[
  {
    "path": ".gitignore",
    "content": "test/\nnode_modules/\n.idea\n.DS_Store\n.outjs"
  },
  {
    "path": ".npmignore",
    "content": "test/\nnode_modules/\n.idea\n.DS_Store\n.outjs\n\nsrc/\nbuildtool/\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2014 Vladimir Kharlampidi\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
  },
  {
    "path": "README.md",
    "content": "# AndroidUIX\n[中文文档](https://github.com/linfaxin/AndroidUIX/blob/master/README_cn.md)\n\nMake a high-performance web app with Android UI.\n\nSite: http://linfaxin.github.io/AndroidUIX/\n\n\n### Feature\n\n1. Native app experience & performance.\n2. Render with web canvas, high-performance web app.\n3. Same api as Android, you can find its question & usage on the internet.\n\n\n### Getting Started \n\nLook wiki: [Getting Started](https://github.com/linfaxin/AndroidUIX/wiki/1.-Getting-Started)\n\n\n### 60fps\n\nthe sample app's fps:\n\n1. IOS: 50-60fps\n2. Android Chrome: 50fps\n3. Android WebView(with [Runtime](https://github.com/linfaxin/AndroidUIRuntimeAndroid)): 50fps\n\nYou can test [Showcase](http://androiduix.com/showcase/index.html) on your device.\n\n\n### Showcase\n\n* [Showcase](http://linfaxin.github.io/AndroidUIX/showcase/index.html)\n\n\n\n### LICENSE\n\nMIT.\n"
  },
  {
    "path": "README_cn.md",
    "content": "# AndroidUIX\n\n移植Android的UI组件到Web端, 以Android的方式来制作高性能优体验的WebApp\n\n网站: http://linfaxin.github.io/AndroidUIX\n\n\n### 特点\n\n1. 完整Native端组件体验\n2. 使用Web Canvas绘制界面\n3. 与Android SDK相同的API，相关用法和问题都可以在网络轻易找到。\n\n### 开始\n\n[快速起步](https://github.com/linfaxin/AndroidUIX/wiki/%E4%B8%AD%E6%96%87_1.-%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B)\n\n### 60fps\n\nSample页在移动端的fps:\n\n1. IOS: 50-60fps\n2. Android Chrome: 50fps\n3. Android WebView(App嵌入[Runtime](https://github.com/linfaxin/AndroidUIRuntimeAndroid)运行时): 50fps\n\n你也可以在自己的手机浏览器上测试 [Showcase](http://androiduix.com/showcase/index.html)。\n\n### Showcase\n\n* [Showcase](http://linfaxin.github.io/AndroidUIX/showcase/index.html)\n\n\n### LICENSE\n\nMIT.\n"
  },
  {
    "path": "buildtool/README.md",
    "content": "### AndroidUIX Modified Note\n\nThe packed typescript's 'checkClassPropertyAccess' was closed, so you can access private/protected property out a class.\n"
  },
  {
    "path": "buildtool/typescript/bin/tsc",
    "content": "#!/usr/bin/env node\nrequire('../lib/tsc.js')\n"
  },
  {
    "path": "buildtool/typescript/bin/tsserver",
    "content": "#!/usr/bin/env node\nrequire('../lib/tsserver.js')\n"
  },
  {
    "path": "buildtool/typescript/lib/lib.d.ts",
    "content": "/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved. \nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0  \n \nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, \nMERCHANTABLITY OR NON-INFRINGEMENT. \n \nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n\n\n\n/// <reference no-default-lib=\"true\"/>\n\n\n/////////////////////////////\n/// ECMAScript APIs\n/////////////////////////////\n\ndeclare const NaN: number;\ndeclare const Infinity: number;\n\n/**\n  * Evaluates JavaScript code and executes it.\n  * @param x A String value that contains valid JavaScript code.\n  */\ndeclare function eval(x: string): any;\n\n/**\n  * Converts A string to an integer.\n  * @param s A string to convert into a number.\n  * @param radix A value between 2 and 36 that specifies the base of the number in numString.\n  * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\n  * All other strings are considered decimal.\n  */\ndeclare function parseInt(s: string, radix?: number): number;\n\n/**\n  * Converts a string to a floating-point number.\n  * @param string A string that contains a floating-point number.\n  */\ndeclare function parseFloat(string: string): number;\n\n/**\n  * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).\n  * @param number A numeric value.\n  */\ndeclare function isNaN(number: number): boolean;\n\n/**\n  * Determines whether a supplied number is finite.\n  * @param number Any numeric value.\n  */\ndeclare function isFinite(number: number): boolean;\n\n/**\n  * Gets the unencoded version of an encoded Uniform Resource Identifier (URI).\n  * @param encodedURI A value representing an encoded URI.\n  */\ndeclare function decodeURI(encodedURI: string): string;\n\n/**\n  * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).\n  * @param encodedURIComponent A value representing an encoded URI component.\n  */\ndeclare function decodeURIComponent(encodedURIComponent: string): string;\n\n/**\n  * Encodes a text string as a valid Uniform Resource Identifier (URI)\n  * @param uri A value representing an encoded URI.\n  */\ndeclare function encodeURI(uri: string): string;\n\n/**\n  * Encodes a text string as a valid component of a Uniform Resource Identifier (URI).\n  * @param uriComponent A value representing an encoded URI component.\n  */\ndeclare function encodeURIComponent(uriComponent: string): string;\n\ninterface PropertyDescriptor {\n    configurable?: boolean;\n    enumerable?: boolean;\n    value?: any;\n    writable?: boolean;\n    get? (): any;\n    set? (v: any): void;\n}\n\ninterface PropertyDescriptorMap {\n    [s: string]: PropertyDescriptor;\n}\n\ninterface Object {\n    /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */\n    constructor: Function;\n\n    /** Returns a string representation of an object. */\n    toString(): string;\n\n    /** Returns a date converted to a string using the current locale. */\n    toLocaleString(): string;\n\n    /** Returns the primitive value of the specified object. */\n    valueOf(): Object;\n\n    /**\n      * Determines whether an object has a property with the specified name.\n      * @param v A property name.\n      */\n    hasOwnProperty(v: string): boolean;\n\n    /**\n      * Determines whether an object exists in another object's prototype chain.\n      * @param v Another object whose prototype chain is to be checked.\n      */\n    isPrototypeOf(v: Object): boolean;\n\n    /**\n      * Determines whether a specified property is enumerable.\n      * @param v A property name.\n      */\n    propertyIsEnumerable(v: string): boolean;\n}\n\ninterface ObjectConstructor {\n    new (value?: any): Object;\n    (): any;\n    (value: any): any;\n\n    /** A reference to the prototype for a class of objects. */\n    readonly prototype: Object;\n\n    /**\n      * Returns the prototype of an object.\n      * @param o The object that references the prototype.\n      */\n    getPrototypeOf(o: any): any;\n\n    /**\n      * Gets the own property descriptor of the specified object.\n      * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype.\n      * @param o Object that contains the property.\n      * @param p Name of the property.\n    */\n    getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor;\n\n    /**\n      * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly\n      * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions.\n      * @param o Object that contains the own properties.\n      */\n    getOwnPropertyNames(o: any): string[];\n\n    /**\n      * Creates an object that has null prototype.\n      * @param o Object to use as a prototype. May be null\n      */\n    create(o: null): any;\n\n    /**\n      * Creates an object that has the specified prototype, and that optionally contains specified properties.\n      * @param o Object to use as a prototype. May be null\n      */\n    create<T>(o: T): T;\n\n    /**\n      * Creates an object that has the specified prototype, and that optionally contains specified properties.\n      * @param o Object to use as a prototype. May be null\n      * @param properties JavaScript object that contains one or more property descriptors.\n      */\n    create(o: any, properties: PropertyDescriptorMap): any;\n\n    /**\n      * Adds a property to an object, or modifies attributes of an existing property.\n      * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object.\n      * @param p The property name.\n      * @param attributes Descriptor for the property. It can be for a data property or an accessor property.\n      */\n    defineProperty(o: any, p: string, attributes: PropertyDescriptor): any;\n\n    /**\n      * Adds one or more properties to an object, and/or modifies attributes of existing properties.\n      * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object.\n      * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property.\n      */\n    defineProperties(o: any, properties: PropertyDescriptorMap): any;\n\n    /**\n      * Prevents the modification of attributes of existing properties, and prevents the addition of new properties.\n      * @param o Object on which to lock the attributes.\n      */\n    seal<T>(o: T): T;\n\n    /**\n      * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.\n      * @param o Object on which to lock the attributes.\n      */\n    freeze<T>(a: T[]): ReadonlyArray<T>;\n\n    /**\n      * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.\n      * @param o Object on which to lock the attributes.\n      */\n    freeze<T extends Function>(f: T): T;\n\n    /**\n      * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.\n      * @param o Object on which to lock the attributes.\n      */\n    freeze<T>(o: T): Readonly<T>;\n\n    /**\n      * Prevents the addition of new properties to an object.\n      * @param o Object to make non-extensible.\n      */\n    preventExtensions<T>(o: T): T;\n\n    /**\n      * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object.\n      * @param o Object to test.\n      */\n    isSealed(o: any): boolean;\n\n    /**\n      * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object.\n      * @param o Object to test.\n      */\n    isFrozen(o: any): boolean;\n\n    /**\n      * Returns a value that indicates whether new properties can be added to an object.\n      * @param o Object to test.\n      */\n    isExtensible(o: any): boolean;\n\n    /**\n      * Returns the names of the enumerable properties and methods of an object.\n      * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.\n      */\n    keys(o: any): string[];\n}\n\n/**\n  * Provides functionality common to all JavaScript objects.\n  */\ndeclare const Object: ObjectConstructor;\n\n/**\n  * Creates a new function.\n  */\ninterface Function {\n    /**\n      * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function.\n      * @param thisArg The object to be used as the this object.\n      * @param argArray A set of arguments to be passed to the function.\n      */\n    apply(this: Function, thisArg: any, argArray?: any): any;\n\n    /**\n      * Calls a method of an object, substituting another object for the current object.\n      * @param thisArg The object to be used as the current object.\n      * @param argArray A list of arguments to be passed to the method.\n      */\n    call(this: Function, thisArg: any, ...argArray: any[]): any;\n\n    /**\n      * For a given function, creates a bound function that has the same body as the original function.\n      * The this object of the bound function is associated with the specified object, and has the specified initial parameters.\n      * @param thisArg An object to which the this keyword can refer inside the new function.\n      * @param argArray A list of arguments to be passed to the new function.\n      */\n    bind(this: Function, thisArg: any, ...argArray: any[]): any;\n\n    /** Returns a string representation of a function. */\n    toString(): string;\n\n    prototype: any;\n    readonly length: number;\n\n    // Non-standard extensions\n    arguments: any;\n    caller: Function;\n}\n\ninterface FunctionConstructor {\n    /**\n      * Creates a new function.\n      * @param args A list of arguments the function accepts.\n      */\n    new (...args: string[]): Function;\n    (...args: string[]): Function;\n    readonly prototype: Function;\n}\n\ndeclare const Function: FunctionConstructor;\n\ninterface IArguments {\n    [index: number]: any;\n    length: number;\n    callee: Function;\n}\n\ninterface String {\n    /** Returns a string representation of a string. */\n    toString(): string;\n\n    /**\n      * Returns the character at the specified index.\n      * @param pos The zero-based index of the desired character.\n      */\n    charAt(pos: number): string;\n\n    /**\n      * Returns the Unicode value of the character at the specified location.\n      * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.\n      */\n    charCodeAt(index: number): number;\n\n    /**\n      * Returns a string that contains the concatenation of two or more strings.\n      * @param strings The strings to append to the end of the string.\n      */\n    concat(...strings: string[]): string;\n\n    /**\n      * Returns the position of the first occurrence of a substring.\n      * @param searchString The substring to search for in the string\n      * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string.\n      */\n    indexOf(searchString: string, position?: number): number;\n\n    /**\n      * Returns the last occurrence of a substring in the string.\n      * @param searchString The substring to search for.\n      * @param position The index at which to begin searching. If omitted, the search begins at the end of the string.\n      */\n    lastIndexOf(searchString: string, position?: number): number;\n\n    /**\n      * Determines whether two strings are equivalent in the current locale.\n      * @param that String to compare to target string\n      */\n    localeCompare(that: string): number;\n\n    /**\n      * Matches a string with a regular expression, and returns an array containing the results of that search.\n      * @param regexp A variable name or string literal containing the regular expression pattern and flags.\n      */\n    match(regexp: string): RegExpMatchArray | null;\n\n    /**\n      * Matches a string with a regular expression, and returns an array containing the results of that search.\n      * @param regexp A regular expression object that contains the regular expression pattern and applicable flags.\n      */\n    match(regexp: RegExp): RegExpMatchArray | null;\n\n    /**\n      * Replaces text in a string, using a regular expression or search string.\n      * @param searchValue A string that represents the regular expression.\n      * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.\n      */\n    replace(searchValue: string, replaceValue: string): string;\n\n    /**\n      * Replaces text in a string, using a regular expression or search string.\n      * @param searchValue A string that represents the regular expression.\n      * @param replacer A function that returns the replacement text.\n      */\n    replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string;\n\n    /**\n      * Replaces text in a string, using a regular expression or search string.\n      * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags.\n      * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.\n      */\n    replace(searchValue: RegExp, replaceValue: string): string;\n\n    /**\n      * Replaces text in a string, using a regular expression or search string.\n      * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags\n      * @param replacer A function that returns the replacement text.\n      */\n    replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string;\n\n    /**\n      * Finds the first substring match in a regular expression search.\n      * @param regexp The regular expression pattern and applicable flags.\n      */\n    search(regexp: string): number;\n\n    /**\n      * Finds the first substring match in a regular expression search.\n      * @param regexp The regular expression pattern and applicable flags.\n      */\n    search(regexp: RegExp): number;\n\n    /**\n      * Returns a section of a string.\n      * @param start The index to the beginning of the specified portion of stringObj.\n      * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end.\n      * If this value is not specified, the substring continues to the end of stringObj.\n      */\n    slice(start?: number, end?: number): string;\n\n    /**\n      * Split a string into substrings using the specified separator and return them as an array.\n      * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.\n      * @param limit A value used to limit the number of elements returned in the array.\n      */\n    split(separator: string, limit?: number): string[];\n\n    /**\n      * Split a string into substrings using the specified separator and return them as an array.\n      * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.\n      * @param limit A value used to limit the number of elements returned in the array.\n      */\n    split(separator: RegExp, limit?: number): string[];\n\n    /**\n      * Returns the substring at the specified location within a String object.\n      * @param start The zero-based index number indicating the beginning of the substring.\n      * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end.\n      * If end is omitted, the characters from start through the end of the original string are returned.\n      */\n    substring(start: number, end?: number): string;\n\n    /** Converts all the alphabetic characters in a string to lowercase. */\n    toLowerCase(): string;\n\n    /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */\n    toLocaleLowerCase(): string;\n\n    /** Converts all the alphabetic characters in a string to uppercase. */\n    toUpperCase(): string;\n\n    /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */\n    toLocaleUpperCase(): string;\n\n    /** Removes the leading and trailing white space and line terminator characters from a string. */\n    trim(): string;\n\n    /** Returns the length of a String object. */\n    readonly length: number;\n\n    // IE extensions\n    /**\n      * Gets a substring beginning at the specified location and having the specified length.\n      * @param from The starting position of the desired substring. The index of the first character in the string is zero.\n      * @param length The number of characters to include in the returned substring.\n      */\n    substr(from: number, length?: number): string;\n\n    /** Returns the primitive value of the specified object. */\n    valueOf(): string;\n\n    readonly [index: number]: string;\n}\n\ninterface StringConstructor {\n    new (value?: any): String;\n    (value?: any): string;\n    readonly prototype: String;\n    fromCharCode(...codes: number[]): string;\n}\n\n/**\n  * Allows manipulation and formatting of text strings and determination and location of substrings within strings.\n  */\ndeclare const String: StringConstructor;\n\ninterface Boolean {\n    /** Returns the primitive value of the specified object. */\n    valueOf(): boolean;\n}\n\ninterface BooleanConstructor {\n    new (value?: any): Boolean;\n    (value?: any): boolean;\n    readonly prototype: Boolean;\n}\n\ndeclare const Boolean: BooleanConstructor;\n\ninterface Number {\n    /**\n      * Returns a string representation of an object.\n      * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers.\n      */\n    toString(radix?: number): string;\n\n    /**\n      * Returns a string representing a number in fixed-point notation.\n      * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.\n      */\n    toFixed(fractionDigits?: number): string;\n\n    /**\n      * Returns a string containing a number represented in exponential notation.\n      * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.\n      */\n    toExponential(fractionDigits?: number): string;\n\n    /**\n      * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits.\n      * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive.\n      */\n    toPrecision(precision?: number): string;\n\n    /** Returns the primitive value of the specified object. */\n    valueOf(): number;\n}\n\ninterface NumberConstructor {\n    new (value?: any): Number;\n    (value?: any): number;\n    readonly prototype: Number;\n\n    /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */\n    readonly MAX_VALUE: number;\n\n    /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */\n    readonly MIN_VALUE: number;\n\n    /**\n      * A value that is not a number.\n      * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function.\n      */\n    readonly NaN: number;\n\n    /**\n      * A value that is less than the largest negative number that can be represented in JavaScript.\n      * JavaScript displays NEGATIVE_INFINITY values as -infinity.\n      */\n    readonly NEGATIVE_INFINITY: number;\n\n    /**\n      * A value greater than the largest number that can be represented in JavaScript.\n      * JavaScript displays POSITIVE_INFINITY values as infinity.\n      */\n    readonly POSITIVE_INFINITY: number;\n}\n\n/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */\ndeclare const Number: NumberConstructor;\n\ninterface TemplateStringsArray extends ReadonlyArray<string> {\n    readonly raw: ReadonlyArray<string>\n}\n\ninterface Math {\n    /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */\n    readonly E: number;\n    /** The natural logarithm of 10. */\n    readonly LN10: number;\n    /** The natural logarithm of 2. */\n    readonly LN2: number;\n    /** The base-2 logarithm of e. */\n    readonly LOG2E: number;\n    /** The base-10 logarithm of e. */\n    readonly LOG10E: number;\n    /** Pi. This is the ratio of the circumference of a circle to its diameter. */\n    readonly PI: number;\n    /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */\n    readonly SQRT1_2: number;\n    /** The square root of 2. */\n    readonly SQRT2: number;\n    /**\n      * Returns the absolute value of a number (the value without regard to whether it is positive or negative).\n      * For example, the absolute value of -5 is the same as the absolute value of 5.\n      * @param x A numeric expression for which the absolute value is needed.\n      */\n    abs(x: number): number;\n    /**\n      * Returns the arc cosine (or inverse cosine) of a number.\n      * @param x A numeric expression.\n      */\n    acos(x: number): number;\n    /**\n      * Returns the arcsine of a number.\n      * @param x A numeric expression.\n      */\n    asin(x: number): number;\n    /**\n      * Returns the arctangent of a number.\n      * @param x A numeric expression for which the arctangent is needed.\n      */\n    atan(x: number): number;\n    /**\n      * Returns the angle (in radians) from the X axis to a point.\n      * @param y A numeric expression representing the cartesian y-coordinate.\n      * @param x A numeric expression representing the cartesian x-coordinate.\n      */\n    atan2(y: number, x: number): number;\n    /**\n      * Returns the smallest number greater than or equal to its numeric argument.\n      * @param x A numeric expression.\n      */\n    ceil(x: number): number;\n    /**\n      * Returns the cosine of a number.\n      * @param x A numeric expression that contains an angle measured in radians.\n      */\n    cos(x: number): number;\n    /**\n      * Returns e (the base of natural logarithms) raised to a power.\n      * @param x A numeric expression representing the power of e.\n      */\n    exp(x: number): number;\n    /**\n      * Returns the greatest number less than or equal to its numeric argument.\n      * @param x A numeric expression.\n      */\n    floor(x: number): number;\n    /**\n      * Returns the natural logarithm (base e) of a number.\n      * @param x A numeric expression.\n      */\n    log(x: number): number;\n    /**\n      * Returns the larger of a set of supplied numeric expressions.\n      * @param values Numeric expressions to be evaluated.\n      */\n    max(...values: number[]): number;\n    /**\n      * Returns the smaller of a set of supplied numeric expressions.\n      * @param values Numeric expressions to be evaluated.\n      */\n    min(...values: number[]): number;\n    /**\n      * Returns the value of a base expression taken to a specified power.\n      * @param x The base value of the expression.\n      * @param y The exponent value of the expression.\n      */\n    pow(x: number, y: number): number;\n    /** Returns a pseudorandom number between 0 and 1. */\n    random(): number;\n    /**\n      * Returns a supplied numeric expression rounded to the nearest number.\n      * @param x The value to be rounded to the nearest number.\n      */\n    round(x: number): number;\n    /**\n      * Returns the sine of a number.\n      * @param x A numeric expression that contains an angle measured in radians.\n      */\n    sin(x: number): number;\n    /**\n      * Returns the square root of a number.\n      * @param x A numeric expression.\n      */\n    sqrt(x: number): number;\n    /**\n      * Returns the tangent of a number.\n      * @param x A numeric expression that contains an angle measured in radians.\n      */\n    tan(x: number): number;\n}\n/** An intrinsic object that provides basic mathematics functionality and constants. */\ndeclare const Math: Math;\n\n/** Enables basic storage and retrieval of dates and times. */\ninterface Date {\n    /** Returns a string representation of a date. The format of the string depends on the locale. */\n    toString(): string;\n    /** Returns a date as a string value. */\n    toDateString(): string;\n    /** Returns a time as a string value. */\n    toTimeString(): string;\n    /** Returns a value as a string value appropriate to the host environment's current locale. */\n    toLocaleString(): string;\n    /** Returns a date as a string value appropriate to the host environment's current locale. */\n    toLocaleDateString(): string;\n    /** Returns a time as a string value appropriate to the host environment's current locale. */\n    toLocaleTimeString(): string;\n    /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */\n    valueOf(): number;\n    /** Gets the time value in milliseconds. */\n    getTime(): number;\n    /** Gets the year, using local time. */\n    getFullYear(): number;\n    /** Gets the year using Universal Coordinated Time (UTC). */\n    getUTCFullYear(): number;\n    /** Gets the month, using local time. */\n    getMonth(): number;\n    /** Gets the month of a Date object using Universal Coordinated Time (UTC). */\n    getUTCMonth(): number;\n    /** Gets the day-of-the-month, using local time. */\n    getDate(): number;\n    /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */\n    getUTCDate(): number;\n    /** Gets the day of the week, using local time. */\n    getDay(): number;\n    /** Gets the day of the week using Universal Coordinated Time (UTC). */\n    getUTCDay(): number;\n    /** Gets the hours in a date, using local time. */\n    getHours(): number;\n    /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */\n    getUTCHours(): number;\n    /** Gets the minutes of a Date object, using local time. */\n    getMinutes(): number;\n    /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */\n    getUTCMinutes(): number;\n    /** Gets the seconds of a Date object, using local time. */\n    getSeconds(): number;\n    /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */\n    getUTCSeconds(): number;\n    /** Gets the milliseconds of a Date, using local time. */\n    getMilliseconds(): number;\n    /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */\n    getUTCMilliseconds(): number;\n    /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */\n    getTimezoneOffset(): number;\n    /**\n      * Sets the date and time value in the Date object.\n      * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT.\n      */\n    setTime(time: number): number;\n    /**\n      * Sets the milliseconds value in the Date object using local time.\n      * @param ms A numeric value equal to the millisecond value.\n      */\n    setMilliseconds(ms: number): number;\n    /**\n      * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).\n      * @param ms A numeric value equal to the millisecond value.\n      */\n    setUTCMilliseconds(ms: number): number;\n\n    /**\n      * Sets the seconds value in the Date object using local time.\n      * @param sec A numeric value equal to the seconds value.\n      * @param ms A numeric value equal to the milliseconds value.\n      */\n    setSeconds(sec: number, ms?: number): number;\n    /**\n      * Sets the seconds value in the Date object using Universal Coordinated Time (UTC).\n      * @param sec A numeric value equal to the seconds value.\n      * @param ms A numeric value equal to the milliseconds value.\n      */\n    setUTCSeconds(sec: number, ms?: number): number;\n    /**\n      * Sets the minutes value in the Date object using local time.\n      * @param min A numeric value equal to the minutes value.\n      * @param sec A numeric value equal to the seconds value.\n      * @param ms A numeric value equal to the milliseconds value.\n      */\n    setMinutes(min: number, sec?: number, ms?: number): number;\n    /**\n      * Sets the minutes value in the Date object using Universal Coordinated Time (UTC).\n      * @param min A numeric value equal to the minutes value.\n      * @param sec A numeric value equal to the seconds value.\n      * @param ms A numeric value equal to the milliseconds value.\n      */\n    setUTCMinutes(min: number, sec?: number, ms?: number): number;\n    /**\n      * Sets the hour value in the Date object using local time.\n      * @param hours A numeric value equal to the hours value.\n      * @param min A numeric value equal to the minutes value.\n      * @param sec A numeric value equal to the seconds value.\n      * @param ms A numeric value equal to the milliseconds value.\n      */\n    setHours(hours: number, min?: number, sec?: number, ms?: number): number;\n    /**\n      * Sets the hours value in the Date object using Universal Coordinated Time (UTC).\n      * @param hours A numeric value equal to the hours value.\n      * @param min A numeric value equal to the minutes value.\n      * @param sec A numeric value equal to the seconds value.\n      * @param ms A numeric value equal to the milliseconds value.\n      */\n    setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number;\n    /**\n      * Sets the numeric day-of-the-month value of the Date object using local time.\n      * @param date A numeric value equal to the day of the month.\n      */\n    setDate(date: number): number;\n    /**\n      * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).\n      * @param date A numeric value equal to the day of the month.\n      */\n    setUTCDate(date: number): number;\n    /**\n      * Sets the month value in the Date object using local time.\n      * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.\n      * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used.\n      */\n    setMonth(month: number, date?: number): number;\n    /**\n      * Sets the month value in the Date object using Universal Coordinated Time (UTC).\n      * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.\n      * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used.\n      */\n    setUTCMonth(month: number, date?: number): number;\n    /**\n      * Sets the year of the Date object using local time.\n      * @param year A numeric value for the year.\n      * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified.\n      * @param date A numeric value equal for the day of the month.\n      */\n    setFullYear(year: number, month?: number, date?: number): number;\n    /**\n      * Sets the year value in the Date object using Universal Coordinated Time (UTC).\n      * @param year A numeric value equal to the year.\n      * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied.\n      * @param date A numeric value equal to the day of the month.\n      */\n    setUTCFullYear(year: number, month?: number, date?: number): number;\n    /** Returns a date converted to a string using Universal Coordinated Time (UTC). */\n    toUTCString(): string;\n    /** Returns a date as a string value in ISO format. */\n    toISOString(): string;\n    /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */\n    toJSON(key?: any): string;\n}\n\ninterface DateConstructor {\n    new (): Date;\n    new (value: number): Date;\n    new (value: string): Date;\n    new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;\n    (): string;\n    readonly prototype: Date;\n    /**\n      * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970.\n      * @param s A date string\n      */\n    parse(s: string): number;\n    /**\n      * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.\n      * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.\n      * @param month The month as an number between 0 and 11 (January to December).\n      * @param date The date as an number between 1 and 31.\n      * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour.\n      * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes.\n      * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds.\n      * @param ms An number from 0 to 999 that specifies the milliseconds.\n      */\n    UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number;\n    now(): number;\n}\n\ndeclare const Date: DateConstructor;\n\ninterface RegExpMatchArray extends Array<string> {\n    index?: number;\n    input?: string;\n}\n\ninterface RegExpExecArray extends Array<string> {\n    index: number;\n    input: string;\n}\n\ninterface RegExp {\n    /**\n      * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search.\n      * @param string The String object or string literal on which to perform the search.\n      */\n    exec(string: string): RegExpExecArray | null;\n\n    /**\n      * Returns a Boolean value that indicates whether or not a pattern exists in a searched string.\n      * @param string String on which to perform the search.\n      */\n    test(string: string): boolean;\n\n    /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */\n    readonly source: string;\n\n    /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */\n    readonly global: boolean;\n\n    /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */\n    readonly ignoreCase: boolean;\n\n    /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */\n    readonly multiline: boolean;\n\n    lastIndex: number;\n\n    // Non-standard extensions\n    compile(): this;\n}\n\ninterface RegExpConstructor {\n    new (pattern: RegExp): RegExp;\n    new (pattern: string, flags?: string): RegExp;\n    (pattern: RegExp): RegExp;\n    (pattern: string, flags?: string): RegExp;\n    readonly prototype: RegExp;\n\n    // Non-standard extensions\n    $1: string;\n    $2: string;\n    $3: string;\n    $4: string;\n    $5: string;\n    $6: string;\n    $7: string;\n    $8: string;\n    $9: string;\n    lastMatch: string;\n}\n\ndeclare const RegExp: RegExpConstructor;\n\ninterface Error {\n    name: string;\n    message: string;\n    stack?: string;\n}\n\ninterface ErrorConstructor {\n    new (message?: string): Error;\n    (message?: string): Error;\n    readonly prototype: Error;\n}\n\ndeclare const Error: ErrorConstructor;\n\ninterface EvalError extends Error {\n}\n\ninterface EvalErrorConstructor {\n    new (message?: string): EvalError;\n    (message?: string): EvalError;\n    readonly prototype: EvalError;\n}\n\ndeclare const EvalError: EvalErrorConstructor;\n\ninterface RangeError extends Error {\n}\n\ninterface RangeErrorConstructor {\n    new (message?: string): RangeError;\n    (message?: string): RangeError;\n    readonly prototype: RangeError;\n}\n\ndeclare const RangeError: RangeErrorConstructor;\n\ninterface ReferenceError extends Error {\n}\n\ninterface ReferenceErrorConstructor {\n    new (message?: string): ReferenceError;\n    (message?: string): ReferenceError;\n    readonly prototype: ReferenceError;\n}\n\ndeclare const ReferenceError: ReferenceErrorConstructor;\n\ninterface SyntaxError extends Error {\n}\n\ninterface SyntaxErrorConstructor {\n    new (message?: string): SyntaxError;\n    (message?: string): SyntaxError;\n    readonly prototype: SyntaxError;\n}\n\ndeclare const SyntaxError: SyntaxErrorConstructor;\n\ninterface TypeError extends Error {\n}\n\ninterface TypeErrorConstructor {\n    new (message?: string): TypeError;\n    (message?: string): TypeError;\n    readonly prototype: TypeError;\n}\n\ndeclare const TypeError: TypeErrorConstructor;\n\ninterface URIError extends Error {\n}\n\ninterface URIErrorConstructor {\n    new (message?: string): URIError;\n    (message?: string): URIError;\n    readonly prototype: URIError;\n}\n\ndeclare const URIError: URIErrorConstructor;\n\ninterface JSON {\n    /**\n      * Converts a JavaScript Object Notation (JSON) string into an object.\n      * @param text A valid JSON string.\n      * @param reviver A function that transforms the results. This function is called for each member of the object.\n      * If a member contains nested objects, the nested objects are transformed before the parent object is.\n      */\n    parse(text: string, reviver?: (key: any, value: any) => any): any;\n    /**\n      * Converts a JavaScript value to a JavaScript Object Notation (JSON) string.\n      * @param value A JavaScript value, usually an object or array, to be converted.\n      * @param replacer A function that transforms the results.\n      * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.\n      */\n    stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string;\n    /**\n      * Converts a JavaScript value to a JavaScript Object Notation (JSON) string.\n      * @param value A JavaScript value, usually an object or array, to be converted.\n      * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified.\n      * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.\n      */\n    stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string;\n}\n\n/**\n  * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.\n  */\ndeclare const JSON: JSON;\n\n\n/////////////////////////////\n/// ECMAScript Array API (specially handled by compiler)\n/////////////////////////////\n\ninterface ReadonlyArray<T> {\n    /**\n      * Gets the length of the array. This is a number one higher than the highest element defined in an array.\n      */\n    readonly length: number;\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n    toLocaleString(): string;\n    /**\n      * Combines two or more arrays.\n      * @param items Additional items to add to the end of array1.\n      */\n    concat<U extends ReadonlyArray<T>>(...items: U[]): T[];\n    /**\n      * Combines two or more arrays.\n      * @param items Additional items to add to the end of array1.\n      */\n    concat(...items: T[][]): T[];\n    /**\n      * Combines two or more arrays.\n      * @param items Additional items to add to the end of array1.\n      */\n    concat(...items: (T | T[])[]): T[];\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): T[];\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\n      */\n    indexOf(searchElement: T, fromIndex?: number): number;\n\n    /**\n      * Returns the index of the last occurrence of a specified value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.\n      */\n    lastIndexOf(searchElement: T, fromIndex?: number): number;\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => boolean, thisArg?: any): boolean;\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => boolean, thisArg?: any): boolean;\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => void, thisArg?: any): void;\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    map<U>(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => U, thisArg?: any): U[];\n    /**\n     * Returns the elements of an array that meet the condition specified in a callback function.\n     * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.\n     * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n     */\n    filter<S extends T>(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => value is S, thisArg?: any): S[];\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => any, thisArg?: any): T[];\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray<T>) => T, initialValue?: T): T;\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray<T>) => U, initialValue: U): U;\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray<T>) => T, initialValue?: T): T;\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray<T>) => U, initialValue: U): U;\n\n    readonly [n: number]: T;\n}\n\ninterface Array<T> {\n    /**\n      * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.\n      */\n    length: number;\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n    toLocaleString(): string;\n    /**\n      * Appends new elements to an array, and returns the new length of the array.\n      * @param items New elements of the Array.\n      */\n    push(...items: T[]): number;\n    /**\n      * Removes the last element from an array and returns it.\n      */\n    pop(): T | undefined;\n    /**\n      * Combines two or more arrays.\n      * @param items Additional items to add to the end of array1.\n      */\n    concat(...items: T[][]): T[];\n    /**\n      * Combines two or more arrays.\n      * @param items Additional items to add to the end of array1.\n      */\n    concat(...items: (T | T[])[]): T[];\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): T[];\n    /**\n      * Removes the first element from an array and returns it.\n      */\n    shift(): T | undefined;\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): T[];\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: T, b: T) => number): this;\n    /**\n      * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.\n      * @param start The zero-based location in the array from which to start removing elements.\n      */\n    splice(start: number): T[];\n    /**\n      * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.\n      * @param start The zero-based location in the array from which to start removing elements.\n      * @param deleteCount The number of elements to remove.\n      * @param items Elements to insert into the array in place of the deleted elements.\n      */\n    splice(start: number, deleteCount: number, ...items: T[]): T[];\n    /**\n      * Inserts new elements at the start of an array.\n      * @param items  Elements to insert at the start of the Array.\n      */\n    unshift(...items: T[]): number;\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\n      */\n    indexOf(searchElement: T, fromIndex?: number): number;\n    /**\n      * Returns the index of the last occurrence of a specified value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.\n      */\n    lastIndexOf(searchElement: T, fromIndex?: number): number;\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    map<U>(this: [T, T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U, U];\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    map<U>(this: [T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U];\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    map<U>(this: [T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U];\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    map<U>(this: [T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U];\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[];\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;\n\n    [n: number]: T;\n}\n\ninterface ArrayConstructor {\n    new (arrayLength?: number): any[];\n    new <T>(arrayLength: number): T[];\n    new <T>(...items: T[]): T[];\n    (arrayLength?: number): any[];\n    <T>(arrayLength: number): T[];\n    <T>(...items: T[]): T[];\n    isArray(arg: any): arg is Array<any>;\n    readonly prototype: Array<any>;\n}\n\ndeclare const Array: ArrayConstructor;\n\ninterface TypedPropertyDescriptor<T> {\n    enumerable?: boolean;\n    configurable?: boolean;\n    writable?: boolean;\n    value?: T;\n    get?: () => T;\n    set?: (value: T) => void;\n}\n\ndeclare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;\ndeclare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;\ndeclare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;\ndeclare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;\n\ndeclare type PromiseConstructorLike = new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void) => PromiseLike<T>;\n\ninterface PromiseLike<T> {\n    /**\n     * Attaches callbacks for the resolution and/or rejection of the Promise.\n     * @param onfulfilled The callback to execute when the Promise is resolved.\n     * @param onrejected The callback to execute when the Promise is rejected.\n     * @returns A Promise for the completion of which ever callback is executed.\n     */\n    then(\n        onfulfilled?: ((value: T) => T | PromiseLike<T>) | undefined | null,\n        onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): PromiseLike<T>;\n\n    /**\n     * Attaches callbacks for the resolution and/or rejection of the Promise.\n     * @param onfulfilled The callback to execute when the Promise is resolved.\n     * @param onrejected The callback to execute when the Promise is rejected.\n     * @returns A Promise for the completion of which ever callback is executed.\n     */\n    then<TResult>(\n        onfulfilled: ((value: T) => T | PromiseLike<T>) | undefined | null,\n        onrejected: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<T | TResult>;\n\n    /**\n     * Attaches callbacks for the resolution and/or rejection of the Promise.\n     * @param onfulfilled The callback to execute when the Promise is resolved.\n     * @param onrejected The callback to execute when the Promise is rejected.\n     * @returns A Promise for the completion of which ever callback is executed.\n     */\n    then<TResult>(\n        onfulfilled: (value: T) => TResult | PromiseLike<TResult>,\n        onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): PromiseLike<TResult>;\n\n    /**\n     * Attaches callbacks for the resolution and/or rejection of the Promise.\n     * @param onfulfilled The callback to execute when the Promise is resolved.\n     * @param onrejected The callback to execute when the Promise is rejected.\n     * @returns A Promise for the completion of which ever callback is executed.\n     */\n    then<TResult1, TResult2>(\n        onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>,\n        onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): PromiseLike<TResult1 | TResult2>;\n}\n\ninterface ArrayLike<T> {\n    readonly length: number;\n    readonly [n: number]: T;\n}\n\n/**\n * Make all properties in T optional\n */\ntype Partial<T> = {\n    [P in keyof T]?: T[P];\n};\n\n/**\n * Make all properties in T readonly\n */\ntype Readonly<T> = {\n    readonly [P in keyof T]: T[P];\n};\n\n/**\n * From T pick a set of properties K\n */\ntype Pick<T, K extends keyof T> = {\n    [P in K]: T[P];\n}\n\n/**\n * Construct a type with a set of properties K of type T\n */\ntype Record<K extends string, T> = {\n    [P in K]: T;\n}\n\n/**\n  * Represents a raw buffer of binary data, which is used to store data for the\n  * different typed arrays. ArrayBuffers cannot be read from or written to directly,\n  * but can be passed to a typed array or DataView Object to interpret the raw\n  * buffer as needed.\n  */\ninterface ArrayBuffer {\n    /**\n      * Read-only. The length of the ArrayBuffer (in bytes).\n      */\n    readonly byteLength: number;\n\n    /**\n      * Returns a section of an ArrayBuffer.\n      */\n    slice(begin:number, end?:number): ArrayBuffer;\n}\n\ninterface ArrayBufferConstructor {\n    readonly prototype: ArrayBuffer;\n    new (byteLength: number): ArrayBuffer;\n    isView(arg: any): arg is ArrayBufferView;\n}\ndeclare const ArrayBuffer: ArrayBufferConstructor;\n\ninterface ArrayBufferView {\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    byteOffset: number;\n}\n\ninterface DataView {\n    readonly buffer: ArrayBuffer;\n    readonly byteLength: number;\n    readonly byteOffset: number;\n    /**\n      * Gets the Float32 value at the specified byte offset from the start of the view. There is\n      * no alignment constraint; multi-byte values may be fetched from any offset.\n      * @param byteOffset The place in the buffer at which the value should be retrieved.\n      */\n    getFloat32(byteOffset: number, littleEndian?: boolean): number;\n\n    /**\n      * Gets the Float64 value at the specified byte offset from the start of the view. There is\n      * no alignment constraint; multi-byte values may be fetched from any offset.\n      * @param byteOffset The place in the buffer at which the value should be retrieved.\n      */\n    getFloat64(byteOffset: number, littleEndian?: boolean): number;\n\n    /**\n      * Gets the Int8 value at the specified byte offset from the start of the view. There is\n      * no alignment constraint; multi-byte values may be fetched from any offset.\n      * @param byteOffset The place in the buffer at which the value should be retrieved.\n      */\n    getInt8(byteOffset: number): number;\n\n    /**\n      * Gets the Int16 value at the specified byte offset from the start of the view. There is\n      * no alignment constraint; multi-byte values may be fetched from any offset.\n      * @param byteOffset The place in the buffer at which the value should be retrieved.\n      */\n    getInt16(byteOffset: number, littleEndian?: boolean): number;\n    /**\n      * Gets the Int32 value at the specified byte offset from the start of the view. There is\n      * no alignment constraint; multi-byte values may be fetched from any offset.\n      * @param byteOffset The place in the buffer at which the value should be retrieved.\n      */\n    getInt32(byteOffset: number, littleEndian?: boolean): number;\n\n    /**\n      * Gets the Uint8 value at the specified byte offset from the start of the view. There is\n      * no alignment constraint; multi-byte values may be fetched from any offset.\n      * @param byteOffset The place in the buffer at which the value should be retrieved.\n      */\n    getUint8(byteOffset: number): number;\n\n    /**\n      * Gets the Uint16 value at the specified byte offset from the start of the view. There is\n      * no alignment constraint; multi-byte values may be fetched from any offset.\n      * @param byteOffset The place in the buffer at which the value should be retrieved.\n      */\n    getUint16(byteOffset: number, littleEndian?: boolean): number;\n\n    /**\n      * Gets the Uint32 value at the specified byte offset from the start of the view. There is\n      * no alignment constraint; multi-byte values may be fetched from any offset.\n      * @param byteOffset The place in the buffer at which the value should be retrieved.\n      */\n    getUint32(byteOffset: number, littleEndian?: boolean): number;\n\n    /**\n      * Stores an Float32 value at the specified byte offset from the start of the view.\n      * @param byteOffset The place in the buffer at which the value should be set.\n      * @param value The value to set.\n      * @param littleEndian If false or undefined, a big-endian value should be written,\n      * otherwise a little-endian value should be written.\n      */\n    setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n    /**\n      * Stores an Float64 value at the specified byte offset from the start of the view.\n      * @param byteOffset The place in the buffer at which the value should be set.\n      * @param value The value to set.\n      * @param littleEndian If false or undefined, a big-endian value should be written,\n      * otherwise a little-endian value should be written.\n      */\n    setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n    /**\n      * Stores an Int8 value at the specified byte offset from the start of the view.\n      * @param byteOffset The place in the buffer at which the value should be set.\n      * @param value The value to set.\n      */\n    setInt8(byteOffset: number, value: number): void;\n\n    /**\n      * Stores an Int16 value at the specified byte offset from the start of the view.\n      * @param byteOffset The place in the buffer at which the value should be set.\n      * @param value The value to set.\n      * @param littleEndian If false or undefined, a big-endian value should be written,\n      * otherwise a little-endian value should be written.\n      */\n    setInt16(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n    /**\n      * Stores an Int32 value at the specified byte offset from the start of the view.\n      * @param byteOffset The place in the buffer at which the value should be set.\n      * @param value The value to set.\n      * @param littleEndian If false or undefined, a big-endian value should be written,\n      * otherwise a little-endian value should be written.\n      */\n    setInt32(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n    /**\n      * Stores an Uint8 value at the specified byte offset from the start of the view.\n      * @param byteOffset The place in the buffer at which the value should be set.\n      * @param value The value to set.\n      */\n    setUint8(byteOffset: number, value: number): void;\n\n    /**\n      * Stores an Uint16 value at the specified byte offset from the start of the view.\n      * @param byteOffset The place in the buffer at which the value should be set.\n      * @param value The value to set.\n      * @param littleEndian If false or undefined, a big-endian value should be written,\n      * otherwise a little-endian value should be written.\n      */\n    setUint16(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n    /**\n      * Stores an Uint32 value at the specified byte offset from the start of the view.\n      * @param byteOffset The place in the buffer at which the value should be set.\n      * @param value The value to set.\n      * @param littleEndian If false or undefined, a big-endian value should be written,\n      * otherwise a little-endian value should be written.\n      */\n    setUint32(byteOffset: number, value: number, littleEndian?: boolean): void;\n}\n\ninterface DataViewConstructor {\n    new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;\n}\ndeclare const DataView: DataViewConstructor;\n\n/**\n  * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested\n  * number of bytes could not be allocated an exception is raised.\n  */\ninterface Int8Array {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Int8Array;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: ArrayLike<number>, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Int8Array;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Int8Array;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\ninterface Int8ArrayConstructor {\n    readonly prototype: Int8Array;\n    new (length: number): Int8Array;\n    new (array: ArrayLike<number>): Int8Array;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Int8Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array;\n\n}\ndeclare const Int8Array: Int8ArrayConstructor;\n\n/**\n  * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the\n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Uint8Array {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Uint8Array;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: ArrayLike<number>, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Uint8Array;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Uint8Array;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\n\ninterface Uint8ArrayConstructor {\n    readonly prototype: Uint8Array;\n    new (length: number): Uint8Array;\n    new (array: ArrayLike<number>): Uint8Array;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Uint8Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array;\n\n}\ndeclare const Uint8Array: Uint8ArrayConstructor;\n\n/**\n  * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.\n  * If the requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Uint8ClampedArray {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Uint8ClampedArray;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: Uint8ClampedArray, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Uint8ClampedArray;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Uint8ClampedArray;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\n\ninterface Uint8ClampedArrayConstructor {\n    readonly prototype: Uint8ClampedArray;\n    new (length: number): Uint8ClampedArray;\n    new (array: ArrayLike<number>): Uint8ClampedArray;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Uint8ClampedArray;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray;\n}\ndeclare const Uint8ClampedArray: Uint8ClampedArrayConstructor;\n\n/**\n  * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the\n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Int16Array {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Int16Array;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: ArrayLike<number>, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Int16Array;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Int16Array;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\n\ninterface Int16ArrayConstructor {\n    readonly prototype: Int16Array;\n    new (length: number): Int16Array;\n    new (array: ArrayLike<number>): Int16Array;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Int16Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array;\n\n}\ndeclare const Int16Array: Int16ArrayConstructor;\n\n/**\n  * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the\n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Uint16Array {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Uint16Array;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: ArrayLike<number>, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Uint16Array;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Uint16Array;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\n\ninterface Uint16ArrayConstructor {\n    readonly prototype: Uint16Array;\n    new (length: number): Uint16Array;\n    new (array: ArrayLike<number>): Uint16Array;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Uint16Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array;\n\n}\ndeclare const Uint16Array: Uint16ArrayConstructor;\n/**\n  * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the\n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Int32Array {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Int32Array;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: ArrayLike<number>, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Int32Array;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Int32Array;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\n\ninterface Int32ArrayConstructor {\n    readonly prototype: Int32Array;\n    new (length: number): Int32Array;\n    new (array: ArrayLike<number>): Int32Array;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Int32Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array;\n}\ndeclare const Int32Array: Int32ArrayConstructor;\n\n/**\n  * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the\n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Uint32Array {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Uint32Array;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: ArrayLike<number>, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Uint32Array;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Uint32Array;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\n\ninterface Uint32ArrayConstructor {\n    readonly prototype: Uint32Array;\n    new (length: number): Uint32Array;\n    new (array: ArrayLike<number>): Uint32Array;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Uint32Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array;\n}\ndeclare const Uint32Array: Uint32ArrayConstructor;\n\n/**\n  * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\n  * of bytes could not be allocated an exception is raised.\n  */\ninterface Float32Array {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Float32Array;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: ArrayLike<number>, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Float32Array;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Float32Array;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\n\ninterface Float32ArrayConstructor {\n    readonly prototype: Float32Array;\n    new (length: number): Float32Array;\n    new (array: ArrayLike<number>): Float32Array;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Float32Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array;\n\n}\ndeclare const Float32Array: Float32ArrayConstructor;\n\n/**\n  * A typed array of 64-bit float values. The contents are initialized to 0. If the requested\n  * number of bytes could not be allocated an exception is raised.\n  */\ninterface Float64Array {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Float64Array;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: ArrayLike<number>, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Float64Array;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Float64Array;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\n\ninterface Float64ArrayConstructor {\n    readonly prototype: Float64Array;\n    new (length: number): Float64Array;\n    new (array: ArrayLike<number>): Float64Array;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Float64Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;\n}\ndeclare const Float64Array: Float64ArrayConstructor;\n\n/////////////////////////////\n/// ECMAScript Internationalization API\n/////////////////////////////\n\ndeclare module Intl {\n    interface CollatorOptions {\n        usage?: string;\n        localeMatcher?: string;\n        numeric?: boolean;\n        caseFirst?: string;\n        sensitivity?: string;\n        ignorePunctuation?: boolean;\n    }\n\n    interface ResolvedCollatorOptions {\n        locale: string;\n        usage: string;\n        sensitivity: string;\n        ignorePunctuation: boolean;\n        collation: string;\n        caseFirst: string;\n        numeric: boolean;\n    }\n\n    interface Collator {\n        compare(x: string, y: string): number;\n        resolvedOptions(): ResolvedCollatorOptions;\n    }\n    var Collator: {\n        new (locales?: string | string[], options?: CollatorOptions): Collator;\n        (locales?: string | string[], options?: CollatorOptions): Collator;\n        supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[];\n    }\n\n    interface NumberFormatOptions {\n        localeMatcher?: string;\n        style?: string;\n        currency?: string;\n        currencyDisplay?: string;\n        useGrouping?: boolean;\n        minimumIntegerDigits?: number;\n        minimumFractionDigits?: number;\n        maximumFractionDigits?: number;\n        minimumSignificantDigits?: number;\n        maximumSignificantDigits?: number;\n    }\n\n    interface ResolvedNumberFormatOptions {\n        locale: string;\n        numberingSystem: string;\n        style: string;\n        currency?: string;\n        currencyDisplay?: string;\n        minimumIntegerDigits: number;\n        minimumFractionDigits: number;\n        maximumFractionDigits: number;\n        minimumSignificantDigits?: number;\n        maximumSignificantDigits?: number;\n        useGrouping: boolean;\n    }\n\n    interface NumberFormat {\n        format(value: number): string;\n        resolvedOptions(): ResolvedNumberFormatOptions;\n    }\n    var NumberFormat: {\n        new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;\n        (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;\n        supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[];\n    }\n\n    interface DateTimeFormatOptions {\n        localeMatcher?: string;\n        weekday?: string;\n        era?: string;\n        year?: string;\n        month?: string;\n        day?: string;\n        hour?: string;\n        minute?: string;\n        second?: string;\n        timeZoneName?: string;\n        formatMatcher?: string;\n        hour12?: boolean;\n        timeZone?: string;\n    }\n\n    interface ResolvedDateTimeFormatOptions {\n        locale: string;\n        calendar: string;\n        numberingSystem: string;\n        timeZone: string;\n        hour12?: boolean;\n        weekday?: string;\n        era?: string;\n        year?: string;\n        month?: string;\n        day?: string;\n        hour?: string;\n        minute?: string;\n        second?: string;\n        timeZoneName?: string;\n    }\n\n    interface DateTimeFormat {\n        format(date?: Date | number): string;\n        resolvedOptions(): ResolvedDateTimeFormatOptions;\n    }\n    var DateTimeFormat: {\n        new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;\n        (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;\n        supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[];\n    }\n}\n\ninterface String {\n    /**\n      * Determines whether two strings are equivalent in the current or specified locale.\n      * @param that String to compare to target string\n      * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.\n      * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.\n      */\n    localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number;\n}\n\ninterface Number {\n    /**\n      * Converts a number to a string by using the current or specified locale.\n      * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n      * @param options An object that contains one or more properties that specify comparison options.\n      */\n    toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;\n}\n\ninterface Date {\n    /**\n      * Converts a date and time to a string by using the current or specified locale.\n      * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n      * @param options An object that contains one or more properties that specify comparison options.\n      */\n    toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;\n    /**\n      * Converts a date to a string by using the current or specified locale.\n      * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n      * @param options An object that contains one or more properties that specify comparison options.\n      */\n    toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;\n\n    /**\n      * Converts a time to a string by using the current or specified locale.\n      * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n      * @param options An object that contains one or more properties that specify comparison options.\n      */\n    toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;\n}\n\n\n\n/////////////////////////////\n/// IE DOM APIs\n/////////////////////////////\n\ninterface Algorithm {\n    name: string;\n}\n\ninterface AriaRequestEventInit extends EventInit {\n    attributeName?: string;\n    attributeValue?: string;\n}\n\ninterface CommandEventInit extends EventInit {\n    commandName?: string;\n    detail?: string;\n}\n\ninterface CompositionEventInit extends UIEventInit {\n    data?: string;\n}\n\ninterface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation {\n    arrayOfDomainStrings?: string[];\n}\n\ninterface ConstrainBooleanParameters {\n    exact?: boolean;\n    ideal?: boolean;\n}\n\ninterface ConstrainDOMStringParameters {\n    exact?: string | string[];\n    ideal?: string | string[];\n}\n\ninterface ConstrainDoubleRange extends DoubleRange {\n    exact?: number;\n    ideal?: number;\n}\n\ninterface ConstrainLongRange extends LongRange {\n    exact?: number;\n    ideal?: number;\n}\n\ninterface ConstrainVideoFacingModeParameters {\n    exact?: string | string[];\n    ideal?: string | string[];\n}\n\ninterface CustomEventInit extends EventInit {\n    detail?: any;\n}\n\ninterface DeviceAccelerationDict {\n    x?: number;\n    y?: number;\n    z?: number;\n}\n\ninterface DeviceLightEventInit extends EventInit {\n    value?: number;\n}\n\ninterface DeviceRotationRateDict {\n    alpha?: number;\n    beta?: number;\n    gamma?: number;\n}\n\ninterface DoubleRange {\n    max?: number;\n    min?: number;\n}\n\ninterface EventInit {\n    scoped?: boolean;\n    bubbles?: boolean;\n    cancelable?: boolean;\n}\n\ninterface EventModifierInit extends UIEventInit {\n    ctrlKey?: boolean;\n    shiftKey?: boolean;\n    altKey?: boolean;\n    metaKey?: boolean;\n    modifierAltGraph?: boolean;\n    modifierCapsLock?: boolean;\n    modifierFn?: boolean;\n    modifierFnLock?: boolean;\n    modifierHyper?: boolean;\n    modifierNumLock?: boolean;\n    modifierOS?: boolean;\n    modifierScrollLock?: boolean;\n    modifierSuper?: boolean;\n    modifierSymbol?: boolean;\n    modifierSymbolLock?: boolean;\n}\n\ninterface ExceptionInformation {\n    domain?: string;\n}\n\ninterface FocusEventInit extends UIEventInit {\n    relatedTarget?: EventTarget;\n}\n\ninterface HashChangeEventInit extends EventInit {\n    newURL?: string;\n    oldURL?: string;\n}\n\ninterface IDBIndexParameters {\n    multiEntry?: boolean;\n    unique?: boolean;\n}\n\ninterface IDBObjectStoreParameters {\n    autoIncrement?: boolean;\n    keyPath?: IDBKeyPath;\n}\n\ninterface KeyAlgorithm {\n    name?: string;\n}\n\ninterface KeyboardEventInit extends EventModifierInit {\n    code?: string;\n    key?: string;\n    location?: number;\n    repeat?: boolean;\n}\n\ninterface LongRange {\n    max?: number;\n    min?: number;\n}\n\ninterface MSAccountInfo {\n    rpDisplayName?: string;\n    userDisplayName?: string;\n    accountName?: string;\n    userId?: string;\n    accountImageUri?: string;\n}\n\ninterface MSAudioLocalClientEvent extends MSLocalClientEventBase {\n    networkSendQualityEventRatio?: number;\n    networkDelayEventRatio?: number;\n    cpuInsufficientEventRatio?: number;\n    deviceHalfDuplexAECEventRatio?: number;\n    deviceRenderNotFunctioningEventRatio?: number;\n    deviceCaptureNotFunctioningEventRatio?: number;\n    deviceGlitchesEventRatio?: number;\n    deviceLowSNREventRatio?: number;\n    deviceLowSpeechLevelEventRatio?: number;\n    deviceClippingEventRatio?: number;\n    deviceEchoEventRatio?: number;\n    deviceNearEndToEchoRatioEventRatio?: number;\n    deviceRenderZeroVolumeEventRatio?: number;\n    deviceRenderMuteEventRatio?: number;\n    deviceMultipleEndpointsEventCount?: number;\n    deviceHowlingEventCount?: number;\n}\n\ninterface MSAudioRecvPayload extends MSPayloadBase {\n    samplingRate?: number;\n    signal?: MSAudioRecvSignal;\n    packetReorderRatio?: number;\n    packetReorderDepthAvg?: number;\n    packetReorderDepthMax?: number;\n    burstLossLength1?: number;\n    burstLossLength2?: number;\n    burstLossLength3?: number;\n    burstLossLength4?: number;\n    burstLossLength5?: number;\n    burstLossLength6?: number;\n    burstLossLength7?: number;\n    burstLossLength8OrHigher?: number;\n    fecRecvDistance1?: number;\n    fecRecvDistance2?: number;\n    fecRecvDistance3?: number;\n    ratioConcealedSamplesAvg?: number;\n    ratioStretchedSamplesAvg?: number;\n    ratioCompressedSamplesAvg?: number;\n}\n\ninterface MSAudioRecvSignal {\n    initialSignalLevelRMS?: number;\n    recvSignalLevelCh1?: number;\n    recvNoiseLevelCh1?: number;\n    renderSignalLevel?: number;\n    renderNoiseLevel?: number;\n    renderLoopbackSignalLevel?: number;\n}\n\ninterface MSAudioSendPayload extends MSPayloadBase {\n    samplingRate?: number;\n    signal?: MSAudioSendSignal;\n    audioFECUsed?: boolean;\n    sendMutePercent?: number;\n}\n\ninterface MSAudioSendSignal {\n    noiseLevel?: number;\n    sendSignalLevelCh1?: number;\n    sendNoiseLevelCh1?: number;\n}\n\ninterface MSConnectivity {\n    iceType?: string;\n    iceWarningFlags?: MSIceWarningFlags;\n    relayAddress?: MSRelayAddress;\n}\n\ninterface MSCredentialFilter {\n    accept?: MSCredentialSpec[];\n}\n\ninterface MSCredentialParameters {\n    type?: string;\n}\n\ninterface MSCredentialSpec {\n    type?: string;\n    id?: string;\n}\n\ninterface MSDelay {\n    roundTrip?: number;\n    roundTripMax?: number;\n}\n\ninterface MSDescription extends RTCStats {\n    connectivity?: MSConnectivity;\n    transport?: string;\n    networkconnectivity?: MSNetworkConnectivityInfo;\n    localAddr?: MSIPAddressInfo;\n    remoteAddr?: MSIPAddressInfo;\n    deviceDevName?: string;\n    reflexiveLocalIPAddr?: MSIPAddressInfo;\n}\n\ninterface MSFIDOCredentialParameters extends MSCredentialParameters {\n    algorithm?: string | Algorithm;\n    authenticators?: AAGUID[];\n}\n\ninterface MSIPAddressInfo {\n    ipAddr?: string;\n    port?: number;\n    manufacturerMacAddrMask?: string;\n}\n\ninterface MSIceWarningFlags {\n    turnTcpTimedOut?: boolean;\n    turnUdpAllocateFailed?: boolean;\n    turnUdpSendFailed?: boolean;\n    turnTcpAllocateFailed?: boolean;\n    turnTcpSendFailed?: boolean;\n    udpLocalConnectivityFailed?: boolean;\n    udpNatConnectivityFailed?: boolean;\n    udpRelayConnectivityFailed?: boolean;\n    tcpNatConnectivityFailed?: boolean;\n    tcpRelayConnectivityFailed?: boolean;\n    connCheckMessageIntegrityFailed?: boolean;\n    allocationMessageIntegrityFailed?: boolean;\n    connCheckOtherError?: boolean;\n    turnAuthUnknownUsernameError?: boolean;\n    noRelayServersConfigured?: boolean;\n    multipleRelayServersAttempted?: boolean;\n    portRangeExhausted?: boolean;\n    alternateServerReceived?: boolean;\n    pseudoTLSFailure?: boolean;\n    turnTurnTcpConnectivityFailed?: boolean;\n    useCandidateChecksFailed?: boolean;\n    fipsAllocationFailure?: boolean;\n}\n\ninterface MSJitter {\n    interArrival?: number;\n    interArrivalMax?: number;\n    interArrivalSD?: number;\n}\n\ninterface MSLocalClientEventBase extends RTCStats {\n    networkReceiveQualityEventRatio?: number;\n    networkBandwidthLowEventRatio?: number;\n}\n\ninterface MSNetwork extends RTCStats {\n    jitter?: MSJitter;\n    delay?: MSDelay;\n    packetLoss?: MSPacketLoss;\n    utilization?: MSUtilization;\n}\n\ninterface MSNetworkConnectivityInfo {\n    vpn?: boolean;\n    linkspeed?: number;\n    networkConnectionDetails?: string;\n}\n\ninterface MSNetworkInterfaceType {\n    interfaceTypeEthernet?: boolean;\n    interfaceTypeWireless?: boolean;\n    interfaceTypePPP?: boolean;\n    interfaceTypeTunnel?: boolean;\n    interfaceTypeWWAN?: boolean;\n}\n\ninterface MSOutboundNetwork extends MSNetwork {\n    appliedBandwidthLimit?: number;\n}\n\ninterface MSPacketLoss {\n    lossRate?: number;\n    lossRateMax?: number;\n}\n\ninterface MSPayloadBase extends RTCStats {\n    payloadDescription?: string;\n}\n\ninterface MSRelayAddress {\n    relayAddress?: string;\n    port?: number;\n}\n\ninterface MSSignatureParameters {\n    userPrompt?: string;\n}\n\ninterface MSTransportDiagnosticsStats extends RTCStats {\n    baseAddress?: string;\n    localAddress?: string;\n    localSite?: string;\n    networkName?: string;\n    remoteAddress?: string;\n    remoteSite?: string;\n    localMR?: string;\n    remoteMR?: string;\n    iceWarningFlags?: MSIceWarningFlags;\n    portRangeMin?: number;\n    portRangeMax?: number;\n    localMRTCPPort?: number;\n    remoteMRTCPPort?: number;\n    stunVer?: number;\n    numConsentReqSent?: number;\n    numConsentReqReceived?: number;\n    numConsentRespSent?: number;\n    numConsentRespReceived?: number;\n    interfaces?: MSNetworkInterfaceType;\n    baseInterface?: MSNetworkInterfaceType;\n    protocol?: string;\n    localInterface?: MSNetworkInterfaceType;\n    localAddrType?: string;\n    remoteAddrType?: string;\n    iceRole?: string;\n    rtpRtcpMux?: boolean;\n    allocationTimeInMs?: number;\n    msRtcEngineVersion?: string;\n}\n\ninterface MSUtilization {\n    packets?: number;\n    bandwidthEstimation?: number;\n    bandwidthEstimationMin?: number;\n    bandwidthEstimationMax?: number;\n    bandwidthEstimationStdDev?: number;\n    bandwidthEstimationAvg?: number;\n}\n\ninterface MSVideoPayload extends MSPayloadBase {\n    resoluton?: string;\n    videoBitRateAvg?: number;\n    videoBitRateMax?: number;\n    videoFrameRateAvg?: number;\n    videoPacketLossRate?: number;\n    durationSeconds?: number;\n}\n\ninterface MSVideoRecvPayload extends MSVideoPayload {\n    videoFrameLossRate?: number;\n    recvCodecType?: string;\n    recvResolutionWidth?: number;\n    recvResolutionHeight?: number;\n    videoResolutions?: MSVideoResolutionDistribution;\n    recvFrameRateAverage?: number;\n    recvBitRateMaximum?: number;\n    recvBitRateAverage?: number;\n    recvVideoStreamsMax?: number;\n    recvVideoStreamsMin?: number;\n    recvVideoStreamsMode?: number;\n    videoPostFECPLR?: number;\n    lowBitRateCallPercent?: number;\n    lowFrameRateCallPercent?: number;\n    reorderBufferTotalPackets?: number;\n    recvReorderBufferReorderedPackets?: number;\n    recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number;\n    recvReorderBufferMaxSuccessfullyOrderedExtent?: number;\n    recvReorderBufferMaxSuccessfullyOrderedLateTime?: number;\n    recvReorderBufferPacketsDroppedDueToTimeout?: number;\n    recvFpsHarmonicAverage?: number;\n    recvNumResSwitches?: number;\n}\n\ninterface MSVideoResolutionDistribution {\n    cifQuality?: number;\n    vgaQuality?: number;\n    h720Quality?: number;\n    h1080Quality?: number;\n    h1440Quality?: number;\n    h2160Quality?: number;\n}\n\ninterface MSVideoSendPayload extends MSVideoPayload {\n    sendFrameRateAverage?: number;\n    sendBitRateMaximum?: number;\n    sendBitRateAverage?: number;\n    sendVideoStreamsMax?: number;\n    sendResolutionWidth?: number;\n    sendResolutionHeight?: number;\n}\n\ninterface MediaEncryptedEventInit extends EventInit {\n    initDataType?: string;\n    initData?: ArrayBuffer;\n}\n\ninterface MediaKeyMessageEventInit extends EventInit {\n    messageType?: string;\n    message?: ArrayBuffer;\n}\n\ninterface MediaKeySystemConfiguration {\n    initDataTypes?: string[];\n    audioCapabilities?: MediaKeySystemMediaCapability[];\n    videoCapabilities?: MediaKeySystemMediaCapability[];\n    distinctiveIdentifier?: string;\n    persistentState?: string;\n}\n\ninterface MediaKeySystemMediaCapability {\n    contentType?: string;\n    robustness?: string;\n}\n\ninterface MediaStreamConstraints {\n    video?: boolean | MediaTrackConstraints;\n    audio?: boolean | MediaTrackConstraints;\n}\n\ninterface MediaStreamErrorEventInit extends EventInit {\n    error?: MediaStreamError;\n}\n\ninterface MediaStreamTrackEventInit extends EventInit {\n    track?: MediaStreamTrack;\n}\n\ninterface MediaTrackCapabilities {\n    width?: number | LongRange;\n    height?: number | LongRange;\n    aspectRatio?: number | DoubleRange;\n    frameRate?: number | DoubleRange;\n    facingMode?: string;\n    volume?: number | DoubleRange;\n    sampleRate?: number | LongRange;\n    sampleSize?: number | LongRange;\n    echoCancellation?: boolean[];\n    deviceId?: string;\n    groupId?: string;\n}\n\ninterface MediaTrackConstraintSet {\n    width?: number | ConstrainLongRange;\n    height?: number | ConstrainLongRange;\n    aspectRatio?: number | ConstrainDoubleRange;\n    frameRate?: number | ConstrainDoubleRange;\n    facingMode?: string | string[] | ConstrainDOMStringParameters;\n    volume?: number | ConstrainDoubleRange;\n    sampleRate?: number | ConstrainLongRange;\n    sampleSize?: number | ConstrainLongRange;\n    echoCancelation?: boolean | ConstrainBooleanParameters;\n    deviceId?: string | string[] | ConstrainDOMStringParameters;\n    groupId?: string | string[] | ConstrainDOMStringParameters;\n}\n\ninterface MediaTrackConstraints extends MediaTrackConstraintSet {\n    advanced?: MediaTrackConstraintSet[];\n}\n\ninterface MediaTrackSettings {\n    width?: number;\n    height?: number;\n    aspectRatio?: number;\n    frameRate?: number;\n    facingMode?: string;\n    volume?: number;\n    sampleRate?: number;\n    sampleSize?: number;\n    echoCancellation?: boolean;\n    deviceId?: string;\n    groupId?: string;\n}\n\ninterface MediaTrackSupportedConstraints {\n    width?: boolean;\n    height?: boolean;\n    aspectRatio?: boolean;\n    frameRate?: boolean;\n    facingMode?: boolean;\n    volume?: boolean;\n    sampleRate?: boolean;\n    sampleSize?: boolean;\n    echoCancellation?: boolean;\n    deviceId?: boolean;\n    groupId?: boolean;\n}\n\ninterface MouseEventInit extends EventModifierInit {\n    screenX?: number;\n    screenY?: number;\n    clientX?: number;\n    clientY?: number;\n    button?: number;\n    buttons?: number;\n    relatedTarget?: EventTarget;\n}\n\ninterface MsZoomToOptions {\n    contentX?: number;\n    contentY?: number;\n    viewportX?: string;\n    viewportY?: string;\n    scaleFactor?: number;\n    animate?: string;\n}\n\ninterface MutationObserverInit {\n    childList?: boolean;\n    attributes?: boolean;\n    characterData?: boolean;\n    subtree?: boolean;\n    attributeOldValue?: boolean;\n    characterDataOldValue?: boolean;\n    attributeFilter?: string[];\n}\n\ninterface ObjectURLOptions {\n    oneTimeOnly?: boolean;\n}\n\ninterface PeriodicWaveConstraints {\n    disableNormalization?: boolean;\n}\n\ninterface PointerEventInit extends MouseEventInit {\n    pointerId?: number;\n    width?: number;\n    height?: number;\n    pressure?: number;\n    tiltX?: number;\n    tiltY?: number;\n    pointerType?: string;\n    isPrimary?: boolean;\n}\n\ninterface PositionOptions {\n    enableHighAccuracy?: boolean;\n    timeout?: number;\n    maximumAge?: number;\n}\n\ninterface RTCDTMFToneChangeEventInit extends EventInit {\n    tone?: string;\n}\n\ninterface RTCDtlsFingerprint {\n    algorithm?: string;\n    value?: string;\n}\n\ninterface RTCDtlsParameters {\n    role?: string;\n    fingerprints?: RTCDtlsFingerprint[];\n}\n\ninterface RTCIceCandidate {\n    foundation?: string;\n    priority?: number;\n    ip?: string;\n    protocol?: string;\n    port?: number;\n    type?: string;\n    tcpType?: string;\n    relatedAddress?: string;\n    relatedPort?: number;\n}\n\ninterface RTCIceCandidateAttributes extends RTCStats {\n    ipAddress?: string;\n    portNumber?: number;\n    transport?: string;\n    candidateType?: string;\n    priority?: number;\n    addressSourceUrl?: string;\n}\n\ninterface RTCIceCandidateComplete {\n}\n\ninterface RTCIceCandidatePair {\n    local?: RTCIceCandidate;\n    remote?: RTCIceCandidate;\n}\n\ninterface RTCIceCandidatePairStats extends RTCStats {\n    transportId?: string;\n    localCandidateId?: string;\n    remoteCandidateId?: string;\n    state?: string;\n    priority?: number;\n    nominated?: boolean;\n    writable?: boolean;\n    readable?: boolean;\n    bytesSent?: number;\n    bytesReceived?: number;\n    roundTripTime?: number;\n    availableOutgoingBitrate?: number;\n    availableIncomingBitrate?: number;\n}\n\ninterface RTCIceGatherOptions {\n    gatherPolicy?: string;\n    iceservers?: RTCIceServer[];\n}\n\ninterface RTCIceParameters {\n    usernameFragment?: string;\n    password?: string;\n}\n\ninterface RTCIceServer {\n    urls?: any;\n    username?: string;\n    credential?: string;\n}\n\ninterface RTCInboundRTPStreamStats extends RTCRTPStreamStats {\n    packetsReceived?: number;\n    bytesReceived?: number;\n    packetsLost?: number;\n    jitter?: number;\n    fractionLost?: number;\n}\n\ninterface RTCMediaStreamTrackStats extends RTCStats {\n    trackIdentifier?: string;\n    remoteSource?: boolean;\n    ssrcIds?: string[];\n    frameWidth?: number;\n    frameHeight?: number;\n    framesPerSecond?: number;\n    framesSent?: number;\n    framesReceived?: number;\n    framesDecoded?: number;\n    framesDropped?: number;\n    framesCorrupted?: number;\n    audioLevel?: number;\n    echoReturnLoss?: number;\n    echoReturnLossEnhancement?: number;\n}\n\ninterface RTCOutboundRTPStreamStats extends RTCRTPStreamStats {\n    packetsSent?: number;\n    bytesSent?: number;\n    targetBitrate?: number;\n    roundTripTime?: number;\n}\n\ninterface RTCRTPStreamStats extends RTCStats {\n    ssrc?: string;\n    associateStatsId?: string;\n    isRemote?: boolean;\n    mediaTrackId?: string;\n    transportId?: string;\n    codecId?: string;\n    firCount?: number;\n    pliCount?: number;\n    nackCount?: number;\n    sliCount?: number;\n}\n\ninterface RTCRtcpFeedback {\n    type?: string;\n    parameter?: string;\n}\n\ninterface RTCRtcpParameters {\n    ssrc?: number;\n    cname?: string;\n    reducedSize?: boolean;\n    mux?: boolean;\n}\n\ninterface RTCRtpCapabilities {\n    codecs?: RTCRtpCodecCapability[];\n    headerExtensions?: RTCRtpHeaderExtension[];\n    fecMechanisms?: string[];\n}\n\ninterface RTCRtpCodecCapability {\n    name?: string;\n    kind?: string;\n    clockRate?: number;\n    preferredPayloadType?: number;\n    maxptime?: number;\n    numChannels?: number;\n    rtcpFeedback?: RTCRtcpFeedback[];\n    parameters?: any;\n    options?: any;\n    maxTemporalLayers?: number;\n    maxSpatialLayers?: number;\n    svcMultiStreamSupport?: boolean;\n}\n\ninterface RTCRtpCodecParameters {\n    name?: string;\n    payloadType?: any;\n    clockRate?: number;\n    maxptime?: number;\n    numChannels?: number;\n    rtcpFeedback?: RTCRtcpFeedback[];\n    parameters?: any;\n}\n\ninterface RTCRtpContributingSource {\n    timestamp?: number;\n    csrc?: number;\n    audioLevel?: number;\n}\n\ninterface RTCRtpEncodingParameters {\n    ssrc?: number;\n    codecPayloadType?: number;\n    fec?: RTCRtpFecParameters;\n    rtx?: RTCRtpRtxParameters;\n    priority?: number;\n    maxBitrate?: number;\n    minQuality?: number;\n    framerateBias?: number;\n    resolutionScale?: number;\n    framerateScale?: number;\n    active?: boolean;\n    encodingId?: string;\n    dependencyEncodingIds?: string[];\n    ssrcRange?: RTCSsrcRange;\n}\n\ninterface RTCRtpFecParameters {\n    ssrc?: number;\n    mechanism?: string;\n}\n\ninterface RTCRtpHeaderExtension {\n    kind?: string;\n    uri?: string;\n    preferredId?: number;\n    preferredEncrypt?: boolean;\n}\n\ninterface RTCRtpHeaderExtensionParameters {\n    uri?: string;\n    id?: number;\n    encrypt?: boolean;\n}\n\ninterface RTCRtpParameters {\n    muxId?: string;\n    codecs?: RTCRtpCodecParameters[];\n    headerExtensions?: RTCRtpHeaderExtensionParameters[];\n    encodings?: RTCRtpEncodingParameters[];\n    rtcp?: RTCRtcpParameters;\n}\n\ninterface RTCRtpRtxParameters {\n    ssrc?: number;\n}\n\ninterface RTCRtpUnhandled {\n    ssrc?: number;\n    payloadType?: number;\n    muxId?: string;\n}\n\ninterface RTCSrtpKeyParam {\n    keyMethod?: string;\n    keySalt?: string;\n    lifetime?: string;\n    mkiValue?: number;\n    mkiLength?: number;\n}\n\ninterface RTCSrtpSdesParameters {\n    tag?: number;\n    cryptoSuite?: string;\n    keyParams?: RTCSrtpKeyParam[];\n    sessionParams?: string[];\n}\n\ninterface RTCSsrcRange {\n    min?: number;\n    max?: number;\n}\n\ninterface RTCStats {\n    timestamp?: number;\n    type?: string;\n    id?: string;\n    msType?: string;\n}\n\ninterface RTCStatsReport {\n}\n\ninterface RTCTransportStats extends RTCStats {\n    bytesSent?: number;\n    bytesReceived?: number;\n    rtcpTransportStatsId?: string;\n    activeConnection?: boolean;\n    selectedCandidatePairId?: string;\n    localCertificateId?: string;\n    remoteCertificateId?: string;\n}\n\ninterface StoreExceptionsInformation extends ExceptionInformation {\n    siteName?: string;\n    explanationString?: string;\n    detailURI?: string;\n}\n\ninterface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation {\n    arrayOfDomainStrings?: string[];\n}\n\ninterface UIEventInit extends EventInit {\n    view?: Window;\n    detail?: number;\n}\n\ninterface WebGLContextAttributes {\n    failIfMajorPerformanceCaveat?: boolean;\n    alpha?: boolean;\n    depth?: boolean;\n    stencil?: boolean;\n    antialias?: boolean;\n    premultipliedAlpha?: boolean;\n    preserveDrawingBuffer?: boolean;\n}\n\ninterface WebGLContextEventInit extends EventInit {\n    statusMessage?: string;\n}\n\ninterface WheelEventInit extends MouseEventInit {\n    deltaX?: number;\n    deltaY?: number;\n    deltaZ?: number;\n    deltaMode?: number;\n}\n\ninterface EventListener {\n    (evt: Event): void;\n}\n\ninterface ANGLE_instanced_arrays {\n    drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void;\n    drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void;\n    vertexAttribDivisorANGLE(index: number, divisor: number): void;\n    readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number;\n}\n\ndeclare var ANGLE_instanced_arrays: {\n    prototype: ANGLE_instanced_arrays;\n    new(): ANGLE_instanced_arrays;\n    readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number;\n}\n\ninterface AnalyserNode extends AudioNode {\n    fftSize: number;\n    readonly frequencyBinCount: number;\n    maxDecibels: number;\n    minDecibels: number;\n    smoothingTimeConstant: number;\n    getByteFrequencyData(array: Uint8Array): void;\n    getByteTimeDomainData(array: Uint8Array): void;\n    getFloatFrequencyData(array: Float32Array): void;\n    getFloatTimeDomainData(array: Float32Array): void;\n}\n\ndeclare var AnalyserNode: {\n    prototype: AnalyserNode;\n    new(): AnalyserNode;\n}\n\ninterface AnimationEvent extends Event {\n    readonly animationName: string;\n    readonly elapsedTime: number;\n    initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void;\n}\n\ndeclare var AnimationEvent: {\n    prototype: AnimationEvent;\n    new(): AnimationEvent;\n}\n\ninterface ApplicationCacheEventMap {\n    \"cached\": Event;\n    \"checking\": Event;\n    \"downloading\": Event;\n    \"error\": ErrorEvent;\n    \"noupdate\": Event;\n    \"obsolete\": Event;\n    \"progress\": ProgressEvent;\n    \"updateready\": Event;\n}\n\ninterface ApplicationCache extends EventTarget {\n    oncached: (this: ApplicationCache, ev: Event) => any;\n    onchecking: (this: ApplicationCache, ev: Event) => any;\n    ondownloading: (this: ApplicationCache, ev: Event) => any;\n    onerror: (this: ApplicationCache, ev: ErrorEvent) => any;\n    onnoupdate: (this: ApplicationCache, ev: Event) => any;\n    onobsolete: (this: ApplicationCache, ev: Event) => any;\n    onprogress: (this: ApplicationCache, ev: ProgressEvent) => any;\n    onupdateready: (this: ApplicationCache, ev: Event) => any;\n    readonly status: number;\n    abort(): void;\n    swapCache(): void;\n    update(): void;\n    readonly CHECKING: number;\n    readonly DOWNLOADING: number;\n    readonly IDLE: number;\n    readonly OBSOLETE: number;\n    readonly UNCACHED: number;\n    readonly UPDATEREADY: number;\n    addEventListener<K extends keyof ApplicationCacheEventMap>(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var ApplicationCache: {\n    prototype: ApplicationCache;\n    new(): ApplicationCache;\n    readonly CHECKING: number;\n    readonly DOWNLOADING: number;\n    readonly IDLE: number;\n    readonly OBSOLETE: number;\n    readonly UNCACHED: number;\n    readonly UPDATEREADY: number;\n}\n\ninterface AriaRequestEvent extends Event {\n    readonly attributeName: string;\n    attributeValue: string | null;\n}\n\ndeclare var AriaRequestEvent: {\n    prototype: AriaRequestEvent;\n    new(type: string, eventInitDict?: AriaRequestEventInit): AriaRequestEvent;\n}\n\ninterface Attr extends Node {\n    readonly name: string;\n    readonly ownerElement: Element;\n    readonly prefix: string | null;\n    readonly specified: boolean;\n    value: string;\n}\n\ndeclare var Attr: {\n    prototype: Attr;\n    new(): Attr;\n}\n\ninterface AudioBuffer {\n    readonly duration: number;\n    readonly length: number;\n    readonly numberOfChannels: number;\n    readonly sampleRate: number;\n    copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void;\n    copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void;\n    getChannelData(channel: number): Float32Array;\n}\n\ndeclare var AudioBuffer: {\n    prototype: AudioBuffer;\n    new(): AudioBuffer;\n}\n\ninterface AudioBufferSourceNodeEventMap {\n    \"ended\": MediaStreamErrorEvent;\n}\n\ninterface AudioBufferSourceNode extends AudioNode {\n    buffer: AudioBuffer | null;\n    readonly detune: AudioParam;\n    loop: boolean;\n    loopEnd: number;\n    loopStart: number;\n    onended: (this: AudioBufferSourceNode, ev: MediaStreamErrorEvent) => any;\n    readonly playbackRate: AudioParam;\n    start(when?: number, offset?: number, duration?: number): void;\n    stop(when?: number): void;\n    addEventListener<K extends keyof AudioBufferSourceNodeEventMap>(type: K, listener: (this: AudioBufferSourceNode, ev: AudioBufferSourceNodeEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var AudioBufferSourceNode: {\n    prototype: AudioBufferSourceNode;\n    new(): AudioBufferSourceNode;\n}\n\ninterface AudioContext extends EventTarget {\n    readonly currentTime: number;\n    readonly destination: AudioDestinationNode;\n    readonly listener: AudioListener;\n    readonly sampleRate: number;\n    state: string;\n    createAnalyser(): AnalyserNode;\n    createBiquadFilter(): BiquadFilterNode;\n    createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer;\n    createBufferSource(): AudioBufferSourceNode;\n    createChannelMerger(numberOfInputs?: number): ChannelMergerNode;\n    createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode;\n    createConvolver(): ConvolverNode;\n    createDelay(maxDelayTime?: number): DelayNode;\n    createDynamicsCompressor(): DynamicsCompressorNode;\n    createGain(): GainNode;\n    createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;\n    createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode;\n    createOscillator(): OscillatorNode;\n    createPanner(): PannerNode;\n    createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave;\n    createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;\n    createStereoPanner(): StereoPannerNode;\n    createWaveShaper(): WaveShaperNode;\n    decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike<AudioBuffer>;\n}\n\ndeclare var AudioContext: {\n    prototype: AudioContext;\n    new(): AudioContext;\n}\n\ninterface AudioDestinationNode extends AudioNode {\n    readonly maxChannelCount: number;\n}\n\ndeclare var AudioDestinationNode: {\n    prototype: AudioDestinationNode;\n    new(): AudioDestinationNode;\n}\n\ninterface AudioListener {\n    dopplerFactor: number;\n    speedOfSound: number;\n    setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void;\n    setPosition(x: number, y: number, z: number): void;\n    setVelocity(x: number, y: number, z: number): void;\n}\n\ndeclare var AudioListener: {\n    prototype: AudioListener;\n    new(): AudioListener;\n}\n\ninterface AudioNode extends EventTarget {\n    channelCount: number;\n    channelCountMode: string;\n    channelInterpretation: string;\n    readonly context: AudioContext;\n    readonly numberOfInputs: number;\n    readonly numberOfOutputs: number;\n    connect(destination: AudioNode, output?: number, input?: number): void;\n    disconnect(output?: number): void;\n    disconnect(destination: AudioNode, output?: number, input?: number): void;\n    disconnect(destination: AudioParam, output?: number): void;\n}\n\ndeclare var AudioNode: {\n    prototype: AudioNode;\n    new(): AudioNode;\n}\n\ninterface AudioParam {\n    readonly defaultValue: number;\n    value: number;\n    cancelScheduledValues(startTime: number): void;\n    exponentialRampToValueAtTime(value: number, endTime: number): void;\n    linearRampToValueAtTime(value: number, endTime: number): void;\n    setTargetAtTime(target: number, startTime: number, timeConstant: number): void;\n    setValueAtTime(value: number, startTime: number): void;\n    setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void;\n}\n\ndeclare var AudioParam: {\n    prototype: AudioParam;\n    new(): AudioParam;\n}\n\ninterface AudioProcessingEvent extends Event {\n    readonly inputBuffer: AudioBuffer;\n    readonly outputBuffer: AudioBuffer;\n    readonly playbackTime: number;\n}\n\ndeclare var AudioProcessingEvent: {\n    prototype: AudioProcessingEvent;\n    new(): AudioProcessingEvent;\n}\n\ninterface AudioTrack {\n    enabled: boolean;\n    readonly id: string;\n    kind: string;\n    readonly label: string;\n    language: string;\n    readonly sourceBuffer: SourceBuffer;\n}\n\ndeclare var AudioTrack: {\n    prototype: AudioTrack;\n    new(): AudioTrack;\n}\n\ninterface AudioTrackListEventMap {\n    \"addtrack\": TrackEvent;\n    \"change\": Event;\n    \"removetrack\": TrackEvent;\n}\n\ninterface AudioTrackList extends EventTarget {\n    readonly length: number;\n    onaddtrack: (this: AudioTrackList, ev: TrackEvent) => any;\n    onchange: (this: AudioTrackList, ev: Event) => any;\n    onremovetrack: (this: AudioTrackList, ev: TrackEvent) => any;\n    getTrackById(id: string): AudioTrack | null;\n    item(index: number): AudioTrack;\n    addEventListener<K extends keyof AudioTrackListEventMap>(type: K, listener: (this: AudioTrackList, ev: AudioTrackListEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n    [index: number]: AudioTrack;\n}\n\ndeclare var AudioTrackList: {\n    prototype: AudioTrackList;\n    new(): AudioTrackList;\n}\n\ninterface BarProp {\n    readonly visible: boolean;\n}\n\ndeclare var BarProp: {\n    prototype: BarProp;\n    new(): BarProp;\n}\n\ninterface BeforeUnloadEvent extends Event {\n    returnValue: any;\n}\n\ndeclare var BeforeUnloadEvent: {\n    prototype: BeforeUnloadEvent;\n    new(): BeforeUnloadEvent;\n}\n\ninterface BiquadFilterNode extends AudioNode {\n    readonly Q: AudioParam;\n    readonly detune: AudioParam;\n    readonly frequency: AudioParam;\n    readonly gain: AudioParam;\n    type: string;\n    getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void;\n}\n\ndeclare var BiquadFilterNode: {\n    prototype: BiquadFilterNode;\n    new(): BiquadFilterNode;\n}\n\ninterface Blob {\n    readonly size: number;\n    readonly type: string;\n    msClose(): void;\n    msDetachStream(): any;\n    slice(start?: number, end?: number, contentType?: string): Blob;\n}\n\ndeclare var Blob: {\n    prototype: Blob;\n    new (blobParts?: any[], options?: BlobPropertyBag): Blob;\n}\n\ninterface CDATASection extends Text {\n}\n\ndeclare var CDATASection: {\n    prototype: CDATASection;\n    new(): CDATASection;\n}\n\ninterface CSS {\n    supports(property: string, value?: string): boolean;\n}\ndeclare var CSS: CSS;\n\ninterface CSSConditionRule extends CSSGroupingRule {\n    conditionText: string;\n}\n\ndeclare var CSSConditionRule: {\n    prototype: CSSConditionRule;\n    new(): CSSConditionRule;\n}\n\ninterface CSSFontFaceRule extends CSSRule {\n    readonly style: CSSStyleDeclaration;\n}\n\ndeclare var CSSFontFaceRule: {\n    prototype: CSSFontFaceRule;\n    new(): CSSFontFaceRule;\n}\n\ninterface CSSGroupingRule extends CSSRule {\n    readonly cssRules: CSSRuleList;\n    deleteRule(index: number): void;\n    insertRule(rule: string, index: number): number;\n}\n\ndeclare var CSSGroupingRule: {\n    prototype: CSSGroupingRule;\n    new(): CSSGroupingRule;\n}\n\ninterface CSSImportRule extends CSSRule {\n    readonly href: string;\n    readonly media: MediaList;\n    readonly styleSheet: CSSStyleSheet;\n}\n\ndeclare var CSSImportRule: {\n    prototype: CSSImportRule;\n    new(): CSSImportRule;\n}\n\ninterface CSSKeyframeRule extends CSSRule {\n    keyText: string;\n    readonly style: CSSStyleDeclaration;\n}\n\ndeclare var CSSKeyframeRule: {\n    prototype: CSSKeyframeRule;\n    new(): CSSKeyframeRule;\n}\n\ninterface CSSKeyframesRule extends CSSRule {\n    readonly cssRules: CSSRuleList;\n    name: string;\n    appendRule(rule: string): void;\n    deleteRule(rule: string): void;\n    findRule(rule: string): CSSKeyframeRule;\n}\n\ndeclare var CSSKeyframesRule: {\n    prototype: CSSKeyframesRule;\n    new(): CSSKeyframesRule;\n}\n\ninterface CSSMediaRule extends CSSConditionRule {\n    readonly media: MediaList;\n}\n\ndeclare var CSSMediaRule: {\n    prototype: CSSMediaRule;\n    new(): CSSMediaRule;\n}\n\ninterface CSSNamespaceRule extends CSSRule {\n    readonly namespaceURI: string;\n    readonly prefix: string;\n}\n\ndeclare var CSSNamespaceRule: {\n    prototype: CSSNamespaceRule;\n    new(): CSSNamespaceRule;\n}\n\ninterface CSSPageRule extends CSSRule {\n    readonly pseudoClass: string;\n    readonly selector: string;\n    selectorText: string;\n    readonly style: CSSStyleDeclaration;\n}\n\ndeclare var CSSPageRule: {\n    prototype: CSSPageRule;\n    new(): CSSPageRule;\n}\n\ninterface CSSRule {\n    cssText: string;\n    readonly parentRule: CSSRule;\n    readonly parentStyleSheet: CSSStyleSheet;\n    readonly type: number;\n    readonly CHARSET_RULE: number;\n    readonly FONT_FACE_RULE: number;\n    readonly IMPORT_RULE: number;\n    readonly KEYFRAMES_RULE: number;\n    readonly KEYFRAME_RULE: number;\n    readonly MEDIA_RULE: number;\n    readonly NAMESPACE_RULE: number;\n    readonly PAGE_RULE: number;\n    readonly STYLE_RULE: number;\n    readonly SUPPORTS_RULE: number;\n    readonly UNKNOWN_RULE: number;\n    readonly VIEWPORT_RULE: number;\n}\n\ndeclare var CSSRule: {\n    prototype: CSSRule;\n    new(): CSSRule;\n    readonly CHARSET_RULE: number;\n    readonly FONT_FACE_RULE: number;\n    readonly IMPORT_RULE: number;\n    readonly KEYFRAMES_RULE: number;\n    readonly KEYFRAME_RULE: number;\n    readonly MEDIA_RULE: number;\n    readonly NAMESPACE_RULE: number;\n    readonly PAGE_RULE: number;\n    readonly STYLE_RULE: number;\n    readonly SUPPORTS_RULE: number;\n    readonly UNKNOWN_RULE: number;\n    readonly VIEWPORT_RULE: number;\n}\n\ninterface CSSRuleList {\n    readonly length: number;\n    item(index: number): CSSRule;\n    [index: number]: CSSRule;\n}\n\ndeclare var CSSRuleList: {\n    prototype: CSSRuleList;\n    new(): CSSRuleList;\n}\n\ninterface CSSStyleDeclaration {\n    alignContent: string | null;\n    alignItems: string | null;\n    alignSelf: string | null;\n    alignmentBaseline: string | null;\n    animation: string | null;\n    animationDelay: string | null;\n    animationDirection: string | null;\n    animationDuration: string | null;\n    animationFillMode: string | null;\n    animationIterationCount: string | null;\n    animationName: string | null;\n    animationPlayState: string | null;\n    animationTimingFunction: string | null;\n    backfaceVisibility: string | null;\n    background: string | null;\n    backgroundAttachment: string | null;\n    backgroundClip: string | null;\n    backgroundColor: string | null;\n    backgroundImage: string | null;\n    backgroundOrigin: string | null;\n    backgroundPosition: string | null;\n    backgroundPositionX: string | null;\n    backgroundPositionY: string | null;\n    backgroundRepeat: string | null;\n    backgroundSize: string | null;\n    baselineShift: string | null;\n    border: string | null;\n    borderBottom: string | null;\n    borderBottomColor: string | null;\n    borderBottomLeftRadius: string | null;\n    borderBottomRightRadius: string | null;\n    borderBottomStyle: string | null;\n    borderBottomWidth: string | null;\n    borderCollapse: string | null;\n    borderColor: string | null;\n    borderImage: string | null;\n    borderImageOutset: string | null;\n    borderImageRepeat: string | null;\n    borderImageSlice: string | null;\n    borderImageSource: string | null;\n    borderImageWidth: string | null;\n    borderLeft: string | null;\n    borderLeftColor: string | null;\n    borderLeftStyle: string | null;\n    borderLeftWidth: string | null;\n    borderRadius: string | null;\n    borderRight: string | null;\n    borderRightColor: string | null;\n    borderRightStyle: string | null;\n    borderRightWidth: string | null;\n    borderSpacing: string | null;\n    borderStyle: string | null;\n    borderTop: string | null;\n    borderTopColor: string | null;\n    borderTopLeftRadius: string | null;\n    borderTopRightRadius: string | null;\n    borderTopStyle: string | null;\n    borderTopWidth: string | null;\n    borderWidth: string | null;\n    bottom: string | null;\n    boxShadow: string | null;\n    boxSizing: string | null;\n    breakAfter: string | null;\n    breakBefore: string | null;\n    breakInside: string | null;\n    captionSide: string | null;\n    clear: string | null;\n    clip: string | null;\n    clipPath: string | null;\n    clipRule: string | null;\n    color: string | null;\n    colorInterpolationFilters: string | null;\n    columnCount: any;\n    columnFill: string | null;\n    columnGap: any;\n    columnRule: string | null;\n    columnRuleColor: any;\n    columnRuleStyle: string | null;\n    columnRuleWidth: any;\n    columnSpan: string | null;\n    columnWidth: any;\n    columns: string | null;\n    content: string | null;\n    counterIncrement: string | null;\n    counterReset: string | null;\n    cssFloat: string | null;\n    cssText: string;\n    cursor: string | null;\n    direction: string | null;\n    display: string | null;\n    dominantBaseline: string | null;\n    emptyCells: string | null;\n    enableBackground: string | null;\n    fill: string | null;\n    fillOpacity: string | null;\n    fillRule: string | null;\n    filter: string | null;\n    flex: string | null;\n    flexBasis: string | null;\n    flexDirection: string | null;\n    flexFlow: string | null;\n    flexGrow: string | null;\n    flexShrink: string | null;\n    flexWrap: string | null;\n    floodColor: string | null;\n    floodOpacity: string | null;\n    font: string | null;\n    fontFamily: string | null;\n    fontFeatureSettings: string | null;\n    fontSize: string | null;\n    fontSizeAdjust: string | null;\n    fontStretch: string | null;\n    fontStyle: string | null;\n    fontVariant: string | null;\n    fontWeight: string | null;\n    glyphOrientationHorizontal: string | null;\n    glyphOrientationVertical: string | null;\n    height: string | null;\n    imeMode: string | null;\n    justifyContent: string | null;\n    kerning: string | null;\n    left: string | null;\n    readonly length: number;\n    letterSpacing: string | null;\n    lightingColor: string | null;\n    lineHeight: string | null;\n    listStyle: string | null;\n    listStyleImage: string | null;\n    listStylePosition: string | null;\n    listStyleType: string | null;\n    margin: string | null;\n    marginBottom: string | null;\n    marginLeft: string | null;\n    marginRight: string | null;\n    marginTop: string | null;\n    marker: string | null;\n    markerEnd: string | null;\n    markerMid: string | null;\n    markerStart: string | null;\n    mask: string | null;\n    maxHeight: string | null;\n    maxWidth: string | null;\n    minHeight: string | null;\n    minWidth: string | null;\n    msContentZoomChaining: string | null;\n    msContentZoomLimit: string | null;\n    msContentZoomLimitMax: any;\n    msContentZoomLimitMin: any;\n    msContentZoomSnap: string | null;\n    msContentZoomSnapPoints: string | null;\n    msContentZoomSnapType: string | null;\n    msContentZooming: string | null;\n    msFlowFrom: string | null;\n    msFlowInto: string | null;\n    msFontFeatureSettings: string | null;\n    msGridColumn: any;\n    msGridColumnAlign: string | null;\n    msGridColumnSpan: any;\n    msGridColumns: string | null;\n    msGridRow: any;\n    msGridRowAlign: string | null;\n    msGridRowSpan: any;\n    msGridRows: string | null;\n    msHighContrastAdjust: string | null;\n    msHyphenateLimitChars: string | null;\n    msHyphenateLimitLines: any;\n    msHyphenateLimitZone: any;\n    msHyphens: string | null;\n    msImeAlign: string | null;\n    msOverflowStyle: string | null;\n    msScrollChaining: string | null;\n    msScrollLimit: string | null;\n    msScrollLimitXMax: any;\n    msScrollLimitXMin: any;\n    msScrollLimitYMax: any;\n    msScrollLimitYMin: any;\n    msScrollRails: string | null;\n    msScrollSnapPointsX: string | null;\n    msScrollSnapPointsY: string | null;\n    msScrollSnapType: string | null;\n    msScrollSnapX: string | null;\n    msScrollSnapY: string | null;\n    msScrollTranslation: string | null;\n    msTextCombineHorizontal: string | null;\n    msTextSizeAdjust: any;\n    msTouchAction: string | null;\n    msTouchSelect: string | null;\n    msUserSelect: string | null;\n    msWrapFlow: string;\n    msWrapMargin: any;\n    msWrapThrough: string;\n    opacity: string | null;\n    order: string | null;\n    orphans: string | null;\n    outline: string | null;\n    outlineColor: string | null;\n    outlineStyle: string | null;\n    outlineWidth: string | null;\n    overflow: string | null;\n    overflowX: string | null;\n    overflowY: string | null;\n    padding: string | null;\n    paddingBottom: string | null;\n    paddingLeft: string | null;\n    paddingRight: string | null;\n    paddingTop: string | null;\n    pageBreakAfter: string | null;\n    pageBreakBefore: string | null;\n    pageBreakInside: string | null;\n    readonly parentRule: CSSRule;\n    perspective: string | null;\n    perspectiveOrigin: string | null;\n    pointerEvents: string | null;\n    position: string | null;\n    quotes: string | null;\n    right: string | null;\n    rubyAlign: string | null;\n    rubyOverhang: string | null;\n    rubyPosition: string | null;\n    stopColor: string | null;\n    stopOpacity: string | null;\n    stroke: string | null;\n    strokeDasharray: string | null;\n    strokeDashoffset: string | null;\n    strokeLinecap: string | null;\n    strokeLinejoin: string | null;\n    strokeMiterlimit: string | null;\n    strokeOpacity: string | null;\n    strokeWidth: string | null;\n    tableLayout: string | null;\n    textAlign: string | null;\n    textAlignLast: string | null;\n    textAnchor: string | null;\n    textDecoration: string | null;\n    textIndent: string | null;\n    textJustify: string | null;\n    textKashida: string | null;\n    textKashidaSpace: string | null;\n    textOverflow: string | null;\n    textShadow: string | null;\n    textTransform: string | null;\n    textUnderlinePosition: string | null;\n    top: string | null;\n    touchAction: string | null;\n    transform: string | null;\n    transformOrigin: string | null;\n    transformStyle: string | null;\n    transition: string | null;\n    transitionDelay: string | null;\n    transitionDuration: string | null;\n    transitionProperty: string | null;\n    transitionTimingFunction: string | null;\n    unicodeBidi: string | null;\n    verticalAlign: string | null;\n    visibility: string | null;\n    webkitAlignContent: string | null;\n    webkitAlignItems: string | null;\n    webkitAlignSelf: string | null;\n    webkitAnimation: string | null;\n    webkitAnimationDelay: string | null;\n    webkitAnimationDirection: string | null;\n    webkitAnimationDuration: string | null;\n    webkitAnimationFillMode: string | null;\n    webkitAnimationIterationCount: string | null;\n    webkitAnimationName: string | null;\n    webkitAnimationPlayState: string | null;\n    webkitAnimationTimingFunction: string | null;\n    webkitAppearance: string | null;\n    webkitBackfaceVisibility: string | null;\n    webkitBackgroundClip: string | null;\n    webkitBackgroundOrigin: string | null;\n    webkitBackgroundSize: string | null;\n    webkitBorderBottomLeftRadius: string | null;\n    webkitBorderBottomRightRadius: string | null;\n    webkitBorderImage: string | null;\n    webkitBorderRadius: string | null;\n    webkitBorderTopLeftRadius: string | null;\n    webkitBorderTopRightRadius: string | null;\n    webkitBoxAlign: string | null;\n    webkitBoxDirection: string | null;\n    webkitBoxFlex: string | null;\n    webkitBoxOrdinalGroup: string | null;\n    webkitBoxOrient: string | null;\n    webkitBoxPack: string | null;\n    webkitBoxSizing: string | null;\n    webkitColumnBreakAfter: string | null;\n    webkitColumnBreakBefore: string | null;\n    webkitColumnBreakInside: string | null;\n    webkitColumnCount: any;\n    webkitColumnGap: any;\n    webkitColumnRule: string | null;\n    webkitColumnRuleColor: any;\n    webkitColumnRuleStyle: string | null;\n    webkitColumnRuleWidth: any;\n    webkitColumnSpan: string | null;\n    webkitColumnWidth: any;\n    webkitColumns: string | null;\n    webkitFilter: string | null;\n    webkitFlex: string | null;\n    webkitFlexBasis: string | null;\n    webkitFlexDirection: string | null;\n    webkitFlexFlow: string | null;\n    webkitFlexGrow: string | null;\n    webkitFlexShrink: string | null;\n    webkitFlexWrap: string | null;\n    webkitJustifyContent: string | null;\n    webkitOrder: string | null;\n    webkitPerspective: string | null;\n    webkitPerspectiveOrigin: string | null;\n    webkitTapHighlightColor: string | null;\n    webkitTextFillColor: string | null;\n    webkitTextSizeAdjust: any;\n    webkitTransform: string | null;\n    webkitTransformOrigin: string | null;\n    webkitTransformStyle: string | null;\n    webkitTransition: string | null;\n    webkitTransitionDelay: string | null;\n    webkitTransitionDuration: string | null;\n    webkitTransitionProperty: string | null;\n    webkitTransitionTimingFunction: string | null;\n    webkitUserModify: string | null;\n    webkitUserSelect: string | null;\n    webkitWritingMode: string | null;\n    whiteSpace: string | null;\n    widows: string | null;\n    width: string | null;\n    wordBreak: string | null;\n    wordSpacing: string | null;\n    wordWrap: string | null;\n    writingMode: string | null;\n    zIndex: string | null;\n    zoom: string | null;\n    resize: string | null;\n    getPropertyPriority(propertyName: string): string;\n    getPropertyValue(propertyName: string): string;\n    item(index: number): string;\n    removeProperty(propertyName: string): string;\n    setProperty(propertyName: string, value: string | null, priority?: string): void;\n    [index: number]: string;\n}\n\ndeclare var CSSStyleDeclaration: {\n    prototype: CSSStyleDeclaration;\n    new(): CSSStyleDeclaration;\n}\n\ninterface CSSStyleRule extends CSSRule {\n    readonly readOnly: boolean;\n    selectorText: string;\n    readonly style: CSSStyleDeclaration;\n}\n\ndeclare var CSSStyleRule: {\n    prototype: CSSStyleRule;\n    new(): CSSStyleRule;\n}\n\ninterface CSSStyleSheet extends StyleSheet {\n    readonly cssRules: CSSRuleList;\n    cssText: string;\n    readonly href: string;\n    readonly id: string;\n    readonly imports: StyleSheetList;\n    readonly isAlternate: boolean;\n    readonly isPrefAlternate: boolean;\n    readonly ownerRule: CSSRule;\n    readonly owningElement: Element;\n    readonly pages: StyleSheetPageList;\n    readonly readOnly: boolean;\n    readonly rules: CSSRuleList;\n    addImport(bstrURL: string, lIndex?: number): number;\n    addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number;\n    addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number;\n    deleteRule(index?: number): void;\n    insertRule(rule: string, index?: number): number;\n    removeImport(lIndex: number): void;\n    removeRule(lIndex: number): void;\n}\n\ndeclare var CSSStyleSheet: {\n    prototype: CSSStyleSheet;\n    new(): CSSStyleSheet;\n}\n\ninterface CSSSupportsRule extends CSSConditionRule {\n}\n\ndeclare var CSSSupportsRule: {\n    prototype: CSSSupportsRule;\n    new(): CSSSupportsRule;\n}\n\ninterface CanvasGradient {\n    addColorStop(offset: number, color: string): void;\n}\n\ndeclare var CanvasGradient: {\n    prototype: CanvasGradient;\n    new(): CanvasGradient;\n}\n\ninterface CanvasPattern {\n    setTransform(matrix: SVGMatrix): void;\n}\n\ndeclare var CanvasPattern: {\n    prototype: CanvasPattern;\n    new(): CanvasPattern;\n}\n\ninterface CanvasRenderingContext2D extends Object, CanvasPathMethods {\n    readonly canvas: HTMLCanvasElement;\n    fillStyle: string | CanvasGradient | CanvasPattern;\n    font: string;\n    globalAlpha: number;\n    globalCompositeOperation: string;\n    lineCap: string;\n    lineDashOffset: number;\n    lineJoin: string;\n    lineWidth: number;\n    miterLimit: number;\n    msFillRule: string;\n    msImageSmoothingEnabled: boolean;\n    shadowBlur: number;\n    shadowColor: string;\n    shadowOffsetX: number;\n    shadowOffsetY: number;\n    strokeStyle: string | CanvasGradient | CanvasPattern;\n    textAlign: string;\n    textBaseline: string;\n    mozImageSmoothingEnabled: boolean;\n    webkitImageSmoothingEnabled: boolean;\n    oImageSmoothingEnabled: boolean;\n    beginPath(): void;\n    clearRect(x: number, y: number, w: number, h: number): void;\n    clip(fillRule?: string): void;\n    createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData;\n    createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;\n    createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern;\n    createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;\n    drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void;\n    fill(fillRule?: string): void;\n    fillRect(x: number, y: number, w: number, h: number): void;\n    fillText(text: string, x: number, y: number, maxWidth?: number): void;\n    getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;\n    getLineDash(): number[];\n    isPointInPath(x: number, y: number, fillRule?: string): boolean;\n    measureText(text: string): TextMetrics;\n    putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void;\n    restore(): void;\n    rotate(angle: number): void;\n    save(): void;\n    scale(x: number, y: number): void;\n    setLineDash(segments: number[]): void;\n    setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void;\n    stroke(): void;\n    strokeRect(x: number, y: number, w: number, h: number): void;\n    strokeText(text: string, x: number, y: number, maxWidth?: number): void;\n    transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void;\n    translate(x: number, y: number): void;\n}\n\ndeclare var CanvasRenderingContext2D: {\n    prototype: CanvasRenderingContext2D;\n    new(): CanvasRenderingContext2D;\n}\n\ninterface ChannelMergerNode extends AudioNode {\n}\n\ndeclare var ChannelMergerNode: {\n    prototype: ChannelMergerNode;\n    new(): ChannelMergerNode;\n}\n\ninterface ChannelSplitterNode extends AudioNode {\n}\n\ndeclare var ChannelSplitterNode: {\n    prototype: ChannelSplitterNode;\n    new(): ChannelSplitterNode;\n}\n\ninterface CharacterData extends Node, ChildNode {\n    data: string;\n    readonly length: number;\n    appendData(arg: string): void;\n    deleteData(offset: number, count: number): void;\n    insertData(offset: number, arg: string): void;\n    replaceData(offset: number, count: number, arg: string): void;\n    substringData(offset: number, count: number): string;\n}\n\ndeclare var CharacterData: {\n    prototype: CharacterData;\n    new(): CharacterData;\n}\n\ninterface ClientRect {\n    bottom: number;\n    readonly height: number;\n    left: number;\n    right: number;\n    top: number;\n    readonly width: number;\n}\n\ndeclare var ClientRect: {\n    prototype: ClientRect;\n    new(): ClientRect;\n}\n\ninterface ClientRectList {\n    readonly length: number;\n    item(index: number): ClientRect;\n    [index: number]: ClientRect;\n}\n\ndeclare var ClientRectList: {\n    prototype: ClientRectList;\n    new(): ClientRectList;\n}\n\ninterface ClipboardEvent extends Event {\n    readonly clipboardData: DataTransfer;\n}\n\ndeclare var ClipboardEvent: {\n    prototype: ClipboardEvent;\n    new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent;\n}\n\ninterface CloseEvent extends Event {\n    readonly code: number;\n    readonly reason: string;\n    readonly wasClean: boolean;\n    initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void;\n}\n\ndeclare var CloseEvent: {\n    prototype: CloseEvent;\n    new(): CloseEvent;\n}\n\ninterface CommandEvent extends Event {\n    readonly commandName: string;\n    readonly detail: string | null;\n}\n\ndeclare var CommandEvent: {\n    prototype: CommandEvent;\n    new(type: string, eventInitDict?: CommandEventInit): CommandEvent;\n}\n\ninterface Comment extends CharacterData {\n    text: string;\n}\n\ndeclare var Comment: {\n    prototype: Comment;\n    new(): Comment;\n}\n\ninterface CompositionEvent extends UIEvent {\n    readonly data: string;\n    readonly locale: string;\n    initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void;\n}\n\ndeclare var CompositionEvent: {\n    prototype: CompositionEvent;\n    new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent;\n}\n\ninterface Console {\n    assert(test?: boolean, message?: string, ...optionalParams: any[]): void;\n    clear(): void;\n    count(countTitle?: string): void;\n    debug(message?: string, ...optionalParams: any[]): void;\n    dir(value?: any, ...optionalParams: any[]): void;\n    dirxml(value: any): void;\n    error(message?: any, ...optionalParams: any[]): void;\n    exception(message?: string, ...optionalParams: any[]): void;\n    group(groupTitle?: string): void;\n    groupCollapsed(groupTitle?: string): void;\n    groupEnd(): void;\n    info(message?: any, ...optionalParams: any[]): void;\n    log(message?: any, ...optionalParams: any[]): void;\n    msIsIndependentlyComposed(element: Element): boolean;\n    profile(reportName?: string): void;\n    profileEnd(): void;\n    select(element: Element): void;\n    table(...data: any[]): void;\n    time(timerName?: string): void;\n    timeEnd(timerName?: string): void;\n    trace(message?: any, ...optionalParams: any[]): void;\n    warn(message?: any, ...optionalParams: any[]): void;\n}\n\ndeclare var Console: {\n    prototype: Console;\n    new(): Console;\n}\n\ninterface ConvolverNode extends AudioNode {\n    buffer: AudioBuffer | null;\n    normalize: boolean;\n}\n\ndeclare var ConvolverNode: {\n    prototype: ConvolverNode;\n    new(): ConvolverNode;\n}\n\ninterface Coordinates {\n    readonly accuracy: number;\n    readonly altitude: number | null;\n    readonly altitudeAccuracy: number | null;\n    readonly heading: number | null;\n    readonly latitude: number;\n    readonly longitude: number;\n    readonly speed: number | null;\n}\n\ndeclare var Coordinates: {\n    prototype: Coordinates;\n    new(): Coordinates;\n}\n\ninterface Crypto extends Object, RandomSource {\n    readonly subtle: SubtleCrypto;\n}\n\ndeclare var Crypto: {\n    prototype: Crypto;\n    new(): Crypto;\n}\n\ninterface CryptoKey {\n    readonly algorithm: KeyAlgorithm;\n    readonly extractable: boolean;\n    readonly type: string;\n    readonly usages: string[];\n}\n\ndeclare var CryptoKey: {\n    prototype: CryptoKey;\n    new(): CryptoKey;\n}\n\ninterface CryptoKeyPair {\n    privateKey: CryptoKey;\n    publicKey: CryptoKey;\n}\n\ndeclare var CryptoKeyPair: {\n    prototype: CryptoKeyPair;\n    new(): CryptoKeyPair;\n}\n\ninterface CustomEvent extends Event {\n    readonly detail: any;\n    initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void;\n}\n\ndeclare var CustomEvent: {\n    prototype: CustomEvent;\n    new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent;\n}\n\ninterface DOMError {\n    readonly name: string;\n    toString(): string;\n}\n\ndeclare var DOMError: {\n    prototype: DOMError;\n    new(): DOMError;\n}\n\ninterface DOMException {\n    readonly code: number;\n    readonly message: string;\n    readonly name: string;\n    toString(): string;\n    readonly ABORT_ERR: number;\n    readonly DATA_CLONE_ERR: number;\n    readonly DOMSTRING_SIZE_ERR: number;\n    readonly HIERARCHY_REQUEST_ERR: number;\n    readonly INDEX_SIZE_ERR: number;\n    readonly INUSE_ATTRIBUTE_ERR: number;\n    readonly INVALID_ACCESS_ERR: number;\n    readonly INVALID_CHARACTER_ERR: number;\n    readonly INVALID_MODIFICATION_ERR: number;\n    readonly INVALID_NODE_TYPE_ERR: number;\n    readonly INVALID_STATE_ERR: number;\n    readonly NAMESPACE_ERR: number;\n    readonly NETWORK_ERR: number;\n    readonly NOT_FOUND_ERR: number;\n    readonly NOT_SUPPORTED_ERR: number;\n    readonly NO_DATA_ALLOWED_ERR: number;\n    readonly NO_MODIFICATION_ALLOWED_ERR: number;\n    readonly PARSE_ERR: number;\n    readonly QUOTA_EXCEEDED_ERR: number;\n    readonly SECURITY_ERR: number;\n    readonly SERIALIZE_ERR: number;\n    readonly SYNTAX_ERR: number;\n    readonly TIMEOUT_ERR: number;\n    readonly TYPE_MISMATCH_ERR: number;\n    readonly URL_MISMATCH_ERR: number;\n    readonly VALIDATION_ERR: number;\n    readonly WRONG_DOCUMENT_ERR: number;\n}\n\ndeclare var DOMException: {\n    prototype: DOMException;\n    new(): DOMException;\n    readonly ABORT_ERR: number;\n    readonly DATA_CLONE_ERR: number;\n    readonly DOMSTRING_SIZE_ERR: number;\n    readonly HIERARCHY_REQUEST_ERR: number;\n    readonly INDEX_SIZE_ERR: number;\n    readonly INUSE_ATTRIBUTE_ERR: number;\n    readonly INVALID_ACCESS_ERR: number;\n    readonly INVALID_CHARACTER_ERR: number;\n    readonly INVALID_MODIFICATION_ERR: number;\n    readonly INVALID_NODE_TYPE_ERR: number;\n    readonly INVALID_STATE_ERR: number;\n    readonly NAMESPACE_ERR: number;\n    readonly NETWORK_ERR: number;\n    readonly NOT_FOUND_ERR: number;\n    readonly NOT_SUPPORTED_ERR: number;\n    readonly NO_DATA_ALLOWED_ERR: number;\n    readonly NO_MODIFICATION_ALLOWED_ERR: number;\n    readonly PARSE_ERR: number;\n    readonly QUOTA_EXCEEDED_ERR: number;\n    readonly SECURITY_ERR: number;\n    readonly SERIALIZE_ERR: number;\n    readonly SYNTAX_ERR: number;\n    readonly TIMEOUT_ERR: number;\n    readonly TYPE_MISMATCH_ERR: number;\n    readonly URL_MISMATCH_ERR: number;\n    readonly VALIDATION_ERR: number;\n    readonly WRONG_DOCUMENT_ERR: number;\n}\n\ninterface DOMImplementation {\n    createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document;\n    createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType;\n    createHTMLDocument(title: string): Document;\n    hasFeature(feature: string | null, version: string | null): boolean;\n}\n\ndeclare var DOMImplementation: {\n    prototype: DOMImplementation;\n    new(): DOMImplementation;\n}\n\ninterface DOMParser {\n    parseFromString(source: string, mimeType: string): Document;\n}\n\ndeclare var DOMParser: {\n    prototype: DOMParser;\n    new(): DOMParser;\n}\n\ninterface DOMSettableTokenList extends DOMTokenList {\n    value: string;\n}\n\ndeclare var DOMSettableTokenList: {\n    prototype: DOMSettableTokenList;\n    new(): DOMSettableTokenList;\n}\n\ninterface DOMStringList {\n    readonly length: number;\n    contains(str: string): boolean;\n    item(index: number): string | null;\n    [index: number]: string;\n}\n\ndeclare var DOMStringList: {\n    prototype: DOMStringList;\n    new(): DOMStringList;\n}\n\ninterface DOMStringMap {\n    [name: string]: string;\n}\n\ndeclare var DOMStringMap: {\n    prototype: DOMStringMap;\n    new(): DOMStringMap;\n}\n\ninterface DOMTokenList {\n    readonly length: number;\n    add(...token: string[]): void;\n    contains(token: string): boolean;\n    item(index: number): string;\n    remove(...token: string[]): void;\n    toString(): string;\n    toggle(token: string, force?: boolean): boolean;\n    [index: number]: string;\n}\n\ndeclare var DOMTokenList: {\n    prototype: DOMTokenList;\n    new(): DOMTokenList;\n}\n\ninterface DataCue extends TextTrackCue {\n    data: ArrayBuffer;\n    addEventListener<K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var DataCue: {\n    prototype: DataCue;\n    new(): DataCue;\n}\n\ninterface DataTransfer {\n    dropEffect: string;\n    effectAllowed: string;\n    readonly files: FileList;\n    readonly items: DataTransferItemList;\n    readonly types: string[];\n    clearData(format?: string): boolean;\n    getData(format: string): string;\n    setData(format: string, data: string): boolean;\n}\n\ndeclare var DataTransfer: {\n    prototype: DataTransfer;\n    new(): DataTransfer;\n}\n\ninterface DataTransferItem {\n    readonly kind: string;\n    readonly type: string;\n    getAsFile(): File | null;\n    getAsString(_callback: FunctionStringCallback | null): void;\n}\n\ndeclare var DataTransferItem: {\n    prototype: DataTransferItem;\n    new(): DataTransferItem;\n}\n\ninterface DataTransferItemList {\n    readonly length: number;\n    add(data: File): DataTransferItem | null;\n    clear(): void;\n    item(index: number): DataTransferItem;\n    remove(index: number): void;\n    [index: number]: DataTransferItem;\n}\n\ndeclare var DataTransferItemList: {\n    prototype: DataTransferItemList;\n    new(): DataTransferItemList;\n}\n\ninterface DeferredPermissionRequest {\n    readonly id: number;\n    readonly type: string;\n    readonly uri: string;\n    allow(): void;\n    deny(): void;\n}\n\ndeclare var DeferredPermissionRequest: {\n    prototype: DeferredPermissionRequest;\n    new(): DeferredPermissionRequest;\n}\n\ninterface DelayNode extends AudioNode {\n    readonly delayTime: AudioParam;\n}\n\ndeclare var DelayNode: {\n    prototype: DelayNode;\n    new(): DelayNode;\n}\n\ninterface DeviceAcceleration {\n    readonly x: number | null;\n    readonly y: number | null;\n    readonly z: number | null;\n}\n\ndeclare var DeviceAcceleration: {\n    prototype: DeviceAcceleration;\n    new(): DeviceAcceleration;\n}\n\ninterface DeviceLightEvent extends Event {\n    readonly value: number;\n}\n\ndeclare var DeviceLightEvent: {\n    prototype: DeviceLightEvent;\n    new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent;\n}\n\ninterface DeviceMotionEvent extends Event {\n    readonly acceleration: DeviceAcceleration | null;\n    readonly accelerationIncludingGravity: DeviceAcceleration | null;\n    readonly interval: number | null;\n    readonly rotationRate: DeviceRotationRate | null;\n    initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void;\n}\n\ndeclare var DeviceMotionEvent: {\n    prototype: DeviceMotionEvent;\n    new(): DeviceMotionEvent;\n}\n\ninterface DeviceOrientationEvent extends Event {\n    readonly absolute: boolean;\n    readonly alpha: number | null;\n    readonly beta: number | null;\n    readonly gamma: number | null;\n    initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void;\n}\n\ndeclare var DeviceOrientationEvent: {\n    prototype: DeviceOrientationEvent;\n    new(): DeviceOrientationEvent;\n}\n\ninterface DeviceRotationRate {\n    readonly alpha: number | null;\n    readonly beta: number | null;\n    readonly gamma: number | null;\n}\n\ndeclare var DeviceRotationRate: {\n    prototype: DeviceRotationRate;\n    new(): DeviceRotationRate;\n}\n\ninterface DocumentEventMap extends GlobalEventHandlersEventMap {\n    \"abort\": UIEvent;\n    \"activate\": UIEvent;\n    \"beforeactivate\": UIEvent;\n    \"beforedeactivate\": UIEvent;\n    \"blur\": FocusEvent;\n    \"canplay\": Event;\n    \"canplaythrough\": Event;\n    \"change\": Event;\n    \"click\": MouseEvent;\n    \"contextmenu\": PointerEvent;\n    \"dblclick\": MouseEvent;\n    \"deactivate\": UIEvent;\n    \"drag\": DragEvent;\n    \"dragend\": DragEvent;\n    \"dragenter\": DragEvent;\n    \"dragleave\": DragEvent;\n    \"dragover\": DragEvent;\n    \"dragstart\": DragEvent;\n    \"drop\": DragEvent;\n    \"durationchange\": Event;\n    \"emptied\": Event;\n    \"ended\": MediaStreamErrorEvent;\n    \"error\": ErrorEvent;\n    \"focus\": FocusEvent;\n    \"fullscreenchange\": Event;\n    \"fullscreenerror\": Event;\n    \"input\": Event;\n    \"invalid\": Event;\n    \"keydown\": KeyboardEvent;\n    \"keypress\": KeyboardEvent;\n    \"keyup\": KeyboardEvent;\n    \"load\": Event;\n    \"loadeddata\": Event;\n    \"loadedmetadata\": Event;\n    \"loadstart\": Event;\n    \"mousedown\": MouseEvent;\n    \"mousemove\": MouseEvent;\n    \"mouseout\": MouseEvent;\n    \"mouseover\": MouseEvent;\n    \"mouseup\": MouseEvent;\n    \"mousewheel\": WheelEvent;\n    \"MSContentZoom\": UIEvent;\n    \"MSGestureChange\": MSGestureEvent;\n    \"MSGestureDoubleTap\": MSGestureEvent;\n    \"MSGestureEnd\": MSGestureEvent;\n    \"MSGestureHold\": MSGestureEvent;\n    \"MSGestureStart\": MSGestureEvent;\n    \"MSGestureTap\": MSGestureEvent;\n    \"MSInertiaStart\": MSGestureEvent;\n    \"MSManipulationStateChanged\": MSManipulationEvent;\n    \"MSPointerCancel\": MSPointerEvent;\n    \"MSPointerDown\": MSPointerEvent;\n    \"MSPointerEnter\": MSPointerEvent;\n    \"MSPointerLeave\": MSPointerEvent;\n    \"MSPointerMove\": MSPointerEvent;\n    \"MSPointerOut\": MSPointerEvent;\n    \"MSPointerOver\": MSPointerEvent;\n    \"MSPointerUp\": MSPointerEvent;\n    \"mssitemodejumplistitemremoved\": MSSiteModeEvent;\n    \"msthumbnailclick\": MSSiteModeEvent;\n    \"pause\": Event;\n    \"play\": Event;\n    \"playing\": Event;\n    \"pointerlockchange\": Event;\n    \"pointerlockerror\": Event;\n    \"progress\": ProgressEvent;\n    \"ratechange\": Event;\n    \"readystatechange\": ProgressEvent;\n    \"reset\": Event;\n    \"scroll\": UIEvent;\n    \"seeked\": Event;\n    \"seeking\": Event;\n    \"select\": UIEvent;\n    \"selectionchange\": Event;\n    \"selectstart\": Event;\n    \"stalled\": Event;\n    \"stop\": Event;\n    \"submit\": Event;\n    \"suspend\": Event;\n    \"timeupdate\": Event;\n    \"touchcancel\": TouchEvent;\n    \"touchend\": TouchEvent;\n    \"touchmove\": TouchEvent;\n    \"touchstart\": TouchEvent;\n    \"volumechange\": Event;\n    \"waiting\": Event;\n    \"webkitfullscreenchange\": Event;\n    \"webkitfullscreenerror\": Event;\n}\n\ninterface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode, DocumentOrShadowRoot {\n    /**\n      * Sets or gets the URL for the current document. \n      */\n    readonly URL: string;\n    /**\n      * Gets the URL for the document, stripped of any character encoding.\n      */\n    readonly URLUnencoded: string;\n    /**\n      * Gets the object that has the focus when the parent document has focus.\n      */\n    readonly activeElement: Element;\n    /**\n      * Sets or gets the color of all active links in the document.\n      */\n    alinkColor: string;\n    /**\n      * Returns a reference to the collection of elements contained by the object.\n      */\n    readonly all: HTMLAllCollection;\n    /**\n      * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order.\n      */\n    anchors: HTMLCollectionOf<HTMLAnchorElement>;\n    /**\n      * Retrieves a collection of all applet objects in the document.\n      */\n    applets: HTMLCollectionOf<HTMLAppletElement>;\n    /**\n      * Deprecated. Sets or retrieves a value that indicates the background color behind the object. \n      */\n    bgColor: string;\n    /**\n      * Specifies the beginning and end of the document body.\n      */\n    body: HTMLElement;\n    readonly characterSet: string;\n    /**\n      * Gets or sets the character set used to encode the object.\n      */\n    charset: string;\n    /**\n      * Gets a value that indicates whether standards-compliant mode is switched on for the object.\n      */\n    readonly compatMode: string;\n    cookie: string;\n    readonly currentScript: HTMLScriptElement | SVGScriptElement;\n    /**\n      * Gets the default character set from the current regional language settings.\n      */\n    readonly defaultCharset: string;\n    readonly defaultView: Window;\n    /**\n      * Sets or gets a value that indicates whether the document can be edited.\n      */\n    designMode: string;\n    /**\n      * Sets or retrieves a value that indicates the reading order of the object. \n      */\n    dir: string;\n    /**\n      * Gets an object representing the document type declaration associated with the current document. \n      */\n    readonly doctype: DocumentType;\n    /**\n      * Gets a reference to the root node of the document. \n      */\n    documentElement: HTMLElement;\n    /**\n      * Sets or gets the security domain of the document. \n      */\n    domain: string;\n    /**\n      * Retrieves a collection of all embed objects in the document.\n      */\n    embeds: HTMLCollectionOf<HTMLEmbedElement>;\n    /**\n      * Sets or gets the foreground (text) color of the document.\n      */\n    fgColor: string;\n    /**\n      * Retrieves a collection, in source order, of all form objects in the document.\n      */\n    forms: HTMLCollectionOf<HTMLFormElement>;\n    readonly fullscreenElement: Element | null;\n    readonly fullscreenEnabled: boolean;\n    readonly head: HTMLHeadElement;\n    readonly hidden: boolean;\n    /**\n      * Retrieves a collection, in source order, of img objects in the document.\n      */\n    images: HTMLCollectionOf<HTMLImageElement>;\n    /**\n      * Gets the implementation object of the current document. \n      */\n    readonly implementation: DOMImplementation;\n    /**\n      * Returns the character encoding used to create the webpage that is loaded into the document object.\n      */\n    readonly inputEncoding: string | null;\n    /**\n      * Gets the date that the page was last modified, if the page supplies one. \n      */\n    readonly lastModified: string;\n    /**\n      * Sets or gets the color of the document links. \n      */\n    linkColor: string;\n    /**\n      * Retrieves a collection of all a objects that specify the href property and all area objects in the document.\n      */\n    links: HTMLCollectionOf<HTMLAnchorElement | HTMLAreaElement>;\n    /**\n      * Contains information about the current URL. \n      */\n    readonly location: Location;\n    msCSSOMElementFloatMetrics: boolean;\n    msCapsLockWarningOff: boolean;\n    /**\n      * Fires when the user aborts the download.\n      * @param ev The event.\n      */\n    onabort: (this: Document, ev: UIEvent) => any;\n    /**\n      * Fires when the object is set as the active element.\n      * @param ev The event.\n      */\n    onactivate: (this: Document, ev: UIEvent) => any;\n    /**\n      * Fires immediately before the object is set as the active element.\n      * @param ev The event.\n      */\n    onbeforeactivate: (this: Document, ev: UIEvent) => any;\n    /**\n      * Fires immediately before the activeElement is changed from the current object to another object in the parent document.\n      * @param ev The event.\n      */\n    onbeforedeactivate: (this: Document, ev: UIEvent) => any;\n    /** \n      * Fires when the object loses the input focus. \n      * @param ev The focus event.\n      */\n    onblur: (this: Document, ev: FocusEvent) => any;\n    /**\n      * Occurs when playback is possible, but would require further buffering. \n      * @param ev The event.\n      */\n    oncanplay: (this: Document, ev: Event) => any;\n    oncanplaythrough: (this: Document, ev: Event) => any;\n    /**\n      * Fires when the contents of the object or selection have changed. \n      * @param ev The event.\n      */\n    onchange: (this: Document, ev: Event) => any;\n    /**\n      * Fires when the user clicks the left mouse button on the object\n      * @param ev The mouse event.\n      */\n    onclick: (this: Document, ev: MouseEvent) => any;\n    /**\n      * Fires when the user clicks the right mouse button in the client area, opening the context menu. \n      * @param ev The mouse event.\n      */\n    oncontextmenu: (this: Document, ev: PointerEvent) => any;\n    /**\n      * Fires when the user double-clicks the object.\n      * @param ev The mouse event.\n      */\n    ondblclick: (this: Document, ev: MouseEvent) => any;\n    /**\n      * Fires when the activeElement is changed from the current object to another object in the parent document.\n      * @param ev The UI Event\n      */\n    ondeactivate: (this: Document, ev: UIEvent) => any;\n    /**\n      * Fires on the source object continuously during a drag operation.\n      * @param ev The event.\n      */\n    ondrag: (this: Document, ev: DragEvent) => any;\n    /**\n      * Fires on the source object when the user releases the mouse at the close of a drag operation.\n      * @param ev The event.\n      */\n    ondragend: (this: Document, ev: DragEvent) => any;\n    /** \n      * Fires on the target element when the user drags the object to a valid drop target.\n      * @param ev The drag event.\n      */\n    ondragenter: (this: Document, ev: DragEvent) => any;\n    /** \n      * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation.\n      * @param ev The drag event.\n      */\n    ondragleave: (this: Document, ev: DragEvent) => any;\n    /**\n      * Fires on the target element continuously while the user drags the object over a valid drop target.\n      * @param ev The event.\n      */\n    ondragover: (this: Document, ev: DragEvent) => any;\n    /**\n      * Fires on the source object when the user starts to drag a text selection or selected object. \n      * @param ev The event.\n      */\n    ondragstart: (this: Document, ev: DragEvent) => any;\n    ondrop: (this: Document, ev: DragEvent) => any;\n    /**\n      * Occurs when the duration attribute is updated. \n      * @param ev The event.\n      */\n    ondurationchange: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when the media element is reset to its initial state. \n      * @param ev The event.\n      */\n    onemptied: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when the end of playback is reached. \n      * @param ev The event\n      */\n    onended: (this: Document, ev: MediaStreamErrorEvent) => any;\n    /**\n      * Fires when an error occurs during object loading.\n      * @param ev The event.\n      */\n    onerror: (this: Document, ev: ErrorEvent) => any;\n    /**\n      * Fires when the object receives focus. \n      * @param ev The event.\n      */\n    onfocus: (this: Document, ev: FocusEvent) => any;\n    onfullscreenchange: (this: Document, ev: Event) => any;\n    onfullscreenerror: (this: Document, ev: Event) => any;\n    oninput: (this: Document, ev: Event) => any;\n    oninvalid: (this: Document, ev: Event) => any;\n    /**\n      * Fires when the user presses a key.\n      * @param ev The keyboard event\n      */\n    onkeydown: (this: Document, ev: KeyboardEvent) => any;\n    /**\n      * Fires when the user presses an alphanumeric key.\n      * @param ev The event.\n      */\n    onkeypress: (this: Document, ev: KeyboardEvent) => any;\n    /**\n      * Fires when the user releases a key.\n      * @param ev The keyboard event\n      */\n    onkeyup: (this: Document, ev: KeyboardEvent) => any;\n    /**\n      * Fires immediately after the browser loads the object. \n      * @param ev The event.\n      */\n    onload: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when media data is loaded at the current playback position. \n      * @param ev The event.\n      */\n    onloadeddata: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when the duration and dimensions of the media have been determined.\n      * @param ev The event.\n      */\n    onloadedmetadata: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when Internet Explorer begins looking for media data. \n      * @param ev The event.\n      */\n    onloadstart: (this: Document, ev: Event) => any;\n    /**\n      * Fires when the user clicks the object with either mouse button. \n      * @param ev The mouse event.\n      */\n    onmousedown: (this: Document, ev: MouseEvent) => any;\n    /**\n      * Fires when the user moves the mouse over the object. \n      * @param ev The mouse event.\n      */\n    onmousemove: (this: Document, ev: MouseEvent) => any;\n    /**\n      * Fires when the user moves the mouse pointer outside the boundaries of the object. \n      * @param ev The mouse event.\n      */\n    onmouseout: (this: Document, ev: MouseEvent) => any;\n    /**\n      * Fires when the user moves the mouse pointer into the object.\n      * @param ev The mouse event.\n      */\n    onmouseover: (this: Document, ev: MouseEvent) => any;\n    /**\n      * Fires when the user releases a mouse button while the mouse is over the object. \n      * @param ev The mouse event.\n      */\n    onmouseup: (this: Document, ev: MouseEvent) => any;\n    /**\n      * Fires when the wheel button is rotated. \n      * @param ev The mouse event\n      */\n    onmousewheel: (this: Document, ev: WheelEvent) => any;\n    onmscontentzoom: (this: Document, ev: UIEvent) => any;\n    onmsgesturechange: (this: Document, ev: MSGestureEvent) => any;\n    onmsgesturedoubletap: (this: Document, ev: MSGestureEvent) => any;\n    onmsgestureend: (this: Document, ev: MSGestureEvent) => any;\n    onmsgesturehold: (this: Document, ev: MSGestureEvent) => any;\n    onmsgesturestart: (this: Document, ev: MSGestureEvent) => any;\n    onmsgesturetap: (this: Document, ev: MSGestureEvent) => any;\n    onmsinertiastart: (this: Document, ev: MSGestureEvent) => any;\n    onmsmanipulationstatechanged: (this: Document, ev: MSManipulationEvent) => any;\n    onmspointercancel: (this: Document, ev: MSPointerEvent) => any;\n    onmspointerdown: (this: Document, ev: MSPointerEvent) => any;\n    onmspointerenter: (this: Document, ev: MSPointerEvent) => any;\n    onmspointerleave: (this: Document, ev: MSPointerEvent) => any;\n    onmspointermove: (this: Document, ev: MSPointerEvent) => any;\n    onmspointerout: (this: Document, ev: MSPointerEvent) => any;\n    onmspointerover: (this: Document, ev: MSPointerEvent) => any;\n    onmspointerup: (this: Document, ev: MSPointerEvent) => any;\n    /**\n      * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. \n      * @param ev The event.\n      */\n    onmssitemodejumplistitemremoved: (this: Document, ev: MSSiteModeEvent) => any;\n    /**\n      * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode.\n      * @param ev The event.\n      */\n    onmsthumbnailclick: (this: Document, ev: MSSiteModeEvent) => any;\n    /**\n      * Occurs when playback is paused.\n      * @param ev The event.\n      */\n    onpause: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when the play method is requested. \n      * @param ev The event.\n      */\n    onplay: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when the audio or video has started playing. \n      * @param ev The event.\n      */\n    onplaying: (this: Document, ev: Event) => any;\n    onpointerlockchange: (this: Document, ev: Event) => any;\n    onpointerlockerror: (this: Document, ev: Event) => any;\n    /**\n      * Occurs to indicate progress while downloading media data. \n      * @param ev The event.\n      */\n    onprogress: (this: Document, ev: ProgressEvent) => any;\n    /**\n      * Occurs when the playback rate is increased or decreased. \n      * @param ev The event.\n      */\n    onratechange: (this: Document, ev: Event) => any;\n    /**\n      * Fires when the state of the object has changed.\n      * @param ev The event\n      */\n    onreadystatechange: (this: Document, ev: ProgressEvent) => any;\n    /**\n      * Fires when the user resets a form. \n      * @param ev The event.\n      */\n    onreset: (this: Document, ev: Event) => any;\n    /**\n      * Fires when the user repositions the scroll box in the scroll bar on the object. \n      * @param ev The event.\n      */\n    onscroll: (this: Document, ev: UIEvent) => any;\n    /**\n      * Occurs when the seek operation ends. \n      * @param ev The event.\n      */\n    onseeked: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when the current playback position is moved. \n      * @param ev The event.\n      */\n    onseeking: (this: Document, ev: Event) => any;\n    /**\n      * Fires when the current selection changes.\n      * @param ev The event.\n      */\n    onselect: (this: Document, ev: UIEvent) => any;\n    /**\n      * Fires when the selection state of a document changes.\n      * @param ev The event.\n      */\n    onselectionchange: (this: Document, ev: Event) => any;\n    onselectstart: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when the download has stopped. \n      * @param ev The event.\n      */\n    onstalled: (this: Document, ev: Event) => any;\n    /**\n      * Fires when the user clicks the Stop button or leaves the Web page.\n      * @param ev The event.\n      */\n    onstop: (this: Document, ev: Event) => any;\n    onsubmit: (this: Document, ev: Event) => any;\n    /**\n      * Occurs if the load operation has been intentionally halted. \n      * @param ev The event.\n      */\n    onsuspend: (this: Document, ev: Event) => any;\n    /**\n      * Occurs to indicate the current playback position.\n      * @param ev The event.\n      */\n    ontimeupdate: (this: Document, ev: Event) => any;\n    ontouchcancel: (ev: TouchEvent) => any;\n    ontouchend: (ev: TouchEvent) => any;\n    ontouchmove: (ev: TouchEvent) => any;\n    ontouchstart: (ev: TouchEvent) => any;\n    /**\n      * Occurs when the volume is changed, or playback is muted or unmuted.\n      * @param ev The event.\n      */\n    onvolumechange: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when playback stops because the next frame of a video resource is not available. \n      * @param ev The event.\n      */\n    onwaiting: (this: Document, ev: Event) => any;\n    onwebkitfullscreenchange: (this: Document, ev: Event) => any;\n    onwebkitfullscreenerror: (this: Document, ev: Event) => any;\n    plugins: HTMLCollectionOf<HTMLEmbedElement>;\n    readonly pointerLockElement: Element;\n    /**\n      * Retrieves a value that indicates the current state of the object.\n      */\n    readonly readyState: string;\n    /**\n      * Gets the URL of the location that referred the user to the current page.\n      */\n    readonly referrer: string;\n    /**\n      * Gets the root svg element in the document hierarchy.\n      */\n    readonly rootElement: SVGSVGElement;\n    /**\n      * Retrieves a collection of all script objects in the document.\n      */\n    scripts: HTMLCollectionOf<HTMLScriptElement>;\n    readonly scrollingElement: Element | null;\n    /**\n      * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document.\n      */\n    readonly styleSheets: StyleSheetList;\n    /**\n      * Contains the title of the document.\n      */\n    title: string;\n    readonly visibilityState: string;\n    /** \n      * Sets or gets the color of the links that the user has visited.\n      */\n    vlinkColor: string;\n    readonly webkitCurrentFullScreenElement: Element | null;\n    readonly webkitFullscreenElement: Element | null;\n    readonly webkitFullscreenEnabled: boolean;\n    readonly webkitIsFullScreen: boolean;\n    readonly xmlEncoding: string | null;\n    xmlStandalone: boolean;\n    /**\n      * Gets or sets the version attribute specified in the declaration of an XML document.\n      */\n    xmlVersion: string | null;\n    adoptNode(source: Node): Node;\n    captureEvents(): void;\n    caretRangeFromPoint(x: number, y: number): Range;\n    clear(): void;\n    /**\n      * Closes an output stream and forces the sent data to display.\n      */\n    close(): void;\n    /**\n      * Creates an attribute object with a specified name.\n      * @param name String that sets the attribute object's name.\n      */\n    createAttribute(name: string): Attr;\n    createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr;\n    createCDATASection(data: string): CDATASection;\n    /**\n      * Creates a comment object with the specified data.\n      * @param data Sets the comment object's data.\n      */\n    createComment(data: string): Comment;\n    /**\n      * Creates a new document.\n      */\n    createDocumentFragment(): DocumentFragment;\n    /**\n      * Creates an instance of the element for the specified tag.\n      * @param tagName The name of an element.\n      */\n    createElement<K extends keyof HTMLElementTagNameMap>(tagName: K): HTMLElementTagNameMap[K];\n    createElement(tagName: string): HTMLElement;\n    createElementNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", qualifiedName: string): HTMLElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"a\"): SVGAElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"circle\"): SVGCircleElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"clipPath\"): SVGClipPathElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"componentTransferFunction\"): SVGComponentTransferFunctionElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"defs\"): SVGDefsElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"desc\"): SVGDescElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"ellipse\"): SVGEllipseElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feBlend\"): SVGFEBlendElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feColorMatrix\"): SVGFEColorMatrixElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feComponentTransfer\"): SVGFEComponentTransferElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feComposite\"): SVGFECompositeElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feConvolveMatrix\"): SVGFEConvolveMatrixElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDiffuseLighting\"): SVGFEDiffuseLightingElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDisplacementMap\"): SVGFEDisplacementMapElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDistantLight\"): SVGFEDistantLightElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFlood\"): SVGFEFloodElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncA\"): SVGFEFuncAElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncB\"): SVGFEFuncBElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncG\"): SVGFEFuncGElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncR\"): SVGFEFuncRElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feGaussianBlur\"): SVGFEGaussianBlurElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feImage\"): SVGFEImageElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMerge\"): SVGFEMergeElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMergeNode\"): SVGFEMergeNodeElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMorphology\"): SVGFEMorphologyElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feOffset\"): SVGFEOffsetElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"fePointLight\"): SVGFEPointLightElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feSpecularLighting\"): SVGFESpecularLightingElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feSpotLight\"): SVGFESpotLightElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feTile\"): SVGFETileElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feTurbulence\"): SVGFETurbulenceElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"filter\"): SVGFilterElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"foreignObject\"): SVGForeignObjectElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"g\"): SVGGElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"image\"): SVGImageElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"gradient\"): SVGGradientElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"line\"): SVGLineElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"linearGradient\"): SVGLinearGradientElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"marker\"): SVGMarkerElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"mask\"): SVGMaskElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"path\"): SVGPathElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"metadata\"): SVGMetadataElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"pattern\"): SVGPatternElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"polygon\"): SVGPolygonElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"polyline\"): SVGPolylineElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"radialGradient\"): SVGRadialGradientElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"rect\"): SVGRectElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"svg\"): SVGSVGElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"script\"): SVGScriptElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"stop\"): SVGStopElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"style\"): SVGStyleElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"switch\"): SVGSwitchElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"symbol\"): SVGSymbolElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"tspan\"): SVGTSpanElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textContent\"): SVGTextContentElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"text\"): SVGTextElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textPath\"): SVGTextPathElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textPositioning\"): SVGTextPositioningElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"title\"): SVGTitleElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"use\"): SVGUseElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"view\"): SVGViewElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: string): SVGElement\n    createElementNS(namespaceURI: string | null, qualifiedName: string): Element;\n    createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;\n    createNSResolver(nodeResolver: Node): XPathNSResolver;\n    /**\n      * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. \n      * @param root The root element or node to start traversing on.\n      * @param whatToShow The type of nodes or elements to appear in the node list\n      * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter.\n      * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded.\n      */\n    createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator;\n    createProcessingInstruction(target: string, data: string): ProcessingInstruction;\n    /**\n      *  Returns an empty range object that has both of its boundary points positioned at the beginning of the document. \n      */\n    createRange(): Range;\n    /**\n      * Creates a text string from the specified value. \n      * @param data String that specifies the nodeValue property of the text node.\n      */\n    createTextNode(data: string): Text;\n    createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch;\n    createTouchList(...touches: Touch[]): TouchList;\n    /**\n      * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document.\n      * @param root The root element or node to start traversing on.\n      * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow.\n      * @param filter A custom NodeFilter function to use.\n      * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded.\n      */\n    createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker;\n    /**\n      * Returns the element for the specified x coordinate and the specified y coordinate. \n      * @param x The x-offset\n      * @param y The y-offset\n      */\n    elementFromPoint(x: number, y: number): Element;\n    evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult;\n    /**\n      * Executes a command on the current document, current selection, or the given range.\n      * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.\n      * @param showUI Display the user interface, defaults to false.\n      * @param value Value to assign.\n      */\n    execCommand(commandId: string, showUI?: boolean, value?: any): boolean;\n    /**\n      * Displays help information for the given command identifier.\n      * @param commandId Displays help information for the given command identifier.\n      */\n    execCommandShowHelp(commandId: string): boolean;\n    exitFullscreen(): void;\n    exitPointerLock(): void;\n    /**\n      * Causes the element to receive the focus and executes the code specified by the onfocus event.\n      */\n    focus(): void;\n    /**\n      * Returns a reference to the first object with the specified value of the ID or NAME attribute.\n      * @param elementId String that specifies the ID value. Case-insensitive.\n      */\n    getElementById(elementId: string): HTMLElement | null;\n    getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;\n    /**\n      * Gets a collection of objects based on the value of the NAME or ID attribute.\n      * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute.\n      */\n    getElementsByName(elementName: string): NodeListOf<HTMLElement>;\n    /**\n      * Retrieves a collection of objects based on the specified element name.\n      * @param name Specifies the name of an element.\n      */\n    getElementsByTagName<K extends keyof ElementListTagNameMap>(tagname: K): ElementListTagNameMap[K];\n    getElementsByTagName(tagname: string): NodeListOf<Element>;\n    getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", localName: string): HTMLCollectionOf<HTMLElement>;\n    getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/2000/svg\", localName: string): HTMLCollectionOf<SVGElement>;\n    getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf<Element>;\n    /**\n      * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage.\n      */\n    getSelection(): Selection;\n    /**\n      * Gets a value indicating whether the object currently has focus.\n      */\n    hasFocus(): boolean;\n    importNode(importedNode: Node, deep: boolean): Node;\n    msElementsFromPoint(x: number, y: number): NodeListOf<Element>;\n    msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf<Element>;\n    /**\n      * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.\n      * @param url Specifies a MIME type for the document.\n      * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element.\n      * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, \"fullscreen=yes, toolbar=yes\"). The following values are supported.\n      * @param replace Specifies whether the existing entry for the document is replaced in the history list.\n      */\n    open(url?: string, name?: string, features?: string, replace?: boolean): Document;\n    /** \n      * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document.\n      * @param commandId Specifies a command identifier.\n      */\n    queryCommandEnabled(commandId: string): boolean;\n    /**\n      * Returns a Boolean value that indicates whether the specified command is in the indeterminate state.\n      * @param commandId String that specifies a command identifier.\n      */\n    queryCommandIndeterm(commandId: string): boolean;\n    /**\n      * Returns a Boolean value that indicates the current state of the command.\n      * @param commandId String that specifies a command identifier.\n      */\n    queryCommandState(commandId: string): boolean;\n    /**\n      * Returns a Boolean value that indicates whether the current command is supported on the current range.\n      * @param commandId Specifies a command identifier.\n      */\n    queryCommandSupported(commandId: string): boolean;\n    /**\n      * Retrieves the string associated with a command.\n      * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. \n      */\n    queryCommandText(commandId: string): string;\n    /**\n      * Returns the current value of the document, range, or current selection for the given command.\n      * @param commandId String that specifies a command identifier.\n      */\n    queryCommandValue(commandId: string): string;\n    releaseEvents(): void;\n    /**\n      * Allows updating the print settings for the page.\n      */\n    updateSettings(): void;\n    webkitCancelFullScreen(): void;\n    webkitExitFullscreen(): void;\n    /**\n      * Writes one or more HTML expressions to a document in the specified window. \n      * @param content Specifies the text and HTML tags to write.\n      */\n    write(...content: string[]): void;\n    /**\n      * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. \n      * @param content The text and HTML tags to write.\n      */\n    writeln(...content: string[]): void;\n    addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Document: {\n    prototype: Document;\n    new(): Document;\n}\n\ninterface DocumentFragment extends Node, NodeSelector, ParentNode {\n}\n\ndeclare var DocumentFragment: {\n    prototype: DocumentFragment;\n    new(): DocumentFragment;\n}\n\ninterface DocumentType extends Node, ChildNode {\n    readonly entities: NamedNodeMap;\n    readonly internalSubset: string | null;\n    readonly name: string;\n    readonly notations: NamedNodeMap;\n    readonly publicId: string | null;\n    readonly systemId: string | null;\n}\n\ndeclare var DocumentType: {\n    prototype: DocumentType;\n    new(): DocumentType;\n}\n\ninterface DragEvent extends MouseEvent {\n    readonly dataTransfer: DataTransfer;\n    initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void;\n    msConvertURL(file: File, targetType: string, targetURL?: string): void;\n}\n\ndeclare var DragEvent: {\n    prototype: DragEvent;\n    new(): DragEvent;\n}\n\ninterface DynamicsCompressorNode extends AudioNode {\n    readonly attack: AudioParam;\n    readonly knee: AudioParam;\n    readonly ratio: AudioParam;\n    readonly reduction: AudioParam;\n    readonly release: AudioParam;\n    readonly threshold: AudioParam;\n}\n\ndeclare var DynamicsCompressorNode: {\n    prototype: DynamicsCompressorNode;\n    new(): DynamicsCompressorNode;\n}\n\ninterface EXT_frag_depth {\n}\n\ndeclare var EXT_frag_depth: {\n    prototype: EXT_frag_depth;\n    new(): EXT_frag_depth;\n}\n\ninterface EXT_texture_filter_anisotropic {\n    readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number;\n    readonly TEXTURE_MAX_ANISOTROPY_EXT: number;\n}\n\ndeclare var EXT_texture_filter_anisotropic: {\n    prototype: EXT_texture_filter_anisotropic;\n    new(): EXT_texture_filter_anisotropic;\n    readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number;\n    readonly TEXTURE_MAX_ANISOTROPY_EXT: number;\n}\n\ninterface ElementEventMap extends GlobalEventHandlersEventMap {\n    \"ariarequest\": AriaRequestEvent;\n    \"command\": CommandEvent;\n    \"gotpointercapture\": PointerEvent;\n    \"lostpointercapture\": PointerEvent;\n    \"MSGestureChange\": MSGestureEvent;\n    \"MSGestureDoubleTap\": MSGestureEvent;\n    \"MSGestureEnd\": MSGestureEvent;\n    \"MSGestureHold\": MSGestureEvent;\n    \"MSGestureStart\": MSGestureEvent;\n    \"MSGestureTap\": MSGestureEvent;\n    \"MSGotPointerCapture\": MSPointerEvent;\n    \"MSInertiaStart\": MSGestureEvent;\n    \"MSLostPointerCapture\": MSPointerEvent;\n    \"MSPointerCancel\": MSPointerEvent;\n    \"MSPointerDown\": MSPointerEvent;\n    \"MSPointerEnter\": MSPointerEvent;\n    \"MSPointerLeave\": MSPointerEvent;\n    \"MSPointerMove\": MSPointerEvent;\n    \"MSPointerOut\": MSPointerEvent;\n    \"MSPointerOver\": MSPointerEvent;\n    \"MSPointerUp\": MSPointerEvent;\n    \"touchcancel\": TouchEvent;\n    \"touchend\": TouchEvent;\n    \"touchmove\": TouchEvent;\n    \"touchstart\": TouchEvent;\n    \"webkitfullscreenchange\": Event;\n    \"webkitfullscreenerror\": Event;\n}\n\ninterface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode {\n    readonly classList: DOMTokenList;\n    className: string;\n    readonly clientHeight: number;\n    readonly clientLeft: number;\n    readonly clientTop: number;\n    readonly clientWidth: number;\n    id: string;\n    msContentZoomFactor: number;\n    readonly msRegionOverflow: string;\n    onariarequest: (this: Element, ev: AriaRequestEvent) => any;\n    oncommand: (this: Element, ev: CommandEvent) => any;\n    ongotpointercapture: (this: Element, ev: PointerEvent) => any;\n    onlostpointercapture: (this: Element, ev: PointerEvent) => any;\n    onmsgesturechange: (this: Element, ev: MSGestureEvent) => any;\n    onmsgesturedoubletap: (this: Element, ev: MSGestureEvent) => any;\n    onmsgestureend: (this: Element, ev: MSGestureEvent) => any;\n    onmsgesturehold: (this: Element, ev: MSGestureEvent) => any;\n    onmsgesturestart: (this: Element, ev: MSGestureEvent) => any;\n    onmsgesturetap: (this: Element, ev: MSGestureEvent) => any;\n    onmsgotpointercapture: (this: Element, ev: MSPointerEvent) => any;\n    onmsinertiastart: (this: Element, ev: MSGestureEvent) => any;\n    onmslostpointercapture: (this: Element, ev: MSPointerEvent) => any;\n    onmspointercancel: (this: Element, ev: MSPointerEvent) => any;\n    onmspointerdown: (this: Element, ev: MSPointerEvent) => any;\n    onmspointerenter: (this: Element, ev: MSPointerEvent) => any;\n    onmspointerleave: (this: Element, ev: MSPointerEvent) => any;\n    onmspointermove: (this: Element, ev: MSPointerEvent) => any;\n    onmspointerout: (this: Element, ev: MSPointerEvent) => any;\n    onmspointerover: (this: Element, ev: MSPointerEvent) => any;\n    onmspointerup: (this: Element, ev: MSPointerEvent) => any;\n    ontouchcancel: (ev: TouchEvent) => any;\n    ontouchend: (ev: TouchEvent) => any;\n    ontouchmove: (ev: TouchEvent) => any;\n    ontouchstart: (ev: TouchEvent) => any;\n    onwebkitfullscreenchange: (this: Element, ev: Event) => any;\n    onwebkitfullscreenerror: (this: Element, ev: Event) => any;\n    readonly prefix: string | null;\n    readonly scrollHeight: number;\n    scrollLeft: number;\n    scrollTop: number;\n    readonly scrollWidth: number;\n    readonly tagName: string;\n    innerHTML: string;\n    readonly assignedSlot: HTMLSlotElement | null;\n    slot: string;\n    readonly shadowRoot: ShadowRoot | null;\n    getAttribute(name: string): string | null;\n    getAttributeNS(namespaceURI: string, localName: string): string;\n    getAttributeNode(name: string): Attr;\n    getAttributeNodeNS(namespaceURI: string, localName: string): Attr;\n    getBoundingClientRect(): ClientRect;\n    getClientRects(): ClientRectList;\n    getElementsByTagName<K extends keyof ElementListTagNameMap>(name: K): ElementListTagNameMap[K];\n    getElementsByTagName(name: string): NodeListOf<Element>;\n    getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", localName: string): HTMLCollectionOf<HTMLElement>;\n    getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/2000/svg\", localName: string): HTMLCollectionOf<SVGElement>;\n    getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf<Element>;\n    hasAttribute(name: string): boolean;\n    hasAttributeNS(namespaceURI: string, localName: string): boolean;\n    msGetRegionContent(): MSRangeCollection;\n    msGetUntransformedBounds(): ClientRect;\n    msMatchesSelector(selectors: string): boolean;\n    msReleasePointerCapture(pointerId: number): void;\n    msSetPointerCapture(pointerId: number): void;\n    msZoomTo(args: MsZoomToOptions): void;\n    releasePointerCapture(pointerId: number): void;\n    removeAttribute(name?: string): void;\n    removeAttributeNS(namespaceURI: string, localName: string): void;\n    removeAttributeNode(oldAttr: Attr): Attr;\n    requestFullscreen(): void;\n    requestPointerLock(): void;\n    setAttribute(name: string, value: string): void;\n    setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void;\n    setAttributeNode(newAttr: Attr): Attr;\n    setAttributeNodeNS(newAttr: Attr): Attr;\n    setPointerCapture(pointerId: number): void;\n    webkitMatchesSelector(selectors: string): boolean;\n    webkitRequestFullScreen(): void;\n    webkitRequestFullscreen(): void;\n    getElementsByClassName(classNames: string): NodeListOf<Element>;\n    matches(selector: string): boolean;\n    closest(selector: string): Element | null;\n    scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;\n    scroll(options?: ScrollToOptions): void;\n    scroll(x: number, y: number): void;\n    scrollTo(options?: ScrollToOptions): void;\n    scrollTo(x: number, y: number): void;\n    scrollBy(options?: ScrollToOptions): void;\n    scrollBy(x: number, y: number): void;\n    insertAdjacentElement(position: string, insertedElement: Element): Element | null;\n    insertAdjacentHTML(where: string, html: string): void;\n    insertAdjacentText(where: string, text: string): void;\n    attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot;\n    addEventListener<K extends keyof ElementEventMap>(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Element: {\n    prototype: Element;\n    new(): Element;\n}\n\ninterface ErrorEvent extends Event {\n    readonly colno: number;\n    readonly error: any;\n    readonly filename: string;\n    readonly lineno: number;\n    readonly message: string;\n    initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void;\n}\n\ndeclare var ErrorEvent: {\n    prototype: ErrorEvent;\n    new(): ErrorEvent;\n}\n\ninterface Event {\n    readonly bubbles: boolean;\n    cancelBubble: boolean;\n    readonly cancelable: boolean;\n    readonly currentTarget: EventTarget;\n    readonly defaultPrevented: boolean;\n    readonly eventPhase: number;\n    readonly isTrusted: boolean;\n    returnValue: boolean;\n    readonly srcElement: Element | null;\n    readonly target: EventTarget;\n    readonly timeStamp: number;\n    readonly type: string;\n    readonly scoped: boolean;\n    initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void;\n    preventDefault(): void;\n    stopImmediatePropagation(): void;\n    stopPropagation(): void;\n    deepPath(): EventTarget[];\n    readonly AT_TARGET: number;\n    readonly BUBBLING_PHASE: number;\n    readonly CAPTURING_PHASE: number;\n}\n\ndeclare var Event: {\n    prototype: Event;\n    new(type: string, eventInitDict?: EventInit): Event;\n    readonly AT_TARGET: number;\n    readonly BUBBLING_PHASE: number;\n    readonly CAPTURING_PHASE: number;\n}\n\ninterface EventTarget {\n    addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n    dispatchEvent(evt: Event): boolean;\n    removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var EventTarget: {\n    prototype: EventTarget;\n    new(): EventTarget;\n}\n\ninterface External {\n}\n\ndeclare var External: {\n    prototype: External;\n    new(): External;\n}\n\ninterface File extends Blob {\n    readonly lastModifiedDate: any;\n    readonly name: string;\n    readonly webkitRelativePath: string;\n}\n\ndeclare var File: {\n    prototype: File;\n    new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File;\n}\n\ninterface FileList {\n    readonly length: number;\n    item(index: number): File;\n    [index: number]: File;\n}\n\ndeclare var FileList: {\n    prototype: FileList;\n    new(): FileList;\n}\n\ninterface FileReader extends EventTarget, MSBaseReader {\n    readonly error: DOMError;\n    readAsArrayBuffer(blob: Blob): void;\n    readAsBinaryString(blob: Blob): void;\n    readAsDataURL(blob: Blob): void;\n    readAsText(blob: Blob, encoding?: string): void;\n    addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var FileReader: {\n    prototype: FileReader;\n    new(): FileReader;\n}\n\ninterface FocusEvent extends UIEvent {\n    readonly relatedTarget: EventTarget;\n    initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void;\n}\n\ndeclare var FocusEvent: {\n    prototype: FocusEvent;\n    new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent;\n}\n\ninterface FormData {\n    append(name: any, value: any, blobName?: string): void;\n}\n\ndeclare var FormData: {\n    prototype: FormData;\n    new (form?: HTMLFormElement): FormData;\n}\n\ninterface GainNode extends AudioNode {\n    readonly gain: AudioParam;\n}\n\ndeclare var GainNode: {\n    prototype: GainNode;\n    new(): GainNode;\n}\n\ninterface Gamepad {\n    readonly axes: number[];\n    readonly buttons: GamepadButton[];\n    readonly connected: boolean;\n    readonly id: string;\n    readonly index: number;\n    readonly mapping: string;\n    readonly timestamp: number;\n}\n\ndeclare var Gamepad: {\n    prototype: Gamepad;\n    new(): Gamepad;\n}\n\ninterface GamepadButton {\n    readonly pressed: boolean;\n    readonly value: number;\n}\n\ndeclare var GamepadButton: {\n    prototype: GamepadButton;\n    new(): GamepadButton;\n}\n\ninterface GamepadEvent extends Event {\n    readonly gamepad: Gamepad;\n}\n\ndeclare var GamepadEvent: {\n    prototype: GamepadEvent;\n    new(): GamepadEvent;\n}\n\ninterface Geolocation {\n    clearWatch(watchId: number): void;\n    getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void;\n    watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number;\n}\n\ndeclare var Geolocation: {\n    prototype: Geolocation;\n    new(): Geolocation;\n}\n\ninterface HTMLAllCollection extends HTMLCollection {\n    namedItem(name: string): Element;\n}\n\ndeclare var HTMLAllCollection: {\n    prototype: HTMLAllCollection;\n    new(): HTMLAllCollection;\n}\n\ninterface HTMLAnchorElement extends HTMLElement {\n    Methods: string;\n    /**\n      * Sets or retrieves the character set used to encode the object.\n      */\n    charset: string;\n    /**\n      * Sets or retrieves the coordinates of the object.\n      */\n    coords: string;\n    download: string;\n    /**\n      * Contains the anchor portion of the URL including the hash sign (#).\n      */\n    hash: string;\n    /**\n      * Contains the hostname and port values of the URL.\n      */\n    host: string;\n    /**\n      * Contains the hostname of a URL.\n      */\n    hostname: string;\n    /**\n      * Sets or retrieves a destination URL or an anchor point.\n      */\n    href: string;\n    /**\n      * Sets or retrieves the language code of the object.\n      */\n    hreflang: string;\n    readonly mimeType: string;\n    /**\n      * Sets or retrieves the shape of the object.\n      */\n    name: string;\n    readonly nameProp: string;\n    /**\n      * Contains the pathname of the URL.\n      */\n    pathname: string;\n    /**\n      * Sets or retrieves the port number associated with a URL.\n      */\n    port: string;\n    /**\n      * Contains the protocol of the URL.\n      */\n    protocol: string;\n    readonly protocolLong: string;\n    /**\n      * Sets or retrieves the relationship between the object and the destination of the link.\n      */\n    rel: string;\n    /**\n      * Sets or retrieves the relationship between the object and the destination of the link.\n      */\n    rev: string;\n    /**\n      * Sets or retrieves the substring of the href property that follows the question mark.\n      */\n    search: string;\n    /**\n      * Sets or retrieves the shape of the object.\n      */\n    shape: string;\n    /**\n      * Sets or retrieves the window or frame at which to target content.\n      */\n    target: string;\n    /**\n      * Retrieves or sets the text of the object as a string. \n      */\n    text: string;\n    type: string;\n    urn: string;\n    /** \n      * Returns a string representation of an object.\n      */\n    toString(): string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLAnchorElement: {\n    prototype: HTMLAnchorElement;\n    new(): HTMLAnchorElement;\n}\n\ninterface HTMLAppletElement extends HTMLElement {\n    /**\n      * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element.\n      */\n    readonly BaseHref: string;\n    align: string;\n    /**\n      * Sets or retrieves a text alternative to the graphic.\n      */\n    alt: string;\n    /**\n      * Gets or sets the optional alternative HTML script to execute if the object fails to load.\n      */\n    altHtml: string;\n    /**\n      * Sets or retrieves a character string that can be used to implement your own archive functionality for the object.\n      */\n    archive: string;\n    border: string;\n    code: string;\n    /**\n      * Sets or retrieves the URL of the component.\n      */\n    codeBase: string;\n    /**\n      * Sets or retrieves the Internet media type for the code associated with the object.\n      */\n    codeType: string;\n    /**\n      * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned.\n      */\n    readonly contentDocument: Document;\n    /**\n      * Sets or retrieves the URL that references the data of the object.\n      */\n    data: string;\n    /**\n      * Sets or retrieves a character string that can be used to implement your own declare functionality for the object.\n      */\n    declare: boolean;\n    readonly form: HTMLFormElement;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: string;\n    hspace: number;\n    /**\n      * Sets or retrieves the shape of the object.\n      */\n    name: string;\n    object: string | null;\n    /**\n      * Sets or retrieves a message to be displayed while an object is loading.\n      */\n    standby: string;\n    /**\n      * Returns the content type of the object.\n      */\n    type: string;\n    /**\n      * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\n      */\n    useMap: string;\n    vspace: number;\n    width: number;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLAppletElement: {\n    prototype: HTMLAppletElement;\n    new(): HTMLAppletElement;\n}\n\ninterface HTMLAreaElement extends HTMLElement {\n    /**\n      * Sets or retrieves a text alternative to the graphic.\n      */\n    alt: string;\n    /**\n      * Sets or retrieves the coordinates of the object.\n      */\n    coords: string;\n    download: string;\n    /**\n      * Sets or retrieves the subsection of the href property that follows the number sign (#).\n      */\n    hash: string;\n    /**\n      * Sets or retrieves the hostname and port number of the location or URL.\n      */\n    host: string;\n    /**\n      * Sets or retrieves the host name part of the location or URL. \n      */\n    hostname: string;\n    /**\n      * Sets or retrieves a destination URL or an anchor point.\n      */\n    href: string;\n    /**\n      * Sets or gets whether clicks in this region cause action.\n      */\n    noHref: boolean;\n    /**\n      * Sets or retrieves the file name or path specified by the object.\n      */\n    pathname: string;\n    /**\n      * Sets or retrieves the port number associated with a URL.\n      */\n    port: string;\n    /**\n      * Sets or retrieves the protocol portion of a URL.\n      */\n    protocol: string;\n    rel: string;\n    /**\n      * Sets or retrieves the substring of the href property that follows the question mark.\n      */\n    search: string;\n    /**\n      * Sets or retrieves the shape of the object.\n      */\n    shape: string;\n    /**\n      * Sets or retrieves the window or frame at which to target content.\n      */\n    target: string;\n    /** \n      * Returns a string representation of an object.\n      */\n    toString(): string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLAreaElement: {\n    prototype: HTMLAreaElement;\n    new(): HTMLAreaElement;\n}\n\ninterface HTMLAreasCollection extends HTMLCollection {\n    /**\n      * Adds an element to the areas, controlRange, or options collection.\n      */\n    add(element: HTMLElement, before?: HTMLElement | number): void;\n    /**\n      * Removes an element from the collection.\n      */\n    remove(index?: number): void;\n}\n\ndeclare var HTMLAreasCollection: {\n    prototype: HTMLAreasCollection;\n    new(): HTMLAreasCollection;\n}\n\ninterface HTMLAudioElement extends HTMLMediaElement {\n    addEventListener<K extends keyof HTMLMediaElementEventMap>(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLAudioElement: {\n    prototype: HTMLAudioElement;\n    new(): HTMLAudioElement;\n}\n\ninterface HTMLBRElement extends HTMLElement {\n    /**\n      * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document.\n      */\n    clear: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLBRElement: {\n    prototype: HTMLBRElement;\n    new(): HTMLBRElement;\n}\n\ninterface HTMLBaseElement extends HTMLElement {\n    /**\n      * Gets or sets the baseline URL on which relative links are based.\n      */\n    href: string;\n    /**\n      * Sets or retrieves the window or frame at which to target content.\n      */\n    target: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLBaseElement: {\n    prototype: HTMLBaseElement;\n    new(): HTMLBaseElement;\n}\n\ninterface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty {\n    /**\n      * Sets or retrieves the current typeface family.\n      */\n    face: string;\n    /**\n      * Sets or retrieves the font size of the object.\n      */\n    size: number;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLBaseFontElement: {\n    prototype: HTMLBaseFontElement;\n    new(): HTMLBaseFontElement;\n}\n\ninterface HTMLBodyElementEventMap extends HTMLElementEventMap {\n    \"afterprint\": Event;\n    \"beforeprint\": Event;\n    \"beforeunload\": BeforeUnloadEvent;\n    \"blur\": FocusEvent;\n    \"error\": ErrorEvent;\n    \"focus\": FocusEvent;\n    \"hashchange\": HashChangeEvent;\n    \"load\": Event;\n    \"message\": MessageEvent;\n    \"offline\": Event;\n    \"online\": Event;\n    \"orientationchange\": Event;\n    \"pagehide\": PageTransitionEvent;\n    \"pageshow\": PageTransitionEvent;\n    \"popstate\": PopStateEvent;\n    \"resize\": UIEvent;\n    \"storage\": StorageEvent;\n    \"unload\": Event;\n}\n\ninterface HTMLBodyElement extends HTMLElement {\n    aLink: any;\n    background: string;\n    bgColor: any;\n    bgProperties: string;\n    link: any;\n    noWrap: boolean;\n    onafterprint: (this: HTMLBodyElement, ev: Event) => any;\n    onbeforeprint: (this: HTMLBodyElement, ev: Event) => any;\n    onbeforeunload: (this: HTMLBodyElement, ev: BeforeUnloadEvent) => any;\n    onblur: (this: HTMLBodyElement, ev: FocusEvent) => any;\n    onerror: (this: HTMLBodyElement, ev: ErrorEvent) => any;\n    onfocus: (this: HTMLBodyElement, ev: FocusEvent) => any;\n    onhashchange: (this: HTMLBodyElement, ev: HashChangeEvent) => any;\n    onload: (this: HTMLBodyElement, ev: Event) => any;\n    onmessage: (this: HTMLBodyElement, ev: MessageEvent) => any;\n    onoffline: (this: HTMLBodyElement, ev: Event) => any;\n    ononline: (this: HTMLBodyElement, ev: Event) => any;\n    onorientationchange: (this: HTMLBodyElement, ev: Event) => any;\n    onpagehide: (this: HTMLBodyElement, ev: PageTransitionEvent) => any;\n    onpageshow: (this: HTMLBodyElement, ev: PageTransitionEvent) => any;\n    onpopstate: (this: HTMLBodyElement, ev: PopStateEvent) => any;\n    onresize: (this: HTMLBodyElement, ev: UIEvent) => any;\n    onstorage: (this: HTMLBodyElement, ev: StorageEvent) => any;\n    onunload: (this: HTMLBodyElement, ev: Event) => any;\n    text: any;\n    vLink: any;\n    addEventListener<K extends keyof HTMLBodyElementEventMap>(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLBodyElement: {\n    prototype: HTMLBodyElement;\n    new(): HTMLBodyElement;\n}\n\ninterface HTMLButtonElement extends HTMLElement {\n    /**\n      * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\n      */\n    autofocus: boolean;\n    disabled: boolean;\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Overrides the action attribute (where the data on a form is sent) on the parent form element.\n      */\n    formAction: string;\n    /**\n      * Used to override the encoding (formEnctype attribute) specified on the form element.\n      */\n    formEnctype: string;\n    /**\n      * Overrides the submit method attribute previously specified on a form element.\n      */\n    formMethod: string;\n    /**\n      * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a \"save draft\"-type submit option.\n      */\n    formNoValidate: string;\n    /**\n      * Overrides the target attribute on a form element.\n      */\n    formTarget: string;\n    /** \n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    status: any;\n    /**\n      * Gets the classification and default behavior of the button.\n      */\n    type: string;\n    /**\n      * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n      */\n    readonly validationMessage: string;\n    /**\n      * Returns a  ValidityState object that represents the validity states of an element.\n      */\n    readonly validity: ValidityState;\n    /** \n      * Sets or retrieves the default or selected value of the control.\n      */\n    value: string;\n    /**\n      * Returns whether an element will successfully validate based on forms validation rules and constraints.\n      */\n    readonly willValidate: boolean;\n    /**\n      * Returns whether a form will validate when it is submitted, without having to submit it.\n      */\n    checkValidity(): boolean;\n    /**\n      * Sets a custom error message that is displayed when a form is submitted.\n      * @param error Sets a custom error message that is displayed when a form is submitted.\n      */\n    setCustomValidity(error: string): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLButtonElement: {\n    prototype: HTMLButtonElement;\n    new(): HTMLButtonElement;\n}\n\ninterface HTMLCanvasElement extends HTMLElement {\n    /**\n      * Gets or sets the height of a canvas element on a document.\n      */\n    height: number;\n    /**\n      * Gets or sets the width of a canvas element on a document.\n      */\n    width: number;\n    /**\n      * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.\n      * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext(\"2d\"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext(\"experimental-webgl\");\n      */\n    getContext(contextId: \"2d\", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null;\n    getContext(contextId: \"webgl\" | \"experimental-webgl\", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null;\n    getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null;\n    /**\n      * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing.\n      */\n    msToBlob(): Blob;\n    /**\n      * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element.\n      * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.\n      */\n    toDataURL(type?: string, ...args: any[]): string;\n    toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLCanvasElement: {\n    prototype: HTMLCanvasElement;\n    new(): HTMLCanvasElement;\n}\n\ninterface HTMLCollection {\n    /**\n      * Sets or retrieves the number of objects in a collection.\n      */\n    readonly length: number;\n    /**\n      * Retrieves an object from various collections.\n      */\n    item(index: number): Element;\n    /**\n      * Retrieves a select object or an object from an options collection.\n      */\n    namedItem(name: string): Element;\n    [index: number]: Element;\n}\n\ndeclare var HTMLCollection: {\n    prototype: HTMLCollection;\n    new(): HTMLCollection;\n}\n\ninterface HTMLDListElement extends HTMLElement {\n    compact: boolean;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDListElement: {\n    prototype: HTMLDListElement;\n    new(): HTMLDListElement;\n}\n\ninterface HTMLDataListElement extends HTMLElement {\n    options: HTMLCollectionOf<HTMLOptionElement>;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDataListElement: {\n    prototype: HTMLDataListElement;\n    new(): HTMLDataListElement;\n}\n\ninterface HTMLDirectoryElement extends HTMLElement {\n    compact: boolean;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDirectoryElement: {\n    prototype: HTMLDirectoryElement;\n    new(): HTMLDirectoryElement;\n}\n\ninterface HTMLDivElement extends HTMLElement {\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text. \n      */\n    align: string;\n    /**\n      * Sets or retrieves whether the browser automatically performs wordwrap.\n      */\n    noWrap: boolean;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDivElement: {\n    prototype: HTMLDivElement;\n    new(): HTMLDivElement;\n}\n\ninterface HTMLDocument extends Document {\n    addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDocument: {\n    prototype: HTMLDocument;\n    new(): HTMLDocument;\n}\n\ninterface HTMLElementEventMap extends ElementEventMap {\n    \"abort\": UIEvent;\n    \"activate\": UIEvent;\n    \"beforeactivate\": UIEvent;\n    \"beforecopy\": ClipboardEvent;\n    \"beforecut\": ClipboardEvent;\n    \"beforedeactivate\": UIEvent;\n    \"beforepaste\": ClipboardEvent;\n    \"blur\": FocusEvent;\n    \"canplay\": Event;\n    \"canplaythrough\": Event;\n    \"change\": Event;\n    \"click\": MouseEvent;\n    \"contextmenu\": PointerEvent;\n    \"copy\": ClipboardEvent;\n    \"cuechange\": Event;\n    \"cut\": ClipboardEvent;\n    \"dblclick\": MouseEvent;\n    \"deactivate\": UIEvent;\n    \"drag\": DragEvent;\n    \"dragend\": DragEvent;\n    \"dragenter\": DragEvent;\n    \"dragleave\": DragEvent;\n    \"dragover\": DragEvent;\n    \"dragstart\": DragEvent;\n    \"drop\": DragEvent;\n    \"durationchange\": Event;\n    \"emptied\": Event;\n    \"ended\": MediaStreamErrorEvent;\n    \"error\": ErrorEvent;\n    \"focus\": FocusEvent;\n    \"input\": Event;\n    \"invalid\": Event;\n    \"keydown\": KeyboardEvent;\n    \"keypress\": KeyboardEvent;\n    \"keyup\": KeyboardEvent;\n    \"load\": Event;\n    \"loadeddata\": Event;\n    \"loadedmetadata\": Event;\n    \"loadstart\": Event;\n    \"mousedown\": MouseEvent;\n    \"mouseenter\": MouseEvent;\n    \"mouseleave\": MouseEvent;\n    \"mousemove\": MouseEvent;\n    \"mouseout\": MouseEvent;\n    \"mouseover\": MouseEvent;\n    \"mouseup\": MouseEvent;\n    \"mousewheel\": WheelEvent;\n    \"MSContentZoom\": UIEvent;\n    \"MSManipulationStateChanged\": MSManipulationEvent;\n    \"paste\": ClipboardEvent;\n    \"pause\": Event;\n    \"play\": Event;\n    \"playing\": Event;\n    \"progress\": ProgressEvent;\n    \"ratechange\": Event;\n    \"reset\": Event;\n    \"scroll\": UIEvent;\n    \"seeked\": Event;\n    \"seeking\": Event;\n    \"select\": UIEvent;\n    \"selectstart\": Event;\n    \"stalled\": Event;\n    \"submit\": Event;\n    \"suspend\": Event;\n    \"timeupdate\": Event;\n    \"volumechange\": Event;\n    \"waiting\": Event;\n}\n\ninterface HTMLElement extends Element {\n    accessKey: string;\n    readonly children: HTMLCollection;\n    contentEditable: string;\n    readonly dataset: DOMStringMap;\n    dir: string;\n    draggable: boolean;\n    hidden: boolean;\n    hideFocus: boolean;\n    innerHTML: string;\n    innerText: string;\n    readonly isContentEditable: boolean;\n    lang: string;\n    readonly offsetHeight: number;\n    readonly offsetLeft: number;\n    readonly offsetParent: Element;\n    readonly offsetTop: number;\n    readonly offsetWidth: number;\n    onabort: (this: HTMLElement, ev: UIEvent) => any;\n    onactivate: (this: HTMLElement, ev: UIEvent) => any;\n    onbeforeactivate: (this: HTMLElement, ev: UIEvent) => any;\n    onbeforecopy: (this: HTMLElement, ev: ClipboardEvent) => any;\n    onbeforecut: (this: HTMLElement, ev: ClipboardEvent) => any;\n    onbeforedeactivate: (this: HTMLElement, ev: UIEvent) => any;\n    onbeforepaste: (this: HTMLElement, ev: ClipboardEvent) => any;\n    onblur: (this: HTMLElement, ev: FocusEvent) => any;\n    oncanplay: (this: HTMLElement, ev: Event) => any;\n    oncanplaythrough: (this: HTMLElement, ev: Event) => any;\n    onchange: (this: HTMLElement, ev: Event) => any;\n    onclick: (this: HTMLElement, ev: MouseEvent) => any;\n    oncontextmenu: (this: HTMLElement, ev: PointerEvent) => any;\n    oncopy: (this: HTMLElement, ev: ClipboardEvent) => any;\n    oncuechange: (this: HTMLElement, ev: Event) => any;\n    oncut: (this: HTMLElement, ev: ClipboardEvent) => any;\n    ondblclick: (this: HTMLElement, ev: MouseEvent) => any;\n    ondeactivate: (this: HTMLElement, ev: UIEvent) => any;\n    ondrag: (this: HTMLElement, ev: DragEvent) => any;\n    ondragend: (this: HTMLElement, ev: DragEvent) => any;\n    ondragenter: (this: HTMLElement, ev: DragEvent) => any;\n    ondragleave: (this: HTMLElement, ev: DragEvent) => any;\n    ondragover: (this: HTMLElement, ev: DragEvent) => any;\n    ondragstart: (this: HTMLElement, ev: DragEvent) => any;\n    ondrop: (this: HTMLElement, ev: DragEvent) => any;\n    ondurationchange: (this: HTMLElement, ev: Event) => any;\n    onemptied: (this: HTMLElement, ev: Event) => any;\n    onended: (this: HTMLElement, ev: MediaStreamErrorEvent) => any;\n    onerror: (this: HTMLElement, ev: ErrorEvent) => any;\n    onfocus: (this: HTMLElement, ev: FocusEvent) => any;\n    oninput: (this: HTMLElement, ev: Event) => any;\n    oninvalid: (this: HTMLElement, ev: Event) => any;\n    onkeydown: (this: HTMLElement, ev: KeyboardEvent) => any;\n    onkeypress: (this: HTMLElement, ev: KeyboardEvent) => any;\n    onkeyup: (this: HTMLElement, ev: KeyboardEvent) => any;\n    onload: (this: HTMLElement, ev: Event) => any;\n    onloadeddata: (this: HTMLElement, ev: Event) => any;\n    onloadedmetadata: (this: HTMLElement, ev: Event) => any;\n    onloadstart: (this: HTMLElement, ev: Event) => any;\n    onmousedown: (this: HTMLElement, ev: MouseEvent) => any;\n    onmouseenter: (this: HTMLElement, ev: MouseEvent) => any;\n    onmouseleave: (this: HTMLElement, ev: MouseEvent) => any;\n    onmousemove: (this: HTMLElement, ev: MouseEvent) => any;\n    onmouseout: (this: HTMLElement, ev: MouseEvent) => any;\n    onmouseover: (this: HTMLElement, ev: MouseEvent) => any;\n    onmouseup: (this: HTMLElement, ev: MouseEvent) => any;\n    onmousewheel: (this: HTMLElement, ev: WheelEvent) => any;\n    onmscontentzoom: (this: HTMLElement, ev: UIEvent) => any;\n    onmsmanipulationstatechanged: (this: HTMLElement, ev: MSManipulationEvent) => any;\n    onpaste: (this: HTMLElement, ev: ClipboardEvent) => any;\n    onpause: (this: HTMLElement, ev: Event) => any;\n    onplay: (this: HTMLElement, ev: Event) => any;\n    onplaying: (this: HTMLElement, ev: Event) => any;\n    onprogress: (this: HTMLElement, ev: ProgressEvent) => any;\n    onratechange: (this: HTMLElement, ev: Event) => any;\n    onreset: (this: HTMLElement, ev: Event) => any;\n    onscroll: (this: HTMLElement, ev: UIEvent) => any;\n    onseeked: (this: HTMLElement, ev: Event) => any;\n    onseeking: (this: HTMLElement, ev: Event) => any;\n    onselect: (this: HTMLElement, ev: UIEvent) => any;\n    onselectstart: (this: HTMLElement, ev: Event) => any;\n    onstalled: (this: HTMLElement, ev: Event) => any;\n    onsubmit: (this: HTMLElement, ev: Event) => any;\n    onsuspend: (this: HTMLElement, ev: Event) => any;\n    ontimeupdate: (this: HTMLElement, ev: Event) => any;\n    onvolumechange: (this: HTMLElement, ev: Event) => any;\n    onwaiting: (this: HTMLElement, ev: Event) => any;\n    outerHTML: string;\n    outerText: string;\n    spellcheck: boolean;\n    readonly style: CSSStyleDeclaration;\n    tabIndex: number;\n    title: string;\n    blur(): void;\n    click(): void;\n    dragDrop(): boolean;\n    focus(): void;\n    msGetInputContext(): MSInputMethodContext;\n    setActive(): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLElement: {\n    prototype: HTMLElement;\n    new(): HTMLElement;\n}\n\ninterface HTMLEmbedElement extends HTMLElement, GetSVGDocument {\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: string;\n    hidden: any;\n    /**\n      * Gets or sets whether the DLNA PlayTo device is available.\n      */\n    msPlayToDisabled: boolean;\n    /**\n      * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\n      */\n    msPlayToPreferredSourceUri: string;\n    /**\n      * Gets or sets the primary DLNA PlayTo device.\n      */\n    msPlayToPrimary: boolean;\n    /**\n      * Gets the source associated with the media element for use by the PlayToManager.\n      */\n    readonly msPlayToSource: any;\n    /**\n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    /**\n      * Retrieves the palette used for the embedded document.\n      */\n    readonly palette: string;\n    /**\n      * Retrieves the URL of the plug-in used to view an embedded document.\n      */\n    readonly pluginspage: string;\n    readonly readyState: string;\n    /**\n      * Sets or retrieves a URL to be loaded by the object.\n      */\n    src: string;\n    /**\n      * Sets or retrieves the height and width units of the embed object.\n      */\n    units: string;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLEmbedElement: {\n    prototype: HTMLEmbedElement;\n    new(): HTMLEmbedElement;\n}\n\ninterface HTMLFieldSetElement extends HTMLElement {\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text.\n      */\n    align: string;\n    disabled: boolean;\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n      */\n    readonly validationMessage: string;\n    /**\n      * Returns a  ValidityState object that represents the validity states of an element.\n      */\n    readonly validity: ValidityState;\n    /**\n      * Returns whether an element will successfully validate based on forms validation rules and constraints.\n      */\n    readonly willValidate: boolean;\n    /**\n      * Returns whether a form will validate when it is submitted, without having to submit it.\n      */\n    checkValidity(): boolean;\n    /**\n      * Sets a custom error message that is displayed when a form is submitted.\n      * @param error Sets a custom error message that is displayed when a form is submitted.\n      */\n    setCustomValidity(error: string): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLFieldSetElement: {\n    prototype: HTMLFieldSetElement;\n    new(): HTMLFieldSetElement;\n}\n\ninterface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty {\n    /**\n      * Sets or retrieves the current typeface family.\n      */\n    face: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLFontElement: {\n    prototype: HTMLFontElement;\n    new(): HTMLFontElement;\n}\n\ninterface HTMLFormElement extends HTMLElement {\n    /**\n      * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form.\n      */\n    acceptCharset: string;\n    /**\n      * Sets or retrieves the URL to which the form content is sent for processing.\n      */\n    action: string;\n    /**\n      * Specifies whether autocomplete is applied to an editable text field.\n      */\n    autocomplete: string;\n    /**\n      * Retrieves a collection, in source order, of all controls in a given form.\n      */\n    readonly elements: HTMLCollection;\n    /**\n      * Sets or retrieves the MIME encoding for the form.\n      */\n    encoding: string;\n    /**\n      * Sets or retrieves the encoding type for the form.\n      */\n    enctype: string;\n    /**\n      * Sets or retrieves the number of objects in a collection.\n      */\n    readonly length: number;\n    /**\n      * Sets or retrieves how to send the form data to the server.\n      */\n    method: string;\n    /**\n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    /**\n      * Designates a form that is not validated when submitted.\n      */\n    noValidate: boolean;\n    /**\n      * Sets or retrieves the window or frame at which to target content.\n      */\n    target: string;\n    /**\n      * Returns whether a form will validate when it is submitted, without having to submit it.\n      */\n    checkValidity(): boolean;\n    /**\n      * Retrieves a form object or an object from an elements collection.\n      * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made.\n      * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned.\n      */\n    item(name?: any, index?: any): any;\n    /**\n      * Retrieves a form object or an object from an elements collection.\n      */\n    namedItem(name: string): any;\n    /**\n      * Fires when the user resets a form.\n      */\n    reset(): void;\n    /**\n      * Fires when a FORM is about to be submitted.\n      */\n    submit(): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n    [name: string]: any;\n}\n\ndeclare var HTMLFormElement: {\n    prototype: HTMLFormElement;\n    new(): HTMLFormElement;\n}\n\ninterface HTMLFrameElementEventMap extends HTMLElementEventMap {\n    \"load\": Event;\n}\n\ninterface HTMLFrameElement extends HTMLElement, GetSVGDocument {\n    /**\n      * Specifies the properties of a border drawn around an object.\n      */\n    border: string;\n    /**\n      * Sets or retrieves the border color of the object.\n      */\n    borderColor: any;\n    /**\n      * Retrieves the document object of the page or frame.\n      */\n    readonly contentDocument: Document;\n    /**\n      * Retrieves the object of the specified.\n      */\n    readonly contentWindow: Window;\n    /**\n      * Sets or retrieves whether to display a border for the frame.\n      */\n    frameBorder: string;\n    /**\n      * Sets or retrieves the amount of additional space between the frames.\n      */\n    frameSpacing: any;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: string | number;\n    /**\n      * Sets or retrieves a URI to a long description of the object.\n      */\n    longDesc: string;\n    /**\n      * Sets or retrieves the top and bottom margin heights before displaying the text in a frame.\n      */\n    marginHeight: string;\n    /**\n      * Sets or retrieves the left and right margin widths before displaying the text in a frame.\n      */\n    marginWidth: string;\n    /**\n      * Sets or retrieves the frame name.\n      */\n    name: string;\n    /**\n      * Sets or retrieves whether the user can resize the frame.\n      */\n    noResize: boolean;\n    /**\n      * Raised when the object has been completely received from the server.\n      */\n    onload: (this: HTMLFrameElement, ev: Event) => any;\n    /**\n      * Sets or retrieves whether the frame can be scrolled.\n      */\n    scrolling: string;\n    /**\n      * Sets or retrieves a URL to be loaded by the object.\n      */\n    src: string;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: string | number;\n    addEventListener<K extends keyof HTMLFrameElementEventMap>(type: K, listener: (this: HTMLFrameElement, ev: HTMLFrameElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLFrameElement: {\n    prototype: HTMLFrameElement;\n    new(): HTMLFrameElement;\n}\n\ninterface HTMLFrameSetElementEventMap extends HTMLElementEventMap {\n    \"beforeprint\": Event;\n    \"beforeunload\": BeforeUnloadEvent;\n    \"blur\": FocusEvent;\n    \"error\": ErrorEvent;\n    \"focus\": FocusEvent;\n    \"hashchange\": HashChangeEvent;\n    \"load\": Event;\n    \"message\": MessageEvent;\n    \"offline\": Event;\n    \"online\": Event;\n    \"orientationchange\": Event;\n    \"pagehide\": PageTransitionEvent;\n    \"pageshow\": PageTransitionEvent;\n    \"resize\": UIEvent;\n    \"storage\": StorageEvent;\n    \"unload\": Event;\n}\n\ninterface HTMLFrameSetElement extends HTMLElement {\n    border: string;\n    /**\n      * Sets or retrieves the border color of the object.\n      */\n    borderColor: any;\n    /**\n      * Sets or retrieves the frame widths of the object.\n      */\n    cols: string;\n    /**\n      * Sets or retrieves whether to display a border for the frame.\n      */\n    frameBorder: string;\n    /**\n      * Sets or retrieves the amount of additional space between the frames.\n      */\n    frameSpacing: any;\n    name: string;\n    onafterprint: (this: HTMLFrameSetElement, ev: Event) => any;\n    onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any;\n    onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any;\n    /**\n      * Fires when the object loses the input focus.\n      */\n    onblur: (this: HTMLFrameSetElement, ev: FocusEvent) => any;\n    onerror: (this: HTMLFrameSetElement, ev: ErrorEvent) => any;\n    /**\n      * Fires when the object receives focus.\n      */\n    onfocus: (this: HTMLFrameSetElement, ev: FocusEvent) => any;\n    onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any;\n    onload: (this: HTMLFrameSetElement, ev: Event) => any;\n    onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any;\n    onoffline: (this: HTMLFrameSetElement, ev: Event) => any;\n    ononline: (this: HTMLFrameSetElement, ev: Event) => any;\n    onorientationchange: (this: HTMLFrameSetElement, ev: Event) => any;\n    onpagehide: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any;\n    onpageshow: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any;\n    onresize: (this: HTMLFrameSetElement, ev: UIEvent) => any;\n    onstorage: (this: HTMLFrameSetElement, ev: StorageEvent) => any;\n    onunload: (this: HTMLFrameSetElement, ev: Event) => any;\n    /**\n      * Sets or retrieves the frame heights of the object.\n      */\n    rows: string;\n    addEventListener<K extends keyof HTMLFrameSetElementEventMap>(type: K, listener: (this: HTMLFrameSetElement, ev: HTMLFrameSetElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLFrameSetElement: {\n    prototype: HTMLFrameSetElement;\n    new(): HTMLFrameSetElement;\n}\n\ninterface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty {\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text.\n      */\n    align: string;\n    /**\n      * Sets or retrieves whether the horizontal rule is drawn with 3-D shading.\n      */\n    noShade: boolean;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: number;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLHRElement: {\n    prototype: HTMLHRElement;\n    new(): HTMLHRElement;\n}\n\ninterface HTMLHeadElement extends HTMLElement {\n    profile: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLHeadElement: {\n    prototype: HTMLHeadElement;\n    new(): HTMLHeadElement;\n}\n\ninterface HTMLHeadingElement extends HTMLElement {\n    /**\n      * Sets or retrieves a value that indicates the table alignment.\n      */\n    align: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLHeadingElement: {\n    prototype: HTMLHeadingElement;\n    new(): HTMLHeadingElement;\n}\n\ninterface HTMLHtmlElement extends HTMLElement {\n    /**\n      * Sets or retrieves the DTD version that governs the current document.\n      */\n    version: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLHtmlElement: {\n    prototype: HTMLHtmlElement;\n    new(): HTMLHtmlElement;\n}\n\ninterface HTMLIFrameElementEventMap extends HTMLElementEventMap {\n    \"load\": Event;\n}\n\ninterface HTMLIFrameElement extends HTMLElement, GetSVGDocument {\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text.\n      */\n    align: string;\n    allowFullscreen: boolean;\n    /**\n      * Specifies the properties of a border drawn around an object.\n      */\n    border: string;\n    /**\n      * Retrieves the document object of the page or frame.\n      */\n    readonly contentDocument: Document;\n    /**\n      * Retrieves the object of the specified.\n      */\n    readonly contentWindow: Window;\n    /**\n      * Sets or retrieves whether to display a border for the frame.\n      */\n    frameBorder: string;\n    /**\n      * Sets or retrieves the amount of additional space between the frames.\n      */\n    frameSpacing: any;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: string;\n    /**\n      * Sets or retrieves the horizontal margin for the object.\n      */\n    hspace: number;\n    /**\n      * Sets or retrieves a URI to a long description of the object.\n      */\n    longDesc: string;\n    /**\n      * Sets or retrieves the top and bottom margin heights before displaying the text in a frame.\n      */\n    marginHeight: string;\n    /**\n      * Sets or retrieves the left and right margin widths before displaying the text in a frame.\n      */\n    marginWidth: string;\n    /**\n      * Sets or retrieves the frame name.\n      */\n    name: string;\n    /**\n      * Sets or retrieves whether the user can resize the frame.\n      */\n    noResize: boolean;\n    /**\n      * Raised when the object has been completely received from the server.\n      */\n    onload: (this: HTMLIFrameElement, ev: Event) => any;\n    readonly sandbox: DOMSettableTokenList;\n    /**\n      * Sets or retrieves whether the frame can be scrolled.\n      */\n    scrolling: string;\n    /**\n      * Sets or retrieves a URL to be loaded by the object.\n      */\n    src: string;\n    /**\n      * Sets or retrieves the vertical margin for the object.\n      */\n    vspace: number;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: string;\n    addEventListener<K extends keyof HTMLIFrameElementEventMap>(type: K, listener: (this: HTMLIFrameElement, ev: HTMLIFrameElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLIFrameElement: {\n    prototype: HTMLIFrameElement;\n    new(): HTMLIFrameElement;\n}\n\ninterface HTMLImageElement extends HTMLElement {\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text.\n      */\n    align: string;\n    /**\n      * Sets or retrieves a text alternative to the graphic.\n      */\n    alt: string;\n    /**\n      * Specifies the properties of a border drawn around an object.\n      */\n    border: string;\n    /**\n      * Retrieves whether the object is fully loaded.\n      */\n    readonly complete: boolean;\n    crossOrigin: string;\n    readonly currentSrc: string;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: number;\n    /**\n      * Sets or retrieves the width of the border to draw around the object.\n      */\n    hspace: number;\n    /**\n      * Sets or retrieves whether the image is a server-side image map.\n      */\n    isMap: boolean;\n    /**\n      * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object.\n      */\n    longDesc: string;\n    lowsrc: string;\n    /**\n      * Gets or sets whether the DLNA PlayTo device is available.\n      */\n    msPlayToDisabled: boolean;\n    msPlayToPreferredSourceUri: string;\n    /**\n      * Gets or sets the primary DLNA PlayTo device.\n      */\n    msPlayToPrimary: boolean;\n    /**\n      * Gets the source associated with the media element for use by the PlayToManager.\n      */\n    readonly msPlayToSource: any;\n    /**\n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    /**\n      * The original height of the image resource before sizing.\n      */\n    readonly naturalHeight: number;\n    /**\n      * The original width of the image resource before sizing.\n      */\n    readonly naturalWidth: number;\n    sizes: string;\n    /**\n      * The address or URL of the a media resource that is to be considered.\n      */\n    src: string;\n    srcset: string;\n    /**\n      * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\n      */\n    useMap: string;\n    /**\n      * Sets or retrieves the vertical margin for the object.\n      */\n    vspace: number;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: number;\n    readonly x: number;\n    readonly y: number;\n    msGetAsCastingSource(): any;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLImageElement: {\n    prototype: HTMLImageElement;\n    new(): HTMLImageElement;\n    create(): HTMLImageElement;\n}\n\ninterface HTMLInputElement extends HTMLElement {\n    /**\n      * Sets or retrieves a comma-separated list of content types.\n      */\n    accept: string;\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text.\n      */\n    align: string;\n    /**\n      * Sets or retrieves a text alternative to the graphic.\n      */\n    alt: string;\n    /**\n      * Specifies whether autocomplete is applied to an editable text field.\n      */\n    autocomplete: string;\n    /**\n      * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\n      */\n    autofocus: boolean;\n    /**\n      * Sets or retrieves the width of the border to draw around the object.\n      */\n    border: string;\n    /**\n      * Sets or retrieves the state of the check box or radio button.\n      */\n    checked: boolean;\n    /**\n      * Retrieves whether the object is fully loaded.\n      */\n    readonly complete: boolean;\n    /**\n      * Sets or retrieves the state of the check box or radio button.\n      */\n    defaultChecked: boolean;\n    /**\n      * Sets or retrieves the initial contents of the object.\n      */\n    defaultValue: string;\n    disabled: boolean;\n    /**\n      * Returns a FileList object on a file type input object.\n      */\n    readonly files: FileList | null;\n    /**\n      * Retrieves a reference to the form that the object is embedded in. \n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Overrides the action attribute (where the data on a form is sent) on the parent form element.\n      */\n    formAction: string;\n    /**\n      * Used to override the encoding (formEnctype attribute) specified on the form element.\n      */\n    formEnctype: string;\n    /**\n      * Overrides the submit method attribute previously specified on a form element.\n      */\n    formMethod: string;\n    /**\n      * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a \"save draft\"-type submit option.\n      */\n    formNoValidate: string;\n    /**\n      * Overrides the target attribute on a form element.\n      */\n    formTarget: string;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: string;\n    /**\n      * Sets or retrieves the width of the border to draw around the object.\n      */\n    hspace: number;\n    indeterminate: boolean;\n    /**\n      * Specifies the ID of a pre-defined datalist of options for an input element.\n      */\n    readonly list: HTMLElement;\n    /**\n      * Defines the maximum acceptable value for an input element with type=\"number\".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field.\n      */\n    max: string;\n    /**\n      * Sets or retrieves the maximum number of characters that the user can enter in a text control.\n      */\n    maxLength: number;\n    /**\n      * Defines the minimum acceptable value for an input element with type=\"number\". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field.\n      */\n    min: string;\n    /**\n      * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list.\n      */\n    multiple: boolean;\n    /**\n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    /**\n      * Gets or sets a string containing a regular expression that the user's input must match.\n      */\n    pattern: string;\n    /**\n      * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field.\n      */\n    placeholder: string;\n    readOnly: boolean;\n    /**\n      * When present, marks an element that can't be submitted without a value.\n      */\n    required: boolean;\n    selectionDirection: string;\n    /**\n      * Gets or sets the end position or offset of a text selection.\n      */\n    selectionEnd: number;\n    /**\n      * Gets or sets the starting position or offset of a text selection.\n      */\n    selectionStart: number;\n    size: number;\n    /**\n      * The address or URL of the a media resource that is to be considered.\n      */\n    src: string;\n    status: boolean;\n    /**\n      * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field.\n      */\n    step: string;\n    /**\n      * Returns the content type of the object.\n      */\n    type: string;\n    /**\n      * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\n      */\n    useMap: string;\n    /**\n      * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n      */\n    readonly validationMessage: string;\n    /**\n      * Returns a  ValidityState object that represents the validity states of an element.\n      */\n    readonly validity: ValidityState;\n    /**\n      * Returns the value of the data at the cursor's current position.\n      */\n    value: string;\n    valueAsDate: Date;\n    /**\n      * Returns the input field value as a number.\n      */\n    valueAsNumber: number;\n    /**\n      * Sets or retrieves the vertical margin for the object.\n      */\n    vspace: number;\n    webkitdirectory: boolean;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: string;\n    /**\n      * Returns whether an element will successfully validate based on forms validation rules and constraints.\n      */\n    readonly willValidate: boolean;\n    minLength: number;\n    /**\n      * Returns whether a form will validate when it is submitted, without having to submit it.\n      */\n    checkValidity(): boolean;\n    /**\n      * Makes the selection equal to the current object.\n      */\n    select(): void;\n    /**\n      * Sets a custom error message that is displayed when a form is submitted.\n      * @param error Sets a custom error message that is displayed when a form is submitted.\n      */\n    setCustomValidity(error: string): void;\n    /**\n      * Sets the start and end positions of a selection in a text field.\n      * @param start The offset into the text field for the start of the selection.\n      * @param end The offset into the text field for the end of the selection.\n      */\n    setSelectionRange(start?: number, end?: number, direction?: string): void;\n    /**\n      * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value.\n      * @param n Value to decrement the value by.\n      */\n    stepDown(n?: number): void;\n    /**\n      * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value.\n      * @param n Value to increment the value by.\n      */\n    stepUp(n?: number): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLInputElement: {\n    prototype: HTMLInputElement;\n    new(): HTMLInputElement;\n}\n\ninterface HTMLLIElement extends HTMLElement {\n    type: string;\n    /**\n      * Sets or retrieves the value of a list item.\n      */\n    value: number;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLLIElement: {\n    prototype: HTMLLIElement;\n    new(): HTMLLIElement;\n}\n\ninterface HTMLLabelElement extends HTMLElement {\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Sets or retrieves the object to which the given label object is assigned.\n      */\n    htmlFor: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLLabelElement: {\n    prototype: HTMLLabelElement;\n    new(): HTMLLabelElement;\n}\n\ninterface HTMLLegendElement extends HTMLElement {\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    align: string;\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLLegendElement: {\n    prototype: HTMLLegendElement;\n    new(): HTMLLegendElement;\n}\n\ninterface HTMLLinkElement extends HTMLElement, LinkStyle {\n    /**\n      * Sets or retrieves the character set used to encode the object.\n      */\n    charset: string;\n    disabled: boolean;\n    /**\n      * Sets or retrieves a destination URL or an anchor point.\n      */\n    href: string;\n    /**\n      * Sets or retrieves the language code of the object.\n      */\n    hreflang: string;\n    /**\n      * Sets or retrieves the media type.\n      */\n    media: string;\n    /**\n      * Sets or retrieves the relationship between the object and the destination of the link.\n      */\n    rel: string;\n    /**\n      * Sets or retrieves the relationship between the object and the destination of the link.\n      */\n    rev: string;\n    /**\n      * Sets or retrieves the window or frame at which to target content.\n      */\n    target: string;\n    /**\n      * Sets or retrieves the MIME type of the object.\n      */\n    type: string;\n    import?: Document;\n    integrity: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLLinkElement: {\n    prototype: HTMLLinkElement;\n    new(): HTMLLinkElement;\n}\n\ninterface HTMLMapElement extends HTMLElement {\n    /**\n      * Retrieves a collection of the area objects defined for the given map object.\n      */\n    readonly areas: HTMLAreasCollection;\n    /**\n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMapElement: {\n    prototype: HTMLMapElement;\n    new(): HTMLMapElement;\n}\n\ninterface HTMLMarqueeElementEventMap extends HTMLElementEventMap {\n    \"bounce\": Event;\n    \"finish\": Event;\n    \"start\": Event;\n}\n\ninterface HTMLMarqueeElement extends HTMLElement {\n    behavior: string;\n    bgColor: any;\n    direction: string;\n    height: string;\n    hspace: number;\n    loop: number;\n    onbounce: (this: HTMLMarqueeElement, ev: Event) => any;\n    onfinish: (this: HTMLMarqueeElement, ev: Event) => any;\n    onstart: (this: HTMLMarqueeElement, ev: Event) => any;\n    scrollAmount: number;\n    scrollDelay: number;\n    trueSpeed: boolean;\n    vspace: number;\n    width: string;\n    start(): void;\n    stop(): void;\n    addEventListener<K extends keyof HTMLMarqueeElementEventMap>(type: K, listener: (this: HTMLMarqueeElement, ev: HTMLMarqueeElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMarqueeElement: {\n    prototype: HTMLMarqueeElement;\n    new(): HTMLMarqueeElement;\n}\n\ninterface HTMLMediaElementEventMap extends HTMLElementEventMap {\n    \"encrypted\": MediaEncryptedEvent;\n    \"msneedkey\": MSMediaKeyNeededEvent;\n}\n\ninterface HTMLMediaElement extends HTMLElement {\n    /**\n      * Returns an AudioTrackList object with the audio tracks for a given video element.\n      */\n    readonly audioTracks: AudioTrackList;\n    /**\n      * Gets or sets a value that indicates whether to start playing the media automatically.\n      */\n    autoplay: boolean;\n    /**\n      * Gets a collection of buffered time ranges.\n      */\n    readonly buffered: TimeRanges;\n    /**\n      * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player).\n      */\n    controls: boolean;\n    crossOrigin: string;\n    /**\n      * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement.\n      */\n    readonly currentSrc: string;\n    /**\n      * Gets or sets the current playback position, in seconds.\n      */\n    currentTime: number;\n    defaultMuted: boolean;\n    /**\n      * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource.\n      */\n    defaultPlaybackRate: number;\n    /**\n      * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming.\n      */\n    readonly duration: number;\n    /**\n      * Gets information about whether the playback has ended or not.\n      */\n    readonly ended: boolean;\n    /**\n      * Returns an object representing the current error state of the audio or video element.\n      */\n    readonly error: MediaError;\n    /**\n      * Gets or sets a flag to specify whether playback should restart after it completes.\n      */\n    loop: boolean;\n    readonly mediaKeys: MediaKeys | null;\n    /**\n      * Specifies the purpose of the audio or video media, such as background audio or alerts.\n      */\n    msAudioCategory: string;\n    /**\n      * Specifies the output device id that the audio will be sent to.\n      */\n    msAudioDeviceType: string;\n    readonly msGraphicsTrustStatus: MSGraphicsTrust;\n    /**\n      * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element.\n      */\n    readonly msKeys: MSMediaKeys;\n    /**\n      * Gets or sets whether the DLNA PlayTo device is available.\n      */\n    msPlayToDisabled: boolean;\n    /**\n      * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\n      */\n    msPlayToPreferredSourceUri: string;\n    /**\n      * Gets or sets the primary DLNA PlayTo device.\n      */\n    msPlayToPrimary: boolean;\n    /**\n      * Gets the source associated with the media element for use by the PlayToManager.\n      */\n    readonly msPlayToSource: any;\n    /**\n      * Specifies whether or not to enable low-latency playback on the media element.\n      */\n    msRealTime: boolean;\n    /**\n      * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted.\n      */\n    muted: boolean;\n    /**\n      * Gets the current network activity for the element.\n      */\n    readonly networkState: number;\n    onencrypted: (this: HTMLMediaElement, ev: MediaEncryptedEvent) => any;\n    onmsneedkey: (this: HTMLMediaElement, ev: MSMediaKeyNeededEvent) => any;\n    /**\n      * Gets a flag that specifies whether playback is paused.\n      */\n    readonly paused: boolean;\n    /**\n      * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource.\n      */\n    playbackRate: number;\n    /**\n      * Gets TimeRanges for the current media resource that has been played.\n      */\n    readonly played: TimeRanges;\n    /**\n      * Gets or sets the current playback position, in seconds.\n      */\n    preload: string;\n    readyState: number;\n    /**\n      * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked.\n      */\n    readonly seekable: TimeRanges;\n    /**\n      * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource.\n      */\n    readonly seeking: boolean;\n    /**\n      * The address or URL of the a media resource that is to be considered.\n      */\n    src: string;\n    srcObject: MediaStream | null;\n    readonly textTracks: TextTrackList;\n    readonly videoTracks: VideoTrackList;\n    /**\n      * Gets or sets the volume level for audio portions of the media element.\n      */\n    volume: number;\n    addTextTrack(kind: string, label?: string, language?: string): TextTrack;\n    /**\n      * Returns a string that specifies whether the client can play a given media resource type.\n      */\n    canPlayType(type: string): string;\n    /**\n      * Resets the audio or video object and loads a new media resource.\n      */\n    load(): void;\n    /**\n      * Clears all effects from the media pipeline.\n      */\n    msClearEffects(): void;\n    msGetAsCastingSource(): any;\n    /**\n      * Inserts the specified audio effect into media pipeline.\n      */\n    msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void;\n    msSetMediaKeys(mediaKeys: MSMediaKeys): void;\n    /**\n      * Specifies the media protection manager for a given media pipeline.\n      */\n    msSetMediaProtectionManager(mediaProtectionManager?: any): void;\n    /**\n      * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not.\n      */\n    pause(): void;\n    /**\n      * Loads and starts playback of a media resource.\n      */\n    play(): void;\n    setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike<void>;\n    readonly HAVE_CURRENT_DATA: number;\n    readonly HAVE_ENOUGH_DATA: number;\n    readonly HAVE_FUTURE_DATA: number;\n    readonly HAVE_METADATA: number;\n    readonly HAVE_NOTHING: number;\n    readonly NETWORK_EMPTY: number;\n    readonly NETWORK_IDLE: number;\n    readonly NETWORK_LOADING: number;\n    readonly NETWORK_NO_SOURCE: number;\n    addEventListener<K extends keyof HTMLMediaElementEventMap>(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMediaElement: {\n    prototype: HTMLMediaElement;\n    new(): HTMLMediaElement;\n    readonly HAVE_CURRENT_DATA: number;\n    readonly HAVE_ENOUGH_DATA: number;\n    readonly HAVE_FUTURE_DATA: number;\n    readonly HAVE_METADATA: number;\n    readonly HAVE_NOTHING: number;\n    readonly NETWORK_EMPTY: number;\n    readonly NETWORK_IDLE: number;\n    readonly NETWORK_LOADING: number;\n    readonly NETWORK_NO_SOURCE: number;\n}\n\ninterface HTMLMenuElement extends HTMLElement {\n    compact: boolean;\n    type: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMenuElement: {\n    prototype: HTMLMenuElement;\n    new(): HTMLMenuElement;\n}\n\ninterface HTMLMetaElement extends HTMLElement {\n    /**\n      * Sets or retrieves the character set used to encode the object.\n      */\n    charset: string;\n    /**\n      * Gets or sets meta-information to associate with httpEquiv or name.\n      */\n    content: string;\n    /**\n      * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header.\n      */\n    httpEquiv: string;\n    /**\n      * Sets or retrieves the value specified in the content attribute of the meta object.\n      */\n    name: string;\n    /**\n      * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object.\n      */\n    scheme: string;\n    /**\n      * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. \n      */\n    url: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMetaElement: {\n    prototype: HTMLMetaElement;\n    new(): HTMLMetaElement;\n}\n\ninterface HTMLMeterElement extends HTMLElement {\n    high: number;\n    low: number;\n    max: number;\n    min: number;\n    optimum: number;\n    value: number;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMeterElement: {\n    prototype: HTMLMeterElement;\n    new(): HTMLMeterElement;\n}\n\ninterface HTMLModElement extends HTMLElement {\n    /**\n      * Sets or retrieves reference information about the object.\n      */\n    cite: string;\n    /**\n      * Sets or retrieves the date and time of a modification to the object.\n      */\n    dateTime: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLModElement: {\n    prototype: HTMLModElement;\n    new(): HTMLModElement;\n}\n\ninterface HTMLOListElement extends HTMLElement {\n    compact: boolean;\n    /**\n      * The starting number.\n      */\n    start: number;\n    type: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLOListElement: {\n    prototype: HTMLOListElement;\n    new(): HTMLOListElement;\n}\n\ninterface HTMLObjectElement extends HTMLElement, GetSVGDocument {\n    /**\n      * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element.\n      */\n    readonly BaseHref: string;\n    align: string;\n    /**\n      * Sets or retrieves a text alternative to the graphic.\n      */\n    alt: string;\n    /**\n      * Gets or sets the optional alternative HTML script to execute if the object fails to load.\n      */\n    altHtml: string;\n    /**\n      * Sets or retrieves a character string that can be used to implement your own archive functionality for the object.\n      */\n    archive: string;\n    border: string;\n    /**\n      * Sets or retrieves the URL of the file containing the compiled Java class.\n      */\n    code: string;\n    /**\n      * Sets or retrieves the URL of the component.\n      */\n    codeBase: string;\n    /**\n      * Sets or retrieves the Internet media type for the code associated with the object.\n      */\n    codeType: string;\n    /**\n      * Retrieves the document object of the page or frame.\n      */\n    readonly contentDocument: Document;\n    /**\n      * Sets or retrieves the URL that references the data of the object.\n      */\n    data: string;\n    declare: boolean;\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: string;\n    hspace: number;\n    /**\n      * Gets or sets whether the DLNA PlayTo device is available.\n      */\n    msPlayToDisabled: boolean;\n    /**\n      * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\n      */\n    msPlayToPreferredSourceUri: string;\n    /**\n      * Gets or sets the primary DLNA PlayTo device.\n      */\n    msPlayToPrimary: boolean;\n    /**\n      * Gets the source associated with the media element for use by the PlayToManager.\n      */\n    readonly msPlayToSource: any;\n    /**\n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    /**\n      * Retrieves the contained object.\n      */\n    readonly object: any;\n    readonly readyState: number;\n    /**\n      * Sets or retrieves a message to be displayed while an object is loading.\n      */\n    standby: string;\n    /**\n      * Sets or retrieves the MIME type of the object.\n      */\n    type: string;\n    /**\n      * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\n      */\n    useMap: string;\n    /**\n      * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n      */\n    readonly validationMessage: string;\n    /**\n      * Returns a  ValidityState object that represents the validity states of an element.\n      */\n    readonly validity: ValidityState;\n    vspace: number;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: string;\n    /**\n      * Returns whether an element will successfully validate based on forms validation rules and constraints.\n      */\n    readonly willValidate: boolean;\n    /**\n      * Returns whether a form will validate when it is submitted, without having to submit it.\n      */\n    checkValidity(): boolean;\n    /**\n      * Sets a custom error message that is displayed when a form is submitted.\n      * @param error Sets a custom error message that is displayed when a form is submitted.\n      */\n    setCustomValidity(error: string): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLObjectElement: {\n    prototype: HTMLObjectElement;\n    new(): HTMLObjectElement;\n}\n\ninterface HTMLOptGroupElement extends HTMLElement {\n    /**\n      * Sets or retrieves the status of an option.\n      */\n    defaultSelected: boolean;\n    disabled: boolean;\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Sets or retrieves the ordinal position of an option in a list box.\n      */\n    readonly index: number;\n    /**\n      * Sets or retrieves a value that you can use to implement your own label functionality for the object.\n      */\n    label: string;\n    /**\n      * Sets or retrieves whether the option in the list box is the default item.\n      */\n    selected: boolean;\n    /**\n      * Sets or retrieves the text string specified by the option tag.\n      */\n    readonly text: string;\n    /**\n      * Sets or retrieves the value which is returned to the server when the form control is submitted.\n      */\n    value: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLOptGroupElement: {\n    prototype: HTMLOptGroupElement;\n    new(): HTMLOptGroupElement;\n}\n\ninterface HTMLOptionElement extends HTMLElement {\n    /**\n      * Sets or retrieves the status of an option.\n      */\n    defaultSelected: boolean;\n    disabled: boolean;\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Sets or retrieves the ordinal position of an option in a list box.\n      */\n    readonly index: number;\n    /**\n      * Sets or retrieves a value that you can use to implement your own label functionality for the object.\n      */\n    label: string;\n    /**\n      * Sets or retrieves whether the option in the list box is the default item.\n      */\n    selected: boolean;\n    /**\n      * Sets or retrieves the text string specified by the option tag.\n      */\n    text: string;\n    /**\n      * Sets or retrieves the value which is returned to the server when the form control is submitted.\n      */\n    value: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLOptionElement: {\n    prototype: HTMLOptionElement;\n    new(): HTMLOptionElement;\n    create(): HTMLOptionElement;\n}\n\ninterface HTMLOptionsCollection extends HTMLCollectionOf<HTMLOptionElement> {\n    length: number;\n    selectedIndex: number;\n    add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void;\n    remove(index: number): void;\n}\n\ndeclare var HTMLOptionsCollection: {\n    prototype: HTMLOptionsCollection;\n    new(): HTMLOptionsCollection;\n}\n\ninterface HTMLParagraphElement extends HTMLElement {\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text. \n      */\n    align: string;\n    clear: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLParagraphElement: {\n    prototype: HTMLParagraphElement;\n    new(): HTMLParagraphElement;\n}\n\ninterface HTMLParamElement extends HTMLElement {\n    /**\n      * Sets or retrieves the name of an input parameter for an element.\n      */\n    name: string;\n    /**\n      * Sets or retrieves the content type of the resource designated by the value attribute.\n      */\n    type: string;\n    /**\n      * Sets or retrieves the value of an input parameter for an element.\n      */\n    value: string;\n    /**\n      * Sets or retrieves the data type of the value attribute.\n      */\n    valueType: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLParamElement: {\n    prototype: HTMLParamElement;\n    new(): HTMLParamElement;\n}\n\ninterface HTMLPictureElement extends HTMLElement {\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLPictureElement: {\n    prototype: HTMLPictureElement;\n    new(): HTMLPictureElement;\n}\n\ninterface HTMLPreElement extends HTMLElement {\n    /**\n      * Sets or gets a value that you can use to implement your own width functionality for the object.\n      */\n    width: number;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLPreElement: {\n    prototype: HTMLPreElement;\n    new(): HTMLPreElement;\n}\n\ninterface HTMLProgressElement extends HTMLElement {\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Defines the maximum, or \"done\" value for a progress element.\n      */\n    max: number;\n    /**\n      * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar).\n      */\n    readonly position: number;\n    /**\n      * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value.\n      */\n    value: number;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLProgressElement: {\n    prototype: HTMLProgressElement;\n    new(): HTMLProgressElement;\n}\n\ninterface HTMLQuoteElement extends HTMLElement {\n    /**\n      * Sets or retrieves reference information about the object.\n      */\n    cite: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLQuoteElement: {\n    prototype: HTMLQuoteElement;\n    new(): HTMLQuoteElement;\n}\n\ninterface HTMLScriptElement extends HTMLElement {\n    async: boolean;\n    /**\n      * Sets or retrieves the character set used to encode the object.\n      */\n    charset: string;\n    /**\n      * Sets or retrieves the status of the script.\n      */\n    defer: boolean;\n    /**\n      * Sets or retrieves the event for which the script is written. \n      */\n    event: string;\n    /** \n      * Sets or retrieves the object that is bound to the event script.\n      */\n    htmlFor: string;\n    /**\n      * Retrieves the URL to an external file that contains the source code or data.\n      */\n    src: string;\n    /**\n      * Retrieves or sets the text of the object as a string. \n      */\n    text: string;\n    /**\n      * Sets or retrieves the MIME type for the associated scripting engine.\n      */\n    type: string;\n    integrity: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLScriptElement: {\n    prototype: HTMLScriptElement;\n    new(): HTMLScriptElement;\n}\n\ninterface HTMLSelectElement extends HTMLElement {\n    /**\n      * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\n      */\n    autofocus: boolean;\n    disabled: boolean;\n    /**\n      * Retrieves a reference to the form that the object is embedded in. \n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Sets or retrieves the number of objects in a collection.\n      */\n    length: number;\n    /**\n      * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list.\n      */\n    multiple: boolean;\n    /**\n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    readonly options: HTMLOptionsCollection;\n    /**\n      * When present, marks an element that can't be submitted without a value.\n      */\n    required: boolean;\n    /**\n      * Sets or retrieves the index of the selected option in a select object.\n      */\n    selectedIndex: number;\n    selectedOptions: HTMLCollectionOf<HTMLOptionElement>;\n    /**\n      * Sets or retrieves the number of rows in the list box. \n      */\n    size: number;\n    /**\n      * Retrieves the type of select control based on the value of the MULTIPLE attribute.\n      */\n    readonly type: string;\n    /**\n      * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n      */\n    readonly validationMessage: string;\n    /**\n      * Returns a  ValidityState object that represents the validity states of an element.\n      */\n    readonly validity: ValidityState;\n    /**\n      * Sets or retrieves the value which is returned to the server when the form control is submitted.\n      */\n    value: string;\n    /**\n      * Returns whether an element will successfully validate based on forms validation rules and constraints.\n      */\n    readonly willValidate: boolean;\n    /**\n      * Adds an element to the areas, controlRange, or options collection.\n      * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection.\n      * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. \n      */\n    add(element: HTMLElement, before?: HTMLElement | number): void;\n    /**\n      * Returns whether a form will validate when it is submitted, without having to submit it.\n      */\n    checkValidity(): boolean;\n    /**\n      * Retrieves a select object or an object from an options collection.\n      * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made.\n      * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned.\n      */\n    item(name?: any, index?: any): any;\n    /**\n      * Retrieves a select object or an object from an options collection.\n      * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made.\n      */\n    namedItem(name: string): any;\n    /**\n      * Removes an element from the collection.\n      * @param index Number that specifies the zero-based index of the element to remove from the collection.\n      */\n    remove(index?: number): void;\n    /**\n      * Sets a custom error message that is displayed when a form is submitted.\n      * @param error Sets a custom error message that is displayed when a form is submitted.\n      */\n    setCustomValidity(error: string): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n    [name: string]: any;\n}\n\ndeclare var HTMLSelectElement: {\n    prototype: HTMLSelectElement;\n    new(): HTMLSelectElement;\n}\n\ninterface HTMLSourceElement extends HTMLElement {\n    /**\n      * Gets or sets the intended media type of the media source.\n     */\n    media: string;\n    msKeySystem: string;\n    sizes: string;\n    /**\n      * The address or URL of the a media resource that is to be considered.\n      */\n    src: string;\n    srcset: string;\n    /**\n     * Gets or sets the MIME type of a media resource.\n     */\n    type: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLSourceElement: {\n    prototype: HTMLSourceElement;\n    new(): HTMLSourceElement;\n}\n\ninterface HTMLSpanElement extends HTMLElement {\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLSpanElement: {\n    prototype: HTMLSpanElement;\n    new(): HTMLSpanElement;\n}\n\ninterface HTMLStyleElement extends HTMLElement, LinkStyle {\n    disabled: boolean;\n    /**\n      * Sets or retrieves the media type.\n      */\n    media: string;\n    /**\n      * Retrieves the CSS language in which the style sheet is written.\n      */\n    type: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLStyleElement: {\n    prototype: HTMLStyleElement;\n    new(): HTMLStyleElement;\n}\n\ninterface HTMLTableCaptionElement extends HTMLElement {\n    /**\n      * Sets or retrieves the alignment of the caption or legend.\n      */\n    align: string;\n    /**\n      * Sets or retrieves whether the caption appears at the top or bottom of the table.\n      */\n    vAlign: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableCaptionElement: {\n    prototype: HTMLTableCaptionElement;\n    new(): HTMLTableCaptionElement;\n}\n\ninterface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment {\n    /**\n      * Sets or retrieves abbreviated text for the object.\n      */\n    abbr: string;\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text.\n      */\n    align: string;\n    /**\n      * Sets or retrieves a comma-delimited list of conceptual categories associated with the object.\n      */\n    axis: string;\n    bgColor: any;\n    /**\n      * Retrieves the position of the object in the cells collection of a row.\n      */\n    readonly cellIndex: number;\n    /**\n      * Sets or retrieves the number columns in the table that the object should span.\n      */\n    colSpan: number;\n    /**\n      * Sets or retrieves a list of header cells that provide information for the object.\n      */\n    headers: string;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: any;\n    /**\n      * Sets or retrieves whether the browser automatically performs wordwrap.\n      */\n    noWrap: boolean;\n    /**\n      * Sets or retrieves how many rows in a table the cell should span.\n      */\n    rowSpan: number;\n    /**\n      * Sets or retrieves the group of cells in a table to which the object's information applies.\n      */\n    scope: string;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableCellElement: {\n    prototype: HTMLTableCellElement;\n    new(): HTMLTableCellElement;\n}\n\ninterface HTMLTableColElement extends HTMLElement, HTMLTableAlignment {\n    /**\n      * Sets or retrieves the alignment of the object relative to the display or table.\n      */\n    align: string;\n    /**\n      * Sets or retrieves the number of columns in the group.\n      */\n    span: number;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: any;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableColElement: {\n    prototype: HTMLTableColElement;\n    new(): HTMLTableColElement;\n}\n\ninterface HTMLTableDataCellElement extends HTMLTableCellElement {\n}\n\ndeclare var HTMLTableDataCellElement: {\n    prototype: HTMLTableDataCellElement;\n    new(): HTMLTableDataCellElement;\n}\n\ninterface HTMLTableElement extends HTMLElement {\n    /**\n      * Sets or retrieves a value that indicates the table alignment.\n      */\n    align: string;\n    bgColor: any;\n    /**\n      * Sets or retrieves the width of the border to draw around the object.\n      */\n    border: string;\n    /**\n      * Sets or retrieves the border color of the object. \n      */\n    borderColor: any;\n    /**\n      * Retrieves the caption object of a table.\n      */\n    caption: HTMLTableCaptionElement;\n    /**\n      * Sets or retrieves the amount of space between the border of the cell and the content of the cell.\n      */\n    cellPadding: string;\n    /**\n      * Sets or retrieves the amount of space between cells in a table.\n      */\n    cellSpacing: string;\n    /**\n      * Sets or retrieves the number of columns in the table.\n      */\n    cols: number;\n    /**\n      * Sets or retrieves the way the border frame around the table is displayed.\n      */\n    frame: string;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: any;\n    /**\n      * Sets or retrieves the number of horizontal rows contained in the object.\n      */\n    rows: HTMLCollectionOf<HTMLTableRowElement>;\n    /**\n      * Sets or retrieves which dividing lines (inner borders) are displayed.\n      */\n    rules: string;\n    /**\n      * Sets or retrieves a description and/or structure of the object.\n      */\n    summary: string;\n    /**\n      * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order.\n      */\n    tBodies: HTMLCollectionOf<HTMLTableSectionElement>;\n    /**\n      * Retrieves the tFoot object of the table.\n      */\n    tFoot: HTMLTableSectionElement;\n    /**\n      * Retrieves the tHead object of the table.\n      */\n    tHead: HTMLTableSectionElement;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: string;\n    /**\n      * Creates an empty caption element in the table.\n      */\n    createCaption(): HTMLTableCaptionElement;\n    /**\n      * Creates an empty tBody element in the table.\n      */\n    createTBody(): HTMLTableSectionElement;\n    /**\n      * Creates an empty tFoot element in the table.\n      */\n    createTFoot(): HTMLTableSectionElement;\n    /**\n      * Returns the tHead element object if successful, or null otherwise.\n      */\n    createTHead(): HTMLTableSectionElement;\n    /**\n      * Deletes the caption element and its contents from the table.\n      */\n    deleteCaption(): void;\n    /**\n      * Removes the specified row (tr) from the element and from the rows collection.\n      * @param index Number that specifies the zero-based position in the rows collection of the row to remove.\n      */\n    deleteRow(index?: number): void;\n    /**\n      * Deletes the tFoot element and its contents from the table.\n      */\n    deleteTFoot(): void;\n    /**\n      * Deletes the tHead element and its contents from the table.\n      */\n    deleteTHead(): void;\n    /**\n      * Creates a new row (tr) in the table, and adds the row to the rows collection.\n      * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection.\n      */\n    insertRow(index?: number): HTMLTableRowElement;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableElement: {\n    prototype: HTMLTableElement;\n    new(): HTMLTableElement;\n}\n\ninterface HTMLTableHeaderCellElement extends HTMLTableCellElement {\n    /**\n      * Sets or retrieves the group of cells in a table to which the object's information applies.\n      */\n    scope: string;\n}\n\ndeclare var HTMLTableHeaderCellElement: {\n    prototype: HTMLTableHeaderCellElement;\n    new(): HTMLTableHeaderCellElement;\n}\n\ninterface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment {\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text.\n      */\n    align: string;\n    bgColor: any;\n    /**\n      * Retrieves a collection of all cells in the table row.\n      */\n    cells: HTMLCollectionOf<HTMLTableDataCellElement | HTMLTableHeaderCellElement>;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: any;\n    /**\n      * Retrieves the position of the object in the rows collection for the table.\n      */\n    readonly rowIndex: number;\n    /**\n      * Retrieves the position of the object in the collection.\n      */\n    readonly sectionRowIndex: number;\n    /**\n      * Removes the specified cell from the table row, as well as from the cells collection.\n      * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted.\n      */\n    deleteCell(index?: number): void;\n    /**\n      * Creates a new cell in the table row, and adds the cell to the cells collection.\n      * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection.\n      */\n    insertCell(index?: number): HTMLTableDataCellElement;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableRowElement: {\n    prototype: HTMLTableRowElement;\n    new(): HTMLTableRowElement;\n}\n\ninterface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment {\n    /**\n      * Sets or retrieves a value that indicates the table alignment.\n      */\n    align: string;\n    /**\n      * Sets or retrieves the number of horizontal rows contained in the object.\n      */\n    rows: HTMLCollectionOf<HTMLTableRowElement>;\n    /**\n      * Removes the specified row (tr) from the element and from the rows collection.\n      * @param index Number that specifies the zero-based position in the rows collection of the row to remove.\n      */\n    deleteRow(index?: number): void;\n    /**\n      * Creates a new row (tr) in the table, and adds the row to the rows collection.\n      * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection.\n      */\n    insertRow(index?: number): HTMLTableRowElement;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableSectionElement: {\n    prototype: HTMLTableSectionElement;\n    new(): HTMLTableSectionElement;\n}\n\ninterface HTMLTemplateElement extends HTMLElement {\n    readonly content: DocumentFragment;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTemplateElement: {\n    prototype: HTMLTemplateElement;\n    new(): HTMLTemplateElement;\n}\n\ninterface HTMLTextAreaElement extends HTMLElement {\n    /**\n      * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\n      */\n    autofocus: boolean;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    cols: number;\n    /**\n      * Sets or retrieves the initial contents of the object.\n      */\n    defaultValue: string;\n    disabled: boolean;\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Sets or retrieves the maximum number of characters that the user can enter in a text control.\n      */\n    maxLength: number;\n    /**\n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    /**\n      * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field.\n      */\n    placeholder: string;\n    /**\n      * Sets or retrieves the value indicated whether the content of the object is read-only.\n      */\n    readOnly: boolean;\n    /**\n      * When present, marks an element that can't be submitted without a value.\n      */\n    required: boolean;\n    /**\n      * Sets or retrieves the number of horizontal rows contained in the object.\n      */\n    rows: number;\n    /**\n      * Gets or sets the end position or offset of a text selection.\n      */\n    selectionEnd: number;\n    /**\n      * Gets or sets the starting position or offset of a text selection.\n      */\n    selectionStart: number;\n    /**\n      * Sets or retrieves the value indicating whether the control is selected.\n      */\n    status: any;\n    /**\n      * Retrieves the type of control.\n      */\n    readonly type: string;\n    /**\n      * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n      */\n    readonly validationMessage: string;\n    /**\n      * Returns a  ValidityState object that represents the validity states of an element.\n      */\n    readonly validity: ValidityState;\n    /**\n      * Retrieves or sets the text in the entry field of the textArea element.\n      */\n    value: string;\n    /**\n      * Returns whether an element will successfully validate based on forms validation rules and constraints.\n      */\n    readonly willValidate: boolean;\n    /**\n      * Sets or retrieves how to handle wordwrapping in the object.\n      */\n    wrap: string;\n    minLength: number;\n    /**\n      * Returns whether a form will validate when it is submitted, without having to submit it.\n      */\n    checkValidity(): boolean;\n    /**\n      * Highlights the input area of a form element.\n      */\n    select(): void;\n    /**\n      * Sets a custom error message that is displayed when a form is submitted.\n      * @param error Sets a custom error message that is displayed when a form is submitted.\n      */\n    setCustomValidity(error: string): void;\n    /**\n      * Sets the start and end positions of a selection in a text field.\n      * @param start The offset into the text field for the start of the selection.\n      * @param end The offset into the text field for the end of the selection.\n      */\n    setSelectionRange(start: number, end: number): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTextAreaElement: {\n    prototype: HTMLTextAreaElement;\n    new(): HTMLTextAreaElement;\n}\n\ninterface HTMLTitleElement extends HTMLElement {\n    /**\n      * Retrieves or sets the text of the object as a string. \n      */\n    text: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTitleElement: {\n    prototype: HTMLTitleElement;\n    new(): HTMLTitleElement;\n}\n\ninterface HTMLTrackElement extends HTMLElement {\n    default: boolean;\n    kind: string;\n    label: string;\n    readonly readyState: number;\n    src: string;\n    srclang: string;\n    readonly track: TextTrack;\n    readonly ERROR: number;\n    readonly LOADED: number;\n    readonly LOADING: number;\n    readonly NONE: number;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTrackElement: {\n    prototype: HTMLTrackElement;\n    new(): HTMLTrackElement;\n    readonly ERROR: number;\n    readonly LOADED: number;\n    readonly LOADING: number;\n    readonly NONE: number;\n}\n\ninterface HTMLUListElement extends HTMLElement {\n    compact: boolean;\n    type: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLUListElement: {\n    prototype: HTMLUListElement;\n    new(): HTMLUListElement;\n}\n\ninterface HTMLUnknownElement extends HTMLElement {\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLUnknownElement: {\n    prototype: HTMLUnknownElement;\n    new(): HTMLUnknownElement;\n}\n\ninterface HTMLVideoElementEventMap extends HTMLMediaElementEventMap {\n    \"MSVideoFormatChanged\": Event;\n    \"MSVideoFrameStepCompleted\": Event;\n    \"MSVideoOptimalLayoutChanged\": Event;\n}\n\ninterface HTMLVideoElement extends HTMLMediaElement {\n    /**\n      * Gets or sets the height of the video element.\n      */\n    height: number;\n    msHorizontalMirror: boolean;\n    readonly msIsLayoutOptimalForPlayback: boolean;\n    readonly msIsStereo3D: boolean;\n    msStereo3DPackingMode: string;\n    msStereo3DRenderMode: string;\n    msZoom: boolean;\n    onMSVideoFormatChanged: (this: HTMLVideoElement, ev: Event) => any;\n    onMSVideoFrameStepCompleted: (this: HTMLVideoElement, ev: Event) => any;\n    onMSVideoOptimalLayoutChanged: (this: HTMLVideoElement, ev: Event) => any;\n    /**\n      * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available.\n      */\n    poster: string;\n    /**\n      * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known.\n      */\n    readonly videoHeight: number;\n    /**\n      * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known.\n      */\n    readonly videoWidth: number;\n    readonly webkitDisplayingFullscreen: boolean;\n    readonly webkitSupportsFullscreen: boolean;\n    /**\n      * Gets or sets the width of the video element.\n      */\n    width: number;\n    getVideoPlaybackQuality(): VideoPlaybackQuality;\n    msFrameStep(forward: boolean): void;\n    msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void;\n    msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void;\n    webkitEnterFullScreen(): void;\n    webkitEnterFullscreen(): void;\n    webkitExitFullScreen(): void;\n    webkitExitFullscreen(): void;\n    addEventListener<K extends keyof HTMLVideoElementEventMap>(type: K, listener: (this: HTMLVideoElement, ev: HTMLVideoElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLVideoElement: {\n    prototype: HTMLVideoElement;\n    new(): HTMLVideoElement;\n}\n\ninterface HashChangeEvent extends Event {\n    readonly newURL: string | null;\n    readonly oldURL: string | null;\n}\n\ndeclare var HashChangeEvent: {\n    prototype: HashChangeEvent;\n    new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent;\n}\n\ninterface History {\n    readonly length: number;\n    readonly state: any;\n    scrollRestoration: ScrollRestoration;\n    back(): void;\n    forward(): void;\n    go(delta?: number): void;\n    pushState(data: any, title: string, url?: string | null): void;\n    replaceState(data: any, title: string, url?: string | null): void;\n}\n\ndeclare var History: {\n    prototype: History;\n    new(): History;\n}\n\ninterface IDBCursor {\n    readonly direction: string;\n    key: IDBKeyRange | IDBValidKey;\n    readonly primaryKey: any;\n    source: IDBObjectStore | IDBIndex;\n    advance(count: number): void;\n    continue(key?: IDBKeyRange | IDBValidKey): void;\n    delete(): IDBRequest;\n    update(value: any): IDBRequest;\n    readonly NEXT: string;\n    readonly NEXT_NO_DUPLICATE: string;\n    readonly PREV: string;\n    readonly PREV_NO_DUPLICATE: string;\n}\n\ndeclare var IDBCursor: {\n    prototype: IDBCursor;\n    new(): IDBCursor;\n    readonly NEXT: string;\n    readonly NEXT_NO_DUPLICATE: string;\n    readonly PREV: string;\n    readonly PREV_NO_DUPLICATE: string;\n}\n\ninterface IDBCursorWithValue extends IDBCursor {\n    readonly value: any;\n}\n\ndeclare var IDBCursorWithValue: {\n    prototype: IDBCursorWithValue;\n    new(): IDBCursorWithValue;\n}\n\ninterface IDBDatabaseEventMap {\n    \"abort\": Event;\n    \"error\": ErrorEvent;\n}\n\ninterface IDBDatabase extends EventTarget {\n    readonly name: string;\n    readonly objectStoreNames: DOMStringList;\n    onabort: (this: IDBDatabase, ev: Event) => any;\n    onerror: (this: IDBDatabase, ev: ErrorEvent) => any;\n    version: number;\n    onversionchange: (ev: IDBVersionChangeEvent) => any;\n    close(): void;\n    createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;\n    deleteObjectStore(name: string): void;\n    transaction(storeNames: string | string[], mode?: string): IDBTransaction;\n    addEventListener(type: \"versionchange\", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;\n    addEventListener<K extends keyof IDBDatabaseEventMap>(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var IDBDatabase: {\n    prototype: IDBDatabase;\n    new(): IDBDatabase;\n}\n\ninterface IDBFactory {\n    cmp(first: any, second: any): number;\n    deleteDatabase(name: string): IDBOpenDBRequest;\n    open(name: string, version?: number): IDBOpenDBRequest;\n}\n\ndeclare var IDBFactory: {\n    prototype: IDBFactory;\n    new(): IDBFactory;\n}\n\ninterface IDBIndex {\n    keyPath: string | string[];\n    readonly name: string;\n    readonly objectStore: IDBObjectStore;\n    readonly unique: boolean;\n    multiEntry: boolean;\n    count(key?: IDBKeyRange | IDBValidKey): IDBRequest;\n    get(key: IDBKeyRange | IDBValidKey): IDBRequest;\n    getKey(key: IDBKeyRange | IDBValidKey): IDBRequest;\n    openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\n    openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\n}\n\ndeclare var IDBIndex: {\n    prototype: IDBIndex;\n    new(): IDBIndex;\n}\n\ninterface IDBKeyRange {\n    readonly lower: any;\n    readonly lowerOpen: boolean;\n    readonly upper: any;\n    readonly upperOpen: boolean;\n}\n\ndeclare var IDBKeyRange: {\n    prototype: IDBKeyRange;\n    new(): IDBKeyRange;\n    bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange;\n    lowerBound(lower: any, open?: boolean): IDBKeyRange;\n    only(value: any): IDBKeyRange;\n    upperBound(upper: any, open?: boolean): IDBKeyRange;\n}\n\ninterface IDBObjectStore {\n    readonly indexNames: DOMStringList;\n    keyPath: string | string[];\n    readonly name: string;\n    readonly transaction: IDBTransaction;\n    autoIncrement: boolean;\n    add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest;\n    clear(): IDBRequest;\n    count(key?: IDBKeyRange | IDBValidKey): IDBRequest;\n    createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex;\n    delete(key: IDBKeyRange | IDBValidKey): IDBRequest;\n    deleteIndex(indexName: string): void;\n    get(key: any): IDBRequest;\n    index(name: string): IDBIndex;\n    openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\n    put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest;\n}\n\ndeclare var IDBObjectStore: {\n    prototype: IDBObjectStore;\n    new(): IDBObjectStore;\n}\n\ninterface IDBOpenDBRequestEventMap extends IDBRequestEventMap {\n    \"blocked\": Event;\n    \"upgradeneeded\": IDBVersionChangeEvent;\n}\n\ninterface IDBOpenDBRequest extends IDBRequest {\n    onblocked: (this: IDBOpenDBRequest, ev: Event) => any;\n    onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any;\n    addEventListener<K extends keyof IDBOpenDBRequestEventMap>(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var IDBOpenDBRequest: {\n    prototype: IDBOpenDBRequest;\n    new(): IDBOpenDBRequest;\n}\n\ninterface IDBRequestEventMap {\n    \"error\": ErrorEvent;\n    \"success\": Event;\n}\n\ninterface IDBRequest extends EventTarget {\n    readonly error: DOMError;\n    onerror: (this: IDBRequest, ev: ErrorEvent) => any;\n    onsuccess: (this: IDBRequest, ev: Event) => any;\n    readonly readyState: string;\n    readonly result: any;\n    source: IDBObjectStore | IDBIndex | IDBCursor;\n    readonly transaction: IDBTransaction;\n    addEventListener<K extends keyof IDBRequestEventMap>(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var IDBRequest: {\n    prototype: IDBRequest;\n    new(): IDBRequest;\n}\n\ninterface IDBTransactionEventMap {\n    \"abort\": Event;\n    \"complete\": Event;\n    \"error\": ErrorEvent;\n}\n\ninterface IDBTransaction extends EventTarget {\n    readonly db: IDBDatabase;\n    readonly error: DOMError;\n    readonly mode: string;\n    onabort: (this: IDBTransaction, ev: Event) => any;\n    oncomplete: (this: IDBTransaction, ev: Event) => any;\n    onerror: (this: IDBTransaction, ev: ErrorEvent) => any;\n    abort(): void;\n    objectStore(name: string): IDBObjectStore;\n    readonly READ_ONLY: string;\n    readonly READ_WRITE: string;\n    readonly VERSION_CHANGE: string;\n    addEventListener<K extends keyof IDBTransactionEventMap>(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var IDBTransaction: {\n    prototype: IDBTransaction;\n    new(): IDBTransaction;\n    readonly READ_ONLY: string;\n    readonly READ_WRITE: string;\n    readonly VERSION_CHANGE: string;\n}\n\ninterface IDBVersionChangeEvent extends Event {\n    readonly newVersion: number | null;\n    readonly oldVersion: number;\n}\n\ndeclare var IDBVersionChangeEvent: {\n    prototype: IDBVersionChangeEvent;\n    new(): IDBVersionChangeEvent;\n}\n\ninterface ImageData {\n    data: Uint8ClampedArray;\n    readonly height: number;\n    readonly width: number;\n}\n\ndeclare var ImageData: {\n    prototype: ImageData;\n    new(width: number, height: number): ImageData;\n    new(array: Uint8ClampedArray, width: number, height: number): ImageData;\n}\n\ninterface KeyboardEvent extends UIEvent {\n    readonly altKey: boolean;\n    readonly char: string | null;\n    readonly charCode: number;\n    readonly ctrlKey: boolean;\n    readonly key: string;\n    readonly keyCode: number;\n    readonly locale: string;\n    readonly location: number;\n    readonly metaKey: boolean;\n    readonly repeat: boolean;\n    readonly shiftKey: boolean;\n    readonly which: number;\n    readonly code: string;\n    getModifierState(keyArg: string): boolean;\n    initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void;\n    readonly DOM_KEY_LOCATION_JOYSTICK: number;\n    readonly DOM_KEY_LOCATION_LEFT: number;\n    readonly DOM_KEY_LOCATION_MOBILE: number;\n    readonly DOM_KEY_LOCATION_NUMPAD: number;\n    readonly DOM_KEY_LOCATION_RIGHT: number;\n    readonly DOM_KEY_LOCATION_STANDARD: number;\n}\n\ndeclare var KeyboardEvent: {\n    prototype: KeyboardEvent;\n    new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent;\n    readonly DOM_KEY_LOCATION_JOYSTICK: number;\n    readonly DOM_KEY_LOCATION_LEFT: number;\n    readonly DOM_KEY_LOCATION_MOBILE: number;\n    readonly DOM_KEY_LOCATION_NUMPAD: number;\n    readonly DOM_KEY_LOCATION_RIGHT: number;\n    readonly DOM_KEY_LOCATION_STANDARD: number;\n}\n\ninterface ListeningStateChangedEvent extends Event {\n    readonly label: string;\n    readonly state: string;\n}\n\ndeclare var ListeningStateChangedEvent: {\n    prototype: ListeningStateChangedEvent;\n    new(): ListeningStateChangedEvent;\n}\n\ninterface Location {\n    hash: string;\n    host: string;\n    hostname: string;\n    href: string;\n    readonly origin: string;\n    pathname: string;\n    port: string;\n    protocol: string;\n    search: string;\n    assign(url: string): void;\n    reload(forcedReload?: boolean): void;\n    replace(url: string): void;\n    toString(): string;\n}\n\ndeclare var Location: {\n    prototype: Location;\n    new(): Location;\n}\n\ninterface LongRunningScriptDetectedEvent extends Event {\n    readonly executionTime: number;\n    stopPageScriptExecution: boolean;\n}\n\ndeclare var LongRunningScriptDetectedEvent: {\n    prototype: LongRunningScriptDetectedEvent;\n    new(): LongRunningScriptDetectedEvent;\n}\n\ninterface MSApp {\n    clearTemporaryWebDataAsync(): MSAppAsyncOperation;\n    createBlobFromRandomAccessStream(type: string, seeker: any): Blob;\n    createDataPackage(object: any): any;\n    createDataPackageFromSelection(): any;\n    createFileFromStorageFile(storageFile: any): File;\n    createStreamFromInputStream(type: string, inputStream: any): MSStream;\n    execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void;\n    execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any;\n    getCurrentPriority(): string;\n    getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike<any>;\n    getViewId(view: any): any;\n    isTaskScheduledAtPriorityOrHigher(priority: string): boolean;\n    pageHandlesAllApplicationActivations(enabled: boolean): void;\n    suppressSubdownloadCredentialPrompts(suppress: boolean): void;\n    terminateApp(exceptionObject: any): void;\n    readonly CURRENT: string;\n    readonly HIGH: string;\n    readonly IDLE: string;\n    readonly NORMAL: string;\n}\ndeclare var MSApp: MSApp;\n\ninterface MSAppAsyncOperationEventMap {\n    \"complete\": Event;\n    \"error\": ErrorEvent;\n}\n\ninterface MSAppAsyncOperation extends EventTarget {\n    readonly error: DOMError;\n    oncomplete: (this: MSAppAsyncOperation, ev: Event) => any;\n    onerror: (this: MSAppAsyncOperation, ev: ErrorEvent) => any;\n    readonly readyState: number;\n    readonly result: any;\n    start(): void;\n    readonly COMPLETED: number;\n    readonly ERROR: number;\n    readonly STARTED: number;\n    addEventListener<K extends keyof MSAppAsyncOperationEventMap>(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSAppAsyncOperation: {\n    prototype: MSAppAsyncOperation;\n    new(): MSAppAsyncOperation;\n    readonly COMPLETED: number;\n    readonly ERROR: number;\n    readonly STARTED: number;\n}\n\ninterface MSAssertion {\n    readonly id: string;\n    readonly type: string;\n}\n\ndeclare var MSAssertion: {\n    prototype: MSAssertion;\n    new(): MSAssertion;\n}\n\ninterface MSBlobBuilder {\n    append(data: any, endings?: string): void;\n    getBlob(contentType?: string): Blob;\n}\n\ndeclare var MSBlobBuilder: {\n    prototype: MSBlobBuilder;\n    new(): MSBlobBuilder;\n}\n\ninterface MSCredentials {\n    getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike<MSAssertion>;\n    makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike<MSAssertion>;\n}\n\ndeclare var MSCredentials: {\n    prototype: MSCredentials;\n    new(): MSCredentials;\n}\n\ninterface MSFIDOCredentialAssertion extends MSAssertion {\n    readonly algorithm: string | Algorithm;\n    readonly attestation: any;\n    readonly publicKey: string;\n    readonly transportHints: string[];\n}\n\ndeclare var MSFIDOCredentialAssertion: {\n    prototype: MSFIDOCredentialAssertion;\n    new(): MSFIDOCredentialAssertion;\n}\n\ninterface MSFIDOSignature {\n    readonly authnrData: string;\n    readonly clientData: string;\n    readonly signature: string;\n}\n\ndeclare var MSFIDOSignature: {\n    prototype: MSFIDOSignature;\n    new(): MSFIDOSignature;\n}\n\ninterface MSFIDOSignatureAssertion extends MSAssertion {\n    readonly signature: MSFIDOSignature;\n}\n\ndeclare var MSFIDOSignatureAssertion: {\n    prototype: MSFIDOSignatureAssertion;\n    new(): MSFIDOSignatureAssertion;\n}\n\ninterface MSGesture {\n    target: Element;\n    addPointer(pointerId: number): void;\n    stop(): void;\n}\n\ndeclare var MSGesture: {\n    prototype: MSGesture;\n    new(): MSGesture;\n}\n\ninterface MSGestureEvent extends UIEvent {\n    readonly clientX: number;\n    readonly clientY: number;\n    readonly expansion: number;\n    readonly gestureObject: any;\n    readonly hwTimestamp: number;\n    readonly offsetX: number;\n    readonly offsetY: number;\n    readonly rotation: number;\n    readonly scale: number;\n    readonly screenX: number;\n    readonly screenY: number;\n    readonly translationX: number;\n    readonly translationY: number;\n    readonly velocityAngular: number;\n    readonly velocityExpansion: number;\n    readonly velocityX: number;\n    readonly velocityY: number;\n    initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void;\n    readonly MSGESTURE_FLAG_BEGIN: number;\n    readonly MSGESTURE_FLAG_CANCEL: number;\n    readonly MSGESTURE_FLAG_END: number;\n    readonly MSGESTURE_FLAG_INERTIA: number;\n    readonly MSGESTURE_FLAG_NONE: number;\n}\n\ndeclare var MSGestureEvent: {\n    prototype: MSGestureEvent;\n    new(): MSGestureEvent;\n    readonly MSGESTURE_FLAG_BEGIN: number;\n    readonly MSGESTURE_FLAG_CANCEL: number;\n    readonly MSGESTURE_FLAG_END: number;\n    readonly MSGESTURE_FLAG_INERTIA: number;\n    readonly MSGESTURE_FLAG_NONE: number;\n}\n\ninterface MSGraphicsTrust {\n    readonly constrictionActive: boolean;\n    readonly status: string;\n}\n\ndeclare var MSGraphicsTrust: {\n    prototype: MSGraphicsTrust;\n    new(): MSGraphicsTrust;\n}\n\ninterface MSHTMLWebViewElement extends HTMLElement {\n    readonly canGoBack: boolean;\n    readonly canGoForward: boolean;\n    readonly containsFullScreenElement: boolean;\n    readonly documentTitle: string;\n    height: number;\n    readonly settings: MSWebViewSettings;\n    src: string;\n    width: number;\n    addWebAllowedObject(name: string, applicationObject: any): void;\n    buildLocalStreamUri(contentIdentifier: string, relativePath: string): string;\n    capturePreviewToBlobAsync(): MSWebViewAsyncOperation;\n    captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation;\n    getDeferredPermissionRequestById(id: number): DeferredPermissionRequest;\n    getDeferredPermissionRequests(): DeferredPermissionRequest[];\n    goBack(): void;\n    goForward(): void;\n    invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation;\n    navigate(uri: string): void;\n    navigateToLocalStreamUri(source: string, streamResolver: any): void;\n    navigateToString(contents: string): void;\n    navigateWithHttpRequestMessage(requestMessage: any): void;\n    refresh(): void;\n    stop(): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSHTMLWebViewElement: {\n    prototype: MSHTMLWebViewElement;\n    new(): MSHTMLWebViewElement;\n}\n\ninterface MSInputMethodContextEventMap {\n    \"MSCandidateWindowHide\": Event;\n    \"MSCandidateWindowShow\": Event;\n    \"MSCandidateWindowUpdate\": Event;\n}\n\ninterface MSInputMethodContext extends EventTarget {\n    readonly compositionEndOffset: number;\n    readonly compositionStartOffset: number;\n    oncandidatewindowhide: (this: MSInputMethodContext, ev: Event) => any;\n    oncandidatewindowshow: (this: MSInputMethodContext, ev: Event) => any;\n    oncandidatewindowupdate: (this: MSInputMethodContext, ev: Event) => any;\n    readonly target: HTMLElement;\n    getCandidateWindowClientRect(): ClientRect;\n    getCompositionAlternatives(): string[];\n    hasComposition(): boolean;\n    isCandidateWindowVisible(): boolean;\n    addEventListener<K extends keyof MSInputMethodContextEventMap>(type: K, listener: (this: MSInputMethodContext, ev: MSInputMethodContextEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSInputMethodContext: {\n    prototype: MSInputMethodContext;\n    new(): MSInputMethodContext;\n}\n\ninterface MSManipulationEvent extends UIEvent {\n    readonly currentState: number;\n    readonly inertiaDestinationX: number;\n    readonly inertiaDestinationY: number;\n    readonly lastState: number;\n    initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void;\n    readonly MS_MANIPULATION_STATE_ACTIVE: number;\n    readonly MS_MANIPULATION_STATE_CANCELLED: number;\n    readonly MS_MANIPULATION_STATE_COMMITTED: number;\n    readonly MS_MANIPULATION_STATE_DRAGGING: number;\n    readonly MS_MANIPULATION_STATE_INERTIA: number;\n    readonly MS_MANIPULATION_STATE_PRESELECT: number;\n    readonly MS_MANIPULATION_STATE_SELECTING: number;\n    readonly MS_MANIPULATION_STATE_STOPPED: number;\n}\n\ndeclare var MSManipulationEvent: {\n    prototype: MSManipulationEvent;\n    new(): MSManipulationEvent;\n    readonly MS_MANIPULATION_STATE_ACTIVE: number;\n    readonly MS_MANIPULATION_STATE_CANCELLED: number;\n    readonly MS_MANIPULATION_STATE_COMMITTED: number;\n    readonly MS_MANIPULATION_STATE_DRAGGING: number;\n    readonly MS_MANIPULATION_STATE_INERTIA: number;\n    readonly MS_MANIPULATION_STATE_PRESELECT: number;\n    readonly MS_MANIPULATION_STATE_SELECTING: number;\n    readonly MS_MANIPULATION_STATE_STOPPED: number;\n}\n\ninterface MSMediaKeyError {\n    readonly code: number;\n    readonly systemCode: number;\n    readonly MS_MEDIA_KEYERR_CLIENT: number;\n    readonly MS_MEDIA_KEYERR_DOMAIN: number;\n    readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number;\n    readonly MS_MEDIA_KEYERR_OUTPUT: number;\n    readonly MS_MEDIA_KEYERR_SERVICE: number;\n    readonly MS_MEDIA_KEYERR_UNKNOWN: number;\n}\n\ndeclare var MSMediaKeyError: {\n    prototype: MSMediaKeyError;\n    new(): MSMediaKeyError;\n    readonly MS_MEDIA_KEYERR_CLIENT: number;\n    readonly MS_MEDIA_KEYERR_DOMAIN: number;\n    readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number;\n    readonly MS_MEDIA_KEYERR_OUTPUT: number;\n    readonly MS_MEDIA_KEYERR_SERVICE: number;\n    readonly MS_MEDIA_KEYERR_UNKNOWN: number;\n}\n\ninterface MSMediaKeyMessageEvent extends Event {\n    readonly destinationURL: string | null;\n    readonly message: Uint8Array;\n}\n\ndeclare var MSMediaKeyMessageEvent: {\n    prototype: MSMediaKeyMessageEvent;\n    new(): MSMediaKeyMessageEvent;\n}\n\ninterface MSMediaKeyNeededEvent extends Event {\n    readonly initData: Uint8Array | null;\n}\n\ndeclare var MSMediaKeyNeededEvent: {\n    prototype: MSMediaKeyNeededEvent;\n    new(): MSMediaKeyNeededEvent;\n}\n\ninterface MSMediaKeySession extends EventTarget {\n    readonly error: MSMediaKeyError | null;\n    readonly keySystem: string;\n    readonly sessionId: string;\n    close(): void;\n    update(key: Uint8Array): void;\n}\n\ndeclare var MSMediaKeySession: {\n    prototype: MSMediaKeySession;\n    new(): MSMediaKeySession;\n}\n\ninterface MSMediaKeys {\n    readonly keySystem: string;\n    createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession;\n}\n\ndeclare var MSMediaKeys: {\n    prototype: MSMediaKeys;\n    new(keySystem: string): MSMediaKeys;\n    isTypeSupported(keySystem: string, type?: string): boolean;\n    isTypeSupportedWithFeatures(keySystem: string, type?: string): string;\n}\n\ninterface MSPointerEvent extends MouseEvent {\n    readonly currentPoint: any;\n    readonly height: number;\n    readonly hwTimestamp: number;\n    readonly intermediatePoints: any;\n    readonly isPrimary: boolean;\n    readonly pointerId: number;\n    readonly pointerType: any;\n    readonly pressure: number;\n    readonly rotation: number;\n    readonly tiltX: number;\n    readonly tiltY: number;\n    readonly width: number;\n    getCurrentPoint(element: Element): void;\n    getIntermediatePoints(element: Element): void;\n    initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void;\n}\n\ndeclare var MSPointerEvent: {\n    prototype: MSPointerEvent;\n    new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent;\n}\n\ninterface MSRangeCollection {\n    readonly length: number;\n    item(index: number): Range;\n    [index: number]: Range;\n}\n\ndeclare var MSRangeCollection: {\n    prototype: MSRangeCollection;\n    new(): MSRangeCollection;\n}\n\ninterface MSSiteModeEvent extends Event {\n    readonly actionURL: string;\n    readonly buttonID: number;\n}\n\ndeclare var MSSiteModeEvent: {\n    prototype: MSSiteModeEvent;\n    new(): MSSiteModeEvent;\n}\n\ninterface MSStream {\n    readonly type: string;\n    msClose(): void;\n    msDetachStream(): any;\n}\n\ndeclare var MSStream: {\n    prototype: MSStream;\n    new(): MSStream;\n}\n\ninterface MSStreamReader extends EventTarget, MSBaseReader {\n    readonly error: DOMError;\n    readAsArrayBuffer(stream: MSStream, size?: number): void;\n    readAsBinaryString(stream: MSStream, size?: number): void;\n    readAsBlob(stream: MSStream, size?: number): void;\n    readAsDataURL(stream: MSStream, size?: number): void;\n    readAsText(stream: MSStream, encoding?: string, size?: number): void;\n    addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSStreamReader: {\n    prototype: MSStreamReader;\n    new(): MSStreamReader;\n}\n\ninterface MSWebViewAsyncOperationEventMap {\n    \"complete\": Event;\n    \"error\": ErrorEvent;\n}\n\ninterface MSWebViewAsyncOperation extends EventTarget {\n    readonly error: DOMError;\n    oncomplete: (this: MSWebViewAsyncOperation, ev: Event) => any;\n    onerror: (this: MSWebViewAsyncOperation, ev: ErrorEvent) => any;\n    readonly readyState: number;\n    readonly result: any;\n    readonly target: MSHTMLWebViewElement;\n    readonly type: number;\n    start(): void;\n    readonly COMPLETED: number;\n    readonly ERROR: number;\n    readonly STARTED: number;\n    readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number;\n    readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number;\n    readonly TYPE_INVOKE_SCRIPT: number;\n    addEventListener<K extends keyof MSWebViewAsyncOperationEventMap>(type: K, listener: (this: MSWebViewAsyncOperation, ev: MSWebViewAsyncOperationEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSWebViewAsyncOperation: {\n    prototype: MSWebViewAsyncOperation;\n    new(): MSWebViewAsyncOperation;\n    readonly COMPLETED: number;\n    readonly ERROR: number;\n    readonly STARTED: number;\n    readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number;\n    readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number;\n    readonly TYPE_INVOKE_SCRIPT: number;\n}\n\ninterface MSWebViewSettings {\n    isIndexedDBEnabled: boolean;\n    isJavaScriptEnabled: boolean;\n}\n\ndeclare var MSWebViewSettings: {\n    prototype: MSWebViewSettings;\n    new(): MSWebViewSettings;\n}\n\ninterface MediaDeviceInfo {\n    readonly deviceId: string;\n    readonly groupId: string;\n    readonly kind: string;\n    readonly label: string;\n}\n\ndeclare var MediaDeviceInfo: {\n    prototype: MediaDeviceInfo;\n    new(): MediaDeviceInfo;\n}\n\ninterface MediaDevicesEventMap {\n    \"devicechange\": Event;\n}\n\ninterface MediaDevices extends EventTarget {\n    ondevicechange: (this: MediaDevices, ev: Event) => any;\n    enumerateDevices(): any;\n    getSupportedConstraints(): MediaTrackSupportedConstraints;\n    getUserMedia(constraints: MediaStreamConstraints): PromiseLike<MediaStream>;\n    addEventListener<K extends keyof MediaDevicesEventMap>(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MediaDevices: {\n    prototype: MediaDevices;\n    new(): MediaDevices;\n}\n\ninterface MediaElementAudioSourceNode extends AudioNode {\n}\n\ndeclare var MediaElementAudioSourceNode: {\n    prototype: MediaElementAudioSourceNode;\n    new(): MediaElementAudioSourceNode;\n}\n\ninterface MediaEncryptedEvent extends Event {\n    readonly initData: ArrayBuffer | null;\n    readonly initDataType: string;\n}\n\ndeclare var MediaEncryptedEvent: {\n    prototype: MediaEncryptedEvent;\n    new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent;\n}\n\ninterface MediaError {\n    readonly code: number;\n    readonly msExtendedCode: number;\n    readonly MEDIA_ERR_ABORTED: number;\n    readonly MEDIA_ERR_DECODE: number;\n    readonly MEDIA_ERR_NETWORK: number;\n    readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number;\n    readonly MS_MEDIA_ERR_ENCRYPTED: number;\n}\n\ndeclare var MediaError: {\n    prototype: MediaError;\n    new(): MediaError;\n    readonly MEDIA_ERR_ABORTED: number;\n    readonly MEDIA_ERR_DECODE: number;\n    readonly MEDIA_ERR_NETWORK: number;\n    readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number;\n    readonly MS_MEDIA_ERR_ENCRYPTED: number;\n}\n\ninterface MediaKeyMessageEvent extends Event {\n    readonly message: ArrayBuffer;\n    readonly messageType: string;\n}\n\ndeclare var MediaKeyMessageEvent: {\n    prototype: MediaKeyMessageEvent;\n    new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent;\n}\n\ninterface MediaKeySession extends EventTarget {\n    readonly closed: PromiseLike<void>;\n    readonly expiration: number;\n    readonly keyStatuses: MediaKeyStatusMap;\n    readonly sessionId: string;\n    close(): PromiseLike<void>;\n    generateRequest(initDataType: string, initData: any): PromiseLike<void>;\n    load(sessionId: string): PromiseLike<boolean>;\n    remove(): PromiseLike<void>;\n    update(response: any): PromiseLike<void>;\n}\n\ndeclare var MediaKeySession: {\n    prototype: MediaKeySession;\n    new(): MediaKeySession;\n}\n\ninterface MediaKeyStatusMap {\n    readonly size: number;\n    forEach(callback: ForEachCallback): void;\n    get(keyId: any): string;\n    has(keyId: any): boolean;\n}\n\ndeclare var MediaKeyStatusMap: {\n    prototype: MediaKeyStatusMap;\n    new(): MediaKeyStatusMap;\n}\n\ninterface MediaKeySystemAccess {\n    readonly keySystem: string;\n    createMediaKeys(): PromiseLike<MediaKeys>;\n    getConfiguration(): MediaKeySystemConfiguration;\n}\n\ndeclare var MediaKeySystemAccess: {\n    prototype: MediaKeySystemAccess;\n    new(): MediaKeySystemAccess;\n}\n\ninterface MediaKeys {\n    createSession(sessionType?: string): MediaKeySession;\n    setServerCertificate(serverCertificate: any): PromiseLike<void>;\n}\n\ndeclare var MediaKeys: {\n    prototype: MediaKeys;\n    new(): MediaKeys;\n}\n\ninterface MediaList {\n    readonly length: number;\n    mediaText: string;\n    appendMedium(newMedium: string): void;\n    deleteMedium(oldMedium: string): void;\n    item(index: number): string;\n    toString(): string;\n    [index: number]: string;\n}\n\ndeclare var MediaList: {\n    prototype: MediaList;\n    new(): MediaList;\n}\n\ninterface MediaQueryList {\n    readonly matches: boolean;\n    readonly media: string;\n    addListener(listener: MediaQueryListListener): void;\n    removeListener(listener: MediaQueryListListener): void;\n}\n\ndeclare var MediaQueryList: {\n    prototype: MediaQueryList;\n    new(): MediaQueryList;\n}\n\ninterface MediaSource extends EventTarget {\n    readonly activeSourceBuffers: SourceBufferList;\n    duration: number;\n    readonly readyState: string;\n    readonly sourceBuffers: SourceBufferList;\n    addSourceBuffer(type: string): SourceBuffer;\n    endOfStream(error?: number): void;\n    removeSourceBuffer(sourceBuffer: SourceBuffer): void;\n}\n\ndeclare var MediaSource: {\n    prototype: MediaSource;\n    new(): MediaSource;\n    isTypeSupported(type: string): boolean;\n}\n\ninterface MediaStreamEventMap {\n    \"active\": Event;\n    \"addtrack\": TrackEvent;\n    \"inactive\": Event;\n    \"removetrack\": TrackEvent;\n}\n\ninterface MediaStream extends EventTarget {\n    readonly active: boolean;\n    readonly id: string;\n    onactive: (this: MediaStream, ev: Event) => any;\n    onaddtrack: (this: MediaStream, ev: TrackEvent) => any;\n    oninactive: (this: MediaStream, ev: Event) => any;\n    onremovetrack: (this: MediaStream, ev: TrackEvent) => any;\n    addTrack(track: MediaStreamTrack): void;\n    clone(): MediaStream;\n    getAudioTracks(): MediaStreamTrack[];\n    getTrackById(trackId: string): MediaStreamTrack | null;\n    getTracks(): MediaStreamTrack[];\n    getVideoTracks(): MediaStreamTrack[];\n    removeTrack(track: MediaStreamTrack): void;\n    stop(): void;\n    addEventListener<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MediaStream: {\n    prototype: MediaStream;\n    new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream;\n}\n\ninterface MediaStreamAudioSourceNode extends AudioNode {\n}\n\ndeclare var MediaStreamAudioSourceNode: {\n    prototype: MediaStreamAudioSourceNode;\n    new(): MediaStreamAudioSourceNode;\n}\n\ninterface MediaStreamError {\n    readonly constraintName: string | null;\n    readonly message: string | null;\n    readonly name: string;\n}\n\ndeclare var MediaStreamError: {\n    prototype: MediaStreamError;\n    new(): MediaStreamError;\n}\n\ninterface MediaStreamErrorEvent extends Event {\n    readonly error: MediaStreamError | null;\n}\n\ndeclare var MediaStreamErrorEvent: {\n    prototype: MediaStreamErrorEvent;\n    new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent;\n}\n\ninterface MediaStreamTrackEventMap {\n    \"ended\": MediaStreamErrorEvent;\n    \"mute\": Event;\n    \"overconstrained\": MediaStreamErrorEvent;\n    \"unmute\": Event;\n}\n\ninterface MediaStreamTrack extends EventTarget {\n    enabled: boolean;\n    readonly id: string;\n    readonly kind: string;\n    readonly label: string;\n    readonly muted: boolean;\n    onended: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any;\n    onmute: (this: MediaStreamTrack, ev: Event) => any;\n    onoverconstrained: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any;\n    onunmute: (this: MediaStreamTrack, ev: Event) => any;\n    readonly readonly: boolean;\n    readonly readyState: string;\n    readonly remote: boolean;\n    applyConstraints(constraints: MediaTrackConstraints): PromiseLike<void>;\n    clone(): MediaStreamTrack;\n    getCapabilities(): MediaTrackCapabilities;\n    getConstraints(): MediaTrackConstraints;\n    getSettings(): MediaTrackSettings;\n    stop(): void;\n    addEventListener<K extends keyof MediaStreamTrackEventMap>(type: K, listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MediaStreamTrack: {\n    prototype: MediaStreamTrack;\n    new(): MediaStreamTrack;\n}\n\ninterface MediaStreamTrackEvent extends Event {\n    readonly track: MediaStreamTrack;\n}\n\ndeclare var MediaStreamTrackEvent: {\n    prototype: MediaStreamTrackEvent;\n    new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent;\n}\n\ninterface MessageChannel {\n    readonly port1: MessagePort;\n    readonly port2: MessagePort;\n}\n\ndeclare var MessageChannel: {\n    prototype: MessageChannel;\n    new(): MessageChannel;\n}\n\ninterface MessageEvent extends Event {\n    readonly data: any;\n    readonly origin: string;\n    readonly ports: any;\n    readonly source: Window;\n    initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void;\n}\n\ndeclare var MessageEvent: {\n    prototype: MessageEvent;\n    new(type: string, eventInitDict?: MessageEventInit): MessageEvent;\n}\n\ninterface MessagePortEventMap {\n    \"message\": MessageEvent;\n}\n\ninterface MessagePort extends EventTarget {\n    onmessage: (this: MessagePort, ev: MessageEvent) => any;\n    close(): void;\n    postMessage(message?: any, ports?: any): void;\n    start(): void;\n    addEventListener<K extends keyof MessagePortEventMap>(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MessagePort: {\n    prototype: MessagePort;\n    new(): MessagePort;\n}\n\ninterface MimeType {\n    readonly description: string;\n    readonly enabledPlugin: Plugin;\n    readonly suffixes: string;\n    readonly type: string;\n}\n\ndeclare var MimeType: {\n    prototype: MimeType;\n    new(): MimeType;\n}\n\ninterface MimeTypeArray {\n    readonly length: number;\n    item(index: number): Plugin;\n    namedItem(type: string): Plugin;\n    [index: number]: Plugin;\n}\n\ndeclare var MimeTypeArray: {\n    prototype: MimeTypeArray;\n    new(): MimeTypeArray;\n}\n\ninterface MouseEvent extends UIEvent {\n    readonly altKey: boolean;\n    readonly button: number;\n    readonly buttons: number;\n    readonly clientX: number;\n    readonly clientY: number;\n    readonly ctrlKey: boolean;\n    readonly fromElement: Element;\n    readonly layerX: number;\n    readonly layerY: number;\n    readonly metaKey: boolean;\n    readonly movementX: number;\n    readonly movementY: number;\n    readonly offsetX: number;\n    readonly offsetY: number;\n    readonly pageX: number;\n    readonly pageY: number;\n    readonly relatedTarget: EventTarget;\n    readonly screenX: number;\n    readonly screenY: number;\n    readonly shiftKey: boolean;\n    readonly toElement: Element;\n    readonly which: number;\n    readonly x: number;\n    readonly y: number;\n    getModifierState(keyArg: string): boolean;\n    initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void;\n}\n\ndeclare var MouseEvent: {\n    prototype: MouseEvent;\n    new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent;\n}\n\ninterface MutationEvent extends Event {\n    readonly attrChange: number;\n    readonly attrName: string;\n    readonly newValue: string;\n    readonly prevValue: string;\n    readonly relatedNode: Node;\n    initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void;\n    readonly ADDITION: number;\n    readonly MODIFICATION: number;\n    readonly REMOVAL: number;\n}\n\ndeclare var MutationEvent: {\n    prototype: MutationEvent;\n    new(): MutationEvent;\n    readonly ADDITION: number;\n    readonly MODIFICATION: number;\n    readonly REMOVAL: number;\n}\n\ninterface MutationObserver {\n    disconnect(): void;\n    observe(target: Node, options: MutationObserverInit): void;\n    takeRecords(): MutationRecord[];\n}\n\ndeclare var MutationObserver: {\n    prototype: MutationObserver;\n    new(callback: MutationCallback): MutationObserver;\n}\n\ninterface MutationRecord {\n    readonly addedNodes: NodeList;\n    readonly attributeName: string | null;\n    readonly attributeNamespace: string | null;\n    readonly nextSibling: Node | null;\n    readonly oldValue: string | null;\n    readonly previousSibling: Node | null;\n    readonly removedNodes: NodeList;\n    readonly target: Node;\n    readonly type: string;\n}\n\ndeclare var MutationRecord: {\n    prototype: MutationRecord;\n    new(): MutationRecord;\n}\n\ninterface NamedNodeMap {\n    readonly length: number;\n    getNamedItem(name: string): Attr;\n    getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr;\n    item(index: number): Attr;\n    removeNamedItem(name: string): Attr;\n    removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr;\n    setNamedItem(arg: Attr): Attr;\n    setNamedItemNS(arg: Attr): Attr;\n    [index: number]: Attr;\n}\n\ndeclare var NamedNodeMap: {\n    prototype: NamedNodeMap;\n    new(): NamedNodeMap;\n}\n\ninterface NavigationCompletedEvent extends NavigationEvent {\n    readonly isSuccess: boolean;\n    readonly webErrorStatus: number;\n}\n\ndeclare var NavigationCompletedEvent: {\n    prototype: NavigationCompletedEvent;\n    new(): NavigationCompletedEvent;\n}\n\ninterface NavigationEvent extends Event {\n    readonly uri: string;\n}\n\ndeclare var NavigationEvent: {\n    prototype: NavigationEvent;\n    new(): NavigationEvent;\n}\n\ninterface NavigationEventWithReferrer extends NavigationEvent {\n    readonly referer: string;\n}\n\ndeclare var NavigationEventWithReferrer: {\n    prototype: NavigationEventWithReferrer;\n    new(): NavigationEventWithReferrer;\n}\n\ninterface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia {\n    readonly appCodeName: string;\n    readonly cookieEnabled: boolean;\n    readonly language: string;\n    readonly maxTouchPoints: number;\n    readonly mimeTypes: MimeTypeArray;\n    readonly msManipulationViewsEnabled: boolean;\n    readonly msMaxTouchPoints: number;\n    readonly msPointerEnabled: boolean;\n    readonly plugins: PluginArray;\n    readonly pointerEnabled: boolean;\n    readonly webdriver: boolean;\n    readonly hardwareConcurrency: number;\n    getGamepads(): Gamepad[];\n    javaEnabled(): boolean;\n    msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void;\n    requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike<MediaKeySystemAccess>;\n    vibrate(pattern: number | number[]): boolean;\n}\n\ndeclare var Navigator: {\n    prototype: Navigator;\n    new(): Navigator;\n}\n\ninterface Node extends EventTarget {\n    readonly attributes: NamedNodeMap;\n    readonly baseURI: string | null;\n    readonly childNodes: NodeList;\n    readonly firstChild: Node | null;\n    readonly lastChild: Node | null;\n    readonly localName: string | null;\n    readonly namespaceURI: string | null;\n    readonly nextSibling: Node | null;\n    readonly nodeName: string;\n    readonly nodeType: number;\n    nodeValue: string | null;\n    readonly ownerDocument: Document;\n    readonly parentElement: HTMLElement | null;\n    readonly parentNode: Node | null;\n    readonly previousSibling: Node | null;\n    textContent: string | null;\n    appendChild(newChild: Node): Node;\n    cloneNode(deep?: boolean): Node;\n    compareDocumentPosition(other: Node): number;\n    contains(child: Node): boolean;\n    hasAttributes(): boolean;\n    hasChildNodes(): boolean;\n    insertBefore(newChild: Node, refChild: Node | null): Node;\n    isDefaultNamespace(namespaceURI: string | null): boolean;\n    isEqualNode(arg: Node): boolean;\n    isSameNode(other: Node): boolean;\n    lookupNamespaceURI(prefix: string | null): string | null;\n    lookupPrefix(namespaceURI: string | null): string | null;\n    normalize(): void;\n    removeChild(oldChild: Node): Node;\n    replaceChild(newChild: Node, oldChild: Node): Node;\n    readonly ATTRIBUTE_NODE: number;\n    readonly CDATA_SECTION_NODE: number;\n    readonly COMMENT_NODE: number;\n    readonly DOCUMENT_FRAGMENT_NODE: number;\n    readonly DOCUMENT_NODE: number;\n    readonly DOCUMENT_POSITION_CONTAINED_BY: number;\n    readonly DOCUMENT_POSITION_CONTAINS: number;\n    readonly DOCUMENT_POSITION_DISCONNECTED: number;\n    readonly DOCUMENT_POSITION_FOLLOWING: number;\n    readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;\n    readonly DOCUMENT_POSITION_PRECEDING: number;\n    readonly DOCUMENT_TYPE_NODE: number;\n    readonly ELEMENT_NODE: number;\n    readonly ENTITY_NODE: number;\n    readonly ENTITY_REFERENCE_NODE: number;\n    readonly NOTATION_NODE: number;\n    readonly PROCESSING_INSTRUCTION_NODE: number;\n    readonly TEXT_NODE: number;\n}\n\ndeclare var Node: {\n    prototype: Node;\n    new(): Node;\n    readonly ATTRIBUTE_NODE: number;\n    readonly CDATA_SECTION_NODE: number;\n    readonly COMMENT_NODE: number;\n    readonly DOCUMENT_FRAGMENT_NODE: number;\n    readonly DOCUMENT_NODE: number;\n    readonly DOCUMENT_POSITION_CONTAINED_BY: number;\n    readonly DOCUMENT_POSITION_CONTAINS: number;\n    readonly DOCUMENT_POSITION_DISCONNECTED: number;\n    readonly DOCUMENT_POSITION_FOLLOWING: number;\n    readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;\n    readonly DOCUMENT_POSITION_PRECEDING: number;\n    readonly DOCUMENT_TYPE_NODE: number;\n    readonly ELEMENT_NODE: number;\n    readonly ENTITY_NODE: number;\n    readonly ENTITY_REFERENCE_NODE: number;\n    readonly NOTATION_NODE: number;\n    readonly PROCESSING_INSTRUCTION_NODE: number;\n    readonly TEXT_NODE: number;\n}\n\ninterface NodeFilter {\n    acceptNode(n: Node): number;\n}\n\ndeclare var NodeFilter: {\n    readonly FILTER_ACCEPT: number;\n    readonly FILTER_REJECT: number;\n    readonly FILTER_SKIP: number;\n    readonly SHOW_ALL: number;\n    readonly SHOW_ATTRIBUTE: number;\n    readonly SHOW_CDATA_SECTION: number;\n    readonly SHOW_COMMENT: number;\n    readonly SHOW_DOCUMENT: number;\n    readonly SHOW_DOCUMENT_FRAGMENT: number;\n    readonly SHOW_DOCUMENT_TYPE: number;\n    readonly SHOW_ELEMENT: number;\n    readonly SHOW_ENTITY: number;\n    readonly SHOW_ENTITY_REFERENCE: number;\n    readonly SHOW_NOTATION: number;\n    readonly SHOW_PROCESSING_INSTRUCTION: number;\n    readonly SHOW_TEXT: number;\n}\n\ninterface NodeIterator {\n    readonly expandEntityReferences: boolean;\n    readonly filter: NodeFilter;\n    readonly root: Node;\n    readonly whatToShow: number;\n    detach(): void;\n    nextNode(): Node;\n    previousNode(): Node;\n}\n\ndeclare var NodeIterator: {\n    prototype: NodeIterator;\n    new(): NodeIterator;\n}\n\ninterface NodeList {\n    readonly length: number;\n    item(index: number): Node;\n    [index: number]: Node;\n}\n\ndeclare var NodeList: {\n    prototype: NodeList;\n    new(): NodeList;\n}\n\ninterface OES_element_index_uint {\n}\n\ndeclare var OES_element_index_uint: {\n    prototype: OES_element_index_uint;\n    new(): OES_element_index_uint;\n}\n\ninterface OES_standard_derivatives {\n    readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number;\n}\n\ndeclare var OES_standard_derivatives: {\n    prototype: OES_standard_derivatives;\n    new(): OES_standard_derivatives;\n    readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number;\n}\n\ninterface OES_texture_float {\n}\n\ndeclare var OES_texture_float: {\n    prototype: OES_texture_float;\n    new(): OES_texture_float;\n}\n\ninterface OES_texture_float_linear {\n}\n\ndeclare var OES_texture_float_linear: {\n    prototype: OES_texture_float_linear;\n    new(): OES_texture_float_linear;\n}\n\ninterface OfflineAudioCompletionEvent extends Event {\n    readonly renderedBuffer: AudioBuffer;\n}\n\ndeclare var OfflineAudioCompletionEvent: {\n    prototype: OfflineAudioCompletionEvent;\n    new(): OfflineAudioCompletionEvent;\n}\n\ninterface OfflineAudioContextEventMap {\n    \"complete\": Event;\n}\n\ninterface OfflineAudioContext extends AudioContext {\n    oncomplete: (this: OfflineAudioContext, ev: Event) => any;\n    startRendering(): PromiseLike<AudioBuffer>;\n    addEventListener<K extends keyof OfflineAudioContextEventMap>(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var OfflineAudioContext: {\n    prototype: OfflineAudioContext;\n    new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext;\n}\n\ninterface OscillatorNodeEventMap {\n    \"ended\": MediaStreamErrorEvent;\n}\n\ninterface OscillatorNode extends AudioNode {\n    readonly detune: AudioParam;\n    readonly frequency: AudioParam;\n    onended: (this: OscillatorNode, ev: MediaStreamErrorEvent) => any;\n    type: string;\n    setPeriodicWave(periodicWave: PeriodicWave): void;\n    start(when?: number): void;\n    stop(when?: number): void;\n    addEventListener<K extends keyof OscillatorNodeEventMap>(type: K, listener: (this: OscillatorNode, ev: OscillatorNodeEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var OscillatorNode: {\n    prototype: OscillatorNode;\n    new(): OscillatorNode;\n}\n\ninterface OverflowEvent extends UIEvent {\n    readonly horizontalOverflow: boolean;\n    readonly orient: number;\n    readonly verticalOverflow: boolean;\n    readonly BOTH: number;\n    readonly HORIZONTAL: number;\n    readonly VERTICAL: number;\n}\n\ndeclare var OverflowEvent: {\n    prototype: OverflowEvent;\n    new(): OverflowEvent;\n    readonly BOTH: number;\n    readonly HORIZONTAL: number;\n    readonly VERTICAL: number;\n}\n\ninterface PageTransitionEvent extends Event {\n    readonly persisted: boolean;\n}\n\ndeclare var PageTransitionEvent: {\n    prototype: PageTransitionEvent;\n    new(): PageTransitionEvent;\n}\n\ninterface PannerNode extends AudioNode {\n    coneInnerAngle: number;\n    coneOuterAngle: number;\n    coneOuterGain: number;\n    distanceModel: string;\n    maxDistance: number;\n    panningModel: string;\n    refDistance: number;\n    rolloffFactor: number;\n    setOrientation(x: number, y: number, z: number): void;\n    setPosition(x: number, y: number, z: number): void;\n    setVelocity(x: number, y: number, z: number): void;\n}\n\ndeclare var PannerNode: {\n    prototype: PannerNode;\n    new(): PannerNode;\n}\n\ninterface PerfWidgetExternal {\n    readonly activeNetworkRequestCount: number;\n    readonly averageFrameTime: number;\n    readonly averagePaintTime: number;\n    readonly extraInformationEnabled: boolean;\n    readonly independentRenderingEnabled: boolean;\n    readonly irDisablingContentString: string;\n    readonly irStatusAvailable: boolean;\n    readonly maxCpuSpeed: number;\n    readonly paintRequestsPerSecond: number;\n    readonly performanceCounter: number;\n    readonly performanceCounterFrequency: number;\n    addEventListener(eventType: string, callback: Function): void;\n    getMemoryUsage(): number;\n    getProcessCpuUsage(): number;\n    getRecentCpuUsage(last: number | null): any;\n    getRecentFrames(last: number | null): any;\n    getRecentMemoryUsage(last: number | null): any;\n    getRecentPaintRequests(last: number | null): any;\n    removeEventListener(eventType: string, callback: Function): void;\n    repositionWindow(x: number, y: number): void;\n    resizeWindow(width: number, height: number): void;\n}\n\ndeclare var PerfWidgetExternal: {\n    prototype: PerfWidgetExternal;\n    new(): PerfWidgetExternal;\n}\n\ninterface Performance {\n    readonly navigation: PerformanceNavigation;\n    readonly timing: PerformanceTiming;\n    clearMarks(markName?: string): void;\n    clearMeasures(measureName?: string): void;\n    clearResourceTimings(): void;\n    getEntries(): any;\n    getEntriesByName(name: string, entryType?: string): any;\n    getEntriesByType(entryType: string): any;\n    getMarks(markName?: string): any;\n    getMeasures(measureName?: string): any;\n    mark(markName: string): void;\n    measure(measureName: string, startMarkName?: string, endMarkName?: string): void;\n    now(): number;\n    setResourceTimingBufferSize(maxSize: number): void;\n    toJSON(): any;\n}\n\ndeclare var Performance: {\n    prototype: Performance;\n    new(): Performance;\n}\n\ninterface PerformanceEntry {\n    readonly duration: number;\n    readonly entryType: string;\n    readonly name: string;\n    readonly startTime: number;\n}\n\ndeclare var PerformanceEntry: {\n    prototype: PerformanceEntry;\n    new(): PerformanceEntry;\n}\n\ninterface PerformanceMark extends PerformanceEntry {\n}\n\ndeclare var PerformanceMark: {\n    prototype: PerformanceMark;\n    new(): PerformanceMark;\n}\n\ninterface PerformanceMeasure extends PerformanceEntry {\n}\n\ndeclare var PerformanceMeasure: {\n    prototype: PerformanceMeasure;\n    new(): PerformanceMeasure;\n}\n\ninterface PerformanceNavigation {\n    readonly redirectCount: number;\n    readonly type: number;\n    toJSON(): any;\n    readonly TYPE_BACK_FORWARD: number;\n    readonly TYPE_NAVIGATE: number;\n    readonly TYPE_RELOAD: number;\n    readonly TYPE_RESERVED: number;\n}\n\ndeclare var PerformanceNavigation: {\n    prototype: PerformanceNavigation;\n    new(): PerformanceNavigation;\n    readonly TYPE_BACK_FORWARD: number;\n    readonly TYPE_NAVIGATE: number;\n    readonly TYPE_RELOAD: number;\n    readonly TYPE_RESERVED: number;\n}\n\ninterface PerformanceNavigationTiming extends PerformanceEntry {\n    readonly connectEnd: number;\n    readonly connectStart: number;\n    readonly domComplete: number;\n    readonly domContentLoadedEventEnd: number;\n    readonly domContentLoadedEventStart: number;\n    readonly domInteractive: number;\n    readonly domLoading: number;\n    readonly domainLookupEnd: number;\n    readonly domainLookupStart: number;\n    readonly fetchStart: number;\n    readonly loadEventEnd: number;\n    readonly loadEventStart: number;\n    readonly navigationStart: number;\n    readonly redirectCount: number;\n    readonly redirectEnd: number;\n    readonly redirectStart: number;\n    readonly requestStart: number;\n    readonly responseEnd: number;\n    readonly responseStart: number;\n    readonly type: string;\n    readonly unloadEventEnd: number;\n    readonly unloadEventStart: number;\n}\n\ndeclare var PerformanceNavigationTiming: {\n    prototype: PerformanceNavigationTiming;\n    new(): PerformanceNavigationTiming;\n}\n\ninterface PerformanceResourceTiming extends PerformanceEntry {\n    readonly connectEnd: number;\n    readonly connectStart: number;\n    readonly domainLookupEnd: number;\n    readonly domainLookupStart: number;\n    readonly fetchStart: number;\n    readonly initiatorType: string;\n    readonly redirectEnd: number;\n    readonly redirectStart: number;\n    readonly requestStart: number;\n    readonly responseEnd: number;\n    readonly responseStart: number;\n}\n\ndeclare var PerformanceResourceTiming: {\n    prototype: PerformanceResourceTiming;\n    new(): PerformanceResourceTiming;\n}\n\ninterface PerformanceTiming {\n    readonly connectEnd: number;\n    readonly connectStart: number;\n    readonly domComplete: number;\n    readonly domContentLoadedEventEnd: number;\n    readonly domContentLoadedEventStart: number;\n    readonly domInteractive: number;\n    readonly domLoading: number;\n    readonly domainLookupEnd: number;\n    readonly domainLookupStart: number;\n    readonly fetchStart: number;\n    readonly loadEventEnd: number;\n    readonly loadEventStart: number;\n    readonly msFirstPaint: number;\n    readonly navigationStart: number;\n    readonly redirectEnd: number;\n    readonly redirectStart: number;\n    readonly requestStart: number;\n    readonly responseEnd: number;\n    readonly responseStart: number;\n    readonly unloadEventEnd: number;\n    readonly unloadEventStart: number;\n    readonly secureConnectionStart: number;\n    toJSON(): any;\n}\n\ndeclare var PerformanceTiming: {\n    prototype: PerformanceTiming;\n    new(): PerformanceTiming;\n}\n\ninterface PeriodicWave {\n}\n\ndeclare var PeriodicWave: {\n    prototype: PeriodicWave;\n    new(): PeriodicWave;\n}\n\ninterface PermissionRequest extends DeferredPermissionRequest {\n    readonly state: string;\n    defer(): void;\n}\n\ndeclare var PermissionRequest: {\n    prototype: PermissionRequest;\n    new(): PermissionRequest;\n}\n\ninterface PermissionRequestedEvent extends Event {\n    readonly permissionRequest: PermissionRequest;\n}\n\ndeclare var PermissionRequestedEvent: {\n    prototype: PermissionRequestedEvent;\n    new(): PermissionRequestedEvent;\n}\n\ninterface Plugin {\n    readonly description: string;\n    readonly filename: string;\n    readonly length: number;\n    readonly name: string;\n    readonly version: string;\n    item(index: number): MimeType;\n    namedItem(type: string): MimeType;\n    [index: number]: MimeType;\n}\n\ndeclare var Plugin: {\n    prototype: Plugin;\n    new(): Plugin;\n}\n\ninterface PluginArray {\n    readonly length: number;\n    item(index: number): Plugin;\n    namedItem(name: string): Plugin;\n    refresh(reload?: boolean): void;\n    [index: number]: Plugin;\n}\n\ndeclare var PluginArray: {\n    prototype: PluginArray;\n    new(): PluginArray;\n}\n\ninterface PointerEvent extends MouseEvent {\n    readonly currentPoint: any;\n    readonly height: number;\n    readonly hwTimestamp: number;\n    readonly intermediatePoints: any;\n    readonly isPrimary: boolean;\n    readonly pointerId: number;\n    readonly pointerType: any;\n    readonly pressure: number;\n    readonly rotation: number;\n    readonly tiltX: number;\n    readonly tiltY: number;\n    readonly width: number;\n    getCurrentPoint(element: Element): void;\n    getIntermediatePoints(element: Element): void;\n    initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void;\n}\n\ndeclare var PointerEvent: {\n    prototype: PointerEvent;\n    new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent;\n}\n\ninterface PopStateEvent extends Event {\n    readonly state: any;\n    initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void;\n}\n\ndeclare var PopStateEvent: {\n    prototype: PopStateEvent;\n    new(): PopStateEvent;\n}\n\ninterface Position {\n    readonly coords: Coordinates;\n    readonly timestamp: number;\n}\n\ndeclare var Position: {\n    prototype: Position;\n    new(): Position;\n}\n\ninterface PositionError {\n    readonly code: number;\n    readonly message: string;\n    toString(): string;\n    readonly PERMISSION_DENIED: number;\n    readonly POSITION_UNAVAILABLE: number;\n    readonly TIMEOUT: number;\n}\n\ndeclare var PositionError: {\n    prototype: PositionError;\n    new(): PositionError;\n    readonly PERMISSION_DENIED: number;\n    readonly POSITION_UNAVAILABLE: number;\n    readonly TIMEOUT: number;\n}\n\ninterface ProcessingInstruction extends CharacterData {\n    readonly target: string;\n}\n\ndeclare var ProcessingInstruction: {\n    prototype: ProcessingInstruction;\n    new(): ProcessingInstruction;\n}\n\ninterface ProgressEvent extends Event {\n    readonly lengthComputable: boolean;\n    readonly loaded: number;\n    readonly total: number;\n    initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void;\n}\n\ndeclare var ProgressEvent: {\n    prototype: ProgressEvent;\n    new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent;\n}\n\ninterface RTCDTMFToneChangeEvent extends Event {\n    readonly tone: string;\n}\n\ndeclare var RTCDTMFToneChangeEvent: {\n    prototype: RTCDTMFToneChangeEvent;\n    new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent;\n}\n\ninterface RTCDtlsTransportEventMap {\n    \"dtlsstatechange\": RTCDtlsTransportStateChangedEvent;\n    \"error\": ErrorEvent;\n}\n\ninterface RTCDtlsTransport extends RTCStatsProvider {\n    ondtlsstatechange: ((this: RTCDtlsTransport, ev: RTCDtlsTransportStateChangedEvent) => any) | null;\n    onerror: ((this: RTCDtlsTransport, ev: ErrorEvent) => any) | null;\n    readonly state: string;\n    readonly transport: RTCIceTransport;\n    getLocalParameters(): RTCDtlsParameters;\n    getRemoteCertificates(): ArrayBuffer[];\n    getRemoteParameters(): RTCDtlsParameters | null;\n    start(remoteParameters: RTCDtlsParameters): void;\n    stop(): void;\n    addEventListener<K extends keyof RTCDtlsTransportEventMap>(type: K, listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCDtlsTransport: {\n    prototype: RTCDtlsTransport;\n    new(transport: RTCIceTransport): RTCDtlsTransport;\n}\n\ninterface RTCDtlsTransportStateChangedEvent extends Event {\n    readonly state: string;\n}\n\ndeclare var RTCDtlsTransportStateChangedEvent: {\n    prototype: RTCDtlsTransportStateChangedEvent;\n    new(): RTCDtlsTransportStateChangedEvent;\n}\n\ninterface RTCDtmfSenderEventMap {\n    \"tonechange\": RTCDTMFToneChangeEvent;\n}\n\ninterface RTCDtmfSender extends EventTarget {\n    readonly canInsertDTMF: boolean;\n    readonly duration: number;\n    readonly interToneGap: number;\n    ontonechange: (this: RTCDtmfSender, ev: RTCDTMFToneChangeEvent) => any;\n    readonly sender: RTCRtpSender;\n    readonly toneBuffer: string;\n    insertDTMF(tones: string, duration?: number, interToneGap?: number): void;\n    addEventListener<K extends keyof RTCDtmfSenderEventMap>(type: K, listener: (this: RTCDtmfSender, ev: RTCDtmfSenderEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCDtmfSender: {\n    prototype: RTCDtmfSender;\n    new(sender: RTCRtpSender): RTCDtmfSender;\n}\n\ninterface RTCIceCandidatePairChangedEvent extends Event {\n    readonly pair: RTCIceCandidatePair;\n}\n\ndeclare var RTCIceCandidatePairChangedEvent: {\n    prototype: RTCIceCandidatePairChangedEvent;\n    new(): RTCIceCandidatePairChangedEvent;\n}\n\ninterface RTCIceGathererEventMap {\n    \"error\": ErrorEvent;\n    \"localcandidate\": RTCIceGathererEvent;\n}\n\ninterface RTCIceGatherer extends RTCStatsProvider {\n    readonly component: string;\n    onerror: ((this: RTCIceGatherer, ev: ErrorEvent) => any) | null;\n    onlocalcandidate: ((this: RTCIceGatherer, ev: RTCIceGathererEvent) => any) | null;\n    createAssociatedGatherer(): RTCIceGatherer;\n    getLocalCandidates(): RTCIceCandidate[];\n    getLocalParameters(): RTCIceParameters;\n    addEventListener<K extends keyof RTCIceGathererEventMap>(type: K, listener: (this: RTCIceGatherer, ev: RTCIceGathererEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCIceGatherer: {\n    prototype: RTCIceGatherer;\n    new(options: RTCIceGatherOptions): RTCIceGatherer;\n}\n\ninterface RTCIceGathererEvent extends Event {\n    readonly candidate: RTCIceCandidate | RTCIceCandidateComplete;\n}\n\ndeclare var RTCIceGathererEvent: {\n    prototype: RTCIceGathererEvent;\n    new(): RTCIceGathererEvent;\n}\n\ninterface RTCIceTransportEventMap {\n    \"candidatepairchange\": RTCIceCandidatePairChangedEvent;\n    \"icestatechange\": RTCIceTransportStateChangedEvent;\n}\n\ninterface RTCIceTransport extends RTCStatsProvider {\n    readonly component: string;\n    readonly iceGatherer: RTCIceGatherer | null;\n    oncandidatepairchange: ((this: RTCIceTransport, ev: RTCIceCandidatePairChangedEvent) => any) | null;\n    onicestatechange: ((this: RTCIceTransport, ev: RTCIceTransportStateChangedEvent) => any) | null;\n    readonly role: string;\n    readonly state: string;\n    addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void;\n    createAssociatedTransport(): RTCIceTransport;\n    getNominatedCandidatePair(): RTCIceCandidatePair | null;\n    getRemoteCandidates(): RTCIceCandidate[];\n    getRemoteParameters(): RTCIceParameters | null;\n    setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void;\n    start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void;\n    stop(): void;\n    addEventListener<K extends keyof RTCIceTransportEventMap>(type: K, listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCIceTransport: {\n    prototype: RTCIceTransport;\n    new(): RTCIceTransport;\n}\n\ninterface RTCIceTransportStateChangedEvent extends Event {\n    readonly state: string;\n}\n\ndeclare var RTCIceTransportStateChangedEvent: {\n    prototype: RTCIceTransportStateChangedEvent;\n    new(): RTCIceTransportStateChangedEvent;\n}\n\ninterface RTCRtpReceiverEventMap {\n    \"error\": ErrorEvent;\n}\n\ninterface RTCRtpReceiver extends RTCStatsProvider {\n    onerror: ((this: RTCRtpReceiver, ev: ErrorEvent) => any) | null;\n    readonly rtcpTransport: RTCDtlsTransport;\n    readonly track: MediaStreamTrack | null;\n    readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;\n    getContributingSources(): RTCRtpContributingSource[];\n    receive(parameters: RTCRtpParameters): void;\n    requestSendCSRC(csrc: number): void;\n    setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;\n    stop(): void;\n    addEventListener<K extends keyof RTCRtpReceiverEventMap>(type: K, listener: (this: RTCRtpReceiver, ev: RTCRtpReceiverEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCRtpReceiver: {\n    prototype: RTCRtpReceiver;\n    new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver;\n    getCapabilities(kind?: string): RTCRtpCapabilities;\n}\n\ninterface RTCRtpSenderEventMap {\n    \"error\": ErrorEvent;\n    \"ssrcconflict\": RTCSsrcConflictEvent;\n}\n\ninterface RTCRtpSender extends RTCStatsProvider {\n    onerror: ((this: RTCRtpSender, ev: ErrorEvent) => any) | null;\n    onssrcconflict: ((this: RTCRtpSender, ev: RTCSsrcConflictEvent) => any) | null;\n    readonly rtcpTransport: RTCDtlsTransport;\n    readonly track: MediaStreamTrack;\n    readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;\n    send(parameters: RTCRtpParameters): void;\n    setTrack(track: MediaStreamTrack): void;\n    setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;\n    stop(): void;\n    addEventListener<K extends keyof RTCRtpSenderEventMap>(type: K, listener: (this: RTCRtpSender, ev: RTCRtpSenderEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCRtpSender: {\n    prototype: RTCRtpSender;\n    new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender;\n    getCapabilities(kind?: string): RTCRtpCapabilities;\n}\n\ninterface RTCSrtpSdesTransportEventMap {\n    \"error\": ErrorEvent;\n}\n\ninterface RTCSrtpSdesTransport extends EventTarget {\n    onerror: ((this: RTCSrtpSdesTransport, ev: ErrorEvent) => any) | null;\n    readonly transport: RTCIceTransport;\n    addEventListener<K extends keyof RTCSrtpSdesTransportEventMap>(type: K, listener: (this: RTCSrtpSdesTransport, ev: RTCSrtpSdesTransportEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCSrtpSdesTransport: {\n    prototype: RTCSrtpSdesTransport;\n    new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport;\n    getLocalParameters(): RTCSrtpSdesParameters[];\n}\n\ninterface RTCSsrcConflictEvent extends Event {\n    readonly ssrc: number;\n}\n\ndeclare var RTCSsrcConflictEvent: {\n    prototype: RTCSsrcConflictEvent;\n    new(): RTCSsrcConflictEvent;\n}\n\ninterface RTCStatsProvider extends EventTarget {\n    getStats(): PromiseLike<RTCStatsReport>;\n    msGetStats(): PromiseLike<RTCStatsReport>;\n}\n\ndeclare var RTCStatsProvider: {\n    prototype: RTCStatsProvider;\n    new(): RTCStatsProvider;\n}\n\ninterface Range {\n    readonly collapsed: boolean;\n    readonly commonAncestorContainer: Node;\n    readonly endContainer: Node;\n    readonly endOffset: number;\n    readonly startContainer: Node;\n    readonly startOffset: number;\n    cloneContents(): DocumentFragment;\n    cloneRange(): Range;\n    collapse(toStart: boolean): void;\n    compareBoundaryPoints(how: number, sourceRange: Range): number;\n    createContextualFragment(fragment: string): DocumentFragment;\n    deleteContents(): void;\n    detach(): void;\n    expand(Unit: string): boolean;\n    extractContents(): DocumentFragment;\n    getBoundingClientRect(): ClientRect;\n    getClientRects(): ClientRectList;\n    insertNode(newNode: Node): void;\n    selectNode(refNode: Node): void;\n    selectNodeContents(refNode: Node): void;\n    setEnd(refNode: Node, offset: number): void;\n    setEndAfter(refNode: Node): void;\n    setEndBefore(refNode: Node): void;\n    setStart(refNode: Node, offset: number): void;\n    setStartAfter(refNode: Node): void;\n    setStartBefore(refNode: Node): void;\n    surroundContents(newParent: Node): void;\n    toString(): string;\n    readonly END_TO_END: number;\n    readonly END_TO_START: number;\n    readonly START_TO_END: number;\n    readonly START_TO_START: number;\n}\n\ndeclare var Range: {\n    prototype: Range;\n    new(): Range;\n    readonly END_TO_END: number;\n    readonly END_TO_START: number;\n    readonly START_TO_END: number;\n    readonly START_TO_START: number;\n}\n\ninterface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\n    readonly target: SVGAnimatedString;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGAElement: {\n    prototype: SVGAElement;\n    new(): SVGAElement;\n}\n\ninterface SVGAngle {\n    readonly unitType: number;\n    value: number;\n    valueAsString: string;\n    valueInSpecifiedUnits: number;\n    convertToSpecifiedUnits(unitType: number): void;\n    newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void;\n    readonly SVG_ANGLETYPE_DEG: number;\n    readonly SVG_ANGLETYPE_GRAD: number;\n    readonly SVG_ANGLETYPE_RAD: number;\n    readonly SVG_ANGLETYPE_UNKNOWN: number;\n    readonly SVG_ANGLETYPE_UNSPECIFIED: number;\n}\n\ndeclare var SVGAngle: {\n    prototype: SVGAngle;\n    new(): SVGAngle;\n    readonly SVG_ANGLETYPE_DEG: number;\n    readonly SVG_ANGLETYPE_GRAD: number;\n    readonly SVG_ANGLETYPE_RAD: number;\n    readonly SVG_ANGLETYPE_UNKNOWN: number;\n    readonly SVG_ANGLETYPE_UNSPECIFIED: number;\n}\n\ninterface SVGAnimatedAngle {\n    readonly animVal: SVGAngle;\n    readonly baseVal: SVGAngle;\n}\n\ndeclare var SVGAnimatedAngle: {\n    prototype: SVGAnimatedAngle;\n    new(): SVGAnimatedAngle;\n}\n\ninterface SVGAnimatedBoolean {\n    readonly animVal: boolean;\n    baseVal: boolean;\n}\n\ndeclare var SVGAnimatedBoolean: {\n    prototype: SVGAnimatedBoolean;\n    new(): SVGAnimatedBoolean;\n}\n\ninterface SVGAnimatedEnumeration {\n    readonly animVal: number;\n    baseVal: number;\n}\n\ndeclare var SVGAnimatedEnumeration: {\n    prototype: SVGAnimatedEnumeration;\n    new(): SVGAnimatedEnumeration;\n}\n\ninterface SVGAnimatedInteger {\n    readonly animVal: number;\n    baseVal: number;\n}\n\ndeclare var SVGAnimatedInteger: {\n    prototype: SVGAnimatedInteger;\n    new(): SVGAnimatedInteger;\n}\n\ninterface SVGAnimatedLength {\n    readonly animVal: SVGLength;\n    readonly baseVal: SVGLength;\n}\n\ndeclare var SVGAnimatedLength: {\n    prototype: SVGAnimatedLength;\n    new(): SVGAnimatedLength;\n}\n\ninterface SVGAnimatedLengthList {\n    readonly animVal: SVGLengthList;\n    readonly baseVal: SVGLengthList;\n}\n\ndeclare var SVGAnimatedLengthList: {\n    prototype: SVGAnimatedLengthList;\n    new(): SVGAnimatedLengthList;\n}\n\ninterface SVGAnimatedNumber {\n    readonly animVal: number;\n    baseVal: number;\n}\n\ndeclare var SVGAnimatedNumber: {\n    prototype: SVGAnimatedNumber;\n    new(): SVGAnimatedNumber;\n}\n\ninterface SVGAnimatedNumberList {\n    readonly animVal: SVGNumberList;\n    readonly baseVal: SVGNumberList;\n}\n\ndeclare var SVGAnimatedNumberList: {\n    prototype: SVGAnimatedNumberList;\n    new(): SVGAnimatedNumberList;\n}\n\ninterface SVGAnimatedPreserveAspectRatio {\n    readonly animVal: SVGPreserveAspectRatio;\n    readonly baseVal: SVGPreserveAspectRatio;\n}\n\ndeclare var SVGAnimatedPreserveAspectRatio: {\n    prototype: SVGAnimatedPreserveAspectRatio;\n    new(): SVGAnimatedPreserveAspectRatio;\n}\n\ninterface SVGAnimatedRect {\n    readonly animVal: SVGRect;\n    readonly baseVal: SVGRect;\n}\n\ndeclare var SVGAnimatedRect: {\n    prototype: SVGAnimatedRect;\n    new(): SVGAnimatedRect;\n}\n\ninterface SVGAnimatedString {\n    readonly animVal: string;\n    baseVal: string;\n}\n\ndeclare var SVGAnimatedString: {\n    prototype: SVGAnimatedString;\n    new(): SVGAnimatedString;\n}\n\ninterface SVGAnimatedTransformList {\n    readonly animVal: SVGTransformList;\n    readonly baseVal: SVGTransformList;\n}\n\ndeclare var SVGAnimatedTransformList: {\n    prototype: SVGAnimatedTransformList;\n    new(): SVGAnimatedTransformList;\n}\n\ninterface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    readonly cx: SVGAnimatedLength;\n    readonly cy: SVGAnimatedLength;\n    readonly r: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGCircleElement: {\n    prototype: SVGCircleElement;\n    new(): SVGCircleElement;\n}\n\ninterface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes {\n    readonly clipPathUnits: SVGAnimatedEnumeration;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGClipPathElement: {\n    prototype: SVGClipPathElement;\n    new(): SVGClipPathElement;\n}\n\ninterface SVGComponentTransferFunctionElement extends SVGElement {\n    readonly amplitude: SVGAnimatedNumber;\n    readonly exponent: SVGAnimatedNumber;\n    readonly intercept: SVGAnimatedNumber;\n    readonly offset: SVGAnimatedNumber;\n    readonly slope: SVGAnimatedNumber;\n    readonly tableValues: SVGAnimatedNumberList;\n    readonly type: SVGAnimatedEnumeration;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGComponentTransferFunctionElement: {\n    prototype: SVGComponentTransferFunctionElement;\n    new(): SVGComponentTransferFunctionElement;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number;\n}\n\ninterface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGDefsElement: {\n    prototype: SVGDefsElement;\n    new(): SVGDefsElement;\n}\n\ninterface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGDescElement: {\n    prototype: SVGDescElement;\n    new(): SVGDescElement;\n}\n\ninterface SVGElementEventMap extends ElementEventMap {\n    \"click\": MouseEvent;\n    \"dblclick\": MouseEvent;\n    \"focusin\": FocusEvent;\n    \"focusout\": FocusEvent;\n    \"load\": Event;\n    \"mousedown\": MouseEvent;\n    \"mousemove\": MouseEvent;\n    \"mouseout\": MouseEvent;\n    \"mouseover\": MouseEvent;\n    \"mouseup\": MouseEvent;\n}\n\ninterface SVGElement extends Element {\n    onclick: (this: SVGElement, ev: MouseEvent) => any;\n    ondblclick: (this: SVGElement, ev: MouseEvent) => any;\n    onfocusin: (this: SVGElement, ev: FocusEvent) => any;\n    onfocusout: (this: SVGElement, ev: FocusEvent) => any;\n    onload: (this: SVGElement, ev: Event) => any;\n    onmousedown: (this: SVGElement, ev: MouseEvent) => any;\n    onmousemove: (this: SVGElement, ev: MouseEvent) => any;\n    onmouseout: (this: SVGElement, ev: MouseEvent) => any;\n    onmouseover: (this: SVGElement, ev: MouseEvent) => any;\n    onmouseup: (this: SVGElement, ev: MouseEvent) => any;\n    readonly ownerSVGElement: SVGSVGElement;\n    readonly viewportElement: SVGElement;\n    xmlbase: string;\n    className: any;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGElement: {\n    prototype: SVGElement;\n    new(): SVGElement;\n}\n\ninterface SVGElementInstance extends EventTarget {\n    readonly childNodes: SVGElementInstanceList;\n    readonly correspondingElement: SVGElement;\n    readonly correspondingUseElement: SVGUseElement;\n    readonly firstChild: SVGElementInstance;\n    readonly lastChild: SVGElementInstance;\n    readonly nextSibling: SVGElementInstance;\n    readonly parentNode: SVGElementInstance;\n    readonly previousSibling: SVGElementInstance;\n}\n\ndeclare var SVGElementInstance: {\n    prototype: SVGElementInstance;\n    new(): SVGElementInstance;\n}\n\ninterface SVGElementInstanceList {\n    readonly length: number;\n    item(index: number): SVGElementInstance;\n}\n\ndeclare var SVGElementInstanceList: {\n    prototype: SVGElementInstanceList;\n    new(): SVGElementInstanceList;\n}\n\ninterface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    readonly cx: SVGAnimatedLength;\n    readonly cy: SVGAnimatedLength;\n    readonly rx: SVGAnimatedLength;\n    readonly ry: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGEllipseElement: {\n    prototype: SVGEllipseElement;\n    new(): SVGEllipseElement;\n}\n\ninterface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    readonly in2: SVGAnimatedString;\n    readonly mode: SVGAnimatedEnumeration;\n    readonly SVG_FEBLEND_MODE_COLOR: number;\n    readonly SVG_FEBLEND_MODE_COLOR_BURN: number;\n    readonly SVG_FEBLEND_MODE_COLOR_DODGE: number;\n    readonly SVG_FEBLEND_MODE_DARKEN: number;\n    readonly SVG_FEBLEND_MODE_DIFFERENCE: number;\n    readonly SVG_FEBLEND_MODE_EXCLUSION: number;\n    readonly SVG_FEBLEND_MODE_HARD_LIGHT: number;\n    readonly SVG_FEBLEND_MODE_HUE: number;\n    readonly SVG_FEBLEND_MODE_LIGHTEN: number;\n    readonly SVG_FEBLEND_MODE_LUMINOSITY: number;\n    readonly SVG_FEBLEND_MODE_MULTIPLY: number;\n    readonly SVG_FEBLEND_MODE_NORMAL: number;\n    readonly SVG_FEBLEND_MODE_OVERLAY: number;\n    readonly SVG_FEBLEND_MODE_SATURATION: number;\n    readonly SVG_FEBLEND_MODE_SCREEN: number;\n    readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number;\n    readonly SVG_FEBLEND_MODE_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEBlendElement: {\n    prototype: SVGFEBlendElement;\n    new(): SVGFEBlendElement;\n    readonly SVG_FEBLEND_MODE_COLOR: number;\n    readonly SVG_FEBLEND_MODE_COLOR_BURN: number;\n    readonly SVG_FEBLEND_MODE_COLOR_DODGE: number;\n    readonly SVG_FEBLEND_MODE_DARKEN: number;\n    readonly SVG_FEBLEND_MODE_DIFFERENCE: number;\n    readonly SVG_FEBLEND_MODE_EXCLUSION: number;\n    readonly SVG_FEBLEND_MODE_HARD_LIGHT: number;\n    readonly SVG_FEBLEND_MODE_HUE: number;\n    readonly SVG_FEBLEND_MODE_LIGHTEN: number;\n    readonly SVG_FEBLEND_MODE_LUMINOSITY: number;\n    readonly SVG_FEBLEND_MODE_MULTIPLY: number;\n    readonly SVG_FEBLEND_MODE_NORMAL: number;\n    readonly SVG_FEBLEND_MODE_OVERLAY: number;\n    readonly SVG_FEBLEND_MODE_SATURATION: number;\n    readonly SVG_FEBLEND_MODE_SCREEN: number;\n    readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number;\n    readonly SVG_FEBLEND_MODE_UNKNOWN: number;\n}\n\ninterface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    readonly type: SVGAnimatedEnumeration;\n    readonly values: SVGAnimatedNumberList;\n    readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number;\n    readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number;\n    readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number;\n    readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number;\n    readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEColorMatrixElement: {\n    prototype: SVGFEColorMatrixElement;\n    new(): SVGFEColorMatrixElement;\n    readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number;\n    readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number;\n    readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number;\n    readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number;\n    readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number;\n}\n\ninterface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEComponentTransferElement: {\n    prototype: SVGFEComponentTransferElement;\n    new(): SVGFEComponentTransferElement;\n}\n\ninterface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    readonly in2: SVGAnimatedString;\n    readonly k1: SVGAnimatedNumber;\n    readonly k2: SVGAnimatedNumber;\n    readonly k3: SVGAnimatedNumber;\n    readonly k4: SVGAnimatedNumber;\n    readonly operator: SVGAnimatedEnumeration;\n    readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_IN: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_OUT: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_OVER: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_XOR: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFECompositeElement: {\n    prototype: SVGFECompositeElement;\n    new(): SVGFECompositeElement;\n    readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_IN: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_OUT: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_OVER: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_XOR: number;\n}\n\ninterface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly bias: SVGAnimatedNumber;\n    readonly divisor: SVGAnimatedNumber;\n    readonly edgeMode: SVGAnimatedEnumeration;\n    readonly in1: SVGAnimatedString;\n    readonly kernelMatrix: SVGAnimatedNumberList;\n    readonly kernelUnitLengthX: SVGAnimatedNumber;\n    readonly kernelUnitLengthY: SVGAnimatedNumber;\n    readonly orderX: SVGAnimatedInteger;\n    readonly orderY: SVGAnimatedInteger;\n    readonly preserveAlpha: SVGAnimatedBoolean;\n    readonly targetX: SVGAnimatedInteger;\n    readonly targetY: SVGAnimatedInteger;\n    readonly SVG_EDGEMODE_DUPLICATE: number;\n    readonly SVG_EDGEMODE_NONE: number;\n    readonly SVG_EDGEMODE_UNKNOWN: number;\n    readonly SVG_EDGEMODE_WRAP: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEConvolveMatrixElement: {\n    prototype: SVGFEConvolveMatrixElement;\n    new(): SVGFEConvolveMatrixElement;\n    readonly SVG_EDGEMODE_DUPLICATE: number;\n    readonly SVG_EDGEMODE_NONE: number;\n    readonly SVG_EDGEMODE_UNKNOWN: number;\n    readonly SVG_EDGEMODE_WRAP: number;\n}\n\ninterface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly diffuseConstant: SVGAnimatedNumber;\n    readonly in1: SVGAnimatedString;\n    readonly kernelUnitLengthX: SVGAnimatedNumber;\n    readonly kernelUnitLengthY: SVGAnimatedNumber;\n    readonly surfaceScale: SVGAnimatedNumber;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEDiffuseLightingElement: {\n    prototype: SVGFEDiffuseLightingElement;\n    new(): SVGFEDiffuseLightingElement;\n}\n\ninterface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    readonly in2: SVGAnimatedString;\n    readonly scale: SVGAnimatedNumber;\n    readonly xChannelSelector: SVGAnimatedEnumeration;\n    readonly yChannelSelector: SVGAnimatedEnumeration;\n    readonly SVG_CHANNEL_A: number;\n    readonly SVG_CHANNEL_B: number;\n    readonly SVG_CHANNEL_G: number;\n    readonly SVG_CHANNEL_R: number;\n    readonly SVG_CHANNEL_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEDisplacementMapElement: {\n    prototype: SVGFEDisplacementMapElement;\n    new(): SVGFEDisplacementMapElement;\n    readonly SVG_CHANNEL_A: number;\n    readonly SVG_CHANNEL_B: number;\n    readonly SVG_CHANNEL_G: number;\n    readonly SVG_CHANNEL_R: number;\n    readonly SVG_CHANNEL_UNKNOWN: number;\n}\n\ninterface SVGFEDistantLightElement extends SVGElement {\n    readonly azimuth: SVGAnimatedNumber;\n    readonly elevation: SVGAnimatedNumber;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEDistantLightElement: {\n    prototype: SVGFEDistantLightElement;\n    new(): SVGFEDistantLightElement;\n}\n\ninterface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEFloodElement: {\n    prototype: SVGFEFloodElement;\n    new(): SVGFEFloodElement;\n}\n\ninterface SVGFEFuncAElement extends SVGComponentTransferFunctionElement {\n}\n\ndeclare var SVGFEFuncAElement: {\n    prototype: SVGFEFuncAElement;\n    new(): SVGFEFuncAElement;\n}\n\ninterface SVGFEFuncBElement extends SVGComponentTransferFunctionElement {\n}\n\ndeclare var SVGFEFuncBElement: {\n    prototype: SVGFEFuncBElement;\n    new(): SVGFEFuncBElement;\n}\n\ninterface SVGFEFuncGElement extends SVGComponentTransferFunctionElement {\n}\n\ndeclare var SVGFEFuncGElement: {\n    prototype: SVGFEFuncGElement;\n    new(): SVGFEFuncGElement;\n}\n\ninterface SVGFEFuncRElement extends SVGComponentTransferFunctionElement {\n}\n\ndeclare var SVGFEFuncRElement: {\n    prototype: SVGFEFuncRElement;\n    new(): SVGFEFuncRElement;\n}\n\ninterface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    readonly stdDeviationX: SVGAnimatedNumber;\n    readonly stdDeviationY: SVGAnimatedNumber;\n    setStdDeviation(stdDeviationX: number, stdDeviationY: number): void;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEGaussianBlurElement: {\n    prototype: SVGFEGaussianBlurElement;\n    new(): SVGFEGaussianBlurElement;\n}\n\ninterface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired {\n    readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEImageElement: {\n    prototype: SVGFEImageElement;\n    new(): SVGFEImageElement;\n}\n\ninterface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEMergeElement: {\n    prototype: SVGFEMergeElement;\n    new(): SVGFEMergeElement;\n}\n\ninterface SVGFEMergeNodeElement extends SVGElement {\n    readonly in1: SVGAnimatedString;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEMergeNodeElement: {\n    prototype: SVGFEMergeNodeElement;\n    new(): SVGFEMergeNodeElement;\n}\n\ninterface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    readonly operator: SVGAnimatedEnumeration;\n    readonly radiusX: SVGAnimatedNumber;\n    readonly radiusY: SVGAnimatedNumber;\n    readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number;\n    readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number;\n    readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEMorphologyElement: {\n    prototype: SVGFEMorphologyElement;\n    new(): SVGFEMorphologyElement;\n    readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number;\n    readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number;\n    readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number;\n}\n\ninterface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly dx: SVGAnimatedNumber;\n    readonly dy: SVGAnimatedNumber;\n    readonly in1: SVGAnimatedString;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEOffsetElement: {\n    prototype: SVGFEOffsetElement;\n    new(): SVGFEOffsetElement;\n}\n\ninterface SVGFEPointLightElement extends SVGElement {\n    readonly x: SVGAnimatedNumber;\n    readonly y: SVGAnimatedNumber;\n    readonly z: SVGAnimatedNumber;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEPointLightElement: {\n    prototype: SVGFEPointLightElement;\n    new(): SVGFEPointLightElement;\n}\n\ninterface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    readonly kernelUnitLengthX: SVGAnimatedNumber;\n    readonly kernelUnitLengthY: SVGAnimatedNumber;\n    readonly specularConstant: SVGAnimatedNumber;\n    readonly specularExponent: SVGAnimatedNumber;\n    readonly surfaceScale: SVGAnimatedNumber;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFESpecularLightingElement: {\n    prototype: SVGFESpecularLightingElement;\n    new(): SVGFESpecularLightingElement;\n}\n\ninterface SVGFESpotLightElement extends SVGElement {\n    readonly limitingConeAngle: SVGAnimatedNumber;\n    readonly pointsAtX: SVGAnimatedNumber;\n    readonly pointsAtY: SVGAnimatedNumber;\n    readonly pointsAtZ: SVGAnimatedNumber;\n    readonly specularExponent: SVGAnimatedNumber;\n    readonly x: SVGAnimatedNumber;\n    readonly y: SVGAnimatedNumber;\n    readonly z: SVGAnimatedNumber;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFESpotLightElement: {\n    prototype: SVGFESpotLightElement;\n    new(): SVGFESpotLightElement;\n}\n\ninterface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFETileElement: {\n    prototype: SVGFETileElement;\n    new(): SVGFETileElement;\n}\n\ninterface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly baseFrequencyX: SVGAnimatedNumber;\n    readonly baseFrequencyY: SVGAnimatedNumber;\n    readonly numOctaves: SVGAnimatedInteger;\n    readonly seed: SVGAnimatedNumber;\n    readonly stitchTiles: SVGAnimatedEnumeration;\n    readonly type: SVGAnimatedEnumeration;\n    readonly SVG_STITCHTYPE_NOSTITCH: number;\n    readonly SVG_STITCHTYPE_STITCH: number;\n    readonly SVG_STITCHTYPE_UNKNOWN: number;\n    readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number;\n    readonly SVG_TURBULENCE_TYPE_TURBULENCE: number;\n    readonly SVG_TURBULENCE_TYPE_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFETurbulenceElement: {\n    prototype: SVGFETurbulenceElement;\n    new(): SVGFETurbulenceElement;\n    readonly SVG_STITCHTYPE_NOSTITCH: number;\n    readonly SVG_STITCHTYPE_STITCH: number;\n    readonly SVG_STITCHTYPE_UNKNOWN: number;\n    readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number;\n    readonly SVG_TURBULENCE_TYPE_TURBULENCE: number;\n    readonly SVG_TURBULENCE_TYPE_UNKNOWN: number;\n}\n\ninterface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired {\n    readonly filterResX: SVGAnimatedInteger;\n    readonly filterResY: SVGAnimatedInteger;\n    readonly filterUnits: SVGAnimatedEnumeration;\n    readonly height: SVGAnimatedLength;\n    readonly primitiveUnits: SVGAnimatedEnumeration;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n    setFilterRes(filterResX: number, filterResY: number): void;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFilterElement: {\n    prototype: SVGFilterElement;\n    new(): SVGFilterElement;\n}\n\ninterface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    readonly height: SVGAnimatedLength;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGForeignObjectElement: {\n    prototype: SVGForeignObjectElement;\n    new(): SVGForeignObjectElement;\n}\n\ninterface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGGElement: {\n    prototype: SVGGElement;\n    new(): SVGGElement;\n}\n\ninterface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes {\n    readonly gradientTransform: SVGAnimatedTransformList;\n    readonly gradientUnits: SVGAnimatedEnumeration;\n    readonly spreadMethod: SVGAnimatedEnumeration;\n    readonly SVG_SPREADMETHOD_PAD: number;\n    readonly SVG_SPREADMETHOD_REFLECT: number;\n    readonly SVG_SPREADMETHOD_REPEAT: number;\n    readonly SVG_SPREADMETHOD_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGGradientElement: {\n    prototype: SVGGradientElement;\n    new(): SVGGradientElement;\n    readonly SVG_SPREADMETHOD_PAD: number;\n    readonly SVG_SPREADMETHOD_REFLECT: number;\n    readonly SVG_SPREADMETHOD_REPEAT: number;\n    readonly SVG_SPREADMETHOD_UNKNOWN: number;\n}\n\ninterface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\n    readonly height: SVGAnimatedLength;\n    readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGImageElement: {\n    prototype: SVGImageElement;\n    new(): SVGImageElement;\n}\n\ninterface SVGLength {\n    readonly unitType: number;\n    value: number;\n    valueAsString: string;\n    valueInSpecifiedUnits: number;\n    convertToSpecifiedUnits(unitType: number): void;\n    newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void;\n    readonly SVG_LENGTHTYPE_CM: number;\n    readonly SVG_LENGTHTYPE_EMS: number;\n    readonly SVG_LENGTHTYPE_EXS: number;\n    readonly SVG_LENGTHTYPE_IN: number;\n    readonly SVG_LENGTHTYPE_MM: number;\n    readonly SVG_LENGTHTYPE_NUMBER: number;\n    readonly SVG_LENGTHTYPE_PC: number;\n    readonly SVG_LENGTHTYPE_PERCENTAGE: number;\n    readonly SVG_LENGTHTYPE_PT: number;\n    readonly SVG_LENGTHTYPE_PX: number;\n    readonly SVG_LENGTHTYPE_UNKNOWN: number;\n}\n\ndeclare var SVGLength: {\n    prototype: SVGLength;\n    new(): SVGLength;\n    readonly SVG_LENGTHTYPE_CM: number;\n    readonly SVG_LENGTHTYPE_EMS: number;\n    readonly SVG_LENGTHTYPE_EXS: number;\n    readonly SVG_LENGTHTYPE_IN: number;\n    readonly SVG_LENGTHTYPE_MM: number;\n    readonly SVG_LENGTHTYPE_NUMBER: number;\n    readonly SVG_LENGTHTYPE_PC: number;\n    readonly SVG_LENGTHTYPE_PERCENTAGE: number;\n    readonly SVG_LENGTHTYPE_PT: number;\n    readonly SVG_LENGTHTYPE_PX: number;\n    readonly SVG_LENGTHTYPE_UNKNOWN: number;\n}\n\ninterface SVGLengthList {\n    readonly numberOfItems: number;\n    appendItem(newItem: SVGLength): SVGLength;\n    clear(): void;\n    getItem(index: number): SVGLength;\n    initialize(newItem: SVGLength): SVGLength;\n    insertItemBefore(newItem: SVGLength, index: number): SVGLength;\n    removeItem(index: number): SVGLength;\n    replaceItem(newItem: SVGLength, index: number): SVGLength;\n}\n\ndeclare var SVGLengthList: {\n    prototype: SVGLengthList;\n    new(): SVGLengthList;\n}\n\ninterface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    readonly x1: SVGAnimatedLength;\n    readonly x2: SVGAnimatedLength;\n    readonly y1: SVGAnimatedLength;\n    readonly y2: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGLineElement: {\n    prototype: SVGLineElement;\n    new(): SVGLineElement;\n}\n\ninterface SVGLinearGradientElement extends SVGGradientElement {\n    readonly x1: SVGAnimatedLength;\n    readonly x2: SVGAnimatedLength;\n    readonly y1: SVGAnimatedLength;\n    readonly y2: SVGAnimatedLength;\n}\n\ndeclare var SVGLinearGradientElement: {\n    prototype: SVGLinearGradientElement;\n    new(): SVGLinearGradientElement;\n}\n\ninterface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox {\n    readonly markerHeight: SVGAnimatedLength;\n    readonly markerUnits: SVGAnimatedEnumeration;\n    readonly markerWidth: SVGAnimatedLength;\n    readonly orientAngle: SVGAnimatedAngle;\n    readonly orientType: SVGAnimatedEnumeration;\n    readonly refX: SVGAnimatedLength;\n    readonly refY: SVGAnimatedLength;\n    setOrientToAngle(angle: SVGAngle): void;\n    setOrientToAuto(): void;\n    readonly SVG_MARKERUNITS_STROKEWIDTH: number;\n    readonly SVG_MARKERUNITS_UNKNOWN: number;\n    readonly SVG_MARKERUNITS_USERSPACEONUSE: number;\n    readonly SVG_MARKER_ORIENT_ANGLE: number;\n    readonly SVG_MARKER_ORIENT_AUTO: number;\n    readonly SVG_MARKER_ORIENT_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGMarkerElement: {\n    prototype: SVGMarkerElement;\n    new(): SVGMarkerElement;\n    readonly SVG_MARKERUNITS_STROKEWIDTH: number;\n    readonly SVG_MARKERUNITS_UNKNOWN: number;\n    readonly SVG_MARKERUNITS_USERSPACEONUSE: number;\n    readonly SVG_MARKER_ORIENT_ANGLE: number;\n    readonly SVG_MARKER_ORIENT_AUTO: number;\n    readonly SVG_MARKER_ORIENT_UNKNOWN: number;\n}\n\ninterface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes {\n    readonly height: SVGAnimatedLength;\n    readonly maskContentUnits: SVGAnimatedEnumeration;\n    readonly maskUnits: SVGAnimatedEnumeration;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGMaskElement: {\n    prototype: SVGMaskElement;\n    new(): SVGMaskElement;\n}\n\ninterface SVGMatrix {\n    a: number;\n    b: number;\n    c: number;\n    d: number;\n    e: number;\n    f: number;\n    flipX(): SVGMatrix;\n    flipY(): SVGMatrix;\n    inverse(): SVGMatrix;\n    multiply(secondMatrix: SVGMatrix): SVGMatrix;\n    rotate(angle: number): SVGMatrix;\n    rotateFromVector(x: number, y: number): SVGMatrix;\n    scale(scaleFactor: number): SVGMatrix;\n    scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix;\n    skewX(angle: number): SVGMatrix;\n    skewY(angle: number): SVGMatrix;\n    translate(x: number, y: number): SVGMatrix;\n}\n\ndeclare var SVGMatrix: {\n    prototype: SVGMatrix;\n    new(): SVGMatrix;\n}\n\ninterface SVGMetadataElement extends SVGElement {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGMetadataElement: {\n    prototype: SVGMetadataElement;\n    new(): SVGMetadataElement;\n}\n\ninterface SVGNumber {\n    value: number;\n}\n\ndeclare var SVGNumber: {\n    prototype: SVGNumber;\n    new(): SVGNumber;\n}\n\ninterface SVGNumberList {\n    readonly numberOfItems: number;\n    appendItem(newItem: SVGNumber): SVGNumber;\n    clear(): void;\n    getItem(index: number): SVGNumber;\n    initialize(newItem: SVGNumber): SVGNumber;\n    insertItemBefore(newItem: SVGNumber, index: number): SVGNumber;\n    removeItem(index: number): SVGNumber;\n    replaceItem(newItem: SVGNumber, index: number): SVGNumber;\n}\n\ndeclare var SVGNumberList: {\n    prototype: SVGNumberList;\n    new(): SVGNumberList;\n}\n\ninterface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPathData {\n    createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs;\n    createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel;\n    createSVGPathSegClosePath(): SVGPathSegClosePath;\n    createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs;\n    createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel;\n    createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs;\n    createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel;\n    createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs;\n    createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel;\n    createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs;\n    createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel;\n    createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs;\n    createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs;\n    createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel;\n    createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel;\n    createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs;\n    createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel;\n    createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs;\n    createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel;\n    getPathSegAtLength(distance: number): number;\n    getPointAtLength(distance: number): SVGPoint;\n    getTotalLength(): number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGPathElement: {\n    prototype: SVGPathElement;\n    new(): SVGPathElement;\n}\n\ninterface SVGPathSeg {\n    readonly pathSegType: number;\n    readonly pathSegTypeAsLetter: string;\n    readonly PATHSEG_ARC_ABS: number;\n    readonly PATHSEG_ARC_REL: number;\n    readonly PATHSEG_CLOSEPATH: number;\n    readonly PATHSEG_CURVETO_CUBIC_ABS: number;\n    readonly PATHSEG_CURVETO_CUBIC_REL: number;\n    readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number;\n    readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number;\n    readonly PATHSEG_CURVETO_QUADRATIC_ABS: number;\n    readonly PATHSEG_CURVETO_QUADRATIC_REL: number;\n    readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number;\n    readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number;\n    readonly PATHSEG_LINETO_ABS: number;\n    readonly PATHSEG_LINETO_HORIZONTAL_ABS: number;\n    readonly PATHSEG_LINETO_HORIZONTAL_REL: number;\n    readonly PATHSEG_LINETO_REL: number;\n    readonly PATHSEG_LINETO_VERTICAL_ABS: number;\n    readonly PATHSEG_LINETO_VERTICAL_REL: number;\n    readonly PATHSEG_MOVETO_ABS: number;\n    readonly PATHSEG_MOVETO_REL: number;\n    readonly PATHSEG_UNKNOWN: number;\n}\n\ndeclare var SVGPathSeg: {\n    prototype: SVGPathSeg;\n    new(): SVGPathSeg;\n    readonly PATHSEG_ARC_ABS: number;\n    readonly PATHSEG_ARC_REL: number;\n    readonly PATHSEG_CLOSEPATH: number;\n    readonly PATHSEG_CURVETO_CUBIC_ABS: number;\n    readonly PATHSEG_CURVETO_CUBIC_REL: number;\n    readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number;\n    readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number;\n    readonly PATHSEG_CURVETO_QUADRATIC_ABS: number;\n    readonly PATHSEG_CURVETO_QUADRATIC_REL: number;\n    readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number;\n    readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number;\n    readonly PATHSEG_LINETO_ABS: number;\n    readonly PATHSEG_LINETO_HORIZONTAL_ABS: number;\n    readonly PATHSEG_LINETO_HORIZONTAL_REL: number;\n    readonly PATHSEG_LINETO_REL: number;\n    readonly PATHSEG_LINETO_VERTICAL_ABS: number;\n    readonly PATHSEG_LINETO_VERTICAL_REL: number;\n    readonly PATHSEG_MOVETO_ABS: number;\n    readonly PATHSEG_MOVETO_REL: number;\n    readonly PATHSEG_UNKNOWN: number;\n}\n\ninterface SVGPathSegArcAbs extends SVGPathSeg {\n    angle: number;\n    largeArcFlag: boolean;\n    r1: number;\n    r2: number;\n    sweepFlag: boolean;\n    x: number;\n    y: number;\n}\n\ndeclare var SVGPathSegArcAbs: {\n    prototype: SVGPathSegArcAbs;\n    new(): SVGPathSegArcAbs;\n}\n\ninterface SVGPathSegArcRel extends SVGPathSeg {\n    angle: number;\n    largeArcFlag: boolean;\n    r1: number;\n    r2: number;\n    sweepFlag: boolean;\n    x: number;\n    y: number;\n}\n\ndeclare var SVGPathSegArcRel: {\n    prototype: SVGPathSegArcRel;\n    new(): SVGPathSegArcRel;\n}\n\ninterface SVGPathSegClosePath extends SVGPathSeg {\n}\n\ndeclare var SVGPathSegClosePath: {\n    prototype: SVGPathSegClosePath;\n    new(): SVGPathSegClosePath;\n}\n\ninterface SVGPathSegCurvetoCubicAbs extends SVGPathSeg {\n    x: number;\n    x1: number;\n    x2: number;\n    y: number;\n    y1: number;\n    y2: number;\n}\n\ndeclare var SVGPathSegCurvetoCubicAbs: {\n    prototype: SVGPathSegCurvetoCubicAbs;\n    new(): SVGPathSegCurvetoCubicAbs;\n}\n\ninterface SVGPathSegCurvetoCubicRel extends SVGPathSeg {\n    x: number;\n    x1: number;\n    x2: number;\n    y: number;\n    y1: number;\n    y2: number;\n}\n\ndeclare var SVGPathSegCurvetoCubicRel: {\n    prototype: SVGPathSegCurvetoCubicRel;\n    new(): SVGPathSegCurvetoCubicRel;\n}\n\ninterface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg {\n    x: number;\n    x2: number;\n    y: number;\n    y2: number;\n}\n\ndeclare var SVGPathSegCurvetoCubicSmoothAbs: {\n    prototype: SVGPathSegCurvetoCubicSmoothAbs;\n    new(): SVGPathSegCurvetoCubicSmoothAbs;\n}\n\ninterface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg {\n    x: number;\n    x2: number;\n    y: number;\n    y2: number;\n}\n\ndeclare var SVGPathSegCurvetoCubicSmoothRel: {\n    prototype: SVGPathSegCurvetoCubicSmoothRel;\n    new(): SVGPathSegCurvetoCubicSmoothRel;\n}\n\ninterface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg {\n    x: number;\n    x1: number;\n    y: number;\n    y1: number;\n}\n\ndeclare var SVGPathSegCurvetoQuadraticAbs: {\n    prototype: SVGPathSegCurvetoQuadraticAbs;\n    new(): SVGPathSegCurvetoQuadraticAbs;\n}\n\ninterface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg {\n    x: number;\n    x1: number;\n    y: number;\n    y1: number;\n}\n\ndeclare var SVGPathSegCurvetoQuadraticRel: {\n    prototype: SVGPathSegCurvetoQuadraticRel;\n    new(): SVGPathSegCurvetoQuadraticRel;\n}\n\ninterface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg {\n    x: number;\n    y: number;\n}\n\ndeclare var SVGPathSegCurvetoQuadraticSmoothAbs: {\n    prototype: SVGPathSegCurvetoQuadraticSmoothAbs;\n    new(): SVGPathSegCurvetoQuadraticSmoothAbs;\n}\n\ninterface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg {\n    x: number;\n    y: number;\n}\n\ndeclare var SVGPathSegCurvetoQuadraticSmoothRel: {\n    prototype: SVGPathSegCurvetoQuadraticSmoothRel;\n    new(): SVGPathSegCurvetoQuadraticSmoothRel;\n}\n\ninterface SVGPathSegLinetoAbs extends SVGPathSeg {\n    x: number;\n    y: number;\n}\n\ndeclare var SVGPathSegLinetoAbs: {\n    prototype: SVGPathSegLinetoAbs;\n    new(): SVGPathSegLinetoAbs;\n}\n\ninterface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg {\n    x: number;\n}\n\ndeclare var SVGPathSegLinetoHorizontalAbs: {\n    prototype: SVGPathSegLinetoHorizontalAbs;\n    new(): SVGPathSegLinetoHorizontalAbs;\n}\n\ninterface SVGPathSegLinetoHorizontalRel extends SVGPathSeg {\n    x: number;\n}\n\ndeclare var SVGPathSegLinetoHorizontalRel: {\n    prototype: SVGPathSegLinetoHorizontalRel;\n    new(): SVGPathSegLinetoHorizontalRel;\n}\n\ninterface SVGPathSegLinetoRel extends SVGPathSeg {\n    x: number;\n    y: number;\n}\n\ndeclare var SVGPathSegLinetoRel: {\n    prototype: SVGPathSegLinetoRel;\n    new(): SVGPathSegLinetoRel;\n}\n\ninterface SVGPathSegLinetoVerticalAbs extends SVGPathSeg {\n    y: number;\n}\n\ndeclare var SVGPathSegLinetoVerticalAbs: {\n    prototype: SVGPathSegLinetoVerticalAbs;\n    new(): SVGPathSegLinetoVerticalAbs;\n}\n\ninterface SVGPathSegLinetoVerticalRel extends SVGPathSeg {\n    y: number;\n}\n\ndeclare var SVGPathSegLinetoVerticalRel: {\n    prototype: SVGPathSegLinetoVerticalRel;\n    new(): SVGPathSegLinetoVerticalRel;\n}\n\ninterface SVGPathSegList {\n    readonly numberOfItems: number;\n    appendItem(newItem: SVGPathSeg): SVGPathSeg;\n    clear(): void;\n    getItem(index: number): SVGPathSeg;\n    initialize(newItem: SVGPathSeg): SVGPathSeg;\n    insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg;\n    removeItem(index: number): SVGPathSeg;\n    replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg;\n}\n\ndeclare var SVGPathSegList: {\n    prototype: SVGPathSegList;\n    new(): SVGPathSegList;\n}\n\ninterface SVGPathSegMovetoAbs extends SVGPathSeg {\n    x: number;\n    y: number;\n}\n\ndeclare var SVGPathSegMovetoAbs: {\n    prototype: SVGPathSegMovetoAbs;\n    new(): SVGPathSegMovetoAbs;\n}\n\ninterface SVGPathSegMovetoRel extends SVGPathSeg {\n    x: number;\n    y: number;\n}\n\ndeclare var SVGPathSegMovetoRel: {\n    prototype: SVGPathSegMovetoRel;\n    new(): SVGPathSegMovetoRel;\n}\n\ninterface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes {\n    readonly height: SVGAnimatedLength;\n    readonly patternContentUnits: SVGAnimatedEnumeration;\n    readonly patternTransform: SVGAnimatedTransformList;\n    readonly patternUnits: SVGAnimatedEnumeration;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGPatternElement: {\n    prototype: SVGPatternElement;\n    new(): SVGPatternElement;\n}\n\ninterface SVGPoint {\n    x: number;\n    y: number;\n    matrixTransform(matrix: SVGMatrix): SVGPoint;\n}\n\ndeclare var SVGPoint: {\n    prototype: SVGPoint;\n    new(): SVGPoint;\n}\n\ninterface SVGPointList {\n    readonly numberOfItems: number;\n    appendItem(newItem: SVGPoint): SVGPoint;\n    clear(): void;\n    getItem(index: number): SVGPoint;\n    initialize(newItem: SVGPoint): SVGPoint;\n    insertItemBefore(newItem: SVGPoint, index: number): SVGPoint;\n    removeItem(index: number): SVGPoint;\n    replaceItem(newItem: SVGPoint, index: number): SVGPoint;\n}\n\ndeclare var SVGPointList: {\n    prototype: SVGPointList;\n    new(): SVGPointList;\n}\n\ninterface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGPolygonElement: {\n    prototype: SVGPolygonElement;\n    new(): SVGPolygonElement;\n}\n\ninterface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGPolylineElement: {\n    prototype: SVGPolylineElement;\n    new(): SVGPolylineElement;\n}\n\ninterface SVGPreserveAspectRatio {\n    align: number;\n    meetOrSlice: number;\n    readonly SVG_MEETORSLICE_MEET: number;\n    readonly SVG_MEETORSLICE_SLICE: number;\n    readonly SVG_MEETORSLICE_UNKNOWN: number;\n    readonly SVG_PRESERVEASPECTRATIO_NONE: number;\n    readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number;\n}\n\ndeclare var SVGPreserveAspectRatio: {\n    prototype: SVGPreserveAspectRatio;\n    new(): SVGPreserveAspectRatio;\n    readonly SVG_MEETORSLICE_MEET: number;\n    readonly SVG_MEETORSLICE_SLICE: number;\n    readonly SVG_MEETORSLICE_UNKNOWN: number;\n    readonly SVG_PRESERVEASPECTRATIO_NONE: number;\n    readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number;\n}\n\ninterface SVGRadialGradientElement extends SVGGradientElement {\n    readonly cx: SVGAnimatedLength;\n    readonly cy: SVGAnimatedLength;\n    readonly fx: SVGAnimatedLength;\n    readonly fy: SVGAnimatedLength;\n    readonly r: SVGAnimatedLength;\n}\n\ndeclare var SVGRadialGradientElement: {\n    prototype: SVGRadialGradientElement;\n    new(): SVGRadialGradientElement;\n}\n\ninterface SVGRect {\n    height: number;\n    width: number;\n    x: number;\n    y: number;\n}\n\ndeclare var SVGRect: {\n    prototype: SVGRect;\n    new(): SVGRect;\n}\n\ninterface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    readonly height: SVGAnimatedLength;\n    readonly rx: SVGAnimatedLength;\n    readonly ry: SVGAnimatedLength;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGRectElement: {\n    prototype: SVGRectElement;\n    new(): SVGRectElement;\n}\n\ninterface SVGSVGElementEventMap extends SVGElementEventMap {\n    \"SVGAbort\": Event;\n    \"SVGError\": Event;\n    \"resize\": UIEvent;\n    \"scroll\": UIEvent;\n    \"SVGUnload\": Event;\n    \"SVGZoom\": SVGZoomEvent;\n}\n\ninterface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {\n    contentScriptType: string;\n    contentStyleType: string;\n    currentScale: number;\n    readonly currentTranslate: SVGPoint;\n    readonly height: SVGAnimatedLength;\n    onabort: (this: SVGSVGElement, ev: Event) => any;\n    onerror: (this: SVGSVGElement, ev: Event) => any;\n    onresize: (this: SVGSVGElement, ev: UIEvent) => any;\n    onscroll: (this: SVGSVGElement, ev: UIEvent) => any;\n    onunload: (this: SVGSVGElement, ev: Event) => any;\n    onzoom: (this: SVGSVGElement, ev: SVGZoomEvent) => any;\n    readonly pixelUnitToMillimeterX: number;\n    readonly pixelUnitToMillimeterY: number;\n    readonly screenPixelToMillimeterX: number;\n    readonly screenPixelToMillimeterY: number;\n    readonly viewport: SVGRect;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n    checkEnclosure(element: SVGElement, rect: SVGRect): boolean;\n    checkIntersection(element: SVGElement, rect: SVGRect): boolean;\n    createSVGAngle(): SVGAngle;\n    createSVGLength(): SVGLength;\n    createSVGMatrix(): SVGMatrix;\n    createSVGNumber(): SVGNumber;\n    createSVGPoint(): SVGPoint;\n    createSVGRect(): SVGRect;\n    createSVGTransform(): SVGTransform;\n    createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform;\n    deselectAll(): void;\n    forceRedraw(): void;\n    getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\n    getCurrentTime(): number;\n    getElementById(elementId: string): Element;\n    getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;\n    getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;\n    pauseAnimations(): void;\n    setCurrentTime(seconds: number): void;\n    suspendRedraw(maxWaitMilliseconds: number): number;\n    unpauseAnimations(): void;\n    unsuspendRedraw(suspendHandleID: number): void;\n    unsuspendRedrawAll(): void;\n    addEventListener<K extends keyof SVGSVGElementEventMap>(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGSVGElement: {\n    prototype: SVGSVGElement;\n    new(): SVGSVGElement;\n}\n\ninterface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference {\n    type: string;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGScriptElement: {\n    prototype: SVGScriptElement;\n    new(): SVGScriptElement;\n}\n\ninterface SVGStopElement extends SVGElement, SVGStylable {\n    readonly offset: SVGAnimatedNumber;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGStopElement: {\n    prototype: SVGStopElement;\n    new(): SVGStopElement;\n}\n\ninterface SVGStringList {\n    readonly numberOfItems: number;\n    appendItem(newItem: string): string;\n    clear(): void;\n    getItem(index: number): string;\n    initialize(newItem: string): string;\n    insertItemBefore(newItem: string, index: number): string;\n    removeItem(index: number): string;\n    replaceItem(newItem: string, index: number): string;\n}\n\ndeclare var SVGStringList: {\n    prototype: SVGStringList;\n    new(): SVGStringList;\n}\n\ninterface SVGStyleElement extends SVGElement, SVGLangSpace {\n    disabled: boolean;\n    media: string;\n    title: string;\n    type: string;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGStyleElement: {\n    prototype: SVGStyleElement;\n    new(): SVGStyleElement;\n}\n\ninterface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGSwitchElement: {\n    prototype: SVGSwitchElement;\n    new(): SVGSwitchElement;\n}\n\ninterface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGSymbolElement: {\n    prototype: SVGSymbolElement;\n    new(): SVGSymbolElement;\n}\n\ninterface SVGTSpanElement extends SVGTextPositioningElement {\n}\n\ndeclare var SVGTSpanElement: {\n    prototype: SVGTSpanElement;\n    new(): SVGTSpanElement;\n}\n\ninterface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    readonly lengthAdjust: SVGAnimatedEnumeration;\n    readonly textLength: SVGAnimatedLength;\n    getCharNumAtPosition(point: SVGPoint): number;\n    getComputedTextLength(): number;\n    getEndPositionOfChar(charnum: number): SVGPoint;\n    getExtentOfChar(charnum: number): SVGRect;\n    getNumberOfChars(): number;\n    getRotationOfChar(charnum: number): number;\n    getStartPositionOfChar(charnum: number): SVGPoint;\n    getSubStringLength(charnum: number, nchars: number): number;\n    selectSubString(charnum: number, nchars: number): void;\n    readonly LENGTHADJUST_SPACING: number;\n    readonly LENGTHADJUST_SPACINGANDGLYPHS: number;\n    readonly LENGTHADJUST_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGTextContentElement: {\n    prototype: SVGTextContentElement;\n    new(): SVGTextContentElement;\n    readonly LENGTHADJUST_SPACING: number;\n    readonly LENGTHADJUST_SPACINGANDGLYPHS: number;\n    readonly LENGTHADJUST_UNKNOWN: number;\n}\n\ninterface SVGTextElement extends SVGTextPositioningElement, SVGTransformable {\n}\n\ndeclare var SVGTextElement: {\n    prototype: SVGTextElement;\n    new(): SVGTextElement;\n}\n\ninterface SVGTextPathElement extends SVGTextContentElement, SVGURIReference {\n    readonly method: SVGAnimatedEnumeration;\n    readonly spacing: SVGAnimatedEnumeration;\n    readonly startOffset: SVGAnimatedLength;\n    readonly TEXTPATH_METHODTYPE_ALIGN: number;\n    readonly TEXTPATH_METHODTYPE_STRETCH: number;\n    readonly TEXTPATH_METHODTYPE_UNKNOWN: number;\n    readonly TEXTPATH_SPACINGTYPE_AUTO: number;\n    readonly TEXTPATH_SPACINGTYPE_EXACT: number;\n    readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number;\n}\n\ndeclare var SVGTextPathElement: {\n    prototype: SVGTextPathElement;\n    new(): SVGTextPathElement;\n    readonly TEXTPATH_METHODTYPE_ALIGN: number;\n    readonly TEXTPATH_METHODTYPE_STRETCH: number;\n    readonly TEXTPATH_METHODTYPE_UNKNOWN: number;\n    readonly TEXTPATH_SPACINGTYPE_AUTO: number;\n    readonly TEXTPATH_SPACINGTYPE_EXACT: number;\n    readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number;\n}\n\ninterface SVGTextPositioningElement extends SVGTextContentElement {\n    readonly dx: SVGAnimatedLengthList;\n    readonly dy: SVGAnimatedLengthList;\n    readonly rotate: SVGAnimatedNumberList;\n    readonly x: SVGAnimatedLengthList;\n    readonly y: SVGAnimatedLengthList;\n}\n\ndeclare var SVGTextPositioningElement: {\n    prototype: SVGTextPositioningElement;\n    new(): SVGTextPositioningElement;\n}\n\ninterface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGTitleElement: {\n    prototype: SVGTitleElement;\n    new(): SVGTitleElement;\n}\n\ninterface SVGTransform {\n    readonly angle: number;\n    readonly matrix: SVGMatrix;\n    readonly type: number;\n    setMatrix(matrix: SVGMatrix): void;\n    setRotate(angle: number, cx: number, cy: number): void;\n    setScale(sx: number, sy: number): void;\n    setSkewX(angle: number): void;\n    setSkewY(angle: number): void;\n    setTranslate(tx: number, ty: number): void;\n    readonly SVG_TRANSFORM_MATRIX: number;\n    readonly SVG_TRANSFORM_ROTATE: number;\n    readonly SVG_TRANSFORM_SCALE: number;\n    readonly SVG_TRANSFORM_SKEWX: number;\n    readonly SVG_TRANSFORM_SKEWY: number;\n    readonly SVG_TRANSFORM_TRANSLATE: number;\n    readonly SVG_TRANSFORM_UNKNOWN: number;\n}\n\ndeclare var SVGTransform: {\n    prototype: SVGTransform;\n    new(): SVGTransform;\n    readonly SVG_TRANSFORM_MATRIX: number;\n    readonly SVG_TRANSFORM_ROTATE: number;\n    readonly SVG_TRANSFORM_SCALE: number;\n    readonly SVG_TRANSFORM_SKEWX: number;\n    readonly SVG_TRANSFORM_SKEWY: number;\n    readonly SVG_TRANSFORM_TRANSLATE: number;\n    readonly SVG_TRANSFORM_UNKNOWN: number;\n}\n\ninterface SVGTransformList {\n    readonly numberOfItems: number;\n    appendItem(newItem: SVGTransform): SVGTransform;\n    clear(): void;\n    consolidate(): SVGTransform;\n    createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform;\n    getItem(index: number): SVGTransform;\n    initialize(newItem: SVGTransform): SVGTransform;\n    insertItemBefore(newItem: SVGTransform, index: number): SVGTransform;\n    removeItem(index: number): SVGTransform;\n    replaceItem(newItem: SVGTransform, index: number): SVGTransform;\n}\n\ndeclare var SVGTransformList: {\n    prototype: SVGTransformList;\n    new(): SVGTransformList;\n}\n\ninterface SVGUnitTypes {\n    readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number;\n    readonly SVG_UNIT_TYPE_UNKNOWN: number;\n    readonly SVG_UNIT_TYPE_USERSPACEONUSE: number;\n}\ndeclare var SVGUnitTypes: SVGUnitTypes;\n\ninterface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\n    readonly animatedInstanceRoot: SVGElementInstance;\n    readonly height: SVGAnimatedLength;\n    readonly instanceRoot: SVGElementInstance;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGUseElement: {\n    prototype: SVGUseElement;\n    new(): SVGUseElement;\n}\n\ninterface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {\n    readonly viewTarget: SVGStringList;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGViewElement: {\n    prototype: SVGViewElement;\n    new(): SVGViewElement;\n}\n\ninterface SVGZoomAndPan {\n    readonly zoomAndPan: number;\n}\n\ndeclare var SVGZoomAndPan: {\n    readonly SVG_ZOOMANDPAN_DISABLE: number;\n    readonly SVG_ZOOMANDPAN_MAGNIFY: number;\n    readonly SVG_ZOOMANDPAN_UNKNOWN: number;\n}\n\ninterface SVGZoomEvent extends UIEvent {\n    readonly newScale: number;\n    readonly newTranslate: SVGPoint;\n    readonly previousScale: number;\n    readonly previousTranslate: SVGPoint;\n    readonly zoomRectScreen: SVGRect;\n}\n\ndeclare var SVGZoomEvent: {\n    prototype: SVGZoomEvent;\n    new(): SVGZoomEvent;\n}\n\ninterface ScreenEventMap {\n    \"MSOrientationChange\": Event;\n}\n\ninterface Screen extends EventTarget {\n    readonly availHeight: number;\n    readonly availWidth: number;\n    bufferDepth: number;\n    readonly colorDepth: number;\n    readonly deviceXDPI: number;\n    readonly deviceYDPI: number;\n    readonly fontSmoothingEnabled: boolean;\n    readonly height: number;\n    readonly logicalXDPI: number;\n    readonly logicalYDPI: number;\n    readonly msOrientation: string;\n    onmsorientationchange: (this: Screen, ev: Event) => any;\n    readonly pixelDepth: number;\n    readonly systemXDPI: number;\n    readonly systemYDPI: number;\n    readonly width: number;\n    msLockOrientation(orientations: string | string[]): boolean;\n    msUnlockOrientation(): void;\n    addEventListener<K extends keyof ScreenEventMap>(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Screen: {\n    prototype: Screen;\n    new(): Screen;\n}\n\ninterface ScriptNotifyEvent extends Event {\n    readonly callingUri: string;\n    readonly value: string;\n}\n\ndeclare var ScriptNotifyEvent: {\n    prototype: ScriptNotifyEvent;\n    new(): ScriptNotifyEvent;\n}\n\ninterface ScriptProcessorNodeEventMap {\n    \"audioprocess\": AudioProcessingEvent;\n}\n\ninterface ScriptProcessorNode extends AudioNode {\n    readonly bufferSize: number;\n    onaudioprocess: (this: ScriptProcessorNode, ev: AudioProcessingEvent) => any;\n    addEventListener<K extends keyof ScriptProcessorNodeEventMap>(type: K, listener: (this: ScriptProcessorNode, ev: ScriptProcessorNodeEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var ScriptProcessorNode: {\n    prototype: ScriptProcessorNode;\n    new(): ScriptProcessorNode;\n}\n\ninterface Selection {\n    readonly anchorNode: Node;\n    readonly anchorOffset: number;\n    readonly focusNode: Node;\n    readonly focusOffset: number;\n    readonly isCollapsed: boolean;\n    readonly rangeCount: number;\n    readonly type: string;\n    addRange(range: Range): void;\n    collapse(parentNode: Node, offset: number): void;\n    collapseToEnd(): void;\n    collapseToStart(): void;\n    containsNode(node: Node, partlyContained: boolean): boolean;\n    deleteFromDocument(): void;\n    empty(): void;\n    extend(newNode: Node, offset: number): void;\n    getRangeAt(index: number): Range;\n    removeAllRanges(): void;\n    removeRange(range: Range): void;\n    selectAllChildren(parentNode: Node): void;\n    setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void;\n    toString(): string;\n}\n\ndeclare var Selection: {\n    prototype: Selection;\n    new(): Selection;\n}\n\ninterface SourceBuffer extends EventTarget {\n    appendWindowEnd: number;\n    appendWindowStart: number;\n    readonly audioTracks: AudioTrackList;\n    readonly buffered: TimeRanges;\n    mode: string;\n    timestampOffset: number;\n    readonly updating: boolean;\n    readonly videoTracks: VideoTrackList;\n    abort(): void;\n    appendBuffer(data: ArrayBuffer | ArrayBufferView): void;\n    appendStream(stream: MSStream, maxSize?: number): void;\n    remove(start: number, end: number): void;\n}\n\ndeclare var SourceBuffer: {\n    prototype: SourceBuffer;\n    new(): SourceBuffer;\n}\n\ninterface SourceBufferList extends EventTarget {\n    readonly length: number;\n    item(index: number): SourceBuffer;\n    [index: number]: SourceBuffer;\n}\n\ndeclare var SourceBufferList: {\n    prototype: SourceBufferList;\n    new(): SourceBufferList;\n}\n\ninterface StereoPannerNode extends AudioNode {\n    readonly pan: AudioParam;\n}\n\ndeclare var StereoPannerNode: {\n    prototype: StereoPannerNode;\n    new(): StereoPannerNode;\n}\n\ninterface Storage {\n    readonly length: number;\n    clear(): void;\n    getItem(key: string): string | null;\n    key(index: number): string | null;\n    removeItem(key: string): void;\n    setItem(key: string, data: string): void;\n    [key: string]: any;\n    [index: number]: string;\n}\n\ndeclare var Storage: {\n    prototype: Storage;\n    new(): Storage;\n}\n\ninterface StorageEvent extends Event {\n    readonly url: string;\n    key?: string;\n    oldValue?: string;\n    newValue?: string;\n    storageArea?: Storage;\n}\n\ndeclare var StorageEvent: {\n    prototype: StorageEvent;\n    new (type: string, eventInitDict?: StorageEventInit): StorageEvent;\n}\n\ninterface StyleMedia {\n    readonly type: string;\n    matchMedium(mediaquery: string): boolean;\n}\n\ndeclare var StyleMedia: {\n    prototype: StyleMedia;\n    new(): StyleMedia;\n}\n\ninterface StyleSheet {\n    disabled: boolean;\n    readonly href: string;\n    readonly media: MediaList;\n    readonly ownerNode: Node;\n    readonly parentStyleSheet: StyleSheet;\n    readonly title: string;\n    readonly type: string;\n}\n\ndeclare var StyleSheet: {\n    prototype: StyleSheet;\n    new(): StyleSheet;\n}\n\ninterface StyleSheetList {\n    readonly length: number;\n    item(index?: number): StyleSheet;\n    [index: number]: StyleSheet;\n}\n\ndeclare var StyleSheetList: {\n    prototype: StyleSheetList;\n    new(): StyleSheetList;\n}\n\ninterface StyleSheetPageList {\n    readonly length: number;\n    item(index: number): CSSPageRule;\n    [index: number]: CSSPageRule;\n}\n\ndeclare var StyleSheetPageList: {\n    prototype: StyleSheetPageList;\n    new(): StyleSheetPageList;\n}\n\ninterface SubtleCrypto {\n    decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike<ArrayBuffer>;\n    deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike<ArrayBuffer>;\n    deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike<CryptoKey>;\n    digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike<ArrayBuffer>;\n    encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike<ArrayBuffer>;\n    exportKey(format: \"jwk\", key: CryptoKey): PromiseLike<JsonWebKey>;\n    exportKey(format: \"raw\" | \"pkcs8\" | \"spki\", key: CryptoKey): PromiseLike<ArrayBuffer>;\n    exportKey(format: string, key: CryptoKey): PromiseLike<JsonWebKey | ArrayBuffer>;\n    generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike<CryptoKeyPair | CryptoKey>;\n    generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike<CryptoKeyPair>;\n    generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike<CryptoKey>;\n    importKey(format: \"jwk\", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike<CryptoKey>;\n    importKey(format: \"raw\" | \"pkcs8\" | \"spki\", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike<CryptoKey>;\n    importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike<CryptoKey>;\n    sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike<ArrayBuffer>;\n    unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike<CryptoKey>;\n    verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike<boolean>;\n    wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike<ArrayBuffer>;\n}\n\ndeclare var SubtleCrypto: {\n    prototype: SubtleCrypto;\n    new(): SubtleCrypto;\n}\n\ninterface Text extends CharacterData {\n    readonly wholeText: string;\n    readonly assignedSlot: HTMLSlotElement | null;\n    splitText(offset: number): Text;\n}\n\ndeclare var Text: {\n    prototype: Text;\n    new(): Text;\n}\n\ninterface TextEvent extends UIEvent {\n    readonly data: string;\n    readonly inputMethod: number;\n    readonly locale: string;\n    initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void;\n    readonly DOM_INPUT_METHOD_DROP: number;\n    readonly DOM_INPUT_METHOD_HANDWRITING: number;\n    readonly DOM_INPUT_METHOD_IME: number;\n    readonly DOM_INPUT_METHOD_KEYBOARD: number;\n    readonly DOM_INPUT_METHOD_MULTIMODAL: number;\n    readonly DOM_INPUT_METHOD_OPTION: number;\n    readonly DOM_INPUT_METHOD_PASTE: number;\n    readonly DOM_INPUT_METHOD_SCRIPT: number;\n    readonly DOM_INPUT_METHOD_UNKNOWN: number;\n    readonly DOM_INPUT_METHOD_VOICE: number;\n}\n\ndeclare var TextEvent: {\n    prototype: TextEvent;\n    new(): TextEvent;\n    readonly DOM_INPUT_METHOD_DROP: number;\n    readonly DOM_INPUT_METHOD_HANDWRITING: number;\n    readonly DOM_INPUT_METHOD_IME: number;\n    readonly DOM_INPUT_METHOD_KEYBOARD: number;\n    readonly DOM_INPUT_METHOD_MULTIMODAL: number;\n    readonly DOM_INPUT_METHOD_OPTION: number;\n    readonly DOM_INPUT_METHOD_PASTE: number;\n    readonly DOM_INPUT_METHOD_SCRIPT: number;\n    readonly DOM_INPUT_METHOD_UNKNOWN: number;\n    readonly DOM_INPUT_METHOD_VOICE: number;\n}\n\ninterface TextMetrics {\n    readonly width: number;\n}\n\ndeclare var TextMetrics: {\n    prototype: TextMetrics;\n    new(): TextMetrics;\n}\n\ninterface TextTrackEventMap {\n    \"cuechange\": Event;\n    \"error\": ErrorEvent;\n    \"load\": Event;\n}\n\ninterface TextTrack extends EventTarget {\n    readonly activeCues: TextTrackCueList;\n    readonly cues: TextTrackCueList;\n    readonly inBandMetadataTrackDispatchType: string;\n    readonly kind: string;\n    readonly label: string;\n    readonly language: string;\n    mode: any;\n    oncuechange: (this: TextTrack, ev: Event) => any;\n    onerror: (this: TextTrack, ev: ErrorEvent) => any;\n    onload: (this: TextTrack, ev: Event) => any;\n    readonly readyState: number;\n    addCue(cue: TextTrackCue): void;\n    removeCue(cue: TextTrackCue): void;\n    readonly DISABLED: number;\n    readonly ERROR: number;\n    readonly HIDDEN: number;\n    readonly LOADED: number;\n    readonly LOADING: number;\n    readonly NONE: number;\n    readonly SHOWING: number;\n    addEventListener<K extends keyof TextTrackEventMap>(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var TextTrack: {\n    prototype: TextTrack;\n    new(): TextTrack;\n    readonly DISABLED: number;\n    readonly ERROR: number;\n    readonly HIDDEN: number;\n    readonly LOADED: number;\n    readonly LOADING: number;\n    readonly NONE: number;\n    readonly SHOWING: number;\n}\n\ninterface TextTrackCueEventMap {\n    \"enter\": Event;\n    \"exit\": Event;\n}\n\ninterface TextTrackCue extends EventTarget {\n    endTime: number;\n    id: string;\n    onenter: (this: TextTrackCue, ev: Event) => any;\n    onexit: (this: TextTrackCue, ev: Event) => any;\n    pauseOnExit: boolean;\n    startTime: number;\n    text: string;\n    readonly track: TextTrack;\n    getCueAsHTML(): DocumentFragment;\n    addEventListener<K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var TextTrackCue: {\n    prototype: TextTrackCue;\n    new(startTime: number, endTime: number, text: string): TextTrackCue;\n}\n\ninterface TextTrackCueList {\n    readonly length: number;\n    getCueById(id: string): TextTrackCue;\n    item(index: number): TextTrackCue;\n    [index: number]: TextTrackCue;\n}\n\ndeclare var TextTrackCueList: {\n    prototype: TextTrackCueList;\n    new(): TextTrackCueList;\n}\n\ninterface TextTrackListEventMap {\n    \"addtrack\": TrackEvent;\n}\n\ninterface TextTrackList extends EventTarget {\n    readonly length: number;\n    onaddtrack: ((this: TextTrackList, ev: TrackEvent) => any) | null;\n    item(index: number): TextTrack;\n    addEventListener<K extends keyof TextTrackListEventMap>(type: K, listener: (this: TextTrackList, ev: TextTrackListEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n    [index: number]: TextTrack;\n}\n\ndeclare var TextTrackList: {\n    prototype: TextTrackList;\n    new(): TextTrackList;\n}\n\ninterface TimeRanges {\n    readonly length: number;\n    end(index: number): number;\n    start(index: number): number;\n}\n\ndeclare var TimeRanges: {\n    prototype: TimeRanges;\n    new(): TimeRanges;\n}\n\ninterface Touch {\n    readonly clientX: number;\n    readonly clientY: number;\n    readonly identifier: number;\n    readonly pageX: number;\n    readonly pageY: number;\n    readonly screenX: number;\n    readonly screenY: number;\n    readonly target: EventTarget;\n}\n\ndeclare var Touch: {\n    prototype: Touch;\n    new(): Touch;\n}\n\ninterface TouchEvent extends UIEvent {\n    readonly altKey: boolean;\n    readonly changedTouches: TouchList;\n    readonly ctrlKey: boolean;\n    readonly metaKey: boolean;\n    readonly shiftKey: boolean;\n    readonly targetTouches: TouchList;\n    readonly touches: TouchList;\n}\n\ndeclare var TouchEvent: {\n    prototype: TouchEvent;\n    new(): TouchEvent;\n}\n\ninterface TouchList {\n    readonly length: number;\n    item(index: number): Touch | null;\n    [index: number]: Touch;\n}\n\ndeclare var TouchList: {\n    prototype: TouchList;\n    new(): TouchList;\n}\n\ninterface TrackEvent extends Event {\n    readonly track: any;\n}\n\ndeclare var TrackEvent: {\n    prototype: TrackEvent;\n    new(): TrackEvent;\n}\n\ninterface TransitionEvent extends Event {\n    readonly elapsedTime: number;\n    readonly propertyName: string;\n    initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void;\n}\n\ndeclare var TransitionEvent: {\n    prototype: TransitionEvent;\n    new(): TransitionEvent;\n}\n\ninterface TreeWalker {\n    currentNode: Node;\n    readonly expandEntityReferences: boolean;\n    readonly filter: NodeFilter;\n    readonly root: Node;\n    readonly whatToShow: number;\n    firstChild(): Node;\n    lastChild(): Node;\n    nextNode(): Node;\n    nextSibling(): Node;\n    parentNode(): Node;\n    previousNode(): Node;\n    previousSibling(): Node;\n}\n\ndeclare var TreeWalker: {\n    prototype: TreeWalker;\n    new(): TreeWalker;\n}\n\ninterface UIEvent extends Event {\n    readonly detail: number;\n    readonly view: Window;\n    initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void;\n}\n\ndeclare var UIEvent: {\n    prototype: UIEvent;\n    new(type: string, eventInitDict?: UIEventInit): UIEvent;\n}\n\ninterface URL {\n    hash: string;\n    host: string;\n    hostname: string;\n    href: string;\n    readonly origin: string;\n    password: string;\n    pathname: string;\n    port: string;\n    protocol: string;\n    search: string;\n    username: string;\n    toString(): string;\n}\n\ndeclare var URL: {\n    prototype: URL;\n    new(url: string, base?: string): URL;\n    createObjectURL(object: any, options?: ObjectURLOptions): string;\n    revokeObjectURL(url: string): void;\n}\n\ninterface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer {\n    readonly mediaType: string;\n}\n\ndeclare var UnviewableContentIdentifiedEvent: {\n    prototype: UnviewableContentIdentifiedEvent;\n    new(): UnviewableContentIdentifiedEvent;\n}\n\ninterface ValidityState {\n    readonly badInput: boolean;\n    readonly customError: boolean;\n    readonly patternMismatch: boolean;\n    readonly rangeOverflow: boolean;\n    readonly rangeUnderflow: boolean;\n    readonly stepMismatch: boolean;\n    readonly tooLong: boolean;\n    readonly typeMismatch: boolean;\n    readonly valid: boolean;\n    readonly valueMissing: boolean;\n}\n\ndeclare var ValidityState: {\n    prototype: ValidityState;\n    new(): ValidityState;\n}\n\ninterface VideoPlaybackQuality {\n    readonly corruptedVideoFrames: number;\n    readonly creationTime: number;\n    readonly droppedVideoFrames: number;\n    readonly totalFrameDelay: number;\n    readonly totalVideoFrames: number;\n}\n\ndeclare var VideoPlaybackQuality: {\n    prototype: VideoPlaybackQuality;\n    new(): VideoPlaybackQuality;\n}\n\ninterface VideoTrack {\n    readonly id: string;\n    kind: string;\n    readonly label: string;\n    language: string;\n    selected: boolean;\n    readonly sourceBuffer: SourceBuffer;\n}\n\ndeclare var VideoTrack: {\n    prototype: VideoTrack;\n    new(): VideoTrack;\n}\n\ninterface VideoTrackListEventMap {\n    \"addtrack\": TrackEvent;\n    \"change\": Event;\n    \"removetrack\": TrackEvent;\n}\n\ninterface VideoTrackList extends EventTarget {\n    readonly length: number;\n    onaddtrack: (this: VideoTrackList, ev: TrackEvent) => any;\n    onchange: (this: VideoTrackList, ev: Event) => any;\n    onremovetrack: (this: VideoTrackList, ev: TrackEvent) => any;\n    readonly selectedIndex: number;\n    getTrackById(id: string): VideoTrack | null;\n    item(index: number): VideoTrack;\n    addEventListener<K extends keyof VideoTrackListEventMap>(type: K, listener: (this: VideoTrackList, ev: VideoTrackListEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n    [index: number]: VideoTrack;\n}\n\ndeclare var VideoTrackList: {\n    prototype: VideoTrackList;\n    new(): VideoTrackList;\n}\n\ninterface WEBGL_compressed_texture_s3tc {\n    readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number;\n    readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number;\n    readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number;\n    readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number;\n}\n\ndeclare var WEBGL_compressed_texture_s3tc: {\n    prototype: WEBGL_compressed_texture_s3tc;\n    new(): WEBGL_compressed_texture_s3tc;\n    readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number;\n    readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number;\n    readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number;\n    readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number;\n}\n\ninterface WEBGL_debug_renderer_info {\n    readonly UNMASKED_RENDERER_WEBGL: number;\n    readonly UNMASKED_VENDOR_WEBGL: number;\n}\n\ndeclare var WEBGL_debug_renderer_info: {\n    prototype: WEBGL_debug_renderer_info;\n    new(): WEBGL_debug_renderer_info;\n    readonly UNMASKED_RENDERER_WEBGL: number;\n    readonly UNMASKED_VENDOR_WEBGL: number;\n}\n\ninterface WEBGL_depth_texture {\n    readonly UNSIGNED_INT_24_8_WEBGL: number;\n}\n\ndeclare var WEBGL_depth_texture: {\n    prototype: WEBGL_depth_texture;\n    new(): WEBGL_depth_texture;\n    readonly UNSIGNED_INT_24_8_WEBGL: number;\n}\n\ninterface WaveShaperNode extends AudioNode {\n    curve: Float32Array | null;\n    oversample: string;\n}\n\ndeclare var WaveShaperNode: {\n    prototype: WaveShaperNode;\n    new(): WaveShaperNode;\n}\n\ninterface WebGLActiveInfo {\n    readonly name: string;\n    readonly size: number;\n    readonly type: number;\n}\n\ndeclare var WebGLActiveInfo: {\n    prototype: WebGLActiveInfo;\n    new(): WebGLActiveInfo;\n}\n\ninterface WebGLBuffer extends WebGLObject {\n}\n\ndeclare var WebGLBuffer: {\n    prototype: WebGLBuffer;\n    new(): WebGLBuffer;\n}\n\ninterface WebGLContextEvent extends Event {\n    readonly statusMessage: string;\n}\n\ndeclare var WebGLContextEvent: {\n    prototype: WebGLContextEvent;\n    new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent;\n}\n\ninterface WebGLFramebuffer extends WebGLObject {\n}\n\ndeclare var WebGLFramebuffer: {\n    prototype: WebGLFramebuffer;\n    new(): WebGLFramebuffer;\n}\n\ninterface WebGLObject {\n}\n\ndeclare var WebGLObject: {\n    prototype: WebGLObject;\n    new(): WebGLObject;\n}\n\ninterface WebGLProgram extends WebGLObject {\n}\n\ndeclare var WebGLProgram: {\n    prototype: WebGLProgram;\n    new(): WebGLProgram;\n}\n\ninterface WebGLRenderbuffer extends WebGLObject {\n}\n\ndeclare var WebGLRenderbuffer: {\n    prototype: WebGLRenderbuffer;\n    new(): WebGLRenderbuffer;\n}\n\ninterface WebGLRenderingContext {\n    readonly canvas: HTMLCanvasElement;\n    readonly drawingBufferHeight: number;\n    readonly drawingBufferWidth: number;\n    activeTexture(texture: number): void;\n    attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void;\n    bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void;\n    bindBuffer(target: number, buffer: WebGLBuffer | null): void;\n    bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void;\n    bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void;\n    bindTexture(target: number, texture: WebGLTexture | null): void;\n    blendColor(red: number, green: number, blue: number, alpha: number): void;\n    blendEquation(mode: number): void;\n    blendEquationSeparate(modeRGB: number, modeAlpha: number): void;\n    blendFunc(sfactor: number, dfactor: number): void;\n    blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void;\n    bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void;\n    bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void;\n    checkFramebufferStatus(target: number): number;\n    clear(mask: number): void;\n    clearColor(red: number, green: number, blue: number, alpha: number): void;\n    clearDepth(depth: number): void;\n    clearStencil(s: number): void;\n    colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void;\n    compileShader(shader: WebGLShader | null): void;\n    compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void;\n    compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void;\n    copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void;\n    copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void;\n    createBuffer(): WebGLBuffer | null;\n    createFramebuffer(): WebGLFramebuffer | null;\n    createProgram(): WebGLProgram | null;\n    createRenderbuffer(): WebGLRenderbuffer | null;\n    createShader(type: number): WebGLShader | null;\n    createTexture(): WebGLTexture | null;\n    cullFace(mode: number): void;\n    deleteBuffer(buffer: WebGLBuffer | null): void;\n    deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void;\n    deleteProgram(program: WebGLProgram | null): void;\n    deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void;\n    deleteShader(shader: WebGLShader | null): void;\n    deleteTexture(texture: WebGLTexture | null): void;\n    depthFunc(func: number): void;\n    depthMask(flag: boolean): void;\n    depthRange(zNear: number, zFar: number): void;\n    detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void;\n    disable(cap: number): void;\n    disableVertexAttribArray(index: number): void;\n    drawArrays(mode: number, first: number, count: number): void;\n    drawElements(mode: number, count: number, type: number, offset: number): void;\n    enable(cap: number): void;\n    enableVertexAttribArray(index: number): void;\n    finish(): void;\n    flush(): void;\n    framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void;\n    framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void;\n    frontFace(mode: number): void;\n    generateMipmap(target: number): void;\n    getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null;\n    getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null;\n    getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null;\n    getAttribLocation(program: WebGLProgram | null, name: string): number;\n    getBufferParameter(target: number, pname: number): any;\n    getContextAttributes(): WebGLContextAttributes;\n    getError(): number;\n    getExtension(name: string): any;\n    getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any;\n    getParameter(pname: number): any;\n    getProgramInfoLog(program: WebGLProgram | null): string | null;\n    getProgramParameter(program: WebGLProgram | null, pname: number): any;\n    getRenderbufferParameter(target: number, pname: number): any;\n    getShaderInfoLog(shader: WebGLShader | null): string | null;\n    getShaderParameter(shader: WebGLShader | null, pname: number): any;\n    getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null;\n    getShaderSource(shader: WebGLShader | null): string | null;\n    getSupportedExtensions(): string[] | null;\n    getTexParameter(target: number, pname: number): any;\n    getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any;\n    getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null;\n    getVertexAttrib(index: number, pname: number): any;\n    getVertexAttribOffset(index: number, pname: number): number;\n    hint(target: number, mode: number): void;\n    isBuffer(buffer: WebGLBuffer | null): boolean;\n    isContextLost(): boolean;\n    isEnabled(cap: number): boolean;\n    isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean;\n    isProgram(program: WebGLProgram | null): boolean;\n    isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean;\n    isShader(shader: WebGLShader | null): boolean;\n    isTexture(texture: WebGLTexture | null): boolean;\n    lineWidth(width: number): void;\n    linkProgram(program: WebGLProgram | null): void;\n    pixelStorei(pname: number, param: number): void;\n    polygonOffset(factor: number, units: number): void;\n    readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void;\n    renderbufferStorage(target: number, internalformat: number, width: number, height: number): void;\n    sampleCoverage(value: number, invert: boolean): void;\n    scissor(x: number, y: number, width: number, height: number): void;\n    shaderSource(shader: WebGLShader | null, source: string): void;\n    stencilFunc(func: number, ref: number, mask: number): void;\n    stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void;\n    stencilMask(mask: number): void;\n    stencilMaskSeparate(face: number, mask: number): void;\n    stencilOp(fail: number, zfail: number, zpass: number): void;\n    stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void;\n    texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void;\n    texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;\n    texParameterf(target: number, pname: number, param: number): void;\n    texParameteri(target: number, pname: number, param: number): void;\n    texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void;\n    texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;\n    uniform1f(location: WebGLUniformLocation | null, x: number): void;\n    uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\n    uniform1i(location: WebGLUniformLocation | null, x: number): void;\n    uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\n    uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void;\n    uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\n    uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void;\n    uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\n    uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void;\n    uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\n    uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void;\n    uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\n    uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void;\n    uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\n    uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void;\n    uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\n    uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\n    uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\n    uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\n    useProgram(program: WebGLProgram | null): void;\n    validateProgram(program: WebGLProgram | null): void;\n    vertexAttrib1f(indx: number, x: number): void;\n    vertexAttrib1fv(indx: number, values: Float32Array | number[]): void;\n    vertexAttrib2f(indx: number, x: number, y: number): void;\n    vertexAttrib2fv(indx: number, values: Float32Array | number[]): void;\n    vertexAttrib3f(indx: number, x: number, y: number, z: number): void;\n    vertexAttrib3fv(indx: number, values: Float32Array | number[]): void;\n    vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void;\n    vertexAttrib4fv(indx: number, values: Float32Array | number[]): void;\n    vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void;\n    viewport(x: number, y: number, width: number, height: number): void;\n    readonly ACTIVE_ATTRIBUTES: number;\n    readonly ACTIVE_TEXTURE: number;\n    readonly ACTIVE_UNIFORMS: number;\n    readonly ALIASED_LINE_WIDTH_RANGE: number;\n    readonly ALIASED_POINT_SIZE_RANGE: number;\n    readonly ALPHA: number;\n    readonly ALPHA_BITS: number;\n    readonly ALWAYS: number;\n    readonly ARRAY_BUFFER: number;\n    readonly ARRAY_BUFFER_BINDING: number;\n    readonly ATTACHED_SHADERS: number;\n    readonly BACK: number;\n    readonly BLEND: number;\n    readonly BLEND_COLOR: number;\n    readonly BLEND_DST_ALPHA: number;\n    readonly BLEND_DST_RGB: number;\n    readonly BLEND_EQUATION: number;\n    readonly BLEND_EQUATION_ALPHA: number;\n    readonly BLEND_EQUATION_RGB: number;\n    readonly BLEND_SRC_ALPHA: number;\n    readonly BLEND_SRC_RGB: number;\n    readonly BLUE_BITS: number;\n    readonly BOOL: number;\n    readonly BOOL_VEC2: number;\n    readonly BOOL_VEC3: number;\n    readonly BOOL_VEC4: number;\n    readonly BROWSER_DEFAULT_WEBGL: number;\n    readonly BUFFER_SIZE: number;\n    readonly BUFFER_USAGE: number;\n    readonly BYTE: number;\n    readonly CCW: number;\n    readonly CLAMP_TO_EDGE: number;\n    readonly COLOR_ATTACHMENT0: number;\n    readonly COLOR_BUFFER_BIT: number;\n    readonly COLOR_CLEAR_VALUE: number;\n    readonly COLOR_WRITEMASK: number;\n    readonly COMPILE_STATUS: number;\n    readonly COMPRESSED_TEXTURE_FORMATS: number;\n    readonly CONSTANT_ALPHA: number;\n    readonly CONSTANT_COLOR: number;\n    readonly CONTEXT_LOST_WEBGL: number;\n    readonly CULL_FACE: number;\n    readonly CULL_FACE_MODE: number;\n    readonly CURRENT_PROGRAM: number;\n    readonly CURRENT_VERTEX_ATTRIB: number;\n    readonly CW: number;\n    readonly DECR: number;\n    readonly DECR_WRAP: number;\n    readonly DELETE_STATUS: number;\n    readonly DEPTH_ATTACHMENT: number;\n    readonly DEPTH_BITS: number;\n    readonly DEPTH_BUFFER_BIT: number;\n    readonly DEPTH_CLEAR_VALUE: number;\n    readonly DEPTH_COMPONENT: number;\n    readonly DEPTH_COMPONENT16: number;\n    readonly DEPTH_FUNC: number;\n    readonly DEPTH_RANGE: number;\n    readonly DEPTH_STENCIL: number;\n    readonly DEPTH_STENCIL_ATTACHMENT: number;\n    readonly DEPTH_TEST: number;\n    readonly DEPTH_WRITEMASK: number;\n    readonly DITHER: number;\n    readonly DONT_CARE: number;\n    readonly DST_ALPHA: number;\n    readonly DST_COLOR: number;\n    readonly DYNAMIC_DRAW: number;\n    readonly ELEMENT_ARRAY_BUFFER: number;\n    readonly ELEMENT_ARRAY_BUFFER_BINDING: number;\n    readonly EQUAL: number;\n    readonly FASTEST: number;\n    readonly FLOAT: number;\n    readonly FLOAT_MAT2: number;\n    readonly FLOAT_MAT3: number;\n    readonly FLOAT_MAT4: number;\n    readonly FLOAT_VEC2: number;\n    readonly FLOAT_VEC3: number;\n    readonly FLOAT_VEC4: number;\n    readonly FRAGMENT_SHADER: number;\n    readonly FRAMEBUFFER: number;\n    readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number;\n    readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number;\n    readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number;\n    readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number;\n    readonly FRAMEBUFFER_BINDING: number;\n    readonly FRAMEBUFFER_COMPLETE: number;\n    readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number;\n    readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number;\n    readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number;\n    readonly FRAMEBUFFER_UNSUPPORTED: number;\n    readonly FRONT: number;\n    readonly FRONT_AND_BACK: number;\n    readonly FRONT_FACE: number;\n    readonly FUNC_ADD: number;\n    readonly FUNC_REVERSE_SUBTRACT: number;\n    readonly FUNC_SUBTRACT: number;\n    readonly GENERATE_MIPMAP_HINT: number;\n    readonly GEQUAL: number;\n    readonly GREATER: number;\n    readonly GREEN_BITS: number;\n    readonly HIGH_FLOAT: number;\n    readonly HIGH_INT: number;\n    readonly IMPLEMENTATION_COLOR_READ_FORMAT: number;\n    readonly IMPLEMENTATION_COLOR_READ_TYPE: number;\n    readonly INCR: number;\n    readonly INCR_WRAP: number;\n    readonly INT: number;\n    readonly INT_VEC2: number;\n    readonly INT_VEC3: number;\n    readonly INT_VEC4: number;\n    readonly INVALID_ENUM: number;\n    readonly INVALID_FRAMEBUFFER_OPERATION: number;\n    readonly INVALID_OPERATION: number;\n    readonly INVALID_VALUE: number;\n    readonly INVERT: number;\n    readonly KEEP: number;\n    readonly LEQUAL: number;\n    readonly LESS: number;\n    readonly LINEAR: number;\n    readonly LINEAR_MIPMAP_LINEAR: number;\n    readonly LINEAR_MIPMAP_NEAREST: number;\n    readonly LINES: number;\n    readonly LINE_LOOP: number;\n    readonly LINE_STRIP: number;\n    readonly LINE_WIDTH: number;\n    readonly LINK_STATUS: number;\n    readonly LOW_FLOAT: number;\n    readonly LOW_INT: number;\n    readonly LUMINANCE: number;\n    readonly LUMINANCE_ALPHA: number;\n    readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number;\n    readonly MAX_CUBE_MAP_TEXTURE_SIZE: number;\n    readonly MAX_FRAGMENT_UNIFORM_VECTORS: number;\n    readonly MAX_RENDERBUFFER_SIZE: number;\n    readonly MAX_TEXTURE_IMAGE_UNITS: number;\n    readonly MAX_TEXTURE_SIZE: number;\n    readonly MAX_VARYING_VECTORS: number;\n    readonly MAX_VERTEX_ATTRIBS: number;\n    readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number;\n    readonly MAX_VERTEX_UNIFORM_VECTORS: number;\n    readonly MAX_VIEWPORT_DIMS: number;\n    readonly MEDIUM_FLOAT: number;\n    readonly MEDIUM_INT: number;\n    readonly MIRRORED_REPEAT: number;\n    readonly NEAREST: number;\n    readonly NEAREST_MIPMAP_LINEAR: number;\n    readonly NEAREST_MIPMAP_NEAREST: number;\n    readonly NEVER: number;\n    readonly NICEST: number;\n    readonly NONE: number;\n    readonly NOTEQUAL: number;\n    readonly NO_ERROR: number;\n    readonly ONE: number;\n    readonly ONE_MINUS_CONSTANT_ALPHA: number;\n    readonly ONE_MINUS_CONSTANT_COLOR: number;\n    readonly ONE_MINUS_DST_ALPHA: number;\n    readonly ONE_MINUS_DST_COLOR: number;\n    readonly ONE_MINUS_SRC_ALPHA: number;\n    readonly ONE_MINUS_SRC_COLOR: number;\n    readonly OUT_OF_MEMORY: number;\n    readonly PACK_ALIGNMENT: number;\n    readonly POINTS: number;\n    readonly POLYGON_OFFSET_FACTOR: number;\n    readonly POLYGON_OFFSET_FILL: number;\n    readonly POLYGON_OFFSET_UNITS: number;\n    readonly RED_BITS: number;\n    readonly RENDERBUFFER: number;\n    readonly RENDERBUFFER_ALPHA_SIZE: number;\n    readonly RENDERBUFFER_BINDING: number;\n    readonly RENDERBUFFER_BLUE_SIZE: number;\n    readonly RENDERBUFFER_DEPTH_SIZE: number;\n    readonly RENDERBUFFER_GREEN_SIZE: number;\n    readonly RENDERBUFFER_HEIGHT: number;\n    readonly RENDERBUFFER_INTERNAL_FORMAT: number;\n    readonly RENDERBUFFER_RED_SIZE: number;\n    readonly RENDERBUFFER_STENCIL_SIZE: number;\n    readonly RENDERBUFFER_WIDTH: number;\n    readonly RENDERER: number;\n    readonly REPEAT: number;\n    readonly REPLACE: number;\n    readonly RGB: number;\n    readonly RGB565: number;\n    readonly RGB5_A1: number;\n    readonly RGBA: number;\n    readonly RGBA4: number;\n    readonly SAMPLER_2D: number;\n    readonly SAMPLER_CUBE: number;\n    readonly SAMPLES: number;\n    readonly SAMPLE_ALPHA_TO_COVERAGE: number;\n    readonly SAMPLE_BUFFERS: number;\n    readonly SAMPLE_COVERAGE: number;\n    readonly SAMPLE_COVERAGE_INVERT: number;\n    readonly SAMPLE_COVERAGE_VALUE: number;\n    readonly SCISSOR_BOX: number;\n    readonly SCISSOR_TEST: number;\n    readonly SHADER_TYPE: number;\n    readonly SHADING_LANGUAGE_VERSION: number;\n    readonly SHORT: number;\n    readonly SRC_ALPHA: number;\n    readonly SRC_ALPHA_SATURATE: number;\n    readonly SRC_COLOR: number;\n    readonly STATIC_DRAW: number;\n    readonly STENCIL_ATTACHMENT: number;\n    readonly STENCIL_BACK_FAIL: number;\n    readonly STENCIL_BACK_FUNC: number;\n    readonly STENCIL_BACK_PASS_DEPTH_FAIL: number;\n    readonly STENCIL_BACK_PASS_DEPTH_PASS: number;\n    readonly STENCIL_BACK_REF: number;\n    readonly STENCIL_BACK_VALUE_MASK: number;\n    readonly STENCIL_BACK_WRITEMASK: number;\n    readonly STENCIL_BITS: number;\n    readonly STENCIL_BUFFER_BIT: number;\n    readonly STENCIL_CLEAR_VALUE: number;\n    readonly STENCIL_FAIL: number;\n    readonly STENCIL_FUNC: number;\n    readonly STENCIL_INDEX: number;\n    readonly STENCIL_INDEX8: number;\n    readonly STENCIL_PASS_DEPTH_FAIL: number;\n    readonly STENCIL_PASS_DEPTH_PASS: number;\n    readonly STENCIL_REF: number;\n    readonly STENCIL_TEST: number;\n    readonly STENCIL_VALUE_MASK: number;\n    readonly STENCIL_WRITEMASK: number;\n    readonly STREAM_DRAW: number;\n    readonly SUBPIXEL_BITS: number;\n    readonly TEXTURE: number;\n    readonly TEXTURE0: number;\n    readonly TEXTURE1: number;\n    readonly TEXTURE10: number;\n    readonly TEXTURE11: number;\n    readonly TEXTURE12: number;\n    readonly TEXTURE13: number;\n    readonly TEXTURE14: number;\n    readonly TEXTURE15: number;\n    readonly TEXTURE16: number;\n    readonly TEXTURE17: number;\n    readonly TEXTURE18: number;\n    readonly TEXTURE19: number;\n    readonly TEXTURE2: number;\n    readonly TEXTURE20: number;\n    readonly TEXTURE21: number;\n    readonly TEXTURE22: number;\n    readonly TEXTURE23: number;\n    readonly TEXTURE24: number;\n    readonly TEXTURE25: number;\n    readonly TEXTURE26: number;\n    readonly TEXTURE27: number;\n    readonly TEXTURE28: number;\n    readonly TEXTURE29: number;\n    readonly TEXTURE3: number;\n    readonly TEXTURE30: number;\n    readonly TEXTURE31: number;\n    readonly TEXTURE4: number;\n    readonly TEXTURE5: number;\n    readonly TEXTURE6: number;\n    readonly TEXTURE7: number;\n    readonly TEXTURE8: number;\n    readonly TEXTURE9: number;\n    readonly TEXTURE_2D: number;\n    readonly TEXTURE_BINDING_2D: number;\n    readonly TEXTURE_BINDING_CUBE_MAP: number;\n    readonly TEXTURE_CUBE_MAP: number;\n    readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number;\n    readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number;\n    readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number;\n    readonly TEXTURE_CUBE_MAP_POSITIVE_X: number;\n    readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number;\n    readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number;\n    readonly TEXTURE_MAG_FILTER: number;\n    readonly TEXTURE_MIN_FILTER: number;\n    readonly TEXTURE_WRAP_S: number;\n    readonly TEXTURE_WRAP_T: number;\n    readonly TRIANGLES: number;\n    readonly TRIANGLE_FAN: number;\n    readonly TRIANGLE_STRIP: number;\n    readonly UNPACK_ALIGNMENT: number;\n    readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number;\n    readonly UNPACK_FLIP_Y_WEBGL: number;\n    readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number;\n    readonly UNSIGNED_BYTE: number;\n    readonly UNSIGNED_INT: number;\n    readonly UNSIGNED_SHORT: number;\n    readonly UNSIGNED_SHORT_4_4_4_4: number;\n    readonly UNSIGNED_SHORT_5_5_5_1: number;\n    readonly UNSIGNED_SHORT_5_6_5: number;\n    readonly VALIDATE_STATUS: number;\n    readonly VENDOR: number;\n    readonly VERSION: number;\n    readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number;\n    readonly VERTEX_ATTRIB_ARRAY_ENABLED: number;\n    readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number;\n    readonly VERTEX_ATTRIB_ARRAY_POINTER: number;\n    readonly VERTEX_ATTRIB_ARRAY_SIZE: number;\n    readonly VERTEX_ATTRIB_ARRAY_STRIDE: number;\n    readonly VERTEX_ATTRIB_ARRAY_TYPE: number;\n    readonly VERTEX_SHADER: number;\n    readonly VIEWPORT: number;\n    readonly ZERO: number;\n}\n\ndeclare var WebGLRenderingContext: {\n    prototype: WebGLRenderingContext;\n    new(): WebGLRenderingContext;\n    readonly ACTIVE_ATTRIBUTES: number;\n    readonly ACTIVE_TEXTURE: number;\n    readonly ACTIVE_UNIFORMS: number;\n    readonly ALIASED_LINE_WIDTH_RANGE: number;\n    readonly ALIASED_POINT_SIZE_RANGE: number;\n    readonly ALPHA: number;\n    readonly ALPHA_BITS: number;\n    readonly ALWAYS: number;\n    readonly ARRAY_BUFFER: number;\n    readonly ARRAY_BUFFER_BINDING: number;\n    readonly ATTACHED_SHADERS: number;\n    readonly BACK: number;\n    readonly BLEND: number;\n    readonly BLEND_COLOR: number;\n    readonly BLEND_DST_ALPHA: number;\n    readonly BLEND_DST_RGB: number;\n    readonly BLEND_EQUATION: number;\n    readonly BLEND_EQUATION_ALPHA: number;\n    readonly BLEND_EQUATION_RGB: number;\n    readonly BLEND_SRC_ALPHA: number;\n    readonly BLEND_SRC_RGB: number;\n    readonly BLUE_BITS: number;\n    readonly BOOL: number;\n    readonly BOOL_VEC2: number;\n    readonly BOOL_VEC3: number;\n    readonly BOOL_VEC4: number;\n    readonly BROWSER_DEFAULT_WEBGL: number;\n    readonly BUFFER_SIZE: number;\n    readonly BUFFER_USAGE: number;\n    readonly BYTE: number;\n    readonly CCW: number;\n    readonly CLAMP_TO_EDGE: number;\n    readonly COLOR_ATTACHMENT0: number;\n    readonly COLOR_BUFFER_BIT: number;\n    readonly COLOR_CLEAR_VALUE: number;\n    readonly COLOR_WRITEMASK: number;\n    readonly COMPILE_STATUS: number;\n    readonly COMPRESSED_TEXTURE_FORMATS: number;\n    readonly CONSTANT_ALPHA: number;\n    readonly CONSTANT_COLOR: number;\n    readonly CONTEXT_LOST_WEBGL: number;\n    readonly CULL_FACE: number;\n    readonly CULL_FACE_MODE: number;\n    readonly CURRENT_PROGRAM: number;\n    readonly CURRENT_VERTEX_ATTRIB: number;\n    readonly CW: number;\n    readonly DECR: number;\n    readonly DECR_WRAP: number;\n    readonly DELETE_STATUS: number;\n    readonly DEPTH_ATTACHMENT: number;\n    readonly DEPTH_BITS: number;\n    readonly DEPTH_BUFFER_BIT: number;\n    readonly DEPTH_CLEAR_VALUE: number;\n    readonly DEPTH_COMPONENT: number;\n    readonly DEPTH_COMPONENT16: number;\n    readonly DEPTH_FUNC: number;\n    readonly DEPTH_RANGE: number;\n    readonly DEPTH_STENCIL: number;\n    readonly DEPTH_STENCIL_ATTACHMENT: number;\n    readonly DEPTH_TEST: number;\n    readonly DEPTH_WRITEMASK: number;\n    readonly DITHER: number;\n    readonly DONT_CARE: number;\n    readonly DST_ALPHA: number;\n    readonly DST_COLOR: number;\n    readonly DYNAMIC_DRAW: number;\n    readonly ELEMENT_ARRAY_BUFFER: number;\n    readonly ELEMENT_ARRAY_BUFFER_BINDING: number;\n    readonly EQUAL: number;\n    readonly FASTEST: number;\n    readonly FLOAT: number;\n    readonly FLOAT_MAT2: number;\n    readonly FLOAT_MAT3: number;\n    readonly FLOAT_MAT4: number;\n    readonly FLOAT_VEC2: number;\n    readonly FLOAT_VEC3: number;\n    readonly FLOAT_VEC4: number;\n    readonly FRAGMENT_SHADER: number;\n    readonly FRAMEBUFFER: number;\n    readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number;\n    readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number;\n    readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number;\n    readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number;\n    readonly FRAMEBUFFER_BINDING: number;\n    readonly FRAMEBUFFER_COMPLETE: number;\n    readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number;\n    readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number;\n    readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number;\n    readonly FRAMEBUFFER_UNSUPPORTED: number;\n    readonly FRONT: number;\n    readonly FRONT_AND_BACK: number;\n    readonly FRONT_FACE: number;\n    readonly FUNC_ADD: number;\n    readonly FUNC_REVERSE_SUBTRACT: number;\n    readonly FUNC_SUBTRACT: number;\n    readonly GENERATE_MIPMAP_HINT: number;\n    readonly GEQUAL: number;\n    readonly GREATER: number;\n    readonly GREEN_BITS: number;\n    readonly HIGH_FLOAT: number;\n    readonly HIGH_INT: number;\n    readonly IMPLEMENTATION_COLOR_READ_FORMAT: number;\n    readonly IMPLEMENTATION_COLOR_READ_TYPE: number;\n    readonly INCR: number;\n    readonly INCR_WRAP: number;\n    readonly INT: number;\n    readonly INT_VEC2: number;\n    readonly INT_VEC3: number;\n    readonly INT_VEC4: number;\n    readonly INVALID_ENUM: number;\n    readonly INVALID_FRAMEBUFFER_OPERATION: number;\n    readonly INVALID_OPERATION: number;\n    readonly INVALID_VALUE: number;\n    readonly INVERT: number;\n    readonly KEEP: number;\n    readonly LEQUAL: number;\n    readonly LESS: number;\n    readonly LINEAR: number;\n    readonly LINEAR_MIPMAP_LINEAR: number;\n    readonly LINEAR_MIPMAP_NEAREST: number;\n    readonly LINES: number;\n    readonly LINE_LOOP: number;\n    readonly LINE_STRIP: number;\n    readonly LINE_WIDTH: number;\n    readonly LINK_STATUS: number;\n    readonly LOW_FLOAT: number;\n    readonly LOW_INT: number;\n    readonly LUMINANCE: number;\n    readonly LUMINANCE_ALPHA: number;\n    readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number;\n    readonly MAX_CUBE_MAP_TEXTURE_SIZE: number;\n    readonly MAX_FRAGMENT_UNIFORM_VECTORS: number;\n    readonly MAX_RENDERBUFFER_SIZE: number;\n    readonly MAX_TEXTURE_IMAGE_UNITS: number;\n    readonly MAX_TEXTURE_SIZE: number;\n    readonly MAX_VARYING_VECTORS: number;\n    readonly MAX_VERTEX_ATTRIBS: number;\n    readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number;\n    readonly MAX_VERTEX_UNIFORM_VECTORS: number;\n    readonly MAX_VIEWPORT_DIMS: number;\n    readonly MEDIUM_FLOAT: number;\n    readonly MEDIUM_INT: number;\n    readonly MIRRORED_REPEAT: number;\n    readonly NEAREST: number;\n    readonly NEAREST_MIPMAP_LINEAR: number;\n    readonly NEAREST_MIPMAP_NEAREST: number;\n    readonly NEVER: number;\n    readonly NICEST: number;\n    readonly NONE: number;\n    readonly NOTEQUAL: number;\n    readonly NO_ERROR: number;\n    readonly ONE: number;\n    readonly ONE_MINUS_CONSTANT_ALPHA: number;\n    readonly ONE_MINUS_CONSTANT_COLOR: number;\n    readonly ONE_MINUS_DST_ALPHA: number;\n    readonly ONE_MINUS_DST_COLOR: number;\n    readonly ONE_MINUS_SRC_ALPHA: number;\n    readonly ONE_MINUS_SRC_COLOR: number;\n    readonly OUT_OF_MEMORY: number;\n    readonly PACK_ALIGNMENT: number;\n    readonly POINTS: number;\n    readonly POLYGON_OFFSET_FACTOR: number;\n    readonly POLYGON_OFFSET_FILL: number;\n    readonly POLYGON_OFFSET_UNITS: number;\n    readonly RED_BITS: number;\n    readonly RENDERBUFFER: number;\n    readonly RENDERBUFFER_ALPHA_SIZE: number;\n    readonly RENDERBUFFER_BINDING: number;\n    readonly RENDERBUFFER_BLUE_SIZE: number;\n    readonly RENDERBUFFER_DEPTH_SIZE: number;\n    readonly RENDERBUFFER_GREEN_SIZE: number;\n    readonly RENDERBUFFER_HEIGHT: number;\n    readonly RENDERBUFFER_INTERNAL_FORMAT: number;\n    readonly RENDERBUFFER_RED_SIZE: number;\n    readonly RENDERBUFFER_STENCIL_SIZE: number;\n    readonly RENDERBUFFER_WIDTH: number;\n    readonly RENDERER: number;\n    readonly REPEAT: number;\n    readonly REPLACE: number;\n    readonly RGB: number;\n    readonly RGB565: number;\n    readonly RGB5_A1: number;\n    readonly RGBA: number;\n    readonly RGBA4: number;\n    readonly SAMPLER_2D: number;\n    readonly SAMPLER_CUBE: number;\n    readonly SAMPLES: number;\n    readonly SAMPLE_ALPHA_TO_COVERAGE: number;\n    readonly SAMPLE_BUFFERS: number;\n    readonly SAMPLE_COVERAGE: number;\n    readonly SAMPLE_COVERAGE_INVERT: number;\n    readonly SAMPLE_COVERAGE_VALUE: number;\n    readonly SCISSOR_BOX: number;\n    readonly SCISSOR_TEST: number;\n    readonly SHADER_TYPE: number;\n    readonly SHADING_LANGUAGE_VERSION: number;\n    readonly SHORT: number;\n    readonly SRC_ALPHA: number;\n    readonly SRC_ALPHA_SATURATE: number;\n    readonly SRC_COLOR: number;\n    readonly STATIC_DRAW: number;\n    readonly STENCIL_ATTACHMENT: number;\n    readonly STENCIL_BACK_FAIL: number;\n    readonly STENCIL_BACK_FUNC: number;\n    readonly STENCIL_BACK_PASS_DEPTH_FAIL: number;\n    readonly STENCIL_BACK_PASS_DEPTH_PASS: number;\n    readonly STENCIL_BACK_REF: number;\n    readonly STENCIL_BACK_VALUE_MASK: number;\n    readonly STENCIL_BACK_WRITEMASK: number;\n    readonly STENCIL_BITS: number;\n    readonly STENCIL_BUFFER_BIT: number;\n    readonly STENCIL_CLEAR_VALUE: number;\n    readonly STENCIL_FAIL: number;\n    readonly STENCIL_FUNC: number;\n    readonly STENCIL_INDEX: number;\n    readonly STENCIL_INDEX8: number;\n    readonly STENCIL_PASS_DEPTH_FAIL: number;\n    readonly STENCIL_PASS_DEPTH_PASS: number;\n    readonly STENCIL_REF: number;\n    readonly STENCIL_TEST: number;\n    readonly STENCIL_VALUE_MASK: number;\n    readonly STENCIL_WRITEMASK: number;\n    readonly STREAM_DRAW: number;\n    readonly SUBPIXEL_BITS: number;\n    readonly TEXTURE: number;\n    readonly TEXTURE0: number;\n    readonly TEXTURE1: number;\n    readonly TEXTURE10: number;\n    readonly TEXTURE11: number;\n    readonly TEXTURE12: number;\n    readonly TEXTURE13: number;\n    readonly TEXTURE14: number;\n    readonly TEXTURE15: number;\n    readonly TEXTURE16: number;\n    readonly TEXTURE17: number;\n    readonly TEXTURE18: number;\n    readonly TEXTURE19: number;\n    readonly TEXTURE2: number;\n    readonly TEXTURE20: number;\n    readonly TEXTURE21: number;\n    readonly TEXTURE22: number;\n    readonly TEXTURE23: number;\n    readonly TEXTURE24: number;\n    readonly TEXTURE25: number;\n    readonly TEXTURE26: number;\n    readonly TEXTURE27: number;\n    readonly TEXTURE28: number;\n    readonly TEXTURE29: number;\n    readonly TEXTURE3: number;\n    readonly TEXTURE30: number;\n    readonly TEXTURE31: number;\n    readonly TEXTURE4: number;\n    readonly TEXTURE5: number;\n    readonly TEXTURE6: number;\n    readonly TEXTURE7: number;\n    readonly TEXTURE8: number;\n    readonly TEXTURE9: number;\n    readonly TEXTURE_2D: number;\n    readonly TEXTURE_BINDING_2D: number;\n    readonly TEXTURE_BINDING_CUBE_MAP: number;\n    readonly TEXTURE_CUBE_MAP: number;\n    readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number;\n    readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number;\n    readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number;\n    readonly TEXTURE_CUBE_MAP_POSITIVE_X: number;\n    readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number;\n    readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number;\n    readonly TEXTURE_MAG_FILTER: number;\n    readonly TEXTURE_MIN_FILTER: number;\n    readonly TEXTURE_WRAP_S: number;\n    readonly TEXTURE_WRAP_T: number;\n    readonly TRIANGLES: number;\n    readonly TRIANGLE_FAN: number;\n    readonly TRIANGLE_STRIP: number;\n    readonly UNPACK_ALIGNMENT: number;\n    readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number;\n    readonly UNPACK_FLIP_Y_WEBGL: number;\n    readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number;\n    readonly UNSIGNED_BYTE: number;\n    readonly UNSIGNED_INT: number;\n    readonly UNSIGNED_SHORT: number;\n    readonly UNSIGNED_SHORT_4_4_4_4: number;\n    readonly UNSIGNED_SHORT_5_5_5_1: number;\n    readonly UNSIGNED_SHORT_5_6_5: number;\n    readonly VALIDATE_STATUS: number;\n    readonly VENDOR: number;\n    readonly VERSION: number;\n    readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number;\n    readonly VERTEX_ATTRIB_ARRAY_ENABLED: number;\n    readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number;\n    readonly VERTEX_ATTRIB_ARRAY_POINTER: number;\n    readonly VERTEX_ATTRIB_ARRAY_SIZE: number;\n    readonly VERTEX_ATTRIB_ARRAY_STRIDE: number;\n    readonly VERTEX_ATTRIB_ARRAY_TYPE: number;\n    readonly VERTEX_SHADER: number;\n    readonly VIEWPORT: number;\n    readonly ZERO: number;\n}\n\ninterface WebGLShader extends WebGLObject {\n}\n\ndeclare var WebGLShader: {\n    prototype: WebGLShader;\n    new(): WebGLShader;\n}\n\ninterface WebGLShaderPrecisionFormat {\n    readonly precision: number;\n    readonly rangeMax: number;\n    readonly rangeMin: number;\n}\n\ndeclare var WebGLShaderPrecisionFormat: {\n    prototype: WebGLShaderPrecisionFormat;\n    new(): WebGLShaderPrecisionFormat;\n}\n\ninterface WebGLTexture extends WebGLObject {\n}\n\ndeclare var WebGLTexture: {\n    prototype: WebGLTexture;\n    new(): WebGLTexture;\n}\n\ninterface WebGLUniformLocation {\n}\n\ndeclare var WebGLUniformLocation: {\n    prototype: WebGLUniformLocation;\n    new(): WebGLUniformLocation;\n}\n\ninterface WebKitCSSMatrix {\n    a: number;\n    b: number;\n    c: number;\n    d: number;\n    e: number;\n    f: number;\n    m11: number;\n    m12: number;\n    m13: number;\n    m14: number;\n    m21: number;\n    m22: number;\n    m23: number;\n    m24: number;\n    m31: number;\n    m32: number;\n    m33: number;\n    m34: number;\n    m41: number;\n    m42: number;\n    m43: number;\n    m44: number;\n    inverse(): WebKitCSSMatrix;\n    multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix;\n    rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix;\n    rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix;\n    scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix;\n    setMatrixValue(value: string): void;\n    skewX(angle: number): WebKitCSSMatrix;\n    skewY(angle: number): WebKitCSSMatrix;\n    toString(): string;\n    translate(x: number, y: number, z?: number): WebKitCSSMatrix;\n}\n\ndeclare var WebKitCSSMatrix: {\n    prototype: WebKitCSSMatrix;\n    new(text?: string): WebKitCSSMatrix;\n}\n\ninterface WebKitPoint {\n    x: number;\n    y: number;\n}\n\ndeclare var WebKitPoint: {\n    prototype: WebKitPoint;\n    new(x?: number, y?: number): WebKitPoint;\n}\n\ninterface WebSocketEventMap {\n    \"close\": CloseEvent;\n    \"error\": ErrorEvent;\n    \"message\": MessageEvent;\n    \"open\": Event;\n}\n\ninterface WebSocket extends EventTarget {\n    binaryType: string;\n    readonly bufferedAmount: number;\n    readonly extensions: string;\n    onclose: (this: WebSocket, ev: CloseEvent) => any;\n    onerror: (this: WebSocket, ev: ErrorEvent) => any;\n    onmessage: (this: WebSocket, ev: MessageEvent) => any;\n    onopen: (this: WebSocket, ev: Event) => any;\n    readonly protocol: string;\n    readonly readyState: number;\n    readonly url: string;\n    close(code?: number, reason?: string): void;\n    send(data: any): void;\n    readonly CLOSED: number;\n    readonly CLOSING: number;\n    readonly CONNECTING: number;\n    readonly OPEN: number;\n    addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var WebSocket: {\n    prototype: WebSocket;\n    new(url: string, protocols?: string | string[]): WebSocket;\n    readonly CLOSED: number;\n    readonly CLOSING: number;\n    readonly CONNECTING: number;\n    readonly OPEN: number;\n}\n\ninterface WheelEvent extends MouseEvent {\n    readonly deltaMode: number;\n    readonly deltaX: number;\n    readonly deltaY: number;\n    readonly deltaZ: number;\n    readonly wheelDelta: number;\n    readonly wheelDeltaX: number;\n    readonly wheelDeltaY: number;\n    getCurrentPoint(element: Element): void;\n    initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void;\n    readonly DOM_DELTA_LINE: number;\n    readonly DOM_DELTA_PAGE: number;\n    readonly DOM_DELTA_PIXEL: number;\n}\n\ndeclare var WheelEvent: {\n    prototype: WheelEvent;\n    new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent;\n    readonly DOM_DELTA_LINE: number;\n    readonly DOM_DELTA_PAGE: number;\n    readonly DOM_DELTA_PIXEL: number;\n}\n\ninterface WindowEventMap extends GlobalEventHandlersEventMap {\n    \"abort\": UIEvent;\n    \"afterprint\": Event;\n    \"beforeprint\": Event;\n    \"beforeunload\": BeforeUnloadEvent;\n    \"blur\": FocusEvent;\n    \"canplay\": Event;\n    \"canplaythrough\": Event;\n    \"change\": Event;\n    \"click\": MouseEvent;\n    \"compassneedscalibration\": Event;\n    \"contextmenu\": PointerEvent;\n    \"dblclick\": MouseEvent;\n    \"devicelight\": DeviceLightEvent;\n    \"devicemotion\": DeviceMotionEvent;\n    \"deviceorientation\": DeviceOrientationEvent;\n    \"drag\": DragEvent;\n    \"dragend\": DragEvent;\n    \"dragenter\": DragEvent;\n    \"dragleave\": DragEvent;\n    \"dragover\": DragEvent;\n    \"dragstart\": DragEvent;\n    \"drop\": DragEvent;\n    \"durationchange\": Event;\n    \"emptied\": Event;\n    \"ended\": MediaStreamErrorEvent;\n    \"focus\": FocusEvent;\n    \"hashchange\": HashChangeEvent;\n    \"input\": Event;\n    \"invalid\": Event;\n    \"keydown\": KeyboardEvent;\n    \"keypress\": KeyboardEvent;\n    \"keyup\": KeyboardEvent;\n    \"load\": Event;\n    \"loadeddata\": Event;\n    \"loadedmetadata\": Event;\n    \"loadstart\": Event;\n    \"message\": MessageEvent;\n    \"mousedown\": MouseEvent;\n    \"mouseenter\": MouseEvent;\n    \"mouseleave\": MouseEvent;\n    \"mousemove\": MouseEvent;\n    \"mouseout\": MouseEvent;\n    \"mouseover\": MouseEvent;\n    \"mouseup\": MouseEvent;\n    \"mousewheel\": WheelEvent;\n    \"MSGestureChange\": MSGestureEvent;\n    \"MSGestureDoubleTap\": MSGestureEvent;\n    \"MSGestureEnd\": MSGestureEvent;\n    \"MSGestureHold\": MSGestureEvent;\n    \"MSGestureStart\": MSGestureEvent;\n    \"MSGestureTap\": MSGestureEvent;\n    \"MSInertiaStart\": MSGestureEvent;\n    \"MSPointerCancel\": MSPointerEvent;\n    \"MSPointerDown\": MSPointerEvent;\n    \"MSPointerEnter\": MSPointerEvent;\n    \"MSPointerLeave\": MSPointerEvent;\n    \"MSPointerMove\": MSPointerEvent;\n    \"MSPointerOut\": MSPointerEvent;\n    \"MSPointerOver\": MSPointerEvent;\n    \"MSPointerUp\": MSPointerEvent;\n    \"offline\": Event;\n    \"online\": Event;\n    \"orientationchange\": Event;\n    \"pagehide\": PageTransitionEvent;\n    \"pageshow\": PageTransitionEvent;\n    \"pause\": Event;\n    \"play\": Event;\n    \"playing\": Event;\n    \"popstate\": PopStateEvent;\n    \"progress\": ProgressEvent;\n    \"ratechange\": Event;\n    \"readystatechange\": ProgressEvent;\n    \"reset\": Event;\n    \"resize\": UIEvent;\n    \"scroll\": UIEvent;\n    \"seeked\": Event;\n    \"seeking\": Event;\n    \"select\": UIEvent;\n    \"stalled\": Event;\n    \"storage\": StorageEvent;\n    \"submit\": Event;\n    \"suspend\": Event;\n    \"timeupdate\": Event;\n    \"unload\": Event;\n    \"volumechange\": Event;\n    \"waiting\": Event;\n}\n\ninterface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 {\n    readonly applicationCache: ApplicationCache;\n    readonly clientInformation: Navigator;\n    readonly closed: boolean;\n    readonly crypto: Crypto;\n    defaultStatus: string;\n    readonly devicePixelRatio: number;\n    readonly doNotTrack: string;\n    readonly document: Document;\n    event: Event | undefined;\n    readonly external: External;\n    readonly frameElement: Element;\n    readonly frames: Window;\n    readonly history: History;\n    readonly innerHeight: number;\n    readonly innerWidth: number;\n    readonly length: number;\n    readonly location: Location;\n    readonly locationbar: BarProp;\n    readonly menubar: BarProp;\n    readonly msCredentials: MSCredentials;\n    name: string;\n    readonly navigator: Navigator;\n    offscreenBuffering: string | boolean;\n    onabort: (this: Window, ev: UIEvent) => any;\n    onafterprint: (this: Window, ev: Event) => any;\n    onbeforeprint: (this: Window, ev: Event) => any;\n    onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any;\n    onblur: (this: Window, ev: FocusEvent) => any;\n    oncanplay: (this: Window, ev: Event) => any;\n    oncanplaythrough: (this: Window, ev: Event) => any;\n    onchange: (this: Window, ev: Event) => any;\n    onclick: (this: Window, ev: MouseEvent) => any;\n    oncompassneedscalibration: (this: Window, ev: Event) => any;\n    oncontextmenu: (this: Window, ev: PointerEvent) => any;\n    ondblclick: (this: Window, ev: MouseEvent) => any;\n    ondevicelight: (this: Window, ev: DeviceLightEvent) => any;\n    ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any;\n    ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any;\n    ondrag: (this: Window, ev: DragEvent) => any;\n    ondragend: (this: Window, ev: DragEvent) => any;\n    ondragenter: (this: Window, ev: DragEvent) => any;\n    ondragleave: (this: Window, ev: DragEvent) => any;\n    ondragover: (this: Window, ev: DragEvent) => any;\n    ondragstart: (this: Window, ev: DragEvent) => any;\n    ondrop: (this: Window, ev: DragEvent) => any;\n    ondurationchange: (this: Window, ev: Event) => any;\n    onemptied: (this: Window, ev: Event) => any;\n    onended: (this: Window, ev: MediaStreamErrorEvent) => any;\n    onerror: ErrorEventHandler;\n    onfocus: (this: Window, ev: FocusEvent) => any;\n    onhashchange: (this: Window, ev: HashChangeEvent) => any;\n    oninput: (this: Window, ev: Event) => any;\n    oninvalid: (this: Window, ev: Event) => any;\n    onkeydown: (this: Window, ev: KeyboardEvent) => any;\n    onkeypress: (this: Window, ev: KeyboardEvent) => any;\n    onkeyup: (this: Window, ev: KeyboardEvent) => any;\n    onload: (this: Window, ev: Event) => any;\n    onloadeddata: (this: Window, ev: Event) => any;\n    onloadedmetadata: (this: Window, ev: Event) => any;\n    onloadstart: (this: Window, ev: Event) => any;\n    onmessage: (this: Window, ev: MessageEvent) => any;\n    onmousedown: (this: Window, ev: MouseEvent) => any;\n    onmouseenter: (this: Window, ev: MouseEvent) => any;\n    onmouseleave: (this: Window, ev: MouseEvent) => any;\n    onmousemove: (this: Window, ev: MouseEvent) => any;\n    onmouseout: (this: Window, ev: MouseEvent) => any;\n    onmouseover: (this: Window, ev: MouseEvent) => any;\n    onmouseup: (this: Window, ev: MouseEvent) => any;\n    onmousewheel: (this: Window, ev: WheelEvent) => any;\n    onmsgesturechange: (this: Window, ev: MSGestureEvent) => any;\n    onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any;\n    onmsgestureend: (this: Window, ev: MSGestureEvent) => any;\n    onmsgesturehold: (this: Window, ev: MSGestureEvent) => any;\n    onmsgesturestart: (this: Window, ev: MSGestureEvent) => any;\n    onmsgesturetap: (this: Window, ev: MSGestureEvent) => any;\n    onmsinertiastart: (this: Window, ev: MSGestureEvent) => any;\n    onmspointercancel: (this: Window, ev: MSPointerEvent) => any;\n    onmspointerdown: (this: Window, ev: MSPointerEvent) => any;\n    onmspointerenter: (this: Window, ev: MSPointerEvent) => any;\n    onmspointerleave: (this: Window, ev: MSPointerEvent) => any;\n    onmspointermove: (this: Window, ev: MSPointerEvent) => any;\n    onmspointerout: (this: Window, ev: MSPointerEvent) => any;\n    onmspointerover: (this: Window, ev: MSPointerEvent) => any;\n    onmspointerup: (this: Window, ev: MSPointerEvent) => any;\n    onoffline: (this: Window, ev: Event) => any;\n    ononline: (this: Window, ev: Event) => any;\n    onorientationchange: (this: Window, ev: Event) => any;\n    onpagehide: (this: Window, ev: PageTransitionEvent) => any;\n    onpageshow: (this: Window, ev: PageTransitionEvent) => any;\n    onpause: (this: Window, ev: Event) => any;\n    onplay: (this: Window, ev: Event) => any;\n    onplaying: (this: Window, ev: Event) => any;\n    onpopstate: (this: Window, ev: PopStateEvent) => any;\n    onprogress: (this: Window, ev: ProgressEvent) => any;\n    onratechange: (this: Window, ev: Event) => any;\n    onreadystatechange: (this: Window, ev: ProgressEvent) => any;\n    onreset: (this: Window, ev: Event) => any;\n    onresize: (this: Window, ev: UIEvent) => any;\n    onscroll: (this: Window, ev: UIEvent) => any;\n    onseeked: (this: Window, ev: Event) => any;\n    onseeking: (this: Window, ev: Event) => any;\n    onselect: (this: Window, ev: UIEvent) => any;\n    onstalled: (this: Window, ev: Event) => any;\n    onstorage: (this: Window, ev: StorageEvent) => any;\n    onsubmit: (this: Window, ev: Event) => any;\n    onsuspend: (this: Window, ev: Event) => any;\n    ontimeupdate: (this: Window, ev: Event) => any;\n    ontouchcancel: (ev: TouchEvent) => any;\n    ontouchend: (ev: TouchEvent) => any;\n    ontouchmove: (ev: TouchEvent) => any;\n    ontouchstart: (ev: TouchEvent) => any;\n    onunload: (this: Window, ev: Event) => any;\n    onvolumechange: (this: Window, ev: Event) => any;\n    onwaiting: (this: Window, ev: Event) => any;\n    opener: any;\n    orientation: string | number;\n    readonly outerHeight: number;\n    readonly outerWidth: number;\n    readonly pageXOffset: number;\n    readonly pageYOffset: number;\n    readonly parent: Window;\n    readonly performance: Performance;\n    readonly personalbar: BarProp;\n    readonly screen: Screen;\n    readonly screenLeft: number;\n    readonly screenTop: number;\n    readonly screenX: number;\n    readonly screenY: number;\n    readonly scrollX: number;\n    readonly scrollY: number;\n    readonly scrollbars: BarProp;\n    readonly self: Window;\n    status: string;\n    readonly statusbar: BarProp;\n    readonly styleMedia: StyleMedia;\n    readonly toolbar: BarProp;\n    readonly top: Window;\n    readonly window: Window;\n    URL: typeof URL;\n    Blob: typeof Blob;\n    alert(message?: any): void;\n    blur(): void;\n    cancelAnimationFrame(handle: number): void;\n    captureEvents(): void;\n    close(): void;\n    confirm(message?: string): boolean;\n    focus(): void;\n    getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\n    getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList;\n    getSelection(): Selection;\n    matchMedia(mediaQuery: string): MediaQueryList;\n    moveBy(x?: number, y?: number): void;\n    moveTo(x?: number, y?: number): void;\n    msWriteProfilerMark(profilerMarkName: string): void;\n    open(url?: string, target?: string, features?: string, replace?: boolean): Window;\n    postMessage(message: any, targetOrigin: string, transfer?: any[]): void;\n    print(): void;\n    prompt(message?: string, _default?: string): string | null;\n    releaseEvents(): void;\n    requestAnimationFrame(callback: FrameRequestCallback): number;\n    resizeBy(x?: number, y?: number): void;\n    resizeTo(x?: number, y?: number): void;\n    scroll(x?: number, y?: number): void;\n    scrollBy(x?: number, y?: number): void;\n    scrollTo(x?: number, y?: number): void;\n    webkitCancelAnimationFrame(handle: number): void;\n    webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;\n    webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;\n    webkitRequestAnimationFrame(callback: FrameRequestCallback): number;\n    scroll(options?: ScrollToOptions): void;\n    scrollTo(options?: ScrollToOptions): void;\n    scrollBy(options?: ScrollToOptions): void;\n    addEventListener<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Window: {\n    prototype: Window;\n    new(): Window;\n}\n\ninterface WorkerEventMap extends AbstractWorkerEventMap {\n    \"message\": MessageEvent;\n}\n\ninterface Worker extends EventTarget, AbstractWorker {\n    onmessage: (this: Worker, ev: MessageEvent) => any;\n    postMessage(message: any, ports?: any): void;\n    terminate(): void;\n    addEventListener<K extends keyof WorkerEventMap>(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Worker: {\n    prototype: Worker;\n    new(stringUrl: string): Worker;\n}\n\ninterface XMLDocument extends Document {\n    addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var XMLDocument: {\n    prototype: XMLDocument;\n    new(): XMLDocument;\n}\n\ninterface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap {\n    \"readystatechange\": Event;\n}\n\ninterface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {\n    onreadystatechange: (this: XMLHttpRequest, ev: Event) => any;\n    readonly readyState: number;\n    readonly response: any;\n    readonly responseText: string;\n    responseType: string;\n    readonly responseXML: any;\n    readonly status: number;\n    readonly statusText: string;\n    timeout: number;\n    readonly upload: XMLHttpRequestUpload;\n    withCredentials: boolean;\n    msCaching?: string;\n    readonly responseURL: string;\n    abort(): void;\n    getAllResponseHeaders(): string;\n    getResponseHeader(header: string): string | null;\n    msCachingEnabled(): boolean;\n    open(method: string, url: string, async?: boolean, user?: string, password?: string): void;\n    overrideMimeType(mime: string): void;\n    send(data?: Document): void;\n    send(data?: string): void;\n    send(data?: any): void;\n    setRequestHeader(header: string, value: string): void;\n    readonly DONE: number;\n    readonly HEADERS_RECEIVED: number;\n    readonly LOADING: number;\n    readonly OPENED: number;\n    readonly UNSENT: number;\n    addEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var XMLHttpRequest: {\n    prototype: XMLHttpRequest;\n    new(): XMLHttpRequest;\n    readonly DONE: number;\n    readonly HEADERS_RECEIVED: number;\n    readonly LOADING: number;\n    readonly OPENED: number;\n    readonly UNSENT: number;\n    create(): XMLHttpRequest;\n}\n\ninterface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {\n    addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var XMLHttpRequestUpload: {\n    prototype: XMLHttpRequestUpload;\n    new(): XMLHttpRequestUpload;\n}\n\ninterface XMLSerializer {\n    serializeToString(target: Node): string;\n}\n\ndeclare var XMLSerializer: {\n    prototype: XMLSerializer;\n    new(): XMLSerializer;\n}\n\ninterface XPathEvaluator {\n    createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;\n    createNSResolver(nodeResolver?: Node): XPathNSResolver;\n    evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult;\n}\n\ndeclare var XPathEvaluator: {\n    prototype: XPathEvaluator;\n    new(): XPathEvaluator;\n}\n\ninterface XPathExpression {\n    evaluate(contextNode: Node, type: number, result: XPathResult | null): XPathResult;\n}\n\ndeclare var XPathExpression: {\n    prototype: XPathExpression;\n    new(): XPathExpression;\n}\n\ninterface XPathNSResolver {\n    lookupNamespaceURI(prefix: string): string;\n}\n\ndeclare var XPathNSResolver: {\n    prototype: XPathNSResolver;\n    new(): XPathNSResolver;\n}\n\ninterface XPathResult {\n    readonly booleanValue: boolean;\n    readonly invalidIteratorState: boolean;\n    readonly numberValue: number;\n    readonly resultType: number;\n    readonly singleNodeValue: Node;\n    readonly snapshotLength: number;\n    readonly stringValue: string;\n    iterateNext(): Node;\n    snapshotItem(index: number): Node;\n    readonly ANY_TYPE: number;\n    readonly ANY_UNORDERED_NODE_TYPE: number;\n    readonly BOOLEAN_TYPE: number;\n    readonly FIRST_ORDERED_NODE_TYPE: number;\n    readonly NUMBER_TYPE: number;\n    readonly ORDERED_NODE_ITERATOR_TYPE: number;\n    readonly ORDERED_NODE_SNAPSHOT_TYPE: number;\n    readonly STRING_TYPE: number;\n    readonly UNORDERED_NODE_ITERATOR_TYPE: number;\n    readonly UNORDERED_NODE_SNAPSHOT_TYPE: number;\n}\n\ndeclare var XPathResult: {\n    prototype: XPathResult;\n    new(): XPathResult;\n    readonly ANY_TYPE: number;\n    readonly ANY_UNORDERED_NODE_TYPE: number;\n    readonly BOOLEAN_TYPE: number;\n    readonly FIRST_ORDERED_NODE_TYPE: number;\n    readonly NUMBER_TYPE: number;\n    readonly ORDERED_NODE_ITERATOR_TYPE: number;\n    readonly ORDERED_NODE_SNAPSHOT_TYPE: number;\n    readonly STRING_TYPE: number;\n    readonly UNORDERED_NODE_ITERATOR_TYPE: number;\n    readonly UNORDERED_NODE_SNAPSHOT_TYPE: number;\n}\n\ninterface XSLTProcessor {\n    clearParameters(): void;\n    getParameter(namespaceURI: string, localName: string): any;\n    importStylesheet(style: Node): void;\n    removeParameter(namespaceURI: string, localName: string): void;\n    reset(): void;\n    setParameter(namespaceURI: string, localName: string, value: any): void;\n    transformToDocument(source: Node): Document;\n    transformToFragment(source: Node, document: Document): DocumentFragment;\n}\n\ndeclare var XSLTProcessor: {\n    prototype: XSLTProcessor;\n    new(): XSLTProcessor;\n}\n\ninterface AbstractWorkerEventMap {\n    \"error\": ErrorEvent;\n}\n\ninterface AbstractWorker {\n    onerror: (this: AbstractWorker, ev: ErrorEvent) => any;\n    addEventListener<K extends keyof AbstractWorkerEventMap>(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ninterface CanvasPathMethods {\n    arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\n    arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;\n    bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;\n    closePath(): void;\n    ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\n    lineTo(x: number, y: number): void;\n    moveTo(x: number, y: number): void;\n    quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;\n    rect(x: number, y: number, w: number, h: number): void;\n}\n\ninterface ChildNode {\n    remove(): void;\n}\n\ninterface DOML2DeprecatedColorProperty {\n    color: string;\n}\n\ninterface DOML2DeprecatedSizeProperty {\n    size: number;\n}\n\ninterface DocumentEvent {\n    createEvent(eventInterface:\"AnimationEvent\"): AnimationEvent;\n    createEvent(eventInterface:\"AriaRequestEvent\"): AriaRequestEvent;\n    createEvent(eventInterface:\"AudioProcessingEvent\"): AudioProcessingEvent;\n    createEvent(eventInterface:\"BeforeUnloadEvent\"): BeforeUnloadEvent;\n    createEvent(eventInterface:\"ClipboardEvent\"): ClipboardEvent;\n    createEvent(eventInterface:\"CloseEvent\"): CloseEvent;\n    createEvent(eventInterface:\"CommandEvent\"): CommandEvent;\n    createEvent(eventInterface:\"CompositionEvent\"): CompositionEvent;\n    createEvent(eventInterface:\"CustomEvent\"): CustomEvent;\n    createEvent(eventInterface:\"DeviceLightEvent\"): DeviceLightEvent;\n    createEvent(eventInterface:\"DeviceMotionEvent\"): DeviceMotionEvent;\n    createEvent(eventInterface:\"DeviceOrientationEvent\"): DeviceOrientationEvent;\n    createEvent(eventInterface:\"DragEvent\"): DragEvent;\n    createEvent(eventInterface:\"ErrorEvent\"): ErrorEvent;\n    createEvent(eventInterface:\"Event\"): Event;\n    createEvent(eventInterface:\"Events\"): Event;\n    createEvent(eventInterface:\"FocusEvent\"): FocusEvent;\n    createEvent(eventInterface:\"GamepadEvent\"): GamepadEvent;\n    createEvent(eventInterface:\"HashChangeEvent\"): HashChangeEvent;\n    createEvent(eventInterface:\"IDBVersionChangeEvent\"): IDBVersionChangeEvent;\n    createEvent(eventInterface:\"KeyboardEvent\"): KeyboardEvent;\n    createEvent(eventInterface:\"ListeningStateChangedEvent\"): ListeningStateChangedEvent;\n    createEvent(eventInterface:\"LongRunningScriptDetectedEvent\"): LongRunningScriptDetectedEvent;\n    createEvent(eventInterface:\"MSGestureEvent\"): MSGestureEvent;\n    createEvent(eventInterface:\"MSManipulationEvent\"): MSManipulationEvent;\n    createEvent(eventInterface:\"MSMediaKeyMessageEvent\"): MSMediaKeyMessageEvent;\n    createEvent(eventInterface:\"MSMediaKeyNeededEvent\"): MSMediaKeyNeededEvent;\n    createEvent(eventInterface:\"MSPointerEvent\"): MSPointerEvent;\n    createEvent(eventInterface:\"MSSiteModeEvent\"): MSSiteModeEvent;\n    createEvent(eventInterface:\"MediaEncryptedEvent\"): MediaEncryptedEvent;\n    createEvent(eventInterface:\"MediaKeyMessageEvent\"): MediaKeyMessageEvent;\n    createEvent(eventInterface:\"MediaStreamErrorEvent\"): MediaStreamErrorEvent;\n    createEvent(eventInterface:\"MediaStreamTrackEvent\"): MediaStreamTrackEvent;\n    createEvent(eventInterface:\"MessageEvent\"): MessageEvent;\n    createEvent(eventInterface:\"MouseEvent\"): MouseEvent;\n    createEvent(eventInterface:\"MouseEvents\"): MouseEvent;\n    createEvent(eventInterface:\"MutationEvent\"): MutationEvent;\n    createEvent(eventInterface:\"MutationEvents\"): MutationEvent;\n    createEvent(eventInterface:\"NavigationCompletedEvent\"): NavigationCompletedEvent;\n    createEvent(eventInterface:\"NavigationEvent\"): NavigationEvent;\n    createEvent(eventInterface:\"NavigationEventWithReferrer\"): NavigationEventWithReferrer;\n    createEvent(eventInterface:\"OfflineAudioCompletionEvent\"): OfflineAudioCompletionEvent;\n    createEvent(eventInterface:\"OverflowEvent\"): OverflowEvent;\n    createEvent(eventInterface:\"PageTransitionEvent\"): PageTransitionEvent;\n    createEvent(eventInterface:\"PermissionRequestedEvent\"): PermissionRequestedEvent;\n    createEvent(eventInterface:\"PointerEvent\"): PointerEvent;\n    createEvent(eventInterface:\"PopStateEvent\"): PopStateEvent;\n    createEvent(eventInterface:\"ProgressEvent\"): ProgressEvent;\n    createEvent(eventInterface:\"RTCDTMFToneChangeEvent\"): RTCDTMFToneChangeEvent;\n    createEvent(eventInterface:\"RTCDtlsTransportStateChangedEvent\"): RTCDtlsTransportStateChangedEvent;\n    createEvent(eventInterface:\"RTCIceCandidatePairChangedEvent\"): RTCIceCandidatePairChangedEvent;\n    createEvent(eventInterface:\"RTCIceGathererEvent\"): RTCIceGathererEvent;\n    createEvent(eventInterface:\"RTCIceTransportStateChangedEvent\"): RTCIceTransportStateChangedEvent;\n    createEvent(eventInterface:\"RTCSsrcConflictEvent\"): RTCSsrcConflictEvent;\n    createEvent(eventInterface:\"SVGZoomEvent\"): SVGZoomEvent;\n    createEvent(eventInterface:\"SVGZoomEvents\"): SVGZoomEvent;\n    createEvent(eventInterface:\"ScriptNotifyEvent\"): ScriptNotifyEvent;\n    createEvent(eventInterface:\"StorageEvent\"): StorageEvent;\n    createEvent(eventInterface:\"TextEvent\"): TextEvent;\n    createEvent(eventInterface:\"TouchEvent\"): TouchEvent;\n    createEvent(eventInterface:\"TrackEvent\"): TrackEvent;\n    createEvent(eventInterface:\"TransitionEvent\"): TransitionEvent;\n    createEvent(eventInterface:\"UIEvent\"): UIEvent;\n    createEvent(eventInterface:\"UIEvents\"): UIEvent;\n    createEvent(eventInterface:\"UnviewableContentIdentifiedEvent\"): UnviewableContentIdentifiedEvent;\n    createEvent(eventInterface:\"WebGLContextEvent\"): WebGLContextEvent;\n    createEvent(eventInterface:\"WheelEvent\"): WheelEvent;\n    createEvent(eventInterface: string): Event;\n}\n\ninterface ElementTraversal {\n    readonly childElementCount: number;\n    readonly firstElementChild: Element;\n    readonly lastElementChild: Element;\n    readonly nextElementSibling: Element;\n    readonly previousElementSibling: Element;\n}\n\ninterface GetSVGDocument {\n    getSVGDocument(): Document;\n}\n\ninterface GlobalEventHandlersEventMap {\n    \"pointercancel\": PointerEvent;\n    \"pointerdown\": PointerEvent;\n    \"pointerenter\": PointerEvent;\n    \"pointerleave\": PointerEvent;\n    \"pointermove\": PointerEvent;\n    \"pointerout\": PointerEvent;\n    \"pointerover\": PointerEvent;\n    \"pointerup\": PointerEvent;\n    \"wheel\": WheelEvent;\n}\n\ninterface GlobalEventHandlers {\n    onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n    onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n    onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n    onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n    onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n    onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n    onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n    onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n    onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any;\n    addEventListener<K extends keyof GlobalEventHandlersEventMap>(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ninterface HTMLTableAlignment {\n    /**\n      * Sets or retrieves a value that you can use to implement your own ch functionality for the object.\n      */\n    ch: string;\n    /**\n      * Sets or retrieves a value that you can use to implement your own chOff functionality for the object.\n      */\n    chOff: string;\n    /**\n      * Sets or retrieves how text and other content are vertically aligned within the object that contains them.\n      */\n    vAlign: string;\n}\n\ninterface IDBEnvironment {\n    readonly indexedDB: IDBFactory;\n}\n\ninterface LinkStyle {\n    readonly sheet: StyleSheet;\n}\n\ninterface MSBaseReaderEventMap {\n    \"abort\": Event;\n    \"error\": ErrorEvent;\n    \"load\": Event;\n    \"loadend\": ProgressEvent;\n    \"loadstart\": Event;\n    \"progress\": ProgressEvent;\n}\n\ninterface MSBaseReader {\n    onabort: (this: MSBaseReader, ev: Event) => any;\n    onerror: (this: MSBaseReader, ev: ErrorEvent) => any;\n    onload: (this: MSBaseReader, ev: Event) => any;\n    onloadend: (this: MSBaseReader, ev: ProgressEvent) => any;\n    onloadstart: (this: MSBaseReader, ev: Event) => any;\n    onprogress: (this: MSBaseReader, ev: ProgressEvent) => any;\n    readonly readyState: number;\n    readonly result: any;\n    abort(): void;\n    readonly DONE: number;\n    readonly EMPTY: number;\n    readonly LOADING: number;\n    addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ninterface MSFileSaver {\n    msSaveBlob(blob: any, defaultName?: string): boolean;\n    msSaveOrOpenBlob(blob: any, defaultName?: string): boolean;\n}\n\ninterface MSNavigatorDoNotTrack {\n    confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean;\n    confirmWebWideTrackingException(args: ExceptionInformation): boolean;\n    removeSiteSpecificTrackingException(args: ExceptionInformation): void;\n    removeWebWideTrackingException(args: ExceptionInformation): void;\n    storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void;\n    storeWebWideTrackingException(args: StoreExceptionsInformation): void;\n}\n\ninterface NavigatorContentUtils {\n}\n\ninterface NavigatorGeolocation {\n    readonly geolocation: Geolocation;\n}\n\ninterface NavigatorID {\n    readonly appName: string;\n    readonly appVersion: string;\n    readonly platform: string;\n    readonly product: string;\n    readonly productSub: string;\n    readonly userAgent: string;\n    readonly vendor: string;\n    readonly vendorSub: string;\n}\n\ninterface NavigatorOnLine {\n    readonly onLine: boolean;\n}\n\ninterface NavigatorStorageUtils {\n}\n\ninterface NavigatorUserMedia {\n    readonly mediaDevices: MediaDevices;\n    getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;\n}\n\ninterface NodeSelector {\n    querySelector<K extends keyof ElementTagNameMap>(selectors: K): ElementTagNameMap[K] | null;\n    querySelector(selectors: string): Element | null;\n    querySelectorAll<K extends keyof ElementListTagNameMap>(selectors: K): ElementListTagNameMap[K];\n    querySelectorAll(selectors: string): NodeListOf<Element>;\n}\n\ninterface RandomSource {\n    getRandomValues(array: ArrayBufferView): ArrayBufferView;\n}\n\ninterface SVGAnimatedPathData {\n    readonly pathSegList: SVGPathSegList;\n}\n\ninterface SVGAnimatedPoints {\n    readonly animatedPoints: SVGPointList;\n    readonly points: SVGPointList;\n}\n\ninterface SVGExternalResourcesRequired {\n    readonly externalResourcesRequired: SVGAnimatedBoolean;\n}\n\ninterface SVGFilterPrimitiveStandardAttributes extends SVGStylable {\n    readonly height: SVGAnimatedLength;\n    readonly result: SVGAnimatedString;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n}\n\ninterface SVGFitToViewBox {\n    readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\n    readonly viewBox: SVGAnimatedRect;\n}\n\ninterface SVGLangSpace {\n    xmllang: string;\n    xmlspace: string;\n}\n\ninterface SVGLocatable {\n    readonly farthestViewportElement: SVGElement;\n    readonly nearestViewportElement: SVGElement;\n    getBBox(): SVGRect;\n    getCTM(): SVGMatrix;\n    getScreenCTM(): SVGMatrix;\n    getTransformToElement(element: SVGElement): SVGMatrix;\n}\n\ninterface SVGStylable {\n    className: any;\n    readonly style: CSSStyleDeclaration;\n}\n\ninterface SVGTests {\n    readonly requiredExtensions: SVGStringList;\n    readonly requiredFeatures: SVGStringList;\n    readonly systemLanguage: SVGStringList;\n    hasExtension(extension: string): boolean;\n}\n\ninterface SVGTransformable extends SVGLocatable {\n    readonly transform: SVGAnimatedTransformList;\n}\n\ninterface SVGURIReference {\n    readonly href: SVGAnimatedString;\n}\n\ninterface WindowBase64 {\n    atob(encodedString: string): string;\n    btoa(rawString: string): string;\n}\n\ninterface WindowConsole {\n    readonly console: Console;\n}\n\ninterface WindowLocalStorage {\n    readonly localStorage: Storage;\n}\n\ninterface WindowSessionStorage {\n    readonly sessionStorage: Storage;\n}\n\ninterface WindowTimers extends Object, WindowTimersExtension {\n    clearInterval(handle: number): void;\n    clearTimeout(handle: number): void;\n    setInterval(handler: (...args: any[]) => void, timeout: number): number;\n    setInterval(handler: any, timeout?: any, ...args: any[]): number;\n    setTimeout(handler: (...args: any[]) => void, timeout: number): number;\n    setTimeout(handler: any, timeout?: any, ...args: any[]): number;\n}\n\ninterface WindowTimersExtension {\n    clearImmediate(handle: number): void;\n    setImmediate(handler: (...args: any[]) => void): number;\n    setImmediate(handler: any, ...args: any[]): number;\n}\n\ninterface XMLHttpRequestEventTargetEventMap {\n    \"abort\": Event;\n    \"error\": ErrorEvent;\n    \"load\": Event;\n    \"loadend\": ProgressEvent;\n    \"loadstart\": Event;\n    \"progress\": ProgressEvent;\n    \"timeout\": ProgressEvent;\n}\n\ninterface XMLHttpRequestEventTarget {\n    onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any;\n    onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any;\n    onload: (this: XMLHttpRequestEventTarget, ev: Event) => any;\n    onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;\n    onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any;\n    onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;\n    ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;\n    addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ninterface StorageEventInit extends EventInit {\n    key?: string;\n    oldValue?: string;\n    newValue?: string;\n    url: string;\n    storageArea?: Storage;\n}\n\ninterface Canvas2DContextAttributes {\n    alpha?: boolean;\n    willReadFrequently?: boolean;\n    storage?: boolean;\n    [attribute: string]: boolean | string | undefined;\n}\n\ninterface NodeListOf<TNode extends Node> extends NodeList {\n    length: number;\n    item(index: number): TNode;\n    [index: number]: TNode;\n}\n\ninterface HTMLCollectionOf<T extends Element> extends HTMLCollection {\n    item(index: number): T;\n    namedItem(name: string): T;\n    [index: number]: T;\n}\n\ninterface BlobPropertyBag {\n    type?: string;\n    endings?: string;\n}\n\ninterface FilePropertyBag {\n    type?: string;\n    lastModified?: number;\n}\n\ninterface EventListenerObject {\n    handleEvent(evt: Event): void;\n}\n\ninterface MessageEventInit extends EventInit {\n    data?: any;\n    origin?: string;\n    lastEventId?: string;\n    channel?: string;\n    source?: any;\n    ports?: MessagePort[];\n}\n\ninterface ProgressEventInit extends EventInit {\n    lengthComputable?: boolean;\n    loaded?: number;\n    total?: number;\n}\n\ninterface ScrollOptions {\n    behavior?: ScrollBehavior;\n}\n\ninterface ScrollToOptions extends ScrollOptions {\n    left?: number;\n    top?: number;\n}\n\ninterface ScrollIntoViewOptions extends ScrollOptions {\n    block?: ScrollLogicalPosition;\n    inline?: ScrollLogicalPosition;\n}\n\ninterface ClipboardEventInit extends EventInit {\n    data?: string;\n    dataType?: string;\n}\n\ninterface IDBArrayKey extends Array<IDBValidKey> {\n}\n\ninterface RsaKeyGenParams extends Algorithm {\n    modulusLength: number;\n    publicExponent: Uint8Array;\n}\n\ninterface RsaHashedKeyGenParams extends RsaKeyGenParams {\n    hash: AlgorithmIdentifier;\n}\n\ninterface RsaKeyAlgorithm extends KeyAlgorithm {\n    modulusLength: number;\n    publicExponent: Uint8Array;\n}\n\ninterface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm {\n    hash: AlgorithmIdentifier;\n}\n\ninterface RsaHashedImportParams {\n    hash: AlgorithmIdentifier;\n}\n\ninterface RsaPssParams {\n    saltLength: number;\n}\n\ninterface RsaOaepParams extends Algorithm {\n    label?: BufferSource;\n}\n\ninterface EcdsaParams extends Algorithm {\n    hash: AlgorithmIdentifier;\n}\n\ninterface EcKeyGenParams extends Algorithm {\n    namedCurve: string;\n}\n\ninterface EcKeyAlgorithm extends KeyAlgorithm {\n    typedCurve: string;\n}\n\ninterface EcKeyImportParams {\n    namedCurve: string;\n}\n\ninterface EcdhKeyDeriveParams extends Algorithm {\n    public: CryptoKey;\n}\n\ninterface AesCtrParams extends Algorithm {\n    counter: BufferSource;\n    length: number;\n}\n\ninterface AesKeyAlgorithm extends KeyAlgorithm {\n    length: number;\n}\n\ninterface AesKeyGenParams extends Algorithm {\n    length: number;\n}\n\ninterface AesDerivedKeyParams extends Algorithm {\n    length: number;\n}\n\ninterface AesCbcParams extends Algorithm {\n    iv: BufferSource;\n}\n\ninterface AesCmacParams extends Algorithm {\n    length: number;\n}\n\ninterface AesGcmParams extends Algorithm {\n    iv: BufferSource;\n    additionalData?: BufferSource;\n    tagLength?: number;\n}\n\ninterface AesCfbParams extends Algorithm {\n    iv: BufferSource;\n}\n\ninterface HmacImportParams extends Algorithm {\n    hash?: AlgorithmIdentifier;\n    length?: number;\n}\n\ninterface HmacKeyAlgorithm extends KeyAlgorithm {\n    hash: AlgorithmIdentifier;\n    length: number;\n}\n\ninterface HmacKeyGenParams extends Algorithm {\n    hash: AlgorithmIdentifier;\n    length?: number;\n}\n\ninterface DhKeyGenParams extends Algorithm {\n    prime: Uint8Array;\n    generator: Uint8Array;\n}\n\ninterface DhKeyAlgorithm extends KeyAlgorithm {\n    prime: Uint8Array;\n    generator: Uint8Array;\n}\n\ninterface DhKeyDeriveParams extends Algorithm {\n    public: CryptoKey;\n}\n\ninterface DhImportKeyParams extends Algorithm {\n    prime: Uint8Array;\n    generator: Uint8Array;\n}\n\ninterface ConcatParams extends Algorithm {\n    hash?: AlgorithmIdentifier;\n    algorithmId: Uint8Array;\n    partyUInfo: Uint8Array;\n    partyVInfo: Uint8Array;\n    publicInfo?: Uint8Array;\n    privateInfo?: Uint8Array;\n}\n\ninterface HkdfCtrParams extends Algorithm {\n    hash: AlgorithmIdentifier;\n    label: BufferSource;\n    context: BufferSource;\n}\n\ninterface Pbkdf2Params extends Algorithm {\n    salt: BufferSource;\n    iterations: number;\n    hash: AlgorithmIdentifier;\n}\n\ninterface RsaOtherPrimesInfo {\n    r: string;\n    d: string;\n    t: string;\n}\n\ninterface JsonWebKey {\n    kty: string;\n    use?: string;\n    key_ops?: string[];\n    alg?: string;\n    kid?: string;\n    x5u?: string;\n    x5c?: string;\n    x5t?: string;\n    ext?: boolean;\n    crv?: string;\n    x?: string;\n    y?: string;\n    d?: string;\n    n?: string;\n    e?: string;\n    p?: string;\n    q?: string;\n    dp?: string;\n    dq?: string;\n    qi?: string;\n    oth?: RsaOtherPrimesInfo[];\n    k?: string;\n}\n\ninterface ParentNode {\n    readonly children: HTMLCollection;\n    readonly firstElementChild: Element;\n    readonly lastElementChild: Element;\n    readonly childElementCount: number;\n}\n\ninterface DocumentOrShadowRoot {\n    readonly activeElement: Element | null;\n    readonly stylesheets: StyleSheetList;\n    getSelection(): Selection | null;\n    elementFromPoint(x: number, y: number): Element | null;\n    elementsFromPoint(x: number, y: number): Element[];\n}\n\ninterface ShadowRoot extends DocumentOrShadowRoot, DocumentFragment {\n    readonly host: Element;\n    innerHTML: string;\n}\n\ninterface ShadowRootInit {\n    mode: 'open'|'closed';\n    delegatesFocus?: boolean;\n}\n\ninterface HTMLSlotElement extends HTMLElement {\n    name: string;\n    assignedNodes(options?: AssignedNodesOptions): Node[];\n}\n\ninterface AssignedNodesOptions {\n    flatten?: boolean;\n}\n\ndeclare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;\n\ninterface ErrorEventHandler {\n    (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;\n}\ninterface PositionCallback {\n    (position: Position): void;\n}\ninterface PositionErrorCallback {\n    (error: PositionError): void;\n}\ninterface MediaQueryListListener {\n    (mql: MediaQueryList): void;\n}\ninterface MSLaunchUriCallback {\n    (): void;\n}\ninterface FrameRequestCallback {\n    (time: number): void;\n}\ninterface MSUnsafeFunctionCallback {\n    (): any;\n}\ninterface MSExecAtPriorityFunctionCallback {\n    (...args: any[]): any;\n}\ninterface MutationCallback {\n    (mutations: MutationRecord[], observer: MutationObserver): void;\n}\ninterface DecodeSuccessCallback {\n    (decodedData: AudioBuffer): void;\n}\ninterface DecodeErrorCallback {\n    (error: DOMException): void;\n}\ninterface FunctionStringCallback {\n    (data: string): void;\n}\ninterface NavigatorUserMediaSuccessCallback {\n    (stream: MediaStream): void;\n}\ninterface NavigatorUserMediaErrorCallback {\n    (error: MediaStreamError): void;\n}\ninterface ForEachCallback {\n    (keyId: any, status: string): void;\n}\ninterface HTMLElementTagNameMap {\n    \"a\": HTMLAnchorElement;\n    \"applet\": HTMLAppletElement;\n    \"area\": HTMLAreaElement;\n    \"audio\": HTMLAudioElement;\n    \"base\": HTMLBaseElement;\n    \"basefont\": HTMLBaseFontElement;\n    \"blockquote\": HTMLQuoteElement;\n    \"body\": HTMLBodyElement;\n    \"br\": HTMLBRElement;\n    \"button\": HTMLButtonElement;\n    \"canvas\": HTMLCanvasElement;\n    \"caption\": HTMLTableCaptionElement;\n    \"col\": HTMLTableColElement;\n    \"colgroup\": HTMLTableColElement;\n    \"datalist\": HTMLDataListElement;\n    \"del\": HTMLModElement;\n    \"dir\": HTMLDirectoryElement;\n    \"div\": HTMLDivElement;\n    \"dl\": HTMLDListElement;\n    \"embed\": HTMLEmbedElement;\n    \"fieldset\": HTMLFieldSetElement;\n    \"font\": HTMLFontElement;\n    \"form\": HTMLFormElement;\n    \"frame\": HTMLFrameElement;\n    \"frameset\": HTMLFrameSetElement;\n    \"h1\": HTMLHeadingElement;\n    \"h2\": HTMLHeadingElement;\n    \"h3\": HTMLHeadingElement;\n    \"h4\": HTMLHeadingElement;\n    \"h5\": HTMLHeadingElement;\n    \"h6\": HTMLHeadingElement;\n    \"head\": HTMLHeadElement;\n    \"hr\": HTMLHRElement;\n    \"html\": HTMLHtmlElement;\n    \"iframe\": HTMLIFrameElement;\n    \"img\": HTMLImageElement;\n    \"input\": HTMLInputElement;\n    \"ins\": HTMLModElement;\n    \"isindex\": HTMLUnknownElement;\n    \"label\": HTMLLabelElement;\n    \"legend\": HTMLLegendElement;\n    \"li\": HTMLLIElement;\n    \"link\": HTMLLinkElement;\n    \"listing\": HTMLPreElement;\n    \"map\": HTMLMapElement;\n    \"marquee\": HTMLMarqueeElement;\n    \"menu\": HTMLMenuElement;\n    \"meta\": HTMLMetaElement;\n    \"meter\": HTMLMeterElement;\n    \"nextid\": HTMLUnknownElement;\n    \"object\": HTMLObjectElement;\n    \"ol\": HTMLOListElement;\n    \"optgroup\": HTMLOptGroupElement;\n    \"option\": HTMLOptionElement;\n    \"p\": HTMLParagraphElement;\n    \"param\": HTMLParamElement;\n    \"picture\": HTMLPictureElement;\n    \"pre\": HTMLPreElement;\n    \"progress\": HTMLProgressElement;\n    \"q\": HTMLQuoteElement;\n    \"script\": HTMLScriptElement;\n    \"select\": HTMLSelectElement;\n    \"source\": HTMLSourceElement;\n    \"span\": HTMLSpanElement;\n    \"style\": HTMLStyleElement;\n    \"table\": HTMLTableElement;\n    \"tbody\": HTMLTableSectionElement;\n    \"td\": HTMLTableDataCellElement;\n    \"template\": HTMLTemplateElement;\n    \"textarea\": HTMLTextAreaElement;\n    \"tfoot\": HTMLTableSectionElement;\n    \"th\": HTMLTableHeaderCellElement;\n    \"thead\": HTMLTableSectionElement;\n    \"title\": HTMLTitleElement;\n    \"tr\": HTMLTableRowElement;\n    \"track\": HTMLTrackElement;\n    \"ul\": HTMLUListElement;\n    \"video\": HTMLVideoElement;\n    \"x-ms-webview\": MSHTMLWebViewElement;\n    \"xmp\": HTMLPreElement;\n}\n\ninterface ElementTagNameMap {\n    \"a\": HTMLAnchorElement;\n    \"abbr\": HTMLElement;\n    \"acronym\": HTMLElement;\n    \"address\": HTMLElement;\n    \"applet\": HTMLAppletElement;\n    \"area\": HTMLAreaElement;\n    \"article\": HTMLElement;\n    \"aside\": HTMLElement;\n    \"audio\": HTMLAudioElement;\n    \"b\": HTMLElement;\n    \"base\": HTMLBaseElement;\n    \"basefont\": HTMLBaseFontElement;\n    \"bdo\": HTMLElement;\n    \"big\": HTMLElement;\n    \"blockquote\": HTMLQuoteElement;\n    \"body\": HTMLBodyElement;\n    \"br\": HTMLBRElement;\n    \"button\": HTMLButtonElement;\n    \"canvas\": HTMLCanvasElement;\n    \"caption\": HTMLTableCaptionElement;\n    \"center\": HTMLElement;\n    \"circle\": SVGCircleElement;\n    \"cite\": HTMLElement;\n    \"clippath\": SVGClipPathElement;\n    \"code\": HTMLElement;\n    \"col\": HTMLTableColElement;\n    \"colgroup\": HTMLTableColElement;\n    \"datalist\": HTMLDataListElement;\n    \"dd\": HTMLElement;\n    \"defs\": SVGDefsElement;\n    \"del\": HTMLModElement;\n    \"desc\": SVGDescElement;\n    \"dfn\": HTMLElement;\n    \"dir\": HTMLDirectoryElement;\n    \"div\": HTMLDivElement;\n    \"dl\": HTMLDListElement;\n    \"dt\": HTMLElement;\n    \"ellipse\": SVGEllipseElement;\n    \"em\": HTMLElement;\n    \"embed\": HTMLEmbedElement;\n    \"feblend\": SVGFEBlendElement;\n    \"fecolormatrix\": SVGFEColorMatrixElement;\n    \"fecomponenttransfer\": SVGFEComponentTransferElement;\n    \"fecomposite\": SVGFECompositeElement;\n    \"feconvolvematrix\": SVGFEConvolveMatrixElement;\n    \"fediffuselighting\": SVGFEDiffuseLightingElement;\n    \"fedisplacementmap\": SVGFEDisplacementMapElement;\n    \"fedistantlight\": SVGFEDistantLightElement;\n    \"feflood\": SVGFEFloodElement;\n    \"fefunca\": SVGFEFuncAElement;\n    \"fefuncb\": SVGFEFuncBElement;\n    \"fefuncg\": SVGFEFuncGElement;\n    \"fefuncr\": SVGFEFuncRElement;\n    \"fegaussianblur\": SVGFEGaussianBlurElement;\n    \"feimage\": SVGFEImageElement;\n    \"femerge\": SVGFEMergeElement;\n    \"femergenode\": SVGFEMergeNodeElement;\n    \"femorphology\": SVGFEMorphologyElement;\n    \"feoffset\": SVGFEOffsetElement;\n    \"fepointlight\": SVGFEPointLightElement;\n    \"fespecularlighting\": SVGFESpecularLightingElement;\n    \"fespotlight\": SVGFESpotLightElement;\n    \"fetile\": SVGFETileElement;\n    \"feturbulence\": SVGFETurbulenceElement;\n    \"fieldset\": HTMLFieldSetElement;\n    \"figcaption\": HTMLElement;\n    \"figure\": HTMLElement;\n    \"filter\": SVGFilterElement;\n    \"font\": HTMLFontElement;\n    \"footer\": HTMLElement;\n    \"foreignobject\": SVGForeignObjectElement;\n    \"form\": HTMLFormElement;\n    \"frame\": HTMLFrameElement;\n    \"frameset\": HTMLFrameSetElement;\n    \"g\": SVGGElement;\n    \"h1\": HTMLHeadingElement;\n    \"h2\": HTMLHeadingElement;\n    \"h3\": HTMLHeadingElement;\n    \"h4\": HTMLHeadingElement;\n    \"h5\": HTMLHeadingElement;\n    \"h6\": HTMLHeadingElement;\n    \"head\": HTMLHeadElement;\n    \"header\": HTMLElement;\n    \"hgroup\": HTMLElement;\n    \"hr\": HTMLHRElement;\n    \"html\": HTMLHtmlElement;\n    \"i\": HTMLElement;\n    \"iframe\": HTMLIFrameElement;\n    \"image\": SVGImageElement;\n    \"img\": HTMLImageElement;\n    \"input\": HTMLInputElement;\n    \"ins\": HTMLModElement;\n    \"isindex\": HTMLUnknownElement;\n    \"kbd\": HTMLElement;\n    \"keygen\": HTMLElement;\n    \"label\": HTMLLabelElement;\n    \"legend\": HTMLLegendElement;\n    \"li\": HTMLLIElement;\n    \"line\": SVGLineElement;\n    \"lineargradient\": SVGLinearGradientElement;\n    \"link\": HTMLLinkElement;\n    \"listing\": HTMLPreElement;\n    \"map\": HTMLMapElement;\n    \"mark\": HTMLElement;\n    \"marker\": SVGMarkerElement;\n    \"marquee\": HTMLMarqueeElement;\n    \"mask\": SVGMaskElement;\n    \"menu\": HTMLMenuElement;\n    \"meta\": HTMLMetaElement;\n    \"metadata\": SVGMetadataElement;\n    \"meter\": HTMLMeterElement;\n    \"nav\": HTMLElement;\n    \"nextid\": HTMLUnknownElement;\n    \"nobr\": HTMLElement;\n    \"noframes\": HTMLElement;\n    \"noscript\": HTMLElement;\n    \"object\": HTMLObjectElement;\n    \"ol\": HTMLOListElement;\n    \"optgroup\": HTMLOptGroupElement;\n    \"option\": HTMLOptionElement;\n    \"p\": HTMLParagraphElement;\n    \"param\": HTMLParamElement;\n    \"path\": SVGPathElement;\n    \"pattern\": SVGPatternElement;\n    \"picture\": HTMLPictureElement;\n    \"plaintext\": HTMLElement;\n    \"polygon\": SVGPolygonElement;\n    \"polyline\": SVGPolylineElement;\n    \"pre\": HTMLPreElement;\n    \"progress\": HTMLProgressElement;\n    \"q\": HTMLQuoteElement;\n    \"radialgradient\": SVGRadialGradientElement;\n    \"rect\": SVGRectElement;\n    \"rt\": HTMLElement;\n    \"ruby\": HTMLElement;\n    \"s\": HTMLElement;\n    \"samp\": HTMLElement;\n    \"script\": HTMLScriptElement;\n    \"section\": HTMLElement;\n    \"select\": HTMLSelectElement;\n    \"small\": HTMLElement;\n    \"source\": HTMLSourceElement;\n    \"span\": HTMLSpanElement;\n    \"stop\": SVGStopElement;\n    \"strike\": HTMLElement;\n    \"strong\": HTMLElement;\n    \"style\": HTMLStyleElement;\n    \"sub\": HTMLElement;\n    \"sup\": HTMLElement;\n    \"svg\": SVGSVGElement;\n    \"switch\": SVGSwitchElement;\n    \"symbol\": SVGSymbolElement;\n    \"table\": HTMLTableElement;\n    \"tbody\": HTMLTableSectionElement;\n    \"td\": HTMLTableDataCellElement;\n    \"template\": HTMLTemplateElement;\n    \"text\": SVGTextElement;\n    \"textpath\": SVGTextPathElement;\n    \"textarea\": HTMLTextAreaElement;\n    \"tfoot\": HTMLTableSectionElement;\n    \"th\": HTMLTableHeaderCellElement;\n    \"thead\": HTMLTableSectionElement;\n    \"title\": HTMLTitleElement;\n    \"tr\": HTMLTableRowElement;\n    \"track\": HTMLTrackElement;\n    \"tspan\": SVGTSpanElement;\n    \"tt\": HTMLElement;\n    \"u\": HTMLElement;\n    \"ul\": HTMLUListElement;\n    \"use\": SVGUseElement;\n    \"var\": HTMLElement;\n    \"video\": HTMLVideoElement;\n    \"view\": SVGViewElement;\n    \"wbr\": HTMLElement;\n    \"x-ms-webview\": MSHTMLWebViewElement;\n    \"xmp\": HTMLPreElement;\n}\n\ninterface ElementListTagNameMap {\n    \"a\": NodeListOf<HTMLAnchorElement>;\n    \"abbr\": NodeListOf<HTMLElement>;\n    \"acronym\": NodeListOf<HTMLElement>;\n    \"address\": NodeListOf<HTMLElement>;\n    \"applet\": NodeListOf<HTMLAppletElement>;\n    \"area\": NodeListOf<HTMLAreaElement>;\n    \"article\": NodeListOf<HTMLElement>;\n    \"aside\": NodeListOf<HTMLElement>;\n    \"audio\": NodeListOf<HTMLAudioElement>;\n    \"b\": NodeListOf<HTMLElement>;\n    \"base\": NodeListOf<HTMLBaseElement>;\n    \"basefont\": NodeListOf<HTMLBaseFontElement>;\n    \"bdo\": NodeListOf<HTMLElement>;\n    \"big\": NodeListOf<HTMLElement>;\n    \"blockquote\": NodeListOf<HTMLQuoteElement>;\n    \"body\": NodeListOf<HTMLBodyElement>;\n    \"br\": NodeListOf<HTMLBRElement>;\n    \"button\": NodeListOf<HTMLButtonElement>;\n    \"canvas\": NodeListOf<HTMLCanvasElement>;\n    \"caption\": NodeListOf<HTMLTableCaptionElement>;\n    \"center\": NodeListOf<HTMLElement>;\n    \"circle\": NodeListOf<SVGCircleElement>;\n    \"cite\": NodeListOf<HTMLElement>;\n    \"clippath\": NodeListOf<SVGClipPathElement>;\n    \"code\": NodeListOf<HTMLElement>;\n    \"col\": NodeListOf<HTMLTableColElement>;\n    \"colgroup\": NodeListOf<HTMLTableColElement>;\n    \"datalist\": NodeListOf<HTMLDataListElement>;\n    \"dd\": NodeListOf<HTMLElement>;\n    \"defs\": NodeListOf<SVGDefsElement>;\n    \"del\": NodeListOf<HTMLModElement>;\n    \"desc\": NodeListOf<SVGDescElement>;\n    \"dfn\": NodeListOf<HTMLElement>;\n    \"dir\": NodeListOf<HTMLDirectoryElement>;\n    \"div\": NodeListOf<HTMLDivElement>;\n    \"dl\": NodeListOf<HTMLDListElement>;\n    \"dt\": NodeListOf<HTMLElement>;\n    \"ellipse\": NodeListOf<SVGEllipseElement>;\n    \"em\": NodeListOf<HTMLElement>;\n    \"embed\": NodeListOf<HTMLEmbedElement>;\n    \"feblend\": NodeListOf<SVGFEBlendElement>;\n    \"fecolormatrix\": NodeListOf<SVGFEColorMatrixElement>;\n    \"fecomponenttransfer\": NodeListOf<SVGFEComponentTransferElement>;\n    \"fecomposite\": NodeListOf<SVGFECompositeElement>;\n    \"feconvolvematrix\": NodeListOf<SVGFEConvolveMatrixElement>;\n    \"fediffuselighting\": NodeListOf<SVGFEDiffuseLightingElement>;\n    \"fedisplacementmap\": NodeListOf<SVGFEDisplacementMapElement>;\n    \"fedistantlight\": NodeListOf<SVGFEDistantLightElement>;\n    \"feflood\": NodeListOf<SVGFEFloodElement>;\n    \"fefunca\": NodeListOf<SVGFEFuncAElement>;\n    \"fefuncb\": NodeListOf<SVGFEFuncBElement>;\n    \"fefuncg\": NodeListOf<SVGFEFuncGElement>;\n    \"fefuncr\": NodeListOf<SVGFEFuncRElement>;\n    \"fegaussianblur\": NodeListOf<SVGFEGaussianBlurElement>;\n    \"feimage\": NodeListOf<SVGFEImageElement>;\n    \"femerge\": NodeListOf<SVGFEMergeElement>;\n    \"femergenode\": NodeListOf<SVGFEMergeNodeElement>;\n    \"femorphology\": NodeListOf<SVGFEMorphologyElement>;\n    \"feoffset\": NodeListOf<SVGFEOffsetElement>;\n    \"fepointlight\": NodeListOf<SVGFEPointLightElement>;\n    \"fespecularlighting\": NodeListOf<SVGFESpecularLightingElement>;\n    \"fespotlight\": NodeListOf<SVGFESpotLightElement>;\n    \"fetile\": NodeListOf<SVGFETileElement>;\n    \"feturbulence\": NodeListOf<SVGFETurbulenceElement>;\n    \"fieldset\": NodeListOf<HTMLFieldSetElement>;\n    \"figcaption\": NodeListOf<HTMLElement>;\n    \"figure\": NodeListOf<HTMLElement>;\n    \"filter\": NodeListOf<SVGFilterElement>;\n    \"font\": NodeListOf<HTMLFontElement>;\n    \"footer\": NodeListOf<HTMLElement>;\n    \"foreignobject\": NodeListOf<SVGForeignObjectElement>;\n    \"form\": NodeListOf<HTMLFormElement>;\n    \"frame\": NodeListOf<HTMLFrameElement>;\n    \"frameset\": NodeListOf<HTMLFrameSetElement>;\n    \"g\": NodeListOf<SVGGElement>;\n    \"h1\": NodeListOf<HTMLHeadingElement>;\n    \"h2\": NodeListOf<HTMLHeadingElement>;\n    \"h3\": NodeListOf<HTMLHeadingElement>;\n    \"h4\": NodeListOf<HTMLHeadingElement>;\n    \"h5\": NodeListOf<HTMLHeadingElement>;\n    \"h6\": NodeListOf<HTMLHeadingElement>;\n    \"head\": NodeListOf<HTMLHeadElement>;\n    \"header\": NodeListOf<HTMLElement>;\n    \"hgroup\": NodeListOf<HTMLElement>;\n    \"hr\": NodeListOf<HTMLHRElement>;\n    \"html\": NodeListOf<HTMLHtmlElement>;\n    \"i\": NodeListOf<HTMLElement>;\n    \"iframe\": NodeListOf<HTMLIFrameElement>;\n    \"image\": NodeListOf<SVGImageElement>;\n    \"img\": NodeListOf<HTMLImageElement>;\n    \"input\": NodeListOf<HTMLInputElement>;\n    \"ins\": NodeListOf<HTMLModElement>;\n    \"isindex\": NodeListOf<HTMLUnknownElement>;\n    \"kbd\": NodeListOf<HTMLElement>;\n    \"keygen\": NodeListOf<HTMLElement>;\n    \"label\": NodeListOf<HTMLLabelElement>;\n    \"legend\": NodeListOf<HTMLLegendElement>;\n    \"li\": NodeListOf<HTMLLIElement>;\n    \"line\": NodeListOf<SVGLineElement>;\n    \"lineargradient\": NodeListOf<SVGLinearGradientElement>;\n    \"link\": NodeListOf<HTMLLinkElement>;\n    \"listing\": NodeListOf<HTMLPreElement>;\n    \"map\": NodeListOf<HTMLMapElement>;\n    \"mark\": NodeListOf<HTMLElement>;\n    \"marker\": NodeListOf<SVGMarkerElement>;\n    \"marquee\": NodeListOf<HTMLMarqueeElement>;\n    \"mask\": NodeListOf<SVGMaskElement>;\n    \"menu\": NodeListOf<HTMLMenuElement>;\n    \"meta\": NodeListOf<HTMLMetaElement>;\n    \"metadata\": NodeListOf<SVGMetadataElement>;\n    \"meter\": NodeListOf<HTMLMeterElement>;\n    \"nav\": NodeListOf<HTMLElement>;\n    \"nextid\": NodeListOf<HTMLUnknownElement>;\n    \"nobr\": NodeListOf<HTMLElement>;\n    \"noframes\": NodeListOf<HTMLElement>;\n    \"noscript\": NodeListOf<HTMLElement>;\n    \"object\": NodeListOf<HTMLObjectElement>;\n    \"ol\": NodeListOf<HTMLOListElement>;\n    \"optgroup\": NodeListOf<HTMLOptGroupElement>;\n    \"option\": NodeListOf<HTMLOptionElement>;\n    \"p\": NodeListOf<HTMLParagraphElement>;\n    \"param\": NodeListOf<HTMLParamElement>;\n    \"path\": NodeListOf<SVGPathElement>;\n    \"pattern\": NodeListOf<SVGPatternElement>;\n    \"picture\": NodeListOf<HTMLPictureElement>;\n    \"plaintext\": NodeListOf<HTMLElement>;\n    \"polygon\": NodeListOf<SVGPolygonElement>;\n    \"polyline\": NodeListOf<SVGPolylineElement>;\n    \"pre\": NodeListOf<HTMLPreElement>;\n    \"progress\": NodeListOf<HTMLProgressElement>;\n    \"q\": NodeListOf<HTMLQuoteElement>;\n    \"radialgradient\": NodeListOf<SVGRadialGradientElement>;\n    \"rect\": NodeListOf<SVGRectElement>;\n    \"rt\": NodeListOf<HTMLElement>;\n    \"ruby\": NodeListOf<HTMLElement>;\n    \"s\": NodeListOf<HTMLElement>;\n    \"samp\": NodeListOf<HTMLElement>;\n    \"script\": NodeListOf<HTMLScriptElement>;\n    \"section\": NodeListOf<HTMLElement>;\n    \"select\": NodeListOf<HTMLSelectElement>;\n    \"small\": NodeListOf<HTMLElement>;\n    \"source\": NodeListOf<HTMLSourceElement>;\n    \"span\": NodeListOf<HTMLSpanElement>;\n    \"stop\": NodeListOf<SVGStopElement>;\n    \"strike\": NodeListOf<HTMLElement>;\n    \"strong\": NodeListOf<HTMLElement>;\n    \"style\": NodeListOf<HTMLStyleElement>;\n    \"sub\": NodeListOf<HTMLElement>;\n    \"sup\": NodeListOf<HTMLElement>;\n    \"svg\": NodeListOf<SVGSVGElement>;\n    \"switch\": NodeListOf<SVGSwitchElement>;\n    \"symbol\": NodeListOf<SVGSymbolElement>;\n    \"table\": NodeListOf<HTMLTableElement>;\n    \"tbody\": NodeListOf<HTMLTableSectionElement>;\n    \"td\": NodeListOf<HTMLTableDataCellElement>;\n    \"template\": NodeListOf<HTMLTemplateElement>;\n    \"text\": NodeListOf<SVGTextElement>;\n    \"textpath\": NodeListOf<SVGTextPathElement>;\n    \"textarea\": NodeListOf<HTMLTextAreaElement>;\n    \"tfoot\": NodeListOf<HTMLTableSectionElement>;\n    \"th\": NodeListOf<HTMLTableHeaderCellElement>;\n    \"thead\": NodeListOf<HTMLTableSectionElement>;\n    \"title\": NodeListOf<HTMLTitleElement>;\n    \"tr\": NodeListOf<HTMLTableRowElement>;\n    \"track\": NodeListOf<HTMLTrackElement>;\n    \"tspan\": NodeListOf<SVGTSpanElement>;\n    \"tt\": NodeListOf<HTMLElement>;\n    \"u\": NodeListOf<HTMLElement>;\n    \"ul\": NodeListOf<HTMLUListElement>;\n    \"use\": NodeListOf<SVGUseElement>;\n    \"var\": NodeListOf<HTMLElement>;\n    \"video\": NodeListOf<HTMLVideoElement>;\n    \"view\": NodeListOf<SVGViewElement>;\n    \"wbr\": NodeListOf<HTMLElement>;\n    \"x-ms-webview\": NodeListOf<MSHTMLWebViewElement>;\n    \"xmp\": NodeListOf<HTMLPreElement>;\n}\n\ndeclare var Audio: {new(src?: string): HTMLAudioElement; };\ndeclare var Image: {new(width?: number, height?: number): HTMLImageElement; };\ndeclare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; };\ndeclare var applicationCache: ApplicationCache;\ndeclare var clientInformation: Navigator;\ndeclare var closed: boolean;\ndeclare var crypto: Crypto;\ndeclare var defaultStatus: string;\ndeclare var devicePixelRatio: number;\ndeclare var doNotTrack: string;\ndeclare var document: Document;\ndeclare var event: Event | undefined;\ndeclare var external: External;\ndeclare var frameElement: Element;\ndeclare var frames: Window;\ndeclare var history: History;\ndeclare var innerHeight: number;\ndeclare var innerWidth: number;\ndeclare var length: number;\ndeclare var location: Location;\ndeclare var locationbar: BarProp;\ndeclare var menubar: BarProp;\ndeclare var msCredentials: MSCredentials;\ndeclare const name: never;\ndeclare var navigator: Navigator;\ndeclare var offscreenBuffering: string | boolean;\ndeclare var onabort: (this: Window, ev: UIEvent) => any;\ndeclare var onafterprint: (this: Window, ev: Event) => any;\ndeclare var onbeforeprint: (this: Window, ev: Event) => any;\ndeclare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any;\ndeclare var onblur: (this: Window, ev: FocusEvent) => any;\ndeclare var oncanplay: (this: Window, ev: Event) => any;\ndeclare var oncanplaythrough: (this: Window, ev: Event) => any;\ndeclare var onchange: (this: Window, ev: Event) => any;\ndeclare var onclick: (this: Window, ev: MouseEvent) => any;\ndeclare var oncompassneedscalibration: (this: Window, ev: Event) => any;\ndeclare var oncontextmenu: (this: Window, ev: PointerEvent) => any;\ndeclare var ondblclick: (this: Window, ev: MouseEvent) => any;\ndeclare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any;\ndeclare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any;\ndeclare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any;\ndeclare var ondrag: (this: Window, ev: DragEvent) => any;\ndeclare var ondragend: (this: Window, ev: DragEvent) => any;\ndeclare var ondragenter: (this: Window, ev: DragEvent) => any;\ndeclare var ondragleave: (this: Window, ev: DragEvent) => any;\ndeclare var ondragover: (this: Window, ev: DragEvent) => any;\ndeclare var ondragstart: (this: Window, ev: DragEvent) => any;\ndeclare var ondrop: (this: Window, ev: DragEvent) => any;\ndeclare var ondurationchange: (this: Window, ev: Event) => any;\ndeclare var onemptied: (this: Window, ev: Event) => any;\ndeclare var onended: (this: Window, ev: MediaStreamErrorEvent) => any;\ndeclare var onerror: ErrorEventHandler;\ndeclare var onfocus: (this: Window, ev: FocusEvent) => any;\ndeclare var onhashchange: (this: Window, ev: HashChangeEvent) => any;\ndeclare var oninput: (this: Window, ev: Event) => any;\ndeclare var oninvalid: (this: Window, ev: Event) => any;\ndeclare var onkeydown: (this: Window, ev: KeyboardEvent) => any;\ndeclare var onkeypress: (this: Window, ev: KeyboardEvent) => any;\ndeclare var onkeyup: (this: Window, ev: KeyboardEvent) => any;\ndeclare var onload: (this: Window, ev: Event) => any;\ndeclare var onloadeddata: (this: Window, ev: Event) => any;\ndeclare var onloadedmetadata: (this: Window, ev: Event) => any;\ndeclare var onloadstart: (this: Window, ev: Event) => any;\ndeclare var onmessage: (this: Window, ev: MessageEvent) => any;\ndeclare var onmousedown: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseenter: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseleave: (this: Window, ev: MouseEvent) => any;\ndeclare var onmousemove: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseout: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseover: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseup: (this: Window, ev: MouseEvent) => any;\ndeclare var onmousewheel: (this: Window, ev: WheelEvent) => any;\ndeclare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointermove: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerout: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerover: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerup: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onoffline: (this: Window, ev: Event) => any;\ndeclare var ononline: (this: Window, ev: Event) => any;\ndeclare var onorientationchange: (this: Window, ev: Event) => any;\ndeclare var onpagehide: (this: Window, ev: PageTransitionEvent) => any;\ndeclare var onpageshow: (this: Window, ev: PageTransitionEvent) => any;\ndeclare var onpause: (this: Window, ev: Event) => any;\ndeclare var onplay: (this: Window, ev: Event) => any;\ndeclare var onplaying: (this: Window, ev: Event) => any;\ndeclare var onpopstate: (this: Window, ev: PopStateEvent) => any;\ndeclare var onprogress: (this: Window, ev: ProgressEvent) => any;\ndeclare var onratechange: (this: Window, ev: Event) => any;\ndeclare var onreadystatechange: (this: Window, ev: ProgressEvent) => any;\ndeclare var onreset: (this: Window, ev: Event) => any;\ndeclare var onresize: (this: Window, ev: UIEvent) => any;\ndeclare var onscroll: (this: Window, ev: UIEvent) => any;\ndeclare var onseeked: (this: Window, ev: Event) => any;\ndeclare var onseeking: (this: Window, ev: Event) => any;\ndeclare var onselect: (this: Window, ev: UIEvent) => any;\ndeclare var onstalled: (this: Window, ev: Event) => any;\ndeclare var onstorage: (this: Window, ev: StorageEvent) => any;\ndeclare var onsubmit: (this: Window, ev: Event) => any;\ndeclare var onsuspend: (this: Window, ev: Event) => any;\ndeclare var ontimeupdate: (this: Window, ev: Event) => any;\ndeclare var ontouchcancel: (ev: TouchEvent) => any;\ndeclare var ontouchend: (ev: TouchEvent) => any;\ndeclare var ontouchmove: (ev: TouchEvent) => any;\ndeclare var ontouchstart: (ev: TouchEvent) => any;\ndeclare var onunload: (this: Window, ev: Event) => any;\ndeclare var onvolumechange: (this: Window, ev: Event) => any;\ndeclare var onwaiting: (this: Window, ev: Event) => any;\ndeclare var opener: any;\ndeclare var orientation: string | number;\ndeclare var outerHeight: number;\ndeclare var outerWidth: number;\ndeclare var pageXOffset: number;\ndeclare var pageYOffset: number;\ndeclare var parent: Window;\ndeclare var performance: Performance;\ndeclare var personalbar: BarProp;\ndeclare var screen: Screen;\ndeclare var screenLeft: number;\ndeclare var screenTop: number;\ndeclare var screenX: number;\ndeclare var screenY: number;\ndeclare var scrollX: number;\ndeclare var scrollY: number;\ndeclare var scrollbars: BarProp;\ndeclare var self: Window;\ndeclare var status: string;\ndeclare var statusbar: BarProp;\ndeclare var styleMedia: StyleMedia;\ndeclare var toolbar: BarProp;\ndeclare var top: Window;\ndeclare var window: Window;\ndeclare function alert(message?: any): void;\ndeclare function blur(): void;\ndeclare function cancelAnimationFrame(handle: number): void;\ndeclare function captureEvents(): void;\ndeclare function close(): void;\ndeclare function confirm(message?: string): boolean;\ndeclare function focus(): void;\ndeclare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\ndeclare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList;\ndeclare function getSelection(): Selection;\ndeclare function matchMedia(mediaQuery: string): MediaQueryList;\ndeclare function moveBy(x?: number, y?: number): void;\ndeclare function moveTo(x?: number, y?: number): void;\ndeclare function msWriteProfilerMark(profilerMarkName: string): void;\ndeclare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;\ndeclare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void;\ndeclare function print(): void;\ndeclare function prompt(message?: string, _default?: string): string | null;\ndeclare function releaseEvents(): void;\ndeclare function requestAnimationFrame(callback: FrameRequestCallback): number;\ndeclare function resizeBy(x?: number, y?: number): void;\ndeclare function resizeTo(x?: number, y?: number): void;\ndeclare function scroll(x?: number, y?: number): void;\ndeclare function scrollBy(x?: number, y?: number): void;\ndeclare function scrollTo(x?: number, y?: number): void;\ndeclare function webkitCancelAnimationFrame(handle: number): void;\ndeclare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;\ndeclare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;\ndeclare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number;\ndeclare function scroll(options?: ScrollToOptions): void;\ndeclare function scrollTo(options?: ScrollToOptions): void;\ndeclare function scrollBy(options?: ScrollToOptions): void;\ndeclare function toString(): string;\ndeclare function dispatchEvent(evt: Event): boolean;\ndeclare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\ndeclare function clearInterval(handle: number): void;\ndeclare function clearTimeout(handle: number): void;\ndeclare function setInterval(handler: (...args: any[]) => void, timeout: number): number;\ndeclare function setInterval(handler: any, timeout?: any, ...args: any[]): number;\ndeclare function setTimeout(handler: (...args: any[]) => void, timeout: number): number;\ndeclare function setTimeout(handler: any, timeout?: any, ...args: any[]): number;\ndeclare function clearImmediate(handle: number): void;\ndeclare function setImmediate(handler: (...args: any[]) => void): number;\ndeclare function setImmediate(handler: any, ...args: any[]): number;\ndeclare var sessionStorage: Storage;\ndeclare var localStorage: Storage;\ndeclare var console: Console;\ndeclare var onpointercancel: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerdown: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerenter: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerleave: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointermove: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerout: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerover: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerup: (this: Window, ev: PointerEvent) => any;\ndeclare var onwheel: (this: Window, ev: WheelEvent) => any;\ndeclare var indexedDB: IDBFactory;\ndeclare function atob(encodedString: string): string;\ndeclare function btoa(rawString: string): string;\ndeclare function addEventListener<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void;\ndeclare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\ntype AAGUID = string;\ntype AlgorithmIdentifier = string | Algorithm;\ntype ConstrainBoolean = boolean | ConstrainBooleanParameters;\ntype ConstrainDOMString = string | string[] | ConstrainDOMStringParameters;\ntype ConstrainDouble = number | ConstrainDoubleRange;\ntype ConstrainLong = number | ConstrainLongRange;\ntype CryptoOperationData = ArrayBufferView;\ntype GLbitfield = number;\ntype GLboolean = boolean;\ntype GLbyte = number;\ntype GLclampf = number;\ntype GLenum = number;\ntype GLfloat = number;\ntype GLint = number;\ntype GLintptr = number;\ntype GLshort = number;\ntype GLsizei = number;\ntype GLsizeiptr = number;\ntype GLubyte = number;\ntype GLuint = number;\ntype GLushort = number;\ntype IDBKeyPath = string;\ntype KeyFormat = string;\ntype KeyType = string;\ntype KeyUsage = string;\ntype MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload;\ntype MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent;\ntype MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload;\ntype RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete;\ntype RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport;\ntype payloadtype = number;\ntype ScrollBehavior = \"auto\" | \"instant\" | \"smooth\";\ntype ScrollLogicalPosition = \"start\" | \"center\" | \"end\" | \"nearest\";\ntype IDBValidKey = number | string | Date | IDBArrayKey;\ntype BufferSource = ArrayBuffer | ArrayBufferView;\ntype MouseWheelEvent = WheelEvent;\ntype ScrollRestoration = \"auto\" | \"manual\";\n\n\n/////////////////////////////\n/// WorkerGlobalScope APIs \n/////////////////////////////\n// These are only available in a Web Worker \ndeclare function importScripts(...urls: string[]): void;\n\n\n\n\n/////////////////////////////\n/// Windows Script Host APIS\n/////////////////////////////\n\n\ninterface ActiveXObject {\n    new (s: string): any;\n}\ndeclare var ActiveXObject: ActiveXObject;\n\ninterface ITextWriter {\n    Write(s: string): void;\n    WriteLine(s: string): void;\n    Close(): void;\n}\n\ninterface TextStreamBase {\n    /**\n     * The column number of the current character position in an input stream.\n     */\n    Column: number;\n\n    /**\n     * The current line number in an input stream.\n     */\n    Line: number;\n\n    /**\n     * Closes a text stream.\n     * It is not necessary to close standard streams; they close automatically when the process ends. If \n     * you close a standard stream, be aware that any other pointers to that standard stream become invalid.\n     */\n    Close(): void;\n}\n\ninterface TextStreamWriter extends TextStreamBase {\n    /**\n     * Sends a string to an output stream.\n     */\n    Write(s: string): void;\n\n    /**\n     * Sends a specified number of blank lines (newline characters) to an output stream.\n     */\n    WriteBlankLines(intLines: number): void;\n\n    /**\n     * Sends a string followed by a newline character to an output stream.\n     */\n    WriteLine(s: string): void;\n}\n\ninterface TextStreamReader extends TextStreamBase {\n    /**\n     * Returns a specified number of characters from an input stream, starting at the current pointer position.\n     * Does not return until the ENTER key is pressed.\n     * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n     */\n    Read(characters: number): string;\n\n    /**\n     * Returns all characters from an input stream.\n     * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n     */\n    ReadAll(): string;\n\n    /**\n     * Returns an entire line from an input stream.\n     * Although this method extracts the newline character, it does not add it to the returned string.\n     * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n     */\n    ReadLine(): string;\n\n    /**\n     * Skips a specified number of characters when reading from an input text stream.\n     * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n     * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)\n     */\n    Skip(characters: number): void;\n\n    /**\n     * Skips the next line when reading from an input text stream.\n     * Can only be used on a stream in reading mode, not writing or appending mode.\n     */\n    SkipLine(): void;\n\n    /**\n     * Indicates whether the stream pointer position is at the end of a line.\n     */\n    AtEndOfLine: boolean;\n\n    /**\n     * Indicates whether the stream pointer position is at the end of a stream.\n     */\n    AtEndOfStream: boolean;\n}\n\ndeclare var WScript: {\n    /**\n    * Outputs text to either a message box (under WScript.exe) or the command console window followed by\n    * a newline (under CScript.exe).\n    */\n    Echo(s: any): void;\n\n    /**\n     * Exposes the write-only error output stream for the current script.\n     * Can be accessed only while using CScript.exe.\n     */\n    StdErr: TextStreamWriter;\n\n    /**\n     * Exposes the write-only output stream for the current script.\n     * Can be accessed only while using CScript.exe.\n     */\n    StdOut: TextStreamWriter;\n    Arguments: { length: number; Item(n: number): string; };\n\n    /**\n     *  The full path of the currently running script.\n     */\n    ScriptFullName: string;\n\n    /**\n     * Forces the script to stop immediately, with an optional exit code.\n     */\n    Quit(exitCode?: number): number;\n\n    /**\n     * The Windows Script Host build version number.\n     */\n    BuildVersion: number;\n\n    /**\n     * Fully qualified path of the host executable.\n     */\n    FullName: string;\n\n    /**\n     * Gets/sets the script mode - interactive(true) or batch(false).\n     */\n    Interactive: boolean;\n\n    /**\n     * The name of the host executable (WScript.exe or CScript.exe).\n     */\n    Name: string;\n\n    /**\n     * Path of the directory containing the host executable.\n     */\n    Path: string;\n\n    /**\n     * The filename of the currently running script.\n     */\n    ScriptName: string;\n\n    /**\n     * Exposes the read-only input stream for the current script.\n     * Can be accessed only while using CScript.exe.\n     */\n    StdIn: TextStreamReader;\n\n    /**\n     * Windows Script Host version\n     */\n    Version: string;\n\n    /**\n     * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.\n     */\n    ConnectObject(objEventSource: any, strPrefix: string): void;\n\n    /**\n     * Creates a COM object.\n     * @param strProgiID\n     * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.\n     */\n    CreateObject(strProgID: string, strPrefix?: string): any;\n\n    /**\n     * Disconnects a COM object from its event sources.\n     */\n    DisconnectObject(obj: any): void;\n\n    /**\n     * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.\n     * @param strPathname Fully qualified path to the file containing the object persisted to disk.\n     *                       For objects in memory, pass a zero-length string.\n     * @param strProgID\n     * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.\n     */\n    GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;\n\n    /**\n     * Suspends script execution for a specified length of time, then continues execution.\n     * @param intTime Interval (in milliseconds) to suspend script execution.\n     */\n    Sleep(intTime: number): void;\n};\n\n/**\n * Allows enumerating over a COM collection, which may not have indexed item access.\n */\ninterface Enumerator<T> {\n    /**\n     * Returns true if the current item is the last one in the collection, or the collection is empty,\n     * or the current item is undefined.\n     */\n    atEnd(): boolean;\n\n    /**\n     * Returns the current item in the collection\n     */\n    item(): T;\n\n    /**\n     * Resets the current item in the collection to the first item. If there are no items in the collection,\n     * the current item is set to undefined.\n     */\n    moveFirst(): void;\n\n    /**\n     * Moves the current item to the next item in the collection. If the enumerator is at the end of\n     * the collection or the collection is empty, the current item is set to undefined.\n     */\n    moveNext(): void;\n}\n\ninterface EnumeratorConstructor {\n    new <T>(collection: any): Enumerator<T>;\n    new (collection: any): Enumerator<any>;\n}\n\ndeclare var Enumerator: EnumeratorConstructor;\n\n/**\n * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions.\n */\ninterface VBArray<T> {\n    /**\n     * Returns the number of dimensions (1-based).\n     */\n    dimensions(): number;\n\n    /**\n     * Takes an index for each dimension in the array, and returns the item at the corresponding location.\n     */\n    getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T;\n\n    /**\n     * Returns the smallest available index for a given dimension.\n     * @param dimension 1-based dimension (defaults to 1)\n     */\n    lbound(dimension?: number): number;\n\n    /**\n     * Returns the largest available index for a given dimension.\n     * @param dimension 1-based dimension (defaults to 1)\n     */\n    ubound(dimension?: number): number;\n\n    /**\n     * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions,\n     * each successive dimension is appended to the end of the array.\n     * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6]\n     */\n    toArray(): T[];\n}\n\ninterface VBArrayConstructor {\n    new <T>(safeArray: any): VBArray<T>;\n    new (safeArray: any): VBArray<any>;\n}\n\ndeclare var VBArray: VBArrayConstructor;\n\n/**\n * Automation date (VT_DATE)\n */\ninterface VarDate { }\n\ninterface DateConstructor {\n    new (vd: VarDate): Date;\n}\n\ninterface Date {\n    getVarDate: () => VarDate;\n}\n"
  },
  {
    "path": "buildtool/typescript/lib/lib.es6.d.ts",
    "content": "/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved. \nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0  \n \nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, \nMERCHANTABLITY OR NON-INFRINGEMENT. \n \nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n\n\n\n/// <reference no-default-lib=\"true\"/>\n\n\n/////////////////////////////\n/// ECMAScript APIs\n/////////////////////////////\n\ndeclare const NaN: number;\ndeclare const Infinity: number;\n\n/**\n  * Evaluates JavaScript code and executes it.\n  * @param x A String value that contains valid JavaScript code.\n  */\ndeclare function eval(x: string): any;\n\n/**\n  * Converts A string to an integer.\n  * @param s A string to convert into a number.\n  * @param radix A value between 2 and 36 that specifies the base of the number in numString.\n  * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\n  * All other strings are considered decimal.\n  */\ndeclare function parseInt(s: string, radix?: number): number;\n\n/**\n  * Converts a string to a floating-point number.\n  * @param string A string that contains a floating-point number.\n  */\ndeclare function parseFloat(string: string): number;\n\n/**\n  * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).\n  * @param number A numeric value.\n  */\ndeclare function isNaN(number: number): boolean;\n\n/**\n  * Determines whether a supplied number is finite.\n  * @param number Any numeric value.\n  */\ndeclare function isFinite(number: number): boolean;\n\n/**\n  * Gets the unencoded version of an encoded Uniform Resource Identifier (URI).\n  * @param encodedURI A value representing an encoded URI.\n  */\ndeclare function decodeURI(encodedURI: string): string;\n\n/**\n  * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).\n  * @param encodedURIComponent A value representing an encoded URI component.\n  */\ndeclare function decodeURIComponent(encodedURIComponent: string): string;\n\n/**\n  * Encodes a text string as a valid Uniform Resource Identifier (URI)\n  * @param uri A value representing an encoded URI.\n  */\ndeclare function encodeURI(uri: string): string;\n\n/**\n  * Encodes a text string as a valid component of a Uniform Resource Identifier (URI).\n  * @param uriComponent A value representing an encoded URI component.\n  */\ndeclare function encodeURIComponent(uriComponent: string): string;\n\ninterface PropertyDescriptor {\n    configurable?: boolean;\n    enumerable?: boolean;\n    value?: any;\n    writable?: boolean;\n    get? (): any;\n    set? (v: any): void;\n}\n\ninterface PropertyDescriptorMap {\n    [s: string]: PropertyDescriptor;\n}\n\ninterface Object {\n    /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */\n    constructor: Function;\n\n    /** Returns a string representation of an object. */\n    toString(): string;\n\n    /** Returns a date converted to a string using the current locale. */\n    toLocaleString(): string;\n\n    /** Returns the primitive value of the specified object. */\n    valueOf(): Object;\n\n    /**\n      * Determines whether an object has a property with the specified name.\n      * @param v A property name.\n      */\n    hasOwnProperty(v: string): boolean;\n\n    /**\n      * Determines whether an object exists in another object's prototype chain.\n      * @param v Another object whose prototype chain is to be checked.\n      */\n    isPrototypeOf(v: Object): boolean;\n\n    /**\n      * Determines whether a specified property is enumerable.\n      * @param v A property name.\n      */\n    propertyIsEnumerable(v: string): boolean;\n}\n\ninterface ObjectConstructor {\n    new (value?: any): Object;\n    (): any;\n    (value: any): any;\n\n    /** A reference to the prototype for a class of objects. */\n    readonly prototype: Object;\n\n    /**\n      * Returns the prototype of an object.\n      * @param o The object that references the prototype.\n      */\n    getPrototypeOf(o: any): any;\n\n    /**\n      * Gets the own property descriptor of the specified object.\n      * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype.\n      * @param o Object that contains the property.\n      * @param p Name of the property.\n    */\n    getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor;\n\n    /**\n      * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly\n      * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions.\n      * @param o Object that contains the own properties.\n      */\n    getOwnPropertyNames(o: any): string[];\n\n    /**\n      * Creates an object that has null prototype.\n      * @param o Object to use as a prototype. May be null\n      */\n    create(o: null): any;\n\n    /**\n      * Creates an object that has the specified prototype, and that optionally contains specified properties.\n      * @param o Object to use as a prototype. May be null\n      */\n    create<T>(o: T): T;\n\n    /**\n      * Creates an object that has the specified prototype, and that optionally contains specified properties.\n      * @param o Object to use as a prototype. May be null\n      * @param properties JavaScript object that contains one or more property descriptors.\n      */\n    create(o: any, properties: PropertyDescriptorMap): any;\n\n    /**\n      * Adds a property to an object, or modifies attributes of an existing property.\n      * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object.\n      * @param p The property name.\n      * @param attributes Descriptor for the property. It can be for a data property or an accessor property.\n      */\n    defineProperty(o: any, p: string, attributes: PropertyDescriptor): any;\n\n    /**\n      * Adds one or more properties to an object, and/or modifies attributes of existing properties.\n      * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object.\n      * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property.\n      */\n    defineProperties(o: any, properties: PropertyDescriptorMap): any;\n\n    /**\n      * Prevents the modification of attributes of existing properties, and prevents the addition of new properties.\n      * @param o Object on which to lock the attributes.\n      */\n    seal<T>(o: T): T;\n\n    /**\n      * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.\n      * @param o Object on which to lock the attributes.\n      */\n    freeze<T>(a: T[]): ReadonlyArray<T>;\n\n    /**\n      * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.\n      * @param o Object on which to lock the attributes.\n      */\n    freeze<T extends Function>(f: T): T;\n\n    /**\n      * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.\n      * @param o Object on which to lock the attributes.\n      */\n    freeze<T>(o: T): Readonly<T>;\n\n    /**\n      * Prevents the addition of new properties to an object.\n      * @param o Object to make non-extensible.\n      */\n    preventExtensions<T>(o: T): T;\n\n    /**\n      * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object.\n      * @param o Object to test.\n      */\n    isSealed(o: any): boolean;\n\n    /**\n      * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object.\n      * @param o Object to test.\n      */\n    isFrozen(o: any): boolean;\n\n    /**\n      * Returns a value that indicates whether new properties can be added to an object.\n      * @param o Object to test.\n      */\n    isExtensible(o: any): boolean;\n\n    /**\n      * Returns the names of the enumerable properties and methods of an object.\n      * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.\n      */\n    keys(o: any): string[];\n}\n\n/**\n  * Provides functionality common to all JavaScript objects.\n  */\ndeclare const Object: ObjectConstructor;\n\n/**\n  * Creates a new function.\n  */\ninterface Function {\n    /**\n      * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function.\n      * @param thisArg The object to be used as the this object.\n      * @param argArray A set of arguments to be passed to the function.\n      */\n    apply(this: Function, thisArg: any, argArray?: any): any;\n\n    /**\n      * Calls a method of an object, substituting another object for the current object.\n      * @param thisArg The object to be used as the current object.\n      * @param argArray A list of arguments to be passed to the method.\n      */\n    call(this: Function, thisArg: any, ...argArray: any[]): any;\n\n    /**\n      * For a given function, creates a bound function that has the same body as the original function.\n      * The this object of the bound function is associated with the specified object, and has the specified initial parameters.\n      * @param thisArg An object to which the this keyword can refer inside the new function.\n      * @param argArray A list of arguments to be passed to the new function.\n      */\n    bind(this: Function, thisArg: any, ...argArray: any[]): any;\n\n    /** Returns a string representation of a function. */\n    toString(): string;\n\n    prototype: any;\n    readonly length: number;\n\n    // Non-standard extensions\n    arguments: any;\n    caller: Function;\n}\n\ninterface FunctionConstructor {\n    /**\n      * Creates a new function.\n      * @param args A list of arguments the function accepts.\n      */\n    new (...args: string[]): Function;\n    (...args: string[]): Function;\n    readonly prototype: Function;\n}\n\ndeclare const Function: FunctionConstructor;\n\ninterface IArguments {\n    [index: number]: any;\n    length: number;\n    callee: Function;\n}\n\ninterface String {\n    /** Returns a string representation of a string. */\n    toString(): string;\n\n    /**\n      * Returns the character at the specified index.\n      * @param pos The zero-based index of the desired character.\n      */\n    charAt(pos: number): string;\n\n    /**\n      * Returns the Unicode value of the character at the specified location.\n      * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.\n      */\n    charCodeAt(index: number): number;\n\n    /**\n      * Returns a string that contains the concatenation of two or more strings.\n      * @param strings The strings to append to the end of the string.\n      */\n    concat(...strings: string[]): string;\n\n    /**\n      * Returns the position of the first occurrence of a substring.\n      * @param searchString The substring to search for in the string\n      * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string.\n      */\n    indexOf(searchString: string, position?: number): number;\n\n    /**\n      * Returns the last occurrence of a substring in the string.\n      * @param searchString The substring to search for.\n      * @param position The index at which to begin searching. If omitted, the search begins at the end of the string.\n      */\n    lastIndexOf(searchString: string, position?: number): number;\n\n    /**\n      * Determines whether two strings are equivalent in the current locale.\n      * @param that String to compare to target string\n      */\n    localeCompare(that: string): number;\n\n    /**\n      * Matches a string with a regular expression, and returns an array containing the results of that search.\n      * @param regexp A variable name or string literal containing the regular expression pattern and flags.\n      */\n    match(regexp: string): RegExpMatchArray | null;\n\n    /**\n      * Matches a string with a regular expression, and returns an array containing the results of that search.\n      * @param regexp A regular expression object that contains the regular expression pattern and applicable flags.\n      */\n    match(regexp: RegExp): RegExpMatchArray | null;\n\n    /**\n      * Replaces text in a string, using a regular expression or search string.\n      * @param searchValue A string that represents the regular expression.\n      * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.\n      */\n    replace(searchValue: string, replaceValue: string): string;\n\n    /**\n      * Replaces text in a string, using a regular expression or search string.\n      * @param searchValue A string that represents the regular expression.\n      * @param replacer A function that returns the replacement text.\n      */\n    replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string;\n\n    /**\n      * Replaces text in a string, using a regular expression or search string.\n      * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags.\n      * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.\n      */\n    replace(searchValue: RegExp, replaceValue: string): string;\n\n    /**\n      * Replaces text in a string, using a regular expression or search string.\n      * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags\n      * @param replacer A function that returns the replacement text.\n      */\n    replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string;\n\n    /**\n      * Finds the first substring match in a regular expression search.\n      * @param regexp The regular expression pattern and applicable flags.\n      */\n    search(regexp: string): number;\n\n    /**\n      * Finds the first substring match in a regular expression search.\n      * @param regexp The regular expression pattern and applicable flags.\n      */\n    search(regexp: RegExp): number;\n\n    /**\n      * Returns a section of a string.\n      * @param start The index to the beginning of the specified portion of stringObj.\n      * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end.\n      * If this value is not specified, the substring continues to the end of stringObj.\n      */\n    slice(start?: number, end?: number): string;\n\n    /**\n      * Split a string into substrings using the specified separator and return them as an array.\n      * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.\n      * @param limit A value used to limit the number of elements returned in the array.\n      */\n    split(separator: string, limit?: number): string[];\n\n    /**\n      * Split a string into substrings using the specified separator and return them as an array.\n      * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.\n      * @param limit A value used to limit the number of elements returned in the array.\n      */\n    split(separator: RegExp, limit?: number): string[];\n\n    /**\n      * Returns the substring at the specified location within a String object.\n      * @param start The zero-based index number indicating the beginning of the substring.\n      * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end.\n      * If end is omitted, the characters from start through the end of the original string are returned.\n      */\n    substring(start: number, end?: number): string;\n\n    /** Converts all the alphabetic characters in a string to lowercase. */\n    toLowerCase(): string;\n\n    /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */\n    toLocaleLowerCase(): string;\n\n    /** Converts all the alphabetic characters in a string to uppercase. */\n    toUpperCase(): string;\n\n    /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */\n    toLocaleUpperCase(): string;\n\n    /** Removes the leading and trailing white space and line terminator characters from a string. */\n    trim(): string;\n\n    /** Returns the length of a String object. */\n    readonly length: number;\n\n    // IE extensions\n    /**\n      * Gets a substring beginning at the specified location and having the specified length.\n      * @param from The starting position of the desired substring. The index of the first character in the string is zero.\n      * @param length The number of characters to include in the returned substring.\n      */\n    substr(from: number, length?: number): string;\n\n    /** Returns the primitive value of the specified object. */\n    valueOf(): string;\n\n    readonly [index: number]: string;\n}\n\ninterface StringConstructor {\n    new (value?: any): String;\n    (value?: any): string;\n    readonly prototype: String;\n    fromCharCode(...codes: number[]): string;\n}\n\n/**\n  * Allows manipulation and formatting of text strings and determination and location of substrings within strings.\n  */\ndeclare const String: StringConstructor;\n\ninterface Boolean {\n    /** Returns the primitive value of the specified object. */\n    valueOf(): boolean;\n}\n\ninterface BooleanConstructor {\n    new (value?: any): Boolean;\n    (value?: any): boolean;\n    readonly prototype: Boolean;\n}\n\ndeclare const Boolean: BooleanConstructor;\n\ninterface Number {\n    /**\n      * Returns a string representation of an object.\n      * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers.\n      */\n    toString(radix?: number): string;\n\n    /**\n      * Returns a string representing a number in fixed-point notation.\n      * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.\n      */\n    toFixed(fractionDigits?: number): string;\n\n    /**\n      * Returns a string containing a number represented in exponential notation.\n      * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.\n      */\n    toExponential(fractionDigits?: number): string;\n\n    /**\n      * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits.\n      * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive.\n      */\n    toPrecision(precision?: number): string;\n\n    /** Returns the primitive value of the specified object. */\n    valueOf(): number;\n}\n\ninterface NumberConstructor {\n    new (value?: any): Number;\n    (value?: any): number;\n    readonly prototype: Number;\n\n    /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */\n    readonly MAX_VALUE: number;\n\n    /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */\n    readonly MIN_VALUE: number;\n\n    /**\n      * A value that is not a number.\n      * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function.\n      */\n    readonly NaN: number;\n\n    /**\n      * A value that is less than the largest negative number that can be represented in JavaScript.\n      * JavaScript displays NEGATIVE_INFINITY values as -infinity.\n      */\n    readonly NEGATIVE_INFINITY: number;\n\n    /**\n      * A value greater than the largest number that can be represented in JavaScript.\n      * JavaScript displays POSITIVE_INFINITY values as infinity.\n      */\n    readonly POSITIVE_INFINITY: number;\n}\n\n/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */\ndeclare const Number: NumberConstructor;\n\ninterface TemplateStringsArray extends ReadonlyArray<string> {\n    readonly raw: ReadonlyArray<string>\n}\n\ninterface Math {\n    /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */\n    readonly E: number;\n    /** The natural logarithm of 10. */\n    readonly LN10: number;\n    /** The natural logarithm of 2. */\n    readonly LN2: number;\n    /** The base-2 logarithm of e. */\n    readonly LOG2E: number;\n    /** The base-10 logarithm of e. */\n    readonly LOG10E: number;\n    /** Pi. This is the ratio of the circumference of a circle to its diameter. */\n    readonly PI: number;\n    /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */\n    readonly SQRT1_2: number;\n    /** The square root of 2. */\n    readonly SQRT2: number;\n    /**\n      * Returns the absolute value of a number (the value without regard to whether it is positive or negative).\n      * For example, the absolute value of -5 is the same as the absolute value of 5.\n      * @param x A numeric expression for which the absolute value is needed.\n      */\n    abs(x: number): number;\n    /**\n      * Returns the arc cosine (or inverse cosine) of a number.\n      * @param x A numeric expression.\n      */\n    acos(x: number): number;\n    /**\n      * Returns the arcsine of a number.\n      * @param x A numeric expression.\n      */\n    asin(x: number): number;\n    /**\n      * Returns the arctangent of a number.\n      * @param x A numeric expression for which the arctangent is needed.\n      */\n    atan(x: number): number;\n    /**\n      * Returns the angle (in radians) from the X axis to a point.\n      * @param y A numeric expression representing the cartesian y-coordinate.\n      * @param x A numeric expression representing the cartesian x-coordinate.\n      */\n    atan2(y: number, x: number): number;\n    /**\n      * Returns the smallest number greater than or equal to its numeric argument.\n      * @param x A numeric expression.\n      */\n    ceil(x: number): number;\n    /**\n      * Returns the cosine of a number.\n      * @param x A numeric expression that contains an angle measured in radians.\n      */\n    cos(x: number): number;\n    /**\n      * Returns e (the base of natural logarithms) raised to a power.\n      * @param x A numeric expression representing the power of e.\n      */\n    exp(x: number): number;\n    /**\n      * Returns the greatest number less than or equal to its numeric argument.\n      * @param x A numeric expression.\n      */\n    floor(x: number): number;\n    /**\n      * Returns the natural logarithm (base e) of a number.\n      * @param x A numeric expression.\n      */\n    log(x: number): number;\n    /**\n      * Returns the larger of a set of supplied numeric expressions.\n      * @param values Numeric expressions to be evaluated.\n      */\n    max(...values: number[]): number;\n    /**\n      * Returns the smaller of a set of supplied numeric expressions.\n      * @param values Numeric expressions to be evaluated.\n      */\n    min(...values: number[]): number;\n    /**\n      * Returns the value of a base expression taken to a specified power.\n      * @param x The base value of the expression.\n      * @param y The exponent value of the expression.\n      */\n    pow(x: number, y: number): number;\n    /** Returns a pseudorandom number between 0 and 1. */\n    random(): number;\n    /**\n      * Returns a supplied numeric expression rounded to the nearest number.\n      * @param x The value to be rounded to the nearest number.\n      */\n    round(x: number): number;\n    /**\n      * Returns the sine of a number.\n      * @param x A numeric expression that contains an angle measured in radians.\n      */\n    sin(x: number): number;\n    /**\n      * Returns the square root of a number.\n      * @param x A numeric expression.\n      */\n    sqrt(x: number): number;\n    /**\n      * Returns the tangent of a number.\n      * @param x A numeric expression that contains an angle measured in radians.\n      */\n    tan(x: number): number;\n}\n/** An intrinsic object that provides basic mathematics functionality and constants. */\ndeclare const Math: Math;\n\n/** Enables basic storage and retrieval of dates and times. */\ninterface Date {\n    /** Returns a string representation of a date. The format of the string depends on the locale. */\n    toString(): string;\n    /** Returns a date as a string value. */\n    toDateString(): string;\n    /** Returns a time as a string value. */\n    toTimeString(): string;\n    /** Returns a value as a string value appropriate to the host environment's current locale. */\n    toLocaleString(): string;\n    /** Returns a date as a string value appropriate to the host environment's current locale. */\n    toLocaleDateString(): string;\n    /** Returns a time as a string value appropriate to the host environment's current locale. */\n    toLocaleTimeString(): string;\n    /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */\n    valueOf(): number;\n    /** Gets the time value in milliseconds. */\n    getTime(): number;\n    /** Gets the year, using local time. */\n    getFullYear(): number;\n    /** Gets the year using Universal Coordinated Time (UTC). */\n    getUTCFullYear(): number;\n    /** Gets the month, using local time. */\n    getMonth(): number;\n    /** Gets the month of a Date object using Universal Coordinated Time (UTC). */\n    getUTCMonth(): number;\n    /** Gets the day-of-the-month, using local time. */\n    getDate(): number;\n    /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */\n    getUTCDate(): number;\n    /** Gets the day of the week, using local time. */\n    getDay(): number;\n    /** Gets the day of the week using Universal Coordinated Time (UTC). */\n    getUTCDay(): number;\n    /** Gets the hours in a date, using local time. */\n    getHours(): number;\n    /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */\n    getUTCHours(): number;\n    /** Gets the minutes of a Date object, using local time. */\n    getMinutes(): number;\n    /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */\n    getUTCMinutes(): number;\n    /** Gets the seconds of a Date object, using local time. */\n    getSeconds(): number;\n    /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */\n    getUTCSeconds(): number;\n    /** Gets the milliseconds of a Date, using local time. */\n    getMilliseconds(): number;\n    /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */\n    getUTCMilliseconds(): number;\n    /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */\n    getTimezoneOffset(): number;\n    /**\n      * Sets the date and time value in the Date object.\n      * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT.\n      */\n    setTime(time: number): number;\n    /**\n      * Sets the milliseconds value in the Date object using local time.\n      * @param ms A numeric value equal to the millisecond value.\n      */\n    setMilliseconds(ms: number): number;\n    /**\n      * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).\n      * @param ms A numeric value equal to the millisecond value.\n      */\n    setUTCMilliseconds(ms: number): number;\n\n    /**\n      * Sets the seconds value in the Date object using local time.\n      * @param sec A numeric value equal to the seconds value.\n      * @param ms A numeric value equal to the milliseconds value.\n      */\n    setSeconds(sec: number, ms?: number): number;\n    /**\n      * Sets the seconds value in the Date object using Universal Coordinated Time (UTC).\n      * @param sec A numeric value equal to the seconds value.\n      * @param ms A numeric value equal to the milliseconds value.\n      */\n    setUTCSeconds(sec: number, ms?: number): number;\n    /**\n      * Sets the minutes value in the Date object using local time.\n      * @param min A numeric value equal to the minutes value.\n      * @param sec A numeric value equal to the seconds value.\n      * @param ms A numeric value equal to the milliseconds value.\n      */\n    setMinutes(min: number, sec?: number, ms?: number): number;\n    /**\n      * Sets the minutes value in the Date object using Universal Coordinated Time (UTC).\n      * @param min A numeric value equal to the minutes value.\n      * @param sec A numeric value equal to the seconds value.\n      * @param ms A numeric value equal to the milliseconds value.\n      */\n    setUTCMinutes(min: number, sec?: number, ms?: number): number;\n    /**\n      * Sets the hour value in the Date object using local time.\n      * @param hours A numeric value equal to the hours value.\n      * @param min A numeric value equal to the minutes value.\n      * @param sec A numeric value equal to the seconds value.\n      * @param ms A numeric value equal to the milliseconds value.\n      */\n    setHours(hours: number, min?: number, sec?: number, ms?: number): number;\n    /**\n      * Sets the hours value in the Date object using Universal Coordinated Time (UTC).\n      * @param hours A numeric value equal to the hours value.\n      * @param min A numeric value equal to the minutes value.\n      * @param sec A numeric value equal to the seconds value.\n      * @param ms A numeric value equal to the milliseconds value.\n      */\n    setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number;\n    /**\n      * Sets the numeric day-of-the-month value of the Date object using local time.\n      * @param date A numeric value equal to the day of the month.\n      */\n    setDate(date: number): number;\n    /**\n      * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).\n      * @param date A numeric value equal to the day of the month.\n      */\n    setUTCDate(date: number): number;\n    /**\n      * Sets the month value in the Date object using local time.\n      * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.\n      * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used.\n      */\n    setMonth(month: number, date?: number): number;\n    /**\n      * Sets the month value in the Date object using Universal Coordinated Time (UTC).\n      * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.\n      * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used.\n      */\n    setUTCMonth(month: number, date?: number): number;\n    /**\n      * Sets the year of the Date object using local time.\n      * @param year A numeric value for the year.\n      * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified.\n      * @param date A numeric value equal for the day of the month.\n      */\n    setFullYear(year: number, month?: number, date?: number): number;\n    /**\n      * Sets the year value in the Date object using Universal Coordinated Time (UTC).\n      * @param year A numeric value equal to the year.\n      * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied.\n      * @param date A numeric value equal to the day of the month.\n      */\n    setUTCFullYear(year: number, month?: number, date?: number): number;\n    /** Returns a date converted to a string using Universal Coordinated Time (UTC). */\n    toUTCString(): string;\n    /** Returns a date as a string value in ISO format. */\n    toISOString(): string;\n    /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */\n    toJSON(key?: any): string;\n}\n\ninterface DateConstructor {\n    new (): Date;\n    new (value: number): Date;\n    new (value: string): Date;\n    new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;\n    (): string;\n    readonly prototype: Date;\n    /**\n      * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970.\n      * @param s A date string\n      */\n    parse(s: string): number;\n    /**\n      * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.\n      * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.\n      * @param month The month as an number between 0 and 11 (January to December).\n      * @param date The date as an number between 1 and 31.\n      * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour.\n      * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes.\n      * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds.\n      * @param ms An number from 0 to 999 that specifies the milliseconds.\n      */\n    UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number;\n    now(): number;\n}\n\ndeclare const Date: DateConstructor;\n\ninterface RegExpMatchArray extends Array<string> {\n    index?: number;\n    input?: string;\n}\n\ninterface RegExpExecArray extends Array<string> {\n    index: number;\n    input: string;\n}\n\ninterface RegExp {\n    /**\n      * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search.\n      * @param string The String object or string literal on which to perform the search.\n      */\n    exec(string: string): RegExpExecArray | null;\n\n    /**\n      * Returns a Boolean value that indicates whether or not a pattern exists in a searched string.\n      * @param string String on which to perform the search.\n      */\n    test(string: string): boolean;\n\n    /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */\n    readonly source: string;\n\n    /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */\n    readonly global: boolean;\n\n    /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */\n    readonly ignoreCase: boolean;\n\n    /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */\n    readonly multiline: boolean;\n\n    lastIndex: number;\n\n    // Non-standard extensions\n    compile(): this;\n}\n\ninterface RegExpConstructor {\n    new (pattern: RegExp): RegExp;\n    new (pattern: string, flags?: string): RegExp;\n    (pattern: RegExp): RegExp;\n    (pattern: string, flags?: string): RegExp;\n    readonly prototype: RegExp;\n\n    // Non-standard extensions\n    $1: string;\n    $2: string;\n    $3: string;\n    $4: string;\n    $5: string;\n    $6: string;\n    $7: string;\n    $8: string;\n    $9: string;\n    lastMatch: string;\n}\n\ndeclare const RegExp: RegExpConstructor;\n\ninterface Error {\n    name: string;\n    message: string;\n    stack?: string;\n}\n\ninterface ErrorConstructor {\n    new (message?: string): Error;\n    (message?: string): Error;\n    readonly prototype: Error;\n}\n\ndeclare const Error: ErrorConstructor;\n\ninterface EvalError extends Error {\n}\n\ninterface EvalErrorConstructor {\n    new (message?: string): EvalError;\n    (message?: string): EvalError;\n    readonly prototype: EvalError;\n}\n\ndeclare const EvalError: EvalErrorConstructor;\n\ninterface RangeError extends Error {\n}\n\ninterface RangeErrorConstructor {\n    new (message?: string): RangeError;\n    (message?: string): RangeError;\n    readonly prototype: RangeError;\n}\n\ndeclare const RangeError: RangeErrorConstructor;\n\ninterface ReferenceError extends Error {\n}\n\ninterface ReferenceErrorConstructor {\n    new (message?: string): ReferenceError;\n    (message?: string): ReferenceError;\n    readonly prototype: ReferenceError;\n}\n\ndeclare const ReferenceError: ReferenceErrorConstructor;\n\ninterface SyntaxError extends Error {\n}\n\ninterface SyntaxErrorConstructor {\n    new (message?: string): SyntaxError;\n    (message?: string): SyntaxError;\n    readonly prototype: SyntaxError;\n}\n\ndeclare const SyntaxError: SyntaxErrorConstructor;\n\ninterface TypeError extends Error {\n}\n\ninterface TypeErrorConstructor {\n    new (message?: string): TypeError;\n    (message?: string): TypeError;\n    readonly prototype: TypeError;\n}\n\ndeclare const TypeError: TypeErrorConstructor;\n\ninterface URIError extends Error {\n}\n\ninterface URIErrorConstructor {\n    new (message?: string): URIError;\n    (message?: string): URIError;\n    readonly prototype: URIError;\n}\n\ndeclare const URIError: URIErrorConstructor;\n\ninterface JSON {\n    /**\n      * Converts a JavaScript Object Notation (JSON) string into an object.\n      * @param text A valid JSON string.\n      * @param reviver A function that transforms the results. This function is called for each member of the object.\n      * If a member contains nested objects, the nested objects are transformed before the parent object is.\n      */\n    parse(text: string, reviver?: (key: any, value: any) => any): any;\n    /**\n      * Converts a JavaScript value to a JavaScript Object Notation (JSON) string.\n      * @param value A JavaScript value, usually an object or array, to be converted.\n      * @param replacer A function that transforms the results.\n      * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.\n      */\n    stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string;\n    /**\n      * Converts a JavaScript value to a JavaScript Object Notation (JSON) string.\n      * @param value A JavaScript value, usually an object or array, to be converted.\n      * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified.\n      * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.\n      */\n    stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string;\n}\n\n/**\n  * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.\n  */\ndeclare const JSON: JSON;\n\n\n/////////////////////////////\n/// ECMAScript Array API (specially handled by compiler)\n/////////////////////////////\n\ninterface ReadonlyArray<T> {\n    /**\n      * Gets the length of the array. This is a number one higher than the highest element defined in an array.\n      */\n    readonly length: number;\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n    toLocaleString(): string;\n    /**\n      * Combines two or more arrays.\n      * @param items Additional items to add to the end of array1.\n      */\n    concat<U extends ReadonlyArray<T>>(...items: U[]): T[];\n    /**\n      * Combines two or more arrays.\n      * @param items Additional items to add to the end of array1.\n      */\n    concat(...items: T[][]): T[];\n    /**\n      * Combines two or more arrays.\n      * @param items Additional items to add to the end of array1.\n      */\n    concat(...items: (T | T[])[]): T[];\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): T[];\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\n      */\n    indexOf(searchElement: T, fromIndex?: number): number;\n\n    /**\n      * Returns the index of the last occurrence of a specified value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.\n      */\n    lastIndexOf(searchElement: T, fromIndex?: number): number;\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => boolean, thisArg?: any): boolean;\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => boolean, thisArg?: any): boolean;\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => void, thisArg?: any): void;\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    map<U>(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => U, thisArg?: any): U[];\n    /**\n     * Returns the elements of an array that meet the condition specified in a callback function.\n     * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.\n     * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n     */\n    filter<S extends T>(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => value is S, thisArg?: any): S[];\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => any, thisArg?: any): T[];\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray<T>) => T, initialValue?: T): T;\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray<T>) => U, initialValue: U): U;\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray<T>) => T, initialValue?: T): T;\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray<T>) => U, initialValue: U): U;\n\n    readonly [n: number]: T;\n}\n\ninterface Array<T> {\n    /**\n      * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.\n      */\n    length: number;\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n    toLocaleString(): string;\n    /**\n      * Appends new elements to an array, and returns the new length of the array.\n      * @param items New elements of the Array.\n      */\n    push(...items: T[]): number;\n    /**\n      * Removes the last element from an array and returns it.\n      */\n    pop(): T | undefined;\n    /**\n      * Combines two or more arrays.\n      * @param items Additional items to add to the end of array1.\n      */\n    concat(...items: T[][]): T[];\n    /**\n      * Combines two or more arrays.\n      * @param items Additional items to add to the end of array1.\n      */\n    concat(...items: (T | T[])[]): T[];\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): T[];\n    /**\n      * Removes the first element from an array and returns it.\n      */\n    shift(): T | undefined;\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): T[];\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: T, b: T) => number): this;\n    /**\n      * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.\n      * @param start The zero-based location in the array from which to start removing elements.\n      */\n    splice(start: number): T[];\n    /**\n      * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.\n      * @param start The zero-based location in the array from which to start removing elements.\n      * @param deleteCount The number of elements to remove.\n      * @param items Elements to insert into the array in place of the deleted elements.\n      */\n    splice(start: number, deleteCount: number, ...items: T[]): T[];\n    /**\n      * Inserts new elements at the start of an array.\n      * @param items  Elements to insert at the start of the Array.\n      */\n    unshift(...items: T[]): number;\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\n      */\n    indexOf(searchElement: T, fromIndex?: number): number;\n    /**\n      * Returns the index of the last occurrence of a specified value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.\n      */\n    lastIndexOf(searchElement: T, fromIndex?: number): number;\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    map<U>(this: [T, T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U, U];\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    map<U>(this: [T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U];\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    map<U>(this: [T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U];\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    map<U>(this: [T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U];\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[];\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;\n\n    [n: number]: T;\n}\n\ninterface ArrayConstructor {\n    new (arrayLength?: number): any[];\n    new <T>(arrayLength: number): T[];\n    new <T>(...items: T[]): T[];\n    (arrayLength?: number): any[];\n    <T>(arrayLength: number): T[];\n    <T>(...items: T[]): T[];\n    isArray(arg: any): arg is Array<any>;\n    readonly prototype: Array<any>;\n}\n\ndeclare const Array: ArrayConstructor;\n\ninterface TypedPropertyDescriptor<T> {\n    enumerable?: boolean;\n    configurable?: boolean;\n    writable?: boolean;\n    value?: T;\n    get?: () => T;\n    set?: (value: T) => void;\n}\n\ndeclare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;\ndeclare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;\ndeclare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;\ndeclare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;\n\ndeclare type PromiseConstructorLike = new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void) => PromiseLike<T>;\n\ninterface PromiseLike<T> {\n    /**\n     * Attaches callbacks for the resolution and/or rejection of the Promise.\n     * @param onfulfilled The callback to execute when the Promise is resolved.\n     * @param onrejected The callback to execute when the Promise is rejected.\n     * @returns A Promise for the completion of which ever callback is executed.\n     */\n    then(\n        onfulfilled?: ((value: T) => T | PromiseLike<T>) | undefined | null,\n        onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): PromiseLike<T>;\n\n    /**\n     * Attaches callbacks for the resolution and/or rejection of the Promise.\n     * @param onfulfilled The callback to execute when the Promise is resolved.\n     * @param onrejected The callback to execute when the Promise is rejected.\n     * @returns A Promise for the completion of which ever callback is executed.\n     */\n    then<TResult>(\n        onfulfilled: ((value: T) => T | PromiseLike<T>) | undefined | null,\n        onrejected: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<T | TResult>;\n\n    /**\n     * Attaches callbacks for the resolution and/or rejection of the Promise.\n     * @param onfulfilled The callback to execute when the Promise is resolved.\n     * @param onrejected The callback to execute when the Promise is rejected.\n     * @returns A Promise for the completion of which ever callback is executed.\n     */\n    then<TResult>(\n        onfulfilled: (value: T) => TResult | PromiseLike<TResult>,\n        onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): PromiseLike<TResult>;\n\n    /**\n     * Attaches callbacks for the resolution and/or rejection of the Promise.\n     * @param onfulfilled The callback to execute when the Promise is resolved.\n     * @param onrejected The callback to execute when the Promise is rejected.\n     * @returns A Promise for the completion of which ever callback is executed.\n     */\n    then<TResult1, TResult2>(\n        onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>,\n        onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): PromiseLike<TResult1 | TResult2>;\n}\n\ninterface ArrayLike<T> {\n    readonly length: number;\n    readonly [n: number]: T;\n}\n\n/**\n * Make all properties in T optional\n */\ntype Partial<T> = {\n    [P in keyof T]?: T[P];\n};\n\n/**\n * Make all properties in T readonly\n */\ntype Readonly<T> = {\n    readonly [P in keyof T]: T[P];\n};\n\n/**\n * From T pick a set of properties K\n */\ntype Pick<T, K extends keyof T> = {\n    [P in K]: T[P];\n}\n\n/**\n * Construct a type with a set of properties K of type T\n */\ntype Record<K extends string, T> = {\n    [P in K]: T;\n}\n\n/**\n  * Represents a raw buffer of binary data, which is used to store data for the\n  * different typed arrays. ArrayBuffers cannot be read from or written to directly,\n  * but can be passed to a typed array or DataView Object to interpret the raw\n  * buffer as needed.\n  */\ninterface ArrayBuffer {\n    /**\n      * Read-only. The length of the ArrayBuffer (in bytes).\n      */\n    readonly byteLength: number;\n\n    /**\n      * Returns a section of an ArrayBuffer.\n      */\n    slice(begin:number, end?:number): ArrayBuffer;\n}\n\ninterface ArrayBufferConstructor {\n    readonly prototype: ArrayBuffer;\n    new (byteLength: number): ArrayBuffer;\n    isView(arg: any): arg is ArrayBufferView;\n}\ndeclare const ArrayBuffer: ArrayBufferConstructor;\n\ninterface ArrayBufferView {\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    byteOffset: number;\n}\n\ninterface DataView {\n    readonly buffer: ArrayBuffer;\n    readonly byteLength: number;\n    readonly byteOffset: number;\n    /**\n      * Gets the Float32 value at the specified byte offset from the start of the view. There is\n      * no alignment constraint; multi-byte values may be fetched from any offset.\n      * @param byteOffset The place in the buffer at which the value should be retrieved.\n      */\n    getFloat32(byteOffset: number, littleEndian?: boolean): number;\n\n    /**\n      * Gets the Float64 value at the specified byte offset from the start of the view. There is\n      * no alignment constraint; multi-byte values may be fetched from any offset.\n      * @param byteOffset The place in the buffer at which the value should be retrieved.\n      */\n    getFloat64(byteOffset: number, littleEndian?: boolean): number;\n\n    /**\n      * Gets the Int8 value at the specified byte offset from the start of the view. There is\n      * no alignment constraint; multi-byte values may be fetched from any offset.\n      * @param byteOffset The place in the buffer at which the value should be retrieved.\n      */\n    getInt8(byteOffset: number): number;\n\n    /**\n      * Gets the Int16 value at the specified byte offset from the start of the view. There is\n      * no alignment constraint; multi-byte values may be fetched from any offset.\n      * @param byteOffset The place in the buffer at which the value should be retrieved.\n      */\n    getInt16(byteOffset: number, littleEndian?: boolean): number;\n    /**\n      * Gets the Int32 value at the specified byte offset from the start of the view. There is\n      * no alignment constraint; multi-byte values may be fetched from any offset.\n      * @param byteOffset The place in the buffer at which the value should be retrieved.\n      */\n    getInt32(byteOffset: number, littleEndian?: boolean): number;\n\n    /**\n      * Gets the Uint8 value at the specified byte offset from the start of the view. There is\n      * no alignment constraint; multi-byte values may be fetched from any offset.\n      * @param byteOffset The place in the buffer at which the value should be retrieved.\n      */\n    getUint8(byteOffset: number): number;\n\n    /**\n      * Gets the Uint16 value at the specified byte offset from the start of the view. There is\n      * no alignment constraint; multi-byte values may be fetched from any offset.\n      * @param byteOffset The place in the buffer at which the value should be retrieved.\n      */\n    getUint16(byteOffset: number, littleEndian?: boolean): number;\n\n    /**\n      * Gets the Uint32 value at the specified byte offset from the start of the view. There is\n      * no alignment constraint; multi-byte values may be fetched from any offset.\n      * @param byteOffset The place in the buffer at which the value should be retrieved.\n      */\n    getUint32(byteOffset: number, littleEndian?: boolean): number;\n\n    /**\n      * Stores an Float32 value at the specified byte offset from the start of the view.\n      * @param byteOffset The place in the buffer at which the value should be set.\n      * @param value The value to set.\n      * @param littleEndian If false or undefined, a big-endian value should be written,\n      * otherwise a little-endian value should be written.\n      */\n    setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n    /**\n      * Stores an Float64 value at the specified byte offset from the start of the view.\n      * @param byteOffset The place in the buffer at which the value should be set.\n      * @param value The value to set.\n      * @param littleEndian If false or undefined, a big-endian value should be written,\n      * otherwise a little-endian value should be written.\n      */\n    setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n    /**\n      * Stores an Int8 value at the specified byte offset from the start of the view.\n      * @param byteOffset The place in the buffer at which the value should be set.\n      * @param value The value to set.\n      */\n    setInt8(byteOffset: number, value: number): void;\n\n    /**\n      * Stores an Int16 value at the specified byte offset from the start of the view.\n      * @param byteOffset The place in the buffer at which the value should be set.\n      * @param value The value to set.\n      * @param littleEndian If false or undefined, a big-endian value should be written,\n      * otherwise a little-endian value should be written.\n      */\n    setInt16(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n    /**\n      * Stores an Int32 value at the specified byte offset from the start of the view.\n      * @param byteOffset The place in the buffer at which the value should be set.\n      * @param value The value to set.\n      * @param littleEndian If false or undefined, a big-endian value should be written,\n      * otherwise a little-endian value should be written.\n      */\n    setInt32(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n    /**\n      * Stores an Uint8 value at the specified byte offset from the start of the view.\n      * @param byteOffset The place in the buffer at which the value should be set.\n      * @param value The value to set.\n      */\n    setUint8(byteOffset: number, value: number): void;\n\n    /**\n      * Stores an Uint16 value at the specified byte offset from the start of the view.\n      * @param byteOffset The place in the buffer at which the value should be set.\n      * @param value The value to set.\n      * @param littleEndian If false or undefined, a big-endian value should be written,\n      * otherwise a little-endian value should be written.\n      */\n    setUint16(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n    /**\n      * Stores an Uint32 value at the specified byte offset from the start of the view.\n      * @param byteOffset The place in the buffer at which the value should be set.\n      * @param value The value to set.\n      * @param littleEndian If false or undefined, a big-endian value should be written,\n      * otherwise a little-endian value should be written.\n      */\n    setUint32(byteOffset: number, value: number, littleEndian?: boolean): void;\n}\n\ninterface DataViewConstructor {\n    new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;\n}\ndeclare const DataView: DataViewConstructor;\n\n/**\n  * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested\n  * number of bytes could not be allocated an exception is raised.\n  */\ninterface Int8Array {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Int8Array;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: ArrayLike<number>, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Int8Array;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Int8Array;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\ninterface Int8ArrayConstructor {\n    readonly prototype: Int8Array;\n    new (length: number): Int8Array;\n    new (array: ArrayLike<number>): Int8Array;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Int8Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array;\n\n}\ndeclare const Int8Array: Int8ArrayConstructor;\n\n/**\n  * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the\n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Uint8Array {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Uint8Array;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: ArrayLike<number>, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Uint8Array;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Uint8Array;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\n\ninterface Uint8ArrayConstructor {\n    readonly prototype: Uint8Array;\n    new (length: number): Uint8Array;\n    new (array: ArrayLike<number>): Uint8Array;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Uint8Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array;\n\n}\ndeclare const Uint8Array: Uint8ArrayConstructor;\n\n/**\n  * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.\n  * If the requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Uint8ClampedArray {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Uint8ClampedArray;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: Uint8ClampedArray, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Uint8ClampedArray;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Uint8ClampedArray;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\n\ninterface Uint8ClampedArrayConstructor {\n    readonly prototype: Uint8ClampedArray;\n    new (length: number): Uint8ClampedArray;\n    new (array: ArrayLike<number>): Uint8ClampedArray;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Uint8ClampedArray;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray;\n}\ndeclare const Uint8ClampedArray: Uint8ClampedArrayConstructor;\n\n/**\n  * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the\n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Int16Array {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Int16Array;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: ArrayLike<number>, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Int16Array;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Int16Array;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\n\ninterface Int16ArrayConstructor {\n    readonly prototype: Int16Array;\n    new (length: number): Int16Array;\n    new (array: ArrayLike<number>): Int16Array;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Int16Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array;\n\n}\ndeclare const Int16Array: Int16ArrayConstructor;\n\n/**\n  * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the\n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Uint16Array {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Uint16Array;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: ArrayLike<number>, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Uint16Array;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Uint16Array;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\n\ninterface Uint16ArrayConstructor {\n    readonly prototype: Uint16Array;\n    new (length: number): Uint16Array;\n    new (array: ArrayLike<number>): Uint16Array;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Uint16Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array;\n\n}\ndeclare const Uint16Array: Uint16ArrayConstructor;\n/**\n  * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the\n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Int32Array {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Int32Array;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: ArrayLike<number>, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Int32Array;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Int32Array;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\n\ninterface Int32ArrayConstructor {\n    readonly prototype: Int32Array;\n    new (length: number): Int32Array;\n    new (array: ArrayLike<number>): Int32Array;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Int32Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array;\n}\ndeclare const Int32Array: Int32ArrayConstructor;\n\n/**\n  * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the\n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Uint32Array {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Uint32Array;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: ArrayLike<number>, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Uint32Array;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Uint32Array;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\n\ninterface Uint32ArrayConstructor {\n    readonly prototype: Uint32Array;\n    new (length: number): Uint32Array;\n    new (array: ArrayLike<number>): Uint32Array;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Uint32Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array;\n}\ndeclare const Uint32Array: Uint32ArrayConstructor;\n\n/**\n  * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\n  * of bytes could not be allocated an exception is raised.\n  */\ninterface Float32Array {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Float32Array;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: ArrayLike<number>, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Float32Array;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Float32Array;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\n\ninterface Float32ArrayConstructor {\n    readonly prototype: Float32Array;\n    new (length: number): Float32Array;\n    new (array: ArrayLike<number>): Float32Array;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Float32Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array;\n\n}\ndeclare const Float32Array: Float32ArrayConstructor;\n\n/**\n  * A typed array of 64-bit float values. The contents are initialized to 0. If the requested\n  * number of bytes could not be allocated an exception is raised.\n  */\ninterface Float64Array {\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * The ArrayBuffer instance referenced by the array.\n      */\n    readonly buffer: ArrayBuffer;\n\n    /**\n      * The length in bytes of the array.\n      */\n    readonly byteLength: number;\n\n    /**\n      * The offset in bytes of the array.\n      */\n    readonly byteOffset: number;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n\n    /**\n      * Determines whether all the members of an array satisfy the specified test.\n      * @param callbackfn A function that accepts up to three arguments. The every method calls\n      * the callbackfn function for each element in array1 until the callbackfn returns false,\n      * or until the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean;\n\n    /**\n        * Returns the this object after filling the section identified by start and end with value\n        * @param value value to fill array section with\n        * @param start index to start filling the array at. If start is negative, it is treated as\n        * length+start where length is the length of the array.\n        * @param end index to stop filling the array at. If end is negative, it is treated as\n        * length+end.\n        */\n    fill(value: number, start?: number, end?: number): this;\n\n    /**\n      * Returns the elements of an array that meet the condition specified in a callback function.\n      * @param callbackfn A function that accepts up to three arguments. The filter method calls\n      * the callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    filter(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array;\n\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;\n\n    /**\n      * Performs the specified action for each element in an array.\n      * @param callbackfn  A function that accepts up to three arguments. forEach calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg  An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void;\n\n    /**\n      * Returns the index of the first occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      *  search starts at index 0.\n      */\n    indexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * Adds all the elements of an array separated by the specified separator string.\n      * @param separator A string used to separate one element of an array from the next in the\n      * resulting String. If omitted, the array elements are separated with a comma.\n      */\n    join(separator?: string): string;\n\n    /**\n      * Returns the index of the last occurrence of a value in an array.\n      * @param searchElement The value to locate in the array.\n      * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n      * search starts at index 0.\n      */\n    lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n    /**\n      * The length of the array.\n      */\n    readonly length: number;\n\n    /**\n      * Calls a defined callback function on each element of an array, and returns an array that\n      * contains the results.\n      * @param callbackfn A function that accepts up to three arguments. The map method calls the\n      * callbackfn function one time for each element in the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array. The return value of\n      * the callback function is the accumulated result, and is provided as an argument in the next\n      * call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n      * callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an\n      * argument instead of an array value.\n      */\n    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number;\n\n    /**\n      * Calls the specified callback function for all the elements in an array, in descending order.\n      * The return value of the callback function is the accumulated result, and is provided as an\n      * argument in the next call to the callback function.\n      * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n      * the callbackfn function one time for each element in the array.\n      * @param initialValue If initialValue is specified, it is used as the initial value to start\n      * the accumulation. The first call to the callbackfn function provides this value as an argument\n      * instead of an array value.\n      */\n    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U;\n\n    /**\n      * Reverses the elements in an Array.\n      */\n    reverse(): Float64Array;\n\n    /**\n      * Sets a value or an array of values.\n      * @param index The index of the location to set.\n      * @param value The value to set.\n      */\n    set(index: number, value: number): void;\n\n    /**\n      * Sets a value or an array of values.\n      * @param array A typed or untyped array of values to set.\n      * @param offset The index in the current array at which the values are to be written.\n      */\n    set(array: ArrayLike<number>, offset?: number): void;\n\n    /**\n      * Returns a section of an array.\n      * @param start The beginning of the specified portion of the array.\n      * @param end The end of the specified portion of the array.\n      */\n    slice(start?: number, end?: number): Float64Array;\n\n    /**\n      * Determines whether the specified callback function returns true for any element of an array.\n      * @param callbackfn A function that accepts up to three arguments. The some method calls the\n      * callbackfn function for each element in array1 until the callbackfn returns true, or until\n      * the end of the array.\n      * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n      * If thisArg is omitted, undefined is used as the this value.\n      */\n    some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean;\n\n    /**\n      * Sorts an array.\n      * @param compareFn The name of the function used to determine the order of the elements. If\n      * omitted, the elements are sorted in ascending, ASCII character order.\n      */\n    sort(compareFn?: (a: number, b: number) => number): this;\n\n    /**\n      * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements\n      * at begin, inclusive, up to end, exclusive.\n      * @param begin The index of the beginning of the array.\n      * @param end The index of the end of the array.\n      */\n    subarray(begin: number, end?: number): Float64Array;\n\n    /**\n      * Converts a number to a string by using the current locale.\n      */\n    toLocaleString(): string;\n\n    /**\n      * Returns a string representation of an array.\n      */\n    toString(): string;\n\n    [index: number]: number;\n}\n\ninterface Float64ArrayConstructor {\n    readonly prototype: Float64Array;\n    new (length: number): Float64Array;\n    new (array: ArrayLike<number>): Float64Array;\n    new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array;\n\n    /**\n      * The size in bytes of each element in the array.\n      */\n    readonly BYTES_PER_ELEMENT: number;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of(...items: number[]): Float64Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: ArrayLike<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;\n}\ndeclare const Float64Array: Float64ArrayConstructor;\n\n/////////////////////////////\n/// ECMAScript Internationalization API\n/////////////////////////////\n\ndeclare module Intl {\n    interface CollatorOptions {\n        usage?: string;\n        localeMatcher?: string;\n        numeric?: boolean;\n        caseFirst?: string;\n        sensitivity?: string;\n        ignorePunctuation?: boolean;\n    }\n\n    interface ResolvedCollatorOptions {\n        locale: string;\n        usage: string;\n        sensitivity: string;\n        ignorePunctuation: boolean;\n        collation: string;\n        caseFirst: string;\n        numeric: boolean;\n    }\n\n    interface Collator {\n        compare(x: string, y: string): number;\n        resolvedOptions(): ResolvedCollatorOptions;\n    }\n    var Collator: {\n        new (locales?: string | string[], options?: CollatorOptions): Collator;\n        (locales?: string | string[], options?: CollatorOptions): Collator;\n        supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[];\n    }\n\n    interface NumberFormatOptions {\n        localeMatcher?: string;\n        style?: string;\n        currency?: string;\n        currencyDisplay?: string;\n        useGrouping?: boolean;\n        minimumIntegerDigits?: number;\n        minimumFractionDigits?: number;\n        maximumFractionDigits?: number;\n        minimumSignificantDigits?: number;\n        maximumSignificantDigits?: number;\n    }\n\n    interface ResolvedNumberFormatOptions {\n        locale: string;\n        numberingSystem: string;\n        style: string;\n        currency?: string;\n        currencyDisplay?: string;\n        minimumIntegerDigits: number;\n        minimumFractionDigits: number;\n        maximumFractionDigits: number;\n        minimumSignificantDigits?: number;\n        maximumSignificantDigits?: number;\n        useGrouping: boolean;\n    }\n\n    interface NumberFormat {\n        format(value: number): string;\n        resolvedOptions(): ResolvedNumberFormatOptions;\n    }\n    var NumberFormat: {\n        new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;\n        (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;\n        supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[];\n    }\n\n    interface DateTimeFormatOptions {\n        localeMatcher?: string;\n        weekday?: string;\n        era?: string;\n        year?: string;\n        month?: string;\n        day?: string;\n        hour?: string;\n        minute?: string;\n        second?: string;\n        timeZoneName?: string;\n        formatMatcher?: string;\n        hour12?: boolean;\n        timeZone?: string;\n    }\n\n    interface ResolvedDateTimeFormatOptions {\n        locale: string;\n        calendar: string;\n        numberingSystem: string;\n        timeZone: string;\n        hour12?: boolean;\n        weekday?: string;\n        era?: string;\n        year?: string;\n        month?: string;\n        day?: string;\n        hour?: string;\n        minute?: string;\n        second?: string;\n        timeZoneName?: string;\n    }\n\n    interface DateTimeFormat {\n        format(date?: Date | number): string;\n        resolvedOptions(): ResolvedDateTimeFormatOptions;\n    }\n    var DateTimeFormat: {\n        new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;\n        (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;\n        supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[];\n    }\n}\n\ninterface String {\n    /**\n      * Determines whether two strings are equivalent in the current or specified locale.\n      * @param that String to compare to target string\n      * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.\n      * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.\n      */\n    localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number;\n}\n\ninterface Number {\n    /**\n      * Converts a number to a string by using the current or specified locale.\n      * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n      * @param options An object that contains one or more properties that specify comparison options.\n      */\n    toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;\n}\n\ninterface Date {\n    /**\n      * Converts a date and time to a string by using the current or specified locale.\n      * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n      * @param options An object that contains one or more properties that specify comparison options.\n      */\n    toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;\n    /**\n      * Converts a date to a string by using the current or specified locale.\n      * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n      * @param options An object that contains one or more properties that specify comparison options.\n      */\n    toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;\n\n    /**\n      * Converts a time to a string by using the current or specified locale.\n      * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n      * @param options An object that contains one or more properties that specify comparison options.\n      */\n    toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;\n}\n\n\ndeclare type PropertyKey = string | number | symbol;\n\ninterface Array<T> {\n    /**\n      * Returns the value of the first element in the array where predicate is true, and undefined\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found, find\n      * immediately returns that element value. Otherwise, find returns undefined.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T | undefined;\n\n    /**\n      * Returns the index of the first element in the array where predicate is true, and -1\n      * otherwise.\n      * @param predicate find calls predicate once for each element of the array, in ascending\n      * order, until it finds one where predicate returns true. If such an element is found,\n      * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n      * @param thisArg If provided, it will be used as the this value for each invocation of\n      * predicate. If it is not provided, undefined is used instead.\n      */\n    findIndex(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): number;\n\n    /**\n      * Returns the this object after filling the section identified by start and end with value\n      * @param value value to fill array section with\n      * @param start index to start filling the array at. If start is negative, it is treated as\n      * length+start where length is the length of the array.\n      * @param end index to stop filling the array at. If end is negative, it is treated as\n      * length+end.\n      */\n    fill(value: T, start?: number, end?: number): this;\n\n    /**\n      * Returns the this object after copying a section of the array identified by start and end\n      * to the same array starting at position target\n      * @param target If target is negative, it is treated as length+target where length is the\n      * length of the array.\n      * @param start If start is negative, it is treated as length+start. If end is negative, it\n      * is treated as length+end.\n      * @param end If not specified, length of the this object is used as its default value.\n      */\n    copyWithin(target: number, start: number, end?: number): this;\n}\n\ninterface ArrayConstructor {\n    /**\n      * Creates an array from an array-like object.\n      * @param arrayLike An array-like object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): Array<U>;\n\n\n    /**\n      * Creates an array from an array-like object.\n      * @param arrayLike An array-like object to convert to an array.\n      */\n    from<T>(arrayLike: ArrayLike<T>): Array<T>;\n\n    /**\n      * Returns a new array from a set of elements.\n      * @param items A set of elements to include in the new array object.\n      */\n    of<T>(...items: T[]): Array<T>;\n}\n\ninterface DateConstructor {\n    new (value: Date): Date;\n}\n\ninterface Function {\n    /**\n      * Returns the name of the function. Function names are read-only and can not be changed.\n      */\n    readonly name: string;\n}\n\ninterface Math {\n    /**\n      * Returns the number of leading zero bits in the 32-bit binary representation of a number.\n      * @param x A numeric expression.\n      */\n    clz32(x: number): number;\n\n    /**\n      * Returns the result of 32-bit multiplication of two numbers.\n      * @param x First number\n      * @param y Second number\n      */\n    imul(x: number, y: number): number;\n\n    /**\n      * Returns the sign of the x, indicating whether x is positive, negative or zero.\n      * @param x The numeric expression to test\n      */\n    sign(x: number): number;\n\n    /**\n      * Returns the base 10 logarithm of a number.\n      * @param x A numeric expression.\n      */\n    log10(x: number): number;\n\n    /**\n      * Returns the base 2 logarithm of a number.\n      * @param x A numeric expression.\n      */\n    log2(x: number): number;\n\n    /**\n      * Returns the natural logarithm of 1 + x.\n      * @param x A numeric expression.\n      */\n    log1p(x: number): number;\n\n    /**\n      * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of\n      * the natural logarithms).\n      * @param x A numeric expression.\n      */\n    expm1(x: number): number;\n\n    /**\n      * Returns the hyperbolic cosine of a number.\n      * @param x A numeric expression that contains an angle measured in radians.\n      */\n    cosh(x: number): number;\n\n    /**\n      * Returns the hyperbolic sine of a number.\n      * @param x A numeric expression that contains an angle measured in radians.\n      */\n    sinh(x: number): number;\n\n    /**\n      * Returns the hyperbolic tangent of a number.\n      * @param x A numeric expression that contains an angle measured in radians.\n      */\n    tanh(x: number): number;\n\n    /**\n      * Returns the inverse hyperbolic cosine of a number.\n      * @param x A numeric expression that contains an angle measured in radians.\n      */\n    acosh(x: number): number;\n\n    /**\n      * Returns the inverse hyperbolic sine of a number.\n      * @param x A numeric expression that contains an angle measured in radians.\n      */\n    asinh(x: number): number;\n\n    /**\n      * Returns the inverse hyperbolic tangent of a number.\n      * @param x A numeric expression that contains an angle measured in radians.\n      */\n    atanh(x: number): number;\n\n    /**\n      * Returns the square root of the sum of squares of its arguments.\n      * @param values Values to compute the square root for.\n      *     If no arguments are passed, the result is +0.\n      *     If there is only one argument, the result is the absolute value.\n      *     If any argument is +Infinity or -Infinity, the result is +Infinity.\n      *     If any argument is NaN, the result is NaN.\n      *     If all arguments are either +0 or −0, the result is +0.\n      */\n    hypot(...values: number[] ): number;\n\n    /**\n      * Returns the integral part of the a numeric expression, x, removing any fractional digits.\n      * If x is already an integer, the result is x.\n      * @param x A numeric expression.\n      */\n    trunc(x: number): number;\n\n    /**\n      * Returns the nearest single precision float representation of a number.\n      * @param x A numeric expression.\n      */\n    fround(x: number): number;\n\n    /**\n      * Returns an implementation-dependent approximation to the cube root of number.\n      * @param x A numeric expression.\n      */\n    cbrt(x: number): number;\n}\n\ninterface NumberConstructor {\n    /**\n      * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1\n      * that is representable as a Number value, which is approximately:\n      * 2.2204460492503130808472633361816 x 10‍−‍16.\n      */\n    readonly EPSILON: number;\n\n    /**\n      * Returns true if passed value is finite.\n      * Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a\n      * number. Only finite values of the type number, result in true.\n      * @param number A numeric value.\n      */\n    isFinite(number: number): boolean;\n\n    /**\n      * Returns true if the value passed is an integer, false otherwise.\n      * @param number A numeric value.\n      */\n    isInteger(number: number): boolean;\n\n    /**\n      * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a\n      * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter\n      * to a number. Only values of the type number, that are also NaN, result in true.\n      * @param number A numeric value.\n      */\n    isNaN(number: number): boolean;\n\n    /**\n      * Returns true if the value passed is a safe integer.\n      * @param number A numeric value.\n      */\n    isSafeInteger(number: number): boolean;\n\n    /**\n      * The value of the largest integer n such that n and n + 1 are both exactly representable as\n      * a Number value.\n      * The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1.\n      */\n    readonly MAX_SAFE_INTEGER: number;\n\n    /**\n      * The value of the smallest integer n such that n and n − 1 are both exactly representable as\n      * a Number value.\n      * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)).\n      */\n    readonly MIN_SAFE_INTEGER: number;\n\n    /**\n      * Converts a string to a floating-point number.\n      * @param string A string that contains a floating-point number.\n      */\n    parseFloat(string: string): number;\n\n    /**\n      * Converts A string to an integer.\n      * @param s A string to convert into a number.\n      * @param radix A value between 2 and 36 that specifies the base of the number in numString.\n      * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\n      * All other strings are considered decimal.\n      */\n    parseInt(string: string, radix?: number): number;\n}\n\ninterface Object {\n    /**\n      * Determines whether an object has a property with the specified name.\n      * @param v A property name.\n      */\n    hasOwnProperty(v: PropertyKey): boolean\n\n    /**\n      * Determines whether a specified property is enumerable.\n      * @param v A property name.\n      */\n    propertyIsEnumerable(v: PropertyKey): boolean;\n}\n\ninterface ObjectConstructor {\n    /**\n      * Copy the values of all of the enumerable own properties from one or more source objects to a\n      * target object. Returns the target object.\n      * @param target The target object to copy to.\n      * @param source The source object from which to copy properties.\n      */\n    assign<T, U>(target: T, source: U): T & U;\n\n    /**\n      * Copy the values of all of the enumerable own properties from one or more source objects to a\n      * target object. Returns the target object.\n      * @param target The target object to copy to.\n      * @param source1 The first source object from which to copy properties.\n      * @param source2 The second source object from which to copy properties.\n      */\n    assign<T, U, V>(target: T, source1: U, source2: V): T & U & V;\n\n    /**\n      * Copy the values of all of the enumerable own properties from one or more source objects to a\n      * target object. Returns the target object.\n      * @param target The target object to copy to.\n      * @param source1 The first source object from which to copy properties.\n      * @param source2 The second source object from which to copy properties.\n      * @param source3 The third source object from which to copy properties.\n      */\n    assign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;\n\n    /**\n      * Copy the values of all of the enumerable own properties from one or more source objects to a\n      * target object. Returns the target object.\n      * @param target The target object to copy to.\n      * @param sources One or more source objects from which to copy properties\n      */\n    assign(target: any, ...sources: any[]): any;\n\n    /**\n      * Returns an array of all symbol properties found directly on object o.\n      * @param o Object to retrieve the symbols from.\n      */\n    getOwnPropertySymbols(o: any): symbol[];\n\n    /**\n      * Returns true if the values are the same value, false otherwise.\n      * @param value1 The first value.\n      * @param value2 The second value.\n      */\n    is(value1: any, value2: any): boolean;\n\n    /**\n      * Sets the prototype of a specified object o to  object proto or null. Returns the object o.\n      * @param o The object to change its prototype.\n      * @param proto The value of the new prototype or null.\n      */\n    setPrototypeOf(o: any, proto: any): any;\n\n    /**\n      * Gets the own property descriptor of the specified object.\n      * An own property descriptor is one that is defined directly on the object and is not\n      * inherited from the object's prototype.\n      * @param o Object that contains the property.\n      * @param p Name of the property.\n    */\n    getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor;\n\n    /**\n      * Adds a property to an object, or modifies attributes of an existing property.\n      * @param o Object on which to add or modify the property. This can be a native JavaScript\n      * object (that is, a user-defined object or a built in object) or a DOM object.\n      * @param p The property name.\n      * @param attributes Descriptor for the property. It can be for a data property or an accessor\n      *  property.\n      */\n    defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any;\n}\n\ninterface ReadonlyArray<T> {\n  /**\n    * Returns the value of the first element in the array where predicate is true, and undefined\n    * otherwise.\n    * @param predicate find calls predicate once for each element of the array, in ascending\n    * order, until it finds one where predicate returns true. If such an element is found, find\n    * immediately returns that element value. Otherwise, find returns undefined.\n    * @param thisArg If provided, it will be used as the this value for each invocation of\n    * predicate. If it is not provided, undefined is used instead.\n    */\n  find(predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean, thisArg?: any): T | undefined;\n\n  /**\n    * Returns the index of the first element in the array where predicate is true, and -1\n    * otherwise.\n    * @param predicate find calls predicate once for each element of the array, in ascending\n    * order, until it finds one where predicate returns true. If such an element is found,\n    * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n    * @param thisArg If provided, it will be used as the this value for each invocation of\n    * predicate. If it is not provided, undefined is used instead.\n    */\n  findIndex(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): number;\n}\n\ninterface RegExp {\n    /**\n      * Returns a string indicating the flags of the regular expression in question. This field is read-only.\n      * The characters in this string are sequenced and concatenated in the following order:\n      *\n      *    - \"g\" for global\n      *    - \"i\" for ignoreCase\n      *    - \"m\" for multiline\n      *    - \"u\" for unicode\n      *    - \"y\" for sticky\n      *\n      * If no flags are set, the value is the empty string.\n      */\n    readonly flags: string;\n\n    /**\n      * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular\n      * expression. Default is false. Read-only.\n      */\n    readonly sticky: boolean;\n\n    /**\n      * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular\n      * expression. Default is false. Read-only.\n      */\n    readonly unicode: boolean;\n}\n\ninterface RegExpConstructor {\n    new (pattern: RegExp, flags?: string): RegExp;\n    (pattern: RegExp, flags?: string): RegExp;\n}\n\ninterface String {\n    /**\n      * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point\n      * value of the UTF-16 encoded code point starting at the string element at position pos in\n      * the String resulting from converting this object to a String.\n      * If there is no element at that position, the result is undefined.\n      * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.\n      */\n    codePointAt(pos: number): number | undefined;\n\n    /**\n      * Returns true if searchString appears as a substring of the result of converting this\n      * object to a String, at one or more positions that are\n      * greater than or equal to position; otherwise, returns false.\n      * @param searchString search string\n      * @param position If position is undefined, 0 is assumed, so as to search all of the String.\n      */\n    includes(searchString: string, position?: number): boolean;\n\n    /**\n      * Returns true if the sequence of elements of searchString converted to a String is the\n      * same as the corresponding elements of this object (converted to a String) starting at\n      * endPosition – length(this). Otherwise returns false.\n      */\n    endsWith(searchString: string, endPosition?: number): boolean;\n\n    /**\n      * Returns the String value result of normalizing the string into the normalization form\n      * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.\n      * @param form Applicable values: \"NFC\", \"NFD\", \"NFKC\", or \"NFKD\", If not specified default\n      * is \"NFC\"\n      */\n    normalize(form: \"NFC\" | \"NFD\" | \"NFKC\" | \"NFKD\"): string;\n\n    /**\n      * Returns the String value result of normalizing the string into the normalization form\n      * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.\n      * @param form Applicable values: \"NFC\", \"NFD\", \"NFKC\", or \"NFKD\", If not specified default\n      * is \"NFC\"\n      */\n    normalize(form?: string): string;\n\n    /**\n      * Returns a String value that is made from count copies appended together. If count is 0,\n      * T is the empty String is returned.\n      * @param count number of copies to append\n      */\n    repeat(count: number): string;\n\n    /**\n      * Returns true if the sequence of elements of searchString converted to a String is the\n      * same as the corresponding elements of this object (converted to a String) starting at\n      * position. Otherwise returns false.\n      */\n    startsWith(searchString: string, position?: number): boolean;\n\n    /**\n      * Returns an <a> HTML anchor element and sets the name attribute to the text value\n      * @param name\n      */\n    anchor(name: string): string;\n\n    /** Returns a <big> HTML element */\n    big(): string;\n\n    /** Returns a <blink> HTML element */\n    blink(): string;\n\n    /** Returns a <b> HTML element */\n    bold(): string;\n\n    /** Returns a <tt> HTML element */\n    fixed(): string\n\n    /** Returns a <font> HTML element and sets the color attribute value */\n    fontcolor(color: string): string\n\n    /** Returns a <font> HTML element and sets the size attribute value */\n    fontsize(size: number): string;\n\n    /** Returns a <font> HTML element and sets the size attribute value */\n    fontsize(size: string): string;\n\n    /** Returns an <i> HTML element */\n    italics(): string;\n\n    /** Returns an <a> HTML element and sets the href attribute value */\n    link(url: string): string;\n\n    /** Returns a <small> HTML element */\n    small(): string;\n\n    /** Returns a <strike> HTML element */\n    strike(): string;\n\n    /** Returns a <sub> HTML element */\n    sub(): string;\n\n    /** Returns a <sup> HTML element */\n    sup(): string;\n}\n\ninterface StringConstructor {\n    /**\n      * Return the String value whose elements are, in order, the elements in the List elements.\n      * If length is 0, the empty string is returned.\n      */\n    fromCodePoint(...codePoints: number[]): string;\n\n    /**\n      * String.raw is intended for use as a tag function of a Tagged Template String. When called\n      * as such the first argument will be a well formed template call site object and the rest\n      * parameter will contain the substitution values.\n      * @param template A well-formed template string call site representation.\n      * @param substitutions A set of substitution values.\n      */\n    raw(template: TemplateStringsArray, ...substitutions: any[]): string;\n}\n\n\ninterface Map<K, V> {\n    clear(): void;\n    delete(key: K): boolean;\n    forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;\n    get(key: K): V | undefined;\n    has(key: K): boolean;\n    set(key: K, value?: V): this;\n    readonly size: number;\n}\n\ninterface MapConstructor {\n    new (): Map<any, any>;\n    new <K, V>(entries?: [K, V][]): Map<K, V>;\n    readonly prototype: Map<any, any>;\n}\ndeclare var Map: MapConstructor;\n\ninterface ReadonlyMap<K, V> {\n    forEach(callbackfn: (value: V, key: K, map: ReadonlyMap<K, V>) => void, thisArg?: any): void;\n    get(key: K): V|undefined;\n    has(key: K): boolean;\n    readonly size: number;\n}\n\ninterface WeakMap<K, V> {\n    delete(key: K): boolean;\n    get(key: K): V | undefined;\n    has(key: K): boolean;\n    set(key: K, value?: V): this;\n}\n\ninterface WeakMapConstructor {\n    new (): WeakMap<any, any>;\n    new <K, V>(entries?: [K, V][]): WeakMap<K, V>;\n    readonly prototype: WeakMap<any, any>;\n}\ndeclare var WeakMap: WeakMapConstructor;\n\ninterface Set<T> {\n    add(value: T): this;\n    clear(): void;\n    delete(value: T): boolean;\n    forEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void;\n    has(value: T): boolean;\n    readonly size: number;\n}\n\ninterface SetConstructor {\n    new (): Set<any>;\n    new <T>(values?: T[]): Set<T>;\n    readonly prototype: Set<any>;\n}\ndeclare var Set: SetConstructor;\n\ninterface ReadonlySet<T> {\n    forEach(callbackfn: (value: T, value2: T, set: ReadonlySet<T>) => void, thisArg?: any): void;\n    has(value: T): boolean;\n    readonly size: number;\n}\n\ninterface WeakSet<T> {\n    add(value: T): this;\n    delete(value: T): boolean;\n    has(value: T): boolean;\n}\n\ninterface WeakSetConstructor {\n    new (): WeakSet<any>;\n    new <T>(values?: T[]): WeakSet<T>;\n    readonly prototype: WeakSet<any>;\n}\ndeclare var WeakSet: WeakSetConstructor;\n\n\ninterface GeneratorFunction extends Function { }\n\ninterface GeneratorFunctionConstructor {\n    /**\n      * Creates a new Generator function.\n      * @param args A list of arguments the function accepts.\n      */\n    new (...args: string[]): GeneratorFunction;\n    (...args: string[]): GeneratorFunction;\n    readonly prototype: GeneratorFunction;\n}\ndeclare var GeneratorFunction: GeneratorFunctionConstructor;\n\n\n/// <reference path=\"lib.es2015.symbol.d.ts\" />\n\ninterface SymbolConstructor {\n    /** \n      * A method that returns the default iterator for an object. Called by the semantics of the \n      * for-of statement.\n      */\n    readonly iterator: symbol;\n}\n\ninterface IteratorResult<T> {\n    done: boolean;\n    value: T;\n}\n\ninterface Iterator<T> {\n    next(value?: any): IteratorResult<T>;\n    return?(value?: any): IteratorResult<T>;\n    throw?(e?: any): IteratorResult<T>;\n}\n\ninterface Iterable<T> {\n    [Symbol.iterator](): Iterator<T>;\n}\n\ninterface IterableIterator<T> extends Iterator<T> {\n    [Symbol.iterator](): IterableIterator<T>;\n}\n\ninterface Array<T> {\n    /** Iterator */\n    [Symbol.iterator](): IterableIterator<T>;\n\n    /** \n      * Returns an array of key, value pairs for every entry in the array\n      */\n    entries(): IterableIterator<[number, T]>;\n\n    /** \n      * Returns an list of keys in the array\n      */\n    keys(): IterableIterator<number>;\n\n    /** \n      * Returns an list of values in the array\n      */\n    values(): IterableIterator<T>;\n}\n\ninterface ArrayConstructor {\n    /**\n      * Creates an array from an iterable object.\n      * @param iterable An iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from<T, U>(iterable: Iterable<T>, mapfn: (v: T, k: number) => U, thisArg?: any): Array<U>;\n    \n    /**\n      * Creates an array from an iterable object.\n      * @param iterable An iterable object to convert to an array.\n      */\n    from<T>(iterable: Iterable<T>): Array<T>;\n}\n\ninterface ReadonlyArray<T> {\n    /** Iterator */\n    [Symbol.iterator](): IterableIterator<T>;\n\n    /** \n      * Returns an array of key, value pairs for every entry in the array\n      */\n    entries(): IterableIterator<[number, T]>;\n\n    /** \n      * Returns an list of keys in the array\n      */\n    keys(): IterableIterator<number>;\n\n    /** \n      * Returns an list of values in the array\n      */\n    values(): IterableIterator<T>;\n}\n\ninterface IArguments {\n    /** Iterator */\n    [Symbol.iterator](): IterableIterator<any>;\n}\n\ninterface Map<K, V> {\n    [Symbol.iterator](): IterableIterator<[K,V]>;\n    entries(): IterableIterator<[K, V]>;\n    keys(): IterableIterator<K>;\n    values(): IterableIterator<V>;\n}\n\ninterface MapConstructor {\n    new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;\n}\n\ninterface WeakMap<K, V> { }\n\ninterface WeakMapConstructor {\n    new <K, V>(iterable: Iterable<[K, V]>): WeakMap<K, V>;\n}\n\ninterface Set<T> {\n    [Symbol.iterator](): IterableIterator<T>;\n    entries(): IterableIterator<[T, T]>;\n    keys(): IterableIterator<T>;\n    values(): IterableIterator<T>;\n}\n\ninterface SetConstructor {\n    new <T>(iterable: Iterable<T>): Set<T>;\n}\n\ninterface WeakSet<T> { }\n\ninterface WeakSetConstructor {\n    new <T>(iterable: Iterable<T>): WeakSet<T>;\n}\n\ninterface Promise<T> { }\n\ninterface PromiseConstructor {\n    /**\n     * Creates a Promise that is resolved with an array of results when all of the provided Promises \n     * resolve, or rejected when any Promise is rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    all<TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>;\n    \n    /**\n     * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved \n     * or rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    race<T>(values: Iterable<T | PromiseLike<T>>): Promise<T>;\n}\n\ndeclare namespace Reflect {\n    function enumerate(target: any): IterableIterator<any>;\n}\n\ninterface String {\n    /** Iterator */\n    [Symbol.iterator](): IterableIterator<string>;\n}\n\n/**\n  * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested \n  * number of bytes could not be allocated an exception is raised.\n  */\ninterface Int8Array {\n    [Symbol.iterator](): IterableIterator<number>;\n    /** \n      * Returns an array of key, value pairs for every entry in the array\n      */\n    entries(): IterableIterator<[number, number]>;\n    /** \n      * Returns an list of keys in the array\n      */\n    keys(): IterableIterator<number>;\n    /** \n      * Returns an list of values in the array\n      */\n    values(): IterableIterator<number>;\n}\n\ninterface Int8ArrayConstructor {\n    new (elements: Iterable<number>): Int8Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array;\n}\n\n/**\n  * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the \n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Uint8Array {\n    [Symbol.iterator](): IterableIterator<number>;\n    /** \n      * Returns an array of key, value pairs for every entry in the array\n      */\n    entries(): IterableIterator<[number, number]>;\n    /** \n      * Returns an list of keys in the array\n      */\n    keys(): IterableIterator<number>;\n    /** \n      * Returns an list of values in the array\n      */\n    values(): IterableIterator<number>;\n}\n\ninterface Uint8ArrayConstructor {\n    new (elements: Iterable<number>): Uint8Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array;\n}\n\n/**\n  * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. \n  * If the requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Uint8ClampedArray {\n    [Symbol.iterator](): IterableIterator<number>;\n    /** \n      * Returns an array of key, value pairs for every entry in the array\n      */\n    entries(): IterableIterator<[number, number]>;\n\n    /** \n      * Returns an list of keys in the array\n      */\n    keys(): IterableIterator<number>;\n\n    /** \n      * Returns an list of values in the array\n      */\n    values(): IterableIterator<number>;\n}\n\ninterface Uint8ClampedArrayConstructor {\n    new (elements: Iterable<number>): Uint8ClampedArray;\n\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray;\n}\n\n/**\n  * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the \n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Int16Array {\n    [Symbol.iterator](): IterableIterator<number>;\n    /** \n      * Returns an array of key, value pairs for every entry in the array\n      */\n    entries(): IterableIterator<[number, number]>;\n\n    /** \n      * Returns an list of keys in the array\n      */\n    keys(): IterableIterator<number>;\n\n    /** \n      * Returns an list of values in the array\n      */\n    values(): IterableIterator<number>;\n}\n\ninterface Int16ArrayConstructor {\n    new (elements: Iterable<number>): Int16Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array;\n}\n\n/**\n  * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the \n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Uint16Array {\n    [Symbol.iterator](): IterableIterator<number>;\n    /** \n      * Returns an array of key, value pairs for every entry in the array\n      */\n    entries(): IterableIterator<[number, number]>;\n    /** \n      * Returns an list of keys in the array\n      */\n    keys(): IterableIterator<number>;\n    /** \n      * Returns an list of values in the array\n      */\n    values(): IterableIterator<number>;\n}\n\ninterface Uint16ArrayConstructor {\n    new (elements: Iterable<number>): Uint16Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array;\n}\n\n/**\n  * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the \n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Int32Array {\n    [Symbol.iterator](): IterableIterator<number>;\n    /** \n      * Returns an array of key, value pairs for every entry in the array\n      */\n    entries(): IterableIterator<[number, number]>;\n    /** \n      * Returns an list of keys in the array\n      */\n    keys(): IterableIterator<number>;\n    /** \n      * Returns an list of values in the array\n      */\n    values(): IterableIterator<number>;\n}\n\ninterface Int32ArrayConstructor {\n    new (elements: Iterable<number>): Int32Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array;\n}\n\n/**\n  * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the \n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Uint32Array {\n    [Symbol.iterator](): IterableIterator<number>;\n    /** \n      * Returns an array of key, value pairs for every entry in the array\n      */\n    entries(): IterableIterator<[number, number]>;\n    /** \n      * Returns an list of keys in the array\n      */\n    keys(): IterableIterator<number>;\n    /** \n      * Returns an list of values in the array\n      */\n    values(): IterableIterator<number>;\n}\n\ninterface Uint32ArrayConstructor {\n    new (elements: Iterable<number>): Uint32Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array;\n}\n\n/**\n  * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\n  * of bytes could not be allocated an exception is raised.\n  */\ninterface Float32Array {\n    [Symbol.iterator](): IterableIterator<number>;\n    /** \n      * Returns an array of key, value pairs for every entry in the array\n      */\n    entries(): IterableIterator<[number, number]>;\n    /** \n      * Returns an list of keys in the array\n      */\n    keys(): IterableIterator<number>;\n    /** \n      * Returns an list of values in the array\n      */\n    values(): IterableIterator<number>;\n}\n\ninterface Float32ArrayConstructor {\n    new (elements: Iterable<number>): Float32Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array;\n}\n\n/**\n  * A typed array of 64-bit float values. The contents are initialized to 0. If the requested \n  * number of bytes could not be allocated an exception is raised.\n  */\ninterface Float64Array {\n    [Symbol.iterator](): IterableIterator<number>;\n    /** \n      * Returns an array of key, value pairs for every entry in the array\n      */\n    entries(): IterableIterator<[number, number]>;\n    /** \n      * Returns an list of keys in the array\n      */\n    keys(): IterableIterator<number>;\n    /** \n      * Returns an list of values in the array\n      */\n    values(): IterableIterator<number>;\n}\n\ninterface Float64ArrayConstructor {\n    new (elements: Iterable<number>): Float64Array;\n\n    /**\n      * Creates an array from an array-like or iterable object.\n      * @param arrayLike An array-like or iterable object to convert to an array.\n      * @param mapfn A mapping function to call on every element of the array.\n      * @param thisArg Value of 'this' used to invoke the mapfn.\n      */\n    from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;\n}\n\n/**\n * Represents the completion of an asynchronous operation\n */\ninterface Promise<T> {\n    /**\n     * Attaches callbacks for the resolution and/or rejection of the Promise.\n     * @param onfulfilled The callback to execute when the Promise is resolved.\n     * @param onrejected The callback to execute when the Promise is rejected.\n     * @returns A Promise for the completion of which ever callback is executed.\n     */\n    then(onfulfilled?: ((value: T) => T | PromiseLike<T>) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): Promise<T>;\n\n    /**\n     * Attaches callbacks for the resolution and/or rejection of the Promise.\n     * @param onfulfilled The callback to execute when the Promise is resolved.\n     * @param onrejected The callback to execute when the Promise is rejected.\n     * @returns A Promise for the completion of which ever callback is executed.\n     */\n    then<TResult>(onfulfilled: ((value: T) => T | PromiseLike<T>) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>;\n\n    /**\n     * Attaches callbacks for the resolution and/or rejection of the Promise.\n     * @param onfulfilled The callback to execute when the Promise is resolved.\n     * @param onrejected The callback to execute when the Promise is rejected.\n     * @returns A Promise for the completion of which ever callback is executed.\n     */\n    then<TResult>(onfulfilled: (value: T) => TResult | PromiseLike<TResult>, onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<TResult>;\n\n    /**\n     * Attaches callbacks for the resolution and/or rejection of the Promise.\n     * @param onfulfilled The callback to execute when the Promise is resolved.\n     * @param onrejected The callback to execute when the Promise is rejected.\n     * @returns A Promise for the completion of which ever callback is executed.\n     */\n    then<TResult1, TResult2>(onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;\n\n    /**\n     * Attaches a callback for only the rejection of the Promise.\n     * @param onrejected The callback to execute when the Promise is rejected.\n     * @returns A Promise for the completion of the callback.\n     */\n    catch(onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): Promise<T>;\n\n    /**\n     * Attaches a callback for only the rejection of the Promise.\n     * @param onrejected The callback to execute when the Promise is rejected.\n     * @returns A Promise for the completion of the callback.\n     */\n    catch<TResult>(onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>;\n}\n\ninterface PromiseConstructor {\n    /**\n      * A reference to the prototype.\n      */\n    readonly prototype: Promise<any>;\n\n    /**\n     * Creates a new Promise.\n     * @param executor A callback used to initialize the promise. This callback is passed two arguments:\n     * a resolve callback used resolve the promise with a value or the result of another promise,\n     * and a reject callback used to reject the promise with a provided reason or error.\n     */\n    new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;\n\n    /**\n     * Creates a Promise that is resolved with an array of results when all of the provided Promises\n     * resolve, or rejected when any Promise is rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;\n\n    /**\n     * Creates a Promise that is resolved with an array of results when all of the provided Promises\n     * resolve, or rejected when any Promise is rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;\n\n    /**\n     * Creates a Promise that is resolved with an array of results when all of the provided Promises\n     * resolve, or rejected when any Promise is rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;\n\n    /**\n     * Creates a Promise that is resolved with an array of results when all of the provided Promises\n     * resolve, or rejected when any Promise is rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;\n\n    /**\n     * Creates a Promise that is resolved with an array of results when all of the provided Promises\n     * resolve, or rejected when any Promise is rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;\n\n    /**\n     * Creates a Promise that is resolved with an array of results when all of the provided Promises\n     * resolve, or rejected when any Promise is rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;\n\n    /**\n     * Creates a Promise that is resolved with an array of results when all of the provided Promises\n     * resolve, or rejected when any Promise is rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;\n\n    /**\n     * Creates a Promise that is resolved with an array of results when all of the provided Promises\n     * resolve, or rejected when any Promise is rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;\n\n    /**\n     * Creates a Promise that is resolved with an array of results when all of the provided Promises\n     * resolve, or rejected when any Promise is rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;\n\n    /**\n     * Creates a Promise that is resolved with an array of results when all of the provided Promises\n     * resolve, or rejected when any Promise is rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    all<T>(values: (T | PromiseLike<T>)[]): Promise<T[]>;\n\n    /**\n     * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n     * or rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    race<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10>;\n\n    /**\n     * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n     * or rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    race<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>;\n\n    /**\n     * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n     * or rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    race<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8>;\n\n    /**\n     * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n     * or rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    race<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7>;\n\n    /**\n     * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n     * or rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    race<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<T1 | T2 | T3 | T4 | T5 | T6>;\n\n    /**\n     * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n     * or rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    race<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>]): Promise<T1 | T2 | T3 | T4 | T5>;\n\n    /**\n     * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n     * or rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    race<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>]): Promise<T1 | T2 | T3 | T4>;\n\n    /**\n     * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n     * or rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    race<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<T1 | T2 | T3>;\n\n    /**\n     * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n     * or rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    race<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<T1 | T2>;\n\n    /**\n     * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n     * or rejected.\n     * @param values An array of Promises.\n     * @returns A new Promise.\n     */\n    race<T>(values: (T | PromiseLike<T>)[]): Promise<T>;\n\n    /**\n     * Creates a new rejected promise for the provided reason.\n     * @param reason The reason the promise was rejected.\n     * @returns A new rejected Promise.\n     */\n    reject(reason: any): Promise<never>;\n\n    /**\n     * Creates a new rejected promise for the provided reason.\n     * @param reason The reason the promise was rejected.\n     * @returns A new rejected Promise.\n     */\n    reject<T>(reason: any): Promise<T>;\n\n    /**\n      * Creates a new resolved promise for the provided value.\n      * @param value A promise.\n      * @returns A promise whose internal state matches the provided promise.\n      */\n    resolve<T>(value: T | PromiseLike<T>): Promise<T>;\n\n    /**\n     * Creates a new resolved promise .\n     * @returns A resolved promise.\n     */\n    resolve(): Promise<void>;\n}\n\ndeclare var Promise: PromiseConstructor;\n\ninterface ProxyHandler<T> {\n    getPrototypeOf? (target: T): {} | null;\n    setPrototypeOf? (target: T, v: any): boolean;\n    isExtensible? (target: T): boolean;\n    preventExtensions? (target: T): boolean;\n    getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor;\n    has? (target: T, p: PropertyKey): boolean;\n    get? (target: T, p: PropertyKey, receiver: any): any;\n    set? (target: T, p: PropertyKey, value: any, receiver: any): boolean;\n    deleteProperty? (target: T, p: PropertyKey): boolean;\n    defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean;\n    enumerate? (target: T): PropertyKey[];\n    ownKeys? (target: T): PropertyKey[];\n    apply? (target: T, thisArg: any, argArray?: any): any;\n    construct? (target: T, argArray: any, newTarget?: any): {};\n}\n\ninterface ProxyConstructor {\n    revocable<T>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };\n    new <T>(target: T, handler: ProxyHandler<T>): T\n}\ndeclare var Proxy: ProxyConstructor;\n\n\ndeclare namespace Reflect {\n    function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;\n    function construct(target: Function, argumentsList: ArrayLike<any>, newTarget?: any): any;\n    function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;\n    function deleteProperty(target: any, propertyKey: PropertyKey): boolean;\n    function get(target: any, propertyKey: PropertyKey, receiver?: any): any;\n    function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;\n    function getPrototypeOf(target: any): any;\n    function has(target: any, propertyKey: PropertyKey): boolean;\n    function isExtensible(target: any): boolean;\n    function ownKeys(target: any): Array<PropertyKey>;\n    function preventExtensions(target: any): boolean;\n    function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean;\n    function setPrototypeOf(target: any, proto: any): boolean;\n}\n\ninterface Symbol {\n    /** Returns a string representation of an object. */\n    toString(): string;\n\n    /** Returns the primitive value of the specified object. */\n    valueOf(): Object;\n}\n\ninterface SymbolConstructor {\n    /** \n      * A reference to the prototype. \n      */\n    readonly prototype: Symbol;\n\n    /**\n      * Returns a new unique Symbol value.\n      * @param  description Description of the new Symbol object.\n      */\n    (description?: string|number): symbol;\n\n    /**\n      * Returns a Symbol object from the global symbol registry matching the given key if found. \n      * Otherwise, returns a new symbol with this key.\n      * @param key key to search for.\n      */\n    for(key: string): symbol;\n\n    /**\n      * Returns a key from the global symbol registry matching the given Symbol if found. \n      * Otherwise, returns a undefined.\n      * @param sym Symbol to find the key for.\n      */\n    keyFor(sym: symbol): string | undefined;\n}\n\ndeclare var Symbol: SymbolConstructor;\n\n/// <reference path=\"lib.es2015.symbol.d.ts\" />\n\ninterface SymbolConstructor {\n    /** \n      * A method that determines if a constructor object recognizes an object as one of the \n      * constructor’s instances. Called by the semantics of the instanceof operator. \n      */\n    readonly hasInstance: symbol;\n\n    /** \n      * A Boolean value that if true indicates that an object should flatten to its array elements\n      * by Array.prototype.concat.\n      */\n    readonly isConcatSpreadable: symbol;\n\n    /**\n      * A regular expression method that matches the regular expression against a string. Called \n      * by the String.prototype.match method. \n      */\n    readonly match: symbol;\n\n    /** \n      * A regular expression method that replaces matched substrings of a string. Called by the \n      * String.prototype.replace method.\n      */\n    readonly replace: symbol;\n\n    /**\n      * A regular expression method that returns the index within a string that matches the \n      * regular expression. Called by the String.prototype.search method.\n      */\n    readonly search: symbol;\n\n    /** \n      * A function valued property that is the constructor function that is used to create \n      * derived objects.\n      */\n    readonly species: symbol;\n\n    /**\n      * A regular expression method that splits a string at the indices that match the regular \n      * expression. Called by the String.prototype.split method.\n      */\n    readonly split: symbol;\n\n    /** \n      * A method that converts an object to a corresponding primitive value.\n      * Called by the ToPrimitive abstract operation.\n      */\n    readonly toPrimitive: symbol;\n\n    /** \n      * A String value that is used in the creation of the default string description of an object.\n      * Called by the built-in method Object.prototype.toString.\n      */\n    readonly toStringTag: symbol;\n\n    /**\n      * An Object whose own property names are property names that are excluded from the 'with'\n      * environment bindings of the associated objects.\n      */\n    readonly unscopables: symbol;\n}\n\ninterface Symbol {\n    readonly [Symbol.toStringTag]: \"Symbol\";\n}\n\ninterface Array<T> {\n    /**\n     * Returns an object whose properties have the value 'true'\n     * when they will be absent when used in a 'with' statement.\n     */\n    [Symbol.unscopables](): {\n        copyWithin: boolean;\n        entries: boolean;\n        fill: boolean;\n        find: boolean;\n        findIndex: boolean;\n        keys: boolean;\n        values: boolean;\n    };\n}\n\ninterface Date {\n    /**\n     * Converts a Date object to a string.\n     */\n    [Symbol.toPrimitive](hint: \"default\"): string;\n    /**\n     * Converts a Date object to a string.\n     */\n    [Symbol.toPrimitive](hint: \"string\"): string;\n    /**\n     * Converts a Date object to a number.\n     */\n    [Symbol.toPrimitive](hint: \"number\"): number;\n    /**\n     * Converts a Date object to a string or number.\n     *\n     * @param hint The strings \"number\", \"string\", or \"default\" to specify what primitive to return.\n     *\n     * @throws {TypeError} If 'hint' was given something other than \"number\", \"string\", or \"default\".\n     * @returns A number if 'hint' was \"number\", a string if 'hint' was \"string\" or \"default\".\n     */\n    [Symbol.toPrimitive](hint: string): string | number;\n}\n\ninterface Map<K, V> {\n    readonly [Symbol.toStringTag]: \"Map\";\n}\n\ninterface WeakMap<K, V>{\n    readonly [Symbol.toStringTag]: \"WeakMap\";\n}\n\ninterface Set<T> {\n    readonly [Symbol.toStringTag]: \"Set\";\n}\n\ninterface WeakSet<T> {\n    readonly [Symbol.toStringTag]: \"WeakSet\";\n}\n\ninterface JSON {\n    readonly [Symbol.toStringTag]: \"JSON\";\n}\n\ninterface Function {\n    /**\n     * Determines whether the given value inherits from this function if this function was used\n     * as a constructor function.\n     *\n     * A constructor function can control which objects are recognized as its instances by\n     * 'instanceof' by overriding this method.\n     */\n    [Symbol.hasInstance](value: any): boolean;\n}\n\ninterface GeneratorFunction extends Function {\n    readonly [Symbol.toStringTag]: \"GeneratorFunction\";\n}\n\ninterface Math {\n    readonly [Symbol.toStringTag]: \"Math\";\n}\n\ninterface Promise<T> {\n    readonly [Symbol.toStringTag]: \"Promise\";\n}\n\ninterface PromiseConstructor {\n    readonly [Symbol.species]: Function;\n}\n\ninterface RegExp {\n        /**\n      * Matches a string with this regular expression, and returns an array containing the results of\n      * that search.\n      * @param string A string to search within.\n      */\n    [Symbol.match](string: string): RegExpMatchArray | null;\n\n    /**\n      * Replaces text in a string, using this regular expression.\n      * @param string A String object or string literal whose contents matching against\n      *               this regular expression will be replaced\n      * @param replaceValue A String object or string literal containing the text to replace for every \n      *                     successful match of this regular expression.\n      */\n    [Symbol.replace](string: string, replaceValue: string): string;\n\n    /**\n      * Replaces text in a string, using this regular expression.\n      * @param string A String object or string literal whose contents matching against\n      *               this regular expression will be replaced\n      * @param replacer A function that returns the replacement text.\n      */\n    [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string;\n\n    /**\n      * Finds the position beginning first substring match in a regular expression search\n      * using this regular expression.\n      *\n      * @param string The string to search within.\n      */\n    [Symbol.search](string: string): number;\n\n    /**\n      * Returns an array of substrings that were delimited by strings in the original input that\n      * match against this regular expression.\n      *\n      * If the regular expression contains capturing parentheses, then each time this\n      * regular expression matches, the results (including any undefined results) of the\n      * capturing parentheses are spliced.\n      *\n      * @param string string value to split\n      * @param limit if not undefined, the output array is truncated so that it contains no more\n      * than 'limit' elements.\n      */\n    [Symbol.split](string: string, limit?: number): string[];\n}\n\ninterface RegExpConstructor {\n    [Symbol.species](): RegExpConstructor;\n}\n\ninterface String {\n    /**\n      * Matches a string an object that supports being matched against, and returns an array containing the results of that search.\n      * @param matcher An object that supports being matched against.\n      */\n    match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null;\n\n    /**\n      * Replaces text in a string, using an object that supports replacement within a string.\n      * @param searchValue A object can search for and replace matches within a string.\n      * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.\n      */\n    replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string;\n\n    /**\n      * Replaces text in a string, using an object that supports replacement within a string.\n      * @param searchValue A object can search for and replace matches within a string.\n      * @param replacer A function that returns the replacement text.\n      */\n    replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string;\n\n    /**\n      * Finds the first substring match in a regular expression search.\n      * @param searcher An object which supports searching within a string.\n      */\n    search(searcher: { [Symbol.search](string: string): number; }): number;\n\n    /**\n      * Split a string into substrings using the specified separator and return them as an array.\n      * @param splitter An object that can split a string.\n      * @param limit A value used to limit the number of elements returned in the array.\n      */\n    split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[];\n}\n\n/**\n  * Represents a raw buffer of binary data, which is used to store data for the \n  * different typed arrays. ArrayBuffers cannot be read from or written to directly, \n  * but can be passed to a typed array or DataView Object to interpret the raw \n  * buffer as needed. \n  */\ninterface ArrayBuffer {\n    readonly [Symbol.toStringTag]: \"ArrayBuffer\";\n}\n\ninterface DataView {\n    readonly [Symbol.toStringTag]: \"DataView\";\n}\n\n/**\n  * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested \n  * number of bytes could not be allocated an exception is raised.\n  */\ninterface Int8Array {\n    readonly [Symbol.toStringTag]: \"Int8Array\";\n}\n\n/**\n  * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the \n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Uint8Array {\n    readonly [Symbol.toStringTag]: \"UInt8Array\";\n}\n\n/**\n  * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. \n  * If the requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Uint8ClampedArray {\n    readonly [Symbol.toStringTag]: \"Uint8ClampedArray\";\n}\n\n/**\n  * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the \n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Int16Array {\n    readonly [Symbol.toStringTag]: \"Int16Array\";\n}\n\n/**\n  * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the \n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Uint16Array {\n    readonly [Symbol.toStringTag]: \"Uint16Array\";\n}\n\n/**\n  * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the \n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Int32Array {\n    readonly [Symbol.toStringTag]: \"Int32Array\";\n}\n\n/**\n  * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the \n  * requested number of bytes could not be allocated an exception is raised.\n  */\ninterface Uint32Array {\n    readonly [Symbol.toStringTag]: \"Uint32Array\";\n}\n\n/**\n  * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\n  * of bytes could not be allocated an exception is raised.\n  */\ninterface Float32Array {\n    readonly [Symbol.toStringTag]: \"Float32Array\";\n}\n\n/**\n  * A typed array of 64-bit float values. The contents are initialized to 0. If the requested \n  * number of bytes could not be allocated an exception is raised.\n  */\ninterface Float64Array {\n    readonly [Symbol.toStringTag]: \"Float64Array\";\n}\n\n\n/////////////////////////////\n/// IE DOM APIs\n/////////////////////////////\n\ninterface Algorithm {\n    name: string;\n}\n\ninterface AriaRequestEventInit extends EventInit {\n    attributeName?: string;\n    attributeValue?: string;\n}\n\ninterface CommandEventInit extends EventInit {\n    commandName?: string;\n    detail?: string;\n}\n\ninterface CompositionEventInit extends UIEventInit {\n    data?: string;\n}\n\ninterface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation {\n    arrayOfDomainStrings?: string[];\n}\n\ninterface ConstrainBooleanParameters {\n    exact?: boolean;\n    ideal?: boolean;\n}\n\ninterface ConstrainDOMStringParameters {\n    exact?: string | string[];\n    ideal?: string | string[];\n}\n\ninterface ConstrainDoubleRange extends DoubleRange {\n    exact?: number;\n    ideal?: number;\n}\n\ninterface ConstrainLongRange extends LongRange {\n    exact?: number;\n    ideal?: number;\n}\n\ninterface ConstrainVideoFacingModeParameters {\n    exact?: string | string[];\n    ideal?: string | string[];\n}\n\ninterface CustomEventInit extends EventInit {\n    detail?: any;\n}\n\ninterface DeviceAccelerationDict {\n    x?: number;\n    y?: number;\n    z?: number;\n}\n\ninterface DeviceLightEventInit extends EventInit {\n    value?: number;\n}\n\ninterface DeviceRotationRateDict {\n    alpha?: number;\n    beta?: number;\n    gamma?: number;\n}\n\ninterface DoubleRange {\n    max?: number;\n    min?: number;\n}\n\ninterface EventInit {\n    scoped?: boolean;\n    bubbles?: boolean;\n    cancelable?: boolean;\n}\n\ninterface EventModifierInit extends UIEventInit {\n    ctrlKey?: boolean;\n    shiftKey?: boolean;\n    altKey?: boolean;\n    metaKey?: boolean;\n    modifierAltGraph?: boolean;\n    modifierCapsLock?: boolean;\n    modifierFn?: boolean;\n    modifierFnLock?: boolean;\n    modifierHyper?: boolean;\n    modifierNumLock?: boolean;\n    modifierOS?: boolean;\n    modifierScrollLock?: boolean;\n    modifierSuper?: boolean;\n    modifierSymbol?: boolean;\n    modifierSymbolLock?: boolean;\n}\n\ninterface ExceptionInformation {\n    domain?: string;\n}\n\ninterface FocusEventInit extends UIEventInit {\n    relatedTarget?: EventTarget;\n}\n\ninterface HashChangeEventInit extends EventInit {\n    newURL?: string;\n    oldURL?: string;\n}\n\ninterface IDBIndexParameters {\n    multiEntry?: boolean;\n    unique?: boolean;\n}\n\ninterface IDBObjectStoreParameters {\n    autoIncrement?: boolean;\n    keyPath?: IDBKeyPath;\n}\n\ninterface KeyAlgorithm {\n    name?: string;\n}\n\ninterface KeyboardEventInit extends EventModifierInit {\n    code?: string;\n    key?: string;\n    location?: number;\n    repeat?: boolean;\n}\n\ninterface LongRange {\n    max?: number;\n    min?: number;\n}\n\ninterface MSAccountInfo {\n    rpDisplayName?: string;\n    userDisplayName?: string;\n    accountName?: string;\n    userId?: string;\n    accountImageUri?: string;\n}\n\ninterface MSAudioLocalClientEvent extends MSLocalClientEventBase {\n    networkSendQualityEventRatio?: number;\n    networkDelayEventRatio?: number;\n    cpuInsufficientEventRatio?: number;\n    deviceHalfDuplexAECEventRatio?: number;\n    deviceRenderNotFunctioningEventRatio?: number;\n    deviceCaptureNotFunctioningEventRatio?: number;\n    deviceGlitchesEventRatio?: number;\n    deviceLowSNREventRatio?: number;\n    deviceLowSpeechLevelEventRatio?: number;\n    deviceClippingEventRatio?: number;\n    deviceEchoEventRatio?: number;\n    deviceNearEndToEchoRatioEventRatio?: number;\n    deviceRenderZeroVolumeEventRatio?: number;\n    deviceRenderMuteEventRatio?: number;\n    deviceMultipleEndpointsEventCount?: number;\n    deviceHowlingEventCount?: number;\n}\n\ninterface MSAudioRecvPayload extends MSPayloadBase {\n    samplingRate?: number;\n    signal?: MSAudioRecvSignal;\n    packetReorderRatio?: number;\n    packetReorderDepthAvg?: number;\n    packetReorderDepthMax?: number;\n    burstLossLength1?: number;\n    burstLossLength2?: number;\n    burstLossLength3?: number;\n    burstLossLength4?: number;\n    burstLossLength5?: number;\n    burstLossLength6?: number;\n    burstLossLength7?: number;\n    burstLossLength8OrHigher?: number;\n    fecRecvDistance1?: number;\n    fecRecvDistance2?: number;\n    fecRecvDistance3?: number;\n    ratioConcealedSamplesAvg?: number;\n    ratioStretchedSamplesAvg?: number;\n    ratioCompressedSamplesAvg?: number;\n}\n\ninterface MSAudioRecvSignal {\n    initialSignalLevelRMS?: number;\n    recvSignalLevelCh1?: number;\n    recvNoiseLevelCh1?: number;\n    renderSignalLevel?: number;\n    renderNoiseLevel?: number;\n    renderLoopbackSignalLevel?: number;\n}\n\ninterface MSAudioSendPayload extends MSPayloadBase {\n    samplingRate?: number;\n    signal?: MSAudioSendSignal;\n    audioFECUsed?: boolean;\n    sendMutePercent?: number;\n}\n\ninterface MSAudioSendSignal {\n    noiseLevel?: number;\n    sendSignalLevelCh1?: number;\n    sendNoiseLevelCh1?: number;\n}\n\ninterface MSConnectivity {\n    iceType?: string;\n    iceWarningFlags?: MSIceWarningFlags;\n    relayAddress?: MSRelayAddress;\n}\n\ninterface MSCredentialFilter {\n    accept?: MSCredentialSpec[];\n}\n\ninterface MSCredentialParameters {\n    type?: string;\n}\n\ninterface MSCredentialSpec {\n    type?: string;\n    id?: string;\n}\n\ninterface MSDelay {\n    roundTrip?: number;\n    roundTripMax?: number;\n}\n\ninterface MSDescription extends RTCStats {\n    connectivity?: MSConnectivity;\n    transport?: string;\n    networkconnectivity?: MSNetworkConnectivityInfo;\n    localAddr?: MSIPAddressInfo;\n    remoteAddr?: MSIPAddressInfo;\n    deviceDevName?: string;\n    reflexiveLocalIPAddr?: MSIPAddressInfo;\n}\n\ninterface MSFIDOCredentialParameters extends MSCredentialParameters {\n    algorithm?: string | Algorithm;\n    authenticators?: AAGUID[];\n}\n\ninterface MSIPAddressInfo {\n    ipAddr?: string;\n    port?: number;\n    manufacturerMacAddrMask?: string;\n}\n\ninterface MSIceWarningFlags {\n    turnTcpTimedOut?: boolean;\n    turnUdpAllocateFailed?: boolean;\n    turnUdpSendFailed?: boolean;\n    turnTcpAllocateFailed?: boolean;\n    turnTcpSendFailed?: boolean;\n    udpLocalConnectivityFailed?: boolean;\n    udpNatConnectivityFailed?: boolean;\n    udpRelayConnectivityFailed?: boolean;\n    tcpNatConnectivityFailed?: boolean;\n    tcpRelayConnectivityFailed?: boolean;\n    connCheckMessageIntegrityFailed?: boolean;\n    allocationMessageIntegrityFailed?: boolean;\n    connCheckOtherError?: boolean;\n    turnAuthUnknownUsernameError?: boolean;\n    noRelayServersConfigured?: boolean;\n    multipleRelayServersAttempted?: boolean;\n    portRangeExhausted?: boolean;\n    alternateServerReceived?: boolean;\n    pseudoTLSFailure?: boolean;\n    turnTurnTcpConnectivityFailed?: boolean;\n    useCandidateChecksFailed?: boolean;\n    fipsAllocationFailure?: boolean;\n}\n\ninterface MSJitter {\n    interArrival?: number;\n    interArrivalMax?: number;\n    interArrivalSD?: number;\n}\n\ninterface MSLocalClientEventBase extends RTCStats {\n    networkReceiveQualityEventRatio?: number;\n    networkBandwidthLowEventRatio?: number;\n}\n\ninterface MSNetwork extends RTCStats {\n    jitter?: MSJitter;\n    delay?: MSDelay;\n    packetLoss?: MSPacketLoss;\n    utilization?: MSUtilization;\n}\n\ninterface MSNetworkConnectivityInfo {\n    vpn?: boolean;\n    linkspeed?: number;\n    networkConnectionDetails?: string;\n}\n\ninterface MSNetworkInterfaceType {\n    interfaceTypeEthernet?: boolean;\n    interfaceTypeWireless?: boolean;\n    interfaceTypePPP?: boolean;\n    interfaceTypeTunnel?: boolean;\n    interfaceTypeWWAN?: boolean;\n}\n\ninterface MSOutboundNetwork extends MSNetwork {\n    appliedBandwidthLimit?: number;\n}\n\ninterface MSPacketLoss {\n    lossRate?: number;\n    lossRateMax?: number;\n}\n\ninterface MSPayloadBase extends RTCStats {\n    payloadDescription?: string;\n}\n\ninterface MSRelayAddress {\n    relayAddress?: string;\n    port?: number;\n}\n\ninterface MSSignatureParameters {\n    userPrompt?: string;\n}\n\ninterface MSTransportDiagnosticsStats extends RTCStats {\n    baseAddress?: string;\n    localAddress?: string;\n    localSite?: string;\n    networkName?: string;\n    remoteAddress?: string;\n    remoteSite?: string;\n    localMR?: string;\n    remoteMR?: string;\n    iceWarningFlags?: MSIceWarningFlags;\n    portRangeMin?: number;\n    portRangeMax?: number;\n    localMRTCPPort?: number;\n    remoteMRTCPPort?: number;\n    stunVer?: number;\n    numConsentReqSent?: number;\n    numConsentReqReceived?: number;\n    numConsentRespSent?: number;\n    numConsentRespReceived?: number;\n    interfaces?: MSNetworkInterfaceType;\n    baseInterface?: MSNetworkInterfaceType;\n    protocol?: string;\n    localInterface?: MSNetworkInterfaceType;\n    localAddrType?: string;\n    remoteAddrType?: string;\n    iceRole?: string;\n    rtpRtcpMux?: boolean;\n    allocationTimeInMs?: number;\n    msRtcEngineVersion?: string;\n}\n\ninterface MSUtilization {\n    packets?: number;\n    bandwidthEstimation?: number;\n    bandwidthEstimationMin?: number;\n    bandwidthEstimationMax?: number;\n    bandwidthEstimationStdDev?: number;\n    bandwidthEstimationAvg?: number;\n}\n\ninterface MSVideoPayload extends MSPayloadBase {\n    resoluton?: string;\n    videoBitRateAvg?: number;\n    videoBitRateMax?: number;\n    videoFrameRateAvg?: number;\n    videoPacketLossRate?: number;\n    durationSeconds?: number;\n}\n\ninterface MSVideoRecvPayload extends MSVideoPayload {\n    videoFrameLossRate?: number;\n    recvCodecType?: string;\n    recvResolutionWidth?: number;\n    recvResolutionHeight?: number;\n    videoResolutions?: MSVideoResolutionDistribution;\n    recvFrameRateAverage?: number;\n    recvBitRateMaximum?: number;\n    recvBitRateAverage?: number;\n    recvVideoStreamsMax?: number;\n    recvVideoStreamsMin?: number;\n    recvVideoStreamsMode?: number;\n    videoPostFECPLR?: number;\n    lowBitRateCallPercent?: number;\n    lowFrameRateCallPercent?: number;\n    reorderBufferTotalPackets?: number;\n    recvReorderBufferReorderedPackets?: number;\n    recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number;\n    recvReorderBufferMaxSuccessfullyOrderedExtent?: number;\n    recvReorderBufferMaxSuccessfullyOrderedLateTime?: number;\n    recvReorderBufferPacketsDroppedDueToTimeout?: number;\n    recvFpsHarmonicAverage?: number;\n    recvNumResSwitches?: number;\n}\n\ninterface MSVideoResolutionDistribution {\n    cifQuality?: number;\n    vgaQuality?: number;\n    h720Quality?: number;\n    h1080Quality?: number;\n    h1440Quality?: number;\n    h2160Quality?: number;\n}\n\ninterface MSVideoSendPayload extends MSVideoPayload {\n    sendFrameRateAverage?: number;\n    sendBitRateMaximum?: number;\n    sendBitRateAverage?: number;\n    sendVideoStreamsMax?: number;\n    sendResolutionWidth?: number;\n    sendResolutionHeight?: number;\n}\n\ninterface MediaEncryptedEventInit extends EventInit {\n    initDataType?: string;\n    initData?: ArrayBuffer;\n}\n\ninterface MediaKeyMessageEventInit extends EventInit {\n    messageType?: string;\n    message?: ArrayBuffer;\n}\n\ninterface MediaKeySystemConfiguration {\n    initDataTypes?: string[];\n    audioCapabilities?: MediaKeySystemMediaCapability[];\n    videoCapabilities?: MediaKeySystemMediaCapability[];\n    distinctiveIdentifier?: string;\n    persistentState?: string;\n}\n\ninterface MediaKeySystemMediaCapability {\n    contentType?: string;\n    robustness?: string;\n}\n\ninterface MediaStreamConstraints {\n    video?: boolean | MediaTrackConstraints;\n    audio?: boolean | MediaTrackConstraints;\n}\n\ninterface MediaStreamErrorEventInit extends EventInit {\n    error?: MediaStreamError;\n}\n\ninterface MediaStreamTrackEventInit extends EventInit {\n    track?: MediaStreamTrack;\n}\n\ninterface MediaTrackCapabilities {\n    width?: number | LongRange;\n    height?: number | LongRange;\n    aspectRatio?: number | DoubleRange;\n    frameRate?: number | DoubleRange;\n    facingMode?: string;\n    volume?: number | DoubleRange;\n    sampleRate?: number | LongRange;\n    sampleSize?: number | LongRange;\n    echoCancellation?: boolean[];\n    deviceId?: string;\n    groupId?: string;\n}\n\ninterface MediaTrackConstraintSet {\n    width?: number | ConstrainLongRange;\n    height?: number | ConstrainLongRange;\n    aspectRatio?: number | ConstrainDoubleRange;\n    frameRate?: number | ConstrainDoubleRange;\n    facingMode?: string | string[] | ConstrainDOMStringParameters;\n    volume?: number | ConstrainDoubleRange;\n    sampleRate?: number | ConstrainLongRange;\n    sampleSize?: number | ConstrainLongRange;\n    echoCancelation?: boolean | ConstrainBooleanParameters;\n    deviceId?: string | string[] | ConstrainDOMStringParameters;\n    groupId?: string | string[] | ConstrainDOMStringParameters;\n}\n\ninterface MediaTrackConstraints extends MediaTrackConstraintSet {\n    advanced?: MediaTrackConstraintSet[];\n}\n\ninterface MediaTrackSettings {\n    width?: number;\n    height?: number;\n    aspectRatio?: number;\n    frameRate?: number;\n    facingMode?: string;\n    volume?: number;\n    sampleRate?: number;\n    sampleSize?: number;\n    echoCancellation?: boolean;\n    deviceId?: string;\n    groupId?: string;\n}\n\ninterface MediaTrackSupportedConstraints {\n    width?: boolean;\n    height?: boolean;\n    aspectRatio?: boolean;\n    frameRate?: boolean;\n    facingMode?: boolean;\n    volume?: boolean;\n    sampleRate?: boolean;\n    sampleSize?: boolean;\n    echoCancellation?: boolean;\n    deviceId?: boolean;\n    groupId?: boolean;\n}\n\ninterface MouseEventInit extends EventModifierInit {\n    screenX?: number;\n    screenY?: number;\n    clientX?: number;\n    clientY?: number;\n    button?: number;\n    buttons?: number;\n    relatedTarget?: EventTarget;\n}\n\ninterface MsZoomToOptions {\n    contentX?: number;\n    contentY?: number;\n    viewportX?: string;\n    viewportY?: string;\n    scaleFactor?: number;\n    animate?: string;\n}\n\ninterface MutationObserverInit {\n    childList?: boolean;\n    attributes?: boolean;\n    characterData?: boolean;\n    subtree?: boolean;\n    attributeOldValue?: boolean;\n    characterDataOldValue?: boolean;\n    attributeFilter?: string[];\n}\n\ninterface ObjectURLOptions {\n    oneTimeOnly?: boolean;\n}\n\ninterface PeriodicWaveConstraints {\n    disableNormalization?: boolean;\n}\n\ninterface PointerEventInit extends MouseEventInit {\n    pointerId?: number;\n    width?: number;\n    height?: number;\n    pressure?: number;\n    tiltX?: number;\n    tiltY?: number;\n    pointerType?: string;\n    isPrimary?: boolean;\n}\n\ninterface PositionOptions {\n    enableHighAccuracy?: boolean;\n    timeout?: number;\n    maximumAge?: number;\n}\n\ninterface RTCDTMFToneChangeEventInit extends EventInit {\n    tone?: string;\n}\n\ninterface RTCDtlsFingerprint {\n    algorithm?: string;\n    value?: string;\n}\n\ninterface RTCDtlsParameters {\n    role?: string;\n    fingerprints?: RTCDtlsFingerprint[];\n}\n\ninterface RTCIceCandidate {\n    foundation?: string;\n    priority?: number;\n    ip?: string;\n    protocol?: string;\n    port?: number;\n    type?: string;\n    tcpType?: string;\n    relatedAddress?: string;\n    relatedPort?: number;\n}\n\ninterface RTCIceCandidateAttributes extends RTCStats {\n    ipAddress?: string;\n    portNumber?: number;\n    transport?: string;\n    candidateType?: string;\n    priority?: number;\n    addressSourceUrl?: string;\n}\n\ninterface RTCIceCandidateComplete {\n}\n\ninterface RTCIceCandidatePair {\n    local?: RTCIceCandidate;\n    remote?: RTCIceCandidate;\n}\n\ninterface RTCIceCandidatePairStats extends RTCStats {\n    transportId?: string;\n    localCandidateId?: string;\n    remoteCandidateId?: string;\n    state?: string;\n    priority?: number;\n    nominated?: boolean;\n    writable?: boolean;\n    readable?: boolean;\n    bytesSent?: number;\n    bytesReceived?: number;\n    roundTripTime?: number;\n    availableOutgoingBitrate?: number;\n    availableIncomingBitrate?: number;\n}\n\ninterface RTCIceGatherOptions {\n    gatherPolicy?: string;\n    iceservers?: RTCIceServer[];\n}\n\ninterface RTCIceParameters {\n    usernameFragment?: string;\n    password?: string;\n}\n\ninterface RTCIceServer {\n    urls?: any;\n    username?: string;\n    credential?: string;\n}\n\ninterface RTCInboundRTPStreamStats extends RTCRTPStreamStats {\n    packetsReceived?: number;\n    bytesReceived?: number;\n    packetsLost?: number;\n    jitter?: number;\n    fractionLost?: number;\n}\n\ninterface RTCMediaStreamTrackStats extends RTCStats {\n    trackIdentifier?: string;\n    remoteSource?: boolean;\n    ssrcIds?: string[];\n    frameWidth?: number;\n    frameHeight?: number;\n    framesPerSecond?: number;\n    framesSent?: number;\n    framesReceived?: number;\n    framesDecoded?: number;\n    framesDropped?: number;\n    framesCorrupted?: number;\n    audioLevel?: number;\n    echoReturnLoss?: number;\n    echoReturnLossEnhancement?: number;\n}\n\ninterface RTCOutboundRTPStreamStats extends RTCRTPStreamStats {\n    packetsSent?: number;\n    bytesSent?: number;\n    targetBitrate?: number;\n    roundTripTime?: number;\n}\n\ninterface RTCRTPStreamStats extends RTCStats {\n    ssrc?: string;\n    associateStatsId?: string;\n    isRemote?: boolean;\n    mediaTrackId?: string;\n    transportId?: string;\n    codecId?: string;\n    firCount?: number;\n    pliCount?: number;\n    nackCount?: number;\n    sliCount?: number;\n}\n\ninterface RTCRtcpFeedback {\n    type?: string;\n    parameter?: string;\n}\n\ninterface RTCRtcpParameters {\n    ssrc?: number;\n    cname?: string;\n    reducedSize?: boolean;\n    mux?: boolean;\n}\n\ninterface RTCRtpCapabilities {\n    codecs?: RTCRtpCodecCapability[];\n    headerExtensions?: RTCRtpHeaderExtension[];\n    fecMechanisms?: string[];\n}\n\ninterface RTCRtpCodecCapability {\n    name?: string;\n    kind?: string;\n    clockRate?: number;\n    preferredPayloadType?: number;\n    maxptime?: number;\n    numChannels?: number;\n    rtcpFeedback?: RTCRtcpFeedback[];\n    parameters?: any;\n    options?: any;\n    maxTemporalLayers?: number;\n    maxSpatialLayers?: number;\n    svcMultiStreamSupport?: boolean;\n}\n\ninterface RTCRtpCodecParameters {\n    name?: string;\n    payloadType?: any;\n    clockRate?: number;\n    maxptime?: number;\n    numChannels?: number;\n    rtcpFeedback?: RTCRtcpFeedback[];\n    parameters?: any;\n}\n\ninterface RTCRtpContributingSource {\n    timestamp?: number;\n    csrc?: number;\n    audioLevel?: number;\n}\n\ninterface RTCRtpEncodingParameters {\n    ssrc?: number;\n    codecPayloadType?: number;\n    fec?: RTCRtpFecParameters;\n    rtx?: RTCRtpRtxParameters;\n    priority?: number;\n    maxBitrate?: number;\n    minQuality?: number;\n    framerateBias?: number;\n    resolutionScale?: number;\n    framerateScale?: number;\n    active?: boolean;\n    encodingId?: string;\n    dependencyEncodingIds?: string[];\n    ssrcRange?: RTCSsrcRange;\n}\n\ninterface RTCRtpFecParameters {\n    ssrc?: number;\n    mechanism?: string;\n}\n\ninterface RTCRtpHeaderExtension {\n    kind?: string;\n    uri?: string;\n    preferredId?: number;\n    preferredEncrypt?: boolean;\n}\n\ninterface RTCRtpHeaderExtensionParameters {\n    uri?: string;\n    id?: number;\n    encrypt?: boolean;\n}\n\ninterface RTCRtpParameters {\n    muxId?: string;\n    codecs?: RTCRtpCodecParameters[];\n    headerExtensions?: RTCRtpHeaderExtensionParameters[];\n    encodings?: RTCRtpEncodingParameters[];\n    rtcp?: RTCRtcpParameters;\n}\n\ninterface RTCRtpRtxParameters {\n    ssrc?: number;\n}\n\ninterface RTCRtpUnhandled {\n    ssrc?: number;\n    payloadType?: number;\n    muxId?: string;\n}\n\ninterface RTCSrtpKeyParam {\n    keyMethod?: string;\n    keySalt?: string;\n    lifetime?: string;\n    mkiValue?: number;\n    mkiLength?: number;\n}\n\ninterface RTCSrtpSdesParameters {\n    tag?: number;\n    cryptoSuite?: string;\n    keyParams?: RTCSrtpKeyParam[];\n    sessionParams?: string[];\n}\n\ninterface RTCSsrcRange {\n    min?: number;\n    max?: number;\n}\n\ninterface RTCStats {\n    timestamp?: number;\n    type?: string;\n    id?: string;\n    msType?: string;\n}\n\ninterface RTCStatsReport {\n}\n\ninterface RTCTransportStats extends RTCStats {\n    bytesSent?: number;\n    bytesReceived?: number;\n    rtcpTransportStatsId?: string;\n    activeConnection?: boolean;\n    selectedCandidatePairId?: string;\n    localCertificateId?: string;\n    remoteCertificateId?: string;\n}\n\ninterface StoreExceptionsInformation extends ExceptionInformation {\n    siteName?: string;\n    explanationString?: string;\n    detailURI?: string;\n}\n\ninterface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation {\n    arrayOfDomainStrings?: string[];\n}\n\ninterface UIEventInit extends EventInit {\n    view?: Window;\n    detail?: number;\n}\n\ninterface WebGLContextAttributes {\n    failIfMajorPerformanceCaveat?: boolean;\n    alpha?: boolean;\n    depth?: boolean;\n    stencil?: boolean;\n    antialias?: boolean;\n    premultipliedAlpha?: boolean;\n    preserveDrawingBuffer?: boolean;\n}\n\ninterface WebGLContextEventInit extends EventInit {\n    statusMessage?: string;\n}\n\ninterface WheelEventInit extends MouseEventInit {\n    deltaX?: number;\n    deltaY?: number;\n    deltaZ?: number;\n    deltaMode?: number;\n}\n\ninterface EventListener {\n    (evt: Event): void;\n}\n\ninterface ANGLE_instanced_arrays {\n    drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void;\n    drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void;\n    vertexAttribDivisorANGLE(index: number, divisor: number): void;\n    readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number;\n}\n\ndeclare var ANGLE_instanced_arrays: {\n    prototype: ANGLE_instanced_arrays;\n    new(): ANGLE_instanced_arrays;\n    readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number;\n}\n\ninterface AnalyserNode extends AudioNode {\n    fftSize: number;\n    readonly frequencyBinCount: number;\n    maxDecibels: number;\n    minDecibels: number;\n    smoothingTimeConstant: number;\n    getByteFrequencyData(array: Uint8Array): void;\n    getByteTimeDomainData(array: Uint8Array): void;\n    getFloatFrequencyData(array: Float32Array): void;\n    getFloatTimeDomainData(array: Float32Array): void;\n}\n\ndeclare var AnalyserNode: {\n    prototype: AnalyserNode;\n    new(): AnalyserNode;\n}\n\ninterface AnimationEvent extends Event {\n    readonly animationName: string;\n    readonly elapsedTime: number;\n    initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void;\n}\n\ndeclare var AnimationEvent: {\n    prototype: AnimationEvent;\n    new(): AnimationEvent;\n}\n\ninterface ApplicationCacheEventMap {\n    \"cached\": Event;\n    \"checking\": Event;\n    \"downloading\": Event;\n    \"error\": ErrorEvent;\n    \"noupdate\": Event;\n    \"obsolete\": Event;\n    \"progress\": ProgressEvent;\n    \"updateready\": Event;\n}\n\ninterface ApplicationCache extends EventTarget {\n    oncached: (this: ApplicationCache, ev: Event) => any;\n    onchecking: (this: ApplicationCache, ev: Event) => any;\n    ondownloading: (this: ApplicationCache, ev: Event) => any;\n    onerror: (this: ApplicationCache, ev: ErrorEvent) => any;\n    onnoupdate: (this: ApplicationCache, ev: Event) => any;\n    onobsolete: (this: ApplicationCache, ev: Event) => any;\n    onprogress: (this: ApplicationCache, ev: ProgressEvent) => any;\n    onupdateready: (this: ApplicationCache, ev: Event) => any;\n    readonly status: number;\n    abort(): void;\n    swapCache(): void;\n    update(): void;\n    readonly CHECKING: number;\n    readonly DOWNLOADING: number;\n    readonly IDLE: number;\n    readonly OBSOLETE: number;\n    readonly UNCACHED: number;\n    readonly UPDATEREADY: number;\n    addEventListener<K extends keyof ApplicationCacheEventMap>(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var ApplicationCache: {\n    prototype: ApplicationCache;\n    new(): ApplicationCache;\n    readonly CHECKING: number;\n    readonly DOWNLOADING: number;\n    readonly IDLE: number;\n    readonly OBSOLETE: number;\n    readonly UNCACHED: number;\n    readonly UPDATEREADY: number;\n}\n\ninterface AriaRequestEvent extends Event {\n    readonly attributeName: string;\n    attributeValue: string | null;\n}\n\ndeclare var AriaRequestEvent: {\n    prototype: AriaRequestEvent;\n    new(type: string, eventInitDict?: AriaRequestEventInit): AriaRequestEvent;\n}\n\ninterface Attr extends Node {\n    readonly name: string;\n    readonly ownerElement: Element;\n    readonly prefix: string | null;\n    readonly specified: boolean;\n    value: string;\n}\n\ndeclare var Attr: {\n    prototype: Attr;\n    new(): Attr;\n}\n\ninterface AudioBuffer {\n    readonly duration: number;\n    readonly length: number;\n    readonly numberOfChannels: number;\n    readonly sampleRate: number;\n    copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void;\n    copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void;\n    getChannelData(channel: number): Float32Array;\n}\n\ndeclare var AudioBuffer: {\n    prototype: AudioBuffer;\n    new(): AudioBuffer;\n}\n\ninterface AudioBufferSourceNodeEventMap {\n    \"ended\": MediaStreamErrorEvent;\n}\n\ninterface AudioBufferSourceNode extends AudioNode {\n    buffer: AudioBuffer | null;\n    readonly detune: AudioParam;\n    loop: boolean;\n    loopEnd: number;\n    loopStart: number;\n    onended: (this: AudioBufferSourceNode, ev: MediaStreamErrorEvent) => any;\n    readonly playbackRate: AudioParam;\n    start(when?: number, offset?: number, duration?: number): void;\n    stop(when?: number): void;\n    addEventListener<K extends keyof AudioBufferSourceNodeEventMap>(type: K, listener: (this: AudioBufferSourceNode, ev: AudioBufferSourceNodeEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var AudioBufferSourceNode: {\n    prototype: AudioBufferSourceNode;\n    new(): AudioBufferSourceNode;\n}\n\ninterface AudioContext extends EventTarget {\n    readonly currentTime: number;\n    readonly destination: AudioDestinationNode;\n    readonly listener: AudioListener;\n    readonly sampleRate: number;\n    state: string;\n    createAnalyser(): AnalyserNode;\n    createBiquadFilter(): BiquadFilterNode;\n    createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer;\n    createBufferSource(): AudioBufferSourceNode;\n    createChannelMerger(numberOfInputs?: number): ChannelMergerNode;\n    createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode;\n    createConvolver(): ConvolverNode;\n    createDelay(maxDelayTime?: number): DelayNode;\n    createDynamicsCompressor(): DynamicsCompressorNode;\n    createGain(): GainNode;\n    createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;\n    createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode;\n    createOscillator(): OscillatorNode;\n    createPanner(): PannerNode;\n    createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave;\n    createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;\n    createStereoPanner(): StereoPannerNode;\n    createWaveShaper(): WaveShaperNode;\n    decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike<AudioBuffer>;\n}\n\ndeclare var AudioContext: {\n    prototype: AudioContext;\n    new(): AudioContext;\n}\n\ninterface AudioDestinationNode extends AudioNode {\n    readonly maxChannelCount: number;\n}\n\ndeclare var AudioDestinationNode: {\n    prototype: AudioDestinationNode;\n    new(): AudioDestinationNode;\n}\n\ninterface AudioListener {\n    dopplerFactor: number;\n    speedOfSound: number;\n    setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void;\n    setPosition(x: number, y: number, z: number): void;\n    setVelocity(x: number, y: number, z: number): void;\n}\n\ndeclare var AudioListener: {\n    prototype: AudioListener;\n    new(): AudioListener;\n}\n\ninterface AudioNode extends EventTarget {\n    channelCount: number;\n    channelCountMode: string;\n    channelInterpretation: string;\n    readonly context: AudioContext;\n    readonly numberOfInputs: number;\n    readonly numberOfOutputs: number;\n    connect(destination: AudioNode, output?: number, input?: number): void;\n    disconnect(output?: number): void;\n    disconnect(destination: AudioNode, output?: number, input?: number): void;\n    disconnect(destination: AudioParam, output?: number): void;\n}\n\ndeclare var AudioNode: {\n    prototype: AudioNode;\n    new(): AudioNode;\n}\n\ninterface AudioParam {\n    readonly defaultValue: number;\n    value: number;\n    cancelScheduledValues(startTime: number): void;\n    exponentialRampToValueAtTime(value: number, endTime: number): void;\n    linearRampToValueAtTime(value: number, endTime: number): void;\n    setTargetAtTime(target: number, startTime: number, timeConstant: number): void;\n    setValueAtTime(value: number, startTime: number): void;\n    setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void;\n}\n\ndeclare var AudioParam: {\n    prototype: AudioParam;\n    new(): AudioParam;\n}\n\ninterface AudioProcessingEvent extends Event {\n    readonly inputBuffer: AudioBuffer;\n    readonly outputBuffer: AudioBuffer;\n    readonly playbackTime: number;\n}\n\ndeclare var AudioProcessingEvent: {\n    prototype: AudioProcessingEvent;\n    new(): AudioProcessingEvent;\n}\n\ninterface AudioTrack {\n    enabled: boolean;\n    readonly id: string;\n    kind: string;\n    readonly label: string;\n    language: string;\n    readonly sourceBuffer: SourceBuffer;\n}\n\ndeclare var AudioTrack: {\n    prototype: AudioTrack;\n    new(): AudioTrack;\n}\n\ninterface AudioTrackListEventMap {\n    \"addtrack\": TrackEvent;\n    \"change\": Event;\n    \"removetrack\": TrackEvent;\n}\n\ninterface AudioTrackList extends EventTarget {\n    readonly length: number;\n    onaddtrack: (this: AudioTrackList, ev: TrackEvent) => any;\n    onchange: (this: AudioTrackList, ev: Event) => any;\n    onremovetrack: (this: AudioTrackList, ev: TrackEvent) => any;\n    getTrackById(id: string): AudioTrack | null;\n    item(index: number): AudioTrack;\n    addEventListener<K extends keyof AudioTrackListEventMap>(type: K, listener: (this: AudioTrackList, ev: AudioTrackListEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n    [index: number]: AudioTrack;\n}\n\ndeclare var AudioTrackList: {\n    prototype: AudioTrackList;\n    new(): AudioTrackList;\n}\n\ninterface BarProp {\n    readonly visible: boolean;\n}\n\ndeclare var BarProp: {\n    prototype: BarProp;\n    new(): BarProp;\n}\n\ninterface BeforeUnloadEvent extends Event {\n    returnValue: any;\n}\n\ndeclare var BeforeUnloadEvent: {\n    prototype: BeforeUnloadEvent;\n    new(): BeforeUnloadEvent;\n}\n\ninterface BiquadFilterNode extends AudioNode {\n    readonly Q: AudioParam;\n    readonly detune: AudioParam;\n    readonly frequency: AudioParam;\n    readonly gain: AudioParam;\n    type: string;\n    getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void;\n}\n\ndeclare var BiquadFilterNode: {\n    prototype: BiquadFilterNode;\n    new(): BiquadFilterNode;\n}\n\ninterface Blob {\n    readonly size: number;\n    readonly type: string;\n    msClose(): void;\n    msDetachStream(): any;\n    slice(start?: number, end?: number, contentType?: string): Blob;\n}\n\ndeclare var Blob: {\n    prototype: Blob;\n    new (blobParts?: any[], options?: BlobPropertyBag): Blob;\n}\n\ninterface CDATASection extends Text {\n}\n\ndeclare var CDATASection: {\n    prototype: CDATASection;\n    new(): CDATASection;\n}\n\ninterface CSS {\n    supports(property: string, value?: string): boolean;\n}\ndeclare var CSS: CSS;\n\ninterface CSSConditionRule extends CSSGroupingRule {\n    conditionText: string;\n}\n\ndeclare var CSSConditionRule: {\n    prototype: CSSConditionRule;\n    new(): CSSConditionRule;\n}\n\ninterface CSSFontFaceRule extends CSSRule {\n    readonly style: CSSStyleDeclaration;\n}\n\ndeclare var CSSFontFaceRule: {\n    prototype: CSSFontFaceRule;\n    new(): CSSFontFaceRule;\n}\n\ninterface CSSGroupingRule extends CSSRule {\n    readonly cssRules: CSSRuleList;\n    deleteRule(index: number): void;\n    insertRule(rule: string, index: number): number;\n}\n\ndeclare var CSSGroupingRule: {\n    prototype: CSSGroupingRule;\n    new(): CSSGroupingRule;\n}\n\ninterface CSSImportRule extends CSSRule {\n    readonly href: string;\n    readonly media: MediaList;\n    readonly styleSheet: CSSStyleSheet;\n}\n\ndeclare var CSSImportRule: {\n    prototype: CSSImportRule;\n    new(): CSSImportRule;\n}\n\ninterface CSSKeyframeRule extends CSSRule {\n    keyText: string;\n    readonly style: CSSStyleDeclaration;\n}\n\ndeclare var CSSKeyframeRule: {\n    prototype: CSSKeyframeRule;\n    new(): CSSKeyframeRule;\n}\n\ninterface CSSKeyframesRule extends CSSRule {\n    readonly cssRules: CSSRuleList;\n    name: string;\n    appendRule(rule: string): void;\n    deleteRule(rule: string): void;\n    findRule(rule: string): CSSKeyframeRule;\n}\n\ndeclare var CSSKeyframesRule: {\n    prototype: CSSKeyframesRule;\n    new(): CSSKeyframesRule;\n}\n\ninterface CSSMediaRule extends CSSConditionRule {\n    readonly media: MediaList;\n}\n\ndeclare var CSSMediaRule: {\n    prototype: CSSMediaRule;\n    new(): CSSMediaRule;\n}\n\ninterface CSSNamespaceRule extends CSSRule {\n    readonly namespaceURI: string;\n    readonly prefix: string;\n}\n\ndeclare var CSSNamespaceRule: {\n    prototype: CSSNamespaceRule;\n    new(): CSSNamespaceRule;\n}\n\ninterface CSSPageRule extends CSSRule {\n    readonly pseudoClass: string;\n    readonly selector: string;\n    selectorText: string;\n    readonly style: CSSStyleDeclaration;\n}\n\ndeclare var CSSPageRule: {\n    prototype: CSSPageRule;\n    new(): CSSPageRule;\n}\n\ninterface CSSRule {\n    cssText: string;\n    readonly parentRule: CSSRule;\n    readonly parentStyleSheet: CSSStyleSheet;\n    readonly type: number;\n    readonly CHARSET_RULE: number;\n    readonly FONT_FACE_RULE: number;\n    readonly IMPORT_RULE: number;\n    readonly KEYFRAMES_RULE: number;\n    readonly KEYFRAME_RULE: number;\n    readonly MEDIA_RULE: number;\n    readonly NAMESPACE_RULE: number;\n    readonly PAGE_RULE: number;\n    readonly STYLE_RULE: number;\n    readonly SUPPORTS_RULE: number;\n    readonly UNKNOWN_RULE: number;\n    readonly VIEWPORT_RULE: number;\n}\n\ndeclare var CSSRule: {\n    prototype: CSSRule;\n    new(): CSSRule;\n    readonly CHARSET_RULE: number;\n    readonly FONT_FACE_RULE: number;\n    readonly IMPORT_RULE: number;\n    readonly KEYFRAMES_RULE: number;\n    readonly KEYFRAME_RULE: number;\n    readonly MEDIA_RULE: number;\n    readonly NAMESPACE_RULE: number;\n    readonly PAGE_RULE: number;\n    readonly STYLE_RULE: number;\n    readonly SUPPORTS_RULE: number;\n    readonly UNKNOWN_RULE: number;\n    readonly VIEWPORT_RULE: number;\n}\n\ninterface CSSRuleList {\n    readonly length: number;\n    item(index: number): CSSRule;\n    [index: number]: CSSRule;\n}\n\ndeclare var CSSRuleList: {\n    prototype: CSSRuleList;\n    new(): CSSRuleList;\n}\n\ninterface CSSStyleDeclaration {\n    alignContent: string | null;\n    alignItems: string | null;\n    alignSelf: string | null;\n    alignmentBaseline: string | null;\n    animation: string | null;\n    animationDelay: string | null;\n    animationDirection: string | null;\n    animationDuration: string | null;\n    animationFillMode: string | null;\n    animationIterationCount: string | null;\n    animationName: string | null;\n    animationPlayState: string | null;\n    animationTimingFunction: string | null;\n    backfaceVisibility: string | null;\n    background: string | null;\n    backgroundAttachment: string | null;\n    backgroundClip: string | null;\n    backgroundColor: string | null;\n    backgroundImage: string | null;\n    backgroundOrigin: string | null;\n    backgroundPosition: string | null;\n    backgroundPositionX: string | null;\n    backgroundPositionY: string | null;\n    backgroundRepeat: string | null;\n    backgroundSize: string | null;\n    baselineShift: string | null;\n    border: string | null;\n    borderBottom: string | null;\n    borderBottomColor: string | null;\n    borderBottomLeftRadius: string | null;\n    borderBottomRightRadius: string | null;\n    borderBottomStyle: string | null;\n    borderBottomWidth: string | null;\n    borderCollapse: string | null;\n    borderColor: string | null;\n    borderImage: string | null;\n    borderImageOutset: string | null;\n    borderImageRepeat: string | null;\n    borderImageSlice: string | null;\n    borderImageSource: string | null;\n    borderImageWidth: string | null;\n    borderLeft: string | null;\n    borderLeftColor: string | null;\n    borderLeftStyle: string | null;\n    borderLeftWidth: string | null;\n    borderRadius: string | null;\n    borderRight: string | null;\n    borderRightColor: string | null;\n    borderRightStyle: string | null;\n    borderRightWidth: string | null;\n    borderSpacing: string | null;\n    borderStyle: string | null;\n    borderTop: string | null;\n    borderTopColor: string | null;\n    borderTopLeftRadius: string | null;\n    borderTopRightRadius: string | null;\n    borderTopStyle: string | null;\n    borderTopWidth: string | null;\n    borderWidth: string | null;\n    bottom: string | null;\n    boxShadow: string | null;\n    boxSizing: string | null;\n    breakAfter: string | null;\n    breakBefore: string | null;\n    breakInside: string | null;\n    captionSide: string | null;\n    clear: string | null;\n    clip: string | null;\n    clipPath: string | null;\n    clipRule: string | null;\n    color: string | null;\n    colorInterpolationFilters: string | null;\n    columnCount: any;\n    columnFill: string | null;\n    columnGap: any;\n    columnRule: string | null;\n    columnRuleColor: any;\n    columnRuleStyle: string | null;\n    columnRuleWidth: any;\n    columnSpan: string | null;\n    columnWidth: any;\n    columns: string | null;\n    content: string | null;\n    counterIncrement: string | null;\n    counterReset: string | null;\n    cssFloat: string | null;\n    cssText: string;\n    cursor: string | null;\n    direction: string | null;\n    display: string | null;\n    dominantBaseline: string | null;\n    emptyCells: string | null;\n    enableBackground: string | null;\n    fill: string | null;\n    fillOpacity: string | null;\n    fillRule: string | null;\n    filter: string | null;\n    flex: string | null;\n    flexBasis: string | null;\n    flexDirection: string | null;\n    flexFlow: string | null;\n    flexGrow: string | null;\n    flexShrink: string | null;\n    flexWrap: string | null;\n    floodColor: string | null;\n    floodOpacity: string | null;\n    font: string | null;\n    fontFamily: string | null;\n    fontFeatureSettings: string | null;\n    fontSize: string | null;\n    fontSizeAdjust: string | null;\n    fontStretch: string | null;\n    fontStyle: string | null;\n    fontVariant: string | null;\n    fontWeight: string | null;\n    glyphOrientationHorizontal: string | null;\n    glyphOrientationVertical: string | null;\n    height: string | null;\n    imeMode: string | null;\n    justifyContent: string | null;\n    kerning: string | null;\n    left: string | null;\n    readonly length: number;\n    letterSpacing: string | null;\n    lightingColor: string | null;\n    lineHeight: string | null;\n    listStyle: string | null;\n    listStyleImage: string | null;\n    listStylePosition: string | null;\n    listStyleType: string | null;\n    margin: string | null;\n    marginBottom: string | null;\n    marginLeft: string | null;\n    marginRight: string | null;\n    marginTop: string | null;\n    marker: string | null;\n    markerEnd: string | null;\n    markerMid: string | null;\n    markerStart: string | null;\n    mask: string | null;\n    maxHeight: string | null;\n    maxWidth: string | null;\n    minHeight: string | null;\n    minWidth: string | null;\n    msContentZoomChaining: string | null;\n    msContentZoomLimit: string | null;\n    msContentZoomLimitMax: any;\n    msContentZoomLimitMin: any;\n    msContentZoomSnap: string | null;\n    msContentZoomSnapPoints: string | null;\n    msContentZoomSnapType: string | null;\n    msContentZooming: string | null;\n    msFlowFrom: string | null;\n    msFlowInto: string | null;\n    msFontFeatureSettings: string | null;\n    msGridColumn: any;\n    msGridColumnAlign: string | null;\n    msGridColumnSpan: any;\n    msGridColumns: string | null;\n    msGridRow: any;\n    msGridRowAlign: string | null;\n    msGridRowSpan: any;\n    msGridRows: string | null;\n    msHighContrastAdjust: string | null;\n    msHyphenateLimitChars: string | null;\n    msHyphenateLimitLines: any;\n    msHyphenateLimitZone: any;\n    msHyphens: string | null;\n    msImeAlign: string | null;\n    msOverflowStyle: string | null;\n    msScrollChaining: string | null;\n    msScrollLimit: string | null;\n    msScrollLimitXMax: any;\n    msScrollLimitXMin: any;\n    msScrollLimitYMax: any;\n    msScrollLimitYMin: any;\n    msScrollRails: string | null;\n    msScrollSnapPointsX: string | null;\n    msScrollSnapPointsY: string | null;\n    msScrollSnapType: string | null;\n    msScrollSnapX: string | null;\n    msScrollSnapY: string | null;\n    msScrollTranslation: string | null;\n    msTextCombineHorizontal: string | null;\n    msTextSizeAdjust: any;\n    msTouchAction: string | null;\n    msTouchSelect: string | null;\n    msUserSelect: string | null;\n    msWrapFlow: string;\n    msWrapMargin: any;\n    msWrapThrough: string;\n    opacity: string | null;\n    order: string | null;\n    orphans: string | null;\n    outline: string | null;\n    outlineColor: string | null;\n    outlineStyle: string | null;\n    outlineWidth: string | null;\n    overflow: string | null;\n    overflowX: string | null;\n    overflowY: string | null;\n    padding: string | null;\n    paddingBottom: string | null;\n    paddingLeft: string | null;\n    paddingRight: string | null;\n    paddingTop: string | null;\n    pageBreakAfter: string | null;\n    pageBreakBefore: string | null;\n    pageBreakInside: string | null;\n    readonly parentRule: CSSRule;\n    perspective: string | null;\n    perspectiveOrigin: string | null;\n    pointerEvents: string | null;\n    position: string | null;\n    quotes: string | null;\n    right: string | null;\n    rubyAlign: string | null;\n    rubyOverhang: string | null;\n    rubyPosition: string | null;\n    stopColor: string | null;\n    stopOpacity: string | null;\n    stroke: string | null;\n    strokeDasharray: string | null;\n    strokeDashoffset: string | null;\n    strokeLinecap: string | null;\n    strokeLinejoin: string | null;\n    strokeMiterlimit: string | null;\n    strokeOpacity: string | null;\n    strokeWidth: string | null;\n    tableLayout: string | null;\n    textAlign: string | null;\n    textAlignLast: string | null;\n    textAnchor: string | null;\n    textDecoration: string | null;\n    textIndent: string | null;\n    textJustify: string | null;\n    textKashida: string | null;\n    textKashidaSpace: string | null;\n    textOverflow: string | null;\n    textShadow: string | null;\n    textTransform: string | null;\n    textUnderlinePosition: string | null;\n    top: string | null;\n    touchAction: string | null;\n    transform: string | null;\n    transformOrigin: string | null;\n    transformStyle: string | null;\n    transition: string | null;\n    transitionDelay: string | null;\n    transitionDuration: string | null;\n    transitionProperty: string | null;\n    transitionTimingFunction: string | null;\n    unicodeBidi: string | null;\n    verticalAlign: string | null;\n    visibility: string | null;\n    webkitAlignContent: string | null;\n    webkitAlignItems: string | null;\n    webkitAlignSelf: string | null;\n    webkitAnimation: string | null;\n    webkitAnimationDelay: string | null;\n    webkitAnimationDirection: string | null;\n    webkitAnimationDuration: string | null;\n    webkitAnimationFillMode: string | null;\n    webkitAnimationIterationCount: string | null;\n    webkitAnimationName: string | null;\n    webkitAnimationPlayState: string | null;\n    webkitAnimationTimingFunction: string | null;\n    webkitAppearance: string | null;\n    webkitBackfaceVisibility: string | null;\n    webkitBackgroundClip: string | null;\n    webkitBackgroundOrigin: string | null;\n    webkitBackgroundSize: string | null;\n    webkitBorderBottomLeftRadius: string | null;\n    webkitBorderBottomRightRadius: string | null;\n    webkitBorderImage: string | null;\n    webkitBorderRadius: string | null;\n    webkitBorderTopLeftRadius: string | null;\n    webkitBorderTopRightRadius: string | null;\n    webkitBoxAlign: string | null;\n    webkitBoxDirection: string | null;\n    webkitBoxFlex: string | null;\n    webkitBoxOrdinalGroup: string | null;\n    webkitBoxOrient: string | null;\n    webkitBoxPack: string | null;\n    webkitBoxSizing: string | null;\n    webkitColumnBreakAfter: string | null;\n    webkitColumnBreakBefore: string | null;\n    webkitColumnBreakInside: string | null;\n    webkitColumnCount: any;\n    webkitColumnGap: any;\n    webkitColumnRule: string | null;\n    webkitColumnRuleColor: any;\n    webkitColumnRuleStyle: string | null;\n    webkitColumnRuleWidth: any;\n    webkitColumnSpan: string | null;\n    webkitColumnWidth: any;\n    webkitColumns: string | null;\n    webkitFilter: string | null;\n    webkitFlex: string | null;\n    webkitFlexBasis: string | null;\n    webkitFlexDirection: string | null;\n    webkitFlexFlow: string | null;\n    webkitFlexGrow: string | null;\n    webkitFlexShrink: string | null;\n    webkitFlexWrap: string | null;\n    webkitJustifyContent: string | null;\n    webkitOrder: string | null;\n    webkitPerspective: string | null;\n    webkitPerspectiveOrigin: string | null;\n    webkitTapHighlightColor: string | null;\n    webkitTextFillColor: string | null;\n    webkitTextSizeAdjust: any;\n    webkitTransform: string | null;\n    webkitTransformOrigin: string | null;\n    webkitTransformStyle: string | null;\n    webkitTransition: string | null;\n    webkitTransitionDelay: string | null;\n    webkitTransitionDuration: string | null;\n    webkitTransitionProperty: string | null;\n    webkitTransitionTimingFunction: string | null;\n    webkitUserModify: string | null;\n    webkitUserSelect: string | null;\n    webkitWritingMode: string | null;\n    whiteSpace: string | null;\n    widows: string | null;\n    width: string | null;\n    wordBreak: string | null;\n    wordSpacing: string | null;\n    wordWrap: string | null;\n    writingMode: string | null;\n    zIndex: string | null;\n    zoom: string | null;\n    resize: string | null;\n    getPropertyPriority(propertyName: string): string;\n    getPropertyValue(propertyName: string): string;\n    item(index: number): string;\n    removeProperty(propertyName: string): string;\n    setProperty(propertyName: string, value: string | null, priority?: string): void;\n    [index: number]: string;\n}\n\ndeclare var CSSStyleDeclaration: {\n    prototype: CSSStyleDeclaration;\n    new(): CSSStyleDeclaration;\n}\n\ninterface CSSStyleRule extends CSSRule {\n    readonly readOnly: boolean;\n    selectorText: string;\n    readonly style: CSSStyleDeclaration;\n}\n\ndeclare var CSSStyleRule: {\n    prototype: CSSStyleRule;\n    new(): CSSStyleRule;\n}\n\ninterface CSSStyleSheet extends StyleSheet {\n    readonly cssRules: CSSRuleList;\n    cssText: string;\n    readonly href: string;\n    readonly id: string;\n    readonly imports: StyleSheetList;\n    readonly isAlternate: boolean;\n    readonly isPrefAlternate: boolean;\n    readonly ownerRule: CSSRule;\n    readonly owningElement: Element;\n    readonly pages: StyleSheetPageList;\n    readonly readOnly: boolean;\n    readonly rules: CSSRuleList;\n    addImport(bstrURL: string, lIndex?: number): number;\n    addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number;\n    addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number;\n    deleteRule(index?: number): void;\n    insertRule(rule: string, index?: number): number;\n    removeImport(lIndex: number): void;\n    removeRule(lIndex: number): void;\n}\n\ndeclare var CSSStyleSheet: {\n    prototype: CSSStyleSheet;\n    new(): CSSStyleSheet;\n}\n\ninterface CSSSupportsRule extends CSSConditionRule {\n}\n\ndeclare var CSSSupportsRule: {\n    prototype: CSSSupportsRule;\n    new(): CSSSupportsRule;\n}\n\ninterface CanvasGradient {\n    addColorStop(offset: number, color: string): void;\n}\n\ndeclare var CanvasGradient: {\n    prototype: CanvasGradient;\n    new(): CanvasGradient;\n}\n\ninterface CanvasPattern {\n    setTransform(matrix: SVGMatrix): void;\n}\n\ndeclare var CanvasPattern: {\n    prototype: CanvasPattern;\n    new(): CanvasPattern;\n}\n\ninterface CanvasRenderingContext2D extends Object, CanvasPathMethods {\n    readonly canvas: HTMLCanvasElement;\n    fillStyle: string | CanvasGradient | CanvasPattern;\n    font: string;\n    globalAlpha: number;\n    globalCompositeOperation: string;\n    lineCap: string;\n    lineDashOffset: number;\n    lineJoin: string;\n    lineWidth: number;\n    miterLimit: number;\n    msFillRule: string;\n    msImageSmoothingEnabled: boolean;\n    shadowBlur: number;\n    shadowColor: string;\n    shadowOffsetX: number;\n    shadowOffsetY: number;\n    strokeStyle: string | CanvasGradient | CanvasPattern;\n    textAlign: string;\n    textBaseline: string;\n    mozImageSmoothingEnabled: boolean;\n    webkitImageSmoothingEnabled: boolean;\n    oImageSmoothingEnabled: boolean;\n    beginPath(): void;\n    clearRect(x: number, y: number, w: number, h: number): void;\n    clip(fillRule?: string): void;\n    createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData;\n    createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;\n    createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern;\n    createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;\n    drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void;\n    fill(fillRule?: string): void;\n    fillRect(x: number, y: number, w: number, h: number): void;\n    fillText(text: string, x: number, y: number, maxWidth?: number): void;\n    getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;\n    getLineDash(): number[];\n    isPointInPath(x: number, y: number, fillRule?: string): boolean;\n    measureText(text: string): TextMetrics;\n    putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void;\n    restore(): void;\n    rotate(angle: number): void;\n    save(): void;\n    scale(x: number, y: number): void;\n    setLineDash(segments: number[]): void;\n    setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void;\n    stroke(): void;\n    strokeRect(x: number, y: number, w: number, h: number): void;\n    strokeText(text: string, x: number, y: number, maxWidth?: number): void;\n    transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void;\n    translate(x: number, y: number): void;\n}\n\ndeclare var CanvasRenderingContext2D: {\n    prototype: CanvasRenderingContext2D;\n    new(): CanvasRenderingContext2D;\n}\n\ninterface ChannelMergerNode extends AudioNode {\n}\n\ndeclare var ChannelMergerNode: {\n    prototype: ChannelMergerNode;\n    new(): ChannelMergerNode;\n}\n\ninterface ChannelSplitterNode extends AudioNode {\n}\n\ndeclare var ChannelSplitterNode: {\n    prototype: ChannelSplitterNode;\n    new(): ChannelSplitterNode;\n}\n\ninterface CharacterData extends Node, ChildNode {\n    data: string;\n    readonly length: number;\n    appendData(arg: string): void;\n    deleteData(offset: number, count: number): void;\n    insertData(offset: number, arg: string): void;\n    replaceData(offset: number, count: number, arg: string): void;\n    substringData(offset: number, count: number): string;\n}\n\ndeclare var CharacterData: {\n    prototype: CharacterData;\n    new(): CharacterData;\n}\n\ninterface ClientRect {\n    bottom: number;\n    readonly height: number;\n    left: number;\n    right: number;\n    top: number;\n    readonly width: number;\n}\n\ndeclare var ClientRect: {\n    prototype: ClientRect;\n    new(): ClientRect;\n}\n\ninterface ClientRectList {\n    readonly length: number;\n    item(index: number): ClientRect;\n    [index: number]: ClientRect;\n}\n\ndeclare var ClientRectList: {\n    prototype: ClientRectList;\n    new(): ClientRectList;\n}\n\ninterface ClipboardEvent extends Event {\n    readonly clipboardData: DataTransfer;\n}\n\ndeclare var ClipboardEvent: {\n    prototype: ClipboardEvent;\n    new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent;\n}\n\ninterface CloseEvent extends Event {\n    readonly code: number;\n    readonly reason: string;\n    readonly wasClean: boolean;\n    initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void;\n}\n\ndeclare var CloseEvent: {\n    prototype: CloseEvent;\n    new(): CloseEvent;\n}\n\ninterface CommandEvent extends Event {\n    readonly commandName: string;\n    readonly detail: string | null;\n}\n\ndeclare var CommandEvent: {\n    prototype: CommandEvent;\n    new(type: string, eventInitDict?: CommandEventInit): CommandEvent;\n}\n\ninterface Comment extends CharacterData {\n    text: string;\n}\n\ndeclare var Comment: {\n    prototype: Comment;\n    new(): Comment;\n}\n\ninterface CompositionEvent extends UIEvent {\n    readonly data: string;\n    readonly locale: string;\n    initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void;\n}\n\ndeclare var CompositionEvent: {\n    prototype: CompositionEvent;\n    new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent;\n}\n\ninterface Console {\n    assert(test?: boolean, message?: string, ...optionalParams: any[]): void;\n    clear(): void;\n    count(countTitle?: string): void;\n    debug(message?: string, ...optionalParams: any[]): void;\n    dir(value?: any, ...optionalParams: any[]): void;\n    dirxml(value: any): void;\n    error(message?: any, ...optionalParams: any[]): void;\n    exception(message?: string, ...optionalParams: any[]): void;\n    group(groupTitle?: string): void;\n    groupCollapsed(groupTitle?: string): void;\n    groupEnd(): void;\n    info(message?: any, ...optionalParams: any[]): void;\n    log(message?: any, ...optionalParams: any[]): void;\n    msIsIndependentlyComposed(element: Element): boolean;\n    profile(reportName?: string): void;\n    profileEnd(): void;\n    select(element: Element): void;\n    table(...data: any[]): void;\n    time(timerName?: string): void;\n    timeEnd(timerName?: string): void;\n    trace(message?: any, ...optionalParams: any[]): void;\n    warn(message?: any, ...optionalParams: any[]): void;\n}\n\ndeclare var Console: {\n    prototype: Console;\n    new(): Console;\n}\n\ninterface ConvolverNode extends AudioNode {\n    buffer: AudioBuffer | null;\n    normalize: boolean;\n}\n\ndeclare var ConvolverNode: {\n    prototype: ConvolverNode;\n    new(): ConvolverNode;\n}\n\ninterface Coordinates {\n    readonly accuracy: number;\n    readonly altitude: number | null;\n    readonly altitudeAccuracy: number | null;\n    readonly heading: number | null;\n    readonly latitude: number;\n    readonly longitude: number;\n    readonly speed: number | null;\n}\n\ndeclare var Coordinates: {\n    prototype: Coordinates;\n    new(): Coordinates;\n}\n\ninterface Crypto extends Object, RandomSource {\n    readonly subtle: SubtleCrypto;\n}\n\ndeclare var Crypto: {\n    prototype: Crypto;\n    new(): Crypto;\n}\n\ninterface CryptoKey {\n    readonly algorithm: KeyAlgorithm;\n    readonly extractable: boolean;\n    readonly type: string;\n    readonly usages: string[];\n}\n\ndeclare var CryptoKey: {\n    prototype: CryptoKey;\n    new(): CryptoKey;\n}\n\ninterface CryptoKeyPair {\n    privateKey: CryptoKey;\n    publicKey: CryptoKey;\n}\n\ndeclare var CryptoKeyPair: {\n    prototype: CryptoKeyPair;\n    new(): CryptoKeyPair;\n}\n\ninterface CustomEvent extends Event {\n    readonly detail: any;\n    initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void;\n}\n\ndeclare var CustomEvent: {\n    prototype: CustomEvent;\n    new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent;\n}\n\ninterface DOMError {\n    readonly name: string;\n    toString(): string;\n}\n\ndeclare var DOMError: {\n    prototype: DOMError;\n    new(): DOMError;\n}\n\ninterface DOMException {\n    readonly code: number;\n    readonly message: string;\n    readonly name: string;\n    toString(): string;\n    readonly ABORT_ERR: number;\n    readonly DATA_CLONE_ERR: number;\n    readonly DOMSTRING_SIZE_ERR: number;\n    readonly HIERARCHY_REQUEST_ERR: number;\n    readonly INDEX_SIZE_ERR: number;\n    readonly INUSE_ATTRIBUTE_ERR: number;\n    readonly INVALID_ACCESS_ERR: number;\n    readonly INVALID_CHARACTER_ERR: number;\n    readonly INVALID_MODIFICATION_ERR: number;\n    readonly INVALID_NODE_TYPE_ERR: number;\n    readonly INVALID_STATE_ERR: number;\n    readonly NAMESPACE_ERR: number;\n    readonly NETWORK_ERR: number;\n    readonly NOT_FOUND_ERR: number;\n    readonly NOT_SUPPORTED_ERR: number;\n    readonly NO_DATA_ALLOWED_ERR: number;\n    readonly NO_MODIFICATION_ALLOWED_ERR: number;\n    readonly PARSE_ERR: number;\n    readonly QUOTA_EXCEEDED_ERR: number;\n    readonly SECURITY_ERR: number;\n    readonly SERIALIZE_ERR: number;\n    readonly SYNTAX_ERR: number;\n    readonly TIMEOUT_ERR: number;\n    readonly TYPE_MISMATCH_ERR: number;\n    readonly URL_MISMATCH_ERR: number;\n    readonly VALIDATION_ERR: number;\n    readonly WRONG_DOCUMENT_ERR: number;\n}\n\ndeclare var DOMException: {\n    prototype: DOMException;\n    new(): DOMException;\n    readonly ABORT_ERR: number;\n    readonly DATA_CLONE_ERR: number;\n    readonly DOMSTRING_SIZE_ERR: number;\n    readonly HIERARCHY_REQUEST_ERR: number;\n    readonly INDEX_SIZE_ERR: number;\n    readonly INUSE_ATTRIBUTE_ERR: number;\n    readonly INVALID_ACCESS_ERR: number;\n    readonly INVALID_CHARACTER_ERR: number;\n    readonly INVALID_MODIFICATION_ERR: number;\n    readonly INVALID_NODE_TYPE_ERR: number;\n    readonly INVALID_STATE_ERR: number;\n    readonly NAMESPACE_ERR: number;\n    readonly NETWORK_ERR: number;\n    readonly NOT_FOUND_ERR: number;\n    readonly NOT_SUPPORTED_ERR: number;\n    readonly NO_DATA_ALLOWED_ERR: number;\n    readonly NO_MODIFICATION_ALLOWED_ERR: number;\n    readonly PARSE_ERR: number;\n    readonly QUOTA_EXCEEDED_ERR: number;\n    readonly SECURITY_ERR: number;\n    readonly SERIALIZE_ERR: number;\n    readonly SYNTAX_ERR: number;\n    readonly TIMEOUT_ERR: number;\n    readonly TYPE_MISMATCH_ERR: number;\n    readonly URL_MISMATCH_ERR: number;\n    readonly VALIDATION_ERR: number;\n    readonly WRONG_DOCUMENT_ERR: number;\n}\n\ninterface DOMImplementation {\n    createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document;\n    createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType;\n    createHTMLDocument(title: string): Document;\n    hasFeature(feature: string | null, version: string | null): boolean;\n}\n\ndeclare var DOMImplementation: {\n    prototype: DOMImplementation;\n    new(): DOMImplementation;\n}\n\ninterface DOMParser {\n    parseFromString(source: string, mimeType: string): Document;\n}\n\ndeclare var DOMParser: {\n    prototype: DOMParser;\n    new(): DOMParser;\n}\n\ninterface DOMSettableTokenList extends DOMTokenList {\n    value: string;\n}\n\ndeclare var DOMSettableTokenList: {\n    prototype: DOMSettableTokenList;\n    new(): DOMSettableTokenList;\n}\n\ninterface DOMStringList {\n    readonly length: number;\n    contains(str: string): boolean;\n    item(index: number): string | null;\n    [index: number]: string;\n}\n\ndeclare var DOMStringList: {\n    prototype: DOMStringList;\n    new(): DOMStringList;\n}\n\ninterface DOMStringMap {\n    [name: string]: string;\n}\n\ndeclare var DOMStringMap: {\n    prototype: DOMStringMap;\n    new(): DOMStringMap;\n}\n\ninterface DOMTokenList {\n    readonly length: number;\n    add(...token: string[]): void;\n    contains(token: string): boolean;\n    item(index: number): string;\n    remove(...token: string[]): void;\n    toString(): string;\n    toggle(token: string, force?: boolean): boolean;\n    [index: number]: string;\n}\n\ndeclare var DOMTokenList: {\n    prototype: DOMTokenList;\n    new(): DOMTokenList;\n}\n\ninterface DataCue extends TextTrackCue {\n    data: ArrayBuffer;\n    addEventListener<K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var DataCue: {\n    prototype: DataCue;\n    new(): DataCue;\n}\n\ninterface DataTransfer {\n    dropEffect: string;\n    effectAllowed: string;\n    readonly files: FileList;\n    readonly items: DataTransferItemList;\n    readonly types: string[];\n    clearData(format?: string): boolean;\n    getData(format: string): string;\n    setData(format: string, data: string): boolean;\n}\n\ndeclare var DataTransfer: {\n    prototype: DataTransfer;\n    new(): DataTransfer;\n}\n\ninterface DataTransferItem {\n    readonly kind: string;\n    readonly type: string;\n    getAsFile(): File | null;\n    getAsString(_callback: FunctionStringCallback | null): void;\n}\n\ndeclare var DataTransferItem: {\n    prototype: DataTransferItem;\n    new(): DataTransferItem;\n}\n\ninterface DataTransferItemList {\n    readonly length: number;\n    add(data: File): DataTransferItem | null;\n    clear(): void;\n    item(index: number): DataTransferItem;\n    remove(index: number): void;\n    [index: number]: DataTransferItem;\n}\n\ndeclare var DataTransferItemList: {\n    prototype: DataTransferItemList;\n    new(): DataTransferItemList;\n}\n\ninterface DeferredPermissionRequest {\n    readonly id: number;\n    readonly type: string;\n    readonly uri: string;\n    allow(): void;\n    deny(): void;\n}\n\ndeclare var DeferredPermissionRequest: {\n    prototype: DeferredPermissionRequest;\n    new(): DeferredPermissionRequest;\n}\n\ninterface DelayNode extends AudioNode {\n    readonly delayTime: AudioParam;\n}\n\ndeclare var DelayNode: {\n    prototype: DelayNode;\n    new(): DelayNode;\n}\n\ninterface DeviceAcceleration {\n    readonly x: number | null;\n    readonly y: number | null;\n    readonly z: number | null;\n}\n\ndeclare var DeviceAcceleration: {\n    prototype: DeviceAcceleration;\n    new(): DeviceAcceleration;\n}\n\ninterface DeviceLightEvent extends Event {\n    readonly value: number;\n}\n\ndeclare var DeviceLightEvent: {\n    prototype: DeviceLightEvent;\n    new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent;\n}\n\ninterface DeviceMotionEvent extends Event {\n    readonly acceleration: DeviceAcceleration | null;\n    readonly accelerationIncludingGravity: DeviceAcceleration | null;\n    readonly interval: number | null;\n    readonly rotationRate: DeviceRotationRate | null;\n    initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void;\n}\n\ndeclare var DeviceMotionEvent: {\n    prototype: DeviceMotionEvent;\n    new(): DeviceMotionEvent;\n}\n\ninterface DeviceOrientationEvent extends Event {\n    readonly absolute: boolean;\n    readonly alpha: number | null;\n    readonly beta: number | null;\n    readonly gamma: number | null;\n    initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void;\n}\n\ndeclare var DeviceOrientationEvent: {\n    prototype: DeviceOrientationEvent;\n    new(): DeviceOrientationEvent;\n}\n\ninterface DeviceRotationRate {\n    readonly alpha: number | null;\n    readonly beta: number | null;\n    readonly gamma: number | null;\n}\n\ndeclare var DeviceRotationRate: {\n    prototype: DeviceRotationRate;\n    new(): DeviceRotationRate;\n}\n\ninterface DocumentEventMap extends GlobalEventHandlersEventMap {\n    \"abort\": UIEvent;\n    \"activate\": UIEvent;\n    \"beforeactivate\": UIEvent;\n    \"beforedeactivate\": UIEvent;\n    \"blur\": FocusEvent;\n    \"canplay\": Event;\n    \"canplaythrough\": Event;\n    \"change\": Event;\n    \"click\": MouseEvent;\n    \"contextmenu\": PointerEvent;\n    \"dblclick\": MouseEvent;\n    \"deactivate\": UIEvent;\n    \"drag\": DragEvent;\n    \"dragend\": DragEvent;\n    \"dragenter\": DragEvent;\n    \"dragleave\": DragEvent;\n    \"dragover\": DragEvent;\n    \"dragstart\": DragEvent;\n    \"drop\": DragEvent;\n    \"durationchange\": Event;\n    \"emptied\": Event;\n    \"ended\": MediaStreamErrorEvent;\n    \"error\": ErrorEvent;\n    \"focus\": FocusEvent;\n    \"fullscreenchange\": Event;\n    \"fullscreenerror\": Event;\n    \"input\": Event;\n    \"invalid\": Event;\n    \"keydown\": KeyboardEvent;\n    \"keypress\": KeyboardEvent;\n    \"keyup\": KeyboardEvent;\n    \"load\": Event;\n    \"loadeddata\": Event;\n    \"loadedmetadata\": Event;\n    \"loadstart\": Event;\n    \"mousedown\": MouseEvent;\n    \"mousemove\": MouseEvent;\n    \"mouseout\": MouseEvent;\n    \"mouseover\": MouseEvent;\n    \"mouseup\": MouseEvent;\n    \"mousewheel\": WheelEvent;\n    \"MSContentZoom\": UIEvent;\n    \"MSGestureChange\": MSGestureEvent;\n    \"MSGestureDoubleTap\": MSGestureEvent;\n    \"MSGestureEnd\": MSGestureEvent;\n    \"MSGestureHold\": MSGestureEvent;\n    \"MSGestureStart\": MSGestureEvent;\n    \"MSGestureTap\": MSGestureEvent;\n    \"MSInertiaStart\": MSGestureEvent;\n    \"MSManipulationStateChanged\": MSManipulationEvent;\n    \"MSPointerCancel\": MSPointerEvent;\n    \"MSPointerDown\": MSPointerEvent;\n    \"MSPointerEnter\": MSPointerEvent;\n    \"MSPointerLeave\": MSPointerEvent;\n    \"MSPointerMove\": MSPointerEvent;\n    \"MSPointerOut\": MSPointerEvent;\n    \"MSPointerOver\": MSPointerEvent;\n    \"MSPointerUp\": MSPointerEvent;\n    \"mssitemodejumplistitemremoved\": MSSiteModeEvent;\n    \"msthumbnailclick\": MSSiteModeEvent;\n    \"pause\": Event;\n    \"play\": Event;\n    \"playing\": Event;\n    \"pointerlockchange\": Event;\n    \"pointerlockerror\": Event;\n    \"progress\": ProgressEvent;\n    \"ratechange\": Event;\n    \"readystatechange\": ProgressEvent;\n    \"reset\": Event;\n    \"scroll\": UIEvent;\n    \"seeked\": Event;\n    \"seeking\": Event;\n    \"select\": UIEvent;\n    \"selectionchange\": Event;\n    \"selectstart\": Event;\n    \"stalled\": Event;\n    \"stop\": Event;\n    \"submit\": Event;\n    \"suspend\": Event;\n    \"timeupdate\": Event;\n    \"touchcancel\": TouchEvent;\n    \"touchend\": TouchEvent;\n    \"touchmove\": TouchEvent;\n    \"touchstart\": TouchEvent;\n    \"volumechange\": Event;\n    \"waiting\": Event;\n    \"webkitfullscreenchange\": Event;\n    \"webkitfullscreenerror\": Event;\n}\n\ninterface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode, DocumentOrShadowRoot {\n    /**\n      * Sets or gets the URL for the current document. \n      */\n    readonly URL: string;\n    /**\n      * Gets the URL for the document, stripped of any character encoding.\n      */\n    readonly URLUnencoded: string;\n    /**\n      * Gets the object that has the focus when the parent document has focus.\n      */\n    readonly activeElement: Element;\n    /**\n      * Sets or gets the color of all active links in the document.\n      */\n    alinkColor: string;\n    /**\n      * Returns a reference to the collection of elements contained by the object.\n      */\n    readonly all: HTMLAllCollection;\n    /**\n      * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order.\n      */\n    anchors: HTMLCollectionOf<HTMLAnchorElement>;\n    /**\n      * Retrieves a collection of all applet objects in the document.\n      */\n    applets: HTMLCollectionOf<HTMLAppletElement>;\n    /**\n      * Deprecated. Sets or retrieves a value that indicates the background color behind the object. \n      */\n    bgColor: string;\n    /**\n      * Specifies the beginning and end of the document body.\n      */\n    body: HTMLElement;\n    readonly characterSet: string;\n    /**\n      * Gets or sets the character set used to encode the object.\n      */\n    charset: string;\n    /**\n      * Gets a value that indicates whether standards-compliant mode is switched on for the object.\n      */\n    readonly compatMode: string;\n    cookie: string;\n    readonly currentScript: HTMLScriptElement | SVGScriptElement;\n    /**\n      * Gets the default character set from the current regional language settings.\n      */\n    readonly defaultCharset: string;\n    readonly defaultView: Window;\n    /**\n      * Sets or gets a value that indicates whether the document can be edited.\n      */\n    designMode: string;\n    /**\n      * Sets or retrieves a value that indicates the reading order of the object. \n      */\n    dir: string;\n    /**\n      * Gets an object representing the document type declaration associated with the current document. \n      */\n    readonly doctype: DocumentType;\n    /**\n      * Gets a reference to the root node of the document. \n      */\n    documentElement: HTMLElement;\n    /**\n      * Sets or gets the security domain of the document. \n      */\n    domain: string;\n    /**\n      * Retrieves a collection of all embed objects in the document.\n      */\n    embeds: HTMLCollectionOf<HTMLEmbedElement>;\n    /**\n      * Sets or gets the foreground (text) color of the document.\n      */\n    fgColor: string;\n    /**\n      * Retrieves a collection, in source order, of all form objects in the document.\n      */\n    forms: HTMLCollectionOf<HTMLFormElement>;\n    readonly fullscreenElement: Element | null;\n    readonly fullscreenEnabled: boolean;\n    readonly head: HTMLHeadElement;\n    readonly hidden: boolean;\n    /**\n      * Retrieves a collection, in source order, of img objects in the document.\n      */\n    images: HTMLCollectionOf<HTMLImageElement>;\n    /**\n      * Gets the implementation object of the current document. \n      */\n    readonly implementation: DOMImplementation;\n    /**\n      * Returns the character encoding used to create the webpage that is loaded into the document object.\n      */\n    readonly inputEncoding: string | null;\n    /**\n      * Gets the date that the page was last modified, if the page supplies one. \n      */\n    readonly lastModified: string;\n    /**\n      * Sets or gets the color of the document links. \n      */\n    linkColor: string;\n    /**\n      * Retrieves a collection of all a objects that specify the href property and all area objects in the document.\n      */\n    links: HTMLCollectionOf<HTMLAnchorElement | HTMLAreaElement>;\n    /**\n      * Contains information about the current URL. \n      */\n    readonly location: Location;\n    msCSSOMElementFloatMetrics: boolean;\n    msCapsLockWarningOff: boolean;\n    /**\n      * Fires when the user aborts the download.\n      * @param ev The event.\n      */\n    onabort: (this: Document, ev: UIEvent) => any;\n    /**\n      * Fires when the object is set as the active element.\n      * @param ev The event.\n      */\n    onactivate: (this: Document, ev: UIEvent) => any;\n    /**\n      * Fires immediately before the object is set as the active element.\n      * @param ev The event.\n      */\n    onbeforeactivate: (this: Document, ev: UIEvent) => any;\n    /**\n      * Fires immediately before the activeElement is changed from the current object to another object in the parent document.\n      * @param ev The event.\n      */\n    onbeforedeactivate: (this: Document, ev: UIEvent) => any;\n    /** \n      * Fires when the object loses the input focus. \n      * @param ev The focus event.\n      */\n    onblur: (this: Document, ev: FocusEvent) => any;\n    /**\n      * Occurs when playback is possible, but would require further buffering. \n      * @param ev The event.\n      */\n    oncanplay: (this: Document, ev: Event) => any;\n    oncanplaythrough: (this: Document, ev: Event) => any;\n    /**\n      * Fires when the contents of the object or selection have changed. \n      * @param ev The event.\n      */\n    onchange: (this: Document, ev: Event) => any;\n    /**\n      * Fires when the user clicks the left mouse button on the object\n      * @param ev The mouse event.\n      */\n    onclick: (this: Document, ev: MouseEvent) => any;\n    /**\n      * Fires when the user clicks the right mouse button in the client area, opening the context menu. \n      * @param ev The mouse event.\n      */\n    oncontextmenu: (this: Document, ev: PointerEvent) => any;\n    /**\n      * Fires when the user double-clicks the object.\n      * @param ev The mouse event.\n      */\n    ondblclick: (this: Document, ev: MouseEvent) => any;\n    /**\n      * Fires when the activeElement is changed from the current object to another object in the parent document.\n      * @param ev The UI Event\n      */\n    ondeactivate: (this: Document, ev: UIEvent) => any;\n    /**\n      * Fires on the source object continuously during a drag operation.\n      * @param ev The event.\n      */\n    ondrag: (this: Document, ev: DragEvent) => any;\n    /**\n      * Fires on the source object when the user releases the mouse at the close of a drag operation.\n      * @param ev The event.\n      */\n    ondragend: (this: Document, ev: DragEvent) => any;\n    /** \n      * Fires on the target element when the user drags the object to a valid drop target.\n      * @param ev The drag event.\n      */\n    ondragenter: (this: Document, ev: DragEvent) => any;\n    /** \n      * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation.\n      * @param ev The drag event.\n      */\n    ondragleave: (this: Document, ev: DragEvent) => any;\n    /**\n      * Fires on the target element continuously while the user drags the object over a valid drop target.\n      * @param ev The event.\n      */\n    ondragover: (this: Document, ev: DragEvent) => any;\n    /**\n      * Fires on the source object when the user starts to drag a text selection or selected object. \n      * @param ev The event.\n      */\n    ondragstart: (this: Document, ev: DragEvent) => any;\n    ondrop: (this: Document, ev: DragEvent) => any;\n    /**\n      * Occurs when the duration attribute is updated. \n      * @param ev The event.\n      */\n    ondurationchange: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when the media element is reset to its initial state. \n      * @param ev The event.\n      */\n    onemptied: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when the end of playback is reached. \n      * @param ev The event\n      */\n    onended: (this: Document, ev: MediaStreamErrorEvent) => any;\n    /**\n      * Fires when an error occurs during object loading.\n      * @param ev The event.\n      */\n    onerror: (this: Document, ev: ErrorEvent) => any;\n    /**\n      * Fires when the object receives focus. \n      * @param ev The event.\n      */\n    onfocus: (this: Document, ev: FocusEvent) => any;\n    onfullscreenchange: (this: Document, ev: Event) => any;\n    onfullscreenerror: (this: Document, ev: Event) => any;\n    oninput: (this: Document, ev: Event) => any;\n    oninvalid: (this: Document, ev: Event) => any;\n    /**\n      * Fires when the user presses a key.\n      * @param ev The keyboard event\n      */\n    onkeydown: (this: Document, ev: KeyboardEvent) => any;\n    /**\n      * Fires when the user presses an alphanumeric key.\n      * @param ev The event.\n      */\n    onkeypress: (this: Document, ev: KeyboardEvent) => any;\n    /**\n      * Fires when the user releases a key.\n      * @param ev The keyboard event\n      */\n    onkeyup: (this: Document, ev: KeyboardEvent) => any;\n    /**\n      * Fires immediately after the browser loads the object. \n      * @param ev The event.\n      */\n    onload: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when media data is loaded at the current playback position. \n      * @param ev The event.\n      */\n    onloadeddata: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when the duration and dimensions of the media have been determined.\n      * @param ev The event.\n      */\n    onloadedmetadata: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when Internet Explorer begins looking for media data. \n      * @param ev The event.\n      */\n    onloadstart: (this: Document, ev: Event) => any;\n    /**\n      * Fires when the user clicks the object with either mouse button. \n      * @param ev The mouse event.\n      */\n    onmousedown: (this: Document, ev: MouseEvent) => any;\n    /**\n      * Fires when the user moves the mouse over the object. \n      * @param ev The mouse event.\n      */\n    onmousemove: (this: Document, ev: MouseEvent) => any;\n    /**\n      * Fires when the user moves the mouse pointer outside the boundaries of the object. \n      * @param ev The mouse event.\n      */\n    onmouseout: (this: Document, ev: MouseEvent) => any;\n    /**\n      * Fires when the user moves the mouse pointer into the object.\n      * @param ev The mouse event.\n      */\n    onmouseover: (this: Document, ev: MouseEvent) => any;\n    /**\n      * Fires when the user releases a mouse button while the mouse is over the object. \n      * @param ev The mouse event.\n      */\n    onmouseup: (this: Document, ev: MouseEvent) => any;\n    /**\n      * Fires when the wheel button is rotated. \n      * @param ev The mouse event\n      */\n    onmousewheel: (this: Document, ev: WheelEvent) => any;\n    onmscontentzoom: (this: Document, ev: UIEvent) => any;\n    onmsgesturechange: (this: Document, ev: MSGestureEvent) => any;\n    onmsgesturedoubletap: (this: Document, ev: MSGestureEvent) => any;\n    onmsgestureend: (this: Document, ev: MSGestureEvent) => any;\n    onmsgesturehold: (this: Document, ev: MSGestureEvent) => any;\n    onmsgesturestart: (this: Document, ev: MSGestureEvent) => any;\n    onmsgesturetap: (this: Document, ev: MSGestureEvent) => any;\n    onmsinertiastart: (this: Document, ev: MSGestureEvent) => any;\n    onmsmanipulationstatechanged: (this: Document, ev: MSManipulationEvent) => any;\n    onmspointercancel: (this: Document, ev: MSPointerEvent) => any;\n    onmspointerdown: (this: Document, ev: MSPointerEvent) => any;\n    onmspointerenter: (this: Document, ev: MSPointerEvent) => any;\n    onmspointerleave: (this: Document, ev: MSPointerEvent) => any;\n    onmspointermove: (this: Document, ev: MSPointerEvent) => any;\n    onmspointerout: (this: Document, ev: MSPointerEvent) => any;\n    onmspointerover: (this: Document, ev: MSPointerEvent) => any;\n    onmspointerup: (this: Document, ev: MSPointerEvent) => any;\n    /**\n      * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. \n      * @param ev The event.\n      */\n    onmssitemodejumplistitemremoved: (this: Document, ev: MSSiteModeEvent) => any;\n    /**\n      * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode.\n      * @param ev The event.\n      */\n    onmsthumbnailclick: (this: Document, ev: MSSiteModeEvent) => any;\n    /**\n      * Occurs when playback is paused.\n      * @param ev The event.\n      */\n    onpause: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when the play method is requested. \n      * @param ev The event.\n      */\n    onplay: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when the audio or video has started playing. \n      * @param ev The event.\n      */\n    onplaying: (this: Document, ev: Event) => any;\n    onpointerlockchange: (this: Document, ev: Event) => any;\n    onpointerlockerror: (this: Document, ev: Event) => any;\n    /**\n      * Occurs to indicate progress while downloading media data. \n      * @param ev The event.\n      */\n    onprogress: (this: Document, ev: ProgressEvent) => any;\n    /**\n      * Occurs when the playback rate is increased or decreased. \n      * @param ev The event.\n      */\n    onratechange: (this: Document, ev: Event) => any;\n    /**\n      * Fires when the state of the object has changed.\n      * @param ev The event\n      */\n    onreadystatechange: (this: Document, ev: ProgressEvent) => any;\n    /**\n      * Fires when the user resets a form. \n      * @param ev The event.\n      */\n    onreset: (this: Document, ev: Event) => any;\n    /**\n      * Fires when the user repositions the scroll box in the scroll bar on the object. \n      * @param ev The event.\n      */\n    onscroll: (this: Document, ev: UIEvent) => any;\n    /**\n      * Occurs when the seek operation ends. \n      * @param ev The event.\n      */\n    onseeked: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when the current playback position is moved. \n      * @param ev The event.\n      */\n    onseeking: (this: Document, ev: Event) => any;\n    /**\n      * Fires when the current selection changes.\n      * @param ev The event.\n      */\n    onselect: (this: Document, ev: UIEvent) => any;\n    /**\n      * Fires when the selection state of a document changes.\n      * @param ev The event.\n      */\n    onselectionchange: (this: Document, ev: Event) => any;\n    onselectstart: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when the download has stopped. \n      * @param ev The event.\n      */\n    onstalled: (this: Document, ev: Event) => any;\n    /**\n      * Fires when the user clicks the Stop button or leaves the Web page.\n      * @param ev The event.\n      */\n    onstop: (this: Document, ev: Event) => any;\n    onsubmit: (this: Document, ev: Event) => any;\n    /**\n      * Occurs if the load operation has been intentionally halted. \n      * @param ev The event.\n      */\n    onsuspend: (this: Document, ev: Event) => any;\n    /**\n      * Occurs to indicate the current playback position.\n      * @param ev The event.\n      */\n    ontimeupdate: (this: Document, ev: Event) => any;\n    ontouchcancel: (ev: TouchEvent) => any;\n    ontouchend: (ev: TouchEvent) => any;\n    ontouchmove: (ev: TouchEvent) => any;\n    ontouchstart: (ev: TouchEvent) => any;\n    /**\n      * Occurs when the volume is changed, or playback is muted or unmuted.\n      * @param ev The event.\n      */\n    onvolumechange: (this: Document, ev: Event) => any;\n    /**\n      * Occurs when playback stops because the next frame of a video resource is not available. \n      * @param ev The event.\n      */\n    onwaiting: (this: Document, ev: Event) => any;\n    onwebkitfullscreenchange: (this: Document, ev: Event) => any;\n    onwebkitfullscreenerror: (this: Document, ev: Event) => any;\n    plugins: HTMLCollectionOf<HTMLEmbedElement>;\n    readonly pointerLockElement: Element;\n    /**\n      * Retrieves a value that indicates the current state of the object.\n      */\n    readonly readyState: string;\n    /**\n      * Gets the URL of the location that referred the user to the current page.\n      */\n    readonly referrer: string;\n    /**\n      * Gets the root svg element in the document hierarchy.\n      */\n    readonly rootElement: SVGSVGElement;\n    /**\n      * Retrieves a collection of all script objects in the document.\n      */\n    scripts: HTMLCollectionOf<HTMLScriptElement>;\n    readonly scrollingElement: Element | null;\n    /**\n      * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document.\n      */\n    readonly styleSheets: StyleSheetList;\n    /**\n      * Contains the title of the document.\n      */\n    title: string;\n    readonly visibilityState: string;\n    /** \n      * Sets or gets the color of the links that the user has visited.\n      */\n    vlinkColor: string;\n    readonly webkitCurrentFullScreenElement: Element | null;\n    readonly webkitFullscreenElement: Element | null;\n    readonly webkitFullscreenEnabled: boolean;\n    readonly webkitIsFullScreen: boolean;\n    readonly xmlEncoding: string | null;\n    xmlStandalone: boolean;\n    /**\n      * Gets or sets the version attribute specified in the declaration of an XML document.\n      */\n    xmlVersion: string | null;\n    adoptNode(source: Node): Node;\n    captureEvents(): void;\n    caretRangeFromPoint(x: number, y: number): Range;\n    clear(): void;\n    /**\n      * Closes an output stream and forces the sent data to display.\n      */\n    close(): void;\n    /**\n      * Creates an attribute object with a specified name.\n      * @param name String that sets the attribute object's name.\n      */\n    createAttribute(name: string): Attr;\n    createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr;\n    createCDATASection(data: string): CDATASection;\n    /**\n      * Creates a comment object with the specified data.\n      * @param data Sets the comment object's data.\n      */\n    createComment(data: string): Comment;\n    /**\n      * Creates a new document.\n      */\n    createDocumentFragment(): DocumentFragment;\n    /**\n      * Creates an instance of the element for the specified tag.\n      * @param tagName The name of an element.\n      */\n    createElement<K extends keyof HTMLElementTagNameMap>(tagName: K): HTMLElementTagNameMap[K];\n    createElement(tagName: string): HTMLElement;\n    createElementNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", qualifiedName: string): HTMLElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"a\"): SVGAElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"circle\"): SVGCircleElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"clipPath\"): SVGClipPathElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"componentTransferFunction\"): SVGComponentTransferFunctionElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"defs\"): SVGDefsElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"desc\"): SVGDescElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"ellipse\"): SVGEllipseElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feBlend\"): SVGFEBlendElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feColorMatrix\"): SVGFEColorMatrixElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feComponentTransfer\"): SVGFEComponentTransferElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feComposite\"): SVGFECompositeElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feConvolveMatrix\"): SVGFEConvolveMatrixElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDiffuseLighting\"): SVGFEDiffuseLightingElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDisplacementMap\"): SVGFEDisplacementMapElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDistantLight\"): SVGFEDistantLightElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFlood\"): SVGFEFloodElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncA\"): SVGFEFuncAElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncB\"): SVGFEFuncBElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncG\"): SVGFEFuncGElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncR\"): SVGFEFuncRElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feGaussianBlur\"): SVGFEGaussianBlurElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feImage\"): SVGFEImageElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMerge\"): SVGFEMergeElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMergeNode\"): SVGFEMergeNodeElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMorphology\"): SVGFEMorphologyElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feOffset\"): SVGFEOffsetElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"fePointLight\"): SVGFEPointLightElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feSpecularLighting\"): SVGFESpecularLightingElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feSpotLight\"): SVGFESpotLightElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feTile\"): SVGFETileElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feTurbulence\"): SVGFETurbulenceElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"filter\"): SVGFilterElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"foreignObject\"): SVGForeignObjectElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"g\"): SVGGElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"image\"): SVGImageElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"gradient\"): SVGGradientElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"line\"): SVGLineElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"linearGradient\"): SVGLinearGradientElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"marker\"): SVGMarkerElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"mask\"): SVGMaskElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"path\"): SVGPathElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"metadata\"): SVGMetadataElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"pattern\"): SVGPatternElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"polygon\"): SVGPolygonElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"polyline\"): SVGPolylineElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"radialGradient\"): SVGRadialGradientElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"rect\"): SVGRectElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"svg\"): SVGSVGElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"script\"): SVGScriptElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"stop\"): SVGStopElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"style\"): SVGStyleElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"switch\"): SVGSwitchElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"symbol\"): SVGSymbolElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"tspan\"): SVGTSpanElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textContent\"): SVGTextContentElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"text\"): SVGTextElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textPath\"): SVGTextPathElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textPositioning\"): SVGTextPositioningElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"title\"): SVGTitleElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"use\"): SVGUseElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"view\"): SVGViewElement\n    createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: string): SVGElement\n    createElementNS(namespaceURI: string | null, qualifiedName: string): Element;\n    createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;\n    createNSResolver(nodeResolver: Node): XPathNSResolver;\n    /**\n      * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. \n      * @param root The root element or node to start traversing on.\n      * @param whatToShow The type of nodes or elements to appear in the node list\n      * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter.\n      * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded.\n      */\n    createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator;\n    createProcessingInstruction(target: string, data: string): ProcessingInstruction;\n    /**\n      *  Returns an empty range object that has both of its boundary points positioned at the beginning of the document. \n      */\n    createRange(): Range;\n    /**\n      * Creates a text string from the specified value. \n      * @param data String that specifies the nodeValue property of the text node.\n      */\n    createTextNode(data: string): Text;\n    createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch;\n    createTouchList(...touches: Touch[]): TouchList;\n    /**\n      * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document.\n      * @param root The root element or node to start traversing on.\n      * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow.\n      * @param filter A custom NodeFilter function to use.\n      * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded.\n      */\n    createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker;\n    /**\n      * Returns the element for the specified x coordinate and the specified y coordinate. \n      * @param x The x-offset\n      * @param y The y-offset\n      */\n    elementFromPoint(x: number, y: number): Element;\n    evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult;\n    /**\n      * Executes a command on the current document, current selection, or the given range.\n      * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.\n      * @param showUI Display the user interface, defaults to false.\n      * @param value Value to assign.\n      */\n    execCommand(commandId: string, showUI?: boolean, value?: any): boolean;\n    /**\n      * Displays help information for the given command identifier.\n      * @param commandId Displays help information for the given command identifier.\n      */\n    execCommandShowHelp(commandId: string): boolean;\n    exitFullscreen(): void;\n    exitPointerLock(): void;\n    /**\n      * Causes the element to receive the focus and executes the code specified by the onfocus event.\n      */\n    focus(): void;\n    /**\n      * Returns a reference to the first object with the specified value of the ID or NAME attribute.\n      * @param elementId String that specifies the ID value. Case-insensitive.\n      */\n    getElementById(elementId: string): HTMLElement | null;\n    getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;\n    /**\n      * Gets a collection of objects based on the value of the NAME or ID attribute.\n      * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute.\n      */\n    getElementsByName(elementName: string): NodeListOf<HTMLElement>;\n    /**\n      * Retrieves a collection of objects based on the specified element name.\n      * @param name Specifies the name of an element.\n      */\n    getElementsByTagName<K extends keyof ElementListTagNameMap>(tagname: K): ElementListTagNameMap[K];\n    getElementsByTagName(tagname: string): NodeListOf<Element>;\n    getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", localName: string): HTMLCollectionOf<HTMLElement>;\n    getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/2000/svg\", localName: string): HTMLCollectionOf<SVGElement>;\n    getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf<Element>;\n    /**\n      * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage.\n      */\n    getSelection(): Selection;\n    /**\n      * Gets a value indicating whether the object currently has focus.\n      */\n    hasFocus(): boolean;\n    importNode(importedNode: Node, deep: boolean): Node;\n    msElementsFromPoint(x: number, y: number): NodeListOf<Element>;\n    msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf<Element>;\n    /**\n      * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.\n      * @param url Specifies a MIME type for the document.\n      * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element.\n      * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, \"fullscreen=yes, toolbar=yes\"). The following values are supported.\n      * @param replace Specifies whether the existing entry for the document is replaced in the history list.\n      */\n    open(url?: string, name?: string, features?: string, replace?: boolean): Document;\n    /** \n      * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document.\n      * @param commandId Specifies a command identifier.\n      */\n    queryCommandEnabled(commandId: string): boolean;\n    /**\n      * Returns a Boolean value that indicates whether the specified command is in the indeterminate state.\n      * @param commandId String that specifies a command identifier.\n      */\n    queryCommandIndeterm(commandId: string): boolean;\n    /**\n      * Returns a Boolean value that indicates the current state of the command.\n      * @param commandId String that specifies a command identifier.\n      */\n    queryCommandState(commandId: string): boolean;\n    /**\n      * Returns a Boolean value that indicates whether the current command is supported on the current range.\n      * @param commandId Specifies a command identifier.\n      */\n    queryCommandSupported(commandId: string): boolean;\n    /**\n      * Retrieves the string associated with a command.\n      * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. \n      */\n    queryCommandText(commandId: string): string;\n    /**\n      * Returns the current value of the document, range, or current selection for the given command.\n      * @param commandId String that specifies a command identifier.\n      */\n    queryCommandValue(commandId: string): string;\n    releaseEvents(): void;\n    /**\n      * Allows updating the print settings for the page.\n      */\n    updateSettings(): void;\n    webkitCancelFullScreen(): void;\n    webkitExitFullscreen(): void;\n    /**\n      * Writes one or more HTML expressions to a document in the specified window. \n      * @param content Specifies the text and HTML tags to write.\n      */\n    write(...content: string[]): void;\n    /**\n      * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. \n      * @param content The text and HTML tags to write.\n      */\n    writeln(...content: string[]): void;\n    addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Document: {\n    prototype: Document;\n    new(): Document;\n}\n\ninterface DocumentFragment extends Node, NodeSelector, ParentNode {\n}\n\ndeclare var DocumentFragment: {\n    prototype: DocumentFragment;\n    new(): DocumentFragment;\n}\n\ninterface DocumentType extends Node, ChildNode {\n    readonly entities: NamedNodeMap;\n    readonly internalSubset: string | null;\n    readonly name: string;\n    readonly notations: NamedNodeMap;\n    readonly publicId: string | null;\n    readonly systemId: string | null;\n}\n\ndeclare var DocumentType: {\n    prototype: DocumentType;\n    new(): DocumentType;\n}\n\ninterface DragEvent extends MouseEvent {\n    readonly dataTransfer: DataTransfer;\n    initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void;\n    msConvertURL(file: File, targetType: string, targetURL?: string): void;\n}\n\ndeclare var DragEvent: {\n    prototype: DragEvent;\n    new(): DragEvent;\n}\n\ninterface DynamicsCompressorNode extends AudioNode {\n    readonly attack: AudioParam;\n    readonly knee: AudioParam;\n    readonly ratio: AudioParam;\n    readonly reduction: AudioParam;\n    readonly release: AudioParam;\n    readonly threshold: AudioParam;\n}\n\ndeclare var DynamicsCompressorNode: {\n    prototype: DynamicsCompressorNode;\n    new(): DynamicsCompressorNode;\n}\n\ninterface EXT_frag_depth {\n}\n\ndeclare var EXT_frag_depth: {\n    prototype: EXT_frag_depth;\n    new(): EXT_frag_depth;\n}\n\ninterface EXT_texture_filter_anisotropic {\n    readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number;\n    readonly TEXTURE_MAX_ANISOTROPY_EXT: number;\n}\n\ndeclare var EXT_texture_filter_anisotropic: {\n    prototype: EXT_texture_filter_anisotropic;\n    new(): EXT_texture_filter_anisotropic;\n    readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number;\n    readonly TEXTURE_MAX_ANISOTROPY_EXT: number;\n}\n\ninterface ElementEventMap extends GlobalEventHandlersEventMap {\n    \"ariarequest\": AriaRequestEvent;\n    \"command\": CommandEvent;\n    \"gotpointercapture\": PointerEvent;\n    \"lostpointercapture\": PointerEvent;\n    \"MSGestureChange\": MSGestureEvent;\n    \"MSGestureDoubleTap\": MSGestureEvent;\n    \"MSGestureEnd\": MSGestureEvent;\n    \"MSGestureHold\": MSGestureEvent;\n    \"MSGestureStart\": MSGestureEvent;\n    \"MSGestureTap\": MSGestureEvent;\n    \"MSGotPointerCapture\": MSPointerEvent;\n    \"MSInertiaStart\": MSGestureEvent;\n    \"MSLostPointerCapture\": MSPointerEvent;\n    \"MSPointerCancel\": MSPointerEvent;\n    \"MSPointerDown\": MSPointerEvent;\n    \"MSPointerEnter\": MSPointerEvent;\n    \"MSPointerLeave\": MSPointerEvent;\n    \"MSPointerMove\": MSPointerEvent;\n    \"MSPointerOut\": MSPointerEvent;\n    \"MSPointerOver\": MSPointerEvent;\n    \"MSPointerUp\": MSPointerEvent;\n    \"touchcancel\": TouchEvent;\n    \"touchend\": TouchEvent;\n    \"touchmove\": TouchEvent;\n    \"touchstart\": TouchEvent;\n    \"webkitfullscreenchange\": Event;\n    \"webkitfullscreenerror\": Event;\n}\n\ninterface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode {\n    readonly classList: DOMTokenList;\n    className: string;\n    readonly clientHeight: number;\n    readonly clientLeft: number;\n    readonly clientTop: number;\n    readonly clientWidth: number;\n    id: string;\n    msContentZoomFactor: number;\n    readonly msRegionOverflow: string;\n    onariarequest: (this: Element, ev: AriaRequestEvent) => any;\n    oncommand: (this: Element, ev: CommandEvent) => any;\n    ongotpointercapture: (this: Element, ev: PointerEvent) => any;\n    onlostpointercapture: (this: Element, ev: PointerEvent) => any;\n    onmsgesturechange: (this: Element, ev: MSGestureEvent) => any;\n    onmsgesturedoubletap: (this: Element, ev: MSGestureEvent) => any;\n    onmsgestureend: (this: Element, ev: MSGestureEvent) => any;\n    onmsgesturehold: (this: Element, ev: MSGestureEvent) => any;\n    onmsgesturestart: (this: Element, ev: MSGestureEvent) => any;\n    onmsgesturetap: (this: Element, ev: MSGestureEvent) => any;\n    onmsgotpointercapture: (this: Element, ev: MSPointerEvent) => any;\n    onmsinertiastart: (this: Element, ev: MSGestureEvent) => any;\n    onmslostpointercapture: (this: Element, ev: MSPointerEvent) => any;\n    onmspointercancel: (this: Element, ev: MSPointerEvent) => any;\n    onmspointerdown: (this: Element, ev: MSPointerEvent) => any;\n    onmspointerenter: (this: Element, ev: MSPointerEvent) => any;\n    onmspointerleave: (this: Element, ev: MSPointerEvent) => any;\n    onmspointermove: (this: Element, ev: MSPointerEvent) => any;\n    onmspointerout: (this: Element, ev: MSPointerEvent) => any;\n    onmspointerover: (this: Element, ev: MSPointerEvent) => any;\n    onmspointerup: (this: Element, ev: MSPointerEvent) => any;\n    ontouchcancel: (ev: TouchEvent) => any;\n    ontouchend: (ev: TouchEvent) => any;\n    ontouchmove: (ev: TouchEvent) => any;\n    ontouchstart: (ev: TouchEvent) => any;\n    onwebkitfullscreenchange: (this: Element, ev: Event) => any;\n    onwebkitfullscreenerror: (this: Element, ev: Event) => any;\n    readonly prefix: string | null;\n    readonly scrollHeight: number;\n    scrollLeft: number;\n    scrollTop: number;\n    readonly scrollWidth: number;\n    readonly tagName: string;\n    innerHTML: string;\n    readonly assignedSlot: HTMLSlotElement | null;\n    slot: string;\n    readonly shadowRoot: ShadowRoot | null;\n    getAttribute(name: string): string | null;\n    getAttributeNS(namespaceURI: string, localName: string): string;\n    getAttributeNode(name: string): Attr;\n    getAttributeNodeNS(namespaceURI: string, localName: string): Attr;\n    getBoundingClientRect(): ClientRect;\n    getClientRects(): ClientRectList;\n    getElementsByTagName<K extends keyof ElementListTagNameMap>(name: K): ElementListTagNameMap[K];\n    getElementsByTagName(name: string): NodeListOf<Element>;\n    getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", localName: string): HTMLCollectionOf<HTMLElement>;\n    getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/2000/svg\", localName: string): HTMLCollectionOf<SVGElement>;\n    getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf<Element>;\n    hasAttribute(name: string): boolean;\n    hasAttributeNS(namespaceURI: string, localName: string): boolean;\n    msGetRegionContent(): MSRangeCollection;\n    msGetUntransformedBounds(): ClientRect;\n    msMatchesSelector(selectors: string): boolean;\n    msReleasePointerCapture(pointerId: number): void;\n    msSetPointerCapture(pointerId: number): void;\n    msZoomTo(args: MsZoomToOptions): void;\n    releasePointerCapture(pointerId: number): void;\n    removeAttribute(name?: string): void;\n    removeAttributeNS(namespaceURI: string, localName: string): void;\n    removeAttributeNode(oldAttr: Attr): Attr;\n    requestFullscreen(): void;\n    requestPointerLock(): void;\n    setAttribute(name: string, value: string): void;\n    setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void;\n    setAttributeNode(newAttr: Attr): Attr;\n    setAttributeNodeNS(newAttr: Attr): Attr;\n    setPointerCapture(pointerId: number): void;\n    webkitMatchesSelector(selectors: string): boolean;\n    webkitRequestFullScreen(): void;\n    webkitRequestFullscreen(): void;\n    getElementsByClassName(classNames: string): NodeListOf<Element>;\n    matches(selector: string): boolean;\n    closest(selector: string): Element | null;\n    scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;\n    scroll(options?: ScrollToOptions): void;\n    scroll(x: number, y: number): void;\n    scrollTo(options?: ScrollToOptions): void;\n    scrollTo(x: number, y: number): void;\n    scrollBy(options?: ScrollToOptions): void;\n    scrollBy(x: number, y: number): void;\n    insertAdjacentElement(position: string, insertedElement: Element): Element | null;\n    insertAdjacentHTML(where: string, html: string): void;\n    insertAdjacentText(where: string, text: string): void;\n    attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot;\n    addEventListener<K extends keyof ElementEventMap>(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Element: {\n    prototype: Element;\n    new(): Element;\n}\n\ninterface ErrorEvent extends Event {\n    readonly colno: number;\n    readonly error: any;\n    readonly filename: string;\n    readonly lineno: number;\n    readonly message: string;\n    initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void;\n}\n\ndeclare var ErrorEvent: {\n    prototype: ErrorEvent;\n    new(): ErrorEvent;\n}\n\ninterface Event {\n    readonly bubbles: boolean;\n    cancelBubble: boolean;\n    readonly cancelable: boolean;\n    readonly currentTarget: EventTarget;\n    readonly defaultPrevented: boolean;\n    readonly eventPhase: number;\n    readonly isTrusted: boolean;\n    returnValue: boolean;\n    readonly srcElement: Element | null;\n    readonly target: EventTarget;\n    readonly timeStamp: number;\n    readonly type: string;\n    readonly scoped: boolean;\n    initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void;\n    preventDefault(): void;\n    stopImmediatePropagation(): void;\n    stopPropagation(): void;\n    deepPath(): EventTarget[];\n    readonly AT_TARGET: number;\n    readonly BUBBLING_PHASE: number;\n    readonly CAPTURING_PHASE: number;\n}\n\ndeclare var Event: {\n    prototype: Event;\n    new(type: string, eventInitDict?: EventInit): Event;\n    readonly AT_TARGET: number;\n    readonly BUBBLING_PHASE: number;\n    readonly CAPTURING_PHASE: number;\n}\n\ninterface EventTarget {\n    addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n    dispatchEvent(evt: Event): boolean;\n    removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var EventTarget: {\n    prototype: EventTarget;\n    new(): EventTarget;\n}\n\ninterface External {\n}\n\ndeclare var External: {\n    prototype: External;\n    new(): External;\n}\n\ninterface File extends Blob {\n    readonly lastModifiedDate: any;\n    readonly name: string;\n    readonly webkitRelativePath: string;\n}\n\ndeclare var File: {\n    prototype: File;\n    new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File;\n}\n\ninterface FileList {\n    readonly length: number;\n    item(index: number): File;\n    [index: number]: File;\n}\n\ndeclare var FileList: {\n    prototype: FileList;\n    new(): FileList;\n}\n\ninterface FileReader extends EventTarget, MSBaseReader {\n    readonly error: DOMError;\n    readAsArrayBuffer(blob: Blob): void;\n    readAsBinaryString(blob: Blob): void;\n    readAsDataURL(blob: Blob): void;\n    readAsText(blob: Blob, encoding?: string): void;\n    addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var FileReader: {\n    prototype: FileReader;\n    new(): FileReader;\n}\n\ninterface FocusEvent extends UIEvent {\n    readonly relatedTarget: EventTarget;\n    initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void;\n}\n\ndeclare var FocusEvent: {\n    prototype: FocusEvent;\n    new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent;\n}\n\ninterface FormData {\n    append(name: any, value: any, blobName?: string): void;\n}\n\ndeclare var FormData: {\n    prototype: FormData;\n    new (form?: HTMLFormElement): FormData;\n}\n\ninterface GainNode extends AudioNode {\n    readonly gain: AudioParam;\n}\n\ndeclare var GainNode: {\n    prototype: GainNode;\n    new(): GainNode;\n}\n\ninterface Gamepad {\n    readonly axes: number[];\n    readonly buttons: GamepadButton[];\n    readonly connected: boolean;\n    readonly id: string;\n    readonly index: number;\n    readonly mapping: string;\n    readonly timestamp: number;\n}\n\ndeclare var Gamepad: {\n    prototype: Gamepad;\n    new(): Gamepad;\n}\n\ninterface GamepadButton {\n    readonly pressed: boolean;\n    readonly value: number;\n}\n\ndeclare var GamepadButton: {\n    prototype: GamepadButton;\n    new(): GamepadButton;\n}\n\ninterface GamepadEvent extends Event {\n    readonly gamepad: Gamepad;\n}\n\ndeclare var GamepadEvent: {\n    prototype: GamepadEvent;\n    new(): GamepadEvent;\n}\n\ninterface Geolocation {\n    clearWatch(watchId: number): void;\n    getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void;\n    watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number;\n}\n\ndeclare var Geolocation: {\n    prototype: Geolocation;\n    new(): Geolocation;\n}\n\ninterface HTMLAllCollection extends HTMLCollection {\n    namedItem(name: string): Element;\n}\n\ndeclare var HTMLAllCollection: {\n    prototype: HTMLAllCollection;\n    new(): HTMLAllCollection;\n}\n\ninterface HTMLAnchorElement extends HTMLElement {\n    Methods: string;\n    /**\n      * Sets or retrieves the character set used to encode the object.\n      */\n    charset: string;\n    /**\n      * Sets or retrieves the coordinates of the object.\n      */\n    coords: string;\n    download: string;\n    /**\n      * Contains the anchor portion of the URL including the hash sign (#).\n      */\n    hash: string;\n    /**\n      * Contains the hostname and port values of the URL.\n      */\n    host: string;\n    /**\n      * Contains the hostname of a URL.\n      */\n    hostname: string;\n    /**\n      * Sets or retrieves a destination URL or an anchor point.\n      */\n    href: string;\n    /**\n      * Sets or retrieves the language code of the object.\n      */\n    hreflang: string;\n    readonly mimeType: string;\n    /**\n      * Sets or retrieves the shape of the object.\n      */\n    name: string;\n    readonly nameProp: string;\n    /**\n      * Contains the pathname of the URL.\n      */\n    pathname: string;\n    /**\n      * Sets or retrieves the port number associated with a URL.\n      */\n    port: string;\n    /**\n      * Contains the protocol of the URL.\n      */\n    protocol: string;\n    readonly protocolLong: string;\n    /**\n      * Sets or retrieves the relationship between the object and the destination of the link.\n      */\n    rel: string;\n    /**\n      * Sets or retrieves the relationship between the object and the destination of the link.\n      */\n    rev: string;\n    /**\n      * Sets or retrieves the substring of the href property that follows the question mark.\n      */\n    search: string;\n    /**\n      * Sets or retrieves the shape of the object.\n      */\n    shape: string;\n    /**\n      * Sets or retrieves the window or frame at which to target content.\n      */\n    target: string;\n    /**\n      * Retrieves or sets the text of the object as a string. \n      */\n    text: string;\n    type: string;\n    urn: string;\n    /** \n      * Returns a string representation of an object.\n      */\n    toString(): string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLAnchorElement: {\n    prototype: HTMLAnchorElement;\n    new(): HTMLAnchorElement;\n}\n\ninterface HTMLAppletElement extends HTMLElement {\n    /**\n      * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element.\n      */\n    readonly BaseHref: string;\n    align: string;\n    /**\n      * Sets or retrieves a text alternative to the graphic.\n      */\n    alt: string;\n    /**\n      * Gets or sets the optional alternative HTML script to execute if the object fails to load.\n      */\n    altHtml: string;\n    /**\n      * Sets or retrieves a character string that can be used to implement your own archive functionality for the object.\n      */\n    archive: string;\n    border: string;\n    code: string;\n    /**\n      * Sets or retrieves the URL of the component.\n      */\n    codeBase: string;\n    /**\n      * Sets or retrieves the Internet media type for the code associated with the object.\n      */\n    codeType: string;\n    /**\n      * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned.\n      */\n    readonly contentDocument: Document;\n    /**\n      * Sets or retrieves the URL that references the data of the object.\n      */\n    data: string;\n    /**\n      * Sets or retrieves a character string that can be used to implement your own declare functionality for the object.\n      */\n    declare: boolean;\n    readonly form: HTMLFormElement;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: string;\n    hspace: number;\n    /**\n      * Sets or retrieves the shape of the object.\n      */\n    name: string;\n    object: string | null;\n    /**\n      * Sets or retrieves a message to be displayed while an object is loading.\n      */\n    standby: string;\n    /**\n      * Returns the content type of the object.\n      */\n    type: string;\n    /**\n      * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\n      */\n    useMap: string;\n    vspace: number;\n    width: number;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLAppletElement: {\n    prototype: HTMLAppletElement;\n    new(): HTMLAppletElement;\n}\n\ninterface HTMLAreaElement extends HTMLElement {\n    /**\n      * Sets or retrieves a text alternative to the graphic.\n      */\n    alt: string;\n    /**\n      * Sets or retrieves the coordinates of the object.\n      */\n    coords: string;\n    download: string;\n    /**\n      * Sets or retrieves the subsection of the href property that follows the number sign (#).\n      */\n    hash: string;\n    /**\n      * Sets or retrieves the hostname and port number of the location or URL.\n      */\n    host: string;\n    /**\n      * Sets or retrieves the host name part of the location or URL. \n      */\n    hostname: string;\n    /**\n      * Sets or retrieves a destination URL or an anchor point.\n      */\n    href: string;\n    /**\n      * Sets or gets whether clicks in this region cause action.\n      */\n    noHref: boolean;\n    /**\n      * Sets or retrieves the file name or path specified by the object.\n      */\n    pathname: string;\n    /**\n      * Sets or retrieves the port number associated with a URL.\n      */\n    port: string;\n    /**\n      * Sets or retrieves the protocol portion of a URL.\n      */\n    protocol: string;\n    rel: string;\n    /**\n      * Sets or retrieves the substring of the href property that follows the question mark.\n      */\n    search: string;\n    /**\n      * Sets or retrieves the shape of the object.\n      */\n    shape: string;\n    /**\n      * Sets or retrieves the window or frame at which to target content.\n      */\n    target: string;\n    /** \n      * Returns a string representation of an object.\n      */\n    toString(): string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLAreaElement: {\n    prototype: HTMLAreaElement;\n    new(): HTMLAreaElement;\n}\n\ninterface HTMLAreasCollection extends HTMLCollection {\n    /**\n      * Adds an element to the areas, controlRange, or options collection.\n      */\n    add(element: HTMLElement, before?: HTMLElement | number): void;\n    /**\n      * Removes an element from the collection.\n      */\n    remove(index?: number): void;\n}\n\ndeclare var HTMLAreasCollection: {\n    prototype: HTMLAreasCollection;\n    new(): HTMLAreasCollection;\n}\n\ninterface HTMLAudioElement extends HTMLMediaElement {\n    addEventListener<K extends keyof HTMLMediaElementEventMap>(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLAudioElement: {\n    prototype: HTMLAudioElement;\n    new(): HTMLAudioElement;\n}\n\ninterface HTMLBRElement extends HTMLElement {\n    /**\n      * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document.\n      */\n    clear: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLBRElement: {\n    prototype: HTMLBRElement;\n    new(): HTMLBRElement;\n}\n\ninterface HTMLBaseElement extends HTMLElement {\n    /**\n      * Gets or sets the baseline URL on which relative links are based.\n      */\n    href: string;\n    /**\n      * Sets or retrieves the window or frame at which to target content.\n      */\n    target: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLBaseElement: {\n    prototype: HTMLBaseElement;\n    new(): HTMLBaseElement;\n}\n\ninterface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty {\n    /**\n      * Sets or retrieves the current typeface family.\n      */\n    face: string;\n    /**\n      * Sets or retrieves the font size of the object.\n      */\n    size: number;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLBaseFontElement: {\n    prototype: HTMLBaseFontElement;\n    new(): HTMLBaseFontElement;\n}\n\ninterface HTMLBodyElementEventMap extends HTMLElementEventMap {\n    \"afterprint\": Event;\n    \"beforeprint\": Event;\n    \"beforeunload\": BeforeUnloadEvent;\n    \"blur\": FocusEvent;\n    \"error\": ErrorEvent;\n    \"focus\": FocusEvent;\n    \"hashchange\": HashChangeEvent;\n    \"load\": Event;\n    \"message\": MessageEvent;\n    \"offline\": Event;\n    \"online\": Event;\n    \"orientationchange\": Event;\n    \"pagehide\": PageTransitionEvent;\n    \"pageshow\": PageTransitionEvent;\n    \"popstate\": PopStateEvent;\n    \"resize\": UIEvent;\n    \"storage\": StorageEvent;\n    \"unload\": Event;\n}\n\ninterface HTMLBodyElement extends HTMLElement {\n    aLink: any;\n    background: string;\n    bgColor: any;\n    bgProperties: string;\n    link: any;\n    noWrap: boolean;\n    onafterprint: (this: HTMLBodyElement, ev: Event) => any;\n    onbeforeprint: (this: HTMLBodyElement, ev: Event) => any;\n    onbeforeunload: (this: HTMLBodyElement, ev: BeforeUnloadEvent) => any;\n    onblur: (this: HTMLBodyElement, ev: FocusEvent) => any;\n    onerror: (this: HTMLBodyElement, ev: ErrorEvent) => any;\n    onfocus: (this: HTMLBodyElement, ev: FocusEvent) => any;\n    onhashchange: (this: HTMLBodyElement, ev: HashChangeEvent) => any;\n    onload: (this: HTMLBodyElement, ev: Event) => any;\n    onmessage: (this: HTMLBodyElement, ev: MessageEvent) => any;\n    onoffline: (this: HTMLBodyElement, ev: Event) => any;\n    ononline: (this: HTMLBodyElement, ev: Event) => any;\n    onorientationchange: (this: HTMLBodyElement, ev: Event) => any;\n    onpagehide: (this: HTMLBodyElement, ev: PageTransitionEvent) => any;\n    onpageshow: (this: HTMLBodyElement, ev: PageTransitionEvent) => any;\n    onpopstate: (this: HTMLBodyElement, ev: PopStateEvent) => any;\n    onresize: (this: HTMLBodyElement, ev: UIEvent) => any;\n    onstorage: (this: HTMLBodyElement, ev: StorageEvent) => any;\n    onunload: (this: HTMLBodyElement, ev: Event) => any;\n    text: any;\n    vLink: any;\n    addEventListener<K extends keyof HTMLBodyElementEventMap>(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLBodyElement: {\n    prototype: HTMLBodyElement;\n    new(): HTMLBodyElement;\n}\n\ninterface HTMLButtonElement extends HTMLElement {\n    /**\n      * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\n      */\n    autofocus: boolean;\n    disabled: boolean;\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Overrides the action attribute (where the data on a form is sent) on the parent form element.\n      */\n    formAction: string;\n    /**\n      * Used to override the encoding (formEnctype attribute) specified on the form element.\n      */\n    formEnctype: string;\n    /**\n      * Overrides the submit method attribute previously specified on a form element.\n      */\n    formMethod: string;\n    /**\n      * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a \"save draft\"-type submit option.\n      */\n    formNoValidate: string;\n    /**\n      * Overrides the target attribute on a form element.\n      */\n    formTarget: string;\n    /** \n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    status: any;\n    /**\n      * Gets the classification and default behavior of the button.\n      */\n    type: string;\n    /**\n      * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n      */\n    readonly validationMessage: string;\n    /**\n      * Returns a  ValidityState object that represents the validity states of an element.\n      */\n    readonly validity: ValidityState;\n    /** \n      * Sets or retrieves the default or selected value of the control.\n      */\n    value: string;\n    /**\n      * Returns whether an element will successfully validate based on forms validation rules and constraints.\n      */\n    readonly willValidate: boolean;\n    /**\n      * Returns whether a form will validate when it is submitted, without having to submit it.\n      */\n    checkValidity(): boolean;\n    /**\n      * Sets a custom error message that is displayed when a form is submitted.\n      * @param error Sets a custom error message that is displayed when a form is submitted.\n      */\n    setCustomValidity(error: string): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLButtonElement: {\n    prototype: HTMLButtonElement;\n    new(): HTMLButtonElement;\n}\n\ninterface HTMLCanvasElement extends HTMLElement {\n    /**\n      * Gets or sets the height of a canvas element on a document.\n      */\n    height: number;\n    /**\n      * Gets or sets the width of a canvas element on a document.\n      */\n    width: number;\n    /**\n      * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.\n      * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext(\"2d\"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext(\"experimental-webgl\");\n      */\n    getContext(contextId: \"2d\", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null;\n    getContext(contextId: \"webgl\" | \"experimental-webgl\", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null;\n    getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null;\n    /**\n      * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing.\n      */\n    msToBlob(): Blob;\n    /**\n      * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element.\n      * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.\n      */\n    toDataURL(type?: string, ...args: any[]): string;\n    toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLCanvasElement: {\n    prototype: HTMLCanvasElement;\n    new(): HTMLCanvasElement;\n}\n\ninterface HTMLCollection {\n    /**\n      * Sets or retrieves the number of objects in a collection.\n      */\n    readonly length: number;\n    /**\n      * Retrieves an object from various collections.\n      */\n    item(index: number): Element;\n    /**\n      * Retrieves a select object or an object from an options collection.\n      */\n    namedItem(name: string): Element;\n    [index: number]: Element;\n}\n\ndeclare var HTMLCollection: {\n    prototype: HTMLCollection;\n    new(): HTMLCollection;\n}\n\ninterface HTMLDListElement extends HTMLElement {\n    compact: boolean;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDListElement: {\n    prototype: HTMLDListElement;\n    new(): HTMLDListElement;\n}\n\ninterface HTMLDataListElement extends HTMLElement {\n    options: HTMLCollectionOf<HTMLOptionElement>;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDataListElement: {\n    prototype: HTMLDataListElement;\n    new(): HTMLDataListElement;\n}\n\ninterface HTMLDirectoryElement extends HTMLElement {\n    compact: boolean;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDirectoryElement: {\n    prototype: HTMLDirectoryElement;\n    new(): HTMLDirectoryElement;\n}\n\ninterface HTMLDivElement extends HTMLElement {\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text. \n      */\n    align: string;\n    /**\n      * Sets or retrieves whether the browser automatically performs wordwrap.\n      */\n    noWrap: boolean;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDivElement: {\n    prototype: HTMLDivElement;\n    new(): HTMLDivElement;\n}\n\ninterface HTMLDocument extends Document {\n    addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDocument: {\n    prototype: HTMLDocument;\n    new(): HTMLDocument;\n}\n\ninterface HTMLElementEventMap extends ElementEventMap {\n    \"abort\": UIEvent;\n    \"activate\": UIEvent;\n    \"beforeactivate\": UIEvent;\n    \"beforecopy\": ClipboardEvent;\n    \"beforecut\": ClipboardEvent;\n    \"beforedeactivate\": UIEvent;\n    \"beforepaste\": ClipboardEvent;\n    \"blur\": FocusEvent;\n    \"canplay\": Event;\n    \"canplaythrough\": Event;\n    \"change\": Event;\n    \"click\": MouseEvent;\n    \"contextmenu\": PointerEvent;\n    \"copy\": ClipboardEvent;\n    \"cuechange\": Event;\n    \"cut\": ClipboardEvent;\n    \"dblclick\": MouseEvent;\n    \"deactivate\": UIEvent;\n    \"drag\": DragEvent;\n    \"dragend\": DragEvent;\n    \"dragenter\": DragEvent;\n    \"dragleave\": DragEvent;\n    \"dragover\": DragEvent;\n    \"dragstart\": DragEvent;\n    \"drop\": DragEvent;\n    \"durationchange\": Event;\n    \"emptied\": Event;\n    \"ended\": MediaStreamErrorEvent;\n    \"error\": ErrorEvent;\n    \"focus\": FocusEvent;\n    \"input\": Event;\n    \"invalid\": Event;\n    \"keydown\": KeyboardEvent;\n    \"keypress\": KeyboardEvent;\n    \"keyup\": KeyboardEvent;\n    \"load\": Event;\n    \"loadeddata\": Event;\n    \"loadedmetadata\": Event;\n    \"loadstart\": Event;\n    \"mousedown\": MouseEvent;\n    \"mouseenter\": MouseEvent;\n    \"mouseleave\": MouseEvent;\n    \"mousemove\": MouseEvent;\n    \"mouseout\": MouseEvent;\n    \"mouseover\": MouseEvent;\n    \"mouseup\": MouseEvent;\n    \"mousewheel\": WheelEvent;\n    \"MSContentZoom\": UIEvent;\n    \"MSManipulationStateChanged\": MSManipulationEvent;\n    \"paste\": ClipboardEvent;\n    \"pause\": Event;\n    \"play\": Event;\n    \"playing\": Event;\n    \"progress\": ProgressEvent;\n    \"ratechange\": Event;\n    \"reset\": Event;\n    \"scroll\": UIEvent;\n    \"seeked\": Event;\n    \"seeking\": Event;\n    \"select\": UIEvent;\n    \"selectstart\": Event;\n    \"stalled\": Event;\n    \"submit\": Event;\n    \"suspend\": Event;\n    \"timeupdate\": Event;\n    \"volumechange\": Event;\n    \"waiting\": Event;\n}\n\ninterface HTMLElement extends Element {\n    accessKey: string;\n    readonly children: HTMLCollection;\n    contentEditable: string;\n    readonly dataset: DOMStringMap;\n    dir: string;\n    draggable: boolean;\n    hidden: boolean;\n    hideFocus: boolean;\n    innerHTML: string;\n    innerText: string;\n    readonly isContentEditable: boolean;\n    lang: string;\n    readonly offsetHeight: number;\n    readonly offsetLeft: number;\n    readonly offsetParent: Element;\n    readonly offsetTop: number;\n    readonly offsetWidth: number;\n    onabort: (this: HTMLElement, ev: UIEvent) => any;\n    onactivate: (this: HTMLElement, ev: UIEvent) => any;\n    onbeforeactivate: (this: HTMLElement, ev: UIEvent) => any;\n    onbeforecopy: (this: HTMLElement, ev: ClipboardEvent) => any;\n    onbeforecut: (this: HTMLElement, ev: ClipboardEvent) => any;\n    onbeforedeactivate: (this: HTMLElement, ev: UIEvent) => any;\n    onbeforepaste: (this: HTMLElement, ev: ClipboardEvent) => any;\n    onblur: (this: HTMLElement, ev: FocusEvent) => any;\n    oncanplay: (this: HTMLElement, ev: Event) => any;\n    oncanplaythrough: (this: HTMLElement, ev: Event) => any;\n    onchange: (this: HTMLElement, ev: Event) => any;\n    onclick: (this: HTMLElement, ev: MouseEvent) => any;\n    oncontextmenu: (this: HTMLElement, ev: PointerEvent) => any;\n    oncopy: (this: HTMLElement, ev: ClipboardEvent) => any;\n    oncuechange: (this: HTMLElement, ev: Event) => any;\n    oncut: (this: HTMLElement, ev: ClipboardEvent) => any;\n    ondblclick: (this: HTMLElement, ev: MouseEvent) => any;\n    ondeactivate: (this: HTMLElement, ev: UIEvent) => any;\n    ondrag: (this: HTMLElement, ev: DragEvent) => any;\n    ondragend: (this: HTMLElement, ev: DragEvent) => any;\n    ondragenter: (this: HTMLElement, ev: DragEvent) => any;\n    ondragleave: (this: HTMLElement, ev: DragEvent) => any;\n    ondragover: (this: HTMLElement, ev: DragEvent) => any;\n    ondragstart: (this: HTMLElement, ev: DragEvent) => any;\n    ondrop: (this: HTMLElement, ev: DragEvent) => any;\n    ondurationchange: (this: HTMLElement, ev: Event) => any;\n    onemptied: (this: HTMLElement, ev: Event) => any;\n    onended: (this: HTMLElement, ev: MediaStreamErrorEvent) => any;\n    onerror: (this: HTMLElement, ev: ErrorEvent) => any;\n    onfocus: (this: HTMLElement, ev: FocusEvent) => any;\n    oninput: (this: HTMLElement, ev: Event) => any;\n    oninvalid: (this: HTMLElement, ev: Event) => any;\n    onkeydown: (this: HTMLElement, ev: KeyboardEvent) => any;\n    onkeypress: (this: HTMLElement, ev: KeyboardEvent) => any;\n    onkeyup: (this: HTMLElement, ev: KeyboardEvent) => any;\n    onload: (this: HTMLElement, ev: Event) => any;\n    onloadeddata: (this: HTMLElement, ev: Event) => any;\n    onloadedmetadata: (this: HTMLElement, ev: Event) => any;\n    onloadstart: (this: HTMLElement, ev: Event) => any;\n    onmousedown: (this: HTMLElement, ev: MouseEvent) => any;\n    onmouseenter: (this: HTMLElement, ev: MouseEvent) => any;\n    onmouseleave: (this: HTMLElement, ev: MouseEvent) => any;\n    onmousemove: (this: HTMLElement, ev: MouseEvent) => any;\n    onmouseout: (this: HTMLElement, ev: MouseEvent) => any;\n    onmouseover: (this: HTMLElement, ev: MouseEvent) => any;\n    onmouseup: (this: HTMLElement, ev: MouseEvent) => any;\n    onmousewheel: (this: HTMLElement, ev: WheelEvent) => any;\n    onmscontentzoom: (this: HTMLElement, ev: UIEvent) => any;\n    onmsmanipulationstatechanged: (this: HTMLElement, ev: MSManipulationEvent) => any;\n    onpaste: (this: HTMLElement, ev: ClipboardEvent) => any;\n    onpause: (this: HTMLElement, ev: Event) => any;\n    onplay: (this: HTMLElement, ev: Event) => any;\n    onplaying: (this: HTMLElement, ev: Event) => any;\n    onprogress: (this: HTMLElement, ev: ProgressEvent) => any;\n    onratechange: (this: HTMLElement, ev: Event) => any;\n    onreset: (this: HTMLElement, ev: Event) => any;\n    onscroll: (this: HTMLElement, ev: UIEvent) => any;\n    onseeked: (this: HTMLElement, ev: Event) => any;\n    onseeking: (this: HTMLElement, ev: Event) => any;\n    onselect: (this: HTMLElement, ev: UIEvent) => any;\n    onselectstart: (this: HTMLElement, ev: Event) => any;\n    onstalled: (this: HTMLElement, ev: Event) => any;\n    onsubmit: (this: HTMLElement, ev: Event) => any;\n    onsuspend: (this: HTMLElement, ev: Event) => any;\n    ontimeupdate: (this: HTMLElement, ev: Event) => any;\n    onvolumechange: (this: HTMLElement, ev: Event) => any;\n    onwaiting: (this: HTMLElement, ev: Event) => any;\n    outerHTML: string;\n    outerText: string;\n    spellcheck: boolean;\n    readonly style: CSSStyleDeclaration;\n    tabIndex: number;\n    title: string;\n    blur(): void;\n    click(): void;\n    dragDrop(): boolean;\n    focus(): void;\n    msGetInputContext(): MSInputMethodContext;\n    setActive(): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLElement: {\n    prototype: HTMLElement;\n    new(): HTMLElement;\n}\n\ninterface HTMLEmbedElement extends HTMLElement, GetSVGDocument {\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: string;\n    hidden: any;\n    /**\n      * Gets or sets whether the DLNA PlayTo device is available.\n      */\n    msPlayToDisabled: boolean;\n    /**\n      * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\n      */\n    msPlayToPreferredSourceUri: string;\n    /**\n      * Gets or sets the primary DLNA PlayTo device.\n      */\n    msPlayToPrimary: boolean;\n    /**\n      * Gets the source associated with the media element for use by the PlayToManager.\n      */\n    readonly msPlayToSource: any;\n    /**\n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    /**\n      * Retrieves the palette used for the embedded document.\n      */\n    readonly palette: string;\n    /**\n      * Retrieves the URL of the plug-in used to view an embedded document.\n      */\n    readonly pluginspage: string;\n    readonly readyState: string;\n    /**\n      * Sets or retrieves a URL to be loaded by the object.\n      */\n    src: string;\n    /**\n      * Sets or retrieves the height and width units of the embed object.\n      */\n    units: string;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLEmbedElement: {\n    prototype: HTMLEmbedElement;\n    new(): HTMLEmbedElement;\n}\n\ninterface HTMLFieldSetElement extends HTMLElement {\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text.\n      */\n    align: string;\n    disabled: boolean;\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n      */\n    readonly validationMessage: string;\n    /**\n      * Returns a  ValidityState object that represents the validity states of an element.\n      */\n    readonly validity: ValidityState;\n    /**\n      * Returns whether an element will successfully validate based on forms validation rules and constraints.\n      */\n    readonly willValidate: boolean;\n    /**\n      * Returns whether a form will validate when it is submitted, without having to submit it.\n      */\n    checkValidity(): boolean;\n    /**\n      * Sets a custom error message that is displayed when a form is submitted.\n      * @param error Sets a custom error message that is displayed when a form is submitted.\n      */\n    setCustomValidity(error: string): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLFieldSetElement: {\n    prototype: HTMLFieldSetElement;\n    new(): HTMLFieldSetElement;\n}\n\ninterface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty {\n    /**\n      * Sets or retrieves the current typeface family.\n      */\n    face: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLFontElement: {\n    prototype: HTMLFontElement;\n    new(): HTMLFontElement;\n}\n\ninterface HTMLFormElement extends HTMLElement {\n    /**\n      * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form.\n      */\n    acceptCharset: string;\n    /**\n      * Sets or retrieves the URL to which the form content is sent for processing.\n      */\n    action: string;\n    /**\n      * Specifies whether autocomplete is applied to an editable text field.\n      */\n    autocomplete: string;\n    /**\n      * Retrieves a collection, in source order, of all controls in a given form.\n      */\n    readonly elements: HTMLCollection;\n    /**\n      * Sets or retrieves the MIME encoding for the form.\n      */\n    encoding: string;\n    /**\n      * Sets or retrieves the encoding type for the form.\n      */\n    enctype: string;\n    /**\n      * Sets or retrieves the number of objects in a collection.\n      */\n    readonly length: number;\n    /**\n      * Sets or retrieves how to send the form data to the server.\n      */\n    method: string;\n    /**\n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    /**\n      * Designates a form that is not validated when submitted.\n      */\n    noValidate: boolean;\n    /**\n      * Sets or retrieves the window or frame at which to target content.\n      */\n    target: string;\n    /**\n      * Returns whether a form will validate when it is submitted, without having to submit it.\n      */\n    checkValidity(): boolean;\n    /**\n      * Retrieves a form object or an object from an elements collection.\n      * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made.\n      * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned.\n      */\n    item(name?: any, index?: any): any;\n    /**\n      * Retrieves a form object or an object from an elements collection.\n      */\n    namedItem(name: string): any;\n    /**\n      * Fires when the user resets a form.\n      */\n    reset(): void;\n    /**\n      * Fires when a FORM is about to be submitted.\n      */\n    submit(): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n    [name: string]: any;\n}\n\ndeclare var HTMLFormElement: {\n    prototype: HTMLFormElement;\n    new(): HTMLFormElement;\n}\n\ninterface HTMLFrameElementEventMap extends HTMLElementEventMap {\n    \"load\": Event;\n}\n\ninterface HTMLFrameElement extends HTMLElement, GetSVGDocument {\n    /**\n      * Specifies the properties of a border drawn around an object.\n      */\n    border: string;\n    /**\n      * Sets or retrieves the border color of the object.\n      */\n    borderColor: any;\n    /**\n      * Retrieves the document object of the page or frame.\n      */\n    readonly contentDocument: Document;\n    /**\n      * Retrieves the object of the specified.\n      */\n    readonly contentWindow: Window;\n    /**\n      * Sets or retrieves whether to display a border for the frame.\n      */\n    frameBorder: string;\n    /**\n      * Sets or retrieves the amount of additional space between the frames.\n      */\n    frameSpacing: any;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: string | number;\n    /**\n      * Sets or retrieves a URI to a long description of the object.\n      */\n    longDesc: string;\n    /**\n      * Sets or retrieves the top and bottom margin heights before displaying the text in a frame.\n      */\n    marginHeight: string;\n    /**\n      * Sets or retrieves the left and right margin widths before displaying the text in a frame.\n      */\n    marginWidth: string;\n    /**\n      * Sets or retrieves the frame name.\n      */\n    name: string;\n    /**\n      * Sets or retrieves whether the user can resize the frame.\n      */\n    noResize: boolean;\n    /**\n      * Raised when the object has been completely received from the server.\n      */\n    onload: (this: HTMLFrameElement, ev: Event) => any;\n    /**\n      * Sets or retrieves whether the frame can be scrolled.\n      */\n    scrolling: string;\n    /**\n      * Sets or retrieves a URL to be loaded by the object.\n      */\n    src: string;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: string | number;\n    addEventListener<K extends keyof HTMLFrameElementEventMap>(type: K, listener: (this: HTMLFrameElement, ev: HTMLFrameElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLFrameElement: {\n    prototype: HTMLFrameElement;\n    new(): HTMLFrameElement;\n}\n\ninterface HTMLFrameSetElementEventMap extends HTMLElementEventMap {\n    \"beforeprint\": Event;\n    \"beforeunload\": BeforeUnloadEvent;\n    \"blur\": FocusEvent;\n    \"error\": ErrorEvent;\n    \"focus\": FocusEvent;\n    \"hashchange\": HashChangeEvent;\n    \"load\": Event;\n    \"message\": MessageEvent;\n    \"offline\": Event;\n    \"online\": Event;\n    \"orientationchange\": Event;\n    \"pagehide\": PageTransitionEvent;\n    \"pageshow\": PageTransitionEvent;\n    \"resize\": UIEvent;\n    \"storage\": StorageEvent;\n    \"unload\": Event;\n}\n\ninterface HTMLFrameSetElement extends HTMLElement {\n    border: string;\n    /**\n      * Sets or retrieves the border color of the object.\n      */\n    borderColor: any;\n    /**\n      * Sets or retrieves the frame widths of the object.\n      */\n    cols: string;\n    /**\n      * Sets or retrieves whether to display a border for the frame.\n      */\n    frameBorder: string;\n    /**\n      * Sets or retrieves the amount of additional space between the frames.\n      */\n    frameSpacing: any;\n    name: string;\n    onafterprint: (this: HTMLFrameSetElement, ev: Event) => any;\n    onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any;\n    onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any;\n    /**\n      * Fires when the object loses the input focus.\n      */\n    onblur: (this: HTMLFrameSetElement, ev: FocusEvent) => any;\n    onerror: (this: HTMLFrameSetElement, ev: ErrorEvent) => any;\n    /**\n      * Fires when the object receives focus.\n      */\n    onfocus: (this: HTMLFrameSetElement, ev: FocusEvent) => any;\n    onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any;\n    onload: (this: HTMLFrameSetElement, ev: Event) => any;\n    onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any;\n    onoffline: (this: HTMLFrameSetElement, ev: Event) => any;\n    ononline: (this: HTMLFrameSetElement, ev: Event) => any;\n    onorientationchange: (this: HTMLFrameSetElement, ev: Event) => any;\n    onpagehide: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any;\n    onpageshow: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any;\n    onresize: (this: HTMLFrameSetElement, ev: UIEvent) => any;\n    onstorage: (this: HTMLFrameSetElement, ev: StorageEvent) => any;\n    onunload: (this: HTMLFrameSetElement, ev: Event) => any;\n    /**\n      * Sets or retrieves the frame heights of the object.\n      */\n    rows: string;\n    addEventListener<K extends keyof HTMLFrameSetElementEventMap>(type: K, listener: (this: HTMLFrameSetElement, ev: HTMLFrameSetElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLFrameSetElement: {\n    prototype: HTMLFrameSetElement;\n    new(): HTMLFrameSetElement;\n}\n\ninterface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty {\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text.\n      */\n    align: string;\n    /**\n      * Sets or retrieves whether the horizontal rule is drawn with 3-D shading.\n      */\n    noShade: boolean;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: number;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLHRElement: {\n    prototype: HTMLHRElement;\n    new(): HTMLHRElement;\n}\n\ninterface HTMLHeadElement extends HTMLElement {\n    profile: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLHeadElement: {\n    prototype: HTMLHeadElement;\n    new(): HTMLHeadElement;\n}\n\ninterface HTMLHeadingElement extends HTMLElement {\n    /**\n      * Sets or retrieves a value that indicates the table alignment.\n      */\n    align: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLHeadingElement: {\n    prototype: HTMLHeadingElement;\n    new(): HTMLHeadingElement;\n}\n\ninterface HTMLHtmlElement extends HTMLElement {\n    /**\n      * Sets or retrieves the DTD version that governs the current document.\n      */\n    version: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLHtmlElement: {\n    prototype: HTMLHtmlElement;\n    new(): HTMLHtmlElement;\n}\n\ninterface HTMLIFrameElementEventMap extends HTMLElementEventMap {\n    \"load\": Event;\n}\n\ninterface HTMLIFrameElement extends HTMLElement, GetSVGDocument {\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text.\n      */\n    align: string;\n    allowFullscreen: boolean;\n    /**\n      * Specifies the properties of a border drawn around an object.\n      */\n    border: string;\n    /**\n      * Retrieves the document object of the page or frame.\n      */\n    readonly contentDocument: Document;\n    /**\n      * Retrieves the object of the specified.\n      */\n    readonly contentWindow: Window;\n    /**\n      * Sets or retrieves whether to display a border for the frame.\n      */\n    frameBorder: string;\n    /**\n      * Sets or retrieves the amount of additional space between the frames.\n      */\n    frameSpacing: any;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: string;\n    /**\n      * Sets or retrieves the horizontal margin for the object.\n      */\n    hspace: number;\n    /**\n      * Sets or retrieves a URI to a long description of the object.\n      */\n    longDesc: string;\n    /**\n      * Sets or retrieves the top and bottom margin heights before displaying the text in a frame.\n      */\n    marginHeight: string;\n    /**\n      * Sets or retrieves the left and right margin widths before displaying the text in a frame.\n      */\n    marginWidth: string;\n    /**\n      * Sets or retrieves the frame name.\n      */\n    name: string;\n    /**\n      * Sets or retrieves whether the user can resize the frame.\n      */\n    noResize: boolean;\n    /**\n      * Raised when the object has been completely received from the server.\n      */\n    onload: (this: HTMLIFrameElement, ev: Event) => any;\n    readonly sandbox: DOMSettableTokenList;\n    /**\n      * Sets or retrieves whether the frame can be scrolled.\n      */\n    scrolling: string;\n    /**\n      * Sets or retrieves a URL to be loaded by the object.\n      */\n    src: string;\n    /**\n      * Sets or retrieves the vertical margin for the object.\n      */\n    vspace: number;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: string;\n    addEventListener<K extends keyof HTMLIFrameElementEventMap>(type: K, listener: (this: HTMLIFrameElement, ev: HTMLIFrameElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLIFrameElement: {\n    prototype: HTMLIFrameElement;\n    new(): HTMLIFrameElement;\n}\n\ninterface HTMLImageElement extends HTMLElement {\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text.\n      */\n    align: string;\n    /**\n      * Sets or retrieves a text alternative to the graphic.\n      */\n    alt: string;\n    /**\n      * Specifies the properties of a border drawn around an object.\n      */\n    border: string;\n    /**\n      * Retrieves whether the object is fully loaded.\n      */\n    readonly complete: boolean;\n    crossOrigin: string;\n    readonly currentSrc: string;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: number;\n    /**\n      * Sets or retrieves the width of the border to draw around the object.\n      */\n    hspace: number;\n    /**\n      * Sets or retrieves whether the image is a server-side image map.\n      */\n    isMap: boolean;\n    /**\n      * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object.\n      */\n    longDesc: string;\n    lowsrc: string;\n    /**\n      * Gets or sets whether the DLNA PlayTo device is available.\n      */\n    msPlayToDisabled: boolean;\n    msPlayToPreferredSourceUri: string;\n    /**\n      * Gets or sets the primary DLNA PlayTo device.\n      */\n    msPlayToPrimary: boolean;\n    /**\n      * Gets the source associated with the media element for use by the PlayToManager.\n      */\n    readonly msPlayToSource: any;\n    /**\n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    /**\n      * The original height of the image resource before sizing.\n      */\n    readonly naturalHeight: number;\n    /**\n      * The original width of the image resource before sizing.\n      */\n    readonly naturalWidth: number;\n    sizes: string;\n    /**\n      * The address or URL of the a media resource that is to be considered.\n      */\n    src: string;\n    srcset: string;\n    /**\n      * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\n      */\n    useMap: string;\n    /**\n      * Sets or retrieves the vertical margin for the object.\n      */\n    vspace: number;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: number;\n    readonly x: number;\n    readonly y: number;\n    msGetAsCastingSource(): any;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLImageElement: {\n    prototype: HTMLImageElement;\n    new(): HTMLImageElement;\n    create(): HTMLImageElement;\n}\n\ninterface HTMLInputElement extends HTMLElement {\n    /**\n      * Sets or retrieves a comma-separated list of content types.\n      */\n    accept: string;\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text.\n      */\n    align: string;\n    /**\n      * Sets or retrieves a text alternative to the graphic.\n      */\n    alt: string;\n    /**\n      * Specifies whether autocomplete is applied to an editable text field.\n      */\n    autocomplete: string;\n    /**\n      * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\n      */\n    autofocus: boolean;\n    /**\n      * Sets or retrieves the width of the border to draw around the object.\n      */\n    border: string;\n    /**\n      * Sets or retrieves the state of the check box or radio button.\n      */\n    checked: boolean;\n    /**\n      * Retrieves whether the object is fully loaded.\n      */\n    readonly complete: boolean;\n    /**\n      * Sets or retrieves the state of the check box or radio button.\n      */\n    defaultChecked: boolean;\n    /**\n      * Sets or retrieves the initial contents of the object.\n      */\n    defaultValue: string;\n    disabled: boolean;\n    /**\n      * Returns a FileList object on a file type input object.\n      */\n    readonly files: FileList | null;\n    /**\n      * Retrieves a reference to the form that the object is embedded in. \n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Overrides the action attribute (where the data on a form is sent) on the parent form element.\n      */\n    formAction: string;\n    /**\n      * Used to override the encoding (formEnctype attribute) specified on the form element.\n      */\n    formEnctype: string;\n    /**\n      * Overrides the submit method attribute previously specified on a form element.\n      */\n    formMethod: string;\n    /**\n      * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a \"save draft\"-type submit option.\n      */\n    formNoValidate: string;\n    /**\n      * Overrides the target attribute on a form element.\n      */\n    formTarget: string;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: string;\n    /**\n      * Sets or retrieves the width of the border to draw around the object.\n      */\n    hspace: number;\n    indeterminate: boolean;\n    /**\n      * Specifies the ID of a pre-defined datalist of options for an input element.\n      */\n    readonly list: HTMLElement;\n    /**\n      * Defines the maximum acceptable value for an input element with type=\"number\".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field.\n      */\n    max: string;\n    /**\n      * Sets or retrieves the maximum number of characters that the user can enter in a text control.\n      */\n    maxLength: number;\n    /**\n      * Defines the minimum acceptable value for an input element with type=\"number\". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field.\n      */\n    min: string;\n    /**\n      * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list.\n      */\n    multiple: boolean;\n    /**\n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    /**\n      * Gets or sets a string containing a regular expression that the user's input must match.\n      */\n    pattern: string;\n    /**\n      * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field.\n      */\n    placeholder: string;\n    readOnly: boolean;\n    /**\n      * When present, marks an element that can't be submitted without a value.\n      */\n    required: boolean;\n    selectionDirection: string;\n    /**\n      * Gets or sets the end position or offset of a text selection.\n      */\n    selectionEnd: number;\n    /**\n      * Gets or sets the starting position or offset of a text selection.\n      */\n    selectionStart: number;\n    size: number;\n    /**\n      * The address or URL of the a media resource that is to be considered.\n      */\n    src: string;\n    status: boolean;\n    /**\n      * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field.\n      */\n    step: string;\n    /**\n      * Returns the content type of the object.\n      */\n    type: string;\n    /**\n      * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\n      */\n    useMap: string;\n    /**\n      * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n      */\n    readonly validationMessage: string;\n    /**\n      * Returns a  ValidityState object that represents the validity states of an element.\n      */\n    readonly validity: ValidityState;\n    /**\n      * Returns the value of the data at the cursor's current position.\n      */\n    value: string;\n    valueAsDate: Date;\n    /**\n      * Returns the input field value as a number.\n      */\n    valueAsNumber: number;\n    /**\n      * Sets or retrieves the vertical margin for the object.\n      */\n    vspace: number;\n    webkitdirectory: boolean;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: string;\n    /**\n      * Returns whether an element will successfully validate based on forms validation rules and constraints.\n      */\n    readonly willValidate: boolean;\n    minLength: number;\n    /**\n      * Returns whether a form will validate when it is submitted, without having to submit it.\n      */\n    checkValidity(): boolean;\n    /**\n      * Makes the selection equal to the current object.\n      */\n    select(): void;\n    /**\n      * Sets a custom error message that is displayed when a form is submitted.\n      * @param error Sets a custom error message that is displayed when a form is submitted.\n      */\n    setCustomValidity(error: string): void;\n    /**\n      * Sets the start and end positions of a selection in a text field.\n      * @param start The offset into the text field for the start of the selection.\n      * @param end The offset into the text field for the end of the selection.\n      */\n    setSelectionRange(start?: number, end?: number, direction?: string): void;\n    /**\n      * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value.\n      * @param n Value to decrement the value by.\n      */\n    stepDown(n?: number): void;\n    /**\n      * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value.\n      * @param n Value to increment the value by.\n      */\n    stepUp(n?: number): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLInputElement: {\n    prototype: HTMLInputElement;\n    new(): HTMLInputElement;\n}\n\ninterface HTMLLIElement extends HTMLElement {\n    type: string;\n    /**\n      * Sets or retrieves the value of a list item.\n      */\n    value: number;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLLIElement: {\n    prototype: HTMLLIElement;\n    new(): HTMLLIElement;\n}\n\ninterface HTMLLabelElement extends HTMLElement {\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Sets or retrieves the object to which the given label object is assigned.\n      */\n    htmlFor: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLLabelElement: {\n    prototype: HTMLLabelElement;\n    new(): HTMLLabelElement;\n}\n\ninterface HTMLLegendElement extends HTMLElement {\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    align: string;\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLLegendElement: {\n    prototype: HTMLLegendElement;\n    new(): HTMLLegendElement;\n}\n\ninterface HTMLLinkElement extends HTMLElement, LinkStyle {\n    /**\n      * Sets or retrieves the character set used to encode the object.\n      */\n    charset: string;\n    disabled: boolean;\n    /**\n      * Sets or retrieves a destination URL or an anchor point.\n      */\n    href: string;\n    /**\n      * Sets or retrieves the language code of the object.\n      */\n    hreflang: string;\n    /**\n      * Sets or retrieves the media type.\n      */\n    media: string;\n    /**\n      * Sets or retrieves the relationship between the object and the destination of the link.\n      */\n    rel: string;\n    /**\n      * Sets or retrieves the relationship between the object and the destination of the link.\n      */\n    rev: string;\n    /**\n      * Sets or retrieves the window or frame at which to target content.\n      */\n    target: string;\n    /**\n      * Sets or retrieves the MIME type of the object.\n      */\n    type: string;\n    import?: Document;\n    integrity: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLLinkElement: {\n    prototype: HTMLLinkElement;\n    new(): HTMLLinkElement;\n}\n\ninterface HTMLMapElement extends HTMLElement {\n    /**\n      * Retrieves a collection of the area objects defined for the given map object.\n      */\n    readonly areas: HTMLAreasCollection;\n    /**\n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMapElement: {\n    prototype: HTMLMapElement;\n    new(): HTMLMapElement;\n}\n\ninterface HTMLMarqueeElementEventMap extends HTMLElementEventMap {\n    \"bounce\": Event;\n    \"finish\": Event;\n    \"start\": Event;\n}\n\ninterface HTMLMarqueeElement extends HTMLElement {\n    behavior: string;\n    bgColor: any;\n    direction: string;\n    height: string;\n    hspace: number;\n    loop: number;\n    onbounce: (this: HTMLMarqueeElement, ev: Event) => any;\n    onfinish: (this: HTMLMarqueeElement, ev: Event) => any;\n    onstart: (this: HTMLMarqueeElement, ev: Event) => any;\n    scrollAmount: number;\n    scrollDelay: number;\n    trueSpeed: boolean;\n    vspace: number;\n    width: string;\n    start(): void;\n    stop(): void;\n    addEventListener<K extends keyof HTMLMarqueeElementEventMap>(type: K, listener: (this: HTMLMarqueeElement, ev: HTMLMarqueeElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMarqueeElement: {\n    prototype: HTMLMarqueeElement;\n    new(): HTMLMarqueeElement;\n}\n\ninterface HTMLMediaElementEventMap extends HTMLElementEventMap {\n    \"encrypted\": MediaEncryptedEvent;\n    \"msneedkey\": MSMediaKeyNeededEvent;\n}\n\ninterface HTMLMediaElement extends HTMLElement {\n    /**\n      * Returns an AudioTrackList object with the audio tracks for a given video element.\n      */\n    readonly audioTracks: AudioTrackList;\n    /**\n      * Gets or sets a value that indicates whether to start playing the media automatically.\n      */\n    autoplay: boolean;\n    /**\n      * Gets a collection of buffered time ranges.\n      */\n    readonly buffered: TimeRanges;\n    /**\n      * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player).\n      */\n    controls: boolean;\n    crossOrigin: string;\n    /**\n      * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement.\n      */\n    readonly currentSrc: string;\n    /**\n      * Gets or sets the current playback position, in seconds.\n      */\n    currentTime: number;\n    defaultMuted: boolean;\n    /**\n      * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource.\n      */\n    defaultPlaybackRate: number;\n    /**\n      * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming.\n      */\n    readonly duration: number;\n    /**\n      * Gets information about whether the playback has ended or not.\n      */\n    readonly ended: boolean;\n    /**\n      * Returns an object representing the current error state of the audio or video element.\n      */\n    readonly error: MediaError;\n    /**\n      * Gets or sets a flag to specify whether playback should restart after it completes.\n      */\n    loop: boolean;\n    readonly mediaKeys: MediaKeys | null;\n    /**\n      * Specifies the purpose of the audio or video media, such as background audio or alerts.\n      */\n    msAudioCategory: string;\n    /**\n      * Specifies the output device id that the audio will be sent to.\n      */\n    msAudioDeviceType: string;\n    readonly msGraphicsTrustStatus: MSGraphicsTrust;\n    /**\n      * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element.\n      */\n    readonly msKeys: MSMediaKeys;\n    /**\n      * Gets or sets whether the DLNA PlayTo device is available.\n      */\n    msPlayToDisabled: boolean;\n    /**\n      * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\n      */\n    msPlayToPreferredSourceUri: string;\n    /**\n      * Gets or sets the primary DLNA PlayTo device.\n      */\n    msPlayToPrimary: boolean;\n    /**\n      * Gets the source associated with the media element for use by the PlayToManager.\n      */\n    readonly msPlayToSource: any;\n    /**\n      * Specifies whether or not to enable low-latency playback on the media element.\n      */\n    msRealTime: boolean;\n    /**\n      * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted.\n      */\n    muted: boolean;\n    /**\n      * Gets the current network activity for the element.\n      */\n    readonly networkState: number;\n    onencrypted: (this: HTMLMediaElement, ev: MediaEncryptedEvent) => any;\n    onmsneedkey: (this: HTMLMediaElement, ev: MSMediaKeyNeededEvent) => any;\n    /**\n      * Gets a flag that specifies whether playback is paused.\n      */\n    readonly paused: boolean;\n    /**\n      * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource.\n      */\n    playbackRate: number;\n    /**\n      * Gets TimeRanges for the current media resource that has been played.\n      */\n    readonly played: TimeRanges;\n    /**\n      * Gets or sets the current playback position, in seconds.\n      */\n    preload: string;\n    readyState: number;\n    /**\n      * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked.\n      */\n    readonly seekable: TimeRanges;\n    /**\n      * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource.\n      */\n    readonly seeking: boolean;\n    /**\n      * The address or URL of the a media resource that is to be considered.\n      */\n    src: string;\n    srcObject: MediaStream | null;\n    readonly textTracks: TextTrackList;\n    readonly videoTracks: VideoTrackList;\n    /**\n      * Gets or sets the volume level for audio portions of the media element.\n      */\n    volume: number;\n    addTextTrack(kind: string, label?: string, language?: string): TextTrack;\n    /**\n      * Returns a string that specifies whether the client can play a given media resource type.\n      */\n    canPlayType(type: string): string;\n    /**\n      * Resets the audio or video object and loads a new media resource.\n      */\n    load(): void;\n    /**\n      * Clears all effects from the media pipeline.\n      */\n    msClearEffects(): void;\n    msGetAsCastingSource(): any;\n    /**\n      * Inserts the specified audio effect into media pipeline.\n      */\n    msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void;\n    msSetMediaKeys(mediaKeys: MSMediaKeys): void;\n    /**\n      * Specifies the media protection manager for a given media pipeline.\n      */\n    msSetMediaProtectionManager(mediaProtectionManager?: any): void;\n    /**\n      * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not.\n      */\n    pause(): void;\n    /**\n      * Loads and starts playback of a media resource.\n      */\n    play(): void;\n    setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike<void>;\n    readonly HAVE_CURRENT_DATA: number;\n    readonly HAVE_ENOUGH_DATA: number;\n    readonly HAVE_FUTURE_DATA: number;\n    readonly HAVE_METADATA: number;\n    readonly HAVE_NOTHING: number;\n    readonly NETWORK_EMPTY: number;\n    readonly NETWORK_IDLE: number;\n    readonly NETWORK_LOADING: number;\n    readonly NETWORK_NO_SOURCE: number;\n    addEventListener<K extends keyof HTMLMediaElementEventMap>(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMediaElement: {\n    prototype: HTMLMediaElement;\n    new(): HTMLMediaElement;\n    readonly HAVE_CURRENT_DATA: number;\n    readonly HAVE_ENOUGH_DATA: number;\n    readonly HAVE_FUTURE_DATA: number;\n    readonly HAVE_METADATA: number;\n    readonly HAVE_NOTHING: number;\n    readonly NETWORK_EMPTY: number;\n    readonly NETWORK_IDLE: number;\n    readonly NETWORK_LOADING: number;\n    readonly NETWORK_NO_SOURCE: number;\n}\n\ninterface HTMLMenuElement extends HTMLElement {\n    compact: boolean;\n    type: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMenuElement: {\n    prototype: HTMLMenuElement;\n    new(): HTMLMenuElement;\n}\n\ninterface HTMLMetaElement extends HTMLElement {\n    /**\n      * Sets or retrieves the character set used to encode the object.\n      */\n    charset: string;\n    /**\n      * Gets or sets meta-information to associate with httpEquiv or name.\n      */\n    content: string;\n    /**\n      * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header.\n      */\n    httpEquiv: string;\n    /**\n      * Sets or retrieves the value specified in the content attribute of the meta object.\n      */\n    name: string;\n    /**\n      * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object.\n      */\n    scheme: string;\n    /**\n      * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. \n      */\n    url: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMetaElement: {\n    prototype: HTMLMetaElement;\n    new(): HTMLMetaElement;\n}\n\ninterface HTMLMeterElement extends HTMLElement {\n    high: number;\n    low: number;\n    max: number;\n    min: number;\n    optimum: number;\n    value: number;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMeterElement: {\n    prototype: HTMLMeterElement;\n    new(): HTMLMeterElement;\n}\n\ninterface HTMLModElement extends HTMLElement {\n    /**\n      * Sets or retrieves reference information about the object.\n      */\n    cite: string;\n    /**\n      * Sets or retrieves the date and time of a modification to the object.\n      */\n    dateTime: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLModElement: {\n    prototype: HTMLModElement;\n    new(): HTMLModElement;\n}\n\ninterface HTMLOListElement extends HTMLElement {\n    compact: boolean;\n    /**\n      * The starting number.\n      */\n    start: number;\n    type: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLOListElement: {\n    prototype: HTMLOListElement;\n    new(): HTMLOListElement;\n}\n\ninterface HTMLObjectElement extends HTMLElement, GetSVGDocument {\n    /**\n      * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element.\n      */\n    readonly BaseHref: string;\n    align: string;\n    /**\n      * Sets or retrieves a text alternative to the graphic.\n      */\n    alt: string;\n    /**\n      * Gets or sets the optional alternative HTML script to execute if the object fails to load.\n      */\n    altHtml: string;\n    /**\n      * Sets or retrieves a character string that can be used to implement your own archive functionality for the object.\n      */\n    archive: string;\n    border: string;\n    /**\n      * Sets or retrieves the URL of the file containing the compiled Java class.\n      */\n    code: string;\n    /**\n      * Sets or retrieves the URL of the component.\n      */\n    codeBase: string;\n    /**\n      * Sets or retrieves the Internet media type for the code associated with the object.\n      */\n    codeType: string;\n    /**\n      * Retrieves the document object of the page or frame.\n      */\n    readonly contentDocument: Document;\n    /**\n      * Sets or retrieves the URL that references the data of the object.\n      */\n    data: string;\n    declare: boolean;\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: string;\n    hspace: number;\n    /**\n      * Gets or sets whether the DLNA PlayTo device is available.\n      */\n    msPlayToDisabled: boolean;\n    /**\n      * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\n      */\n    msPlayToPreferredSourceUri: string;\n    /**\n      * Gets or sets the primary DLNA PlayTo device.\n      */\n    msPlayToPrimary: boolean;\n    /**\n      * Gets the source associated with the media element for use by the PlayToManager.\n      */\n    readonly msPlayToSource: any;\n    /**\n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    /**\n      * Retrieves the contained object.\n      */\n    readonly object: any;\n    readonly readyState: number;\n    /**\n      * Sets or retrieves a message to be displayed while an object is loading.\n      */\n    standby: string;\n    /**\n      * Sets or retrieves the MIME type of the object.\n      */\n    type: string;\n    /**\n      * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\n      */\n    useMap: string;\n    /**\n      * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n      */\n    readonly validationMessage: string;\n    /**\n      * Returns a  ValidityState object that represents the validity states of an element.\n      */\n    readonly validity: ValidityState;\n    vspace: number;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: string;\n    /**\n      * Returns whether an element will successfully validate based on forms validation rules and constraints.\n      */\n    readonly willValidate: boolean;\n    /**\n      * Returns whether a form will validate when it is submitted, without having to submit it.\n      */\n    checkValidity(): boolean;\n    /**\n      * Sets a custom error message that is displayed when a form is submitted.\n      * @param error Sets a custom error message that is displayed when a form is submitted.\n      */\n    setCustomValidity(error: string): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLObjectElement: {\n    prototype: HTMLObjectElement;\n    new(): HTMLObjectElement;\n}\n\ninterface HTMLOptGroupElement extends HTMLElement {\n    /**\n      * Sets or retrieves the status of an option.\n      */\n    defaultSelected: boolean;\n    disabled: boolean;\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Sets or retrieves the ordinal position of an option in a list box.\n      */\n    readonly index: number;\n    /**\n      * Sets or retrieves a value that you can use to implement your own label functionality for the object.\n      */\n    label: string;\n    /**\n      * Sets or retrieves whether the option in the list box is the default item.\n      */\n    selected: boolean;\n    /**\n      * Sets or retrieves the text string specified by the option tag.\n      */\n    readonly text: string;\n    /**\n      * Sets or retrieves the value which is returned to the server when the form control is submitted.\n      */\n    value: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLOptGroupElement: {\n    prototype: HTMLOptGroupElement;\n    new(): HTMLOptGroupElement;\n}\n\ninterface HTMLOptionElement extends HTMLElement {\n    /**\n      * Sets or retrieves the status of an option.\n      */\n    defaultSelected: boolean;\n    disabled: boolean;\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Sets or retrieves the ordinal position of an option in a list box.\n      */\n    readonly index: number;\n    /**\n      * Sets or retrieves a value that you can use to implement your own label functionality for the object.\n      */\n    label: string;\n    /**\n      * Sets or retrieves whether the option in the list box is the default item.\n      */\n    selected: boolean;\n    /**\n      * Sets or retrieves the text string specified by the option tag.\n      */\n    text: string;\n    /**\n      * Sets or retrieves the value which is returned to the server when the form control is submitted.\n      */\n    value: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLOptionElement: {\n    prototype: HTMLOptionElement;\n    new(): HTMLOptionElement;\n    create(): HTMLOptionElement;\n}\n\ninterface HTMLOptionsCollection extends HTMLCollectionOf<HTMLOptionElement> {\n    length: number;\n    selectedIndex: number;\n    add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void;\n    remove(index: number): void;\n}\n\ndeclare var HTMLOptionsCollection: {\n    prototype: HTMLOptionsCollection;\n    new(): HTMLOptionsCollection;\n}\n\ninterface HTMLParagraphElement extends HTMLElement {\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text. \n      */\n    align: string;\n    clear: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLParagraphElement: {\n    prototype: HTMLParagraphElement;\n    new(): HTMLParagraphElement;\n}\n\ninterface HTMLParamElement extends HTMLElement {\n    /**\n      * Sets or retrieves the name of an input parameter for an element.\n      */\n    name: string;\n    /**\n      * Sets or retrieves the content type of the resource designated by the value attribute.\n      */\n    type: string;\n    /**\n      * Sets or retrieves the value of an input parameter for an element.\n      */\n    value: string;\n    /**\n      * Sets or retrieves the data type of the value attribute.\n      */\n    valueType: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLParamElement: {\n    prototype: HTMLParamElement;\n    new(): HTMLParamElement;\n}\n\ninterface HTMLPictureElement extends HTMLElement {\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLPictureElement: {\n    prototype: HTMLPictureElement;\n    new(): HTMLPictureElement;\n}\n\ninterface HTMLPreElement extends HTMLElement {\n    /**\n      * Sets or gets a value that you can use to implement your own width functionality for the object.\n      */\n    width: number;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLPreElement: {\n    prototype: HTMLPreElement;\n    new(): HTMLPreElement;\n}\n\ninterface HTMLProgressElement extends HTMLElement {\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Defines the maximum, or \"done\" value for a progress element.\n      */\n    max: number;\n    /**\n      * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar).\n      */\n    readonly position: number;\n    /**\n      * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value.\n      */\n    value: number;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLProgressElement: {\n    prototype: HTMLProgressElement;\n    new(): HTMLProgressElement;\n}\n\ninterface HTMLQuoteElement extends HTMLElement {\n    /**\n      * Sets or retrieves reference information about the object.\n      */\n    cite: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLQuoteElement: {\n    prototype: HTMLQuoteElement;\n    new(): HTMLQuoteElement;\n}\n\ninterface HTMLScriptElement extends HTMLElement {\n    async: boolean;\n    /**\n      * Sets or retrieves the character set used to encode the object.\n      */\n    charset: string;\n    /**\n      * Sets or retrieves the status of the script.\n      */\n    defer: boolean;\n    /**\n      * Sets or retrieves the event for which the script is written. \n      */\n    event: string;\n    /** \n      * Sets or retrieves the object that is bound to the event script.\n      */\n    htmlFor: string;\n    /**\n      * Retrieves the URL to an external file that contains the source code or data.\n      */\n    src: string;\n    /**\n      * Retrieves or sets the text of the object as a string. \n      */\n    text: string;\n    /**\n      * Sets or retrieves the MIME type for the associated scripting engine.\n      */\n    type: string;\n    integrity: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLScriptElement: {\n    prototype: HTMLScriptElement;\n    new(): HTMLScriptElement;\n}\n\ninterface HTMLSelectElement extends HTMLElement {\n    /**\n      * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\n      */\n    autofocus: boolean;\n    disabled: boolean;\n    /**\n      * Retrieves a reference to the form that the object is embedded in. \n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Sets or retrieves the number of objects in a collection.\n      */\n    length: number;\n    /**\n      * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list.\n      */\n    multiple: boolean;\n    /**\n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    readonly options: HTMLOptionsCollection;\n    /**\n      * When present, marks an element that can't be submitted without a value.\n      */\n    required: boolean;\n    /**\n      * Sets or retrieves the index of the selected option in a select object.\n      */\n    selectedIndex: number;\n    selectedOptions: HTMLCollectionOf<HTMLOptionElement>;\n    /**\n      * Sets or retrieves the number of rows in the list box. \n      */\n    size: number;\n    /**\n      * Retrieves the type of select control based on the value of the MULTIPLE attribute.\n      */\n    readonly type: string;\n    /**\n      * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n      */\n    readonly validationMessage: string;\n    /**\n      * Returns a  ValidityState object that represents the validity states of an element.\n      */\n    readonly validity: ValidityState;\n    /**\n      * Sets or retrieves the value which is returned to the server when the form control is submitted.\n      */\n    value: string;\n    /**\n      * Returns whether an element will successfully validate based on forms validation rules and constraints.\n      */\n    readonly willValidate: boolean;\n    /**\n      * Adds an element to the areas, controlRange, or options collection.\n      * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection.\n      * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. \n      */\n    add(element: HTMLElement, before?: HTMLElement | number): void;\n    /**\n      * Returns whether a form will validate when it is submitted, without having to submit it.\n      */\n    checkValidity(): boolean;\n    /**\n      * Retrieves a select object or an object from an options collection.\n      * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made.\n      * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned.\n      */\n    item(name?: any, index?: any): any;\n    /**\n      * Retrieves a select object or an object from an options collection.\n      * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made.\n      */\n    namedItem(name: string): any;\n    /**\n      * Removes an element from the collection.\n      * @param index Number that specifies the zero-based index of the element to remove from the collection.\n      */\n    remove(index?: number): void;\n    /**\n      * Sets a custom error message that is displayed when a form is submitted.\n      * @param error Sets a custom error message that is displayed when a form is submitted.\n      */\n    setCustomValidity(error: string): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n    [name: string]: any;\n}\n\ndeclare var HTMLSelectElement: {\n    prototype: HTMLSelectElement;\n    new(): HTMLSelectElement;\n}\n\ninterface HTMLSourceElement extends HTMLElement {\n    /**\n      * Gets or sets the intended media type of the media source.\n     */\n    media: string;\n    msKeySystem: string;\n    sizes: string;\n    /**\n      * The address or URL of the a media resource that is to be considered.\n      */\n    src: string;\n    srcset: string;\n    /**\n     * Gets or sets the MIME type of a media resource.\n     */\n    type: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLSourceElement: {\n    prototype: HTMLSourceElement;\n    new(): HTMLSourceElement;\n}\n\ninterface HTMLSpanElement extends HTMLElement {\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLSpanElement: {\n    prototype: HTMLSpanElement;\n    new(): HTMLSpanElement;\n}\n\ninterface HTMLStyleElement extends HTMLElement, LinkStyle {\n    disabled: boolean;\n    /**\n      * Sets or retrieves the media type.\n      */\n    media: string;\n    /**\n      * Retrieves the CSS language in which the style sheet is written.\n      */\n    type: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLStyleElement: {\n    prototype: HTMLStyleElement;\n    new(): HTMLStyleElement;\n}\n\ninterface HTMLTableCaptionElement extends HTMLElement {\n    /**\n      * Sets or retrieves the alignment of the caption or legend.\n      */\n    align: string;\n    /**\n      * Sets or retrieves whether the caption appears at the top or bottom of the table.\n      */\n    vAlign: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableCaptionElement: {\n    prototype: HTMLTableCaptionElement;\n    new(): HTMLTableCaptionElement;\n}\n\ninterface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment {\n    /**\n      * Sets or retrieves abbreviated text for the object.\n      */\n    abbr: string;\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text.\n      */\n    align: string;\n    /**\n      * Sets or retrieves a comma-delimited list of conceptual categories associated with the object.\n      */\n    axis: string;\n    bgColor: any;\n    /**\n      * Retrieves the position of the object in the cells collection of a row.\n      */\n    readonly cellIndex: number;\n    /**\n      * Sets or retrieves the number columns in the table that the object should span.\n      */\n    colSpan: number;\n    /**\n      * Sets or retrieves a list of header cells that provide information for the object.\n      */\n    headers: string;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: any;\n    /**\n      * Sets or retrieves whether the browser automatically performs wordwrap.\n      */\n    noWrap: boolean;\n    /**\n      * Sets or retrieves how many rows in a table the cell should span.\n      */\n    rowSpan: number;\n    /**\n      * Sets or retrieves the group of cells in a table to which the object's information applies.\n      */\n    scope: string;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableCellElement: {\n    prototype: HTMLTableCellElement;\n    new(): HTMLTableCellElement;\n}\n\ninterface HTMLTableColElement extends HTMLElement, HTMLTableAlignment {\n    /**\n      * Sets or retrieves the alignment of the object relative to the display or table.\n      */\n    align: string;\n    /**\n      * Sets or retrieves the number of columns in the group.\n      */\n    span: number;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: any;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableColElement: {\n    prototype: HTMLTableColElement;\n    new(): HTMLTableColElement;\n}\n\ninterface HTMLTableDataCellElement extends HTMLTableCellElement {\n}\n\ndeclare var HTMLTableDataCellElement: {\n    prototype: HTMLTableDataCellElement;\n    new(): HTMLTableDataCellElement;\n}\n\ninterface HTMLTableElement extends HTMLElement {\n    /**\n      * Sets or retrieves a value that indicates the table alignment.\n      */\n    align: string;\n    bgColor: any;\n    /**\n      * Sets or retrieves the width of the border to draw around the object.\n      */\n    border: string;\n    /**\n      * Sets or retrieves the border color of the object. \n      */\n    borderColor: any;\n    /**\n      * Retrieves the caption object of a table.\n      */\n    caption: HTMLTableCaptionElement;\n    /**\n      * Sets or retrieves the amount of space between the border of the cell and the content of the cell.\n      */\n    cellPadding: string;\n    /**\n      * Sets or retrieves the amount of space between cells in a table.\n      */\n    cellSpacing: string;\n    /**\n      * Sets or retrieves the number of columns in the table.\n      */\n    cols: number;\n    /**\n      * Sets or retrieves the way the border frame around the table is displayed.\n      */\n    frame: string;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: any;\n    /**\n      * Sets or retrieves the number of horizontal rows contained in the object.\n      */\n    rows: HTMLCollectionOf<HTMLTableRowElement>;\n    /**\n      * Sets or retrieves which dividing lines (inner borders) are displayed.\n      */\n    rules: string;\n    /**\n      * Sets or retrieves a description and/or structure of the object.\n      */\n    summary: string;\n    /**\n      * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order.\n      */\n    tBodies: HTMLCollectionOf<HTMLTableSectionElement>;\n    /**\n      * Retrieves the tFoot object of the table.\n      */\n    tFoot: HTMLTableSectionElement;\n    /**\n      * Retrieves the tHead object of the table.\n      */\n    tHead: HTMLTableSectionElement;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    width: string;\n    /**\n      * Creates an empty caption element in the table.\n      */\n    createCaption(): HTMLTableCaptionElement;\n    /**\n      * Creates an empty tBody element in the table.\n      */\n    createTBody(): HTMLTableSectionElement;\n    /**\n      * Creates an empty tFoot element in the table.\n      */\n    createTFoot(): HTMLTableSectionElement;\n    /**\n      * Returns the tHead element object if successful, or null otherwise.\n      */\n    createTHead(): HTMLTableSectionElement;\n    /**\n      * Deletes the caption element and its contents from the table.\n      */\n    deleteCaption(): void;\n    /**\n      * Removes the specified row (tr) from the element and from the rows collection.\n      * @param index Number that specifies the zero-based position in the rows collection of the row to remove.\n      */\n    deleteRow(index?: number): void;\n    /**\n      * Deletes the tFoot element and its contents from the table.\n      */\n    deleteTFoot(): void;\n    /**\n      * Deletes the tHead element and its contents from the table.\n      */\n    deleteTHead(): void;\n    /**\n      * Creates a new row (tr) in the table, and adds the row to the rows collection.\n      * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection.\n      */\n    insertRow(index?: number): HTMLTableRowElement;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableElement: {\n    prototype: HTMLTableElement;\n    new(): HTMLTableElement;\n}\n\ninterface HTMLTableHeaderCellElement extends HTMLTableCellElement {\n    /**\n      * Sets or retrieves the group of cells in a table to which the object's information applies.\n      */\n    scope: string;\n}\n\ndeclare var HTMLTableHeaderCellElement: {\n    prototype: HTMLTableHeaderCellElement;\n    new(): HTMLTableHeaderCellElement;\n}\n\ninterface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment {\n    /**\n      * Sets or retrieves how the object is aligned with adjacent text.\n      */\n    align: string;\n    bgColor: any;\n    /**\n      * Retrieves a collection of all cells in the table row.\n      */\n    cells: HTMLCollectionOf<HTMLTableDataCellElement | HTMLTableHeaderCellElement>;\n    /**\n      * Sets or retrieves the height of the object.\n      */\n    height: any;\n    /**\n      * Retrieves the position of the object in the rows collection for the table.\n      */\n    readonly rowIndex: number;\n    /**\n      * Retrieves the position of the object in the collection.\n      */\n    readonly sectionRowIndex: number;\n    /**\n      * Removes the specified cell from the table row, as well as from the cells collection.\n      * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted.\n      */\n    deleteCell(index?: number): void;\n    /**\n      * Creates a new cell in the table row, and adds the cell to the cells collection.\n      * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection.\n      */\n    insertCell(index?: number): HTMLTableDataCellElement;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableRowElement: {\n    prototype: HTMLTableRowElement;\n    new(): HTMLTableRowElement;\n}\n\ninterface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment {\n    /**\n      * Sets or retrieves a value that indicates the table alignment.\n      */\n    align: string;\n    /**\n      * Sets or retrieves the number of horizontal rows contained in the object.\n      */\n    rows: HTMLCollectionOf<HTMLTableRowElement>;\n    /**\n      * Removes the specified row (tr) from the element and from the rows collection.\n      * @param index Number that specifies the zero-based position in the rows collection of the row to remove.\n      */\n    deleteRow(index?: number): void;\n    /**\n      * Creates a new row (tr) in the table, and adds the row to the rows collection.\n      * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection.\n      */\n    insertRow(index?: number): HTMLTableRowElement;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableSectionElement: {\n    prototype: HTMLTableSectionElement;\n    new(): HTMLTableSectionElement;\n}\n\ninterface HTMLTemplateElement extends HTMLElement {\n    readonly content: DocumentFragment;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTemplateElement: {\n    prototype: HTMLTemplateElement;\n    new(): HTMLTemplateElement;\n}\n\ninterface HTMLTextAreaElement extends HTMLElement {\n    /**\n      * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\n      */\n    autofocus: boolean;\n    /**\n      * Sets or retrieves the width of the object.\n      */\n    cols: number;\n    /**\n      * Sets or retrieves the initial contents of the object.\n      */\n    defaultValue: string;\n    disabled: boolean;\n    /**\n      * Retrieves a reference to the form that the object is embedded in.\n      */\n    readonly form: HTMLFormElement;\n    /**\n      * Sets or retrieves the maximum number of characters that the user can enter in a text control.\n      */\n    maxLength: number;\n    /**\n      * Sets or retrieves the name of the object.\n      */\n    name: string;\n    /**\n      * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field.\n      */\n    placeholder: string;\n    /**\n      * Sets or retrieves the value indicated whether the content of the object is read-only.\n      */\n    readOnly: boolean;\n    /**\n      * When present, marks an element that can't be submitted without a value.\n      */\n    required: boolean;\n    /**\n      * Sets or retrieves the number of horizontal rows contained in the object.\n      */\n    rows: number;\n    /**\n      * Gets or sets the end position or offset of a text selection.\n      */\n    selectionEnd: number;\n    /**\n      * Gets or sets the starting position or offset of a text selection.\n      */\n    selectionStart: number;\n    /**\n      * Sets or retrieves the value indicating whether the control is selected.\n      */\n    status: any;\n    /**\n      * Retrieves the type of control.\n      */\n    readonly type: string;\n    /**\n      * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n      */\n    readonly validationMessage: string;\n    /**\n      * Returns a  ValidityState object that represents the validity states of an element.\n      */\n    readonly validity: ValidityState;\n    /**\n      * Retrieves or sets the text in the entry field of the textArea element.\n      */\n    value: string;\n    /**\n      * Returns whether an element will successfully validate based on forms validation rules and constraints.\n      */\n    readonly willValidate: boolean;\n    /**\n      * Sets or retrieves how to handle wordwrapping in the object.\n      */\n    wrap: string;\n    minLength: number;\n    /**\n      * Returns whether a form will validate when it is submitted, without having to submit it.\n      */\n    checkValidity(): boolean;\n    /**\n      * Highlights the input area of a form element.\n      */\n    select(): void;\n    /**\n      * Sets a custom error message that is displayed when a form is submitted.\n      * @param error Sets a custom error message that is displayed when a form is submitted.\n      */\n    setCustomValidity(error: string): void;\n    /**\n      * Sets the start and end positions of a selection in a text field.\n      * @param start The offset into the text field for the start of the selection.\n      * @param end The offset into the text field for the end of the selection.\n      */\n    setSelectionRange(start: number, end: number): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTextAreaElement: {\n    prototype: HTMLTextAreaElement;\n    new(): HTMLTextAreaElement;\n}\n\ninterface HTMLTitleElement extends HTMLElement {\n    /**\n      * Retrieves or sets the text of the object as a string. \n      */\n    text: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTitleElement: {\n    prototype: HTMLTitleElement;\n    new(): HTMLTitleElement;\n}\n\ninterface HTMLTrackElement extends HTMLElement {\n    default: boolean;\n    kind: string;\n    label: string;\n    readonly readyState: number;\n    src: string;\n    srclang: string;\n    readonly track: TextTrack;\n    readonly ERROR: number;\n    readonly LOADED: number;\n    readonly LOADING: number;\n    readonly NONE: number;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTrackElement: {\n    prototype: HTMLTrackElement;\n    new(): HTMLTrackElement;\n    readonly ERROR: number;\n    readonly LOADED: number;\n    readonly LOADING: number;\n    readonly NONE: number;\n}\n\ninterface HTMLUListElement extends HTMLElement {\n    compact: boolean;\n    type: string;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLUListElement: {\n    prototype: HTMLUListElement;\n    new(): HTMLUListElement;\n}\n\ninterface HTMLUnknownElement extends HTMLElement {\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLUnknownElement: {\n    prototype: HTMLUnknownElement;\n    new(): HTMLUnknownElement;\n}\n\ninterface HTMLVideoElementEventMap extends HTMLMediaElementEventMap {\n    \"MSVideoFormatChanged\": Event;\n    \"MSVideoFrameStepCompleted\": Event;\n    \"MSVideoOptimalLayoutChanged\": Event;\n}\n\ninterface HTMLVideoElement extends HTMLMediaElement {\n    /**\n      * Gets or sets the height of the video element.\n      */\n    height: number;\n    msHorizontalMirror: boolean;\n    readonly msIsLayoutOptimalForPlayback: boolean;\n    readonly msIsStereo3D: boolean;\n    msStereo3DPackingMode: string;\n    msStereo3DRenderMode: string;\n    msZoom: boolean;\n    onMSVideoFormatChanged: (this: HTMLVideoElement, ev: Event) => any;\n    onMSVideoFrameStepCompleted: (this: HTMLVideoElement, ev: Event) => any;\n    onMSVideoOptimalLayoutChanged: (this: HTMLVideoElement, ev: Event) => any;\n    /**\n      * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available.\n      */\n    poster: string;\n    /**\n      * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known.\n      */\n    readonly videoHeight: number;\n    /**\n      * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known.\n      */\n    readonly videoWidth: number;\n    readonly webkitDisplayingFullscreen: boolean;\n    readonly webkitSupportsFullscreen: boolean;\n    /**\n      * Gets or sets the width of the video element.\n      */\n    width: number;\n    getVideoPlaybackQuality(): VideoPlaybackQuality;\n    msFrameStep(forward: boolean): void;\n    msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void;\n    msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void;\n    webkitEnterFullScreen(): void;\n    webkitEnterFullscreen(): void;\n    webkitExitFullScreen(): void;\n    webkitExitFullscreen(): void;\n    addEventListener<K extends keyof HTMLVideoElementEventMap>(type: K, listener: (this: HTMLVideoElement, ev: HTMLVideoElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLVideoElement: {\n    prototype: HTMLVideoElement;\n    new(): HTMLVideoElement;\n}\n\ninterface HashChangeEvent extends Event {\n    readonly newURL: string | null;\n    readonly oldURL: string | null;\n}\n\ndeclare var HashChangeEvent: {\n    prototype: HashChangeEvent;\n    new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent;\n}\n\ninterface History {\n    readonly length: number;\n    readonly state: any;\n    scrollRestoration: ScrollRestoration;\n    back(): void;\n    forward(): void;\n    go(delta?: number): void;\n    pushState(data: any, title: string, url?: string | null): void;\n    replaceState(data: any, title: string, url?: string | null): void;\n}\n\ndeclare var History: {\n    prototype: History;\n    new(): History;\n}\n\ninterface IDBCursor {\n    readonly direction: string;\n    key: IDBKeyRange | IDBValidKey;\n    readonly primaryKey: any;\n    source: IDBObjectStore | IDBIndex;\n    advance(count: number): void;\n    continue(key?: IDBKeyRange | IDBValidKey): void;\n    delete(): IDBRequest;\n    update(value: any): IDBRequest;\n    readonly NEXT: string;\n    readonly NEXT_NO_DUPLICATE: string;\n    readonly PREV: string;\n    readonly PREV_NO_DUPLICATE: string;\n}\n\ndeclare var IDBCursor: {\n    prototype: IDBCursor;\n    new(): IDBCursor;\n    readonly NEXT: string;\n    readonly NEXT_NO_DUPLICATE: string;\n    readonly PREV: string;\n    readonly PREV_NO_DUPLICATE: string;\n}\n\ninterface IDBCursorWithValue extends IDBCursor {\n    readonly value: any;\n}\n\ndeclare var IDBCursorWithValue: {\n    prototype: IDBCursorWithValue;\n    new(): IDBCursorWithValue;\n}\n\ninterface IDBDatabaseEventMap {\n    \"abort\": Event;\n    \"error\": ErrorEvent;\n}\n\ninterface IDBDatabase extends EventTarget {\n    readonly name: string;\n    readonly objectStoreNames: DOMStringList;\n    onabort: (this: IDBDatabase, ev: Event) => any;\n    onerror: (this: IDBDatabase, ev: ErrorEvent) => any;\n    version: number;\n    onversionchange: (ev: IDBVersionChangeEvent) => any;\n    close(): void;\n    createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;\n    deleteObjectStore(name: string): void;\n    transaction(storeNames: string | string[], mode?: string): IDBTransaction;\n    addEventListener(type: \"versionchange\", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;\n    addEventListener<K extends keyof IDBDatabaseEventMap>(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var IDBDatabase: {\n    prototype: IDBDatabase;\n    new(): IDBDatabase;\n}\n\ninterface IDBFactory {\n    cmp(first: any, second: any): number;\n    deleteDatabase(name: string): IDBOpenDBRequest;\n    open(name: string, version?: number): IDBOpenDBRequest;\n}\n\ndeclare var IDBFactory: {\n    prototype: IDBFactory;\n    new(): IDBFactory;\n}\n\ninterface IDBIndex {\n    keyPath: string | string[];\n    readonly name: string;\n    readonly objectStore: IDBObjectStore;\n    readonly unique: boolean;\n    multiEntry: boolean;\n    count(key?: IDBKeyRange | IDBValidKey): IDBRequest;\n    get(key: IDBKeyRange | IDBValidKey): IDBRequest;\n    getKey(key: IDBKeyRange | IDBValidKey): IDBRequest;\n    openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\n    openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\n}\n\ndeclare var IDBIndex: {\n    prototype: IDBIndex;\n    new(): IDBIndex;\n}\n\ninterface IDBKeyRange {\n    readonly lower: any;\n    readonly lowerOpen: boolean;\n    readonly upper: any;\n    readonly upperOpen: boolean;\n}\n\ndeclare var IDBKeyRange: {\n    prototype: IDBKeyRange;\n    new(): IDBKeyRange;\n    bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange;\n    lowerBound(lower: any, open?: boolean): IDBKeyRange;\n    only(value: any): IDBKeyRange;\n    upperBound(upper: any, open?: boolean): IDBKeyRange;\n}\n\ninterface IDBObjectStore {\n    readonly indexNames: DOMStringList;\n    keyPath: string | string[];\n    readonly name: string;\n    readonly transaction: IDBTransaction;\n    autoIncrement: boolean;\n    add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest;\n    clear(): IDBRequest;\n    count(key?: IDBKeyRange | IDBValidKey): IDBRequest;\n    createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex;\n    delete(key: IDBKeyRange | IDBValidKey): IDBRequest;\n    deleteIndex(indexName: string): void;\n    get(key: any): IDBRequest;\n    index(name: string): IDBIndex;\n    openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\n    put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest;\n}\n\ndeclare var IDBObjectStore: {\n    prototype: IDBObjectStore;\n    new(): IDBObjectStore;\n}\n\ninterface IDBOpenDBRequestEventMap extends IDBRequestEventMap {\n    \"blocked\": Event;\n    \"upgradeneeded\": IDBVersionChangeEvent;\n}\n\ninterface IDBOpenDBRequest extends IDBRequest {\n    onblocked: (this: IDBOpenDBRequest, ev: Event) => any;\n    onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any;\n    addEventListener<K extends keyof IDBOpenDBRequestEventMap>(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var IDBOpenDBRequest: {\n    prototype: IDBOpenDBRequest;\n    new(): IDBOpenDBRequest;\n}\n\ninterface IDBRequestEventMap {\n    \"error\": ErrorEvent;\n    \"success\": Event;\n}\n\ninterface IDBRequest extends EventTarget {\n    readonly error: DOMError;\n    onerror: (this: IDBRequest, ev: ErrorEvent) => any;\n    onsuccess: (this: IDBRequest, ev: Event) => any;\n    readonly readyState: string;\n    readonly result: any;\n    source: IDBObjectStore | IDBIndex | IDBCursor;\n    readonly transaction: IDBTransaction;\n    addEventListener<K extends keyof IDBRequestEventMap>(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var IDBRequest: {\n    prototype: IDBRequest;\n    new(): IDBRequest;\n}\n\ninterface IDBTransactionEventMap {\n    \"abort\": Event;\n    \"complete\": Event;\n    \"error\": ErrorEvent;\n}\n\ninterface IDBTransaction extends EventTarget {\n    readonly db: IDBDatabase;\n    readonly error: DOMError;\n    readonly mode: string;\n    onabort: (this: IDBTransaction, ev: Event) => any;\n    oncomplete: (this: IDBTransaction, ev: Event) => any;\n    onerror: (this: IDBTransaction, ev: ErrorEvent) => any;\n    abort(): void;\n    objectStore(name: string): IDBObjectStore;\n    readonly READ_ONLY: string;\n    readonly READ_WRITE: string;\n    readonly VERSION_CHANGE: string;\n    addEventListener<K extends keyof IDBTransactionEventMap>(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var IDBTransaction: {\n    prototype: IDBTransaction;\n    new(): IDBTransaction;\n    readonly READ_ONLY: string;\n    readonly READ_WRITE: string;\n    readonly VERSION_CHANGE: string;\n}\n\ninterface IDBVersionChangeEvent extends Event {\n    readonly newVersion: number | null;\n    readonly oldVersion: number;\n}\n\ndeclare var IDBVersionChangeEvent: {\n    prototype: IDBVersionChangeEvent;\n    new(): IDBVersionChangeEvent;\n}\n\ninterface ImageData {\n    data: Uint8ClampedArray;\n    readonly height: number;\n    readonly width: number;\n}\n\ndeclare var ImageData: {\n    prototype: ImageData;\n    new(width: number, height: number): ImageData;\n    new(array: Uint8ClampedArray, width: number, height: number): ImageData;\n}\n\ninterface KeyboardEvent extends UIEvent {\n    readonly altKey: boolean;\n    readonly char: string | null;\n    readonly charCode: number;\n    readonly ctrlKey: boolean;\n    readonly key: string;\n    readonly keyCode: number;\n    readonly locale: string;\n    readonly location: number;\n    readonly metaKey: boolean;\n    readonly repeat: boolean;\n    readonly shiftKey: boolean;\n    readonly which: number;\n    readonly code: string;\n    getModifierState(keyArg: string): boolean;\n    initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void;\n    readonly DOM_KEY_LOCATION_JOYSTICK: number;\n    readonly DOM_KEY_LOCATION_LEFT: number;\n    readonly DOM_KEY_LOCATION_MOBILE: number;\n    readonly DOM_KEY_LOCATION_NUMPAD: number;\n    readonly DOM_KEY_LOCATION_RIGHT: number;\n    readonly DOM_KEY_LOCATION_STANDARD: number;\n}\n\ndeclare var KeyboardEvent: {\n    prototype: KeyboardEvent;\n    new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent;\n    readonly DOM_KEY_LOCATION_JOYSTICK: number;\n    readonly DOM_KEY_LOCATION_LEFT: number;\n    readonly DOM_KEY_LOCATION_MOBILE: number;\n    readonly DOM_KEY_LOCATION_NUMPAD: number;\n    readonly DOM_KEY_LOCATION_RIGHT: number;\n    readonly DOM_KEY_LOCATION_STANDARD: number;\n}\n\ninterface ListeningStateChangedEvent extends Event {\n    readonly label: string;\n    readonly state: string;\n}\n\ndeclare var ListeningStateChangedEvent: {\n    prototype: ListeningStateChangedEvent;\n    new(): ListeningStateChangedEvent;\n}\n\ninterface Location {\n    hash: string;\n    host: string;\n    hostname: string;\n    href: string;\n    readonly origin: string;\n    pathname: string;\n    port: string;\n    protocol: string;\n    search: string;\n    assign(url: string): void;\n    reload(forcedReload?: boolean): void;\n    replace(url: string): void;\n    toString(): string;\n}\n\ndeclare var Location: {\n    prototype: Location;\n    new(): Location;\n}\n\ninterface LongRunningScriptDetectedEvent extends Event {\n    readonly executionTime: number;\n    stopPageScriptExecution: boolean;\n}\n\ndeclare var LongRunningScriptDetectedEvent: {\n    prototype: LongRunningScriptDetectedEvent;\n    new(): LongRunningScriptDetectedEvent;\n}\n\ninterface MSApp {\n    clearTemporaryWebDataAsync(): MSAppAsyncOperation;\n    createBlobFromRandomAccessStream(type: string, seeker: any): Blob;\n    createDataPackage(object: any): any;\n    createDataPackageFromSelection(): any;\n    createFileFromStorageFile(storageFile: any): File;\n    createStreamFromInputStream(type: string, inputStream: any): MSStream;\n    execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void;\n    execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any;\n    getCurrentPriority(): string;\n    getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike<any>;\n    getViewId(view: any): any;\n    isTaskScheduledAtPriorityOrHigher(priority: string): boolean;\n    pageHandlesAllApplicationActivations(enabled: boolean): void;\n    suppressSubdownloadCredentialPrompts(suppress: boolean): void;\n    terminateApp(exceptionObject: any): void;\n    readonly CURRENT: string;\n    readonly HIGH: string;\n    readonly IDLE: string;\n    readonly NORMAL: string;\n}\ndeclare var MSApp: MSApp;\n\ninterface MSAppAsyncOperationEventMap {\n    \"complete\": Event;\n    \"error\": ErrorEvent;\n}\n\ninterface MSAppAsyncOperation extends EventTarget {\n    readonly error: DOMError;\n    oncomplete: (this: MSAppAsyncOperation, ev: Event) => any;\n    onerror: (this: MSAppAsyncOperation, ev: ErrorEvent) => any;\n    readonly readyState: number;\n    readonly result: any;\n    start(): void;\n    readonly COMPLETED: number;\n    readonly ERROR: number;\n    readonly STARTED: number;\n    addEventListener<K extends keyof MSAppAsyncOperationEventMap>(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSAppAsyncOperation: {\n    prototype: MSAppAsyncOperation;\n    new(): MSAppAsyncOperation;\n    readonly COMPLETED: number;\n    readonly ERROR: number;\n    readonly STARTED: number;\n}\n\ninterface MSAssertion {\n    readonly id: string;\n    readonly type: string;\n}\n\ndeclare var MSAssertion: {\n    prototype: MSAssertion;\n    new(): MSAssertion;\n}\n\ninterface MSBlobBuilder {\n    append(data: any, endings?: string): void;\n    getBlob(contentType?: string): Blob;\n}\n\ndeclare var MSBlobBuilder: {\n    prototype: MSBlobBuilder;\n    new(): MSBlobBuilder;\n}\n\ninterface MSCredentials {\n    getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike<MSAssertion>;\n    makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike<MSAssertion>;\n}\n\ndeclare var MSCredentials: {\n    prototype: MSCredentials;\n    new(): MSCredentials;\n}\n\ninterface MSFIDOCredentialAssertion extends MSAssertion {\n    readonly algorithm: string | Algorithm;\n    readonly attestation: any;\n    readonly publicKey: string;\n    readonly transportHints: string[];\n}\n\ndeclare var MSFIDOCredentialAssertion: {\n    prototype: MSFIDOCredentialAssertion;\n    new(): MSFIDOCredentialAssertion;\n}\n\ninterface MSFIDOSignature {\n    readonly authnrData: string;\n    readonly clientData: string;\n    readonly signature: string;\n}\n\ndeclare var MSFIDOSignature: {\n    prototype: MSFIDOSignature;\n    new(): MSFIDOSignature;\n}\n\ninterface MSFIDOSignatureAssertion extends MSAssertion {\n    readonly signature: MSFIDOSignature;\n}\n\ndeclare var MSFIDOSignatureAssertion: {\n    prototype: MSFIDOSignatureAssertion;\n    new(): MSFIDOSignatureAssertion;\n}\n\ninterface MSGesture {\n    target: Element;\n    addPointer(pointerId: number): void;\n    stop(): void;\n}\n\ndeclare var MSGesture: {\n    prototype: MSGesture;\n    new(): MSGesture;\n}\n\ninterface MSGestureEvent extends UIEvent {\n    readonly clientX: number;\n    readonly clientY: number;\n    readonly expansion: number;\n    readonly gestureObject: any;\n    readonly hwTimestamp: number;\n    readonly offsetX: number;\n    readonly offsetY: number;\n    readonly rotation: number;\n    readonly scale: number;\n    readonly screenX: number;\n    readonly screenY: number;\n    readonly translationX: number;\n    readonly translationY: number;\n    readonly velocityAngular: number;\n    readonly velocityExpansion: number;\n    readonly velocityX: number;\n    readonly velocityY: number;\n    initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void;\n    readonly MSGESTURE_FLAG_BEGIN: number;\n    readonly MSGESTURE_FLAG_CANCEL: number;\n    readonly MSGESTURE_FLAG_END: number;\n    readonly MSGESTURE_FLAG_INERTIA: number;\n    readonly MSGESTURE_FLAG_NONE: number;\n}\n\ndeclare var MSGestureEvent: {\n    prototype: MSGestureEvent;\n    new(): MSGestureEvent;\n    readonly MSGESTURE_FLAG_BEGIN: number;\n    readonly MSGESTURE_FLAG_CANCEL: number;\n    readonly MSGESTURE_FLAG_END: number;\n    readonly MSGESTURE_FLAG_INERTIA: number;\n    readonly MSGESTURE_FLAG_NONE: number;\n}\n\ninterface MSGraphicsTrust {\n    readonly constrictionActive: boolean;\n    readonly status: string;\n}\n\ndeclare var MSGraphicsTrust: {\n    prototype: MSGraphicsTrust;\n    new(): MSGraphicsTrust;\n}\n\ninterface MSHTMLWebViewElement extends HTMLElement {\n    readonly canGoBack: boolean;\n    readonly canGoForward: boolean;\n    readonly containsFullScreenElement: boolean;\n    readonly documentTitle: string;\n    height: number;\n    readonly settings: MSWebViewSettings;\n    src: string;\n    width: number;\n    addWebAllowedObject(name: string, applicationObject: any): void;\n    buildLocalStreamUri(contentIdentifier: string, relativePath: string): string;\n    capturePreviewToBlobAsync(): MSWebViewAsyncOperation;\n    captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation;\n    getDeferredPermissionRequestById(id: number): DeferredPermissionRequest;\n    getDeferredPermissionRequests(): DeferredPermissionRequest[];\n    goBack(): void;\n    goForward(): void;\n    invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation;\n    navigate(uri: string): void;\n    navigateToLocalStreamUri(source: string, streamResolver: any): void;\n    navigateToString(contents: string): void;\n    navigateWithHttpRequestMessage(requestMessage: any): void;\n    refresh(): void;\n    stop(): void;\n    addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSHTMLWebViewElement: {\n    prototype: MSHTMLWebViewElement;\n    new(): MSHTMLWebViewElement;\n}\n\ninterface MSInputMethodContextEventMap {\n    \"MSCandidateWindowHide\": Event;\n    \"MSCandidateWindowShow\": Event;\n    \"MSCandidateWindowUpdate\": Event;\n}\n\ninterface MSInputMethodContext extends EventTarget {\n    readonly compositionEndOffset: number;\n    readonly compositionStartOffset: number;\n    oncandidatewindowhide: (this: MSInputMethodContext, ev: Event) => any;\n    oncandidatewindowshow: (this: MSInputMethodContext, ev: Event) => any;\n    oncandidatewindowupdate: (this: MSInputMethodContext, ev: Event) => any;\n    readonly target: HTMLElement;\n    getCandidateWindowClientRect(): ClientRect;\n    getCompositionAlternatives(): string[];\n    hasComposition(): boolean;\n    isCandidateWindowVisible(): boolean;\n    addEventListener<K extends keyof MSInputMethodContextEventMap>(type: K, listener: (this: MSInputMethodContext, ev: MSInputMethodContextEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSInputMethodContext: {\n    prototype: MSInputMethodContext;\n    new(): MSInputMethodContext;\n}\n\ninterface MSManipulationEvent extends UIEvent {\n    readonly currentState: number;\n    readonly inertiaDestinationX: number;\n    readonly inertiaDestinationY: number;\n    readonly lastState: number;\n    initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void;\n    readonly MS_MANIPULATION_STATE_ACTIVE: number;\n    readonly MS_MANIPULATION_STATE_CANCELLED: number;\n    readonly MS_MANIPULATION_STATE_COMMITTED: number;\n    readonly MS_MANIPULATION_STATE_DRAGGING: number;\n    readonly MS_MANIPULATION_STATE_INERTIA: number;\n    readonly MS_MANIPULATION_STATE_PRESELECT: number;\n    readonly MS_MANIPULATION_STATE_SELECTING: number;\n    readonly MS_MANIPULATION_STATE_STOPPED: number;\n}\n\ndeclare var MSManipulationEvent: {\n    prototype: MSManipulationEvent;\n    new(): MSManipulationEvent;\n    readonly MS_MANIPULATION_STATE_ACTIVE: number;\n    readonly MS_MANIPULATION_STATE_CANCELLED: number;\n    readonly MS_MANIPULATION_STATE_COMMITTED: number;\n    readonly MS_MANIPULATION_STATE_DRAGGING: number;\n    readonly MS_MANIPULATION_STATE_INERTIA: number;\n    readonly MS_MANIPULATION_STATE_PRESELECT: number;\n    readonly MS_MANIPULATION_STATE_SELECTING: number;\n    readonly MS_MANIPULATION_STATE_STOPPED: number;\n}\n\ninterface MSMediaKeyError {\n    readonly code: number;\n    readonly systemCode: number;\n    readonly MS_MEDIA_KEYERR_CLIENT: number;\n    readonly MS_MEDIA_KEYERR_DOMAIN: number;\n    readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number;\n    readonly MS_MEDIA_KEYERR_OUTPUT: number;\n    readonly MS_MEDIA_KEYERR_SERVICE: number;\n    readonly MS_MEDIA_KEYERR_UNKNOWN: number;\n}\n\ndeclare var MSMediaKeyError: {\n    prototype: MSMediaKeyError;\n    new(): MSMediaKeyError;\n    readonly MS_MEDIA_KEYERR_CLIENT: number;\n    readonly MS_MEDIA_KEYERR_DOMAIN: number;\n    readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number;\n    readonly MS_MEDIA_KEYERR_OUTPUT: number;\n    readonly MS_MEDIA_KEYERR_SERVICE: number;\n    readonly MS_MEDIA_KEYERR_UNKNOWN: number;\n}\n\ninterface MSMediaKeyMessageEvent extends Event {\n    readonly destinationURL: string | null;\n    readonly message: Uint8Array;\n}\n\ndeclare var MSMediaKeyMessageEvent: {\n    prototype: MSMediaKeyMessageEvent;\n    new(): MSMediaKeyMessageEvent;\n}\n\ninterface MSMediaKeyNeededEvent extends Event {\n    readonly initData: Uint8Array | null;\n}\n\ndeclare var MSMediaKeyNeededEvent: {\n    prototype: MSMediaKeyNeededEvent;\n    new(): MSMediaKeyNeededEvent;\n}\n\ninterface MSMediaKeySession extends EventTarget {\n    readonly error: MSMediaKeyError | null;\n    readonly keySystem: string;\n    readonly sessionId: string;\n    close(): void;\n    update(key: Uint8Array): void;\n}\n\ndeclare var MSMediaKeySession: {\n    prototype: MSMediaKeySession;\n    new(): MSMediaKeySession;\n}\n\ninterface MSMediaKeys {\n    readonly keySystem: string;\n    createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession;\n}\n\ndeclare var MSMediaKeys: {\n    prototype: MSMediaKeys;\n    new(keySystem: string): MSMediaKeys;\n    isTypeSupported(keySystem: string, type?: string): boolean;\n    isTypeSupportedWithFeatures(keySystem: string, type?: string): string;\n}\n\ninterface MSPointerEvent extends MouseEvent {\n    readonly currentPoint: any;\n    readonly height: number;\n    readonly hwTimestamp: number;\n    readonly intermediatePoints: any;\n    readonly isPrimary: boolean;\n    readonly pointerId: number;\n    readonly pointerType: any;\n    readonly pressure: number;\n    readonly rotation: number;\n    readonly tiltX: number;\n    readonly tiltY: number;\n    readonly width: number;\n    getCurrentPoint(element: Element): void;\n    getIntermediatePoints(element: Element): void;\n    initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void;\n}\n\ndeclare var MSPointerEvent: {\n    prototype: MSPointerEvent;\n    new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent;\n}\n\ninterface MSRangeCollection {\n    readonly length: number;\n    item(index: number): Range;\n    [index: number]: Range;\n}\n\ndeclare var MSRangeCollection: {\n    prototype: MSRangeCollection;\n    new(): MSRangeCollection;\n}\n\ninterface MSSiteModeEvent extends Event {\n    readonly actionURL: string;\n    readonly buttonID: number;\n}\n\ndeclare var MSSiteModeEvent: {\n    prototype: MSSiteModeEvent;\n    new(): MSSiteModeEvent;\n}\n\ninterface MSStream {\n    readonly type: string;\n    msClose(): void;\n    msDetachStream(): any;\n}\n\ndeclare var MSStream: {\n    prototype: MSStream;\n    new(): MSStream;\n}\n\ninterface MSStreamReader extends EventTarget, MSBaseReader {\n    readonly error: DOMError;\n    readAsArrayBuffer(stream: MSStream, size?: number): void;\n    readAsBinaryString(stream: MSStream, size?: number): void;\n    readAsBlob(stream: MSStream, size?: number): void;\n    readAsDataURL(stream: MSStream, size?: number): void;\n    readAsText(stream: MSStream, encoding?: string, size?: number): void;\n    addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSStreamReader: {\n    prototype: MSStreamReader;\n    new(): MSStreamReader;\n}\n\ninterface MSWebViewAsyncOperationEventMap {\n    \"complete\": Event;\n    \"error\": ErrorEvent;\n}\n\ninterface MSWebViewAsyncOperation extends EventTarget {\n    readonly error: DOMError;\n    oncomplete: (this: MSWebViewAsyncOperation, ev: Event) => any;\n    onerror: (this: MSWebViewAsyncOperation, ev: ErrorEvent) => any;\n    readonly readyState: number;\n    readonly result: any;\n    readonly target: MSHTMLWebViewElement;\n    readonly type: number;\n    start(): void;\n    readonly COMPLETED: number;\n    readonly ERROR: number;\n    readonly STARTED: number;\n    readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number;\n    readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number;\n    readonly TYPE_INVOKE_SCRIPT: number;\n    addEventListener<K extends keyof MSWebViewAsyncOperationEventMap>(type: K, listener: (this: MSWebViewAsyncOperation, ev: MSWebViewAsyncOperationEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSWebViewAsyncOperation: {\n    prototype: MSWebViewAsyncOperation;\n    new(): MSWebViewAsyncOperation;\n    readonly COMPLETED: number;\n    readonly ERROR: number;\n    readonly STARTED: number;\n    readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number;\n    readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number;\n    readonly TYPE_INVOKE_SCRIPT: number;\n}\n\ninterface MSWebViewSettings {\n    isIndexedDBEnabled: boolean;\n    isJavaScriptEnabled: boolean;\n}\n\ndeclare var MSWebViewSettings: {\n    prototype: MSWebViewSettings;\n    new(): MSWebViewSettings;\n}\n\ninterface MediaDeviceInfo {\n    readonly deviceId: string;\n    readonly groupId: string;\n    readonly kind: string;\n    readonly label: string;\n}\n\ndeclare var MediaDeviceInfo: {\n    prototype: MediaDeviceInfo;\n    new(): MediaDeviceInfo;\n}\n\ninterface MediaDevicesEventMap {\n    \"devicechange\": Event;\n}\n\ninterface MediaDevices extends EventTarget {\n    ondevicechange: (this: MediaDevices, ev: Event) => any;\n    enumerateDevices(): any;\n    getSupportedConstraints(): MediaTrackSupportedConstraints;\n    getUserMedia(constraints: MediaStreamConstraints): PromiseLike<MediaStream>;\n    addEventListener<K extends keyof MediaDevicesEventMap>(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MediaDevices: {\n    prototype: MediaDevices;\n    new(): MediaDevices;\n}\n\ninterface MediaElementAudioSourceNode extends AudioNode {\n}\n\ndeclare var MediaElementAudioSourceNode: {\n    prototype: MediaElementAudioSourceNode;\n    new(): MediaElementAudioSourceNode;\n}\n\ninterface MediaEncryptedEvent extends Event {\n    readonly initData: ArrayBuffer | null;\n    readonly initDataType: string;\n}\n\ndeclare var MediaEncryptedEvent: {\n    prototype: MediaEncryptedEvent;\n    new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent;\n}\n\ninterface MediaError {\n    readonly code: number;\n    readonly msExtendedCode: number;\n    readonly MEDIA_ERR_ABORTED: number;\n    readonly MEDIA_ERR_DECODE: number;\n    readonly MEDIA_ERR_NETWORK: number;\n    readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number;\n    readonly MS_MEDIA_ERR_ENCRYPTED: number;\n}\n\ndeclare var MediaError: {\n    prototype: MediaError;\n    new(): MediaError;\n    readonly MEDIA_ERR_ABORTED: number;\n    readonly MEDIA_ERR_DECODE: number;\n    readonly MEDIA_ERR_NETWORK: number;\n    readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number;\n    readonly MS_MEDIA_ERR_ENCRYPTED: number;\n}\n\ninterface MediaKeyMessageEvent extends Event {\n    readonly message: ArrayBuffer;\n    readonly messageType: string;\n}\n\ndeclare var MediaKeyMessageEvent: {\n    prototype: MediaKeyMessageEvent;\n    new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent;\n}\n\ninterface MediaKeySession extends EventTarget {\n    readonly closed: PromiseLike<void>;\n    readonly expiration: number;\n    readonly keyStatuses: MediaKeyStatusMap;\n    readonly sessionId: string;\n    close(): PromiseLike<void>;\n    generateRequest(initDataType: string, initData: any): PromiseLike<void>;\n    load(sessionId: string): PromiseLike<boolean>;\n    remove(): PromiseLike<void>;\n    update(response: any): PromiseLike<void>;\n}\n\ndeclare var MediaKeySession: {\n    prototype: MediaKeySession;\n    new(): MediaKeySession;\n}\n\ninterface MediaKeyStatusMap {\n    readonly size: number;\n    forEach(callback: ForEachCallback): void;\n    get(keyId: any): string;\n    has(keyId: any): boolean;\n}\n\ndeclare var MediaKeyStatusMap: {\n    prototype: MediaKeyStatusMap;\n    new(): MediaKeyStatusMap;\n}\n\ninterface MediaKeySystemAccess {\n    readonly keySystem: string;\n    createMediaKeys(): PromiseLike<MediaKeys>;\n    getConfiguration(): MediaKeySystemConfiguration;\n}\n\ndeclare var MediaKeySystemAccess: {\n    prototype: MediaKeySystemAccess;\n    new(): MediaKeySystemAccess;\n}\n\ninterface MediaKeys {\n    createSession(sessionType?: string): MediaKeySession;\n    setServerCertificate(serverCertificate: any): PromiseLike<void>;\n}\n\ndeclare var MediaKeys: {\n    prototype: MediaKeys;\n    new(): MediaKeys;\n}\n\ninterface MediaList {\n    readonly length: number;\n    mediaText: string;\n    appendMedium(newMedium: string): void;\n    deleteMedium(oldMedium: string): void;\n    item(index: number): string;\n    toString(): string;\n    [index: number]: string;\n}\n\ndeclare var MediaList: {\n    prototype: MediaList;\n    new(): MediaList;\n}\n\ninterface MediaQueryList {\n    readonly matches: boolean;\n    readonly media: string;\n    addListener(listener: MediaQueryListListener): void;\n    removeListener(listener: MediaQueryListListener): void;\n}\n\ndeclare var MediaQueryList: {\n    prototype: MediaQueryList;\n    new(): MediaQueryList;\n}\n\ninterface MediaSource extends EventTarget {\n    readonly activeSourceBuffers: SourceBufferList;\n    duration: number;\n    readonly readyState: string;\n    readonly sourceBuffers: SourceBufferList;\n    addSourceBuffer(type: string): SourceBuffer;\n    endOfStream(error?: number): void;\n    removeSourceBuffer(sourceBuffer: SourceBuffer): void;\n}\n\ndeclare var MediaSource: {\n    prototype: MediaSource;\n    new(): MediaSource;\n    isTypeSupported(type: string): boolean;\n}\n\ninterface MediaStreamEventMap {\n    \"active\": Event;\n    \"addtrack\": TrackEvent;\n    \"inactive\": Event;\n    \"removetrack\": TrackEvent;\n}\n\ninterface MediaStream extends EventTarget {\n    readonly active: boolean;\n    readonly id: string;\n    onactive: (this: MediaStream, ev: Event) => any;\n    onaddtrack: (this: MediaStream, ev: TrackEvent) => any;\n    oninactive: (this: MediaStream, ev: Event) => any;\n    onremovetrack: (this: MediaStream, ev: TrackEvent) => any;\n    addTrack(track: MediaStreamTrack): void;\n    clone(): MediaStream;\n    getAudioTracks(): MediaStreamTrack[];\n    getTrackById(trackId: string): MediaStreamTrack | null;\n    getTracks(): MediaStreamTrack[];\n    getVideoTracks(): MediaStreamTrack[];\n    removeTrack(track: MediaStreamTrack): void;\n    stop(): void;\n    addEventListener<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MediaStream: {\n    prototype: MediaStream;\n    new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream;\n}\n\ninterface MediaStreamAudioSourceNode extends AudioNode {\n}\n\ndeclare var MediaStreamAudioSourceNode: {\n    prototype: MediaStreamAudioSourceNode;\n    new(): MediaStreamAudioSourceNode;\n}\n\ninterface MediaStreamError {\n    readonly constraintName: string | null;\n    readonly message: string | null;\n    readonly name: string;\n}\n\ndeclare var MediaStreamError: {\n    prototype: MediaStreamError;\n    new(): MediaStreamError;\n}\n\ninterface MediaStreamErrorEvent extends Event {\n    readonly error: MediaStreamError | null;\n}\n\ndeclare var MediaStreamErrorEvent: {\n    prototype: MediaStreamErrorEvent;\n    new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent;\n}\n\ninterface MediaStreamTrackEventMap {\n    \"ended\": MediaStreamErrorEvent;\n    \"mute\": Event;\n    \"overconstrained\": MediaStreamErrorEvent;\n    \"unmute\": Event;\n}\n\ninterface MediaStreamTrack extends EventTarget {\n    enabled: boolean;\n    readonly id: string;\n    readonly kind: string;\n    readonly label: string;\n    readonly muted: boolean;\n    onended: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any;\n    onmute: (this: MediaStreamTrack, ev: Event) => any;\n    onoverconstrained: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any;\n    onunmute: (this: MediaStreamTrack, ev: Event) => any;\n    readonly readonly: boolean;\n    readonly readyState: string;\n    readonly remote: boolean;\n    applyConstraints(constraints: MediaTrackConstraints): PromiseLike<void>;\n    clone(): MediaStreamTrack;\n    getCapabilities(): MediaTrackCapabilities;\n    getConstraints(): MediaTrackConstraints;\n    getSettings(): MediaTrackSettings;\n    stop(): void;\n    addEventListener<K extends keyof MediaStreamTrackEventMap>(type: K, listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MediaStreamTrack: {\n    prototype: MediaStreamTrack;\n    new(): MediaStreamTrack;\n}\n\ninterface MediaStreamTrackEvent extends Event {\n    readonly track: MediaStreamTrack;\n}\n\ndeclare var MediaStreamTrackEvent: {\n    prototype: MediaStreamTrackEvent;\n    new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent;\n}\n\ninterface MessageChannel {\n    readonly port1: MessagePort;\n    readonly port2: MessagePort;\n}\n\ndeclare var MessageChannel: {\n    prototype: MessageChannel;\n    new(): MessageChannel;\n}\n\ninterface MessageEvent extends Event {\n    readonly data: any;\n    readonly origin: string;\n    readonly ports: any;\n    readonly source: Window;\n    initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void;\n}\n\ndeclare var MessageEvent: {\n    prototype: MessageEvent;\n    new(type: string, eventInitDict?: MessageEventInit): MessageEvent;\n}\n\ninterface MessagePortEventMap {\n    \"message\": MessageEvent;\n}\n\ninterface MessagePort extends EventTarget {\n    onmessage: (this: MessagePort, ev: MessageEvent) => any;\n    close(): void;\n    postMessage(message?: any, ports?: any): void;\n    start(): void;\n    addEventListener<K extends keyof MessagePortEventMap>(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MessagePort: {\n    prototype: MessagePort;\n    new(): MessagePort;\n}\n\ninterface MimeType {\n    readonly description: string;\n    readonly enabledPlugin: Plugin;\n    readonly suffixes: string;\n    readonly type: string;\n}\n\ndeclare var MimeType: {\n    prototype: MimeType;\n    new(): MimeType;\n}\n\ninterface MimeTypeArray {\n    readonly length: number;\n    item(index: number): Plugin;\n    namedItem(type: string): Plugin;\n    [index: number]: Plugin;\n}\n\ndeclare var MimeTypeArray: {\n    prototype: MimeTypeArray;\n    new(): MimeTypeArray;\n}\n\ninterface MouseEvent extends UIEvent {\n    readonly altKey: boolean;\n    readonly button: number;\n    readonly buttons: number;\n    readonly clientX: number;\n    readonly clientY: number;\n    readonly ctrlKey: boolean;\n    readonly fromElement: Element;\n    readonly layerX: number;\n    readonly layerY: number;\n    readonly metaKey: boolean;\n    readonly movementX: number;\n    readonly movementY: number;\n    readonly offsetX: number;\n    readonly offsetY: number;\n    readonly pageX: number;\n    readonly pageY: number;\n    readonly relatedTarget: EventTarget;\n    readonly screenX: number;\n    readonly screenY: number;\n    readonly shiftKey: boolean;\n    readonly toElement: Element;\n    readonly which: number;\n    readonly x: number;\n    readonly y: number;\n    getModifierState(keyArg: string): boolean;\n    initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void;\n}\n\ndeclare var MouseEvent: {\n    prototype: MouseEvent;\n    new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent;\n}\n\ninterface MutationEvent extends Event {\n    readonly attrChange: number;\n    readonly attrName: string;\n    readonly newValue: string;\n    readonly prevValue: string;\n    readonly relatedNode: Node;\n    initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void;\n    readonly ADDITION: number;\n    readonly MODIFICATION: number;\n    readonly REMOVAL: number;\n}\n\ndeclare var MutationEvent: {\n    prototype: MutationEvent;\n    new(): MutationEvent;\n    readonly ADDITION: number;\n    readonly MODIFICATION: number;\n    readonly REMOVAL: number;\n}\n\ninterface MutationObserver {\n    disconnect(): void;\n    observe(target: Node, options: MutationObserverInit): void;\n    takeRecords(): MutationRecord[];\n}\n\ndeclare var MutationObserver: {\n    prototype: MutationObserver;\n    new(callback: MutationCallback): MutationObserver;\n}\n\ninterface MutationRecord {\n    readonly addedNodes: NodeList;\n    readonly attributeName: string | null;\n    readonly attributeNamespace: string | null;\n    readonly nextSibling: Node | null;\n    readonly oldValue: string | null;\n    readonly previousSibling: Node | null;\n    readonly removedNodes: NodeList;\n    readonly target: Node;\n    readonly type: string;\n}\n\ndeclare var MutationRecord: {\n    prototype: MutationRecord;\n    new(): MutationRecord;\n}\n\ninterface NamedNodeMap {\n    readonly length: number;\n    getNamedItem(name: string): Attr;\n    getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr;\n    item(index: number): Attr;\n    removeNamedItem(name: string): Attr;\n    removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr;\n    setNamedItem(arg: Attr): Attr;\n    setNamedItemNS(arg: Attr): Attr;\n    [index: number]: Attr;\n}\n\ndeclare var NamedNodeMap: {\n    prototype: NamedNodeMap;\n    new(): NamedNodeMap;\n}\n\ninterface NavigationCompletedEvent extends NavigationEvent {\n    readonly isSuccess: boolean;\n    readonly webErrorStatus: number;\n}\n\ndeclare var NavigationCompletedEvent: {\n    prototype: NavigationCompletedEvent;\n    new(): NavigationCompletedEvent;\n}\n\ninterface NavigationEvent extends Event {\n    readonly uri: string;\n}\n\ndeclare var NavigationEvent: {\n    prototype: NavigationEvent;\n    new(): NavigationEvent;\n}\n\ninterface NavigationEventWithReferrer extends NavigationEvent {\n    readonly referer: string;\n}\n\ndeclare var NavigationEventWithReferrer: {\n    prototype: NavigationEventWithReferrer;\n    new(): NavigationEventWithReferrer;\n}\n\ninterface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia {\n    readonly appCodeName: string;\n    readonly cookieEnabled: boolean;\n    readonly language: string;\n    readonly maxTouchPoints: number;\n    readonly mimeTypes: MimeTypeArray;\n    readonly msManipulationViewsEnabled: boolean;\n    readonly msMaxTouchPoints: number;\n    readonly msPointerEnabled: boolean;\n    readonly plugins: PluginArray;\n    readonly pointerEnabled: boolean;\n    readonly webdriver: boolean;\n    readonly hardwareConcurrency: number;\n    getGamepads(): Gamepad[];\n    javaEnabled(): boolean;\n    msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void;\n    requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike<MediaKeySystemAccess>;\n    vibrate(pattern: number | number[]): boolean;\n}\n\ndeclare var Navigator: {\n    prototype: Navigator;\n    new(): Navigator;\n}\n\ninterface Node extends EventTarget {\n    readonly attributes: NamedNodeMap;\n    readonly baseURI: string | null;\n    readonly childNodes: NodeList;\n    readonly firstChild: Node | null;\n    readonly lastChild: Node | null;\n    readonly localName: string | null;\n    readonly namespaceURI: string | null;\n    readonly nextSibling: Node | null;\n    readonly nodeName: string;\n    readonly nodeType: number;\n    nodeValue: string | null;\n    readonly ownerDocument: Document;\n    readonly parentElement: HTMLElement | null;\n    readonly parentNode: Node | null;\n    readonly previousSibling: Node | null;\n    textContent: string | null;\n    appendChild(newChild: Node): Node;\n    cloneNode(deep?: boolean): Node;\n    compareDocumentPosition(other: Node): number;\n    contains(child: Node): boolean;\n    hasAttributes(): boolean;\n    hasChildNodes(): boolean;\n    insertBefore(newChild: Node, refChild: Node | null): Node;\n    isDefaultNamespace(namespaceURI: string | null): boolean;\n    isEqualNode(arg: Node): boolean;\n    isSameNode(other: Node): boolean;\n    lookupNamespaceURI(prefix: string | null): string | null;\n    lookupPrefix(namespaceURI: string | null): string | null;\n    normalize(): void;\n    removeChild(oldChild: Node): Node;\n    replaceChild(newChild: Node, oldChild: Node): Node;\n    readonly ATTRIBUTE_NODE: number;\n    readonly CDATA_SECTION_NODE: number;\n    readonly COMMENT_NODE: number;\n    readonly DOCUMENT_FRAGMENT_NODE: number;\n    readonly DOCUMENT_NODE: number;\n    readonly DOCUMENT_POSITION_CONTAINED_BY: number;\n    readonly DOCUMENT_POSITION_CONTAINS: number;\n    readonly DOCUMENT_POSITION_DISCONNECTED: number;\n    readonly DOCUMENT_POSITION_FOLLOWING: number;\n    readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;\n    readonly DOCUMENT_POSITION_PRECEDING: number;\n    readonly DOCUMENT_TYPE_NODE: number;\n    readonly ELEMENT_NODE: number;\n    readonly ENTITY_NODE: number;\n    readonly ENTITY_REFERENCE_NODE: number;\n    readonly NOTATION_NODE: number;\n    readonly PROCESSING_INSTRUCTION_NODE: number;\n    readonly TEXT_NODE: number;\n}\n\ndeclare var Node: {\n    prototype: Node;\n    new(): Node;\n    readonly ATTRIBUTE_NODE: number;\n    readonly CDATA_SECTION_NODE: number;\n    readonly COMMENT_NODE: number;\n    readonly DOCUMENT_FRAGMENT_NODE: number;\n    readonly DOCUMENT_NODE: number;\n    readonly DOCUMENT_POSITION_CONTAINED_BY: number;\n    readonly DOCUMENT_POSITION_CONTAINS: number;\n    readonly DOCUMENT_POSITION_DISCONNECTED: number;\n    readonly DOCUMENT_POSITION_FOLLOWING: number;\n    readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;\n    readonly DOCUMENT_POSITION_PRECEDING: number;\n    readonly DOCUMENT_TYPE_NODE: number;\n    readonly ELEMENT_NODE: number;\n    readonly ENTITY_NODE: number;\n    readonly ENTITY_REFERENCE_NODE: number;\n    readonly NOTATION_NODE: number;\n    readonly PROCESSING_INSTRUCTION_NODE: number;\n    readonly TEXT_NODE: number;\n}\n\ninterface NodeFilter {\n    acceptNode(n: Node): number;\n}\n\ndeclare var NodeFilter: {\n    readonly FILTER_ACCEPT: number;\n    readonly FILTER_REJECT: number;\n    readonly FILTER_SKIP: number;\n    readonly SHOW_ALL: number;\n    readonly SHOW_ATTRIBUTE: number;\n    readonly SHOW_CDATA_SECTION: number;\n    readonly SHOW_COMMENT: number;\n    readonly SHOW_DOCUMENT: number;\n    readonly SHOW_DOCUMENT_FRAGMENT: number;\n    readonly SHOW_DOCUMENT_TYPE: number;\n    readonly SHOW_ELEMENT: number;\n    readonly SHOW_ENTITY: number;\n    readonly SHOW_ENTITY_REFERENCE: number;\n    readonly SHOW_NOTATION: number;\n    readonly SHOW_PROCESSING_INSTRUCTION: number;\n    readonly SHOW_TEXT: number;\n}\n\ninterface NodeIterator {\n    readonly expandEntityReferences: boolean;\n    readonly filter: NodeFilter;\n    readonly root: Node;\n    readonly whatToShow: number;\n    detach(): void;\n    nextNode(): Node;\n    previousNode(): Node;\n}\n\ndeclare var NodeIterator: {\n    prototype: NodeIterator;\n    new(): NodeIterator;\n}\n\ninterface NodeList {\n    readonly length: number;\n    item(index: number): Node;\n    [index: number]: Node;\n}\n\ndeclare var NodeList: {\n    prototype: NodeList;\n    new(): NodeList;\n}\n\ninterface OES_element_index_uint {\n}\n\ndeclare var OES_element_index_uint: {\n    prototype: OES_element_index_uint;\n    new(): OES_element_index_uint;\n}\n\ninterface OES_standard_derivatives {\n    readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number;\n}\n\ndeclare var OES_standard_derivatives: {\n    prototype: OES_standard_derivatives;\n    new(): OES_standard_derivatives;\n    readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number;\n}\n\ninterface OES_texture_float {\n}\n\ndeclare var OES_texture_float: {\n    prototype: OES_texture_float;\n    new(): OES_texture_float;\n}\n\ninterface OES_texture_float_linear {\n}\n\ndeclare var OES_texture_float_linear: {\n    prototype: OES_texture_float_linear;\n    new(): OES_texture_float_linear;\n}\n\ninterface OfflineAudioCompletionEvent extends Event {\n    readonly renderedBuffer: AudioBuffer;\n}\n\ndeclare var OfflineAudioCompletionEvent: {\n    prototype: OfflineAudioCompletionEvent;\n    new(): OfflineAudioCompletionEvent;\n}\n\ninterface OfflineAudioContextEventMap {\n    \"complete\": Event;\n}\n\ninterface OfflineAudioContext extends AudioContext {\n    oncomplete: (this: OfflineAudioContext, ev: Event) => any;\n    startRendering(): PromiseLike<AudioBuffer>;\n    addEventListener<K extends keyof OfflineAudioContextEventMap>(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var OfflineAudioContext: {\n    prototype: OfflineAudioContext;\n    new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext;\n}\n\ninterface OscillatorNodeEventMap {\n    \"ended\": MediaStreamErrorEvent;\n}\n\ninterface OscillatorNode extends AudioNode {\n    readonly detune: AudioParam;\n    readonly frequency: AudioParam;\n    onended: (this: OscillatorNode, ev: MediaStreamErrorEvent) => any;\n    type: string;\n    setPeriodicWave(periodicWave: PeriodicWave): void;\n    start(when?: number): void;\n    stop(when?: number): void;\n    addEventListener<K extends keyof OscillatorNodeEventMap>(type: K, listener: (this: OscillatorNode, ev: OscillatorNodeEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var OscillatorNode: {\n    prototype: OscillatorNode;\n    new(): OscillatorNode;\n}\n\ninterface OverflowEvent extends UIEvent {\n    readonly horizontalOverflow: boolean;\n    readonly orient: number;\n    readonly verticalOverflow: boolean;\n    readonly BOTH: number;\n    readonly HORIZONTAL: number;\n    readonly VERTICAL: number;\n}\n\ndeclare var OverflowEvent: {\n    prototype: OverflowEvent;\n    new(): OverflowEvent;\n    readonly BOTH: number;\n    readonly HORIZONTAL: number;\n    readonly VERTICAL: number;\n}\n\ninterface PageTransitionEvent extends Event {\n    readonly persisted: boolean;\n}\n\ndeclare var PageTransitionEvent: {\n    prototype: PageTransitionEvent;\n    new(): PageTransitionEvent;\n}\n\ninterface PannerNode extends AudioNode {\n    coneInnerAngle: number;\n    coneOuterAngle: number;\n    coneOuterGain: number;\n    distanceModel: string;\n    maxDistance: number;\n    panningModel: string;\n    refDistance: number;\n    rolloffFactor: number;\n    setOrientation(x: number, y: number, z: number): void;\n    setPosition(x: number, y: number, z: number): void;\n    setVelocity(x: number, y: number, z: number): void;\n}\n\ndeclare var PannerNode: {\n    prototype: PannerNode;\n    new(): PannerNode;\n}\n\ninterface PerfWidgetExternal {\n    readonly activeNetworkRequestCount: number;\n    readonly averageFrameTime: number;\n    readonly averagePaintTime: number;\n    readonly extraInformationEnabled: boolean;\n    readonly independentRenderingEnabled: boolean;\n    readonly irDisablingContentString: string;\n    readonly irStatusAvailable: boolean;\n    readonly maxCpuSpeed: number;\n    readonly paintRequestsPerSecond: number;\n    readonly performanceCounter: number;\n    readonly performanceCounterFrequency: number;\n    addEventListener(eventType: string, callback: Function): void;\n    getMemoryUsage(): number;\n    getProcessCpuUsage(): number;\n    getRecentCpuUsage(last: number | null): any;\n    getRecentFrames(last: number | null): any;\n    getRecentMemoryUsage(last: number | null): any;\n    getRecentPaintRequests(last: number | null): any;\n    removeEventListener(eventType: string, callback: Function): void;\n    repositionWindow(x: number, y: number): void;\n    resizeWindow(width: number, height: number): void;\n}\n\ndeclare var PerfWidgetExternal: {\n    prototype: PerfWidgetExternal;\n    new(): PerfWidgetExternal;\n}\n\ninterface Performance {\n    readonly navigation: PerformanceNavigation;\n    readonly timing: PerformanceTiming;\n    clearMarks(markName?: string): void;\n    clearMeasures(measureName?: string): void;\n    clearResourceTimings(): void;\n    getEntries(): any;\n    getEntriesByName(name: string, entryType?: string): any;\n    getEntriesByType(entryType: string): any;\n    getMarks(markName?: string): any;\n    getMeasures(measureName?: string): any;\n    mark(markName: string): void;\n    measure(measureName: string, startMarkName?: string, endMarkName?: string): void;\n    now(): number;\n    setResourceTimingBufferSize(maxSize: number): void;\n    toJSON(): any;\n}\n\ndeclare var Performance: {\n    prototype: Performance;\n    new(): Performance;\n}\n\ninterface PerformanceEntry {\n    readonly duration: number;\n    readonly entryType: string;\n    readonly name: string;\n    readonly startTime: number;\n}\n\ndeclare var PerformanceEntry: {\n    prototype: PerformanceEntry;\n    new(): PerformanceEntry;\n}\n\ninterface PerformanceMark extends PerformanceEntry {\n}\n\ndeclare var PerformanceMark: {\n    prototype: PerformanceMark;\n    new(): PerformanceMark;\n}\n\ninterface PerformanceMeasure extends PerformanceEntry {\n}\n\ndeclare var PerformanceMeasure: {\n    prototype: PerformanceMeasure;\n    new(): PerformanceMeasure;\n}\n\ninterface PerformanceNavigation {\n    readonly redirectCount: number;\n    readonly type: number;\n    toJSON(): any;\n    readonly TYPE_BACK_FORWARD: number;\n    readonly TYPE_NAVIGATE: number;\n    readonly TYPE_RELOAD: number;\n    readonly TYPE_RESERVED: number;\n}\n\ndeclare var PerformanceNavigation: {\n    prototype: PerformanceNavigation;\n    new(): PerformanceNavigation;\n    readonly TYPE_BACK_FORWARD: number;\n    readonly TYPE_NAVIGATE: number;\n    readonly TYPE_RELOAD: number;\n    readonly TYPE_RESERVED: number;\n}\n\ninterface PerformanceNavigationTiming extends PerformanceEntry {\n    readonly connectEnd: number;\n    readonly connectStart: number;\n    readonly domComplete: number;\n    readonly domContentLoadedEventEnd: number;\n    readonly domContentLoadedEventStart: number;\n    readonly domInteractive: number;\n    readonly domLoading: number;\n    readonly domainLookupEnd: number;\n    readonly domainLookupStart: number;\n    readonly fetchStart: number;\n    readonly loadEventEnd: number;\n    readonly loadEventStart: number;\n    readonly navigationStart: number;\n    readonly redirectCount: number;\n    readonly redirectEnd: number;\n    readonly redirectStart: number;\n    readonly requestStart: number;\n    readonly responseEnd: number;\n    readonly responseStart: number;\n    readonly type: string;\n    readonly unloadEventEnd: number;\n    readonly unloadEventStart: number;\n}\n\ndeclare var PerformanceNavigationTiming: {\n    prototype: PerformanceNavigationTiming;\n    new(): PerformanceNavigationTiming;\n}\n\ninterface PerformanceResourceTiming extends PerformanceEntry {\n    readonly connectEnd: number;\n    readonly connectStart: number;\n    readonly domainLookupEnd: number;\n    readonly domainLookupStart: number;\n    readonly fetchStart: number;\n    readonly initiatorType: string;\n    readonly redirectEnd: number;\n    readonly redirectStart: number;\n    readonly requestStart: number;\n    readonly responseEnd: number;\n    readonly responseStart: number;\n}\n\ndeclare var PerformanceResourceTiming: {\n    prototype: PerformanceResourceTiming;\n    new(): PerformanceResourceTiming;\n}\n\ninterface PerformanceTiming {\n    readonly connectEnd: number;\n    readonly connectStart: number;\n    readonly domComplete: number;\n    readonly domContentLoadedEventEnd: number;\n    readonly domContentLoadedEventStart: number;\n    readonly domInteractive: number;\n    readonly domLoading: number;\n    readonly domainLookupEnd: number;\n    readonly domainLookupStart: number;\n    readonly fetchStart: number;\n    readonly loadEventEnd: number;\n    readonly loadEventStart: number;\n    readonly msFirstPaint: number;\n    readonly navigationStart: number;\n    readonly redirectEnd: number;\n    readonly redirectStart: number;\n    readonly requestStart: number;\n    readonly responseEnd: number;\n    readonly responseStart: number;\n    readonly unloadEventEnd: number;\n    readonly unloadEventStart: number;\n    readonly secureConnectionStart: number;\n    toJSON(): any;\n}\n\ndeclare var PerformanceTiming: {\n    prototype: PerformanceTiming;\n    new(): PerformanceTiming;\n}\n\ninterface PeriodicWave {\n}\n\ndeclare var PeriodicWave: {\n    prototype: PeriodicWave;\n    new(): PeriodicWave;\n}\n\ninterface PermissionRequest extends DeferredPermissionRequest {\n    readonly state: string;\n    defer(): void;\n}\n\ndeclare var PermissionRequest: {\n    prototype: PermissionRequest;\n    new(): PermissionRequest;\n}\n\ninterface PermissionRequestedEvent extends Event {\n    readonly permissionRequest: PermissionRequest;\n}\n\ndeclare var PermissionRequestedEvent: {\n    prototype: PermissionRequestedEvent;\n    new(): PermissionRequestedEvent;\n}\n\ninterface Plugin {\n    readonly description: string;\n    readonly filename: string;\n    readonly length: number;\n    readonly name: string;\n    readonly version: string;\n    item(index: number): MimeType;\n    namedItem(type: string): MimeType;\n    [index: number]: MimeType;\n}\n\ndeclare var Plugin: {\n    prototype: Plugin;\n    new(): Plugin;\n}\n\ninterface PluginArray {\n    readonly length: number;\n    item(index: number): Plugin;\n    namedItem(name: string): Plugin;\n    refresh(reload?: boolean): void;\n    [index: number]: Plugin;\n}\n\ndeclare var PluginArray: {\n    prototype: PluginArray;\n    new(): PluginArray;\n}\n\ninterface PointerEvent extends MouseEvent {\n    readonly currentPoint: any;\n    readonly height: number;\n    readonly hwTimestamp: number;\n    readonly intermediatePoints: any;\n    readonly isPrimary: boolean;\n    readonly pointerId: number;\n    readonly pointerType: any;\n    readonly pressure: number;\n    readonly rotation: number;\n    readonly tiltX: number;\n    readonly tiltY: number;\n    readonly width: number;\n    getCurrentPoint(element: Element): void;\n    getIntermediatePoints(element: Element): void;\n    initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void;\n}\n\ndeclare var PointerEvent: {\n    prototype: PointerEvent;\n    new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent;\n}\n\ninterface PopStateEvent extends Event {\n    readonly state: any;\n    initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void;\n}\n\ndeclare var PopStateEvent: {\n    prototype: PopStateEvent;\n    new(): PopStateEvent;\n}\n\ninterface Position {\n    readonly coords: Coordinates;\n    readonly timestamp: number;\n}\n\ndeclare var Position: {\n    prototype: Position;\n    new(): Position;\n}\n\ninterface PositionError {\n    readonly code: number;\n    readonly message: string;\n    toString(): string;\n    readonly PERMISSION_DENIED: number;\n    readonly POSITION_UNAVAILABLE: number;\n    readonly TIMEOUT: number;\n}\n\ndeclare var PositionError: {\n    prototype: PositionError;\n    new(): PositionError;\n    readonly PERMISSION_DENIED: number;\n    readonly POSITION_UNAVAILABLE: number;\n    readonly TIMEOUT: number;\n}\n\ninterface ProcessingInstruction extends CharacterData {\n    readonly target: string;\n}\n\ndeclare var ProcessingInstruction: {\n    prototype: ProcessingInstruction;\n    new(): ProcessingInstruction;\n}\n\ninterface ProgressEvent extends Event {\n    readonly lengthComputable: boolean;\n    readonly loaded: number;\n    readonly total: number;\n    initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void;\n}\n\ndeclare var ProgressEvent: {\n    prototype: ProgressEvent;\n    new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent;\n}\n\ninterface RTCDTMFToneChangeEvent extends Event {\n    readonly tone: string;\n}\n\ndeclare var RTCDTMFToneChangeEvent: {\n    prototype: RTCDTMFToneChangeEvent;\n    new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent;\n}\n\ninterface RTCDtlsTransportEventMap {\n    \"dtlsstatechange\": RTCDtlsTransportStateChangedEvent;\n    \"error\": ErrorEvent;\n}\n\ninterface RTCDtlsTransport extends RTCStatsProvider {\n    ondtlsstatechange: ((this: RTCDtlsTransport, ev: RTCDtlsTransportStateChangedEvent) => any) | null;\n    onerror: ((this: RTCDtlsTransport, ev: ErrorEvent) => any) | null;\n    readonly state: string;\n    readonly transport: RTCIceTransport;\n    getLocalParameters(): RTCDtlsParameters;\n    getRemoteCertificates(): ArrayBuffer[];\n    getRemoteParameters(): RTCDtlsParameters | null;\n    start(remoteParameters: RTCDtlsParameters): void;\n    stop(): void;\n    addEventListener<K extends keyof RTCDtlsTransportEventMap>(type: K, listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCDtlsTransport: {\n    prototype: RTCDtlsTransport;\n    new(transport: RTCIceTransport): RTCDtlsTransport;\n}\n\ninterface RTCDtlsTransportStateChangedEvent extends Event {\n    readonly state: string;\n}\n\ndeclare var RTCDtlsTransportStateChangedEvent: {\n    prototype: RTCDtlsTransportStateChangedEvent;\n    new(): RTCDtlsTransportStateChangedEvent;\n}\n\ninterface RTCDtmfSenderEventMap {\n    \"tonechange\": RTCDTMFToneChangeEvent;\n}\n\ninterface RTCDtmfSender extends EventTarget {\n    readonly canInsertDTMF: boolean;\n    readonly duration: number;\n    readonly interToneGap: number;\n    ontonechange: (this: RTCDtmfSender, ev: RTCDTMFToneChangeEvent) => any;\n    readonly sender: RTCRtpSender;\n    readonly toneBuffer: string;\n    insertDTMF(tones: string, duration?: number, interToneGap?: number): void;\n    addEventListener<K extends keyof RTCDtmfSenderEventMap>(type: K, listener: (this: RTCDtmfSender, ev: RTCDtmfSenderEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCDtmfSender: {\n    prototype: RTCDtmfSender;\n    new(sender: RTCRtpSender): RTCDtmfSender;\n}\n\ninterface RTCIceCandidatePairChangedEvent extends Event {\n    readonly pair: RTCIceCandidatePair;\n}\n\ndeclare var RTCIceCandidatePairChangedEvent: {\n    prototype: RTCIceCandidatePairChangedEvent;\n    new(): RTCIceCandidatePairChangedEvent;\n}\n\ninterface RTCIceGathererEventMap {\n    \"error\": ErrorEvent;\n    \"localcandidate\": RTCIceGathererEvent;\n}\n\ninterface RTCIceGatherer extends RTCStatsProvider {\n    readonly component: string;\n    onerror: ((this: RTCIceGatherer, ev: ErrorEvent) => any) | null;\n    onlocalcandidate: ((this: RTCIceGatherer, ev: RTCIceGathererEvent) => any) | null;\n    createAssociatedGatherer(): RTCIceGatherer;\n    getLocalCandidates(): RTCIceCandidate[];\n    getLocalParameters(): RTCIceParameters;\n    addEventListener<K extends keyof RTCIceGathererEventMap>(type: K, listener: (this: RTCIceGatherer, ev: RTCIceGathererEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCIceGatherer: {\n    prototype: RTCIceGatherer;\n    new(options: RTCIceGatherOptions): RTCIceGatherer;\n}\n\ninterface RTCIceGathererEvent extends Event {\n    readonly candidate: RTCIceCandidate | RTCIceCandidateComplete;\n}\n\ndeclare var RTCIceGathererEvent: {\n    prototype: RTCIceGathererEvent;\n    new(): RTCIceGathererEvent;\n}\n\ninterface RTCIceTransportEventMap {\n    \"candidatepairchange\": RTCIceCandidatePairChangedEvent;\n    \"icestatechange\": RTCIceTransportStateChangedEvent;\n}\n\ninterface RTCIceTransport extends RTCStatsProvider {\n    readonly component: string;\n    readonly iceGatherer: RTCIceGatherer | null;\n    oncandidatepairchange: ((this: RTCIceTransport, ev: RTCIceCandidatePairChangedEvent) => any) | null;\n    onicestatechange: ((this: RTCIceTransport, ev: RTCIceTransportStateChangedEvent) => any) | null;\n    readonly role: string;\n    readonly state: string;\n    addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void;\n    createAssociatedTransport(): RTCIceTransport;\n    getNominatedCandidatePair(): RTCIceCandidatePair | null;\n    getRemoteCandidates(): RTCIceCandidate[];\n    getRemoteParameters(): RTCIceParameters | null;\n    setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void;\n    start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void;\n    stop(): void;\n    addEventListener<K extends keyof RTCIceTransportEventMap>(type: K, listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCIceTransport: {\n    prototype: RTCIceTransport;\n    new(): RTCIceTransport;\n}\n\ninterface RTCIceTransportStateChangedEvent extends Event {\n    readonly state: string;\n}\n\ndeclare var RTCIceTransportStateChangedEvent: {\n    prototype: RTCIceTransportStateChangedEvent;\n    new(): RTCIceTransportStateChangedEvent;\n}\n\ninterface RTCRtpReceiverEventMap {\n    \"error\": ErrorEvent;\n}\n\ninterface RTCRtpReceiver extends RTCStatsProvider {\n    onerror: ((this: RTCRtpReceiver, ev: ErrorEvent) => any) | null;\n    readonly rtcpTransport: RTCDtlsTransport;\n    readonly track: MediaStreamTrack | null;\n    readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;\n    getContributingSources(): RTCRtpContributingSource[];\n    receive(parameters: RTCRtpParameters): void;\n    requestSendCSRC(csrc: number): void;\n    setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;\n    stop(): void;\n    addEventListener<K extends keyof RTCRtpReceiverEventMap>(type: K, listener: (this: RTCRtpReceiver, ev: RTCRtpReceiverEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCRtpReceiver: {\n    prototype: RTCRtpReceiver;\n    new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver;\n    getCapabilities(kind?: string): RTCRtpCapabilities;\n}\n\ninterface RTCRtpSenderEventMap {\n    \"error\": ErrorEvent;\n    \"ssrcconflict\": RTCSsrcConflictEvent;\n}\n\ninterface RTCRtpSender extends RTCStatsProvider {\n    onerror: ((this: RTCRtpSender, ev: ErrorEvent) => any) | null;\n    onssrcconflict: ((this: RTCRtpSender, ev: RTCSsrcConflictEvent) => any) | null;\n    readonly rtcpTransport: RTCDtlsTransport;\n    readonly track: MediaStreamTrack;\n    readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;\n    send(parameters: RTCRtpParameters): void;\n    setTrack(track: MediaStreamTrack): void;\n    setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;\n    stop(): void;\n    addEventListener<K extends keyof RTCRtpSenderEventMap>(type: K, listener: (this: RTCRtpSender, ev: RTCRtpSenderEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCRtpSender: {\n    prototype: RTCRtpSender;\n    new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender;\n    getCapabilities(kind?: string): RTCRtpCapabilities;\n}\n\ninterface RTCSrtpSdesTransportEventMap {\n    \"error\": ErrorEvent;\n}\n\ninterface RTCSrtpSdesTransport extends EventTarget {\n    onerror: ((this: RTCSrtpSdesTransport, ev: ErrorEvent) => any) | null;\n    readonly transport: RTCIceTransport;\n    addEventListener<K extends keyof RTCSrtpSdesTransportEventMap>(type: K, listener: (this: RTCSrtpSdesTransport, ev: RTCSrtpSdesTransportEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCSrtpSdesTransport: {\n    prototype: RTCSrtpSdesTransport;\n    new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport;\n    getLocalParameters(): RTCSrtpSdesParameters[];\n}\n\ninterface RTCSsrcConflictEvent extends Event {\n    readonly ssrc: number;\n}\n\ndeclare var RTCSsrcConflictEvent: {\n    prototype: RTCSsrcConflictEvent;\n    new(): RTCSsrcConflictEvent;\n}\n\ninterface RTCStatsProvider extends EventTarget {\n    getStats(): PromiseLike<RTCStatsReport>;\n    msGetStats(): PromiseLike<RTCStatsReport>;\n}\n\ndeclare var RTCStatsProvider: {\n    prototype: RTCStatsProvider;\n    new(): RTCStatsProvider;\n}\n\ninterface Range {\n    readonly collapsed: boolean;\n    readonly commonAncestorContainer: Node;\n    readonly endContainer: Node;\n    readonly endOffset: number;\n    readonly startContainer: Node;\n    readonly startOffset: number;\n    cloneContents(): DocumentFragment;\n    cloneRange(): Range;\n    collapse(toStart: boolean): void;\n    compareBoundaryPoints(how: number, sourceRange: Range): number;\n    createContextualFragment(fragment: string): DocumentFragment;\n    deleteContents(): void;\n    detach(): void;\n    expand(Unit: string): boolean;\n    extractContents(): DocumentFragment;\n    getBoundingClientRect(): ClientRect;\n    getClientRects(): ClientRectList;\n    insertNode(newNode: Node): void;\n    selectNode(refNode: Node): void;\n    selectNodeContents(refNode: Node): void;\n    setEnd(refNode: Node, offset: number): void;\n    setEndAfter(refNode: Node): void;\n    setEndBefore(refNode: Node): void;\n    setStart(refNode: Node, offset: number): void;\n    setStartAfter(refNode: Node): void;\n    setStartBefore(refNode: Node): void;\n    surroundContents(newParent: Node): void;\n    toString(): string;\n    readonly END_TO_END: number;\n    readonly END_TO_START: number;\n    readonly START_TO_END: number;\n    readonly START_TO_START: number;\n}\n\ndeclare var Range: {\n    prototype: Range;\n    new(): Range;\n    readonly END_TO_END: number;\n    readonly END_TO_START: number;\n    readonly START_TO_END: number;\n    readonly START_TO_START: number;\n}\n\ninterface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\n    readonly target: SVGAnimatedString;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGAElement: {\n    prototype: SVGAElement;\n    new(): SVGAElement;\n}\n\ninterface SVGAngle {\n    readonly unitType: number;\n    value: number;\n    valueAsString: string;\n    valueInSpecifiedUnits: number;\n    convertToSpecifiedUnits(unitType: number): void;\n    newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void;\n    readonly SVG_ANGLETYPE_DEG: number;\n    readonly SVG_ANGLETYPE_GRAD: number;\n    readonly SVG_ANGLETYPE_RAD: number;\n    readonly SVG_ANGLETYPE_UNKNOWN: number;\n    readonly SVG_ANGLETYPE_UNSPECIFIED: number;\n}\n\ndeclare var SVGAngle: {\n    prototype: SVGAngle;\n    new(): SVGAngle;\n    readonly SVG_ANGLETYPE_DEG: number;\n    readonly SVG_ANGLETYPE_GRAD: number;\n    readonly SVG_ANGLETYPE_RAD: number;\n    readonly SVG_ANGLETYPE_UNKNOWN: number;\n    readonly SVG_ANGLETYPE_UNSPECIFIED: number;\n}\n\ninterface SVGAnimatedAngle {\n    readonly animVal: SVGAngle;\n    readonly baseVal: SVGAngle;\n}\n\ndeclare var SVGAnimatedAngle: {\n    prototype: SVGAnimatedAngle;\n    new(): SVGAnimatedAngle;\n}\n\ninterface SVGAnimatedBoolean {\n    readonly animVal: boolean;\n    baseVal: boolean;\n}\n\ndeclare var SVGAnimatedBoolean: {\n    prototype: SVGAnimatedBoolean;\n    new(): SVGAnimatedBoolean;\n}\n\ninterface SVGAnimatedEnumeration {\n    readonly animVal: number;\n    baseVal: number;\n}\n\ndeclare var SVGAnimatedEnumeration: {\n    prototype: SVGAnimatedEnumeration;\n    new(): SVGAnimatedEnumeration;\n}\n\ninterface SVGAnimatedInteger {\n    readonly animVal: number;\n    baseVal: number;\n}\n\ndeclare var SVGAnimatedInteger: {\n    prototype: SVGAnimatedInteger;\n    new(): SVGAnimatedInteger;\n}\n\ninterface SVGAnimatedLength {\n    readonly animVal: SVGLength;\n    readonly baseVal: SVGLength;\n}\n\ndeclare var SVGAnimatedLength: {\n    prototype: SVGAnimatedLength;\n    new(): SVGAnimatedLength;\n}\n\ninterface SVGAnimatedLengthList {\n    readonly animVal: SVGLengthList;\n    readonly baseVal: SVGLengthList;\n}\n\ndeclare var SVGAnimatedLengthList: {\n    prototype: SVGAnimatedLengthList;\n    new(): SVGAnimatedLengthList;\n}\n\ninterface SVGAnimatedNumber {\n    readonly animVal: number;\n    baseVal: number;\n}\n\ndeclare var SVGAnimatedNumber: {\n    prototype: SVGAnimatedNumber;\n    new(): SVGAnimatedNumber;\n}\n\ninterface SVGAnimatedNumberList {\n    readonly animVal: SVGNumberList;\n    readonly baseVal: SVGNumberList;\n}\n\ndeclare var SVGAnimatedNumberList: {\n    prototype: SVGAnimatedNumberList;\n    new(): SVGAnimatedNumberList;\n}\n\ninterface SVGAnimatedPreserveAspectRatio {\n    readonly animVal: SVGPreserveAspectRatio;\n    readonly baseVal: SVGPreserveAspectRatio;\n}\n\ndeclare var SVGAnimatedPreserveAspectRatio: {\n    prototype: SVGAnimatedPreserveAspectRatio;\n    new(): SVGAnimatedPreserveAspectRatio;\n}\n\ninterface SVGAnimatedRect {\n    readonly animVal: SVGRect;\n    readonly baseVal: SVGRect;\n}\n\ndeclare var SVGAnimatedRect: {\n    prototype: SVGAnimatedRect;\n    new(): SVGAnimatedRect;\n}\n\ninterface SVGAnimatedString {\n    readonly animVal: string;\n    baseVal: string;\n}\n\ndeclare var SVGAnimatedString: {\n    prototype: SVGAnimatedString;\n    new(): SVGAnimatedString;\n}\n\ninterface SVGAnimatedTransformList {\n    readonly animVal: SVGTransformList;\n    readonly baseVal: SVGTransformList;\n}\n\ndeclare var SVGAnimatedTransformList: {\n    prototype: SVGAnimatedTransformList;\n    new(): SVGAnimatedTransformList;\n}\n\ninterface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    readonly cx: SVGAnimatedLength;\n    readonly cy: SVGAnimatedLength;\n    readonly r: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGCircleElement: {\n    prototype: SVGCircleElement;\n    new(): SVGCircleElement;\n}\n\ninterface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes {\n    readonly clipPathUnits: SVGAnimatedEnumeration;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGClipPathElement: {\n    prototype: SVGClipPathElement;\n    new(): SVGClipPathElement;\n}\n\ninterface SVGComponentTransferFunctionElement extends SVGElement {\n    readonly amplitude: SVGAnimatedNumber;\n    readonly exponent: SVGAnimatedNumber;\n    readonly intercept: SVGAnimatedNumber;\n    readonly offset: SVGAnimatedNumber;\n    readonly slope: SVGAnimatedNumber;\n    readonly tableValues: SVGAnimatedNumberList;\n    readonly type: SVGAnimatedEnumeration;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGComponentTransferFunctionElement: {\n    prototype: SVGComponentTransferFunctionElement;\n    new(): SVGComponentTransferFunctionElement;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number;\n    readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number;\n}\n\ninterface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGDefsElement: {\n    prototype: SVGDefsElement;\n    new(): SVGDefsElement;\n}\n\ninterface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGDescElement: {\n    prototype: SVGDescElement;\n    new(): SVGDescElement;\n}\n\ninterface SVGElementEventMap extends ElementEventMap {\n    \"click\": MouseEvent;\n    \"dblclick\": MouseEvent;\n    \"focusin\": FocusEvent;\n    \"focusout\": FocusEvent;\n    \"load\": Event;\n    \"mousedown\": MouseEvent;\n    \"mousemove\": MouseEvent;\n    \"mouseout\": MouseEvent;\n    \"mouseover\": MouseEvent;\n    \"mouseup\": MouseEvent;\n}\n\ninterface SVGElement extends Element {\n    onclick: (this: SVGElement, ev: MouseEvent) => any;\n    ondblclick: (this: SVGElement, ev: MouseEvent) => any;\n    onfocusin: (this: SVGElement, ev: FocusEvent) => any;\n    onfocusout: (this: SVGElement, ev: FocusEvent) => any;\n    onload: (this: SVGElement, ev: Event) => any;\n    onmousedown: (this: SVGElement, ev: MouseEvent) => any;\n    onmousemove: (this: SVGElement, ev: MouseEvent) => any;\n    onmouseout: (this: SVGElement, ev: MouseEvent) => any;\n    onmouseover: (this: SVGElement, ev: MouseEvent) => any;\n    onmouseup: (this: SVGElement, ev: MouseEvent) => any;\n    readonly ownerSVGElement: SVGSVGElement;\n    readonly viewportElement: SVGElement;\n    xmlbase: string;\n    className: any;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGElement: {\n    prototype: SVGElement;\n    new(): SVGElement;\n}\n\ninterface SVGElementInstance extends EventTarget {\n    readonly childNodes: SVGElementInstanceList;\n    readonly correspondingElement: SVGElement;\n    readonly correspondingUseElement: SVGUseElement;\n    readonly firstChild: SVGElementInstance;\n    readonly lastChild: SVGElementInstance;\n    readonly nextSibling: SVGElementInstance;\n    readonly parentNode: SVGElementInstance;\n    readonly previousSibling: SVGElementInstance;\n}\n\ndeclare var SVGElementInstance: {\n    prototype: SVGElementInstance;\n    new(): SVGElementInstance;\n}\n\ninterface SVGElementInstanceList {\n    readonly length: number;\n    item(index: number): SVGElementInstance;\n}\n\ndeclare var SVGElementInstanceList: {\n    prototype: SVGElementInstanceList;\n    new(): SVGElementInstanceList;\n}\n\ninterface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    readonly cx: SVGAnimatedLength;\n    readonly cy: SVGAnimatedLength;\n    readonly rx: SVGAnimatedLength;\n    readonly ry: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGEllipseElement: {\n    prototype: SVGEllipseElement;\n    new(): SVGEllipseElement;\n}\n\ninterface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    readonly in2: SVGAnimatedString;\n    readonly mode: SVGAnimatedEnumeration;\n    readonly SVG_FEBLEND_MODE_COLOR: number;\n    readonly SVG_FEBLEND_MODE_COLOR_BURN: number;\n    readonly SVG_FEBLEND_MODE_COLOR_DODGE: number;\n    readonly SVG_FEBLEND_MODE_DARKEN: number;\n    readonly SVG_FEBLEND_MODE_DIFFERENCE: number;\n    readonly SVG_FEBLEND_MODE_EXCLUSION: number;\n    readonly SVG_FEBLEND_MODE_HARD_LIGHT: number;\n    readonly SVG_FEBLEND_MODE_HUE: number;\n    readonly SVG_FEBLEND_MODE_LIGHTEN: number;\n    readonly SVG_FEBLEND_MODE_LUMINOSITY: number;\n    readonly SVG_FEBLEND_MODE_MULTIPLY: number;\n    readonly SVG_FEBLEND_MODE_NORMAL: number;\n    readonly SVG_FEBLEND_MODE_OVERLAY: number;\n    readonly SVG_FEBLEND_MODE_SATURATION: number;\n    readonly SVG_FEBLEND_MODE_SCREEN: number;\n    readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number;\n    readonly SVG_FEBLEND_MODE_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEBlendElement: {\n    prototype: SVGFEBlendElement;\n    new(): SVGFEBlendElement;\n    readonly SVG_FEBLEND_MODE_COLOR: number;\n    readonly SVG_FEBLEND_MODE_COLOR_BURN: number;\n    readonly SVG_FEBLEND_MODE_COLOR_DODGE: number;\n    readonly SVG_FEBLEND_MODE_DARKEN: number;\n    readonly SVG_FEBLEND_MODE_DIFFERENCE: number;\n    readonly SVG_FEBLEND_MODE_EXCLUSION: number;\n    readonly SVG_FEBLEND_MODE_HARD_LIGHT: number;\n    readonly SVG_FEBLEND_MODE_HUE: number;\n    readonly SVG_FEBLEND_MODE_LIGHTEN: number;\n    readonly SVG_FEBLEND_MODE_LUMINOSITY: number;\n    readonly SVG_FEBLEND_MODE_MULTIPLY: number;\n    readonly SVG_FEBLEND_MODE_NORMAL: number;\n    readonly SVG_FEBLEND_MODE_OVERLAY: number;\n    readonly SVG_FEBLEND_MODE_SATURATION: number;\n    readonly SVG_FEBLEND_MODE_SCREEN: number;\n    readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number;\n    readonly SVG_FEBLEND_MODE_UNKNOWN: number;\n}\n\ninterface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    readonly type: SVGAnimatedEnumeration;\n    readonly values: SVGAnimatedNumberList;\n    readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number;\n    readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number;\n    readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number;\n    readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number;\n    readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEColorMatrixElement: {\n    prototype: SVGFEColorMatrixElement;\n    new(): SVGFEColorMatrixElement;\n    readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number;\n    readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number;\n    readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number;\n    readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number;\n    readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number;\n}\n\ninterface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEComponentTransferElement: {\n    prototype: SVGFEComponentTransferElement;\n    new(): SVGFEComponentTransferElement;\n}\n\ninterface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    readonly in2: SVGAnimatedString;\n    readonly k1: SVGAnimatedNumber;\n    readonly k2: SVGAnimatedNumber;\n    readonly k3: SVGAnimatedNumber;\n    readonly k4: SVGAnimatedNumber;\n    readonly operator: SVGAnimatedEnumeration;\n    readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_IN: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_OUT: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_OVER: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_XOR: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFECompositeElement: {\n    prototype: SVGFECompositeElement;\n    new(): SVGFECompositeElement;\n    readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_IN: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_OUT: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_OVER: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number;\n    readonly SVG_FECOMPOSITE_OPERATOR_XOR: number;\n}\n\ninterface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly bias: SVGAnimatedNumber;\n    readonly divisor: SVGAnimatedNumber;\n    readonly edgeMode: SVGAnimatedEnumeration;\n    readonly in1: SVGAnimatedString;\n    readonly kernelMatrix: SVGAnimatedNumberList;\n    readonly kernelUnitLengthX: SVGAnimatedNumber;\n    readonly kernelUnitLengthY: SVGAnimatedNumber;\n    readonly orderX: SVGAnimatedInteger;\n    readonly orderY: SVGAnimatedInteger;\n    readonly preserveAlpha: SVGAnimatedBoolean;\n    readonly targetX: SVGAnimatedInteger;\n    readonly targetY: SVGAnimatedInteger;\n    readonly SVG_EDGEMODE_DUPLICATE: number;\n    readonly SVG_EDGEMODE_NONE: number;\n    readonly SVG_EDGEMODE_UNKNOWN: number;\n    readonly SVG_EDGEMODE_WRAP: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEConvolveMatrixElement: {\n    prototype: SVGFEConvolveMatrixElement;\n    new(): SVGFEConvolveMatrixElement;\n    readonly SVG_EDGEMODE_DUPLICATE: number;\n    readonly SVG_EDGEMODE_NONE: number;\n    readonly SVG_EDGEMODE_UNKNOWN: number;\n    readonly SVG_EDGEMODE_WRAP: number;\n}\n\ninterface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly diffuseConstant: SVGAnimatedNumber;\n    readonly in1: SVGAnimatedString;\n    readonly kernelUnitLengthX: SVGAnimatedNumber;\n    readonly kernelUnitLengthY: SVGAnimatedNumber;\n    readonly surfaceScale: SVGAnimatedNumber;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEDiffuseLightingElement: {\n    prototype: SVGFEDiffuseLightingElement;\n    new(): SVGFEDiffuseLightingElement;\n}\n\ninterface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    readonly in2: SVGAnimatedString;\n    readonly scale: SVGAnimatedNumber;\n    readonly xChannelSelector: SVGAnimatedEnumeration;\n    readonly yChannelSelector: SVGAnimatedEnumeration;\n    readonly SVG_CHANNEL_A: number;\n    readonly SVG_CHANNEL_B: number;\n    readonly SVG_CHANNEL_G: number;\n    readonly SVG_CHANNEL_R: number;\n    readonly SVG_CHANNEL_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEDisplacementMapElement: {\n    prototype: SVGFEDisplacementMapElement;\n    new(): SVGFEDisplacementMapElement;\n    readonly SVG_CHANNEL_A: number;\n    readonly SVG_CHANNEL_B: number;\n    readonly SVG_CHANNEL_G: number;\n    readonly SVG_CHANNEL_R: number;\n    readonly SVG_CHANNEL_UNKNOWN: number;\n}\n\ninterface SVGFEDistantLightElement extends SVGElement {\n    readonly azimuth: SVGAnimatedNumber;\n    readonly elevation: SVGAnimatedNumber;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEDistantLightElement: {\n    prototype: SVGFEDistantLightElement;\n    new(): SVGFEDistantLightElement;\n}\n\ninterface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEFloodElement: {\n    prototype: SVGFEFloodElement;\n    new(): SVGFEFloodElement;\n}\n\ninterface SVGFEFuncAElement extends SVGComponentTransferFunctionElement {\n}\n\ndeclare var SVGFEFuncAElement: {\n    prototype: SVGFEFuncAElement;\n    new(): SVGFEFuncAElement;\n}\n\ninterface SVGFEFuncBElement extends SVGComponentTransferFunctionElement {\n}\n\ndeclare var SVGFEFuncBElement: {\n    prototype: SVGFEFuncBElement;\n    new(): SVGFEFuncBElement;\n}\n\ninterface SVGFEFuncGElement extends SVGComponentTransferFunctionElement {\n}\n\ndeclare var SVGFEFuncGElement: {\n    prototype: SVGFEFuncGElement;\n    new(): SVGFEFuncGElement;\n}\n\ninterface SVGFEFuncRElement extends SVGComponentTransferFunctionElement {\n}\n\ndeclare var SVGFEFuncRElement: {\n    prototype: SVGFEFuncRElement;\n    new(): SVGFEFuncRElement;\n}\n\ninterface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    readonly stdDeviationX: SVGAnimatedNumber;\n    readonly stdDeviationY: SVGAnimatedNumber;\n    setStdDeviation(stdDeviationX: number, stdDeviationY: number): void;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEGaussianBlurElement: {\n    prototype: SVGFEGaussianBlurElement;\n    new(): SVGFEGaussianBlurElement;\n}\n\ninterface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired {\n    readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEImageElement: {\n    prototype: SVGFEImageElement;\n    new(): SVGFEImageElement;\n}\n\ninterface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEMergeElement: {\n    prototype: SVGFEMergeElement;\n    new(): SVGFEMergeElement;\n}\n\ninterface SVGFEMergeNodeElement extends SVGElement {\n    readonly in1: SVGAnimatedString;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEMergeNodeElement: {\n    prototype: SVGFEMergeNodeElement;\n    new(): SVGFEMergeNodeElement;\n}\n\ninterface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    readonly operator: SVGAnimatedEnumeration;\n    readonly radiusX: SVGAnimatedNumber;\n    readonly radiusY: SVGAnimatedNumber;\n    readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number;\n    readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number;\n    readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEMorphologyElement: {\n    prototype: SVGFEMorphologyElement;\n    new(): SVGFEMorphologyElement;\n    readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number;\n    readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number;\n    readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number;\n}\n\ninterface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly dx: SVGAnimatedNumber;\n    readonly dy: SVGAnimatedNumber;\n    readonly in1: SVGAnimatedString;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEOffsetElement: {\n    prototype: SVGFEOffsetElement;\n    new(): SVGFEOffsetElement;\n}\n\ninterface SVGFEPointLightElement extends SVGElement {\n    readonly x: SVGAnimatedNumber;\n    readonly y: SVGAnimatedNumber;\n    readonly z: SVGAnimatedNumber;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEPointLightElement: {\n    prototype: SVGFEPointLightElement;\n    new(): SVGFEPointLightElement;\n}\n\ninterface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    readonly kernelUnitLengthX: SVGAnimatedNumber;\n    readonly kernelUnitLengthY: SVGAnimatedNumber;\n    readonly specularConstant: SVGAnimatedNumber;\n    readonly specularExponent: SVGAnimatedNumber;\n    readonly surfaceScale: SVGAnimatedNumber;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFESpecularLightingElement: {\n    prototype: SVGFESpecularLightingElement;\n    new(): SVGFESpecularLightingElement;\n}\n\ninterface SVGFESpotLightElement extends SVGElement {\n    readonly limitingConeAngle: SVGAnimatedNumber;\n    readonly pointsAtX: SVGAnimatedNumber;\n    readonly pointsAtY: SVGAnimatedNumber;\n    readonly pointsAtZ: SVGAnimatedNumber;\n    readonly specularExponent: SVGAnimatedNumber;\n    readonly x: SVGAnimatedNumber;\n    readonly y: SVGAnimatedNumber;\n    readonly z: SVGAnimatedNumber;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFESpotLightElement: {\n    prototype: SVGFESpotLightElement;\n    new(): SVGFESpotLightElement;\n}\n\ninterface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly in1: SVGAnimatedString;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFETileElement: {\n    prototype: SVGFETileElement;\n    new(): SVGFETileElement;\n}\n\ninterface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n    readonly baseFrequencyX: SVGAnimatedNumber;\n    readonly baseFrequencyY: SVGAnimatedNumber;\n    readonly numOctaves: SVGAnimatedInteger;\n    readonly seed: SVGAnimatedNumber;\n    readonly stitchTiles: SVGAnimatedEnumeration;\n    readonly type: SVGAnimatedEnumeration;\n    readonly SVG_STITCHTYPE_NOSTITCH: number;\n    readonly SVG_STITCHTYPE_STITCH: number;\n    readonly SVG_STITCHTYPE_UNKNOWN: number;\n    readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number;\n    readonly SVG_TURBULENCE_TYPE_TURBULENCE: number;\n    readonly SVG_TURBULENCE_TYPE_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFETurbulenceElement: {\n    prototype: SVGFETurbulenceElement;\n    new(): SVGFETurbulenceElement;\n    readonly SVG_STITCHTYPE_NOSTITCH: number;\n    readonly SVG_STITCHTYPE_STITCH: number;\n    readonly SVG_STITCHTYPE_UNKNOWN: number;\n    readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number;\n    readonly SVG_TURBULENCE_TYPE_TURBULENCE: number;\n    readonly SVG_TURBULENCE_TYPE_UNKNOWN: number;\n}\n\ninterface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired {\n    readonly filterResX: SVGAnimatedInteger;\n    readonly filterResY: SVGAnimatedInteger;\n    readonly filterUnits: SVGAnimatedEnumeration;\n    readonly height: SVGAnimatedLength;\n    readonly primitiveUnits: SVGAnimatedEnumeration;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n    setFilterRes(filterResX: number, filterResY: number): void;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFilterElement: {\n    prototype: SVGFilterElement;\n    new(): SVGFilterElement;\n}\n\ninterface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    readonly height: SVGAnimatedLength;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGForeignObjectElement: {\n    prototype: SVGForeignObjectElement;\n    new(): SVGForeignObjectElement;\n}\n\ninterface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGGElement: {\n    prototype: SVGGElement;\n    new(): SVGGElement;\n}\n\ninterface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes {\n    readonly gradientTransform: SVGAnimatedTransformList;\n    readonly gradientUnits: SVGAnimatedEnumeration;\n    readonly spreadMethod: SVGAnimatedEnumeration;\n    readonly SVG_SPREADMETHOD_PAD: number;\n    readonly SVG_SPREADMETHOD_REFLECT: number;\n    readonly SVG_SPREADMETHOD_REPEAT: number;\n    readonly SVG_SPREADMETHOD_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGGradientElement: {\n    prototype: SVGGradientElement;\n    new(): SVGGradientElement;\n    readonly SVG_SPREADMETHOD_PAD: number;\n    readonly SVG_SPREADMETHOD_REFLECT: number;\n    readonly SVG_SPREADMETHOD_REPEAT: number;\n    readonly SVG_SPREADMETHOD_UNKNOWN: number;\n}\n\ninterface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\n    readonly height: SVGAnimatedLength;\n    readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGImageElement: {\n    prototype: SVGImageElement;\n    new(): SVGImageElement;\n}\n\ninterface SVGLength {\n    readonly unitType: number;\n    value: number;\n    valueAsString: string;\n    valueInSpecifiedUnits: number;\n    convertToSpecifiedUnits(unitType: number): void;\n    newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void;\n    readonly SVG_LENGTHTYPE_CM: number;\n    readonly SVG_LENGTHTYPE_EMS: number;\n    readonly SVG_LENGTHTYPE_EXS: number;\n    readonly SVG_LENGTHTYPE_IN: number;\n    readonly SVG_LENGTHTYPE_MM: number;\n    readonly SVG_LENGTHTYPE_NUMBER: number;\n    readonly SVG_LENGTHTYPE_PC: number;\n    readonly SVG_LENGTHTYPE_PERCENTAGE: number;\n    readonly SVG_LENGTHTYPE_PT: number;\n    readonly SVG_LENGTHTYPE_PX: number;\n    readonly SVG_LENGTHTYPE_UNKNOWN: number;\n}\n\ndeclare var SVGLength: {\n    prototype: SVGLength;\n    new(): SVGLength;\n    readonly SVG_LENGTHTYPE_CM: number;\n    readonly SVG_LENGTHTYPE_EMS: number;\n    readonly SVG_LENGTHTYPE_EXS: number;\n    readonly SVG_LENGTHTYPE_IN: number;\n    readonly SVG_LENGTHTYPE_MM: number;\n    readonly SVG_LENGTHTYPE_NUMBER: number;\n    readonly SVG_LENGTHTYPE_PC: number;\n    readonly SVG_LENGTHTYPE_PERCENTAGE: number;\n    readonly SVG_LENGTHTYPE_PT: number;\n    readonly SVG_LENGTHTYPE_PX: number;\n    readonly SVG_LENGTHTYPE_UNKNOWN: number;\n}\n\ninterface SVGLengthList {\n    readonly numberOfItems: number;\n    appendItem(newItem: SVGLength): SVGLength;\n    clear(): void;\n    getItem(index: number): SVGLength;\n    initialize(newItem: SVGLength): SVGLength;\n    insertItemBefore(newItem: SVGLength, index: number): SVGLength;\n    removeItem(index: number): SVGLength;\n    replaceItem(newItem: SVGLength, index: number): SVGLength;\n}\n\ndeclare var SVGLengthList: {\n    prototype: SVGLengthList;\n    new(): SVGLengthList;\n}\n\ninterface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    readonly x1: SVGAnimatedLength;\n    readonly x2: SVGAnimatedLength;\n    readonly y1: SVGAnimatedLength;\n    readonly y2: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGLineElement: {\n    prototype: SVGLineElement;\n    new(): SVGLineElement;\n}\n\ninterface SVGLinearGradientElement extends SVGGradientElement {\n    readonly x1: SVGAnimatedLength;\n    readonly x2: SVGAnimatedLength;\n    readonly y1: SVGAnimatedLength;\n    readonly y2: SVGAnimatedLength;\n}\n\ndeclare var SVGLinearGradientElement: {\n    prototype: SVGLinearGradientElement;\n    new(): SVGLinearGradientElement;\n}\n\ninterface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox {\n    readonly markerHeight: SVGAnimatedLength;\n    readonly markerUnits: SVGAnimatedEnumeration;\n    readonly markerWidth: SVGAnimatedLength;\n    readonly orientAngle: SVGAnimatedAngle;\n    readonly orientType: SVGAnimatedEnumeration;\n    readonly refX: SVGAnimatedLength;\n    readonly refY: SVGAnimatedLength;\n    setOrientToAngle(angle: SVGAngle): void;\n    setOrientToAuto(): void;\n    readonly SVG_MARKERUNITS_STROKEWIDTH: number;\n    readonly SVG_MARKERUNITS_UNKNOWN: number;\n    readonly SVG_MARKERUNITS_USERSPACEONUSE: number;\n    readonly SVG_MARKER_ORIENT_ANGLE: number;\n    readonly SVG_MARKER_ORIENT_AUTO: number;\n    readonly SVG_MARKER_ORIENT_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGMarkerElement: {\n    prototype: SVGMarkerElement;\n    new(): SVGMarkerElement;\n    readonly SVG_MARKERUNITS_STROKEWIDTH: number;\n    readonly SVG_MARKERUNITS_UNKNOWN: number;\n    readonly SVG_MARKERUNITS_USERSPACEONUSE: number;\n    readonly SVG_MARKER_ORIENT_ANGLE: number;\n    readonly SVG_MARKER_ORIENT_AUTO: number;\n    readonly SVG_MARKER_ORIENT_UNKNOWN: number;\n}\n\ninterface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes {\n    readonly height: SVGAnimatedLength;\n    readonly maskContentUnits: SVGAnimatedEnumeration;\n    readonly maskUnits: SVGAnimatedEnumeration;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGMaskElement: {\n    prototype: SVGMaskElement;\n    new(): SVGMaskElement;\n}\n\ninterface SVGMatrix {\n    a: number;\n    b: number;\n    c: number;\n    d: number;\n    e: number;\n    f: number;\n    flipX(): SVGMatrix;\n    flipY(): SVGMatrix;\n    inverse(): SVGMatrix;\n    multiply(secondMatrix: SVGMatrix): SVGMatrix;\n    rotate(angle: number): SVGMatrix;\n    rotateFromVector(x: number, y: number): SVGMatrix;\n    scale(scaleFactor: number): SVGMatrix;\n    scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix;\n    skewX(angle: number): SVGMatrix;\n    skewY(angle: number): SVGMatrix;\n    translate(x: number, y: number): SVGMatrix;\n}\n\ndeclare var SVGMatrix: {\n    prototype: SVGMatrix;\n    new(): SVGMatrix;\n}\n\ninterface SVGMetadataElement extends SVGElement {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGMetadataElement: {\n    prototype: SVGMetadataElement;\n    new(): SVGMetadataElement;\n}\n\ninterface SVGNumber {\n    value: number;\n}\n\ndeclare var SVGNumber: {\n    prototype: SVGNumber;\n    new(): SVGNumber;\n}\n\ninterface SVGNumberList {\n    readonly numberOfItems: number;\n    appendItem(newItem: SVGNumber): SVGNumber;\n    clear(): void;\n    getItem(index: number): SVGNumber;\n    initialize(newItem: SVGNumber): SVGNumber;\n    insertItemBefore(newItem: SVGNumber, index: number): SVGNumber;\n    removeItem(index: number): SVGNumber;\n    replaceItem(newItem: SVGNumber, index: number): SVGNumber;\n}\n\ndeclare var SVGNumberList: {\n    prototype: SVGNumberList;\n    new(): SVGNumberList;\n}\n\ninterface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPathData {\n    createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs;\n    createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel;\n    createSVGPathSegClosePath(): SVGPathSegClosePath;\n    createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs;\n    createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel;\n    createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs;\n    createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel;\n    createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs;\n    createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel;\n    createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs;\n    createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel;\n    createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs;\n    createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs;\n    createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel;\n    createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel;\n    createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs;\n    createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel;\n    createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs;\n    createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel;\n    getPathSegAtLength(distance: number): number;\n    getPointAtLength(distance: number): SVGPoint;\n    getTotalLength(): number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGPathElement: {\n    prototype: SVGPathElement;\n    new(): SVGPathElement;\n}\n\ninterface SVGPathSeg {\n    readonly pathSegType: number;\n    readonly pathSegTypeAsLetter: string;\n    readonly PATHSEG_ARC_ABS: number;\n    readonly PATHSEG_ARC_REL: number;\n    readonly PATHSEG_CLOSEPATH: number;\n    readonly PATHSEG_CURVETO_CUBIC_ABS: number;\n    readonly PATHSEG_CURVETO_CUBIC_REL: number;\n    readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number;\n    readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number;\n    readonly PATHSEG_CURVETO_QUADRATIC_ABS: number;\n    readonly PATHSEG_CURVETO_QUADRATIC_REL: number;\n    readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number;\n    readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number;\n    readonly PATHSEG_LINETO_ABS: number;\n    readonly PATHSEG_LINETO_HORIZONTAL_ABS: number;\n    readonly PATHSEG_LINETO_HORIZONTAL_REL: number;\n    readonly PATHSEG_LINETO_REL: number;\n    readonly PATHSEG_LINETO_VERTICAL_ABS: number;\n    readonly PATHSEG_LINETO_VERTICAL_REL: number;\n    readonly PATHSEG_MOVETO_ABS: number;\n    readonly PATHSEG_MOVETO_REL: number;\n    readonly PATHSEG_UNKNOWN: number;\n}\n\ndeclare var SVGPathSeg: {\n    prototype: SVGPathSeg;\n    new(): SVGPathSeg;\n    readonly PATHSEG_ARC_ABS: number;\n    readonly PATHSEG_ARC_REL: number;\n    readonly PATHSEG_CLOSEPATH: number;\n    readonly PATHSEG_CURVETO_CUBIC_ABS: number;\n    readonly PATHSEG_CURVETO_CUBIC_REL: number;\n    readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number;\n    readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number;\n    readonly PATHSEG_CURVETO_QUADRATIC_ABS: number;\n    readonly PATHSEG_CURVETO_QUADRATIC_REL: number;\n    readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number;\n    readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number;\n    readonly PATHSEG_LINETO_ABS: number;\n    readonly PATHSEG_LINETO_HORIZONTAL_ABS: number;\n    readonly PATHSEG_LINETO_HORIZONTAL_REL: number;\n    readonly PATHSEG_LINETO_REL: number;\n    readonly PATHSEG_LINETO_VERTICAL_ABS: number;\n    readonly PATHSEG_LINETO_VERTICAL_REL: number;\n    readonly PATHSEG_MOVETO_ABS: number;\n    readonly PATHSEG_MOVETO_REL: number;\n    readonly PATHSEG_UNKNOWN: number;\n}\n\ninterface SVGPathSegArcAbs extends SVGPathSeg {\n    angle: number;\n    largeArcFlag: boolean;\n    r1: number;\n    r2: number;\n    sweepFlag: boolean;\n    x: number;\n    y: number;\n}\n\ndeclare var SVGPathSegArcAbs: {\n    prototype: SVGPathSegArcAbs;\n    new(): SVGPathSegArcAbs;\n}\n\ninterface SVGPathSegArcRel extends SVGPathSeg {\n    angle: number;\n    largeArcFlag: boolean;\n    r1: number;\n    r2: number;\n    sweepFlag: boolean;\n    x: number;\n    y: number;\n}\n\ndeclare var SVGPathSegArcRel: {\n    prototype: SVGPathSegArcRel;\n    new(): SVGPathSegArcRel;\n}\n\ninterface SVGPathSegClosePath extends SVGPathSeg {\n}\n\ndeclare var SVGPathSegClosePath: {\n    prototype: SVGPathSegClosePath;\n    new(): SVGPathSegClosePath;\n}\n\ninterface SVGPathSegCurvetoCubicAbs extends SVGPathSeg {\n    x: number;\n    x1: number;\n    x2: number;\n    y: number;\n    y1: number;\n    y2: number;\n}\n\ndeclare var SVGPathSegCurvetoCubicAbs: {\n    prototype: SVGPathSegCurvetoCubicAbs;\n    new(): SVGPathSegCurvetoCubicAbs;\n}\n\ninterface SVGPathSegCurvetoCubicRel extends SVGPathSeg {\n    x: number;\n    x1: number;\n    x2: number;\n    y: number;\n    y1: number;\n    y2: number;\n}\n\ndeclare var SVGPathSegCurvetoCubicRel: {\n    prototype: SVGPathSegCurvetoCubicRel;\n    new(): SVGPathSegCurvetoCubicRel;\n}\n\ninterface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg {\n    x: number;\n    x2: number;\n    y: number;\n    y2: number;\n}\n\ndeclare var SVGPathSegCurvetoCubicSmoothAbs: {\n    prototype: SVGPathSegCurvetoCubicSmoothAbs;\n    new(): SVGPathSegCurvetoCubicSmoothAbs;\n}\n\ninterface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg {\n    x: number;\n    x2: number;\n    y: number;\n    y2: number;\n}\n\ndeclare var SVGPathSegCurvetoCubicSmoothRel: {\n    prototype: SVGPathSegCurvetoCubicSmoothRel;\n    new(): SVGPathSegCurvetoCubicSmoothRel;\n}\n\ninterface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg {\n    x: number;\n    x1: number;\n    y: number;\n    y1: number;\n}\n\ndeclare var SVGPathSegCurvetoQuadraticAbs: {\n    prototype: SVGPathSegCurvetoQuadraticAbs;\n    new(): SVGPathSegCurvetoQuadraticAbs;\n}\n\ninterface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg {\n    x: number;\n    x1: number;\n    y: number;\n    y1: number;\n}\n\ndeclare var SVGPathSegCurvetoQuadraticRel: {\n    prototype: SVGPathSegCurvetoQuadraticRel;\n    new(): SVGPathSegCurvetoQuadraticRel;\n}\n\ninterface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg {\n    x: number;\n    y: number;\n}\n\ndeclare var SVGPathSegCurvetoQuadraticSmoothAbs: {\n    prototype: SVGPathSegCurvetoQuadraticSmoothAbs;\n    new(): SVGPathSegCurvetoQuadraticSmoothAbs;\n}\n\ninterface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg {\n    x: number;\n    y: number;\n}\n\ndeclare var SVGPathSegCurvetoQuadraticSmoothRel: {\n    prototype: SVGPathSegCurvetoQuadraticSmoothRel;\n    new(): SVGPathSegCurvetoQuadraticSmoothRel;\n}\n\ninterface SVGPathSegLinetoAbs extends SVGPathSeg {\n    x: number;\n    y: number;\n}\n\ndeclare var SVGPathSegLinetoAbs: {\n    prototype: SVGPathSegLinetoAbs;\n    new(): SVGPathSegLinetoAbs;\n}\n\ninterface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg {\n    x: number;\n}\n\ndeclare var SVGPathSegLinetoHorizontalAbs: {\n    prototype: SVGPathSegLinetoHorizontalAbs;\n    new(): SVGPathSegLinetoHorizontalAbs;\n}\n\ninterface SVGPathSegLinetoHorizontalRel extends SVGPathSeg {\n    x: number;\n}\n\ndeclare var SVGPathSegLinetoHorizontalRel: {\n    prototype: SVGPathSegLinetoHorizontalRel;\n    new(): SVGPathSegLinetoHorizontalRel;\n}\n\ninterface SVGPathSegLinetoRel extends SVGPathSeg {\n    x: number;\n    y: number;\n}\n\ndeclare var SVGPathSegLinetoRel: {\n    prototype: SVGPathSegLinetoRel;\n    new(): SVGPathSegLinetoRel;\n}\n\ninterface SVGPathSegLinetoVerticalAbs extends SVGPathSeg {\n    y: number;\n}\n\ndeclare var SVGPathSegLinetoVerticalAbs: {\n    prototype: SVGPathSegLinetoVerticalAbs;\n    new(): SVGPathSegLinetoVerticalAbs;\n}\n\ninterface SVGPathSegLinetoVerticalRel extends SVGPathSeg {\n    y: number;\n}\n\ndeclare var SVGPathSegLinetoVerticalRel: {\n    prototype: SVGPathSegLinetoVerticalRel;\n    new(): SVGPathSegLinetoVerticalRel;\n}\n\ninterface SVGPathSegList {\n    readonly numberOfItems: number;\n    appendItem(newItem: SVGPathSeg): SVGPathSeg;\n    clear(): void;\n    getItem(index: number): SVGPathSeg;\n    initialize(newItem: SVGPathSeg): SVGPathSeg;\n    insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg;\n    removeItem(index: number): SVGPathSeg;\n    replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg;\n}\n\ndeclare var SVGPathSegList: {\n    prototype: SVGPathSegList;\n    new(): SVGPathSegList;\n}\n\ninterface SVGPathSegMovetoAbs extends SVGPathSeg {\n    x: number;\n    y: number;\n}\n\ndeclare var SVGPathSegMovetoAbs: {\n    prototype: SVGPathSegMovetoAbs;\n    new(): SVGPathSegMovetoAbs;\n}\n\ninterface SVGPathSegMovetoRel extends SVGPathSeg {\n    x: number;\n    y: number;\n}\n\ndeclare var SVGPathSegMovetoRel: {\n    prototype: SVGPathSegMovetoRel;\n    new(): SVGPathSegMovetoRel;\n}\n\ninterface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes {\n    readonly height: SVGAnimatedLength;\n    readonly patternContentUnits: SVGAnimatedEnumeration;\n    readonly patternTransform: SVGAnimatedTransformList;\n    readonly patternUnits: SVGAnimatedEnumeration;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGPatternElement: {\n    prototype: SVGPatternElement;\n    new(): SVGPatternElement;\n}\n\ninterface SVGPoint {\n    x: number;\n    y: number;\n    matrixTransform(matrix: SVGMatrix): SVGPoint;\n}\n\ndeclare var SVGPoint: {\n    prototype: SVGPoint;\n    new(): SVGPoint;\n}\n\ninterface SVGPointList {\n    readonly numberOfItems: number;\n    appendItem(newItem: SVGPoint): SVGPoint;\n    clear(): void;\n    getItem(index: number): SVGPoint;\n    initialize(newItem: SVGPoint): SVGPoint;\n    insertItemBefore(newItem: SVGPoint, index: number): SVGPoint;\n    removeItem(index: number): SVGPoint;\n    replaceItem(newItem: SVGPoint, index: number): SVGPoint;\n}\n\ndeclare var SVGPointList: {\n    prototype: SVGPointList;\n    new(): SVGPointList;\n}\n\ninterface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGPolygonElement: {\n    prototype: SVGPolygonElement;\n    new(): SVGPolygonElement;\n}\n\ninterface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGPolylineElement: {\n    prototype: SVGPolylineElement;\n    new(): SVGPolylineElement;\n}\n\ninterface SVGPreserveAspectRatio {\n    align: number;\n    meetOrSlice: number;\n    readonly SVG_MEETORSLICE_MEET: number;\n    readonly SVG_MEETORSLICE_SLICE: number;\n    readonly SVG_MEETORSLICE_UNKNOWN: number;\n    readonly SVG_PRESERVEASPECTRATIO_NONE: number;\n    readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number;\n}\n\ndeclare var SVGPreserveAspectRatio: {\n    prototype: SVGPreserveAspectRatio;\n    new(): SVGPreserveAspectRatio;\n    readonly SVG_MEETORSLICE_MEET: number;\n    readonly SVG_MEETORSLICE_SLICE: number;\n    readonly SVG_MEETORSLICE_UNKNOWN: number;\n    readonly SVG_PRESERVEASPECTRATIO_NONE: number;\n    readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number;\n    readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number;\n}\n\ninterface SVGRadialGradientElement extends SVGGradientElement {\n    readonly cx: SVGAnimatedLength;\n    readonly cy: SVGAnimatedLength;\n    readonly fx: SVGAnimatedLength;\n    readonly fy: SVGAnimatedLength;\n    readonly r: SVGAnimatedLength;\n}\n\ndeclare var SVGRadialGradientElement: {\n    prototype: SVGRadialGradientElement;\n    new(): SVGRadialGradientElement;\n}\n\ninterface SVGRect {\n    height: number;\n    width: number;\n    x: number;\n    y: number;\n}\n\ndeclare var SVGRect: {\n    prototype: SVGRect;\n    new(): SVGRect;\n}\n\ninterface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    readonly height: SVGAnimatedLength;\n    readonly rx: SVGAnimatedLength;\n    readonly ry: SVGAnimatedLength;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGRectElement: {\n    prototype: SVGRectElement;\n    new(): SVGRectElement;\n}\n\ninterface SVGSVGElementEventMap extends SVGElementEventMap {\n    \"SVGAbort\": Event;\n    \"SVGError\": Event;\n    \"resize\": UIEvent;\n    \"scroll\": UIEvent;\n    \"SVGUnload\": Event;\n    \"SVGZoom\": SVGZoomEvent;\n}\n\ninterface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {\n    contentScriptType: string;\n    contentStyleType: string;\n    currentScale: number;\n    readonly currentTranslate: SVGPoint;\n    readonly height: SVGAnimatedLength;\n    onabort: (this: SVGSVGElement, ev: Event) => any;\n    onerror: (this: SVGSVGElement, ev: Event) => any;\n    onresize: (this: SVGSVGElement, ev: UIEvent) => any;\n    onscroll: (this: SVGSVGElement, ev: UIEvent) => any;\n    onunload: (this: SVGSVGElement, ev: Event) => any;\n    onzoom: (this: SVGSVGElement, ev: SVGZoomEvent) => any;\n    readonly pixelUnitToMillimeterX: number;\n    readonly pixelUnitToMillimeterY: number;\n    readonly screenPixelToMillimeterX: number;\n    readonly screenPixelToMillimeterY: number;\n    readonly viewport: SVGRect;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n    checkEnclosure(element: SVGElement, rect: SVGRect): boolean;\n    checkIntersection(element: SVGElement, rect: SVGRect): boolean;\n    createSVGAngle(): SVGAngle;\n    createSVGLength(): SVGLength;\n    createSVGMatrix(): SVGMatrix;\n    createSVGNumber(): SVGNumber;\n    createSVGPoint(): SVGPoint;\n    createSVGRect(): SVGRect;\n    createSVGTransform(): SVGTransform;\n    createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform;\n    deselectAll(): void;\n    forceRedraw(): void;\n    getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\n    getCurrentTime(): number;\n    getElementById(elementId: string): Element;\n    getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;\n    getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;\n    pauseAnimations(): void;\n    setCurrentTime(seconds: number): void;\n    suspendRedraw(maxWaitMilliseconds: number): number;\n    unpauseAnimations(): void;\n    unsuspendRedraw(suspendHandleID: number): void;\n    unsuspendRedrawAll(): void;\n    addEventListener<K extends keyof SVGSVGElementEventMap>(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGSVGElement: {\n    prototype: SVGSVGElement;\n    new(): SVGSVGElement;\n}\n\ninterface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference {\n    type: string;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGScriptElement: {\n    prototype: SVGScriptElement;\n    new(): SVGScriptElement;\n}\n\ninterface SVGStopElement extends SVGElement, SVGStylable {\n    readonly offset: SVGAnimatedNumber;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGStopElement: {\n    prototype: SVGStopElement;\n    new(): SVGStopElement;\n}\n\ninterface SVGStringList {\n    readonly numberOfItems: number;\n    appendItem(newItem: string): string;\n    clear(): void;\n    getItem(index: number): string;\n    initialize(newItem: string): string;\n    insertItemBefore(newItem: string, index: number): string;\n    removeItem(index: number): string;\n    replaceItem(newItem: string, index: number): string;\n}\n\ndeclare var SVGStringList: {\n    prototype: SVGStringList;\n    new(): SVGStringList;\n}\n\ninterface SVGStyleElement extends SVGElement, SVGLangSpace {\n    disabled: boolean;\n    media: string;\n    title: string;\n    type: string;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGStyleElement: {\n    prototype: SVGStyleElement;\n    new(): SVGStyleElement;\n}\n\ninterface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGSwitchElement: {\n    prototype: SVGSwitchElement;\n    new(): SVGSwitchElement;\n}\n\ninterface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGSymbolElement: {\n    prototype: SVGSymbolElement;\n    new(): SVGSymbolElement;\n}\n\ninterface SVGTSpanElement extends SVGTextPositioningElement {\n}\n\ndeclare var SVGTSpanElement: {\n    prototype: SVGTSpanElement;\n    new(): SVGTSpanElement;\n}\n\ninterface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n    readonly lengthAdjust: SVGAnimatedEnumeration;\n    readonly textLength: SVGAnimatedLength;\n    getCharNumAtPosition(point: SVGPoint): number;\n    getComputedTextLength(): number;\n    getEndPositionOfChar(charnum: number): SVGPoint;\n    getExtentOfChar(charnum: number): SVGRect;\n    getNumberOfChars(): number;\n    getRotationOfChar(charnum: number): number;\n    getStartPositionOfChar(charnum: number): SVGPoint;\n    getSubStringLength(charnum: number, nchars: number): number;\n    selectSubString(charnum: number, nchars: number): void;\n    readonly LENGTHADJUST_SPACING: number;\n    readonly LENGTHADJUST_SPACINGANDGLYPHS: number;\n    readonly LENGTHADJUST_UNKNOWN: number;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGTextContentElement: {\n    prototype: SVGTextContentElement;\n    new(): SVGTextContentElement;\n    readonly LENGTHADJUST_SPACING: number;\n    readonly LENGTHADJUST_SPACINGANDGLYPHS: number;\n    readonly LENGTHADJUST_UNKNOWN: number;\n}\n\ninterface SVGTextElement extends SVGTextPositioningElement, SVGTransformable {\n}\n\ndeclare var SVGTextElement: {\n    prototype: SVGTextElement;\n    new(): SVGTextElement;\n}\n\ninterface SVGTextPathElement extends SVGTextContentElement, SVGURIReference {\n    readonly method: SVGAnimatedEnumeration;\n    readonly spacing: SVGAnimatedEnumeration;\n    readonly startOffset: SVGAnimatedLength;\n    readonly TEXTPATH_METHODTYPE_ALIGN: number;\n    readonly TEXTPATH_METHODTYPE_STRETCH: number;\n    readonly TEXTPATH_METHODTYPE_UNKNOWN: number;\n    readonly TEXTPATH_SPACINGTYPE_AUTO: number;\n    readonly TEXTPATH_SPACINGTYPE_EXACT: number;\n    readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number;\n}\n\ndeclare var SVGTextPathElement: {\n    prototype: SVGTextPathElement;\n    new(): SVGTextPathElement;\n    readonly TEXTPATH_METHODTYPE_ALIGN: number;\n    readonly TEXTPATH_METHODTYPE_STRETCH: number;\n    readonly TEXTPATH_METHODTYPE_UNKNOWN: number;\n    readonly TEXTPATH_SPACINGTYPE_AUTO: number;\n    readonly TEXTPATH_SPACINGTYPE_EXACT: number;\n    readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number;\n}\n\ninterface SVGTextPositioningElement extends SVGTextContentElement {\n    readonly dx: SVGAnimatedLengthList;\n    readonly dy: SVGAnimatedLengthList;\n    readonly rotate: SVGAnimatedNumberList;\n    readonly x: SVGAnimatedLengthList;\n    readonly y: SVGAnimatedLengthList;\n}\n\ndeclare var SVGTextPositioningElement: {\n    prototype: SVGTextPositioningElement;\n    new(): SVGTextPositioningElement;\n}\n\ninterface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace {\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGTitleElement: {\n    prototype: SVGTitleElement;\n    new(): SVGTitleElement;\n}\n\ninterface SVGTransform {\n    readonly angle: number;\n    readonly matrix: SVGMatrix;\n    readonly type: number;\n    setMatrix(matrix: SVGMatrix): void;\n    setRotate(angle: number, cx: number, cy: number): void;\n    setScale(sx: number, sy: number): void;\n    setSkewX(angle: number): void;\n    setSkewY(angle: number): void;\n    setTranslate(tx: number, ty: number): void;\n    readonly SVG_TRANSFORM_MATRIX: number;\n    readonly SVG_TRANSFORM_ROTATE: number;\n    readonly SVG_TRANSFORM_SCALE: number;\n    readonly SVG_TRANSFORM_SKEWX: number;\n    readonly SVG_TRANSFORM_SKEWY: number;\n    readonly SVG_TRANSFORM_TRANSLATE: number;\n    readonly SVG_TRANSFORM_UNKNOWN: number;\n}\n\ndeclare var SVGTransform: {\n    prototype: SVGTransform;\n    new(): SVGTransform;\n    readonly SVG_TRANSFORM_MATRIX: number;\n    readonly SVG_TRANSFORM_ROTATE: number;\n    readonly SVG_TRANSFORM_SCALE: number;\n    readonly SVG_TRANSFORM_SKEWX: number;\n    readonly SVG_TRANSFORM_SKEWY: number;\n    readonly SVG_TRANSFORM_TRANSLATE: number;\n    readonly SVG_TRANSFORM_UNKNOWN: number;\n}\n\ninterface SVGTransformList {\n    readonly numberOfItems: number;\n    appendItem(newItem: SVGTransform): SVGTransform;\n    clear(): void;\n    consolidate(): SVGTransform;\n    createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform;\n    getItem(index: number): SVGTransform;\n    initialize(newItem: SVGTransform): SVGTransform;\n    insertItemBefore(newItem: SVGTransform, index: number): SVGTransform;\n    removeItem(index: number): SVGTransform;\n    replaceItem(newItem: SVGTransform, index: number): SVGTransform;\n}\n\ndeclare var SVGTransformList: {\n    prototype: SVGTransformList;\n    new(): SVGTransformList;\n}\n\ninterface SVGUnitTypes {\n    readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number;\n    readonly SVG_UNIT_TYPE_UNKNOWN: number;\n    readonly SVG_UNIT_TYPE_USERSPACEONUSE: number;\n}\ndeclare var SVGUnitTypes: SVGUnitTypes;\n\ninterface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\n    readonly animatedInstanceRoot: SVGElementInstance;\n    readonly height: SVGAnimatedLength;\n    readonly instanceRoot: SVGElementInstance;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGUseElement: {\n    prototype: SVGUseElement;\n    new(): SVGUseElement;\n}\n\ninterface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {\n    readonly viewTarget: SVGStringList;\n    addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGViewElement: {\n    prototype: SVGViewElement;\n    new(): SVGViewElement;\n}\n\ninterface SVGZoomAndPan {\n    readonly zoomAndPan: number;\n}\n\ndeclare var SVGZoomAndPan: {\n    readonly SVG_ZOOMANDPAN_DISABLE: number;\n    readonly SVG_ZOOMANDPAN_MAGNIFY: number;\n    readonly SVG_ZOOMANDPAN_UNKNOWN: number;\n}\n\ninterface SVGZoomEvent extends UIEvent {\n    readonly newScale: number;\n    readonly newTranslate: SVGPoint;\n    readonly previousScale: number;\n    readonly previousTranslate: SVGPoint;\n    readonly zoomRectScreen: SVGRect;\n}\n\ndeclare var SVGZoomEvent: {\n    prototype: SVGZoomEvent;\n    new(): SVGZoomEvent;\n}\n\ninterface ScreenEventMap {\n    \"MSOrientationChange\": Event;\n}\n\ninterface Screen extends EventTarget {\n    readonly availHeight: number;\n    readonly availWidth: number;\n    bufferDepth: number;\n    readonly colorDepth: number;\n    readonly deviceXDPI: number;\n    readonly deviceYDPI: number;\n    readonly fontSmoothingEnabled: boolean;\n    readonly height: number;\n    readonly logicalXDPI: number;\n    readonly logicalYDPI: number;\n    readonly msOrientation: string;\n    onmsorientationchange: (this: Screen, ev: Event) => any;\n    readonly pixelDepth: number;\n    readonly systemXDPI: number;\n    readonly systemYDPI: number;\n    readonly width: number;\n    msLockOrientation(orientations: string | string[]): boolean;\n    msUnlockOrientation(): void;\n    addEventListener<K extends keyof ScreenEventMap>(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Screen: {\n    prototype: Screen;\n    new(): Screen;\n}\n\ninterface ScriptNotifyEvent extends Event {\n    readonly callingUri: string;\n    readonly value: string;\n}\n\ndeclare var ScriptNotifyEvent: {\n    prototype: ScriptNotifyEvent;\n    new(): ScriptNotifyEvent;\n}\n\ninterface ScriptProcessorNodeEventMap {\n    \"audioprocess\": AudioProcessingEvent;\n}\n\ninterface ScriptProcessorNode extends AudioNode {\n    readonly bufferSize: number;\n    onaudioprocess: (this: ScriptProcessorNode, ev: AudioProcessingEvent) => any;\n    addEventListener<K extends keyof ScriptProcessorNodeEventMap>(type: K, listener: (this: ScriptProcessorNode, ev: ScriptProcessorNodeEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var ScriptProcessorNode: {\n    prototype: ScriptProcessorNode;\n    new(): ScriptProcessorNode;\n}\n\ninterface Selection {\n    readonly anchorNode: Node;\n    readonly anchorOffset: number;\n    readonly focusNode: Node;\n    readonly focusOffset: number;\n    readonly isCollapsed: boolean;\n    readonly rangeCount: number;\n    readonly type: string;\n    addRange(range: Range): void;\n    collapse(parentNode: Node, offset: number): void;\n    collapseToEnd(): void;\n    collapseToStart(): void;\n    containsNode(node: Node, partlyContained: boolean): boolean;\n    deleteFromDocument(): void;\n    empty(): void;\n    extend(newNode: Node, offset: number): void;\n    getRangeAt(index: number): Range;\n    removeAllRanges(): void;\n    removeRange(range: Range): void;\n    selectAllChildren(parentNode: Node): void;\n    setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void;\n    toString(): string;\n}\n\ndeclare var Selection: {\n    prototype: Selection;\n    new(): Selection;\n}\n\ninterface SourceBuffer extends EventTarget {\n    appendWindowEnd: number;\n    appendWindowStart: number;\n    readonly audioTracks: AudioTrackList;\n    readonly buffered: TimeRanges;\n    mode: string;\n    timestampOffset: number;\n    readonly updating: boolean;\n    readonly videoTracks: VideoTrackList;\n    abort(): void;\n    appendBuffer(data: ArrayBuffer | ArrayBufferView): void;\n    appendStream(stream: MSStream, maxSize?: number): void;\n    remove(start: number, end: number): void;\n}\n\ndeclare var SourceBuffer: {\n    prototype: SourceBuffer;\n    new(): SourceBuffer;\n}\n\ninterface SourceBufferList extends EventTarget {\n    readonly length: number;\n    item(index: number): SourceBuffer;\n    [index: number]: SourceBuffer;\n}\n\ndeclare var SourceBufferList: {\n    prototype: SourceBufferList;\n    new(): SourceBufferList;\n}\n\ninterface StereoPannerNode extends AudioNode {\n    readonly pan: AudioParam;\n}\n\ndeclare var StereoPannerNode: {\n    prototype: StereoPannerNode;\n    new(): StereoPannerNode;\n}\n\ninterface Storage {\n    readonly length: number;\n    clear(): void;\n    getItem(key: string): string | null;\n    key(index: number): string | null;\n    removeItem(key: string): void;\n    setItem(key: string, data: string): void;\n    [key: string]: any;\n    [index: number]: string;\n}\n\ndeclare var Storage: {\n    prototype: Storage;\n    new(): Storage;\n}\n\ninterface StorageEvent extends Event {\n    readonly url: string;\n    key?: string;\n    oldValue?: string;\n    newValue?: string;\n    storageArea?: Storage;\n}\n\ndeclare var StorageEvent: {\n    prototype: StorageEvent;\n    new (type: string, eventInitDict?: StorageEventInit): StorageEvent;\n}\n\ninterface StyleMedia {\n    readonly type: string;\n    matchMedium(mediaquery: string): boolean;\n}\n\ndeclare var StyleMedia: {\n    prototype: StyleMedia;\n    new(): StyleMedia;\n}\n\ninterface StyleSheet {\n    disabled: boolean;\n    readonly href: string;\n    readonly media: MediaList;\n    readonly ownerNode: Node;\n    readonly parentStyleSheet: StyleSheet;\n    readonly title: string;\n    readonly type: string;\n}\n\ndeclare var StyleSheet: {\n    prototype: StyleSheet;\n    new(): StyleSheet;\n}\n\ninterface StyleSheetList {\n    readonly length: number;\n    item(index?: number): StyleSheet;\n    [index: number]: StyleSheet;\n}\n\ndeclare var StyleSheetList: {\n    prototype: StyleSheetList;\n    new(): StyleSheetList;\n}\n\ninterface StyleSheetPageList {\n    readonly length: number;\n    item(index: number): CSSPageRule;\n    [index: number]: CSSPageRule;\n}\n\ndeclare var StyleSheetPageList: {\n    prototype: StyleSheetPageList;\n    new(): StyleSheetPageList;\n}\n\ninterface SubtleCrypto {\n    decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike<ArrayBuffer>;\n    deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike<ArrayBuffer>;\n    deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike<CryptoKey>;\n    digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike<ArrayBuffer>;\n    encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike<ArrayBuffer>;\n    exportKey(format: \"jwk\", key: CryptoKey): PromiseLike<JsonWebKey>;\n    exportKey(format: \"raw\" | \"pkcs8\" | \"spki\", key: CryptoKey): PromiseLike<ArrayBuffer>;\n    exportKey(format: string, key: CryptoKey): PromiseLike<JsonWebKey | ArrayBuffer>;\n    generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike<CryptoKeyPair | CryptoKey>;\n    generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike<CryptoKeyPair>;\n    generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike<CryptoKey>;\n    importKey(format: \"jwk\", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike<CryptoKey>;\n    importKey(format: \"raw\" | \"pkcs8\" | \"spki\", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike<CryptoKey>;\n    importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike<CryptoKey>;\n    sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike<ArrayBuffer>;\n    unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike<CryptoKey>;\n    verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike<boolean>;\n    wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike<ArrayBuffer>;\n}\n\ndeclare var SubtleCrypto: {\n    prototype: SubtleCrypto;\n    new(): SubtleCrypto;\n}\n\ninterface Text extends CharacterData {\n    readonly wholeText: string;\n    readonly assignedSlot: HTMLSlotElement | null;\n    splitText(offset: number): Text;\n}\n\ndeclare var Text: {\n    prototype: Text;\n    new(): Text;\n}\n\ninterface TextEvent extends UIEvent {\n    readonly data: string;\n    readonly inputMethod: number;\n    readonly locale: string;\n    initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void;\n    readonly DOM_INPUT_METHOD_DROP: number;\n    readonly DOM_INPUT_METHOD_HANDWRITING: number;\n    readonly DOM_INPUT_METHOD_IME: number;\n    readonly DOM_INPUT_METHOD_KEYBOARD: number;\n    readonly DOM_INPUT_METHOD_MULTIMODAL: number;\n    readonly DOM_INPUT_METHOD_OPTION: number;\n    readonly DOM_INPUT_METHOD_PASTE: number;\n    readonly DOM_INPUT_METHOD_SCRIPT: number;\n    readonly DOM_INPUT_METHOD_UNKNOWN: number;\n    readonly DOM_INPUT_METHOD_VOICE: number;\n}\n\ndeclare var TextEvent: {\n    prototype: TextEvent;\n    new(): TextEvent;\n    readonly DOM_INPUT_METHOD_DROP: number;\n    readonly DOM_INPUT_METHOD_HANDWRITING: number;\n    readonly DOM_INPUT_METHOD_IME: number;\n    readonly DOM_INPUT_METHOD_KEYBOARD: number;\n    readonly DOM_INPUT_METHOD_MULTIMODAL: number;\n    readonly DOM_INPUT_METHOD_OPTION: number;\n    readonly DOM_INPUT_METHOD_PASTE: number;\n    readonly DOM_INPUT_METHOD_SCRIPT: number;\n    readonly DOM_INPUT_METHOD_UNKNOWN: number;\n    readonly DOM_INPUT_METHOD_VOICE: number;\n}\n\ninterface TextMetrics {\n    readonly width: number;\n}\n\ndeclare var TextMetrics: {\n    prototype: TextMetrics;\n    new(): TextMetrics;\n}\n\ninterface TextTrackEventMap {\n    \"cuechange\": Event;\n    \"error\": ErrorEvent;\n    \"load\": Event;\n}\n\ninterface TextTrack extends EventTarget {\n    readonly activeCues: TextTrackCueList;\n    readonly cues: TextTrackCueList;\n    readonly inBandMetadataTrackDispatchType: string;\n    readonly kind: string;\n    readonly label: string;\n    readonly language: string;\n    mode: any;\n    oncuechange: (this: TextTrack, ev: Event) => any;\n    onerror: (this: TextTrack, ev: ErrorEvent) => any;\n    onload: (this: TextTrack, ev: Event) => any;\n    readonly readyState: number;\n    addCue(cue: TextTrackCue): void;\n    removeCue(cue: TextTrackCue): void;\n    readonly DISABLED: number;\n    readonly ERROR: number;\n    readonly HIDDEN: number;\n    readonly LOADED: number;\n    readonly LOADING: number;\n    readonly NONE: number;\n    readonly SHOWING: number;\n    addEventListener<K extends keyof TextTrackEventMap>(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var TextTrack: {\n    prototype: TextTrack;\n    new(): TextTrack;\n    readonly DISABLED: number;\n    readonly ERROR: number;\n    readonly HIDDEN: number;\n    readonly LOADED: number;\n    readonly LOADING: number;\n    readonly NONE: number;\n    readonly SHOWING: number;\n}\n\ninterface TextTrackCueEventMap {\n    \"enter\": Event;\n    \"exit\": Event;\n}\n\ninterface TextTrackCue extends EventTarget {\n    endTime: number;\n    id: string;\n    onenter: (this: TextTrackCue, ev: Event) => any;\n    onexit: (this: TextTrackCue, ev: Event) => any;\n    pauseOnExit: boolean;\n    startTime: number;\n    text: string;\n    readonly track: TextTrack;\n    getCueAsHTML(): DocumentFragment;\n    addEventListener<K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var TextTrackCue: {\n    prototype: TextTrackCue;\n    new(startTime: number, endTime: number, text: string): TextTrackCue;\n}\n\ninterface TextTrackCueList {\n    readonly length: number;\n    getCueById(id: string): TextTrackCue;\n    item(index: number): TextTrackCue;\n    [index: number]: TextTrackCue;\n}\n\ndeclare var TextTrackCueList: {\n    prototype: TextTrackCueList;\n    new(): TextTrackCueList;\n}\n\ninterface TextTrackListEventMap {\n    \"addtrack\": TrackEvent;\n}\n\ninterface TextTrackList extends EventTarget {\n    readonly length: number;\n    onaddtrack: ((this: TextTrackList, ev: TrackEvent) => any) | null;\n    item(index: number): TextTrack;\n    addEventListener<K extends keyof TextTrackListEventMap>(type: K, listener: (this: TextTrackList, ev: TextTrackListEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n    [index: number]: TextTrack;\n}\n\ndeclare var TextTrackList: {\n    prototype: TextTrackList;\n    new(): TextTrackList;\n}\n\ninterface TimeRanges {\n    readonly length: number;\n    end(index: number): number;\n    start(index: number): number;\n}\n\ndeclare var TimeRanges: {\n    prototype: TimeRanges;\n    new(): TimeRanges;\n}\n\ninterface Touch {\n    readonly clientX: number;\n    readonly clientY: number;\n    readonly identifier: number;\n    readonly pageX: number;\n    readonly pageY: number;\n    readonly screenX: number;\n    readonly screenY: number;\n    readonly target: EventTarget;\n}\n\ndeclare var Touch: {\n    prototype: Touch;\n    new(): Touch;\n}\n\ninterface TouchEvent extends UIEvent {\n    readonly altKey: boolean;\n    readonly changedTouches: TouchList;\n    readonly ctrlKey: boolean;\n    readonly metaKey: boolean;\n    readonly shiftKey: boolean;\n    readonly targetTouches: TouchList;\n    readonly touches: TouchList;\n}\n\ndeclare var TouchEvent: {\n    prototype: TouchEvent;\n    new(): TouchEvent;\n}\n\ninterface TouchList {\n    readonly length: number;\n    item(index: number): Touch | null;\n    [index: number]: Touch;\n}\n\ndeclare var TouchList: {\n    prototype: TouchList;\n    new(): TouchList;\n}\n\ninterface TrackEvent extends Event {\n    readonly track: any;\n}\n\ndeclare var TrackEvent: {\n    prototype: TrackEvent;\n    new(): TrackEvent;\n}\n\ninterface TransitionEvent extends Event {\n    readonly elapsedTime: number;\n    readonly propertyName: string;\n    initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void;\n}\n\ndeclare var TransitionEvent: {\n    prototype: TransitionEvent;\n    new(): TransitionEvent;\n}\n\ninterface TreeWalker {\n    currentNode: Node;\n    readonly expandEntityReferences: boolean;\n    readonly filter: NodeFilter;\n    readonly root: Node;\n    readonly whatToShow: number;\n    firstChild(): Node;\n    lastChild(): Node;\n    nextNode(): Node;\n    nextSibling(): Node;\n    parentNode(): Node;\n    previousNode(): Node;\n    previousSibling(): Node;\n}\n\ndeclare var TreeWalker: {\n    prototype: TreeWalker;\n    new(): TreeWalker;\n}\n\ninterface UIEvent extends Event {\n    readonly detail: number;\n    readonly view: Window;\n    initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void;\n}\n\ndeclare var UIEvent: {\n    prototype: UIEvent;\n    new(type: string, eventInitDict?: UIEventInit): UIEvent;\n}\n\ninterface URL {\n    hash: string;\n    host: string;\n    hostname: string;\n    href: string;\n    readonly origin: string;\n    password: string;\n    pathname: string;\n    port: string;\n    protocol: string;\n    search: string;\n    username: string;\n    toString(): string;\n}\n\ndeclare var URL: {\n    prototype: URL;\n    new(url: string, base?: string): URL;\n    createObjectURL(object: any, options?: ObjectURLOptions): string;\n    revokeObjectURL(url: string): void;\n}\n\ninterface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer {\n    readonly mediaType: string;\n}\n\ndeclare var UnviewableContentIdentifiedEvent: {\n    prototype: UnviewableContentIdentifiedEvent;\n    new(): UnviewableContentIdentifiedEvent;\n}\n\ninterface ValidityState {\n    readonly badInput: boolean;\n    readonly customError: boolean;\n    readonly patternMismatch: boolean;\n    readonly rangeOverflow: boolean;\n    readonly rangeUnderflow: boolean;\n    readonly stepMismatch: boolean;\n    readonly tooLong: boolean;\n    readonly typeMismatch: boolean;\n    readonly valid: boolean;\n    readonly valueMissing: boolean;\n}\n\ndeclare var ValidityState: {\n    prototype: ValidityState;\n    new(): ValidityState;\n}\n\ninterface VideoPlaybackQuality {\n    readonly corruptedVideoFrames: number;\n    readonly creationTime: number;\n    readonly droppedVideoFrames: number;\n    readonly totalFrameDelay: number;\n    readonly totalVideoFrames: number;\n}\n\ndeclare var VideoPlaybackQuality: {\n    prototype: VideoPlaybackQuality;\n    new(): VideoPlaybackQuality;\n}\n\ninterface VideoTrack {\n    readonly id: string;\n    kind: string;\n    readonly label: string;\n    language: string;\n    selected: boolean;\n    readonly sourceBuffer: SourceBuffer;\n}\n\ndeclare var VideoTrack: {\n    prototype: VideoTrack;\n    new(): VideoTrack;\n}\n\ninterface VideoTrackListEventMap {\n    \"addtrack\": TrackEvent;\n    \"change\": Event;\n    \"removetrack\": TrackEvent;\n}\n\ninterface VideoTrackList extends EventTarget {\n    readonly length: number;\n    onaddtrack: (this: VideoTrackList, ev: TrackEvent) => any;\n    onchange: (this: VideoTrackList, ev: Event) => any;\n    onremovetrack: (this: VideoTrackList, ev: TrackEvent) => any;\n    readonly selectedIndex: number;\n    getTrackById(id: string): VideoTrack | null;\n    item(index: number): VideoTrack;\n    addEventListener<K extends keyof VideoTrackListEventMap>(type: K, listener: (this: VideoTrackList, ev: VideoTrackListEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n    [index: number]: VideoTrack;\n}\n\ndeclare var VideoTrackList: {\n    prototype: VideoTrackList;\n    new(): VideoTrackList;\n}\n\ninterface WEBGL_compressed_texture_s3tc {\n    readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number;\n    readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number;\n    readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number;\n    readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number;\n}\n\ndeclare var WEBGL_compressed_texture_s3tc: {\n    prototype: WEBGL_compressed_texture_s3tc;\n    new(): WEBGL_compressed_texture_s3tc;\n    readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number;\n    readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number;\n    readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number;\n    readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number;\n}\n\ninterface WEBGL_debug_renderer_info {\n    readonly UNMASKED_RENDERER_WEBGL: number;\n    readonly UNMASKED_VENDOR_WEBGL: number;\n}\n\ndeclare var WEBGL_debug_renderer_info: {\n    prototype: WEBGL_debug_renderer_info;\n    new(): WEBGL_debug_renderer_info;\n    readonly UNMASKED_RENDERER_WEBGL: number;\n    readonly UNMASKED_VENDOR_WEBGL: number;\n}\n\ninterface WEBGL_depth_texture {\n    readonly UNSIGNED_INT_24_8_WEBGL: number;\n}\n\ndeclare var WEBGL_depth_texture: {\n    prototype: WEBGL_depth_texture;\n    new(): WEBGL_depth_texture;\n    readonly UNSIGNED_INT_24_8_WEBGL: number;\n}\n\ninterface WaveShaperNode extends AudioNode {\n    curve: Float32Array | null;\n    oversample: string;\n}\n\ndeclare var WaveShaperNode: {\n    prototype: WaveShaperNode;\n    new(): WaveShaperNode;\n}\n\ninterface WebGLActiveInfo {\n    readonly name: string;\n    readonly size: number;\n    readonly type: number;\n}\n\ndeclare var WebGLActiveInfo: {\n    prototype: WebGLActiveInfo;\n    new(): WebGLActiveInfo;\n}\n\ninterface WebGLBuffer extends WebGLObject {\n}\n\ndeclare var WebGLBuffer: {\n    prototype: WebGLBuffer;\n    new(): WebGLBuffer;\n}\n\ninterface WebGLContextEvent extends Event {\n    readonly statusMessage: string;\n}\n\ndeclare var WebGLContextEvent: {\n    prototype: WebGLContextEvent;\n    new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent;\n}\n\ninterface WebGLFramebuffer extends WebGLObject {\n}\n\ndeclare var WebGLFramebuffer: {\n    prototype: WebGLFramebuffer;\n    new(): WebGLFramebuffer;\n}\n\ninterface WebGLObject {\n}\n\ndeclare var WebGLObject: {\n    prototype: WebGLObject;\n    new(): WebGLObject;\n}\n\ninterface WebGLProgram extends WebGLObject {\n}\n\ndeclare var WebGLProgram: {\n    prototype: WebGLProgram;\n    new(): WebGLProgram;\n}\n\ninterface WebGLRenderbuffer extends WebGLObject {\n}\n\ndeclare var WebGLRenderbuffer: {\n    prototype: WebGLRenderbuffer;\n    new(): WebGLRenderbuffer;\n}\n\ninterface WebGLRenderingContext {\n    readonly canvas: HTMLCanvasElement;\n    readonly drawingBufferHeight: number;\n    readonly drawingBufferWidth: number;\n    activeTexture(texture: number): void;\n    attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void;\n    bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void;\n    bindBuffer(target: number, buffer: WebGLBuffer | null): void;\n    bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void;\n    bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void;\n    bindTexture(target: number, texture: WebGLTexture | null): void;\n    blendColor(red: number, green: number, blue: number, alpha: number): void;\n    blendEquation(mode: number): void;\n    blendEquationSeparate(modeRGB: number, modeAlpha: number): void;\n    blendFunc(sfactor: number, dfactor: number): void;\n    blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void;\n    bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void;\n    bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void;\n    checkFramebufferStatus(target: number): number;\n    clear(mask: number): void;\n    clearColor(red: number, green: number, blue: number, alpha: number): void;\n    clearDepth(depth: number): void;\n    clearStencil(s: number): void;\n    colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void;\n    compileShader(shader: WebGLShader | null): void;\n    compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void;\n    compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void;\n    copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void;\n    copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void;\n    createBuffer(): WebGLBuffer | null;\n    createFramebuffer(): WebGLFramebuffer | null;\n    createProgram(): WebGLProgram | null;\n    createRenderbuffer(): WebGLRenderbuffer | null;\n    createShader(type: number): WebGLShader | null;\n    createTexture(): WebGLTexture | null;\n    cullFace(mode: number): void;\n    deleteBuffer(buffer: WebGLBuffer | null): void;\n    deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void;\n    deleteProgram(program: WebGLProgram | null): void;\n    deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void;\n    deleteShader(shader: WebGLShader | null): void;\n    deleteTexture(texture: WebGLTexture | null): void;\n    depthFunc(func: number): void;\n    depthMask(flag: boolean): void;\n    depthRange(zNear: number, zFar: number): void;\n    detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void;\n    disable(cap: number): void;\n    disableVertexAttribArray(index: number): void;\n    drawArrays(mode: number, first: number, count: number): void;\n    drawElements(mode: number, count: number, type: number, offset: number): void;\n    enable(cap: number): void;\n    enableVertexAttribArray(index: number): void;\n    finish(): void;\n    flush(): void;\n    framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void;\n    framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void;\n    frontFace(mode: number): void;\n    generateMipmap(target: number): void;\n    getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null;\n    getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null;\n    getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null;\n    getAttribLocation(program: WebGLProgram | null, name: string): number;\n    getBufferParameter(target: number, pname: number): any;\n    getContextAttributes(): WebGLContextAttributes;\n    getError(): number;\n    getExtension(name: string): any;\n    getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any;\n    getParameter(pname: number): any;\n    getProgramInfoLog(program: WebGLProgram | null): string | null;\n    getProgramParameter(program: WebGLProgram | null, pname: number): any;\n    getRenderbufferParameter(target: number, pname: number): any;\n    getShaderInfoLog(shader: WebGLShader | null): string | null;\n    getShaderParameter(shader: WebGLShader | null, pname: number): any;\n    getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null;\n    getShaderSource(shader: WebGLShader | null): string | null;\n    getSupportedExtensions(): string[] | null;\n    getTexParameter(target: number, pname: number): any;\n    getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any;\n    getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null;\n    getVertexAttrib(index: number, pname: number): any;\n    getVertexAttribOffset(index: number, pname: number): number;\n    hint(target: number, mode: number): void;\n    isBuffer(buffer: WebGLBuffer | null): boolean;\n    isContextLost(): boolean;\n    isEnabled(cap: number): boolean;\n    isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean;\n    isProgram(program: WebGLProgram | null): boolean;\n    isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean;\n    isShader(shader: WebGLShader | null): boolean;\n    isTexture(texture: WebGLTexture | null): boolean;\n    lineWidth(width: number): void;\n    linkProgram(program: WebGLProgram | null): void;\n    pixelStorei(pname: number, param: number): void;\n    polygonOffset(factor: number, units: number): void;\n    readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void;\n    renderbufferStorage(target: number, internalformat: number, width: number, height: number): void;\n    sampleCoverage(value: number, invert: boolean): void;\n    scissor(x: number, y: number, width: number, height: number): void;\n    shaderSource(shader: WebGLShader | null, source: string): void;\n    stencilFunc(func: number, ref: number, mask: number): void;\n    stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void;\n    stencilMask(mask: number): void;\n    stencilMaskSeparate(face: number, mask: number): void;\n    stencilOp(fail: number, zfail: number, zpass: number): void;\n    stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void;\n    texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void;\n    texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;\n    texParameterf(target: number, pname: number, param: number): void;\n    texParameteri(target: number, pname: number, param: number): void;\n    texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void;\n    texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;\n    uniform1f(location: WebGLUniformLocation | null, x: number): void;\n    uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\n    uniform1i(location: WebGLUniformLocation | null, x: number): void;\n    uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\n    uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void;\n    uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\n    uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void;\n    uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\n    uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void;\n    uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\n    uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void;\n    uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\n    uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void;\n    uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\n    uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void;\n    uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\n    uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\n    uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\n    uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\n    useProgram(program: WebGLProgram | null): void;\n    validateProgram(program: WebGLProgram | null): void;\n    vertexAttrib1f(indx: number, x: number): void;\n    vertexAttrib1fv(indx: number, values: Float32Array | number[]): void;\n    vertexAttrib2f(indx: number, x: number, y: number): void;\n    vertexAttrib2fv(indx: number, values: Float32Array | number[]): void;\n    vertexAttrib3f(indx: number, x: number, y: number, z: number): void;\n    vertexAttrib3fv(indx: number, values: Float32Array | number[]): void;\n    vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void;\n    vertexAttrib4fv(indx: number, values: Float32Array | number[]): void;\n    vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void;\n    viewport(x: number, y: number, width: number, height: number): void;\n    readonly ACTIVE_ATTRIBUTES: number;\n    readonly ACTIVE_TEXTURE: number;\n    readonly ACTIVE_UNIFORMS: number;\n    readonly ALIASED_LINE_WIDTH_RANGE: number;\n    readonly ALIASED_POINT_SIZE_RANGE: number;\n    readonly ALPHA: number;\n    readonly ALPHA_BITS: number;\n    readonly ALWAYS: number;\n    readonly ARRAY_BUFFER: number;\n    readonly ARRAY_BUFFER_BINDING: number;\n    readonly ATTACHED_SHADERS: number;\n    readonly BACK: number;\n    readonly BLEND: number;\n    readonly BLEND_COLOR: number;\n    readonly BLEND_DST_ALPHA: number;\n    readonly BLEND_DST_RGB: number;\n    readonly BLEND_EQUATION: number;\n    readonly BLEND_EQUATION_ALPHA: number;\n    readonly BLEND_EQUATION_RGB: number;\n    readonly BLEND_SRC_ALPHA: number;\n    readonly BLEND_SRC_RGB: number;\n    readonly BLUE_BITS: number;\n    readonly BOOL: number;\n    readonly BOOL_VEC2: number;\n    readonly BOOL_VEC3: number;\n    readonly BOOL_VEC4: number;\n    readonly BROWSER_DEFAULT_WEBGL: number;\n    readonly BUFFER_SIZE: number;\n    readonly BUFFER_USAGE: number;\n    readonly BYTE: number;\n    readonly CCW: number;\n    readonly CLAMP_TO_EDGE: number;\n    readonly COLOR_ATTACHMENT0: number;\n    readonly COLOR_BUFFER_BIT: number;\n    readonly COLOR_CLEAR_VALUE: number;\n    readonly COLOR_WRITEMASK: number;\n    readonly COMPILE_STATUS: number;\n    readonly COMPRESSED_TEXTURE_FORMATS: number;\n    readonly CONSTANT_ALPHA: number;\n    readonly CONSTANT_COLOR: number;\n    readonly CONTEXT_LOST_WEBGL: number;\n    readonly CULL_FACE: number;\n    readonly CULL_FACE_MODE: number;\n    readonly CURRENT_PROGRAM: number;\n    readonly CURRENT_VERTEX_ATTRIB: number;\n    readonly CW: number;\n    readonly DECR: number;\n    readonly DECR_WRAP: number;\n    readonly DELETE_STATUS: number;\n    readonly DEPTH_ATTACHMENT: number;\n    readonly DEPTH_BITS: number;\n    readonly DEPTH_BUFFER_BIT: number;\n    readonly DEPTH_CLEAR_VALUE: number;\n    readonly DEPTH_COMPONENT: number;\n    readonly DEPTH_COMPONENT16: number;\n    readonly DEPTH_FUNC: number;\n    readonly DEPTH_RANGE: number;\n    readonly DEPTH_STENCIL: number;\n    readonly DEPTH_STENCIL_ATTACHMENT: number;\n    readonly DEPTH_TEST: number;\n    readonly DEPTH_WRITEMASK: number;\n    readonly DITHER: number;\n    readonly DONT_CARE: number;\n    readonly DST_ALPHA: number;\n    readonly DST_COLOR: number;\n    readonly DYNAMIC_DRAW: number;\n    readonly ELEMENT_ARRAY_BUFFER: number;\n    readonly ELEMENT_ARRAY_BUFFER_BINDING: number;\n    readonly EQUAL: number;\n    readonly FASTEST: number;\n    readonly FLOAT: number;\n    readonly FLOAT_MAT2: number;\n    readonly FLOAT_MAT3: number;\n    readonly FLOAT_MAT4: number;\n    readonly FLOAT_VEC2: number;\n    readonly FLOAT_VEC3: number;\n    readonly FLOAT_VEC4: number;\n    readonly FRAGMENT_SHADER: number;\n    readonly FRAMEBUFFER: number;\n    readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number;\n    readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number;\n    readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number;\n    readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number;\n    readonly FRAMEBUFFER_BINDING: number;\n    readonly FRAMEBUFFER_COMPLETE: number;\n    readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number;\n    readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number;\n    readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number;\n    readonly FRAMEBUFFER_UNSUPPORTED: number;\n    readonly FRONT: number;\n    readonly FRONT_AND_BACK: number;\n    readonly FRONT_FACE: number;\n    readonly FUNC_ADD: number;\n    readonly FUNC_REVERSE_SUBTRACT: number;\n    readonly FUNC_SUBTRACT: number;\n    readonly GENERATE_MIPMAP_HINT: number;\n    readonly GEQUAL: number;\n    readonly GREATER: number;\n    readonly GREEN_BITS: number;\n    readonly HIGH_FLOAT: number;\n    readonly HIGH_INT: number;\n    readonly IMPLEMENTATION_COLOR_READ_FORMAT: number;\n    readonly IMPLEMENTATION_COLOR_READ_TYPE: number;\n    readonly INCR: number;\n    readonly INCR_WRAP: number;\n    readonly INT: number;\n    readonly INT_VEC2: number;\n    readonly INT_VEC3: number;\n    readonly INT_VEC4: number;\n    readonly INVALID_ENUM: number;\n    readonly INVALID_FRAMEBUFFER_OPERATION: number;\n    readonly INVALID_OPERATION: number;\n    readonly INVALID_VALUE: number;\n    readonly INVERT: number;\n    readonly KEEP: number;\n    readonly LEQUAL: number;\n    readonly LESS: number;\n    readonly LINEAR: number;\n    readonly LINEAR_MIPMAP_LINEAR: number;\n    readonly LINEAR_MIPMAP_NEAREST: number;\n    readonly LINES: number;\n    readonly LINE_LOOP: number;\n    readonly LINE_STRIP: number;\n    readonly LINE_WIDTH: number;\n    readonly LINK_STATUS: number;\n    readonly LOW_FLOAT: number;\n    readonly LOW_INT: number;\n    readonly LUMINANCE: number;\n    readonly LUMINANCE_ALPHA: number;\n    readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number;\n    readonly MAX_CUBE_MAP_TEXTURE_SIZE: number;\n    readonly MAX_FRAGMENT_UNIFORM_VECTORS: number;\n    readonly MAX_RENDERBUFFER_SIZE: number;\n    readonly MAX_TEXTURE_IMAGE_UNITS: number;\n    readonly MAX_TEXTURE_SIZE: number;\n    readonly MAX_VARYING_VECTORS: number;\n    readonly MAX_VERTEX_ATTRIBS: number;\n    readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number;\n    readonly MAX_VERTEX_UNIFORM_VECTORS: number;\n    readonly MAX_VIEWPORT_DIMS: number;\n    readonly MEDIUM_FLOAT: number;\n    readonly MEDIUM_INT: number;\n    readonly MIRRORED_REPEAT: number;\n    readonly NEAREST: number;\n    readonly NEAREST_MIPMAP_LINEAR: number;\n    readonly NEAREST_MIPMAP_NEAREST: number;\n    readonly NEVER: number;\n    readonly NICEST: number;\n    readonly NONE: number;\n    readonly NOTEQUAL: number;\n    readonly NO_ERROR: number;\n    readonly ONE: number;\n    readonly ONE_MINUS_CONSTANT_ALPHA: number;\n    readonly ONE_MINUS_CONSTANT_COLOR: number;\n    readonly ONE_MINUS_DST_ALPHA: number;\n    readonly ONE_MINUS_DST_COLOR: number;\n    readonly ONE_MINUS_SRC_ALPHA: number;\n    readonly ONE_MINUS_SRC_COLOR: number;\n    readonly OUT_OF_MEMORY: number;\n    readonly PACK_ALIGNMENT: number;\n    readonly POINTS: number;\n    readonly POLYGON_OFFSET_FACTOR: number;\n    readonly POLYGON_OFFSET_FILL: number;\n    readonly POLYGON_OFFSET_UNITS: number;\n    readonly RED_BITS: number;\n    readonly RENDERBUFFER: number;\n    readonly RENDERBUFFER_ALPHA_SIZE: number;\n    readonly RENDERBUFFER_BINDING: number;\n    readonly RENDERBUFFER_BLUE_SIZE: number;\n    readonly RENDERBUFFER_DEPTH_SIZE: number;\n    readonly RENDERBUFFER_GREEN_SIZE: number;\n    readonly RENDERBUFFER_HEIGHT: number;\n    readonly RENDERBUFFER_INTERNAL_FORMAT: number;\n    readonly RENDERBUFFER_RED_SIZE: number;\n    readonly RENDERBUFFER_STENCIL_SIZE: number;\n    readonly RENDERBUFFER_WIDTH: number;\n    readonly RENDERER: number;\n    readonly REPEAT: number;\n    readonly REPLACE: number;\n    readonly RGB: number;\n    readonly RGB565: number;\n    readonly RGB5_A1: number;\n    readonly RGBA: number;\n    readonly RGBA4: number;\n    readonly SAMPLER_2D: number;\n    readonly SAMPLER_CUBE: number;\n    readonly SAMPLES: number;\n    readonly SAMPLE_ALPHA_TO_COVERAGE: number;\n    readonly SAMPLE_BUFFERS: number;\n    readonly SAMPLE_COVERAGE: number;\n    readonly SAMPLE_COVERAGE_INVERT: number;\n    readonly SAMPLE_COVERAGE_VALUE: number;\n    readonly SCISSOR_BOX: number;\n    readonly SCISSOR_TEST: number;\n    readonly SHADER_TYPE: number;\n    readonly SHADING_LANGUAGE_VERSION: number;\n    readonly SHORT: number;\n    readonly SRC_ALPHA: number;\n    readonly SRC_ALPHA_SATURATE: number;\n    readonly SRC_COLOR: number;\n    readonly STATIC_DRAW: number;\n    readonly STENCIL_ATTACHMENT: number;\n    readonly STENCIL_BACK_FAIL: number;\n    readonly STENCIL_BACK_FUNC: number;\n    readonly STENCIL_BACK_PASS_DEPTH_FAIL: number;\n    readonly STENCIL_BACK_PASS_DEPTH_PASS: number;\n    readonly STENCIL_BACK_REF: number;\n    readonly STENCIL_BACK_VALUE_MASK: number;\n    readonly STENCIL_BACK_WRITEMASK: number;\n    readonly STENCIL_BITS: number;\n    readonly STENCIL_BUFFER_BIT: number;\n    readonly STENCIL_CLEAR_VALUE: number;\n    readonly STENCIL_FAIL: number;\n    readonly STENCIL_FUNC: number;\n    readonly STENCIL_INDEX: number;\n    readonly STENCIL_INDEX8: number;\n    readonly STENCIL_PASS_DEPTH_FAIL: number;\n    readonly STENCIL_PASS_DEPTH_PASS: number;\n    readonly STENCIL_REF: number;\n    readonly STENCIL_TEST: number;\n    readonly STENCIL_VALUE_MASK: number;\n    readonly STENCIL_WRITEMASK: number;\n    readonly STREAM_DRAW: number;\n    readonly SUBPIXEL_BITS: number;\n    readonly TEXTURE: number;\n    readonly TEXTURE0: number;\n    readonly TEXTURE1: number;\n    readonly TEXTURE10: number;\n    readonly TEXTURE11: number;\n    readonly TEXTURE12: number;\n    readonly TEXTURE13: number;\n    readonly TEXTURE14: number;\n    readonly TEXTURE15: number;\n    readonly TEXTURE16: number;\n    readonly TEXTURE17: number;\n    readonly TEXTURE18: number;\n    readonly TEXTURE19: number;\n    readonly TEXTURE2: number;\n    readonly TEXTURE20: number;\n    readonly TEXTURE21: number;\n    readonly TEXTURE22: number;\n    readonly TEXTURE23: number;\n    readonly TEXTURE24: number;\n    readonly TEXTURE25: number;\n    readonly TEXTURE26: number;\n    readonly TEXTURE27: number;\n    readonly TEXTURE28: number;\n    readonly TEXTURE29: number;\n    readonly TEXTURE3: number;\n    readonly TEXTURE30: number;\n    readonly TEXTURE31: number;\n    readonly TEXTURE4: number;\n    readonly TEXTURE5: number;\n    readonly TEXTURE6: number;\n    readonly TEXTURE7: number;\n    readonly TEXTURE8: number;\n    readonly TEXTURE9: number;\n    readonly TEXTURE_2D: number;\n    readonly TEXTURE_BINDING_2D: number;\n    readonly TEXTURE_BINDING_CUBE_MAP: number;\n    readonly TEXTURE_CUBE_MAP: number;\n    readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number;\n    readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number;\n    readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number;\n    readonly TEXTURE_CUBE_MAP_POSITIVE_X: number;\n    readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number;\n    readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number;\n    readonly TEXTURE_MAG_FILTER: number;\n    readonly TEXTURE_MIN_FILTER: number;\n    readonly TEXTURE_WRAP_S: number;\n    readonly TEXTURE_WRAP_T: number;\n    readonly TRIANGLES: number;\n    readonly TRIANGLE_FAN: number;\n    readonly TRIANGLE_STRIP: number;\n    readonly UNPACK_ALIGNMENT: number;\n    readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number;\n    readonly UNPACK_FLIP_Y_WEBGL: number;\n    readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number;\n    readonly UNSIGNED_BYTE: number;\n    readonly UNSIGNED_INT: number;\n    readonly UNSIGNED_SHORT: number;\n    readonly UNSIGNED_SHORT_4_4_4_4: number;\n    readonly UNSIGNED_SHORT_5_5_5_1: number;\n    readonly UNSIGNED_SHORT_5_6_5: number;\n    readonly VALIDATE_STATUS: number;\n    readonly VENDOR: number;\n    readonly VERSION: number;\n    readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number;\n    readonly VERTEX_ATTRIB_ARRAY_ENABLED: number;\n    readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number;\n    readonly VERTEX_ATTRIB_ARRAY_POINTER: number;\n    readonly VERTEX_ATTRIB_ARRAY_SIZE: number;\n    readonly VERTEX_ATTRIB_ARRAY_STRIDE: number;\n    readonly VERTEX_ATTRIB_ARRAY_TYPE: number;\n    readonly VERTEX_SHADER: number;\n    readonly VIEWPORT: number;\n    readonly ZERO: number;\n}\n\ndeclare var WebGLRenderingContext: {\n    prototype: WebGLRenderingContext;\n    new(): WebGLRenderingContext;\n    readonly ACTIVE_ATTRIBUTES: number;\n    readonly ACTIVE_TEXTURE: number;\n    readonly ACTIVE_UNIFORMS: number;\n    readonly ALIASED_LINE_WIDTH_RANGE: number;\n    readonly ALIASED_POINT_SIZE_RANGE: number;\n    readonly ALPHA: number;\n    readonly ALPHA_BITS: number;\n    readonly ALWAYS: number;\n    readonly ARRAY_BUFFER: number;\n    readonly ARRAY_BUFFER_BINDING: number;\n    readonly ATTACHED_SHADERS: number;\n    readonly BACK: number;\n    readonly BLEND: number;\n    readonly BLEND_COLOR: number;\n    readonly BLEND_DST_ALPHA: number;\n    readonly BLEND_DST_RGB: number;\n    readonly BLEND_EQUATION: number;\n    readonly BLEND_EQUATION_ALPHA: number;\n    readonly BLEND_EQUATION_RGB: number;\n    readonly BLEND_SRC_ALPHA: number;\n    readonly BLEND_SRC_RGB: number;\n    readonly BLUE_BITS: number;\n    readonly BOOL: number;\n    readonly BOOL_VEC2: number;\n    readonly BOOL_VEC3: number;\n    readonly BOOL_VEC4: number;\n    readonly BROWSER_DEFAULT_WEBGL: number;\n    readonly BUFFER_SIZE: number;\n    readonly BUFFER_USAGE: number;\n    readonly BYTE: number;\n    readonly CCW: number;\n    readonly CLAMP_TO_EDGE: number;\n    readonly COLOR_ATTACHMENT0: number;\n    readonly COLOR_BUFFER_BIT: number;\n    readonly COLOR_CLEAR_VALUE: number;\n    readonly COLOR_WRITEMASK: number;\n    readonly COMPILE_STATUS: number;\n    readonly COMPRESSED_TEXTURE_FORMATS: number;\n    readonly CONSTANT_ALPHA: number;\n    readonly CONSTANT_COLOR: number;\n    readonly CONTEXT_LOST_WEBGL: number;\n    readonly CULL_FACE: number;\n    readonly CULL_FACE_MODE: number;\n    readonly CURRENT_PROGRAM: number;\n    readonly CURRENT_VERTEX_ATTRIB: number;\n    readonly CW: number;\n    readonly DECR: number;\n    readonly DECR_WRAP: number;\n    readonly DELETE_STATUS: number;\n    readonly DEPTH_ATTACHMENT: number;\n    readonly DEPTH_BITS: number;\n    readonly DEPTH_BUFFER_BIT: number;\n    readonly DEPTH_CLEAR_VALUE: number;\n    readonly DEPTH_COMPONENT: number;\n    readonly DEPTH_COMPONENT16: number;\n    readonly DEPTH_FUNC: number;\n    readonly DEPTH_RANGE: number;\n    readonly DEPTH_STENCIL: number;\n    readonly DEPTH_STENCIL_ATTACHMENT: number;\n    readonly DEPTH_TEST: number;\n    readonly DEPTH_WRITEMASK: number;\n    readonly DITHER: number;\n    readonly DONT_CARE: number;\n    readonly DST_ALPHA: number;\n    readonly DST_COLOR: number;\n    readonly DYNAMIC_DRAW: number;\n    readonly ELEMENT_ARRAY_BUFFER: number;\n    readonly ELEMENT_ARRAY_BUFFER_BINDING: number;\n    readonly EQUAL: number;\n    readonly FASTEST: number;\n    readonly FLOAT: number;\n    readonly FLOAT_MAT2: number;\n    readonly FLOAT_MAT3: number;\n    readonly FLOAT_MAT4: number;\n    readonly FLOAT_VEC2: number;\n    readonly FLOAT_VEC3: number;\n    readonly FLOAT_VEC4: number;\n    readonly FRAGMENT_SHADER: number;\n    readonly FRAMEBUFFER: number;\n    readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number;\n    readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number;\n    readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number;\n    readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number;\n    readonly FRAMEBUFFER_BINDING: number;\n    readonly FRAMEBUFFER_COMPLETE: number;\n    readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number;\n    readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number;\n    readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number;\n    readonly FRAMEBUFFER_UNSUPPORTED: number;\n    readonly FRONT: number;\n    readonly FRONT_AND_BACK: number;\n    readonly FRONT_FACE: number;\n    readonly FUNC_ADD: number;\n    readonly FUNC_REVERSE_SUBTRACT: number;\n    readonly FUNC_SUBTRACT: number;\n    readonly GENERATE_MIPMAP_HINT: number;\n    readonly GEQUAL: number;\n    readonly GREATER: number;\n    readonly GREEN_BITS: number;\n    readonly HIGH_FLOAT: number;\n    readonly HIGH_INT: number;\n    readonly IMPLEMENTATION_COLOR_READ_FORMAT: number;\n    readonly IMPLEMENTATION_COLOR_READ_TYPE: number;\n    readonly INCR: number;\n    readonly INCR_WRAP: number;\n    readonly INT: number;\n    readonly INT_VEC2: number;\n    readonly INT_VEC3: number;\n    readonly INT_VEC4: number;\n    readonly INVALID_ENUM: number;\n    readonly INVALID_FRAMEBUFFER_OPERATION: number;\n    readonly INVALID_OPERATION: number;\n    readonly INVALID_VALUE: number;\n    readonly INVERT: number;\n    readonly KEEP: number;\n    readonly LEQUAL: number;\n    readonly LESS: number;\n    readonly LINEAR: number;\n    readonly LINEAR_MIPMAP_LINEAR: number;\n    readonly LINEAR_MIPMAP_NEAREST: number;\n    readonly LINES: number;\n    readonly LINE_LOOP: number;\n    readonly LINE_STRIP: number;\n    readonly LINE_WIDTH: number;\n    readonly LINK_STATUS: number;\n    readonly LOW_FLOAT: number;\n    readonly LOW_INT: number;\n    readonly LUMINANCE: number;\n    readonly LUMINANCE_ALPHA: number;\n    readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number;\n    readonly MAX_CUBE_MAP_TEXTURE_SIZE: number;\n    readonly MAX_FRAGMENT_UNIFORM_VECTORS: number;\n    readonly MAX_RENDERBUFFER_SIZE: number;\n    readonly MAX_TEXTURE_IMAGE_UNITS: number;\n    readonly MAX_TEXTURE_SIZE: number;\n    readonly MAX_VARYING_VECTORS: number;\n    readonly MAX_VERTEX_ATTRIBS: number;\n    readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number;\n    readonly MAX_VERTEX_UNIFORM_VECTORS: number;\n    readonly MAX_VIEWPORT_DIMS: number;\n    readonly MEDIUM_FLOAT: number;\n    readonly MEDIUM_INT: number;\n    readonly MIRRORED_REPEAT: number;\n    readonly NEAREST: number;\n    readonly NEAREST_MIPMAP_LINEAR: number;\n    readonly NEAREST_MIPMAP_NEAREST: number;\n    readonly NEVER: number;\n    readonly NICEST: number;\n    readonly NONE: number;\n    readonly NOTEQUAL: number;\n    readonly NO_ERROR: number;\n    readonly ONE: number;\n    readonly ONE_MINUS_CONSTANT_ALPHA: number;\n    readonly ONE_MINUS_CONSTANT_COLOR: number;\n    readonly ONE_MINUS_DST_ALPHA: number;\n    readonly ONE_MINUS_DST_COLOR: number;\n    readonly ONE_MINUS_SRC_ALPHA: number;\n    readonly ONE_MINUS_SRC_COLOR: number;\n    readonly OUT_OF_MEMORY: number;\n    readonly PACK_ALIGNMENT: number;\n    readonly POINTS: number;\n    readonly POLYGON_OFFSET_FACTOR: number;\n    readonly POLYGON_OFFSET_FILL: number;\n    readonly POLYGON_OFFSET_UNITS: number;\n    readonly RED_BITS: number;\n    readonly RENDERBUFFER: number;\n    readonly RENDERBUFFER_ALPHA_SIZE: number;\n    readonly RENDERBUFFER_BINDING: number;\n    readonly RENDERBUFFER_BLUE_SIZE: number;\n    readonly RENDERBUFFER_DEPTH_SIZE: number;\n    readonly RENDERBUFFER_GREEN_SIZE: number;\n    readonly RENDERBUFFER_HEIGHT: number;\n    readonly RENDERBUFFER_INTERNAL_FORMAT: number;\n    readonly RENDERBUFFER_RED_SIZE: number;\n    readonly RENDERBUFFER_STENCIL_SIZE: number;\n    readonly RENDERBUFFER_WIDTH: number;\n    readonly RENDERER: number;\n    readonly REPEAT: number;\n    readonly REPLACE: number;\n    readonly RGB: number;\n    readonly RGB565: number;\n    readonly RGB5_A1: number;\n    readonly RGBA: number;\n    readonly RGBA4: number;\n    readonly SAMPLER_2D: number;\n    readonly SAMPLER_CUBE: number;\n    readonly SAMPLES: number;\n    readonly SAMPLE_ALPHA_TO_COVERAGE: number;\n    readonly SAMPLE_BUFFERS: number;\n    readonly SAMPLE_COVERAGE: number;\n    readonly SAMPLE_COVERAGE_INVERT: number;\n    readonly SAMPLE_COVERAGE_VALUE: number;\n    readonly SCISSOR_BOX: number;\n    readonly SCISSOR_TEST: number;\n    readonly SHADER_TYPE: number;\n    readonly SHADING_LANGUAGE_VERSION: number;\n    readonly SHORT: number;\n    readonly SRC_ALPHA: number;\n    readonly SRC_ALPHA_SATURATE: number;\n    readonly SRC_COLOR: number;\n    readonly STATIC_DRAW: number;\n    readonly STENCIL_ATTACHMENT: number;\n    readonly STENCIL_BACK_FAIL: number;\n    readonly STENCIL_BACK_FUNC: number;\n    readonly STENCIL_BACK_PASS_DEPTH_FAIL: number;\n    readonly STENCIL_BACK_PASS_DEPTH_PASS: number;\n    readonly STENCIL_BACK_REF: number;\n    readonly STENCIL_BACK_VALUE_MASK: number;\n    readonly STENCIL_BACK_WRITEMASK: number;\n    readonly STENCIL_BITS: number;\n    readonly STENCIL_BUFFER_BIT: number;\n    readonly STENCIL_CLEAR_VALUE: number;\n    readonly STENCIL_FAIL: number;\n    readonly STENCIL_FUNC: number;\n    readonly STENCIL_INDEX: number;\n    readonly STENCIL_INDEX8: number;\n    readonly STENCIL_PASS_DEPTH_FAIL: number;\n    readonly STENCIL_PASS_DEPTH_PASS: number;\n    readonly STENCIL_REF: number;\n    readonly STENCIL_TEST: number;\n    readonly STENCIL_VALUE_MASK: number;\n    readonly STENCIL_WRITEMASK: number;\n    readonly STREAM_DRAW: number;\n    readonly SUBPIXEL_BITS: number;\n    readonly TEXTURE: number;\n    readonly TEXTURE0: number;\n    readonly TEXTURE1: number;\n    readonly TEXTURE10: number;\n    readonly TEXTURE11: number;\n    readonly TEXTURE12: number;\n    readonly TEXTURE13: number;\n    readonly TEXTURE14: number;\n    readonly TEXTURE15: number;\n    readonly TEXTURE16: number;\n    readonly TEXTURE17: number;\n    readonly TEXTURE18: number;\n    readonly TEXTURE19: number;\n    readonly TEXTURE2: number;\n    readonly TEXTURE20: number;\n    readonly TEXTURE21: number;\n    readonly TEXTURE22: number;\n    readonly TEXTURE23: number;\n    readonly TEXTURE24: number;\n    readonly TEXTURE25: number;\n    readonly TEXTURE26: number;\n    readonly TEXTURE27: number;\n    readonly TEXTURE28: number;\n    readonly TEXTURE29: number;\n    readonly TEXTURE3: number;\n    readonly TEXTURE30: number;\n    readonly TEXTURE31: number;\n    readonly TEXTURE4: number;\n    readonly TEXTURE5: number;\n    readonly TEXTURE6: number;\n    readonly TEXTURE7: number;\n    readonly TEXTURE8: number;\n    readonly TEXTURE9: number;\n    readonly TEXTURE_2D: number;\n    readonly TEXTURE_BINDING_2D: number;\n    readonly TEXTURE_BINDING_CUBE_MAP: number;\n    readonly TEXTURE_CUBE_MAP: number;\n    readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number;\n    readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number;\n    readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number;\n    readonly TEXTURE_CUBE_MAP_POSITIVE_X: number;\n    readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number;\n    readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number;\n    readonly TEXTURE_MAG_FILTER: number;\n    readonly TEXTURE_MIN_FILTER: number;\n    readonly TEXTURE_WRAP_S: number;\n    readonly TEXTURE_WRAP_T: number;\n    readonly TRIANGLES: number;\n    readonly TRIANGLE_FAN: number;\n    readonly TRIANGLE_STRIP: number;\n    readonly UNPACK_ALIGNMENT: number;\n    readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number;\n    readonly UNPACK_FLIP_Y_WEBGL: number;\n    readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number;\n    readonly UNSIGNED_BYTE: number;\n    readonly UNSIGNED_INT: number;\n    readonly UNSIGNED_SHORT: number;\n    readonly UNSIGNED_SHORT_4_4_4_4: number;\n    readonly UNSIGNED_SHORT_5_5_5_1: number;\n    readonly UNSIGNED_SHORT_5_6_5: number;\n    readonly VALIDATE_STATUS: number;\n    readonly VENDOR: number;\n    readonly VERSION: number;\n    readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number;\n    readonly VERTEX_ATTRIB_ARRAY_ENABLED: number;\n    readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number;\n    readonly VERTEX_ATTRIB_ARRAY_POINTER: number;\n    readonly VERTEX_ATTRIB_ARRAY_SIZE: number;\n    readonly VERTEX_ATTRIB_ARRAY_STRIDE: number;\n    readonly VERTEX_ATTRIB_ARRAY_TYPE: number;\n    readonly VERTEX_SHADER: number;\n    readonly VIEWPORT: number;\n    readonly ZERO: number;\n}\n\ninterface WebGLShader extends WebGLObject {\n}\n\ndeclare var WebGLShader: {\n    prototype: WebGLShader;\n    new(): WebGLShader;\n}\n\ninterface WebGLShaderPrecisionFormat {\n    readonly precision: number;\n    readonly rangeMax: number;\n    readonly rangeMin: number;\n}\n\ndeclare var WebGLShaderPrecisionFormat: {\n    prototype: WebGLShaderPrecisionFormat;\n    new(): WebGLShaderPrecisionFormat;\n}\n\ninterface WebGLTexture extends WebGLObject {\n}\n\ndeclare var WebGLTexture: {\n    prototype: WebGLTexture;\n    new(): WebGLTexture;\n}\n\ninterface WebGLUniformLocation {\n}\n\ndeclare var WebGLUniformLocation: {\n    prototype: WebGLUniformLocation;\n    new(): WebGLUniformLocation;\n}\n\ninterface WebKitCSSMatrix {\n    a: number;\n    b: number;\n    c: number;\n    d: number;\n    e: number;\n    f: number;\n    m11: number;\n    m12: number;\n    m13: number;\n    m14: number;\n    m21: number;\n    m22: number;\n    m23: number;\n    m24: number;\n    m31: number;\n    m32: number;\n    m33: number;\n    m34: number;\n    m41: number;\n    m42: number;\n    m43: number;\n    m44: number;\n    inverse(): WebKitCSSMatrix;\n    multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix;\n    rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix;\n    rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix;\n    scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix;\n    setMatrixValue(value: string): void;\n    skewX(angle: number): WebKitCSSMatrix;\n    skewY(angle: number): WebKitCSSMatrix;\n    toString(): string;\n    translate(x: number, y: number, z?: number): WebKitCSSMatrix;\n}\n\ndeclare var WebKitCSSMatrix: {\n    prototype: WebKitCSSMatrix;\n    new(text?: string): WebKitCSSMatrix;\n}\n\ninterface WebKitPoint {\n    x: number;\n    y: number;\n}\n\ndeclare var WebKitPoint: {\n    prototype: WebKitPoint;\n    new(x?: number, y?: number): WebKitPoint;\n}\n\ninterface WebSocketEventMap {\n    \"close\": CloseEvent;\n    \"error\": ErrorEvent;\n    \"message\": MessageEvent;\n    \"open\": Event;\n}\n\ninterface WebSocket extends EventTarget {\n    binaryType: string;\n    readonly bufferedAmount: number;\n    readonly extensions: string;\n    onclose: (this: WebSocket, ev: CloseEvent) => any;\n    onerror: (this: WebSocket, ev: ErrorEvent) => any;\n    onmessage: (this: WebSocket, ev: MessageEvent) => any;\n    onopen: (this: WebSocket, ev: Event) => any;\n    readonly protocol: string;\n    readonly readyState: number;\n    readonly url: string;\n    close(code?: number, reason?: string): void;\n    send(data: any): void;\n    readonly CLOSED: number;\n    readonly CLOSING: number;\n    readonly CONNECTING: number;\n    readonly OPEN: number;\n    addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var WebSocket: {\n    prototype: WebSocket;\n    new(url: string, protocols?: string | string[]): WebSocket;\n    readonly CLOSED: number;\n    readonly CLOSING: number;\n    readonly CONNECTING: number;\n    readonly OPEN: number;\n}\n\ninterface WheelEvent extends MouseEvent {\n    readonly deltaMode: number;\n    readonly deltaX: number;\n    readonly deltaY: number;\n    readonly deltaZ: number;\n    readonly wheelDelta: number;\n    readonly wheelDeltaX: number;\n    readonly wheelDeltaY: number;\n    getCurrentPoint(element: Element): void;\n    initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void;\n    readonly DOM_DELTA_LINE: number;\n    readonly DOM_DELTA_PAGE: number;\n    readonly DOM_DELTA_PIXEL: number;\n}\n\ndeclare var WheelEvent: {\n    prototype: WheelEvent;\n    new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent;\n    readonly DOM_DELTA_LINE: number;\n    readonly DOM_DELTA_PAGE: number;\n    readonly DOM_DELTA_PIXEL: number;\n}\n\ninterface WindowEventMap extends GlobalEventHandlersEventMap {\n    \"abort\": UIEvent;\n    \"afterprint\": Event;\n    \"beforeprint\": Event;\n    \"beforeunload\": BeforeUnloadEvent;\n    \"blur\": FocusEvent;\n    \"canplay\": Event;\n    \"canplaythrough\": Event;\n    \"change\": Event;\n    \"click\": MouseEvent;\n    \"compassneedscalibration\": Event;\n    \"contextmenu\": PointerEvent;\n    \"dblclick\": MouseEvent;\n    \"devicelight\": DeviceLightEvent;\n    \"devicemotion\": DeviceMotionEvent;\n    \"deviceorientation\": DeviceOrientationEvent;\n    \"drag\": DragEvent;\n    \"dragend\": DragEvent;\n    \"dragenter\": DragEvent;\n    \"dragleave\": DragEvent;\n    \"dragover\": DragEvent;\n    \"dragstart\": DragEvent;\n    \"drop\": DragEvent;\n    \"durationchange\": Event;\n    \"emptied\": Event;\n    \"ended\": MediaStreamErrorEvent;\n    \"focus\": FocusEvent;\n    \"hashchange\": HashChangeEvent;\n    \"input\": Event;\n    \"invalid\": Event;\n    \"keydown\": KeyboardEvent;\n    \"keypress\": KeyboardEvent;\n    \"keyup\": KeyboardEvent;\n    \"load\": Event;\n    \"loadeddata\": Event;\n    \"loadedmetadata\": Event;\n    \"loadstart\": Event;\n    \"message\": MessageEvent;\n    \"mousedown\": MouseEvent;\n    \"mouseenter\": MouseEvent;\n    \"mouseleave\": MouseEvent;\n    \"mousemove\": MouseEvent;\n    \"mouseout\": MouseEvent;\n    \"mouseover\": MouseEvent;\n    \"mouseup\": MouseEvent;\n    \"mousewheel\": WheelEvent;\n    \"MSGestureChange\": MSGestureEvent;\n    \"MSGestureDoubleTap\": MSGestureEvent;\n    \"MSGestureEnd\": MSGestureEvent;\n    \"MSGestureHold\": MSGestureEvent;\n    \"MSGestureStart\": MSGestureEvent;\n    \"MSGestureTap\": MSGestureEvent;\n    \"MSInertiaStart\": MSGestureEvent;\n    \"MSPointerCancel\": MSPointerEvent;\n    \"MSPointerDown\": MSPointerEvent;\n    \"MSPointerEnter\": MSPointerEvent;\n    \"MSPointerLeave\": MSPointerEvent;\n    \"MSPointerMove\": MSPointerEvent;\n    \"MSPointerOut\": MSPointerEvent;\n    \"MSPointerOver\": MSPointerEvent;\n    \"MSPointerUp\": MSPointerEvent;\n    \"offline\": Event;\n    \"online\": Event;\n    \"orientationchange\": Event;\n    \"pagehide\": PageTransitionEvent;\n    \"pageshow\": PageTransitionEvent;\n    \"pause\": Event;\n    \"play\": Event;\n    \"playing\": Event;\n    \"popstate\": PopStateEvent;\n    \"progress\": ProgressEvent;\n    \"ratechange\": Event;\n    \"readystatechange\": ProgressEvent;\n    \"reset\": Event;\n    \"resize\": UIEvent;\n    \"scroll\": UIEvent;\n    \"seeked\": Event;\n    \"seeking\": Event;\n    \"select\": UIEvent;\n    \"stalled\": Event;\n    \"storage\": StorageEvent;\n    \"submit\": Event;\n    \"suspend\": Event;\n    \"timeupdate\": Event;\n    \"unload\": Event;\n    \"volumechange\": Event;\n    \"waiting\": Event;\n}\n\ninterface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 {\n    readonly applicationCache: ApplicationCache;\n    readonly clientInformation: Navigator;\n    readonly closed: boolean;\n    readonly crypto: Crypto;\n    defaultStatus: string;\n    readonly devicePixelRatio: number;\n    readonly doNotTrack: string;\n    readonly document: Document;\n    event: Event | undefined;\n    readonly external: External;\n    readonly frameElement: Element;\n    readonly frames: Window;\n    readonly history: History;\n    readonly innerHeight: number;\n    readonly innerWidth: number;\n    readonly length: number;\n    readonly location: Location;\n    readonly locationbar: BarProp;\n    readonly menubar: BarProp;\n    readonly msCredentials: MSCredentials;\n    name: string;\n    readonly navigator: Navigator;\n    offscreenBuffering: string | boolean;\n    onabort: (this: Window, ev: UIEvent) => any;\n    onafterprint: (this: Window, ev: Event) => any;\n    onbeforeprint: (this: Window, ev: Event) => any;\n    onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any;\n    onblur: (this: Window, ev: FocusEvent) => any;\n    oncanplay: (this: Window, ev: Event) => any;\n    oncanplaythrough: (this: Window, ev: Event) => any;\n    onchange: (this: Window, ev: Event) => any;\n    onclick: (this: Window, ev: MouseEvent) => any;\n    oncompassneedscalibration: (this: Window, ev: Event) => any;\n    oncontextmenu: (this: Window, ev: PointerEvent) => any;\n    ondblclick: (this: Window, ev: MouseEvent) => any;\n    ondevicelight: (this: Window, ev: DeviceLightEvent) => any;\n    ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any;\n    ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any;\n    ondrag: (this: Window, ev: DragEvent) => any;\n    ondragend: (this: Window, ev: DragEvent) => any;\n    ondragenter: (this: Window, ev: DragEvent) => any;\n    ondragleave: (this: Window, ev: DragEvent) => any;\n    ondragover: (this: Window, ev: DragEvent) => any;\n    ondragstart: (this: Window, ev: DragEvent) => any;\n    ondrop: (this: Window, ev: DragEvent) => any;\n    ondurationchange: (this: Window, ev: Event) => any;\n    onemptied: (this: Window, ev: Event) => any;\n    onended: (this: Window, ev: MediaStreamErrorEvent) => any;\n    onerror: ErrorEventHandler;\n    onfocus: (this: Window, ev: FocusEvent) => any;\n    onhashchange: (this: Window, ev: HashChangeEvent) => any;\n    oninput: (this: Window, ev: Event) => any;\n    oninvalid: (this: Window, ev: Event) => any;\n    onkeydown: (this: Window, ev: KeyboardEvent) => any;\n    onkeypress: (this: Window, ev: KeyboardEvent) => any;\n    onkeyup: (this: Window, ev: KeyboardEvent) => any;\n    onload: (this: Window, ev: Event) => any;\n    onloadeddata: (this: Window, ev: Event) => any;\n    onloadedmetadata: (this: Window, ev: Event) => any;\n    onloadstart: (this: Window, ev: Event) => any;\n    onmessage: (this: Window, ev: MessageEvent) => any;\n    onmousedown: (this: Window, ev: MouseEvent) => any;\n    onmouseenter: (this: Window, ev: MouseEvent) => any;\n    onmouseleave: (this: Window, ev: MouseEvent) => any;\n    onmousemove: (this: Window, ev: MouseEvent) => any;\n    onmouseout: (this: Window, ev: MouseEvent) => any;\n    onmouseover: (this: Window, ev: MouseEvent) => any;\n    onmouseup: (this: Window, ev: MouseEvent) => any;\n    onmousewheel: (this: Window, ev: WheelEvent) => any;\n    onmsgesturechange: (this: Window, ev: MSGestureEvent) => any;\n    onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any;\n    onmsgestureend: (this: Window, ev: MSGestureEvent) => any;\n    onmsgesturehold: (this: Window, ev: MSGestureEvent) => any;\n    onmsgesturestart: (this: Window, ev: MSGestureEvent) => any;\n    onmsgesturetap: (this: Window, ev: MSGestureEvent) => any;\n    onmsinertiastart: (this: Window, ev: MSGestureEvent) => any;\n    onmspointercancel: (this: Window, ev: MSPointerEvent) => any;\n    onmspointerdown: (this: Window, ev: MSPointerEvent) => any;\n    onmspointerenter: (this: Window, ev: MSPointerEvent) => any;\n    onmspointerleave: (this: Window, ev: MSPointerEvent) => any;\n    onmspointermove: (this: Window, ev: MSPointerEvent) => any;\n    onmspointerout: (this: Window, ev: MSPointerEvent) => any;\n    onmspointerover: (this: Window, ev: MSPointerEvent) => any;\n    onmspointerup: (this: Window, ev: MSPointerEvent) => any;\n    onoffline: (this: Window, ev: Event) => any;\n    ononline: (this: Window, ev: Event) => any;\n    onorientationchange: (this: Window, ev: Event) => any;\n    onpagehide: (this: Window, ev: PageTransitionEvent) => any;\n    onpageshow: (this: Window, ev: PageTransitionEvent) => any;\n    onpause: (this: Window, ev: Event) => any;\n    onplay: (this: Window, ev: Event) => any;\n    onplaying: (this: Window, ev: Event) => any;\n    onpopstate: (this: Window, ev: PopStateEvent) => any;\n    onprogress: (this: Window, ev: ProgressEvent) => any;\n    onratechange: (this: Window, ev: Event) => any;\n    onreadystatechange: (this: Window, ev: ProgressEvent) => any;\n    onreset: (this: Window, ev: Event) => any;\n    onresize: (this: Window, ev: UIEvent) => any;\n    onscroll: (this: Window, ev: UIEvent) => any;\n    onseeked: (this: Window, ev: Event) => any;\n    onseeking: (this: Window, ev: Event) => any;\n    onselect: (this: Window, ev: UIEvent) => any;\n    onstalled: (this: Window, ev: Event) => any;\n    onstorage: (this: Window, ev: StorageEvent) => any;\n    onsubmit: (this: Window, ev: Event) => any;\n    onsuspend: (this: Window, ev: Event) => any;\n    ontimeupdate: (this: Window, ev: Event) => any;\n    ontouchcancel: (ev: TouchEvent) => any;\n    ontouchend: (ev: TouchEvent) => any;\n    ontouchmove: (ev: TouchEvent) => any;\n    ontouchstart: (ev: TouchEvent) => any;\n    onunload: (this: Window, ev: Event) => any;\n    onvolumechange: (this: Window, ev: Event) => any;\n    onwaiting: (this: Window, ev: Event) => any;\n    opener: any;\n    orientation: string | number;\n    readonly outerHeight: number;\n    readonly outerWidth: number;\n    readonly pageXOffset: number;\n    readonly pageYOffset: number;\n    readonly parent: Window;\n    readonly performance: Performance;\n    readonly personalbar: BarProp;\n    readonly screen: Screen;\n    readonly screenLeft: number;\n    readonly screenTop: number;\n    readonly screenX: number;\n    readonly screenY: number;\n    readonly scrollX: number;\n    readonly scrollY: number;\n    readonly scrollbars: BarProp;\n    readonly self: Window;\n    status: string;\n    readonly statusbar: BarProp;\n    readonly styleMedia: StyleMedia;\n    readonly toolbar: BarProp;\n    readonly top: Window;\n    readonly window: Window;\n    URL: typeof URL;\n    Blob: typeof Blob;\n    alert(message?: any): void;\n    blur(): void;\n    cancelAnimationFrame(handle: number): void;\n    captureEvents(): void;\n    close(): void;\n    confirm(message?: string): boolean;\n    focus(): void;\n    getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\n    getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList;\n    getSelection(): Selection;\n    matchMedia(mediaQuery: string): MediaQueryList;\n    moveBy(x?: number, y?: number): void;\n    moveTo(x?: number, y?: number): void;\n    msWriteProfilerMark(profilerMarkName: string): void;\n    open(url?: string, target?: string, features?: string, replace?: boolean): Window;\n    postMessage(message: any, targetOrigin: string, transfer?: any[]): void;\n    print(): void;\n    prompt(message?: string, _default?: string): string | null;\n    releaseEvents(): void;\n    requestAnimationFrame(callback: FrameRequestCallback): number;\n    resizeBy(x?: number, y?: number): void;\n    resizeTo(x?: number, y?: number): void;\n    scroll(x?: number, y?: number): void;\n    scrollBy(x?: number, y?: number): void;\n    scrollTo(x?: number, y?: number): void;\n    webkitCancelAnimationFrame(handle: number): void;\n    webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;\n    webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;\n    webkitRequestAnimationFrame(callback: FrameRequestCallback): number;\n    scroll(options?: ScrollToOptions): void;\n    scrollTo(options?: ScrollToOptions): void;\n    scrollBy(options?: ScrollToOptions): void;\n    addEventListener<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Window: {\n    prototype: Window;\n    new(): Window;\n}\n\ninterface WorkerEventMap extends AbstractWorkerEventMap {\n    \"message\": MessageEvent;\n}\n\ninterface Worker extends EventTarget, AbstractWorker {\n    onmessage: (this: Worker, ev: MessageEvent) => any;\n    postMessage(message: any, ports?: any): void;\n    terminate(): void;\n    addEventListener<K extends keyof WorkerEventMap>(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Worker: {\n    prototype: Worker;\n    new(stringUrl: string): Worker;\n}\n\ninterface XMLDocument extends Document {\n    addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var XMLDocument: {\n    prototype: XMLDocument;\n    new(): XMLDocument;\n}\n\ninterface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap {\n    \"readystatechange\": Event;\n}\n\ninterface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {\n    onreadystatechange: (this: XMLHttpRequest, ev: Event) => any;\n    readonly readyState: number;\n    readonly response: any;\n    readonly responseText: string;\n    responseType: string;\n    readonly responseXML: any;\n    readonly status: number;\n    readonly statusText: string;\n    timeout: number;\n    readonly upload: XMLHttpRequestUpload;\n    withCredentials: boolean;\n    msCaching?: string;\n    readonly responseURL: string;\n    abort(): void;\n    getAllResponseHeaders(): string;\n    getResponseHeader(header: string): string | null;\n    msCachingEnabled(): boolean;\n    open(method: string, url: string, async?: boolean, user?: string, password?: string): void;\n    overrideMimeType(mime: string): void;\n    send(data?: Document): void;\n    send(data?: string): void;\n    send(data?: any): void;\n    setRequestHeader(header: string, value: string): void;\n    readonly DONE: number;\n    readonly HEADERS_RECEIVED: number;\n    readonly LOADING: number;\n    readonly OPENED: number;\n    readonly UNSENT: number;\n    addEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var XMLHttpRequest: {\n    prototype: XMLHttpRequest;\n    new(): XMLHttpRequest;\n    readonly DONE: number;\n    readonly HEADERS_RECEIVED: number;\n    readonly LOADING: number;\n    readonly OPENED: number;\n    readonly UNSENT: number;\n    create(): XMLHttpRequest;\n}\n\ninterface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {\n    addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var XMLHttpRequestUpload: {\n    prototype: XMLHttpRequestUpload;\n    new(): XMLHttpRequestUpload;\n}\n\ninterface XMLSerializer {\n    serializeToString(target: Node): string;\n}\n\ndeclare var XMLSerializer: {\n    prototype: XMLSerializer;\n    new(): XMLSerializer;\n}\n\ninterface XPathEvaluator {\n    createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;\n    createNSResolver(nodeResolver?: Node): XPathNSResolver;\n    evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult;\n}\n\ndeclare var XPathEvaluator: {\n    prototype: XPathEvaluator;\n    new(): XPathEvaluator;\n}\n\ninterface XPathExpression {\n    evaluate(contextNode: Node, type: number, result: XPathResult | null): XPathResult;\n}\n\ndeclare var XPathExpression: {\n    prototype: XPathExpression;\n    new(): XPathExpression;\n}\n\ninterface XPathNSResolver {\n    lookupNamespaceURI(prefix: string): string;\n}\n\ndeclare var XPathNSResolver: {\n    prototype: XPathNSResolver;\n    new(): XPathNSResolver;\n}\n\ninterface XPathResult {\n    readonly booleanValue: boolean;\n    readonly invalidIteratorState: boolean;\n    readonly numberValue: number;\n    readonly resultType: number;\n    readonly singleNodeValue: Node;\n    readonly snapshotLength: number;\n    readonly stringValue: string;\n    iterateNext(): Node;\n    snapshotItem(index: number): Node;\n    readonly ANY_TYPE: number;\n    readonly ANY_UNORDERED_NODE_TYPE: number;\n    readonly BOOLEAN_TYPE: number;\n    readonly FIRST_ORDERED_NODE_TYPE: number;\n    readonly NUMBER_TYPE: number;\n    readonly ORDERED_NODE_ITERATOR_TYPE: number;\n    readonly ORDERED_NODE_SNAPSHOT_TYPE: number;\n    readonly STRING_TYPE: number;\n    readonly UNORDERED_NODE_ITERATOR_TYPE: number;\n    readonly UNORDERED_NODE_SNAPSHOT_TYPE: number;\n}\n\ndeclare var XPathResult: {\n    prototype: XPathResult;\n    new(): XPathResult;\n    readonly ANY_TYPE: number;\n    readonly ANY_UNORDERED_NODE_TYPE: number;\n    readonly BOOLEAN_TYPE: number;\n    readonly FIRST_ORDERED_NODE_TYPE: number;\n    readonly NUMBER_TYPE: number;\n    readonly ORDERED_NODE_ITERATOR_TYPE: number;\n    readonly ORDERED_NODE_SNAPSHOT_TYPE: number;\n    readonly STRING_TYPE: number;\n    readonly UNORDERED_NODE_ITERATOR_TYPE: number;\n    readonly UNORDERED_NODE_SNAPSHOT_TYPE: number;\n}\n\ninterface XSLTProcessor {\n    clearParameters(): void;\n    getParameter(namespaceURI: string, localName: string): any;\n    importStylesheet(style: Node): void;\n    removeParameter(namespaceURI: string, localName: string): void;\n    reset(): void;\n    setParameter(namespaceURI: string, localName: string, value: any): void;\n    transformToDocument(source: Node): Document;\n    transformToFragment(source: Node, document: Document): DocumentFragment;\n}\n\ndeclare var XSLTProcessor: {\n    prototype: XSLTProcessor;\n    new(): XSLTProcessor;\n}\n\ninterface AbstractWorkerEventMap {\n    \"error\": ErrorEvent;\n}\n\ninterface AbstractWorker {\n    onerror: (this: AbstractWorker, ev: ErrorEvent) => any;\n    addEventListener<K extends keyof AbstractWorkerEventMap>(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ninterface CanvasPathMethods {\n    arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\n    arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;\n    bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;\n    closePath(): void;\n    ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\n    lineTo(x: number, y: number): void;\n    moveTo(x: number, y: number): void;\n    quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;\n    rect(x: number, y: number, w: number, h: number): void;\n}\n\ninterface ChildNode {\n    remove(): void;\n}\n\ninterface DOML2DeprecatedColorProperty {\n    color: string;\n}\n\ninterface DOML2DeprecatedSizeProperty {\n    size: number;\n}\n\ninterface DocumentEvent {\n    createEvent(eventInterface:\"AnimationEvent\"): AnimationEvent;\n    createEvent(eventInterface:\"AriaRequestEvent\"): AriaRequestEvent;\n    createEvent(eventInterface:\"AudioProcessingEvent\"): AudioProcessingEvent;\n    createEvent(eventInterface:\"BeforeUnloadEvent\"): BeforeUnloadEvent;\n    createEvent(eventInterface:\"ClipboardEvent\"): ClipboardEvent;\n    createEvent(eventInterface:\"CloseEvent\"): CloseEvent;\n    createEvent(eventInterface:\"CommandEvent\"): CommandEvent;\n    createEvent(eventInterface:\"CompositionEvent\"): CompositionEvent;\n    createEvent(eventInterface:\"CustomEvent\"): CustomEvent;\n    createEvent(eventInterface:\"DeviceLightEvent\"): DeviceLightEvent;\n    createEvent(eventInterface:\"DeviceMotionEvent\"): DeviceMotionEvent;\n    createEvent(eventInterface:\"DeviceOrientationEvent\"): DeviceOrientationEvent;\n    createEvent(eventInterface:\"DragEvent\"): DragEvent;\n    createEvent(eventInterface:\"ErrorEvent\"): ErrorEvent;\n    createEvent(eventInterface:\"Event\"): Event;\n    createEvent(eventInterface:\"Events\"): Event;\n    createEvent(eventInterface:\"FocusEvent\"): FocusEvent;\n    createEvent(eventInterface:\"GamepadEvent\"): GamepadEvent;\n    createEvent(eventInterface:\"HashChangeEvent\"): HashChangeEvent;\n    createEvent(eventInterface:\"IDBVersionChangeEvent\"): IDBVersionChangeEvent;\n    createEvent(eventInterface:\"KeyboardEvent\"): KeyboardEvent;\n    createEvent(eventInterface:\"ListeningStateChangedEvent\"): ListeningStateChangedEvent;\n    createEvent(eventInterface:\"LongRunningScriptDetectedEvent\"): LongRunningScriptDetectedEvent;\n    createEvent(eventInterface:\"MSGestureEvent\"): MSGestureEvent;\n    createEvent(eventInterface:\"MSManipulationEvent\"): MSManipulationEvent;\n    createEvent(eventInterface:\"MSMediaKeyMessageEvent\"): MSMediaKeyMessageEvent;\n    createEvent(eventInterface:\"MSMediaKeyNeededEvent\"): MSMediaKeyNeededEvent;\n    createEvent(eventInterface:\"MSPointerEvent\"): MSPointerEvent;\n    createEvent(eventInterface:\"MSSiteModeEvent\"): MSSiteModeEvent;\n    createEvent(eventInterface:\"MediaEncryptedEvent\"): MediaEncryptedEvent;\n    createEvent(eventInterface:\"MediaKeyMessageEvent\"): MediaKeyMessageEvent;\n    createEvent(eventInterface:\"MediaStreamErrorEvent\"): MediaStreamErrorEvent;\n    createEvent(eventInterface:\"MediaStreamTrackEvent\"): MediaStreamTrackEvent;\n    createEvent(eventInterface:\"MessageEvent\"): MessageEvent;\n    createEvent(eventInterface:\"MouseEvent\"): MouseEvent;\n    createEvent(eventInterface:\"MouseEvents\"): MouseEvent;\n    createEvent(eventInterface:\"MutationEvent\"): MutationEvent;\n    createEvent(eventInterface:\"MutationEvents\"): MutationEvent;\n    createEvent(eventInterface:\"NavigationCompletedEvent\"): NavigationCompletedEvent;\n    createEvent(eventInterface:\"NavigationEvent\"): NavigationEvent;\n    createEvent(eventInterface:\"NavigationEventWithReferrer\"): NavigationEventWithReferrer;\n    createEvent(eventInterface:\"OfflineAudioCompletionEvent\"): OfflineAudioCompletionEvent;\n    createEvent(eventInterface:\"OverflowEvent\"): OverflowEvent;\n    createEvent(eventInterface:\"PageTransitionEvent\"): PageTransitionEvent;\n    createEvent(eventInterface:\"PermissionRequestedEvent\"): PermissionRequestedEvent;\n    createEvent(eventInterface:\"PointerEvent\"): PointerEvent;\n    createEvent(eventInterface:\"PopStateEvent\"): PopStateEvent;\n    createEvent(eventInterface:\"ProgressEvent\"): ProgressEvent;\n    createEvent(eventInterface:\"RTCDTMFToneChangeEvent\"): RTCDTMFToneChangeEvent;\n    createEvent(eventInterface:\"RTCDtlsTransportStateChangedEvent\"): RTCDtlsTransportStateChangedEvent;\n    createEvent(eventInterface:\"RTCIceCandidatePairChangedEvent\"): RTCIceCandidatePairChangedEvent;\n    createEvent(eventInterface:\"RTCIceGathererEvent\"): RTCIceGathererEvent;\n    createEvent(eventInterface:\"RTCIceTransportStateChangedEvent\"): RTCIceTransportStateChangedEvent;\n    createEvent(eventInterface:\"RTCSsrcConflictEvent\"): RTCSsrcConflictEvent;\n    createEvent(eventInterface:\"SVGZoomEvent\"): SVGZoomEvent;\n    createEvent(eventInterface:\"SVGZoomEvents\"): SVGZoomEvent;\n    createEvent(eventInterface:\"ScriptNotifyEvent\"): ScriptNotifyEvent;\n    createEvent(eventInterface:\"StorageEvent\"): StorageEvent;\n    createEvent(eventInterface:\"TextEvent\"): TextEvent;\n    createEvent(eventInterface:\"TouchEvent\"): TouchEvent;\n    createEvent(eventInterface:\"TrackEvent\"): TrackEvent;\n    createEvent(eventInterface:\"TransitionEvent\"): TransitionEvent;\n    createEvent(eventInterface:\"UIEvent\"): UIEvent;\n    createEvent(eventInterface:\"UIEvents\"): UIEvent;\n    createEvent(eventInterface:\"UnviewableContentIdentifiedEvent\"): UnviewableContentIdentifiedEvent;\n    createEvent(eventInterface:\"WebGLContextEvent\"): WebGLContextEvent;\n    createEvent(eventInterface:\"WheelEvent\"): WheelEvent;\n    createEvent(eventInterface: string): Event;\n}\n\ninterface ElementTraversal {\n    readonly childElementCount: number;\n    readonly firstElementChild: Element;\n    readonly lastElementChild: Element;\n    readonly nextElementSibling: Element;\n    readonly previousElementSibling: Element;\n}\n\ninterface GetSVGDocument {\n    getSVGDocument(): Document;\n}\n\ninterface GlobalEventHandlersEventMap {\n    \"pointercancel\": PointerEvent;\n    \"pointerdown\": PointerEvent;\n    \"pointerenter\": PointerEvent;\n    \"pointerleave\": PointerEvent;\n    \"pointermove\": PointerEvent;\n    \"pointerout\": PointerEvent;\n    \"pointerover\": PointerEvent;\n    \"pointerup\": PointerEvent;\n    \"wheel\": WheelEvent;\n}\n\ninterface GlobalEventHandlers {\n    onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n    onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n    onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n    onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n    onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n    onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n    onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n    onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n    onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any;\n    addEventListener<K extends keyof GlobalEventHandlersEventMap>(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ninterface HTMLTableAlignment {\n    /**\n      * Sets or retrieves a value that you can use to implement your own ch functionality for the object.\n      */\n    ch: string;\n    /**\n      * Sets or retrieves a value that you can use to implement your own chOff functionality for the object.\n      */\n    chOff: string;\n    /**\n      * Sets or retrieves how text and other content are vertically aligned within the object that contains them.\n      */\n    vAlign: string;\n}\n\ninterface IDBEnvironment {\n    readonly indexedDB: IDBFactory;\n}\n\ninterface LinkStyle {\n    readonly sheet: StyleSheet;\n}\n\ninterface MSBaseReaderEventMap {\n    \"abort\": Event;\n    \"error\": ErrorEvent;\n    \"load\": Event;\n    \"loadend\": ProgressEvent;\n    \"loadstart\": Event;\n    \"progress\": ProgressEvent;\n}\n\ninterface MSBaseReader {\n    onabort: (this: MSBaseReader, ev: Event) => any;\n    onerror: (this: MSBaseReader, ev: ErrorEvent) => any;\n    onload: (this: MSBaseReader, ev: Event) => any;\n    onloadend: (this: MSBaseReader, ev: ProgressEvent) => any;\n    onloadstart: (this: MSBaseReader, ev: Event) => any;\n    onprogress: (this: MSBaseReader, ev: ProgressEvent) => any;\n    readonly readyState: number;\n    readonly result: any;\n    abort(): void;\n    readonly DONE: number;\n    readonly EMPTY: number;\n    readonly LOADING: number;\n    addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ninterface MSFileSaver {\n    msSaveBlob(blob: any, defaultName?: string): boolean;\n    msSaveOrOpenBlob(blob: any, defaultName?: string): boolean;\n}\n\ninterface MSNavigatorDoNotTrack {\n    confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean;\n    confirmWebWideTrackingException(args: ExceptionInformation): boolean;\n    removeSiteSpecificTrackingException(args: ExceptionInformation): void;\n    removeWebWideTrackingException(args: ExceptionInformation): void;\n    storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void;\n    storeWebWideTrackingException(args: StoreExceptionsInformation): void;\n}\n\ninterface NavigatorContentUtils {\n}\n\ninterface NavigatorGeolocation {\n    readonly geolocation: Geolocation;\n}\n\ninterface NavigatorID {\n    readonly appName: string;\n    readonly appVersion: string;\n    readonly platform: string;\n    readonly product: string;\n    readonly productSub: string;\n    readonly userAgent: string;\n    readonly vendor: string;\n    readonly vendorSub: string;\n}\n\ninterface NavigatorOnLine {\n    readonly onLine: boolean;\n}\n\ninterface NavigatorStorageUtils {\n}\n\ninterface NavigatorUserMedia {\n    readonly mediaDevices: MediaDevices;\n    getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;\n}\n\ninterface NodeSelector {\n    querySelector<K extends keyof ElementTagNameMap>(selectors: K): ElementTagNameMap[K] | null;\n    querySelector(selectors: string): Element | null;\n    querySelectorAll<K extends keyof ElementListTagNameMap>(selectors: K): ElementListTagNameMap[K];\n    querySelectorAll(selectors: string): NodeListOf<Element>;\n}\n\ninterface RandomSource {\n    getRandomValues(array: ArrayBufferView): ArrayBufferView;\n}\n\ninterface SVGAnimatedPathData {\n    readonly pathSegList: SVGPathSegList;\n}\n\ninterface SVGAnimatedPoints {\n    readonly animatedPoints: SVGPointList;\n    readonly points: SVGPointList;\n}\n\ninterface SVGExternalResourcesRequired {\n    readonly externalResourcesRequired: SVGAnimatedBoolean;\n}\n\ninterface SVGFilterPrimitiveStandardAttributes extends SVGStylable {\n    readonly height: SVGAnimatedLength;\n    readonly result: SVGAnimatedString;\n    readonly width: SVGAnimatedLength;\n    readonly x: SVGAnimatedLength;\n    readonly y: SVGAnimatedLength;\n}\n\ninterface SVGFitToViewBox {\n    readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\n    readonly viewBox: SVGAnimatedRect;\n}\n\ninterface SVGLangSpace {\n    xmllang: string;\n    xmlspace: string;\n}\n\ninterface SVGLocatable {\n    readonly farthestViewportElement: SVGElement;\n    readonly nearestViewportElement: SVGElement;\n    getBBox(): SVGRect;\n    getCTM(): SVGMatrix;\n    getScreenCTM(): SVGMatrix;\n    getTransformToElement(element: SVGElement): SVGMatrix;\n}\n\ninterface SVGStylable {\n    className: any;\n    readonly style: CSSStyleDeclaration;\n}\n\ninterface SVGTests {\n    readonly requiredExtensions: SVGStringList;\n    readonly requiredFeatures: SVGStringList;\n    readonly systemLanguage: SVGStringList;\n    hasExtension(extension: string): boolean;\n}\n\ninterface SVGTransformable extends SVGLocatable {\n    readonly transform: SVGAnimatedTransformList;\n}\n\ninterface SVGURIReference {\n    readonly href: SVGAnimatedString;\n}\n\ninterface WindowBase64 {\n    atob(encodedString: string): string;\n    btoa(rawString: string): string;\n}\n\ninterface WindowConsole {\n    readonly console: Console;\n}\n\ninterface WindowLocalStorage {\n    readonly localStorage: Storage;\n}\n\ninterface WindowSessionStorage {\n    readonly sessionStorage: Storage;\n}\n\ninterface WindowTimers extends Object, WindowTimersExtension {\n    clearInterval(handle: number): void;\n    clearTimeout(handle: number): void;\n    setInterval(handler: (...args: any[]) => void, timeout: number): number;\n    setInterval(handler: any, timeout?: any, ...args: any[]): number;\n    setTimeout(handler: (...args: any[]) => void, timeout: number): number;\n    setTimeout(handler: any, timeout?: any, ...args: any[]): number;\n}\n\ninterface WindowTimersExtension {\n    clearImmediate(handle: number): void;\n    setImmediate(handler: (...args: any[]) => void): number;\n    setImmediate(handler: any, ...args: any[]): number;\n}\n\ninterface XMLHttpRequestEventTargetEventMap {\n    \"abort\": Event;\n    \"error\": ErrorEvent;\n    \"load\": Event;\n    \"loadend\": ProgressEvent;\n    \"loadstart\": Event;\n    \"progress\": ProgressEvent;\n    \"timeout\": ProgressEvent;\n}\n\ninterface XMLHttpRequestEventTarget {\n    onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any;\n    onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any;\n    onload: (this: XMLHttpRequestEventTarget, ev: Event) => any;\n    onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;\n    onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any;\n    onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;\n    ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;\n    addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ninterface StorageEventInit extends EventInit {\n    key?: string;\n    oldValue?: string;\n    newValue?: string;\n    url: string;\n    storageArea?: Storage;\n}\n\ninterface Canvas2DContextAttributes {\n    alpha?: boolean;\n    willReadFrequently?: boolean;\n    storage?: boolean;\n    [attribute: string]: boolean | string | undefined;\n}\n\ninterface NodeListOf<TNode extends Node> extends NodeList {\n    length: number;\n    item(index: number): TNode;\n    [index: number]: TNode;\n}\n\ninterface HTMLCollectionOf<T extends Element> extends HTMLCollection {\n    item(index: number): T;\n    namedItem(name: string): T;\n    [index: number]: T;\n}\n\ninterface BlobPropertyBag {\n    type?: string;\n    endings?: string;\n}\n\ninterface FilePropertyBag {\n    type?: string;\n    lastModified?: number;\n}\n\ninterface EventListenerObject {\n    handleEvent(evt: Event): void;\n}\n\ninterface MessageEventInit extends EventInit {\n    data?: any;\n    origin?: string;\n    lastEventId?: string;\n    channel?: string;\n    source?: any;\n    ports?: MessagePort[];\n}\n\ninterface ProgressEventInit extends EventInit {\n    lengthComputable?: boolean;\n    loaded?: number;\n    total?: number;\n}\n\ninterface ScrollOptions {\n    behavior?: ScrollBehavior;\n}\n\ninterface ScrollToOptions extends ScrollOptions {\n    left?: number;\n    top?: number;\n}\n\ninterface ScrollIntoViewOptions extends ScrollOptions {\n    block?: ScrollLogicalPosition;\n    inline?: ScrollLogicalPosition;\n}\n\ninterface ClipboardEventInit extends EventInit {\n    data?: string;\n    dataType?: string;\n}\n\ninterface IDBArrayKey extends Array<IDBValidKey> {\n}\n\ninterface RsaKeyGenParams extends Algorithm {\n    modulusLength: number;\n    publicExponent: Uint8Array;\n}\n\ninterface RsaHashedKeyGenParams extends RsaKeyGenParams {\n    hash: AlgorithmIdentifier;\n}\n\ninterface RsaKeyAlgorithm extends KeyAlgorithm {\n    modulusLength: number;\n    publicExponent: Uint8Array;\n}\n\ninterface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm {\n    hash: AlgorithmIdentifier;\n}\n\ninterface RsaHashedImportParams {\n    hash: AlgorithmIdentifier;\n}\n\ninterface RsaPssParams {\n    saltLength: number;\n}\n\ninterface RsaOaepParams extends Algorithm {\n    label?: BufferSource;\n}\n\ninterface EcdsaParams extends Algorithm {\n    hash: AlgorithmIdentifier;\n}\n\ninterface EcKeyGenParams extends Algorithm {\n    namedCurve: string;\n}\n\ninterface EcKeyAlgorithm extends KeyAlgorithm {\n    typedCurve: string;\n}\n\ninterface EcKeyImportParams {\n    namedCurve: string;\n}\n\ninterface EcdhKeyDeriveParams extends Algorithm {\n    public: CryptoKey;\n}\n\ninterface AesCtrParams extends Algorithm {\n    counter: BufferSource;\n    length: number;\n}\n\ninterface AesKeyAlgorithm extends KeyAlgorithm {\n    length: number;\n}\n\ninterface AesKeyGenParams extends Algorithm {\n    length: number;\n}\n\ninterface AesDerivedKeyParams extends Algorithm {\n    length: number;\n}\n\ninterface AesCbcParams extends Algorithm {\n    iv: BufferSource;\n}\n\ninterface AesCmacParams extends Algorithm {\n    length: number;\n}\n\ninterface AesGcmParams extends Algorithm {\n    iv: BufferSource;\n    additionalData?: BufferSource;\n    tagLength?: number;\n}\n\ninterface AesCfbParams extends Algorithm {\n    iv: BufferSource;\n}\n\ninterface HmacImportParams extends Algorithm {\n    hash?: AlgorithmIdentifier;\n    length?: number;\n}\n\ninterface HmacKeyAlgorithm extends KeyAlgorithm {\n    hash: AlgorithmIdentifier;\n    length: number;\n}\n\ninterface HmacKeyGenParams extends Algorithm {\n    hash: AlgorithmIdentifier;\n    length?: number;\n}\n\ninterface DhKeyGenParams extends Algorithm {\n    prime: Uint8Array;\n    generator: Uint8Array;\n}\n\ninterface DhKeyAlgorithm extends KeyAlgorithm {\n    prime: Uint8Array;\n    generator: Uint8Array;\n}\n\ninterface DhKeyDeriveParams extends Algorithm {\n    public: CryptoKey;\n}\n\ninterface DhImportKeyParams extends Algorithm {\n    prime: Uint8Array;\n    generator: Uint8Array;\n}\n\ninterface ConcatParams extends Algorithm {\n    hash?: AlgorithmIdentifier;\n    algorithmId: Uint8Array;\n    partyUInfo: Uint8Array;\n    partyVInfo: Uint8Array;\n    publicInfo?: Uint8Array;\n    privateInfo?: Uint8Array;\n}\n\ninterface HkdfCtrParams extends Algorithm {\n    hash: AlgorithmIdentifier;\n    label: BufferSource;\n    context: BufferSource;\n}\n\ninterface Pbkdf2Params extends Algorithm {\n    salt: BufferSource;\n    iterations: number;\n    hash: AlgorithmIdentifier;\n}\n\ninterface RsaOtherPrimesInfo {\n    r: string;\n    d: string;\n    t: string;\n}\n\ninterface JsonWebKey {\n    kty: string;\n    use?: string;\n    key_ops?: string[];\n    alg?: string;\n    kid?: string;\n    x5u?: string;\n    x5c?: string;\n    x5t?: string;\n    ext?: boolean;\n    crv?: string;\n    x?: string;\n    y?: string;\n    d?: string;\n    n?: string;\n    e?: string;\n    p?: string;\n    q?: string;\n    dp?: string;\n    dq?: string;\n    qi?: string;\n    oth?: RsaOtherPrimesInfo[];\n    k?: string;\n}\n\ninterface ParentNode {\n    readonly children: HTMLCollection;\n    readonly firstElementChild: Element;\n    readonly lastElementChild: Element;\n    readonly childElementCount: number;\n}\n\ninterface DocumentOrShadowRoot {\n    readonly activeElement: Element | null;\n    readonly stylesheets: StyleSheetList;\n    getSelection(): Selection | null;\n    elementFromPoint(x: number, y: number): Element | null;\n    elementsFromPoint(x: number, y: number): Element[];\n}\n\ninterface ShadowRoot extends DocumentOrShadowRoot, DocumentFragment {\n    readonly host: Element;\n    innerHTML: string;\n}\n\ninterface ShadowRootInit {\n    mode: 'open'|'closed';\n    delegatesFocus?: boolean;\n}\n\ninterface HTMLSlotElement extends HTMLElement {\n    name: string;\n    assignedNodes(options?: AssignedNodesOptions): Node[];\n}\n\ninterface AssignedNodesOptions {\n    flatten?: boolean;\n}\n\ndeclare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;\n\ninterface ErrorEventHandler {\n    (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;\n}\ninterface PositionCallback {\n    (position: Position): void;\n}\ninterface PositionErrorCallback {\n    (error: PositionError): void;\n}\ninterface MediaQueryListListener {\n    (mql: MediaQueryList): void;\n}\ninterface MSLaunchUriCallback {\n    (): void;\n}\ninterface FrameRequestCallback {\n    (time: number): void;\n}\ninterface MSUnsafeFunctionCallback {\n    (): any;\n}\ninterface MSExecAtPriorityFunctionCallback {\n    (...args: any[]): any;\n}\ninterface MutationCallback {\n    (mutations: MutationRecord[], observer: MutationObserver): void;\n}\ninterface DecodeSuccessCallback {\n    (decodedData: AudioBuffer): void;\n}\ninterface DecodeErrorCallback {\n    (error: DOMException): void;\n}\ninterface FunctionStringCallback {\n    (data: string): void;\n}\ninterface NavigatorUserMediaSuccessCallback {\n    (stream: MediaStream): void;\n}\ninterface NavigatorUserMediaErrorCallback {\n    (error: MediaStreamError): void;\n}\ninterface ForEachCallback {\n    (keyId: any, status: string): void;\n}\ninterface HTMLElementTagNameMap {\n    \"a\": HTMLAnchorElement;\n    \"applet\": HTMLAppletElement;\n    \"area\": HTMLAreaElement;\n    \"audio\": HTMLAudioElement;\n    \"base\": HTMLBaseElement;\n    \"basefont\": HTMLBaseFontElement;\n    \"blockquote\": HTMLQuoteElement;\n    \"body\": HTMLBodyElement;\n    \"br\": HTMLBRElement;\n    \"button\": HTMLButtonElement;\n    \"canvas\": HTMLCanvasElement;\n    \"caption\": HTMLTableCaptionElement;\n    \"col\": HTMLTableColElement;\n    \"colgroup\": HTMLTableColElement;\n    \"datalist\": HTMLDataListElement;\n    \"del\": HTMLModElement;\n    \"dir\": HTMLDirectoryElement;\n    \"div\": HTMLDivElement;\n    \"dl\": HTMLDListElement;\n    \"embed\": HTMLEmbedElement;\n    \"fieldset\": HTMLFieldSetElement;\n    \"font\": HTMLFontElement;\n    \"form\": HTMLFormElement;\n    \"frame\": HTMLFrameElement;\n    \"frameset\": HTMLFrameSetElement;\n    \"h1\": HTMLHeadingElement;\n    \"h2\": HTMLHeadingElement;\n    \"h3\": HTMLHeadingElement;\n    \"h4\": HTMLHeadingElement;\n    \"h5\": HTMLHeadingElement;\n    \"h6\": HTMLHeadingElement;\n    \"head\": HTMLHeadElement;\n    \"hr\": HTMLHRElement;\n    \"html\": HTMLHtmlElement;\n    \"iframe\": HTMLIFrameElement;\n    \"img\": HTMLImageElement;\n    \"input\": HTMLInputElement;\n    \"ins\": HTMLModElement;\n    \"isindex\": HTMLUnknownElement;\n    \"label\": HTMLLabelElement;\n    \"legend\": HTMLLegendElement;\n    \"li\": HTMLLIElement;\n    \"link\": HTMLLinkElement;\n    \"listing\": HTMLPreElement;\n    \"map\": HTMLMapElement;\n    \"marquee\": HTMLMarqueeElement;\n    \"menu\": HTMLMenuElement;\n    \"meta\": HTMLMetaElement;\n    \"meter\": HTMLMeterElement;\n    \"nextid\": HTMLUnknownElement;\n    \"object\": HTMLObjectElement;\n    \"ol\": HTMLOListElement;\n    \"optgroup\": HTMLOptGroupElement;\n    \"option\": HTMLOptionElement;\n    \"p\": HTMLParagraphElement;\n    \"param\": HTMLParamElement;\n    \"picture\": HTMLPictureElement;\n    \"pre\": HTMLPreElement;\n    \"progress\": HTMLProgressElement;\n    \"q\": HTMLQuoteElement;\n    \"script\": HTMLScriptElement;\n    \"select\": HTMLSelectElement;\n    \"source\": HTMLSourceElement;\n    \"span\": HTMLSpanElement;\n    \"style\": HTMLStyleElement;\n    \"table\": HTMLTableElement;\n    \"tbody\": HTMLTableSectionElement;\n    \"td\": HTMLTableDataCellElement;\n    \"template\": HTMLTemplateElement;\n    \"textarea\": HTMLTextAreaElement;\n    \"tfoot\": HTMLTableSectionElement;\n    \"th\": HTMLTableHeaderCellElement;\n    \"thead\": HTMLTableSectionElement;\n    \"title\": HTMLTitleElement;\n    \"tr\": HTMLTableRowElement;\n    \"track\": HTMLTrackElement;\n    \"ul\": HTMLUListElement;\n    \"video\": HTMLVideoElement;\n    \"x-ms-webview\": MSHTMLWebViewElement;\n    \"xmp\": HTMLPreElement;\n}\n\ninterface ElementTagNameMap {\n    \"a\": HTMLAnchorElement;\n    \"abbr\": HTMLElement;\n    \"acronym\": HTMLElement;\n    \"address\": HTMLElement;\n    \"applet\": HTMLAppletElement;\n    \"area\": HTMLAreaElement;\n    \"article\": HTMLElement;\n    \"aside\": HTMLElement;\n    \"audio\": HTMLAudioElement;\n    \"b\": HTMLElement;\n    \"base\": HTMLBaseElement;\n    \"basefont\": HTMLBaseFontElement;\n    \"bdo\": HTMLElement;\n    \"big\": HTMLElement;\n    \"blockquote\": HTMLQuoteElement;\n    \"body\": HTMLBodyElement;\n    \"br\": HTMLBRElement;\n    \"button\": HTMLButtonElement;\n    \"canvas\": HTMLCanvasElement;\n    \"caption\": HTMLTableCaptionElement;\n    \"center\": HTMLElement;\n    \"circle\": SVGCircleElement;\n    \"cite\": HTMLElement;\n    \"clippath\": SVGClipPathElement;\n    \"code\": HTMLElement;\n    \"col\": HTMLTableColElement;\n    \"colgroup\": HTMLTableColElement;\n    \"datalist\": HTMLDataListElement;\n    \"dd\": HTMLElement;\n    \"defs\": SVGDefsElement;\n    \"del\": HTMLModElement;\n    \"desc\": SVGDescElement;\n    \"dfn\": HTMLElement;\n    \"dir\": HTMLDirectoryElement;\n    \"div\": HTMLDivElement;\n    \"dl\": HTMLDListElement;\n    \"dt\": HTMLElement;\n    \"ellipse\": SVGEllipseElement;\n    \"em\": HTMLElement;\n    \"embed\": HTMLEmbedElement;\n    \"feblend\": SVGFEBlendElement;\n    \"fecolormatrix\": SVGFEColorMatrixElement;\n    \"fecomponenttransfer\": SVGFEComponentTransferElement;\n    \"fecomposite\": SVGFECompositeElement;\n    \"feconvolvematrix\": SVGFEConvolveMatrixElement;\n    \"fediffuselighting\": SVGFEDiffuseLightingElement;\n    \"fedisplacementmap\": SVGFEDisplacementMapElement;\n    \"fedistantlight\": SVGFEDistantLightElement;\n    \"feflood\": SVGFEFloodElement;\n    \"fefunca\": SVGFEFuncAElement;\n    \"fefuncb\": SVGFEFuncBElement;\n    \"fefuncg\": SVGFEFuncGElement;\n    \"fefuncr\": SVGFEFuncRElement;\n    \"fegaussianblur\": SVGFEGaussianBlurElement;\n    \"feimage\": SVGFEImageElement;\n    \"femerge\": SVGFEMergeElement;\n    \"femergenode\": SVGFEMergeNodeElement;\n    \"femorphology\": SVGFEMorphologyElement;\n    \"feoffset\": SVGFEOffsetElement;\n    \"fepointlight\": SVGFEPointLightElement;\n    \"fespecularlighting\": SVGFESpecularLightingElement;\n    \"fespotlight\": SVGFESpotLightElement;\n    \"fetile\": SVGFETileElement;\n    \"feturbulence\": SVGFETurbulenceElement;\n    \"fieldset\": HTMLFieldSetElement;\n    \"figcaption\": HTMLElement;\n    \"figure\": HTMLElement;\n    \"filter\": SVGFilterElement;\n    \"font\": HTMLFontElement;\n    \"footer\": HTMLElement;\n    \"foreignobject\": SVGForeignObjectElement;\n    \"form\": HTMLFormElement;\n    \"frame\": HTMLFrameElement;\n    \"frameset\": HTMLFrameSetElement;\n    \"g\": SVGGElement;\n    \"h1\": HTMLHeadingElement;\n    \"h2\": HTMLHeadingElement;\n    \"h3\": HTMLHeadingElement;\n    \"h4\": HTMLHeadingElement;\n    \"h5\": HTMLHeadingElement;\n    \"h6\": HTMLHeadingElement;\n    \"head\": HTMLHeadElement;\n    \"header\": HTMLElement;\n    \"hgroup\": HTMLElement;\n    \"hr\": HTMLHRElement;\n    \"html\": HTMLHtmlElement;\n    \"i\": HTMLElement;\n    \"iframe\": HTMLIFrameElement;\n    \"image\": SVGImageElement;\n    \"img\": HTMLImageElement;\n    \"input\": HTMLInputElement;\n    \"ins\": HTMLModElement;\n    \"isindex\": HTMLUnknownElement;\n    \"kbd\": HTMLElement;\n    \"keygen\": HTMLElement;\n    \"label\": HTMLLabelElement;\n    \"legend\": HTMLLegendElement;\n    \"li\": HTMLLIElement;\n    \"line\": SVGLineElement;\n    \"lineargradient\": SVGLinearGradientElement;\n    \"link\": HTMLLinkElement;\n    \"listing\": HTMLPreElement;\n    \"map\": HTMLMapElement;\n    \"mark\": HTMLElement;\n    \"marker\": SVGMarkerElement;\n    \"marquee\": HTMLMarqueeElement;\n    \"mask\": SVGMaskElement;\n    \"menu\": HTMLMenuElement;\n    \"meta\": HTMLMetaElement;\n    \"metadata\": SVGMetadataElement;\n    \"meter\": HTMLMeterElement;\n    \"nav\": HTMLElement;\n    \"nextid\": HTMLUnknownElement;\n    \"nobr\": HTMLElement;\n    \"noframes\": HTMLElement;\n    \"noscript\": HTMLElement;\n    \"object\": HTMLObjectElement;\n    \"ol\": HTMLOListElement;\n    \"optgroup\": HTMLOptGroupElement;\n    \"option\": HTMLOptionElement;\n    \"p\": HTMLParagraphElement;\n    \"param\": HTMLParamElement;\n    \"path\": SVGPathElement;\n    \"pattern\": SVGPatternElement;\n    \"picture\": HTMLPictureElement;\n    \"plaintext\": HTMLElement;\n    \"polygon\": SVGPolygonElement;\n    \"polyline\": SVGPolylineElement;\n    \"pre\": HTMLPreElement;\n    \"progress\": HTMLProgressElement;\n    \"q\": HTMLQuoteElement;\n    \"radialgradient\": SVGRadialGradientElement;\n    \"rect\": SVGRectElement;\n    \"rt\": HTMLElement;\n    \"ruby\": HTMLElement;\n    \"s\": HTMLElement;\n    \"samp\": HTMLElement;\n    \"script\": HTMLScriptElement;\n    \"section\": HTMLElement;\n    \"select\": HTMLSelectElement;\n    \"small\": HTMLElement;\n    \"source\": HTMLSourceElement;\n    \"span\": HTMLSpanElement;\n    \"stop\": SVGStopElement;\n    \"strike\": HTMLElement;\n    \"strong\": HTMLElement;\n    \"style\": HTMLStyleElement;\n    \"sub\": HTMLElement;\n    \"sup\": HTMLElement;\n    \"svg\": SVGSVGElement;\n    \"switch\": SVGSwitchElement;\n    \"symbol\": SVGSymbolElement;\n    \"table\": HTMLTableElement;\n    \"tbody\": HTMLTableSectionElement;\n    \"td\": HTMLTableDataCellElement;\n    \"template\": HTMLTemplateElement;\n    \"text\": SVGTextElement;\n    \"textpath\": SVGTextPathElement;\n    \"textarea\": HTMLTextAreaElement;\n    \"tfoot\": HTMLTableSectionElement;\n    \"th\": HTMLTableHeaderCellElement;\n    \"thead\": HTMLTableSectionElement;\n    \"title\": HTMLTitleElement;\n    \"tr\": HTMLTableRowElement;\n    \"track\": HTMLTrackElement;\n    \"tspan\": SVGTSpanElement;\n    \"tt\": HTMLElement;\n    \"u\": HTMLElement;\n    \"ul\": HTMLUListElement;\n    \"use\": SVGUseElement;\n    \"var\": HTMLElement;\n    \"video\": HTMLVideoElement;\n    \"view\": SVGViewElement;\n    \"wbr\": HTMLElement;\n    \"x-ms-webview\": MSHTMLWebViewElement;\n    \"xmp\": HTMLPreElement;\n}\n\ninterface ElementListTagNameMap {\n    \"a\": NodeListOf<HTMLAnchorElement>;\n    \"abbr\": NodeListOf<HTMLElement>;\n    \"acronym\": NodeListOf<HTMLElement>;\n    \"address\": NodeListOf<HTMLElement>;\n    \"applet\": NodeListOf<HTMLAppletElement>;\n    \"area\": NodeListOf<HTMLAreaElement>;\n    \"article\": NodeListOf<HTMLElement>;\n    \"aside\": NodeListOf<HTMLElement>;\n    \"audio\": NodeListOf<HTMLAudioElement>;\n    \"b\": NodeListOf<HTMLElement>;\n    \"base\": NodeListOf<HTMLBaseElement>;\n    \"basefont\": NodeListOf<HTMLBaseFontElement>;\n    \"bdo\": NodeListOf<HTMLElement>;\n    \"big\": NodeListOf<HTMLElement>;\n    \"blockquote\": NodeListOf<HTMLQuoteElement>;\n    \"body\": NodeListOf<HTMLBodyElement>;\n    \"br\": NodeListOf<HTMLBRElement>;\n    \"button\": NodeListOf<HTMLButtonElement>;\n    \"canvas\": NodeListOf<HTMLCanvasElement>;\n    \"caption\": NodeListOf<HTMLTableCaptionElement>;\n    \"center\": NodeListOf<HTMLElement>;\n    \"circle\": NodeListOf<SVGCircleElement>;\n    \"cite\": NodeListOf<HTMLElement>;\n    \"clippath\": NodeListOf<SVGClipPathElement>;\n    \"code\": NodeListOf<HTMLElement>;\n    \"col\": NodeListOf<HTMLTableColElement>;\n    \"colgroup\": NodeListOf<HTMLTableColElement>;\n    \"datalist\": NodeListOf<HTMLDataListElement>;\n    \"dd\": NodeListOf<HTMLElement>;\n    \"defs\": NodeListOf<SVGDefsElement>;\n    \"del\": NodeListOf<HTMLModElement>;\n    \"desc\": NodeListOf<SVGDescElement>;\n    \"dfn\": NodeListOf<HTMLElement>;\n    \"dir\": NodeListOf<HTMLDirectoryElement>;\n    \"div\": NodeListOf<HTMLDivElement>;\n    \"dl\": NodeListOf<HTMLDListElement>;\n    \"dt\": NodeListOf<HTMLElement>;\n    \"ellipse\": NodeListOf<SVGEllipseElement>;\n    \"em\": NodeListOf<HTMLElement>;\n    \"embed\": NodeListOf<HTMLEmbedElement>;\n    \"feblend\": NodeListOf<SVGFEBlendElement>;\n    \"fecolormatrix\": NodeListOf<SVGFEColorMatrixElement>;\n    \"fecomponenttransfer\": NodeListOf<SVGFEComponentTransferElement>;\n    \"fecomposite\": NodeListOf<SVGFECompositeElement>;\n    \"feconvolvematrix\": NodeListOf<SVGFEConvolveMatrixElement>;\n    \"fediffuselighting\": NodeListOf<SVGFEDiffuseLightingElement>;\n    \"fedisplacementmap\": NodeListOf<SVGFEDisplacementMapElement>;\n    \"fedistantlight\": NodeListOf<SVGFEDistantLightElement>;\n    \"feflood\": NodeListOf<SVGFEFloodElement>;\n    \"fefunca\": NodeListOf<SVGFEFuncAElement>;\n    \"fefuncb\": NodeListOf<SVGFEFuncBElement>;\n    \"fefuncg\": NodeListOf<SVGFEFuncGElement>;\n    \"fefuncr\": NodeListOf<SVGFEFuncRElement>;\n    \"fegaussianblur\": NodeListOf<SVGFEGaussianBlurElement>;\n    \"feimage\": NodeListOf<SVGFEImageElement>;\n    \"femerge\": NodeListOf<SVGFEMergeElement>;\n    \"femergenode\": NodeListOf<SVGFEMergeNodeElement>;\n    \"femorphology\": NodeListOf<SVGFEMorphologyElement>;\n    \"feoffset\": NodeListOf<SVGFEOffsetElement>;\n    \"fepointlight\": NodeListOf<SVGFEPointLightElement>;\n    \"fespecularlighting\": NodeListOf<SVGFESpecularLightingElement>;\n    \"fespotlight\": NodeListOf<SVGFESpotLightElement>;\n    \"fetile\": NodeListOf<SVGFETileElement>;\n    \"feturbulence\": NodeListOf<SVGFETurbulenceElement>;\n    \"fieldset\": NodeListOf<HTMLFieldSetElement>;\n    \"figcaption\": NodeListOf<HTMLElement>;\n    \"figure\": NodeListOf<HTMLElement>;\n    \"filter\": NodeListOf<SVGFilterElement>;\n    \"font\": NodeListOf<HTMLFontElement>;\n    \"footer\": NodeListOf<HTMLElement>;\n    \"foreignobject\": NodeListOf<SVGForeignObjectElement>;\n    \"form\": NodeListOf<HTMLFormElement>;\n    \"frame\": NodeListOf<HTMLFrameElement>;\n    \"frameset\": NodeListOf<HTMLFrameSetElement>;\n    \"g\": NodeListOf<SVGGElement>;\n    \"h1\": NodeListOf<HTMLHeadingElement>;\n    \"h2\": NodeListOf<HTMLHeadingElement>;\n    \"h3\": NodeListOf<HTMLHeadingElement>;\n    \"h4\": NodeListOf<HTMLHeadingElement>;\n    \"h5\": NodeListOf<HTMLHeadingElement>;\n    \"h6\": NodeListOf<HTMLHeadingElement>;\n    \"head\": NodeListOf<HTMLHeadElement>;\n    \"header\": NodeListOf<HTMLElement>;\n    \"hgroup\": NodeListOf<HTMLElement>;\n    \"hr\": NodeListOf<HTMLHRElement>;\n    \"html\": NodeListOf<HTMLHtmlElement>;\n    \"i\": NodeListOf<HTMLElement>;\n    \"iframe\": NodeListOf<HTMLIFrameElement>;\n    \"image\": NodeListOf<SVGImageElement>;\n    \"img\": NodeListOf<HTMLImageElement>;\n    \"input\": NodeListOf<HTMLInputElement>;\n    \"ins\": NodeListOf<HTMLModElement>;\n    \"isindex\": NodeListOf<HTMLUnknownElement>;\n    \"kbd\": NodeListOf<HTMLElement>;\n    \"keygen\": NodeListOf<HTMLElement>;\n    \"label\": NodeListOf<HTMLLabelElement>;\n    \"legend\": NodeListOf<HTMLLegendElement>;\n    \"li\": NodeListOf<HTMLLIElement>;\n    \"line\": NodeListOf<SVGLineElement>;\n    \"lineargradient\": NodeListOf<SVGLinearGradientElement>;\n    \"link\": NodeListOf<HTMLLinkElement>;\n    \"listing\": NodeListOf<HTMLPreElement>;\n    \"map\": NodeListOf<HTMLMapElement>;\n    \"mark\": NodeListOf<HTMLElement>;\n    \"marker\": NodeListOf<SVGMarkerElement>;\n    \"marquee\": NodeListOf<HTMLMarqueeElement>;\n    \"mask\": NodeListOf<SVGMaskElement>;\n    \"menu\": NodeListOf<HTMLMenuElement>;\n    \"meta\": NodeListOf<HTMLMetaElement>;\n    \"metadata\": NodeListOf<SVGMetadataElement>;\n    \"meter\": NodeListOf<HTMLMeterElement>;\n    \"nav\": NodeListOf<HTMLElement>;\n    \"nextid\": NodeListOf<HTMLUnknownElement>;\n    \"nobr\": NodeListOf<HTMLElement>;\n    \"noframes\": NodeListOf<HTMLElement>;\n    \"noscript\": NodeListOf<HTMLElement>;\n    \"object\": NodeListOf<HTMLObjectElement>;\n    \"ol\": NodeListOf<HTMLOListElement>;\n    \"optgroup\": NodeListOf<HTMLOptGroupElement>;\n    \"option\": NodeListOf<HTMLOptionElement>;\n    \"p\": NodeListOf<HTMLParagraphElement>;\n    \"param\": NodeListOf<HTMLParamElement>;\n    \"path\": NodeListOf<SVGPathElement>;\n    \"pattern\": NodeListOf<SVGPatternElement>;\n    \"picture\": NodeListOf<HTMLPictureElement>;\n    \"plaintext\": NodeListOf<HTMLElement>;\n    \"polygon\": NodeListOf<SVGPolygonElement>;\n    \"polyline\": NodeListOf<SVGPolylineElement>;\n    \"pre\": NodeListOf<HTMLPreElement>;\n    \"progress\": NodeListOf<HTMLProgressElement>;\n    \"q\": NodeListOf<HTMLQuoteElement>;\n    \"radialgradient\": NodeListOf<SVGRadialGradientElement>;\n    \"rect\": NodeListOf<SVGRectElement>;\n    \"rt\": NodeListOf<HTMLElement>;\n    \"ruby\": NodeListOf<HTMLElement>;\n    \"s\": NodeListOf<HTMLElement>;\n    \"samp\": NodeListOf<HTMLElement>;\n    \"script\": NodeListOf<HTMLScriptElement>;\n    \"section\": NodeListOf<HTMLElement>;\n    \"select\": NodeListOf<HTMLSelectElement>;\n    \"small\": NodeListOf<HTMLElement>;\n    \"source\": NodeListOf<HTMLSourceElement>;\n    \"span\": NodeListOf<HTMLSpanElement>;\n    \"stop\": NodeListOf<SVGStopElement>;\n    \"strike\": NodeListOf<HTMLElement>;\n    \"strong\": NodeListOf<HTMLElement>;\n    \"style\": NodeListOf<HTMLStyleElement>;\n    \"sub\": NodeListOf<HTMLElement>;\n    \"sup\": NodeListOf<HTMLElement>;\n    \"svg\": NodeListOf<SVGSVGElement>;\n    \"switch\": NodeListOf<SVGSwitchElement>;\n    \"symbol\": NodeListOf<SVGSymbolElement>;\n    \"table\": NodeListOf<HTMLTableElement>;\n    \"tbody\": NodeListOf<HTMLTableSectionElement>;\n    \"td\": NodeListOf<HTMLTableDataCellElement>;\n    \"template\": NodeListOf<HTMLTemplateElement>;\n    \"text\": NodeListOf<SVGTextElement>;\n    \"textpath\": NodeListOf<SVGTextPathElement>;\n    \"textarea\": NodeListOf<HTMLTextAreaElement>;\n    \"tfoot\": NodeListOf<HTMLTableSectionElement>;\n    \"th\": NodeListOf<HTMLTableHeaderCellElement>;\n    \"thead\": NodeListOf<HTMLTableSectionElement>;\n    \"title\": NodeListOf<HTMLTitleElement>;\n    \"tr\": NodeListOf<HTMLTableRowElement>;\n    \"track\": NodeListOf<HTMLTrackElement>;\n    \"tspan\": NodeListOf<SVGTSpanElement>;\n    \"tt\": NodeListOf<HTMLElement>;\n    \"u\": NodeListOf<HTMLElement>;\n    \"ul\": NodeListOf<HTMLUListElement>;\n    \"use\": NodeListOf<SVGUseElement>;\n    \"var\": NodeListOf<HTMLElement>;\n    \"video\": NodeListOf<HTMLVideoElement>;\n    \"view\": NodeListOf<SVGViewElement>;\n    \"wbr\": NodeListOf<HTMLElement>;\n    \"x-ms-webview\": NodeListOf<MSHTMLWebViewElement>;\n    \"xmp\": NodeListOf<HTMLPreElement>;\n}\n\ndeclare var Audio: {new(src?: string): HTMLAudioElement; };\ndeclare var Image: {new(width?: number, height?: number): HTMLImageElement; };\ndeclare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; };\ndeclare var applicationCache: ApplicationCache;\ndeclare var clientInformation: Navigator;\ndeclare var closed: boolean;\ndeclare var crypto: Crypto;\ndeclare var defaultStatus: string;\ndeclare var devicePixelRatio: number;\ndeclare var doNotTrack: string;\ndeclare var document: Document;\ndeclare var event: Event | undefined;\ndeclare var external: External;\ndeclare var frameElement: Element;\ndeclare var frames: Window;\ndeclare var history: History;\ndeclare var innerHeight: number;\ndeclare var innerWidth: number;\ndeclare var length: number;\ndeclare var location: Location;\ndeclare var locationbar: BarProp;\ndeclare var menubar: BarProp;\ndeclare var msCredentials: MSCredentials;\ndeclare const name: never;\ndeclare var navigator: Navigator;\ndeclare var offscreenBuffering: string | boolean;\ndeclare var onabort: (this: Window, ev: UIEvent) => any;\ndeclare var onafterprint: (this: Window, ev: Event) => any;\ndeclare var onbeforeprint: (this: Window, ev: Event) => any;\ndeclare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any;\ndeclare var onblur: (this: Window, ev: FocusEvent) => any;\ndeclare var oncanplay: (this: Window, ev: Event) => any;\ndeclare var oncanplaythrough: (this: Window, ev: Event) => any;\ndeclare var onchange: (this: Window, ev: Event) => any;\ndeclare var onclick: (this: Window, ev: MouseEvent) => any;\ndeclare var oncompassneedscalibration: (this: Window, ev: Event) => any;\ndeclare var oncontextmenu: (this: Window, ev: PointerEvent) => any;\ndeclare var ondblclick: (this: Window, ev: MouseEvent) => any;\ndeclare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any;\ndeclare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any;\ndeclare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any;\ndeclare var ondrag: (this: Window, ev: DragEvent) => any;\ndeclare var ondragend: (this: Window, ev: DragEvent) => any;\ndeclare var ondragenter: (this: Window, ev: DragEvent) => any;\ndeclare var ondragleave: (this: Window, ev: DragEvent) => any;\ndeclare var ondragover: (this: Window, ev: DragEvent) => any;\ndeclare var ondragstart: (this: Window, ev: DragEvent) => any;\ndeclare var ondrop: (this: Window, ev: DragEvent) => any;\ndeclare var ondurationchange: (this: Window, ev: Event) => any;\ndeclare var onemptied: (this: Window, ev: Event) => any;\ndeclare var onended: (this: Window, ev: MediaStreamErrorEvent) => any;\ndeclare var onerror: ErrorEventHandler;\ndeclare var onfocus: (this: Window, ev: FocusEvent) => any;\ndeclare var onhashchange: (this: Window, ev: HashChangeEvent) => any;\ndeclare var oninput: (this: Window, ev: Event) => any;\ndeclare var oninvalid: (this: Window, ev: Event) => any;\ndeclare var onkeydown: (this: Window, ev: KeyboardEvent) => any;\ndeclare var onkeypress: (this: Window, ev: KeyboardEvent) => any;\ndeclare var onkeyup: (this: Window, ev: KeyboardEvent) => any;\ndeclare var onload: (this: Window, ev: Event) => any;\ndeclare var onloadeddata: (this: Window, ev: Event) => any;\ndeclare var onloadedmetadata: (this: Window, ev: Event) => any;\ndeclare var onloadstart: (this: Window, ev: Event) => any;\ndeclare var onmessage: (this: Window, ev: MessageEvent) => any;\ndeclare var onmousedown: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseenter: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseleave: (this: Window, ev: MouseEvent) => any;\ndeclare var onmousemove: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseout: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseover: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseup: (this: Window, ev: MouseEvent) => any;\ndeclare var onmousewheel: (this: Window, ev: WheelEvent) => any;\ndeclare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointermove: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerout: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerover: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerup: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onoffline: (this: Window, ev: Event) => any;\ndeclare var ononline: (this: Window, ev: Event) => any;\ndeclare var onorientationchange: (this: Window, ev: Event) => any;\ndeclare var onpagehide: (this: Window, ev: PageTransitionEvent) => any;\ndeclare var onpageshow: (this: Window, ev: PageTransitionEvent) => any;\ndeclare var onpause: (this: Window, ev: Event) => any;\ndeclare var onplay: (this: Window, ev: Event) => any;\ndeclare var onplaying: (this: Window, ev: Event) => any;\ndeclare var onpopstate: (this: Window, ev: PopStateEvent) => any;\ndeclare var onprogress: (this: Window, ev: ProgressEvent) => any;\ndeclare var onratechange: (this: Window, ev: Event) => any;\ndeclare var onreadystatechange: (this: Window, ev: ProgressEvent) => any;\ndeclare var onreset: (this: Window, ev: Event) => any;\ndeclare var onresize: (this: Window, ev: UIEvent) => any;\ndeclare var onscroll: (this: Window, ev: UIEvent) => any;\ndeclare var onseeked: (this: Window, ev: Event) => any;\ndeclare var onseeking: (this: Window, ev: Event) => any;\ndeclare var onselect: (this: Window, ev: UIEvent) => any;\ndeclare var onstalled: (this: Window, ev: Event) => any;\ndeclare var onstorage: (this: Window, ev: StorageEvent) => any;\ndeclare var onsubmit: (this: Window, ev: Event) => any;\ndeclare var onsuspend: (this: Window, ev: Event) => any;\ndeclare var ontimeupdate: (this: Window, ev: Event) => any;\ndeclare var ontouchcancel: (ev: TouchEvent) => any;\ndeclare var ontouchend: (ev: TouchEvent) => any;\ndeclare var ontouchmove: (ev: TouchEvent) => any;\ndeclare var ontouchstart: (ev: TouchEvent) => any;\ndeclare var onunload: (this: Window, ev: Event) => any;\ndeclare var onvolumechange: (this: Window, ev: Event) => any;\ndeclare var onwaiting: (this: Window, ev: Event) => any;\ndeclare var opener: any;\ndeclare var orientation: string | number;\ndeclare var outerHeight: number;\ndeclare var outerWidth: number;\ndeclare var pageXOffset: number;\ndeclare var pageYOffset: number;\ndeclare var parent: Window;\ndeclare var performance: Performance;\ndeclare var personalbar: BarProp;\ndeclare var screen: Screen;\ndeclare var screenLeft: number;\ndeclare var screenTop: number;\ndeclare var screenX: number;\ndeclare var screenY: number;\ndeclare var scrollX: number;\ndeclare var scrollY: number;\ndeclare var scrollbars: BarProp;\ndeclare var self: Window;\ndeclare var status: string;\ndeclare var statusbar: BarProp;\ndeclare var styleMedia: StyleMedia;\ndeclare var toolbar: BarProp;\ndeclare var top: Window;\ndeclare var window: Window;\ndeclare function alert(message?: any): void;\ndeclare function blur(): void;\ndeclare function cancelAnimationFrame(handle: number): void;\ndeclare function captureEvents(): void;\ndeclare function close(): void;\ndeclare function confirm(message?: string): boolean;\ndeclare function focus(): void;\ndeclare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\ndeclare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList;\ndeclare function getSelection(): Selection;\ndeclare function matchMedia(mediaQuery: string): MediaQueryList;\ndeclare function moveBy(x?: number, y?: number): void;\ndeclare function moveTo(x?: number, y?: number): void;\ndeclare function msWriteProfilerMark(profilerMarkName: string): void;\ndeclare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;\ndeclare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void;\ndeclare function print(): void;\ndeclare function prompt(message?: string, _default?: string): string | null;\ndeclare function releaseEvents(): void;\ndeclare function requestAnimationFrame(callback: FrameRequestCallback): number;\ndeclare function resizeBy(x?: number, y?: number): void;\ndeclare function resizeTo(x?: number, y?: number): void;\ndeclare function scroll(x?: number, y?: number): void;\ndeclare function scrollBy(x?: number, y?: number): void;\ndeclare function scrollTo(x?: number, y?: number): void;\ndeclare function webkitCancelAnimationFrame(handle: number): void;\ndeclare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;\ndeclare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;\ndeclare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number;\ndeclare function scroll(options?: ScrollToOptions): void;\ndeclare function scrollTo(options?: ScrollToOptions): void;\ndeclare function scrollBy(options?: ScrollToOptions): void;\ndeclare function toString(): string;\ndeclare function dispatchEvent(evt: Event): boolean;\ndeclare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\ndeclare function clearInterval(handle: number): void;\ndeclare function clearTimeout(handle: number): void;\ndeclare function setInterval(handler: (...args: any[]) => void, timeout: number): number;\ndeclare function setInterval(handler: any, timeout?: any, ...args: any[]): number;\ndeclare function setTimeout(handler: (...args: any[]) => void, timeout: number): number;\ndeclare function setTimeout(handler: any, timeout?: any, ...args: any[]): number;\ndeclare function clearImmediate(handle: number): void;\ndeclare function setImmediate(handler: (...args: any[]) => void): number;\ndeclare function setImmediate(handler: any, ...args: any[]): number;\ndeclare var sessionStorage: Storage;\ndeclare var localStorage: Storage;\ndeclare var console: Console;\ndeclare var onpointercancel: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerdown: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerenter: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerleave: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointermove: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerout: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerover: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerup: (this: Window, ev: PointerEvent) => any;\ndeclare var onwheel: (this: Window, ev: WheelEvent) => any;\ndeclare var indexedDB: IDBFactory;\ndeclare function atob(encodedString: string): string;\ndeclare function btoa(rawString: string): string;\ndeclare function addEventListener<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void;\ndeclare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\ntype AAGUID = string;\ntype AlgorithmIdentifier = string | Algorithm;\ntype ConstrainBoolean = boolean | ConstrainBooleanParameters;\ntype ConstrainDOMString = string | string[] | ConstrainDOMStringParameters;\ntype ConstrainDouble = number | ConstrainDoubleRange;\ntype ConstrainLong = number | ConstrainLongRange;\ntype CryptoOperationData = ArrayBufferView;\ntype GLbitfield = number;\ntype GLboolean = boolean;\ntype GLbyte = number;\ntype GLclampf = number;\ntype GLenum = number;\ntype GLfloat = number;\ntype GLint = number;\ntype GLintptr = number;\ntype GLshort = number;\ntype GLsizei = number;\ntype GLsizeiptr = number;\ntype GLubyte = number;\ntype GLuint = number;\ntype GLushort = number;\ntype IDBKeyPath = string;\ntype KeyFormat = string;\ntype KeyType = string;\ntype KeyUsage = string;\ntype MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload;\ntype MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent;\ntype MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload;\ntype RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete;\ntype RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport;\ntype payloadtype = number;\ntype ScrollBehavior = \"auto\" | \"instant\" | \"smooth\";\ntype ScrollLogicalPosition = \"start\" | \"center\" | \"end\" | \"nearest\";\ntype IDBValidKey = number | string | Date | IDBArrayKey;\ntype BufferSource = ArrayBuffer | ArrayBufferView;\ntype MouseWheelEvent = WheelEvent;\ntype ScrollRestoration = \"auto\" | \"manual\";\n\n\n/////////////////////////////\n/// WorkerGlobalScope APIs \n/////////////////////////////\n// These are only available in a Web Worker \ndeclare function importScripts(...urls: string[]): void;\n\n\n\n\n/////////////////////////////\n/// Windows Script Host APIS\n/////////////////////////////\n\n\ninterface ActiveXObject {\n    new (s: string): any;\n}\ndeclare var ActiveXObject: ActiveXObject;\n\ninterface ITextWriter {\n    Write(s: string): void;\n    WriteLine(s: string): void;\n    Close(): void;\n}\n\ninterface TextStreamBase {\n    /**\n     * The column number of the current character position in an input stream.\n     */\n    Column: number;\n\n    /**\n     * The current line number in an input stream.\n     */\n    Line: number;\n\n    /**\n     * Closes a text stream.\n     * It is not necessary to close standard streams; they close automatically when the process ends. If \n     * you close a standard stream, be aware that any other pointers to that standard stream become invalid.\n     */\n    Close(): void;\n}\n\ninterface TextStreamWriter extends TextStreamBase {\n    /**\n     * Sends a string to an output stream.\n     */\n    Write(s: string): void;\n\n    /**\n     * Sends a specified number of blank lines (newline characters) to an output stream.\n     */\n    WriteBlankLines(intLines: number): void;\n\n    /**\n     * Sends a string followed by a newline character to an output stream.\n     */\n    WriteLine(s: string): void;\n}\n\ninterface TextStreamReader extends TextStreamBase {\n    /**\n     * Returns a specified number of characters from an input stream, starting at the current pointer position.\n     * Does not return until the ENTER key is pressed.\n     * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n     */\n    Read(characters: number): string;\n\n    /**\n     * Returns all characters from an input stream.\n     * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n     */\n    ReadAll(): string;\n\n    /**\n     * Returns an entire line from an input stream.\n     * Although this method extracts the newline character, it does not add it to the returned string.\n     * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n     */\n    ReadLine(): string;\n\n    /**\n     * Skips a specified number of characters when reading from an input text stream.\n     * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n     * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)\n     */\n    Skip(characters: number): void;\n\n    /**\n     * Skips the next line when reading from an input text stream.\n     * Can only be used on a stream in reading mode, not writing or appending mode.\n     */\n    SkipLine(): void;\n\n    /**\n     * Indicates whether the stream pointer position is at the end of a line.\n     */\n    AtEndOfLine: boolean;\n\n    /**\n     * Indicates whether the stream pointer position is at the end of a stream.\n     */\n    AtEndOfStream: boolean;\n}\n\ndeclare var WScript: {\n    /**\n    * Outputs text to either a message box (under WScript.exe) or the command console window followed by\n    * a newline (under CScript.exe).\n    */\n    Echo(s: any): void;\n\n    /**\n     * Exposes the write-only error output stream for the current script.\n     * Can be accessed only while using CScript.exe.\n     */\n    StdErr: TextStreamWriter;\n\n    /**\n     * Exposes the write-only output stream for the current script.\n     * Can be accessed only while using CScript.exe.\n     */\n    StdOut: TextStreamWriter;\n    Arguments: { length: number; Item(n: number): string; };\n\n    /**\n     *  The full path of the currently running script.\n     */\n    ScriptFullName: string;\n\n    /**\n     * Forces the script to stop immediately, with an optional exit code.\n     */\n    Quit(exitCode?: number): number;\n\n    /**\n     * The Windows Script Host build version number.\n     */\n    BuildVersion: number;\n\n    /**\n     * Fully qualified path of the host executable.\n     */\n    FullName: string;\n\n    /**\n     * Gets/sets the script mode - interactive(true) or batch(false).\n     */\n    Interactive: boolean;\n\n    /**\n     * The name of the host executable (WScript.exe or CScript.exe).\n     */\n    Name: string;\n\n    /**\n     * Path of the directory containing the host executable.\n     */\n    Path: string;\n\n    /**\n     * The filename of the currently running script.\n     */\n    ScriptName: string;\n\n    /**\n     * Exposes the read-only input stream for the current script.\n     * Can be accessed only while using CScript.exe.\n     */\n    StdIn: TextStreamReader;\n\n    /**\n     * Windows Script Host version\n     */\n    Version: string;\n\n    /**\n     * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.\n     */\n    ConnectObject(objEventSource: any, strPrefix: string): void;\n\n    /**\n     * Creates a COM object.\n     * @param strProgiID\n     * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.\n     */\n    CreateObject(strProgID: string, strPrefix?: string): any;\n\n    /**\n     * Disconnects a COM object from its event sources.\n     */\n    DisconnectObject(obj: any): void;\n\n    /**\n     * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.\n     * @param strPathname Fully qualified path to the file containing the object persisted to disk.\n     *                       For objects in memory, pass a zero-length string.\n     * @param strProgID\n     * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.\n     */\n    GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;\n\n    /**\n     * Suspends script execution for a specified length of time, then continues execution.\n     * @param intTime Interval (in milliseconds) to suspend script execution.\n     */\n    Sleep(intTime: number): void;\n};\n\n/**\n * Allows enumerating over a COM collection, which may not have indexed item access.\n */\ninterface Enumerator<T> {\n    /**\n     * Returns true if the current item is the last one in the collection, or the collection is empty,\n     * or the current item is undefined.\n     */\n    atEnd(): boolean;\n\n    /**\n     * Returns the current item in the collection\n     */\n    item(): T;\n\n    /**\n     * Resets the current item in the collection to the first item. If there are no items in the collection,\n     * the current item is set to undefined.\n     */\n    moveFirst(): void;\n\n    /**\n     * Moves the current item to the next item in the collection. If the enumerator is at the end of\n     * the collection or the collection is empty, the current item is set to undefined.\n     */\n    moveNext(): void;\n}\n\ninterface EnumeratorConstructor {\n    new <T>(collection: any): Enumerator<T>;\n    new (collection: any): Enumerator<any>;\n}\n\ndeclare var Enumerator: EnumeratorConstructor;\n\n/**\n * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions.\n */\ninterface VBArray<T> {\n    /**\n     * Returns the number of dimensions (1-based).\n     */\n    dimensions(): number;\n\n    /**\n     * Takes an index for each dimension in the array, and returns the item at the corresponding location.\n     */\n    getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T;\n\n    /**\n     * Returns the smallest available index for a given dimension.\n     * @param dimension 1-based dimension (defaults to 1)\n     */\n    lbound(dimension?: number): number;\n\n    /**\n     * Returns the largest available index for a given dimension.\n     * @param dimension 1-based dimension (defaults to 1)\n     */\n    ubound(dimension?: number): number;\n\n    /**\n     * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions,\n     * each successive dimension is appended to the end of the array.\n     * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6]\n     */\n    toArray(): T[];\n}\n\ninterface VBArrayConstructor {\n    new <T>(safeArray: any): VBArray<T>;\n    new (safeArray: any): VBArray<any>;\n}\n\ndeclare var VBArray: VBArrayConstructor;\n\n/**\n * Automation date (VT_DATE)\n */\ninterface VarDate { }\n\ninterface DateConstructor {\n    new (vd: VarDate): Date;\n}\n\ninterface Date {\n    getVarDate: () => VarDate;\n}\n\n\n/// <reference path=\"lib.dom.d.ts\" />\n\ninterface DOMTokenList {\n    [Symbol.iterator](): IterableIterator<string>;\n}\n\ninterface NodeList {\n    [Symbol.iterator](): IterableIterator<Node>\n}\n\ninterface NodeListOf<TNode extends Node> {\n    [Symbol.iterator](): IterableIterator<TNode>\n}\n"
  },
  {
    "path": "buildtool/typescript/lib/tsc.js",
    "content": "/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved. \nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0  \n \nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, \nMERCHANTABLITY OR NON-INFRINGEMENT. \n \nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n\nvar ts;\n(function (ts) {\n    var OperationCanceledException = (function () {\n        function OperationCanceledException() {\n        }\n        return OperationCanceledException;\n    }());\n    ts.OperationCanceledException = OperationCanceledException;\n    var ExitStatus;\n    (function (ExitStatus) {\n        ExitStatus[ExitStatus[\"Success\"] = 0] = \"Success\";\n        ExitStatus[ExitStatus[\"DiagnosticsPresent_OutputsSkipped\"] = 1] = \"DiagnosticsPresent_OutputsSkipped\";\n        ExitStatus[ExitStatus[\"DiagnosticsPresent_OutputsGenerated\"] = 2] = \"DiagnosticsPresent_OutputsGenerated\";\n    })(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {}));\n    var TypeReferenceSerializationKind;\n    (function (TypeReferenceSerializationKind) {\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"Unknown\"] = 0] = \"Unknown\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"TypeWithConstructSignatureAndValue\"] = 1] = \"TypeWithConstructSignatureAndValue\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"VoidNullableOrNeverType\"] = 2] = \"VoidNullableOrNeverType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"NumberLikeType\"] = 3] = \"NumberLikeType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"StringLikeType\"] = 4] = \"StringLikeType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"BooleanType\"] = 5] = \"BooleanType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"ArrayLikeType\"] = 6] = \"ArrayLikeType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"ESSymbolType\"] = 7] = \"ESSymbolType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"Promise\"] = 8] = \"Promise\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"TypeWithCallSignature\"] = 9] = \"TypeWithCallSignature\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"ObjectType\"] = 10] = \"ObjectType\";\n    })(TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {}));\n    var DiagnosticCategory;\n    (function (DiagnosticCategory) {\n        DiagnosticCategory[DiagnosticCategory[\"Warning\"] = 0] = \"Warning\";\n        DiagnosticCategory[DiagnosticCategory[\"Error\"] = 1] = \"Error\";\n        DiagnosticCategory[DiagnosticCategory[\"Message\"] = 2] = \"Message\";\n    })(DiagnosticCategory = ts.DiagnosticCategory || (ts.DiagnosticCategory = {}));\n    var ModuleResolutionKind;\n    (function (ModuleResolutionKind) {\n        ModuleResolutionKind[ModuleResolutionKind[\"Classic\"] = 1] = \"Classic\";\n        ModuleResolutionKind[ModuleResolutionKind[\"NodeJs\"] = 2] = \"NodeJs\";\n    })(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));\n    var ModuleKind;\n    (function (ModuleKind) {\n        ModuleKind[ModuleKind[\"None\"] = 0] = \"None\";\n        ModuleKind[ModuleKind[\"CommonJS\"] = 1] = \"CommonJS\";\n        ModuleKind[ModuleKind[\"AMD\"] = 2] = \"AMD\";\n        ModuleKind[ModuleKind[\"UMD\"] = 3] = \"UMD\";\n        ModuleKind[ModuleKind[\"System\"] = 4] = \"System\";\n        ModuleKind[ModuleKind[\"ES2015\"] = 5] = \"ES2015\";\n    })(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));\n    var Extension;\n    (function (Extension) {\n        Extension[Extension[\"Ts\"] = 0] = \"Ts\";\n        Extension[Extension[\"Tsx\"] = 1] = \"Tsx\";\n        Extension[Extension[\"Dts\"] = 2] = \"Dts\";\n        Extension[Extension[\"Js\"] = 3] = \"Js\";\n        Extension[Extension[\"Jsx\"] = 4] = \"Jsx\";\n        Extension[Extension[\"LastTypeScriptExtension\"] = 2] = \"LastTypeScriptExtension\";\n    })(Extension = ts.Extension || (ts.Extension = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    ts.timestamp = typeof performance !== \"undefined\" && performance.now ? function () { return performance.now(); } : Date.now ? Date.now : function () { return +(new Date()); };\n})(ts || (ts = {}));\n(function (ts) {\n    var performance;\n    (function (performance) {\n        var profilerEvent = typeof onProfilerEvent === \"function\" && onProfilerEvent.profiler === true\n            ? onProfilerEvent\n            : function (_markName) { };\n        var enabled = false;\n        var profilerStart = 0;\n        var counts;\n        var marks;\n        var measures;\n        function mark(markName) {\n            if (enabled) {\n                marks[markName] = ts.timestamp();\n                counts[markName] = (counts[markName] || 0) + 1;\n                profilerEvent(markName);\n            }\n        }\n        performance.mark = mark;\n        function measure(measureName, startMarkName, endMarkName) {\n            if (enabled) {\n                var end = endMarkName && marks[endMarkName] || ts.timestamp();\n                var start = startMarkName && marks[startMarkName] || profilerStart;\n                measures[measureName] = (measures[measureName] || 0) + (end - start);\n            }\n        }\n        performance.measure = measure;\n        function getCount(markName) {\n            return counts && counts[markName] || 0;\n        }\n        performance.getCount = getCount;\n        function getDuration(measureName) {\n            return measures && measures[measureName] || 0;\n        }\n        performance.getDuration = getDuration;\n        function forEachMeasure(cb) {\n            for (var key in measures) {\n                cb(key, measures[key]);\n            }\n        }\n        performance.forEachMeasure = forEachMeasure;\n        function enable() {\n            counts = ts.createMap();\n            marks = ts.createMap();\n            measures = ts.createMap();\n            enabled = true;\n            profilerStart = ts.timestamp();\n        }\n        performance.enable = enable;\n        function disable() {\n            enabled = false;\n        }\n        performance.disable = disable;\n    })(performance = ts.performance || (ts.performance = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    ts.version = \"2.1.4\";\n})(ts || (ts = {}));\n(function (ts) {\n    var createObject = Object.create;\n    ts.collator = typeof Intl === \"object\" && typeof Intl.Collator === \"function\" ? new Intl.Collator() : undefined;\n    function createMap(template) {\n        var map = createObject(null);\n        map[\"__\"] = undefined;\n        delete map[\"__\"];\n        for (var key in template)\n            if (hasOwnProperty.call(template, key)) {\n                map[key] = template[key];\n            }\n        return map;\n    }\n    ts.createMap = createMap;\n    function createFileMap(keyMapper) {\n        var files = createMap();\n        return {\n            get: get,\n            set: set,\n            contains: contains,\n            remove: remove,\n            forEachValue: forEachValueInMap,\n            getKeys: getKeys,\n            clear: clear,\n        };\n        function forEachValueInMap(f) {\n            for (var key in files) {\n                f(key, files[key]);\n            }\n        }\n        function getKeys() {\n            var keys = [];\n            for (var key in files) {\n                keys.push(key);\n            }\n            return keys;\n        }\n        function get(path) {\n            return files[toKey(path)];\n        }\n        function set(path, value) {\n            files[toKey(path)] = value;\n        }\n        function contains(path) {\n            return toKey(path) in files;\n        }\n        function remove(path) {\n            var key = toKey(path);\n            delete files[key];\n        }\n        function clear() {\n            files = createMap();\n        }\n        function toKey(path) {\n            return keyMapper ? keyMapper(path) : path;\n        }\n    }\n    ts.createFileMap = createFileMap;\n    function toPath(fileName, basePath, getCanonicalFileName) {\n        var nonCanonicalizedPath = isRootedDiskPath(fileName)\n            ? normalizePath(fileName)\n            : getNormalizedAbsolutePath(fileName, basePath);\n        return getCanonicalFileName(nonCanonicalizedPath);\n    }\n    ts.toPath = toPath;\n    function forEach(array, callback) {\n        if (array) {\n            for (var i = 0, len = array.length; i < len; i++) {\n                var result = callback(array[i], i);\n                if (result) {\n                    return result;\n                }\n            }\n        }\n        return undefined;\n    }\n    ts.forEach = forEach;\n    function zipWith(arrayA, arrayB, callback) {\n        Debug.assert(arrayA.length === arrayB.length);\n        for (var i = 0; i < arrayA.length; i++) {\n            callback(arrayA[i], arrayB[i], i);\n        }\n    }\n    ts.zipWith = zipWith;\n    function every(array, callback) {\n        if (array) {\n            for (var i = 0, len = array.length; i < len; i++) {\n                if (!callback(array[i], i)) {\n                    return false;\n                }\n            }\n        }\n        return true;\n    }\n    ts.every = every;\n    function find(array, predicate) {\n        for (var i = 0, len = array.length; i < len; i++) {\n            var value = array[i];\n            if (predicate(value, i)) {\n                return value;\n            }\n        }\n        return undefined;\n    }\n    ts.find = find;\n    function findMap(array, callback) {\n        for (var i = 0, len = array.length; i < len; i++) {\n            var result = callback(array[i], i);\n            if (result) {\n                return result;\n            }\n        }\n        Debug.fail();\n    }\n    ts.findMap = findMap;\n    function contains(array, value) {\n        if (array) {\n            for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {\n                var v = array_1[_i];\n                if (v === value) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n    ts.contains = contains;\n    function indexOf(array, value) {\n        if (array) {\n            for (var i = 0, len = array.length; i < len; i++) {\n                if (array[i] === value) {\n                    return i;\n                }\n            }\n        }\n        return -1;\n    }\n    ts.indexOf = indexOf;\n    function indexOfAnyCharCode(text, charCodes, start) {\n        for (var i = start || 0, len = text.length; i < len; i++) {\n            if (contains(charCodes, text.charCodeAt(i))) {\n                return i;\n            }\n        }\n        return -1;\n    }\n    ts.indexOfAnyCharCode = indexOfAnyCharCode;\n    function countWhere(array, predicate) {\n        var count = 0;\n        if (array) {\n            for (var i = 0; i < array.length; i++) {\n                var v = array[i];\n                if (predicate(v, i)) {\n                    count++;\n                }\n            }\n        }\n        return count;\n    }\n    ts.countWhere = countWhere;\n    function filter(array, f) {\n        if (array) {\n            var len = array.length;\n            var i = 0;\n            while (i < len && f(array[i]))\n                i++;\n            if (i < len) {\n                var result = array.slice(0, i);\n                i++;\n                while (i < len) {\n                    var item = array[i];\n                    if (f(item)) {\n                        result.push(item);\n                    }\n                    i++;\n                }\n                return result;\n            }\n        }\n        return array;\n    }\n    ts.filter = filter;\n    function removeWhere(array, f) {\n        var outIndex = 0;\n        for (var _i = 0, array_2 = array; _i < array_2.length; _i++) {\n            var item = array_2[_i];\n            if (!f(item)) {\n                array[outIndex] = item;\n                outIndex++;\n            }\n        }\n        if (outIndex !== array.length) {\n            array.length = outIndex;\n            return true;\n        }\n        return false;\n    }\n    ts.removeWhere = removeWhere;\n    function filterMutate(array, f) {\n        var outIndex = 0;\n        for (var _i = 0, array_3 = array; _i < array_3.length; _i++) {\n            var item = array_3[_i];\n            if (f(item)) {\n                array[outIndex] = item;\n                outIndex++;\n            }\n        }\n        array.length = outIndex;\n    }\n    ts.filterMutate = filterMutate;\n    function map(array, f) {\n        var result;\n        if (array) {\n            result = [];\n            for (var i = 0; i < array.length; i++) {\n                result.push(f(array[i], i));\n            }\n        }\n        return result;\n    }\n    ts.map = map;\n    function sameMap(array, f) {\n        var result;\n        if (array) {\n            for (var i = 0; i < array.length; i++) {\n                if (result) {\n                    result.push(f(array[i], i));\n                }\n                else {\n                    var item = array[i];\n                    var mapped = f(item, i);\n                    if (item !== mapped) {\n                        result = array.slice(0, i);\n                        result.push(mapped);\n                    }\n                }\n            }\n        }\n        return result || array;\n    }\n    ts.sameMap = sameMap;\n    function flatten(array) {\n        var result;\n        if (array) {\n            result = [];\n            for (var _i = 0, array_4 = array; _i < array_4.length; _i++) {\n                var v = array_4[_i];\n                if (v) {\n                    if (isArray(v)) {\n                        addRange(result, v);\n                    }\n                    else {\n                        result.push(v);\n                    }\n                }\n            }\n        }\n        return result;\n    }\n    ts.flatten = flatten;\n    function flatMap(array, mapfn) {\n        var result;\n        if (array) {\n            result = [];\n            for (var i = 0; i < array.length; i++) {\n                var v = mapfn(array[i], i);\n                if (v) {\n                    if (isArray(v)) {\n                        addRange(result, v);\n                    }\n                    else {\n                        result.push(v);\n                    }\n                }\n            }\n        }\n        return result;\n    }\n    ts.flatMap = flatMap;\n    function span(array, f) {\n        if (array) {\n            for (var i = 0; i < array.length; i++) {\n                if (!f(array[i], i)) {\n                    return [array.slice(0, i), array.slice(i)];\n                }\n            }\n            return [array.slice(0), []];\n        }\n        return undefined;\n    }\n    ts.span = span;\n    function spanMap(array, keyfn, mapfn) {\n        var result;\n        if (array) {\n            result = [];\n            var len = array.length;\n            var previousKey = void 0;\n            var key = void 0;\n            var start = 0;\n            var pos = 0;\n            while (start < len) {\n                while (pos < len) {\n                    var value = array[pos];\n                    key = keyfn(value, pos);\n                    if (pos === 0) {\n                        previousKey = key;\n                    }\n                    else if (key !== previousKey) {\n                        break;\n                    }\n                    pos++;\n                }\n                if (start < pos) {\n                    var v = mapfn(array.slice(start, pos), previousKey, start, pos);\n                    if (v) {\n                        result.push(v);\n                    }\n                    start = pos;\n                }\n                previousKey = key;\n                pos++;\n            }\n        }\n        return result;\n    }\n    ts.spanMap = spanMap;\n    function mapObject(object, f) {\n        var result;\n        if (object) {\n            result = {};\n            for (var _i = 0, _a = getOwnKeys(object); _i < _a.length; _i++) {\n                var v = _a[_i];\n                var _b = f(v, object[v]) || [undefined, undefined], key = _b[0], value = _b[1];\n                if (key !== undefined) {\n                    result[key] = value;\n                }\n            }\n        }\n        return result;\n    }\n    ts.mapObject = mapObject;\n    function some(array, predicate) {\n        if (array) {\n            if (predicate) {\n                for (var _i = 0, array_5 = array; _i < array_5.length; _i++) {\n                    var v = array_5[_i];\n                    if (predicate(v)) {\n                        return true;\n                    }\n                }\n            }\n            else {\n                return array.length > 0;\n            }\n        }\n        return false;\n    }\n    ts.some = some;\n    function concatenate(array1, array2) {\n        if (!some(array2))\n            return array1;\n        if (!some(array1))\n            return array2;\n        return array1.concat(array2);\n    }\n    ts.concatenate = concatenate;\n    function deduplicate(array, areEqual) {\n        var result;\n        if (array) {\n            result = [];\n            loop: for (var _i = 0, array_6 = array; _i < array_6.length; _i++) {\n                var item = array_6[_i];\n                for (var _a = 0, result_1 = result; _a < result_1.length; _a++) {\n                    var res = result_1[_a];\n                    if (areEqual ? areEqual(res, item) : res === item) {\n                        continue loop;\n                    }\n                }\n                result.push(item);\n            }\n        }\n        return result;\n    }\n    ts.deduplicate = deduplicate;\n    function arrayIsEqualTo(array1, array2, equaler) {\n        if (!array1 || !array2) {\n            return array1 === array2;\n        }\n        if (array1.length !== array2.length) {\n            return false;\n        }\n        for (var i = 0; i < array1.length; i++) {\n            var equals = equaler ? equaler(array1[i], array2[i]) : array1[i] === array2[i];\n            if (!equals) {\n                return false;\n            }\n        }\n        return true;\n    }\n    ts.arrayIsEqualTo = arrayIsEqualTo;\n    function changesAffectModuleResolution(oldOptions, newOptions) {\n        return !oldOptions ||\n            (oldOptions.module !== newOptions.module) ||\n            (oldOptions.moduleResolution !== newOptions.moduleResolution) ||\n            (oldOptions.noResolve !== newOptions.noResolve) ||\n            (oldOptions.target !== newOptions.target) ||\n            (oldOptions.noLib !== newOptions.noLib) ||\n            (oldOptions.jsx !== newOptions.jsx) ||\n            (oldOptions.allowJs !== newOptions.allowJs) ||\n            (oldOptions.rootDir !== newOptions.rootDir) ||\n            (oldOptions.configFilePath !== newOptions.configFilePath) ||\n            (oldOptions.baseUrl !== newOptions.baseUrl) ||\n            (oldOptions.maxNodeModuleJsDepth !== newOptions.maxNodeModuleJsDepth) ||\n            !arrayIsEqualTo(oldOptions.lib, newOptions.lib) ||\n            !arrayIsEqualTo(oldOptions.typeRoots, newOptions.typeRoots) ||\n            !arrayIsEqualTo(oldOptions.rootDirs, newOptions.rootDirs) ||\n            !equalOwnProperties(oldOptions.paths, newOptions.paths);\n    }\n    ts.changesAffectModuleResolution = changesAffectModuleResolution;\n    function compact(array) {\n        var result;\n        if (array) {\n            for (var i = 0; i < array.length; i++) {\n                var v = array[i];\n                if (result || !v) {\n                    if (!result) {\n                        result = array.slice(0, i);\n                    }\n                    if (v) {\n                        result.push(v);\n                    }\n                }\n            }\n        }\n        return result || array;\n    }\n    ts.compact = compact;\n    function relativeComplement(arrayA, arrayB, comparer, offsetA, offsetB) {\n        if (comparer === void 0) { comparer = compareValues; }\n        if (offsetA === void 0) { offsetA = 0; }\n        if (offsetB === void 0) { offsetB = 0; }\n        if (!arrayB || !arrayA || arrayB.length === 0 || arrayA.length === 0)\n            return arrayB;\n        var result = [];\n        outer: for (; offsetB < arrayB.length; offsetB++) {\n            inner: for (; offsetA < arrayA.length; offsetA++) {\n                switch (comparer(arrayB[offsetB], arrayA[offsetA])) {\n                    case -1: break inner;\n                    case 0: continue outer;\n                    case 1: continue inner;\n                }\n            }\n            result.push(arrayB[offsetB]);\n        }\n        return result;\n    }\n    ts.relativeComplement = relativeComplement;\n    function sum(array, prop) {\n        var result = 0;\n        for (var _i = 0, array_7 = array; _i < array_7.length; _i++) {\n            var v = array_7[_i];\n            result += v[prop];\n        }\n        return result;\n    }\n    ts.sum = sum;\n    function append(to, value) {\n        if (value === undefined)\n            return to;\n        if (to === undefined)\n            return [value];\n        to.push(value);\n        return to;\n    }\n    ts.append = append;\n    function addRange(to, from) {\n        if (from === undefined)\n            return to;\n        for (var _i = 0, from_1 = from; _i < from_1.length; _i++) {\n            var v = from_1[_i];\n            to = append(to, v);\n        }\n        return to;\n    }\n    ts.addRange = addRange;\n    function stableSort(array, comparer) {\n        if (comparer === void 0) { comparer = compareValues; }\n        return array\n            .map(function (_, i) { return i; })\n            .sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); })\n            .map(function (i) { return array[i]; });\n    }\n    ts.stableSort = stableSort;\n    function rangeEquals(array1, array2, pos, end) {\n        while (pos < end) {\n            if (array1[pos] !== array2[pos]) {\n                return false;\n            }\n            pos++;\n        }\n        return true;\n    }\n    ts.rangeEquals = rangeEquals;\n    function firstOrUndefined(array) {\n        return array && array.length > 0\n            ? array[0]\n            : undefined;\n    }\n    ts.firstOrUndefined = firstOrUndefined;\n    function lastOrUndefined(array) {\n        return array && array.length > 0\n            ? array[array.length - 1]\n            : undefined;\n    }\n    ts.lastOrUndefined = lastOrUndefined;\n    function singleOrUndefined(array) {\n        return array && array.length === 1\n            ? array[0]\n            : undefined;\n    }\n    ts.singleOrUndefined = singleOrUndefined;\n    function singleOrMany(array) {\n        return array && array.length === 1\n            ? array[0]\n            : array;\n    }\n    ts.singleOrMany = singleOrMany;\n    function replaceElement(array, index, value) {\n        var result = array.slice(0);\n        result[index] = value;\n        return result;\n    }\n    ts.replaceElement = replaceElement;\n    function binarySearch(array, value, comparer, offset) {\n        if (!array || array.length === 0) {\n            return -1;\n        }\n        var low = offset || 0;\n        var high = array.length - 1;\n        comparer = comparer !== undefined\n            ? comparer\n            : function (v1, v2) { return (v1 < v2 ? -1 : (v1 > v2 ? 1 : 0)); };\n        while (low <= high) {\n            var middle = low + ((high - low) >> 1);\n            var midValue = array[middle];\n            if (comparer(midValue, value) === 0) {\n                return middle;\n            }\n            else if (comparer(midValue, value) > 0) {\n                high = middle - 1;\n            }\n            else {\n                low = middle + 1;\n            }\n        }\n        return ~low;\n    }\n    ts.binarySearch = binarySearch;\n    function reduceLeft(array, f, initial, start, count) {\n        if (array && array.length > 0) {\n            var size = array.length;\n            if (size > 0) {\n                var pos = start === undefined || start < 0 ? 0 : start;\n                var end = count === undefined || pos + count > size - 1 ? size - 1 : pos + count;\n                var result = void 0;\n                if (arguments.length <= 2) {\n                    result = array[pos];\n                    pos++;\n                }\n                else {\n                    result = initial;\n                }\n                while (pos <= end) {\n                    result = f(result, array[pos], pos);\n                    pos++;\n                }\n                return result;\n            }\n        }\n        return initial;\n    }\n    ts.reduceLeft = reduceLeft;\n    function reduceRight(array, f, initial, start, count) {\n        if (array) {\n            var size = array.length;\n            if (size > 0) {\n                var pos = start === undefined || start > size - 1 ? size - 1 : start;\n                var end = count === undefined || pos - count < 0 ? 0 : pos - count;\n                var result = void 0;\n                if (arguments.length <= 2) {\n                    result = array[pos];\n                    pos--;\n                }\n                else {\n                    result = initial;\n                }\n                while (pos >= end) {\n                    result = f(result, array[pos], pos);\n                    pos--;\n                }\n                return result;\n            }\n        }\n        return initial;\n    }\n    ts.reduceRight = reduceRight;\n    var hasOwnProperty = Object.prototype.hasOwnProperty;\n    function hasProperty(map, key) {\n        return hasOwnProperty.call(map, key);\n    }\n    ts.hasProperty = hasProperty;\n    function getProperty(map, key) {\n        return hasOwnProperty.call(map, key) ? map[key] : undefined;\n    }\n    ts.getProperty = getProperty;\n    function getOwnKeys(map) {\n        var keys = [];\n        for (var key in map)\n            if (hasOwnProperty.call(map, key)) {\n                keys.push(key);\n            }\n        return keys;\n    }\n    ts.getOwnKeys = getOwnKeys;\n    function forEachProperty(map, callback) {\n        var result;\n        for (var key in map) {\n            if (result = callback(map[key], key))\n                break;\n        }\n        return result;\n    }\n    ts.forEachProperty = forEachProperty;\n    function someProperties(map, predicate) {\n        for (var key in map) {\n            if (!predicate || predicate(map[key], key))\n                return true;\n        }\n        return false;\n    }\n    ts.someProperties = someProperties;\n    function copyProperties(source, target) {\n        for (var key in source) {\n            target[key] = source[key];\n        }\n    }\n    ts.copyProperties = copyProperties;\n    function appendProperty(map, key, value) {\n        if (key === undefined || value === undefined)\n            return map;\n        if (map === undefined)\n            map = createMap();\n        map[key] = value;\n        return map;\n    }\n    ts.appendProperty = appendProperty;\n    function assign(t) {\n        var args = [];\n        for (var _i = 1; _i < arguments.length; _i++) {\n            args[_i - 1] = arguments[_i];\n        }\n        for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {\n            var arg = args_1[_a];\n            for (var _b = 0, _c = getOwnKeys(arg); _b < _c.length; _b++) {\n                var p = _c[_b];\n                t[p] = arg[p];\n            }\n        }\n        return t;\n    }\n    ts.assign = assign;\n    function reduceProperties(map, callback, initial) {\n        var result = initial;\n        for (var key in map) {\n            result = callback(result, map[key], String(key));\n        }\n        return result;\n    }\n    ts.reduceProperties = reduceProperties;\n    function reduceOwnProperties(map, callback, initial) {\n        var result = initial;\n        for (var key in map)\n            if (hasOwnProperty.call(map, key)) {\n                result = callback(result, map[key], String(key));\n            }\n        return result;\n    }\n    ts.reduceOwnProperties = reduceOwnProperties;\n    function equalOwnProperties(left, right, equalityComparer) {\n        if (left === right)\n            return true;\n        if (!left || !right)\n            return false;\n        for (var key in left)\n            if (hasOwnProperty.call(left, key)) {\n                if (!hasOwnProperty.call(right, key) === undefined)\n                    return false;\n                if (equalityComparer ? !equalityComparer(left[key], right[key]) : left[key] !== right[key])\n                    return false;\n            }\n        for (var key in right)\n            if (hasOwnProperty.call(right, key)) {\n                if (!hasOwnProperty.call(left, key))\n                    return false;\n            }\n        return true;\n    }\n    ts.equalOwnProperties = equalOwnProperties;\n    function arrayToMap(array, makeKey, makeValue) {\n        var result = createMap();\n        for (var _i = 0, array_8 = array; _i < array_8.length; _i++) {\n            var value = array_8[_i];\n            result[makeKey(value)] = makeValue ? makeValue(value) : value;\n        }\n        return result;\n    }\n    ts.arrayToMap = arrayToMap;\n    function isEmpty(map) {\n        for (var id in map) {\n            if (hasProperty(map, id)) {\n                return false;\n            }\n        }\n        return true;\n    }\n    ts.isEmpty = isEmpty;\n    function cloneMap(map) {\n        var clone = createMap();\n        copyProperties(map, clone);\n        return clone;\n    }\n    ts.cloneMap = cloneMap;\n    function clone(object) {\n        var result = {};\n        for (var id in object) {\n            if (hasOwnProperty.call(object, id)) {\n                result[id] = object[id];\n            }\n        }\n        return result;\n    }\n    ts.clone = clone;\n    function extend(first, second) {\n        var result = {};\n        for (var id in second)\n            if (hasOwnProperty.call(second, id)) {\n                result[id] = second[id];\n            }\n        for (var id in first)\n            if (hasOwnProperty.call(first, id)) {\n                result[id] = first[id];\n            }\n        return result;\n    }\n    ts.extend = extend;\n    function multiMapAdd(map, key, value) {\n        var values = map[key];\n        if (values) {\n            values.push(value);\n            return values;\n        }\n        else {\n            return map[key] = [value];\n        }\n    }\n    ts.multiMapAdd = multiMapAdd;\n    function multiMapRemove(map, key, value) {\n        var values = map[key];\n        if (values) {\n            unorderedRemoveItem(values, value);\n            if (!values.length) {\n                delete map[key];\n            }\n        }\n    }\n    ts.multiMapRemove = multiMapRemove;\n    function isArray(value) {\n        return Array.isArray ? Array.isArray(value) : value instanceof Array;\n    }\n    ts.isArray = isArray;\n    function noop() { }\n    ts.noop = noop;\n    function notImplemented() {\n        throw new Error(\"Not implemented\");\n    }\n    ts.notImplemented = notImplemented;\n    function memoize(callback) {\n        var value;\n        return function () {\n            if (callback) {\n                value = callback();\n                callback = undefined;\n            }\n            return value;\n        };\n    }\n    ts.memoize = memoize;\n    function chain(a, b, c, d, e) {\n        if (e) {\n            var args_2 = [];\n            for (var i = 0; i < arguments.length; i++) {\n                args_2[i] = arguments[i];\n            }\n            return function (t) { return compose.apply(void 0, map(args_2, function (f) { return f(t); })); };\n        }\n        else if (d) {\n            return function (t) { return compose(a(t), b(t), c(t), d(t)); };\n        }\n        else if (c) {\n            return function (t) { return compose(a(t), b(t), c(t)); };\n        }\n        else if (b) {\n            return function (t) { return compose(a(t), b(t)); };\n        }\n        else if (a) {\n            return function (t) { return compose(a(t)); };\n        }\n        else {\n            return function (_) { return function (u) { return u; }; };\n        }\n    }\n    ts.chain = chain;\n    function compose(a, b, c, d, e) {\n        if (e) {\n            var args_3 = [];\n            for (var i = 0; i < arguments.length; i++) {\n                args_3[i] = arguments[i];\n            }\n            return function (t) { return reduceLeft(args_3, function (u, f) { return f(u); }, t); };\n        }\n        else if (d) {\n            return function (t) { return d(c(b(a(t)))); };\n        }\n        else if (c) {\n            return function (t) { return c(b(a(t))); };\n        }\n        else if (b) {\n            return function (t) { return b(a(t)); };\n        }\n        else if (a) {\n            return function (t) { return a(t); };\n        }\n        else {\n            return function (t) { return t; };\n        }\n    }\n    ts.compose = compose;\n    function formatStringFromArgs(text, args, baseIndex) {\n        baseIndex = baseIndex || 0;\n        return text.replace(/{(\\d+)}/g, function (_match, index) { return args[+index + baseIndex]; });\n    }\n    ts.localizedDiagnosticMessages = undefined;\n    function getLocaleSpecificMessage(message) {\n        return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message;\n    }\n    ts.getLocaleSpecificMessage = getLocaleSpecificMessage;\n    function createFileDiagnostic(file, start, length, message) {\n        var end = start + length;\n        Debug.assert(start >= 0, \"start must be non-negative, is \" + start);\n        Debug.assert(length >= 0, \"length must be non-negative, is \" + length);\n        if (file) {\n            Debug.assert(start <= file.text.length, \"start must be within the bounds of the file. \" + start + \" > \" + file.text.length);\n            Debug.assert(end <= file.text.length, \"end must be the bounds of the file. \" + end + \" > \" + file.text.length);\n        }\n        var text = getLocaleSpecificMessage(message);\n        if (arguments.length > 4) {\n            text = formatStringFromArgs(text, arguments, 4);\n        }\n        return {\n            file: file,\n            start: start,\n            length: length,\n            messageText: text,\n            category: message.category,\n            code: message.code,\n        };\n    }\n    ts.createFileDiagnostic = createFileDiagnostic;\n    function formatMessage(_dummy, message) {\n        var text = getLocaleSpecificMessage(message);\n        if (arguments.length > 2) {\n            text = formatStringFromArgs(text, arguments, 2);\n        }\n        return text;\n    }\n    ts.formatMessage = formatMessage;\n    function createCompilerDiagnostic(message) {\n        var text = getLocaleSpecificMessage(message);\n        if (arguments.length > 1) {\n            text = formatStringFromArgs(text, arguments, 1);\n        }\n        return {\n            file: undefined,\n            start: undefined,\n            length: undefined,\n            messageText: text,\n            category: message.category,\n            code: message.code\n        };\n    }\n    ts.createCompilerDiagnostic = createCompilerDiagnostic;\n    function createCompilerDiagnosticFromMessageChain(chain) {\n        return {\n            file: undefined,\n            start: undefined,\n            length: undefined,\n            code: chain.code,\n            category: chain.category,\n            messageText: chain.next ? chain : chain.messageText\n        };\n    }\n    ts.createCompilerDiagnosticFromMessageChain = createCompilerDiagnosticFromMessageChain;\n    function chainDiagnosticMessages(details, message) {\n        var text = getLocaleSpecificMessage(message);\n        if (arguments.length > 2) {\n            text = formatStringFromArgs(text, arguments, 2);\n        }\n        return {\n            messageText: text,\n            category: message.category,\n            code: message.code,\n            next: details\n        };\n    }\n    ts.chainDiagnosticMessages = chainDiagnosticMessages;\n    function concatenateDiagnosticMessageChains(headChain, tailChain) {\n        var lastChain = headChain;\n        while (lastChain.next) {\n            lastChain = lastChain.next;\n        }\n        lastChain.next = tailChain;\n        return headChain;\n    }\n    ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains;\n    function compareValues(a, b) {\n        if (a === b)\n            return 0;\n        if (a === undefined)\n            return -1;\n        if (b === undefined)\n            return 1;\n        return a < b ? -1 : 1;\n    }\n    ts.compareValues = compareValues;\n    function compareStrings(a, b, ignoreCase) {\n        if (a === b)\n            return 0;\n        if (a === undefined)\n            return -1;\n        if (b === undefined)\n            return 1;\n        if (ignoreCase) {\n            if (ts.collator && String.prototype.localeCompare) {\n                var result = a.localeCompare(b, undefined, { usage: \"sort\", sensitivity: \"accent\" });\n                return result < 0 ? -1 : result > 0 ? 1 : 0;\n            }\n            a = a.toUpperCase();\n            b = b.toUpperCase();\n            if (a === b)\n                return 0;\n        }\n        return a < b ? -1 : 1;\n    }\n    ts.compareStrings = compareStrings;\n    function compareStringsCaseInsensitive(a, b) {\n        return compareStrings(a, b, true);\n    }\n    ts.compareStringsCaseInsensitive = compareStringsCaseInsensitive;\n    function getDiagnosticFileName(diagnostic) {\n        return diagnostic.file ? diagnostic.file.fileName : undefined;\n    }\n    function compareDiagnostics(d1, d2) {\n        return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) ||\n            compareValues(d1.start, d2.start) ||\n            compareValues(d1.length, d2.length) ||\n            compareValues(d1.code, d2.code) ||\n            compareMessageText(d1.messageText, d2.messageText) ||\n            0;\n    }\n    ts.compareDiagnostics = compareDiagnostics;\n    function compareMessageText(text1, text2) {\n        while (text1 && text2) {\n            var string1 = typeof text1 === \"string\" ? text1 : text1.messageText;\n            var string2 = typeof text2 === \"string\" ? text2 : text2.messageText;\n            var res = compareValues(string1, string2);\n            if (res) {\n                return res;\n            }\n            text1 = typeof text1 === \"string\" ? undefined : text1.next;\n            text2 = typeof text2 === \"string\" ? undefined : text2.next;\n        }\n        if (!text1 && !text2) {\n            return 0;\n        }\n        return text1 ? 1 : -1;\n    }\n    function sortAndDeduplicateDiagnostics(diagnostics) {\n        return deduplicateSortedDiagnostics(diagnostics.sort(compareDiagnostics));\n    }\n    ts.sortAndDeduplicateDiagnostics = sortAndDeduplicateDiagnostics;\n    function deduplicateSortedDiagnostics(diagnostics) {\n        if (diagnostics.length < 2) {\n            return diagnostics;\n        }\n        var newDiagnostics = [diagnostics[0]];\n        var previousDiagnostic = diagnostics[0];\n        for (var i = 1; i < diagnostics.length; i++) {\n            var currentDiagnostic = diagnostics[i];\n            var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === 0;\n            if (!isDupe) {\n                newDiagnostics.push(currentDiagnostic);\n                previousDiagnostic = currentDiagnostic;\n            }\n        }\n        return newDiagnostics;\n    }\n    ts.deduplicateSortedDiagnostics = deduplicateSortedDiagnostics;\n    function normalizeSlashes(path) {\n        return path.replace(/\\\\/g, \"/\");\n    }\n    ts.normalizeSlashes = normalizeSlashes;\n    function getRootLength(path) {\n        if (path.charCodeAt(0) === 47) {\n            if (path.charCodeAt(1) !== 47)\n                return 1;\n            var p1 = path.indexOf(\"/\", 2);\n            if (p1 < 0)\n                return 2;\n            var p2 = path.indexOf(\"/\", p1 + 1);\n            if (p2 < 0)\n                return p1 + 1;\n            return p2 + 1;\n        }\n        if (path.charCodeAt(1) === 58) {\n            if (path.charCodeAt(2) === 47)\n                return 3;\n            return 2;\n        }\n        if (path.lastIndexOf(\"file:///\", 0) === 0) {\n            return \"file:///\".length;\n        }\n        var idx = path.indexOf(\"://\");\n        if (idx !== -1) {\n            return idx + \"://\".length;\n        }\n        return 0;\n    }\n    ts.getRootLength = getRootLength;\n    ts.directorySeparator = \"/\";\n    var directorySeparatorCharCode = 47;\n    function getNormalizedParts(normalizedSlashedPath, rootLength) {\n        var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator);\n        var normalized = [];\n        for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {\n            var part = parts_1[_i];\n            if (part !== \".\") {\n                if (part === \"..\" && normalized.length > 0 && lastOrUndefined(normalized) !== \"..\") {\n                    normalized.pop();\n                }\n                else {\n                    if (part) {\n                        normalized.push(part);\n                    }\n                }\n            }\n        }\n        return normalized;\n    }\n    function normalizePath(path) {\n        path = normalizeSlashes(path);\n        var rootLength = getRootLength(path);\n        var root = path.substr(0, rootLength);\n        var normalized = getNormalizedParts(path, rootLength);\n        if (normalized.length) {\n            var joinedParts = root + normalized.join(ts.directorySeparator);\n            return pathEndsWithDirectorySeparator(path) ? joinedParts + ts.directorySeparator : joinedParts;\n        }\n        else {\n            return root;\n        }\n    }\n    ts.normalizePath = normalizePath;\n    function pathEndsWithDirectorySeparator(path) {\n        return path.charCodeAt(path.length - 1) === directorySeparatorCharCode;\n    }\n    ts.pathEndsWithDirectorySeparator = pathEndsWithDirectorySeparator;\n    function getDirectoryPath(path) {\n        return path.substr(0, Math.max(getRootLength(path), path.lastIndexOf(ts.directorySeparator)));\n    }\n    ts.getDirectoryPath = getDirectoryPath;\n    function isUrl(path) {\n        return path && !isRootedDiskPath(path) && path.indexOf(\"://\") !== -1;\n    }\n    ts.isUrl = isUrl;\n    function isExternalModuleNameRelative(moduleName) {\n        return /^\\.\\.?($|[\\\\/])/.test(moduleName);\n    }\n    ts.isExternalModuleNameRelative = isExternalModuleNameRelative;\n    function getEmitScriptTarget(compilerOptions) {\n        return compilerOptions.target || 0;\n    }\n    ts.getEmitScriptTarget = getEmitScriptTarget;\n    function getEmitModuleKind(compilerOptions) {\n        return typeof compilerOptions.module === \"number\" ?\n            compilerOptions.module :\n            getEmitScriptTarget(compilerOptions) >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS;\n    }\n    ts.getEmitModuleKind = getEmitModuleKind;\n    function getEmitModuleResolutionKind(compilerOptions) {\n        var moduleResolution = compilerOptions.moduleResolution;\n        if (moduleResolution === undefined) {\n            moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;\n        }\n        return moduleResolution;\n    }\n    ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;\n    function hasZeroOrOneAsteriskCharacter(str) {\n        var seenAsterisk = false;\n        for (var i = 0; i < str.length; i++) {\n            if (str.charCodeAt(i) === 42) {\n                if (!seenAsterisk) {\n                    seenAsterisk = true;\n                }\n                else {\n                    return false;\n                }\n            }\n        }\n        return true;\n    }\n    ts.hasZeroOrOneAsteriskCharacter = hasZeroOrOneAsteriskCharacter;\n    function isRootedDiskPath(path) {\n        return getRootLength(path) !== 0;\n    }\n    ts.isRootedDiskPath = isRootedDiskPath;\n    function convertToRelativePath(absoluteOrRelativePath, basePath, getCanonicalFileName) {\n        return !isRootedDiskPath(absoluteOrRelativePath)\n            ? absoluteOrRelativePath\n            : getRelativePathToDirectoryOrUrl(basePath, absoluteOrRelativePath, basePath, getCanonicalFileName, false);\n    }\n    ts.convertToRelativePath = convertToRelativePath;\n    function normalizedPathComponents(path, rootLength) {\n        var normalizedParts = getNormalizedParts(path, rootLength);\n        return [path.substr(0, rootLength)].concat(normalizedParts);\n    }\n    function getNormalizedPathComponents(path, currentDirectory) {\n        path = normalizeSlashes(path);\n        var rootLength = getRootLength(path);\n        if (rootLength === 0) {\n            path = combinePaths(normalizeSlashes(currentDirectory), path);\n            rootLength = getRootLength(path);\n        }\n        return normalizedPathComponents(path, rootLength);\n    }\n    ts.getNormalizedPathComponents = getNormalizedPathComponents;\n    function getNormalizedAbsolutePath(fileName, currentDirectory) {\n        return getNormalizedPathFromPathComponents(getNormalizedPathComponents(fileName, currentDirectory));\n    }\n    ts.getNormalizedAbsolutePath = getNormalizedAbsolutePath;\n    function getNormalizedPathFromPathComponents(pathComponents) {\n        if (pathComponents && pathComponents.length) {\n            return pathComponents[0] + pathComponents.slice(1).join(ts.directorySeparator);\n        }\n    }\n    ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents;\n    function getNormalizedPathComponentsOfUrl(url) {\n        var urlLength = url.length;\n        var rootLength = url.indexOf(\"://\") + \"://\".length;\n        while (rootLength < urlLength) {\n            if (url.charCodeAt(rootLength) === 47) {\n                rootLength++;\n            }\n            else {\n                break;\n            }\n        }\n        if (rootLength === urlLength) {\n            return [url];\n        }\n        var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength);\n        if (indexOfNextSlash !== -1) {\n            rootLength = indexOfNextSlash + 1;\n            return normalizedPathComponents(url, rootLength);\n        }\n        else {\n            return [url + ts.directorySeparator];\n        }\n    }\n    function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) {\n        if (isUrl(pathOrUrl)) {\n            return getNormalizedPathComponentsOfUrl(pathOrUrl);\n        }\n        else {\n            return getNormalizedPathComponents(pathOrUrl, currentDirectory);\n        }\n    }\n    function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) {\n        var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory);\n        var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory);\n        if (directoryComponents.length > 1 && lastOrUndefined(directoryComponents) === \"\") {\n            directoryComponents.length--;\n        }\n        var joinStartIndex;\n        for (joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) {\n            if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) {\n                break;\n            }\n        }\n        if (joinStartIndex) {\n            var relativePath = \"\";\n            var relativePathComponents = pathComponents.slice(joinStartIndex, pathComponents.length);\n            for (; joinStartIndex < directoryComponents.length; joinStartIndex++) {\n                if (directoryComponents[joinStartIndex] !== \"\") {\n                    relativePath = relativePath + \"..\" + ts.directorySeparator;\n                }\n            }\n            return relativePath + relativePathComponents.join(ts.directorySeparator);\n        }\n        var absolutePath = getNormalizedPathFromPathComponents(pathComponents);\n        if (isAbsolutePathAnUrl && isRootedDiskPath(absolutePath)) {\n            absolutePath = \"file:///\" + absolutePath;\n        }\n        return absolutePath;\n    }\n    ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl;\n    function getBaseFileName(path) {\n        if (path === undefined) {\n            return undefined;\n        }\n        var i = path.lastIndexOf(ts.directorySeparator);\n        return i < 0 ? path : path.substring(i + 1);\n    }\n    ts.getBaseFileName = getBaseFileName;\n    function combinePaths(path1, path2) {\n        if (!(path1 && path1.length))\n            return path2;\n        if (!(path2 && path2.length))\n            return path1;\n        if (getRootLength(path2) !== 0)\n            return path2;\n        if (path1.charAt(path1.length - 1) === ts.directorySeparator)\n            return path1 + path2;\n        return path1 + ts.directorySeparator + path2;\n    }\n    ts.combinePaths = combinePaths;\n    function removeTrailingDirectorySeparator(path) {\n        if (path.charAt(path.length - 1) === ts.directorySeparator) {\n            return path.substr(0, path.length - 1);\n        }\n        return path;\n    }\n    ts.removeTrailingDirectorySeparator = removeTrailingDirectorySeparator;\n    function ensureTrailingDirectorySeparator(path) {\n        if (path.charAt(path.length - 1) !== ts.directorySeparator) {\n            return path + ts.directorySeparator;\n        }\n        return path;\n    }\n    ts.ensureTrailingDirectorySeparator = ensureTrailingDirectorySeparator;\n    function comparePaths(a, b, currentDirectory, ignoreCase) {\n        if (a === b)\n            return 0;\n        if (a === undefined)\n            return -1;\n        if (b === undefined)\n            return 1;\n        a = removeTrailingDirectorySeparator(a);\n        b = removeTrailingDirectorySeparator(b);\n        var aComponents = getNormalizedPathComponents(a, currentDirectory);\n        var bComponents = getNormalizedPathComponents(b, currentDirectory);\n        var sharedLength = Math.min(aComponents.length, bComponents.length);\n        for (var i = 0; i < sharedLength; i++) {\n            var result = compareStrings(aComponents[i], bComponents[i], ignoreCase);\n            if (result !== 0) {\n                return result;\n            }\n        }\n        return compareValues(aComponents.length, bComponents.length);\n    }\n    ts.comparePaths = comparePaths;\n    function containsPath(parent, child, currentDirectory, ignoreCase) {\n        if (parent === undefined || child === undefined)\n            return false;\n        if (parent === child)\n            return true;\n        parent = removeTrailingDirectorySeparator(parent);\n        child = removeTrailingDirectorySeparator(child);\n        if (parent === child)\n            return true;\n        var parentComponents = getNormalizedPathComponents(parent, currentDirectory);\n        var childComponents = getNormalizedPathComponents(child, currentDirectory);\n        if (childComponents.length < parentComponents.length) {\n            return false;\n        }\n        for (var i = 0; i < parentComponents.length; i++) {\n            var result = compareStrings(parentComponents[i], childComponents[i], ignoreCase);\n            if (result !== 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n    ts.containsPath = containsPath;\n    function startsWith(str, prefix) {\n        return str.lastIndexOf(prefix, 0) === 0;\n    }\n    ts.startsWith = startsWith;\n    function endsWith(str, suffix) {\n        var expectedPos = str.length - suffix.length;\n        return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;\n    }\n    ts.endsWith = endsWith;\n    function hasExtension(fileName) {\n        return getBaseFileName(fileName).indexOf(\".\") >= 0;\n    }\n    ts.hasExtension = hasExtension;\n    function fileExtensionIs(path, extension) {\n        return path.length > extension.length && endsWith(path, extension);\n    }\n    ts.fileExtensionIs = fileExtensionIs;\n    function fileExtensionIsAny(path, extensions) {\n        for (var _i = 0, extensions_1 = extensions; _i < extensions_1.length; _i++) {\n            var extension = extensions_1[_i];\n            if (fileExtensionIs(path, extension)) {\n                return true;\n            }\n        }\n        return false;\n    }\n    ts.fileExtensionIsAny = fileExtensionIsAny;\n    var reservedCharacterPattern = /[^\\w\\s\\/]/g;\n    var wildcardCharCodes = [42, 63];\n    var singleAsteriskRegexFragmentFiles = \"([^./]|(\\\\.(?!min\\\\.js$))?)*\";\n    var singleAsteriskRegexFragmentOther = \"[^/]*\";\n    function getRegularExpressionForWildcard(specs, basePath, usage) {\n        if (specs === undefined || specs.length === 0) {\n            return undefined;\n        }\n        var replaceWildcardCharacter = usage === \"files\" ? replaceWildCardCharacterFiles : replaceWildCardCharacterOther;\n        var singleAsteriskRegexFragment = usage === \"files\" ? singleAsteriskRegexFragmentFiles : singleAsteriskRegexFragmentOther;\n        var doubleAsteriskRegexFragment = usage === \"exclude\" ? \"(/.+?)?\" : \"(/[^/.][^/]*)*?\";\n        var pattern = \"\";\n        var hasWrittenSubpattern = false;\n        for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {\n            var spec = specs_1[_i];\n            if (!spec) {\n                continue;\n            }\n            var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter);\n            if (subPattern === undefined) {\n                continue;\n            }\n            if (hasWrittenSubpattern) {\n                pattern += \"|\";\n            }\n            pattern += \"(\" + subPattern + \")\";\n            hasWrittenSubpattern = true;\n        }\n        if (!pattern) {\n            return undefined;\n        }\n        var terminator = usage === \"exclude\" ? \"($|/)\" : \"$\";\n        return \"^(\" + pattern + \")\" + terminator;\n    }\n    ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard;\n    function isImplicitGlob(lastPathComponent) {\n        return !/[.*?]/.test(lastPathComponent);\n    }\n    ts.isImplicitGlob = isImplicitGlob;\n    function getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter) {\n        var subpattern = \"\";\n        var hasRecursiveDirectoryWildcard = false;\n        var hasWrittenComponent = false;\n        var components = getNormalizedPathComponents(spec, basePath);\n        var lastComponent = lastOrUndefined(components);\n        if (usage !== \"exclude\" && lastComponent === \"**\") {\n            return undefined;\n        }\n        components[0] = removeTrailingDirectorySeparator(components[0]);\n        if (isImplicitGlob(lastComponent)) {\n            components.push(\"**\", \"*\");\n        }\n        var optionalCount = 0;\n        for (var _i = 0, components_1 = components; _i < components_1.length; _i++) {\n            var component = components_1[_i];\n            if (component === \"**\") {\n                if (hasRecursiveDirectoryWildcard) {\n                    return undefined;\n                }\n                subpattern += doubleAsteriskRegexFragment;\n                hasRecursiveDirectoryWildcard = true;\n            }\n            else {\n                if (usage === \"directories\") {\n                    subpattern += \"(\";\n                    optionalCount++;\n                }\n                if (hasWrittenComponent) {\n                    subpattern += ts.directorySeparator;\n                }\n                if (usage !== \"exclude\") {\n                    if (component.charCodeAt(0) === 42) {\n                        subpattern += \"([^./]\" + singleAsteriskRegexFragment + \")?\";\n                        component = component.substr(1);\n                    }\n                    else if (component.charCodeAt(0) === 63) {\n                        subpattern += \"[^./]\";\n                        component = component.substr(1);\n                    }\n                }\n                subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter);\n            }\n            hasWrittenComponent = true;\n        }\n        while (optionalCount > 0) {\n            subpattern += \")?\";\n            optionalCount--;\n        }\n        return subpattern;\n    }\n    function replaceWildCardCharacterFiles(match) {\n        return replaceWildcardCharacter(match, singleAsteriskRegexFragmentFiles);\n    }\n    function replaceWildCardCharacterOther(match) {\n        return replaceWildcardCharacter(match, singleAsteriskRegexFragmentOther);\n    }\n    function replaceWildcardCharacter(match, singleAsteriskRegexFragment) {\n        return match === \"*\" ? singleAsteriskRegexFragment : match === \"?\" ? \"[^/]\" : \"\\\\\" + match;\n    }\n    function getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory) {\n        path = normalizePath(path);\n        currentDirectory = normalizePath(currentDirectory);\n        var absolutePath = combinePaths(currentDirectory, path);\n        return {\n            includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, \"files\"),\n            includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, \"directories\"),\n            excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, \"exclude\"),\n            basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames)\n        };\n    }\n    ts.getFileMatcherPatterns = getFileMatcherPatterns;\n    function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, getFileSystemEntries) {\n        path = normalizePath(path);\n        currentDirectory = normalizePath(currentDirectory);\n        var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);\n        var regexFlag = useCaseSensitiveFileNames ? \"\" : \"i\";\n        var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag);\n        var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag);\n        var excludeRegex = patterns.excludePattern && new RegExp(patterns.excludePattern, regexFlag);\n        var result = [];\n        for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {\n            var basePath = _a[_i];\n            visitDirectory(basePath, combinePaths(currentDirectory, basePath));\n        }\n        return result;\n        function visitDirectory(path, absolutePath) {\n            var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;\n            for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {\n                var current = files_1[_i];\n                var name_1 = combinePaths(path, current);\n                var absoluteName = combinePaths(absolutePath, current);\n                if ((!extensions || fileExtensionIsAny(name_1, extensions)) &&\n                    (!includeFileRegex || includeFileRegex.test(absoluteName)) &&\n                    (!excludeRegex || !excludeRegex.test(absoluteName))) {\n                    result.push(name_1);\n                }\n            }\n            for (var _b = 0, directories_1 = directories; _b < directories_1.length; _b++) {\n                var current = directories_1[_b];\n                var name_2 = combinePaths(path, current);\n                var absoluteName = combinePaths(absolutePath, current);\n                if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&\n                    (!excludeRegex || !excludeRegex.test(absoluteName))) {\n                    visitDirectory(name_2, absoluteName);\n                }\n            }\n        }\n    }\n    ts.matchFiles = matchFiles;\n    function getBasePaths(path, includes, useCaseSensitiveFileNames) {\n        var basePaths = [path];\n        if (includes) {\n            var includeBasePaths = [];\n            for (var _i = 0, includes_1 = includes; _i < includes_1.length; _i++) {\n                var include = includes_1[_i];\n                var absolute = isRootedDiskPath(include) ? include : normalizePath(combinePaths(path, include));\n                includeBasePaths.push(getIncludeBasePath(absolute));\n            }\n            includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive);\n            var _loop_1 = function (includeBasePath) {\n                if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) {\n                    basePaths.push(includeBasePath);\n                }\n            };\n            for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) {\n                var includeBasePath = includeBasePaths_1[_a];\n                _loop_1(includeBasePath);\n            }\n        }\n        return basePaths;\n    }\n    function getIncludeBasePath(absolute) {\n        var wildcardOffset = indexOfAnyCharCode(absolute, wildcardCharCodes);\n        if (wildcardOffset < 0) {\n            return !hasExtension(absolute)\n                ? absolute\n                : removeTrailingDirectorySeparator(getDirectoryPath(absolute));\n        }\n        return absolute.substring(0, absolute.lastIndexOf(ts.directorySeparator, wildcardOffset));\n    }\n    function ensureScriptKind(fileName, scriptKind) {\n        return (scriptKind || getScriptKindFromFileName(fileName)) || 3;\n    }\n    ts.ensureScriptKind = ensureScriptKind;\n    function getScriptKindFromFileName(fileName) {\n        var ext = fileName.substr(fileName.lastIndexOf(\".\"));\n        switch (ext.toLowerCase()) {\n            case \".js\":\n                return 1;\n            case \".jsx\":\n                return 2;\n            case \".ts\":\n                return 3;\n            case \".tsx\":\n                return 4;\n            default:\n                return 0;\n        }\n    }\n    ts.getScriptKindFromFileName = getScriptKindFromFileName;\n    ts.supportedTypeScriptExtensions = [\".ts\", \".tsx\", \".d.ts\"];\n    ts.supportedTypescriptExtensionsForExtractExtension = [\".d.ts\", \".ts\", \".tsx\"];\n    ts.supportedJavascriptExtensions = [\".js\", \".jsx\"];\n    var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions);\n    function getSupportedExtensions(options) {\n        return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions;\n    }\n    ts.getSupportedExtensions = getSupportedExtensions;\n    function hasJavaScriptFileExtension(fileName) {\n        return forEach(ts.supportedJavascriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); });\n    }\n    ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension;\n    function hasTypeScriptFileExtension(fileName) {\n        return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); });\n    }\n    ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension;\n    function isSupportedSourceFileName(fileName, compilerOptions) {\n        if (!fileName) {\n            return false;\n        }\n        for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) {\n            var extension = _a[_i];\n            if (fileExtensionIs(fileName, extension)) {\n                return true;\n            }\n        }\n        return false;\n    }\n    ts.isSupportedSourceFileName = isSupportedSourceFileName;\n    function getExtensionPriority(path, supportedExtensions) {\n        for (var i = supportedExtensions.length - 1; i >= 0; i--) {\n            if (fileExtensionIs(path, supportedExtensions[i])) {\n                return adjustExtensionPriority(i);\n            }\n        }\n        return 0;\n    }\n    ts.getExtensionPriority = getExtensionPriority;\n    function adjustExtensionPriority(extensionPriority) {\n        if (extensionPriority < 2) {\n            return 0;\n        }\n        else if (extensionPriority < 5) {\n            return 2;\n        }\n        else {\n            return 5;\n        }\n    }\n    ts.adjustExtensionPriority = adjustExtensionPriority;\n    function getNextLowestExtensionPriority(extensionPriority) {\n        if (extensionPriority < 2) {\n            return 2;\n        }\n        else {\n            return 5;\n        }\n    }\n    ts.getNextLowestExtensionPriority = getNextLowestExtensionPriority;\n    var extensionsToRemove = [\".d.ts\", \".ts\", \".js\", \".tsx\", \".jsx\"];\n    function removeFileExtension(path) {\n        for (var _i = 0, extensionsToRemove_1 = extensionsToRemove; _i < extensionsToRemove_1.length; _i++) {\n            var ext = extensionsToRemove_1[_i];\n            var extensionless = tryRemoveExtension(path, ext);\n            if (extensionless !== undefined) {\n                return extensionless;\n            }\n        }\n        return path;\n    }\n    ts.removeFileExtension = removeFileExtension;\n    function tryRemoveExtension(path, extension) {\n        return fileExtensionIs(path, extension) ? removeExtension(path, extension) : undefined;\n    }\n    ts.tryRemoveExtension = tryRemoveExtension;\n    function removeExtension(path, extension) {\n        return path.substring(0, path.length - extension.length);\n    }\n    ts.removeExtension = removeExtension;\n    function changeExtension(path, newExtension) {\n        return (removeFileExtension(path) + newExtension);\n    }\n    ts.changeExtension = changeExtension;\n    function Symbol(flags, name) {\n        this.flags = flags;\n        this.name = name;\n        this.declarations = undefined;\n    }\n    function Type(_checker, flags) {\n        this.flags = flags;\n    }\n    function Signature() {\n    }\n    function Node(kind, pos, end) {\n        this.id = 0;\n        this.kind = kind;\n        this.pos = pos;\n        this.end = end;\n        this.flags = 0;\n        this.modifierFlagsCache = 0;\n        this.transformFlags = 0;\n        this.parent = undefined;\n        this.original = undefined;\n    }\n    ts.objectAllocator = {\n        getNodeConstructor: function () { return Node; },\n        getTokenConstructor: function () { return Node; },\n        getIdentifierConstructor: function () { return Node; },\n        getSourceFileConstructor: function () { return Node; },\n        getSymbolConstructor: function () { return Symbol; },\n        getTypeConstructor: function () { return Type; },\n        getSignatureConstructor: function () { return Signature; }\n    };\n    var Debug;\n    (function (Debug) {\n        Debug.currentAssertionLevel = 0;\n        function shouldAssert(level) {\n            return Debug.currentAssertionLevel >= level;\n        }\n        Debug.shouldAssert = shouldAssert;\n        function assert(expression, message, verboseDebugInfo) {\n            if (!expression) {\n                var verboseDebugString = \"\";\n                if (verboseDebugInfo) {\n                    verboseDebugString = \"\\r\\nVerbose Debug Information: \" + verboseDebugInfo();\n                }\n                debugger;\n                throw new Error(\"Debug Failure. False expression: \" + (message || \"\") + verboseDebugString);\n            }\n        }\n        Debug.assert = assert;\n        function fail(message) {\n            Debug.assert(false, message);\n        }\n        Debug.fail = fail;\n    })(Debug = ts.Debug || (ts.Debug = {}));\n    function orderedRemoveItem(array, item) {\n        for (var i = 0; i < array.length; i++) {\n            if (array[i] === item) {\n                orderedRemoveItemAt(array, i);\n                return true;\n            }\n        }\n        return false;\n    }\n    ts.orderedRemoveItem = orderedRemoveItem;\n    function orderedRemoveItemAt(array, index) {\n        for (var i = index; i < array.length - 1; i++) {\n            array[i] = array[i + 1];\n        }\n        array.pop();\n    }\n    ts.orderedRemoveItemAt = orderedRemoveItemAt;\n    function unorderedRemoveItemAt(array, index) {\n        array[index] = array[array.length - 1];\n        array.pop();\n    }\n    ts.unorderedRemoveItemAt = unorderedRemoveItemAt;\n    function unorderedRemoveItem(array, item) {\n        unorderedRemoveFirstItemWhere(array, function (element) { return element === item; });\n    }\n    ts.unorderedRemoveItem = unorderedRemoveItem;\n    function unorderedRemoveFirstItemWhere(array, predicate) {\n        for (var i = 0; i < array.length; i++) {\n            if (predicate(array[i])) {\n                unorderedRemoveItemAt(array, i);\n                break;\n            }\n        }\n    }\n    function createGetCanonicalFileName(useCaseSensitiveFileNames) {\n        return useCaseSensitiveFileNames\n            ? (function (fileName) { return fileName; })\n            : (function (fileName) { return fileName.toLowerCase(); });\n    }\n    ts.createGetCanonicalFileName = createGetCanonicalFileName;\n    function matchPatternOrExact(patternStrings, candidate) {\n        var patterns = [];\n        for (var _i = 0, patternStrings_1 = patternStrings; _i < patternStrings_1.length; _i++) {\n            var patternString = patternStrings_1[_i];\n            var pattern = tryParsePattern(patternString);\n            if (pattern) {\n                patterns.push(pattern);\n            }\n            else if (patternString === candidate) {\n                return patternString;\n            }\n        }\n        return findBestPatternMatch(patterns, function (_) { return _; }, candidate);\n    }\n    ts.matchPatternOrExact = matchPatternOrExact;\n    function patternText(_a) {\n        var prefix = _a.prefix, suffix = _a.suffix;\n        return prefix + \"*\" + suffix;\n    }\n    ts.patternText = patternText;\n    function matchedText(pattern, candidate) {\n        Debug.assert(isPatternMatch(pattern, candidate));\n        return candidate.substr(pattern.prefix.length, candidate.length - pattern.suffix.length);\n    }\n    ts.matchedText = matchedText;\n    function findBestPatternMatch(values, getPattern, candidate) {\n        var matchedValue = undefined;\n        var longestMatchPrefixLength = -1;\n        for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {\n            var v = values_1[_i];\n            var pattern = getPattern(v);\n            if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) {\n                longestMatchPrefixLength = pattern.prefix.length;\n                matchedValue = v;\n            }\n        }\n        return matchedValue;\n    }\n    ts.findBestPatternMatch = findBestPatternMatch;\n    function isPatternMatch(_a, candidate) {\n        var prefix = _a.prefix, suffix = _a.suffix;\n        return candidate.length >= prefix.length + suffix.length &&\n            startsWith(candidate, prefix) &&\n            endsWith(candidate, suffix);\n    }\n    function tryParsePattern(pattern) {\n        Debug.assert(hasZeroOrOneAsteriskCharacter(pattern));\n        var indexOfStar = pattern.indexOf(\"*\");\n        return indexOfStar === -1 ? undefined : {\n            prefix: pattern.substr(0, indexOfStar),\n            suffix: pattern.substr(indexOfStar + 1)\n        };\n    }\n    ts.tryParsePattern = tryParsePattern;\n    function positionIsSynthesized(pos) {\n        return !(pos >= 0);\n    }\n    ts.positionIsSynthesized = positionIsSynthesized;\n    function extensionIsTypeScript(ext) {\n        return ext <= ts.Extension.LastTypeScriptExtension;\n    }\n    ts.extensionIsTypeScript = extensionIsTypeScript;\n    function extensionFromPath(path) {\n        var ext = tryGetExtensionFromPath(path);\n        if (ext !== undefined) {\n            return ext;\n        }\n        Debug.fail(\"File \" + path + \" has unknown extension.\");\n    }\n    ts.extensionFromPath = extensionFromPath;\n    function tryGetExtensionFromPath(path) {\n        if (fileExtensionIs(path, \".d.ts\")) {\n            return ts.Extension.Dts;\n        }\n        if (fileExtensionIs(path, \".ts\")) {\n            return ts.Extension.Ts;\n        }\n        if (fileExtensionIs(path, \".tsx\")) {\n            return ts.Extension.Tsx;\n        }\n        if (fileExtensionIs(path, \".js\")) {\n            return ts.Extension.Js;\n        }\n        if (fileExtensionIs(path, \".jsx\")) {\n            return ts.Extension.Jsx;\n        }\n    }\n    ts.tryGetExtensionFromPath = tryGetExtensionFromPath;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    ts.sys = (function () {\n        function getWScriptSystem() {\n            var fso = new ActiveXObject(\"Scripting.FileSystemObject\");\n            var shell = new ActiveXObject(\"WScript.Shell\");\n            var fileStream = new ActiveXObject(\"ADODB.Stream\");\n            fileStream.Type = 2;\n            var binaryStream = new ActiveXObject(\"ADODB.Stream\");\n            binaryStream.Type = 1;\n            var args = [];\n            for (var i = 0; i < WScript.Arguments.length; i++) {\n                args[i] = WScript.Arguments.Item(i);\n            }\n            function readFile(fileName, encoding) {\n                if (!fso.FileExists(fileName)) {\n                    return undefined;\n                }\n                fileStream.Open();\n                try {\n                    if (encoding) {\n                        fileStream.Charset = encoding;\n                        fileStream.LoadFromFile(fileName);\n                    }\n                    else {\n                        fileStream.Charset = \"x-ansi\";\n                        fileStream.LoadFromFile(fileName);\n                        var bom = fileStream.ReadText(2) || \"\";\n                        fileStream.Position = 0;\n                        fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? \"unicode\" : \"utf-8\";\n                    }\n                    return fileStream.ReadText();\n                }\n                catch (e) {\n                    throw e;\n                }\n                finally {\n                    fileStream.Close();\n                }\n            }\n            function writeFile(fileName, data, writeByteOrderMark) {\n                fileStream.Open();\n                binaryStream.Open();\n                try {\n                    fileStream.Charset = \"utf-8\";\n                    fileStream.WriteText(data);\n                    if (writeByteOrderMark) {\n                        fileStream.Position = 0;\n                    }\n                    else {\n                        fileStream.Position = 3;\n                    }\n                    fileStream.CopyTo(binaryStream);\n                    binaryStream.SaveToFile(fileName, 2);\n                }\n                finally {\n                    binaryStream.Close();\n                    fileStream.Close();\n                }\n            }\n            function getNames(collection) {\n                var result = [];\n                for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) {\n                    result.push(e.item().Name);\n                }\n                return result.sort();\n            }\n            function getDirectories(path) {\n                var folder = fso.GetFolder(path);\n                return getNames(folder.subfolders);\n            }\n            function getAccessibleFileSystemEntries(path) {\n                try {\n                    var folder = fso.GetFolder(path || \".\");\n                    var files = getNames(folder.files);\n                    var directories = getNames(folder.subfolders);\n                    return { files: files, directories: directories };\n                }\n                catch (e) {\n                    return { files: [], directories: [] };\n                }\n            }\n            function readDirectory(path, extensions, excludes, includes) {\n                return ts.matchFiles(path, extensions, excludes, includes, false, shell.CurrentDirectory, getAccessibleFileSystemEntries);\n            }\n            var wscriptSystem = {\n                args: args,\n                newLine: \"\\r\\n\",\n                useCaseSensitiveFileNames: false,\n                write: function (s) {\n                    WScript.StdOut.Write(s);\n                },\n                readFile: readFile,\n                writeFile: writeFile,\n                resolvePath: function (path) {\n                    return fso.GetAbsolutePathName(path);\n                },\n                fileExists: function (path) {\n                    return fso.FileExists(path);\n                },\n                directoryExists: function (path) {\n                    return fso.FolderExists(path);\n                },\n                createDirectory: function (directoryName) {\n                    if (!wscriptSystem.directoryExists(directoryName)) {\n                        fso.CreateFolder(directoryName);\n                    }\n                },\n                getExecutingFilePath: function () {\n                    return WScript.ScriptFullName;\n                },\n                getCurrentDirectory: function () {\n                    return shell.CurrentDirectory;\n                },\n                getDirectories: getDirectories,\n                getEnvironmentVariable: function (name) {\n                    return new ActiveXObject(\"WScript.Shell\").ExpandEnvironmentStrings(\"%\" + name + \"%\");\n                },\n                readDirectory: readDirectory,\n                exit: function (exitCode) {\n                    try {\n                        WScript.Quit(exitCode);\n                    }\n                    catch (e) {\n                    }\n                }\n            };\n            return wscriptSystem;\n        }\n        function getNodeSystem() {\n            var _fs = require(\"fs\");\n            var _path = require(\"path\");\n            var _os = require(\"os\");\n            var _crypto = require(\"crypto\");\n            var useNonPollingWatchers = process.env[\"TSC_NONPOLLING_WATCHER\"];\n            function createWatchedFileSet() {\n                var dirWatchers = ts.createMap();\n                var fileWatcherCallbacks = ts.createMap();\n                return { addFile: addFile, removeFile: removeFile };\n                function reduceDirWatcherRefCountForFile(fileName) {\n                    var dirName = ts.getDirectoryPath(fileName);\n                    var watcher = dirWatchers[dirName];\n                    if (watcher) {\n                        watcher.referenceCount -= 1;\n                        if (watcher.referenceCount <= 0) {\n                            watcher.close();\n                            delete dirWatchers[dirName];\n                        }\n                    }\n                }\n                function addDirWatcher(dirPath) {\n                    var watcher = dirWatchers[dirPath];\n                    if (watcher) {\n                        watcher.referenceCount += 1;\n                        return;\n                    }\n                    watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); });\n                    watcher.referenceCount = 1;\n                    dirWatchers[dirPath] = watcher;\n                    return;\n                }\n                function addFileWatcherCallback(filePath, callback) {\n                    ts.multiMapAdd(fileWatcherCallbacks, filePath, callback);\n                }\n                function addFile(fileName, callback) {\n                    addFileWatcherCallback(fileName, callback);\n                    addDirWatcher(ts.getDirectoryPath(fileName));\n                    return { fileName: fileName, callback: callback };\n                }\n                function removeFile(watchedFile) {\n                    removeFileWatcherCallback(watchedFile.fileName, watchedFile.callback);\n                    reduceDirWatcherRefCountForFile(watchedFile.fileName);\n                }\n                function removeFileWatcherCallback(filePath, callback) {\n                    ts.multiMapRemove(fileWatcherCallbacks, filePath, callback);\n                }\n                function fileEventHandler(eventName, relativeFileName, baseDirPath) {\n                    var fileName = typeof relativeFileName !== \"string\"\n                        ? undefined\n                        : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath);\n                    if ((eventName === \"change\" || eventName === \"rename\") && fileWatcherCallbacks[fileName]) {\n                        for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) {\n                            var fileCallback = _a[_i];\n                            fileCallback(fileName);\n                        }\n                    }\n                }\n            }\n            var watchedFileSet = createWatchedFileSet();\n            function isNode4OrLater() {\n                return parseInt(process.version.charAt(1)) >= 4;\n            }\n            function isFileSystemCaseSensitive() {\n                if (platform === \"win32\" || platform === \"win64\") {\n                    return false;\n                }\n                return !fileExists(__filename.toUpperCase()) || !fileExists(__filename.toLowerCase());\n            }\n            var platform = _os.platform();\n            var useCaseSensitiveFileNames = isFileSystemCaseSensitive();\n            function readFile(fileName, _encoding) {\n                if (!fileExists(fileName)) {\n                    return undefined;\n                }\n                var buffer = _fs.readFileSync(fileName);\n                var len = buffer.length;\n                if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) {\n                    len &= ~1;\n                    for (var i = 0; i < len; i += 2) {\n                        var temp = buffer[i];\n                        buffer[i] = buffer[i + 1];\n                        buffer[i + 1] = temp;\n                    }\n                    return buffer.toString(\"utf16le\", 2);\n                }\n                if (len >= 2 && buffer[0] === 0xFF && buffer[1] === 0xFE) {\n                    return buffer.toString(\"utf16le\", 2);\n                }\n                if (len >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) {\n                    return buffer.toString(\"utf8\", 3);\n                }\n                return buffer.toString(\"utf8\");\n            }\n            function writeFile(fileName, data, writeByteOrderMark) {\n                if (writeByteOrderMark) {\n                    data = \"\\uFEFF\" + data;\n                }\n                var fd;\n                try {\n                    fd = _fs.openSync(fileName, \"w\");\n                    _fs.writeSync(fd, data, undefined, \"utf8\");\n                }\n                finally {\n                    if (fd !== undefined) {\n                        _fs.closeSync(fd);\n                    }\n                }\n            }\n            function getAccessibleFileSystemEntries(path) {\n                try {\n                    var entries = _fs.readdirSync(path || \".\").sort();\n                    var files = [];\n                    var directories = [];\n                    for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n                        var entry = entries_1[_i];\n                        if (entry === \".\" || entry === \"..\") {\n                            continue;\n                        }\n                        var name_3 = ts.combinePaths(path, entry);\n                        var stat = void 0;\n                        try {\n                            stat = _fs.statSync(name_3);\n                        }\n                        catch (e) {\n                            continue;\n                        }\n                        if (stat.isFile()) {\n                            files.push(entry);\n                        }\n                        else if (stat.isDirectory()) {\n                            directories.push(entry);\n                        }\n                    }\n                    return { files: files, directories: directories };\n                }\n                catch (e) {\n                    return { files: [], directories: [] };\n                }\n            }\n            function readDirectory(path, extensions, excludes, includes) {\n                return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), getAccessibleFileSystemEntries);\n            }\n            function fileSystemEntryExists(path, entryKind) {\n                try {\n                    var stat = _fs.statSync(path);\n                    switch (entryKind) {\n                        case 0: return stat.isFile();\n                        case 1: return stat.isDirectory();\n                    }\n                }\n                catch (e) {\n                    return false;\n                }\n            }\n            function fileExists(path) {\n                return fileSystemEntryExists(path, 0);\n            }\n            function directoryExists(path) {\n                return fileSystemEntryExists(path, 1);\n            }\n            function getDirectories(path) {\n                return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1); });\n            }\n            var noOpFileWatcher = { close: ts.noop };\n            var nodeSystem = {\n                args: process.argv.slice(2),\n                newLine: _os.EOL,\n                useCaseSensitiveFileNames: useCaseSensitiveFileNames,\n                write: function (s) {\n                    process.stdout.write(s);\n                },\n                readFile: readFile,\n                writeFile: writeFile,\n                watchFile: function (fileName, callback, pollingInterval) {\n                    if (useNonPollingWatchers) {\n                        var watchedFile_1 = watchedFileSet.addFile(fileName, callback);\n                        return {\n                            close: function () { return watchedFileSet.removeFile(watchedFile_1); }\n                        };\n                    }\n                    else {\n                        _fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);\n                        return {\n                            close: function () { return _fs.unwatchFile(fileName, fileChanged); }\n                        };\n                    }\n                    function fileChanged(curr, prev) {\n                        if (+curr.mtime <= +prev.mtime) {\n                            return;\n                        }\n                        callback(fileName);\n                    }\n                },\n                watchDirectory: function (directoryName, callback, recursive) {\n                    var options;\n                    if (!directoryExists(directoryName)) {\n                        return noOpFileWatcher;\n                    }\n                    if (isNode4OrLater() && (process.platform === \"win32\" || process.platform === \"darwin\")) {\n                        options = { persistent: true, recursive: !!recursive };\n                    }\n                    else {\n                        options = { persistent: true };\n                    }\n                    return _fs.watch(directoryName, options, function (eventName, relativeFileName) {\n                        if (eventName === \"rename\") {\n                            callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName)));\n                        }\n                        ;\n                    });\n                },\n                resolvePath: function (path) {\n                    return _path.resolve(path);\n                },\n                fileExists: fileExists,\n                directoryExists: directoryExists,\n                createDirectory: function (directoryName) {\n                    if (!nodeSystem.directoryExists(directoryName)) {\n                        _fs.mkdirSync(directoryName);\n                    }\n                },\n                getExecutingFilePath: function () {\n                    return __filename;\n                },\n                getCurrentDirectory: function () {\n                    return process.cwd();\n                },\n                getDirectories: getDirectories,\n                getEnvironmentVariable: function (name) {\n                    return process.env[name] || \"\";\n                },\n                readDirectory: readDirectory,\n                getModifiedTime: function (path) {\n                    try {\n                        return _fs.statSync(path).mtime;\n                    }\n                    catch (e) {\n                        return undefined;\n                    }\n                },\n                createHash: function (data) {\n                    var hash = _crypto.createHash(\"md5\");\n                    hash.update(data);\n                    return hash.digest(\"hex\");\n                },\n                getMemoryUsage: function () {\n                    if (global.gc) {\n                        global.gc();\n                    }\n                    return process.memoryUsage().heapUsed;\n                },\n                getFileSize: function (path) {\n                    try {\n                        var stat = _fs.statSync(path);\n                        if (stat.isFile()) {\n                            return stat.size;\n                        }\n                    }\n                    catch (e) { }\n                    return 0;\n                },\n                exit: function (exitCode) {\n                    process.exit(exitCode);\n                },\n                realpath: function (path) {\n                    return _fs.realpathSync(path);\n                },\n                tryEnableSourceMapsForHost: function () {\n                    try {\n                        require(\"source-map-support\").install();\n                    }\n                    catch (e) {\n                    }\n                },\n                setTimeout: setTimeout,\n                clearTimeout: clearTimeout\n            };\n            return nodeSystem;\n        }\n        function getChakraSystem() {\n            var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });\n            return {\n                newLine: ChakraHost.newLine || \"\\r\\n\",\n                args: ChakraHost.args,\n                useCaseSensitiveFileNames: !!ChakraHost.useCaseSensitiveFileNames,\n                write: ChakraHost.echo,\n                readFile: function (path, _encoding) {\n                    return ChakraHost.readFile(path);\n                },\n                writeFile: function (path, data, writeByteOrderMark) {\n                    if (writeByteOrderMark) {\n                        data = \"\\uFEFF\" + data;\n                    }\n                    ChakraHost.writeFile(path, data);\n                },\n                resolvePath: ChakraHost.resolvePath,\n                fileExists: ChakraHost.fileExists,\n                directoryExists: ChakraHost.directoryExists,\n                createDirectory: ChakraHost.createDirectory,\n                getExecutingFilePath: function () { return ChakraHost.executingFile; },\n                getCurrentDirectory: function () { return ChakraHost.currentDirectory; },\n                getDirectories: ChakraHost.getDirectories,\n                getEnvironmentVariable: ChakraHost.getEnvironmentVariable || (function () { return \"\"; }),\n                readDirectory: function (path, extensions, excludes, includes) {\n                    var pattern = ts.getFileMatcherPatterns(path, excludes, includes, !!ChakraHost.useCaseSensitiveFileNames, ChakraHost.currentDirectory);\n                    return ChakraHost.readDirectory(path, extensions, pattern.basePaths, pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern);\n                },\n                exit: ChakraHost.quit,\n                realpath: realpath\n            };\n        }\n        function recursiveCreateDirectory(directoryPath, sys) {\n            var basePath = ts.getDirectoryPath(directoryPath);\n            var shouldCreateParent = directoryPath !== basePath && !sys.directoryExists(basePath);\n            if (shouldCreateParent) {\n                recursiveCreateDirectory(basePath, sys);\n            }\n            if (shouldCreateParent || !sys.directoryExists(directoryPath)) {\n                sys.createDirectory(directoryPath);\n            }\n        }\n        var sys;\n        if (typeof ChakraHost !== \"undefined\") {\n            sys = getChakraSystem();\n        }\n        else if (typeof WScript !== \"undefined\" && typeof ActiveXObject === \"function\") {\n            sys = getWScriptSystem();\n        }\n        else if (typeof process !== \"undefined\" && process.nextTick && !process.browser && typeof require !== \"undefined\") {\n            sys = getNodeSystem();\n        }\n        if (sys) {\n            var originalWriteFile_1 = sys.writeFile;\n            sys.writeFile = function (path, data, writeBom) {\n                var directoryPath = ts.getDirectoryPath(ts.normalizeSlashes(path));\n                if (directoryPath && !sys.directoryExists(directoryPath)) {\n                    recursiveCreateDirectory(directoryPath, sys);\n                }\n                originalWriteFile_1.call(sys, path, data, writeBom);\n            };\n        }\n        return sys;\n    })();\n    if (ts.sys && ts.sys.getEnvironmentVariable) {\n        ts.Debug.currentAssertionLevel = /^development$/i.test(ts.sys.getEnvironmentVariable(\"NODE_ENV\"))\n            ? 1\n            : 0;\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    ts.Diagnostics = {\n        Unterminated_string_literal: { code: 1002, category: ts.DiagnosticCategory.Error, key: \"Unterminated_string_literal_1002\", message: \"Unterminated string literal.\" },\n        Identifier_expected: { code: 1003, category: ts.DiagnosticCategory.Error, key: \"Identifier_expected_1003\", message: \"Identifier expected.\" },\n        _0_expected: { code: 1005, category: ts.DiagnosticCategory.Error, key: \"_0_expected_1005\", message: \"'{0}' expected.\" },\n        A_file_cannot_have_a_reference_to_itself: { code: 1006, category: ts.DiagnosticCategory.Error, key: \"A_file_cannot_have_a_reference_to_itself_1006\", message: \"A file cannot have a reference to itself.\" },\n        Trailing_comma_not_allowed: { code: 1009, category: ts.DiagnosticCategory.Error, key: \"Trailing_comma_not_allowed_1009\", message: \"Trailing comma not allowed.\" },\n        Asterisk_Slash_expected: { code: 1010, category: ts.DiagnosticCategory.Error, key: \"Asterisk_Slash_expected_1010\", message: \"'*/' expected.\" },\n        Unexpected_token: { code: 1012, category: ts.DiagnosticCategory.Error, key: \"Unexpected_token_1012\", message: \"Unexpected token.\" },\n        A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: ts.DiagnosticCategory.Error, key: \"A_rest_parameter_must_be_last_in_a_parameter_list_1014\", message: \"A rest parameter must be last in a parameter list.\" },\n        Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: ts.DiagnosticCategory.Error, key: \"Parameter_cannot_have_question_mark_and_initializer_1015\", message: \"Parameter cannot have question mark and initializer.\" },\n        A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: ts.DiagnosticCategory.Error, key: \"A_required_parameter_cannot_follow_an_optional_parameter_1016\", message: \"A required parameter cannot follow an optional parameter.\" },\n        An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_cannot_have_a_rest_parameter_1017\", message: \"An index signature cannot have a rest parameter.\" },\n        An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_parameter_cannot_have_an_accessibility_modifier_1018\", message: \"An index signature parameter cannot have an accessibility modifier.\" },\n        An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_parameter_cannot_have_a_question_mark_1019\", message: \"An index signature parameter cannot have a question mark.\" },\n        An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_parameter_cannot_have_an_initializer_1020\", message: \"An index signature parameter cannot have an initializer.\" },\n        An_index_signature_must_have_a_type_annotation: { code: 1021, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_must_have_a_type_annotation_1021\", message: \"An index signature must have a type annotation.\" },\n        An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_parameter_must_have_a_type_annotation_1022\", message: \"An index signature parameter must have a type annotation.\" },\n        An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_parameter_type_must_be_string_or_number_1023\", message: \"An index signature parameter type must be 'string' or 'number'.\" },\n        readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature: { code: 1024, category: ts.DiagnosticCategory.Error, key: \"readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature_1024\", message: \"'readonly' modifier can only appear on a property declaration or index signature.\" },\n        Accessibility_modifier_already_seen: { code: 1028, category: ts.DiagnosticCategory.Error, key: \"Accessibility_modifier_already_seen_1028\", message: \"Accessibility modifier already seen.\" },\n        _0_modifier_must_precede_1_modifier: { code: 1029, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_must_precede_1_modifier_1029\", message: \"'{0}' modifier must precede '{1}' modifier.\" },\n        _0_modifier_already_seen: { code: 1030, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_already_seen_1030\", message: \"'{0}' modifier already seen.\" },\n        _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_class_element_1031\", message: \"'{0}' modifier cannot appear on a class element.\" },\n        super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: ts.DiagnosticCategory.Error, key: \"super_must_be_followed_by_an_argument_list_or_member_access_1034\", message: \"'super' must be followed by an argument list or member access.\" },\n        Only_ambient_modules_can_use_quoted_names: { code: 1035, category: ts.DiagnosticCategory.Error, key: \"Only_ambient_modules_can_use_quoted_names_1035\", message: \"Only ambient modules can use quoted names.\" },\n        Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: ts.DiagnosticCategory.Error, key: \"Statements_are_not_allowed_in_ambient_contexts_1036\", message: \"Statements are not allowed in ambient contexts.\" },\n        A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: ts.DiagnosticCategory.Error, key: \"A_declare_modifier_cannot_be_used_in_an_already_ambient_context_1038\", message: \"A 'declare' modifier cannot be used in an already ambient context.\" },\n        Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: ts.DiagnosticCategory.Error, key: \"Initializers_are_not_allowed_in_ambient_contexts_1039\", message: \"Initializers are not allowed in ambient contexts.\" },\n        _0_modifier_cannot_be_used_in_an_ambient_context: { code: 1040, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_be_used_in_an_ambient_context_1040\", message: \"'{0}' modifier cannot be used in an ambient context.\" },\n        _0_modifier_cannot_be_used_with_a_class_declaration: { code: 1041, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_be_used_with_a_class_declaration_1041\", message: \"'{0}' modifier cannot be used with a class declaration.\" },\n        _0_modifier_cannot_be_used_here: { code: 1042, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_be_used_here_1042\", message: \"'{0}' modifier cannot be used here.\" },\n        _0_modifier_cannot_appear_on_a_data_property: { code: 1043, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_data_property_1043\", message: \"'{0}' modifier cannot appear on a data property.\" },\n        _0_modifier_cannot_appear_on_a_module_or_namespace_element: { code: 1044, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044\", message: \"'{0}' modifier cannot appear on a module or namespace element.\" },\n        A_0_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: ts.DiagnosticCategory.Error, key: \"A_0_modifier_cannot_be_used_with_an_interface_declaration_1045\", message: \"A '{0}' modifier cannot be used with an interface declaration.\" },\n        A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: ts.DiagnosticCategory.Error, key: \"A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046\", message: \"A 'declare' modifier is required for a top level declaration in a .d.ts file.\" },\n        A_rest_parameter_cannot_be_optional: { code: 1047, category: ts.DiagnosticCategory.Error, key: \"A_rest_parameter_cannot_be_optional_1047\", message: \"A rest parameter cannot be optional.\" },\n        A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: ts.DiagnosticCategory.Error, key: \"A_rest_parameter_cannot_have_an_initializer_1048\", message: \"A rest parameter cannot have an initializer.\" },\n        A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: ts.DiagnosticCategory.Error, key: \"A_set_accessor_must_have_exactly_one_parameter_1049\", message: \"A 'set' accessor must have exactly one parameter.\" },\n        A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: ts.DiagnosticCategory.Error, key: \"A_set_accessor_cannot_have_an_optional_parameter_1051\", message: \"A 'set' accessor cannot have an optional parameter.\" },\n        A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: ts.DiagnosticCategory.Error, key: \"A_set_accessor_parameter_cannot_have_an_initializer_1052\", message: \"A 'set' accessor parameter cannot have an initializer.\" },\n        A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: ts.DiagnosticCategory.Error, key: \"A_set_accessor_cannot_have_rest_parameter_1053\", message: \"A 'set' accessor cannot have rest parameter.\" },\n        A_get_accessor_cannot_have_parameters: { code: 1054, category: ts.DiagnosticCategory.Error, key: \"A_get_accessor_cannot_have_parameters_1054\", message: \"A 'get' accessor cannot have parameters.\" },\n        Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: { code: 1055, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055\", message: \"Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.\" },\n        Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: \"Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056\", message: \"Accessors are only available when targeting ECMAScript 5 and higher.\" },\n        An_async_function_or_method_must_have_a_valid_awaitable_return_type: { code: 1057, category: ts.DiagnosticCategory.Error, key: \"An_async_function_or_method_must_have_a_valid_awaitable_return_type_1057\", message: \"An async function or method must have a valid awaitable return type.\" },\n        Operand_for_await_does_not_have_a_valid_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: \"Operand_for_await_does_not_have_a_valid_callable_then_member_1058\", message: \"Operand for 'await' does not have a valid callable 'then' member.\" },\n        Return_expression_in_async_function_does_not_have_a_valid_callable_then_member: { code: 1059, category: ts.DiagnosticCategory.Error, key: \"Return_expression_in_async_function_does_not_have_a_valid_callable_then_member_1059\", message: \"Return expression in async function does not have a valid callable 'then' member.\" },\n        Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member: { code: 1060, category: ts.DiagnosticCategory.Error, key: \"Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member_1060\", message: \"Expression body for async arrow function does not have a valid callable 'then' member.\" },\n        Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: \"Enum_member_must_have_initializer_1061\", message: \"Enum member must have initializer.\" },\n        _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: \"_0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062\", message: \"{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method.\" },\n        An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: \"An_export_assignment_cannot_be_used_in_a_namespace_1063\", message: \"An export assignment cannot be used in a namespace.\" },\n        The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { code: 1064, category: ts.DiagnosticCategory.Error, key: \"The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064\", message: \"The return type of an async function or method must be the global Promise<T> type.\" },\n        In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: \"In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066\", message: \"In ambient enum declarations member initializer must be constant expression.\" },\n        Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: \"Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068\", message: \"Unexpected token. A constructor, method, accessor, or property was expected.\" },\n        _0_modifier_cannot_appear_on_a_type_member: { code: 1070, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_type_member_1070\", message: \"'{0}' modifier cannot appear on a type member.\" },\n        _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_an_index_signature_1071\", message: \"'{0}' modifier cannot appear on an index signature.\" },\n        A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: \"A_0_modifier_cannot_be_used_with_an_import_declaration_1079\", message: \"A '{0}' modifier cannot be used with an import declaration.\" },\n        Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: \"Invalid_reference_directive_syntax_1084\", message: \"Invalid 'reference' directive syntax.\" },\n        Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: \"Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085\", message: \"Octal literals are not available when targeting ECMAScript 5 and higher.\" },\n        An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: \"An_accessor_cannot_be_declared_in_an_ambient_context_1086\", message: \"An accessor cannot be declared in an ambient context.\" },\n        _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_constructor_declaration_1089\", message: \"'{0}' modifier cannot appear on a constructor declaration.\" },\n        _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_parameter_1090\", message: \"'{0}' modifier cannot appear on a parameter.\" },\n        Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: ts.DiagnosticCategory.Error, key: \"Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091\", message: \"Only a single variable declaration is allowed in a 'for...in' statement.\" },\n        Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: ts.DiagnosticCategory.Error, key: \"Type_parameters_cannot_appear_on_a_constructor_declaration_1092\", message: \"Type parameters cannot appear on a constructor declaration.\" },\n        Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: ts.DiagnosticCategory.Error, key: \"Type_annotation_cannot_appear_on_a_constructor_declaration_1093\", message: \"Type annotation cannot appear on a constructor declaration.\" },\n        An_accessor_cannot_have_type_parameters: { code: 1094, category: ts.DiagnosticCategory.Error, key: \"An_accessor_cannot_have_type_parameters_1094\", message: \"An accessor cannot have type parameters.\" },\n        A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: ts.DiagnosticCategory.Error, key: \"A_set_accessor_cannot_have_a_return_type_annotation_1095\", message: \"A 'set' accessor cannot have a return type annotation.\" },\n        An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_must_have_exactly_one_parameter_1096\", message: \"An index signature must have exactly one parameter.\" },\n        _0_list_cannot_be_empty: { code: 1097, category: ts.DiagnosticCategory.Error, key: \"_0_list_cannot_be_empty_1097\", message: \"'{0}' list cannot be empty.\" },\n        Type_parameter_list_cannot_be_empty: { code: 1098, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_list_cannot_be_empty_1098\", message: \"Type parameter list cannot be empty.\" },\n        Type_argument_list_cannot_be_empty: { code: 1099, category: ts.DiagnosticCategory.Error, key: \"Type_argument_list_cannot_be_empty_1099\", message: \"Type argument list cannot be empty.\" },\n        Invalid_use_of_0_in_strict_mode: { code: 1100, category: ts.DiagnosticCategory.Error, key: \"Invalid_use_of_0_in_strict_mode_1100\", message: \"Invalid use of '{0}' in strict mode.\" },\n        with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: ts.DiagnosticCategory.Error, key: \"with_statements_are_not_allowed_in_strict_mode_1101\", message: \"'with' statements are not allowed in strict mode.\" },\n        delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: ts.DiagnosticCategory.Error, key: \"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102\", message: \"'delete' cannot be called on an identifier in strict mode.\" },\n        A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: ts.DiagnosticCategory.Error, key: \"A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104\", message: \"A 'continue' statement can only be used within an enclosing iteration statement.\" },\n        A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: ts.DiagnosticCategory.Error, key: \"A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105\", message: \"A 'break' statement can only be used within an enclosing iteration or switch statement.\" },\n        Jump_target_cannot_cross_function_boundary: { code: 1107, category: ts.DiagnosticCategory.Error, key: \"Jump_target_cannot_cross_function_boundary_1107\", message: \"Jump target cannot cross function boundary.\" },\n        A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: ts.DiagnosticCategory.Error, key: \"A_return_statement_can_only_be_used_within_a_function_body_1108\", message: \"A 'return' statement can only be used within a function body.\" },\n        Expression_expected: { code: 1109, category: ts.DiagnosticCategory.Error, key: \"Expression_expected_1109\", message: \"Expression expected.\" },\n        Type_expected: { code: 1110, category: ts.DiagnosticCategory.Error, key: \"Type_expected_1110\", message: \"Type expected.\" },\n        A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: ts.DiagnosticCategory.Error, key: \"A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113\", message: \"A 'default' clause cannot appear more than once in a 'switch' statement.\" },\n        Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: \"Duplicate_label_0_1114\", message: \"Duplicate label '{0}'\" },\n        A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: ts.DiagnosticCategory.Error, key: \"A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115\", message: \"A 'continue' statement can only jump to a label of an enclosing iteration statement.\" },\n        A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: ts.DiagnosticCategory.Error, key: \"A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116\", message: \"A 'break' statement can only jump to a label of an enclosing statement.\" },\n        An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: ts.DiagnosticCategory.Error, key: \"An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode_1117\", message: \"An object literal cannot have multiple properties with the same name in strict mode.\" },\n        An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: ts.DiagnosticCategory.Error, key: \"An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118\", message: \"An object literal cannot have multiple get/set accessors with the same name.\" },\n        An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: ts.DiagnosticCategory.Error, key: \"An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119\", message: \"An object literal cannot have property and accessor with the same name.\" },\n        An_export_assignment_cannot_have_modifiers: { code: 1120, category: ts.DiagnosticCategory.Error, key: \"An_export_assignment_cannot_have_modifiers_1120\", message: \"An export assignment cannot have modifiers.\" },\n        Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: ts.DiagnosticCategory.Error, key: \"Octal_literals_are_not_allowed_in_strict_mode_1121\", message: \"Octal literals are not allowed in strict mode.\" },\n        A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: ts.DiagnosticCategory.Error, key: \"A_tuple_type_element_list_cannot_be_empty_1122\", message: \"A tuple type element list cannot be empty.\" },\n        Variable_declaration_list_cannot_be_empty: { code: 1123, category: ts.DiagnosticCategory.Error, key: \"Variable_declaration_list_cannot_be_empty_1123\", message: \"Variable declaration list cannot be empty.\" },\n        Digit_expected: { code: 1124, category: ts.DiagnosticCategory.Error, key: \"Digit_expected_1124\", message: \"Digit expected.\" },\n        Hexadecimal_digit_expected: { code: 1125, category: ts.DiagnosticCategory.Error, key: \"Hexadecimal_digit_expected_1125\", message: \"Hexadecimal digit expected.\" },\n        Unexpected_end_of_text: { code: 1126, category: ts.DiagnosticCategory.Error, key: \"Unexpected_end_of_text_1126\", message: \"Unexpected end of text.\" },\n        Invalid_character: { code: 1127, category: ts.DiagnosticCategory.Error, key: \"Invalid_character_1127\", message: \"Invalid character.\" },\n        Declaration_or_statement_expected: { code: 1128, category: ts.DiagnosticCategory.Error, key: \"Declaration_or_statement_expected_1128\", message: \"Declaration or statement expected.\" },\n        Statement_expected: { code: 1129, category: ts.DiagnosticCategory.Error, key: \"Statement_expected_1129\", message: \"Statement expected.\" },\n        case_or_default_expected: { code: 1130, category: ts.DiagnosticCategory.Error, key: \"case_or_default_expected_1130\", message: \"'case' or 'default' expected.\" },\n        Property_or_signature_expected: { code: 1131, category: ts.DiagnosticCategory.Error, key: \"Property_or_signature_expected_1131\", message: \"Property or signature expected.\" },\n        Enum_member_expected: { code: 1132, category: ts.DiagnosticCategory.Error, key: \"Enum_member_expected_1132\", message: \"Enum member expected.\" },\n        Variable_declaration_expected: { code: 1134, category: ts.DiagnosticCategory.Error, key: \"Variable_declaration_expected_1134\", message: \"Variable declaration expected.\" },\n        Argument_expression_expected: { code: 1135, category: ts.DiagnosticCategory.Error, key: \"Argument_expression_expected_1135\", message: \"Argument expression expected.\" },\n        Property_assignment_expected: { code: 1136, category: ts.DiagnosticCategory.Error, key: \"Property_assignment_expected_1136\", message: \"Property assignment expected.\" },\n        Expression_or_comma_expected: { code: 1137, category: ts.DiagnosticCategory.Error, key: \"Expression_or_comma_expected_1137\", message: \"Expression or comma expected.\" },\n        Parameter_declaration_expected: { code: 1138, category: ts.DiagnosticCategory.Error, key: \"Parameter_declaration_expected_1138\", message: \"Parameter declaration expected.\" },\n        Type_parameter_declaration_expected: { code: 1139, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_declaration_expected_1139\", message: \"Type parameter declaration expected.\" },\n        Type_argument_expected: { code: 1140, category: ts.DiagnosticCategory.Error, key: \"Type_argument_expected_1140\", message: \"Type argument expected.\" },\n        String_literal_expected: { code: 1141, category: ts.DiagnosticCategory.Error, key: \"String_literal_expected_1141\", message: \"String literal expected.\" },\n        Line_break_not_permitted_here: { code: 1142, category: ts.DiagnosticCategory.Error, key: \"Line_break_not_permitted_here_1142\", message: \"Line break not permitted here.\" },\n        or_expected: { code: 1144, category: ts.DiagnosticCategory.Error, key: \"or_expected_1144\", message: \"'{' or ';' expected.\" },\n        Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: \"Declaration_expected_1146\", message: \"Declaration expected.\" },\n        Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: \"Import_declarations_in_a_namespace_cannot_reference_a_module_1147\", message: \"Import declarations in a namespace cannot reference a module.\" },\n        Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: { code: 1148, category: ts.DiagnosticCategory.Error, key: \"Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148\", message: \"Cannot use imports, exports, or module augmentations when '--module' is 'none'.\" },\n        File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: \"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149\", message: \"File name '{0}' differs from already included file name '{1}' only in casing\" },\n        new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: ts.DiagnosticCategory.Error, key: \"new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150\", message: \"'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead.\" },\n        const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: \"const_declarations_must_be_initialized_1155\", message: \"'const' declarations must be initialized\" },\n        const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: ts.DiagnosticCategory.Error, key: \"const_declarations_can_only_be_declared_inside_a_block_1156\", message: \"'const' declarations can only be declared inside a block.\" },\n        let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: ts.DiagnosticCategory.Error, key: \"let_declarations_can_only_be_declared_inside_a_block_1157\", message: \"'let' declarations can only be declared inside a block.\" },\n        Unterminated_template_literal: { code: 1160, category: ts.DiagnosticCategory.Error, key: \"Unterminated_template_literal_1160\", message: \"Unterminated template literal.\" },\n        Unterminated_regular_expression_literal: { code: 1161, category: ts.DiagnosticCategory.Error, key: \"Unterminated_regular_expression_literal_1161\", message: \"Unterminated regular expression literal.\" },\n        An_object_member_cannot_be_declared_optional: { code: 1162, category: ts.DiagnosticCategory.Error, key: \"An_object_member_cannot_be_declared_optional_1162\", message: \"An object member cannot be declared optional.\" },\n        A_yield_expression_is_only_allowed_in_a_generator_body: { code: 1163, category: ts.DiagnosticCategory.Error, key: \"A_yield_expression_is_only_allowed_in_a_generator_body_1163\", message: \"A 'yield' expression is only allowed in a generator body.\" },\n        Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: ts.DiagnosticCategory.Error, key: \"Computed_property_names_are_not_allowed_in_enums_1164\", message: \"Computed property names are not allowed in enums.\" },\n        A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol_1165\", message: \"A computed property name in an ambient context must directly refer to a built-in symbol.\" },\n        A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol_1166\", message: \"A computed property name in a class property declaration must directly refer to a built-in symbol.\" },\n        A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol_1168\", message: \"A computed property name in a method overload must directly refer to a built-in symbol.\" },\n        A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol_1169\", message: \"A computed property name in an interface must directly refer to a built-in symbol.\" },\n        A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol_1170\", message: \"A computed property name in a type literal must directly refer to a built-in symbol.\" },\n        A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: ts.DiagnosticCategory.Error, key: \"A_comma_expression_is_not_allowed_in_a_computed_property_name_1171\", message: \"A comma expression is not allowed in a computed property name.\" },\n        extends_clause_already_seen: { code: 1172, category: ts.DiagnosticCategory.Error, key: \"extends_clause_already_seen_1172\", message: \"'extends' clause already seen.\" },\n        extends_clause_must_precede_implements_clause: { code: 1173, category: ts.DiagnosticCategory.Error, key: \"extends_clause_must_precede_implements_clause_1173\", message: \"'extends' clause must precede 'implements' clause.\" },\n        Classes_can_only_extend_a_single_class: { code: 1174, category: ts.DiagnosticCategory.Error, key: \"Classes_can_only_extend_a_single_class_1174\", message: \"Classes can only extend a single class.\" },\n        implements_clause_already_seen: { code: 1175, category: ts.DiagnosticCategory.Error, key: \"implements_clause_already_seen_1175\", message: \"'implements' clause already seen.\" },\n        Interface_declaration_cannot_have_implements_clause: { code: 1176, category: ts.DiagnosticCategory.Error, key: \"Interface_declaration_cannot_have_implements_clause_1176\", message: \"Interface declaration cannot have 'implements' clause.\" },\n        Binary_digit_expected: { code: 1177, category: ts.DiagnosticCategory.Error, key: \"Binary_digit_expected_1177\", message: \"Binary digit expected.\" },\n        Octal_digit_expected: { code: 1178, category: ts.DiagnosticCategory.Error, key: \"Octal_digit_expected_1178\", message: \"Octal digit expected.\" },\n        Unexpected_token_expected: { code: 1179, category: ts.DiagnosticCategory.Error, key: \"Unexpected_token_expected_1179\", message: \"Unexpected token. '{' expected.\" },\n        Property_destructuring_pattern_expected: { code: 1180, category: ts.DiagnosticCategory.Error, key: \"Property_destructuring_pattern_expected_1180\", message: \"Property destructuring pattern expected.\" },\n        Array_element_destructuring_pattern_expected: { code: 1181, category: ts.DiagnosticCategory.Error, key: \"Array_element_destructuring_pattern_expected_1181\", message: \"Array element destructuring pattern expected.\" },\n        A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: ts.DiagnosticCategory.Error, key: \"A_destructuring_declaration_must_have_an_initializer_1182\", message: \"A destructuring declaration must have an initializer.\" },\n        An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1183, category: ts.DiagnosticCategory.Error, key: \"An_implementation_cannot_be_declared_in_ambient_contexts_1183\", message: \"An implementation cannot be declared in ambient contexts.\" },\n        Modifiers_cannot_appear_here: { code: 1184, category: ts.DiagnosticCategory.Error, key: \"Modifiers_cannot_appear_here_1184\", message: \"Modifiers cannot appear here.\" },\n        Merge_conflict_marker_encountered: { code: 1185, category: ts.DiagnosticCategory.Error, key: \"Merge_conflict_marker_encountered_1185\", message: \"Merge conflict marker encountered.\" },\n        A_rest_element_cannot_have_an_initializer: { code: 1186, category: ts.DiagnosticCategory.Error, key: \"A_rest_element_cannot_have_an_initializer_1186\", message: \"A rest element cannot have an initializer.\" },\n        A_parameter_property_may_not_be_declared_using_a_binding_pattern: { code: 1187, category: ts.DiagnosticCategory.Error, key: \"A_parameter_property_may_not_be_declared_using_a_binding_pattern_1187\", message: \"A parameter property may not be declared using a binding pattern.\" },\n        Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: ts.DiagnosticCategory.Error, key: \"Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement_1188\", message: \"Only a single variable declaration is allowed in a 'for...of' statement.\" },\n        The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: ts.DiagnosticCategory.Error, key: \"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189\", message: \"The variable declaration of a 'for...in' statement cannot have an initializer.\" },\n        The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: ts.DiagnosticCategory.Error, key: \"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190\", message: \"The variable declaration of a 'for...of' statement cannot have an initializer.\" },\n        An_import_declaration_cannot_have_modifiers: { code: 1191, category: ts.DiagnosticCategory.Error, key: \"An_import_declaration_cannot_have_modifiers_1191\", message: \"An import declaration cannot have modifiers.\" },\n        Module_0_has_no_default_export: { code: 1192, category: ts.DiagnosticCategory.Error, key: \"Module_0_has_no_default_export_1192\", message: \"Module '{0}' has no default export.\" },\n        An_export_declaration_cannot_have_modifiers: { code: 1193, category: ts.DiagnosticCategory.Error, key: \"An_export_declaration_cannot_have_modifiers_1193\", message: \"An export declaration cannot have modifiers.\" },\n        Export_declarations_are_not_permitted_in_a_namespace: { code: 1194, category: ts.DiagnosticCategory.Error, key: \"Export_declarations_are_not_permitted_in_a_namespace_1194\", message: \"Export declarations are not permitted in a namespace.\" },\n        Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: ts.DiagnosticCategory.Error, key: \"Catch_clause_variable_cannot_have_a_type_annotation_1196\", message: \"Catch clause variable cannot have a type annotation.\" },\n        Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: ts.DiagnosticCategory.Error, key: \"Catch_clause_variable_cannot_have_an_initializer_1197\", message: \"Catch clause variable cannot have an initializer.\" },\n        An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: ts.DiagnosticCategory.Error, key: \"An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198\", message: \"An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive.\" },\n        Unterminated_Unicode_escape_sequence: { code: 1199, category: ts.DiagnosticCategory.Error, key: \"Unterminated_Unicode_escape_sequence_1199\", message: \"Unterminated Unicode escape sequence.\" },\n        Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: \"Line_terminator_not_permitted_before_arrow_1200\", message: \"Line terminator not permitted before arrow.\" },\n        Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: \"Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asteri_1202\", message: \"Import assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'import * as ns from \\\"mod\\\"', 'import {a} from \\\"mod\\\"', 'import d from \\\"mod\\\"', or another module format instead.\" },\n        Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_default_or_another_module_format_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: \"Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_defaul_1203\", message: \"Export assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'export default' or another module format instead.\" },\n        Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: \"Decorators_are_not_valid_here_1206\", message: \"Decorators are not valid here.\" },\n        Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: \"Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207\", message: \"Decorators cannot be applied to multiple get/set accessors of the same name.\" },\n        Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: \"Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208\", message: \"Cannot compile namespaces when the '--isolatedModules' flag is provided.\" },\n        Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: \"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209\", message: \"Ambient const enums are not allowed when the '--isolatedModules' flag is provided.\" },\n        Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: ts.DiagnosticCategory.Error, key: \"Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210\", message: \"Invalid use of '{0}'. Class definitions are automatically in strict mode.\" },\n        A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: \"A_class_declaration_without_the_default_modifier_must_have_a_name_1211\", message: \"A class declaration without the 'default' modifier must have a name\" },\n        Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: \"Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212\", message: \"Identifier expected. '{0}' is a reserved word in strict mode\" },\n        Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: ts.DiagnosticCategory.Error, key: \"Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213\", message: \"Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode.\" },\n        Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: \"Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214\", message: \"Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode.\" },\n        Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: \"Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215\", message: \"Invalid use of '{0}'. Modules are automatically in strict mode.\" },\n        Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: \"Export_assignment_is_not_supported_when_module_flag_is_system_1218\", message: \"Export assignment is not supported when '--module' flag is 'system'.\" },\n        Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: \"Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219\", message: \"Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.\" },\n        Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: { code: 1220, category: ts.DiagnosticCategory.Error, key: \"Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220\", message: \"Generators are only available when targeting ECMAScript 2015 or higher.\" },\n        Generators_are_not_allowed_in_an_ambient_context: { code: 1221, category: ts.DiagnosticCategory.Error, key: \"Generators_are_not_allowed_in_an_ambient_context_1221\", message: \"Generators are not allowed in an ambient context.\" },\n        An_overload_signature_cannot_be_declared_as_a_generator: { code: 1222, category: ts.DiagnosticCategory.Error, key: \"An_overload_signature_cannot_be_declared_as_a_generator_1222\", message: \"An overload signature cannot be declared as a generator.\" },\n        _0_tag_already_specified: { code: 1223, category: ts.DiagnosticCategory.Error, key: \"_0_tag_already_specified_1223\", message: \"'{0}' tag already specified.\" },\n        Signature_0_must_have_a_type_predicate: { code: 1224, category: ts.DiagnosticCategory.Error, key: \"Signature_0_must_have_a_type_predicate_1224\", message: \"Signature '{0}' must have a type predicate.\" },\n        Cannot_find_parameter_0: { code: 1225, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_parameter_0_1225\", message: \"Cannot find parameter '{0}'.\" },\n        Type_predicate_0_is_not_assignable_to_1: { code: 1226, category: ts.DiagnosticCategory.Error, key: \"Type_predicate_0_is_not_assignable_to_1_1226\", message: \"Type predicate '{0}' is not assignable to '{1}'.\" },\n        Parameter_0_is_not_in_the_same_position_as_parameter_1: { code: 1227, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_is_not_in_the_same_position_as_parameter_1_1227\", message: \"Parameter '{0}' is not in the same position as parameter '{1}'.\" },\n        A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods: { code: 1228, category: ts.DiagnosticCategory.Error, key: \"A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods_1228\", message: \"A type predicate is only allowed in return type position for functions and methods.\" },\n        A_type_predicate_cannot_reference_a_rest_parameter: { code: 1229, category: ts.DiagnosticCategory.Error, key: \"A_type_predicate_cannot_reference_a_rest_parameter_1229\", message: \"A type predicate cannot reference a rest parameter.\" },\n        A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: { code: 1230, category: ts.DiagnosticCategory.Error, key: \"A_type_predicate_cannot_reference_element_0_in_a_binding_pattern_1230\", message: \"A type predicate cannot reference element '{0}' in a binding pattern.\" },\n        An_export_assignment_can_only_be_used_in_a_module: { code: 1231, category: ts.DiagnosticCategory.Error, key: \"An_export_assignment_can_only_be_used_in_a_module_1231\", message: \"An export assignment can only be used in a module.\" },\n        An_import_declaration_can_only_be_used_in_a_namespace_or_module: { code: 1232, category: ts.DiagnosticCategory.Error, key: \"An_import_declaration_can_only_be_used_in_a_namespace_or_module_1232\", message: \"An import declaration can only be used in a namespace or module.\" },\n        An_export_declaration_can_only_be_used_in_a_module: { code: 1233, category: ts.DiagnosticCategory.Error, key: \"An_export_declaration_can_only_be_used_in_a_module_1233\", message: \"An export declaration can only be used in a module.\" },\n        An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { code: 1234, category: ts.DiagnosticCategory.Error, key: \"An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234\", message: \"An ambient module declaration is only allowed at the top level in a file.\" },\n        A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { code: 1235, category: ts.DiagnosticCategory.Error, key: \"A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235\", message: \"A namespace declaration is only allowed in a namespace or module.\" },\n        The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { code: 1236, category: ts.DiagnosticCategory.Error, key: \"The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236\", message: \"The return type of a property decorator function must be either 'void' or 'any'.\" },\n        The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { code: 1237, category: ts.DiagnosticCategory.Error, key: \"The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any_1237\", message: \"The return type of a parameter decorator function must be either 'void' or 'any'.\" },\n        Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { code: 1238, category: ts.DiagnosticCategory.Error, key: \"Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression_1238\", message: \"Unable to resolve signature of class decorator when called as an expression.\" },\n        Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: { code: 1239, category: ts.DiagnosticCategory.Error, key: \"Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression_1239\", message: \"Unable to resolve signature of parameter decorator when called as an expression.\" },\n        Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: { code: 1240, category: ts.DiagnosticCategory.Error, key: \"Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression_1240\", message: \"Unable to resolve signature of property decorator when called as an expression.\" },\n        Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: { code: 1241, category: ts.DiagnosticCategory.Error, key: \"Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression_1241\", message: \"Unable to resolve signature of method decorator when called as an expression.\" },\n        abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration: { code: 1242, category: ts.DiagnosticCategory.Error, key: \"abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242\", message: \"'abstract' modifier can only appear on a class, method, or property declaration.\" },\n        _0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_be_used_with_1_modifier_1243\", message: \"'{0}' modifier cannot be used with '{1}' modifier.\" },\n        Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: \"Abstract_methods_can_only_appear_within_an_abstract_class_1244\", message: \"Abstract methods can only appear within an abstract class.\" },\n        Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: \"Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245\", message: \"Method '{0}' cannot have an implementation because it is marked abstract.\" },\n        An_interface_property_cannot_have_an_initializer: { code: 1246, category: ts.DiagnosticCategory.Error, key: \"An_interface_property_cannot_have_an_initializer_1246\", message: \"An interface property cannot have an initializer.\" },\n        A_type_literal_property_cannot_have_an_initializer: { code: 1247, category: ts.DiagnosticCategory.Error, key: \"A_type_literal_property_cannot_have_an_initializer_1247\", message: \"A type literal property cannot have an initializer.\" },\n        A_class_member_cannot_have_the_0_keyword: { code: 1248, category: ts.DiagnosticCategory.Error, key: \"A_class_member_cannot_have_the_0_keyword_1248\", message: \"A class member cannot have the '{0}' keyword.\" },\n        A_decorator_can_only_decorate_a_method_implementation_not_an_overload: { code: 1249, category: ts.DiagnosticCategory.Error, key: \"A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249\", message: \"A decorator can only decorate a method implementation, not an overload.\" },\n        Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: { code: 1250, category: ts.DiagnosticCategory.Error, key: \"Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250\", message: \"Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.\" },\n        Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: { code: 1251, category: ts.DiagnosticCategory.Error, key: \"Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251\", message: \"Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode.\" },\n        Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: { code: 1252, category: ts.DiagnosticCategory.Error, key: \"Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252\", message: \"Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode.\" },\n        _0_tag_cannot_be_used_independently_as_a_top_level_JSDoc_tag: { code: 1253, category: ts.DiagnosticCategory.Error, key: \"_0_tag_cannot_be_used_independently_as_a_top_level_JSDoc_tag_1253\", message: \"'{0}' tag cannot be used independently as a top level JSDoc tag.\" },\n        A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal: { code: 1254, category: ts.DiagnosticCategory.Error, key: \"A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_1254\", message: \"A 'const' initializer in an ambient context must be a string or numeric literal.\" },\n        with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: \"with_statements_are_not_allowed_in_an_async_function_block_1300\", message: \"'with' statements are not allowed in an async function block.\" },\n        await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: \"await_expression_is_only_allowed_within_an_async_function_1308\", message: \"'await' expression is only allowed within an async function.\" },\n        can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: \"can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312\", message: \"'=' can only be used in an object literal property inside a destructuring assignment.\" },\n        The_body_of_an_if_statement_cannot_be_the_empty_statement: { code: 1313, category: ts.DiagnosticCategory.Error, key: \"The_body_of_an_if_statement_cannot_be_the_empty_statement_1313\", message: \"The body of an 'if' statement cannot be the empty statement.\" },\n        Global_module_exports_may_only_appear_in_module_files: { code: 1314, category: ts.DiagnosticCategory.Error, key: \"Global_module_exports_may_only_appear_in_module_files_1314\", message: \"Global module exports may only appear in module files.\" },\n        Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: \"Global_module_exports_may_only_appear_in_declaration_files_1315\", message: \"Global module exports may only appear in declaration files.\" },\n        Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: \"Global_module_exports_may_only_appear_at_top_level_1316\", message: \"Global module exports may only appear at top level.\" },\n        A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: \"A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317\", message: \"A parameter property cannot be declared using a rest parameter.\" },\n        An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: \"An_abstract_accessor_cannot_have_an_implementation_1318\", message: \"An abstract accessor cannot have an implementation.\" },\n        Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_0_2300\", message: \"Duplicate identifier '{0}'.\" },\n        Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: \"Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301\", message: \"Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor.\" },\n        Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: \"Static_members_cannot_reference_class_type_parameters_2302\", message: \"Static members cannot reference class type parameters.\" },\n        Circular_definition_of_import_alias_0: { code: 2303, category: ts.DiagnosticCategory.Error, key: \"Circular_definition_of_import_alias_0_2303\", message: \"Circular definition of import alias '{0}'.\" },\n        Cannot_find_name_0: { code: 2304, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_name_0_2304\", message: \"Cannot find name '{0}'.\" },\n        Module_0_has_no_exported_member_1: { code: 2305, category: ts.DiagnosticCategory.Error, key: \"Module_0_has_no_exported_member_1_2305\", message: \"Module '{0}' has no exported member '{1}'.\" },\n        File_0_is_not_a_module: { code: 2306, category: ts.DiagnosticCategory.Error, key: \"File_0_is_not_a_module_2306\", message: \"File '{0}' is not a module.\" },\n        Cannot_find_module_0: { code: 2307, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_module_0_2307\", message: \"Cannot find module '{0}'.\" },\n        Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: { code: 2308, category: ts.DiagnosticCategory.Error, key: \"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308\", message: \"Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity.\" },\n        An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: ts.DiagnosticCategory.Error, key: \"An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309\", message: \"An export assignment cannot be used in a module with other exported elements.\" },\n        Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: ts.DiagnosticCategory.Error, key: \"Type_0_recursively_references_itself_as_a_base_type_2310\", message: \"Type '{0}' recursively references itself as a base type.\" },\n        A_class_may_only_extend_another_class: { code: 2311, category: ts.DiagnosticCategory.Error, key: \"A_class_may_only_extend_another_class_2311\", message: \"A class may only extend another class.\" },\n        An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: ts.DiagnosticCategory.Error, key: \"An_interface_may_only_extend_a_class_or_another_interface_2312\", message: \"An interface may only extend a class or another interface.\" },\n        Type_parameter_0_has_a_circular_constraint: { code: 2313, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_has_a_circular_constraint_2313\", message: \"Type parameter '{0}' has a circular constraint.\" },\n        Generic_type_0_requires_1_type_argument_s: { code: 2314, category: ts.DiagnosticCategory.Error, key: \"Generic_type_0_requires_1_type_argument_s_2314\", message: \"Generic type '{0}' requires {1} type argument(s).\" },\n        Type_0_is_not_generic: { code: 2315, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_generic_2315\", message: \"Type '{0}' is not generic.\" },\n        Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: ts.DiagnosticCategory.Error, key: \"Global_type_0_must_be_a_class_or_interface_type_2316\", message: \"Global type '{0}' must be a class or interface type.\" },\n        Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: ts.DiagnosticCategory.Error, key: \"Global_type_0_must_have_1_type_parameter_s_2317\", message: \"Global type '{0}' must have {1} type parameter(s).\" },\n        Cannot_find_global_type_0: { code: 2318, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_global_type_0_2318\", message: \"Cannot find global type '{0}'.\" },\n        Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: ts.DiagnosticCategory.Error, key: \"Named_property_0_of_types_1_and_2_are_not_identical_2319\", message: \"Named property '{0}' of types '{1}' and '{2}' are not identical.\" },\n        Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: ts.DiagnosticCategory.Error, key: \"Interface_0_cannot_simultaneously_extend_types_1_and_2_2320\", message: \"Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'.\" },\n        Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: ts.DiagnosticCategory.Error, key: \"Excessive_stack_depth_comparing_types_0_and_1_2321\", message: \"Excessive stack depth comparing types '{0}' and '{1}'.\" },\n        Type_0_is_not_assignable_to_type_1: { code: 2322, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_assignable_to_type_1_2322\", message: \"Type '{0}' is not assignable to type '{1}'.\" },\n        Cannot_redeclare_exported_variable_0: { code: 2323, category: ts.DiagnosticCategory.Error, key: \"Cannot_redeclare_exported_variable_0_2323\", message: \"Cannot redeclare exported variable '{0}'.\" },\n        Property_0_is_missing_in_type_1: { code: 2324, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_missing_in_type_1_2324\", message: \"Property '{0}' is missing in type '{1}'.\" },\n        Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_private_in_type_1_but_not_in_type_2_2325\", message: \"Property '{0}' is private in type '{1}' but not in type '{2}'.\" },\n        Types_of_property_0_are_incompatible: { code: 2326, category: ts.DiagnosticCategory.Error, key: \"Types_of_property_0_are_incompatible_2326\", message: \"Types of property '{0}' are incompatible.\" },\n        Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_optional_in_type_1_but_required_in_type_2_2327\", message: \"Property '{0}' is optional in type '{1}' but required in type '{2}'.\" },\n        Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: ts.DiagnosticCategory.Error, key: \"Types_of_parameters_0_and_1_are_incompatible_2328\", message: \"Types of parameters '{0}' and '{1}' are incompatible.\" },\n        Index_signature_is_missing_in_type_0: { code: 2329, category: ts.DiagnosticCategory.Error, key: \"Index_signature_is_missing_in_type_0_2329\", message: \"Index signature is missing in type '{0}'.\" },\n        Index_signatures_are_incompatible: { code: 2330, category: ts.DiagnosticCategory.Error, key: \"Index_signatures_are_incompatible_2330\", message: \"Index signatures are incompatible.\" },\n        this_cannot_be_referenced_in_a_module_or_namespace_body: { code: 2331, category: ts.DiagnosticCategory.Error, key: \"this_cannot_be_referenced_in_a_module_or_namespace_body_2331\", message: \"'this' cannot be referenced in a module or namespace body.\" },\n        this_cannot_be_referenced_in_current_location: { code: 2332, category: ts.DiagnosticCategory.Error, key: \"this_cannot_be_referenced_in_current_location_2332\", message: \"'this' cannot be referenced in current location.\" },\n        this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: ts.DiagnosticCategory.Error, key: \"this_cannot_be_referenced_in_constructor_arguments_2333\", message: \"'this' cannot be referenced in constructor arguments.\" },\n        this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: ts.DiagnosticCategory.Error, key: \"this_cannot_be_referenced_in_a_static_property_initializer_2334\", message: \"'this' cannot be referenced in a static property initializer.\" },\n        super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: ts.DiagnosticCategory.Error, key: \"super_can_only_be_referenced_in_a_derived_class_2335\", message: \"'super' can only be referenced in a derived class.\" },\n        super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: ts.DiagnosticCategory.Error, key: \"super_cannot_be_referenced_in_constructor_arguments_2336\", message: \"'super' cannot be referenced in constructor arguments.\" },\n        Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: ts.DiagnosticCategory.Error, key: \"Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors_2337\", message: \"Super calls are not permitted outside constructors or in nested functions inside constructors.\" },\n        super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: ts.DiagnosticCategory.Error, key: \"super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_der_2338\", message: \"'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.\" },\n        Property_0_does_not_exist_on_type_1: { code: 2339, category: ts.DiagnosticCategory.Error, key: \"Property_0_does_not_exist_on_type_1_2339\", message: \"Property '{0}' does not exist on type '{1}'.\" },\n        Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: \"Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340\", message: \"Only public and protected methods of the base class are accessible via the 'super' keyword.\" },\n        Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_private_and_only_accessible_within_class_1_2341\", message: \"Property '{0}' is private and only accessible within class '{1}'.\" },\n        An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: \"An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342\", message: \"An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.\" },\n        This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: \"This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343\", message: \"This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'.\" },\n        Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: \"Type_0_does_not_satisfy_the_constraint_1_2344\", message: \"Type '{0}' does not satisfy the constraint '{1}'.\" },\n        Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: \"Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345\", message: \"Argument of type '{0}' is not assignable to parameter of type '{1}'.\" },\n        Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: \"Supplied_parameters_do_not_match_any_signature_of_call_target_2346\", message: \"Supplied parameters do not match any signature of call target.\" },\n        Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: ts.DiagnosticCategory.Error, key: \"Untyped_function_calls_may_not_accept_type_arguments_2347\", message: \"Untyped function calls may not accept type arguments.\" },\n        Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: ts.DiagnosticCategory.Error, key: \"Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348\", message: \"Value of type '{0}' is not callable. Did you mean to include 'new'?\" },\n        Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures: { code: 2349, category: ts.DiagnosticCategory.Error, key: \"Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatur_2349\", message: \"Cannot invoke an expression whose type lacks a call signature. Type '{0}' has no compatible call signatures.\" },\n        Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: ts.DiagnosticCategory.Error, key: \"Only_a_void_function_can_be_called_with_the_new_keyword_2350\", message: \"Only a void function can be called with the 'new' keyword.\" },\n        Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: \"Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351\", message: \"Cannot use 'new' with an expression whose type lacks a call or construct signature.\" },\n        Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: \"Type_0_cannot_be_converted_to_type_1_2352\", message: \"Type '{0}' cannot be converted to type '{1}'.\" },\n        Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: \"Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353\", message: \"Object literal may only specify known properties, and '{0}' does not exist in type '{1}'.\" },\n        This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: \"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354\", message: \"This syntax requires an imported helper but module '{0}' cannot be found.\" },\n        A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: \"A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355\", message: \"A function whose declared type is neither 'void' nor 'any' must return a value.\" },\n        An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: \"An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356\", message: \"An arithmetic operand must be of type 'any', 'number' or an enum type.\" },\n        The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: \"The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357\", message: \"The operand of an increment or decrement operator must be a variable or a property access.\" },\n        The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358\", message: \"The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.\" },\n        The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: ts.DiagnosticCategory.Error, key: \"The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359\", message: \"The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.\" },\n        The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol_2360\", message: \"The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.\" },\n        The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: \"The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361\", message: \"The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter\" },\n        The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2362\", message: \"The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.\" },\n        The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: \"The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363\", message: \"The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.\" },\n        The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: { code: 2364, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364\", message: \"The left-hand side of an assignment expression must be a variable or a property access.\" },\n        Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: \"Operator_0_cannot_be_applied_to_types_1_and_2_2365\", message: \"Operator '{0}' cannot be applied to types '{1}' and '{2}'.\" },\n        Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: \"Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366\", message: \"Function lacks ending return statement and return type does not include 'undefined'.\" },\n        Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_name_cannot_be_0_2368\", message: \"Type parameter name cannot be '{0}'\" },\n        A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: \"A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369\", message: \"A parameter property is only allowed in a constructor implementation.\" },\n        A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: \"A_rest_parameter_must_be_of_an_array_type_2370\", message: \"A rest parameter must be of an array type.\" },\n        A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: ts.DiagnosticCategory.Error, key: \"A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371\", message: \"A parameter initializer is only allowed in a function or constructor implementation.\" },\n        Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_cannot_be_referenced_in_its_initializer_2372\", message: \"Parameter '{0}' cannot be referenced in its initializer.\" },\n        Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: ts.DiagnosticCategory.Error, key: \"Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373\", message: \"Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.\" },\n        Duplicate_string_index_signature: { code: 2374, category: ts.DiagnosticCategory.Error, key: \"Duplicate_string_index_signature_2374\", message: \"Duplicate string index signature.\" },\n        Duplicate_number_index_signature: { code: 2375, category: ts.DiagnosticCategory.Error, key: \"Duplicate_number_index_signature_2375\", message: \"Duplicate number index signature.\" },\n        A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: ts.DiagnosticCategory.Error, key: \"A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_proper_2376\", message: \"A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.\" },\n        Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: ts.DiagnosticCategory.Error, key: \"Constructors_for_derived_classes_must_contain_a_super_call_2377\", message: \"Constructors for derived classes must contain a 'super' call.\" },\n        A_get_accessor_must_return_a_value: { code: 2378, category: ts.DiagnosticCategory.Error, key: \"A_get_accessor_must_return_a_value_2378\", message: \"A 'get' accessor must return a value.\" },\n        Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: ts.DiagnosticCategory.Error, key: \"Getter_and_setter_accessors_do_not_agree_in_visibility_2379\", message: \"Getter and setter accessors do not agree in visibility.\" },\n        get_and_set_accessor_must_have_the_same_type: { code: 2380, category: ts.DiagnosticCategory.Error, key: \"get_and_set_accessor_must_have_the_same_type_2380\", message: \"'get' and 'set' accessor must have the same type.\" },\n        A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: ts.DiagnosticCategory.Error, key: \"A_signature_with_an_implementation_cannot_use_a_string_literal_type_2381\", message: \"A signature with an implementation cannot use a string literal type.\" },\n        Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: ts.DiagnosticCategory.Error, key: \"Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382\", message: \"Specialized overload signature is not assignable to any non-specialized signature.\" },\n        Overload_signatures_must_all_be_exported_or_non_exported: { code: 2383, category: ts.DiagnosticCategory.Error, key: \"Overload_signatures_must_all_be_exported_or_non_exported_2383\", message: \"Overload signatures must all be exported or non-exported.\" },\n        Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: ts.DiagnosticCategory.Error, key: \"Overload_signatures_must_all_be_ambient_or_non_ambient_2384\", message: \"Overload signatures must all be ambient or non-ambient.\" },\n        Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: ts.DiagnosticCategory.Error, key: \"Overload_signatures_must_all_be_public_private_or_protected_2385\", message: \"Overload signatures must all be public, private or protected.\" },\n        Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: ts.DiagnosticCategory.Error, key: \"Overload_signatures_must_all_be_optional_or_required_2386\", message: \"Overload signatures must all be optional or required.\" },\n        Function_overload_must_be_static: { code: 2387, category: ts.DiagnosticCategory.Error, key: \"Function_overload_must_be_static_2387\", message: \"Function overload must be static.\" },\n        Function_overload_must_not_be_static: { code: 2388, category: ts.DiagnosticCategory.Error, key: \"Function_overload_must_not_be_static_2388\", message: \"Function overload must not be static.\" },\n        Function_implementation_name_must_be_0: { code: 2389, category: ts.DiagnosticCategory.Error, key: \"Function_implementation_name_must_be_0_2389\", message: \"Function implementation name must be '{0}'.\" },\n        Constructor_implementation_is_missing: { code: 2390, category: ts.DiagnosticCategory.Error, key: \"Constructor_implementation_is_missing_2390\", message: \"Constructor implementation is missing.\" },\n        Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: ts.DiagnosticCategory.Error, key: \"Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391\", message: \"Function implementation is missing or not immediately following the declaration.\" },\n        Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: ts.DiagnosticCategory.Error, key: \"Multiple_constructor_implementations_are_not_allowed_2392\", message: \"Multiple constructor implementations are not allowed.\" },\n        Duplicate_function_implementation: { code: 2393, category: ts.DiagnosticCategory.Error, key: \"Duplicate_function_implementation_2393\", message: \"Duplicate function implementation.\" },\n        Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: ts.DiagnosticCategory.Error, key: \"Overload_signature_is_not_compatible_with_function_implementation_2394\", message: \"Overload signature is not compatible with function implementation.\" },\n        Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: ts.DiagnosticCategory.Error, key: \"Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395\", message: \"Individual declarations in merged declaration '{0}' must be all exported or all local.\" },\n        Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters_2396\", message: \"Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.\" },\n        Declaration_name_conflicts_with_built_in_global_identifier_0: { code: 2397, category: ts.DiagnosticCategory.Error, key: \"Declaration_name_conflicts_with_built_in_global_identifier_0_2397\", message: \"Declaration name conflicts with built-in global identifier '{0}'.\" },\n        Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399\", message: \"Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.\" },\n        Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: ts.DiagnosticCategory.Error, key: \"Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400\", message: \"Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference.\" },\n        Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference_2401\", message: \"Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.\" },\n        Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: ts.DiagnosticCategory.Error, key: \"Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference_2402\", message: \"Expression resolves to '_super' that compiler uses to capture base class reference.\" },\n        Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: ts.DiagnosticCategory.Error, key: \"Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403\", message: \"Subsequent variable declarations must have the same type.  Variable '{0}' must be of type '{1}', but here has type '{2}'.\" },\n        The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404\", message: \"The left-hand side of a 'for...in' statement cannot use a type annotation.\" },\n        The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405\", message: \"The left-hand side of a 'for...in' statement must be of type 'string' or 'any'.\" },\n        The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: { code: 2406, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406\", message: \"The left-hand side of a 'for...in' statement must be a variable or a property access.\" },\n        The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: ts.DiagnosticCategory.Error, key: \"The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407\", message: \"The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.\" },\n        Setters_cannot_return_a_value: { code: 2408, category: ts.DiagnosticCategory.Error, key: \"Setters_cannot_return_a_value_2408\", message: \"Setters cannot return a value.\" },\n        Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409\", message: \"Return type of constructor signature must be assignable to the instance type of the class\" },\n        The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: { code: 2410, category: ts.DiagnosticCategory.Error, key: \"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410\", message: \"The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.\" },\n        Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: ts.DiagnosticCategory.Error, key: \"Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411\", message: \"Property '{0}' of type '{1}' is not assignable to string index type '{2}'.\" },\n        Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: ts.DiagnosticCategory.Error, key: \"Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412\", message: \"Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'.\" },\n        Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: ts.DiagnosticCategory.Error, key: \"Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413\", message: \"Numeric index type '{0}' is not assignable to string index type '{1}'.\" },\n        Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: \"Class_name_cannot_be_0_2414\", message: \"Class name cannot be '{0}'\" },\n        Class_0_incorrectly_extends_base_class_1: { code: 2415, category: ts.DiagnosticCategory.Error, key: \"Class_0_incorrectly_extends_base_class_1_2415\", message: \"Class '{0}' incorrectly extends base class '{1}'.\" },\n        Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: ts.DiagnosticCategory.Error, key: \"Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417\", message: \"Class static side '{0}' incorrectly extends base class static side '{1}'.\" },\n        Class_0_incorrectly_implements_interface_1: { code: 2420, category: ts.DiagnosticCategory.Error, key: \"Class_0_incorrectly_implements_interface_1_2420\", message: \"Class '{0}' incorrectly implements interface '{1}'.\" },\n        A_class_may_only_implement_another_class_or_interface: { code: 2422, category: ts.DiagnosticCategory.Error, key: \"A_class_may_only_implement_another_class_or_interface_2422\", message: \"A class may only implement another class or interface.\" },\n        Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: ts.DiagnosticCategory.Error, key: \"Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_access_2423\", message: \"Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.\" },\n        Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: ts.DiagnosticCategory.Error, key: \"Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_proper_2424\", message: \"Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.\" },\n        Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: ts.DiagnosticCategory.Error, key: \"Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425\", message: \"Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.\" },\n        Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: ts.DiagnosticCategory.Error, key: \"Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426\", message: \"Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.\" },\n        Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: \"Interface_name_cannot_be_0_2427\", message: \"Interface name cannot be '{0}'\" },\n        All_declarations_of_0_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: \"All_declarations_of_0_must_have_identical_type_parameters_2428\", message: \"All declarations of '{0}' must have identical type parameters.\" },\n        Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: \"Interface_0_incorrectly_extends_interface_1_2430\", message: \"Interface '{0}' incorrectly extends interface '{1}'.\" },\n        Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: \"Enum_name_cannot_be_0_2431\", message: \"Enum name cannot be '{0}'\" },\n        In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: \"In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432\", message: \"In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element.\" },\n        A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: \"A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433\", message: \"A namespace declaration cannot be in a different file from a class or function with which it is merged\" },\n        A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: \"A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434\", message: \"A namespace declaration cannot be located prior to a class or function with which it is merged\" },\n        Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { code: 2435, category: ts.DiagnosticCategory.Error, key: \"Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435\", message: \"Ambient modules cannot be nested in other modules or namespaces.\" },\n        Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: \"Ambient_module_declaration_cannot_specify_relative_module_name_2436\", message: \"Ambient module declaration cannot specify relative module name.\" },\n        Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: \"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437\", message: \"Module '{0}' is hidden by a local declaration with the same name\" },\n        Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: \"Import_name_cannot_be_0_2438\", message: \"Import name cannot be '{0}'\" },\n        Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: \"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439\", message: \"Import or export declaration in an ambient module declaration cannot reference module through relative module name.\" },\n        Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.DiagnosticCategory.Error, key: \"Import_declaration_conflicts_with_local_declaration_of_0_2440\", message: \"Import declaration conflicts with local declaration of '{0}'\" },\n        Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441\", message: \"Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module.\" },\n        Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: ts.DiagnosticCategory.Error, key: \"Types_have_separate_declarations_of_a_private_property_0_2442\", message: \"Types have separate declarations of a private property '{0}'.\" },\n        Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443\", message: \"Property '{0}' is protected but type '{1}' is not a class derived from '{2}'.\" },\n        Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_protected_in_type_1_but_public_in_type_2_2444\", message: \"Property '{0}' is protected in type '{1}' but public in type '{2}'.\" },\n        Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses_2445\", message: \"Property '{0}' is protected and only accessible within class '{1}' and its subclasses.\" },\n        Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446\", message: \"Property '{0}' is protected and only accessible through an instance of class '{1}'.\" },\n        The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: \"The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447\", message: \"The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead.\" },\n        Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: \"Block_scoped_variable_0_used_before_its_declaration_2448\", message: \"Block-scoped variable '{0}' used before its declaration.\" },\n        Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: \"Cannot_redeclare_block_scoped_variable_0_2451\", message: \"Cannot redeclare block-scoped variable '{0}'.\" },\n        An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: \"An_enum_member_cannot_have_a_numeric_name_2452\", message: \"An enum member cannot have a numeric name.\" },\n        The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: \"The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453\", message: \"The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly.\" },\n        Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: \"Variable_0_is_used_before_being_assigned_2454\", message: \"Variable '{0}' is used before being assigned.\" },\n        Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: \"Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455\", message: \"Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'.\" },\n        Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: \"Type_alias_0_circularly_references_itself_2456\", message: \"Type alias '{0}' circularly references itself.\" },\n        Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: \"Type_alias_name_cannot_be_0_2457\", message: \"Type alias name cannot be '{0}'\" },\n        An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: ts.DiagnosticCategory.Error, key: \"An_AMD_module_cannot_have_multiple_name_assignments_2458\", message: \"An AMD module cannot have multiple name assignments.\" },\n        Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: ts.DiagnosticCategory.Error, key: \"Type_0_has_no_property_1_and_no_string_index_signature_2459\", message: \"Type '{0}' has no property '{1}' and no string index signature.\" },\n        Type_0_has_no_property_1: { code: 2460, category: ts.DiagnosticCategory.Error, key: \"Type_0_has_no_property_1_2460\", message: \"Type '{0}' has no property '{1}'.\" },\n        Type_0_is_not_an_array_type: { code: 2461, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_an_array_type_2461\", message: \"Type '{0}' is not an array type.\" },\n        A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: \"A_rest_element_must_be_last_in_a_destructuring_pattern_2462\", message: \"A rest element must be last in a destructuring pattern\" },\n        A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: ts.DiagnosticCategory.Error, key: \"A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463\", message: \"A binding pattern parameter cannot be optional in an implementation signature.\" },\n        A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464\", message: \"A computed property name must be of type 'string', 'number', 'symbol', or 'any'.\" },\n        this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: ts.DiagnosticCategory.Error, key: \"this_cannot_be_referenced_in_a_computed_property_name_2465\", message: \"'this' cannot be referenced in a computed property name.\" },\n        super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: ts.DiagnosticCategory.Error, key: \"super_cannot_be_referenced_in_a_computed_property_name_2466\", message: \"'super' cannot be referenced in a computed property name.\" },\n        A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type_2467\", message: \"A computed property name cannot reference a type parameter from its containing type.\" },\n        Cannot_find_global_value_0: { code: 2468, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_global_value_0_2468\", message: \"Cannot find global value '{0}'.\" },\n        The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: ts.DiagnosticCategory.Error, key: \"The_0_operator_cannot_be_applied_to_type_symbol_2469\", message: \"The '{0}' operator cannot be applied to type 'symbol'.\" },\n        Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: ts.DiagnosticCategory.Error, key: \"Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object_2470\", message: \"'Symbol' reference does not refer to the global Symbol constructor object.\" },\n        A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_of_the_form_0_must_be_of_type_symbol_2471\", message: \"A computed property name of the form '{0}' must be of type 'symbol'.\" },\n        Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: { code: 2472, category: ts.DiagnosticCategory.Error, key: \"Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher_2472\", message: \"Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher.\" },\n        Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: ts.DiagnosticCategory.Error, key: \"Enum_declarations_must_all_be_const_or_non_const_2473\", message: \"Enum declarations must all be const or non-const.\" },\n        In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: ts.DiagnosticCategory.Error, key: \"In_const_enum_declarations_member_initializer_must_be_constant_expression_2474\", message: \"In 'const' enum declarations member initializer must be constant expression.\" },\n        const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: ts.DiagnosticCategory.Error, key: \"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475\", message: \"'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.\" },\n        A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: ts.DiagnosticCategory.Error, key: \"A_const_enum_member_can_only_be_accessed_using_a_string_literal_2476\", message: \"A const enum member can only be accessed using a string literal.\" },\n        const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: ts.DiagnosticCategory.Error, key: \"const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477\", message: \"'const' enum member initializer was evaluated to a non-finite value.\" },\n        const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: ts.DiagnosticCategory.Error, key: \"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478\", message: \"'const' enum member initializer was evaluated to disallowed value 'NaN'.\" },\n        Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: ts.DiagnosticCategory.Error, key: \"Property_0_does_not_exist_on_const_enum_1_2479\", message: \"Property '{0}' does not exist on 'const' enum '{1}'.\" },\n        let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: ts.DiagnosticCategory.Error, key: \"let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480\", message: \"'let' is not allowed to be used as a name in 'let' or 'const' declarations.\" },\n        Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: \"Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481\", message: \"Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'.\" },\n        The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483\", message: \"The left-hand side of a 'for...of' statement cannot use a type annotation.\" },\n        Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: \"Export_declaration_conflicts_with_exported_declaration_of_0_2484\", message: \"Export declaration conflicts with exported declaration of '{0}'\" },\n        The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: { code: 2487, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487\", message: \"The left-hand side of a 'for...of' statement must be a variable or a property access.\" },\n        Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: \"Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488\", message: \"Type must have a '[Symbol.iterator]()' method that returns an iterator.\" },\n        An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: \"An_iterator_must_have_a_next_method_2489\", message: \"An iterator must have a 'next()' method.\" },\n        The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: ts.DiagnosticCategory.Error, key: \"The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490\", message: \"The type returned by the 'next()' method of an iterator must have a 'value' property.\" },\n        The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491\", message: \"The left-hand side of a 'for...in' statement cannot be a destructuring pattern.\" },\n        Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: ts.DiagnosticCategory.Error, key: \"Cannot_redeclare_identifier_0_in_catch_clause_2492\", message: \"Cannot redeclare identifier '{0}' in catch clause\" },\n        Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: ts.DiagnosticCategory.Error, key: \"Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2_2493\", message: \"Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'.\" },\n        Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: ts.DiagnosticCategory.Error, key: \"Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494\", message: \"Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher.\" },\n        Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_an_array_type_or_a_string_type_2495\", message: \"Type '{0}' is not an array type or a string type.\" },\n        The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: { code: 2496, category: ts.DiagnosticCategory.Error, key: \"The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_stand_2496\", message: \"The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.\" },\n        Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: \"Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497\", message: \"Module '{0}' resolves to a non-module entity and cannot be imported using this construct.\" },\n        Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: \"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498\", message: \"Module '{0}' uses 'export =' and cannot be used with 'export *'.\" },\n        An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: \"An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments_2499\", message: \"An interface can only extend an identifier/qualified-name with optional type arguments.\" },\n        A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: \"A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments_2500\", message: \"A class can only implement an identifier/qualified-name with optional type arguments.\" },\n        A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: \"A_rest_element_cannot_contain_a_binding_pattern_2501\", message: \"A rest element cannot contain a binding pattern.\" },\n        _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: \"_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502\", message: \"'{0}' is referenced directly or indirectly in its own type annotation.\" },\n        Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_namespace_0_2503\", message: \"Cannot find namespace '{0}'.\" },\n        A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: ts.DiagnosticCategory.Error, key: \"A_generator_cannot_have_a_void_type_annotation_2505\", message: \"A generator cannot have a 'void' type annotation.\" },\n        _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: { code: 2506, category: ts.DiagnosticCategory.Error, key: \"_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506\", message: \"'{0}' is referenced directly or indirectly in its own base expression.\" },\n        Type_0_is_not_a_constructor_function_type: { code: 2507, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_a_constructor_function_type_2507\", message: \"Type '{0}' is not a constructor function type.\" },\n        No_base_constructor_has_the_specified_number_of_type_arguments: { code: 2508, category: ts.DiagnosticCategory.Error, key: \"No_base_constructor_has_the_specified_number_of_type_arguments_2508\", message: \"No base constructor has the specified number of type arguments.\" },\n        Base_constructor_return_type_0_is_not_a_class_or_interface_type: { code: 2509, category: ts.DiagnosticCategory.Error, key: \"Base_constructor_return_type_0_is_not_a_class_or_interface_type_2509\", message: \"Base constructor return type '{0}' is not a class or interface type.\" },\n        Base_constructors_must_all_have_the_same_return_type: { code: 2510, category: ts.DiagnosticCategory.Error, key: \"Base_constructors_must_all_have_the_same_return_type_2510\", message: \"Base constructors must all have the same return type.\" },\n        Cannot_create_an_instance_of_the_abstract_class_0: { code: 2511, category: ts.DiagnosticCategory.Error, key: \"Cannot_create_an_instance_of_the_abstract_class_0_2511\", message: \"Cannot create an instance of the abstract class '{0}'.\" },\n        Overload_signatures_must_all_be_abstract_or_non_abstract: { code: 2512, category: ts.DiagnosticCategory.Error, key: \"Overload_signatures_must_all_be_abstract_or_non_abstract_2512\", message: \"Overload signatures must all be abstract or non-abstract.\" },\n        Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: { code: 2513, category: ts.DiagnosticCategory.Error, key: \"Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513\", message: \"Abstract method '{0}' in class '{1}' cannot be accessed via super expression.\" },\n        Classes_containing_abstract_methods_must_be_marked_abstract: { code: 2514, category: ts.DiagnosticCategory.Error, key: \"Classes_containing_abstract_methods_must_be_marked_abstract_2514\", message: \"Classes containing abstract methods must be marked abstract.\" },\n        Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: \"Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515\", message: \"Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'.\" },\n        All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: \"All_declarations_of_an_abstract_method_must_be_consecutive_2516\", message: \"All declarations of an abstract method must be consecutive.\" },\n        Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: \"Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517\", message: \"Cannot assign an abstract constructor type to a non-abstract constructor type.\" },\n        A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { code: 2518, category: ts.DiagnosticCategory.Error, key: \"A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518\", message: \"A 'this'-based type guard is not compatible with a parameter-based type guard.\" },\n        Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520\", message: \"Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions.\" },\n        Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: \"Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521\", message: \"Expression resolves to variable declaration '{0}' that compiler uses to support async functions.\" },\n        The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: { code: 2522, category: ts.DiagnosticCategory.Error, key: \"The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522\", message: \"The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method.\" },\n        yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: ts.DiagnosticCategory.Error, key: \"yield_expressions_cannot_be_used_in_a_parameter_initializer_2523\", message: \"'yield' expressions cannot be used in a parameter initializer.\" },\n        await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: ts.DiagnosticCategory.Error, key: \"await_expressions_cannot_be_used_in_a_parameter_initializer_2524\", message: \"'await' expressions cannot be used in a parameter initializer.\" },\n        Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: ts.DiagnosticCategory.Error, key: \"Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525\", message: \"Initializer provides no value for this binding element and the binding element has no default value.\" },\n        A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: { code: 2526, category: ts.DiagnosticCategory.Error, key: \"A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526\", message: \"A 'this' type is available only in a non-static member of a class or interface.\" },\n        The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: { code: 2527, category: ts.DiagnosticCategory.Error, key: \"The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary_2527\", message: \"The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary.\" },\n        A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: \"A_module_cannot_have_multiple_default_exports_2528\", message: \"A module cannot have multiple default exports.\" },\n        Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: { code: 2529, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529\", message: \"Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions.\" },\n        Property_0_is_incompatible_with_index_signature: { code: 2530, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_incompatible_with_index_signature_2530\", message: \"Property '{0}' is incompatible with index signature.\" },\n        Object_is_possibly_null: { code: 2531, category: ts.DiagnosticCategory.Error, key: \"Object_is_possibly_null_2531\", message: \"Object is possibly 'null'.\" },\n        Object_is_possibly_undefined: { code: 2532, category: ts.DiagnosticCategory.Error, key: \"Object_is_possibly_undefined_2532\", message: \"Object is possibly 'undefined'.\" },\n        Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: \"Object_is_possibly_null_or_undefined_2533\", message: \"Object is possibly 'null' or 'undefined'.\" },\n        A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: \"A_function_returning_never_cannot_have_a_reachable_end_point_2534\", message: \"A function returning 'never' cannot have a reachable end point.\" },\n        Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: \"Enum_type_0_has_members_with_initializers_that_are_not_literals_2535\", message: \"Enum type '{0}' has members with initializers that are not literals.\" },\n        Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: \"Type_0_cannot_be_used_to_index_type_1_2536\", message: \"Type '{0}' cannot be used to index type '{1}'.\" },\n        Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: \"Type_0_has_no_matching_index_signature_for_type_1_2537\", message: \"Type '{0}' has no matching index signature for type '{1}'.\" },\n        Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: \"Type_0_cannot_be_used_as_an_index_type_2538\", message: \"Type '{0}' cannot be used as an index type.\" },\n        Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: \"Cannot_assign_to_0_because_it_is_not_a_variable_2539\", message: \"Cannot assign to '{0}' because it is not a variable.\" },\n        Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: \"Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540\", message: \"Cannot assign to '{0}' because it is a constant or a read-only property.\" },\n        The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: \"The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541\", message: \"The target of an assignment must be a variable or a property access.\" },\n        Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: \"Index_signature_in_type_0_only_permits_reading_2542\", message: \"Index signature in type '{0}' only permits reading.\" },\n        JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: \"JSX_element_attributes_type_0_may_not_be_a_union_type_2600\", message: \"JSX element attributes type '{0}' may not be a union type.\" },\n        The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: \"The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601\", message: \"The return type of a JSX element constructor must return an object type.\" },\n        JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: \"JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602\", message: \"JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist.\" },\n        Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: \"Property_0_in_type_1_is_not_assignable_to_type_2_2603\", message: \"Property '{0}' in type '{1}' is not assignable to type '{2}'\" },\n        JSX_element_type_0_does_not_have_any_construct_or_call_signatures: { code: 2604, category: ts.DiagnosticCategory.Error, key: \"JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604\", message: \"JSX element type '{0}' does not have any construct or call signatures.\" },\n        JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: { code: 2605, category: ts.DiagnosticCategory.Error, key: \"JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements_2605\", message: \"JSX element type '{0}' is not a constructor function for JSX elements.\" },\n        Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: \"Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606\", message: \"Property '{0}' of JSX spread attribute is not assignable to target property.\" },\n        JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: \"JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607\", message: \"JSX element class does not support attributes because it does not have a '{0}' property\" },\n        The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: \"The_global_type_JSX_0_may_not_have_more_than_one_property_2608\", message: \"The global type 'JSX.{0}' may not have more than one property\" },\n        Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: \"Cannot_emit_namespaced_JSX_elements_in_React_2650\", message: \"Cannot emit namespaced JSX elements in React\" },\n        A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: \"A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651\", message: \"A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.\" },\n        Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: \"Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652\", message: \"Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead.\" },\n        Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: ts.DiagnosticCategory.Error, key: \"Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653\", message: \"Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'.\" },\n        Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: \"Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654\", message: \"Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.\" },\n        Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: \"Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656\", message: \"Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition.\" },\n        JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: \"JSX_expressions_must_have_one_parent_element_2657\", message: \"JSX expressions must have one parent element\" },\n        Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: \"Type_0_provides_no_match_for_the_signature_1_2658\", message: \"Type '{0}' provides no match for the signature '{1}'\" },\n        super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { code: 2659, category: ts.DiagnosticCategory.Error, key: \"super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659\", message: \"'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.\" },\n        super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { code: 2660, category: ts.DiagnosticCategory.Error, key: \"super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660\", message: \"'super' can only be referenced in members of derived classes or object literal expressions.\" },\n        Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { code: 2661, category: ts.DiagnosticCategory.Error, key: \"Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661\", message: \"Cannot export '{0}'. Only local declarations can be exported from a module.\" },\n        Cannot_find_name_0_Did_you_mean_the_static_member_1_0: { code: 2662, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662\", message: \"Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?\" },\n        Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: { code: 2663, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663\", message: \"Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?\" },\n        Invalid_module_name_in_augmentation_module_0_cannot_be_found: { code: 2664, category: ts.DiagnosticCategory.Error, key: \"Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664\", message: \"Invalid module name in augmentation, module '{0}' cannot be found.\" },\n        Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented: { code: 2665, category: ts.DiagnosticCategory.Error, key: \"Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augm_2665\", message: \"Invalid module name in augmentation. Module '{0}' resolves to an untyped module at '{1}', which cannot be augmented.\" },\n        Exports_and_export_assignments_are_not_permitted_in_module_augmentations: { code: 2666, category: ts.DiagnosticCategory.Error, key: \"Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666\", message: \"Exports and export assignments are not permitted in module augmentations.\" },\n        Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: { code: 2667, category: ts.DiagnosticCategory.Error, key: \"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667\", message: \"Imports are not permitted in module augmentations. Consider moving them to the enclosing external module.\" },\n        export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: { code: 2668, category: ts.DiagnosticCategory.Error, key: \"export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668\", message: \"'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.\" },\n        Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations: { code: 2669, category: ts.DiagnosticCategory.Error, key: \"Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669\", message: \"Augmentations for the global scope can only be directly nested in external modules or ambient module declarations.\" },\n        Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context: { code: 2670, category: ts.DiagnosticCategory.Error, key: \"Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670\", message: \"Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context.\" },\n        Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity: { code: 2671, category: ts.DiagnosticCategory.Error, key: \"Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671\", message: \"Cannot augment module '{0}' because it resolves to a non-module entity.\" },\n        Cannot_assign_a_0_constructor_type_to_a_1_constructor_type: { code: 2672, category: ts.DiagnosticCategory.Error, key: \"Cannot_assign_a_0_constructor_type_to_a_1_constructor_type_2672\", message: \"Cannot assign a '{0}' constructor type to a '{1}' constructor type.\" },\n        Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration: { code: 2673, category: ts.DiagnosticCategory.Error, key: \"Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration_2673\", message: \"Constructor of class '{0}' is private and only accessible within the class declaration.\" },\n        Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: { code: 2674, category: ts.DiagnosticCategory.Error, key: \"Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674\", message: \"Constructor of class '{0}' is protected and only accessible within the class declaration.\" },\n        Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: { code: 2675, category: ts.DiagnosticCategory.Error, key: \"Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675\", message: \"Cannot extend a class '{0}'. Class constructor is marked as private.\" },\n        Accessors_must_both_be_abstract_or_non_abstract: { code: 2676, category: ts.DiagnosticCategory.Error, key: \"Accessors_must_both_be_abstract_or_non_abstract_2676\", message: \"Accessors must both be abstract or non-abstract.\" },\n        A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: { code: 2677, category: ts.DiagnosticCategory.Error, key: \"A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677\", message: \"A type predicate's type must be assignable to its parameter's type.\" },\n        Type_0_is_not_comparable_to_type_1: { code: 2678, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_comparable_to_type_1_2678\", message: \"Type '{0}' is not comparable to type '{1}'.\" },\n        A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: { code: 2679, category: ts.DiagnosticCategory.Error, key: \"A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679\", message: \"A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'.\" },\n        A_this_parameter_must_be_the_first_parameter: { code: 2680, category: ts.DiagnosticCategory.Error, key: \"A_this_parameter_must_be_the_first_parameter_2680\", message: \"A 'this' parameter must be the first parameter.\" },\n        A_constructor_cannot_have_a_this_parameter: { code: 2681, category: ts.DiagnosticCategory.Error, key: \"A_constructor_cannot_have_a_this_parameter_2681\", message: \"A constructor cannot have a 'this' parameter.\" },\n        get_and_set_accessor_must_have_the_same_this_type: { code: 2682, category: ts.DiagnosticCategory.Error, key: \"get_and_set_accessor_must_have_the_same_this_type_2682\", message: \"'get' and 'set' accessor must have the same 'this' type.\" },\n        this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: { code: 2683, category: ts.DiagnosticCategory.Error, key: \"this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_2683\", message: \"'this' implicitly has type 'any' because it does not have a type annotation.\" },\n        The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: { code: 2684, category: ts.DiagnosticCategory.Error, key: \"The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684\", message: \"The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'.\" },\n        The_this_types_of_each_signature_are_incompatible: { code: 2685, category: ts.DiagnosticCategory.Error, key: \"The_this_types_of_each_signature_are_incompatible_2685\", message: \"The 'this' types of each signature are incompatible.\" },\n        _0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead: { code: 2686, category: ts.DiagnosticCategory.Error, key: \"_0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead_2686\", message: \"'{0}' refers to a UMD global, but the current file is a module. Consider adding an import instead.\" },\n        All_declarations_of_0_must_have_identical_modifiers: { code: 2687, category: ts.DiagnosticCategory.Error, key: \"All_declarations_of_0_must_have_identical_modifiers_2687\", message: \"All declarations of '{0}' must have identical modifiers.\" },\n        Cannot_find_type_definition_file_for_0: { code: 2688, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_type_definition_file_for_0_2688\", message: \"Cannot find type definition file for '{0}'.\" },\n        Cannot_extend_an_interface_0_Did_you_mean_implements: { code: 2689, category: ts.DiagnosticCategory.Error, key: \"Cannot_extend_an_interface_0_Did_you_mean_implements_2689\", message: \"Cannot extend an interface '{0}'. Did you mean 'implements'?\" },\n        A_class_must_be_declared_after_its_base_class: { code: 2690, category: ts.DiagnosticCategory.Error, key: \"A_class_must_be_declared_after_its_base_class_2690\", message: \"A class must be declared after its base class.\" },\n        An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: { code: 2691, category: ts.DiagnosticCategory.Error, key: \"An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691\", message: \"An import path cannot end with a '{0}' extension. Consider importing '{1}' instead.\" },\n        _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: { code: 2692, category: ts.DiagnosticCategory.Error, key: \"_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692\", message: \"'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible.\" },\n        _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: { code: 2693, category: ts.DiagnosticCategory.Error, key: \"_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693\", message: \"'{0}' only refers to a type, but is being used as a value here.\" },\n        Namespace_0_has_no_exported_member_1: { code: 2694, category: ts.DiagnosticCategory.Error, key: \"Namespace_0_has_no_exported_member_1_2694\", message: \"Namespace '{0}' has no exported member '{1}'.\" },\n        Left_side_of_comma_operator_is_unused_and_has_no_side_effects: { code: 2695, category: ts.DiagnosticCategory.Error, key: \"Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695\", message: \"Left side of comma operator is unused and has no side effects.\" },\n        The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: \"The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696\", message: \"The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?\" },\n        An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: \"An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697\", message: \"An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option.\" },\n        Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: \"Spread_types_may_only_be_created_from_object_types_2698\", message: \"Spread types may only be created from object types.\" },\n        Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: \"Rest_types_may_only_be_created_from_object_types_2700\", message: \"Rest types may only be created from object types.\" },\n        The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: \"The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701\", message: \"The target of an object rest assignment must be a variable or a property access.\" },\n        _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: \"_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702\", message: \"'{0}' only refers to a type, but is being used as a namespace here.\" },\n        Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: \"Import_declaration_0_is_using_private_name_1_4000\", message: \"Import declaration '{0}' is using private name '{1}'.\" },\n        Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002\", message: \"Type parameter '{0}' of exported class has or is using private name '{1}'.\" },\n        Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004\", message: \"Type parameter '{0}' of exported interface has or is using private name '{1}'.\" },\n        Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4006\", message: \"Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'.\" },\n        Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4008\", message: \"Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'.\" },\n        Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4010\", message: \"Type parameter '{0}' of public static method from exported class has or is using private name '{1}'.\" },\n        Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4012\", message: \"Type parameter '{0}' of public method from exported class has or is using private name '{1}'.\" },\n        Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014\", message: \"Type parameter '{0}' of method from exported interface has or is using private name '{1}'.\" },\n        Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016\", message: \"Type parameter '{0}' of exported function has or is using private name '{1}'.\" },\n        Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: ts.DiagnosticCategory.Error, key: \"Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019\", message: \"Implements clause of exported class '{0}' has or is using private name '{1}'.\" },\n        Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: ts.DiagnosticCategory.Error, key: \"Extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020\", message: \"Extends clause of exported class '{0}' has or is using private name '{1}'.\" },\n        Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: ts.DiagnosticCategory.Error, key: \"Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022\", message: \"Extends clause of exported interface '{0}' has or is using private name '{1}'.\" },\n        Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: ts.DiagnosticCategory.Error, key: \"Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023\", message: \"Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: ts.DiagnosticCategory.Error, key: \"Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024\", message: \"Exported variable '{0}' has or is using name '{1}' from private module '{2}'.\" },\n        Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: ts.DiagnosticCategory.Error, key: \"Exported_variable_0_has_or_is_using_private_name_1_4025\", message: \"Exported variable '{0}' has or is using private name '{1}'.\" },\n        Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: ts.DiagnosticCategory.Error, key: \"Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot__4026\", message: \"Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: ts.DiagnosticCategory.Error, key: \"Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4027\", message: \"Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'.\" },\n        Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: ts.DiagnosticCategory.Error, key: \"Public_static_property_0_of_exported_class_has_or_is_using_private_name_1_4028\", message: \"Public static property '{0}' of exported class has or is using private name '{1}'.\" },\n        Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: ts.DiagnosticCategory.Error, key: \"Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_name_4029\", message: \"Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: ts.DiagnosticCategory.Error, key: \"Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4030\", message: \"Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'.\" },\n        Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: ts.DiagnosticCategory.Error, key: \"Public_property_0_of_exported_class_has_or_is_using_private_name_1_4031\", message: \"Public property '{0}' of exported class has or is using private name '{1}'.\" },\n        Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: ts.DiagnosticCategory.Error, key: \"Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4032\", message: \"Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'.\" },\n        Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: ts.DiagnosticCategory.Error, key: \"Property_0_of_exported_interface_has_or_is_using_private_name_1_4033\", message: \"Property '{0}' of exported interface has or is using private name '{1}'.\" },\n        Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_4034\", message: \"Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1_4035\", message: \"Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'.\" },\n        Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_4036\", message: \"Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1_4037\", message: \"Parameter '{0}' of public property setter from exported class has or is using private name '{1}'.\" },\n        Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_externa_4038\", message: \"Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named.\" },\n        Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_4039\", message: \"Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0_4040\", message: \"Return type of public static property getter from exported class has or is using private name '{0}'.\" },\n        Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_modul_4041\", message: \"Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named.\" },\n        Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_4042\", message: \"Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0_4043\", message: \"Return type of public property getter from exported class has or is using private name '{0}'.\" },\n        Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_mod_4044\", message: \"Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0_4045\", message: \"Return type of constructor signature from exported interface has or is using private name '{0}'.\" },\n        Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4046\", message: \"Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0_4047\", message: \"Return type of call signature from exported interface has or is using private name '{0}'.\" },\n        Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4048\", message: \"Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0_4049\", message: \"Return type of index signature from exported interface has or is using private name '{0}'.\" },\n        Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module__4050\", message: \"Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named.\" },\n        Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4051\", message: \"Return type of public static method from exported class has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052\", message: \"Return type of public static method from exported class has or is using private name '{0}'.\" },\n        Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_c_4053\", message: \"Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named.\" },\n        Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4054\", message: \"Return type of public method from exported class has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0_4055\", message: \"Return type of public method from exported class has or is using private name '{0}'.\" },\n        Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4056\", message: \"Return type of method from exported interface has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0_4057\", message: \"Return type of method from exported interface has or is using private name '{0}'.\" },\n        Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named_4058\", message: \"Return type of exported function has or is using name '{0}' from external module {1} but cannot be named.\" },\n        Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1_4059\", message: \"Return type of exported function has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_exported_function_has_or_is_using_private_name_0_4060\", message: \"Return type of exported function has or is using private name '{0}'.\" },\n        Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_can_4061\", message: \"Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2_4062\", message: \"Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1_4063\", message: \"Parameter '{0}' of constructor from exported class has or is using private name '{1}'.\" },\n        Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_mod_4064\", message: \"Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4065\", message: \"Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'.\" },\n        Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4066\", message: \"Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4067\", message: \"Parameter '{0}' of call signature from exported interface has or is using private name '{1}'.\" },\n        Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module__4068\", message: \"Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4069\", message: \"Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4070\", message: \"Parameter '{0}' of public static method from exported class has or is using private name '{1}'.\" },\n        Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_c_4071\", message: \"Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4072\", message: \"Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4073\", message: \"Parameter '{0}' of public method from exported class has or is using private name '{1}'.\" },\n        Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4074\", message: \"Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4075\", message: \"Parameter '{0}' of method from exported interface has or is using private name '{1}'.\" },\n        Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4076\", message: \"Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2_4077\", message: \"Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078\", message: \"Parameter '{0}' of exported function has or is using private name '{1}'.\" },\n        Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: \"Exported_type_alias_0_has_or_is_using_private_name_1_4081\", message: \"Exported type alias '{0}' has or is using private name '{1}'.\" },\n        Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: \"Default_export_of_the_module_has_or_is_using_private_name_0_4082\", message: \"Default export of the module has or is using private name '{0}'.\" },\n        Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083\", message: \"Type parameter '{0}' of exported type alias has or is using private name '{1}'.\" },\n        Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: \"Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090\", message: \"Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict.\" },\n        Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091\", message: \"Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092\", message: \"Parameter '{0}' of index signature from exported interface has or is using private name '{1}'.\" },\n        The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: \"The_current_host_does_not_support_the_0_option_5001\", message: \"The current host does not support the '{0}' option.\" },\n        Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_the_common_subdirectory_path_for_the_input_files_5009\", message: \"Cannot find the common subdirectory path for the input files.\" },\n        File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: \"File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010\", message: \"File specification cannot end in a recursive directory wildcard ('**'): '{0}'.\" },\n        File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0: { code: 5011, category: ts.DiagnosticCategory.Error, key: \"File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0_5011\", message: \"File specification cannot contain multiple recursive directory wildcards ('**'): '{0}'.\" },\n        Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: \"Cannot_read_file_0_Colon_1_5012\", message: \"Cannot read file '{0}': {1}\" },\n        Unsupported_file_encoding: { code: 5013, category: ts.DiagnosticCategory.Error, key: \"Unsupported_file_encoding_5013\", message: \"Unsupported file encoding.\" },\n        Failed_to_parse_file_0_Colon_1: { code: 5014, category: ts.DiagnosticCategory.Error, key: \"Failed_to_parse_file_0_Colon_1_5014\", message: \"Failed to parse file '{0}': {1}.\" },\n        Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: \"Unknown_compiler_option_0_5023\", message: \"Unknown compiler option '{0}'.\" },\n        Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: \"Compiler_option_0_requires_a_value_of_type_1_5024\", message: \"Compiler option '{0}' requires a value of type {1}.\" },\n        Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: \"Could_not_write_file_0_Colon_1_5033\", message: \"Could not write file '{0}': {1}\" },\n        Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: \"Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042\", message: \"Option 'project' cannot be mixed with source files on a command line.\" },\n        Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: \"Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047\", message: \"Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher.\" },\n        Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: \"Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051\", message: \"Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.\" },\n        Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: \"Option_0_cannot_be_specified_without_specifying_option_1_5052\", message: \"Option '{0}' cannot be specified without specifying option '{1}'.\" },\n        Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: \"Option_0_cannot_be_specified_with_option_1_5053\", message: \"Option '{0}' cannot be specified with option '{1}'.\" },\n        A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: \"A_tsconfig_json_file_is_already_defined_at_Colon_0_5054\", message: \"A 'tsconfig.json' file is already defined at: '{0}'.\" },\n        Cannot_write_file_0_because_it_would_overwrite_input_file: { code: 5055, category: ts.DiagnosticCategory.Error, key: \"Cannot_write_file_0_because_it_would_overwrite_input_file_5055\", message: \"Cannot write file '{0}' because it would overwrite input file.\" },\n        Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { code: 5056, category: ts.DiagnosticCategory.Error, key: \"Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056\", message: \"Cannot write file '{0}' because it would be overwritten by multiple input files.\" },\n        Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057\", message: \"Cannot find a tsconfig.json file at the specified directory: '{0}'\" },\n        The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: \"The_specified_path_does_not_exist_Colon_0_5058\", message: \"The specified path does not exist: '{0}'\" },\n        Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { code: 5059, category: ts.DiagnosticCategory.Error, key: \"Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059\", message: \"Invalid value for '--reactNamespace'. '{0}' is not a valid identifier.\" },\n        Option_paths_cannot_be_used_without_specifying_baseUrl_option: { code: 5060, category: ts.DiagnosticCategory.Error, key: \"Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060\", message: \"Option 'paths' cannot be used without specifying '--baseUrl' option.\" },\n        Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: \"Pattern_0_can_have_at_most_one_Asterisk_character_5061\", message: \"Pattern '{0}' can have at most one '*' character\" },\n        Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: \"Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062\", message: \"Substitution '{0}' in pattern '{1}' in can have at most one '*' character\" },\n        Substitutions_for_pattern_0_should_be_an_array: { code: 5063, category: ts.DiagnosticCategory.Error, key: \"Substitutions_for_pattern_0_should_be_an_array_5063\", message: \"Substitutions for pattern '{0}' should be an array.\" },\n        Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: \"Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064\", message: \"Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'.\" },\n        File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5065, category: ts.DiagnosticCategory.Error, key: \"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065\", message: \"File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'.\" },\n        Substitutions_for_pattern_0_shouldn_t_be_an_empty_array: { code: 5066, category: ts.DiagnosticCategory.Error, key: \"Substitutions_for_pattern_0_shouldn_t_be_an_empty_array_5066\", message: \"Substitutions for pattern '{0}' shouldn't be an empty array.\" },\n        Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name: { code: 5067, category: ts.DiagnosticCategory.Error, key: \"Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067\", message: \"Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name.\" },\n        Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: \"Concatenate_and_emit_output_to_single_file_6001\", message: \"Concatenate and emit output to single file.\" },\n        Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: \"Generates_corresponding_d_ts_file_6002\", message: \"Generates corresponding '.d.ts' file.\" },\n        Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: \"Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003\", message: \"Specify the location where debugger should locate map files instead of generated locations.\" },\n        Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: \"Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004\", message: \"Specify the location where debugger should locate TypeScript files instead of source locations.\" },\n        Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: \"Watch_input_files_6005\", message: \"Watch input files.\" },\n        Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: \"Redirect_output_structure_to_the_directory_6006\", message: \"Redirect output structure to the directory.\" },\n        Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: \"Do_not_erase_const_enum_declarations_in_generated_code_6007\", message: \"Do not erase const enum declarations in generated code.\" },\n        Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: \"Do_not_emit_outputs_if_any_errors_were_reported_6008\", message: \"Do not emit outputs if any errors were reported.\" },\n        Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: \"Do_not_emit_comments_to_output_6009\", message: \"Do not emit comments to output.\" },\n        Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: \"Do_not_emit_outputs_6010\", message: \"Do not emit outputs.\" },\n        Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: \"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011\", message: \"Allow default imports from modules with no default export. This does not affect code emit, just typechecking.\" },\n        Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: \"Skip_type_checking_of_declaration_files_6012\", message: \"Skip type checking of declaration files.\" },\n        Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: \"Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015\", message: \"Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'\" },\n        Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: \"Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016\", message: \"Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'\" },\n        Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: \"Print_this_message_6017\", message: \"Print this message.\" },\n        Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: \"Print_the_compiler_s_version_6019\", message: \"Print the compiler's version.\" },\n        Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: \"Compile_the_project_in_the_given_directory_6020\", message: \"Compile the project in the given directory.\" },\n        Syntax_Colon_0: { code: 6023, category: ts.DiagnosticCategory.Message, key: \"Syntax_Colon_0_6023\", message: \"Syntax: {0}\" },\n        options: { code: 6024, category: ts.DiagnosticCategory.Message, key: \"options_6024\", message: \"options\" },\n        file: { code: 6025, category: ts.DiagnosticCategory.Message, key: \"file_6025\", message: \"file\" },\n        Examples_Colon_0: { code: 6026, category: ts.DiagnosticCategory.Message, key: \"Examples_Colon_0_6026\", message: \"Examples: {0}\" },\n        Options_Colon: { code: 6027, category: ts.DiagnosticCategory.Message, key: \"Options_Colon_6027\", message: \"Options:\" },\n        Version_0: { code: 6029, category: ts.DiagnosticCategory.Message, key: \"Version_0_6029\", message: \"Version {0}\" },\n        Insert_command_line_options_and_files_from_a_file: { code: 6030, category: ts.DiagnosticCategory.Message, key: \"Insert_command_line_options_and_files_from_a_file_6030\", message: \"Insert command line options and files from a file.\" },\n        File_change_detected_Starting_incremental_compilation: { code: 6032, category: ts.DiagnosticCategory.Message, key: \"File_change_detected_Starting_incremental_compilation_6032\", message: \"File change detected. Starting incremental compilation...\" },\n        KIND: { code: 6034, category: ts.DiagnosticCategory.Message, key: \"KIND_6034\", message: \"KIND\" },\n        FILE: { code: 6035, category: ts.DiagnosticCategory.Message, key: \"FILE_6035\", message: \"FILE\" },\n        VERSION: { code: 6036, category: ts.DiagnosticCategory.Message, key: \"VERSION_6036\", message: \"VERSION\" },\n        LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: \"LOCATION_6037\", message: \"LOCATION\" },\n        DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: \"DIRECTORY_6038\", message: \"DIRECTORY\" },\n        STRATEGY: { code: 6039, category: ts.DiagnosticCategory.Message, key: \"STRATEGY_6039\", message: \"STRATEGY\" },\n        Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: \"Compilation_complete_Watching_for_file_changes_6042\", message: \"Compilation complete. Watching for file changes.\" },\n        Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: \"Generates_corresponding_map_file_6043\", message: \"Generates corresponding '.map' file.\" },\n        Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: \"Compiler_option_0_expects_an_argument_6044\", message: \"Compiler option '{0}' expects an argument.\" },\n        Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: \"Unterminated_quoted_string_in_response_file_0_6045\", message: \"Unterminated quoted string in response file '{0}'.\" },\n        Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: \"Argument_for_0_option_must_be_Colon_1_6046\", message: \"Argument for '{0}' option must be: {1}\" },\n        Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: \"Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048\", message: \"Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'.\" },\n        Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: \"Unsupported_locale_0_6049\", message: \"Unsupported locale '{0}'.\" },\n        Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: \"Unable_to_open_file_0_6050\", message: \"Unable to open file '{0}'.\" },\n        Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: \"Corrupted_locale_file_0_6051\", message: \"Corrupted locale file {0}.\" },\n        Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: \"Raise_error_on_expressions_and_declarations_with_an_implied_any_type_6052\", message: \"Raise error on expressions and declarations with an implied 'any' type.\" },\n        File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: \"File_0_not_found_6053\", message: \"File '{0}' not found.\" },\n        File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: \"File_0_has_unsupported_extension_The_only_supported_extensions_are_1_6054\", message: \"File '{0}' has unsupported extension. The only supported extensions are {1}.\" },\n        Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: \"Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055\", message: \"Suppress noImplicitAny errors for indexing objects lacking index signatures.\" },\n        Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: \"Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056\", message: \"Do not emit declarations for code that has an '@internal' annotation.\" },\n        Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: \"Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058\", message: \"Specify the root directory of input files. Use to control the output directory structure with --outDir.\" },\n        File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: \"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059\", message: \"File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files.\" },\n        Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: \"Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060\", message: \"Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix).\" },\n        NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: \"NEWLINE_6061\", message: \"NEWLINE\" },\n        Option_0_can_only_be_specified_in_tsconfig_json_file: { code: 6064, category: ts.DiagnosticCategory.Error, key: \"Option_0_can_only_be_specified_in_tsconfig_json_file_6064\", message: \"Option '{0}' can only be specified in 'tsconfig.json' file.\" },\n        Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: \"Enables_experimental_support_for_ES7_decorators_6065\", message: \"Enables experimental support for ES7 decorators.\" },\n        Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: \"Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066\", message: \"Enables experimental support for emitting type metadata for decorators.\" },\n        Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: \"Enables_experimental_support_for_ES7_async_functions_6068\", message: \"Enables experimental support for ES7 async functions.\" },\n        Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: \"Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069\", message: \"Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6).\" },\n        Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: \"Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070\", message: \"Initializes a TypeScript project and creates a tsconfig.json file.\" },\n        Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: \"Successfully_created_a_tsconfig_json_file_6071\", message: \"Successfully created a tsconfig.json file.\" },\n        Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: \"Suppress_excess_property_checks_for_object_literals_6072\", message: \"Suppress excess property checks for object literals.\" },\n        Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: \"Stylize_errors_and_messages_using_color_and_context_experimental_6073\", message: \"Stylize errors and messages using color and context. (experimental)\" },\n        Do_not_report_errors_on_unused_labels: { code: 6074, category: ts.DiagnosticCategory.Message, key: \"Do_not_report_errors_on_unused_labels_6074\", message: \"Do not report errors on unused labels.\" },\n        Report_error_when_not_all_code_paths_in_function_return_a_value: { code: 6075, category: ts.DiagnosticCategory.Message, key: \"Report_error_when_not_all_code_paths_in_function_return_a_value_6075\", message: \"Report error when not all code paths in function return a value.\" },\n        Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: \"Report_errors_for_fallthrough_cases_in_switch_statement_6076\", message: \"Report errors for fallthrough cases in switch statement.\" },\n        Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: \"Do_not_report_errors_on_unreachable_code_6077\", message: \"Do not report errors on unreachable code.\" },\n        Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: \"Disallow_inconsistently_cased_references_to_the_same_file_6078\", message: \"Disallow inconsistently-cased references to the same file.\" },\n        Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: \"Specify_library_files_to_be_included_in_the_compilation_Colon_6079\", message: \"Specify library files to be included in the compilation: \" },\n        Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: \"Specify_JSX_code_generation_Colon_preserve_or_react_6080\", message: \"Specify JSX code generation: 'preserve' or 'react'\" },\n        Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: \"Only_amd_and_system_modules_are_supported_alongside_0_6082\", message: \"Only 'amd' and 'system' modules are supported alongside --{0}.\" },\n        Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: \"Base_directory_to_resolve_non_absolute_module_names_6083\", message: \"Base directory to resolve non-absolute module names.\" },\n        Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: \"Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084\", message: \"Specify the object invoked for createElement and __spread when targeting 'react' JSX emit\" },\n        Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: \"Enable_tracing_of_the_name_resolution_process_6085\", message: \"Enable tracing of the name resolution process.\" },\n        Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: \"Resolving_module_0_from_1_6086\", message: \"======== Resolving module '{0}' from '{1}'. ========\" },\n        Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: \"Explicitly_specified_module_resolution_kind_Colon_0_6087\", message: \"Explicitly specified module resolution kind: '{0}'.\" },\n        Module_resolution_kind_is_not_specified_using_0: { code: 6088, category: ts.DiagnosticCategory.Message, key: \"Module_resolution_kind_is_not_specified_using_0_6088\", message: \"Module resolution kind is not specified, using '{0}'.\" },\n        Module_name_0_was_successfully_resolved_to_1: { code: 6089, category: ts.DiagnosticCategory.Message, key: \"Module_name_0_was_successfully_resolved_to_1_6089\", message: \"======== Module name '{0}' was successfully resolved to '{1}'. ========\" },\n        Module_name_0_was_not_resolved: { code: 6090, category: ts.DiagnosticCategory.Message, key: \"Module_name_0_was_not_resolved_6090\", message: \"======== Module name '{0}' was not resolved. ========\" },\n        paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0: { code: 6091, category: ts.DiagnosticCategory.Message, key: \"paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091\", message: \"'paths' option is specified, looking for a pattern to match module name '{0}'.\" },\n        Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: \"Module_name_0_matched_pattern_1_6092\", message: \"Module name '{0}', matched pattern '{1}'.\" },\n        Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: \"Trying_substitution_0_candidate_module_location_Colon_1_6093\", message: \"Trying substitution '{0}', candidate module location: '{1}'.\" },\n        Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: \"Resolving_module_name_0_relative_to_base_url_1_2_6094\", message: \"Resolving module name '{0}' relative to base url '{1}' - '{2}'.\" },\n        Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: \"Loading_module_as_file_Slash_folder_candidate_module_location_0_6095\", message: \"Loading module as file / folder, candidate module location '{0}'.\" },\n        File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: \"File_0_does_not_exist_6096\", message: \"File '{0}' does not exist.\" },\n        File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: \"File_0_exist_use_it_as_a_name_resolution_result_6097\", message: \"File '{0}' exist - use it as a name resolution result.\" },\n        Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: \"Loading_module_0_from_node_modules_folder_6098\", message: \"Loading module '{0}' from 'node_modules' folder.\" },\n        Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: \"Found_package_json_at_0_6099\", message: \"Found 'package.json' at '{0}'.\" },\n        package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: \"package_json_does_not_have_a_types_or_main_field_6100\", message: \"'package.json' does not have a 'types' or 'main' field.\" },\n        package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: \"package_json_has_0_field_1_that_references_2_6101\", message: \"'package.json' has '{0}' field '{1}' that references '{2}'.\" },\n        Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: \"Allow_javascript_files_to_be_compiled_6102\", message: \"Allow javascript files to be compiled.\" },\n        Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: \"Option_0_should_have_array_of_strings_as_a_value_6103\", message: \"Option '{0}' should have array of strings as a value.\" },\n        Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: \"Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104\", message: \"Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'.\" },\n        Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: \"Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105\", message: \"Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'.\" },\n        baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: \"baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106\", message: \"'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'\" },\n        rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: \"rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107\", message: \"'rootDirs' option is set, using it to resolve relative module name '{0}'\" },\n        Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: \"Longest_matching_prefix_for_0_is_1_6108\", message: \"Longest matching prefix for '{0}' is '{1}'\" },\n        Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: \"Loading_0_from_the_root_dir_1_candidate_location_2_6109\", message: \"Loading '{0}' from the root dir '{1}', candidate location '{2}'\" },\n        Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: \"Trying_other_entries_in_rootDirs_6110\", message: \"Trying other entries in 'rootDirs'\" },\n        Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: \"Module_resolution_using_rootDirs_has_failed_6111\", message: \"Module resolution using 'rootDirs' has failed\" },\n        Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: \"Do_not_emit_use_strict_directives_in_module_output_6112\", message: \"Do not emit 'use strict' directives in module output.\" },\n        Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: \"Enable_strict_null_checks_6113\", message: \"Enable strict null checks.\" },\n        Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: \"Unknown_option_excludes_Did_you_mean_exclude_6114\", message: \"Unknown option 'excludes'. Did you mean 'exclude'?\" },\n        Raise_error_on_this_expressions_with_an_implied_any_type: { code: 6115, category: ts.DiagnosticCategory.Message, key: \"Raise_error_on_this_expressions_with_an_implied_any_type_6115\", message: \"Raise error on 'this' expressions with an implied 'any' type.\" },\n        Resolving_type_reference_directive_0_containing_file_1_root_directory_2: { code: 6116, category: ts.DiagnosticCategory.Message, key: \"Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116\", message: \"======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========\" },\n        Resolving_using_primary_search_paths: { code: 6117, category: ts.DiagnosticCategory.Message, key: \"Resolving_using_primary_search_paths_6117\", message: \"Resolving using primary search paths...\" },\n        Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: \"Resolving_from_node_modules_folder_6118\", message: \"Resolving from node_modules folder...\" },\n        Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: \"Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119\", message: \"======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========\" },\n        Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: \"Type_reference_directive_0_was_not_resolved_6120\", message: \"======== Type reference directive '{0}' was not resolved. ========\" },\n        Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: \"Resolving_with_primary_search_path_0_6121\", message: \"Resolving with primary search path '{0}'\" },\n        Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: \"Root_directory_cannot_be_determined_skipping_primary_search_paths_6122\", message: \"Root directory cannot be determined, skipping primary search paths.\" },\n        Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: \"Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123\", message: \"======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========\" },\n        Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: \"Type_declaration_files_to_be_included_in_compilation_6124\", message: \"Type declaration files to be included in compilation.\" },\n        Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: \"Looking_up_in_node_modules_folder_initial_location_0_6125\", message: \"Looking up in 'node_modules' folder, initial location '{0}'\" },\n        Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: \"Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126\", message: \"Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder.\" },\n        Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: \"Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127\", message: \"======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========\" },\n        Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: \"Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128\", message: \"======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========\" },\n        The_config_file_0_found_doesn_t_contain_any_source_files: { code: 6129, category: ts.DiagnosticCategory.Error, key: \"The_config_file_0_found_doesn_t_contain_any_source_files_6129\", message: \"The config file '{0}' found doesn't contain any source files.\" },\n        Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: \"Resolving_real_path_for_0_result_1_6130\", message: \"Resolving real path for '{0}', result '{1}'\" },\n        Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: \"Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131\", message: \"Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'.\" },\n        File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: \"File_name_0_has_a_1_extension_stripping_it_6132\", message: \"File name '{0}' has a '{1}' extension - stripping it\" },\n        _0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: \"_0_is_declared_but_never_used_6133\", message: \"'{0}' is declared but never used.\" },\n        Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: \"Report_errors_on_unused_locals_6134\", message: \"Report errors on unused locals.\" },\n        Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: \"Report_errors_on_unused_parameters_6135\", message: \"Report errors on unused parameters.\" },\n        The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: \"The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136\", message: \"The maximum dependency depth to search under node_modules and load JavaScript files\" },\n        No_types_specified_in_package_json_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: \"No_types_specified_in_package_json_so_returning_main_value_of_0_6137\", message: \"No types specified in 'package.json', so returning 'main' value of '{0}'\" },\n        Property_0_is_declared_but_never_used: { code: 6138, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_declared_but_never_used_6138\", message: \"Property '{0}' is declared but never used.\" },\n        Import_emit_helpers_from_tslib: { code: 6139, category: ts.DiagnosticCategory.Message, key: \"Import_emit_helpers_from_tslib_6139\", message: \"Import emit helpers from 'tslib'.\" },\n        Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: { code: 6140, category: ts.DiagnosticCategory.Error, key: \"Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140\", message: \"Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'.\" },\n        Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: \"Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141\", message: \"Parse in strict mode and emit \\\"use strict\\\" for each source file\" },\n        Module_0_was_resolved_to_1_but_jsx_is_not_set: { code: 6142, category: ts.DiagnosticCategory.Error, key: \"Module_0_was_resolved_to_1_but_jsx_is_not_set_6142\", message: \"Module '{0}' was resolved to '{1}', but '--jsx' is not set.\" },\n        Module_0_was_resolved_to_1_but_allowJs_is_not_set: { code: 6143, category: ts.DiagnosticCategory.Error, key: \"Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143\", message: \"Module '{0}' was resolved to '{1}', but '--allowJs' is not set.\" },\n        Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: \"Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144\", message: \"Module '{0}' was resolved as locally declared ambient module in file '{1}'.\" },\n        Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: \"Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145\", message: \"Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified.\" },\n        Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: \"Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146\", message: \"Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'.\" },\n        Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: \"Variable_0_implicitly_has_an_1_type_7005\", message: \"Variable '{0}' implicitly has an '{1}' type.\" },\n        Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_implicitly_has_an_1_type_7006\", message: \"Parameter '{0}' implicitly has an '{1}' type.\" },\n        Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: \"Member_0_implicitly_has_an_1_type_7008\", message: \"Member '{0}' implicitly has an '{1}' type.\" },\n        new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: ts.DiagnosticCategory.Error, key: \"new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009\", message: \"'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.\" },\n        _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: ts.DiagnosticCategory.Error, key: \"_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010\", message: \"'{0}', which lacks return-type annotation, implicitly has an '{1}' return type.\" },\n        Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: ts.DiagnosticCategory.Error, key: \"Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011\", message: \"Function expression, which lacks return-type annotation, implicitly has an '{0}' return type.\" },\n        Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: ts.DiagnosticCategory.Error, key: \"Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013\", message: \"Construct signature, which lacks return-type annotation, implicitly has an 'any' return type.\" },\n        Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: { code: 7015, category: ts.DiagnosticCategory.Error, key: \"Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015\", message: \"Element implicitly has an 'any' type because index expression is not of type 'number'.\" },\n        Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type: { code: 7016, category: ts.DiagnosticCategory.Error, key: \"Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type_7016\", message: \"Could not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type.\" },\n        Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature: { code: 7017, category: ts.DiagnosticCategory.Error, key: \"Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017\", message: \"Element implicitly has an 'any' type because type '{0}' has no index signature.\" },\n        Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: \"Object_literal_s_property_0_implicitly_has_an_1_type_7018\", message: \"Object literal's property '{0}' implicitly has an '{1}' type.\" },\n        Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: \"Rest_parameter_0_implicitly_has_an_any_type_7019\", message: \"Rest parameter '{0}' implicitly has an 'any[]' type.\" },\n        Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: \"Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020\", message: \"Call signature, which lacks return-type annotation, implicitly has an 'any' return type.\" },\n        _0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: \"_0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or__7022\", message: \"'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.\" },\n        _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: \"_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023\", message: \"'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.\" },\n        Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: \"Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024\", message: \"Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.\" },\n        Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: ts.DiagnosticCategory.Error, key: \"Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025\", message: \"Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type.\" },\n        JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: \"JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026\", message: \"JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists\" },\n        Unreachable_code_detected: { code: 7027, category: ts.DiagnosticCategory.Error, key: \"Unreachable_code_detected_7027\", message: \"Unreachable code detected.\" },\n        Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: \"Unused_label_7028\", message: \"Unused label.\" },\n        Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: \"Fallthrough_case_in_switch_7029\", message: \"Fallthrough case in switch.\" },\n        Not_all_code_paths_return_a_value: { code: 7030, category: ts.DiagnosticCategory.Error, key: \"Not_all_code_paths_return_a_value_7030\", message: \"Not all code paths return a value.\" },\n        Binding_element_0_implicitly_has_an_1_type: { code: 7031, category: ts.DiagnosticCategory.Error, key: \"Binding_element_0_implicitly_has_an_1_type_7031\", message: \"Binding element '{0}' implicitly has an '{1}' type.\" },\n        Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation: { code: 7032, category: ts.DiagnosticCategory.Error, key: \"Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation_7032\", message: \"Property '{0}' implicitly has type 'any', because its set accessor lacks a parameter type annotation.\" },\n        Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation: { code: 7033, category: ts.DiagnosticCategory.Error, key: \"Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation_7033\", message: \"Property '{0}' implicitly has type 'any', because its get accessor lacks a return type annotation.\" },\n        Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined: { code: 7034, category: ts.DiagnosticCategory.Error, key: \"Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined_7034\", message: \"Variable '{0}' implicitly has type '{1}' in some locations where its type cannot be determined.\" },\n        You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: \"You_cannot_rename_this_element_8000\", message: \"You cannot rename this element.\" },\n        You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: \"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001\", message: \"You cannot rename elements that are defined in the standard TypeScript library.\" },\n        import_can_only_be_used_in_a_ts_file: { code: 8002, category: ts.DiagnosticCategory.Error, key: \"import_can_only_be_used_in_a_ts_file_8002\", message: \"'import ... =' can only be used in a .ts file.\" },\n        export_can_only_be_used_in_a_ts_file: { code: 8003, category: ts.DiagnosticCategory.Error, key: \"export_can_only_be_used_in_a_ts_file_8003\", message: \"'export=' can only be used in a .ts file.\" },\n        type_parameter_declarations_can_only_be_used_in_a_ts_file: { code: 8004, category: ts.DiagnosticCategory.Error, key: \"type_parameter_declarations_can_only_be_used_in_a_ts_file_8004\", message: \"'type parameter declarations' can only be used in a .ts file.\" },\n        implements_clauses_can_only_be_used_in_a_ts_file: { code: 8005, category: ts.DiagnosticCategory.Error, key: \"implements_clauses_can_only_be_used_in_a_ts_file_8005\", message: \"'implements clauses' can only be used in a .ts file.\" },\n        interface_declarations_can_only_be_used_in_a_ts_file: { code: 8006, category: ts.DiagnosticCategory.Error, key: \"interface_declarations_can_only_be_used_in_a_ts_file_8006\", message: \"'interface declarations' can only be used in a .ts file.\" },\n        module_declarations_can_only_be_used_in_a_ts_file: { code: 8007, category: ts.DiagnosticCategory.Error, key: \"module_declarations_can_only_be_used_in_a_ts_file_8007\", message: \"'module declarations' can only be used in a .ts file.\" },\n        type_aliases_can_only_be_used_in_a_ts_file: { code: 8008, category: ts.DiagnosticCategory.Error, key: \"type_aliases_can_only_be_used_in_a_ts_file_8008\", message: \"'type aliases' can only be used in a .ts file.\" },\n        _0_can_only_be_used_in_a_ts_file: { code: 8009, category: ts.DiagnosticCategory.Error, key: \"_0_can_only_be_used_in_a_ts_file_8009\", message: \"'{0}' can only be used in a .ts file.\" },\n        types_can_only_be_used_in_a_ts_file: { code: 8010, category: ts.DiagnosticCategory.Error, key: \"types_can_only_be_used_in_a_ts_file_8010\", message: \"'types' can only be used in a .ts file.\" },\n        type_arguments_can_only_be_used_in_a_ts_file: { code: 8011, category: ts.DiagnosticCategory.Error, key: \"type_arguments_can_only_be_used_in_a_ts_file_8011\", message: \"'type arguments' can only be used in a .ts file.\" },\n        parameter_modifiers_can_only_be_used_in_a_ts_file: { code: 8012, category: ts.DiagnosticCategory.Error, key: \"parameter_modifiers_can_only_be_used_in_a_ts_file_8012\", message: \"'parameter modifiers' can only be used in a .ts file.\" },\n        enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: ts.DiagnosticCategory.Error, key: \"enum_declarations_can_only_be_used_in_a_ts_file_8015\", message: \"'enum declarations' can only be used in a .ts file.\" },\n        type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: \"type_assertion_expressions_can_only_be_used_in_a_ts_file_8016\", message: \"'type assertion expressions' can only be used in a .ts file.\" },\n        Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: \"Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002\", message: \"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.\" },\n        class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: \"class_expressions_are_not_currently_supported_9003\", message: \"'class' expressions are not currently supported.\" },\n        Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: \"Language_service_is_disabled_9004\", message: \"Language service is disabled.\" },\n        JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: \"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000\", message: \"JSX attributes must only be assigned a non-empty 'expression'.\" },\n        JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: ts.DiagnosticCategory.Error, key: \"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001\", message: \"JSX elements cannot have multiple attributes with the same name.\" },\n        Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: \"Expected_corresponding_JSX_closing_tag_for_0_17002\", message: \"Expected corresponding JSX closing tag for '{0}'.\" },\n        JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: \"JSX_attribute_expected_17003\", message: \"JSX attribute expected.\" },\n        Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: \"Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004\", message: \"Cannot use JSX unless the '--jsx' flag is provided.\" },\n        A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: \"A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005\", message: \"A constructor cannot contain a 'super' call when its class extends 'null'\" },\n        An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: \"An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006\", message: \"An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.\" },\n        A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: \"A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007\", message: \"A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.\" },\n        JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: \"JSX_element_0_has_no_corresponding_closing_tag_17008\", message: \"JSX element '{0}' has no corresponding closing tag.\" },\n        super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: \"super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009\", message: \"'super' must be called before accessing 'this' in the constructor of a derived class.\" },\n        Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: \"Unknown_type_acquisition_option_0_17010\", message: \"Unknown type acquisition option '{0}'.\" },\n        Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: \"Circularity_detected_while_resolving_configuration_Colon_0_18000\", message: \"Circularity detected while resolving configuration: {0}\" },\n        A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: \"A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001\", message: \"A path in an 'extends' option must be relative or rooted, but '{0}' is not.\" },\n        The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: \"The_files_list_in_config_file_0_is_empty_18002\", message: \"The 'files' list in config file '{0}' is empty.\" },\n        No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: \"No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003\", message: \"No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'.\" },\n        Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: \"Add_missing_super_call_90001\", message: \"Add missing 'super()' call.\" },\n        Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: \"Make_super_call_the_first_statement_in_the_constructor_90002\", message: \"Make 'super()' call the first statement in the constructor.\" },\n        Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: \"Change_extends_to_implements_90003\", message: \"Change 'extends' to 'implements'\" },\n        Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: \"Remove_unused_identifiers_90004\", message: \"Remove unused identifiers\" },\n        Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: \"Implement_interface_on_reference_90005\", message: \"Implement interface on reference\" },\n        Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: \"Implement_interface_on_class_90006\", message: \"Implement interface on class\" },\n        Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: \"Implement_inherited_abstract_class_90007\", message: \"Implement inherited abstract class\" },\n        Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: \"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009\", message: \"Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig\" },\n        Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010\", message: \"Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated.\" },\n        Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: \"Import_0_from_1_90013\", message: \"Import {0} from {1}\" },\n        Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: \"Change_0_to_1_90014\", message: \"Change {0} to {1}\" },\n        Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: \"Add_0_to_existing_import_declaration_from_1_90015\", message: \"Add {0} to existing import declaration from {1}\" },\n    };\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function tokenIsIdentifierOrKeyword(token) {\n        return token >= 70;\n    }\n    ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword;\n    var textToToken = ts.createMap({\n        \"abstract\": 116,\n        \"any\": 118,\n        \"as\": 117,\n        \"boolean\": 121,\n        \"break\": 71,\n        \"case\": 72,\n        \"catch\": 73,\n        \"class\": 74,\n        \"continue\": 76,\n        \"const\": 75,\n        \"constructor\": 122,\n        \"debugger\": 77,\n        \"declare\": 123,\n        \"default\": 78,\n        \"delete\": 79,\n        \"do\": 80,\n        \"else\": 81,\n        \"enum\": 82,\n        \"export\": 83,\n        \"extends\": 84,\n        \"false\": 85,\n        \"finally\": 86,\n        \"for\": 87,\n        \"from\": 138,\n        \"function\": 88,\n        \"get\": 124,\n        \"if\": 89,\n        \"implements\": 107,\n        \"import\": 90,\n        \"in\": 91,\n        \"instanceof\": 92,\n        \"interface\": 108,\n        \"is\": 125,\n        \"keyof\": 126,\n        \"let\": 109,\n        \"module\": 127,\n        \"namespace\": 128,\n        \"never\": 129,\n        \"new\": 93,\n        \"null\": 94,\n        \"number\": 132,\n        \"package\": 110,\n        \"private\": 111,\n        \"protected\": 112,\n        \"public\": 113,\n        \"readonly\": 130,\n        \"require\": 131,\n        \"global\": 139,\n        \"return\": 95,\n        \"set\": 133,\n        \"static\": 114,\n        \"string\": 134,\n        \"super\": 96,\n        \"switch\": 97,\n        \"symbol\": 135,\n        \"this\": 98,\n        \"throw\": 99,\n        \"true\": 100,\n        \"try\": 101,\n        \"type\": 136,\n        \"typeof\": 102,\n        \"undefined\": 137,\n        \"var\": 103,\n        \"void\": 104,\n        \"while\": 105,\n        \"with\": 106,\n        \"yield\": 115,\n        \"async\": 119,\n        \"await\": 120,\n        \"of\": 140,\n        \"{\": 16,\n        \"}\": 17,\n        \"(\": 18,\n        \")\": 19,\n        \"[\": 20,\n        \"]\": 21,\n        \".\": 22,\n        \"...\": 23,\n        \";\": 24,\n        \",\": 25,\n        \"<\": 26,\n        \">\": 28,\n        \"<=\": 29,\n        \">=\": 30,\n        \"==\": 31,\n        \"!=\": 32,\n        \"===\": 33,\n        \"!==\": 34,\n        \"=>\": 35,\n        \"+\": 36,\n        \"-\": 37,\n        \"**\": 39,\n        \"*\": 38,\n        \"/\": 40,\n        \"%\": 41,\n        \"++\": 42,\n        \"--\": 43,\n        \"<<\": 44,\n        \"</\": 27,\n        \">>\": 45,\n        \">>>\": 46,\n        \"&\": 47,\n        \"|\": 48,\n        \"^\": 49,\n        \"!\": 50,\n        \"~\": 51,\n        \"&&\": 52,\n        \"||\": 53,\n        \"?\": 54,\n        \":\": 55,\n        \"=\": 57,\n        \"+=\": 58,\n        \"-=\": 59,\n        \"*=\": 60,\n        \"**=\": 61,\n        \"/=\": 62,\n        \"%=\": 63,\n        \"<<=\": 64,\n        \">>=\": 65,\n        \">>>=\": 66,\n        \"&=\": 67,\n        \"|=\": 68,\n        \"^=\": 69,\n        \"@\": 56,\n    });\n    var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];\n    var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];\n    var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];\n    var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];\n    function lookupInUnicodeMap(code, map) {\n        if (code < map[0]) {\n            return false;\n        }\n        var lo = 0;\n        var hi = map.length;\n        var mid;\n        while (lo + 1 < hi) {\n            mid = lo + (hi - lo) / 2;\n            mid -= mid % 2;\n            if (map[mid] <= code && code <= map[mid + 1]) {\n                return true;\n            }\n            if (code < map[mid]) {\n                hi = mid;\n            }\n            else {\n                lo = mid + 2;\n            }\n        }\n        return false;\n    }\n    function isUnicodeIdentifierStart(code, languageVersion) {\n        return languageVersion >= 1 ?\n            lookupInUnicodeMap(code, unicodeES5IdentifierStart) :\n            lookupInUnicodeMap(code, unicodeES3IdentifierStart);\n    }\n    ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart;\n    function isUnicodeIdentifierPart(code, languageVersion) {\n        return languageVersion >= 1 ?\n            lookupInUnicodeMap(code, unicodeES5IdentifierPart) :\n            lookupInUnicodeMap(code, unicodeES3IdentifierPart);\n    }\n    function makeReverseMap(source) {\n        var result = [];\n        for (var name_4 in source) {\n            result[source[name_4]] = name_4;\n        }\n        return result;\n    }\n    var tokenStrings = makeReverseMap(textToToken);\n    function tokenToString(t) {\n        return tokenStrings[t];\n    }\n    ts.tokenToString = tokenToString;\n    function stringToToken(s) {\n        return textToToken[s];\n    }\n    ts.stringToToken = stringToToken;\n    function computeLineStarts(text) {\n        var result = new Array();\n        var pos = 0;\n        var lineStart = 0;\n        while (pos < text.length) {\n            var ch = text.charCodeAt(pos);\n            pos++;\n            switch (ch) {\n                case 13:\n                    if (text.charCodeAt(pos) === 10) {\n                        pos++;\n                    }\n                case 10:\n                    result.push(lineStart);\n                    lineStart = pos;\n                    break;\n                default:\n                    if (ch > 127 && isLineBreak(ch)) {\n                        result.push(lineStart);\n                        lineStart = pos;\n                    }\n                    break;\n            }\n        }\n        result.push(lineStart);\n        return result;\n    }\n    ts.computeLineStarts = computeLineStarts;\n    function getPositionOfLineAndCharacter(sourceFile, line, character) {\n        return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character);\n    }\n    ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter;\n    function computePositionOfLineAndCharacter(lineStarts, line, character) {\n        ts.Debug.assert(line >= 0 && line < lineStarts.length);\n        return lineStarts[line] + character;\n    }\n    ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter;\n    function getLineStarts(sourceFile) {\n        return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text));\n    }\n    ts.getLineStarts = getLineStarts;\n    function computeLineAndCharacterOfPosition(lineStarts, position) {\n        var lineNumber = ts.binarySearch(lineStarts, position);\n        if (lineNumber < 0) {\n            lineNumber = ~lineNumber - 1;\n            ts.Debug.assert(lineNumber !== -1, \"position cannot precede the beginning of the file\");\n        }\n        return {\n            line: lineNumber,\n            character: position - lineStarts[lineNumber]\n        };\n    }\n    ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition;\n    function getLineAndCharacterOfPosition(sourceFile, position) {\n        return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position);\n    }\n    ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition;\n    var hasOwnProperty = Object.prototype.hasOwnProperty;\n    function isWhiteSpace(ch) {\n        return isWhiteSpaceSingleLine(ch) || isLineBreak(ch);\n    }\n    ts.isWhiteSpace = isWhiteSpace;\n    function isWhiteSpaceSingleLine(ch) {\n        return ch === 32 ||\n            ch === 9 ||\n            ch === 11 ||\n            ch === 12 ||\n            ch === 160 ||\n            ch === 133 ||\n            ch === 5760 ||\n            ch >= 8192 && ch <= 8203 ||\n            ch === 8239 ||\n            ch === 8287 ||\n            ch === 12288 ||\n            ch === 65279;\n    }\n    ts.isWhiteSpaceSingleLine = isWhiteSpaceSingleLine;\n    function isLineBreak(ch) {\n        return ch === 10 ||\n            ch === 13 ||\n            ch === 8232 ||\n            ch === 8233;\n    }\n    ts.isLineBreak = isLineBreak;\n    function isDigit(ch) {\n        return ch >= 48 && ch <= 57;\n    }\n    function isOctalDigit(ch) {\n        return ch >= 48 && ch <= 55;\n    }\n    ts.isOctalDigit = isOctalDigit;\n    function couldStartTrivia(text, pos) {\n        var ch = text.charCodeAt(pos);\n        switch (ch) {\n            case 13:\n            case 10:\n            case 9:\n            case 11:\n            case 12:\n            case 32:\n            case 47:\n            case 60:\n            case 61:\n            case 62:\n                return true;\n            case 35:\n                return pos === 0;\n            default:\n                return ch > 127;\n        }\n    }\n    ts.couldStartTrivia = couldStartTrivia;\n    function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments) {\n        if (stopAtComments === void 0) { stopAtComments = false; }\n        if (ts.positionIsSynthesized(pos)) {\n            return pos;\n        }\n        while (true) {\n            var ch = text.charCodeAt(pos);\n            switch (ch) {\n                case 13:\n                    if (text.charCodeAt(pos + 1) === 10) {\n                        pos++;\n                    }\n                case 10:\n                    pos++;\n                    if (stopAfterLineBreak) {\n                        return pos;\n                    }\n                    continue;\n                case 9:\n                case 11:\n                case 12:\n                case 32:\n                    pos++;\n                    continue;\n                case 47:\n                    if (stopAtComments) {\n                        break;\n                    }\n                    if (text.charCodeAt(pos + 1) === 47) {\n                        pos += 2;\n                        while (pos < text.length) {\n                            if (isLineBreak(text.charCodeAt(pos))) {\n                                break;\n                            }\n                            pos++;\n                        }\n                        continue;\n                    }\n                    if (text.charCodeAt(pos + 1) === 42) {\n                        pos += 2;\n                        while (pos < text.length) {\n                            if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) {\n                                pos += 2;\n                                break;\n                            }\n                            pos++;\n                        }\n                        continue;\n                    }\n                    break;\n                case 60:\n                case 61:\n                case 62:\n                    if (isConflictMarkerTrivia(text, pos)) {\n                        pos = scanConflictMarkerTrivia(text, pos);\n                        continue;\n                    }\n                    break;\n                case 35:\n                    if (pos === 0 && isShebangTrivia(text, pos)) {\n                        pos = scanShebangTrivia(text, pos);\n                        continue;\n                    }\n                    break;\n                default:\n                    if (ch > 127 && (isWhiteSpace(ch))) {\n                        pos++;\n                        continue;\n                    }\n                    break;\n            }\n            return pos;\n        }\n    }\n    ts.skipTrivia = skipTrivia;\n    var mergeConflictMarkerLength = \"<<<<<<<\".length;\n    function isConflictMarkerTrivia(text, pos) {\n        ts.Debug.assert(pos >= 0);\n        if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) {\n            var ch = text.charCodeAt(pos);\n            if ((pos + mergeConflictMarkerLength) < text.length) {\n                for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) {\n                    if (text.charCodeAt(pos + i) !== ch) {\n                        return false;\n                    }\n                }\n                return ch === 61 ||\n                    text.charCodeAt(pos + mergeConflictMarkerLength) === 32;\n            }\n        }\n        return false;\n    }\n    function scanConflictMarkerTrivia(text, pos, error) {\n        if (error) {\n            error(ts.Diagnostics.Merge_conflict_marker_encountered, mergeConflictMarkerLength);\n        }\n        var ch = text.charCodeAt(pos);\n        var len = text.length;\n        if (ch === 60 || ch === 62) {\n            while (pos < len && !isLineBreak(text.charCodeAt(pos))) {\n                pos++;\n            }\n        }\n        else {\n            ts.Debug.assert(ch === 61);\n            while (pos < len) {\n                var ch_1 = text.charCodeAt(pos);\n                if (ch_1 === 62 && isConflictMarkerTrivia(text, pos)) {\n                    break;\n                }\n                pos++;\n            }\n        }\n        return pos;\n    }\n    var shebangTriviaRegex = /^#!.*/;\n    function isShebangTrivia(text, pos) {\n        ts.Debug.assert(pos === 0);\n        return shebangTriviaRegex.test(text);\n    }\n    function scanShebangTrivia(text, pos) {\n        var shebang = shebangTriviaRegex.exec(text)[0];\n        pos = pos + shebang.length;\n        return pos;\n    }\n    function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) {\n        var pendingPos;\n        var pendingEnd;\n        var pendingKind;\n        var pendingHasTrailingNewLine;\n        var hasPendingCommentRange = false;\n        var collecting = trailing || pos === 0;\n        var accumulator = initial;\n        scan: while (pos >= 0 && pos < text.length) {\n            var ch = text.charCodeAt(pos);\n            switch (ch) {\n                case 13:\n                    if (text.charCodeAt(pos + 1) === 10) {\n                        pos++;\n                    }\n                case 10:\n                    pos++;\n                    if (trailing) {\n                        break scan;\n                    }\n                    collecting = true;\n                    if (hasPendingCommentRange) {\n                        pendingHasTrailingNewLine = true;\n                    }\n                    continue;\n                case 9:\n                case 11:\n                case 12:\n                case 32:\n                    pos++;\n                    continue;\n                case 47:\n                    var nextChar = text.charCodeAt(pos + 1);\n                    var hasTrailingNewLine = false;\n                    if (nextChar === 47 || nextChar === 42) {\n                        var kind = nextChar === 47 ? 2 : 3;\n                        var startPos = pos;\n                        pos += 2;\n                        if (nextChar === 47) {\n                            while (pos < text.length) {\n                                if (isLineBreak(text.charCodeAt(pos))) {\n                                    hasTrailingNewLine = true;\n                                    break;\n                                }\n                                pos++;\n                            }\n                        }\n                        else {\n                            while (pos < text.length) {\n                                if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) {\n                                    pos += 2;\n                                    break;\n                                }\n                                pos++;\n                            }\n                        }\n                        if (collecting) {\n                            if (hasPendingCommentRange) {\n                                accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator);\n                                if (!reduce && accumulator) {\n                                    return accumulator;\n                                }\n                                hasPendingCommentRange = false;\n                            }\n                            pendingPos = startPos;\n                            pendingEnd = pos;\n                            pendingKind = kind;\n                            pendingHasTrailingNewLine = hasTrailingNewLine;\n                            hasPendingCommentRange = true;\n                        }\n                        continue;\n                    }\n                    break scan;\n                default:\n                    if (ch > 127 && (isWhiteSpace(ch))) {\n                        if (hasPendingCommentRange && isLineBreak(ch)) {\n                            pendingHasTrailingNewLine = true;\n                        }\n                        pos++;\n                        continue;\n                    }\n                    break scan;\n            }\n        }\n        if (hasPendingCommentRange) {\n            accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator);\n        }\n        return accumulator;\n    }\n    function forEachLeadingCommentRange(text, pos, cb, state) {\n        return iterateCommentRanges(false, text, pos, false, cb, state);\n    }\n    ts.forEachLeadingCommentRange = forEachLeadingCommentRange;\n    function forEachTrailingCommentRange(text, pos, cb, state) {\n        return iterateCommentRanges(false, text, pos, true, cb, state);\n    }\n    ts.forEachTrailingCommentRange = forEachTrailingCommentRange;\n    function reduceEachLeadingCommentRange(text, pos, cb, state, initial) {\n        return iterateCommentRanges(true, text, pos, false, cb, state, initial);\n    }\n    ts.reduceEachLeadingCommentRange = reduceEachLeadingCommentRange;\n    function reduceEachTrailingCommentRange(text, pos, cb, state, initial) {\n        return iterateCommentRanges(true, text, pos, true, cb, state, initial);\n    }\n    ts.reduceEachTrailingCommentRange = reduceEachTrailingCommentRange;\n    function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments) {\n        if (!comments) {\n            comments = [];\n        }\n        comments.push({ pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine, kind: kind });\n        return comments;\n    }\n    function getLeadingCommentRanges(text, pos) {\n        return reduceEachLeadingCommentRange(text, pos, appendCommentRange, undefined, undefined);\n    }\n    ts.getLeadingCommentRanges = getLeadingCommentRanges;\n    function getTrailingCommentRanges(text, pos) {\n        return reduceEachTrailingCommentRange(text, pos, appendCommentRange, undefined, undefined);\n    }\n    ts.getTrailingCommentRanges = getTrailingCommentRanges;\n    function getShebang(text) {\n        return shebangTriviaRegex.test(text)\n            ? shebangTriviaRegex.exec(text)[0]\n            : undefined;\n    }\n    ts.getShebang = getShebang;\n    function isIdentifierStart(ch, languageVersion) {\n        return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 ||\n            ch === 36 || ch === 95 ||\n            ch > 127 && isUnicodeIdentifierStart(ch, languageVersion);\n    }\n    ts.isIdentifierStart = isIdentifierStart;\n    function isIdentifierPart(ch, languageVersion) {\n        return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 ||\n            ch >= 48 && ch <= 57 || ch === 36 || ch === 95 ||\n            ch > 127 && isUnicodeIdentifierPart(ch, languageVersion);\n    }\n    ts.isIdentifierPart = isIdentifierPart;\n    function isIdentifierText(name, languageVersion) {\n        if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) {\n            return false;\n        }\n        for (var i = 1, n = name.length; i < n; i++) {\n            if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) {\n                return false;\n            }\n        }\n        return true;\n    }\n    ts.isIdentifierText = isIdentifierText;\n    function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) {\n        if (languageVariant === void 0) { languageVariant = 0; }\n        var pos;\n        var end;\n        var startPos;\n        var tokenPos;\n        var token;\n        var tokenValue;\n        var precedingLineBreak;\n        var hasExtendedUnicodeEscape;\n        var tokenIsUnterminated;\n        setText(text, start, length);\n        return {\n            getStartPos: function () { return startPos; },\n            getTextPos: function () { return pos; },\n            getToken: function () { return token; },\n            getTokenPos: function () { return tokenPos; },\n            getTokenText: function () { return text.substring(tokenPos, pos); },\n            getTokenValue: function () { return tokenValue; },\n            hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; },\n            hasPrecedingLineBreak: function () { return precedingLineBreak; },\n            isIdentifier: function () { return token === 70 || token > 106; },\n            isReservedWord: function () { return token >= 71 && token <= 106; },\n            isUnterminated: function () { return tokenIsUnterminated; },\n            reScanGreaterToken: reScanGreaterToken,\n            reScanSlashToken: reScanSlashToken,\n            reScanTemplateToken: reScanTemplateToken,\n            scanJsxIdentifier: scanJsxIdentifier,\n            scanJsxAttributeValue: scanJsxAttributeValue,\n            reScanJsxToken: reScanJsxToken,\n            scanJsxToken: scanJsxToken,\n            scanJSDocToken: scanJSDocToken,\n            scan: scan,\n            getText: getText,\n            setText: setText,\n            setScriptTarget: setScriptTarget,\n            setLanguageVariant: setLanguageVariant,\n            setOnError: setOnError,\n            setTextPos: setTextPos,\n            tryScan: tryScan,\n            lookAhead: lookAhead,\n            scanRange: scanRange,\n        };\n        function error(message, length) {\n            if (onError) {\n                onError(message, length || 0);\n            }\n        }\n        function scanNumber() {\n            var start = pos;\n            while (isDigit(text.charCodeAt(pos)))\n                pos++;\n            if (text.charCodeAt(pos) === 46) {\n                pos++;\n                while (isDigit(text.charCodeAt(pos)))\n                    pos++;\n            }\n            var end = pos;\n            if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) {\n                pos++;\n                if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45)\n                    pos++;\n                if (isDigit(text.charCodeAt(pos))) {\n                    pos++;\n                    while (isDigit(text.charCodeAt(pos)))\n                        pos++;\n                    end = pos;\n                }\n                else {\n                    error(ts.Diagnostics.Digit_expected);\n                }\n            }\n            return \"\" + +(text.substring(start, end));\n        }\n        function scanOctalDigits() {\n            var start = pos;\n            while (isOctalDigit(text.charCodeAt(pos))) {\n                pos++;\n            }\n            return +(text.substring(start, pos));\n        }\n        function scanExactNumberOfHexDigits(count) {\n            return scanHexDigits(count, false);\n        }\n        function scanMinimumNumberOfHexDigits(count) {\n            return scanHexDigits(count, true);\n        }\n        function scanHexDigits(minCount, scanAsManyAsPossible) {\n            var digits = 0;\n            var value = 0;\n            while (digits < minCount || scanAsManyAsPossible) {\n                var ch = text.charCodeAt(pos);\n                if (ch >= 48 && ch <= 57) {\n                    value = value * 16 + ch - 48;\n                }\n                else if (ch >= 65 && ch <= 70) {\n                    value = value * 16 + ch - 65 + 10;\n                }\n                else if (ch >= 97 && ch <= 102) {\n                    value = value * 16 + ch - 97 + 10;\n                }\n                else {\n                    break;\n                }\n                pos++;\n                digits++;\n            }\n            if (digits < minCount) {\n                value = -1;\n            }\n            return value;\n        }\n        function scanString(allowEscapes) {\n            if (allowEscapes === void 0) { allowEscapes = true; }\n            var quote = text.charCodeAt(pos);\n            pos++;\n            var result = \"\";\n            var start = pos;\n            while (true) {\n                if (pos >= end) {\n                    result += text.substring(start, pos);\n                    tokenIsUnterminated = true;\n                    error(ts.Diagnostics.Unterminated_string_literal);\n                    break;\n                }\n                var ch = text.charCodeAt(pos);\n                if (ch === quote) {\n                    result += text.substring(start, pos);\n                    pos++;\n                    break;\n                }\n                if (ch === 92 && allowEscapes) {\n                    result += text.substring(start, pos);\n                    result += scanEscapeSequence();\n                    start = pos;\n                    continue;\n                }\n                if (isLineBreak(ch)) {\n                    result += text.substring(start, pos);\n                    tokenIsUnterminated = true;\n                    error(ts.Diagnostics.Unterminated_string_literal);\n                    break;\n                }\n                pos++;\n            }\n            return result;\n        }\n        function scanTemplateAndSetTokenValue() {\n            var startedWithBacktick = text.charCodeAt(pos) === 96;\n            pos++;\n            var start = pos;\n            var contents = \"\";\n            var resultingToken;\n            while (true) {\n                if (pos >= end) {\n                    contents += text.substring(start, pos);\n                    tokenIsUnterminated = true;\n                    error(ts.Diagnostics.Unterminated_template_literal);\n                    resultingToken = startedWithBacktick ? 12 : 15;\n                    break;\n                }\n                var currChar = text.charCodeAt(pos);\n                if (currChar === 96) {\n                    contents += text.substring(start, pos);\n                    pos++;\n                    resultingToken = startedWithBacktick ? 12 : 15;\n                    break;\n                }\n                if (currChar === 36 && pos + 1 < end && text.charCodeAt(pos + 1) === 123) {\n                    contents += text.substring(start, pos);\n                    pos += 2;\n                    resultingToken = startedWithBacktick ? 13 : 14;\n                    break;\n                }\n                if (currChar === 92) {\n                    contents += text.substring(start, pos);\n                    contents += scanEscapeSequence();\n                    start = pos;\n                    continue;\n                }\n                if (currChar === 13) {\n                    contents += text.substring(start, pos);\n                    pos++;\n                    if (pos < end && text.charCodeAt(pos) === 10) {\n                        pos++;\n                    }\n                    contents += \"\\n\";\n                    start = pos;\n                    continue;\n                }\n                pos++;\n            }\n            ts.Debug.assert(resultingToken !== undefined);\n            tokenValue = contents;\n            return resultingToken;\n        }\n        function scanEscapeSequence() {\n            pos++;\n            if (pos >= end) {\n                error(ts.Diagnostics.Unexpected_end_of_text);\n                return \"\";\n            }\n            var ch = text.charCodeAt(pos);\n            pos++;\n            switch (ch) {\n                case 48:\n                    return \"\\0\";\n                case 98:\n                    return \"\\b\";\n                case 116:\n                    return \"\\t\";\n                case 110:\n                    return \"\\n\";\n                case 118:\n                    return \"\\v\";\n                case 102:\n                    return \"\\f\";\n                case 114:\n                    return \"\\r\";\n                case 39:\n                    return \"\\'\";\n                case 34:\n                    return \"\\\"\";\n                case 117:\n                    if (pos < end && text.charCodeAt(pos) === 123) {\n                        hasExtendedUnicodeEscape = true;\n                        pos++;\n                        return scanExtendedUnicodeEscape();\n                    }\n                    return scanHexadecimalEscape(4);\n                case 120:\n                    return scanHexadecimalEscape(2);\n                case 13:\n                    if (pos < end && text.charCodeAt(pos) === 10) {\n                        pos++;\n                    }\n                case 10:\n                case 8232:\n                case 8233:\n                    return \"\";\n                default:\n                    return String.fromCharCode(ch);\n            }\n        }\n        function scanHexadecimalEscape(numDigits) {\n            var escapedValue = scanExactNumberOfHexDigits(numDigits);\n            if (escapedValue >= 0) {\n                return String.fromCharCode(escapedValue);\n            }\n            else {\n                error(ts.Diagnostics.Hexadecimal_digit_expected);\n                return \"\";\n            }\n        }\n        function scanExtendedUnicodeEscape() {\n            var escapedValue = scanMinimumNumberOfHexDigits(1);\n            var isInvalidExtendedEscape = false;\n            if (escapedValue < 0) {\n                error(ts.Diagnostics.Hexadecimal_digit_expected);\n                isInvalidExtendedEscape = true;\n            }\n            else if (escapedValue > 0x10FFFF) {\n                error(ts.Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);\n                isInvalidExtendedEscape = true;\n            }\n            if (pos >= end) {\n                error(ts.Diagnostics.Unexpected_end_of_text);\n                isInvalidExtendedEscape = true;\n            }\n            else if (text.charCodeAt(pos) === 125) {\n                pos++;\n            }\n            else {\n                error(ts.Diagnostics.Unterminated_Unicode_escape_sequence);\n                isInvalidExtendedEscape = true;\n            }\n            if (isInvalidExtendedEscape) {\n                return \"\";\n            }\n            return utf16EncodeAsString(escapedValue);\n        }\n        function utf16EncodeAsString(codePoint) {\n            ts.Debug.assert(0x0 <= codePoint && codePoint <= 0x10FFFF);\n            if (codePoint <= 65535) {\n                return String.fromCharCode(codePoint);\n            }\n            var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 0xD800;\n            var codeUnit2 = ((codePoint - 65536) % 1024) + 0xDC00;\n            return String.fromCharCode(codeUnit1, codeUnit2);\n        }\n        function peekUnicodeEscape() {\n            if (pos + 5 < end && text.charCodeAt(pos + 1) === 117) {\n                var start_1 = pos;\n                pos += 2;\n                var value = scanExactNumberOfHexDigits(4);\n                pos = start_1;\n                return value;\n            }\n            return -1;\n        }\n        function scanIdentifierParts() {\n            var result = \"\";\n            var start = pos;\n            while (pos < end) {\n                var ch = text.charCodeAt(pos);\n                if (isIdentifierPart(ch, languageVersion)) {\n                    pos++;\n                }\n                else if (ch === 92) {\n                    ch = peekUnicodeEscape();\n                    if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) {\n                        break;\n                    }\n                    result += text.substring(start, pos);\n                    result += String.fromCharCode(ch);\n                    pos += 6;\n                    start = pos;\n                }\n                else {\n                    break;\n                }\n            }\n            result += text.substring(start, pos);\n            return result;\n        }\n        function getIdentifierToken() {\n            var len = tokenValue.length;\n            if (len >= 2 && len <= 11) {\n                var ch = tokenValue.charCodeAt(0);\n                if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) {\n                    return token = textToToken[tokenValue];\n                }\n            }\n            return token = 70;\n        }\n        function scanBinaryOrOctalDigits(base) {\n            ts.Debug.assert(base === 2 || base === 8, \"Expected either base 2 or base 8\");\n            var value = 0;\n            var numberOfDigits = 0;\n            while (true) {\n                var ch = text.charCodeAt(pos);\n                var valueOfCh = ch - 48;\n                if (!isDigit(ch) || valueOfCh >= base) {\n                    break;\n                }\n                value = value * base + valueOfCh;\n                pos++;\n                numberOfDigits++;\n            }\n            if (numberOfDigits === 0) {\n                return -1;\n            }\n            return value;\n        }\n        function scan() {\n            startPos = pos;\n            hasExtendedUnicodeEscape = false;\n            precedingLineBreak = false;\n            tokenIsUnterminated = false;\n            while (true) {\n                tokenPos = pos;\n                if (pos >= end) {\n                    return token = 1;\n                }\n                var ch = text.charCodeAt(pos);\n                if (ch === 35 && pos === 0 && isShebangTrivia(text, pos)) {\n                    pos = scanShebangTrivia(text, pos);\n                    if (skipTrivia) {\n                        continue;\n                    }\n                    else {\n                        return token = 6;\n                    }\n                }\n                switch (ch) {\n                    case 10:\n                    case 13:\n                        precedingLineBreak = true;\n                        if (skipTrivia) {\n                            pos++;\n                            continue;\n                        }\n                        else {\n                            if (ch === 13 && pos + 1 < end && text.charCodeAt(pos + 1) === 10) {\n                                pos += 2;\n                            }\n                            else {\n                                pos++;\n                            }\n                            return token = 4;\n                        }\n                    case 9:\n                    case 11:\n                    case 12:\n                    case 32:\n                        if (skipTrivia) {\n                            pos++;\n                            continue;\n                        }\n                        else {\n                            while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) {\n                                pos++;\n                            }\n                            return token = 5;\n                        }\n                    case 33:\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            if (text.charCodeAt(pos + 2) === 61) {\n                                return pos += 3, token = 34;\n                            }\n                            return pos += 2, token = 32;\n                        }\n                        pos++;\n                        return token = 50;\n                    case 34:\n                    case 39:\n                        tokenValue = scanString();\n                        return token = 9;\n                    case 96:\n                        return token = scanTemplateAndSetTokenValue();\n                    case 37:\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 63;\n                        }\n                        pos++;\n                        return token = 41;\n                    case 38:\n                        if (text.charCodeAt(pos + 1) === 38) {\n                            return pos += 2, token = 52;\n                        }\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 67;\n                        }\n                        pos++;\n                        return token = 47;\n                    case 40:\n                        pos++;\n                        return token = 18;\n                    case 41:\n                        pos++;\n                        return token = 19;\n                    case 42:\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 60;\n                        }\n                        if (text.charCodeAt(pos + 1) === 42) {\n                            if (text.charCodeAt(pos + 2) === 61) {\n                                return pos += 3, token = 61;\n                            }\n                            return pos += 2, token = 39;\n                        }\n                        pos++;\n                        return token = 38;\n                    case 43:\n                        if (text.charCodeAt(pos + 1) === 43) {\n                            return pos += 2, token = 42;\n                        }\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 58;\n                        }\n                        pos++;\n                        return token = 36;\n                    case 44:\n                        pos++;\n                        return token = 25;\n                    case 45:\n                        if (text.charCodeAt(pos + 1) === 45) {\n                            return pos += 2, token = 43;\n                        }\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 59;\n                        }\n                        pos++;\n                        return token = 37;\n                    case 46:\n                        if (isDigit(text.charCodeAt(pos + 1))) {\n                            tokenValue = scanNumber();\n                            return token = 8;\n                        }\n                        if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) {\n                            return pos += 3, token = 23;\n                        }\n                        pos++;\n                        return token = 22;\n                    case 47:\n                        if (text.charCodeAt(pos + 1) === 47) {\n                            pos += 2;\n                            while (pos < end) {\n                                if (isLineBreak(text.charCodeAt(pos))) {\n                                    break;\n                                }\n                                pos++;\n                            }\n                            if (skipTrivia) {\n                                continue;\n                            }\n                            else {\n                                return token = 2;\n                            }\n                        }\n                        if (text.charCodeAt(pos + 1) === 42) {\n                            pos += 2;\n                            var commentClosed = false;\n                            while (pos < end) {\n                                var ch_2 = text.charCodeAt(pos);\n                                if (ch_2 === 42 && text.charCodeAt(pos + 1) === 47) {\n                                    pos += 2;\n                                    commentClosed = true;\n                                    break;\n                                }\n                                if (isLineBreak(ch_2)) {\n                                    precedingLineBreak = true;\n                                }\n                                pos++;\n                            }\n                            if (!commentClosed) {\n                                error(ts.Diagnostics.Asterisk_Slash_expected);\n                            }\n                            if (skipTrivia) {\n                                continue;\n                            }\n                            else {\n                                tokenIsUnterminated = !commentClosed;\n                                return token = 3;\n                            }\n                        }\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 62;\n                        }\n                        pos++;\n                        return token = 40;\n                    case 48:\n                        if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) {\n                            pos += 2;\n                            var value = scanMinimumNumberOfHexDigits(1);\n                            if (value < 0) {\n                                error(ts.Diagnostics.Hexadecimal_digit_expected);\n                                value = 0;\n                            }\n                            tokenValue = \"\" + value;\n                            return token = 8;\n                        }\n                        else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) {\n                            pos += 2;\n                            var value = scanBinaryOrOctalDigits(2);\n                            if (value < 0) {\n                                error(ts.Diagnostics.Binary_digit_expected);\n                                value = 0;\n                            }\n                            tokenValue = \"\" + value;\n                            return token = 8;\n                        }\n                        else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) {\n                            pos += 2;\n                            var value = scanBinaryOrOctalDigits(8);\n                            if (value < 0) {\n                                error(ts.Diagnostics.Octal_digit_expected);\n                                value = 0;\n                            }\n                            tokenValue = \"\" + value;\n                            return token = 8;\n                        }\n                        if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) {\n                            tokenValue = \"\" + scanOctalDigits();\n                            return token = 8;\n                        }\n                    case 49:\n                    case 50:\n                    case 51:\n                    case 52:\n                    case 53:\n                    case 54:\n                    case 55:\n                    case 56:\n                    case 57:\n                        tokenValue = scanNumber();\n                        return token = 8;\n                    case 58:\n                        pos++;\n                        return token = 55;\n                    case 59:\n                        pos++;\n                        return token = 24;\n                    case 60:\n                        if (isConflictMarkerTrivia(text, pos)) {\n                            pos = scanConflictMarkerTrivia(text, pos, error);\n                            if (skipTrivia) {\n                                continue;\n                            }\n                            else {\n                                return token = 7;\n                            }\n                        }\n                        if (text.charCodeAt(pos + 1) === 60) {\n                            if (text.charCodeAt(pos + 2) === 61) {\n                                return pos += 3, token = 64;\n                            }\n                            return pos += 2, token = 44;\n                        }\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 29;\n                        }\n                        if (languageVariant === 1 &&\n                            text.charCodeAt(pos + 1) === 47 &&\n                            text.charCodeAt(pos + 2) !== 42) {\n                            return pos += 2, token = 27;\n                        }\n                        pos++;\n                        return token = 26;\n                    case 61:\n                        if (isConflictMarkerTrivia(text, pos)) {\n                            pos = scanConflictMarkerTrivia(text, pos, error);\n                            if (skipTrivia) {\n                                continue;\n                            }\n                            else {\n                                return token = 7;\n                            }\n                        }\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            if (text.charCodeAt(pos + 2) === 61) {\n                                return pos += 3, token = 33;\n                            }\n                            return pos += 2, token = 31;\n                        }\n                        if (text.charCodeAt(pos + 1) === 62) {\n                            return pos += 2, token = 35;\n                        }\n                        pos++;\n                        return token = 57;\n                    case 62:\n                        if (isConflictMarkerTrivia(text, pos)) {\n                            pos = scanConflictMarkerTrivia(text, pos, error);\n                            if (skipTrivia) {\n                                continue;\n                            }\n                            else {\n                                return token = 7;\n                            }\n                        }\n                        pos++;\n                        return token = 28;\n                    case 63:\n                        pos++;\n                        return token = 54;\n                    case 91:\n                        pos++;\n                        return token = 20;\n                    case 93:\n                        pos++;\n                        return token = 21;\n                    case 94:\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 69;\n                        }\n                        pos++;\n                        return token = 49;\n                    case 123:\n                        pos++;\n                        return token = 16;\n                    case 124:\n                        if (text.charCodeAt(pos + 1) === 124) {\n                            return pos += 2, token = 53;\n                        }\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 68;\n                        }\n                        pos++;\n                        return token = 48;\n                    case 125:\n                        pos++;\n                        return token = 17;\n                    case 126:\n                        pos++;\n                        return token = 51;\n                    case 64:\n                        pos++;\n                        return token = 56;\n                    case 92:\n                        var cookedChar = peekUnicodeEscape();\n                        if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {\n                            pos += 6;\n                            tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();\n                            return token = getIdentifierToken();\n                        }\n                        error(ts.Diagnostics.Invalid_character);\n                        pos++;\n                        return token = 0;\n                    default:\n                        if (isIdentifierStart(ch, languageVersion)) {\n                            pos++;\n                            while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion))\n                                pos++;\n                            tokenValue = text.substring(tokenPos, pos);\n                            if (ch === 92) {\n                                tokenValue += scanIdentifierParts();\n                            }\n                            return token = getIdentifierToken();\n                        }\n                        else if (isWhiteSpaceSingleLine(ch)) {\n                            pos++;\n                            continue;\n                        }\n                        else if (isLineBreak(ch)) {\n                            precedingLineBreak = true;\n                            pos++;\n                            continue;\n                        }\n                        error(ts.Diagnostics.Invalid_character);\n                        pos++;\n                        return token = 0;\n                }\n            }\n        }\n        function reScanGreaterToken() {\n            if (token === 28) {\n                if (text.charCodeAt(pos) === 62) {\n                    if (text.charCodeAt(pos + 1) === 62) {\n                        if (text.charCodeAt(pos + 2) === 61) {\n                            return pos += 3, token = 66;\n                        }\n                        return pos += 2, token = 46;\n                    }\n                    if (text.charCodeAt(pos + 1) === 61) {\n                        return pos += 2, token = 65;\n                    }\n                    pos++;\n                    return token = 45;\n                }\n                if (text.charCodeAt(pos) === 61) {\n                    pos++;\n                    return token = 30;\n                }\n            }\n            return token;\n        }\n        function reScanSlashToken() {\n            if (token === 40 || token === 62) {\n                var p = tokenPos + 1;\n                var inEscape = false;\n                var inCharacterClass = false;\n                while (true) {\n                    if (p >= end) {\n                        tokenIsUnterminated = true;\n                        error(ts.Diagnostics.Unterminated_regular_expression_literal);\n                        break;\n                    }\n                    var ch = text.charCodeAt(p);\n                    if (isLineBreak(ch)) {\n                        tokenIsUnterminated = true;\n                        error(ts.Diagnostics.Unterminated_regular_expression_literal);\n                        break;\n                    }\n                    if (inEscape) {\n                        inEscape = false;\n                    }\n                    else if (ch === 47 && !inCharacterClass) {\n                        p++;\n                        break;\n                    }\n                    else if (ch === 91) {\n                        inCharacterClass = true;\n                    }\n                    else if (ch === 92) {\n                        inEscape = true;\n                    }\n                    else if (ch === 93) {\n                        inCharacterClass = false;\n                    }\n                    p++;\n                }\n                while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) {\n                    p++;\n                }\n                pos = p;\n                tokenValue = text.substring(tokenPos, pos);\n                token = 11;\n            }\n            return token;\n        }\n        function reScanTemplateToken() {\n            ts.Debug.assert(token === 17, \"'reScanTemplateToken' should only be called on a '}'\");\n            pos = tokenPos;\n            return token = scanTemplateAndSetTokenValue();\n        }\n        function reScanJsxToken() {\n            pos = tokenPos = startPos;\n            return token = scanJsxToken();\n        }\n        function scanJsxToken() {\n            startPos = tokenPos = pos;\n            if (pos >= end) {\n                return token = 1;\n            }\n            var char = text.charCodeAt(pos);\n            if (char === 60) {\n                if (text.charCodeAt(pos + 1) === 47) {\n                    pos += 2;\n                    return token = 27;\n                }\n                pos++;\n                return token = 26;\n            }\n            if (char === 123) {\n                pos++;\n                return token = 16;\n            }\n            while (pos < end) {\n                pos++;\n                char = text.charCodeAt(pos);\n                if ((char === 123) || (char === 60)) {\n                    break;\n                }\n            }\n            return token = 10;\n        }\n        function scanJsxIdentifier() {\n            if (tokenIsIdentifierOrKeyword(token)) {\n                var firstCharPosition = pos;\n                while (pos < end) {\n                    var ch = text.charCodeAt(pos);\n                    if (ch === 45 || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {\n                        pos++;\n                    }\n                    else {\n                        break;\n                    }\n                }\n                tokenValue += text.substr(firstCharPosition, pos - firstCharPosition);\n            }\n            return token;\n        }\n        function scanJsxAttributeValue() {\n            startPos = pos;\n            switch (text.charCodeAt(pos)) {\n                case 34:\n                case 39:\n                    tokenValue = scanString(false);\n                    return token = 9;\n                default:\n                    return scan();\n            }\n        }\n        function scanJSDocToken() {\n            if (pos >= end) {\n                return token = 1;\n            }\n            startPos = pos;\n            tokenPos = pos;\n            var ch = text.charCodeAt(pos);\n            switch (ch) {\n                case 9:\n                case 11:\n                case 12:\n                case 32:\n                    while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) {\n                        pos++;\n                    }\n                    return token = 5;\n                case 64:\n                    pos++;\n                    return token = 56;\n                case 10:\n                case 13:\n                    pos++;\n                    return token = 4;\n                case 42:\n                    pos++;\n                    return token = 38;\n                case 123:\n                    pos++;\n                    return token = 16;\n                case 125:\n                    pos++;\n                    return token = 17;\n                case 91:\n                    pos++;\n                    return token = 20;\n                case 93:\n                    pos++;\n                    return token = 21;\n                case 61:\n                    pos++;\n                    return token = 57;\n                case 44:\n                    pos++;\n                    return token = 25;\n                case 46:\n                    pos++;\n                    return token = 22;\n            }\n            if (isIdentifierStart(ch, 5)) {\n                pos++;\n                while (isIdentifierPart(text.charCodeAt(pos), 5) && pos < end) {\n                    pos++;\n                }\n                return token = 70;\n            }\n            else {\n                return pos += 1, token = 0;\n            }\n        }\n        function speculationHelper(callback, isLookahead) {\n            var savePos = pos;\n            var saveStartPos = startPos;\n            var saveTokenPos = tokenPos;\n            var saveToken = token;\n            var saveTokenValue = tokenValue;\n            var savePrecedingLineBreak = precedingLineBreak;\n            var result = callback();\n            if (!result || isLookahead) {\n                pos = savePos;\n                startPos = saveStartPos;\n                tokenPos = saveTokenPos;\n                token = saveToken;\n                tokenValue = saveTokenValue;\n                precedingLineBreak = savePrecedingLineBreak;\n            }\n            return result;\n        }\n        function scanRange(start, length, callback) {\n            var saveEnd = end;\n            var savePos = pos;\n            var saveStartPos = startPos;\n            var saveTokenPos = tokenPos;\n            var saveToken = token;\n            var savePrecedingLineBreak = precedingLineBreak;\n            var saveTokenValue = tokenValue;\n            var saveHasExtendedUnicodeEscape = hasExtendedUnicodeEscape;\n            var saveTokenIsUnterminated = tokenIsUnterminated;\n            setText(text, start, length);\n            var result = callback();\n            end = saveEnd;\n            pos = savePos;\n            startPos = saveStartPos;\n            tokenPos = saveTokenPos;\n            token = saveToken;\n            precedingLineBreak = savePrecedingLineBreak;\n            tokenValue = saveTokenValue;\n            hasExtendedUnicodeEscape = saveHasExtendedUnicodeEscape;\n            tokenIsUnterminated = saveTokenIsUnterminated;\n            return result;\n        }\n        function lookAhead(callback) {\n            return speculationHelper(callback, true);\n        }\n        function tryScan(callback) {\n            return speculationHelper(callback, false);\n        }\n        function getText() {\n            return text;\n        }\n        function setText(newText, start, length) {\n            text = newText || \"\";\n            end = length === undefined ? text.length : start + length;\n            setTextPos(start || 0);\n        }\n        function setOnError(errorCallback) {\n            onError = errorCallback;\n        }\n        function setScriptTarget(scriptTarget) {\n            languageVersion = scriptTarget;\n        }\n        function setLanguageVariant(variant) {\n            languageVariant = variant;\n        }\n        function setTextPos(textPos) {\n            ts.Debug.assert(textPos >= 0);\n            pos = textPos;\n            startPos = textPos;\n            tokenPos = textPos;\n            token = 0;\n            precedingLineBreak = false;\n            tokenValue = undefined;\n            hasExtendedUnicodeEscape = false;\n            tokenIsUnterminated = false;\n        }\n    }\n    ts.createScanner = createScanner;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    ts.externalHelpersModuleNameText = \"tslib\";\n    function getDeclarationOfKind(symbol, kind) {\n        var declarations = symbol.declarations;\n        if (declarations) {\n            for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) {\n                var declaration = declarations_1[_i];\n                if (declaration.kind === kind) {\n                    return declaration;\n                }\n            }\n        }\n        return undefined;\n    }\n    ts.getDeclarationOfKind = getDeclarationOfKind;\n    var stringWriters = [];\n    function getSingleLineStringWriter() {\n        if (stringWriters.length === 0) {\n            var str_1 = \"\";\n            var writeText = function (text) { return str_1 += text; };\n            return {\n                string: function () { return str_1; },\n                writeKeyword: writeText,\n                writeOperator: writeText,\n                writePunctuation: writeText,\n                writeSpace: writeText,\n                writeStringLiteral: writeText,\n                writeParameter: writeText,\n                writeSymbol: writeText,\n                writeLine: function () { return str_1 += \" \"; },\n                increaseIndent: ts.noop,\n                decreaseIndent: ts.noop,\n                clear: function () { return str_1 = \"\"; },\n                trackSymbol: ts.noop,\n                reportInaccessibleThisError: ts.noop\n            };\n        }\n        return stringWriters.pop();\n    }\n    ts.getSingleLineStringWriter = getSingleLineStringWriter;\n    function releaseStringWriter(writer) {\n        writer.clear();\n        stringWriters.push(writer);\n    }\n    ts.releaseStringWriter = releaseStringWriter;\n    function getFullWidth(node) {\n        return node.end - node.pos;\n    }\n    ts.getFullWidth = getFullWidth;\n    function hasResolvedModule(sourceFile, moduleNameText) {\n        return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]);\n    }\n    ts.hasResolvedModule = hasResolvedModule;\n    function getResolvedModule(sourceFile, moduleNameText) {\n        return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;\n    }\n    ts.getResolvedModule = getResolvedModule;\n    function setResolvedModule(sourceFile, moduleNameText, resolvedModule) {\n        if (!sourceFile.resolvedModules) {\n            sourceFile.resolvedModules = ts.createMap();\n        }\n        sourceFile.resolvedModules[moduleNameText] = resolvedModule;\n    }\n    ts.setResolvedModule = setResolvedModule;\n    function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) {\n        if (!sourceFile.resolvedTypeReferenceDirectiveNames) {\n            sourceFile.resolvedTypeReferenceDirectiveNames = ts.createMap();\n        }\n        sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective;\n    }\n    ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;\n    function moduleResolutionIsEqualTo(oldResolution, newResolution) {\n        return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport &&\n            oldResolution.extension === newResolution.extension &&\n            oldResolution.resolvedFileName === newResolution.resolvedFileName;\n    }\n    ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo;\n    function typeDirectiveIsEqualTo(oldResolution, newResolution) {\n        return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary;\n    }\n    ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo;\n    function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) {\n        if (names.length !== newResolutions.length) {\n            return false;\n        }\n        for (var i = 0; i < names.length; i++) {\n            var newResolution = newResolutions[i];\n            var oldResolution = oldResolutions && oldResolutions[names[i]];\n            var changed = oldResolution\n                ? !newResolution || !comparer(oldResolution, newResolution)\n                : newResolution;\n            if (changed) {\n                return true;\n            }\n        }\n        return false;\n    }\n    ts.hasChangesInResolutions = hasChangesInResolutions;\n    function containsParseError(node) {\n        aggregateChildData(node);\n        return (node.flags & 131072) !== 0;\n    }\n    ts.containsParseError = containsParseError;\n    function aggregateChildData(node) {\n        if (!(node.flags & 262144)) {\n            var thisNodeOrAnySubNodesHasError = ((node.flags & 32768) !== 0) ||\n                ts.forEachChild(node, containsParseError);\n            if (thisNodeOrAnySubNodesHasError) {\n                node.flags |= 131072;\n            }\n            node.flags |= 262144;\n        }\n    }\n    function getSourceFileOfNode(node) {\n        while (node && node.kind !== 261) {\n            node = node.parent;\n        }\n        return node;\n    }\n    ts.getSourceFileOfNode = getSourceFileOfNode;\n    function isStatementWithLocals(node) {\n        switch (node.kind) {\n            case 204:\n            case 232:\n            case 211:\n            case 212:\n            case 213:\n                return true;\n        }\n        return false;\n    }\n    ts.isStatementWithLocals = isStatementWithLocals;\n    function getStartPositionOfLine(line, sourceFile) {\n        ts.Debug.assert(line >= 0);\n        return ts.getLineStarts(sourceFile)[line];\n    }\n    ts.getStartPositionOfLine = getStartPositionOfLine;\n    function nodePosToString(node) {\n        var file = getSourceFileOfNode(node);\n        var loc = ts.getLineAndCharacterOfPosition(file, node.pos);\n        return file.fileName + \"(\" + (loc.line + 1) + \",\" + (loc.character + 1) + \")\";\n    }\n    ts.nodePosToString = nodePosToString;\n    function getStartPosOfNode(node) {\n        return node.pos;\n    }\n    ts.getStartPosOfNode = getStartPosOfNode;\n    function isDefined(value) {\n        return value !== undefined;\n    }\n    ts.isDefined = isDefined;\n    function getEndLinePosition(line, sourceFile) {\n        ts.Debug.assert(line >= 0);\n        var lineStarts = ts.getLineStarts(sourceFile);\n        var lineIndex = line;\n        var sourceText = sourceFile.text;\n        if (lineIndex + 1 === lineStarts.length) {\n            return sourceText.length - 1;\n        }\n        else {\n            var start = lineStarts[lineIndex];\n            var pos = lineStarts[lineIndex + 1] - 1;\n            ts.Debug.assert(ts.isLineBreak(sourceText.charCodeAt(pos)));\n            while (start <= pos && ts.isLineBreak(sourceText.charCodeAt(pos))) {\n                pos--;\n            }\n            return pos;\n        }\n    }\n    ts.getEndLinePosition = getEndLinePosition;\n    function nodeIsMissing(node) {\n        if (node === undefined) {\n            return true;\n        }\n        return node.pos === node.end && node.pos >= 0 && node.kind !== 1;\n    }\n    ts.nodeIsMissing = nodeIsMissing;\n    function nodeIsPresent(node) {\n        return !nodeIsMissing(node);\n    }\n    ts.nodeIsPresent = nodeIsPresent;\n    function getTokenPosOfNode(node, sourceFile, includeJsDoc) {\n        if (nodeIsMissing(node)) {\n            return node.pos;\n        }\n        if (isJSDocNode(node)) {\n            return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, false, true);\n        }\n        if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) {\n            return getTokenPosOfNode(node.jsDoc[0]);\n        }\n        if (node.kind === 292 && node._children.length > 0) {\n            return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);\n        }\n        return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);\n    }\n    ts.getTokenPosOfNode = getTokenPosOfNode;\n    function isJSDocNode(node) {\n        return node.kind >= 262 && node.kind <= 288;\n    }\n    ts.isJSDocNode = isJSDocNode;\n    function isJSDocTag(node) {\n        return node.kind >= 278 && node.kind <= 291;\n    }\n    ts.isJSDocTag = isJSDocTag;\n    function getNonDecoratorTokenPosOfNode(node, sourceFile) {\n        if (nodeIsMissing(node) || !node.decorators) {\n            return getTokenPosOfNode(node, sourceFile);\n        }\n        return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.decorators.end);\n    }\n    ts.getNonDecoratorTokenPosOfNode = getNonDecoratorTokenPosOfNode;\n    function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia) {\n        if (includeTrivia === void 0) { includeTrivia = false; }\n        if (nodeIsMissing(node)) {\n            return \"\";\n        }\n        var text = sourceFile.text;\n        return text.substring(includeTrivia ? node.pos : ts.skipTrivia(text, node.pos), node.end);\n    }\n    ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile;\n    function getTextOfNodeFromSourceText(sourceText, node) {\n        if (nodeIsMissing(node)) {\n            return \"\";\n        }\n        return sourceText.substring(ts.skipTrivia(sourceText, node.pos), node.end);\n    }\n    ts.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText;\n    function getTextOfNode(node, includeTrivia) {\n        if (includeTrivia === void 0) { includeTrivia = false; }\n        return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia);\n    }\n    ts.getTextOfNode = getTextOfNode;\n    function getLiteralText(node, sourceFile, languageVersion) {\n        if (languageVersion < 2 && (isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) {\n            return getQuotedEscapedLiteralText('\"', node.text, '\"');\n        }\n        if (!nodeIsSynthesized(node) && node.parent) {\n            var text = getSourceTextOfNodeFromSourceFile(sourceFile, node);\n            if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) {\n                return node.text;\n            }\n            return text;\n        }\n        switch (node.kind) {\n            case 9:\n                return getQuotedEscapedLiteralText('\"', node.text, '\"');\n            case 12:\n                return getQuotedEscapedLiteralText(\"`\", node.text, \"`\");\n            case 13:\n                return getQuotedEscapedLiteralText(\"`\", node.text, \"${\");\n            case 14:\n                return getQuotedEscapedLiteralText(\"}\", node.text, \"${\");\n            case 15:\n                return getQuotedEscapedLiteralText(\"}\", node.text, \"`\");\n            case 8:\n                return node.text;\n        }\n        ts.Debug.fail(\"Literal kind '\" + node.kind + \"' not accounted for.\");\n    }\n    ts.getLiteralText = getLiteralText;\n    function isBinaryOrOctalIntegerLiteral(node, text) {\n        if (node.kind === 8 && text.length > 1) {\n            switch (text.charCodeAt(1)) {\n                case 98:\n                case 66:\n                case 111:\n                case 79:\n                    return true;\n            }\n        }\n        return false;\n    }\n    ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral;\n    function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) {\n        return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote;\n    }\n    function escapeIdentifier(identifier) {\n        return identifier.length >= 2 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 ? \"_\" + identifier : identifier;\n    }\n    ts.escapeIdentifier = escapeIdentifier;\n    function unescapeIdentifier(identifier) {\n        return identifier.length >= 3 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 && identifier.charCodeAt(2) === 95 ? identifier.substr(1) : identifier;\n    }\n    ts.unescapeIdentifier = unescapeIdentifier;\n    function makeIdentifierFromModuleName(moduleName) {\n        return ts.getBaseFileName(moduleName).replace(/^(\\d)/, \"_$1\").replace(/\\W/g, \"_\");\n    }\n    ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName;\n    function isBlockOrCatchScoped(declaration) {\n        return (ts.getCombinedNodeFlags(declaration) & 3) !== 0 ||\n            isCatchClauseVariableDeclarationOrBindingElement(declaration);\n    }\n    ts.isBlockOrCatchScoped = isBlockOrCatchScoped;\n    function isCatchClauseVariableDeclarationOrBindingElement(declaration) {\n        var node = getRootDeclaration(declaration);\n        return node.kind === 223 && node.parent.kind === 256;\n    }\n    ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement;\n    function isAmbientModule(node) {\n        return node && node.kind === 230 &&\n            (node.name.kind === 9 || isGlobalScopeAugmentation(node));\n    }\n    ts.isAmbientModule = isAmbientModule;\n    function isShorthandAmbientModuleSymbol(moduleSymbol) {\n        return isShorthandAmbientModule(moduleSymbol.valueDeclaration);\n    }\n    ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;\n    function isShorthandAmbientModule(node) {\n        return node.kind === 230 && (!node.body);\n    }\n    function isBlockScopedContainerTopLevel(node) {\n        return node.kind === 261 ||\n            node.kind === 230 ||\n            isFunctionLike(node);\n    }\n    ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel;\n    function isGlobalScopeAugmentation(module) {\n        return !!(module.flags & 512);\n    }\n    ts.isGlobalScopeAugmentation = isGlobalScopeAugmentation;\n    function isExternalModuleAugmentation(node) {\n        if (!node || !isAmbientModule(node)) {\n            return false;\n        }\n        switch (node.parent.kind) {\n            case 261:\n                return ts.isExternalModule(node.parent);\n            case 231:\n                return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent);\n        }\n        return false;\n    }\n    ts.isExternalModuleAugmentation = isExternalModuleAugmentation;\n    function isEffectiveExternalModule(node, compilerOptions) {\n        return ts.isExternalModule(node) || compilerOptions.isolatedModules;\n    }\n    ts.isEffectiveExternalModule = isEffectiveExternalModule;\n    function isBlockScope(node, parentNode) {\n        switch (node.kind) {\n            case 261:\n            case 232:\n            case 256:\n            case 230:\n            case 211:\n            case 212:\n            case 213:\n            case 150:\n            case 149:\n            case 151:\n            case 152:\n            case 225:\n            case 184:\n            case 185:\n                return true;\n            case 204:\n                return parentNode && !isFunctionLike(parentNode);\n        }\n        return false;\n    }\n    ts.isBlockScope = isBlockScope;\n    function getEnclosingBlockScopeContainer(node) {\n        var current = node.parent;\n        while (current) {\n            if (isBlockScope(current, current.parent)) {\n                return current;\n            }\n            current = current.parent;\n        }\n    }\n    ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer;\n    function declarationNameToString(name) {\n        return getFullWidth(name) === 0 ? \"(Missing)\" : getTextOfNode(name);\n    }\n    ts.declarationNameToString = declarationNameToString;\n    function getTextOfPropertyName(name) {\n        switch (name.kind) {\n            case 70:\n                return name.text;\n            case 9:\n            case 8:\n                return name.text;\n            case 142:\n                if (isStringOrNumericLiteral(name.expression)) {\n                    return name.expression.text;\n                }\n        }\n        return undefined;\n    }\n    ts.getTextOfPropertyName = getTextOfPropertyName;\n    function entityNameToString(name) {\n        switch (name.kind) {\n            case 70:\n                return getFullWidth(name) === 0 ? unescapeIdentifier(name.text) : getTextOfNode(name);\n            case 141:\n                return entityNameToString(name.left) + \".\" + entityNameToString(name.right);\n            case 177:\n                return entityNameToString(name.expression) + \".\" + entityNameToString(name.name);\n        }\n    }\n    ts.entityNameToString = entityNameToString;\n    function createDiagnosticForNode(node, message, arg0, arg1, arg2) {\n        var sourceFile = getSourceFileOfNode(node);\n        return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2);\n    }\n    ts.createDiagnosticForNode = createDiagnosticForNode;\n    function createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2) {\n        var span = getErrorSpanForNode(sourceFile, node);\n        return ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2);\n    }\n    ts.createDiagnosticForNodeInSourceFile = createDiagnosticForNodeInSourceFile;\n    function createDiagnosticForNodeFromMessageChain(node, messageChain) {\n        var sourceFile = getSourceFileOfNode(node);\n        var span = getErrorSpanForNode(sourceFile, node);\n        return {\n            file: sourceFile,\n            start: span.start,\n            length: span.length,\n            code: messageChain.code,\n            category: messageChain.category,\n            messageText: messageChain.next ? messageChain : messageChain.messageText\n        };\n    }\n    ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain;\n    function getSpanOfTokenAtPosition(sourceFile, pos) {\n        var scanner = ts.createScanner(sourceFile.languageVersion, true, sourceFile.languageVariant, sourceFile.text, undefined, pos);\n        scanner.scan();\n        var start = scanner.getTokenPos();\n        return ts.createTextSpanFromBounds(start, scanner.getTextPos());\n    }\n    ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition;\n    function getErrorSpanForArrowFunction(sourceFile, node) {\n        var pos = ts.skipTrivia(sourceFile.text, node.pos);\n        if (node.body && node.body.kind === 204) {\n            var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line;\n            var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line;\n            if (startLine < endLine) {\n                return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1);\n            }\n        }\n        return ts.createTextSpanFromBounds(pos, node.end);\n    }\n    function getErrorSpanForNode(sourceFile, node) {\n        var errorNode = node;\n        switch (node.kind) {\n            case 261:\n                var pos_1 = ts.skipTrivia(sourceFile.text, 0, false);\n                if (pos_1 === sourceFile.text.length) {\n                    return ts.createTextSpan(0, 0);\n                }\n                return getSpanOfTokenAtPosition(sourceFile, pos_1);\n            case 223:\n            case 174:\n            case 226:\n            case 197:\n            case 227:\n            case 230:\n            case 229:\n            case 260:\n            case 225:\n            case 184:\n            case 149:\n            case 151:\n            case 152:\n            case 228:\n                errorNode = node.name;\n                break;\n            case 185:\n                return getErrorSpanForArrowFunction(sourceFile, node);\n        }\n        if (errorNode === undefined) {\n            return getSpanOfTokenAtPosition(sourceFile, node.pos);\n        }\n        var pos = nodeIsMissing(errorNode)\n            ? errorNode.pos\n            : ts.skipTrivia(sourceFile.text, errorNode.pos);\n        return ts.createTextSpanFromBounds(pos, errorNode.end);\n    }\n    ts.getErrorSpanForNode = getErrorSpanForNode;\n    function isExternalOrCommonJsModule(file) {\n        return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined;\n    }\n    ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule;\n    function isDeclarationFile(file) {\n        return file.isDeclarationFile;\n    }\n    ts.isDeclarationFile = isDeclarationFile;\n    function isConstEnumDeclaration(node) {\n        return node.kind === 229 && isConst(node);\n    }\n    ts.isConstEnumDeclaration = isConstEnumDeclaration;\n    function isConst(node) {\n        return !!(ts.getCombinedNodeFlags(node) & 2)\n            || !!(ts.getCombinedModifierFlags(node) & 2048);\n    }\n    ts.isConst = isConst;\n    function isLet(node) {\n        return !!(ts.getCombinedNodeFlags(node) & 1);\n    }\n    ts.isLet = isLet;\n    function isSuperCall(n) {\n        return n.kind === 179 && n.expression.kind === 96;\n    }\n    ts.isSuperCall = isSuperCall;\n    function isPrologueDirective(node) {\n        return node.kind === 207\n            && node.expression.kind === 9;\n    }\n    ts.isPrologueDirective = isPrologueDirective;\n    function getLeadingCommentRangesOfNode(node, sourceFileOfNode) {\n        return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos);\n    }\n    ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode;\n    function getLeadingCommentRangesOfNodeFromText(node, text) {\n        return ts.getLeadingCommentRanges(text, node.pos);\n    }\n    ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText;\n    function getJSDocCommentRanges(node, text) {\n        var commentRanges = (node.kind === 144 ||\n            node.kind === 143 ||\n            node.kind === 184 ||\n            node.kind === 185) ?\n            ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :\n            getLeadingCommentRangesOfNodeFromText(node, text);\n        return ts.filter(commentRanges, function (comment) {\n            return text.charCodeAt(comment.pos + 1) === 42 &&\n                text.charCodeAt(comment.pos + 2) === 42 &&\n                text.charCodeAt(comment.pos + 3) !== 47;\n        });\n    }\n    ts.getJSDocCommentRanges = getJSDocCommentRanges;\n    ts.fullTripleSlashReferencePathRegEx = /^(\\/\\/\\/\\s*<reference\\s+path\\s*=\\s*)('|\")(.+?)\\2.*?\\/>/;\n    ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\\/\\/\\/\\s*<reference\\s+types\\s*=\\s*)('|\")(.+?)\\2.*?\\/>/;\n    ts.fullTripleSlashAMDReferencePathRegEx = /^(\\/\\/\\/\\s*<amd-dependency\\s+path\\s*=\\s*)('|\")(.+?)\\2.*?\\/>/;\n    function isPartOfTypeNode(node) {\n        if (156 <= node.kind && node.kind <= 171) {\n            return true;\n        }\n        switch (node.kind) {\n            case 118:\n            case 132:\n            case 134:\n            case 121:\n            case 135:\n            case 137:\n            case 129:\n                return true;\n            case 104:\n                return node.parent.kind !== 188;\n            case 199:\n                return !isExpressionWithTypeArgumentsInClassExtendsClause(node);\n            case 70:\n                if (node.parent.kind === 141 && node.parent.right === node) {\n                    node = node.parent;\n                }\n                else if (node.parent.kind === 177 && node.parent.name === node) {\n                    node = node.parent;\n                }\n                ts.Debug.assert(node.kind === 70 || node.kind === 141 || node.kind === 177, \"'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.\");\n            case 141:\n            case 177:\n            case 98:\n                var parent_1 = node.parent;\n                if (parent_1.kind === 160) {\n                    return false;\n                }\n                if (156 <= parent_1.kind && parent_1.kind <= 171) {\n                    return true;\n                }\n                switch (parent_1.kind) {\n                    case 199:\n                        return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1);\n                    case 143:\n                        return node === parent_1.constraint;\n                    case 147:\n                    case 146:\n                    case 144:\n                    case 223:\n                        return node === parent_1.type;\n                    case 225:\n                    case 184:\n                    case 185:\n                    case 150:\n                    case 149:\n                    case 148:\n                    case 151:\n                    case 152:\n                        return node === parent_1.type;\n                    case 153:\n                    case 154:\n                    case 155:\n                        return node === parent_1.type;\n                    case 182:\n                        return node === parent_1.type;\n                    case 179:\n                    case 180:\n                        return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0;\n                    case 181:\n                        return false;\n                }\n        }\n        return false;\n    }\n    ts.isPartOfTypeNode = isPartOfTypeNode;\n    function forEachReturnStatement(body, visitor) {\n        return traverse(body);\n        function traverse(node) {\n            switch (node.kind) {\n                case 216:\n                    return visitor(node);\n                case 232:\n                case 204:\n                case 208:\n                case 209:\n                case 210:\n                case 211:\n                case 212:\n                case 213:\n                case 217:\n                case 218:\n                case 253:\n                case 254:\n                case 219:\n                case 221:\n                case 256:\n                    return ts.forEachChild(node, traverse);\n            }\n        }\n    }\n    ts.forEachReturnStatement = forEachReturnStatement;\n    function forEachYieldExpression(body, visitor) {\n        return traverse(body);\n        function traverse(node) {\n            switch (node.kind) {\n                case 195:\n                    visitor(node);\n                    var operand = node.expression;\n                    if (operand) {\n                        traverse(operand);\n                    }\n                case 229:\n                case 227:\n                case 230:\n                case 228:\n                case 226:\n                case 197:\n                    return;\n                default:\n                    if (isFunctionLike(node)) {\n                        var name_5 = node.name;\n                        if (name_5 && name_5.kind === 142) {\n                            traverse(name_5.expression);\n                            return;\n                        }\n                    }\n                    else if (!isPartOfTypeNode(node)) {\n                        ts.forEachChild(node, traverse);\n                    }\n            }\n        }\n    }\n    ts.forEachYieldExpression = forEachYieldExpression;\n    function isVariableLike(node) {\n        if (node) {\n            switch (node.kind) {\n                case 174:\n                case 260:\n                case 144:\n                case 257:\n                case 147:\n                case 146:\n                case 258:\n                case 223:\n                    return true;\n            }\n        }\n        return false;\n    }\n    ts.isVariableLike = isVariableLike;\n    function isAccessor(node) {\n        return node && (node.kind === 151 || node.kind === 152);\n    }\n    ts.isAccessor = isAccessor;\n    function isClassLike(node) {\n        return node && (node.kind === 226 || node.kind === 197);\n    }\n    ts.isClassLike = isClassLike;\n    function isFunctionLike(node) {\n        return node && isFunctionLikeKind(node.kind);\n    }\n    ts.isFunctionLike = isFunctionLike;\n    function isFunctionLikeKind(kind) {\n        switch (kind) {\n            case 150:\n            case 184:\n            case 225:\n            case 185:\n            case 149:\n            case 148:\n            case 151:\n            case 152:\n            case 153:\n            case 154:\n            case 155:\n            case 158:\n            case 159:\n                return true;\n        }\n        return false;\n    }\n    ts.isFunctionLikeKind = isFunctionLikeKind;\n    function introducesArgumentsExoticObject(node) {\n        switch (node.kind) {\n            case 149:\n            case 148:\n            case 150:\n            case 151:\n            case 152:\n            case 225:\n            case 184:\n                return true;\n        }\n        return false;\n    }\n    ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject;\n    function isIterationStatement(node, lookInLabeledStatements) {\n        switch (node.kind) {\n            case 211:\n            case 212:\n            case 213:\n            case 209:\n            case 210:\n                return true;\n            case 219:\n                return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements);\n        }\n        return false;\n    }\n    ts.isIterationStatement = isIterationStatement;\n    function isFunctionBlock(node) {\n        return node && node.kind === 204 && isFunctionLike(node.parent);\n    }\n    ts.isFunctionBlock = isFunctionBlock;\n    function isObjectLiteralMethod(node) {\n        return node && node.kind === 149 && node.parent.kind === 176;\n    }\n    ts.isObjectLiteralMethod = isObjectLiteralMethod;\n    function isObjectLiteralOrClassExpressionMethod(node) {\n        return node.kind === 149 &&\n            (node.parent.kind === 176 ||\n                node.parent.kind === 197);\n    }\n    ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod;\n    function isIdentifierTypePredicate(predicate) {\n        return predicate && predicate.kind === 1;\n    }\n    ts.isIdentifierTypePredicate = isIdentifierTypePredicate;\n    function isThisTypePredicate(predicate) {\n        return predicate && predicate.kind === 0;\n    }\n    ts.isThisTypePredicate = isThisTypePredicate;\n    function getContainingFunction(node) {\n        while (true) {\n            node = node.parent;\n            if (!node || isFunctionLike(node)) {\n                return node;\n            }\n        }\n    }\n    ts.getContainingFunction = getContainingFunction;\n    function getContainingClass(node) {\n        while (true) {\n            node = node.parent;\n            if (!node || isClassLike(node)) {\n                return node;\n            }\n        }\n    }\n    ts.getContainingClass = getContainingClass;\n    function getThisContainer(node, includeArrowFunctions) {\n        while (true) {\n            node = node.parent;\n            if (!node) {\n                return undefined;\n            }\n            switch (node.kind) {\n                case 142:\n                    if (isClassLike(node.parent.parent)) {\n                        return node;\n                    }\n                    node = node.parent;\n                    break;\n                case 145:\n                    if (node.parent.kind === 144 && isClassElement(node.parent.parent)) {\n                        node = node.parent.parent;\n                    }\n                    else if (isClassElement(node.parent)) {\n                        node = node.parent;\n                    }\n                    break;\n                case 185:\n                    if (!includeArrowFunctions) {\n                        continue;\n                    }\n                case 225:\n                case 184:\n                case 230:\n                case 147:\n                case 146:\n                case 149:\n                case 148:\n                case 150:\n                case 151:\n                case 152:\n                case 153:\n                case 154:\n                case 155:\n                case 229:\n                case 261:\n                    return node;\n            }\n        }\n    }\n    ts.getThisContainer = getThisContainer;\n    function getSuperContainer(node, stopOnFunctions) {\n        while (true) {\n            node = node.parent;\n            if (!node) {\n                return node;\n            }\n            switch (node.kind) {\n                case 142:\n                    node = node.parent;\n                    break;\n                case 225:\n                case 184:\n                case 185:\n                    if (!stopOnFunctions) {\n                        continue;\n                    }\n                case 147:\n                case 146:\n                case 149:\n                case 148:\n                case 150:\n                case 151:\n                case 152:\n                    return node;\n                case 145:\n                    if (node.parent.kind === 144 && isClassElement(node.parent.parent)) {\n                        node = node.parent.parent;\n                    }\n                    else if (isClassElement(node.parent)) {\n                        node = node.parent;\n                    }\n                    break;\n            }\n        }\n    }\n    ts.getSuperContainer = getSuperContainer;\n    function getImmediatelyInvokedFunctionExpression(func) {\n        if (func.kind === 184 || func.kind === 185) {\n            var prev = func;\n            var parent_2 = func.parent;\n            while (parent_2.kind === 183) {\n                prev = parent_2;\n                parent_2 = parent_2.parent;\n            }\n            if (parent_2.kind === 179 && parent_2.expression === prev) {\n                return parent_2;\n            }\n        }\n    }\n    ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression;\n    function isSuperProperty(node) {\n        var kind = node.kind;\n        return (kind === 177 || kind === 178)\n            && node.expression.kind === 96;\n    }\n    ts.isSuperProperty = isSuperProperty;\n    function getEntityNameFromTypeNode(node) {\n        switch (node.kind) {\n            case 157:\n            case 272:\n                return node.typeName;\n            case 199:\n                return isEntityNameExpression(node.expression)\n                    ? node.expression\n                    : undefined;\n            case 70:\n            case 141:\n                return node;\n        }\n        return undefined;\n    }\n    ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode;\n    function isCallLikeExpression(node) {\n        switch (node.kind) {\n            case 179:\n            case 180:\n            case 181:\n            case 145:\n                return true;\n            default:\n                return false;\n        }\n    }\n    ts.isCallLikeExpression = isCallLikeExpression;\n    function getInvokedExpression(node) {\n        if (node.kind === 181) {\n            return node.tag;\n        }\n        return node.expression;\n    }\n    ts.getInvokedExpression = getInvokedExpression;\n    function nodeCanBeDecorated(node) {\n        switch (node.kind) {\n            case 226:\n                return true;\n            case 147:\n                return node.parent.kind === 226;\n            case 151:\n            case 152:\n            case 149:\n                return node.body !== undefined\n                    && node.parent.kind === 226;\n            case 144:\n                return node.parent.body !== undefined\n                    && (node.parent.kind === 150\n                        || node.parent.kind === 149\n                        || node.parent.kind === 152)\n                    && node.parent.parent.kind === 226;\n        }\n        return false;\n    }\n    ts.nodeCanBeDecorated = nodeCanBeDecorated;\n    function nodeIsDecorated(node) {\n        return node.decorators !== undefined\n            && nodeCanBeDecorated(node);\n    }\n    ts.nodeIsDecorated = nodeIsDecorated;\n    function nodeOrChildIsDecorated(node) {\n        return nodeIsDecorated(node) || childIsDecorated(node);\n    }\n    ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated;\n    function childIsDecorated(node) {\n        switch (node.kind) {\n            case 226:\n                return ts.forEach(node.members, nodeOrChildIsDecorated);\n            case 149:\n            case 152:\n                return ts.forEach(node.parameters, nodeIsDecorated);\n        }\n    }\n    ts.childIsDecorated = childIsDecorated;\n    function isJSXTagName(node) {\n        var parent = node.parent;\n        if (parent.kind === 248 ||\n            parent.kind === 247 ||\n            parent.kind === 249) {\n            return parent.tagName === node;\n        }\n        return false;\n    }\n    ts.isJSXTagName = isJSXTagName;\n    function isPartOfExpression(node) {\n        switch (node.kind) {\n            case 98:\n            case 96:\n            case 94:\n            case 100:\n            case 85:\n            case 11:\n            case 175:\n            case 176:\n            case 177:\n            case 178:\n            case 179:\n            case 180:\n            case 181:\n            case 200:\n            case 182:\n            case 201:\n            case 183:\n            case 184:\n            case 197:\n            case 185:\n            case 188:\n            case 186:\n            case 187:\n            case 190:\n            case 191:\n            case 192:\n            case 193:\n            case 196:\n            case 194:\n            case 12:\n            case 198:\n            case 246:\n            case 247:\n            case 195:\n            case 189:\n                return true;\n            case 141:\n                while (node.parent.kind === 141) {\n                    node = node.parent;\n                }\n                return node.parent.kind === 160 || isJSXTagName(node);\n            case 70:\n                if (node.parent.kind === 160 || isJSXTagName(node)) {\n                    return true;\n                }\n            case 8:\n            case 9:\n            case 98:\n                var parent_3 = node.parent;\n                switch (parent_3.kind) {\n                    case 223:\n                    case 144:\n                    case 147:\n                    case 146:\n                    case 260:\n                    case 257:\n                    case 174:\n                        return parent_3.initializer === node;\n                    case 207:\n                    case 208:\n                    case 209:\n                    case 210:\n                    case 216:\n                    case 217:\n                    case 218:\n                    case 253:\n                    case 220:\n                    case 218:\n                        return parent_3.expression === node;\n                    case 211:\n                        var forStatement = parent_3;\n                        return (forStatement.initializer === node && forStatement.initializer.kind !== 224) ||\n                            forStatement.condition === node ||\n                            forStatement.incrementor === node;\n                    case 212:\n                    case 213:\n                        var forInStatement = parent_3;\n                        return (forInStatement.initializer === node && forInStatement.initializer.kind !== 224) ||\n                            forInStatement.expression === node;\n                    case 182:\n                    case 200:\n                        return node === parent_3.expression;\n                    case 202:\n                        return node === parent_3.expression;\n                    case 142:\n                        return node === parent_3.expression;\n                    case 145:\n                    case 252:\n                    case 251:\n                    case 259:\n                        return true;\n                    case 199:\n                        return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3);\n                    default:\n                        if (isPartOfExpression(parent_3)) {\n                            return true;\n                        }\n                }\n        }\n        return false;\n    }\n    ts.isPartOfExpression = isPartOfExpression;\n    function isInstantiatedModule(node, preserveConstEnums) {\n        var moduleState = ts.getModuleInstanceState(node);\n        return moduleState === 1 ||\n            (preserveConstEnums && moduleState === 2);\n    }\n    ts.isInstantiatedModule = isInstantiatedModule;\n    function isExternalModuleImportEqualsDeclaration(node) {\n        return node.kind === 234 && node.moduleReference.kind === 245;\n    }\n    ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration;\n    function getExternalModuleImportEqualsDeclarationExpression(node) {\n        ts.Debug.assert(isExternalModuleImportEqualsDeclaration(node));\n        return node.moduleReference.expression;\n    }\n    ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;\n    function isInternalModuleImportEqualsDeclaration(node) {\n        return node.kind === 234 && node.moduleReference.kind !== 245;\n    }\n    ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration;\n    function isSourceFileJavaScript(file) {\n        return isInJavaScriptFile(file);\n    }\n    ts.isSourceFileJavaScript = isSourceFileJavaScript;\n    function isInJavaScriptFile(node) {\n        return node && !!(node.flags & 65536);\n    }\n    ts.isInJavaScriptFile = isInJavaScriptFile;\n    function isRequireCall(expression, checkArgumentIsStringLiteral) {\n        var isRequire = expression.kind === 179 &&\n            expression.expression.kind === 70 &&\n            expression.expression.text === \"require\" &&\n            expression.arguments.length === 1;\n        return isRequire && (!checkArgumentIsStringLiteral || expression.arguments[0].kind === 9);\n    }\n    ts.isRequireCall = isRequireCall;\n    function isSingleOrDoubleQuote(charCode) {\n        return charCode === 39 || charCode === 34;\n    }\n    ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote;\n    function isDeclarationOfFunctionExpression(s) {\n        if (s.valueDeclaration && s.valueDeclaration.kind === 223) {\n            var declaration = s.valueDeclaration;\n            return declaration.initializer && declaration.initializer.kind === 184;\n        }\n        return false;\n    }\n    ts.isDeclarationOfFunctionExpression = isDeclarationOfFunctionExpression;\n    function getSpecialPropertyAssignmentKind(expression) {\n        if (!isInJavaScriptFile(expression)) {\n            return 0;\n        }\n        if (expression.kind !== 192) {\n            return 0;\n        }\n        var expr = expression;\n        if (expr.operatorToken.kind !== 57 || expr.left.kind !== 177) {\n            return 0;\n        }\n        var lhs = expr.left;\n        if (lhs.expression.kind === 70) {\n            var lhsId = lhs.expression;\n            if (lhsId.text === \"exports\") {\n                return 1;\n            }\n            else if (lhsId.text === \"module\" && lhs.name.text === \"exports\") {\n                return 2;\n            }\n        }\n        else if (lhs.expression.kind === 98) {\n            return 4;\n        }\n        else if (lhs.expression.kind === 177) {\n            var innerPropertyAccess = lhs.expression;\n            if (innerPropertyAccess.expression.kind === 70) {\n                var innerPropertyAccessIdentifier = innerPropertyAccess.expression;\n                if (innerPropertyAccessIdentifier.text === \"module\" && innerPropertyAccess.name.text === \"exports\") {\n                    return 1;\n                }\n                if (innerPropertyAccess.name.text === \"prototype\") {\n                    return 3;\n                }\n            }\n        }\n        return 0;\n    }\n    ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind;\n    function getExternalModuleName(node) {\n        if (node.kind === 235) {\n            return node.moduleSpecifier;\n        }\n        if (node.kind === 234) {\n            var reference = node.moduleReference;\n            if (reference.kind === 245) {\n                return reference.expression;\n            }\n        }\n        if (node.kind === 241) {\n            return node.moduleSpecifier;\n        }\n        if (node.kind === 230 && node.name.kind === 9) {\n            return node.name;\n        }\n    }\n    ts.getExternalModuleName = getExternalModuleName;\n    function getNamespaceDeclarationNode(node) {\n        if (node.kind === 234) {\n            return node;\n        }\n        var importClause = node.importClause;\n        if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 237) {\n            return importClause.namedBindings;\n        }\n    }\n    ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode;\n    function isDefaultImport(node) {\n        return node.kind === 235\n            && node.importClause\n            && !!node.importClause.name;\n    }\n    ts.isDefaultImport = isDefaultImport;\n    function hasQuestionToken(node) {\n        if (node) {\n            switch (node.kind) {\n                case 144:\n                case 149:\n                case 148:\n                case 258:\n                case 257:\n                case 147:\n                case 146:\n                    return node.questionToken !== undefined;\n            }\n        }\n        return false;\n    }\n    ts.hasQuestionToken = hasQuestionToken;\n    function isJSDocConstructSignature(node) {\n        return node.kind === 274 &&\n            node.parameters.length > 0 &&\n            node.parameters[0].type.kind === 276;\n    }\n    ts.isJSDocConstructSignature = isJSDocConstructSignature;\n    function getCommentsFromJSDoc(node) {\n        return ts.map(getJSDocs(node), function (doc) { return doc.comment; });\n    }\n    ts.getCommentsFromJSDoc = getCommentsFromJSDoc;\n    function getJSDocTags(node, kind) {\n        var docs = getJSDocs(node);\n        if (docs) {\n            var result = [];\n            for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) {\n                var doc = docs_1[_i];\n                if (doc.kind === 281) {\n                    if (doc.kind === kind) {\n                        result.push(doc);\n                    }\n                }\n                else {\n                    result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; }));\n                }\n            }\n            return result;\n        }\n    }\n    function getFirstJSDocTag(node, kind) {\n        return node && ts.firstOrUndefined(getJSDocTags(node, kind));\n    }\n    function getJSDocs(node) {\n        var cache = node.jsDocCache;\n        if (!cache) {\n            getJSDocsWorker(node);\n            node.jsDocCache = cache;\n        }\n        return cache;\n        function getJSDocsWorker(node) {\n            var parent = node.parent;\n            var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) &&\n                parent.initializer === node &&\n                parent.parent.parent.kind === 205;\n            var isVariableOfVariableDeclarationStatement = isVariableLike(node) &&\n                parent.parent.kind === 205;\n            var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent :\n                isVariableOfVariableDeclarationStatement ? parent.parent :\n                    undefined;\n            if (variableStatementNode) {\n                getJSDocsWorker(variableStatementNode);\n            }\n            var isSourceOfAssignmentExpressionStatement = parent && parent.parent &&\n                parent.kind === 192 &&\n                parent.operatorToken.kind === 57 &&\n                parent.parent.kind === 207;\n            if (isSourceOfAssignmentExpressionStatement) {\n                getJSDocsWorker(parent.parent);\n            }\n            var isModuleDeclaration = node.kind === 230 &&\n                parent && parent.kind === 230;\n            var isPropertyAssignmentExpression = parent && parent.kind === 257;\n            if (isModuleDeclaration || isPropertyAssignmentExpression) {\n                getJSDocsWorker(parent);\n            }\n            if (node.kind === 144) {\n                cache = ts.concatenate(cache, getJSDocParameterTags(node));\n            }\n            if (isVariableLike(node) && node.initializer) {\n                cache = ts.concatenate(cache, node.initializer.jsDoc);\n            }\n            cache = ts.concatenate(cache, node.jsDoc);\n        }\n    }\n    function getJSDocParameterTags(param) {\n        if (!isParameter(param)) {\n            return undefined;\n        }\n        var func = param.parent;\n        var tags = getJSDocTags(func, 281);\n        if (!param.name) {\n            var i = func.parameters.indexOf(param);\n            var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281; });\n            if (paramTags && 0 <= i && i < paramTags.length) {\n                return [paramTags[i]];\n            }\n        }\n        else if (param.name.kind === 70) {\n            var name_6 = param.name.text;\n            return ts.filter(tags, function (tag) { return tag.kind === 281 && tag.parameterName.text === name_6; });\n        }\n        else {\n            return undefined;\n        }\n    }\n    ts.getJSDocParameterTags = getJSDocParameterTags;\n    function getJSDocType(node) {\n        var tag = getFirstJSDocTag(node, 283);\n        if (!tag && node.kind === 144) {\n            var paramTags = getJSDocParameterTags(node);\n            if (paramTags) {\n                tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; });\n            }\n        }\n        return tag && tag.typeExpression && tag.typeExpression.type;\n    }\n    ts.getJSDocType = getJSDocType;\n    function getJSDocAugmentsTag(node) {\n        return getFirstJSDocTag(node, 280);\n    }\n    ts.getJSDocAugmentsTag = getJSDocAugmentsTag;\n    function getJSDocReturnTag(node) {\n        return getFirstJSDocTag(node, 282);\n    }\n    ts.getJSDocReturnTag = getJSDocReturnTag;\n    function getJSDocTemplateTag(node) {\n        return getFirstJSDocTag(node, 284);\n    }\n    ts.getJSDocTemplateTag = getJSDocTemplateTag;\n    function hasRestParameter(s) {\n        return isRestParameter(ts.lastOrUndefined(s.parameters));\n    }\n    ts.hasRestParameter = hasRestParameter;\n    function hasDeclaredRestParameter(s) {\n        return isDeclaredRestParam(ts.lastOrUndefined(s.parameters));\n    }\n    ts.hasDeclaredRestParameter = hasDeclaredRestParameter;\n    function isRestParameter(node) {\n        if (node && (node.flags & 65536)) {\n            if (node.type && node.type.kind === 275 ||\n                ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275; })) {\n                return true;\n            }\n        }\n        return isDeclaredRestParam(node);\n    }\n    ts.isRestParameter = isRestParameter;\n    function isDeclaredRestParam(node) {\n        return node && node.dotDotDotToken !== undefined;\n    }\n    ts.isDeclaredRestParam = isDeclaredRestParam;\n    function getAssignmentTargetKind(node) {\n        var parent = node.parent;\n        while (true) {\n            switch (parent.kind) {\n                case 192:\n                    var binaryOperator = parent.operatorToken.kind;\n                    return isAssignmentOperator(binaryOperator) && parent.left === node ?\n                        binaryOperator === 57 ? 1 : 2 :\n                        0;\n                case 190:\n                case 191:\n                    var unaryOperator = parent.operator;\n                    return unaryOperator === 42 || unaryOperator === 43 ? 2 : 0;\n                case 212:\n                case 213:\n                    return parent.initializer === node ? 1 : 0;\n                case 183:\n                case 175:\n                case 196:\n                    node = parent;\n                    break;\n                case 258:\n                    if (parent.name !== node) {\n                        return 0;\n                    }\n                case 257:\n                    node = parent.parent;\n                    break;\n                default:\n                    return 0;\n            }\n            parent = node.parent;\n        }\n    }\n    ts.getAssignmentTargetKind = getAssignmentTargetKind;\n    function isAssignmentTarget(node) {\n        return getAssignmentTargetKind(node) !== 0;\n    }\n    ts.isAssignmentTarget = isAssignmentTarget;\n    function isNodeDescendantOf(node, ancestor) {\n        while (node) {\n            if (node === ancestor)\n                return true;\n            node = node.parent;\n        }\n        return false;\n    }\n    ts.isNodeDescendantOf = isNodeDescendantOf;\n    function isInAmbientContext(node) {\n        while (node) {\n            if (hasModifier(node, 2) || (node.kind === 261 && node.isDeclarationFile)) {\n                return true;\n            }\n            node = node.parent;\n        }\n        return false;\n    }\n    ts.isInAmbientContext = isInAmbientContext;\n    function isDeclarationName(name) {\n        if (name.kind !== 70 && name.kind !== 9 && name.kind !== 8) {\n            return false;\n        }\n        var parent = name.parent;\n        if (parent.kind === 239 || parent.kind === 243) {\n            if (parent.propertyName) {\n                return true;\n            }\n        }\n        if (isDeclaration(parent)) {\n            return parent.name === name;\n        }\n        return false;\n    }\n    ts.isDeclarationName = isDeclarationName;\n    function isLiteralComputedPropertyDeclarationName(node) {\n        return (node.kind === 9 || node.kind === 8) &&\n            node.parent.kind === 142 &&\n            isDeclaration(node.parent.parent);\n    }\n    ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName;\n    function isIdentifierName(node) {\n        var parent = node.parent;\n        switch (parent.kind) {\n            case 147:\n            case 146:\n            case 149:\n            case 148:\n            case 151:\n            case 152:\n            case 260:\n            case 257:\n            case 177:\n                return parent.name === node;\n            case 141:\n                if (parent.right === node) {\n                    while (parent.kind === 141) {\n                        parent = parent.parent;\n                    }\n                    return parent.kind === 160;\n                }\n                return false;\n            case 174:\n            case 239:\n                return parent.propertyName === node;\n            case 243:\n                return true;\n        }\n        return false;\n    }\n    ts.isIdentifierName = isIdentifierName;\n    function isAliasSymbolDeclaration(node) {\n        return node.kind === 234 ||\n            node.kind === 233 ||\n            node.kind === 236 && !!node.name ||\n            node.kind === 237 ||\n            node.kind === 239 ||\n            node.kind === 243 ||\n            node.kind === 240 && exportAssignmentIsAlias(node);\n    }\n    ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;\n    function exportAssignmentIsAlias(node) {\n        return isEntityNameExpression(node.expression);\n    }\n    ts.exportAssignmentIsAlias = exportAssignmentIsAlias;\n    function getClassExtendsHeritageClauseElement(node) {\n        var heritageClause = getHeritageClause(node.heritageClauses, 84);\n        return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;\n    }\n    ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement;\n    function getClassImplementsHeritageClauseElements(node) {\n        var heritageClause = getHeritageClause(node.heritageClauses, 107);\n        return heritageClause ? heritageClause.types : undefined;\n    }\n    ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements;\n    function getInterfaceBaseTypeNodes(node) {\n        var heritageClause = getHeritageClause(node.heritageClauses, 84);\n        return heritageClause ? heritageClause.types : undefined;\n    }\n    ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes;\n    function getHeritageClause(clauses, kind) {\n        if (clauses) {\n            for (var _i = 0, clauses_1 = clauses; _i < clauses_1.length; _i++) {\n                var clause = clauses_1[_i];\n                if (clause.token === kind) {\n                    return clause;\n                }\n            }\n        }\n        return undefined;\n    }\n    ts.getHeritageClause = getHeritageClause;\n    function tryResolveScriptReference(host, sourceFile, reference) {\n        if (!host.getCompilerOptions().noResolve) {\n            var referenceFileName = ts.isRootedDiskPath(reference.fileName) ? reference.fileName : ts.combinePaths(ts.getDirectoryPath(sourceFile.fileName), reference.fileName);\n            return host.getSourceFile(referenceFileName);\n        }\n    }\n    ts.tryResolveScriptReference = tryResolveScriptReference;\n    function getAncestor(node, kind) {\n        while (node) {\n            if (node.kind === kind) {\n                return node;\n            }\n            node = node.parent;\n        }\n        return undefined;\n    }\n    ts.getAncestor = getAncestor;\n    function getFileReferenceFromReferencePath(comment, commentRange) {\n        var simpleReferenceRegEx = /^\\/\\/\\/\\s*<reference\\s+/gim;\n        var isNoDefaultLibRegEx = /^(\\/\\/\\/\\s*<reference\\s+no-default-lib\\s*=\\s*)('|\")(.+?)\\2\\s*\\/>/gim;\n        if (simpleReferenceRegEx.test(comment)) {\n            if (isNoDefaultLibRegEx.test(comment)) {\n                return {\n                    isNoDefaultLib: true\n                };\n            }\n            else {\n                var refMatchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment);\n                var refLibResult = !refMatchResult && ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment);\n                if (refMatchResult || refLibResult) {\n                    var start = commentRange.pos;\n                    var end = commentRange.end;\n                    return {\n                        fileReference: {\n                            pos: start,\n                            end: end,\n                            fileName: (refMatchResult || refLibResult)[3]\n                        },\n                        isNoDefaultLib: false,\n                        isTypeReferenceDirective: !!refLibResult\n                    };\n                }\n                return {\n                    diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax,\n                    isNoDefaultLib: false\n                };\n            }\n        }\n        return undefined;\n    }\n    ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath;\n    function isKeyword(token) {\n        return 71 <= token && token <= 140;\n    }\n    ts.isKeyword = isKeyword;\n    function isTrivia(token) {\n        return 2 <= token && token <= 7;\n    }\n    ts.isTrivia = isTrivia;\n    function isAsyncFunctionLike(node) {\n        return isFunctionLike(node) && hasModifier(node, 256) && !isAccessor(node);\n    }\n    ts.isAsyncFunctionLike = isAsyncFunctionLike;\n    function isStringOrNumericLiteral(node) {\n        var kind = node.kind;\n        return kind === 9\n            || kind === 8;\n    }\n    ts.isStringOrNumericLiteral = isStringOrNumericLiteral;\n    function hasDynamicName(declaration) {\n        return declaration.name && isDynamicName(declaration.name);\n    }\n    ts.hasDynamicName = hasDynamicName;\n    function isDynamicName(name) {\n        return name.kind === 142 &&\n            !isStringOrNumericLiteral(name.expression) &&\n            !isWellKnownSymbolSyntactically(name.expression);\n    }\n    ts.isDynamicName = isDynamicName;\n    function isWellKnownSymbolSyntactically(node) {\n        return isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression);\n    }\n    ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically;\n    function getPropertyNameForPropertyNameNode(name) {\n        if (name.kind === 70 || name.kind === 9 || name.kind === 8 || name.kind === 144) {\n            return name.text;\n        }\n        if (name.kind === 142) {\n            var nameExpression = name.expression;\n            if (isWellKnownSymbolSyntactically(nameExpression)) {\n                var rightHandSideName = nameExpression.name.text;\n                return getPropertyNameForKnownSymbolName(rightHandSideName);\n            }\n            else if (nameExpression.kind === 9 || nameExpression.kind === 8) {\n                return nameExpression.text;\n            }\n        }\n        return undefined;\n    }\n    ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode;\n    function getPropertyNameForKnownSymbolName(symbolName) {\n        return \"__@\" + symbolName;\n    }\n    ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName;\n    function isESSymbolIdentifier(node) {\n        return node.kind === 70 && node.text === \"Symbol\";\n    }\n    ts.isESSymbolIdentifier = isESSymbolIdentifier;\n    function isPushOrUnshiftIdentifier(node) {\n        return node.text === \"push\" || node.text === \"unshift\";\n    }\n    ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier;\n    function isModifierKind(token) {\n        switch (token) {\n            case 116:\n            case 119:\n            case 75:\n            case 123:\n            case 78:\n            case 83:\n            case 113:\n            case 111:\n            case 112:\n            case 130:\n            case 114:\n                return true;\n        }\n        return false;\n    }\n    ts.isModifierKind = isModifierKind;\n    function isParameterDeclaration(node) {\n        var root = getRootDeclaration(node);\n        return root.kind === 144;\n    }\n    ts.isParameterDeclaration = isParameterDeclaration;\n    function getRootDeclaration(node) {\n        while (node.kind === 174) {\n            node = node.parent.parent;\n        }\n        return node;\n    }\n    ts.getRootDeclaration = getRootDeclaration;\n    function nodeStartsNewLexicalEnvironment(node) {\n        var kind = node.kind;\n        return kind === 150\n            || kind === 184\n            || kind === 225\n            || kind === 185\n            || kind === 149\n            || kind === 151\n            || kind === 152\n            || kind === 230\n            || kind === 261;\n    }\n    ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment;\n    function nodeIsSynthesized(node) {\n        return ts.positionIsSynthesized(node.pos)\n            || ts.positionIsSynthesized(node.end);\n    }\n    ts.nodeIsSynthesized = nodeIsSynthesized;\n    function getOriginalNode(node, nodeTest) {\n        if (node) {\n            while (node.original !== undefined) {\n                node = node.original;\n            }\n        }\n        return !nodeTest || nodeTest(node) ? node : undefined;\n    }\n    ts.getOriginalNode = getOriginalNode;\n    function isParseTreeNode(node) {\n        return (node.flags & 8) === 0;\n    }\n    ts.isParseTreeNode = isParseTreeNode;\n    function getParseTreeNode(node, nodeTest) {\n        if (isParseTreeNode(node)) {\n            return node;\n        }\n        node = getOriginalNode(node);\n        if (isParseTreeNode(node) && (!nodeTest || nodeTest(node))) {\n            return node;\n        }\n        return undefined;\n    }\n    ts.getParseTreeNode = getParseTreeNode;\n    function getOriginalSourceFiles(sourceFiles) {\n        var originalSourceFiles = [];\n        for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) {\n            var sourceFile = sourceFiles_1[_i];\n            var originalSourceFile = getParseTreeNode(sourceFile, isSourceFile);\n            if (originalSourceFile) {\n                originalSourceFiles.push(originalSourceFile);\n            }\n        }\n        return originalSourceFiles;\n    }\n    ts.getOriginalSourceFiles = getOriginalSourceFiles;\n    function getOriginalNodeId(node) {\n        node = getOriginalNode(node);\n        return node ? ts.getNodeId(node) : 0;\n    }\n    ts.getOriginalNodeId = getOriginalNodeId;\n    function getExpressionAssociativity(expression) {\n        var operator = getOperator(expression);\n        var hasArguments = expression.kind === 180 && expression.arguments !== undefined;\n        return getOperatorAssociativity(expression.kind, operator, hasArguments);\n    }\n    ts.getExpressionAssociativity = getExpressionAssociativity;\n    function getOperatorAssociativity(kind, operator, hasArguments) {\n        switch (kind) {\n            case 180:\n                return hasArguments ? 0 : 1;\n            case 190:\n            case 187:\n            case 188:\n            case 186:\n            case 189:\n            case 193:\n            case 195:\n                return 1;\n            case 192:\n                switch (operator) {\n                    case 39:\n                    case 57:\n                    case 58:\n                    case 59:\n                    case 61:\n                    case 60:\n                    case 62:\n                    case 63:\n                    case 64:\n                    case 65:\n                    case 66:\n                    case 67:\n                    case 69:\n                    case 68:\n                        return 1;\n                }\n        }\n        return 0;\n    }\n    ts.getOperatorAssociativity = getOperatorAssociativity;\n    function getExpressionPrecedence(expression) {\n        var operator = getOperator(expression);\n        var hasArguments = expression.kind === 180 && expression.arguments !== undefined;\n        return getOperatorPrecedence(expression.kind, operator, hasArguments);\n    }\n    ts.getExpressionPrecedence = getExpressionPrecedence;\n    function getOperator(expression) {\n        if (expression.kind === 192) {\n            return expression.operatorToken.kind;\n        }\n        else if (expression.kind === 190 || expression.kind === 191) {\n            return expression.operator;\n        }\n        else {\n            return expression.kind;\n        }\n    }\n    ts.getOperator = getOperator;\n    function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {\n        switch (nodeKind) {\n            case 98:\n            case 96:\n            case 70:\n            case 94:\n            case 100:\n            case 85:\n            case 8:\n            case 9:\n            case 175:\n            case 176:\n            case 184:\n            case 185:\n            case 197:\n            case 246:\n            case 247:\n            case 11:\n            case 12:\n            case 194:\n            case 183:\n            case 198:\n            case 297:\n                return 19;\n            case 181:\n            case 177:\n            case 178:\n                return 18;\n            case 180:\n                return hasArguments ? 18 : 17;\n            case 179:\n                return 17;\n            case 191:\n                return 16;\n            case 190:\n            case 187:\n            case 188:\n            case 186:\n            case 189:\n                return 15;\n            case 192:\n                switch (operatorKind) {\n                    case 50:\n                    case 51:\n                        return 15;\n                    case 39:\n                    case 38:\n                    case 40:\n                    case 41:\n                        return 14;\n                    case 36:\n                    case 37:\n                        return 13;\n                    case 44:\n                    case 45:\n                    case 46:\n                        return 12;\n                    case 26:\n                    case 29:\n                    case 28:\n                    case 30:\n                    case 91:\n                    case 92:\n                        return 11;\n                    case 31:\n                    case 33:\n                    case 32:\n                    case 34:\n                        return 10;\n                    case 47:\n                        return 9;\n                    case 49:\n                        return 8;\n                    case 48:\n                        return 7;\n                    case 52:\n                        return 6;\n                    case 53:\n                        return 5;\n                    case 57:\n                    case 58:\n                    case 59:\n                    case 61:\n                    case 60:\n                    case 62:\n                    case 63:\n                    case 64:\n                    case 65:\n                    case 66:\n                    case 67:\n                    case 69:\n                    case 68:\n                        return 3;\n                    case 25:\n                        return 0;\n                    default:\n                        return -1;\n                }\n            case 193:\n                return 4;\n            case 195:\n                return 2;\n            case 196:\n                return 1;\n            default:\n                return -1;\n        }\n    }\n    ts.getOperatorPrecedence = getOperatorPrecedence;\n    function createDiagnosticCollection() {\n        var nonFileDiagnostics = [];\n        var fileDiagnostics = ts.createMap();\n        var diagnosticsModified = false;\n        var modificationCount = 0;\n        return {\n            add: add,\n            getGlobalDiagnostics: getGlobalDiagnostics,\n            getDiagnostics: getDiagnostics,\n            getModificationCount: getModificationCount,\n            reattachFileDiagnostics: reattachFileDiagnostics\n        };\n        function getModificationCount() {\n            return modificationCount;\n        }\n        function reattachFileDiagnostics(newFile) {\n            if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) {\n                return;\n            }\n            for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) {\n                var diagnostic = _a[_i];\n                diagnostic.file = newFile;\n            }\n        }\n        function add(diagnostic) {\n            var diagnostics;\n            if (diagnostic.file) {\n                diagnostics = fileDiagnostics[diagnostic.file.fileName];\n                if (!diagnostics) {\n                    diagnostics = [];\n                    fileDiagnostics[diagnostic.file.fileName] = diagnostics;\n                }\n            }\n            else {\n                diagnostics = nonFileDiagnostics;\n            }\n            diagnostics.push(diagnostic);\n            diagnosticsModified = true;\n            modificationCount++;\n        }\n        function getGlobalDiagnostics() {\n            sortAndDeduplicate();\n            return nonFileDiagnostics;\n        }\n        function getDiagnostics(fileName) {\n            sortAndDeduplicate();\n            if (fileName) {\n                return fileDiagnostics[fileName] || [];\n            }\n            var allDiagnostics = [];\n            function pushDiagnostic(d) {\n                allDiagnostics.push(d);\n            }\n            ts.forEach(nonFileDiagnostics, pushDiagnostic);\n            for (var key in fileDiagnostics) {\n                ts.forEach(fileDiagnostics[key], pushDiagnostic);\n            }\n            return ts.sortAndDeduplicateDiagnostics(allDiagnostics);\n        }\n        function sortAndDeduplicate() {\n            if (!diagnosticsModified) {\n                return;\n            }\n            diagnosticsModified = false;\n            nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics);\n            for (var key in fileDiagnostics) {\n                fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]);\n            }\n        }\n    }\n    ts.createDiagnosticCollection = createDiagnosticCollection;\n    var escapedCharsRegExp = /[\\\\\\\"\\u0000-\\u001f\\t\\v\\f\\b\\r\\n\\u2028\\u2029\\u0085]/g;\n    var escapedCharsMap = ts.createMap({\n        \"\\0\": \"\\\\0\",\n        \"\\t\": \"\\\\t\",\n        \"\\v\": \"\\\\v\",\n        \"\\f\": \"\\\\f\",\n        \"\\b\": \"\\\\b\",\n        \"\\r\": \"\\\\r\",\n        \"\\n\": \"\\\\n\",\n        \"\\\\\": \"\\\\\\\\\",\n        \"\\\"\": \"\\\\\\\"\",\n        \"\\u2028\": \"\\\\u2028\",\n        \"\\u2029\": \"\\\\u2029\",\n        \"\\u0085\": \"\\\\u0085\"\n    });\n    function escapeString(s) {\n        s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s;\n        return s;\n        function getReplacement(c) {\n            return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0));\n        }\n    }\n    ts.escapeString = escapeString;\n    function isIntrinsicJsxName(name) {\n        var ch = name.substr(0, 1);\n        return ch.toLowerCase() === ch;\n    }\n    ts.isIntrinsicJsxName = isIntrinsicJsxName;\n    function get16BitUnicodeEscapeSequence(charCode) {\n        var hexCharCode = charCode.toString(16).toUpperCase();\n        var paddedHexCode = (\"0000\" + hexCharCode).slice(-4);\n        return \"\\\\u\" + paddedHexCode;\n    }\n    var nonAsciiCharacters = /[^\\u0000-\\u007F]/g;\n    function escapeNonAsciiCharacters(s) {\n        return nonAsciiCharacters.test(s) ?\n            s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) :\n            s;\n    }\n    ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters;\n    var indentStrings = [\"\", \"    \"];\n    function getIndentString(level) {\n        if (indentStrings[level] === undefined) {\n            indentStrings[level] = getIndentString(level - 1) + indentStrings[1];\n        }\n        return indentStrings[level];\n    }\n    ts.getIndentString = getIndentString;\n    function getIndentSize() {\n        return indentStrings[1].length;\n    }\n    ts.getIndentSize = getIndentSize;\n    function createTextWriter(newLine) {\n        var output;\n        var indent;\n        var lineStart;\n        var lineCount;\n        var linePos;\n        function write(s) {\n            if (s && s.length) {\n                if (lineStart) {\n                    output += getIndentString(indent);\n                    lineStart = false;\n                }\n                output += s;\n            }\n        }\n        function reset() {\n            output = \"\";\n            indent = 0;\n            lineStart = true;\n            lineCount = 0;\n            linePos = 0;\n        }\n        function rawWrite(s) {\n            if (s !== undefined) {\n                if (lineStart) {\n                    lineStart = false;\n                }\n                output += s;\n            }\n        }\n        function writeLiteral(s) {\n            if (s && s.length) {\n                write(s);\n                var lineStartsOfS = ts.computeLineStarts(s);\n                if (lineStartsOfS.length > 1) {\n                    lineCount = lineCount + lineStartsOfS.length - 1;\n                    linePos = output.length - s.length + ts.lastOrUndefined(lineStartsOfS);\n                }\n            }\n        }\n        function writeLine() {\n            if (!lineStart) {\n                output += newLine;\n                lineCount++;\n                linePos = output.length;\n                lineStart = true;\n            }\n        }\n        function writeTextOfNode(text, node) {\n            write(getTextOfNodeFromSourceText(text, node));\n        }\n        reset();\n        return {\n            write: write,\n            rawWrite: rawWrite,\n            writeTextOfNode: writeTextOfNode,\n            writeLiteral: writeLiteral,\n            writeLine: writeLine,\n            increaseIndent: function () { indent++; },\n            decreaseIndent: function () { indent--; },\n            getIndent: function () { return indent; },\n            getTextPos: function () { return output.length; },\n            getLine: function () { return lineCount + 1; },\n            getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; },\n            getText: function () { return output; },\n            isAtStartOfLine: function () { return lineStart; },\n            reset: reset\n        };\n    }\n    ts.createTextWriter = createTextWriter;\n    function getResolvedExternalModuleName(host, file) {\n        return file.moduleName || getExternalModuleNameFromPath(host, file.fileName);\n    }\n    ts.getResolvedExternalModuleName = getResolvedExternalModuleName;\n    function getExternalModuleNameFromDeclaration(host, resolver, declaration) {\n        var file = resolver.getExternalModuleFileFromDeclaration(declaration);\n        if (!file || isDeclarationFile(file)) {\n            return undefined;\n        }\n        return getResolvedExternalModuleName(host, file);\n    }\n    ts.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration;\n    function getExternalModuleNameFromPath(host, fileName) {\n        var getCanonicalFileName = function (f) { return host.getCanonicalFileName(f); };\n        var dir = ts.toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName);\n        var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());\n        var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, false);\n        return ts.removeFileExtension(relativePath);\n    }\n    ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath;\n    function getOwnEmitOutputFilePath(sourceFile, host, extension) {\n        var compilerOptions = host.getCompilerOptions();\n        var emitOutputFilePathWithoutExtension;\n        if (compilerOptions.outDir) {\n            emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir));\n        }\n        else {\n            emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName);\n        }\n        return emitOutputFilePathWithoutExtension + extension;\n    }\n    ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath;\n    function getDeclarationEmitOutputFilePath(sourceFile, host) {\n        var options = host.getCompilerOptions();\n        var outputDir = options.declarationDir || options.outDir;\n        var path = outputDir\n            ? getSourceFilePathInNewDir(sourceFile, host, outputDir)\n            : sourceFile.fileName;\n        return ts.removeFileExtension(path) + \".d.ts\";\n    }\n    ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath;\n    function getSourceFilesToEmit(host, targetSourceFile) {\n        var options = host.getCompilerOptions();\n        if (options.outFile || options.out) {\n            var moduleKind = ts.getEmitModuleKind(options);\n            var moduleEmitEnabled = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System;\n            var sourceFiles = getAllEmittableSourceFiles();\n            return ts.filter(sourceFiles, moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule);\n        }\n        else {\n            var sourceFiles = targetSourceFile === undefined ? getAllEmittableSourceFiles() : [targetSourceFile];\n            return filterSourceFilesInDirectory(sourceFiles, function (file) { return host.isSourceFileFromExternalLibrary(file); });\n        }\n        function getAllEmittableSourceFiles() {\n            return options.noEmitForJsFiles ? ts.filter(host.getSourceFiles(), function (sourceFile) { return !isSourceFileJavaScript(sourceFile); }) : host.getSourceFiles();\n        }\n    }\n    ts.getSourceFilesToEmit = getSourceFilesToEmit;\n    function filterSourceFilesInDirectory(sourceFiles, isSourceFileFromExternalLibrary) {\n        return ts.filter(sourceFiles, function (file) { return shouldEmitInDirectory(file, isSourceFileFromExternalLibrary); });\n    }\n    ts.filterSourceFilesInDirectory = filterSourceFilesInDirectory;\n    function isNonDeclarationFile(sourceFile) {\n        return !isDeclarationFile(sourceFile);\n    }\n    function shouldEmitInDirectory(sourceFile, isSourceFileFromExternalLibrary) {\n        return isNonDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile);\n    }\n    function isBundleEmitNonExternalModule(sourceFile) {\n        return isNonDeclarationFile(sourceFile) && !ts.isExternalModule(sourceFile);\n    }\n    function forEachTransformedEmitFile(host, sourceFiles, action, emitOnlyDtsFiles) {\n        var options = host.getCompilerOptions();\n        if (options.outFile || options.out) {\n            onBundledEmit(sourceFiles);\n        }\n        else {\n            for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) {\n                var sourceFile = sourceFiles_2[_i];\n                if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) {\n                    onSingleFileEmit(host, sourceFile);\n                }\n            }\n        }\n        function onSingleFileEmit(host, sourceFile) {\n            var extension = \".js\";\n            if (options.jsx === 1) {\n                if (isSourceFileJavaScript(sourceFile)) {\n                    if (ts.fileExtensionIs(sourceFile.fileName, \".jsx\")) {\n                        extension = \".jsx\";\n                    }\n                }\n                else if (sourceFile.languageVariant === 1) {\n                    extension = \".jsx\";\n                }\n            }\n            var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension);\n            var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options);\n            var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (options.declaration || emitOnlyDtsFiles) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined;\n            action(jsFilePath, sourceMapFilePath, declarationFilePath, [sourceFile], false);\n        }\n        function onBundledEmit(sourceFiles) {\n            if (sourceFiles.length) {\n                var jsFilePath = options.outFile || options.out;\n                var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options);\n                var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + \".d.ts\" : undefined;\n                action(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, true);\n            }\n        }\n    }\n    ts.forEachTransformedEmitFile = forEachTransformedEmitFile;\n    function getSourceMapFilePath(jsFilePath, options) {\n        return options.sourceMap ? jsFilePath + \".map\" : undefined;\n    }\n    function forEachExpectedEmitFile(host, action, targetSourceFile, emitOnlyDtsFiles) {\n        var options = host.getCompilerOptions();\n        if (options.outFile || options.out) {\n            onBundledEmit(host);\n        }\n        else {\n            var sourceFiles = targetSourceFile === undefined ? getSourceFilesToEmit(host) : [targetSourceFile];\n            for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) {\n                var sourceFile = sourceFiles_3[_i];\n                if (shouldEmitInDirectory(sourceFile, function (file) { return host.isSourceFileFromExternalLibrary(file); })) {\n                    onSingleFileEmit(host, sourceFile);\n                }\n            }\n        }\n        function onSingleFileEmit(host, sourceFile) {\n            var extension = \".js\";\n            if (options.jsx === 1) {\n                if (isSourceFileJavaScript(sourceFile)) {\n                    if (ts.fileExtensionIs(sourceFile.fileName, \".jsx\")) {\n                        extension = \".jsx\";\n                    }\n                }\n                else if (sourceFile.languageVariant === 1) {\n                    extension = \".jsx\";\n                }\n            }\n            var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension);\n            var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined;\n            var emitFileNames = {\n                jsFilePath: jsFilePath,\n                sourceMapFilePath: getSourceMapFilePath(jsFilePath, options),\n                declarationFilePath: declarationFilePath\n            };\n            action(emitFileNames, [sourceFile], false, emitOnlyDtsFiles);\n        }\n        function onBundledEmit(host) {\n            var bundledSources = ts.filter(getSourceFilesToEmit(host), function (sourceFile) { return !isDeclarationFile(sourceFile) &&\n                !host.isSourceFileFromExternalLibrary(sourceFile) &&\n                (!ts.isExternalModule(sourceFile) ||\n                    !!ts.getEmitModuleKind(options)); });\n            if (bundledSources.length) {\n                var jsFilePath = options.outFile || options.out;\n                var emitFileNames = {\n                    jsFilePath: jsFilePath,\n                    sourceMapFilePath: getSourceMapFilePath(jsFilePath, options),\n                    declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + \".d.ts\" : undefined\n                };\n                action(emitFileNames, bundledSources, true, emitOnlyDtsFiles);\n            }\n        }\n    }\n    ts.forEachExpectedEmitFile = forEachExpectedEmitFile;\n    function getSourceFilePathInNewDir(sourceFile, host, newDirPath) {\n        var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory());\n        var commonSourceDirectory = host.getCommonSourceDirectory();\n        var isSourceFileInCommonSourceDirectory = host.getCanonicalFileName(sourceFilePath).indexOf(host.getCanonicalFileName(commonSourceDirectory)) === 0;\n        sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath;\n        return ts.combinePaths(newDirPath, sourceFilePath);\n    }\n    ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir;\n    function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) {\n        host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) {\n            diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));\n        }, sourceFiles);\n    }\n    ts.writeFile = writeFile;\n    function getLineOfLocalPosition(currentSourceFile, pos) {\n        return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line;\n    }\n    ts.getLineOfLocalPosition = getLineOfLocalPosition;\n    function getLineOfLocalPositionFromLineMap(lineMap, pos) {\n        return ts.computeLineAndCharacterOfPosition(lineMap, pos).line;\n    }\n    ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap;\n    function getFirstConstructorWithBody(node) {\n        return ts.forEach(node.members, function (member) {\n            if (member.kind === 150 && nodeIsPresent(member.body)) {\n                return member;\n            }\n        });\n    }\n    ts.getFirstConstructorWithBody = getFirstConstructorWithBody;\n    function getSetAccessorTypeAnnotationNode(accessor) {\n        if (accessor && accessor.parameters.length > 0) {\n            var hasThis = accessor.parameters.length === 2 && parameterIsThisKeyword(accessor.parameters[0]);\n            return accessor.parameters[hasThis ? 1 : 0].type;\n        }\n    }\n    ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode;\n    function getThisParameter(signature) {\n        if (signature.parameters.length) {\n            var thisParameter = signature.parameters[0];\n            if (parameterIsThisKeyword(thisParameter)) {\n                return thisParameter;\n            }\n        }\n    }\n    ts.getThisParameter = getThisParameter;\n    function parameterIsThisKeyword(parameter) {\n        return isThisIdentifier(parameter.name);\n    }\n    ts.parameterIsThisKeyword = parameterIsThisKeyword;\n    function isThisIdentifier(node) {\n        return node && node.kind === 70 && identifierIsThisKeyword(node);\n    }\n    ts.isThisIdentifier = isThisIdentifier;\n    function identifierIsThisKeyword(id) {\n        return id.originalKeywordKind === 98;\n    }\n    ts.identifierIsThisKeyword = identifierIsThisKeyword;\n    function getAllAccessorDeclarations(declarations, accessor) {\n        var firstAccessor;\n        var secondAccessor;\n        var getAccessor;\n        var setAccessor;\n        if (hasDynamicName(accessor)) {\n            firstAccessor = accessor;\n            if (accessor.kind === 151) {\n                getAccessor = accessor;\n            }\n            else if (accessor.kind === 152) {\n                setAccessor = accessor;\n            }\n            else {\n                ts.Debug.fail(\"Accessor has wrong kind\");\n            }\n        }\n        else {\n            ts.forEach(declarations, function (member) {\n                if ((member.kind === 151 || member.kind === 152)\n                    && hasModifier(member, 32) === hasModifier(accessor, 32)) {\n                    var memberName = getPropertyNameForPropertyNameNode(member.name);\n                    var accessorName = getPropertyNameForPropertyNameNode(accessor.name);\n                    if (memberName === accessorName) {\n                        if (!firstAccessor) {\n                            firstAccessor = member;\n                        }\n                        else if (!secondAccessor) {\n                            secondAccessor = member;\n                        }\n                        if (member.kind === 151 && !getAccessor) {\n                            getAccessor = member;\n                        }\n                        if (member.kind === 152 && !setAccessor) {\n                            setAccessor = member;\n                        }\n                    }\n                }\n            });\n        }\n        return {\n            firstAccessor: firstAccessor,\n            secondAccessor: secondAccessor,\n            getAccessor: getAccessor,\n            setAccessor: setAccessor\n        };\n    }\n    ts.getAllAccessorDeclarations = getAllAccessorDeclarations;\n    function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) {\n        emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, node.pos, leadingComments);\n    }\n    ts.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments;\n    function emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, pos, leadingComments) {\n        if (leadingComments && leadingComments.length && pos !== leadingComments[0].pos &&\n            getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) {\n            writer.writeLine();\n        }\n    }\n    ts.emitNewLineBeforeLeadingCommentsOfPosition = emitNewLineBeforeLeadingCommentsOfPosition;\n    function emitNewLineBeforeLeadingCommentOfPosition(lineMap, writer, pos, commentPos) {\n        if (pos !== commentPos &&\n            getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, commentPos)) {\n            writer.writeLine();\n        }\n    }\n    ts.emitNewLineBeforeLeadingCommentOfPosition = emitNewLineBeforeLeadingCommentOfPosition;\n    function emitComments(text, lineMap, writer, comments, leadingSeparator, trailingSeparator, newLine, writeComment) {\n        if (comments && comments.length > 0) {\n            if (leadingSeparator) {\n                writer.write(\" \");\n            }\n            var emitInterveningSeparator = false;\n            for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) {\n                var comment = comments_1[_i];\n                if (emitInterveningSeparator) {\n                    writer.write(\" \");\n                    emitInterveningSeparator = false;\n                }\n                writeComment(text, lineMap, writer, comment.pos, comment.end, newLine);\n                if (comment.hasTrailingNewLine) {\n                    writer.writeLine();\n                }\n                else {\n                    emitInterveningSeparator = true;\n                }\n            }\n            if (emitInterveningSeparator && trailingSeparator) {\n                writer.write(\" \");\n            }\n        }\n    }\n    ts.emitComments = emitComments;\n    function emitDetachedComments(text, lineMap, writer, writeComment, node, newLine, removeComments) {\n        var leadingComments;\n        var currentDetachedCommentInfo;\n        if (removeComments) {\n            if (node.pos === 0) {\n                leadingComments = ts.filter(ts.getLeadingCommentRanges(text, node.pos), isPinnedComment);\n            }\n        }\n        else {\n            leadingComments = ts.getLeadingCommentRanges(text, node.pos);\n        }\n        if (leadingComments) {\n            var detachedComments = [];\n            var lastComment = void 0;\n            for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) {\n                var comment = leadingComments_1[_i];\n                if (lastComment) {\n                    var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end);\n                    var commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos);\n                    if (commentLine >= lastCommentLine + 2) {\n                        break;\n                    }\n                }\n                detachedComments.push(comment);\n                lastComment = comment;\n            }\n            if (detachedComments.length) {\n                var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, ts.lastOrUndefined(detachedComments).end);\n                var nodeLine = getLineOfLocalPositionFromLineMap(lineMap, ts.skipTrivia(text, node.pos));\n                if (nodeLine >= lastCommentLine + 2) {\n                    emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments);\n                    emitComments(text, lineMap, writer, detachedComments, false, true, newLine, writeComment);\n                    currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end };\n                }\n            }\n        }\n        return currentDetachedCommentInfo;\n        function isPinnedComment(comment) {\n            return text.charCodeAt(comment.pos + 1) === 42 &&\n                text.charCodeAt(comment.pos + 2) === 33;\n        }\n    }\n    ts.emitDetachedComments = emitDetachedComments;\n    function writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine) {\n        if (text.charCodeAt(commentPos + 1) === 42) {\n            var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, commentPos);\n            var lineCount = lineMap.length;\n            var firstCommentLineIndent = void 0;\n            for (var pos = commentPos, currentLine = firstCommentLineAndCharacter.line; pos < commentEnd; currentLine++) {\n                var nextLineStart = (currentLine + 1) === lineCount\n                    ? text.length + 1\n                    : lineMap[currentLine + 1];\n                if (pos !== commentPos) {\n                    if (firstCommentLineIndent === undefined) {\n                        firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], commentPos);\n                    }\n                    var currentWriterIndentSpacing = writer.getIndent() * getIndentSize();\n                    var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart);\n                    if (spacesToEmit > 0) {\n                        var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize();\n                        var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize());\n                        writer.rawWrite(indentSizeSpaceString);\n                        while (numberOfSingleSpacesToEmit) {\n                            writer.rawWrite(\" \");\n                            numberOfSingleSpacesToEmit--;\n                        }\n                    }\n                    else {\n                        writer.rawWrite(\"\");\n                    }\n                }\n                writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart);\n                pos = nextLineStart;\n            }\n        }\n        else {\n            writer.write(text.substring(commentPos, commentEnd));\n        }\n    }\n    ts.writeCommentRange = writeCommentRange;\n    function writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart) {\n        var end = Math.min(commentEnd, nextLineStart - 1);\n        var currentLineText = text.substring(pos, end).replace(/^\\s+|\\s+$/g, \"\");\n        if (currentLineText) {\n            writer.write(currentLineText);\n            if (end !== commentEnd) {\n                writer.writeLine();\n            }\n        }\n        else {\n            writer.writeLiteral(newLine);\n        }\n    }\n    function calculateIndent(text, pos, end) {\n        var currentLineIndent = 0;\n        for (; pos < end && ts.isWhiteSpaceSingleLine(text.charCodeAt(pos)); pos++) {\n            if (text.charCodeAt(pos) === 9) {\n                currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize());\n            }\n            else {\n                currentLineIndent++;\n            }\n        }\n        return currentLineIndent;\n    }\n    function hasModifiers(node) {\n        return getModifierFlags(node) !== 0;\n    }\n    ts.hasModifiers = hasModifiers;\n    function hasModifier(node, flags) {\n        return (getModifierFlags(node) & flags) !== 0;\n    }\n    ts.hasModifier = hasModifier;\n    function getModifierFlags(node) {\n        if (node.modifierFlagsCache & 536870912) {\n            return node.modifierFlagsCache & ~536870912;\n        }\n        var flags = 0;\n        if (node.modifiers) {\n            for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {\n                var modifier = _a[_i];\n                flags |= modifierToFlag(modifier.kind);\n            }\n        }\n        if (node.flags & 4 || (node.kind === 70 && node.isInJSDocNamespace)) {\n            flags |= 1;\n        }\n        node.modifierFlagsCache = flags | 536870912;\n        return flags;\n    }\n    ts.getModifierFlags = getModifierFlags;\n    function modifierToFlag(token) {\n        switch (token) {\n            case 114: return 32;\n            case 113: return 4;\n            case 112: return 16;\n            case 111: return 8;\n            case 116: return 128;\n            case 83: return 1;\n            case 123: return 2;\n            case 75: return 2048;\n            case 78: return 512;\n            case 119: return 256;\n            case 130: return 64;\n        }\n        return 0;\n    }\n    ts.modifierToFlag = modifierToFlag;\n    function isLogicalOperator(token) {\n        return token === 53\n            || token === 52\n            || token === 50;\n    }\n    ts.isLogicalOperator = isLogicalOperator;\n    function isAssignmentOperator(token) {\n        return token >= 57 && token <= 69;\n    }\n    ts.isAssignmentOperator = isAssignmentOperator;\n    function tryGetClassExtendingExpressionWithTypeArguments(node) {\n        if (node.kind === 199 &&\n            node.parent.token === 84 &&\n            isClassLike(node.parent.parent)) {\n            return node.parent.parent;\n        }\n    }\n    ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments;\n    function isAssignmentExpression(node, excludeCompoundAssignment) {\n        return isBinaryExpression(node)\n            && (excludeCompoundAssignment\n                ? node.operatorToken.kind === 57\n                : isAssignmentOperator(node.operatorToken.kind))\n            && isLeftHandSideExpression(node.left);\n    }\n    ts.isAssignmentExpression = isAssignmentExpression;\n    function isDestructuringAssignment(node) {\n        if (isAssignmentExpression(node, true)) {\n            var kind = node.left.kind;\n            return kind === 176\n                || kind === 175;\n        }\n        return false;\n    }\n    ts.isDestructuringAssignment = isDestructuringAssignment;\n    function isSupportedExpressionWithTypeArguments(node) {\n        return isSupportedExpressionWithTypeArgumentsRest(node.expression);\n    }\n    ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments;\n    function isSupportedExpressionWithTypeArgumentsRest(node) {\n        if (node.kind === 70) {\n            return true;\n        }\n        else if (isPropertyAccessExpression(node)) {\n            return isSupportedExpressionWithTypeArgumentsRest(node.expression);\n        }\n        else {\n            return false;\n        }\n    }\n    function isExpressionWithTypeArgumentsInClassExtendsClause(node) {\n        return tryGetClassExtendingExpressionWithTypeArguments(node) !== undefined;\n    }\n    ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause;\n    function isEntityNameExpression(node) {\n        return node.kind === 70 ||\n            node.kind === 177 && isEntityNameExpression(node.expression);\n    }\n    ts.isEntityNameExpression = isEntityNameExpression;\n    function isRightSideOfQualifiedNameOrPropertyAccess(node) {\n        return (node.parent.kind === 141 && node.parent.right === node) ||\n            (node.parent.kind === 177 && node.parent.name === node);\n    }\n    ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;\n    function isEmptyObjectLiteralOrArrayLiteral(expression) {\n        var kind = expression.kind;\n        if (kind === 176) {\n            return expression.properties.length === 0;\n        }\n        if (kind === 175) {\n            return expression.elements.length === 0;\n        }\n        return false;\n    }\n    ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral;\n    function getLocalSymbolForExportDefault(symbol) {\n        return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512) ? symbol.valueDeclaration.localSymbol : undefined;\n    }\n    ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault;\n    function tryExtractTypeScriptExtension(fileName) {\n        return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); });\n    }\n    ts.tryExtractTypeScriptExtension = tryExtractTypeScriptExtension;\n    function getExpandedCharCodes(input) {\n        var output = [];\n        var length = input.length;\n        for (var i = 0; i < length; i++) {\n            var charCode = input.charCodeAt(i);\n            if (charCode < 0x80) {\n                output.push(charCode);\n            }\n            else if (charCode < 0x800) {\n                output.push((charCode >> 6) | 192);\n                output.push((charCode & 63) | 128);\n            }\n            else if (charCode < 0x10000) {\n                output.push((charCode >> 12) | 224);\n                output.push(((charCode >> 6) & 63) | 128);\n                output.push((charCode & 63) | 128);\n            }\n            else if (charCode < 0x20000) {\n                output.push((charCode >> 18) | 240);\n                output.push(((charCode >> 12) & 63) | 128);\n                output.push(((charCode >> 6) & 63) | 128);\n                output.push((charCode & 63) | 128);\n            }\n            else {\n                ts.Debug.assert(false, \"Unexpected code point\");\n            }\n        }\n        return output;\n    }\n    ts.stringify = typeof JSON !== \"undefined\" && JSON.stringify\n        ? JSON.stringify\n        : stringifyFallback;\n    function stringifyFallback(value) {\n        return value === undefined ? undefined : stringifyValue(value);\n    }\n    function stringifyValue(value) {\n        return typeof value === \"string\" ? \"\\\"\" + escapeString(value) + \"\\\"\"\n            : typeof value === \"number\" ? isFinite(value) ? String(value) : \"null\"\n                : typeof value === \"boolean\" ? value ? \"true\" : \"false\"\n                    : typeof value === \"object\" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value)\n                        : \"null\";\n    }\n    function cycleCheck(cb, value) {\n        ts.Debug.assert(!value.hasOwnProperty(\"__cycle\"), \"Converting circular structure to JSON\");\n        value.__cycle = true;\n        var result = cb(value);\n        delete value.__cycle;\n        return result;\n    }\n    function stringifyArray(value) {\n        return \"[\" + ts.reduceLeft(value, stringifyElement, \"\") + \"]\";\n    }\n    function stringifyElement(memo, value) {\n        return (memo ? memo + \",\" : memo) + stringifyValue(value);\n    }\n    function stringifyObject(value) {\n        return \"{\" + ts.reduceOwnProperties(value, stringifyProperty, \"\") + \"}\";\n    }\n    function stringifyProperty(memo, value, key) {\n        return value === undefined || typeof value === \"function\" || key === \"__cycle\" ? memo\n            : (memo ? memo + \",\" : memo) + (\"\\\"\" + escapeString(key) + \"\\\":\" + stringifyValue(value));\n    }\n    var base64Digits = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n    function convertToBase64(input) {\n        var result = \"\";\n        var charCodes = getExpandedCharCodes(input);\n        var i = 0;\n        var length = charCodes.length;\n        var byte1, byte2, byte3, byte4;\n        while (i < length) {\n            byte1 = charCodes[i] >> 2;\n            byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4;\n            byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6;\n            byte4 = charCodes[i + 2] & 63;\n            if (i + 1 >= length) {\n                byte3 = byte4 = 64;\n            }\n            else if (i + 2 >= length) {\n                byte4 = 64;\n            }\n            result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4);\n            i += 3;\n        }\n        return result;\n    }\n    ts.convertToBase64 = convertToBase64;\n    var carriageReturnLineFeed = \"\\r\\n\";\n    var lineFeed = \"\\n\";\n    function getNewLineCharacter(options) {\n        if (options.newLine === 0) {\n            return carriageReturnLineFeed;\n        }\n        else if (options.newLine === 1) {\n            return lineFeed;\n        }\n        else if (ts.sys) {\n            return ts.sys.newLine;\n        }\n        return carriageReturnLineFeed;\n    }\n    ts.getNewLineCharacter = getNewLineCharacter;\n    function isSimpleExpression(node) {\n        return isSimpleExpressionWorker(node, 0);\n    }\n    ts.isSimpleExpression = isSimpleExpression;\n    function isSimpleExpressionWorker(node, depth) {\n        if (depth <= 5) {\n            var kind = node.kind;\n            if (kind === 9\n                || kind === 8\n                || kind === 11\n                || kind === 12\n                || kind === 70\n                || kind === 98\n                || kind === 96\n                || kind === 100\n                || kind === 85\n                || kind === 94) {\n                return true;\n            }\n            else if (kind === 177) {\n                return isSimpleExpressionWorker(node.expression, depth + 1);\n            }\n            else if (kind === 178) {\n                return isSimpleExpressionWorker(node.expression, depth + 1)\n                    && isSimpleExpressionWorker(node.argumentExpression, depth + 1);\n            }\n            else if (kind === 190\n                || kind === 191) {\n                return isSimpleExpressionWorker(node.operand, depth + 1);\n            }\n            else if (kind === 192) {\n                return node.operatorToken.kind !== 39\n                    && isSimpleExpressionWorker(node.left, depth + 1)\n                    && isSimpleExpressionWorker(node.right, depth + 1);\n            }\n            else if (kind === 193) {\n                return isSimpleExpressionWorker(node.condition, depth + 1)\n                    && isSimpleExpressionWorker(node.whenTrue, depth + 1)\n                    && isSimpleExpressionWorker(node.whenFalse, depth + 1);\n            }\n            else if (kind === 188\n                || kind === 187\n                || kind === 186) {\n                return isSimpleExpressionWorker(node.expression, depth + 1);\n            }\n            else if (kind === 175) {\n                return node.elements.length === 0;\n            }\n            else if (kind === 176) {\n                return node.properties.length === 0;\n            }\n            else if (kind === 179) {\n                if (!isSimpleExpressionWorker(node.expression, depth + 1)) {\n                    return false;\n                }\n                for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {\n                    var argument = _a[_i];\n                    if (!isSimpleExpressionWorker(argument, depth + 1)) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n        }\n        return false;\n    }\n    var syntaxKindCache = ts.createMap();\n    function formatSyntaxKind(kind) {\n        var syntaxKindEnum = ts.SyntaxKind;\n        if (syntaxKindEnum) {\n            if (syntaxKindCache[kind]) {\n                return syntaxKindCache[kind];\n            }\n            for (var name_7 in syntaxKindEnum) {\n                if (syntaxKindEnum[name_7] === kind) {\n                    return syntaxKindCache[kind] = kind.toString() + \" (\" + name_7 + \")\";\n                }\n            }\n        }\n        else {\n            return kind.toString();\n        }\n    }\n    ts.formatSyntaxKind = formatSyntaxKind;\n    function movePos(pos, value) {\n        return ts.positionIsSynthesized(pos) ? -1 : pos + value;\n    }\n    ts.movePos = movePos;\n    function createRange(pos, end) {\n        return { pos: pos, end: end };\n    }\n    ts.createRange = createRange;\n    function moveRangeEnd(range, end) {\n        return createRange(range.pos, end);\n    }\n    ts.moveRangeEnd = moveRangeEnd;\n    function moveRangePos(range, pos) {\n        return createRange(pos, range.end);\n    }\n    ts.moveRangePos = moveRangePos;\n    function moveRangePastDecorators(node) {\n        return node.decorators && node.decorators.length > 0\n            ? moveRangePos(node, node.decorators.end)\n            : node;\n    }\n    ts.moveRangePastDecorators = moveRangePastDecorators;\n    function moveRangePastModifiers(node) {\n        return node.modifiers && node.modifiers.length > 0\n            ? moveRangePos(node, node.modifiers.end)\n            : moveRangePastDecorators(node);\n    }\n    ts.moveRangePastModifiers = moveRangePastModifiers;\n    function isCollapsedRange(range) {\n        return range.pos === range.end;\n    }\n    ts.isCollapsedRange = isCollapsedRange;\n    function collapseRangeToStart(range) {\n        return isCollapsedRange(range) ? range : moveRangeEnd(range, range.pos);\n    }\n    ts.collapseRangeToStart = collapseRangeToStart;\n    function collapseRangeToEnd(range) {\n        return isCollapsedRange(range) ? range : moveRangePos(range, range.end);\n    }\n    ts.collapseRangeToEnd = collapseRangeToEnd;\n    function createTokenRange(pos, token) {\n        return createRange(pos, pos + ts.tokenToString(token).length);\n    }\n    ts.createTokenRange = createTokenRange;\n    function rangeIsOnSingleLine(range, sourceFile) {\n        return rangeStartIsOnSameLineAsRangeEnd(range, range, sourceFile);\n    }\n    ts.rangeIsOnSingleLine = rangeIsOnSingleLine;\n    function rangeStartPositionsAreOnSameLine(range1, range2, sourceFile) {\n        return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), getStartPositionOfRange(range2, sourceFile), sourceFile);\n    }\n    ts.rangeStartPositionsAreOnSameLine = rangeStartPositionsAreOnSameLine;\n    function rangeEndPositionsAreOnSameLine(range1, range2, sourceFile) {\n        return positionsAreOnSameLine(range1.end, range2.end, sourceFile);\n    }\n    ts.rangeEndPositionsAreOnSameLine = rangeEndPositionsAreOnSameLine;\n    function rangeStartIsOnSameLineAsRangeEnd(range1, range2, sourceFile) {\n        return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), range2.end, sourceFile);\n    }\n    ts.rangeStartIsOnSameLineAsRangeEnd = rangeStartIsOnSameLineAsRangeEnd;\n    function rangeEndIsOnSameLineAsRangeStart(range1, range2, sourceFile) {\n        return positionsAreOnSameLine(range1.end, getStartPositionOfRange(range2, sourceFile), sourceFile);\n    }\n    ts.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart;\n    function positionsAreOnSameLine(pos1, pos2, sourceFile) {\n        return pos1 === pos2 ||\n            getLineOfLocalPosition(sourceFile, pos1) === getLineOfLocalPosition(sourceFile, pos2);\n    }\n    ts.positionsAreOnSameLine = positionsAreOnSameLine;\n    function getStartPositionOfRange(range, sourceFile) {\n        return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos);\n    }\n    ts.getStartPositionOfRange = getStartPositionOfRange;\n    function isDeclarationNameOfEnumOrNamespace(node) {\n        var parseNode = getParseTreeNode(node);\n        if (parseNode) {\n            switch (parseNode.parent.kind) {\n                case 229:\n                case 230:\n                    return parseNode === parseNode.parent.name;\n            }\n        }\n        return false;\n    }\n    ts.isDeclarationNameOfEnumOrNamespace = isDeclarationNameOfEnumOrNamespace;\n    function getInitializedVariables(node) {\n        return ts.filter(node.declarations, isInitializedVariable);\n    }\n    ts.getInitializedVariables = getInitializedVariables;\n    function isInitializedVariable(node) {\n        return node.initializer !== undefined;\n    }\n    function isMergedWithClass(node) {\n        if (node.symbol) {\n            for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) {\n                var declaration = _a[_i];\n                if (declaration.kind === 226 && declaration !== node) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n    ts.isMergedWithClass = isMergedWithClass;\n    function isFirstDeclarationOfKind(node, kind) {\n        return node.symbol && getDeclarationOfKind(node.symbol, kind) === node;\n    }\n    ts.isFirstDeclarationOfKind = isFirstDeclarationOfKind;\n    function isNodeArray(array) {\n        return array.hasOwnProperty(\"pos\")\n            && array.hasOwnProperty(\"end\");\n    }\n    ts.isNodeArray = isNodeArray;\n    function isNoSubstitutionTemplateLiteral(node) {\n        return node.kind === 12;\n    }\n    ts.isNoSubstitutionTemplateLiteral = isNoSubstitutionTemplateLiteral;\n    function isLiteralKind(kind) {\n        return 8 <= kind && kind <= 12;\n    }\n    ts.isLiteralKind = isLiteralKind;\n    function isTextualLiteralKind(kind) {\n        return kind === 9 || kind === 12;\n    }\n    ts.isTextualLiteralKind = isTextualLiteralKind;\n    function isLiteralExpression(node) {\n        return isLiteralKind(node.kind);\n    }\n    ts.isLiteralExpression = isLiteralExpression;\n    function isTemplateLiteralKind(kind) {\n        return 12 <= kind && kind <= 15;\n    }\n    ts.isTemplateLiteralKind = isTemplateLiteralKind;\n    function isTemplateHead(node) {\n        return node.kind === 13;\n    }\n    ts.isTemplateHead = isTemplateHead;\n    function isTemplateMiddleOrTemplateTail(node) {\n        var kind = node.kind;\n        return kind === 14\n            || kind === 15;\n    }\n    ts.isTemplateMiddleOrTemplateTail = isTemplateMiddleOrTemplateTail;\n    function isIdentifier(node) {\n        return node.kind === 70;\n    }\n    ts.isIdentifier = isIdentifier;\n    function isGeneratedIdentifier(node) {\n        return isIdentifier(node) && node.autoGenerateKind > 0;\n    }\n    ts.isGeneratedIdentifier = isGeneratedIdentifier;\n    function isModifier(node) {\n        return isModifierKind(node.kind);\n    }\n    ts.isModifier = isModifier;\n    function isQualifiedName(node) {\n        return node.kind === 141;\n    }\n    ts.isQualifiedName = isQualifiedName;\n    function isComputedPropertyName(node) {\n        return node.kind === 142;\n    }\n    ts.isComputedPropertyName = isComputedPropertyName;\n    function isEntityName(node) {\n        var kind = node.kind;\n        return kind === 141\n            || kind === 70;\n    }\n    ts.isEntityName = isEntityName;\n    function isPropertyName(node) {\n        var kind = node.kind;\n        return kind === 70\n            || kind === 9\n            || kind === 8\n            || kind === 142;\n    }\n    ts.isPropertyName = isPropertyName;\n    function isModuleName(node) {\n        var kind = node.kind;\n        return kind === 70\n            || kind === 9;\n    }\n    ts.isModuleName = isModuleName;\n    function isBindingName(node) {\n        var kind = node.kind;\n        return kind === 70\n            || kind === 172\n            || kind === 173;\n    }\n    ts.isBindingName = isBindingName;\n    function isTypeParameter(node) {\n        return node.kind === 143;\n    }\n    ts.isTypeParameter = isTypeParameter;\n    function isParameter(node) {\n        return node.kind === 144;\n    }\n    ts.isParameter = isParameter;\n    function isDecorator(node) {\n        return node.kind === 145;\n    }\n    ts.isDecorator = isDecorator;\n    function isMethodDeclaration(node) {\n        return node.kind === 149;\n    }\n    ts.isMethodDeclaration = isMethodDeclaration;\n    function isClassElement(node) {\n        var kind = node.kind;\n        return kind === 150\n            || kind === 147\n            || kind === 149\n            || kind === 151\n            || kind === 152\n            || kind === 155\n            || kind === 203;\n    }\n    ts.isClassElement = isClassElement;\n    function isObjectLiteralElementLike(node) {\n        var kind = node.kind;\n        return kind === 257\n            || kind === 258\n            || kind === 259\n            || kind === 149\n            || kind === 151\n            || kind === 152\n            || kind === 244;\n    }\n    ts.isObjectLiteralElementLike = isObjectLiteralElementLike;\n    function isTypeNodeKind(kind) {\n        return (kind >= 156 && kind <= 171)\n            || kind === 118\n            || kind === 132\n            || kind === 121\n            || kind === 134\n            || kind === 135\n            || kind === 104\n            || kind === 129\n            || kind === 199;\n    }\n    function isTypeNode(node) {\n        return isTypeNodeKind(node.kind);\n    }\n    ts.isTypeNode = isTypeNode;\n    function isArrayBindingPattern(node) {\n        return node.kind === 173;\n    }\n    ts.isArrayBindingPattern = isArrayBindingPattern;\n    function isObjectBindingPattern(node) {\n        return node.kind === 172;\n    }\n    ts.isObjectBindingPattern = isObjectBindingPattern;\n    function isBindingPattern(node) {\n        if (node) {\n            var kind = node.kind;\n            return kind === 173\n                || kind === 172;\n        }\n        return false;\n    }\n    ts.isBindingPattern = isBindingPattern;\n    function isAssignmentPattern(node) {\n        var kind = node.kind;\n        return kind === 175\n            || kind === 176;\n    }\n    ts.isAssignmentPattern = isAssignmentPattern;\n    function isBindingElement(node) {\n        return node.kind === 174;\n    }\n    ts.isBindingElement = isBindingElement;\n    function isArrayBindingElement(node) {\n        var kind = node.kind;\n        return kind === 174\n            || kind === 198;\n    }\n    ts.isArrayBindingElement = isArrayBindingElement;\n    function isDeclarationBindingElement(bindingElement) {\n        switch (bindingElement.kind) {\n            case 223:\n            case 144:\n            case 174:\n                return true;\n        }\n        return false;\n    }\n    ts.isDeclarationBindingElement = isDeclarationBindingElement;\n    function isBindingOrAssignmentPattern(node) {\n        return isObjectBindingOrAssignmentPattern(node)\n            || isArrayBindingOrAssignmentPattern(node);\n    }\n    ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern;\n    function isObjectBindingOrAssignmentPattern(node) {\n        switch (node.kind) {\n            case 172:\n            case 176:\n                return true;\n        }\n        return false;\n    }\n    ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern;\n    function isArrayBindingOrAssignmentPattern(node) {\n        switch (node.kind) {\n            case 173:\n            case 175:\n                return true;\n        }\n        return false;\n    }\n    ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern;\n    function isArrayLiteralExpression(node) {\n        return node.kind === 175;\n    }\n    ts.isArrayLiteralExpression = isArrayLiteralExpression;\n    function isObjectLiteralExpression(node) {\n        return node.kind === 176;\n    }\n    ts.isObjectLiteralExpression = isObjectLiteralExpression;\n    function isPropertyAccessExpression(node) {\n        return node.kind === 177;\n    }\n    ts.isPropertyAccessExpression = isPropertyAccessExpression;\n    function isElementAccessExpression(node) {\n        return node.kind === 178;\n    }\n    ts.isElementAccessExpression = isElementAccessExpression;\n    function isBinaryExpression(node) {\n        return node.kind === 192;\n    }\n    ts.isBinaryExpression = isBinaryExpression;\n    function isConditionalExpression(node) {\n        return node.kind === 193;\n    }\n    ts.isConditionalExpression = isConditionalExpression;\n    function isCallExpression(node) {\n        return node.kind === 179;\n    }\n    ts.isCallExpression = isCallExpression;\n    function isTemplateLiteral(node) {\n        var kind = node.kind;\n        return kind === 194\n            || kind === 12;\n    }\n    ts.isTemplateLiteral = isTemplateLiteral;\n    function isSpreadExpression(node) {\n        return node.kind === 196;\n    }\n    ts.isSpreadExpression = isSpreadExpression;\n    function isExpressionWithTypeArguments(node) {\n        return node.kind === 199;\n    }\n    ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments;\n    function isLeftHandSideExpressionKind(kind) {\n        return kind === 177\n            || kind === 178\n            || kind === 180\n            || kind === 179\n            || kind === 246\n            || kind === 247\n            || kind === 181\n            || kind === 175\n            || kind === 183\n            || kind === 176\n            || kind === 197\n            || kind === 184\n            || kind === 70\n            || kind === 11\n            || kind === 8\n            || kind === 9\n            || kind === 12\n            || kind === 194\n            || kind === 85\n            || kind === 94\n            || kind === 98\n            || kind === 100\n            || kind === 96\n            || kind === 201\n            || kind === 297;\n    }\n    function isLeftHandSideExpression(node) {\n        return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);\n    }\n    ts.isLeftHandSideExpression = isLeftHandSideExpression;\n    function isUnaryExpressionKind(kind) {\n        return kind === 190\n            || kind === 191\n            || kind === 186\n            || kind === 187\n            || kind === 188\n            || kind === 189\n            || kind === 182\n            || isLeftHandSideExpressionKind(kind);\n    }\n    function isUnaryExpression(node) {\n        return isUnaryExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);\n    }\n    ts.isUnaryExpression = isUnaryExpression;\n    function isExpressionKind(kind) {\n        return kind === 193\n            || kind === 195\n            || kind === 185\n            || kind === 192\n            || kind === 196\n            || kind === 200\n            || kind === 198\n            || kind === 297\n            || isUnaryExpressionKind(kind);\n    }\n    function isExpression(node) {\n        return isExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);\n    }\n    ts.isExpression = isExpression;\n    function isAssertionExpression(node) {\n        var kind = node.kind;\n        return kind === 182\n            || kind === 200;\n    }\n    ts.isAssertionExpression = isAssertionExpression;\n    function isPartiallyEmittedExpression(node) {\n        return node.kind === 294;\n    }\n    ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;\n    function isNotEmittedStatement(node) {\n        return node.kind === 293;\n    }\n    ts.isNotEmittedStatement = isNotEmittedStatement;\n    function isNotEmittedOrPartiallyEmittedNode(node) {\n        return isNotEmittedStatement(node)\n            || isPartiallyEmittedExpression(node);\n    }\n    ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode;\n    function isOmittedExpression(node) {\n        return node.kind === 198;\n    }\n    ts.isOmittedExpression = isOmittedExpression;\n    function isTemplateSpan(node) {\n        return node.kind === 202;\n    }\n    ts.isTemplateSpan = isTemplateSpan;\n    function isBlock(node) {\n        return node.kind === 204;\n    }\n    ts.isBlock = isBlock;\n    function isConciseBody(node) {\n        return isBlock(node)\n            || isExpression(node);\n    }\n    ts.isConciseBody = isConciseBody;\n    function isFunctionBody(node) {\n        return isBlock(node);\n    }\n    ts.isFunctionBody = isFunctionBody;\n    function isForInitializer(node) {\n        return isVariableDeclarationList(node)\n            || isExpression(node);\n    }\n    ts.isForInitializer = isForInitializer;\n    function isVariableDeclaration(node) {\n        return node.kind === 223;\n    }\n    ts.isVariableDeclaration = isVariableDeclaration;\n    function isVariableDeclarationList(node) {\n        return node.kind === 224;\n    }\n    ts.isVariableDeclarationList = isVariableDeclarationList;\n    function isCaseBlock(node) {\n        return node.kind === 232;\n    }\n    ts.isCaseBlock = isCaseBlock;\n    function isModuleBody(node) {\n        var kind = node.kind;\n        return kind === 231\n            || kind === 230;\n    }\n    ts.isModuleBody = isModuleBody;\n    function isImportEqualsDeclaration(node) {\n        return node.kind === 234;\n    }\n    ts.isImportEqualsDeclaration = isImportEqualsDeclaration;\n    function isImportClause(node) {\n        return node.kind === 236;\n    }\n    ts.isImportClause = isImportClause;\n    function isNamedImportBindings(node) {\n        var kind = node.kind;\n        return kind === 238\n            || kind === 237;\n    }\n    ts.isNamedImportBindings = isNamedImportBindings;\n    function isImportSpecifier(node) {\n        return node.kind === 239;\n    }\n    ts.isImportSpecifier = isImportSpecifier;\n    function isNamedExports(node) {\n        return node.kind === 242;\n    }\n    ts.isNamedExports = isNamedExports;\n    function isExportSpecifier(node) {\n        return node.kind === 243;\n    }\n    ts.isExportSpecifier = isExportSpecifier;\n    function isModuleOrEnumDeclaration(node) {\n        return node.kind === 230 || node.kind === 229;\n    }\n    ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration;\n    function isDeclarationKind(kind) {\n        return kind === 185\n            || kind === 174\n            || kind === 226\n            || kind === 197\n            || kind === 150\n            || kind === 229\n            || kind === 260\n            || kind === 243\n            || kind === 225\n            || kind === 184\n            || kind === 151\n            || kind === 236\n            || kind === 234\n            || kind === 239\n            || kind === 227\n            || kind === 149\n            || kind === 148\n            || kind === 230\n            || kind === 233\n            || kind === 237\n            || kind === 144\n            || kind === 257\n            || kind === 147\n            || kind === 146\n            || kind === 152\n            || kind === 258\n            || kind === 228\n            || kind === 143\n            || kind === 223\n            || kind === 285;\n    }\n    function isDeclarationStatementKind(kind) {\n        return kind === 225\n            || kind === 244\n            || kind === 226\n            || kind === 227\n            || kind === 228\n            || kind === 229\n            || kind === 230\n            || kind === 235\n            || kind === 234\n            || kind === 241\n            || kind === 240\n            || kind === 233;\n    }\n    function isStatementKindButNotDeclarationKind(kind) {\n        return kind === 215\n            || kind === 214\n            || kind === 222\n            || kind === 209\n            || kind === 207\n            || kind === 206\n            || kind === 212\n            || kind === 213\n            || kind === 211\n            || kind === 208\n            || kind === 219\n            || kind === 216\n            || kind === 218\n            || kind === 220\n            || kind === 221\n            || kind === 205\n            || kind === 210\n            || kind === 217\n            || kind === 293\n            || kind === 296\n            || kind === 295;\n    }\n    function isDeclaration(node) {\n        return isDeclarationKind(node.kind);\n    }\n    ts.isDeclaration = isDeclaration;\n    function isDeclarationStatement(node) {\n        return isDeclarationStatementKind(node.kind);\n    }\n    ts.isDeclarationStatement = isDeclarationStatement;\n    function isStatementButNotDeclaration(node) {\n        return isStatementKindButNotDeclarationKind(node.kind);\n    }\n    ts.isStatementButNotDeclaration = isStatementButNotDeclaration;\n    function isStatement(node) {\n        var kind = node.kind;\n        return isStatementKindButNotDeclarationKind(kind)\n            || isDeclarationStatementKind(kind)\n            || kind === 204;\n    }\n    ts.isStatement = isStatement;\n    function isModuleReference(node) {\n        var kind = node.kind;\n        return kind === 245\n            || kind === 141\n            || kind === 70;\n    }\n    ts.isModuleReference = isModuleReference;\n    function isJsxOpeningElement(node) {\n        return node.kind === 248;\n    }\n    ts.isJsxOpeningElement = isJsxOpeningElement;\n    function isJsxClosingElement(node) {\n        return node.kind === 249;\n    }\n    ts.isJsxClosingElement = isJsxClosingElement;\n    function isJsxTagNameExpression(node) {\n        var kind = node.kind;\n        return kind === 98\n            || kind === 70\n            || kind === 177;\n    }\n    ts.isJsxTagNameExpression = isJsxTagNameExpression;\n    function isJsxChild(node) {\n        var kind = node.kind;\n        return kind === 246\n            || kind === 252\n            || kind === 247\n            || kind === 10;\n    }\n    ts.isJsxChild = isJsxChild;\n    function isJsxAttributeLike(node) {\n        var kind = node.kind;\n        return kind === 250\n            || kind === 251;\n    }\n    ts.isJsxAttributeLike = isJsxAttributeLike;\n    function isJsxSpreadAttribute(node) {\n        return node.kind === 251;\n    }\n    ts.isJsxSpreadAttribute = isJsxSpreadAttribute;\n    function isJsxAttribute(node) {\n        return node.kind === 250;\n    }\n    ts.isJsxAttribute = isJsxAttribute;\n    function isStringLiteralOrJsxExpression(node) {\n        var kind = node.kind;\n        return kind === 9\n            || kind === 252;\n    }\n    ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression;\n    function isCaseOrDefaultClause(node) {\n        var kind = node.kind;\n        return kind === 253\n            || kind === 254;\n    }\n    ts.isCaseOrDefaultClause = isCaseOrDefaultClause;\n    function isHeritageClause(node) {\n        return node.kind === 255;\n    }\n    ts.isHeritageClause = isHeritageClause;\n    function isCatchClause(node) {\n        return node.kind === 256;\n    }\n    ts.isCatchClause = isCatchClause;\n    function isPropertyAssignment(node) {\n        return node.kind === 257;\n    }\n    ts.isPropertyAssignment = isPropertyAssignment;\n    function isShorthandPropertyAssignment(node) {\n        return node.kind === 258;\n    }\n    ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment;\n    function isEnumMember(node) {\n        return node.kind === 260;\n    }\n    ts.isEnumMember = isEnumMember;\n    function isSourceFile(node) {\n        return node.kind === 261;\n    }\n    ts.isSourceFile = isSourceFile;\n    function isWatchSet(options) {\n        return options.watch && options.hasOwnProperty(\"watch\");\n    }\n    ts.isWatchSet = isWatchSet;\n})(ts || (ts = {}));\n(function (ts) {\n    function getDefaultLibFileName(options) {\n        switch (options.target) {\n            case 5:\n            case 4:\n                return \"lib.es2017.d.ts\";\n            case 3:\n                return \"lib.es2016.d.ts\";\n            case 2:\n                return \"lib.es6.d.ts\";\n            default:\n                return \"lib.d.ts\";\n        }\n    }\n    ts.getDefaultLibFileName = getDefaultLibFileName;\n    function textSpanEnd(span) {\n        return span.start + span.length;\n    }\n    ts.textSpanEnd = textSpanEnd;\n    function textSpanIsEmpty(span) {\n        return span.length === 0;\n    }\n    ts.textSpanIsEmpty = textSpanIsEmpty;\n    function textSpanContainsPosition(span, position) {\n        return position >= span.start && position < textSpanEnd(span);\n    }\n    ts.textSpanContainsPosition = textSpanContainsPosition;\n    function textSpanContainsTextSpan(span, other) {\n        return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span);\n    }\n    ts.textSpanContainsTextSpan = textSpanContainsTextSpan;\n    function textSpanOverlapsWith(span, other) {\n        var overlapStart = Math.max(span.start, other.start);\n        var overlapEnd = Math.min(textSpanEnd(span), textSpanEnd(other));\n        return overlapStart < overlapEnd;\n    }\n    ts.textSpanOverlapsWith = textSpanOverlapsWith;\n    function textSpanOverlap(span1, span2) {\n        var overlapStart = Math.max(span1.start, span2.start);\n        var overlapEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2));\n        if (overlapStart < overlapEnd) {\n            return createTextSpanFromBounds(overlapStart, overlapEnd);\n        }\n        return undefined;\n    }\n    ts.textSpanOverlap = textSpanOverlap;\n    function textSpanIntersectsWithTextSpan(span, other) {\n        return other.start <= textSpanEnd(span) && textSpanEnd(other) >= span.start;\n    }\n    ts.textSpanIntersectsWithTextSpan = textSpanIntersectsWithTextSpan;\n    function textSpanIntersectsWith(span, start, length) {\n        var end = start + length;\n        return start <= textSpanEnd(span) && end >= span.start;\n    }\n    ts.textSpanIntersectsWith = textSpanIntersectsWith;\n    function decodedTextSpanIntersectsWith(start1, length1, start2, length2) {\n        var end1 = start1 + length1;\n        var end2 = start2 + length2;\n        return start2 <= end1 && end2 >= start1;\n    }\n    ts.decodedTextSpanIntersectsWith = decodedTextSpanIntersectsWith;\n    function textSpanIntersectsWithPosition(span, position) {\n        return position <= textSpanEnd(span) && position >= span.start;\n    }\n    ts.textSpanIntersectsWithPosition = textSpanIntersectsWithPosition;\n    function textSpanIntersection(span1, span2) {\n        var intersectStart = Math.max(span1.start, span2.start);\n        var intersectEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2));\n        if (intersectStart <= intersectEnd) {\n            return createTextSpanFromBounds(intersectStart, intersectEnd);\n        }\n        return undefined;\n    }\n    ts.textSpanIntersection = textSpanIntersection;\n    function createTextSpan(start, length) {\n        if (start < 0) {\n            throw new Error(\"start < 0\");\n        }\n        if (length < 0) {\n            throw new Error(\"length < 0\");\n        }\n        return { start: start, length: length };\n    }\n    ts.createTextSpan = createTextSpan;\n    function createTextSpanFromBounds(start, end) {\n        return createTextSpan(start, end - start);\n    }\n    ts.createTextSpanFromBounds = createTextSpanFromBounds;\n    function textChangeRangeNewSpan(range) {\n        return createTextSpan(range.span.start, range.newLength);\n    }\n    ts.textChangeRangeNewSpan = textChangeRangeNewSpan;\n    function textChangeRangeIsUnchanged(range) {\n        return textSpanIsEmpty(range.span) && range.newLength === 0;\n    }\n    ts.textChangeRangeIsUnchanged = textChangeRangeIsUnchanged;\n    function createTextChangeRange(span, newLength) {\n        if (newLength < 0) {\n            throw new Error(\"newLength < 0\");\n        }\n        return { span: span, newLength: newLength };\n    }\n    ts.createTextChangeRange = createTextChangeRange;\n    ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0);\n    function collapseTextChangeRangesAcrossMultipleVersions(changes) {\n        if (changes.length === 0) {\n            return ts.unchangedTextChangeRange;\n        }\n        if (changes.length === 1) {\n            return changes[0];\n        }\n        var change0 = changes[0];\n        var oldStartN = change0.span.start;\n        var oldEndN = textSpanEnd(change0.span);\n        var newEndN = oldStartN + change0.newLength;\n        for (var i = 1; i < changes.length; i++) {\n            var nextChange = changes[i];\n            var oldStart1 = oldStartN;\n            var oldEnd1 = oldEndN;\n            var newEnd1 = newEndN;\n            var oldStart2 = nextChange.span.start;\n            var oldEnd2 = textSpanEnd(nextChange.span);\n            var newEnd2 = oldStart2 + nextChange.newLength;\n            oldStartN = Math.min(oldStart1, oldStart2);\n            oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1));\n            newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2));\n        }\n        return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), newEndN - oldStartN);\n    }\n    ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions;\n    function getTypeParameterOwner(d) {\n        if (d && d.kind === 143) {\n            for (var current = d; current; current = current.parent) {\n                if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 227) {\n                    return current;\n                }\n            }\n        }\n    }\n    ts.getTypeParameterOwner = getTypeParameterOwner;\n    function isParameterPropertyDeclaration(node) {\n        return ts.hasModifier(node, 92) && node.parent.kind === 150 && ts.isClassLike(node.parent.parent);\n    }\n    ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;\n    function walkUpBindingElementsAndPatterns(node) {\n        while (node && (node.kind === 174 || ts.isBindingPattern(node))) {\n            node = node.parent;\n        }\n        return node;\n    }\n    function getCombinedModifierFlags(node) {\n        node = walkUpBindingElementsAndPatterns(node);\n        var flags = ts.getModifierFlags(node);\n        if (node.kind === 223) {\n            node = node.parent;\n        }\n        if (node && node.kind === 224) {\n            flags |= ts.getModifierFlags(node);\n            node = node.parent;\n        }\n        if (node && node.kind === 205) {\n            flags |= ts.getModifierFlags(node);\n        }\n        return flags;\n    }\n    ts.getCombinedModifierFlags = getCombinedModifierFlags;\n    function getCombinedNodeFlags(node) {\n        node = walkUpBindingElementsAndPatterns(node);\n        var flags = node.flags;\n        if (node.kind === 223) {\n            node = node.parent;\n        }\n        if (node && node.kind === 224) {\n            flags |= node.flags;\n            node = node.parent;\n        }\n        if (node && node.kind === 205) {\n            flags |= node.flags;\n        }\n        return flags;\n    }\n    ts.getCombinedNodeFlags = getCombinedNodeFlags;\n    function validateLocaleAndSetLanguage(locale, sys, errors) {\n        var matchResult = /^([a-z]+)([_\\-]([a-z]+))?$/.exec(locale.toLowerCase());\n        if (!matchResult) {\n            if (errors) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, \"en\", \"ja-jp\"));\n            }\n            return;\n        }\n        var language = matchResult[1];\n        var territory = matchResult[3];\n        if (!trySetLanguageAndTerritory(language, territory, errors)) {\n            trySetLanguageAndTerritory(language, undefined, errors);\n        }\n        function trySetLanguageAndTerritory(language, territory, errors) {\n            var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath());\n            var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath);\n            var filePath = ts.combinePaths(containingDirectoryPath, language);\n            if (territory) {\n                filePath = filePath + \"-\" + territory;\n            }\n            filePath = sys.resolvePath(ts.combinePaths(filePath, \"diagnosticMessages.generated.json\"));\n            if (!sys.fileExists(filePath)) {\n                return false;\n            }\n            var fileContents = \"\";\n            try {\n                fileContents = sys.readFile(filePath);\n            }\n            catch (e) {\n                if (errors) {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath));\n                }\n                return false;\n            }\n            try {\n                ts.localizedDiagnosticMessages = JSON.parse(fileContents);\n            }\n            catch (e) {\n                if (errors) {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath));\n                }\n                return false;\n            }\n            return true;\n        }\n    }\n    ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var NodeConstructor;\n    var SourceFileConstructor;\n    function createNode(kind, location, flags) {\n        var ConstructorForKind = kind === 261\n            ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))\n            : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()));\n        var node = location\n            ? new ConstructorForKind(kind, location.pos, location.end)\n            : new ConstructorForKind(kind, -1, -1);\n        node.flags = flags | 8;\n        return node;\n    }\n    function updateNode(updated, original) {\n        if (updated !== original) {\n            setOriginalNode(updated, original);\n            if (original.startsOnNewLine) {\n                updated.startsOnNewLine = true;\n            }\n            ts.aggregateTransformFlags(updated);\n        }\n        return updated;\n    }\n    ts.updateNode = updateNode;\n    function createNodeArray(elements, location, hasTrailingComma) {\n        if (elements) {\n            if (ts.isNodeArray(elements)) {\n                return elements;\n            }\n        }\n        else {\n            elements = [];\n        }\n        var array = elements;\n        if (location) {\n            array.pos = location.pos;\n            array.end = location.end;\n        }\n        else {\n            array.pos = -1;\n            array.end = -1;\n        }\n        if (hasTrailingComma) {\n            array.hasTrailingComma = true;\n        }\n        return array;\n    }\n    ts.createNodeArray = createNodeArray;\n    function createSynthesizedNode(kind, startsOnNewLine) {\n        var node = createNode(kind, undefined);\n        node.startsOnNewLine = startsOnNewLine;\n        return node;\n    }\n    ts.createSynthesizedNode = createSynthesizedNode;\n    function createSynthesizedNodeArray(elements) {\n        return createNodeArray(elements, undefined);\n    }\n    ts.createSynthesizedNodeArray = createSynthesizedNodeArray;\n    function getSynthesizedClone(node) {\n        var clone = createNode(node.kind, undefined, node.flags);\n        setOriginalNode(clone, node);\n        for (var key in node) {\n            if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) {\n                continue;\n            }\n            clone[key] = node[key];\n        }\n        return clone;\n    }\n    ts.getSynthesizedClone = getSynthesizedClone;\n    function getMutableClone(node) {\n        var clone = getSynthesizedClone(node);\n        clone.pos = node.pos;\n        clone.end = node.end;\n        clone.parent = node.parent;\n        return clone;\n    }\n    ts.getMutableClone = getMutableClone;\n    function createLiteral(value, location) {\n        if (typeof value === \"number\") {\n            var node = createNode(8, location, undefined);\n            node.text = value.toString();\n            return node;\n        }\n        else if (typeof value === \"boolean\") {\n            return createNode(value ? 100 : 85, location, undefined);\n        }\n        else if (typeof value === \"string\") {\n            var node = createNode(9, location, undefined);\n            node.text = value;\n            return node;\n        }\n        else if (value) {\n            var node = createNode(9, location, undefined);\n            node.textSourceNode = value;\n            node.text = value.text;\n            return node;\n        }\n    }\n    ts.createLiteral = createLiteral;\n    var nextAutoGenerateId = 0;\n    function createIdentifier(text, location) {\n        var node = createNode(70, location);\n        node.text = ts.escapeIdentifier(text);\n        node.originalKeywordKind = ts.stringToToken(text);\n        node.autoGenerateKind = 0;\n        node.autoGenerateId = 0;\n        return node;\n    }\n    ts.createIdentifier = createIdentifier;\n    function createTempVariable(recordTempVariable, location) {\n        var name = createNode(70, location);\n        name.text = \"\";\n        name.originalKeywordKind = 0;\n        name.autoGenerateKind = 1;\n        name.autoGenerateId = nextAutoGenerateId;\n        nextAutoGenerateId++;\n        if (recordTempVariable) {\n            recordTempVariable(name);\n        }\n        return name;\n    }\n    ts.createTempVariable = createTempVariable;\n    function createLoopVariable(location) {\n        var name = createNode(70, location);\n        name.text = \"\";\n        name.originalKeywordKind = 0;\n        name.autoGenerateKind = 2;\n        name.autoGenerateId = nextAutoGenerateId;\n        nextAutoGenerateId++;\n        return name;\n    }\n    ts.createLoopVariable = createLoopVariable;\n    function createUniqueName(text, location) {\n        var name = createNode(70, location);\n        name.text = text;\n        name.originalKeywordKind = 0;\n        name.autoGenerateKind = 3;\n        name.autoGenerateId = nextAutoGenerateId;\n        nextAutoGenerateId++;\n        return name;\n    }\n    ts.createUniqueName = createUniqueName;\n    function getGeneratedNameForNode(node, location) {\n        var name = createNode(70, location);\n        name.original = node;\n        name.text = \"\";\n        name.originalKeywordKind = 0;\n        name.autoGenerateKind = 4;\n        name.autoGenerateId = nextAutoGenerateId;\n        nextAutoGenerateId++;\n        return name;\n    }\n    ts.getGeneratedNameForNode = getGeneratedNameForNode;\n    function createToken(token) {\n        return createNode(token);\n    }\n    ts.createToken = createToken;\n    function createSuper() {\n        var node = createNode(96);\n        return node;\n    }\n    ts.createSuper = createSuper;\n    function createThis(location) {\n        var node = createNode(98, location);\n        return node;\n    }\n    ts.createThis = createThis;\n    function createNull() {\n        var node = createNode(94);\n        return node;\n    }\n    ts.createNull = createNull;\n    function createComputedPropertyName(expression, location) {\n        var node = createNode(142, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createComputedPropertyName = createComputedPropertyName;\n    function updateComputedPropertyName(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createComputedPropertyName(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateComputedPropertyName = updateComputedPropertyName;\n    function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) {\n        var node = createNode(144, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.dotDotDotToken = dotDotDotToken;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.questionToken = questionToken;\n        node.type = type;\n        node.initializer = initializer ? parenthesizeExpressionForList(initializer) : undefined;\n        return node;\n    }\n    ts.createParameter = createParameter;\n    function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) {\n            return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateParameter = updateParameter;\n    function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) {\n        var node = createNode(147, location);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.questionToken = questionToken;\n        node.type = type;\n        node.initializer = initializer;\n        return node;\n    }\n    ts.createProperty = createProperty;\n    function updateProperty(node, decorators, modifiers, name, type, initializer) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) {\n            return updateNode(createProperty(decorators, modifiers, name, node.questionToken, type, initializer, node), node);\n        }\n        return node;\n    }\n    ts.updateProperty = updateProperty;\n    function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {\n        var node = createNode(149, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.asteriskToken = asteriskToken;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = type;\n        node.body = body;\n        return node;\n    }\n    ts.createMethod = createMethod;\n    function updateMethod(node, decorators, modifiers, name, typeParameters, parameters, type, body) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {\n            return updateNode(createMethod(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateMethod = updateMethod;\n    function createConstructor(decorators, modifiers, parameters, body, location, flags) {\n        var node = createNode(150, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.typeParameters = undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = undefined;\n        node.body = body;\n        return node;\n    }\n    ts.createConstructor = createConstructor;\n    function updateConstructor(node, decorators, modifiers, parameters, body) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.parameters !== parameters || node.body !== body) {\n            return updateNode(createConstructor(decorators, modifiers, parameters, body, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateConstructor = updateConstructor;\n    function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) {\n        var node = createNode(151, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.typeParameters = undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = type;\n        node.body = body;\n        return node;\n    }\n    ts.createGetAccessor = createGetAccessor;\n    function updateGetAccessor(node, decorators, modifiers, name, parameters, type, body) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.type !== type || node.body !== body) {\n            return updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateGetAccessor = updateGetAccessor;\n    function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) {\n        var node = createNode(152, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.typeParameters = undefined;\n        node.parameters = createNodeArray(parameters);\n        node.body = body;\n        return node;\n    }\n    ts.createSetAccessor = createSetAccessor;\n    function updateSetAccessor(node, decorators, modifiers, name, parameters, body) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.body !== body) {\n            return updateNode(createSetAccessor(decorators, modifiers, name, parameters, body, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateSetAccessor = updateSetAccessor;\n    function createObjectBindingPattern(elements, location) {\n        var node = createNode(172, location);\n        node.elements = createNodeArray(elements);\n        return node;\n    }\n    ts.createObjectBindingPattern = createObjectBindingPattern;\n    function updateObjectBindingPattern(node, elements) {\n        if (node.elements !== elements) {\n            return updateNode(createObjectBindingPattern(elements, node), node);\n        }\n        return node;\n    }\n    ts.updateObjectBindingPattern = updateObjectBindingPattern;\n    function createArrayBindingPattern(elements, location) {\n        var node = createNode(173, location);\n        node.elements = createNodeArray(elements);\n        return node;\n    }\n    ts.createArrayBindingPattern = createArrayBindingPattern;\n    function updateArrayBindingPattern(node, elements) {\n        if (node.elements !== elements) {\n            return updateNode(createArrayBindingPattern(elements, node), node);\n        }\n        return node;\n    }\n    ts.updateArrayBindingPattern = updateArrayBindingPattern;\n    function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) {\n        var node = createNode(174, location);\n        node.propertyName = typeof propertyName === \"string\" ? createIdentifier(propertyName) : propertyName;\n        node.dotDotDotToken = dotDotDotToken;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.initializer = initializer;\n        return node;\n    }\n    ts.createBindingElement = createBindingElement;\n    function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) {\n        if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) {\n            return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node);\n        }\n        return node;\n    }\n    ts.updateBindingElement = updateBindingElement;\n    function createArrayLiteral(elements, location, multiLine) {\n        var node = createNode(175, location);\n        node.elements = parenthesizeListElements(createNodeArray(elements));\n        if (multiLine) {\n            node.multiLine = true;\n        }\n        return node;\n    }\n    ts.createArrayLiteral = createArrayLiteral;\n    function updateArrayLiteral(node, elements) {\n        if (node.elements !== elements) {\n            return updateNode(createArrayLiteral(elements, node, node.multiLine), node);\n        }\n        return node;\n    }\n    ts.updateArrayLiteral = updateArrayLiteral;\n    function createObjectLiteral(properties, location, multiLine) {\n        var node = createNode(176, location);\n        node.properties = createNodeArray(properties);\n        if (multiLine) {\n            node.multiLine = true;\n        }\n        return node;\n    }\n    ts.createObjectLiteral = createObjectLiteral;\n    function updateObjectLiteral(node, properties) {\n        if (node.properties !== properties) {\n            return updateNode(createObjectLiteral(properties, node, node.multiLine), node);\n        }\n        return node;\n    }\n    ts.updateObjectLiteral = updateObjectLiteral;\n    function createPropertyAccess(expression, name, location, flags) {\n        var node = createNode(177, location, flags);\n        node.expression = parenthesizeForAccess(expression);\n        (node.emitNode || (node.emitNode = {})).flags |= 65536;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        return node;\n    }\n    ts.createPropertyAccess = createPropertyAccess;\n    function updatePropertyAccess(node, expression, name) {\n        if (node.expression !== expression || node.name !== name) {\n            var propertyAccess = createPropertyAccess(expression, name, node, node.flags);\n            (propertyAccess.emitNode || (propertyAccess.emitNode = {})).flags = getEmitFlags(node);\n            return updateNode(propertyAccess, node);\n        }\n        return node;\n    }\n    ts.updatePropertyAccess = updatePropertyAccess;\n    function createElementAccess(expression, index, location) {\n        var node = createNode(178, location);\n        node.expression = parenthesizeForAccess(expression);\n        node.argumentExpression = typeof index === \"number\" ? createLiteral(index) : index;\n        return node;\n    }\n    ts.createElementAccess = createElementAccess;\n    function updateElementAccess(node, expression, argumentExpression) {\n        if (node.expression !== expression || node.argumentExpression !== argumentExpression) {\n            return updateNode(createElementAccess(expression, argumentExpression, node), node);\n        }\n        return node;\n    }\n    ts.updateElementAccess = updateElementAccess;\n    function createCall(expression, typeArguments, argumentsArray, location, flags) {\n        var node = createNode(179, location, flags);\n        node.expression = parenthesizeForAccess(expression);\n        if (typeArguments) {\n            node.typeArguments = createNodeArray(typeArguments);\n        }\n        node.arguments = parenthesizeListElements(createNodeArray(argumentsArray));\n        return node;\n    }\n    ts.createCall = createCall;\n    function updateCall(node, expression, typeArguments, argumentsArray) {\n        if (expression !== node.expression || typeArguments !== node.typeArguments || argumentsArray !== node.arguments) {\n            return updateNode(createCall(expression, typeArguments, argumentsArray, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateCall = updateCall;\n    function createNew(expression, typeArguments, argumentsArray, location, flags) {\n        var node = createNode(180, location, flags);\n        node.expression = parenthesizeForNew(expression);\n        node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined;\n        node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined;\n        return node;\n    }\n    ts.createNew = createNew;\n    function updateNew(node, expression, typeArguments, argumentsArray) {\n        if (node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray) {\n            return updateNode(createNew(expression, typeArguments, argumentsArray, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateNew = updateNew;\n    function createTaggedTemplate(tag, template, location) {\n        var node = createNode(181, location);\n        node.tag = parenthesizeForAccess(tag);\n        node.template = template;\n        return node;\n    }\n    ts.createTaggedTemplate = createTaggedTemplate;\n    function updateTaggedTemplate(node, tag, template) {\n        if (node.tag !== tag || node.template !== template) {\n            return updateNode(createTaggedTemplate(tag, template, node), node);\n        }\n        return node;\n    }\n    ts.updateTaggedTemplate = updateTaggedTemplate;\n    function createParen(expression, location) {\n        var node = createNode(183, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createParen = createParen;\n    function updateParen(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createParen(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateParen = updateParen;\n    function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {\n        var node = createNode(184, location, flags);\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.asteriskToken = asteriskToken;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = type;\n        node.body = body;\n        return node;\n    }\n    ts.createFunctionExpression = createFunctionExpression;\n    function updateFunctionExpression(node, modifiers, name, typeParameters, parameters, type, body) {\n        if (node.name !== name || node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {\n            return updateNode(createFunctionExpression(modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateFunctionExpression = updateFunctionExpression;\n    function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) {\n        var node = createNode(185, location, flags);\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = type;\n        node.equalsGreaterThanToken = equalsGreaterThanToken || createToken(35);\n        node.body = parenthesizeConciseBody(body);\n        return node;\n    }\n    ts.createArrowFunction = createArrowFunction;\n    function updateArrowFunction(node, modifiers, typeParameters, parameters, type, body) {\n        if (node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {\n            return updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, body, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateArrowFunction = updateArrowFunction;\n    function createDelete(expression, location) {\n        var node = createNode(186, location);\n        node.expression = parenthesizePrefixOperand(expression);\n        return node;\n    }\n    ts.createDelete = createDelete;\n    function updateDelete(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createDelete(expression, node), expression);\n        }\n        return node;\n    }\n    ts.updateDelete = updateDelete;\n    function createTypeOf(expression, location) {\n        var node = createNode(187, location);\n        node.expression = parenthesizePrefixOperand(expression);\n        return node;\n    }\n    ts.createTypeOf = createTypeOf;\n    function updateTypeOf(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createTypeOf(expression, node), expression);\n        }\n        return node;\n    }\n    ts.updateTypeOf = updateTypeOf;\n    function createVoid(expression, location) {\n        var node = createNode(188, location);\n        node.expression = parenthesizePrefixOperand(expression);\n        return node;\n    }\n    ts.createVoid = createVoid;\n    function updateVoid(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createVoid(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateVoid = updateVoid;\n    function createAwait(expression, location) {\n        var node = createNode(189, location);\n        node.expression = parenthesizePrefixOperand(expression);\n        return node;\n    }\n    ts.createAwait = createAwait;\n    function updateAwait(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createAwait(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateAwait = updateAwait;\n    function createPrefix(operator, operand, location) {\n        var node = createNode(190, location);\n        node.operator = operator;\n        node.operand = parenthesizePrefixOperand(operand);\n        return node;\n    }\n    ts.createPrefix = createPrefix;\n    function updatePrefix(node, operand) {\n        if (node.operand !== operand) {\n            return updateNode(createPrefix(node.operator, operand, node), node);\n        }\n        return node;\n    }\n    ts.updatePrefix = updatePrefix;\n    function createPostfix(operand, operator, location) {\n        var node = createNode(191, location);\n        node.operand = parenthesizePostfixOperand(operand);\n        node.operator = operator;\n        return node;\n    }\n    ts.createPostfix = createPostfix;\n    function updatePostfix(node, operand) {\n        if (node.operand !== operand) {\n            return updateNode(createPostfix(operand, node.operator, node), node);\n        }\n        return node;\n    }\n    ts.updatePostfix = updatePostfix;\n    function createBinary(left, operator, right, location) {\n        var operatorToken = typeof operator === \"number\" ? createToken(operator) : operator;\n        var operatorKind = operatorToken.kind;\n        var node = createNode(192, location);\n        node.left = parenthesizeBinaryOperand(operatorKind, left, true, undefined);\n        node.operatorToken = operatorToken;\n        node.right = parenthesizeBinaryOperand(operatorKind, right, false, node.left);\n        return node;\n    }\n    ts.createBinary = createBinary;\n    function updateBinary(node, left, right) {\n        if (node.left !== left || node.right !== right) {\n            return updateNode(createBinary(left, node.operatorToken, right, node), node);\n        }\n        return node;\n    }\n    ts.updateBinary = updateBinary;\n    function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) {\n        var node = createNode(193, whenFalse ? location : colonTokenOrLocation);\n        node.condition = parenthesizeForConditionalHead(condition);\n        if (whenFalse) {\n            node.questionToken = questionTokenOrWhenTrue;\n            node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse);\n            node.colonToken = colonTokenOrLocation;\n            node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse);\n        }\n        else {\n            node.questionToken = createToken(54);\n            node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue);\n            node.colonToken = createToken(55);\n            node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse);\n        }\n        return node;\n    }\n    ts.createConditional = createConditional;\n    function updateConditional(node, condition, whenTrue, whenFalse) {\n        if (node.condition !== condition || node.whenTrue !== whenTrue || node.whenFalse !== whenFalse) {\n            return updateNode(createConditional(condition, node.questionToken, whenTrue, node.colonToken, whenFalse, node), node);\n        }\n        return node;\n    }\n    ts.updateConditional = updateConditional;\n    function createTemplateExpression(head, templateSpans, location) {\n        var node = createNode(194, location);\n        node.head = head;\n        node.templateSpans = createNodeArray(templateSpans);\n        return node;\n    }\n    ts.createTemplateExpression = createTemplateExpression;\n    function updateTemplateExpression(node, head, templateSpans) {\n        if (node.head !== head || node.templateSpans !== templateSpans) {\n            return updateNode(createTemplateExpression(head, templateSpans, node), node);\n        }\n        return node;\n    }\n    ts.updateTemplateExpression = updateTemplateExpression;\n    function createYield(asteriskToken, expression, location) {\n        var node = createNode(195, location);\n        node.asteriskToken = asteriskToken;\n        node.expression = expression;\n        return node;\n    }\n    ts.createYield = createYield;\n    function updateYield(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createYield(node.asteriskToken, expression, node), node);\n        }\n        return node;\n    }\n    ts.updateYield = updateYield;\n    function createSpread(expression, location) {\n        var node = createNode(196, location);\n        node.expression = parenthesizeExpressionForList(expression);\n        return node;\n    }\n    ts.createSpread = createSpread;\n    function updateSpread(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createSpread(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateSpread = updateSpread;\n    function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) {\n        var node = createNode(197, location);\n        node.decorators = undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.name = name;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.heritageClauses = createNodeArray(heritageClauses);\n        node.members = createNodeArray(members);\n        return node;\n    }\n    ts.createClassExpression = createClassExpression;\n    function updateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members) {\n        if (node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) {\n            return updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members, node), node);\n        }\n        return node;\n    }\n    ts.updateClassExpression = updateClassExpression;\n    function createOmittedExpression(location) {\n        var node = createNode(198, location);\n        return node;\n    }\n    ts.createOmittedExpression = createOmittedExpression;\n    function createExpressionWithTypeArguments(typeArguments, expression, location) {\n        var node = createNode(199, location);\n        node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined;\n        node.expression = parenthesizeForAccess(expression);\n        return node;\n    }\n    ts.createExpressionWithTypeArguments = createExpressionWithTypeArguments;\n    function updateExpressionWithTypeArguments(node, typeArguments, expression) {\n        if (node.typeArguments !== typeArguments || node.expression !== expression) {\n            return updateNode(createExpressionWithTypeArguments(typeArguments, expression, node), node);\n        }\n        return node;\n    }\n    ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments;\n    function createTemplateSpan(expression, literal, location) {\n        var node = createNode(202, location);\n        node.expression = expression;\n        node.literal = literal;\n        return node;\n    }\n    ts.createTemplateSpan = createTemplateSpan;\n    function updateTemplateSpan(node, expression, literal) {\n        if (node.expression !== expression || node.literal !== literal) {\n            return updateNode(createTemplateSpan(expression, literal, node), node);\n        }\n        return node;\n    }\n    ts.updateTemplateSpan = updateTemplateSpan;\n    function createBlock(statements, location, multiLine, flags) {\n        var block = createNode(204, location, flags);\n        block.statements = createNodeArray(statements);\n        if (multiLine) {\n            block.multiLine = true;\n        }\n        return block;\n    }\n    ts.createBlock = createBlock;\n    function updateBlock(node, statements) {\n        if (statements !== node.statements) {\n            return updateNode(createBlock(statements, node, node.multiLine, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateBlock = updateBlock;\n    function createVariableStatement(modifiers, declarationList, location, flags) {\n        var node = createNode(205, location, flags);\n        node.decorators = undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList;\n        return node;\n    }\n    ts.createVariableStatement = createVariableStatement;\n    function updateVariableStatement(node, modifiers, declarationList) {\n        if (node.modifiers !== modifiers || node.declarationList !== declarationList) {\n            return updateNode(createVariableStatement(modifiers, declarationList, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateVariableStatement = updateVariableStatement;\n    function createVariableDeclarationList(declarations, location, flags) {\n        var node = createNode(224, location, flags);\n        node.declarations = createNodeArray(declarations);\n        return node;\n    }\n    ts.createVariableDeclarationList = createVariableDeclarationList;\n    function updateVariableDeclarationList(node, declarations) {\n        if (node.declarations !== declarations) {\n            return updateNode(createVariableDeclarationList(declarations, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateVariableDeclarationList = updateVariableDeclarationList;\n    function createVariableDeclaration(name, type, initializer, location, flags) {\n        var node = createNode(223, location, flags);\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.type = type;\n        node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined;\n        return node;\n    }\n    ts.createVariableDeclaration = createVariableDeclaration;\n    function updateVariableDeclaration(node, name, type, initializer) {\n        if (node.name !== name || node.type !== type || node.initializer !== initializer) {\n            return updateNode(createVariableDeclaration(name, type, initializer, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateVariableDeclaration = updateVariableDeclaration;\n    function createEmptyStatement(location) {\n        return createNode(206, location);\n    }\n    ts.createEmptyStatement = createEmptyStatement;\n    function createStatement(expression, location, flags) {\n        var node = createNode(207, location, flags);\n        node.expression = parenthesizeExpressionForExpressionStatement(expression);\n        return node;\n    }\n    ts.createStatement = createStatement;\n    function updateStatement(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createStatement(expression, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateStatement = updateStatement;\n    function createIf(expression, thenStatement, elseStatement, location) {\n        var node = createNode(208, location);\n        node.expression = expression;\n        node.thenStatement = thenStatement;\n        node.elseStatement = elseStatement;\n        return node;\n    }\n    ts.createIf = createIf;\n    function updateIf(node, expression, thenStatement, elseStatement) {\n        if (node.expression !== expression || node.thenStatement !== thenStatement || node.elseStatement !== elseStatement) {\n            return updateNode(createIf(expression, thenStatement, elseStatement, node), node);\n        }\n        return node;\n    }\n    ts.updateIf = updateIf;\n    function createDo(statement, expression, location) {\n        var node = createNode(209, location);\n        node.statement = statement;\n        node.expression = expression;\n        return node;\n    }\n    ts.createDo = createDo;\n    function updateDo(node, statement, expression) {\n        if (node.statement !== statement || node.expression !== expression) {\n            return updateNode(createDo(statement, expression, node), node);\n        }\n        return node;\n    }\n    ts.updateDo = updateDo;\n    function createWhile(expression, statement, location) {\n        var node = createNode(210, location);\n        node.expression = expression;\n        node.statement = statement;\n        return node;\n    }\n    ts.createWhile = createWhile;\n    function updateWhile(node, expression, statement) {\n        if (node.expression !== expression || node.statement !== statement) {\n            return updateNode(createWhile(expression, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateWhile = updateWhile;\n    function createFor(initializer, condition, incrementor, statement, location) {\n        var node = createNode(211, location, undefined);\n        node.initializer = initializer;\n        node.condition = condition;\n        node.incrementor = incrementor;\n        node.statement = statement;\n        return node;\n    }\n    ts.createFor = createFor;\n    function updateFor(node, initializer, condition, incrementor, statement) {\n        if (node.initializer !== initializer || node.condition !== condition || node.incrementor !== incrementor || node.statement !== statement) {\n            return updateNode(createFor(initializer, condition, incrementor, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateFor = updateFor;\n    function createForIn(initializer, expression, statement, location) {\n        var node = createNode(212, location);\n        node.initializer = initializer;\n        node.expression = expression;\n        node.statement = statement;\n        return node;\n    }\n    ts.createForIn = createForIn;\n    function updateForIn(node, initializer, expression, statement) {\n        if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) {\n            return updateNode(createForIn(initializer, expression, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateForIn = updateForIn;\n    function createForOf(initializer, expression, statement, location) {\n        var node = createNode(213, location);\n        node.initializer = initializer;\n        node.expression = expression;\n        node.statement = statement;\n        return node;\n    }\n    ts.createForOf = createForOf;\n    function updateForOf(node, initializer, expression, statement) {\n        if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) {\n            return updateNode(createForOf(initializer, expression, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateForOf = updateForOf;\n    function createContinue(label, location) {\n        var node = createNode(214, location);\n        if (label) {\n            node.label = label;\n        }\n        return node;\n    }\n    ts.createContinue = createContinue;\n    function updateContinue(node, label) {\n        if (node.label !== label) {\n            return updateNode(createContinue(label, node), node);\n        }\n        return node;\n    }\n    ts.updateContinue = updateContinue;\n    function createBreak(label, location) {\n        var node = createNode(215, location);\n        if (label) {\n            node.label = label;\n        }\n        return node;\n    }\n    ts.createBreak = createBreak;\n    function updateBreak(node, label) {\n        if (node.label !== label) {\n            return updateNode(createBreak(label, node), node);\n        }\n        return node;\n    }\n    ts.updateBreak = updateBreak;\n    function createReturn(expression, location) {\n        var node = createNode(216, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createReturn = createReturn;\n    function updateReturn(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createReturn(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateReturn = updateReturn;\n    function createWith(expression, statement, location) {\n        var node = createNode(217, location);\n        node.expression = expression;\n        node.statement = statement;\n        return node;\n    }\n    ts.createWith = createWith;\n    function updateWith(node, expression, statement) {\n        if (node.expression !== expression || node.statement !== statement) {\n            return updateNode(createWith(expression, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateWith = updateWith;\n    function createSwitch(expression, caseBlock, location) {\n        var node = createNode(218, location);\n        node.expression = parenthesizeExpressionForList(expression);\n        node.caseBlock = caseBlock;\n        return node;\n    }\n    ts.createSwitch = createSwitch;\n    function updateSwitch(node, expression, caseBlock) {\n        if (node.expression !== expression || node.caseBlock !== caseBlock) {\n            return updateNode(createSwitch(expression, caseBlock, node), node);\n        }\n        return node;\n    }\n    ts.updateSwitch = updateSwitch;\n    function createLabel(label, statement, location) {\n        var node = createNode(219, location);\n        node.label = typeof label === \"string\" ? createIdentifier(label) : label;\n        node.statement = statement;\n        return node;\n    }\n    ts.createLabel = createLabel;\n    function updateLabel(node, label, statement) {\n        if (node.label !== label || node.statement !== statement) {\n            return updateNode(createLabel(label, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateLabel = updateLabel;\n    function createThrow(expression, location) {\n        var node = createNode(220, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createThrow = createThrow;\n    function updateThrow(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createThrow(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateThrow = updateThrow;\n    function createTry(tryBlock, catchClause, finallyBlock, location) {\n        var node = createNode(221, location);\n        node.tryBlock = tryBlock;\n        node.catchClause = catchClause;\n        node.finallyBlock = finallyBlock;\n        return node;\n    }\n    ts.createTry = createTry;\n    function updateTry(node, tryBlock, catchClause, finallyBlock) {\n        if (node.tryBlock !== tryBlock || node.catchClause !== catchClause || node.finallyBlock !== finallyBlock) {\n            return updateNode(createTry(tryBlock, catchClause, finallyBlock, node), node);\n        }\n        return node;\n    }\n    ts.updateTry = updateTry;\n    function createCaseBlock(clauses, location) {\n        var node = createNode(232, location);\n        node.clauses = createNodeArray(clauses);\n        return node;\n    }\n    ts.createCaseBlock = createCaseBlock;\n    function updateCaseBlock(node, clauses) {\n        if (node.clauses !== clauses) {\n            return updateNode(createCaseBlock(clauses, node), node);\n        }\n        return node;\n    }\n    ts.updateCaseBlock = updateCaseBlock;\n    function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {\n        var node = createNode(225, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.asteriskToken = asteriskToken;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = type;\n        node.body = body;\n        return node;\n    }\n    ts.createFunctionDeclaration = createFunctionDeclaration;\n    function updateFunctionDeclaration(node, decorators, modifiers, name, typeParameters, parameters, type, body) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {\n            return updateNode(createFunctionDeclaration(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateFunctionDeclaration = updateFunctionDeclaration;\n    function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) {\n        var node = createNode(226, location);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.name = name;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.heritageClauses = createNodeArray(heritageClauses);\n        node.members = createNodeArray(members);\n        return node;\n    }\n    ts.createClassDeclaration = createClassDeclaration;\n    function updateClassDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) {\n            return updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, node), node);\n        }\n        return node;\n    }\n    ts.updateClassDeclaration = updateClassDeclaration;\n    function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) {\n        var node = createNode(235, location);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.importClause = importClause;\n        node.moduleSpecifier = moduleSpecifier;\n        return node;\n    }\n    ts.createImportDeclaration = createImportDeclaration;\n    function updateImportDeclaration(node, decorators, modifiers, importClause, moduleSpecifier) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier) {\n            return updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, node), node);\n        }\n        return node;\n    }\n    ts.updateImportDeclaration = updateImportDeclaration;\n    function createImportClause(name, namedBindings, location) {\n        var node = createNode(236, location);\n        node.name = name;\n        node.namedBindings = namedBindings;\n        return node;\n    }\n    ts.createImportClause = createImportClause;\n    function updateImportClause(node, name, namedBindings) {\n        if (node.name !== name || node.namedBindings !== namedBindings) {\n            return updateNode(createImportClause(name, namedBindings, node), node);\n        }\n        return node;\n    }\n    ts.updateImportClause = updateImportClause;\n    function createNamespaceImport(name, location) {\n        var node = createNode(237, location);\n        node.name = name;\n        return node;\n    }\n    ts.createNamespaceImport = createNamespaceImport;\n    function updateNamespaceImport(node, name) {\n        if (node.name !== name) {\n            return updateNode(createNamespaceImport(name, node), node);\n        }\n        return node;\n    }\n    ts.updateNamespaceImport = updateNamespaceImport;\n    function createNamedImports(elements, location) {\n        var node = createNode(238, location);\n        node.elements = createNodeArray(elements);\n        return node;\n    }\n    ts.createNamedImports = createNamedImports;\n    function updateNamedImports(node, elements) {\n        if (node.elements !== elements) {\n            return updateNode(createNamedImports(elements, node), node);\n        }\n        return node;\n    }\n    ts.updateNamedImports = updateNamedImports;\n    function createImportSpecifier(propertyName, name, location) {\n        var node = createNode(239, location);\n        node.propertyName = propertyName;\n        node.name = name;\n        return node;\n    }\n    ts.createImportSpecifier = createImportSpecifier;\n    function updateImportSpecifier(node, propertyName, name) {\n        if (node.propertyName !== propertyName || node.name !== name) {\n            return updateNode(createImportSpecifier(propertyName, name, node), node);\n        }\n        return node;\n    }\n    ts.updateImportSpecifier = updateImportSpecifier;\n    function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) {\n        var node = createNode(240, location);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.isExportEquals = isExportEquals;\n        node.expression = expression;\n        return node;\n    }\n    ts.createExportAssignment = createExportAssignment;\n    function updateExportAssignment(node, decorators, modifiers, expression) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.expression !== expression) {\n            return updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression, node), node);\n        }\n        return node;\n    }\n    ts.updateExportAssignment = updateExportAssignment;\n    function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) {\n        var node = createNode(241, location);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.exportClause = exportClause;\n        node.moduleSpecifier = moduleSpecifier;\n        return node;\n    }\n    ts.createExportDeclaration = createExportDeclaration;\n    function updateExportDeclaration(node, decorators, modifiers, exportClause, moduleSpecifier) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier) {\n            return updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, node), node);\n        }\n        return node;\n    }\n    ts.updateExportDeclaration = updateExportDeclaration;\n    function createNamedExports(elements, location) {\n        var node = createNode(242, location);\n        node.elements = createNodeArray(elements);\n        return node;\n    }\n    ts.createNamedExports = createNamedExports;\n    function updateNamedExports(node, elements) {\n        if (node.elements !== elements) {\n            return updateNode(createNamedExports(elements, node), node);\n        }\n        return node;\n    }\n    ts.updateNamedExports = updateNamedExports;\n    function createExportSpecifier(name, propertyName, location) {\n        var node = createNode(243, location);\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.propertyName = typeof propertyName === \"string\" ? createIdentifier(propertyName) : propertyName;\n        return node;\n    }\n    ts.createExportSpecifier = createExportSpecifier;\n    function updateExportSpecifier(node, name, propertyName) {\n        if (node.name !== name || node.propertyName !== propertyName) {\n            return updateNode(createExportSpecifier(name, propertyName, node), node);\n        }\n        return node;\n    }\n    ts.updateExportSpecifier = updateExportSpecifier;\n    function createJsxElement(openingElement, children, closingElement, location) {\n        var node = createNode(246, location);\n        node.openingElement = openingElement;\n        node.children = createNodeArray(children);\n        node.closingElement = closingElement;\n        return node;\n    }\n    ts.createJsxElement = createJsxElement;\n    function updateJsxElement(node, openingElement, children, closingElement) {\n        if (node.openingElement !== openingElement || node.children !== children || node.closingElement !== closingElement) {\n            return updateNode(createJsxElement(openingElement, children, closingElement, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxElement = updateJsxElement;\n    function createJsxSelfClosingElement(tagName, attributes, location) {\n        var node = createNode(247, location);\n        node.tagName = tagName;\n        node.attributes = createNodeArray(attributes);\n        return node;\n    }\n    ts.createJsxSelfClosingElement = createJsxSelfClosingElement;\n    function updateJsxSelfClosingElement(node, tagName, attributes) {\n        if (node.tagName !== tagName || node.attributes !== attributes) {\n            return updateNode(createJsxSelfClosingElement(tagName, attributes, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement;\n    function createJsxOpeningElement(tagName, attributes, location) {\n        var node = createNode(248, location);\n        node.tagName = tagName;\n        node.attributes = createNodeArray(attributes);\n        return node;\n    }\n    ts.createJsxOpeningElement = createJsxOpeningElement;\n    function updateJsxOpeningElement(node, tagName, attributes) {\n        if (node.tagName !== tagName || node.attributes !== attributes) {\n            return updateNode(createJsxOpeningElement(tagName, attributes, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxOpeningElement = updateJsxOpeningElement;\n    function createJsxClosingElement(tagName, location) {\n        var node = createNode(249, location);\n        node.tagName = tagName;\n        return node;\n    }\n    ts.createJsxClosingElement = createJsxClosingElement;\n    function updateJsxClosingElement(node, tagName) {\n        if (node.tagName !== tagName) {\n            return updateNode(createJsxClosingElement(tagName, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxClosingElement = updateJsxClosingElement;\n    function createJsxAttribute(name, initializer, location) {\n        var node = createNode(250, location);\n        node.name = name;\n        node.initializer = initializer;\n        return node;\n    }\n    ts.createJsxAttribute = createJsxAttribute;\n    function updateJsxAttribute(node, name, initializer) {\n        if (node.name !== name || node.initializer !== initializer) {\n            return updateNode(createJsxAttribute(name, initializer, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxAttribute = updateJsxAttribute;\n    function createJsxSpreadAttribute(expression, location) {\n        var node = createNode(251, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createJsxSpreadAttribute = createJsxSpreadAttribute;\n    function updateJsxSpreadAttribute(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createJsxSpreadAttribute(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute;\n    function createJsxExpression(expression, location) {\n        var node = createNode(252, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createJsxExpression = createJsxExpression;\n    function updateJsxExpression(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createJsxExpression(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxExpression = updateJsxExpression;\n    function createHeritageClause(token, types, location) {\n        var node = createNode(255, location);\n        node.token = token;\n        node.types = createNodeArray(types);\n        return node;\n    }\n    ts.createHeritageClause = createHeritageClause;\n    function updateHeritageClause(node, types) {\n        if (node.types !== types) {\n            return updateNode(createHeritageClause(node.token, types, node), node);\n        }\n        return node;\n    }\n    ts.updateHeritageClause = updateHeritageClause;\n    function createCaseClause(expression, statements, location) {\n        var node = createNode(253, location);\n        node.expression = parenthesizeExpressionForList(expression);\n        node.statements = createNodeArray(statements);\n        return node;\n    }\n    ts.createCaseClause = createCaseClause;\n    function updateCaseClause(node, expression, statements) {\n        if (node.expression !== expression || node.statements !== statements) {\n            return updateNode(createCaseClause(expression, statements, node), node);\n        }\n        return node;\n    }\n    ts.updateCaseClause = updateCaseClause;\n    function createDefaultClause(statements, location) {\n        var node = createNode(254, location);\n        node.statements = createNodeArray(statements);\n        return node;\n    }\n    ts.createDefaultClause = createDefaultClause;\n    function updateDefaultClause(node, statements) {\n        if (node.statements !== statements) {\n            return updateNode(createDefaultClause(statements, node), node);\n        }\n        return node;\n    }\n    ts.updateDefaultClause = updateDefaultClause;\n    function createCatchClause(variableDeclaration, block, location) {\n        var node = createNode(256, location);\n        node.variableDeclaration = typeof variableDeclaration === \"string\" ? createVariableDeclaration(variableDeclaration) : variableDeclaration;\n        node.block = block;\n        return node;\n    }\n    ts.createCatchClause = createCatchClause;\n    function updateCatchClause(node, variableDeclaration, block) {\n        if (node.variableDeclaration !== variableDeclaration || node.block !== block) {\n            return updateNode(createCatchClause(variableDeclaration, block, node), node);\n        }\n        return node;\n    }\n    ts.updateCatchClause = updateCatchClause;\n    function createPropertyAssignment(name, initializer, location) {\n        var node = createNode(257, location);\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.questionToken = undefined;\n        node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined;\n        return node;\n    }\n    ts.createPropertyAssignment = createPropertyAssignment;\n    function updatePropertyAssignment(node, name, initializer) {\n        if (node.name !== name || node.initializer !== initializer) {\n            return updateNode(createPropertyAssignment(name, initializer, node), node);\n        }\n        return node;\n    }\n    ts.updatePropertyAssignment = updatePropertyAssignment;\n    function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) {\n        var node = createNode(258, location);\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined;\n        return node;\n    }\n    ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment;\n    function createSpreadAssignment(expression, location) {\n        var node = createNode(259, location);\n        node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined;\n        return node;\n    }\n    ts.createSpreadAssignment = createSpreadAssignment;\n    function updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer) {\n        if (node.name !== name || node.objectAssignmentInitializer !== objectAssignmentInitializer) {\n            return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer, node), node);\n        }\n        return node;\n    }\n    ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment;\n    function updateSpreadAssignment(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createSpreadAssignment(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateSpreadAssignment = updateSpreadAssignment;\n    function updateSourceFileNode(node, statements) {\n        if (node.statements !== statements) {\n            var updated = createNode(261, node, node.flags);\n            updated.statements = createNodeArray(statements);\n            updated.endOfFileToken = node.endOfFileToken;\n            updated.fileName = node.fileName;\n            updated.path = node.path;\n            updated.text = node.text;\n            if (node.amdDependencies !== undefined)\n                updated.amdDependencies = node.amdDependencies;\n            if (node.moduleName !== undefined)\n                updated.moduleName = node.moduleName;\n            if (node.referencedFiles !== undefined)\n                updated.referencedFiles = node.referencedFiles;\n            if (node.typeReferenceDirectives !== undefined)\n                updated.typeReferenceDirectives = node.typeReferenceDirectives;\n            if (node.languageVariant !== undefined)\n                updated.languageVariant = node.languageVariant;\n            if (node.isDeclarationFile !== undefined)\n                updated.isDeclarationFile = node.isDeclarationFile;\n            if (node.renamedDependencies !== undefined)\n                updated.renamedDependencies = node.renamedDependencies;\n            if (node.hasNoDefaultLib !== undefined)\n                updated.hasNoDefaultLib = node.hasNoDefaultLib;\n            if (node.languageVersion !== undefined)\n                updated.languageVersion = node.languageVersion;\n            if (node.scriptKind !== undefined)\n                updated.scriptKind = node.scriptKind;\n            if (node.externalModuleIndicator !== undefined)\n                updated.externalModuleIndicator = node.externalModuleIndicator;\n            if (node.commonJsModuleIndicator !== undefined)\n                updated.commonJsModuleIndicator = node.commonJsModuleIndicator;\n            if (node.identifiers !== undefined)\n                updated.identifiers = node.identifiers;\n            if (node.nodeCount !== undefined)\n                updated.nodeCount = node.nodeCount;\n            if (node.identifierCount !== undefined)\n                updated.identifierCount = node.identifierCount;\n            if (node.symbolCount !== undefined)\n                updated.symbolCount = node.symbolCount;\n            if (node.parseDiagnostics !== undefined)\n                updated.parseDiagnostics = node.parseDiagnostics;\n            if (node.bindDiagnostics !== undefined)\n                updated.bindDiagnostics = node.bindDiagnostics;\n            if (node.lineMap !== undefined)\n                updated.lineMap = node.lineMap;\n            if (node.classifiableNames !== undefined)\n                updated.classifiableNames = node.classifiableNames;\n            if (node.resolvedModules !== undefined)\n                updated.resolvedModules = node.resolvedModules;\n            if (node.resolvedTypeReferenceDirectiveNames !== undefined)\n                updated.resolvedTypeReferenceDirectiveNames = node.resolvedTypeReferenceDirectiveNames;\n            if (node.imports !== undefined)\n                updated.imports = node.imports;\n            if (node.moduleAugmentations !== undefined)\n                updated.moduleAugmentations = node.moduleAugmentations;\n            return updateNode(updated, node);\n        }\n        return node;\n    }\n    ts.updateSourceFileNode = updateSourceFileNode;\n    function createNotEmittedStatement(original) {\n        var node = createNode(293, original);\n        node.original = original;\n        return node;\n    }\n    ts.createNotEmittedStatement = createNotEmittedStatement;\n    function createEndOfDeclarationMarker(original) {\n        var node = createNode(296);\n        node.emitNode = {};\n        node.original = original;\n        return node;\n    }\n    ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker;\n    function createMergeDeclarationMarker(original) {\n        var node = createNode(295);\n        node.emitNode = {};\n        node.original = original;\n        return node;\n    }\n    ts.createMergeDeclarationMarker = createMergeDeclarationMarker;\n    function createPartiallyEmittedExpression(expression, original, location) {\n        var node = createNode(294, location || original);\n        node.expression = expression;\n        node.original = original;\n        return node;\n    }\n    ts.createPartiallyEmittedExpression = createPartiallyEmittedExpression;\n    function updatePartiallyEmittedExpression(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createPartiallyEmittedExpression(expression, node.original, node), node);\n        }\n        return node;\n    }\n    ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;\n    function createRawExpression(text) {\n        var node = createNode(297);\n        node.text = text;\n        return node;\n    }\n    ts.createRawExpression = createRawExpression;\n    function createComma(left, right) {\n        return createBinary(left, 25, right);\n    }\n    ts.createComma = createComma;\n    function createLessThan(left, right, location) {\n        return createBinary(left, 26, right, location);\n    }\n    ts.createLessThan = createLessThan;\n    function createAssignment(left, right, location) {\n        return createBinary(left, 57, right, location);\n    }\n    ts.createAssignment = createAssignment;\n    function createStrictEquality(left, right) {\n        return createBinary(left, 33, right);\n    }\n    ts.createStrictEquality = createStrictEquality;\n    function createStrictInequality(left, right) {\n        return createBinary(left, 34, right);\n    }\n    ts.createStrictInequality = createStrictInequality;\n    function createAdd(left, right) {\n        return createBinary(left, 36, right);\n    }\n    ts.createAdd = createAdd;\n    function createSubtract(left, right) {\n        return createBinary(left, 37, right);\n    }\n    ts.createSubtract = createSubtract;\n    function createPostfixIncrement(operand, location) {\n        return createPostfix(operand, 42, location);\n    }\n    ts.createPostfixIncrement = createPostfixIncrement;\n    function createLogicalAnd(left, right) {\n        return createBinary(left, 52, right);\n    }\n    ts.createLogicalAnd = createLogicalAnd;\n    function createLogicalOr(left, right) {\n        return createBinary(left, 53, right);\n    }\n    ts.createLogicalOr = createLogicalOr;\n    function createLogicalNot(operand) {\n        return createPrefix(50, operand);\n    }\n    ts.createLogicalNot = createLogicalNot;\n    function createVoidZero() {\n        return createVoid(createLiteral(0));\n    }\n    ts.createVoidZero = createVoidZero;\n    function createTypeCheck(value, tag) {\n        return tag === \"undefined\"\n            ? createStrictEquality(value, createVoidZero())\n            : createStrictEquality(createTypeOf(value), createLiteral(tag));\n    }\n    ts.createTypeCheck = createTypeCheck;\n    function createMemberAccessForPropertyName(target, memberName, location) {\n        if (ts.isComputedPropertyName(memberName)) {\n            return createElementAccess(target, memberName.expression, location);\n        }\n        else {\n            var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location);\n            (expression.emitNode || (expression.emitNode = {})).flags |= 64;\n            return expression;\n        }\n    }\n    ts.createMemberAccessForPropertyName = createMemberAccessForPropertyName;\n    function createFunctionCall(func, thisArg, argumentsList, location) {\n        return createCall(createPropertyAccess(func, \"call\"), undefined, [\n            thisArg\n        ].concat(argumentsList), location);\n    }\n    ts.createFunctionCall = createFunctionCall;\n    function createFunctionApply(func, thisArg, argumentsExpression, location) {\n        return createCall(createPropertyAccess(func, \"apply\"), undefined, [\n            thisArg,\n            argumentsExpression\n        ], location);\n    }\n    ts.createFunctionApply = createFunctionApply;\n    function createArraySlice(array, start) {\n        var argumentsList = [];\n        if (start !== undefined) {\n            argumentsList.push(typeof start === \"number\" ? createLiteral(start) : start);\n        }\n        return createCall(createPropertyAccess(array, \"slice\"), undefined, argumentsList);\n    }\n    ts.createArraySlice = createArraySlice;\n    function createArrayConcat(array, values) {\n        return createCall(createPropertyAccess(array, \"concat\"), undefined, values);\n    }\n    ts.createArrayConcat = createArrayConcat;\n    function createMathPow(left, right, location) {\n        return createCall(createPropertyAccess(createIdentifier(\"Math\"), \"pow\"), undefined, [left, right], location);\n    }\n    ts.createMathPow = createMathPow;\n    function createReactNamespace(reactNamespace, parent) {\n        var react = createIdentifier(reactNamespace || \"React\");\n        react.flags &= ~8;\n        react.parent = ts.getParseTreeNode(parent);\n        return react;\n    }\n    function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) {\n        if (ts.isQualifiedName(jsxFactory)) {\n            var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent);\n            var right = createSynthesizedNode(70);\n            right.text = jsxFactory.right.text;\n            return createPropertyAccess(left, right);\n        }\n        else {\n            return createReactNamespace(jsxFactory.text, parent);\n        }\n    }\n    function createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parent) {\n        return jsxFactoryEntity ?\n            createJsxFactoryExpressionFromEntityName(jsxFactoryEntity, parent) :\n            createPropertyAccess(createReactNamespace(reactNamespace, parent), \"createElement\");\n    }\n    function createExpressionForJsxElement(jsxFactoryEntity, reactNamespace, tagName, props, children, parentElement, location) {\n        var argumentsList = [tagName];\n        if (props) {\n            argumentsList.push(props);\n        }\n        if (children && children.length > 0) {\n            if (!props) {\n                argumentsList.push(createNull());\n            }\n            if (children.length > 1) {\n                for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {\n                    var child = children_1[_i];\n                    child.startsOnNewLine = true;\n                    argumentsList.push(child);\n                }\n            }\n            else {\n                argumentsList.push(children[0]);\n            }\n        }\n        return createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), undefined, argumentsList, location);\n    }\n    ts.createExpressionForJsxElement = createExpressionForJsxElement;\n    function createExportDefault(expression) {\n        return createExportAssignment(undefined, undefined, false, expression);\n    }\n    ts.createExportDefault = createExportDefault;\n    function createExternalModuleExport(exportName) {\n        return createExportDeclaration(undefined, undefined, createNamedExports([createExportSpecifier(exportName)]));\n    }\n    ts.createExternalModuleExport = createExternalModuleExport;\n    function createLetStatement(name, initializer, location) {\n        return createVariableStatement(undefined, createLetDeclarationList([createVariableDeclaration(name, undefined, initializer)]), location);\n    }\n    ts.createLetStatement = createLetStatement;\n    function createLetDeclarationList(declarations, location) {\n        return createVariableDeclarationList(declarations, location, 1);\n    }\n    ts.createLetDeclarationList = createLetDeclarationList;\n    function createConstDeclarationList(declarations, location) {\n        return createVariableDeclarationList(declarations, location, 2);\n    }\n    ts.createConstDeclarationList = createConstDeclarationList;\n    function getHelperName(name) {\n        return setEmitFlags(createIdentifier(name), 4096 | 2);\n    }\n    ts.getHelperName = getHelperName;\n    function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {\n        var target = skipParentheses(node);\n        switch (target.kind) {\n            case 70:\n                return cacheIdentifiers;\n            case 98:\n            case 8:\n            case 9:\n                return false;\n            case 175:\n                var elements = target.elements;\n                if (elements.length === 0) {\n                    return false;\n                }\n                return true;\n            case 176:\n                return target.properties.length > 0;\n            default:\n                return true;\n        }\n    }\n    function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers) {\n        var callee = skipOuterExpressions(expression, 7);\n        var thisArg;\n        var target;\n        if (ts.isSuperProperty(callee)) {\n            thisArg = createThis();\n            target = callee;\n        }\n        else if (callee.kind === 96) {\n            thisArg = createThis();\n            target = languageVersion < 2 ? createIdentifier(\"_super\", callee) : callee;\n        }\n        else {\n            switch (callee.kind) {\n                case 177: {\n                    if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {\n                        thisArg = createTempVariable(recordTempVariable);\n                        target = createPropertyAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.name, callee);\n                    }\n                    else {\n                        thisArg = callee.expression;\n                        target = callee;\n                    }\n                    break;\n                }\n                case 178: {\n                    if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {\n                        thisArg = createTempVariable(recordTempVariable);\n                        target = createElementAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.argumentExpression, callee);\n                    }\n                    else {\n                        thisArg = callee.expression;\n                        target = callee;\n                    }\n                    break;\n                }\n                default: {\n                    thisArg = createVoidZero();\n                    target = parenthesizeForAccess(expression);\n                    break;\n                }\n            }\n        }\n        return { target: target, thisArg: thisArg };\n    }\n    ts.createCallBinding = createCallBinding;\n    function inlineExpressions(expressions) {\n        return ts.reduceLeft(expressions, createComma);\n    }\n    ts.inlineExpressions = inlineExpressions;\n    function createExpressionFromEntityName(node) {\n        if (ts.isQualifiedName(node)) {\n            var left = createExpressionFromEntityName(node.left);\n            var right = getMutableClone(node.right);\n            return createPropertyAccess(left, right, node);\n        }\n        else {\n            return getMutableClone(node);\n        }\n    }\n    ts.createExpressionFromEntityName = createExpressionFromEntityName;\n    function createExpressionForPropertyName(memberName) {\n        if (ts.isIdentifier(memberName)) {\n            return createLiteral(memberName, undefined);\n        }\n        else if (ts.isComputedPropertyName(memberName)) {\n            return getMutableClone(memberName.expression);\n        }\n        else {\n            return getMutableClone(memberName);\n        }\n    }\n    ts.createExpressionForPropertyName = createExpressionForPropertyName;\n    function createExpressionForObjectLiteralElementLike(node, property, receiver) {\n        switch (property.kind) {\n            case 151:\n            case 152:\n                return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine);\n            case 257:\n                return createExpressionForPropertyAssignment(property, receiver);\n            case 258:\n                return createExpressionForShorthandPropertyAssignment(property, receiver);\n            case 149:\n                return createExpressionForMethodDeclaration(property, receiver);\n        }\n    }\n    ts.createExpressionForObjectLiteralElementLike = createExpressionForObjectLiteralElementLike;\n    function createExpressionForAccessorDeclaration(properties, property, receiver, multiLine) {\n        var _a = ts.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;\n        if (property === firstAccessor) {\n            var properties_1 = [];\n            if (getAccessor) {\n                var getterFunction = createFunctionExpression(getAccessor.modifiers, undefined, undefined, undefined, getAccessor.parameters, undefined, getAccessor.body, getAccessor);\n                setOriginalNode(getterFunction, getAccessor);\n                var getter = createPropertyAssignment(\"get\", getterFunction);\n                properties_1.push(getter);\n            }\n            if (setAccessor) {\n                var setterFunction = createFunctionExpression(setAccessor.modifiers, undefined, undefined, undefined, setAccessor.parameters, undefined, setAccessor.body, setAccessor);\n                setOriginalNode(setterFunction, setAccessor);\n                var setter = createPropertyAssignment(\"set\", setterFunction);\n                properties_1.push(setter);\n            }\n            properties_1.push(createPropertyAssignment(\"enumerable\", createLiteral(true)));\n            properties_1.push(createPropertyAssignment(\"configurable\", createLiteral(true)));\n            var expression = createCall(createPropertyAccess(createIdentifier(\"Object\"), \"defineProperty\"), undefined, [\n                receiver,\n                createExpressionForPropertyName(property.name),\n                createObjectLiteral(properties_1, undefined, multiLine)\n            ], firstAccessor);\n            return ts.aggregateTransformFlags(expression);\n        }\n        return undefined;\n    }\n    function createExpressionForPropertyAssignment(property, receiver) {\n        return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), property.initializer, property), property));\n    }\n    function createExpressionForShorthandPropertyAssignment(property, receiver) {\n        return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), getSynthesizedClone(property.name), property), property));\n    }\n    function createExpressionForMethodDeclaration(method, receiver) {\n        return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), setOriginalNode(createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body, method), method), method), method));\n    }\n    function getLocalName(node, allowComments, allowSourceMaps) {\n        return getName(node, allowComments, allowSourceMaps, 16384);\n    }\n    ts.getLocalName = getLocalName;\n    function isLocalName(node) {\n        return (getEmitFlags(node) & 16384) !== 0;\n    }\n    ts.isLocalName = isLocalName;\n    function getExportName(node, allowComments, allowSourceMaps) {\n        return getName(node, allowComments, allowSourceMaps, 8192);\n    }\n    ts.getExportName = getExportName;\n    function isExportName(node) {\n        return (getEmitFlags(node) & 8192) !== 0;\n    }\n    ts.isExportName = isExportName;\n    function getDeclarationName(node, allowComments, allowSourceMaps) {\n        return getName(node, allowComments, allowSourceMaps);\n    }\n    ts.getDeclarationName = getDeclarationName;\n    function getName(node, allowComments, allowSourceMaps, emitFlags) {\n        if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) {\n            var name_8 = getMutableClone(node.name);\n            emitFlags |= getEmitFlags(node.name);\n            if (!allowSourceMaps)\n                emitFlags |= 48;\n            if (!allowComments)\n                emitFlags |= 1536;\n            if (emitFlags)\n                setEmitFlags(name_8, emitFlags);\n            return name_8;\n        }\n        return getGeneratedNameForNode(node);\n    }\n    function getExternalModuleOrNamespaceExportName(ns, node, allowComments, allowSourceMaps) {\n        if (ns && ts.hasModifier(node, 1)) {\n            return getNamespaceMemberName(ns, getName(node), allowComments, allowSourceMaps);\n        }\n        return getExportName(node, allowComments, allowSourceMaps);\n    }\n    ts.getExternalModuleOrNamespaceExportName = getExternalModuleOrNamespaceExportName;\n    function getNamespaceMemberName(ns, name, allowComments, allowSourceMaps) {\n        var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), name);\n        var emitFlags;\n        if (!allowSourceMaps)\n            emitFlags |= 48;\n        if (!allowComments)\n            emitFlags |= 1536;\n        if (emitFlags)\n            setEmitFlags(qualifiedName, emitFlags);\n        return qualifiedName;\n    }\n    ts.getNamespaceMemberName = getNamespaceMemberName;\n    function convertToFunctionBody(node, multiLine) {\n        return ts.isBlock(node) ? node : createBlock([createReturn(node, node)], node, multiLine);\n    }\n    ts.convertToFunctionBody = convertToFunctionBody;\n    function isUseStrictPrologue(node) {\n        return node.expression.text === \"use strict\";\n    }\n    function addPrologueDirectives(target, source, ensureUseStrict, visitor) {\n        ts.Debug.assert(target.length === 0, \"Prologue directives should be at the first statement in the target statements array\");\n        var foundUseStrict = false;\n        var statementOffset = 0;\n        var numStatements = source.length;\n        while (statementOffset < numStatements) {\n            var statement = source[statementOffset];\n            if (ts.isPrologueDirective(statement)) {\n                if (isUseStrictPrologue(statement)) {\n                    foundUseStrict = true;\n                }\n                target.push(statement);\n            }\n            else {\n                break;\n            }\n            statementOffset++;\n        }\n        if (ensureUseStrict && !foundUseStrict) {\n            target.push(startOnNewLine(createStatement(createLiteral(\"use strict\"))));\n        }\n        while (statementOffset < numStatements) {\n            var statement = source[statementOffset];\n            if (getEmitFlags(statement) & 524288) {\n                target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement);\n            }\n            else {\n                break;\n            }\n            statementOffset++;\n        }\n        return statementOffset;\n    }\n    ts.addPrologueDirectives = addPrologueDirectives;\n    function startsWithUseStrict(statements) {\n        var firstStatement = ts.firstOrUndefined(statements);\n        return firstStatement !== undefined\n            && ts.isPrologueDirective(firstStatement)\n            && isUseStrictPrologue(firstStatement);\n    }\n    ts.startsWithUseStrict = startsWithUseStrict;\n    function ensureUseStrict(statements) {\n        var foundUseStrict = false;\n        for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {\n            var statement = statements_1[_i];\n            if (ts.isPrologueDirective(statement)) {\n                if (isUseStrictPrologue(statement)) {\n                    foundUseStrict = true;\n                    break;\n                }\n            }\n            else {\n                break;\n            }\n        }\n        if (!foundUseStrict) {\n            return createNodeArray([\n                startOnNewLine(createStatement(createLiteral(\"use strict\")))\n            ].concat(statements), statements);\n        }\n        return statements;\n    }\n    ts.ensureUseStrict = ensureUseStrict;\n    function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {\n        var skipped = skipPartiallyEmittedExpressions(operand);\n        if (skipped.kind === 183) {\n            return operand;\n        }\n        return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand)\n            ? createParen(operand)\n            : operand;\n    }\n    ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand;\n    function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {\n        var binaryOperatorPrecedence = ts.getOperatorPrecedence(192, binaryOperator);\n        var binaryOperatorAssociativity = ts.getOperatorAssociativity(192, binaryOperator);\n        var emittedOperand = skipPartiallyEmittedExpressions(operand);\n        var operandPrecedence = ts.getExpressionPrecedence(emittedOperand);\n        switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) {\n            case -1:\n                if (!isLeftSideOfBinary\n                    && binaryOperatorAssociativity === 1\n                    && operand.kind === 195) {\n                    return false;\n                }\n                return true;\n            case 1:\n                return false;\n            case 0:\n                if (isLeftSideOfBinary) {\n                    return binaryOperatorAssociativity === 1;\n                }\n                else {\n                    if (ts.isBinaryExpression(emittedOperand)\n                        && emittedOperand.operatorToken.kind === binaryOperator) {\n                        if (operatorHasAssociativeProperty(binaryOperator)) {\n                            return false;\n                        }\n                        if (binaryOperator === 36) {\n                            var leftKind = leftOperand ? getLiteralKindOfBinaryPlusOperand(leftOperand) : 0;\n                            if (ts.isLiteralKind(leftKind) && leftKind === getLiteralKindOfBinaryPlusOperand(emittedOperand)) {\n                                return false;\n                            }\n                        }\n                    }\n                    var operandAssociativity = ts.getExpressionAssociativity(emittedOperand);\n                    return operandAssociativity === 0;\n                }\n        }\n    }\n    function operatorHasAssociativeProperty(binaryOperator) {\n        return binaryOperator === 38\n            || binaryOperator === 48\n            || binaryOperator === 47\n            || binaryOperator === 49;\n    }\n    function getLiteralKindOfBinaryPlusOperand(node) {\n        node = skipPartiallyEmittedExpressions(node);\n        if (ts.isLiteralKind(node.kind)) {\n            return node.kind;\n        }\n        if (node.kind === 192 && node.operatorToken.kind === 36) {\n            if (node.cachedLiteralKind !== undefined) {\n                return node.cachedLiteralKind;\n            }\n            var leftKind = getLiteralKindOfBinaryPlusOperand(node.left);\n            var literalKind = ts.isLiteralKind(leftKind)\n                && leftKind === getLiteralKindOfBinaryPlusOperand(node.right)\n                ? leftKind\n                : 0;\n            node.cachedLiteralKind = literalKind;\n            return literalKind;\n        }\n        return 0;\n    }\n    function parenthesizeForConditionalHead(condition) {\n        var conditionalPrecedence = ts.getOperatorPrecedence(193, 54);\n        var emittedCondition = skipPartiallyEmittedExpressions(condition);\n        var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition);\n        if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) {\n            return createParen(condition);\n        }\n        return condition;\n    }\n    ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead;\n    function parenthesizeSubexpressionOfConditionalExpression(e) {\n        return e.kind === 192 && e.operatorToken.kind === 25\n            ? createParen(e)\n            : e;\n    }\n    function parenthesizeForNew(expression) {\n        var emittedExpression = skipPartiallyEmittedExpressions(expression);\n        switch (emittedExpression.kind) {\n            case 179:\n                return createParen(expression);\n            case 180:\n                return emittedExpression.arguments\n                    ? expression\n                    : createParen(expression);\n        }\n        return parenthesizeForAccess(expression);\n    }\n    ts.parenthesizeForNew = parenthesizeForNew;\n    function parenthesizeForAccess(expression) {\n        var emittedExpression = skipPartiallyEmittedExpressions(expression);\n        if (ts.isLeftHandSideExpression(emittedExpression)\n            && (emittedExpression.kind !== 180 || emittedExpression.arguments)\n            && emittedExpression.kind !== 8) {\n            return expression;\n        }\n        return createParen(expression, expression);\n    }\n    ts.parenthesizeForAccess = parenthesizeForAccess;\n    function parenthesizePostfixOperand(operand) {\n        return ts.isLeftHandSideExpression(operand)\n            ? operand\n            : createParen(operand, operand);\n    }\n    ts.parenthesizePostfixOperand = parenthesizePostfixOperand;\n    function parenthesizePrefixOperand(operand) {\n        return ts.isUnaryExpression(operand)\n            ? operand\n            : createParen(operand, operand);\n    }\n    ts.parenthesizePrefixOperand = parenthesizePrefixOperand;\n    function parenthesizeListElements(elements) {\n        var result;\n        for (var i = 0; i < elements.length; i++) {\n            var element = parenthesizeExpressionForList(elements[i]);\n            if (result !== undefined || element !== elements[i]) {\n                if (result === undefined) {\n                    result = elements.slice(0, i);\n                }\n                result.push(element);\n            }\n        }\n        if (result !== undefined) {\n            return createNodeArray(result, elements, elements.hasTrailingComma);\n        }\n        return elements;\n    }\n    function parenthesizeExpressionForList(expression) {\n        var emittedExpression = skipPartiallyEmittedExpressions(expression);\n        var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression);\n        var commaPrecedence = ts.getOperatorPrecedence(192, 25);\n        return expressionPrecedence > commaPrecedence\n            ? expression\n            : createParen(expression, expression);\n    }\n    ts.parenthesizeExpressionForList = parenthesizeExpressionForList;\n    function parenthesizeExpressionForExpressionStatement(expression) {\n        var emittedExpression = skipPartiallyEmittedExpressions(expression);\n        if (ts.isCallExpression(emittedExpression)) {\n            var callee = emittedExpression.expression;\n            var kind = skipPartiallyEmittedExpressions(callee).kind;\n            if (kind === 184 || kind === 185) {\n                var mutableCall = getMutableClone(emittedExpression);\n                mutableCall.expression = createParen(callee, callee);\n                return recreatePartiallyEmittedExpressions(expression, mutableCall);\n            }\n        }\n        else {\n            var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind;\n            if (leftmostExpressionKind === 176 || leftmostExpressionKind === 184) {\n                return createParen(expression, expression);\n            }\n        }\n        return expression;\n    }\n    ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement;\n    function recreatePartiallyEmittedExpressions(originalOuterExpression, newInnerExpression) {\n        if (ts.isPartiallyEmittedExpression(originalOuterExpression)) {\n            var clone_1 = getMutableClone(originalOuterExpression);\n            clone_1.expression = recreatePartiallyEmittedExpressions(clone_1.expression, newInnerExpression);\n            return clone_1;\n        }\n        return newInnerExpression;\n    }\n    function getLeftmostExpression(node) {\n        while (true) {\n            switch (node.kind) {\n                case 191:\n                    node = node.operand;\n                    continue;\n                case 192:\n                    node = node.left;\n                    continue;\n                case 193:\n                    node = node.condition;\n                    continue;\n                case 179:\n                case 178:\n                case 177:\n                    node = node.expression;\n                    continue;\n                case 294:\n                    node = node.expression;\n                    continue;\n            }\n            return node;\n        }\n    }\n    function parenthesizeConciseBody(body) {\n        var emittedBody = skipPartiallyEmittedExpressions(body);\n        if (emittedBody.kind === 176) {\n            return createParen(body, body);\n        }\n        return body;\n    }\n    ts.parenthesizeConciseBody = parenthesizeConciseBody;\n    function skipOuterExpressions(node, kinds) {\n        if (kinds === void 0) { kinds = 7; }\n        var previousNode;\n        do {\n            previousNode = node;\n            if (kinds & 1) {\n                node = skipParentheses(node);\n            }\n            if (kinds & 2) {\n                node = skipAssertions(node);\n            }\n            if (kinds & 4) {\n                node = skipPartiallyEmittedExpressions(node);\n            }\n        } while (previousNode !== node);\n        return node;\n    }\n    ts.skipOuterExpressions = skipOuterExpressions;\n    function skipParentheses(node) {\n        while (node.kind === 183) {\n            node = node.expression;\n        }\n        return node;\n    }\n    ts.skipParentheses = skipParentheses;\n    function skipAssertions(node) {\n        while (ts.isAssertionExpression(node)) {\n            node = node.expression;\n        }\n        return node;\n    }\n    ts.skipAssertions = skipAssertions;\n    function skipPartiallyEmittedExpressions(node) {\n        while (node.kind === 294) {\n            node = node.expression;\n        }\n        return node;\n    }\n    ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions;\n    function startOnNewLine(node) {\n        node.startsOnNewLine = true;\n        return node;\n    }\n    ts.startOnNewLine = startOnNewLine;\n    function setOriginalNode(node, original) {\n        node.original = original;\n        if (original) {\n            var emitNode = original.emitNode;\n            if (emitNode)\n                node.emitNode = mergeEmitNode(emitNode, node.emitNode);\n        }\n        return node;\n    }\n    ts.setOriginalNode = setOriginalNode;\n    function mergeEmitNode(sourceEmitNode, destEmitNode) {\n        var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers;\n        if (!destEmitNode)\n            destEmitNode = {};\n        if (flags)\n            destEmitNode.flags = flags;\n        if (commentRange)\n            destEmitNode.commentRange = commentRange;\n        if (sourceMapRange)\n            destEmitNode.sourceMapRange = sourceMapRange;\n        if (tokenSourceMapRanges)\n            destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges);\n        if (constantValue !== undefined)\n            destEmitNode.constantValue = constantValue;\n        if (helpers)\n            destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers);\n        return destEmitNode;\n    }\n    function mergeTokenSourceMapRanges(sourceRanges, destRanges) {\n        if (!destRanges)\n            destRanges = ts.createMap();\n        ts.copyProperties(sourceRanges, destRanges);\n        return destRanges;\n    }\n    function disposeEmitNodes(sourceFile) {\n        sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile));\n        var emitNode = sourceFile && sourceFile.emitNode;\n        var annotatedNodes = emitNode && emitNode.annotatedNodes;\n        if (annotatedNodes) {\n            for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) {\n                var node = annotatedNodes_1[_i];\n                node.emitNode = undefined;\n            }\n        }\n    }\n    ts.disposeEmitNodes = disposeEmitNodes;\n    function getOrCreateEmitNode(node) {\n        if (!node.emitNode) {\n            if (ts.isParseTreeNode(node)) {\n                if (node.kind === 261) {\n                    return node.emitNode = { annotatedNodes: [node] };\n                }\n                var sourceFile = ts.getSourceFileOfNode(node);\n                getOrCreateEmitNode(sourceFile).annotatedNodes.push(node);\n            }\n            node.emitNode = {};\n        }\n        return node.emitNode;\n    }\n    ts.getOrCreateEmitNode = getOrCreateEmitNode;\n    function getEmitFlags(node) {\n        var emitNode = node.emitNode;\n        return emitNode && emitNode.flags;\n    }\n    ts.getEmitFlags = getEmitFlags;\n    function setEmitFlags(node, emitFlags) {\n        getOrCreateEmitNode(node).flags = emitFlags;\n        return node;\n    }\n    ts.setEmitFlags = setEmitFlags;\n    function getSourceMapRange(node) {\n        var emitNode = node.emitNode;\n        return (emitNode && emitNode.sourceMapRange) || node;\n    }\n    ts.getSourceMapRange = getSourceMapRange;\n    function setSourceMapRange(node, range) {\n        getOrCreateEmitNode(node).sourceMapRange = range;\n        return node;\n    }\n    ts.setSourceMapRange = setSourceMapRange;\n    function getTokenSourceMapRange(node, token) {\n        var emitNode = node.emitNode;\n        var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges;\n        return tokenSourceMapRanges && tokenSourceMapRanges[token];\n    }\n    ts.getTokenSourceMapRange = getTokenSourceMapRange;\n    function setTokenSourceMapRange(node, token, range) {\n        var emitNode = getOrCreateEmitNode(node);\n        var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap());\n        tokenSourceMapRanges[token] = range;\n        return node;\n    }\n    ts.setTokenSourceMapRange = setTokenSourceMapRange;\n    function getCommentRange(node) {\n        var emitNode = node.emitNode;\n        return (emitNode && emitNode.commentRange) || node;\n    }\n    ts.getCommentRange = getCommentRange;\n    function setCommentRange(node, range) {\n        getOrCreateEmitNode(node).commentRange = range;\n        return node;\n    }\n    ts.setCommentRange = setCommentRange;\n    function getConstantValue(node) {\n        var emitNode = node.emitNode;\n        return emitNode && emitNode.constantValue;\n    }\n    ts.getConstantValue = getConstantValue;\n    function setConstantValue(node, value) {\n        var emitNode = getOrCreateEmitNode(node);\n        emitNode.constantValue = value;\n        return node;\n    }\n    ts.setConstantValue = setConstantValue;\n    function getExternalHelpersModuleName(node) {\n        var parseNode = ts.getOriginalNode(node, ts.isSourceFile);\n        var emitNode = parseNode && parseNode.emitNode;\n        return emitNode && emitNode.externalHelpersModuleName;\n    }\n    ts.getExternalHelpersModuleName = getExternalHelpersModuleName;\n    function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions) {\n        if (compilerOptions.importHelpers && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {\n            var externalHelpersModuleName = getExternalHelpersModuleName(node);\n            if (externalHelpersModuleName) {\n                return externalHelpersModuleName;\n            }\n            var helpers = getEmitHelpers(node);\n            if (helpers) {\n                for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) {\n                    var helper = helpers_1[_i];\n                    if (!helper.scoped) {\n                        var parseNode = ts.getOriginalNode(node, ts.isSourceFile);\n                        var emitNode = getOrCreateEmitNode(parseNode);\n                        return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText));\n                    }\n                }\n            }\n        }\n    }\n    ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded;\n    function addEmitHelper(node, helper) {\n        var emitNode = getOrCreateEmitNode(node);\n        emitNode.helpers = ts.append(emitNode.helpers, helper);\n        return node;\n    }\n    ts.addEmitHelper = addEmitHelper;\n    function addEmitHelpers(node, helpers) {\n        if (ts.some(helpers)) {\n            var emitNode = getOrCreateEmitNode(node);\n            for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {\n                var helper = helpers_2[_i];\n                if (!ts.contains(emitNode.helpers, helper)) {\n                    emitNode.helpers = ts.append(emitNode.helpers, helper);\n                }\n            }\n        }\n        return node;\n    }\n    ts.addEmitHelpers = addEmitHelpers;\n    function removeEmitHelper(node, helper) {\n        var emitNode = node.emitNode;\n        if (emitNode) {\n            var helpers = emitNode.helpers;\n            if (helpers) {\n                return ts.orderedRemoveItem(helpers, helper);\n            }\n        }\n        return false;\n    }\n    ts.removeEmitHelper = removeEmitHelper;\n    function getEmitHelpers(node) {\n        var emitNode = node.emitNode;\n        return emitNode && emitNode.helpers;\n    }\n    ts.getEmitHelpers = getEmitHelpers;\n    function moveEmitHelpers(source, target, predicate) {\n        var sourceEmitNode = source.emitNode;\n        var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers;\n        if (!ts.some(sourceEmitHelpers))\n            return;\n        var targetEmitNode = getOrCreateEmitNode(target);\n        var helpersRemoved = 0;\n        for (var i = 0; i < sourceEmitHelpers.length; i++) {\n            var helper = sourceEmitHelpers[i];\n            if (predicate(helper)) {\n                helpersRemoved++;\n                if (!ts.contains(targetEmitNode.helpers, helper)) {\n                    targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper);\n                }\n            }\n            else if (helpersRemoved > 0) {\n                sourceEmitHelpers[i - helpersRemoved] = helper;\n            }\n        }\n        if (helpersRemoved > 0) {\n            sourceEmitHelpers.length -= helpersRemoved;\n        }\n    }\n    ts.moveEmitHelpers = moveEmitHelpers;\n    function compareEmitHelpers(x, y) {\n        if (x === y)\n            return 0;\n        if (x.priority === y.priority)\n            return 0;\n        if (x.priority === undefined)\n            return 1;\n        if (y.priority === undefined)\n            return -1;\n        return ts.compareValues(x.priority, y.priority);\n    }\n    ts.compareEmitHelpers = compareEmitHelpers;\n    function setTextRange(node, location) {\n        if (location) {\n            node.pos = location.pos;\n            node.end = location.end;\n        }\n        return node;\n    }\n    ts.setTextRange = setTextRange;\n    function setNodeFlags(node, flags) {\n        node.flags = flags;\n        return node;\n    }\n    ts.setNodeFlags = setNodeFlags;\n    function setMultiLine(node, multiLine) {\n        node.multiLine = multiLine;\n        return node;\n    }\n    ts.setMultiLine = setMultiLine;\n    function setHasTrailingComma(nodes, hasTrailingComma) {\n        nodes.hasTrailingComma = hasTrailingComma;\n        return nodes;\n    }\n    ts.setHasTrailingComma = setHasTrailingComma;\n    function getLocalNameForExternalImport(node, sourceFile) {\n        var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);\n        if (namespaceDeclaration && !ts.isDefaultImport(node)) {\n            var name_9 = namespaceDeclaration.name;\n            return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));\n        }\n        if (node.kind === 235 && node.importClause) {\n            return getGeneratedNameForNode(node);\n        }\n        if (node.kind === 241 && node.moduleSpecifier) {\n            return getGeneratedNameForNode(node);\n        }\n        return undefined;\n    }\n    ts.getLocalNameForExternalImport = getLocalNameForExternalImport;\n    function getExternalModuleNameLiteral(importNode, sourceFile, host, resolver, compilerOptions) {\n        var moduleName = ts.getExternalModuleName(importNode);\n        if (moduleName.kind === 9) {\n            return tryGetModuleNameFromDeclaration(importNode, host, resolver, compilerOptions)\n                || tryRenameExternalModule(moduleName, sourceFile)\n                || getSynthesizedClone(moduleName);\n        }\n        return undefined;\n    }\n    ts.getExternalModuleNameLiteral = getExternalModuleNameLiteral;\n    function tryRenameExternalModule(moduleName, sourceFile) {\n        if (sourceFile.renamedDependencies && ts.hasProperty(sourceFile.renamedDependencies, moduleName.text)) {\n            return createLiteral(sourceFile.renamedDependencies[moduleName.text]);\n        }\n        return undefined;\n    }\n    function tryGetModuleNameFromFile(file, host, options) {\n        if (!file) {\n            return undefined;\n        }\n        if (file.moduleName) {\n            return createLiteral(file.moduleName);\n        }\n        if (!ts.isDeclarationFile(file) && (options.out || options.outFile)) {\n            return createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName));\n        }\n        return undefined;\n    }\n    ts.tryGetModuleNameFromFile = tryGetModuleNameFromFile;\n    function tryGetModuleNameFromDeclaration(declaration, host, resolver, compilerOptions) {\n        return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions);\n    }\n    function getInitializerOfBindingOrAssignmentElement(bindingElement) {\n        if (ts.isDeclarationBindingElement(bindingElement)) {\n            return bindingElement.initializer;\n        }\n        if (ts.isPropertyAssignment(bindingElement)) {\n            return ts.isAssignmentExpression(bindingElement.initializer, true)\n                ? bindingElement.initializer.right\n                : undefined;\n        }\n        if (ts.isShorthandPropertyAssignment(bindingElement)) {\n            return bindingElement.objectAssignmentInitializer;\n        }\n        if (ts.isAssignmentExpression(bindingElement, true)) {\n            return bindingElement.right;\n        }\n        if (ts.isSpreadExpression(bindingElement)) {\n            return getInitializerOfBindingOrAssignmentElement(bindingElement.expression);\n        }\n    }\n    ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement;\n    function getTargetOfBindingOrAssignmentElement(bindingElement) {\n        if (ts.isDeclarationBindingElement(bindingElement)) {\n            return bindingElement.name;\n        }\n        if (ts.isObjectLiteralElementLike(bindingElement)) {\n            switch (bindingElement.kind) {\n                case 257:\n                    return getTargetOfBindingOrAssignmentElement(bindingElement.initializer);\n                case 258:\n                    return bindingElement.name;\n                case 259:\n                    return getTargetOfBindingOrAssignmentElement(bindingElement.expression);\n            }\n            return undefined;\n        }\n        if (ts.isAssignmentExpression(bindingElement, true)) {\n            return getTargetOfBindingOrAssignmentElement(bindingElement.left);\n        }\n        if (ts.isSpreadExpression(bindingElement)) {\n            return getTargetOfBindingOrAssignmentElement(bindingElement.expression);\n        }\n        return bindingElement;\n    }\n    ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement;\n    function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) {\n        switch (bindingElement.kind) {\n            case 144:\n            case 174:\n                return bindingElement.dotDotDotToken;\n            case 196:\n            case 259:\n                return bindingElement;\n        }\n        return undefined;\n    }\n    ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement;\n    function getPropertyNameOfBindingOrAssignmentElement(bindingElement) {\n        switch (bindingElement.kind) {\n            case 174:\n                if (bindingElement.propertyName) {\n                    var propertyName = bindingElement.propertyName;\n                    return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression)\n                        ? propertyName.expression\n                        : propertyName;\n                }\n                break;\n            case 257:\n                if (bindingElement.name) {\n                    var propertyName = bindingElement.name;\n                    return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression)\n                        ? propertyName.expression\n                        : propertyName;\n                }\n                break;\n            case 259:\n                return bindingElement.name;\n        }\n        var target = getTargetOfBindingOrAssignmentElement(bindingElement);\n        if (target && ts.isPropertyName(target)) {\n            return ts.isComputedPropertyName(target) && ts.isStringOrNumericLiteral(target.expression)\n                ? target.expression\n                : target;\n        }\n        ts.Debug.fail(\"Invalid property name for binding element.\");\n    }\n    ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement;\n    function getElementsOfBindingOrAssignmentPattern(name) {\n        switch (name.kind) {\n            case 172:\n            case 173:\n            case 175:\n                return name.elements;\n            case 176:\n                return name.properties;\n        }\n    }\n    ts.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern;\n    function convertToArrayAssignmentElement(element) {\n        if (ts.isBindingElement(element)) {\n            if (element.dotDotDotToken) {\n                ts.Debug.assertNode(element.name, ts.isIdentifier);\n                return setOriginalNode(createSpread(element.name, element), element);\n            }\n            var expression = convertToAssignmentElementTarget(element.name);\n            return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression;\n        }\n        ts.Debug.assertNode(element, ts.isExpression);\n        return element;\n    }\n    ts.convertToArrayAssignmentElement = convertToArrayAssignmentElement;\n    function convertToObjectAssignmentElement(element) {\n        if (ts.isBindingElement(element)) {\n            if (element.dotDotDotToken) {\n                ts.Debug.assertNode(element.name, ts.isIdentifier);\n                return setOriginalNode(createSpreadAssignment(element.name, element), element);\n            }\n            if (element.propertyName) {\n                var expression = convertToAssignmentElementTarget(element.name);\n                return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element);\n            }\n            ts.Debug.assertNode(element.name, ts.isIdentifier);\n            return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element);\n        }\n        ts.Debug.assertNode(element, ts.isObjectLiteralElementLike);\n        return element;\n    }\n    ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement;\n    function convertToAssignmentPattern(node) {\n        switch (node.kind) {\n            case 173:\n            case 175:\n                return convertToArrayAssignmentPattern(node);\n            case 172:\n            case 176:\n                return convertToObjectAssignmentPattern(node);\n        }\n    }\n    ts.convertToAssignmentPattern = convertToAssignmentPattern;\n    function convertToObjectAssignmentPattern(node) {\n        if (ts.isObjectBindingPattern(node)) {\n            return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node);\n        }\n        ts.Debug.assertNode(node, ts.isObjectLiteralExpression);\n        return node;\n    }\n    ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern;\n    function convertToArrayAssignmentPattern(node) {\n        if (ts.isArrayBindingPattern(node)) {\n            return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node);\n        }\n        ts.Debug.assertNode(node, ts.isArrayLiteralExpression);\n        return node;\n    }\n    ts.convertToArrayAssignmentPattern = convertToArrayAssignmentPattern;\n    function convertToAssignmentElementTarget(node) {\n        if (ts.isBindingPattern(node)) {\n            return convertToAssignmentPattern(node);\n        }\n        ts.Debug.assertNode(node, ts.isExpression);\n        return node;\n    }\n    ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget;\n    function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) {\n        var externalImports = [];\n        var exportSpecifiers = ts.createMap();\n        var exportedBindings = ts.createMap();\n        var uniqueExports = ts.createMap();\n        var exportedNames;\n        var hasExportDefault = false;\n        var exportEquals = undefined;\n        var hasExportStarsToExportValues = false;\n        var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions);\n        var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration(undefined, undefined, createImportClause(undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText));\n        if (externalHelpersImportDeclaration) {\n            externalImports.push(externalHelpersImportDeclaration);\n        }\n        for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {\n            var node = _a[_i];\n            switch (node.kind) {\n                case 235:\n                    externalImports.push(node);\n                    break;\n                case 234:\n                    if (node.moduleReference.kind === 245) {\n                        externalImports.push(node);\n                    }\n                    break;\n                case 241:\n                    if (node.moduleSpecifier) {\n                        if (!node.exportClause) {\n                            externalImports.push(node);\n                            hasExportStarsToExportValues = true;\n                        }\n                        else {\n                            externalImports.push(node);\n                        }\n                    }\n                    else {\n                        for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) {\n                            var specifier = _c[_b];\n                            if (!uniqueExports[specifier.name.text]) {\n                                var name_10 = specifier.propertyName || specifier.name;\n                                ts.multiMapAdd(exportSpecifiers, name_10.text, specifier);\n                                var decl = resolver.getReferencedImportDeclaration(name_10)\n                                    || resolver.getReferencedValueDeclaration(name_10);\n                                if (decl) {\n                                    ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name);\n                                }\n                                uniqueExports[specifier.name.text] = true;\n                                exportedNames = ts.append(exportedNames, specifier.name);\n                            }\n                        }\n                    }\n                    break;\n                case 240:\n                    if (node.isExportEquals && !exportEquals) {\n                        exportEquals = node;\n                    }\n                    break;\n                case 205:\n                    if (ts.hasModifier(node, 1)) {\n                        for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {\n                            var decl = _e[_d];\n                            exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames);\n                        }\n                    }\n                    break;\n                case 225:\n                    if (ts.hasModifier(node, 1)) {\n                        if (ts.hasModifier(node, 512)) {\n                            if (!hasExportDefault) {\n                                ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node));\n                                hasExportDefault = true;\n                            }\n                        }\n                        else {\n                            var name_11 = node.name;\n                            if (!uniqueExports[name_11.text]) {\n                                ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_11);\n                                uniqueExports[name_11.text] = true;\n                                exportedNames = ts.append(exportedNames, name_11);\n                            }\n                        }\n                    }\n                    break;\n                case 226:\n                    if (ts.hasModifier(node, 1)) {\n                        if (ts.hasModifier(node, 512)) {\n                            if (!hasExportDefault) {\n                                ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node));\n                                hasExportDefault = true;\n                            }\n                        }\n                        else {\n                            var name_12 = node.name;\n                            if (!uniqueExports[name_12.text]) {\n                                ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_12);\n                                uniqueExports[name_12.text] = true;\n                                exportedNames = ts.append(exportedNames, name_12);\n                            }\n                        }\n                    }\n                    break;\n            }\n        }\n        return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration };\n    }\n    ts.collectExternalModuleInfo = collectExternalModuleInfo;\n    function collectExportedVariableInfo(decl, uniqueExports, exportedNames) {\n        if (ts.isBindingPattern(decl.name)) {\n            for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {\n                var element = _a[_i];\n                if (!ts.isOmittedExpression(element)) {\n                    exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames);\n                }\n            }\n        }\n        else if (!ts.isGeneratedIdentifier(decl.name)) {\n            if (!uniqueExports[decl.name.text]) {\n                uniqueExports[decl.name.text] = true;\n                exportedNames = ts.append(exportedNames, decl.name);\n            }\n        }\n        return exportedNames;\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var NodeConstructor;\n    var TokenConstructor;\n    var IdentifierConstructor;\n    var SourceFileConstructor;\n    function createNode(kind, pos, end) {\n        if (kind === 261) {\n            return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);\n        }\n        else if (kind === 70) {\n            return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);\n        }\n        else if (kind < 141) {\n            return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end);\n        }\n        else {\n            return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end);\n        }\n    }\n    ts.createNode = createNode;\n    function visitNode(cbNode, node) {\n        if (node) {\n            return cbNode(node);\n        }\n    }\n    function visitNodeArray(cbNodes, nodes) {\n        if (nodes) {\n            return cbNodes(nodes);\n        }\n    }\n    function visitEachNode(cbNode, nodes) {\n        if (nodes) {\n            for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {\n                var node = nodes_1[_i];\n                var result = cbNode(node);\n                if (result) {\n                    return result;\n                }\n            }\n        }\n    }\n    function forEachChild(node, cbNode, cbNodeArray) {\n        if (!node) {\n            return;\n        }\n        var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode;\n        var cbNodes = cbNodeArray || cbNode;\n        switch (node.kind) {\n            case 141:\n                return visitNode(cbNode, node.left) ||\n                    visitNode(cbNode, node.right);\n            case 143:\n                return visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.constraint) ||\n                    visitNode(cbNode, node.expression);\n            case 258:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.questionToken) ||\n                    visitNode(cbNode, node.equalsToken) ||\n                    visitNode(cbNode, node.objectAssignmentInitializer);\n            case 259:\n                return visitNode(cbNode, node.expression);\n            case 144:\n            case 147:\n            case 146:\n            case 257:\n            case 223:\n            case 174:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.propertyName) ||\n                    visitNode(cbNode, node.dotDotDotToken) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.questionToken) ||\n                    visitNode(cbNode, node.type) ||\n                    visitNode(cbNode, node.initializer);\n            case 158:\n            case 159:\n            case 153:\n            case 154:\n            case 155:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNodes(cbNodes, node.typeParameters) ||\n                    visitNodes(cbNodes, node.parameters) ||\n                    visitNode(cbNode, node.type);\n            case 149:\n            case 148:\n            case 150:\n            case 151:\n            case 152:\n            case 184:\n            case 225:\n            case 185:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.asteriskToken) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.questionToken) ||\n                    visitNodes(cbNodes, node.typeParameters) ||\n                    visitNodes(cbNodes, node.parameters) ||\n                    visitNode(cbNode, node.type) ||\n                    visitNode(cbNode, node.equalsGreaterThanToken) ||\n                    visitNode(cbNode, node.body);\n            case 157:\n                return visitNode(cbNode, node.typeName) ||\n                    visitNodes(cbNodes, node.typeArguments);\n            case 156:\n                return visitNode(cbNode, node.parameterName) ||\n                    visitNode(cbNode, node.type);\n            case 160:\n                return visitNode(cbNode, node.exprName);\n            case 161:\n                return visitNodes(cbNodes, node.members);\n            case 162:\n                return visitNode(cbNode, node.elementType);\n            case 163:\n                return visitNodes(cbNodes, node.elementTypes);\n            case 164:\n            case 165:\n                return visitNodes(cbNodes, node.types);\n            case 166:\n            case 168:\n                return visitNode(cbNode, node.type);\n            case 169:\n                return visitNode(cbNode, node.objectType) ||\n                    visitNode(cbNode, node.indexType);\n            case 170:\n                return visitNode(cbNode, node.readonlyToken) ||\n                    visitNode(cbNode, node.typeParameter) ||\n                    visitNode(cbNode, node.questionToken) ||\n                    visitNode(cbNode, node.type);\n            case 171:\n                return visitNode(cbNode, node.literal);\n            case 172:\n            case 173:\n                return visitNodes(cbNodes, node.elements);\n            case 175:\n                return visitNodes(cbNodes, node.elements);\n            case 176:\n                return visitNodes(cbNodes, node.properties);\n            case 177:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.name);\n            case 178:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.argumentExpression);\n            case 179:\n            case 180:\n                return visitNode(cbNode, node.expression) ||\n                    visitNodes(cbNodes, node.typeArguments) ||\n                    visitNodes(cbNodes, node.arguments);\n            case 181:\n                return visitNode(cbNode, node.tag) ||\n                    visitNode(cbNode, node.template);\n            case 182:\n                return visitNode(cbNode, node.type) ||\n                    visitNode(cbNode, node.expression);\n            case 183:\n                return visitNode(cbNode, node.expression);\n            case 186:\n                return visitNode(cbNode, node.expression);\n            case 187:\n                return visitNode(cbNode, node.expression);\n            case 188:\n                return visitNode(cbNode, node.expression);\n            case 190:\n                return visitNode(cbNode, node.operand);\n            case 195:\n                return visitNode(cbNode, node.asteriskToken) ||\n                    visitNode(cbNode, node.expression);\n            case 189:\n                return visitNode(cbNode, node.expression);\n            case 191:\n                return visitNode(cbNode, node.operand);\n            case 192:\n                return visitNode(cbNode, node.left) ||\n                    visitNode(cbNode, node.operatorToken) ||\n                    visitNode(cbNode, node.right);\n            case 200:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.type);\n            case 201:\n                return visitNode(cbNode, node.expression);\n            case 193:\n                return visitNode(cbNode, node.condition) ||\n                    visitNode(cbNode, node.questionToken) ||\n                    visitNode(cbNode, node.whenTrue) ||\n                    visitNode(cbNode, node.colonToken) ||\n                    visitNode(cbNode, node.whenFalse);\n            case 196:\n                return visitNode(cbNode, node.expression);\n            case 204:\n            case 231:\n                return visitNodes(cbNodes, node.statements);\n            case 261:\n                return visitNodes(cbNodes, node.statements) ||\n                    visitNode(cbNode, node.endOfFileToken);\n            case 205:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.declarationList);\n            case 224:\n                return visitNodes(cbNodes, node.declarations);\n            case 207:\n                return visitNode(cbNode, node.expression);\n            case 208:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.thenStatement) ||\n                    visitNode(cbNode, node.elseStatement);\n            case 209:\n                return visitNode(cbNode, node.statement) ||\n                    visitNode(cbNode, node.expression);\n            case 210:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.statement);\n            case 211:\n                return visitNode(cbNode, node.initializer) ||\n                    visitNode(cbNode, node.condition) ||\n                    visitNode(cbNode, node.incrementor) ||\n                    visitNode(cbNode, node.statement);\n            case 212:\n                return visitNode(cbNode, node.initializer) ||\n                    visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.statement);\n            case 213:\n                return visitNode(cbNode, node.initializer) ||\n                    visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.statement);\n            case 214:\n            case 215:\n                return visitNode(cbNode, node.label);\n            case 216:\n                return visitNode(cbNode, node.expression);\n            case 217:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.statement);\n            case 218:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.caseBlock);\n            case 232:\n                return visitNodes(cbNodes, node.clauses);\n            case 253:\n                return visitNode(cbNode, node.expression) ||\n                    visitNodes(cbNodes, node.statements);\n            case 254:\n                return visitNodes(cbNodes, node.statements);\n            case 219:\n                return visitNode(cbNode, node.label) ||\n                    visitNode(cbNode, node.statement);\n            case 220:\n                return visitNode(cbNode, node.expression);\n            case 221:\n                return visitNode(cbNode, node.tryBlock) ||\n                    visitNode(cbNode, node.catchClause) ||\n                    visitNode(cbNode, node.finallyBlock);\n            case 256:\n                return visitNode(cbNode, node.variableDeclaration) ||\n                    visitNode(cbNode, node.block);\n            case 145:\n                return visitNode(cbNode, node.expression);\n            case 226:\n            case 197:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNodes(cbNodes, node.typeParameters) ||\n                    visitNodes(cbNodes, node.heritageClauses) ||\n                    visitNodes(cbNodes, node.members);\n            case 227:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNodes(cbNodes, node.typeParameters) ||\n                    visitNodes(cbNodes, node.heritageClauses) ||\n                    visitNodes(cbNodes, node.members);\n            case 228:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNodes(cbNodes, node.typeParameters) ||\n                    visitNode(cbNode, node.type);\n            case 229:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNodes(cbNodes, node.members);\n            case 260:\n                return visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.initializer);\n            case 230:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.body);\n            case 234:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.moduleReference);\n            case 235:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.importClause) ||\n                    visitNode(cbNode, node.moduleSpecifier);\n            case 236:\n                return visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.namedBindings);\n            case 233:\n                return visitNode(cbNode, node.name);\n            case 237:\n                return visitNode(cbNode, node.name);\n            case 238:\n            case 242:\n                return visitNodes(cbNodes, node.elements);\n            case 241:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.exportClause) ||\n                    visitNode(cbNode, node.moduleSpecifier);\n            case 239:\n            case 243:\n                return visitNode(cbNode, node.propertyName) ||\n                    visitNode(cbNode, node.name);\n            case 240:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.expression);\n            case 194:\n                return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans);\n            case 202:\n                return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal);\n            case 142:\n                return visitNode(cbNode, node.expression);\n            case 255:\n                return visitNodes(cbNodes, node.types);\n            case 199:\n                return visitNode(cbNode, node.expression) ||\n                    visitNodes(cbNodes, node.typeArguments);\n            case 245:\n                return visitNode(cbNode, node.expression);\n            case 244:\n                return visitNodes(cbNodes, node.decorators);\n            case 246:\n                return visitNode(cbNode, node.openingElement) ||\n                    visitNodes(cbNodes, node.children) ||\n                    visitNode(cbNode, node.closingElement);\n            case 247:\n            case 248:\n                return visitNode(cbNode, node.tagName) ||\n                    visitNodes(cbNodes, node.attributes);\n            case 250:\n                return visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.initializer);\n            case 251:\n                return visitNode(cbNode, node.expression);\n            case 252:\n                return visitNode(cbNode, node.expression);\n            case 249:\n                return visitNode(cbNode, node.tagName);\n            case 262:\n                return visitNode(cbNode, node.type);\n            case 266:\n                return visitNodes(cbNodes, node.types);\n            case 267:\n                return visitNodes(cbNodes, node.types);\n            case 265:\n                return visitNode(cbNode, node.elementType);\n            case 269:\n                return visitNode(cbNode, node.type);\n            case 268:\n                return visitNode(cbNode, node.type);\n            case 270:\n                return visitNode(cbNode, node.literal);\n            case 272:\n                return visitNode(cbNode, node.name) ||\n                    visitNodes(cbNodes, node.typeArguments);\n            case 273:\n                return visitNode(cbNode, node.type);\n            case 274:\n                return visitNodes(cbNodes, node.parameters) ||\n                    visitNode(cbNode, node.type);\n            case 275:\n                return visitNode(cbNode, node.type);\n            case 276:\n                return visitNode(cbNode, node.type);\n            case 277:\n                return visitNode(cbNode, node.type);\n            case 271:\n                return visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.type);\n            case 278:\n                return visitNodes(cbNodes, node.tags);\n            case 281:\n                return visitNode(cbNode, node.preParameterName) ||\n                    visitNode(cbNode, node.typeExpression) ||\n                    visitNode(cbNode, node.postParameterName);\n            case 282:\n                return visitNode(cbNode, node.typeExpression);\n            case 283:\n                return visitNode(cbNode, node.typeExpression);\n            case 280:\n                return visitNode(cbNode, node.typeExpression);\n            case 284:\n                return visitNodes(cbNodes, node.typeParameters);\n            case 285:\n                return visitNode(cbNode, node.typeExpression) ||\n                    visitNode(cbNode, node.fullName) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.jsDocTypeLiteral);\n            case 287:\n                return visitNodes(cbNodes, node.jsDocPropertyTags);\n            case 286:\n                return visitNode(cbNode, node.typeExpression) ||\n                    visitNode(cbNode, node.name);\n            case 294:\n                return visitNode(cbNode, node.expression);\n            case 288:\n                return visitNode(cbNode, node.literal);\n        }\n    }\n    ts.forEachChild = forEachChild;\n    function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) {\n        if (setParentNodes === void 0) { setParentNodes = false; }\n        ts.performance.mark(\"beforeParse\");\n        var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes, scriptKind);\n        ts.performance.mark(\"afterParse\");\n        ts.performance.measure(\"Parse\", \"beforeParse\", \"afterParse\");\n        return result;\n    }\n    ts.createSourceFile = createSourceFile;\n    function parseIsolatedEntityName(text, languageVersion) {\n        return Parser.parseIsolatedEntityName(text, languageVersion);\n    }\n    ts.parseIsolatedEntityName = parseIsolatedEntityName;\n    function isExternalModule(file) {\n        return file.externalModuleIndicator !== undefined;\n    }\n    ts.isExternalModule = isExternalModule;\n    function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) {\n        return IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);\n    }\n    ts.updateSourceFile = updateSourceFile;\n    function parseIsolatedJSDocComment(content, start, length) {\n        var result = Parser.JSDocParser.parseIsolatedJSDocComment(content, start, length);\n        if (result && result.jsDoc) {\n            Parser.fixupParentReferences(result.jsDoc);\n        }\n        return result;\n    }\n    ts.parseIsolatedJSDocComment = parseIsolatedJSDocComment;\n    function parseJSDocTypeExpressionForTests(content, start, length) {\n        return Parser.JSDocParser.parseJSDocTypeExpressionForTests(content, start, length);\n    }\n    ts.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;\n    var Parser;\n    (function (Parser) {\n        var scanner = ts.createScanner(5, true);\n        var disallowInAndDecoratorContext = 2048 | 8192;\n        var NodeConstructor;\n        var TokenConstructor;\n        var IdentifierConstructor;\n        var SourceFileConstructor;\n        var sourceFile;\n        var parseDiagnostics;\n        var syntaxCursor;\n        var currentToken;\n        var sourceText;\n        var nodeCount;\n        var identifiers;\n        var identifierCount;\n        var parsingContext;\n        var contextFlags;\n        var parseErrorBeforeNextFinishedNode = false;\n        function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes, scriptKind) {\n            scriptKind = ts.ensureScriptKind(fileName, scriptKind);\n            initializeState(sourceText, languageVersion, syntaxCursor, scriptKind);\n            var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind);\n            clearState();\n            return result;\n        }\n        Parser.parseSourceFile = parseSourceFile;\n        function parseIsolatedEntityName(content, languageVersion) {\n            initializeState(content, languageVersion, undefined, 1);\n            nextToken();\n            var entityName = parseEntityName(true);\n            var isInvalid = token() === 1 && !parseDiagnostics.length;\n            clearState();\n            return isInvalid ? entityName : undefined;\n        }\n        Parser.parseIsolatedEntityName = parseIsolatedEntityName;\n        function getLanguageVariant(scriptKind) {\n            return scriptKind === 4 || scriptKind === 2 || scriptKind === 1 ? 1 : 0;\n        }\n        function initializeState(_sourceText, languageVersion, _syntaxCursor, scriptKind) {\n            NodeConstructor = ts.objectAllocator.getNodeConstructor();\n            TokenConstructor = ts.objectAllocator.getTokenConstructor();\n            IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor();\n            SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor();\n            sourceText = _sourceText;\n            syntaxCursor = _syntaxCursor;\n            parseDiagnostics = [];\n            parsingContext = 0;\n            identifiers = ts.createMap();\n            identifierCount = 0;\n            nodeCount = 0;\n            contextFlags = scriptKind === 1 || scriptKind === 2 ? 65536 : 0;\n            parseErrorBeforeNextFinishedNode = false;\n            scanner.setText(sourceText);\n            scanner.setOnError(scanError);\n            scanner.setScriptTarget(languageVersion);\n            scanner.setLanguageVariant(getLanguageVariant(scriptKind));\n        }\n        function clearState() {\n            scanner.setText(\"\");\n            scanner.setOnError(undefined);\n            parseDiagnostics = undefined;\n            sourceFile = undefined;\n            identifiers = undefined;\n            syntaxCursor = undefined;\n            sourceText = undefined;\n        }\n        function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) {\n            sourceFile = createSourceFile(fileName, languageVersion, scriptKind);\n            sourceFile.flags = contextFlags;\n            nextToken();\n            processReferenceComments(sourceFile);\n            sourceFile.statements = parseList(0, parseStatement);\n            ts.Debug.assert(token() === 1);\n            sourceFile.endOfFileToken = parseTokenNode();\n            setExternalModuleIndicator(sourceFile);\n            sourceFile.nodeCount = nodeCount;\n            sourceFile.identifierCount = identifierCount;\n            sourceFile.identifiers = identifiers;\n            sourceFile.parseDiagnostics = parseDiagnostics;\n            if (setParentNodes) {\n                fixupParentReferences(sourceFile);\n            }\n            return sourceFile;\n        }\n        function addJSDocComment(node) {\n            var comments = ts.getJSDocCommentRanges(node, sourceFile.text);\n            if (comments) {\n                for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) {\n                    var comment = comments_2[_i];\n                    var jsDoc = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos);\n                    if (!jsDoc) {\n                        continue;\n                    }\n                    if (!node.jsDoc) {\n                        node.jsDoc = [];\n                    }\n                    node.jsDoc.push(jsDoc);\n                }\n            }\n            return node;\n        }\n        function fixupParentReferences(rootNode) {\n            var parent = rootNode;\n            forEachChild(rootNode, visitNode);\n            return;\n            function visitNode(n) {\n                if (n.parent !== parent) {\n                    n.parent = parent;\n                    var saveParent = parent;\n                    parent = n;\n                    forEachChild(n, visitNode);\n                    if (n.jsDoc) {\n                        for (var _i = 0, _a = n.jsDoc; _i < _a.length; _i++) {\n                            var jsDoc = _a[_i];\n                            jsDoc.parent = n;\n                            parent = jsDoc;\n                            forEachChild(jsDoc, visitNode);\n                        }\n                    }\n                    parent = saveParent;\n                }\n            }\n        }\n        Parser.fixupParentReferences = fixupParentReferences;\n        function createSourceFile(fileName, languageVersion, scriptKind) {\n            var sourceFile = new SourceFileConstructor(261, 0, sourceText.length);\n            nodeCount++;\n            sourceFile.text = sourceText;\n            sourceFile.bindDiagnostics = [];\n            sourceFile.languageVersion = languageVersion;\n            sourceFile.fileName = ts.normalizePath(fileName);\n            sourceFile.languageVariant = getLanguageVariant(scriptKind);\n            sourceFile.isDeclarationFile = ts.fileExtensionIs(sourceFile.fileName, \".d.ts\");\n            sourceFile.scriptKind = scriptKind;\n            return sourceFile;\n        }\n        function setContextFlag(val, flag) {\n            if (val) {\n                contextFlags |= flag;\n            }\n            else {\n                contextFlags &= ~flag;\n            }\n        }\n        function setDisallowInContext(val) {\n            setContextFlag(val, 2048);\n        }\n        function setYieldContext(val) {\n            setContextFlag(val, 4096);\n        }\n        function setDecoratorContext(val) {\n            setContextFlag(val, 8192);\n        }\n        function setAwaitContext(val) {\n            setContextFlag(val, 16384);\n        }\n        function doOutsideOfContext(context, func) {\n            var contextFlagsToClear = context & contextFlags;\n            if (contextFlagsToClear) {\n                setContextFlag(false, contextFlagsToClear);\n                var result = func();\n                setContextFlag(true, contextFlagsToClear);\n                return result;\n            }\n            return func();\n        }\n        function doInsideOfContext(context, func) {\n            var contextFlagsToSet = context & ~contextFlags;\n            if (contextFlagsToSet) {\n                setContextFlag(true, contextFlagsToSet);\n                var result = func();\n                setContextFlag(false, contextFlagsToSet);\n                return result;\n            }\n            return func();\n        }\n        function allowInAnd(func) {\n            return doOutsideOfContext(2048, func);\n        }\n        function disallowInAnd(func) {\n            return doInsideOfContext(2048, func);\n        }\n        function doInYieldContext(func) {\n            return doInsideOfContext(4096, func);\n        }\n        function doInDecoratorContext(func) {\n            return doInsideOfContext(8192, func);\n        }\n        function doInAwaitContext(func) {\n            return doInsideOfContext(16384, func);\n        }\n        function doOutsideOfAwaitContext(func) {\n            return doOutsideOfContext(16384, func);\n        }\n        function doInYieldAndAwaitContext(func) {\n            return doInsideOfContext(4096 | 16384, func);\n        }\n        function inContext(flags) {\n            return (contextFlags & flags) !== 0;\n        }\n        function inYieldContext() {\n            return inContext(4096);\n        }\n        function inDisallowInContext() {\n            return inContext(2048);\n        }\n        function inDecoratorContext() {\n            return inContext(8192);\n        }\n        function inAwaitContext() {\n            return inContext(16384);\n        }\n        function parseErrorAtCurrentToken(message, arg0) {\n            var start = scanner.getTokenPos();\n            var length = scanner.getTextPos() - start;\n            parseErrorAtPosition(start, length, message, arg0);\n        }\n        function parseErrorAtPosition(start, length, message, arg0) {\n            var lastError = ts.lastOrUndefined(parseDiagnostics);\n            if (!lastError || start !== lastError.start) {\n                parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, start, length, message, arg0));\n            }\n            parseErrorBeforeNextFinishedNode = true;\n        }\n        function scanError(message, length) {\n            var pos = scanner.getTextPos();\n            parseErrorAtPosition(pos, length || 0, message);\n        }\n        function getNodePos() {\n            return scanner.getStartPos();\n        }\n        function getNodeEnd() {\n            return scanner.getStartPos();\n        }\n        function token() {\n            return currentToken;\n        }\n        function nextToken() {\n            return currentToken = scanner.scan();\n        }\n        function reScanGreaterToken() {\n            return currentToken = scanner.reScanGreaterToken();\n        }\n        function reScanSlashToken() {\n            return currentToken = scanner.reScanSlashToken();\n        }\n        function reScanTemplateToken() {\n            return currentToken = scanner.reScanTemplateToken();\n        }\n        function scanJsxIdentifier() {\n            return currentToken = scanner.scanJsxIdentifier();\n        }\n        function scanJsxText() {\n            return currentToken = scanner.scanJsxToken();\n        }\n        function scanJsxAttributeValue() {\n            return currentToken = scanner.scanJsxAttributeValue();\n        }\n        function speculationHelper(callback, isLookAhead) {\n            var saveToken = currentToken;\n            var saveParseDiagnosticsLength = parseDiagnostics.length;\n            var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;\n            var saveContextFlags = contextFlags;\n            var result = isLookAhead\n                ? scanner.lookAhead(callback)\n                : scanner.tryScan(callback);\n            ts.Debug.assert(saveContextFlags === contextFlags);\n            if (!result || isLookAhead) {\n                currentToken = saveToken;\n                parseDiagnostics.length = saveParseDiagnosticsLength;\n                parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode;\n            }\n            return result;\n        }\n        function lookAhead(callback) {\n            return speculationHelper(callback, true);\n        }\n        function tryParse(callback) {\n            return speculationHelper(callback, false);\n        }\n        function isIdentifier() {\n            if (token() === 70) {\n                return true;\n            }\n            if (token() === 115 && inYieldContext()) {\n                return false;\n            }\n            if (token() === 120 && inAwaitContext()) {\n                return false;\n            }\n            return token() > 106;\n        }\n        function parseExpected(kind, diagnosticMessage, shouldAdvance) {\n            if (shouldAdvance === void 0) { shouldAdvance = true; }\n            if (token() === kind) {\n                if (shouldAdvance) {\n                    nextToken();\n                }\n                return true;\n            }\n            if (diagnosticMessage) {\n                parseErrorAtCurrentToken(diagnosticMessage);\n            }\n            else {\n                parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));\n            }\n            return false;\n        }\n        function parseOptional(t) {\n            if (token() === t) {\n                nextToken();\n                return true;\n            }\n            return false;\n        }\n        function parseOptionalToken(t) {\n            if (token() === t) {\n                return parseTokenNode();\n            }\n            return undefined;\n        }\n        function parseExpectedToken(t, reportAtCurrentPosition, diagnosticMessage, arg0) {\n            return parseOptionalToken(t) ||\n                createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0);\n        }\n        function parseTokenNode() {\n            var node = createNode(token());\n            nextToken();\n            return finishNode(node);\n        }\n        function canParseSemicolon() {\n            if (token() === 24) {\n                return true;\n            }\n            return token() === 17 || token() === 1 || scanner.hasPrecedingLineBreak();\n        }\n        function parseSemicolon() {\n            if (canParseSemicolon()) {\n                if (token() === 24) {\n                    nextToken();\n                }\n                return true;\n            }\n            else {\n                return parseExpected(24);\n            }\n        }\n        function createNode(kind, pos) {\n            nodeCount++;\n            if (!(pos >= 0)) {\n                pos = scanner.getStartPos();\n            }\n            return kind >= 141 ? new NodeConstructor(kind, pos, pos) :\n                kind === 70 ? new IdentifierConstructor(kind, pos, pos) :\n                    new TokenConstructor(kind, pos, pos);\n        }\n        function createNodeArray(elements, pos) {\n            var array = (elements || []);\n            if (!(pos >= 0)) {\n                pos = getNodePos();\n            }\n            array.pos = pos;\n            array.end = pos;\n            return array;\n        }\n        function finishNode(node, end) {\n            node.end = end === undefined ? scanner.getStartPos() : end;\n            if (contextFlags) {\n                node.flags |= contextFlags;\n            }\n            if (parseErrorBeforeNextFinishedNode) {\n                parseErrorBeforeNextFinishedNode = false;\n                node.flags |= 32768;\n            }\n            return node;\n        }\n        function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, arg0) {\n            if (reportAtCurrentPosition) {\n                parseErrorAtPosition(scanner.getStartPos(), 0, diagnosticMessage, arg0);\n            }\n            else {\n                parseErrorAtCurrentToken(diagnosticMessage, arg0);\n            }\n            var result = createNode(kind, scanner.getStartPos());\n            result.text = \"\";\n            return finishNode(result);\n        }\n        function internIdentifier(text) {\n            text = ts.escapeIdentifier(text);\n            return identifiers[text] || (identifiers[text] = text);\n        }\n        function createIdentifier(isIdentifier, diagnosticMessage) {\n            identifierCount++;\n            if (isIdentifier) {\n                var node = createNode(70);\n                if (token() !== 70) {\n                    node.originalKeywordKind = token();\n                }\n                node.text = internIdentifier(scanner.getTokenValue());\n                nextToken();\n                return finishNode(node);\n            }\n            return createMissingNode(70, false, diagnosticMessage || ts.Diagnostics.Identifier_expected);\n        }\n        function parseIdentifier(diagnosticMessage) {\n            return createIdentifier(isIdentifier(), diagnosticMessage);\n        }\n        function parseIdentifierName() {\n            return createIdentifier(ts.tokenIsIdentifierOrKeyword(token()));\n        }\n        function isLiteralPropertyName() {\n            return ts.tokenIsIdentifierOrKeyword(token()) ||\n                token() === 9 ||\n                token() === 8;\n        }\n        function parsePropertyNameWorker(allowComputedPropertyNames) {\n            if (token() === 9 || token() === 8) {\n                return parseLiteralNode(true);\n            }\n            if (allowComputedPropertyNames && token() === 20) {\n                return parseComputedPropertyName();\n            }\n            return parseIdentifierName();\n        }\n        function parsePropertyName() {\n            return parsePropertyNameWorker(true);\n        }\n        function parseSimplePropertyName() {\n            return parsePropertyNameWorker(false);\n        }\n        function isSimplePropertyName() {\n            return token() === 9 || token() === 8 || ts.tokenIsIdentifierOrKeyword(token());\n        }\n        function parseComputedPropertyName() {\n            var node = createNode(142);\n            parseExpected(20);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(21);\n            return finishNode(node);\n        }\n        function parseContextualModifier(t) {\n            return token() === t && tryParse(nextTokenCanFollowModifier);\n        }\n        function nextTokenIsOnSameLineAndCanFollowModifier() {\n            nextToken();\n            if (scanner.hasPrecedingLineBreak()) {\n                return false;\n            }\n            return canFollowModifier();\n        }\n        function nextTokenCanFollowModifier() {\n            if (token() === 75) {\n                return nextToken() === 82;\n            }\n            if (token() === 83) {\n                nextToken();\n                if (token() === 78) {\n                    return lookAhead(nextTokenIsClassOrFunctionOrAsync);\n                }\n                return token() !== 38 && token() !== 117 && token() !== 16 && canFollowModifier();\n            }\n            if (token() === 78) {\n                return nextTokenIsClassOrFunctionOrAsync();\n            }\n            if (token() === 114) {\n                nextToken();\n                return canFollowModifier();\n            }\n            return nextTokenIsOnSameLineAndCanFollowModifier();\n        }\n        function parseAnyContextualModifier() {\n            return ts.isModifierKind(token()) && tryParse(nextTokenCanFollowModifier);\n        }\n        function canFollowModifier() {\n            return token() === 20\n                || token() === 16\n                || token() === 38\n                || token() === 23\n                || isLiteralPropertyName();\n        }\n        function nextTokenIsClassOrFunctionOrAsync() {\n            nextToken();\n            return token() === 74 || token() === 88 ||\n                (token() === 119 && lookAhead(nextTokenIsFunctionKeywordOnSameLine));\n        }\n        function isListElement(parsingContext, inErrorRecovery) {\n            var node = currentNode(parsingContext);\n            if (node) {\n                return true;\n            }\n            switch (parsingContext) {\n                case 0:\n                case 1:\n                case 3:\n                    return !(token() === 24 && inErrorRecovery) && isStartOfStatement();\n                case 2:\n                    return token() === 72 || token() === 78;\n                case 4:\n                    return lookAhead(isTypeMemberStart);\n                case 5:\n                    return lookAhead(isClassMemberStart) || (token() === 24 && !inErrorRecovery);\n                case 6:\n                    return token() === 20 || isLiteralPropertyName();\n                case 12:\n                    return token() === 20 || token() === 38 || token() === 23 || isLiteralPropertyName();\n                case 17:\n                    return isLiteralPropertyName();\n                case 9:\n                    return token() === 20 || token() === 23 || isLiteralPropertyName();\n                case 7:\n                    if (token() === 16) {\n                        return lookAhead(isValidHeritageClauseObjectLiteral);\n                    }\n                    if (!inErrorRecovery) {\n                        return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword();\n                    }\n                    else {\n                        return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword();\n                    }\n                case 8:\n                    return isIdentifierOrPattern();\n                case 10:\n                    return token() === 25 || token() === 23 || isIdentifierOrPattern();\n                case 18:\n                    return isIdentifier();\n                case 11:\n                case 15:\n                    return token() === 25 || token() === 23 || isStartOfExpression();\n                case 16:\n                    return isStartOfParameter();\n                case 19:\n                case 20:\n                    return token() === 25 || isStartOfType();\n                case 21:\n                    return isHeritageClause();\n                case 22:\n                    return ts.tokenIsIdentifierOrKeyword(token());\n                case 13:\n                    return ts.tokenIsIdentifierOrKeyword(token()) || token() === 16;\n                case 14:\n                    return true;\n                case 23:\n                case 24:\n                case 26:\n                    return JSDocParser.isJSDocType();\n                case 25:\n                    return isSimplePropertyName();\n            }\n            ts.Debug.fail(\"Non-exhaustive case in 'isListElement'.\");\n        }\n        function isValidHeritageClauseObjectLiteral() {\n            ts.Debug.assert(token() === 16);\n            if (nextToken() === 17) {\n                var next = nextToken();\n                return next === 25 || next === 16 || next === 84 || next === 107;\n            }\n            return true;\n        }\n        function nextTokenIsIdentifier() {\n            nextToken();\n            return isIdentifier();\n        }\n        function nextTokenIsIdentifierOrKeyword() {\n            nextToken();\n            return ts.tokenIsIdentifierOrKeyword(token());\n        }\n        function isHeritageClauseExtendsOrImplementsKeyword() {\n            if (token() === 107 ||\n                token() === 84) {\n                return lookAhead(nextTokenIsStartOfExpression);\n            }\n            return false;\n        }\n        function nextTokenIsStartOfExpression() {\n            nextToken();\n            return isStartOfExpression();\n        }\n        function isListTerminator(kind) {\n            if (token() === 1) {\n                return true;\n            }\n            switch (kind) {\n                case 1:\n                case 2:\n                case 4:\n                case 5:\n                case 6:\n                case 12:\n                case 9:\n                case 22:\n                    return token() === 17;\n                case 3:\n                    return token() === 17 || token() === 72 || token() === 78;\n                case 7:\n                    return token() === 16 || token() === 84 || token() === 107;\n                case 8:\n                    return isVariableDeclaratorListTerminator();\n                case 18:\n                    return token() === 28 || token() === 18 || token() === 16 || token() === 84 || token() === 107;\n                case 11:\n                    return token() === 19 || token() === 24;\n                case 15:\n                case 20:\n                case 10:\n                    return token() === 21;\n                case 16:\n                case 17:\n                    return token() === 19 || token() === 21;\n                case 19:\n                    return token() !== 25;\n                case 21:\n                    return token() === 16 || token() === 17;\n                case 13:\n                    return token() === 28 || token() === 40;\n                case 14:\n                    return token() === 26 && lookAhead(nextTokenIsSlash);\n                case 23:\n                    return token() === 19 || token() === 55 || token() === 17;\n                case 24:\n                    return token() === 28 || token() === 17;\n                case 26:\n                    return token() === 21 || token() === 17;\n                case 25:\n                    return token() === 17;\n            }\n        }\n        function isVariableDeclaratorListTerminator() {\n            if (canParseSemicolon()) {\n                return true;\n            }\n            if (isInOrOfKeyword(token())) {\n                return true;\n            }\n            if (token() === 35) {\n                return true;\n            }\n            return false;\n        }\n        function isInSomeParsingContext() {\n            for (var kind = 0; kind < 27; kind++) {\n                if (parsingContext & (1 << kind)) {\n                    if (isListElement(kind, true) || isListTerminator(kind)) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function parseList(kind, parseElement) {\n            var saveParsingContext = parsingContext;\n            parsingContext |= 1 << kind;\n            var result = createNodeArray();\n            while (!isListTerminator(kind)) {\n                if (isListElement(kind, false)) {\n                    var element = parseListElement(kind, parseElement);\n                    result.push(element);\n                    continue;\n                }\n                if (abortParsingListOrMoveToNextToken(kind)) {\n                    break;\n                }\n            }\n            result.end = getNodeEnd();\n            parsingContext = saveParsingContext;\n            return result;\n        }\n        function parseListElement(parsingContext, parseElement) {\n            var node = currentNode(parsingContext);\n            if (node) {\n                return consumeNode(node);\n            }\n            return parseElement();\n        }\n        function currentNode(parsingContext) {\n            if (parseErrorBeforeNextFinishedNode) {\n                return undefined;\n            }\n            if (!syntaxCursor) {\n                return undefined;\n            }\n            var node = syntaxCursor.currentNode(scanner.getStartPos());\n            if (ts.nodeIsMissing(node)) {\n                return undefined;\n            }\n            if (node.intersectsChange) {\n                return undefined;\n            }\n            if (ts.containsParseError(node)) {\n                return undefined;\n            }\n            var nodeContextFlags = node.flags & 96256;\n            if (nodeContextFlags !== contextFlags) {\n                return undefined;\n            }\n            if (!canReuseNode(node, parsingContext)) {\n                return undefined;\n            }\n            return node;\n        }\n        function consumeNode(node) {\n            scanner.setTextPos(node.end);\n            nextToken();\n            return node;\n        }\n        function canReuseNode(node, parsingContext) {\n            switch (parsingContext) {\n                case 5:\n                    return isReusableClassMember(node);\n                case 2:\n                    return isReusableSwitchClause(node);\n                case 0:\n                case 1:\n                case 3:\n                    return isReusableStatement(node);\n                case 6:\n                    return isReusableEnumMember(node);\n                case 4:\n                    return isReusableTypeMember(node);\n                case 8:\n                    return isReusableVariableDeclaration(node);\n                case 16:\n                    return isReusableParameter(node);\n                case 17:\n                    return false;\n                case 21:\n                case 18:\n                case 20:\n                case 19:\n                case 11:\n                case 12:\n                case 7:\n                case 13:\n                case 14:\n            }\n            return false;\n        }\n        function isReusableClassMember(node) {\n            if (node) {\n                switch (node.kind) {\n                    case 150:\n                    case 155:\n                    case 151:\n                    case 152:\n                    case 147:\n                    case 203:\n                        return true;\n                    case 149:\n                        var methodDeclaration = node;\n                        var nameIsConstructor = methodDeclaration.name.kind === 70 &&\n                            methodDeclaration.name.originalKeywordKind === 122;\n                        return !nameIsConstructor;\n                }\n            }\n            return false;\n        }\n        function isReusableSwitchClause(node) {\n            if (node) {\n                switch (node.kind) {\n                    case 253:\n                    case 254:\n                        return true;\n                }\n            }\n            return false;\n        }\n        function isReusableStatement(node) {\n            if (node) {\n                switch (node.kind) {\n                    case 225:\n                    case 205:\n                    case 204:\n                    case 208:\n                    case 207:\n                    case 220:\n                    case 216:\n                    case 218:\n                    case 215:\n                    case 214:\n                    case 212:\n                    case 213:\n                    case 211:\n                    case 210:\n                    case 217:\n                    case 206:\n                    case 221:\n                    case 219:\n                    case 209:\n                    case 222:\n                    case 235:\n                    case 234:\n                    case 241:\n                    case 240:\n                    case 230:\n                    case 226:\n                    case 227:\n                    case 229:\n                    case 228:\n                        return true;\n                }\n            }\n            return false;\n        }\n        function isReusableEnumMember(node) {\n            return node.kind === 260;\n        }\n        function isReusableTypeMember(node) {\n            if (node) {\n                switch (node.kind) {\n                    case 154:\n                    case 148:\n                    case 155:\n                    case 146:\n                    case 153:\n                        return true;\n                }\n            }\n            return false;\n        }\n        function isReusableVariableDeclaration(node) {\n            if (node.kind !== 223) {\n                return false;\n            }\n            var variableDeclarator = node;\n            return variableDeclarator.initializer === undefined;\n        }\n        function isReusableParameter(node) {\n            if (node.kind !== 144) {\n                return false;\n            }\n            var parameter = node;\n            return parameter.initializer === undefined;\n        }\n        function abortParsingListOrMoveToNextToken(kind) {\n            parseErrorAtCurrentToken(parsingContextErrors(kind));\n            if (isInSomeParsingContext()) {\n                return true;\n            }\n            nextToken();\n            return false;\n        }\n        function parsingContextErrors(context) {\n            switch (context) {\n                case 0: return ts.Diagnostics.Declaration_or_statement_expected;\n                case 1: return ts.Diagnostics.Declaration_or_statement_expected;\n                case 2: return ts.Diagnostics.case_or_default_expected;\n                case 3: return ts.Diagnostics.Statement_expected;\n                case 17:\n                case 4: return ts.Diagnostics.Property_or_signature_expected;\n                case 5: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected;\n                case 6: return ts.Diagnostics.Enum_member_expected;\n                case 7: return ts.Diagnostics.Expression_expected;\n                case 8: return ts.Diagnostics.Variable_declaration_expected;\n                case 9: return ts.Diagnostics.Property_destructuring_pattern_expected;\n                case 10: return ts.Diagnostics.Array_element_destructuring_pattern_expected;\n                case 11: return ts.Diagnostics.Argument_expression_expected;\n                case 12: return ts.Diagnostics.Property_assignment_expected;\n                case 15: return ts.Diagnostics.Expression_or_comma_expected;\n                case 16: return ts.Diagnostics.Parameter_declaration_expected;\n                case 18: return ts.Diagnostics.Type_parameter_declaration_expected;\n                case 19: return ts.Diagnostics.Type_argument_expected;\n                case 20: return ts.Diagnostics.Type_expected;\n                case 21: return ts.Diagnostics.Unexpected_token_expected;\n                case 22: return ts.Diagnostics.Identifier_expected;\n                case 13: return ts.Diagnostics.Identifier_expected;\n                case 14: return ts.Diagnostics.Identifier_expected;\n                case 23: return ts.Diagnostics.Parameter_declaration_expected;\n                case 24: return ts.Diagnostics.Type_argument_expected;\n                case 26: return ts.Diagnostics.Type_expected;\n                case 25: return ts.Diagnostics.Property_assignment_expected;\n            }\n        }\n        ;\n        function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) {\n            var saveParsingContext = parsingContext;\n            parsingContext |= 1 << kind;\n            var result = createNodeArray();\n            var commaStart = -1;\n            while (true) {\n                if (isListElement(kind, false)) {\n                    result.push(parseListElement(kind, parseElement));\n                    commaStart = scanner.getTokenPos();\n                    if (parseOptional(25)) {\n                        continue;\n                    }\n                    commaStart = -1;\n                    if (isListTerminator(kind)) {\n                        break;\n                    }\n                    parseExpected(25);\n                    if (considerSemicolonAsDelimiter && token() === 24 && !scanner.hasPrecedingLineBreak()) {\n                        nextToken();\n                    }\n                    continue;\n                }\n                if (isListTerminator(kind)) {\n                    break;\n                }\n                if (abortParsingListOrMoveToNextToken(kind)) {\n                    break;\n                }\n            }\n            if (commaStart >= 0) {\n                result.hasTrailingComma = true;\n            }\n            result.end = getNodeEnd();\n            parsingContext = saveParsingContext;\n            return result;\n        }\n        function createMissingList() {\n            return createNodeArray();\n        }\n        function parseBracketedList(kind, parseElement, open, close) {\n            if (parseExpected(open)) {\n                var result = parseDelimitedList(kind, parseElement);\n                parseExpected(close);\n                return result;\n            }\n            return createMissingList();\n        }\n        function parseEntityName(allowReservedWords, diagnosticMessage) {\n            var entity = parseIdentifier(diagnosticMessage);\n            while (parseOptional(22)) {\n                var node = createNode(141, entity.pos);\n                node.left = entity;\n                node.right = parseRightSideOfDot(allowReservedWords);\n                entity = finishNode(node);\n            }\n            return entity;\n        }\n        function parseRightSideOfDot(allowIdentifierNames) {\n            if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token())) {\n                var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);\n                if (matchesPattern) {\n                    return createMissingNode(70, true, ts.Diagnostics.Identifier_expected);\n                }\n            }\n            return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();\n        }\n        function parseTemplateExpression() {\n            var template = createNode(194);\n            template.head = parseTemplateHead();\n            ts.Debug.assert(template.head.kind === 13, \"Template head has wrong token kind\");\n            var templateSpans = createNodeArray();\n            do {\n                templateSpans.push(parseTemplateSpan());\n            } while (ts.lastOrUndefined(templateSpans).literal.kind === 14);\n            templateSpans.end = getNodeEnd();\n            template.templateSpans = templateSpans;\n            return finishNode(template);\n        }\n        function parseTemplateSpan() {\n            var span = createNode(202);\n            span.expression = allowInAnd(parseExpression);\n            var literal;\n            if (token() === 17) {\n                reScanTemplateToken();\n                literal = parseTemplateMiddleOrTemplateTail();\n            }\n            else {\n                literal = parseExpectedToken(15, false, ts.Diagnostics._0_expected, ts.tokenToString(17));\n            }\n            span.literal = literal;\n            return finishNode(span);\n        }\n        function parseLiteralNode(internName) {\n            return parseLiteralLikeNode(token(), internName);\n        }\n        function parseTemplateHead() {\n            var fragment = parseLiteralLikeNode(token(), false);\n            ts.Debug.assert(fragment.kind === 13, \"Template head has wrong token kind\");\n            return fragment;\n        }\n        function parseTemplateMiddleOrTemplateTail() {\n            var fragment = parseLiteralLikeNode(token(), false);\n            ts.Debug.assert(fragment.kind === 14 || fragment.kind === 15, \"Template fragment has wrong token kind\");\n            return fragment;\n        }\n        function parseLiteralLikeNode(kind, internName) {\n            var node = createNode(kind);\n            var text = scanner.getTokenValue();\n            node.text = internName ? internIdentifier(text) : text;\n            if (scanner.hasExtendedUnicodeEscape()) {\n                node.hasExtendedUnicodeEscape = true;\n            }\n            if (scanner.isUnterminated()) {\n                node.isUnterminated = true;\n            }\n            var tokenPos = scanner.getTokenPos();\n            nextToken();\n            finishNode(node);\n            if (node.kind === 8\n                && sourceText.charCodeAt(tokenPos) === 48\n                && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) {\n                node.isOctalLiteral = true;\n            }\n            return node;\n        }\n        function parseTypeReference() {\n            var typeName = parseEntityName(false, ts.Diagnostics.Type_expected);\n            var node = createNode(157, typeName.pos);\n            node.typeName = typeName;\n            if (!scanner.hasPrecedingLineBreak() && token() === 26) {\n                node.typeArguments = parseBracketedList(19, parseType, 26, 28);\n            }\n            return finishNode(node);\n        }\n        function parseThisTypePredicate(lhs) {\n            nextToken();\n            var node = createNode(156, lhs.pos);\n            node.parameterName = lhs;\n            node.type = parseType();\n            return finishNode(node);\n        }\n        function parseThisTypeNode() {\n            var node = createNode(167);\n            nextToken();\n            return finishNode(node);\n        }\n        function parseTypeQuery() {\n            var node = createNode(160);\n            parseExpected(102);\n            node.exprName = parseEntityName(true);\n            return finishNode(node);\n        }\n        function parseTypeParameter() {\n            var node = createNode(143);\n            node.name = parseIdentifier();\n            if (parseOptional(84)) {\n                if (isStartOfType() || !isStartOfExpression()) {\n                    node.constraint = parseType();\n                }\n                else {\n                    node.expression = parseUnaryExpressionOrHigher();\n                }\n            }\n            return finishNode(node);\n        }\n        function parseTypeParameters() {\n            if (token() === 26) {\n                return parseBracketedList(18, parseTypeParameter, 26, 28);\n            }\n        }\n        function parseParameterType() {\n            if (parseOptional(55)) {\n                return parseType();\n            }\n            return undefined;\n        }\n        function isStartOfParameter() {\n            return token() === 23 || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 56 || token() === 98;\n        }\n        function parseParameter() {\n            var node = createNode(144);\n            if (token() === 98) {\n                node.name = createIdentifier(true, undefined);\n                node.type = parseParameterType();\n                return finishNode(node);\n            }\n            node.decorators = parseDecorators();\n            node.modifiers = parseModifiers();\n            node.dotDotDotToken = parseOptionalToken(23);\n            node.name = parseIdentifierOrPattern();\n            if (ts.getFullWidth(node.name) === 0 && !ts.hasModifiers(node) && ts.isModifierKind(token())) {\n                nextToken();\n            }\n            node.questionToken = parseOptionalToken(54);\n            node.type = parseParameterType();\n            node.initializer = parseBindingElementInitializer(true);\n            return addJSDocComment(finishNode(node));\n        }\n        function parseBindingElementInitializer(inParameter) {\n            return inParameter ? parseParameterInitializer() : parseNonParameterInitializer();\n        }\n        function parseParameterInitializer() {\n            return parseInitializer(true);\n        }\n        function fillSignature(returnToken, yieldContext, awaitContext, requireCompleteParameterList, signature) {\n            var returnTokenRequired = returnToken === 35;\n            signature.typeParameters = parseTypeParameters();\n            signature.parameters = parseParameterList(yieldContext, awaitContext, requireCompleteParameterList);\n            if (returnTokenRequired) {\n                parseExpected(returnToken);\n                signature.type = parseTypeOrTypePredicate();\n            }\n            else if (parseOptional(returnToken)) {\n                signature.type = parseTypeOrTypePredicate();\n            }\n        }\n        function parseParameterList(yieldContext, awaitContext, requireCompleteParameterList) {\n            if (parseExpected(18)) {\n                var savedYieldContext = inYieldContext();\n                var savedAwaitContext = inAwaitContext();\n                setYieldContext(yieldContext);\n                setAwaitContext(awaitContext);\n                var result = parseDelimitedList(16, parseParameter);\n                setYieldContext(savedYieldContext);\n                setAwaitContext(savedAwaitContext);\n                if (!parseExpected(19) && requireCompleteParameterList) {\n                    return undefined;\n                }\n                return result;\n            }\n            return requireCompleteParameterList ? undefined : createMissingList();\n        }\n        function parseTypeMemberSemicolon() {\n            if (parseOptional(25)) {\n                return;\n            }\n            parseSemicolon();\n        }\n        function parseSignatureMember(kind) {\n            var node = createNode(kind);\n            if (kind === 154) {\n                parseExpected(93);\n            }\n            fillSignature(55, false, false, false, node);\n            parseTypeMemberSemicolon();\n            return addJSDocComment(finishNode(node));\n        }\n        function isIndexSignature() {\n            if (token() !== 20) {\n                return false;\n            }\n            return lookAhead(isUnambiguouslyIndexSignature);\n        }\n        function isUnambiguouslyIndexSignature() {\n            nextToken();\n            if (token() === 23 || token() === 21) {\n                return true;\n            }\n            if (ts.isModifierKind(token())) {\n                nextToken();\n                if (isIdentifier()) {\n                    return true;\n                }\n            }\n            else if (!isIdentifier()) {\n                return false;\n            }\n            else {\n                nextToken();\n            }\n            if (token() === 55 || token() === 25) {\n                return true;\n            }\n            if (token() !== 54) {\n                return false;\n            }\n            nextToken();\n            return token() === 55 || token() === 25 || token() === 21;\n        }\n        function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(155, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            node.parameters = parseBracketedList(16, parseParameter, 20, 21);\n            node.type = parseTypeAnnotation();\n            parseTypeMemberSemicolon();\n            return finishNode(node);\n        }\n        function parsePropertyOrMethodSignature(fullStart, modifiers) {\n            var name = parsePropertyName();\n            var questionToken = parseOptionalToken(54);\n            if (token() === 18 || token() === 26) {\n                var method = createNode(148, fullStart);\n                method.modifiers = modifiers;\n                method.name = name;\n                method.questionToken = questionToken;\n                fillSignature(55, false, false, false, method);\n                parseTypeMemberSemicolon();\n                return addJSDocComment(finishNode(method));\n            }\n            else {\n                var property = createNode(146, fullStart);\n                property.modifiers = modifiers;\n                property.name = name;\n                property.questionToken = questionToken;\n                property.type = parseTypeAnnotation();\n                if (token() === 57) {\n                    property.initializer = parseNonParameterInitializer();\n                }\n                parseTypeMemberSemicolon();\n                return addJSDocComment(finishNode(property));\n            }\n        }\n        function isTypeMemberStart() {\n            var idToken;\n            if (token() === 18 || token() === 26) {\n                return true;\n            }\n            while (ts.isModifierKind(token())) {\n                idToken = token();\n                nextToken();\n            }\n            if (token() === 20) {\n                return true;\n            }\n            if (isLiteralPropertyName()) {\n                idToken = token();\n                nextToken();\n            }\n            if (idToken) {\n                return token() === 18 ||\n                    token() === 26 ||\n                    token() === 54 ||\n                    token() === 55 ||\n                    token() === 25 ||\n                    canParseSemicolon();\n            }\n            return false;\n        }\n        function parseTypeMember() {\n            if (token() === 18 || token() === 26) {\n                return parseSignatureMember(153);\n            }\n            if (token() === 93 && lookAhead(isStartOfConstructSignature)) {\n                return parseSignatureMember(154);\n            }\n            var fullStart = getNodePos();\n            var modifiers = parseModifiers();\n            if (isIndexSignature()) {\n                return parseIndexSignatureDeclaration(fullStart, undefined, modifiers);\n            }\n            return parsePropertyOrMethodSignature(fullStart, modifiers);\n        }\n        function isStartOfConstructSignature() {\n            nextToken();\n            return token() === 18 || token() === 26;\n        }\n        function parseTypeLiteral() {\n            var node = createNode(161);\n            node.members = parseObjectTypeMembers();\n            return finishNode(node);\n        }\n        function parseObjectTypeMembers() {\n            var members;\n            if (parseExpected(16)) {\n                members = parseList(4, parseTypeMember);\n                parseExpected(17);\n            }\n            else {\n                members = createMissingList();\n            }\n            return members;\n        }\n        function isStartOfMappedType() {\n            nextToken();\n            if (token() === 130) {\n                nextToken();\n            }\n            return token() === 20 && nextTokenIsIdentifier() && nextToken() === 91;\n        }\n        function parseMappedTypeParameter() {\n            var node = createNode(143);\n            node.name = parseIdentifier();\n            parseExpected(91);\n            node.constraint = parseType();\n            return finishNode(node);\n        }\n        function parseMappedType() {\n            var node = createNode(170);\n            parseExpected(16);\n            node.readonlyToken = parseOptionalToken(130);\n            parseExpected(20);\n            node.typeParameter = parseMappedTypeParameter();\n            parseExpected(21);\n            node.questionToken = parseOptionalToken(54);\n            node.type = parseTypeAnnotation();\n            parseSemicolon();\n            parseExpected(17);\n            return finishNode(node);\n        }\n        function parseTupleType() {\n            var node = createNode(163);\n            node.elementTypes = parseBracketedList(20, parseType, 20, 21);\n            return finishNode(node);\n        }\n        function parseParenthesizedType() {\n            var node = createNode(166);\n            parseExpected(18);\n            node.type = parseType();\n            parseExpected(19);\n            return finishNode(node);\n        }\n        function parseFunctionOrConstructorType(kind) {\n            var node = createNode(kind);\n            if (kind === 159) {\n                parseExpected(93);\n            }\n            fillSignature(35, false, false, false, node);\n            return finishNode(node);\n        }\n        function parseKeywordAndNoDot() {\n            var node = parseTokenNode();\n            return token() === 22 ? undefined : node;\n        }\n        function parseLiteralTypeNode() {\n            var node = createNode(171);\n            node.literal = parseSimpleUnaryExpression();\n            finishNode(node);\n            return node;\n        }\n        function nextTokenIsNumericLiteral() {\n            return nextToken() === 8;\n        }\n        function parseNonArrayType() {\n            switch (token()) {\n                case 118:\n                case 134:\n                case 132:\n                case 121:\n                case 135:\n                case 137:\n                case 129:\n                    var node = tryParse(parseKeywordAndNoDot);\n                    return node || parseTypeReference();\n                case 9:\n                case 8:\n                case 100:\n                case 85:\n                    return parseLiteralTypeNode();\n                case 37:\n                    return lookAhead(nextTokenIsNumericLiteral) ? parseLiteralTypeNode() : parseTypeReference();\n                case 104:\n                case 94:\n                    return parseTokenNode();\n                case 98: {\n                    var thisKeyword = parseThisTypeNode();\n                    if (token() === 125 && !scanner.hasPrecedingLineBreak()) {\n                        return parseThisTypePredicate(thisKeyword);\n                    }\n                    else {\n                        return thisKeyword;\n                    }\n                }\n                case 102:\n                    return parseTypeQuery();\n                case 16:\n                    return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral();\n                case 20:\n                    return parseTupleType();\n                case 18:\n                    return parseParenthesizedType();\n                default:\n                    return parseTypeReference();\n            }\n        }\n        function isStartOfType() {\n            switch (token()) {\n                case 118:\n                case 134:\n                case 132:\n                case 121:\n                case 135:\n                case 104:\n                case 137:\n                case 94:\n                case 98:\n                case 102:\n                case 129:\n                case 16:\n                case 20:\n                case 26:\n                case 48:\n                case 47:\n                case 93:\n                case 9:\n                case 8:\n                case 100:\n                case 85:\n                    return true;\n                case 37:\n                    return lookAhead(nextTokenIsNumericLiteral);\n                case 18:\n                    return lookAhead(isStartOfParenthesizedOrFunctionType);\n                default:\n                    return isIdentifier();\n            }\n        }\n        function isStartOfParenthesizedOrFunctionType() {\n            nextToken();\n            return token() === 19 || isStartOfParameter() || isStartOfType();\n        }\n        function parseArrayTypeOrHigher() {\n            var type = parseNonArrayType();\n            while (!scanner.hasPrecedingLineBreak() && parseOptional(20)) {\n                if (isStartOfType()) {\n                    var node = createNode(169, type.pos);\n                    node.objectType = type;\n                    node.indexType = parseType();\n                    parseExpected(21);\n                    type = finishNode(node);\n                }\n                else {\n                    var node = createNode(162, type.pos);\n                    node.elementType = type;\n                    parseExpected(21);\n                    type = finishNode(node);\n                }\n            }\n            return type;\n        }\n        function parseTypeOperator(operator) {\n            var node = createNode(168);\n            parseExpected(operator);\n            node.operator = operator;\n            node.type = parseTypeOperatorOrHigher();\n            return finishNode(node);\n        }\n        function parseTypeOperatorOrHigher() {\n            switch (token()) {\n                case 126:\n                    return parseTypeOperator(126);\n            }\n            return parseArrayTypeOrHigher();\n        }\n        function parseUnionOrIntersectionType(kind, parseConstituentType, operator) {\n            parseOptional(operator);\n            var type = parseConstituentType();\n            if (token() === operator) {\n                var types = createNodeArray([type], type.pos);\n                while (parseOptional(operator)) {\n                    types.push(parseConstituentType());\n                }\n                types.end = getNodeEnd();\n                var node = createNode(kind, type.pos);\n                node.types = types;\n                type = finishNode(node);\n            }\n            return type;\n        }\n        function parseIntersectionTypeOrHigher() {\n            return parseUnionOrIntersectionType(165, parseTypeOperatorOrHigher, 47);\n        }\n        function parseUnionTypeOrHigher() {\n            return parseUnionOrIntersectionType(164, parseIntersectionTypeOrHigher, 48);\n        }\n        function isStartOfFunctionType() {\n            if (token() === 26) {\n                return true;\n            }\n            return token() === 18 && lookAhead(isUnambiguouslyStartOfFunctionType);\n        }\n        function skipParameterStart() {\n            if (ts.isModifierKind(token())) {\n                parseModifiers();\n            }\n            if (isIdentifier() || token() === 98) {\n                nextToken();\n                return true;\n            }\n            if (token() === 20 || token() === 16) {\n                var previousErrorCount = parseDiagnostics.length;\n                parseIdentifierOrPattern();\n                return previousErrorCount === parseDiagnostics.length;\n            }\n            return false;\n        }\n        function isUnambiguouslyStartOfFunctionType() {\n            nextToken();\n            if (token() === 19 || token() === 23) {\n                return true;\n            }\n            if (skipParameterStart()) {\n                if (token() === 55 || token() === 25 ||\n                    token() === 54 || token() === 57) {\n                    return true;\n                }\n                if (token() === 19) {\n                    nextToken();\n                    if (token() === 35) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function parseTypeOrTypePredicate() {\n            var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix);\n            var type = parseType();\n            if (typePredicateVariable) {\n                var node = createNode(156, typePredicateVariable.pos);\n                node.parameterName = typePredicateVariable;\n                node.type = type;\n                return finishNode(node);\n            }\n            else {\n                return type;\n            }\n        }\n        function parseTypePredicatePrefix() {\n            var id = parseIdentifier();\n            if (token() === 125 && !scanner.hasPrecedingLineBreak()) {\n                nextToken();\n                return id;\n            }\n        }\n        function parseType() {\n            return doOutsideOfContext(20480, parseTypeWorker);\n        }\n        function parseTypeWorker() {\n            if (isStartOfFunctionType()) {\n                return parseFunctionOrConstructorType(158);\n            }\n            if (token() === 93) {\n                return parseFunctionOrConstructorType(159);\n            }\n            return parseUnionTypeOrHigher();\n        }\n        function parseTypeAnnotation() {\n            return parseOptional(55) ? parseType() : undefined;\n        }\n        function isStartOfLeftHandSideExpression() {\n            switch (token()) {\n                case 98:\n                case 96:\n                case 94:\n                case 100:\n                case 85:\n                case 8:\n                case 9:\n                case 12:\n                case 13:\n                case 18:\n                case 20:\n                case 16:\n                case 88:\n                case 74:\n                case 93:\n                case 40:\n                case 62:\n                case 70:\n                    return true;\n                default:\n                    return isIdentifier();\n            }\n        }\n        function isStartOfExpression() {\n            if (isStartOfLeftHandSideExpression()) {\n                return true;\n            }\n            switch (token()) {\n                case 36:\n                case 37:\n                case 51:\n                case 50:\n                case 79:\n                case 102:\n                case 104:\n                case 42:\n                case 43:\n                case 26:\n                case 120:\n                case 115:\n                    return true;\n                default:\n                    if (isBinaryOperator()) {\n                        return true;\n                    }\n                    return isIdentifier();\n            }\n        }\n        function isStartOfExpressionStatement() {\n            return token() !== 16 &&\n                token() !== 88 &&\n                token() !== 74 &&\n                token() !== 56 &&\n                isStartOfExpression();\n        }\n        function parseExpression() {\n            var saveDecoratorContext = inDecoratorContext();\n            if (saveDecoratorContext) {\n                setDecoratorContext(false);\n            }\n            var expr = parseAssignmentExpressionOrHigher();\n            var operatorToken;\n            while ((operatorToken = parseOptionalToken(25))) {\n                expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher());\n            }\n            if (saveDecoratorContext) {\n                setDecoratorContext(true);\n            }\n            return expr;\n        }\n        function parseInitializer(inParameter) {\n            if (token() !== 57) {\n                if (scanner.hasPrecedingLineBreak() || (inParameter && token() === 16) || !isStartOfExpression()) {\n                    return undefined;\n                }\n            }\n            parseExpected(57);\n            return parseAssignmentExpressionOrHigher();\n        }\n        function parseAssignmentExpressionOrHigher() {\n            if (isYieldExpression()) {\n                return parseYieldExpression();\n            }\n            var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();\n            if (arrowExpression) {\n                return arrowExpression;\n            }\n            var expr = parseBinaryExpressionOrHigher(0);\n            if (expr.kind === 70 && token() === 35) {\n                return parseSimpleArrowFunctionExpression(expr);\n            }\n            if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {\n                return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher());\n            }\n            return parseConditionalExpressionRest(expr);\n        }\n        function isYieldExpression() {\n            if (token() === 115) {\n                if (inYieldContext()) {\n                    return true;\n                }\n                return lookAhead(nextTokenIsIdentifierOrKeywordOrNumberOnSameLine);\n            }\n            return false;\n        }\n        function nextTokenIsIdentifierOnSameLine() {\n            nextToken();\n            return !scanner.hasPrecedingLineBreak() && isIdentifier();\n        }\n        function parseYieldExpression() {\n            var node = createNode(195);\n            nextToken();\n            if (!scanner.hasPrecedingLineBreak() &&\n                (token() === 38 || isStartOfExpression())) {\n                node.asteriskToken = parseOptionalToken(38);\n                node.expression = parseAssignmentExpressionOrHigher();\n                return finishNode(node);\n            }\n            else {\n                return finishNode(node);\n            }\n        }\n        function parseSimpleArrowFunctionExpression(identifier, asyncModifier) {\n            ts.Debug.assert(token() === 35, \"parseSimpleArrowFunctionExpression should only have been called if we had a =>\");\n            var node;\n            if (asyncModifier) {\n                node = createNode(185, asyncModifier.pos);\n                node.modifiers = asyncModifier;\n            }\n            else {\n                node = createNode(185, identifier.pos);\n            }\n            var parameter = createNode(144, identifier.pos);\n            parameter.name = identifier;\n            finishNode(parameter);\n            node.parameters = createNodeArray([parameter], parameter.pos);\n            node.parameters.end = parameter.end;\n            node.equalsGreaterThanToken = parseExpectedToken(35, false, ts.Diagnostics._0_expected, \"=>\");\n            node.body = parseArrowFunctionExpressionBody(!!asyncModifier);\n            return addJSDocComment(finishNode(node));\n        }\n        function tryParseParenthesizedArrowFunctionExpression() {\n            var triState = isParenthesizedArrowFunctionExpression();\n            if (triState === 0) {\n                return undefined;\n            }\n            var arrowFunction = triState === 1\n                ? parseParenthesizedArrowFunctionExpressionHead(true)\n                : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead);\n            if (!arrowFunction) {\n                return undefined;\n            }\n            var isAsync = !!(ts.getModifierFlags(arrowFunction) & 256);\n            var lastToken = token();\n            arrowFunction.equalsGreaterThanToken = parseExpectedToken(35, false, ts.Diagnostics._0_expected, \"=>\");\n            arrowFunction.body = (lastToken === 35 || lastToken === 16)\n                ? parseArrowFunctionExpressionBody(isAsync)\n                : parseIdentifier();\n            return addJSDocComment(finishNode(arrowFunction));\n        }\n        function isParenthesizedArrowFunctionExpression() {\n            if (token() === 18 || token() === 26 || token() === 119) {\n                return lookAhead(isParenthesizedArrowFunctionExpressionWorker);\n            }\n            if (token() === 35) {\n                return 1;\n            }\n            return 0;\n        }\n        function isParenthesizedArrowFunctionExpressionWorker() {\n            if (token() === 119) {\n                nextToken();\n                if (scanner.hasPrecedingLineBreak()) {\n                    return 0;\n                }\n                if (token() !== 18 && token() !== 26) {\n                    return 0;\n                }\n            }\n            var first = token();\n            var second = nextToken();\n            if (first === 18) {\n                if (second === 19) {\n                    var third = nextToken();\n                    switch (third) {\n                        case 35:\n                        case 55:\n                        case 16:\n                            return 1;\n                        default:\n                            return 0;\n                    }\n                }\n                if (second === 20 || second === 16) {\n                    return 2;\n                }\n                if (second === 23) {\n                    return 1;\n                }\n                if (!isIdentifier()) {\n                    return 0;\n                }\n                if (nextToken() === 55) {\n                    return 1;\n                }\n                return 2;\n            }\n            else {\n                ts.Debug.assert(first === 26);\n                if (!isIdentifier()) {\n                    return 0;\n                }\n                if (sourceFile.languageVariant === 1) {\n                    var isArrowFunctionInJsx = lookAhead(function () {\n                        var third = nextToken();\n                        if (third === 84) {\n                            var fourth = nextToken();\n                            switch (fourth) {\n                                case 57:\n                                case 28:\n                                    return false;\n                                default:\n                                    return true;\n                            }\n                        }\n                        else if (third === 25) {\n                            return true;\n                        }\n                        return false;\n                    });\n                    if (isArrowFunctionInJsx) {\n                        return 1;\n                    }\n                    return 0;\n                }\n                return 2;\n            }\n        }\n        function parsePossibleParenthesizedArrowFunctionExpressionHead() {\n            return parseParenthesizedArrowFunctionExpressionHead(false);\n        }\n        function tryParseAsyncSimpleArrowFunctionExpression() {\n            if (token() === 119) {\n                var isUnParenthesizedAsyncArrowFunction = lookAhead(isUnParenthesizedAsyncArrowFunctionWorker);\n                if (isUnParenthesizedAsyncArrowFunction === 1) {\n                    var asyncModifier = parseModifiersForArrowFunction();\n                    var expr = parseBinaryExpressionOrHigher(0);\n                    return parseSimpleArrowFunctionExpression(expr, asyncModifier);\n                }\n            }\n            return undefined;\n        }\n        function isUnParenthesizedAsyncArrowFunctionWorker() {\n            if (token() === 119) {\n                nextToken();\n                if (scanner.hasPrecedingLineBreak() || token() === 35) {\n                    return 0;\n                }\n                var expr = parseBinaryExpressionOrHigher(0);\n                if (!scanner.hasPrecedingLineBreak() && expr.kind === 70 && token() === 35) {\n                    return 1;\n                }\n            }\n            return 0;\n        }\n        function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) {\n            var node = createNode(185);\n            node.modifiers = parseModifiersForArrowFunction();\n            var isAsync = !!(ts.getModifierFlags(node) & 256);\n            fillSignature(55, false, isAsync, !allowAmbiguity, node);\n            if (!node.parameters) {\n                return undefined;\n            }\n            if (!allowAmbiguity && token() !== 35 && token() !== 16) {\n                return undefined;\n            }\n            return node;\n        }\n        function parseArrowFunctionExpressionBody(isAsync) {\n            if (token() === 16) {\n                return parseFunctionBlock(false, isAsync, false);\n            }\n            if (token() !== 24 &&\n                token() !== 88 &&\n                token() !== 74 &&\n                isStartOfStatement() &&\n                !isStartOfExpressionStatement()) {\n                return parseFunctionBlock(false, isAsync, true);\n            }\n            return isAsync\n                ? doInAwaitContext(parseAssignmentExpressionOrHigher)\n                : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);\n        }\n        function parseConditionalExpressionRest(leftOperand) {\n            var questionToken = parseOptionalToken(54);\n            if (!questionToken) {\n                return leftOperand;\n            }\n            var node = createNode(193, leftOperand.pos);\n            node.condition = leftOperand;\n            node.questionToken = questionToken;\n            node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);\n            node.colonToken = parseExpectedToken(55, false, ts.Diagnostics._0_expected, ts.tokenToString(55));\n            node.whenFalse = parseAssignmentExpressionOrHigher();\n            return finishNode(node);\n        }\n        function parseBinaryExpressionOrHigher(precedence) {\n            var leftOperand = parseUnaryExpressionOrHigher();\n            return parseBinaryExpressionRest(precedence, leftOperand);\n        }\n        function isInOrOfKeyword(t) {\n            return t === 91 || t === 140;\n        }\n        function parseBinaryExpressionRest(precedence, leftOperand) {\n            while (true) {\n                reScanGreaterToken();\n                var newPrecedence = getBinaryOperatorPrecedence();\n                var consumeCurrentOperator = token() === 39 ?\n                    newPrecedence >= precedence :\n                    newPrecedence > precedence;\n                if (!consumeCurrentOperator) {\n                    break;\n                }\n                if (token() === 91 && inDisallowInContext()) {\n                    break;\n                }\n                if (token() === 117) {\n                    if (scanner.hasPrecedingLineBreak()) {\n                        break;\n                    }\n                    else {\n                        nextToken();\n                        leftOperand = makeAsExpression(leftOperand, parseType());\n                    }\n                }\n                else {\n                    leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence));\n                }\n            }\n            return leftOperand;\n        }\n        function isBinaryOperator() {\n            if (inDisallowInContext() && token() === 91) {\n                return false;\n            }\n            return getBinaryOperatorPrecedence() > 0;\n        }\n        function getBinaryOperatorPrecedence() {\n            switch (token()) {\n                case 53:\n                    return 1;\n                case 52:\n                    return 2;\n                case 48:\n                    return 3;\n                case 49:\n                    return 4;\n                case 47:\n                    return 5;\n                case 31:\n                case 32:\n                case 33:\n                case 34:\n                    return 6;\n                case 26:\n                case 28:\n                case 29:\n                case 30:\n                case 92:\n                case 91:\n                case 117:\n                    return 7;\n                case 44:\n                case 45:\n                case 46:\n                    return 8;\n                case 36:\n                case 37:\n                    return 9;\n                case 38:\n                case 40:\n                case 41:\n                    return 10;\n                case 39:\n                    return 11;\n            }\n            return -1;\n        }\n        function makeBinaryExpression(left, operatorToken, right) {\n            var node = createNode(192, left.pos);\n            node.left = left;\n            node.operatorToken = operatorToken;\n            node.right = right;\n            return finishNode(node);\n        }\n        function makeAsExpression(left, right) {\n            var node = createNode(200, left.pos);\n            node.expression = left;\n            node.type = right;\n            return finishNode(node);\n        }\n        function parsePrefixUnaryExpression() {\n            var node = createNode(190);\n            node.operator = token();\n            nextToken();\n            node.operand = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        function parseDeleteExpression() {\n            var node = createNode(186);\n            nextToken();\n            node.expression = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        function parseTypeOfExpression() {\n            var node = createNode(187);\n            nextToken();\n            node.expression = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        function parseVoidExpression() {\n            var node = createNode(188);\n            nextToken();\n            node.expression = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        function isAwaitExpression() {\n            if (token() === 120) {\n                if (inAwaitContext()) {\n                    return true;\n                }\n                return lookAhead(nextTokenIsIdentifierOnSameLine);\n            }\n            return false;\n        }\n        function parseAwaitExpression() {\n            var node = createNode(189);\n            nextToken();\n            node.expression = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        function parseUnaryExpressionOrHigher() {\n            if (isUpdateExpression()) {\n                var incrementExpression = parseIncrementExpression();\n                return token() === 39 ?\n                    parseBinaryExpressionRest(getBinaryOperatorPrecedence(), incrementExpression) :\n                    incrementExpression;\n            }\n            var unaryOperator = token();\n            var simpleUnaryExpression = parseSimpleUnaryExpression();\n            if (token() === 39) {\n                var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos);\n                if (simpleUnaryExpression.kind === 182) {\n                    parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);\n                }\n                else {\n                    parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, ts.tokenToString(unaryOperator));\n                }\n            }\n            return simpleUnaryExpression;\n        }\n        function parseSimpleUnaryExpression() {\n            switch (token()) {\n                case 36:\n                case 37:\n                case 51:\n                case 50:\n                    return parsePrefixUnaryExpression();\n                case 79:\n                    return parseDeleteExpression();\n                case 102:\n                    return parseTypeOfExpression();\n                case 104:\n                    return parseVoidExpression();\n                case 26:\n                    return parseTypeAssertion();\n                case 120:\n                    if (isAwaitExpression()) {\n                        return parseAwaitExpression();\n                    }\n                default:\n                    return parseIncrementExpression();\n            }\n        }\n        function isUpdateExpression() {\n            switch (token()) {\n                case 36:\n                case 37:\n                case 51:\n                case 50:\n                case 79:\n                case 102:\n                case 104:\n                case 120:\n                    return false;\n                case 26:\n                    if (sourceFile.languageVariant !== 1) {\n                        return false;\n                    }\n                default:\n                    return true;\n            }\n        }\n        function parseIncrementExpression() {\n            if (token() === 42 || token() === 43) {\n                var node = createNode(190);\n                node.operator = token();\n                nextToken();\n                node.operand = parseLeftHandSideExpressionOrHigher();\n                return finishNode(node);\n            }\n            else if (sourceFile.languageVariant === 1 && token() === 26 && lookAhead(nextTokenIsIdentifierOrKeyword)) {\n                return parseJsxElementOrSelfClosingElement(true);\n            }\n            var expression = parseLeftHandSideExpressionOrHigher();\n            ts.Debug.assert(ts.isLeftHandSideExpression(expression));\n            if ((token() === 42 || token() === 43) && !scanner.hasPrecedingLineBreak()) {\n                var node = createNode(191, expression.pos);\n                node.operand = expression;\n                node.operator = token();\n                nextToken();\n                return finishNode(node);\n            }\n            return expression;\n        }\n        function parseLeftHandSideExpressionOrHigher() {\n            var expression = token() === 96\n                ? parseSuperExpression()\n                : parseMemberExpressionOrHigher();\n            return parseCallExpressionRest(expression);\n        }\n        function parseMemberExpressionOrHigher() {\n            var expression = parsePrimaryExpression();\n            return parseMemberExpressionRest(expression);\n        }\n        function parseSuperExpression() {\n            var expression = parseTokenNode();\n            if (token() === 18 || token() === 22 || token() === 20) {\n                return expression;\n            }\n            var node = createNode(177, expression.pos);\n            node.expression = expression;\n            parseExpectedToken(22, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);\n            node.name = parseRightSideOfDot(true);\n            return finishNode(node);\n        }\n        function tagNamesAreEquivalent(lhs, rhs) {\n            if (lhs.kind !== rhs.kind) {\n                return false;\n            }\n            if (lhs.kind === 70) {\n                return lhs.text === rhs.text;\n            }\n            if (lhs.kind === 98) {\n                return true;\n            }\n            return lhs.name.text === rhs.name.text &&\n                tagNamesAreEquivalent(lhs.expression, rhs.expression);\n        }\n        function parseJsxElementOrSelfClosingElement(inExpressionContext) {\n            var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext);\n            var result;\n            if (opening.kind === 248) {\n                var node = createNode(246, opening.pos);\n                node.openingElement = opening;\n                node.children = parseJsxChildren(node.openingElement.tagName);\n                node.closingElement = parseJsxClosingElement(inExpressionContext);\n                if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) {\n                    parseErrorAtPosition(node.closingElement.pos, node.closingElement.end - node.closingElement.pos, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, node.openingElement.tagName));\n                }\n                result = finishNode(node);\n            }\n            else {\n                ts.Debug.assert(opening.kind === 247);\n                result = opening;\n            }\n            if (inExpressionContext && token() === 26) {\n                var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); });\n                if (invalidElement) {\n                    parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element);\n                    var badNode = createNode(192, result.pos);\n                    badNode.end = invalidElement.end;\n                    badNode.left = result;\n                    badNode.right = invalidElement;\n                    badNode.operatorToken = createMissingNode(25, false, undefined);\n                    badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos;\n                    return badNode;\n                }\n            }\n            return result;\n        }\n        function parseJsxText() {\n            var node = createNode(10, scanner.getStartPos());\n            currentToken = scanner.scanJsxToken();\n            return finishNode(node);\n        }\n        function parseJsxChild() {\n            switch (token()) {\n                case 10:\n                    return parseJsxText();\n                case 16:\n                    return parseJsxExpression(false);\n                case 26:\n                    return parseJsxElementOrSelfClosingElement(false);\n            }\n            ts.Debug.fail(\"Unknown JSX child kind \" + token());\n        }\n        function parseJsxChildren(openingTagName) {\n            var result = createNodeArray();\n            var saveParsingContext = parsingContext;\n            parsingContext |= 1 << 14;\n            while (true) {\n                currentToken = scanner.reScanJsxToken();\n                if (token() === 27) {\n                    break;\n                }\n                else if (token() === 1) {\n                    parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName));\n                    break;\n                }\n                result.push(parseJsxChild());\n            }\n            result.end = scanner.getTokenPos();\n            parsingContext = saveParsingContext;\n            return result;\n        }\n        function parseJsxOpeningOrSelfClosingElement(inExpressionContext) {\n            var fullStart = scanner.getStartPos();\n            parseExpected(26);\n            var tagName = parseJsxElementName();\n            var attributes = parseList(13, parseJsxAttribute);\n            var node;\n            if (token() === 28) {\n                node = createNode(248, fullStart);\n                scanJsxText();\n            }\n            else {\n                parseExpected(40);\n                if (inExpressionContext) {\n                    parseExpected(28);\n                }\n                else {\n                    parseExpected(28, undefined, false);\n                    scanJsxText();\n                }\n                node = createNode(247, fullStart);\n            }\n            node.tagName = tagName;\n            node.attributes = attributes;\n            return finishNode(node);\n        }\n        function parseJsxElementName() {\n            scanJsxIdentifier();\n            var expression = token() === 98 ?\n                parseTokenNode() : parseIdentifierName();\n            while (parseOptional(22)) {\n                var propertyAccess = createNode(177, expression.pos);\n                propertyAccess.expression = expression;\n                propertyAccess.name = parseRightSideOfDot(true);\n                expression = finishNode(propertyAccess);\n            }\n            return expression;\n        }\n        function parseJsxExpression(inExpressionContext) {\n            var node = createNode(252);\n            parseExpected(16);\n            if (token() !== 17) {\n                node.expression = parseAssignmentExpressionOrHigher();\n            }\n            if (inExpressionContext) {\n                parseExpected(17);\n            }\n            else {\n                parseExpected(17, undefined, false);\n                scanJsxText();\n            }\n            return finishNode(node);\n        }\n        function parseJsxAttribute() {\n            if (token() === 16) {\n                return parseJsxSpreadAttribute();\n            }\n            scanJsxIdentifier();\n            var node = createNode(250);\n            node.name = parseIdentifierName();\n            if (token() === 57) {\n                switch (scanJsxAttributeValue()) {\n                    case 9:\n                        node.initializer = parseLiteralNode();\n                        break;\n                    default:\n                        node.initializer = parseJsxExpression(true);\n                        break;\n                }\n            }\n            return finishNode(node);\n        }\n        function parseJsxSpreadAttribute() {\n            var node = createNode(251);\n            parseExpected(16);\n            parseExpected(23);\n            node.expression = parseExpression();\n            parseExpected(17);\n            return finishNode(node);\n        }\n        function parseJsxClosingElement(inExpressionContext) {\n            var node = createNode(249);\n            parseExpected(27);\n            node.tagName = parseJsxElementName();\n            if (inExpressionContext) {\n                parseExpected(28);\n            }\n            else {\n                parseExpected(28, undefined, false);\n                scanJsxText();\n            }\n            return finishNode(node);\n        }\n        function parseTypeAssertion() {\n            var node = createNode(182);\n            parseExpected(26);\n            node.type = parseType();\n            parseExpected(28);\n            node.expression = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        function parseMemberExpressionRest(expression) {\n            while (true) {\n                var dotToken = parseOptionalToken(22);\n                if (dotToken) {\n                    var propertyAccess = createNode(177, expression.pos);\n                    propertyAccess.expression = expression;\n                    propertyAccess.name = parseRightSideOfDot(true);\n                    expression = finishNode(propertyAccess);\n                    continue;\n                }\n                if (token() === 50 && !scanner.hasPrecedingLineBreak()) {\n                    nextToken();\n                    var nonNullExpression = createNode(201, expression.pos);\n                    nonNullExpression.expression = expression;\n                    expression = finishNode(nonNullExpression);\n                    continue;\n                }\n                if (!inDecoratorContext() && parseOptional(20)) {\n                    var indexedAccess = createNode(178, expression.pos);\n                    indexedAccess.expression = expression;\n                    if (token() !== 21) {\n                        indexedAccess.argumentExpression = allowInAnd(parseExpression);\n                        if (indexedAccess.argumentExpression.kind === 9 || indexedAccess.argumentExpression.kind === 8) {\n                            var literal = indexedAccess.argumentExpression;\n                            literal.text = internIdentifier(literal.text);\n                        }\n                    }\n                    parseExpected(21);\n                    expression = finishNode(indexedAccess);\n                    continue;\n                }\n                if (token() === 12 || token() === 13) {\n                    var tagExpression = createNode(181, expression.pos);\n                    tagExpression.tag = expression;\n                    tagExpression.template = token() === 12\n                        ? parseLiteralNode()\n                        : parseTemplateExpression();\n                    expression = finishNode(tagExpression);\n                    continue;\n                }\n                return expression;\n            }\n        }\n        function parseCallExpressionRest(expression) {\n            while (true) {\n                expression = parseMemberExpressionRest(expression);\n                if (token() === 26) {\n                    var typeArguments = tryParse(parseTypeArgumentsInExpression);\n                    if (!typeArguments) {\n                        return expression;\n                    }\n                    var callExpr = createNode(179, expression.pos);\n                    callExpr.expression = expression;\n                    callExpr.typeArguments = typeArguments;\n                    callExpr.arguments = parseArgumentList();\n                    expression = finishNode(callExpr);\n                    continue;\n                }\n                else if (token() === 18) {\n                    var callExpr = createNode(179, expression.pos);\n                    callExpr.expression = expression;\n                    callExpr.arguments = parseArgumentList();\n                    expression = finishNode(callExpr);\n                    continue;\n                }\n                return expression;\n            }\n        }\n        function parseArgumentList() {\n            parseExpected(18);\n            var result = parseDelimitedList(11, parseArgumentExpression);\n            parseExpected(19);\n            return result;\n        }\n        function parseTypeArgumentsInExpression() {\n            if (!parseOptional(26)) {\n                return undefined;\n            }\n            var typeArguments = parseDelimitedList(19, parseType);\n            if (!parseExpected(28)) {\n                return undefined;\n            }\n            return typeArguments && canFollowTypeArgumentsInExpression()\n                ? typeArguments\n                : undefined;\n        }\n        function canFollowTypeArgumentsInExpression() {\n            switch (token()) {\n                case 18:\n                case 22:\n                case 19:\n                case 21:\n                case 55:\n                case 24:\n                case 54:\n                case 31:\n                case 33:\n                case 32:\n                case 34:\n                case 52:\n                case 53:\n                case 49:\n                case 47:\n                case 48:\n                case 17:\n                case 1:\n                    return true;\n                case 25:\n                case 16:\n                default:\n                    return false;\n            }\n        }\n        function parsePrimaryExpression() {\n            switch (token()) {\n                case 8:\n                case 9:\n                case 12:\n                    return parseLiteralNode();\n                case 98:\n                case 96:\n                case 94:\n                case 100:\n                case 85:\n                    return parseTokenNode();\n                case 18:\n                    return parseParenthesizedExpression();\n                case 20:\n                    return parseArrayLiteralExpression();\n                case 16:\n                    return parseObjectLiteralExpression();\n                case 119:\n                    if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) {\n                        break;\n                    }\n                    return parseFunctionExpression();\n                case 74:\n                    return parseClassExpression();\n                case 88:\n                    return parseFunctionExpression();\n                case 93:\n                    return parseNewExpression();\n                case 40:\n                case 62:\n                    if (reScanSlashToken() === 11) {\n                        return parseLiteralNode();\n                    }\n                    break;\n                case 13:\n                    return parseTemplateExpression();\n            }\n            return parseIdentifier(ts.Diagnostics.Expression_expected);\n        }\n        function parseParenthesizedExpression() {\n            var node = createNode(183);\n            parseExpected(18);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19);\n            return finishNode(node);\n        }\n        function parseSpreadElement() {\n            var node = createNode(196);\n            parseExpected(23);\n            node.expression = parseAssignmentExpressionOrHigher();\n            return finishNode(node);\n        }\n        function parseArgumentOrArrayLiteralElement() {\n            return token() === 23 ? parseSpreadElement() :\n                token() === 25 ? createNode(198) :\n                    parseAssignmentExpressionOrHigher();\n        }\n        function parseArgumentExpression() {\n            return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);\n        }\n        function parseArrayLiteralExpression() {\n            var node = createNode(175);\n            parseExpected(20);\n            if (scanner.hasPrecedingLineBreak()) {\n                node.multiLine = true;\n            }\n            node.elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement);\n            parseExpected(21);\n            return finishNode(node);\n        }\n        function tryParseAccessorDeclaration(fullStart, decorators, modifiers) {\n            if (parseContextualModifier(124)) {\n                return parseAccessorDeclaration(151, fullStart, decorators, modifiers);\n            }\n            else if (parseContextualModifier(133)) {\n                return parseAccessorDeclaration(152, fullStart, decorators, modifiers);\n            }\n            return undefined;\n        }\n        function parseObjectLiteralElement() {\n            var fullStart = scanner.getStartPos();\n            var dotDotDotToken = parseOptionalToken(23);\n            if (dotDotDotToken) {\n                var spreadElement = createNode(259, fullStart);\n                spreadElement.expression = parseAssignmentExpressionOrHigher();\n                return addJSDocComment(finishNode(spreadElement));\n            }\n            var decorators = parseDecorators();\n            var modifiers = parseModifiers();\n            var accessor = tryParseAccessorDeclaration(fullStart, decorators, modifiers);\n            if (accessor) {\n                return accessor;\n            }\n            var asteriskToken = parseOptionalToken(38);\n            var tokenIsIdentifier = isIdentifier();\n            var propertyName = parsePropertyName();\n            var questionToken = parseOptionalToken(54);\n            if (asteriskToken || token() === 18 || token() === 26) {\n                return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken);\n            }\n            var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 || token() === 17 || token() === 57);\n            if (isShorthandPropertyAssignment) {\n                var shorthandDeclaration = createNode(258, fullStart);\n                shorthandDeclaration.name = propertyName;\n                shorthandDeclaration.questionToken = questionToken;\n                var equalsToken = parseOptionalToken(57);\n                if (equalsToken) {\n                    shorthandDeclaration.equalsToken = equalsToken;\n                    shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher);\n                }\n                return addJSDocComment(finishNode(shorthandDeclaration));\n            }\n            else {\n                var propertyAssignment = createNode(257, fullStart);\n                propertyAssignment.modifiers = modifiers;\n                propertyAssignment.name = propertyName;\n                propertyAssignment.questionToken = questionToken;\n                parseExpected(55);\n                propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher);\n                return addJSDocComment(finishNode(propertyAssignment));\n            }\n        }\n        function parseObjectLiteralExpression() {\n            var node = createNode(176);\n            parseExpected(16);\n            if (scanner.hasPrecedingLineBreak()) {\n                node.multiLine = true;\n            }\n            node.properties = parseDelimitedList(12, parseObjectLiteralElement, true);\n            parseExpected(17);\n            return finishNode(node);\n        }\n        function parseFunctionExpression() {\n            var saveDecoratorContext = inDecoratorContext();\n            if (saveDecoratorContext) {\n                setDecoratorContext(false);\n            }\n            var node = createNode(184);\n            node.modifiers = parseModifiers();\n            parseExpected(88);\n            node.asteriskToken = parseOptionalToken(38);\n            var isGenerator = !!node.asteriskToken;\n            var isAsync = !!(ts.getModifierFlags(node) & 256);\n            node.name =\n                isGenerator && isAsync ? doInYieldAndAwaitContext(parseOptionalIdentifier) :\n                    isGenerator ? doInYieldContext(parseOptionalIdentifier) :\n                        isAsync ? doInAwaitContext(parseOptionalIdentifier) :\n                            parseOptionalIdentifier();\n            fillSignature(55, isGenerator, isAsync, false, node);\n            node.body = parseFunctionBlock(isGenerator, isAsync, false);\n            if (saveDecoratorContext) {\n                setDecoratorContext(true);\n            }\n            return addJSDocComment(finishNode(node));\n        }\n        function parseOptionalIdentifier() {\n            return isIdentifier() ? parseIdentifier() : undefined;\n        }\n        function parseNewExpression() {\n            var node = createNode(180);\n            parseExpected(93);\n            node.expression = parseMemberExpressionOrHigher();\n            node.typeArguments = tryParse(parseTypeArgumentsInExpression);\n            if (node.typeArguments || token() === 18) {\n                node.arguments = parseArgumentList();\n            }\n            return finishNode(node);\n        }\n        function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {\n            var node = createNode(204);\n            if (parseExpected(16, diagnosticMessage) || ignoreMissingOpenBrace) {\n                if (scanner.hasPrecedingLineBreak()) {\n                    node.multiLine = true;\n                }\n                node.statements = parseList(1, parseStatement);\n                parseExpected(17);\n            }\n            else {\n                node.statements = createMissingList();\n            }\n            return finishNode(node);\n        }\n        function parseFunctionBlock(allowYield, allowAwait, ignoreMissingOpenBrace, diagnosticMessage) {\n            var savedYieldContext = inYieldContext();\n            setYieldContext(allowYield);\n            var savedAwaitContext = inAwaitContext();\n            setAwaitContext(allowAwait);\n            var saveDecoratorContext = inDecoratorContext();\n            if (saveDecoratorContext) {\n                setDecoratorContext(false);\n            }\n            var block = parseBlock(ignoreMissingOpenBrace, diagnosticMessage);\n            if (saveDecoratorContext) {\n                setDecoratorContext(true);\n            }\n            setYieldContext(savedYieldContext);\n            setAwaitContext(savedAwaitContext);\n            return block;\n        }\n        function parseEmptyStatement() {\n            var node = createNode(206);\n            parseExpected(24);\n            return finishNode(node);\n        }\n        function parseIfStatement() {\n            var node = createNode(208);\n            parseExpected(89);\n            parseExpected(18);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19);\n            node.thenStatement = parseStatement();\n            node.elseStatement = parseOptional(81) ? parseStatement() : undefined;\n            return finishNode(node);\n        }\n        function parseDoStatement() {\n            var node = createNode(209);\n            parseExpected(80);\n            node.statement = parseStatement();\n            parseExpected(105);\n            parseExpected(18);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19);\n            parseOptional(24);\n            return finishNode(node);\n        }\n        function parseWhileStatement() {\n            var node = createNode(210);\n            parseExpected(105);\n            parseExpected(18);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19);\n            node.statement = parseStatement();\n            return finishNode(node);\n        }\n        function parseForOrForInOrForOfStatement() {\n            var pos = getNodePos();\n            parseExpected(87);\n            parseExpected(18);\n            var initializer = undefined;\n            if (token() !== 24) {\n                if (token() === 103 || token() === 109 || token() === 75) {\n                    initializer = parseVariableDeclarationList(true);\n                }\n                else {\n                    initializer = disallowInAnd(parseExpression);\n                }\n            }\n            var forOrForInOrForOfStatement;\n            if (parseOptional(91)) {\n                var forInStatement = createNode(212, pos);\n                forInStatement.initializer = initializer;\n                forInStatement.expression = allowInAnd(parseExpression);\n                parseExpected(19);\n                forOrForInOrForOfStatement = forInStatement;\n            }\n            else if (parseOptional(140)) {\n                var forOfStatement = createNode(213, pos);\n                forOfStatement.initializer = initializer;\n                forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher);\n                parseExpected(19);\n                forOrForInOrForOfStatement = forOfStatement;\n            }\n            else {\n                var forStatement = createNode(211, pos);\n                forStatement.initializer = initializer;\n                parseExpected(24);\n                if (token() !== 24 && token() !== 19) {\n                    forStatement.condition = allowInAnd(parseExpression);\n                }\n                parseExpected(24);\n                if (token() !== 19) {\n                    forStatement.incrementor = allowInAnd(parseExpression);\n                }\n                parseExpected(19);\n                forOrForInOrForOfStatement = forStatement;\n            }\n            forOrForInOrForOfStatement.statement = parseStatement();\n            return finishNode(forOrForInOrForOfStatement);\n        }\n        function parseBreakOrContinueStatement(kind) {\n            var node = createNode(kind);\n            parseExpected(kind === 215 ? 71 : 76);\n            if (!canParseSemicolon()) {\n                node.label = parseIdentifier();\n            }\n            parseSemicolon();\n            return finishNode(node);\n        }\n        function parseReturnStatement() {\n            var node = createNode(216);\n            parseExpected(95);\n            if (!canParseSemicolon()) {\n                node.expression = allowInAnd(parseExpression);\n            }\n            parseSemicolon();\n            return finishNode(node);\n        }\n        function parseWithStatement() {\n            var node = createNode(217);\n            parseExpected(106);\n            parseExpected(18);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19);\n            node.statement = parseStatement();\n            return finishNode(node);\n        }\n        function parseCaseClause() {\n            var node = createNode(253);\n            parseExpected(72);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(55);\n            node.statements = parseList(3, parseStatement);\n            return finishNode(node);\n        }\n        function parseDefaultClause() {\n            var node = createNode(254);\n            parseExpected(78);\n            parseExpected(55);\n            node.statements = parseList(3, parseStatement);\n            return finishNode(node);\n        }\n        function parseCaseOrDefaultClause() {\n            return token() === 72 ? parseCaseClause() : parseDefaultClause();\n        }\n        function parseSwitchStatement() {\n            var node = createNode(218);\n            parseExpected(97);\n            parseExpected(18);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19);\n            var caseBlock = createNode(232, scanner.getStartPos());\n            parseExpected(16);\n            caseBlock.clauses = parseList(2, parseCaseOrDefaultClause);\n            parseExpected(17);\n            node.caseBlock = finishNode(caseBlock);\n            return finishNode(node);\n        }\n        function parseThrowStatement() {\n            var node = createNode(220);\n            parseExpected(99);\n            node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression);\n            parseSemicolon();\n            return finishNode(node);\n        }\n        function parseTryStatement() {\n            var node = createNode(221);\n            parseExpected(101);\n            node.tryBlock = parseBlock(false);\n            node.catchClause = token() === 73 ? parseCatchClause() : undefined;\n            if (!node.catchClause || token() === 86) {\n                parseExpected(86);\n                node.finallyBlock = parseBlock(false);\n            }\n            return finishNode(node);\n        }\n        function parseCatchClause() {\n            var result = createNode(256);\n            parseExpected(73);\n            if (parseExpected(18)) {\n                result.variableDeclaration = parseVariableDeclaration();\n            }\n            parseExpected(19);\n            result.block = parseBlock(false);\n            return finishNode(result);\n        }\n        function parseDebuggerStatement() {\n            var node = createNode(222);\n            parseExpected(77);\n            parseSemicolon();\n            return finishNode(node);\n        }\n        function parseExpressionOrLabeledStatement() {\n            var fullStart = scanner.getStartPos();\n            var expression = allowInAnd(parseExpression);\n            if (expression.kind === 70 && parseOptional(55)) {\n                var labeledStatement = createNode(219, fullStart);\n                labeledStatement.label = expression;\n                labeledStatement.statement = parseStatement();\n                return addJSDocComment(finishNode(labeledStatement));\n            }\n            else {\n                var expressionStatement = createNode(207, fullStart);\n                expressionStatement.expression = expression;\n                parseSemicolon();\n                return addJSDocComment(finishNode(expressionStatement));\n            }\n        }\n        function nextTokenIsIdentifierOrKeywordOnSameLine() {\n            nextToken();\n            return ts.tokenIsIdentifierOrKeyword(token()) && !scanner.hasPrecedingLineBreak();\n        }\n        function nextTokenIsFunctionKeywordOnSameLine() {\n            nextToken();\n            return token() === 88 && !scanner.hasPrecedingLineBreak();\n        }\n        function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() {\n            nextToken();\n            return (ts.tokenIsIdentifierOrKeyword(token()) || token() === 8) && !scanner.hasPrecedingLineBreak();\n        }\n        function isDeclaration() {\n            while (true) {\n                switch (token()) {\n                    case 103:\n                    case 109:\n                    case 75:\n                    case 88:\n                    case 74:\n                    case 82:\n                        return true;\n                    case 108:\n                    case 136:\n                        return nextTokenIsIdentifierOnSameLine();\n                    case 127:\n                    case 128:\n                        return nextTokenIsIdentifierOrStringLiteralOnSameLine();\n                    case 116:\n                    case 119:\n                    case 123:\n                    case 111:\n                    case 112:\n                    case 113:\n                    case 130:\n                        nextToken();\n                        if (scanner.hasPrecedingLineBreak()) {\n                            return false;\n                        }\n                        continue;\n                    case 139:\n                        nextToken();\n                        return token() === 16 || token() === 70 || token() === 83;\n                    case 90:\n                        nextToken();\n                        return token() === 9 || token() === 38 ||\n                            token() === 16 || ts.tokenIsIdentifierOrKeyword(token());\n                    case 83:\n                        nextToken();\n                        if (token() === 57 || token() === 38 ||\n                            token() === 16 || token() === 78 ||\n                            token() === 117) {\n                            return true;\n                        }\n                        continue;\n                    case 114:\n                        nextToken();\n                        continue;\n                    default:\n                        return false;\n                }\n            }\n        }\n        function isStartOfDeclaration() {\n            return lookAhead(isDeclaration);\n        }\n        function isStartOfStatement() {\n            switch (token()) {\n                case 56:\n                case 24:\n                case 16:\n                case 103:\n                case 109:\n                case 88:\n                case 74:\n                case 82:\n                case 89:\n                case 80:\n                case 105:\n                case 87:\n                case 76:\n                case 71:\n                case 95:\n                case 106:\n                case 97:\n                case 99:\n                case 101:\n                case 77:\n                case 73:\n                case 86:\n                    return true;\n                case 75:\n                case 83:\n                case 90:\n                    return isStartOfDeclaration();\n                case 119:\n                case 123:\n                case 108:\n                case 127:\n                case 128:\n                case 136:\n                case 139:\n                    return true;\n                case 113:\n                case 111:\n                case 112:\n                case 114:\n                case 130:\n                    return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);\n                default:\n                    return isStartOfExpression();\n            }\n        }\n        function nextTokenIsIdentifierOrStartOfDestructuring() {\n            nextToken();\n            return isIdentifier() || token() === 16 || token() === 20;\n        }\n        function isLetDeclaration() {\n            return lookAhead(nextTokenIsIdentifierOrStartOfDestructuring);\n        }\n        function parseStatement() {\n            switch (token()) {\n                case 24:\n                    return parseEmptyStatement();\n                case 16:\n                    return parseBlock(false);\n                case 103:\n                    return parseVariableStatement(scanner.getStartPos(), undefined, undefined);\n                case 109:\n                    if (isLetDeclaration()) {\n                        return parseVariableStatement(scanner.getStartPos(), undefined, undefined);\n                    }\n                    break;\n                case 88:\n                    return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined);\n                case 74:\n                    return parseClassDeclaration(scanner.getStartPos(), undefined, undefined);\n                case 89:\n                    return parseIfStatement();\n                case 80:\n                    return parseDoStatement();\n                case 105:\n                    return parseWhileStatement();\n                case 87:\n                    return parseForOrForInOrForOfStatement();\n                case 76:\n                    return parseBreakOrContinueStatement(214);\n                case 71:\n                    return parseBreakOrContinueStatement(215);\n                case 95:\n                    return parseReturnStatement();\n                case 106:\n                    return parseWithStatement();\n                case 97:\n                    return parseSwitchStatement();\n                case 99:\n                    return parseThrowStatement();\n                case 101:\n                case 73:\n                case 86:\n                    return parseTryStatement();\n                case 77:\n                    return parseDebuggerStatement();\n                case 56:\n                    return parseDeclaration();\n                case 119:\n                case 108:\n                case 136:\n                case 127:\n                case 128:\n                case 123:\n                case 75:\n                case 82:\n                case 83:\n                case 90:\n                case 111:\n                case 112:\n                case 113:\n                case 116:\n                case 114:\n                case 130:\n                case 139:\n                    if (isStartOfDeclaration()) {\n                        return parseDeclaration();\n                    }\n                    break;\n            }\n            return parseExpressionOrLabeledStatement();\n        }\n        function parseDeclaration() {\n            var fullStart = getNodePos();\n            var decorators = parseDecorators();\n            var modifiers = parseModifiers();\n            switch (token()) {\n                case 103:\n                case 109:\n                case 75:\n                    return parseVariableStatement(fullStart, decorators, modifiers);\n                case 88:\n                    return parseFunctionDeclaration(fullStart, decorators, modifiers);\n                case 74:\n                    return parseClassDeclaration(fullStart, decorators, modifiers);\n                case 108:\n                    return parseInterfaceDeclaration(fullStart, decorators, modifiers);\n                case 136:\n                    return parseTypeAliasDeclaration(fullStart, decorators, modifiers);\n                case 82:\n                    return parseEnumDeclaration(fullStart, decorators, modifiers);\n                case 139:\n                case 127:\n                case 128:\n                    return parseModuleDeclaration(fullStart, decorators, modifiers);\n                case 90:\n                    return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers);\n                case 83:\n                    nextToken();\n                    switch (token()) {\n                        case 78:\n                        case 57:\n                            return parseExportAssignment(fullStart, decorators, modifiers);\n                        case 117:\n                            return parseNamespaceExportDeclaration(fullStart, decorators, modifiers);\n                        default:\n                            return parseExportDeclaration(fullStart, decorators, modifiers);\n                    }\n                default:\n                    if (decorators || modifiers) {\n                        var node = createMissingNode(244, true, ts.Diagnostics.Declaration_expected);\n                        node.pos = fullStart;\n                        node.decorators = decorators;\n                        node.modifiers = modifiers;\n                        return finishNode(node);\n                    }\n            }\n        }\n        function nextTokenIsIdentifierOrStringLiteralOnSameLine() {\n            nextToken();\n            return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === 9);\n        }\n        function parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage) {\n            if (token() !== 16 && canParseSemicolon()) {\n                parseSemicolon();\n                return;\n            }\n            return parseFunctionBlock(isGenerator, isAsync, false, diagnosticMessage);\n        }\n        function parseArrayBindingElement() {\n            if (token() === 25) {\n                return createNode(198);\n            }\n            var node = createNode(174);\n            node.dotDotDotToken = parseOptionalToken(23);\n            node.name = parseIdentifierOrPattern();\n            node.initializer = parseBindingElementInitializer(false);\n            return finishNode(node);\n        }\n        function parseObjectBindingElement() {\n            var node = createNode(174);\n            node.dotDotDotToken = parseOptionalToken(23);\n            var tokenIsIdentifier = isIdentifier();\n            var propertyName = parsePropertyName();\n            if (tokenIsIdentifier && token() !== 55) {\n                node.name = propertyName;\n            }\n            else {\n                parseExpected(55);\n                node.propertyName = propertyName;\n                node.name = parseIdentifierOrPattern();\n            }\n            node.initializer = parseBindingElementInitializer(false);\n            return finishNode(node);\n        }\n        function parseObjectBindingPattern() {\n            var node = createNode(172);\n            parseExpected(16);\n            node.elements = parseDelimitedList(9, parseObjectBindingElement);\n            parseExpected(17);\n            return finishNode(node);\n        }\n        function parseArrayBindingPattern() {\n            var node = createNode(173);\n            parseExpected(20);\n            node.elements = parseDelimitedList(10, parseArrayBindingElement);\n            parseExpected(21);\n            return finishNode(node);\n        }\n        function isIdentifierOrPattern() {\n            return token() === 16 || token() === 20 || isIdentifier();\n        }\n        function parseIdentifierOrPattern() {\n            if (token() === 20) {\n                return parseArrayBindingPattern();\n            }\n            if (token() === 16) {\n                return parseObjectBindingPattern();\n            }\n            return parseIdentifier();\n        }\n        function parseVariableDeclaration() {\n            var node = createNode(223);\n            node.name = parseIdentifierOrPattern();\n            node.type = parseTypeAnnotation();\n            if (!isInOrOfKeyword(token())) {\n                node.initializer = parseInitializer(false);\n            }\n            return finishNode(node);\n        }\n        function parseVariableDeclarationList(inForStatementInitializer) {\n            var node = createNode(224);\n            switch (token()) {\n                case 103:\n                    break;\n                case 109:\n                    node.flags |= 1;\n                    break;\n                case 75:\n                    node.flags |= 2;\n                    break;\n                default:\n                    ts.Debug.fail();\n            }\n            nextToken();\n            if (token() === 140 && lookAhead(canFollowContextualOfKeyword)) {\n                node.declarations = createMissingList();\n            }\n            else {\n                var savedDisallowIn = inDisallowInContext();\n                setDisallowInContext(inForStatementInitializer);\n                node.declarations = parseDelimitedList(8, parseVariableDeclaration);\n                setDisallowInContext(savedDisallowIn);\n            }\n            return finishNode(node);\n        }\n        function canFollowContextualOfKeyword() {\n            return nextTokenIsIdentifier() && nextToken() === 19;\n        }\n        function parseVariableStatement(fullStart, decorators, modifiers) {\n            var node = createNode(205, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            node.declarationList = parseVariableDeclarationList(false);\n            parseSemicolon();\n            return addJSDocComment(finishNode(node));\n        }\n        function parseFunctionDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(225, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(88);\n            node.asteriskToken = parseOptionalToken(38);\n            node.name = ts.hasModifier(node, 512) ? parseOptionalIdentifier() : parseIdentifier();\n            var isGenerator = !!node.asteriskToken;\n            var isAsync = ts.hasModifier(node, 256);\n            fillSignature(55, isGenerator, isAsync, false, node);\n            node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected);\n            return addJSDocComment(finishNode(node));\n        }\n        function parseConstructorDeclaration(pos, decorators, modifiers) {\n            var node = createNode(150, pos);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(122);\n            fillSignature(55, false, false, false, node);\n            node.body = parseFunctionBlockOrSemicolon(false, false, ts.Diagnostics.or_expected);\n            return addJSDocComment(finishNode(node));\n        }\n        function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) {\n            var method = createNode(149, fullStart);\n            method.decorators = decorators;\n            method.modifiers = modifiers;\n            method.asteriskToken = asteriskToken;\n            method.name = name;\n            method.questionToken = questionToken;\n            var isGenerator = !!asteriskToken;\n            var isAsync = ts.hasModifier(method, 256);\n            fillSignature(55, isGenerator, isAsync, false, method);\n            method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage);\n            return addJSDocComment(finishNode(method));\n        }\n        function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) {\n            var property = createNode(147, fullStart);\n            property.decorators = decorators;\n            property.modifiers = modifiers;\n            property.name = name;\n            property.questionToken = questionToken;\n            property.type = parseTypeAnnotation();\n            property.initializer = ts.hasModifier(property, 32)\n                ? allowInAnd(parseNonParameterInitializer)\n                : doOutsideOfContext(4096 | 2048, parseNonParameterInitializer);\n            parseSemicolon();\n            return addJSDocComment(finishNode(property));\n        }\n        function parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers) {\n            var asteriskToken = parseOptionalToken(38);\n            var name = parsePropertyName();\n            var questionToken = parseOptionalToken(54);\n            if (asteriskToken || token() === 18 || token() === 26) {\n                return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected);\n            }\n            else {\n                return parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken);\n            }\n        }\n        function parseNonParameterInitializer() {\n            return parseInitializer(false);\n        }\n        function parseAccessorDeclaration(kind, fullStart, decorators, modifiers) {\n            var node = createNode(kind, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            node.name = parsePropertyName();\n            fillSignature(55, false, false, false, node);\n            node.body = parseFunctionBlockOrSemicolon(false, false);\n            return addJSDocComment(finishNode(node));\n        }\n        function isClassMemberModifier(idToken) {\n            switch (idToken) {\n                case 113:\n                case 111:\n                case 112:\n                case 114:\n                case 130:\n                    return true;\n                default:\n                    return false;\n            }\n        }\n        function isClassMemberStart() {\n            var idToken;\n            if (token() === 56) {\n                return true;\n            }\n            while (ts.isModifierKind(token())) {\n                idToken = token();\n                if (isClassMemberModifier(idToken)) {\n                    return true;\n                }\n                nextToken();\n            }\n            if (token() === 38) {\n                return true;\n            }\n            if (isLiteralPropertyName()) {\n                idToken = token();\n                nextToken();\n            }\n            if (token() === 20) {\n                return true;\n            }\n            if (idToken !== undefined) {\n                if (!ts.isKeyword(idToken) || idToken === 133 || idToken === 124) {\n                    return true;\n                }\n                switch (token()) {\n                    case 18:\n                    case 26:\n                    case 55:\n                    case 57:\n                    case 54:\n                        return true;\n                    default:\n                        return canParseSemicolon();\n                }\n            }\n            return false;\n        }\n        function parseDecorators() {\n            var decorators;\n            while (true) {\n                var decoratorStart = getNodePos();\n                if (!parseOptional(56)) {\n                    break;\n                }\n                var decorator = createNode(145, decoratorStart);\n                decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher);\n                finishNode(decorator);\n                if (!decorators) {\n                    decorators = createNodeArray([decorator], decoratorStart);\n                }\n                else {\n                    decorators.push(decorator);\n                }\n            }\n            if (decorators) {\n                decorators.end = getNodeEnd();\n            }\n            return decorators;\n        }\n        function parseModifiers(permitInvalidConstAsModifier) {\n            var modifiers;\n            while (true) {\n                var modifierStart = scanner.getStartPos();\n                var modifierKind = token();\n                if (token() === 75 && permitInvalidConstAsModifier) {\n                    if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) {\n                        break;\n                    }\n                }\n                else {\n                    if (!parseAnyContextualModifier()) {\n                        break;\n                    }\n                }\n                var modifier = finishNode(createNode(modifierKind, modifierStart));\n                if (!modifiers) {\n                    modifiers = createNodeArray([modifier], modifierStart);\n                }\n                else {\n                    modifiers.push(modifier);\n                }\n            }\n            if (modifiers) {\n                modifiers.end = scanner.getStartPos();\n            }\n            return modifiers;\n        }\n        function parseModifiersForArrowFunction() {\n            var modifiers;\n            if (token() === 119) {\n                var modifierStart = scanner.getStartPos();\n                var modifierKind = token();\n                nextToken();\n                var modifier = finishNode(createNode(modifierKind, modifierStart));\n                modifiers = createNodeArray([modifier], modifierStart);\n                modifiers.end = scanner.getStartPos();\n            }\n            return modifiers;\n        }\n        function parseClassElement() {\n            if (token() === 24) {\n                var result = createNode(203);\n                nextToken();\n                return finishNode(result);\n            }\n            var fullStart = getNodePos();\n            var decorators = parseDecorators();\n            var modifiers = parseModifiers(true);\n            var accessor = tryParseAccessorDeclaration(fullStart, decorators, modifiers);\n            if (accessor) {\n                return accessor;\n            }\n            if (token() === 122) {\n                return parseConstructorDeclaration(fullStart, decorators, modifiers);\n            }\n            if (isIndexSignature()) {\n                return parseIndexSignatureDeclaration(fullStart, decorators, modifiers);\n            }\n            if (ts.tokenIsIdentifierOrKeyword(token()) ||\n                token() === 9 ||\n                token() === 8 ||\n                token() === 38 ||\n                token() === 20) {\n                return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers);\n            }\n            if (decorators || modifiers) {\n                var name_13 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected);\n                return parsePropertyDeclaration(fullStart, decorators, modifiers, name_13, undefined);\n            }\n            ts.Debug.fail(\"Should not have attempted to parse class member declaration.\");\n        }\n        function parseClassExpression() {\n            return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 197);\n        }\n        function parseClassDeclaration(fullStart, decorators, modifiers) {\n            return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 226);\n        }\n        function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) {\n            var node = createNode(kind, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(74);\n            node.name = parseNameOfClassDeclarationOrExpression();\n            node.typeParameters = parseTypeParameters();\n            node.heritageClauses = parseHeritageClauses();\n            if (parseExpected(16)) {\n                node.members = parseClassMembers();\n                parseExpected(17);\n            }\n            else {\n                node.members = createMissingList();\n            }\n            return addJSDocComment(finishNode(node));\n        }\n        function parseNameOfClassDeclarationOrExpression() {\n            return isIdentifier() && !isImplementsClause()\n                ? parseIdentifier()\n                : undefined;\n        }\n        function isImplementsClause() {\n            return token() === 107 && lookAhead(nextTokenIsIdentifierOrKeyword);\n        }\n        function parseHeritageClauses() {\n            if (isHeritageClause()) {\n                return parseList(21, parseHeritageClause);\n            }\n            return undefined;\n        }\n        function parseHeritageClause() {\n            if (token() === 84 || token() === 107) {\n                var node = createNode(255);\n                node.token = token();\n                nextToken();\n                node.types = parseDelimitedList(7, parseExpressionWithTypeArguments);\n                return finishNode(node);\n            }\n            return undefined;\n        }\n        function parseExpressionWithTypeArguments() {\n            var node = createNode(199);\n            node.expression = parseLeftHandSideExpressionOrHigher();\n            if (token() === 26) {\n                node.typeArguments = parseBracketedList(19, parseType, 26, 28);\n            }\n            return finishNode(node);\n        }\n        function isHeritageClause() {\n            return token() === 84 || token() === 107;\n        }\n        function parseClassMembers() {\n            return parseList(5, parseClassElement);\n        }\n        function parseInterfaceDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(227, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(108);\n            node.name = parseIdentifier();\n            node.typeParameters = parseTypeParameters();\n            node.heritageClauses = parseHeritageClauses();\n            node.members = parseObjectTypeMembers();\n            return addJSDocComment(finishNode(node));\n        }\n        function parseTypeAliasDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(228, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(136);\n            node.name = parseIdentifier();\n            node.typeParameters = parseTypeParameters();\n            parseExpected(57);\n            node.type = parseType();\n            parseSemicolon();\n            return addJSDocComment(finishNode(node));\n        }\n        function parseEnumMember() {\n            var node = createNode(260, scanner.getStartPos());\n            node.name = parsePropertyName();\n            node.initializer = allowInAnd(parseNonParameterInitializer);\n            return addJSDocComment(finishNode(node));\n        }\n        function parseEnumDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(229, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(82);\n            node.name = parseIdentifier();\n            if (parseExpected(16)) {\n                node.members = parseDelimitedList(6, parseEnumMember);\n                parseExpected(17);\n            }\n            else {\n                node.members = createMissingList();\n            }\n            return addJSDocComment(finishNode(node));\n        }\n        function parseModuleBlock() {\n            var node = createNode(231, scanner.getStartPos());\n            if (parseExpected(16)) {\n                node.statements = parseList(1, parseStatement);\n                parseExpected(17);\n            }\n            else {\n                node.statements = createMissingList();\n            }\n            return finishNode(node);\n        }\n        function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) {\n            var node = createNode(230, fullStart);\n            var namespaceFlag = flags & 16;\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            node.flags |= flags;\n            node.name = parseIdentifier();\n            node.body = parseOptional(22)\n                ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 4 | namespaceFlag)\n                : parseModuleBlock();\n            return addJSDocComment(finishNode(node));\n        }\n        function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(230, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            if (token() === 139) {\n                node.name = parseIdentifier();\n                node.flags |= 512;\n            }\n            else {\n                node.name = parseLiteralNode(true);\n            }\n            if (token() === 16) {\n                node.body = parseModuleBlock();\n            }\n            else {\n                parseSemicolon();\n            }\n            return finishNode(node);\n        }\n        function parseModuleDeclaration(fullStart, decorators, modifiers) {\n            var flags = 0;\n            if (token() === 139) {\n                return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers);\n            }\n            else if (parseOptional(128)) {\n                flags |= 16;\n            }\n            else {\n                parseExpected(127);\n                if (token() === 9) {\n                    return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers);\n                }\n            }\n            return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags);\n        }\n        function isExternalModuleReference() {\n            return token() === 131 &&\n                lookAhead(nextTokenIsOpenParen);\n        }\n        function nextTokenIsOpenParen() {\n            return nextToken() === 18;\n        }\n        function nextTokenIsSlash() {\n            return nextToken() === 40;\n        }\n        function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) {\n            var exportDeclaration = createNode(233, fullStart);\n            exportDeclaration.decorators = decorators;\n            exportDeclaration.modifiers = modifiers;\n            parseExpected(117);\n            parseExpected(128);\n            exportDeclaration.name = parseIdentifier();\n            parseSemicolon();\n            return finishNode(exportDeclaration);\n        }\n        function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) {\n            parseExpected(90);\n            var afterImportPos = scanner.getStartPos();\n            var identifier;\n            if (isIdentifier()) {\n                identifier = parseIdentifier();\n                if (token() !== 25 && token() !== 138) {\n                    var importEqualsDeclaration = createNode(234, fullStart);\n                    importEqualsDeclaration.decorators = decorators;\n                    importEqualsDeclaration.modifiers = modifiers;\n                    importEqualsDeclaration.name = identifier;\n                    parseExpected(57);\n                    importEqualsDeclaration.moduleReference = parseModuleReference();\n                    parseSemicolon();\n                    return addJSDocComment(finishNode(importEqualsDeclaration));\n                }\n            }\n            var importDeclaration = createNode(235, fullStart);\n            importDeclaration.decorators = decorators;\n            importDeclaration.modifiers = modifiers;\n            if (identifier ||\n                token() === 38 ||\n                token() === 16) {\n                importDeclaration.importClause = parseImportClause(identifier, afterImportPos);\n                parseExpected(138);\n            }\n            importDeclaration.moduleSpecifier = parseModuleSpecifier();\n            parseSemicolon();\n            return finishNode(importDeclaration);\n        }\n        function parseImportClause(identifier, fullStart) {\n            var importClause = createNode(236, fullStart);\n            if (identifier) {\n                importClause.name = identifier;\n            }\n            if (!importClause.name ||\n                parseOptional(25)) {\n                importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(238);\n            }\n            return finishNode(importClause);\n        }\n        function parseModuleReference() {\n            return isExternalModuleReference()\n                ? parseExternalModuleReference()\n                : parseEntityName(false);\n        }\n        function parseExternalModuleReference() {\n            var node = createNode(245);\n            parseExpected(131);\n            parseExpected(18);\n            node.expression = parseModuleSpecifier();\n            parseExpected(19);\n            return finishNode(node);\n        }\n        function parseModuleSpecifier() {\n            if (token() === 9) {\n                var result = parseLiteralNode();\n                internIdentifier(result.text);\n                return result;\n            }\n            else {\n                return parseExpression();\n            }\n        }\n        function parseNamespaceImport() {\n            var namespaceImport = createNode(237);\n            parseExpected(38);\n            parseExpected(117);\n            namespaceImport.name = parseIdentifier();\n            return finishNode(namespaceImport);\n        }\n        function parseNamedImportsOrExports(kind) {\n            var node = createNode(kind);\n            node.elements = parseBracketedList(22, kind === 238 ? parseImportSpecifier : parseExportSpecifier, 16, 17);\n            return finishNode(node);\n        }\n        function parseExportSpecifier() {\n            return parseImportOrExportSpecifier(243);\n        }\n        function parseImportSpecifier() {\n            return parseImportOrExportSpecifier(239);\n        }\n        function parseImportOrExportSpecifier(kind) {\n            var node = createNode(kind);\n            var checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();\n            var checkIdentifierStart = scanner.getTokenPos();\n            var checkIdentifierEnd = scanner.getTextPos();\n            var identifierName = parseIdentifierName();\n            if (token() === 117) {\n                node.propertyName = identifierName;\n                parseExpected(117);\n                checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();\n                checkIdentifierStart = scanner.getTokenPos();\n                checkIdentifierEnd = scanner.getTextPos();\n                node.name = parseIdentifierName();\n            }\n            else {\n                node.name = identifierName;\n            }\n            if (kind === 239 && checkIdentifierIsKeyword) {\n                parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected);\n            }\n            return finishNode(node);\n        }\n        function parseExportDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(241, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            if (parseOptional(38)) {\n                parseExpected(138);\n                node.moduleSpecifier = parseModuleSpecifier();\n            }\n            else {\n                node.exportClause = parseNamedImportsOrExports(242);\n                if (token() === 138 || (token() === 9 && !scanner.hasPrecedingLineBreak())) {\n                    parseExpected(138);\n                    node.moduleSpecifier = parseModuleSpecifier();\n                }\n            }\n            parseSemicolon();\n            return finishNode(node);\n        }\n        function parseExportAssignment(fullStart, decorators, modifiers) {\n            var node = createNode(240, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            if (parseOptional(57)) {\n                node.isExportEquals = true;\n            }\n            else {\n                parseExpected(78);\n            }\n            node.expression = parseAssignmentExpressionOrHigher();\n            parseSemicolon();\n            return finishNode(node);\n        }\n        function processReferenceComments(sourceFile) {\n            var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, 0, sourceText);\n            var referencedFiles = [];\n            var typeReferenceDirectives = [];\n            var amdDependencies = [];\n            var amdModuleName;\n            while (true) {\n                var kind = triviaScanner.scan();\n                if (kind !== 2) {\n                    if (ts.isTrivia(kind)) {\n                        continue;\n                    }\n                    else {\n                        break;\n                    }\n                }\n                var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos(), kind: triviaScanner.getToken() };\n                var comment = sourceText.substring(range.pos, range.end);\n                var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range);\n                if (referencePathMatchResult) {\n                    var fileReference = referencePathMatchResult.fileReference;\n                    sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib;\n                    var diagnosticMessage = referencePathMatchResult.diagnosticMessage;\n                    if (fileReference) {\n                        if (referencePathMatchResult.isTypeReferenceDirective) {\n                            typeReferenceDirectives.push(fileReference);\n                        }\n                        else {\n                            referencedFiles.push(fileReference);\n                        }\n                    }\n                    if (diagnosticMessage) {\n                        parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage));\n                    }\n                }\n                else {\n                    var amdModuleNameRegEx = /^\\/\\/\\/\\s*<amd-module\\s+name\\s*=\\s*('|\")(.+?)\\1/gim;\n                    var amdModuleNameMatchResult = amdModuleNameRegEx.exec(comment);\n                    if (amdModuleNameMatchResult) {\n                        if (amdModuleName) {\n                            parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, ts.Diagnostics.An_AMD_module_cannot_have_multiple_name_assignments));\n                        }\n                        amdModuleName = amdModuleNameMatchResult[2];\n                    }\n                    var amdDependencyRegEx = /^\\/\\/\\/\\s*<amd-dependency\\s/gim;\n                    var pathRegex = /\\spath\\s*=\\s*('|\")(.+?)\\1/gim;\n                    var nameRegex = /\\sname\\s*=\\s*('|\")(.+?)\\1/gim;\n                    var amdDependencyMatchResult = amdDependencyRegEx.exec(comment);\n                    if (amdDependencyMatchResult) {\n                        var pathMatchResult = pathRegex.exec(comment);\n                        var nameMatchResult = nameRegex.exec(comment);\n                        if (pathMatchResult) {\n                            var amdDependency = { path: pathMatchResult[2], name: nameMatchResult ? nameMatchResult[2] : undefined };\n                            amdDependencies.push(amdDependency);\n                        }\n                    }\n                }\n            }\n            sourceFile.referencedFiles = referencedFiles;\n            sourceFile.typeReferenceDirectives = typeReferenceDirectives;\n            sourceFile.amdDependencies = amdDependencies;\n            sourceFile.moduleName = amdModuleName;\n        }\n        function setExternalModuleIndicator(sourceFile) {\n            sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) {\n                return ts.hasModifier(node, 1)\n                    || node.kind === 234 && node.moduleReference.kind === 245\n                    || node.kind === 235\n                    || node.kind === 240\n                    || node.kind === 241\n                    ? node\n                    : undefined;\n            });\n        }\n        var JSDocParser;\n        (function (JSDocParser) {\n            function isJSDocType() {\n                switch (token()) {\n                    case 38:\n                    case 54:\n                    case 18:\n                    case 20:\n                    case 50:\n                    case 16:\n                    case 88:\n                    case 23:\n                    case 93:\n                    case 98:\n                        return true;\n                }\n                return ts.tokenIsIdentifierOrKeyword(token());\n            }\n            JSDocParser.isJSDocType = isJSDocType;\n            function parseJSDocTypeExpressionForTests(content, start, length) {\n                initializeState(content, 5, undefined, 1);\n                sourceFile = createSourceFile(\"file.js\", 5, 1);\n                scanner.setText(content, start, length);\n                currentToken = scanner.scan();\n                var jsDocTypeExpression = parseJSDocTypeExpression();\n                var diagnostics = parseDiagnostics;\n                clearState();\n                return jsDocTypeExpression ? { jsDocTypeExpression: jsDocTypeExpression, diagnostics: diagnostics } : undefined;\n            }\n            JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;\n            function parseJSDocTypeExpression() {\n                var result = createNode(262, scanner.getTokenPos());\n                parseExpected(16);\n                result.type = parseJSDocTopLevelType();\n                parseExpected(17);\n                fixupParentReferences(result);\n                return finishNode(result);\n            }\n            JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;\n            function parseJSDocTopLevelType() {\n                var type = parseJSDocType();\n                if (token() === 48) {\n                    var unionType = createNode(266, type.pos);\n                    unionType.types = parseJSDocTypeList(type);\n                    type = finishNode(unionType);\n                }\n                if (token() === 57) {\n                    var optionalType = createNode(273, type.pos);\n                    nextToken();\n                    optionalType.type = type;\n                    type = finishNode(optionalType);\n                }\n                return type;\n            }\n            function parseJSDocType() {\n                var type = parseBasicTypeExpression();\n                while (true) {\n                    if (token() === 20) {\n                        var arrayType = createNode(265, type.pos);\n                        arrayType.elementType = type;\n                        nextToken();\n                        parseExpected(21);\n                        type = finishNode(arrayType);\n                    }\n                    else if (token() === 54) {\n                        var nullableType = createNode(268, type.pos);\n                        nullableType.type = type;\n                        nextToken();\n                        type = finishNode(nullableType);\n                    }\n                    else if (token() === 50) {\n                        var nonNullableType = createNode(269, type.pos);\n                        nonNullableType.type = type;\n                        nextToken();\n                        type = finishNode(nonNullableType);\n                    }\n                    else {\n                        break;\n                    }\n                }\n                return type;\n            }\n            function parseBasicTypeExpression() {\n                switch (token()) {\n                    case 38:\n                        return parseJSDocAllType();\n                    case 54:\n                        return parseJSDocUnknownOrNullableType();\n                    case 18:\n                        return parseJSDocUnionType();\n                    case 20:\n                        return parseJSDocTupleType();\n                    case 50:\n                        return parseJSDocNonNullableType();\n                    case 16:\n                        return parseJSDocRecordType();\n                    case 88:\n                        return parseJSDocFunctionType();\n                    case 23:\n                        return parseJSDocVariadicType();\n                    case 93:\n                        return parseJSDocConstructorType();\n                    case 98:\n                        return parseJSDocThisType();\n                    case 118:\n                    case 134:\n                    case 132:\n                    case 121:\n                    case 135:\n                    case 104:\n                    case 94:\n                    case 137:\n                    case 129:\n                        return parseTokenNode();\n                    case 9:\n                    case 8:\n                    case 100:\n                    case 85:\n                        return parseJSDocLiteralType();\n                }\n                return parseJSDocTypeReference();\n            }\n            function parseJSDocThisType() {\n                var result = createNode(277);\n                nextToken();\n                parseExpected(55);\n                result.type = parseJSDocType();\n                return finishNode(result);\n            }\n            function parseJSDocConstructorType() {\n                var result = createNode(276);\n                nextToken();\n                parseExpected(55);\n                result.type = parseJSDocType();\n                return finishNode(result);\n            }\n            function parseJSDocVariadicType() {\n                var result = createNode(275);\n                nextToken();\n                result.type = parseJSDocType();\n                return finishNode(result);\n            }\n            function parseJSDocFunctionType() {\n                var result = createNode(274);\n                nextToken();\n                parseExpected(18);\n                result.parameters = parseDelimitedList(23, parseJSDocParameter);\n                checkForTrailingComma(result.parameters);\n                parseExpected(19);\n                if (token() === 55) {\n                    nextToken();\n                    result.type = parseJSDocType();\n                }\n                return finishNode(result);\n            }\n            function parseJSDocParameter() {\n                var parameter = createNode(144);\n                parameter.type = parseJSDocType();\n                if (parseOptional(57)) {\n                    parameter.questionToken = createNode(57);\n                }\n                return finishNode(parameter);\n            }\n            function parseJSDocTypeReference() {\n                var result = createNode(272);\n                result.name = parseSimplePropertyName();\n                if (token() === 26) {\n                    result.typeArguments = parseTypeArguments();\n                }\n                else {\n                    while (parseOptional(22)) {\n                        if (token() === 26) {\n                            result.typeArguments = parseTypeArguments();\n                            break;\n                        }\n                        else {\n                            result.name = parseQualifiedName(result.name);\n                        }\n                    }\n                }\n                return finishNode(result);\n            }\n            function parseTypeArguments() {\n                nextToken();\n                var typeArguments = parseDelimitedList(24, parseJSDocType);\n                checkForTrailingComma(typeArguments);\n                checkForEmptyTypeArgumentList(typeArguments);\n                parseExpected(28);\n                return typeArguments;\n            }\n            function checkForEmptyTypeArgumentList(typeArguments) {\n                if (parseDiagnostics.length === 0 && typeArguments && typeArguments.length === 0) {\n                    var start = typeArguments.pos - \"<\".length;\n                    var end = ts.skipTrivia(sourceText, typeArguments.end) + \">\".length;\n                    return parseErrorAtPosition(start, end - start, ts.Diagnostics.Type_argument_list_cannot_be_empty);\n                }\n            }\n            function parseQualifiedName(left) {\n                var result = createNode(141, left.pos);\n                result.left = left;\n                result.right = parseIdentifierName();\n                return finishNode(result);\n            }\n            function parseJSDocRecordType() {\n                var result = createNode(270);\n                result.literal = parseTypeLiteral();\n                return finishNode(result);\n            }\n            function parseJSDocNonNullableType() {\n                var result = createNode(269);\n                nextToken();\n                result.type = parseJSDocType();\n                return finishNode(result);\n            }\n            function parseJSDocTupleType() {\n                var result = createNode(267);\n                nextToken();\n                result.types = parseDelimitedList(26, parseJSDocType);\n                checkForTrailingComma(result.types);\n                parseExpected(21);\n                return finishNode(result);\n            }\n            function checkForTrailingComma(list) {\n                if (parseDiagnostics.length === 0 && list.hasTrailingComma) {\n                    var start = list.end - \",\".length;\n                    parseErrorAtPosition(start, \",\".length, ts.Diagnostics.Trailing_comma_not_allowed);\n                }\n            }\n            function parseJSDocUnionType() {\n                var result = createNode(266);\n                nextToken();\n                result.types = parseJSDocTypeList(parseJSDocType());\n                parseExpected(19);\n                return finishNode(result);\n            }\n            function parseJSDocTypeList(firstType) {\n                ts.Debug.assert(!!firstType);\n                var types = createNodeArray([firstType], firstType.pos);\n                while (parseOptional(48)) {\n                    types.push(parseJSDocType());\n                }\n                types.end = scanner.getStartPos();\n                return types;\n            }\n            function parseJSDocAllType() {\n                var result = createNode(263);\n                nextToken();\n                return finishNode(result);\n            }\n            function parseJSDocLiteralType() {\n                var result = createNode(288);\n                result.literal = parseLiteralTypeNode();\n                return finishNode(result);\n            }\n            function parseJSDocUnknownOrNullableType() {\n                var pos = scanner.getStartPos();\n                nextToken();\n                if (token() === 25 ||\n                    token() === 17 ||\n                    token() === 19 ||\n                    token() === 28 ||\n                    token() === 57 ||\n                    token() === 48) {\n                    var result = createNode(264, pos);\n                    return finishNode(result);\n                }\n                else {\n                    var result = createNode(268, pos);\n                    result.type = parseJSDocType();\n                    return finishNode(result);\n                }\n            }\n            function parseIsolatedJSDocComment(content, start, length) {\n                initializeState(content, 5, undefined, 1);\n                sourceFile = { languageVariant: 0, text: content };\n                var jsDoc = parseJSDocCommentWorker(start, length);\n                var diagnostics = parseDiagnostics;\n                clearState();\n                return jsDoc ? { jsDoc: jsDoc, diagnostics: diagnostics } : undefined;\n            }\n            JSDocParser.parseIsolatedJSDocComment = parseIsolatedJSDocComment;\n            function parseJSDocComment(parent, start, length) {\n                var saveToken = currentToken;\n                var saveParseDiagnosticsLength = parseDiagnostics.length;\n                var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;\n                var comment = parseJSDocCommentWorker(start, length);\n                if (comment) {\n                    comment.parent = parent;\n                }\n                currentToken = saveToken;\n                parseDiagnostics.length = saveParseDiagnosticsLength;\n                parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode;\n                return comment;\n            }\n            JSDocParser.parseJSDocComment = parseJSDocComment;\n            function parseJSDocCommentWorker(start, length) {\n                var content = sourceText;\n                start = start || 0;\n                var end = length === undefined ? content.length : start + length;\n                length = end - start;\n                ts.Debug.assert(start >= 0);\n                ts.Debug.assert(start <= end);\n                ts.Debug.assert(end <= content.length);\n                var tags;\n                var comments = [];\n                var result;\n                if (!isJsDocStart(content, start)) {\n                    return result;\n                }\n                scanner.scanRange(start + 3, length - 5, function () {\n                    var advanceToken = true;\n                    var state = 1;\n                    var margin = undefined;\n                    var indent = start - Math.max(content.lastIndexOf(\"\\n\", start), 0) + 4;\n                    function pushComment(text) {\n                        if (!margin) {\n                            margin = indent;\n                        }\n                        comments.push(text);\n                        indent += text.length;\n                    }\n                    nextJSDocToken();\n                    while (token() === 5) {\n                        nextJSDocToken();\n                    }\n                    if (token() === 4) {\n                        state = 0;\n                        indent = 0;\n                        nextJSDocToken();\n                    }\n                    while (token() !== 1) {\n                        switch (token()) {\n                            case 56:\n                                if (state === 0 || state === 1) {\n                                    removeTrailingNewlines(comments);\n                                    parseTag(indent);\n                                    state = 0;\n                                    advanceToken = false;\n                                    margin = undefined;\n                                    indent++;\n                                }\n                                else {\n                                    pushComment(scanner.getTokenText());\n                                }\n                                break;\n                            case 4:\n                                comments.push(scanner.getTokenText());\n                                state = 0;\n                                indent = 0;\n                                break;\n                            case 38:\n                                var asterisk = scanner.getTokenText();\n                                if (state === 1) {\n                                    state = 2;\n                                    pushComment(asterisk);\n                                }\n                                else {\n                                    state = 1;\n                                    indent += asterisk.length;\n                                }\n                                break;\n                            case 70:\n                                pushComment(scanner.getTokenText());\n                                state = 2;\n                                break;\n                            case 5:\n                                var whitespace = scanner.getTokenText();\n                                if (state === 2 || margin !== undefined && indent + whitespace.length > margin) {\n                                    comments.push(whitespace.slice(margin - indent - 1));\n                                }\n                                indent += whitespace.length;\n                                break;\n                            case 1:\n                                break;\n                            default:\n                                pushComment(scanner.getTokenText());\n                                break;\n                        }\n                        if (advanceToken) {\n                            nextJSDocToken();\n                        }\n                        else {\n                            advanceToken = true;\n                        }\n                    }\n                    removeLeadingNewlines(comments);\n                    removeTrailingNewlines(comments);\n                    result = createJSDocComment();\n                });\n                return result;\n                function removeLeadingNewlines(comments) {\n                    while (comments.length && (comments[0] === \"\\n\" || comments[0] === \"\\r\")) {\n                        comments.shift();\n                    }\n                }\n                function removeTrailingNewlines(comments) {\n                    while (comments.length && (comments[comments.length - 1] === \"\\n\" || comments[comments.length - 1] === \"\\r\")) {\n                        comments.pop();\n                    }\n                }\n                function isJsDocStart(content, start) {\n                    return content.charCodeAt(start) === 47 &&\n                        content.charCodeAt(start + 1) === 42 &&\n                        content.charCodeAt(start + 2) === 42 &&\n                        content.charCodeAt(start + 3) !== 42;\n                }\n                function createJSDocComment() {\n                    var result = createNode(278, start);\n                    result.tags = tags;\n                    result.comment = comments.length ? comments.join(\"\") : undefined;\n                    return finishNode(result, end);\n                }\n                function skipWhitespace() {\n                    while (token() === 5 || token() === 4) {\n                        nextJSDocToken();\n                    }\n                }\n                function parseTag(indent) {\n                    ts.Debug.assert(token() === 56);\n                    var atToken = createNode(56, scanner.getTokenPos());\n                    atToken.end = scanner.getTextPos();\n                    nextJSDocToken();\n                    var tagName = parseJSDocIdentifierName();\n                    skipWhitespace();\n                    if (!tagName) {\n                        return;\n                    }\n                    var tag;\n                    if (tagName) {\n                        switch (tagName.text) {\n                            case \"augments\":\n                                tag = parseAugmentsTag(atToken, tagName);\n                                break;\n                            case \"param\":\n                                tag = parseParamTag(atToken, tagName);\n                                break;\n                            case \"return\":\n                            case \"returns\":\n                                tag = parseReturnTag(atToken, tagName);\n                                break;\n                            case \"template\":\n                                tag = parseTemplateTag(atToken, tagName);\n                                break;\n                            case \"type\":\n                                tag = parseTypeTag(atToken, tagName);\n                                break;\n                            case \"typedef\":\n                                tag = parseTypedefTag(atToken, tagName);\n                                break;\n                            default:\n                                tag = parseUnknownTag(atToken, tagName);\n                                break;\n                        }\n                    }\n                    else {\n                        tag = parseUnknownTag(atToken, tagName);\n                    }\n                    if (!tag) {\n                        return;\n                    }\n                    addTag(tag, parseTagComments(indent + tag.end - tag.pos));\n                }\n                function parseTagComments(indent) {\n                    var comments = [];\n                    var state = 1;\n                    var margin;\n                    function pushComment(text) {\n                        if (!margin) {\n                            margin = indent;\n                        }\n                        comments.push(text);\n                        indent += text.length;\n                    }\n                    while (token() !== 56 && token() !== 1) {\n                        switch (token()) {\n                            case 4:\n                                if (state >= 1) {\n                                    state = 0;\n                                    comments.push(scanner.getTokenText());\n                                }\n                                indent = 0;\n                                break;\n                            case 56:\n                                break;\n                            case 5:\n                                if (state === 2) {\n                                    pushComment(scanner.getTokenText());\n                                }\n                                else {\n                                    var whitespace = scanner.getTokenText();\n                                    if (margin !== undefined && indent + whitespace.length > margin) {\n                                        comments.push(whitespace.slice(margin - indent - 1));\n                                    }\n                                    indent += whitespace.length;\n                                }\n                                break;\n                            case 38:\n                                if (state === 0) {\n                                    state = 1;\n                                    indent += scanner.getTokenText().length;\n                                    break;\n                                }\n                            default:\n                                state = 2;\n                                pushComment(scanner.getTokenText());\n                                break;\n                        }\n                        if (token() === 56) {\n                            break;\n                        }\n                        nextJSDocToken();\n                    }\n                    removeLeadingNewlines(comments);\n                    removeTrailingNewlines(comments);\n                    return comments;\n                }\n                function parseUnknownTag(atToken, tagName) {\n                    var result = createNode(279, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    return finishNode(result);\n                }\n                function addTag(tag, comments) {\n                    tag.comment = comments.join(\"\");\n                    if (!tags) {\n                        tags = createNodeArray([tag], tag.pos);\n                    }\n                    else {\n                        tags.push(tag);\n                    }\n                    tags.end = tag.end;\n                }\n                function tryParseTypeExpression() {\n                    return tryParse(function () {\n                        skipWhitespace();\n                        if (token() !== 16) {\n                            return undefined;\n                        }\n                        return parseJSDocTypeExpression();\n                    });\n                }\n                function parseParamTag(atToken, tagName) {\n                    var typeExpression = tryParseTypeExpression();\n                    skipWhitespace();\n                    var name;\n                    var isBracketed;\n                    if (parseOptionalToken(20)) {\n                        name = parseJSDocIdentifierName();\n                        skipWhitespace();\n                        isBracketed = true;\n                        if (parseOptionalToken(57)) {\n                            parseExpression();\n                        }\n                        parseExpected(21);\n                    }\n                    else if (ts.tokenIsIdentifierOrKeyword(token())) {\n                        name = parseJSDocIdentifierName();\n                    }\n                    if (!name) {\n                        parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);\n                        return undefined;\n                    }\n                    var preName, postName;\n                    if (typeExpression) {\n                        postName = name;\n                    }\n                    else {\n                        preName = name;\n                    }\n                    if (!typeExpression) {\n                        typeExpression = tryParseTypeExpression();\n                    }\n                    var result = createNode(281, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.preParameterName = preName;\n                    result.typeExpression = typeExpression;\n                    result.postParameterName = postName;\n                    result.parameterName = postName || preName;\n                    result.isBracketed = isBracketed;\n                    return finishNode(result);\n                }\n                function parseReturnTag(atToken, tagName) {\n                    if (ts.forEach(tags, function (t) { return t.kind === 282; })) {\n                        parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);\n                    }\n                    var result = createNode(282, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.typeExpression = tryParseTypeExpression();\n                    return finishNode(result);\n                }\n                function parseTypeTag(atToken, tagName) {\n                    if (ts.forEach(tags, function (t) { return t.kind === 283; })) {\n                        parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);\n                    }\n                    var result = createNode(283, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.typeExpression = tryParseTypeExpression();\n                    return finishNode(result);\n                }\n                function parsePropertyTag(atToken, tagName) {\n                    var typeExpression = tryParseTypeExpression();\n                    skipWhitespace();\n                    var name = parseJSDocIdentifierName();\n                    skipWhitespace();\n                    if (!name) {\n                        parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);\n                        return undefined;\n                    }\n                    var result = createNode(286, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.name = name;\n                    result.typeExpression = typeExpression;\n                    return finishNode(result);\n                }\n                function parseAugmentsTag(atToken, tagName) {\n                    var typeExpression = tryParseTypeExpression();\n                    var result = createNode(280, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.typeExpression = typeExpression;\n                    return finishNode(result);\n                }\n                function parseTypedefTag(atToken, tagName) {\n                    var typeExpression = tryParseTypeExpression();\n                    skipWhitespace();\n                    var typedefTag = createNode(285, atToken.pos);\n                    typedefTag.atToken = atToken;\n                    typedefTag.tagName = tagName;\n                    typedefTag.fullName = parseJSDocTypeNameWithNamespace(0);\n                    if (typedefTag.fullName) {\n                        var rightNode = typedefTag.fullName;\n                        while (rightNode.kind !== 70) {\n                            rightNode = rightNode.body;\n                        }\n                        typedefTag.name = rightNode;\n                    }\n                    typedefTag.typeExpression = typeExpression;\n                    skipWhitespace();\n                    if (typeExpression) {\n                        if (typeExpression.type.kind === 272) {\n                            var jsDocTypeReference = typeExpression.type;\n                            if (jsDocTypeReference.name.kind === 70) {\n                                var name_14 = jsDocTypeReference.name;\n                                if (name_14.text === \"Object\") {\n                                    typedefTag.jsDocTypeLiteral = scanChildTags();\n                                }\n                            }\n                        }\n                        if (!typedefTag.jsDocTypeLiteral) {\n                            typedefTag.jsDocTypeLiteral = typeExpression.type;\n                        }\n                    }\n                    else {\n                        typedefTag.jsDocTypeLiteral = scanChildTags();\n                    }\n                    return finishNode(typedefTag);\n                    function scanChildTags() {\n                        var jsDocTypeLiteral = createNode(287, scanner.getStartPos());\n                        var resumePos = scanner.getStartPos();\n                        var canParseTag = true;\n                        var seenAsterisk = false;\n                        var parentTagTerminated = false;\n                        while (token() !== 1 && !parentTagTerminated) {\n                            nextJSDocToken();\n                            switch (token()) {\n                                case 56:\n                                    if (canParseTag) {\n                                        parentTagTerminated = !tryParseChildTag(jsDocTypeLiteral);\n                                        if (!parentTagTerminated) {\n                                            resumePos = scanner.getStartPos();\n                                        }\n                                    }\n                                    seenAsterisk = false;\n                                    break;\n                                case 4:\n                                    resumePos = scanner.getStartPos() - 1;\n                                    canParseTag = true;\n                                    seenAsterisk = false;\n                                    break;\n                                case 38:\n                                    if (seenAsterisk) {\n                                        canParseTag = false;\n                                    }\n                                    seenAsterisk = true;\n                                    break;\n                                case 70:\n                                    canParseTag = false;\n                                case 1:\n                                    break;\n                            }\n                        }\n                        scanner.setTextPos(resumePos);\n                        return finishNode(jsDocTypeLiteral);\n                    }\n                    function parseJSDocTypeNameWithNamespace(flags) {\n                        var pos = scanner.getTokenPos();\n                        var typeNameOrNamespaceName = parseJSDocIdentifierName();\n                        if (typeNameOrNamespaceName && parseOptional(22)) {\n                            var jsDocNamespaceNode = createNode(230, pos);\n                            jsDocNamespaceNode.flags |= flags;\n                            jsDocNamespaceNode.name = typeNameOrNamespaceName;\n                            jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4);\n                            return jsDocNamespaceNode;\n                        }\n                        if (typeNameOrNamespaceName && flags & 4) {\n                            typeNameOrNamespaceName.isInJSDocNamespace = true;\n                        }\n                        return typeNameOrNamespaceName;\n                    }\n                }\n                function tryParseChildTag(parentTag) {\n                    ts.Debug.assert(token() === 56);\n                    var atToken = createNode(56, scanner.getStartPos());\n                    atToken.end = scanner.getTextPos();\n                    nextJSDocToken();\n                    var tagName = parseJSDocIdentifierName();\n                    skipWhitespace();\n                    if (!tagName) {\n                        return false;\n                    }\n                    switch (tagName.text) {\n                        case \"type\":\n                            if (parentTag.jsDocTypeTag) {\n                                return false;\n                            }\n                            parentTag.jsDocTypeTag = parseTypeTag(atToken, tagName);\n                            return true;\n                        case \"prop\":\n                        case \"property\":\n                            var propertyTag = parsePropertyTag(atToken, tagName);\n                            if (propertyTag) {\n                                if (!parentTag.jsDocPropertyTags) {\n                                    parentTag.jsDocPropertyTags = [];\n                                }\n                                parentTag.jsDocPropertyTags.push(propertyTag);\n                                return true;\n                            }\n                            return false;\n                    }\n                    return false;\n                }\n                function parseTemplateTag(atToken, tagName) {\n                    if (ts.forEach(tags, function (t) { return t.kind === 284; })) {\n                        parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);\n                    }\n                    var typeParameters = createNodeArray();\n                    while (true) {\n                        var name_15 = parseJSDocIdentifierName();\n                        skipWhitespace();\n                        if (!name_15) {\n                            parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);\n                            return undefined;\n                        }\n                        var typeParameter = createNode(143, name_15.pos);\n                        typeParameter.name = name_15;\n                        finishNode(typeParameter);\n                        typeParameters.push(typeParameter);\n                        if (token() === 25) {\n                            nextJSDocToken();\n                            skipWhitespace();\n                        }\n                        else {\n                            break;\n                        }\n                    }\n                    var result = createNode(284, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.typeParameters = typeParameters;\n                    finishNode(result);\n                    typeParameters.end = result.end;\n                    return result;\n                }\n                function nextJSDocToken() {\n                    return currentToken = scanner.scanJSDocToken();\n                }\n                function parseJSDocIdentifierName() {\n                    return createJSDocIdentifier(ts.tokenIsIdentifierOrKeyword(token()));\n                }\n                function createJSDocIdentifier(isIdentifier) {\n                    if (!isIdentifier) {\n                        parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);\n                        return undefined;\n                    }\n                    var pos = scanner.getTokenPos();\n                    var end = scanner.getTextPos();\n                    var result = createNode(70, pos);\n                    result.text = content.substring(pos, end);\n                    finishNode(result, end);\n                    nextJSDocToken();\n                    return result;\n                }\n            }\n            JSDocParser.parseJSDocCommentWorker = parseJSDocCommentWorker;\n        })(JSDocParser = Parser.JSDocParser || (Parser.JSDocParser = {}));\n    })(Parser || (Parser = {}));\n    var IncrementalParser;\n    (function (IncrementalParser) {\n        function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) {\n            aggressiveChecks = aggressiveChecks || ts.Debug.shouldAssert(2);\n            checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks);\n            if (ts.textChangeRangeIsUnchanged(textChangeRange)) {\n                return sourceFile;\n            }\n            if (sourceFile.statements.length === 0) {\n                return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, undefined, true, sourceFile.scriptKind);\n            }\n            var incrementalSourceFile = sourceFile;\n            ts.Debug.assert(!incrementalSourceFile.hasBeenIncrementallyParsed);\n            incrementalSourceFile.hasBeenIncrementallyParsed = true;\n            var oldText = sourceFile.text;\n            var syntaxCursor = createSyntaxCursor(sourceFile);\n            var changeRange = extendToAffectedRange(sourceFile, textChangeRange);\n            checkChangeRange(sourceFile, newText, changeRange, aggressiveChecks);\n            ts.Debug.assert(changeRange.span.start <= textChangeRange.span.start);\n            ts.Debug.assert(ts.textSpanEnd(changeRange.span) === ts.textSpanEnd(textChangeRange.span));\n            ts.Debug.assert(ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)) === ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange)));\n            var delta = ts.textChangeRangeNewSpan(changeRange).length - changeRange.span.length;\n            updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, ts.textSpanEnd(changeRange.span), ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks);\n            var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, true, sourceFile.scriptKind);\n            return result;\n        }\n        IncrementalParser.updateSourceFile = updateSourceFile;\n        function moveElementEntirelyPastChangeRange(element, isArray, delta, oldText, newText, aggressiveChecks) {\n            if (isArray) {\n                visitArray(element);\n            }\n            else {\n                visitNode(element);\n            }\n            return;\n            function visitNode(node) {\n                var text = \"\";\n                if (aggressiveChecks && shouldCheckNode(node)) {\n                    text = oldText.substring(node.pos, node.end);\n                }\n                if (node._children) {\n                    node._children = undefined;\n                }\n                node.pos += delta;\n                node.end += delta;\n                if (aggressiveChecks && shouldCheckNode(node)) {\n                    ts.Debug.assert(text === newText.substring(node.pos, node.end));\n                }\n                forEachChild(node, visitNode, visitArray);\n                if (node.jsDoc) {\n                    for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {\n                        var jsDocComment = _a[_i];\n                        forEachChild(jsDocComment, visitNode, visitArray);\n                    }\n                }\n                checkNodePositions(node, aggressiveChecks);\n            }\n            function visitArray(array) {\n                array._children = undefined;\n                array.pos += delta;\n                array.end += delta;\n                for (var _i = 0, array_9 = array; _i < array_9.length; _i++) {\n                    var node = array_9[_i];\n                    visitNode(node);\n                }\n            }\n        }\n        function shouldCheckNode(node) {\n            switch (node.kind) {\n                case 9:\n                case 8:\n                case 70:\n                    return true;\n            }\n            return false;\n        }\n        function adjustIntersectingElement(element, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta) {\n            ts.Debug.assert(element.end >= changeStart, \"Adjusting an element that was entirely before the change range\");\n            ts.Debug.assert(element.pos <= changeRangeOldEnd, \"Adjusting an element that was entirely after the change range\");\n            ts.Debug.assert(element.pos <= element.end);\n            element.pos = Math.min(element.pos, changeRangeNewEnd);\n            if (element.end >= changeRangeOldEnd) {\n                element.end += delta;\n            }\n            else {\n                element.end = Math.min(element.end, changeRangeNewEnd);\n            }\n            ts.Debug.assert(element.pos <= element.end);\n            if (element.parent) {\n                ts.Debug.assert(element.pos >= element.parent.pos);\n                ts.Debug.assert(element.end <= element.parent.end);\n            }\n        }\n        function checkNodePositions(node, aggressiveChecks) {\n            if (aggressiveChecks) {\n                var pos_2 = node.pos;\n                forEachChild(node, function (child) {\n                    ts.Debug.assert(child.pos >= pos_2);\n                    pos_2 = child.end;\n                });\n                ts.Debug.assert(pos_2 <= node.end);\n            }\n        }\n        function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) {\n            visitNode(sourceFile);\n            return;\n            function visitNode(child) {\n                ts.Debug.assert(child.pos <= child.end);\n                if (child.pos > changeRangeOldEnd) {\n                    moveElementEntirelyPastChangeRange(child, false, delta, oldText, newText, aggressiveChecks);\n                    return;\n                }\n                var fullEnd = child.end;\n                if (fullEnd >= changeStart) {\n                    child.intersectsChange = true;\n                    child._children = undefined;\n                    adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);\n                    forEachChild(child, visitNode, visitArray);\n                    checkNodePositions(child, aggressiveChecks);\n                    return;\n                }\n                ts.Debug.assert(fullEnd < changeStart);\n            }\n            function visitArray(array) {\n                ts.Debug.assert(array.pos <= array.end);\n                if (array.pos > changeRangeOldEnd) {\n                    moveElementEntirelyPastChangeRange(array, true, delta, oldText, newText, aggressiveChecks);\n                    return;\n                }\n                var fullEnd = array.end;\n                if (fullEnd >= changeStart) {\n                    array.intersectsChange = true;\n                    array._children = undefined;\n                    adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);\n                    for (var _i = 0, array_10 = array; _i < array_10.length; _i++) {\n                        var node = array_10[_i];\n                        visitNode(node);\n                    }\n                    return;\n                }\n                ts.Debug.assert(fullEnd < changeStart);\n            }\n        }\n        function extendToAffectedRange(sourceFile, changeRange) {\n            var maxLookahead = 1;\n            var start = changeRange.span.start;\n            for (var i = 0; start > 0 && i <= maxLookahead; i++) {\n                var nearestNode = findNearestNodeStartingBeforeOrAtPosition(sourceFile, start);\n                ts.Debug.assert(nearestNode.pos <= start);\n                var position = nearestNode.pos;\n                start = Math.max(0, position - 1);\n            }\n            var finalSpan = ts.createTextSpanFromBounds(start, ts.textSpanEnd(changeRange.span));\n            var finalLength = changeRange.newLength + (changeRange.span.start - start);\n            return ts.createTextChangeRange(finalSpan, finalLength);\n        }\n        function findNearestNodeStartingBeforeOrAtPosition(sourceFile, position) {\n            var bestResult = sourceFile;\n            var lastNodeEntirelyBeforePosition;\n            forEachChild(sourceFile, visit);\n            if (lastNodeEntirelyBeforePosition) {\n                var lastChildOfLastEntireNodeBeforePosition = getLastChild(lastNodeEntirelyBeforePosition);\n                if (lastChildOfLastEntireNodeBeforePosition.pos > bestResult.pos) {\n                    bestResult = lastChildOfLastEntireNodeBeforePosition;\n                }\n            }\n            return bestResult;\n            function getLastChild(node) {\n                while (true) {\n                    var lastChild = getLastChildWorker(node);\n                    if (lastChild) {\n                        node = lastChild;\n                    }\n                    else {\n                        return node;\n                    }\n                }\n            }\n            function getLastChildWorker(node) {\n                var last = undefined;\n                forEachChild(node, function (child) {\n                    if (ts.nodeIsPresent(child)) {\n                        last = child;\n                    }\n                });\n                return last;\n            }\n            function visit(child) {\n                if (ts.nodeIsMissing(child)) {\n                    return;\n                }\n                if (child.pos <= position) {\n                    if (child.pos >= bestResult.pos) {\n                        bestResult = child;\n                    }\n                    if (position < child.end) {\n                        forEachChild(child, visit);\n                        return true;\n                    }\n                    else {\n                        ts.Debug.assert(child.end <= position);\n                        lastNodeEntirelyBeforePosition = child;\n                    }\n                }\n                else {\n                    ts.Debug.assert(child.pos > position);\n                    return true;\n                }\n            }\n        }\n        function checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks) {\n            var oldText = sourceFile.text;\n            if (textChangeRange) {\n                ts.Debug.assert((oldText.length - textChangeRange.span.length + textChangeRange.newLength) === newText.length);\n                if (aggressiveChecks || ts.Debug.shouldAssert(3)) {\n                    var oldTextPrefix = oldText.substr(0, textChangeRange.span.start);\n                    var newTextPrefix = newText.substr(0, textChangeRange.span.start);\n                    ts.Debug.assert(oldTextPrefix === newTextPrefix);\n                    var oldTextSuffix = oldText.substring(ts.textSpanEnd(textChangeRange.span), oldText.length);\n                    var newTextSuffix = newText.substring(ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange)), newText.length);\n                    ts.Debug.assert(oldTextSuffix === newTextSuffix);\n                }\n            }\n        }\n        function createSyntaxCursor(sourceFile) {\n            var currentArray = sourceFile.statements;\n            var currentArrayIndex = 0;\n            ts.Debug.assert(currentArrayIndex < currentArray.length);\n            var current = currentArray[currentArrayIndex];\n            var lastQueriedPosition = -1;\n            return {\n                currentNode: function (position) {\n                    if (position !== lastQueriedPosition) {\n                        if (current && current.end === position && currentArrayIndex < (currentArray.length - 1)) {\n                            currentArrayIndex++;\n                            current = currentArray[currentArrayIndex];\n                        }\n                        if (!current || current.pos !== position) {\n                            findHighestListElementThatStartsAtPosition(position);\n                        }\n                    }\n                    lastQueriedPosition = position;\n                    ts.Debug.assert(!current || current.pos === position);\n                    return current;\n                }\n            };\n            function findHighestListElementThatStartsAtPosition(position) {\n                currentArray = undefined;\n                currentArrayIndex = -1;\n                current = undefined;\n                forEachChild(sourceFile, visitNode, visitArray);\n                return;\n                function visitNode(node) {\n                    if (position >= node.pos && position < node.end) {\n                        forEachChild(node, visitNode, visitArray);\n                        return true;\n                    }\n                    return false;\n                }\n                function visitArray(array) {\n                    if (position >= array.pos && position < array.end) {\n                        for (var i = 0, n = array.length; i < n; i++) {\n                            var child = array[i];\n                            if (child) {\n                                if (child.pos === position) {\n                                    currentArray = array;\n                                    currentArrayIndex = i;\n                                    current = child;\n                                    return true;\n                                }\n                                else {\n                                    if (child.pos < position && position < child.end) {\n                                        forEachChild(child, visitNode, visitArray);\n                                        return true;\n                                    }\n                                }\n                            }\n                        }\n                    }\n                    return false;\n                }\n            }\n        }\n    })(IncrementalParser || (IncrementalParser = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function getModuleInstanceState(node) {\n        if (node.kind === 227 || node.kind === 228) {\n            return 0;\n        }\n        else if (ts.isConstEnumDeclaration(node)) {\n            return 2;\n        }\n        else if ((node.kind === 235 || node.kind === 234) && !(ts.hasModifier(node, 1))) {\n            return 0;\n        }\n        else if (node.kind === 231) {\n            var state_1 = 0;\n            ts.forEachChild(node, function (n) {\n                switch (getModuleInstanceState(n)) {\n                    case 0:\n                        return false;\n                    case 2:\n                        state_1 = 2;\n                        return false;\n                    case 1:\n                        state_1 = 1;\n                        return true;\n                }\n            });\n            return state_1;\n        }\n        else if (node.kind === 230) {\n            var body = node.body;\n            return body ? getModuleInstanceState(body) : 1;\n        }\n        else if (node.kind === 70 && node.isInJSDocNamespace) {\n            return 0;\n        }\n        else {\n            return 1;\n        }\n    }\n    ts.getModuleInstanceState = getModuleInstanceState;\n    var binder = createBinder();\n    function bindSourceFile(file, options) {\n        ts.performance.mark(\"beforeBind\");\n        binder(file, options);\n        ts.performance.mark(\"afterBind\");\n        ts.performance.measure(\"Bind\", \"beforeBind\", \"afterBind\");\n    }\n    ts.bindSourceFile = bindSourceFile;\n    function createBinder() {\n        var file;\n        var options;\n        var languageVersion;\n        var parent;\n        var container;\n        var blockScopeContainer;\n        var lastContainer;\n        var seenThisKeyword;\n        var currentFlow;\n        var currentBreakTarget;\n        var currentContinueTarget;\n        var currentReturnTarget;\n        var currentTrueTarget;\n        var currentFalseTarget;\n        var preSwitchCaseFlow;\n        var activeLabels;\n        var hasExplicitReturn;\n        var emitFlags;\n        var inStrictMode;\n        var symbolCount = 0;\n        var Symbol;\n        var classifiableNames;\n        var unreachableFlow = { flags: 1 };\n        var reportedUnreachableFlow = { flags: 1 };\n        var subtreeTransformFlags = 0;\n        var skipTransformFlagAggregation;\n        function bindSourceFile(f, opts) {\n            file = f;\n            options = opts;\n            languageVersion = ts.getEmitScriptTarget(options);\n            inStrictMode = bindInStrictMode(file, opts);\n            classifiableNames = ts.createMap();\n            symbolCount = 0;\n            skipTransformFlagAggregation = ts.isDeclarationFile(file);\n            Symbol = ts.objectAllocator.getSymbolConstructor();\n            if (!file.locals) {\n                bind(file);\n                file.symbolCount = symbolCount;\n                file.classifiableNames = classifiableNames;\n            }\n            file = undefined;\n            options = undefined;\n            languageVersion = undefined;\n            parent = undefined;\n            container = undefined;\n            blockScopeContainer = undefined;\n            lastContainer = undefined;\n            seenThisKeyword = false;\n            currentFlow = undefined;\n            currentBreakTarget = undefined;\n            currentContinueTarget = undefined;\n            currentReturnTarget = undefined;\n            currentTrueTarget = undefined;\n            currentFalseTarget = undefined;\n            activeLabels = undefined;\n            hasExplicitReturn = false;\n            emitFlags = 0;\n            subtreeTransformFlags = 0;\n        }\n        return bindSourceFile;\n        function bindInStrictMode(file, opts) {\n            if (opts.alwaysStrict && !ts.isDeclarationFile(file)) {\n                return true;\n            }\n            else {\n                return !!file.externalModuleIndicator;\n            }\n        }\n        function createSymbol(flags, name) {\n            symbolCount++;\n            return new Symbol(flags, name);\n        }\n        function addDeclarationToSymbol(symbol, node, symbolFlags) {\n            symbol.flags |= symbolFlags;\n            node.symbol = symbol;\n            if (!symbol.declarations) {\n                symbol.declarations = [];\n            }\n            symbol.declarations.push(node);\n            if (symbolFlags & 1952 && !symbol.exports) {\n                symbol.exports = ts.createMap();\n            }\n            if (symbolFlags & 6240 && !symbol.members) {\n                symbol.members = ts.createMap();\n            }\n            if (symbolFlags & 107455) {\n                var valueDeclaration = symbol.valueDeclaration;\n                if (!valueDeclaration ||\n                    (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 230)) {\n                    symbol.valueDeclaration = node;\n                }\n            }\n        }\n        function getDeclarationName(node) {\n            if (node.name) {\n                if (ts.isAmbientModule(node)) {\n                    return ts.isGlobalScopeAugmentation(node) ? \"__global\" : \"\\\"\" + node.name.text + \"\\\"\";\n                }\n                if (node.name.kind === 142) {\n                    var nameExpression = node.name.expression;\n                    if (ts.isStringOrNumericLiteral(nameExpression)) {\n                        return nameExpression.text;\n                    }\n                    ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression));\n                    return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text);\n                }\n                return node.name.text;\n            }\n            switch (node.kind) {\n                case 150:\n                    return \"__constructor\";\n                case 158:\n                case 153:\n                    return \"__call\";\n                case 159:\n                case 154:\n                    return \"__new\";\n                case 155:\n                    return \"__index\";\n                case 241:\n                    return \"__export\";\n                case 240:\n                    return node.isExportEquals ? \"export=\" : \"default\";\n                case 192:\n                    switch (ts.getSpecialPropertyAssignmentKind(node)) {\n                        case 2:\n                            return \"export=\";\n                        case 1:\n                        case 4:\n                            return node.left.name.text;\n                        case 3:\n                            return node.left.expression.name.text;\n                    }\n                    ts.Debug.fail(\"Unknown binary declaration kind\");\n                    break;\n                case 225:\n                case 226:\n                    return ts.hasModifier(node, 512) ? \"default\" : undefined;\n                case 274:\n                    return ts.isJSDocConstructSignature(node) ? \"__new\" : \"__call\";\n                case 144:\n                    ts.Debug.assert(node.parent.kind === 274);\n                    var functionType = node.parent;\n                    var index = ts.indexOf(functionType.parameters, node);\n                    return \"arg\" + index;\n                case 285:\n                    var parentNode = node.parent && node.parent.parent;\n                    var nameFromParentNode = void 0;\n                    if (parentNode && parentNode.kind === 205) {\n                        if (parentNode.declarationList.declarations.length > 0) {\n                            var nameIdentifier = parentNode.declarationList.declarations[0].name;\n                            if (nameIdentifier.kind === 70) {\n                                nameFromParentNode = nameIdentifier.text;\n                            }\n                        }\n                    }\n                    return nameFromParentNode;\n            }\n        }\n        function getDisplayName(node) {\n            return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node);\n        }\n        function declareSymbol(symbolTable, parent, node, includes, excludes) {\n            ts.Debug.assert(!ts.hasDynamicName(node));\n            var isDefaultExport = ts.hasModifier(node, 512);\n            var name = isDefaultExport && parent ? \"default\" : getDeclarationName(node);\n            var symbol;\n            if (name === undefined) {\n                symbol = createSymbol(0, \"__missing\");\n            }\n            else {\n                symbol = symbolTable[name] || (symbolTable[name] = createSymbol(0, name));\n                if (name && (includes & 788448)) {\n                    classifiableNames[name] = name;\n                }\n                if (symbol.flags & excludes) {\n                    if (symbol.isReplaceableByMethod) {\n                        symbol = symbolTable[name] = createSymbol(0, name);\n                    }\n                    else {\n                        if (node.name) {\n                            node.name.parent = node;\n                        }\n                        var message_1 = symbol.flags & 2\n                            ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0\n                            : ts.Diagnostics.Duplicate_identifier_0;\n                        if (symbol.declarations && symbol.declarations.length) {\n                            if (isDefaultExport) {\n                                message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;\n                            }\n                            else {\n                                if (symbol.declarations && symbol.declarations.length &&\n                                    (isDefaultExport || (node.kind === 240 && !node.isExportEquals))) {\n                                    message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;\n                                }\n                            }\n                        }\n                        ts.forEach(symbol.declarations, function (declaration) {\n                            file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message_1, getDisplayName(declaration)));\n                        });\n                        file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message_1, getDisplayName(node)));\n                        symbol = createSymbol(0, name);\n                    }\n                }\n            }\n            addDeclarationToSymbol(symbol, node, includes);\n            symbol.parent = parent;\n            return symbol;\n        }\n        function declareModuleMember(node, symbolFlags, symbolExcludes) {\n            var hasExportModifier = ts.getCombinedModifierFlags(node) & 1;\n            if (symbolFlags & 8388608) {\n                if (node.kind === 243 || (node.kind === 234 && hasExportModifier)) {\n                    return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);\n                }\n                else {\n                    return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);\n                }\n            }\n            else {\n                var isJSDocTypedefInJSDocNamespace = node.kind === 285 &&\n                    node.name &&\n                    node.name.kind === 70 &&\n                    node.name.isInJSDocNamespace;\n                if ((!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 32)) || isJSDocTypedefInJSDocNamespace) {\n                    var exportKind = (symbolFlags & 107455 ? 1048576 : 0) |\n                        (symbolFlags & 793064 ? 2097152 : 0) |\n                        (symbolFlags & 1920 ? 4194304 : 0);\n                    var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes);\n                    local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);\n                    node.localSymbol = local;\n                    return local;\n                }\n                else {\n                    return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);\n                }\n            }\n        }\n        function bindContainer(node, containerFlags) {\n            var saveContainer = container;\n            var savedBlockScopeContainer = blockScopeContainer;\n            if (containerFlags & 1) {\n                container = blockScopeContainer = node;\n                if (containerFlags & 32) {\n                    container.locals = ts.createMap();\n                }\n                addToContainerChain(container);\n            }\n            else if (containerFlags & 2) {\n                blockScopeContainer = node;\n                blockScopeContainer.locals = undefined;\n            }\n            if (containerFlags & 4) {\n                var saveCurrentFlow = currentFlow;\n                var saveBreakTarget = currentBreakTarget;\n                var saveContinueTarget = currentContinueTarget;\n                var saveReturnTarget = currentReturnTarget;\n                var saveActiveLabels = activeLabels;\n                var saveHasExplicitReturn = hasExplicitReturn;\n                var isIIFE = containerFlags & 16 && !ts.hasModifier(node, 256) && !!ts.getImmediatelyInvokedFunctionExpression(node);\n                if (isIIFE) {\n                    currentReturnTarget = createBranchLabel();\n                }\n                else {\n                    currentFlow = { flags: 2 };\n                    if (containerFlags & (16 | 128)) {\n                        currentFlow.container = node;\n                    }\n                    currentReturnTarget = undefined;\n                }\n                currentBreakTarget = undefined;\n                currentContinueTarget = undefined;\n                activeLabels = undefined;\n                hasExplicitReturn = false;\n                bindChildren(node);\n                node.flags &= ~1408;\n                if (!(currentFlow.flags & 1) && containerFlags & 8 && ts.nodeIsPresent(node.body)) {\n                    node.flags |= 128;\n                    if (hasExplicitReturn)\n                        node.flags |= 256;\n                }\n                if (node.kind === 261) {\n                    node.flags |= emitFlags;\n                }\n                if (isIIFE) {\n                    addAntecedent(currentReturnTarget, currentFlow);\n                    currentFlow = finishFlowLabel(currentReturnTarget);\n                }\n                else {\n                    currentFlow = saveCurrentFlow;\n                }\n                currentBreakTarget = saveBreakTarget;\n                currentContinueTarget = saveContinueTarget;\n                currentReturnTarget = saveReturnTarget;\n                activeLabels = saveActiveLabels;\n                hasExplicitReturn = saveHasExplicitReturn;\n            }\n            else if (containerFlags & 64) {\n                seenThisKeyword = false;\n                bindChildren(node);\n                node.flags = seenThisKeyword ? node.flags | 64 : node.flags & ~64;\n            }\n            else {\n                bindChildren(node);\n            }\n            container = saveContainer;\n            blockScopeContainer = savedBlockScopeContainer;\n        }\n        function bindChildren(node) {\n            if (skipTransformFlagAggregation) {\n                bindChildrenWorker(node);\n            }\n            else if (node.transformFlags & 536870912) {\n                skipTransformFlagAggregation = true;\n                bindChildrenWorker(node);\n                skipTransformFlagAggregation = false;\n                subtreeTransformFlags |= node.transformFlags & ~getTransformFlagsSubtreeExclusions(node.kind);\n            }\n            else {\n                var savedSubtreeTransformFlags = subtreeTransformFlags;\n                subtreeTransformFlags = 0;\n                bindChildrenWorker(node);\n                subtreeTransformFlags = savedSubtreeTransformFlags | computeTransformFlagsForNode(node, subtreeTransformFlags);\n            }\n        }\n        function bindEach(nodes) {\n            if (nodes === undefined) {\n                return;\n            }\n            if (skipTransformFlagAggregation) {\n                ts.forEach(nodes, bind);\n            }\n            else {\n                var savedSubtreeTransformFlags = subtreeTransformFlags;\n                subtreeTransformFlags = 0;\n                var nodeArrayFlags = 0;\n                for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {\n                    var node = nodes_2[_i];\n                    bind(node);\n                    nodeArrayFlags |= node.transformFlags & ~536870912;\n                }\n                nodes.transformFlags = nodeArrayFlags | 536870912;\n                subtreeTransformFlags |= savedSubtreeTransformFlags;\n            }\n        }\n        function bindEachChild(node) {\n            ts.forEachChild(node, bind, bindEach);\n        }\n        function bindChildrenWorker(node) {\n            if (ts.isInJavaScriptFile(node) && node.jsDoc) {\n                ts.forEach(node.jsDoc, bind);\n            }\n            if (checkUnreachable(node)) {\n                bindEachChild(node);\n                return;\n            }\n            switch (node.kind) {\n                case 210:\n                    bindWhileStatement(node);\n                    break;\n                case 209:\n                    bindDoStatement(node);\n                    break;\n                case 211:\n                    bindForStatement(node);\n                    break;\n                case 212:\n                case 213:\n                    bindForInOrForOfStatement(node);\n                    break;\n                case 208:\n                    bindIfStatement(node);\n                    break;\n                case 216:\n                case 220:\n                    bindReturnOrThrow(node);\n                    break;\n                case 215:\n                case 214:\n                    bindBreakOrContinueStatement(node);\n                    break;\n                case 221:\n                    bindTryStatement(node);\n                    break;\n                case 218:\n                    bindSwitchStatement(node);\n                    break;\n                case 232:\n                    bindCaseBlock(node);\n                    break;\n                case 253:\n                    bindCaseClause(node);\n                    break;\n                case 219:\n                    bindLabeledStatement(node);\n                    break;\n                case 190:\n                    bindPrefixUnaryExpressionFlow(node);\n                    break;\n                case 191:\n                    bindPostfixUnaryExpressionFlow(node);\n                    break;\n                case 192:\n                    bindBinaryExpressionFlow(node);\n                    break;\n                case 186:\n                    bindDeleteExpressionFlow(node);\n                    break;\n                case 193:\n                    bindConditionalExpressionFlow(node);\n                    break;\n                case 223:\n                    bindVariableDeclarationFlow(node);\n                    break;\n                case 179:\n                    bindCallExpressionFlow(node);\n                    break;\n                default:\n                    bindEachChild(node);\n                    break;\n            }\n        }\n        function isNarrowingExpression(expr) {\n            switch (expr.kind) {\n                case 70:\n                case 98:\n                case 177:\n                    return isNarrowableReference(expr);\n                case 179:\n                    return hasNarrowableArgument(expr);\n                case 183:\n                    return isNarrowingExpression(expr.expression);\n                case 192:\n                    return isNarrowingBinaryExpression(expr);\n                case 190:\n                    return expr.operator === 50 && isNarrowingExpression(expr.operand);\n            }\n            return false;\n        }\n        function isNarrowableReference(expr) {\n            return expr.kind === 70 ||\n                expr.kind === 98 ||\n                expr.kind === 177 && isNarrowableReference(expr.expression);\n        }\n        function hasNarrowableArgument(expr) {\n            if (expr.arguments) {\n                for (var _i = 0, _a = expr.arguments; _i < _a.length; _i++) {\n                    var argument = _a[_i];\n                    if (isNarrowableReference(argument)) {\n                        return true;\n                    }\n                }\n            }\n            if (expr.expression.kind === 177 &&\n                isNarrowableReference(expr.expression.expression)) {\n                return true;\n            }\n            return false;\n        }\n        function isNarrowingTypeofOperands(expr1, expr2) {\n            return expr1.kind === 187 && isNarrowableOperand(expr1.expression) && expr2.kind === 9;\n        }\n        function isNarrowingBinaryExpression(expr) {\n            switch (expr.operatorToken.kind) {\n                case 57:\n                    return isNarrowableReference(expr.left);\n                case 31:\n                case 32:\n                case 33:\n                case 34:\n                    return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) ||\n                        isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);\n                case 92:\n                    return isNarrowableOperand(expr.left);\n                case 25:\n                    return isNarrowingExpression(expr.right);\n            }\n            return false;\n        }\n        function isNarrowableOperand(expr) {\n            switch (expr.kind) {\n                case 183:\n                    return isNarrowableOperand(expr.expression);\n                case 192:\n                    switch (expr.operatorToken.kind) {\n                        case 57:\n                            return isNarrowableOperand(expr.left);\n                        case 25:\n                            return isNarrowableOperand(expr.right);\n                    }\n            }\n            return isNarrowableReference(expr);\n        }\n        function createBranchLabel() {\n            return {\n                flags: 4,\n                antecedents: undefined\n            };\n        }\n        function createLoopLabel() {\n            return {\n                flags: 8,\n                antecedents: undefined\n            };\n        }\n        function setFlowNodeReferenced(flow) {\n            flow.flags |= flow.flags & 512 ? 1024 : 512;\n        }\n        function addAntecedent(label, antecedent) {\n            if (!(antecedent.flags & 1) && !ts.contains(label.antecedents, antecedent)) {\n                (label.antecedents || (label.antecedents = [])).push(antecedent);\n                setFlowNodeReferenced(antecedent);\n            }\n        }\n        function createFlowCondition(flags, antecedent, expression) {\n            if (antecedent.flags & 1) {\n                return antecedent;\n            }\n            if (!expression) {\n                return flags & 32 ? antecedent : unreachableFlow;\n            }\n            if (expression.kind === 100 && flags & 64 ||\n                expression.kind === 85 && flags & 32) {\n                return unreachableFlow;\n            }\n            if (!isNarrowingExpression(expression)) {\n                return antecedent;\n            }\n            setFlowNodeReferenced(antecedent);\n            return {\n                flags: flags,\n                expression: expression,\n                antecedent: antecedent\n            };\n        }\n        function createFlowSwitchClause(antecedent, switchStatement, clauseStart, clauseEnd) {\n            if (!isNarrowingExpression(switchStatement.expression)) {\n                return antecedent;\n            }\n            setFlowNodeReferenced(antecedent);\n            return {\n                flags: 128,\n                switchStatement: switchStatement,\n                clauseStart: clauseStart,\n                clauseEnd: clauseEnd,\n                antecedent: antecedent\n            };\n        }\n        function createFlowAssignment(antecedent, node) {\n            setFlowNodeReferenced(antecedent);\n            return {\n                flags: 16,\n                antecedent: antecedent,\n                node: node\n            };\n        }\n        function createFlowArrayMutation(antecedent, node) {\n            setFlowNodeReferenced(antecedent);\n            return {\n                flags: 256,\n                antecedent: antecedent,\n                node: node\n            };\n        }\n        function finishFlowLabel(flow) {\n            var antecedents = flow.antecedents;\n            if (!antecedents) {\n                return unreachableFlow;\n            }\n            if (antecedents.length === 1) {\n                return antecedents[0];\n            }\n            return flow;\n        }\n        function isStatementCondition(node) {\n            var parent = node.parent;\n            switch (parent.kind) {\n                case 208:\n                case 210:\n                case 209:\n                    return parent.expression === node;\n                case 211:\n                case 193:\n                    return parent.condition === node;\n            }\n            return false;\n        }\n        function isLogicalExpression(node) {\n            while (true) {\n                if (node.kind === 183) {\n                    node = node.expression;\n                }\n                else if (node.kind === 190 && node.operator === 50) {\n                    node = node.operand;\n                }\n                else {\n                    return node.kind === 192 && (node.operatorToken.kind === 52 ||\n                        node.operatorToken.kind === 53);\n                }\n            }\n        }\n        function isTopLevelLogicalExpression(node) {\n            while (node.parent.kind === 183 ||\n                node.parent.kind === 190 &&\n                    node.parent.operator === 50) {\n                node = node.parent;\n            }\n            return !isStatementCondition(node) && !isLogicalExpression(node.parent);\n        }\n        function bindCondition(node, trueTarget, falseTarget) {\n            var saveTrueTarget = currentTrueTarget;\n            var saveFalseTarget = currentFalseTarget;\n            currentTrueTarget = trueTarget;\n            currentFalseTarget = falseTarget;\n            bind(node);\n            currentTrueTarget = saveTrueTarget;\n            currentFalseTarget = saveFalseTarget;\n            if (!node || !isLogicalExpression(node)) {\n                addAntecedent(trueTarget, createFlowCondition(32, currentFlow, node));\n                addAntecedent(falseTarget, createFlowCondition(64, currentFlow, node));\n            }\n        }\n        function bindIterativeStatement(node, breakTarget, continueTarget) {\n            var saveBreakTarget = currentBreakTarget;\n            var saveContinueTarget = currentContinueTarget;\n            currentBreakTarget = breakTarget;\n            currentContinueTarget = continueTarget;\n            bind(node);\n            currentBreakTarget = saveBreakTarget;\n            currentContinueTarget = saveContinueTarget;\n        }\n        function bindWhileStatement(node) {\n            var preWhileLabel = createLoopLabel();\n            var preBodyLabel = createBranchLabel();\n            var postWhileLabel = createBranchLabel();\n            addAntecedent(preWhileLabel, currentFlow);\n            currentFlow = preWhileLabel;\n            bindCondition(node.expression, preBodyLabel, postWhileLabel);\n            currentFlow = finishFlowLabel(preBodyLabel);\n            bindIterativeStatement(node.statement, postWhileLabel, preWhileLabel);\n            addAntecedent(preWhileLabel, currentFlow);\n            currentFlow = finishFlowLabel(postWhileLabel);\n        }\n        function bindDoStatement(node) {\n            var preDoLabel = createLoopLabel();\n            var enclosingLabeledStatement = node.parent.kind === 219\n                ? ts.lastOrUndefined(activeLabels)\n                : undefined;\n            var preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel();\n            var postDoLabel = enclosingLabeledStatement ? enclosingLabeledStatement.breakTarget : createBranchLabel();\n            addAntecedent(preDoLabel, currentFlow);\n            currentFlow = preDoLabel;\n            bindIterativeStatement(node.statement, postDoLabel, preConditionLabel);\n            addAntecedent(preConditionLabel, currentFlow);\n            currentFlow = finishFlowLabel(preConditionLabel);\n            bindCondition(node.expression, preDoLabel, postDoLabel);\n            currentFlow = finishFlowLabel(postDoLabel);\n        }\n        function bindForStatement(node) {\n            var preLoopLabel = createLoopLabel();\n            var preBodyLabel = createBranchLabel();\n            var postLoopLabel = createBranchLabel();\n            bind(node.initializer);\n            addAntecedent(preLoopLabel, currentFlow);\n            currentFlow = preLoopLabel;\n            bindCondition(node.condition, preBodyLabel, postLoopLabel);\n            currentFlow = finishFlowLabel(preBodyLabel);\n            bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);\n            bind(node.incrementor);\n            addAntecedent(preLoopLabel, currentFlow);\n            currentFlow = finishFlowLabel(postLoopLabel);\n        }\n        function bindForInOrForOfStatement(node) {\n            var preLoopLabel = createLoopLabel();\n            var postLoopLabel = createBranchLabel();\n            addAntecedent(preLoopLabel, currentFlow);\n            currentFlow = preLoopLabel;\n            bind(node.expression);\n            addAntecedent(postLoopLabel, currentFlow);\n            bind(node.initializer);\n            if (node.initializer.kind !== 224) {\n                bindAssignmentTargetFlow(node.initializer);\n            }\n            bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);\n            addAntecedent(preLoopLabel, currentFlow);\n            currentFlow = finishFlowLabel(postLoopLabel);\n        }\n        function bindIfStatement(node) {\n            var thenLabel = createBranchLabel();\n            var elseLabel = createBranchLabel();\n            var postIfLabel = createBranchLabel();\n            bindCondition(node.expression, thenLabel, elseLabel);\n            currentFlow = finishFlowLabel(thenLabel);\n            bind(node.thenStatement);\n            addAntecedent(postIfLabel, currentFlow);\n            currentFlow = finishFlowLabel(elseLabel);\n            bind(node.elseStatement);\n            addAntecedent(postIfLabel, currentFlow);\n            currentFlow = finishFlowLabel(postIfLabel);\n        }\n        function bindReturnOrThrow(node) {\n            bind(node.expression);\n            if (node.kind === 216) {\n                hasExplicitReturn = true;\n                if (currentReturnTarget) {\n                    addAntecedent(currentReturnTarget, currentFlow);\n                }\n            }\n            currentFlow = unreachableFlow;\n        }\n        function findActiveLabel(name) {\n            if (activeLabels) {\n                for (var _i = 0, activeLabels_1 = activeLabels; _i < activeLabels_1.length; _i++) {\n                    var label = activeLabels_1[_i];\n                    if (label.name === name) {\n                        return label;\n                    }\n                }\n            }\n            return undefined;\n        }\n        function bindBreakOrContinueFlow(node, breakTarget, continueTarget) {\n            var flowLabel = node.kind === 215 ? breakTarget : continueTarget;\n            if (flowLabel) {\n                addAntecedent(flowLabel, currentFlow);\n                currentFlow = unreachableFlow;\n            }\n        }\n        function bindBreakOrContinueStatement(node) {\n            bind(node.label);\n            if (node.label) {\n                var activeLabel = findActiveLabel(node.label.text);\n                if (activeLabel) {\n                    activeLabel.referenced = true;\n                    bindBreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget);\n                }\n            }\n            else {\n                bindBreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget);\n            }\n        }\n        function bindTryStatement(node) {\n            var preFinallyLabel = createBranchLabel();\n            var preTryFlow = currentFlow;\n            bind(node.tryBlock);\n            addAntecedent(preFinallyLabel, currentFlow);\n            var flowAfterTry = currentFlow;\n            var flowAfterCatch = unreachableFlow;\n            if (node.catchClause) {\n                currentFlow = preTryFlow;\n                bind(node.catchClause);\n                addAntecedent(preFinallyLabel, currentFlow);\n                flowAfterCatch = currentFlow;\n            }\n            if (node.finallyBlock) {\n                addAntecedent(preFinallyLabel, preTryFlow);\n                currentFlow = finishFlowLabel(preFinallyLabel);\n                bind(node.finallyBlock);\n                if (!(currentFlow.flags & 1)) {\n                    if ((flowAfterTry.flags & 1) && (flowAfterCatch.flags & 1)) {\n                        currentFlow = flowAfterTry === reportedUnreachableFlow || flowAfterCatch === reportedUnreachableFlow\n                            ? reportedUnreachableFlow\n                            : unreachableFlow;\n                    }\n                }\n            }\n            else {\n                currentFlow = finishFlowLabel(preFinallyLabel);\n            }\n        }\n        function bindSwitchStatement(node) {\n            var postSwitchLabel = createBranchLabel();\n            bind(node.expression);\n            var saveBreakTarget = currentBreakTarget;\n            var savePreSwitchCaseFlow = preSwitchCaseFlow;\n            currentBreakTarget = postSwitchLabel;\n            preSwitchCaseFlow = currentFlow;\n            bind(node.caseBlock);\n            addAntecedent(postSwitchLabel, currentFlow);\n            var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 254; });\n            node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents;\n            if (!hasDefault) {\n                addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0));\n            }\n            currentBreakTarget = saveBreakTarget;\n            preSwitchCaseFlow = savePreSwitchCaseFlow;\n            currentFlow = finishFlowLabel(postSwitchLabel);\n        }\n        function bindCaseBlock(node) {\n            var savedSubtreeTransformFlags = subtreeTransformFlags;\n            subtreeTransformFlags = 0;\n            var clauses = node.clauses;\n            var fallthroughFlow = unreachableFlow;\n            for (var i = 0; i < clauses.length; i++) {\n                var clauseStart = i;\n                while (!clauses[i].statements.length && i + 1 < clauses.length) {\n                    bind(clauses[i]);\n                    i++;\n                }\n                var preCaseLabel = createBranchLabel();\n                addAntecedent(preCaseLabel, createFlowSwitchClause(preSwitchCaseFlow, node.parent, clauseStart, i + 1));\n                addAntecedent(preCaseLabel, fallthroughFlow);\n                currentFlow = finishFlowLabel(preCaseLabel);\n                var clause = clauses[i];\n                bind(clause);\n                fallthroughFlow = currentFlow;\n                if (!(currentFlow.flags & 1) && i !== clauses.length - 1 && options.noFallthroughCasesInSwitch) {\n                    errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch);\n                }\n            }\n            clauses.transformFlags = subtreeTransformFlags | 536870912;\n            subtreeTransformFlags |= savedSubtreeTransformFlags;\n        }\n        function bindCaseClause(node) {\n            var saveCurrentFlow = currentFlow;\n            currentFlow = preSwitchCaseFlow;\n            bind(node.expression);\n            currentFlow = saveCurrentFlow;\n            bindEach(node.statements);\n        }\n        function pushActiveLabel(name, breakTarget, continueTarget) {\n            var activeLabel = {\n                name: name,\n                breakTarget: breakTarget,\n                continueTarget: continueTarget,\n                referenced: false\n            };\n            (activeLabels || (activeLabels = [])).push(activeLabel);\n            return activeLabel;\n        }\n        function popActiveLabel() {\n            activeLabels.pop();\n        }\n        function bindLabeledStatement(node) {\n            var preStatementLabel = createLoopLabel();\n            var postStatementLabel = createBranchLabel();\n            bind(node.label);\n            addAntecedent(preStatementLabel, currentFlow);\n            var activeLabel = pushActiveLabel(node.label.text, postStatementLabel, preStatementLabel);\n            bind(node.statement);\n            popActiveLabel();\n            if (!activeLabel.referenced && !options.allowUnusedLabels) {\n                file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label));\n            }\n            if (!node.statement || node.statement.kind !== 209) {\n                addAntecedent(postStatementLabel, currentFlow);\n                currentFlow = finishFlowLabel(postStatementLabel);\n            }\n        }\n        function bindDestructuringTargetFlow(node) {\n            if (node.kind === 192 && node.operatorToken.kind === 57) {\n                bindAssignmentTargetFlow(node.left);\n            }\n            else {\n                bindAssignmentTargetFlow(node);\n            }\n        }\n        function bindAssignmentTargetFlow(node) {\n            if (isNarrowableReference(node)) {\n                currentFlow = createFlowAssignment(currentFlow, node);\n            }\n            else if (node.kind === 175) {\n                for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {\n                    var e = _a[_i];\n                    if (e.kind === 196) {\n                        bindAssignmentTargetFlow(e.expression);\n                    }\n                    else {\n                        bindDestructuringTargetFlow(e);\n                    }\n                }\n            }\n            else if (node.kind === 176) {\n                for (var _b = 0, _c = node.properties; _b < _c.length; _b++) {\n                    var p = _c[_b];\n                    if (p.kind === 257) {\n                        bindDestructuringTargetFlow(p.initializer);\n                    }\n                    else if (p.kind === 258) {\n                        bindAssignmentTargetFlow(p.name);\n                    }\n                    else if (p.kind === 259) {\n                        bindAssignmentTargetFlow(p.expression);\n                    }\n                }\n            }\n        }\n        function bindLogicalExpression(node, trueTarget, falseTarget) {\n            var preRightLabel = createBranchLabel();\n            if (node.operatorToken.kind === 52) {\n                bindCondition(node.left, preRightLabel, falseTarget);\n            }\n            else {\n                bindCondition(node.left, trueTarget, preRightLabel);\n            }\n            currentFlow = finishFlowLabel(preRightLabel);\n            bind(node.operatorToken);\n            bindCondition(node.right, trueTarget, falseTarget);\n        }\n        function bindPrefixUnaryExpressionFlow(node) {\n            if (node.operator === 50) {\n                var saveTrueTarget = currentTrueTarget;\n                currentTrueTarget = currentFalseTarget;\n                currentFalseTarget = saveTrueTarget;\n                bindEachChild(node);\n                currentFalseTarget = currentTrueTarget;\n                currentTrueTarget = saveTrueTarget;\n            }\n            else {\n                bindEachChild(node);\n                if (node.operator === 42 || node.operator === 43) {\n                    bindAssignmentTargetFlow(node.operand);\n                }\n            }\n        }\n        function bindPostfixUnaryExpressionFlow(node) {\n            bindEachChild(node);\n            if (node.operator === 42 || node.operator === 43) {\n                bindAssignmentTargetFlow(node.operand);\n            }\n        }\n        function bindBinaryExpressionFlow(node) {\n            var operator = node.operatorToken.kind;\n            if (operator === 52 || operator === 53) {\n                if (isTopLevelLogicalExpression(node)) {\n                    var postExpressionLabel = createBranchLabel();\n                    bindLogicalExpression(node, postExpressionLabel, postExpressionLabel);\n                    currentFlow = finishFlowLabel(postExpressionLabel);\n                }\n                else {\n                    bindLogicalExpression(node, currentTrueTarget, currentFalseTarget);\n                }\n            }\n            else {\n                bindEachChild(node);\n                if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) {\n                    bindAssignmentTargetFlow(node.left);\n                    if (operator === 57 && node.left.kind === 178) {\n                        var elementAccess = node.left;\n                        if (isNarrowableOperand(elementAccess.expression)) {\n                            currentFlow = createFlowArrayMutation(currentFlow, node);\n                        }\n                    }\n                }\n            }\n        }\n        function bindDeleteExpressionFlow(node) {\n            bindEachChild(node);\n            if (node.expression.kind === 177) {\n                bindAssignmentTargetFlow(node.expression);\n            }\n        }\n        function bindConditionalExpressionFlow(node) {\n            var trueLabel = createBranchLabel();\n            var falseLabel = createBranchLabel();\n            var postExpressionLabel = createBranchLabel();\n            bindCondition(node.condition, trueLabel, falseLabel);\n            currentFlow = finishFlowLabel(trueLabel);\n            bind(node.questionToken);\n            bind(node.whenTrue);\n            addAntecedent(postExpressionLabel, currentFlow);\n            currentFlow = finishFlowLabel(falseLabel);\n            bind(node.colonToken);\n            bind(node.whenFalse);\n            addAntecedent(postExpressionLabel, currentFlow);\n            currentFlow = finishFlowLabel(postExpressionLabel);\n        }\n        function bindInitializedVariableFlow(node) {\n            var name = !ts.isOmittedExpression(node) ? node.name : undefined;\n            if (ts.isBindingPattern(name)) {\n                for (var _i = 0, _a = name.elements; _i < _a.length; _i++) {\n                    var child = _a[_i];\n                    bindInitializedVariableFlow(child);\n                }\n            }\n            else {\n                currentFlow = createFlowAssignment(currentFlow, node);\n            }\n        }\n        function bindVariableDeclarationFlow(node) {\n            bindEachChild(node);\n            if (node.initializer || node.parent.parent.kind === 212 || node.parent.parent.kind === 213) {\n                bindInitializedVariableFlow(node);\n            }\n        }\n        function bindCallExpressionFlow(node) {\n            var expr = node.expression;\n            while (expr.kind === 183) {\n                expr = expr.expression;\n            }\n            if (expr.kind === 184 || expr.kind === 185) {\n                bindEach(node.typeArguments);\n                bindEach(node.arguments);\n                bind(node.expression);\n            }\n            else {\n                bindEachChild(node);\n            }\n            if (node.expression.kind === 177) {\n                var propertyAccess = node.expression;\n                if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) {\n                    currentFlow = createFlowArrayMutation(currentFlow, node);\n                }\n            }\n        }\n        function getContainerFlags(node) {\n            switch (node.kind) {\n                case 197:\n                case 226:\n                case 229:\n                case 176:\n                case 161:\n                case 287:\n                case 270:\n                    return 1;\n                case 227:\n                    return 1 | 64;\n                case 274:\n                case 230:\n                case 228:\n                case 170:\n                    return 1 | 32;\n                case 261:\n                    return 1 | 4 | 32;\n                case 149:\n                    if (ts.isObjectLiteralOrClassExpressionMethod(node)) {\n                        return 1 | 4 | 32 | 8 | 128;\n                    }\n                case 150:\n                case 225:\n                case 148:\n                case 151:\n                case 152:\n                case 153:\n                case 154:\n                case 155:\n                case 158:\n                case 159:\n                    return 1 | 4 | 32 | 8;\n                case 184:\n                case 185:\n                    return 1 | 4 | 32 | 8 | 16;\n                case 231:\n                    return 4;\n                case 147:\n                    return node.initializer ? 4 : 0;\n                case 256:\n                case 211:\n                case 212:\n                case 213:\n                case 232:\n                    return 2;\n                case 204:\n                    return ts.isFunctionLike(node.parent) ? 0 : 2;\n            }\n            return 0;\n        }\n        function addToContainerChain(next) {\n            if (lastContainer) {\n                lastContainer.nextContainer = next;\n            }\n            lastContainer = next;\n        }\n        function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) {\n            return declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes);\n        }\n        function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) {\n            switch (container.kind) {\n                case 230:\n                    return declareModuleMember(node, symbolFlags, symbolExcludes);\n                case 261:\n                    return declareSourceFileMember(node, symbolFlags, symbolExcludes);\n                case 197:\n                case 226:\n                    return declareClassMember(node, symbolFlags, symbolExcludes);\n                case 229:\n                    return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);\n                case 161:\n                case 176:\n                case 227:\n                case 270:\n                case 287:\n                    return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);\n                case 158:\n                case 159:\n                case 153:\n                case 154:\n                case 155:\n                case 149:\n                case 148:\n                case 150:\n                case 151:\n                case 152:\n                case 225:\n                case 184:\n                case 185:\n                case 274:\n                case 228:\n                case 170:\n                    return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);\n            }\n        }\n        function declareClassMember(node, symbolFlags, symbolExcludes) {\n            return ts.hasModifier(node, 32)\n                ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes)\n                : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);\n        }\n        function declareSourceFileMember(node, symbolFlags, symbolExcludes) {\n            return ts.isExternalModule(file)\n                ? declareModuleMember(node, symbolFlags, symbolExcludes)\n                : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes);\n        }\n        function hasExportDeclarations(node) {\n            var body = node.kind === 261 ? node : node.body;\n            if (body && (body.kind === 261 || body.kind === 231)) {\n                for (var _i = 0, _a = body.statements; _i < _a.length; _i++) {\n                    var stat = _a[_i];\n                    if (stat.kind === 241 || stat.kind === 240) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function setExportContextFlag(node) {\n            if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) {\n                node.flags |= 32;\n            }\n            else {\n                node.flags &= ~32;\n            }\n        }\n        function bindModuleDeclaration(node) {\n            setExportContextFlag(node);\n            if (ts.isAmbientModule(node)) {\n                if (ts.hasModifier(node, 1)) {\n                    errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible);\n                }\n                if (ts.isExternalModuleAugmentation(node)) {\n                    declareSymbolAndAddToSymbolTable(node, 1024, 0);\n                }\n                else {\n                    var pattern = void 0;\n                    if (node.name.kind === 9) {\n                        var text = node.name.text;\n                        if (ts.hasZeroOrOneAsteriskCharacter(text)) {\n                            pattern = ts.tryParsePattern(text);\n                        }\n                        else {\n                            errorOnFirstToken(node.name, ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, text);\n                        }\n                    }\n                    var symbol = declareSymbolAndAddToSymbolTable(node, 512, 106639);\n                    if (pattern) {\n                        (file.patternAmbientModules || (file.patternAmbientModules = [])).push({ pattern: pattern, symbol: symbol });\n                    }\n                }\n            }\n            else {\n                var state = getModuleInstanceState(node);\n                if (state === 0) {\n                    declareSymbolAndAddToSymbolTable(node, 1024, 0);\n                }\n                else {\n                    declareSymbolAndAddToSymbolTable(node, 512, 106639);\n                    if (node.symbol.flags & (16 | 32 | 256)) {\n                        node.symbol.constEnumOnlyModule = false;\n                    }\n                    else {\n                        var currentModuleIsConstEnumOnly = state === 2;\n                        if (node.symbol.constEnumOnlyModule === undefined) {\n                            node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly;\n                        }\n                        else {\n                            node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly;\n                        }\n                    }\n                }\n            }\n        }\n        function bindFunctionOrConstructorType(node) {\n            var symbol = createSymbol(131072, getDeclarationName(node));\n            addDeclarationToSymbol(symbol, node, 131072);\n            var typeLiteralSymbol = createSymbol(2048, \"__type\");\n            addDeclarationToSymbol(typeLiteralSymbol, node, 2048);\n            typeLiteralSymbol.members = ts.createMap();\n            typeLiteralSymbol.members[symbol.name] = symbol;\n        }\n        function bindObjectLiteralExpression(node) {\n            if (inStrictMode) {\n                var seen = ts.createMap();\n                for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {\n                    var prop = _a[_i];\n                    if (prop.kind === 259 || prop.name.kind !== 70) {\n                        continue;\n                    }\n                    var identifier = prop.name;\n                    var currentKind = prop.kind === 257 || prop.kind === 258 || prop.kind === 149\n                        ? 1\n                        : 2;\n                    var existingKind = seen[identifier.text];\n                    if (!existingKind) {\n                        seen[identifier.text] = currentKind;\n                        continue;\n                    }\n                    if (currentKind === 1 && existingKind === 1) {\n                        var span_1 = ts.getErrorSpanForNode(file, identifier);\n                        file.bindDiagnostics.push(ts.createFileDiagnostic(file, span_1.start, span_1.length, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode));\n                    }\n                }\n            }\n            return bindAnonymousDeclaration(node, 4096, \"__object\");\n        }\n        function bindAnonymousDeclaration(node, symbolFlags, name) {\n            var symbol = createSymbol(symbolFlags, name);\n            addDeclarationToSymbol(symbol, node, symbolFlags);\n        }\n        function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) {\n            switch (blockScopeContainer.kind) {\n                case 230:\n                    declareModuleMember(node, symbolFlags, symbolExcludes);\n                    break;\n                case 261:\n                    if (ts.isExternalModule(container)) {\n                        declareModuleMember(node, symbolFlags, symbolExcludes);\n                        break;\n                    }\n                default:\n                    if (!blockScopeContainer.locals) {\n                        blockScopeContainer.locals = ts.createMap();\n                        addToContainerChain(blockScopeContainer);\n                    }\n                    declareSymbol(blockScopeContainer.locals, undefined, node, symbolFlags, symbolExcludes);\n            }\n        }\n        function bindBlockScopedVariableDeclaration(node) {\n            bindBlockScopedDeclaration(node, 2, 107455);\n        }\n        function checkStrictModeIdentifier(node) {\n            if (inStrictMode &&\n                node.originalKeywordKind >= 107 &&\n                node.originalKeywordKind <= 115 &&\n                !ts.isIdentifierName(node) &&\n                !ts.isInAmbientContext(node)) {\n                if (!file.parseDiagnostics.length) {\n                    file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node)));\n                }\n            }\n        }\n        function getStrictModeIdentifierMessage(node) {\n            if (ts.getContainingClass(node)) {\n                return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode;\n            }\n            if (file.externalModuleIndicator) {\n                return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode;\n            }\n            return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode;\n        }\n        function checkStrictModeBinaryExpression(node) {\n            if (inStrictMode && ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind)) {\n                checkStrictModeEvalOrArguments(node, node.left);\n            }\n        }\n        function checkStrictModeCatchClause(node) {\n            if (inStrictMode && node.variableDeclaration) {\n                checkStrictModeEvalOrArguments(node, node.variableDeclaration.name);\n            }\n        }\n        function checkStrictModeDeleteExpression(node) {\n            if (inStrictMode && node.expression.kind === 70) {\n                var span_2 = ts.getErrorSpanForNode(file, node.expression);\n                file.bindDiagnostics.push(ts.createFileDiagnostic(file, span_2.start, span_2.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode));\n            }\n        }\n        function isEvalOrArgumentsIdentifier(node) {\n            return node.kind === 70 &&\n                (node.text === \"eval\" || node.text === \"arguments\");\n        }\n        function checkStrictModeEvalOrArguments(contextNode, name) {\n            if (name && name.kind === 70) {\n                var identifier = name;\n                if (isEvalOrArgumentsIdentifier(identifier)) {\n                    var span_3 = ts.getErrorSpanForNode(file, name);\n                    file.bindDiagnostics.push(ts.createFileDiagnostic(file, span_3.start, span_3.length, getStrictModeEvalOrArgumentsMessage(contextNode), identifier.text));\n                }\n            }\n        }\n        function getStrictModeEvalOrArgumentsMessage(node) {\n            if (ts.getContainingClass(node)) {\n                return ts.Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode;\n            }\n            if (file.externalModuleIndicator) {\n                return ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode;\n            }\n            return ts.Diagnostics.Invalid_use_of_0_in_strict_mode;\n        }\n        function checkStrictModeFunctionName(node) {\n            if (inStrictMode) {\n                checkStrictModeEvalOrArguments(node, node.name);\n            }\n        }\n        function getStrictModeBlockScopeFunctionDeclarationMessage(node) {\n            if (ts.getContainingClass(node)) {\n                return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode;\n            }\n            if (file.externalModuleIndicator) {\n                return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode;\n            }\n            return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5;\n        }\n        function checkStrictModeFunctionDeclaration(node) {\n            if (languageVersion < 2) {\n                if (blockScopeContainer.kind !== 261 &&\n                    blockScopeContainer.kind !== 230 &&\n                    !ts.isFunctionLike(blockScopeContainer)) {\n                    var errorSpan = ts.getErrorSpanForNode(file, node);\n                    file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node)));\n                }\n            }\n        }\n        function checkStrictModeNumericLiteral(node) {\n            if (inStrictMode && node.isOctalLiteral) {\n                file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode));\n            }\n        }\n        function checkStrictModePostfixUnaryExpression(node) {\n            if (inStrictMode) {\n                checkStrictModeEvalOrArguments(node, node.operand);\n            }\n        }\n        function checkStrictModePrefixUnaryExpression(node) {\n            if (inStrictMode) {\n                if (node.operator === 42 || node.operator === 43) {\n                    checkStrictModeEvalOrArguments(node, node.operand);\n                }\n            }\n        }\n        function checkStrictModeWithStatement(node) {\n            if (inStrictMode) {\n                errorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode);\n            }\n        }\n        function errorOnFirstToken(node, message, arg0, arg1, arg2) {\n            var span = ts.getSpanOfTokenAtPosition(file, node.pos);\n            file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2));\n        }\n        function getDestructuringParameterName(node) {\n            return \"__\" + ts.indexOf(node.parent.parameters, node);\n        }\n        function bind(node) {\n            if (!node) {\n                return;\n            }\n            node.parent = parent;\n            var saveInStrictMode = inStrictMode;\n            bindWorker(node);\n            if (node.kind > 140) {\n                var saveParent = parent;\n                parent = node;\n                var containerFlags = getContainerFlags(node);\n                if (containerFlags === 0) {\n                    bindChildren(node);\n                }\n                else {\n                    bindContainer(node, containerFlags);\n                }\n                parent = saveParent;\n            }\n            else if (!skipTransformFlagAggregation && (node.transformFlags & 536870912) === 0) {\n                subtreeTransformFlags |= computeTransformFlagsForNode(node, 0);\n            }\n            inStrictMode = saveInStrictMode;\n        }\n        function updateStrictModeStatementList(statements) {\n            if (!inStrictMode) {\n                for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {\n                    var statement = statements_2[_i];\n                    if (!ts.isPrologueDirective(statement)) {\n                        return;\n                    }\n                    if (isUseStrictPrologueDirective(statement)) {\n                        inStrictMode = true;\n                        return;\n                    }\n                }\n            }\n        }\n        function isUseStrictPrologueDirective(node) {\n            var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression);\n            return nodeText === '\"use strict\"' || nodeText === \"'use strict'\";\n        }\n        function bindWorker(node) {\n            switch (node.kind) {\n                case 70:\n                    if (node.isInJSDocNamespace) {\n                        var parentNode = node.parent;\n                        while (parentNode && parentNode.kind !== 285) {\n                            parentNode = parentNode.parent;\n                        }\n                        bindBlockScopedDeclaration(parentNode, 524288, 793064);\n                        break;\n                    }\n                case 98:\n                    if (currentFlow && (ts.isExpression(node) || parent.kind === 258)) {\n                        node.flowNode = currentFlow;\n                    }\n                    return checkStrictModeIdentifier(node);\n                case 177:\n                    if (currentFlow && isNarrowableReference(node)) {\n                        node.flowNode = currentFlow;\n                    }\n                    break;\n                case 192:\n                    if (ts.isInJavaScriptFile(node)) {\n                        var specialKind = ts.getSpecialPropertyAssignmentKind(node);\n                        switch (specialKind) {\n                            case 1:\n                                bindExportsPropertyAssignment(node);\n                                break;\n                            case 2:\n                                bindModuleExportsAssignment(node);\n                                break;\n                            case 3:\n                                bindPrototypePropertyAssignment(node);\n                                break;\n                            case 4:\n                                bindThisPropertyAssignment(node);\n                                break;\n                            case 0:\n                                break;\n                            default:\n                                ts.Debug.fail(\"Unknown special property assignment kind\");\n                        }\n                    }\n                    return checkStrictModeBinaryExpression(node);\n                case 256:\n                    return checkStrictModeCatchClause(node);\n                case 186:\n                    return checkStrictModeDeleteExpression(node);\n                case 8:\n                    return checkStrictModeNumericLiteral(node);\n                case 191:\n                    return checkStrictModePostfixUnaryExpression(node);\n                case 190:\n                    return checkStrictModePrefixUnaryExpression(node);\n                case 217:\n                    return checkStrictModeWithStatement(node);\n                case 167:\n                    seenThisKeyword = true;\n                    return;\n                case 156:\n                    return checkTypePredicate(node);\n                case 143:\n                    return declareSymbolAndAddToSymbolTable(node, 262144, 530920);\n                case 144:\n                    return bindParameter(node);\n                case 223:\n                case 174:\n                    return bindVariableDeclarationOrBindingElement(node);\n                case 147:\n                case 146:\n                case 271:\n                    return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0);\n                case 286:\n                    return bindJSDocProperty(node);\n                case 257:\n                case 258:\n                    return bindPropertyOrMethodOrAccessor(node, 4, 0);\n                case 260:\n                    return bindPropertyOrMethodOrAccessor(node, 8, 900095);\n                case 259:\n                case 251:\n                    var root = container;\n                    var hasRest = false;\n                    while (root.parent) {\n                        if (root.kind === 176 &&\n                            root.parent.kind === 192 &&\n                            root.parent.operatorToken.kind === 57 &&\n                            root.parent.left === root) {\n                            hasRest = true;\n                            break;\n                        }\n                        root = root.parent;\n                    }\n                    return;\n                case 153:\n                case 154:\n                case 155:\n                    return declareSymbolAndAddToSymbolTable(node, 131072, 0);\n                case 149:\n                case 148:\n                    return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263);\n                case 225:\n                    return bindFunctionDeclaration(node);\n                case 150:\n                    return declareSymbolAndAddToSymbolTable(node, 16384, 0);\n                case 151:\n                    return bindPropertyOrMethodOrAccessor(node, 32768, 41919);\n                case 152:\n                    return bindPropertyOrMethodOrAccessor(node, 65536, 74687);\n                case 158:\n                case 159:\n                case 274:\n                    return bindFunctionOrConstructorType(node);\n                case 161:\n                case 170:\n                case 287:\n                case 270:\n                    return bindAnonymousDeclaration(node, 2048, \"__type\");\n                case 176:\n                    return bindObjectLiteralExpression(node);\n                case 184:\n                case 185:\n                    return bindFunctionExpression(node);\n                case 179:\n                    if (ts.isInJavaScriptFile(node)) {\n                        bindCallExpression(node);\n                    }\n                    break;\n                case 197:\n                case 226:\n                    inStrictMode = true;\n                    return bindClassLikeDeclaration(node);\n                case 227:\n                    return bindBlockScopedDeclaration(node, 64, 792968);\n                case 285:\n                    if (!node.fullName || node.fullName.kind === 70) {\n                        return bindBlockScopedDeclaration(node, 524288, 793064);\n                    }\n                    break;\n                case 228:\n                    return bindBlockScopedDeclaration(node, 524288, 793064);\n                case 229:\n                    return bindEnumDeclaration(node);\n                case 230:\n                    return bindModuleDeclaration(node);\n                case 234:\n                case 237:\n                case 239:\n                case 243:\n                    return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608);\n                case 233:\n                    return bindNamespaceExportDeclaration(node);\n                case 236:\n                    return bindImportClause(node);\n                case 241:\n                    return bindExportDeclaration(node);\n                case 240:\n                    return bindExportAssignment(node);\n                case 261:\n                    updateStrictModeStatementList(node.statements);\n                    return bindSourceFileIfExternalModule();\n                case 204:\n                    if (!ts.isFunctionLike(node.parent)) {\n                        return;\n                    }\n                case 231:\n                    return updateStrictModeStatementList(node.statements);\n            }\n        }\n        function checkTypePredicate(node) {\n            var parameterName = node.parameterName, type = node.type;\n            if (parameterName && parameterName.kind === 70) {\n                checkStrictModeIdentifier(parameterName);\n            }\n            if (parameterName && parameterName.kind === 167) {\n                seenThisKeyword = true;\n            }\n            bind(type);\n        }\n        function bindSourceFileIfExternalModule() {\n            setExportContextFlag(file);\n            if (ts.isExternalModule(file)) {\n                bindSourceFileAsExternalModule();\n            }\n        }\n        function bindSourceFileAsExternalModule() {\n            bindAnonymousDeclaration(file, 512, \"\\\"\" + ts.removeFileExtension(file.fileName) + \"\\\"\");\n        }\n        function bindExportAssignment(node) {\n            if (!container.symbol || !container.symbol.exports) {\n                bindAnonymousDeclaration(node, 8388608, getDeclarationName(node));\n            }\n            else {\n                var flags = node.kind === 240 && ts.exportAssignmentIsAlias(node)\n                    ? 8388608\n                    : 4;\n                declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 | 8388608 | 32 | 16);\n            }\n        }\n        function bindNamespaceExportDeclaration(node) {\n            if (node.modifiers && node.modifiers.length) {\n                file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here));\n            }\n            if (node.parent.kind !== 261) {\n                file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level));\n                return;\n            }\n            else {\n                var parent_4 = node.parent;\n                if (!ts.isExternalModule(parent_4)) {\n                    file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files));\n                    return;\n                }\n                if (!parent_4.isDeclarationFile) {\n                    file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files));\n                    return;\n                }\n            }\n            file.symbol.globalExports = file.symbol.globalExports || ts.createMap();\n            declareSymbol(file.symbol.globalExports, file.symbol, node, 8388608, 8388608);\n        }\n        function bindExportDeclaration(node) {\n            if (!container.symbol || !container.symbol.exports) {\n                bindAnonymousDeclaration(node, 1073741824, getDeclarationName(node));\n            }\n            else if (!node.exportClause) {\n                declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0);\n            }\n        }\n        function bindImportClause(node) {\n            if (node.name) {\n                declareSymbolAndAddToSymbolTable(node, 8388608, 8388608);\n            }\n        }\n        function setCommonJsModuleIndicator(node) {\n            if (!file.commonJsModuleIndicator) {\n                file.commonJsModuleIndicator = node;\n                if (!file.externalModuleIndicator) {\n                    bindSourceFileAsExternalModule();\n                }\n            }\n        }\n        function bindExportsPropertyAssignment(node) {\n            setCommonJsModuleIndicator(node);\n            declareSymbol(file.symbol.exports, file.symbol, node.left, 4 | 7340032, 0);\n        }\n        function bindModuleExportsAssignment(node) {\n            setCommonJsModuleIndicator(node);\n            declareSymbol(file.symbol.exports, file.symbol, node, 4 | 7340032 | 512, 0);\n        }\n        function bindThisPropertyAssignment(node) {\n            ts.Debug.assert(ts.isInJavaScriptFile(node));\n            if (container.kind === 225 || container.kind === 184) {\n                container.symbol.members = container.symbol.members || ts.createMap();\n                declareSymbol(container.symbol.members, container.symbol, node, 4, 0 & ~4);\n            }\n            else if (container.kind === 150) {\n                var saveContainer = container;\n                container = container.parent;\n                var symbol = bindPropertyOrMethodOrAccessor(node, 4, 0);\n                if (symbol) {\n                    symbol.isReplaceableByMethod = true;\n                }\n                container = saveContainer;\n            }\n        }\n        function bindPrototypePropertyAssignment(node) {\n            var leftSideOfAssignment = node.left;\n            var classPrototype = leftSideOfAssignment.expression;\n            var constructorFunction = classPrototype.expression;\n            leftSideOfAssignment.parent = node;\n            constructorFunction.parent = classPrototype;\n            classPrototype.parent = leftSideOfAssignment;\n            var funcSymbol = container.locals[constructorFunction.text];\n            if (!funcSymbol || !(funcSymbol.flags & 16 || ts.isDeclarationOfFunctionExpression(funcSymbol))) {\n                return;\n            }\n            if (!funcSymbol.members) {\n                funcSymbol.members = ts.createMap();\n            }\n            declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, 4, 0);\n        }\n        function bindCallExpression(node) {\n            if (!file.commonJsModuleIndicator && ts.isRequireCall(node, false)) {\n                setCommonJsModuleIndicator(node);\n            }\n        }\n        function bindClassLikeDeclaration(node) {\n            if (node.kind === 226) {\n                bindBlockScopedDeclaration(node, 32, 899519);\n            }\n            else {\n                var bindingName = node.name ? node.name.text : \"__class\";\n                bindAnonymousDeclaration(node, 32, bindingName);\n                if (node.name) {\n                    classifiableNames[node.name.text] = node.name.text;\n                }\n            }\n            var symbol = node.symbol;\n            var prototypeSymbol = createSymbol(4 | 134217728, \"prototype\");\n            if (symbol.exports[prototypeSymbol.name]) {\n                if (node.name) {\n                    node.name.parent = node;\n                }\n                file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name));\n            }\n            symbol.exports[prototypeSymbol.name] = prototypeSymbol;\n            prototypeSymbol.parent = symbol;\n        }\n        function bindEnumDeclaration(node) {\n            return ts.isConst(node)\n                ? bindBlockScopedDeclaration(node, 128, 899967)\n                : bindBlockScopedDeclaration(node, 256, 899327);\n        }\n        function bindVariableDeclarationOrBindingElement(node) {\n            if (inStrictMode) {\n                checkStrictModeEvalOrArguments(node, node.name);\n            }\n            if (!ts.isBindingPattern(node.name)) {\n                if (ts.isBlockOrCatchScoped(node)) {\n                    bindBlockScopedVariableDeclaration(node);\n                }\n                else if (ts.isParameterDeclaration(node)) {\n                    declareSymbolAndAddToSymbolTable(node, 1, 107455);\n                }\n                else {\n                    declareSymbolAndAddToSymbolTable(node, 1, 107454);\n                }\n            }\n        }\n        function bindParameter(node) {\n            if (inStrictMode) {\n                checkStrictModeEvalOrArguments(node, node.name);\n            }\n            if (ts.isBindingPattern(node.name)) {\n                bindAnonymousDeclaration(node, 1, getDestructuringParameterName(node));\n            }\n            else {\n                declareSymbolAndAddToSymbolTable(node, 1, 107455);\n            }\n            if (ts.isParameterPropertyDeclaration(node)) {\n                var classDeclaration = node.parent.parent;\n                declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 | (node.questionToken ? 536870912 : 0), 0);\n            }\n        }\n        function bindFunctionDeclaration(node) {\n            if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) {\n                if (ts.isAsyncFunctionLike(node)) {\n                    emitFlags |= 1024;\n                }\n            }\n            checkStrictModeFunctionName(node);\n            if (inStrictMode) {\n                checkStrictModeFunctionDeclaration(node);\n                bindBlockScopedDeclaration(node, 16, 106927);\n            }\n            else {\n                declareSymbolAndAddToSymbolTable(node, 16, 106927);\n            }\n        }\n        function bindFunctionExpression(node) {\n            if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) {\n                if (ts.isAsyncFunctionLike(node)) {\n                    emitFlags |= 1024;\n                }\n            }\n            if (currentFlow) {\n                node.flowNode = currentFlow;\n            }\n            checkStrictModeFunctionName(node);\n            var bindingName = node.name ? node.name.text : \"__function\";\n            return bindAnonymousDeclaration(node, 16, bindingName);\n        }\n        function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) {\n            if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) {\n                if (ts.isAsyncFunctionLike(node)) {\n                    emitFlags |= 1024;\n                }\n            }\n            if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) {\n                node.flowNode = currentFlow;\n            }\n            return ts.hasDynamicName(node)\n                ? bindAnonymousDeclaration(node, symbolFlags, \"__computed\")\n                : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes);\n        }\n        function bindJSDocProperty(node) {\n            return declareSymbolAndAddToSymbolTable(node, 4, 0);\n        }\n        function shouldReportErrorOnModuleDeclaration(node) {\n            var instanceState = getModuleInstanceState(node);\n            return instanceState === 1 || (instanceState === 2 && options.preserveConstEnums);\n        }\n        function checkUnreachable(node) {\n            if (!(currentFlow.flags & 1)) {\n                return false;\n            }\n            if (currentFlow === unreachableFlow) {\n                var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 206) ||\n                    node.kind === 226 ||\n                    (node.kind === 230 && shouldReportErrorOnModuleDeclaration(node)) ||\n                    (node.kind === 229 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums));\n                if (reportError) {\n                    currentFlow = reportedUnreachableFlow;\n                    var reportUnreachableCode = !options.allowUnreachableCode &&\n                        !ts.isInAmbientContext(node) &&\n                        (node.kind !== 205 ||\n                            ts.getCombinedNodeFlags(node.declarationList) & 3 ||\n                            ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; }));\n                    if (reportUnreachableCode) {\n                        errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected);\n                    }\n                }\n            }\n            return true;\n        }\n    }\n    function computeTransformFlagsForNode(node, subtreeFlags) {\n        var kind = node.kind;\n        switch (kind) {\n            case 179:\n                return computeCallExpression(node, subtreeFlags);\n            case 180:\n                return computeNewExpression(node, subtreeFlags);\n            case 230:\n                return computeModuleDeclaration(node, subtreeFlags);\n            case 183:\n                return computeParenthesizedExpression(node, subtreeFlags);\n            case 192:\n                return computeBinaryExpression(node, subtreeFlags);\n            case 207:\n                return computeExpressionStatement(node, subtreeFlags);\n            case 144:\n                return computeParameter(node, subtreeFlags);\n            case 185:\n                return computeArrowFunction(node, subtreeFlags);\n            case 184:\n                return computeFunctionExpression(node, subtreeFlags);\n            case 225:\n                return computeFunctionDeclaration(node, subtreeFlags);\n            case 223:\n                return computeVariableDeclaration(node, subtreeFlags);\n            case 224:\n                return computeVariableDeclarationList(node, subtreeFlags);\n            case 205:\n                return computeVariableStatement(node, subtreeFlags);\n            case 219:\n                return computeLabeledStatement(node, subtreeFlags);\n            case 226:\n                return computeClassDeclaration(node, subtreeFlags);\n            case 197:\n                return computeClassExpression(node, subtreeFlags);\n            case 255:\n                return computeHeritageClause(node, subtreeFlags);\n            case 256:\n                return computeCatchClause(node, subtreeFlags);\n            case 199:\n                return computeExpressionWithTypeArguments(node, subtreeFlags);\n            case 150:\n                return computeConstructor(node, subtreeFlags);\n            case 147:\n                return computePropertyDeclaration(node, subtreeFlags);\n            case 149:\n                return computeMethod(node, subtreeFlags);\n            case 151:\n            case 152:\n                return computeAccessor(node, subtreeFlags);\n            case 234:\n                return computeImportEquals(node, subtreeFlags);\n            case 177:\n                return computePropertyAccess(node, subtreeFlags);\n            default:\n                return computeOther(node, kind, subtreeFlags);\n        }\n    }\n    ts.computeTransformFlagsForNode = computeTransformFlagsForNode;\n    function computeCallExpression(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        var expression = node.expression;\n        var expressionKind = expression.kind;\n        if (node.typeArguments) {\n            transformFlags |= 3;\n        }\n        if (subtreeFlags & 524288\n            || isSuperOrSuperProperty(expression, expressionKind)) {\n            transformFlags |= 192;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~537396545;\n    }\n    function isSuperOrSuperProperty(node, kind) {\n        switch (kind) {\n            case 96:\n                return true;\n            case 177:\n            case 178:\n                var expression = node.expression;\n                var expressionKind = expression.kind;\n                return expressionKind === 96;\n        }\n        return false;\n    }\n    function computeNewExpression(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (node.typeArguments) {\n            transformFlags |= 3;\n        }\n        if (subtreeFlags & 524288) {\n            transformFlags |= 192;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~537396545;\n    }\n    function computeBinaryExpression(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        var operatorTokenKind = node.operatorToken.kind;\n        var leftKind = node.left.kind;\n        if (operatorTokenKind === 57 && leftKind === 176) {\n            transformFlags |= 8 | 192 | 3072;\n        }\n        else if (operatorTokenKind === 57 && leftKind === 175) {\n            transformFlags |= 192 | 3072;\n        }\n        else if (operatorTokenKind === 39\n            || operatorTokenKind === 61) {\n            transformFlags |= 32;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeParameter(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        var modifierFlags = ts.getModifierFlags(node);\n        var name = node.name;\n        var initializer = node.initializer;\n        var dotDotDotToken = node.dotDotDotToken;\n        if (node.questionToken\n            || node.type\n            || subtreeFlags & 4096\n            || ts.isThisIdentifier(name)) {\n            transformFlags |= 3;\n        }\n        if (modifierFlags & 92) {\n            transformFlags |= 3 | 262144;\n        }\n        if (subtreeFlags & 1048576) {\n            transformFlags |= 8;\n        }\n        if (subtreeFlags & 8388608 || initializer || dotDotDotToken) {\n            transformFlags |= 192 | 131072;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeParenthesizedExpression(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        var expression = node.expression;\n        var expressionKind = expression.kind;\n        var expressionTransformFlags = expression.transformFlags;\n        if (expressionKind === 200\n            || expressionKind === 182) {\n            transformFlags |= 3;\n        }\n        if (expressionTransformFlags & 1024) {\n            transformFlags |= 1024;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeClassDeclaration(node, subtreeFlags) {\n        var transformFlags;\n        var modifierFlags = ts.getModifierFlags(node);\n        if (modifierFlags & 2) {\n            transformFlags = 3;\n        }\n        else {\n            transformFlags = subtreeFlags | 192;\n            if ((subtreeFlags & 274432)\n                || node.typeParameters) {\n                transformFlags |= 3;\n            }\n            if (subtreeFlags & 65536) {\n                transformFlags |= 16384;\n            }\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~539358529;\n    }\n    function computeClassExpression(node, subtreeFlags) {\n        var transformFlags = subtreeFlags | 192;\n        if (subtreeFlags & 274432\n            || node.typeParameters) {\n            transformFlags |= 3;\n        }\n        if (subtreeFlags & 65536) {\n            transformFlags |= 16384;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~539358529;\n    }\n    function computeHeritageClause(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        switch (node.token) {\n            case 84:\n                transformFlags |= 192;\n                break;\n            case 107:\n                transformFlags |= 3;\n                break;\n            default:\n                ts.Debug.fail(\"Unexpected token for heritage clause\");\n                break;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeCatchClause(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (node.variableDeclaration && ts.isBindingPattern(node.variableDeclaration.name)) {\n            transformFlags |= 192;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~537920833;\n    }\n    function computeExpressionWithTypeArguments(node, subtreeFlags) {\n        var transformFlags = subtreeFlags | 192;\n        if (node.typeArguments) {\n            transformFlags |= 3;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeConstructor(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (ts.hasModifier(node, 2270)\n            || !node.body) {\n            transformFlags |= 3;\n        }\n        if (subtreeFlags & 1048576) {\n            transformFlags |= 8;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~601015617;\n    }\n    function computeMethod(node, subtreeFlags) {\n        var transformFlags = subtreeFlags | 192;\n        if (node.decorators\n            || ts.hasModifier(node, 2270)\n            || node.typeParameters\n            || node.type\n            || !node.body) {\n            transformFlags |= 3;\n        }\n        if (subtreeFlags & 1048576) {\n            transformFlags |= 8;\n        }\n        if (ts.hasModifier(node, 256)) {\n            transformFlags |= 16;\n        }\n        if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {\n            transformFlags |= 768;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~601015617;\n    }\n    function computeAccessor(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (node.decorators\n            || ts.hasModifier(node, 2270)\n            || node.type\n            || !node.body) {\n            transformFlags |= 3;\n        }\n        if (subtreeFlags & 1048576) {\n            transformFlags |= 8;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~601015617;\n    }\n    function computePropertyDeclaration(node, subtreeFlags) {\n        var transformFlags = subtreeFlags | 3;\n        if (node.initializer) {\n            transformFlags |= 8192;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeFunctionDeclaration(node, subtreeFlags) {\n        var transformFlags;\n        var modifierFlags = ts.getModifierFlags(node);\n        var body = node.body;\n        if (!body || (modifierFlags & 2)) {\n            transformFlags = 3;\n        }\n        else {\n            transformFlags = subtreeFlags | 33554432;\n            if (modifierFlags & 2270\n                || node.typeParameters\n                || node.type) {\n                transformFlags |= 3;\n            }\n            if (modifierFlags & 256) {\n                transformFlags |= 16;\n            }\n            if (subtreeFlags & 1048576) {\n                transformFlags |= 8;\n            }\n            if (subtreeFlags & 163840) {\n                transformFlags |= 192;\n            }\n            if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {\n                transformFlags |= 768;\n            }\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~601281857;\n    }\n    function computeFunctionExpression(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (ts.hasModifier(node, 2270)\n            || node.typeParameters\n            || node.type) {\n            transformFlags |= 3;\n        }\n        if (ts.hasModifier(node, 256)) {\n            transformFlags |= 16;\n        }\n        if (subtreeFlags & 1048576) {\n            transformFlags |= 8;\n        }\n        if (subtreeFlags & 163840) {\n            transformFlags |= 192;\n        }\n        if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {\n            transformFlags |= 768;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~601281857;\n    }\n    function computeArrowFunction(node, subtreeFlags) {\n        var transformFlags = subtreeFlags | 192;\n        if (ts.hasModifier(node, 2270)\n            || node.typeParameters\n            || node.type) {\n            transformFlags |= 3;\n        }\n        if (ts.hasModifier(node, 256)) {\n            transformFlags |= 16;\n        }\n        if (subtreeFlags & 1048576) {\n            transformFlags |= 8;\n        }\n        if (subtreeFlags & 16384) {\n            transformFlags |= 32768;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~601249089;\n    }\n    function computePropertyAccess(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        var expression = node.expression;\n        var expressionKind = expression.kind;\n        if (expressionKind === 96) {\n            transformFlags |= 16384;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeVariableDeclaration(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        transformFlags |= 192 | 8388608;\n        if (subtreeFlags & 1048576) {\n            transformFlags |= 8;\n        }\n        if (node.type) {\n            transformFlags |= 3;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeVariableStatement(node, subtreeFlags) {\n        var transformFlags;\n        var modifierFlags = ts.getModifierFlags(node);\n        var declarationListTransformFlags = node.declarationList.transformFlags;\n        if (modifierFlags & 2) {\n            transformFlags = 3;\n        }\n        else {\n            transformFlags = subtreeFlags;\n            if (declarationListTransformFlags & 8388608) {\n                transformFlags |= 192;\n            }\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeLabeledStatement(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (subtreeFlags & 4194304\n            && ts.isIterationStatement(node, true)) {\n            transformFlags |= 192;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeImportEquals(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (!ts.isExternalModuleImportEqualsDeclaration(node)) {\n            transformFlags |= 3;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeExpressionStatement(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (node.expression.transformFlags & 1024) {\n            transformFlags |= 192;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeModuleDeclaration(node, subtreeFlags) {\n        var transformFlags = 3;\n        var modifierFlags = ts.getModifierFlags(node);\n        if ((modifierFlags & 2) === 0) {\n            transformFlags |= subtreeFlags;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~574674241;\n    }\n    function computeVariableDeclarationList(node, subtreeFlags) {\n        var transformFlags = subtreeFlags | 33554432;\n        if (subtreeFlags & 8388608) {\n            transformFlags |= 192;\n        }\n        if (node.flags & 3) {\n            transformFlags |= 192 | 4194304;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~546309441;\n    }\n    function computeOther(node, kind, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        var excludeFlags = 536872257;\n        switch (kind) {\n            case 119:\n            case 189:\n                transformFlags |= 16;\n                break;\n            case 113:\n            case 111:\n            case 112:\n            case 116:\n            case 123:\n            case 75:\n            case 229:\n            case 260:\n            case 182:\n            case 200:\n            case 201:\n            case 130:\n                transformFlags |= 3;\n                break;\n            case 246:\n            case 247:\n            case 248:\n            case 10:\n            case 249:\n            case 250:\n            case 251:\n            case 252:\n                transformFlags |= 4;\n                break;\n            case 213:\n                transformFlags |= 8;\n            case 12:\n            case 13:\n            case 14:\n            case 15:\n            case 194:\n            case 181:\n            case 258:\n            case 114:\n                transformFlags |= 192;\n                break;\n            case 195:\n                transformFlags |= 192 | 16777216;\n                break;\n            case 118:\n            case 132:\n            case 129:\n            case 134:\n            case 121:\n            case 135:\n            case 104:\n            case 143:\n            case 146:\n            case 148:\n            case 153:\n            case 154:\n            case 155:\n            case 156:\n            case 157:\n            case 158:\n            case 159:\n            case 160:\n            case 161:\n            case 162:\n            case 163:\n            case 164:\n            case 165:\n            case 166:\n            case 227:\n            case 228:\n            case 167:\n            case 168:\n            case 169:\n            case 170:\n            case 171:\n                transformFlags = 3;\n                excludeFlags = -3;\n                break;\n            case 142:\n                transformFlags |= 2097152;\n                if (subtreeFlags & 16384) {\n                    transformFlags |= 65536;\n                }\n                break;\n            case 196:\n                transformFlags |= 192 | 524288;\n                break;\n            case 259:\n                transformFlags |= 8 | 1048576;\n                break;\n            case 96:\n                transformFlags |= 192;\n                break;\n            case 98:\n                transformFlags |= 16384;\n                break;\n            case 172:\n                transformFlags |= 192 | 8388608;\n                if (subtreeFlags & 524288) {\n                    transformFlags |= 8 | 1048576;\n                }\n                excludeFlags = 537396545;\n                break;\n            case 173:\n                transformFlags |= 192 | 8388608;\n                excludeFlags = 537396545;\n                break;\n            case 174:\n                transformFlags |= 192;\n                if (node.dotDotDotToken) {\n                    transformFlags |= 524288;\n                }\n                break;\n            case 145:\n                transformFlags |= 3 | 4096;\n                break;\n            case 176:\n                excludeFlags = 540087617;\n                if (subtreeFlags & 2097152) {\n                    transformFlags |= 192;\n                }\n                if (subtreeFlags & 65536) {\n                    transformFlags |= 16384;\n                }\n                if (subtreeFlags & 1048576) {\n                    transformFlags |= 8;\n                }\n                break;\n            case 175:\n            case 180:\n                excludeFlags = 537396545;\n                if (subtreeFlags & 524288) {\n                    transformFlags |= 192;\n                }\n                break;\n            case 209:\n            case 210:\n            case 211:\n            case 212:\n                if (subtreeFlags & 4194304) {\n                    transformFlags |= 192;\n                }\n                break;\n            case 261:\n                if (subtreeFlags & 32768) {\n                    transformFlags |= 192;\n                }\n                break;\n            case 216:\n            case 214:\n            case 215:\n                transformFlags |= 33554432;\n                break;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~excludeFlags;\n    }\n    function getTransformFlagsSubtreeExclusions(kind) {\n        if (kind >= 156 && kind <= 171) {\n            return -3;\n        }\n        switch (kind) {\n            case 179:\n            case 180:\n            case 175:\n                return 537396545;\n            case 230:\n                return 574674241;\n            case 144:\n                return 536872257;\n            case 185:\n                return 601249089;\n            case 184:\n            case 225:\n                return 601281857;\n            case 224:\n                return 546309441;\n            case 226:\n            case 197:\n                return 539358529;\n            case 150:\n                return 601015617;\n            case 149:\n            case 151:\n            case 152:\n                return 601015617;\n            case 118:\n            case 132:\n            case 129:\n            case 134:\n            case 121:\n            case 135:\n            case 104:\n            case 143:\n            case 146:\n            case 148:\n            case 153:\n            case 154:\n            case 155:\n            case 227:\n            case 228:\n                return -3;\n            case 176:\n                return 540087617;\n            case 256:\n                return 537920833;\n            case 172:\n            case 173:\n                return 537396545;\n            default:\n                return 536872257;\n        }\n    }\n    ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function trace(host) {\n        host.trace(ts.formatMessage.apply(undefined, arguments));\n    }\n    ts.trace = trace;\n    function isTraceEnabled(compilerOptions, host) {\n        return compilerOptions.traceResolution && host.trace !== undefined;\n    }\n    ts.isTraceEnabled = isTraceEnabled;\n    function resolvedTypeScriptOnly(resolved) {\n        if (!resolved) {\n            return undefined;\n        }\n        ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension));\n        return resolved.path;\n    }\n    function resolvedFromAnyFile(path) {\n        return { path: path, extension: ts.extensionFromPath(path) };\n    }\n    function resolvedModuleFromResolved(_a, isExternalLibraryImport) {\n        var path = _a.path, extension = _a.extension;\n        return { resolvedFileName: path, extension: extension, isExternalLibraryImport: isExternalLibraryImport };\n    }\n    function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations) {\n        return { resolvedModule: resolved && resolvedModuleFromResolved(resolved, isExternalLibraryImport), failedLookupLocations: failedLookupLocations };\n    }\n    function moduleHasNonRelativeName(moduleName) {\n        return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));\n    }\n    ts.moduleHasNonRelativeName = moduleHasNonRelativeName;\n    function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) {\n        var jsonContent = readJson(packageJsonPath, state.host);\n        switch (extensions) {\n            case 2:\n            case 0:\n                return tryReadFromField(\"typings\") || tryReadFromField(\"types\");\n            case 1:\n                if (typeof jsonContent.main === \"string\") {\n                    if (state.traceEnabled) {\n                        trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main);\n                    }\n                    return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main));\n                }\n                return undefined;\n        }\n        function tryReadFromField(fieldName) {\n            if (ts.hasProperty(jsonContent, fieldName)) {\n                var typesFile = jsonContent[fieldName];\n                if (typeof typesFile === \"string\") {\n                    var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile));\n                    if (state.traceEnabled) {\n                        trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath);\n                    }\n                    return typesFilePath;\n                }\n                else {\n                    if (state.traceEnabled) {\n                        trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof typesFile);\n                    }\n                }\n            }\n        }\n    }\n    function readJson(path, host) {\n        try {\n            var jsonText = host.readFile(path);\n            return jsonText ? JSON.parse(jsonText) : {};\n        }\n        catch (e) {\n            return {};\n        }\n    }\n    function getEffectiveTypeRoots(options, host) {\n        if (options.typeRoots) {\n            return options.typeRoots;\n        }\n        var currentDirectory;\n        if (options.configFilePath) {\n            currentDirectory = ts.getDirectoryPath(options.configFilePath);\n        }\n        else if (host.getCurrentDirectory) {\n            currentDirectory = host.getCurrentDirectory();\n        }\n        if (currentDirectory !== undefined) {\n            return getDefaultTypeRoots(currentDirectory, host);\n        }\n    }\n    ts.getEffectiveTypeRoots = getEffectiveTypeRoots;\n    function getDefaultTypeRoots(currentDirectory, host) {\n        if (!host.directoryExists) {\n            return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)];\n        }\n        var typeRoots;\n        forEachAncestorDirectory(currentDirectory, function (directory) {\n            var atTypes = ts.combinePaths(directory, nodeModulesAtTypes);\n            if (host.directoryExists(atTypes)) {\n                (typeRoots || (typeRoots = [])).push(atTypes);\n            }\n        });\n        return typeRoots;\n    }\n    var nodeModulesAtTypes = ts.combinePaths(\"node_modules\", \"@types\");\n    function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) {\n        var traceEnabled = isTraceEnabled(options, host);\n        var moduleResolutionState = {\n            compilerOptions: options,\n            host: host,\n            traceEnabled: traceEnabled\n        };\n        var typeRoots = getEffectiveTypeRoots(options, host);\n        if (traceEnabled) {\n            if (containingFile === undefined) {\n                if (typeRoots === undefined) {\n                    trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName);\n                }\n                else {\n                    trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, typeRoots);\n                }\n            }\n            else {\n                if (typeRoots === undefined) {\n                    trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile);\n                }\n                else {\n                    trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, typeRoots);\n                }\n            }\n        }\n        var failedLookupLocations = [];\n        var resolved = primaryLookup();\n        var primary = true;\n        if (!resolved) {\n            resolved = secondaryLookup();\n            primary = false;\n        }\n        var resolvedTypeReferenceDirective;\n        if (resolved) {\n            resolved = realpath(resolved, host, traceEnabled);\n            if (traceEnabled) {\n                trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolved, primary);\n            }\n            resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolved };\n        }\n        return { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };\n        function primaryLookup() {\n            if (typeRoots && typeRoots.length) {\n                if (traceEnabled) {\n                    trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(\", \"));\n                }\n                return ts.forEach(typeRoots, function (typeRoot) {\n                    var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName);\n                    var candidateDirectory = ts.getDirectoryPath(candidate);\n                    return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState));\n                });\n            }\n            else {\n                if (traceEnabled) {\n                    trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths);\n                }\n            }\n        }\n        function secondaryLookup() {\n            var resolvedFile;\n            var initialLocationForSecondaryLookup = containingFile && ts.getDirectoryPath(containingFile);\n            if (initialLocationForSecondaryLookup !== undefined) {\n                if (traceEnabled) {\n                    trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);\n                }\n                resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState));\n                if (!resolvedFile && traceEnabled) {\n                    trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName);\n                }\n                return resolvedFile;\n            }\n            else {\n                if (traceEnabled) {\n                    trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder);\n                }\n            }\n        }\n    }\n    ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;\n    function getAutomaticTypeDirectiveNames(options, host) {\n        if (options.types) {\n            return options.types;\n        }\n        var result = [];\n        if (host.directoryExists && host.getDirectories) {\n            var typeRoots = getEffectiveTypeRoots(options, host);\n            if (typeRoots) {\n                for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) {\n                    var root = typeRoots_1[_i];\n                    if (host.directoryExists(root)) {\n                        for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) {\n                            var typeDirectivePath = _b[_a];\n                            var normalized = ts.normalizePath(typeDirectivePath);\n                            var packageJsonPath = pathToPackageJson(ts.combinePaths(root, normalized));\n                            var isNotNeededPackage = host.fileExists(packageJsonPath) && readJson(packageJsonPath, host).typings === null;\n                            if (!isNotNeededPackage) {\n                                result.push(ts.getBaseFileName(normalized));\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        return result;\n    }\n    ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;\n    function resolveModuleName(moduleName, containingFile, compilerOptions, host) {\n        var traceEnabled = isTraceEnabled(compilerOptions, host);\n        if (traceEnabled) {\n            trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile);\n        }\n        var moduleResolution = compilerOptions.moduleResolution;\n        if (moduleResolution === undefined) {\n            moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;\n            if (traceEnabled) {\n                trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]);\n            }\n        }\n        else {\n            if (traceEnabled) {\n                trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]);\n            }\n        }\n        var result;\n        switch (moduleResolution) {\n            case ts.ModuleResolutionKind.NodeJs:\n                result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host);\n                break;\n            case ts.ModuleResolutionKind.Classic:\n                result = classicNameResolver(moduleName, containingFile, compilerOptions, host);\n                break;\n        }\n        if (traceEnabled) {\n            if (result.resolvedModule) {\n                trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName);\n            }\n            else {\n                trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName);\n            }\n        }\n        return result;\n    }\n    ts.resolveModuleName = resolveModuleName;\n    function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) {\n        if (moduleHasNonRelativeName(moduleName)) {\n            return tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state);\n        }\n        else {\n            return tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state);\n        }\n    }\n    function tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) {\n        if (!state.compilerOptions.rootDirs) {\n            return undefined;\n        }\n        if (state.traceEnabled) {\n            trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName);\n        }\n        var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));\n        var matchedRootDir;\n        var matchedNormalizedPrefix;\n        for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) {\n            var rootDir = _a[_i];\n            var normalizedRoot = ts.normalizePath(rootDir);\n            if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) {\n                normalizedRoot += ts.directorySeparator;\n            }\n            var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) &&\n                (matchedNormalizedPrefix === undefined || matchedNormalizedPrefix.length < normalizedRoot.length);\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix);\n            }\n            if (isLongestMatchingPrefix) {\n                matchedNormalizedPrefix = normalizedRoot;\n                matchedRootDir = rootDir;\n            }\n        }\n        if (matchedNormalizedPrefix) {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix);\n            }\n            var suffix = candidate.substr(matchedNormalizedPrefix.length);\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate);\n            }\n            var resolvedFileName = loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state);\n            if (resolvedFileName) {\n                return resolvedFileName;\n            }\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs);\n            }\n            for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) {\n                var rootDir = _c[_b];\n                if (rootDir === matchedRootDir) {\n                    continue;\n                }\n                var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix);\n                if (state.traceEnabled) {\n                    trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1);\n                }\n                var baseDirectory = ts.getDirectoryPath(candidate_1);\n                var resolvedFileName_1 = loader(extensions, candidate_1, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state);\n                if (resolvedFileName_1) {\n                    return resolvedFileName_1;\n                }\n            }\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed);\n            }\n        }\n        return undefined;\n    }\n    function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state) {\n        if (!state.compilerOptions.baseUrl) {\n            return undefined;\n        }\n        if (state.traceEnabled) {\n            trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName);\n        }\n        var matchedPattern = undefined;\n        if (state.compilerOptions.paths) {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName);\n            }\n            matchedPattern = ts.matchPatternOrExact(ts.getOwnKeys(state.compilerOptions.paths), moduleName);\n        }\n        if (matchedPattern) {\n            var matchedStar_1 = typeof matchedPattern === \"string\" ? undefined : ts.matchedText(matchedPattern, moduleName);\n            var matchedPatternText = typeof matchedPattern === \"string\" ? matchedPattern : ts.patternText(matchedPattern);\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPatternText);\n            }\n            return ts.forEach(state.compilerOptions.paths[matchedPatternText], function (subst) {\n                var path = matchedStar_1 ? subst.replace(\"*\", matchedStar_1) : subst;\n                var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, path));\n                if (state.traceEnabled) {\n                    trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path);\n                }\n                var tsExtension = ts.tryGetExtensionFromPath(candidate);\n                if (tsExtension !== undefined) {\n                    var path_1 = tryFile(candidate, failedLookupLocations, false, state);\n                    return path_1 && { path: path_1, extension: tsExtension };\n                }\n                return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);\n            });\n        }\n        else {\n            var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, moduleName));\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate);\n            }\n            return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);\n        }\n    }\n    function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) {\n        var containingDirectory = ts.getDirectoryPath(containingFile);\n        var traceEnabled = isTraceEnabled(compilerOptions, host);\n        var failedLookupLocations = [];\n        var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };\n        var result = tryResolve(0) || tryResolve(1);\n        if (result) {\n            var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport;\n            return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations);\n        }\n        return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };\n        function tryResolve(extensions) {\n            var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state);\n            if (resolved) {\n                return { resolved: resolved, isExternalLibraryImport: false };\n            }\n            if (moduleHasNonRelativeName(moduleName)) {\n                if (traceEnabled) {\n                    trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName);\n                }\n                var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state);\n                return resolved_1 && { resolved: { path: realpath(resolved_1.path, host, traceEnabled), extension: resolved_1.extension }, isExternalLibraryImport: true };\n            }\n            else {\n                var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));\n                var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state);\n                return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false };\n            }\n        }\n    }\n    ts.nodeModuleNameResolver = nodeModuleNameResolver;\n    function realpath(path, host, traceEnabled) {\n        if (!host.realpath) {\n            return path;\n        }\n        var real = ts.normalizePath(host.realpath(path));\n        if (traceEnabled) {\n            trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, path, real);\n        }\n        return real;\n    }\n    function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) {\n        if (state.traceEnabled) {\n            trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate);\n        }\n        var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state);\n        return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state);\n    }\n    function directoryProbablyExists(directoryName, host) {\n        return !host.directoryExists || host.directoryExists(directoryName);\n    }\n    ts.directoryProbablyExists = directoryProbablyExists;\n    function loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) {\n        var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state);\n        if (resolvedByAddingExtension) {\n            return resolvedByAddingExtension;\n        }\n        if (ts.hasJavaScriptFileExtension(candidate)) {\n            var extensionless = ts.removeFileExtension(candidate);\n            if (state.traceEnabled) {\n                var extension = candidate.substring(extensionless.length);\n                trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);\n            }\n            return tryAddingExtensions(extensionless, extensions, failedLookupLocations, onlyRecordFailures, state);\n        }\n    }\n    function tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state) {\n        if (!onlyRecordFailures) {\n            var directory = ts.getDirectoryPath(candidate);\n            if (directory) {\n                onlyRecordFailures = !directoryProbablyExists(directory, state.host);\n            }\n        }\n        switch (extensions) {\n            case 2:\n                return tryExtension(\".d.ts\", ts.Extension.Dts);\n            case 0:\n                return tryExtension(\".ts\", ts.Extension.Ts) || tryExtension(\".tsx\", ts.Extension.Tsx) || tryExtension(\".d.ts\", ts.Extension.Dts);\n            case 1:\n                return tryExtension(\".js\", ts.Extension.Js) || tryExtension(\".jsx\", ts.Extension.Jsx);\n        }\n        function tryExtension(ext, extension) {\n            var path = tryFile(candidate + ext, failedLookupLocations, onlyRecordFailures, state);\n            return path && { path: path, extension: extension };\n        }\n    }\n    function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) {\n        if (!onlyRecordFailures && state.host.fileExists(fileName)) {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName);\n            }\n            return fileName;\n        }\n        else {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName);\n            }\n            failedLookupLocations.push(fileName);\n            return undefined;\n        }\n    }\n    function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) {\n        var packageJsonPath = pathToPackageJson(candidate);\n        var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host);\n        if (directoryExists && state.host.fileExists(packageJsonPath)) {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);\n            }\n            var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state);\n            if (typesFile) {\n                var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host);\n                var fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures_1, state);\n                if (fromFile) {\n                    return resolvedFromAnyFile(fromFile);\n                }\n                var x = tryAddingExtensions(typesFile, 0, failedLookupLocations, onlyRecordFailures_1, state);\n                if (x) {\n                    return x;\n                }\n            }\n            else {\n                if (state.traceEnabled) {\n                    trace(state.host, ts.Diagnostics.package_json_does_not_have_a_types_or_main_field);\n                }\n            }\n        }\n        else {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath);\n            }\n            failedLookupLocations.push(packageJsonPath);\n        }\n        return loadModuleFromFile(extensions, ts.combinePaths(candidate, \"index\"), failedLookupLocations, !directoryExists, state);\n    }\n    function pathToPackageJson(directory) {\n        return ts.combinePaths(directory, \"package.json\");\n    }\n    function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) {\n        var nodeModulesFolder = ts.combinePaths(directory, \"node_modules\");\n        var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host);\n        var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName));\n        return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) ||\n            loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state);\n    }\n    function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state) {\n        return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false);\n    }\n    function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) {\n        return loadModuleFromNodeModulesWorker(2, moduleName, directory, failedLookupLocations, state, true);\n    }\n    function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) {\n        return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) {\n            if (ts.getBaseFileName(ancestorDirectory) !== \"node_modules\") {\n                return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly);\n            }\n        });\n    }\n    function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) {\n        if (typesOnly === void 0) { typesOnly = false; }\n        var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state);\n        if (packageResult) {\n            return packageResult;\n        }\n        if (extensions !== 1) {\n            return loadModuleFromNodeModulesFolder(2, ts.combinePaths(\"@types\", moduleName), directory, failedLookupLocations, state);\n        }\n    }\n    function classicNameResolver(moduleName, containingFile, compilerOptions, host) {\n        var traceEnabled = isTraceEnabled(compilerOptions, host);\n        var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };\n        var failedLookupLocations = [];\n        var containingDirectory = ts.getDirectoryPath(containingFile);\n        var resolved = tryResolve(0) || tryResolve(1);\n        return createResolvedModuleWithFailedLookupLocations(resolved, false, failedLookupLocations);\n        function tryResolve(extensions) {\n            var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state);\n            if (resolvedUsingSettings) {\n                return resolvedUsingSettings;\n            }\n            if (moduleHasNonRelativeName(moduleName)) {\n                var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) {\n                    var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName));\n                    return loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state);\n                });\n                if (resolved_3) {\n                    return resolved_3;\n                }\n                if (extensions === 0) {\n                    return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state);\n                }\n            }\n            else {\n                var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));\n                return loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state);\n            }\n        }\n    }\n    ts.classicNameResolver = classicNameResolver;\n    function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache) {\n        var traceEnabled = isTraceEnabled(compilerOptions, host);\n        if (traceEnabled) {\n            trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache);\n        }\n        var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };\n        var failedLookupLocations = [];\n        var resolved = loadModuleFromNodeModulesOneLevel(2, moduleName, globalCache, failedLookupLocations, state);\n        return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations);\n    }\n    ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;\n    function forEachAncestorDirectory(directory, callback) {\n        while (true) {\n            var result = callback(directory);\n            if (result !== undefined) {\n                return result;\n            }\n            var parentPath = ts.getDirectoryPath(directory);\n            if (parentPath === directory) {\n                return undefined;\n            }\n            directory = parentPath;\n        }\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var ambientModuleSymbolRegex = /^\".+\"$/;\n    var nextSymbolId = 1;\n    var nextNodeId = 1;\n    var nextMergeId = 1;\n    var nextFlowId = 1;\n    function getNodeId(node) {\n        if (!node.id) {\n            node.id = nextNodeId;\n            nextNodeId++;\n        }\n        return node.id;\n    }\n    ts.getNodeId = getNodeId;\n    function getSymbolId(symbol) {\n        if (!symbol.id) {\n            symbol.id = nextSymbolId;\n            nextSymbolId++;\n        }\n        return symbol.id;\n    }\n    ts.getSymbolId = getSymbolId;\n    function createTypeChecker(host, produceDiagnostics) {\n        var cancellationToken;\n        var requestedExternalEmitHelpers;\n        var externalHelpersModule;\n        var Symbol = ts.objectAllocator.getSymbolConstructor();\n        var Type = ts.objectAllocator.getTypeConstructor();\n        var Signature = ts.objectAllocator.getSignatureConstructor();\n        var typeCount = 0;\n        var symbolCount = 0;\n        var emptyArray = [];\n        var emptySymbols = ts.createMap();\n        var compilerOptions = host.getCompilerOptions();\n        var languageVersion = compilerOptions.target || 0;\n        var modulekind = ts.getEmitModuleKind(compilerOptions);\n        var noUnusedIdentifiers = !!compilerOptions.noUnusedLocals || !!compilerOptions.noUnusedParameters;\n        var allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== \"undefined\" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ts.ModuleKind.System;\n        var strictNullChecks = compilerOptions.strictNullChecks;\n        var emitResolver = createResolver();\n        var undefinedSymbol = createSymbol(4 | 67108864, \"undefined\");\n        undefinedSymbol.declarations = [];\n        var argumentsSymbol = createSymbol(4 | 67108864, \"arguments\");\n        var checker = {\n            getNodeCount: function () { return ts.sum(host.getSourceFiles(), \"nodeCount\"); },\n            getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), \"identifierCount\"); },\n            getSymbolCount: function () { return ts.sum(host.getSourceFiles(), \"symbolCount\") + symbolCount; },\n            getTypeCount: function () { return typeCount; },\n            isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; },\n            isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; },\n            isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; },\n            getDiagnostics: getDiagnostics,\n            getGlobalDiagnostics: getGlobalDiagnostics,\n            getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation,\n            getSymbolsOfParameterPropertyDeclaration: getSymbolsOfParameterPropertyDeclaration,\n            getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol,\n            getPropertiesOfType: getPropertiesOfType,\n            getPropertyOfType: getPropertyOfType,\n            getSignaturesOfType: getSignaturesOfType,\n            getIndexTypeOfType: getIndexTypeOfType,\n            getBaseTypes: getBaseTypes,\n            getReturnTypeOfSignature: getReturnTypeOfSignature,\n            getNonNullableType: getNonNullableType,\n            getSymbolsInScope: getSymbolsInScope,\n            getSymbolAtLocation: getSymbolAtLocation,\n            getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol,\n            getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol,\n            getTypeAtLocation: getTypeOfNode,\n            getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment,\n            typeToString: typeToString,\n            getSymbolDisplayBuilder: getSymbolDisplayBuilder,\n            symbolToString: symbolToString,\n            getAugmentedPropertiesOfType: getAugmentedPropertiesOfType,\n            getRootSymbols: getRootSymbols,\n            getContextualType: getContextualType,\n            getFullyQualifiedName: getFullyQualifiedName,\n            getResolvedSignature: getResolvedSignature,\n            getConstantValue: getConstantValue,\n            isValidPropertyAccess: isValidPropertyAccess,\n            getSignatureFromDeclaration: getSignatureFromDeclaration,\n            isImplementationOfOverload: isImplementationOfOverload,\n            getAliasedSymbol: resolveAlias,\n            getEmitResolver: getEmitResolver,\n            getExportsOfModule: getExportsOfModuleAsArray,\n            getAmbientModules: getAmbientModules,\n            getJsxElementAttributesType: getJsxElementAttributesType,\n            getJsxIntrinsicTagNames: getJsxIntrinsicTagNames,\n            isOptionalParameter: isOptionalParameter,\n            tryGetMemberInModuleExports: tryGetMemberInModuleExports,\n            tryFindAmbientModuleWithoutAugmentations: function (moduleName) {\n                return tryFindAmbientModule(moduleName, false);\n            }\n        };\n        var tupleTypes = [];\n        var unionTypes = ts.createMap();\n        var intersectionTypes = ts.createMap();\n        var stringLiteralTypes = ts.createMap();\n        var numericLiteralTypes = ts.createMap();\n        var indexedAccessTypes = ts.createMap();\n        var evolvingArrayTypes = [];\n        var unknownSymbol = createSymbol(4 | 67108864, \"unknown\");\n        var resolvingSymbol = createSymbol(67108864, \"__resolving__\");\n        var anyType = createIntrinsicType(1, \"any\");\n        var autoType = createIntrinsicType(1, \"any\");\n        var unknownType = createIntrinsicType(1, \"unknown\");\n        var undefinedType = createIntrinsicType(2048, \"undefined\");\n        var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(2048 | 2097152, \"undefined\");\n        var nullType = createIntrinsicType(4096, \"null\");\n        var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(4096 | 2097152, \"null\");\n        var stringType = createIntrinsicType(2, \"string\");\n        var numberType = createIntrinsicType(4, \"number\");\n        var trueType = createIntrinsicType(128, \"true\");\n        var falseType = createIntrinsicType(128, \"false\");\n        var booleanType = createBooleanType([trueType, falseType]);\n        var esSymbolType = createIntrinsicType(512, \"symbol\");\n        var voidType = createIntrinsicType(1024, \"void\");\n        var neverType = createIntrinsicType(8192, \"never\");\n        var silentNeverType = createIntrinsicType(8192, \"never\");\n        var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n        var emptyTypeLiteralSymbol = createSymbol(2048 | 67108864, \"__type\");\n        emptyTypeLiteralSymbol.members = ts.createMap();\n        var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n        var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n        emptyGenericType.instantiations = ts.createMap();\n        var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n        anyFunctionType.flags |= 8388608;\n        var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n        var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false);\n        var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false);\n        var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false);\n        var silentNeverSignature = createSignature(undefined, undefined, undefined, emptyArray, silentNeverType, undefined, 0, false, false);\n        var enumNumberIndexInfo = createIndexInfo(stringType, true);\n        var globals = ts.createMap();\n        var patternAmbientModules;\n        var getGlobalESSymbolConstructorSymbol;\n        var getGlobalPromiseConstructorSymbol;\n        var tryGetGlobalPromiseConstructorSymbol;\n        var globalObjectType;\n        var globalFunctionType;\n        var globalArrayType;\n        var globalReadonlyArrayType;\n        var globalStringType;\n        var globalNumberType;\n        var globalBooleanType;\n        var globalRegExpType;\n        var anyArrayType;\n        var autoArrayType;\n        var anyReadonlyArrayType;\n        var getGlobalTemplateStringsArrayType;\n        var getGlobalESSymbolType;\n        var getGlobalIterableType;\n        var getGlobalIteratorType;\n        var getGlobalIterableIteratorType;\n        var getGlobalClassDecoratorType;\n        var getGlobalParameterDecoratorType;\n        var getGlobalPropertyDecoratorType;\n        var getGlobalMethodDecoratorType;\n        var getGlobalTypedPropertyDescriptorType;\n        var getGlobalPromiseType;\n        var tryGetGlobalPromiseType;\n        var getGlobalPromiseLikeType;\n        var getInstantiatedGlobalPromiseLikeType;\n        var getGlobalPromiseConstructorLikeType;\n        var getGlobalThenableType;\n        var jsxElementClassType;\n        var deferredNodes;\n        var deferredUnusedIdentifierNodes;\n        var flowLoopStart = 0;\n        var flowLoopCount = 0;\n        var visitedFlowCount = 0;\n        var emptyStringType = getLiteralTypeForText(32, \"\");\n        var zeroType = getLiteralTypeForText(64, \"0\");\n        var resolutionTargets = [];\n        var resolutionResults = [];\n        var resolutionPropertyNames = [];\n        var mergedSymbols = [];\n        var symbolLinks = [];\n        var nodeLinks = [];\n        var flowLoopCaches = [];\n        var flowLoopNodes = [];\n        var flowLoopKeys = [];\n        var flowLoopTypes = [];\n        var visitedFlowNodes = [];\n        var visitedFlowTypes = [];\n        var potentialThisCollisions = [];\n        var awaitedTypeStack = [];\n        var diagnostics = ts.createDiagnosticCollection();\n        var typeofEQFacts = ts.createMap({\n            \"string\": 1,\n            \"number\": 2,\n            \"boolean\": 4,\n            \"symbol\": 8,\n            \"undefined\": 16384,\n            \"object\": 16,\n            \"function\": 32\n        });\n        var typeofNEFacts = ts.createMap({\n            \"string\": 128,\n            \"number\": 256,\n            \"boolean\": 512,\n            \"symbol\": 1024,\n            \"undefined\": 131072,\n            \"object\": 2048,\n            \"function\": 4096\n        });\n        var typeofTypesByName = ts.createMap({\n            \"string\": stringType,\n            \"number\": numberType,\n            \"boolean\": booleanType,\n            \"symbol\": esSymbolType,\n            \"undefined\": undefinedType\n        });\n        var jsxElementType;\n        var _jsxNamespace;\n        var _jsxFactoryEntity;\n        var jsxTypes = ts.createMap();\n        var JsxNames = {\n            JSX: \"JSX\",\n            IntrinsicElements: \"IntrinsicElements\",\n            ElementClass: \"ElementClass\",\n            ElementAttributesPropertyNameContainer: \"ElementAttributesProperty\",\n            Element: \"Element\",\n            IntrinsicAttributes: \"IntrinsicAttributes\",\n            IntrinsicClassAttributes: \"IntrinsicClassAttributes\"\n        };\n        var subtypeRelation = ts.createMap();\n        var assignableRelation = ts.createMap();\n        var comparableRelation = ts.createMap();\n        var identityRelation = ts.createMap();\n        var enumRelation = ts.createMap();\n        var _displayBuilder;\n        var builtinGlobals = ts.createMap();\n        builtinGlobals[undefinedSymbol.name] = undefinedSymbol;\n        initializeTypeChecker();\n        return checker;\n        function getJsxNamespace() {\n            if (_jsxNamespace === undefined) {\n                _jsxNamespace = \"React\";\n                if (compilerOptions.jsxFactory) {\n                    _jsxFactoryEntity = ts.parseIsolatedEntityName(compilerOptions.jsxFactory, languageVersion);\n                    if (_jsxFactoryEntity) {\n                        _jsxNamespace = getFirstIdentifier(_jsxFactoryEntity).text;\n                    }\n                }\n                else if (compilerOptions.reactNamespace) {\n                    _jsxNamespace = compilerOptions.reactNamespace;\n                }\n            }\n            return _jsxNamespace;\n        }\n        function getEmitResolver(sourceFile, cancellationToken) {\n            getDiagnostics(sourceFile, cancellationToken);\n            return emitResolver;\n        }\n        function error(location, message, arg0, arg1, arg2) {\n            var diagnostic = location\n                ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2)\n                : ts.createCompilerDiagnostic(message, arg0, arg1, arg2);\n            diagnostics.add(diagnostic);\n        }\n        function createSymbol(flags, name) {\n            symbolCount++;\n            return new Symbol(flags, name);\n        }\n        function getExcludedSymbolFlags(flags) {\n            var result = 0;\n            if (flags & 2)\n                result |= 107455;\n            if (flags & 1)\n                result |= 107454;\n            if (flags & 4)\n                result |= 0;\n            if (flags & 8)\n                result |= 900095;\n            if (flags & 16)\n                result |= 106927;\n            if (flags & 32)\n                result |= 899519;\n            if (flags & 64)\n                result |= 792968;\n            if (flags & 256)\n                result |= 899327;\n            if (flags & 128)\n                result |= 899967;\n            if (flags & 512)\n                result |= 106639;\n            if (flags & 8192)\n                result |= 99263;\n            if (flags & 32768)\n                result |= 41919;\n            if (flags & 65536)\n                result |= 74687;\n            if (flags & 262144)\n                result |= 530920;\n            if (flags & 524288)\n                result |= 793064;\n            if (flags & 8388608)\n                result |= 8388608;\n            return result;\n        }\n        function recordMergedSymbol(target, source) {\n            if (!source.mergeId) {\n                source.mergeId = nextMergeId;\n                nextMergeId++;\n            }\n            mergedSymbols[source.mergeId] = target;\n        }\n        function cloneSymbol(symbol) {\n            var result = createSymbol(symbol.flags | 33554432, symbol.name);\n            result.declarations = symbol.declarations.slice(0);\n            result.parent = symbol.parent;\n            if (symbol.valueDeclaration)\n                result.valueDeclaration = symbol.valueDeclaration;\n            if (symbol.constEnumOnlyModule)\n                result.constEnumOnlyModule = true;\n            if (symbol.members)\n                result.members = ts.cloneMap(symbol.members);\n            if (symbol.exports)\n                result.exports = ts.cloneMap(symbol.exports);\n            recordMergedSymbol(result, symbol);\n            return result;\n        }\n        function mergeSymbol(target, source) {\n            if (!(target.flags & getExcludedSymbolFlags(source.flags))) {\n                if (source.flags & 512 && target.flags & 512 && target.constEnumOnlyModule && !source.constEnumOnlyModule) {\n                    target.constEnumOnlyModule = false;\n                }\n                target.flags |= source.flags;\n                if (source.valueDeclaration &&\n                    (!target.valueDeclaration ||\n                        (target.valueDeclaration.kind === 230 && source.valueDeclaration.kind !== 230))) {\n                    target.valueDeclaration = source.valueDeclaration;\n                }\n                ts.forEach(source.declarations, function (node) {\n                    target.declarations.push(node);\n                });\n                if (source.members) {\n                    if (!target.members)\n                        target.members = ts.createMap();\n                    mergeSymbolTable(target.members, source.members);\n                }\n                if (source.exports) {\n                    if (!target.exports)\n                        target.exports = ts.createMap();\n                    mergeSymbolTable(target.exports, source.exports);\n                }\n                recordMergedSymbol(target, source);\n            }\n            else {\n                var message_2 = target.flags & 2 || source.flags & 2\n                    ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0;\n                ts.forEach(source.declarations, function (node) {\n                    error(node.name ? node.name : node, message_2, symbolToString(source));\n                });\n                ts.forEach(target.declarations, function (node) {\n                    error(node.name ? node.name : node, message_2, symbolToString(source));\n                });\n            }\n        }\n        function mergeSymbolTable(target, source) {\n            for (var id in source) {\n                var targetSymbol = target[id];\n                if (!targetSymbol) {\n                    target[id] = source[id];\n                }\n                else {\n                    if (!(targetSymbol.flags & 33554432)) {\n                        target[id] = targetSymbol = cloneSymbol(targetSymbol);\n                    }\n                    mergeSymbol(targetSymbol, source[id]);\n                }\n            }\n        }\n        function mergeModuleAugmentation(moduleName) {\n            var moduleAugmentation = moduleName.parent;\n            if (moduleAugmentation.symbol.declarations[0] !== moduleAugmentation) {\n                ts.Debug.assert(moduleAugmentation.symbol.declarations.length > 1);\n                return;\n            }\n            if (ts.isGlobalScopeAugmentation(moduleAugmentation)) {\n                mergeSymbolTable(globals, moduleAugmentation.symbol.exports);\n            }\n            else {\n                var moduleNotFoundError = !ts.isInAmbientContext(moduleName.parent.parent)\n                    ? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found\n                    : undefined;\n                var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, true);\n                if (!mainModule) {\n                    return;\n                }\n                mainModule = resolveExternalModuleSymbol(mainModule);\n                if (mainModule.flags & 1920) {\n                    mainModule = mainModule.flags & 33554432 ? mainModule : cloneSymbol(mainModule);\n                    mergeSymbol(mainModule, moduleAugmentation.symbol);\n                }\n                else {\n                    error(moduleName, ts.Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text);\n                }\n            }\n        }\n        function addToSymbolTable(target, source, message) {\n            for (var id in source) {\n                if (target[id]) {\n                    ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message));\n                }\n                else {\n                    target[id] = source[id];\n                }\n            }\n            function addDeclarationDiagnostic(id, message) {\n                return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); };\n            }\n        }\n        function getSymbolLinks(symbol) {\n            if (symbol.flags & 67108864)\n                return symbol;\n            var id = getSymbolId(symbol);\n            return symbolLinks[id] || (symbolLinks[id] = {});\n        }\n        function getNodeLinks(node) {\n            var nodeId = getNodeId(node);\n            return nodeLinks[nodeId] || (nodeLinks[nodeId] = { flags: 0 });\n        }\n        function getObjectFlags(type) {\n            return type.flags & 32768 ? type.objectFlags : 0;\n        }\n        function isGlobalSourceFile(node) {\n            return node.kind === 261 && !ts.isExternalOrCommonJsModule(node);\n        }\n        function getSymbol(symbols, name, meaning) {\n            if (meaning) {\n                var symbol = symbols[name];\n                if (symbol) {\n                    ts.Debug.assert((symbol.flags & 16777216) === 0, \"Should never get an instantiated symbol here.\");\n                    if (symbol.flags & meaning) {\n                        return symbol;\n                    }\n                    if (symbol.flags & 8388608) {\n                        var target = resolveAlias(symbol);\n                        if (target === unknownSymbol || target.flags & meaning) {\n                            return symbol;\n                        }\n                    }\n                }\n            }\n        }\n        function getSymbolsOfParameterPropertyDeclaration(parameter, parameterName) {\n            var constructorDeclaration = parameter.parent;\n            var classDeclaration = parameter.parent.parent;\n            var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 107455);\n            var propertySymbol = getSymbol(classDeclaration.symbol.members, parameterName, 107455);\n            if (parameterSymbol && propertySymbol) {\n                return [parameterSymbol, propertySymbol];\n            }\n            ts.Debug.fail(\"There should exist two symbols, one as property declaration and one as parameter declaration\");\n        }\n        function isBlockScopedNameDeclaredBeforeUse(declaration, usage) {\n            var declarationFile = ts.getSourceFileOfNode(declaration);\n            var useFile = ts.getSourceFileOfNode(usage);\n            if (declarationFile !== useFile) {\n                if ((modulekind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator)) ||\n                    (!compilerOptions.outFile && !compilerOptions.out)) {\n                    return true;\n                }\n                if (isUsedInFunctionOrNonStaticProperty(usage)) {\n                    return true;\n                }\n                var sourceFiles = host.getSourceFiles();\n                return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile);\n            }\n            if (declaration.pos <= usage.pos) {\n                return declaration.kind !== 223 ||\n                    !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);\n            }\n            var container = ts.getEnclosingBlockScopeContainer(declaration);\n            return isUsedInFunctionOrNonStaticProperty(usage, container);\n            function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) {\n                var container = ts.getEnclosingBlockScopeContainer(declaration);\n                switch (declaration.parent.parent.kind) {\n                    case 205:\n                    case 211:\n                    case 213:\n                        if (isSameScopeDescendentOf(usage, declaration, container)) {\n                            return true;\n                        }\n                        break;\n                }\n                switch (declaration.parent.parent.kind) {\n                    case 212:\n                    case 213:\n                        if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) {\n                            return true;\n                        }\n                }\n                return false;\n            }\n            function isUsedInFunctionOrNonStaticProperty(usage, container) {\n                var current = usage;\n                while (current) {\n                    if (current === container) {\n                        return false;\n                    }\n                    if (ts.isFunctionLike(current)) {\n                        return true;\n                    }\n                    var initializerOfNonStaticProperty = current.parent &&\n                        current.parent.kind === 147 &&\n                        (ts.getModifierFlags(current.parent) & 32) === 0 &&\n                        current.parent.initializer === current;\n                    if (initializerOfNonStaticProperty) {\n                        return true;\n                    }\n                    current = current.parent;\n                }\n                return false;\n            }\n        }\n        function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) {\n            var result;\n            var lastLocation;\n            var propertyWithInvalidInitializer;\n            var errorLocation = location;\n            var grandparent;\n            var isInExternalModule = false;\n            loop: while (location) {\n                if (location.locals && !isGlobalSourceFile(location)) {\n                    if (result = getSymbol(location.locals, name, meaning)) {\n                        var useResult = true;\n                        if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) {\n                            if (meaning & result.flags & 793064 && lastLocation.kind !== 278) {\n                                useResult = result.flags & 262144\n                                    ? lastLocation === location.type ||\n                                        lastLocation.kind === 144 ||\n                                        lastLocation.kind === 143\n                                    : false;\n                            }\n                            if (meaning & 107455 && result.flags & 1) {\n                                useResult =\n                                    lastLocation.kind === 144 ||\n                                        (lastLocation === location.type &&\n                                            result.valueDeclaration.kind === 144);\n                            }\n                        }\n                        if (useResult) {\n                            break loop;\n                        }\n                        else {\n                            result = undefined;\n                        }\n                    }\n                }\n                switch (location.kind) {\n                    case 261:\n                        if (!ts.isExternalOrCommonJsModule(location))\n                            break;\n                        isInExternalModule = true;\n                    case 230:\n                        var moduleExports = getSymbolOfNode(location).exports;\n                        if (location.kind === 261 || ts.isAmbientModule(location)) {\n                            if (result = moduleExports[\"default\"]) {\n                                var localSymbol = ts.getLocalSymbolForExportDefault(result);\n                                if (localSymbol && (result.flags & meaning) && localSymbol.name === name) {\n                                    break loop;\n                                }\n                                result = undefined;\n                            }\n                            if (moduleExports[name] &&\n                                moduleExports[name].flags === 8388608 &&\n                                ts.getDeclarationOfKind(moduleExports[name], 243)) {\n                                break;\n                            }\n                        }\n                        if (result = getSymbol(moduleExports, name, meaning & 8914931)) {\n                            break loop;\n                        }\n                        break;\n                    case 229:\n                        if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) {\n                            break loop;\n                        }\n                        break;\n                    case 147:\n                    case 146:\n                        if (ts.isClassLike(location.parent) && !(ts.getModifierFlags(location) & 32)) {\n                            var ctor = findConstructorDeclaration(location.parent);\n                            if (ctor && ctor.locals) {\n                                if (getSymbol(ctor.locals, name, meaning & 107455)) {\n                                    propertyWithInvalidInitializer = location;\n                                }\n                            }\n                        }\n                        break;\n                    case 226:\n                    case 197:\n                    case 227:\n                        if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064)) {\n                            if (lastLocation && ts.getModifierFlags(lastLocation) & 32) {\n                                error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters);\n                                return undefined;\n                            }\n                            break loop;\n                        }\n                        if (location.kind === 197 && meaning & 32) {\n                            var className = location.name;\n                            if (className && name === className.text) {\n                                result = location.symbol;\n                                break loop;\n                            }\n                        }\n                        break;\n                    case 142:\n                        grandparent = location.parent.parent;\n                        if (ts.isClassLike(grandparent) || grandparent.kind === 227) {\n                            if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064)) {\n                                error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);\n                                return undefined;\n                            }\n                        }\n                        break;\n                    case 149:\n                    case 148:\n                    case 150:\n                    case 151:\n                    case 152:\n                    case 225:\n                    case 185:\n                        if (meaning & 3 && name === \"arguments\") {\n                            result = argumentsSymbol;\n                            break loop;\n                        }\n                        break;\n                    case 184:\n                        if (meaning & 3 && name === \"arguments\") {\n                            result = argumentsSymbol;\n                            break loop;\n                        }\n                        if (meaning & 16) {\n                            var functionName = location.name;\n                            if (functionName && name === functionName.text) {\n                                result = location.symbol;\n                                break loop;\n                            }\n                        }\n                        break;\n                    case 145:\n                        if (location.parent && location.parent.kind === 144) {\n                            location = location.parent;\n                        }\n                        if (location.parent && ts.isClassElement(location.parent)) {\n                            location = location.parent;\n                        }\n                        break;\n                }\n                lastLocation = location;\n                location = location.parent;\n            }\n            if (result && nameNotFoundMessage && noUnusedIdentifiers) {\n                result.isReferenced = true;\n            }\n            if (!result) {\n                result = getSymbol(globals, name, meaning);\n            }\n            if (!result) {\n                if (nameNotFoundMessage) {\n                    if (!errorLocation ||\n                        !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&\n                            !checkAndReportErrorForExtendingInterface(errorLocation) &&\n                            !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&\n                            !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) {\n                        error(errorLocation, nameNotFoundMessage, typeof nameArg === \"string\" ? nameArg : ts.declarationNameToString(nameArg));\n                    }\n                }\n                return undefined;\n            }\n            if (nameNotFoundMessage) {\n                if (propertyWithInvalidInitializer) {\n                    var propertyName = propertyWithInvalidInitializer.name;\n                    error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), typeof nameArg === \"string\" ? nameArg : ts.declarationNameToString(nameArg));\n                    return undefined;\n                }\n                if (meaning & 2) {\n                    var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);\n                    if (exportOrLocalSymbol.flags & 2) {\n                        checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);\n                    }\n                }\n                if (result && isInExternalModule && (meaning & 107455) === 107455) {\n                    var decls = result.declarations;\n                    if (decls && decls.length === 1 && decls[0].kind === 233) {\n                        error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name);\n                    }\n                }\n            }\n            return result;\n        }\n        function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) {\n            if ((errorLocation.kind === 70 && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) {\n                return false;\n            }\n            var container = ts.getThisContainer(errorLocation, true);\n            var location = container;\n            while (location) {\n                if (ts.isClassLike(location.parent)) {\n                    var classSymbol = getSymbolOfNode(location.parent);\n                    if (!classSymbol) {\n                        break;\n                    }\n                    var constructorType = getTypeOfSymbol(classSymbol);\n                    if (getPropertyOfType(constructorType, name)) {\n                        error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, typeof nameArg === \"string\" ? nameArg : ts.declarationNameToString(nameArg), symbolToString(classSymbol));\n                        return true;\n                    }\n                    if (location === container && !(ts.getModifierFlags(location) & 32)) {\n                        var instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType;\n                        if (getPropertyOfType(instanceType, name)) {\n                            error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, typeof nameArg === \"string\" ? nameArg : ts.declarationNameToString(nameArg));\n                            return true;\n                        }\n                    }\n                }\n                location = location.parent;\n            }\n            return false;\n        }\n        function checkAndReportErrorForExtendingInterface(errorLocation) {\n            var expression = getEntityNameForExtendingInterface(errorLocation);\n            var isError = !!(expression && resolveEntityName(expression, 64, true));\n            if (isError) {\n                error(errorLocation, ts.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements, ts.getTextOfNode(expression));\n            }\n            return isError;\n        }\n        function getEntityNameForExtendingInterface(node) {\n            switch (node.kind) {\n                case 70:\n                case 177:\n                    return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined;\n                case 199:\n                    ts.Debug.assert(ts.isEntityNameExpression(node.expression));\n                    return node.expression;\n                default:\n                    return undefined;\n            }\n        }\n        function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) {\n            if (meaning === 1920) {\n                var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined));\n                if (symbol) {\n                    error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, name);\n                    return true;\n                }\n            }\n            return false;\n        }\n        function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {\n            if (meaning & (107455 & ~1024)) {\n                var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined));\n                if (symbol && !(symbol.flags & 1024)) {\n                    error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, name);\n                    return true;\n                }\n            }\n            return false;\n        }\n        function checkResolvedBlockScopedVariable(result, errorLocation) {\n            ts.Debug.assert((result.flags & 2) !== 0);\n            var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; });\n            ts.Debug.assert(declaration !== undefined, \"Block-scoped variable declaration is undefined\");\n            if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 223), errorLocation)) {\n                error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name));\n            }\n        }\n        function isSameScopeDescendentOf(initial, parent, stopAt) {\n            if (!parent) {\n                return false;\n            }\n            for (var current = initial; current && current !== stopAt && !ts.isFunctionLike(current); current = current.parent) {\n                if (current === parent) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function getAnyImportSyntax(node) {\n            if (ts.isAliasSymbolDeclaration(node)) {\n                if (node.kind === 234) {\n                    return node;\n                }\n                while (node && node.kind !== 235) {\n                    node = node.parent;\n                }\n                return node;\n            }\n        }\n        function getDeclarationOfAliasSymbol(symbol) {\n            return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; });\n        }\n        function getTargetOfImportEqualsDeclaration(node) {\n            if (node.moduleReference.kind === 245) {\n                return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node)));\n            }\n            return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference);\n        }\n        function getTargetOfImportClause(node) {\n            var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);\n            if (moduleSymbol) {\n                var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ?\n                    moduleSymbol :\n                    moduleSymbol.exports[\"export=\"] ?\n                        getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports[\"export=\"]), \"default\") :\n                        resolveSymbol(moduleSymbol.exports[\"default\"]);\n                if (!exportDefaultSymbol && !allowSyntheticDefaultImports) {\n                    error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));\n                }\n                else if (!exportDefaultSymbol && allowSyntheticDefaultImports) {\n                    return resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol);\n                }\n                return exportDefaultSymbol;\n            }\n        }\n        function getTargetOfNamespaceImport(node) {\n            var moduleSpecifier = node.parent.parent.moduleSpecifier;\n            return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier);\n        }\n        function combineValueAndTypeSymbols(valueSymbol, typeSymbol) {\n            if (valueSymbol.flags & (793064 | 1920)) {\n                return valueSymbol;\n            }\n            var result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.name);\n            result.declarations = ts.concatenate(valueSymbol.declarations, typeSymbol.declarations);\n            result.parent = valueSymbol.parent || typeSymbol.parent;\n            if (valueSymbol.valueDeclaration)\n                result.valueDeclaration = valueSymbol.valueDeclaration;\n            if (typeSymbol.members)\n                result.members = typeSymbol.members;\n            if (valueSymbol.exports)\n                result.exports = valueSymbol.exports;\n            return result;\n        }\n        function getExportOfModule(symbol, name) {\n            if (symbol.flags & 1536) {\n                var exportedSymbol = getExportsOfSymbol(symbol)[name];\n                if (exportedSymbol) {\n                    return resolveSymbol(exportedSymbol);\n                }\n            }\n        }\n        function getPropertyOfVariable(symbol, name) {\n            if (symbol.flags & 3) {\n                var typeAnnotation = symbol.valueDeclaration.type;\n                if (typeAnnotation) {\n                    return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name));\n                }\n            }\n        }\n        function getExternalModuleMember(node, specifier) {\n            var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);\n            var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier);\n            if (targetSymbol) {\n                var name_16 = specifier.propertyName || specifier.name;\n                if (name_16.text) {\n                    if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {\n                        return moduleSymbol;\n                    }\n                    var symbolFromVariable = void 0;\n                    if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports[\"export=\"]) {\n                        symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_16.text);\n                    }\n                    else {\n                        symbolFromVariable = getPropertyOfVariable(targetSymbol, name_16.text);\n                    }\n                    symbolFromVariable = resolveSymbol(symbolFromVariable);\n                    var symbolFromModule = getExportOfModule(targetSymbol, name_16.text);\n                    if (!symbolFromModule && allowSyntheticDefaultImports && name_16.text === \"default\") {\n                        symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol);\n                    }\n                    var symbol = symbolFromModule && symbolFromVariable ?\n                        combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :\n                        symbolFromModule || symbolFromVariable;\n                    if (!symbol) {\n                        error(name_16, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_16));\n                    }\n                    return symbol;\n                }\n            }\n        }\n        function getTargetOfImportSpecifier(node) {\n            return getExternalModuleMember(node.parent.parent.parent, node);\n        }\n        function getTargetOfNamespaceExportDeclaration(node) {\n            return resolveExternalModuleSymbol(node.parent.symbol);\n        }\n        function getTargetOfExportSpecifier(node) {\n            return node.parent.parent.moduleSpecifier ?\n                getExternalModuleMember(node.parent.parent, node) :\n                resolveEntityName(node.propertyName || node.name, 107455 | 793064 | 1920);\n        }\n        function getTargetOfExportAssignment(node) {\n            return resolveEntityName(node.expression, 107455 | 793064 | 1920);\n        }\n        function getTargetOfAliasDeclaration(node) {\n            switch (node.kind) {\n                case 234:\n                    return getTargetOfImportEqualsDeclaration(node);\n                case 236:\n                    return getTargetOfImportClause(node);\n                case 237:\n                    return getTargetOfNamespaceImport(node);\n                case 239:\n                    return getTargetOfImportSpecifier(node);\n                case 243:\n                    return getTargetOfExportSpecifier(node);\n                case 240:\n                    return getTargetOfExportAssignment(node);\n                case 233:\n                    return getTargetOfNamespaceExportDeclaration(node);\n            }\n        }\n        function resolveSymbol(symbol) {\n            return symbol && symbol.flags & 8388608 && !(symbol.flags & (107455 | 793064 | 1920)) ? resolveAlias(symbol) : symbol;\n        }\n        function resolveAlias(symbol) {\n            ts.Debug.assert((symbol.flags & 8388608) !== 0, \"Should only get Alias here.\");\n            var links = getSymbolLinks(symbol);\n            if (!links.target) {\n                links.target = resolvingSymbol;\n                var node = getDeclarationOfAliasSymbol(symbol);\n                ts.Debug.assert(!!node);\n                var target = getTargetOfAliasDeclaration(node);\n                if (links.target === resolvingSymbol) {\n                    links.target = target || unknownSymbol;\n                }\n                else {\n                    error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));\n                }\n            }\n            else if (links.target === resolvingSymbol) {\n                links.target = unknownSymbol;\n            }\n            return links.target;\n        }\n        function markExportAsReferenced(node) {\n            var symbol = getSymbolOfNode(node);\n            var target = resolveAlias(symbol);\n            if (target) {\n                var markAlias = target === unknownSymbol ||\n                    ((target.flags & 107455) && !isConstEnumOrConstEnumOnlyModule(target));\n                if (markAlias) {\n                    markAliasSymbolAsReferenced(symbol);\n                }\n            }\n        }\n        function markAliasSymbolAsReferenced(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.referenced) {\n                links.referenced = true;\n                var node = getDeclarationOfAliasSymbol(symbol);\n                ts.Debug.assert(!!node);\n                if (node.kind === 240) {\n                    checkExpressionCached(node.expression);\n                }\n                else if (node.kind === 243) {\n                    checkExpressionCached(node.propertyName || node.name);\n                }\n                else if (ts.isInternalModuleImportEqualsDeclaration(node)) {\n                    checkExpressionCached(node.moduleReference);\n                }\n            }\n        }\n        function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) {\n            if (entityName.kind === 70 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {\n                entityName = entityName.parent;\n            }\n            if (entityName.kind === 70 || entityName.parent.kind === 141) {\n                return resolveEntityName(entityName, 1920, false, dontResolveAlias);\n            }\n            else {\n                ts.Debug.assert(entityName.parent.kind === 234);\n                return resolveEntityName(entityName, 107455 | 793064 | 1920, false, dontResolveAlias);\n            }\n        }\n        function getFullyQualifiedName(symbol) {\n            return symbol.parent ? getFullyQualifiedName(symbol.parent) + \".\" + symbolToString(symbol) : symbolToString(symbol);\n        }\n        function resolveEntityName(name, meaning, ignoreErrors, dontResolveAlias, location) {\n            if (ts.nodeIsMissing(name)) {\n                return undefined;\n            }\n            var symbol;\n            if (name.kind === 70) {\n                var message = meaning === 1920 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0;\n                symbol = resolveName(location || name, name.text, meaning, ignoreErrors ? undefined : message, name);\n                if (!symbol) {\n                    return undefined;\n                }\n            }\n            else if (name.kind === 141 || name.kind === 177) {\n                var left = name.kind === 141 ? name.left : name.expression;\n                var right = name.kind === 141 ? name.right : name.name;\n                var namespace = resolveEntityName(left, 1920, ignoreErrors, false, location);\n                if (!namespace || ts.nodeIsMissing(right)) {\n                    return undefined;\n                }\n                else if (namespace === unknownSymbol) {\n                    return namespace;\n                }\n                symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning);\n                if (!symbol) {\n                    if (!ignoreErrors) {\n                        error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right));\n                    }\n                    return undefined;\n                }\n            }\n            else {\n                ts.Debug.fail(\"Unknown entity name kind.\");\n            }\n            ts.Debug.assert((symbol.flags & 16777216) === 0, \"Should never get an instantiated symbol here.\");\n            return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol);\n        }\n        function resolveExternalModuleName(location, moduleReferenceExpression) {\n            return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ts.Diagnostics.Cannot_find_module_0);\n        }\n        function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation) {\n            if (isForAugmentation === void 0) { isForAugmentation = false; }\n            if (moduleReferenceExpression.kind !== 9) {\n                return;\n            }\n            var moduleReferenceLiteral = moduleReferenceExpression;\n            return resolveExternalModule(location, moduleReferenceLiteral.text, moduleNotFoundError, moduleReferenceLiteral, isForAugmentation);\n        }\n        function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {\n            if (isForAugmentation === void 0) { isForAugmentation = false; }\n            var moduleName = ts.escapeIdentifier(moduleReference);\n            if (moduleName === undefined) {\n                return;\n            }\n            var ambientModule = tryFindAmbientModule(moduleName, true);\n            if (ambientModule) {\n                return ambientModule;\n            }\n            var isRelative = ts.isExternalModuleNameRelative(moduleName);\n            var resolvedModule = ts.getResolvedModule(ts.getSourceFileOfNode(location), moduleReference);\n            var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);\n            var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);\n            if (sourceFile) {\n                if (sourceFile.symbol) {\n                    return getMergedSymbol(sourceFile.symbol);\n                }\n                if (moduleNotFoundError) {\n                    error(errorNode, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName);\n                }\n                return undefined;\n            }\n            if (patternAmbientModules) {\n                var pattern = ts.findBestPatternMatch(patternAmbientModules, function (_) { return _.pattern; }, moduleName);\n                if (pattern) {\n                    return getMergedSymbol(pattern.symbol);\n                }\n            }\n            if (!isRelative && resolvedModule && !ts.extensionIsTypeScript(resolvedModule.extension)) {\n                if (isForAugmentation) {\n                    ts.Debug.assert(!!moduleNotFoundError);\n                    var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;\n                    error(errorNode, diag, moduleName, resolvedModule.resolvedFileName);\n                }\n                else if (compilerOptions.noImplicitAny && moduleNotFoundError) {\n                    error(errorNode, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedModule.resolvedFileName);\n                }\n                return undefined;\n            }\n            if (moduleNotFoundError) {\n                if (resolutionDiagnostic) {\n                    error(errorNode, resolutionDiagnostic, moduleName, resolvedModule.resolvedFileName);\n                }\n                else {\n                    var tsExtension = ts.tryExtractTypeScriptExtension(moduleName);\n                    if (tsExtension) {\n                        var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;\n                        error(errorNode, diag, tsExtension, ts.removeExtension(moduleName, tsExtension));\n                    }\n                    else {\n                        error(errorNode, moduleNotFoundError, moduleName);\n                    }\n                }\n            }\n            return undefined;\n        }\n        function resolveExternalModuleSymbol(moduleSymbol) {\n            return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports[\"export=\"])) || moduleSymbol;\n        }\n        function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) {\n            var symbol = resolveExternalModuleSymbol(moduleSymbol);\n            if (symbol && !(symbol.flags & (1536 | 3))) {\n                error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol));\n                symbol = undefined;\n            }\n            return symbol;\n        }\n        function hasExportAssignmentSymbol(moduleSymbol) {\n            return moduleSymbol.exports[\"export=\"] !== undefined;\n        }\n        function getExportsOfModuleAsArray(moduleSymbol) {\n            return symbolsToArray(getExportsOfModule(moduleSymbol));\n        }\n        function tryGetMemberInModuleExports(memberName, moduleSymbol) {\n            var symbolTable = getExportsOfModule(moduleSymbol);\n            if (symbolTable) {\n                return symbolTable[memberName];\n            }\n        }\n        function getExportsOfSymbol(symbol) {\n            return symbol.flags & 1536 ? getExportsOfModule(symbol) : symbol.exports || emptySymbols;\n        }\n        function getExportsOfModule(moduleSymbol) {\n            var links = getSymbolLinks(moduleSymbol);\n            return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol));\n        }\n        function extendExportSymbols(target, source, lookupTable, exportNode) {\n            for (var id in source) {\n                if (id !== \"default\" && !target[id]) {\n                    target[id] = source[id];\n                    if (lookupTable && exportNode) {\n                        lookupTable[id] = {\n                            specifierText: ts.getTextOfNode(exportNode.moduleSpecifier)\n                        };\n                    }\n                }\n                else if (lookupTable && exportNode && id !== \"default\" && target[id] && resolveSymbol(target[id]) !== resolveSymbol(source[id])) {\n                    if (!lookupTable[id].exportsWithDuplicate) {\n                        lookupTable[id].exportsWithDuplicate = [exportNode];\n                    }\n                    else {\n                        lookupTable[id].exportsWithDuplicate.push(exportNode);\n                    }\n                }\n            }\n        }\n        function getExportsForModule(moduleSymbol) {\n            var visitedSymbols = [];\n            moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);\n            return visit(moduleSymbol) || moduleSymbol.exports;\n            function visit(symbol) {\n                if (!(symbol && symbol.flags & 1952 && !ts.contains(visitedSymbols, symbol))) {\n                    return;\n                }\n                visitedSymbols.push(symbol);\n                var symbols = ts.cloneMap(symbol.exports);\n                var exportStars = symbol.exports[\"__export\"];\n                if (exportStars) {\n                    var nestedSymbols = ts.createMap();\n                    var lookupTable = ts.createMap();\n                    for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) {\n                        var node = _a[_i];\n                        var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);\n                        var exportedSymbols = visit(resolvedModule);\n                        extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node);\n                    }\n                    for (var id in lookupTable) {\n                        var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate;\n                        if (id === \"export=\" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols[id]) {\n                            continue;\n                        }\n                        for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) {\n                            var node = exportsWithDuplicate_1[_b];\n                            diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id));\n                        }\n                    }\n                    extendExportSymbols(symbols, nestedSymbols);\n                }\n                return symbols;\n            }\n        }\n        function getMergedSymbol(symbol) {\n            var merged;\n            return symbol && symbol.mergeId && (merged = mergedSymbols[symbol.mergeId]) ? merged : symbol;\n        }\n        function getSymbolOfNode(node) {\n            return getMergedSymbol(node.symbol);\n        }\n        function getParentOfSymbol(symbol) {\n            return getMergedSymbol(symbol.parent);\n        }\n        function getExportSymbolOfValueSymbolIfExported(symbol) {\n            return symbol && (symbol.flags & 1048576) !== 0\n                ? getMergedSymbol(symbol.exportSymbol)\n                : symbol;\n        }\n        function symbolIsValue(symbol) {\n            if (symbol.flags & 16777216) {\n                return symbolIsValue(getSymbolLinks(symbol).target);\n            }\n            if (symbol.flags & 107455) {\n                return true;\n            }\n            if (symbol.flags & 8388608) {\n                return (resolveAlias(symbol).flags & 107455) !== 0;\n            }\n            return false;\n        }\n        function findConstructorDeclaration(node) {\n            var members = node.members;\n            for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {\n                var member = members_1[_i];\n                if (member.kind === 150 && ts.nodeIsPresent(member.body)) {\n                    return member;\n                }\n            }\n        }\n        function createType(flags) {\n            var result = new Type(checker, flags);\n            typeCount++;\n            result.id = typeCount;\n            return result;\n        }\n        function createIntrinsicType(kind, intrinsicName) {\n            var type = createType(kind);\n            type.intrinsicName = intrinsicName;\n            return type;\n        }\n        function createBooleanType(trueFalseTypes) {\n            var type = getUnionType(trueFalseTypes);\n            type.flags |= 8;\n            type.intrinsicName = \"boolean\";\n            return type;\n        }\n        function createObjectType(objectFlags, symbol) {\n            var type = createType(32768);\n            type.objectFlags = objectFlags;\n            type.symbol = symbol;\n            return type;\n        }\n        function isReservedMemberName(name) {\n            return name.charCodeAt(0) === 95 &&\n                name.charCodeAt(1) === 95 &&\n                name.charCodeAt(2) !== 95 &&\n                name.charCodeAt(2) !== 64;\n        }\n        function getNamedMembers(members) {\n            var result;\n            for (var id in members) {\n                if (!isReservedMemberName(id)) {\n                    if (!result)\n                        result = [];\n                    var symbol = members[id];\n                    if (symbolIsValue(symbol)) {\n                        result.push(symbol);\n                    }\n                }\n            }\n            return result || emptyArray;\n        }\n        function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) {\n            type.members = members;\n            type.properties = getNamedMembers(members);\n            type.callSignatures = callSignatures;\n            type.constructSignatures = constructSignatures;\n            if (stringIndexInfo)\n                type.stringIndexInfo = stringIndexInfo;\n            if (numberIndexInfo)\n                type.numberIndexInfo = numberIndexInfo;\n            return type;\n        }\n        function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) {\n            return setStructuredTypeMembers(createObjectType(16, symbol), members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n        }\n        function forEachSymbolTableInScope(enclosingDeclaration, callback) {\n            var result;\n            for (var location_1 = enclosingDeclaration; location_1; location_1 = location_1.parent) {\n                if (location_1.locals && !isGlobalSourceFile(location_1)) {\n                    if (result = callback(location_1.locals)) {\n                        return result;\n                    }\n                }\n                switch (location_1.kind) {\n                    case 261:\n                        if (!ts.isExternalOrCommonJsModule(location_1)) {\n                            break;\n                        }\n                    case 230:\n                        if (result = callback(getSymbolOfNode(location_1).exports)) {\n                            return result;\n                        }\n                        break;\n                }\n            }\n            return callback(globals);\n        }\n        function getQualifiedLeftMeaning(rightMeaning) {\n            return rightMeaning === 107455 ? 107455 : 1920;\n        }\n        function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) {\n            function getAccessibleSymbolChainFromSymbolTable(symbols) {\n                function canQualifySymbol(symbolFromSymbolTable, meaning) {\n                    if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) {\n                        return true;\n                    }\n                    var accessibleParent = getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning), useOnlyExternalAliasing);\n                    return !!accessibleParent;\n                }\n                function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) {\n                    if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) {\n                        return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) &&\n                            canQualifySymbol(symbolFromSymbolTable, meaning);\n                    }\n                }\n                if (isAccessible(symbols[symbol.name])) {\n                    return [symbol];\n                }\n                return ts.forEachProperty(symbols, function (symbolFromSymbolTable) {\n                    if (symbolFromSymbolTable.flags & 8388608\n                        && symbolFromSymbolTable.name !== \"export=\"\n                        && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) {\n                        if (!useOnlyExternalAliasing ||\n                            ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) {\n                            var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);\n                            if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) {\n                                return [symbolFromSymbolTable];\n                            }\n                            var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined;\n                            if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) {\n                                return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports);\n                            }\n                        }\n                    }\n                });\n            }\n            if (symbol) {\n                if (!(isPropertyOrMethodDeclarationSymbol(symbol))) {\n                    return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable);\n                }\n            }\n        }\n        function needsQualification(symbol, enclosingDeclaration, meaning) {\n            var qualify = false;\n            forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) {\n                var symbolFromSymbolTable = symbolTable[symbol.name];\n                if (!symbolFromSymbolTable) {\n                    return false;\n                }\n                if (symbolFromSymbolTable === symbol) {\n                    return true;\n                }\n                symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;\n                if (symbolFromSymbolTable.flags & meaning) {\n                    qualify = true;\n                    return true;\n                }\n                return false;\n            });\n            return qualify;\n        }\n        function isPropertyOrMethodDeclarationSymbol(symbol) {\n            if (symbol.declarations && symbol.declarations.length) {\n                for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                    var declaration = _a[_i];\n                    switch (declaration.kind) {\n                        case 147:\n                        case 149:\n                        case 151:\n                        case 152:\n                            continue;\n                        default:\n                            return false;\n                    }\n                }\n                return true;\n            }\n            return false;\n        }\n        function isSymbolAccessible(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible) {\n            if (symbol && enclosingDeclaration && !(symbol.flags & 262144)) {\n                var initialSymbol = symbol;\n                var meaningToLook = meaning;\n                while (symbol) {\n                    var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, false);\n                    if (accessibleSymbolChain) {\n                        var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0], shouldComputeAliasesToMakeVisible);\n                        if (!hasAccessibleDeclarations) {\n                            return {\n                                accessibility: 1,\n                                errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),\n                                errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, 1920) : undefined,\n                            };\n                        }\n                        return hasAccessibleDeclarations;\n                    }\n                    meaningToLook = getQualifiedLeftMeaning(meaning);\n                    symbol = getParentOfSymbol(symbol);\n                }\n                var symbolExternalModule = ts.forEach(initialSymbol.declarations, getExternalModuleContainer);\n                if (symbolExternalModule) {\n                    var enclosingExternalModule = getExternalModuleContainer(enclosingDeclaration);\n                    if (symbolExternalModule !== enclosingExternalModule) {\n                        return {\n                            accessibility: 2,\n                            errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),\n                            errorModuleName: symbolToString(symbolExternalModule)\n                        };\n                    }\n                }\n                return {\n                    accessibility: 1,\n                    errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),\n                };\n            }\n            return { accessibility: 0 };\n            function getExternalModuleContainer(declaration) {\n                for (; declaration; declaration = declaration.parent) {\n                    if (hasExternalModuleSymbol(declaration)) {\n                        return getSymbolOfNode(declaration);\n                    }\n                }\n            }\n        }\n        function hasExternalModuleSymbol(declaration) {\n            return ts.isAmbientModule(declaration) || (declaration.kind === 261 && ts.isExternalOrCommonJsModule(declaration));\n        }\n        function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {\n            var aliasesToMakeVisible;\n            if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) {\n                return undefined;\n            }\n            return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible };\n            function getIsDeclarationVisible(declaration) {\n                if (!isDeclarationVisible(declaration)) {\n                    var anyImportSyntax = getAnyImportSyntax(declaration);\n                    if (anyImportSyntax &&\n                        !(ts.getModifierFlags(anyImportSyntax) & 1) &&\n                        isDeclarationVisible(anyImportSyntax.parent)) {\n                        if (shouldComputeAliasToMakeVisible) {\n                            getNodeLinks(declaration).isVisible = true;\n                            if (aliasesToMakeVisible) {\n                                if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) {\n                                    aliasesToMakeVisible.push(anyImportSyntax);\n                                }\n                            }\n                            else {\n                                aliasesToMakeVisible = [anyImportSyntax];\n                            }\n                        }\n                        return true;\n                    }\n                    return false;\n                }\n                return true;\n            }\n        }\n        function isEntityNameVisible(entityName, enclosingDeclaration) {\n            var meaning;\n            if (entityName.parent.kind === 160 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {\n                meaning = 107455 | 1048576;\n            }\n            else if (entityName.kind === 141 || entityName.kind === 177 ||\n                entityName.parent.kind === 234) {\n                meaning = 1920;\n            }\n            else {\n                meaning = 793064;\n            }\n            var firstIdentifier = getFirstIdentifier(entityName);\n            var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, undefined, undefined);\n            return (symbol && hasVisibleDeclarations(symbol, true)) || {\n                accessibility: 1,\n                errorSymbolName: ts.getTextOfNode(firstIdentifier),\n                errorNode: firstIdentifier\n            };\n        }\n        function writeKeyword(writer, kind) {\n            writer.writeKeyword(ts.tokenToString(kind));\n        }\n        function writePunctuation(writer, kind) {\n            writer.writePunctuation(ts.tokenToString(kind));\n        }\n        function writeSpace(writer) {\n            writer.writeSpace(\" \");\n        }\n        function symbolToString(symbol, enclosingDeclaration, meaning) {\n            var writer = ts.getSingleLineStringWriter();\n            getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning);\n            var result = writer.string();\n            ts.releaseStringWriter(writer);\n            return result;\n        }\n        function signatureToString(signature, enclosingDeclaration, flags, kind) {\n            var writer = ts.getSingleLineStringWriter();\n            getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind);\n            var result = writer.string();\n            ts.releaseStringWriter(writer);\n            return result;\n        }\n        function typeToString(type, enclosingDeclaration, flags) {\n            var writer = ts.getSingleLineStringWriter();\n            getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);\n            var result = writer.string();\n            ts.releaseStringWriter(writer);\n            var maxLength = compilerOptions.noErrorTruncation || flags & 4 ? undefined : 100;\n            if (maxLength && result.length >= maxLength) {\n                result = result.substr(0, maxLength - \"...\".length) + \"...\";\n            }\n            return result;\n        }\n        function typePredicateToString(typePredicate, enclosingDeclaration, flags) {\n            var writer = ts.getSingleLineStringWriter();\n            getSymbolDisplayBuilder().buildTypePredicateDisplay(typePredicate, writer, enclosingDeclaration, flags);\n            var result = writer.string();\n            ts.releaseStringWriter(writer);\n            return result;\n        }\n        function formatUnionTypes(types) {\n            var result = [];\n            var flags = 0;\n            for (var i = 0; i < types.length; i++) {\n                var t = types[i];\n                flags |= t.flags;\n                if (!(t.flags & 6144)) {\n                    if (t.flags & (128 | 256)) {\n                        var baseType = t.flags & 128 ? booleanType : t.baseType;\n                        var count = baseType.types.length;\n                        if (i + count <= types.length && types[i + count - 1] === baseType.types[count - 1]) {\n                            result.push(baseType);\n                            i += count - 1;\n                            continue;\n                        }\n                    }\n                    result.push(t);\n                }\n            }\n            if (flags & 4096)\n                result.push(nullType);\n            if (flags & 2048)\n                result.push(undefinedType);\n            return result || types;\n        }\n        function visibilityToString(flags) {\n            if (flags === 8) {\n                return \"private\";\n            }\n            if (flags === 16) {\n                return \"protected\";\n            }\n            return \"public\";\n        }\n        function getTypeAliasForTypeLiteral(type) {\n            if (type.symbol && type.symbol.flags & 2048) {\n                var node = type.symbol.declarations[0].parent;\n                while (node.kind === 166) {\n                    node = node.parent;\n                }\n                if (node.kind === 228) {\n                    return getSymbolOfNode(node);\n                }\n            }\n            return undefined;\n        }\n        function isTopLevelInExternalModuleAugmentation(node) {\n            return node && node.parent &&\n                node.parent.kind === 231 &&\n                ts.isExternalModuleAugmentation(node.parent.parent);\n        }\n        function literalTypeToString(type) {\n            return type.flags & 32 ? \"\\\"\" + ts.escapeString(type.text) + \"\\\"\" : type.text;\n        }\n        function getSymbolDisplayBuilder() {\n            function getNameOfSymbol(symbol) {\n                if (symbol.declarations && symbol.declarations.length) {\n                    var declaration = symbol.declarations[0];\n                    if (declaration.name) {\n                        return ts.declarationNameToString(declaration.name);\n                    }\n                    switch (declaration.kind) {\n                        case 197:\n                            return \"(Anonymous class)\";\n                        case 184:\n                        case 185:\n                            return \"(Anonymous function)\";\n                    }\n                }\n                return symbol.name;\n            }\n            function appendSymbolNameOnly(symbol, writer) {\n                writer.writeSymbol(getNameOfSymbol(symbol), symbol);\n            }\n            function appendPropertyOrElementAccessForSymbol(symbol, writer) {\n                var symbolName = getNameOfSymbol(symbol);\n                var firstChar = symbolName.charCodeAt(0);\n                var needsElementAccess = !ts.isIdentifierStart(firstChar, languageVersion);\n                if (needsElementAccess) {\n                    writePunctuation(writer, 20);\n                    if (ts.isSingleOrDoubleQuote(firstChar)) {\n                        writer.writeStringLiteral(symbolName);\n                    }\n                    else {\n                        writer.writeSymbol(symbolName, symbol);\n                    }\n                    writePunctuation(writer, 21);\n                }\n                else {\n                    writePunctuation(writer, 22);\n                    writer.writeSymbol(symbolName, symbol);\n                }\n            }\n            function buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags, typeFlags) {\n                var parentSymbol;\n                function appendParentTypeArgumentsAndSymbolName(symbol) {\n                    if (parentSymbol) {\n                        if (flags & 1) {\n                            if (symbol.flags & 16777216) {\n                                buildDisplayForTypeArgumentsAndDelimiters(getTypeParametersOfClassOrInterface(parentSymbol), symbol.mapper, writer, enclosingDeclaration);\n                            }\n                            else {\n                                buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration);\n                            }\n                        }\n                        appendPropertyOrElementAccessForSymbol(symbol, writer);\n                    }\n                    else {\n                        appendSymbolNameOnly(symbol, writer);\n                    }\n                    parentSymbol = symbol;\n                }\n                writer.trackSymbol(symbol, enclosingDeclaration, meaning);\n                function walkSymbol(symbol, meaning, endOfChain) {\n                    var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2));\n                    if (!accessibleSymbolChain ||\n                        needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) {\n                        var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);\n                        if (parent_5) {\n                            walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), false);\n                        }\n                    }\n                    if (accessibleSymbolChain) {\n                        for (var _i = 0, accessibleSymbolChain_1 = accessibleSymbolChain; _i < accessibleSymbolChain_1.length; _i++) {\n                            var accessibleSymbol = accessibleSymbolChain_1[_i];\n                            appendParentTypeArgumentsAndSymbolName(accessibleSymbol);\n                        }\n                    }\n                    else if (endOfChain ||\n                        !(!parentSymbol && ts.forEach(symbol.declarations, hasExternalModuleSymbol)) &&\n                            !(symbol.flags & (2048 | 4096))) {\n                        appendParentTypeArgumentsAndSymbolName(symbol);\n                    }\n                }\n                var isTypeParameter = symbol.flags & 262144;\n                var typeFormatFlag = 128 & typeFlags;\n                if (!isTypeParameter && (enclosingDeclaration || typeFormatFlag)) {\n                    walkSymbol(symbol, meaning, true);\n                }\n                else {\n                    appendParentTypeArgumentsAndSymbolName(symbol);\n                }\n            }\n            function buildTypeDisplay(type, writer, enclosingDeclaration, globalFlags, symbolStack) {\n                var globalFlagsToPass = globalFlags & 16;\n                var inObjectTypeLiteral = false;\n                return writeType(type, globalFlags);\n                function writeType(type, flags) {\n                    var nextFlags = flags & ~512;\n                    if (type.flags & 16015) {\n                        writer.writeKeyword(!(globalFlags & 16) && isTypeAny(type)\n                            ? \"any\"\n                            : type.intrinsicName);\n                    }\n                    else if (type.flags & 16384 && type.isThisType) {\n                        if (inObjectTypeLiteral) {\n                            writer.reportInaccessibleThisError();\n                        }\n                        writer.writeKeyword(\"this\");\n                    }\n                    else if (getObjectFlags(type) & 4) {\n                        writeTypeReference(type, nextFlags);\n                    }\n                    else if (type.flags & 256) {\n                        buildSymbolDisplay(getParentOfSymbol(type.symbol), writer, enclosingDeclaration, 793064, 0, nextFlags);\n                        writePunctuation(writer, 22);\n                        appendSymbolNameOnly(type.symbol, writer);\n                    }\n                    else if (getObjectFlags(type) & 3 || type.flags & (16 | 16384)) {\n                        buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793064, 0, nextFlags);\n                    }\n                    else if (!(flags & 512) && type.aliasSymbol &&\n                        isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, 793064, false).accessibility === 0) {\n                        var typeArguments = type.aliasTypeArguments;\n                        writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);\n                    }\n                    else if (type.flags & 196608) {\n                        writeUnionOrIntersectionType(type, nextFlags);\n                    }\n                    else if (getObjectFlags(type) & (16 | 32)) {\n                        writeAnonymousType(type, nextFlags);\n                    }\n                    else if (type.flags & 96) {\n                        writer.writeStringLiteral(literalTypeToString(type));\n                    }\n                    else if (type.flags & 262144) {\n                        writer.writeKeyword(\"keyof\");\n                        writeSpace(writer);\n                        writeType(type.type, 64);\n                    }\n                    else if (type.flags & 524288) {\n                        writeType(type.objectType, 64);\n                        writePunctuation(writer, 20);\n                        writeType(type.indexType, 0);\n                        writePunctuation(writer, 21);\n                    }\n                    else {\n                        writePunctuation(writer, 16);\n                        writeSpace(writer);\n                        writePunctuation(writer, 23);\n                        writeSpace(writer);\n                        writePunctuation(writer, 17);\n                    }\n                }\n                function writeTypeList(types, delimiter) {\n                    for (var i = 0; i < types.length; i++) {\n                        if (i > 0) {\n                            if (delimiter !== 25) {\n                                writeSpace(writer);\n                            }\n                            writePunctuation(writer, delimiter);\n                            writeSpace(writer);\n                        }\n                        writeType(types[i], delimiter === 25 ? 0 : 64);\n                    }\n                }\n                function writeSymbolTypeReference(symbol, typeArguments, pos, end, flags) {\n                    if (symbol.flags & 32 || !isReservedMemberName(symbol.name)) {\n                        buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793064, 0, flags);\n                    }\n                    if (pos < end) {\n                        writePunctuation(writer, 26);\n                        writeType(typeArguments[pos], 256);\n                        pos++;\n                        while (pos < end) {\n                            writePunctuation(writer, 25);\n                            writeSpace(writer);\n                            writeType(typeArguments[pos], 0);\n                            pos++;\n                        }\n                        writePunctuation(writer, 28);\n                    }\n                }\n                function writeTypeReference(type, flags) {\n                    var typeArguments = type.typeArguments || emptyArray;\n                    if (type.target === globalArrayType && !(flags & 1)) {\n                        writeType(typeArguments[0], 64);\n                        writePunctuation(writer, 20);\n                        writePunctuation(writer, 21);\n                    }\n                    else if (type.target.objectFlags & 8) {\n                        writePunctuation(writer, 20);\n                        writeTypeList(type.typeArguments.slice(0, getTypeReferenceArity(type)), 25);\n                        writePunctuation(writer, 21);\n                    }\n                    else {\n                        var outerTypeParameters = type.target.outerTypeParameters;\n                        var i = 0;\n                        if (outerTypeParameters) {\n                            var length_1 = outerTypeParameters.length;\n                            while (i < length_1) {\n                                var start = i;\n                                var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]);\n                                do {\n                                    i++;\n                                } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6);\n                                if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) {\n                                    writeSymbolTypeReference(parent_6, typeArguments, start, i, flags);\n                                    writePunctuation(writer, 22);\n                                }\n                            }\n                        }\n                        var typeParameterCount = (type.target.typeParameters || emptyArray).length;\n                        writeSymbolTypeReference(type.symbol, typeArguments, i, typeParameterCount, flags);\n                    }\n                }\n                function writeUnionOrIntersectionType(type, flags) {\n                    if (flags & 64) {\n                        writePunctuation(writer, 18);\n                    }\n                    if (type.flags & 65536) {\n                        writeTypeList(formatUnionTypes(type.types), 48);\n                    }\n                    else {\n                        writeTypeList(type.types, 47);\n                    }\n                    if (flags & 64) {\n                        writePunctuation(writer, 19);\n                    }\n                }\n                function writeAnonymousType(type, flags) {\n                    var symbol = type.symbol;\n                    if (symbol) {\n                        if (symbol.flags & (32 | 384 | 512)) {\n                            writeTypeOfSymbol(type, flags);\n                        }\n                        else if (shouldWriteTypeOfFunctionSymbol()) {\n                            writeTypeOfSymbol(type, flags);\n                        }\n                        else if (ts.contains(symbolStack, symbol)) {\n                            var typeAlias = getTypeAliasForTypeLiteral(type);\n                            if (typeAlias) {\n                                buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 793064, 0, flags);\n                            }\n                            else {\n                                writeKeyword(writer, 118);\n                            }\n                        }\n                        else {\n                            if (!symbolStack) {\n                                symbolStack = [];\n                            }\n                            symbolStack.push(symbol);\n                            writeLiteralType(type, flags);\n                            symbolStack.pop();\n                        }\n                    }\n                    else {\n                        writeLiteralType(type, flags);\n                    }\n                    function shouldWriteTypeOfFunctionSymbol() {\n                        var isStaticMethodSymbol = !!(symbol.flags & 8192 &&\n                            ts.forEach(symbol.declarations, function (declaration) { return ts.getModifierFlags(declaration) & 32; }));\n                        var isNonLocalFunctionSymbol = !!(symbol.flags & 16) &&\n                            (symbol.parent ||\n                                ts.forEach(symbol.declarations, function (declaration) {\n                                    return declaration.parent.kind === 261 || declaration.parent.kind === 231;\n                                }));\n                        if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {\n                            return !!(flags & 2) ||\n                                (ts.contains(symbolStack, symbol));\n                        }\n                    }\n                }\n                function writeTypeOfSymbol(type, typeFormatFlags) {\n                    writeKeyword(writer, 102);\n                    writeSpace(writer);\n                    buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags);\n                }\n                function writeIndexSignature(info, keyword) {\n                    if (info) {\n                        if (info.isReadonly) {\n                            writeKeyword(writer, 130);\n                            writeSpace(writer);\n                        }\n                        writePunctuation(writer, 20);\n                        writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : \"x\");\n                        writePunctuation(writer, 55);\n                        writeSpace(writer);\n                        writeKeyword(writer, keyword);\n                        writePunctuation(writer, 21);\n                        writePunctuation(writer, 55);\n                        writeSpace(writer);\n                        writeType(info.type, 0);\n                        writePunctuation(writer, 24);\n                        writer.writeLine();\n                    }\n                }\n                function writePropertyWithModifiers(prop) {\n                    if (isReadonlySymbol(prop)) {\n                        writeKeyword(writer, 130);\n                        writeSpace(writer);\n                    }\n                    buildSymbolDisplay(prop, writer);\n                    if (prop.flags & 536870912) {\n                        writePunctuation(writer, 54);\n                    }\n                }\n                function shouldAddParenthesisAroundFunctionType(callSignature, flags) {\n                    if (flags & 64) {\n                        return true;\n                    }\n                    else if (flags & 256) {\n                        var typeParameters = callSignature.target && (flags & 32) ?\n                            callSignature.target.typeParameters : callSignature.typeParameters;\n                        return typeParameters && typeParameters.length !== 0;\n                    }\n                    return false;\n                }\n                function writeLiteralType(type, flags) {\n                    if (type.objectFlags & 32) {\n                        if (getConstraintTypeFromMappedType(type).flags & (16384 | 262144)) {\n                            writeMappedType(type);\n                            return;\n                        }\n                    }\n                    var resolved = resolveStructuredTypeMembers(type);\n                    if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {\n                        if (!resolved.callSignatures.length && !resolved.constructSignatures.length) {\n                            writePunctuation(writer, 16);\n                            writePunctuation(writer, 17);\n                            return;\n                        }\n                        if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) {\n                            var parenthesizeSignature = shouldAddParenthesisAroundFunctionType(resolved.callSignatures[0], flags);\n                            if (parenthesizeSignature) {\n                                writePunctuation(writer, 18);\n                            }\n                            buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, undefined, symbolStack);\n                            if (parenthesizeSignature) {\n                                writePunctuation(writer, 19);\n                            }\n                            return;\n                        }\n                        if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) {\n                            if (flags & 64) {\n                                writePunctuation(writer, 18);\n                            }\n                            writeKeyword(writer, 93);\n                            writeSpace(writer);\n                            buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, undefined, symbolStack);\n                            if (flags & 64) {\n                                writePunctuation(writer, 19);\n                            }\n                            return;\n                        }\n                    }\n                    var saveInObjectTypeLiteral = inObjectTypeLiteral;\n                    inObjectTypeLiteral = true;\n                    writePunctuation(writer, 16);\n                    writer.writeLine();\n                    writer.increaseIndent();\n                    writeObjectLiteralType(resolved);\n                    writer.decreaseIndent();\n                    writePunctuation(writer, 17);\n                    inObjectTypeLiteral = saveInObjectTypeLiteral;\n                }\n                function writeObjectLiteralType(resolved) {\n                    for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) {\n                        var signature = _a[_i];\n                        buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, undefined, symbolStack);\n                        writePunctuation(writer, 24);\n                        writer.writeLine();\n                    }\n                    for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) {\n                        var signature = _c[_b];\n                        buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, 1, symbolStack);\n                        writePunctuation(writer, 24);\n                        writer.writeLine();\n                    }\n                    writeIndexSignature(resolved.stringIndexInfo, 134);\n                    writeIndexSignature(resolved.numberIndexInfo, 132);\n                    for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) {\n                        var p = _e[_d];\n                        var t = getTypeOfSymbol(p);\n                        if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) {\n                            var signatures = getSignaturesOfType(t, 0);\n                            for (var _f = 0, signatures_1 = signatures; _f < signatures_1.length; _f++) {\n                                var signature = signatures_1[_f];\n                                writePropertyWithModifiers(p);\n                                buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, undefined, symbolStack);\n                                writePunctuation(writer, 24);\n                                writer.writeLine();\n                            }\n                        }\n                        else {\n                            writePropertyWithModifiers(p);\n                            writePunctuation(writer, 55);\n                            writeSpace(writer);\n                            writeType(t, 0);\n                            writePunctuation(writer, 24);\n                            writer.writeLine();\n                        }\n                    }\n                }\n                function writeMappedType(type) {\n                    writePunctuation(writer, 16);\n                    writer.writeLine();\n                    writer.increaseIndent();\n                    if (type.declaration.readonlyToken) {\n                        writeKeyword(writer, 130);\n                        writeSpace(writer);\n                    }\n                    writePunctuation(writer, 20);\n                    appendSymbolNameOnly(getTypeParameterFromMappedType(type).symbol, writer);\n                    writeSpace(writer);\n                    writeKeyword(writer, 91);\n                    writeSpace(writer);\n                    writeType(getConstraintTypeFromMappedType(type), 0);\n                    writePunctuation(writer, 21);\n                    if (type.declaration.questionToken) {\n                        writePunctuation(writer, 54);\n                    }\n                    writePunctuation(writer, 55);\n                    writeSpace(writer);\n                    writeType(getTemplateTypeFromMappedType(type), 0);\n                    writePunctuation(writer, 24);\n                    writer.writeLine();\n                    writer.decreaseIndent();\n                    writePunctuation(writer, 17);\n                }\n            }\n            function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration, flags) {\n                var targetSymbol = getTargetSymbol(symbol);\n                if (targetSymbol.flags & 32 || targetSymbol.flags & 64 || targetSymbol.flags & 524288) {\n                    buildDisplayForTypeParametersAndDelimiters(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol), writer, enclosingDeclaration, flags);\n                }\n            }\n            function buildTypeParameterDisplay(tp, writer, enclosingDeclaration, flags, symbolStack) {\n                appendSymbolNameOnly(tp.symbol, writer);\n                var constraint = getConstraintOfTypeParameter(tp);\n                if (constraint) {\n                    writeSpace(writer);\n                    writeKeyword(writer, 84);\n                    writeSpace(writer);\n                    buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack);\n                }\n            }\n            function buildParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack) {\n                var parameterNode = p.valueDeclaration;\n                if (ts.isRestParameter(parameterNode)) {\n                    writePunctuation(writer, 23);\n                }\n                if (ts.isBindingPattern(parameterNode.name)) {\n                    buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack);\n                }\n                else {\n                    appendSymbolNameOnly(p, writer);\n                }\n                if (isOptionalParameter(parameterNode)) {\n                    writePunctuation(writer, 54);\n                }\n                writePunctuation(writer, 55);\n                writeSpace(writer);\n                buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack);\n            }\n            function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) {\n                if (bindingPattern.kind === 172) {\n                    writePunctuation(writer, 16);\n                    buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); });\n                    writePunctuation(writer, 17);\n                }\n                else if (bindingPattern.kind === 173) {\n                    writePunctuation(writer, 20);\n                    var elements = bindingPattern.elements;\n                    buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); });\n                    if (elements && elements.hasTrailingComma) {\n                        writePunctuation(writer, 25);\n                    }\n                    writePunctuation(writer, 21);\n                }\n            }\n            function buildBindingElementDisplay(bindingElement, writer, enclosingDeclaration, flags, symbolStack) {\n                if (ts.isOmittedExpression(bindingElement)) {\n                    return;\n                }\n                ts.Debug.assert(bindingElement.kind === 174);\n                if (bindingElement.propertyName) {\n                    writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol);\n                    writePunctuation(writer, 55);\n                    writeSpace(writer);\n                }\n                if (ts.isBindingPattern(bindingElement.name)) {\n                    buildBindingPatternDisplay(bindingElement.name, writer, enclosingDeclaration, flags, symbolStack);\n                }\n                else {\n                    if (bindingElement.dotDotDotToken) {\n                        writePunctuation(writer, 23);\n                    }\n                    appendSymbolNameOnly(bindingElement.symbol, writer);\n                }\n            }\n            function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) {\n                if (typeParameters && typeParameters.length) {\n                    writePunctuation(writer, 26);\n                    buildDisplayForCommaSeparatedList(typeParameters, writer, function (p) { return buildTypeParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack); });\n                    writePunctuation(writer, 28);\n                }\n            }\n            function buildDisplayForCommaSeparatedList(list, writer, action) {\n                for (var i = 0; i < list.length; i++) {\n                    if (i > 0) {\n                        writePunctuation(writer, 25);\n                        writeSpace(writer);\n                    }\n                    action(list[i]);\n                }\n            }\n            function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration) {\n                if (typeParameters && typeParameters.length) {\n                    writePunctuation(writer, 26);\n                    var flags = 256;\n                    for (var i = 0; i < typeParameters.length; i++) {\n                        if (i > 0) {\n                            writePunctuation(writer, 25);\n                            writeSpace(writer);\n                            flags = 0;\n                        }\n                        buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, flags);\n                    }\n                    writePunctuation(writer, 28);\n                }\n            }\n            function buildDisplayForParametersAndDelimiters(thisParameter, parameters, writer, enclosingDeclaration, flags, symbolStack) {\n                writePunctuation(writer, 18);\n                if (thisParameter) {\n                    buildParameterDisplay(thisParameter, writer, enclosingDeclaration, flags, symbolStack);\n                }\n                for (var i = 0; i < parameters.length; i++) {\n                    if (i > 0 || thisParameter) {\n                        writePunctuation(writer, 25);\n                        writeSpace(writer);\n                    }\n                    buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, symbolStack);\n                }\n                writePunctuation(writer, 19);\n            }\n            function buildTypePredicateDisplay(predicate, writer, enclosingDeclaration, flags, symbolStack) {\n                if (ts.isIdentifierTypePredicate(predicate)) {\n                    writer.writeParameter(predicate.parameterName);\n                }\n                else {\n                    writeKeyword(writer, 98);\n                }\n                writeSpace(writer);\n                writeKeyword(writer, 125);\n                writeSpace(writer);\n                buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack);\n            }\n            function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) {\n                if (flags & 8) {\n                    writeSpace(writer);\n                    writePunctuation(writer, 35);\n                }\n                else {\n                    writePunctuation(writer, 55);\n                }\n                writeSpace(writer);\n                if (signature.typePredicate) {\n                    buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack);\n                }\n                else {\n                    var returnType = getReturnTypeOfSignature(signature);\n                    buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack);\n                }\n            }\n            function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind, symbolStack) {\n                if (kind === 1) {\n                    writeKeyword(writer, 93);\n                    writeSpace(writer);\n                }\n                if (signature.target && (flags & 32)) {\n                    buildDisplayForTypeArgumentsAndDelimiters(signature.target.typeParameters, signature.mapper, writer, enclosingDeclaration);\n                }\n                else {\n                    buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, symbolStack);\n                }\n                buildDisplayForParametersAndDelimiters(signature.thisParameter, signature.parameters, writer, enclosingDeclaration, flags, symbolStack);\n                buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack);\n            }\n            return _displayBuilder || (_displayBuilder = {\n                buildSymbolDisplay: buildSymbolDisplay,\n                buildTypeDisplay: buildTypeDisplay,\n                buildTypeParameterDisplay: buildTypeParameterDisplay,\n                buildTypePredicateDisplay: buildTypePredicateDisplay,\n                buildParameterDisplay: buildParameterDisplay,\n                buildDisplayForParametersAndDelimiters: buildDisplayForParametersAndDelimiters,\n                buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters,\n                buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol,\n                buildSignatureDisplay: buildSignatureDisplay,\n                buildReturnTypeDisplay: buildReturnTypeDisplay\n            });\n        }\n        function isDeclarationVisible(node) {\n            if (node) {\n                var links = getNodeLinks(node);\n                if (links.isVisible === undefined) {\n                    links.isVisible = !!determineIfDeclarationIsVisible();\n                }\n                return links.isVisible;\n            }\n            return false;\n            function determineIfDeclarationIsVisible() {\n                switch (node.kind) {\n                    case 174:\n                        return isDeclarationVisible(node.parent.parent);\n                    case 223:\n                        if (ts.isBindingPattern(node.name) &&\n                            !node.name.elements.length) {\n                            return false;\n                        }\n                    case 230:\n                    case 226:\n                    case 227:\n                    case 228:\n                    case 225:\n                    case 229:\n                    case 234:\n                        if (ts.isExternalModuleAugmentation(node)) {\n                            return true;\n                        }\n                        var parent_7 = getDeclarationContainer(node);\n                        if (!(ts.getCombinedModifierFlags(node) & 1) &&\n                            !(node.kind !== 234 && parent_7.kind !== 261 && ts.isInAmbientContext(parent_7))) {\n                            return isGlobalSourceFile(parent_7);\n                        }\n                        return isDeclarationVisible(parent_7);\n                    case 147:\n                    case 146:\n                    case 151:\n                    case 152:\n                    case 149:\n                    case 148:\n                        if (ts.getModifierFlags(node) & (8 | 16)) {\n                            return false;\n                        }\n                    case 150:\n                    case 154:\n                    case 153:\n                    case 155:\n                    case 144:\n                    case 231:\n                    case 158:\n                    case 159:\n                    case 161:\n                    case 157:\n                    case 162:\n                    case 163:\n                    case 164:\n                    case 165:\n                    case 166:\n                        return isDeclarationVisible(node.parent);\n                    case 236:\n                    case 237:\n                    case 239:\n                        return false;\n                    case 143:\n                    case 261:\n                    case 233:\n                        return true;\n                    case 240:\n                        return false;\n                    default:\n                        return false;\n                }\n            }\n        }\n        function collectLinkedAliases(node) {\n            var exportSymbol;\n            if (node.parent && node.parent.kind === 240) {\n                exportSymbol = resolveName(node.parent, node.text, 107455 | 793064 | 1920 | 8388608, ts.Diagnostics.Cannot_find_name_0, node);\n            }\n            else if (node.parent.kind === 243) {\n                var exportSpecifier = node.parent;\n                exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ?\n                    getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) :\n                    resolveEntityName(exportSpecifier.propertyName || exportSpecifier.name, 107455 | 793064 | 1920 | 8388608);\n            }\n            var result = [];\n            if (exportSymbol) {\n                buildVisibleNodeList(exportSymbol.declarations);\n            }\n            return result;\n            function buildVisibleNodeList(declarations) {\n                ts.forEach(declarations, function (declaration) {\n                    getNodeLinks(declaration).isVisible = true;\n                    var resultNode = getAnyImportSyntax(declaration) || declaration;\n                    if (!ts.contains(result, resultNode)) {\n                        result.push(resultNode);\n                    }\n                    if (ts.isInternalModuleImportEqualsDeclaration(declaration)) {\n                        var internalModuleReference = declaration.moduleReference;\n                        var firstIdentifier = getFirstIdentifier(internalModuleReference);\n                        var importSymbol = resolveName(declaration, firstIdentifier.text, 107455 | 793064 | 1920, undefined, undefined);\n                        if (importSymbol) {\n                            buildVisibleNodeList(importSymbol.declarations);\n                        }\n                    }\n                });\n            }\n        }\n        function pushTypeResolution(target, propertyName) {\n            var resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName);\n            if (resolutionCycleStartIndex >= 0) {\n                var length_2 = resolutionTargets.length;\n                for (var i = resolutionCycleStartIndex; i < length_2; i++) {\n                    resolutionResults[i] = false;\n                }\n                return false;\n            }\n            resolutionTargets.push(target);\n            resolutionResults.push(true);\n            resolutionPropertyNames.push(propertyName);\n            return true;\n        }\n        function findResolutionCycleStartIndex(target, propertyName) {\n            for (var i = resolutionTargets.length - 1; i >= 0; i--) {\n                if (hasType(resolutionTargets[i], resolutionPropertyNames[i])) {\n                    return -1;\n                }\n                if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {\n                    return i;\n                }\n            }\n            return -1;\n        }\n        function hasType(target, propertyName) {\n            if (propertyName === 0) {\n                return getSymbolLinks(target).type;\n            }\n            if (propertyName === 2) {\n                return getSymbolLinks(target).declaredType;\n            }\n            if (propertyName === 1) {\n                return target.resolvedBaseConstructorType;\n            }\n            if (propertyName === 3) {\n                return target.resolvedReturnType;\n            }\n            ts.Debug.fail(\"Unhandled TypeSystemPropertyName \" + propertyName);\n        }\n        function popTypeResolution() {\n            resolutionTargets.pop();\n            resolutionPropertyNames.pop();\n            return resolutionResults.pop();\n        }\n        function getDeclarationContainer(node) {\n            node = ts.getRootDeclaration(node);\n            while (node) {\n                switch (node.kind) {\n                    case 223:\n                    case 224:\n                    case 239:\n                    case 238:\n                    case 237:\n                    case 236:\n                        node = node.parent;\n                        break;\n                    default:\n                        return node.parent;\n                }\n            }\n        }\n        function getTypeOfPrototypeProperty(prototype) {\n            var classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype));\n            return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType;\n        }\n        function getTypeOfPropertyOfType(type, name) {\n            var prop = getPropertyOfType(type, name);\n            return prop ? getTypeOfSymbol(prop) : undefined;\n        }\n        function isTypeAny(type) {\n            return type && (type.flags & 1) !== 0;\n        }\n        function isTypeNever(type) {\n            return type && (type.flags & 8192) !== 0;\n        }\n        function getTypeForBindingElementParent(node) {\n            var symbol = getSymbolOfNode(node);\n            return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false);\n        }\n        function isComputedNonLiteralName(name) {\n            return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression);\n        }\n        function getRestType(source, properties, symbol) {\n            source = filterType(source, function (t) { return !(t.flags & 6144); });\n            if (source.flags & 8192) {\n                return emptyObjectType;\n            }\n            if (source.flags & 65536) {\n                return mapType(source, function (t) { return getRestType(t, properties, symbol); });\n            }\n            var members = ts.createMap();\n            var names = ts.createMap();\n            for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) {\n                var name_17 = properties_2[_i];\n                names[ts.getTextOfPropertyName(name_17)] = true;\n            }\n            for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {\n                var prop = _b[_a];\n                var inNamesToRemove = prop.name in names;\n                var isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16);\n                var isMethod = prop.flags & 8192;\n                var isSetOnlyAccessor = prop.flags & 65536 && !(prop.flags & 32768);\n                if (!inNamesToRemove && !isPrivate && !isMethod && !isSetOnlyAccessor) {\n                    members[prop.name] = prop;\n                }\n            }\n            var stringIndexInfo = getIndexInfoOfType(source, 0);\n            var numberIndexInfo = getIndexInfoOfType(source, 1);\n            return createAnonymousType(symbol, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);\n        }\n        function getTypeForBindingElement(declaration) {\n            var pattern = declaration.parent;\n            var parentType = getTypeForBindingElementParent(pattern.parent);\n            if (parentType === unknownType) {\n                return unknownType;\n            }\n            if (!parentType || isTypeAny(parentType)) {\n                if (declaration.initializer) {\n                    return checkDeclarationInitializer(declaration);\n                }\n                return parentType;\n            }\n            var type;\n            if (pattern.kind === 172) {\n                if (declaration.dotDotDotToken) {\n                    if (!isValidSpreadType(parentType)) {\n                        error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types);\n                        return unknownType;\n                    }\n                    var literalMembers = [];\n                    for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {\n                        var element = _a[_i];\n                        if (!element.dotDotDotToken) {\n                            literalMembers.push(element.propertyName || element.name);\n                        }\n                    }\n                    type = getRestType(parentType, literalMembers, declaration.symbol);\n                }\n                else {\n                    var name_18 = declaration.propertyName || declaration.name;\n                    if (isComputedNonLiteralName(name_18)) {\n                        return anyType;\n                    }\n                    if (declaration.initializer) {\n                        getContextualType(declaration.initializer);\n                    }\n                    var text = ts.getTextOfPropertyName(name_18);\n                    type = getTypeOfPropertyOfType(parentType, text) ||\n                        isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) ||\n                        getIndexTypeOfType(parentType, 0);\n                    if (!type) {\n                        error(name_18, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_18));\n                        return unknownType;\n                    }\n                }\n            }\n            else {\n                var elementType = checkIteratedTypeOrElementType(parentType, pattern, false);\n                if (declaration.dotDotDotToken) {\n                    type = createArrayType(elementType);\n                }\n                else {\n                    var propName = \"\" + ts.indexOf(pattern.elements, declaration);\n                    type = isTupleLikeType(parentType)\n                        ? getTypeOfPropertyOfType(parentType, propName)\n                        : elementType;\n                    if (!type) {\n                        if (isTupleType(parentType)) {\n                            error(declaration, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), getTypeReferenceArity(parentType), pattern.elements.length);\n                        }\n                        else {\n                            error(declaration, ts.Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName);\n                        }\n                        return unknownType;\n                    }\n                }\n            }\n            if (strictNullChecks && declaration.initializer && !(getFalsyFlags(checkExpressionCached(declaration.initializer)) & 2048)) {\n                type = getTypeWithFacts(type, 131072);\n            }\n            return declaration.initializer ?\n                getUnionType([type, checkExpressionCached(declaration.initializer)], true) :\n                type;\n        }\n        function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) {\n            var jsdocType = ts.getJSDocType(declaration);\n            if (jsdocType) {\n                return getTypeFromTypeNode(jsdocType);\n            }\n            return undefined;\n        }\n        function isNullOrUndefined(node) {\n            var expr = ts.skipParentheses(node);\n            return expr.kind === 94 || expr.kind === 70 && getResolvedSymbol(expr) === undefinedSymbol;\n        }\n        function isEmptyArrayLiteral(node) {\n            var expr = ts.skipParentheses(node);\n            return expr.kind === 175 && expr.elements.length === 0;\n        }\n        function addOptionality(type, optional) {\n            return strictNullChecks && optional ? includeFalsyTypes(type, 2048) : type;\n        }\n        function getTypeForVariableLikeDeclaration(declaration, includeOptionality) {\n            if (declaration.flags & 65536) {\n                var type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration);\n                if (type && type !== unknownType) {\n                    return type;\n                }\n            }\n            if (declaration.parent.parent.kind === 212) {\n                var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression));\n                return indexType.flags & (16384 | 262144) ? indexType : stringType;\n            }\n            if (declaration.parent.parent.kind === 213) {\n                return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType;\n            }\n            if (ts.isBindingPattern(declaration.parent)) {\n                return getTypeForBindingElement(declaration);\n            }\n            if (declaration.type) {\n                return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality);\n            }\n            if ((compilerOptions.noImplicitAny || declaration.flags & 65536) &&\n                declaration.kind === 223 && !ts.isBindingPattern(declaration.name) &&\n                !(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) {\n                if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) {\n                    return autoType;\n                }\n                if (declaration.initializer && isEmptyArrayLiteral(declaration.initializer)) {\n                    return autoArrayType;\n                }\n            }\n            if (declaration.kind === 144) {\n                var func = declaration.parent;\n                if (func.kind === 152 && !ts.hasDynamicName(func)) {\n                    var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 151);\n                    if (getter) {\n                        var getterSignature = getSignatureFromDeclaration(getter);\n                        var thisParameter = getAccessorThisParameter(func);\n                        if (thisParameter && declaration === thisParameter) {\n                            ts.Debug.assert(!thisParameter.type);\n                            return getTypeOfSymbol(getterSignature.thisParameter);\n                        }\n                        return getReturnTypeOfSignature(getterSignature);\n                    }\n                }\n                var type = void 0;\n                if (declaration.symbol.name === \"this\") {\n                    type = getContextualThisParameterType(func);\n                }\n                else {\n                    type = getContextuallyTypedParameterType(declaration);\n                }\n                if (type) {\n                    return addOptionality(type, declaration.questionToken && includeOptionality);\n                }\n            }\n            if (declaration.initializer) {\n                var type = checkDeclarationInitializer(declaration);\n                return addOptionality(type, declaration.questionToken && includeOptionality);\n            }\n            if (declaration.kind === 258) {\n                return checkIdentifier(declaration.name);\n            }\n            if (ts.isBindingPattern(declaration.name)) {\n                return getTypeFromBindingPattern(declaration.name, false, true);\n            }\n            return undefined;\n        }\n        function getTypeFromBindingElement(element, includePatternInType, reportErrors) {\n            if (element.initializer) {\n                return checkDeclarationInitializer(element);\n            }\n            if (ts.isBindingPattern(element.name)) {\n                return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors);\n            }\n            if (reportErrors && compilerOptions.noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) {\n                reportImplicitAnyError(element, anyType);\n            }\n            return anyType;\n        }\n        function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {\n            var members = ts.createMap();\n            var stringIndexInfo;\n            var hasComputedProperties = false;\n            ts.forEach(pattern.elements, function (e) {\n                var name = e.propertyName || e.name;\n                if (isComputedNonLiteralName(name)) {\n                    hasComputedProperties = true;\n                    return;\n                }\n                if (e.dotDotDotToken) {\n                    stringIndexInfo = createIndexInfo(anyType, false);\n                    return;\n                }\n                var text = ts.getTextOfPropertyName(name);\n                var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0);\n                var symbol = createSymbol(flags, text);\n                symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors);\n                symbol.bindingElement = e;\n                members[symbol.name] = symbol;\n            });\n            var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined);\n            if (includePatternInType) {\n                result.pattern = pattern;\n            }\n            if (hasComputedProperties) {\n                result.objectFlags |= 512;\n            }\n            return result;\n        }\n        function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) {\n            var elements = pattern.elements;\n            var lastElement = ts.lastOrUndefined(elements);\n            if (elements.length === 0 || (!ts.isOmittedExpression(lastElement) && lastElement.dotDotDotToken)) {\n                return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType;\n            }\n            var elementTypes = ts.map(elements, function (e) { return ts.isOmittedExpression(e) ? anyType : getTypeFromBindingElement(e, includePatternInType, reportErrors); });\n            var result = createTupleType(elementTypes);\n            if (includePatternInType) {\n                result = cloneTypeReference(result);\n                result.pattern = pattern;\n            }\n            return result;\n        }\n        function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) {\n            return pattern.kind === 172\n                ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors)\n                : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors);\n        }\n        function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) {\n            var type = getTypeForVariableLikeDeclaration(declaration, true);\n            if (type) {\n                if (reportErrors) {\n                    reportErrorsFromWidening(declaration, type);\n                }\n                if (declaration.kind === 257) {\n                    return type;\n                }\n                return getWidenedType(type);\n            }\n            type = declaration.dotDotDotToken ? anyArrayType : anyType;\n            if (reportErrors && compilerOptions.noImplicitAny) {\n                if (!declarationBelongsToPrivateAmbientMember(declaration)) {\n                    reportImplicitAnyError(declaration, type);\n                }\n            }\n            return type;\n        }\n        function declarationBelongsToPrivateAmbientMember(declaration) {\n            var root = ts.getRootDeclaration(declaration);\n            var memberDeclaration = root.kind === 144 ? root.parent : root;\n            return isPrivateWithinAmbient(memberDeclaration);\n        }\n        function getTypeOfVariableOrParameterOrProperty(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                if (symbol.flags & 134217728) {\n                    return links.type = getTypeOfPrototypeProperty(symbol);\n                }\n                var declaration = symbol.valueDeclaration;\n                if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) {\n                    return links.type = anyType;\n                }\n                if (declaration.kind === 240) {\n                    return links.type = checkExpression(declaration.expression);\n                }\n                if (declaration.flags & 65536 && declaration.kind === 286 && declaration.typeExpression) {\n                    return links.type = getTypeFromTypeNode(declaration.typeExpression.type);\n                }\n                if (!pushTypeResolution(symbol, 0)) {\n                    return unknownType;\n                }\n                var type = void 0;\n                if (declaration.kind === 192 ||\n                    declaration.kind === 177 && declaration.parent.kind === 192) {\n                    if (declaration.flags & 65536) {\n                        var jsdocType = ts.getJSDocType(declaration.parent);\n                        if (jsdocType) {\n                            return links.type = getTypeFromTypeNode(jsdocType);\n                        }\n                    }\n                    var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 ?\n                        checkExpressionCached(decl.right) :\n                        checkExpressionCached(decl.parent.right); });\n                    type = getUnionType(declaredTypes, true);\n                }\n                else {\n                    type = getWidenedTypeForVariableLikeDeclaration(declaration, true);\n                }\n                if (!popTypeResolution()) {\n                    if (symbol.valueDeclaration.type) {\n                        type = unknownType;\n                        error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));\n                    }\n                    else {\n                        type = anyType;\n                        if (compilerOptions.noImplicitAny) {\n                            error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));\n                        }\n                    }\n                }\n                links.type = type;\n            }\n            return links.type;\n        }\n        function getAnnotatedAccessorType(accessor) {\n            if (accessor) {\n                if (accessor.kind === 151) {\n                    return accessor.type && getTypeFromTypeNode(accessor.type);\n                }\n                else {\n                    var setterTypeAnnotation = ts.getSetAccessorTypeAnnotationNode(accessor);\n                    return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation);\n                }\n            }\n            return undefined;\n        }\n        function getAnnotatedAccessorThisParameter(accessor) {\n            var parameter = getAccessorThisParameter(accessor);\n            return parameter && parameter.symbol;\n        }\n        function getThisTypeOfDeclaration(declaration) {\n            return getThisTypeOfSignature(getSignatureFromDeclaration(declaration));\n        }\n        function getTypeOfAccessors(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                var getter = ts.getDeclarationOfKind(symbol, 151);\n                var setter = ts.getDeclarationOfKind(symbol, 152);\n                if (getter && getter.flags & 65536) {\n                    var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter);\n                    if (jsDocType) {\n                        return links.type = jsDocType;\n                    }\n                }\n                if (!pushTypeResolution(symbol, 0)) {\n                    return unknownType;\n                }\n                var type = void 0;\n                var getterReturnType = getAnnotatedAccessorType(getter);\n                if (getterReturnType) {\n                    type = getterReturnType;\n                }\n                else {\n                    var setterParameterType = getAnnotatedAccessorType(setter);\n                    if (setterParameterType) {\n                        type = setterParameterType;\n                    }\n                    else {\n                        if (getter && getter.body) {\n                            type = getReturnTypeFromBody(getter);\n                        }\n                        else {\n                            if (compilerOptions.noImplicitAny) {\n                                if (setter) {\n                                    error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));\n                                }\n                                else {\n                                    ts.Debug.assert(!!getter, \"there must existed getter as we are current checking either setter or getter in this function\");\n                                    error(getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol));\n                                }\n                            }\n                            type = anyType;\n                        }\n                    }\n                }\n                if (!popTypeResolution()) {\n                    type = anyType;\n                    if (compilerOptions.noImplicitAny) {\n                        var getter_1 = ts.getDeclarationOfKind(symbol, 151);\n                        error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));\n                    }\n                }\n                links.type = type;\n            }\n            return links.type;\n        }\n        function getTypeOfFuncClassEnumModule(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                if (symbol.flags & 1536 && ts.isShorthandAmbientModuleSymbol(symbol)) {\n                    links.type = anyType;\n                }\n                else {\n                    var type = createObjectType(16, symbol);\n                    links.type = strictNullChecks && symbol.flags & 536870912 ?\n                        includeFalsyTypes(type, 2048) : type;\n                }\n            }\n            return links.type;\n        }\n        function getTypeOfEnumMember(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                links.type = getDeclaredTypeOfEnumMember(symbol);\n            }\n            return links.type;\n        }\n        function getTypeOfAlias(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                var targetSymbol = resolveAlias(symbol);\n                links.type = targetSymbol.flags & 107455\n                    ? getTypeOfSymbol(targetSymbol)\n                    : unknownType;\n            }\n            return links.type;\n        }\n        function getTypeOfInstantiatedSymbol(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper);\n            }\n            return links.type;\n        }\n        function getTypeOfSymbol(symbol) {\n            if (symbol.flags & 16777216) {\n                return getTypeOfInstantiatedSymbol(symbol);\n            }\n            if (symbol.flags & (3 | 4)) {\n                return getTypeOfVariableOrParameterOrProperty(symbol);\n            }\n            if (symbol.flags & (16 | 8192 | 32 | 384 | 512)) {\n                return getTypeOfFuncClassEnumModule(symbol);\n            }\n            if (symbol.flags & 8) {\n                return getTypeOfEnumMember(symbol);\n            }\n            if (symbol.flags & 98304) {\n                return getTypeOfAccessors(symbol);\n            }\n            if (symbol.flags & 8388608) {\n                return getTypeOfAlias(symbol);\n            }\n            return unknownType;\n        }\n        function getTargetType(type) {\n            return getObjectFlags(type) & 4 ? type.target : type;\n        }\n        function hasBaseType(type, checkBase) {\n            return check(type);\n            function check(type) {\n                var target = getTargetType(type);\n                return target === checkBase || ts.forEach(getBaseTypes(target), check);\n            }\n        }\n        function appendTypeParameters(typeParameters, declarations) {\n            for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) {\n                var declaration = declarations_2[_i];\n                var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration));\n                if (!typeParameters) {\n                    typeParameters = [tp];\n                }\n                else if (!ts.contains(typeParameters, tp)) {\n                    typeParameters.push(tp);\n                }\n            }\n            return typeParameters;\n        }\n        function appendOuterTypeParameters(typeParameters, node) {\n            while (true) {\n                node = node.parent;\n                if (!node) {\n                    return typeParameters;\n                }\n                if (node.kind === 226 || node.kind === 197 ||\n                    node.kind === 225 || node.kind === 184 ||\n                    node.kind === 149 || node.kind === 185) {\n                    var declarations = node.typeParameters;\n                    if (declarations) {\n                        return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations);\n                    }\n                }\n            }\n        }\n        function getOuterTypeParametersOfClassOrInterface(symbol) {\n            var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 227);\n            return appendOuterTypeParameters(undefined, declaration);\n        }\n        function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) {\n            var result;\n            for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                var node = _a[_i];\n                if (node.kind === 227 || node.kind === 226 ||\n                    node.kind === 197 || node.kind === 228) {\n                    var declaration = node;\n                    if (declaration.typeParameters) {\n                        result = appendTypeParameters(result, declaration.typeParameters);\n                    }\n                }\n            }\n            return result;\n        }\n        function getTypeParametersOfClassOrInterface(symbol) {\n            return ts.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol));\n        }\n        function isConstructorType(type) {\n            return type.flags & 32768 && getSignaturesOfType(type, 1).length > 0;\n        }\n        function getBaseTypeNodeOfClass(type) {\n            return ts.getClassExtendsHeritageClauseElement(type.symbol.valueDeclaration);\n        }\n        function getConstructorsForTypeArguments(type, typeArgumentNodes) {\n            var typeArgCount = typeArgumentNodes ? typeArgumentNodes.length : 0;\n            return ts.filter(getSignaturesOfType(type, 1), function (sig) { return (sig.typeParameters ? sig.typeParameters.length : 0) === typeArgCount; });\n        }\n        function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes) {\n            var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes);\n            if (typeArgumentNodes) {\n                var typeArguments_1 = ts.map(typeArgumentNodes, getTypeFromTypeNode);\n                signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments_1); });\n            }\n            return signatures;\n        }\n        function getBaseConstructorTypeOfClass(type) {\n            if (!type.resolvedBaseConstructorType) {\n                var baseTypeNode = getBaseTypeNodeOfClass(type);\n                if (!baseTypeNode) {\n                    return type.resolvedBaseConstructorType = undefinedType;\n                }\n                if (!pushTypeResolution(type, 1)) {\n                    return unknownType;\n                }\n                var baseConstructorType = checkExpression(baseTypeNode.expression);\n                if (baseConstructorType.flags & 32768) {\n                    resolveStructuredTypeMembers(baseConstructorType);\n                }\n                if (!popTypeResolution()) {\n                    error(type.symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol));\n                    return type.resolvedBaseConstructorType = unknownType;\n                }\n                if (baseConstructorType !== unknownType && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) {\n                    error(baseTypeNode.expression, ts.Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType));\n                    return type.resolvedBaseConstructorType = unknownType;\n                }\n                type.resolvedBaseConstructorType = baseConstructorType;\n            }\n            return type.resolvedBaseConstructorType;\n        }\n        function getBaseTypes(type) {\n            if (!type.resolvedBaseTypes) {\n                if (type.objectFlags & 8) {\n                    type.resolvedBaseTypes = [createArrayType(getUnionType(type.typeParameters))];\n                }\n                else if (type.symbol.flags & (32 | 64)) {\n                    if (type.symbol.flags & 32) {\n                        resolveBaseTypesOfClass(type);\n                    }\n                    if (type.symbol.flags & 64) {\n                        resolveBaseTypesOfInterface(type);\n                    }\n                }\n                else {\n                    ts.Debug.fail(\"type must be class or interface\");\n                }\n            }\n            return type.resolvedBaseTypes;\n        }\n        function resolveBaseTypesOfClass(type) {\n            type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray;\n            var baseConstructorType = getBaseConstructorTypeOfClass(type);\n            if (!(baseConstructorType.flags & 32768)) {\n                return;\n            }\n            var baseTypeNode = getBaseTypeNodeOfClass(type);\n            var baseType;\n            var originalBaseType = baseConstructorType && baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : undefined;\n            if (baseConstructorType.symbol && baseConstructorType.symbol.flags & 32 &&\n                areAllOuterTypeParametersApplied(originalBaseType)) {\n                baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol);\n            }\n            else {\n                var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments);\n                if (!constructors.length) {\n                    error(baseTypeNode.expression, ts.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments);\n                    return;\n                }\n                baseType = getReturnTypeOfSignature(constructors[0]);\n            }\n            var valueDecl = type.symbol.valueDeclaration;\n            if (valueDecl && ts.isInJavaScriptFile(valueDecl)) {\n                var augTag = ts.getJSDocAugmentsTag(type.symbol.valueDeclaration);\n                if (augTag) {\n                    baseType = getTypeFromTypeNode(augTag.typeExpression.type);\n                }\n            }\n            if (baseType === unknownType) {\n                return;\n            }\n            if (!(getObjectFlags(getTargetType(baseType)) & 3)) {\n                error(baseTypeNode.expression, ts.Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType));\n                return;\n            }\n            if (type === baseType || hasBaseType(baseType, type)) {\n                error(valueDecl, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1));\n                return;\n            }\n            if (type.resolvedBaseTypes === emptyArray) {\n                type.resolvedBaseTypes = [baseType];\n            }\n            else {\n                type.resolvedBaseTypes.push(baseType);\n            }\n        }\n        function areAllOuterTypeParametersApplied(type) {\n            var outerTypeParameters = type.outerTypeParameters;\n            if (outerTypeParameters) {\n                var last = outerTypeParameters.length - 1;\n                var typeArguments = type.typeArguments;\n                return outerTypeParameters[last].symbol !== typeArguments[last].symbol;\n            }\n            return true;\n        }\n        function resolveBaseTypesOfInterface(type) {\n            type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray;\n            for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) {\n                var declaration = _a[_i];\n                if (declaration.kind === 227 && ts.getInterfaceBaseTypeNodes(declaration)) {\n                    for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) {\n                        var node = _c[_b];\n                        var baseType = getTypeFromTypeNode(node);\n                        if (baseType !== unknownType) {\n                            if (getObjectFlags(getTargetType(baseType)) & 3) {\n                                if (type !== baseType && !hasBaseType(baseType, type)) {\n                                    if (type.resolvedBaseTypes === emptyArray) {\n                                        type.resolvedBaseTypes = [baseType];\n                                    }\n                                    else {\n                                        type.resolvedBaseTypes.push(baseType);\n                                    }\n                                }\n                                else {\n                                    error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1));\n                                }\n                            }\n                            else {\n                                error(node, ts.Diagnostics.An_interface_may_only_extend_a_class_or_another_interface);\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        function isIndependentInterface(symbol) {\n            for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                var declaration = _a[_i];\n                if (declaration.kind === 227) {\n                    if (declaration.flags & 64) {\n                        return false;\n                    }\n                    var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration);\n                    if (baseTypeNodes) {\n                        for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) {\n                            var node = baseTypeNodes_1[_b];\n                            if (ts.isEntityNameExpression(node.expression)) {\n                                var baseSymbol = resolveEntityName(node.expression, 793064, true);\n                                if (!baseSymbol || !(baseSymbol.flags & 64) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) {\n                                    return false;\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n            return true;\n        }\n        function getDeclaredTypeOfClassOrInterface(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                var kind = symbol.flags & 32 ? 1 : 2;\n                var type = links.declaredType = createObjectType(kind, symbol);\n                var outerTypeParameters = getOuterTypeParametersOfClassOrInterface(symbol);\n                var localTypeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);\n                if (outerTypeParameters || localTypeParameters || kind === 1 || !isIndependentInterface(symbol)) {\n                    type.objectFlags |= 4;\n                    type.typeParameters = ts.concatenate(outerTypeParameters, localTypeParameters);\n                    type.outerTypeParameters = outerTypeParameters;\n                    type.localTypeParameters = localTypeParameters;\n                    type.instantiations = ts.createMap();\n                    type.instantiations[getTypeListId(type.typeParameters)] = type;\n                    type.target = type;\n                    type.typeArguments = type.typeParameters;\n                    type.thisType = createType(16384);\n                    type.thisType.isThisType = true;\n                    type.thisType.symbol = symbol;\n                    type.thisType.constraint = type;\n                }\n            }\n            return links.declaredType;\n        }\n        function getDeclaredTypeOfTypeAlias(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                if (!pushTypeResolution(symbol, 2)) {\n                    return unknownType;\n                }\n                var declaration = ts.getDeclarationOfKind(symbol, 285);\n                var type = void 0;\n                if (declaration) {\n                    if (declaration.jsDocTypeLiteral) {\n                        type = getTypeFromTypeNode(declaration.jsDocTypeLiteral);\n                    }\n                    else {\n                        type = getTypeFromTypeNode(declaration.typeExpression.type);\n                    }\n                }\n                else {\n                    declaration = ts.getDeclarationOfKind(symbol, 228);\n                    type = getTypeFromTypeNode(declaration.type);\n                }\n                if (popTypeResolution()) {\n                    var typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);\n                    if (typeParameters) {\n                        links.typeParameters = typeParameters;\n                        links.instantiations = ts.createMap();\n                        links.instantiations[getTypeListId(typeParameters)] = type;\n                    }\n                }\n                else {\n                    type = unknownType;\n                    error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));\n                }\n                links.declaredType = type;\n            }\n            return links.declaredType;\n        }\n        function isLiteralEnumMember(symbol, member) {\n            var expr = member.initializer;\n            if (!expr) {\n                return !ts.isInAmbientContext(member);\n            }\n            return expr.kind === 8 ||\n                expr.kind === 190 && expr.operator === 37 &&\n                    expr.operand.kind === 8 ||\n                expr.kind === 70 && !!symbol.exports[expr.text];\n        }\n        function enumHasLiteralMembers(symbol) {\n            for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                var declaration = _a[_i];\n                if (declaration.kind === 229) {\n                    for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {\n                        var member = _c[_b];\n                        if (!isLiteralEnumMember(symbol, member)) {\n                            return false;\n                        }\n                    }\n                }\n            }\n            return true;\n        }\n        function createEnumLiteralType(symbol, baseType, text) {\n            var type = createType(256);\n            type.symbol = symbol;\n            type.baseType = baseType;\n            type.text = text;\n            return type;\n        }\n        function getDeclaredTypeOfEnum(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                var enumType = links.declaredType = createType(16);\n                enumType.symbol = symbol;\n                if (enumHasLiteralMembers(symbol)) {\n                    var memberTypeList = [];\n                    var memberTypes = ts.createMap();\n                    for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) {\n                        var declaration = _a[_i];\n                        if (declaration.kind === 229) {\n                            computeEnumMemberValues(declaration);\n                            for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {\n                                var member = _c[_b];\n                                var memberSymbol = getSymbolOfNode(member);\n                                var value = getEnumMemberValue(member);\n                                if (!memberTypes[value]) {\n                                    var memberType = memberTypes[value] = createEnumLiteralType(memberSymbol, enumType, \"\" + value);\n                                    memberTypeList.push(memberType);\n                                }\n                            }\n                        }\n                    }\n                    enumType.memberTypes = memberTypes;\n                    if (memberTypeList.length > 1) {\n                        enumType.flags |= 65536;\n                        enumType.types = memberTypeList;\n                        unionTypes[getTypeListId(memberTypeList)] = enumType;\n                    }\n                }\n            }\n            return links.declaredType;\n        }\n        function getDeclaredTypeOfEnumMember(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                var enumType = getDeclaredTypeOfEnum(getParentOfSymbol(symbol));\n                links.declaredType = enumType.flags & 65536 ?\n                    enumType.memberTypes[getEnumMemberValue(symbol.valueDeclaration)] :\n                    enumType;\n            }\n            return links.declaredType;\n        }\n        function getDeclaredTypeOfTypeParameter(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                var type = createType(16384);\n                type.symbol = symbol;\n                if (!ts.getDeclarationOfKind(symbol, 143).constraint) {\n                    type.constraint = noConstraintType;\n                }\n                links.declaredType = type;\n            }\n            return links.declaredType;\n        }\n        function getDeclaredTypeOfAlias(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                links.declaredType = getDeclaredTypeOfSymbol(resolveAlias(symbol));\n            }\n            return links.declaredType;\n        }\n        function getDeclaredTypeOfSymbol(symbol) {\n            ts.Debug.assert((symbol.flags & 16777216) === 0);\n            if (symbol.flags & (32 | 64)) {\n                return getDeclaredTypeOfClassOrInterface(symbol);\n            }\n            if (symbol.flags & 524288) {\n                return getDeclaredTypeOfTypeAlias(symbol);\n            }\n            if (symbol.flags & 262144) {\n                return getDeclaredTypeOfTypeParameter(symbol);\n            }\n            if (symbol.flags & 384) {\n                return getDeclaredTypeOfEnum(symbol);\n            }\n            if (symbol.flags & 8) {\n                return getDeclaredTypeOfEnumMember(symbol);\n            }\n            if (symbol.flags & 8388608) {\n                return getDeclaredTypeOfAlias(symbol);\n            }\n            return unknownType;\n        }\n        function isIndependentTypeReference(node) {\n            if (node.typeArguments) {\n                for (var _i = 0, _a = node.typeArguments; _i < _a.length; _i++) {\n                    var typeNode = _a[_i];\n                    if (!isIndependentType(typeNode)) {\n                        return false;\n                    }\n                }\n            }\n            return true;\n        }\n        function isIndependentType(node) {\n            switch (node.kind) {\n                case 118:\n                case 134:\n                case 132:\n                case 121:\n                case 135:\n                case 104:\n                case 137:\n                case 94:\n                case 129:\n                case 171:\n                    return true;\n                case 162:\n                    return isIndependentType(node.elementType);\n                case 157:\n                    return isIndependentTypeReference(node);\n            }\n            return false;\n        }\n        function isIndependentVariableLikeDeclaration(node) {\n            return node.type && isIndependentType(node.type) || !node.type && !node.initializer;\n        }\n        function isIndependentFunctionLikeDeclaration(node) {\n            if (node.kind !== 150 && (!node.type || !isIndependentType(node.type))) {\n                return false;\n            }\n            for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {\n                var parameter = _a[_i];\n                if (!isIndependentVariableLikeDeclaration(parameter)) {\n                    return false;\n                }\n            }\n            return true;\n        }\n        function isIndependentMember(symbol) {\n            if (symbol.declarations && symbol.declarations.length === 1) {\n                var declaration = symbol.declarations[0];\n                if (declaration) {\n                    switch (declaration.kind) {\n                        case 147:\n                        case 146:\n                            return isIndependentVariableLikeDeclaration(declaration);\n                        case 149:\n                        case 148:\n                        case 150:\n                            return isIndependentFunctionLikeDeclaration(declaration);\n                    }\n                }\n            }\n            return false;\n        }\n        function createSymbolTable(symbols) {\n            var result = ts.createMap();\n            for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {\n                var symbol = symbols_1[_i];\n                result[symbol.name] = symbol;\n            }\n            return result;\n        }\n        function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) {\n            var result = ts.createMap();\n            for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {\n                var symbol = symbols_2[_i];\n                result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper);\n            }\n            return result;\n        }\n        function addInheritedMembers(symbols, baseSymbols) {\n            for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) {\n                var s = baseSymbols_1[_i];\n                if (!symbols[s.name]) {\n                    symbols[s.name] = s;\n                }\n            }\n        }\n        function resolveDeclaredMembers(type) {\n            if (!type.declaredProperties) {\n                var symbol = type.symbol;\n                type.declaredProperties = getNamedMembers(symbol.members);\n                type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members[\"__call\"]);\n                type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members[\"__new\"]);\n                type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0);\n                type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1);\n            }\n            return type;\n        }\n        function getTypeWithThisArgument(type, thisArgument) {\n            if (getObjectFlags(type) & 4) {\n                return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType]));\n            }\n            return type;\n        }\n        function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {\n            var mapper;\n            var members;\n            var callSignatures;\n            var constructSignatures;\n            var stringIndexInfo;\n            var numberIndexInfo;\n            if (ts.rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) {\n                mapper = identityMapper;\n                members = source.symbol ? source.symbol.members : createSymbolTable(source.declaredProperties);\n                callSignatures = source.declaredCallSignatures;\n                constructSignatures = source.declaredConstructSignatures;\n                stringIndexInfo = source.declaredStringIndexInfo;\n                numberIndexInfo = source.declaredNumberIndexInfo;\n            }\n            else {\n                mapper = createTypeMapper(typeParameters, typeArguments);\n                members = createInstantiatedSymbolTable(source.declaredProperties, mapper, typeParameters.length === 1);\n                callSignatures = instantiateSignatures(source.declaredCallSignatures, mapper);\n                constructSignatures = instantiateSignatures(source.declaredConstructSignatures, mapper);\n                stringIndexInfo = instantiateIndexInfo(source.declaredStringIndexInfo, mapper);\n                numberIndexInfo = instantiateIndexInfo(source.declaredNumberIndexInfo, mapper);\n            }\n            var baseTypes = getBaseTypes(source);\n            if (baseTypes.length) {\n                if (source.symbol && members === source.symbol.members) {\n                    members = createSymbolTable(source.declaredProperties);\n                }\n                var thisArgument = ts.lastOrUndefined(typeArguments);\n                for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) {\n                    var baseType = baseTypes_1[_i];\n                    var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType;\n                    addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType));\n                    callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0));\n                    constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1));\n                    stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0);\n                    numberIndexInfo = numberIndexInfo || getIndexInfoOfType(instantiatedBaseType, 1);\n                }\n            }\n            setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n        }\n        function resolveClassOrInterfaceMembers(type) {\n            resolveObjectTypeMembers(type, resolveDeclaredMembers(type), emptyArray, emptyArray);\n        }\n        function resolveTypeReferenceMembers(type) {\n            var source = resolveDeclaredMembers(type.target);\n            var typeParameters = ts.concatenate(source.typeParameters, [source.thisType]);\n            var typeArguments = type.typeArguments && type.typeArguments.length === typeParameters.length ?\n                type.typeArguments : ts.concatenate(type.typeArguments, [type]);\n            resolveObjectTypeMembers(type, source, typeParameters, typeArguments);\n        }\n        function createSignature(declaration, typeParameters, thisParameter, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasLiteralTypes) {\n            var sig = new Signature(checker);\n            sig.declaration = declaration;\n            sig.typeParameters = typeParameters;\n            sig.parameters = parameters;\n            sig.thisParameter = thisParameter;\n            sig.resolvedReturnType = resolvedReturnType;\n            sig.typePredicate = typePredicate;\n            sig.minArgumentCount = minArgumentCount;\n            sig.hasRestParameter = hasRestParameter;\n            sig.hasLiteralTypes = hasLiteralTypes;\n            return sig;\n        }\n        function cloneSignature(sig) {\n            return createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasLiteralTypes);\n        }\n        function getDefaultConstructSignatures(classType) {\n            var baseConstructorType = getBaseConstructorTypeOfClass(classType);\n            var baseSignatures = getSignaturesOfType(baseConstructorType, 1);\n            if (baseSignatures.length === 0) {\n                return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, undefined, 0, false, false)];\n            }\n            var baseTypeNode = getBaseTypeNodeOfClass(classType);\n            var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode);\n            var typeArgCount = typeArguments ? typeArguments.length : 0;\n            var result = [];\n            for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) {\n                var baseSig = baseSignatures_1[_i];\n                var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0;\n                if (typeParamCount === typeArgCount) {\n                    var sig = typeParamCount ? createSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig);\n                    sig.typeParameters = classType.localTypeParameters;\n                    sig.resolvedReturnType = classType;\n                    result.push(sig);\n                }\n            }\n            return result;\n        }\n        function findMatchingSignature(signatureList, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes) {\n            for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) {\n                var s = signatureList_1[_i];\n                if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypesIdentical)) {\n                    return s;\n                }\n            }\n        }\n        function findMatchingSignatures(signatureLists, signature, listIndex) {\n            if (signature.typeParameters) {\n                if (listIndex > 0) {\n                    return undefined;\n                }\n                for (var i = 1; i < signatureLists.length; i++) {\n                    if (!findMatchingSignature(signatureLists[i], signature, false, false, false)) {\n                        return undefined;\n                    }\n                }\n                return [signature];\n            }\n            var result = undefined;\n            for (var i = 0; i < signatureLists.length; i++) {\n                var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, true, true, true);\n                if (!match) {\n                    return undefined;\n                }\n                if (!ts.contains(result, match)) {\n                    (result || (result = [])).push(match);\n                }\n            }\n            return result;\n        }\n        function getUnionSignatures(types, kind) {\n            var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); });\n            var result = undefined;\n            for (var i = 0; i < signatureLists.length; i++) {\n                for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) {\n                    var signature = _a[_i];\n                    if (!result || !findMatchingSignature(result, signature, false, true, true)) {\n                        var unionSignatures = findMatchingSignatures(signatureLists, signature, i);\n                        if (unionSignatures) {\n                            var s = signature;\n                            if (unionSignatures.length > 1) {\n                                s = cloneSignature(signature);\n                                if (ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; })) {\n                                    var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return getTypeOfSymbol(sig.thisParameter) || anyType; }), true);\n                                    s.thisParameter = createTransientSymbol(signature.thisParameter, thisType);\n                                }\n                                s.resolvedReturnType = undefined;\n                                s.unionSignatures = unionSignatures;\n                            }\n                            (result || (result = [])).push(s);\n                        }\n                    }\n                }\n            }\n            return result || emptyArray;\n        }\n        function getUnionIndexInfo(types, kind) {\n            var indexTypes = [];\n            var isAnyReadonly = false;\n            for (var _i = 0, types_1 = types; _i < types_1.length; _i++) {\n                var type = types_1[_i];\n                var indexInfo = getIndexInfoOfType(type, kind);\n                if (!indexInfo) {\n                    return undefined;\n                }\n                indexTypes.push(indexInfo.type);\n                isAnyReadonly = isAnyReadonly || indexInfo.isReadonly;\n            }\n            return createIndexInfo(getUnionType(indexTypes, true), isAnyReadonly);\n        }\n        function resolveUnionTypeMembers(type) {\n            var callSignatures = getUnionSignatures(type.types, 0);\n            var constructSignatures = getUnionSignatures(type.types, 1);\n            var stringIndexInfo = getUnionIndexInfo(type.types, 0);\n            var numberIndexInfo = getUnionIndexInfo(type.types, 1);\n            setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n        }\n        function intersectTypes(type1, type2) {\n            return !type1 ? type2 : !type2 ? type1 : getIntersectionType([type1, type2]);\n        }\n        function intersectIndexInfos(info1, info2) {\n            return !info1 ? info2 : !info2 ? info1 : createIndexInfo(getIntersectionType([info1.type, info2.type]), info1.isReadonly && info2.isReadonly);\n        }\n        function unionSpreadIndexInfos(info1, info2) {\n            return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly);\n        }\n        function resolveIntersectionTypeMembers(type) {\n            var callSignatures = emptyArray;\n            var constructSignatures = emptyArray;\n            var stringIndexInfo = undefined;\n            var numberIndexInfo = undefined;\n            for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                var t = _a[_i];\n                callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0));\n                constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1));\n                stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0));\n                numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1));\n            }\n            setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n        }\n        function resolveAnonymousTypeMembers(type) {\n            var symbol = type.symbol;\n            if (type.target) {\n                var members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, false);\n                var callSignatures = instantiateSignatures(getSignaturesOfType(type.target, 0), type.mapper);\n                var constructSignatures = instantiateSignatures(getSignaturesOfType(type.target, 1), type.mapper);\n                var stringIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 0), type.mapper);\n                var numberIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 1), type.mapper);\n                setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n            }\n            else if (symbol.flags & 2048) {\n                var members = symbol.members;\n                var callSignatures = getSignaturesOfSymbol(members[\"__call\"]);\n                var constructSignatures = getSignaturesOfSymbol(members[\"__new\"]);\n                var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0);\n                var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1);\n                setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n            }\n            else {\n                var members = emptySymbols;\n                var constructSignatures = emptyArray;\n                if (symbol.flags & 1952) {\n                    members = getExportsOfSymbol(symbol);\n                }\n                if (symbol.flags & 32) {\n                    var classType = getDeclaredTypeOfClassOrInterface(symbol);\n                    constructSignatures = getSignaturesOfSymbol(symbol.members[\"__constructor\"]);\n                    if (!constructSignatures.length) {\n                        constructSignatures = getDefaultConstructSignatures(classType);\n                    }\n                    var baseConstructorType = getBaseConstructorTypeOfClass(classType);\n                    if (baseConstructorType.flags & 32768) {\n                        members = createSymbolTable(getNamedMembers(members));\n                        addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType));\n                    }\n                }\n                var numberIndexInfo = symbol.flags & 384 ? enumNumberIndexInfo : undefined;\n                setStructuredTypeMembers(type, members, emptyArray, constructSignatures, undefined, numberIndexInfo);\n                if (symbol.flags & (16 | 8192)) {\n                    type.callSignatures = getSignaturesOfSymbol(symbol);\n                }\n            }\n        }\n        function resolveMappedTypeMembers(type) {\n            var members = ts.createMap();\n            var stringIndexInfo;\n            setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n            var typeParameter = getTypeParameterFromMappedType(type);\n            var constraintType = getConstraintTypeFromMappedType(type);\n            var homomorphicType = getHomomorphicTypeFromMappedType(type);\n            var templateType = getTemplateTypeFromMappedType(type);\n            var templateReadonly = !!type.declaration.readonlyToken;\n            var templateOptional = !!type.declaration.questionToken;\n            var keyType = constraintType.flags & 540672 ? getApparentType(constraintType) : constraintType;\n            var iterationType = keyType.flags & 262144 ? getIndexType(getApparentType(keyType.type)) : keyType;\n            forEachType(iterationType, function (t) {\n                var iterationMapper = createUnaryTypeMapper(typeParameter, t);\n                var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper;\n                var propType = instantiateType(templateType, templateMapper);\n                if (t.flags & 32) {\n                    var propName = t.text;\n                    var homomorphicProp = homomorphicType && getPropertyOfType(homomorphicType, propName);\n                    var isOptional = templateOptional || !!(homomorphicProp && homomorphicProp.flags & 536870912);\n                    var prop = createSymbol(4 | 67108864 | (isOptional ? 536870912 : 0), propName);\n                    prop.type = propType;\n                    prop.isReadonly = templateReadonly || homomorphicProp && isReadonlySymbol(homomorphicProp);\n                    members[propName] = prop;\n                }\n                else if (t.flags & 2) {\n                    stringIndexInfo = createIndexInfo(propType, templateReadonly);\n                }\n            });\n            setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined);\n        }\n        function getTypeParameterFromMappedType(type) {\n            return type.typeParameter ||\n                (type.typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(type.declaration.typeParameter)));\n        }\n        function getConstraintTypeFromMappedType(type) {\n            return type.constraintType ||\n                (type.constraintType = instantiateType(getConstraintOfTypeParameter(getTypeParameterFromMappedType(type)), type.mapper || identityMapper) || unknownType);\n        }\n        function getTemplateTypeFromMappedType(type) {\n            return type.templateType ||\n                (type.templateType = type.declaration.type ?\n                    instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!type.declaration.questionToken), type.mapper || identityMapper) :\n                    unknownType);\n        }\n        function getHomomorphicTypeFromMappedType(type) {\n            var constraint = getConstraintDeclaration(getTypeParameterFromMappedType(type));\n            return constraint.kind === 168 ? instantiateType(getTypeFromTypeNode(constraint.type), type.mapper || identityMapper) : undefined;\n        }\n        function getErasedTemplateTypeFromMappedType(type) {\n            return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType));\n        }\n        function isGenericMappedType(type) {\n            if (getObjectFlags(type) & 32) {\n                var constraintType = getConstraintTypeFromMappedType(type);\n                return maybeTypeOfKind(constraintType, 540672 | 262144);\n            }\n            return false;\n        }\n        function resolveStructuredTypeMembers(type) {\n            if (!type.members) {\n                if (type.flags & 32768) {\n                    if (type.objectFlags & 4) {\n                        resolveTypeReferenceMembers(type);\n                    }\n                    else if (type.objectFlags & 3) {\n                        resolveClassOrInterfaceMembers(type);\n                    }\n                    else if (type.objectFlags & 16) {\n                        resolveAnonymousTypeMembers(type);\n                    }\n                    else if (type.objectFlags & 32) {\n                        resolveMappedTypeMembers(type);\n                    }\n                }\n                else if (type.flags & 65536) {\n                    resolveUnionTypeMembers(type);\n                }\n                else if (type.flags & 131072) {\n                    resolveIntersectionTypeMembers(type);\n                }\n            }\n            return type;\n        }\n        function getPropertiesOfObjectType(type) {\n            if (type.flags & 32768) {\n                return resolveStructuredTypeMembers(type).properties;\n            }\n            return emptyArray;\n        }\n        function getPropertyOfObjectType(type, name) {\n            if (type.flags & 32768) {\n                var resolved = resolveStructuredTypeMembers(type);\n                var symbol = resolved.members[name];\n                if (symbol && symbolIsValue(symbol)) {\n                    return symbol;\n                }\n            }\n        }\n        function getPropertiesOfUnionOrIntersectionType(type) {\n            for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                var current = _a[_i];\n                for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) {\n                    var prop = _c[_b];\n                    getUnionOrIntersectionProperty(type, prop.name);\n                }\n                if (type.flags & 65536) {\n                    break;\n                }\n            }\n            var props = type.resolvedProperties;\n            if (props) {\n                var result = [];\n                for (var key in props) {\n                    var prop = props[key];\n                    if (!(prop.flags & 268435456 && prop.isPartial)) {\n                        result.push(prop);\n                    }\n                }\n                return result;\n            }\n            return emptyArray;\n        }\n        function getPropertiesOfType(type) {\n            type = getApparentType(type);\n            return type.flags & 196608 ?\n                getPropertiesOfUnionOrIntersectionType(type) :\n                getPropertiesOfObjectType(type);\n        }\n        function getApparentTypeOfTypeParameter(type) {\n            if (!type.resolvedApparentType) {\n                var constraintType = getConstraintOfTypeParameter(type);\n                while (constraintType && constraintType.flags & 16384) {\n                    constraintType = getConstraintOfTypeParameter(constraintType);\n                }\n                type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type);\n            }\n            return type.resolvedApparentType;\n        }\n        function getApparentTypeOfIndexedAccess(type) {\n            return getIndexTypeOfType(getApparentType(type.objectType), 0) || type;\n        }\n        function getApparentType(type) {\n            var t = type.flags & 16384 ? getApparentTypeOfTypeParameter(type) :\n                type.flags & 524288 ? getApparentTypeOfIndexedAccess(type) :\n                    type;\n            return t.flags & 262178 ? globalStringType :\n                t.flags & 340 ? globalNumberType :\n                    t.flags & 136 ? globalBooleanType :\n                        t.flags & 512 ? getGlobalESSymbolType() :\n                            t;\n        }\n        function createUnionOrIntersectionProperty(containingType, name) {\n            var types = containingType.types;\n            var props;\n            var commonFlags = (containingType.flags & 131072) ? 536870912 : 0;\n            var isReadonly = false;\n            var isPartial = false;\n            for (var _i = 0, types_2 = types; _i < types_2.length; _i++) {\n                var current = types_2[_i];\n                var type = getApparentType(current);\n                if (type !== unknownType) {\n                    var prop = getPropertyOfType(type, name);\n                    if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16))) {\n                        commonFlags &= prop.flags;\n                        if (!props) {\n                            props = [prop];\n                        }\n                        else if (!ts.contains(props, prop)) {\n                            props.push(prop);\n                        }\n                        if (isReadonlySymbol(prop)) {\n                            isReadonly = true;\n                        }\n                    }\n                    else if (containingType.flags & 65536) {\n                        isPartial = true;\n                    }\n                }\n            }\n            if (!props) {\n                return undefined;\n            }\n            if (props.length === 1 && !isPartial) {\n                return props[0];\n            }\n            var propTypes = [];\n            var declarations = [];\n            var commonType = undefined;\n            var hasNonUniformType = false;\n            for (var _a = 0, props_1 = props; _a < props_1.length; _a++) {\n                var prop = props_1[_a];\n                if (prop.declarations) {\n                    ts.addRange(declarations, prop.declarations);\n                }\n                var type = getTypeOfSymbol(prop);\n                if (!commonType) {\n                    commonType = type;\n                }\n                else if (type !== commonType) {\n                    hasNonUniformType = true;\n                }\n                propTypes.push(type);\n            }\n            var result = createSymbol(4 | 67108864 | 268435456 | commonFlags, name);\n            result.containingType = containingType;\n            result.hasNonUniformType = hasNonUniformType;\n            result.isPartial = isPartial;\n            result.declarations = declarations;\n            result.isReadonly = isReadonly;\n            result.type = containingType.flags & 65536 ? getUnionType(propTypes) : getIntersectionType(propTypes);\n            return result;\n        }\n        function getUnionOrIntersectionProperty(type, name) {\n            var properties = type.resolvedProperties || (type.resolvedProperties = ts.createMap());\n            var property = properties[name];\n            if (!property) {\n                property = createUnionOrIntersectionProperty(type, name);\n                if (property) {\n                    properties[name] = property;\n                }\n            }\n            return property;\n        }\n        function getPropertyOfUnionOrIntersectionType(type, name) {\n            var property = getUnionOrIntersectionProperty(type, name);\n            return property && !(property.flags & 268435456 && property.isPartial) ? property : undefined;\n        }\n        function getPropertyOfType(type, name) {\n            type = getApparentType(type);\n            if (type.flags & 32768) {\n                var resolved = resolveStructuredTypeMembers(type);\n                var symbol = resolved.members[name];\n                if (symbol && symbolIsValue(symbol)) {\n                    return symbol;\n                }\n                if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) {\n                    var symbol_1 = getPropertyOfObjectType(globalFunctionType, name);\n                    if (symbol_1) {\n                        return symbol_1;\n                    }\n                }\n                return getPropertyOfObjectType(globalObjectType, name);\n            }\n            if (type.flags & 196608) {\n                return getPropertyOfUnionOrIntersectionType(type, name);\n            }\n            return undefined;\n        }\n        function getSignaturesOfStructuredType(type, kind) {\n            if (type.flags & 229376) {\n                var resolved = resolveStructuredTypeMembers(type);\n                return kind === 0 ? resolved.callSignatures : resolved.constructSignatures;\n            }\n            return emptyArray;\n        }\n        function getSignaturesOfType(type, kind) {\n            return getSignaturesOfStructuredType(getApparentType(type), kind);\n        }\n        function getIndexInfoOfStructuredType(type, kind) {\n            if (type.flags & 229376) {\n                var resolved = resolveStructuredTypeMembers(type);\n                return kind === 0 ? resolved.stringIndexInfo : resolved.numberIndexInfo;\n            }\n        }\n        function getIndexTypeOfStructuredType(type, kind) {\n            var info = getIndexInfoOfStructuredType(type, kind);\n            return info && info.type;\n        }\n        function getIndexInfoOfType(type, kind) {\n            return getIndexInfoOfStructuredType(getApparentType(type), kind);\n        }\n        function getIndexTypeOfType(type, kind) {\n            return getIndexTypeOfStructuredType(getApparentType(type), kind);\n        }\n        function getImplicitIndexTypeOfType(type, kind) {\n            if (isObjectLiteralType(type)) {\n                var propTypes = [];\n                for (var _i = 0, _a = getPropertiesOfType(type); _i < _a.length; _i++) {\n                    var prop = _a[_i];\n                    if (kind === 0 || isNumericLiteralName(prop.name)) {\n                        propTypes.push(getTypeOfSymbol(prop));\n                    }\n                }\n                if (propTypes.length) {\n                    return getUnionType(propTypes, true);\n                }\n            }\n            return undefined;\n        }\n        function getTypeParametersFromJSDocTemplate(declaration) {\n            if (declaration.flags & 65536) {\n                var templateTag = ts.getJSDocTemplateTag(declaration);\n                if (templateTag) {\n                    return getTypeParametersFromDeclaration(templateTag.typeParameters);\n                }\n            }\n            return undefined;\n        }\n        function getTypeParametersFromDeclaration(typeParameterDeclarations) {\n            var result = [];\n            ts.forEach(typeParameterDeclarations, function (node) {\n                var tp = getDeclaredTypeOfTypeParameter(node.symbol);\n                if (!ts.contains(result, tp)) {\n                    result.push(tp);\n                }\n            });\n            return result;\n        }\n        function symbolsToArray(symbols) {\n            var result = [];\n            for (var id in symbols) {\n                if (!isReservedMemberName(id)) {\n                    result.push(symbols[id]);\n                }\n            }\n            return result;\n        }\n        function isJSDocOptionalParameter(node) {\n            if (node.flags & 65536) {\n                if (node.type && node.type.kind === 273) {\n                    return true;\n                }\n                var paramTags = ts.getJSDocParameterTags(node);\n                if (paramTags) {\n                    for (var _i = 0, paramTags_1 = paramTags; _i < paramTags_1.length; _i++) {\n                        var paramTag = paramTags_1[_i];\n                        if (paramTag.isBracketed) {\n                            return true;\n                        }\n                        if (paramTag.typeExpression) {\n                            return paramTag.typeExpression.type.kind === 273;\n                        }\n                    }\n                }\n            }\n        }\n        function tryFindAmbientModule(moduleName, withAugmentations) {\n            if (ts.isExternalModuleNameRelative(moduleName)) {\n                return undefined;\n            }\n            var symbol = getSymbol(globals, \"\\\"\" + moduleName + \"\\\"\", 512);\n            return symbol && withAugmentations ? getMergedSymbol(symbol) : symbol;\n        }\n        function isOptionalParameter(node) {\n            if (ts.hasQuestionToken(node) || isJSDocOptionalParameter(node)) {\n                return true;\n            }\n            if (node.initializer) {\n                var signatureDeclaration = node.parent;\n                var signature = getSignatureFromDeclaration(signatureDeclaration);\n                var parameterIndex = ts.indexOf(signatureDeclaration.parameters, node);\n                ts.Debug.assert(parameterIndex >= 0);\n                return parameterIndex >= signature.minArgumentCount;\n            }\n            return false;\n        }\n        function createTypePredicateFromTypePredicateNode(node) {\n            if (node.parameterName.kind === 70) {\n                var parameterName = node.parameterName;\n                return {\n                    kind: 1,\n                    parameterName: parameterName ? parameterName.text : undefined,\n                    parameterIndex: parameterName ? getTypePredicateParameterIndex(node.parent.parameters, parameterName) : undefined,\n                    type: getTypeFromTypeNode(node.type)\n                };\n            }\n            else {\n                return {\n                    kind: 0,\n                    type: getTypeFromTypeNode(node.type)\n                };\n            }\n        }\n        function getSignatureFromDeclaration(declaration) {\n            var links = getNodeLinks(declaration);\n            if (!links.resolvedSignature) {\n                var parameters = [];\n                var hasLiteralTypes = false;\n                var minArgumentCount = -1;\n                var thisParameter = undefined;\n                var hasThisParameter = void 0;\n                var isJSConstructSignature = ts.isJSDocConstructSignature(declaration);\n                for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) {\n                    var param = declaration.parameters[i];\n                    var paramSymbol = param.symbol;\n                    if (paramSymbol && !!(paramSymbol.flags & 4) && !ts.isBindingPattern(param.name)) {\n                        var resolvedSymbol = resolveName(param, paramSymbol.name, 107455, undefined, undefined);\n                        paramSymbol = resolvedSymbol;\n                    }\n                    if (i === 0 && paramSymbol.name === \"this\") {\n                        hasThisParameter = true;\n                        thisParameter = param.symbol;\n                    }\n                    else {\n                        parameters.push(paramSymbol);\n                    }\n                    if (param.type && param.type.kind === 171) {\n                        hasLiteralTypes = true;\n                    }\n                    if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) {\n                        if (minArgumentCount < 0) {\n                            minArgumentCount = i - (hasThisParameter ? 1 : 0);\n                        }\n                    }\n                    else {\n                        minArgumentCount = -1;\n                    }\n                }\n                if ((declaration.kind === 151 || declaration.kind === 152) &&\n                    !ts.hasDynamicName(declaration) &&\n                    (!hasThisParameter || !thisParameter)) {\n                    var otherKind = declaration.kind === 151 ? 152 : 151;\n                    var other = ts.getDeclarationOfKind(declaration.symbol, otherKind);\n                    if (other) {\n                        thisParameter = getAnnotatedAccessorThisParameter(other);\n                    }\n                }\n                if (minArgumentCount < 0) {\n                    minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0);\n                }\n                if (isJSConstructSignature) {\n                    minArgumentCount--;\n                }\n                var classType = declaration.kind === 150 ?\n                    getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol))\n                    : undefined;\n                var typeParameters = classType ? classType.localTypeParameters :\n                    declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) :\n                        getTypeParametersFromJSDocTemplate(declaration);\n                var returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType);\n                var typePredicate = declaration.type && declaration.type.kind === 156 ?\n                    createTypePredicateFromTypePredicateNode(declaration.type) :\n                    undefined;\n                links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasLiteralTypes);\n            }\n            return links.resolvedSignature;\n        }\n        function getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType) {\n            if (isJSConstructSignature) {\n                return getTypeFromTypeNode(declaration.parameters[0].type);\n            }\n            else if (classType) {\n                return classType;\n            }\n            else if (declaration.type) {\n                return getTypeFromTypeNode(declaration.type);\n            }\n            if (declaration.flags & 65536) {\n                var type = getReturnTypeFromJSDocComment(declaration);\n                if (type && type !== unknownType) {\n                    return type;\n                }\n            }\n            if (declaration.kind === 151 && !ts.hasDynamicName(declaration)) {\n                var setter = ts.getDeclarationOfKind(declaration.symbol, 152);\n                return getAnnotatedAccessorType(setter);\n            }\n            if (ts.nodeIsMissing(declaration.body)) {\n                return anyType;\n            }\n        }\n        function getSignaturesOfSymbol(symbol) {\n            if (!symbol)\n                return emptyArray;\n            var result = [];\n            for (var i = 0, len = symbol.declarations.length; i < len; i++) {\n                var node = symbol.declarations[i];\n                switch (node.kind) {\n                    case 158:\n                    case 159:\n                    case 225:\n                    case 149:\n                    case 148:\n                    case 150:\n                    case 153:\n                    case 154:\n                    case 155:\n                    case 151:\n                    case 152:\n                    case 184:\n                    case 185:\n                    case 274:\n                        if (i > 0 && node.body) {\n                            var previous = symbol.declarations[i - 1];\n                            if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) {\n                                break;\n                            }\n                        }\n                        result.push(getSignatureFromDeclaration(node));\n                }\n            }\n            return result;\n        }\n        function resolveExternalModuleTypeByLiteral(name) {\n            var moduleSym = resolveExternalModuleName(name, name);\n            if (moduleSym) {\n                var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym);\n                if (resolvedModuleSymbol) {\n                    return getTypeOfSymbol(resolvedModuleSymbol);\n                }\n            }\n            return anyType;\n        }\n        function getThisTypeOfSignature(signature) {\n            if (signature.thisParameter) {\n                return getTypeOfSymbol(signature.thisParameter);\n            }\n        }\n        function getReturnTypeOfSignature(signature) {\n            if (!signature.resolvedReturnType) {\n                if (!pushTypeResolution(signature, 3)) {\n                    return unknownType;\n                }\n                var type = void 0;\n                if (signature.target) {\n                    type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper);\n                }\n                else if (signature.unionSignatures) {\n                    type = getUnionType(ts.map(signature.unionSignatures, getReturnTypeOfSignature), true);\n                }\n                else {\n                    type = getReturnTypeFromBody(signature.declaration);\n                }\n                if (!popTypeResolution()) {\n                    type = anyType;\n                    if (compilerOptions.noImplicitAny) {\n                        var declaration = signature.declaration;\n                        if (declaration.name) {\n                            error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));\n                        }\n                        else {\n                            error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);\n                        }\n                    }\n                }\n                signature.resolvedReturnType = type;\n            }\n            return signature.resolvedReturnType;\n        }\n        function getRestTypeOfSignature(signature) {\n            if (signature.hasRestParameter) {\n                var type = getTypeOfSymbol(ts.lastOrUndefined(signature.parameters));\n                if (getObjectFlags(type) & 4 && type.target === globalArrayType) {\n                    return type.typeArguments[0];\n                }\n            }\n            return anyType;\n        }\n        function getSignatureInstantiation(signature, typeArguments) {\n            var instantiations = signature.instantiations || (signature.instantiations = ts.createMap());\n            var id = getTypeListId(typeArguments);\n            return instantiations[id] || (instantiations[id] = createSignatureInstantiation(signature, typeArguments));\n        }\n        function createSignatureInstantiation(signature, typeArguments) {\n            return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), true);\n        }\n        function getErasedSignature(signature) {\n            if (!signature.typeParameters)\n                return signature;\n            if (!signature.erasedSignatureCache) {\n                signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), true);\n            }\n            return signature.erasedSignatureCache;\n        }\n        function getOrCreateTypeFromSignature(signature) {\n            if (!signature.isolatedSignatureType) {\n                var isConstructor = signature.declaration.kind === 150 || signature.declaration.kind === 154;\n                var type = createObjectType(16);\n                type.members = emptySymbols;\n                type.properties = emptyArray;\n                type.callSignatures = !isConstructor ? [signature] : emptyArray;\n                type.constructSignatures = isConstructor ? [signature] : emptyArray;\n                signature.isolatedSignatureType = type;\n            }\n            return signature.isolatedSignatureType;\n        }\n        function getIndexSymbol(symbol) {\n            return symbol.members[\"__index\"];\n        }\n        function getIndexDeclarationOfSymbol(symbol, kind) {\n            var syntaxKind = kind === 1 ? 132 : 134;\n            var indexSymbol = getIndexSymbol(symbol);\n            if (indexSymbol) {\n                for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    var node = decl;\n                    if (node.parameters.length === 1) {\n                        var parameter = node.parameters[0];\n                        if (parameter && parameter.type && parameter.type.kind === syntaxKind) {\n                            return node;\n                        }\n                    }\n                }\n            }\n            return undefined;\n        }\n        function createIndexInfo(type, isReadonly, declaration) {\n            return { type: type, isReadonly: isReadonly, declaration: declaration };\n        }\n        function getIndexInfoOfSymbol(symbol, kind) {\n            var declaration = getIndexDeclarationOfSymbol(symbol, kind);\n            if (declaration) {\n                return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, (ts.getModifierFlags(declaration) & 64) !== 0, declaration);\n            }\n            return undefined;\n        }\n        function getConstraintDeclaration(type) {\n            return ts.getDeclarationOfKind(type.symbol, 143).constraint;\n        }\n        function hasConstraintReferenceTo(type, target) {\n            var checked;\n            while (type && type.flags & 16384 && !(type.isThisType) && !ts.contains(checked, type)) {\n                if (type === target) {\n                    return true;\n                }\n                (checked || (checked = [])).push(type);\n                var constraintDeclaration = getConstraintDeclaration(type);\n                type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration);\n            }\n            return false;\n        }\n        function getConstraintOfTypeParameter(typeParameter) {\n            if (!typeParameter.constraint) {\n                if (typeParameter.target) {\n                    var targetConstraint = getConstraintOfTypeParameter(typeParameter.target);\n                    typeParameter.constraint = targetConstraint ? instantiateType(targetConstraint, typeParameter.mapper) : noConstraintType;\n                }\n                else {\n                    var constraintDeclaration = getConstraintDeclaration(typeParameter);\n                    var constraint = getTypeFromTypeNode(constraintDeclaration);\n                    if (hasConstraintReferenceTo(constraint, typeParameter)) {\n                        error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter));\n                        constraint = unknownType;\n                    }\n                    typeParameter.constraint = constraint;\n                }\n            }\n            return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint;\n        }\n        function getParentSymbolOfTypeParameter(typeParameter) {\n            return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143).parent);\n        }\n        function getTypeListId(types) {\n            var result = \"\";\n            if (types) {\n                var length_3 = types.length;\n                var i = 0;\n                while (i < length_3) {\n                    var startId = types[i].id;\n                    var count = 1;\n                    while (i + count < length_3 && types[i + count].id === startId + count) {\n                        count++;\n                    }\n                    if (result.length) {\n                        result += \",\";\n                    }\n                    result += startId;\n                    if (count > 1) {\n                        result += \":\" + count;\n                    }\n                    i += count;\n                }\n            }\n            return result;\n        }\n        function getPropagatingFlagsOfTypes(types, excludeKinds) {\n            var result = 0;\n            for (var _i = 0, types_3 = types; _i < types_3.length; _i++) {\n                var type = types_3[_i];\n                if (!(type.flags & excludeKinds)) {\n                    result |= type.flags;\n                }\n            }\n            return result & 14680064;\n        }\n        function createTypeReference(target, typeArguments) {\n            var id = getTypeListId(typeArguments);\n            var type = target.instantiations[id];\n            if (!type) {\n                type = target.instantiations[id] = createObjectType(4, target.symbol);\n                type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, 0) : 0;\n                type.target = target;\n                type.typeArguments = typeArguments;\n            }\n            return type;\n        }\n        function cloneTypeReference(source) {\n            var type = createType(source.flags);\n            type.symbol = source.symbol;\n            type.objectFlags = source.objectFlags;\n            type.target = source.target;\n            type.typeArguments = source.typeArguments;\n            return type;\n        }\n        function getTypeReferenceArity(type) {\n            return type.target.typeParameters ? type.target.typeParameters.length : 0;\n        }\n        function getTypeFromClassOrInterfaceReference(node, symbol) {\n            var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol));\n            var typeParameters = type.localTypeParameters;\n            if (typeParameters) {\n                if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) {\n                    error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length);\n                    return unknownType;\n                }\n                return createTypeReference(type, ts.concatenate(type.outerTypeParameters, ts.map(node.typeArguments, getTypeFromTypeNode)));\n            }\n            if (node.typeArguments) {\n                error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type));\n                return unknownType;\n            }\n            return type;\n        }\n        function getTypeAliasInstantiation(symbol, typeArguments) {\n            var type = getDeclaredTypeOfSymbol(symbol);\n            var links = getSymbolLinks(symbol);\n            var typeParameters = links.typeParameters;\n            var id = getTypeListId(typeArguments);\n            return links.instantiations[id] || (links.instantiations[id] = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments)));\n        }\n        function getTypeFromTypeAliasReference(node, symbol) {\n            var type = getDeclaredTypeOfSymbol(symbol);\n            var typeParameters = getSymbolLinks(symbol).typeParameters;\n            if (typeParameters) {\n                if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) {\n                    error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, symbolToString(symbol), typeParameters.length);\n                    return unknownType;\n                }\n                var typeArguments = ts.map(node.typeArguments, getTypeFromTypeNode);\n                return getTypeAliasInstantiation(symbol, typeArguments);\n            }\n            if (node.typeArguments) {\n                error(node, ts.Diagnostics.Type_0_is_not_generic, symbolToString(symbol));\n                return unknownType;\n            }\n            return type;\n        }\n        function getTypeFromNonGenericTypeReference(node, symbol) {\n            if (node.typeArguments) {\n                error(node, ts.Diagnostics.Type_0_is_not_generic, symbolToString(symbol));\n                return unknownType;\n            }\n            return getDeclaredTypeOfSymbol(symbol);\n        }\n        function getTypeReferenceName(node) {\n            switch (node.kind) {\n                case 157:\n                    return node.typeName;\n                case 272:\n                    return node.name;\n                case 199:\n                    var expr = node.expression;\n                    if (ts.isEntityNameExpression(expr)) {\n                        return expr;\n                    }\n            }\n            return undefined;\n        }\n        function resolveTypeReferenceName(typeReferenceName) {\n            if (!typeReferenceName) {\n                return unknownSymbol;\n            }\n            return resolveEntityName(typeReferenceName, 793064) || unknownSymbol;\n        }\n        function getTypeReferenceType(node, symbol) {\n            if (symbol === unknownSymbol) {\n                return unknownType;\n            }\n            if (symbol.flags & (32 | 64)) {\n                return getTypeFromClassOrInterfaceReference(node, symbol);\n            }\n            if (symbol.flags & 524288) {\n                return getTypeFromTypeAliasReference(node, symbol);\n            }\n            if (symbol.flags & 107455 && node.kind === 272) {\n                return getTypeOfSymbol(symbol);\n            }\n            return getTypeFromNonGenericTypeReference(node, symbol);\n        }\n        function getTypeFromTypeReference(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                var symbol = void 0;\n                var type = void 0;\n                if (node.kind === 272) {\n                    var typeReferenceName = getTypeReferenceName(node);\n                    symbol = resolveTypeReferenceName(typeReferenceName);\n                    type = getTypeReferenceType(node, symbol);\n                }\n                else {\n                    var typeNameOrExpression = node.kind === 157\n                        ? node.typeName\n                        : ts.isEntityNameExpression(node.expression)\n                            ? node.expression\n                            : undefined;\n                    symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793064) || unknownSymbol;\n                    type = symbol === unknownSymbol ? unknownType :\n                        symbol.flags & (32 | 64) ? getTypeFromClassOrInterfaceReference(node, symbol) :\n                            symbol.flags & 524288 ? getTypeFromTypeAliasReference(node, symbol) :\n                                getTypeFromNonGenericTypeReference(node, symbol);\n                }\n                links.resolvedSymbol = symbol;\n                links.resolvedType = type;\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromTypeQueryNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getWidenedType(checkExpression(node.exprName));\n            }\n            return links.resolvedType;\n        }\n        function getTypeOfGlobalSymbol(symbol, arity) {\n            function getTypeDeclaration(symbol) {\n                var declarations = symbol.declarations;\n                for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) {\n                    var declaration = declarations_3[_i];\n                    switch (declaration.kind) {\n                        case 226:\n                        case 227:\n                        case 229:\n                            return declaration;\n                    }\n                }\n            }\n            if (!symbol) {\n                return arity ? emptyGenericType : emptyObjectType;\n            }\n            var type = getDeclaredTypeOfSymbol(symbol);\n            if (!(type.flags & 32768)) {\n                error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name);\n                return arity ? emptyGenericType : emptyObjectType;\n            }\n            if ((type.typeParameters ? type.typeParameters.length : 0) !== arity) {\n                error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbol.name, arity);\n                return arity ? emptyGenericType : emptyObjectType;\n            }\n            return type;\n        }\n        function getGlobalValueSymbol(name) {\n            return getGlobalSymbol(name, 107455, ts.Diagnostics.Cannot_find_global_value_0);\n        }\n        function getGlobalTypeSymbol(name) {\n            return getGlobalSymbol(name, 793064, ts.Diagnostics.Cannot_find_global_type_0);\n        }\n        function getGlobalSymbol(name, meaning, diagnostic) {\n            return resolveName(undefined, name, meaning, diagnostic, name);\n        }\n        function getGlobalType(name, arity) {\n            if (arity === void 0) { arity = 0; }\n            return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), arity);\n        }\n        function getExportedTypeFromNamespace(namespace, name) {\n            var namespaceSymbol = getGlobalSymbol(namespace, 1920, undefined);\n            var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793064);\n            return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol);\n        }\n        function createTypedPropertyDescriptorType(propertyType) {\n            var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType();\n            return globalTypedPropertyDescriptorType !== emptyGenericType\n                ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType])\n                : emptyObjectType;\n        }\n        function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) {\n            return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType;\n        }\n        function createIterableType(elementType) {\n            return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]);\n        }\n        function createIterableIteratorType(elementType) {\n            return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]);\n        }\n        function createArrayType(elementType) {\n            return createTypeFromGenericGlobalType(globalArrayType, [elementType]);\n        }\n        function getTypeFromArrayTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType));\n            }\n            return links.resolvedType;\n        }\n        function createTupleTypeOfArity(arity) {\n            var typeParameters = [];\n            var properties = [];\n            for (var i = 0; i < arity; i++) {\n                var typeParameter = createType(16384);\n                typeParameters.push(typeParameter);\n                var property = createSymbol(4 | 67108864, \"\" + i);\n                property.type = typeParameter;\n                properties.push(property);\n            }\n            var type = createObjectType(8 | 4);\n            type.typeParameters = typeParameters;\n            type.outerTypeParameters = undefined;\n            type.localTypeParameters = typeParameters;\n            type.instantiations = ts.createMap();\n            type.instantiations[getTypeListId(type.typeParameters)] = type;\n            type.target = type;\n            type.typeArguments = type.typeParameters;\n            type.thisType = createType(16384);\n            type.thisType.isThisType = true;\n            type.thisType.constraint = type;\n            type.declaredProperties = properties;\n            type.declaredCallSignatures = emptyArray;\n            type.declaredConstructSignatures = emptyArray;\n            type.declaredStringIndexInfo = undefined;\n            type.declaredNumberIndexInfo = undefined;\n            return type;\n        }\n        function getTupleTypeOfArity(arity) {\n            return tupleTypes[arity] || (tupleTypes[arity] = createTupleTypeOfArity(arity));\n        }\n        function createTupleType(elementTypes) {\n            return createTypeReference(getTupleTypeOfArity(elementTypes.length), elementTypes);\n        }\n        function getTypeFromTupleTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode));\n            }\n            return links.resolvedType;\n        }\n        function binarySearchTypes(types, type) {\n            var low = 0;\n            var high = types.length - 1;\n            var typeId = type.id;\n            while (low <= high) {\n                var middle = low + ((high - low) >> 1);\n                var id = types[middle].id;\n                if (id === typeId) {\n                    return middle;\n                }\n                else if (id > typeId) {\n                    high = middle - 1;\n                }\n                else {\n                    low = middle + 1;\n                }\n            }\n            return ~low;\n        }\n        function containsType(types, type) {\n            return binarySearchTypes(types, type) >= 0;\n        }\n        function addTypeToUnion(typeSet, type) {\n            var flags = type.flags;\n            if (flags & 65536) {\n                addTypesToUnion(typeSet, type.types);\n            }\n            else if (flags & 1) {\n                typeSet.containsAny = true;\n            }\n            else if (!strictNullChecks && flags & 6144) {\n                if (flags & 2048)\n                    typeSet.containsUndefined = true;\n                if (flags & 4096)\n                    typeSet.containsNull = true;\n                if (!(flags & 2097152))\n                    typeSet.containsNonWideningType = true;\n            }\n            else if (!(flags & 8192)) {\n                if (flags & 2)\n                    typeSet.containsString = true;\n                if (flags & 4)\n                    typeSet.containsNumber = true;\n                if (flags & 96)\n                    typeSet.containsStringOrNumberLiteral = true;\n                var len = typeSet.length;\n                var index = len && type.id > typeSet[len - 1].id ? ~len : binarySearchTypes(typeSet, type);\n                if (index < 0) {\n                    if (!(flags & 32768 && type.objectFlags & 16 &&\n                        type.symbol && type.symbol.flags & (16 | 8192) && containsIdenticalType(typeSet, type))) {\n                        typeSet.splice(~index, 0, type);\n                    }\n                }\n            }\n        }\n        function addTypesToUnion(typeSet, types) {\n            for (var _i = 0, types_4 = types; _i < types_4.length; _i++) {\n                var type = types_4[_i];\n                addTypeToUnion(typeSet, type);\n            }\n        }\n        function containsIdenticalType(types, type) {\n            for (var _i = 0, types_5 = types; _i < types_5.length; _i++) {\n                var t = types_5[_i];\n                if (isTypeIdenticalTo(t, type)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function isSubtypeOfAny(candidate, types) {\n            for (var i = 0, len = types.length; i < len; i++) {\n                if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function isSetOfLiteralsFromSameEnum(types) {\n            var first = types[0];\n            if (first.flags & 256) {\n                var firstEnum = getParentOfSymbol(first.symbol);\n                for (var i = 1; i < types.length; i++) {\n                    var other = types[i];\n                    if (!(other.flags & 256) || (firstEnum !== getParentOfSymbol(other.symbol))) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            return false;\n        }\n        function removeSubtypes(types) {\n            if (types.length === 0 || isSetOfLiteralsFromSameEnum(types)) {\n                return;\n            }\n            var i = types.length;\n            while (i > 0) {\n                i--;\n                if (isSubtypeOfAny(types[i], types)) {\n                    ts.orderedRemoveItemAt(types, i);\n                }\n            }\n        }\n        function removeRedundantLiteralTypes(types) {\n            var i = types.length;\n            while (i > 0) {\n                i--;\n                var t = types[i];\n                var remove = t.flags & 32 && types.containsString ||\n                    t.flags & 64 && types.containsNumber ||\n                    t.flags & 96 && t.flags & 1048576 && containsType(types, t.regularType);\n                if (remove) {\n                    ts.orderedRemoveItemAt(types, i);\n                }\n            }\n        }\n        function getUnionType(types, subtypeReduction, aliasSymbol, aliasTypeArguments) {\n            if (types.length === 0) {\n                return neverType;\n            }\n            if (types.length === 1) {\n                return types[0];\n            }\n            var typeSet = [];\n            addTypesToUnion(typeSet, types);\n            if (typeSet.containsAny) {\n                return anyType;\n            }\n            if (subtypeReduction) {\n                removeSubtypes(typeSet);\n            }\n            else if (typeSet.containsStringOrNumberLiteral) {\n                removeRedundantLiteralTypes(typeSet);\n            }\n            if (typeSet.length === 0) {\n                return typeSet.containsNull ? typeSet.containsNonWideningType ? nullType : nullWideningType :\n                    typeSet.containsUndefined ? typeSet.containsNonWideningType ? undefinedType : undefinedWideningType :\n                        neverType;\n            }\n            return getUnionTypeFromSortedList(typeSet, aliasSymbol, aliasTypeArguments);\n        }\n        function getUnionTypeFromSortedList(types, aliasSymbol, aliasTypeArguments) {\n            if (types.length === 0) {\n                return neverType;\n            }\n            if (types.length === 1) {\n                return types[0];\n            }\n            var id = getTypeListId(types);\n            var type = unionTypes[id];\n            if (!type) {\n                var propagatedFlags = getPropagatingFlagsOfTypes(types, 6144);\n                type = unionTypes[id] = createType(65536 | propagatedFlags);\n                type.types = types;\n                type.aliasSymbol = aliasSymbol;\n                type.aliasTypeArguments = aliasTypeArguments;\n            }\n            return type;\n        }\n        function getTypeFromUnionTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), false, getAliasSymbolForTypeNode(node), getAliasTypeArgumentsForTypeNode(node));\n            }\n            return links.resolvedType;\n        }\n        function addTypeToIntersection(typeSet, type) {\n            if (type.flags & 131072) {\n                addTypesToIntersection(typeSet, type.types);\n            }\n            else if (type.flags & 1) {\n                typeSet.containsAny = true;\n            }\n            else if (!(type.flags & 8192) && (strictNullChecks || !(type.flags & 6144)) && !ts.contains(typeSet, type)) {\n                if (type.flags & 65536 && typeSet.unionIndex === undefined) {\n                    typeSet.unionIndex = typeSet.length;\n                }\n                typeSet.push(type);\n            }\n        }\n        function addTypesToIntersection(typeSet, types) {\n            for (var _i = 0, types_6 = types; _i < types_6.length; _i++) {\n                var type = types_6[_i];\n                addTypeToIntersection(typeSet, type);\n            }\n        }\n        function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {\n            if (types.length === 0) {\n                return emptyObjectType;\n            }\n            var typeSet = [];\n            addTypesToIntersection(typeSet, types);\n            if (typeSet.containsAny) {\n                return anyType;\n            }\n            if (typeSet.length === 1) {\n                return typeSet[0];\n            }\n            var unionIndex = typeSet.unionIndex;\n            if (unionIndex !== undefined) {\n                var unionType = typeSet[unionIndex];\n                return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex, t)); }), false, aliasSymbol, aliasTypeArguments);\n            }\n            var id = getTypeListId(typeSet);\n            var type = intersectionTypes[id];\n            if (!type) {\n                var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 6144);\n                type = intersectionTypes[id] = createType(131072 | propagatedFlags);\n                type.types = typeSet;\n                type.aliasSymbol = aliasSymbol;\n                type.aliasTypeArguments = aliasTypeArguments;\n            }\n            return type;\n        }\n        function getTypeFromIntersectionTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), getAliasSymbolForTypeNode(node), getAliasTypeArgumentsForTypeNode(node));\n            }\n            return links.resolvedType;\n        }\n        function getIndexTypeForGenericType(type) {\n            if (!type.resolvedIndexType) {\n                type.resolvedIndexType = createType(262144);\n                type.resolvedIndexType.type = type;\n            }\n            return type.resolvedIndexType;\n        }\n        function getLiteralTypeFromPropertyName(prop) {\n            return getDeclarationModifierFlagsFromSymbol(prop) & 24 || ts.startsWith(prop.name, \"__@\") ?\n                neverType :\n                getLiteralTypeForText(32, ts.unescapeIdentifier(prop.name));\n        }\n        function getLiteralTypeFromPropertyNames(type) {\n            return getUnionType(ts.map(getPropertiesOfType(type), getLiteralTypeFromPropertyName));\n        }\n        function getIndexType(type) {\n            return maybeTypeOfKind(type, 540672) ? getIndexTypeForGenericType(type) :\n                getObjectFlags(type) & 32 ? getConstraintTypeFromMappedType(type) :\n                    type.flags & 1 || getIndexInfoOfType(type, 0) ? stringType :\n                        getLiteralTypeFromPropertyNames(type);\n        }\n        function getIndexTypeOrString(type) {\n            var indexType = getIndexType(type);\n            return indexType !== neverType ? indexType : stringType;\n        }\n        function getTypeFromTypeOperatorNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getIndexType(getTypeFromTypeNode(node.type));\n            }\n            return links.resolvedType;\n        }\n        function createIndexedAccessType(objectType, indexType) {\n            var type = createType(524288);\n            type.objectType = objectType;\n            type.indexType = indexType;\n            return type;\n        }\n        function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) {\n            var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined;\n            var propName = indexType.flags & (32 | 64 | 256) ?\n                indexType.text :\n                accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, false) ?\n                    ts.getPropertyNameForKnownSymbolName(accessExpression.argumentExpression.name.text) :\n                    undefined;\n            if (propName) {\n                var prop = getPropertyOfType(objectType, propName);\n                if (prop) {\n                    if (accessExpression) {\n                        if (ts.isAssignmentTarget(accessExpression) && (isReferenceToReadonlyEntity(accessExpression, prop) || isReferenceThroughNamespaceImport(accessExpression))) {\n                            error(accessExpression.argumentExpression, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(prop));\n                            return unknownType;\n                        }\n                        if (cacheSymbol) {\n                            getNodeLinks(accessNode).resolvedSymbol = prop;\n                        }\n                    }\n                    return getTypeOfSymbol(prop);\n                }\n            }\n            if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 262178 | 340 | 512)) {\n                if (isTypeAny(objectType)) {\n                    return anyType;\n                }\n                var indexInfo = isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340) && getIndexInfoOfType(objectType, 1) ||\n                    getIndexInfoOfType(objectType, 0) ||\n                    undefined;\n                if (indexInfo) {\n                    if (accessExpression && ts.isAssignmentTarget(accessExpression) && indexInfo.isReadonly) {\n                        error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));\n                        return unknownType;\n                    }\n                    return indexInfo.type;\n                }\n                if (accessExpression && !isConstEnumObjectType(objectType)) {\n                    if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) {\n                        if (getIndexTypeOfType(objectType, 1)) {\n                            error(accessExpression.argumentExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number);\n                        }\n                        else {\n                            error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(objectType));\n                        }\n                    }\n                    return anyType;\n                }\n            }\n            if (accessNode) {\n                var indexNode = accessNode.kind === 178 ? accessNode.argumentExpression : accessNode.indexType;\n                if (indexType.flags & (32 | 64)) {\n                    error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.text, typeToString(objectType));\n                }\n                else if (indexType.flags & (2 | 4)) {\n                    error(indexNode, ts.Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType));\n                }\n                else {\n                    error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));\n                }\n            }\n            return unknownType;\n        }\n        function getIndexedAccessForMappedType(type, indexType, accessNode) {\n            var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined;\n            if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) {\n                error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type));\n                return unknownType;\n            }\n            var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType);\n            var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper;\n            return instantiateType(getTemplateTypeFromMappedType(type), templateMapper);\n        }\n        function getIndexedAccessType(objectType, indexType, accessNode) {\n            if (maybeTypeOfKind(indexType, 540672 | 262144) || isGenericMappedType(objectType)) {\n                if (objectType.flags & 1) {\n                    return objectType;\n                }\n                if (accessNode) {\n                    if (!isTypeAssignableTo(indexType, getIndexType(objectType))) {\n                        error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));\n                        return unknownType;\n                    }\n                }\n                if (isGenericMappedType(objectType)) {\n                    return getIndexedAccessForMappedType(objectType, indexType, accessNode);\n                }\n                var id = objectType.id + \",\" + indexType.id;\n                return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType));\n            }\n            var apparentObjectType = getApparentType(objectType);\n            if (indexType.flags & 65536 && !(indexType.flags & 8190)) {\n                var propTypes = [];\n                for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) {\n                    var t = _a[_i];\n                    var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, false);\n                    if (propType === unknownType) {\n                        return unknownType;\n                    }\n                    propTypes.push(propType);\n                }\n                return getUnionType(propTypes);\n            }\n            return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, true);\n        }\n        function getTypeFromIndexedAccessTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getIndexedAccessType(getTypeFromTypeNode(node.objectType), getTypeFromTypeNode(node.indexType), node);\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromMappedTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                var type = createObjectType(32, node.symbol);\n                type.declaration = node;\n                type.aliasSymbol = getAliasSymbolForTypeNode(node);\n                type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node);\n                links.resolvedType = type;\n                getConstraintTypeFromMappedType(type);\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                var aliasSymbol = getAliasSymbolForTypeNode(node);\n                if (ts.isEmpty(node.symbol.members) && !aliasSymbol) {\n                    links.resolvedType = emptyTypeLiteralType;\n                }\n                else {\n                    var type = createObjectType(16, node.symbol);\n                    type.aliasSymbol = aliasSymbol;\n                    type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node);\n                    links.resolvedType = type;\n                }\n            }\n            return links.resolvedType;\n        }\n        function getAliasSymbolForTypeNode(node) {\n            return node.parent.kind === 228 ? getSymbolOfNode(node.parent) : undefined;\n        }\n        function getAliasTypeArgumentsForTypeNode(node) {\n            var symbol = getAliasSymbolForTypeNode(node);\n            return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : undefined;\n        }\n        function getSpreadType(left, right, isFromObjectLiteral) {\n            if (left.flags & 1 || right.flags & 1) {\n                return anyType;\n            }\n            left = filterType(left, function (t) { return !(t.flags & 6144); });\n            if (left.flags & 8192) {\n                return right;\n            }\n            right = filterType(right, function (t) { return !(t.flags & 6144); });\n            if (right.flags & 8192) {\n                return left;\n            }\n            if (left.flags & 65536) {\n                return mapType(left, function (t) { return getSpreadType(t, right, isFromObjectLiteral); });\n            }\n            if (right.flags & 65536) {\n                return mapType(right, function (t) { return getSpreadType(left, t, isFromObjectLiteral); });\n            }\n            var members = ts.createMap();\n            var skippedPrivateMembers = ts.createMap();\n            var stringIndexInfo;\n            var numberIndexInfo;\n            if (left === emptyObjectType) {\n                stringIndexInfo = getIndexInfoOfType(right, 0);\n                numberIndexInfo = getIndexInfoOfType(right, 1);\n            }\n            else {\n                stringIndexInfo = unionSpreadIndexInfos(getIndexInfoOfType(left, 0), getIndexInfoOfType(right, 0));\n                numberIndexInfo = unionSpreadIndexInfos(getIndexInfoOfType(left, 1), getIndexInfoOfType(right, 1));\n            }\n            for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) {\n                var rightProp = _a[_i];\n                var isOwnProperty = !(rightProp.flags & 8192) || isFromObjectLiteral;\n                var isSetterWithoutGetter = rightProp.flags & 65536 && !(rightProp.flags & 32768);\n                if (getDeclarationModifierFlagsFromSymbol(rightProp) & (8 | 16)) {\n                    skippedPrivateMembers[rightProp.name] = true;\n                }\n                else if (isOwnProperty && !isSetterWithoutGetter) {\n                    members[rightProp.name] = rightProp;\n                }\n            }\n            for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) {\n                var leftProp = _c[_b];\n                if (leftProp.flags & 65536 && !(leftProp.flags & 32768)\n                    || leftProp.name in skippedPrivateMembers) {\n                    continue;\n                }\n                if (leftProp.name in members) {\n                    var rightProp = members[leftProp.name];\n                    var rightType = getTypeOfSymbol(rightProp);\n                    if (maybeTypeOfKind(rightType, 2048) || rightProp.flags & 536870912) {\n                        var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations);\n                        var flags = 4 | 67108864 | (leftProp.flags & 536870912);\n                        var result = createSymbol(flags, leftProp.name);\n                        result.type = getUnionType([getTypeOfSymbol(leftProp), getTypeWithFacts(rightType, 131072)]);\n                        result.leftSpread = leftProp;\n                        result.rightSpread = rightProp;\n                        result.declarations = declarations;\n                        result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp);\n                        members[leftProp.name] = result;\n                    }\n                }\n                else {\n                    members[leftProp.name] = leftProp;\n                }\n            }\n            return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);\n        }\n        function createLiteralType(flags, text) {\n            var type = createType(flags);\n            type.text = text;\n            return type;\n        }\n        function getFreshTypeOfLiteralType(type) {\n            if (type.flags & 96 && !(type.flags & 1048576)) {\n                if (!type.freshType) {\n                    var freshType = createLiteralType(type.flags | 1048576, type.text);\n                    freshType.regularType = type;\n                    type.freshType = freshType;\n                }\n                return type.freshType;\n            }\n            return type;\n        }\n        function getRegularTypeOfLiteralType(type) {\n            return type.flags & 96 && type.flags & 1048576 ? type.regularType : type;\n        }\n        function getLiteralTypeForText(flags, text) {\n            var map = flags & 32 ? stringLiteralTypes : numericLiteralTypes;\n            return map[text] || (map[text] = createLiteralType(flags, text));\n        }\n        function getTypeFromLiteralTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getRegularTypeOfLiteralType(checkExpression(node.literal));\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromJSDocVariadicType(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                var type = getTypeFromTypeNode(node.type);\n                links.resolvedType = type ? createArrayType(type) : unknownType;\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromJSDocTupleType(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                var types = ts.map(node.types, getTypeFromTypeNode);\n                links.resolvedType = createTupleType(types);\n            }\n            return links.resolvedType;\n        }\n        function getThisType(node) {\n            var container = ts.getThisContainer(node, false);\n            var parent = container && container.parent;\n            if (parent && (ts.isClassLike(parent) || parent.kind === 227)) {\n                if (!(ts.getModifierFlags(container) & 32) &&\n                    (container.kind !== 150 || ts.isNodeDescendantOf(node, container.body))) {\n                    return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType;\n                }\n            }\n            error(node, ts.Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface);\n            return unknownType;\n        }\n        function getTypeFromThisTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getThisType(node);\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromTypeNode(node) {\n            switch (node.kind) {\n                case 118:\n                case 263:\n                case 264:\n                    return anyType;\n                case 134:\n                    return stringType;\n                case 132:\n                    return numberType;\n                case 121:\n                    return booleanType;\n                case 135:\n                    return esSymbolType;\n                case 104:\n                    return voidType;\n                case 137:\n                    return undefinedType;\n                case 94:\n                    return nullType;\n                case 129:\n                    return neverType;\n                case 289:\n                    return nullType;\n                case 290:\n                    return undefinedType;\n                case 291:\n                    return neverType;\n                case 167:\n                case 98:\n                    return getTypeFromThisTypeNode(node);\n                case 171:\n                    return getTypeFromLiteralTypeNode(node);\n                case 288:\n                    return getTypeFromLiteralTypeNode(node.literal);\n                case 157:\n                case 272:\n                    return getTypeFromTypeReference(node);\n                case 156:\n                    return booleanType;\n                case 199:\n                    return getTypeFromTypeReference(node);\n                case 160:\n                    return getTypeFromTypeQueryNode(node);\n                case 162:\n                case 265:\n                    return getTypeFromArrayTypeNode(node);\n                case 163:\n                    return getTypeFromTupleTypeNode(node);\n                case 164:\n                case 266:\n                    return getTypeFromUnionTypeNode(node);\n                case 165:\n                    return getTypeFromIntersectionTypeNode(node);\n                case 166:\n                case 268:\n                case 269:\n                case 276:\n                case 277:\n                case 273:\n                    return getTypeFromTypeNode(node.type);\n                case 270:\n                    return getTypeFromTypeNode(node.literal);\n                case 158:\n                case 159:\n                case 161:\n                case 287:\n                case 274:\n                    return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);\n                case 168:\n                    return getTypeFromTypeOperatorNode(node);\n                case 169:\n                    return getTypeFromIndexedAccessTypeNode(node);\n                case 170:\n                    return getTypeFromMappedTypeNode(node);\n                case 70:\n                case 141:\n                    var symbol = getSymbolAtLocation(node);\n                    return symbol && getDeclaredTypeOfSymbol(symbol);\n                case 267:\n                    return getTypeFromJSDocTupleType(node);\n                case 275:\n                    return getTypeFromJSDocVariadicType(node);\n                default:\n                    return unknownType;\n            }\n        }\n        function instantiateList(items, mapper, instantiator) {\n            if (items && items.length) {\n                var result = [];\n                for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {\n                    var v = items_1[_i];\n                    result.push(instantiator(v, mapper));\n                }\n                return result;\n            }\n            return items;\n        }\n        function instantiateTypes(types, mapper) {\n            return instantiateList(types, mapper, instantiateType);\n        }\n        function instantiateSignatures(signatures, mapper) {\n            return instantiateList(signatures, mapper, instantiateSignature);\n        }\n        function instantiateCached(type, mapper, instantiator) {\n            var instantiations = mapper.instantiations || (mapper.instantiations = []);\n            return instantiations[type.id] || (instantiations[type.id] = instantiator(type, mapper));\n        }\n        function createUnaryTypeMapper(source, target) {\n            return function (t) { return t === source ? target : t; };\n        }\n        function createBinaryTypeMapper(source1, target1, source2, target2) {\n            return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; };\n        }\n        function createArrayTypeMapper(sources, targets) {\n            return function (t) {\n                for (var i = 0; i < sources.length; i++) {\n                    if (t === sources[i]) {\n                        return targets ? targets[i] : anyType;\n                    }\n                }\n                return t;\n            };\n        }\n        function createTypeMapper(sources, targets) {\n            var count = sources.length;\n            var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) :\n                count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) :\n                    createArrayTypeMapper(sources, targets);\n            mapper.mappedTypes = sources;\n            return mapper;\n        }\n        function createTypeEraser(sources) {\n            return createTypeMapper(sources, undefined);\n        }\n        function getInferenceMapper(context) {\n            if (!context.mapper) {\n                var mapper = function (t) {\n                    var typeParameters = context.signature.typeParameters;\n                    for (var i = 0; i < typeParameters.length; i++) {\n                        if (t === typeParameters[i]) {\n                            context.inferences[i].isFixed = true;\n                            return getInferredType(context, i);\n                        }\n                    }\n                    return t;\n                };\n                mapper.mappedTypes = context.signature.typeParameters;\n                mapper.context = context;\n                context.mapper = mapper;\n            }\n            return context.mapper;\n        }\n        function identityMapper(type) {\n            return type;\n        }\n        function combineTypeMappers(mapper1, mapper2) {\n            var mapper = function (t) { return instantiateType(mapper1(t), mapper2); };\n            mapper.mappedTypes = mapper1.mappedTypes;\n            return mapper;\n        }\n        function cloneTypeParameter(typeParameter) {\n            var result = createType(16384);\n            result.symbol = typeParameter.symbol;\n            result.target = typeParameter;\n            return result;\n        }\n        function cloneTypePredicate(predicate, mapper) {\n            if (ts.isIdentifierTypePredicate(predicate)) {\n                return {\n                    kind: 1,\n                    parameterName: predicate.parameterName,\n                    parameterIndex: predicate.parameterIndex,\n                    type: instantiateType(predicate.type, mapper)\n                };\n            }\n            else {\n                return {\n                    kind: 0,\n                    type: instantiateType(predicate.type, mapper)\n                };\n            }\n        }\n        function instantiateSignature(signature, mapper, eraseTypeParameters) {\n            var freshTypeParameters;\n            var freshTypePredicate;\n            if (signature.typeParameters && !eraseTypeParameters) {\n                freshTypeParameters = ts.map(signature.typeParameters, cloneTypeParameter);\n                mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper);\n                for (var _i = 0, freshTypeParameters_1 = freshTypeParameters; _i < freshTypeParameters_1.length; _i++) {\n                    var tp = freshTypeParameters_1[_i];\n                    tp.mapper = mapper;\n                }\n            }\n            if (signature.typePredicate) {\n                freshTypePredicate = cloneTypePredicate(signature.typePredicate, mapper);\n            }\n            var result = createSignature(signature.declaration, freshTypeParameters, signature.thisParameter && instantiateSymbol(signature.thisParameter, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasLiteralTypes);\n            result.target = signature;\n            result.mapper = mapper;\n            return result;\n        }\n        function instantiateSymbol(symbol, mapper) {\n            if (symbol.flags & 16777216) {\n                var links = getSymbolLinks(symbol);\n                symbol = links.target;\n                mapper = combineTypeMappers(links.mapper, mapper);\n            }\n            var result = createSymbol(16777216 | 67108864 | symbol.flags, symbol.name);\n            result.declarations = symbol.declarations;\n            result.parent = symbol.parent;\n            result.target = symbol;\n            result.mapper = mapper;\n            if (symbol.valueDeclaration) {\n                result.valueDeclaration = symbol.valueDeclaration;\n            }\n            return result;\n        }\n        function instantiateAnonymousType(type, mapper) {\n            var result = createObjectType(16 | 64, type.symbol);\n            result.target = type.objectFlags & 64 ? type.target : type;\n            result.mapper = type.objectFlags & 64 ? combineTypeMappers(type.mapper, mapper) : mapper;\n            result.aliasSymbol = type.aliasSymbol;\n            result.aliasTypeArguments = instantiateTypes(type.aliasTypeArguments, mapper);\n            return result;\n        }\n        function instantiateMappedType(type, mapper) {\n            var constraintType = getConstraintTypeFromMappedType(type);\n            if (constraintType.flags & 262144) {\n                var typeVariable_1 = constraintType.type;\n                var mappedTypeVariable = instantiateType(typeVariable_1, mapper);\n                if (typeVariable_1 !== mappedTypeVariable) {\n                    return mapType(mappedTypeVariable, function (t) {\n                        if (isMappableType(t)) {\n                            var replacementMapper = createUnaryTypeMapper(typeVariable_1, t);\n                            var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper);\n                            combinedMapper.mappedTypes = mapper.mappedTypes;\n                            return instantiateMappedObjectType(type, combinedMapper);\n                        }\n                        return t;\n                    });\n                }\n            }\n            return instantiateMappedObjectType(type, mapper);\n        }\n        function isMappableType(type) {\n            return type.flags & (16384 | 32768 | 131072 | 524288);\n        }\n        function instantiateMappedObjectType(type, mapper) {\n            var result = createObjectType(32 | 64, type.symbol);\n            result.declaration = type.declaration;\n            result.mapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper;\n            result.aliasSymbol = type.aliasSymbol;\n            result.aliasTypeArguments = instantiateTypes(type.aliasTypeArguments, mapper);\n            return result;\n        }\n        function isSymbolInScopeOfMappedTypeParameter(symbol, mapper) {\n            if (!(symbol.declarations && symbol.declarations.length)) {\n                return false;\n            }\n            var mappedTypes = mapper.mappedTypes;\n            var node = symbol.declarations[0].parent;\n            while (node) {\n                switch (node.kind) {\n                    case 158:\n                    case 159:\n                    case 225:\n                    case 149:\n                    case 148:\n                    case 150:\n                    case 153:\n                    case 154:\n                    case 155:\n                    case 151:\n                    case 152:\n                    case 184:\n                    case 185:\n                    case 226:\n                    case 197:\n                    case 227:\n                    case 228:\n                        var declaration = node;\n                        if (declaration.typeParameters) {\n                            for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) {\n                                var d = _a[_i];\n                                if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) {\n                                    return true;\n                                }\n                            }\n                        }\n                        if (ts.isClassLike(node) || node.kind === 227) {\n                            var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType;\n                            if (thisType && ts.contains(mappedTypes, thisType)) {\n                                return true;\n                            }\n                        }\n                        break;\n                    case 230:\n                    case 261:\n                        return false;\n                }\n                node = node.parent;\n            }\n            return false;\n        }\n        function isTopLevelTypeAlias(symbol) {\n            if (symbol.declarations && symbol.declarations.length) {\n                var parentKind = symbol.declarations[0].parent.kind;\n                return parentKind === 261 || parentKind === 231;\n            }\n            return false;\n        }\n        function instantiateType(type, mapper) {\n            if (type && mapper !== identityMapper) {\n                if (type.aliasSymbol && isTopLevelTypeAlias(type.aliasSymbol)) {\n                    if (type.aliasTypeArguments) {\n                        return getTypeAliasInstantiation(type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));\n                    }\n                    return type;\n                }\n                return instantiateTypeNoAlias(type, mapper);\n            }\n            return type;\n        }\n        function instantiateTypeNoAlias(type, mapper) {\n            if (type.flags & 16384) {\n                return mapper(type);\n            }\n            if (type.flags & 32768) {\n                if (type.objectFlags & 16) {\n                    return type.symbol &&\n                        type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) &&\n                        (type.objectFlags & 64 || isSymbolInScopeOfMappedTypeParameter(type.symbol, mapper)) ?\n                        instantiateCached(type, mapper, instantiateAnonymousType) : type;\n                }\n                if (type.objectFlags & 32) {\n                    return instantiateCached(type, mapper, instantiateMappedType);\n                }\n                if (type.objectFlags & 4) {\n                    return createTypeReference(type.target, instantiateTypes(type.typeArguments, mapper));\n                }\n            }\n            if (type.flags & 65536 && !(type.flags & 8190)) {\n                return getUnionType(instantiateTypes(type.types, mapper), false, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));\n            }\n            if (type.flags & 131072) {\n                return getIntersectionType(instantiateTypes(type.types, mapper), type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));\n            }\n            if (type.flags & 262144) {\n                return getIndexType(instantiateType(type.type, mapper));\n            }\n            if (type.flags & 524288) {\n                return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper));\n            }\n            return type;\n        }\n        function instantiateIndexInfo(info, mapper) {\n            return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration);\n        }\n        function isContextSensitive(node) {\n            ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node));\n            switch (node.kind) {\n                case 184:\n                case 185:\n                    return isContextSensitiveFunctionLikeDeclaration(node);\n                case 176:\n                    return ts.forEach(node.properties, isContextSensitive);\n                case 175:\n                    return ts.forEach(node.elements, isContextSensitive);\n                case 193:\n                    return isContextSensitive(node.whenTrue) ||\n                        isContextSensitive(node.whenFalse);\n                case 192:\n                    return node.operatorToken.kind === 53 &&\n                        (isContextSensitive(node.left) || isContextSensitive(node.right));\n                case 257:\n                    return isContextSensitive(node.initializer);\n                case 149:\n                case 148:\n                    return isContextSensitiveFunctionLikeDeclaration(node);\n                case 183:\n                    return isContextSensitive(node.expression);\n            }\n            return false;\n        }\n        function isContextSensitiveFunctionLikeDeclaration(node) {\n            if (node.typeParameters) {\n                return false;\n            }\n            if (ts.forEach(node.parameters, function (p) { return !p.type; })) {\n                return true;\n            }\n            if (node.kind === 185) {\n                return false;\n            }\n            var parameter = ts.firstOrUndefined(node.parameters);\n            return !(parameter && ts.parameterIsThisKeyword(parameter));\n        }\n        function isContextSensitiveFunctionOrObjectLiteralMethod(func) {\n            return (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);\n        }\n        function getTypeWithoutSignatures(type) {\n            if (type.flags & 32768) {\n                var resolved = resolveStructuredTypeMembers(type);\n                if (resolved.constructSignatures.length) {\n                    var result = createObjectType(16, type.symbol);\n                    result.members = resolved.members;\n                    result.properties = resolved.properties;\n                    result.callSignatures = emptyArray;\n                    result.constructSignatures = emptyArray;\n                    type = result;\n                }\n            }\n            return type;\n        }\n        function isTypeIdenticalTo(source, target) {\n            return isTypeRelatedTo(source, target, identityRelation);\n        }\n        function compareTypesIdentical(source, target) {\n            return isTypeRelatedTo(source, target, identityRelation) ? -1 : 0;\n        }\n        function compareTypesAssignable(source, target) {\n            return isTypeRelatedTo(source, target, assignableRelation) ? -1 : 0;\n        }\n        function isTypeSubtypeOf(source, target) {\n            return isTypeRelatedTo(source, target, subtypeRelation);\n        }\n        function isTypeAssignableTo(source, target) {\n            return isTypeRelatedTo(source, target, assignableRelation);\n        }\n        function isTypeInstanceOf(source, target) {\n            return source === target || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target);\n        }\n        function isTypeComparableTo(source, target) {\n            return isTypeRelatedTo(source, target, comparableRelation);\n        }\n        function areTypesComparable(type1, type2) {\n            return isTypeComparableTo(type1, type2) || isTypeComparableTo(type2, type1);\n        }\n        function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) {\n            return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain);\n        }\n        function checkTypeAssignableTo(source, target, errorNode, headMessage, containingMessageChain) {\n            return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain);\n        }\n        function checkTypeComparableTo(source, target, errorNode, headMessage, containingMessageChain) {\n            return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain);\n        }\n        function isSignatureAssignableTo(source, target, ignoreReturnTypes) {\n            return compareSignaturesRelated(source, target, ignoreReturnTypes, false, undefined, compareTypesAssignable) !== 0;\n        }\n        function compareSignaturesRelated(source, target, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) {\n            if (source === target) {\n                return -1;\n            }\n            if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) {\n                return 0;\n            }\n            source = getErasedSignature(source);\n            target = getErasedSignature(target);\n            var result = -1;\n            var sourceThisType = getThisTypeOfSignature(source);\n            if (sourceThisType && sourceThisType !== voidType) {\n                var targetThisType = getThisTypeOfSignature(target);\n                if (targetThisType) {\n                    var related = compareTypes(sourceThisType, targetThisType, false)\n                        || compareTypes(targetThisType, sourceThisType, reportErrors);\n                    if (!related) {\n                        if (reportErrors) {\n                            errorReporter(ts.Diagnostics.The_this_types_of_each_signature_are_incompatible);\n                        }\n                        return 0;\n                    }\n                    result &= related;\n                }\n            }\n            var sourceMax = getNumNonRestParameters(source);\n            var targetMax = getNumNonRestParameters(target);\n            var checkCount = getNumParametersToCheckForSignatureRelatability(source, sourceMax, target, targetMax);\n            var sourceParams = source.parameters;\n            var targetParams = target.parameters;\n            for (var i = 0; i < checkCount; i++) {\n                var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source);\n                var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target);\n                var related = compareTypes(s, t, false) || compareTypes(t, s, reportErrors);\n                if (!related) {\n                    if (reportErrors) {\n                        errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name);\n                    }\n                    return 0;\n                }\n                result &= related;\n            }\n            if (!ignoreReturnTypes) {\n                var targetReturnType = getReturnTypeOfSignature(target);\n                if (targetReturnType === voidType) {\n                    return result;\n                }\n                var sourceReturnType = getReturnTypeOfSignature(source);\n                if (target.typePredicate) {\n                    if (source.typePredicate) {\n                        result &= compareTypePredicateRelatedTo(source.typePredicate, target.typePredicate, reportErrors, errorReporter, compareTypes);\n                    }\n                    else if (ts.isIdentifierTypePredicate(target.typePredicate)) {\n                        if (reportErrors) {\n                            errorReporter(ts.Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source));\n                        }\n                        return 0;\n                    }\n                }\n                else {\n                    result &= compareTypes(sourceReturnType, targetReturnType, reportErrors);\n                }\n            }\n            return result;\n        }\n        function compareTypePredicateRelatedTo(source, target, reportErrors, errorReporter, compareTypes) {\n            if (source.kind !== target.kind) {\n                if (reportErrors) {\n                    errorReporter(ts.Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard);\n                    errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target));\n                }\n                return 0;\n            }\n            if (source.kind === 1) {\n                var sourceIdentifierPredicate = source;\n                var targetIdentifierPredicate = target;\n                if (sourceIdentifierPredicate.parameterIndex !== targetIdentifierPredicate.parameterIndex) {\n                    if (reportErrors) {\n                        errorReporter(ts.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, sourceIdentifierPredicate.parameterName, targetIdentifierPredicate.parameterName);\n                        errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target));\n                    }\n                    return 0;\n                }\n            }\n            var related = compareTypes(source.type, target.type, reportErrors);\n            if (related === 0 && reportErrors) {\n                errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target));\n            }\n            return related;\n        }\n        function isImplementationCompatibleWithOverload(implementation, overload) {\n            var erasedSource = getErasedSignature(implementation);\n            var erasedTarget = getErasedSignature(overload);\n            var sourceReturnType = getReturnTypeOfSignature(erasedSource);\n            var targetReturnType = getReturnTypeOfSignature(erasedTarget);\n            if (targetReturnType === voidType\n                || isTypeRelatedTo(targetReturnType, sourceReturnType, assignableRelation)\n                || isTypeRelatedTo(sourceReturnType, targetReturnType, assignableRelation)) {\n                return isSignatureAssignableTo(erasedSource, erasedTarget, true);\n            }\n            return false;\n        }\n        function getNumNonRestParameters(signature) {\n            var numParams = signature.parameters.length;\n            return signature.hasRestParameter ?\n                numParams - 1 :\n                numParams;\n        }\n        function getNumParametersToCheckForSignatureRelatability(source, sourceNonRestParamCount, target, targetNonRestParamCount) {\n            if (source.hasRestParameter === target.hasRestParameter) {\n                if (source.hasRestParameter) {\n                    return Math.max(sourceNonRestParamCount, targetNonRestParamCount) + 1;\n                }\n                else {\n                    return Math.min(sourceNonRestParamCount, targetNonRestParamCount);\n                }\n            }\n            else {\n                return source.hasRestParameter ?\n                    targetNonRestParamCount :\n                    sourceNonRestParamCount;\n            }\n        }\n        function isEnumTypeRelatedTo(source, target, errorReporter) {\n            if (source === target) {\n                return true;\n            }\n            var id = source.id + \",\" + target.id;\n            if (enumRelation[id] !== undefined) {\n                return enumRelation[id];\n            }\n            if (source.symbol.name !== target.symbol.name ||\n                !(source.symbol.flags & 256) || !(target.symbol.flags & 256) ||\n                (source.flags & 65536) !== (target.flags & 65536)) {\n                return enumRelation[id] = false;\n            }\n            var targetEnumType = getTypeOfSymbol(target.symbol);\n            for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) {\n                var property = _a[_i];\n                if (property.flags & 8) {\n                    var targetProperty = getPropertyOfType(targetEnumType, property.name);\n                    if (!targetProperty || !(targetProperty.flags & 8)) {\n                        if (errorReporter) {\n                            errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128));\n                        }\n                        return enumRelation[id] = false;\n                    }\n                }\n            }\n            return enumRelation[id] = true;\n        }\n        function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {\n            if (target.flags & 8192)\n                return false;\n            if (target.flags & 1 || source.flags & 8192)\n                return true;\n            if (source.flags & 262178 && target.flags & 2)\n                return true;\n            if (source.flags & 340 && target.flags & 4)\n                return true;\n            if (source.flags & 136 && target.flags & 8)\n                return true;\n            if (source.flags & 256 && target.flags & 16 && source.baseType === target)\n                return true;\n            if (source.flags & 16 && target.flags & 16 && isEnumTypeRelatedTo(source, target, errorReporter))\n                return true;\n            if (source.flags & 2048 && (!strictNullChecks || target.flags & (2048 | 1024)))\n                return true;\n            if (source.flags & 4096 && (!strictNullChecks || target.flags & 4096))\n                return true;\n            if (relation === assignableRelation || relation === comparableRelation) {\n                if (source.flags & 1)\n                    return true;\n                if ((source.flags & 4 | source.flags & 64) && target.flags & 272)\n                    return true;\n                if (source.flags & 256 &&\n                    target.flags & 256 &&\n                    source.text === target.text &&\n                    isEnumTypeRelatedTo(source.baseType, target.baseType, errorReporter)) {\n                    return true;\n                }\n                if (source.flags & 256 &&\n                    target.flags & 16 &&\n                    isEnumTypeRelatedTo(target, source.baseType, errorReporter)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function isTypeRelatedTo(source, target, relation) {\n            if (source.flags & 96 && source.flags & 1048576) {\n                source = source.regularType;\n            }\n            if (target.flags & 96 && target.flags & 1048576) {\n                target = target.regularType;\n            }\n            if (source === target || relation !== identityRelation && isSimpleTypeRelatedTo(source, target, relation)) {\n                return true;\n            }\n            if (source.flags & 32768 && target.flags & 32768) {\n                var id = relation !== identityRelation || source.id < target.id ? source.id + \",\" + target.id : target.id + \",\" + source.id;\n                var related = relation[id];\n                if (related !== undefined) {\n                    return related === 1;\n                }\n            }\n            if (source.flags & 507904 || target.flags & 507904) {\n                return checkTypeRelatedTo(source, target, relation, undefined, undefined, undefined);\n            }\n            return false;\n        }\n        function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain) {\n            var errorInfo;\n            var sourceStack;\n            var targetStack;\n            var maybeStack;\n            var expandingFlags;\n            var depth = 0;\n            var overflow = false;\n            ts.Debug.assert(relation !== identityRelation || !errorNode, \"no error reporting in identity checking\");\n            var result = isRelatedTo(source, target, !!errorNode, headMessage);\n            if (overflow) {\n                error(errorNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));\n            }\n            else if (errorInfo) {\n                if (containingMessageChain) {\n                    errorInfo = ts.concatenateDiagnosticMessageChains(containingMessageChain, errorInfo);\n                }\n                diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo));\n            }\n            return result !== 0;\n            function reportError(message, arg0, arg1, arg2) {\n                ts.Debug.assert(!!errorNode);\n                errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2);\n            }\n            function reportRelationError(message, source, target) {\n                var sourceType = typeToString(source);\n                var targetType = typeToString(target);\n                if (sourceType === targetType) {\n                    sourceType = typeToString(source, undefined, 128);\n                    targetType = typeToString(target, undefined, 128);\n                }\n                if (!message) {\n                    if (relation === comparableRelation) {\n                        message = ts.Diagnostics.Type_0_is_not_comparable_to_type_1;\n                    }\n                    else if (sourceType === targetType) {\n                        message = ts.Diagnostics.Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated;\n                    }\n                    else {\n                        message = ts.Diagnostics.Type_0_is_not_assignable_to_type_1;\n                    }\n                }\n                reportError(message, sourceType, targetType);\n            }\n            function tryElaborateErrorsForPrimitivesAndObjects(source, target) {\n                var sourceType = typeToString(source);\n                var targetType = typeToString(target);\n                if ((globalStringType === source && stringType === target) ||\n                    (globalNumberType === source && numberType === target) ||\n                    (globalBooleanType === source && booleanType === target) ||\n                    (getGlobalESSymbolType() === source && esSymbolType === target)) {\n                    reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);\n                }\n            }\n            function isRelatedTo(source, target, reportErrors, headMessage) {\n                var result;\n                if (source.flags & 96 && source.flags & 1048576) {\n                    source = source.regularType;\n                }\n                if (target.flags & 96 && target.flags & 1048576) {\n                    target = target.regularType;\n                }\n                if (source === target)\n                    return -1;\n                if (relation === identityRelation) {\n                    return isIdenticalTo(source, target);\n                }\n                if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))\n                    return -1;\n                if (getObjectFlags(source) & 128 && source.flags & 1048576) {\n                    if (hasExcessProperties(source, target, reportErrors)) {\n                        if (reportErrors) {\n                            reportRelationError(headMessage, source, target);\n                        }\n                        return 0;\n                    }\n                    if (target.flags & 196608) {\n                        source = getRegularTypeOfObjectLiteral(source);\n                    }\n                }\n                var saveErrorInfo = errorInfo;\n                if (source.flags & 65536) {\n                    if (relation === comparableRelation) {\n                        result = someTypeRelatedToType(source, target, reportErrors && !(source.flags & 8190));\n                    }\n                    else {\n                        result = eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 8190));\n                    }\n                    if (result) {\n                        return result;\n                    }\n                }\n                else if (target.flags & 65536) {\n                    if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 8190) && !(target.flags & 8190))) {\n                        return result;\n                    }\n                }\n                else if (target.flags & 131072) {\n                    if (result = typeRelatedToEachType(source, target, reportErrors)) {\n                        return result;\n                    }\n                }\n                else if (source.flags & 131072) {\n                    if (result = someTypeRelatedToType(source, target, false)) {\n                        return result;\n                    }\n                }\n                if (target.flags & 16384) {\n                    if (getObjectFlags(source) & 32 && getConstraintTypeFromMappedType(source) === getIndexType(target)) {\n                        if (!source.declaration.questionToken) {\n                            var templateType = getTemplateTypeFromMappedType(source);\n                            var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source));\n                            if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) {\n                                return result;\n                            }\n                        }\n                    }\n                    else {\n                        var constraint = getConstraintOfTypeParameter(target);\n                        if (constraint && constraint.flags & 262144) {\n                            if (result = isRelatedTo(source, constraint, reportErrors)) {\n                                return result;\n                            }\n                        }\n                    }\n                }\n                else if (target.flags & 262144) {\n                    if (source.flags & 262144) {\n                        if (result = isRelatedTo(target.type, source.type, false)) {\n                            return result;\n                        }\n                    }\n                    if (target.type.flags & 16384) {\n                        var constraint = getConstraintOfTypeParameter(target.type);\n                        if (constraint) {\n                            if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) {\n                                return result;\n                            }\n                        }\n                    }\n                }\n                else if (target.flags & 524288) {\n                    if (source.flags & 524288 && source.indexType === target.indexType) {\n                        if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) {\n                            return result;\n                        }\n                    }\n                }\n                if (source.flags & 16384) {\n                    if (getObjectFlags(target) & 32 && getConstraintTypeFromMappedType(target) === getIndexType(source)) {\n                        var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target));\n                        var templateType = getTemplateTypeFromMappedType(target);\n                        if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) {\n                            return result;\n                        }\n                    }\n                    else {\n                        var constraint = getConstraintOfTypeParameter(source);\n                        if (!constraint || constraint.flags & 1) {\n                            constraint = emptyObjectType;\n                        }\n                        constraint = getTypeWithThisArgument(constraint, source);\n                        var reportConstraintErrors = reportErrors && constraint !== emptyObjectType;\n                        if (result = isRelatedTo(constraint, target, reportConstraintErrors)) {\n                            errorInfo = saveErrorInfo;\n                            return result;\n                        }\n                    }\n                }\n                else {\n                    if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && source.target === target.target) {\n                        if (result = typeArgumentsRelatedTo(source, target, reportErrors)) {\n                            return result;\n                        }\n                    }\n                    var apparentSource = getApparentType(source);\n                    if (apparentSource.flags & (32768 | 131072) && target.flags & 32768) {\n                        var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190);\n                        if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) {\n                            errorInfo = saveErrorInfo;\n                            return result;\n                        }\n                    }\n                }\n                if (reportErrors) {\n                    if (source.flags & 32768 && target.flags & 8190) {\n                        tryElaborateErrorsForPrimitivesAndObjects(source, target);\n                    }\n                    else if (source.symbol && source.flags & 32768 && globalObjectType === source) {\n                        reportError(ts.Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);\n                    }\n                    reportRelationError(headMessage, source, target);\n                }\n                return 0;\n            }\n            function isIdenticalTo(source, target) {\n                var result;\n                if (source.flags & 32768 && target.flags & 32768) {\n                    if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && source.target === target.target) {\n                        if (result = typeArgumentsRelatedTo(source, target, false)) {\n                            return result;\n                        }\n                    }\n                    return objectTypeRelatedTo(source, source, target, false);\n                }\n                if (source.flags & 65536 && target.flags & 65536 ||\n                    source.flags & 131072 && target.flags & 131072) {\n                    if (result = eachTypeRelatedToSomeType(source, target)) {\n                        if (result &= eachTypeRelatedToSomeType(target, source)) {\n                            return result;\n                        }\n                    }\n                }\n                return 0;\n            }\n            function isKnownProperty(type, name) {\n                if (type.flags & 32768) {\n                    var resolved = resolveStructuredTypeMembers(type);\n                    if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyObjectType(resolved)) ||\n                        resolved.stringIndexInfo ||\n                        (resolved.numberIndexInfo && isNumericLiteralName(name)) ||\n                        getPropertyOfType(type, name)) {\n                        return true;\n                    }\n                }\n                else if (type.flags & 196608) {\n                    for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                        var t = _a[_i];\n                        if (isKnownProperty(t, name)) {\n                            return true;\n                        }\n                    }\n                }\n                return false;\n            }\n            function isEmptyObjectType(t) {\n                return t.properties.length === 0 &&\n                    t.callSignatures.length === 0 &&\n                    t.constructSignatures.length === 0 &&\n                    !t.stringIndexInfo &&\n                    !t.numberIndexInfo;\n            }\n            function hasExcessProperties(source, target, reportErrors) {\n                if (maybeTypeOfKind(target, 32768) && !(getObjectFlags(target) & 512)) {\n                    for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {\n                        var prop = _a[_i];\n                        if (!isKnownProperty(target, prop.name)) {\n                            if (reportErrors) {\n                                ts.Debug.assert(!!errorNode);\n                                errorNode = prop.valueDeclaration;\n                                reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target));\n                            }\n                            return true;\n                        }\n                    }\n                }\n                return false;\n            }\n            function eachTypeRelatedToSomeType(source, target) {\n                var result = -1;\n                var sourceTypes = source.types;\n                for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) {\n                    var sourceType = sourceTypes_1[_i];\n                    var related = typeRelatedToSomeType(sourceType, target, false);\n                    if (!related) {\n                        return 0;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            function typeRelatedToSomeType(source, target, reportErrors) {\n                var targetTypes = target.types;\n                if (target.flags & 65536 && containsType(targetTypes, source)) {\n                    return -1;\n                }\n                var len = targetTypes.length;\n                for (var i = 0; i < len; i++) {\n                    var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1);\n                    if (related) {\n                        return related;\n                    }\n                }\n                return 0;\n            }\n            function typeRelatedToEachType(source, target, reportErrors) {\n                var result = -1;\n                var targetTypes = target.types;\n                for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) {\n                    var targetType = targetTypes_1[_i];\n                    var related = isRelatedTo(source, targetType, reportErrors);\n                    if (!related) {\n                        return 0;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            function someTypeRelatedToType(source, target, reportErrors) {\n                var sourceTypes = source.types;\n                if (source.flags & 65536 && containsType(sourceTypes, target)) {\n                    return -1;\n                }\n                var len = sourceTypes.length;\n                for (var i = 0; i < len; i++) {\n                    var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1);\n                    if (related) {\n                        return related;\n                    }\n                }\n                return 0;\n            }\n            function eachTypeRelatedToType(source, target, reportErrors) {\n                var result = -1;\n                var sourceTypes = source.types;\n                for (var _i = 0, sourceTypes_2 = sourceTypes; _i < sourceTypes_2.length; _i++) {\n                    var sourceType = sourceTypes_2[_i];\n                    var related = isRelatedTo(sourceType, target, reportErrors);\n                    if (!related) {\n                        return 0;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            function typeArgumentsRelatedTo(source, target, reportErrors) {\n                var sources = source.typeArguments || emptyArray;\n                var targets = target.typeArguments || emptyArray;\n                if (sources.length !== targets.length && relation === identityRelation) {\n                    return 0;\n                }\n                var length = sources.length <= targets.length ? sources.length : targets.length;\n                var result = -1;\n                for (var i = 0; i < length; i++) {\n                    var related = isRelatedTo(sources[i], targets[i], reportErrors);\n                    if (!related) {\n                        return 0;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            function objectTypeRelatedTo(source, originalSource, target, reportErrors) {\n                if (overflow) {\n                    return 0;\n                }\n                var id = relation !== identityRelation || source.id < target.id ? source.id + \",\" + target.id : target.id + \",\" + source.id;\n                var related = relation[id];\n                if (related !== undefined) {\n                    if (reportErrors && related === 2) {\n                        relation[id] = 3;\n                    }\n                    else {\n                        return related === 1 ? -1 : 0;\n                    }\n                }\n                if (depth > 0) {\n                    for (var i = 0; i < depth; i++) {\n                        if (maybeStack[i][id]) {\n                            return 1;\n                        }\n                    }\n                    if (depth === 100) {\n                        overflow = true;\n                        return 0;\n                    }\n                }\n                else {\n                    sourceStack = [];\n                    targetStack = [];\n                    maybeStack = [];\n                    expandingFlags = 0;\n                }\n                sourceStack[depth] = source;\n                targetStack[depth] = target;\n                maybeStack[depth] = ts.createMap();\n                maybeStack[depth][id] = 1;\n                depth++;\n                var saveExpandingFlags = expandingFlags;\n                if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth))\n                    expandingFlags |= 1;\n                if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth))\n                    expandingFlags |= 2;\n                var result;\n                if (expandingFlags === 3) {\n                    result = 1;\n                }\n                else if (isGenericMappedType(source) || isGenericMappedType(target)) {\n                    result = mappedTypeRelatedTo(source, target, reportErrors);\n                }\n                else {\n                    result = propertiesRelatedTo(source, target, reportErrors);\n                    if (result) {\n                        result &= signaturesRelatedTo(source, target, 0, reportErrors);\n                        if (result) {\n                            result &= signaturesRelatedTo(source, target, 1, reportErrors);\n                            if (result) {\n                                result &= indexTypesRelatedTo(source, originalSource, target, 0, reportErrors);\n                                if (result) {\n                                    result &= indexTypesRelatedTo(source, originalSource, target, 1, reportErrors);\n                                }\n                            }\n                        }\n                    }\n                }\n                expandingFlags = saveExpandingFlags;\n                depth--;\n                if (result) {\n                    var maybeCache = maybeStack[depth];\n                    var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1];\n                    ts.copyProperties(maybeCache, destinationCache);\n                }\n                else {\n                    relation[id] = reportErrors ? 3 : 2;\n                }\n                return result;\n            }\n            function mappedTypeRelatedTo(source, target, reportErrors) {\n                if (isGenericMappedType(target)) {\n                    if (isGenericMappedType(source)) {\n                        var result_2;\n                        if (relation === identityRelation) {\n                            var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken;\n                            var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken;\n                            if (readonlyMatches && optionalMatches) {\n                                if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {\n                                    return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors);\n                                }\n                            }\n                        }\n                        else {\n                            if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) {\n                                if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {\n                                    return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors);\n                                }\n                            }\n                        }\n                    }\n                }\n                else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) {\n                    return -1;\n                }\n                return 0;\n            }\n            function propertiesRelatedTo(source, target, reportErrors) {\n                if (relation === identityRelation) {\n                    return propertiesIdenticalTo(source, target);\n                }\n                var result = -1;\n                var properties = getPropertiesOfObjectType(target);\n                var requireOptionalProperties = relation === subtypeRelation && !(getObjectFlags(source) & 128);\n                for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) {\n                    var targetProp = properties_3[_i];\n                    var sourceProp = getPropertyOfType(source, targetProp.name);\n                    if (sourceProp !== targetProp) {\n                        if (!sourceProp) {\n                            if (!(targetProp.flags & 536870912) || requireOptionalProperties) {\n                                if (reportErrors) {\n                                    reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source));\n                                }\n                                return 0;\n                            }\n                        }\n                        else if (!(targetProp.flags & 134217728)) {\n                            var sourcePropFlags = getDeclarationModifierFlagsFromSymbol(sourceProp);\n                            var targetPropFlags = getDeclarationModifierFlagsFromSymbol(targetProp);\n                            if (sourcePropFlags & 8 || targetPropFlags & 8) {\n                                if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) {\n                                    if (reportErrors) {\n                                        if (sourcePropFlags & 8 && targetPropFlags & 8) {\n                                            reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp));\n                                        }\n                                        else {\n                                            reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 8 ? source : target), typeToString(sourcePropFlags & 8 ? target : source));\n                                        }\n                                    }\n                                    return 0;\n                                }\n                            }\n                            else if (targetPropFlags & 16) {\n                                var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32;\n                                var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(getParentOfSymbol(sourceProp)) : undefined;\n                                var targetClass = getDeclaredTypeOfSymbol(getParentOfSymbol(targetProp));\n                                if (!sourceClass || !hasBaseType(sourceClass, targetClass)) {\n                                    if (reportErrors) {\n                                        reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass));\n                                    }\n                                    return 0;\n                                }\n                            }\n                            else if (sourcePropFlags & 16) {\n                                if (reportErrors) {\n                                    reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target));\n                                }\n                                return 0;\n                            }\n                            var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors);\n                            if (!related) {\n                                if (reportErrors) {\n                                    reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));\n                                }\n                                return 0;\n                            }\n                            result &= related;\n                            if (relation !== comparableRelation && sourceProp.flags & 536870912 && !(targetProp.flags & 536870912)) {\n                                if (reportErrors) {\n                                    reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target));\n                                }\n                                return 0;\n                            }\n                        }\n                    }\n                }\n                return result;\n            }\n            function propertiesIdenticalTo(source, target) {\n                if (!(source.flags & 32768 && target.flags & 32768)) {\n                    return 0;\n                }\n                var sourceProperties = getPropertiesOfObjectType(source);\n                var targetProperties = getPropertiesOfObjectType(target);\n                if (sourceProperties.length !== targetProperties.length) {\n                    return 0;\n                }\n                var result = -1;\n                for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) {\n                    var sourceProp = sourceProperties_1[_i];\n                    var targetProp = getPropertyOfObjectType(target, sourceProp.name);\n                    if (!targetProp) {\n                        return 0;\n                    }\n                    var related = compareProperties(sourceProp, targetProp, isRelatedTo);\n                    if (!related) {\n                        return 0;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            function signaturesRelatedTo(source, target, kind, reportErrors) {\n                if (relation === identityRelation) {\n                    return signaturesIdenticalTo(source, target, kind);\n                }\n                if (target === anyFunctionType || source === anyFunctionType) {\n                    return -1;\n                }\n                var sourceSignatures = getSignaturesOfType(source, kind);\n                var targetSignatures = getSignaturesOfType(target, kind);\n                if (kind === 1 && sourceSignatures.length && targetSignatures.length) {\n                    if (isAbstractConstructorType(source) && !isAbstractConstructorType(target)) {\n                        if (reportErrors) {\n                            reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type);\n                        }\n                        return 0;\n                    }\n                    if (!constructorVisibilitiesAreCompatible(sourceSignatures[0], targetSignatures[0], reportErrors)) {\n                        return 0;\n                    }\n                }\n                var result = -1;\n                var saveErrorInfo = errorInfo;\n                outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) {\n                    var t = targetSignatures_1[_i];\n                    var shouldElaborateErrors = reportErrors;\n                    for (var _a = 0, sourceSignatures_1 = sourceSignatures; _a < sourceSignatures_1.length; _a++) {\n                        var s = sourceSignatures_1[_a];\n                        var related = signatureRelatedTo(s, t, shouldElaborateErrors);\n                        if (related) {\n                            result &= related;\n                            errorInfo = saveErrorInfo;\n                            continue outer;\n                        }\n                        shouldElaborateErrors = false;\n                    }\n                    if (shouldElaborateErrors) {\n                        reportError(ts.Diagnostics.Type_0_provides_no_match_for_the_signature_1, typeToString(source), signatureToString(t, undefined, undefined, kind));\n                    }\n                    return 0;\n                }\n                return result;\n            }\n            function signatureRelatedTo(source, target, reportErrors) {\n                return compareSignaturesRelated(source, target, false, reportErrors, reportError, isRelatedTo);\n            }\n            function signaturesIdenticalTo(source, target, kind) {\n                var sourceSignatures = getSignaturesOfType(source, kind);\n                var targetSignatures = getSignaturesOfType(target, kind);\n                if (sourceSignatures.length !== targetSignatures.length) {\n                    return 0;\n                }\n                var result = -1;\n                for (var i = 0, len = sourceSignatures.length; i < len; i++) {\n                    var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], false, false, false, isRelatedTo);\n                    if (!related) {\n                        return 0;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            function eachPropertyRelatedTo(source, target, kind, reportErrors) {\n                var result = -1;\n                for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {\n                    var prop = _a[_i];\n                    if (kind === 0 || isNumericLiteralName(prop.name)) {\n                        var related = isRelatedTo(getTypeOfSymbol(prop), target, reportErrors);\n                        if (!related) {\n                            if (reportErrors) {\n                                reportError(ts.Diagnostics.Property_0_is_incompatible_with_index_signature, symbolToString(prop));\n                            }\n                            return 0;\n                        }\n                        result &= related;\n                    }\n                }\n                return result;\n            }\n            function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors) {\n                var related = isRelatedTo(sourceInfo.type, targetInfo.type, reportErrors);\n                if (!related && reportErrors) {\n                    reportError(ts.Diagnostics.Index_signatures_are_incompatible);\n                }\n                return related;\n            }\n            function indexTypesRelatedTo(source, originalSource, target, kind, reportErrors) {\n                if (relation === identityRelation) {\n                    return indexTypesIdenticalTo(source, target, kind);\n                }\n                var targetInfo = getIndexInfoOfType(target, kind);\n                if (!targetInfo || ((targetInfo.type.flags & 1) && !(originalSource.flags & 8190))) {\n                    return -1;\n                }\n                var sourceInfo = getIndexInfoOfType(source, kind) ||\n                    kind === 1 && getIndexInfoOfType(source, 0);\n                if (sourceInfo) {\n                    return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors);\n                }\n                if (isObjectLiteralType(source)) {\n                    var related = -1;\n                    if (kind === 0) {\n                        var sourceNumberInfo = getIndexInfoOfType(source, 1);\n                        if (sourceNumberInfo) {\n                            related = indexInfoRelatedTo(sourceNumberInfo, targetInfo, reportErrors);\n                        }\n                    }\n                    if (related) {\n                        related &= eachPropertyRelatedTo(source, targetInfo.type, kind, reportErrors);\n                    }\n                    return related;\n                }\n                if (reportErrors) {\n                    reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source));\n                }\n                return 0;\n            }\n            function indexTypesIdenticalTo(source, target, indexKind) {\n                var targetInfo = getIndexInfoOfType(target, indexKind);\n                var sourceInfo = getIndexInfoOfType(source, indexKind);\n                if (!sourceInfo && !targetInfo) {\n                    return -1;\n                }\n                if (sourceInfo && targetInfo && sourceInfo.isReadonly === targetInfo.isReadonly) {\n                    return isRelatedTo(sourceInfo.type, targetInfo.type);\n                }\n                return 0;\n            }\n            function constructorVisibilitiesAreCompatible(sourceSignature, targetSignature, reportErrors) {\n                if (!sourceSignature.declaration || !targetSignature.declaration) {\n                    return true;\n                }\n                var sourceAccessibility = ts.getModifierFlags(sourceSignature.declaration) & 24;\n                var targetAccessibility = ts.getModifierFlags(targetSignature.declaration) & 24;\n                if (targetAccessibility === 8) {\n                    return true;\n                }\n                if (targetAccessibility === 16 && sourceAccessibility !== 8) {\n                    return true;\n                }\n                if (targetAccessibility !== 16 && !sourceAccessibility) {\n                    return true;\n                }\n                if (reportErrors) {\n                    reportError(ts.Diagnostics.Cannot_assign_a_0_constructor_type_to_a_1_constructor_type, visibilityToString(sourceAccessibility), visibilityToString(targetAccessibility));\n                }\n                return false;\n            }\n        }\n        function isAbstractConstructorType(type) {\n            if (getObjectFlags(type) & 16) {\n                var symbol = type.symbol;\n                if (symbol && symbol.flags & 32) {\n                    var declaration = getClassLikeDeclarationOfSymbol(symbol);\n                    if (declaration && ts.getModifierFlags(declaration) & 128) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function isDeeplyNestedGeneric(type, stack, depth) {\n            if (getObjectFlags(type) & (4 | 64) && depth >= 5) {\n                var symbol = type.symbol;\n                var count = 0;\n                for (var i = 0; i < depth; i++) {\n                    var t = stack[i];\n                    if (getObjectFlags(t) & (4 | 64) && t.symbol === symbol) {\n                        count++;\n                        if (count >= 5)\n                            return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function isPropertyIdenticalTo(sourceProp, targetProp) {\n            return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0;\n        }\n        function compareProperties(sourceProp, targetProp, compareTypes) {\n            if (sourceProp === targetProp) {\n                return -1;\n            }\n            var sourcePropAccessibility = getDeclarationModifierFlagsFromSymbol(sourceProp) & 24;\n            var targetPropAccessibility = getDeclarationModifierFlagsFromSymbol(targetProp) & 24;\n            if (sourcePropAccessibility !== targetPropAccessibility) {\n                return 0;\n            }\n            if (sourcePropAccessibility) {\n                if (getTargetSymbol(sourceProp) !== getTargetSymbol(targetProp)) {\n                    return 0;\n                }\n            }\n            else {\n                if ((sourceProp.flags & 536870912) !== (targetProp.flags & 536870912)) {\n                    return 0;\n                }\n            }\n            if (isReadonlySymbol(sourceProp) !== isReadonlySymbol(targetProp)) {\n                return 0;\n            }\n            return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));\n        }\n        function isMatchingSignature(source, target, partialMatch) {\n            if (source.parameters.length === target.parameters.length &&\n                source.minArgumentCount === target.minArgumentCount &&\n                source.hasRestParameter === target.hasRestParameter) {\n                return true;\n            }\n            var sourceRestCount = source.hasRestParameter ? 1 : 0;\n            var targetRestCount = target.hasRestParameter ? 1 : 0;\n            if (partialMatch && source.minArgumentCount <= target.minArgumentCount && (sourceRestCount > targetRestCount ||\n                sourceRestCount === targetRestCount && source.parameters.length >= target.parameters.length)) {\n                return true;\n            }\n            return false;\n        }\n        function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) {\n            if (source === target) {\n                return -1;\n            }\n            if (!(isMatchingSignature(source, target, partialMatch))) {\n                return 0;\n            }\n            if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) {\n                return 0;\n            }\n            source = getErasedSignature(source);\n            target = getErasedSignature(target);\n            var result = -1;\n            if (!ignoreThisTypes) {\n                var sourceThisType = getThisTypeOfSignature(source);\n                if (sourceThisType) {\n                    var targetThisType = getThisTypeOfSignature(target);\n                    if (targetThisType) {\n                        var related = compareTypes(sourceThisType, targetThisType);\n                        if (!related) {\n                            return 0;\n                        }\n                        result &= related;\n                    }\n                }\n            }\n            var targetLen = target.parameters.length;\n            for (var i = 0; i < targetLen; i++) {\n                var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfParameter(source.parameters[i]);\n                var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfParameter(target.parameters[i]);\n                var related = compareTypes(s, t);\n                if (!related) {\n                    return 0;\n                }\n                result &= related;\n            }\n            if (!ignoreReturnTypes) {\n                result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));\n            }\n            return result;\n        }\n        function isRestParameterIndex(signature, parameterIndex) {\n            return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1;\n        }\n        function isSupertypeOfEach(candidate, types) {\n            for (var _i = 0, types_7 = types; _i < types_7.length; _i++) {\n                var t = types_7[_i];\n                if (candidate !== t && !isTypeSubtypeOf(t, candidate))\n                    return false;\n            }\n            return true;\n        }\n        function literalTypesWithSameBaseType(types) {\n            var commonBaseType;\n            for (var _i = 0, types_8 = types; _i < types_8.length; _i++) {\n                var t = types_8[_i];\n                var baseType = getBaseTypeOfLiteralType(t);\n                if (!commonBaseType) {\n                    commonBaseType = baseType;\n                }\n                if (baseType === t || baseType !== commonBaseType) {\n                    return false;\n                }\n            }\n            return true;\n        }\n        function getSupertypeOrUnion(types) {\n            return literalTypesWithSameBaseType(types) ? getUnionType(types) : ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; });\n        }\n        function getCommonSupertype(types) {\n            if (!strictNullChecks) {\n                return getSupertypeOrUnion(types);\n            }\n            var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 6144); });\n            if (!primaryTypes.length) {\n                return getUnionType(types, true);\n            }\n            var supertype = getSupertypeOrUnion(primaryTypes);\n            return supertype && includeFalsyTypes(supertype, getFalsyFlagsOfTypes(types) & 6144);\n        }\n        function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) {\n            var bestSupertype;\n            var bestSupertypeDownfallType;\n            var bestSupertypeScore = 0;\n            for (var i = 0; i < types.length; i++) {\n                var score = 0;\n                var downfallType = undefined;\n                for (var j = 0; j < types.length; j++) {\n                    if (isTypeSubtypeOf(types[j], types[i])) {\n                        score++;\n                    }\n                    else if (!downfallType) {\n                        downfallType = types[j];\n                    }\n                }\n                ts.Debug.assert(!!downfallType, \"If there is no common supertype, each type should have a downfallType\");\n                if (score > bestSupertypeScore) {\n                    bestSupertype = types[i];\n                    bestSupertypeDownfallType = downfallType;\n                    bestSupertypeScore = score;\n                }\n                if (bestSupertypeScore === types.length - 1) {\n                    break;\n                }\n            }\n            checkTypeSubtypeOf(bestSupertypeDownfallType, bestSupertype, errorLocation, ts.Diagnostics.Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0, errorMessageChainHead);\n        }\n        function isArrayType(type) {\n            return getObjectFlags(type) & 4 && type.target === globalArrayType;\n        }\n        function isArrayLikeType(type) {\n            return getObjectFlags(type) & 4 && (type.target === globalArrayType || type.target === globalReadonlyArrayType) ||\n                !(type.flags & 6144) && isTypeAssignableTo(type, anyReadonlyArrayType);\n        }\n        function isTupleLikeType(type) {\n            return !!getPropertyOfType(type, \"0\");\n        }\n        function isUnitType(type) {\n            return (type.flags & (480 | 2048 | 4096)) !== 0;\n        }\n        function isLiteralType(type) {\n            return type.flags & 8 ? true :\n                type.flags & 65536 ? type.flags & 16 ? true : !ts.forEach(type.types, function (t) { return !isUnitType(t); }) :\n                    isUnitType(type);\n        }\n        function getBaseTypeOfLiteralType(type) {\n            return type.flags & 32 ? stringType :\n                type.flags & 64 ? numberType :\n                    type.flags & 128 ? booleanType :\n                        type.flags & 256 ? type.baseType :\n                            type.flags & 65536 && !(type.flags & 16) ? getUnionType(ts.sameMap(type.types, getBaseTypeOfLiteralType)) :\n                                type;\n        }\n        function getWidenedLiteralType(type) {\n            return type.flags & 32 && type.flags & 1048576 ? stringType :\n                type.flags & 64 && type.flags & 1048576 ? numberType :\n                    type.flags & 128 ? booleanType :\n                        type.flags & 256 ? type.baseType :\n                            type.flags & 65536 && !(type.flags & 16) ? getUnionType(ts.sameMap(type.types, getWidenedLiteralType)) :\n                                type;\n        }\n        function isTupleType(type) {\n            return !!(getObjectFlags(type) & 4 && type.target.objectFlags & 8);\n        }\n        function getFalsyFlagsOfTypes(types) {\n            var result = 0;\n            for (var _i = 0, types_9 = types; _i < types_9.length; _i++) {\n                var t = types_9[_i];\n                result |= getFalsyFlags(t);\n            }\n            return result;\n        }\n        function getFalsyFlags(type) {\n            return type.flags & 65536 ? getFalsyFlagsOfTypes(type.types) :\n                type.flags & 32 ? type.text === \"\" ? 32 : 0 :\n                    type.flags & 64 ? type.text === \"0\" ? 64 : 0 :\n                        type.flags & 128 ? type === falseType ? 128 : 0 :\n                            type.flags & 7406;\n        }\n        function includeFalsyTypes(type, flags) {\n            if ((getFalsyFlags(type) & flags) === flags) {\n                return type;\n            }\n            var types = [type];\n            if (flags & 262178)\n                types.push(emptyStringType);\n            if (flags & 340)\n                types.push(zeroType);\n            if (flags & 136)\n                types.push(falseType);\n            if (flags & 1024)\n                types.push(voidType);\n            if (flags & 2048)\n                types.push(undefinedType);\n            if (flags & 4096)\n                types.push(nullType);\n            return getUnionType(types, true);\n        }\n        function removeDefinitelyFalsyTypes(type) {\n            return getFalsyFlags(type) & 7392 ?\n                filterType(type, function (t) { return !(getFalsyFlags(t) & 7392); }) :\n                type;\n        }\n        function getNonNullableType(type) {\n            return strictNullChecks ? getTypeWithFacts(type, 524288) : type;\n        }\n        function isObjectLiteralType(type) {\n            return type.symbol && (type.symbol.flags & (4096 | 2048)) !== 0 &&\n                getSignaturesOfType(type, 0).length === 0 &&\n                getSignaturesOfType(type, 1).length === 0;\n        }\n        function createTransientSymbol(source, type) {\n            var symbol = createSymbol(source.flags | 67108864, source.name);\n            symbol.declarations = source.declarations;\n            symbol.parent = source.parent;\n            symbol.type = type;\n            symbol.target = source;\n            if (source.valueDeclaration) {\n                symbol.valueDeclaration = source.valueDeclaration;\n            }\n            return symbol;\n        }\n        function transformTypeOfMembers(type, f) {\n            var members = ts.createMap();\n            for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) {\n                var property = _a[_i];\n                var original = getTypeOfSymbol(property);\n                var updated = f(original);\n                members[property.name] = updated === original ? property : createTransientSymbol(property, updated);\n            }\n            ;\n            return members;\n        }\n        function getRegularTypeOfObjectLiteral(type) {\n            if (!(getObjectFlags(type) & 128 && type.flags & 1048576)) {\n                return type;\n            }\n            var regularType = type.regularType;\n            if (regularType) {\n                return regularType;\n            }\n            var resolved = type;\n            var members = transformTypeOfMembers(type, getRegularTypeOfObjectLiteral);\n            var regularNew = createAnonymousType(resolved.symbol, members, resolved.callSignatures, resolved.constructSignatures, resolved.stringIndexInfo, resolved.numberIndexInfo);\n            regularNew.flags = resolved.flags & ~1048576;\n            regularNew.objectFlags |= 128;\n            type.regularType = regularNew;\n            return regularNew;\n        }\n        function getWidenedTypeOfObjectLiteral(type) {\n            var members = transformTypeOfMembers(type, function (prop) {\n                var widened = getWidenedType(prop);\n                return prop === widened ? prop : widened;\n            });\n            var stringIndexInfo = getIndexInfoOfType(type, 0);\n            var numberIndexInfo = getIndexInfoOfType(type, 1);\n            return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly));\n        }\n        function getWidenedConstituentType(type) {\n            return type.flags & 6144 ? type : getWidenedType(type);\n        }\n        function getWidenedType(type) {\n            if (type.flags & 6291456) {\n                if (type.flags & 6144) {\n                    return anyType;\n                }\n                if (getObjectFlags(type) & 128) {\n                    return getWidenedTypeOfObjectLiteral(type);\n                }\n                if (type.flags & 65536) {\n                    return getUnionType(ts.sameMap(type.types, getWidenedConstituentType));\n                }\n                if (isArrayType(type) || isTupleType(type)) {\n                    return createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType));\n                }\n            }\n            return type;\n        }\n        function reportWideningErrorsInType(type) {\n            var errorReported = false;\n            if (type.flags & 65536) {\n                for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                    var t = _a[_i];\n                    if (reportWideningErrorsInType(t)) {\n                        errorReported = true;\n                    }\n                }\n            }\n            if (isArrayType(type) || isTupleType(type)) {\n                for (var _b = 0, _c = type.typeArguments; _b < _c.length; _b++) {\n                    var t = _c[_b];\n                    if (reportWideningErrorsInType(t)) {\n                        errorReported = true;\n                    }\n                }\n            }\n            if (getObjectFlags(type) & 128) {\n                for (var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) {\n                    var p = _e[_d];\n                    var t = getTypeOfSymbol(p);\n                    if (t.flags & 2097152) {\n                        if (!reportWideningErrorsInType(t)) {\n                            error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t)));\n                        }\n                        errorReported = true;\n                    }\n                }\n            }\n            return errorReported;\n        }\n        function reportImplicitAnyError(declaration, type) {\n            var typeAsString = typeToString(getWidenedType(type));\n            var diagnostic;\n            switch (declaration.kind) {\n                case 147:\n                case 146:\n                    diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type;\n                    break;\n                case 144:\n                    diagnostic = declaration.dotDotDotToken ?\n                        ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type :\n                        ts.Diagnostics.Parameter_0_implicitly_has_an_1_type;\n                    break;\n                case 174:\n                    diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type;\n                    break;\n                case 225:\n                case 149:\n                case 148:\n                case 151:\n                case 152:\n                case 184:\n                case 185:\n                    if (!declaration.name) {\n                        error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);\n                        return;\n                    }\n                    diagnostic = ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type;\n                    break;\n                default:\n                    diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type;\n            }\n            error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString);\n        }\n        function reportErrorsFromWidening(declaration, type) {\n            if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 2097152) {\n                if (!reportWideningErrorsInType(type)) {\n                    reportImplicitAnyError(declaration, type);\n                }\n            }\n        }\n        function forEachMatchingParameterType(source, target, callback) {\n            var sourceMax = source.parameters.length;\n            var targetMax = target.parameters.length;\n            var count;\n            if (source.hasRestParameter && target.hasRestParameter) {\n                count = Math.max(sourceMax, targetMax);\n            }\n            else if (source.hasRestParameter) {\n                count = targetMax;\n            }\n            else if (target.hasRestParameter) {\n                count = sourceMax;\n            }\n            else {\n                count = Math.min(sourceMax, targetMax);\n            }\n            for (var i = 0; i < count; i++) {\n                callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i));\n            }\n        }\n        function createInferenceContext(signature, inferUnionTypes) {\n            var inferences = ts.map(signature.typeParameters, createTypeInferencesObject);\n            return {\n                signature: signature,\n                inferUnionTypes: inferUnionTypes,\n                inferences: inferences,\n                inferredTypes: new Array(signature.typeParameters.length),\n            };\n        }\n        function createTypeInferencesObject() {\n            return {\n                primary: undefined,\n                secondary: undefined,\n                topLevel: true,\n                isFixed: false,\n            };\n        }\n        function couldContainTypeVariables(type) {\n            var objectFlags = getObjectFlags(type);\n            return !!(type.flags & 540672 ||\n                objectFlags & 4 && ts.forEach(type.typeArguments, couldContainTypeVariables) ||\n                objectFlags & 16 && type.symbol && type.symbol.flags & (8192 | 2048 | 32) ||\n                objectFlags & 32 ||\n                type.flags & 196608 && couldUnionOrIntersectionContainTypeVariables(type));\n        }\n        function couldUnionOrIntersectionContainTypeVariables(type) {\n            if (type.couldContainTypeVariables === undefined) {\n                type.couldContainTypeVariables = ts.forEach(type.types, couldContainTypeVariables);\n            }\n            return type.couldContainTypeVariables;\n        }\n        function isTypeParameterAtTopLevel(type, typeParameter) {\n            return type === typeParameter || type.flags & 196608 && ts.forEach(type.types, function (t) { return isTypeParameterAtTopLevel(t, typeParameter); });\n        }\n        function inferTypeForHomomorphicMappedType(source, target) {\n            var properties = getPropertiesOfType(source);\n            var indexInfo = getIndexInfoOfType(source, 0);\n            if (properties.length === 0 && !indexInfo) {\n                return undefined;\n            }\n            var typeVariable = getIndexedAccessType(getConstraintTypeFromMappedType(target).type, getTypeParameterFromMappedType(target));\n            var typeVariableArray = [typeVariable];\n            var typeInferences = createTypeInferencesObject();\n            var typeInferencesArray = [typeInferences];\n            var templateType = getTemplateTypeFromMappedType(target);\n            var readonlyMask = target.declaration.readonlyToken ? false : true;\n            var optionalMask = target.declaration.questionToken ? 0 : 536870912;\n            var members = createSymbolTable(properties);\n            for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {\n                var prop = properties_4[_i];\n                var inferredPropType = inferTargetType(getTypeOfSymbol(prop));\n                if (!inferredPropType) {\n                    return undefined;\n                }\n                var inferredProp = createSymbol(4 | 67108864 | prop.flags & optionalMask, prop.name);\n                inferredProp.declarations = prop.declarations;\n                inferredProp.type = inferredPropType;\n                inferredProp.isReadonly = readonlyMask && isReadonlySymbol(prop);\n                members[prop.name] = inferredProp;\n            }\n            if (indexInfo) {\n                var inferredIndexType = inferTargetType(indexInfo.type);\n                if (!inferredIndexType) {\n                    return undefined;\n                }\n                indexInfo = createIndexInfo(inferredIndexType, readonlyMask && indexInfo.isReadonly);\n            }\n            return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfo, undefined);\n            function inferTargetType(sourceType) {\n                typeInferences.primary = undefined;\n                typeInferences.secondary = undefined;\n                inferTypes(typeVariableArray, typeInferencesArray, sourceType, templateType);\n                var inferences = typeInferences.primary || typeInferences.secondary;\n                return inferences && getUnionType(inferences, true);\n            }\n        }\n        function inferTypesWithContext(context, originalSource, originalTarget) {\n            inferTypes(context.signature.typeParameters, context.inferences, originalSource, originalTarget);\n        }\n        function inferTypes(typeVariables, typeInferences, originalSource, originalTarget) {\n            var sourceStack;\n            var targetStack;\n            var depth = 0;\n            var inferiority = 0;\n            var visited = ts.createMap();\n            inferFromTypes(originalSource, originalTarget);\n            function isInProcess(source, target) {\n                for (var i = 0; i < depth; i++) {\n                    if (source === sourceStack[i] && target === targetStack[i]) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n            function inferFromTypes(source, target) {\n                if (!couldContainTypeVariables(target)) {\n                    return;\n                }\n                if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) {\n                    var sourceTypes = source.aliasTypeArguments;\n                    var targetTypes = target.aliasTypeArguments;\n                    for (var i = 0; i < sourceTypes.length; i++) {\n                        inferFromTypes(sourceTypes[i], targetTypes[i]);\n                    }\n                    return;\n                }\n                if (source.flags & 65536 && target.flags & 65536 && !(source.flags & 16 && target.flags & 16) ||\n                    source.flags & 131072 && target.flags & 131072) {\n                    if (source === target) {\n                        for (var _i = 0, _a = source.types; _i < _a.length; _i++) {\n                            var t = _a[_i];\n                            inferFromTypes(t, t);\n                        }\n                        return;\n                    }\n                    var matchingTypes = void 0;\n                    for (var _b = 0, _c = source.types; _b < _c.length; _b++) {\n                        var t = _c[_b];\n                        if (typeIdenticalToSomeType(t, target.types)) {\n                            (matchingTypes || (matchingTypes = [])).push(t);\n                            inferFromTypes(t, t);\n                        }\n                        else if (t.flags & (64 | 32)) {\n                            var b = getBaseTypeOfLiteralType(t);\n                            if (typeIdenticalToSomeType(b, target.types)) {\n                                (matchingTypes || (matchingTypes = [])).push(t, b);\n                            }\n                        }\n                    }\n                    if (matchingTypes) {\n                        source = removeTypesFromUnionOrIntersection(source, matchingTypes);\n                        target = removeTypesFromUnionOrIntersection(target, matchingTypes);\n                    }\n                }\n                if (target.flags & 540672) {\n                    if (source.flags & 8388608) {\n                        return;\n                    }\n                    for (var i = 0; i < typeVariables.length; i++) {\n                        if (target === typeVariables[i]) {\n                            var inferences = typeInferences[i];\n                            if (!inferences.isFixed) {\n                                var candidates = inferiority ?\n                                    inferences.secondary || (inferences.secondary = []) :\n                                    inferences.primary || (inferences.primary = []);\n                                if (!ts.contains(candidates, source)) {\n                                    candidates.push(source);\n                                }\n                                if (target.flags & 16384 && !isTypeParameterAtTopLevel(originalTarget, target)) {\n                                    inferences.topLevel = false;\n                                }\n                            }\n                            return;\n                        }\n                    }\n                }\n                else if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && source.target === target.target) {\n                    var sourceTypes = source.typeArguments || emptyArray;\n                    var targetTypes = target.typeArguments || emptyArray;\n                    var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;\n                    for (var i = 0; i < count; i++) {\n                        inferFromTypes(sourceTypes[i], targetTypes[i]);\n                    }\n                }\n                else if (target.flags & 196608) {\n                    var targetTypes = target.types;\n                    var typeVariableCount = 0;\n                    var typeVariable = void 0;\n                    for (var _d = 0, targetTypes_2 = targetTypes; _d < targetTypes_2.length; _d++) {\n                        var t = targetTypes_2[_d];\n                        if (t.flags & 540672 && ts.contains(typeVariables, t)) {\n                            typeVariable = t;\n                            typeVariableCount++;\n                        }\n                        else {\n                            inferFromTypes(source, t);\n                        }\n                    }\n                    if (typeVariableCount === 1) {\n                        inferiority++;\n                        inferFromTypes(source, typeVariable);\n                        inferiority--;\n                    }\n                }\n                else if (source.flags & 196608) {\n                    var sourceTypes = source.types;\n                    for (var _e = 0, sourceTypes_3 = sourceTypes; _e < sourceTypes_3.length; _e++) {\n                        var sourceType = sourceTypes_3[_e];\n                        inferFromTypes(sourceType, target);\n                    }\n                }\n                else {\n                    source = getApparentType(source);\n                    if (source.flags & 32768) {\n                        if (isInProcess(source, target)) {\n                            return;\n                        }\n                        if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) {\n                            return;\n                        }\n                        var key = source.id + \",\" + target.id;\n                        if (visited[key]) {\n                            return;\n                        }\n                        visited[key] = true;\n                        if (depth === 0) {\n                            sourceStack = [];\n                            targetStack = [];\n                        }\n                        sourceStack[depth] = source;\n                        targetStack[depth] = target;\n                        depth++;\n                        inferFromObjectTypes(source, target);\n                        depth--;\n                    }\n                }\n            }\n            function inferFromObjectTypes(source, target) {\n                if (getObjectFlags(target) & 32) {\n                    var constraintType = getConstraintTypeFromMappedType(target);\n                    if (constraintType.flags & 262144) {\n                        var index = ts.indexOf(typeVariables, constraintType.type);\n                        if (index >= 0 && !typeInferences[index].isFixed) {\n                            var inferredType = inferTypeForHomomorphicMappedType(source, target);\n                            if (inferredType) {\n                                inferiority++;\n                                inferFromTypes(inferredType, typeVariables[index]);\n                                inferiority--;\n                            }\n                        }\n                        return;\n                    }\n                    if (constraintType.flags & 16384) {\n                        inferFromTypes(getIndexType(source), constraintType);\n                        inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target));\n                        return;\n                    }\n                }\n                inferFromProperties(source, target);\n                inferFromSignatures(source, target, 0);\n                inferFromSignatures(source, target, 1);\n                inferFromIndexTypes(source, target);\n            }\n            function inferFromProperties(source, target) {\n                var properties = getPropertiesOfObjectType(target);\n                for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) {\n                    var targetProp = properties_5[_i];\n                    var sourceProp = getPropertyOfObjectType(source, targetProp.name);\n                    if (sourceProp) {\n                        inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));\n                    }\n                }\n            }\n            function inferFromSignatures(source, target, kind) {\n                var sourceSignatures = getSignaturesOfType(source, kind);\n                var targetSignatures = getSignaturesOfType(target, kind);\n                var sourceLen = sourceSignatures.length;\n                var targetLen = targetSignatures.length;\n                var len = sourceLen < targetLen ? sourceLen : targetLen;\n                for (var i = 0; i < len; i++) {\n                    inferFromSignature(getErasedSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i]));\n                }\n            }\n            function inferFromParameterTypes(source, target) {\n                return inferFromTypes(source, target);\n            }\n            function inferFromSignature(source, target) {\n                forEachMatchingParameterType(source, target, inferFromParameterTypes);\n                if (source.typePredicate && target.typePredicate && source.typePredicate.kind === target.typePredicate.kind) {\n                    inferFromTypes(source.typePredicate.type, target.typePredicate.type);\n                }\n                else {\n                    inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));\n                }\n            }\n            function inferFromIndexTypes(source, target) {\n                var targetStringIndexType = getIndexTypeOfType(target, 0);\n                if (targetStringIndexType) {\n                    var sourceIndexType = getIndexTypeOfType(source, 0) ||\n                        getImplicitIndexTypeOfType(source, 0);\n                    if (sourceIndexType) {\n                        inferFromTypes(sourceIndexType, targetStringIndexType);\n                    }\n                }\n                var targetNumberIndexType = getIndexTypeOfType(target, 1);\n                if (targetNumberIndexType) {\n                    var sourceIndexType = getIndexTypeOfType(source, 1) ||\n                        getIndexTypeOfType(source, 0) ||\n                        getImplicitIndexTypeOfType(source, 1);\n                    if (sourceIndexType) {\n                        inferFromTypes(sourceIndexType, targetNumberIndexType);\n                    }\n                }\n            }\n        }\n        function typeIdenticalToSomeType(type, types) {\n            for (var _i = 0, types_10 = types; _i < types_10.length; _i++) {\n                var t = types_10[_i];\n                if (isTypeIdenticalTo(t, type)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function removeTypesFromUnionOrIntersection(type, typesToRemove) {\n            var reducedTypes = [];\n            for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                var t = _a[_i];\n                if (!typeIdenticalToSomeType(t, typesToRemove)) {\n                    reducedTypes.push(t);\n                }\n            }\n            return type.flags & 65536 ? getUnionType(reducedTypes) : getIntersectionType(reducedTypes);\n        }\n        function getInferenceCandidates(context, index) {\n            var inferences = context.inferences[index];\n            return inferences.primary || inferences.secondary || emptyArray;\n        }\n        function hasPrimitiveConstraint(type) {\n            var constraint = getConstraintOfTypeParameter(type);\n            return constraint && maybeTypeOfKind(constraint, 8190 | 262144);\n        }\n        function getInferredType(context, index) {\n            var inferredType = context.inferredTypes[index];\n            var inferenceSucceeded;\n            if (!inferredType) {\n                var inferences = getInferenceCandidates(context, index);\n                if (inferences.length) {\n                    var signature = context.signature;\n                    var widenLiteralTypes = context.inferences[index].topLevel &&\n                        !hasPrimitiveConstraint(signature.typeParameters[index]) &&\n                        (context.inferences[index].isFixed || !isTypeParameterAtTopLevel(getReturnTypeOfSignature(signature), signature.typeParameters[index]));\n                    var baseInferences = widenLiteralTypes ? ts.sameMap(inferences, getWidenedLiteralType) : inferences;\n                    var unionOrSuperType = context.inferUnionTypes ? getUnionType(baseInferences, true) : getCommonSupertype(baseInferences);\n                    inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : unknownType;\n                    inferenceSucceeded = !!unionOrSuperType;\n                }\n                else {\n                    inferredType = emptyObjectType;\n                    inferenceSucceeded = true;\n                }\n                context.inferredTypes[index] = inferredType;\n                if (inferenceSucceeded) {\n                    var constraint = getConstraintOfTypeParameter(context.signature.typeParameters[index]);\n                    if (constraint) {\n                        var instantiatedConstraint = instantiateType(constraint, getInferenceMapper(context));\n                        if (!isTypeAssignableTo(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {\n                            context.inferredTypes[index] = inferredType = instantiatedConstraint;\n                        }\n                    }\n                }\n                else if (context.failedTypeParameterIndex === undefined || context.failedTypeParameterIndex > index) {\n                    context.failedTypeParameterIndex = index;\n                }\n            }\n            return inferredType;\n        }\n        function getInferredTypes(context) {\n            for (var i = 0; i < context.inferredTypes.length; i++) {\n                getInferredType(context, i);\n            }\n            return context.inferredTypes;\n        }\n        function getResolvedSymbol(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedSymbol) {\n                links.resolvedSymbol = !ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node) || unknownSymbol;\n            }\n            return links.resolvedSymbol;\n        }\n        function isInTypeQuery(node) {\n            while (node) {\n                switch (node.kind) {\n                    case 160:\n                        return true;\n                    case 70:\n                    case 141:\n                        node = node.parent;\n                        continue;\n                    default:\n                        return false;\n                }\n            }\n            ts.Debug.fail(\"should not get here\");\n        }\n        function getFlowCacheKey(node) {\n            if (node.kind === 70) {\n                var symbol = getResolvedSymbol(node);\n                return symbol !== unknownSymbol ? \"\" + getSymbolId(symbol) : undefined;\n            }\n            if (node.kind === 98) {\n                return \"0\";\n            }\n            if (node.kind === 177) {\n                var key = getFlowCacheKey(node.expression);\n                return key && key + \".\" + node.name.text;\n            }\n            return undefined;\n        }\n        function getLeftmostIdentifierOrThis(node) {\n            switch (node.kind) {\n                case 70:\n                case 98:\n                    return node;\n                case 177:\n                    return getLeftmostIdentifierOrThis(node.expression);\n            }\n            return undefined;\n        }\n        function isMatchingReference(source, target) {\n            switch (source.kind) {\n                case 70:\n                    return target.kind === 70 && getResolvedSymbol(source) === getResolvedSymbol(target) ||\n                        (target.kind === 223 || target.kind === 174) &&\n                            getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target);\n                case 98:\n                    return target.kind === 98;\n                case 177:\n                    return target.kind === 177 &&\n                        source.name.text === target.name.text &&\n                        isMatchingReference(source.expression, target.expression);\n            }\n            return false;\n        }\n        function containsMatchingReference(source, target) {\n            while (source.kind === 177) {\n                source = source.expression;\n                if (isMatchingReference(source, target)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function containsMatchingReferenceDiscriminant(source, target) {\n            return target.kind === 177 &&\n                containsMatchingReference(source, target.expression) &&\n                isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text);\n        }\n        function getDeclaredTypeOfReference(expr) {\n            if (expr.kind === 70) {\n                return getTypeOfSymbol(getResolvedSymbol(expr));\n            }\n            if (expr.kind === 177) {\n                var type = getDeclaredTypeOfReference(expr.expression);\n                return type && getTypeOfPropertyOfType(type, expr.name.text);\n            }\n            return undefined;\n        }\n        function isDiscriminantProperty(type, name) {\n            if (type && type.flags & 65536) {\n                var prop = getUnionOrIntersectionProperty(type, name);\n                if (prop && prop.flags & 268435456) {\n                    if (prop.isDiscriminantProperty === undefined) {\n                        prop.isDiscriminantProperty = prop.hasNonUniformType && isLiteralType(getTypeOfSymbol(prop));\n                    }\n                    return prop.isDiscriminantProperty;\n                }\n            }\n            return false;\n        }\n        function isOrContainsMatchingReference(source, target) {\n            return isMatchingReference(source, target) || containsMatchingReference(source, target);\n        }\n        function hasMatchingArgument(callExpression, reference) {\n            if (callExpression.arguments) {\n                for (var _i = 0, _a = callExpression.arguments; _i < _a.length; _i++) {\n                    var argument = _a[_i];\n                    if (isOrContainsMatchingReference(reference, argument)) {\n                        return true;\n                    }\n                }\n            }\n            if (callExpression.expression.kind === 177 &&\n                isOrContainsMatchingReference(reference, callExpression.expression.expression)) {\n                return true;\n            }\n            return false;\n        }\n        function getFlowNodeId(flow) {\n            if (!flow.id) {\n                flow.id = nextFlowId;\n                nextFlowId++;\n            }\n            return flow.id;\n        }\n        function typeMaybeAssignableTo(source, target) {\n            if (!(source.flags & 65536)) {\n                return isTypeAssignableTo(source, target);\n            }\n            for (var _i = 0, _a = source.types; _i < _a.length; _i++) {\n                var t = _a[_i];\n                if (isTypeAssignableTo(t, target)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function getAssignmentReducedType(declaredType, assignedType) {\n            if (declaredType !== assignedType) {\n                if (assignedType.flags & 8192) {\n                    return assignedType;\n                }\n                var reducedType = filterType(declaredType, function (t) { return typeMaybeAssignableTo(assignedType, t); });\n                if (!(reducedType.flags & 8192)) {\n                    return reducedType;\n                }\n            }\n            return declaredType;\n        }\n        function getTypeFactsOfTypes(types) {\n            var result = 0;\n            for (var _i = 0, types_11 = types; _i < types_11.length; _i++) {\n                var t = types_11[_i];\n                result |= getTypeFacts(t);\n            }\n            return result;\n        }\n        function isFunctionObjectType(type) {\n            var resolved = resolveStructuredTypeMembers(type);\n            return !!(resolved.callSignatures.length || resolved.constructSignatures.length ||\n                resolved.members[\"bind\"] && isTypeSubtypeOf(type, globalFunctionType));\n        }\n        function getTypeFacts(type) {\n            var flags = type.flags;\n            if (flags & 2) {\n                return strictNullChecks ? 4079361 : 4194049;\n            }\n            if (flags & 32) {\n                return strictNullChecks ?\n                    type.text === \"\" ? 3030785 : 1982209 :\n                    type.text === \"\" ? 3145473 : 4194049;\n            }\n            if (flags & (4 | 16)) {\n                return strictNullChecks ? 4079234 : 4193922;\n            }\n            if (flags & (64 | 256)) {\n                var isZero = type.text === \"0\";\n                return strictNullChecks ?\n                    isZero ? 3030658 : 1982082 :\n                    isZero ? 3145346 : 4193922;\n            }\n            if (flags & 8) {\n                return strictNullChecks ? 4078980 : 4193668;\n            }\n            if (flags & 136) {\n                return strictNullChecks ?\n                    type === falseType ? 3030404 : 1981828 :\n                    type === falseType ? 3145092 : 4193668;\n            }\n            if (flags & 32768) {\n                return isFunctionObjectType(type) ?\n                    strictNullChecks ? 6164448 : 8376288 :\n                    strictNullChecks ? 6166480 : 8378320;\n            }\n            if (flags & (1024 | 2048)) {\n                return 2457472;\n            }\n            if (flags & 4096) {\n                return 2340752;\n            }\n            if (flags & 512) {\n                return strictNullChecks ? 1981320 : 4193160;\n            }\n            if (flags & 16384) {\n                var constraint = getConstraintOfTypeParameter(type);\n                return getTypeFacts(constraint || emptyObjectType);\n            }\n            if (flags & 196608) {\n                return getTypeFactsOfTypes(type.types);\n            }\n            return 8388607;\n        }\n        function getTypeWithFacts(type, include) {\n            return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });\n        }\n        function getTypeWithDefault(type, defaultExpression) {\n            if (defaultExpression) {\n                var defaultType = getTypeOfExpression(defaultExpression);\n                return getUnionType([getTypeWithFacts(type, 131072), defaultType]);\n            }\n            return type;\n        }\n        function getTypeOfDestructuredProperty(type, name) {\n            var text = ts.getTextOfPropertyName(name);\n            return getTypeOfPropertyOfType(type, text) ||\n                isNumericLiteralName(text) && getIndexTypeOfType(type, 1) ||\n                getIndexTypeOfType(type, 0) ||\n                unknownType;\n        }\n        function getTypeOfDestructuredArrayElement(type, index) {\n            return isTupleLikeType(type) && getTypeOfPropertyOfType(type, \"\" + index) ||\n                checkIteratedTypeOrElementType(type, undefined, false) ||\n                unknownType;\n        }\n        function getTypeOfDestructuredSpreadExpression(type) {\n            return createArrayType(checkIteratedTypeOrElementType(type, undefined, false) || unknownType);\n        }\n        function getAssignedTypeOfBinaryExpression(node) {\n            return node.parent.kind === 175 || node.parent.kind === 257 ?\n                getTypeWithDefault(getAssignedType(node), node.right) :\n                getTypeOfExpression(node.right);\n        }\n        function getAssignedTypeOfArrayLiteralElement(node, element) {\n            return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element));\n        }\n        function getAssignedTypeOfSpreadExpression(node) {\n            return getTypeOfDestructuredSpreadExpression(getAssignedType(node.parent));\n        }\n        function getAssignedTypeOfPropertyAssignment(node) {\n            return getTypeOfDestructuredProperty(getAssignedType(node.parent), node.name);\n        }\n        function getAssignedTypeOfShorthandPropertyAssignment(node) {\n            return getTypeWithDefault(getAssignedTypeOfPropertyAssignment(node), node.objectAssignmentInitializer);\n        }\n        function getAssignedType(node) {\n            var parent = node.parent;\n            switch (parent.kind) {\n                case 212:\n                    return stringType;\n                case 213:\n                    return checkRightHandSideOfForOf(parent.expression) || unknownType;\n                case 192:\n                    return getAssignedTypeOfBinaryExpression(parent);\n                case 186:\n                    return undefinedType;\n                case 175:\n                    return getAssignedTypeOfArrayLiteralElement(parent, node);\n                case 196:\n                    return getAssignedTypeOfSpreadExpression(parent);\n                case 257:\n                    return getAssignedTypeOfPropertyAssignment(parent);\n                case 258:\n                    return getAssignedTypeOfShorthandPropertyAssignment(parent);\n            }\n            return unknownType;\n        }\n        function getInitialTypeOfBindingElement(node) {\n            var pattern = node.parent;\n            var parentType = getInitialType(pattern.parent);\n            var type = pattern.kind === 172 ?\n                getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) :\n                !node.dotDotDotToken ?\n                    getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) :\n                    getTypeOfDestructuredSpreadExpression(parentType);\n            return getTypeWithDefault(type, node.initializer);\n        }\n        function getTypeOfInitializer(node) {\n            var links = getNodeLinks(node);\n            return links.resolvedType || getTypeOfExpression(node);\n        }\n        function getInitialTypeOfVariableDeclaration(node) {\n            if (node.initializer) {\n                return getTypeOfInitializer(node.initializer);\n            }\n            if (node.parent.parent.kind === 212) {\n                return stringType;\n            }\n            if (node.parent.parent.kind === 213) {\n                return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType;\n            }\n            return unknownType;\n        }\n        function getInitialType(node) {\n            return node.kind === 223 ?\n                getInitialTypeOfVariableDeclaration(node) :\n                getInitialTypeOfBindingElement(node);\n        }\n        function getInitialOrAssignedType(node) {\n            return node.kind === 223 || node.kind === 174 ?\n                getInitialType(node) :\n                getAssignedType(node);\n        }\n        function isEmptyArrayAssignment(node) {\n            return node.kind === 223 && node.initializer &&\n                isEmptyArrayLiteral(node.initializer) ||\n                node.kind !== 174 && node.parent.kind === 192 &&\n                    isEmptyArrayLiteral(node.parent.right);\n        }\n        function getReferenceCandidate(node) {\n            switch (node.kind) {\n                case 183:\n                    return getReferenceCandidate(node.expression);\n                case 192:\n                    switch (node.operatorToken.kind) {\n                        case 57:\n                            return getReferenceCandidate(node.left);\n                        case 25:\n                            return getReferenceCandidate(node.right);\n                    }\n            }\n            return node;\n        }\n        function getReferenceRoot(node) {\n            var parent = node.parent;\n            return parent.kind === 183 ||\n                parent.kind === 192 && parent.operatorToken.kind === 57 && parent.left === node ||\n                parent.kind === 192 && parent.operatorToken.kind === 25 && parent.right === node ?\n                getReferenceRoot(parent) : node;\n        }\n        function getTypeOfSwitchClause(clause) {\n            if (clause.kind === 253) {\n                var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression));\n                return isUnitType(caseType) ? caseType : undefined;\n            }\n            return neverType;\n        }\n        function getSwitchClauseTypes(switchStatement) {\n            var links = getNodeLinks(switchStatement);\n            if (!links.switchTypes) {\n                var types = ts.map(switchStatement.caseBlock.clauses, getTypeOfSwitchClause);\n                links.switchTypes = !ts.contains(types, undefined) ? types : emptyArray;\n            }\n            return links.switchTypes;\n        }\n        function eachTypeContainedIn(source, types) {\n            return source.flags & 65536 ? !ts.forEach(source.types, function (t) { return !ts.contains(types, t); }) : ts.contains(types, source);\n        }\n        function isTypeSubsetOf(source, target) {\n            return source === target || target.flags & 65536 && isTypeSubsetOfUnion(source, target);\n        }\n        function isTypeSubsetOfUnion(source, target) {\n            if (source.flags & 65536) {\n                for (var _i = 0, _a = source.types; _i < _a.length; _i++) {\n                    var t = _a[_i];\n                    if (!containsType(target.types, t)) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            if (source.flags & 256 && target.flags & 16 && source.baseType === target) {\n                return true;\n            }\n            return containsType(target.types, source);\n        }\n        function forEachType(type, f) {\n            return type.flags & 65536 ? ts.forEach(type.types, f) : f(type);\n        }\n        function filterType(type, f) {\n            if (type.flags & 65536) {\n                var types = type.types;\n                var filtered = ts.filter(types, f);\n                return filtered === types ? type : getUnionTypeFromSortedList(filtered);\n            }\n            return f(type) ? type : neverType;\n        }\n        function mapType(type, f) {\n            return type.flags & 65536 ? getUnionType(ts.map(type.types, f)) : f(type);\n        }\n        function extractTypesOfKind(type, kind) {\n            return filterType(type, function (t) { return (t.flags & kind) !== 0; });\n        }\n        function replacePrimitivesWithLiterals(typeWithPrimitives, typeWithLiterals) {\n            if (isTypeSubsetOf(stringType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, 32) ||\n                isTypeSubsetOf(numberType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, 64)) {\n                return mapType(typeWithPrimitives, function (t) {\n                    return t.flags & 2 ? extractTypesOfKind(typeWithLiterals, 2 | 32) :\n                        t.flags & 4 ? extractTypesOfKind(typeWithLiterals, 4 | 64) :\n                            t;\n                });\n            }\n            return typeWithPrimitives;\n        }\n        function isIncomplete(flowType) {\n            return flowType.flags === 0;\n        }\n        function getTypeFromFlowType(flowType) {\n            return flowType.flags === 0 ? flowType.type : flowType;\n        }\n        function createFlowType(type, incomplete) {\n            return incomplete ? { flags: 0, type: type } : type;\n        }\n        function createEvolvingArrayType(elementType) {\n            var result = createObjectType(256);\n            result.elementType = elementType;\n            return result;\n        }\n        function getEvolvingArrayType(elementType) {\n            return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType));\n        }\n        function addEvolvingArrayElementType(evolvingArrayType, node) {\n            var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node));\n            return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType]));\n        }\n        function createFinalArrayType(elementType) {\n            return elementType.flags & 8192 ?\n                autoArrayType :\n                createArrayType(elementType.flags & 65536 ?\n                    getUnionType(elementType.types, true) :\n                    elementType);\n        }\n        function getFinalArrayType(evolvingArrayType) {\n            return evolvingArrayType.finalArrayType || (evolvingArrayType.finalArrayType = createFinalArrayType(evolvingArrayType.elementType));\n        }\n        function finalizeEvolvingArrayType(type) {\n            return getObjectFlags(type) & 256 ? getFinalArrayType(type) : type;\n        }\n        function getElementTypeOfEvolvingArrayType(type) {\n            return getObjectFlags(type) & 256 ? type.elementType : neverType;\n        }\n        function isEvolvingArrayTypeList(types) {\n            var hasEvolvingArrayType = false;\n            for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {\n                var t = types_12[_i];\n                if (!(t.flags & 8192)) {\n                    if (!(getObjectFlags(t) & 256)) {\n                        return false;\n                    }\n                    hasEvolvingArrayType = true;\n                }\n            }\n            return hasEvolvingArrayType;\n        }\n        function getUnionOrEvolvingArrayType(types, subtypeReduction) {\n            return isEvolvingArrayTypeList(types) ?\n                getEvolvingArrayType(getUnionType(ts.map(types, getElementTypeOfEvolvingArrayType))) :\n                getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction);\n        }\n        function isEvolvingArrayOperationTarget(node) {\n            var root = getReferenceRoot(node);\n            var parent = root.parent;\n            var isLengthPushOrUnshift = parent.kind === 177 && (parent.name.text === \"length\" ||\n                parent.parent.kind === 179 && ts.isPushOrUnshiftIdentifier(parent.name));\n            var isElementAssignment = parent.kind === 178 &&\n                parent.expression === root &&\n                parent.parent.kind === 192 &&\n                parent.parent.operatorToken.kind === 57 &&\n                parent.parent.left === parent &&\n                !ts.isAssignmentTarget(parent.parent) &&\n                isTypeAnyOrAllConstituentTypesHaveKind(getTypeOfExpression(parent.argumentExpression), 340 | 2048);\n            return isLengthPushOrUnshift || isElementAssignment;\n        }\n        function maybeTypePredicateCall(node) {\n            var links = getNodeLinks(node);\n            if (links.maybeTypePredicate === undefined) {\n                links.maybeTypePredicate = getMaybeTypePredicate(node);\n            }\n            return links.maybeTypePredicate;\n        }\n        function getMaybeTypePredicate(node) {\n            if (node.expression.kind !== 96) {\n                var funcType = checkNonNullExpression(node.expression);\n                if (funcType !== silentNeverType) {\n                    var apparentType = getApparentType(funcType);\n                    if (apparentType !== unknownType) {\n                        var callSignatures = getSignaturesOfType(apparentType, 0);\n                        return !!ts.forEach(callSignatures, function (sig) { return sig.typePredicate; });\n                    }\n                }\n            }\n            return false;\n        }\n        function getFlowTypeOfReference(reference, declaredType, assumeInitialized, flowContainer) {\n            var key;\n            if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 1033215)) {\n                return declaredType;\n            }\n            var initialType = assumeInitialized ? declaredType :\n                declaredType === autoType || declaredType === autoArrayType ? undefinedType :\n                    includeFalsyTypes(declaredType, 2048);\n            var visitedFlowStart = visitedFlowCount;\n            var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode));\n            visitedFlowCount = visitedFlowStart;\n            var resultType = getObjectFlags(evolvedType) & 256 && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType);\n            if (reference.parent.kind === 201 && getTypeWithFacts(resultType, 524288).flags & 8192) {\n                return declaredType;\n            }\n            return resultType;\n            function getTypeAtFlowNode(flow) {\n                while (true) {\n                    if (flow.flags & 1024) {\n                        for (var i = visitedFlowStart; i < visitedFlowCount; i++) {\n                            if (visitedFlowNodes[i] === flow) {\n                                return visitedFlowTypes[i];\n                            }\n                        }\n                    }\n                    var type = void 0;\n                    if (flow.flags & 16) {\n                        type = getTypeAtFlowAssignment(flow);\n                        if (!type) {\n                            flow = flow.antecedent;\n                            continue;\n                        }\n                    }\n                    else if (flow.flags & 96) {\n                        type = getTypeAtFlowCondition(flow);\n                    }\n                    else if (flow.flags & 128) {\n                        type = getTypeAtSwitchClause(flow);\n                    }\n                    else if (flow.flags & 12) {\n                        if (flow.antecedents.length === 1) {\n                            flow = flow.antecedents[0];\n                            continue;\n                        }\n                        type = flow.flags & 4 ?\n                            getTypeAtFlowBranchLabel(flow) :\n                            getTypeAtFlowLoopLabel(flow);\n                    }\n                    else if (flow.flags & 256) {\n                        type = getTypeAtFlowArrayMutation(flow);\n                        if (!type) {\n                            flow = flow.antecedent;\n                            continue;\n                        }\n                    }\n                    else if (flow.flags & 2) {\n                        var container = flow.container;\n                        if (container && container !== flowContainer && reference.kind !== 177) {\n                            flow = container.flowNode;\n                            continue;\n                        }\n                        type = initialType;\n                    }\n                    else {\n                        type = convertAutoToAny(declaredType);\n                    }\n                    if (flow.flags & 1024) {\n                        visitedFlowNodes[visitedFlowCount] = flow;\n                        visitedFlowTypes[visitedFlowCount] = type;\n                        visitedFlowCount++;\n                    }\n                    return type;\n                }\n            }\n            function getTypeAtFlowAssignment(flow) {\n                var node = flow.node;\n                if (isMatchingReference(reference, node)) {\n                    if (ts.getAssignmentTargetKind(node) === 2) {\n                        var flowType = getTypeAtFlowNode(flow.antecedent);\n                        return createFlowType(getBaseTypeOfLiteralType(getTypeFromFlowType(flowType)), isIncomplete(flowType));\n                    }\n                    if (declaredType === autoType || declaredType === autoArrayType) {\n                        if (isEmptyArrayAssignment(node)) {\n                            return getEvolvingArrayType(neverType);\n                        }\n                        var assignedType = getBaseTypeOfLiteralType(getInitialOrAssignedType(node));\n                        return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType;\n                    }\n                    if (declaredType.flags & 65536) {\n                        return getAssignmentReducedType(declaredType, getInitialOrAssignedType(node));\n                    }\n                    return declaredType;\n                }\n                if (containsMatchingReference(reference, node)) {\n                    return declaredType;\n                }\n                return undefined;\n            }\n            function getTypeAtFlowArrayMutation(flow) {\n                var node = flow.node;\n                var expr = node.kind === 179 ?\n                    node.expression.expression :\n                    node.left.expression;\n                if (isMatchingReference(reference, getReferenceCandidate(expr))) {\n                    var flowType = getTypeAtFlowNode(flow.antecedent);\n                    var type = getTypeFromFlowType(flowType);\n                    if (getObjectFlags(type) & 256) {\n                        var evolvedType_1 = type;\n                        if (node.kind === 179) {\n                            for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {\n                                var arg = _a[_i];\n                                evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg);\n                            }\n                        }\n                        else {\n                            var indexType = getTypeOfExpression(node.left.argumentExpression);\n                            if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 | 2048)) {\n                                evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right);\n                            }\n                        }\n                        return evolvedType_1 === type ? flowType : createFlowType(evolvedType_1, isIncomplete(flowType));\n                    }\n                    return flowType;\n                }\n                return undefined;\n            }\n            function getTypeAtFlowCondition(flow) {\n                var flowType = getTypeAtFlowNode(flow.antecedent);\n                var type = getTypeFromFlowType(flowType);\n                if (type.flags & 8192) {\n                    return flowType;\n                }\n                var assumeTrue = (flow.flags & 32) !== 0;\n                var nonEvolvingType = finalizeEvolvingArrayType(type);\n                var narrowedType = narrowType(nonEvolvingType, flow.expression, assumeTrue);\n                if (narrowedType === nonEvolvingType) {\n                    return flowType;\n                }\n                var incomplete = isIncomplete(flowType);\n                var resultType = incomplete && narrowedType.flags & 8192 ? silentNeverType : narrowedType;\n                return createFlowType(resultType, incomplete);\n            }\n            function getTypeAtSwitchClause(flow) {\n                var flowType = getTypeAtFlowNode(flow.antecedent);\n                var type = getTypeFromFlowType(flowType);\n                var expr = flow.switchStatement.expression;\n                if (isMatchingReference(reference, expr)) {\n                    type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);\n                }\n                else if (isMatchingReferenceDiscriminant(expr)) {\n                    type = narrowTypeByDiscriminant(type, expr, function (t) { return narrowTypeBySwitchOnDiscriminant(t, flow.switchStatement, flow.clauseStart, flow.clauseEnd); });\n                }\n                return createFlowType(type, isIncomplete(flowType));\n            }\n            function getTypeAtFlowBranchLabel(flow) {\n                var antecedentTypes = [];\n                var subtypeReduction = false;\n                var seenIncomplete = false;\n                for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) {\n                    var antecedent = _a[_i];\n                    var flowType = getTypeAtFlowNode(antecedent);\n                    var type = getTypeFromFlowType(flowType);\n                    if (type === declaredType && declaredType === initialType) {\n                        return type;\n                    }\n                    if (!ts.contains(antecedentTypes, type)) {\n                        antecedentTypes.push(type);\n                    }\n                    if (!isTypeSubsetOf(type, declaredType)) {\n                        subtypeReduction = true;\n                    }\n                    if (isIncomplete(flowType)) {\n                        seenIncomplete = true;\n                    }\n                }\n                return createFlowType(getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction), seenIncomplete);\n            }\n            function getTypeAtFlowLoopLabel(flow) {\n                var id = getFlowNodeId(flow);\n                var cache = flowLoopCaches[id] || (flowLoopCaches[id] = ts.createMap());\n                if (!key) {\n                    key = getFlowCacheKey(reference);\n                }\n                if (cache[key]) {\n                    return cache[key];\n                }\n                for (var i = flowLoopStart; i < flowLoopCount; i++) {\n                    if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key && flowLoopTypes[i].length) {\n                        return createFlowType(getUnionOrEvolvingArrayType(flowLoopTypes[i], false), true);\n                    }\n                }\n                var antecedentTypes = [];\n                var subtypeReduction = false;\n                var firstAntecedentType;\n                flowLoopNodes[flowLoopCount] = flow;\n                flowLoopKeys[flowLoopCount] = key;\n                flowLoopTypes[flowLoopCount] = antecedentTypes;\n                for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) {\n                    var antecedent = _a[_i];\n                    flowLoopCount++;\n                    var flowType = getTypeAtFlowNode(antecedent);\n                    flowLoopCount--;\n                    if (!firstAntecedentType) {\n                        firstAntecedentType = flowType;\n                    }\n                    var type = getTypeFromFlowType(flowType);\n                    if (cache[key]) {\n                        return cache[key];\n                    }\n                    if (!ts.contains(antecedentTypes, type)) {\n                        antecedentTypes.push(type);\n                    }\n                    if (!isTypeSubsetOf(type, declaredType)) {\n                        subtypeReduction = true;\n                    }\n                    if (type === declaredType) {\n                        break;\n                    }\n                }\n                var result = getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction);\n                if (isIncomplete(firstAntecedentType)) {\n                    return createFlowType(result, true);\n                }\n                return cache[key] = result;\n            }\n            function isMatchingReferenceDiscriminant(expr) {\n                return expr.kind === 177 &&\n                    declaredType.flags & 65536 &&\n                    isMatchingReference(reference, expr.expression) &&\n                    isDiscriminantProperty(declaredType, expr.name.text);\n            }\n            function narrowTypeByDiscriminant(type, propAccess, narrowType) {\n                var propName = propAccess.name.text;\n                var propType = getTypeOfPropertyOfType(type, propName);\n                var narrowedPropType = propType && narrowType(propType);\n                return propType === narrowedPropType ? type : filterType(type, function (t) { return isTypeComparableTo(getTypeOfPropertyOfType(t, propName), narrowedPropType); });\n            }\n            function narrowTypeByTruthiness(type, expr, assumeTrue) {\n                if (isMatchingReference(reference, expr)) {\n                    return getTypeWithFacts(type, assumeTrue ? 1048576 : 2097152);\n                }\n                if (isMatchingReferenceDiscriminant(expr)) {\n                    return narrowTypeByDiscriminant(type, expr, function (t) { return getTypeWithFacts(t, assumeTrue ? 1048576 : 2097152); });\n                }\n                if (containsMatchingReferenceDiscriminant(reference, expr)) {\n                    return declaredType;\n                }\n                return type;\n            }\n            function narrowTypeByBinaryExpression(type, expr, assumeTrue) {\n                switch (expr.operatorToken.kind) {\n                    case 57:\n                        return narrowTypeByTruthiness(type, expr.left, assumeTrue);\n                    case 31:\n                    case 32:\n                    case 33:\n                    case 34:\n                        var operator_1 = expr.operatorToken.kind;\n                        var left_1 = getReferenceCandidate(expr.left);\n                        var right_1 = getReferenceCandidate(expr.right);\n                        if (left_1.kind === 187 && right_1.kind === 9) {\n                            return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue);\n                        }\n                        if (right_1.kind === 187 && left_1.kind === 9) {\n                            return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue);\n                        }\n                        if (isMatchingReference(reference, left_1)) {\n                            return narrowTypeByEquality(type, operator_1, right_1, assumeTrue);\n                        }\n                        if (isMatchingReference(reference, right_1)) {\n                            return narrowTypeByEquality(type, operator_1, left_1, assumeTrue);\n                        }\n                        if (isMatchingReferenceDiscriminant(left_1)) {\n                            return narrowTypeByDiscriminant(type, left_1, function (t) { return narrowTypeByEquality(t, operator_1, right_1, assumeTrue); });\n                        }\n                        if (isMatchingReferenceDiscriminant(right_1)) {\n                            return narrowTypeByDiscriminant(type, right_1, function (t) { return narrowTypeByEquality(t, operator_1, left_1, assumeTrue); });\n                        }\n                        if (containsMatchingReferenceDiscriminant(reference, left_1) || containsMatchingReferenceDiscriminant(reference, right_1)) {\n                            return declaredType;\n                        }\n                        break;\n                    case 92:\n                        return narrowTypeByInstanceof(type, expr, assumeTrue);\n                    case 25:\n                        return narrowType(type, expr.right, assumeTrue);\n                }\n                return type;\n            }\n            function narrowTypeByEquality(type, operator, value, assumeTrue) {\n                if (type.flags & 1) {\n                    return type;\n                }\n                if (operator === 32 || operator === 34) {\n                    assumeTrue = !assumeTrue;\n                }\n                var valueType = getTypeOfExpression(value);\n                if (valueType.flags & 6144) {\n                    if (!strictNullChecks) {\n                        return type;\n                    }\n                    var doubleEquals = operator === 31 || operator === 32;\n                    var facts = doubleEquals ?\n                        assumeTrue ? 65536 : 524288 :\n                        value.kind === 94 ?\n                            assumeTrue ? 32768 : 262144 :\n                            assumeTrue ? 16384 : 131072;\n                    return getTypeWithFacts(type, facts);\n                }\n                if (type.flags & 33281) {\n                    return type;\n                }\n                if (assumeTrue) {\n                    var narrowedType = filterType(type, function (t) { return areTypesComparable(t, valueType); });\n                    return narrowedType.flags & 8192 ? type : replacePrimitivesWithLiterals(narrowedType, valueType);\n                }\n                if (isUnitType(valueType)) {\n                    var regularType_1 = getRegularTypeOfLiteralType(valueType);\n                    return filterType(type, function (t) { return getRegularTypeOfLiteralType(t) !== regularType_1; });\n                }\n                return type;\n            }\n            function narrowTypeByTypeof(type, typeOfExpr, operator, literal, assumeTrue) {\n                var target = getReferenceCandidate(typeOfExpr.expression);\n                if (!isMatchingReference(reference, target)) {\n                    if (containsMatchingReference(reference, target)) {\n                        return declaredType;\n                    }\n                    return type;\n                }\n                if (operator === 32 || operator === 34) {\n                    assumeTrue = !assumeTrue;\n                }\n                if (assumeTrue && !(type.flags & 65536)) {\n                    var targetType = typeofTypesByName[literal.text];\n                    if (targetType && isTypeSubtypeOf(targetType, type)) {\n                        return targetType;\n                    }\n                }\n                var facts = assumeTrue ?\n                    typeofEQFacts[literal.text] || 64 :\n                    typeofNEFacts[literal.text] || 8192;\n                return getTypeWithFacts(type, facts);\n            }\n            function narrowTypeBySwitchOnDiscriminant(type, switchStatement, clauseStart, clauseEnd) {\n                var switchTypes = getSwitchClauseTypes(switchStatement);\n                if (!switchTypes.length) {\n                    return type;\n                }\n                var clauseTypes = switchTypes.slice(clauseStart, clauseEnd);\n                var hasDefaultClause = clauseStart === clauseEnd || ts.contains(clauseTypes, neverType);\n                var discriminantType = getUnionType(clauseTypes);\n                var caseType = discriminantType.flags & 8192 ? neverType :\n                    replacePrimitivesWithLiterals(filterType(type, function (t) { return isTypeComparableTo(discriminantType, t); }), discriminantType);\n                if (!hasDefaultClause) {\n                    return caseType;\n                }\n                var defaultType = filterType(type, function (t) { return !(isUnitType(t) && ts.contains(switchTypes, getRegularTypeOfLiteralType(t))); });\n                return caseType.flags & 8192 ? defaultType : getUnionType([caseType, defaultType]);\n            }\n            function narrowTypeByInstanceof(type, expr, assumeTrue) {\n                var left = getReferenceCandidate(expr.left);\n                if (!isMatchingReference(reference, left)) {\n                    if (containsMatchingReference(reference, left)) {\n                        return declaredType;\n                    }\n                    return type;\n                }\n                var rightType = getTypeOfExpression(expr.right);\n                if (!isTypeSubtypeOf(rightType, globalFunctionType)) {\n                    return type;\n                }\n                var targetType;\n                var prototypeProperty = getPropertyOfType(rightType, \"prototype\");\n                if (prototypeProperty) {\n                    var prototypePropertyType = getTypeOfSymbol(prototypeProperty);\n                    if (!isTypeAny(prototypePropertyType)) {\n                        targetType = prototypePropertyType;\n                    }\n                }\n                if (isTypeAny(type) && (targetType === globalObjectType || targetType === globalFunctionType)) {\n                    return type;\n                }\n                if (!targetType) {\n                    var constructSignatures = void 0;\n                    if (getObjectFlags(rightType) & 2) {\n                        constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;\n                    }\n                    else if (getObjectFlags(rightType) & 16) {\n                        constructSignatures = getSignaturesOfType(rightType, 1);\n                    }\n                    if (constructSignatures && constructSignatures.length) {\n                        targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));\n                    }\n                }\n                if (targetType) {\n                    return getNarrowedType(type, targetType, assumeTrue, isTypeInstanceOf);\n                }\n                return type;\n            }\n            function getNarrowedType(type, candidate, assumeTrue, isRelated) {\n                if (!assumeTrue) {\n                    return filterType(type, function (t) { return !isRelated(t, candidate); });\n                }\n                if (type.flags & 65536) {\n                    var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });\n                    if (!(assignableType.flags & 8192)) {\n                        return assignableType;\n                    }\n                }\n                var targetType = type.flags & 16384 ? getApparentType(type) : type;\n                return isTypeSubtypeOf(candidate, type) ? candidate :\n                    isTypeAssignableTo(type, candidate) ? type :\n                        isTypeAssignableTo(candidate, targetType) ? candidate :\n                            getIntersectionType([type, candidate]);\n            }\n            function narrowTypeByTypePredicate(type, callExpression, assumeTrue) {\n                if (!hasMatchingArgument(callExpression, reference) || !maybeTypePredicateCall(callExpression)) {\n                    return type;\n                }\n                var signature = getResolvedSignature(callExpression);\n                var predicate = signature.typePredicate;\n                if (!predicate) {\n                    return type;\n                }\n                if (isTypeAny(type) && (predicate.type === globalObjectType || predicate.type === globalFunctionType)) {\n                    return type;\n                }\n                if (ts.isIdentifierTypePredicate(predicate)) {\n                    var predicateArgument = callExpression.arguments[predicate.parameterIndex];\n                    if (predicateArgument) {\n                        if (isMatchingReference(reference, predicateArgument)) {\n                            return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);\n                        }\n                        if (containsMatchingReference(reference, predicateArgument)) {\n                            return declaredType;\n                        }\n                    }\n                }\n                else {\n                    var invokedExpression = ts.skipParentheses(callExpression.expression);\n                    if (invokedExpression.kind === 178 || invokedExpression.kind === 177) {\n                        var accessExpression = invokedExpression;\n                        var possibleReference = ts.skipParentheses(accessExpression.expression);\n                        if (isMatchingReference(reference, possibleReference)) {\n                            return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);\n                        }\n                        if (containsMatchingReference(reference, possibleReference)) {\n                            return declaredType;\n                        }\n                    }\n                }\n                return type;\n            }\n            function narrowType(type, expr, assumeTrue) {\n                switch (expr.kind) {\n                    case 70:\n                    case 98:\n                    case 177:\n                        return narrowTypeByTruthiness(type, expr, assumeTrue);\n                    case 179:\n                        return narrowTypeByTypePredicate(type, expr, assumeTrue);\n                    case 183:\n                        return narrowType(type, expr.expression, assumeTrue);\n                    case 192:\n                        return narrowTypeByBinaryExpression(type, expr, assumeTrue);\n                    case 190:\n                        if (expr.operator === 50) {\n                            return narrowType(type, expr.operand, !assumeTrue);\n                        }\n                        break;\n                }\n                return type;\n            }\n        }\n        function getTypeOfSymbolAtLocation(symbol, location) {\n            if (location.kind === 70) {\n                if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) {\n                    location = location.parent;\n                }\n                if (ts.isPartOfExpression(location) && !ts.isAssignmentTarget(location)) {\n                    var type = getTypeOfExpression(location);\n                    if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {\n                        return type;\n                    }\n                }\n            }\n            return getTypeOfSymbol(symbol);\n        }\n        function getControlFlowContainer(node) {\n            while (true) {\n                node = node.parent;\n                if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) ||\n                    node.kind === 231 ||\n                    node.kind === 261 ||\n                    node.kind === 147) {\n                    return node;\n                }\n            }\n        }\n        function isParameterAssigned(symbol) {\n            var func = ts.getRootDeclaration(symbol.valueDeclaration).parent;\n            var links = getNodeLinks(func);\n            if (!(links.flags & 4194304)) {\n                links.flags |= 4194304;\n                if (!hasParentWithAssignmentsMarked(func)) {\n                    markParameterAssignments(func);\n                }\n            }\n            return symbol.isAssigned || false;\n        }\n        function hasParentWithAssignmentsMarked(node) {\n            while (true) {\n                node = node.parent;\n                if (!node) {\n                    return false;\n                }\n                if (ts.isFunctionLike(node) && getNodeLinks(node).flags & 4194304) {\n                    return true;\n                }\n            }\n        }\n        function markParameterAssignments(node) {\n            if (node.kind === 70) {\n                if (ts.isAssignmentTarget(node)) {\n                    var symbol = getResolvedSymbol(node);\n                    if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 144) {\n                        symbol.isAssigned = true;\n                    }\n                }\n            }\n            else {\n                ts.forEachChild(node, markParameterAssignments);\n            }\n        }\n        function isConstVariable(symbol) {\n            return symbol.flags & 3 && (getDeclarationNodeFlagsFromSymbol(symbol) & 2) !== 0 && getTypeOfSymbol(symbol) !== autoArrayType;\n        }\n        function checkIdentifier(node) {\n            var symbol = getResolvedSymbol(node);\n            if (symbol === unknownSymbol) {\n                return unknownType;\n            }\n            if (symbol === argumentsSymbol) {\n                var container = ts.getContainingFunction(node);\n                if (languageVersion < 2) {\n                    if (container.kind === 185) {\n                        error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);\n                    }\n                    else if (ts.hasModifier(container, 256)) {\n                        error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method);\n                    }\n                }\n                if (node.flags & 16384) {\n                    getNodeLinks(container).flags |= 8192;\n                }\n                return getTypeOfSymbol(symbol);\n            }\n            if (symbol.flags & 8388608 && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) {\n                markAliasSymbolAsReferenced(symbol);\n            }\n            var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);\n            if (localOrExportSymbol.flags & 32) {\n                var declaration_1 = localOrExportSymbol.valueDeclaration;\n                if (declaration_1.kind === 226\n                    && ts.nodeIsDecorated(declaration_1)) {\n                    var container = ts.getContainingClass(node);\n                    while (container !== undefined) {\n                        if (container === declaration_1 && container.name !== node) {\n                            getNodeLinks(declaration_1).flags |= 8388608;\n                            getNodeLinks(node).flags |= 16777216;\n                            break;\n                        }\n                        container = ts.getContainingClass(container);\n                    }\n                }\n                else if (declaration_1.kind === 197) {\n                    var container = ts.getThisContainer(node, false);\n                    while (container !== undefined) {\n                        if (container.parent === declaration_1) {\n                            if (container.kind === 147 && ts.hasModifier(container, 32)) {\n                                getNodeLinks(declaration_1).flags |= 8388608;\n                                getNodeLinks(node).flags |= 16777216;\n                            }\n                            break;\n                        }\n                        container = ts.getThisContainer(container, false);\n                    }\n                }\n            }\n            checkCollisionWithCapturedSuperVariable(node, node);\n            checkCollisionWithCapturedThisVariable(node, node);\n            checkNestedBlockScopedBinding(node, symbol);\n            var type = getTypeOfSymbol(localOrExportSymbol);\n            var declaration = localOrExportSymbol.valueDeclaration;\n            var assignmentKind = ts.getAssignmentTargetKind(node);\n            if (assignmentKind) {\n                if (!(localOrExportSymbol.flags & 3)) {\n                    error(node, ts.Diagnostics.Cannot_assign_to_0_because_it_is_not_a_variable, symbolToString(symbol));\n                    return unknownType;\n                }\n                if (isReadonlySymbol(localOrExportSymbol)) {\n                    error(node, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(symbol));\n                    return unknownType;\n                }\n            }\n            if (!(localOrExportSymbol.flags & 3) || assignmentKind === 1 || !declaration) {\n                return type;\n            }\n            var isParameter = ts.getRootDeclaration(declaration).kind === 144;\n            var declarationContainer = getControlFlowContainer(declaration);\n            var flowContainer = getControlFlowContainer(node);\n            var isOuterVariable = flowContainer !== declarationContainer;\n            while (flowContainer !== declarationContainer && (flowContainer.kind === 184 ||\n                flowContainer.kind === 185 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&\n                (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {\n                flowContainer = getControlFlowContainer(flowContainer);\n            }\n            var assumeInitialized = isParameter || isOuterVariable ||\n                type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0) ||\n                ts.isInAmbientContext(declaration);\n            var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer);\n            if (type === autoType || type === autoArrayType) {\n                if (flowType === autoType || flowType === autoArrayType) {\n                    if (compilerOptions.noImplicitAny) {\n                        error(declaration.name, ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType));\n                        error(node, ts.Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));\n                    }\n                    return convertAutoToAny(flowType);\n                }\n            }\n            else if (!assumeInitialized && !(getFalsyFlags(type) & 2048) && getFalsyFlags(flowType) & 2048) {\n                error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));\n                return type;\n            }\n            return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;\n        }\n        function isInsideFunction(node, threshold) {\n            var current = node;\n            while (current && current !== threshold) {\n                if (ts.isFunctionLike(current)) {\n                    return true;\n                }\n                current = current.parent;\n            }\n            return false;\n        }\n        function checkNestedBlockScopedBinding(node, symbol) {\n            if (languageVersion >= 2 ||\n                (symbol.flags & (2 | 32)) === 0 ||\n                symbol.valueDeclaration.parent.kind === 256) {\n                return;\n            }\n            var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);\n            var usedInFunction = isInsideFunction(node.parent, container);\n            var current = container;\n            var containedInIterationStatement = false;\n            while (current && !ts.nodeStartsNewLexicalEnvironment(current)) {\n                if (ts.isIterationStatement(current, false)) {\n                    containedInIterationStatement = true;\n                    break;\n                }\n                current = current.parent;\n            }\n            if (containedInIterationStatement) {\n                if (usedInFunction) {\n                    getNodeLinks(current).flags |= 65536;\n                }\n                if (container.kind === 211 &&\n                    ts.getAncestor(symbol.valueDeclaration, 224).parent === container &&\n                    isAssignedInBodyOfForStatement(node, container)) {\n                    getNodeLinks(symbol.valueDeclaration).flags |= 2097152;\n                }\n                getNodeLinks(symbol.valueDeclaration).flags |= 262144;\n            }\n            if (usedInFunction) {\n                getNodeLinks(symbol.valueDeclaration).flags |= 131072;\n            }\n        }\n        function isAssignedInBodyOfForStatement(node, container) {\n            var current = node;\n            while (current.parent.kind === 183) {\n                current = current.parent;\n            }\n            var isAssigned = false;\n            if (ts.isAssignmentTarget(current)) {\n                isAssigned = true;\n            }\n            else if ((current.parent.kind === 190 || current.parent.kind === 191)) {\n                var expr = current.parent;\n                isAssigned = expr.operator === 42 || expr.operator === 43;\n            }\n            if (!isAssigned) {\n                return false;\n            }\n            while (current !== container) {\n                if (current === container.statement) {\n                    return true;\n                }\n                else {\n                    current = current.parent;\n                }\n            }\n            return false;\n        }\n        function captureLexicalThis(node, container) {\n            getNodeLinks(node).flags |= 2;\n            if (container.kind === 147 || container.kind === 150) {\n                var classNode = container.parent;\n                getNodeLinks(classNode).flags |= 4;\n            }\n            else {\n                getNodeLinks(container).flags |= 4;\n            }\n        }\n        function findFirstSuperCall(n) {\n            if (ts.isSuperCall(n)) {\n                return n;\n            }\n            else if (ts.isFunctionLike(n)) {\n                return undefined;\n            }\n            return ts.forEachChild(n, findFirstSuperCall);\n        }\n        function getSuperCallInConstructor(constructor) {\n            var links = getNodeLinks(constructor);\n            if (links.hasSuperCall === undefined) {\n                links.superCall = findFirstSuperCall(constructor.body);\n                links.hasSuperCall = links.superCall ? true : false;\n            }\n            return links.superCall;\n        }\n        function classDeclarationExtendsNull(classDecl) {\n            var classSymbol = getSymbolOfNode(classDecl);\n            var classInstanceType = getDeclaredTypeOfSymbol(classSymbol);\n            var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType);\n            return baseConstructorType === nullWideningType;\n        }\n        function checkThisExpression(node) {\n            var container = ts.getThisContainer(node, true);\n            var needToCaptureLexicalThis = false;\n            if (container.kind === 150) {\n                var containingClassDecl = container.parent;\n                var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl);\n                if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) {\n                    var superCall = getSuperCallInConstructor(container);\n                    if (!superCall || superCall.end > node.pos) {\n                        error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class);\n                    }\n                }\n            }\n            if (container.kind === 185) {\n                container = ts.getThisContainer(container, false);\n                needToCaptureLexicalThis = (languageVersion < 2);\n            }\n            switch (container.kind) {\n                case 230:\n                    error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);\n                    break;\n                case 229:\n                    error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location);\n                    break;\n                case 150:\n                    if (isInConstructorArgumentInitializer(node, container)) {\n                        error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments);\n                    }\n                    break;\n                case 147:\n                case 146:\n                    if (ts.getModifierFlags(container) & 32) {\n                        error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer);\n                    }\n                    break;\n                case 142:\n                    error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);\n                    break;\n            }\n            if (needToCaptureLexicalThis) {\n                captureLexicalThis(node, container);\n            }\n            if (ts.isFunctionLike(container) &&\n                (!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) {\n                if (container.kind === 184 &&\n                    ts.isInJavaScriptFile(container.parent) &&\n                    ts.getSpecialPropertyAssignmentKind(container.parent) === 3) {\n                    var className = container.parent\n                        .left\n                        .expression\n                        .expression;\n                    var classSymbol = checkExpression(className).symbol;\n                    if (classSymbol && classSymbol.members && (classSymbol.flags & 16)) {\n                        return getInferredClassType(classSymbol);\n                    }\n                }\n                var thisType = getThisTypeOfDeclaration(container) || getContextualThisParameterType(container);\n                if (thisType) {\n                    return thisType;\n                }\n            }\n            if (ts.isClassLike(container.parent)) {\n                var symbol = getSymbolOfNode(container.parent);\n                var type = ts.hasModifier(container, 32) ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType;\n                return getFlowTypeOfReference(node, type, true, undefined);\n            }\n            if (ts.isInJavaScriptFile(node)) {\n                var type = getTypeForThisExpressionFromJSDoc(container);\n                if (type && type !== unknownType) {\n                    return type;\n                }\n            }\n            if (compilerOptions.noImplicitThis) {\n                error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation);\n            }\n            return anyType;\n        }\n        function getTypeForThisExpressionFromJSDoc(node) {\n            var jsdocType = ts.getJSDocType(node);\n            if (jsdocType && jsdocType.kind === 274) {\n                var jsDocFunctionType = jsdocType;\n                if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277) {\n                    return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);\n                }\n            }\n        }\n        function isInConstructorArgumentInitializer(node, constructorDecl) {\n            for (var n = node; n && n !== constructorDecl; n = n.parent) {\n                if (n.kind === 144) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function checkSuperExpression(node) {\n            var isCallExpression = node.parent.kind === 179 && node.parent.expression === node;\n            var container = ts.getSuperContainer(node, true);\n            var needToCaptureLexicalThis = false;\n            if (!isCallExpression) {\n                while (container && container.kind === 185) {\n                    container = ts.getSuperContainer(container, true);\n                    needToCaptureLexicalThis = languageVersion < 2;\n                }\n            }\n            var canUseSuperExpression = isLegalUsageOfSuperExpression(container);\n            var nodeCheckFlag = 0;\n            if (!canUseSuperExpression) {\n                var current = node;\n                while (current && current !== container && current.kind !== 142) {\n                    current = current.parent;\n                }\n                if (current && current.kind === 142) {\n                    error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);\n                }\n                else if (isCallExpression) {\n                    error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);\n                }\n                else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 176)) {\n                    error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);\n                }\n                else {\n                    error(node, ts.Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class);\n                }\n                return unknownType;\n            }\n            if ((ts.getModifierFlags(container) & 32) || isCallExpression) {\n                nodeCheckFlag = 512;\n            }\n            else {\n                nodeCheckFlag = 256;\n            }\n            getNodeLinks(node).flags |= nodeCheckFlag;\n            if (container.kind === 149 && ts.getModifierFlags(container) & 256) {\n                if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {\n                    getNodeLinks(container).flags |= 4096;\n                }\n                else {\n                    getNodeLinks(container).flags |= 2048;\n                }\n            }\n            if (needToCaptureLexicalThis) {\n                captureLexicalThis(node.parent, container);\n            }\n            if (container.parent.kind === 176) {\n                if (languageVersion < 2) {\n                    error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);\n                    return unknownType;\n                }\n                else {\n                    return anyType;\n                }\n            }\n            var classLikeDeclaration = container.parent;\n            var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classLikeDeclaration));\n            var baseClassType = classType && getBaseTypes(classType)[0];\n            if (!baseClassType) {\n                if (!ts.getClassExtendsHeritageClauseElement(classLikeDeclaration)) {\n                    error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class);\n                }\n                return unknownType;\n            }\n            if (container.kind === 150 && isInConstructorArgumentInitializer(node, container)) {\n                error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments);\n                return unknownType;\n            }\n            return nodeCheckFlag === 512\n                ? getBaseConstructorTypeOfClass(classType)\n                : getTypeWithThisArgument(baseClassType, classType.thisType);\n            function isLegalUsageOfSuperExpression(container) {\n                if (!container) {\n                    return false;\n                }\n                if (isCallExpression) {\n                    return container.kind === 150;\n                }\n                else {\n                    if (ts.isClassLike(container.parent) || container.parent.kind === 176) {\n                        if (ts.getModifierFlags(container) & 32) {\n                            return container.kind === 149 ||\n                                container.kind === 148 ||\n                                container.kind === 151 ||\n                                container.kind === 152;\n                        }\n                        else {\n                            return container.kind === 149 ||\n                                container.kind === 148 ||\n                                container.kind === 151 ||\n                                container.kind === 152 ||\n                                container.kind === 147 ||\n                                container.kind === 146 ||\n                                container.kind === 150;\n                        }\n                    }\n                }\n                return false;\n            }\n        }\n        function getContextualThisParameterType(func) {\n            if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 185) {\n                var contextualSignature = getContextualSignature(func);\n                if (contextualSignature) {\n                    var thisParameter = contextualSignature.thisParameter;\n                    if (thisParameter) {\n                        return getTypeOfSymbol(thisParameter);\n                    }\n                }\n            }\n            return undefined;\n        }\n        function getContextuallyTypedParameterType(parameter) {\n            var func = parameter.parent;\n            if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) {\n                var iife = ts.getImmediatelyInvokedFunctionExpression(func);\n                if (iife) {\n                    var indexOfParameter = ts.indexOf(func.parameters, parameter);\n                    if (iife.arguments && indexOfParameter < iife.arguments.length) {\n                        if (parameter.dotDotDotToken) {\n                            var restTypes = [];\n                            for (var i = indexOfParameter; i < iife.arguments.length; i++) {\n                                restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i])));\n                            }\n                            return createArrayType(getUnionType(restTypes));\n                        }\n                        var links = getNodeLinks(iife);\n                        var cached = links.resolvedSignature;\n                        links.resolvedSignature = anySignature;\n                        var type = getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter]));\n                        links.resolvedSignature = cached;\n                        return type;\n                    }\n                }\n                var contextualSignature = getContextualSignature(func);\n                if (contextualSignature) {\n                    var funcHasRestParameters = ts.hasRestParameter(func);\n                    var len = func.parameters.length - (funcHasRestParameters ? 1 : 0);\n                    var indexOfParameter = ts.indexOf(func.parameters, parameter);\n                    if (indexOfParameter < len) {\n                        return getTypeAtPosition(contextualSignature, indexOfParameter);\n                    }\n                    if (funcHasRestParameters &&\n                        indexOfParameter === (func.parameters.length - 1) &&\n                        isRestParameterIndex(contextualSignature, func.parameters.length - 1)) {\n                        return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters));\n                    }\n                }\n            }\n            return undefined;\n        }\n        function getContextualTypeForInitializerExpression(node) {\n            var declaration = node.parent;\n            if (node === declaration.initializer) {\n                if (declaration.type) {\n                    return getTypeFromTypeNode(declaration.type);\n                }\n                if (declaration.kind === 144) {\n                    var type = getContextuallyTypedParameterType(declaration);\n                    if (type) {\n                        return type;\n                    }\n                }\n                if (ts.isBindingPattern(declaration.name)) {\n                    return getTypeFromBindingPattern(declaration.name, true, false);\n                }\n                if (ts.isBindingPattern(declaration.parent)) {\n                    var parentDeclaration = declaration.parent.parent;\n                    var name_19 = declaration.propertyName || declaration.name;\n                    if (ts.isVariableLike(parentDeclaration) &&\n                        parentDeclaration.type &&\n                        !ts.isBindingPattern(name_19)) {\n                        var text = ts.getTextOfPropertyName(name_19);\n                        if (text) {\n                            return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text);\n                        }\n                    }\n                }\n            }\n            return undefined;\n        }\n        function getContextualTypeForReturnExpression(node) {\n            var func = ts.getContainingFunction(node);\n            if (ts.isAsyncFunctionLike(func)) {\n                var contextualReturnType = getContextualReturnType(func);\n                if (contextualReturnType) {\n                    return getPromisedType(contextualReturnType);\n                }\n                return undefined;\n            }\n            if (func && !func.asteriskToken) {\n                return getContextualReturnType(func);\n            }\n            return undefined;\n        }\n        function getContextualTypeForYieldOperand(node) {\n            var func = ts.getContainingFunction(node);\n            if (func) {\n                var contextualReturnType = getContextualReturnType(func);\n                if (contextualReturnType) {\n                    return node.asteriskToken\n                        ? contextualReturnType\n                        : getElementTypeOfIterableIterator(contextualReturnType);\n                }\n            }\n            return undefined;\n        }\n        function isInParameterInitializerBeforeContainingFunction(node) {\n            while (node.parent && !ts.isFunctionLike(node.parent)) {\n                if (node.parent.kind === 144 && node.parent.initializer === node) {\n                    return true;\n                }\n                node = node.parent;\n            }\n            return false;\n        }\n        function getContextualReturnType(functionDecl) {\n            if (functionDecl.type ||\n                functionDecl.kind === 150 ||\n                functionDecl.kind === 151 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 152))) {\n                return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl));\n            }\n            var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl);\n            if (signature) {\n                return getReturnTypeOfSignature(signature);\n            }\n            return undefined;\n        }\n        function getContextualTypeForArgument(callTarget, arg) {\n            var args = getEffectiveCallArguments(callTarget);\n            var argIndex = ts.indexOf(args, arg);\n            if (argIndex >= 0) {\n                var signature = getResolvedOrAnySignature(callTarget);\n                return getTypeAtPosition(signature, argIndex);\n            }\n            return undefined;\n        }\n        function getContextualTypeForSubstitutionExpression(template, substitutionExpression) {\n            if (template.parent.kind === 181) {\n                return getContextualTypeForArgument(template.parent, substitutionExpression);\n            }\n            return undefined;\n        }\n        function getContextualTypeForBinaryOperand(node) {\n            var binaryExpression = node.parent;\n            var operator = binaryExpression.operatorToken.kind;\n            if (operator >= 57 && operator <= 69) {\n                if (ts.getSpecialPropertyAssignmentKind(binaryExpression) !== 0) {\n                    return undefined;\n                }\n                if (node === binaryExpression.right) {\n                    return getTypeOfExpression(binaryExpression.left);\n                }\n            }\n            else if (operator === 53) {\n                var type = getContextualType(binaryExpression);\n                if (!type && node === binaryExpression.right) {\n                    type = getTypeOfExpression(binaryExpression.left);\n                }\n                return type;\n            }\n            else if (operator === 52 || operator === 25) {\n                if (node === binaryExpression.right) {\n                    return getContextualType(binaryExpression);\n                }\n            }\n            return undefined;\n        }\n        function applyToContextualType(type, mapper) {\n            if (!(type.flags & 65536)) {\n                return mapper(type);\n            }\n            var types = type.types;\n            var mappedType;\n            var mappedTypes;\n            for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {\n                var current = types_13[_i];\n                var t = mapper(current);\n                if (t) {\n                    if (!mappedType) {\n                        mappedType = t;\n                    }\n                    else if (!mappedTypes) {\n                        mappedTypes = [mappedType, t];\n                    }\n                    else {\n                        mappedTypes.push(t);\n                    }\n                }\n            }\n            return mappedTypes ? getUnionType(mappedTypes) : mappedType;\n        }\n        function getTypeOfPropertyOfContextualType(type, name) {\n            return applyToContextualType(type, function (t) {\n                var prop = t.flags & 229376 ? getPropertyOfType(t, name) : undefined;\n                return prop ? getTypeOfSymbol(prop) : undefined;\n            });\n        }\n        function getIndexTypeOfContextualType(type, kind) {\n            return applyToContextualType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); });\n        }\n        function contextualTypeIsTupleLikeType(type) {\n            return !!(type.flags & 65536 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type));\n        }\n        function getContextualTypeForObjectLiteralMethod(node) {\n            ts.Debug.assert(ts.isObjectLiteralMethod(node));\n            if (isInsideWithStatementBody(node)) {\n                return undefined;\n            }\n            return getContextualTypeForObjectLiteralElement(node);\n        }\n        function getContextualTypeForObjectLiteralElement(element) {\n            var objectLiteral = element.parent;\n            var type = getApparentTypeOfContextualType(objectLiteral);\n            if (type) {\n                if (!ts.hasDynamicName(element)) {\n                    var symbolName = getSymbolOfNode(element).name;\n                    var propertyType = getTypeOfPropertyOfContextualType(type, symbolName);\n                    if (propertyType) {\n                        return propertyType;\n                    }\n                }\n                return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) ||\n                    getIndexTypeOfContextualType(type, 0);\n            }\n            return undefined;\n        }\n        function getContextualTypeForElementExpression(node) {\n            var arrayLiteral = node.parent;\n            var type = getApparentTypeOfContextualType(arrayLiteral);\n            if (type) {\n                var index = ts.indexOf(arrayLiteral.elements, node);\n                return getTypeOfPropertyOfContextualType(type, \"\" + index)\n                    || getIndexTypeOfContextualType(type, 1)\n                    || (languageVersion >= 2 ? getElementTypeOfIterable(type, undefined) : undefined);\n            }\n            return undefined;\n        }\n        function getContextualTypeForConditionalOperand(node) {\n            var conditional = node.parent;\n            return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined;\n        }\n        function getContextualTypeForJsxAttribute(attribute) {\n            var kind = attribute.kind;\n            var jsxElement = attribute.parent;\n            var attrsType = getJsxElementAttributesType(jsxElement);\n            if (attribute.kind === 250) {\n                if (!attrsType || isTypeAny(attrsType)) {\n                    return undefined;\n                }\n                return getTypeOfPropertyOfType(attrsType, attribute.name.text);\n            }\n            else if (attribute.kind === 251) {\n                return attrsType;\n            }\n            ts.Debug.fail(\"Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[\" + kind + \"]\");\n        }\n        function getApparentTypeOfContextualType(node) {\n            var type = getContextualType(node);\n            return type && getApparentType(type);\n        }\n        function getContextualType(node) {\n            if (isInsideWithStatementBody(node)) {\n                return undefined;\n            }\n            if (node.contextualType) {\n                return node.contextualType;\n            }\n            var parent = node.parent;\n            switch (parent.kind) {\n                case 223:\n                case 144:\n                case 147:\n                case 146:\n                case 174:\n                    return getContextualTypeForInitializerExpression(node);\n                case 185:\n                case 216:\n                    return getContextualTypeForReturnExpression(node);\n                case 195:\n                    return getContextualTypeForYieldOperand(parent);\n                case 179:\n                case 180:\n                    return getContextualTypeForArgument(parent, node);\n                case 182:\n                case 200:\n                    return getTypeFromTypeNode(parent.type);\n                case 192:\n                    return getContextualTypeForBinaryOperand(node);\n                case 257:\n                case 258:\n                    return getContextualTypeForObjectLiteralElement(parent);\n                case 175:\n                    return getContextualTypeForElementExpression(node);\n                case 193:\n                    return getContextualTypeForConditionalOperand(node);\n                case 202:\n                    ts.Debug.assert(parent.parent.kind === 194);\n                    return getContextualTypeForSubstitutionExpression(parent.parent, node);\n                case 183:\n                    return getContextualType(parent);\n                case 252:\n                    return getContextualType(parent);\n                case 250:\n                case 251:\n                    return getContextualTypeForJsxAttribute(parent);\n            }\n            return undefined;\n        }\n        function getNonGenericSignature(type, node) {\n            var signatures = getSignaturesOfStructuredType(type, 0);\n            if (signatures.length === 1) {\n                var signature = signatures[0];\n                if (!signature.typeParameters && !isAritySmaller(signature, node)) {\n                    return signature;\n                }\n            }\n        }\n        function isAritySmaller(signature, target) {\n            var targetParameterCount = 0;\n            for (; targetParameterCount < target.parameters.length; targetParameterCount++) {\n                var param = target.parameters[targetParameterCount];\n                if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) {\n                    break;\n                }\n            }\n            if (target.parameters.length && ts.parameterIsThisKeyword(target.parameters[0])) {\n                targetParameterCount--;\n            }\n            var sourceLength = signature.hasRestParameter ? Number.MAX_VALUE : signature.parameters.length;\n            return sourceLength < targetParameterCount;\n        }\n        function isFunctionExpressionOrArrowFunction(node) {\n            return node.kind === 184 || node.kind === 185;\n        }\n        function getContextualSignatureForFunctionLikeDeclaration(node) {\n            return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node)\n                ? getContextualSignature(node)\n                : undefined;\n        }\n        function getContextualTypeForFunctionLikeDeclaration(node) {\n            return ts.isObjectLiteralMethod(node) ?\n                getContextualTypeForObjectLiteralMethod(node) :\n                getApparentTypeOfContextualType(node);\n        }\n        function getContextualSignature(node) {\n            ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node));\n            var type = getContextualTypeForFunctionLikeDeclaration(node);\n            if (!type) {\n                return undefined;\n            }\n            if (!(type.flags & 65536)) {\n                return getNonGenericSignature(type, node);\n            }\n            var signatureList;\n            var types = type.types;\n            for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {\n                var current = types_14[_i];\n                var signature = getNonGenericSignature(current, node);\n                if (signature) {\n                    if (!signatureList) {\n                        signatureList = [signature];\n                    }\n                    else if (!compareSignaturesIdentical(signatureList[0], signature, false, true, true, compareTypesIdentical)) {\n                        return undefined;\n                    }\n                    else {\n                        signatureList.push(signature);\n                    }\n                }\n            }\n            var result;\n            if (signatureList) {\n                result = cloneSignature(signatureList[0]);\n                result.resolvedReturnType = undefined;\n                result.unionSignatures = signatureList;\n            }\n            return result;\n        }\n        function isInferentialContext(mapper) {\n            return mapper && mapper.context;\n        }\n        function checkSpreadExpression(node, contextualMapper) {\n            var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper);\n            return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false);\n        }\n        function hasDefaultValue(node) {\n            return (node.kind === 174 && !!node.initializer) ||\n                (node.kind === 192 && node.operatorToken.kind === 57);\n        }\n        function checkArrayLiteral(node, contextualMapper) {\n            var elements = node.elements;\n            var hasSpreadElement = false;\n            var elementTypes = [];\n            var inDestructuringPattern = ts.isAssignmentTarget(node);\n            for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {\n                var e = elements_1[_i];\n                if (inDestructuringPattern && e.kind === 196) {\n                    var restArrayType = checkExpression(e.expression, contextualMapper);\n                    var restElementType = getIndexTypeOfType(restArrayType, 1) ||\n                        (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined);\n                    if (restElementType) {\n                        elementTypes.push(restElementType);\n                    }\n                }\n                else {\n                    var type = checkExpressionForMutableLocation(e, contextualMapper);\n                    elementTypes.push(type);\n                }\n                hasSpreadElement = hasSpreadElement || e.kind === 196;\n            }\n            if (!hasSpreadElement) {\n                if (inDestructuringPattern && elementTypes.length) {\n                    var type = cloneTypeReference(createTupleType(elementTypes));\n                    type.pattern = node;\n                    return type;\n                }\n                var contextualType = getApparentTypeOfContextualType(node);\n                if (contextualType && contextualTypeIsTupleLikeType(contextualType)) {\n                    var pattern = contextualType.pattern;\n                    if (pattern && (pattern.kind === 173 || pattern.kind === 175)) {\n                        var patternElements = pattern.elements;\n                        for (var i = elementTypes.length; i < patternElements.length; i++) {\n                            var patternElement = patternElements[i];\n                            if (hasDefaultValue(patternElement)) {\n                                elementTypes.push(contextualType.typeArguments[i]);\n                            }\n                            else {\n                                if (patternElement.kind !== 198) {\n                                    error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);\n                                }\n                                elementTypes.push(unknownType);\n                            }\n                        }\n                    }\n                    if (elementTypes.length) {\n                        return createTupleType(elementTypes);\n                    }\n                }\n            }\n            return createArrayType(elementTypes.length ?\n                getUnionType(elementTypes, true) :\n                strictNullChecks ? neverType : undefinedWideningType);\n        }\n        function isNumericName(name) {\n            return name.kind === 142 ? isNumericComputedName(name) : isNumericLiteralName(name.text);\n        }\n        function isNumericComputedName(name) {\n            return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 340);\n        }\n        function isTypeAnyOrAllConstituentTypesHaveKind(type, kind) {\n            return isTypeAny(type) || isTypeOfKind(type, kind);\n        }\n        function isInfinityOrNaNString(name) {\n            return name === \"Infinity\" || name === \"-Infinity\" || name === \"NaN\";\n        }\n        function isNumericLiteralName(name) {\n            return (+name).toString() === name;\n        }\n        function checkComputedPropertyName(node) {\n            var links = getNodeLinks(node.expression);\n            if (!links.resolvedType) {\n                links.resolvedType = checkExpression(node.expression);\n                if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 | 262178 | 512)) {\n                    error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);\n                }\n                else {\n                    checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, true);\n                }\n            }\n            return links.resolvedType;\n        }\n        function getObjectLiteralIndexInfo(propertyNodes, offset, properties, kind) {\n            var propTypes = [];\n            for (var i = 0; i < properties.length; i++) {\n                if (kind === 0 || isNumericName(propertyNodes[i + offset].name)) {\n                    propTypes.push(getTypeOfSymbol(properties[i]));\n                }\n            }\n            var unionType = propTypes.length ? getUnionType(propTypes, true) : undefinedType;\n            return createIndexInfo(unionType, false);\n        }\n        function checkObjectLiteral(node, contextualMapper) {\n            var inDestructuringPattern = ts.isAssignmentTarget(node);\n            checkGrammarObjectLiteralExpression(node, inDestructuringPattern);\n            var propertiesTable = ts.createMap();\n            var propertiesArray = [];\n            var spread = emptyObjectType;\n            var propagatedFlags = 0;\n            var contextualType = getApparentTypeOfContextualType(node);\n            var contextualTypeHasPattern = contextualType && contextualType.pattern &&\n                (contextualType.pattern.kind === 172 || contextualType.pattern.kind === 176);\n            var typeFlags = 0;\n            var patternWithComputedProperties = false;\n            var hasComputedStringProperty = false;\n            var hasComputedNumberProperty = false;\n            var offset = 0;\n            for (var i = 0; i < node.properties.length; i++) {\n                var memberDecl = node.properties[i];\n                var member = memberDecl.symbol;\n                if (memberDecl.kind === 257 ||\n                    memberDecl.kind === 258 ||\n                    ts.isObjectLiteralMethod(memberDecl)) {\n                    var type = void 0;\n                    if (memberDecl.kind === 257) {\n                        type = checkPropertyAssignment(memberDecl, contextualMapper);\n                    }\n                    else if (memberDecl.kind === 149) {\n                        type = checkObjectLiteralMethod(memberDecl, contextualMapper);\n                    }\n                    else {\n                        ts.Debug.assert(memberDecl.kind === 258);\n                        type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper);\n                    }\n                    typeFlags |= type.flags;\n                    var prop = createSymbol(4 | 67108864 | member.flags, member.name);\n                    if (inDestructuringPattern) {\n                        var isOptional = (memberDecl.kind === 257 && hasDefaultValue(memberDecl.initializer)) ||\n                            (memberDecl.kind === 258 && memberDecl.objectAssignmentInitializer);\n                        if (isOptional) {\n                            prop.flags |= 536870912;\n                        }\n                        if (ts.hasDynamicName(memberDecl)) {\n                            patternWithComputedProperties = true;\n                        }\n                    }\n                    else if (contextualTypeHasPattern && !(getObjectFlags(contextualType) & 512)) {\n                        var impliedProp = getPropertyOfType(contextualType, member.name);\n                        if (impliedProp) {\n                            prop.flags |= impliedProp.flags & 536870912;\n                        }\n                        else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, 0)) {\n                            error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType));\n                        }\n                    }\n                    prop.declarations = member.declarations;\n                    prop.parent = member.parent;\n                    if (member.valueDeclaration) {\n                        prop.valueDeclaration = member.valueDeclaration;\n                    }\n                    prop.type = type;\n                    prop.target = member;\n                    member = prop;\n                }\n                else if (memberDecl.kind === 259) {\n                    if (languageVersion < 5) {\n                        checkExternalEmitHelpers(memberDecl, 2);\n                    }\n                    if (propertiesArray.length > 0) {\n                        spread = getSpreadType(spread, createObjectLiteralType(), true);\n                        propertiesArray = [];\n                        propertiesTable = ts.createMap();\n                        hasComputedStringProperty = false;\n                        hasComputedNumberProperty = false;\n                        typeFlags = 0;\n                    }\n                    var type = checkExpression(memberDecl.expression);\n                    if (!isValidSpreadType(type)) {\n                        error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types);\n                        return unknownType;\n                    }\n                    spread = getSpreadType(spread, type, false);\n                    offset = i + 1;\n                    continue;\n                }\n                else {\n                    ts.Debug.assert(memberDecl.kind === 151 || memberDecl.kind === 152);\n                    checkAccessorDeclaration(memberDecl);\n                }\n                if (ts.hasDynamicName(memberDecl)) {\n                    if (isNumericName(memberDecl.name)) {\n                        hasComputedNumberProperty = true;\n                    }\n                    else {\n                        hasComputedStringProperty = true;\n                    }\n                }\n                else {\n                    propertiesTable[member.name] = member;\n                }\n                propertiesArray.push(member);\n            }\n            if (contextualTypeHasPattern) {\n                for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) {\n                    var prop = _a[_i];\n                    if (!propertiesTable[prop.name]) {\n                        if (!(prop.flags & 536870912)) {\n                            error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);\n                        }\n                        propertiesTable[prop.name] = prop;\n                        propertiesArray.push(prop);\n                    }\n                }\n            }\n            if (spread !== emptyObjectType) {\n                if (propertiesArray.length > 0) {\n                    spread = getSpreadType(spread, createObjectLiteralType(), true);\n                }\n                spread.flags |= propagatedFlags;\n                spread.symbol = node.symbol;\n                return spread;\n            }\n            return createObjectLiteralType();\n            function createObjectLiteralType() {\n                var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0) : undefined;\n                var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1) : undefined;\n                var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);\n                var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576;\n                result.flags |= 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064);\n                result.objectFlags |= 128;\n                if (patternWithComputedProperties) {\n                    result.objectFlags |= 512;\n                }\n                if (inDestructuringPattern) {\n                    result.pattern = node;\n                }\n                if (!(result.flags & 6144)) {\n                    propagatedFlags |= (result.flags & 14680064);\n                }\n                return result;\n            }\n        }\n        function isValidSpreadType(type) {\n            return !!(type.flags & (1 | 4096 | 2048) ||\n                type.flags & 32768 && !isGenericMappedType(type) ||\n                type.flags & 196608 && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); }));\n        }\n        function checkJsxSelfClosingElement(node) {\n            checkJsxOpeningLikeElement(node);\n            return jsxElementType || anyType;\n        }\n        function checkJsxElement(node) {\n            checkJsxOpeningLikeElement(node.openingElement);\n            if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) {\n                getIntrinsicTagSymbol(node.closingElement);\n            }\n            else {\n                checkExpression(node.closingElement.tagName);\n            }\n            for (var _i = 0, _a = node.children; _i < _a.length; _i++) {\n                var child = _a[_i];\n                switch (child.kind) {\n                    case 252:\n                        checkJsxExpression(child);\n                        break;\n                    case 246:\n                        checkJsxElement(child);\n                        break;\n                    case 247:\n                        checkJsxSelfClosingElement(child);\n                        break;\n                }\n            }\n            return jsxElementType || anyType;\n        }\n        function isUnhyphenatedJsxName(name) {\n            return name.indexOf(\"-\") < 0;\n        }\n        function isJsxIntrinsicIdentifier(tagName) {\n            if (tagName.kind === 177 || tagName.kind === 98) {\n                return false;\n            }\n            else {\n                return ts.isIntrinsicJsxName(tagName.text);\n            }\n        }\n        function checkJsxAttribute(node, elementAttributesType, nameTable) {\n            var correspondingPropType = undefined;\n            if (elementAttributesType === emptyObjectType && isUnhyphenatedJsxName(node.name.text)) {\n                error(node.parent, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName());\n            }\n            else if (elementAttributesType && !isTypeAny(elementAttributesType)) {\n                var correspondingPropSymbol = getPropertyOfType(elementAttributesType, node.name.text);\n                correspondingPropType = correspondingPropSymbol && getTypeOfSymbol(correspondingPropSymbol);\n                if (isUnhyphenatedJsxName(node.name.text)) {\n                    var attributeType = getTypeOfPropertyOfType(elementAttributesType, ts.getTextOfPropertyName(node.name)) || getIndexTypeOfType(elementAttributesType, 0);\n                    if (attributeType) {\n                        correspondingPropType = attributeType;\n                    }\n                    else {\n                        if (!correspondingPropType) {\n                            error(node.name, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.name.text, typeToString(elementAttributesType));\n                            return unknownType;\n                        }\n                    }\n                }\n            }\n            var exprType;\n            if (node.initializer) {\n                exprType = checkExpression(node.initializer);\n            }\n            else {\n                exprType = booleanType;\n            }\n            if (correspondingPropType) {\n                checkTypeAssignableTo(exprType, correspondingPropType, node);\n            }\n            nameTable[node.name.text] = true;\n            return exprType;\n        }\n        function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) {\n            if (compilerOptions.jsx === 2) {\n                checkExternalEmitHelpers(node, 2);\n            }\n            var type = checkExpression(node.expression);\n            var props = getPropertiesOfType(type);\n            for (var _i = 0, props_2 = props; _i < props_2.length; _i++) {\n                var prop = props_2[_i];\n                if (!nameTable[prop.name]) {\n                    var targetPropSym = getPropertyOfType(elementAttributesType, prop.name);\n                    if (targetPropSym) {\n                        var msg = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property, prop.name);\n                        checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(targetPropSym), node, undefined, msg);\n                    }\n                    nameTable[prop.name] = true;\n                }\n            }\n            return type;\n        }\n        function getJsxType(name) {\n            if (jsxTypes[name] === undefined) {\n                return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType;\n            }\n            return jsxTypes[name];\n        }\n        function getIntrinsicTagSymbol(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedSymbol) {\n                var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements);\n                if (intrinsicElementsType !== unknownType) {\n                    var intrinsicProp = getPropertyOfType(intrinsicElementsType, node.tagName.text);\n                    if (intrinsicProp) {\n                        links.jsxFlags |= 1;\n                        return links.resolvedSymbol = intrinsicProp;\n                    }\n                    var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, 0);\n                    if (indexSignatureType) {\n                        links.jsxFlags |= 2;\n                        return links.resolvedSymbol = intrinsicElementsType.symbol;\n                    }\n                    error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, \"JSX.\" + JsxNames.IntrinsicElements);\n                    return links.resolvedSymbol = unknownSymbol;\n                }\n                else {\n                    if (compilerOptions.noImplicitAny) {\n                        error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements);\n                    }\n                    return links.resolvedSymbol = unknownSymbol;\n                }\n            }\n            return links.resolvedSymbol;\n        }\n        function getJsxElementInstanceType(node, valueType) {\n            ts.Debug.assert(!(valueType.flags & 65536));\n            if (isTypeAny(valueType)) {\n                return anyType;\n            }\n            var signatures = getSignaturesOfType(valueType, 1);\n            if (signatures.length === 0) {\n                signatures = getSignaturesOfType(valueType, 0);\n                if (signatures.length === 0) {\n                    error(node.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(node.tagName));\n                    return unknownType;\n                }\n            }\n            return getUnionType(ts.map(signatures, getReturnTypeOfSignature), true);\n        }\n        function getJsxElementPropertiesName() {\n            var jsxNamespace = getGlobalSymbol(JsxNames.JSX, 1920, undefined);\n            var attribsPropTypeSym = jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.ElementAttributesPropertyNameContainer, 793064);\n            var attribPropType = attribsPropTypeSym && getDeclaredTypeOfSymbol(attribsPropTypeSym);\n            var attribProperties = attribPropType && getPropertiesOfType(attribPropType);\n            if (attribProperties) {\n                if (attribProperties.length === 0) {\n                    return \"\";\n                }\n                else if (attribProperties.length === 1) {\n                    return attribProperties[0].name;\n                }\n                else {\n                    error(attribsPropTypeSym.declarations[0], ts.Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, JsxNames.ElementAttributesPropertyNameContainer);\n                    return undefined;\n                }\n            }\n            else {\n                return undefined;\n            }\n        }\n        function getResolvedJsxType(node, elemType, elemClassType) {\n            if (!elemType) {\n                elemType = checkExpression(node.tagName);\n            }\n            if (elemType.flags & 65536) {\n                var types = elemType.types;\n                return getUnionType(ts.map(types, function (type) {\n                    return getResolvedJsxType(node, type, elemClassType);\n                }), true);\n            }\n            if (elemType.flags & 2) {\n                return anyType;\n            }\n            else if (elemType.flags & 32) {\n                var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements);\n                if (intrinsicElementsType !== unknownType) {\n                    var stringLiteralTypeName = elemType.text;\n                    var intrinsicProp = getPropertyOfType(intrinsicElementsType, stringLiteralTypeName);\n                    if (intrinsicProp) {\n                        return getTypeOfSymbol(intrinsicProp);\n                    }\n                    var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, 0);\n                    if (indexSignatureType) {\n                        return indexSignatureType;\n                    }\n                    error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, stringLiteralTypeName, \"JSX.\" + JsxNames.IntrinsicElements);\n                }\n                return anyType;\n            }\n            var elemInstanceType = getJsxElementInstanceType(node, elemType);\n            if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) {\n                if (jsxElementType) {\n                    var callSignatures = elemType && getSignaturesOfType(elemType, 0);\n                    var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0];\n                    var callReturnType = callSignature && getReturnTypeOfSignature(callSignature);\n                    var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0]));\n                    if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) {\n                        var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes);\n                        if (intrinsicAttributes !== unknownType) {\n                            paramType = intersectTypes(intrinsicAttributes, paramType);\n                        }\n                        return paramType;\n                    }\n                }\n            }\n            if (elemClassType) {\n                checkTypeRelatedTo(elemInstanceType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements);\n            }\n            if (isTypeAny(elemInstanceType)) {\n                return elemInstanceType;\n            }\n            var propsName = getJsxElementPropertiesName();\n            if (propsName === undefined) {\n                return anyType;\n            }\n            else if (propsName === \"\") {\n                return elemInstanceType;\n            }\n            else {\n                var attributesType = getTypeOfPropertyOfType(elemInstanceType, propsName);\n                if (!attributesType) {\n                    return emptyObjectType;\n                }\n                else if (isTypeAny(attributesType) || (attributesType === unknownType)) {\n                    return attributesType;\n                }\n                else if (attributesType.flags & 65536) {\n                    error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type, typeToString(attributesType));\n                    return anyType;\n                }\n                else {\n                    var apparentAttributesType = attributesType;\n                    var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes);\n                    if (intrinsicClassAttribs !== unknownType) {\n                        var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol);\n                        if (typeParams) {\n                            if (typeParams.length === 1) {\n                                apparentAttributesType = intersectTypes(createTypeReference(intrinsicClassAttribs, [elemInstanceType]), apparentAttributesType);\n                            }\n                        }\n                        else {\n                            apparentAttributesType = intersectTypes(attributesType, intrinsicClassAttribs);\n                        }\n                    }\n                    var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes);\n                    if (intrinsicAttribs !== unknownType) {\n                        apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType);\n                    }\n                    return apparentAttributesType;\n                }\n            }\n        }\n        function getJsxElementAttributesType(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedJsxType) {\n                if (isJsxIntrinsicIdentifier(node.tagName)) {\n                    var symbol = getIntrinsicTagSymbol(node);\n                    if (links.jsxFlags & 1) {\n                        return links.resolvedJsxType = getTypeOfSymbol(symbol);\n                    }\n                    else if (links.jsxFlags & 2) {\n                        return links.resolvedJsxType = getIndexInfoOfSymbol(symbol, 0).type;\n                    }\n                    else {\n                        return links.resolvedJsxType = unknownType;\n                    }\n                }\n                else {\n                    var elemClassType = getJsxGlobalElementClassType();\n                    return links.resolvedJsxType = getResolvedJsxType(node, undefined, elemClassType);\n                }\n            }\n            return links.resolvedJsxType;\n        }\n        function getJsxAttributePropertySymbol(attrib) {\n            var attributesType = getJsxElementAttributesType(attrib.parent);\n            var prop = getPropertyOfType(attributesType, attrib.name.text);\n            return prop || unknownSymbol;\n        }\n        function getJsxGlobalElementClassType() {\n            if (!jsxElementClassType) {\n                jsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass);\n            }\n            return jsxElementClassType;\n        }\n        function getJsxIntrinsicTagNames() {\n            var intrinsics = getJsxType(JsxNames.IntrinsicElements);\n            return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray;\n        }\n        function checkJsxPreconditions(errorNode) {\n            if ((compilerOptions.jsx || 0) === 0) {\n                error(errorNode, ts.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided);\n            }\n            if (jsxElementType === undefined) {\n                if (compilerOptions.noImplicitAny) {\n                    error(errorNode, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist);\n                }\n            }\n        }\n        function checkJsxOpeningLikeElement(node) {\n            checkGrammarJsxElement(node);\n            checkJsxPreconditions(node);\n            var reactRefErr = compilerOptions.jsx === 2 ? ts.Diagnostics.Cannot_find_name_0 : undefined;\n            var reactNamespace = getJsxNamespace();\n            var reactSym = resolveName(node.tagName, reactNamespace, 107455, reactRefErr, reactNamespace);\n            if (reactSym) {\n                reactSym.isReferenced = true;\n                if (reactSym.flags & 8388608 && !isConstEnumOrConstEnumOnlyModule(resolveAlias(reactSym))) {\n                    markAliasSymbolAsReferenced(reactSym);\n                }\n            }\n            var targetAttributesType = getJsxElementAttributesType(node);\n            var nameTable = ts.createMap();\n            var sawSpreadedAny = false;\n            for (var i = node.attributes.length - 1; i >= 0; i--) {\n                if (node.attributes[i].kind === 250) {\n                    checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable);\n                }\n                else {\n                    ts.Debug.assert(node.attributes[i].kind === 251);\n                    var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable);\n                    if (isTypeAny(spreadType)) {\n                        sawSpreadedAny = true;\n                    }\n                }\n            }\n            if (targetAttributesType && !sawSpreadedAny) {\n                var targetProperties = getPropertiesOfType(targetAttributesType);\n                for (var i = 0; i < targetProperties.length; i++) {\n                    if (!(targetProperties[i].flags & 536870912) &&\n                        !nameTable[targetProperties[i].name]) {\n                        error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperties[i].name, typeToString(targetAttributesType));\n                    }\n                }\n            }\n        }\n        function checkJsxExpression(node) {\n            if (node.expression) {\n                return checkExpression(node.expression);\n            }\n            else {\n                return unknownType;\n            }\n        }\n        function getDeclarationKindFromSymbol(s) {\n            return s.valueDeclaration ? s.valueDeclaration.kind : 147;\n        }\n        function getDeclarationModifierFlagsFromSymbol(s) {\n            return s.valueDeclaration ? ts.getCombinedModifierFlags(s.valueDeclaration) : s.flags & 134217728 ? 4 | 32 : 0;\n        }\n        function getDeclarationNodeFlagsFromSymbol(s) {\n            return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : 0;\n        }\n        function checkClassPropertyAccess(node, left, type, prop) {\n          return true;//AndroidUIX Modify\n        }\n        function AndroidUIXIgnore_checkClassPropertyAccess(node, left, type, prop) {\n            var flags = getDeclarationModifierFlagsFromSymbol(prop);\n            var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop));\n            var errorNode = node.kind === 177 || node.kind === 223 ?\n                node.name :\n                node.right;\n            if (left.kind === 96) {\n                if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 149) {\n                    error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword);\n                    return false;\n                }\n                if (flags & 128) {\n                    error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(declaringClass));\n                    return false;\n                }\n            }\n            if (!(flags & 24)) {\n                return true;\n            }\n            if (flags & 8) {\n                var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));\n                if (!isNodeWithinClass(node, declaringClassDeclaration)) {\n                    error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass));\n                    return false;\n                }\n                return true;\n            }\n            if (left.kind === 96) {\n                return true;\n            }\n            var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) {\n                var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration));\n                return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined;\n            });\n            if (!enclosingClass) {\n                error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass));\n                return false;\n            }\n            if (flags & 32) {\n                return true;\n            }\n            if (type.flags & 16384 && type.isThisType) {\n                type = getConstraintOfTypeParameter(type);\n            }\n            if (!(getObjectFlags(getTargetType(type)) & 3 && hasBaseType(type, enclosingClass))) {\n                error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass));\n                return false;\n            }\n            return true;\n        }\n        function checkNonNullExpression(node) {\n            var type = checkExpression(node);\n            if (strictNullChecks) {\n                var kind = getFalsyFlags(type) & 6144;\n                if (kind) {\n                    error(node, kind & 2048 ? kind & 4096 ?\n                        ts.Diagnostics.Object_is_possibly_null_or_undefined :\n                        ts.Diagnostics.Object_is_possibly_undefined :\n                        ts.Diagnostics.Object_is_possibly_null);\n                }\n                return getNonNullableType(type);\n            }\n            return type;\n        }\n        function checkPropertyAccessExpression(node) {\n            return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name);\n        }\n        function checkQualifiedName(node) {\n            return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right);\n        }\n        function reportNonexistentProperty(propNode, containingType) {\n            var errorInfo;\n            if (containingType.flags & 65536 && !(containingType.flags & 8190)) {\n                for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) {\n                    var subtype = _a[_i];\n                    if (!getPropertyOfType(subtype, propNode.text)) {\n                        errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(subtype));\n                        break;\n                    }\n                }\n            }\n            errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(containingType));\n            diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(propNode, errorInfo));\n        }\n        function markPropertyAsReferenced(prop) {\n            if (prop &&\n                noUnusedIdentifiers &&\n                (prop.flags & 106500) &&\n                prop.valueDeclaration && (ts.getModifierFlags(prop.valueDeclaration) & 8)) {\n                if (prop.flags & 16777216) {\n                    getSymbolLinks(prop).target.isReferenced = true;\n                }\n                else {\n                    prop.isReferenced = true;\n                }\n            }\n        }\n        function checkPropertyAccessExpressionOrQualifiedName(node, left, right) {\n            var type = checkNonNullExpression(left);\n            if (isTypeAny(type) || type === silentNeverType) {\n                return type;\n            }\n            var apparentType = getApparentType(getWidenedType(type));\n            if (apparentType === unknownType || (type.flags & 16384 && isTypeAny(apparentType))) {\n                return apparentType;\n            }\n            var prop = getPropertyOfType(apparentType, right.text);\n            if (!prop) {\n                if (right.text && !checkAndReportErrorForExtendingInterface(node)) {\n                    reportNonexistentProperty(right, type.flags & 16384 && type.isThisType ? apparentType : type);\n                }\n                return unknownType;\n            }\n            markPropertyAsReferenced(prop);\n            getNodeLinks(node).resolvedSymbol = prop;\n            if (prop.parent && prop.parent.flags & 32) {\n                checkClassPropertyAccess(node, left, apparentType, prop);\n            }\n            var propType = getTypeOfSymbol(prop);\n            var assignmentKind = ts.getAssignmentTargetKind(node);\n            if (assignmentKind) {\n                if (isReferenceToReadonlyEntity(node, prop) || isReferenceThroughNamespaceImport(node)) {\n                    error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, right.text);\n                    return unknownType;\n                }\n            }\n            if (node.kind !== 177 || assignmentKind === 1 ||\n                !(prop.flags & (3 | 4 | 98304)) &&\n                    !(prop.flags & 8192 && propType.flags & 65536)) {\n                return propType;\n            }\n            var flowType = getFlowTypeOfReference(node, propType, true, undefined);\n            return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;\n        }\n        function isValidPropertyAccess(node, propertyName) {\n            var left = node.kind === 177\n                ? node.expression\n                : node.left;\n            var type = checkExpression(left);\n            if (type !== unknownType && !isTypeAny(type)) {\n                var prop = getPropertyOfType(getWidenedType(type), propertyName);\n                if (prop && prop.parent && prop.parent.flags & 32) {\n                    return checkClassPropertyAccess(node, left, type, prop);\n                }\n            }\n            return true;\n        }\n        function getForInVariableSymbol(node) {\n            var initializer = node.initializer;\n            if (initializer.kind === 224) {\n                var variable = initializer.declarations[0];\n                if (variable && !ts.isBindingPattern(variable.name)) {\n                    return getSymbolOfNode(variable);\n                }\n            }\n            else if (initializer.kind === 70) {\n                return getResolvedSymbol(initializer);\n            }\n            return undefined;\n        }\n        function hasNumericPropertyNames(type) {\n            return getIndexTypeOfType(type, 1) && !getIndexTypeOfType(type, 0);\n        }\n        function isForInVariableForNumericPropertyNames(expr) {\n            var e = ts.skipParentheses(expr);\n            if (e.kind === 70) {\n                var symbol = getResolvedSymbol(e);\n                if (symbol.flags & 3) {\n                    var child = expr;\n                    var node = expr.parent;\n                    while (node) {\n                        if (node.kind === 212 &&\n                            child === node.statement &&\n                            getForInVariableSymbol(node) === symbol &&\n                            hasNumericPropertyNames(getTypeOfExpression(node.expression))) {\n                            return true;\n                        }\n                        child = node;\n                        node = node.parent;\n                    }\n                }\n            }\n            return false;\n        }\n        function checkIndexedAccess(node) {\n            var objectType = checkNonNullExpression(node.expression);\n            var indexExpression = node.argumentExpression;\n            if (!indexExpression) {\n                var sourceFile = ts.getSourceFileOfNode(node);\n                if (node.parent.kind === 180 && node.parent.expression === node) {\n                    var start = ts.skipTrivia(sourceFile.text, node.expression.end);\n                    var end = node.end;\n                    grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead);\n                }\n                else {\n                    var start = node.end - \"]\".length;\n                    var end = node.end;\n                    grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected);\n                }\n                return unknownType;\n            }\n            var indexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : checkExpression(indexExpression);\n            if (objectType === unknownType || objectType === silentNeverType) {\n                return objectType;\n            }\n            if (isConstEnumObjectType(objectType) && indexExpression.kind !== 9) {\n                error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);\n                return unknownType;\n            }\n            return getIndexedAccessType(objectType, indexType, node);\n        }\n        function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) {\n            if (expressionType === unknownType) {\n                return false;\n            }\n            if (!ts.isWellKnownSymbolSyntactically(expression)) {\n                return false;\n            }\n            if ((expressionType.flags & 512) === 0) {\n                if (reportError) {\n                    error(expression, ts.Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, ts.getTextOfNode(expression));\n                }\n                return false;\n            }\n            var leftHandSide = expression.expression;\n            var leftHandSideSymbol = getResolvedSymbol(leftHandSide);\n            if (!leftHandSideSymbol) {\n                return false;\n            }\n            var globalESSymbol = getGlobalESSymbolConstructorSymbol();\n            if (!globalESSymbol) {\n                return false;\n            }\n            if (leftHandSideSymbol !== globalESSymbol) {\n                if (reportError) {\n                    error(leftHandSide, ts.Diagnostics.Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object);\n                }\n                return false;\n            }\n            return true;\n        }\n        function resolveUntypedCall(node) {\n            if (node.kind === 181) {\n                checkExpression(node.template);\n            }\n            else if (node.kind !== 145) {\n                ts.forEach(node.arguments, function (argument) {\n                    checkExpression(argument);\n                });\n            }\n            return anySignature;\n        }\n        function resolveErrorCall(node) {\n            resolveUntypedCall(node);\n            return unknownSignature;\n        }\n        function reorderCandidates(signatures, result) {\n            var lastParent;\n            var lastSymbol;\n            var cutoffIndex = 0;\n            var index;\n            var specializedIndex = -1;\n            var spliceIndex;\n            ts.Debug.assert(!result.length);\n            for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) {\n                var signature = signatures_2[_i];\n                var symbol = signature.declaration && getSymbolOfNode(signature.declaration);\n                var parent_8 = signature.declaration && signature.declaration.parent;\n                if (!lastSymbol || symbol === lastSymbol) {\n                    if (lastParent && parent_8 === lastParent) {\n                        index++;\n                    }\n                    else {\n                        lastParent = parent_8;\n                        index = cutoffIndex;\n                    }\n                }\n                else {\n                    index = cutoffIndex = result.length;\n                    lastParent = parent_8;\n                }\n                lastSymbol = symbol;\n                if (signature.hasLiteralTypes) {\n                    specializedIndex++;\n                    spliceIndex = specializedIndex;\n                    cutoffIndex++;\n                }\n                else {\n                    spliceIndex = index;\n                }\n                result.splice(spliceIndex, 0, signature);\n            }\n        }\n        function getSpreadArgumentIndex(args) {\n            for (var i = 0; i < args.length; i++) {\n                var arg = args[i];\n                if (arg && arg.kind === 196) {\n                    return i;\n                }\n            }\n            return -1;\n        }\n        function hasCorrectArity(node, args, signature, signatureHelpTrailingComma) {\n            if (signatureHelpTrailingComma === void 0) { signatureHelpTrailingComma = false; }\n            var argCount;\n            var typeArguments;\n            var callIsIncomplete;\n            var isDecorator;\n            var spreadArgIndex = -1;\n            if (node.kind === 181) {\n                var tagExpression = node;\n                argCount = args.length;\n                typeArguments = undefined;\n                if (tagExpression.template.kind === 194) {\n                    var templateExpression = tagExpression.template;\n                    var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans);\n                    ts.Debug.assert(lastSpan !== undefined);\n                    callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated;\n                }\n                else {\n                    var templateLiteral = tagExpression.template;\n                    ts.Debug.assert(templateLiteral.kind === 12);\n                    callIsIncomplete = !!templateLiteral.isUnterminated;\n                }\n            }\n            else if (node.kind === 145) {\n                isDecorator = true;\n                typeArguments = undefined;\n                argCount = getEffectiveArgumentCount(node, undefined, signature);\n            }\n            else {\n                var callExpression = node;\n                if (!callExpression.arguments) {\n                    ts.Debug.assert(callExpression.kind === 180);\n                    return signature.minArgumentCount === 0;\n                }\n                argCount = signatureHelpTrailingComma ? args.length + 1 : args.length;\n                callIsIncomplete = callExpression.arguments.end === callExpression.end;\n                typeArguments = callExpression.typeArguments;\n                spreadArgIndex = getSpreadArgumentIndex(args);\n            }\n            var hasRightNumberOfTypeArgs = !typeArguments ||\n                (signature.typeParameters && typeArguments.length === signature.typeParameters.length);\n            if (!hasRightNumberOfTypeArgs) {\n                return false;\n            }\n            if (spreadArgIndex >= 0) {\n                return isRestParameterIndex(signature, spreadArgIndex);\n            }\n            if (!signature.hasRestParameter && argCount > signature.parameters.length) {\n                return false;\n            }\n            var hasEnoughArguments = argCount >= signature.minArgumentCount;\n            return callIsIncomplete || hasEnoughArguments;\n        }\n        function getSingleCallSignature(type) {\n            if (type.flags & 32768) {\n                var resolved = resolveStructuredTypeMembers(type);\n                if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 &&\n                    resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {\n                    return resolved.callSignatures[0];\n                }\n            }\n            return undefined;\n        }\n        function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) {\n            var context = createInferenceContext(signature, true);\n            forEachMatchingParameterType(contextualSignature, signature, function (source, target) {\n                inferTypesWithContext(context, instantiateType(source, contextualMapper), target);\n            });\n            return getSignatureInstantiation(signature, getInferredTypes(context));\n        }\n        function inferTypeArguments(node, signature, args, excludeArgument, context) {\n            var typeParameters = signature.typeParameters;\n            var inferenceMapper = getInferenceMapper(context);\n            for (var i = 0; i < typeParameters.length; i++) {\n                if (!context.inferences[i].isFixed) {\n                    context.inferredTypes[i] = undefined;\n                }\n            }\n            if (context.failedTypeParameterIndex !== undefined && !context.inferences[context.failedTypeParameterIndex].isFixed) {\n                context.failedTypeParameterIndex = undefined;\n            }\n            var thisType = getThisTypeOfSignature(signature);\n            if (thisType) {\n                var thisArgumentNode = getThisArgumentOfCall(node);\n                var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType;\n                inferTypesWithContext(context, thisArgumentType, thisType);\n            }\n            var argCount = getEffectiveArgumentCount(node, args, signature);\n            for (var i = 0; i < argCount; i++) {\n                var arg = getEffectiveArgument(node, args, i);\n                if (arg === undefined || arg.kind !== 198) {\n                    var paramType = getTypeAtPosition(signature, i);\n                    var argType = getEffectiveArgumentType(node, i);\n                    if (argType === undefined) {\n                        var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper;\n                        argType = checkExpressionWithContextualType(arg, paramType, mapper);\n                    }\n                    inferTypesWithContext(context, argType, paramType);\n                }\n            }\n            if (excludeArgument) {\n                for (var i = 0; i < argCount; i++) {\n                    if (excludeArgument[i] === false) {\n                        var arg = args[i];\n                        var paramType = getTypeAtPosition(signature, i);\n                        inferTypesWithContext(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType);\n                    }\n                }\n            }\n            getInferredTypes(context);\n        }\n        function checkTypeArguments(signature, typeArgumentNodes, typeArgumentTypes, reportErrors, headMessage) {\n            var typeParameters = signature.typeParameters;\n            var typeArgumentsAreAssignable = true;\n            var mapper;\n            for (var i = 0; i < typeParameters.length; i++) {\n                if (typeArgumentsAreAssignable) {\n                    var constraint = getConstraintOfTypeParameter(typeParameters[i]);\n                    if (constraint) {\n                        var errorInfo = void 0;\n                        var typeArgumentHeadMessage = ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1;\n                        if (reportErrors && headMessage) {\n                            errorInfo = ts.chainDiagnosticMessages(errorInfo, typeArgumentHeadMessage);\n                            typeArgumentHeadMessage = headMessage;\n                        }\n                        if (!mapper) {\n                            mapper = createTypeMapper(typeParameters, typeArgumentTypes);\n                        }\n                        var typeArgument = typeArgumentTypes[i];\n                        typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), reportErrors ? typeArgumentNodes[i] : undefined, typeArgumentHeadMessage, errorInfo);\n                    }\n                }\n            }\n            return typeArgumentsAreAssignable;\n        }\n        function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) {\n            var thisType = getThisTypeOfSignature(signature);\n            if (thisType && thisType !== voidType && node.kind !== 180) {\n                var thisArgumentNode = getThisArgumentOfCall(node);\n                var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType;\n                var errorNode = reportErrors ? (thisArgumentNode || node) : undefined;\n                var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1;\n                if (!checkTypeRelatedTo(thisArgumentType, getThisTypeOfSignature(signature), relation, errorNode, headMessage_1)) {\n                    return false;\n                }\n            }\n            var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1;\n            var argCount = getEffectiveArgumentCount(node, args, signature);\n            for (var i = 0; i < argCount; i++) {\n                var arg = getEffectiveArgument(node, args, i);\n                if (arg === undefined || arg.kind !== 198) {\n                    var paramType = getTypeAtPosition(signature, i);\n                    var argType = getEffectiveArgumentType(node, i);\n                    if (argType === undefined) {\n                        argType = checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined);\n                    }\n                    var errorNode = reportErrors ? getEffectiveArgumentErrorNode(node, i, arg) : undefined;\n                    if (!checkTypeRelatedTo(argType, paramType, relation, errorNode, headMessage)) {\n                        return false;\n                    }\n                }\n            }\n            return true;\n        }\n        function getThisArgumentOfCall(node) {\n            if (node.kind === 179) {\n                var callee = node.expression;\n                if (callee.kind === 177) {\n                    return callee.expression;\n                }\n                else if (callee.kind === 178) {\n                    return callee.expression;\n                }\n            }\n        }\n        function getEffectiveCallArguments(node) {\n            var args;\n            if (node.kind === 181) {\n                var template = node.template;\n                args = [undefined];\n                if (template.kind === 194) {\n                    ts.forEach(template.templateSpans, function (span) {\n                        args.push(span.expression);\n                    });\n                }\n            }\n            else if (node.kind === 145) {\n                return undefined;\n            }\n            else {\n                args = node.arguments || emptyArray;\n            }\n            return args;\n        }\n        function getEffectiveArgumentCount(node, args, signature) {\n            if (node.kind === 145) {\n                switch (node.parent.kind) {\n                    case 226:\n                    case 197:\n                        return 1;\n                    case 147:\n                        return 2;\n                    case 149:\n                    case 151:\n                    case 152:\n                        if (languageVersion === 0) {\n                            return 2;\n                        }\n                        return signature.parameters.length >= 3 ? 3 : 2;\n                    case 144:\n                        return 3;\n                }\n            }\n            else {\n                return args.length;\n            }\n        }\n        function getEffectiveDecoratorFirstArgumentType(node) {\n            if (node.kind === 226) {\n                var classSymbol = getSymbolOfNode(node);\n                return getTypeOfSymbol(classSymbol);\n            }\n            if (node.kind === 144) {\n                node = node.parent;\n                if (node.kind === 150) {\n                    var classSymbol = getSymbolOfNode(node);\n                    return getTypeOfSymbol(classSymbol);\n                }\n            }\n            if (node.kind === 147 ||\n                node.kind === 149 ||\n                node.kind === 151 ||\n                node.kind === 152) {\n                return getParentTypeOfClassElement(node);\n            }\n            ts.Debug.fail(\"Unsupported decorator target.\");\n            return unknownType;\n        }\n        function getEffectiveDecoratorSecondArgumentType(node) {\n            if (node.kind === 226) {\n                ts.Debug.fail(\"Class decorators should not have a second synthetic argument.\");\n                return unknownType;\n            }\n            if (node.kind === 144) {\n                node = node.parent;\n                if (node.kind === 150) {\n                    return anyType;\n                }\n            }\n            if (node.kind === 147 ||\n                node.kind === 149 ||\n                node.kind === 151 ||\n                node.kind === 152) {\n                var element = node;\n                switch (element.name.kind) {\n                    case 70:\n                    case 8:\n                    case 9:\n                        return getLiteralTypeForText(32, element.name.text);\n                    case 142:\n                        var nameType = checkComputedPropertyName(element.name);\n                        if (isTypeOfKind(nameType, 512)) {\n                            return nameType;\n                        }\n                        else {\n                            return stringType;\n                        }\n                    default:\n                        ts.Debug.fail(\"Unsupported property name.\");\n                        return unknownType;\n                }\n            }\n            ts.Debug.fail(\"Unsupported decorator target.\");\n            return unknownType;\n        }\n        function getEffectiveDecoratorThirdArgumentType(node) {\n            if (node.kind === 226) {\n                ts.Debug.fail(\"Class decorators should not have a third synthetic argument.\");\n                return unknownType;\n            }\n            if (node.kind === 144) {\n                return numberType;\n            }\n            if (node.kind === 147) {\n                ts.Debug.fail(\"Property decorators should not have a third synthetic argument.\");\n                return unknownType;\n            }\n            if (node.kind === 149 ||\n                node.kind === 151 ||\n                node.kind === 152) {\n                var propertyType = getTypeOfNode(node);\n                return createTypedPropertyDescriptorType(propertyType);\n            }\n            ts.Debug.fail(\"Unsupported decorator target.\");\n            return unknownType;\n        }\n        function getEffectiveDecoratorArgumentType(node, argIndex) {\n            if (argIndex === 0) {\n                return getEffectiveDecoratorFirstArgumentType(node.parent);\n            }\n            else if (argIndex === 1) {\n                return getEffectiveDecoratorSecondArgumentType(node.parent);\n            }\n            else if (argIndex === 2) {\n                return getEffectiveDecoratorThirdArgumentType(node.parent);\n            }\n            ts.Debug.fail(\"Decorators should not have a fourth synthetic argument.\");\n            return unknownType;\n        }\n        function getEffectiveArgumentType(node, argIndex) {\n            if (node.kind === 145) {\n                return getEffectiveDecoratorArgumentType(node, argIndex);\n            }\n            else if (argIndex === 0 && node.kind === 181) {\n                return getGlobalTemplateStringsArrayType();\n            }\n            return undefined;\n        }\n        function getEffectiveArgument(node, args, argIndex) {\n            if (node.kind === 145 ||\n                (argIndex === 0 && node.kind === 181)) {\n                return undefined;\n            }\n            return args[argIndex];\n        }\n        function getEffectiveArgumentErrorNode(node, argIndex, arg) {\n            if (node.kind === 145) {\n                return node.expression;\n            }\n            else if (argIndex === 0 && node.kind === 181) {\n                return node.template;\n            }\n            else {\n                return arg;\n            }\n        }\n        function resolveCall(node, signatures, candidatesOutArray, headMessage) {\n            var isTaggedTemplate = node.kind === 181;\n            var isDecorator = node.kind === 145;\n            var typeArguments;\n            if (!isTaggedTemplate && !isDecorator) {\n                typeArguments = node.typeArguments;\n                if (node.expression.kind !== 96) {\n                    ts.forEach(typeArguments, checkSourceElement);\n                }\n            }\n            var candidates = candidatesOutArray || [];\n            reorderCandidates(signatures, candidates);\n            if (!candidates.length) {\n                reportError(ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target);\n                return resolveErrorCall(node);\n            }\n            var args = getEffectiveCallArguments(node);\n            var excludeArgument;\n            if (!isDecorator) {\n                for (var i = isTaggedTemplate ? 1 : 0; i < args.length; i++) {\n                    if (isContextSensitive(args[i])) {\n                        if (!excludeArgument) {\n                            excludeArgument = new Array(args.length);\n                        }\n                        excludeArgument[i] = true;\n                    }\n                }\n            }\n            var candidateForArgumentError;\n            var candidateForTypeArgumentError;\n            var resultOfFailedInference;\n            var result;\n            var signatureHelpTrailingComma = candidatesOutArray && node.kind === 179 && node.arguments.hasTrailingComma;\n            if (candidates.length > 1) {\n                result = chooseOverload(candidates, subtypeRelation, signatureHelpTrailingComma);\n            }\n            if (!result) {\n                candidateForArgumentError = undefined;\n                candidateForTypeArgumentError = undefined;\n                resultOfFailedInference = undefined;\n                result = chooseOverload(candidates, assignableRelation, signatureHelpTrailingComma);\n            }\n            if (result) {\n                return result;\n            }\n            if (candidateForArgumentError) {\n                checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, undefined, true);\n            }\n            else if (candidateForTypeArgumentError) {\n                if (!isTaggedTemplate && !isDecorator && typeArguments) {\n                    var typeArguments_2 = node.typeArguments;\n                    checkTypeArguments(candidateForTypeArgumentError, typeArguments_2, ts.map(typeArguments_2, getTypeFromTypeNode), true, headMessage);\n                }\n                else {\n                    ts.Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0);\n                    var failedTypeParameter = candidateForTypeArgumentError.typeParameters[resultOfFailedInference.failedTypeParameterIndex];\n                    var inferenceCandidates = getInferenceCandidates(resultOfFailedInference, resultOfFailedInference.failedTypeParameterIndex);\n                    var diagnosticChainHead = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly, typeToString(failedTypeParameter));\n                    if (headMessage) {\n                        diagnosticChainHead = ts.chainDiagnosticMessages(diagnosticChainHead, headMessage);\n                    }\n                    reportNoCommonSupertypeError(inferenceCandidates, node.expression || node.tag, diagnosticChainHead);\n                }\n            }\n            else {\n                reportError(ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target);\n            }\n            if (!produceDiagnostics) {\n                for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) {\n                    var candidate = candidates_1[_i];\n                    if (hasCorrectArity(node, args, candidate)) {\n                        if (candidate.typeParameters && typeArguments) {\n                            candidate = getSignatureInstantiation(candidate, ts.map(typeArguments, getTypeFromTypeNode));\n                        }\n                        return candidate;\n                    }\n                }\n            }\n            return resolveErrorCall(node);\n            function reportError(message, arg0, arg1, arg2) {\n                var errorInfo;\n                errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2);\n                if (headMessage) {\n                    errorInfo = ts.chainDiagnosticMessages(errorInfo, headMessage);\n                }\n                diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo));\n            }\n            function chooseOverload(candidates, relation, signatureHelpTrailingComma) {\n                if (signatureHelpTrailingComma === void 0) { signatureHelpTrailingComma = false; }\n                for (var _i = 0, candidates_2 = candidates; _i < candidates_2.length; _i++) {\n                    var originalCandidate = candidates_2[_i];\n                    if (!hasCorrectArity(node, args, originalCandidate, signatureHelpTrailingComma)) {\n                        continue;\n                    }\n                    var candidate = void 0;\n                    var typeArgumentsAreValid = void 0;\n                    var inferenceContext = originalCandidate.typeParameters\n                        ? createInferenceContext(originalCandidate, false)\n                        : undefined;\n                    while (true) {\n                        candidate = originalCandidate;\n                        if (candidate.typeParameters) {\n                            var typeArgumentTypes = void 0;\n                            if (typeArguments) {\n                                typeArgumentTypes = ts.map(typeArguments, getTypeFromTypeNode);\n                                typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false);\n                            }\n                            else {\n                                inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext);\n                                typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined;\n                                typeArgumentTypes = inferenceContext.inferredTypes;\n                            }\n                            if (!typeArgumentsAreValid) {\n                                break;\n                            }\n                            candidate = getSignatureInstantiation(candidate, typeArgumentTypes);\n                        }\n                        if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) {\n                            break;\n                        }\n                        var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1;\n                        if (index < 0) {\n                            return candidate;\n                        }\n                        excludeArgument[index] = false;\n                    }\n                    if (originalCandidate.typeParameters) {\n                        var instantiatedCandidate = candidate;\n                        if (typeArgumentsAreValid) {\n                            candidateForArgumentError = instantiatedCandidate;\n                        }\n                        else {\n                            candidateForTypeArgumentError = originalCandidate;\n                            if (!typeArguments) {\n                                resultOfFailedInference = inferenceContext;\n                            }\n                        }\n                    }\n                    else {\n                        ts.Debug.assert(originalCandidate === candidate);\n                        candidateForArgumentError = originalCandidate;\n                    }\n                }\n                return undefined;\n            }\n        }\n        function resolveCallExpression(node, candidatesOutArray) {\n            if (node.expression.kind === 96) {\n                var superType = checkSuperExpression(node.expression);\n                if (superType !== unknownType) {\n                    var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node));\n                    if (baseTypeNode) {\n                        var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments);\n                        return resolveCall(node, baseConstructors, candidatesOutArray);\n                    }\n                }\n                return resolveUntypedCall(node);\n            }\n            var funcType = checkNonNullExpression(node.expression);\n            if (funcType === silentNeverType) {\n                return silentNeverSignature;\n            }\n            var apparentType = getApparentType(funcType);\n            if (apparentType === unknownType) {\n                return resolveErrorCall(node);\n            }\n            var callSignatures = getSignaturesOfType(apparentType, 0);\n            var constructSignatures = getSignaturesOfType(apparentType, 1);\n            if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, constructSignatures.length)) {\n                if (funcType !== unknownType && node.typeArguments) {\n                    error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);\n                }\n                return resolveUntypedCall(node);\n            }\n            if (!callSignatures.length) {\n                if (constructSignatures.length) {\n                    error(node, ts.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));\n                }\n                else {\n                    error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType));\n                }\n                return resolveErrorCall(node);\n            }\n            return resolveCall(node, callSignatures, candidatesOutArray);\n        }\n        function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {\n            if (isTypeAny(funcType)) {\n                return true;\n            }\n            if (isTypeAny(apparentFuncType) && funcType.flags & 16384) {\n                return true;\n            }\n            if (!numCallSignatures && !numConstructSignatures) {\n                if (funcType.flags & 65536) {\n                    return false;\n                }\n                return isTypeAssignableTo(funcType, globalFunctionType);\n            }\n            return false;\n        }\n        function resolveNewExpression(node, candidatesOutArray) {\n            if (node.arguments && languageVersion < 1) {\n                var spreadIndex = getSpreadArgumentIndex(node.arguments);\n                if (spreadIndex >= 0) {\n                    error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher);\n                }\n            }\n            var expressionType = checkNonNullExpression(node.expression);\n            if (expressionType === silentNeverType) {\n                return silentNeverSignature;\n            }\n            expressionType = getApparentType(expressionType);\n            if (expressionType === unknownType) {\n                return resolveErrorCall(node);\n            }\n            var valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol);\n            if (valueDecl && ts.getModifierFlags(valueDecl) & 128) {\n                error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name));\n                return resolveErrorCall(node);\n            }\n            if (isTypeAny(expressionType)) {\n                if (node.typeArguments) {\n                    error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);\n                }\n                return resolveUntypedCall(node);\n            }\n            var constructSignatures = getSignaturesOfType(expressionType, 1);\n            if (constructSignatures.length) {\n                if (!isConstructorAccessible(node, constructSignatures[0])) {\n                    return resolveErrorCall(node);\n                }\n                return resolveCall(node, constructSignatures, candidatesOutArray);\n            }\n            var callSignatures = getSignaturesOfType(expressionType, 0);\n            if (callSignatures.length) {\n                var signature = resolveCall(node, callSignatures, candidatesOutArray);\n                if (getReturnTypeOfSignature(signature) !== voidType) {\n                    error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword);\n                }\n                if (getThisTypeOfSignature(signature) === voidType) {\n                    error(node, ts.Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void);\n                }\n                return signature;\n            }\n            error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature);\n            return resolveErrorCall(node);\n        }\n        function isConstructorAccessible(node, signature) {\n            if (!signature || !signature.declaration) {\n                return true;\n            }\n            var declaration = signature.declaration;\n            var modifiers = ts.getModifierFlags(declaration);\n            if (!(modifiers & 24)) {\n                return true;\n            }\n            var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(declaration.parent.symbol);\n            var declaringClass = getDeclaredTypeOfSymbol(declaration.parent.symbol);\n            if (!isNodeWithinClass(node, declaringClassDeclaration)) {\n                var containingClass = ts.getContainingClass(node);\n                if (containingClass) {\n                    var containingType = getTypeOfNode(containingClass);\n                    var baseTypes = getBaseTypes(containingType);\n                    if (baseTypes.length) {\n                        var baseType = baseTypes[0];\n                        if (modifiers & 16 &&\n                            baseType.symbol === declaration.parent.symbol) {\n                            return true;\n                        }\n                    }\n                }\n                if (modifiers & 8) {\n                    error(node, ts.Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));\n                }\n                if (modifiers & 16) {\n                    error(node, ts.Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));\n                }\n                return false;\n            }\n            return true;\n        }\n        function resolveTaggedTemplateExpression(node, candidatesOutArray) {\n            var tagType = checkExpression(node.tag);\n            var apparentType = getApparentType(tagType);\n            if (apparentType === unknownType) {\n                return resolveErrorCall(node);\n            }\n            var callSignatures = getSignaturesOfType(apparentType, 0);\n            var constructSignatures = getSignaturesOfType(apparentType, 1);\n            if (isUntypedFunctionCall(tagType, apparentType, callSignatures.length, constructSignatures.length)) {\n                return resolveUntypedCall(node);\n            }\n            if (!callSignatures.length) {\n                error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType));\n                return resolveErrorCall(node);\n            }\n            return resolveCall(node, callSignatures, candidatesOutArray);\n        }\n        function getDiagnosticHeadMessageForDecoratorResolution(node) {\n            switch (node.parent.kind) {\n                case 226:\n                case 197:\n                    return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression;\n                case 144:\n                    return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression;\n                case 147:\n                    return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression;\n                case 149:\n                case 151:\n                case 152:\n                    return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression;\n            }\n        }\n        function resolveDecorator(node, candidatesOutArray) {\n            var funcType = checkExpression(node.expression);\n            var apparentType = getApparentType(funcType);\n            if (apparentType === unknownType) {\n                return resolveErrorCall(node);\n            }\n            var callSignatures = getSignaturesOfType(apparentType, 0);\n            var constructSignatures = getSignaturesOfType(apparentType, 1);\n            if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, constructSignatures.length)) {\n                return resolveUntypedCall(node);\n            }\n            var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);\n            if (!callSignatures.length) {\n                var errorInfo = void 0;\n                errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType));\n                errorInfo = ts.chainDiagnosticMessages(errorInfo, headMessage);\n                diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo));\n                return resolveErrorCall(node);\n            }\n            return resolveCall(node, callSignatures, candidatesOutArray, headMessage);\n        }\n        function resolveSignature(node, candidatesOutArray) {\n            switch (node.kind) {\n                case 179:\n                    return resolveCallExpression(node, candidatesOutArray);\n                case 180:\n                    return resolveNewExpression(node, candidatesOutArray);\n                case 181:\n                    return resolveTaggedTemplateExpression(node, candidatesOutArray);\n                case 145:\n                    return resolveDecorator(node, candidatesOutArray);\n            }\n            ts.Debug.fail(\"Branch in 'resolveSignature' should be unreachable.\");\n        }\n        function getResolvedSignature(node, candidatesOutArray) {\n            var links = getNodeLinks(node);\n            var cached = links.resolvedSignature;\n            if (cached && cached !== resolvingSignature && !candidatesOutArray) {\n                return cached;\n            }\n            links.resolvedSignature = resolvingSignature;\n            var result = resolveSignature(node, candidatesOutArray);\n            links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached;\n            return result;\n        }\n        function getResolvedOrAnySignature(node) {\n            return getNodeLinks(node).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(node);\n        }\n        function getInferredClassType(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.inferredClassType) {\n                links.inferredClassType = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, undefined, undefined);\n            }\n            return links.inferredClassType;\n        }\n        function checkCallExpression(node) {\n            checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments);\n            var signature = getResolvedSignature(node);\n            if (node.expression.kind === 96) {\n                return voidType;\n            }\n            if (node.kind === 180) {\n                var declaration = signature.declaration;\n                if (declaration &&\n                    declaration.kind !== 150 &&\n                    declaration.kind !== 154 &&\n                    declaration.kind !== 159 &&\n                    !ts.isJSDocConstructSignature(declaration)) {\n                    var funcSymbol = node.expression.kind === 70 ?\n                        getResolvedSymbol(node.expression) :\n                        checkExpression(node.expression).symbol;\n                    if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16 || ts.isDeclarationOfFunctionExpression(funcSymbol))) {\n                        return getInferredClassType(funcSymbol);\n                    }\n                    else if (compilerOptions.noImplicitAny) {\n                        error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);\n                    }\n                    return anyType;\n                }\n            }\n            if (ts.isInJavaScriptFile(node) && isCommonJsRequire(node)) {\n                return resolveExternalModuleTypeByLiteral(node.arguments[0]);\n            }\n            return getReturnTypeOfSignature(signature);\n        }\n        function isCommonJsRequire(node) {\n            if (!ts.isRequireCall(node, true)) {\n                return false;\n            }\n            var resolvedRequire = resolveName(node.expression, node.expression.text, 107455, undefined, undefined);\n            if (!resolvedRequire) {\n                return true;\n            }\n            if (resolvedRequire.flags & 8388608) {\n                return false;\n            }\n            var targetDeclarationKind = resolvedRequire.flags & 16\n                ? 225\n                : resolvedRequire.flags & 3\n                    ? 223\n                    : 0;\n            if (targetDeclarationKind !== 0) {\n                var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind);\n                return ts.isInAmbientContext(decl);\n            }\n            return false;\n        }\n        function checkTaggedTemplateExpression(node) {\n            return getReturnTypeOfSignature(getResolvedSignature(node));\n        }\n        function checkAssertion(node) {\n            var exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(checkExpression(node.expression)));\n            checkSourceElement(node.type);\n            var targetType = getTypeFromTypeNode(node.type);\n            if (produceDiagnostics && targetType !== unknownType) {\n                var widenedType = getWidenedType(exprType);\n                if (!isTypeComparableTo(targetType, widenedType)) {\n                    checkTypeComparableTo(exprType, targetType, node, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1);\n                }\n            }\n            return targetType;\n        }\n        function checkNonNullAssertion(node) {\n            return getNonNullableType(checkExpression(node.expression));\n        }\n        function getTypeOfParameter(symbol) {\n            var type = getTypeOfSymbol(symbol);\n            if (strictNullChecks) {\n                var declaration = symbol.valueDeclaration;\n                if (declaration && declaration.initializer) {\n                    return includeFalsyTypes(type, 2048);\n                }\n            }\n            return type;\n        }\n        function getTypeAtPosition(signature, pos) {\n            return signature.hasRestParameter ?\n                pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) :\n                pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType;\n        }\n        function assignContextualParameterTypes(signature, context, mapper) {\n            var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0);\n            if (isInferentialContext(mapper)) {\n                for (var i = 0; i < len; i++) {\n                    var declaration = signature.parameters[i].valueDeclaration;\n                    if (declaration.type) {\n                        inferTypesWithContext(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i));\n                    }\n                }\n            }\n            if (context.thisParameter) {\n                var parameter = signature.thisParameter;\n                if (!parameter || parameter.valueDeclaration && !parameter.valueDeclaration.type) {\n                    if (!parameter) {\n                        signature.thisParameter = createTransientSymbol(context.thisParameter, undefined);\n                    }\n                    assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper);\n                }\n            }\n            for (var i = 0; i < len; i++) {\n                var parameter = signature.parameters[i];\n                if (!parameter.valueDeclaration.type) {\n                    var contextualParameterType = getTypeAtPosition(context, i);\n                    assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);\n                }\n            }\n            if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) {\n                var parameter = ts.lastOrUndefined(signature.parameters);\n                if (!parameter.valueDeclaration.type) {\n                    var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters));\n                    assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);\n                }\n            }\n        }\n        function assignBindingElementTypes(node) {\n            if (ts.isBindingPattern(node.name)) {\n                for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        if (element.name.kind === 70) {\n                            getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element);\n                        }\n                        assignBindingElementTypes(element);\n                    }\n                }\n            }\n        }\n        function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) {\n            var links = getSymbolLinks(parameter);\n            if (!links.type) {\n                links.type = instantiateType(contextualType, mapper);\n                if (links.type === emptyObjectType &&\n                    (parameter.valueDeclaration.name.kind === 172 ||\n                        parameter.valueDeclaration.name.kind === 173)) {\n                    links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name);\n                }\n                assignBindingElementTypes(parameter.valueDeclaration);\n            }\n            else if (isInferentialContext(mapper)) {\n                inferTypesWithContext(mapper.context, links.type, instantiateType(contextualType, mapper));\n            }\n        }\n        function getReturnTypeFromJSDocComment(func) {\n            var returnTag = ts.getJSDocReturnTag(func);\n            if (returnTag && returnTag.typeExpression) {\n                return getTypeFromTypeNode(returnTag.typeExpression.type);\n            }\n            return undefined;\n        }\n        function createPromiseType(promisedType) {\n            var globalPromiseType = getGlobalPromiseType();\n            if (globalPromiseType !== emptyGenericType) {\n                promisedType = getAwaitedType(promisedType);\n                return createTypeReference(globalPromiseType, [promisedType]);\n            }\n            return emptyObjectType;\n        }\n        function createPromiseReturnType(func, promisedType) {\n            var promiseType = createPromiseType(promisedType);\n            if (promiseType === emptyObjectType) {\n                error(func, ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option);\n                return unknownType;\n            }\n            return promiseType;\n        }\n        function getReturnTypeFromBody(func, contextualMapper) {\n            var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);\n            if (!func.body) {\n                return unknownType;\n            }\n            var isAsync = ts.isAsyncFunctionLike(func);\n            var type;\n            if (func.body.kind !== 204) {\n                type = checkExpressionCached(func.body, contextualMapper);\n                if (isAsync) {\n                    type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member);\n                }\n            }\n            else {\n                var types = void 0;\n                var funcIsGenerator = !!func.asteriskToken;\n                if (funcIsGenerator) {\n                    types = checkAndAggregateYieldOperandTypes(func, contextualMapper);\n                    if (types.length === 0) {\n                        var iterableIteratorAny = createIterableIteratorType(anyType);\n                        if (compilerOptions.noImplicitAny) {\n                            error(func.asteriskToken, ts.Diagnostics.Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type, typeToString(iterableIteratorAny));\n                        }\n                        return iterableIteratorAny;\n                    }\n                }\n                else {\n                    types = checkAndAggregateReturnExpressionTypes(func, contextualMapper);\n                    if (!types) {\n                        return isAsync ? createPromiseReturnType(func, neverType) : neverType;\n                    }\n                    if (types.length === 0) {\n                        return isAsync ? createPromiseReturnType(func, voidType) : voidType;\n                    }\n                }\n                type = getUnionType(types, true);\n                if (funcIsGenerator) {\n                    type = createIterableIteratorType(type);\n                }\n            }\n            if (!contextualSignature) {\n                reportErrorsFromWidening(func, type);\n            }\n            if (isUnitType(type) &&\n                !(contextualSignature &&\n                    isLiteralContextualType(contextualSignature === getSignatureFromDeclaration(func) ? type : getReturnTypeOfSignature(contextualSignature)))) {\n                type = getWidenedLiteralType(type);\n            }\n            var widenedType = getWidenedType(type);\n            return isAsync ? createPromiseReturnType(func, widenedType) : widenedType;\n        }\n        function checkAndAggregateYieldOperandTypes(func, contextualMapper) {\n            var aggregatedTypes = [];\n            ts.forEachYieldExpression(func.body, function (yieldExpression) {\n                var expr = yieldExpression.expression;\n                if (expr) {\n                    var type = checkExpressionCached(expr, contextualMapper);\n                    if (yieldExpression.asteriskToken) {\n                        type = checkElementTypeOfIterable(type, yieldExpression.expression);\n                    }\n                    if (!ts.contains(aggregatedTypes, type)) {\n                        aggregatedTypes.push(type);\n                    }\n                }\n            });\n            return aggregatedTypes;\n        }\n        function isExhaustiveSwitchStatement(node) {\n            if (!node.possiblyExhaustive) {\n                return false;\n            }\n            var type = getTypeOfExpression(node.expression);\n            if (!isLiteralType(type)) {\n                return false;\n            }\n            var switchTypes = getSwitchClauseTypes(node);\n            if (!switchTypes.length) {\n                return false;\n            }\n            return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes);\n        }\n        function functionHasImplicitReturn(func) {\n            if (!(func.flags & 128)) {\n                return false;\n            }\n            var lastStatement = ts.lastOrUndefined(func.body.statements);\n            if (lastStatement && lastStatement.kind === 218 && isExhaustiveSwitchStatement(lastStatement)) {\n                return false;\n            }\n            return true;\n        }\n        function checkAndAggregateReturnExpressionTypes(func, contextualMapper) {\n            var isAsync = ts.isAsyncFunctionLike(func);\n            var aggregatedTypes = [];\n            var hasReturnWithNoExpression = functionHasImplicitReturn(func);\n            var hasReturnOfTypeNever = false;\n            ts.forEachReturnStatement(func.body, function (returnStatement) {\n                var expr = returnStatement.expression;\n                if (expr) {\n                    var type = checkExpressionCached(expr, contextualMapper);\n                    if (isAsync) {\n                        type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member);\n                    }\n                    if (type.flags & 8192) {\n                        hasReturnOfTypeNever = true;\n                    }\n                    else if (!ts.contains(aggregatedTypes, type)) {\n                        aggregatedTypes.push(type);\n                    }\n                }\n                else {\n                    hasReturnWithNoExpression = true;\n                }\n            });\n            if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever ||\n                func.kind === 184 || func.kind === 185)) {\n                return undefined;\n            }\n            if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) {\n                if (!ts.contains(aggregatedTypes, undefinedType)) {\n                    aggregatedTypes.push(undefinedType);\n                }\n            }\n            return aggregatedTypes;\n        }\n        function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {\n            if (!produceDiagnostics) {\n                return;\n            }\n            if (returnType && maybeTypeOfKind(returnType, 1 | 1024)) {\n                return;\n            }\n            if (ts.nodeIsMissing(func.body) || func.body.kind !== 204 || !functionHasImplicitReturn(func)) {\n                return;\n            }\n            var hasExplicitReturn = func.flags & 256;\n            if (returnType && returnType.flags & 8192) {\n                error(func.type, ts.Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);\n            }\n            else if (returnType && !hasExplicitReturn) {\n                error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);\n            }\n            else if (returnType && strictNullChecks && !isTypeAssignableTo(undefinedType, returnType)) {\n                error(func.type, ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);\n            }\n            else if (compilerOptions.noImplicitReturns) {\n                if (!returnType) {\n                    if (!hasExplicitReturn) {\n                        return;\n                    }\n                    var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func));\n                    if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) {\n                        return;\n                    }\n                }\n                error(func.type || func, ts.Diagnostics.Not_all_code_paths_return_a_value);\n            }\n        }\n        function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) {\n            ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node));\n            var hasGrammarError = checkGrammarFunctionLikeDeclaration(node);\n            if (!hasGrammarError && node.kind === 184) {\n                checkGrammarForGenerator(node);\n            }\n            if (contextualMapper === identityMapper && isContextSensitive(node)) {\n                checkNodeDeferred(node);\n                return anyFunctionType;\n            }\n            var links = getNodeLinks(node);\n            var type = getTypeOfSymbol(node.symbol);\n            var contextSensitive = isContextSensitive(node);\n            var mightFixTypeParameters = contextSensitive && isInferentialContext(contextualMapper);\n            if (mightFixTypeParameters || !(links.flags & 1024)) {\n                var contextualSignature = getContextualSignature(node);\n                var contextChecked = !!(links.flags & 1024);\n                if (mightFixTypeParameters || !contextChecked) {\n                    links.flags |= 1024;\n                    if (contextualSignature) {\n                        var signature = getSignaturesOfType(type, 0)[0];\n                        if (contextSensitive) {\n                            assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);\n                        }\n                        if (mightFixTypeParameters || !node.type && !signature.resolvedReturnType) {\n                            var returnType = getReturnTypeFromBody(node, contextualMapper);\n                            if (!signature.resolvedReturnType) {\n                                signature.resolvedReturnType = returnType;\n                            }\n                        }\n                    }\n                    if (!contextChecked) {\n                        checkSignatureDeclaration(node);\n                        checkNodeDeferred(node);\n                    }\n                }\n            }\n            if (produceDiagnostics && node.kind !== 149) {\n                checkCollisionWithCapturedSuperVariable(node, node.name);\n                checkCollisionWithCapturedThisVariable(node, node.name);\n            }\n            return type;\n        }\n        function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) {\n            ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node));\n            var isAsync = ts.isAsyncFunctionLike(node);\n            var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type));\n            if (!node.asteriskToken) {\n                checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType);\n            }\n            if (node.body) {\n                if (!node.type) {\n                    getReturnTypeOfSignature(getSignatureFromDeclaration(node));\n                }\n                if (node.body.kind === 204) {\n                    checkSourceElement(node.body);\n                }\n                else {\n                    var exprType = checkExpression(node.body);\n                    if (returnOrPromisedType) {\n                        if (isAsync) {\n                            var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member);\n                            checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body);\n                        }\n                        else {\n                            checkTypeAssignableTo(exprType, returnOrPromisedType, node.body);\n                        }\n                    }\n                }\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkArithmeticOperandType(operand, type, diagnostic) {\n            if (!isTypeAnyOrAllConstituentTypesHaveKind(type, 340)) {\n                error(operand, diagnostic);\n                return false;\n            }\n            return true;\n        }\n        function isReadonlySymbol(symbol) {\n            return symbol.isReadonly ||\n                symbol.flags & 4 && (getDeclarationModifierFlagsFromSymbol(symbol) & 64) !== 0 ||\n                symbol.flags & 3 && (getDeclarationNodeFlagsFromSymbol(symbol) & 2) !== 0 ||\n                symbol.flags & 98304 && !(symbol.flags & 65536) ||\n                (symbol.flags & 8) !== 0;\n        }\n        function isReferenceToReadonlyEntity(expr, symbol) {\n            if (isReadonlySymbol(symbol)) {\n                if (symbol.flags & 4 &&\n                    (expr.kind === 177 || expr.kind === 178) &&\n                    expr.expression.kind === 98) {\n                    var func = ts.getContainingFunction(expr);\n                    if (!(func && func.kind === 150))\n                        return true;\n                    return !(func.parent === symbol.valueDeclaration.parent || func === symbol.valueDeclaration.parent);\n                }\n                return true;\n            }\n            return false;\n        }\n        function isReferenceThroughNamespaceImport(expr) {\n            if (expr.kind === 177 || expr.kind === 178) {\n                var node = ts.skipParentheses(expr.expression);\n                if (node.kind === 70) {\n                    var symbol = getNodeLinks(node).resolvedSymbol;\n                    if (symbol.flags & 8388608) {\n                        var declaration = getDeclarationOfAliasSymbol(symbol);\n                        return declaration && declaration.kind === 237;\n                    }\n                }\n            }\n            return false;\n        }\n        function checkReferenceExpression(expr, invalidReferenceMessage) {\n            var node = ts.skipParentheses(expr);\n            if (node.kind !== 70 && node.kind !== 177 && node.kind !== 178) {\n                error(expr, invalidReferenceMessage);\n                return false;\n            }\n            return true;\n        }\n        function checkDeleteExpression(node) {\n            checkExpression(node.expression);\n            return booleanType;\n        }\n        function checkTypeOfExpression(node) {\n            checkExpression(node.expression);\n            return stringType;\n        }\n        function checkVoidExpression(node) {\n            checkExpression(node.expression);\n            return undefinedWideningType;\n        }\n        function checkAwaitExpression(node) {\n            if (produceDiagnostics) {\n                if (!(node.flags & 16384)) {\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function);\n                }\n                if (isInParameterInitializerBeforeContainingFunction(node)) {\n                    error(node, ts.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);\n                }\n            }\n            var operandType = checkExpression(node.expression);\n            return checkAwaitedType(operandType, node);\n        }\n        function checkPrefixUnaryExpression(node) {\n            var operandType = checkExpression(node.operand);\n            if (operandType === silentNeverType) {\n                return silentNeverType;\n            }\n            if (node.operator === 37 && node.operand.kind === 8) {\n                return getFreshTypeOfLiteralType(getLiteralTypeForText(64, \"\" + -node.operand.text));\n            }\n            switch (node.operator) {\n                case 36:\n                case 37:\n                case 51:\n                    if (maybeTypeOfKind(operandType, 512)) {\n                        error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator));\n                    }\n                    return numberType;\n                case 50:\n                    var facts = getTypeFacts(operandType) & (1048576 | 2097152);\n                    return facts === 1048576 ? falseType :\n                        facts === 2097152 ? trueType :\n                            booleanType;\n                case 42:\n                case 43:\n                    var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type);\n                    if (ok) {\n                        checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access);\n                    }\n                    return numberType;\n            }\n            return unknownType;\n        }\n        function checkPostfixUnaryExpression(node) {\n            var operandType = checkExpression(node.operand);\n            if (operandType === silentNeverType) {\n                return silentNeverType;\n            }\n            var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type);\n            if (ok) {\n                checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access);\n            }\n            return numberType;\n        }\n        function maybeTypeOfKind(type, kind) {\n            if (type.flags & kind) {\n                return true;\n            }\n            if (type.flags & 196608) {\n                var types = type.types;\n                for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {\n                    var t = types_15[_i];\n                    if (maybeTypeOfKind(t, kind)) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function isTypeOfKind(type, kind) {\n            if (type.flags & kind) {\n                return true;\n            }\n            if (type.flags & 65536) {\n                var types = type.types;\n                for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {\n                    var t = types_16[_i];\n                    if (!isTypeOfKind(t, kind)) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            if (type.flags & 131072) {\n                var types = type.types;\n                for (var _a = 0, types_17 = types; _a < types_17.length; _a++) {\n                    var t = types_17[_a];\n                    if (isTypeOfKind(t, kind)) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function isConstEnumObjectType(type) {\n            return getObjectFlags(type) & 16 && type.symbol && isConstEnumSymbol(type.symbol);\n        }\n        function isConstEnumSymbol(symbol) {\n            return (symbol.flags & 128) !== 0;\n        }\n        function checkInstanceOfExpression(left, right, leftType, rightType) {\n            if (leftType === silentNeverType || rightType === silentNeverType) {\n                return silentNeverType;\n            }\n            if (isTypeOfKind(leftType, 8190)) {\n                error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);\n            }\n            if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {\n                error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);\n            }\n            return booleanType;\n        }\n        function checkInExpression(left, right, leftType, rightType) {\n            if (leftType === silentNeverType || rightType === silentNeverType) {\n                return silentNeverType;\n            }\n            if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 | 512))) {\n                error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol);\n            }\n            if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672)) {\n                error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);\n            }\n            return booleanType;\n        }\n        function checkObjectLiteralAssignment(node, sourceType) {\n            var properties = node.properties;\n            for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) {\n                var p = properties_6[_i];\n                checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties);\n            }\n            return sourceType;\n        }\n        function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) {\n            if (property.kind === 257 || property.kind === 258) {\n                var name_20 = property.name;\n                if (name_20.kind === 142) {\n                    checkComputedPropertyName(name_20);\n                }\n                if (isComputedNonLiteralName(name_20)) {\n                    return undefined;\n                }\n                var text = ts.getTextOfPropertyName(name_20);\n                var type = isTypeAny(objectLiteralType)\n                    ? objectLiteralType\n                    : getTypeOfPropertyOfType(objectLiteralType, text) ||\n                        isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) ||\n                        getIndexTypeOfType(objectLiteralType, 0);\n                if (type) {\n                    if (property.kind === 258) {\n                        return checkDestructuringAssignment(property, type);\n                    }\n                    else {\n                        return checkDestructuringAssignment(property.initializer, type);\n                    }\n                }\n                else {\n                    error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20));\n                }\n            }\n            else if (property.kind === 259) {\n                if (languageVersion < 5) {\n                    checkExternalEmitHelpers(property, 4);\n                }\n                var nonRestNames = [];\n                if (allProperties) {\n                    for (var i = 0; i < allProperties.length - 1; i++) {\n                        nonRestNames.push(allProperties[i].name);\n                    }\n                }\n                var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol);\n                return checkDestructuringAssignment(property.expression, type);\n            }\n            else {\n                error(property, ts.Diagnostics.Property_assignment_expected);\n            }\n        }\n        function checkArrayLiteralAssignment(node, sourceType, contextualMapper) {\n            var elementType = checkIteratedTypeOrElementType(sourceType, node, false) || unknownType;\n            var elements = node.elements;\n            for (var i = 0; i < elements.length; i++) {\n                checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, contextualMapper);\n            }\n            return sourceType;\n        }\n        function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) {\n            var elements = node.elements;\n            var element = elements[elementIndex];\n            if (element.kind !== 198) {\n                if (element.kind !== 196) {\n                    var propName = \"\" + elementIndex;\n                    var type = isTypeAny(sourceType)\n                        ? sourceType\n                        : isTupleLikeType(sourceType)\n                            ? getTypeOfPropertyOfType(sourceType, propName)\n                            : elementType;\n                    if (type) {\n                        return checkDestructuringAssignment(element, type, contextualMapper);\n                    }\n                    else {\n                        checkExpression(element);\n                        if (isTupleType(sourceType)) {\n                            error(element, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), getTypeReferenceArity(sourceType), elements.length);\n                        }\n                        else {\n                            error(element, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName);\n                        }\n                    }\n                }\n                else {\n                    if (elementIndex < elements.length - 1) {\n                        error(element, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);\n                    }\n                    else {\n                        var restExpression = element.expression;\n                        if (restExpression.kind === 192 && restExpression.operatorToken.kind === 57) {\n                            error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);\n                        }\n                        else {\n                            return checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper);\n                        }\n                    }\n                }\n            }\n            return undefined;\n        }\n        function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) {\n            var target;\n            if (exprOrAssignment.kind === 258) {\n                var prop = exprOrAssignment;\n                if (prop.objectAssignmentInitializer) {\n                    if (strictNullChecks &&\n                        !(getFalsyFlags(checkExpression(prop.objectAssignmentInitializer)) & 2048)) {\n                        sourceType = getTypeWithFacts(sourceType, 131072);\n                    }\n                    checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper);\n                }\n                target = exprOrAssignment.name;\n            }\n            else {\n                target = exprOrAssignment;\n            }\n            if (target.kind === 192 && target.operatorToken.kind === 57) {\n                checkBinaryExpression(target, contextualMapper);\n                target = target.left;\n            }\n            if (target.kind === 176) {\n                return checkObjectLiteralAssignment(target, sourceType);\n            }\n            if (target.kind === 175) {\n                return checkArrayLiteralAssignment(target, sourceType, contextualMapper);\n            }\n            return checkReferenceAssignment(target, sourceType, contextualMapper);\n        }\n        function checkReferenceAssignment(target, sourceType, contextualMapper) {\n            var targetType = checkExpression(target, contextualMapper);\n            var error = target.parent.kind === 259 ?\n                ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access :\n                ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access;\n            if (checkReferenceExpression(target, error)) {\n                checkTypeAssignableTo(sourceType, targetType, target, undefined);\n            }\n            return sourceType;\n        }\n        function isSideEffectFree(node) {\n            node = ts.skipParentheses(node);\n            switch (node.kind) {\n                case 70:\n                case 9:\n                case 11:\n                case 181:\n                case 194:\n                case 12:\n                case 8:\n                case 100:\n                case 85:\n                case 94:\n                case 137:\n                case 184:\n                case 197:\n                case 185:\n                case 175:\n                case 176:\n                case 187:\n                case 201:\n                case 247:\n                case 246:\n                    return true;\n                case 193:\n                    return isSideEffectFree(node.whenTrue) &&\n                        isSideEffectFree(node.whenFalse);\n                case 192:\n                    if (ts.isAssignmentOperator(node.operatorToken.kind)) {\n                        return false;\n                    }\n                    return isSideEffectFree(node.left) &&\n                        isSideEffectFree(node.right);\n                case 190:\n                case 191:\n                    switch (node.operator) {\n                        case 50:\n                        case 36:\n                        case 37:\n                        case 51:\n                            return true;\n                    }\n                    return false;\n                case 188:\n                case 182:\n                case 200:\n                default:\n                    return false;\n            }\n        }\n        function isTypeEqualityComparableTo(source, target) {\n            return (target.flags & 6144) !== 0 || isTypeComparableTo(source, target);\n        }\n        function getBestChoiceType(type1, type2) {\n            var firstAssignableToSecond = isTypeAssignableTo(type1, type2);\n            var secondAssignableToFirst = isTypeAssignableTo(type2, type1);\n            return secondAssignableToFirst && !firstAssignableToSecond ? type1 :\n                firstAssignableToSecond && !secondAssignableToFirst ? type2 :\n                    getUnionType([type1, type2], true);\n        }\n        function checkBinaryExpression(node, contextualMapper) {\n            return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node);\n        }\n        function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) {\n            var operator = operatorToken.kind;\n            if (operator === 57 && (left.kind === 176 || left.kind === 175)) {\n                return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper);\n            }\n            var leftType = checkExpression(left, contextualMapper);\n            var rightType = checkExpression(right, contextualMapper);\n            switch (operator) {\n                case 38:\n                case 39:\n                case 60:\n                case 61:\n                case 40:\n                case 62:\n                case 41:\n                case 63:\n                case 37:\n                case 59:\n                case 44:\n                case 64:\n                case 45:\n                case 65:\n                case 46:\n                case 66:\n                case 48:\n                case 68:\n                case 49:\n                case 69:\n                case 47:\n                case 67:\n                    if (leftType === silentNeverType || rightType === silentNeverType) {\n                        return silentNeverType;\n                    }\n                    if (leftType.flags & 6144)\n                        leftType = rightType;\n                    if (rightType.flags & 6144)\n                        rightType = leftType;\n                    leftType = getNonNullableType(leftType);\n                    rightType = getNonNullableType(rightType);\n                    var suggestedOperator = void 0;\n                    if ((leftType.flags & 136) &&\n                        (rightType.flags & 136) &&\n                        (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== undefined) {\n                        error(errorNode || operatorToken, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(operatorToken.kind), ts.tokenToString(suggestedOperator));\n                    }\n                    else {\n                        var leftOk = checkArithmeticOperandType(left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type);\n                        var rightOk = checkArithmeticOperandType(right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type);\n                        if (leftOk && rightOk) {\n                            checkAssignmentOperator(numberType);\n                        }\n                    }\n                    return numberType;\n                case 36:\n                case 58:\n                    if (leftType === silentNeverType || rightType === silentNeverType) {\n                        return silentNeverType;\n                    }\n                    if (leftType.flags & 6144)\n                        leftType = rightType;\n                    if (rightType.flags & 6144)\n                        rightType = leftType;\n                    leftType = getNonNullableType(leftType);\n                    rightType = getNonNullableType(rightType);\n                    var resultType = void 0;\n                    if (isTypeOfKind(leftType, 340) && isTypeOfKind(rightType, 340)) {\n                        resultType = numberType;\n                    }\n                    else {\n                        if (isTypeOfKind(leftType, 262178) || isTypeOfKind(rightType, 262178)) {\n                            resultType = stringType;\n                        }\n                        else if (isTypeAny(leftType) || isTypeAny(rightType)) {\n                            resultType = leftType === unknownType || rightType === unknownType ? unknownType : anyType;\n                        }\n                        if (resultType && !checkForDisallowedESSymbolOperand(operator)) {\n                            return resultType;\n                        }\n                    }\n                    if (!resultType) {\n                        reportOperatorError();\n                        return anyType;\n                    }\n                    if (operator === 58) {\n                        checkAssignmentOperator(resultType);\n                    }\n                    return resultType;\n                case 26:\n                case 28:\n                case 29:\n                case 30:\n                    if (checkForDisallowedESSymbolOperand(operator)) {\n                        leftType = getBaseTypeOfLiteralType(leftType);\n                        rightType = getBaseTypeOfLiteralType(rightType);\n                        if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {\n                            reportOperatorError();\n                        }\n                    }\n                    return booleanType;\n                case 31:\n                case 32:\n                case 33:\n                case 34:\n                    var leftIsLiteral = isLiteralType(leftType);\n                    var rightIsLiteral = isLiteralType(rightType);\n                    if (!leftIsLiteral || !rightIsLiteral) {\n                        leftType = leftIsLiteral ? getBaseTypeOfLiteralType(leftType) : leftType;\n                        rightType = rightIsLiteral ? getBaseTypeOfLiteralType(rightType) : rightType;\n                    }\n                    if (!isTypeEqualityComparableTo(leftType, rightType) && !isTypeEqualityComparableTo(rightType, leftType)) {\n                        reportOperatorError();\n                    }\n                    return booleanType;\n                case 92:\n                    return checkInstanceOfExpression(left, right, leftType, rightType);\n                case 91:\n                    return checkInExpression(left, right, leftType, rightType);\n                case 52:\n                    return getTypeFacts(leftType) & 1048576 ?\n                        includeFalsyTypes(rightType, getFalsyFlags(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType))) :\n                        leftType;\n                case 53:\n                    return getTypeFacts(leftType) & 2097152 ?\n                        getBestChoiceType(removeDefinitelyFalsyTypes(leftType), rightType) :\n                        leftType;\n                case 57:\n                    checkAssignmentOperator(rightType);\n                    return getRegularTypeOfObjectLiteral(rightType);\n                case 25:\n                    if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left)) {\n                        error(left, ts.Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects);\n                    }\n                    return rightType;\n            }\n            function checkForDisallowedESSymbolOperand(operator) {\n                var offendingSymbolOperand = maybeTypeOfKind(leftType, 512) ? left :\n                    maybeTypeOfKind(rightType, 512) ? right :\n                        undefined;\n                if (offendingSymbolOperand) {\n                    error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator));\n                    return false;\n                }\n                return true;\n            }\n            function getSuggestedBooleanOperator(operator) {\n                switch (operator) {\n                    case 48:\n                    case 68:\n                        return 53;\n                    case 49:\n                    case 69:\n                        return 34;\n                    case 47:\n                    case 67:\n                        return 52;\n                    default:\n                        return undefined;\n                }\n            }\n            function checkAssignmentOperator(valueType) {\n                if (produceDiagnostics && operator >= 57 && operator <= 69) {\n                    if (checkReferenceExpression(left, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) {\n                        checkTypeAssignableTo(valueType, leftType, left, undefined);\n                    }\n                }\n            }\n            function reportOperatorError() {\n                error(errorNode || operatorToken, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), typeToString(leftType), typeToString(rightType));\n            }\n        }\n        function isYieldExpressionInClass(node) {\n            var current = node;\n            var parent = node.parent;\n            while (parent) {\n                if (ts.isFunctionLike(parent) && current === parent.body) {\n                    return false;\n                }\n                else if (ts.isClassLike(current)) {\n                    return true;\n                }\n                current = parent;\n                parent = parent.parent;\n            }\n            return false;\n        }\n        function checkYieldExpression(node) {\n            if (produceDiagnostics) {\n                if (!(node.flags & 4096) || isYieldExpressionInClass(node)) {\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body);\n                }\n                if (isInParameterInitializerBeforeContainingFunction(node)) {\n                    error(node, ts.Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer);\n                }\n            }\n            if (node.expression) {\n                var func = ts.getContainingFunction(node);\n                if (func && func.asteriskToken) {\n                    var expressionType = checkExpressionCached(node.expression, undefined);\n                    var expressionElementType = void 0;\n                    var nodeIsYieldStar = !!node.asteriskToken;\n                    if (nodeIsYieldStar) {\n                        expressionElementType = checkElementTypeOfIterable(expressionType, node.expression);\n                    }\n                    if (func.type) {\n                        var signatureElementType = getElementTypeOfIterableIterator(getTypeFromTypeNode(func.type)) || anyType;\n                        if (nodeIsYieldStar) {\n                            checkTypeAssignableTo(expressionElementType, signatureElementType, node.expression, undefined);\n                        }\n                        else {\n                            checkTypeAssignableTo(expressionType, signatureElementType, node.expression, undefined);\n                        }\n                    }\n                }\n            }\n            return anyType;\n        }\n        function checkConditionalExpression(node, contextualMapper) {\n            checkExpression(node.condition);\n            var type1 = checkExpression(node.whenTrue, contextualMapper);\n            var type2 = checkExpression(node.whenFalse, contextualMapper);\n            return getBestChoiceType(type1, type2);\n        }\n        function checkLiteralExpression(node) {\n            if (node.kind === 8) {\n                checkGrammarNumericLiteral(node);\n            }\n            switch (node.kind) {\n                case 9:\n                    return getFreshTypeOfLiteralType(getLiteralTypeForText(32, node.text));\n                case 8:\n                    return getFreshTypeOfLiteralType(getLiteralTypeForText(64, node.text));\n                case 100:\n                    return trueType;\n                case 85:\n                    return falseType;\n            }\n        }\n        function checkTemplateExpression(node) {\n            ts.forEach(node.templateSpans, function (templateSpan) {\n                checkExpression(templateSpan.expression);\n            });\n            return stringType;\n        }\n        function checkExpressionWithContextualType(node, contextualType, contextualMapper) {\n            var saveContextualType = node.contextualType;\n            node.contextualType = contextualType;\n            var result = checkExpression(node, contextualMapper);\n            node.contextualType = saveContextualType;\n            return result;\n        }\n        function checkExpressionCached(node, contextualMapper) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                var saveFlowLoopStart = flowLoopStart;\n                flowLoopStart = flowLoopCount;\n                links.resolvedType = checkExpression(node, contextualMapper);\n                flowLoopStart = saveFlowLoopStart;\n            }\n            return links.resolvedType;\n        }\n        function isTypeAssertion(node) {\n            node = ts.skipParentheses(node);\n            return node.kind === 182 || node.kind === 200;\n        }\n        function checkDeclarationInitializer(declaration) {\n            var type = checkExpressionCached(declaration.initializer);\n            return ts.getCombinedNodeFlags(declaration) & 2 ||\n                ts.getCombinedModifierFlags(declaration) & 64 && !ts.isParameterPropertyDeclaration(declaration) ||\n                isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type);\n        }\n        function isLiteralContextualType(contextualType) {\n            if (contextualType) {\n                if (contextualType.flags & 16384) {\n                    var apparentType = getApparentTypeOfTypeParameter(contextualType);\n                    if (apparentType.flags & (2 | 4 | 8 | 16)) {\n                        return true;\n                    }\n                    contextualType = apparentType;\n                }\n                return maybeTypeOfKind(contextualType, (480 | 262144));\n            }\n            return false;\n        }\n        function checkExpressionForMutableLocation(node, contextualMapper) {\n            var type = checkExpression(node, contextualMapper);\n            return isTypeAssertion(node) || isLiteralContextualType(getContextualType(node)) ? type : getWidenedLiteralType(type);\n        }\n        function checkPropertyAssignment(node, contextualMapper) {\n            if (node.name.kind === 142) {\n                checkComputedPropertyName(node.name);\n            }\n            return checkExpressionForMutableLocation(node.initializer, contextualMapper);\n        }\n        function checkObjectLiteralMethod(node, contextualMapper) {\n            checkGrammarMethod(node);\n            if (node.name.kind === 142) {\n                checkComputedPropertyName(node.name);\n            }\n            var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper);\n            return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper);\n        }\n        function instantiateTypeWithSingleGenericCallSignature(node, type, contextualMapper) {\n            if (isInferentialContext(contextualMapper)) {\n                var signature = getSingleCallSignature(type);\n                if (signature && signature.typeParameters) {\n                    var contextualType = getApparentTypeOfContextualType(node);\n                    if (contextualType) {\n                        var contextualSignature = getSingleCallSignature(contextualType);\n                        if (contextualSignature && !contextualSignature.typeParameters) {\n                            return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper));\n                        }\n                    }\n                }\n            }\n            return type;\n        }\n        function getTypeOfExpression(node) {\n            if (node.kind === 179 && node.expression.kind !== 96) {\n                var funcType = checkNonNullExpression(node.expression);\n                var signature = getSingleCallSignature(funcType);\n                if (signature && !signature.typeParameters) {\n                    return getReturnTypeOfSignature(signature);\n                }\n            }\n            return checkExpression(node);\n        }\n        function checkExpression(node, contextualMapper) {\n            var type;\n            if (node.kind === 141) {\n                type = checkQualifiedName(node);\n            }\n            else {\n                var uninstantiatedType = checkExpressionWorker(node, contextualMapper);\n                type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper);\n            }\n            if (isConstEnumObjectType(type)) {\n                var ok = (node.parent.kind === 177 && node.parent.expression === node) ||\n                    (node.parent.kind === 178 && node.parent.expression === node) ||\n                    ((node.kind === 70 || node.kind === 141) && isInRightSideOfImportOrExportAssignment(node));\n                if (!ok) {\n                    error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment);\n                }\n            }\n            return type;\n        }\n        function checkExpressionWorker(node, contextualMapper) {\n            switch (node.kind) {\n                case 70:\n                    return checkIdentifier(node);\n                case 98:\n                    return checkThisExpression(node);\n                case 96:\n                    return checkSuperExpression(node);\n                case 94:\n                    return nullWideningType;\n                case 9:\n                case 8:\n                case 100:\n                case 85:\n                    return checkLiteralExpression(node);\n                case 194:\n                    return checkTemplateExpression(node);\n                case 12:\n                    return stringType;\n                case 11:\n                    return globalRegExpType;\n                case 175:\n                    return checkArrayLiteral(node, contextualMapper);\n                case 176:\n                    return checkObjectLiteral(node, contextualMapper);\n                case 177:\n                    return checkPropertyAccessExpression(node);\n                case 178:\n                    return checkIndexedAccess(node);\n                case 179:\n                case 180:\n                    return checkCallExpression(node);\n                case 181:\n                    return checkTaggedTemplateExpression(node);\n                case 183:\n                    return checkExpression(node.expression, contextualMapper);\n                case 197:\n                    return checkClassExpression(node);\n                case 184:\n                case 185:\n                    return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper);\n                case 187:\n                    return checkTypeOfExpression(node);\n                case 182:\n                case 200:\n                    return checkAssertion(node);\n                case 201:\n                    return checkNonNullAssertion(node);\n                case 186:\n                    return checkDeleteExpression(node);\n                case 188:\n                    return checkVoidExpression(node);\n                case 189:\n                    return checkAwaitExpression(node);\n                case 190:\n                    return checkPrefixUnaryExpression(node);\n                case 191:\n                    return checkPostfixUnaryExpression(node);\n                case 192:\n                    return checkBinaryExpression(node, contextualMapper);\n                case 193:\n                    return checkConditionalExpression(node, contextualMapper);\n                case 196:\n                    return checkSpreadExpression(node, contextualMapper);\n                case 198:\n                    return undefinedWideningType;\n                case 195:\n                    return checkYieldExpression(node);\n                case 252:\n                    return checkJsxExpression(node);\n                case 246:\n                    return checkJsxElement(node);\n                case 247:\n                    return checkJsxSelfClosingElement(node);\n                case 248:\n                    ts.Debug.fail(\"Shouldn't ever directly check a JsxOpeningElement\");\n            }\n            return unknownType;\n        }\n        function checkTypeParameter(node) {\n            if (node.expression) {\n                grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected);\n            }\n            checkSourceElement(node.constraint);\n            getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)));\n            if (produceDiagnostics) {\n                checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0);\n            }\n        }\n        function checkParameter(node) {\n            checkGrammarDecorators(node) || checkGrammarModifiers(node);\n            checkVariableLikeDeclaration(node);\n            var func = ts.getContainingFunction(node);\n            if (ts.getModifierFlags(node) & 92) {\n                func = ts.getContainingFunction(node);\n                if (!(func.kind === 150 && ts.nodeIsPresent(func.body))) {\n                    error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);\n                }\n            }\n            if (node.questionToken && ts.isBindingPattern(node.name) && func.body) {\n                error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);\n            }\n            if (node.name.text === \"this\") {\n                if (ts.indexOf(func.parameters, node) !== 0) {\n                    error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter);\n                }\n                if (func.kind === 150 || func.kind === 154 || func.kind === 159) {\n                    error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter);\n                }\n            }\n            if (node.dotDotDotToken && !ts.isBindingPattern(node.name) && !isArrayType(getTypeOfSymbol(node.symbol))) {\n                error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type);\n            }\n        }\n        function isSyntacticallyValidGenerator(node) {\n            if (!node.asteriskToken || !node.body) {\n                return false;\n            }\n            return node.kind === 149 ||\n                node.kind === 225 ||\n                node.kind === 184;\n        }\n        function getTypePredicateParameterIndex(parameterList, parameter) {\n            if (parameterList) {\n                for (var i = 0; i < parameterList.length; i++) {\n                    var param = parameterList[i];\n                    if (param.name.kind === 70 &&\n                        param.name.text === parameter.text) {\n                        return i;\n                    }\n                }\n            }\n            return -1;\n        }\n        function checkTypePredicate(node) {\n            var parent = getTypePredicateParent(node);\n            if (!parent) {\n                error(node, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);\n                return;\n            }\n            var typePredicate = getSignatureFromDeclaration(parent).typePredicate;\n            if (!typePredicate) {\n                return;\n            }\n            var parameterName = node.parameterName;\n            if (ts.isThisTypePredicate(typePredicate)) {\n                getTypeFromThisTypeNode(parameterName);\n            }\n            else {\n                if (typePredicate.parameterIndex >= 0) {\n                    if (parent.parameters[typePredicate.parameterIndex].dotDotDotToken) {\n                        error(parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter);\n                    }\n                    else {\n                        var leadingError = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type);\n                        checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type, undefined, leadingError);\n                    }\n                }\n                else if (parameterName) {\n                    var hasReportedError = false;\n                    for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) {\n                        var name_21 = _a[_i].name;\n                        if (ts.isBindingPattern(name_21) &&\n                            checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_21, parameterName, typePredicate.parameterName)) {\n                            hasReportedError = true;\n                            break;\n                        }\n                    }\n                    if (!hasReportedError) {\n                        error(node.parameterName, ts.Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName);\n                    }\n                }\n            }\n        }\n        function getTypePredicateParent(node) {\n            switch (node.parent.kind) {\n                case 185:\n                case 153:\n                case 225:\n                case 184:\n                case 158:\n                case 149:\n                case 148:\n                    var parent_9 = node.parent;\n                    if (node === parent_9.type) {\n                        return parent_9;\n                    }\n            }\n        }\n        function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern, predicateVariableNode, predicateVariableName) {\n            for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {\n                var element = _a[_i];\n                if (ts.isOmittedExpression(element)) {\n                    continue;\n                }\n                var name_22 = element.name;\n                if (name_22.kind === 70 &&\n                    name_22.text === predicateVariableName) {\n                    error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);\n                    return true;\n                }\n                else if (name_22.kind === 173 ||\n                    name_22.kind === 172) {\n                    if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, predicateVariableNode, predicateVariableName)) {\n                        return true;\n                    }\n                }\n            }\n        }\n        function checkSignatureDeclaration(node) {\n            if (node.kind === 155) {\n                checkGrammarIndexSignature(node);\n            }\n            else if (node.kind === 158 || node.kind === 225 || node.kind === 159 ||\n                node.kind === 153 || node.kind === 150 ||\n                node.kind === 154) {\n                checkGrammarFunctionLikeDeclaration(node);\n            }\n            if (ts.isAsyncFunctionLike(node) && languageVersion < 4) {\n                checkExternalEmitHelpers(node, 64);\n                if (languageVersion < 2) {\n                    checkExternalEmitHelpers(node, 128);\n                }\n            }\n            checkTypeParameters(node.typeParameters);\n            ts.forEach(node.parameters, checkParameter);\n            if (node.type) {\n                checkSourceElement(node.type);\n            }\n            if (produceDiagnostics) {\n                checkCollisionWithArgumentsInGeneratedCode(node);\n                if (compilerOptions.noImplicitAny && !node.type) {\n                    switch (node.kind) {\n                        case 154:\n                            error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);\n                            break;\n                        case 153:\n                            error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);\n                            break;\n                    }\n                }\n                if (node.type) {\n                    if (languageVersion >= 2 && isSyntacticallyValidGenerator(node)) {\n                        var returnType = getTypeFromTypeNode(node.type);\n                        if (returnType === voidType) {\n                            error(node.type, ts.Diagnostics.A_generator_cannot_have_a_void_type_annotation);\n                        }\n                        else {\n                            var generatorElementType = getElementTypeOfIterableIterator(returnType) || anyType;\n                            var iterableIteratorInstantiation = createIterableIteratorType(generatorElementType);\n                            checkTypeAssignableTo(iterableIteratorInstantiation, returnType, node.type);\n                        }\n                    }\n                    else if (ts.isAsyncFunctionLike(node)) {\n                        checkAsyncFunctionReturnType(node);\n                    }\n                }\n                if (noUnusedIdentifiers && !node.body) {\n                    checkUnusedTypeParameters(node);\n                }\n            }\n        }\n        function checkClassForDuplicateDeclarations(node) {\n            var instanceNames = ts.createMap();\n            var staticNames = ts.createMap();\n            for (var _i = 0, _a = node.members; _i < _a.length; _i++) {\n                var member = _a[_i];\n                if (member.kind === 150) {\n                    for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {\n                        var param = _c[_b];\n                        if (ts.isParameterPropertyDeclaration(param)) {\n                            addName(instanceNames, param.name, param.name.text, 3);\n                        }\n                    }\n                }\n                else {\n                    var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 114; });\n                    var names = isStatic ? staticNames : instanceNames;\n                    var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name);\n                    if (memberName) {\n                        switch (member.kind) {\n                            case 151:\n                                addName(names, member.name, memberName, 1);\n                                break;\n                            case 152:\n                                addName(names, member.name, memberName, 2);\n                                break;\n                            case 147:\n                                addName(names, member.name, memberName, 3);\n                                break;\n                        }\n                    }\n                }\n            }\n            function addName(names, location, name, meaning) {\n                var prev = names[name];\n                if (prev) {\n                    if (prev & meaning) {\n                        error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location));\n                    }\n                    else {\n                        names[name] = prev | meaning;\n                    }\n                }\n                else {\n                    names[name] = meaning;\n                }\n            }\n        }\n        function checkObjectTypeForDuplicateDeclarations(node) {\n            var names = ts.createMap();\n            for (var _i = 0, _a = node.members; _i < _a.length; _i++) {\n                var member = _a[_i];\n                if (member.kind == 146) {\n                    var memberName = void 0;\n                    switch (member.name.kind) {\n                        case 9:\n                        case 8:\n                        case 70:\n                            memberName = member.name.text;\n                            break;\n                        default:\n                            continue;\n                    }\n                    if (names[memberName]) {\n                        error(member.symbol.valueDeclaration.name, ts.Diagnostics.Duplicate_identifier_0, memberName);\n                        error(member.name, ts.Diagnostics.Duplicate_identifier_0, memberName);\n                    }\n                    else {\n                        names[memberName] = true;\n                    }\n                }\n            }\n        }\n        function checkTypeForDuplicateIndexSignatures(node) {\n            if (node.kind === 227) {\n                var nodeSymbol = getSymbolOfNode(node);\n                if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) {\n                    return;\n                }\n            }\n            var indexSymbol = getIndexSymbol(getSymbolOfNode(node));\n            if (indexSymbol) {\n                var seenNumericIndexer = false;\n                var seenStringIndexer = false;\n                for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    var declaration = decl;\n                    if (declaration.parameters.length === 1 && declaration.parameters[0].type) {\n                        switch (declaration.parameters[0].type.kind) {\n                            case 134:\n                                if (!seenStringIndexer) {\n                                    seenStringIndexer = true;\n                                }\n                                else {\n                                    error(declaration, ts.Diagnostics.Duplicate_string_index_signature);\n                                }\n                                break;\n                            case 132:\n                                if (!seenNumericIndexer) {\n                                    seenNumericIndexer = true;\n                                }\n                                else {\n                                    error(declaration, ts.Diagnostics.Duplicate_number_index_signature);\n                                }\n                                break;\n                        }\n                    }\n                }\n            }\n        }\n        function checkPropertyDeclaration(node) {\n            checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name);\n            checkVariableLikeDeclaration(node);\n        }\n        function checkMethodDeclaration(node) {\n            checkGrammarMethod(node) || checkGrammarComputedPropertyName(node.name);\n            checkFunctionOrMethodDeclaration(node);\n            if (ts.getModifierFlags(node) & 128 && node.body) {\n                error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name));\n            }\n        }\n        function checkConstructorDeclaration(node) {\n            checkSignatureDeclaration(node);\n            checkGrammarConstructorTypeParameters(node) || checkGrammarConstructorTypeAnnotation(node);\n            checkSourceElement(node.body);\n            registerForUnusedIdentifiersCheck(node);\n            var symbol = getSymbolOfNode(node);\n            var firstDeclaration = ts.getDeclarationOfKind(symbol, node.kind);\n            if (node === firstDeclaration) {\n                checkFunctionOrConstructorSymbol(symbol);\n            }\n            if (ts.nodeIsMissing(node.body)) {\n                return;\n            }\n            if (!produceDiagnostics) {\n                return;\n            }\n            function containsSuperCallAsComputedPropertyName(n) {\n                return n.name && containsSuperCall(n.name);\n            }\n            function containsSuperCall(n) {\n                if (ts.isSuperCall(n)) {\n                    return true;\n                }\n                else if (ts.isFunctionLike(n)) {\n                    return false;\n                }\n                else if (ts.isClassLike(n)) {\n                    return ts.forEach(n.members, containsSuperCallAsComputedPropertyName);\n                }\n                return ts.forEachChild(n, containsSuperCall);\n            }\n            function markThisReferencesAsErrors(n) {\n                if (n.kind === 98) {\n                    error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location);\n                }\n                else if (n.kind !== 184 && n.kind !== 225) {\n                    ts.forEachChild(n, markThisReferencesAsErrors);\n                }\n            }\n            function isInstancePropertyWithInitializer(n) {\n                return n.kind === 147 &&\n                    !(ts.getModifierFlags(n) & 32) &&\n                    !!n.initializer;\n            }\n            var containingClassDecl = node.parent;\n            if (ts.getClassExtendsHeritageClauseElement(containingClassDecl)) {\n                captureLexicalThis(node.parent, containingClassDecl);\n                var classExtendsNull = classDeclarationExtendsNull(containingClassDecl);\n                var superCall = getSuperCallInConstructor(node);\n                if (superCall) {\n                    if (classExtendsNull) {\n                        error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);\n                    }\n                    var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) ||\n                        ts.forEach(node.parameters, function (p) { return ts.getModifierFlags(p) & 92; });\n                    if (superCallShouldBeFirst) {\n                        var statements = node.body.statements;\n                        var superCallStatement = void 0;\n                        for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) {\n                            var statement = statements_3[_i];\n                            if (statement.kind === 207 && ts.isSuperCall(statement.expression)) {\n                                superCallStatement = statement;\n                                break;\n                            }\n                            if (!ts.isPrologueDirective(statement)) {\n                                break;\n                            }\n                        }\n                        if (!superCallStatement) {\n                          error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties);\n                        }\n                    }\n                }\n                else if (!classExtendsNull) {\n                    error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call);\n                }\n            }\n        }\n        function checkAccessorDeclaration(node) {\n            if (produceDiagnostics) {\n                checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name);\n                checkDecorators(node);\n                checkSignatureDeclaration(node);\n                if (node.kind === 151) {\n                    if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 128)) {\n                        if (!(node.flags & 256)) {\n                            error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);\n                        }\n                    }\n                }\n                if (node.name.kind === 142) {\n                    checkComputedPropertyName(node.name);\n                }\n                if (!ts.hasDynamicName(node)) {\n                    var otherKind = node.kind === 151 ? 152 : 151;\n                    var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind);\n                    if (otherAccessor) {\n                        if ((ts.getModifierFlags(node) & 28) !== (ts.getModifierFlags(otherAccessor) & 28)) {\n                            error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility);\n                        }\n                        if (ts.hasModifier(node, 128) !== ts.hasModifier(otherAccessor, 128)) {\n                            error(node.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);\n                        }\n                        checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorType, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type);\n                        checkAccessorDeclarationTypesIdentical(node, otherAccessor, getThisTypeOfDeclaration, ts.Diagnostics.get_and_set_accessor_must_have_the_same_this_type);\n                    }\n                }\n                var returnType = getTypeOfAccessors(getSymbolOfNode(node));\n                if (node.kind === 151) {\n                    checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType);\n                }\n            }\n            if (node.parent.kind !== 176) {\n                checkSourceElement(node.body);\n                registerForUnusedIdentifiersCheck(node);\n            }\n            else {\n                checkNodeDeferred(node);\n            }\n        }\n        function checkAccessorDeclarationTypesIdentical(first, second, getAnnotatedType, message) {\n            var firstType = getAnnotatedType(first);\n            var secondType = getAnnotatedType(second);\n            if (firstType && secondType && !isTypeIdenticalTo(firstType, secondType)) {\n                error(first, message);\n            }\n        }\n        function checkAccessorDeferred(node) {\n            checkSourceElement(node.body);\n            registerForUnusedIdentifiersCheck(node);\n        }\n        function checkMissingDeclaration(node) {\n            checkDecorators(node);\n        }\n        function checkTypeArgumentConstraints(typeParameters, typeArgumentNodes) {\n            var typeArguments;\n            var mapper;\n            var result = true;\n            for (var i = 0; i < typeParameters.length; i++) {\n                var constraint = getConstraintOfTypeParameter(typeParameters[i]);\n                if (constraint) {\n                    if (!typeArguments) {\n                        typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode);\n                        mapper = createTypeMapper(typeParameters, typeArguments);\n                    }\n                    var typeArgument = typeArguments[i];\n                    result = result && checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), typeArgumentNodes[i], ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);\n                }\n            }\n            return result;\n        }\n        function checkTypeReferenceNode(node) {\n            checkGrammarTypeArguments(node, node.typeArguments);\n            var type = getTypeFromTypeReference(node);\n            if (type !== unknownType) {\n                if (node.typeArguments) {\n                    ts.forEach(node.typeArguments, checkSourceElement);\n                    if (produceDiagnostics) {\n                        var symbol = getNodeLinks(node).resolvedSymbol;\n                        var typeParameters = symbol.flags & 524288 ? getSymbolLinks(symbol).typeParameters : type.target.localTypeParameters;\n                        checkTypeArgumentConstraints(typeParameters, node.typeArguments);\n                    }\n                }\n                if (type.flags & 16 && !type.memberTypes && getNodeLinks(node).resolvedSymbol.flags & 8) {\n                    error(node, ts.Diagnostics.Enum_type_0_has_members_with_initializers_that_are_not_literals, typeToString(type));\n                }\n            }\n        }\n        function checkTypeQuery(node) {\n            getTypeFromTypeQueryNode(node);\n        }\n        function checkTypeLiteral(node) {\n            ts.forEach(node.members, checkSourceElement);\n            if (produceDiagnostics) {\n                var type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);\n                checkIndexConstraints(type);\n                checkTypeForDuplicateIndexSignatures(node);\n                checkObjectTypeForDuplicateDeclarations(node);\n            }\n        }\n        function checkArrayType(node) {\n            checkSourceElement(node.elementType);\n        }\n        function checkTupleType(node) {\n            var hasErrorFromDisallowedTrailingComma = checkGrammarForDisallowedTrailingComma(node.elementTypes);\n            if (!hasErrorFromDisallowedTrailingComma && node.elementTypes.length === 0) {\n                grammarErrorOnNode(node, ts.Diagnostics.A_tuple_type_element_list_cannot_be_empty);\n            }\n            ts.forEach(node.elementTypes, checkSourceElement);\n        }\n        function checkUnionOrIntersectionType(node) {\n            ts.forEach(node.types, checkSourceElement);\n        }\n        function checkIndexedAccessType(node) {\n            getTypeFromIndexedAccessTypeNode(node);\n        }\n        function checkMappedType(node) {\n            checkSourceElement(node.typeParameter);\n            checkSourceElement(node.type);\n            var type = getTypeFromMappedTypeNode(node);\n            var constraintType = getConstraintTypeFromMappedType(type);\n            var keyType = constraintType.flags & 16384 ? getApparentTypeOfTypeParameter(constraintType) : constraintType;\n            checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint);\n        }\n        function isPrivateWithinAmbient(node) {\n            return (ts.getModifierFlags(node) & 8) && ts.isInAmbientContext(node);\n        }\n        function getEffectiveDeclarationFlags(n, flagsToCheck) {\n            var flags = ts.getCombinedModifierFlags(n);\n            if (n.parent.kind !== 227 &&\n                n.parent.kind !== 226 &&\n                n.parent.kind !== 197 &&\n                ts.isInAmbientContext(n)) {\n                if (!(flags & 2)) {\n                    flags |= 1;\n                }\n                flags |= 2;\n            }\n            return flags & flagsToCheck;\n        }\n        function checkFunctionOrConstructorSymbol(symbol) {\n            if (!produceDiagnostics) {\n                return;\n            }\n            function getCanonicalOverload(overloads, implementation) {\n                var implementationSharesContainerWithFirstOverload = implementation !== undefined && implementation.parent === overloads[0].parent;\n                return implementationSharesContainerWithFirstOverload ? implementation : overloads[0];\n            }\n            function checkFlagAgreementBetweenOverloads(overloads, implementation, flagsToCheck, someOverloadFlags, allOverloadFlags) {\n                var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags;\n                if (someButNotAllOverloadFlags !== 0) {\n                    var canonicalFlags_1 = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck);\n                    ts.forEach(overloads, function (o) {\n                        var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags_1;\n                        if (deviation & 1) {\n                            error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);\n                        }\n                        else if (deviation & 2) {\n                            error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);\n                        }\n                        else if (deviation & (8 | 16)) {\n                            error(o.name || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);\n                        }\n                        else if (deviation & 128) {\n                            error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);\n                        }\n                    });\n                }\n            }\n            function checkQuestionTokenAgreementBetweenOverloads(overloads, implementation, someHaveQuestionToken, allHaveQuestionToken) {\n                if (someHaveQuestionToken !== allHaveQuestionToken) {\n                    var canonicalHasQuestionToken_1 = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation));\n                    ts.forEach(overloads, function (o) {\n                        var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken_1;\n                        if (deviation) {\n                            error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_optional_or_required);\n                        }\n                    });\n                }\n            }\n            var flagsToCheck = 1 | 2 | 8 | 16 | 128;\n            var someNodeFlags = 0;\n            var allNodeFlags = flagsToCheck;\n            var someHaveQuestionToken = false;\n            var allHaveQuestionToken = true;\n            var hasOverloads = false;\n            var bodyDeclaration;\n            var lastSeenNonAmbientDeclaration;\n            var previousDeclaration;\n            var declarations = symbol.declarations;\n            var isConstructor = (symbol.flags & 16384) !== 0;\n            function reportImplementationExpectedError(node) {\n                if (node.name && ts.nodeIsMissing(node.name)) {\n                    return;\n                }\n                var seen = false;\n                var subsequentNode = ts.forEachChild(node.parent, function (c) {\n                    if (seen) {\n                        return c;\n                    }\n                    else {\n                        seen = c === node;\n                    }\n                });\n                if (subsequentNode && subsequentNode.pos === node.end) {\n                    if (subsequentNode.kind === node.kind) {\n                        var errorNode_1 = subsequentNode.name || subsequentNode;\n                        if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) {\n                            var reportError = (node.kind === 149 || node.kind === 148) &&\n                                (ts.getModifierFlags(node) & 32) !== (ts.getModifierFlags(subsequentNode) & 32);\n                            if (reportError) {\n                                var diagnostic = ts.getModifierFlags(node) & 32 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static;\n                                error(errorNode_1, diagnostic);\n                            }\n                            return;\n                        }\n                        else if (ts.nodeIsPresent(subsequentNode.body)) {\n                            error(errorNode_1, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name));\n                            return;\n                        }\n                    }\n                }\n                var errorNode = node.name || node;\n                if (isConstructor) {\n                    error(errorNode, ts.Diagnostics.Constructor_implementation_is_missing);\n                }\n                else {\n                    if (ts.getModifierFlags(node) & 128) {\n                        error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive);\n                    }\n                    else {\n                        error(errorNode, ts.Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration);\n                    }\n                }\n            }\n            var duplicateFunctionDeclaration = false;\n            var multipleConstructorImplementation = false;\n            for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {\n                var current = declarations_4[_i];\n                var node = current;\n                var inAmbientContext = ts.isInAmbientContext(node);\n                var inAmbientContextOrInterface = node.parent.kind === 227 || node.parent.kind === 161 || inAmbientContext;\n                if (inAmbientContextOrInterface) {\n                    previousDeclaration = undefined;\n                }\n                if (node.kind === 225 || node.kind === 149 || node.kind === 148 || node.kind === 150) {\n                    var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);\n                    someNodeFlags |= currentNodeFlags;\n                    allNodeFlags &= currentNodeFlags;\n                    someHaveQuestionToken = someHaveQuestionToken || ts.hasQuestionToken(node);\n                    allHaveQuestionToken = allHaveQuestionToken && ts.hasQuestionToken(node);\n                    if (ts.nodeIsPresent(node.body) && bodyDeclaration) {\n                        if (isConstructor) {\n                            multipleConstructorImplementation = true;\n                        }\n                        else {\n                            duplicateFunctionDeclaration = true;\n                        }\n                    }\n                    else if (previousDeclaration && previousDeclaration.parent === node.parent && previousDeclaration.end !== node.pos) {\n                        reportImplementationExpectedError(previousDeclaration);\n                    }\n                    if (ts.nodeIsPresent(node.body)) {\n                        if (!bodyDeclaration) {\n                            bodyDeclaration = node;\n                        }\n                    }\n                    else {\n                        hasOverloads = true;\n                    }\n                    previousDeclaration = node;\n                    if (!inAmbientContextOrInterface) {\n                        lastSeenNonAmbientDeclaration = node;\n                    }\n                }\n            }\n            if (multipleConstructorImplementation) {\n                ts.forEach(declarations, function (declaration) {\n                    error(declaration, ts.Diagnostics.Multiple_constructor_implementations_are_not_allowed);\n                });\n            }\n            if (duplicateFunctionDeclaration) {\n                ts.forEach(declarations, function (declaration) {\n                    error(declaration.name, ts.Diagnostics.Duplicate_function_implementation);\n                });\n            }\n            if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body &&\n                !(ts.getModifierFlags(lastSeenNonAmbientDeclaration) & 128) && !lastSeenNonAmbientDeclaration.questionToken) {\n                reportImplementationExpectedError(lastSeenNonAmbientDeclaration);\n            }\n            if (hasOverloads) {\n                checkFlagAgreementBetweenOverloads(declarations, bodyDeclaration, flagsToCheck, someNodeFlags, allNodeFlags);\n                checkQuestionTokenAgreementBetweenOverloads(declarations, bodyDeclaration, someHaveQuestionToken, allHaveQuestionToken);\n                if (bodyDeclaration) {\n                    var signatures = getSignaturesOfSymbol(symbol);\n                    var bodySignature = getSignatureFromDeclaration(bodyDeclaration);\n                    for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) {\n                        var signature = signatures_3[_a];\n                        if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {\n                            error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation);\n                            break;\n                        }\n                    }\n                }\n            }\n        }\n        function checkExportsOnMergedDeclarations(node) {\n            if (!produceDiagnostics) {\n                return;\n            }\n            var symbol = node.localSymbol;\n            if (!symbol) {\n                symbol = getSymbolOfNode(node);\n                if (!(symbol.flags & 7340032)) {\n                    return;\n                }\n            }\n            if (ts.getDeclarationOfKind(symbol, node.kind) !== node) {\n                return;\n            }\n            var exportedDeclarationSpaces = 0;\n            var nonExportedDeclarationSpaces = 0;\n            var defaultExportedDeclarationSpaces = 0;\n            for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                var d = _a[_i];\n                var declarationSpaces = getDeclarationSpaces(d);\n                var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 | 512);\n                if (effectiveDeclarationFlags & 1) {\n                    if (effectiveDeclarationFlags & 512) {\n                        defaultExportedDeclarationSpaces |= declarationSpaces;\n                    }\n                    else {\n                        exportedDeclarationSpaces |= declarationSpaces;\n                    }\n                }\n                else {\n                    nonExportedDeclarationSpaces |= declarationSpaces;\n                }\n            }\n            var nonDefaultExportedDeclarationSpaces = exportedDeclarationSpaces | nonExportedDeclarationSpaces;\n            var commonDeclarationSpacesForExportsAndLocals = exportedDeclarationSpaces & nonExportedDeclarationSpaces;\n            var commonDeclarationSpacesForDefaultAndNonDefault = defaultExportedDeclarationSpaces & nonDefaultExportedDeclarationSpaces;\n            if (commonDeclarationSpacesForExportsAndLocals || commonDeclarationSpacesForDefaultAndNonDefault) {\n                for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) {\n                    var d = _c[_b];\n                    var declarationSpaces = getDeclarationSpaces(d);\n                    if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) {\n                        error(d.name, ts.Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, ts.declarationNameToString(d.name));\n                    }\n                    else if (declarationSpaces & commonDeclarationSpacesForExportsAndLocals) {\n                        error(d.name, ts.Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, ts.declarationNameToString(d.name));\n                    }\n                }\n            }\n            function getDeclarationSpaces(d) {\n                switch (d.kind) {\n                    case 227:\n                        return 2097152;\n                    case 230:\n                        return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0\n                            ? 4194304 | 1048576\n                            : 4194304;\n                    case 226:\n                    case 229:\n                        return 2097152 | 1048576;\n                    case 234:\n                        var result_3 = 0;\n                        var target = resolveAlias(getSymbolOfNode(d));\n                        ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); });\n                        return result_3;\n                    default:\n                        return 1048576;\n                }\n            }\n        }\n        function checkNonThenableType(type, location, message) {\n            type = getWidenedType(type);\n            if (!isTypeAny(type) && !isTypeNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) {\n                if (location) {\n                    if (!message) {\n                        message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member;\n                    }\n                    error(location, message);\n                }\n                return unknownType;\n            }\n            return type;\n        }\n        function getPromisedType(promise) {\n            if (isTypeAny(promise)) {\n                return undefined;\n            }\n            if (getObjectFlags(promise) & 4) {\n                if (promise.target === tryGetGlobalPromiseType()\n                    || promise.target === getGlobalPromiseLikeType()) {\n                    return promise.typeArguments[0];\n                }\n            }\n            var globalPromiseLikeType = getInstantiatedGlobalPromiseLikeType();\n            if (globalPromiseLikeType === emptyObjectType || !isTypeAssignableTo(promise, globalPromiseLikeType)) {\n                return undefined;\n            }\n            var thenFunction = getTypeOfPropertyOfType(promise, \"then\");\n            if (!thenFunction || isTypeAny(thenFunction)) {\n                return undefined;\n            }\n            var thenSignatures = getSignaturesOfType(thenFunction, 0);\n            if (thenSignatures.length === 0) {\n                return undefined;\n            }\n            var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072);\n            if (isTypeAny(onfulfilledParameterType)) {\n                return undefined;\n            }\n            var onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0);\n            if (onfulfilledParameterSignatures.length === 0) {\n                return undefined;\n            }\n            return getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), true);\n        }\n        function getTypeOfFirstParameterOfSignature(signature) {\n            return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType;\n        }\n        function getAwaitedType(type) {\n            return checkAwaitedType(type, undefined, undefined);\n        }\n        function checkAwaitedType(type, location, message) {\n            return checkAwaitedTypeWorker(type);\n            function checkAwaitedTypeWorker(type) {\n                if (type.flags & 65536) {\n                    var types = [];\n                    for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                        var constituentType = _a[_i];\n                        types.push(checkAwaitedTypeWorker(constituentType));\n                    }\n                    return getUnionType(types, true);\n                }\n                else {\n                    var promisedType = getPromisedType(type);\n                    if (promisedType === undefined) {\n                        return checkNonThenableType(type, location, message);\n                    }\n                    else {\n                        if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) {\n                            if (location) {\n                                error(location, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method, symbolToString(type.symbol));\n                            }\n                            return unknownType;\n                        }\n                        awaitedTypeStack.push(type.id);\n                        var awaitedType = checkAwaitedTypeWorker(promisedType);\n                        awaitedTypeStack.pop();\n                        return awaitedType;\n                    }\n                }\n            }\n        }\n        function checkAsyncFunctionReturnType(node) {\n            var returnType = getTypeFromTypeNode(node.type);\n            if (languageVersion >= 2) {\n                if (returnType === unknownType) {\n                    return unknownType;\n                }\n                var globalPromiseType = getGlobalPromiseType();\n                if (globalPromiseType !== emptyGenericType && globalPromiseType !== getTargetType(returnType)) {\n                    error(node.type, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type);\n                    return unknownType;\n                }\n            }\n            else {\n                markTypeNodeAsReferenced(node.type);\n                if (returnType === unknownType) {\n                    return unknownType;\n                }\n                var promiseConstructorName = ts.getEntityNameFromTypeNode(node.type);\n                if (promiseConstructorName === undefined) {\n                    error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType));\n                    return unknownType;\n                }\n                var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 107455, true);\n                var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType;\n                if (promiseConstructorType === unknownType) {\n                    error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName));\n                    return unknownType;\n                }\n                var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType();\n                if (globalPromiseConstructorLikeType === emptyObjectType) {\n                    error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName));\n                    return unknownType;\n                }\n                if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value)) {\n                    return unknownType;\n                }\n                var rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);\n                var collidingSymbol = getSymbol(node.locals, rootName.text, 107455);\n                if (collidingSymbol) {\n                    error(collidingSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, rootName.text, ts.entityNameToString(promiseConstructorName));\n                    return unknownType;\n                }\n            }\n            return checkAwaitedType(returnType, node, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type);\n        }\n        function checkDecorator(node) {\n            var signature = getResolvedSignature(node);\n            var returnType = getReturnTypeOfSignature(signature);\n            if (returnType.flags & 1) {\n                return;\n            }\n            var expectedReturnType;\n            var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);\n            var errorInfo;\n            switch (node.parent.kind) {\n                case 226:\n                    var classSymbol = getSymbolOfNode(node.parent);\n                    var classConstructorType = getTypeOfSymbol(classSymbol);\n                    expectedReturnType = getUnionType([classConstructorType, voidType]);\n                    break;\n                case 144:\n                    expectedReturnType = voidType;\n                    errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);\n                    break;\n                case 147:\n                    expectedReturnType = voidType;\n                    errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);\n                    break;\n                case 149:\n                case 151:\n                case 152:\n                    var methodType = getTypeOfNode(node.parent);\n                    var descriptorType = createTypedPropertyDescriptorType(methodType);\n                    expectedReturnType = getUnionType([descriptorType, voidType]);\n                    break;\n            }\n            checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, errorInfo);\n        }\n        function markTypeNodeAsReferenced(node) {\n            var typeName = node && ts.getEntityNameFromTypeNode(node);\n            var rootName = typeName && getFirstIdentifier(typeName);\n            var rootSymbol = rootName && resolveName(rootName, rootName.text, (typeName.kind === 70 ? 793064 : 1920) | 8388608, undefined, undefined);\n            if (rootSymbol\n                && rootSymbol.flags & 8388608\n                && symbolIsValue(rootSymbol)\n                && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) {\n                markAliasSymbolAsReferenced(rootSymbol);\n            }\n        }\n        function checkDecorators(node) {\n            if (!node.decorators) {\n                return;\n            }\n            if (!ts.nodeCanBeDecorated(node)) {\n                return;\n            }\n            if (!compilerOptions.experimentalDecorators) {\n                error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning);\n            }\n            var firstDecorator = node.decorators[0];\n            checkExternalEmitHelpers(firstDecorator, 8);\n            if (node.kind === 144) {\n                checkExternalEmitHelpers(firstDecorator, 32);\n            }\n            if (compilerOptions.emitDecoratorMetadata) {\n                checkExternalEmitHelpers(firstDecorator, 16);\n                switch (node.kind) {\n                    case 226:\n                        var constructor = ts.getFirstConstructorWithBody(node);\n                        if (constructor) {\n                            for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) {\n                                var parameter = _a[_i];\n                                markTypeNodeAsReferenced(parameter.type);\n                            }\n                        }\n                        break;\n                    case 149:\n                    case 151:\n                    case 152:\n                        for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) {\n                            var parameter = _c[_b];\n                            markTypeNodeAsReferenced(parameter.type);\n                        }\n                        markTypeNodeAsReferenced(node.type);\n                        break;\n                    case 147:\n                    case 144:\n                        markTypeNodeAsReferenced(node.type);\n                        break;\n                }\n            }\n            ts.forEach(node.decorators, checkDecorator);\n        }\n        function checkFunctionDeclaration(node) {\n            if (produceDiagnostics) {\n                checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node);\n                checkCollisionWithCapturedSuperVariable(node, node.name);\n                checkCollisionWithCapturedThisVariable(node, node.name);\n                checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n                checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n            }\n        }\n        function checkFunctionOrMethodDeclaration(node) {\n            checkDecorators(node);\n            checkSignatureDeclaration(node);\n            var isAsync = ts.isAsyncFunctionLike(node);\n            if (node.name && node.name.kind === 142) {\n                checkComputedPropertyName(node.name);\n            }\n            if (!ts.hasDynamicName(node)) {\n                var symbol = getSymbolOfNode(node);\n                var localSymbol = node.localSymbol || symbol;\n                var firstDeclaration = ts.forEach(localSymbol.declarations, function (declaration) { return declaration.kind === node.kind && !ts.isSourceFileJavaScript(ts.getSourceFileOfNode(declaration)) ?\n                    declaration : undefined; });\n                if (node === firstDeclaration) {\n                    checkFunctionOrConstructorSymbol(localSymbol);\n                }\n                if (symbol.parent) {\n                    if (ts.getDeclarationOfKind(symbol, node.kind) === node) {\n                        checkFunctionOrConstructorSymbol(symbol);\n                    }\n                }\n            }\n            checkSourceElement(node.body);\n            if (!node.asteriskToken) {\n                var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type));\n                checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType);\n            }\n            if (produceDiagnostics && !node.type) {\n                if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) {\n                    reportImplicitAnyError(node, anyType);\n                }\n                if (node.asteriskToken && ts.nodeIsPresent(node.body)) {\n                    getReturnTypeOfSignature(getSignatureFromDeclaration(node));\n                }\n            }\n            registerForUnusedIdentifiersCheck(node);\n        }\n        function registerForUnusedIdentifiersCheck(node) {\n            if (deferredUnusedIdentifierNodes) {\n                deferredUnusedIdentifierNodes.push(node);\n            }\n        }\n        function checkUnusedIdentifiers() {\n            if (deferredUnusedIdentifierNodes) {\n                for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) {\n                    var node = deferredUnusedIdentifierNodes_1[_i];\n                    switch (node.kind) {\n                        case 261:\n                        case 230:\n                            checkUnusedModuleMembers(node);\n                            break;\n                        case 226:\n                        case 197:\n                            checkUnusedClassMembers(node);\n                            checkUnusedTypeParameters(node);\n                            break;\n                        case 227:\n                            checkUnusedTypeParameters(node);\n                            break;\n                        case 204:\n                        case 232:\n                        case 211:\n                        case 212:\n                        case 213:\n                            checkUnusedLocalsAndParameters(node);\n                            break;\n                        case 150:\n                        case 184:\n                        case 225:\n                        case 185:\n                        case 149:\n                        case 151:\n                        case 152:\n                            if (node.body) {\n                                checkUnusedLocalsAndParameters(node);\n                            }\n                            checkUnusedTypeParameters(node);\n                            break;\n                        case 148:\n                        case 153:\n                        case 154:\n                        case 155:\n                        case 158:\n                        case 159:\n                            checkUnusedTypeParameters(node);\n                            break;\n                    }\n                    ;\n                }\n            }\n        }\n        function checkUnusedLocalsAndParameters(node) {\n            if (node.parent.kind !== 227 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) {\n                var _loop_2 = function (key) {\n                    var local = node.locals[key];\n                    if (!local.isReferenced) {\n                        if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144) {\n                            var parameter = ts.getRootDeclaration(local.valueDeclaration);\n                            if (compilerOptions.noUnusedParameters &&\n                                !ts.isParameterPropertyDeclaration(parameter) &&\n                                !ts.parameterIsThisKeyword(parameter) &&\n                                !parameterNameStartsWithUnderscore(local.valueDeclaration.name)) {\n                                error(local.valueDeclaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name);\n                            }\n                        }\n                        else if (compilerOptions.noUnusedLocals) {\n                            ts.forEach(local.declarations, function (d) { return errorUnusedLocal(d.name || d, local.name); });\n                        }\n                    }\n                };\n                for (var key in node.locals) {\n                    _loop_2(key);\n                }\n            }\n        }\n        function errorUnusedLocal(node, name) {\n            if (isIdentifierThatStartsWithUnderScore(node)) {\n                var declaration = ts.getRootDeclaration(node.parent);\n                if (declaration.kind === 223 &&\n                    (declaration.parent.parent.kind === 212 ||\n                        declaration.parent.parent.kind === 213)) {\n                    return;\n                }\n            }\n            error(node, ts.Diagnostics._0_is_declared_but_never_used, name);\n        }\n        function parameterNameStartsWithUnderscore(parameterName) {\n            return parameterName && isIdentifierThatStartsWithUnderScore(parameterName);\n        }\n        function isIdentifierThatStartsWithUnderScore(node) {\n            return node.kind === 70 && node.text.charCodeAt(0) === 95;\n        }\n        function checkUnusedClassMembers(node) {\n            if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {\n                if (node.members) {\n                    for (var _i = 0, _a = node.members; _i < _a.length; _i++) {\n                        var member = _a[_i];\n                        if (member.kind === 149 || member.kind === 147) {\n                            if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8) {\n                                error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name);\n                            }\n                        }\n                        else if (member.kind === 150) {\n                            for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {\n                                var parameter = _c[_b];\n                                if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8) {\n                                    error(parameter.name, ts.Diagnostics.Property_0_is_declared_but_never_used, parameter.symbol.name);\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        function checkUnusedTypeParameters(node) {\n            if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {\n                if (node.typeParameters) {\n                    var symbol = getSymbolOfNode(node);\n                    var lastDeclaration = symbol && symbol.declarations && ts.lastOrUndefined(symbol.declarations);\n                    if (lastDeclaration !== node) {\n                        return;\n                    }\n                    for (var _i = 0, _a = node.typeParameters; _i < _a.length; _i++) {\n                        var typeParameter = _a[_i];\n                        if (!getMergedSymbol(typeParameter.symbol).isReferenced) {\n                            error(typeParameter.name, ts.Diagnostics._0_is_declared_but_never_used, typeParameter.symbol.name);\n                        }\n                    }\n                }\n            }\n        }\n        function checkUnusedModuleMembers(node) {\n            if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {\n                for (var key in node.locals) {\n                    var local = node.locals[key];\n                    if (!local.isReferenced && !local.exportSymbol) {\n                        for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) {\n                            var declaration = _a[_i];\n                            if (!ts.isAmbientModule(declaration)) {\n                                error(declaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name);\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        function checkBlock(node) {\n            if (node.kind === 204) {\n                checkGrammarStatementInAmbientContext(node);\n            }\n            ts.forEach(node.statements, checkSourceElement);\n            if (node.locals) {\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkCollisionWithArgumentsInGeneratedCode(node) {\n            if (!ts.hasDeclaredRestParameter(node) || ts.isInAmbientContext(node) || ts.nodeIsMissing(node.body)) {\n                return;\n            }\n            ts.forEach(node.parameters, function (p) {\n                if (p.name && !ts.isBindingPattern(p.name) && p.name.text === argumentsSymbol.name) {\n                    error(p, ts.Diagnostics.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters);\n                }\n            });\n        }\n        function needCollisionCheckForIdentifier(node, identifier, name) {\n            if (!(identifier && identifier.text === name)) {\n                return false;\n            }\n            if (node.kind === 147 ||\n                node.kind === 146 ||\n                node.kind === 149 ||\n                node.kind === 148 ||\n                node.kind === 151 ||\n                node.kind === 152) {\n                return false;\n            }\n            if (ts.isInAmbientContext(node)) {\n                return false;\n            }\n            var root = ts.getRootDeclaration(node);\n            if (root.kind === 144 && ts.nodeIsMissing(root.parent.body)) {\n                return false;\n            }\n            return true;\n        }\n        function checkCollisionWithCapturedThisVariable(node, name) {\n            if (needCollisionCheckForIdentifier(node, name, \"_this\")) {\n                potentialThisCollisions.push(node);\n            }\n        }\n        function checkIfThisIsCapturedInEnclosingScope(node) {\n            var current = node;\n            while (current) {\n                if (getNodeCheckFlags(current) & 4) {\n                    var isDeclaration_1 = node.kind !== 70;\n                    if (isDeclaration_1) {\n                        error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);\n                    }\n                    else {\n                        error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference);\n                    }\n                    return;\n                }\n                current = current.parent;\n            }\n        }\n        function checkCollisionWithCapturedSuperVariable(node, name) {\n            if (!needCollisionCheckForIdentifier(node, name, \"_super\")) {\n                return;\n            }\n            var enclosingClass = ts.getContainingClass(node);\n            if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) {\n                return;\n            }\n            if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) {\n                var isDeclaration_2 = node.kind !== 70;\n                if (isDeclaration_2) {\n                    error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference);\n                }\n                else {\n                    error(node, ts.Diagnostics.Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference);\n                }\n            }\n        }\n        function checkCollisionWithRequireExportsInGeneratedCode(node, name) {\n            if (modulekind >= ts.ModuleKind.ES2015) {\n                return;\n            }\n            if (!needCollisionCheckForIdentifier(node, name, \"require\") && !needCollisionCheckForIdentifier(node, name, \"exports\")) {\n                return;\n            }\n            if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) {\n                return;\n            }\n            var parent = getDeclarationContainer(node);\n            if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent)) {\n                error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name));\n            }\n        }\n        function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) {\n            if (languageVersion >= 4 || !needCollisionCheckForIdentifier(node, name, \"Promise\")) {\n                return;\n            }\n            if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) {\n                return;\n            }\n            var parent = getDeclarationContainer(node);\n            if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) {\n                error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name));\n            }\n        }\n        function checkVarDeclaredNamesNotShadowed(node) {\n            if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) {\n                return;\n            }\n            if (node.kind === 223 && !node.initializer) {\n                return;\n            }\n            var symbol = getSymbolOfNode(node);\n            if (symbol.flags & 1) {\n                var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined);\n                if (localDeclarationSymbol &&\n                    localDeclarationSymbol !== symbol &&\n                    localDeclarationSymbol.flags & 2) {\n                    if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) {\n                        var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 224);\n                        var container = varDeclList.parent.kind === 205 && varDeclList.parent.parent\n                            ? varDeclList.parent.parent\n                            : undefined;\n                        var namesShareScope = container &&\n                            (container.kind === 204 && ts.isFunctionLike(container.parent) ||\n                                container.kind === 231 ||\n                                container.kind === 230 ||\n                                container.kind === 261);\n                        if (!namesShareScope) {\n                            var name_23 = symbolToString(localDeclarationSymbol);\n                            error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_23, name_23);\n                        }\n                    }\n                }\n            }\n        }\n        function checkParameterInitializer(node) {\n            if (ts.getRootDeclaration(node).kind !== 144) {\n                return;\n            }\n            var func = ts.getContainingFunction(node);\n            visit(node.initializer);\n            function visit(n) {\n                if (ts.isTypeNode(n) || ts.isDeclarationName(n)) {\n                    return;\n                }\n                if (n.kind === 177) {\n                    return visit(n.expression);\n                }\n                else if (n.kind === 70) {\n                    var symbol = resolveName(n, n.text, 107455 | 8388608, undefined, undefined);\n                    if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) {\n                        return;\n                    }\n                    if (symbol.valueDeclaration === node) {\n                        error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name));\n                        return;\n                    }\n                    var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);\n                    if (enclosingContainer === func) {\n                        if (symbol.valueDeclaration.kind === 144) {\n                            if (symbol.valueDeclaration.pos < node.pos) {\n                                return;\n                            }\n                            var current = n;\n                            while (current !== node.initializer) {\n                                if (ts.isFunctionLike(current.parent)) {\n                                    return;\n                                }\n                                if (current.parent.kind === 147 &&\n                                    !(ts.hasModifier(current.parent, 32)) &&\n                                    ts.isClassLike(current.parent.parent)) {\n                                    return;\n                                }\n                                current = current.parent;\n                            }\n                        }\n                        error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n));\n                    }\n                }\n                else {\n                    return ts.forEachChild(n, visit);\n                }\n            }\n        }\n        function convertAutoToAny(type) {\n            return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type;\n        }\n        function checkVariableLikeDeclaration(node) {\n            checkDecorators(node);\n            checkSourceElement(node.type);\n            if (node.name.kind === 142) {\n                checkComputedPropertyName(node.name);\n                if (node.initializer) {\n                    checkExpressionCached(node.initializer);\n                }\n            }\n            if (node.kind === 174) {\n                if (node.parent.kind === 172 && languageVersion < 5) {\n                    checkExternalEmitHelpers(node, 4);\n                }\n                if (node.propertyName && node.propertyName.kind === 142) {\n                    checkComputedPropertyName(node.propertyName);\n                }\n                var parent_10 = node.parent.parent;\n                var parentType = getTypeForBindingElementParent(parent_10);\n                var name_24 = node.propertyName || node.name;\n                var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_24));\n                markPropertyAsReferenced(property);\n                if (parent_10.initializer && property && getParentOfSymbol(property)) {\n                    checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property);\n                }\n            }\n            if (ts.isBindingPattern(node.name)) {\n                ts.forEach(node.name.elements, checkSourceElement);\n            }\n            if (node.initializer && ts.getRootDeclaration(node).kind === 144 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {\n                error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);\n                return;\n            }\n            if (ts.isBindingPattern(node.name)) {\n                if (node.initializer && node.parent.parent.kind !== 212) {\n                    checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined);\n                    checkParameterInitializer(node);\n                }\n                return;\n            }\n            var symbol = getSymbolOfNode(node);\n            var type = convertAutoToAny(getTypeOfVariableOrParameterOrProperty(symbol));\n            if (node === symbol.valueDeclaration) {\n                if (node.initializer && node.parent.parent.kind !== 212) {\n                    checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined);\n                    checkParameterInitializer(node);\n                }\n            }\n            else {\n                var declarationType = convertAutoToAny(getWidenedTypeForVariableLikeDeclaration(node));\n                if (type !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(type, declarationType)) {\n                    error(node.name, ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, ts.declarationNameToString(node.name), typeToString(type), typeToString(declarationType));\n                }\n                if (node.initializer) {\n                    checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined);\n                }\n                if (!areDeclarationFlagsIdentical(node, symbol.valueDeclaration)) {\n                    error(symbol.valueDeclaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name));\n                    error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name));\n                }\n            }\n            if (node.kind !== 147 && node.kind !== 146) {\n                checkExportsOnMergedDeclarations(node);\n                if (node.kind === 223 || node.kind === 174) {\n                    checkVarDeclaredNamesNotShadowed(node);\n                }\n                checkCollisionWithCapturedSuperVariable(node, node.name);\n                checkCollisionWithCapturedThisVariable(node, node.name);\n                checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n                checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n            }\n        }\n        function areDeclarationFlagsIdentical(left, right) {\n            if ((left.kind === 144 && right.kind === 223) ||\n                (left.kind === 223 && right.kind === 144)) {\n                return true;\n            }\n            if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) {\n                return false;\n            }\n            var interestingFlags = 8 |\n                16 |\n                256 |\n                128 |\n                64 |\n                32;\n            return (ts.getModifierFlags(left) & interestingFlags) === (ts.getModifierFlags(right) & interestingFlags);\n        }\n        function checkVariableDeclaration(node) {\n            checkGrammarVariableDeclaration(node);\n            return checkVariableLikeDeclaration(node);\n        }\n        function checkBindingElement(node) {\n            checkGrammarBindingElement(node);\n            return checkVariableLikeDeclaration(node);\n        }\n        function checkVariableStatement(node) {\n            checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarVariableDeclarationList(node.declarationList) || checkGrammarForDisallowedLetOrConstStatement(node);\n            ts.forEach(node.declarationList.declarations, checkSourceElement);\n        }\n        function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) {\n            if (node.modifiers && node.parent.kind === 176) {\n                if (ts.isAsyncFunctionLike(node)) {\n                    if (node.modifiers.length > 1) {\n                        return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here);\n                    }\n                }\n                else {\n                    return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here);\n                }\n            }\n        }\n        function checkExpressionStatement(node) {\n            checkGrammarStatementInAmbientContext(node);\n            checkExpression(node.expression);\n        }\n        function checkIfStatement(node) {\n            checkGrammarStatementInAmbientContext(node);\n            checkExpression(node.expression);\n            checkSourceElement(node.thenStatement);\n            if (node.thenStatement.kind === 206) {\n                error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);\n            }\n            checkSourceElement(node.elseStatement);\n        }\n        function checkDoStatement(node) {\n            checkGrammarStatementInAmbientContext(node);\n            checkSourceElement(node.statement);\n            checkExpression(node.expression);\n        }\n        function checkWhileStatement(node) {\n            checkGrammarStatementInAmbientContext(node);\n            checkExpression(node.expression);\n            checkSourceElement(node.statement);\n        }\n        function checkForStatement(node) {\n            if (!checkGrammarStatementInAmbientContext(node)) {\n                if (node.initializer && node.initializer.kind === 224) {\n                    checkGrammarVariableDeclarationList(node.initializer);\n                }\n            }\n            if (node.initializer) {\n                if (node.initializer.kind === 224) {\n                    ts.forEach(node.initializer.declarations, checkVariableDeclaration);\n                }\n                else {\n                    checkExpression(node.initializer);\n                }\n            }\n            if (node.condition)\n                checkExpression(node.condition);\n            if (node.incrementor)\n                checkExpression(node.incrementor);\n            checkSourceElement(node.statement);\n            if (node.locals) {\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkForOfStatement(node) {\n            checkGrammarForInOrForOfStatement(node);\n            if (node.initializer.kind === 224) {\n                checkForInOrForOfVariableDeclaration(node);\n            }\n            else {\n                var varExpr = node.initializer;\n                var iteratedType = checkRightHandSideOfForOf(node.expression);\n                if (varExpr.kind === 175 || varExpr.kind === 176) {\n                    checkDestructuringAssignment(varExpr, iteratedType || unknownType);\n                }\n                else {\n                    var leftType = checkExpression(varExpr);\n                    checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access);\n                    if (iteratedType) {\n                        checkTypeAssignableTo(iteratedType, leftType, varExpr, undefined);\n                    }\n                }\n            }\n            checkSourceElement(node.statement);\n            if (node.locals) {\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkForInStatement(node) {\n            checkGrammarForInOrForOfStatement(node);\n            var rightType = checkNonNullExpression(node.expression);\n            if (node.initializer.kind === 224) {\n                var variable = node.initializer.declarations[0];\n                if (variable && ts.isBindingPattern(variable.name)) {\n                    error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);\n                }\n                checkForInOrForOfVariableDeclaration(node);\n            }\n            else {\n                var varExpr = node.initializer;\n                var leftType = checkExpression(varExpr);\n                if (varExpr.kind === 175 || varExpr.kind === 176) {\n                    error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);\n                }\n                else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {\n                    error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any);\n                }\n                else {\n                    checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access);\n                }\n            }\n            if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672)) {\n                error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter);\n            }\n            checkSourceElement(node.statement);\n            if (node.locals) {\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkForInOrForOfVariableDeclaration(iterationStatement) {\n            var variableDeclarationList = iterationStatement.initializer;\n            if (variableDeclarationList.declarations.length >= 1) {\n                var decl = variableDeclarationList.declarations[0];\n                checkVariableDeclaration(decl);\n            }\n        }\n        function checkRightHandSideOfForOf(rhsExpression) {\n            var expressionType = checkNonNullExpression(rhsExpression);\n            return checkIteratedTypeOrElementType(expressionType, rhsExpression, true);\n        }\n        function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) {\n            if (isTypeAny(inputType)) {\n                return inputType;\n            }\n            if (languageVersion >= 2) {\n                return checkElementTypeOfIterable(inputType, errorNode);\n            }\n            if (allowStringInput) {\n                return checkElementTypeOfArrayOrString(inputType, errorNode);\n            }\n            if (isArrayLikeType(inputType)) {\n                var indexType = getIndexTypeOfType(inputType, 1);\n                if (indexType) {\n                    return indexType;\n                }\n            }\n            if (errorNode) {\n                error(errorNode, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType));\n            }\n            return unknownType;\n        }\n        function checkElementTypeOfIterable(iterable, errorNode) {\n            var elementType = getElementTypeOfIterable(iterable, errorNode);\n            if (errorNode && elementType) {\n                checkTypeAssignableTo(iterable, createIterableType(elementType), errorNode);\n            }\n            return elementType || anyType;\n        }\n        function getElementTypeOfIterable(type, errorNode) {\n            if (isTypeAny(type)) {\n                return undefined;\n            }\n            var typeAsIterable = type;\n            if (!typeAsIterable.iterableElementType) {\n                if ((getObjectFlags(type) & 4) && type.target === getGlobalIterableType()) {\n                    typeAsIterable.iterableElementType = type.typeArguments[0];\n                }\n                else {\n                    var iteratorFunction = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName(\"iterator\"));\n                    if (isTypeAny(iteratorFunction)) {\n                        return undefined;\n                    }\n                    var iteratorFunctionSignatures = iteratorFunction ? getSignaturesOfType(iteratorFunction, 0) : emptyArray;\n                    if (iteratorFunctionSignatures.length === 0) {\n                        if (errorNode) {\n                            error(errorNode, ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator);\n                        }\n                        return undefined;\n                    }\n                    typeAsIterable.iterableElementType = getElementTypeOfIterator(getUnionType(ts.map(iteratorFunctionSignatures, getReturnTypeOfSignature), true), errorNode);\n                }\n            }\n            return typeAsIterable.iterableElementType;\n        }\n        function getElementTypeOfIterator(type, errorNode) {\n            if (isTypeAny(type)) {\n                return undefined;\n            }\n            var typeAsIterator = type;\n            if (!typeAsIterator.iteratorElementType) {\n                if ((getObjectFlags(type) & 4) && type.target === getGlobalIteratorType()) {\n                    typeAsIterator.iteratorElementType = type.typeArguments[0];\n                }\n                else {\n                    var iteratorNextFunction = getTypeOfPropertyOfType(type, \"next\");\n                    if (isTypeAny(iteratorNextFunction)) {\n                        return undefined;\n                    }\n                    var iteratorNextFunctionSignatures = iteratorNextFunction ? getSignaturesOfType(iteratorNextFunction, 0) : emptyArray;\n                    if (iteratorNextFunctionSignatures.length === 0) {\n                        if (errorNode) {\n                            error(errorNode, ts.Diagnostics.An_iterator_must_have_a_next_method);\n                        }\n                        return undefined;\n                    }\n                    var iteratorNextResult = getUnionType(ts.map(iteratorNextFunctionSignatures, getReturnTypeOfSignature), true);\n                    if (isTypeAny(iteratorNextResult)) {\n                        return undefined;\n                    }\n                    var iteratorNextValue = getTypeOfPropertyOfType(iteratorNextResult, \"value\");\n                    if (!iteratorNextValue) {\n                        if (errorNode) {\n                            error(errorNode, ts.Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property);\n                        }\n                        return undefined;\n                    }\n                    typeAsIterator.iteratorElementType = iteratorNextValue;\n                }\n            }\n            return typeAsIterator.iteratorElementType;\n        }\n        function getElementTypeOfIterableIterator(type) {\n            if (isTypeAny(type)) {\n                return undefined;\n            }\n            if ((getObjectFlags(type) & 4) && type.target === getGlobalIterableIteratorType()) {\n                return type.typeArguments[0];\n            }\n            return getElementTypeOfIterable(type, undefined) ||\n                getElementTypeOfIterator(type, undefined);\n        }\n        function checkElementTypeOfArrayOrString(arrayOrStringType, errorNode) {\n            ts.Debug.assert(languageVersion < 2);\n            var arrayType = arrayOrStringType;\n            if (arrayOrStringType.flags & 65536) {\n                var arrayTypes = arrayOrStringType.types;\n                var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178); });\n                if (filteredTypes !== arrayTypes) {\n                    arrayType = getUnionType(filteredTypes, true);\n                }\n            }\n            else if (arrayOrStringType.flags & 262178) {\n                arrayType = neverType;\n            }\n            var hasStringConstituent = arrayOrStringType !== arrayType;\n            var reportedError = false;\n            if (hasStringConstituent) {\n                if (languageVersion < 1) {\n                    error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher);\n                    reportedError = true;\n                }\n                if (arrayType.flags & 8192) {\n                    return stringType;\n                }\n            }\n            if (!isArrayLikeType(arrayType)) {\n                if (!reportedError) {\n                    var diagnostic = hasStringConstituent\n                        ? ts.Diagnostics.Type_0_is_not_an_array_type\n                        : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type;\n                    error(errorNode, diagnostic, typeToString(arrayType));\n                }\n                return hasStringConstituent ? stringType : unknownType;\n            }\n            var arrayElementType = getIndexTypeOfType(arrayType, 1) || unknownType;\n            if (hasStringConstituent) {\n                if (arrayElementType.flags & 262178) {\n                    return stringType;\n                }\n                return getUnionType([arrayElementType, stringType], true);\n            }\n            return arrayElementType;\n        }\n        function checkBreakOrContinueStatement(node) {\n            checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node);\n        }\n        function isGetAccessorWithAnnotatedSetAccessor(node) {\n            return !!(node.kind === 151 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 152)));\n        }\n        function isUnwrappedReturnTypeVoidOrAny(func, returnType) {\n            var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType;\n            return unwrappedReturnType && maybeTypeOfKind(unwrappedReturnType, 1024 | 1);\n        }\n        function checkReturnStatement(node) {\n            if (!checkGrammarStatementInAmbientContext(node)) {\n                var functionBlock = ts.getContainingFunction(node);\n                if (!functionBlock) {\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body);\n                }\n            }\n            var func = ts.getContainingFunction(node);\n            if (func) {\n                var signature = getSignatureFromDeclaration(func);\n                var returnType = getReturnTypeOfSignature(signature);\n                if (strictNullChecks || node.expression || returnType.flags & 8192) {\n                    var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType;\n                    if (func.asteriskToken) {\n                        return;\n                    }\n                    if (func.kind === 152) {\n                        if (node.expression) {\n                            error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value);\n                        }\n                    }\n                    else if (func.kind === 150) {\n                        if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) {\n                            error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);\n                        }\n                    }\n                    else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) {\n                        if (ts.isAsyncFunctionLike(func)) {\n                            var promisedType = getPromisedType(returnType);\n                            var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member);\n                            if (promisedType) {\n                                checkTypeAssignableTo(awaitedType, promisedType, node.expression || node);\n                            }\n                        }\n                        else {\n                            checkTypeAssignableTo(exprType, returnType, node.expression || node);\n                        }\n                    }\n                }\n                else if (func.kind !== 150 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) {\n                    error(node, ts.Diagnostics.Not_all_code_paths_return_a_value);\n                }\n            }\n        }\n        function checkWithStatement(node) {\n            if (!checkGrammarStatementInAmbientContext(node)) {\n                if (node.flags & 16384) {\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block);\n                }\n            }\n            checkExpression(node.expression);\n            var sourceFile = ts.getSourceFileOfNode(node);\n            if (!hasParseDiagnostics(sourceFile)) {\n                var start = ts.getSpanOfTokenAtPosition(sourceFile, node.pos).start;\n                var end = node.statement.pos;\n                grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any);\n            }\n        }\n        function checkSwitchStatement(node) {\n            checkGrammarStatementInAmbientContext(node);\n            var firstDefaultClause;\n            var hasDuplicateDefaultClause = false;\n            var expressionType = checkExpression(node.expression);\n            var expressionIsLiteral = isLiteralType(expressionType);\n            ts.forEach(node.caseBlock.clauses, function (clause) {\n                if (clause.kind === 254 && !hasDuplicateDefaultClause) {\n                    if (firstDefaultClause === undefined) {\n                        firstDefaultClause = clause;\n                    }\n                    else {\n                        var sourceFile = ts.getSourceFileOfNode(node);\n                        var start = ts.skipTrivia(sourceFile.text, clause.pos);\n                        var end = clause.statements.length > 0 ? clause.statements[0].pos : clause.end;\n                        grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement);\n                        hasDuplicateDefaultClause = true;\n                    }\n                }\n                if (produceDiagnostics && clause.kind === 253) {\n                    var caseClause = clause;\n                    var caseType = checkExpression(caseClause.expression);\n                    var caseIsLiteral = isLiteralType(caseType);\n                    var comparedExpressionType = expressionType;\n                    if (!caseIsLiteral || !expressionIsLiteral) {\n                        caseType = caseIsLiteral ? getBaseTypeOfLiteralType(caseType) : caseType;\n                        comparedExpressionType = getBaseTypeOfLiteralType(expressionType);\n                    }\n                    if (!isTypeEqualityComparableTo(comparedExpressionType, caseType)) {\n                        checkTypeComparableTo(caseType, comparedExpressionType, caseClause.expression, undefined);\n                    }\n                }\n                ts.forEach(clause.statements, checkSourceElement);\n            });\n            if (node.caseBlock.locals) {\n                registerForUnusedIdentifiersCheck(node.caseBlock);\n            }\n        }\n        function checkLabeledStatement(node) {\n            if (!checkGrammarStatementInAmbientContext(node)) {\n                var current = node.parent;\n                while (current) {\n                    if (ts.isFunctionLike(current)) {\n                        break;\n                    }\n                    if (current.kind === 219 && current.label.text === node.label.text) {\n                        var sourceFile = ts.getSourceFileOfNode(node);\n                        grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label));\n                        break;\n                    }\n                    current = current.parent;\n                }\n            }\n            checkSourceElement(node.statement);\n        }\n        function checkThrowStatement(node) {\n            if (!checkGrammarStatementInAmbientContext(node)) {\n                if (node.expression === undefined) {\n                    grammarErrorAfterFirstToken(node, ts.Diagnostics.Line_break_not_permitted_here);\n                }\n            }\n            if (node.expression) {\n                checkExpression(node.expression);\n            }\n        }\n        function checkTryStatement(node) {\n            checkGrammarStatementInAmbientContext(node);\n            checkBlock(node.tryBlock);\n            var catchClause = node.catchClause;\n            if (catchClause) {\n                if (catchClause.variableDeclaration) {\n                    if (catchClause.variableDeclaration.type) {\n                        grammarErrorOnFirstToken(catchClause.variableDeclaration.type, ts.Diagnostics.Catch_clause_variable_cannot_have_a_type_annotation);\n                    }\n                    else if (catchClause.variableDeclaration.initializer) {\n                        grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer);\n                    }\n                    else {\n                        var blockLocals = catchClause.block.locals;\n                        if (blockLocals) {\n                            for (var caughtName in catchClause.locals) {\n                                var blockLocal = blockLocals[caughtName];\n                                if (blockLocal && (blockLocal.flags & 2) !== 0) {\n                                    grammarErrorOnNode(blockLocal.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName);\n                                }\n                            }\n                        }\n                    }\n                }\n                checkBlock(catchClause.block);\n            }\n            if (node.finallyBlock) {\n                checkBlock(node.finallyBlock);\n            }\n        }\n        function checkIndexConstraints(type) {\n            var declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, 1);\n            var declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, 0);\n            var stringIndexType = getIndexTypeOfType(type, 0);\n            var numberIndexType = getIndexTypeOfType(type, 1);\n            if (stringIndexType || numberIndexType) {\n                ts.forEach(getPropertiesOfObjectType(type), function (prop) {\n                    var propType = getTypeOfSymbol(prop);\n                    checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0);\n                    checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1);\n                });\n                if (getObjectFlags(type) & 1 && ts.isClassLike(type.symbol.valueDeclaration)) {\n                    var classDeclaration = type.symbol.valueDeclaration;\n                    for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) {\n                        var member = _a[_i];\n                        if (!(ts.getModifierFlags(member) & 32) && ts.hasDynamicName(member)) {\n                            var propType = getTypeOfSymbol(member.symbol);\n                            checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0);\n                            checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1);\n                        }\n                    }\n                }\n            }\n            var errorNode;\n            if (stringIndexType && numberIndexType) {\n                errorNode = declaredNumberIndexer || declaredStringIndexer;\n                if (!errorNode && (getObjectFlags(type) & 2)) {\n                    var someBaseTypeHasBothIndexers = ts.forEach(getBaseTypes(type), function (base) { return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); });\n                    errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0];\n                }\n            }\n            if (errorNode && !isTypeAssignableTo(numberIndexType, stringIndexType)) {\n                error(errorNode, ts.Diagnostics.Numeric_index_type_0_is_not_assignable_to_string_index_type_1, typeToString(numberIndexType), typeToString(stringIndexType));\n            }\n            function checkIndexConstraintForProperty(prop, propertyType, containingType, indexDeclaration, indexType, indexKind) {\n                if (!indexType) {\n                    return;\n                }\n                if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) {\n                    return;\n                }\n                var errorNode;\n                if (prop.valueDeclaration.name.kind === 142 || prop.parent === containingType.symbol) {\n                    errorNode = prop.valueDeclaration;\n                }\n                else if (indexDeclaration) {\n                    errorNode = indexDeclaration;\n                }\n                else if (getObjectFlags(containingType) & 2) {\n                    var someBaseClassHasBothPropertyAndIndexer = ts.forEach(getBaseTypes(containingType), function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); });\n                    errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0];\n                }\n                if (errorNode && !isTypeAssignableTo(propertyType, indexType)) {\n                    var errorMessage = indexKind === 0\n                        ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2\n                        : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2;\n                    error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType));\n                }\n            }\n        }\n        function checkTypeNameIsReserved(name, message) {\n            switch (name.text) {\n                case \"any\":\n                case \"number\":\n                case \"boolean\":\n                case \"string\":\n                case \"symbol\":\n                case \"void\":\n                    error(name, message, name.text);\n            }\n        }\n        function checkTypeParameters(typeParameterDeclarations) {\n            if (typeParameterDeclarations) {\n                for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) {\n                    var node = typeParameterDeclarations[i];\n                    checkTypeParameter(node);\n                    if (produceDiagnostics) {\n                        for (var j = 0; j < i; j++) {\n                            if (typeParameterDeclarations[j].symbol === node.symbol) {\n                                error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name));\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        function checkTypeParameterListsIdentical(node, symbol) {\n            if (symbol.declarations.length === 1) {\n                return;\n            }\n            var firstDecl;\n            for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                var declaration = _a[_i];\n                if (declaration.kind === 226 || declaration.kind === 227) {\n                    if (!firstDecl) {\n                        firstDecl = declaration;\n                    }\n                    else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) {\n                        error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text);\n                    }\n                }\n            }\n        }\n        function checkClassExpression(node) {\n            checkClassLikeDeclaration(node);\n            checkNodeDeferred(node);\n            return getTypeOfSymbol(getSymbolOfNode(node));\n        }\n        function checkClassExpressionDeferred(node) {\n            ts.forEach(node.members, checkSourceElement);\n            registerForUnusedIdentifiersCheck(node);\n        }\n        function checkClassDeclaration(node) {\n            if (!node.name && !(ts.getModifierFlags(node) & 512)) {\n                grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name);\n            }\n            checkClassLikeDeclaration(node);\n            ts.forEach(node.members, checkSourceElement);\n            registerForUnusedIdentifiersCheck(node);\n        }\n        function checkClassLikeDeclaration(node) {\n            checkGrammarClassDeclarationHeritageClauses(node);\n            checkDecorators(node);\n            if (node.name) {\n                checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0);\n                checkCollisionWithCapturedThisVariable(node, node.name);\n                checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n                checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n            }\n            checkTypeParameters(node.typeParameters);\n            checkExportsOnMergedDeclarations(node);\n            var symbol = getSymbolOfNode(node);\n            var type = getDeclaredTypeOfSymbol(symbol);\n            var typeWithThis = getTypeWithThisArgument(type);\n            var staticType = getTypeOfSymbol(symbol);\n            checkTypeParameterListsIdentical(node, symbol);\n            checkClassForDuplicateDeclarations(node);\n            var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node);\n            if (baseTypeNode) {\n                if (languageVersion < 2) {\n                    checkExternalEmitHelpers(baseTypeNode.parent, 1);\n                }\n                var baseTypes = getBaseTypes(type);\n                if (baseTypes.length && produceDiagnostics) {\n                    var baseType_1 = baseTypes[0];\n                    var staticBaseType = getBaseConstructorTypeOfClass(type);\n                    checkBaseTypeAccessibility(staticBaseType, baseTypeNode);\n                    checkSourceElement(baseTypeNode.expression);\n                    if (baseTypeNode.typeArguments) {\n                        ts.forEach(baseTypeNode.typeArguments, checkSourceElement);\n                        for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); _i < _a.length; _i++) {\n                            var constructor = _a[_i];\n                            if (!checkTypeArgumentConstraints(constructor.typeParameters, baseTypeNode.typeArguments)) {\n                                break;\n                            }\n                        }\n                    }\n                    checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1);\n                    checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1);\n                    if (baseType_1.symbol.valueDeclaration &&\n                        !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) &&\n                        baseType_1.symbol.valueDeclaration.kind === 226) {\n                        if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) {\n                            error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class);\n                        }\n                    }\n                    if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32)) {\n                        var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments);\n                        if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1; })) {\n                            error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type);\n                        }\n                    }\n                    checkKindsOfPropertyMemberOverrides(type, baseType_1);\n                }\n            }\n            var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node);\n            if (implementedTypeNodes) {\n                for (var _b = 0, implementedTypeNodes_1 = implementedTypeNodes; _b < implementedTypeNodes_1.length; _b++) {\n                    var typeRefNode = implementedTypeNodes_1[_b];\n                    if (!ts.isEntityNameExpression(typeRefNode.expression)) {\n                        error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments);\n                    }\n                    checkTypeReferenceNode(typeRefNode);\n                    if (produceDiagnostics) {\n                        var t = getTypeFromTypeNode(typeRefNode);\n                        if (t !== unknownType) {\n                            var declaredType = getObjectFlags(t) & 4 ? t.target : t;\n                            if (getObjectFlags(declaredType) & 3) {\n                                checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1);\n                            }\n                            else {\n                                error(typeRefNode, ts.Diagnostics.A_class_may_only_implement_another_class_or_interface);\n                            }\n                        }\n                    }\n                }\n            }\n            if (produceDiagnostics) {\n                checkIndexConstraints(type);\n                checkTypeForDuplicateIndexSignatures(node);\n            }\n        }\n        function checkBaseTypeAccessibility(type, node) {\n            var signatures = getSignaturesOfType(type, 1);\n            if (signatures.length) {\n                var declaration = signatures[0].declaration;\n                if (declaration && ts.getModifierFlags(declaration) & 8) {\n                    var typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol);\n                    if (!isNodeWithinClass(node, typeClassDeclaration)) {\n                        error(node, ts.Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol));\n                    }\n                }\n            }\n        }\n        function getTargetSymbol(s) {\n            return s.flags & 16777216 ? getSymbolLinks(s).target : s;\n        }\n        function getClassLikeDeclarationOfSymbol(symbol) {\n            return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; });\n        }\n        function checkKindsOfPropertyMemberOverrides(type, baseType) {\n            var baseProperties = getPropertiesOfObjectType(baseType);\n            for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {\n                var baseProperty = baseProperties_1[_i];\n                var base = getTargetSymbol(baseProperty);\n                if (base.flags & 134217728) {\n                    continue;\n                }\n                var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name));\n                var baseDeclarationFlags = getDeclarationModifierFlagsFromSymbol(base);\n                ts.Debug.assert(!!derived, \"derived should point to something, even if it is the base class' declaration.\");\n                if (derived) {\n                    if (derived === base) {\n                        var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol);\n                        if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128))) {\n                            if (derivedClassDecl.kind === 197) {\n                                error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));\n                            }\n                            else {\n                                error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType));\n                            }\n                        }\n                    }\n                    else {\n                        var derivedDeclarationFlags = getDeclarationModifierFlagsFromSymbol(derived);\n                        if ((baseDeclarationFlags & 8) || (derivedDeclarationFlags & 8)) {\n                            continue;\n                        }\n                        if ((baseDeclarationFlags & 32) !== (derivedDeclarationFlags & 32)) {\n                            continue;\n                        }\n                        if ((base.flags & derived.flags & 8192) || ((base.flags & 98308) && (derived.flags & 98308))) {\n                            continue;\n                        }\n                        var errorMessage = void 0;\n                        if (base.flags & 8192) {\n                            if (derived.flags & 98304) {\n                                errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;\n                            }\n                            else {\n                                ts.Debug.assert((derived.flags & 4) !== 0);\n                                errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property;\n                            }\n                        }\n                        else if (base.flags & 4) {\n                            ts.Debug.assert((derived.flags & 8192) !== 0);\n                            errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;\n                        }\n                        else {\n                            ts.Debug.assert((base.flags & 98304) !== 0);\n                            ts.Debug.assert((derived.flags & 8192) !== 0);\n                            errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;\n                        }\n                        error(derived.valueDeclaration.name, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));\n                    }\n                }\n            }\n        }\n        function isAccessor(kind) {\n            return kind === 151 || kind === 152;\n        }\n        function areTypeParametersIdentical(list1, list2) {\n            if (!list1 && !list2) {\n                return true;\n            }\n            if (!list1 || !list2 || list1.length !== list2.length) {\n                return false;\n            }\n            for (var i = 0, len = list1.length; i < len; i++) {\n                var tp1 = list1[i];\n                var tp2 = list2[i];\n                if (tp1.name.text !== tp2.name.text) {\n                    return false;\n                }\n                if (!tp1.constraint && !tp2.constraint) {\n                    continue;\n                }\n                if (!tp1.constraint || !tp2.constraint) {\n                    return false;\n                }\n                if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) {\n                    return false;\n                }\n            }\n            return true;\n        }\n        function checkInheritedPropertiesAreIdentical(type, typeNode) {\n            var baseTypes = getBaseTypes(type);\n            if (baseTypes.length < 2) {\n                return true;\n            }\n            var seen = ts.createMap();\n            ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; });\n            var ok = true;\n            for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) {\n                var base = baseTypes_2[_i];\n                var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType));\n                for (var _a = 0, properties_7 = properties; _a < properties_7.length; _a++) {\n                    var prop = properties_7[_a];\n                    var existing = seen[prop.name];\n                    if (!existing) {\n                        seen[prop.name] = { prop: prop, containingType: base };\n                    }\n                    else {\n                        var isInheritedProperty = existing.containingType !== type;\n                        if (isInheritedProperty && !isPropertyIdenticalTo(existing.prop, prop)) {\n                            ok = false;\n                            var typeName1 = typeToString(existing.containingType);\n                            var typeName2 = typeToString(base);\n                            var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2);\n                            errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2);\n                            diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo));\n                        }\n                    }\n                }\n            }\n            return ok;\n        }\n        function checkInterfaceDeclaration(node) {\n            checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarInterfaceDeclaration(node);\n            checkTypeParameters(node.typeParameters);\n            if (produceDiagnostics) {\n                checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0);\n                checkExportsOnMergedDeclarations(node);\n                var symbol = getSymbolOfNode(node);\n                checkTypeParameterListsIdentical(node, symbol);\n                var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 227);\n                if (node === firstInterfaceDecl) {\n                    var type = getDeclaredTypeOfSymbol(symbol);\n                    var typeWithThis = getTypeWithThisArgument(type);\n                    if (checkInheritedPropertiesAreIdentical(type, node.name)) {\n                        for (var _i = 0, _a = getBaseTypes(type); _i < _a.length; _i++) {\n                            var baseType = _a[_i];\n                            checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1);\n                        }\n                        checkIndexConstraints(type);\n                    }\n                }\n                checkObjectTypeForDuplicateDeclarations(node);\n            }\n            ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) {\n                if (!ts.isEntityNameExpression(heritageElement.expression)) {\n                    error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments);\n                }\n                checkTypeReferenceNode(heritageElement);\n            });\n            ts.forEach(node.members, checkSourceElement);\n            if (produceDiagnostics) {\n                checkTypeForDuplicateIndexSignatures(node);\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkTypeAliasDeclaration(node) {\n            checkGrammarDecorators(node) || checkGrammarModifiers(node);\n            checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0);\n            checkTypeParameters(node.typeParameters);\n            checkSourceElement(node.type);\n        }\n        function computeEnumMemberValues(node) {\n            var nodeLinks = getNodeLinks(node);\n            if (!(nodeLinks.flags & 16384)) {\n                var enumSymbol = getSymbolOfNode(node);\n                var enumType = getDeclaredTypeOfSymbol(enumSymbol);\n                var autoValue = 0;\n                var ambient = ts.isInAmbientContext(node);\n                var enumIsConst = ts.isConst(node);\n                for (var _i = 0, _a = node.members; _i < _a.length; _i++) {\n                    var member = _a[_i];\n                    if (isComputedNonLiteralName(member.name)) {\n                        error(member.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums);\n                    }\n                    else {\n                        var text = ts.getTextOfPropertyName(member.name);\n                        if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {\n                            error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name);\n                        }\n                    }\n                    var previousEnumMemberIsNonConstant = autoValue === undefined;\n                    var initializer = member.initializer;\n                    if (initializer) {\n                        autoValue = computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient);\n                    }\n                    else if (ambient && !enumIsConst) {\n                        autoValue = undefined;\n                    }\n                    else if (previousEnumMemberIsNonConstant) {\n                        error(member.name, ts.Diagnostics.Enum_member_must_have_initializer);\n                    }\n                    if (autoValue !== undefined) {\n                        getNodeLinks(member).enumMemberValue = autoValue;\n                        autoValue++;\n                    }\n                }\n                nodeLinks.flags |= 16384;\n            }\n            function computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient) {\n                var reportError = true;\n                var value = evalConstant(initializer);\n                if (reportError) {\n                    if (value === undefined) {\n                        if (enumIsConst) {\n                            error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression);\n                        }\n                        else if (ambient) {\n                            error(initializer, ts.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);\n                        }\n                        else {\n                            checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, undefined);\n                        }\n                    }\n                    else if (enumIsConst) {\n                        if (isNaN(value)) {\n                            error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN);\n                        }\n                        else if (!isFinite(value)) {\n                            error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value);\n                        }\n                    }\n                }\n                return value;\n                function evalConstant(e) {\n                    switch (e.kind) {\n                        case 190:\n                            var value_1 = evalConstant(e.operand);\n                            if (value_1 === undefined) {\n                                return undefined;\n                            }\n                            switch (e.operator) {\n                                case 36: return value_1;\n                                case 37: return -value_1;\n                                case 51: return ~value_1;\n                            }\n                            return undefined;\n                        case 192:\n                            var left = evalConstant(e.left);\n                            if (left === undefined) {\n                                return undefined;\n                            }\n                            var right = evalConstant(e.right);\n                            if (right === undefined) {\n                                return undefined;\n                            }\n                            switch (e.operatorToken.kind) {\n                                case 48: return left | right;\n                                case 47: return left & right;\n                                case 45: return left >> right;\n                                case 46: return left >>> right;\n                                case 44: return left << right;\n                                case 49: return left ^ right;\n                                case 38: return left * right;\n                                case 40: return left / right;\n                                case 36: return left + right;\n                                case 37: return left - right;\n                                case 41: return left % right;\n                            }\n                            return undefined;\n                        case 8:\n                            return +e.text;\n                        case 183:\n                            return evalConstant(e.expression);\n                        case 70:\n                        case 178:\n                        case 177:\n                            var member = initializer.parent;\n                            var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent));\n                            var enumType_1;\n                            var propertyName = void 0;\n                            if (e.kind === 70) {\n                                enumType_1 = currentType;\n                                propertyName = e.text;\n                            }\n                            else {\n                                var expression = void 0;\n                                if (e.kind === 178) {\n                                    if (e.argumentExpression === undefined ||\n                                        e.argumentExpression.kind !== 9) {\n                                        return undefined;\n                                    }\n                                    expression = e.expression;\n                                    propertyName = e.argumentExpression.text;\n                                }\n                                else {\n                                    expression = e.expression;\n                                    propertyName = e.name.text;\n                                }\n                                var current = expression;\n                                while (current) {\n                                    if (current.kind === 70) {\n                                        break;\n                                    }\n                                    else if (current.kind === 177) {\n                                        current = current.expression;\n                                    }\n                                    else {\n                                        return undefined;\n                                    }\n                                }\n                                enumType_1 = getTypeOfExpression(expression);\n                                if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384))) {\n                                    return undefined;\n                                }\n                            }\n                            if (propertyName === undefined) {\n                                return undefined;\n                            }\n                            var property = getPropertyOfObjectType(enumType_1, propertyName);\n                            if (!property || !(property.flags & 8)) {\n                                return undefined;\n                            }\n                            var propertyDecl = property.valueDeclaration;\n                            if (member === propertyDecl) {\n                                return undefined;\n                            }\n                            if (!isBlockScopedNameDeclaredBeforeUse(propertyDecl, member)) {\n                                reportError = false;\n                                error(e, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);\n                                return undefined;\n                            }\n                            return getNodeLinks(propertyDecl).enumMemberValue;\n                    }\n                }\n            }\n        }\n        function checkEnumDeclaration(node) {\n            if (!produceDiagnostics) {\n                return;\n            }\n            checkGrammarDecorators(node) || checkGrammarModifiers(node);\n            checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0);\n            checkCollisionWithCapturedThisVariable(node, node.name);\n            checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n            checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n            checkExportsOnMergedDeclarations(node);\n            computeEnumMemberValues(node);\n            var enumIsConst = ts.isConst(node);\n            if (compilerOptions.isolatedModules && enumIsConst && ts.isInAmbientContext(node)) {\n                error(node.name, ts.Diagnostics.Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided);\n            }\n            var enumSymbol = getSymbolOfNode(node);\n            var firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind);\n            if (node === firstDeclaration) {\n                if (enumSymbol.declarations.length > 1) {\n                    ts.forEach(enumSymbol.declarations, function (decl) {\n                        if (ts.isConstEnumDeclaration(decl) !== enumIsConst) {\n                            error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const);\n                        }\n                    });\n                }\n                var seenEnumMissingInitialInitializer_1 = false;\n                ts.forEach(enumSymbol.declarations, function (declaration) {\n                    if (declaration.kind !== 229) {\n                        return false;\n                    }\n                    var enumDeclaration = declaration;\n                    if (!enumDeclaration.members.length) {\n                        return false;\n                    }\n                    var firstEnumMember = enumDeclaration.members[0];\n                    if (!firstEnumMember.initializer) {\n                        if (seenEnumMissingInitialInitializer_1) {\n                            error(firstEnumMember.name, ts.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element);\n                        }\n                        else {\n                            seenEnumMissingInitialInitializer_1 = true;\n                        }\n                    }\n                });\n            }\n        }\n        function getFirstNonAmbientClassOrFunctionDeclaration(symbol) {\n            var declarations = symbol.declarations;\n            for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {\n                var declaration = declarations_5[_i];\n                if ((declaration.kind === 226 ||\n                    (declaration.kind === 225 && ts.nodeIsPresent(declaration.body))) &&\n                    !ts.isInAmbientContext(declaration)) {\n                    return declaration;\n                }\n            }\n            return undefined;\n        }\n        function inSameLexicalScope(node1, node2) {\n            var container1 = ts.getEnclosingBlockScopeContainer(node1);\n            var container2 = ts.getEnclosingBlockScopeContainer(node2);\n            if (isGlobalSourceFile(container1)) {\n                return isGlobalSourceFile(container2);\n            }\n            else if (isGlobalSourceFile(container2)) {\n                return false;\n            }\n            else {\n                return container1 === container2;\n            }\n        }\n        function checkModuleDeclaration(node) {\n            if (produceDiagnostics) {\n                var isGlobalAugmentation = ts.isGlobalScopeAugmentation(node);\n                var inAmbientContext = ts.isInAmbientContext(node);\n                if (isGlobalAugmentation && !inAmbientContext) {\n                    error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context);\n                }\n                var isAmbientExternalModule = ts.isAmbientModule(node);\n                var contextErrorMessage = isAmbientExternalModule\n                    ? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file\n                    : ts.Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module;\n                if (checkGrammarModuleElementContext(node, contextErrorMessage)) {\n                    return;\n                }\n                if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node)) {\n                    if (!inAmbientContext && node.name.kind === 9) {\n                        grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names);\n                    }\n                }\n                if (ts.isIdentifier(node.name)) {\n                    checkCollisionWithCapturedThisVariable(node, node.name);\n                    checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n                    checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n                }\n                checkExportsOnMergedDeclarations(node);\n                var symbol = getSymbolOfNode(node);\n                if (symbol.flags & 512\n                    && symbol.declarations.length > 1\n                    && !inAmbientContext\n                    && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules)) {\n                    var firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);\n                    if (firstNonAmbientClassOrFunc) {\n                        if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(firstNonAmbientClassOrFunc)) {\n                            error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged);\n                        }\n                        else if (node.pos < firstNonAmbientClassOrFunc.pos) {\n                            error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);\n                        }\n                    }\n                    var mergedClass = ts.getDeclarationOfKind(symbol, 226);\n                    if (mergedClass &&\n                        inSameLexicalScope(node, mergedClass)) {\n                        getNodeLinks(node).flags |= 32768;\n                    }\n                }\n                if (isAmbientExternalModule) {\n                    if (ts.isExternalModuleAugmentation(node)) {\n                        var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 33554432);\n                        if (checkBody && node.body) {\n                            for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) {\n                                var statement = _a[_i];\n                                checkModuleAugmentationElement(statement, isGlobalAugmentation);\n                            }\n                        }\n                    }\n                    else if (isGlobalSourceFile(node.parent)) {\n                        if (isGlobalAugmentation) {\n                            error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);\n                        }\n                        else if (ts.isExternalModuleNameRelative(node.name.text)) {\n                            error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name);\n                        }\n                    }\n                    else {\n                        if (isGlobalAugmentation) {\n                            error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);\n                        }\n                        else {\n                            error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces);\n                        }\n                    }\n                }\n            }\n            if (node.body) {\n                checkSourceElement(node.body);\n                if (!ts.isGlobalScopeAugmentation(node)) {\n                    registerForUnusedIdentifiersCheck(node);\n                }\n            }\n        }\n        function checkModuleAugmentationElement(node, isGlobalAugmentation) {\n            switch (node.kind) {\n                case 205:\n                    for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                        var decl = _a[_i];\n                        checkModuleAugmentationElement(decl, isGlobalAugmentation);\n                    }\n                    break;\n                case 240:\n                case 241:\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);\n                    break;\n                case 234:\n                case 235:\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);\n                    break;\n                case 174:\n                case 223:\n                    var name_25 = node.name;\n                    if (ts.isBindingPattern(name_25)) {\n                        for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) {\n                            var el = _c[_b];\n                            checkModuleAugmentationElement(el, isGlobalAugmentation);\n                        }\n                        break;\n                    }\n                case 226:\n                case 229:\n                case 225:\n                case 227:\n                case 230:\n                case 228:\n                    if (isGlobalAugmentation) {\n                        return;\n                    }\n                    var symbol = getSymbolOfNode(node);\n                    if (symbol) {\n                        var reportError = !(symbol.flags & 33554432);\n                        if (!reportError) {\n                            reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]);\n                        }\n                    }\n                    break;\n            }\n        }\n        function getFirstIdentifier(node) {\n            switch (node.kind) {\n                case 70:\n                    return node;\n                case 141:\n                    do {\n                        node = node.left;\n                    } while (node.kind !== 70);\n                    return node;\n                case 177:\n                    do {\n                        node = node.expression;\n                    } while (node.kind !== 70);\n                    return node;\n            }\n        }\n        function checkExternalImportOrExportDeclaration(node) {\n            var moduleName = ts.getExternalModuleName(node);\n            if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 9) {\n                error(moduleName, ts.Diagnostics.String_literal_expected);\n                return false;\n            }\n            var inAmbientExternalModule = node.parent.kind === 231 && ts.isAmbientModule(node.parent.parent);\n            if (node.parent.kind !== 261 && !inAmbientExternalModule) {\n                error(moduleName, node.kind === 241 ?\n                    ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace :\n                    ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);\n                return false;\n            }\n            if (inAmbientExternalModule && ts.isExternalModuleNameRelative(moduleName.text)) {\n                if (!isTopLevelInExternalModuleAugmentation(node)) {\n                    error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name);\n                    return false;\n                }\n            }\n            return true;\n        }\n        function checkAliasSymbol(node) {\n            var symbol = getSymbolOfNode(node);\n            var target = resolveAlias(symbol);\n            if (target !== unknownSymbol) {\n                var excludedMeanings = (symbol.flags & (107455 | 1048576) ? 107455 : 0) |\n                    (symbol.flags & 793064 ? 793064 : 0) |\n                    (symbol.flags & 1920 ? 1920 : 0);\n                if (target.flags & excludedMeanings) {\n                    var message = node.kind === 243 ?\n                        ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :\n                        ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;\n                    error(node, message, symbolToString(symbol));\n                }\n            }\n        }\n        function checkImportBinding(node) {\n            checkCollisionWithCapturedThisVariable(node, node.name);\n            checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n            checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n            checkAliasSymbol(node);\n        }\n        function checkImportDeclaration(node) {\n            if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) {\n                return;\n            }\n            if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) {\n                grammarErrorOnFirstToken(node, ts.Diagnostics.An_import_declaration_cannot_have_modifiers);\n            }\n            if (checkExternalImportOrExportDeclaration(node)) {\n                var importClause = node.importClause;\n                if (importClause) {\n                    if (importClause.name) {\n                        checkImportBinding(importClause);\n                    }\n                    if (importClause.namedBindings) {\n                        if (importClause.namedBindings.kind === 237) {\n                            checkImportBinding(importClause.namedBindings);\n                        }\n                        else {\n                            ts.forEach(importClause.namedBindings.elements, checkImportBinding);\n                        }\n                    }\n                }\n            }\n        }\n        function checkImportEqualsDeclaration(node) {\n            if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) {\n                return;\n            }\n            checkGrammarDecorators(node) || checkGrammarModifiers(node);\n            if (ts.isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {\n                checkImportBinding(node);\n                if (ts.getModifierFlags(node) & 1) {\n                    markExportAsReferenced(node);\n                }\n                if (ts.isInternalModuleImportEqualsDeclaration(node)) {\n                    var target = resolveAlias(getSymbolOfNode(node));\n                    if (target !== unknownSymbol) {\n                        if (target.flags & 107455) {\n                            var moduleName = getFirstIdentifier(node.moduleReference);\n                            if (!(resolveEntityName(moduleName, 107455 | 1920).flags & 1920)) {\n                                error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName));\n                            }\n                        }\n                        if (target.flags & 793064) {\n                            checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0);\n                        }\n                    }\n                }\n                else {\n                    if (modulekind === ts.ModuleKind.ES2015 && !ts.isInAmbientContext(node)) {\n                        grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);\n                    }\n                }\n            }\n        }\n        function checkExportDeclaration(node) {\n            if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module)) {\n                return;\n            }\n            if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) {\n                grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers);\n            }\n            if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) {\n                if (node.exportClause) {\n                    ts.forEach(node.exportClause.elements, checkExportSpecifier);\n                    var inAmbientExternalModule = node.parent.kind === 231 && ts.isAmbientModule(node.parent.parent);\n                    if (node.parent.kind !== 261 && !inAmbientExternalModule) {\n                        error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);\n                    }\n                }\n                else {\n                    var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);\n                    if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) {\n                        error(node.moduleSpecifier, ts.Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));\n                    }\n                }\n            }\n        }\n        function checkGrammarModuleElementContext(node, errorMessage) {\n            var isInAppropriateContext = node.parent.kind === 261 || node.parent.kind === 231 || node.parent.kind === 230;\n            if (!isInAppropriateContext) {\n                grammarErrorOnFirstToken(node, errorMessage);\n            }\n            return !isInAppropriateContext;\n        }\n        function checkExportSpecifier(node) {\n            checkAliasSymbol(node);\n            if (!node.parent.parent.moduleSpecifier) {\n                var exportedName = node.propertyName || node.name;\n                var symbol = resolveName(exportedName, exportedName.text, 107455 | 793064 | 1920 | 8388608, undefined, undefined);\n                if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {\n                    error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, exportedName.text);\n                }\n                else {\n                    markExportAsReferenced(node);\n                }\n            }\n        }\n        function checkExportAssignment(node) {\n            if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) {\n                return;\n            }\n            var container = node.parent.kind === 261 ? node.parent : node.parent.parent;\n            if (container.kind === 230 && !ts.isAmbientModule(container)) {\n                error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);\n                return;\n            }\n            if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) {\n                grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);\n            }\n            if (node.expression.kind === 70) {\n                markExportAsReferenced(node);\n            }\n            else {\n                checkExpressionCached(node.expression);\n            }\n            checkExternalModuleExports(container);\n            if (node.isExportEquals && !ts.isInAmbientContext(node)) {\n                if (modulekind === ts.ModuleKind.ES2015) {\n                    grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_default_or_another_module_format_instead);\n                }\n                else if (modulekind === ts.ModuleKind.System) {\n                    grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);\n                }\n            }\n        }\n        function hasExportedMembers(moduleSymbol) {\n            for (var id in moduleSymbol.exports) {\n                if (id !== \"export=\") {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function checkExternalModuleExports(node) {\n            var moduleSymbol = getSymbolOfNode(node);\n            var links = getSymbolLinks(moduleSymbol);\n            if (!links.exportsChecked) {\n                var exportEqualsSymbol = moduleSymbol.exports[\"export=\"];\n                if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) {\n                    var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration;\n                    if (!isTopLevelInExternalModuleAugmentation(declaration)) {\n                        error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);\n                    }\n                }\n                var exports = getExportsOfModule(moduleSymbol);\n                for (var id in exports) {\n                    if (id === \"__export\") {\n                        continue;\n                    }\n                    var _a = exports[id], declarations = _a.declarations, flags = _a.flags;\n                    if (flags & (1920 | 64 | 384)) {\n                        continue;\n                    }\n                    var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload);\n                    if (flags & 524288 && exportedDeclarationsCount <= 2) {\n                        continue;\n                    }\n                    if (exportedDeclarationsCount > 1) {\n                        for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {\n                            var declaration = declarations_6[_i];\n                            if (isNotOverload(declaration)) {\n                                diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, id));\n                            }\n                        }\n                    }\n                }\n                links.exportsChecked = true;\n            }\n            function isNotOverload(declaration) {\n                return (declaration.kind !== 225 && declaration.kind !== 149) ||\n                    !!declaration.body;\n            }\n        }\n        function checkSourceElement(node) {\n            if (!node) {\n                return;\n            }\n            var kind = node.kind;\n            if (cancellationToken) {\n                switch (kind) {\n                    case 230:\n                    case 226:\n                    case 227:\n                    case 225:\n                        cancellationToken.throwIfCancellationRequested();\n                }\n            }\n            switch (kind) {\n                case 143:\n                    return checkTypeParameter(node);\n                case 144:\n                    return checkParameter(node);\n                case 147:\n                case 146:\n                    return checkPropertyDeclaration(node);\n                case 158:\n                case 159:\n                case 153:\n                case 154:\n                    return checkSignatureDeclaration(node);\n                case 155:\n                    return checkSignatureDeclaration(node);\n                case 149:\n                case 148:\n                    return checkMethodDeclaration(node);\n                case 150:\n                    return checkConstructorDeclaration(node);\n                case 151:\n                case 152:\n                    return checkAccessorDeclaration(node);\n                case 157:\n                    return checkTypeReferenceNode(node);\n                case 156:\n                    return checkTypePredicate(node);\n                case 160:\n                    return checkTypeQuery(node);\n                case 161:\n                    return checkTypeLiteral(node);\n                case 162:\n                    return checkArrayType(node);\n                case 163:\n                    return checkTupleType(node);\n                case 164:\n                case 165:\n                    return checkUnionOrIntersectionType(node);\n                case 166:\n                case 168:\n                    return checkSourceElement(node.type);\n                case 169:\n                    return checkIndexedAccessType(node);\n                case 170:\n                    return checkMappedType(node);\n                case 225:\n                    return checkFunctionDeclaration(node);\n                case 204:\n                case 231:\n                    return checkBlock(node);\n                case 205:\n                    return checkVariableStatement(node);\n                case 207:\n                    return checkExpressionStatement(node);\n                case 208:\n                    return checkIfStatement(node);\n                case 209:\n                    return checkDoStatement(node);\n                case 210:\n                    return checkWhileStatement(node);\n                case 211:\n                    return checkForStatement(node);\n                case 212:\n                    return checkForInStatement(node);\n                case 213:\n                    return checkForOfStatement(node);\n                case 214:\n                case 215:\n                    return checkBreakOrContinueStatement(node);\n                case 216:\n                    return checkReturnStatement(node);\n                case 217:\n                    return checkWithStatement(node);\n                case 218:\n                    return checkSwitchStatement(node);\n                case 219:\n                    return checkLabeledStatement(node);\n                case 220:\n                    return checkThrowStatement(node);\n                case 221:\n                    return checkTryStatement(node);\n                case 223:\n                    return checkVariableDeclaration(node);\n                case 174:\n                    return checkBindingElement(node);\n                case 226:\n                    return checkClassDeclaration(node);\n                case 227:\n                    return checkInterfaceDeclaration(node);\n                case 228:\n                    return checkTypeAliasDeclaration(node);\n                case 229:\n                    return checkEnumDeclaration(node);\n                case 230:\n                    return checkModuleDeclaration(node);\n                case 235:\n                    return checkImportDeclaration(node);\n                case 234:\n                    return checkImportEqualsDeclaration(node);\n                case 241:\n                    return checkExportDeclaration(node);\n                case 240:\n                    return checkExportAssignment(node);\n                case 206:\n                    checkGrammarStatementInAmbientContext(node);\n                    return;\n                case 222:\n                    checkGrammarStatementInAmbientContext(node);\n                    return;\n                case 244:\n                    return checkMissingDeclaration(node);\n            }\n        }\n        function checkNodeDeferred(node) {\n            if (deferredNodes) {\n                deferredNodes.push(node);\n            }\n        }\n        function checkDeferredNodes() {\n            for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) {\n                var node = deferredNodes_1[_i];\n                switch (node.kind) {\n                    case 184:\n                    case 185:\n                    case 149:\n                    case 148:\n                        checkFunctionExpressionOrObjectLiteralMethodDeferred(node);\n                        break;\n                    case 151:\n                    case 152:\n                        checkAccessorDeferred(node);\n                        break;\n                    case 197:\n                        checkClassExpressionDeferred(node);\n                        break;\n                }\n            }\n        }\n        function checkSourceFile(node) {\n            ts.performance.mark(\"beforeCheck\");\n            checkSourceFileWorker(node);\n            ts.performance.mark(\"afterCheck\");\n            ts.performance.measure(\"Check\", \"beforeCheck\", \"afterCheck\");\n        }\n        function checkSourceFileWorker(node) {\n            var links = getNodeLinks(node);\n            if (!(links.flags & 1)) {\n                if (compilerOptions.skipLibCheck && node.isDeclarationFile || compilerOptions.skipDefaultLibCheck && node.hasNoDefaultLib) {\n                    return;\n                }\n                checkGrammarSourceFile(node);\n                potentialThisCollisions.length = 0;\n                deferredNodes = [];\n                deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined;\n                ts.forEach(node.statements, checkSourceElement);\n                checkDeferredNodes();\n                if (ts.isExternalModule(node)) {\n                    registerForUnusedIdentifiersCheck(node);\n                }\n                if (!node.isDeclarationFile) {\n                    checkUnusedIdentifiers();\n                }\n                deferredNodes = undefined;\n                deferredUnusedIdentifierNodes = undefined;\n                if (ts.isExternalOrCommonJsModule(node)) {\n                    checkExternalModuleExports(node);\n                }\n                if (potentialThisCollisions.length) {\n                    ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope);\n                    potentialThisCollisions.length = 0;\n                }\n                links.flags |= 1;\n            }\n        }\n        function getDiagnostics(sourceFile, ct) {\n            try {\n                cancellationToken = ct;\n                return getDiagnosticsWorker(sourceFile);\n            }\n            finally {\n                cancellationToken = undefined;\n            }\n        }\n        function getDiagnosticsWorker(sourceFile) {\n            throwIfNonDiagnosticsProducing();\n            if (sourceFile) {\n                var previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics();\n                var previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length;\n                checkSourceFile(sourceFile);\n                var semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);\n                var currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics();\n                if (currentGlobalDiagnostics !== previousGlobalDiagnostics) {\n                    var deferredGlobalDiagnostics = ts.relativeComplement(previousGlobalDiagnostics, currentGlobalDiagnostics, ts.compareDiagnostics);\n                    return ts.concatenate(deferredGlobalDiagnostics, semanticDiagnostics);\n                }\n                else if (previousGlobalDiagnosticsSize === 0 && currentGlobalDiagnostics.length > 0) {\n                    return ts.concatenate(currentGlobalDiagnostics, semanticDiagnostics);\n                }\n                return semanticDiagnostics;\n            }\n            ts.forEach(host.getSourceFiles(), checkSourceFile);\n            return diagnostics.getDiagnostics();\n        }\n        function getGlobalDiagnostics() {\n            throwIfNonDiagnosticsProducing();\n            return diagnostics.getGlobalDiagnostics();\n        }\n        function throwIfNonDiagnosticsProducing() {\n            if (!produceDiagnostics) {\n                throw new Error(\"Trying to get diagnostics from a type checker that does not produce them.\");\n            }\n        }\n        function isInsideWithStatementBody(node) {\n            if (node) {\n                while (node.parent) {\n                    if (node.parent.kind === 217 && node.parent.statement === node) {\n                        return true;\n                    }\n                    node = node.parent;\n                }\n            }\n            return false;\n        }\n        function getSymbolsInScope(location, meaning) {\n            var symbols = ts.createMap();\n            var memberFlags = 0;\n            if (isInsideWithStatementBody(location)) {\n                return [];\n            }\n            populateSymbols();\n            return symbolsToArray(symbols);\n            function populateSymbols() {\n                while (location) {\n                    if (location.locals && !isGlobalSourceFile(location)) {\n                        copySymbols(location.locals, meaning);\n                    }\n                    switch (location.kind) {\n                        case 261:\n                            if (!ts.isExternalOrCommonJsModule(location)) {\n                                break;\n                            }\n                        case 230:\n                            copySymbols(getSymbolOfNode(location).exports, meaning & 8914931);\n                            break;\n                        case 229:\n                            copySymbols(getSymbolOfNode(location).exports, meaning & 8);\n                            break;\n                        case 197:\n                            var className = location.name;\n                            if (className) {\n                                copySymbol(location.symbol, meaning);\n                            }\n                        case 226:\n                        case 227:\n                            if (!(memberFlags & 32)) {\n                                copySymbols(getSymbolOfNode(location).members, meaning & 793064);\n                            }\n                            break;\n                        case 184:\n                            var funcName = location.name;\n                            if (funcName) {\n                                copySymbol(location.symbol, meaning);\n                            }\n                            break;\n                    }\n                    if (ts.introducesArgumentsExoticObject(location)) {\n                        copySymbol(argumentsSymbol, meaning);\n                    }\n                    memberFlags = ts.getModifierFlags(location);\n                    location = location.parent;\n                }\n                copySymbols(globals, meaning);\n            }\n            function copySymbol(symbol, meaning) {\n                if (symbol.flags & meaning) {\n                    var id = symbol.name;\n                    if (!symbols[id]) {\n                        symbols[id] = symbol;\n                    }\n                }\n            }\n            function copySymbols(source, meaning) {\n                if (meaning) {\n                    for (var id in source) {\n                        var symbol = source[id];\n                        copySymbol(symbol, meaning);\n                    }\n                }\n            }\n        }\n        function isTypeDeclarationName(name) {\n            return name.kind === 70 &&\n                isTypeDeclaration(name.parent) &&\n                name.parent.name === name;\n        }\n        function isTypeDeclaration(node) {\n            switch (node.kind) {\n                case 143:\n                case 226:\n                case 227:\n                case 228:\n                case 229:\n                    return true;\n            }\n        }\n        function isTypeReferenceIdentifier(entityName) {\n            var node = entityName;\n            while (node.parent && node.parent.kind === 141) {\n                node = node.parent;\n            }\n            return node.parent && (node.parent.kind === 157 || node.parent.kind === 272);\n        }\n        function isHeritageClauseElementIdentifier(entityName) {\n            var node = entityName;\n            while (node.parent && node.parent.kind === 177) {\n                node = node.parent;\n            }\n            return node.parent && node.parent.kind === 199;\n        }\n        function forEachEnclosingClass(node, callback) {\n            var result;\n            while (true) {\n                node = ts.getContainingClass(node);\n                if (!node)\n                    break;\n                if (result = callback(node))\n                    break;\n            }\n            return result;\n        }\n        function isNodeWithinClass(node, classDeclaration) {\n            return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; });\n        }\n        function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) {\n            while (nodeOnRightSide.parent.kind === 141) {\n                nodeOnRightSide = nodeOnRightSide.parent;\n            }\n            if (nodeOnRightSide.parent.kind === 234) {\n                return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent;\n            }\n            if (nodeOnRightSide.parent.kind === 240) {\n                return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent;\n            }\n            return undefined;\n        }\n        function isInRightSideOfImportOrExportAssignment(node) {\n            return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined;\n        }\n        function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) {\n            if (ts.isDeclarationName(entityName)) {\n                return getSymbolOfNode(entityName.parent);\n            }\n            if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 177) {\n                var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent);\n                switch (specialPropertyAssignmentKind) {\n                    case 1:\n                    case 3:\n                        return getSymbolOfNode(entityName.parent);\n                    case 4:\n                    case 2:\n                        return getSymbolOfNode(entityName.parent.parent);\n                    default:\n                }\n            }\n            if (entityName.parent.kind === 240 && ts.isEntityNameExpression(entityName)) {\n                return resolveEntityName(entityName, 107455 | 793064 | 1920 | 8388608);\n            }\n            if (entityName.kind !== 177 && isInRightSideOfImportOrExportAssignment(entityName)) {\n                var importEqualsDeclaration = ts.getAncestor(entityName, 234);\n                ts.Debug.assert(importEqualsDeclaration !== undefined);\n                return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, true);\n            }\n            if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {\n                entityName = entityName.parent;\n            }\n            if (isHeritageClauseElementIdentifier(entityName)) {\n                var meaning = 0;\n                if (entityName.parent.kind === 199) {\n                    meaning = 793064;\n                    if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {\n                        meaning |= 107455;\n                    }\n                }\n                else {\n                    meaning = 1920;\n                }\n                meaning |= 8388608;\n                return resolveEntityName(entityName, meaning);\n            }\n            else if (ts.isPartOfExpression(entityName)) {\n                if (ts.nodeIsMissing(entityName)) {\n                    return undefined;\n                }\n                if (entityName.kind === 70) {\n                    if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) {\n                        return getIntrinsicTagSymbol(entityName.parent);\n                    }\n                    return resolveEntityName(entityName, 107455, false, true);\n                }\n                else if (entityName.kind === 177) {\n                    var symbol = getNodeLinks(entityName).resolvedSymbol;\n                    if (!symbol) {\n                        checkPropertyAccessExpression(entityName);\n                    }\n                    return getNodeLinks(entityName).resolvedSymbol;\n                }\n                else if (entityName.kind === 141) {\n                    var symbol = getNodeLinks(entityName).resolvedSymbol;\n                    if (!symbol) {\n                        checkQualifiedName(entityName);\n                    }\n                    return getNodeLinks(entityName).resolvedSymbol;\n                }\n            }\n            else if (isTypeReferenceIdentifier(entityName)) {\n                var meaning = (entityName.parent.kind === 157 || entityName.parent.kind === 272) ? 793064 : 1920;\n                return resolveEntityName(entityName, meaning, false, true);\n            }\n            else if (entityName.parent.kind === 250) {\n                return getJsxAttributePropertySymbol(entityName.parent);\n            }\n            if (entityName.parent.kind === 156) {\n                return resolveEntityName(entityName, 1);\n            }\n            return undefined;\n        }\n        function getSymbolAtLocation(node) {\n            if (node.kind === 261) {\n                return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined;\n            }\n            if (isInsideWithStatementBody(node)) {\n                return undefined;\n            }\n            if (ts.isDeclarationName(node)) {\n                return getSymbolOfNode(node.parent);\n            }\n            else if (ts.isLiteralComputedPropertyDeclarationName(node)) {\n                return getSymbolOfNode(node.parent.parent);\n            }\n            if (node.kind === 70) {\n                if (isInRightSideOfImportOrExportAssignment(node)) {\n                    return getSymbolOfEntityNameOrPropertyAccessExpression(node);\n                }\n                else if (node.parent.kind === 174 &&\n                    node.parent.parent.kind === 172 &&\n                    node === node.parent.propertyName) {\n                    var typeOfPattern = getTypeOfNode(node.parent.parent);\n                    var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text);\n                    if (propertyDeclaration) {\n                        return propertyDeclaration;\n                    }\n                }\n            }\n            switch (node.kind) {\n                case 70:\n                case 177:\n                case 141:\n                    return getSymbolOfEntityNameOrPropertyAccessExpression(node);\n                case 98:\n                    var container = ts.getThisContainer(node, false);\n                    if (ts.isFunctionLike(container)) {\n                        var sig = getSignatureFromDeclaration(container);\n                        if (sig.thisParameter) {\n                            return sig.thisParameter;\n                        }\n                    }\n                case 96:\n                    var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node);\n                    return type.symbol;\n                case 167:\n                    return getTypeFromTypeNode(node).symbol;\n                case 122:\n                    var constructorDeclaration = node.parent;\n                    if (constructorDeclaration && constructorDeclaration.kind === 150) {\n                        return constructorDeclaration.parent.symbol;\n                    }\n                    return undefined;\n                case 9:\n                    if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) &&\n                        ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) ||\n                        ((node.parent.kind === 235 || node.parent.kind === 241) &&\n                            node.parent.moduleSpecifier === node)) {\n                        return resolveExternalModuleName(node, node);\n                    }\n                    if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node.parent, false)) {\n                        return resolveExternalModuleName(node, node);\n                    }\n                case 8:\n                    if (node.parent.kind === 178 && node.parent.argumentExpression === node) {\n                        var objectType = getTypeOfExpression(node.parent.expression);\n                        if (objectType === unknownType)\n                            return undefined;\n                        var apparentType = getApparentType(objectType);\n                        if (apparentType === unknownType)\n                            return undefined;\n                        return getPropertyOfType(apparentType, node.text);\n                    }\n                    break;\n            }\n            return undefined;\n        }\n        function getShorthandAssignmentValueSymbol(location) {\n            if (location && location.kind === 258) {\n                return resolveEntityName(location.name, 107455 | 8388608);\n            }\n            return undefined;\n        }\n        function getExportSpecifierLocalTargetSymbol(node) {\n            return node.parent.parent.moduleSpecifier ?\n                getExternalModuleMember(node.parent.parent, node) :\n                resolveEntityName(node.propertyName || node.name, 107455 | 793064 | 1920 | 8388608);\n        }\n        function getTypeOfNode(node) {\n            if (isInsideWithStatementBody(node)) {\n                return unknownType;\n            }\n            if (ts.isPartOfTypeNode(node)) {\n                return getTypeFromTypeNode(node);\n            }\n            if (ts.isPartOfExpression(node)) {\n                return getRegularTypeOfExpression(node);\n            }\n            if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) {\n                return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0];\n            }\n            if (isTypeDeclaration(node)) {\n                var symbol = getSymbolOfNode(node);\n                return getDeclaredTypeOfSymbol(symbol);\n            }\n            if (isTypeDeclarationName(node)) {\n                var symbol = getSymbolAtLocation(node);\n                return symbol && getDeclaredTypeOfSymbol(symbol);\n            }\n            if (ts.isDeclaration(node)) {\n                var symbol = getSymbolOfNode(node);\n                return getTypeOfSymbol(symbol);\n            }\n            if (ts.isDeclarationName(node)) {\n                var symbol = getSymbolAtLocation(node);\n                return symbol && getTypeOfSymbol(symbol);\n            }\n            if (ts.isBindingPattern(node)) {\n                return getTypeForVariableLikeDeclaration(node.parent, true);\n            }\n            if (isInRightSideOfImportOrExportAssignment(node)) {\n                var symbol = getSymbolAtLocation(node);\n                var declaredType = symbol && getDeclaredTypeOfSymbol(symbol);\n                return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol);\n            }\n            return unknownType;\n        }\n        function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) {\n            ts.Debug.assert(expr.kind === 176 || expr.kind === 175);\n            if (expr.parent.kind === 213) {\n                var iteratedType = checkRightHandSideOfForOf(expr.parent.expression);\n                return checkDestructuringAssignment(expr, iteratedType || unknownType);\n            }\n            if (expr.parent.kind === 192) {\n                var iteratedType = getTypeOfExpression(expr.parent.right);\n                return checkDestructuringAssignment(expr, iteratedType || unknownType);\n            }\n            if (expr.parent.kind === 257) {\n                var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent);\n                return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent);\n            }\n            ts.Debug.assert(expr.parent.kind === 175);\n            var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent);\n            var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false) || unknownType;\n            return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType);\n        }\n        function getPropertySymbolOfDestructuringAssignment(location) {\n            var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent);\n            return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text);\n        }\n        function getRegularTypeOfExpression(expr) {\n            if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) {\n                expr = expr.parent;\n            }\n            return getRegularTypeOfLiteralType(getTypeOfExpression(expr));\n        }\n        function getParentTypeOfClassElement(node) {\n            var classSymbol = getSymbolOfNode(node.parent);\n            return ts.getModifierFlags(node) & 32\n                ? getTypeOfSymbol(classSymbol)\n                : getDeclaredTypeOfSymbol(classSymbol);\n        }\n        function getAugmentedPropertiesOfType(type) {\n            type = getApparentType(type);\n            var propsByName = createSymbolTable(getPropertiesOfType(type));\n            if (getSignaturesOfType(type, 0).length || getSignaturesOfType(type, 1).length) {\n                ts.forEach(getPropertiesOfType(globalFunctionType), function (p) {\n                    if (!propsByName[p.name]) {\n                        propsByName[p.name] = p;\n                    }\n                });\n            }\n            return getNamedMembers(propsByName);\n        }\n        function getRootSymbols(symbol) {\n            if (symbol.flags & 268435456) {\n                var symbols_3 = [];\n                var name_26 = symbol.name;\n                ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) {\n                    var symbol = getPropertyOfType(t, name_26);\n                    if (symbol) {\n                        symbols_3.push(symbol);\n                    }\n                });\n                return symbols_3;\n            }\n            else if (symbol.flags & 67108864) {\n                if (symbol.leftSpread) {\n                    var links = symbol;\n                    return [links.leftSpread, links.rightSpread];\n                }\n                var target = void 0;\n                var next = symbol;\n                while (next = getSymbolLinks(next).target) {\n                    target = next;\n                }\n                if (target) {\n                    return [target];\n                }\n            }\n            return [symbol];\n        }\n        function isArgumentsLocalBinding(node) {\n            if (!ts.isGeneratedIdentifier(node)) {\n                node = ts.getParseTreeNode(node, ts.isIdentifier);\n                if (node) {\n                    return getReferencedValueSymbol(node) === argumentsSymbol;\n                }\n            }\n            return false;\n        }\n        function moduleExportsSomeValue(moduleReferenceExpression) {\n            var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);\n            if (!moduleSymbol || ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {\n                return true;\n            }\n            var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);\n            moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);\n            var symbolLinks = getSymbolLinks(moduleSymbol);\n            if (symbolLinks.exportsSomeValue === undefined) {\n                symbolLinks.exportsSomeValue = hasExportAssignment\n                    ? !!(moduleSymbol.flags & 107455)\n                    : ts.forEachProperty(getExportsOfModule(moduleSymbol), isValue);\n            }\n            return symbolLinks.exportsSomeValue;\n            function isValue(s) {\n                s = resolveSymbol(s);\n                return s && !!(s.flags & 107455);\n            }\n        }\n        function isNameOfModuleOrEnumDeclaration(node) {\n            var parent = node.parent;\n            return parent && ts.isModuleOrEnumDeclaration(parent) && node === parent.name;\n        }\n        function getReferencedExportContainer(node, prefixLocals) {\n            node = ts.getParseTreeNode(node, ts.isIdentifier);\n            if (node) {\n                var symbol = getReferencedValueSymbol(node, isNameOfModuleOrEnumDeclaration(node));\n                if (symbol) {\n                    if (symbol.flags & 1048576) {\n                        var exportSymbol = getMergedSymbol(symbol.exportSymbol);\n                        if (!prefixLocals && exportSymbol.flags & 944) {\n                            return undefined;\n                        }\n                        symbol = exportSymbol;\n                    }\n                    var parentSymbol = getParentOfSymbol(symbol);\n                    if (parentSymbol) {\n                        if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 261) {\n                            var symbolFile = parentSymbol.valueDeclaration;\n                            var referenceFile = ts.getSourceFileOfNode(node);\n                            var symbolIsUmdExport = symbolFile !== referenceFile;\n                            return symbolIsUmdExport ? undefined : symbolFile;\n                        }\n                        for (var n = node.parent; n; n = n.parent) {\n                            if (ts.isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol) {\n                                return n;\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        function getReferencedImportDeclaration(node) {\n            node = ts.getParseTreeNode(node, ts.isIdentifier);\n            if (node) {\n                var symbol = getReferencedValueSymbol(node);\n                if (symbol && symbol.flags & 8388608) {\n                    return getDeclarationOfAliasSymbol(symbol);\n                }\n            }\n            return undefined;\n        }\n        function isSymbolOfDeclarationWithCollidingName(symbol) {\n            if (symbol.flags & 418) {\n                var links = getSymbolLinks(symbol);\n                if (links.isDeclarationWithCollidingName === undefined) {\n                    var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);\n                    if (ts.isStatementWithLocals(container)) {\n                        var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration);\n                        if (!!resolveName(container.parent, symbol.name, 107455, undefined, undefined)) {\n                            links.isDeclarationWithCollidingName = true;\n                        }\n                        else if (nodeLinks_1.flags & 131072) {\n                            var isDeclaredInLoop = nodeLinks_1.flags & 262144;\n                            var inLoopInitializer = ts.isIterationStatement(container, false);\n                            var inLoopBodyBlock = container.kind === 204 && ts.isIterationStatement(container.parent, false);\n                            links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock));\n                        }\n                        else {\n                            links.isDeclarationWithCollidingName = false;\n                        }\n                    }\n                }\n                return links.isDeclarationWithCollidingName;\n            }\n            return false;\n        }\n        function getReferencedDeclarationWithCollidingName(node) {\n            if (!ts.isGeneratedIdentifier(node)) {\n                node = ts.getParseTreeNode(node, ts.isIdentifier);\n                if (node) {\n                    var symbol = getReferencedValueSymbol(node);\n                    if (symbol && isSymbolOfDeclarationWithCollidingName(symbol)) {\n                        return symbol.valueDeclaration;\n                    }\n                }\n            }\n            return undefined;\n        }\n        function isDeclarationWithCollidingName(node) {\n            node = ts.getParseTreeNode(node, ts.isDeclaration);\n            if (node) {\n                var symbol = getSymbolOfNode(node);\n                if (symbol) {\n                    return isSymbolOfDeclarationWithCollidingName(symbol);\n                }\n            }\n            return false;\n        }\n        function isValueAliasDeclaration(node) {\n            node = ts.getParseTreeNode(node);\n            if (node === undefined) {\n                return true;\n            }\n            switch (node.kind) {\n                case 234:\n                case 236:\n                case 237:\n                case 239:\n                case 243:\n                    return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol);\n                case 241:\n                    var exportClause = node.exportClause;\n                    return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration);\n                case 240:\n                    return node.expression\n                        && node.expression.kind === 70\n                        ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol)\n                        : true;\n            }\n            return false;\n        }\n        function isTopLevelValueImportEqualsWithEntityName(node) {\n            node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration);\n            if (node === undefined || node.parent.kind !== 261 || !ts.isInternalModuleImportEqualsDeclaration(node)) {\n                return false;\n            }\n            var isValue = isAliasResolvedToValue(getSymbolOfNode(node));\n            return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference);\n        }\n        function isAliasResolvedToValue(symbol) {\n            var target = resolveAlias(symbol);\n            if (target === unknownSymbol) {\n                return true;\n            }\n            return target.flags & 107455 &&\n                (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target));\n        }\n        function isConstEnumOrConstEnumOnlyModule(s) {\n            return isConstEnumSymbol(s) || s.constEnumOnlyModule;\n        }\n        function isReferencedAliasDeclaration(node, checkChildren) {\n            node = ts.getParseTreeNode(node);\n            if (node === undefined) {\n                return true;\n            }\n            if (ts.isAliasSymbolDeclaration(node)) {\n                var symbol = getSymbolOfNode(node);\n                if (symbol && getSymbolLinks(symbol).referenced) {\n                    return true;\n                }\n            }\n            if (checkChildren) {\n                return ts.forEachChild(node, function (node) { return isReferencedAliasDeclaration(node, checkChildren); });\n            }\n            return false;\n        }\n        function isImplementationOfOverload(node) {\n            if (ts.nodeIsPresent(node.body)) {\n                var symbol = getSymbolOfNode(node);\n                var signaturesOfSymbol = getSignaturesOfSymbol(symbol);\n                return signaturesOfSymbol.length > 1 ||\n                    (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node);\n            }\n            return false;\n        }\n        function getNodeCheckFlags(node) {\n            node = ts.getParseTreeNode(node);\n            return node ? getNodeLinks(node).flags : undefined;\n        }\n        function getEnumMemberValue(node) {\n            computeEnumMemberValues(node.parent);\n            return getNodeLinks(node).enumMemberValue;\n        }\n        function getConstantValue(node) {\n            if (node.kind === 260) {\n                return getEnumMemberValue(node);\n            }\n            var symbol = getNodeLinks(node).resolvedSymbol;\n            if (symbol && (symbol.flags & 8)) {\n                if (ts.isConstEnumDeclaration(symbol.valueDeclaration.parent)) {\n                    return getEnumMemberValue(symbol.valueDeclaration);\n                }\n            }\n            return undefined;\n        }\n        function isFunctionType(type) {\n            return type.flags & 32768 && getSignaturesOfType(type, 0).length > 0;\n        }\n        function getTypeReferenceSerializationKind(typeName, location) {\n            var valueSymbol = resolveEntityName(typeName, 107455, true, false, location);\n            var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol();\n            if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) {\n                return ts.TypeReferenceSerializationKind.Promise;\n            }\n            var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined;\n            if (constructorType && isConstructorType(constructorType)) {\n                return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue;\n            }\n            var typeSymbol = resolveEntityName(typeName, 793064, true, false, location);\n            if (!typeSymbol) {\n                return ts.TypeReferenceSerializationKind.ObjectType;\n            }\n            var type = getDeclaredTypeOfSymbol(typeSymbol);\n            if (type === unknownType) {\n                return ts.TypeReferenceSerializationKind.Unknown;\n            }\n            else if (type.flags & 1) {\n                return ts.TypeReferenceSerializationKind.ObjectType;\n            }\n            else if (isTypeOfKind(type, 1024 | 6144 | 8192)) {\n                return ts.TypeReferenceSerializationKind.VoidNullableOrNeverType;\n            }\n            else if (isTypeOfKind(type, 136)) {\n                return ts.TypeReferenceSerializationKind.BooleanType;\n            }\n            else if (isTypeOfKind(type, 340)) {\n                return ts.TypeReferenceSerializationKind.NumberLikeType;\n            }\n            else if (isTypeOfKind(type, 262178)) {\n                return ts.TypeReferenceSerializationKind.StringLikeType;\n            }\n            else if (isTupleType(type)) {\n                return ts.TypeReferenceSerializationKind.ArrayLikeType;\n            }\n            else if (isTypeOfKind(type, 512)) {\n                return ts.TypeReferenceSerializationKind.ESSymbolType;\n            }\n            else if (isFunctionType(type)) {\n                return ts.TypeReferenceSerializationKind.TypeWithCallSignature;\n            }\n            else if (isArrayType(type)) {\n                return ts.TypeReferenceSerializationKind.ArrayLikeType;\n            }\n            else {\n                return ts.TypeReferenceSerializationKind.ObjectType;\n            }\n        }\n        function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) {\n            var symbol = getSymbolOfNode(declaration);\n            var type = symbol && !(symbol.flags & (2048 | 131072))\n                ? getWidenedLiteralType(getTypeOfSymbol(symbol))\n                : unknownType;\n            getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);\n        }\n        function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) {\n            var signature = getSignatureFromDeclaration(signatureDeclaration);\n            getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags);\n        }\n        function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) {\n            var type = getWidenedType(getRegularTypeOfExpression(expr));\n            getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);\n        }\n        function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) {\n            var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node));\n            resolveBaseTypesOfClass(classType);\n            var baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType;\n            getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags);\n        }\n        function hasGlobalName(name) {\n            return !!globals[name];\n        }\n        function getReferencedValueSymbol(reference, startInDeclarationContainer) {\n            var resolvedSymbol = getNodeLinks(reference).resolvedSymbol;\n            if (resolvedSymbol) {\n                return resolvedSymbol;\n            }\n            var location = reference;\n            if (startInDeclarationContainer) {\n                var parent_11 = reference.parent;\n                if (ts.isDeclaration(parent_11) && reference === parent_11.name) {\n                    location = getDeclarationContainer(parent_11);\n                }\n            }\n            return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined);\n        }\n        function getReferencedValueDeclaration(reference) {\n            if (!ts.isGeneratedIdentifier(reference)) {\n                reference = ts.getParseTreeNode(reference, ts.isIdentifier);\n                if (reference) {\n                    var symbol = getReferencedValueSymbol(reference);\n                    if (symbol) {\n                        return getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration;\n                    }\n                }\n            }\n            return undefined;\n        }\n        function isLiteralConstDeclaration(node) {\n            if (ts.isConst(node)) {\n                var type = getTypeOfSymbol(getSymbolOfNode(node));\n                return !!(type.flags & 96 && type.flags & 1048576);\n            }\n            return false;\n        }\n        function writeLiteralConstValue(node, writer) {\n            var type = getTypeOfSymbol(getSymbolOfNode(node));\n            writer.writeStringLiteral(literalTypeToString(type));\n        }\n        function createResolver() {\n            var resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives();\n            var fileToDirective;\n            if (resolvedTypeReferenceDirectives) {\n                fileToDirective = ts.createFileMap();\n                for (var key in resolvedTypeReferenceDirectives) {\n                    var resolvedDirective = resolvedTypeReferenceDirectives[key];\n                    if (!resolvedDirective) {\n                        continue;\n                    }\n                    var file = host.getSourceFile(resolvedDirective.resolvedFileName);\n                    fileToDirective.set(file.path, key);\n                }\n            }\n            return {\n                getReferencedExportContainer: getReferencedExportContainer,\n                getReferencedImportDeclaration: getReferencedImportDeclaration,\n                getReferencedDeclarationWithCollidingName: getReferencedDeclarationWithCollidingName,\n                isDeclarationWithCollidingName: isDeclarationWithCollidingName,\n                isValueAliasDeclaration: isValueAliasDeclaration,\n                hasGlobalName: hasGlobalName,\n                isReferencedAliasDeclaration: isReferencedAliasDeclaration,\n                getNodeCheckFlags: getNodeCheckFlags,\n                isTopLevelValueImportEqualsWithEntityName: isTopLevelValueImportEqualsWithEntityName,\n                isDeclarationVisible: isDeclarationVisible,\n                isImplementationOfOverload: isImplementationOfOverload,\n                writeTypeOfDeclaration: writeTypeOfDeclaration,\n                writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration,\n                writeTypeOfExpression: writeTypeOfExpression,\n                writeBaseConstructorTypeOfClass: writeBaseConstructorTypeOfClass,\n                isSymbolAccessible: isSymbolAccessible,\n                isEntityNameVisible: isEntityNameVisible,\n                getConstantValue: getConstantValue,\n                collectLinkedAliases: collectLinkedAliases,\n                getReferencedValueDeclaration: getReferencedValueDeclaration,\n                getTypeReferenceSerializationKind: getTypeReferenceSerializationKind,\n                isOptionalParameter: isOptionalParameter,\n                moduleExportsSomeValue: moduleExportsSomeValue,\n                isArgumentsLocalBinding: isArgumentsLocalBinding,\n                getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration,\n                getTypeReferenceDirectivesForEntityName: getTypeReferenceDirectivesForEntityName,\n                getTypeReferenceDirectivesForSymbol: getTypeReferenceDirectivesForSymbol,\n                isLiteralConstDeclaration: isLiteralConstDeclaration,\n                writeLiteralConstValue: writeLiteralConstValue,\n                getJsxFactoryEntity: function () { return _jsxFactoryEntity; }\n            };\n            function getTypeReferenceDirectivesForEntityName(node) {\n                if (!fileToDirective) {\n                    return undefined;\n                }\n                var meaning = (node.kind === 177) || (node.kind === 70 && isInTypeQuery(node))\n                    ? 107455 | 1048576\n                    : 793064 | 1920;\n                var symbol = resolveEntityName(node, meaning, true);\n                return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined;\n            }\n            function getTypeReferenceDirectivesForSymbol(symbol, meaning) {\n                if (!fileToDirective) {\n                    return undefined;\n                }\n                if (!isSymbolFromTypeDeclarationFile(symbol)) {\n                    return undefined;\n                }\n                var typeReferenceDirectives;\n                for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    if (decl.symbol && decl.symbol.flags & meaning) {\n                        var file = ts.getSourceFileOfNode(decl);\n                        var typeReferenceDirective = fileToDirective.get(file.path);\n                        if (typeReferenceDirective) {\n                            (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective);\n                        }\n                        else {\n                            return undefined;\n                        }\n                    }\n                }\n                return typeReferenceDirectives;\n            }\n            function isSymbolFromTypeDeclarationFile(symbol) {\n                if (!symbol.declarations) {\n                    return false;\n                }\n                var current = symbol;\n                while (true) {\n                    var parent_12 = getParentOfSymbol(current);\n                    if (parent_12) {\n                        current = parent_12;\n                    }\n                    else {\n                        break;\n                    }\n                }\n                if (current.valueDeclaration && current.valueDeclaration.kind === 261 && current.flags & 512) {\n                    return false;\n                }\n                for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    var file = ts.getSourceFileOfNode(decl);\n                    if (fileToDirective.contains(file.path)) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n        }\n        function getExternalModuleFileFromDeclaration(declaration) {\n            var specifier = ts.getExternalModuleName(declaration);\n            var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, undefined);\n            if (!moduleSymbol) {\n                return undefined;\n            }\n            return ts.getDeclarationOfKind(moduleSymbol, 261);\n        }\n        function initializeTypeChecker() {\n            for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) {\n                var file = _a[_i];\n                ts.bindSourceFile(file, compilerOptions);\n            }\n            var augmentations;\n            for (var _b = 0, _c = host.getSourceFiles(); _b < _c.length; _b++) {\n                var file = _c[_b];\n                if (!ts.isExternalOrCommonJsModule(file)) {\n                    mergeSymbolTable(globals, file.locals);\n                }\n                if (file.patternAmbientModules && file.patternAmbientModules.length) {\n                    patternAmbientModules = ts.concatenate(patternAmbientModules, file.patternAmbientModules);\n                }\n                if (file.moduleAugmentations.length) {\n                    (augmentations || (augmentations = [])).push(file.moduleAugmentations);\n                }\n                if (file.symbol && file.symbol.globalExports) {\n                    var source = file.symbol.globalExports;\n                    for (var id in source) {\n                        if (!(id in globals)) {\n                            globals[id] = source[id];\n                        }\n                    }\n                }\n            }\n            if (augmentations) {\n                for (var _d = 0, augmentations_1 = augmentations; _d < augmentations_1.length; _d++) {\n                    var list = augmentations_1[_d];\n                    for (var _e = 0, list_1 = list; _e < list_1.length; _e++) {\n                        var augmentation = list_1[_e];\n                        mergeModuleAugmentation(augmentation);\n                    }\n                }\n            }\n            addToSymbolTable(globals, builtinGlobals, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0);\n            getSymbolLinks(undefinedSymbol).type = undefinedWideningType;\n            getSymbolLinks(argumentsSymbol).type = getGlobalType(\"IArguments\");\n            getSymbolLinks(unknownSymbol).type = unknownType;\n            globalArrayType = getGlobalType(\"Array\", 1);\n            globalObjectType = getGlobalType(\"Object\");\n            globalFunctionType = getGlobalType(\"Function\");\n            globalStringType = getGlobalType(\"String\");\n            globalNumberType = getGlobalType(\"Number\");\n            globalBooleanType = getGlobalType(\"Boolean\");\n            globalRegExpType = getGlobalType(\"RegExp\");\n            jsxElementType = getExportedTypeFromNamespace(\"JSX\", JsxNames.Element);\n            getGlobalClassDecoratorType = ts.memoize(function () { return getGlobalType(\"ClassDecorator\"); });\n            getGlobalPropertyDecoratorType = ts.memoize(function () { return getGlobalType(\"PropertyDecorator\"); });\n            getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType(\"MethodDecorator\"); });\n            getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType(\"ParameterDecorator\"); });\n            getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType(\"TypedPropertyDescriptor\", 1); });\n            getGlobalESSymbolConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol(\"Symbol\"); });\n            getGlobalPromiseType = ts.memoize(function () { return getGlobalType(\"Promise\", 1); });\n            tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol(\"Promise\", 793064, undefined) && getGlobalPromiseType(); });\n            getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType(\"PromiseLike\", 1); });\n            getInstantiatedGlobalPromiseLikeType = ts.memoize(createInstantiatedPromiseLikeType);\n            getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol(\"Promise\"); });\n            tryGetGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalSymbol(\"Promise\", 107455, undefined) && getGlobalPromiseConstructorSymbol(); });\n            getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType(\"PromiseConstructorLike\"); });\n            getGlobalThenableType = ts.memoize(createThenableType);\n            getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType(\"TemplateStringsArray\"); });\n            if (languageVersion >= 2) {\n                getGlobalESSymbolType = ts.memoize(function () { return getGlobalType(\"Symbol\"); });\n                getGlobalIterableType = ts.memoize(function () { return getGlobalType(\"Iterable\", 1); });\n                getGlobalIteratorType = ts.memoize(function () { return getGlobalType(\"Iterator\", 1); });\n                getGlobalIterableIteratorType = ts.memoize(function () { return getGlobalType(\"IterableIterator\", 1); });\n            }\n            else {\n                getGlobalESSymbolType = ts.memoize(function () { return emptyObjectType; });\n                getGlobalIterableType = ts.memoize(function () { return emptyGenericType; });\n                getGlobalIteratorType = ts.memoize(function () { return emptyGenericType; });\n                getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; });\n            }\n            anyArrayType = createArrayType(anyType);\n            autoArrayType = createArrayType(autoType);\n            var symbol = getGlobalSymbol(\"ReadonlyArray\", 793064, undefined);\n            globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, 1);\n            anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType;\n        }\n        function checkExternalEmitHelpers(location, helpers) {\n            if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) {\n                var sourceFile = ts.getSourceFileOfNode(location);\n                if (ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {\n                    var helpersModule = resolveHelpersModule(sourceFile, location);\n                    if (helpersModule !== unknownSymbol) {\n                        var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers;\n                        for (var helper = 1; helper <= 128; helper <<= 1) {\n                            if (uncheckedHelpers & helper) {\n                                var name_27 = getHelperName(helper);\n                                var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name_27), 107455);\n                                if (!symbol) {\n                                    error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name_27);\n                                }\n                            }\n                        }\n                    }\n                    requestedExternalEmitHelpers |= helpers;\n                }\n            }\n        }\n        function getHelperName(helper) {\n            switch (helper) {\n                case 1: return \"__extends\";\n                case 2: return \"__assign\";\n                case 4: return \"__rest\";\n                case 8: return \"__decorate\";\n                case 16: return \"__metadata\";\n                case 32: return \"__param\";\n                case 64: return \"__awaiter\";\n                case 128: return \"__generator\";\n            }\n        }\n        function resolveHelpersModule(node, errorNode) {\n            if (!externalHelpersModule) {\n                externalHelpersModule = resolveExternalModule(node, ts.externalHelpersModuleNameText, ts.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol;\n            }\n            return externalHelpersModule;\n        }\n        function createInstantiatedPromiseLikeType() {\n            var promiseLikeType = getGlobalPromiseLikeType();\n            if (promiseLikeType !== emptyGenericType) {\n                return createTypeReference(promiseLikeType, [anyType]);\n            }\n            return emptyObjectType;\n        }\n        function createThenableType() {\n            var thenPropertySymbol = createSymbol(67108864 | 4, \"then\");\n            getSymbolLinks(thenPropertySymbol).type = globalFunctionType;\n            var thenableType = createObjectType(16);\n            thenableType.properties = [thenPropertySymbol];\n            thenableType.members = createSymbolTable(thenableType.properties);\n            thenableType.callSignatures = [];\n            thenableType.constructSignatures = [];\n            return thenableType;\n        }\n        function checkGrammarDecorators(node) {\n            if (!node.decorators) {\n                return false;\n            }\n            if (!ts.nodeCanBeDecorated(node)) {\n                if (node.kind === 149 && !ts.nodeIsPresent(node.body)) {\n                    return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload);\n                }\n                else {\n                    return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here);\n                }\n            }\n            else if (node.kind === 151 || node.kind === 152) {\n                var accessors = ts.getAllAccessorDeclarations(node.parent.members, node);\n                if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) {\n                    return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);\n                }\n            }\n            return false;\n        }\n        function checkGrammarModifiers(node) {\n            var quickResult = reportObviousModifierErrors(node);\n            if (quickResult !== undefined) {\n                return quickResult;\n            }\n            var lastStatic, lastPrivate, lastProtected, lastDeclare, lastAsync, lastReadonly;\n            var flags = 0;\n            for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {\n                var modifier = _a[_i];\n                if (modifier.kind !== 130) {\n                    if (node.kind === 146 || node.kind === 148) {\n                        return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind));\n                    }\n                    if (node.kind === 155) {\n                        return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind));\n                    }\n                }\n                switch (modifier.kind) {\n                    case 75:\n                        if (node.kind !== 229 && node.parent.kind === 226) {\n                            return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75));\n                        }\n                        break;\n                    case 113:\n                    case 112:\n                    case 111:\n                        var text = visibilityToString(ts.modifierToFlag(modifier.kind));\n                        if (modifier.kind === 112) {\n                            lastProtected = modifier;\n                        }\n                        else if (modifier.kind === 111) {\n                            lastPrivate = modifier;\n                        }\n                        if (flags & 28) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen);\n                        }\n                        else if (flags & 32) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, \"static\");\n                        }\n                        else if (flags & 64) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, \"readonly\");\n                        }\n                        else if (flags & 256) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, \"async\");\n                        }\n                        else if (node.parent.kind === 231 || node.parent.kind === 261) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text);\n                        }\n                        else if (flags & 128) {\n                            if (modifier.kind === 111) {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, \"abstract\");\n                            }\n                            else {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, \"abstract\");\n                            }\n                        }\n                        flags |= ts.modifierToFlag(modifier.kind);\n                        break;\n                    case 114:\n                        if (flags & 32) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"static\");\n                        }\n                        else if (flags & 64) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, \"static\", \"readonly\");\n                        }\n                        else if (flags & 256) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, \"static\", \"async\");\n                        }\n                        else if (node.parent.kind === 231 || node.parent.kind === 261) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, \"static\");\n                        }\n                        else if (node.kind === 144) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, \"static\");\n                        }\n                        else if (flags & 128) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, \"static\", \"abstract\");\n                        }\n                        flags |= 32;\n                        lastStatic = modifier;\n                        break;\n                    case 130:\n                        if (flags & 64) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"readonly\");\n                        }\n                        else if (node.kind !== 147 && node.kind !== 146 && node.kind !== 155 && node.kind !== 144) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);\n                        }\n                        flags |= 64;\n                        lastReadonly = modifier;\n                        break;\n                    case 83:\n                        if (flags & 1) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"export\");\n                        }\n                        else if (flags & 2) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, \"export\", \"declare\");\n                        }\n                        else if (flags & 128) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, \"export\", \"abstract\");\n                        }\n                        else if (flags & 256) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, \"export\", \"async\");\n                        }\n                        else if (node.parent.kind === 226) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, \"export\");\n                        }\n                        else if (node.kind === 144) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, \"export\");\n                        }\n                        flags |= 1;\n                        break;\n                    case 123:\n                        if (flags & 2) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"declare\");\n                        }\n                        else if (flags & 256) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, \"async\");\n                        }\n                        else if (node.parent.kind === 226) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, \"declare\");\n                        }\n                        else if (node.kind === 144) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, \"declare\");\n                        }\n                        else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 231) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);\n                        }\n                        flags |= 2;\n                        lastDeclare = modifier;\n                        break;\n                    case 116:\n                        if (flags & 128) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"abstract\");\n                        }\n                        if (node.kind !== 226) {\n                            if (node.kind !== 149 &&\n                                node.kind !== 147 &&\n                                node.kind !== 151 &&\n                                node.kind !== 152) {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);\n                            }\n                            if (!(node.parent.kind === 226 && ts.getModifierFlags(node.parent) & 128)) {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);\n                            }\n                            if (flags & 32) {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, \"static\", \"abstract\");\n                            }\n                            if (flags & 8) {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, \"private\", \"abstract\");\n                            }\n                        }\n                        flags |= 128;\n                        break;\n                    case 119:\n                        if (flags & 256) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"async\");\n                        }\n                        else if (flags & 2 || ts.isInAmbientContext(node.parent)) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, \"async\");\n                        }\n                        else if (node.kind === 144) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, \"async\");\n                        }\n                        flags |= 256;\n                        lastAsync = modifier;\n                        break;\n                }\n            }\n            if (node.kind === 150) {\n                if (flags & 32) {\n                    return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, \"static\");\n                }\n                if (flags & 128) {\n                    return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, \"abstract\");\n                }\n                else if (flags & 256) {\n                    return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, \"async\");\n                }\n                else if (flags & 64) {\n                    return grammarErrorOnNode(lastReadonly, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, \"readonly\");\n                }\n                return;\n            }\n            else if ((node.kind === 235 || node.kind === 234) && flags & 2) {\n                return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, \"declare\");\n            }\n            else if (node.kind === 144 && (flags & 92) && ts.isBindingPattern(node.name)) {\n                return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern);\n            }\n            else if (node.kind === 144 && (flags & 92) && node.dotDotDotToken) {\n                return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter);\n            }\n            if (flags & 256) {\n                return checkGrammarAsyncModifier(node, lastAsync);\n            }\n        }\n        function reportObviousModifierErrors(node) {\n            return !node.modifiers\n                ? false\n                : shouldReportBadModifier(node)\n                    ? grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here)\n                    : undefined;\n        }\n        function shouldReportBadModifier(node) {\n            switch (node.kind) {\n                case 151:\n                case 152:\n                case 150:\n                case 147:\n                case 146:\n                case 149:\n                case 148:\n                case 155:\n                case 230:\n                case 235:\n                case 234:\n                case 241:\n                case 240:\n                case 184:\n                case 185:\n                case 144:\n                    return false;\n                default:\n                    if (node.parent.kind === 231 || node.parent.kind === 261) {\n                        return false;\n                    }\n                    switch (node.kind) {\n                        case 225:\n                            return nodeHasAnyModifiersExcept(node, 119);\n                        case 226:\n                            return nodeHasAnyModifiersExcept(node, 116);\n                        case 227:\n                        case 205:\n                        case 228:\n                            return true;\n                        case 229:\n                            return nodeHasAnyModifiersExcept(node, 75);\n                        default:\n                            ts.Debug.fail();\n                            return false;\n                    }\n            }\n        }\n        function nodeHasAnyModifiersExcept(node, allowedModifier) {\n            return node.modifiers.length > 1 || node.modifiers[0].kind !== allowedModifier;\n        }\n        function checkGrammarAsyncModifier(node, asyncModifier) {\n            switch (node.kind) {\n                case 149:\n                case 225:\n                case 184:\n                case 185:\n                    if (!node.asteriskToken) {\n                        return false;\n                    }\n                    break;\n            }\n            return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, \"async\");\n        }\n        function checkGrammarForDisallowedTrailingComma(list) {\n            if (list && list.hasTrailingComma) {\n                var start = list.end - \",\".length;\n                var end = list.end;\n                var sourceFile = ts.getSourceFileOfNode(list[0]);\n                return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Trailing_comma_not_allowed);\n            }\n        }\n        function checkGrammarTypeParameterList(typeParameters, file) {\n            if (checkGrammarForDisallowedTrailingComma(typeParameters)) {\n                return true;\n            }\n            if (typeParameters && typeParameters.length === 0) {\n                var start = typeParameters.pos - \"<\".length;\n                var end = ts.skipTrivia(file.text, typeParameters.end) + \">\".length;\n                return grammarErrorAtPos(file, start, end - start, ts.Diagnostics.Type_parameter_list_cannot_be_empty);\n            }\n        }\n        function checkGrammarParameterList(parameters) {\n            var seenOptionalParameter = false;\n            var parameterCount = parameters.length;\n            for (var i = 0; i < parameterCount; i++) {\n                var parameter = parameters[i];\n                if (parameter.dotDotDotToken) {\n                    if (i !== (parameterCount - 1)) {\n                        return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);\n                    }\n                    if (ts.isBindingPattern(parameter.name)) {\n                        return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);\n                    }\n                    if (parameter.questionToken) {\n                        return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_rest_parameter_cannot_be_optional);\n                    }\n                    if (parameter.initializer) {\n                        return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer);\n                    }\n                }\n                else if (parameter.questionToken) {\n                    seenOptionalParameter = true;\n                    if (parameter.initializer) {\n                        return grammarErrorOnNode(parameter.name, ts.Diagnostics.Parameter_cannot_have_question_mark_and_initializer);\n                    }\n                }\n                else if (seenOptionalParameter && !parameter.initializer) {\n                    return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter);\n                }\n            }\n        }\n        function checkGrammarFunctionLikeDeclaration(node) {\n            var file = ts.getSourceFileOfNode(node);\n            return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node.typeParameters, file) ||\n                checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file);\n        }\n        function checkGrammarArrowFunction(node, file) {\n            if (node.kind === 185) {\n                var arrowFunction = node;\n                var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line;\n                var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line;\n                if (startLine !== endLine) {\n                    return grammarErrorOnNode(arrowFunction.equalsGreaterThanToken, ts.Diagnostics.Line_terminator_not_permitted_before_arrow);\n                }\n            }\n            return false;\n        }\n        function checkGrammarIndexSignatureParameters(node) {\n            var parameter = node.parameters[0];\n            if (node.parameters.length !== 1) {\n                if (parameter) {\n                    return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter);\n                }\n                else {\n                    return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter);\n                }\n            }\n            if (parameter.dotDotDotToken) {\n                return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter);\n            }\n            if (ts.getModifierFlags(parameter) !== 0) {\n                return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier);\n            }\n            if (parameter.questionToken) {\n                return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark);\n            }\n            if (parameter.initializer) {\n                return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_initializer);\n            }\n            if (!parameter.type) {\n                return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);\n            }\n            if (parameter.type.kind !== 134 && parameter.type.kind !== 132) {\n                return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number);\n            }\n            if (!node.type) {\n                return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation);\n            }\n        }\n        function checkGrammarIndexSignature(node) {\n            return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node);\n        }\n        function checkGrammarForAtLeastOneTypeArgument(node, typeArguments) {\n            if (typeArguments && typeArguments.length === 0) {\n                var sourceFile = ts.getSourceFileOfNode(node);\n                var start = typeArguments.pos - \"<\".length;\n                var end = ts.skipTrivia(sourceFile.text, typeArguments.end) + \">\".length;\n                return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Type_argument_list_cannot_be_empty);\n            }\n        }\n        function checkGrammarTypeArguments(node, typeArguments) {\n            return checkGrammarForDisallowedTrailingComma(typeArguments) ||\n                checkGrammarForAtLeastOneTypeArgument(node, typeArguments);\n        }\n        function checkGrammarForOmittedArgument(node, args) {\n            if (args) {\n                var sourceFile = ts.getSourceFileOfNode(node);\n                for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {\n                    var arg = args_4[_i];\n                    if (arg.kind === 198) {\n                        return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);\n                    }\n                }\n            }\n        }\n        function checkGrammarArguments(node, args) {\n            return checkGrammarForOmittedArgument(node, args);\n        }\n        function checkGrammarHeritageClause(node) {\n            var types = node.types;\n            if (checkGrammarForDisallowedTrailingComma(types)) {\n                return true;\n            }\n            if (types && types.length === 0) {\n                var listType = ts.tokenToString(node.token);\n                var sourceFile = ts.getSourceFileOfNode(node);\n                return grammarErrorAtPos(sourceFile, types.pos, 0, ts.Diagnostics._0_list_cannot_be_empty, listType);\n            }\n        }\n        function checkGrammarClassDeclarationHeritageClauses(node) {\n            var seenExtendsClause = false;\n            var seenImplementsClause = false;\n            if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) {\n                for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {\n                    var heritageClause = _a[_i];\n                    if (heritageClause.token === 84) {\n                        if (seenExtendsClause) {\n                            return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);\n                        }\n                        if (seenImplementsClause) {\n                            return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_must_precede_implements_clause);\n                        }\n                        if (heritageClause.types.length > 1) {\n                            return grammarErrorOnFirstToken(heritageClause.types[1], ts.Diagnostics.Classes_can_only_extend_a_single_class);\n                        }\n                        seenExtendsClause = true;\n                    }\n                    else {\n                        ts.Debug.assert(heritageClause.token === 107);\n                        if (seenImplementsClause) {\n                            return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen);\n                        }\n                        seenImplementsClause = true;\n                    }\n                    checkGrammarHeritageClause(heritageClause);\n                }\n            }\n        }\n        function checkGrammarInterfaceDeclaration(node) {\n            var seenExtendsClause = false;\n            if (node.heritageClauses) {\n                for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {\n                    var heritageClause = _a[_i];\n                    if (heritageClause.token === 84) {\n                        if (seenExtendsClause) {\n                            return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);\n                        }\n                        seenExtendsClause = true;\n                    }\n                    else {\n                        ts.Debug.assert(heritageClause.token === 107);\n                        return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause);\n                    }\n                    checkGrammarHeritageClause(heritageClause);\n                }\n            }\n            return false;\n        }\n        function checkGrammarComputedPropertyName(node) {\n            if (node.kind !== 142) {\n                return false;\n            }\n            var computedPropertyName = node;\n            if (computedPropertyName.expression.kind === 192 && computedPropertyName.expression.operatorToken.kind === 25) {\n                return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);\n            }\n        }\n        function checkGrammarForGenerator(node) {\n            if (node.asteriskToken) {\n                ts.Debug.assert(node.kind === 225 ||\n                    node.kind === 184 ||\n                    node.kind === 149);\n                if (ts.isInAmbientContext(node)) {\n                    return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);\n                }\n                if (!node.body) {\n                    return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator);\n                }\n                if (languageVersion < 2) {\n                    return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher);\n                }\n            }\n        }\n        function checkGrammarForInvalidQuestionMark(questionToken, message) {\n            if (questionToken) {\n                return grammarErrorOnNode(questionToken, message);\n            }\n        }\n        function checkGrammarObjectLiteralExpression(node, inDestructuring) {\n            var seen = ts.createMap();\n            var Property = 1;\n            var GetAccessor = 2;\n            var SetAccessor = 4;\n            var GetOrSetAccessor = GetAccessor | SetAccessor;\n            for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {\n                var prop = _a[_i];\n                if (prop.kind === 259) {\n                    continue;\n                }\n                var name_28 = prop.name;\n                if (name_28.kind === 142) {\n                    checkGrammarComputedPropertyName(name_28);\n                }\n                if (prop.kind === 258 && !inDestructuring && prop.objectAssignmentInitializer) {\n                    return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment);\n                }\n                if (prop.modifiers) {\n                    for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) {\n                        var mod = _c[_b];\n                        if (mod.kind !== 119 || prop.kind !== 149) {\n                            grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod));\n                        }\n                    }\n                }\n                var currentKind = void 0;\n                if (prop.kind === 257 || prop.kind === 258) {\n                    checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);\n                    if (name_28.kind === 8) {\n                        checkGrammarNumericLiteral(name_28);\n                    }\n                    currentKind = Property;\n                }\n                else if (prop.kind === 149) {\n                    currentKind = Property;\n                }\n                else if (prop.kind === 151) {\n                    currentKind = GetAccessor;\n                }\n                else if (prop.kind === 152) {\n                    currentKind = SetAccessor;\n                }\n                else {\n                    ts.Debug.fail(\"Unexpected syntax kind:\" + prop.kind);\n                }\n                var effectiveName = ts.getPropertyNameForPropertyNameNode(name_28);\n                if (effectiveName === undefined) {\n                    continue;\n                }\n                if (!seen[effectiveName]) {\n                    seen[effectiveName] = currentKind;\n                }\n                else {\n                    var existingKind = seen[effectiveName];\n                    if (currentKind === Property && existingKind === Property) {\n                        grammarErrorOnNode(name_28, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_28));\n                    }\n                    else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) {\n                        if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) {\n                            seen[effectiveName] = currentKind | existingKind;\n                        }\n                        else {\n                            return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);\n                        }\n                    }\n                    else {\n                        return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);\n                    }\n                }\n            }\n        }\n        function checkGrammarJsxElement(node) {\n            var seen = ts.createMap();\n            for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) {\n                var attr = _a[_i];\n                if (attr.kind === 251) {\n                    continue;\n                }\n                var jsxAttr = attr;\n                var name_29 = jsxAttr.name;\n                if (!seen[name_29.text]) {\n                    seen[name_29.text] = true;\n                }\n                else {\n                    return grammarErrorOnNode(name_29, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);\n                }\n                var initializer = jsxAttr.initializer;\n                if (initializer && initializer.kind === 252 && !initializer.expression) {\n                    return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression);\n                }\n            }\n        }\n        function checkGrammarForInOrForOfStatement(forInOrOfStatement) {\n            if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) {\n                return true;\n            }\n            if (forInOrOfStatement.initializer.kind === 224) {\n                var variableList = forInOrOfStatement.initializer;\n                if (!checkGrammarVariableDeclarationList(variableList)) {\n                    var declarations = variableList.declarations;\n                    if (!declarations.length) {\n                        return false;\n                    }\n                    if (declarations.length > 1) {\n                        var diagnostic = forInOrOfStatement.kind === 212\n                            ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement\n                            : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement;\n                        return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic);\n                    }\n                    var firstDeclaration = declarations[0];\n                    if (firstDeclaration.initializer) {\n                        var diagnostic = forInOrOfStatement.kind === 212\n                            ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer\n                            : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer;\n                        return grammarErrorOnNode(firstDeclaration.name, diagnostic);\n                    }\n                    if (firstDeclaration.type) {\n                        var diagnostic = forInOrOfStatement.kind === 212\n                            ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation\n                            : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation;\n                        return grammarErrorOnNode(firstDeclaration, diagnostic);\n                    }\n                }\n            }\n            return false;\n        }\n        function checkGrammarAccessor(accessor) {\n            var kind = accessor.kind;\n            if (languageVersion < 1) {\n                return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);\n            }\n            else if (ts.isInAmbientContext(accessor)) {\n                return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context);\n            }\n            else if (accessor.body === undefined && !(ts.getModifierFlags(accessor) & 128)) {\n                return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, \";\".length, ts.Diagnostics._0_expected, \"{\");\n            }\n            else if (accessor.body && ts.getModifierFlags(accessor) & 128) {\n                return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation);\n            }\n            else if (accessor.typeParameters) {\n                return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);\n            }\n            else if (!doesAccessorHaveCorrectParameterCount(accessor)) {\n                return grammarErrorOnNode(accessor.name, kind === 151 ?\n                    ts.Diagnostics.A_get_accessor_cannot_have_parameters :\n                    ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);\n            }\n            else if (kind === 152) {\n                if (accessor.type) {\n                    return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);\n                }\n                else {\n                    var parameter = accessor.parameters[0];\n                    if (parameter.dotDotDotToken) {\n                        return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter);\n                    }\n                    else if (parameter.questionToken) {\n                        return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);\n                    }\n                    else if (parameter.initializer) {\n                        return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer);\n                    }\n                }\n            }\n        }\n        function doesAccessorHaveCorrectParameterCount(accessor) {\n            return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 151 ? 0 : 1);\n        }\n        function getAccessorThisParameter(accessor) {\n            if (accessor.parameters.length === (accessor.kind === 151 ? 1 : 2)) {\n                return ts.getThisParameter(accessor);\n            }\n        }\n        function checkGrammarForNonSymbolComputedProperty(node, message) {\n            if (ts.isDynamicName(node)) {\n                return grammarErrorOnNode(node, message);\n            }\n        }\n        function checkGrammarMethod(node) {\n            if (checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) ||\n                checkGrammarFunctionLikeDeclaration(node) ||\n                checkGrammarForGenerator(node)) {\n                return true;\n            }\n            if (node.parent.kind === 176) {\n                if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) {\n                    return true;\n                }\n                else if (node.body === undefined) {\n                    return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.end - 1, \";\".length, ts.Diagnostics._0_expected, \"{\");\n                }\n            }\n            if (ts.isClassLike(node.parent)) {\n                if (ts.isInAmbientContext(node)) {\n                    return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol);\n                }\n                else if (!node.body) {\n                    return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol);\n                }\n            }\n            else if (node.parent.kind === 227) {\n                return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol);\n            }\n            else if (node.parent.kind === 161) {\n                return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol);\n            }\n        }\n        function checkGrammarBreakOrContinueStatement(node) {\n            var current = node;\n            while (current) {\n                if (ts.isFunctionLike(current)) {\n                    return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary);\n                }\n                switch (current.kind) {\n                    case 219:\n                        if (node.label && current.label.text === node.label.text) {\n                            var isMisplacedContinueLabel = node.kind === 214\n                                && !ts.isIterationStatement(current.statement, true);\n                            if (isMisplacedContinueLabel) {\n                                return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement);\n                            }\n                            return false;\n                        }\n                        break;\n                    case 218:\n                        if (node.kind === 215 && !node.label) {\n                            return false;\n                        }\n                        break;\n                    default:\n                        if (ts.isIterationStatement(current, false) && !node.label) {\n                            return false;\n                        }\n                        break;\n                }\n                current = current.parent;\n            }\n            if (node.label) {\n                var message = node.kind === 215\n                    ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement\n                    : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement;\n                return grammarErrorOnNode(node, message);\n            }\n            else {\n                var message = node.kind === 215\n                    ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement\n                    : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement;\n                return grammarErrorOnNode(node, message);\n            }\n        }\n        function checkGrammarBindingElement(node) {\n            if (node.dotDotDotToken) {\n                var elements = node.parent.elements;\n                if (node !== ts.lastOrUndefined(elements)) {\n                    return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);\n                }\n                if (node.name.kind === 173 || node.name.kind === 172) {\n                    return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);\n                }\n                if (node.initializer) {\n                    return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - 1, 1, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);\n                }\n            }\n        }\n        function isStringOrNumberLiteralExpression(expr) {\n            return expr.kind === 9 || expr.kind === 8 ||\n                expr.kind === 190 && expr.operator === 37 &&\n                    expr.operand.kind === 8;\n        }\n        function checkGrammarVariableDeclaration(node) {\n            if (node.parent.parent.kind !== 212 && node.parent.parent.kind !== 213) {\n                if (ts.isInAmbientContext(node)) {\n                    if (node.initializer) {\n                        if (ts.isConst(node) && !node.type) {\n                            if (!isStringOrNumberLiteralExpression(node.initializer)) {\n                                return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal);\n                            }\n                        }\n                        else {\n                            var equalsTokenLength = \"=\".length;\n                            return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);\n                        }\n                    }\n                    if (node.initializer && !(ts.isConst(node) && isStringOrNumberLiteralExpression(node.initializer))) {\n                        var equalsTokenLength = \"=\".length;\n                        return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);\n                    }\n                }\n                else if (!node.initializer) {\n                    if (ts.isBindingPattern(node.name) && !ts.isBindingPattern(node.parent)) {\n                        return grammarErrorOnNode(node, ts.Diagnostics.A_destructuring_declaration_must_have_an_initializer);\n                    }\n                    if (ts.isConst(node)) {\n                        return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_must_be_initialized);\n                    }\n                }\n            }\n            var checkLetConstNames = (ts.isLet(node) || ts.isConst(node));\n            return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name);\n        }\n        function checkGrammarNameInLetOrConstDeclarations(name) {\n            if (name.kind === 70) {\n                if (name.originalKeywordKind === 109) {\n                    return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations);\n                }\n            }\n            else {\n                var elements = name.elements;\n                for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) {\n                    var element = elements_2[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        checkGrammarNameInLetOrConstDeclarations(element.name);\n                    }\n                }\n            }\n        }\n        function checkGrammarVariableDeclarationList(declarationList) {\n            var declarations = declarationList.declarations;\n            if (checkGrammarForDisallowedTrailingComma(declarationList.declarations)) {\n                return true;\n            }\n            if (!declarationList.declarations.length) {\n                return grammarErrorAtPos(ts.getSourceFileOfNode(declarationList), declarations.pos, declarations.end - declarations.pos, ts.Diagnostics.Variable_declaration_list_cannot_be_empty);\n            }\n        }\n        function allowLetAndConstDeclarations(parent) {\n            switch (parent.kind) {\n                case 208:\n                case 209:\n                case 210:\n                case 217:\n                case 211:\n                case 212:\n                case 213:\n                    return false;\n                case 219:\n                    return allowLetAndConstDeclarations(parent.parent);\n            }\n            return true;\n        }\n        function checkGrammarForDisallowedLetOrConstStatement(node) {\n            if (!allowLetAndConstDeclarations(node.parent)) {\n                if (ts.isLet(node.declarationList)) {\n                    return grammarErrorOnNode(node, ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block);\n                }\n                else if (ts.isConst(node.declarationList)) {\n                    return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_can_only_be_declared_inside_a_block);\n                }\n            }\n        }\n        function hasParseDiagnostics(sourceFile) {\n            return sourceFile.parseDiagnostics.length > 0;\n        }\n        function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) {\n            var sourceFile = ts.getSourceFileOfNode(node);\n            if (!hasParseDiagnostics(sourceFile)) {\n                var span_4 = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);\n                diagnostics.add(ts.createFileDiagnostic(sourceFile, span_4.start, span_4.length, message, arg0, arg1, arg2));\n                return true;\n            }\n        }\n        function grammarErrorAtPos(sourceFile, start, length, message, arg0, arg1, arg2) {\n            if (!hasParseDiagnostics(sourceFile)) {\n                diagnostics.add(ts.createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2));\n                return true;\n            }\n        }\n        function grammarErrorOnNode(node, message, arg0, arg1, arg2) {\n            var sourceFile = ts.getSourceFileOfNode(node);\n            if (!hasParseDiagnostics(sourceFile)) {\n                diagnostics.add(ts.createDiagnosticForNode(node, message, arg0, arg1, arg2));\n                return true;\n            }\n        }\n        function checkGrammarConstructorTypeParameters(node) {\n            if (node.typeParameters) {\n                return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.typeParameters.pos, node.typeParameters.end - node.typeParameters.pos, ts.Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration);\n            }\n        }\n        function checkGrammarConstructorTypeAnnotation(node) {\n            if (node.type) {\n                return grammarErrorOnNode(node.type, ts.Diagnostics.Type_annotation_cannot_appear_on_a_constructor_declaration);\n            }\n        }\n        function checkGrammarProperty(node) {\n            if (ts.isClassLike(node.parent)) {\n                if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) {\n                    return true;\n                }\n            }\n            else if (node.parent.kind === 227) {\n                if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) {\n                    return true;\n                }\n                if (node.initializer) {\n                    return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer);\n                }\n            }\n            else if (node.parent.kind === 161) {\n                if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) {\n                    return true;\n                }\n                if (node.initializer) {\n                    return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_type_literal_property_cannot_have_an_initializer);\n                }\n            }\n            if (ts.isInAmbientContext(node) && node.initializer) {\n                return grammarErrorOnFirstToken(node.initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);\n            }\n        }\n        function checkGrammarTopLevelElementForRequiredDeclareModifier(node) {\n            if (node.kind === 227 ||\n                node.kind === 228 ||\n                node.kind === 235 ||\n                node.kind === 234 ||\n                node.kind === 241 ||\n                node.kind === 240 ||\n                node.kind === 233 ||\n                ts.getModifierFlags(node) & (2 | 1 | 512)) {\n                return false;\n            }\n            return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file);\n        }\n        function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) {\n            for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {\n                var decl = _a[_i];\n                if (ts.isDeclaration(decl) || decl.kind === 205) {\n                    if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) {\n                        return true;\n                    }\n                }\n            }\n        }\n        function checkGrammarSourceFile(node) {\n            return ts.isInAmbientContext(node) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node);\n        }\n        function checkGrammarStatementInAmbientContext(node) {\n            if (ts.isInAmbientContext(node)) {\n                if (isAccessor(node.parent.kind)) {\n                    return getNodeLinks(node).hasReportedStatementInAmbientContext = true;\n                }\n                var links = getNodeLinks(node);\n                if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) {\n                    return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts);\n                }\n                if (node.parent.kind === 204 || node.parent.kind === 231 || node.parent.kind === 261) {\n                    var links_1 = getNodeLinks(node.parent);\n                    if (!links_1.hasReportedStatementInAmbientContext) {\n                        return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts);\n                    }\n                }\n                else {\n                }\n            }\n        }\n        function checkGrammarNumericLiteral(node) {\n            if (node.isOctalLiteral && languageVersion >= 1) {\n                return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher);\n            }\n        }\n        function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) {\n            var sourceFile = ts.getSourceFileOfNode(node);\n            if (!hasParseDiagnostics(sourceFile)) {\n                var span_5 = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);\n                diagnostics.add(ts.createFileDiagnostic(sourceFile, ts.textSpanEnd(span_5), 0, message, arg0, arg1, arg2));\n                return true;\n            }\n        }\n        function getAmbientModules() {\n            var result = [];\n            for (var sym in globals) {\n                if (ambientModuleSymbolRegex.test(sym)) {\n                    result.push(globals[sym]);\n                }\n            }\n            return result;\n        }\n    }\n    ts.createTypeChecker = createTypeChecker;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    ;\n    var nodeEdgeTraversalMap = ts.createMap((_a = {},\n        _a[141] = [\n            { name: \"left\", test: ts.isEntityName },\n            { name: \"right\", test: ts.isIdentifier }\n        ],\n        _a[145] = [\n            { name: \"expression\", test: ts.isLeftHandSideExpression }\n        ],\n        _a[182] = [\n            { name: \"type\", test: ts.isTypeNode },\n            { name: \"expression\", test: ts.isUnaryExpression }\n        ],\n        _a[200] = [\n            { name: \"expression\", test: ts.isExpression },\n            { name: \"type\", test: ts.isTypeNode }\n        ],\n        _a[201] = [\n            { name: \"expression\", test: ts.isLeftHandSideExpression }\n        ],\n        _a[229] = [\n            { name: \"decorators\", test: ts.isDecorator },\n            { name: \"modifiers\", test: ts.isModifier },\n            { name: \"name\", test: ts.isIdentifier },\n            { name: \"members\", test: ts.isEnumMember }\n        ],\n        _a[230] = [\n            { name: \"decorators\", test: ts.isDecorator },\n            { name: \"modifiers\", test: ts.isModifier },\n            { name: \"name\", test: ts.isModuleName },\n            { name: \"body\", test: ts.isModuleBody }\n        ],\n        _a[231] = [\n            { name: \"statements\", test: ts.isStatement }\n        ],\n        _a[234] = [\n            { name: \"decorators\", test: ts.isDecorator },\n            { name: \"modifiers\", test: ts.isModifier },\n            { name: \"name\", test: ts.isIdentifier },\n            { name: \"moduleReference\", test: ts.isModuleReference }\n        ],\n        _a[245] = [\n            { name: \"expression\", test: ts.isExpression, optional: true }\n        ],\n        _a[260] = [\n            { name: \"name\", test: ts.isPropertyName },\n            { name: \"initializer\", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList }\n        ],\n        _a));\n    function reduceNode(node, f, initial) {\n        return node ? f(initial, node) : initial;\n    }\n    function reduceNodeArray(nodes, f, initial) {\n        return nodes ? f(initial, nodes) : initial;\n    }\n    function reduceEachChild(node, initial, cbNode, cbNodeArray) {\n        if (node === undefined) {\n            return initial;\n        }\n        var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft;\n        var cbNodes = cbNodeArray || cbNode;\n        var kind = node.kind;\n        if ((kind > 0 && kind <= 140)) {\n            return initial;\n        }\n        if ((kind >= 156 && kind <= 171)) {\n            return initial;\n        }\n        var result = initial;\n        switch (node.kind) {\n            case 203:\n            case 206:\n            case 198:\n            case 222:\n            case 293:\n                break;\n            case 142:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 144:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            case 145:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 147:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            case 149:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 150:\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 151:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 152:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 172:\n            case 173:\n                result = reduceNodes(node.elements, cbNodes, result);\n                break;\n            case 174:\n                result = reduceNode(node.propertyName, cbNode, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            case 175:\n                result = reduceNodes(node.elements, cbNodes, result);\n                break;\n            case 176:\n                result = reduceNodes(node.properties, cbNodes, result);\n                break;\n            case 177:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.name, cbNode, result);\n                break;\n            case 178:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.argumentExpression, cbNode, result);\n                break;\n            case 179:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNodes(node.typeArguments, cbNodes, result);\n                result = reduceNodes(node.arguments, cbNodes, result);\n                break;\n            case 180:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNodes(node.typeArguments, cbNodes, result);\n                result = reduceNodes(node.arguments, cbNodes, result);\n                break;\n            case 181:\n                result = reduceNode(node.tag, cbNode, result);\n                result = reduceNode(node.template, cbNode, result);\n                break;\n            case 184:\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 185:\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 183:\n            case 186:\n            case 187:\n            case 188:\n            case 189:\n            case 195:\n            case 196:\n            case 201:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 190:\n            case 191:\n                result = reduceNode(node.operand, cbNode, result);\n                break;\n            case 192:\n                result = reduceNode(node.left, cbNode, result);\n                result = reduceNode(node.right, cbNode, result);\n                break;\n            case 193:\n                result = reduceNode(node.condition, cbNode, result);\n                result = reduceNode(node.whenTrue, cbNode, result);\n                result = reduceNode(node.whenFalse, cbNode, result);\n                break;\n            case 194:\n                result = reduceNode(node.head, cbNode, result);\n                result = reduceNodes(node.templateSpans, cbNodes, result);\n                break;\n            case 197:\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.heritageClauses, cbNodes, result);\n                result = reduceNodes(node.members, cbNodes, result);\n                break;\n            case 199:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNodes(node.typeArguments, cbNodes, result);\n                break;\n            case 202:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.literal, cbNode, result);\n                break;\n            case 204:\n                result = reduceNodes(node.statements, cbNodes, result);\n                break;\n            case 205:\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.declarationList, cbNode, result);\n                break;\n            case 207:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 208:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.thenStatement, cbNode, result);\n                result = reduceNode(node.elseStatement, cbNode, result);\n                break;\n            case 209:\n                result = reduceNode(node.statement, cbNode, result);\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 210:\n            case 217:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.statement, cbNode, result);\n                break;\n            case 211:\n                result = reduceNode(node.initializer, cbNode, result);\n                result = reduceNode(node.condition, cbNode, result);\n                result = reduceNode(node.incrementor, cbNode, result);\n                result = reduceNode(node.statement, cbNode, result);\n                break;\n            case 212:\n            case 213:\n                result = reduceNode(node.initializer, cbNode, result);\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.statement, cbNode, result);\n                break;\n            case 216:\n            case 220:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 218:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.caseBlock, cbNode, result);\n                break;\n            case 219:\n                result = reduceNode(node.label, cbNode, result);\n                result = reduceNode(node.statement, cbNode, result);\n                break;\n            case 221:\n                result = reduceNode(node.tryBlock, cbNode, result);\n                result = reduceNode(node.catchClause, cbNode, result);\n                result = reduceNode(node.finallyBlock, cbNode, result);\n                break;\n            case 223:\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            case 224:\n                result = reduceNodes(node.declarations, cbNodes, result);\n                break;\n            case 225:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 226:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.heritageClauses, cbNodes, result);\n                result = reduceNodes(node.members, cbNodes, result);\n                break;\n            case 232:\n                result = reduceNodes(node.clauses, cbNodes, result);\n                break;\n            case 235:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.importClause, cbNode, result);\n                result = reduceNode(node.moduleSpecifier, cbNode, result);\n                break;\n            case 236:\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.namedBindings, cbNode, result);\n                break;\n            case 237:\n                result = reduceNode(node.name, cbNode, result);\n                break;\n            case 238:\n            case 242:\n                result = reduceNodes(node.elements, cbNodes, result);\n                break;\n            case 239:\n            case 243:\n                result = reduceNode(node.propertyName, cbNode, result);\n                result = reduceNode(node.name, cbNode, result);\n                break;\n            case 240:\n                result = ts.reduceLeft(node.decorators, cbNode, result);\n                result = ts.reduceLeft(node.modifiers, cbNode, result);\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 241:\n                result = ts.reduceLeft(node.decorators, cbNode, result);\n                result = ts.reduceLeft(node.modifiers, cbNode, result);\n                result = reduceNode(node.exportClause, cbNode, result);\n                result = reduceNode(node.moduleSpecifier, cbNode, result);\n                break;\n            case 246:\n                result = reduceNode(node.openingElement, cbNode, result);\n                result = ts.reduceLeft(node.children, cbNode, result);\n                result = reduceNode(node.closingElement, cbNode, result);\n                break;\n            case 247:\n            case 248:\n                result = reduceNode(node.tagName, cbNode, result);\n                result = reduceNodes(node.attributes, cbNodes, result);\n                break;\n            case 249:\n                result = reduceNode(node.tagName, cbNode, result);\n                break;\n            case 250:\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            case 251:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 252:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 253:\n                result = reduceNode(node.expression, cbNode, result);\n            case 254:\n                result = reduceNodes(node.statements, cbNodes, result);\n                break;\n            case 255:\n                result = reduceNodes(node.types, cbNodes, result);\n                break;\n            case 256:\n                result = reduceNode(node.variableDeclaration, cbNode, result);\n                result = reduceNode(node.block, cbNode, result);\n                break;\n            case 257:\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            case 258:\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.objectAssignmentInitializer, cbNode, result);\n                break;\n            case 259:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 261:\n                result = reduceNodes(node.statements, cbNodes, result);\n                break;\n            case 294:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            default:\n                var edgeTraversalPath = nodeEdgeTraversalMap[kind];\n                if (edgeTraversalPath) {\n                    for (var _i = 0, edgeTraversalPath_1 = edgeTraversalPath; _i < edgeTraversalPath_1.length; _i++) {\n                        var edge = edgeTraversalPath_1[_i];\n                        var value = node[edge.name];\n                        if (value !== undefined) {\n                            result = ts.isArray(value)\n                                ? reduceNodes(value, cbNodes, result)\n                                : cbNode(result, value);\n                        }\n                    }\n                }\n                break;\n        }\n        return result;\n    }\n    ts.reduceEachChild = reduceEachChild;\n    function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) {\n        if (node === undefined || visitor === undefined) {\n            return node;\n        }\n        aggregateTransformFlags(node);\n        var visited = visitor(node);\n        if (visited === node) {\n            return node;\n        }\n        var visitedNode;\n        if (visited === undefined) {\n            if (!optional) {\n                Debug.failNotOptional();\n            }\n            return undefined;\n        }\n        else if (ts.isArray(visited)) {\n            visitedNode = (lift || extractSingleNode)(visited);\n        }\n        else {\n            visitedNode = visited;\n        }\n        if (parenthesize !== undefined) {\n            visitedNode = parenthesize(visitedNode, parentNode);\n        }\n        Debug.assertNode(visitedNode, test);\n        aggregateTransformFlags(visitedNode);\n        return visitedNode;\n    }\n    ts.visitNode = visitNode;\n    function visitNodes(nodes, visitor, test, start, count, parenthesize, parentNode) {\n        if (nodes === undefined) {\n            return undefined;\n        }\n        var updated;\n        var length = nodes.length;\n        if (start === undefined || start < 0) {\n            start = 0;\n        }\n        if (count === undefined || count > length - start) {\n            count = length - start;\n        }\n        if (start > 0 || count < length) {\n            updated = ts.createNodeArray([], undefined, nodes.hasTrailingComma && start + count === length);\n        }\n        for (var i = 0; i < count; i++) {\n            var node = nodes[i + start];\n            aggregateTransformFlags(node);\n            var visited = node !== undefined ? visitor(node) : undefined;\n            if (updated !== undefined || visited === undefined || visited !== node) {\n                if (updated === undefined) {\n                    updated = ts.createNodeArray(nodes.slice(0, i), nodes, nodes.hasTrailingComma);\n                }\n                if (visited) {\n                    if (ts.isArray(visited)) {\n                        for (var _i = 0, visited_1 = visited; _i < visited_1.length; _i++) {\n                            var visitedNode = visited_1[_i];\n                            visitedNode = parenthesize\n                                ? parenthesize(visitedNode, parentNode)\n                                : visitedNode;\n                            Debug.assertNode(visitedNode, test);\n                            aggregateTransformFlags(visitedNode);\n                            updated.push(visitedNode);\n                        }\n                    }\n                    else {\n                        var visitedNode = parenthesize\n                            ? parenthesize(visited, parentNode)\n                            : visited;\n                        Debug.assertNode(visitedNode, test);\n                        aggregateTransformFlags(visitedNode);\n                        updated.push(visitedNode);\n                    }\n                }\n            }\n        }\n        return updated || nodes;\n    }\n    ts.visitNodes = visitNodes;\n    function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) {\n        context.startLexicalEnvironment();\n        statements = visitNodes(statements, visitor, ts.isStatement, start);\n        if (ensureUseStrict && !ts.startsWithUseStrict(statements)) {\n            statements = ts.createNodeArray([ts.createStatement(ts.createLiteral(\"use strict\"))].concat(statements), statements);\n        }\n        var declarations = context.endLexicalEnvironment();\n        return ts.createNodeArray(ts.concatenate(statements, declarations), statements);\n    }\n    ts.visitLexicalEnvironment = visitLexicalEnvironment;\n    function visitParameterList(nodes, visitor, context) {\n        context.startLexicalEnvironment();\n        var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration);\n        context.suspendLexicalEnvironment();\n        return updated;\n    }\n    ts.visitParameterList = visitParameterList;\n    function visitFunctionBody(node, visitor, context) {\n        context.resumeLexicalEnvironment();\n        var updated = visitNode(node, visitor, ts.isConciseBody);\n        var declarations = context.endLexicalEnvironment();\n        if (ts.some(declarations)) {\n            var block = ts.convertToFunctionBody(updated);\n            var statements = mergeLexicalEnvironment(block.statements, declarations);\n            return ts.updateBlock(block, statements);\n        }\n        return updated;\n    }\n    ts.visitFunctionBody = visitFunctionBody;\n    function visitEachChild(node, visitor, context) {\n        if (node === undefined) {\n            return undefined;\n        }\n        var kind = node.kind;\n        if ((kind > 0 && kind <= 140)) {\n            return node;\n        }\n        if ((kind >= 156 && kind <= 171)) {\n            return node;\n        }\n        switch (node.kind) {\n            case 203:\n            case 206:\n            case 198:\n            case 222:\n                return node;\n            case 142:\n                return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 144:\n                return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));\n            case 147:\n                return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));\n            case 149:\n                return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));\n            case 150:\n                return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context));\n            case 151:\n                return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));\n            case 152:\n                return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context));\n            case 172:\n                return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement));\n            case 173:\n                return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement));\n            case 174:\n                return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true));\n            case 175:\n                return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression));\n            case 176:\n                return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike));\n            case 177:\n                return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier));\n            case 178:\n                return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression));\n            case 179:\n                return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression));\n            case 180:\n                return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression));\n            case 181:\n                return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral));\n            case 183:\n                return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 184:\n                return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));\n            case 185:\n                return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));\n            case 186:\n                return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 187:\n                return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 188:\n                return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 189:\n                return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 192:\n                return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression));\n            case 190:\n                return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression));\n            case 191:\n                return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression));\n            case 193:\n                return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression));\n            case 194:\n                return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan));\n            case 195:\n                return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 196:\n                return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 197:\n                return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement));\n            case 199:\n                return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));\n            case 202:\n                return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail));\n            case 204:\n                return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement));\n            case 205:\n                return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList));\n            case 207:\n                return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 208:\n                return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock));\n            case 209:\n                return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression));\n            case 210:\n                return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));\n            case 211:\n                return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));\n            case 212:\n                return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));\n            case 213:\n                return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));\n            case 214:\n                return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true));\n            case 215:\n                return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true));\n            case 216:\n                return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true));\n            case 217:\n                return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));\n            case 218:\n                return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock));\n            case 219:\n                return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));\n            case 220:\n                return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 221:\n                return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, true), visitNode(node.finallyBlock, visitor, ts.isBlock, true));\n            case 223:\n                return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));\n            case 224:\n                return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration));\n            case 225:\n                return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));\n            case 226:\n                return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement));\n            case 232:\n                return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause));\n            case 235:\n                return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression));\n            case 236:\n                return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true));\n            case 237:\n                return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier));\n            case 238:\n                return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier));\n            case 239:\n                return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier));\n            case 240:\n                return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression));\n            case 241:\n                return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true));\n            case 242:\n                return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier));\n            case 243:\n                return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier));\n            case 246:\n                return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement));\n            case 247:\n                return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike));\n            case 248:\n                return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike));\n            case 249:\n                return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression));\n            case 250:\n                return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression));\n            case 251:\n                return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 252:\n                return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 253:\n                return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement));\n            case 254:\n                return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement));\n            case 255:\n                return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments));\n            case 256:\n                return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock));\n            case 257:\n                return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));\n            case 258:\n                return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression));\n            case 259:\n                return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 261:\n                return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));\n            case 294:\n                return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));\n            default:\n                var updated = void 0;\n                var edgeTraversalPath = nodeEdgeTraversalMap[kind];\n                if (edgeTraversalPath) {\n                    for (var _i = 0, edgeTraversalPath_2 = edgeTraversalPath; _i < edgeTraversalPath_2.length; _i++) {\n                        var edge = edgeTraversalPath_2[_i];\n                        var value = node[edge.name];\n                        if (value !== undefined) {\n                            var visited = ts.isArray(value)\n                                ? visitNodes(value, visitor, edge.test, 0, value.length, edge.parenthesize, node)\n                                : visitNode(value, visitor, edge.test, edge.optional, edge.lift, edge.parenthesize, node);\n                            if (updated !== undefined || visited !== value) {\n                                if (updated === undefined) {\n                                    updated = ts.getMutableClone(node);\n                                }\n                                if (visited !== value) {\n                                    updated[edge.name] = visited;\n                                }\n                            }\n                        }\n                    }\n                }\n                return updated ? ts.updateNode(updated, node) : node;\n        }\n    }\n    ts.visitEachChild = visitEachChild;\n    function mergeLexicalEnvironment(statements, declarations) {\n        if (!ts.some(declarations)) {\n            return statements;\n        }\n        return ts.isNodeArray(statements)\n            ? ts.createNodeArray(ts.concatenate(statements, declarations), statements)\n            : ts.addRange(statements, declarations);\n    }\n    ts.mergeLexicalEnvironment = mergeLexicalEnvironment;\n    function mergeFunctionBodyLexicalEnvironment(body, declarations) {\n        if (body && declarations !== undefined && declarations.length > 0) {\n            if (ts.isBlock(body)) {\n                return ts.updateBlock(body, ts.createNodeArray(ts.concatenate(body.statements, declarations), body.statements));\n            }\n            else {\n                return ts.createBlock(ts.createNodeArray([ts.createReturn(body, body)].concat(declarations), body), body, true);\n            }\n        }\n        return body;\n    }\n    ts.mergeFunctionBodyLexicalEnvironment = mergeFunctionBodyLexicalEnvironment;\n    function liftToBlock(nodes) {\n        Debug.assert(ts.every(nodes, ts.isStatement), \"Cannot lift nodes to a Block.\");\n        return ts.singleOrUndefined(nodes) || ts.createBlock(nodes);\n    }\n    ts.liftToBlock = liftToBlock;\n    function extractSingleNode(nodes) {\n        Debug.assert(nodes.length <= 1, \"Too many nodes written to output.\");\n        return ts.singleOrUndefined(nodes);\n    }\n    function aggregateTransformFlags(node) {\n        aggregateTransformFlagsForNode(node);\n        return node;\n    }\n    ts.aggregateTransformFlags = aggregateTransformFlags;\n    function aggregateTransformFlagsForNode(node) {\n        if (node === undefined) {\n            return 0;\n        }\n        if (node.transformFlags & 536870912) {\n            return node.transformFlags & ~ts.getTransformFlagsSubtreeExclusions(node.kind);\n        }\n        var subtreeFlags = aggregateTransformFlagsForSubtree(node);\n        return ts.computeTransformFlagsForNode(node, subtreeFlags);\n    }\n    function aggregateTransformFlagsForNodeArray(nodes) {\n        if (nodes === undefined) {\n            return 0;\n        }\n        var subtreeFlags = 0;\n        var nodeArrayFlags = 0;\n        for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) {\n            var node = nodes_3[_i];\n            subtreeFlags |= aggregateTransformFlagsForNode(node);\n            nodeArrayFlags |= node.transformFlags & ~536870912;\n        }\n        nodes.transformFlags = nodeArrayFlags | 536870912;\n        return subtreeFlags;\n    }\n    function aggregateTransformFlagsForSubtree(node) {\n        if (ts.hasModifier(node, 2) || ts.isTypeNode(node)) {\n            return 0;\n        }\n        return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes);\n    }\n    function aggregateTransformFlagsForChildNode(transformFlags, node) {\n        return transformFlags | aggregateTransformFlagsForNode(node);\n    }\n    function aggregateTransformFlagsForChildNodes(transformFlags, nodes) {\n        return transformFlags | aggregateTransformFlagsForNodeArray(nodes);\n    }\n    var Debug;\n    (function (Debug) {\n        Debug.failNotOptional = Debug.shouldAssert(1)\n            ? function (message) { return Debug.assert(false, message || \"Node not optional.\"); }\n            : ts.noop;\n        Debug.failBadSyntaxKind = Debug.shouldAssert(1)\n            ? function (node, message) { return Debug.assert(false, message || \"Unexpected node.\", function () { return \"Node \" + ts.formatSyntaxKind(node.kind) + \" was unexpected.\"; }); }\n            : ts.noop;\n        Debug.assertEachNode = Debug.shouldAssert(1)\n            ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || \"Unexpected node.\", function () { return \"Node array did not pass test '\" + getFunctionName(test) + \"'.\"; }); }\n            : ts.noop;\n        Debug.assertNode = Debug.shouldAssert(1)\n            ? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || \"Unexpected node.\", function () { return \"Node \" + ts.formatSyntaxKind(node.kind) + \" did not pass test '\" + getFunctionName(test) + \"'.\"; }); }\n            : ts.noop;\n        Debug.assertOptionalNode = Debug.shouldAssert(1)\n            ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || \"Unexpected node.\", function () { return \"Node \" + ts.formatSyntaxKind(node.kind) + \" did not pass test '\" + getFunctionName(test) + \"'.\"; }); }\n            : ts.noop;\n        Debug.assertOptionalToken = Debug.shouldAssert(1)\n            ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || \"Unexpected node.\", function () { return \"Node \" + ts.formatSyntaxKind(node.kind) + \" was not a '\" + ts.formatSyntaxKind(kind) + \"' token.\"; }); }\n            : ts.noop;\n        Debug.assertMissingNode = Debug.shouldAssert(1)\n            ? function (node, message) { return Debug.assert(node === undefined, message || \"Unexpected node.\", function () { return \"Node \" + ts.formatSyntaxKind(node.kind) + \" was unexpected'.\"; }); }\n            : ts.noop;\n        function getFunctionName(func) {\n            if (typeof func !== \"function\") {\n                return \"\";\n            }\n            else if (func.hasOwnProperty(\"name\")) {\n                return func.name;\n            }\n            else {\n                var text = Function.prototype.toString.call(func);\n                var match = /^function\\s+([\\w\\$]+)\\s*\\(/.exec(text);\n                return match ? match[1] : \"\";\n            }\n        }\n    })(Debug = ts.Debug || (ts.Debug = {}));\n    var _a;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) {\n        var location = node;\n        var value;\n        if (ts.isDestructuringAssignment(node)) {\n            value = node.right;\n            while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) {\n                if (ts.isDestructuringAssignment(value)) {\n                    location = node = value;\n                    value = node.right;\n                }\n                else {\n                    return value;\n                }\n            }\n        }\n        var expressions;\n        var flattenContext = {\n            context: context,\n            level: level,\n            hoistTempVariables: true,\n            emitExpression: emitExpression,\n            emitBindingOrAssignment: emitBindingOrAssignment,\n            createArrayBindingOrAssignmentPattern: makeArrayAssignmentPattern,\n            createObjectBindingOrAssignmentPattern: makeObjectAssignmentPattern,\n            createArrayBindingOrAssignmentElement: makeAssignmentElement,\n            visitor: visitor\n        };\n        if (value) {\n            value = ts.visitNode(value, visitor, ts.isExpression);\n            if (needsValue) {\n                value = ensureIdentifier(flattenContext, value, true, location);\n            }\n            else if (ts.nodeIsSynthesized(node)) {\n                location = value;\n            }\n        }\n        flattenBindingOrAssignmentElement(flattenContext, node, value, location, ts.isDestructuringAssignment(node));\n        if (value && needsValue) {\n            if (!ts.some(expressions)) {\n                return value;\n            }\n            expressions.push(value);\n        }\n        return ts.aggregateTransformFlags(ts.inlineExpressions(expressions)) || ts.createOmittedExpression();\n        function emitExpression(expression) {\n            ts.setEmitFlags(expression, 64);\n            ts.aggregateTransformFlags(expression);\n            expressions = ts.append(expressions, expression);\n        }\n        function emitBindingOrAssignment(target, value, location, original) {\n            ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression);\n            var expression = createAssignmentCallback\n                ? createAssignmentCallback(target, value, location)\n                : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location);\n            expression.original = original;\n            emitExpression(expression);\n        }\n    }\n    ts.flattenDestructuringAssignment = flattenDestructuringAssignment;\n    function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) {\n        var pendingExpressions;\n        var pendingDeclarations = [];\n        var declarations = [];\n        var flattenContext = {\n            context: context,\n            level: level,\n            hoistTempVariables: hoistTempVariables,\n            emitExpression: emitExpression,\n            emitBindingOrAssignment: emitBindingOrAssignment,\n            createArrayBindingOrAssignmentPattern: makeArrayBindingPattern,\n            createObjectBindingOrAssignmentPattern: makeObjectBindingPattern,\n            createArrayBindingOrAssignmentElement: makeBindingElement,\n            visitor: visitor\n        };\n        flattenBindingOrAssignmentElement(flattenContext, node, rval, node, skipInitializer);\n        if (pendingExpressions) {\n            var temp = ts.createTempVariable(undefined);\n            if (hoistTempVariables) {\n                var value = ts.inlineExpressions(pendingExpressions);\n                pendingExpressions = undefined;\n                emitBindingOrAssignment(temp, value, undefined, undefined);\n            }\n            else {\n                context.hoistVariableDeclaration(temp);\n                var pendingDeclaration = ts.lastOrUndefined(pendingDeclarations);\n                pendingDeclaration.pendingExpressions = ts.append(pendingDeclaration.pendingExpressions, ts.createAssignment(temp, pendingDeclaration.value));\n                ts.addRange(pendingDeclaration.pendingExpressions, pendingExpressions);\n                pendingDeclaration.value = temp;\n            }\n        }\n        for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) {\n            var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_30 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original;\n            var variable = ts.createVariableDeclaration(name_30, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2);\n            variable.original = original;\n            if (ts.isIdentifier(name_30)) {\n                ts.setEmitFlags(variable, 64);\n            }\n            ts.aggregateTransformFlags(variable);\n            declarations.push(variable);\n        }\n        return declarations;\n        function emitExpression(value) {\n            pendingExpressions = ts.append(pendingExpressions, value);\n        }\n        function emitBindingOrAssignment(target, value, location, original) {\n            ts.Debug.assertNode(target, ts.isBindingName);\n            if (pendingExpressions) {\n                value = ts.inlineExpressions(ts.append(pendingExpressions, value));\n                pendingExpressions = undefined;\n            }\n            pendingDeclarations.push({ pendingExpressions: pendingExpressions, name: target, value: value, location: location, original: original });\n        }\n    }\n    ts.flattenDestructuringBinding = flattenDestructuringBinding;\n    function flattenBindingOrAssignmentElement(flattenContext, element, value, location, skipInitializer) {\n        if (!skipInitializer) {\n            var initializer = ts.visitNode(ts.getInitializerOfBindingOrAssignmentElement(element), flattenContext.visitor, ts.isExpression);\n            if (initializer) {\n                value = value ? createDefaultValueCheck(flattenContext, value, initializer, location) : initializer;\n            }\n            else if (!value) {\n                value = ts.createVoidZero();\n            }\n        }\n        var bindingTarget = ts.getTargetOfBindingOrAssignmentElement(element);\n        if (ts.isObjectBindingOrAssignmentPattern(bindingTarget)) {\n            flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);\n        }\n        else if (ts.isArrayBindingOrAssignmentPattern(bindingTarget)) {\n            flattenArrayBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);\n        }\n        else {\n            flattenContext.emitBindingOrAssignment(bindingTarget, value, location, element);\n        }\n    }\n    function flattenObjectBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {\n        var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);\n        var numElements = elements.length;\n        if (numElements !== 1) {\n            var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;\n            value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);\n        }\n        var bindingElements;\n        var computedTempVariables;\n        for (var i = 0; i < numElements; i++) {\n            var element = elements[i];\n            if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {\n                var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(element);\n                if (flattenContext.level >= 1\n                    && !(element.transformFlags & (524288 | 1048576))\n                    && !(ts.getTargetOfBindingOrAssignmentElement(element).transformFlags & (524288 | 1048576))\n                    && !ts.isComputedPropertyName(propertyName)) {\n                    bindingElements = ts.append(bindingElements, element);\n                }\n                else {\n                    if (bindingElements) {\n                        flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);\n                        bindingElements = undefined;\n                    }\n                    var rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName);\n                    if (ts.isComputedPropertyName(propertyName)) {\n                        computedTempVariables = ts.append(computedTempVariables, rhsValue.argumentExpression);\n                    }\n                    flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);\n                }\n            }\n            else if (i === numElements - 1) {\n                if (bindingElements) {\n                    flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);\n                    bindingElements = undefined;\n                }\n                var rhsValue = createRestCall(flattenContext.context, value, elements, computedTempVariables, pattern);\n                flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);\n            }\n        }\n        if (bindingElements) {\n            flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);\n        }\n    }\n    function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {\n        var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);\n        var numElements = elements.length;\n        if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0)) {\n            var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;\n            value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);\n        }\n        var bindingElements;\n        var restContainingElements;\n        for (var i = 0; i < numElements; i++) {\n            var element = elements[i];\n            if (flattenContext.level >= 1) {\n                if (element.transformFlags & 1048576) {\n                    var temp = ts.createTempVariable(undefined);\n                    if (flattenContext.hoistTempVariables) {\n                        flattenContext.context.hoistVariableDeclaration(temp);\n                    }\n                    restContainingElements = ts.append(restContainingElements, [temp, element]);\n                    bindingElements = ts.append(bindingElements, flattenContext.createArrayBindingOrAssignmentElement(temp));\n                }\n                else {\n                    bindingElements = ts.append(bindingElements, element);\n                }\n            }\n            else if (ts.isOmittedExpression(element)) {\n                continue;\n            }\n            else if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {\n                var rhsValue = ts.createElementAccess(value, i);\n                flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);\n            }\n            else if (i === numElements - 1) {\n                var rhsValue = ts.createArraySlice(value, i);\n                flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);\n            }\n        }\n        if (bindingElements) {\n            flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern);\n        }\n        if (restContainingElements) {\n            for (var _i = 0, restContainingElements_1 = restContainingElements; _i < restContainingElements_1.length; _i++) {\n                var _a = restContainingElements_1[_i], id = _a[0], element = _a[1];\n                flattenBindingOrAssignmentElement(flattenContext, element, id, element);\n            }\n        }\n    }\n    function createDefaultValueCheck(flattenContext, value, defaultValue, location) {\n        value = ensureIdentifier(flattenContext, value, true, location);\n        return ts.createConditional(ts.createTypeCheck(value, \"undefined\"), defaultValue, value);\n    }\n    function createDestructuringPropertyAccess(flattenContext, value, propertyName) {\n        if (ts.isComputedPropertyName(propertyName)) {\n            var argumentExpression = ensureIdentifier(flattenContext, propertyName.expression, false, propertyName);\n            return ts.createElementAccess(value, argumentExpression);\n        }\n        else if (ts.isStringOrNumericLiteral(propertyName)) {\n            var argumentExpression = ts.getSynthesizedClone(propertyName);\n            argumentExpression.text = ts.unescapeIdentifier(argumentExpression.text);\n            return ts.createElementAccess(value, argumentExpression);\n        }\n        else {\n            var name_31 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text));\n            return ts.createPropertyAccess(value, name_31);\n        }\n    }\n    function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) {\n        if (ts.isIdentifier(value) && reuseIdentifierExpressions) {\n            return value;\n        }\n        else {\n            var temp = ts.createTempVariable(undefined);\n            if (flattenContext.hoistTempVariables) {\n                flattenContext.context.hoistVariableDeclaration(temp);\n                flattenContext.emitExpression(ts.createAssignment(temp, value, location));\n            }\n            else {\n                flattenContext.emitBindingOrAssignment(temp, value, location, undefined);\n            }\n            return temp;\n        }\n    }\n    function makeArrayBindingPattern(elements) {\n        ts.Debug.assertEachNode(elements, ts.isArrayBindingElement);\n        return ts.createArrayBindingPattern(elements);\n    }\n    function makeArrayAssignmentPattern(elements) {\n        return ts.createArrayLiteral(ts.map(elements, ts.convertToArrayAssignmentElement));\n    }\n    function makeObjectBindingPattern(elements) {\n        ts.Debug.assertEachNode(elements, ts.isBindingElement);\n        return ts.createObjectBindingPattern(elements);\n    }\n    function makeObjectAssignmentPattern(elements) {\n        return ts.createObjectLiteral(ts.map(elements, ts.convertToObjectAssignmentElement));\n    }\n    function makeBindingElement(name) {\n        return ts.createBindingElement(undefined, undefined, name);\n    }\n    function makeAssignmentElement(name) {\n        return name;\n    }\n    var restHelper = {\n        name: \"typescript:rest\",\n        scoped: false,\n        text: \"\\n            var __rest = (this && this.__rest) || function (s, e) {\\n                var t = {};\\n                for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\\n                    t[p] = s[p];\\n                if (s != null && typeof Object.getOwnPropertySymbols === \\\"function\\\")\\n                    for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\\n                        t[p[i]] = s[p[i]];\\n                return t;\\n            };\"\n    };\n    function createRestCall(context, value, elements, computedTempVariables, location) {\n        context.requestEmitHelper(restHelper);\n        var propertyNames = [];\n        var computedTempVariableOffset = 0;\n        for (var i = 0; i < elements.length - 1; i++) {\n            var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(elements[i]);\n            if (propertyName) {\n                if (ts.isComputedPropertyName(propertyName)) {\n                    var temp = computedTempVariables[computedTempVariableOffset];\n                    computedTempVariableOffset++;\n                    propertyNames.push(ts.createConditional(ts.createTypeCheck(temp, \"symbol\"), temp, ts.createAdd(temp, ts.createLiteral(\"\"))));\n                }\n                else {\n                    propertyNames.push(ts.createLiteral(propertyName));\n                }\n            }\n        }\n        return ts.createCall(ts.getHelperName(\"__rest\"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]);\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var USE_NEW_TYPE_METADATA_FORMAT = false;\n    function transformTypeScript(context) {\n        var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;\n        var resolver = context.getEmitResolver();\n        var compilerOptions = context.getCompilerOptions();\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        var moduleKind = ts.getEmitModuleKind(compilerOptions);\n        var previousOnEmitNode = context.onEmitNode;\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        context.onEmitNode = onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        context.enableSubstitution(177);\n        context.enableSubstitution(178);\n        var currentSourceFile;\n        var currentNamespace;\n        var currentNamespaceContainerName;\n        var currentScope;\n        var currentScopeFirstDeclarationsOfName;\n        var enabledSubstitutions;\n        var classAliases;\n        var applicableSubstitutions;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            currentSourceFile = node;\n            var visited = saveStateAndInvoke(node, visitSourceFile);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            currentSourceFile = undefined;\n            return visited;\n        }\n        function saveStateAndInvoke(node, f) {\n            var savedCurrentScope = currentScope;\n            var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;\n            onBeforeVisitNode(node);\n            var visited = f(node);\n            if (currentScope !== savedCurrentScope) {\n                currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;\n            }\n            currentScope = savedCurrentScope;\n            return visited;\n        }\n        function onBeforeVisitNode(node) {\n            switch (node.kind) {\n                case 261:\n                case 232:\n                case 231:\n                case 204:\n                    currentScope = node;\n                    currentScopeFirstDeclarationsOfName = undefined;\n                    break;\n                case 226:\n                case 225:\n                    if (ts.hasModifier(node, 2)) {\n                        break;\n                    }\n                    recordEmittedDeclarationInScope(node);\n                    break;\n            }\n        }\n        function visitor(node) {\n            return saveStateAndInvoke(node, visitorWorker);\n        }\n        function visitorWorker(node) {\n            if (node.transformFlags & 1) {\n                return visitTypeScript(node);\n            }\n            else if (node.transformFlags & 2) {\n                return ts.visitEachChild(node, visitor, context);\n            }\n            return node;\n        }\n        function sourceElementVisitor(node) {\n            return saveStateAndInvoke(node, sourceElementVisitorWorker);\n        }\n        function sourceElementVisitorWorker(node) {\n            switch (node.kind) {\n                case 235:\n                    return visitImportDeclaration(node);\n                case 234:\n                    return visitImportEqualsDeclaration(node);\n                case 240:\n                    return visitExportAssignment(node);\n                case 241:\n                    return visitExportDeclaration(node);\n                default:\n                    return visitorWorker(node);\n            }\n        }\n        function namespaceElementVisitor(node) {\n            return saveStateAndInvoke(node, namespaceElementVisitorWorker);\n        }\n        function namespaceElementVisitorWorker(node) {\n            if (node.kind === 241 ||\n                node.kind === 235 ||\n                node.kind === 236 ||\n                (node.kind === 234 &&\n                    node.moduleReference.kind === 245)) {\n                return undefined;\n            }\n            else if (node.transformFlags & 1 || ts.hasModifier(node, 1)) {\n                return visitTypeScript(node);\n            }\n            else if (node.transformFlags & 2) {\n                return ts.visitEachChild(node, visitor, context);\n            }\n            return node;\n        }\n        function classElementVisitor(node) {\n            return saveStateAndInvoke(node, classElementVisitorWorker);\n        }\n        function classElementVisitorWorker(node) {\n            switch (node.kind) {\n                case 150:\n                    return undefined;\n                case 147:\n                case 155:\n                case 151:\n                case 152:\n                case 149:\n                    return visitorWorker(node);\n                case 203:\n                    return node;\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    return undefined;\n            }\n        }\n        function modifierVisitor(node) {\n            if (ts.modifierToFlag(node.kind) & 2270) {\n                return undefined;\n            }\n            else if (currentNamespace && node.kind === 83) {\n                return undefined;\n            }\n            return node;\n        }\n        function visitTypeScript(node) {\n            if (ts.hasModifier(node, 2) && ts.isStatement(node)) {\n                return ts.createNotEmittedStatement(node);\n            }\n            switch (node.kind) {\n                case 83:\n                case 78:\n                    return currentNamespace ? undefined : node;\n                case 113:\n                case 111:\n                case 112:\n                case 116:\n                case 75:\n                case 123:\n                case 130:\n                case 162:\n                case 163:\n                case 161:\n                case 156:\n                case 143:\n                case 118:\n                case 121:\n                case 134:\n                case 132:\n                case 129:\n                case 104:\n                case 135:\n                case 159:\n                case 158:\n                case 160:\n                case 157:\n                case 164:\n                case 165:\n                case 166:\n                case 167:\n                case 168:\n                case 169:\n                case 170:\n                case 171:\n                case 155:\n                case 145:\n                case 228:\n                case 147:\n                    return undefined;\n                case 150:\n                    return visitConstructor(node);\n                case 227:\n                    return ts.createNotEmittedStatement(node);\n                case 226:\n                    return visitClassDeclaration(node);\n                case 197:\n                    return visitClassExpression(node);\n                case 255:\n                    return visitHeritageClause(node);\n                case 199:\n                    return visitExpressionWithTypeArguments(node);\n                case 149:\n                    return visitMethodDeclaration(node);\n                case 151:\n                    return visitGetAccessor(node);\n                case 152:\n                    return visitSetAccessor(node);\n                case 225:\n                    return visitFunctionDeclaration(node);\n                case 184:\n                    return visitFunctionExpression(node);\n                case 185:\n                    return visitArrowFunction(node);\n                case 144:\n                    return visitParameter(node);\n                case 183:\n                    return visitParenthesizedExpression(node);\n                case 182:\n                case 200:\n                    return visitAssertionExpression(node);\n                case 179:\n                    return visitCallExpression(node);\n                case 180:\n                    return visitNewExpression(node);\n                case 201:\n                    return visitNonNullExpression(node);\n                case 229:\n                    return visitEnumDeclaration(node);\n                case 205:\n                    return visitVariableStatement(node);\n                case 223:\n                    return visitVariableDeclaration(node);\n                case 230:\n                    return visitModuleDeclaration(node);\n                case 234:\n                    return visitImportEqualsDeclaration(node);\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitSourceFile(node) {\n            var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015);\n            return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, 0, alwaysStrict));\n        }\n        function shouldEmitDecorateCallForClass(node) {\n            if (node.decorators && node.decorators.length > 0) {\n                return true;\n            }\n            var constructor = ts.getFirstConstructorWithBody(node);\n            if (constructor) {\n                return ts.forEach(constructor.parameters, shouldEmitDecorateCallForParameter);\n            }\n            return false;\n        }\n        function shouldEmitDecorateCallForParameter(parameter) {\n            return parameter.decorators !== undefined && parameter.decorators.length > 0;\n        }\n        function visitClassDeclaration(node) {\n            var staticProperties = getInitializedProperties(node, true);\n            var hasExtendsClause = ts.getClassExtendsHeritageClauseElement(node) !== undefined;\n            var isDecoratedClass = shouldEmitDecorateCallForClass(node);\n            var name = node.name;\n            if (!name && staticProperties.length > 0) {\n                name = ts.getGeneratedNameForNode(node);\n            }\n            var classStatement = isDecoratedClass\n                ? createClassDeclarationHeadWithDecorators(node, name, hasExtendsClause)\n                : createClassDeclarationHeadWithoutDecorators(node, name, hasExtendsClause, staticProperties.length > 0);\n            var statements = [classStatement];\n            if (staticProperties.length) {\n                addInitializedPropertyStatements(statements, staticProperties, ts.getLocalName(node));\n            }\n            addClassElementDecorationStatements(statements, node, false);\n            addClassElementDecorationStatements(statements, node, true);\n            addConstructorDecorationStatement(statements, node);\n            if (isNamespaceExport(node)) {\n                addExportMemberAssignment(statements, node);\n            }\n            else if (isDecoratedClass) {\n                if (isDefaultExternalModuleExport(node)) {\n                    statements.push(ts.createExportDefault(ts.getLocalName(node, false, true)));\n                }\n                else if (isNamedExternalModuleExport(node)) {\n                    statements.push(ts.createExternalModuleExport(ts.getLocalName(node, false, true)));\n                }\n            }\n            if (statements.length > 1) {\n                statements.push(ts.createEndOfDeclarationMarker(node));\n                ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 2097152);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function createClassDeclarationHeadWithoutDecorators(node, name, hasExtendsClause, hasStaticProperties) {\n            var classDeclaration = ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause), node);\n            var emitFlags = ts.getEmitFlags(node);\n            if (hasStaticProperties) {\n                emitFlags |= 32;\n            }\n            ts.setOriginalNode(classDeclaration, node);\n            ts.setEmitFlags(classDeclaration, emitFlags);\n            return classDeclaration;\n        }\n        function createClassDeclarationHeadWithDecorators(node, name, hasExtendsClause) {\n            var location = ts.moveRangePastDecorators(node);\n            var classAlias = getClassAliasIfNeeded(node);\n            var declName = ts.getLocalName(node, false, true);\n            var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);\n            var members = transformClassMembers(node, hasExtendsClause);\n            var classExpression = ts.createClassExpression(undefined, name, undefined, heritageClauses, members, location);\n            ts.setOriginalNode(classExpression, node);\n            var statement = ts.createLetStatement(declName, classAlias ? ts.createAssignment(classAlias, classExpression) : classExpression, location);\n            ts.setOriginalNode(statement, node);\n            ts.setCommentRange(statement, node);\n            return statement;\n        }\n        function visitClassExpression(node) {\n            var staticProperties = getInitializedProperties(node, true);\n            var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);\n            var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 84; }));\n            var classExpression = ts.setOriginalNode(ts.createClassExpression(undefined, node.name, undefined, heritageClauses, members, node), node);\n            if (staticProperties.length > 0) {\n                var expressions = [];\n                var temp = ts.createTempVariable(hoistVariableDeclaration);\n                if (resolver.getNodeCheckFlags(node) & 8388608) {\n                    enableSubstitutionForClassAliases();\n                    classAliases[ts.getOriginalNodeId(node)] = ts.getSynthesizedClone(temp);\n                }\n                ts.setEmitFlags(classExpression, 32768 | ts.getEmitFlags(classExpression));\n                expressions.push(ts.startOnNewLine(ts.createAssignment(temp, classExpression)));\n                ts.addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp));\n                expressions.push(ts.startOnNewLine(temp));\n                return ts.inlineExpressions(expressions);\n            }\n            return classExpression;\n        }\n        function transformClassMembers(node, hasExtendsClause) {\n            var members = [];\n            var constructor = transformConstructor(node, hasExtendsClause);\n            if (constructor) {\n                members.push(constructor);\n            }\n            ts.addRange(members, ts.visitNodes(node.members, classElementVisitor, ts.isClassElement));\n            return ts.createNodeArray(members, node.members);\n        }\n        function transformConstructor(node, hasExtendsClause) {\n            var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty);\n            var hasParameterPropertyAssignments = node.transformFlags & 262144;\n            var constructor = ts.getFirstConstructorWithBody(node);\n            if (!hasInstancePropertyWithInitializer && !hasParameterPropertyAssignments) {\n                return ts.visitEachChild(constructor, visitor, context);\n            }\n            var parameters = transformConstructorParameters(constructor);\n            var body = transformConstructorBody(node, constructor, hasExtendsClause);\n            return ts.startOnNewLine(ts.setOriginalNode(ts.createConstructor(undefined, undefined, parameters, body, constructor || node), constructor));\n        }\n        function transformConstructorParameters(constructor) {\n            return ts.visitParameterList(constructor && constructor.parameters, visitor, context)\n                || [];\n        }\n        function transformConstructorBody(node, constructor, hasExtendsClause) {\n            var statements = [];\n            var indexOfFirstStatement = 0;\n            resumeLexicalEnvironment();\n            if (constructor) {\n                indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements);\n                var propertyAssignments = getParametersWithPropertyAssignments(constructor);\n                ts.addRange(statements, ts.map(propertyAssignments, transformParameterWithPropertyAssignment));\n            }\n            else if (hasExtendsClause) {\n                statements.push(ts.createStatement(ts.createCall(ts.createSuper(), undefined, [ts.createSpread(ts.createIdentifier(\"arguments\"))])));\n            }\n            var properties = getInitializedProperties(node, false);\n            addInitializedPropertyStatements(statements, properties, ts.createThis());\n            if (constructor) {\n                ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement));\n            }\n            ts.addRange(statements, endLexicalEnvironment());\n            return ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : undefined, true);\n        }\n        function addPrologueDirectivesAndInitialSuperCall(ctor, result) {\n            if (ctor.body) {\n                var statements = ctor.body.statements;\n                var index = ts.addPrologueDirectives(result, statements, false, visitor);\n                if (index === statements.length) {\n                    return index;\n                }\n                var statement = statements[index];\n                if (statement.kind === 207 && ts.isSuperCall(statement.expression)) {\n                    result.push(ts.visitNode(statement, visitor, ts.isStatement));\n                    return index + 1;\n                }\n                return index;\n            }\n            return 0;\n        }\n        function getParametersWithPropertyAssignments(node) {\n            return ts.filter(node.parameters, isParameterWithPropertyAssignment);\n        }\n        function isParameterWithPropertyAssignment(parameter) {\n            return ts.hasModifier(parameter, 92)\n                && ts.isIdentifier(parameter.name);\n        }\n        function transformParameterWithPropertyAssignment(node) {\n            ts.Debug.assert(ts.isIdentifier(node.name));\n            var name = node.name;\n            var propertyName = ts.getMutableClone(name);\n            ts.setEmitFlags(propertyName, 1536 | 48);\n            var localName = ts.getMutableClone(name);\n            ts.setEmitFlags(localName, 1536);\n            return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName, node.name), localName), ts.moveRangePos(node, -1)));\n        }\n        function getInitializedProperties(node, isStatic) {\n            return ts.filter(node.members, isStatic ? isStaticInitializedProperty : isInstanceInitializedProperty);\n        }\n        function isStaticInitializedProperty(member) {\n            return isInitializedProperty(member, true);\n        }\n        function isInstanceInitializedProperty(member) {\n            return isInitializedProperty(member, false);\n        }\n        function isInitializedProperty(member, isStatic) {\n            return member.kind === 147\n                && isStatic === ts.hasModifier(member, 32)\n                && member.initializer !== undefined;\n        }\n        function addInitializedPropertyStatements(statements, properties, receiver) {\n            for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) {\n                var property = properties_8[_i];\n                var statement = ts.createStatement(transformInitializedProperty(property, receiver));\n                ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property));\n                ts.setCommentRange(statement, property);\n                statements.push(statement);\n            }\n        }\n        function generateInitializedPropertyExpressions(properties, receiver) {\n            var expressions = [];\n            for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) {\n                var property = properties_9[_i];\n                var expression = transformInitializedProperty(property, receiver);\n                expression.startsOnNewLine = true;\n                ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property));\n                ts.setCommentRange(expression, property);\n                expressions.push(expression);\n            }\n            return expressions;\n        }\n        function transformInitializedProperty(property, receiver) {\n            var propertyName = visitPropertyNameOfClassElement(property);\n            var initializer = ts.visitNode(property.initializer, visitor, ts.isExpression);\n            var memberAccess = ts.createMemberAccessForPropertyName(receiver, propertyName, propertyName);\n            return ts.createAssignment(memberAccess, initializer);\n        }\n        function getDecoratedClassElements(node, isStatic) {\n            return ts.filter(node.members, isStatic ? isStaticDecoratedClassElement : isInstanceDecoratedClassElement);\n        }\n        function isStaticDecoratedClassElement(member) {\n            return isDecoratedClassElement(member, true);\n        }\n        function isInstanceDecoratedClassElement(member) {\n            return isDecoratedClassElement(member, false);\n        }\n        function isDecoratedClassElement(member, isStatic) {\n            return ts.nodeOrChildIsDecorated(member)\n                && isStatic === ts.hasModifier(member, 32);\n        }\n        function getDecoratorsOfParameters(node) {\n            var decorators;\n            if (node) {\n                var parameters = node.parameters;\n                for (var i = 0; i < parameters.length; i++) {\n                    var parameter = parameters[i];\n                    if (decorators || parameter.decorators) {\n                        if (!decorators) {\n                            decorators = new Array(parameters.length);\n                        }\n                        decorators[i] = parameter.decorators;\n                    }\n                }\n            }\n            return decorators;\n        }\n        function getAllDecoratorsOfConstructor(node) {\n            var decorators = node.decorators;\n            var parameters = getDecoratorsOfParameters(ts.getFirstConstructorWithBody(node));\n            if (!decorators && !parameters) {\n                return undefined;\n            }\n            return {\n                decorators: decorators,\n                parameters: parameters\n            };\n        }\n        function getAllDecoratorsOfClassElement(node, member) {\n            switch (member.kind) {\n                case 151:\n                case 152:\n                    return getAllDecoratorsOfAccessors(node, member);\n                case 149:\n                    return getAllDecoratorsOfMethod(member);\n                case 147:\n                    return getAllDecoratorsOfProperty(member);\n                default:\n                    return undefined;\n            }\n        }\n        function getAllDecoratorsOfAccessors(node, accessor) {\n            if (!accessor.body) {\n                return undefined;\n            }\n            var _a = ts.getAllAccessorDeclarations(node.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, setAccessor = _a.setAccessor;\n            if (accessor !== firstAccessor) {\n                return undefined;\n            }\n            var decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators);\n            var parameters = getDecoratorsOfParameters(setAccessor);\n            if (!decorators && !parameters) {\n                return undefined;\n            }\n            return { decorators: decorators, parameters: parameters };\n        }\n        function getAllDecoratorsOfMethod(method) {\n            if (!method.body) {\n                return undefined;\n            }\n            var decorators = method.decorators;\n            var parameters = getDecoratorsOfParameters(method);\n            if (!decorators && !parameters) {\n                return undefined;\n            }\n            return { decorators: decorators, parameters: parameters };\n        }\n        function getAllDecoratorsOfProperty(property) {\n            var decorators = property.decorators;\n            if (!decorators) {\n                return undefined;\n            }\n            return { decorators: decorators };\n        }\n        function transformAllDecoratorsOfDeclaration(node, allDecorators) {\n            if (!allDecorators) {\n                return undefined;\n            }\n            var decoratorExpressions = [];\n            ts.addRange(decoratorExpressions, ts.map(allDecorators.decorators, transformDecorator));\n            ts.addRange(decoratorExpressions, ts.flatMap(allDecorators.parameters, transformDecoratorsOfParameter));\n            addTypeMetadata(node, decoratorExpressions);\n            return decoratorExpressions;\n        }\n        function addClassElementDecorationStatements(statements, node, isStatic) {\n            ts.addRange(statements, ts.map(generateClassElementDecorationExpressions(node, isStatic), expressionToStatement));\n        }\n        function generateClassElementDecorationExpressions(node, isStatic) {\n            var members = getDecoratedClassElements(node, isStatic);\n            var expressions;\n            for (var _i = 0, members_2 = members; _i < members_2.length; _i++) {\n                var member = members_2[_i];\n                var expression = generateClassElementDecorationExpression(node, member);\n                if (expression) {\n                    if (!expressions) {\n                        expressions = [expression];\n                    }\n                    else {\n                        expressions.push(expression);\n                    }\n                }\n            }\n            return expressions;\n        }\n        function generateClassElementDecorationExpression(node, member) {\n            var allDecorators = getAllDecoratorsOfClassElement(node, member);\n            var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators);\n            if (!decoratorExpressions) {\n                return undefined;\n            }\n            var prefix = getClassMemberPrefix(node, member);\n            var memberName = getExpressionForPropertyName(member, true);\n            var descriptor = languageVersion > 0\n                ? member.kind === 147\n                    ? ts.createVoidZero()\n                    : ts.createNull()\n                : undefined;\n            var helper = createDecorateHelper(context, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member));\n            ts.setEmitFlags(helper, 1536);\n            return helper;\n        }\n        function addConstructorDecorationStatement(statements, node) {\n            var expression = generateConstructorDecorationExpression(node);\n            if (expression) {\n                statements.push(ts.setOriginalNode(ts.createStatement(expression), node));\n            }\n        }\n        function generateConstructorDecorationExpression(node) {\n            var allDecorators = getAllDecoratorsOfConstructor(node);\n            var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators);\n            if (!decoratorExpressions) {\n                return undefined;\n            }\n            var classAlias = classAliases && classAliases[ts.getOriginalNodeId(node)];\n            var localName = ts.getLocalName(node, false, true);\n            var decorate = createDecorateHelper(context, decoratorExpressions, localName);\n            var expression = ts.createAssignment(localName, classAlias ? ts.createAssignment(classAlias, decorate) : decorate);\n            ts.setEmitFlags(expression, 1536);\n            ts.setSourceMapRange(expression, ts.moveRangePastDecorators(node));\n            return expression;\n        }\n        function transformDecorator(decorator) {\n            return ts.visitNode(decorator.expression, visitor, ts.isExpression);\n        }\n        function transformDecoratorsOfParameter(decorators, parameterOffset) {\n            var expressions;\n            if (decorators) {\n                expressions = [];\n                for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) {\n                    var decorator = decorators_1[_i];\n                    var helper = createParamHelper(context, transformDecorator(decorator), parameterOffset, decorator.expression);\n                    ts.setEmitFlags(helper, 1536);\n                    expressions.push(helper);\n                }\n            }\n            return expressions;\n        }\n        function addTypeMetadata(node, decoratorExpressions) {\n            if (USE_NEW_TYPE_METADATA_FORMAT) {\n                addNewTypeMetadata(node, decoratorExpressions);\n            }\n            else {\n                addOldTypeMetadata(node, decoratorExpressions);\n            }\n        }\n        function addOldTypeMetadata(node, decoratorExpressions) {\n            if (compilerOptions.emitDecoratorMetadata) {\n                if (shouldAddTypeMetadata(node)) {\n                    decoratorExpressions.push(createMetadataHelper(context, \"design:type\", serializeTypeOfNode(node)));\n                }\n                if (shouldAddParamTypesMetadata(node)) {\n                    decoratorExpressions.push(createMetadataHelper(context, \"design:paramtypes\", serializeParameterTypesOfNode(node)));\n                }\n                if (shouldAddReturnTypeMetadata(node)) {\n                    decoratorExpressions.push(createMetadataHelper(context, \"design:returntype\", serializeReturnTypeOfNode(node)));\n                }\n            }\n        }\n        function addNewTypeMetadata(node, decoratorExpressions) {\n            if (compilerOptions.emitDecoratorMetadata) {\n                var properties = void 0;\n                if (shouldAddTypeMetadata(node)) {\n                    (properties || (properties = [])).push(ts.createPropertyAssignment(\"type\", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeTypeOfNode(node))));\n                }\n                if (shouldAddParamTypesMetadata(node)) {\n                    (properties || (properties = [])).push(ts.createPropertyAssignment(\"paramTypes\", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeParameterTypesOfNode(node))));\n                }\n                if (shouldAddReturnTypeMetadata(node)) {\n                    (properties || (properties = [])).push(ts.createPropertyAssignment(\"returnType\", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeReturnTypeOfNode(node))));\n                }\n                if (properties) {\n                    decoratorExpressions.push(createMetadataHelper(context, \"design:typeinfo\", ts.createObjectLiteral(properties, undefined, true)));\n                }\n            }\n        }\n        function shouldAddTypeMetadata(node) {\n            var kind = node.kind;\n            return kind === 149\n                || kind === 151\n                || kind === 152\n                || kind === 147;\n        }\n        function shouldAddReturnTypeMetadata(node) {\n            return node.kind === 149;\n        }\n        function shouldAddParamTypesMetadata(node) {\n            var kind = node.kind;\n            return kind === 226\n                || kind === 197\n                || kind === 149\n                || kind === 151\n                || kind === 152;\n        }\n        function serializeTypeOfNode(node) {\n            switch (node.kind) {\n                case 147:\n                case 144:\n                case 151:\n                    return serializeTypeNode(node.type);\n                case 152:\n                    return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node));\n                case 226:\n                case 197:\n                case 149:\n                    return ts.createIdentifier(\"Function\");\n                default:\n                    return ts.createVoidZero();\n            }\n        }\n        function getRestParameterElementType(node) {\n            if (node && node.kind === 162) {\n                return node.elementType;\n            }\n            else if (node && node.kind === 157) {\n                return ts.singleOrUndefined(node.typeArguments);\n            }\n            else {\n                return undefined;\n            }\n        }\n        function serializeParameterTypesOfNode(node) {\n            var valueDeclaration = ts.isClassLike(node)\n                ? ts.getFirstConstructorWithBody(node)\n                : ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)\n                    ? node\n                    : undefined;\n            var expressions = [];\n            if (valueDeclaration) {\n                var parameters = valueDeclaration.parameters;\n                var numParameters = parameters.length;\n                for (var i = 0; i < numParameters; i++) {\n                    var parameter = parameters[i];\n                    if (i === 0 && ts.isIdentifier(parameter.name) && parameter.name.text === \"this\") {\n                        continue;\n                    }\n                    if (parameter.dotDotDotToken) {\n                        expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type)));\n                    }\n                    else {\n                        expressions.push(serializeTypeOfNode(parameter));\n                    }\n                }\n            }\n            return ts.createArrayLiteral(expressions);\n        }\n        function serializeReturnTypeOfNode(node) {\n            if (ts.isFunctionLike(node) && node.type) {\n                return serializeTypeNode(node.type);\n            }\n            else if (ts.isAsyncFunctionLike(node)) {\n                return ts.createIdentifier(\"Promise\");\n            }\n            return ts.createVoidZero();\n        }\n        function serializeTypeNode(node) {\n            if (node === undefined) {\n                return ts.createIdentifier(\"Object\");\n            }\n            switch (node.kind) {\n                case 104:\n                    return ts.createVoidZero();\n                case 166:\n                    return serializeTypeNode(node.type);\n                case 158:\n                case 159:\n                    return ts.createIdentifier(\"Function\");\n                case 162:\n                case 163:\n                    return ts.createIdentifier(\"Array\");\n                case 156:\n                case 121:\n                    return ts.createIdentifier(\"Boolean\");\n                case 134:\n                    return ts.createIdentifier(\"String\");\n                case 171:\n                    switch (node.literal.kind) {\n                        case 9:\n                            return ts.createIdentifier(\"String\");\n                        case 8:\n                            return ts.createIdentifier(\"Number\");\n                        case 100:\n                        case 85:\n                            return ts.createIdentifier(\"Boolean\");\n                        default:\n                            ts.Debug.failBadSyntaxKind(node.literal);\n                            break;\n                    }\n                    break;\n                case 132:\n                    return ts.createIdentifier(\"Number\");\n                case 135:\n                    return languageVersion < 2\n                        ? getGlobalSymbolNameWithFallback()\n                        : ts.createIdentifier(\"Symbol\");\n                case 157:\n                    return serializeTypeReferenceNode(node);\n                case 165:\n                case 164:\n                    {\n                        var unionOrIntersection = node;\n                        var serializedUnion = void 0;\n                        for (var _i = 0, _a = unionOrIntersection.types; _i < _a.length; _i++) {\n                            var typeNode = _a[_i];\n                            var serializedIndividual = serializeTypeNode(typeNode);\n                            if (serializedIndividual.kind !== 70) {\n                                serializedUnion = undefined;\n                                break;\n                            }\n                            if (serializedIndividual.text === \"Object\") {\n                                return serializedIndividual;\n                            }\n                            if (serializedUnion && serializedUnion.text !== serializedIndividual.text) {\n                                serializedUnion = undefined;\n                                break;\n                            }\n                            serializedUnion = serializedIndividual;\n                        }\n                        if (serializedUnion) {\n                            return serializedUnion;\n                        }\n                    }\n                case 160:\n                case 168:\n                case 169:\n                case 170:\n                case 161:\n                case 118:\n                case 167:\n                    break;\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    break;\n            }\n            return ts.createIdentifier(\"Object\");\n        }\n        function serializeTypeReferenceNode(node) {\n            switch (resolver.getTypeReferenceSerializationKind(node.typeName, currentScope)) {\n                case ts.TypeReferenceSerializationKind.Unknown:\n                    var serialized = serializeEntityNameAsExpression(node.typeName, true);\n                    var temp = ts.createTempVariable(hoistVariableDeclaration);\n                    return ts.createLogicalOr(ts.createLogicalAnd(ts.createTypeCheck(ts.createAssignment(temp, serialized), \"function\"), temp), ts.createIdentifier(\"Object\"));\n                case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue:\n                    return serializeEntityNameAsExpression(node.typeName, false);\n                case ts.TypeReferenceSerializationKind.VoidNullableOrNeverType:\n                    return ts.createVoidZero();\n                case ts.TypeReferenceSerializationKind.BooleanType:\n                    return ts.createIdentifier(\"Boolean\");\n                case ts.TypeReferenceSerializationKind.NumberLikeType:\n                    return ts.createIdentifier(\"Number\");\n                case ts.TypeReferenceSerializationKind.StringLikeType:\n                    return ts.createIdentifier(\"String\");\n                case ts.TypeReferenceSerializationKind.ArrayLikeType:\n                    return ts.createIdentifier(\"Array\");\n                case ts.TypeReferenceSerializationKind.ESSymbolType:\n                    return languageVersion < 2\n                        ? getGlobalSymbolNameWithFallback()\n                        : ts.createIdentifier(\"Symbol\");\n                case ts.TypeReferenceSerializationKind.TypeWithCallSignature:\n                    return ts.createIdentifier(\"Function\");\n                case ts.TypeReferenceSerializationKind.Promise:\n                    return ts.createIdentifier(\"Promise\");\n                case ts.TypeReferenceSerializationKind.ObjectType:\n                default:\n                    return ts.createIdentifier(\"Object\");\n            }\n        }\n        function serializeEntityNameAsExpression(node, useFallback) {\n            switch (node.kind) {\n                case 70:\n                    var name_32 = ts.getMutableClone(node);\n                    name_32.flags &= ~8;\n                    name_32.original = undefined;\n                    name_32.parent = currentScope;\n                    if (useFallback) {\n                        return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_32), ts.createLiteral(\"undefined\")), name_32);\n                    }\n                    return name_32;\n                case 141:\n                    return serializeQualifiedNameAsExpression(node, useFallback);\n            }\n        }\n        function serializeQualifiedNameAsExpression(node, useFallback) {\n            var left;\n            if (node.left.kind === 70) {\n                left = serializeEntityNameAsExpression(node.left, useFallback);\n            }\n            else if (useFallback) {\n                var temp = ts.createTempVariable(hoistVariableDeclaration);\n                left = ts.createLogicalAnd(ts.createAssignment(temp, serializeEntityNameAsExpression(node.left, true)), temp);\n            }\n            else {\n                left = serializeEntityNameAsExpression(node.left, false);\n            }\n            return ts.createPropertyAccess(left, node.right);\n        }\n        function getGlobalSymbolNameWithFallback() {\n            return ts.createConditional(ts.createTypeCheck(ts.createIdentifier(\"Symbol\"), \"function\"), ts.createIdentifier(\"Symbol\"), ts.createIdentifier(\"Object\"));\n        }\n        function getExpressionForPropertyName(member, generateNameForComputedPropertyName) {\n            var name = member.name;\n            if (ts.isComputedPropertyName(name)) {\n                return generateNameForComputedPropertyName\n                    ? ts.getGeneratedNameForNode(name)\n                    : name.expression;\n            }\n            else if (ts.isIdentifier(name)) {\n                return ts.createLiteral(ts.unescapeIdentifier(name.text));\n            }\n            else {\n                return ts.getSynthesizedClone(name);\n            }\n        }\n        function visitPropertyNameOfClassElement(member) {\n            var name = member.name;\n            if (ts.isComputedPropertyName(name)) {\n                var expression = ts.visitNode(name.expression, visitor, ts.isExpression);\n                if (member.decorators) {\n                    var generatedName = ts.getGeneratedNameForNode(name);\n                    hoistVariableDeclaration(generatedName);\n                    expression = ts.createAssignment(generatedName, expression);\n                }\n                return ts.setOriginalNode(ts.createComputedPropertyName(expression, name), name);\n            }\n            else {\n                return name;\n            }\n        }\n        function visitHeritageClause(node) {\n            if (node.token === 84) {\n                var types = ts.visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments, 0, 1);\n                return ts.createHeritageClause(84, types, node);\n            }\n            return undefined;\n        }\n        function visitExpressionWithTypeArguments(node) {\n            var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression);\n            return ts.createExpressionWithTypeArguments(undefined, expression, node);\n        }\n        function shouldEmitFunctionLikeDeclaration(node) {\n            return !ts.nodeIsMissing(node.body);\n        }\n        function visitConstructor(node) {\n            if (!shouldEmitFunctionLikeDeclaration(node)) {\n                return undefined;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitMethodDeclaration(node) {\n            if (!shouldEmitFunctionLikeDeclaration(node)) {\n                return undefined;\n            }\n            var updated = ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context));\n            if (updated !== node) {\n                ts.setCommentRange(updated, node);\n                ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));\n            }\n            return updated;\n        }\n        function shouldEmitAccessorDeclaration(node) {\n            return !(ts.nodeIsMissing(node.body) && ts.hasModifier(node, 128));\n        }\n        function visitGetAccessor(node) {\n            if (!shouldEmitAccessorDeclaration(node)) {\n                return undefined;\n            }\n            var updated = ts.updateGetAccessor(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));\n            if (updated !== node) {\n                ts.setCommentRange(updated, node);\n                ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));\n            }\n            return updated;\n        }\n        function visitSetAccessor(node) {\n            if (!shouldEmitAccessorDeclaration(node)) {\n                return undefined;\n            }\n            var updated = ts.updateSetAccessor(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));\n            if (updated !== node) {\n                ts.setCommentRange(updated, node);\n                ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));\n            }\n            return updated;\n        }\n        function visitFunctionDeclaration(node) {\n            if (!shouldEmitFunctionLikeDeclaration(node)) {\n                return ts.createNotEmittedStatement(node);\n            }\n            var updated = ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));\n            if (isNamespaceExport(node)) {\n                var statements = [updated];\n                addExportMemberAssignment(statements, node);\n                return statements;\n            }\n            return updated;\n        }\n        function visitFunctionExpression(node) {\n            if (ts.nodeIsMissing(node.body)) {\n                return ts.createOmittedExpression();\n            }\n            var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context));\n            return updated;\n        }\n        function visitArrowFunction(node) {\n            var updated = ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context));\n            return updated;\n        }\n        function visitParameter(node) {\n            if (ts.parameterIsThisKeyword(node)) {\n                return undefined;\n            }\n            var parameter = ts.createParameter(undefined, undefined, node.dotDotDotToken, ts.visitNode(node.name, visitor, ts.isBindingName), undefined, undefined, ts.visitNode(node.initializer, visitor, ts.isExpression), ts.moveRangePastModifiers(node));\n            ts.setOriginalNode(parameter, node);\n            ts.setCommentRange(parameter, node);\n            ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node));\n            ts.setEmitFlags(parameter.name, 32);\n            return parameter;\n        }\n        function visitVariableStatement(node) {\n            if (isNamespaceExport(node)) {\n                var variables = ts.getInitializedVariables(node.declarationList);\n                if (variables.length === 0) {\n                    return undefined;\n                }\n                return ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable)), node);\n            }\n            else {\n                return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function transformInitializedVariable(node) {\n            var name = node.name;\n            if (ts.isBindingPattern(name)) {\n                return ts.flattenDestructuringAssignment(node, visitor, context, 0, false, createNamespaceExportExpression);\n            }\n            else {\n                return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), node);\n            }\n        }\n        function visitVariableDeclaration(node) {\n            return ts.updateVariableDeclaration(node, ts.visitNode(node.name, visitor, ts.isBindingName), undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));\n        }\n        function visitParenthesizedExpression(node) {\n            var innerExpression = ts.skipOuterExpressions(node.expression, ~2);\n            if (ts.isAssertionExpression(innerExpression)) {\n                var expression = ts.visitNode(node.expression, visitor, ts.isExpression);\n                return ts.createPartiallyEmittedExpression(expression, node);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitAssertionExpression(node) {\n            var expression = ts.visitNode(node.expression, visitor, ts.isExpression);\n            return ts.createPartiallyEmittedExpression(expression, node);\n        }\n        function visitNonNullExpression(node) {\n            var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression);\n            return ts.createPartiallyEmittedExpression(expression, node);\n        }\n        function visitCallExpression(node) {\n            return ts.updateCall(node, ts.visitNode(node.expression, visitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression));\n        }\n        function visitNewExpression(node) {\n            return ts.updateNew(node, ts.visitNode(node.expression, visitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression));\n        }\n        function shouldEmitEnumDeclaration(node) {\n            return !ts.isConst(node)\n                || compilerOptions.preserveConstEnums\n                || compilerOptions.isolatedModules;\n        }\n        function visitEnumDeclaration(node) {\n            if (!shouldEmitEnumDeclaration(node)) {\n                return undefined;\n            }\n            var statements = [];\n            var emitFlags = 2;\n            if (addVarForEnumOrModuleDeclaration(statements, node)) {\n                if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {\n                    emitFlags |= 512;\n                }\n            }\n            var parameterName = getNamespaceParameterName(node);\n            var containerName = getNamespaceContainerName(node);\n            var exportName = ts.hasModifier(node, 1)\n                ? ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, false, true)\n                : ts.getLocalName(node, false, true);\n            var moduleArg = ts.createLogicalOr(exportName, ts.createAssignment(exportName, ts.createObjectLiteral()));\n            if (hasNamespaceQualifiedExportName(node)) {\n                var localName = ts.getLocalName(node, false, true);\n                moduleArg = ts.createAssignment(localName, moduleArg);\n            }\n            var enumStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, transformEnumBody(node, containerName)), undefined, [moduleArg]), node);\n            ts.setOriginalNode(enumStatement, node);\n            ts.setEmitFlags(enumStatement, emitFlags);\n            statements.push(enumStatement);\n            statements.push(ts.createEndOfDeclarationMarker(node));\n            return statements;\n        }\n        function transformEnumBody(node, localName) {\n            var savedCurrentNamespaceLocalName = currentNamespaceContainerName;\n            currentNamespaceContainerName = localName;\n            var statements = [];\n            startLexicalEnvironment();\n            ts.addRange(statements, ts.map(node.members, transformEnumMember));\n            ts.addRange(statements, endLexicalEnvironment());\n            currentNamespaceContainerName = savedCurrentNamespaceLocalName;\n            return ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true);\n        }\n        function transformEnumMember(member) {\n            var name = getExpressionForPropertyName(member, false);\n            return ts.createStatement(ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, name), transformEnumMemberDeclarationValue(member))), name, member), member);\n        }\n        function transformEnumMemberDeclarationValue(member) {\n            var value = resolver.getConstantValue(member);\n            if (value !== undefined) {\n                return ts.createLiteral(value);\n            }\n            else {\n                enableSubstitutionForNonQualifiedEnumMembers();\n                if (member.initializer) {\n                    return ts.visitNode(member.initializer, visitor, ts.isExpression);\n                }\n                else {\n                    return ts.createVoidZero();\n                }\n            }\n        }\n        function shouldEmitModuleDeclaration(node) {\n            return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules);\n        }\n        function hasNamespaceQualifiedExportName(node) {\n            return isNamespaceExport(node)\n                || (isExternalModuleExport(node)\n                    && moduleKind !== ts.ModuleKind.ES2015\n                    && moduleKind !== ts.ModuleKind.System);\n        }\n        function recordEmittedDeclarationInScope(node) {\n            var name = node.symbol && node.symbol.name;\n            if (name) {\n                if (!currentScopeFirstDeclarationsOfName) {\n                    currentScopeFirstDeclarationsOfName = ts.createMap();\n                }\n                if (!(name in currentScopeFirstDeclarationsOfName)) {\n                    currentScopeFirstDeclarationsOfName[name] = node;\n                }\n            }\n        }\n        function isFirstEmittedDeclarationInScope(node) {\n            if (currentScopeFirstDeclarationsOfName) {\n                var name_33 = node.symbol && node.symbol.name;\n                if (name_33) {\n                    return currentScopeFirstDeclarationsOfName[name_33] === node;\n                }\n            }\n            return false;\n        }\n        function addVarForEnumOrModuleDeclaration(statements, node) {\n            var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), [\n                ts.createVariableDeclaration(ts.getLocalName(node, false, true))\n            ]);\n            ts.setOriginalNode(statement, node);\n            recordEmittedDeclarationInScope(node);\n            if (isFirstEmittedDeclarationInScope(node)) {\n                if (node.kind === 229) {\n                    ts.setSourceMapRange(statement.declarationList, node);\n                }\n                else {\n                    ts.setSourceMapRange(statement, node);\n                }\n                ts.setCommentRange(statement, node);\n                ts.setEmitFlags(statement, 1024 | 2097152);\n                statements.push(statement);\n                return true;\n            }\n            else {\n                var mergeMarker = ts.createMergeDeclarationMarker(statement);\n                ts.setEmitFlags(mergeMarker, 1536 | 2097152);\n                statements.push(mergeMarker);\n                return false;\n            }\n        }\n        function visitModuleDeclaration(node) {\n            if (!shouldEmitModuleDeclaration(node)) {\n                return ts.createNotEmittedStatement(node);\n            }\n            ts.Debug.assert(ts.isIdentifier(node.name), \"TypeScript module should have an Identifier name.\");\n            enableSubstitutionForNamespaceExports();\n            var statements = [];\n            var emitFlags = 2;\n            if (addVarForEnumOrModuleDeclaration(statements, node)) {\n                if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {\n                    emitFlags |= 512;\n                }\n            }\n            var parameterName = getNamespaceParameterName(node);\n            var containerName = getNamespaceContainerName(node);\n            var exportName = ts.hasModifier(node, 1)\n                ? ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, false, true)\n                : ts.getLocalName(node, false, true);\n            var moduleArg = ts.createLogicalOr(exportName, ts.createAssignment(exportName, ts.createObjectLiteral()));\n            if (hasNamespaceQualifiedExportName(node)) {\n                var localName = ts.getLocalName(node, false, true);\n                moduleArg = ts.createAssignment(localName, moduleArg);\n            }\n            var moduleStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, transformModuleBody(node, containerName)), undefined, [moduleArg]), node);\n            ts.setOriginalNode(moduleStatement, node);\n            ts.setEmitFlags(moduleStatement, emitFlags);\n            statements.push(moduleStatement);\n            statements.push(ts.createEndOfDeclarationMarker(node));\n            return statements;\n        }\n        function transformModuleBody(node, namespaceLocalName) {\n            var savedCurrentNamespaceContainerName = currentNamespaceContainerName;\n            var savedCurrentNamespace = currentNamespace;\n            var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;\n            currentNamespaceContainerName = namespaceLocalName;\n            currentNamespace = node;\n            currentScopeFirstDeclarationsOfName = undefined;\n            var statements = [];\n            startLexicalEnvironment();\n            var statementsLocation;\n            var blockLocation;\n            var body = node.body;\n            if (body.kind === 231) {\n                ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement));\n                statementsLocation = body.statements;\n                blockLocation = body;\n            }\n            else {\n                var result = visitModuleDeclaration(body);\n                if (result) {\n                    if (ts.isArray(result)) {\n                        ts.addRange(statements, result);\n                    }\n                    else {\n                        statements.push(result);\n                    }\n                }\n                var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body;\n                statementsLocation = ts.moveRangePos(moduleBlock.statements, -1);\n            }\n            ts.addRange(statements, endLexicalEnvironment());\n            currentNamespaceContainerName = savedCurrentNamespaceContainerName;\n            currentNamespace = savedCurrentNamespace;\n            currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;\n            var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true);\n            if (body.kind !== 231) {\n                ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536);\n            }\n            return block;\n        }\n        function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) {\n            if (moduleDeclaration.body.kind === 230) {\n                var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body);\n                return recursiveInnerModule || moduleDeclaration.body;\n            }\n        }\n        function visitImportDeclaration(node) {\n            if (!node.importClause) {\n                return node;\n            }\n            var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause, true);\n            return importClause\n                ? ts.updateImportDeclaration(node, undefined, undefined, importClause, node.moduleSpecifier)\n                : undefined;\n        }\n        function visitImportClause(node) {\n            var name = resolver.isReferencedAliasDeclaration(node) ? node.name : undefined;\n            var namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings, true);\n            return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined;\n        }\n        function visitNamedImportBindings(node) {\n            if (node.kind === 237) {\n                return resolver.isReferencedAliasDeclaration(node) ? node : undefined;\n            }\n            else {\n                var elements = ts.visitNodes(node.elements, visitImportSpecifier, ts.isImportSpecifier);\n                return ts.some(elements) ? ts.updateNamedImports(node, elements) : undefined;\n            }\n        }\n        function visitImportSpecifier(node) {\n            return resolver.isReferencedAliasDeclaration(node) ? node : undefined;\n        }\n        function visitExportAssignment(node) {\n            return resolver.isValueAliasDeclaration(node)\n                ? ts.visitEachChild(node, visitor, context)\n                : undefined;\n        }\n        function visitExportDeclaration(node) {\n            if (!node.exportClause) {\n                return resolver.moduleExportsSomeValue(node.moduleSpecifier) ? node : undefined;\n            }\n            if (!resolver.isValueAliasDeclaration(node)) {\n                return undefined;\n            }\n            var exportClause = ts.visitNode(node.exportClause, visitNamedExports, ts.isNamedExports, true);\n            return exportClause\n                ? ts.updateExportDeclaration(node, undefined, undefined, exportClause, node.moduleSpecifier)\n                : undefined;\n        }\n        function visitNamedExports(node) {\n            var elements = ts.visitNodes(node.elements, visitExportSpecifier, ts.isExportSpecifier);\n            return ts.some(elements) ? ts.updateNamedExports(node, elements) : undefined;\n        }\n        function visitExportSpecifier(node) {\n            return resolver.isValueAliasDeclaration(node) ? node : undefined;\n        }\n        function shouldEmitImportEqualsDeclaration(node) {\n            return resolver.isReferencedAliasDeclaration(node)\n                || (!ts.isExternalModule(currentSourceFile)\n                    && resolver.isTopLevelValueImportEqualsWithEntityName(node));\n        }\n        function visitImportEqualsDeclaration(node) {\n            if (ts.isExternalModuleImportEqualsDeclaration(node)) {\n                return resolver.isReferencedAliasDeclaration(node)\n                    ? ts.visitEachChild(node, visitor, context)\n                    : undefined;\n            }\n            if (!shouldEmitImportEqualsDeclaration(node)) {\n                return undefined;\n            }\n            var moduleReference = ts.createExpressionFromEntityName(node.moduleReference);\n            ts.setEmitFlags(moduleReference, 1536 | 2048);\n            if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) {\n                return ts.setOriginalNode(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([\n                    ts.setOriginalNode(ts.createVariableDeclaration(node.name, undefined, moduleReference), node)\n                ]), node), node);\n            }\n            else {\n                return ts.setOriginalNode(createNamespaceExport(node.name, moduleReference, node), node);\n            }\n        }\n        function isNamespaceExport(node) {\n            return currentNamespace !== undefined && ts.hasModifier(node, 1);\n        }\n        function isExternalModuleExport(node) {\n            return currentNamespace === undefined && ts.hasModifier(node, 1);\n        }\n        function isNamedExternalModuleExport(node) {\n            return isExternalModuleExport(node)\n                && !ts.hasModifier(node, 512);\n        }\n        function isDefaultExternalModuleExport(node) {\n            return isExternalModuleExport(node)\n                && ts.hasModifier(node, 512);\n        }\n        function expressionToStatement(expression) {\n            return ts.createStatement(expression, undefined);\n        }\n        function addExportMemberAssignment(statements, node) {\n            var expression = ts.createAssignment(ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, false, true), ts.getLocalName(node));\n            ts.setSourceMapRange(expression, ts.createRange(node.name.pos, node.end));\n            var statement = ts.createStatement(expression);\n            ts.setSourceMapRange(statement, ts.createRange(-1, node.end));\n            statements.push(statement);\n        }\n        function createNamespaceExport(exportName, exportValue, location) {\n            return ts.createStatement(ts.createAssignment(ts.getNamespaceMemberName(currentNamespaceContainerName, exportName, false, true), exportValue), location);\n        }\n        function createNamespaceExportExpression(exportName, exportValue, location) {\n            return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue, location);\n        }\n        function getNamespaceMemberNameWithSourceMapsAndWithoutComments(name) {\n            return ts.getNamespaceMemberName(currentNamespaceContainerName, name, false, true);\n        }\n        function getNamespaceParameterName(node) {\n            var name = ts.getGeneratedNameForNode(node);\n            ts.setSourceMapRange(name, node.name);\n            return name;\n        }\n        function getNamespaceContainerName(node) {\n            return ts.getGeneratedNameForNode(node);\n        }\n        function getClassAliasIfNeeded(node) {\n            if (resolver.getNodeCheckFlags(node) & 8388608) {\n                enableSubstitutionForClassAliases();\n                var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? node.name.text : \"default\");\n                classAliases[ts.getOriginalNodeId(node)] = classAlias;\n                hoistVariableDeclaration(classAlias);\n                return classAlias;\n            }\n        }\n        function getClassPrototype(node) {\n            return ts.createPropertyAccess(ts.getDeclarationName(node), \"prototype\");\n        }\n        function getClassMemberPrefix(node, member) {\n            return ts.hasModifier(member, 32)\n                ? ts.getDeclarationName(node)\n                : getClassPrototype(node);\n        }\n        function enableSubstitutionForNonQualifiedEnumMembers() {\n            if ((enabledSubstitutions & 8) === 0) {\n                enabledSubstitutions |= 8;\n                context.enableSubstitution(70);\n            }\n        }\n        function enableSubstitutionForClassAliases() {\n            if ((enabledSubstitutions & 1) === 0) {\n                enabledSubstitutions |= 1;\n                context.enableSubstitution(70);\n                classAliases = ts.createMap();\n            }\n        }\n        function enableSubstitutionForNamespaceExports() {\n            if ((enabledSubstitutions & 2) === 0) {\n                enabledSubstitutions |= 2;\n                context.enableSubstitution(70);\n                context.enableSubstitution(258);\n                context.enableEmitNotification(230);\n            }\n        }\n        function isTransformedModuleDeclaration(node) {\n            return ts.getOriginalNode(node).kind === 230;\n        }\n        function isTransformedEnumDeclaration(node) {\n            return ts.getOriginalNode(node).kind === 229;\n        }\n        function onEmitNode(emitContext, node, emitCallback) {\n            var savedApplicableSubstitutions = applicableSubstitutions;\n            if (enabledSubstitutions & 2 && isTransformedModuleDeclaration(node)) {\n                applicableSubstitutions |= 2;\n            }\n            if (enabledSubstitutions & 8 && isTransformedEnumDeclaration(node)) {\n                applicableSubstitutions |= 8;\n            }\n            previousOnEmitNode(emitContext, node, emitCallback);\n            applicableSubstitutions = savedApplicableSubstitutions;\n        }\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (emitContext === 1) {\n                return substituteExpression(node);\n            }\n            else if (ts.isShorthandPropertyAssignment(node)) {\n                return substituteShorthandPropertyAssignment(node);\n            }\n            return node;\n        }\n        function substituteShorthandPropertyAssignment(node) {\n            if (enabledSubstitutions & 2) {\n                var name_34 = node.name;\n                var exportedName = trySubstituteNamespaceExportedName(name_34);\n                if (exportedName) {\n                    if (node.objectAssignmentInitializer) {\n                        var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer);\n                        return ts.createPropertyAssignment(name_34, initializer, node);\n                    }\n                    return ts.createPropertyAssignment(name_34, exportedName, node);\n                }\n            }\n            return node;\n        }\n        function substituteExpression(node) {\n            switch (node.kind) {\n                case 70:\n                    return substituteExpressionIdentifier(node);\n                case 177:\n                    return substitutePropertyAccessExpression(node);\n                case 178:\n                    return substituteElementAccessExpression(node);\n            }\n            return node;\n        }\n        function substituteExpressionIdentifier(node) {\n            return trySubstituteClassAlias(node)\n                || trySubstituteNamespaceExportedName(node)\n                || node;\n        }\n        function trySubstituteClassAlias(node) {\n            if (enabledSubstitutions & 1) {\n                if (resolver.getNodeCheckFlags(node) & 16777216) {\n                    var declaration = resolver.getReferencedValueDeclaration(node);\n                    if (declaration) {\n                        var classAlias = classAliases[declaration.id];\n                        if (classAlias) {\n                            var clone_2 = ts.getSynthesizedClone(classAlias);\n                            ts.setSourceMapRange(clone_2, node);\n                            ts.setCommentRange(clone_2, node);\n                            return clone_2;\n                        }\n                    }\n                }\n            }\n            return undefined;\n        }\n        function trySubstituteNamespaceExportedName(node) {\n            if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {\n                var container = resolver.getReferencedExportContainer(node, false);\n                if (container && container.kind !== 261) {\n                    var substitute = (applicableSubstitutions & 2 && container.kind === 230) ||\n                        (applicableSubstitutions & 8 && container.kind === 229);\n                    if (substitute) {\n                        return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, node);\n                    }\n                }\n            }\n            return undefined;\n        }\n        function substitutePropertyAccessExpression(node) {\n            return substituteConstantValue(node);\n        }\n        function substituteElementAccessExpression(node) {\n            return substituteConstantValue(node);\n        }\n        function substituteConstantValue(node) {\n            var constantValue = tryGetConstEnumValue(node);\n            if (constantValue !== undefined) {\n                var substitute = ts.createLiteral(constantValue);\n                ts.setSourceMapRange(substitute, node);\n                ts.setCommentRange(substitute, node);\n                if (!compilerOptions.removeComments) {\n                    var propertyName = ts.isPropertyAccessExpression(node)\n                        ? ts.declarationNameToString(node.name)\n                        : ts.getTextOfNode(node.argumentExpression);\n                    substitute.trailingComment = \" \" + propertyName + \" \";\n                }\n                ts.setConstantValue(node, constantValue);\n                return substitute;\n            }\n            return node;\n        }\n        function tryGetConstEnumValue(node) {\n            if (compilerOptions.isolatedModules) {\n                return undefined;\n            }\n            return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)\n                ? resolver.getConstantValue(node)\n                : undefined;\n        }\n    }\n    ts.transformTypeScript = transformTypeScript;\n    var paramHelper = {\n        name: \"typescript:param\",\n        scoped: false,\n        priority: 4,\n        text: \"\\n            var __param = (this && this.__param) || function (paramIndex, decorator) {\\n                return function (target, key) { decorator(target, key, paramIndex); }\\n            };\"\n    };\n    function createParamHelper(context, expression, parameterOffset, location) {\n        context.requestEmitHelper(paramHelper);\n        return ts.createCall(ts.getHelperName(\"__param\"), undefined, [\n            ts.createLiteral(parameterOffset),\n            expression\n        ], location);\n    }\n    var metadataHelper = {\n        name: \"typescript:metadata\",\n        scoped: false,\n        priority: 3,\n        text: \"\\n            var __metadata = (this && this.__metadata) || function (k, v) {\\n                if (typeof Reflect === \\\"object\\\" && typeof Reflect.metadata === \\\"function\\\") return Reflect.metadata(k, v);\\n            };\"\n    };\n    function createMetadataHelper(context, metadataKey, metadataValue) {\n        context.requestEmitHelper(metadataHelper);\n        return ts.createCall(ts.getHelperName(\"__metadata\"), undefined, [\n            ts.createLiteral(metadataKey),\n            metadataValue\n        ]);\n    }\n    var decorateHelper = {\n        name: \"typescript:decorate\",\n        scoped: false,\n        priority: 2,\n        text: \"\\n            var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\\n                var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\\n                if (typeof Reflect === \\\"object\\\" && typeof Reflect.decorate === \\\"function\\\") r = Reflect.decorate(decorators, target, key, desc);\\n                else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\\n                return c > 3 && r && Object.defineProperty(target, key, r), r;\\n            };\"\n    };\n    function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) {\n        context.requestEmitHelper(decorateHelper);\n        var argumentsArray = [];\n        argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, undefined, true));\n        argumentsArray.push(target);\n        if (memberName) {\n            argumentsArray.push(memberName);\n            if (descriptor) {\n                argumentsArray.push(descriptor);\n            }\n        }\n        return ts.createCall(ts.getHelperName(\"__decorate\"), undefined, argumentsArray, location);\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformESNext(context) {\n        var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            var visited = ts.visitEachChild(node, visitor, context);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            return visited;\n        }\n        function visitor(node) {\n            return visitorWorker(node, false);\n        }\n        function visitorNoDestructuringValue(node) {\n            return visitorWorker(node, true);\n        }\n        function visitorWorker(node, noDestructuringValue) {\n            if ((node.transformFlags & 8) === 0) {\n                return node;\n            }\n            switch (node.kind) {\n                case 176:\n                    return visitObjectLiteralExpression(node);\n                case 192:\n                    return visitBinaryExpression(node, noDestructuringValue);\n                case 223:\n                    return visitVariableDeclaration(node);\n                case 213:\n                    return visitForOfStatement(node);\n                case 211:\n                    return visitForStatement(node);\n                case 188:\n                    return visitVoidExpression(node);\n                case 150:\n                    return visitConstructorDeclaration(node);\n                case 149:\n                    return visitMethodDeclaration(node);\n                case 151:\n                    return visitGetAccessorDeclaration(node);\n                case 152:\n                    return visitSetAccessorDeclaration(node);\n                case 225:\n                    return visitFunctionDeclaration(node);\n                case 184:\n                    return visitFunctionExpression(node);\n                case 185:\n                    return visitArrowFunction(node);\n                case 144:\n                    return visitParameter(node);\n                case 207:\n                    return visitExpressionStatement(node);\n                case 183:\n                    return visitParenthesizedExpression(node, noDestructuringValue);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function chunkObjectLiteralElements(elements) {\n            var chunkObject;\n            var objects = [];\n            for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {\n                var e = elements_3[_i];\n                if (e.kind === 259) {\n                    if (chunkObject) {\n                        objects.push(ts.createObjectLiteral(chunkObject));\n                        chunkObject = undefined;\n                    }\n                    var target = e.expression;\n                    objects.push(ts.visitNode(target, visitor, ts.isExpression));\n                }\n                else {\n                    if (!chunkObject) {\n                        chunkObject = [];\n                    }\n                    if (e.kind === 257) {\n                        var p = e;\n                        chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression)));\n                    }\n                    else {\n                        chunkObject.push(e);\n                    }\n                }\n            }\n            if (chunkObject) {\n                objects.push(ts.createObjectLiteral(chunkObject));\n            }\n            return objects;\n        }\n        function visitObjectLiteralExpression(node) {\n            if (node.transformFlags & 1048576) {\n                var objects = chunkObjectLiteralElements(node.properties);\n                if (objects.length && objects[0].kind !== 176) {\n                    objects.unshift(ts.createObjectLiteral());\n                }\n                return createAssignHelper(context, objects);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitExpressionStatement(node) {\n            return ts.visitEachChild(node, visitorNoDestructuringValue, context);\n        }\n        function visitParenthesizedExpression(node, noDestructuringValue) {\n            return ts.visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context);\n        }\n        function visitBinaryExpression(node, noDestructuringValue) {\n            if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 1048576) {\n                return ts.flattenDestructuringAssignment(node, visitor, context, 1, !noDestructuringValue);\n            }\n            else if (node.operatorToken.kind === 25) {\n                return ts.updateBinary(node, ts.visitNode(node.left, visitorNoDestructuringValue, ts.isExpression), ts.visitNode(node.right, noDestructuringValue ? visitorNoDestructuringValue : visitor, ts.isExpression));\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitVariableDeclaration(node) {\n            if (ts.isBindingPattern(node.name) && node.name.transformFlags & 1048576) {\n                return ts.flattenDestructuringBinding(node, visitor, context, 1);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitForStatement(node) {\n            return ts.updateFor(node, ts.visitNode(node.initializer, visitorNoDestructuringValue, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement));\n        }\n        function visitVoidExpression(node) {\n            return ts.visitEachChild(node, visitorNoDestructuringValue, context);\n        }\n        function visitForOfStatement(node) {\n            var leadingStatements;\n            var temp;\n            var initializer = ts.skipParentheses(node.initializer);\n            if (initializer.transformFlags & 1048576) {\n                if (ts.isVariableDeclarationList(initializer)) {\n                    temp = ts.createTempVariable(undefined);\n                    var firstDeclaration = ts.firstOrUndefined(initializer.declarations);\n                    var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1, temp, false, true);\n                    if (ts.some(declarations)) {\n                        var statement = ts.createVariableStatement(undefined, ts.updateVariableDeclarationList(initializer, declarations), initializer);\n                        leadingStatements = ts.append(leadingStatements, statement);\n                    }\n                }\n                else if (ts.isAssignmentPattern(initializer)) {\n                    temp = ts.createTempVariable(undefined);\n                    var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, node.initializer)), visitor, context, 1);\n                    leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, node.initializer));\n                }\n            }\n            if (temp) {\n                var expression = ts.visitNode(node.expression, visitor, ts.isExpression);\n                var statement = ts.visitNode(node.statement, visitor, ts.isStatement);\n                var block = ts.isBlock(statement)\n                    ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements))\n                    : ts.createBlock(ts.append(leadingStatements, statement), statement, true);\n                return ts.updateForOf(node, ts.createVariableDeclarationList([\n                    ts.createVariableDeclaration(temp, undefined, undefined, node.initializer)\n                ], node.initializer, 1), expression, block);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitParameter(node) {\n            if (node.transformFlags & 1048576) {\n                return ts.updateParameter(node, undefined, undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitConstructorDeclaration(node) {\n            return ts.updateConstructor(node, undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));\n        }\n        function visitGetAccessorDeclaration(node) {\n            return ts.updateGetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));\n        }\n        function visitSetAccessorDeclaration(node) {\n            return ts.updateSetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));\n        }\n        function visitMethodDeclaration(node) {\n            return ts.updateMethod(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));\n        }\n        function visitFunctionDeclaration(node) {\n            return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));\n        }\n        function visitArrowFunction(node) {\n            return ts.updateArrowFunction(node, node.modifiers, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));\n        }\n        function visitFunctionExpression(node) {\n            return ts.updateFunctionExpression(node, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));\n        }\n        function transformFunctionBody(node) {\n            resumeLexicalEnvironment();\n            var leadingStatements;\n            for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {\n                var parameter = _a[_i];\n                if (parameter.transformFlags & 1048576) {\n                    var temp = ts.getGeneratedNameForNode(parameter);\n                    var declarations = ts.flattenDestructuringBinding(parameter, visitor, context, 1, temp, false, true);\n                    if (ts.some(declarations)) {\n                        var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(declarations));\n                        ts.setEmitFlags(statement, 524288);\n                        leadingStatements = ts.append(leadingStatements, statement);\n                    }\n                }\n            }\n            var body = ts.visitNode(node.body, visitor, ts.isConciseBody);\n            var trailingStatements = endLexicalEnvironment();\n            if (ts.some(leadingStatements) || ts.some(trailingStatements)) {\n                var block = ts.convertToFunctionBody(body, true);\n                return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements));\n            }\n            return body;\n        }\n    }\n    ts.transformESNext = transformESNext;\n    var assignHelper = {\n        name: \"typescript:assign\",\n        scoped: false,\n        priority: 1,\n        text: \"\\n            var __assign = (this && this.__assign) || Object.assign || function(t) {\\n                for (var s, i = 1, n = arguments.length; i < n; i++) {\\n                    s = arguments[i];\\n                    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\\n                        t[p] = s[p];\\n                }\\n                return t;\\n            };\"\n    };\n    function createAssignHelper(context, attributesSegments) {\n        context.requestEmitHelper(assignHelper);\n        return ts.createCall(ts.getHelperName(\"__assign\"), undefined, attributesSegments);\n    }\n    ts.createAssignHelper = createAssignHelper;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformJsx(context) {\n        var compilerOptions = context.getCompilerOptions();\n        var currentSourceFile;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            currentSourceFile = node;\n            var visited = ts.visitEachChild(node, visitor, context);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            currentSourceFile = undefined;\n            return visited;\n        }\n        function visitor(node) {\n            if (node.transformFlags & 4) {\n                return visitorWorker(node);\n            }\n            else {\n                return node;\n            }\n        }\n        function visitorWorker(node) {\n            switch (node.kind) {\n                case 246:\n                    return visitJsxElement(node, false);\n                case 247:\n                    return visitJsxSelfClosingElement(node, false);\n                case 252:\n                    return visitJsxExpression(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function transformJsxChildToExpression(node) {\n            switch (node.kind) {\n                case 10:\n                    return visitJsxText(node);\n                case 252:\n                    return visitJsxExpression(node);\n                case 246:\n                    return visitJsxElement(node, true);\n                case 247:\n                    return visitJsxSelfClosingElement(node, true);\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    return undefined;\n            }\n        }\n        function visitJsxElement(node, isChild) {\n            return visitJsxOpeningLikeElement(node.openingElement, node.children, isChild, node);\n        }\n        function visitJsxSelfClosingElement(node, isChild) {\n            return visitJsxOpeningLikeElement(node, undefined, isChild, node);\n        }\n        function visitJsxOpeningLikeElement(node, children, isChild, location) {\n            var tagName = getTagName(node);\n            var objectProperties;\n            var attrs = node.attributes;\n            if (attrs.length === 0) {\n                objectProperties = ts.createNull();\n            }\n            else {\n                var segments = ts.flatten(ts.spanMap(attrs, ts.isJsxSpreadAttribute, function (attrs, isSpread) { return isSpread\n                    ? ts.map(attrs, transformJsxSpreadAttributeToExpression)\n                    : ts.createObjectLiteral(ts.map(attrs, transformJsxAttributeToObjectLiteralElement)); }));\n                if (ts.isJsxSpreadAttribute(attrs[0])) {\n                    segments.unshift(ts.createObjectLiteral());\n                }\n                objectProperties = ts.singleOrUndefined(segments);\n                if (!objectProperties) {\n                    objectProperties = ts.createAssignHelper(context, segments);\n                }\n            }\n            var element = ts.createExpressionForJsxElement(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location);\n            if (isChild) {\n                ts.startOnNewLine(element);\n            }\n            return element;\n        }\n        function transformJsxSpreadAttributeToExpression(node) {\n            return ts.visitNode(node.expression, visitor, ts.isExpression);\n        }\n        function transformJsxAttributeToObjectLiteralElement(node) {\n            var name = getAttributeName(node);\n            var expression = transformJsxAttributeInitializer(node.initializer);\n            return ts.createPropertyAssignment(name, expression);\n        }\n        function transformJsxAttributeInitializer(node) {\n            if (node === undefined) {\n                return ts.createLiteral(true);\n            }\n            else if (node.kind === 9) {\n                var decoded = tryDecodeEntities(node.text);\n                return decoded ? ts.createLiteral(decoded, node) : node;\n            }\n            else if (node.kind === 252) {\n                return visitJsxExpression(node);\n            }\n            else {\n                ts.Debug.failBadSyntaxKind(node);\n            }\n        }\n        function visitJsxText(node) {\n            var text = ts.getTextOfNode(node, true);\n            var parts;\n            var firstNonWhitespace = 0;\n            var lastNonWhitespace = -1;\n            for (var i = 0; i < text.length; i++) {\n                var c = text.charCodeAt(i);\n                if (ts.isLineBreak(c)) {\n                    if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) {\n                        var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1);\n                        if (!parts) {\n                            parts = [];\n                        }\n                        parts.push(ts.createLiteral(decodeEntities(part)));\n                    }\n                    firstNonWhitespace = -1;\n                }\n                else if (!ts.isWhiteSpace(c)) {\n                    lastNonWhitespace = i;\n                    if (firstNonWhitespace === -1) {\n                        firstNonWhitespace = i;\n                    }\n                }\n            }\n            if (firstNonWhitespace !== -1) {\n                var part = text.substr(firstNonWhitespace);\n                if (!parts) {\n                    parts = [];\n                }\n                parts.push(ts.createLiteral(decodeEntities(part)));\n            }\n            if (parts) {\n                return ts.reduceLeft(parts, aggregateJsxTextParts);\n            }\n            return undefined;\n        }\n        function aggregateJsxTextParts(left, right) {\n            return ts.createAdd(ts.createAdd(left, ts.createLiteral(\" \")), right);\n        }\n        function decodeEntities(text) {\n            return text.replace(/&((#((\\d+)|x([\\da-fA-F]+)))|(\\w+));/g, function (match, _all, _number, _digits, decimal, hex, word) {\n                if (decimal) {\n                    return String.fromCharCode(parseInt(decimal, 10));\n                }\n                else if (hex) {\n                    return String.fromCharCode(parseInt(hex, 16));\n                }\n                else {\n                    var ch = entities[word];\n                    return ch ? String.fromCharCode(ch) : match;\n                }\n            });\n        }\n        function tryDecodeEntities(text) {\n            var decoded = decodeEntities(text);\n            return decoded === text ? undefined : decoded;\n        }\n        function getTagName(node) {\n            if (node.kind === 246) {\n                return getTagName(node.openingElement);\n            }\n            else {\n                var name_35 = node.tagName;\n                if (ts.isIdentifier(name_35) && ts.isIntrinsicJsxName(name_35.text)) {\n                    return ts.createLiteral(name_35.text);\n                }\n                else {\n                    return ts.createExpressionFromEntityName(name_35);\n                }\n            }\n        }\n        function getAttributeName(node) {\n            var name = node.name;\n            if (/^[A-Za-z_]\\w*$/.test(name.text)) {\n                return name;\n            }\n            else {\n                return ts.createLiteral(name.text);\n            }\n        }\n        function visitJsxExpression(node) {\n            return ts.visitNode(node.expression, visitor, ts.isExpression);\n        }\n    }\n    ts.transformJsx = transformJsx;\n    var entities = ts.createMap({\n        \"quot\": 0x0022,\n        \"amp\": 0x0026,\n        \"apos\": 0x0027,\n        \"lt\": 0x003C,\n        \"gt\": 0x003E,\n        \"nbsp\": 0x00A0,\n        \"iexcl\": 0x00A1,\n        \"cent\": 0x00A2,\n        \"pound\": 0x00A3,\n        \"curren\": 0x00A4,\n        \"yen\": 0x00A5,\n        \"brvbar\": 0x00A6,\n        \"sect\": 0x00A7,\n        \"uml\": 0x00A8,\n        \"copy\": 0x00A9,\n        \"ordf\": 0x00AA,\n        \"laquo\": 0x00AB,\n        \"not\": 0x00AC,\n        \"shy\": 0x00AD,\n        \"reg\": 0x00AE,\n        \"macr\": 0x00AF,\n        \"deg\": 0x00B0,\n        \"plusmn\": 0x00B1,\n        \"sup2\": 0x00B2,\n        \"sup3\": 0x00B3,\n        \"acute\": 0x00B4,\n        \"micro\": 0x00B5,\n        \"para\": 0x00B6,\n        \"middot\": 0x00B7,\n        \"cedil\": 0x00B8,\n        \"sup1\": 0x00B9,\n        \"ordm\": 0x00BA,\n        \"raquo\": 0x00BB,\n        \"frac14\": 0x00BC,\n        \"frac12\": 0x00BD,\n        \"frac34\": 0x00BE,\n        \"iquest\": 0x00BF,\n        \"Agrave\": 0x00C0,\n        \"Aacute\": 0x00C1,\n        \"Acirc\": 0x00C2,\n        \"Atilde\": 0x00C3,\n        \"Auml\": 0x00C4,\n        \"Aring\": 0x00C5,\n        \"AElig\": 0x00C6,\n        \"Ccedil\": 0x00C7,\n        \"Egrave\": 0x00C8,\n        \"Eacute\": 0x00C9,\n        \"Ecirc\": 0x00CA,\n        \"Euml\": 0x00CB,\n        \"Igrave\": 0x00CC,\n        \"Iacute\": 0x00CD,\n        \"Icirc\": 0x00CE,\n        \"Iuml\": 0x00CF,\n        \"ETH\": 0x00D0,\n        \"Ntilde\": 0x00D1,\n        \"Ograve\": 0x00D2,\n        \"Oacute\": 0x00D3,\n        \"Ocirc\": 0x00D4,\n        \"Otilde\": 0x00D5,\n        \"Ouml\": 0x00D6,\n        \"times\": 0x00D7,\n        \"Oslash\": 0x00D8,\n        \"Ugrave\": 0x00D9,\n        \"Uacute\": 0x00DA,\n        \"Ucirc\": 0x00DB,\n        \"Uuml\": 0x00DC,\n        \"Yacute\": 0x00DD,\n        \"THORN\": 0x00DE,\n        \"szlig\": 0x00DF,\n        \"agrave\": 0x00E0,\n        \"aacute\": 0x00E1,\n        \"acirc\": 0x00E2,\n        \"atilde\": 0x00E3,\n        \"auml\": 0x00E4,\n        \"aring\": 0x00E5,\n        \"aelig\": 0x00E6,\n        \"ccedil\": 0x00E7,\n        \"egrave\": 0x00E8,\n        \"eacute\": 0x00E9,\n        \"ecirc\": 0x00EA,\n        \"euml\": 0x00EB,\n        \"igrave\": 0x00EC,\n        \"iacute\": 0x00ED,\n        \"icirc\": 0x00EE,\n        \"iuml\": 0x00EF,\n        \"eth\": 0x00F0,\n        \"ntilde\": 0x00F1,\n        \"ograve\": 0x00F2,\n        \"oacute\": 0x00F3,\n        \"ocirc\": 0x00F4,\n        \"otilde\": 0x00F5,\n        \"ouml\": 0x00F6,\n        \"divide\": 0x00F7,\n        \"oslash\": 0x00F8,\n        \"ugrave\": 0x00F9,\n        \"uacute\": 0x00FA,\n        \"ucirc\": 0x00FB,\n        \"uuml\": 0x00FC,\n        \"yacute\": 0x00FD,\n        \"thorn\": 0x00FE,\n        \"yuml\": 0x00FF,\n        \"OElig\": 0x0152,\n        \"oelig\": 0x0153,\n        \"Scaron\": 0x0160,\n        \"scaron\": 0x0161,\n        \"Yuml\": 0x0178,\n        \"fnof\": 0x0192,\n        \"circ\": 0x02C6,\n        \"tilde\": 0x02DC,\n        \"Alpha\": 0x0391,\n        \"Beta\": 0x0392,\n        \"Gamma\": 0x0393,\n        \"Delta\": 0x0394,\n        \"Epsilon\": 0x0395,\n        \"Zeta\": 0x0396,\n        \"Eta\": 0x0397,\n        \"Theta\": 0x0398,\n        \"Iota\": 0x0399,\n        \"Kappa\": 0x039A,\n        \"Lambda\": 0x039B,\n        \"Mu\": 0x039C,\n        \"Nu\": 0x039D,\n        \"Xi\": 0x039E,\n        \"Omicron\": 0x039F,\n        \"Pi\": 0x03A0,\n        \"Rho\": 0x03A1,\n        \"Sigma\": 0x03A3,\n        \"Tau\": 0x03A4,\n        \"Upsilon\": 0x03A5,\n        \"Phi\": 0x03A6,\n        \"Chi\": 0x03A7,\n        \"Psi\": 0x03A8,\n        \"Omega\": 0x03A9,\n        \"alpha\": 0x03B1,\n        \"beta\": 0x03B2,\n        \"gamma\": 0x03B3,\n        \"delta\": 0x03B4,\n        \"epsilon\": 0x03B5,\n        \"zeta\": 0x03B6,\n        \"eta\": 0x03B7,\n        \"theta\": 0x03B8,\n        \"iota\": 0x03B9,\n        \"kappa\": 0x03BA,\n        \"lambda\": 0x03BB,\n        \"mu\": 0x03BC,\n        \"nu\": 0x03BD,\n        \"xi\": 0x03BE,\n        \"omicron\": 0x03BF,\n        \"pi\": 0x03C0,\n        \"rho\": 0x03C1,\n        \"sigmaf\": 0x03C2,\n        \"sigma\": 0x03C3,\n        \"tau\": 0x03C4,\n        \"upsilon\": 0x03C5,\n        \"phi\": 0x03C6,\n        \"chi\": 0x03C7,\n        \"psi\": 0x03C8,\n        \"omega\": 0x03C9,\n        \"thetasym\": 0x03D1,\n        \"upsih\": 0x03D2,\n        \"piv\": 0x03D6,\n        \"ensp\": 0x2002,\n        \"emsp\": 0x2003,\n        \"thinsp\": 0x2009,\n        \"zwnj\": 0x200C,\n        \"zwj\": 0x200D,\n        \"lrm\": 0x200E,\n        \"rlm\": 0x200F,\n        \"ndash\": 0x2013,\n        \"mdash\": 0x2014,\n        \"lsquo\": 0x2018,\n        \"rsquo\": 0x2019,\n        \"sbquo\": 0x201A,\n        \"ldquo\": 0x201C,\n        \"rdquo\": 0x201D,\n        \"bdquo\": 0x201E,\n        \"dagger\": 0x2020,\n        \"Dagger\": 0x2021,\n        \"bull\": 0x2022,\n        \"hellip\": 0x2026,\n        \"permil\": 0x2030,\n        \"prime\": 0x2032,\n        \"Prime\": 0x2033,\n        \"lsaquo\": 0x2039,\n        \"rsaquo\": 0x203A,\n        \"oline\": 0x203E,\n        \"frasl\": 0x2044,\n        \"euro\": 0x20AC,\n        \"image\": 0x2111,\n        \"weierp\": 0x2118,\n        \"real\": 0x211C,\n        \"trade\": 0x2122,\n        \"alefsym\": 0x2135,\n        \"larr\": 0x2190,\n        \"uarr\": 0x2191,\n        \"rarr\": 0x2192,\n        \"darr\": 0x2193,\n        \"harr\": 0x2194,\n        \"crarr\": 0x21B5,\n        \"lArr\": 0x21D0,\n        \"uArr\": 0x21D1,\n        \"rArr\": 0x21D2,\n        \"dArr\": 0x21D3,\n        \"hArr\": 0x21D4,\n        \"forall\": 0x2200,\n        \"part\": 0x2202,\n        \"exist\": 0x2203,\n        \"empty\": 0x2205,\n        \"nabla\": 0x2207,\n        \"isin\": 0x2208,\n        \"notin\": 0x2209,\n        \"ni\": 0x220B,\n        \"prod\": 0x220F,\n        \"sum\": 0x2211,\n        \"minus\": 0x2212,\n        \"lowast\": 0x2217,\n        \"radic\": 0x221A,\n        \"prop\": 0x221D,\n        \"infin\": 0x221E,\n        \"ang\": 0x2220,\n        \"and\": 0x2227,\n        \"or\": 0x2228,\n        \"cap\": 0x2229,\n        \"cup\": 0x222A,\n        \"int\": 0x222B,\n        \"there4\": 0x2234,\n        \"sim\": 0x223C,\n        \"cong\": 0x2245,\n        \"asymp\": 0x2248,\n        \"ne\": 0x2260,\n        \"equiv\": 0x2261,\n        \"le\": 0x2264,\n        \"ge\": 0x2265,\n        \"sub\": 0x2282,\n        \"sup\": 0x2283,\n        \"nsub\": 0x2284,\n        \"sube\": 0x2286,\n        \"supe\": 0x2287,\n        \"oplus\": 0x2295,\n        \"otimes\": 0x2297,\n        \"perp\": 0x22A5,\n        \"sdot\": 0x22C5,\n        \"lceil\": 0x2308,\n        \"rceil\": 0x2309,\n        \"lfloor\": 0x230A,\n        \"rfloor\": 0x230B,\n        \"lang\": 0x2329,\n        \"rang\": 0x232A,\n        \"loz\": 0x25CA,\n        \"spades\": 0x2660,\n        \"clubs\": 0x2663,\n        \"hearts\": 0x2665,\n        \"diams\": 0x2666\n    });\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformES2017(context) {\n        var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;\n        var resolver = context.getEmitResolver();\n        var compilerOptions = context.getCompilerOptions();\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        var currentSourceFile;\n        var enabledSubstitutions;\n        var currentSuperContainer;\n        var previousOnEmitNode = context.onEmitNode;\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        context.onEmitNode = onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            currentSourceFile = node;\n            var visited = ts.visitEachChild(node, visitor, context);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            currentSourceFile = undefined;\n            return visited;\n        }\n        function visitor(node) {\n            if ((node.transformFlags & 16) === 0) {\n                return node;\n            }\n            switch (node.kind) {\n                case 119:\n                    return undefined;\n                case 189:\n                    return visitAwaitExpression(node);\n                case 149:\n                    return visitMethodDeclaration(node);\n                case 225:\n                    return visitFunctionDeclaration(node);\n                case 184:\n                    return visitFunctionExpression(node);\n                case 185:\n                    return visitArrowFunction(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitAwaitExpression(node) {\n            return ts.setOriginalNode(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression), node), node);\n        }\n        function visitMethodDeclaration(node) {\n            return ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)\n                ? transformAsyncFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        function visitFunctionDeclaration(node) {\n            return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)\n                ? transformAsyncFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        function visitFunctionExpression(node) {\n            if (ts.nodeIsMissing(node.body)) {\n                return ts.createOmittedExpression();\n            }\n            return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)\n                ? transformAsyncFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        function visitArrowFunction(node) {\n            return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)\n                ? transformAsyncFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        function transformAsyncFunctionBody(node) {\n            resumeLexicalEnvironment();\n            var original = ts.getOriginalNode(node, ts.isFunctionLike);\n            var nodeType = original.type;\n            var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined;\n            var isArrowFunction = node.kind === 185;\n            var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0;\n            if (!isArrowFunction) {\n                var statements = [];\n                var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, false, visitor);\n                statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset))));\n                ts.addRange(statements, endLexicalEnvironment());\n                var block = ts.createBlock(statements, node.body, true);\n                if (languageVersion >= 2) {\n                    if (resolver.getNodeCheckFlags(node) & 4096) {\n                        enableSubstitutionForAsyncMethodsWithSuper();\n                        ts.addEmitHelper(block, advancedAsyncSuperHelper);\n                    }\n                    else if (resolver.getNodeCheckFlags(node) & 2048) {\n                        enableSubstitutionForAsyncMethodsWithSuper();\n                        ts.addEmitHelper(block, asyncSuperHelper);\n                    }\n                }\n                return block;\n            }\n            else {\n                var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body));\n                var declarations = endLexicalEnvironment();\n                if (ts.some(declarations)) {\n                    var block = ts.convertToFunctionBody(expression);\n                    return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements));\n                }\n                return expression;\n            }\n        }\n        function transformFunctionBodyWorker(body, start) {\n            if (ts.isBlock(body)) {\n                return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start));\n            }\n            else {\n                startLexicalEnvironment();\n                var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody));\n                var declarations = endLexicalEnvironment();\n                return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements));\n            }\n        }\n        function getPromiseConstructor(type) {\n            var typeName = type && ts.getEntityNameFromTypeNode(type);\n            if (typeName && ts.isEntityName(typeName)) {\n                var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);\n                if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue\n                    || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {\n                    return typeName;\n                }\n            }\n            return undefined;\n        }\n        function enableSubstitutionForAsyncMethodsWithSuper() {\n            if ((enabledSubstitutions & 1) === 0) {\n                enabledSubstitutions |= 1;\n                context.enableSubstitution(179);\n                context.enableSubstitution(177);\n                context.enableSubstitution(178);\n                context.enableEmitNotification(226);\n                context.enableEmitNotification(149);\n                context.enableEmitNotification(151);\n                context.enableEmitNotification(152);\n                context.enableEmitNotification(150);\n            }\n        }\n        function substituteExpression(node) {\n            switch (node.kind) {\n                case 177:\n                    return substitutePropertyAccessExpression(node);\n                case 178:\n                    return substituteElementAccessExpression(node);\n                case 179:\n                    if (enabledSubstitutions & 1) {\n                        return substituteCallExpression(node);\n                    }\n                    break;\n            }\n            return node;\n        }\n        function substitutePropertyAccessExpression(node) {\n            if (enabledSubstitutions & 1 && node.expression.kind === 96) {\n                var flags = getSuperContainerAsyncMethodFlags();\n                if (flags) {\n                    return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), flags, node);\n                }\n            }\n            return node;\n        }\n        function substituteElementAccessExpression(node) {\n            if (enabledSubstitutions & 1 && node.expression.kind === 96) {\n                var flags = getSuperContainerAsyncMethodFlags();\n                if (flags) {\n                    return createSuperAccessInAsyncMethod(node.argumentExpression, flags, node);\n                }\n            }\n            return node;\n        }\n        function substituteCallExpression(node) {\n            var expression = node.expression;\n            if (ts.isSuperProperty(expression)) {\n                var flags = getSuperContainerAsyncMethodFlags();\n                if (flags) {\n                    var argumentExpression = ts.isPropertyAccessExpression(expression)\n                        ? substitutePropertyAccessExpression(expression)\n                        : substituteElementAccessExpression(expression);\n                    return ts.createCall(ts.createPropertyAccess(argumentExpression, \"call\"), undefined, [\n                        ts.createThis()\n                    ].concat(node.arguments));\n                }\n            }\n            return node;\n        }\n        function isSuperContainer(node) {\n            var kind = node.kind;\n            return kind === 226\n                || kind === 150\n                || kind === 149\n                || kind === 151\n                || kind === 152;\n        }\n        function onEmitNode(emitContext, node, emitCallback) {\n            if (enabledSubstitutions & 1 && isSuperContainer(node)) {\n                var savedCurrentSuperContainer = currentSuperContainer;\n                currentSuperContainer = node;\n                previousOnEmitNode(emitContext, node, emitCallback);\n                currentSuperContainer = savedCurrentSuperContainer;\n            }\n            else {\n                previousOnEmitNode(emitContext, node, emitCallback);\n            }\n        }\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (emitContext === 1) {\n                return substituteExpression(node);\n            }\n            return node;\n        }\n        function createSuperAccessInAsyncMethod(argumentExpression, flags, location) {\n            if (flags & 4096) {\n                return ts.createPropertyAccess(ts.createCall(ts.createIdentifier(\"_super\"), undefined, [argumentExpression]), \"value\", location);\n            }\n            else {\n                return ts.createCall(ts.createIdentifier(\"_super\"), undefined, [argumentExpression], location);\n            }\n        }\n        function getSuperContainerAsyncMethodFlags() {\n            return currentSuperContainer !== undefined\n                && resolver.getNodeCheckFlags(currentSuperContainer) & (2048 | 4096);\n        }\n    }\n    ts.transformES2017 = transformES2017;\n    function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) {\n        context.requestEmitHelper(awaiterHelper);\n        var generatorFunc = ts.createFunctionExpression(undefined, ts.createToken(38), undefined, undefined, [], undefined, body);\n        (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072;\n        return ts.createCall(ts.getHelperName(\"__awaiter\"), undefined, [\n            ts.createThis(),\n            hasLexicalArguments ? ts.createIdentifier(\"arguments\") : ts.createVoidZero(),\n            promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(),\n            generatorFunc\n        ]);\n    }\n    var awaiterHelper = {\n        name: \"typescript:awaiter\",\n        scoped: false,\n        priority: 5,\n        text: \"\\n            var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\\n                return new (P || (P = Promise))(function (resolve, reject) {\\n                    function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\\n                    function rejected(value) { try { step(generator[\\\"throw\\\"](value)); } catch (e) { reject(e); } }\\n                    function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\\n                    step((generator = generator.apply(thisArg, _arguments)).next());\\n                });\\n            };\"\n    };\n    var asyncSuperHelper = {\n        name: \"typescript:async-super\",\n        scoped: true,\n        text: \"\\n            const _super = name => super[name];\"\n    };\n    var advancedAsyncSuperHelper = {\n        name: \"typescript:advanced-async-super\",\n        scoped: true,\n        text: \"\\n            const _super = (function (geti, seti) {\\n                const cache = Object.create(null);\\n                return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\\n            })(name => super[name], (name, value) => super[name] = value);\"\n    };\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformES2016(context) {\n        var hoistVariableDeclaration = context.hoistVariableDeclaration;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitor(node) {\n            if ((node.transformFlags & 32) === 0) {\n                return node;\n            }\n            switch (node.kind) {\n                case 192:\n                    return visitBinaryExpression(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitBinaryExpression(node) {\n            switch (node.operatorToken.kind) {\n                case 61:\n                    return visitExponentiationAssignmentExpression(node);\n                case 39:\n                    return visitExponentiationExpression(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitExponentiationAssignmentExpression(node) {\n            var target;\n            var value;\n            var left = ts.visitNode(node.left, visitor, ts.isExpression);\n            var right = ts.visitNode(node.right, visitor, ts.isExpression);\n            if (ts.isElementAccessExpression(left)) {\n                var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);\n                var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration);\n                target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left);\n                value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left);\n            }\n            else if (ts.isPropertyAccessExpression(left)) {\n                var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);\n                target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left);\n                value = ts.createPropertyAccess(expressionTemp, left.name, left);\n            }\n            else {\n                target = left;\n                value = left;\n            }\n            return ts.createAssignment(target, ts.createMathPow(value, right, node), node);\n        }\n        function visitExponentiationExpression(node) {\n            var left = ts.visitNode(node.left, visitor, ts.isExpression);\n            var right = ts.visitNode(node.right, visitor, ts.isExpression);\n            return ts.createMathPow(left, right, node);\n        }\n    }\n    ts.transformES2016 = transformES2016;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformES2015(context) {\n        var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;\n        var resolver = context.getEmitResolver();\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        var previousOnEmitNode = context.onEmitNode;\n        context.onEmitNode = onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        var currentSourceFile;\n        var currentText;\n        var currentParent;\n        var currentNode;\n        var enclosingVariableStatement;\n        var enclosingBlockScopeContainer;\n        var enclosingBlockScopeContainerParent;\n        var enclosingFunction;\n        var enclosingNonArrowFunction;\n        var enclosingNonAsyncFunctionBody;\n        var isInConstructorWithCapturedSuper;\n        var convertedLoopState;\n        var enabledSubstitutions;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            currentSourceFile = node;\n            currentText = node.text;\n            var visited = saveStateAndInvoke(node, visitSourceFile);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            currentSourceFile = undefined;\n            currentText = undefined;\n            return visited;\n        }\n        function visitor(node) {\n            return saveStateAndInvoke(node, dispatcher);\n        }\n        function dispatcher(node) {\n            return convertedLoopState\n                ? visitorForConvertedLoopWorker(node)\n                : visitorWorker(node);\n        }\n        function saveStateAndInvoke(node, f) {\n            var savedEnclosingFunction = enclosingFunction;\n            var savedEnclosingNonArrowFunction = enclosingNonArrowFunction;\n            var savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody;\n            var savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer;\n            var savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent;\n            var savedEnclosingVariableStatement = enclosingVariableStatement;\n            var savedCurrentParent = currentParent;\n            var savedCurrentNode = currentNode;\n            var savedConvertedLoopState = convertedLoopState;\n            var savedIsInConstructorWithCapturedSuper = isInConstructorWithCapturedSuper;\n            if (ts.nodeStartsNewLexicalEnvironment(node)) {\n                isInConstructorWithCapturedSuper = false;\n                convertedLoopState = undefined;\n            }\n            onBeforeVisitNode(node);\n            var visited = f(node);\n            isInConstructorWithCapturedSuper = savedIsInConstructorWithCapturedSuper;\n            convertedLoopState = savedConvertedLoopState;\n            enclosingFunction = savedEnclosingFunction;\n            enclosingNonArrowFunction = savedEnclosingNonArrowFunction;\n            enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody;\n            enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer;\n            enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent;\n            enclosingVariableStatement = savedEnclosingVariableStatement;\n            currentParent = savedCurrentParent;\n            currentNode = savedCurrentNode;\n            return visited;\n        }\n        function onBeforeVisitNode(node) {\n            if (currentNode) {\n                if (ts.isBlockScope(currentNode, currentParent)) {\n                    enclosingBlockScopeContainer = currentNode;\n                    enclosingBlockScopeContainerParent = currentParent;\n                }\n                if (ts.isFunctionLike(currentNode)) {\n                    enclosingFunction = currentNode;\n                    if (currentNode.kind !== 185) {\n                        enclosingNonArrowFunction = currentNode;\n                        if (!(ts.getEmitFlags(currentNode) & 131072)) {\n                            enclosingNonAsyncFunctionBody = currentNode;\n                        }\n                    }\n                }\n                switch (currentNode.kind) {\n                    case 205:\n                        enclosingVariableStatement = currentNode;\n                        break;\n                    case 224:\n                    case 223:\n                    case 174:\n                    case 172:\n                    case 173:\n                        break;\n                    default:\n                        enclosingVariableStatement = undefined;\n                }\n            }\n            currentParent = currentNode;\n            currentNode = node;\n        }\n        function returnCapturedThis(node) {\n            return ts.setOriginalNode(ts.createReturn(ts.createIdentifier(\"_this\")), node);\n        }\n        function isReturnVoidStatementInConstructorWithCapturedSuper(node) {\n            return isInConstructorWithCapturedSuper && node.kind === 216 && !node.expression;\n        }\n        function shouldCheckNode(node) {\n            return (node.transformFlags & 64) !== 0 ||\n                node.kind === 219 ||\n                (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node));\n        }\n        function visitorWorker(node) {\n            if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) {\n                return returnCapturedThis(node);\n            }\n            else if (shouldCheckNode(node)) {\n                return visitJavaScript(node);\n            }\n            else if (node.transformFlags & 128 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) {\n                return ts.visitEachChild(node, visitor, context);\n            }\n            else {\n                return node;\n            }\n        }\n        function visitorForConvertedLoopWorker(node) {\n            var result;\n            if (shouldCheckNode(node)) {\n                result = visitJavaScript(node);\n            }\n            else {\n                result = visitNodesInConvertedLoop(node);\n            }\n            return result;\n        }\n        function visitNodesInConvertedLoop(node) {\n            switch (node.kind) {\n                case 216:\n                    node = isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : node;\n                    return visitReturnStatement(node);\n                case 205:\n                    return visitVariableStatement(node);\n                case 218:\n                    return visitSwitchStatement(node);\n                case 215:\n                case 214:\n                    return visitBreakOrContinueStatement(node);\n                case 98:\n                    return visitThisKeyword(node);\n                case 70:\n                    return visitIdentifier(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitJavaScript(node) {\n            switch (node.kind) {\n                case 114:\n                    return undefined;\n                case 226:\n                    return visitClassDeclaration(node);\n                case 197:\n                    return visitClassExpression(node);\n                case 144:\n                    return visitParameter(node);\n                case 225:\n                    return visitFunctionDeclaration(node);\n                case 185:\n                    return visitArrowFunction(node);\n                case 184:\n                    return visitFunctionExpression(node);\n                case 223:\n                    return visitVariableDeclaration(node);\n                case 70:\n                    return visitIdentifier(node);\n                case 224:\n                    return visitVariableDeclarationList(node);\n                case 219:\n                    return visitLabeledStatement(node);\n                case 209:\n                    return visitDoStatement(node);\n                case 210:\n                    return visitWhileStatement(node);\n                case 211:\n                    return visitForStatement(node);\n                case 212:\n                    return visitForInStatement(node);\n                case 213:\n                    return visitForOfStatement(node);\n                case 207:\n                    return visitExpressionStatement(node);\n                case 176:\n                    return visitObjectLiteralExpression(node);\n                case 256:\n                    return visitCatchClause(node);\n                case 258:\n                    return visitShorthandPropertyAssignment(node);\n                case 175:\n                    return visitArrayLiteralExpression(node);\n                case 179:\n                    return visitCallExpression(node);\n                case 180:\n                    return visitNewExpression(node);\n                case 183:\n                    return visitParenthesizedExpression(node, true);\n                case 192:\n                    return visitBinaryExpression(node, true);\n                case 12:\n                case 13:\n                case 14:\n                case 15:\n                    return visitTemplateLiteral(node);\n                case 181:\n                    return visitTaggedTemplateExpression(node);\n                case 194:\n                    return visitTemplateExpression(node);\n                case 195:\n                    return visitYieldExpression(node);\n                case 196:\n                    return visitSpreadElement(node);\n                case 96:\n                    return visitSuperKeyword();\n                case 195:\n                    return ts.visitEachChild(node, visitor, context);\n                case 149:\n                    return visitMethodDeclaration(node);\n                case 205:\n                    return visitVariableStatement(node);\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitSourceFile(node) {\n            var statements = [];\n            startLexicalEnvironment();\n            var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor);\n            addCaptureThisForNodeIfNeeded(statements, node);\n            ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));\n            ts.addRange(statements, endLexicalEnvironment());\n            return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));\n        }\n        function visitSwitchStatement(node) {\n            ts.Debug.assert(convertedLoopState !== undefined);\n            var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps;\n            convertedLoopState.allowedNonLabeledJumps |= 2;\n            var result = ts.visitEachChild(node, visitor, context);\n            convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps;\n            return result;\n        }\n        function visitReturnStatement(node) {\n            ts.Debug.assert(convertedLoopState !== undefined);\n            convertedLoopState.nonLocalJumps |= 8;\n            return ts.createReturn(ts.createObjectLiteral([\n                ts.createPropertyAssignment(ts.createIdentifier(\"value\"), node.expression\n                    ? ts.visitNode(node.expression, visitor, ts.isExpression)\n                    : ts.createVoidZero())\n            ]));\n        }\n        function visitThisKeyword(node) {\n            ts.Debug.assert(convertedLoopState !== undefined);\n            if (enclosingFunction && enclosingFunction.kind === 185) {\n                convertedLoopState.containsLexicalThis = true;\n                return node;\n            }\n            return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName(\"this\"));\n        }\n        function visitIdentifier(node) {\n            if (!convertedLoopState) {\n                return node;\n            }\n            if (ts.isGeneratedIdentifier(node)) {\n                return node;\n            }\n            if (node.text !== \"arguments\" && !resolver.isArgumentsLocalBinding(node)) {\n                return node;\n            }\n            return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName(\"arguments\"));\n        }\n        function visitBreakOrContinueStatement(node) {\n            if (convertedLoopState) {\n                var jump = node.kind === 215 ? 2 : 4;\n                var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) ||\n                    (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump));\n                if (!canUseBreakOrContinue) {\n                    var labelMarker = void 0;\n                    if (!node.label) {\n                        if (node.kind === 215) {\n                            convertedLoopState.nonLocalJumps |= 2;\n                            labelMarker = \"break\";\n                        }\n                        else {\n                            convertedLoopState.nonLocalJumps |= 4;\n                            labelMarker = \"continue\";\n                        }\n                    }\n                    else {\n                        if (node.kind === 215) {\n                            labelMarker = \"break-\" + node.label.text;\n                            setLabeledJump(convertedLoopState, true, node.label.text, labelMarker);\n                        }\n                        else {\n                            labelMarker = \"continue-\" + node.label.text;\n                            setLabeledJump(convertedLoopState, false, node.label.text, labelMarker);\n                        }\n                    }\n                    var returnExpression = ts.createLiteral(labelMarker);\n                    if (convertedLoopState.loopOutParameters.length) {\n                        var outParams = convertedLoopState.loopOutParameters;\n                        var expr = void 0;\n                        for (var i = 0; i < outParams.length; i++) {\n                            var copyExpr = copyOutParameter(outParams[i], 1);\n                            if (i === 0) {\n                                expr = copyExpr;\n                            }\n                            else {\n                                expr = ts.createBinary(expr, 25, copyExpr);\n                            }\n                        }\n                        returnExpression = ts.createBinary(expr, 25, returnExpression);\n                    }\n                    return ts.createReturn(returnExpression);\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitClassDeclaration(node) {\n            var variable = ts.createVariableDeclaration(ts.getLocalName(node, true), undefined, transformClassLikeDeclarationToExpression(node));\n            ts.setOriginalNode(variable, node);\n            var statements = [];\n            var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([variable]), node);\n            ts.setOriginalNode(statement, node);\n            ts.startOnNewLine(statement);\n            statements.push(statement);\n            if (ts.hasModifier(node, 1)) {\n                var exportStatement = ts.hasModifier(node, 512)\n                    ? ts.createExportDefault(ts.getLocalName(node))\n                    : ts.createExternalModuleExport(ts.getLocalName(node));\n                ts.setOriginalNode(exportStatement, statement);\n                statements.push(exportStatement);\n            }\n            var emitFlags = ts.getEmitFlags(node);\n            if ((emitFlags & 2097152) === 0) {\n                statements.push(ts.createEndOfDeclarationMarker(node));\n                ts.setEmitFlags(statement, emitFlags | 2097152);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function visitClassExpression(node) {\n            return transformClassLikeDeclarationToExpression(node);\n        }\n        function transformClassLikeDeclarationToExpression(node) {\n            if (node.name) {\n                enableSubstitutionsForBlockScopedBindings();\n            }\n            var extendsClauseElement = ts.getClassExtendsHeritageClauseElement(node);\n            var classFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, extendsClauseElement ? [ts.createParameter(undefined, undefined, undefined, \"_super\")] : [], undefined, transformClassBody(node, extendsClauseElement));\n            if (ts.getEmitFlags(node) & 32768) {\n                ts.setEmitFlags(classFunction, 32768);\n            }\n            var inner = ts.createPartiallyEmittedExpression(classFunction);\n            inner.end = node.end;\n            ts.setEmitFlags(inner, 1536);\n            var outer = ts.createPartiallyEmittedExpression(inner);\n            outer.end = ts.skipTrivia(currentText, node.pos);\n            ts.setEmitFlags(outer, 1536);\n            return ts.createParen(ts.createCall(outer, undefined, extendsClauseElement\n                ? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)]\n                : []));\n        }\n        function transformClassBody(node, extendsClauseElement) {\n            var statements = [];\n            startLexicalEnvironment();\n            addExtendsHelperIfNeeded(statements, node, extendsClauseElement);\n            addConstructor(statements, node, extendsClauseElement);\n            addClassMembers(statements, node);\n            var closingBraceLocation = ts.createTokenRange(ts.skipTrivia(currentText, node.members.end), 17);\n            var localName = ts.getLocalName(node);\n            var outer = ts.createPartiallyEmittedExpression(localName);\n            outer.end = closingBraceLocation.end;\n            ts.setEmitFlags(outer, 1536);\n            var statement = ts.createReturn(outer);\n            statement.pos = closingBraceLocation.pos;\n            ts.setEmitFlags(statement, 1536 | 384);\n            statements.push(statement);\n            ts.addRange(statements, endLexicalEnvironment());\n            var block = ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true);\n            ts.setEmitFlags(block, 1536);\n            return block;\n        }\n        function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) {\n            if (extendsClauseElement) {\n                statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)), extendsClauseElement));\n            }\n        }\n        function addConstructor(statements, node, extendsClauseElement) {\n            var constructor = ts.getFirstConstructorWithBody(node);\n            var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined);\n            var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), constructor || node);\n            if (extendsClauseElement) {\n                ts.setEmitFlags(constructorFunction, 8);\n            }\n            statements.push(constructorFunction);\n        }\n        function transformConstructorParameters(constructor, hasSynthesizedSuper) {\n            return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context)\n                || [];\n        }\n        function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {\n            var statements = [];\n            resumeLexicalEnvironment();\n            var statementOffset = -1;\n            if (hasSynthesizedSuper) {\n                statementOffset = 0;\n            }\n            else if (constructor) {\n                statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, false, visitor);\n            }\n            if (constructor) {\n                addDefaultValueAssignmentsIfNeeded(statements, constructor);\n                addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);\n                ts.Debug.assert(statementOffset >= 0, \"statementOffset not initialized correctly!\");\n            }\n            var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset);\n            if (superCaptureStatus === 1 || superCaptureStatus === 2) {\n                statementOffset++;\n            }\n            if (constructor) {\n                var body = saveStateAndInvoke(constructor, function (constructor) {\n                    isInConstructorWithCapturedSuper = superCaptureStatus === 1;\n                    return ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset);\n                });\n                ts.addRange(statements, body);\n            }\n            if (extendsClauseElement\n                && superCaptureStatus !== 2\n                && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) {\n                statements.push(ts.createReturn(ts.createIdentifier(\"_this\")));\n            }\n            ts.addRange(statements, endLexicalEnvironment());\n            var block = ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : node, true);\n            if (!constructor) {\n                ts.setEmitFlags(block, 1536);\n            }\n            return block;\n        }\n        function isSufficientlyCoveredByReturnStatements(statement) {\n            if (statement.kind === 216) {\n                return true;\n            }\n            else if (statement.kind === 208) {\n                var ifStatement = statement;\n                if (ifStatement.elseStatement) {\n                    return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) &&\n                        isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement);\n                }\n            }\n            else if (statement.kind === 204) {\n                var lastStatement = ts.lastOrUndefined(statement.statements);\n                if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) {\n            if (!hasExtendsClause) {\n                if (ctor) {\n                    addCaptureThisForNodeIfNeeded(statements, ctor);\n                }\n                return 0;\n            }\n            if (!ctor) {\n                statements.push(ts.createReturn(createDefaultSuperCallOrThis()));\n                return 2;\n            }\n            if (hasSynthesizedSuper) {\n                captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());\n                enableSubstitutionsForCapturedThis();\n                return 1;\n            }\n            var firstStatement;\n            var superCallExpression;\n            var ctorStatements = ctor.body.statements;\n            if (statementOffset < ctorStatements.length) {\n                firstStatement = ctorStatements[statementOffset];\n                if (firstStatement.kind === 207 && ts.isSuperCall(firstStatement.expression)) {\n                    var superCall = firstStatement.expression;\n                    superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall);\n                }\n            }\n            if (superCallExpression && statementOffset === ctorStatements.length - 1) {\n                var returnStatement = ts.createReturn(superCallExpression);\n                if (superCallExpression.kind !== 192\n                    || superCallExpression.left.kind !== 179) {\n                    ts.Debug.fail(\"Assumed generated super call would have form 'super.call(...) || this'.\");\n                }\n                ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536)));\n                statements.push(returnStatement);\n                return 2;\n            }\n            captureThisForNode(statements, ctor, superCallExpression, firstStatement);\n            if (superCallExpression) {\n                return 1;\n            }\n            return 0;\n        }\n        function createDefaultSuperCallOrThis() {\n            var actualThis = ts.createThis();\n            ts.setEmitFlags(actualThis, 4);\n            var superCall = ts.createFunctionApply(ts.createIdentifier(\"_super\"), actualThis, ts.createIdentifier(\"arguments\"));\n            return ts.createLogicalOr(superCall, actualThis);\n        }\n        function visitParameter(node) {\n            if (node.dotDotDotToken) {\n                return undefined;\n            }\n            else if (ts.isBindingPattern(node.name)) {\n                return ts.setOriginalNode(ts.createParameter(undefined, undefined, undefined, ts.getGeneratedNameForNode(node), undefined, undefined, undefined, node), node);\n            }\n            else if (node.initializer) {\n                return ts.setOriginalNode(ts.createParameter(undefined, undefined, undefined, node.name, undefined, undefined, undefined, node), node);\n            }\n            else {\n                return node;\n            }\n        }\n        function shouldAddDefaultValueAssignments(node) {\n            return (node.transformFlags & 131072) !== 0;\n        }\n        function addDefaultValueAssignmentsIfNeeded(statements, node) {\n            if (!shouldAddDefaultValueAssignments(node)) {\n                return;\n            }\n            for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {\n                var parameter = _a[_i];\n                var name_36 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;\n                if (dotDotDotToken) {\n                    continue;\n                }\n                if (ts.isBindingPattern(name_36)) {\n                    addDefaultValueAssignmentForBindingPattern(statements, parameter, name_36, initializer);\n                }\n                else if (initializer) {\n                    addDefaultValueAssignmentForInitializer(statements, parameter, name_36, initializer);\n                }\n            }\n        }\n        function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) {\n            var temp = ts.getGeneratedNameForNode(parameter);\n            if (name.elements.length > 0) {\n                statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0, temp))), 524288));\n            }\n            else if (initializer) {\n                statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 524288));\n            }\n        }\n        function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) {\n            initializer = ts.visitNode(initializer, visitor, ts.isExpression);\n            var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), \"undefined\"), ts.setEmitFlags(ts.createBlock([\n                ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48), ts.setEmitFlags(initializer, 48 | ts.getEmitFlags(initializer)), parameter))\n            ], parameter), 1 | 32 | 384), undefined, parameter);\n            statement.startsOnNewLine = true;\n            ts.setEmitFlags(statement, 384 | 32 | 524288);\n            statements.push(statement);\n        }\n        function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {\n            return node && node.dotDotDotToken && node.name.kind === 70 && !inConstructorWithSynthesizedSuper;\n        }\n        function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {\n            var parameter = ts.lastOrUndefined(node.parameters);\n            if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {\n                return;\n            }\n            var declarationName = ts.getMutableClone(parameter.name);\n            ts.setEmitFlags(declarationName, 48);\n            var expressionName = ts.getSynthesizedClone(parameter.name);\n            var restIndex = node.parameters.length - 1;\n            var temp = ts.createLoopVariable();\n            statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(declarationName, undefined, ts.createArrayLiteral([]))\n            ]), parameter), 524288));\n            var forStatement = ts.createFor(ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(temp, undefined, ts.createLiteral(restIndex))\n            ], parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier(\"arguments\"), \"length\"), parameter), ts.createPostfixIncrement(temp, parameter), ts.createBlock([\n                ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0\n                    ? temp\n                    : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier(\"arguments\"), temp)), parameter))\n            ]));\n            ts.setEmitFlags(forStatement, 524288);\n            ts.startOnNewLine(forStatement);\n            statements.push(forStatement);\n        }\n        function addCaptureThisForNodeIfNeeded(statements, node) {\n            if (node.transformFlags & 32768 && node.kind !== 185) {\n                captureThisForNode(statements, node, ts.createThis());\n            }\n        }\n        function captureThisForNode(statements, node, initializer, originalStatement) {\n            enableSubstitutionsForCapturedThis();\n            var captureThisStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(\"_this\", undefined, initializer)\n            ]), originalStatement);\n            ts.setEmitFlags(captureThisStatement, 1536 | 524288);\n            ts.setSourceMapRange(captureThisStatement, node);\n            statements.push(captureThisStatement);\n        }\n        function addClassMembers(statements, node) {\n            for (var _i = 0, _a = node.members; _i < _a.length; _i++) {\n                var member = _a[_i];\n                switch (member.kind) {\n                    case 203:\n                        statements.push(transformSemicolonClassElementToStatement(member));\n                        break;\n                    case 149:\n                        statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member));\n                        break;\n                    case 151:\n                    case 152:\n                        var accessors = ts.getAllAccessorDeclarations(node.members, member);\n                        if (member === accessors.firstAccessor) {\n                            statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors));\n                        }\n                        break;\n                    case 150:\n                        break;\n                    default:\n                        ts.Debug.failBadSyntaxKind(node);\n                        break;\n                }\n            }\n        }\n        function transformSemicolonClassElementToStatement(member) {\n            return ts.createEmptyStatement(member);\n        }\n        function transformClassMethodDeclarationToStatement(receiver, member) {\n            var commentRange = ts.getCommentRange(member);\n            var sourceMapRange = ts.getSourceMapRange(member);\n            var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name);\n            var memberFunction = transformFunctionLikeToExpression(member, member, undefined);\n            ts.setEmitFlags(memberFunction, 1536);\n            ts.setSourceMapRange(memberFunction, sourceMapRange);\n            var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), member);\n            ts.setOriginalNode(statement, member);\n            ts.setCommentRange(statement, commentRange);\n            ts.setEmitFlags(statement, 48);\n            return statement;\n        }\n        function transformAccessorsToStatement(receiver, accessors) {\n            var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, false), ts.getSourceMapRange(accessors.firstAccessor));\n            ts.setEmitFlags(statement, 1536);\n            return statement;\n        }\n        function transformAccessorsToExpression(receiver, _a, startsOnNewLine) {\n            var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;\n            var target = ts.getMutableClone(receiver);\n            ts.setEmitFlags(target, 1536 | 32);\n            ts.setSourceMapRange(target, firstAccessor.name);\n            var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName));\n            ts.setEmitFlags(propertyName, 1536 | 16);\n            ts.setSourceMapRange(propertyName, firstAccessor.name);\n            var properties = [];\n            if (getAccessor) {\n                var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined);\n                ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor));\n                ts.setEmitFlags(getterFunction, 512);\n                var getter = ts.createPropertyAssignment(\"get\", getterFunction);\n                ts.setCommentRange(getter, ts.getCommentRange(getAccessor));\n                properties.push(getter);\n            }\n            if (setAccessor) {\n                var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined);\n                ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor));\n                ts.setEmitFlags(setterFunction, 512);\n                var setter = ts.createPropertyAssignment(\"set\", setterFunction);\n                ts.setCommentRange(setter, ts.getCommentRange(setAccessor));\n                properties.push(setter);\n            }\n            properties.push(ts.createPropertyAssignment(\"enumerable\", ts.createLiteral(true)), ts.createPropertyAssignment(\"configurable\", ts.createLiteral(true)));\n            var call = ts.createCall(ts.createPropertyAccess(ts.createIdentifier(\"Object\"), \"defineProperty\"), undefined, [\n                target,\n                propertyName,\n                ts.createObjectLiteral(properties, undefined, true)\n            ]);\n            if (startsOnNewLine) {\n                call.startsOnNewLine = true;\n            }\n            return call;\n        }\n        function visitArrowFunction(node) {\n            if (node.transformFlags & 16384) {\n                enableSubstitutionsForCapturedThis();\n            }\n            var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node), node);\n            ts.setOriginalNode(func, node);\n            ts.setEmitFlags(func, 8);\n            return func;\n        }\n        function visitFunctionExpression(node) {\n            return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64\n                ? transformFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        function visitFunctionDeclaration(node) {\n            return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64\n                ? transformFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        function transformFunctionLikeToExpression(node, location, name) {\n            var savedContainingNonArrowFunction = enclosingNonArrowFunction;\n            if (node.kind !== 185) {\n                enclosingNonArrowFunction = node;\n            }\n            var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node);\n            enclosingNonArrowFunction = savedContainingNonArrowFunction;\n            return expression;\n        }\n        function transformFunctionBody(node) {\n            var multiLine = false;\n            var singleLine = false;\n            var statementsLocation;\n            var closeBraceLocation;\n            var statements = [];\n            var body = node.body;\n            var statementOffset;\n            resumeLexicalEnvironment();\n            if (ts.isBlock(body)) {\n                statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor);\n            }\n            addCaptureThisForNodeIfNeeded(statements, node);\n            addDefaultValueAssignmentsIfNeeded(statements, node);\n            addRestParameterIfNeeded(statements, node, false);\n            if (!multiLine && statements.length > 0) {\n                multiLine = true;\n            }\n            if (ts.isBlock(body)) {\n                statementsLocation = body.statements;\n                ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));\n                if (!multiLine && body.multiLine) {\n                    multiLine = true;\n                }\n            }\n            else {\n                ts.Debug.assert(node.kind === 185);\n                statementsLocation = ts.moveRangeEnd(body, -1);\n                var equalsGreaterThanToken = node.equalsGreaterThanToken;\n                if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {\n                    if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {\n                        singleLine = true;\n                    }\n                    else {\n                        multiLine = true;\n                    }\n                }\n                var expression = ts.visitNode(body, visitor, ts.isExpression);\n                var returnStatement = ts.createReturn(expression, body);\n                ts.setEmitFlags(returnStatement, 384 | 32 | 1024);\n                statements.push(returnStatement);\n                closeBraceLocation = body;\n            }\n            var lexicalEnvironment = context.endLexicalEnvironment();\n            ts.addRange(statements, lexicalEnvironment);\n            if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {\n                multiLine = true;\n            }\n            var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine);\n            if (!multiLine && singleLine) {\n                ts.setEmitFlags(block, 1);\n            }\n            if (closeBraceLocation) {\n                ts.setTokenSourceMapRange(block, 17, closeBraceLocation);\n            }\n            ts.setOriginalNode(block, node.body);\n            return block;\n        }\n        function visitExpressionStatement(node) {\n            switch (node.expression.kind) {\n                case 183:\n                    return ts.updateStatement(node, visitParenthesizedExpression(node.expression, false));\n                case 192:\n                    return ts.updateStatement(node, visitBinaryExpression(node.expression, false));\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitParenthesizedExpression(node, needsDestructuringValue) {\n            if (!needsDestructuringValue) {\n                switch (node.expression.kind) {\n                    case 183:\n                        return ts.updateParen(node, visitParenthesizedExpression(node.expression, false));\n                    case 192:\n                        return ts.updateParen(node, visitBinaryExpression(node.expression, false));\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitBinaryExpression(node, needsDestructuringValue) {\n            if (ts.isDestructuringAssignment(node)) {\n                return ts.flattenDestructuringAssignment(node, visitor, context, 0, needsDestructuringValue);\n            }\n        }\n        function visitVariableStatement(node) {\n            if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3) == 0) {\n                var assignments = void 0;\n                for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    hoistVariableDeclarationDeclaredInConvertedLoop(convertedLoopState, decl);\n                    if (decl.initializer) {\n                        var assignment = void 0;\n                        if (ts.isBindingPattern(decl.name)) {\n                            assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0);\n                        }\n                        else {\n                            assignment = ts.createBinary(decl.name, 57, ts.visitNode(decl.initializer, visitor, ts.isExpression));\n                        }\n                        (assignments || (assignments = [])).push(assignment);\n                    }\n                }\n                if (assignments) {\n                    return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25, acc); }), node);\n                }\n                else {\n                    return undefined;\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitVariableDeclarationList(node) {\n            if (node.flags & 3) {\n                enableSubstitutionsForBlockScopedBindings();\n            }\n            var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1\n                ? visitVariableDeclarationInLetDeclarationList\n                : visitVariableDeclaration));\n            var declarationList = ts.createVariableDeclarationList(declarations, node);\n            ts.setOriginalNode(declarationList, node);\n            ts.setCommentRange(declarationList, node);\n            if (node.transformFlags & 8388608\n                && (ts.isBindingPattern(node.declarations[0].name)\n                    || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) {\n                var firstDeclaration = ts.firstOrUndefined(declarations);\n                var lastDeclaration = ts.lastOrUndefined(declarations);\n                ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));\n            }\n            return declarationList;\n        }\n        function shouldEmitExplicitInitializerForLetDeclaration(node) {\n            var flags = resolver.getNodeCheckFlags(node);\n            var isCapturedInFunction = flags & 131072;\n            var isDeclaredInLoop = flags & 262144;\n            var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(enclosingBlockScopeContainer)\n                || (isCapturedInFunction\n                    && isDeclaredInLoop\n                    && ts.isBlock(enclosingBlockScopeContainer)\n                    && ts.isIterationStatement(enclosingBlockScopeContainerParent, false));\n            var emitExplicitInitializer = !emittedAsTopLevel\n                && enclosingBlockScopeContainer.kind !== 212\n                && enclosingBlockScopeContainer.kind !== 213\n                && (!resolver.isDeclarationWithCollidingName(node)\n                    || (isDeclaredInLoop\n                        && !isCapturedInFunction\n                        && !ts.isIterationStatement(enclosingBlockScopeContainer, false)));\n            return emitExplicitInitializer;\n        }\n        function visitVariableDeclarationInLetDeclarationList(node) {\n            var name = node.name;\n            if (ts.isBindingPattern(name)) {\n                return visitVariableDeclaration(node);\n            }\n            if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) {\n                var clone_3 = ts.getMutableClone(node);\n                clone_3.initializer = ts.createVoidZero();\n                return clone_3;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitVariableDeclaration(node) {\n            if (ts.isBindingPattern(node.name)) {\n                var hoistTempVariables = enclosingVariableStatement\n                    && ts.hasModifier(enclosingVariableStatement, 1);\n                return ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, hoistTempVariables);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitLabeledStatement(node) {\n            if (convertedLoopState) {\n                if (!convertedLoopState.labels) {\n                    convertedLoopState.labels = ts.createMap();\n                }\n                convertedLoopState.labels[node.label.text] = node.label.text;\n            }\n            var result;\n            if (ts.isIterationStatement(node.statement, false) && shouldConvertIterationStatementBody(node.statement)) {\n                result = ts.visitNodes(ts.createNodeArray([node.statement]), visitor, ts.isStatement);\n            }\n            else {\n                result = ts.visitEachChild(node, visitor, context);\n            }\n            if (convertedLoopState) {\n                convertedLoopState.labels[node.label.text] = undefined;\n            }\n            return result;\n        }\n        function visitDoStatement(node) {\n            return convertIterationStatementBodyIfNecessary(node);\n        }\n        function visitWhileStatement(node) {\n            return convertIterationStatementBodyIfNecessary(node);\n        }\n        function visitForStatement(node) {\n            return convertIterationStatementBodyIfNecessary(node);\n        }\n        function visitForInStatement(node) {\n            return convertIterationStatementBodyIfNecessary(node);\n        }\n        function visitForOfStatement(node) {\n            return convertIterationStatementBodyIfNecessary(node, convertForOfToFor);\n        }\n        function convertForOfToFor(node, convertedLoopBodyStatements) {\n            var expression = ts.visitNode(node.expression, visitor, ts.isExpression);\n            var initializer = node.initializer;\n            var statements = [];\n            var counter = ts.createLoopVariable();\n            var rhsReference = expression.kind === 70\n                ? ts.createUniqueName(expression.text)\n                : ts.createTempVariable(undefined);\n            var elementAccess = ts.createElementAccess(rhsReference, counter);\n            if (ts.isVariableDeclarationList(initializer)) {\n                if (initializer.flags & 3) {\n                    enableSubstitutionsForBlockScopedBindings();\n                }\n                var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);\n                if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {\n                    var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0, elementAccess);\n                    var declarationList = ts.createVariableDeclarationList(declarations, initializer);\n                    ts.setOriginalNode(declarationList, initializer);\n                    var firstDeclaration = declarations[0];\n                    var lastDeclaration = ts.lastOrUndefined(declarations);\n                    ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));\n                    statements.push(ts.createVariableStatement(undefined, declarationList));\n                }\n                else {\n                    statements.push(ts.createVariableStatement(undefined, ts.setOriginalNode(ts.createVariableDeclarationList([\n                        ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(undefined), undefined, ts.createElementAccess(rhsReference, counter))\n                    ], ts.moveRangePos(initializer, -1)), initializer), ts.moveRangeEnd(initializer, -1)));\n                }\n            }\n            else {\n                var assignment = ts.createAssignment(initializer, elementAccess);\n                if (ts.isDestructuringAssignment(assignment)) {\n                    statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0)));\n                }\n                else {\n                    assignment.end = initializer.end;\n                    statements.push(ts.createStatement(assignment, ts.moveRangeEnd(initializer, -1)));\n                }\n            }\n            var bodyLocation;\n            var statementsLocation;\n            if (convertedLoopBodyStatements) {\n                ts.addRange(statements, convertedLoopBodyStatements);\n            }\n            else {\n                var statement = ts.visitNode(node.statement, visitor, ts.isStatement);\n                if (ts.isBlock(statement)) {\n                    ts.addRange(statements, statement.statements);\n                    bodyLocation = statement;\n                    statementsLocation = statement.statements;\n                }\n                else {\n                    statements.push(statement);\n                }\n            }\n            ts.setEmitFlags(expression, 48 | ts.getEmitFlags(expression));\n            var body = ts.createBlock(ts.createNodeArray(statements, statementsLocation), bodyLocation);\n            ts.setEmitFlags(body, 48 | 384);\n            var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(counter, undefined, ts.createLiteral(0), ts.moveRangePos(node.expression, -1)),\n                ts.createVariableDeclaration(rhsReference, undefined, expression, node.expression)\n            ], node.expression), 1048576), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, \"length\"), node.expression), ts.createPostfixIncrement(counter, node.expression), body, node);\n            ts.setEmitFlags(forStatement, 256);\n            return forStatement;\n        }\n        function visitObjectLiteralExpression(node) {\n            var properties = node.properties;\n            var numProperties = properties.length;\n            var numInitialProperties = numProperties;\n            for (var i = 0; i < numProperties; i++) {\n                var property = properties[i];\n                if (property.transformFlags & 16777216\n                    || property.name.kind === 142) {\n                    numInitialProperties = i;\n                    break;\n                }\n            }\n            ts.Debug.assert(numInitialProperties !== numProperties);\n            var temp = ts.createTempVariable(hoistVariableDeclaration);\n            var expressions = [];\n            var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 32768));\n            if (node.multiLine) {\n                assignment.startsOnNewLine = true;\n            }\n            expressions.push(assignment);\n            addObjectLiteralMembers(expressions, node, temp, numInitialProperties);\n            expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp);\n            return ts.inlineExpressions(expressions);\n        }\n        function shouldConvertIterationStatementBody(node) {\n            return (resolver.getNodeCheckFlags(node) & 65536) !== 0;\n        }\n        function hoistVariableDeclarationDeclaredInConvertedLoop(state, node) {\n            if (!state.hoistedLocalVariables) {\n                state.hoistedLocalVariables = [];\n            }\n            visit(node.name);\n            function visit(node) {\n                if (node.kind === 70) {\n                    state.hoistedLocalVariables.push(node);\n                }\n                else {\n                    for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {\n                        var element = _a[_i];\n                        if (!ts.isOmittedExpression(element)) {\n                            visit(element.name);\n                        }\n                    }\n                }\n            }\n        }\n        function convertIterationStatementBodyIfNecessary(node, convert) {\n            if (!shouldConvertIterationStatementBody(node)) {\n                var saveAllowedNonLabeledJumps = void 0;\n                if (convertedLoopState) {\n                    saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps;\n                    convertedLoopState.allowedNonLabeledJumps = 2 | 4;\n                }\n                var result = convert ? convert(node, undefined) : ts.visitEachChild(node, visitor, context);\n                if (convertedLoopState) {\n                    convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps;\n                }\n                return result;\n            }\n            var functionName = ts.createUniqueName(\"_loop\");\n            var loopInitializer;\n            switch (node.kind) {\n                case 211:\n                case 212:\n                case 213:\n                    var initializer = node.initializer;\n                    if (initializer && initializer.kind === 224) {\n                        loopInitializer = initializer;\n                    }\n                    break;\n            }\n            var loopParameters = [];\n            var loopOutParameters = [];\n            if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 3)) {\n                for (var _i = 0, _a = loopInitializer.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    processLoopVariableDeclaration(decl, loopParameters, loopOutParameters);\n                }\n            }\n            var outerConvertedLoopState = convertedLoopState;\n            convertedLoopState = { loopOutParameters: loopOutParameters };\n            if (outerConvertedLoopState) {\n                if (outerConvertedLoopState.argumentsName) {\n                    convertedLoopState.argumentsName = outerConvertedLoopState.argumentsName;\n                }\n                if (outerConvertedLoopState.thisName) {\n                    convertedLoopState.thisName = outerConvertedLoopState.thisName;\n                }\n                if (outerConvertedLoopState.hoistedLocalVariables) {\n                    convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables;\n                }\n            }\n            var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement);\n            var currentState = convertedLoopState;\n            convertedLoopState = outerConvertedLoopState;\n            if (loopOutParameters.length) {\n                var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody];\n                copyOutParameters(loopOutParameters, 1, statements_4);\n                loopBody = ts.createBlock(statements_4, undefined, true);\n            }\n            if (!ts.isBlock(loopBody)) {\n                loopBody = ts.createBlock([loopBody], undefined, true);\n            }\n            var isAsyncBlockContainingAwait = enclosingNonArrowFunction\n                && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072) !== 0\n                && (node.statement.transformFlags & 16777216) !== 0;\n            var loopBodyFlags = 0;\n            if (currentState.containsLexicalThis) {\n                loopBodyFlags |= 8;\n            }\n            if (isAsyncBlockContainingAwait) {\n                loopBodyFlags |= 131072;\n            }\n            var convertedLoopVariable = ts.createVariableStatement(undefined, ts.setEmitFlags(ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(functionName, undefined, ts.setEmitFlags(ts.createFunctionExpression(undefined, isAsyncBlockContainingAwait ? ts.createToken(38) : undefined, undefined, undefined, loopParameters, undefined, loopBody), loopBodyFlags))\n            ]), 1048576));\n            var statements = [convertedLoopVariable];\n            var extraVariableDeclarations;\n            if (currentState.argumentsName) {\n                if (outerConvertedLoopState) {\n                    outerConvertedLoopState.argumentsName = currentState.argumentsName;\n                }\n                else {\n                    (extraVariableDeclarations || (extraVariableDeclarations = [])).push(ts.createVariableDeclaration(currentState.argumentsName, undefined, ts.createIdentifier(\"arguments\")));\n                }\n            }\n            if (currentState.thisName) {\n                if (outerConvertedLoopState) {\n                    outerConvertedLoopState.thisName = currentState.thisName;\n                }\n                else {\n                    (extraVariableDeclarations || (extraVariableDeclarations = [])).push(ts.createVariableDeclaration(currentState.thisName, undefined, ts.createIdentifier(\"this\")));\n                }\n            }\n            if (currentState.hoistedLocalVariables) {\n                if (outerConvertedLoopState) {\n                    outerConvertedLoopState.hoistedLocalVariables = currentState.hoistedLocalVariables;\n                }\n                else {\n                    if (!extraVariableDeclarations) {\n                        extraVariableDeclarations = [];\n                    }\n                    for (var _b = 0, _c = currentState.hoistedLocalVariables; _b < _c.length; _b++) {\n                        var identifier = _c[_b];\n                        extraVariableDeclarations.push(ts.createVariableDeclaration(identifier));\n                    }\n                }\n            }\n            if (loopOutParameters.length) {\n                if (!extraVariableDeclarations) {\n                    extraVariableDeclarations = [];\n                }\n                for (var _d = 0, loopOutParameters_1 = loopOutParameters; _d < loopOutParameters_1.length; _d++) {\n                    var outParam = loopOutParameters_1[_d];\n                    extraVariableDeclarations.push(ts.createVariableDeclaration(outParam.outParamName));\n                }\n            }\n            if (extraVariableDeclarations) {\n                statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(extraVariableDeclarations)));\n            }\n            var convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait);\n            var loop;\n            if (convert) {\n                loop = convert(node, convertedLoopBodyStatements);\n            }\n            else {\n                loop = ts.getMutableClone(node);\n                loop.statement = undefined;\n                loop = ts.visitEachChild(loop, visitor, context);\n                loop.statement = ts.createBlock(convertedLoopBodyStatements, undefined, true);\n                loop.transformFlags = 0;\n                ts.aggregateTransformFlags(loop);\n            }\n            statements.push(currentParent.kind === 219\n                ? ts.createLabel(currentParent.label, loop)\n                : loop);\n            return statements;\n        }\n        function copyOutParameter(outParam, copyDirection) {\n            var source = copyDirection === 0 ? outParam.outParamName : outParam.originalName;\n            var target = copyDirection === 0 ? outParam.originalName : outParam.outParamName;\n            return ts.createBinary(target, 57, source);\n        }\n        function copyOutParameters(outParams, copyDirection, statements) {\n            for (var _i = 0, outParams_1 = outParams; _i < outParams_1.length; _i++) {\n                var outParam = outParams_1[_i];\n                statements.push(ts.createStatement(copyOutParameter(outParam, copyDirection)));\n            }\n        }\n        function generateCallToConvertedLoop(loopFunctionExpressionName, parameters, state, isAsyncBlockContainingAwait) {\n            var outerConvertedLoopState = convertedLoopState;\n            var statements = [];\n            var isSimpleLoop = !(state.nonLocalJumps & ~4) &&\n                !state.labeledNonLocalBreaks &&\n                !state.labeledNonLocalContinues;\n            var call = ts.createCall(loopFunctionExpressionName, undefined, ts.map(parameters, function (p) { return p.name; }));\n            var callResult = isAsyncBlockContainingAwait ? ts.createYield(ts.createToken(38), call) : call;\n            if (isSimpleLoop) {\n                statements.push(ts.createStatement(callResult));\n                copyOutParameters(state.loopOutParameters, 0, statements);\n            }\n            else {\n                var loopResultName = ts.createUniqueName(\"state\");\n                var stateVariable = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ts.createVariableDeclaration(loopResultName, undefined, callResult)]));\n                statements.push(stateVariable);\n                copyOutParameters(state.loopOutParameters, 0, statements);\n                if (state.nonLocalJumps & 8) {\n                    var returnStatement = void 0;\n                    if (outerConvertedLoopState) {\n                        outerConvertedLoopState.nonLocalJumps |= 8;\n                        returnStatement = ts.createReturn(loopResultName);\n                    }\n                    else {\n                        returnStatement = ts.createReturn(ts.createPropertyAccess(loopResultName, \"value\"));\n                    }\n                    statements.push(ts.createIf(ts.createBinary(ts.createTypeOf(loopResultName), 33, ts.createLiteral(\"object\")), returnStatement));\n                }\n                if (state.nonLocalJumps & 2) {\n                    statements.push(ts.createIf(ts.createBinary(loopResultName, 33, ts.createLiteral(\"break\")), ts.createBreak()));\n                }\n                if (state.labeledNonLocalBreaks || state.labeledNonLocalContinues) {\n                    var caseClauses = [];\n                    processLabeledJumps(state.labeledNonLocalBreaks, true, loopResultName, outerConvertedLoopState, caseClauses);\n                    processLabeledJumps(state.labeledNonLocalContinues, false, loopResultName, outerConvertedLoopState, caseClauses);\n                    statements.push(ts.createSwitch(loopResultName, ts.createCaseBlock(caseClauses)));\n                }\n            }\n            return statements;\n        }\n        function setLabeledJump(state, isBreak, labelText, labelMarker) {\n            if (isBreak) {\n                if (!state.labeledNonLocalBreaks) {\n                    state.labeledNonLocalBreaks = ts.createMap();\n                }\n                state.labeledNonLocalBreaks[labelText] = labelMarker;\n            }\n            else {\n                if (!state.labeledNonLocalContinues) {\n                    state.labeledNonLocalContinues = ts.createMap();\n                }\n                state.labeledNonLocalContinues[labelText] = labelMarker;\n            }\n        }\n        function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) {\n            if (!table) {\n                return;\n            }\n            for (var labelText in table) {\n                var labelMarker = table[labelText];\n                var statements = [];\n                if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) {\n                    var label = ts.createIdentifier(labelText);\n                    statements.push(isBreak ? ts.createBreak(label) : ts.createContinue(label));\n                }\n                else {\n                    setLabeledJump(outerLoop, isBreak, labelText, labelMarker);\n                    statements.push(ts.createReturn(loopResultName));\n                }\n                caseClauses.push(ts.createCaseClause(ts.createLiteral(labelMarker), statements));\n            }\n        }\n        function processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) {\n            var name = decl.name;\n            if (ts.isBindingPattern(name)) {\n                for (var _i = 0, _a = name.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        processLoopVariableDeclaration(element, loopParameters, loopOutParameters);\n                    }\n                }\n            }\n            else {\n                loopParameters.push(ts.createParameter(undefined, undefined, undefined, name));\n                if (resolver.getNodeCheckFlags(decl) & 2097152) {\n                    var outParamName = ts.createUniqueName(\"out_\" + name.text);\n                    loopOutParameters.push({ originalName: name, outParamName: outParamName });\n                }\n            }\n        }\n        function addObjectLiteralMembers(expressions, node, receiver, start) {\n            var properties = node.properties;\n            var numProperties = properties.length;\n            for (var i = start; i < numProperties; i++) {\n                var property = properties[i];\n                switch (property.kind) {\n                    case 151:\n                    case 152:\n                        var accessors = ts.getAllAccessorDeclarations(node.properties, property);\n                        if (property === accessors.firstAccessor) {\n                            expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine));\n                        }\n                        break;\n                    case 257:\n                        expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine));\n                        break;\n                    case 258:\n                        expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine));\n                        break;\n                    case 149:\n                        expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine));\n                        break;\n                    default:\n                        ts.Debug.failBadSyntaxKind(node);\n                        break;\n                }\n            }\n        }\n        function transformPropertyAssignmentToExpression(property, receiver, startsOnNewLine) {\n            var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression), property);\n            if (startsOnNewLine) {\n                expression.startsOnNewLine = true;\n            }\n            return expression;\n        }\n        function transformShorthandPropertyAssignmentToExpression(property, receiver, startsOnNewLine) {\n            var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name), property);\n            if (startsOnNewLine) {\n                expression.startsOnNewLine = true;\n            }\n            return expression;\n        }\n        function transformObjectLiteralMethodDeclarationToExpression(method, receiver, startsOnNewLine) {\n            var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined), method);\n            if (startsOnNewLine) {\n                expression.startsOnNewLine = true;\n            }\n            return expression;\n        }\n        function visitCatchClause(node) {\n            ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name));\n            var temp = ts.createTempVariable(undefined);\n            var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration);\n            var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp);\n            var list = ts.createVariableDeclarationList(vars, node.variableDeclaration, node.variableDeclaration.flags);\n            var destructure = ts.createVariableStatement(undefined, list);\n            return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure));\n        }\n        function addStatementToStartOfBlock(block, statement) {\n            var transformedStatements = ts.visitNodes(block.statements, visitor, ts.isStatement);\n            return ts.updateBlock(block, [statement].concat(transformedStatements));\n        }\n        function visitMethodDeclaration(node) {\n            ts.Debug.assert(!ts.isComputedPropertyName(node.name));\n            var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined);\n            ts.setEmitFlags(functionExpression, 512 | ts.getEmitFlags(functionExpression));\n            return ts.createPropertyAssignment(node.name, functionExpression, node);\n        }\n        function visitShorthandPropertyAssignment(node) {\n            return ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name), node);\n        }\n        function visitYieldExpression(node) {\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitArrayLiteralExpression(node) {\n            return transformAndSpreadElements(node.elements, true, node.multiLine, node.elements.hasTrailingComma);\n        }\n        function visitCallExpression(node) {\n            return visitCallExpressionWithPotentialCapturedThisAssignment(node, true);\n        }\n        function visitImmediateSuperCallInBody(node) {\n            return visitCallExpressionWithPotentialCapturedThisAssignment(node, false);\n        }\n        function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) {\n            var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;\n            if (node.expression.kind === 96) {\n                ts.setEmitFlags(thisArg, 4);\n            }\n            var resultingCall;\n            if (node.transformFlags & 524288) {\n                resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false));\n            }\n            else {\n                resultingCall = ts.createFunctionCall(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node);\n            }\n            if (node.expression.kind === 96) {\n                var actualThis = ts.createThis();\n                ts.setEmitFlags(actualThis, 4);\n                var initializer = ts.createLogicalOr(resultingCall, actualThis);\n                return assignToCapturedThis\n                    ? ts.createAssignment(ts.createIdentifier(\"_this\"), initializer)\n                    : initializer;\n            }\n            return resultingCall;\n        }\n        function visitNewExpression(node) {\n            ts.Debug.assert((node.transformFlags & 524288) !== 0);\n            var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, \"bind\"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;\n            return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []);\n        }\n        function transformAndSpreadElements(elements, needsUniqueCopy, multiLine, hasTrailingComma) {\n            var numElements = elements.length;\n            var segments = ts.flatten(ts.spanMap(elements, partitionSpread, function (partition, visitPartition, _start, end) {\n                return visitPartition(partition, multiLine, hasTrailingComma && end === numElements);\n            }));\n            if (segments.length === 1) {\n                var firstElement = elements[0];\n                return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 175\n                    ? ts.createArraySlice(segments[0])\n                    : segments[0];\n            }\n            return ts.createArrayConcat(segments.shift(), segments);\n        }\n        function partitionSpread(node) {\n            return ts.isSpreadExpression(node)\n                ? visitSpanOfSpreads\n                : visitSpanOfNonSpreads;\n        }\n        function visitSpanOfSpreads(chunk) {\n            return ts.map(chunk, visitExpressionOfSpread);\n        }\n        function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) {\n            return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, undefined, hasTrailingComma), visitor, ts.isExpression), undefined, multiLine);\n        }\n        function visitSpreadElement(node) {\n            return ts.visitNode(node.expression, visitor, ts.isExpression);\n        }\n        function visitExpressionOfSpread(node) {\n            return ts.visitNode(node.expression, visitor, ts.isExpression);\n        }\n        function visitTemplateLiteral(node) {\n            return ts.createLiteral(node.text, node);\n        }\n        function visitTaggedTemplateExpression(node) {\n            var tag = ts.visitNode(node.tag, visitor, ts.isExpression);\n            var temp = ts.createTempVariable(hoistVariableDeclaration);\n            var templateArguments = [temp];\n            var cookedStrings = [];\n            var rawStrings = [];\n            var template = node.template;\n            if (ts.isNoSubstitutionTemplateLiteral(template)) {\n                cookedStrings.push(ts.createLiteral(template.text));\n                rawStrings.push(getRawLiteral(template));\n            }\n            else {\n                cookedStrings.push(ts.createLiteral(template.head.text));\n                rawStrings.push(getRawLiteral(template.head));\n                for (var _i = 0, _a = template.templateSpans; _i < _a.length; _i++) {\n                    var templateSpan = _a[_i];\n                    cookedStrings.push(ts.createLiteral(templateSpan.literal.text));\n                    rawStrings.push(getRawLiteral(templateSpan.literal));\n                    templateArguments.push(ts.visitNode(templateSpan.expression, visitor, ts.isExpression));\n                }\n            }\n            return ts.createParen(ts.inlineExpressions([\n                ts.createAssignment(temp, ts.createArrayLiteral(cookedStrings)),\n                ts.createAssignment(ts.createPropertyAccess(temp, \"raw\"), ts.createArrayLiteral(rawStrings)),\n                ts.createCall(tag, undefined, templateArguments)\n            ]));\n        }\n        function getRawLiteral(node) {\n            var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);\n            var isLast = node.kind === 12 || node.kind === 15;\n            text = text.substring(1, text.length - (isLast ? 1 : 2));\n            text = text.replace(/\\r\\n?/g, \"\\n\");\n            return ts.createLiteral(text, node);\n        }\n        function visitTemplateExpression(node) {\n            var expressions = [];\n            addTemplateHead(expressions, node);\n            addTemplateSpans(expressions, node);\n            var expression = ts.reduceLeft(expressions, ts.createAdd);\n            if (ts.nodeIsSynthesized(expression)) {\n                ts.setTextRange(expression, node);\n            }\n            return expression;\n        }\n        function shouldAddTemplateHead(node) {\n            ts.Debug.assert(node.templateSpans.length !== 0);\n            return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0;\n        }\n        function addTemplateHead(expressions, node) {\n            if (!shouldAddTemplateHead(node)) {\n                return;\n            }\n            expressions.push(ts.createLiteral(node.head.text));\n        }\n        function addTemplateSpans(expressions, node) {\n            for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) {\n                var span_6 = _a[_i];\n                expressions.push(ts.visitNode(span_6.expression, visitor, ts.isExpression));\n                if (span_6.literal.text.length !== 0) {\n                    expressions.push(ts.createLiteral(span_6.literal.text));\n                }\n            }\n        }\n        function visitSuperKeyword() {\n            return enclosingNonAsyncFunctionBody\n                && ts.isClassElement(enclosingNonAsyncFunctionBody)\n                && !ts.hasModifier(enclosingNonAsyncFunctionBody, 32)\n                && currentParent.kind !== 179\n                ? ts.createPropertyAccess(ts.createIdentifier(\"_super\"), \"prototype\")\n                : ts.createIdentifier(\"_super\");\n        }\n        function onEmitNode(emitContext, node, emitCallback) {\n            var savedEnclosingFunction = enclosingFunction;\n            if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) {\n                enclosingFunction = node;\n            }\n            previousOnEmitNode(emitContext, node, emitCallback);\n            enclosingFunction = savedEnclosingFunction;\n        }\n        function enableSubstitutionsForBlockScopedBindings() {\n            if ((enabledSubstitutions & 2) === 0) {\n                enabledSubstitutions |= 2;\n                context.enableSubstitution(70);\n            }\n        }\n        function enableSubstitutionsForCapturedThis() {\n            if ((enabledSubstitutions & 1) === 0) {\n                enabledSubstitutions |= 1;\n                context.enableSubstitution(98);\n                context.enableEmitNotification(150);\n                context.enableEmitNotification(149);\n                context.enableEmitNotification(151);\n                context.enableEmitNotification(152);\n                context.enableEmitNotification(185);\n                context.enableEmitNotification(184);\n                context.enableEmitNotification(225);\n            }\n        }\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (emitContext === 1) {\n                return substituteExpression(node);\n            }\n            if (ts.isIdentifier(node)) {\n                return substituteIdentifier(node);\n            }\n            return node;\n        }\n        function substituteIdentifier(node) {\n            if (enabledSubstitutions & 2) {\n                var original = ts.getParseTreeNode(node, ts.isIdentifier);\n                if (original && isNameOfDeclarationWithCollidingName(original)) {\n                    return ts.getGeneratedNameForNode(original);\n                }\n            }\n            return node;\n        }\n        function isNameOfDeclarationWithCollidingName(node) {\n            var parent = node.parent;\n            switch (parent.kind) {\n                case 174:\n                case 226:\n                case 229:\n                case 223:\n                    return parent.name === node\n                        && resolver.isDeclarationWithCollidingName(parent);\n            }\n            return false;\n        }\n        function substituteExpression(node) {\n            switch (node.kind) {\n                case 70:\n                    return substituteExpressionIdentifier(node);\n                case 98:\n                    return substituteThisKeyword(node);\n            }\n            return node;\n        }\n        function substituteExpressionIdentifier(node) {\n            if (enabledSubstitutions & 2) {\n                var declaration = resolver.getReferencedDeclarationWithCollidingName(node);\n                if (declaration) {\n                    return ts.getGeneratedNameForNode(declaration.name);\n                }\n            }\n            return node;\n        }\n        function substituteThisKeyword(node) {\n            if (enabledSubstitutions & 1\n                && enclosingFunction\n                && ts.getEmitFlags(enclosingFunction) & 8) {\n                return ts.createIdentifier(\"_this\", node);\n            }\n            return node;\n        }\n        function getClassMemberPrefix(node, member) {\n            var expression = ts.getLocalName(node);\n            return ts.hasModifier(member, 32) ? expression : ts.createPropertyAccess(expression, \"prototype\");\n        }\n        function hasSynthesizedDefaultSuperCall(constructor, hasExtendsClause) {\n            if (!constructor || !hasExtendsClause) {\n                return false;\n            }\n            if (ts.some(constructor.parameters)) {\n                return false;\n            }\n            var statement = ts.firstOrUndefined(constructor.body.statements);\n            if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 207) {\n                return false;\n            }\n            var statementExpression = statement.expression;\n            if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 179) {\n                return false;\n            }\n            var callTarget = statementExpression.expression;\n            if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 96) {\n                return false;\n            }\n            var callArgument = ts.singleOrUndefined(statementExpression.arguments);\n            if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 196) {\n                return false;\n            }\n            var expression = callArgument.expression;\n            return ts.isIdentifier(expression) && expression.text === \"arguments\";\n        }\n    }\n    ts.transformES2015 = transformES2015;\n    function createExtendsHelper(context, name) {\n        context.requestEmitHelper(extendsHelper);\n        return ts.createCall(ts.getHelperName(\"__extends\"), undefined, [\n            name,\n            ts.createIdentifier(\"_super\")\n        ]);\n    }\n    var extendsHelper = {\n        name: \"typescript:extends\",\n        scoped: false,\n        priority: 0,\n        text: \"\\n            var __extends = (this && this.__extends) || function (d, b) {\\n                for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\\n                function __() { this.constructor = d; }\\n                d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\\n            };\"\n    };\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var instructionNames = ts.createMap((_a = {},\n        _a[2] = \"return\",\n        _a[3] = \"break\",\n        _a[4] = \"yield\",\n        _a[5] = \"yield*\",\n        _a[7] = \"endfinally\",\n        _a));\n    function transformGenerators(context) {\n        var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration;\n        var compilerOptions = context.getCompilerOptions();\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        var resolver = context.getEmitResolver();\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        context.onSubstituteNode = onSubstituteNode;\n        var currentSourceFile;\n        var renamedCatchVariables;\n        var renamedCatchVariableDeclarations;\n        var inGeneratorFunctionBody;\n        var inStatementContainingYield;\n        var blocks;\n        var blockOffsets;\n        var blockActions;\n        var blockStack;\n        var labelOffsets;\n        var labelExpressions;\n        var nextLabelId = 1;\n        var operations;\n        var operationArguments;\n        var operationLocations;\n        var state;\n        var blockIndex = 0;\n        var labelNumber = 0;\n        var labelNumbers;\n        var lastOperationWasAbrupt;\n        var lastOperationWasCompletion;\n        var clauses;\n        var statements;\n        var exceptionBlockStack;\n        var currentExceptionBlock;\n        var withBlockStack;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)\n                || (node.transformFlags & 512) === 0) {\n                return node;\n            }\n            currentSourceFile = node;\n            var visited = ts.visitEachChild(node, visitor, context);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            currentSourceFile = undefined;\n            return visited;\n        }\n        function visitor(node) {\n            var transformFlags = node.transformFlags;\n            if (inStatementContainingYield) {\n                return visitJavaScriptInStatementContainingYield(node);\n            }\n            else if (inGeneratorFunctionBody) {\n                return visitJavaScriptInGeneratorFunctionBody(node);\n            }\n            else if (transformFlags & 256) {\n                return visitGenerator(node);\n            }\n            else if (transformFlags & 512) {\n                return ts.visitEachChild(node, visitor, context);\n            }\n            else {\n                return node;\n            }\n        }\n        function visitJavaScriptInStatementContainingYield(node) {\n            switch (node.kind) {\n                case 209:\n                    return visitDoStatement(node);\n                case 210:\n                    return visitWhileStatement(node);\n                case 218:\n                    return visitSwitchStatement(node);\n                case 219:\n                    return visitLabeledStatement(node);\n                default:\n                    return visitJavaScriptInGeneratorFunctionBody(node);\n            }\n        }\n        function visitJavaScriptInGeneratorFunctionBody(node) {\n            switch (node.kind) {\n                case 225:\n                    return visitFunctionDeclaration(node);\n                case 184:\n                    return visitFunctionExpression(node);\n                case 151:\n                case 152:\n                    return visitAccessorDeclaration(node);\n                case 205:\n                    return visitVariableStatement(node);\n                case 211:\n                    return visitForStatement(node);\n                case 212:\n                    return visitForInStatement(node);\n                case 215:\n                    return visitBreakStatement(node);\n                case 214:\n                    return visitContinueStatement(node);\n                case 216:\n                    return visitReturnStatement(node);\n                default:\n                    if (node.transformFlags & 16777216) {\n                        return visitJavaScriptContainingYield(node);\n                    }\n                    else if (node.transformFlags & (512 | 33554432)) {\n                        return ts.visitEachChild(node, visitor, context);\n                    }\n                    else {\n                        return node;\n                    }\n            }\n        }\n        function visitJavaScriptContainingYield(node) {\n            switch (node.kind) {\n                case 192:\n                    return visitBinaryExpression(node);\n                case 193:\n                    return visitConditionalExpression(node);\n                case 195:\n                    return visitYieldExpression(node);\n                case 175:\n                    return visitArrayLiteralExpression(node);\n                case 176:\n                    return visitObjectLiteralExpression(node);\n                case 178:\n                    return visitElementAccessExpression(node);\n                case 179:\n                    return visitCallExpression(node);\n                case 180:\n                    return visitNewExpression(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitGenerator(node) {\n            switch (node.kind) {\n                case 225:\n                    return visitFunctionDeclaration(node);\n                case 184:\n                    return visitFunctionExpression(node);\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitFunctionDeclaration(node) {\n            if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {\n                node = ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node);\n            }\n            else {\n                var savedInGeneratorFunctionBody = inGeneratorFunctionBody;\n                var savedInStatementContainingYield = inStatementContainingYield;\n                inGeneratorFunctionBody = false;\n                inStatementContainingYield = false;\n                node = ts.visitEachChild(node, visitor, context);\n                inGeneratorFunctionBody = savedInGeneratorFunctionBody;\n                inStatementContainingYield = savedInStatementContainingYield;\n            }\n            if (inGeneratorFunctionBody) {\n                hoistFunctionDeclaration(node);\n                return undefined;\n            }\n            else {\n                return node;\n            }\n        }\n        function visitFunctionExpression(node) {\n            if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {\n                node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node);\n            }\n            else {\n                var savedInGeneratorFunctionBody = inGeneratorFunctionBody;\n                var savedInStatementContainingYield = inStatementContainingYield;\n                inGeneratorFunctionBody = false;\n                inStatementContainingYield = false;\n                node = ts.visitEachChild(node, visitor, context);\n                inGeneratorFunctionBody = savedInGeneratorFunctionBody;\n                inStatementContainingYield = savedInStatementContainingYield;\n            }\n            return node;\n        }\n        function visitAccessorDeclaration(node) {\n            var savedInGeneratorFunctionBody = inGeneratorFunctionBody;\n            var savedInStatementContainingYield = inStatementContainingYield;\n            inGeneratorFunctionBody = false;\n            inStatementContainingYield = false;\n            node = ts.visitEachChild(node, visitor, context);\n            inGeneratorFunctionBody = savedInGeneratorFunctionBody;\n            inStatementContainingYield = savedInStatementContainingYield;\n            return node;\n        }\n        function transformGeneratorFunctionBody(body) {\n            var statements = [];\n            var savedInGeneratorFunctionBody = inGeneratorFunctionBody;\n            var savedInStatementContainingYield = inStatementContainingYield;\n            var savedBlocks = blocks;\n            var savedBlockOffsets = blockOffsets;\n            var savedBlockActions = blockActions;\n            var savedBlockStack = blockStack;\n            var savedLabelOffsets = labelOffsets;\n            var savedLabelExpressions = labelExpressions;\n            var savedNextLabelId = nextLabelId;\n            var savedOperations = operations;\n            var savedOperationArguments = operationArguments;\n            var savedOperationLocations = operationLocations;\n            var savedState = state;\n            inGeneratorFunctionBody = true;\n            inStatementContainingYield = false;\n            blocks = undefined;\n            blockOffsets = undefined;\n            blockActions = undefined;\n            blockStack = undefined;\n            labelOffsets = undefined;\n            labelExpressions = undefined;\n            nextLabelId = 1;\n            operations = undefined;\n            operationArguments = undefined;\n            operationLocations = undefined;\n            state = ts.createTempVariable(undefined);\n            resumeLexicalEnvironment();\n            var statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor);\n            transformAndEmitStatements(body.statements, statementOffset);\n            var buildResult = build();\n            ts.addRange(statements, endLexicalEnvironment());\n            statements.push(ts.createReturn(buildResult));\n            inGeneratorFunctionBody = savedInGeneratorFunctionBody;\n            inStatementContainingYield = savedInStatementContainingYield;\n            blocks = savedBlocks;\n            blockOffsets = savedBlockOffsets;\n            blockActions = savedBlockActions;\n            blockStack = savedBlockStack;\n            labelOffsets = savedLabelOffsets;\n            labelExpressions = savedLabelExpressions;\n            nextLabelId = savedNextLabelId;\n            operations = savedOperations;\n            operationArguments = savedOperationArguments;\n            operationLocations = savedOperationLocations;\n            state = savedState;\n            return ts.createBlock(statements, body, body.multiLine);\n        }\n        function visitVariableStatement(node) {\n            if (node.transformFlags & 16777216) {\n                transformAndEmitVariableDeclarationList(node.declarationList);\n                return undefined;\n            }\n            else {\n                if (ts.getEmitFlags(node) & 524288) {\n                    return node;\n                }\n                for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                    var variable = _a[_i];\n                    hoistVariableDeclaration(variable.name);\n                }\n                var variables = ts.getInitializedVariables(node.declarationList);\n                if (variables.length === 0) {\n                    return undefined;\n                }\n                return ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable)));\n            }\n        }\n        function visitBinaryExpression(node) {\n            switch (ts.getExpressionAssociativity(node)) {\n                case 0:\n                    return visitLeftAssociativeBinaryExpression(node);\n                case 1:\n                    return visitRightAssociativeBinaryExpression(node);\n                default:\n                    ts.Debug.fail(\"Unknown associativity.\");\n            }\n        }\n        function isCompoundAssignment(kind) {\n            return kind >= 58\n                && kind <= 69;\n        }\n        function getOperatorForCompoundAssignment(kind) {\n            switch (kind) {\n                case 58: return 36;\n                case 59: return 37;\n                case 60: return 38;\n                case 61: return 39;\n                case 62: return 40;\n                case 63: return 41;\n                case 64: return 44;\n                case 65: return 45;\n                case 66: return 46;\n                case 67: return 47;\n                case 68: return 48;\n                case 69: return 49;\n            }\n        }\n        function visitRightAssociativeBinaryExpression(node) {\n            var left = node.left, right = node.right;\n            if (containsYield(right)) {\n                var target = void 0;\n                switch (left.kind) {\n                    case 177:\n                        target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name);\n                        break;\n                    case 178:\n                        target = ts.updateElementAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression)));\n                        break;\n                    default:\n                        target = ts.visitNode(left, visitor, ts.isExpression);\n                        break;\n                }\n                var operator = node.operatorToken.kind;\n                if (isCompoundAssignment(operator)) {\n                    return ts.createBinary(target, 57, ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression), node), node);\n                }\n                else {\n                    return ts.updateBinary(node, target, ts.visitNode(right, visitor, ts.isExpression));\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitLeftAssociativeBinaryExpression(node) {\n            if (containsYield(node.right)) {\n                if (ts.isLogicalOperator(node.operatorToken.kind)) {\n                    return visitLogicalBinaryExpression(node);\n                }\n                else if (node.operatorToken.kind === 25) {\n                    return visitCommaExpression(node);\n                }\n                var clone_4 = ts.getMutableClone(node);\n                clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression));\n                clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression);\n                return clone_4;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitLogicalBinaryExpression(node) {\n            var resultLabel = defineLabel();\n            var resultLocal = declareLocal();\n            emitAssignment(resultLocal, ts.visitNode(node.left, visitor, ts.isExpression), node.left);\n            if (node.operatorToken.kind === 52) {\n                emitBreakWhenFalse(resultLabel, resultLocal, node.left);\n            }\n            else {\n                emitBreakWhenTrue(resultLabel, resultLocal, node.left);\n            }\n            emitAssignment(resultLocal, ts.visitNode(node.right, visitor, ts.isExpression), node.right);\n            markLabel(resultLabel);\n            return resultLocal;\n        }\n        function visitCommaExpression(node) {\n            var pendingExpressions = [];\n            visit(node.left);\n            visit(node.right);\n            return ts.inlineExpressions(pendingExpressions);\n            function visit(node) {\n                if (ts.isBinaryExpression(node) && node.operatorToken.kind === 25) {\n                    visit(node.left);\n                    visit(node.right);\n                }\n                else {\n                    if (containsYield(node) && pendingExpressions.length > 0) {\n                        emitWorker(1, [ts.createStatement(ts.inlineExpressions(pendingExpressions))]);\n                        pendingExpressions = [];\n                    }\n                    pendingExpressions.push(ts.visitNode(node, visitor, ts.isExpression));\n                }\n            }\n        }\n        function visitConditionalExpression(node) {\n            if (containsYield(node.whenTrue) || containsYield(node.whenFalse)) {\n                var whenFalseLabel = defineLabel();\n                var resultLabel = defineLabel();\n                var resultLocal = declareLocal();\n                emitBreakWhenFalse(whenFalseLabel, ts.visitNode(node.condition, visitor, ts.isExpression), node.condition);\n                emitAssignment(resultLocal, ts.visitNode(node.whenTrue, visitor, ts.isExpression), node.whenTrue);\n                emitBreak(resultLabel);\n                markLabel(whenFalseLabel);\n                emitAssignment(resultLocal, ts.visitNode(node.whenFalse, visitor, ts.isExpression), node.whenFalse);\n                markLabel(resultLabel);\n                return resultLocal;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitYieldExpression(node) {\n            var resumeLabel = defineLabel();\n            var expression = ts.visitNode(node.expression, visitor, ts.isExpression);\n            if (node.asteriskToken) {\n                emitYieldStar(expression, node);\n            }\n            else {\n                emitYield(expression, node);\n            }\n            markLabel(resumeLabel);\n            return createGeneratorResume();\n        }\n        function visitArrayLiteralExpression(node) {\n            return visitElements(node.elements, undefined, undefined, node.multiLine);\n        }\n        function visitElements(elements, leadingElement, location, multiLine) {\n            var numInitialElements = countInitialNodesWithoutYield(elements);\n            var temp = declareLocal();\n            var hasAssignedTemp = false;\n            if (numInitialElements > 0) {\n                var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements);\n                emitAssignment(temp, ts.createArrayLiteral(leadingElement\n                    ? [leadingElement].concat(initialElements) : initialElements));\n                leadingElement = undefined;\n                hasAssignedTemp = true;\n            }\n            var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements);\n            return hasAssignedTemp\n                ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)])\n                : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine);\n            function reduceElement(expressions, element) {\n                if (containsYield(element) && expressions.length > 0) {\n                    emitAssignment(temp, hasAssignedTemp\n                        ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)])\n                        : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, undefined, multiLine));\n                    hasAssignedTemp = true;\n                    leadingElement = undefined;\n                    expressions = [];\n                }\n                expressions.push(ts.visitNode(element, visitor, ts.isExpression));\n                return expressions;\n            }\n        }\n        function visitObjectLiteralExpression(node) {\n            var properties = node.properties;\n            var multiLine = node.multiLine;\n            var numInitialProperties = countInitialNodesWithoutYield(properties);\n            var temp = declareLocal();\n            emitAssignment(temp, ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, multiLine));\n            var expressions = ts.reduceLeft(properties, reduceProperty, [], numInitialProperties);\n            expressions.push(multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp);\n            return ts.inlineExpressions(expressions);\n            function reduceProperty(expressions, property) {\n                if (containsYield(property) && expressions.length > 0) {\n                    emitStatement(ts.createStatement(ts.inlineExpressions(expressions)));\n                    expressions = [];\n                }\n                var expression = ts.createExpressionForObjectLiteralElementLike(node, property, temp);\n                var visited = ts.visitNode(expression, visitor, ts.isExpression);\n                if (visited) {\n                    if (multiLine) {\n                        visited.startsOnNewLine = true;\n                    }\n                    expressions.push(visited);\n                }\n                return expressions;\n            }\n        }\n        function visitElementAccessExpression(node) {\n            if (containsYield(node.argumentExpression)) {\n                var clone_5 = ts.getMutableClone(node);\n                clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression));\n                clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression);\n                return clone_5;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitCallExpression(node) {\n            if (ts.forEach(node.arguments, containsYield)) {\n                var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion, true), target = _a.target, thisArg = _a.thisArg;\n                return ts.setOriginalNode(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isLeftHandSideExpression)), thisArg, visitElements(node.arguments), node), node);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitNewExpression(node) {\n            if (ts.forEach(node.arguments, containsYield)) {\n                var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, \"bind\"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;\n                return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, ts.createVoidZero())), undefined, [], node), node);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function transformAndEmitStatements(statements, start) {\n            if (start === void 0) { start = 0; }\n            var numStatements = statements.length;\n            for (var i = start; i < numStatements; i++) {\n                transformAndEmitStatement(statements[i]);\n            }\n        }\n        function transformAndEmitEmbeddedStatement(node) {\n            if (ts.isBlock(node)) {\n                transformAndEmitStatements(node.statements);\n            }\n            else {\n                transformAndEmitStatement(node);\n            }\n        }\n        function transformAndEmitStatement(node) {\n            var savedInStatementContainingYield = inStatementContainingYield;\n            if (!inStatementContainingYield) {\n                inStatementContainingYield = containsYield(node);\n            }\n            transformAndEmitStatementWorker(node);\n            inStatementContainingYield = savedInStatementContainingYield;\n        }\n        function transformAndEmitStatementWorker(node) {\n            switch (node.kind) {\n                case 204:\n                    return transformAndEmitBlock(node);\n                case 207:\n                    return transformAndEmitExpressionStatement(node);\n                case 208:\n                    return transformAndEmitIfStatement(node);\n                case 209:\n                    return transformAndEmitDoStatement(node);\n                case 210:\n                    return transformAndEmitWhileStatement(node);\n                case 211:\n                    return transformAndEmitForStatement(node);\n                case 212:\n                    return transformAndEmitForInStatement(node);\n                case 214:\n                    return transformAndEmitContinueStatement(node);\n                case 215:\n                    return transformAndEmitBreakStatement(node);\n                case 216:\n                    return transformAndEmitReturnStatement(node);\n                case 217:\n                    return transformAndEmitWithStatement(node);\n                case 218:\n                    return transformAndEmitSwitchStatement(node);\n                case 219:\n                    return transformAndEmitLabeledStatement(node);\n                case 220:\n                    return transformAndEmitThrowStatement(node);\n                case 221:\n                    return transformAndEmitTryStatement(node);\n                default:\n                    return emitStatement(ts.visitNode(node, visitor, ts.isStatement, true));\n            }\n        }\n        function transformAndEmitBlock(node) {\n            if (containsYield(node)) {\n                transformAndEmitStatements(node.statements);\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function transformAndEmitExpressionStatement(node) {\n            emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n        }\n        function transformAndEmitVariableDeclarationList(node) {\n            for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) {\n                var variable = _a[_i];\n                hoistVariableDeclaration(variable.name);\n            }\n            var variables = ts.getInitializedVariables(node);\n            var numVariables = variables.length;\n            var variablesWritten = 0;\n            var pendingExpressions = [];\n            while (variablesWritten < numVariables) {\n                for (var i = variablesWritten; i < numVariables; i++) {\n                    var variable = variables[i];\n                    if (containsYield(variable.initializer) && pendingExpressions.length > 0) {\n                        break;\n                    }\n                    pendingExpressions.push(transformInitializedVariable(variable));\n                }\n                if (pendingExpressions.length) {\n                    emitStatement(ts.createStatement(ts.inlineExpressions(pendingExpressions)));\n                    variablesWritten += pendingExpressions.length;\n                    pendingExpressions = [];\n                }\n            }\n            return undefined;\n        }\n        function transformInitializedVariable(node) {\n            return ts.createAssignment(ts.getSynthesizedClone(node.name), ts.visitNode(node.initializer, visitor, ts.isExpression));\n        }\n        function transformAndEmitIfStatement(node) {\n            if (containsYield(node)) {\n                if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) {\n                    var endLabel = defineLabel();\n                    var elseLabel = node.elseStatement ? defineLabel() : undefined;\n                    emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression));\n                    transformAndEmitEmbeddedStatement(node.thenStatement);\n                    if (node.elseStatement) {\n                        emitBreak(endLabel);\n                        markLabel(elseLabel);\n                        transformAndEmitEmbeddedStatement(node.elseStatement);\n                    }\n                    markLabel(endLabel);\n                }\n                else {\n                    emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n                }\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function transformAndEmitDoStatement(node) {\n            if (containsYield(node)) {\n                var conditionLabel = defineLabel();\n                var loopLabel = defineLabel();\n                beginLoopBlock(conditionLabel);\n                markLabel(loopLabel);\n                transformAndEmitEmbeddedStatement(node.statement);\n                markLabel(conditionLabel);\n                emitBreakWhenTrue(loopLabel, ts.visitNode(node.expression, visitor, ts.isExpression));\n                endLoopBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitDoStatement(node) {\n            if (inStatementContainingYield) {\n                beginScriptLoopBlock();\n                node = ts.visitEachChild(node, visitor, context);\n                endLoopBlock();\n                return node;\n            }\n            else {\n                return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function transformAndEmitWhileStatement(node) {\n            if (containsYield(node)) {\n                var loopLabel = defineLabel();\n                var endLabel = beginLoopBlock(loopLabel);\n                markLabel(loopLabel);\n                emitBreakWhenFalse(endLabel, ts.visitNode(node.expression, visitor, ts.isExpression));\n                transformAndEmitEmbeddedStatement(node.statement);\n                emitBreak(loopLabel);\n                endLoopBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitWhileStatement(node) {\n            if (inStatementContainingYield) {\n                beginScriptLoopBlock();\n                node = ts.visitEachChild(node, visitor, context);\n                endLoopBlock();\n                return node;\n            }\n            else {\n                return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function transformAndEmitForStatement(node) {\n            if (containsYield(node)) {\n                var conditionLabel = defineLabel();\n                var incrementLabel = defineLabel();\n                var endLabel = beginLoopBlock(incrementLabel);\n                if (node.initializer) {\n                    var initializer = node.initializer;\n                    if (ts.isVariableDeclarationList(initializer)) {\n                        transformAndEmitVariableDeclarationList(initializer);\n                    }\n                    else {\n                        emitStatement(ts.createStatement(ts.visitNode(initializer, visitor, ts.isExpression), initializer));\n                    }\n                }\n                markLabel(conditionLabel);\n                if (node.condition) {\n                    emitBreakWhenFalse(endLabel, ts.visitNode(node.condition, visitor, ts.isExpression));\n                }\n                transformAndEmitEmbeddedStatement(node.statement);\n                markLabel(incrementLabel);\n                if (node.incrementor) {\n                    emitStatement(ts.createStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression), node.incrementor));\n                }\n                emitBreak(conditionLabel);\n                endLoopBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitForStatement(node) {\n            if (inStatementContainingYield) {\n                beginScriptLoopBlock();\n            }\n            var initializer = node.initializer;\n            if (ts.isVariableDeclarationList(initializer)) {\n                for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) {\n                    var variable = _a[_i];\n                    hoistVariableDeclaration(variable.name);\n                }\n                var variables = ts.getInitializedVariables(initializer);\n                node = ts.updateFor(node, variables.length > 0\n                    ? ts.inlineExpressions(ts.map(variables, transformInitializedVariable))\n                    : undefined, ts.visitNode(node.condition, visitor, ts.isExpression, true), ts.visitNode(node.incrementor, visitor, ts.isExpression, true), ts.visitNode(node.statement, visitor, ts.isStatement, false, ts.liftToBlock));\n            }\n            else {\n                node = ts.visitEachChild(node, visitor, context);\n            }\n            if (inStatementContainingYield) {\n                endLoopBlock();\n            }\n            return node;\n        }\n        function transformAndEmitForInStatement(node) {\n            if (containsYield(node)) {\n                var keysArray = declareLocal();\n                var key = declareLocal();\n                var keysIndex = ts.createLoopVariable();\n                var initializer = node.initializer;\n                hoistVariableDeclaration(keysIndex);\n                emitAssignment(keysArray, ts.createArrayLiteral());\n                emitStatement(ts.createForIn(key, ts.visitNode(node.expression, visitor, ts.isExpression), ts.createStatement(ts.createCall(ts.createPropertyAccess(keysArray, \"push\"), undefined, [key]))));\n                emitAssignment(keysIndex, ts.createLiteral(0));\n                var conditionLabel = defineLabel();\n                var incrementLabel = defineLabel();\n                var endLabel = beginLoopBlock(incrementLabel);\n                markLabel(conditionLabel);\n                emitBreakWhenFalse(endLabel, ts.createLessThan(keysIndex, ts.createPropertyAccess(keysArray, \"length\")));\n                var variable = void 0;\n                if (ts.isVariableDeclarationList(initializer)) {\n                    for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) {\n                        var variable_1 = _a[_i];\n                        hoistVariableDeclaration(variable_1.name);\n                    }\n                    variable = ts.getSynthesizedClone(initializer.declarations[0].name);\n                }\n                else {\n                    variable = ts.visitNode(initializer, visitor, ts.isExpression);\n                    ts.Debug.assert(ts.isLeftHandSideExpression(variable));\n                }\n                emitAssignment(variable, ts.createElementAccess(keysArray, keysIndex));\n                transformAndEmitEmbeddedStatement(node.statement);\n                markLabel(incrementLabel);\n                emitStatement(ts.createStatement(ts.createPostfixIncrement(keysIndex)));\n                emitBreak(conditionLabel);\n                endLoopBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitForInStatement(node) {\n            if (inStatementContainingYield) {\n                beginScriptLoopBlock();\n            }\n            var initializer = node.initializer;\n            if (ts.isVariableDeclarationList(initializer)) {\n                for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) {\n                    var variable = _a[_i];\n                    hoistVariableDeclaration(variable.name);\n                }\n                node = ts.updateForIn(node, initializer.declarations[0].name, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, false, ts.liftToBlock));\n            }\n            else {\n                node = ts.visitEachChild(node, visitor, context);\n            }\n            if (inStatementContainingYield) {\n                endLoopBlock();\n            }\n            return node;\n        }\n        function transformAndEmitContinueStatement(node) {\n            var label = findContinueTarget(node.label ? node.label.text : undefined);\n            ts.Debug.assert(label > 0, \"Expected continue statment to point to a valid Label.\");\n            emitBreak(label, node);\n        }\n        function visitContinueStatement(node) {\n            if (inStatementContainingYield) {\n                var label = findContinueTarget(node.label && node.label.text);\n                if (label > 0) {\n                    return createInlineBreak(label, node);\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function transformAndEmitBreakStatement(node) {\n            var label = findBreakTarget(node.label ? node.label.text : undefined);\n            ts.Debug.assert(label > 0, \"Expected break statment to point to a valid Label.\");\n            emitBreak(label, node);\n        }\n        function visitBreakStatement(node) {\n            if (inStatementContainingYield) {\n                var label = findBreakTarget(node.label && node.label.text);\n                if (label > 0) {\n                    return createInlineBreak(label, node);\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function transformAndEmitReturnStatement(node) {\n            emitReturn(ts.visitNode(node.expression, visitor, ts.isExpression, true), node);\n        }\n        function visitReturnStatement(node) {\n            return createInlineReturn(ts.visitNode(node.expression, visitor, ts.isExpression, true), node);\n        }\n        function transformAndEmitWithStatement(node) {\n            if (containsYield(node)) {\n                beginWithBlock(cacheExpression(ts.visitNode(node.expression, visitor, ts.isExpression)));\n                transformAndEmitEmbeddedStatement(node.statement);\n                endWithBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function transformAndEmitSwitchStatement(node) {\n            if (containsYield(node.caseBlock)) {\n                var caseBlock = node.caseBlock;\n                var numClauses = caseBlock.clauses.length;\n                var endLabel = beginSwitchBlock();\n                var expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isExpression));\n                var clauseLabels = [];\n                var defaultClauseIndex = -1;\n                for (var i = 0; i < numClauses; i++) {\n                    var clause = caseBlock.clauses[i];\n                    clauseLabels.push(defineLabel());\n                    if (clause.kind === 254 && defaultClauseIndex === -1) {\n                        defaultClauseIndex = i;\n                    }\n                }\n                var clausesWritten = 0;\n                var pendingClauses = [];\n                while (clausesWritten < numClauses) {\n                    var defaultClausesSkipped = 0;\n                    for (var i = clausesWritten; i < numClauses; i++) {\n                        var clause = caseBlock.clauses[i];\n                        if (clause.kind === 253) {\n                            var caseClause = clause;\n                            if (containsYield(caseClause.expression) && pendingClauses.length > 0) {\n                                break;\n                            }\n                            pendingClauses.push(ts.createCaseClause(ts.visitNode(caseClause.expression, visitor, ts.isExpression), [\n                                createInlineBreak(clauseLabels[i], caseClause.expression)\n                            ]));\n                        }\n                        else {\n                            defaultClausesSkipped++;\n                        }\n                    }\n                    if (pendingClauses.length) {\n                        emitStatement(ts.createSwitch(expression, ts.createCaseBlock(pendingClauses)));\n                        clausesWritten += pendingClauses.length;\n                        pendingClauses = [];\n                    }\n                    if (defaultClausesSkipped > 0) {\n                        clausesWritten += defaultClausesSkipped;\n                        defaultClausesSkipped = 0;\n                    }\n                }\n                if (defaultClauseIndex >= 0) {\n                    emitBreak(clauseLabels[defaultClauseIndex]);\n                }\n                else {\n                    emitBreak(endLabel);\n                }\n                for (var i = 0; i < numClauses; i++) {\n                    markLabel(clauseLabels[i]);\n                    transformAndEmitStatements(caseBlock.clauses[i].statements);\n                }\n                endSwitchBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitSwitchStatement(node) {\n            if (inStatementContainingYield) {\n                beginScriptSwitchBlock();\n            }\n            node = ts.visitEachChild(node, visitor, context);\n            if (inStatementContainingYield) {\n                endSwitchBlock();\n            }\n            return node;\n        }\n        function transformAndEmitLabeledStatement(node) {\n            if (containsYield(node)) {\n                beginLabeledBlock(node.label.text);\n                transformAndEmitEmbeddedStatement(node.statement);\n                endLabeledBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitLabeledStatement(node) {\n            if (inStatementContainingYield) {\n                beginScriptLabeledBlock(node.label.text);\n            }\n            node = ts.visitEachChild(node, visitor, context);\n            if (inStatementContainingYield) {\n                endLabeledBlock();\n            }\n            return node;\n        }\n        function transformAndEmitThrowStatement(node) {\n            emitThrow(ts.visitNode(node.expression, visitor, ts.isExpression), node);\n        }\n        function transformAndEmitTryStatement(node) {\n            if (containsYield(node)) {\n                beginExceptionBlock();\n                transformAndEmitEmbeddedStatement(node.tryBlock);\n                if (node.catchClause) {\n                    beginCatchBlock(node.catchClause.variableDeclaration);\n                    transformAndEmitEmbeddedStatement(node.catchClause.block);\n                }\n                if (node.finallyBlock) {\n                    beginFinallyBlock();\n                    transformAndEmitEmbeddedStatement(node.finallyBlock);\n                }\n                endExceptionBlock();\n            }\n            else {\n                emitStatement(ts.visitEachChild(node, visitor, context));\n            }\n        }\n        function containsYield(node) {\n            return node && (node.transformFlags & 16777216) !== 0;\n        }\n        function countInitialNodesWithoutYield(nodes) {\n            var numNodes = nodes.length;\n            for (var i = 0; i < numNodes; i++) {\n                if (containsYield(nodes[i])) {\n                    return i;\n                }\n            }\n            return -1;\n        }\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (emitContext === 1) {\n                return substituteExpression(node);\n            }\n            return node;\n        }\n        function substituteExpression(node) {\n            if (ts.isIdentifier(node)) {\n                return substituteExpressionIdentifier(node);\n            }\n            return node;\n        }\n        function substituteExpressionIdentifier(node) {\n            if (renamedCatchVariables && ts.hasProperty(renamedCatchVariables, node.text)) {\n                var original = ts.getOriginalNode(node);\n                if (ts.isIdentifier(original) && original.parent) {\n                    var declaration = resolver.getReferencedValueDeclaration(original);\n                    if (declaration) {\n                        var name_37 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));\n                        if (name_37) {\n                            var clone_6 = ts.getMutableClone(name_37);\n                            ts.setSourceMapRange(clone_6, node);\n                            ts.setCommentRange(clone_6, node);\n                            return clone_6;\n                        }\n                    }\n                }\n            }\n            return node;\n        }\n        function cacheExpression(node) {\n            var temp;\n            if (ts.isGeneratedIdentifier(node)) {\n                return node;\n            }\n            temp = ts.createTempVariable(hoistVariableDeclaration);\n            emitAssignment(temp, node, node);\n            return temp;\n        }\n        function declareLocal(name) {\n            var temp = name\n                ? ts.createUniqueName(name)\n                : ts.createTempVariable(undefined);\n            hoistVariableDeclaration(temp);\n            return temp;\n        }\n        function defineLabel() {\n            if (!labelOffsets) {\n                labelOffsets = [];\n            }\n            var label = nextLabelId;\n            nextLabelId++;\n            labelOffsets[label] = -1;\n            return label;\n        }\n        function markLabel(label) {\n            ts.Debug.assert(labelOffsets !== undefined, \"No labels were defined.\");\n            labelOffsets[label] = operations ? operations.length : 0;\n        }\n        function beginBlock(block) {\n            if (!blocks) {\n                blocks = [];\n                blockActions = [];\n                blockOffsets = [];\n                blockStack = [];\n            }\n            var index = blockActions.length;\n            blockActions[index] = 0;\n            blockOffsets[index] = operations ? operations.length : 0;\n            blocks[index] = block;\n            blockStack.push(block);\n            return index;\n        }\n        function endBlock() {\n            var block = peekBlock();\n            ts.Debug.assert(block !== undefined, \"beginBlock was never called.\");\n            var index = blockActions.length;\n            blockActions[index] = 1;\n            blockOffsets[index] = operations ? operations.length : 0;\n            blocks[index] = block;\n            blockStack.pop();\n            return block;\n        }\n        function peekBlock() {\n            return ts.lastOrUndefined(blockStack);\n        }\n        function peekBlockKind() {\n            var block = peekBlock();\n            return block && block.kind;\n        }\n        function beginWithBlock(expression) {\n            var startLabel = defineLabel();\n            var endLabel = defineLabel();\n            markLabel(startLabel);\n            beginBlock({\n                kind: 1,\n                expression: expression,\n                startLabel: startLabel,\n                endLabel: endLabel\n            });\n        }\n        function endWithBlock() {\n            ts.Debug.assert(peekBlockKind() === 1);\n            var block = endBlock();\n            markLabel(block.endLabel);\n        }\n        function isWithBlock(block) {\n            return block.kind === 1;\n        }\n        function beginExceptionBlock() {\n            var startLabel = defineLabel();\n            var endLabel = defineLabel();\n            markLabel(startLabel);\n            beginBlock({\n                kind: 0,\n                state: 0,\n                startLabel: startLabel,\n                endLabel: endLabel\n            });\n            emitNop();\n            return endLabel;\n        }\n        function beginCatchBlock(variable) {\n            ts.Debug.assert(peekBlockKind() === 0);\n            var text = variable.name.text;\n            var name = declareLocal(text);\n            if (!renamedCatchVariables) {\n                renamedCatchVariables = ts.createMap();\n                renamedCatchVariableDeclarations = ts.createMap();\n                context.enableSubstitution(70);\n            }\n            renamedCatchVariables[text] = true;\n            renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name;\n            var exception = peekBlock();\n            ts.Debug.assert(exception.state < 1);\n            var endLabel = exception.endLabel;\n            emitBreak(endLabel);\n            var catchLabel = defineLabel();\n            markLabel(catchLabel);\n            exception.state = 1;\n            exception.catchVariable = name;\n            exception.catchLabel = catchLabel;\n            emitAssignment(name, ts.createCall(ts.createPropertyAccess(state, \"sent\"), undefined, []));\n            emitNop();\n        }\n        function beginFinallyBlock() {\n            ts.Debug.assert(peekBlockKind() === 0);\n            var exception = peekBlock();\n            ts.Debug.assert(exception.state < 2);\n            var endLabel = exception.endLabel;\n            emitBreak(endLabel);\n            var finallyLabel = defineLabel();\n            markLabel(finallyLabel);\n            exception.state = 2;\n            exception.finallyLabel = finallyLabel;\n        }\n        function endExceptionBlock() {\n            ts.Debug.assert(peekBlockKind() === 0);\n            var exception = endBlock();\n            var state = exception.state;\n            if (state < 2) {\n                emitBreak(exception.endLabel);\n            }\n            else {\n                emitEndfinally();\n            }\n            markLabel(exception.endLabel);\n            emitNop();\n            exception.state = 3;\n        }\n        function isExceptionBlock(block) {\n            return block.kind === 0;\n        }\n        function beginScriptLoopBlock() {\n            beginBlock({\n                kind: 3,\n                isScript: true,\n                breakLabel: -1,\n                continueLabel: -1\n            });\n        }\n        function beginLoopBlock(continueLabel) {\n            var breakLabel = defineLabel();\n            beginBlock({\n                kind: 3,\n                isScript: false,\n                breakLabel: breakLabel,\n                continueLabel: continueLabel\n            });\n            return breakLabel;\n        }\n        function endLoopBlock() {\n            ts.Debug.assert(peekBlockKind() === 3);\n            var block = endBlock();\n            var breakLabel = block.breakLabel;\n            if (!block.isScript) {\n                markLabel(breakLabel);\n            }\n        }\n        function beginScriptSwitchBlock() {\n            beginBlock({\n                kind: 2,\n                isScript: true,\n                breakLabel: -1\n            });\n        }\n        function beginSwitchBlock() {\n            var breakLabel = defineLabel();\n            beginBlock({\n                kind: 2,\n                isScript: false,\n                breakLabel: breakLabel\n            });\n            return breakLabel;\n        }\n        function endSwitchBlock() {\n            ts.Debug.assert(peekBlockKind() === 2);\n            var block = endBlock();\n            var breakLabel = block.breakLabel;\n            if (!block.isScript) {\n                markLabel(breakLabel);\n            }\n        }\n        function beginScriptLabeledBlock(labelText) {\n            beginBlock({\n                kind: 4,\n                isScript: true,\n                labelText: labelText,\n                breakLabel: -1\n            });\n        }\n        function beginLabeledBlock(labelText) {\n            var breakLabel = defineLabel();\n            beginBlock({\n                kind: 4,\n                isScript: false,\n                labelText: labelText,\n                breakLabel: breakLabel\n            });\n        }\n        function endLabeledBlock() {\n            ts.Debug.assert(peekBlockKind() === 4);\n            var block = endBlock();\n            if (!block.isScript) {\n                markLabel(block.breakLabel);\n            }\n        }\n        function supportsUnlabeledBreak(block) {\n            return block.kind === 2\n                || block.kind === 3;\n        }\n        function supportsLabeledBreakOrContinue(block) {\n            return block.kind === 4;\n        }\n        function supportsUnlabeledContinue(block) {\n            return block.kind === 3;\n        }\n        function hasImmediateContainingLabeledBlock(labelText, start) {\n            for (var j = start; j >= 0; j--) {\n                var containingBlock = blockStack[j];\n                if (supportsLabeledBreakOrContinue(containingBlock)) {\n                    if (containingBlock.labelText === labelText) {\n                        return true;\n                    }\n                }\n                else {\n                    break;\n                }\n            }\n            return false;\n        }\n        function findBreakTarget(labelText) {\n            ts.Debug.assert(blocks !== undefined);\n            if (labelText) {\n                for (var i = blockStack.length - 1; i >= 0; i--) {\n                    var block = blockStack[i];\n                    if (supportsLabeledBreakOrContinue(block) && block.labelText === labelText) {\n                        return block.breakLabel;\n                    }\n                    else if (supportsUnlabeledBreak(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) {\n                        return block.breakLabel;\n                    }\n                }\n            }\n            else {\n                for (var i = blockStack.length - 1; i >= 0; i--) {\n                    var block = blockStack[i];\n                    if (supportsUnlabeledBreak(block)) {\n                        return block.breakLabel;\n                    }\n                }\n            }\n            return 0;\n        }\n        function findContinueTarget(labelText) {\n            ts.Debug.assert(blocks !== undefined);\n            if (labelText) {\n                for (var i = blockStack.length - 1; i >= 0; i--) {\n                    var block = blockStack[i];\n                    if (supportsUnlabeledContinue(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) {\n                        return block.continueLabel;\n                    }\n                }\n            }\n            else {\n                for (var i = blockStack.length - 1; i >= 0; i--) {\n                    var block = blockStack[i];\n                    if (supportsUnlabeledContinue(block)) {\n                        return block.continueLabel;\n                    }\n                }\n            }\n            return 0;\n        }\n        function createLabel(label) {\n            if (label > 0) {\n                if (labelExpressions === undefined) {\n                    labelExpressions = [];\n                }\n                var expression = ts.createLiteral(-1);\n                if (labelExpressions[label] === undefined) {\n                    labelExpressions[label] = [expression];\n                }\n                else {\n                    labelExpressions[label].push(expression);\n                }\n                return expression;\n            }\n            return ts.createOmittedExpression();\n        }\n        function createInstruction(instruction) {\n            var literal = ts.createLiteral(instruction);\n            literal.trailingComment = instructionNames[instruction];\n            return literal;\n        }\n        function createInlineBreak(label, location) {\n            ts.Debug.assert(label > 0, \"Invalid label: \" + label);\n            return ts.createReturn(ts.createArrayLiteral([\n                createInstruction(3),\n                createLabel(label)\n            ]), location);\n        }\n        function createInlineReturn(expression, location) {\n            return ts.createReturn(ts.createArrayLiteral(expression\n                ? [createInstruction(2), expression]\n                : [createInstruction(2)]), location);\n        }\n        function createGeneratorResume(location) {\n            return ts.createCall(ts.createPropertyAccess(state, \"sent\"), undefined, [], location);\n        }\n        function emitNop() {\n            emitWorker(0);\n        }\n        function emitStatement(node) {\n            if (node) {\n                emitWorker(1, [node]);\n            }\n            else {\n                emitNop();\n            }\n        }\n        function emitAssignment(left, right, location) {\n            emitWorker(2, [left, right], location);\n        }\n        function emitBreak(label, location) {\n            emitWorker(3, [label], location);\n        }\n        function emitBreakWhenTrue(label, condition, location) {\n            emitWorker(4, [label, condition], location);\n        }\n        function emitBreakWhenFalse(label, condition, location) {\n            emitWorker(5, [label, condition], location);\n        }\n        function emitYieldStar(expression, location) {\n            emitWorker(7, [expression], location);\n        }\n        function emitYield(expression, location) {\n            emitWorker(6, [expression], location);\n        }\n        function emitReturn(expression, location) {\n            emitWorker(8, [expression], location);\n        }\n        function emitThrow(expression, location) {\n            emitWorker(9, [expression], location);\n        }\n        function emitEndfinally() {\n            emitWorker(10);\n        }\n        function emitWorker(code, args, location) {\n            if (operations === undefined) {\n                operations = [];\n                operationArguments = [];\n                operationLocations = [];\n            }\n            if (labelOffsets === undefined) {\n                markLabel(defineLabel());\n            }\n            var operationIndex = operations.length;\n            operations[operationIndex] = code;\n            operationArguments[operationIndex] = args;\n            operationLocations[operationIndex] = location;\n        }\n        function build() {\n            blockIndex = 0;\n            labelNumber = 0;\n            labelNumbers = undefined;\n            lastOperationWasAbrupt = false;\n            lastOperationWasCompletion = false;\n            clauses = undefined;\n            statements = undefined;\n            exceptionBlockStack = undefined;\n            currentExceptionBlock = undefined;\n            withBlockStack = undefined;\n            var buildResult = buildStatements();\n            return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 262144));\n        }\n        function buildStatements() {\n            if (operations) {\n                for (var operationIndex = 0; operationIndex < operations.length; operationIndex++) {\n                    writeOperation(operationIndex);\n                }\n                flushFinalLabel(operations.length);\n            }\n            else {\n                flushFinalLabel(0);\n            }\n            if (clauses) {\n                var labelExpression = ts.createPropertyAccess(state, \"label\");\n                var switchStatement = ts.createSwitch(labelExpression, ts.createCaseBlock(clauses));\n                switchStatement.startsOnNewLine = true;\n                return [switchStatement];\n            }\n            if (statements) {\n                return statements;\n            }\n            return [];\n        }\n        function flushLabel() {\n            if (!statements) {\n                return;\n            }\n            appendLabel(!lastOperationWasAbrupt);\n            lastOperationWasAbrupt = false;\n            lastOperationWasCompletion = false;\n            labelNumber++;\n        }\n        function flushFinalLabel(operationIndex) {\n            if (isFinalLabelReachable(operationIndex)) {\n                tryEnterLabel(operationIndex);\n                withBlockStack = undefined;\n                writeReturn(undefined, undefined);\n            }\n            if (statements && clauses) {\n                appendLabel(false);\n            }\n            updateLabelExpressions();\n        }\n        function isFinalLabelReachable(operationIndex) {\n            if (!lastOperationWasCompletion) {\n                return true;\n            }\n            if (!labelOffsets || !labelExpressions) {\n                return false;\n            }\n            for (var label = 0; label < labelOffsets.length; label++) {\n                if (labelOffsets[label] === operationIndex && labelExpressions[label]) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function appendLabel(markLabelEnd) {\n            if (!clauses) {\n                clauses = [];\n            }\n            if (statements) {\n                if (withBlockStack) {\n                    for (var i = withBlockStack.length - 1; i >= 0; i--) {\n                        var withBlock = withBlockStack[i];\n                        statements = [ts.createWith(withBlock.expression, ts.createBlock(statements))];\n                    }\n                }\n                if (currentExceptionBlock) {\n                    var startLabel = currentExceptionBlock.startLabel, catchLabel = currentExceptionBlock.catchLabel, finallyLabel = currentExceptionBlock.finallyLabel, endLabel = currentExceptionBlock.endLabel;\n                    statements.unshift(ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createPropertyAccess(state, \"trys\"), \"push\"), undefined, [\n                        ts.createArrayLiteral([\n                            createLabel(startLabel),\n                            createLabel(catchLabel),\n                            createLabel(finallyLabel),\n                            createLabel(endLabel)\n                        ])\n                    ])));\n                    currentExceptionBlock = undefined;\n                }\n                if (markLabelEnd) {\n                    statements.push(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(state, \"label\"), ts.createLiteral(labelNumber + 1))));\n                }\n            }\n            clauses.push(ts.createCaseClause(ts.createLiteral(labelNumber), statements || []));\n            statements = undefined;\n        }\n        function tryEnterLabel(operationIndex) {\n            if (!labelOffsets) {\n                return;\n            }\n            for (var label = 0; label < labelOffsets.length; label++) {\n                if (labelOffsets[label] === operationIndex) {\n                    flushLabel();\n                    if (labelNumbers === undefined) {\n                        labelNumbers = [];\n                    }\n                    if (labelNumbers[labelNumber] === undefined) {\n                        labelNumbers[labelNumber] = [label];\n                    }\n                    else {\n                        labelNumbers[labelNumber].push(label);\n                    }\n                }\n            }\n        }\n        function updateLabelExpressions() {\n            if (labelExpressions !== undefined && labelNumbers !== undefined) {\n                for (var labelNumber_1 = 0; labelNumber_1 < labelNumbers.length; labelNumber_1++) {\n                    var labels = labelNumbers[labelNumber_1];\n                    if (labels !== undefined) {\n                        for (var _i = 0, labels_1 = labels; _i < labels_1.length; _i++) {\n                            var label = labels_1[_i];\n                            var expressions = labelExpressions[label];\n                            if (expressions !== undefined) {\n                                for (var _a = 0, expressions_1 = expressions; _a < expressions_1.length; _a++) {\n                                    var expression = expressions_1[_a];\n                                    expression.text = String(labelNumber_1);\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        function tryEnterOrLeaveBlock(operationIndex) {\n            if (blocks) {\n                for (; blockIndex < blockActions.length && blockOffsets[blockIndex] <= operationIndex; blockIndex++) {\n                    var block = blocks[blockIndex];\n                    var blockAction = blockActions[blockIndex];\n                    if (isExceptionBlock(block)) {\n                        if (blockAction === 0) {\n                            if (!exceptionBlockStack) {\n                                exceptionBlockStack = [];\n                            }\n                            if (!statements) {\n                                statements = [];\n                            }\n                            exceptionBlockStack.push(currentExceptionBlock);\n                            currentExceptionBlock = block;\n                        }\n                        else if (blockAction === 1) {\n                            currentExceptionBlock = exceptionBlockStack.pop();\n                        }\n                    }\n                    else if (isWithBlock(block)) {\n                        if (blockAction === 0) {\n                            if (!withBlockStack) {\n                                withBlockStack = [];\n                            }\n                            withBlockStack.push(block);\n                        }\n                        else if (blockAction === 1) {\n                            withBlockStack.pop();\n                        }\n                    }\n                }\n            }\n        }\n        function writeOperation(operationIndex) {\n            tryEnterLabel(operationIndex);\n            tryEnterOrLeaveBlock(operationIndex);\n            if (lastOperationWasAbrupt) {\n                return;\n            }\n            lastOperationWasAbrupt = false;\n            lastOperationWasCompletion = false;\n            var opcode = operations[operationIndex];\n            if (opcode === 0) {\n                return;\n            }\n            else if (opcode === 10) {\n                return writeEndfinally();\n            }\n            var args = operationArguments[operationIndex];\n            if (opcode === 1) {\n                return writeStatement(args[0]);\n            }\n            var location = operationLocations[operationIndex];\n            switch (opcode) {\n                case 2:\n                    return writeAssign(args[0], args[1], location);\n                case 3:\n                    return writeBreak(args[0], location);\n                case 4:\n                    return writeBreakWhenTrue(args[0], args[1], location);\n                case 5:\n                    return writeBreakWhenFalse(args[0], args[1], location);\n                case 6:\n                    return writeYield(args[0], location);\n                case 7:\n                    return writeYieldStar(args[0], location);\n                case 8:\n                    return writeReturn(args[0], location);\n                case 9:\n                    return writeThrow(args[0], location);\n            }\n        }\n        function writeStatement(statement) {\n            if (statement) {\n                if (!statements) {\n                    statements = [statement];\n                }\n                else {\n                    statements.push(statement);\n                }\n            }\n        }\n        function writeAssign(left, right, operationLocation) {\n            writeStatement(ts.createStatement(ts.createAssignment(left, right), operationLocation));\n        }\n        function writeThrow(expression, operationLocation) {\n            lastOperationWasAbrupt = true;\n            lastOperationWasCompletion = true;\n            writeStatement(ts.createThrow(expression, operationLocation));\n        }\n        function writeReturn(expression, operationLocation) {\n            lastOperationWasAbrupt = true;\n            lastOperationWasCompletion = true;\n            writeStatement(ts.createReturn(ts.createArrayLiteral(expression\n                ? [createInstruction(2), expression]\n                : [createInstruction(2)]), operationLocation));\n        }\n        function writeBreak(label, operationLocation) {\n            lastOperationWasAbrupt = true;\n            writeStatement(ts.createReturn(ts.createArrayLiteral([\n                createInstruction(3),\n                createLabel(label)\n            ]), operationLocation));\n        }\n        function writeBreakWhenTrue(label, condition, operationLocation) {\n            writeStatement(ts.createIf(condition, ts.createReturn(ts.createArrayLiteral([\n                createInstruction(3),\n                createLabel(label)\n            ]), operationLocation)));\n        }\n        function writeBreakWhenFalse(label, condition, operationLocation) {\n            writeStatement(ts.createIf(ts.createLogicalNot(condition), ts.createReturn(ts.createArrayLiteral([\n                createInstruction(3),\n                createLabel(label)\n            ]), operationLocation)));\n        }\n        function writeYield(expression, operationLocation) {\n            lastOperationWasAbrupt = true;\n            writeStatement(ts.createReturn(ts.createArrayLiteral(expression\n                ? [createInstruction(4), expression]\n                : [createInstruction(4)]), operationLocation));\n        }\n        function writeYieldStar(expression, operationLocation) {\n            lastOperationWasAbrupt = true;\n            writeStatement(ts.createReturn(ts.createArrayLiteral([\n                createInstruction(5),\n                expression\n            ]), operationLocation));\n        }\n        function writeEndfinally() {\n            lastOperationWasAbrupt = true;\n            writeStatement(ts.createReturn(ts.createArrayLiteral([\n                createInstruction(7)\n            ])));\n        }\n    }\n    ts.transformGenerators = transformGenerators;\n    function createGeneratorHelper(context, body) {\n        context.requestEmitHelper(generatorHelper);\n        return ts.createCall(ts.getHelperName(\"__generator\"), undefined, [ts.createThis(), body]);\n    }\n    var generatorHelper = {\n        name: \"typescript:generator\",\n        scoped: false,\n        priority: 6,\n        text: \"\\n            var __generator = (this && this.__generator) || function (thisArg, body) {\\n                var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\\n                return { next: verb(0), \\\"throw\\\": verb(1), \\\"return\\\": verb(2) };\\n                function verb(n) { return function (v) { return step([n, v]); }; }\\n                function step(op) {\\n                    if (f) throw new TypeError(\\\"Generator is already executing.\\\");\\n                    while (_) try {\\n                        if (f = 1, y && (t = y[op[0] & 2 ? \\\"return\\\" : op[0] ? \\\"throw\\\" : \\\"next\\\"]) && !(t = t.call(y, op[1])).done) return t;\\n                        if (y = 0, t) op = [0, t.value];\\n                        switch (op[0]) {\\n                            case 0: case 1: t = op; break;\\n                            case 4: _.label++; return { value: op[1], done: false };\\n                            case 5: _.label++; y = op[1]; op = [0]; continue;\\n                            case 7: op = _.ops.pop(); _.trys.pop(); continue;\\n                            default:\\n                                if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\\n                                if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\\n                                if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\\n                                if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\\n                                if (t[2]) _.ops.pop();\\n                                _.trys.pop(); continue;\\n                        }\\n                        op = body.call(thisArg, _);\\n                    } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\\n                    if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\\n                }\\n            };\"\n    };\n    var _a;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformES5(context) {\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        context.onSubstituteNode = onSubstituteNode;\n        context.enableSubstitution(177);\n        context.enableSubstitution(257);\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            return node;\n        }\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (ts.isPropertyAccessExpression(node)) {\n                return substitutePropertyAccessExpression(node);\n            }\n            else if (ts.isPropertyAssignment(node)) {\n                return substitutePropertyAssignment(node);\n            }\n            return node;\n        }\n        function substitutePropertyAccessExpression(node) {\n            var literalName = trySubstituteReservedName(node.name);\n            if (literalName) {\n                return ts.createElementAccess(node.expression, literalName, node);\n            }\n            return node;\n        }\n        function substitutePropertyAssignment(node) {\n            var literalName = ts.isIdentifier(node.name) && trySubstituteReservedName(node.name);\n            if (literalName) {\n                return ts.updatePropertyAssignment(node, literalName, node.initializer);\n            }\n            return node;\n        }\n        function trySubstituteReservedName(name) {\n            var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(name.text) : undefined);\n            if (token >= 71 && token <= 106) {\n                return ts.createLiteral(name, name);\n            }\n            return undefined;\n        }\n    }\n    ts.transformES5 = transformES5;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformES2015Module(context) {\n        var compilerOptions = context.getCompilerOptions();\n        var previousOnEmitNode = context.onEmitNode;\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        context.onEmitNode = onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        context.enableEmitNotification(261);\n        context.enableSubstitution(70);\n        var currentSourceFile;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {\n                var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions);\n                if (externalHelpersModuleName) {\n                    var statements = [];\n                    var statementOffset = ts.addPrologueDirectives(statements, node.statements);\n                    ts.append(statements, ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)));\n                    ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));\n                    return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));\n                }\n                else {\n                    return ts.visitEachChild(node, visitor, context);\n                }\n            }\n            return node;\n        }\n        function visitor(node) {\n            switch (node.kind) {\n                case 234:\n                    return undefined;\n                case 240:\n                    return visitExportAssignment(node);\n            }\n            return node;\n        }\n        function visitExportAssignment(node) {\n            return node.isExportEquals ? undefined : node;\n        }\n        function onEmitNode(emitContext, node, emitCallback) {\n            if (ts.isSourceFile(node)) {\n                currentSourceFile = node;\n                previousOnEmitNode(emitContext, node, emitCallback);\n                currentSourceFile = undefined;\n            }\n            else {\n                previousOnEmitNode(emitContext, node, emitCallback);\n            }\n        }\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (ts.isIdentifier(node) && emitContext === 1) {\n                return substituteExpressionIdentifier(node);\n            }\n            return node;\n        }\n        function substituteExpressionIdentifier(node) {\n            if (ts.getEmitFlags(node) & 4096) {\n                var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);\n                if (externalHelpersModuleName) {\n                    return ts.createPropertyAccess(externalHelpersModuleName, node);\n                }\n            }\n            return node;\n        }\n    }\n    ts.transformES2015Module = transformES2015Module;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformSystemModule(context) {\n        var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;\n        var compilerOptions = context.getCompilerOptions();\n        var resolver = context.getEmitResolver();\n        var host = context.getEmitHost();\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        var previousOnEmitNode = context.onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        context.onEmitNode = onEmitNode;\n        context.enableSubstitution(70);\n        context.enableSubstitution(192);\n        context.enableSubstitution(190);\n        context.enableSubstitution(191);\n        context.enableEmitNotification(261);\n        var moduleInfoMap = ts.createMap();\n        var deferredExports = ts.createMap();\n        var exportFunctionsMap = ts.createMap();\n        var noSubstitutionMap = ts.createMap();\n        var currentSourceFile;\n        var moduleInfo;\n        var exportFunction;\n        var contextObject;\n        var hoistedStatements;\n        var enclosingBlockScopedContainer;\n        var noSubstitution;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)\n                || !(ts.isExternalModule(node)\n                    || compilerOptions.isolatedModules)) {\n                return node;\n            }\n            var id = ts.getOriginalNodeId(node);\n            currentSourceFile = node;\n            enclosingBlockScopedContainer = node;\n            moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions);\n            exportFunction = exportFunctionsMap[id] = ts.createUniqueName(\"exports\");\n            contextObject = ts.createUniqueName(\"context\");\n            var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports);\n            var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups);\n            var moduleBodyFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [\n                ts.createParameter(undefined, undefined, undefined, exportFunction),\n                ts.createParameter(undefined, undefined, undefined, contextObject)\n            ], undefined, moduleBodyBlock);\n            var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);\n            var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; }));\n            var updated = ts.updateSourceFileNode(node, ts.createNodeArray([\n                ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier(\"System\"), \"register\"), undefined, moduleName\n                    ? [moduleName, dependencies, moduleBodyFunction]\n                    : [dependencies, moduleBodyFunction]))\n            ], node.statements));\n            if (!(compilerOptions.outFile || compilerOptions.out)) {\n                ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; });\n            }\n            if (noSubstitution) {\n                noSubstitutionMap[id] = noSubstitution;\n                noSubstitution = undefined;\n            }\n            currentSourceFile = undefined;\n            moduleInfo = undefined;\n            exportFunction = undefined;\n            contextObject = undefined;\n            hoistedStatements = undefined;\n            enclosingBlockScopedContainer = undefined;\n            return ts.aggregateTransformFlags(updated);\n        }\n        function collectDependencyGroups(externalImports) {\n            var groupIndices = ts.createMap();\n            var dependencyGroups = [];\n            for (var i = 0; i < externalImports.length; i++) {\n                var externalImport = externalImports[i];\n                var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions);\n                var text = externalModuleName.text;\n                if (ts.hasProperty(groupIndices, text)) {\n                    var groupIndex = groupIndices[text];\n                    dependencyGroups[groupIndex].externalImports.push(externalImport);\n                }\n                else {\n                    groupIndices[text] = dependencyGroups.length;\n                    dependencyGroups.push({\n                        name: externalModuleName,\n                        externalImports: [externalImport]\n                    });\n                }\n            }\n            return dependencyGroups;\n        }\n        function createSystemModuleBody(node, dependencyGroups) {\n            var statements = [];\n            startLexicalEnvironment();\n            var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor);\n            statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(\"__moduleName\", undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, \"id\")))\n            ])));\n            ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true);\n            var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset);\n            ts.addRange(statements, hoistedStatements);\n            ts.addRange(statements, endLexicalEnvironment());\n            var exportStarFunction = addExportStarIfNeeded(statements);\n            statements.push(ts.createReturn(ts.setMultiLine(ts.createObjectLiteral([\n                ts.createPropertyAssignment(\"setters\", createSettersArray(exportStarFunction, dependencyGroups)),\n                ts.createPropertyAssignment(\"execute\", ts.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, undefined, true)))\n            ]), true)));\n            return ts.createBlock(statements, undefined, true);\n        }\n        function addExportStarIfNeeded(statements) {\n            if (!moduleInfo.hasExportStarsToExportValues) {\n                return;\n            }\n            if (!moduleInfo.exportedNames && ts.isEmpty(moduleInfo.exportSpecifiers)) {\n                var hasExportDeclarationWithExportClause = false;\n                for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) {\n                    var externalImport = _a[_i];\n                    if (externalImport.kind === 241 && externalImport.exportClause) {\n                        hasExportDeclarationWithExportClause = true;\n                        break;\n                    }\n                }\n                if (!hasExportDeclarationWithExportClause) {\n                    var exportStarFunction_1 = createExportStarFunction(undefined);\n                    statements.push(exportStarFunction_1);\n                    return exportStarFunction_1.name;\n                }\n            }\n            var exportedNames = [];\n            if (moduleInfo.exportedNames) {\n                for (var _b = 0, _c = moduleInfo.exportedNames; _b < _c.length; _b++) {\n                    var exportedLocalName = _c[_b];\n                    if (exportedLocalName.text === \"default\") {\n                        continue;\n                    }\n                    exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName), ts.createLiteral(true)));\n                }\n            }\n            for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) {\n                var externalImport = _e[_d];\n                if (externalImport.kind !== 241) {\n                    continue;\n                }\n                var exportDecl = externalImport;\n                if (!exportDecl.exportClause) {\n                    continue;\n                }\n                for (var _f = 0, _g = exportDecl.exportClause.elements; _f < _g.length; _f++) {\n                    var element = _g[_f];\n                    exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createLiteral(true)));\n                }\n            }\n            var exportedNamesStorageRef = ts.createUniqueName(\"exportedNames\");\n            statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(exportedNamesStorageRef, undefined, ts.createObjectLiteral(exportedNames, undefined, true))\n            ])));\n            var exportStarFunction = createExportStarFunction(exportedNamesStorageRef);\n            statements.push(exportStarFunction);\n            return exportStarFunction.name;\n        }\n        function createExportStarFunction(localNames) {\n            var exportStarFunction = ts.createUniqueName(\"exportStar\");\n            var m = ts.createIdentifier(\"m\");\n            var n = ts.createIdentifier(\"n\");\n            var exports = ts.createIdentifier(\"exports\");\n            var condition = ts.createStrictInequality(n, ts.createLiteral(\"default\"));\n            if (localNames) {\n                condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, \"hasOwnProperty\"), undefined, [n])));\n            }\n            return ts.createFunctionDeclaration(undefined, undefined, undefined, exportStarFunction, undefined, [ts.createParameter(undefined, undefined, undefined, m)], undefined, ts.createBlock([\n                ts.createVariableStatement(undefined, ts.createVariableDeclarationList([\n                    ts.createVariableDeclaration(exports, undefined, ts.createObjectLiteral([]))\n                ])),\n                ts.createForIn(ts.createVariableDeclarationList([\n                    ts.createVariableDeclaration(n, undefined)\n                ]), m, ts.createBlock([\n                    ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1)\n                ])),\n                ts.createStatement(ts.createCall(exportFunction, undefined, [exports]))\n            ], undefined, true));\n        }\n        function createSettersArray(exportStarFunction, dependencyGroups) {\n            var setters = [];\n            for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) {\n                var group = dependencyGroups_1[_i];\n                var localName = ts.forEach(group.externalImports, function (i) { return ts.getLocalNameForExternalImport(i, currentSourceFile); });\n                var parameterName = localName ? ts.getGeneratedNameForNode(localName) : ts.createUniqueName(\"\");\n                var statements = [];\n                for (var _a = 0, _b = group.externalImports; _a < _b.length; _a++) {\n                    var entry = _b[_a];\n                    var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile);\n                    switch (entry.kind) {\n                        case 235:\n                            if (!entry.importClause) {\n                                break;\n                            }\n                        case 234:\n                            ts.Debug.assert(importVariableName !== undefined);\n                            statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName)));\n                            break;\n                        case 241:\n                            ts.Debug.assert(importVariableName !== undefined);\n                            if (entry.exportClause) {\n                                var properties = [];\n                                for (var _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) {\n                                    var e = _d[_c];\n                                    properties.push(ts.createPropertyAssignment(ts.createLiteral(e.name.text), ts.createElementAccess(parameterName, ts.createLiteral((e.propertyName || e.name).text))));\n                                }\n                                statements.push(ts.createStatement(ts.createCall(exportFunction, undefined, [ts.createObjectLiteral(properties, undefined, true)])));\n                            }\n                            else {\n                                statements.push(ts.createStatement(ts.createCall(exportStarFunction, undefined, [parameterName])));\n                            }\n                            break;\n                    }\n                }\n                setters.push(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, ts.createBlock(statements, undefined, true)));\n            }\n            return ts.createArrayLiteral(setters, undefined, true);\n        }\n        function sourceElementVisitor(node) {\n            switch (node.kind) {\n                case 235:\n                    return visitImportDeclaration(node);\n                case 234:\n                    return visitImportEqualsDeclaration(node);\n                case 241:\n                    return undefined;\n                case 240:\n                    return visitExportAssignment(node);\n                default:\n                    return nestedElementVisitor(node);\n            }\n        }\n        function visitImportDeclaration(node) {\n            var statements;\n            if (node.importClause) {\n                hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile));\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfImportDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function visitImportEqualsDeclaration(node) {\n            ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), \"import= for internal module references should be handled in an earlier transformer.\");\n            var statements;\n            hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile));\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfImportEqualsDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function visitExportAssignment(node) {\n            if (node.isExportEquals) {\n                return undefined;\n            }\n            var expression = ts.visitNode(node.expression, destructuringVisitor, ts.isExpression);\n            var original = node.original;\n            if (original && hasAssociatedEndOfDeclarationMarker(original)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier(\"default\"), expression, true);\n            }\n            else {\n                return createExportStatement(ts.createIdentifier(\"default\"), expression, true);\n            }\n        }\n        function visitFunctionDeclaration(node) {\n            if (ts.hasModifier(node, 1)) {\n                hoistedStatements = ts.append(hoistedStatements, ts.updateFunctionDeclaration(node, node.decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, true, true), undefined, ts.visitNodes(node.parameters, destructuringVisitor, ts.isParameterDeclaration), undefined, ts.visitNode(node.body, destructuringVisitor, ts.isBlock)));\n            }\n            else {\n                hoistedStatements = ts.append(hoistedStatements, node);\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);\n            }\n            else {\n                hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node);\n            }\n            return undefined;\n        }\n        function visitClassDeclaration(node) {\n            var statements;\n            var name = ts.getLocalName(node);\n            hoistVariableDeclaration(name);\n            statements = ts.append(statements, ts.createStatement(ts.createAssignment(name, ts.createClassExpression(undefined, node.name, undefined, ts.visitNodes(node.heritageClauses, destructuringVisitor, ts.isHeritageClause), ts.visitNodes(node.members, destructuringVisitor, ts.isClassElement), node)), node));\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfHoistedDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function visitVariableStatement(node) {\n            if (!shouldHoistVariableDeclarationList(node.declarationList)) {\n                return ts.visitNode(node, destructuringVisitor, ts.isStatement);\n            }\n            var expressions;\n            var isExportedDeclaration = ts.hasModifier(node, 1);\n            var isMarkedDeclaration = hasAssociatedEndOfDeclarationMarker(node);\n            for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                var variable = _a[_i];\n                if (variable.initializer) {\n                    expressions = ts.append(expressions, transformInitializedVariable(variable, isExportedDeclaration && !isMarkedDeclaration));\n                }\n                else {\n                    hoistBindingElement(variable);\n                }\n            }\n            var statements;\n            if (expressions) {\n                statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), node));\n            }\n            if (isMarkedDeclaration) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration);\n            }\n            else {\n                statements = appendExportsOfVariableStatement(statements, node, false);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function hoistBindingElement(node) {\n            if (ts.isBindingPattern(node.name)) {\n                for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        hoistBindingElement(element);\n                    }\n                }\n            }\n            else {\n                hoistVariableDeclaration(ts.getSynthesizedClone(node.name));\n            }\n        }\n        function shouldHoistVariableDeclarationList(node) {\n            return (ts.getEmitFlags(node) & 1048576) === 0\n                && (enclosingBlockScopedContainer.kind === 261\n                    || (ts.getOriginalNode(node).flags & 3) === 0);\n        }\n        function transformInitializedVariable(node, isExportedDeclaration) {\n            var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment;\n            return ts.isBindingPattern(node.name)\n                ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, false, createAssignment)\n                : createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression));\n        }\n        function createExportedVariableAssignment(name, value, location) {\n            return createVariableAssignment(name, value, location, true);\n        }\n        function createNonExportedVariableAssignment(name, value, location) {\n            return createVariableAssignment(name, value, location, false);\n        }\n        function createVariableAssignment(name, value, location, isExportedDeclaration) {\n            hoistVariableDeclaration(ts.getSynthesizedClone(name));\n            return isExportedDeclaration\n                ? createExportExpression(name, preventSubstitution(ts.createAssignment(name, value, location)))\n                : preventSubstitution(ts.createAssignment(name, value, location));\n        }\n        function visitMergeDeclarationMarker(node) {\n            if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205) {\n                var id = ts.getOriginalNodeId(node);\n                var isExportedDeclaration = ts.hasModifier(node.original, 1);\n                deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration);\n            }\n            return node;\n        }\n        function hasAssociatedEndOfDeclarationMarker(node) {\n            return (ts.getEmitFlags(node) & 2097152) !== 0;\n        }\n        function visitEndOfDeclarationMarker(node) {\n            var id = ts.getOriginalNodeId(node);\n            var statements = deferredExports[id];\n            if (statements) {\n                delete deferredExports[id];\n                return ts.append(statements, node);\n            }\n            return node;\n        }\n        function appendExportsOfImportDeclaration(statements, decl) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            var importClause = decl.importClause;\n            if (!importClause) {\n                return statements;\n            }\n            if (importClause.name) {\n                statements = appendExportsOfDeclaration(statements, importClause);\n            }\n            var namedBindings = importClause.namedBindings;\n            if (namedBindings) {\n                switch (namedBindings.kind) {\n                    case 237:\n                        statements = appendExportsOfDeclaration(statements, namedBindings);\n                        break;\n                    case 238:\n                        for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {\n                            var importBinding = _a[_i];\n                            statements = appendExportsOfDeclaration(statements, importBinding);\n                        }\n                        break;\n                }\n            }\n            return statements;\n        }\n        function appendExportsOfImportEqualsDeclaration(statements, decl) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            return appendExportsOfDeclaration(statements, decl);\n        }\n        function appendExportsOfVariableStatement(statements, node, exportSelf) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                var decl = _a[_i];\n                if (decl.initializer || exportSelf) {\n                    statements = appendExportsOfBindingElement(statements, decl, exportSelf);\n                }\n            }\n            return statements;\n        }\n        function appendExportsOfBindingElement(statements, decl, exportSelf) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            if (ts.isBindingPattern(decl.name)) {\n                for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        statements = appendExportsOfBindingElement(statements, element, exportSelf);\n                    }\n                }\n            }\n            else if (!ts.isGeneratedIdentifier(decl.name)) {\n                var excludeName = void 0;\n                if (exportSelf) {\n                    statements = appendExportStatement(statements, decl.name, ts.getLocalName(decl));\n                    excludeName = decl.name.text;\n                }\n                statements = appendExportsOfDeclaration(statements, decl, excludeName);\n            }\n            return statements;\n        }\n        function appendExportsOfHoistedDeclaration(statements, decl) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            var excludeName;\n            if (ts.hasModifier(decl, 1)) {\n                var exportName = ts.hasModifier(decl, 512) ? ts.createLiteral(\"default\") : decl.name;\n                statements = appendExportStatement(statements, exportName, ts.getLocalName(decl));\n                excludeName = exportName.text;\n            }\n            if (decl.name) {\n                statements = appendExportsOfDeclaration(statements, decl, excludeName);\n            }\n            return statements;\n        }\n        function appendExportsOfDeclaration(statements, decl, excludeName) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            var name = ts.getDeclarationName(decl);\n            var exportSpecifiers = moduleInfo.exportSpecifiers[name.text];\n            if (exportSpecifiers) {\n                for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) {\n                    var exportSpecifier = exportSpecifiers_1[_i];\n                    if (exportSpecifier.name.text !== excludeName) {\n                        statements = appendExportStatement(statements, exportSpecifier.name, name);\n                    }\n                }\n            }\n            return statements;\n        }\n        function appendExportStatement(statements, exportName, expression, allowComments) {\n            statements = ts.append(statements, createExportStatement(exportName, expression, allowComments));\n            return statements;\n        }\n        function createExportStatement(name, value, allowComments) {\n            var statement = ts.createStatement(createExportExpression(name, value));\n            ts.startOnNewLine(statement);\n            if (!allowComments) {\n                ts.setEmitFlags(statement, 1536);\n            }\n            return statement;\n        }\n        function createExportExpression(name, value) {\n            var exportName = ts.isIdentifier(name) ? ts.createLiteral(name) : name;\n            return ts.createCall(exportFunction, undefined, [exportName, value]);\n        }\n        function nestedElementVisitor(node) {\n            switch (node.kind) {\n                case 205:\n                    return visitVariableStatement(node);\n                case 225:\n                    return visitFunctionDeclaration(node);\n                case 226:\n                    return visitClassDeclaration(node);\n                case 211:\n                    return visitForStatement(node);\n                case 212:\n                    return visitForInStatement(node);\n                case 213:\n                    return visitForOfStatement(node);\n                case 209:\n                    return visitDoStatement(node);\n                case 210:\n                    return visitWhileStatement(node);\n                case 219:\n                    return visitLabeledStatement(node);\n                case 217:\n                    return visitWithStatement(node);\n                case 218:\n                    return visitSwitchStatement(node);\n                case 232:\n                    return visitCaseBlock(node);\n                case 253:\n                    return visitCaseClause(node);\n                case 254:\n                    return visitDefaultClause(node);\n                case 221:\n                    return visitTryStatement(node);\n                case 256:\n                    return visitCatchClause(node);\n                case 204:\n                    return visitBlock(node);\n                case 295:\n                    return visitMergeDeclarationMarker(node);\n                case 296:\n                    return visitEndOfDeclarationMarker(node);\n                default:\n                    return destructuringVisitor(node);\n            }\n        }\n        function visitForStatement(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.updateFor(node, visitForInitializer(node.initializer), ts.visitNode(node.condition, destructuringVisitor, ts.isExpression, true), ts.visitNode(node.incrementor, destructuringVisitor, ts.isExpression, true), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement));\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        function visitForInStatement(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.updateForIn(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock));\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        function visitForOfStatement(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.updateForOf(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock));\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        function shouldHoistForInitializer(node) {\n            return ts.isVariableDeclarationList(node)\n                && shouldHoistVariableDeclarationList(node);\n        }\n        function visitForInitializer(node) {\n            if (shouldHoistForInitializer(node)) {\n                var expressions = void 0;\n                for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) {\n                    var variable = _a[_i];\n                    expressions = ts.append(expressions, transformInitializedVariable(variable, false));\n                }\n                return expressions ? ts.inlineExpressions(expressions) : ts.createOmittedExpression();\n            }\n            else {\n                return ts.visitEachChild(node, nestedElementVisitor, context);\n            }\n        }\n        function visitDoStatement(node) {\n            return ts.updateDo(node, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression));\n        }\n        function visitWhileStatement(node) {\n            return ts.updateWhile(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock));\n        }\n        function visitLabeledStatement(node) {\n            return ts.updateLabel(node, node.label, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock));\n        }\n        function visitWithStatement(node) {\n            return ts.updateWith(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock));\n        }\n        function visitSwitchStatement(node) {\n            return ts.updateSwitch(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.caseBlock, nestedElementVisitor, ts.isCaseBlock));\n        }\n        function visitCaseBlock(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.updateCaseBlock(node, ts.visitNodes(node.clauses, nestedElementVisitor, ts.isCaseOrDefaultClause));\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        function visitCaseClause(node) {\n            return ts.updateCaseClause(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNodes(node.statements, nestedElementVisitor, ts.isStatement));\n        }\n        function visitDefaultClause(node) {\n            return ts.visitEachChild(node, nestedElementVisitor, context);\n        }\n        function visitTryStatement(node) {\n            return ts.visitEachChild(node, nestedElementVisitor, context);\n        }\n        function visitCatchClause(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.updateCatchClause(node, node.variableDeclaration, ts.visitNode(node.block, nestedElementVisitor, ts.isBlock));\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        function visitBlock(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.visitEachChild(node, nestedElementVisitor, context);\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        function destructuringVisitor(node) {\n            if (node.transformFlags & 1024\n                && node.kind === 192) {\n                return visitDestructuringAssignment(node);\n            }\n            else if (node.transformFlags & 2048) {\n                return ts.visitEachChild(node, destructuringVisitor, context);\n            }\n            else {\n                return node;\n            }\n        }\n        function visitDestructuringAssignment(node) {\n            if (hasExportedReferenceInDestructuringTarget(node.left)) {\n                return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, true);\n            }\n            return ts.visitEachChild(node, destructuringVisitor, context);\n        }\n        function hasExportedReferenceInDestructuringTarget(node) {\n            if (ts.isAssignmentExpression(node)) {\n                return hasExportedReferenceInDestructuringTarget(node.left);\n            }\n            else if (ts.isSpreadExpression(node)) {\n                return hasExportedReferenceInDestructuringTarget(node.expression);\n            }\n            else if (ts.isObjectLiteralExpression(node)) {\n                return ts.some(node.properties, hasExportedReferenceInDestructuringTarget);\n            }\n            else if (ts.isArrayLiteralExpression(node)) {\n                return ts.some(node.elements, hasExportedReferenceInDestructuringTarget);\n            }\n            else if (ts.isShorthandPropertyAssignment(node)) {\n                return hasExportedReferenceInDestructuringTarget(node.name);\n            }\n            else if (ts.isPropertyAssignment(node)) {\n                return hasExportedReferenceInDestructuringTarget(node.initializer);\n            }\n            else if (ts.isIdentifier(node)) {\n                var container = resolver.getReferencedExportContainer(node);\n                return container !== undefined && container.kind === 261;\n            }\n            else {\n                return false;\n            }\n        }\n        function modifierVisitor(node) {\n            switch (node.kind) {\n                case 83:\n                case 78:\n                    return undefined;\n            }\n            return node;\n        }\n        function onEmitNode(emitContext, node, emitCallback) {\n            if (node.kind === 261) {\n                var id = ts.getOriginalNodeId(node);\n                currentSourceFile = node;\n                moduleInfo = moduleInfoMap[id];\n                exportFunction = exportFunctionsMap[id];\n                noSubstitution = noSubstitutionMap[id];\n                if (noSubstitution) {\n                    delete noSubstitutionMap[id];\n                }\n                previousOnEmitNode(emitContext, node, emitCallback);\n                currentSourceFile = undefined;\n                moduleInfo = undefined;\n                exportFunction = undefined;\n                noSubstitution = undefined;\n            }\n            else {\n                previousOnEmitNode(emitContext, node, emitCallback);\n            }\n        }\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (isSubstitutionPrevented(node)) {\n                return node;\n            }\n            if (emitContext === 1) {\n                return substituteExpression(node);\n            }\n            return node;\n        }\n        function substituteExpression(node) {\n            switch (node.kind) {\n                case 70:\n                    return substituteExpressionIdentifier(node);\n                case 192:\n                    return substituteBinaryExpression(node);\n                case 190:\n                case 191:\n                    return substituteUnaryExpression(node);\n            }\n            return node;\n        }\n        function substituteExpressionIdentifier(node) {\n            if (ts.getEmitFlags(node) & 4096) {\n                var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);\n                if (externalHelpersModuleName) {\n                    return ts.createPropertyAccess(externalHelpersModuleName, node);\n                }\n                return node;\n            }\n            if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {\n                var importDeclaration = resolver.getReferencedImportDeclaration(node);\n                if (importDeclaration) {\n                    if (ts.isImportClause(importDeclaration)) {\n                        return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier(\"default\"), node);\n                    }\n                    else if (ts.isImportSpecifier(importDeclaration)) {\n                        return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(importDeclaration.propertyName || importDeclaration.name), node);\n                    }\n                }\n            }\n            return node;\n        }\n        function substituteBinaryExpression(node) {\n            if (ts.isAssignmentOperator(node.operatorToken.kind)\n                && ts.isIdentifier(node.left)\n                && !ts.isGeneratedIdentifier(node.left)\n                && !ts.isLocalName(node.left)\n                && !ts.isDeclarationNameOfEnumOrNamespace(node.left)) {\n                var exportedNames = getExports(node.left);\n                if (exportedNames) {\n                    var expression = node;\n                    for (var _i = 0, exportedNames_1 = exportedNames; _i < exportedNames_1.length; _i++) {\n                        var exportName = exportedNames_1[_i];\n                        expression = createExportExpression(exportName, preventSubstitution(expression));\n                    }\n                    return expression;\n                }\n            }\n            return node;\n        }\n        function substituteUnaryExpression(node) {\n            if ((node.operator === 42 || node.operator === 43)\n                && ts.isIdentifier(node.operand)\n                && !ts.isGeneratedIdentifier(node.operand)\n                && !ts.isLocalName(node.operand)\n                && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {\n                var exportedNames = getExports(node.operand);\n                if (exportedNames) {\n                    var expression = node.kind === 191\n                        ? ts.createPrefix(node.operator, node.operand, node)\n                        : node;\n                    for (var _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) {\n                        var exportName = exportedNames_2[_i];\n                        expression = createExportExpression(exportName, preventSubstitution(expression));\n                    }\n                    if (node.kind === 191) {\n                        expression = node.operator === 42\n                            ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1))\n                            : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1));\n                    }\n                    return expression;\n                }\n            }\n            return node;\n        }\n        function getExports(name) {\n            var exportedNames;\n            if (!ts.isGeneratedIdentifier(name)) {\n                var valueDeclaration = resolver.getReferencedImportDeclaration(name)\n                    || resolver.getReferencedValueDeclaration(name);\n                if (valueDeclaration) {\n                    var exportContainer = resolver.getReferencedExportContainer(name, false);\n                    if (exportContainer && exportContainer.kind === 261) {\n                        exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration));\n                    }\n                    exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]);\n                }\n            }\n            return exportedNames;\n        }\n        function preventSubstitution(node) {\n            if (noSubstitution === undefined)\n                noSubstitution = ts.createMap();\n            noSubstitution[ts.getNodeId(node)] = true;\n            return node;\n        }\n        function isSubstitutionPrevented(node) {\n            return noSubstitution && node.id && noSubstitution[node.id];\n        }\n    }\n    ts.transformSystemModule = transformSystemModule;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformModule(context) {\n        var transformModuleDelegates = ts.createMap((_a = {},\n            _a[ts.ModuleKind.None] = transformCommonJSModule,\n            _a[ts.ModuleKind.CommonJS] = transformCommonJSModule,\n            _a[ts.ModuleKind.AMD] = transformAMDModule,\n            _a[ts.ModuleKind.UMD] = transformUMDModule,\n            _a));\n        var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;\n        var compilerOptions = context.getCompilerOptions();\n        var resolver = context.getEmitResolver();\n        var host = context.getEmitHost();\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        var moduleKind = ts.getEmitModuleKind(compilerOptions);\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        var previousOnEmitNode = context.onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        context.onEmitNode = onEmitNode;\n        context.enableSubstitution(70);\n        context.enableSubstitution(192);\n        context.enableSubstitution(190);\n        context.enableSubstitution(191);\n        context.enableSubstitution(258);\n        context.enableEmitNotification(261);\n        var moduleInfoMap = ts.createMap();\n        var deferredExports = ts.createMap();\n        var currentSourceFile;\n        var currentModuleInfo;\n        var noSubstitution;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)\n                || !(ts.isExternalModule(node)\n                    || compilerOptions.isolatedModules)) {\n                return node;\n            }\n            currentSourceFile = node;\n            currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions);\n            var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None];\n            var updated = transformModule(node);\n            currentSourceFile = undefined;\n            currentModuleInfo = undefined;\n            return ts.aggregateTransformFlags(updated);\n        }\n        function transformCommonJSModule(node) {\n            startLexicalEnvironment();\n            var statements = [];\n            var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor);\n            ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true));\n            ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));\n            ts.addRange(statements, endLexicalEnvironment());\n            addExportEqualsIfNeeded(statements, false);\n            var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));\n            if (currentModuleInfo.hasExportStarsToExportValues) {\n                ts.addEmitHelper(updated, exportStarHelper);\n            }\n            return updated;\n        }\n        function transformAMDModule(node) {\n            var define = ts.createIdentifier(\"define\");\n            var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);\n            return transformAsynchronousModule(node, define, moduleName, true);\n        }\n        function transformUMDModule(node) {\n            var define = ts.createRawExpression(umdHelper);\n            return transformAsynchronousModule(node, define, undefined, false);\n        }\n        function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) {\n            var _a = collectAsynchronousDependencies(node, includeNonAmdDependencies), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames;\n            return ts.updateSourceFileNode(node, ts.createNodeArray([\n                ts.createStatement(ts.createCall(define, undefined, (moduleName ? [moduleName] : []).concat([\n                    ts.createArrayLiteral([\n                        ts.createLiteral(\"require\"),\n                        ts.createLiteral(\"exports\")\n                    ].concat(aliasedModuleNames, unaliasedModuleNames)),\n                    ts.createFunctionExpression(undefined, undefined, undefined, undefined, [\n                        ts.createParameter(undefined, undefined, undefined, \"require\"),\n                        ts.createParameter(undefined, undefined, undefined, \"exports\")\n                    ].concat(importAliasNames), undefined, transformAsynchronousModuleBody(node))\n                ])))\n            ], node.statements));\n        }\n        function collectAsynchronousDependencies(node, includeNonAmdDependencies) {\n            var aliasedModuleNames = [];\n            var unaliasedModuleNames = [];\n            var importAliasNames = [];\n            for (var _i = 0, _a = node.amdDependencies; _i < _a.length; _i++) {\n                var amdDependency = _a[_i];\n                if (amdDependency.name) {\n                    aliasedModuleNames.push(ts.createLiteral(amdDependency.path));\n                    importAliasNames.push(ts.createParameter(undefined, undefined, undefined, amdDependency.name));\n                }\n                else {\n                    unaliasedModuleNames.push(ts.createLiteral(amdDependency.path));\n                }\n            }\n            for (var _b = 0, _c = currentModuleInfo.externalImports; _b < _c.length; _b++) {\n                var importNode = _c[_b];\n                var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions);\n                var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile);\n                if (includeNonAmdDependencies && importAliasName) {\n                    ts.setEmitFlags(importAliasName, 4);\n                    aliasedModuleNames.push(externalModuleName);\n                    importAliasNames.push(ts.createParameter(undefined, undefined, undefined, importAliasName));\n                }\n                else {\n                    unaliasedModuleNames.push(externalModuleName);\n                }\n            }\n            return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames };\n        }\n        function transformAsynchronousModuleBody(node) {\n            startLexicalEnvironment();\n            var statements = [];\n            var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor);\n            ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true));\n            ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));\n            ts.addRange(statements, endLexicalEnvironment());\n            addExportEqualsIfNeeded(statements, true);\n            var body = ts.createBlock(statements, undefined, true);\n            if (currentModuleInfo.hasExportStarsToExportValues) {\n                ts.addEmitHelper(body, exportStarHelper);\n            }\n            return body;\n        }\n        function addExportEqualsIfNeeded(statements, emitAsReturn) {\n            if (currentModuleInfo.exportEquals) {\n                if (emitAsReturn) {\n                    var statement = ts.createReturn(currentModuleInfo.exportEquals.expression, currentModuleInfo.exportEquals);\n                    ts.setEmitFlags(statement, 384 | 1536);\n                    statements.push(statement);\n                }\n                else {\n                    var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier(\"module\"), \"exports\"), currentModuleInfo.exportEquals.expression), currentModuleInfo.exportEquals);\n                    ts.setEmitFlags(statement, 1536);\n                    statements.push(statement);\n                }\n            }\n        }\n        function sourceElementVisitor(node) {\n            switch (node.kind) {\n                case 235:\n                    return visitImportDeclaration(node);\n                case 234:\n                    return visitImportEqualsDeclaration(node);\n                case 241:\n                    return visitExportDeclaration(node);\n                case 240:\n                    return visitExportAssignment(node);\n                case 205:\n                    return visitVariableStatement(node);\n                case 225:\n                    return visitFunctionDeclaration(node);\n                case 226:\n                    return visitClassDeclaration(node);\n                case 295:\n                    return visitMergeDeclarationMarker(node);\n                case 296:\n                    return visitEndOfDeclarationMarker(node);\n                default:\n                    return node;\n            }\n        }\n        function visitImportDeclaration(node) {\n            var statements;\n            var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);\n            if (moduleKind !== ts.ModuleKind.AMD) {\n                if (!node.importClause) {\n                    return ts.createStatement(createRequireCall(node), node);\n                }\n                else {\n                    var variables = [];\n                    if (namespaceDeclaration && !ts.isDefaultImport(node)) {\n                        variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, createRequireCall(node)));\n                    }\n                    else {\n                        variables.push(ts.createVariableDeclaration(ts.getGeneratedNameForNode(node), undefined, createRequireCall(node)));\n                        if (namespaceDeclaration && ts.isDefaultImport(node)) {\n                            variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node)));\n                        }\n                    }\n                    statements = ts.append(statements, ts.createVariableStatement(undefined, ts.createVariableDeclarationList(variables, undefined, languageVersion >= 2 ? 2 : 0), node));\n                }\n            }\n            else if (namespaceDeclaration && ts.isDefaultImport(node)) {\n                statements = ts.append(statements, ts.createVariableStatement(undefined, ts.createVariableDeclarationList([\n                    ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node), node)\n                ], undefined, languageVersion >= 2 ? 2 : 0)));\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfImportDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function createRequireCall(importNode) {\n            var moduleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions);\n            var args = [];\n            if (moduleName) {\n                args.push(moduleName);\n            }\n            return ts.createCall(ts.createIdentifier(\"require\"), undefined, args);\n        }\n        function visitImportEqualsDeclaration(node) {\n            ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), \"import= for internal module references should be handled in an earlier transformer.\");\n            var statements;\n            if (moduleKind !== ts.ModuleKind.AMD) {\n                if (ts.hasModifier(node, 1)) {\n                    statements = ts.append(statements, ts.createStatement(createExportExpression(node.name, createRequireCall(node)), node));\n                }\n                else {\n                    statements = ts.append(statements, ts.createVariableStatement(undefined, ts.createVariableDeclarationList([\n                        ts.createVariableDeclaration(ts.getSynthesizedClone(node.name), undefined, createRequireCall(node))\n                    ], undefined, languageVersion >= 2 ? 2 : 0), node));\n                }\n            }\n            else {\n                if (ts.hasModifier(node, 1)) {\n                    statements = ts.append(statements, ts.createStatement(createExportExpression(ts.getExportName(node), ts.getLocalName(node)), node));\n                }\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfImportEqualsDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function visitExportDeclaration(node) {\n            if (!node.moduleSpecifier) {\n                return undefined;\n            }\n            var generatedName = ts.getGeneratedNameForNode(node);\n            if (node.exportClause) {\n                var statements = [];\n                if (moduleKind !== ts.ModuleKind.AMD) {\n                    statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([\n                        ts.createVariableDeclaration(generatedName, undefined, createRequireCall(node))\n                    ]), node));\n                }\n                for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) {\n                    var specifier = _a[_i];\n                    var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name);\n                    statements.push(ts.createStatement(createExportExpression(ts.getExportName(specifier), exportedValue), specifier));\n                }\n                return ts.singleOrMany(statements);\n            }\n            else {\n                return ts.createStatement(ts.createCall(ts.createIdentifier(\"__export\"), undefined, [\n                    moduleKind !== ts.ModuleKind.AMD\n                        ? createRequireCall(node)\n                        : generatedName\n                ]), node);\n            }\n        }\n        function visitExportAssignment(node) {\n            if (node.isExportEquals) {\n                return undefined;\n            }\n            var statements;\n            var original = node.original;\n            if (original && hasAssociatedEndOfDeclarationMarker(original)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier(\"default\"), node.expression, node, true);\n            }\n            else {\n                statements = appendExportStatement(statements, ts.createIdentifier(\"default\"), node.expression, node, true);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function visitFunctionDeclaration(node) {\n            var statements;\n            if (ts.hasModifier(node, 1)) {\n                statements = ts.append(statements, ts.setOriginalNode(ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, true, true), undefined, node.parameters, undefined, node.body, node), node));\n            }\n            else {\n                statements = ts.append(statements, node);\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfHoistedDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function visitClassDeclaration(node) {\n            var statements;\n            if (ts.hasModifier(node, 1)) {\n                statements = ts.append(statements, ts.setOriginalNode(ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, true, true), undefined, node.heritageClauses, node.members, node), node));\n            }\n            else {\n                statements = ts.append(statements, node);\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfHoistedDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function visitVariableStatement(node) {\n            var statements;\n            var variables;\n            var expressions;\n            if (ts.hasModifier(node, 1)) {\n                var modifiers = void 0;\n                for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                    var variable = _a[_i];\n                    if (ts.isIdentifier(variable.name) && ts.isLocalName(variable.name)) {\n                        if (!modifiers) {\n                            modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier);\n                        }\n                        variables = ts.append(variables, variable);\n                    }\n                    else if (variable.initializer) {\n                        expressions = ts.append(expressions, transformInitializedVariable(variable));\n                    }\n                }\n                if (variables) {\n                    statements = ts.append(statements, ts.updateVariableStatement(node, modifiers, ts.updateVariableDeclarationList(node.declarationList, variables)));\n                }\n                if (expressions) {\n                    statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), node));\n                }\n            }\n            else {\n                statements = ts.append(statements, node);\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfVariableStatement(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function transformInitializedVariable(node) {\n            if (ts.isBindingPattern(node.name)) {\n                return ts.flattenDestructuringAssignment(node, undefined, context, 0, false, createExportExpression);\n            }\n            else {\n                return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier(\"exports\"), node.name, node.name), node.initializer);\n            }\n        }\n        function visitMergeDeclarationMarker(node) {\n            if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original);\n            }\n            return node;\n        }\n        function hasAssociatedEndOfDeclarationMarker(node) {\n            return (ts.getEmitFlags(node) & 2097152) !== 0;\n        }\n        function visitEndOfDeclarationMarker(node) {\n            var id = ts.getOriginalNodeId(node);\n            var statements = deferredExports[id];\n            if (statements) {\n                delete deferredExports[id];\n                return ts.append(statements, node);\n            }\n            return node;\n        }\n        function appendExportsOfImportDeclaration(statements, decl) {\n            if (currentModuleInfo.exportEquals) {\n                return statements;\n            }\n            var importClause = decl.importClause;\n            if (!importClause) {\n                return statements;\n            }\n            if (importClause.name) {\n                statements = appendExportsOfDeclaration(statements, importClause);\n            }\n            var namedBindings = importClause.namedBindings;\n            if (namedBindings) {\n                switch (namedBindings.kind) {\n                    case 237:\n                        statements = appendExportsOfDeclaration(statements, namedBindings);\n                        break;\n                    case 238:\n                        for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {\n                            var importBinding = _a[_i];\n                            statements = appendExportsOfDeclaration(statements, importBinding);\n                        }\n                        break;\n                }\n            }\n            return statements;\n        }\n        function appendExportsOfImportEqualsDeclaration(statements, decl) {\n            if (currentModuleInfo.exportEquals) {\n                return statements;\n            }\n            return appendExportsOfDeclaration(statements, decl);\n        }\n        function appendExportsOfVariableStatement(statements, node) {\n            if (currentModuleInfo.exportEquals) {\n                return statements;\n            }\n            for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                var decl = _a[_i];\n                statements = appendExportsOfBindingElement(statements, decl);\n            }\n            return statements;\n        }\n        function appendExportsOfBindingElement(statements, decl) {\n            if (currentModuleInfo.exportEquals) {\n                return statements;\n            }\n            if (ts.isBindingPattern(decl.name)) {\n                for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        statements = appendExportsOfBindingElement(statements, element);\n                    }\n                }\n            }\n            else if (!ts.isGeneratedIdentifier(decl.name)) {\n                statements = appendExportsOfDeclaration(statements, decl);\n            }\n            return statements;\n        }\n        function appendExportsOfHoistedDeclaration(statements, decl) {\n            if (currentModuleInfo.exportEquals) {\n                return statements;\n            }\n            if (ts.hasModifier(decl, 1)) {\n                var exportName = ts.hasModifier(decl, 512) ? ts.createIdentifier(\"default\") : decl.name;\n                statements = appendExportStatement(statements, exportName, ts.getLocalName(decl), decl);\n            }\n            if (decl.name) {\n                statements = appendExportsOfDeclaration(statements, decl);\n            }\n            return statements;\n        }\n        function appendExportsOfDeclaration(statements, decl) {\n            var name = ts.getDeclarationName(decl);\n            var exportSpecifiers = currentModuleInfo.exportSpecifiers[name.text];\n            if (exportSpecifiers) {\n                for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) {\n                    var exportSpecifier = exportSpecifiers_2[_i];\n                    statements = appendExportStatement(statements, exportSpecifier.name, name, exportSpecifier.name);\n                }\n            }\n            return statements;\n        }\n        function appendExportStatement(statements, exportName, expression, location, allowComments) {\n            if (exportName.text === \"default\") {\n                var sourceFile = ts.getOriginalNode(currentSourceFile, ts.isSourceFile);\n                if (sourceFile && !sourceFile.symbol.exports[\"___esModule\"]) {\n                    if (languageVersion === 0) {\n                        statements = ts.append(statements, ts.createStatement(createExportExpression(ts.createIdentifier(\"__esModule\"), ts.createLiteral(true))));\n                    }\n                    else {\n                        statements = ts.append(statements, ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier(\"Object\"), \"defineProperty\"), undefined, [\n                            ts.createIdentifier(\"exports\"),\n                            ts.createLiteral(\"__esModule\"),\n                            ts.createObjectLiteral([\n                                ts.createPropertyAssignment(\"value\", ts.createLiteral(true))\n                            ])\n                        ])));\n                    }\n                }\n            }\n            statements = ts.append(statements, createExportStatement(exportName, expression, location, allowComments));\n            return statements;\n        }\n        function createExportStatement(name, value, location, allowComments) {\n            var statement = ts.createStatement(createExportExpression(name, value), location);\n            ts.startOnNewLine(statement);\n            if (!allowComments) {\n                ts.setEmitFlags(statement, 1536);\n            }\n            return statement;\n        }\n        function createExportExpression(name, value, location) {\n            return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier(\"exports\"), ts.getSynthesizedClone(name)), value, location);\n        }\n        function modifierVisitor(node) {\n            switch (node.kind) {\n                case 83:\n                case 78:\n                    return undefined;\n            }\n            return node;\n        }\n        function onEmitNode(emitContext, node, emitCallback) {\n            if (node.kind === 261) {\n                currentSourceFile = node;\n                currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)];\n                noSubstitution = ts.createMap();\n                previousOnEmitNode(emitContext, node, emitCallback);\n                currentSourceFile = undefined;\n                currentModuleInfo = undefined;\n                noSubstitution = undefined;\n            }\n            else {\n                previousOnEmitNode(emitContext, node, emitCallback);\n            }\n        }\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (node.id && noSubstitution[node.id]) {\n                return node;\n            }\n            if (emitContext === 1) {\n                return substituteExpression(node);\n            }\n            else if (ts.isShorthandPropertyAssignment(node)) {\n                return substituteShorthandPropertyAssignment(node);\n            }\n            return node;\n        }\n        function substituteShorthandPropertyAssignment(node) {\n            var name = node.name;\n            var exportedOrImportedName = substituteExpressionIdentifier(name);\n            if (exportedOrImportedName !== name) {\n                if (node.objectAssignmentInitializer) {\n                    var initializer = ts.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer);\n                    return ts.createPropertyAssignment(name, initializer, node);\n                }\n                return ts.createPropertyAssignment(name, exportedOrImportedName, node);\n            }\n            return node;\n        }\n        function substituteExpression(node) {\n            switch (node.kind) {\n                case 70:\n                    return substituteExpressionIdentifier(node);\n                case 192:\n                    return substituteBinaryExpression(node);\n                case 191:\n                case 190:\n                    return substituteUnaryExpression(node);\n            }\n            return node;\n        }\n        function substituteExpressionIdentifier(node) {\n            if (ts.getEmitFlags(node) & 4096) {\n                var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);\n                if (externalHelpersModuleName) {\n                    return ts.createPropertyAccess(externalHelpersModuleName, node);\n                }\n                return node;\n            }\n            if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {\n                var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node));\n                if (exportContainer && exportContainer.kind === 261) {\n                    return ts.createPropertyAccess(ts.createIdentifier(\"exports\"), ts.getSynthesizedClone(node), node);\n                }\n                var importDeclaration = resolver.getReferencedImportDeclaration(node);\n                if (importDeclaration) {\n                    if (ts.isImportClause(importDeclaration)) {\n                        return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier(\"default\"), node);\n                    }\n                    else if (ts.isImportSpecifier(importDeclaration)) {\n                        var name_38 = importDeclaration.propertyName || importDeclaration.name;\n                        return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_38), node);\n                    }\n                }\n            }\n            return node;\n        }\n        function substituteBinaryExpression(node) {\n            if (ts.isAssignmentOperator(node.operatorToken.kind)\n                && ts.isIdentifier(node.left)\n                && !ts.isGeneratedIdentifier(node.left)\n                && !ts.isLocalName(node.left)\n                && !ts.isDeclarationNameOfEnumOrNamespace(node.left)) {\n                var exportedNames = getExports(node.left);\n                if (exportedNames) {\n                    var expression = node;\n                    for (var _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) {\n                        var exportName = exportedNames_3[_i];\n                        noSubstitution[ts.getNodeId(expression)] = true;\n                        expression = createExportExpression(exportName, expression, node);\n                    }\n                    return expression;\n                }\n            }\n            return node;\n        }\n        function substituteUnaryExpression(node) {\n            if ((node.operator === 42 || node.operator === 43)\n                && ts.isIdentifier(node.operand)\n                && !ts.isGeneratedIdentifier(node.operand)\n                && !ts.isLocalName(node.operand)\n                && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {\n                var exportedNames = getExports(node.operand);\n                if (exportedNames) {\n                    var expression = node.kind === 191\n                        ? ts.createBinary(node.operand, ts.createToken(node.operator === 42 ? 58 : 59), ts.createLiteral(1), node)\n                        : node;\n                    for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) {\n                        var exportName = exportedNames_4[_i];\n                        noSubstitution[ts.getNodeId(expression)] = true;\n                        expression = createExportExpression(exportName, expression);\n                    }\n                    return expression;\n                }\n            }\n            return node;\n        }\n        function getExports(name) {\n            if (!ts.isGeneratedIdentifier(name)) {\n                var valueDeclaration = resolver.getReferencedImportDeclaration(name)\n                    || resolver.getReferencedValueDeclaration(name);\n                if (valueDeclaration) {\n                    return currentModuleInfo\n                        && currentModuleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)];\n                }\n            }\n        }\n        var _a;\n    }\n    ts.transformModule = transformModule;\n    var exportStarHelper = {\n        name: \"typescript:export-star\",\n        scoped: true,\n        text: \"\\n            function __export(m) {\\n                for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\\n            }\"\n    };\n    var umdHelper = \"\\n        (function (dependencies, factory) {\\n            if (typeof module === 'object' && typeof module.exports === 'object') {\\n                var v = factory(require, exports); if (v !== undefined) module.exports = v;\\n            }\\n            else if (typeof define === 'function' && define.amd) {\\n                define(dependencies, factory);\\n            }\\n        })\";\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var moduleTransformerMap = ts.createMap((_a = {},\n        _a[ts.ModuleKind.ES2015] = ts.transformES2015Module,\n        _a[ts.ModuleKind.System] = ts.transformSystemModule,\n        _a[ts.ModuleKind.AMD] = ts.transformModule,\n        _a[ts.ModuleKind.CommonJS] = ts.transformModule,\n        _a[ts.ModuleKind.UMD] = ts.transformModule,\n        _a[ts.ModuleKind.None] = ts.transformModule,\n        _a));\n    function getTransformers(compilerOptions) {\n        var jsx = compilerOptions.jsx;\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        var moduleKind = ts.getEmitModuleKind(compilerOptions);\n        var transformers = [];\n        transformers.push(ts.transformTypeScript);\n        if (jsx === 2) {\n            transformers.push(ts.transformJsx);\n        }\n        if (languageVersion < 5) {\n            transformers.push(ts.transformESNext);\n        }\n        if (languageVersion < 4) {\n            transformers.push(ts.transformES2017);\n        }\n        if (languageVersion < 3) {\n            transformers.push(ts.transformES2016);\n        }\n        if (languageVersion < 2) {\n            transformers.push(ts.transformES2015);\n            transformers.push(ts.transformGenerators);\n        }\n        transformers.push(moduleTransformerMap[moduleKind] || moduleTransformerMap[ts.ModuleKind.None]);\n        if (languageVersion < 1) {\n            transformers.push(ts.transformES5);\n        }\n        return transformers;\n    }\n    ts.getTransformers = getTransformers;\n    function transformFiles(resolver, host, sourceFiles, transformers) {\n        var enabledSyntaxKindFeatures = new Array(298);\n        var lexicalEnvironmentDisabled = false;\n        var lexicalEnvironmentVariableDeclarations;\n        var lexicalEnvironmentFunctionDeclarations;\n        var lexicalEnvironmentVariableDeclarationsStack = [];\n        var lexicalEnvironmentFunctionDeclarationsStack = [];\n        var lexicalEnvironmentStackOffset = 0;\n        var lexicalEnvironmentSuspended = false;\n        var emitHelpers;\n        var context = {\n            getCompilerOptions: function () { return host.getCompilerOptions(); },\n            getEmitResolver: function () { return resolver; },\n            getEmitHost: function () { return host; },\n            startLexicalEnvironment: startLexicalEnvironment,\n            suspendLexicalEnvironment: suspendLexicalEnvironment,\n            resumeLexicalEnvironment: resumeLexicalEnvironment,\n            endLexicalEnvironment: endLexicalEnvironment,\n            hoistVariableDeclaration: hoistVariableDeclaration,\n            hoistFunctionDeclaration: hoistFunctionDeclaration,\n            requestEmitHelper: requestEmitHelper,\n            readEmitHelpers: readEmitHelpers,\n            onSubstituteNode: function (_emitContext, node) { return node; },\n            enableSubstitution: enableSubstitution,\n            isSubstitutionEnabled: isSubstitutionEnabled,\n            onEmitNode: function (node, emitContext, emitCallback) { return emitCallback(node, emitContext); },\n            enableEmitNotification: enableEmitNotification,\n            isEmitNotificationEnabled: isEmitNotificationEnabled\n        };\n        var transformation = ts.chain.apply(void 0, transformers)(context);\n        var transformed = ts.map(sourceFiles, transformSourceFile);\n        lexicalEnvironmentDisabled = true;\n        return {\n            transformed: transformed,\n            emitNodeWithSubstitution: emitNodeWithSubstitution,\n            emitNodeWithNotification: emitNodeWithNotification\n        };\n        function transformSourceFile(sourceFile) {\n            if (ts.isDeclarationFile(sourceFile)) {\n                return sourceFile;\n            }\n            return transformation(sourceFile);\n        }\n        function enableSubstitution(kind) {\n            enabledSyntaxKindFeatures[kind] |= 1;\n        }\n        function isSubstitutionEnabled(node) {\n            return (enabledSyntaxKindFeatures[node.kind] & 1) !== 0\n                && (ts.getEmitFlags(node) & 4) === 0;\n        }\n        function emitNodeWithSubstitution(emitContext, node, emitCallback) {\n            if (node) {\n                if (isSubstitutionEnabled(node)) {\n                    var substitute = context.onSubstituteNode(emitContext, node);\n                    if (substitute && substitute !== node) {\n                        emitCallback(emitContext, substitute);\n                        return;\n                    }\n                }\n                emitCallback(emitContext, node);\n            }\n        }\n        function enableEmitNotification(kind) {\n            enabledSyntaxKindFeatures[kind] |= 2;\n        }\n        function isEmitNotificationEnabled(node) {\n            return (enabledSyntaxKindFeatures[node.kind] & 2) !== 0\n                || (ts.getEmitFlags(node) & 2) !== 0;\n        }\n        function emitNodeWithNotification(emitContext, node, emitCallback) {\n            if (node) {\n                if (isEmitNotificationEnabled(node)) {\n                    context.onEmitNode(emitContext, node, emitCallback);\n                }\n                else {\n                    emitCallback(emitContext, node);\n                }\n            }\n        }\n        function hoistVariableDeclaration(name) {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot modify the lexical environment during the print phase.\");\n            var decl = ts.createVariableDeclaration(name);\n            if (!lexicalEnvironmentVariableDeclarations) {\n                lexicalEnvironmentVariableDeclarations = [decl];\n            }\n            else {\n                lexicalEnvironmentVariableDeclarations.push(decl);\n            }\n        }\n        function hoistFunctionDeclaration(func) {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot modify the lexical environment during the print phase.\");\n            if (!lexicalEnvironmentFunctionDeclarations) {\n                lexicalEnvironmentFunctionDeclarations = [func];\n            }\n            else {\n                lexicalEnvironmentFunctionDeclarations.push(func);\n            }\n        }\n        function startLexicalEnvironment() {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot start a lexical environment during the print phase.\");\n            ts.Debug.assert(!lexicalEnvironmentSuspended, \"Lexical environment is suspended.\");\n            lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations;\n            lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations;\n            lexicalEnvironmentStackOffset++;\n            lexicalEnvironmentVariableDeclarations = undefined;\n            lexicalEnvironmentFunctionDeclarations = undefined;\n        }\n        function suspendLexicalEnvironment() {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot suspend a lexical environment during the print phase.\");\n            ts.Debug.assert(!lexicalEnvironmentSuspended, \"Lexical environment is already suspended.\");\n            lexicalEnvironmentSuspended = true;\n        }\n        function resumeLexicalEnvironment() {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot resume a lexical environment during the print phase.\");\n            ts.Debug.assert(lexicalEnvironmentSuspended, \"Lexical environment is not suspended.\");\n            lexicalEnvironmentSuspended = false;\n        }\n        function endLexicalEnvironment() {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot end a lexical environment during the print phase.\");\n            ts.Debug.assert(!lexicalEnvironmentSuspended, \"Lexical environment is suspended.\");\n            var statements;\n            if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) {\n                if (lexicalEnvironmentFunctionDeclarations) {\n                    statements = lexicalEnvironmentFunctionDeclarations.slice();\n                }\n                if (lexicalEnvironmentVariableDeclarations) {\n                    var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations));\n                    if (!statements) {\n                        statements = [statement];\n                    }\n                    else {\n                        statements.push(statement);\n                    }\n                }\n            }\n            lexicalEnvironmentStackOffset--;\n            lexicalEnvironmentVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset];\n            lexicalEnvironmentFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset];\n            if (lexicalEnvironmentStackOffset === 0) {\n                lexicalEnvironmentVariableDeclarationsStack = [];\n                lexicalEnvironmentFunctionDeclarationsStack = [];\n            }\n            return statements;\n        }\n        function requestEmitHelper(helper) {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot modify the lexical environment during the print phase.\");\n            ts.Debug.assert(!helper.scoped, \"Cannot request a scoped emit helper.\");\n            emitHelpers = ts.append(emitHelpers, helper);\n        }\n        function readEmitHelpers() {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot modify the lexical environment during the print phase.\");\n            var helpers = emitHelpers;\n            emitHelpers = undefined;\n            return helpers;\n        }\n    }\n    ts.transformFiles = transformFiles;\n    var _a;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var defaultLastEncodedSourceMapSpan = {\n        emittedLine: 1,\n        emittedColumn: 1,\n        sourceLine: 1,\n        sourceColumn: 1,\n        sourceIndex: 0\n    };\n    function createSourceMapWriter(host, writer) {\n        var compilerOptions = host.getCompilerOptions();\n        var extendedDiagnostics = compilerOptions.extendedDiagnostics;\n        var currentSourceFile;\n        var currentSourceText;\n        var sourceMapDir;\n        var sourceMapSourceIndex;\n        var lastRecordedSourceMapSpan;\n        var lastEncodedSourceMapSpan;\n        var lastEncodedNameIndex;\n        var sourceMapData;\n        var disabled = !(compilerOptions.sourceMap || compilerOptions.inlineSourceMap);\n        return {\n            initialize: initialize,\n            reset: reset,\n            getSourceMapData: function () { return sourceMapData; },\n            setSourceFile: setSourceFile,\n            emitPos: emitPos,\n            emitNodeWithSourceMap: emitNodeWithSourceMap,\n            emitTokenWithSourceMap: emitTokenWithSourceMap,\n            getText: getText,\n            getSourceMappingURL: getSourceMappingURL,\n        };\n        function initialize(filePath, sourceMapFilePath, sourceFiles, isBundledEmit) {\n            if (disabled) {\n                return;\n            }\n            if (sourceMapData) {\n                reset();\n            }\n            currentSourceFile = undefined;\n            currentSourceText = undefined;\n            sourceMapSourceIndex = -1;\n            lastRecordedSourceMapSpan = undefined;\n            lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan;\n            lastEncodedNameIndex = 0;\n            sourceMapData = {\n                sourceMapFilePath: sourceMapFilePath,\n                jsSourceMappingURL: !compilerOptions.inlineSourceMap ? ts.getBaseFileName(ts.normalizeSlashes(sourceMapFilePath)) : undefined,\n                sourceMapFile: ts.getBaseFileName(ts.normalizeSlashes(filePath)),\n                sourceMapSourceRoot: compilerOptions.sourceRoot || \"\",\n                sourceMapSources: [],\n                inputSourceFileNames: [],\n                sourceMapNames: [],\n                sourceMapMappings: \"\",\n                sourceMapSourcesContent: compilerOptions.inlineSources ? [] : undefined,\n                sourceMapDecodedMappings: []\n            };\n            sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot);\n            if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47) {\n                sourceMapData.sourceMapSourceRoot += ts.directorySeparator;\n            }\n            if (compilerOptions.mapRoot) {\n                sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot);\n                if (!isBundledEmit) {\n                    ts.Debug.assert(sourceFiles.length === 1);\n                    sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFiles[0], host, sourceMapDir));\n                }\n                if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) {\n                    sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir);\n                    sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(filePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), host.getCurrentDirectory(), host.getCanonicalFileName, true);\n                }\n                else {\n                    sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL);\n                }\n            }\n            else {\n                sourceMapDir = ts.getDirectoryPath(ts.normalizePath(filePath));\n            }\n        }\n        function reset() {\n            if (disabled) {\n                return;\n            }\n            currentSourceFile = undefined;\n            sourceMapDir = undefined;\n            sourceMapSourceIndex = undefined;\n            lastRecordedSourceMapSpan = undefined;\n            lastEncodedSourceMapSpan = undefined;\n            lastEncodedNameIndex = undefined;\n            sourceMapData = undefined;\n        }\n        function encodeLastRecordedSourceMapSpan() {\n            if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) {\n                return;\n            }\n            var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn;\n            if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) {\n                if (sourceMapData.sourceMapMappings) {\n                    sourceMapData.sourceMapMappings += \",\";\n                }\n            }\n            else {\n                for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) {\n                    sourceMapData.sourceMapMappings += \";\";\n                }\n                prevEncodedEmittedColumn = 1;\n            }\n            sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn);\n            sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex);\n            sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine);\n            sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn);\n            if (lastRecordedSourceMapSpan.nameIndex >= 0) {\n                ts.Debug.assert(false, \"We do not support name index right now, Make sure to update updateLastEncodedAndRecordedSpans when we start using this\");\n                sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex);\n                lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex;\n            }\n            lastEncodedSourceMapSpan = lastRecordedSourceMapSpan;\n            sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan);\n        }\n        function emitPos(pos) {\n            if (disabled || ts.positionIsSynthesized(pos)) {\n                return;\n            }\n            if (extendedDiagnostics) {\n                ts.performance.mark(\"beforeSourcemap\");\n            }\n            var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos);\n            sourceLinePos.line++;\n            sourceLinePos.character++;\n            var emittedLine = writer.getLine();\n            var emittedColumn = writer.getColumn();\n            if (!lastRecordedSourceMapSpan ||\n                lastRecordedSourceMapSpan.emittedLine !== emittedLine ||\n                lastRecordedSourceMapSpan.emittedColumn !== emittedColumn ||\n                (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex &&\n                    (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line ||\n                        (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) {\n                encodeLastRecordedSourceMapSpan();\n                lastRecordedSourceMapSpan = {\n                    emittedLine: emittedLine,\n                    emittedColumn: emittedColumn,\n                    sourceLine: sourceLinePos.line,\n                    sourceColumn: sourceLinePos.character,\n                    sourceIndex: sourceMapSourceIndex\n                };\n            }\n            else {\n                lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line;\n                lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character;\n                lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex;\n            }\n            if (extendedDiagnostics) {\n                ts.performance.mark(\"afterSourcemap\");\n                ts.performance.measure(\"Source Map\", \"beforeSourcemap\", \"afterSourcemap\");\n            }\n        }\n        function emitNodeWithSourceMap(emitContext, node, emitCallback) {\n            if (disabled) {\n                return emitCallback(emitContext, node);\n            }\n            if (node) {\n                var emitNode = node.emitNode;\n                var emitFlags = emitNode && emitNode.flags;\n                var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end;\n                if (node.kind !== 293\n                    && (emitFlags & 16) === 0\n                    && pos >= 0) {\n                    emitPos(ts.skipTrivia(currentSourceText, pos));\n                }\n                if (emitFlags & 64) {\n                    disabled = true;\n                    emitCallback(emitContext, node);\n                    disabled = false;\n                }\n                else {\n                    emitCallback(emitContext, node);\n                }\n                if (node.kind !== 293\n                    && (emitFlags & 32) === 0\n                    && end >= 0) {\n                    emitPos(end);\n                }\n            }\n        }\n        function emitTokenWithSourceMap(node, token, tokenPos, emitCallback) {\n            if (disabled) {\n                return emitCallback(token, tokenPos);\n            }\n            var emitNode = node && node.emitNode;\n            var emitFlags = emitNode && emitNode.flags;\n            var range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token];\n            tokenPos = ts.skipTrivia(currentSourceText, range ? range.pos : tokenPos);\n            if ((emitFlags & 128) === 0 && tokenPos >= 0) {\n                emitPos(tokenPos);\n            }\n            tokenPos = emitCallback(token, tokenPos);\n            if (range)\n                tokenPos = range.end;\n            if ((emitFlags & 256) === 0 && tokenPos >= 0) {\n                emitPos(tokenPos);\n            }\n            return tokenPos;\n        }\n        function setSourceFile(sourceFile) {\n            if (disabled) {\n                return;\n            }\n            currentSourceFile = sourceFile;\n            currentSourceText = currentSourceFile.text;\n            var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;\n            var source = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, currentSourceFile.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true);\n            sourceMapSourceIndex = ts.indexOf(sourceMapData.sourceMapSources, source);\n            if (sourceMapSourceIndex === -1) {\n                sourceMapSourceIndex = sourceMapData.sourceMapSources.length;\n                sourceMapData.sourceMapSources.push(source);\n                sourceMapData.inputSourceFileNames.push(currentSourceFile.fileName);\n                if (compilerOptions.inlineSources) {\n                    sourceMapData.sourceMapSourcesContent.push(currentSourceFile.text);\n                }\n            }\n        }\n        function getText() {\n            if (disabled) {\n                return;\n            }\n            encodeLastRecordedSourceMapSpan();\n            return ts.stringify({\n                version: 3,\n                file: sourceMapData.sourceMapFile,\n                sourceRoot: sourceMapData.sourceMapSourceRoot,\n                sources: sourceMapData.sourceMapSources,\n                names: sourceMapData.sourceMapNames,\n                mappings: sourceMapData.sourceMapMappings,\n                sourcesContent: sourceMapData.sourceMapSourcesContent,\n            });\n        }\n        function getSourceMappingURL() {\n            if (disabled) {\n                return;\n            }\n            if (compilerOptions.inlineSourceMap) {\n                var base64SourceMapText = ts.convertToBase64(getText());\n                return sourceMapData.jsSourceMappingURL = \"data:application/json;base64,\" + base64SourceMapText;\n            }\n            else {\n                return sourceMapData.jsSourceMappingURL;\n            }\n        }\n    }\n    ts.createSourceMapWriter = createSourceMapWriter;\n    var base64Chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n    function base64FormatEncode(inValue) {\n        if (inValue < 64) {\n            return base64Chars.charAt(inValue);\n        }\n        throw TypeError(inValue + \": not a 64 based value\");\n    }\n    function base64VLQFormatEncode(inValue) {\n        if (inValue < 0) {\n            inValue = ((-inValue) << 1) + 1;\n        }\n        else {\n            inValue = inValue << 1;\n        }\n        var encodedStr = \"\";\n        do {\n            var currentDigit = inValue & 31;\n            inValue = inValue >> 5;\n            if (inValue > 0) {\n                currentDigit = currentDigit | 32;\n            }\n            encodedStr = encodedStr + base64FormatEncode(currentDigit);\n        } while (inValue > 0);\n        return encodedStr;\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function createCommentWriter(host, writer, sourceMap) {\n        var compilerOptions = host.getCompilerOptions();\n        var extendedDiagnostics = compilerOptions.extendedDiagnostics;\n        var newLine = host.getNewLine();\n        var emitPos = sourceMap.emitPos;\n        var containerPos = -1;\n        var containerEnd = -1;\n        var declarationListContainerEnd = -1;\n        var currentSourceFile;\n        var currentText;\n        var currentLineMap;\n        var detachedCommentsInfo;\n        var hasWrittenComment = false;\n        var disabled = compilerOptions.removeComments;\n        return {\n            reset: reset,\n            setSourceFile: setSourceFile,\n            emitNodeWithComments: emitNodeWithComments,\n            emitBodyWithDetachedComments: emitBodyWithDetachedComments,\n            emitTrailingCommentsOfPosition: emitTrailingCommentsOfPosition,\n        };\n        function emitNodeWithComments(emitContext, node, emitCallback) {\n            if (disabled) {\n                emitCallback(emitContext, node);\n                return;\n            }\n            if (node) {\n                var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;\n                var emitFlags = ts.getEmitFlags(node);\n                if ((pos < 0 && end < 0) || (pos === end)) {\n                    if (emitFlags & 2048) {\n                        disabled = true;\n                        emitCallback(emitContext, node);\n                        disabled = false;\n                    }\n                    else {\n                        emitCallback(emitContext, node);\n                    }\n                }\n                else {\n                    if (extendedDiagnostics) {\n                        ts.performance.mark(\"preEmitNodeWithComment\");\n                    }\n                    var isEmittedNode = node.kind !== 293;\n                    var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0;\n                    var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0;\n                    if (!skipLeadingComments) {\n                        emitLeadingComments(pos, isEmittedNode);\n                    }\n                    var savedContainerPos = containerPos;\n                    var savedContainerEnd = containerEnd;\n                    var savedDeclarationListContainerEnd = declarationListContainerEnd;\n                    if (!skipLeadingComments) {\n                        containerPos = pos;\n                    }\n                    if (!skipTrailingComments) {\n                        containerEnd = end;\n                        if (node.kind === 224) {\n                            declarationListContainerEnd = end;\n                        }\n                    }\n                    if (extendedDiagnostics) {\n                        ts.performance.measure(\"commentTime\", \"preEmitNodeWithComment\");\n                    }\n                    if (emitFlags & 2048) {\n                        disabled = true;\n                        emitCallback(emitContext, node);\n                        disabled = false;\n                    }\n                    else {\n                        emitCallback(emitContext, node);\n                    }\n                    if (extendedDiagnostics) {\n                        ts.performance.mark(\"beginEmitNodeWithComment\");\n                    }\n                    containerPos = savedContainerPos;\n                    containerEnd = savedContainerEnd;\n                    declarationListContainerEnd = savedDeclarationListContainerEnd;\n                    if (!skipTrailingComments && isEmittedNode) {\n                        emitTrailingComments(end);\n                    }\n                    if (extendedDiagnostics) {\n                        ts.performance.measure(\"commentTime\", \"beginEmitNodeWithComment\");\n                    }\n                }\n            }\n        }\n        function emitBodyWithDetachedComments(node, detachedRange, emitCallback) {\n            if (extendedDiagnostics) {\n                ts.performance.mark(\"preEmitBodyWithDetachedComments\");\n            }\n            var pos = detachedRange.pos, end = detachedRange.end;\n            var emitFlags = ts.getEmitFlags(node);\n            var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0;\n            var skipTrailingComments = disabled || end < 0 || (emitFlags & 1024) !== 0;\n            if (!skipLeadingComments) {\n                emitDetachedCommentsAndUpdateCommentsInfo(detachedRange);\n            }\n            if (extendedDiagnostics) {\n                ts.performance.measure(\"commentTime\", \"preEmitBodyWithDetachedComments\");\n            }\n            if (emitFlags & 2048 && !disabled) {\n                disabled = true;\n                emitCallback(node);\n                disabled = false;\n            }\n            else {\n                emitCallback(node);\n            }\n            if (extendedDiagnostics) {\n                ts.performance.mark(\"beginEmitBodyWithDetachedCommetns\");\n            }\n            if (!skipTrailingComments) {\n                emitLeadingComments(detachedRange.end, true);\n            }\n            if (extendedDiagnostics) {\n                ts.performance.measure(\"commentTime\", \"beginEmitBodyWithDetachedCommetns\");\n            }\n        }\n        function emitLeadingComments(pos, isEmittedNode) {\n            hasWrittenComment = false;\n            if (isEmittedNode) {\n                forEachLeadingCommentToEmit(pos, emitLeadingComment);\n            }\n            else if (pos === 0) {\n                forEachLeadingCommentToEmit(pos, emitTripleSlashLeadingComment);\n            }\n        }\n        function emitTripleSlashLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {\n            if (isTripleSlashComment(commentPos, commentEnd)) {\n                emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos);\n            }\n        }\n        function emitLeadingComment(commentPos, commentEnd, _kind, hasTrailingNewLine, rangePos) {\n            if (!hasWrittenComment) {\n                ts.emitNewLineBeforeLeadingCommentOfPosition(currentLineMap, writer, rangePos, commentPos);\n                hasWrittenComment = true;\n            }\n            emitPos(commentPos);\n            ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine);\n            emitPos(commentEnd);\n            if (hasTrailingNewLine) {\n                writer.writeLine();\n            }\n            else {\n                writer.write(\" \");\n            }\n        }\n        function emitTrailingComments(pos) {\n            forEachTrailingCommentToEmit(pos, emitTrailingComment);\n        }\n        function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) {\n            if (!writer.isAtStartOfLine()) {\n                writer.write(\" \");\n            }\n            emitPos(commentPos);\n            ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine);\n            emitPos(commentEnd);\n            if (hasTrailingNewLine) {\n                writer.writeLine();\n            }\n        }\n        function emitTrailingCommentsOfPosition(pos) {\n            if (disabled) {\n                return;\n            }\n            if (extendedDiagnostics) {\n                ts.performance.mark(\"beforeEmitTrailingCommentsOfPosition\");\n            }\n            forEachTrailingCommentToEmit(pos, emitTrailingCommentOfPosition);\n            if (extendedDiagnostics) {\n                ts.performance.measure(\"commentTime\", \"beforeEmitTrailingCommentsOfPosition\");\n            }\n        }\n        function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) {\n            emitPos(commentPos);\n            ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine);\n            emitPos(commentEnd);\n            if (hasTrailingNewLine) {\n                writer.writeLine();\n            }\n            else {\n                writer.write(\" \");\n            }\n        }\n        function forEachLeadingCommentToEmit(pos, cb) {\n            if (containerPos === -1 || pos !== containerPos) {\n                if (hasDetachedComments(pos)) {\n                    forEachLeadingCommentWithoutDetachedComments(cb);\n                }\n                else {\n                    ts.forEachLeadingCommentRange(currentText, pos, cb, pos);\n                }\n            }\n        }\n        function forEachTrailingCommentToEmit(end, cb) {\n            if (containerEnd === -1 || (end !== containerEnd && end !== declarationListContainerEnd)) {\n                ts.forEachTrailingCommentRange(currentText, end, cb);\n            }\n        }\n        function reset() {\n            currentSourceFile = undefined;\n            currentText = undefined;\n            currentLineMap = undefined;\n            detachedCommentsInfo = undefined;\n        }\n        function setSourceFile(sourceFile) {\n            currentSourceFile = sourceFile;\n            currentText = currentSourceFile.text;\n            currentLineMap = ts.getLineStarts(currentSourceFile);\n            detachedCommentsInfo = undefined;\n        }\n        function hasDetachedComments(pos) {\n            return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos;\n        }\n        function forEachLeadingCommentWithoutDetachedComments(cb) {\n            var pos = ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos;\n            if (detachedCommentsInfo.length - 1) {\n                detachedCommentsInfo.pop();\n            }\n            else {\n                detachedCommentsInfo = undefined;\n            }\n            ts.forEachLeadingCommentRange(currentText, pos, cb, pos);\n        }\n        function emitDetachedCommentsAndUpdateCommentsInfo(range) {\n            var currentDetachedCommentInfo = ts.emitDetachedComments(currentText, currentLineMap, writer, writeComment, range, newLine, disabled);\n            if (currentDetachedCommentInfo) {\n                if (detachedCommentsInfo) {\n                    detachedCommentsInfo.push(currentDetachedCommentInfo);\n                }\n                else {\n                    detachedCommentsInfo = [currentDetachedCommentInfo];\n                }\n            }\n        }\n        function writeComment(text, lineMap, writer, commentPos, commentEnd, newLine) {\n            emitPos(commentPos);\n            ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine);\n            emitPos(commentEnd);\n        }\n        function isTripleSlashComment(commentPos, commentEnd) {\n            if (currentText.charCodeAt(commentPos + 1) === 47 &&\n                commentPos + 2 < commentEnd &&\n                currentText.charCodeAt(commentPos + 2) === 47) {\n                var textSubStr = currentText.substring(commentPos, commentEnd);\n                return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) ||\n                    textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ?\n                    true : false;\n            }\n            return false;\n        }\n    }\n    ts.createCommentWriter = createCommentWriter;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function getDeclarationDiagnostics(host, resolver, targetSourceFile) {\n        var declarationDiagnostics = ts.createDiagnosticCollection();\n        ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile);\n        return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined);\n        function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) {\n            var declarationFilePath = _a.declarationFilePath;\n            emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit, false);\n        }\n    }\n    ts.getDeclarationDiagnostics = getDeclarationDiagnostics;\n    function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles) {\n        var newLine = host.getNewLine();\n        var compilerOptions = host.getCompilerOptions();\n        var write;\n        var writeLine;\n        var increaseIndent;\n        var decreaseIndent;\n        var writeTextOfNode;\n        var writer;\n        createAndSetNewTextWriterWithSymbolWriter();\n        var enclosingDeclaration;\n        var resultHasExternalModuleIndicator;\n        var currentText;\n        var currentLineMap;\n        var currentIdentifiers;\n        var isCurrentFileExternalModule;\n        var reportedDeclarationError = false;\n        var errorNameNode;\n        var emitJsDocComments = compilerOptions.removeComments ? ts.noop : writeJsDocComments;\n        var emit = compilerOptions.stripInternal ? stripInternal : emitNode;\n        var noDeclare;\n        var moduleElementDeclarationEmitInfo = [];\n        var asynchronousSubModuleDeclarationEmitInfo;\n        var referencesOutput = \"\";\n        var usedTypeDirectiveReferences;\n        var emittedReferencedFiles = [];\n        var addedGlobalFileReference = false;\n        var allSourcesModuleElementDeclarationEmitInfo = [];\n        ts.forEach(sourceFiles, function (sourceFile) {\n            if (ts.isSourceFileJavaScript(sourceFile)) {\n                return;\n            }\n            if (!compilerOptions.noResolve) {\n                ts.forEach(sourceFile.referencedFiles, function (fileReference) {\n                    var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference);\n                    if (referencedFile && !ts.contains(emittedReferencedFiles, referencedFile)) {\n                        if (writeReferencePath(referencedFile, !isBundledEmit && !addedGlobalFileReference, emitOnlyDtsFiles)) {\n                            addedGlobalFileReference = true;\n                        }\n                        emittedReferencedFiles.push(referencedFile);\n                    }\n                });\n            }\n            resultHasExternalModuleIndicator = false;\n            if (!isBundledEmit || !ts.isExternalModule(sourceFile)) {\n                noDeclare = false;\n                emitSourceFile(sourceFile);\n            }\n            else if (ts.isExternalModule(sourceFile)) {\n                noDeclare = true;\n                write(\"declare module \\\"\" + ts.getResolvedExternalModuleName(host, sourceFile) + \"\\\" {\");\n                writeLine();\n                increaseIndent();\n                emitSourceFile(sourceFile);\n                decreaseIndent();\n                write(\"}\");\n                writeLine();\n            }\n            if (moduleElementDeclarationEmitInfo.length) {\n                var oldWriter = writer;\n                ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) {\n                    if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) {\n                        ts.Debug.assert(aliasEmitInfo.node.kind === 235);\n                        createAndSetNewTextWriterWithSymbolWriter();\n                        ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit));\n                        for (var i = 0; i < aliasEmitInfo.indent; i++) {\n                            increaseIndent();\n                        }\n                        writeImportDeclaration(aliasEmitInfo.node);\n                        aliasEmitInfo.asynchronousOutput = writer.getText();\n                        for (var i = 0; i < aliasEmitInfo.indent; i++) {\n                            decreaseIndent();\n                        }\n                    }\n                });\n                setWriter(oldWriter);\n                allSourcesModuleElementDeclarationEmitInfo = allSourcesModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo);\n                moduleElementDeclarationEmitInfo = [];\n            }\n            if (!isBundledEmit && ts.isExternalModule(sourceFile) && sourceFile.moduleAugmentations.length && !resultHasExternalModuleIndicator) {\n                write(\"export {};\");\n                writeLine();\n            }\n        });\n        if (usedTypeDirectiveReferences) {\n            for (var directive in usedTypeDirectiveReferences) {\n                referencesOutput += \"/// <reference types=\\\"\" + directive + \"\\\" />\" + newLine;\n            }\n        }\n        return {\n            reportedDeclarationError: reportedDeclarationError,\n            moduleElementDeclarationEmitInfo: allSourcesModuleElementDeclarationEmitInfo,\n            synchronousDeclarationOutput: writer.getText(),\n            referencesOutput: referencesOutput,\n        };\n        function hasInternalAnnotation(range) {\n            var comment = currentText.substring(range.pos, range.end);\n            return comment.indexOf(\"@internal\") >= 0;\n        }\n        function stripInternal(node) {\n            if (node) {\n                var leadingCommentRanges = ts.getLeadingCommentRanges(currentText, node.pos);\n                if (ts.forEach(leadingCommentRanges, hasInternalAnnotation)) {\n                    return;\n                }\n                emitNode(node);\n            }\n        }\n        function createAndSetNewTextWriterWithSymbolWriter() {\n            var writer = ts.createTextWriter(newLine);\n            writer.trackSymbol = trackSymbol;\n            writer.reportInaccessibleThisError = reportInaccessibleThisError;\n            writer.writeKeyword = writer.write;\n            writer.writeOperator = writer.write;\n            writer.writePunctuation = writer.write;\n            writer.writeSpace = writer.write;\n            writer.writeStringLiteral = writer.writeLiteral;\n            writer.writeParameter = writer.write;\n            writer.writeSymbol = writer.write;\n            setWriter(writer);\n        }\n        function setWriter(newWriter) {\n            writer = newWriter;\n            write = newWriter.write;\n            writeTextOfNode = newWriter.writeTextOfNode;\n            writeLine = newWriter.writeLine;\n            increaseIndent = newWriter.increaseIndent;\n            decreaseIndent = newWriter.decreaseIndent;\n        }\n        function writeAsynchronousModuleElements(nodes) {\n            var oldWriter = writer;\n            ts.forEach(nodes, function (declaration) {\n                var nodeToCheck;\n                if (declaration.kind === 223) {\n                    nodeToCheck = declaration.parent.parent;\n                }\n                else if (declaration.kind === 238 || declaration.kind === 239 || declaration.kind === 236) {\n                    ts.Debug.fail(\"We should be getting ImportDeclaration instead to write\");\n                }\n                else {\n                    nodeToCheck = declaration;\n                }\n                var moduleElementEmitInfo = ts.forEach(moduleElementDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; });\n                if (!moduleElementEmitInfo && asynchronousSubModuleDeclarationEmitInfo) {\n                    moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; });\n                }\n                if (moduleElementEmitInfo) {\n                    if (moduleElementEmitInfo.node.kind === 235) {\n                        moduleElementEmitInfo.isVisible = true;\n                    }\n                    else {\n                        createAndSetNewTextWriterWithSymbolWriter();\n                        for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) {\n                            increaseIndent();\n                        }\n                        if (nodeToCheck.kind === 230) {\n                            ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined);\n                            asynchronousSubModuleDeclarationEmitInfo = [];\n                        }\n                        writeModuleElement(nodeToCheck);\n                        if (nodeToCheck.kind === 230) {\n                            moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo;\n                            asynchronousSubModuleDeclarationEmitInfo = undefined;\n                        }\n                        moduleElementEmitInfo.asynchronousOutput = writer.getText();\n                    }\n                }\n            });\n            setWriter(oldWriter);\n        }\n        function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) {\n            if (!typeReferenceDirectives) {\n                return;\n            }\n            if (!usedTypeDirectiveReferences) {\n                usedTypeDirectiveReferences = ts.createMap();\n            }\n            for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) {\n                var directive = typeReferenceDirectives_1[_i];\n                if (!(directive in usedTypeDirectiveReferences)) {\n                    usedTypeDirectiveReferences[directive] = directive;\n                }\n            }\n        }\n        function handleSymbolAccessibilityError(symbolAccessibilityResult) {\n            if (symbolAccessibilityResult.accessibility === 0) {\n                if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) {\n                    writeAsynchronousModuleElements(symbolAccessibilityResult.aliasesToMakeVisible);\n                }\n            }\n            else {\n                reportedDeclarationError = true;\n                var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccessibilityResult);\n                if (errorInfo) {\n                    if (errorInfo.typeName) {\n                        emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName));\n                    }\n                    else {\n                        emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName));\n                    }\n                }\n            }\n        }\n        function trackSymbol(symbol, enclosingDeclaration, meaning) {\n            handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, true));\n            recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning));\n        }\n        function reportInaccessibleThisError() {\n            if (errorNameNode) {\n                reportedDeclarationError = true;\n                emitterDiagnostics.add(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode)));\n            }\n        }\n        function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) {\n            writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic;\n            write(\": \");\n            if (type) {\n                emitType(type);\n            }\n            else {\n                errorNameNode = declaration.name;\n                resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 | 1024, writer);\n                errorNameNode = undefined;\n            }\n        }\n        function writeReturnTypeAtSignature(signature, getSymbolAccessibilityDiagnostic) {\n            writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic;\n            write(\": \");\n            if (signature.type) {\n                emitType(signature.type);\n            }\n            else {\n                errorNameNode = signature.name;\n                resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 | 1024, writer);\n                errorNameNode = undefined;\n            }\n        }\n        function emitLines(nodes) {\n            for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {\n                var node = nodes_4[_i];\n                emit(node);\n            }\n        }\n        function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) {\n            var currentWriterPos = writer.getTextPos();\n            for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) {\n                var node = nodes_5[_i];\n                if (!canEmitFn || canEmitFn(node)) {\n                    if (currentWriterPos !== writer.getTextPos()) {\n                        write(separator);\n                    }\n                    currentWriterPos = writer.getTextPos();\n                    eachNodeEmitFn(node);\n                }\n            }\n        }\n        function emitCommaList(nodes, eachNodeEmitFn, canEmitFn) {\n            emitSeparatedList(nodes, \", \", eachNodeEmitFn, canEmitFn);\n        }\n        function writeJsDocComments(declaration) {\n            if (declaration) {\n                var jsDocComments = ts.getJSDocCommentRanges(declaration, currentText);\n                ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments);\n                ts.emitComments(currentText, currentLineMap, writer, jsDocComments, false, true, newLine, ts.writeCommentRange);\n            }\n        }\n        function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type, getSymbolAccessibilityDiagnostic) {\n            writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic;\n            emitType(type);\n        }\n        function emitType(type) {\n            switch (type.kind) {\n                case 118:\n                case 134:\n                case 132:\n                case 121:\n                case 135:\n                case 104:\n                case 137:\n                case 94:\n                case 129:\n                case 167:\n                case 171:\n                    return writeTextOfNode(currentText, type);\n                case 199:\n                    return emitExpressionWithTypeArguments(type);\n                case 157:\n                    return emitTypeReference(type);\n                case 160:\n                    return emitTypeQuery(type);\n                case 162:\n                    return emitArrayType(type);\n                case 163:\n                    return emitTupleType(type);\n                case 164:\n                    return emitUnionType(type);\n                case 165:\n                    return emitIntersectionType(type);\n                case 166:\n                    return emitParenType(type);\n                case 168:\n                    return emitTypeOperator(type);\n                case 169:\n                    return emitIndexedAccessType(type);\n                case 170:\n                    return emitMappedType(type);\n                case 158:\n                case 159:\n                    return emitSignatureDeclarationWithJsDocComments(type);\n                case 161:\n                    return emitTypeLiteral(type);\n                case 70:\n                    return emitEntityName(type);\n                case 141:\n                    return emitEntityName(type);\n                case 156:\n                    return emitTypePredicate(type);\n            }\n            function writeEntityName(entityName) {\n                if (entityName.kind === 70) {\n                    writeTextOfNode(currentText, entityName);\n                }\n                else {\n                    var left = entityName.kind === 141 ? entityName.left : entityName.expression;\n                    var right = entityName.kind === 141 ? entityName.right : entityName.name;\n                    writeEntityName(left);\n                    write(\".\");\n                    writeTextOfNode(currentText, right);\n                }\n            }\n            function emitEntityName(entityName) {\n                var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 234 ? entityName.parent : enclosingDeclaration);\n                handleSymbolAccessibilityError(visibilityResult);\n                recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName));\n                writeEntityName(entityName);\n            }\n            function emitExpressionWithTypeArguments(node) {\n                if (ts.isEntityNameExpression(node.expression)) {\n                    ts.Debug.assert(node.expression.kind === 70 || node.expression.kind === 177);\n                    emitEntityName(node.expression);\n                    if (node.typeArguments) {\n                        write(\"<\");\n                        emitCommaList(node.typeArguments, emitType);\n                        write(\">\");\n                    }\n                }\n            }\n            function emitTypeReference(type) {\n                emitEntityName(type.typeName);\n                if (type.typeArguments) {\n                    write(\"<\");\n                    emitCommaList(type.typeArguments, emitType);\n                    write(\">\");\n                }\n            }\n            function emitTypePredicate(type) {\n                writeTextOfNode(currentText, type.parameterName);\n                write(\" is \");\n                emitType(type.type);\n            }\n            function emitTypeQuery(type) {\n                write(\"typeof \");\n                emitEntityName(type.exprName);\n            }\n            function emitArrayType(type) {\n                emitType(type.elementType);\n                write(\"[]\");\n            }\n            function emitTupleType(type) {\n                write(\"[\");\n                emitCommaList(type.elementTypes, emitType);\n                write(\"]\");\n            }\n            function emitUnionType(type) {\n                emitSeparatedList(type.types, \" | \", emitType);\n            }\n            function emitIntersectionType(type) {\n                emitSeparatedList(type.types, \" & \", emitType);\n            }\n            function emitParenType(type) {\n                write(\"(\");\n                emitType(type.type);\n                write(\")\");\n            }\n            function emitTypeOperator(type) {\n                write(ts.tokenToString(type.operator));\n                write(\" \");\n                emitType(type.type);\n            }\n            function emitIndexedAccessType(node) {\n                emitType(node.objectType);\n                write(\"[\");\n                emitType(node.indexType);\n                write(\"]\");\n            }\n            function emitMappedType(node) {\n                var prevEnclosingDeclaration = enclosingDeclaration;\n                enclosingDeclaration = node;\n                write(\"{\");\n                writeLine();\n                increaseIndent();\n                if (node.readonlyToken) {\n                    write(\"readonly \");\n                }\n                write(\"[\");\n                writeEntityName(node.typeParameter.name);\n                write(\" in \");\n                emitType(node.typeParameter.constraint);\n                write(\"]\");\n                if (node.questionToken) {\n                    write(\"?\");\n                }\n                write(\": \");\n                emitType(node.type);\n                write(\";\");\n                writeLine();\n                decreaseIndent();\n                write(\"}\");\n                enclosingDeclaration = prevEnclosingDeclaration;\n            }\n            function emitTypeLiteral(type) {\n                write(\"{\");\n                if (type.members.length) {\n                    writeLine();\n                    increaseIndent();\n                    emitLines(type.members);\n                    decreaseIndent();\n                }\n                write(\"}\");\n            }\n        }\n        function emitSourceFile(node) {\n            currentText = node.text;\n            currentLineMap = ts.getLineStarts(node);\n            currentIdentifiers = node.identifiers;\n            isCurrentFileExternalModule = ts.isExternalModule(node);\n            enclosingDeclaration = node;\n            ts.emitDetachedComments(currentText, currentLineMap, writer, ts.writeCommentRange, node, newLine, true);\n            emitLines(node.statements);\n        }\n        function getExportDefaultTempVariableName() {\n            var baseName = \"_default\";\n            if (!(baseName in currentIdentifiers)) {\n                return baseName;\n            }\n            var count = 0;\n            while (true) {\n                count++;\n                var name_39 = baseName + \"_\" + count;\n                if (!(name_39 in currentIdentifiers)) {\n                    return name_39;\n                }\n            }\n        }\n        function emitExportAssignment(node) {\n            if (node.expression.kind === 70) {\n                write(node.isExportEquals ? \"export = \" : \"export default \");\n                writeTextOfNode(currentText, node.expression);\n            }\n            else {\n                var tempVarName = getExportDefaultTempVariableName();\n                if (!noDeclare) {\n                    write(\"declare \");\n                }\n                write(\"var \");\n                write(tempVarName);\n                write(\": \");\n                writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;\n                resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 | 1024, writer);\n                write(\";\");\n                writeLine();\n                write(node.isExportEquals ? \"export = \" : \"export default \");\n                write(tempVarName);\n            }\n            write(\";\");\n            writeLine();\n            if (node.expression.kind === 70) {\n                var nodes = resolver.collectLinkedAliases(node.expression);\n                writeAsynchronousModuleElements(nodes);\n            }\n            function getDefaultExportAccessibilityDiagnostic() {\n                return {\n                    diagnosticMessage: ts.Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0,\n                    errorNode: node\n                };\n            }\n        }\n        function isModuleElementVisible(node) {\n            return resolver.isDeclarationVisible(node);\n        }\n        function emitModuleElement(node, isModuleElementVisible) {\n            if (isModuleElementVisible) {\n                writeModuleElement(node);\n            }\n            else if (node.kind === 234 ||\n                (node.parent.kind === 261 && isCurrentFileExternalModule)) {\n                var isVisible = void 0;\n                if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 261) {\n                    asynchronousSubModuleDeclarationEmitInfo.push({\n                        node: node,\n                        outputPos: writer.getTextPos(),\n                        indent: writer.getIndent(),\n                        isVisible: isVisible\n                    });\n                }\n                else {\n                    if (node.kind === 235) {\n                        var importDeclaration = node;\n                        if (importDeclaration.importClause) {\n                            isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) ||\n                                isVisibleNamedBinding(importDeclaration.importClause.namedBindings);\n                        }\n                    }\n                    moduleElementDeclarationEmitInfo.push({\n                        node: node,\n                        outputPos: writer.getTextPos(),\n                        indent: writer.getIndent(),\n                        isVisible: isVisible\n                    });\n                }\n            }\n        }\n        function writeModuleElement(node) {\n            switch (node.kind) {\n                case 225:\n                    return writeFunctionDeclaration(node);\n                case 205:\n                    return writeVariableStatement(node);\n                case 227:\n                    return writeInterfaceDeclaration(node);\n                case 226:\n                    return writeClassDeclaration(node);\n                case 228:\n                    return writeTypeAliasDeclaration(node);\n                case 229:\n                    return writeEnumDeclaration(node);\n                case 230:\n                    return writeModuleDeclaration(node);\n                case 234:\n                    return writeImportEqualsDeclaration(node);\n                case 235:\n                    return writeImportDeclaration(node);\n                default:\n                    ts.Debug.fail(\"Unknown symbol kind\");\n            }\n        }\n        function emitModuleElementDeclarationFlags(node) {\n            if (node.parent.kind === 261) {\n                var modifiers = ts.getModifierFlags(node);\n                if (modifiers & 1) {\n                    write(\"export \");\n                }\n                if (modifiers & 512) {\n                    write(\"default \");\n                }\n                else if (node.kind !== 227 && !noDeclare) {\n                    write(\"declare \");\n                }\n            }\n        }\n        function emitClassMemberDeclarationFlags(flags) {\n            if (flags & 8) {\n                write(\"private \");\n            }\n            else if (flags & 16) {\n                write(\"protected \");\n            }\n            if (flags & 32) {\n                write(\"static \");\n            }\n            if (flags & 64) {\n                write(\"readonly \");\n            }\n            if (flags & 128) {\n                write(\"abstract \");\n            }\n        }\n        function writeImportEqualsDeclaration(node) {\n            emitJsDocComments(node);\n            if (ts.hasModifier(node, 1)) {\n                write(\"export \");\n            }\n            write(\"import \");\n            writeTextOfNode(currentText, node.name);\n            write(\" = \");\n            if (ts.isInternalModuleImportEqualsDeclaration(node)) {\n                emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.moduleReference, getImportEntityNameVisibilityError);\n                write(\";\");\n            }\n            else {\n                write(\"require(\");\n                emitExternalModuleSpecifier(node);\n                write(\");\");\n            }\n            writer.writeLine();\n            function getImportEntityNameVisibilityError() {\n                return {\n                    diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1,\n                    errorNode: node,\n                    typeName: node.name\n                };\n            }\n        }\n        function isVisibleNamedBinding(namedBindings) {\n            if (namedBindings) {\n                if (namedBindings.kind === 237) {\n                    return resolver.isDeclarationVisible(namedBindings);\n                }\n                else {\n                    return ts.forEach(namedBindings.elements, function (namedImport) { return resolver.isDeclarationVisible(namedImport); });\n                }\n            }\n        }\n        function writeImportDeclaration(node) {\n            emitJsDocComments(node);\n            if (ts.hasModifier(node, 1)) {\n                write(\"export \");\n            }\n            write(\"import \");\n            if (node.importClause) {\n                var currentWriterPos = writer.getTextPos();\n                if (node.importClause.name && resolver.isDeclarationVisible(node.importClause)) {\n                    writeTextOfNode(currentText, node.importClause.name);\n                }\n                if (node.importClause.namedBindings && isVisibleNamedBinding(node.importClause.namedBindings)) {\n                    if (currentWriterPos !== writer.getTextPos()) {\n                        write(\", \");\n                    }\n                    if (node.importClause.namedBindings.kind === 237) {\n                        write(\"* as \");\n                        writeTextOfNode(currentText, node.importClause.namedBindings.name);\n                    }\n                    else {\n                        write(\"{ \");\n                        emitCommaList(node.importClause.namedBindings.elements, emitImportOrExportSpecifier, resolver.isDeclarationVisible);\n                        write(\" }\");\n                    }\n                }\n                write(\" from \");\n            }\n            emitExternalModuleSpecifier(node);\n            write(\";\");\n            writer.writeLine();\n        }\n        function emitExternalModuleSpecifier(parent) {\n            resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 230;\n            var moduleSpecifier;\n            if (parent.kind === 234) {\n                var node = parent;\n                moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node);\n            }\n            else if (parent.kind === 230) {\n                moduleSpecifier = parent.name;\n            }\n            else {\n                var node = parent;\n                moduleSpecifier = node.moduleSpecifier;\n            }\n            if (moduleSpecifier.kind === 9 && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) {\n                var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, parent);\n                if (moduleName) {\n                    write('\"');\n                    write(moduleName);\n                    write('\"');\n                    return;\n                }\n            }\n            writeTextOfNode(currentText, moduleSpecifier);\n        }\n        function emitImportOrExportSpecifier(node) {\n            if (node.propertyName) {\n                writeTextOfNode(currentText, node.propertyName);\n                write(\" as \");\n            }\n            writeTextOfNode(currentText, node.name);\n        }\n        function emitExportSpecifier(node) {\n            emitImportOrExportSpecifier(node);\n            var nodes = resolver.collectLinkedAliases(node.propertyName || node.name);\n            writeAsynchronousModuleElements(nodes);\n        }\n        function emitExportDeclaration(node) {\n            emitJsDocComments(node);\n            write(\"export \");\n            if (node.exportClause) {\n                write(\"{ \");\n                emitCommaList(node.exportClause.elements, emitExportSpecifier);\n                write(\" }\");\n            }\n            else {\n                write(\"*\");\n            }\n            if (node.moduleSpecifier) {\n                write(\" from \");\n                emitExternalModuleSpecifier(node);\n            }\n            write(\";\");\n            writer.writeLine();\n        }\n        function writeModuleDeclaration(node) {\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            if (ts.isGlobalScopeAugmentation(node)) {\n                write(\"global \");\n            }\n            else {\n                if (node.flags & 16) {\n                    write(\"namespace \");\n                }\n                else {\n                    write(\"module \");\n                }\n                if (ts.isExternalModuleAugmentation(node)) {\n                    emitExternalModuleSpecifier(node);\n                }\n                else {\n                    writeTextOfNode(currentText, node.name);\n                }\n            }\n            while (node.body && node.body.kind !== 231) {\n                node = node.body;\n                write(\".\");\n                writeTextOfNode(currentText, node.name);\n            }\n            var prevEnclosingDeclaration = enclosingDeclaration;\n            if (node.body) {\n                enclosingDeclaration = node;\n                write(\" {\");\n                writeLine();\n                increaseIndent();\n                emitLines(node.body.statements);\n                decreaseIndent();\n                write(\"}\");\n                writeLine();\n                enclosingDeclaration = prevEnclosingDeclaration;\n            }\n            else {\n                write(\";\");\n            }\n        }\n        function writeTypeAliasDeclaration(node) {\n            var prevEnclosingDeclaration = enclosingDeclaration;\n            enclosingDeclaration = node;\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            write(\"type \");\n            writeTextOfNode(currentText, node.name);\n            emitTypeParameters(node.typeParameters);\n            write(\" = \");\n            emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError);\n            write(\";\");\n            writeLine();\n            enclosingDeclaration = prevEnclosingDeclaration;\n            function getTypeAliasDeclarationVisibilityError() {\n                return {\n                    diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1,\n                    errorNode: node.type,\n                    typeName: node.name\n                };\n            }\n        }\n        function writeEnumDeclaration(node) {\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            if (ts.isConst(node)) {\n                write(\"const \");\n            }\n            write(\"enum \");\n            writeTextOfNode(currentText, node.name);\n            write(\" {\");\n            writeLine();\n            increaseIndent();\n            emitLines(node.members);\n            decreaseIndent();\n            write(\"}\");\n            writeLine();\n        }\n        function emitEnumMemberDeclaration(node) {\n            emitJsDocComments(node);\n            writeTextOfNode(currentText, node.name);\n            var enumMemberValue = resolver.getConstantValue(node);\n            if (enumMemberValue !== undefined) {\n                write(\" = \");\n                write(enumMemberValue.toString());\n            }\n            write(\",\");\n            writeLine();\n        }\n        function isPrivateMethodTypeParameter(node) {\n            return node.parent.kind === 149 && ts.hasModifier(node.parent, 8);\n        }\n        function emitTypeParameters(typeParameters) {\n            function emitTypeParameter(node) {\n                increaseIndent();\n                emitJsDocComments(node);\n                decreaseIndent();\n                writeTextOfNode(currentText, node.name);\n                if (node.constraint && !isPrivateMethodTypeParameter(node)) {\n                    write(\" extends \");\n                    if (node.parent.kind === 158 ||\n                        node.parent.kind === 159 ||\n                        (node.parent.parent && node.parent.parent.kind === 161)) {\n                        ts.Debug.assert(node.parent.kind === 149 ||\n                            node.parent.kind === 148 ||\n                            node.parent.kind === 158 ||\n                            node.parent.kind === 159 ||\n                            node.parent.kind === 153 ||\n                            node.parent.kind === 154);\n                        emitType(node.constraint);\n                    }\n                    else {\n                        emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError);\n                    }\n                }\n                function getTypeParameterConstraintVisibilityError() {\n                    var diagnosticMessage;\n                    switch (node.parent.kind) {\n                        case 226:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1;\n                            break;\n                        case 227:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;\n                            break;\n                        case 154:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;\n                            break;\n                        case 153:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;\n                            break;\n                        case 149:\n                        case 148:\n                            if (ts.hasModifier(node.parent, 32)) {\n                                diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;\n                            }\n                            else if (node.parent.parent.kind === 226) {\n                                diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;\n                            }\n                            else {\n                                diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;\n                            }\n                            break;\n                        case 225:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;\n                            break;\n                        case 228:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;\n                            break;\n                        default:\n                            ts.Debug.fail(\"This is unknown parent for type parameter: \" + node.parent.kind);\n                    }\n                    return {\n                        diagnosticMessage: diagnosticMessage,\n                        errorNode: node,\n                        typeName: node.name\n                    };\n                }\n            }\n            if (typeParameters) {\n                write(\"<\");\n                emitCommaList(typeParameters, emitTypeParameter);\n                write(\">\");\n            }\n        }\n        function emitHeritageClause(typeReferences, isImplementsList) {\n            if (typeReferences) {\n                write(isImplementsList ? \" implements \" : \" extends \");\n                emitCommaList(typeReferences, emitTypeOfTypeReference);\n            }\n            function emitTypeOfTypeReference(node) {\n                if (ts.isEntityNameExpression(node.expression)) {\n                    emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError);\n                }\n                else if (!isImplementsList && node.expression.kind === 94) {\n                    write(\"null\");\n                }\n                else {\n                    writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError;\n                    resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 | 1024, writer);\n                }\n                function getHeritageClauseVisibilityError() {\n                    var diagnosticMessage;\n                    if (node.parent.parent.kind === 226) {\n                        diagnosticMessage = isImplementsList ?\n                            ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :\n                            ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1;\n                    }\n                    else {\n                        diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1;\n                    }\n                    return {\n                        diagnosticMessage: diagnosticMessage,\n                        errorNode: node,\n                        typeName: node.parent.parent.name\n                    };\n                }\n            }\n        }\n        function writeClassDeclaration(node) {\n            function emitParameterProperties(constructorDeclaration) {\n                if (constructorDeclaration) {\n                    ts.forEach(constructorDeclaration.parameters, function (param) {\n                        if (ts.hasModifier(param, 92)) {\n                            emitPropertyDeclaration(param);\n                        }\n                    });\n                }\n            }\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            if (ts.hasModifier(node, 128)) {\n                write(\"abstract \");\n            }\n            write(\"class \");\n            writeTextOfNode(currentText, node.name);\n            var prevEnclosingDeclaration = enclosingDeclaration;\n            enclosingDeclaration = node;\n            emitTypeParameters(node.typeParameters);\n            var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node);\n            if (baseTypeNode) {\n                emitHeritageClause([baseTypeNode], false);\n            }\n            emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), true);\n            write(\" {\");\n            writeLine();\n            increaseIndent();\n            emitParameterProperties(ts.getFirstConstructorWithBody(node));\n            emitLines(node.members);\n            decreaseIndent();\n            write(\"}\");\n            writeLine();\n            enclosingDeclaration = prevEnclosingDeclaration;\n        }\n        function writeInterfaceDeclaration(node) {\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            write(\"interface \");\n            writeTextOfNode(currentText, node.name);\n            var prevEnclosingDeclaration = enclosingDeclaration;\n            enclosingDeclaration = node;\n            emitTypeParameters(node.typeParameters);\n            var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); });\n            if (interfaceExtendsTypes && interfaceExtendsTypes.length) {\n                emitHeritageClause(interfaceExtendsTypes, false);\n            }\n            write(\" {\");\n            writeLine();\n            increaseIndent();\n            emitLines(node.members);\n            decreaseIndent();\n            write(\"}\");\n            writeLine();\n            enclosingDeclaration = prevEnclosingDeclaration;\n        }\n        function emitPropertyDeclaration(node) {\n            if (ts.hasDynamicName(node)) {\n                return;\n            }\n            emitJsDocComments(node);\n            emitClassMemberDeclarationFlags(ts.getModifierFlags(node));\n            emitVariableDeclaration(node);\n            write(\";\");\n            writeLine();\n        }\n        function emitVariableDeclaration(node) {\n            if (node.kind !== 223 || resolver.isDeclarationVisible(node)) {\n                if (ts.isBindingPattern(node.name)) {\n                    emitBindingPattern(node.name);\n                }\n                else {\n                    writeTextOfNode(currentText, node.name);\n                    if ((node.kind === 147 || node.kind === 146 ||\n                        (node.kind === 144 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) {\n                        write(\"?\");\n                    }\n                    if ((node.kind === 147 || node.kind === 146) && node.parent.kind === 161) {\n                        emitTypeOfVariableDeclarationFromTypeLiteral(node);\n                    }\n                    else if (resolver.isLiteralConstDeclaration(node)) {\n                        write(\" = \");\n                        resolver.writeLiteralConstValue(node, writer);\n                    }\n                    else if (!ts.hasModifier(node, 8)) {\n                        writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError);\n                    }\n                }\n            }\n            function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {\n                if (node.kind === 223) {\n                    return symbolAccessibilityResult.errorModuleName ?\n                        symbolAccessibilityResult.accessibility === 2 ?\n                            ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                            ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 :\n                        ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;\n                }\n                else if (node.kind === 147 || node.kind === 146) {\n                    if (ts.hasModifier(node, 32)) {\n                        return symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 ?\n                                ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;\n                    }\n                    else if (node.parent.kind === 226) {\n                        return symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 ?\n                                ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1;\n                    }\n                    else {\n                        return symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1;\n                    }\n                }\n            }\n            function getVariableDeclarationTypeVisibilityError(symbolAccessibilityResult) {\n                var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);\n                return diagnosticMessage !== undefined ? {\n                    diagnosticMessage: diagnosticMessage,\n                    errorNode: node,\n                    typeName: node.name\n                } : undefined;\n            }\n            function emitBindingPattern(bindingPattern) {\n                var elements = [];\n                for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (element.kind !== 198) {\n                        elements.push(element);\n                    }\n                }\n                emitCommaList(elements, emitBindingElement);\n            }\n            function emitBindingElement(bindingElement) {\n                function getBindingElementTypeVisibilityError(symbolAccessibilityResult) {\n                    var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);\n                    return diagnosticMessage !== undefined ? {\n                        diagnosticMessage: diagnosticMessage,\n                        errorNode: bindingElement,\n                        typeName: bindingElement.name\n                    } : undefined;\n                }\n                if (bindingElement.name) {\n                    if (ts.isBindingPattern(bindingElement.name)) {\n                        emitBindingPattern(bindingElement.name);\n                    }\n                    else {\n                        writeTextOfNode(currentText, bindingElement.name);\n                        writeTypeOfDeclaration(bindingElement, undefined, getBindingElementTypeVisibilityError);\n                    }\n                }\n            }\n        }\n        function emitTypeOfVariableDeclarationFromTypeLiteral(node) {\n            if (node.type) {\n                write(\": \");\n                emitType(node.type);\n            }\n        }\n        function isVariableStatementVisible(node) {\n            return ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); });\n        }\n        function writeVariableStatement(node) {\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            if (ts.isLet(node.declarationList)) {\n                write(\"let \");\n            }\n            else if (ts.isConst(node.declarationList)) {\n                write(\"const \");\n            }\n            else {\n                write(\"var \");\n            }\n            emitCommaList(node.declarationList.declarations, emitVariableDeclaration, resolver.isDeclarationVisible);\n            write(\";\");\n            writeLine();\n        }\n        function emitAccessorDeclaration(node) {\n            if (ts.hasDynamicName(node)) {\n                return;\n            }\n            var accessors = ts.getAllAccessorDeclarations(node.parent.members, node);\n            var accessorWithTypeAnnotation;\n            if (node === accessors.firstAccessor) {\n                emitJsDocComments(accessors.getAccessor);\n                emitJsDocComments(accessors.setAccessor);\n                emitClassMemberDeclarationFlags(ts.getModifierFlags(node) | (accessors.setAccessor ? 0 : 64));\n                writeTextOfNode(currentText, node.name);\n                if (!ts.hasModifier(node, 8)) {\n                    accessorWithTypeAnnotation = node;\n                    var type = getTypeAnnotationFromAccessor(node);\n                    if (!type) {\n                        var anotherAccessor = node.kind === 151 ? accessors.setAccessor : accessors.getAccessor;\n                        type = getTypeAnnotationFromAccessor(anotherAccessor);\n                        if (type) {\n                            accessorWithTypeAnnotation = anotherAccessor;\n                        }\n                    }\n                    writeTypeOfDeclaration(node, type, getAccessorDeclarationTypeVisibilityError);\n                }\n                write(\";\");\n                writeLine();\n            }\n            function getTypeAnnotationFromAccessor(accessor) {\n                if (accessor) {\n                    return accessor.kind === 151\n                        ? accessor.type\n                        : accessor.parameters.length > 0\n                            ? accessor.parameters[0].type\n                            : undefined;\n                }\n            }\n            function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) {\n                var diagnosticMessage;\n                if (accessorWithTypeAnnotation.kind === 152) {\n                    if (ts.hasModifier(accessorWithTypeAnnotation.parent, 32)) {\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1;\n                    }\n                    else {\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1;\n                    }\n                    return {\n                        diagnosticMessage: diagnosticMessage,\n                        errorNode: accessorWithTypeAnnotation.parameters[0],\n                        typeName: accessorWithTypeAnnotation.name\n                    };\n                }\n                else {\n                    if (ts.hasModifier(accessorWithTypeAnnotation, 32)) {\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 ?\n                                ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :\n                                ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0;\n                    }\n                    else {\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 ?\n                                ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :\n                                ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0;\n                    }\n                    return {\n                        diagnosticMessage: diagnosticMessage,\n                        errorNode: accessorWithTypeAnnotation.name,\n                        typeName: undefined\n                    };\n                }\n            }\n        }\n        function writeFunctionDeclaration(node) {\n            if (ts.hasDynamicName(node)) {\n                return;\n            }\n            if (!resolver.isImplementationOfOverload(node)) {\n                emitJsDocComments(node);\n                if (node.kind === 225) {\n                    emitModuleElementDeclarationFlags(node);\n                }\n                else if (node.kind === 149 || node.kind === 150) {\n                    emitClassMemberDeclarationFlags(ts.getModifierFlags(node));\n                }\n                if (node.kind === 225) {\n                    write(\"function \");\n                    writeTextOfNode(currentText, node.name);\n                }\n                else if (node.kind === 150) {\n                    write(\"constructor\");\n                }\n                else {\n                    writeTextOfNode(currentText, node.name);\n                    if (ts.hasQuestionToken(node)) {\n                        write(\"?\");\n                    }\n                }\n                emitSignatureDeclaration(node);\n            }\n        }\n        function emitSignatureDeclarationWithJsDocComments(node) {\n            emitJsDocComments(node);\n            emitSignatureDeclaration(node);\n        }\n        function emitSignatureDeclaration(node) {\n            var prevEnclosingDeclaration = enclosingDeclaration;\n            enclosingDeclaration = node;\n            var closeParenthesizedFunctionType = false;\n            if (node.kind === 155) {\n                emitClassMemberDeclarationFlags(ts.getModifierFlags(node));\n                write(\"[\");\n            }\n            else {\n                if (node.kind === 154 || node.kind === 159) {\n                    write(\"new \");\n                }\n                else if (node.kind === 158) {\n                    var currentOutput = writer.getText();\n                    if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === \"<\") {\n                        closeParenthesizedFunctionType = true;\n                        write(\"(\");\n                    }\n                }\n                emitTypeParameters(node.typeParameters);\n                write(\"(\");\n            }\n            emitCommaList(node.parameters, emitParameterDeclaration);\n            if (node.kind === 155) {\n                write(\"]\");\n            }\n            else {\n                write(\")\");\n            }\n            var isFunctionTypeOrConstructorType = node.kind === 158 || node.kind === 159;\n            if (isFunctionTypeOrConstructorType || node.parent.kind === 161) {\n                if (node.type) {\n                    write(isFunctionTypeOrConstructorType ? \" => \" : \": \");\n                    emitType(node.type);\n                }\n            }\n            else if (node.kind !== 150 && !ts.hasModifier(node, 8)) {\n                writeReturnTypeAtSignature(node, getReturnTypeVisibilityError);\n            }\n            enclosingDeclaration = prevEnclosingDeclaration;\n            if (!isFunctionTypeOrConstructorType) {\n                write(\";\");\n                writeLine();\n            }\n            else if (closeParenthesizedFunctionType) {\n                write(\")\");\n            }\n            function getReturnTypeVisibilityError(symbolAccessibilityResult) {\n                var diagnosticMessage;\n                switch (node.kind) {\n                    case 154:\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;\n                        break;\n                    case 153:\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;\n                        break;\n                    case 155:\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;\n                        break;\n                    case 149:\n                    case 148:\n                        if (ts.hasModifier(node, 32)) {\n                            diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                                symbolAccessibilityResult.accessibility === 2 ?\n                                    ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :\n                                    ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :\n                                ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0;\n                        }\n                        else if (node.parent.kind === 226) {\n                            diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                                symbolAccessibilityResult.accessibility === 2 ?\n                                    ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :\n                                    ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :\n                                ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0;\n                        }\n                        else {\n                            diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                                ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :\n                                ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;\n                        }\n                        break;\n                    case 225:\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 ?\n                                ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :\n                                ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0;\n                        break;\n                    default:\n                        ts.Debug.fail(\"This is unknown kind for signature: \" + node.kind);\n                }\n                return {\n                    diagnosticMessage: diagnosticMessage,\n                    errorNode: node.name || node\n                };\n            }\n        }\n        function emitParameterDeclaration(node) {\n            increaseIndent();\n            emitJsDocComments(node);\n            if (node.dotDotDotToken) {\n                write(\"...\");\n            }\n            if (ts.isBindingPattern(node.name)) {\n                emitBindingPattern(node.name);\n            }\n            else {\n                writeTextOfNode(currentText, node.name);\n            }\n            if (resolver.isOptionalParameter(node)) {\n                write(\"?\");\n            }\n            decreaseIndent();\n            if (node.parent.kind === 158 ||\n                node.parent.kind === 159 ||\n                node.parent.parent.kind === 161) {\n                emitTypeOfVariableDeclarationFromTypeLiteral(node);\n            }\n            else if (!ts.hasModifier(node.parent, 8)) {\n                writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError);\n            }\n            function getParameterDeclarationTypeVisibilityError(symbolAccessibilityResult) {\n                var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);\n                return diagnosticMessage !== undefined ? {\n                    diagnosticMessage: diagnosticMessage,\n                    errorNode: node,\n                    typeName: node.name\n                } : undefined;\n            }\n            function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {\n                switch (node.parent.kind) {\n                    case 150:\n                        return symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 ?\n                                ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;\n                    case 154:\n                        return symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;\n                    case 153:\n                        return symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;\n                    case 155:\n                        return symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1;\n                    case 149:\n                    case 148:\n                        if (ts.hasModifier(node.parent, 32)) {\n                            return symbolAccessibilityResult.errorModuleName ?\n                                symbolAccessibilityResult.accessibility === 2 ?\n                                    ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                    ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                                ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;\n                        }\n                        else if (node.parent.parent.kind === 226) {\n                            return symbolAccessibilityResult.errorModuleName ?\n                                symbolAccessibilityResult.accessibility === 2 ?\n                                    ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                    ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                                ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;\n                        }\n                        else {\n                            return symbolAccessibilityResult.errorModuleName ?\n                                ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :\n                                ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;\n                        }\n                    case 225:\n                        return symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 ?\n                                ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1;\n                    default:\n                        ts.Debug.fail(\"This is unknown parent for parameter: \" + node.parent.kind);\n                }\n            }\n            function emitBindingPattern(bindingPattern) {\n                if (bindingPattern.kind === 172) {\n                    write(\"{\");\n                    emitCommaList(bindingPattern.elements, emitBindingElement);\n                    write(\"}\");\n                }\n                else if (bindingPattern.kind === 173) {\n                    write(\"[\");\n                    var elements = bindingPattern.elements;\n                    emitCommaList(elements, emitBindingElement);\n                    if (elements && elements.hasTrailingComma) {\n                        write(\", \");\n                    }\n                    write(\"]\");\n                }\n            }\n            function emitBindingElement(bindingElement) {\n                if (bindingElement.kind === 198) {\n                    write(\" \");\n                }\n                else if (bindingElement.kind === 174) {\n                    if (bindingElement.propertyName) {\n                        writeTextOfNode(currentText, bindingElement.propertyName);\n                        write(\": \");\n                    }\n                    if (bindingElement.name) {\n                        if (ts.isBindingPattern(bindingElement.name)) {\n                            emitBindingPattern(bindingElement.name);\n                        }\n                        else {\n                            ts.Debug.assert(bindingElement.name.kind === 70);\n                            if (bindingElement.dotDotDotToken) {\n                                write(\"...\");\n                            }\n                            writeTextOfNode(currentText, bindingElement.name);\n                        }\n                    }\n                }\n            }\n        }\n        function emitNode(node) {\n            switch (node.kind) {\n                case 225:\n                case 230:\n                case 234:\n                case 227:\n                case 226:\n                case 228:\n                case 229:\n                    return emitModuleElement(node, isModuleElementVisible(node));\n                case 205:\n                    return emitModuleElement(node, isVariableStatementVisible(node));\n                case 235:\n                    return emitModuleElement(node, !node.importClause);\n                case 241:\n                    return emitExportDeclaration(node);\n                case 150:\n                case 149:\n                case 148:\n                    return writeFunctionDeclaration(node);\n                case 154:\n                case 153:\n                case 155:\n                    return emitSignatureDeclarationWithJsDocComments(node);\n                case 151:\n                case 152:\n                    return emitAccessorDeclaration(node);\n                case 147:\n                case 146:\n                    return emitPropertyDeclaration(node);\n                case 260:\n                    return emitEnumMemberDeclaration(node);\n                case 240:\n                    return emitExportAssignment(node);\n                case 261:\n                    return emitSourceFile(node);\n            }\n        }\n        function writeReferencePath(referencedFile, addBundledFileReference, emitOnlyDtsFiles) {\n            var declFileName;\n            var addedBundledEmitReference = false;\n            if (ts.isDeclarationFile(referencedFile)) {\n                declFileName = referencedFile.fileName;\n            }\n            else {\n                ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles);\n            }\n            if (declFileName) {\n                declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false);\n                referencesOutput += \"/// <reference path=\\\"\" + declFileName + \"\\\" />\" + newLine;\n            }\n            return addedBundledEmitReference;\n            function getDeclFileName(emitFileNames, _sourceFiles, isBundledEmit) {\n                if (isBundledEmit && !addBundledFileReference) {\n                    return;\n                }\n                ts.Debug.assert(!!emitFileNames.declarationFilePath || ts.isSourceFileJavaScript(referencedFile), \"Declaration file is not present only for javascript files\");\n                declFileName = emitFileNames.declarationFilePath || emitFileNames.jsFilePath;\n                addedBundledEmitReference = isBundledEmit;\n            }\n        }\n    }\n    function writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) {\n        var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles);\n        var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit;\n        if (!emitSkipped) {\n            var declarationOutput = emitDeclarationResult.referencesOutput\n                + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo);\n            ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles);\n        }\n        return emitSkipped;\n        function getDeclarationOutput(synchronousDeclarationOutput, moduleElementDeclarationEmitInfo) {\n            var appliedSyncOutputPos = 0;\n            var declarationOutput = \"\";\n            ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) {\n                if (aliasEmitInfo.asynchronousOutput) {\n                    declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos);\n                    declarationOutput += getDeclarationOutput(aliasEmitInfo.asynchronousOutput, aliasEmitInfo.subModuleElementDeclarationEmitInfo);\n                    appliedSyncOutputPos = aliasEmitInfo.outputPos;\n                }\n            });\n            declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos);\n            return declarationOutput;\n        }\n    }\n    ts.writeDeclarationFile = writeDeclarationFile;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var id = function (s) { return s; };\n    var nullTransformers = [function (_) { return id; }];\n    function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) {\n        var delimiters = createDelimiterMap();\n        var brackets = createBracketsMap();\n        var compilerOptions = host.getCompilerOptions();\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        var moduleKind = ts.getEmitModuleKind(compilerOptions);\n        var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined;\n        var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined;\n        var emitterDiagnostics = ts.createDiagnosticCollection();\n        var newLine = host.getNewLine();\n        var transformers = emitOnlyDtsFiles ? nullTransformers : ts.getTransformers(compilerOptions);\n        var writer = ts.createTextWriter(newLine);\n        var write = writer.write, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent;\n        var sourceMap = ts.createSourceMapWriter(host, writer);\n        var emitNodeWithSourceMap = sourceMap.emitNodeWithSourceMap, emitTokenWithSourceMap = sourceMap.emitTokenWithSourceMap;\n        var comments = ts.createCommentWriter(host, writer, sourceMap);\n        var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition;\n        var nodeIdToGeneratedName;\n        var autoGeneratedIdToGeneratedName;\n        var generatedNameSet;\n        var tempFlags;\n        var currentSourceFile;\n        var currentText;\n        var currentFileIdentifiers;\n        var bundledHelpers;\n        var isOwnFileEmit;\n        var emitSkipped = false;\n        var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile);\n        ts.performance.mark(\"beforeTransform\");\n        var _a = ts.transformFiles(resolver, host, sourceFiles, transformers), transformed = _a.transformed, emitNodeWithSubstitution = _a.emitNodeWithSubstitution, emitNodeWithNotification = _a.emitNodeWithNotification;\n        ts.performance.measure(\"transformTime\", \"beforeTransform\");\n        ts.performance.mark(\"beforePrint\");\n        ts.forEachTransformedEmitFile(host, transformed, emitFile, emitOnlyDtsFiles);\n        ts.performance.measure(\"printTime\", \"beforePrint\");\n        for (var _b = 0, sourceFiles_4 = sourceFiles; _b < sourceFiles_4.length; _b++) {\n            var sourceFile = sourceFiles_4[_b];\n            ts.disposeEmitNodes(sourceFile);\n        }\n        return {\n            emitSkipped: emitSkipped,\n            diagnostics: emitterDiagnostics.getDiagnostics(),\n            emittedFiles: emittedFilesList,\n            sourceMaps: sourceMapDataList\n        };\n        function emitFile(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, isBundledEmit) {\n            if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) {\n                if (!emitOnlyDtsFiles) {\n                    printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit);\n                }\n            }\n            else {\n                emitSkipped = true;\n            }\n            if (declarationFilePath) {\n                emitSkipped = ts.writeDeclarationFile(declarationFilePath, ts.getOriginalSourceFiles(sourceFiles), isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) || emitSkipped;\n            }\n            if (!emitSkipped && emittedFilesList) {\n                if (!emitOnlyDtsFiles) {\n                    emittedFilesList.push(jsFilePath);\n                }\n                if (sourceMapFilePath) {\n                    emittedFilesList.push(sourceMapFilePath);\n                }\n                if (declarationFilePath) {\n                    emittedFilesList.push(declarationFilePath);\n                }\n            }\n        }\n        function printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit) {\n            sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit);\n            nodeIdToGeneratedName = [];\n            autoGeneratedIdToGeneratedName = [];\n            generatedNameSet = ts.createMap();\n            bundledHelpers = isBundledEmit ? ts.createMap() : undefined;\n            isOwnFileEmit = !isBundledEmit;\n            if (isBundledEmit && moduleKind) {\n                for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) {\n                    var sourceFile = sourceFiles_5[_a];\n                    emitHelpers(sourceFile, true);\n                }\n            }\n            ts.forEach(sourceFiles, printSourceFile);\n            writeLine();\n            var sourceMappingURL = sourceMap.getSourceMappingURL();\n            if (sourceMappingURL) {\n                write(\"//# \" + \"sourceMappingURL\" + \"=\" + sourceMappingURL);\n            }\n            if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) {\n                ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false, sourceFiles);\n            }\n            if (sourceMapDataList) {\n                sourceMapDataList.push(sourceMap.getSourceMapData());\n            }\n            ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles);\n            sourceMap.reset();\n            comments.reset();\n            writer.reset();\n            tempFlags = 0;\n            currentSourceFile = undefined;\n            currentText = undefined;\n            isOwnFileEmit = false;\n        }\n        function printSourceFile(node) {\n            currentSourceFile = node;\n            currentText = node.text;\n            currentFileIdentifiers = node.identifiers;\n            sourceMap.setSourceFile(node);\n            comments.setSourceFile(node);\n            pipelineEmitWithNotification(0, node);\n        }\n        function emit(node) {\n            pipelineEmitWithNotification(3, node);\n        }\n        function emitIdentifierName(node) {\n            pipelineEmitWithNotification(2, node);\n        }\n        function emitExpression(node) {\n            pipelineEmitWithNotification(1, node);\n        }\n        function pipelineEmitWithNotification(emitContext, node) {\n            emitNodeWithNotification(emitContext, node, pipelineEmitWithComments);\n        }\n        function pipelineEmitWithComments(emitContext, node) {\n            if (emitContext === 0) {\n                pipelineEmitWithSourceMap(emitContext, node);\n                return;\n            }\n            emitNodeWithComments(emitContext, node, pipelineEmitWithSourceMap);\n        }\n        function pipelineEmitWithSourceMap(emitContext, node) {\n            if (emitContext === 0\n                || emitContext === 2) {\n                pipelineEmitWithSubstitution(emitContext, node);\n                return;\n            }\n            emitNodeWithSourceMap(emitContext, node, pipelineEmitWithSubstitution);\n        }\n        function pipelineEmitWithSubstitution(emitContext, node) {\n            emitNodeWithSubstitution(emitContext, node, pipelineEmitForContext);\n        }\n        function pipelineEmitForContext(emitContext, node) {\n            switch (emitContext) {\n                case 0: return pipelineEmitInSourceFileContext(node);\n                case 2: return pipelineEmitInIdentifierNameContext(node);\n                case 3: return pipelineEmitInUnspecifiedContext(node);\n                case 1: return pipelineEmitInExpressionContext(node);\n            }\n        }\n        function pipelineEmitInSourceFileContext(node) {\n            var kind = node.kind;\n            switch (kind) {\n                case 261:\n                    return emitSourceFile(node);\n            }\n        }\n        function pipelineEmitInIdentifierNameContext(node) {\n            var kind = node.kind;\n            switch (kind) {\n                case 70:\n                    return emitIdentifier(node);\n            }\n        }\n        function pipelineEmitInUnspecifiedContext(node) {\n            var kind = node.kind;\n            switch (kind) {\n                case 13:\n                case 14:\n                case 15:\n                    return emitLiteral(node);\n                case 70:\n                    return emitIdentifier(node);\n                case 75:\n                case 78:\n                case 83:\n                case 104:\n                case 111:\n                case 112:\n                case 113:\n                case 114:\n                case 116:\n                case 117:\n                case 118:\n                case 119:\n                case 120:\n                case 121:\n                case 122:\n                case 123:\n                case 124:\n                case 125:\n                case 127:\n                case 128:\n                case 129:\n                case 130:\n                case 131:\n                case 132:\n                case 133:\n                case 134:\n                case 135:\n                case 136:\n                case 137:\n                case 138:\n                case 139:\n                case 140:\n                    writeTokenText(kind);\n                    return;\n                case 141:\n                    return emitQualifiedName(node);\n                case 142:\n                    return emitComputedPropertyName(node);\n                case 143:\n                    return emitTypeParameter(node);\n                case 144:\n                    return emitParameter(node);\n                case 145:\n                    return emitDecorator(node);\n                case 146:\n                    return emitPropertySignature(node);\n                case 147:\n                    return emitPropertyDeclaration(node);\n                case 148:\n                    return emitMethodSignature(node);\n                case 149:\n                    return emitMethodDeclaration(node);\n                case 150:\n                    return emitConstructor(node);\n                case 151:\n                case 152:\n                    return emitAccessorDeclaration(node);\n                case 153:\n                    return emitCallSignature(node);\n                case 154:\n                    return emitConstructSignature(node);\n                case 155:\n                    return emitIndexSignature(node);\n                case 156:\n                    return emitTypePredicate(node);\n                case 157:\n                    return emitTypeReference(node);\n                case 158:\n                    return emitFunctionType(node);\n                case 159:\n                    return emitConstructorType(node);\n                case 160:\n                    return emitTypeQuery(node);\n                case 161:\n                    return emitTypeLiteral(node);\n                case 162:\n                    return emitArrayType(node);\n                case 163:\n                    return emitTupleType(node);\n                case 164:\n                    return emitUnionType(node);\n                case 165:\n                    return emitIntersectionType(node);\n                case 166:\n                    return emitParenthesizedType(node);\n                case 199:\n                    return emitExpressionWithTypeArguments(node);\n                case 167:\n                    return emitThisType();\n                case 168:\n                    return emitTypeOperator(node);\n                case 169:\n                    return emitIndexedAccessType(node);\n                case 170:\n                    return emitMappedType(node);\n                case 171:\n                    return emitLiteralType(node);\n                case 172:\n                    return emitObjectBindingPattern(node);\n                case 173:\n                    return emitArrayBindingPattern(node);\n                case 174:\n                    return emitBindingElement(node);\n                case 202:\n                    return emitTemplateSpan(node);\n                case 203:\n                    return emitSemicolonClassElement();\n                case 204:\n                    return emitBlock(node);\n                case 205:\n                    return emitVariableStatement(node);\n                case 206:\n                    return emitEmptyStatement();\n                case 207:\n                    return emitExpressionStatement(node);\n                case 208:\n                    return emitIfStatement(node);\n                case 209:\n                    return emitDoStatement(node);\n                case 210:\n                    return emitWhileStatement(node);\n                case 211:\n                    return emitForStatement(node);\n                case 212:\n                    return emitForInStatement(node);\n                case 213:\n                    return emitForOfStatement(node);\n                case 214:\n                    return emitContinueStatement(node);\n                case 215:\n                    return emitBreakStatement(node);\n                case 216:\n                    return emitReturnStatement(node);\n                case 217:\n                    return emitWithStatement(node);\n                case 218:\n                    return emitSwitchStatement(node);\n                case 219:\n                    return emitLabeledStatement(node);\n                case 220:\n                    return emitThrowStatement(node);\n                case 221:\n                    return emitTryStatement(node);\n                case 222:\n                    return emitDebuggerStatement(node);\n                case 223:\n                    return emitVariableDeclaration(node);\n                case 224:\n                    return emitVariableDeclarationList(node);\n                case 225:\n                    return emitFunctionDeclaration(node);\n                case 226:\n                    return emitClassDeclaration(node);\n                case 227:\n                    return emitInterfaceDeclaration(node);\n                case 228:\n                    return emitTypeAliasDeclaration(node);\n                case 229:\n                    return emitEnumDeclaration(node);\n                case 230:\n                    return emitModuleDeclaration(node);\n                case 231:\n                    return emitModuleBlock(node);\n                case 232:\n                    return emitCaseBlock(node);\n                case 234:\n                    return emitImportEqualsDeclaration(node);\n                case 235:\n                    return emitImportDeclaration(node);\n                case 236:\n                    return emitImportClause(node);\n                case 237:\n                    return emitNamespaceImport(node);\n                case 238:\n                    return emitNamedImports(node);\n                case 239:\n                    return emitImportSpecifier(node);\n                case 240:\n                    return emitExportAssignment(node);\n                case 241:\n                    return emitExportDeclaration(node);\n                case 242:\n                    return emitNamedExports(node);\n                case 243:\n                    return emitExportSpecifier(node);\n                case 244:\n                    return;\n                case 245:\n                    return emitExternalModuleReference(node);\n                case 10:\n                    return emitJsxText(node);\n                case 248:\n                    return emitJsxOpeningElement(node);\n                case 249:\n                    return emitJsxClosingElement(node);\n                case 250:\n                    return emitJsxAttribute(node);\n                case 251:\n                    return emitJsxSpreadAttribute(node);\n                case 252:\n                    return emitJsxExpression(node);\n                case 253:\n                    return emitCaseClause(node);\n                case 254:\n                    return emitDefaultClause(node);\n                case 255:\n                    return emitHeritageClause(node);\n                case 256:\n                    return emitCatchClause(node);\n                case 257:\n                    return emitPropertyAssignment(node);\n                case 258:\n                    return emitShorthandPropertyAssignment(node);\n                case 259:\n                    return emitSpreadAssignment(node);\n                case 260:\n                    return emitEnumMember(node);\n            }\n            if (ts.isExpression(node)) {\n                return pipelineEmitWithSubstitution(1, node);\n            }\n        }\n        function pipelineEmitInExpressionContext(node) {\n            var kind = node.kind;\n            switch (kind) {\n                case 8:\n                    return emitNumericLiteral(node);\n                case 9:\n                case 11:\n                case 12:\n                    return emitLiteral(node);\n                case 70:\n                    return emitIdentifier(node);\n                case 85:\n                case 94:\n                case 96:\n                case 100:\n                case 98:\n                    writeTokenText(kind);\n                    return;\n                case 175:\n                    return emitArrayLiteralExpression(node);\n                case 176:\n                    return emitObjectLiteralExpression(node);\n                case 177:\n                    return emitPropertyAccessExpression(node);\n                case 178:\n                    return emitElementAccessExpression(node);\n                case 179:\n                    return emitCallExpression(node);\n                case 180:\n                    return emitNewExpression(node);\n                case 181:\n                    return emitTaggedTemplateExpression(node);\n                case 182:\n                    return emitTypeAssertionExpression(node);\n                case 183:\n                    return emitParenthesizedExpression(node);\n                case 184:\n                    return emitFunctionExpression(node);\n                case 185:\n                    return emitArrowFunction(node);\n                case 186:\n                    return emitDeleteExpression(node);\n                case 187:\n                    return emitTypeOfExpression(node);\n                case 188:\n                    return emitVoidExpression(node);\n                case 189:\n                    return emitAwaitExpression(node);\n                case 190:\n                    return emitPrefixUnaryExpression(node);\n                case 191:\n                    return emitPostfixUnaryExpression(node);\n                case 192:\n                    return emitBinaryExpression(node);\n                case 193:\n                    return emitConditionalExpression(node);\n                case 194:\n                    return emitTemplateExpression(node);\n                case 195:\n                    return emitYieldExpression(node);\n                case 196:\n                    return emitSpreadExpression(node);\n                case 197:\n                    return emitClassExpression(node);\n                case 198:\n                    return;\n                case 200:\n                    return emitAsExpression(node);\n                case 201:\n                    return emitNonNullExpression(node);\n                case 246:\n                    return emitJsxElement(node);\n                case 247:\n                    return emitJsxSelfClosingElement(node);\n                case 294:\n                    return emitPartiallyEmittedExpression(node);\n                case 297:\n                    return writeLines(node.text);\n            }\n        }\n        function emitNumericLiteral(node) {\n            emitLiteral(node);\n            if (node.trailingComment) {\n                write(\" /*\" + node.trailingComment + \"*/\");\n            }\n        }\n        function emitLiteral(node) {\n            var text = getLiteralTextOfNode(node);\n            if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap)\n                && (node.kind === 9 || ts.isTemplateLiteralKind(node.kind))) {\n                writer.writeLiteral(text);\n            }\n            else {\n                write(text);\n            }\n        }\n        function emitIdentifier(node) {\n            write(getTextOfNode(node, false));\n        }\n        function emitQualifiedName(node) {\n            emitEntityName(node.left);\n            write(\".\");\n            emit(node.right);\n        }\n        function emitEntityName(node) {\n            if (node.kind === 70) {\n                emitExpression(node);\n            }\n            else {\n                emit(node);\n            }\n        }\n        function emitComputedPropertyName(node) {\n            write(\"[\");\n            emitExpression(node.expression);\n            write(\"]\");\n        }\n        function emitTypeParameter(node) {\n            emit(node.name);\n            emitWithPrefix(\" extends \", node.constraint);\n        }\n        function emitParameter(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            writeIfPresent(node.dotDotDotToken, \"...\");\n            emit(node.name);\n            writeIfPresent(node.questionToken, \"?\");\n            emitExpressionWithPrefix(\" = \", node.initializer);\n            emitWithPrefix(\": \", node.type);\n        }\n        function emitDecorator(decorator) {\n            write(\"@\");\n            emitExpression(decorator.expression);\n        }\n        function emitPropertySignature(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emit(node.name);\n            writeIfPresent(node.questionToken, \"?\");\n            emitWithPrefix(\": \", node.type);\n            write(\";\");\n        }\n        function emitPropertyDeclaration(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emit(node.name);\n            emitWithPrefix(\": \", node.type);\n            emitExpressionWithPrefix(\" = \", node.initializer);\n            write(\";\");\n        }\n        function emitMethodSignature(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emit(node.name);\n            writeIfPresent(node.questionToken, \"?\");\n            emitTypeParameters(node, node.typeParameters);\n            emitParameters(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n            write(\";\");\n        }\n        function emitMethodDeclaration(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            writeIfPresent(node.asteriskToken, \"*\");\n            emit(node.name);\n            emitSignatureAndBody(node, emitSignatureHead);\n        }\n        function emitConstructor(node) {\n            emitModifiers(node, node.modifiers);\n            write(\"constructor\");\n            emitSignatureAndBody(node, emitSignatureHead);\n        }\n        function emitAccessorDeclaration(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(node.kind === 151 ? \"get \" : \"set \");\n            emit(node.name);\n            emitSignatureAndBody(node, emitSignatureHead);\n        }\n        function emitCallSignature(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emitTypeParameters(node, node.typeParameters);\n            emitParameters(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n            write(\";\");\n        }\n        function emitConstructSignature(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(\"new \");\n            emitTypeParameters(node, node.typeParameters);\n            emitParameters(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n            write(\";\");\n        }\n        function emitIndexSignature(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emitParametersForIndexSignature(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n            write(\";\");\n        }\n        function emitSemicolonClassElement() {\n            write(\";\");\n        }\n        function emitTypePredicate(node) {\n            emit(node.parameterName);\n            write(\" is \");\n            emit(node.type);\n        }\n        function emitTypeReference(node) {\n            emit(node.typeName);\n            emitTypeArguments(node, node.typeArguments);\n        }\n        function emitFunctionType(node) {\n            emitTypeParameters(node, node.typeParameters);\n            emitParametersForArrow(node, node.parameters);\n            write(\" => \");\n            emit(node.type);\n        }\n        function emitConstructorType(node) {\n            write(\"new \");\n            emitTypeParameters(node, node.typeParameters);\n            emitParametersForArrow(node, node.parameters);\n            write(\" => \");\n            emit(node.type);\n        }\n        function emitTypeQuery(node) {\n            write(\"typeof \");\n            emit(node.exprName);\n        }\n        function emitTypeLiteral(node) {\n            write(\"{\");\n            emitList(node, node.members, 65);\n            write(\"}\");\n        }\n        function emitArrayType(node) {\n            emit(node.elementType);\n            write(\"[]\");\n        }\n        function emitTupleType(node) {\n            write(\"[\");\n            emitList(node, node.elementTypes, 336);\n            write(\"]\");\n        }\n        function emitUnionType(node) {\n            emitList(node, node.types, 260);\n        }\n        function emitIntersectionType(node) {\n            emitList(node, node.types, 264);\n        }\n        function emitParenthesizedType(node) {\n            write(\"(\");\n            emit(node.type);\n            write(\")\");\n        }\n        function emitThisType() {\n            write(\"this\");\n        }\n        function emitTypeOperator(node) {\n            writeTokenText(node.operator);\n            write(\" \");\n            emit(node.type);\n        }\n        function emitIndexedAccessType(node) {\n            emit(node.objectType);\n            write(\"[\");\n            emit(node.indexType);\n            write(\"]\");\n        }\n        function emitMappedType(node) {\n            write(\"{\");\n            writeLine();\n            increaseIndent();\n            if (node.readonlyToken) {\n                write(\"readonly \");\n            }\n            write(\"[\");\n            emit(node.typeParameter.name);\n            write(\" in \");\n            emit(node.typeParameter.constraint);\n            write(\"]\");\n            if (node.questionToken) {\n                write(\"?\");\n            }\n            write(\": \");\n            emit(node.type);\n            write(\";\");\n            writeLine();\n            decreaseIndent();\n            write(\"}\");\n        }\n        function emitLiteralType(node) {\n            emitExpression(node.literal);\n        }\n        function emitObjectBindingPattern(node) {\n            var elements = node.elements;\n            if (elements.length === 0) {\n                write(\"{}\");\n            }\n            else {\n                write(\"{\");\n                emitList(node, elements, 432);\n                write(\"}\");\n            }\n        }\n        function emitArrayBindingPattern(node) {\n            var elements = node.elements;\n            if (elements.length === 0) {\n                write(\"[]\");\n            }\n            else {\n                write(\"[\");\n                emitList(node, node.elements, 304);\n                write(\"]\");\n            }\n        }\n        function emitBindingElement(node) {\n            emitWithSuffix(node.propertyName, \": \");\n            writeIfPresent(node.dotDotDotToken, \"...\");\n            emit(node.name);\n            emitExpressionWithPrefix(\" = \", node.initializer);\n        }\n        function emitArrayLiteralExpression(node) {\n            var elements = node.elements;\n            if (elements.length === 0) {\n                write(\"[]\");\n            }\n            else {\n                var preferNewLine = node.multiLine ? 32768 : 0;\n                emitExpressionList(node, elements, 4466 | preferNewLine);\n            }\n        }\n        function emitObjectLiteralExpression(node) {\n            var properties = node.properties;\n            if (properties.length === 0) {\n                write(\"{}\");\n            }\n            else {\n                var indentedFlag = ts.getEmitFlags(node) & 32768;\n                if (indentedFlag) {\n                    increaseIndent();\n                }\n                var preferNewLine = node.multiLine ? 32768 : 0;\n                var allowTrailingComma = languageVersion >= 1 ? 32 : 0;\n                emitList(node, properties, 978 | allowTrailingComma | preferNewLine);\n                if (indentedFlag) {\n                    decreaseIndent();\n                }\n            }\n        }\n        function emitPropertyAccessExpression(node) {\n            var indentBeforeDot = false;\n            var indentAfterDot = false;\n            if (!(ts.getEmitFlags(node) & 65536)) {\n                var dotRangeStart = node.expression.end;\n                var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1;\n                var dotToken = { kind: 22, pos: dotRangeStart, end: dotRangeEnd };\n                indentBeforeDot = needsIndentation(node, node.expression, dotToken);\n                indentAfterDot = needsIndentation(node, dotToken, node.name);\n            }\n            emitExpression(node.expression);\n            increaseIndentIf(indentBeforeDot);\n            var shouldEmitDotDot = !indentBeforeDot && needsDotDotForPropertyAccess(node.expression);\n            write(shouldEmitDotDot ? \"..\" : \".\");\n            increaseIndentIf(indentAfterDot);\n            emit(node.name);\n            decreaseIndentIf(indentBeforeDot, indentAfterDot);\n        }\n        function needsDotDotForPropertyAccess(expression) {\n            if (expression.kind === 8) {\n                var text = getLiteralTextOfNode(expression);\n                return text.indexOf(ts.tokenToString(22)) < 0;\n            }\n            else if (ts.isPropertyAccessExpression(expression) || ts.isElementAccessExpression(expression)) {\n                var constantValue = ts.getConstantValue(expression);\n                return isFinite(constantValue)\n                    && Math.floor(constantValue) === constantValue\n                    && compilerOptions.removeComments;\n            }\n        }\n        function emitElementAccessExpression(node) {\n            emitExpression(node.expression);\n            write(\"[\");\n            emitExpression(node.argumentExpression);\n            write(\"]\");\n        }\n        function emitCallExpression(node) {\n            emitExpression(node.expression);\n            emitTypeArguments(node, node.typeArguments);\n            emitExpressionList(node, node.arguments, 1296);\n        }\n        function emitNewExpression(node) {\n            write(\"new \");\n            emitExpression(node.expression);\n            emitTypeArguments(node, node.typeArguments);\n            emitExpressionList(node, node.arguments, 9488);\n        }\n        function emitTaggedTemplateExpression(node) {\n            emitExpression(node.tag);\n            write(\" \");\n            emitExpression(node.template);\n        }\n        function emitTypeAssertionExpression(node) {\n            if (node.type) {\n                write(\"<\");\n                emit(node.type);\n                write(\">\");\n            }\n            emitExpression(node.expression);\n        }\n        function emitParenthesizedExpression(node) {\n            write(\"(\");\n            emitExpression(node.expression);\n            write(\")\");\n        }\n        function emitFunctionExpression(node) {\n            emitFunctionDeclarationOrExpression(node);\n        }\n        function emitArrowFunction(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emitSignatureAndBody(node, emitArrowFunctionHead);\n        }\n        function emitArrowFunctionHead(node) {\n            emitTypeParameters(node, node.typeParameters);\n            emitParametersForArrow(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n            write(\" =>\");\n        }\n        function emitDeleteExpression(node) {\n            write(\"delete \");\n            emitExpression(node.expression);\n        }\n        function emitTypeOfExpression(node) {\n            write(\"typeof \");\n            emitExpression(node.expression);\n        }\n        function emitVoidExpression(node) {\n            write(\"void \");\n            emitExpression(node.expression);\n        }\n        function emitAwaitExpression(node) {\n            write(\"await \");\n            emitExpression(node.expression);\n        }\n        function emitPrefixUnaryExpression(node) {\n            writeTokenText(node.operator);\n            if (shouldEmitWhitespaceBeforeOperand(node)) {\n                write(\" \");\n            }\n            emitExpression(node.operand);\n        }\n        function shouldEmitWhitespaceBeforeOperand(node) {\n            var operand = node.operand;\n            return operand.kind === 190\n                && ((node.operator === 36 && (operand.operator === 36 || operand.operator === 42))\n                    || (node.operator === 37 && (operand.operator === 37 || operand.operator === 43)));\n        }\n        function emitPostfixUnaryExpression(node) {\n            emitExpression(node.operand);\n            writeTokenText(node.operator);\n        }\n        function emitBinaryExpression(node) {\n            var isCommaOperator = node.operatorToken.kind !== 25;\n            var indentBeforeOperator = needsIndentation(node, node.left, node.operatorToken);\n            var indentAfterOperator = needsIndentation(node, node.operatorToken, node.right);\n            emitExpression(node.left);\n            increaseIndentIf(indentBeforeOperator, isCommaOperator ? \" \" : undefined);\n            writeTokenText(node.operatorToken.kind);\n            increaseIndentIf(indentAfterOperator, \" \");\n            emitExpression(node.right);\n            decreaseIndentIf(indentBeforeOperator, indentAfterOperator);\n        }\n        function emitConditionalExpression(node) {\n            var indentBeforeQuestion = needsIndentation(node, node.condition, node.questionToken);\n            var indentAfterQuestion = needsIndentation(node, node.questionToken, node.whenTrue);\n            var indentBeforeColon = needsIndentation(node, node.whenTrue, node.colonToken);\n            var indentAfterColon = needsIndentation(node, node.colonToken, node.whenFalse);\n            emitExpression(node.condition);\n            increaseIndentIf(indentBeforeQuestion, \" \");\n            write(\"?\");\n            increaseIndentIf(indentAfterQuestion, \" \");\n            emitExpression(node.whenTrue);\n            decreaseIndentIf(indentBeforeQuestion, indentAfterQuestion);\n            increaseIndentIf(indentBeforeColon, \" \");\n            write(\":\");\n            increaseIndentIf(indentAfterColon, \" \");\n            emitExpression(node.whenFalse);\n            decreaseIndentIf(indentBeforeColon, indentAfterColon);\n        }\n        function emitTemplateExpression(node) {\n            emit(node.head);\n            emitList(node, node.templateSpans, 131072);\n        }\n        function emitYieldExpression(node) {\n            write(node.asteriskToken ? \"yield*\" : \"yield\");\n            emitExpressionWithPrefix(\" \", node.expression);\n        }\n        function emitSpreadExpression(node) {\n            write(\"...\");\n            emitExpression(node.expression);\n        }\n        function emitClassExpression(node) {\n            emitClassDeclarationOrExpression(node);\n        }\n        function emitExpressionWithTypeArguments(node) {\n            emitExpression(node.expression);\n            emitTypeArguments(node, node.typeArguments);\n        }\n        function emitAsExpression(node) {\n            emitExpression(node.expression);\n            if (node.type) {\n                write(\" as \");\n                emit(node.type);\n            }\n        }\n        function emitNonNullExpression(node) {\n            emitExpression(node.expression);\n            write(\"!\");\n        }\n        function emitTemplateSpan(node) {\n            emitExpression(node.expression);\n            emit(node.literal);\n        }\n        function emitBlock(node) {\n            if (isSingleLineEmptyBlock(node)) {\n                writeToken(16, node.pos, node);\n                write(\" \");\n                writeToken(17, node.statements.end, node);\n            }\n            else {\n                writeToken(16, node.pos, node);\n                emitBlockStatements(node);\n                writeToken(17, node.statements.end, node);\n            }\n        }\n        function emitBlockStatements(node) {\n            if (ts.getEmitFlags(node) & 1) {\n                emitList(node, node.statements, 384);\n            }\n            else {\n                emitList(node, node.statements, 65);\n            }\n        }\n        function emitVariableStatement(node) {\n            emitModifiers(node, node.modifiers);\n            emit(node.declarationList);\n            write(\";\");\n        }\n        function emitEmptyStatement() {\n            write(\";\");\n        }\n        function emitExpressionStatement(node) {\n            emitExpression(node.expression);\n            write(\";\");\n        }\n        function emitIfStatement(node) {\n            var openParenPos = writeToken(89, node.pos, node);\n            write(\" \");\n            writeToken(18, openParenPos, node);\n            emitExpression(node.expression);\n            writeToken(19, node.expression.end, node);\n            emitEmbeddedStatement(node.thenStatement);\n            if (node.elseStatement) {\n                writeLine();\n                writeToken(81, node.thenStatement.end, node);\n                if (node.elseStatement.kind === 208) {\n                    write(\" \");\n                    emit(node.elseStatement);\n                }\n                else {\n                    emitEmbeddedStatement(node.elseStatement);\n                }\n            }\n        }\n        function emitDoStatement(node) {\n            write(\"do\");\n            emitEmbeddedStatement(node.statement);\n            if (ts.isBlock(node.statement)) {\n                write(\" \");\n            }\n            else {\n                writeLine();\n            }\n            write(\"while (\");\n            emitExpression(node.expression);\n            write(\");\");\n        }\n        function emitWhileStatement(node) {\n            write(\"while (\");\n            emitExpression(node.expression);\n            write(\")\");\n            emitEmbeddedStatement(node.statement);\n        }\n        function emitForStatement(node) {\n            var openParenPos = writeToken(87, node.pos);\n            write(\" \");\n            writeToken(18, openParenPos, node);\n            emitForBinding(node.initializer);\n            write(\";\");\n            emitExpressionWithPrefix(\" \", node.condition);\n            write(\";\");\n            emitExpressionWithPrefix(\" \", node.incrementor);\n            write(\")\");\n            emitEmbeddedStatement(node.statement);\n        }\n        function emitForInStatement(node) {\n            var openParenPos = writeToken(87, node.pos);\n            write(\" \");\n            writeToken(18, openParenPos);\n            emitForBinding(node.initializer);\n            write(\" in \");\n            emitExpression(node.expression);\n            writeToken(19, node.expression.end);\n            emitEmbeddedStatement(node.statement);\n        }\n        function emitForOfStatement(node) {\n            var openParenPos = writeToken(87, node.pos);\n            write(\" \");\n            writeToken(18, openParenPos);\n            emitForBinding(node.initializer);\n            write(\" of \");\n            emitExpression(node.expression);\n            writeToken(19, node.expression.end);\n            emitEmbeddedStatement(node.statement);\n        }\n        function emitForBinding(node) {\n            if (node !== undefined) {\n                if (node.kind === 224) {\n                    emit(node);\n                }\n                else {\n                    emitExpression(node);\n                }\n            }\n        }\n        function emitContinueStatement(node) {\n            writeToken(76, node.pos);\n            emitWithPrefix(\" \", node.label);\n            write(\";\");\n        }\n        function emitBreakStatement(node) {\n            writeToken(71, node.pos);\n            emitWithPrefix(\" \", node.label);\n            write(\";\");\n        }\n        function emitReturnStatement(node) {\n            writeToken(95, node.pos, node);\n            emitExpressionWithPrefix(\" \", node.expression);\n            write(\";\");\n        }\n        function emitWithStatement(node) {\n            write(\"with (\");\n            emitExpression(node.expression);\n            write(\")\");\n            emitEmbeddedStatement(node.statement);\n        }\n        function emitSwitchStatement(node) {\n            var openParenPos = writeToken(97, node.pos);\n            write(\" \");\n            writeToken(18, openParenPos);\n            emitExpression(node.expression);\n            writeToken(19, node.expression.end);\n            write(\" \");\n            emit(node.caseBlock);\n        }\n        function emitLabeledStatement(node) {\n            emit(node.label);\n            write(\": \");\n            emit(node.statement);\n        }\n        function emitThrowStatement(node) {\n            write(\"throw\");\n            emitExpressionWithPrefix(\" \", node.expression);\n            write(\";\");\n        }\n        function emitTryStatement(node) {\n            write(\"try \");\n            emit(node.tryBlock);\n            emit(node.catchClause);\n            if (node.finallyBlock) {\n                writeLine();\n                write(\"finally \");\n                emit(node.finallyBlock);\n            }\n        }\n        function emitDebuggerStatement(node) {\n            writeToken(77, node.pos);\n            write(\";\");\n        }\n        function emitVariableDeclaration(node) {\n            emit(node.name);\n            emitWithPrefix(\": \", node.type);\n            emitExpressionWithPrefix(\" = \", node.initializer);\n        }\n        function emitVariableDeclarationList(node) {\n            write(ts.isLet(node) ? \"let \" : ts.isConst(node) ? \"const \" : \"var \");\n            emitList(node, node.declarations, 272);\n        }\n        function emitFunctionDeclaration(node) {\n            emitFunctionDeclarationOrExpression(node);\n        }\n        function emitFunctionDeclarationOrExpression(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(node.asteriskToken ? \"function* \" : \"function \");\n            emitIdentifierName(node.name);\n            emitSignatureAndBody(node, emitSignatureHead);\n        }\n        function emitSignatureAndBody(node, emitSignatureHead) {\n            var body = node.body;\n            if (body) {\n                if (ts.isBlock(body)) {\n                    var indentedFlag = ts.getEmitFlags(node) & 32768;\n                    if (indentedFlag) {\n                        increaseIndent();\n                    }\n                    if (ts.getEmitFlags(node) & 262144) {\n                        emitSignatureHead(node);\n                        emitBlockFunctionBody(body);\n                    }\n                    else {\n                        var savedTempFlags = tempFlags;\n                        tempFlags = 0;\n                        emitSignatureHead(node);\n                        emitBlockFunctionBody(body);\n                        tempFlags = savedTempFlags;\n                    }\n                    if (indentedFlag) {\n                        decreaseIndent();\n                    }\n                }\n                else {\n                    emitSignatureHead(node);\n                    write(\" \");\n                    emitExpression(body);\n                }\n            }\n            else {\n                emitSignatureHead(node);\n                write(\";\");\n            }\n        }\n        function emitSignatureHead(node) {\n            emitTypeParameters(node, node.typeParameters);\n            emitParameters(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n        }\n        function shouldEmitBlockFunctionBodyOnSingleLine(body) {\n            if (ts.getEmitFlags(body) & 1) {\n                return true;\n            }\n            if (body.multiLine) {\n                return false;\n            }\n            if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {\n                return false;\n            }\n            if (shouldWriteLeadingLineTerminator(body, body.statements, 2)\n                || shouldWriteClosingLineTerminator(body, body.statements, 2)) {\n                return false;\n            }\n            var previousStatement;\n            for (var _a = 0, _b = body.statements; _a < _b.length; _a++) {\n                var statement = _b[_a];\n                if (shouldWriteSeparatingLineTerminator(previousStatement, statement, 2)) {\n                    return false;\n                }\n                previousStatement = statement;\n            }\n            return true;\n        }\n        function emitBlockFunctionBody(body) {\n            write(\" {\");\n            increaseIndent();\n            emitBodyWithDetachedComments(body, body.statements, shouldEmitBlockFunctionBodyOnSingleLine(body)\n                ? emitBlockFunctionBodyOnSingleLine\n                : emitBlockFunctionBodyWorker);\n            decreaseIndent();\n            writeToken(17, body.statements.end, body);\n        }\n        function emitBlockFunctionBodyOnSingleLine(body) {\n            emitBlockFunctionBodyWorker(body, true);\n        }\n        function emitBlockFunctionBodyWorker(body, emitBlockFunctionBodyOnSingleLine) {\n            var statementOffset = emitPrologueDirectives(body.statements, true);\n            var helpersEmitted = emitHelpers(body);\n            if (statementOffset === 0 && !helpersEmitted && emitBlockFunctionBodyOnSingleLine) {\n                decreaseIndent();\n                emitList(body, body.statements, 384);\n                increaseIndent();\n            }\n            else {\n                emitList(body, body.statements, 1, statementOffset);\n            }\n        }\n        function emitClassDeclaration(node) {\n            emitClassDeclarationOrExpression(node);\n        }\n        function emitClassDeclarationOrExpression(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(\"class\");\n            emitNodeWithPrefix(\" \", node.name, emitIdentifierName);\n            var indentedFlag = ts.getEmitFlags(node) & 32768;\n            if (indentedFlag) {\n                increaseIndent();\n            }\n            emitTypeParameters(node, node.typeParameters);\n            emitList(node, node.heritageClauses, 256);\n            var savedTempFlags = tempFlags;\n            tempFlags = 0;\n            write(\" {\");\n            emitList(node, node.members, 65);\n            write(\"}\");\n            if (indentedFlag) {\n                decreaseIndent();\n            }\n            tempFlags = savedTempFlags;\n        }\n        function emitInterfaceDeclaration(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(\"interface \");\n            emit(node.name);\n            emitTypeParameters(node, node.typeParameters);\n            emitList(node, node.heritageClauses, 256);\n            write(\" {\");\n            emitList(node, node.members, 65);\n            write(\"}\");\n        }\n        function emitTypeAliasDeclaration(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(\"type \");\n            emit(node.name);\n            emitTypeParameters(node, node.typeParameters);\n            write(\" = \");\n            emit(node.type);\n            write(\";\");\n        }\n        function emitEnumDeclaration(node) {\n            emitModifiers(node, node.modifiers);\n            write(\"enum \");\n            emit(node.name);\n            var savedTempFlags = tempFlags;\n            tempFlags = 0;\n            write(\" {\");\n            emitList(node, node.members, 81);\n            write(\"}\");\n            tempFlags = savedTempFlags;\n        }\n        function emitModuleDeclaration(node) {\n            emitModifiers(node, node.modifiers);\n            write(node.flags & 16 ? \"namespace \" : \"module \");\n            emit(node.name);\n            var body = node.body;\n            while (body.kind === 230) {\n                write(\".\");\n                emit(body.name);\n                body = body.body;\n            }\n            write(\" \");\n            emit(body);\n        }\n        function emitModuleBlock(node) {\n            if (isEmptyBlock(node)) {\n                write(\"{ }\");\n            }\n            else {\n                var savedTempFlags = tempFlags;\n                tempFlags = 0;\n                write(\"{\");\n                increaseIndent();\n                emitBlockStatements(node);\n                write(\"}\");\n                tempFlags = savedTempFlags;\n            }\n        }\n        function emitCaseBlock(node) {\n            writeToken(16, node.pos);\n            emitList(node, node.clauses, 65);\n            writeToken(17, node.clauses.end);\n        }\n        function emitImportEqualsDeclaration(node) {\n            emitModifiers(node, node.modifiers);\n            write(\"import \");\n            emit(node.name);\n            write(\" = \");\n            emitModuleReference(node.moduleReference);\n            write(\";\");\n        }\n        function emitModuleReference(node) {\n            if (node.kind === 70) {\n                emitExpression(node);\n            }\n            else {\n                emit(node);\n            }\n        }\n        function emitImportDeclaration(node) {\n            emitModifiers(node, node.modifiers);\n            write(\"import \");\n            if (node.importClause) {\n                emit(node.importClause);\n                write(\" from \");\n            }\n            emitExpression(node.moduleSpecifier);\n            write(\";\");\n        }\n        function emitImportClause(node) {\n            emit(node.name);\n            if (node.name && node.namedBindings) {\n                write(\", \");\n            }\n            emit(node.namedBindings);\n        }\n        function emitNamespaceImport(node) {\n            write(\"* as \");\n            emit(node.name);\n        }\n        function emitNamedImports(node) {\n            emitNamedImportsOrExports(node);\n        }\n        function emitImportSpecifier(node) {\n            emitImportOrExportSpecifier(node);\n        }\n        function emitExportAssignment(node) {\n            write(node.isExportEquals ? \"export = \" : \"export default \");\n            emitExpression(node.expression);\n            write(\";\");\n        }\n        function emitExportDeclaration(node) {\n            write(\"export \");\n            if (node.exportClause) {\n                emit(node.exportClause);\n            }\n            else {\n                write(\"*\");\n            }\n            if (node.moduleSpecifier) {\n                write(\" from \");\n                emitExpression(node.moduleSpecifier);\n            }\n            write(\";\");\n        }\n        function emitNamedExports(node) {\n            emitNamedImportsOrExports(node);\n        }\n        function emitExportSpecifier(node) {\n            emitImportOrExportSpecifier(node);\n        }\n        function emitNamedImportsOrExports(node) {\n            write(\"{\");\n            emitList(node, node.elements, 432);\n            write(\"}\");\n        }\n        function emitImportOrExportSpecifier(node) {\n            if (node.propertyName) {\n                emit(node.propertyName);\n                write(\" as \");\n            }\n            emit(node.name);\n        }\n        function emitExternalModuleReference(node) {\n            write(\"require(\");\n            emitExpression(node.expression);\n            write(\")\");\n        }\n        function emitJsxElement(node) {\n            emit(node.openingElement);\n            emitList(node, node.children, 131072);\n            emit(node.closingElement);\n        }\n        function emitJsxSelfClosingElement(node) {\n            write(\"<\");\n            emitJsxTagName(node.tagName);\n            write(\" \");\n            emitList(node, node.attributes, 131328);\n            write(\"/>\");\n        }\n        function emitJsxOpeningElement(node) {\n            write(\"<\");\n            emitJsxTagName(node.tagName);\n            writeIfAny(node.attributes, \" \");\n            emitList(node, node.attributes, 131328);\n            write(\">\");\n        }\n        function emitJsxText(node) {\n            writer.writeLiteral(getTextOfNode(node, true));\n        }\n        function emitJsxClosingElement(node) {\n            write(\"</\");\n            emitJsxTagName(node.tagName);\n            write(\">\");\n        }\n        function emitJsxAttribute(node) {\n            emit(node.name);\n            emitWithPrefix(\"=\", node.initializer);\n        }\n        function emitJsxSpreadAttribute(node) {\n            write(\"{...\");\n            emitExpression(node.expression);\n            write(\"}\");\n        }\n        function emitJsxExpression(node) {\n            if (node.expression) {\n                write(\"{\");\n                emitExpression(node.expression);\n                write(\"}\");\n            }\n        }\n        function emitJsxTagName(node) {\n            if (node.kind === 70) {\n                emitExpression(node);\n            }\n            else {\n                emit(node);\n            }\n        }\n        function emitCaseClause(node) {\n            write(\"case \");\n            emitExpression(node.expression);\n            write(\":\");\n            emitCaseOrDefaultClauseStatements(node, node.statements);\n        }\n        function emitDefaultClause(node) {\n            write(\"default:\");\n            emitCaseOrDefaultClauseStatements(node, node.statements);\n        }\n        function emitCaseOrDefaultClauseStatements(parentNode, statements) {\n            var emitAsSingleStatement = statements.length === 1 &&\n                (ts.nodeIsSynthesized(parentNode) ||\n                    ts.nodeIsSynthesized(statements[0]) ||\n                    ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile));\n            if (emitAsSingleStatement) {\n                write(\" \");\n                emit(statements[0]);\n            }\n            else {\n                emitList(parentNode, statements, 81985);\n            }\n        }\n        function emitHeritageClause(node) {\n            write(\" \");\n            writeTokenText(node.token);\n            write(\" \");\n            emitList(node, node.types, 272);\n        }\n        function emitCatchClause(node) {\n            writeLine();\n            var openParenPos = writeToken(73, node.pos);\n            write(\" \");\n            writeToken(18, openParenPos);\n            emit(node.variableDeclaration);\n            writeToken(19, node.variableDeclaration ? node.variableDeclaration.end : openParenPos);\n            write(\" \");\n            emit(node.block);\n        }\n        function emitPropertyAssignment(node) {\n            emit(node.name);\n            write(\": \");\n            var initializer = node.initializer;\n            if ((ts.getEmitFlags(initializer) & 512) === 0) {\n                var commentRange = ts.getCommentRange(initializer);\n                emitTrailingCommentsOfPosition(commentRange.pos);\n            }\n            emitExpression(initializer);\n        }\n        function emitShorthandPropertyAssignment(node) {\n            emit(node.name);\n            if (node.objectAssignmentInitializer) {\n                write(\" = \");\n                emitExpression(node.objectAssignmentInitializer);\n            }\n        }\n        function emitSpreadAssignment(node) {\n            if (node.expression) {\n                write(\"...\");\n                emitExpression(node.expression);\n            }\n        }\n        function emitEnumMember(node) {\n            emit(node.name);\n            emitExpressionWithPrefix(\" = \", node.initializer);\n        }\n        function emitSourceFile(node) {\n            writeLine();\n            emitShebang();\n            emitBodyWithDetachedComments(node, node.statements, emitSourceFileWorker);\n        }\n        function emitSourceFileWorker(node) {\n            var statements = node.statements;\n            var statementOffset = emitPrologueDirectives(statements);\n            var savedTempFlags = tempFlags;\n            tempFlags = 0;\n            emitHelpers(node);\n            emitList(node, statements, 1, statementOffset);\n            tempFlags = savedTempFlags;\n        }\n        function emitPartiallyEmittedExpression(node) {\n            emitExpression(node.expression);\n        }\n        function emitPrologueDirectives(statements, startWithNewLine) {\n            for (var i = 0; i < statements.length; i++) {\n                if (ts.isPrologueDirective(statements[i])) {\n                    if (startWithNewLine || i > 0) {\n                        writeLine();\n                    }\n                    emit(statements[i]);\n                }\n                else {\n                    return i;\n                }\n            }\n            return statements.length;\n        }\n        function emitHelpers(node, isBundle) {\n            var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile;\n            var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined);\n            var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit;\n            var helpersEmitted = false;\n            var helpers = ts.getEmitHelpers(node);\n            if (helpers) {\n                for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) {\n                    var helper = _b[_a];\n                    if (!helper.scoped) {\n                        if (shouldSkip)\n                            continue;\n                        if (shouldBundle) {\n                            if (bundledHelpers[helper.name]) {\n                                continue;\n                            }\n                            bundledHelpers[helper.name] = true;\n                        }\n                    }\n                    else if (isBundle) {\n                        continue;\n                    }\n                    writeLines(helper.text);\n                    helpersEmitted = true;\n                }\n            }\n            if (helpersEmitted) {\n                writeLine();\n            }\n            return helpersEmitted;\n        }\n        function writeLines(text) {\n            var lines = text.split(/\\r\\n?|\\n/g);\n            var indentation = guessIndentation(lines);\n            for (var i = 0; i < lines.length; i++) {\n                var line = indentation ? lines[i].slice(indentation) : lines[i];\n                if (line.length) {\n                    if (i > 0) {\n                        writeLine();\n                    }\n                    write(line);\n                }\n            }\n        }\n        function guessIndentation(lines) {\n            var indentation;\n            for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) {\n                var line = lines_1[_a];\n                for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) {\n                    if (!ts.isWhiteSpace(line.charCodeAt(i))) {\n                        if (indentation === undefined || i < indentation) {\n                            indentation = i;\n                            break;\n                        }\n                    }\n                }\n            }\n            return indentation;\n        }\n        function emitShebang() {\n            var shebang = ts.getShebang(currentText);\n            if (shebang) {\n                write(shebang);\n                writeLine();\n            }\n        }\n        function emitModifiers(node, modifiers) {\n            if (modifiers && modifiers.length) {\n                emitList(node, modifiers, 256);\n                write(\" \");\n            }\n        }\n        function emitWithPrefix(prefix, node) {\n            emitNodeWithPrefix(prefix, node, emit);\n        }\n        function emitExpressionWithPrefix(prefix, node) {\n            emitNodeWithPrefix(prefix, node, emitExpression);\n        }\n        function emitNodeWithPrefix(prefix, node, emit) {\n            if (node) {\n                write(prefix);\n                emit(node);\n            }\n        }\n        function emitWithSuffix(node, suffix) {\n            if (node) {\n                emit(node);\n                write(suffix);\n            }\n        }\n        function emitEmbeddedStatement(node) {\n            if (ts.isBlock(node)) {\n                write(\" \");\n                emit(node);\n            }\n            else {\n                writeLine();\n                increaseIndent();\n                emit(node);\n                decreaseIndent();\n            }\n        }\n        function emitDecorators(parentNode, decorators) {\n            emitList(parentNode, decorators, 24577);\n        }\n        function emitTypeArguments(parentNode, typeArguments) {\n            emitList(parentNode, typeArguments, 26960);\n        }\n        function emitTypeParameters(parentNode, typeParameters) {\n            emitList(parentNode, typeParameters, 26960);\n        }\n        function emitParameters(parentNode, parameters) {\n            emitList(parentNode, parameters, 1360);\n        }\n        function emitParametersForArrow(parentNode, parameters) {\n            if (parameters &&\n                parameters.length === 1 &&\n                parameters[0].type === undefined &&\n                parameters[0].pos === parentNode.pos) {\n                emit(parameters[0]);\n            }\n            else {\n                emitParameters(parentNode, parameters);\n            }\n        }\n        function emitParametersForIndexSignature(parentNode, parameters) {\n            emitList(parentNode, parameters, 4432);\n        }\n        function emitList(parentNode, children, format, start, count) {\n            emitNodeList(emit, parentNode, children, format, start, count);\n        }\n        function emitExpressionList(parentNode, children, format, start, count) {\n            emitNodeList(emitExpression, parentNode, children, format, start, count);\n        }\n        function emitNodeList(emit, parentNode, children, format, start, count) {\n            if (start === void 0) { start = 0; }\n            if (count === void 0) { count = children ? children.length - start : 0; }\n            var isUndefined = children === undefined;\n            if (isUndefined && format & 8192) {\n                return;\n            }\n            var isEmpty = isUndefined || children.length === 0 || start >= children.length || count === 0;\n            if (isEmpty && format & 16384) {\n                return;\n            }\n            if (format & 7680) {\n                write(getOpeningBracket(format));\n            }\n            if (isEmpty) {\n                if (format & 1) {\n                    writeLine();\n                }\n                else if (format & 128) {\n                    write(\" \");\n                }\n            }\n            else {\n                var mayEmitInterveningComments = (format & 131072) === 0;\n                var shouldEmitInterveningComments = mayEmitInterveningComments;\n                if (shouldWriteLeadingLineTerminator(parentNode, children, format)) {\n                    writeLine();\n                    shouldEmitInterveningComments = false;\n                }\n                else if (format & 128) {\n                    write(\" \");\n                }\n                if (format & 64) {\n                    increaseIndent();\n                }\n                var previousSibling = void 0;\n                var shouldDecreaseIndentAfterEmit = void 0;\n                var delimiter = getDelimiter(format);\n                for (var i = 0; i < count; i++) {\n                    var child = children[start + i];\n                    if (previousSibling) {\n                        write(delimiter);\n                        if (shouldWriteSeparatingLineTerminator(previousSibling, child, format)) {\n                            if ((format & (3 | 64)) === 0) {\n                                increaseIndent();\n                                shouldDecreaseIndentAfterEmit = true;\n                            }\n                            writeLine();\n                            shouldEmitInterveningComments = false;\n                        }\n                        else if (previousSibling && format & 256) {\n                            write(\" \");\n                        }\n                    }\n                    if (shouldEmitInterveningComments) {\n                        var commentRange = ts.getCommentRange(child);\n                        emitTrailingCommentsOfPosition(commentRange.pos);\n                    }\n                    else {\n                        shouldEmitInterveningComments = mayEmitInterveningComments;\n                    }\n                    emit(child);\n                    if (shouldDecreaseIndentAfterEmit) {\n                        decreaseIndent();\n                        shouldDecreaseIndentAfterEmit = false;\n                    }\n                    previousSibling = child;\n                }\n                var hasTrailingComma = (format & 32) && children.hasTrailingComma;\n                if (format & 16 && hasTrailingComma) {\n                    write(\",\");\n                }\n                if (format & 64) {\n                    decreaseIndent();\n                }\n                if (shouldWriteClosingLineTerminator(parentNode, children, format)) {\n                    writeLine();\n                }\n                else if (format & 128) {\n                    write(\" \");\n                }\n            }\n            if (format & 7680) {\n                write(getClosingBracket(format));\n            }\n        }\n        function writeIfAny(nodes, text) {\n            if (nodes && nodes.length > 0) {\n                write(text);\n            }\n        }\n        function writeIfPresent(node, text) {\n            if (node !== undefined) {\n                write(text);\n            }\n        }\n        function writeToken(token, pos, contextNode) {\n            return emitTokenWithSourceMap(contextNode, token, pos, writeTokenText);\n        }\n        function writeTokenText(token, pos) {\n            var tokenString = ts.tokenToString(token);\n            write(tokenString);\n            return pos < 0 ? pos : pos + tokenString.length;\n        }\n        function increaseIndentIf(value, valueToWriteWhenNotIndenting) {\n            if (value) {\n                increaseIndent();\n                writeLine();\n            }\n            else if (valueToWriteWhenNotIndenting) {\n                write(valueToWriteWhenNotIndenting);\n            }\n        }\n        function decreaseIndentIf(value1, value2) {\n            if (value1) {\n                decreaseIndent();\n            }\n            if (value2) {\n                decreaseIndent();\n            }\n        }\n        function shouldWriteLeadingLineTerminator(parentNode, children, format) {\n            if (format & 1) {\n                return true;\n            }\n            if (format & 2) {\n                if (format & 32768) {\n                    return true;\n                }\n                var firstChild = children[0];\n                if (firstChild === undefined) {\n                    return !ts.rangeIsOnSingleLine(parentNode, currentSourceFile);\n                }\n                else if (ts.positionIsSynthesized(parentNode.pos) || ts.nodeIsSynthesized(firstChild)) {\n                    return synthesizedNodeStartsOnNewLine(firstChild, format);\n                }\n                else {\n                    return !ts.rangeStartPositionsAreOnSameLine(parentNode, firstChild, currentSourceFile);\n                }\n            }\n            else {\n                return false;\n            }\n        }\n        function shouldWriteSeparatingLineTerminator(previousNode, nextNode, format) {\n            if (format & 1) {\n                return true;\n            }\n            else if (format & 2) {\n                if (previousNode === undefined || nextNode === undefined) {\n                    return false;\n                }\n                else if (ts.nodeIsSynthesized(previousNode) || ts.nodeIsSynthesized(nextNode)) {\n                    return synthesizedNodeStartsOnNewLine(previousNode, format) || synthesizedNodeStartsOnNewLine(nextNode, format);\n                }\n                else {\n                    return !ts.rangeEndIsOnSameLineAsRangeStart(previousNode, nextNode, currentSourceFile);\n                }\n            }\n            else {\n                return nextNode.startsOnNewLine;\n            }\n        }\n        function shouldWriteClosingLineTerminator(parentNode, children, format) {\n            if (format & 1) {\n                return (format & 65536) === 0;\n            }\n            else if (format & 2) {\n                if (format & 32768) {\n                    return true;\n                }\n                var lastChild = ts.lastOrUndefined(children);\n                if (lastChild === undefined) {\n                    return !ts.rangeIsOnSingleLine(parentNode, currentSourceFile);\n                }\n                else if (ts.positionIsSynthesized(parentNode.pos) || ts.nodeIsSynthesized(lastChild)) {\n                    return synthesizedNodeStartsOnNewLine(lastChild, format);\n                }\n                else {\n                    return !ts.rangeEndPositionsAreOnSameLine(parentNode, lastChild, currentSourceFile);\n                }\n            }\n            else {\n                return false;\n            }\n        }\n        function synthesizedNodeStartsOnNewLine(node, format) {\n            if (ts.nodeIsSynthesized(node)) {\n                var startsOnNewLine = node.startsOnNewLine;\n                if (startsOnNewLine === undefined) {\n                    return (format & 32768) !== 0;\n                }\n                return startsOnNewLine;\n            }\n            return (format & 32768) !== 0;\n        }\n        function needsIndentation(parent, node1, node2) {\n            parent = skipSynthesizedParentheses(parent);\n            node1 = skipSynthesizedParentheses(node1);\n            node2 = skipSynthesizedParentheses(node2);\n            if (node2.startsOnNewLine) {\n                return true;\n            }\n            return !ts.nodeIsSynthesized(parent)\n                && !ts.nodeIsSynthesized(node1)\n                && !ts.nodeIsSynthesized(node2)\n                && !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile);\n        }\n        function skipSynthesizedParentheses(node) {\n            while (node.kind === 183 && ts.nodeIsSynthesized(node)) {\n                node = node.expression;\n            }\n            return node;\n        }\n        function getTextOfNode(node, includeTrivia) {\n            if (ts.isGeneratedIdentifier(node)) {\n                return getGeneratedIdentifier(node);\n            }\n            else if (ts.isIdentifier(node) && (ts.nodeIsSynthesized(node) || !node.parent)) {\n                return ts.unescapeIdentifier(node.text);\n            }\n            else if (node.kind === 9 && node.textSourceNode) {\n                return getTextOfNode(node.textSourceNode, includeTrivia);\n            }\n            else if (ts.isLiteralExpression(node) && (ts.nodeIsSynthesized(node) || !node.parent)) {\n                return node.text;\n            }\n            return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node, includeTrivia);\n        }\n        function getLiteralTextOfNode(node) {\n            if (node.kind === 9 && node.textSourceNode) {\n                var textSourceNode = node.textSourceNode;\n                if (ts.isIdentifier(textSourceNode)) {\n                    return \"\\\"\" + ts.escapeNonAsciiCharacters(ts.escapeString(getTextOfNode(textSourceNode))) + \"\\\"\";\n                }\n                else {\n                    return getLiteralTextOfNode(textSourceNode);\n                }\n            }\n            return ts.getLiteralText(node, currentSourceFile, languageVersion);\n        }\n        function isSingleLineEmptyBlock(block) {\n            return !block.multiLine\n                && isEmptyBlock(block);\n        }\n        function isEmptyBlock(block) {\n            return block.statements.length === 0\n                && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);\n        }\n        function isUniqueName(name) {\n            return !resolver.hasGlobalName(name) &&\n                !ts.hasProperty(currentFileIdentifiers, name) &&\n                !ts.hasProperty(generatedNameSet, name);\n        }\n        function isUniqueLocalName(name, container) {\n            for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) {\n                if (node.locals && ts.hasProperty(node.locals, name)) {\n                    if (node.locals[name].flags & (107455 | 1048576 | 8388608)) {\n                        return false;\n                    }\n                }\n            }\n            return true;\n        }\n        function makeTempVariableName(flags) {\n            if (flags && !(tempFlags & flags)) {\n                var name_40 = flags === 268435456 ? \"_i\" : \"_n\";\n                if (isUniqueName(name_40)) {\n                    tempFlags |= flags;\n                    return name_40;\n                }\n            }\n            while (true) {\n                var count = tempFlags & 268435455;\n                tempFlags++;\n                if (count !== 8 && count !== 13) {\n                    var name_41 = count < 26\n                        ? \"_\" + String.fromCharCode(97 + count)\n                        : \"_\" + (count - 26);\n                    if (isUniqueName(name_41)) {\n                        return name_41;\n                    }\n                }\n            }\n        }\n        function makeUniqueName(baseName) {\n            if (baseName.charCodeAt(baseName.length - 1) !== 95) {\n                baseName += \"_\";\n            }\n            var i = 1;\n            while (true) {\n                var generatedName = baseName + i;\n                if (isUniqueName(generatedName)) {\n                    return generatedNameSet[generatedName] = generatedName;\n                }\n                i++;\n            }\n        }\n        function generateNameForModuleOrEnum(node) {\n            var name = getTextOfNode(node.name);\n            return isUniqueLocalName(name, node) ? name : makeUniqueName(name);\n        }\n        function generateNameForImportOrExportDeclaration(node) {\n            var expr = ts.getExternalModuleName(node);\n            var baseName = expr.kind === 9 ?\n                ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : \"module\";\n            return makeUniqueName(baseName);\n        }\n        function generateNameForExportDefault() {\n            return makeUniqueName(\"default\");\n        }\n        function generateNameForClassExpression() {\n            return makeUniqueName(\"class\");\n        }\n        function generateNameForNode(node) {\n            switch (node.kind) {\n                case 70:\n                    return makeUniqueName(getTextOfNode(node));\n                case 230:\n                case 229:\n                    return generateNameForModuleOrEnum(node);\n                case 235:\n                case 241:\n                    return generateNameForImportOrExportDeclaration(node);\n                case 225:\n                case 226:\n                case 240:\n                    return generateNameForExportDefault();\n                case 197:\n                    return generateNameForClassExpression();\n                default:\n                    return makeTempVariableName(0);\n            }\n        }\n        function generateName(name) {\n            switch (name.autoGenerateKind) {\n                case 1:\n                    return makeTempVariableName(0);\n                case 2:\n                    return makeTempVariableName(268435456);\n                case 3:\n                    return makeUniqueName(name.text);\n            }\n            ts.Debug.fail(\"Unsupported GeneratedIdentifierKind.\");\n        }\n        function getNodeForGeneratedName(name) {\n            var autoGenerateId = name.autoGenerateId;\n            var node = name;\n            var original = node.original;\n            while (original) {\n                node = original;\n                if (ts.isIdentifier(node)\n                    && node.autoGenerateKind === 4\n                    && node.autoGenerateId !== autoGenerateId) {\n                    break;\n                }\n                original = node.original;\n            }\n            return node;\n        }\n        function getGeneratedIdentifier(name) {\n            if (name.autoGenerateKind === 4) {\n                var node = getNodeForGeneratedName(name);\n                var nodeId = ts.getNodeId(node);\n                return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node)));\n            }\n            else {\n                var autoGenerateId = name.autoGenerateId;\n                return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = ts.unescapeIdentifier(generateName(name)));\n            }\n        }\n        function createDelimiterMap() {\n            var delimiters = [];\n            delimiters[0] = \"\";\n            delimiters[16] = \",\";\n            delimiters[4] = \" |\";\n            delimiters[8] = \" &\";\n            return delimiters;\n        }\n        function getDelimiter(format) {\n            return delimiters[format & 28];\n        }\n        function createBracketsMap() {\n            var brackets = [];\n            brackets[512] = [\"{\", \"}\"];\n            brackets[1024] = [\"(\", \")\"];\n            brackets[2048] = [\"<\", \">\"];\n            brackets[4096] = [\"[\", \"]\"];\n            return brackets;\n        }\n        function getOpeningBracket(format) {\n            return brackets[format & 7680][0];\n        }\n        function getClosingBracket(format) {\n            return brackets[format & 7680][1];\n        }\n    }\n    ts.emitFiles = emitFiles;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var emptyArray = [];\n    function findConfigFile(searchPath, fileExists, configName) {\n        if (configName === void 0) { configName = \"tsconfig.json\"; }\n        while (true) {\n            var fileName = ts.combinePaths(searchPath, configName);\n            if (fileExists(fileName)) {\n                return fileName;\n            }\n            var parentPath = ts.getDirectoryPath(searchPath);\n            if (parentPath === searchPath) {\n                break;\n            }\n            searchPath = parentPath;\n        }\n        return undefined;\n    }\n    ts.findConfigFile = findConfigFile;\n    function resolveTripleslashReference(moduleName, containingFile) {\n        var basePath = ts.getDirectoryPath(containingFile);\n        var referencedFileName = ts.isRootedDiskPath(moduleName) ? moduleName : ts.combinePaths(basePath, moduleName);\n        return ts.normalizePath(referencedFileName);\n    }\n    ts.resolveTripleslashReference = resolveTripleslashReference;\n    function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) {\n        var commonPathComponents;\n        var failed = ts.forEach(fileNames, function (sourceFile) {\n            var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile, currentDirectory);\n            sourcePathComponents.pop();\n            if (!commonPathComponents) {\n                commonPathComponents = sourcePathComponents;\n                return;\n            }\n            for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) {\n                if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) {\n                    if (i === 0) {\n                        return true;\n                    }\n                    commonPathComponents.length = i;\n                    break;\n                }\n            }\n            if (sourcePathComponents.length < commonPathComponents.length) {\n                commonPathComponents.length = sourcePathComponents.length;\n            }\n        });\n        if (failed) {\n            return \"\";\n        }\n        if (!commonPathComponents) {\n            return currentDirectory;\n        }\n        return ts.getNormalizedPathFromPathComponents(commonPathComponents);\n    }\n    ts.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames;\n    function createCompilerHost(options, setParentNodes) {\n        var existingDirectories = ts.createMap();\n        function getCanonicalFileName(fileName) {\n            return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();\n        }\n        var unsupportedFileEncodingErrorCode = -2147024809;\n        function getSourceFile(fileName, languageVersion, onError) {\n            var text;\n            try {\n                ts.performance.mark(\"beforeIORead\");\n                text = ts.sys.readFile(fileName, options.charset);\n                ts.performance.mark(\"afterIORead\");\n                ts.performance.measure(\"I/O Read\", \"beforeIORead\", \"afterIORead\");\n            }\n            catch (e) {\n                if (onError) {\n                    onError(e.number === unsupportedFileEncodingErrorCode\n                        ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText\n                        : e.message);\n                }\n                text = \"\";\n            }\n            return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined;\n        }\n        function directoryExists(directoryPath) {\n            if (directoryPath in existingDirectories) {\n                return true;\n            }\n            if (ts.sys.directoryExists(directoryPath)) {\n                existingDirectories[directoryPath] = true;\n                return true;\n            }\n            return false;\n        }\n        function ensureDirectoriesExist(directoryPath) {\n            if (directoryPath.length > ts.getRootLength(directoryPath) && !directoryExists(directoryPath)) {\n                var parentDirectory = ts.getDirectoryPath(directoryPath);\n                ensureDirectoriesExist(parentDirectory);\n                ts.sys.createDirectory(directoryPath);\n            }\n        }\n        var outputFingerprints;\n        function writeFileIfUpdated(fileName, data, writeByteOrderMark) {\n            if (!outputFingerprints) {\n                outputFingerprints = ts.createMap();\n            }\n            var hash = ts.sys.createHash(data);\n            var mtimeBefore = ts.sys.getModifiedTime(fileName);\n            if (mtimeBefore && fileName in outputFingerprints) {\n                var fingerprint = outputFingerprints[fileName];\n                if (fingerprint.byteOrderMark === writeByteOrderMark &&\n                    fingerprint.hash === hash &&\n                    fingerprint.mtime.getTime() === mtimeBefore.getTime()) {\n                    return;\n                }\n            }\n            ts.sys.writeFile(fileName, data, writeByteOrderMark);\n            var mtimeAfter = ts.sys.getModifiedTime(fileName);\n            outputFingerprints[fileName] = {\n                hash: hash,\n                byteOrderMark: writeByteOrderMark,\n                mtime: mtimeAfter\n            };\n        }\n        function writeFile(fileName, data, writeByteOrderMark, onError) {\n            try {\n                ts.performance.mark(\"beforeIOWrite\");\n                ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName)));\n                if (ts.isWatchSet(options) && ts.sys.createHash && ts.sys.getModifiedTime) {\n                    writeFileIfUpdated(fileName, data, writeByteOrderMark);\n                }\n                else {\n                    ts.sys.writeFile(fileName, data, writeByteOrderMark);\n                }\n                ts.performance.mark(\"afterIOWrite\");\n                ts.performance.measure(\"I/O Write\", \"beforeIOWrite\", \"afterIOWrite\");\n            }\n            catch (e) {\n                if (onError) {\n                    onError(e.message);\n                }\n            }\n        }\n        function getDefaultLibLocation() {\n            return ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath()));\n        }\n        var newLine = ts.getNewLineCharacter(options);\n        var realpath = ts.sys.realpath && (function (path) { return ts.sys.realpath(path); });\n        return {\n            getSourceFile: getSourceFile,\n            getDefaultLibLocation: getDefaultLibLocation,\n            getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); },\n            writeFile: writeFile,\n            getCurrentDirectory: ts.memoize(function () { return ts.sys.getCurrentDirectory(); }),\n            useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; },\n            getCanonicalFileName: getCanonicalFileName,\n            getNewLine: function () { return newLine; },\n            fileExists: function (fileName) { return ts.sys.fileExists(fileName); },\n            readFile: function (fileName) { return ts.sys.readFile(fileName); },\n            trace: function (s) { return ts.sys.write(s + newLine); },\n            directoryExists: function (directoryName) { return ts.sys.directoryExists(directoryName); },\n            getEnvironmentVariable: function (name) { return ts.sys.getEnvironmentVariable ? ts.sys.getEnvironmentVariable(name) : \"\"; },\n            getDirectories: function (path) { return ts.sys.getDirectories(path); },\n            realpath: realpath\n        };\n    }\n    ts.createCompilerHost = createCompilerHost;\n    function getPreEmitDiagnostics(program, sourceFile, cancellationToken) {\n        var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken));\n        if (program.getCompilerOptions().declaration) {\n            diagnostics = diagnostics.concat(program.getDeclarationDiagnostics(sourceFile, cancellationToken));\n        }\n        return ts.sortAndDeduplicateDiagnostics(diagnostics);\n    }\n    ts.getPreEmitDiagnostics = getPreEmitDiagnostics;\n    function formatDiagnostics(diagnostics, host) {\n        var output = \"\";\n        for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {\n            var diagnostic = diagnostics_1[_i];\n            if (diagnostic.file) {\n                var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character;\n                var fileName = diagnostic.file.fileName;\n                var relativeFileName = ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); });\n                output += relativeFileName + \"(\" + (line + 1) + \",\" + (character + 1) + \"): \";\n            }\n            var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();\n            output += category + \" TS\" + diagnostic.code + \": \" + flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()) + host.getNewLine();\n        }\n        return output;\n    }\n    ts.formatDiagnostics = formatDiagnostics;\n    function flattenDiagnosticMessageText(messageText, newLine) {\n        if (typeof messageText === \"string\") {\n            return messageText;\n        }\n        else {\n            var diagnosticChain = messageText;\n            var result = \"\";\n            var indent = 0;\n            while (diagnosticChain) {\n                if (indent) {\n                    result += newLine;\n                    for (var i = 0; i < indent; i++) {\n                        result += \"  \";\n                    }\n                }\n                result += diagnosticChain.messageText;\n                indent++;\n                diagnosticChain = diagnosticChain.next;\n            }\n            return result;\n        }\n    }\n    ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText;\n    function loadWithLocalCache(names, containingFile, loader) {\n        if (names.length === 0) {\n            return [];\n        }\n        var resolutions = [];\n        var cache = ts.createMap();\n        for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {\n            var name_42 = names_1[_i];\n            var result = name_42 in cache\n                ? cache[name_42]\n                : cache[name_42] = loader(name_42, containingFile);\n            resolutions.push(result);\n        }\n        return resolutions;\n    }\n    function createProgram(rootNames, options, host, oldProgram) {\n        var program;\n        var files = [];\n        var commonSourceDirectory;\n        var diagnosticsProducingTypeChecker;\n        var noDiagnosticsTypeChecker;\n        var classifiableNames;\n        var resolvedTypeReferenceDirectives = ts.createMap();\n        var fileProcessingDiagnostics = ts.createDiagnosticCollection();\n        var maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === \"number\" ? options.maxNodeModuleJsDepth : 0;\n        var currentNodeModulesDepth = 0;\n        var modulesWithElidedImports = ts.createMap();\n        var sourceFilesFoundSearchingNodeModules = ts.createMap();\n        ts.performance.mark(\"beforeProgram\");\n        host = host || createCompilerHost(options);\n        var skipDefaultLib = options.noLib;\n        var programDiagnostics = ts.createDiagnosticCollection();\n        var currentDirectory = host.getCurrentDirectory();\n        var supportedExtensions = ts.getSupportedExtensions(options);\n        var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName);\n        var resolveModuleNamesWorker;\n        if (host.resolveModuleNames) {\n            resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile).map(function (resolved) {\n                if (!resolved || resolved.extension !== undefined) {\n                    return resolved;\n                }\n                var withExtension = ts.clone(resolved);\n                withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName);\n                return withExtension;\n            }); };\n        }\n        else {\n            var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host).resolvedModule; };\n            resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); };\n        }\n        var resolveTypeReferenceDirectiveNamesWorker;\n        if (host.resolveTypeReferenceDirectives) {\n            resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); };\n        }\n        else {\n            var loader_2 = function (typesRef, containingFile) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; };\n            resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader_2); };\n        }\n        var filesByName = ts.createFileMap();\n        var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined;\n        if (!tryReuseStructureFromOldProgram()) {\n            ts.forEach(rootNames, function (name) { return processRootFile(name, false); });\n            var typeReferences = ts.getAutomaticTypeDirectiveNames(options, host);\n            if (typeReferences.length) {\n                var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();\n                var containingFilename = ts.combinePaths(containingDirectory, \"__inferred type names__.ts\");\n                var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);\n                for (var i = 0; i < typeReferences.length; i++) {\n                    processTypeReferenceDirective(typeReferences[i], resolutions[i]);\n                }\n            }\n            if (!skipDefaultLib) {\n                if (!options.lib) {\n                    processRootFile(host.getDefaultLibFileName(options), true);\n                }\n                else {\n                    var libDirectory_1 = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(host.getDefaultLibFileName(options));\n                    ts.forEach(options.lib, function (libFileName) {\n                        processRootFile(ts.combinePaths(libDirectory_1, libFileName), true);\n                    });\n                }\n            }\n        }\n        oldProgram = undefined;\n        program = {\n            getRootFileNames: function () { return rootNames; },\n            getSourceFile: getSourceFile,\n            getSourceFileByPath: getSourceFileByPath,\n            getSourceFiles: function () { return files; },\n            getCompilerOptions: function () { return options; },\n            getSyntacticDiagnostics: getSyntacticDiagnostics,\n            getOptionsDiagnostics: getOptionsDiagnostics,\n            getGlobalDiagnostics: getGlobalDiagnostics,\n            getSemanticDiagnostics: getSemanticDiagnostics,\n            getDeclarationDiagnostics: getDeclarationDiagnostics,\n            getTypeChecker: getTypeChecker,\n            getClassifiableNames: getClassifiableNames,\n            getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker,\n            getCommonSourceDirectory: getCommonSourceDirectory,\n            emit: emit,\n            getCurrentDirectory: function () { return currentDirectory; },\n            getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); },\n            getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); },\n            getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); },\n            getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },\n            getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },\n            getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },\n            isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,\n            dropDiagnosticsProducingTypeChecker: dropDiagnosticsProducingTypeChecker\n        };\n        verifyCompilerOptions();\n        ts.performance.mark(\"afterProgram\");\n        ts.performance.measure(\"Program\", \"beforeProgram\", \"afterProgram\");\n        return program;\n        function getCommonSourceDirectory() {\n            if (commonSourceDirectory === undefined) {\n                var emittedFiles = ts.filterSourceFilesInDirectory(files, isSourceFileFromExternalLibrary);\n                if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) {\n                    commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory);\n                }\n                else {\n                    commonSourceDirectory = computeCommonSourceDirectory(emittedFiles);\n                }\n                if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) {\n                    commonSourceDirectory += ts.directorySeparator;\n                }\n            }\n            return commonSourceDirectory;\n        }\n        function getClassifiableNames() {\n            if (!classifiableNames) {\n                getTypeChecker();\n                classifiableNames = ts.createMap();\n                for (var _i = 0, files_2 = files; _i < files_2.length; _i++) {\n                    var sourceFile = files_2[_i];\n                    ts.copyProperties(sourceFile.classifiableNames, classifiableNames);\n                }\n            }\n            return classifiableNames;\n        }\n        function resolveModuleNamesReusingOldState(moduleNames, containingFile, file, oldProgramState) {\n            if (!oldProgramState && !file.ambientModuleNames.length) {\n                return resolveModuleNamesWorker(moduleNames, containingFile);\n            }\n            var unknownModuleNames;\n            var result;\n            var predictedToResolveToAmbientModuleMarker = {};\n            for (var i = 0; i < moduleNames.length; i++) {\n                var moduleName = moduleNames[i];\n                var isKnownToResolveToAmbientModule = false;\n                if (ts.contains(file.ambientModuleNames, moduleName)) {\n                    isKnownToResolveToAmbientModule = true;\n                    if (ts.isTraceEnabled(options, host)) {\n                        ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName, containingFile);\n                    }\n                }\n                else {\n                    isKnownToResolveToAmbientModule = checkModuleNameResolvedToAmbientModuleInNonModifiedFile(moduleName, oldProgramState);\n                }\n                if (isKnownToResolveToAmbientModule) {\n                    if (!unknownModuleNames) {\n                        result = new Array(moduleNames.length);\n                        unknownModuleNames = moduleNames.slice(0, i);\n                    }\n                    result[i] = predictedToResolveToAmbientModuleMarker;\n                }\n                else if (unknownModuleNames) {\n                    unknownModuleNames.push(moduleName);\n                }\n            }\n            if (!unknownModuleNames) {\n                return resolveModuleNamesWorker(moduleNames, containingFile);\n            }\n            var resolutions = unknownModuleNames.length\n                ? resolveModuleNamesWorker(unknownModuleNames, containingFile)\n                : emptyArray;\n            var j = 0;\n            for (var i = 0; i < result.length; i++) {\n                if (result[i] == predictedToResolveToAmbientModuleMarker) {\n                    result[i] = undefined;\n                }\n                else {\n                    result[i] = resolutions[j];\n                    j++;\n                }\n            }\n            ts.Debug.assert(j === resolutions.length);\n            return result;\n            function checkModuleNameResolvedToAmbientModuleInNonModifiedFile(moduleName, oldProgramState) {\n                if (!oldProgramState) {\n                    return false;\n                }\n                var resolutionToFile = ts.getResolvedModule(oldProgramState.file, moduleName);\n                if (resolutionToFile) {\n                    return false;\n                }\n                var ambientModule = oldProgram.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(moduleName);\n                if (!(ambientModule && ambientModule.declarations)) {\n                    return false;\n                }\n                var firstUnmodifiedFile = ts.forEach(ambientModule.declarations, function (d) {\n                    var f = ts.getSourceFileOfNode(d);\n                    return !ts.contains(oldProgramState.modifiedFilePaths, f.path) && f;\n                });\n                if (!firstUnmodifiedFile) {\n                    return false;\n                }\n                if (ts.isTraceEnabled(options, host)) {\n                    ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName, firstUnmodifiedFile.fileName);\n                }\n                return true;\n            }\n        }\n        function tryReuseStructureFromOldProgram() {\n            if (!oldProgram) {\n                return false;\n            }\n            var oldOptions = oldProgram.getCompilerOptions();\n            if (ts.changesAffectModuleResolution(oldOptions, options)) {\n                return false;\n            }\n            ts.Debug.assert(!oldProgram.structureIsReused);\n            var oldRootNames = oldProgram.getRootFileNames();\n            if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) {\n                return false;\n            }\n            if (!ts.arrayIsEqualTo(options.types, oldOptions.types)) {\n                return false;\n            }\n            var newSourceFiles = [];\n            var filePaths = [];\n            var modifiedSourceFiles = [];\n            for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) {\n                var oldSourceFile = _a[_i];\n                var newSourceFile = host.getSourceFileByPath\n                    ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.path, options.target)\n                    : host.getSourceFile(oldSourceFile.fileName, options.target);\n                if (!newSourceFile) {\n                    return false;\n                }\n                newSourceFile.path = oldSourceFile.path;\n                filePaths.push(newSourceFile.path);\n                if (oldSourceFile !== newSourceFile) {\n                    if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {\n                        return false;\n                    }\n                    if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {\n                        return false;\n                    }\n                    collectExternalModuleReferences(newSourceFile);\n                    if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {\n                        return false;\n                    }\n                    if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {\n                        return false;\n                    }\n                    if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {\n                        return false;\n                    }\n                    modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });\n                }\n                else {\n                    newSourceFile = oldSourceFile;\n                }\n                newSourceFiles.push(newSourceFile);\n            }\n            var modifiedFilePaths = modifiedSourceFiles.map(function (f) { return f.newFile.path; });\n            for (var _b = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _b < modifiedSourceFiles_1.length; _b++) {\n                var _c = modifiedSourceFiles_1[_b], oldSourceFile = _c.oldFile, newSourceFile = _c.newFile;\n                var newSourceFilePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory);\n                if (resolveModuleNamesWorker) {\n                    var moduleNames = ts.map(ts.concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral);\n                    var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFilePath, newSourceFile, { file: oldSourceFile, program: oldProgram, modifiedFilePaths: modifiedFilePaths });\n                    var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo);\n                    if (resolutionsChanged) {\n                        return false;\n                    }\n                }\n                if (resolveTypeReferenceDirectiveNamesWorker) {\n                    var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (x) { return x.fileName; });\n                    var resolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFilePath);\n                    var resolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo);\n                    if (resolutionsChanged) {\n                        return false;\n                    }\n                }\n                newSourceFile.resolvedModules = oldSourceFile.resolvedModules;\n                newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;\n            }\n            for (var i = 0, len = newSourceFiles.length; i < len; i++) {\n                filesByName.set(filePaths[i], newSourceFiles[i]);\n            }\n            files = newSourceFiles;\n            fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();\n            for (var _d = 0, modifiedSourceFiles_2 = modifiedSourceFiles; _d < modifiedSourceFiles_2.length; _d++) {\n                var modifiedFile = modifiedSourceFiles_2[_d];\n                fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile.newFile);\n            }\n            resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();\n            oldProgram.structureIsReused = true;\n            return true;\n        }\n        function getEmitHost(writeFileCallback) {\n            return {\n                getCanonicalFileName: getCanonicalFileName,\n                getCommonSourceDirectory: program.getCommonSourceDirectory,\n                getCompilerOptions: program.getCompilerOptions,\n                getCurrentDirectory: function () { return currentDirectory; },\n                getNewLine: function () { return host.getNewLine(); },\n                getSourceFile: program.getSourceFile,\n                getSourceFileByPath: program.getSourceFileByPath,\n                getSourceFiles: program.getSourceFiles,\n                isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,\n                writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }),\n                isEmitBlocked: isEmitBlocked,\n            };\n        }\n        function isSourceFileFromExternalLibrary(file) {\n            return sourceFilesFoundSearchingNodeModules[file.path];\n        }\n        function getDiagnosticsProducingTypeChecker() {\n            return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true));\n        }\n        function dropDiagnosticsProducingTypeChecker() {\n            diagnosticsProducingTypeChecker = undefined;\n        }\n        function getTypeChecker() {\n            return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false));\n        }\n        function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) {\n            return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles); });\n        }\n        function isEmitBlocked(emitFileName) {\n            return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName));\n        }\n        function emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) {\n            var declarationDiagnostics = [];\n            if (options.noEmit) {\n                return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true };\n            }\n            if (options.noEmitOnError) {\n                var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken));\n                if (diagnostics.length === 0 && program.getCompilerOptions().declaration) {\n                    declarationDiagnostics = program.getDeclarationDiagnostics(undefined, cancellationToken);\n                }\n                if (diagnostics.length > 0 || declarationDiagnostics.length > 0) {\n                    return {\n                        diagnostics: ts.concatenate(diagnostics, declarationDiagnostics),\n                        sourceMaps: undefined,\n                        emittedFiles: undefined,\n                        emitSkipped: true\n                    };\n                }\n            }\n            var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile);\n            ts.performance.mark(\"beforeEmit\");\n            var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles);\n            ts.performance.mark(\"afterEmit\");\n            ts.performance.measure(\"Emit\", \"beforeEmit\", \"afterEmit\");\n            return emitResult;\n        }\n        function getSourceFile(fileName) {\n            return getSourceFileByPath(ts.toPath(fileName, currentDirectory, getCanonicalFileName));\n        }\n        function getSourceFileByPath(path) {\n            return filesByName.get(path);\n        }\n        function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) {\n            if (sourceFile) {\n                return getDiagnostics(sourceFile, cancellationToken);\n            }\n            var allDiagnostics = [];\n            ts.forEach(program.getSourceFiles(), function (sourceFile) {\n                if (cancellationToken) {\n                    cancellationToken.throwIfCancellationRequested();\n                }\n                ts.addRange(allDiagnostics, getDiagnostics(sourceFile, cancellationToken));\n            });\n            return ts.sortAndDeduplicateDiagnostics(allDiagnostics);\n        }\n        function getSyntacticDiagnostics(sourceFile, cancellationToken) {\n            return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken);\n        }\n        function getSemanticDiagnostics(sourceFile, cancellationToken) {\n            return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken);\n        }\n        function getDeclarationDiagnostics(sourceFile, cancellationToken) {\n            var options = program.getCompilerOptions();\n            if (!sourceFile || options.out || options.outFile) {\n                return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);\n            }\n            else {\n                return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken);\n            }\n        }\n        function getSyntacticDiagnosticsForFile(sourceFile) {\n            if (ts.isSourceFileJavaScript(sourceFile)) {\n                if (!sourceFile.additionalSyntacticDiagnostics) {\n                    sourceFile.additionalSyntacticDiagnostics = getJavaScriptSyntacticDiagnosticsForFile(sourceFile);\n                }\n                return ts.concatenate(sourceFile.additionalSyntacticDiagnostics, sourceFile.parseDiagnostics);\n            }\n            return sourceFile.parseDiagnostics;\n        }\n        function runWithCancellationToken(func) {\n            try {\n                return func();\n            }\n            catch (e) {\n                if (e instanceof ts.OperationCanceledException) {\n                    noDiagnosticsTypeChecker = undefined;\n                    diagnosticsProducingTypeChecker = undefined;\n                }\n                throw e;\n            }\n        }\n        function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) {\n            return runWithCancellationToken(function () {\n                var typeChecker = getDiagnosticsProducingTypeChecker();\n                ts.Debug.assert(!!sourceFile.bindDiagnostics);\n                var bindDiagnostics = sourceFile.bindDiagnostics;\n                var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ? [] : typeChecker.getDiagnostics(sourceFile, cancellationToken);\n                var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName);\n                var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);\n                return bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile);\n            });\n        }\n        function getJavaScriptSyntacticDiagnosticsForFile(sourceFile) {\n            return runWithCancellationToken(function () {\n                var diagnostics = [];\n                var parent = sourceFile;\n                walk(sourceFile);\n                return diagnostics;\n                function walk(node) {\n                    switch (parent.kind) {\n                        case 144:\n                        case 147:\n                            if (parent.questionToken === node) {\n                                diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, \"?\"));\n                                return;\n                            }\n                        case 149:\n                        case 148:\n                        case 150:\n                        case 151:\n                        case 152:\n                        case 184:\n                        case 225:\n                        case 185:\n                        case 225:\n                        case 223:\n                            if (parent.type === node) {\n                                diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                    }\n                    switch (node.kind) {\n                        case 234:\n                            diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file));\n                            return;\n                        case 240:\n                            if (node.isExportEquals) {\n                                diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                            break;\n                        case 255:\n                            var heritageClause = node;\n                            if (heritageClause.token === 107) {\n                                diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                            break;\n                        case 227:\n                            diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file));\n                            return;\n                        case 230:\n                            diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file));\n                            return;\n                        case 228:\n                            diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file));\n                            return;\n                        case 229:\n                            diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file));\n                            return;\n                        case 182:\n                            var typeAssertionExpression = node;\n                            diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));\n                            return;\n                    }\n                    var prevParent = parent;\n                    parent = node;\n                    ts.forEachChild(node, walk, walkArray);\n                    parent = prevParent;\n                }\n                function walkArray(nodes) {\n                    if (parent.decorators === nodes && !options.experimentalDecorators) {\n                        diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning));\n                    }\n                    switch (parent.kind) {\n                        case 226:\n                        case 149:\n                        case 148:\n                        case 150:\n                        case 151:\n                        case 152:\n                        case 184:\n                        case 225:\n                        case 185:\n                        case 225:\n                            if (nodes === parent.typeParameters) {\n                                diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                        case 205:\n                            if (nodes === parent.modifiers) {\n                                return checkModifiers(nodes, parent.kind === 205);\n                            }\n                            break;\n                        case 147:\n                            if (nodes === parent.modifiers) {\n                                for (var _i = 0, _a = nodes; _i < _a.length; _i++) {\n                                    var modifier = _a[_i];\n                                    if (modifier.kind !== 114) {\n                                        diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));\n                                    }\n                                }\n                                return;\n                            }\n                            break;\n                        case 144:\n                            if (nodes === parent.modifiers) {\n                                diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                            break;\n                        case 179:\n                        case 180:\n                        case 199:\n                            if (nodes === parent.typeArguments) {\n                                diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                            break;\n                    }\n                    for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) {\n                        var node = nodes_6[_b];\n                        walk(node);\n                    }\n                }\n                function checkModifiers(modifiers, isConstValid) {\n                    for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) {\n                        var modifier = modifiers_1[_i];\n                        switch (modifier.kind) {\n                            case 75:\n                                if (isConstValid) {\n                                    continue;\n                                }\n                            case 113:\n                            case 111:\n                            case 112:\n                            case 130:\n                            case 123:\n                            case 116:\n                                diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));\n                                break;\n                            case 114:\n                            case 83:\n                            case 78:\n                        }\n                    }\n                }\n                function createDiagnosticForNodeArray(nodes, message, arg0, arg1, arg2) {\n                    var start = nodes.pos;\n                    return ts.createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2);\n                }\n                function createDiagnosticForNode(node, message, arg0, arg1, arg2) {\n                    return ts.createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2);\n                }\n            });\n        }\n        function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) {\n            return runWithCancellationToken(function () {\n                var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken);\n                return ts.getDeclarationDiagnostics(getEmitHost(ts.noop), resolver, sourceFile);\n            });\n        }\n        function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) {\n            return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);\n        }\n        function getOptionsDiagnostics() {\n            var allDiagnostics = [];\n            ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics());\n            ts.addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics());\n            return ts.sortAndDeduplicateDiagnostics(allDiagnostics);\n        }\n        function getGlobalDiagnostics() {\n            var allDiagnostics = [];\n            ts.addRange(allDiagnostics, getDiagnosticsProducingTypeChecker().getGlobalDiagnostics());\n            return ts.sortAndDeduplicateDiagnostics(allDiagnostics);\n        }\n        function processRootFile(fileName, isDefaultLib) {\n            processSourceFile(ts.normalizePath(fileName), isDefaultLib);\n        }\n        function fileReferenceIsEqualTo(a, b) {\n            return a.fileName === b.fileName;\n        }\n        function moduleNameIsEqualTo(a, b) {\n            return a.text === b.text;\n        }\n        function getTextOfLiteral(literal) {\n            return literal.text;\n        }\n        function collectExternalModuleReferences(file) {\n            if (file.imports) {\n                return;\n            }\n            var isJavaScriptFile = ts.isSourceFileJavaScript(file);\n            var isExternalModuleFile = ts.isExternalModule(file);\n            var isDtsFile = ts.isDeclarationFile(file);\n            var imports;\n            var moduleAugmentations;\n            var ambientModules;\n            if (options.importHelpers\n                && (options.isolatedModules || isExternalModuleFile)\n                && !file.isDeclarationFile) {\n                var externalHelpersModuleReference = ts.createSynthesizedNode(9);\n                externalHelpersModuleReference.text = ts.externalHelpersModuleNameText;\n                var importDecl = ts.createSynthesizedNode(235);\n                importDecl.parent = file;\n                externalHelpersModuleReference.parent = importDecl;\n                imports = [externalHelpersModuleReference];\n            }\n            for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {\n                var node = _a[_i];\n                collectModuleReferences(node, false);\n                if (isJavaScriptFile) {\n                    collectRequireCalls(node);\n                }\n            }\n            file.imports = imports || emptyArray;\n            file.moduleAugmentations = moduleAugmentations || emptyArray;\n            file.ambientModuleNames = ambientModules || emptyArray;\n            return;\n            function collectModuleReferences(node, inAmbientModule) {\n                switch (node.kind) {\n                    case 235:\n                    case 234:\n                    case 241:\n                        var moduleNameExpr = ts.getExternalModuleName(node);\n                        if (!moduleNameExpr || moduleNameExpr.kind !== 9) {\n                            break;\n                        }\n                        if (!moduleNameExpr.text) {\n                            break;\n                        }\n                        if (!inAmbientModule || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) {\n                            (imports || (imports = [])).push(moduleNameExpr);\n                        }\n                        break;\n                    case 230:\n                        if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2) || ts.isDeclarationFile(file))) {\n                            var moduleName = node.name;\n                            if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) {\n                                (moduleAugmentations || (moduleAugmentations = [])).push(moduleName);\n                            }\n                            else if (!inAmbientModule) {\n                                if (isDtsFile) {\n                                    (ambientModules || (ambientModules = [])).push(moduleName.text);\n                                }\n                                var body = node.body;\n                                if (body) {\n                                    for (var _i = 0, _a = body.statements; _i < _a.length; _i++) {\n                                        var statement = _a[_i];\n                                        collectModuleReferences(statement, true);\n                                    }\n                                }\n                            }\n                        }\n                }\n            }\n            function collectRequireCalls(node) {\n                if (ts.isRequireCall(node, true)) {\n                    (imports || (imports = [])).push(node.arguments[0]);\n                }\n                else {\n                    ts.forEachChild(node, collectRequireCalls);\n                }\n            }\n        }\n        function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) {\n            var diagnosticArgument;\n            var diagnostic;\n            if (ts.hasExtension(fileName)) {\n                if (!options.allowNonTsExtensions && !ts.forEach(supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) {\n                    diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1;\n                    diagnosticArgument = [fileName, \"'\" + supportedExtensions.join(\"', '\") + \"'\"];\n                }\n                else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) {\n                    diagnostic = ts.Diagnostics.File_0_not_found;\n                    diagnosticArgument = [fileName];\n                }\n                else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) {\n                    diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself;\n                    diagnosticArgument = [fileName];\n                }\n            }\n            else {\n                var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd);\n                if (!nonTsFile) {\n                    if (options.allowNonTsExtensions) {\n                        diagnostic = ts.Diagnostics.File_0_not_found;\n                        diagnosticArgument = [fileName];\n                    }\n                    else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) {\n                        diagnostic = ts.Diagnostics.File_0_not_found;\n                        fileName += \".ts\";\n                        diagnosticArgument = [fileName];\n                    }\n                }\n            }\n            if (diagnostic) {\n                if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) {\n                    fileProcessingDiagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument)));\n                }\n                else {\n                    fileProcessingDiagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument)));\n                }\n            }\n        }\n        function reportFileNamesDifferOnlyInCasingError(fileName, existingFileName, refFile, refPos, refEnd) {\n            if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {\n                fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName));\n            }\n            else {\n                fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName));\n            }\n        }\n        function findSourceFile(fileName, path, isDefaultLib, refFile, refPos, refEnd) {\n            if (filesByName.contains(path)) {\n                var file_1 = filesByName.get(path);\n                if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) {\n                    reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd);\n                }\n                if (file_1 && sourceFilesFoundSearchingNodeModules[file_1.path] && currentNodeModulesDepth == 0) {\n                    sourceFilesFoundSearchingNodeModules[file_1.path] = false;\n                    if (!options.noResolve) {\n                        processReferencedFiles(file_1, isDefaultLib);\n                        processTypeReferenceDirectives(file_1);\n                    }\n                    modulesWithElidedImports[file_1.path] = false;\n                    processImportedModules(file_1);\n                }\n                else if (file_1 && modulesWithElidedImports[file_1.path]) {\n                    if (currentNodeModulesDepth < maxNodeModuleJsDepth) {\n                        modulesWithElidedImports[file_1.path] = false;\n                        processImportedModules(file_1);\n                    }\n                }\n                return file_1;\n            }\n            var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) {\n                if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {\n                    fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));\n                }\n                else {\n                    fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));\n                }\n            });\n            filesByName.set(path, file);\n            if (file) {\n                sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0);\n                file.path = path;\n                if (host.useCaseSensitiveFileNames()) {\n                    var existingFile = filesByNameIgnoreCase.get(path);\n                    if (existingFile) {\n                        reportFileNamesDifferOnlyInCasingError(fileName, existingFile.fileName, refFile, refPos, refEnd);\n                    }\n                    else {\n                        filesByNameIgnoreCase.set(path, file);\n                    }\n                }\n                skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib;\n                if (!options.noResolve) {\n                    processReferencedFiles(file, isDefaultLib);\n                    processTypeReferenceDirectives(file);\n                }\n                processImportedModules(file);\n                if (isDefaultLib) {\n                    files.unshift(file);\n                }\n                else {\n                    files.push(file);\n                }\n            }\n            return file;\n        }\n        function processReferencedFiles(file, isDefaultLib) {\n            ts.forEach(file.referencedFiles, function (ref) {\n                var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName);\n                processSourceFile(referencedFileName, isDefaultLib, file, ref.pos, ref.end);\n            });\n        }\n        function processTypeReferenceDirectives(file) {\n            var typeDirectives = ts.map(file.typeReferenceDirectives, function (ref) { return ref.fileName.toLocaleLowerCase(); });\n            var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file.fileName);\n            for (var i = 0; i < typeDirectives.length; i++) {\n                var ref = file.typeReferenceDirectives[i];\n                var resolvedTypeReferenceDirective = resolutions[i];\n                var fileName = ref.fileName.toLocaleLowerCase();\n                ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);\n                processTypeReferenceDirective(fileName, resolvedTypeReferenceDirective, file, ref.pos, ref.end);\n            }\n        }\n        function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) {\n            var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective];\n            if (previousResolution && previousResolution.primary) {\n                return;\n            }\n            var saveResolution = true;\n            if (resolvedTypeReferenceDirective) {\n                if (resolvedTypeReferenceDirective.primary) {\n                    processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, refFile, refPos, refEnd);\n                }\n                else {\n                    if (previousResolution) {\n                        if (resolvedTypeReferenceDirective.resolvedFileName !== previousResolution.resolvedFileName) {\n                            var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName);\n                            if (otherFileText !== getSourceFile(previousResolution.resolvedFileName).text) {\n                                fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict, typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName));\n                            }\n                        }\n                        saveResolution = false;\n                    }\n                    else {\n                        processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, refFile, refPos, refEnd);\n                    }\n                }\n            }\n            else {\n                fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_type_definition_file_for_0, typeReferenceDirective));\n            }\n            if (saveResolution) {\n                resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective;\n            }\n        }\n        function createDiagnostic(refFile, refPos, refEnd, message) {\n            var args = [];\n            for (var _i = 4; _i < arguments.length; _i++) {\n                args[_i - 4] = arguments[_i];\n            }\n            if (refFile === undefined || refPos === undefined || refEnd === undefined) {\n                return ts.createCompilerDiagnostic.apply(void 0, [message].concat(args));\n            }\n            else {\n                return ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, message].concat(args));\n            }\n        }\n        function getCanonicalFileName(fileName) {\n            return host.getCanonicalFileName(fileName);\n        }\n        function processImportedModules(file) {\n            collectExternalModuleReferences(file);\n            if (file.imports.length || file.moduleAugmentations.length) {\n                file.resolvedModules = ts.createMap();\n                var nonGlobalAugmentation = ts.filter(file.moduleAugmentations, function (moduleAugmentation) { return moduleAugmentation.kind === 9; });\n                var moduleNames = ts.map(ts.concatenate(file.imports, nonGlobalAugmentation), getTextOfLiteral);\n                var resolutions = resolveModuleNamesReusingOldState(moduleNames, ts.getNormalizedAbsolutePath(file.fileName, currentDirectory), file);\n                ts.Debug.assert(resolutions.length === moduleNames.length);\n                for (var i = 0; i < moduleNames.length; i++) {\n                    var resolution = resolutions[i];\n                    ts.setResolvedModule(file, moduleNames[i], resolution);\n                    if (!resolution) {\n                        continue;\n                    }\n                    var isFromNodeModulesSearch = resolution.isExternalLibraryImport;\n                    var isJsFileFromNodeModules = isFromNodeModulesSearch && !ts.extensionIsTypeScript(resolution.extension);\n                    var resolvedFileName = resolution.resolvedFileName;\n                    if (isFromNodeModulesSearch) {\n                        currentNodeModulesDepth++;\n                    }\n                    var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth;\n                    var shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport;\n                    if (elideImport) {\n                        modulesWithElidedImports[file.path] = true;\n                    }\n                    else if (shouldAddFile) {\n                        var path = ts.toPath(resolvedFileName, currentDirectory, getCanonicalFileName);\n                        var pos = ts.skipTrivia(file.text, file.imports[i].pos);\n                        findSourceFile(resolvedFileName, path, false, file, pos, file.imports[i].end);\n                    }\n                    if (isFromNodeModulesSearch) {\n                        currentNodeModulesDepth--;\n                    }\n                }\n            }\n            else {\n                file.resolvedModules = undefined;\n            }\n        }\n        function computeCommonSourceDirectory(sourceFiles) {\n            var fileNames = [];\n            for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) {\n                var file = sourceFiles_6[_i];\n                if (!file.isDeclarationFile) {\n                    fileNames.push(file.fileName);\n                }\n            }\n            return computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName);\n        }\n        function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) {\n            var allFilesBelongToPath = true;\n            if (sourceFiles) {\n                var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory));\n                for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) {\n                    var sourceFile = sourceFiles_7[_i];\n                    if (!ts.isDeclarationFile(sourceFile)) {\n                        var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));\n                        if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {\n                            programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir));\n                            allFilesBelongToPath = false;\n                        }\n                    }\n                }\n            }\n            return allFilesBelongToPath;\n        }\n        function verifyCompilerOptions() {\n            if (options.isolatedModules) {\n                if (options.declaration) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"declaration\", \"isolatedModules\"));\n                }\n                if (options.noEmitOnError) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"noEmitOnError\", \"isolatedModules\"));\n                }\n                if (options.out) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"out\", \"isolatedModules\"));\n                }\n                if (options.outFile) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"outFile\", \"isolatedModules\"));\n                }\n            }\n            if (options.inlineSourceMap) {\n                if (options.sourceMap) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"sourceMap\", \"inlineSourceMap\"));\n                }\n                if (options.mapRoot) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"mapRoot\", \"inlineSourceMap\"));\n                }\n            }\n            if (options.paths && options.baseUrl === undefined) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option));\n            }\n            if (options.paths) {\n                for (var key in options.paths) {\n                    if (!ts.hasProperty(options.paths, key)) {\n                        continue;\n                    }\n                    if (!ts.hasZeroOrOneAsteriskCharacter(key)) {\n                        programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key));\n                    }\n                    if (ts.isArray(options.paths[key])) {\n                        if (options.paths[key].length === 0) {\n                            programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitutions_for_pattern_0_shouldn_t_be_an_empty_array, key));\n                        }\n                        for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) {\n                            var subst = _a[_i];\n                            var typeOfSubst = typeof subst;\n                            if (typeOfSubst === \"string\") {\n                                if (!ts.hasZeroOrOneAsteriskCharacter(subst)) {\n                                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key));\n                                }\n                            }\n                            else {\n                                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst));\n                            }\n                        }\n                    }\n                    else {\n                        programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitutions_for_pattern_0_should_be_an_array, key));\n                    }\n                }\n            }\n            if (!options.sourceMap && !options.inlineSourceMap) {\n                if (options.inlineSources) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, \"inlineSources\"));\n                }\n                if (options.sourceRoot) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, \"sourceRoot\"));\n                }\n            }\n            if (options.out && options.outFile) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"out\", \"outFile\"));\n            }\n            if (options.mapRoot && !options.sourceMap) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, \"mapRoot\", \"sourceMap\"));\n            }\n            if (options.declarationDir) {\n                if (!options.declaration) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, \"declarationDir\", \"declaration\"));\n                }\n                if (options.out || options.outFile) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"declarationDir\", options.out ? \"out\" : \"outFile\"));\n                }\n            }\n            if (options.lib && options.noLib) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"lib\", \"noLib\"));\n            }\n            if (options.noImplicitUseStrict && options.alwaysStrict) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"noImplicitUseStrict\", \"alwaysStrict\"));\n            }\n            var languageVersion = options.target || 0;\n            var outFile = options.outFile || options.out;\n            var firstNonAmbientExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; });\n            if (options.isolatedModules) {\n                if (options.module === ts.ModuleKind.None && languageVersion < 2) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher));\n                }\n                var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; });\n                if (firstNonExternalModuleSourceFile) {\n                    var span_7 = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);\n                    programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span_7.start, span_7.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));\n                }\n            }\n            else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 && options.module === ts.ModuleKind.None) {\n                var span_8 = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);\n                programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span_8.start, span_8.length, ts.Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none));\n            }\n            if (outFile) {\n                if (options.module && !(options.module === ts.ModuleKind.AMD || options.module === ts.ModuleKind.System)) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? \"out\" : \"outFile\"));\n                }\n                else if (options.module === undefined && firstNonAmbientExternalModuleSourceFile) {\n                    var span_9 = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);\n                    programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span_9.start, span_9.length, ts.Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, options.out ? \"out\" : \"outFile\"));\n                }\n            }\n            if (options.outDir ||\n                options.sourceRoot ||\n                options.mapRoot) {\n                var dir = getCommonSourceDirectory();\n                if (options.outDir && dir === \"\" && ts.forEach(files, function (file) { return ts.getRootLength(file.fileName) > 1; })) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));\n                }\n            }\n            if (!options.noEmit && options.allowJs && options.declaration) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"allowJs\", \"declaration\"));\n            }\n            if (options.emitDecoratorMetadata &&\n                !options.experimentalDecorators) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, \"emitDecoratorMetadata\", \"experimentalDecorators\"));\n            }\n            if (options.jsxFactory) {\n                if (options.reactNamespace) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"reactNamespace\", \"jsxFactory\"));\n                }\n                if (!ts.parseIsolatedEntityName(options.jsxFactory, languageVersion)) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory));\n                }\n            }\n            else if (options.reactNamespace && !ts.isIdentifierText(options.reactNamespace, languageVersion)) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace));\n            }\n            if (!options.noEmit && !options.suppressOutputPathCheck) {\n                var emitHost = getEmitHost();\n                var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined);\n                ts.forEachExpectedEmitFile(emitHost, function (emitFileNames) {\n                    verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1);\n                    verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1);\n                });\n            }\n            function verifyEmitFilePath(emitFileName, emitFilesSeen) {\n                if (emitFileName) {\n                    var emitFilePath = ts.toPath(emitFileName, currentDirectory, getCanonicalFileName);\n                    if (filesByName.contains(emitFilePath)) {\n                        var chain_1;\n                        if (!options.configFilePath) {\n                            chain_1 = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);\n                        }\n                        chain_1 = ts.chainDiagnosticMessages(chain_1, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);\n                        blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain_1));\n                    }\n                    if (emitFilesSeen.contains(emitFilePath)) {\n                        blockEmittingOfFile(emitFileName, ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files, emitFileName));\n                    }\n                    else {\n                        emitFilesSeen.set(emitFilePath, true);\n                    }\n                }\n            }\n        }\n        function blockEmittingOfFile(emitFileName, diag) {\n            hasEmitBlockingDiagnostics.set(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName), true);\n            programDiagnostics.add(diag);\n        }\n    }\n    ts.createProgram = createProgram;\n    function getResolutionDiagnostic(options, _a) {\n        var extension = _a.extension;\n        switch (extension) {\n            case ts.Extension.Ts:\n            case ts.Extension.Dts:\n                return undefined;\n            case ts.Extension.Tsx:\n                return needJsx();\n            case ts.Extension.Jsx:\n                return needJsx() || needAllowJs();\n            case ts.Extension.Js:\n                return needAllowJs();\n        }\n        function needJsx() {\n            return options.jsx ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set;\n        }\n        function needAllowJs() {\n            return options.allowJs ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_allowJs_is_not_set;\n        }\n    }\n    ts.getResolutionDiagnostic = getResolutionDiagnostic;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    ts.compileOnSaveCommandLineOption = { name: \"compileOnSave\", type: \"boolean\" };\n    ts.optionDeclarations = [\n        {\n            name: \"charset\",\n            type: \"string\",\n        },\n        ts.compileOnSaveCommandLineOption,\n        {\n            name: \"declaration\",\n            shortName: \"d\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Generates_corresponding_d_ts_file,\n        },\n        {\n            name: \"declarationDir\",\n            type: \"string\",\n            isFilePath: true,\n            paramType: ts.Diagnostics.DIRECTORY,\n        },\n        {\n            name: \"diagnostics\",\n            type: \"boolean\",\n        },\n        {\n            name: \"extendedDiagnostics\",\n            type: \"boolean\",\n            experimental: true\n        },\n        {\n            name: \"emitBOM\",\n            type: \"boolean\"\n        },\n        {\n            name: \"help\",\n            shortName: \"h\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Print_this_message,\n        },\n        {\n            name: \"help\",\n            shortName: \"?\",\n            type: \"boolean\"\n        },\n        {\n            name: \"init\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file,\n        },\n        {\n            name: \"inlineSourceMap\",\n            type: \"boolean\",\n        },\n        {\n            name: \"inlineSources\",\n            type: \"boolean\",\n        },\n        {\n            name: \"jsx\",\n            type: ts.createMap({\n                \"preserve\": 1,\n                \"react\": 2\n            }),\n            paramType: ts.Diagnostics.KIND,\n            description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react,\n        },\n        {\n            name: \"reactNamespace\",\n            type: \"string\",\n            description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit\n        },\n        {\n            name: \"jsxFactory\",\n            type: \"string\",\n            description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h\n        },\n        {\n            name: \"listFiles\",\n            type: \"boolean\",\n        },\n        {\n            name: \"locale\",\n            type: \"string\",\n        },\n        {\n            name: \"mapRoot\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,\n            paramType: ts.Diagnostics.LOCATION,\n        },\n        {\n            name: \"module\",\n            shortName: \"m\",\n            type: ts.createMap({\n                \"none\": ts.ModuleKind.None,\n                \"commonjs\": ts.ModuleKind.CommonJS,\n                \"amd\": ts.ModuleKind.AMD,\n                \"system\": ts.ModuleKind.System,\n                \"umd\": ts.ModuleKind.UMD,\n                \"es6\": ts.ModuleKind.ES2015,\n                \"es2015\": ts.ModuleKind.ES2015,\n            }),\n            description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015,\n            paramType: ts.Diagnostics.KIND,\n        },\n        {\n            name: \"newLine\",\n            type: ts.createMap({\n                \"crlf\": 0,\n                \"lf\": 1\n            }),\n            description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,\n            paramType: ts.Diagnostics.NEWLINE,\n        },\n        {\n            name: \"noEmit\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_emit_outputs,\n        },\n        {\n            name: \"noEmitHelpers\",\n            type: \"boolean\"\n        },\n        {\n            name: \"noEmitOnError\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,\n        },\n        {\n            name: \"noErrorTruncation\",\n            type: \"boolean\"\n        },\n        {\n            name: \"noImplicitAny\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type,\n        },\n        {\n            name: \"noImplicitThis\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type,\n        },\n        {\n            name: \"noUnusedLocals\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Report_errors_on_unused_locals,\n        },\n        {\n            name: \"noUnusedParameters\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Report_errors_on_unused_parameters,\n        },\n        {\n            name: \"noLib\",\n            type: \"boolean\",\n        },\n        {\n            name: \"noResolve\",\n            type: \"boolean\",\n        },\n        {\n            name: \"skipDefaultLibCheck\",\n            type: \"boolean\",\n        },\n        {\n            name: \"skipLibCheck\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Skip_type_checking_of_declaration_files,\n        },\n        {\n            name: \"out\",\n            type: \"string\",\n            isFilePath: false,\n            paramType: ts.Diagnostics.FILE,\n        },\n        {\n            name: \"outFile\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file,\n            paramType: ts.Diagnostics.FILE,\n        },\n        {\n            name: \"outDir\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Redirect_output_structure_to_the_directory,\n            paramType: ts.Diagnostics.DIRECTORY,\n        },\n        {\n            name: \"preserveConstEnums\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code\n        },\n        {\n            name: \"pretty\",\n            description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental,\n            type: \"boolean\"\n        },\n        {\n            name: \"project\",\n            shortName: \"p\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Compile_the_project_in_the_given_directory,\n            paramType: ts.Diagnostics.DIRECTORY\n        },\n        {\n            name: \"removeComments\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_emit_comments_to_output,\n        },\n        {\n            name: \"rootDir\",\n            type: \"string\",\n            isFilePath: true,\n            paramType: ts.Diagnostics.LOCATION,\n            description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir,\n        },\n        {\n            name: \"isolatedModules\",\n            type: \"boolean\",\n        },\n        {\n            name: \"sourceMap\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Generates_corresponding_map_file,\n        },\n        {\n            name: \"sourceRoot\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,\n            paramType: ts.Diagnostics.LOCATION,\n        },\n        {\n            name: \"suppressExcessPropertyErrors\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals,\n            experimental: true\n        },\n        {\n            name: \"suppressImplicitAnyIndexErrors\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures,\n        },\n        {\n            name: \"stripInternal\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation,\n            experimental: true\n        },\n        {\n            name: \"target\",\n            shortName: \"t\",\n            type: ts.createMap({\n                \"es3\": 0,\n                \"es5\": 1,\n                \"es6\": 2,\n                \"es2015\": 2,\n                \"es2016\": 3,\n                \"es2017\": 4,\n                \"esnext\": 5,\n            }),\n            description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT,\n            paramType: ts.Diagnostics.VERSION,\n        },\n        {\n            name: \"version\",\n            shortName: \"v\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Print_the_compiler_s_version,\n        },\n        {\n            name: \"watch\",\n            shortName: \"w\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Watch_input_files,\n        },\n        {\n            name: \"experimentalDecorators\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators\n        },\n        {\n            name: \"emitDecoratorMetadata\",\n            type: \"boolean\",\n            experimental: true,\n            description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators\n        },\n        {\n            name: \"moduleResolution\",\n            type: ts.createMap({\n                \"node\": ts.ModuleResolutionKind.NodeJs,\n                \"classic\": ts.ModuleResolutionKind.Classic,\n            }),\n            description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6,\n            paramType: ts.Diagnostics.STRATEGY,\n        },\n        {\n            name: \"allowUnusedLabels\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_report_errors_on_unused_labels\n        },\n        {\n            name: \"noImplicitReturns\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value\n        },\n        {\n            name: \"noFallthroughCasesInSwitch\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement\n        },\n        {\n            name: \"allowUnreachableCode\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code\n        },\n        {\n            name: \"forceConsistentCasingInFileNames\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file\n        },\n        {\n            name: \"baseUrl\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names\n        },\n        {\n            name: \"paths\",\n            type: \"object\",\n            isTSConfigOnly: true\n        },\n        {\n            name: \"rootDirs\",\n            type: \"list\",\n            isTSConfigOnly: true,\n            element: {\n                name: \"rootDirs\",\n                type: \"string\",\n                isFilePath: true\n            }\n        },\n        {\n            name: \"typeRoots\",\n            type: \"list\",\n            element: {\n                name: \"typeRoots\",\n                type: \"string\",\n                isFilePath: true\n            }\n        },\n        {\n            name: \"types\",\n            type: \"list\",\n            element: {\n                name: \"types\",\n                type: \"string\"\n            },\n            description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation\n        },\n        {\n            name: \"traceResolution\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process\n        },\n        {\n            name: \"allowJs\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Allow_javascript_files_to_be_compiled\n        },\n        {\n            name: \"allowSyntheticDefaultImports\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking\n        },\n        {\n            name: \"noImplicitUseStrict\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output\n        },\n        {\n            name: \"maxNodeModuleJsDepth\",\n            type: \"number\",\n            description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files\n        },\n        {\n            name: \"listEmittedFiles\",\n            type: \"boolean\"\n        },\n        {\n            name: \"lib\",\n            type: \"list\",\n            element: {\n                name: \"lib\",\n                type: ts.createMap({\n                    \"es5\": \"lib.es5.d.ts\",\n                    \"es6\": \"lib.es2015.d.ts\",\n                    \"es2015\": \"lib.es2015.d.ts\",\n                    \"es7\": \"lib.es2016.d.ts\",\n                    \"es2016\": \"lib.es2016.d.ts\",\n                    \"es2017\": \"lib.es2017.d.ts\",\n                    \"dom\": \"lib.dom.d.ts\",\n                    \"dom.iterable\": \"lib.dom.iterable.d.ts\",\n                    \"webworker\": \"lib.webworker.d.ts\",\n                    \"scripthost\": \"lib.scripthost.d.ts\",\n                    \"es2015.core\": \"lib.es2015.core.d.ts\",\n                    \"es2015.collection\": \"lib.es2015.collection.d.ts\",\n                    \"es2015.generator\": \"lib.es2015.generator.d.ts\",\n                    \"es2015.iterable\": \"lib.es2015.iterable.d.ts\",\n                    \"es2015.promise\": \"lib.es2015.promise.d.ts\",\n                    \"es2015.proxy\": \"lib.es2015.proxy.d.ts\",\n                    \"es2015.reflect\": \"lib.es2015.reflect.d.ts\",\n                    \"es2015.symbol\": \"lib.es2015.symbol.d.ts\",\n                    \"es2015.symbol.wellknown\": \"lib.es2015.symbol.wellknown.d.ts\",\n                    \"es2016.array.include\": \"lib.es2016.array.include.d.ts\",\n                    \"es2017.object\": \"lib.es2017.object.d.ts\",\n                    \"es2017.sharedmemory\": \"lib.es2017.sharedmemory.d.ts\",\n                    \"es2017.string\": \"lib.es2017.string.d.ts\",\n                }),\n            },\n            description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon\n        },\n        {\n            name: \"disableSizeLimit\",\n            type: \"boolean\"\n        },\n        {\n            name: \"strictNullChecks\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Enable_strict_null_checks\n        },\n        {\n            name: \"importHelpers\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Import_emit_helpers_from_tslib\n        },\n        {\n            name: \"alwaysStrict\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file\n        }\n    ];\n    ts.typeAcquisitionDeclarations = [\n        {\n            name: \"enableAutoDiscovery\",\n            type: \"boolean\",\n        },\n        {\n            name: \"enable\",\n            type: \"boolean\",\n        },\n        {\n            name: \"include\",\n            type: \"list\",\n            element: {\n                name: \"include\",\n                type: \"string\"\n            }\n        },\n        {\n            name: \"exclude\",\n            type: \"list\",\n            element: {\n                name: \"exclude\",\n                type: \"string\"\n            }\n        }\n    ];\n    ts.defaultInitCompilerOptions = {\n        module: ts.ModuleKind.CommonJS,\n        target: 1,\n        noImplicitAny: false,\n        sourceMap: false,\n    };\n    var optionNameMapCache;\n    function convertEnableAutoDiscoveryToEnable(typeAcquisition) {\n        if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) {\n            var result = {\n                enable: typeAcquisition.enableAutoDiscovery,\n                include: typeAcquisition.include || [],\n                exclude: typeAcquisition.exclude || []\n            };\n            return result;\n        }\n        return typeAcquisition;\n    }\n    ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable;\n    function getOptionNameMap() {\n        if (optionNameMapCache) {\n            return optionNameMapCache;\n        }\n        var optionNameMap = ts.createMap();\n        var shortOptionNames = ts.createMap();\n        ts.forEach(ts.optionDeclarations, function (option) {\n            optionNameMap[option.name.toLowerCase()] = option;\n            if (option.shortName) {\n                shortOptionNames[option.shortName] = option.name;\n            }\n        });\n        optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames };\n        return optionNameMapCache;\n    }\n    ts.getOptionNameMap = getOptionNameMap;\n    function createCompilerDiagnosticForInvalidCustomType(opt) {\n        var namesOfType = Object.keys(opt.type).map(function (key) { return \"'\" + key + \"'\"; }).join(\", \");\n        return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, \"--\" + opt.name, namesOfType);\n    }\n    ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType;\n    function parseCustomTypeOption(opt, value, errors) {\n        var key = trimString((value || \"\")).toLowerCase();\n        var map = opt.type;\n        if (key in map) {\n            return map[key];\n        }\n        else {\n            errors.push(createCompilerDiagnosticForInvalidCustomType(opt));\n        }\n    }\n    ts.parseCustomTypeOption = parseCustomTypeOption;\n    function parseListTypeOption(opt, value, errors) {\n        if (value === void 0) { value = \"\"; }\n        value = trimString(value);\n        if (ts.startsWith(value, \"-\")) {\n            return undefined;\n        }\n        if (value === \"\") {\n            return [];\n        }\n        var values = value.split(\",\");\n        switch (opt.element.type) {\n            case \"number\":\n                return ts.map(values, parseInt);\n            case \"string\":\n                return ts.map(values, function (v) { return v || \"\"; });\n            default:\n                return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; });\n        }\n    }\n    ts.parseListTypeOption = parseListTypeOption;\n    function parseCommandLine(commandLine, readFile) {\n        var options = {};\n        var fileNames = [];\n        var errors = [];\n        var _a = getOptionNameMap(), optionNameMap = _a.optionNameMap, shortOptionNames = _a.shortOptionNames;\n        parseStrings(commandLine);\n        return {\n            options: options,\n            fileNames: fileNames,\n            errors: errors\n        };\n        function parseStrings(args) {\n            var i = 0;\n            while (i < args.length) {\n                var s = args[i];\n                i++;\n                if (s.charCodeAt(0) === 64) {\n                    parseResponseFile(s.slice(1));\n                }\n                else if (s.charCodeAt(0) === 45) {\n                    s = s.slice(s.charCodeAt(1) === 45 ? 2 : 1).toLowerCase();\n                    if (s in shortOptionNames) {\n                        s = shortOptionNames[s];\n                    }\n                    if (s in optionNameMap) {\n                        var opt = optionNameMap[s];\n                        if (opt.isTSConfigOnly) {\n                            errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name));\n                        }\n                        else {\n                            if (!args[i] && opt.type !== \"boolean\") {\n                                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name));\n                            }\n                            switch (opt.type) {\n                                case \"number\":\n                                    options[opt.name] = parseInt(args[i]);\n                                    i++;\n                                    break;\n                                case \"boolean\":\n                                    var optValue = args[i];\n                                    options[opt.name] = optValue !== \"false\";\n                                    if (optValue === \"false\" || optValue === \"true\") {\n                                        i++;\n                                    }\n                                    break;\n                                case \"string\":\n                                    options[opt.name] = args[i] || \"\";\n                                    i++;\n                                    break;\n                                case \"list\":\n                                    var result = parseListTypeOption(opt, args[i], errors);\n                                    options[opt.name] = result || [];\n                                    if (result) {\n                                        i++;\n                                    }\n                                    break;\n                                default:\n                                    options[opt.name] = parseCustomTypeOption(opt, args[i], errors);\n                                    i++;\n                                    break;\n                            }\n                        }\n                    }\n                    else {\n                        errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, s));\n                    }\n                }\n                else {\n                    fileNames.push(s);\n                }\n            }\n        }\n        function parseResponseFile(fileName) {\n            var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName);\n            if (!text) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName));\n                return;\n            }\n            var args = [];\n            var pos = 0;\n            while (true) {\n                while (pos < text.length && text.charCodeAt(pos) <= 32)\n                    pos++;\n                if (pos >= text.length)\n                    break;\n                var start = pos;\n                if (text.charCodeAt(start) === 34) {\n                    pos++;\n                    while (pos < text.length && text.charCodeAt(pos) !== 34)\n                        pos++;\n                    if (pos < text.length) {\n                        args.push(text.substring(start + 1, pos));\n                        pos++;\n                    }\n                    else {\n                        errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName));\n                    }\n                }\n                else {\n                    while (text.charCodeAt(pos) > 32)\n                        pos++;\n                    args.push(text.substring(start, pos));\n                }\n            }\n            parseStrings(args);\n        }\n    }\n    ts.parseCommandLine = parseCommandLine;\n    function readConfigFile(fileName, readFile) {\n        var text = \"\";\n        try {\n            text = readFile(fileName);\n        }\n        catch (e) {\n            return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) };\n        }\n        return parseConfigFileTextToJson(fileName, text);\n    }\n    ts.readConfigFile = readConfigFile;\n    function parseConfigFileTextToJson(fileName, jsonText, stripComments) {\n        if (stripComments === void 0) { stripComments = true; }\n        try {\n            var jsonTextToParse = stripComments ? removeComments(jsonText) : jsonText;\n            return { config: /\\S/.test(jsonTextToParse) ? JSON.parse(jsonTextToParse) : {} };\n        }\n        catch (e) {\n            return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) };\n        }\n    }\n    ts.parseConfigFileTextToJson = parseConfigFileTextToJson;\n    function generateTSConfig(options, fileNames) {\n        var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions);\n        var configurations = {\n            compilerOptions: serializeCompilerOptions(compilerOptions)\n        };\n        if (fileNames && fileNames.length) {\n            configurations.files = fileNames;\n        }\n        return configurations;\n        function getCustomTypeMapOfCommandLineOption(optionDefinition) {\n            if (optionDefinition.type === \"string\" || optionDefinition.type === \"number\" || optionDefinition.type === \"boolean\") {\n                return undefined;\n            }\n            else if (optionDefinition.type === \"list\") {\n                return getCustomTypeMapOfCommandLineOption(optionDefinition.element);\n            }\n            else {\n                return optionDefinition.type;\n            }\n        }\n        function getNameOfCompilerOptionValue(value, customTypeMap) {\n            for (var key in customTypeMap) {\n                if (customTypeMap[key] === value) {\n                    return key;\n                }\n            }\n            return undefined;\n        }\n        function serializeCompilerOptions(options) {\n            var result = ts.createMap();\n            var optionsNameMap = getOptionNameMap().optionNameMap;\n            for (var name_43 in options) {\n                if (ts.hasProperty(options, name_43)) {\n                    switch (name_43) {\n                        case \"init\":\n                        case \"watch\":\n                        case \"version\":\n                        case \"help\":\n                        case \"project\":\n                            break;\n                        default:\n                            var value = options[name_43];\n                            var optionDefinition = optionsNameMap[name_43.toLowerCase()];\n                            if (optionDefinition) {\n                                var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition);\n                                if (!customTypeMap) {\n                                    result[name_43] = value;\n                                }\n                                else {\n                                    if (optionDefinition.type === \"list\") {\n                                        var convertedValue = [];\n                                        for (var _i = 0, _a = value; _i < _a.length; _i++) {\n                                            var element = _a[_i];\n                                            convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap));\n                                        }\n                                        result[name_43] = convertedValue;\n                                    }\n                                    else {\n                                        result[name_43] = getNameOfCompilerOptionValue(value, customTypeMap);\n                                    }\n                                }\n                            }\n                            break;\n                    }\n                }\n            }\n            return result;\n        }\n    }\n    ts.generateTSConfig = generateTSConfig;\n    function removeComments(jsonText) {\n        var output = \"\";\n        var scanner = ts.createScanner(1, false, 0, jsonText);\n        var token;\n        while ((token = scanner.scan()) !== 1) {\n            switch (token) {\n                case 2:\n                case 3:\n                    output += scanner.getTokenText().replace(/\\S/g, \" \");\n                    break;\n                default:\n                    output += scanner.getTokenText();\n                    break;\n            }\n        }\n        return output;\n    }\n    function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) {\n        if (existingOptions === void 0) { existingOptions = {}; }\n        if (resolutionStack === void 0) { resolutionStack = []; }\n        var errors = [];\n        var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);\n        var resolvedPath = ts.toPath(configFileName || \"\", basePath, getCanonicalFileName);\n        if (resolutionStack.indexOf(resolvedPath) >= 0) {\n            return {\n                options: {},\n                fileNames: [],\n                typeAcquisition: {},\n                raw: json,\n                errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(\" -> \"))],\n                wildcardDirectories: {}\n            };\n        }\n        var options = convertCompilerOptionsFromJsonWorker(json[\"compilerOptions\"], basePath, errors, configFileName);\n        var jsonOptions = json[\"typeAcquisition\"] || json[\"typingOptions\"];\n        var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);\n        if (json[\"extends\"]) {\n            var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3];\n            if (typeof json[\"extends\"] === \"string\") {\n                _b = (tryExtendsName(json[\"extends\"]) || [include, exclude, files, baseOptions]), include = _b[0], exclude = _b[1], files = _b[2], baseOptions = _b[3];\n            }\n            else {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, \"extends\", \"string\"));\n            }\n            if (include && !json[\"include\"]) {\n                json[\"include\"] = include;\n            }\n            if (exclude && !json[\"exclude\"]) {\n                json[\"exclude\"] = exclude;\n            }\n            if (files && !json[\"files\"]) {\n                json[\"files\"] = files;\n            }\n            options = ts.assign({}, baseOptions, options);\n        }\n        options = ts.extend(existingOptions, options);\n        options.configFilePath = configFileName;\n        var _c = getFileNames(errors), fileNames = _c.fileNames, wildcardDirectories = _c.wildcardDirectories;\n        var compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors);\n        return {\n            options: options,\n            fileNames: fileNames,\n            typeAcquisition: typeAcquisition,\n            raw: json,\n            errors: errors,\n            wildcardDirectories: wildcardDirectories,\n            compileOnSave: compileOnSave\n        };\n        function tryExtendsName(extendedConfig) {\n            if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), \"./\") || ts.startsWith(ts.normalizeSlashes(extendedConfig), \"../\"))) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig));\n                return;\n            }\n            var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName);\n            if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, \".json\")) {\n                extendedConfigPath = extendedConfigPath + \".json\";\n                if (!host.fileExists(extendedConfigPath)) {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig));\n                    return;\n                }\n            }\n            var extendedResult = readConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });\n            if (extendedResult.error) {\n                errors.push(extendedResult.error);\n                return;\n            }\n            var extendedDirname = ts.getDirectoryPath(extendedConfigPath);\n            var relativeDifference = ts.convertToRelativePath(extendedDirname, basePath, getCanonicalFileName);\n            var updatePath = function (path) { return ts.isRootedDiskPath(path) ? path : ts.combinePaths(relativeDifference, path); };\n            var result = parseJsonConfigFileContent(extendedResult.config, host, extendedDirname, undefined, ts.getBaseFileName(extendedConfigPath), resolutionStack.concat([resolvedPath]));\n            errors.push.apply(errors, result.errors);\n            var _a = ts.map([\"include\", \"exclude\", \"files\"], function (key) {\n                if (!json[key] && extendedResult.config[key]) {\n                    return ts.map(extendedResult.config[key], updatePath);\n                }\n            }), include = _a[0], exclude = _a[1], files = _a[2];\n            return [include, exclude, files, result.options];\n        }\n        function getFileNames(errors) {\n            var fileNames;\n            if (ts.hasProperty(json, \"files\")) {\n                if (ts.isArray(json[\"files\"])) {\n                    fileNames = json[\"files\"];\n                    if (fileNames.length === 0) {\n                        errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || \"tsconfig.json\"));\n                    }\n                }\n                else {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, \"files\", \"Array\"));\n                }\n            }\n            var includeSpecs;\n            if (ts.hasProperty(json, \"include\")) {\n                if (ts.isArray(json[\"include\"])) {\n                    includeSpecs = json[\"include\"];\n                }\n                else {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, \"include\", \"Array\"));\n                }\n            }\n            var excludeSpecs;\n            if (ts.hasProperty(json, \"exclude\")) {\n                if (ts.isArray(json[\"exclude\"])) {\n                    excludeSpecs = json[\"exclude\"];\n                }\n                else {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, \"exclude\", \"Array\"));\n                }\n            }\n            else if (ts.hasProperty(json, \"excludes\")) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));\n            }\n            else {\n                excludeSpecs = includeSpecs ? [] : [\"node_modules\", \"bower_components\", \"jspm_packages\"];\n                var outDir = json[\"compilerOptions\"] && json[\"compilerOptions\"][\"outDir\"];\n                if (outDir) {\n                    excludeSpecs.push(outDir);\n                }\n            }\n            if (fileNames === undefined && includeSpecs === undefined) {\n                includeSpecs = [\"**/*\"];\n            }\n            var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors);\n            if (result.fileNames.length === 0 && !ts.hasProperty(json, \"files\") && resolutionStack.length === 0) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || \"tsconfig.json\", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || [])));\n            }\n            return result;\n        }\n        var _b;\n    }\n    ts.parseJsonConfigFileContent = parseJsonConfigFileContent;\n    function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) {\n        if (!ts.hasProperty(jsonOption, ts.compileOnSaveCommandLineOption.name)) {\n            return false;\n        }\n        var result = convertJsonOption(ts.compileOnSaveCommandLineOption, jsonOption[\"compileOnSave\"], basePath, errors);\n        if (typeof result === \"boolean\" && result) {\n            return result;\n        }\n        return false;\n    }\n    ts.convertCompileOnSaveOptionFromJson = convertCompileOnSaveOptionFromJson;\n    function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) {\n        var errors = [];\n        var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName);\n        return { options: options, errors: errors };\n    }\n    ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson;\n    function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) {\n        var errors = [];\n        var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);\n        return { options: options, errors: errors };\n    }\n    ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson;\n    function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {\n        var options = ts.getBaseFileName(configFileName) === \"jsconfig.json\"\n            ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true }\n            : {};\n        convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);\n        return options;\n    }\n    function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) {\n        var options = { enable: ts.getBaseFileName(configFileName) === \"jsconfig.json\", include: [], exclude: [] };\n        var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions);\n        convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors);\n        return options;\n    }\n    function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) {\n        if (!jsonOptions) {\n            return;\n        }\n        var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; });\n        for (var id in jsonOptions) {\n            if (id in optionNameMap) {\n                var opt = optionNameMap[id];\n                defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors);\n            }\n            else {\n                errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id));\n            }\n        }\n    }\n    function convertJsonOption(opt, value, basePath, errors) {\n        var optType = opt.type;\n        var expectedType = typeof optType === \"string\" ? optType : \"string\";\n        if (optType === \"list\" && ts.isArray(value)) {\n            return convertJsonOptionOfListType(opt, value, basePath, errors);\n        }\n        else if (typeof value === expectedType) {\n            if (typeof optType !== \"string\") {\n                return convertJsonOptionOfCustomType(opt, value, errors);\n            }\n            else {\n                if (opt.isFilePath) {\n                    value = ts.normalizePath(ts.combinePaths(basePath, value));\n                    if (value === \"\") {\n                        value = \".\";\n                    }\n                }\n            }\n            return value;\n        }\n        else {\n            errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType));\n        }\n    }\n    function convertJsonOptionOfCustomType(opt, value, errors) {\n        var key = value.toLowerCase();\n        if (key in opt.type) {\n            return opt.type[key];\n        }\n        else {\n            errors.push(createCompilerDiagnosticForInvalidCustomType(opt));\n        }\n    }\n    function convertJsonOptionOfListType(option, values, basePath, errors) {\n        return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; });\n    }\n    function trimString(s) {\n        return typeof s.trim === \"function\" ? s.trim() : s.replace(/^[\\s]+|[\\s]+$/g, \"\");\n    }\n    var invalidTrailingRecursionPattern = /(^|\\/)\\*\\*\\/?$/;\n    var invalidMultipleRecursionPatterns = /(^|\\/)\\*\\*\\/(.*\\/)?\\*\\*($|\\/)/;\n    var invalidDotDotAfterRecursiveWildcardPattern = /(^|\\/)\\*\\*\\/(.*\\/)?\\.\\.($|\\/)/;\n    var watchRecursivePattern = /\\/[^/]*?[*?][^/]*\\//;\n    var wildcardDirectoryPattern = /^[^*?]*(?=\\/[^/]*[*?])/;\n    function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) {\n        basePath = ts.normalizePath(basePath);\n        var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper;\n        var literalFileMap = ts.createMap();\n        var wildcardFileMap = ts.createMap();\n        if (include) {\n            include = validateSpecs(include, errors, false);\n        }\n        if (exclude) {\n            exclude = validateSpecs(exclude, errors, true);\n        }\n        var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames);\n        var supportedExtensions = ts.getSupportedExtensions(options);\n        if (fileNames) {\n            for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) {\n                var fileName = fileNames_1[_i];\n                var file = ts.combinePaths(basePath, fileName);\n                literalFileMap[keyMapper(file)] = file;\n            }\n        }\n        if (include && include.length > 0) {\n            for (var _a = 0, _b = host.readDirectory(basePath, supportedExtensions, exclude, include); _a < _b.length; _a++) {\n                var file = _b[_a];\n                if (hasFileWithHigherPriorityExtension(file, literalFileMap, wildcardFileMap, supportedExtensions, keyMapper)) {\n                    continue;\n                }\n                removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper);\n                var key = keyMapper(file);\n                if (!(key in literalFileMap) && !(key in wildcardFileMap)) {\n                    wildcardFileMap[key] = file;\n                }\n            }\n        }\n        var literalFiles = ts.reduceProperties(literalFileMap, addFileToOutput, []);\n        var wildcardFiles = ts.reduceProperties(wildcardFileMap, addFileToOutput, []);\n        wildcardFiles.sort(host.useCaseSensitiveFileNames ? ts.compareStrings : ts.compareStringsCaseInsensitive);\n        return {\n            fileNames: literalFiles.concat(wildcardFiles),\n            wildcardDirectories: wildcardDirectories\n        };\n    }\n    function validateSpecs(specs, errors, allowTrailingRecursion) {\n        var validSpecs = [];\n        for (var _i = 0, specs_2 = specs; _i < specs_2.length; _i++) {\n            var spec = specs_2[_i];\n            if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec));\n            }\n            else if (invalidMultipleRecursionPatterns.test(spec)) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0, spec));\n            }\n            else if (invalidDotDotAfterRecursiveWildcardPattern.test(spec)) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec));\n            }\n            else {\n                validSpecs.push(spec);\n            }\n        }\n        return validSpecs;\n    }\n    function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) {\n        var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, \"exclude\");\n        var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? \"\" : \"i\");\n        var wildcardDirectories = ts.createMap();\n        if (include !== undefined) {\n            var recursiveKeys = [];\n            for (var _i = 0, include_1 = include; _i < include_1.length; _i++) {\n                var file = include_1[_i];\n                var spec = ts.normalizePath(ts.combinePaths(path, file));\n                if (excludeRegex && excludeRegex.test(spec)) {\n                    continue;\n                }\n                var match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames);\n                if (match) {\n                    var key = match.key, flags = match.flags;\n                    var existingFlags = wildcardDirectories[key];\n                    if (existingFlags === undefined || existingFlags < flags) {\n                        wildcardDirectories[key] = flags;\n                        if (flags === 1) {\n                            recursiveKeys.push(key);\n                        }\n                    }\n                }\n            }\n            for (var key in wildcardDirectories) {\n                for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) {\n                    var recursiveKey = recursiveKeys_1[_a];\n                    if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) {\n                        delete wildcardDirectories[key];\n                    }\n                }\n            }\n        }\n        return wildcardDirectories;\n    }\n    function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames) {\n        var match = wildcardDirectoryPattern.exec(spec);\n        if (match) {\n            return {\n                key: useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase(),\n                flags: watchRecursivePattern.test(spec) ? 1 : 0\n            };\n        }\n        if (ts.isImplicitGlob(spec)) {\n            return { key: spec, flags: 1 };\n        }\n        return undefined;\n    }\n    function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) {\n        var extensionPriority = ts.getExtensionPriority(file, extensions);\n        var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority);\n        for (var i = 0; i < adjustedExtensionPriority; i++) {\n            var higherPriorityExtension = extensions[i];\n            var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension));\n            if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) {\n                return true;\n            }\n        }\n        return false;\n    }\n    function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) {\n        var extensionPriority = ts.getExtensionPriority(file, extensions);\n        var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority);\n        for (var i = nextExtensionPriority; i < extensions.length; i++) {\n            var lowerPriorityExtension = extensions[i];\n            var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension));\n            delete wildcardFiles[lowerPriorityPath];\n        }\n    }\n    function addFileToOutput(output, file) {\n        output.push(file);\n        return output;\n    }\n    function caseSensitiveKeyMapper(key) {\n        return key;\n    }\n    function caseInsensitiveKeyMapper(key) {\n        return key.toLowerCase();\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var defaultFormatDiagnosticsHost = {\n        getCurrentDirectory: function () { return ts.sys.getCurrentDirectory(); },\n        getNewLine: function () { return ts.sys.newLine; },\n        getCanonicalFileName: ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)\n    };\n    var reportDiagnosticWorker = reportDiagnosticSimply;\n    function reportDiagnostic(diagnostic, host) {\n        reportDiagnosticWorker(diagnostic, host || defaultFormatDiagnosticsHost);\n    }\n    function reportDiagnostics(diagnostics, host) {\n        for (var _i = 0, diagnostics_2 = diagnostics; _i < diagnostics_2.length; _i++) {\n            var diagnostic = diagnostics_2[_i];\n            reportDiagnostic(diagnostic, host);\n        }\n    }\n    function reportEmittedFiles(files) {\n        if (!files || files.length == 0) {\n            return;\n        }\n        var currentDir = ts.sys.getCurrentDirectory();\n        for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {\n            var file = files_3[_i];\n            var filepath = ts.getNormalizedAbsolutePath(file, currentDir);\n            ts.sys.write(\"TSFILE: \" + filepath + ts.sys.newLine);\n        }\n    }\n    function countLines(program) {\n        var count = 0;\n        ts.forEach(program.getSourceFiles(), function (file) {\n            count += ts.getLineStarts(file).length;\n        });\n        return count;\n    }\n    function getDiagnosticText(_message) {\n        var _args = [];\n        for (var _i = 1; _i < arguments.length; _i++) {\n            _args[_i - 1] = arguments[_i];\n        }\n        var diagnostic = ts.createCompilerDiagnostic.apply(undefined, arguments);\n        return diagnostic.messageText;\n    }\n    function reportDiagnosticSimply(diagnostic, host) {\n        ts.sys.write(ts.formatDiagnostics([diagnostic], host));\n    }\n    var redForegroundEscapeSequence = \"\\u001b[91m\";\n    var yellowForegroundEscapeSequence = \"\\u001b[93m\";\n    var blueForegroundEscapeSequence = \"\\u001b[93m\";\n    var gutterStyleSequence = \"\\u001b[100;30m\";\n    var gutterSeparator = \" \";\n    var resetEscapeSequence = \"\\u001b[0m\";\n    var ellipsis = \"...\";\n    var categoryFormatMap = ts.createMap((_a = {},\n        _a[ts.DiagnosticCategory.Warning] = yellowForegroundEscapeSequence,\n        _a[ts.DiagnosticCategory.Error] = redForegroundEscapeSequence,\n        _a[ts.DiagnosticCategory.Message] = blueForegroundEscapeSequence,\n        _a));\n    function formatAndReset(text, formatStyle) {\n        return formatStyle + text + resetEscapeSequence;\n    }\n    function reportDiagnosticWithColorAndContext(diagnostic, host) {\n        var output = \"\";\n        if (diagnostic.file) {\n            var start = diagnostic.start, length_4 = diagnostic.length, file = diagnostic.file;\n            var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character;\n            var _b = ts.getLineAndCharacterOfPosition(file, start + length_4), lastLine = _b.line, lastLineChar = _b.character;\n            var lastLineInFile = ts.getLineAndCharacterOfPosition(file, file.text.length).line;\n            var relativeFileName = host ? ts.convertToRelativePath(file.fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }) : file.fileName;\n            var hasMoreThanFiveLines = (lastLine - firstLine) >= 4;\n            var gutterWidth = (lastLine + 1 + \"\").length;\n            if (hasMoreThanFiveLines) {\n                gutterWidth = Math.max(ellipsis.length, gutterWidth);\n            }\n            output += ts.sys.newLine;\n            for (var i = firstLine; i <= lastLine; i++) {\n                if (hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1) {\n                    output += formatAndReset(padLeft(ellipsis, gutterWidth), gutterStyleSequence) + gutterSeparator + ts.sys.newLine;\n                    i = lastLine - 1;\n                }\n                var lineStart = ts.getPositionOfLineAndCharacter(file, i, 0);\n                var lineEnd = i < lastLineInFile ? ts.getPositionOfLineAndCharacter(file, i + 1, 0) : file.text.length;\n                var lineContent = file.text.slice(lineStart, lineEnd);\n                lineContent = lineContent.replace(/\\s+$/g, \"\");\n                lineContent = lineContent.replace(\"\\t\", \" \");\n                output += formatAndReset(padLeft(i + 1 + \"\", gutterWidth), gutterStyleSequence) + gutterSeparator;\n                output += lineContent + ts.sys.newLine;\n                output += formatAndReset(padLeft(\"\", gutterWidth), gutterStyleSequence) + gutterSeparator;\n                output += redForegroundEscapeSequence;\n                if (i === firstLine) {\n                    var lastCharForLine = i === lastLine ? lastLineChar : undefined;\n                    output += lineContent.slice(0, firstLineChar).replace(/\\S/g, \" \");\n                    output += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, \"~\");\n                }\n                else if (i === lastLine) {\n                    output += lineContent.slice(0, lastLineChar).replace(/./g, \"~\");\n                }\n                else {\n                    output += lineContent.replace(/./g, \"~\");\n                }\n                output += resetEscapeSequence;\n                output += ts.sys.newLine;\n            }\n            output += ts.sys.newLine;\n            output += relativeFileName + \"(\" + (firstLine + 1) + \",\" + (firstLineChar + 1) + \"): \";\n        }\n        var categoryColor = categoryFormatMap[diagnostic.category];\n        var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();\n        output += formatAndReset(category, categoryColor) + \" TS\" + diagnostic.code + \": \" + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine);\n        output += ts.sys.newLine + ts.sys.newLine;\n        ts.sys.write(output);\n    }\n    function reportWatchDiagnostic(diagnostic) {\n        var output = new Date().toLocaleTimeString() + \" - \";\n        if (diagnostic.file) {\n            var loc = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);\n            output += diagnostic.file.fileName + \"(\" + (loc.line + 1) + \",\" + (loc.character + 1) + \"): \";\n        }\n        output += \"\" + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) + ts.sys.newLine;\n        ts.sys.write(output);\n    }\n    function padLeft(s, length) {\n        while (s.length < length) {\n            s = \" \" + s;\n        }\n        return s;\n    }\n    function padRight(s, length) {\n        while (s.length < length) {\n            s = s + \" \";\n        }\n        return s;\n    }\n    function isJSONSupported() {\n        return typeof JSON === \"object\" && typeof JSON.parse === \"function\";\n    }\n    function executeCommandLine(args) {\n        var commandLine = ts.parseCommandLine(args);\n        var configFileName;\n        var cachedConfigFileText;\n        var configFileWatcher;\n        var directoryWatcher;\n        var cachedProgram;\n        var rootFileNames;\n        var compilerOptions;\n        var compilerHost;\n        var hostGetSourceFile;\n        var timerHandleForRecompilation;\n        var timerHandleForDirectoryChanges;\n        var cachedExistingFiles;\n        var hostFileExists;\n        if (commandLine.options.locale) {\n            if (!isJSONSupported()) {\n                reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, \"--locale\"), undefined);\n                return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);\n            }\n            ts.validateLocaleAndSetLanguage(commandLine.options.locale, ts.sys, commandLine.errors);\n        }\n        if (commandLine.errors.length > 0) {\n            reportDiagnostics(commandLine.errors, compilerHost);\n            return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);\n        }\n        if (commandLine.options.init) {\n            writeConfigFile(commandLine.options, commandLine.fileNames);\n            return ts.sys.exit(ts.ExitStatus.Success);\n        }\n        if (commandLine.options.version) {\n            printVersion();\n            return ts.sys.exit(ts.ExitStatus.Success);\n        }\n        if (commandLine.options.help) {\n            printVersion();\n            printHelp();\n            return ts.sys.exit(ts.ExitStatus.Success);\n        }\n        if (commandLine.options.project) {\n            if (!isJSONSupported()) {\n                reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, \"--project\"), undefined);\n                return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);\n            }\n            if (commandLine.fileNames.length !== 0) {\n                reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line), undefined);\n                return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);\n            }\n            var fileOrDirectory = ts.normalizePath(commandLine.options.project);\n            if (!fileOrDirectory || ts.sys.directoryExists(fileOrDirectory)) {\n                configFileName = ts.combinePaths(fileOrDirectory, \"tsconfig.json\");\n                if (!ts.sys.fileExists(configFileName)) {\n                    reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project), undefined);\n                    return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);\n                }\n            }\n            else {\n                configFileName = fileOrDirectory;\n                if (!ts.sys.fileExists(configFileName)) {\n                    reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project), undefined);\n                    return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);\n                }\n            }\n        }\n        else if (commandLine.fileNames.length === 0 && isJSONSupported()) {\n            var searchPath = ts.normalizePath(ts.sys.getCurrentDirectory());\n            configFileName = ts.findConfigFile(searchPath, ts.sys.fileExists);\n        }\n        if (commandLine.fileNames.length === 0 && !configFileName) {\n            printVersion();\n            printHelp();\n            return ts.sys.exit(ts.ExitStatus.Success);\n        }\n        if (ts.isWatchSet(commandLine.options)) {\n            if (!ts.sys.watchFile) {\n                reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, \"--watch\"), undefined);\n                return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);\n            }\n            if (configFileName) {\n                configFileWatcher = ts.sys.watchFile(configFileName, configFileChanged);\n            }\n            if (ts.sys.watchDirectory && configFileName) {\n                var directory = ts.getDirectoryPath(configFileName);\n                directoryWatcher = ts.sys.watchDirectory(directory == \"\" ? \".\" : directory, watchedDirectoryChanged, true);\n            }\n        }\n        performCompilation();\n        function parseConfigFile() {\n            if (!cachedConfigFileText) {\n                try {\n                    cachedConfigFileText = ts.sys.readFile(configFileName);\n                }\n                catch (e) {\n                    var error = ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, configFileName, e.message);\n                    reportWatchDiagnostic(error);\n                    ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);\n                    return;\n                }\n            }\n            if (!cachedConfigFileText) {\n                var error = ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, configFileName);\n                reportDiagnostics([error], undefined);\n                ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);\n                return;\n            }\n            var result = ts.parseConfigFileTextToJson(configFileName, cachedConfigFileText);\n            var configObject = result.config;\n            if (!configObject) {\n                reportDiagnostics([result.error], undefined);\n                ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);\n                return;\n            }\n            var cwd = ts.sys.getCurrentDirectory();\n            var configParseResult = ts.parseJsonConfigFileContent(configObject, ts.sys, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), commandLine.options, ts.getNormalizedAbsolutePath(configFileName, cwd));\n            if (configParseResult.errors.length > 0) {\n                reportDiagnostics(configParseResult.errors, undefined);\n                ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);\n                return;\n            }\n            if (ts.isWatchSet(configParseResult.options)) {\n                if (!ts.sys.watchFile) {\n                    reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, \"--watch\"), undefined);\n                    ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);\n                }\n                if (!directoryWatcher && ts.sys.watchDirectory && configFileName) {\n                    var directory = ts.getDirectoryPath(configFileName);\n                    directoryWatcher = ts.sys.watchDirectory(directory == \"\" ? \".\" : directory, watchedDirectoryChanged, true);\n                }\n                ;\n            }\n            return configParseResult;\n        }\n        function performCompilation() {\n            if (!cachedProgram) {\n                if (configFileName) {\n                    var configParseResult = parseConfigFile();\n                    rootFileNames = configParseResult.fileNames;\n                    compilerOptions = configParseResult.options;\n                }\n                else {\n                    rootFileNames = commandLine.fileNames;\n                    compilerOptions = commandLine.options;\n                }\n                compilerHost = ts.createCompilerHost(compilerOptions);\n                hostGetSourceFile = compilerHost.getSourceFile;\n                compilerHost.getSourceFile = getSourceFile;\n                hostFileExists = compilerHost.fileExists;\n                compilerHost.fileExists = cachedFileExists;\n            }\n            if (compilerOptions.pretty) {\n                reportDiagnosticWorker = reportDiagnosticWithColorAndContext;\n            }\n            cachedExistingFiles = ts.createMap();\n            var compileResult = compile(rootFileNames, compilerOptions, compilerHost);\n            if (!ts.isWatchSet(compilerOptions)) {\n                return ts.sys.exit(compileResult.exitStatus);\n            }\n            setCachedProgram(compileResult.program);\n            reportWatchDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Compilation_complete_Watching_for_file_changes));\n        }\n        function cachedFileExists(fileName) {\n            return fileName in cachedExistingFiles\n                ? cachedExistingFiles[fileName]\n                : cachedExistingFiles[fileName] = hostFileExists(fileName);\n        }\n        function getSourceFile(fileName, languageVersion, onError) {\n            if (cachedProgram) {\n                var sourceFile_1 = cachedProgram.getSourceFile(fileName);\n                if (sourceFile_1 && sourceFile_1.fileWatcher) {\n                    return sourceFile_1;\n                }\n            }\n            var sourceFile = hostGetSourceFile(fileName, languageVersion, onError);\n            if (sourceFile && ts.isWatchSet(compilerOptions) && ts.sys.watchFile) {\n                sourceFile.fileWatcher = ts.sys.watchFile(sourceFile.fileName, function (_fileName, removed) { return sourceFileChanged(sourceFile, removed); });\n            }\n            return sourceFile;\n        }\n        function setCachedProgram(program) {\n            if (cachedProgram) {\n                var newSourceFiles_1 = program ? program.getSourceFiles() : undefined;\n                ts.forEach(cachedProgram.getSourceFiles(), function (sourceFile) {\n                    if (!(newSourceFiles_1 && ts.contains(newSourceFiles_1, sourceFile))) {\n                        if (sourceFile.fileWatcher) {\n                            sourceFile.fileWatcher.close();\n                            sourceFile.fileWatcher = undefined;\n                        }\n                    }\n                });\n            }\n            cachedProgram = program;\n        }\n        function sourceFileChanged(sourceFile, removed) {\n            sourceFile.fileWatcher.close();\n            sourceFile.fileWatcher = undefined;\n            if (removed) {\n                ts.unorderedRemoveItem(rootFileNames, sourceFile.fileName);\n            }\n            startTimerForRecompilation();\n        }\n        function configFileChanged() {\n            setCachedProgram(undefined);\n            cachedConfigFileText = undefined;\n            startTimerForRecompilation();\n        }\n        function watchedDirectoryChanged(fileName) {\n            if (fileName && !ts.isSupportedSourceFileName(fileName, compilerOptions)) {\n                return;\n            }\n            startTimerForHandlingDirectoryChanges();\n        }\n        function startTimerForHandlingDirectoryChanges() {\n            if (!ts.sys.setTimeout || !ts.sys.clearTimeout) {\n                return;\n            }\n            if (timerHandleForDirectoryChanges) {\n                ts.sys.clearTimeout(timerHandleForDirectoryChanges);\n            }\n            timerHandleForDirectoryChanges = ts.sys.setTimeout(directoryChangeHandler, 250);\n        }\n        function directoryChangeHandler() {\n            var parsedCommandLine = parseConfigFile();\n            var newFileNames = ts.map(parsedCommandLine.fileNames, compilerHost.getCanonicalFileName);\n            var canonicalRootFileNames = ts.map(rootFileNames, compilerHost.getCanonicalFileName);\n            if (!ts.arrayIsEqualTo(newFileNames && newFileNames.sort(), canonicalRootFileNames && canonicalRootFileNames.sort())) {\n                setCachedProgram(undefined);\n                startTimerForRecompilation();\n            }\n        }\n        function startTimerForRecompilation() {\n            if (!ts.sys.setTimeout || !ts.sys.clearTimeout) {\n                return;\n            }\n            if (timerHandleForRecompilation) {\n                ts.sys.clearTimeout(timerHandleForRecompilation);\n            }\n            timerHandleForRecompilation = ts.sys.setTimeout(recompile, 250);\n        }\n        function recompile() {\n            timerHandleForRecompilation = undefined;\n            reportWatchDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation));\n            performCompilation();\n        }\n    }\n    ts.executeCommandLine = executeCommandLine;\n    function compile(fileNames, compilerOptions, compilerHost) {\n        var hasDiagnostics = compilerOptions.diagnostics || compilerOptions.extendedDiagnostics;\n        var statistics;\n        if (hasDiagnostics) {\n            ts.performance.enable();\n            statistics = [];\n        }\n        var program = ts.createProgram(fileNames, compilerOptions, compilerHost);\n        var exitStatus = compileProgram();\n        if (compilerOptions.listFiles) {\n            ts.forEach(program.getSourceFiles(), function (file) {\n                ts.sys.write(file.fileName + ts.sys.newLine);\n            });\n        }\n        if (hasDiagnostics) {\n            var memoryUsed = ts.sys.getMemoryUsage ? ts.sys.getMemoryUsage() : -1;\n            reportCountStatistic(\"Files\", program.getSourceFiles().length);\n            reportCountStatistic(\"Lines\", countLines(program));\n            reportCountStatistic(\"Nodes\", program.getNodeCount());\n            reportCountStatistic(\"Identifiers\", program.getIdentifierCount());\n            reportCountStatistic(\"Symbols\", program.getSymbolCount());\n            reportCountStatistic(\"Types\", program.getTypeCount());\n            if (memoryUsed >= 0) {\n                reportStatisticalValue(\"Memory used\", Math.round(memoryUsed / 1000) + \"K\");\n            }\n            var programTime = ts.performance.getDuration(\"Program\");\n            var bindTime = ts.performance.getDuration(\"Bind\");\n            var checkTime = ts.performance.getDuration(\"Check\");\n            var emitTime = ts.performance.getDuration(\"Emit\");\n            if (compilerOptions.extendedDiagnostics) {\n                ts.performance.forEachMeasure(function (name, duration) { return reportTimeStatistic(name + \" time\", duration); });\n            }\n            else {\n                reportTimeStatistic(\"I/O read\", ts.performance.getDuration(\"I/O Read\"));\n                reportTimeStatistic(\"I/O write\", ts.performance.getDuration(\"I/O Write\"));\n                reportTimeStatistic(\"Parse time\", programTime);\n                reportTimeStatistic(\"Bind time\", bindTime);\n                reportTimeStatistic(\"Check time\", checkTime);\n                reportTimeStatistic(\"Emit time\", emitTime);\n            }\n            reportTimeStatistic(\"Total time\", programTime + bindTime + checkTime + emitTime);\n            reportStatistics();\n            ts.performance.disable();\n        }\n        return { program: program, exitStatus: exitStatus };\n        function compileProgram() {\n            var diagnostics;\n            diagnostics = program.getSyntacticDiagnostics();\n            if (diagnostics.length === 0) {\n                diagnostics = program.getOptionsDiagnostics().concat(program.getGlobalDiagnostics());\n                if (diagnostics.length === 0) {\n                    diagnostics = program.getSemanticDiagnostics();\n                }\n            }\n            var emitOutput = program.emit();\n            diagnostics = diagnostics.concat(emitOutput.diagnostics);\n            reportDiagnostics(ts.sortAndDeduplicateDiagnostics(diagnostics), compilerHost);\n            reportEmittedFiles(emitOutput.emittedFiles);\n            if (emitOutput.emitSkipped && diagnostics.length > 0) {\n                return ts.ExitStatus.DiagnosticsPresent_OutputsSkipped;\n            }\n            else if (diagnostics.length > 0) {\n                return ts.ExitStatus.DiagnosticsPresent_OutputsGenerated;\n            }\n            return ts.ExitStatus.Success;\n        }\n        function reportStatistics() {\n            var nameSize = 0;\n            var valueSize = 0;\n            for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) {\n                var _a = statistics_1[_i], name_44 = _a.name, value = _a.value;\n                if (name_44.length > nameSize) {\n                    nameSize = name_44.length;\n                }\n                if (value.length > valueSize) {\n                    valueSize = value.length;\n                }\n            }\n            for (var _b = 0, statistics_2 = statistics; _b < statistics_2.length; _b++) {\n                var _c = statistics_2[_b], name_45 = _c.name, value = _c.value;\n                ts.sys.write(padRight(name_45 + \":\", nameSize + 2) + padLeft(value.toString(), valueSize) + ts.sys.newLine);\n            }\n        }\n        function reportStatisticalValue(name, value) {\n            statistics.push({ name: name, value: value });\n        }\n        function reportCountStatistic(name, count) {\n            reportStatisticalValue(name, \"\" + count);\n        }\n        function reportTimeStatistic(name, time) {\n            reportStatisticalValue(name, (time / 1000).toFixed(2) + \"s\");\n        }\n    }\n    function printVersion() {\n        ts.sys.write(getDiagnosticText(ts.Diagnostics.Version_0, ts.version) + ts.sys.newLine);\n    }\n    function printHelp() {\n        var output = [];\n        var syntaxLength = getDiagnosticText(ts.Diagnostics.Syntax_Colon_0, \"\").length;\n        var examplesLength = getDiagnosticText(ts.Diagnostics.Examples_Colon_0, \"\").length;\n        var marginLength = Math.max(syntaxLength, examplesLength);\n        var syntax = makePadding(marginLength - syntaxLength);\n        syntax += \"tsc [\" + getDiagnosticText(ts.Diagnostics.options) + \"] [\" + getDiagnosticText(ts.Diagnostics.file) + \" ...]\";\n        output.push(getDiagnosticText(ts.Diagnostics.Syntax_Colon_0, syntax));\n        output.push(ts.sys.newLine + ts.sys.newLine);\n        var padding = makePadding(marginLength);\n        output.push(getDiagnosticText(ts.Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + \"tsc hello.ts\") + ts.sys.newLine);\n        output.push(padding + \"tsc --outFile file.js file.ts\" + ts.sys.newLine);\n        output.push(padding + \"tsc @args.txt\" + ts.sys.newLine);\n        output.push(ts.sys.newLine);\n        output.push(getDiagnosticText(ts.Diagnostics.Options_Colon) + ts.sys.newLine);\n        var optsList = ts.filter(ts.optionDeclarations.slice(), function (v) { return !v.experimental; });\n        optsList.sort(function (a, b) { return ts.compareValues(a.name.toLowerCase(), b.name.toLowerCase()); });\n        marginLength = 0;\n        var usageColumn = [];\n        var descriptionColumn = [];\n        var optionsDescriptionMap = ts.createMap();\n        for (var i = 0; i < optsList.length; i++) {\n            var option = optsList[i];\n            if (!option.description) {\n                continue;\n            }\n            var usageText_1 = \" \";\n            if (option.shortName) {\n                usageText_1 += \"-\" + option.shortName;\n                usageText_1 += getParamType(option);\n                usageText_1 += \", \";\n            }\n            usageText_1 += \"--\" + option.name;\n            usageText_1 += getParamType(option);\n            usageColumn.push(usageText_1);\n            var description = void 0;\n            if (option.name === \"lib\") {\n                description = getDiagnosticText(option.description);\n                var options = [];\n                var element = option.element;\n                var typeMap = element.type;\n                for (var key in typeMap) {\n                    options.push(\"'\" + key + \"'\");\n                }\n                optionsDescriptionMap[description] = options;\n            }\n            else {\n                description = getDiagnosticText(option.description);\n            }\n            descriptionColumn.push(description);\n            marginLength = Math.max(usageText_1.length, marginLength);\n        }\n        var usageText = \" @<\" + getDiagnosticText(ts.Diagnostics.file) + \">\";\n        usageColumn.push(usageText);\n        descriptionColumn.push(getDiagnosticText(ts.Diagnostics.Insert_command_line_options_and_files_from_a_file));\n        marginLength = Math.max(usageText.length, marginLength);\n        for (var i = 0; i < usageColumn.length; i++) {\n            var usage = usageColumn[i];\n            var description = descriptionColumn[i];\n            var kindsList = optionsDescriptionMap[description];\n            output.push(usage + makePadding(marginLength - usage.length + 2) + description + ts.sys.newLine);\n            if (kindsList) {\n                output.push(makePadding(marginLength + 4));\n                for (var _i = 0, kindsList_1 = kindsList; _i < kindsList_1.length; _i++) {\n                    var kind = kindsList_1[_i];\n                    output.push(kind + \" \");\n                }\n                output.push(ts.sys.newLine);\n            }\n        }\n        for (var _a = 0, output_1 = output; _a < output_1.length; _a++) {\n            var line = output_1[_a];\n            ts.sys.write(line);\n        }\n        return;\n        function getParamType(option) {\n            if (option.paramType !== undefined) {\n                return \" \" + getDiagnosticText(option.paramType);\n            }\n            return \"\";\n        }\n        function makePadding(paddingLength) {\n            return Array(paddingLength + 1).join(\" \");\n        }\n    }\n    function writeConfigFile(options, fileNames) {\n        var currentDirectory = ts.sys.getCurrentDirectory();\n        var file = ts.normalizePath(ts.combinePaths(currentDirectory, \"tsconfig.json\"));\n        if (ts.sys.fileExists(file)) {\n            reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file), undefined);\n        }\n        else {\n            ts.sys.writeFile(file, JSON.stringify(ts.generateTSConfig(options, fileNames), undefined, 4));\n            reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Successfully_created_a_tsconfig_json_file), undefined);\n        }\n        return;\n    }\n    var _a;\n})(ts || (ts = {}));\nif (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnvironmentVariable(\"NODE_ENV\"))) {\n    ts.sys.tryEnableSourceMapsForHost();\n}\nts.executeCommandLine(ts.sys.args);\n"
  },
  {
    "path": "buildtool/typescript/lib/tsserver.js",
    "content": "/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved. \nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0  \n \nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, \nMERCHANTABLITY OR NON-INFRINGEMENT. \n \nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar ts;\n(function (ts) {\n    var OperationCanceledException = (function () {\n        function OperationCanceledException() {\n        }\n        return OperationCanceledException;\n    }());\n    ts.OperationCanceledException = OperationCanceledException;\n    var ExitStatus;\n    (function (ExitStatus) {\n        ExitStatus[ExitStatus[\"Success\"] = 0] = \"Success\";\n        ExitStatus[ExitStatus[\"DiagnosticsPresent_OutputsSkipped\"] = 1] = \"DiagnosticsPresent_OutputsSkipped\";\n        ExitStatus[ExitStatus[\"DiagnosticsPresent_OutputsGenerated\"] = 2] = \"DiagnosticsPresent_OutputsGenerated\";\n    })(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {}));\n    var TypeReferenceSerializationKind;\n    (function (TypeReferenceSerializationKind) {\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"Unknown\"] = 0] = \"Unknown\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"TypeWithConstructSignatureAndValue\"] = 1] = \"TypeWithConstructSignatureAndValue\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"VoidNullableOrNeverType\"] = 2] = \"VoidNullableOrNeverType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"NumberLikeType\"] = 3] = \"NumberLikeType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"StringLikeType\"] = 4] = \"StringLikeType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"BooleanType\"] = 5] = \"BooleanType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"ArrayLikeType\"] = 6] = \"ArrayLikeType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"ESSymbolType\"] = 7] = \"ESSymbolType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"Promise\"] = 8] = \"Promise\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"TypeWithCallSignature\"] = 9] = \"TypeWithCallSignature\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"ObjectType\"] = 10] = \"ObjectType\";\n    })(TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {}));\n    var DiagnosticCategory;\n    (function (DiagnosticCategory) {\n        DiagnosticCategory[DiagnosticCategory[\"Warning\"] = 0] = \"Warning\";\n        DiagnosticCategory[DiagnosticCategory[\"Error\"] = 1] = \"Error\";\n        DiagnosticCategory[DiagnosticCategory[\"Message\"] = 2] = \"Message\";\n    })(DiagnosticCategory = ts.DiagnosticCategory || (ts.DiagnosticCategory = {}));\n    var ModuleResolutionKind;\n    (function (ModuleResolutionKind) {\n        ModuleResolutionKind[ModuleResolutionKind[\"Classic\"] = 1] = \"Classic\";\n        ModuleResolutionKind[ModuleResolutionKind[\"NodeJs\"] = 2] = \"NodeJs\";\n    })(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));\n    var ModuleKind;\n    (function (ModuleKind) {\n        ModuleKind[ModuleKind[\"None\"] = 0] = \"None\";\n        ModuleKind[ModuleKind[\"CommonJS\"] = 1] = \"CommonJS\";\n        ModuleKind[ModuleKind[\"AMD\"] = 2] = \"AMD\";\n        ModuleKind[ModuleKind[\"UMD\"] = 3] = \"UMD\";\n        ModuleKind[ModuleKind[\"System\"] = 4] = \"System\";\n        ModuleKind[ModuleKind[\"ES2015\"] = 5] = \"ES2015\";\n    })(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));\n    var Extension;\n    (function (Extension) {\n        Extension[Extension[\"Ts\"] = 0] = \"Ts\";\n        Extension[Extension[\"Tsx\"] = 1] = \"Tsx\";\n        Extension[Extension[\"Dts\"] = 2] = \"Dts\";\n        Extension[Extension[\"Js\"] = 3] = \"Js\";\n        Extension[Extension[\"Jsx\"] = 4] = \"Jsx\";\n        Extension[Extension[\"LastTypeScriptExtension\"] = 2] = \"LastTypeScriptExtension\";\n    })(Extension = ts.Extension || (ts.Extension = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    ts.timestamp = typeof performance !== \"undefined\" && performance.now ? function () { return performance.now(); } : Date.now ? Date.now : function () { return +(new Date()); };\n})(ts || (ts = {}));\n(function (ts) {\n    var performance;\n    (function (performance) {\n        var profilerEvent = typeof onProfilerEvent === \"function\" && onProfilerEvent.profiler === true\n            ? onProfilerEvent\n            : function (_markName) { };\n        var enabled = false;\n        var profilerStart = 0;\n        var counts;\n        var marks;\n        var measures;\n        function mark(markName) {\n            if (enabled) {\n                marks[markName] = ts.timestamp();\n                counts[markName] = (counts[markName] || 0) + 1;\n                profilerEvent(markName);\n            }\n        }\n        performance.mark = mark;\n        function measure(measureName, startMarkName, endMarkName) {\n            if (enabled) {\n                var end = endMarkName && marks[endMarkName] || ts.timestamp();\n                var start = startMarkName && marks[startMarkName] || profilerStart;\n                measures[measureName] = (measures[measureName] || 0) + (end - start);\n            }\n        }\n        performance.measure = measure;\n        function getCount(markName) {\n            return counts && counts[markName] || 0;\n        }\n        performance.getCount = getCount;\n        function getDuration(measureName) {\n            return measures && measures[measureName] || 0;\n        }\n        performance.getDuration = getDuration;\n        function forEachMeasure(cb) {\n            for (var key in measures) {\n                cb(key, measures[key]);\n            }\n        }\n        performance.forEachMeasure = forEachMeasure;\n        function enable() {\n            counts = ts.createMap();\n            marks = ts.createMap();\n            measures = ts.createMap();\n            enabled = true;\n            profilerStart = ts.timestamp();\n        }\n        performance.enable = enable;\n        function disable() {\n            enabled = false;\n        }\n        performance.disable = disable;\n    })(performance = ts.performance || (ts.performance = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    ts.version = \"2.1.4\";\n})(ts || (ts = {}));\n(function (ts) {\n    var createObject = Object.create;\n    ts.collator = typeof Intl === \"object\" && typeof Intl.Collator === \"function\" ? new Intl.Collator() : undefined;\n    function createMap(template) {\n        var map = createObject(null);\n        map[\"__\"] = undefined;\n        delete map[\"__\"];\n        for (var key in template)\n            if (hasOwnProperty.call(template, key)) {\n                map[key] = template[key];\n            }\n        return map;\n    }\n    ts.createMap = createMap;\n    function createFileMap(keyMapper) {\n        var files = createMap();\n        return {\n            get: get,\n            set: set,\n            contains: contains,\n            remove: remove,\n            forEachValue: forEachValueInMap,\n            getKeys: getKeys,\n            clear: clear,\n        };\n        function forEachValueInMap(f) {\n            for (var key in files) {\n                f(key, files[key]);\n            }\n        }\n        function getKeys() {\n            var keys = [];\n            for (var key in files) {\n                keys.push(key);\n            }\n            return keys;\n        }\n        function get(path) {\n            return files[toKey(path)];\n        }\n        function set(path, value) {\n            files[toKey(path)] = value;\n        }\n        function contains(path) {\n            return toKey(path) in files;\n        }\n        function remove(path) {\n            var key = toKey(path);\n            delete files[key];\n        }\n        function clear() {\n            files = createMap();\n        }\n        function toKey(path) {\n            return keyMapper ? keyMapper(path) : path;\n        }\n    }\n    ts.createFileMap = createFileMap;\n    function toPath(fileName, basePath, getCanonicalFileName) {\n        var nonCanonicalizedPath = isRootedDiskPath(fileName)\n            ? normalizePath(fileName)\n            : getNormalizedAbsolutePath(fileName, basePath);\n        return getCanonicalFileName(nonCanonicalizedPath);\n    }\n    ts.toPath = toPath;\n    function forEach(array, callback) {\n        if (array) {\n            for (var i = 0, len = array.length; i < len; i++) {\n                var result = callback(array[i], i);\n                if (result) {\n                    return result;\n                }\n            }\n        }\n        return undefined;\n    }\n    ts.forEach = forEach;\n    function zipWith(arrayA, arrayB, callback) {\n        Debug.assert(arrayA.length === arrayB.length);\n        for (var i = 0; i < arrayA.length; i++) {\n            callback(arrayA[i], arrayB[i], i);\n        }\n    }\n    ts.zipWith = zipWith;\n    function every(array, callback) {\n        if (array) {\n            for (var i = 0, len = array.length; i < len; i++) {\n                if (!callback(array[i], i)) {\n                    return false;\n                }\n            }\n        }\n        return true;\n    }\n    ts.every = every;\n    function find(array, predicate) {\n        for (var i = 0, len = array.length; i < len; i++) {\n            var value = array[i];\n            if (predicate(value, i)) {\n                return value;\n            }\n        }\n        return undefined;\n    }\n    ts.find = find;\n    function findMap(array, callback) {\n        for (var i = 0, len = array.length; i < len; i++) {\n            var result = callback(array[i], i);\n            if (result) {\n                return result;\n            }\n        }\n        Debug.fail();\n    }\n    ts.findMap = findMap;\n    function contains(array, value) {\n        if (array) {\n            for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {\n                var v = array_1[_i];\n                if (v === value) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n    ts.contains = contains;\n    function indexOf(array, value) {\n        if (array) {\n            for (var i = 0, len = array.length; i < len; i++) {\n                if (array[i] === value) {\n                    return i;\n                }\n            }\n        }\n        return -1;\n    }\n    ts.indexOf = indexOf;\n    function indexOfAnyCharCode(text, charCodes, start) {\n        for (var i = start || 0, len = text.length; i < len; i++) {\n            if (contains(charCodes, text.charCodeAt(i))) {\n                return i;\n            }\n        }\n        return -1;\n    }\n    ts.indexOfAnyCharCode = indexOfAnyCharCode;\n    function countWhere(array, predicate) {\n        var count = 0;\n        if (array) {\n            for (var i = 0; i < array.length; i++) {\n                var v = array[i];\n                if (predicate(v, i)) {\n                    count++;\n                }\n            }\n        }\n        return count;\n    }\n    ts.countWhere = countWhere;\n    function filter(array, f) {\n        if (array) {\n            var len = array.length;\n            var i = 0;\n            while (i < len && f(array[i]))\n                i++;\n            if (i < len) {\n                var result = array.slice(0, i);\n                i++;\n                while (i < len) {\n                    var item = array[i];\n                    if (f(item)) {\n                        result.push(item);\n                    }\n                    i++;\n                }\n                return result;\n            }\n        }\n        return array;\n    }\n    ts.filter = filter;\n    function removeWhere(array, f) {\n        var outIndex = 0;\n        for (var _i = 0, array_2 = array; _i < array_2.length; _i++) {\n            var item = array_2[_i];\n            if (!f(item)) {\n                array[outIndex] = item;\n                outIndex++;\n            }\n        }\n        if (outIndex !== array.length) {\n            array.length = outIndex;\n            return true;\n        }\n        return false;\n    }\n    ts.removeWhere = removeWhere;\n    function filterMutate(array, f) {\n        var outIndex = 0;\n        for (var _i = 0, array_3 = array; _i < array_3.length; _i++) {\n            var item = array_3[_i];\n            if (f(item)) {\n                array[outIndex] = item;\n                outIndex++;\n            }\n        }\n        array.length = outIndex;\n    }\n    ts.filterMutate = filterMutate;\n    function map(array, f) {\n        var result;\n        if (array) {\n            result = [];\n            for (var i = 0; i < array.length; i++) {\n                result.push(f(array[i], i));\n            }\n        }\n        return result;\n    }\n    ts.map = map;\n    function sameMap(array, f) {\n        var result;\n        if (array) {\n            for (var i = 0; i < array.length; i++) {\n                if (result) {\n                    result.push(f(array[i], i));\n                }\n                else {\n                    var item = array[i];\n                    var mapped = f(item, i);\n                    if (item !== mapped) {\n                        result = array.slice(0, i);\n                        result.push(mapped);\n                    }\n                }\n            }\n        }\n        return result || array;\n    }\n    ts.sameMap = sameMap;\n    function flatten(array) {\n        var result;\n        if (array) {\n            result = [];\n            for (var _i = 0, array_4 = array; _i < array_4.length; _i++) {\n                var v = array_4[_i];\n                if (v) {\n                    if (isArray(v)) {\n                        addRange(result, v);\n                    }\n                    else {\n                        result.push(v);\n                    }\n                }\n            }\n        }\n        return result;\n    }\n    ts.flatten = flatten;\n    function flatMap(array, mapfn) {\n        var result;\n        if (array) {\n            result = [];\n            for (var i = 0; i < array.length; i++) {\n                var v = mapfn(array[i], i);\n                if (v) {\n                    if (isArray(v)) {\n                        addRange(result, v);\n                    }\n                    else {\n                        result.push(v);\n                    }\n                }\n            }\n        }\n        return result;\n    }\n    ts.flatMap = flatMap;\n    function span(array, f) {\n        if (array) {\n            for (var i = 0; i < array.length; i++) {\n                if (!f(array[i], i)) {\n                    return [array.slice(0, i), array.slice(i)];\n                }\n            }\n            return [array.slice(0), []];\n        }\n        return undefined;\n    }\n    ts.span = span;\n    function spanMap(array, keyfn, mapfn) {\n        var result;\n        if (array) {\n            result = [];\n            var len = array.length;\n            var previousKey = void 0;\n            var key = void 0;\n            var start = 0;\n            var pos = 0;\n            while (start < len) {\n                while (pos < len) {\n                    var value = array[pos];\n                    key = keyfn(value, pos);\n                    if (pos === 0) {\n                        previousKey = key;\n                    }\n                    else if (key !== previousKey) {\n                        break;\n                    }\n                    pos++;\n                }\n                if (start < pos) {\n                    var v = mapfn(array.slice(start, pos), previousKey, start, pos);\n                    if (v) {\n                        result.push(v);\n                    }\n                    start = pos;\n                }\n                previousKey = key;\n                pos++;\n            }\n        }\n        return result;\n    }\n    ts.spanMap = spanMap;\n    function mapObject(object, f) {\n        var result;\n        if (object) {\n            result = {};\n            for (var _i = 0, _a = getOwnKeys(object); _i < _a.length; _i++) {\n                var v = _a[_i];\n                var _b = f(v, object[v]) || [undefined, undefined], key = _b[0], value = _b[1];\n                if (key !== undefined) {\n                    result[key] = value;\n                }\n            }\n        }\n        return result;\n    }\n    ts.mapObject = mapObject;\n    function some(array, predicate) {\n        if (array) {\n            if (predicate) {\n                for (var _i = 0, array_5 = array; _i < array_5.length; _i++) {\n                    var v = array_5[_i];\n                    if (predicate(v)) {\n                        return true;\n                    }\n                }\n            }\n            else {\n                return array.length > 0;\n            }\n        }\n        return false;\n    }\n    ts.some = some;\n    function concatenate(array1, array2) {\n        if (!some(array2))\n            return array1;\n        if (!some(array1))\n            return array2;\n        return array1.concat(array2);\n    }\n    ts.concatenate = concatenate;\n    function deduplicate(array, areEqual) {\n        var result;\n        if (array) {\n            result = [];\n            loop: for (var _i = 0, array_6 = array; _i < array_6.length; _i++) {\n                var item = array_6[_i];\n                for (var _a = 0, result_1 = result; _a < result_1.length; _a++) {\n                    var res = result_1[_a];\n                    if (areEqual ? areEqual(res, item) : res === item) {\n                        continue loop;\n                    }\n                }\n                result.push(item);\n            }\n        }\n        return result;\n    }\n    ts.deduplicate = deduplicate;\n    function arrayIsEqualTo(array1, array2, equaler) {\n        if (!array1 || !array2) {\n            return array1 === array2;\n        }\n        if (array1.length !== array2.length) {\n            return false;\n        }\n        for (var i = 0; i < array1.length; i++) {\n            var equals = equaler ? equaler(array1[i], array2[i]) : array1[i] === array2[i];\n            if (!equals) {\n                return false;\n            }\n        }\n        return true;\n    }\n    ts.arrayIsEqualTo = arrayIsEqualTo;\n    function changesAffectModuleResolution(oldOptions, newOptions) {\n        return !oldOptions ||\n            (oldOptions.module !== newOptions.module) ||\n            (oldOptions.moduleResolution !== newOptions.moduleResolution) ||\n            (oldOptions.noResolve !== newOptions.noResolve) ||\n            (oldOptions.target !== newOptions.target) ||\n            (oldOptions.noLib !== newOptions.noLib) ||\n            (oldOptions.jsx !== newOptions.jsx) ||\n            (oldOptions.allowJs !== newOptions.allowJs) ||\n            (oldOptions.rootDir !== newOptions.rootDir) ||\n            (oldOptions.configFilePath !== newOptions.configFilePath) ||\n            (oldOptions.baseUrl !== newOptions.baseUrl) ||\n            (oldOptions.maxNodeModuleJsDepth !== newOptions.maxNodeModuleJsDepth) ||\n            !arrayIsEqualTo(oldOptions.lib, newOptions.lib) ||\n            !arrayIsEqualTo(oldOptions.typeRoots, newOptions.typeRoots) ||\n            !arrayIsEqualTo(oldOptions.rootDirs, newOptions.rootDirs) ||\n            !equalOwnProperties(oldOptions.paths, newOptions.paths);\n    }\n    ts.changesAffectModuleResolution = changesAffectModuleResolution;\n    function compact(array) {\n        var result;\n        if (array) {\n            for (var i = 0; i < array.length; i++) {\n                var v = array[i];\n                if (result || !v) {\n                    if (!result) {\n                        result = array.slice(0, i);\n                    }\n                    if (v) {\n                        result.push(v);\n                    }\n                }\n            }\n        }\n        return result || array;\n    }\n    ts.compact = compact;\n    function relativeComplement(arrayA, arrayB, comparer, offsetA, offsetB) {\n        if (comparer === void 0) { comparer = compareValues; }\n        if (offsetA === void 0) { offsetA = 0; }\n        if (offsetB === void 0) { offsetB = 0; }\n        if (!arrayB || !arrayA || arrayB.length === 0 || arrayA.length === 0)\n            return arrayB;\n        var result = [];\n        outer: for (; offsetB < arrayB.length; offsetB++) {\n            inner: for (; offsetA < arrayA.length; offsetA++) {\n                switch (comparer(arrayB[offsetB], arrayA[offsetA])) {\n                    case -1: break inner;\n                    case 0: continue outer;\n                    case 1: continue inner;\n                }\n            }\n            result.push(arrayB[offsetB]);\n        }\n        return result;\n    }\n    ts.relativeComplement = relativeComplement;\n    function sum(array, prop) {\n        var result = 0;\n        for (var _i = 0, array_7 = array; _i < array_7.length; _i++) {\n            var v = array_7[_i];\n            result += v[prop];\n        }\n        return result;\n    }\n    ts.sum = sum;\n    function append(to, value) {\n        if (value === undefined)\n            return to;\n        if (to === undefined)\n            return [value];\n        to.push(value);\n        return to;\n    }\n    ts.append = append;\n    function addRange(to, from) {\n        if (from === undefined)\n            return to;\n        for (var _i = 0, from_1 = from; _i < from_1.length; _i++) {\n            var v = from_1[_i];\n            to = append(to, v);\n        }\n        return to;\n    }\n    ts.addRange = addRange;\n    function stableSort(array, comparer) {\n        if (comparer === void 0) { comparer = compareValues; }\n        return array\n            .map(function (_, i) { return i; })\n            .sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); })\n            .map(function (i) { return array[i]; });\n    }\n    ts.stableSort = stableSort;\n    function rangeEquals(array1, array2, pos, end) {\n        while (pos < end) {\n            if (array1[pos] !== array2[pos]) {\n                return false;\n            }\n            pos++;\n        }\n        return true;\n    }\n    ts.rangeEquals = rangeEquals;\n    function firstOrUndefined(array) {\n        return array && array.length > 0\n            ? array[0]\n            : undefined;\n    }\n    ts.firstOrUndefined = firstOrUndefined;\n    function lastOrUndefined(array) {\n        return array && array.length > 0\n            ? array[array.length - 1]\n            : undefined;\n    }\n    ts.lastOrUndefined = lastOrUndefined;\n    function singleOrUndefined(array) {\n        return array && array.length === 1\n            ? array[0]\n            : undefined;\n    }\n    ts.singleOrUndefined = singleOrUndefined;\n    function singleOrMany(array) {\n        return array && array.length === 1\n            ? array[0]\n            : array;\n    }\n    ts.singleOrMany = singleOrMany;\n    function replaceElement(array, index, value) {\n        var result = array.slice(0);\n        result[index] = value;\n        return result;\n    }\n    ts.replaceElement = replaceElement;\n    function binarySearch(array, value, comparer, offset) {\n        if (!array || array.length === 0) {\n            return -1;\n        }\n        var low = offset || 0;\n        var high = array.length - 1;\n        comparer = comparer !== undefined\n            ? comparer\n            : function (v1, v2) { return (v1 < v2 ? -1 : (v1 > v2 ? 1 : 0)); };\n        while (low <= high) {\n            var middle = low + ((high - low) >> 1);\n            var midValue = array[middle];\n            if (comparer(midValue, value) === 0) {\n                return middle;\n            }\n            else if (comparer(midValue, value) > 0) {\n                high = middle - 1;\n            }\n            else {\n                low = middle + 1;\n            }\n        }\n        return ~low;\n    }\n    ts.binarySearch = binarySearch;\n    function reduceLeft(array, f, initial, start, count) {\n        if (array && array.length > 0) {\n            var size = array.length;\n            if (size > 0) {\n                var pos = start === undefined || start < 0 ? 0 : start;\n                var end = count === undefined || pos + count > size - 1 ? size - 1 : pos + count;\n                var result = void 0;\n                if (arguments.length <= 2) {\n                    result = array[pos];\n                    pos++;\n                }\n                else {\n                    result = initial;\n                }\n                while (pos <= end) {\n                    result = f(result, array[pos], pos);\n                    pos++;\n                }\n                return result;\n            }\n        }\n        return initial;\n    }\n    ts.reduceLeft = reduceLeft;\n    function reduceRight(array, f, initial, start, count) {\n        if (array) {\n            var size = array.length;\n            if (size > 0) {\n                var pos = start === undefined || start > size - 1 ? size - 1 : start;\n                var end = count === undefined || pos - count < 0 ? 0 : pos - count;\n                var result = void 0;\n                if (arguments.length <= 2) {\n                    result = array[pos];\n                    pos--;\n                }\n                else {\n                    result = initial;\n                }\n                while (pos >= end) {\n                    result = f(result, array[pos], pos);\n                    pos--;\n                }\n                return result;\n            }\n        }\n        return initial;\n    }\n    ts.reduceRight = reduceRight;\n    var hasOwnProperty = Object.prototype.hasOwnProperty;\n    function hasProperty(map, key) {\n        return hasOwnProperty.call(map, key);\n    }\n    ts.hasProperty = hasProperty;\n    function getProperty(map, key) {\n        return hasOwnProperty.call(map, key) ? map[key] : undefined;\n    }\n    ts.getProperty = getProperty;\n    function getOwnKeys(map) {\n        var keys = [];\n        for (var key in map)\n            if (hasOwnProperty.call(map, key)) {\n                keys.push(key);\n            }\n        return keys;\n    }\n    ts.getOwnKeys = getOwnKeys;\n    function forEachProperty(map, callback) {\n        var result;\n        for (var key in map) {\n            if (result = callback(map[key], key))\n                break;\n        }\n        return result;\n    }\n    ts.forEachProperty = forEachProperty;\n    function someProperties(map, predicate) {\n        for (var key in map) {\n            if (!predicate || predicate(map[key], key))\n                return true;\n        }\n        return false;\n    }\n    ts.someProperties = someProperties;\n    function copyProperties(source, target) {\n        for (var key in source) {\n            target[key] = source[key];\n        }\n    }\n    ts.copyProperties = copyProperties;\n    function appendProperty(map, key, value) {\n        if (key === undefined || value === undefined)\n            return map;\n        if (map === undefined)\n            map = createMap();\n        map[key] = value;\n        return map;\n    }\n    ts.appendProperty = appendProperty;\n    function assign(t) {\n        var args = [];\n        for (var _i = 1; _i < arguments.length; _i++) {\n            args[_i - 1] = arguments[_i];\n        }\n        for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {\n            var arg = args_1[_a];\n            for (var _b = 0, _c = getOwnKeys(arg); _b < _c.length; _b++) {\n                var p = _c[_b];\n                t[p] = arg[p];\n            }\n        }\n        return t;\n    }\n    ts.assign = assign;\n    function reduceProperties(map, callback, initial) {\n        var result = initial;\n        for (var key in map) {\n            result = callback(result, map[key], String(key));\n        }\n        return result;\n    }\n    ts.reduceProperties = reduceProperties;\n    function reduceOwnProperties(map, callback, initial) {\n        var result = initial;\n        for (var key in map)\n            if (hasOwnProperty.call(map, key)) {\n                result = callback(result, map[key], String(key));\n            }\n        return result;\n    }\n    ts.reduceOwnProperties = reduceOwnProperties;\n    function equalOwnProperties(left, right, equalityComparer) {\n        if (left === right)\n            return true;\n        if (!left || !right)\n            return false;\n        for (var key in left)\n            if (hasOwnProperty.call(left, key)) {\n                if (!hasOwnProperty.call(right, key) === undefined)\n                    return false;\n                if (equalityComparer ? !equalityComparer(left[key], right[key]) : left[key] !== right[key])\n                    return false;\n            }\n        for (var key in right)\n            if (hasOwnProperty.call(right, key)) {\n                if (!hasOwnProperty.call(left, key))\n                    return false;\n            }\n        return true;\n    }\n    ts.equalOwnProperties = equalOwnProperties;\n    function arrayToMap(array, makeKey, makeValue) {\n        var result = createMap();\n        for (var _i = 0, array_8 = array; _i < array_8.length; _i++) {\n            var value = array_8[_i];\n            result[makeKey(value)] = makeValue ? makeValue(value) : value;\n        }\n        return result;\n    }\n    ts.arrayToMap = arrayToMap;\n    function isEmpty(map) {\n        for (var id in map) {\n            if (hasProperty(map, id)) {\n                return false;\n            }\n        }\n        return true;\n    }\n    ts.isEmpty = isEmpty;\n    function cloneMap(map) {\n        var clone = createMap();\n        copyProperties(map, clone);\n        return clone;\n    }\n    ts.cloneMap = cloneMap;\n    function clone(object) {\n        var result = {};\n        for (var id in object) {\n            if (hasOwnProperty.call(object, id)) {\n                result[id] = object[id];\n            }\n        }\n        return result;\n    }\n    ts.clone = clone;\n    function extend(first, second) {\n        var result = {};\n        for (var id in second)\n            if (hasOwnProperty.call(second, id)) {\n                result[id] = second[id];\n            }\n        for (var id in first)\n            if (hasOwnProperty.call(first, id)) {\n                result[id] = first[id];\n            }\n        return result;\n    }\n    ts.extend = extend;\n    function multiMapAdd(map, key, value) {\n        var values = map[key];\n        if (values) {\n            values.push(value);\n            return values;\n        }\n        else {\n            return map[key] = [value];\n        }\n    }\n    ts.multiMapAdd = multiMapAdd;\n    function multiMapRemove(map, key, value) {\n        var values = map[key];\n        if (values) {\n            unorderedRemoveItem(values, value);\n            if (!values.length) {\n                delete map[key];\n            }\n        }\n    }\n    ts.multiMapRemove = multiMapRemove;\n    function isArray(value) {\n        return Array.isArray ? Array.isArray(value) : value instanceof Array;\n    }\n    ts.isArray = isArray;\n    function noop() { }\n    ts.noop = noop;\n    function notImplemented() {\n        throw new Error(\"Not implemented\");\n    }\n    ts.notImplemented = notImplemented;\n    function memoize(callback) {\n        var value;\n        return function () {\n            if (callback) {\n                value = callback();\n                callback = undefined;\n            }\n            return value;\n        };\n    }\n    ts.memoize = memoize;\n    function chain(a, b, c, d, e) {\n        if (e) {\n            var args_2 = [];\n            for (var i = 0; i < arguments.length; i++) {\n                args_2[i] = arguments[i];\n            }\n            return function (t) { return compose.apply(void 0, map(args_2, function (f) { return f(t); })); };\n        }\n        else if (d) {\n            return function (t) { return compose(a(t), b(t), c(t), d(t)); };\n        }\n        else if (c) {\n            return function (t) { return compose(a(t), b(t), c(t)); };\n        }\n        else if (b) {\n            return function (t) { return compose(a(t), b(t)); };\n        }\n        else if (a) {\n            return function (t) { return compose(a(t)); };\n        }\n        else {\n            return function (_) { return function (u) { return u; }; };\n        }\n    }\n    ts.chain = chain;\n    function compose(a, b, c, d, e) {\n        if (e) {\n            var args_3 = [];\n            for (var i = 0; i < arguments.length; i++) {\n                args_3[i] = arguments[i];\n            }\n            return function (t) { return reduceLeft(args_3, function (u, f) { return f(u); }, t); };\n        }\n        else if (d) {\n            return function (t) { return d(c(b(a(t)))); };\n        }\n        else if (c) {\n            return function (t) { return c(b(a(t))); };\n        }\n        else if (b) {\n            return function (t) { return b(a(t)); };\n        }\n        else if (a) {\n            return function (t) { return a(t); };\n        }\n        else {\n            return function (t) { return t; };\n        }\n    }\n    ts.compose = compose;\n    function formatStringFromArgs(text, args, baseIndex) {\n        baseIndex = baseIndex || 0;\n        return text.replace(/{(\\d+)}/g, function (_match, index) { return args[+index + baseIndex]; });\n    }\n    ts.localizedDiagnosticMessages = undefined;\n    function getLocaleSpecificMessage(message) {\n        return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message;\n    }\n    ts.getLocaleSpecificMessage = getLocaleSpecificMessage;\n    function createFileDiagnostic(file, start, length, message) {\n        var end = start + length;\n        Debug.assert(start >= 0, \"start must be non-negative, is \" + start);\n        Debug.assert(length >= 0, \"length must be non-negative, is \" + length);\n        if (file) {\n            Debug.assert(start <= file.text.length, \"start must be within the bounds of the file. \" + start + \" > \" + file.text.length);\n            Debug.assert(end <= file.text.length, \"end must be the bounds of the file. \" + end + \" > \" + file.text.length);\n        }\n        var text = getLocaleSpecificMessage(message);\n        if (arguments.length > 4) {\n            text = formatStringFromArgs(text, arguments, 4);\n        }\n        return {\n            file: file,\n            start: start,\n            length: length,\n            messageText: text,\n            category: message.category,\n            code: message.code,\n        };\n    }\n    ts.createFileDiagnostic = createFileDiagnostic;\n    function formatMessage(_dummy, message) {\n        var text = getLocaleSpecificMessage(message);\n        if (arguments.length > 2) {\n            text = formatStringFromArgs(text, arguments, 2);\n        }\n        return text;\n    }\n    ts.formatMessage = formatMessage;\n    function createCompilerDiagnostic(message) {\n        var text = getLocaleSpecificMessage(message);\n        if (arguments.length > 1) {\n            text = formatStringFromArgs(text, arguments, 1);\n        }\n        return {\n            file: undefined,\n            start: undefined,\n            length: undefined,\n            messageText: text,\n            category: message.category,\n            code: message.code\n        };\n    }\n    ts.createCompilerDiagnostic = createCompilerDiagnostic;\n    function createCompilerDiagnosticFromMessageChain(chain) {\n        return {\n            file: undefined,\n            start: undefined,\n            length: undefined,\n            code: chain.code,\n            category: chain.category,\n            messageText: chain.next ? chain : chain.messageText\n        };\n    }\n    ts.createCompilerDiagnosticFromMessageChain = createCompilerDiagnosticFromMessageChain;\n    function chainDiagnosticMessages(details, message) {\n        var text = getLocaleSpecificMessage(message);\n        if (arguments.length > 2) {\n            text = formatStringFromArgs(text, arguments, 2);\n        }\n        return {\n            messageText: text,\n            category: message.category,\n            code: message.code,\n            next: details\n        };\n    }\n    ts.chainDiagnosticMessages = chainDiagnosticMessages;\n    function concatenateDiagnosticMessageChains(headChain, tailChain) {\n        var lastChain = headChain;\n        while (lastChain.next) {\n            lastChain = lastChain.next;\n        }\n        lastChain.next = tailChain;\n        return headChain;\n    }\n    ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains;\n    function compareValues(a, b) {\n        if (a === b)\n            return 0;\n        if (a === undefined)\n            return -1;\n        if (b === undefined)\n            return 1;\n        return a < b ? -1 : 1;\n    }\n    ts.compareValues = compareValues;\n    function compareStrings(a, b, ignoreCase) {\n        if (a === b)\n            return 0;\n        if (a === undefined)\n            return -1;\n        if (b === undefined)\n            return 1;\n        if (ignoreCase) {\n            if (ts.collator && String.prototype.localeCompare) {\n                var result = a.localeCompare(b, undefined, { usage: \"sort\", sensitivity: \"accent\" });\n                return result < 0 ? -1 : result > 0 ? 1 : 0;\n            }\n            a = a.toUpperCase();\n            b = b.toUpperCase();\n            if (a === b)\n                return 0;\n        }\n        return a < b ? -1 : 1;\n    }\n    ts.compareStrings = compareStrings;\n    function compareStringsCaseInsensitive(a, b) {\n        return compareStrings(a, b, true);\n    }\n    ts.compareStringsCaseInsensitive = compareStringsCaseInsensitive;\n    function getDiagnosticFileName(diagnostic) {\n        return diagnostic.file ? diagnostic.file.fileName : undefined;\n    }\n    function compareDiagnostics(d1, d2) {\n        return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) ||\n            compareValues(d1.start, d2.start) ||\n            compareValues(d1.length, d2.length) ||\n            compareValues(d1.code, d2.code) ||\n            compareMessageText(d1.messageText, d2.messageText) ||\n            0;\n    }\n    ts.compareDiagnostics = compareDiagnostics;\n    function compareMessageText(text1, text2) {\n        while (text1 && text2) {\n            var string1 = typeof text1 === \"string\" ? text1 : text1.messageText;\n            var string2 = typeof text2 === \"string\" ? text2 : text2.messageText;\n            var res = compareValues(string1, string2);\n            if (res) {\n                return res;\n            }\n            text1 = typeof text1 === \"string\" ? undefined : text1.next;\n            text2 = typeof text2 === \"string\" ? undefined : text2.next;\n        }\n        if (!text1 && !text2) {\n            return 0;\n        }\n        return text1 ? 1 : -1;\n    }\n    function sortAndDeduplicateDiagnostics(diagnostics) {\n        return deduplicateSortedDiagnostics(diagnostics.sort(compareDiagnostics));\n    }\n    ts.sortAndDeduplicateDiagnostics = sortAndDeduplicateDiagnostics;\n    function deduplicateSortedDiagnostics(diagnostics) {\n        if (diagnostics.length < 2) {\n            return diagnostics;\n        }\n        var newDiagnostics = [diagnostics[0]];\n        var previousDiagnostic = diagnostics[0];\n        for (var i = 1; i < diagnostics.length; i++) {\n            var currentDiagnostic = diagnostics[i];\n            var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === 0;\n            if (!isDupe) {\n                newDiagnostics.push(currentDiagnostic);\n                previousDiagnostic = currentDiagnostic;\n            }\n        }\n        return newDiagnostics;\n    }\n    ts.deduplicateSortedDiagnostics = deduplicateSortedDiagnostics;\n    function normalizeSlashes(path) {\n        return path.replace(/\\\\/g, \"/\");\n    }\n    ts.normalizeSlashes = normalizeSlashes;\n    function getRootLength(path) {\n        if (path.charCodeAt(0) === 47) {\n            if (path.charCodeAt(1) !== 47)\n                return 1;\n            var p1 = path.indexOf(\"/\", 2);\n            if (p1 < 0)\n                return 2;\n            var p2 = path.indexOf(\"/\", p1 + 1);\n            if (p2 < 0)\n                return p1 + 1;\n            return p2 + 1;\n        }\n        if (path.charCodeAt(1) === 58) {\n            if (path.charCodeAt(2) === 47)\n                return 3;\n            return 2;\n        }\n        if (path.lastIndexOf(\"file:///\", 0) === 0) {\n            return \"file:///\".length;\n        }\n        var idx = path.indexOf(\"://\");\n        if (idx !== -1) {\n            return idx + \"://\".length;\n        }\n        return 0;\n    }\n    ts.getRootLength = getRootLength;\n    ts.directorySeparator = \"/\";\n    var directorySeparatorCharCode = 47;\n    function getNormalizedParts(normalizedSlashedPath, rootLength) {\n        var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator);\n        var normalized = [];\n        for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {\n            var part = parts_1[_i];\n            if (part !== \".\") {\n                if (part === \"..\" && normalized.length > 0 && lastOrUndefined(normalized) !== \"..\") {\n                    normalized.pop();\n                }\n                else {\n                    if (part) {\n                        normalized.push(part);\n                    }\n                }\n            }\n        }\n        return normalized;\n    }\n    function normalizePath(path) {\n        path = normalizeSlashes(path);\n        var rootLength = getRootLength(path);\n        var root = path.substr(0, rootLength);\n        var normalized = getNormalizedParts(path, rootLength);\n        if (normalized.length) {\n            var joinedParts = root + normalized.join(ts.directorySeparator);\n            return pathEndsWithDirectorySeparator(path) ? joinedParts + ts.directorySeparator : joinedParts;\n        }\n        else {\n            return root;\n        }\n    }\n    ts.normalizePath = normalizePath;\n    function pathEndsWithDirectorySeparator(path) {\n        return path.charCodeAt(path.length - 1) === directorySeparatorCharCode;\n    }\n    ts.pathEndsWithDirectorySeparator = pathEndsWithDirectorySeparator;\n    function getDirectoryPath(path) {\n        return path.substr(0, Math.max(getRootLength(path), path.lastIndexOf(ts.directorySeparator)));\n    }\n    ts.getDirectoryPath = getDirectoryPath;\n    function isUrl(path) {\n        return path && !isRootedDiskPath(path) && path.indexOf(\"://\") !== -1;\n    }\n    ts.isUrl = isUrl;\n    function isExternalModuleNameRelative(moduleName) {\n        return /^\\.\\.?($|[\\\\/])/.test(moduleName);\n    }\n    ts.isExternalModuleNameRelative = isExternalModuleNameRelative;\n    function getEmitScriptTarget(compilerOptions) {\n        return compilerOptions.target || 0;\n    }\n    ts.getEmitScriptTarget = getEmitScriptTarget;\n    function getEmitModuleKind(compilerOptions) {\n        return typeof compilerOptions.module === \"number\" ?\n            compilerOptions.module :\n            getEmitScriptTarget(compilerOptions) >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS;\n    }\n    ts.getEmitModuleKind = getEmitModuleKind;\n    function getEmitModuleResolutionKind(compilerOptions) {\n        var moduleResolution = compilerOptions.moduleResolution;\n        if (moduleResolution === undefined) {\n            moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;\n        }\n        return moduleResolution;\n    }\n    ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;\n    function hasZeroOrOneAsteriskCharacter(str) {\n        var seenAsterisk = false;\n        for (var i = 0; i < str.length; i++) {\n            if (str.charCodeAt(i) === 42) {\n                if (!seenAsterisk) {\n                    seenAsterisk = true;\n                }\n                else {\n                    return false;\n                }\n            }\n        }\n        return true;\n    }\n    ts.hasZeroOrOneAsteriskCharacter = hasZeroOrOneAsteriskCharacter;\n    function isRootedDiskPath(path) {\n        return getRootLength(path) !== 0;\n    }\n    ts.isRootedDiskPath = isRootedDiskPath;\n    function convertToRelativePath(absoluteOrRelativePath, basePath, getCanonicalFileName) {\n        return !isRootedDiskPath(absoluteOrRelativePath)\n            ? absoluteOrRelativePath\n            : getRelativePathToDirectoryOrUrl(basePath, absoluteOrRelativePath, basePath, getCanonicalFileName, false);\n    }\n    ts.convertToRelativePath = convertToRelativePath;\n    function normalizedPathComponents(path, rootLength) {\n        var normalizedParts = getNormalizedParts(path, rootLength);\n        return [path.substr(0, rootLength)].concat(normalizedParts);\n    }\n    function getNormalizedPathComponents(path, currentDirectory) {\n        path = normalizeSlashes(path);\n        var rootLength = getRootLength(path);\n        if (rootLength === 0) {\n            path = combinePaths(normalizeSlashes(currentDirectory), path);\n            rootLength = getRootLength(path);\n        }\n        return normalizedPathComponents(path, rootLength);\n    }\n    ts.getNormalizedPathComponents = getNormalizedPathComponents;\n    function getNormalizedAbsolutePath(fileName, currentDirectory) {\n        return getNormalizedPathFromPathComponents(getNormalizedPathComponents(fileName, currentDirectory));\n    }\n    ts.getNormalizedAbsolutePath = getNormalizedAbsolutePath;\n    function getNormalizedPathFromPathComponents(pathComponents) {\n        if (pathComponents && pathComponents.length) {\n            return pathComponents[0] + pathComponents.slice(1).join(ts.directorySeparator);\n        }\n    }\n    ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents;\n    function getNormalizedPathComponentsOfUrl(url) {\n        var urlLength = url.length;\n        var rootLength = url.indexOf(\"://\") + \"://\".length;\n        while (rootLength < urlLength) {\n            if (url.charCodeAt(rootLength) === 47) {\n                rootLength++;\n            }\n            else {\n                break;\n            }\n        }\n        if (rootLength === urlLength) {\n            return [url];\n        }\n        var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength);\n        if (indexOfNextSlash !== -1) {\n            rootLength = indexOfNextSlash + 1;\n            return normalizedPathComponents(url, rootLength);\n        }\n        else {\n            return [url + ts.directorySeparator];\n        }\n    }\n    function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) {\n        if (isUrl(pathOrUrl)) {\n            return getNormalizedPathComponentsOfUrl(pathOrUrl);\n        }\n        else {\n            return getNormalizedPathComponents(pathOrUrl, currentDirectory);\n        }\n    }\n    function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) {\n        var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory);\n        var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory);\n        if (directoryComponents.length > 1 && lastOrUndefined(directoryComponents) === \"\") {\n            directoryComponents.length--;\n        }\n        var joinStartIndex;\n        for (joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) {\n            if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) {\n                break;\n            }\n        }\n        if (joinStartIndex) {\n            var relativePath = \"\";\n            var relativePathComponents = pathComponents.slice(joinStartIndex, pathComponents.length);\n            for (; joinStartIndex < directoryComponents.length; joinStartIndex++) {\n                if (directoryComponents[joinStartIndex] !== \"\") {\n                    relativePath = relativePath + \"..\" + ts.directorySeparator;\n                }\n            }\n            return relativePath + relativePathComponents.join(ts.directorySeparator);\n        }\n        var absolutePath = getNormalizedPathFromPathComponents(pathComponents);\n        if (isAbsolutePathAnUrl && isRootedDiskPath(absolutePath)) {\n            absolutePath = \"file:///\" + absolutePath;\n        }\n        return absolutePath;\n    }\n    ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl;\n    function getBaseFileName(path) {\n        if (path === undefined) {\n            return undefined;\n        }\n        var i = path.lastIndexOf(ts.directorySeparator);\n        return i < 0 ? path : path.substring(i + 1);\n    }\n    ts.getBaseFileName = getBaseFileName;\n    function combinePaths(path1, path2) {\n        if (!(path1 && path1.length))\n            return path2;\n        if (!(path2 && path2.length))\n            return path1;\n        if (getRootLength(path2) !== 0)\n            return path2;\n        if (path1.charAt(path1.length - 1) === ts.directorySeparator)\n            return path1 + path2;\n        return path1 + ts.directorySeparator + path2;\n    }\n    ts.combinePaths = combinePaths;\n    function removeTrailingDirectorySeparator(path) {\n        if (path.charAt(path.length - 1) === ts.directorySeparator) {\n            return path.substr(0, path.length - 1);\n        }\n        return path;\n    }\n    ts.removeTrailingDirectorySeparator = removeTrailingDirectorySeparator;\n    function ensureTrailingDirectorySeparator(path) {\n        if (path.charAt(path.length - 1) !== ts.directorySeparator) {\n            return path + ts.directorySeparator;\n        }\n        return path;\n    }\n    ts.ensureTrailingDirectorySeparator = ensureTrailingDirectorySeparator;\n    function comparePaths(a, b, currentDirectory, ignoreCase) {\n        if (a === b)\n            return 0;\n        if (a === undefined)\n            return -1;\n        if (b === undefined)\n            return 1;\n        a = removeTrailingDirectorySeparator(a);\n        b = removeTrailingDirectorySeparator(b);\n        var aComponents = getNormalizedPathComponents(a, currentDirectory);\n        var bComponents = getNormalizedPathComponents(b, currentDirectory);\n        var sharedLength = Math.min(aComponents.length, bComponents.length);\n        for (var i = 0; i < sharedLength; i++) {\n            var result = compareStrings(aComponents[i], bComponents[i], ignoreCase);\n            if (result !== 0) {\n                return result;\n            }\n        }\n        return compareValues(aComponents.length, bComponents.length);\n    }\n    ts.comparePaths = comparePaths;\n    function containsPath(parent, child, currentDirectory, ignoreCase) {\n        if (parent === undefined || child === undefined)\n            return false;\n        if (parent === child)\n            return true;\n        parent = removeTrailingDirectorySeparator(parent);\n        child = removeTrailingDirectorySeparator(child);\n        if (parent === child)\n            return true;\n        var parentComponents = getNormalizedPathComponents(parent, currentDirectory);\n        var childComponents = getNormalizedPathComponents(child, currentDirectory);\n        if (childComponents.length < parentComponents.length) {\n            return false;\n        }\n        for (var i = 0; i < parentComponents.length; i++) {\n            var result = compareStrings(parentComponents[i], childComponents[i], ignoreCase);\n            if (result !== 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n    ts.containsPath = containsPath;\n    function startsWith(str, prefix) {\n        return str.lastIndexOf(prefix, 0) === 0;\n    }\n    ts.startsWith = startsWith;\n    function endsWith(str, suffix) {\n        var expectedPos = str.length - suffix.length;\n        return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;\n    }\n    ts.endsWith = endsWith;\n    function hasExtension(fileName) {\n        return getBaseFileName(fileName).indexOf(\".\") >= 0;\n    }\n    ts.hasExtension = hasExtension;\n    function fileExtensionIs(path, extension) {\n        return path.length > extension.length && endsWith(path, extension);\n    }\n    ts.fileExtensionIs = fileExtensionIs;\n    function fileExtensionIsAny(path, extensions) {\n        for (var _i = 0, extensions_1 = extensions; _i < extensions_1.length; _i++) {\n            var extension = extensions_1[_i];\n            if (fileExtensionIs(path, extension)) {\n                return true;\n            }\n        }\n        return false;\n    }\n    ts.fileExtensionIsAny = fileExtensionIsAny;\n    var reservedCharacterPattern = /[^\\w\\s\\/]/g;\n    var wildcardCharCodes = [42, 63];\n    var singleAsteriskRegexFragmentFiles = \"([^./]|(\\\\.(?!min\\\\.js$))?)*\";\n    var singleAsteriskRegexFragmentOther = \"[^/]*\";\n    function getRegularExpressionForWildcard(specs, basePath, usage) {\n        if (specs === undefined || specs.length === 0) {\n            return undefined;\n        }\n        var replaceWildcardCharacter = usage === \"files\" ? replaceWildCardCharacterFiles : replaceWildCardCharacterOther;\n        var singleAsteriskRegexFragment = usage === \"files\" ? singleAsteriskRegexFragmentFiles : singleAsteriskRegexFragmentOther;\n        var doubleAsteriskRegexFragment = usage === \"exclude\" ? \"(/.+?)?\" : \"(/[^/.][^/]*)*?\";\n        var pattern = \"\";\n        var hasWrittenSubpattern = false;\n        for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {\n            var spec = specs_1[_i];\n            if (!spec) {\n                continue;\n            }\n            var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter);\n            if (subPattern === undefined) {\n                continue;\n            }\n            if (hasWrittenSubpattern) {\n                pattern += \"|\";\n            }\n            pattern += \"(\" + subPattern + \")\";\n            hasWrittenSubpattern = true;\n        }\n        if (!pattern) {\n            return undefined;\n        }\n        var terminator = usage === \"exclude\" ? \"($|/)\" : \"$\";\n        return \"^(\" + pattern + \")\" + terminator;\n    }\n    ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard;\n    function isImplicitGlob(lastPathComponent) {\n        return !/[.*?]/.test(lastPathComponent);\n    }\n    ts.isImplicitGlob = isImplicitGlob;\n    function getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter) {\n        var subpattern = \"\";\n        var hasRecursiveDirectoryWildcard = false;\n        var hasWrittenComponent = false;\n        var components = getNormalizedPathComponents(spec, basePath);\n        var lastComponent = lastOrUndefined(components);\n        if (usage !== \"exclude\" && lastComponent === \"**\") {\n            return undefined;\n        }\n        components[0] = removeTrailingDirectorySeparator(components[0]);\n        if (isImplicitGlob(lastComponent)) {\n            components.push(\"**\", \"*\");\n        }\n        var optionalCount = 0;\n        for (var _i = 0, components_1 = components; _i < components_1.length; _i++) {\n            var component = components_1[_i];\n            if (component === \"**\") {\n                if (hasRecursiveDirectoryWildcard) {\n                    return undefined;\n                }\n                subpattern += doubleAsteriskRegexFragment;\n                hasRecursiveDirectoryWildcard = true;\n            }\n            else {\n                if (usage === \"directories\") {\n                    subpattern += \"(\";\n                    optionalCount++;\n                }\n                if (hasWrittenComponent) {\n                    subpattern += ts.directorySeparator;\n                }\n                if (usage !== \"exclude\") {\n                    if (component.charCodeAt(0) === 42) {\n                        subpattern += \"([^./]\" + singleAsteriskRegexFragment + \")?\";\n                        component = component.substr(1);\n                    }\n                    else if (component.charCodeAt(0) === 63) {\n                        subpattern += \"[^./]\";\n                        component = component.substr(1);\n                    }\n                }\n                subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter);\n            }\n            hasWrittenComponent = true;\n        }\n        while (optionalCount > 0) {\n            subpattern += \")?\";\n            optionalCount--;\n        }\n        return subpattern;\n    }\n    function replaceWildCardCharacterFiles(match) {\n        return replaceWildcardCharacter(match, singleAsteriskRegexFragmentFiles);\n    }\n    function replaceWildCardCharacterOther(match) {\n        return replaceWildcardCharacter(match, singleAsteriskRegexFragmentOther);\n    }\n    function replaceWildcardCharacter(match, singleAsteriskRegexFragment) {\n        return match === \"*\" ? singleAsteriskRegexFragment : match === \"?\" ? \"[^/]\" : \"\\\\\" + match;\n    }\n    function getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory) {\n        path = normalizePath(path);\n        currentDirectory = normalizePath(currentDirectory);\n        var absolutePath = combinePaths(currentDirectory, path);\n        return {\n            includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, \"files\"),\n            includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, \"directories\"),\n            excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, \"exclude\"),\n            basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames)\n        };\n    }\n    ts.getFileMatcherPatterns = getFileMatcherPatterns;\n    function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, getFileSystemEntries) {\n        path = normalizePath(path);\n        currentDirectory = normalizePath(currentDirectory);\n        var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);\n        var regexFlag = useCaseSensitiveFileNames ? \"\" : \"i\";\n        var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag);\n        var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag);\n        var excludeRegex = patterns.excludePattern && new RegExp(patterns.excludePattern, regexFlag);\n        var result = [];\n        for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {\n            var basePath = _a[_i];\n            visitDirectory(basePath, combinePaths(currentDirectory, basePath));\n        }\n        return result;\n        function visitDirectory(path, absolutePath) {\n            var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;\n            for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {\n                var current = files_1[_i];\n                var name_1 = combinePaths(path, current);\n                var absoluteName = combinePaths(absolutePath, current);\n                if ((!extensions || fileExtensionIsAny(name_1, extensions)) &&\n                    (!includeFileRegex || includeFileRegex.test(absoluteName)) &&\n                    (!excludeRegex || !excludeRegex.test(absoluteName))) {\n                    result.push(name_1);\n                }\n            }\n            for (var _b = 0, directories_1 = directories; _b < directories_1.length; _b++) {\n                var current = directories_1[_b];\n                var name_2 = combinePaths(path, current);\n                var absoluteName = combinePaths(absolutePath, current);\n                if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&\n                    (!excludeRegex || !excludeRegex.test(absoluteName))) {\n                    visitDirectory(name_2, absoluteName);\n                }\n            }\n        }\n    }\n    ts.matchFiles = matchFiles;\n    function getBasePaths(path, includes, useCaseSensitiveFileNames) {\n        var basePaths = [path];\n        if (includes) {\n            var includeBasePaths = [];\n            for (var _i = 0, includes_1 = includes; _i < includes_1.length; _i++) {\n                var include = includes_1[_i];\n                var absolute = isRootedDiskPath(include) ? include : normalizePath(combinePaths(path, include));\n                includeBasePaths.push(getIncludeBasePath(absolute));\n            }\n            includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive);\n            var _loop_1 = function (includeBasePath) {\n                if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) {\n                    basePaths.push(includeBasePath);\n                }\n            };\n            for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) {\n                var includeBasePath = includeBasePaths_1[_a];\n                _loop_1(includeBasePath);\n            }\n        }\n        return basePaths;\n    }\n    function getIncludeBasePath(absolute) {\n        var wildcardOffset = indexOfAnyCharCode(absolute, wildcardCharCodes);\n        if (wildcardOffset < 0) {\n            return !hasExtension(absolute)\n                ? absolute\n                : removeTrailingDirectorySeparator(getDirectoryPath(absolute));\n        }\n        return absolute.substring(0, absolute.lastIndexOf(ts.directorySeparator, wildcardOffset));\n    }\n    function ensureScriptKind(fileName, scriptKind) {\n        return (scriptKind || getScriptKindFromFileName(fileName)) || 3;\n    }\n    ts.ensureScriptKind = ensureScriptKind;\n    function getScriptKindFromFileName(fileName) {\n        var ext = fileName.substr(fileName.lastIndexOf(\".\"));\n        switch (ext.toLowerCase()) {\n            case \".js\":\n                return 1;\n            case \".jsx\":\n                return 2;\n            case \".ts\":\n                return 3;\n            case \".tsx\":\n                return 4;\n            default:\n                return 0;\n        }\n    }\n    ts.getScriptKindFromFileName = getScriptKindFromFileName;\n    ts.supportedTypeScriptExtensions = [\".ts\", \".tsx\", \".d.ts\"];\n    ts.supportedTypescriptExtensionsForExtractExtension = [\".d.ts\", \".ts\", \".tsx\"];\n    ts.supportedJavascriptExtensions = [\".js\", \".jsx\"];\n    var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions);\n    function getSupportedExtensions(options) {\n        return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions;\n    }\n    ts.getSupportedExtensions = getSupportedExtensions;\n    function hasJavaScriptFileExtension(fileName) {\n        return forEach(ts.supportedJavascriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); });\n    }\n    ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension;\n    function hasTypeScriptFileExtension(fileName) {\n        return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); });\n    }\n    ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension;\n    function isSupportedSourceFileName(fileName, compilerOptions) {\n        if (!fileName) {\n            return false;\n        }\n        for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) {\n            var extension = _a[_i];\n            if (fileExtensionIs(fileName, extension)) {\n                return true;\n            }\n        }\n        return false;\n    }\n    ts.isSupportedSourceFileName = isSupportedSourceFileName;\n    function getExtensionPriority(path, supportedExtensions) {\n        for (var i = supportedExtensions.length - 1; i >= 0; i--) {\n            if (fileExtensionIs(path, supportedExtensions[i])) {\n                return adjustExtensionPriority(i);\n            }\n        }\n        return 0;\n    }\n    ts.getExtensionPriority = getExtensionPriority;\n    function adjustExtensionPriority(extensionPriority) {\n        if (extensionPriority < 2) {\n            return 0;\n        }\n        else if (extensionPriority < 5) {\n            return 2;\n        }\n        else {\n            return 5;\n        }\n    }\n    ts.adjustExtensionPriority = adjustExtensionPriority;\n    function getNextLowestExtensionPriority(extensionPriority) {\n        if (extensionPriority < 2) {\n            return 2;\n        }\n        else {\n            return 5;\n        }\n    }\n    ts.getNextLowestExtensionPriority = getNextLowestExtensionPriority;\n    var extensionsToRemove = [\".d.ts\", \".ts\", \".js\", \".tsx\", \".jsx\"];\n    function removeFileExtension(path) {\n        for (var _i = 0, extensionsToRemove_1 = extensionsToRemove; _i < extensionsToRemove_1.length; _i++) {\n            var ext = extensionsToRemove_1[_i];\n            var extensionless = tryRemoveExtension(path, ext);\n            if (extensionless !== undefined) {\n                return extensionless;\n            }\n        }\n        return path;\n    }\n    ts.removeFileExtension = removeFileExtension;\n    function tryRemoveExtension(path, extension) {\n        return fileExtensionIs(path, extension) ? removeExtension(path, extension) : undefined;\n    }\n    ts.tryRemoveExtension = tryRemoveExtension;\n    function removeExtension(path, extension) {\n        return path.substring(0, path.length - extension.length);\n    }\n    ts.removeExtension = removeExtension;\n    function changeExtension(path, newExtension) {\n        return (removeFileExtension(path) + newExtension);\n    }\n    ts.changeExtension = changeExtension;\n    function Symbol(flags, name) {\n        this.flags = flags;\n        this.name = name;\n        this.declarations = undefined;\n    }\n    function Type(_checker, flags) {\n        this.flags = flags;\n    }\n    function Signature() {\n    }\n    function Node(kind, pos, end) {\n        this.id = 0;\n        this.kind = kind;\n        this.pos = pos;\n        this.end = end;\n        this.flags = 0;\n        this.modifierFlagsCache = 0;\n        this.transformFlags = 0;\n        this.parent = undefined;\n        this.original = undefined;\n    }\n    ts.objectAllocator = {\n        getNodeConstructor: function () { return Node; },\n        getTokenConstructor: function () { return Node; },\n        getIdentifierConstructor: function () { return Node; },\n        getSourceFileConstructor: function () { return Node; },\n        getSymbolConstructor: function () { return Symbol; },\n        getTypeConstructor: function () { return Type; },\n        getSignatureConstructor: function () { return Signature; }\n    };\n    var Debug;\n    (function (Debug) {\n        Debug.currentAssertionLevel = 0;\n        function shouldAssert(level) {\n            return Debug.currentAssertionLevel >= level;\n        }\n        Debug.shouldAssert = shouldAssert;\n        function assert(expression, message, verboseDebugInfo) {\n            if (!expression) {\n                var verboseDebugString = \"\";\n                if (verboseDebugInfo) {\n                    verboseDebugString = \"\\r\\nVerbose Debug Information: \" + verboseDebugInfo();\n                }\n                debugger;\n                throw new Error(\"Debug Failure. False expression: \" + (message || \"\") + verboseDebugString);\n            }\n        }\n        Debug.assert = assert;\n        function fail(message) {\n            Debug.assert(false, message);\n        }\n        Debug.fail = fail;\n    })(Debug = ts.Debug || (ts.Debug = {}));\n    function orderedRemoveItem(array, item) {\n        for (var i = 0; i < array.length; i++) {\n            if (array[i] === item) {\n                orderedRemoveItemAt(array, i);\n                return true;\n            }\n        }\n        return false;\n    }\n    ts.orderedRemoveItem = orderedRemoveItem;\n    function orderedRemoveItemAt(array, index) {\n        for (var i = index; i < array.length - 1; i++) {\n            array[i] = array[i + 1];\n        }\n        array.pop();\n    }\n    ts.orderedRemoveItemAt = orderedRemoveItemAt;\n    function unorderedRemoveItemAt(array, index) {\n        array[index] = array[array.length - 1];\n        array.pop();\n    }\n    ts.unorderedRemoveItemAt = unorderedRemoveItemAt;\n    function unorderedRemoveItem(array, item) {\n        unorderedRemoveFirstItemWhere(array, function (element) { return element === item; });\n    }\n    ts.unorderedRemoveItem = unorderedRemoveItem;\n    function unorderedRemoveFirstItemWhere(array, predicate) {\n        for (var i = 0; i < array.length; i++) {\n            if (predicate(array[i])) {\n                unorderedRemoveItemAt(array, i);\n                break;\n            }\n        }\n    }\n    function createGetCanonicalFileName(useCaseSensitiveFileNames) {\n        return useCaseSensitiveFileNames\n            ? (function (fileName) { return fileName; })\n            : (function (fileName) { return fileName.toLowerCase(); });\n    }\n    ts.createGetCanonicalFileName = createGetCanonicalFileName;\n    function matchPatternOrExact(patternStrings, candidate) {\n        var patterns = [];\n        for (var _i = 0, patternStrings_1 = patternStrings; _i < patternStrings_1.length; _i++) {\n            var patternString = patternStrings_1[_i];\n            var pattern = tryParsePattern(patternString);\n            if (pattern) {\n                patterns.push(pattern);\n            }\n            else if (patternString === candidate) {\n                return patternString;\n            }\n        }\n        return findBestPatternMatch(patterns, function (_) { return _; }, candidate);\n    }\n    ts.matchPatternOrExact = matchPatternOrExact;\n    function patternText(_a) {\n        var prefix = _a.prefix, suffix = _a.suffix;\n        return prefix + \"*\" + suffix;\n    }\n    ts.patternText = patternText;\n    function matchedText(pattern, candidate) {\n        Debug.assert(isPatternMatch(pattern, candidate));\n        return candidate.substr(pattern.prefix.length, candidate.length - pattern.suffix.length);\n    }\n    ts.matchedText = matchedText;\n    function findBestPatternMatch(values, getPattern, candidate) {\n        var matchedValue = undefined;\n        var longestMatchPrefixLength = -1;\n        for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {\n            var v = values_1[_i];\n            var pattern = getPattern(v);\n            if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) {\n                longestMatchPrefixLength = pattern.prefix.length;\n                matchedValue = v;\n            }\n        }\n        return matchedValue;\n    }\n    ts.findBestPatternMatch = findBestPatternMatch;\n    function isPatternMatch(_a, candidate) {\n        var prefix = _a.prefix, suffix = _a.suffix;\n        return candidate.length >= prefix.length + suffix.length &&\n            startsWith(candidate, prefix) &&\n            endsWith(candidate, suffix);\n    }\n    function tryParsePattern(pattern) {\n        Debug.assert(hasZeroOrOneAsteriskCharacter(pattern));\n        var indexOfStar = pattern.indexOf(\"*\");\n        return indexOfStar === -1 ? undefined : {\n            prefix: pattern.substr(0, indexOfStar),\n            suffix: pattern.substr(indexOfStar + 1)\n        };\n    }\n    ts.tryParsePattern = tryParsePattern;\n    function positionIsSynthesized(pos) {\n        return !(pos >= 0);\n    }\n    ts.positionIsSynthesized = positionIsSynthesized;\n    function extensionIsTypeScript(ext) {\n        return ext <= ts.Extension.LastTypeScriptExtension;\n    }\n    ts.extensionIsTypeScript = extensionIsTypeScript;\n    function extensionFromPath(path) {\n        var ext = tryGetExtensionFromPath(path);\n        if (ext !== undefined) {\n            return ext;\n        }\n        Debug.fail(\"File \" + path + \" has unknown extension.\");\n    }\n    ts.extensionFromPath = extensionFromPath;\n    function tryGetExtensionFromPath(path) {\n        if (fileExtensionIs(path, \".d.ts\")) {\n            return ts.Extension.Dts;\n        }\n        if (fileExtensionIs(path, \".ts\")) {\n            return ts.Extension.Ts;\n        }\n        if (fileExtensionIs(path, \".tsx\")) {\n            return ts.Extension.Tsx;\n        }\n        if (fileExtensionIs(path, \".js\")) {\n            return ts.Extension.Js;\n        }\n        if (fileExtensionIs(path, \".jsx\")) {\n            return ts.Extension.Jsx;\n        }\n    }\n    ts.tryGetExtensionFromPath = tryGetExtensionFromPath;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    ts.sys = (function () {\n        function getWScriptSystem() {\n            var fso = new ActiveXObject(\"Scripting.FileSystemObject\");\n            var shell = new ActiveXObject(\"WScript.Shell\");\n            var fileStream = new ActiveXObject(\"ADODB.Stream\");\n            fileStream.Type = 2;\n            var binaryStream = new ActiveXObject(\"ADODB.Stream\");\n            binaryStream.Type = 1;\n            var args = [];\n            for (var i = 0; i < WScript.Arguments.length; i++) {\n                args[i] = WScript.Arguments.Item(i);\n            }\n            function readFile(fileName, encoding) {\n                if (!fso.FileExists(fileName)) {\n                    return undefined;\n                }\n                fileStream.Open();\n                try {\n                    if (encoding) {\n                        fileStream.Charset = encoding;\n                        fileStream.LoadFromFile(fileName);\n                    }\n                    else {\n                        fileStream.Charset = \"x-ansi\";\n                        fileStream.LoadFromFile(fileName);\n                        var bom = fileStream.ReadText(2) || \"\";\n                        fileStream.Position = 0;\n                        fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? \"unicode\" : \"utf-8\";\n                    }\n                    return fileStream.ReadText();\n                }\n                catch (e) {\n                    throw e;\n                }\n                finally {\n                    fileStream.Close();\n                }\n            }\n            function writeFile(fileName, data, writeByteOrderMark) {\n                fileStream.Open();\n                binaryStream.Open();\n                try {\n                    fileStream.Charset = \"utf-8\";\n                    fileStream.WriteText(data);\n                    if (writeByteOrderMark) {\n                        fileStream.Position = 0;\n                    }\n                    else {\n                        fileStream.Position = 3;\n                    }\n                    fileStream.CopyTo(binaryStream);\n                    binaryStream.SaveToFile(fileName, 2);\n                }\n                finally {\n                    binaryStream.Close();\n                    fileStream.Close();\n                }\n            }\n            function getNames(collection) {\n                var result = [];\n                for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) {\n                    result.push(e.item().Name);\n                }\n                return result.sort();\n            }\n            function getDirectories(path) {\n                var folder = fso.GetFolder(path);\n                return getNames(folder.subfolders);\n            }\n            function getAccessibleFileSystemEntries(path) {\n                try {\n                    var folder = fso.GetFolder(path || \".\");\n                    var files = getNames(folder.files);\n                    var directories = getNames(folder.subfolders);\n                    return { files: files, directories: directories };\n                }\n                catch (e) {\n                    return { files: [], directories: [] };\n                }\n            }\n            function readDirectory(path, extensions, excludes, includes) {\n                return ts.matchFiles(path, extensions, excludes, includes, false, shell.CurrentDirectory, getAccessibleFileSystemEntries);\n            }\n            var wscriptSystem = {\n                args: args,\n                newLine: \"\\r\\n\",\n                useCaseSensitiveFileNames: false,\n                write: function (s) {\n                    WScript.StdOut.Write(s);\n                },\n                readFile: readFile,\n                writeFile: writeFile,\n                resolvePath: function (path) {\n                    return fso.GetAbsolutePathName(path);\n                },\n                fileExists: function (path) {\n                    return fso.FileExists(path);\n                },\n                directoryExists: function (path) {\n                    return fso.FolderExists(path);\n                },\n                createDirectory: function (directoryName) {\n                    if (!wscriptSystem.directoryExists(directoryName)) {\n                        fso.CreateFolder(directoryName);\n                    }\n                },\n                getExecutingFilePath: function () {\n                    return WScript.ScriptFullName;\n                },\n                getCurrentDirectory: function () {\n                    return shell.CurrentDirectory;\n                },\n                getDirectories: getDirectories,\n                getEnvironmentVariable: function (name) {\n                    return new ActiveXObject(\"WScript.Shell\").ExpandEnvironmentStrings(\"%\" + name + \"%\");\n                },\n                readDirectory: readDirectory,\n                exit: function (exitCode) {\n                    try {\n                        WScript.Quit(exitCode);\n                    }\n                    catch (e) {\n                    }\n                }\n            };\n            return wscriptSystem;\n        }\n        function getNodeSystem() {\n            var _fs = require(\"fs\");\n            var _path = require(\"path\");\n            var _os = require(\"os\");\n            var _crypto = require(\"crypto\");\n            var useNonPollingWatchers = process.env[\"TSC_NONPOLLING_WATCHER\"];\n            function createWatchedFileSet() {\n                var dirWatchers = ts.createMap();\n                var fileWatcherCallbacks = ts.createMap();\n                return { addFile: addFile, removeFile: removeFile };\n                function reduceDirWatcherRefCountForFile(fileName) {\n                    var dirName = ts.getDirectoryPath(fileName);\n                    var watcher = dirWatchers[dirName];\n                    if (watcher) {\n                        watcher.referenceCount -= 1;\n                        if (watcher.referenceCount <= 0) {\n                            watcher.close();\n                            delete dirWatchers[dirName];\n                        }\n                    }\n                }\n                function addDirWatcher(dirPath) {\n                    var watcher = dirWatchers[dirPath];\n                    if (watcher) {\n                        watcher.referenceCount += 1;\n                        return;\n                    }\n                    watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); });\n                    watcher.referenceCount = 1;\n                    dirWatchers[dirPath] = watcher;\n                    return;\n                }\n                function addFileWatcherCallback(filePath, callback) {\n                    ts.multiMapAdd(fileWatcherCallbacks, filePath, callback);\n                }\n                function addFile(fileName, callback) {\n                    addFileWatcherCallback(fileName, callback);\n                    addDirWatcher(ts.getDirectoryPath(fileName));\n                    return { fileName: fileName, callback: callback };\n                }\n                function removeFile(watchedFile) {\n                    removeFileWatcherCallback(watchedFile.fileName, watchedFile.callback);\n                    reduceDirWatcherRefCountForFile(watchedFile.fileName);\n                }\n                function removeFileWatcherCallback(filePath, callback) {\n                    ts.multiMapRemove(fileWatcherCallbacks, filePath, callback);\n                }\n                function fileEventHandler(eventName, relativeFileName, baseDirPath) {\n                    var fileName = typeof relativeFileName !== \"string\"\n                        ? undefined\n                        : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath);\n                    if ((eventName === \"change\" || eventName === \"rename\") && fileWatcherCallbacks[fileName]) {\n                        for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) {\n                            var fileCallback = _a[_i];\n                            fileCallback(fileName);\n                        }\n                    }\n                }\n            }\n            var watchedFileSet = createWatchedFileSet();\n            function isNode4OrLater() {\n                return parseInt(process.version.charAt(1)) >= 4;\n            }\n            function isFileSystemCaseSensitive() {\n                if (platform === \"win32\" || platform === \"win64\") {\n                    return false;\n                }\n                return !fileExists(__filename.toUpperCase()) || !fileExists(__filename.toLowerCase());\n            }\n            var platform = _os.platform();\n            var useCaseSensitiveFileNames = isFileSystemCaseSensitive();\n            function readFile(fileName, _encoding) {\n                if (!fileExists(fileName)) {\n                    return undefined;\n                }\n                var buffer = _fs.readFileSync(fileName);\n                var len = buffer.length;\n                if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) {\n                    len &= ~1;\n                    for (var i = 0; i < len; i += 2) {\n                        var temp = buffer[i];\n                        buffer[i] = buffer[i + 1];\n                        buffer[i + 1] = temp;\n                    }\n                    return buffer.toString(\"utf16le\", 2);\n                }\n                if (len >= 2 && buffer[0] === 0xFF && buffer[1] === 0xFE) {\n                    return buffer.toString(\"utf16le\", 2);\n                }\n                if (len >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) {\n                    return buffer.toString(\"utf8\", 3);\n                }\n                return buffer.toString(\"utf8\");\n            }\n            function writeFile(fileName, data, writeByteOrderMark) {\n                if (writeByteOrderMark) {\n                    data = \"\\uFEFF\" + data;\n                }\n                var fd;\n                try {\n                    fd = _fs.openSync(fileName, \"w\");\n                    _fs.writeSync(fd, data, undefined, \"utf8\");\n                }\n                finally {\n                    if (fd !== undefined) {\n                        _fs.closeSync(fd);\n                    }\n                }\n            }\n            function getAccessibleFileSystemEntries(path) {\n                try {\n                    var entries = _fs.readdirSync(path || \".\").sort();\n                    var files = [];\n                    var directories = [];\n                    for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n                        var entry = entries_1[_i];\n                        if (entry === \".\" || entry === \"..\") {\n                            continue;\n                        }\n                        var name_3 = ts.combinePaths(path, entry);\n                        var stat = void 0;\n                        try {\n                            stat = _fs.statSync(name_3);\n                        }\n                        catch (e) {\n                            continue;\n                        }\n                        if (stat.isFile()) {\n                            files.push(entry);\n                        }\n                        else if (stat.isDirectory()) {\n                            directories.push(entry);\n                        }\n                    }\n                    return { files: files, directories: directories };\n                }\n                catch (e) {\n                    return { files: [], directories: [] };\n                }\n            }\n            function readDirectory(path, extensions, excludes, includes) {\n                return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), getAccessibleFileSystemEntries);\n            }\n            function fileSystemEntryExists(path, entryKind) {\n                try {\n                    var stat = _fs.statSync(path);\n                    switch (entryKind) {\n                        case 0: return stat.isFile();\n                        case 1: return stat.isDirectory();\n                    }\n                }\n                catch (e) {\n                    return false;\n                }\n            }\n            function fileExists(path) {\n                return fileSystemEntryExists(path, 0);\n            }\n            function directoryExists(path) {\n                return fileSystemEntryExists(path, 1);\n            }\n            function getDirectories(path) {\n                return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1); });\n            }\n            var noOpFileWatcher = { close: ts.noop };\n            var nodeSystem = {\n                args: process.argv.slice(2),\n                newLine: _os.EOL,\n                useCaseSensitiveFileNames: useCaseSensitiveFileNames,\n                write: function (s) {\n                    process.stdout.write(s);\n                },\n                readFile: readFile,\n                writeFile: writeFile,\n                watchFile: function (fileName, callback, pollingInterval) {\n                    if (useNonPollingWatchers) {\n                        var watchedFile_1 = watchedFileSet.addFile(fileName, callback);\n                        return {\n                            close: function () { return watchedFileSet.removeFile(watchedFile_1); }\n                        };\n                    }\n                    else {\n                        _fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);\n                        return {\n                            close: function () { return _fs.unwatchFile(fileName, fileChanged); }\n                        };\n                    }\n                    function fileChanged(curr, prev) {\n                        if (+curr.mtime <= +prev.mtime) {\n                            return;\n                        }\n                        callback(fileName);\n                    }\n                },\n                watchDirectory: function (directoryName, callback, recursive) {\n                    var options;\n                    if (!directoryExists(directoryName)) {\n                        return noOpFileWatcher;\n                    }\n                    if (isNode4OrLater() && (process.platform === \"win32\" || process.platform === \"darwin\")) {\n                        options = { persistent: true, recursive: !!recursive };\n                    }\n                    else {\n                        options = { persistent: true };\n                    }\n                    return _fs.watch(directoryName, options, function (eventName, relativeFileName) {\n                        if (eventName === \"rename\") {\n                            callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName)));\n                        }\n                        ;\n                    });\n                },\n                resolvePath: function (path) {\n                    return _path.resolve(path);\n                },\n                fileExists: fileExists,\n                directoryExists: directoryExists,\n                createDirectory: function (directoryName) {\n                    if (!nodeSystem.directoryExists(directoryName)) {\n                        _fs.mkdirSync(directoryName);\n                    }\n                },\n                getExecutingFilePath: function () {\n                    return __filename;\n                },\n                getCurrentDirectory: function () {\n                    return process.cwd();\n                },\n                getDirectories: getDirectories,\n                getEnvironmentVariable: function (name) {\n                    return process.env[name] || \"\";\n                },\n                readDirectory: readDirectory,\n                getModifiedTime: function (path) {\n                    try {\n                        return _fs.statSync(path).mtime;\n                    }\n                    catch (e) {\n                        return undefined;\n                    }\n                },\n                createHash: function (data) {\n                    var hash = _crypto.createHash(\"md5\");\n                    hash.update(data);\n                    return hash.digest(\"hex\");\n                },\n                getMemoryUsage: function () {\n                    if (global.gc) {\n                        global.gc();\n                    }\n                    return process.memoryUsage().heapUsed;\n                },\n                getFileSize: function (path) {\n                    try {\n                        var stat = _fs.statSync(path);\n                        if (stat.isFile()) {\n                            return stat.size;\n                        }\n                    }\n                    catch (e) { }\n                    return 0;\n                },\n                exit: function (exitCode) {\n                    process.exit(exitCode);\n                },\n                realpath: function (path) {\n                    return _fs.realpathSync(path);\n                },\n                tryEnableSourceMapsForHost: function () {\n                    try {\n                        require(\"source-map-support\").install();\n                    }\n                    catch (e) {\n                    }\n                },\n                setTimeout: setTimeout,\n                clearTimeout: clearTimeout\n            };\n            return nodeSystem;\n        }\n        function getChakraSystem() {\n            var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });\n            return {\n                newLine: ChakraHost.newLine || \"\\r\\n\",\n                args: ChakraHost.args,\n                useCaseSensitiveFileNames: !!ChakraHost.useCaseSensitiveFileNames,\n                write: ChakraHost.echo,\n                readFile: function (path, _encoding) {\n                    return ChakraHost.readFile(path);\n                },\n                writeFile: function (path, data, writeByteOrderMark) {\n                    if (writeByteOrderMark) {\n                        data = \"\\uFEFF\" + data;\n                    }\n                    ChakraHost.writeFile(path, data);\n                },\n                resolvePath: ChakraHost.resolvePath,\n                fileExists: ChakraHost.fileExists,\n                directoryExists: ChakraHost.directoryExists,\n                createDirectory: ChakraHost.createDirectory,\n                getExecutingFilePath: function () { return ChakraHost.executingFile; },\n                getCurrentDirectory: function () { return ChakraHost.currentDirectory; },\n                getDirectories: ChakraHost.getDirectories,\n                getEnvironmentVariable: ChakraHost.getEnvironmentVariable || (function () { return \"\"; }),\n                readDirectory: function (path, extensions, excludes, includes) {\n                    var pattern = ts.getFileMatcherPatterns(path, excludes, includes, !!ChakraHost.useCaseSensitiveFileNames, ChakraHost.currentDirectory);\n                    return ChakraHost.readDirectory(path, extensions, pattern.basePaths, pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern);\n                },\n                exit: ChakraHost.quit,\n                realpath: realpath\n            };\n        }\n        function recursiveCreateDirectory(directoryPath, sys) {\n            var basePath = ts.getDirectoryPath(directoryPath);\n            var shouldCreateParent = directoryPath !== basePath && !sys.directoryExists(basePath);\n            if (shouldCreateParent) {\n                recursiveCreateDirectory(basePath, sys);\n            }\n            if (shouldCreateParent || !sys.directoryExists(directoryPath)) {\n                sys.createDirectory(directoryPath);\n            }\n        }\n        var sys;\n        if (typeof ChakraHost !== \"undefined\") {\n            sys = getChakraSystem();\n        }\n        else if (typeof WScript !== \"undefined\" && typeof ActiveXObject === \"function\") {\n            sys = getWScriptSystem();\n        }\n        else if (typeof process !== \"undefined\" && process.nextTick && !process.browser && typeof require !== \"undefined\") {\n            sys = getNodeSystem();\n        }\n        if (sys) {\n            var originalWriteFile_1 = sys.writeFile;\n            sys.writeFile = function (path, data, writeBom) {\n                var directoryPath = ts.getDirectoryPath(ts.normalizeSlashes(path));\n                if (directoryPath && !sys.directoryExists(directoryPath)) {\n                    recursiveCreateDirectory(directoryPath, sys);\n                }\n                originalWriteFile_1.call(sys, path, data, writeBom);\n            };\n        }\n        return sys;\n    })();\n    if (ts.sys && ts.sys.getEnvironmentVariable) {\n        ts.Debug.currentAssertionLevel = /^development$/i.test(ts.sys.getEnvironmentVariable(\"NODE_ENV\"))\n            ? 1\n            : 0;\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    ts.Diagnostics = {\n        Unterminated_string_literal: { code: 1002, category: ts.DiagnosticCategory.Error, key: \"Unterminated_string_literal_1002\", message: \"Unterminated string literal.\" },\n        Identifier_expected: { code: 1003, category: ts.DiagnosticCategory.Error, key: \"Identifier_expected_1003\", message: \"Identifier expected.\" },\n        _0_expected: { code: 1005, category: ts.DiagnosticCategory.Error, key: \"_0_expected_1005\", message: \"'{0}' expected.\" },\n        A_file_cannot_have_a_reference_to_itself: { code: 1006, category: ts.DiagnosticCategory.Error, key: \"A_file_cannot_have_a_reference_to_itself_1006\", message: \"A file cannot have a reference to itself.\" },\n        Trailing_comma_not_allowed: { code: 1009, category: ts.DiagnosticCategory.Error, key: \"Trailing_comma_not_allowed_1009\", message: \"Trailing comma not allowed.\" },\n        Asterisk_Slash_expected: { code: 1010, category: ts.DiagnosticCategory.Error, key: \"Asterisk_Slash_expected_1010\", message: \"'*/' expected.\" },\n        Unexpected_token: { code: 1012, category: ts.DiagnosticCategory.Error, key: \"Unexpected_token_1012\", message: \"Unexpected token.\" },\n        A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: ts.DiagnosticCategory.Error, key: \"A_rest_parameter_must_be_last_in_a_parameter_list_1014\", message: \"A rest parameter must be last in a parameter list.\" },\n        Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: ts.DiagnosticCategory.Error, key: \"Parameter_cannot_have_question_mark_and_initializer_1015\", message: \"Parameter cannot have question mark and initializer.\" },\n        A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: ts.DiagnosticCategory.Error, key: \"A_required_parameter_cannot_follow_an_optional_parameter_1016\", message: \"A required parameter cannot follow an optional parameter.\" },\n        An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_cannot_have_a_rest_parameter_1017\", message: \"An index signature cannot have a rest parameter.\" },\n        An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_parameter_cannot_have_an_accessibility_modifier_1018\", message: \"An index signature parameter cannot have an accessibility modifier.\" },\n        An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_parameter_cannot_have_a_question_mark_1019\", message: \"An index signature parameter cannot have a question mark.\" },\n        An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_parameter_cannot_have_an_initializer_1020\", message: \"An index signature parameter cannot have an initializer.\" },\n        An_index_signature_must_have_a_type_annotation: { code: 1021, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_must_have_a_type_annotation_1021\", message: \"An index signature must have a type annotation.\" },\n        An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_parameter_must_have_a_type_annotation_1022\", message: \"An index signature parameter must have a type annotation.\" },\n        An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_parameter_type_must_be_string_or_number_1023\", message: \"An index signature parameter type must be 'string' or 'number'.\" },\n        readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature: { code: 1024, category: ts.DiagnosticCategory.Error, key: \"readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature_1024\", message: \"'readonly' modifier can only appear on a property declaration or index signature.\" },\n        Accessibility_modifier_already_seen: { code: 1028, category: ts.DiagnosticCategory.Error, key: \"Accessibility_modifier_already_seen_1028\", message: \"Accessibility modifier already seen.\" },\n        _0_modifier_must_precede_1_modifier: { code: 1029, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_must_precede_1_modifier_1029\", message: \"'{0}' modifier must precede '{1}' modifier.\" },\n        _0_modifier_already_seen: { code: 1030, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_already_seen_1030\", message: \"'{0}' modifier already seen.\" },\n        _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_class_element_1031\", message: \"'{0}' modifier cannot appear on a class element.\" },\n        super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: ts.DiagnosticCategory.Error, key: \"super_must_be_followed_by_an_argument_list_or_member_access_1034\", message: \"'super' must be followed by an argument list or member access.\" },\n        Only_ambient_modules_can_use_quoted_names: { code: 1035, category: ts.DiagnosticCategory.Error, key: \"Only_ambient_modules_can_use_quoted_names_1035\", message: \"Only ambient modules can use quoted names.\" },\n        Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: ts.DiagnosticCategory.Error, key: \"Statements_are_not_allowed_in_ambient_contexts_1036\", message: \"Statements are not allowed in ambient contexts.\" },\n        A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: ts.DiagnosticCategory.Error, key: \"A_declare_modifier_cannot_be_used_in_an_already_ambient_context_1038\", message: \"A 'declare' modifier cannot be used in an already ambient context.\" },\n        Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: ts.DiagnosticCategory.Error, key: \"Initializers_are_not_allowed_in_ambient_contexts_1039\", message: \"Initializers are not allowed in ambient contexts.\" },\n        _0_modifier_cannot_be_used_in_an_ambient_context: { code: 1040, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_be_used_in_an_ambient_context_1040\", message: \"'{0}' modifier cannot be used in an ambient context.\" },\n        _0_modifier_cannot_be_used_with_a_class_declaration: { code: 1041, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_be_used_with_a_class_declaration_1041\", message: \"'{0}' modifier cannot be used with a class declaration.\" },\n        _0_modifier_cannot_be_used_here: { code: 1042, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_be_used_here_1042\", message: \"'{0}' modifier cannot be used here.\" },\n        _0_modifier_cannot_appear_on_a_data_property: { code: 1043, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_data_property_1043\", message: \"'{0}' modifier cannot appear on a data property.\" },\n        _0_modifier_cannot_appear_on_a_module_or_namespace_element: { code: 1044, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044\", message: \"'{0}' modifier cannot appear on a module or namespace element.\" },\n        A_0_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: ts.DiagnosticCategory.Error, key: \"A_0_modifier_cannot_be_used_with_an_interface_declaration_1045\", message: \"A '{0}' modifier cannot be used with an interface declaration.\" },\n        A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: ts.DiagnosticCategory.Error, key: \"A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046\", message: \"A 'declare' modifier is required for a top level declaration in a .d.ts file.\" },\n        A_rest_parameter_cannot_be_optional: { code: 1047, category: ts.DiagnosticCategory.Error, key: \"A_rest_parameter_cannot_be_optional_1047\", message: \"A rest parameter cannot be optional.\" },\n        A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: ts.DiagnosticCategory.Error, key: \"A_rest_parameter_cannot_have_an_initializer_1048\", message: \"A rest parameter cannot have an initializer.\" },\n        A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: ts.DiagnosticCategory.Error, key: \"A_set_accessor_must_have_exactly_one_parameter_1049\", message: \"A 'set' accessor must have exactly one parameter.\" },\n        A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: ts.DiagnosticCategory.Error, key: \"A_set_accessor_cannot_have_an_optional_parameter_1051\", message: \"A 'set' accessor cannot have an optional parameter.\" },\n        A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: ts.DiagnosticCategory.Error, key: \"A_set_accessor_parameter_cannot_have_an_initializer_1052\", message: \"A 'set' accessor parameter cannot have an initializer.\" },\n        A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: ts.DiagnosticCategory.Error, key: \"A_set_accessor_cannot_have_rest_parameter_1053\", message: \"A 'set' accessor cannot have rest parameter.\" },\n        A_get_accessor_cannot_have_parameters: { code: 1054, category: ts.DiagnosticCategory.Error, key: \"A_get_accessor_cannot_have_parameters_1054\", message: \"A 'get' accessor cannot have parameters.\" },\n        Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: { code: 1055, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055\", message: \"Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.\" },\n        Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: \"Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056\", message: \"Accessors are only available when targeting ECMAScript 5 and higher.\" },\n        An_async_function_or_method_must_have_a_valid_awaitable_return_type: { code: 1057, category: ts.DiagnosticCategory.Error, key: \"An_async_function_or_method_must_have_a_valid_awaitable_return_type_1057\", message: \"An async function or method must have a valid awaitable return type.\" },\n        Operand_for_await_does_not_have_a_valid_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: \"Operand_for_await_does_not_have_a_valid_callable_then_member_1058\", message: \"Operand for 'await' does not have a valid callable 'then' member.\" },\n        Return_expression_in_async_function_does_not_have_a_valid_callable_then_member: { code: 1059, category: ts.DiagnosticCategory.Error, key: \"Return_expression_in_async_function_does_not_have_a_valid_callable_then_member_1059\", message: \"Return expression in async function does not have a valid callable 'then' member.\" },\n        Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member: { code: 1060, category: ts.DiagnosticCategory.Error, key: \"Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member_1060\", message: \"Expression body for async arrow function does not have a valid callable 'then' member.\" },\n        Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: \"Enum_member_must_have_initializer_1061\", message: \"Enum member must have initializer.\" },\n        _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: \"_0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062\", message: \"{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method.\" },\n        An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: \"An_export_assignment_cannot_be_used_in_a_namespace_1063\", message: \"An export assignment cannot be used in a namespace.\" },\n        The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { code: 1064, category: ts.DiagnosticCategory.Error, key: \"The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064\", message: \"The return type of an async function or method must be the global Promise<T> type.\" },\n        In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: \"In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066\", message: \"In ambient enum declarations member initializer must be constant expression.\" },\n        Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: \"Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068\", message: \"Unexpected token. A constructor, method, accessor, or property was expected.\" },\n        _0_modifier_cannot_appear_on_a_type_member: { code: 1070, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_type_member_1070\", message: \"'{0}' modifier cannot appear on a type member.\" },\n        _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_an_index_signature_1071\", message: \"'{0}' modifier cannot appear on an index signature.\" },\n        A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: \"A_0_modifier_cannot_be_used_with_an_import_declaration_1079\", message: \"A '{0}' modifier cannot be used with an import declaration.\" },\n        Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: \"Invalid_reference_directive_syntax_1084\", message: \"Invalid 'reference' directive syntax.\" },\n        Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: \"Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085\", message: \"Octal literals are not available when targeting ECMAScript 5 and higher.\" },\n        An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: \"An_accessor_cannot_be_declared_in_an_ambient_context_1086\", message: \"An accessor cannot be declared in an ambient context.\" },\n        _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_constructor_declaration_1089\", message: \"'{0}' modifier cannot appear on a constructor declaration.\" },\n        _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_parameter_1090\", message: \"'{0}' modifier cannot appear on a parameter.\" },\n        Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: ts.DiagnosticCategory.Error, key: \"Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091\", message: \"Only a single variable declaration is allowed in a 'for...in' statement.\" },\n        Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: ts.DiagnosticCategory.Error, key: \"Type_parameters_cannot_appear_on_a_constructor_declaration_1092\", message: \"Type parameters cannot appear on a constructor declaration.\" },\n        Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: ts.DiagnosticCategory.Error, key: \"Type_annotation_cannot_appear_on_a_constructor_declaration_1093\", message: \"Type annotation cannot appear on a constructor declaration.\" },\n        An_accessor_cannot_have_type_parameters: { code: 1094, category: ts.DiagnosticCategory.Error, key: \"An_accessor_cannot_have_type_parameters_1094\", message: \"An accessor cannot have type parameters.\" },\n        A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: ts.DiagnosticCategory.Error, key: \"A_set_accessor_cannot_have_a_return_type_annotation_1095\", message: \"A 'set' accessor cannot have a return type annotation.\" },\n        An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_must_have_exactly_one_parameter_1096\", message: \"An index signature must have exactly one parameter.\" },\n        _0_list_cannot_be_empty: { code: 1097, category: ts.DiagnosticCategory.Error, key: \"_0_list_cannot_be_empty_1097\", message: \"'{0}' list cannot be empty.\" },\n        Type_parameter_list_cannot_be_empty: { code: 1098, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_list_cannot_be_empty_1098\", message: \"Type parameter list cannot be empty.\" },\n        Type_argument_list_cannot_be_empty: { code: 1099, category: ts.DiagnosticCategory.Error, key: \"Type_argument_list_cannot_be_empty_1099\", message: \"Type argument list cannot be empty.\" },\n        Invalid_use_of_0_in_strict_mode: { code: 1100, category: ts.DiagnosticCategory.Error, key: \"Invalid_use_of_0_in_strict_mode_1100\", message: \"Invalid use of '{0}' in strict mode.\" },\n        with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: ts.DiagnosticCategory.Error, key: \"with_statements_are_not_allowed_in_strict_mode_1101\", message: \"'with' statements are not allowed in strict mode.\" },\n        delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: ts.DiagnosticCategory.Error, key: \"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102\", message: \"'delete' cannot be called on an identifier in strict mode.\" },\n        A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: ts.DiagnosticCategory.Error, key: \"A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104\", message: \"A 'continue' statement can only be used within an enclosing iteration statement.\" },\n        A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: ts.DiagnosticCategory.Error, key: \"A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105\", message: \"A 'break' statement can only be used within an enclosing iteration or switch statement.\" },\n        Jump_target_cannot_cross_function_boundary: { code: 1107, category: ts.DiagnosticCategory.Error, key: \"Jump_target_cannot_cross_function_boundary_1107\", message: \"Jump target cannot cross function boundary.\" },\n        A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: ts.DiagnosticCategory.Error, key: \"A_return_statement_can_only_be_used_within_a_function_body_1108\", message: \"A 'return' statement can only be used within a function body.\" },\n        Expression_expected: { code: 1109, category: ts.DiagnosticCategory.Error, key: \"Expression_expected_1109\", message: \"Expression expected.\" },\n        Type_expected: { code: 1110, category: ts.DiagnosticCategory.Error, key: \"Type_expected_1110\", message: \"Type expected.\" },\n        A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: ts.DiagnosticCategory.Error, key: \"A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113\", message: \"A 'default' clause cannot appear more than once in a 'switch' statement.\" },\n        Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: \"Duplicate_label_0_1114\", message: \"Duplicate label '{0}'\" },\n        A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: ts.DiagnosticCategory.Error, key: \"A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115\", message: \"A 'continue' statement can only jump to a label of an enclosing iteration statement.\" },\n        A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: ts.DiagnosticCategory.Error, key: \"A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116\", message: \"A 'break' statement can only jump to a label of an enclosing statement.\" },\n        An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: ts.DiagnosticCategory.Error, key: \"An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode_1117\", message: \"An object literal cannot have multiple properties with the same name in strict mode.\" },\n        An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: ts.DiagnosticCategory.Error, key: \"An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118\", message: \"An object literal cannot have multiple get/set accessors with the same name.\" },\n        An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: ts.DiagnosticCategory.Error, key: \"An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119\", message: \"An object literal cannot have property and accessor with the same name.\" },\n        An_export_assignment_cannot_have_modifiers: { code: 1120, category: ts.DiagnosticCategory.Error, key: \"An_export_assignment_cannot_have_modifiers_1120\", message: \"An export assignment cannot have modifiers.\" },\n        Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: ts.DiagnosticCategory.Error, key: \"Octal_literals_are_not_allowed_in_strict_mode_1121\", message: \"Octal literals are not allowed in strict mode.\" },\n        A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: ts.DiagnosticCategory.Error, key: \"A_tuple_type_element_list_cannot_be_empty_1122\", message: \"A tuple type element list cannot be empty.\" },\n        Variable_declaration_list_cannot_be_empty: { code: 1123, category: ts.DiagnosticCategory.Error, key: \"Variable_declaration_list_cannot_be_empty_1123\", message: \"Variable declaration list cannot be empty.\" },\n        Digit_expected: { code: 1124, category: ts.DiagnosticCategory.Error, key: \"Digit_expected_1124\", message: \"Digit expected.\" },\n        Hexadecimal_digit_expected: { code: 1125, category: ts.DiagnosticCategory.Error, key: \"Hexadecimal_digit_expected_1125\", message: \"Hexadecimal digit expected.\" },\n        Unexpected_end_of_text: { code: 1126, category: ts.DiagnosticCategory.Error, key: \"Unexpected_end_of_text_1126\", message: \"Unexpected end of text.\" },\n        Invalid_character: { code: 1127, category: ts.DiagnosticCategory.Error, key: \"Invalid_character_1127\", message: \"Invalid character.\" },\n        Declaration_or_statement_expected: { code: 1128, category: ts.DiagnosticCategory.Error, key: \"Declaration_or_statement_expected_1128\", message: \"Declaration or statement expected.\" },\n        Statement_expected: { code: 1129, category: ts.DiagnosticCategory.Error, key: \"Statement_expected_1129\", message: \"Statement expected.\" },\n        case_or_default_expected: { code: 1130, category: ts.DiagnosticCategory.Error, key: \"case_or_default_expected_1130\", message: \"'case' or 'default' expected.\" },\n        Property_or_signature_expected: { code: 1131, category: ts.DiagnosticCategory.Error, key: \"Property_or_signature_expected_1131\", message: \"Property or signature expected.\" },\n        Enum_member_expected: { code: 1132, category: ts.DiagnosticCategory.Error, key: \"Enum_member_expected_1132\", message: \"Enum member expected.\" },\n        Variable_declaration_expected: { code: 1134, category: ts.DiagnosticCategory.Error, key: \"Variable_declaration_expected_1134\", message: \"Variable declaration expected.\" },\n        Argument_expression_expected: { code: 1135, category: ts.DiagnosticCategory.Error, key: \"Argument_expression_expected_1135\", message: \"Argument expression expected.\" },\n        Property_assignment_expected: { code: 1136, category: ts.DiagnosticCategory.Error, key: \"Property_assignment_expected_1136\", message: \"Property assignment expected.\" },\n        Expression_or_comma_expected: { code: 1137, category: ts.DiagnosticCategory.Error, key: \"Expression_or_comma_expected_1137\", message: \"Expression or comma expected.\" },\n        Parameter_declaration_expected: { code: 1138, category: ts.DiagnosticCategory.Error, key: \"Parameter_declaration_expected_1138\", message: \"Parameter declaration expected.\" },\n        Type_parameter_declaration_expected: { code: 1139, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_declaration_expected_1139\", message: \"Type parameter declaration expected.\" },\n        Type_argument_expected: { code: 1140, category: ts.DiagnosticCategory.Error, key: \"Type_argument_expected_1140\", message: \"Type argument expected.\" },\n        String_literal_expected: { code: 1141, category: ts.DiagnosticCategory.Error, key: \"String_literal_expected_1141\", message: \"String literal expected.\" },\n        Line_break_not_permitted_here: { code: 1142, category: ts.DiagnosticCategory.Error, key: \"Line_break_not_permitted_here_1142\", message: \"Line break not permitted here.\" },\n        or_expected: { code: 1144, category: ts.DiagnosticCategory.Error, key: \"or_expected_1144\", message: \"'{' or ';' expected.\" },\n        Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: \"Declaration_expected_1146\", message: \"Declaration expected.\" },\n        Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: \"Import_declarations_in_a_namespace_cannot_reference_a_module_1147\", message: \"Import declarations in a namespace cannot reference a module.\" },\n        Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: { code: 1148, category: ts.DiagnosticCategory.Error, key: \"Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148\", message: \"Cannot use imports, exports, or module augmentations when '--module' is 'none'.\" },\n        File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: \"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149\", message: \"File name '{0}' differs from already included file name '{1}' only in casing\" },\n        new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: ts.DiagnosticCategory.Error, key: \"new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150\", message: \"'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead.\" },\n        const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: \"const_declarations_must_be_initialized_1155\", message: \"'const' declarations must be initialized\" },\n        const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: ts.DiagnosticCategory.Error, key: \"const_declarations_can_only_be_declared_inside_a_block_1156\", message: \"'const' declarations can only be declared inside a block.\" },\n        let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: ts.DiagnosticCategory.Error, key: \"let_declarations_can_only_be_declared_inside_a_block_1157\", message: \"'let' declarations can only be declared inside a block.\" },\n        Unterminated_template_literal: { code: 1160, category: ts.DiagnosticCategory.Error, key: \"Unterminated_template_literal_1160\", message: \"Unterminated template literal.\" },\n        Unterminated_regular_expression_literal: { code: 1161, category: ts.DiagnosticCategory.Error, key: \"Unterminated_regular_expression_literal_1161\", message: \"Unterminated regular expression literal.\" },\n        An_object_member_cannot_be_declared_optional: { code: 1162, category: ts.DiagnosticCategory.Error, key: \"An_object_member_cannot_be_declared_optional_1162\", message: \"An object member cannot be declared optional.\" },\n        A_yield_expression_is_only_allowed_in_a_generator_body: { code: 1163, category: ts.DiagnosticCategory.Error, key: \"A_yield_expression_is_only_allowed_in_a_generator_body_1163\", message: \"A 'yield' expression is only allowed in a generator body.\" },\n        Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: ts.DiagnosticCategory.Error, key: \"Computed_property_names_are_not_allowed_in_enums_1164\", message: \"Computed property names are not allowed in enums.\" },\n        A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol_1165\", message: \"A computed property name in an ambient context must directly refer to a built-in symbol.\" },\n        A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol_1166\", message: \"A computed property name in a class property declaration must directly refer to a built-in symbol.\" },\n        A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol_1168\", message: \"A computed property name in a method overload must directly refer to a built-in symbol.\" },\n        A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol_1169\", message: \"A computed property name in an interface must directly refer to a built-in symbol.\" },\n        A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol_1170\", message: \"A computed property name in a type literal must directly refer to a built-in symbol.\" },\n        A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: ts.DiagnosticCategory.Error, key: \"A_comma_expression_is_not_allowed_in_a_computed_property_name_1171\", message: \"A comma expression is not allowed in a computed property name.\" },\n        extends_clause_already_seen: { code: 1172, category: ts.DiagnosticCategory.Error, key: \"extends_clause_already_seen_1172\", message: \"'extends' clause already seen.\" },\n        extends_clause_must_precede_implements_clause: { code: 1173, category: ts.DiagnosticCategory.Error, key: \"extends_clause_must_precede_implements_clause_1173\", message: \"'extends' clause must precede 'implements' clause.\" },\n        Classes_can_only_extend_a_single_class: { code: 1174, category: ts.DiagnosticCategory.Error, key: \"Classes_can_only_extend_a_single_class_1174\", message: \"Classes can only extend a single class.\" },\n        implements_clause_already_seen: { code: 1175, category: ts.DiagnosticCategory.Error, key: \"implements_clause_already_seen_1175\", message: \"'implements' clause already seen.\" },\n        Interface_declaration_cannot_have_implements_clause: { code: 1176, category: ts.DiagnosticCategory.Error, key: \"Interface_declaration_cannot_have_implements_clause_1176\", message: \"Interface declaration cannot have 'implements' clause.\" },\n        Binary_digit_expected: { code: 1177, category: ts.DiagnosticCategory.Error, key: \"Binary_digit_expected_1177\", message: \"Binary digit expected.\" },\n        Octal_digit_expected: { code: 1178, category: ts.DiagnosticCategory.Error, key: \"Octal_digit_expected_1178\", message: \"Octal digit expected.\" },\n        Unexpected_token_expected: { code: 1179, category: ts.DiagnosticCategory.Error, key: \"Unexpected_token_expected_1179\", message: \"Unexpected token. '{' expected.\" },\n        Property_destructuring_pattern_expected: { code: 1180, category: ts.DiagnosticCategory.Error, key: \"Property_destructuring_pattern_expected_1180\", message: \"Property destructuring pattern expected.\" },\n        Array_element_destructuring_pattern_expected: { code: 1181, category: ts.DiagnosticCategory.Error, key: \"Array_element_destructuring_pattern_expected_1181\", message: \"Array element destructuring pattern expected.\" },\n        A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: ts.DiagnosticCategory.Error, key: \"A_destructuring_declaration_must_have_an_initializer_1182\", message: \"A destructuring declaration must have an initializer.\" },\n        An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1183, category: ts.DiagnosticCategory.Error, key: \"An_implementation_cannot_be_declared_in_ambient_contexts_1183\", message: \"An implementation cannot be declared in ambient contexts.\" },\n        Modifiers_cannot_appear_here: { code: 1184, category: ts.DiagnosticCategory.Error, key: \"Modifiers_cannot_appear_here_1184\", message: \"Modifiers cannot appear here.\" },\n        Merge_conflict_marker_encountered: { code: 1185, category: ts.DiagnosticCategory.Error, key: \"Merge_conflict_marker_encountered_1185\", message: \"Merge conflict marker encountered.\" },\n        A_rest_element_cannot_have_an_initializer: { code: 1186, category: ts.DiagnosticCategory.Error, key: \"A_rest_element_cannot_have_an_initializer_1186\", message: \"A rest element cannot have an initializer.\" },\n        A_parameter_property_may_not_be_declared_using_a_binding_pattern: { code: 1187, category: ts.DiagnosticCategory.Error, key: \"A_parameter_property_may_not_be_declared_using_a_binding_pattern_1187\", message: \"A parameter property may not be declared using a binding pattern.\" },\n        Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: ts.DiagnosticCategory.Error, key: \"Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement_1188\", message: \"Only a single variable declaration is allowed in a 'for...of' statement.\" },\n        The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: ts.DiagnosticCategory.Error, key: \"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189\", message: \"The variable declaration of a 'for...in' statement cannot have an initializer.\" },\n        The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: ts.DiagnosticCategory.Error, key: \"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190\", message: \"The variable declaration of a 'for...of' statement cannot have an initializer.\" },\n        An_import_declaration_cannot_have_modifiers: { code: 1191, category: ts.DiagnosticCategory.Error, key: \"An_import_declaration_cannot_have_modifiers_1191\", message: \"An import declaration cannot have modifiers.\" },\n        Module_0_has_no_default_export: { code: 1192, category: ts.DiagnosticCategory.Error, key: \"Module_0_has_no_default_export_1192\", message: \"Module '{0}' has no default export.\" },\n        An_export_declaration_cannot_have_modifiers: { code: 1193, category: ts.DiagnosticCategory.Error, key: \"An_export_declaration_cannot_have_modifiers_1193\", message: \"An export declaration cannot have modifiers.\" },\n        Export_declarations_are_not_permitted_in_a_namespace: { code: 1194, category: ts.DiagnosticCategory.Error, key: \"Export_declarations_are_not_permitted_in_a_namespace_1194\", message: \"Export declarations are not permitted in a namespace.\" },\n        Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: ts.DiagnosticCategory.Error, key: \"Catch_clause_variable_cannot_have_a_type_annotation_1196\", message: \"Catch clause variable cannot have a type annotation.\" },\n        Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: ts.DiagnosticCategory.Error, key: \"Catch_clause_variable_cannot_have_an_initializer_1197\", message: \"Catch clause variable cannot have an initializer.\" },\n        An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: ts.DiagnosticCategory.Error, key: \"An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198\", message: \"An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive.\" },\n        Unterminated_Unicode_escape_sequence: { code: 1199, category: ts.DiagnosticCategory.Error, key: \"Unterminated_Unicode_escape_sequence_1199\", message: \"Unterminated Unicode escape sequence.\" },\n        Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: \"Line_terminator_not_permitted_before_arrow_1200\", message: \"Line terminator not permitted before arrow.\" },\n        Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: \"Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asteri_1202\", message: \"Import assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'import * as ns from \\\"mod\\\"', 'import {a} from \\\"mod\\\"', 'import d from \\\"mod\\\"', or another module format instead.\" },\n        Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_default_or_another_module_format_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: \"Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_defaul_1203\", message: \"Export assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'export default' or another module format instead.\" },\n        Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: \"Decorators_are_not_valid_here_1206\", message: \"Decorators are not valid here.\" },\n        Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: \"Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207\", message: \"Decorators cannot be applied to multiple get/set accessors of the same name.\" },\n        Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: \"Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208\", message: \"Cannot compile namespaces when the '--isolatedModules' flag is provided.\" },\n        Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: \"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209\", message: \"Ambient const enums are not allowed when the '--isolatedModules' flag is provided.\" },\n        Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: ts.DiagnosticCategory.Error, key: \"Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210\", message: \"Invalid use of '{0}'. Class definitions are automatically in strict mode.\" },\n        A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: \"A_class_declaration_without_the_default_modifier_must_have_a_name_1211\", message: \"A class declaration without the 'default' modifier must have a name\" },\n        Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: \"Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212\", message: \"Identifier expected. '{0}' is a reserved word in strict mode\" },\n        Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: ts.DiagnosticCategory.Error, key: \"Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213\", message: \"Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode.\" },\n        Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: \"Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214\", message: \"Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode.\" },\n        Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: \"Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215\", message: \"Invalid use of '{0}'. Modules are automatically in strict mode.\" },\n        Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: \"Export_assignment_is_not_supported_when_module_flag_is_system_1218\", message: \"Export assignment is not supported when '--module' flag is 'system'.\" },\n        Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: \"Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219\", message: \"Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.\" },\n        Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: { code: 1220, category: ts.DiagnosticCategory.Error, key: \"Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220\", message: \"Generators are only available when targeting ECMAScript 2015 or higher.\" },\n        Generators_are_not_allowed_in_an_ambient_context: { code: 1221, category: ts.DiagnosticCategory.Error, key: \"Generators_are_not_allowed_in_an_ambient_context_1221\", message: \"Generators are not allowed in an ambient context.\" },\n        An_overload_signature_cannot_be_declared_as_a_generator: { code: 1222, category: ts.DiagnosticCategory.Error, key: \"An_overload_signature_cannot_be_declared_as_a_generator_1222\", message: \"An overload signature cannot be declared as a generator.\" },\n        _0_tag_already_specified: { code: 1223, category: ts.DiagnosticCategory.Error, key: \"_0_tag_already_specified_1223\", message: \"'{0}' tag already specified.\" },\n        Signature_0_must_have_a_type_predicate: { code: 1224, category: ts.DiagnosticCategory.Error, key: \"Signature_0_must_have_a_type_predicate_1224\", message: \"Signature '{0}' must have a type predicate.\" },\n        Cannot_find_parameter_0: { code: 1225, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_parameter_0_1225\", message: \"Cannot find parameter '{0}'.\" },\n        Type_predicate_0_is_not_assignable_to_1: { code: 1226, category: ts.DiagnosticCategory.Error, key: \"Type_predicate_0_is_not_assignable_to_1_1226\", message: \"Type predicate '{0}' is not assignable to '{1}'.\" },\n        Parameter_0_is_not_in_the_same_position_as_parameter_1: { code: 1227, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_is_not_in_the_same_position_as_parameter_1_1227\", message: \"Parameter '{0}' is not in the same position as parameter '{1}'.\" },\n        A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods: { code: 1228, category: ts.DiagnosticCategory.Error, key: \"A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods_1228\", message: \"A type predicate is only allowed in return type position for functions and methods.\" },\n        A_type_predicate_cannot_reference_a_rest_parameter: { code: 1229, category: ts.DiagnosticCategory.Error, key: \"A_type_predicate_cannot_reference_a_rest_parameter_1229\", message: \"A type predicate cannot reference a rest parameter.\" },\n        A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: { code: 1230, category: ts.DiagnosticCategory.Error, key: \"A_type_predicate_cannot_reference_element_0_in_a_binding_pattern_1230\", message: \"A type predicate cannot reference element '{0}' in a binding pattern.\" },\n        An_export_assignment_can_only_be_used_in_a_module: { code: 1231, category: ts.DiagnosticCategory.Error, key: \"An_export_assignment_can_only_be_used_in_a_module_1231\", message: \"An export assignment can only be used in a module.\" },\n        An_import_declaration_can_only_be_used_in_a_namespace_or_module: { code: 1232, category: ts.DiagnosticCategory.Error, key: \"An_import_declaration_can_only_be_used_in_a_namespace_or_module_1232\", message: \"An import declaration can only be used in a namespace or module.\" },\n        An_export_declaration_can_only_be_used_in_a_module: { code: 1233, category: ts.DiagnosticCategory.Error, key: \"An_export_declaration_can_only_be_used_in_a_module_1233\", message: \"An export declaration can only be used in a module.\" },\n        An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { code: 1234, category: ts.DiagnosticCategory.Error, key: \"An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234\", message: \"An ambient module declaration is only allowed at the top level in a file.\" },\n        A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { code: 1235, category: ts.DiagnosticCategory.Error, key: \"A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235\", message: \"A namespace declaration is only allowed in a namespace or module.\" },\n        The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { code: 1236, category: ts.DiagnosticCategory.Error, key: \"The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236\", message: \"The return type of a property decorator function must be either 'void' or 'any'.\" },\n        The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { code: 1237, category: ts.DiagnosticCategory.Error, key: \"The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any_1237\", message: \"The return type of a parameter decorator function must be either 'void' or 'any'.\" },\n        Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { code: 1238, category: ts.DiagnosticCategory.Error, key: \"Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression_1238\", message: \"Unable to resolve signature of class decorator when called as an expression.\" },\n        Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: { code: 1239, category: ts.DiagnosticCategory.Error, key: \"Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression_1239\", message: \"Unable to resolve signature of parameter decorator when called as an expression.\" },\n        Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: { code: 1240, category: ts.DiagnosticCategory.Error, key: \"Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression_1240\", message: \"Unable to resolve signature of property decorator when called as an expression.\" },\n        Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: { code: 1241, category: ts.DiagnosticCategory.Error, key: \"Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression_1241\", message: \"Unable to resolve signature of method decorator when called as an expression.\" },\n        abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration: { code: 1242, category: ts.DiagnosticCategory.Error, key: \"abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242\", message: \"'abstract' modifier can only appear on a class, method, or property declaration.\" },\n        _0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_be_used_with_1_modifier_1243\", message: \"'{0}' modifier cannot be used with '{1}' modifier.\" },\n        Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: \"Abstract_methods_can_only_appear_within_an_abstract_class_1244\", message: \"Abstract methods can only appear within an abstract class.\" },\n        Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: \"Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245\", message: \"Method '{0}' cannot have an implementation because it is marked abstract.\" },\n        An_interface_property_cannot_have_an_initializer: { code: 1246, category: ts.DiagnosticCategory.Error, key: \"An_interface_property_cannot_have_an_initializer_1246\", message: \"An interface property cannot have an initializer.\" },\n        A_type_literal_property_cannot_have_an_initializer: { code: 1247, category: ts.DiagnosticCategory.Error, key: \"A_type_literal_property_cannot_have_an_initializer_1247\", message: \"A type literal property cannot have an initializer.\" },\n        A_class_member_cannot_have_the_0_keyword: { code: 1248, category: ts.DiagnosticCategory.Error, key: \"A_class_member_cannot_have_the_0_keyword_1248\", message: \"A class member cannot have the '{0}' keyword.\" },\n        A_decorator_can_only_decorate_a_method_implementation_not_an_overload: { code: 1249, category: ts.DiagnosticCategory.Error, key: \"A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249\", message: \"A decorator can only decorate a method implementation, not an overload.\" },\n        Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: { code: 1250, category: ts.DiagnosticCategory.Error, key: \"Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250\", message: \"Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.\" },\n        Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: { code: 1251, category: ts.DiagnosticCategory.Error, key: \"Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251\", message: \"Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode.\" },\n        Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: { code: 1252, category: ts.DiagnosticCategory.Error, key: \"Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252\", message: \"Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode.\" },\n        _0_tag_cannot_be_used_independently_as_a_top_level_JSDoc_tag: { code: 1253, category: ts.DiagnosticCategory.Error, key: \"_0_tag_cannot_be_used_independently_as_a_top_level_JSDoc_tag_1253\", message: \"'{0}' tag cannot be used independently as a top level JSDoc tag.\" },\n        A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal: { code: 1254, category: ts.DiagnosticCategory.Error, key: \"A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_1254\", message: \"A 'const' initializer in an ambient context must be a string or numeric literal.\" },\n        with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: \"with_statements_are_not_allowed_in_an_async_function_block_1300\", message: \"'with' statements are not allowed in an async function block.\" },\n        await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: \"await_expression_is_only_allowed_within_an_async_function_1308\", message: \"'await' expression is only allowed within an async function.\" },\n        can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: \"can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312\", message: \"'=' can only be used in an object literal property inside a destructuring assignment.\" },\n        The_body_of_an_if_statement_cannot_be_the_empty_statement: { code: 1313, category: ts.DiagnosticCategory.Error, key: \"The_body_of_an_if_statement_cannot_be_the_empty_statement_1313\", message: \"The body of an 'if' statement cannot be the empty statement.\" },\n        Global_module_exports_may_only_appear_in_module_files: { code: 1314, category: ts.DiagnosticCategory.Error, key: \"Global_module_exports_may_only_appear_in_module_files_1314\", message: \"Global module exports may only appear in module files.\" },\n        Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: \"Global_module_exports_may_only_appear_in_declaration_files_1315\", message: \"Global module exports may only appear in declaration files.\" },\n        Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: \"Global_module_exports_may_only_appear_at_top_level_1316\", message: \"Global module exports may only appear at top level.\" },\n        A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: \"A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317\", message: \"A parameter property cannot be declared using a rest parameter.\" },\n        An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: \"An_abstract_accessor_cannot_have_an_implementation_1318\", message: \"An abstract accessor cannot have an implementation.\" },\n        Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_0_2300\", message: \"Duplicate identifier '{0}'.\" },\n        Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: \"Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301\", message: \"Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor.\" },\n        Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: \"Static_members_cannot_reference_class_type_parameters_2302\", message: \"Static members cannot reference class type parameters.\" },\n        Circular_definition_of_import_alias_0: { code: 2303, category: ts.DiagnosticCategory.Error, key: \"Circular_definition_of_import_alias_0_2303\", message: \"Circular definition of import alias '{0}'.\" },\n        Cannot_find_name_0: { code: 2304, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_name_0_2304\", message: \"Cannot find name '{0}'.\" },\n        Module_0_has_no_exported_member_1: { code: 2305, category: ts.DiagnosticCategory.Error, key: \"Module_0_has_no_exported_member_1_2305\", message: \"Module '{0}' has no exported member '{1}'.\" },\n        File_0_is_not_a_module: { code: 2306, category: ts.DiagnosticCategory.Error, key: \"File_0_is_not_a_module_2306\", message: \"File '{0}' is not a module.\" },\n        Cannot_find_module_0: { code: 2307, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_module_0_2307\", message: \"Cannot find module '{0}'.\" },\n        Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: { code: 2308, category: ts.DiagnosticCategory.Error, key: \"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308\", message: \"Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity.\" },\n        An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: ts.DiagnosticCategory.Error, key: \"An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309\", message: \"An export assignment cannot be used in a module with other exported elements.\" },\n        Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: ts.DiagnosticCategory.Error, key: \"Type_0_recursively_references_itself_as_a_base_type_2310\", message: \"Type '{0}' recursively references itself as a base type.\" },\n        A_class_may_only_extend_another_class: { code: 2311, category: ts.DiagnosticCategory.Error, key: \"A_class_may_only_extend_another_class_2311\", message: \"A class may only extend another class.\" },\n        An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: ts.DiagnosticCategory.Error, key: \"An_interface_may_only_extend_a_class_or_another_interface_2312\", message: \"An interface may only extend a class or another interface.\" },\n        Type_parameter_0_has_a_circular_constraint: { code: 2313, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_has_a_circular_constraint_2313\", message: \"Type parameter '{0}' has a circular constraint.\" },\n        Generic_type_0_requires_1_type_argument_s: { code: 2314, category: ts.DiagnosticCategory.Error, key: \"Generic_type_0_requires_1_type_argument_s_2314\", message: \"Generic type '{0}' requires {1} type argument(s).\" },\n        Type_0_is_not_generic: { code: 2315, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_generic_2315\", message: \"Type '{0}' is not generic.\" },\n        Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: ts.DiagnosticCategory.Error, key: \"Global_type_0_must_be_a_class_or_interface_type_2316\", message: \"Global type '{0}' must be a class or interface type.\" },\n        Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: ts.DiagnosticCategory.Error, key: \"Global_type_0_must_have_1_type_parameter_s_2317\", message: \"Global type '{0}' must have {1} type parameter(s).\" },\n        Cannot_find_global_type_0: { code: 2318, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_global_type_0_2318\", message: \"Cannot find global type '{0}'.\" },\n        Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: ts.DiagnosticCategory.Error, key: \"Named_property_0_of_types_1_and_2_are_not_identical_2319\", message: \"Named property '{0}' of types '{1}' and '{2}' are not identical.\" },\n        Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: ts.DiagnosticCategory.Error, key: \"Interface_0_cannot_simultaneously_extend_types_1_and_2_2320\", message: \"Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'.\" },\n        Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: ts.DiagnosticCategory.Error, key: \"Excessive_stack_depth_comparing_types_0_and_1_2321\", message: \"Excessive stack depth comparing types '{0}' and '{1}'.\" },\n        Type_0_is_not_assignable_to_type_1: { code: 2322, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_assignable_to_type_1_2322\", message: \"Type '{0}' is not assignable to type '{1}'.\" },\n        Cannot_redeclare_exported_variable_0: { code: 2323, category: ts.DiagnosticCategory.Error, key: \"Cannot_redeclare_exported_variable_0_2323\", message: \"Cannot redeclare exported variable '{0}'.\" },\n        Property_0_is_missing_in_type_1: { code: 2324, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_missing_in_type_1_2324\", message: \"Property '{0}' is missing in type '{1}'.\" },\n        Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_private_in_type_1_but_not_in_type_2_2325\", message: \"Property '{0}' is private in type '{1}' but not in type '{2}'.\" },\n        Types_of_property_0_are_incompatible: { code: 2326, category: ts.DiagnosticCategory.Error, key: \"Types_of_property_0_are_incompatible_2326\", message: \"Types of property '{0}' are incompatible.\" },\n        Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_optional_in_type_1_but_required_in_type_2_2327\", message: \"Property '{0}' is optional in type '{1}' but required in type '{2}'.\" },\n        Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: ts.DiagnosticCategory.Error, key: \"Types_of_parameters_0_and_1_are_incompatible_2328\", message: \"Types of parameters '{0}' and '{1}' are incompatible.\" },\n        Index_signature_is_missing_in_type_0: { code: 2329, category: ts.DiagnosticCategory.Error, key: \"Index_signature_is_missing_in_type_0_2329\", message: \"Index signature is missing in type '{0}'.\" },\n        Index_signatures_are_incompatible: { code: 2330, category: ts.DiagnosticCategory.Error, key: \"Index_signatures_are_incompatible_2330\", message: \"Index signatures are incompatible.\" },\n        this_cannot_be_referenced_in_a_module_or_namespace_body: { code: 2331, category: ts.DiagnosticCategory.Error, key: \"this_cannot_be_referenced_in_a_module_or_namespace_body_2331\", message: \"'this' cannot be referenced in a module or namespace body.\" },\n        this_cannot_be_referenced_in_current_location: { code: 2332, category: ts.DiagnosticCategory.Error, key: \"this_cannot_be_referenced_in_current_location_2332\", message: \"'this' cannot be referenced in current location.\" },\n        this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: ts.DiagnosticCategory.Error, key: \"this_cannot_be_referenced_in_constructor_arguments_2333\", message: \"'this' cannot be referenced in constructor arguments.\" },\n        this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: ts.DiagnosticCategory.Error, key: \"this_cannot_be_referenced_in_a_static_property_initializer_2334\", message: \"'this' cannot be referenced in a static property initializer.\" },\n        super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: ts.DiagnosticCategory.Error, key: \"super_can_only_be_referenced_in_a_derived_class_2335\", message: \"'super' can only be referenced in a derived class.\" },\n        super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: ts.DiagnosticCategory.Error, key: \"super_cannot_be_referenced_in_constructor_arguments_2336\", message: \"'super' cannot be referenced in constructor arguments.\" },\n        Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: ts.DiagnosticCategory.Error, key: \"Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors_2337\", message: \"Super calls are not permitted outside constructors or in nested functions inside constructors.\" },\n        super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: ts.DiagnosticCategory.Error, key: \"super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_der_2338\", message: \"'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.\" },\n        Property_0_does_not_exist_on_type_1: { code: 2339, category: ts.DiagnosticCategory.Error, key: \"Property_0_does_not_exist_on_type_1_2339\", message: \"Property '{0}' does not exist on type '{1}'.\" },\n        Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: \"Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340\", message: \"Only public and protected methods of the base class are accessible via the 'super' keyword.\" },\n        Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_private_and_only_accessible_within_class_1_2341\", message: \"Property '{0}' is private and only accessible within class '{1}'.\" },\n        An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: \"An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342\", message: \"An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.\" },\n        This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: \"This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343\", message: \"This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'.\" },\n        Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: \"Type_0_does_not_satisfy_the_constraint_1_2344\", message: \"Type '{0}' does not satisfy the constraint '{1}'.\" },\n        Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: \"Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345\", message: \"Argument of type '{0}' is not assignable to parameter of type '{1}'.\" },\n        Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: \"Supplied_parameters_do_not_match_any_signature_of_call_target_2346\", message: \"Supplied parameters do not match any signature of call target.\" },\n        Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: ts.DiagnosticCategory.Error, key: \"Untyped_function_calls_may_not_accept_type_arguments_2347\", message: \"Untyped function calls may not accept type arguments.\" },\n        Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: ts.DiagnosticCategory.Error, key: \"Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348\", message: \"Value of type '{0}' is not callable. Did you mean to include 'new'?\" },\n        Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures: { code: 2349, category: ts.DiagnosticCategory.Error, key: \"Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatur_2349\", message: \"Cannot invoke an expression whose type lacks a call signature. Type '{0}' has no compatible call signatures.\" },\n        Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: ts.DiagnosticCategory.Error, key: \"Only_a_void_function_can_be_called_with_the_new_keyword_2350\", message: \"Only a void function can be called with the 'new' keyword.\" },\n        Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: \"Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351\", message: \"Cannot use 'new' with an expression whose type lacks a call or construct signature.\" },\n        Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: \"Type_0_cannot_be_converted_to_type_1_2352\", message: \"Type '{0}' cannot be converted to type '{1}'.\" },\n        Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: \"Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353\", message: \"Object literal may only specify known properties, and '{0}' does not exist in type '{1}'.\" },\n        This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: \"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354\", message: \"This syntax requires an imported helper but module '{0}' cannot be found.\" },\n        A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: \"A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355\", message: \"A function whose declared type is neither 'void' nor 'any' must return a value.\" },\n        An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: \"An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356\", message: \"An arithmetic operand must be of type 'any', 'number' or an enum type.\" },\n        The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: \"The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357\", message: \"The operand of an increment or decrement operator must be a variable or a property access.\" },\n        The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358\", message: \"The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.\" },\n        The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: ts.DiagnosticCategory.Error, key: \"The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359\", message: \"The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.\" },\n        The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol_2360\", message: \"The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.\" },\n        The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: \"The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361\", message: \"The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter\" },\n        The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2362\", message: \"The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.\" },\n        The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: \"The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363\", message: \"The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.\" },\n        The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: { code: 2364, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364\", message: \"The left-hand side of an assignment expression must be a variable or a property access.\" },\n        Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: \"Operator_0_cannot_be_applied_to_types_1_and_2_2365\", message: \"Operator '{0}' cannot be applied to types '{1}' and '{2}'.\" },\n        Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: \"Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366\", message: \"Function lacks ending return statement and return type does not include 'undefined'.\" },\n        Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_name_cannot_be_0_2368\", message: \"Type parameter name cannot be '{0}'\" },\n        A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: \"A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369\", message: \"A parameter property is only allowed in a constructor implementation.\" },\n        A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: \"A_rest_parameter_must_be_of_an_array_type_2370\", message: \"A rest parameter must be of an array type.\" },\n        A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: ts.DiagnosticCategory.Error, key: \"A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371\", message: \"A parameter initializer is only allowed in a function or constructor implementation.\" },\n        Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_cannot_be_referenced_in_its_initializer_2372\", message: \"Parameter '{0}' cannot be referenced in its initializer.\" },\n        Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: ts.DiagnosticCategory.Error, key: \"Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373\", message: \"Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.\" },\n        Duplicate_string_index_signature: { code: 2374, category: ts.DiagnosticCategory.Error, key: \"Duplicate_string_index_signature_2374\", message: \"Duplicate string index signature.\" },\n        Duplicate_number_index_signature: { code: 2375, category: ts.DiagnosticCategory.Error, key: \"Duplicate_number_index_signature_2375\", message: \"Duplicate number index signature.\" },\n        A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: ts.DiagnosticCategory.Error, key: \"A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_proper_2376\", message: \"A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.\" },\n        Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: ts.DiagnosticCategory.Error, key: \"Constructors_for_derived_classes_must_contain_a_super_call_2377\", message: \"Constructors for derived classes must contain a 'super' call.\" },\n        A_get_accessor_must_return_a_value: { code: 2378, category: ts.DiagnosticCategory.Error, key: \"A_get_accessor_must_return_a_value_2378\", message: \"A 'get' accessor must return a value.\" },\n        Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: ts.DiagnosticCategory.Error, key: \"Getter_and_setter_accessors_do_not_agree_in_visibility_2379\", message: \"Getter and setter accessors do not agree in visibility.\" },\n        get_and_set_accessor_must_have_the_same_type: { code: 2380, category: ts.DiagnosticCategory.Error, key: \"get_and_set_accessor_must_have_the_same_type_2380\", message: \"'get' and 'set' accessor must have the same type.\" },\n        A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: ts.DiagnosticCategory.Error, key: \"A_signature_with_an_implementation_cannot_use_a_string_literal_type_2381\", message: \"A signature with an implementation cannot use a string literal type.\" },\n        Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: ts.DiagnosticCategory.Error, key: \"Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382\", message: \"Specialized overload signature is not assignable to any non-specialized signature.\" },\n        Overload_signatures_must_all_be_exported_or_non_exported: { code: 2383, category: ts.DiagnosticCategory.Error, key: \"Overload_signatures_must_all_be_exported_or_non_exported_2383\", message: \"Overload signatures must all be exported or non-exported.\" },\n        Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: ts.DiagnosticCategory.Error, key: \"Overload_signatures_must_all_be_ambient_or_non_ambient_2384\", message: \"Overload signatures must all be ambient or non-ambient.\" },\n        Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: ts.DiagnosticCategory.Error, key: \"Overload_signatures_must_all_be_public_private_or_protected_2385\", message: \"Overload signatures must all be public, private or protected.\" },\n        Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: ts.DiagnosticCategory.Error, key: \"Overload_signatures_must_all_be_optional_or_required_2386\", message: \"Overload signatures must all be optional or required.\" },\n        Function_overload_must_be_static: { code: 2387, category: ts.DiagnosticCategory.Error, key: \"Function_overload_must_be_static_2387\", message: \"Function overload must be static.\" },\n        Function_overload_must_not_be_static: { code: 2388, category: ts.DiagnosticCategory.Error, key: \"Function_overload_must_not_be_static_2388\", message: \"Function overload must not be static.\" },\n        Function_implementation_name_must_be_0: { code: 2389, category: ts.DiagnosticCategory.Error, key: \"Function_implementation_name_must_be_0_2389\", message: \"Function implementation name must be '{0}'.\" },\n        Constructor_implementation_is_missing: { code: 2390, category: ts.DiagnosticCategory.Error, key: \"Constructor_implementation_is_missing_2390\", message: \"Constructor implementation is missing.\" },\n        Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: ts.DiagnosticCategory.Error, key: \"Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391\", message: \"Function implementation is missing or not immediately following the declaration.\" },\n        Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: ts.DiagnosticCategory.Error, key: \"Multiple_constructor_implementations_are_not_allowed_2392\", message: \"Multiple constructor implementations are not allowed.\" },\n        Duplicate_function_implementation: { code: 2393, category: ts.DiagnosticCategory.Error, key: \"Duplicate_function_implementation_2393\", message: \"Duplicate function implementation.\" },\n        Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: ts.DiagnosticCategory.Error, key: \"Overload_signature_is_not_compatible_with_function_implementation_2394\", message: \"Overload signature is not compatible with function implementation.\" },\n        Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: ts.DiagnosticCategory.Error, key: \"Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395\", message: \"Individual declarations in merged declaration '{0}' must be all exported or all local.\" },\n        Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters_2396\", message: \"Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.\" },\n        Declaration_name_conflicts_with_built_in_global_identifier_0: { code: 2397, category: ts.DiagnosticCategory.Error, key: \"Declaration_name_conflicts_with_built_in_global_identifier_0_2397\", message: \"Declaration name conflicts with built-in global identifier '{0}'.\" },\n        Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399\", message: \"Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.\" },\n        Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: ts.DiagnosticCategory.Error, key: \"Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400\", message: \"Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference.\" },\n        Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference_2401\", message: \"Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.\" },\n        Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: ts.DiagnosticCategory.Error, key: \"Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference_2402\", message: \"Expression resolves to '_super' that compiler uses to capture base class reference.\" },\n        Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: ts.DiagnosticCategory.Error, key: \"Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403\", message: \"Subsequent variable declarations must have the same type.  Variable '{0}' must be of type '{1}', but here has type '{2}'.\" },\n        The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404\", message: \"The left-hand side of a 'for...in' statement cannot use a type annotation.\" },\n        The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405\", message: \"The left-hand side of a 'for...in' statement must be of type 'string' or 'any'.\" },\n        The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: { code: 2406, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406\", message: \"The left-hand side of a 'for...in' statement must be a variable or a property access.\" },\n        The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: ts.DiagnosticCategory.Error, key: \"The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407\", message: \"The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.\" },\n        Setters_cannot_return_a_value: { code: 2408, category: ts.DiagnosticCategory.Error, key: \"Setters_cannot_return_a_value_2408\", message: \"Setters cannot return a value.\" },\n        Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409\", message: \"Return type of constructor signature must be assignable to the instance type of the class\" },\n        The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: { code: 2410, category: ts.DiagnosticCategory.Error, key: \"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410\", message: \"The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.\" },\n        Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: ts.DiagnosticCategory.Error, key: \"Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411\", message: \"Property '{0}' of type '{1}' is not assignable to string index type '{2}'.\" },\n        Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: ts.DiagnosticCategory.Error, key: \"Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412\", message: \"Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'.\" },\n        Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: ts.DiagnosticCategory.Error, key: \"Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413\", message: \"Numeric index type '{0}' is not assignable to string index type '{1}'.\" },\n        Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: \"Class_name_cannot_be_0_2414\", message: \"Class name cannot be '{0}'\" },\n        Class_0_incorrectly_extends_base_class_1: { code: 2415, category: ts.DiagnosticCategory.Error, key: \"Class_0_incorrectly_extends_base_class_1_2415\", message: \"Class '{0}' incorrectly extends base class '{1}'.\" },\n        Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: ts.DiagnosticCategory.Error, key: \"Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417\", message: \"Class static side '{0}' incorrectly extends base class static side '{1}'.\" },\n        Class_0_incorrectly_implements_interface_1: { code: 2420, category: ts.DiagnosticCategory.Error, key: \"Class_0_incorrectly_implements_interface_1_2420\", message: \"Class '{0}' incorrectly implements interface '{1}'.\" },\n        A_class_may_only_implement_another_class_or_interface: { code: 2422, category: ts.DiagnosticCategory.Error, key: \"A_class_may_only_implement_another_class_or_interface_2422\", message: \"A class may only implement another class or interface.\" },\n        Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: ts.DiagnosticCategory.Error, key: \"Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_access_2423\", message: \"Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.\" },\n        Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: ts.DiagnosticCategory.Error, key: \"Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_proper_2424\", message: \"Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.\" },\n        Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: ts.DiagnosticCategory.Error, key: \"Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425\", message: \"Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.\" },\n        Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: ts.DiagnosticCategory.Error, key: \"Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426\", message: \"Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.\" },\n        Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: \"Interface_name_cannot_be_0_2427\", message: \"Interface name cannot be '{0}'\" },\n        All_declarations_of_0_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: \"All_declarations_of_0_must_have_identical_type_parameters_2428\", message: \"All declarations of '{0}' must have identical type parameters.\" },\n        Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: \"Interface_0_incorrectly_extends_interface_1_2430\", message: \"Interface '{0}' incorrectly extends interface '{1}'.\" },\n        Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: \"Enum_name_cannot_be_0_2431\", message: \"Enum name cannot be '{0}'\" },\n        In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: \"In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432\", message: \"In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element.\" },\n        A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: \"A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433\", message: \"A namespace declaration cannot be in a different file from a class or function with which it is merged\" },\n        A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: \"A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434\", message: \"A namespace declaration cannot be located prior to a class or function with which it is merged\" },\n        Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { code: 2435, category: ts.DiagnosticCategory.Error, key: \"Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435\", message: \"Ambient modules cannot be nested in other modules or namespaces.\" },\n        Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: \"Ambient_module_declaration_cannot_specify_relative_module_name_2436\", message: \"Ambient module declaration cannot specify relative module name.\" },\n        Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: \"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437\", message: \"Module '{0}' is hidden by a local declaration with the same name\" },\n        Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: \"Import_name_cannot_be_0_2438\", message: \"Import name cannot be '{0}'\" },\n        Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: \"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439\", message: \"Import or export declaration in an ambient module declaration cannot reference module through relative module name.\" },\n        Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.DiagnosticCategory.Error, key: \"Import_declaration_conflicts_with_local_declaration_of_0_2440\", message: \"Import declaration conflicts with local declaration of '{0}'\" },\n        Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441\", message: \"Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module.\" },\n        Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: ts.DiagnosticCategory.Error, key: \"Types_have_separate_declarations_of_a_private_property_0_2442\", message: \"Types have separate declarations of a private property '{0}'.\" },\n        Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443\", message: \"Property '{0}' is protected but type '{1}' is not a class derived from '{2}'.\" },\n        Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_protected_in_type_1_but_public_in_type_2_2444\", message: \"Property '{0}' is protected in type '{1}' but public in type '{2}'.\" },\n        Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses_2445\", message: \"Property '{0}' is protected and only accessible within class '{1}' and its subclasses.\" },\n        Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446\", message: \"Property '{0}' is protected and only accessible through an instance of class '{1}'.\" },\n        The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: \"The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447\", message: \"The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead.\" },\n        Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: \"Block_scoped_variable_0_used_before_its_declaration_2448\", message: \"Block-scoped variable '{0}' used before its declaration.\" },\n        Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: \"Cannot_redeclare_block_scoped_variable_0_2451\", message: \"Cannot redeclare block-scoped variable '{0}'.\" },\n        An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: \"An_enum_member_cannot_have_a_numeric_name_2452\", message: \"An enum member cannot have a numeric name.\" },\n        The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: \"The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453\", message: \"The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly.\" },\n        Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: \"Variable_0_is_used_before_being_assigned_2454\", message: \"Variable '{0}' is used before being assigned.\" },\n        Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: \"Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455\", message: \"Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'.\" },\n        Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: \"Type_alias_0_circularly_references_itself_2456\", message: \"Type alias '{0}' circularly references itself.\" },\n        Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: \"Type_alias_name_cannot_be_0_2457\", message: \"Type alias name cannot be '{0}'\" },\n        An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: ts.DiagnosticCategory.Error, key: \"An_AMD_module_cannot_have_multiple_name_assignments_2458\", message: \"An AMD module cannot have multiple name assignments.\" },\n        Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: ts.DiagnosticCategory.Error, key: \"Type_0_has_no_property_1_and_no_string_index_signature_2459\", message: \"Type '{0}' has no property '{1}' and no string index signature.\" },\n        Type_0_has_no_property_1: { code: 2460, category: ts.DiagnosticCategory.Error, key: \"Type_0_has_no_property_1_2460\", message: \"Type '{0}' has no property '{1}'.\" },\n        Type_0_is_not_an_array_type: { code: 2461, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_an_array_type_2461\", message: \"Type '{0}' is not an array type.\" },\n        A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: \"A_rest_element_must_be_last_in_a_destructuring_pattern_2462\", message: \"A rest element must be last in a destructuring pattern\" },\n        A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: ts.DiagnosticCategory.Error, key: \"A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463\", message: \"A binding pattern parameter cannot be optional in an implementation signature.\" },\n        A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464\", message: \"A computed property name must be of type 'string', 'number', 'symbol', or 'any'.\" },\n        this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: ts.DiagnosticCategory.Error, key: \"this_cannot_be_referenced_in_a_computed_property_name_2465\", message: \"'this' cannot be referenced in a computed property name.\" },\n        super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: ts.DiagnosticCategory.Error, key: \"super_cannot_be_referenced_in_a_computed_property_name_2466\", message: \"'super' cannot be referenced in a computed property name.\" },\n        A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type_2467\", message: \"A computed property name cannot reference a type parameter from its containing type.\" },\n        Cannot_find_global_value_0: { code: 2468, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_global_value_0_2468\", message: \"Cannot find global value '{0}'.\" },\n        The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: ts.DiagnosticCategory.Error, key: \"The_0_operator_cannot_be_applied_to_type_symbol_2469\", message: \"The '{0}' operator cannot be applied to type 'symbol'.\" },\n        Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: ts.DiagnosticCategory.Error, key: \"Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object_2470\", message: \"'Symbol' reference does not refer to the global Symbol constructor object.\" },\n        A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_of_the_form_0_must_be_of_type_symbol_2471\", message: \"A computed property name of the form '{0}' must be of type 'symbol'.\" },\n        Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: { code: 2472, category: ts.DiagnosticCategory.Error, key: \"Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher_2472\", message: \"Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher.\" },\n        Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: ts.DiagnosticCategory.Error, key: \"Enum_declarations_must_all_be_const_or_non_const_2473\", message: \"Enum declarations must all be const or non-const.\" },\n        In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: ts.DiagnosticCategory.Error, key: \"In_const_enum_declarations_member_initializer_must_be_constant_expression_2474\", message: \"In 'const' enum declarations member initializer must be constant expression.\" },\n        const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: ts.DiagnosticCategory.Error, key: \"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475\", message: \"'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.\" },\n        A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: ts.DiagnosticCategory.Error, key: \"A_const_enum_member_can_only_be_accessed_using_a_string_literal_2476\", message: \"A const enum member can only be accessed using a string literal.\" },\n        const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: ts.DiagnosticCategory.Error, key: \"const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477\", message: \"'const' enum member initializer was evaluated to a non-finite value.\" },\n        const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: ts.DiagnosticCategory.Error, key: \"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478\", message: \"'const' enum member initializer was evaluated to disallowed value 'NaN'.\" },\n        Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: ts.DiagnosticCategory.Error, key: \"Property_0_does_not_exist_on_const_enum_1_2479\", message: \"Property '{0}' does not exist on 'const' enum '{1}'.\" },\n        let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: ts.DiagnosticCategory.Error, key: \"let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480\", message: \"'let' is not allowed to be used as a name in 'let' or 'const' declarations.\" },\n        Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: \"Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481\", message: \"Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'.\" },\n        The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483\", message: \"The left-hand side of a 'for...of' statement cannot use a type annotation.\" },\n        Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: \"Export_declaration_conflicts_with_exported_declaration_of_0_2484\", message: \"Export declaration conflicts with exported declaration of '{0}'\" },\n        The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: { code: 2487, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487\", message: \"The left-hand side of a 'for...of' statement must be a variable or a property access.\" },\n        Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: \"Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488\", message: \"Type must have a '[Symbol.iterator]()' method that returns an iterator.\" },\n        An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: \"An_iterator_must_have_a_next_method_2489\", message: \"An iterator must have a 'next()' method.\" },\n        The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: ts.DiagnosticCategory.Error, key: \"The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490\", message: \"The type returned by the 'next()' method of an iterator must have a 'value' property.\" },\n        The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491\", message: \"The left-hand side of a 'for...in' statement cannot be a destructuring pattern.\" },\n        Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: ts.DiagnosticCategory.Error, key: \"Cannot_redeclare_identifier_0_in_catch_clause_2492\", message: \"Cannot redeclare identifier '{0}' in catch clause\" },\n        Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: ts.DiagnosticCategory.Error, key: \"Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2_2493\", message: \"Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'.\" },\n        Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: ts.DiagnosticCategory.Error, key: \"Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494\", message: \"Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher.\" },\n        Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_an_array_type_or_a_string_type_2495\", message: \"Type '{0}' is not an array type or a string type.\" },\n        The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: { code: 2496, category: ts.DiagnosticCategory.Error, key: \"The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_stand_2496\", message: \"The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.\" },\n        Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: \"Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497\", message: \"Module '{0}' resolves to a non-module entity and cannot be imported using this construct.\" },\n        Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: \"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498\", message: \"Module '{0}' uses 'export =' and cannot be used with 'export *'.\" },\n        An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: \"An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments_2499\", message: \"An interface can only extend an identifier/qualified-name with optional type arguments.\" },\n        A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: \"A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments_2500\", message: \"A class can only implement an identifier/qualified-name with optional type arguments.\" },\n        A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: \"A_rest_element_cannot_contain_a_binding_pattern_2501\", message: \"A rest element cannot contain a binding pattern.\" },\n        _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: \"_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502\", message: \"'{0}' is referenced directly or indirectly in its own type annotation.\" },\n        Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_namespace_0_2503\", message: \"Cannot find namespace '{0}'.\" },\n        A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: ts.DiagnosticCategory.Error, key: \"A_generator_cannot_have_a_void_type_annotation_2505\", message: \"A generator cannot have a 'void' type annotation.\" },\n        _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: { code: 2506, category: ts.DiagnosticCategory.Error, key: \"_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506\", message: \"'{0}' is referenced directly or indirectly in its own base expression.\" },\n        Type_0_is_not_a_constructor_function_type: { code: 2507, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_a_constructor_function_type_2507\", message: \"Type '{0}' is not a constructor function type.\" },\n        No_base_constructor_has_the_specified_number_of_type_arguments: { code: 2508, category: ts.DiagnosticCategory.Error, key: \"No_base_constructor_has_the_specified_number_of_type_arguments_2508\", message: \"No base constructor has the specified number of type arguments.\" },\n        Base_constructor_return_type_0_is_not_a_class_or_interface_type: { code: 2509, category: ts.DiagnosticCategory.Error, key: \"Base_constructor_return_type_0_is_not_a_class_or_interface_type_2509\", message: \"Base constructor return type '{0}' is not a class or interface type.\" },\n        Base_constructors_must_all_have_the_same_return_type: { code: 2510, category: ts.DiagnosticCategory.Error, key: \"Base_constructors_must_all_have_the_same_return_type_2510\", message: \"Base constructors must all have the same return type.\" },\n        Cannot_create_an_instance_of_the_abstract_class_0: { code: 2511, category: ts.DiagnosticCategory.Error, key: \"Cannot_create_an_instance_of_the_abstract_class_0_2511\", message: \"Cannot create an instance of the abstract class '{0}'.\" },\n        Overload_signatures_must_all_be_abstract_or_non_abstract: { code: 2512, category: ts.DiagnosticCategory.Error, key: \"Overload_signatures_must_all_be_abstract_or_non_abstract_2512\", message: \"Overload signatures must all be abstract or non-abstract.\" },\n        Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: { code: 2513, category: ts.DiagnosticCategory.Error, key: \"Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513\", message: \"Abstract method '{0}' in class '{1}' cannot be accessed via super expression.\" },\n        Classes_containing_abstract_methods_must_be_marked_abstract: { code: 2514, category: ts.DiagnosticCategory.Error, key: \"Classes_containing_abstract_methods_must_be_marked_abstract_2514\", message: \"Classes containing abstract methods must be marked abstract.\" },\n        Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: \"Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515\", message: \"Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'.\" },\n        All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: \"All_declarations_of_an_abstract_method_must_be_consecutive_2516\", message: \"All declarations of an abstract method must be consecutive.\" },\n        Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: \"Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517\", message: \"Cannot assign an abstract constructor type to a non-abstract constructor type.\" },\n        A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { code: 2518, category: ts.DiagnosticCategory.Error, key: \"A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518\", message: \"A 'this'-based type guard is not compatible with a parameter-based type guard.\" },\n        Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520\", message: \"Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions.\" },\n        Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: \"Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521\", message: \"Expression resolves to variable declaration '{0}' that compiler uses to support async functions.\" },\n        The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: { code: 2522, category: ts.DiagnosticCategory.Error, key: \"The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522\", message: \"The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method.\" },\n        yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: ts.DiagnosticCategory.Error, key: \"yield_expressions_cannot_be_used_in_a_parameter_initializer_2523\", message: \"'yield' expressions cannot be used in a parameter initializer.\" },\n        await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: ts.DiagnosticCategory.Error, key: \"await_expressions_cannot_be_used_in_a_parameter_initializer_2524\", message: \"'await' expressions cannot be used in a parameter initializer.\" },\n        Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: ts.DiagnosticCategory.Error, key: \"Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525\", message: \"Initializer provides no value for this binding element and the binding element has no default value.\" },\n        A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: { code: 2526, category: ts.DiagnosticCategory.Error, key: \"A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526\", message: \"A 'this' type is available only in a non-static member of a class or interface.\" },\n        The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: { code: 2527, category: ts.DiagnosticCategory.Error, key: \"The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary_2527\", message: \"The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary.\" },\n        A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: \"A_module_cannot_have_multiple_default_exports_2528\", message: \"A module cannot have multiple default exports.\" },\n        Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: { code: 2529, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529\", message: \"Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions.\" },\n        Property_0_is_incompatible_with_index_signature: { code: 2530, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_incompatible_with_index_signature_2530\", message: \"Property '{0}' is incompatible with index signature.\" },\n        Object_is_possibly_null: { code: 2531, category: ts.DiagnosticCategory.Error, key: \"Object_is_possibly_null_2531\", message: \"Object is possibly 'null'.\" },\n        Object_is_possibly_undefined: { code: 2532, category: ts.DiagnosticCategory.Error, key: \"Object_is_possibly_undefined_2532\", message: \"Object is possibly 'undefined'.\" },\n        Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: \"Object_is_possibly_null_or_undefined_2533\", message: \"Object is possibly 'null' or 'undefined'.\" },\n        A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: \"A_function_returning_never_cannot_have_a_reachable_end_point_2534\", message: \"A function returning 'never' cannot have a reachable end point.\" },\n        Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: \"Enum_type_0_has_members_with_initializers_that_are_not_literals_2535\", message: \"Enum type '{0}' has members with initializers that are not literals.\" },\n        Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: \"Type_0_cannot_be_used_to_index_type_1_2536\", message: \"Type '{0}' cannot be used to index type '{1}'.\" },\n        Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: \"Type_0_has_no_matching_index_signature_for_type_1_2537\", message: \"Type '{0}' has no matching index signature for type '{1}'.\" },\n        Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: \"Type_0_cannot_be_used_as_an_index_type_2538\", message: \"Type '{0}' cannot be used as an index type.\" },\n        Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: \"Cannot_assign_to_0_because_it_is_not_a_variable_2539\", message: \"Cannot assign to '{0}' because it is not a variable.\" },\n        Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: \"Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540\", message: \"Cannot assign to '{0}' because it is a constant or a read-only property.\" },\n        The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: \"The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541\", message: \"The target of an assignment must be a variable or a property access.\" },\n        Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: \"Index_signature_in_type_0_only_permits_reading_2542\", message: \"Index signature in type '{0}' only permits reading.\" },\n        JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: \"JSX_element_attributes_type_0_may_not_be_a_union_type_2600\", message: \"JSX element attributes type '{0}' may not be a union type.\" },\n        The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: \"The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601\", message: \"The return type of a JSX element constructor must return an object type.\" },\n        JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: \"JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602\", message: \"JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist.\" },\n        Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: \"Property_0_in_type_1_is_not_assignable_to_type_2_2603\", message: \"Property '{0}' in type '{1}' is not assignable to type '{2}'\" },\n        JSX_element_type_0_does_not_have_any_construct_or_call_signatures: { code: 2604, category: ts.DiagnosticCategory.Error, key: \"JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604\", message: \"JSX element type '{0}' does not have any construct or call signatures.\" },\n        JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: { code: 2605, category: ts.DiagnosticCategory.Error, key: \"JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements_2605\", message: \"JSX element type '{0}' is not a constructor function for JSX elements.\" },\n        Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: \"Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606\", message: \"Property '{0}' of JSX spread attribute is not assignable to target property.\" },\n        JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: \"JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607\", message: \"JSX element class does not support attributes because it does not have a '{0}' property\" },\n        The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: \"The_global_type_JSX_0_may_not_have_more_than_one_property_2608\", message: \"The global type 'JSX.{0}' may not have more than one property\" },\n        Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: \"Cannot_emit_namespaced_JSX_elements_in_React_2650\", message: \"Cannot emit namespaced JSX elements in React\" },\n        A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: \"A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651\", message: \"A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.\" },\n        Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: \"Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652\", message: \"Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead.\" },\n        Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: ts.DiagnosticCategory.Error, key: \"Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653\", message: \"Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'.\" },\n        Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: \"Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654\", message: \"Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.\" },\n        Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: \"Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656\", message: \"Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition.\" },\n        JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: \"JSX_expressions_must_have_one_parent_element_2657\", message: \"JSX expressions must have one parent element\" },\n        Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: \"Type_0_provides_no_match_for_the_signature_1_2658\", message: \"Type '{0}' provides no match for the signature '{1}'\" },\n        super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { code: 2659, category: ts.DiagnosticCategory.Error, key: \"super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659\", message: \"'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.\" },\n        super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { code: 2660, category: ts.DiagnosticCategory.Error, key: \"super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660\", message: \"'super' can only be referenced in members of derived classes or object literal expressions.\" },\n        Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { code: 2661, category: ts.DiagnosticCategory.Error, key: \"Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661\", message: \"Cannot export '{0}'. Only local declarations can be exported from a module.\" },\n        Cannot_find_name_0_Did_you_mean_the_static_member_1_0: { code: 2662, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662\", message: \"Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?\" },\n        Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: { code: 2663, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663\", message: \"Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?\" },\n        Invalid_module_name_in_augmentation_module_0_cannot_be_found: { code: 2664, category: ts.DiagnosticCategory.Error, key: \"Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664\", message: \"Invalid module name in augmentation, module '{0}' cannot be found.\" },\n        Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented: { code: 2665, category: ts.DiagnosticCategory.Error, key: \"Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augm_2665\", message: \"Invalid module name in augmentation. Module '{0}' resolves to an untyped module at '{1}', which cannot be augmented.\" },\n        Exports_and_export_assignments_are_not_permitted_in_module_augmentations: { code: 2666, category: ts.DiagnosticCategory.Error, key: \"Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666\", message: \"Exports and export assignments are not permitted in module augmentations.\" },\n        Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: { code: 2667, category: ts.DiagnosticCategory.Error, key: \"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667\", message: \"Imports are not permitted in module augmentations. Consider moving them to the enclosing external module.\" },\n        export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: { code: 2668, category: ts.DiagnosticCategory.Error, key: \"export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668\", message: \"'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.\" },\n        Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations: { code: 2669, category: ts.DiagnosticCategory.Error, key: \"Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669\", message: \"Augmentations for the global scope can only be directly nested in external modules or ambient module declarations.\" },\n        Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context: { code: 2670, category: ts.DiagnosticCategory.Error, key: \"Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670\", message: \"Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context.\" },\n        Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity: { code: 2671, category: ts.DiagnosticCategory.Error, key: \"Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671\", message: \"Cannot augment module '{0}' because it resolves to a non-module entity.\" },\n        Cannot_assign_a_0_constructor_type_to_a_1_constructor_type: { code: 2672, category: ts.DiagnosticCategory.Error, key: \"Cannot_assign_a_0_constructor_type_to_a_1_constructor_type_2672\", message: \"Cannot assign a '{0}' constructor type to a '{1}' constructor type.\" },\n        Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration: { code: 2673, category: ts.DiagnosticCategory.Error, key: \"Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration_2673\", message: \"Constructor of class '{0}' is private and only accessible within the class declaration.\" },\n        Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: { code: 2674, category: ts.DiagnosticCategory.Error, key: \"Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674\", message: \"Constructor of class '{0}' is protected and only accessible within the class declaration.\" },\n        Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: { code: 2675, category: ts.DiagnosticCategory.Error, key: \"Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675\", message: \"Cannot extend a class '{0}'. Class constructor is marked as private.\" },\n        Accessors_must_both_be_abstract_or_non_abstract: { code: 2676, category: ts.DiagnosticCategory.Error, key: \"Accessors_must_both_be_abstract_or_non_abstract_2676\", message: \"Accessors must both be abstract or non-abstract.\" },\n        A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: { code: 2677, category: ts.DiagnosticCategory.Error, key: \"A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677\", message: \"A type predicate's type must be assignable to its parameter's type.\" },\n        Type_0_is_not_comparable_to_type_1: { code: 2678, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_comparable_to_type_1_2678\", message: \"Type '{0}' is not comparable to type '{1}'.\" },\n        A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: { code: 2679, category: ts.DiagnosticCategory.Error, key: \"A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679\", message: \"A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'.\" },\n        A_this_parameter_must_be_the_first_parameter: { code: 2680, category: ts.DiagnosticCategory.Error, key: \"A_this_parameter_must_be_the_first_parameter_2680\", message: \"A 'this' parameter must be the first parameter.\" },\n        A_constructor_cannot_have_a_this_parameter: { code: 2681, category: ts.DiagnosticCategory.Error, key: \"A_constructor_cannot_have_a_this_parameter_2681\", message: \"A constructor cannot have a 'this' parameter.\" },\n        get_and_set_accessor_must_have_the_same_this_type: { code: 2682, category: ts.DiagnosticCategory.Error, key: \"get_and_set_accessor_must_have_the_same_this_type_2682\", message: \"'get' and 'set' accessor must have the same 'this' type.\" },\n        this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: { code: 2683, category: ts.DiagnosticCategory.Error, key: \"this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_2683\", message: \"'this' implicitly has type 'any' because it does not have a type annotation.\" },\n        The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: { code: 2684, category: ts.DiagnosticCategory.Error, key: \"The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684\", message: \"The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'.\" },\n        The_this_types_of_each_signature_are_incompatible: { code: 2685, category: ts.DiagnosticCategory.Error, key: \"The_this_types_of_each_signature_are_incompatible_2685\", message: \"The 'this' types of each signature are incompatible.\" },\n        _0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead: { code: 2686, category: ts.DiagnosticCategory.Error, key: \"_0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead_2686\", message: \"'{0}' refers to a UMD global, but the current file is a module. Consider adding an import instead.\" },\n        All_declarations_of_0_must_have_identical_modifiers: { code: 2687, category: ts.DiagnosticCategory.Error, key: \"All_declarations_of_0_must_have_identical_modifiers_2687\", message: \"All declarations of '{0}' must have identical modifiers.\" },\n        Cannot_find_type_definition_file_for_0: { code: 2688, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_type_definition_file_for_0_2688\", message: \"Cannot find type definition file for '{0}'.\" },\n        Cannot_extend_an_interface_0_Did_you_mean_implements: { code: 2689, category: ts.DiagnosticCategory.Error, key: \"Cannot_extend_an_interface_0_Did_you_mean_implements_2689\", message: \"Cannot extend an interface '{0}'. Did you mean 'implements'?\" },\n        A_class_must_be_declared_after_its_base_class: { code: 2690, category: ts.DiagnosticCategory.Error, key: \"A_class_must_be_declared_after_its_base_class_2690\", message: \"A class must be declared after its base class.\" },\n        An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: { code: 2691, category: ts.DiagnosticCategory.Error, key: \"An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691\", message: \"An import path cannot end with a '{0}' extension. Consider importing '{1}' instead.\" },\n        _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: { code: 2692, category: ts.DiagnosticCategory.Error, key: \"_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692\", message: \"'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible.\" },\n        _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: { code: 2693, category: ts.DiagnosticCategory.Error, key: \"_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693\", message: \"'{0}' only refers to a type, but is being used as a value here.\" },\n        Namespace_0_has_no_exported_member_1: { code: 2694, category: ts.DiagnosticCategory.Error, key: \"Namespace_0_has_no_exported_member_1_2694\", message: \"Namespace '{0}' has no exported member '{1}'.\" },\n        Left_side_of_comma_operator_is_unused_and_has_no_side_effects: { code: 2695, category: ts.DiagnosticCategory.Error, key: \"Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695\", message: \"Left side of comma operator is unused and has no side effects.\" },\n        The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: \"The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696\", message: \"The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?\" },\n        An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: \"An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697\", message: \"An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option.\" },\n        Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: \"Spread_types_may_only_be_created_from_object_types_2698\", message: \"Spread types may only be created from object types.\" },\n        Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: \"Rest_types_may_only_be_created_from_object_types_2700\", message: \"Rest types may only be created from object types.\" },\n        The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: \"The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701\", message: \"The target of an object rest assignment must be a variable or a property access.\" },\n        _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: \"_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702\", message: \"'{0}' only refers to a type, but is being used as a namespace here.\" },\n        Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: \"Import_declaration_0_is_using_private_name_1_4000\", message: \"Import declaration '{0}' is using private name '{1}'.\" },\n        Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002\", message: \"Type parameter '{0}' of exported class has or is using private name '{1}'.\" },\n        Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004\", message: \"Type parameter '{0}' of exported interface has or is using private name '{1}'.\" },\n        Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4006\", message: \"Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'.\" },\n        Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4008\", message: \"Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'.\" },\n        Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4010\", message: \"Type parameter '{0}' of public static method from exported class has or is using private name '{1}'.\" },\n        Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4012\", message: \"Type parameter '{0}' of public method from exported class has or is using private name '{1}'.\" },\n        Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014\", message: \"Type parameter '{0}' of method from exported interface has or is using private name '{1}'.\" },\n        Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016\", message: \"Type parameter '{0}' of exported function has or is using private name '{1}'.\" },\n        Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: ts.DiagnosticCategory.Error, key: \"Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019\", message: \"Implements clause of exported class '{0}' has or is using private name '{1}'.\" },\n        Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: ts.DiagnosticCategory.Error, key: \"Extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020\", message: \"Extends clause of exported class '{0}' has or is using private name '{1}'.\" },\n        Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: ts.DiagnosticCategory.Error, key: \"Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022\", message: \"Extends clause of exported interface '{0}' has or is using private name '{1}'.\" },\n        Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: ts.DiagnosticCategory.Error, key: \"Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023\", message: \"Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: ts.DiagnosticCategory.Error, key: \"Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024\", message: \"Exported variable '{0}' has or is using name '{1}' from private module '{2}'.\" },\n        Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: ts.DiagnosticCategory.Error, key: \"Exported_variable_0_has_or_is_using_private_name_1_4025\", message: \"Exported variable '{0}' has or is using private name '{1}'.\" },\n        Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: ts.DiagnosticCategory.Error, key: \"Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot__4026\", message: \"Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: ts.DiagnosticCategory.Error, key: \"Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4027\", message: \"Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'.\" },\n        Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: ts.DiagnosticCategory.Error, key: \"Public_static_property_0_of_exported_class_has_or_is_using_private_name_1_4028\", message: \"Public static property '{0}' of exported class has or is using private name '{1}'.\" },\n        Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: ts.DiagnosticCategory.Error, key: \"Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_name_4029\", message: \"Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: ts.DiagnosticCategory.Error, key: \"Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4030\", message: \"Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'.\" },\n        Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: ts.DiagnosticCategory.Error, key: \"Public_property_0_of_exported_class_has_or_is_using_private_name_1_4031\", message: \"Public property '{0}' of exported class has or is using private name '{1}'.\" },\n        Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: ts.DiagnosticCategory.Error, key: \"Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4032\", message: \"Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'.\" },\n        Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: ts.DiagnosticCategory.Error, key: \"Property_0_of_exported_interface_has_or_is_using_private_name_1_4033\", message: \"Property '{0}' of exported interface has or is using private name '{1}'.\" },\n        Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_4034\", message: \"Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1_4035\", message: \"Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'.\" },\n        Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_4036\", message: \"Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1_4037\", message: \"Parameter '{0}' of public property setter from exported class has or is using private name '{1}'.\" },\n        Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_externa_4038\", message: \"Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named.\" },\n        Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_4039\", message: \"Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0_4040\", message: \"Return type of public static property getter from exported class has or is using private name '{0}'.\" },\n        Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_modul_4041\", message: \"Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named.\" },\n        Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_4042\", message: \"Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0_4043\", message: \"Return type of public property getter from exported class has or is using private name '{0}'.\" },\n        Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_mod_4044\", message: \"Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0_4045\", message: \"Return type of constructor signature from exported interface has or is using private name '{0}'.\" },\n        Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4046\", message: \"Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0_4047\", message: \"Return type of call signature from exported interface has or is using private name '{0}'.\" },\n        Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4048\", message: \"Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0_4049\", message: \"Return type of index signature from exported interface has or is using private name '{0}'.\" },\n        Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module__4050\", message: \"Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named.\" },\n        Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4051\", message: \"Return type of public static method from exported class has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052\", message: \"Return type of public static method from exported class has or is using private name '{0}'.\" },\n        Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_c_4053\", message: \"Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named.\" },\n        Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4054\", message: \"Return type of public method from exported class has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0_4055\", message: \"Return type of public method from exported class has or is using private name '{0}'.\" },\n        Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4056\", message: \"Return type of method from exported interface has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0_4057\", message: \"Return type of method from exported interface has or is using private name '{0}'.\" },\n        Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named_4058\", message: \"Return type of exported function has or is using name '{0}' from external module {1} but cannot be named.\" },\n        Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1_4059\", message: \"Return type of exported function has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_exported_function_has_or_is_using_private_name_0_4060\", message: \"Return type of exported function has or is using private name '{0}'.\" },\n        Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_can_4061\", message: \"Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2_4062\", message: \"Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1_4063\", message: \"Parameter '{0}' of constructor from exported class has or is using private name '{1}'.\" },\n        Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_mod_4064\", message: \"Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4065\", message: \"Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'.\" },\n        Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4066\", message: \"Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4067\", message: \"Parameter '{0}' of call signature from exported interface has or is using private name '{1}'.\" },\n        Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module__4068\", message: \"Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4069\", message: \"Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4070\", message: \"Parameter '{0}' of public static method from exported class has or is using private name '{1}'.\" },\n        Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_c_4071\", message: \"Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4072\", message: \"Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4073\", message: \"Parameter '{0}' of public method from exported class has or is using private name '{1}'.\" },\n        Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4074\", message: \"Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4075\", message: \"Parameter '{0}' of method from exported interface has or is using private name '{1}'.\" },\n        Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4076\", message: \"Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2_4077\", message: \"Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078\", message: \"Parameter '{0}' of exported function has or is using private name '{1}'.\" },\n        Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: \"Exported_type_alias_0_has_or_is_using_private_name_1_4081\", message: \"Exported type alias '{0}' has or is using private name '{1}'.\" },\n        Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: \"Default_export_of_the_module_has_or_is_using_private_name_0_4082\", message: \"Default export of the module has or is using private name '{0}'.\" },\n        Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083\", message: \"Type parameter '{0}' of exported type alias has or is using private name '{1}'.\" },\n        Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: \"Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090\", message: \"Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict.\" },\n        Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091\", message: \"Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092\", message: \"Parameter '{0}' of index signature from exported interface has or is using private name '{1}'.\" },\n        The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: \"The_current_host_does_not_support_the_0_option_5001\", message: \"The current host does not support the '{0}' option.\" },\n        Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_the_common_subdirectory_path_for_the_input_files_5009\", message: \"Cannot find the common subdirectory path for the input files.\" },\n        File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: \"File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010\", message: \"File specification cannot end in a recursive directory wildcard ('**'): '{0}'.\" },\n        File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0: { code: 5011, category: ts.DiagnosticCategory.Error, key: \"File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0_5011\", message: \"File specification cannot contain multiple recursive directory wildcards ('**'): '{0}'.\" },\n        Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: \"Cannot_read_file_0_Colon_1_5012\", message: \"Cannot read file '{0}': {1}\" },\n        Unsupported_file_encoding: { code: 5013, category: ts.DiagnosticCategory.Error, key: \"Unsupported_file_encoding_5013\", message: \"Unsupported file encoding.\" },\n        Failed_to_parse_file_0_Colon_1: { code: 5014, category: ts.DiagnosticCategory.Error, key: \"Failed_to_parse_file_0_Colon_1_5014\", message: \"Failed to parse file '{0}': {1}.\" },\n        Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: \"Unknown_compiler_option_0_5023\", message: \"Unknown compiler option '{0}'.\" },\n        Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: \"Compiler_option_0_requires_a_value_of_type_1_5024\", message: \"Compiler option '{0}' requires a value of type {1}.\" },\n        Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: \"Could_not_write_file_0_Colon_1_5033\", message: \"Could not write file '{0}': {1}\" },\n        Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: \"Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042\", message: \"Option 'project' cannot be mixed with source files on a command line.\" },\n        Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: \"Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047\", message: \"Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher.\" },\n        Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: \"Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051\", message: \"Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.\" },\n        Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: \"Option_0_cannot_be_specified_without_specifying_option_1_5052\", message: \"Option '{0}' cannot be specified without specifying option '{1}'.\" },\n        Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: \"Option_0_cannot_be_specified_with_option_1_5053\", message: \"Option '{0}' cannot be specified with option '{1}'.\" },\n        A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: \"A_tsconfig_json_file_is_already_defined_at_Colon_0_5054\", message: \"A 'tsconfig.json' file is already defined at: '{0}'.\" },\n        Cannot_write_file_0_because_it_would_overwrite_input_file: { code: 5055, category: ts.DiagnosticCategory.Error, key: \"Cannot_write_file_0_because_it_would_overwrite_input_file_5055\", message: \"Cannot write file '{0}' because it would overwrite input file.\" },\n        Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { code: 5056, category: ts.DiagnosticCategory.Error, key: \"Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056\", message: \"Cannot write file '{0}' because it would be overwritten by multiple input files.\" },\n        Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057\", message: \"Cannot find a tsconfig.json file at the specified directory: '{0}'\" },\n        The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: \"The_specified_path_does_not_exist_Colon_0_5058\", message: \"The specified path does not exist: '{0}'\" },\n        Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { code: 5059, category: ts.DiagnosticCategory.Error, key: \"Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059\", message: \"Invalid value for '--reactNamespace'. '{0}' is not a valid identifier.\" },\n        Option_paths_cannot_be_used_without_specifying_baseUrl_option: { code: 5060, category: ts.DiagnosticCategory.Error, key: \"Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060\", message: \"Option 'paths' cannot be used without specifying '--baseUrl' option.\" },\n        Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: \"Pattern_0_can_have_at_most_one_Asterisk_character_5061\", message: \"Pattern '{0}' can have at most one '*' character\" },\n        Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: \"Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062\", message: \"Substitution '{0}' in pattern '{1}' in can have at most one '*' character\" },\n        Substitutions_for_pattern_0_should_be_an_array: { code: 5063, category: ts.DiagnosticCategory.Error, key: \"Substitutions_for_pattern_0_should_be_an_array_5063\", message: \"Substitutions for pattern '{0}' should be an array.\" },\n        Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: \"Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064\", message: \"Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'.\" },\n        File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5065, category: ts.DiagnosticCategory.Error, key: \"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065\", message: \"File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'.\" },\n        Substitutions_for_pattern_0_shouldn_t_be_an_empty_array: { code: 5066, category: ts.DiagnosticCategory.Error, key: \"Substitutions_for_pattern_0_shouldn_t_be_an_empty_array_5066\", message: \"Substitutions for pattern '{0}' shouldn't be an empty array.\" },\n        Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name: { code: 5067, category: ts.DiagnosticCategory.Error, key: \"Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067\", message: \"Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name.\" },\n        Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: \"Concatenate_and_emit_output_to_single_file_6001\", message: \"Concatenate and emit output to single file.\" },\n        Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: \"Generates_corresponding_d_ts_file_6002\", message: \"Generates corresponding '.d.ts' file.\" },\n        Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: \"Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003\", message: \"Specify the location where debugger should locate map files instead of generated locations.\" },\n        Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: \"Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004\", message: \"Specify the location where debugger should locate TypeScript files instead of source locations.\" },\n        Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: \"Watch_input_files_6005\", message: \"Watch input files.\" },\n        Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: \"Redirect_output_structure_to_the_directory_6006\", message: \"Redirect output structure to the directory.\" },\n        Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: \"Do_not_erase_const_enum_declarations_in_generated_code_6007\", message: \"Do not erase const enum declarations in generated code.\" },\n        Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: \"Do_not_emit_outputs_if_any_errors_were_reported_6008\", message: \"Do not emit outputs if any errors were reported.\" },\n        Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: \"Do_not_emit_comments_to_output_6009\", message: \"Do not emit comments to output.\" },\n        Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: \"Do_not_emit_outputs_6010\", message: \"Do not emit outputs.\" },\n        Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: \"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011\", message: \"Allow default imports from modules with no default export. This does not affect code emit, just typechecking.\" },\n        Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: \"Skip_type_checking_of_declaration_files_6012\", message: \"Skip type checking of declaration files.\" },\n        Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: \"Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015\", message: \"Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'\" },\n        Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: \"Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016\", message: \"Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'\" },\n        Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: \"Print_this_message_6017\", message: \"Print this message.\" },\n        Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: \"Print_the_compiler_s_version_6019\", message: \"Print the compiler's version.\" },\n        Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: \"Compile_the_project_in_the_given_directory_6020\", message: \"Compile the project in the given directory.\" },\n        Syntax_Colon_0: { code: 6023, category: ts.DiagnosticCategory.Message, key: \"Syntax_Colon_0_6023\", message: \"Syntax: {0}\" },\n        options: { code: 6024, category: ts.DiagnosticCategory.Message, key: \"options_6024\", message: \"options\" },\n        file: { code: 6025, category: ts.DiagnosticCategory.Message, key: \"file_6025\", message: \"file\" },\n        Examples_Colon_0: { code: 6026, category: ts.DiagnosticCategory.Message, key: \"Examples_Colon_0_6026\", message: \"Examples: {0}\" },\n        Options_Colon: { code: 6027, category: ts.DiagnosticCategory.Message, key: \"Options_Colon_6027\", message: \"Options:\" },\n        Version_0: { code: 6029, category: ts.DiagnosticCategory.Message, key: \"Version_0_6029\", message: \"Version {0}\" },\n        Insert_command_line_options_and_files_from_a_file: { code: 6030, category: ts.DiagnosticCategory.Message, key: \"Insert_command_line_options_and_files_from_a_file_6030\", message: \"Insert command line options and files from a file.\" },\n        File_change_detected_Starting_incremental_compilation: { code: 6032, category: ts.DiagnosticCategory.Message, key: \"File_change_detected_Starting_incremental_compilation_6032\", message: \"File change detected. Starting incremental compilation...\" },\n        KIND: { code: 6034, category: ts.DiagnosticCategory.Message, key: \"KIND_6034\", message: \"KIND\" },\n        FILE: { code: 6035, category: ts.DiagnosticCategory.Message, key: \"FILE_6035\", message: \"FILE\" },\n        VERSION: { code: 6036, category: ts.DiagnosticCategory.Message, key: \"VERSION_6036\", message: \"VERSION\" },\n        LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: \"LOCATION_6037\", message: \"LOCATION\" },\n        DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: \"DIRECTORY_6038\", message: \"DIRECTORY\" },\n        STRATEGY: { code: 6039, category: ts.DiagnosticCategory.Message, key: \"STRATEGY_6039\", message: \"STRATEGY\" },\n        Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: \"Compilation_complete_Watching_for_file_changes_6042\", message: \"Compilation complete. Watching for file changes.\" },\n        Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: \"Generates_corresponding_map_file_6043\", message: \"Generates corresponding '.map' file.\" },\n        Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: \"Compiler_option_0_expects_an_argument_6044\", message: \"Compiler option '{0}' expects an argument.\" },\n        Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: \"Unterminated_quoted_string_in_response_file_0_6045\", message: \"Unterminated quoted string in response file '{0}'.\" },\n        Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: \"Argument_for_0_option_must_be_Colon_1_6046\", message: \"Argument for '{0}' option must be: {1}\" },\n        Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: \"Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048\", message: \"Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'.\" },\n        Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: \"Unsupported_locale_0_6049\", message: \"Unsupported locale '{0}'.\" },\n        Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: \"Unable_to_open_file_0_6050\", message: \"Unable to open file '{0}'.\" },\n        Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: \"Corrupted_locale_file_0_6051\", message: \"Corrupted locale file {0}.\" },\n        Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: \"Raise_error_on_expressions_and_declarations_with_an_implied_any_type_6052\", message: \"Raise error on expressions and declarations with an implied 'any' type.\" },\n        File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: \"File_0_not_found_6053\", message: \"File '{0}' not found.\" },\n        File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: \"File_0_has_unsupported_extension_The_only_supported_extensions_are_1_6054\", message: \"File '{0}' has unsupported extension. The only supported extensions are {1}.\" },\n        Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: \"Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055\", message: \"Suppress noImplicitAny errors for indexing objects lacking index signatures.\" },\n        Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: \"Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056\", message: \"Do not emit declarations for code that has an '@internal' annotation.\" },\n        Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: \"Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058\", message: \"Specify the root directory of input files. Use to control the output directory structure with --outDir.\" },\n        File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: \"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059\", message: \"File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files.\" },\n        Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: \"Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060\", message: \"Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix).\" },\n        NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: \"NEWLINE_6061\", message: \"NEWLINE\" },\n        Option_0_can_only_be_specified_in_tsconfig_json_file: { code: 6064, category: ts.DiagnosticCategory.Error, key: \"Option_0_can_only_be_specified_in_tsconfig_json_file_6064\", message: \"Option '{0}' can only be specified in 'tsconfig.json' file.\" },\n        Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: \"Enables_experimental_support_for_ES7_decorators_6065\", message: \"Enables experimental support for ES7 decorators.\" },\n        Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: \"Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066\", message: \"Enables experimental support for emitting type metadata for decorators.\" },\n        Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: \"Enables_experimental_support_for_ES7_async_functions_6068\", message: \"Enables experimental support for ES7 async functions.\" },\n        Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: \"Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069\", message: \"Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6).\" },\n        Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: \"Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070\", message: \"Initializes a TypeScript project and creates a tsconfig.json file.\" },\n        Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: \"Successfully_created_a_tsconfig_json_file_6071\", message: \"Successfully created a tsconfig.json file.\" },\n        Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: \"Suppress_excess_property_checks_for_object_literals_6072\", message: \"Suppress excess property checks for object literals.\" },\n        Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: \"Stylize_errors_and_messages_using_color_and_context_experimental_6073\", message: \"Stylize errors and messages using color and context. (experimental)\" },\n        Do_not_report_errors_on_unused_labels: { code: 6074, category: ts.DiagnosticCategory.Message, key: \"Do_not_report_errors_on_unused_labels_6074\", message: \"Do not report errors on unused labels.\" },\n        Report_error_when_not_all_code_paths_in_function_return_a_value: { code: 6075, category: ts.DiagnosticCategory.Message, key: \"Report_error_when_not_all_code_paths_in_function_return_a_value_6075\", message: \"Report error when not all code paths in function return a value.\" },\n        Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: \"Report_errors_for_fallthrough_cases_in_switch_statement_6076\", message: \"Report errors for fallthrough cases in switch statement.\" },\n        Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: \"Do_not_report_errors_on_unreachable_code_6077\", message: \"Do not report errors on unreachable code.\" },\n        Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: \"Disallow_inconsistently_cased_references_to_the_same_file_6078\", message: \"Disallow inconsistently-cased references to the same file.\" },\n        Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: \"Specify_library_files_to_be_included_in_the_compilation_Colon_6079\", message: \"Specify library files to be included in the compilation: \" },\n        Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: \"Specify_JSX_code_generation_Colon_preserve_or_react_6080\", message: \"Specify JSX code generation: 'preserve' or 'react'\" },\n        Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: \"Only_amd_and_system_modules_are_supported_alongside_0_6082\", message: \"Only 'amd' and 'system' modules are supported alongside --{0}.\" },\n        Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: \"Base_directory_to_resolve_non_absolute_module_names_6083\", message: \"Base directory to resolve non-absolute module names.\" },\n        Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: \"Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084\", message: \"Specify the object invoked for createElement and __spread when targeting 'react' JSX emit\" },\n        Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: \"Enable_tracing_of_the_name_resolution_process_6085\", message: \"Enable tracing of the name resolution process.\" },\n        Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: \"Resolving_module_0_from_1_6086\", message: \"======== Resolving module '{0}' from '{1}'. ========\" },\n        Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: \"Explicitly_specified_module_resolution_kind_Colon_0_6087\", message: \"Explicitly specified module resolution kind: '{0}'.\" },\n        Module_resolution_kind_is_not_specified_using_0: { code: 6088, category: ts.DiagnosticCategory.Message, key: \"Module_resolution_kind_is_not_specified_using_0_6088\", message: \"Module resolution kind is not specified, using '{0}'.\" },\n        Module_name_0_was_successfully_resolved_to_1: { code: 6089, category: ts.DiagnosticCategory.Message, key: \"Module_name_0_was_successfully_resolved_to_1_6089\", message: \"======== Module name '{0}' was successfully resolved to '{1}'. ========\" },\n        Module_name_0_was_not_resolved: { code: 6090, category: ts.DiagnosticCategory.Message, key: \"Module_name_0_was_not_resolved_6090\", message: \"======== Module name '{0}' was not resolved. ========\" },\n        paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0: { code: 6091, category: ts.DiagnosticCategory.Message, key: \"paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091\", message: \"'paths' option is specified, looking for a pattern to match module name '{0}'.\" },\n        Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: \"Module_name_0_matched_pattern_1_6092\", message: \"Module name '{0}', matched pattern '{1}'.\" },\n        Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: \"Trying_substitution_0_candidate_module_location_Colon_1_6093\", message: \"Trying substitution '{0}', candidate module location: '{1}'.\" },\n        Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: \"Resolving_module_name_0_relative_to_base_url_1_2_6094\", message: \"Resolving module name '{0}' relative to base url '{1}' - '{2}'.\" },\n        Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: \"Loading_module_as_file_Slash_folder_candidate_module_location_0_6095\", message: \"Loading module as file / folder, candidate module location '{0}'.\" },\n        File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: \"File_0_does_not_exist_6096\", message: \"File '{0}' does not exist.\" },\n        File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: \"File_0_exist_use_it_as_a_name_resolution_result_6097\", message: \"File '{0}' exist - use it as a name resolution result.\" },\n        Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: \"Loading_module_0_from_node_modules_folder_6098\", message: \"Loading module '{0}' from 'node_modules' folder.\" },\n        Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: \"Found_package_json_at_0_6099\", message: \"Found 'package.json' at '{0}'.\" },\n        package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: \"package_json_does_not_have_a_types_or_main_field_6100\", message: \"'package.json' does not have a 'types' or 'main' field.\" },\n        package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: \"package_json_has_0_field_1_that_references_2_6101\", message: \"'package.json' has '{0}' field '{1}' that references '{2}'.\" },\n        Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: \"Allow_javascript_files_to_be_compiled_6102\", message: \"Allow javascript files to be compiled.\" },\n        Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: \"Option_0_should_have_array_of_strings_as_a_value_6103\", message: \"Option '{0}' should have array of strings as a value.\" },\n        Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: \"Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104\", message: \"Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'.\" },\n        Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: \"Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105\", message: \"Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'.\" },\n        baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: \"baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106\", message: \"'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'\" },\n        rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: \"rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107\", message: \"'rootDirs' option is set, using it to resolve relative module name '{0}'\" },\n        Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: \"Longest_matching_prefix_for_0_is_1_6108\", message: \"Longest matching prefix for '{0}' is '{1}'\" },\n        Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: \"Loading_0_from_the_root_dir_1_candidate_location_2_6109\", message: \"Loading '{0}' from the root dir '{1}', candidate location '{2}'\" },\n        Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: \"Trying_other_entries_in_rootDirs_6110\", message: \"Trying other entries in 'rootDirs'\" },\n        Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: \"Module_resolution_using_rootDirs_has_failed_6111\", message: \"Module resolution using 'rootDirs' has failed\" },\n        Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: \"Do_not_emit_use_strict_directives_in_module_output_6112\", message: \"Do not emit 'use strict' directives in module output.\" },\n        Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: \"Enable_strict_null_checks_6113\", message: \"Enable strict null checks.\" },\n        Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: \"Unknown_option_excludes_Did_you_mean_exclude_6114\", message: \"Unknown option 'excludes'. Did you mean 'exclude'?\" },\n        Raise_error_on_this_expressions_with_an_implied_any_type: { code: 6115, category: ts.DiagnosticCategory.Message, key: \"Raise_error_on_this_expressions_with_an_implied_any_type_6115\", message: \"Raise error on 'this' expressions with an implied 'any' type.\" },\n        Resolving_type_reference_directive_0_containing_file_1_root_directory_2: { code: 6116, category: ts.DiagnosticCategory.Message, key: \"Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116\", message: \"======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========\" },\n        Resolving_using_primary_search_paths: { code: 6117, category: ts.DiagnosticCategory.Message, key: \"Resolving_using_primary_search_paths_6117\", message: \"Resolving using primary search paths...\" },\n        Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: \"Resolving_from_node_modules_folder_6118\", message: \"Resolving from node_modules folder...\" },\n        Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: \"Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119\", message: \"======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========\" },\n        Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: \"Type_reference_directive_0_was_not_resolved_6120\", message: \"======== Type reference directive '{0}' was not resolved. ========\" },\n        Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: \"Resolving_with_primary_search_path_0_6121\", message: \"Resolving with primary search path '{0}'\" },\n        Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: \"Root_directory_cannot_be_determined_skipping_primary_search_paths_6122\", message: \"Root directory cannot be determined, skipping primary search paths.\" },\n        Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: \"Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123\", message: \"======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========\" },\n        Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: \"Type_declaration_files_to_be_included_in_compilation_6124\", message: \"Type declaration files to be included in compilation.\" },\n        Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: \"Looking_up_in_node_modules_folder_initial_location_0_6125\", message: \"Looking up in 'node_modules' folder, initial location '{0}'\" },\n        Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: \"Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126\", message: \"Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder.\" },\n        Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: \"Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127\", message: \"======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========\" },\n        Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: \"Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128\", message: \"======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========\" },\n        The_config_file_0_found_doesn_t_contain_any_source_files: { code: 6129, category: ts.DiagnosticCategory.Error, key: \"The_config_file_0_found_doesn_t_contain_any_source_files_6129\", message: \"The config file '{0}' found doesn't contain any source files.\" },\n        Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: \"Resolving_real_path_for_0_result_1_6130\", message: \"Resolving real path for '{0}', result '{1}'\" },\n        Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: \"Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131\", message: \"Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'.\" },\n        File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: \"File_name_0_has_a_1_extension_stripping_it_6132\", message: \"File name '{0}' has a '{1}' extension - stripping it\" },\n        _0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: \"_0_is_declared_but_never_used_6133\", message: \"'{0}' is declared but never used.\" },\n        Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: \"Report_errors_on_unused_locals_6134\", message: \"Report errors on unused locals.\" },\n        Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: \"Report_errors_on_unused_parameters_6135\", message: \"Report errors on unused parameters.\" },\n        The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: \"The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136\", message: \"The maximum dependency depth to search under node_modules and load JavaScript files\" },\n        No_types_specified_in_package_json_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: \"No_types_specified_in_package_json_so_returning_main_value_of_0_6137\", message: \"No types specified in 'package.json', so returning 'main' value of '{0}'\" },\n        Property_0_is_declared_but_never_used: { code: 6138, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_declared_but_never_used_6138\", message: \"Property '{0}' is declared but never used.\" },\n        Import_emit_helpers_from_tslib: { code: 6139, category: ts.DiagnosticCategory.Message, key: \"Import_emit_helpers_from_tslib_6139\", message: \"Import emit helpers from 'tslib'.\" },\n        Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: { code: 6140, category: ts.DiagnosticCategory.Error, key: \"Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140\", message: \"Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'.\" },\n        Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: \"Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141\", message: \"Parse in strict mode and emit \\\"use strict\\\" for each source file\" },\n        Module_0_was_resolved_to_1_but_jsx_is_not_set: { code: 6142, category: ts.DiagnosticCategory.Error, key: \"Module_0_was_resolved_to_1_but_jsx_is_not_set_6142\", message: \"Module '{0}' was resolved to '{1}', but '--jsx' is not set.\" },\n        Module_0_was_resolved_to_1_but_allowJs_is_not_set: { code: 6143, category: ts.DiagnosticCategory.Error, key: \"Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143\", message: \"Module '{0}' was resolved to '{1}', but '--allowJs' is not set.\" },\n        Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: \"Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144\", message: \"Module '{0}' was resolved as locally declared ambient module in file '{1}'.\" },\n        Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: \"Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145\", message: \"Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified.\" },\n        Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: \"Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146\", message: \"Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'.\" },\n        Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: \"Variable_0_implicitly_has_an_1_type_7005\", message: \"Variable '{0}' implicitly has an '{1}' type.\" },\n        Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_implicitly_has_an_1_type_7006\", message: \"Parameter '{0}' implicitly has an '{1}' type.\" },\n        Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: \"Member_0_implicitly_has_an_1_type_7008\", message: \"Member '{0}' implicitly has an '{1}' type.\" },\n        new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: ts.DiagnosticCategory.Error, key: \"new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009\", message: \"'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.\" },\n        _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: ts.DiagnosticCategory.Error, key: \"_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010\", message: \"'{0}', which lacks return-type annotation, implicitly has an '{1}' return type.\" },\n        Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: ts.DiagnosticCategory.Error, key: \"Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011\", message: \"Function expression, which lacks return-type annotation, implicitly has an '{0}' return type.\" },\n        Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: ts.DiagnosticCategory.Error, key: \"Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013\", message: \"Construct signature, which lacks return-type annotation, implicitly has an 'any' return type.\" },\n        Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: { code: 7015, category: ts.DiagnosticCategory.Error, key: \"Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015\", message: \"Element implicitly has an 'any' type because index expression is not of type 'number'.\" },\n        Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type: { code: 7016, category: ts.DiagnosticCategory.Error, key: \"Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type_7016\", message: \"Could not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type.\" },\n        Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature: { code: 7017, category: ts.DiagnosticCategory.Error, key: \"Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017\", message: \"Element implicitly has an 'any' type because type '{0}' has no index signature.\" },\n        Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: \"Object_literal_s_property_0_implicitly_has_an_1_type_7018\", message: \"Object literal's property '{0}' implicitly has an '{1}' type.\" },\n        Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: \"Rest_parameter_0_implicitly_has_an_any_type_7019\", message: \"Rest parameter '{0}' implicitly has an 'any[]' type.\" },\n        Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: \"Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020\", message: \"Call signature, which lacks return-type annotation, implicitly has an 'any' return type.\" },\n        _0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: \"_0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or__7022\", message: \"'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.\" },\n        _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: \"_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023\", message: \"'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.\" },\n        Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: \"Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024\", message: \"Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.\" },\n        Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: ts.DiagnosticCategory.Error, key: \"Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025\", message: \"Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type.\" },\n        JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: \"JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026\", message: \"JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists\" },\n        Unreachable_code_detected: { code: 7027, category: ts.DiagnosticCategory.Error, key: \"Unreachable_code_detected_7027\", message: \"Unreachable code detected.\" },\n        Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: \"Unused_label_7028\", message: \"Unused label.\" },\n        Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: \"Fallthrough_case_in_switch_7029\", message: \"Fallthrough case in switch.\" },\n        Not_all_code_paths_return_a_value: { code: 7030, category: ts.DiagnosticCategory.Error, key: \"Not_all_code_paths_return_a_value_7030\", message: \"Not all code paths return a value.\" },\n        Binding_element_0_implicitly_has_an_1_type: { code: 7031, category: ts.DiagnosticCategory.Error, key: \"Binding_element_0_implicitly_has_an_1_type_7031\", message: \"Binding element '{0}' implicitly has an '{1}' type.\" },\n        Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation: { code: 7032, category: ts.DiagnosticCategory.Error, key: \"Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation_7032\", message: \"Property '{0}' implicitly has type 'any', because its set accessor lacks a parameter type annotation.\" },\n        Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation: { code: 7033, category: ts.DiagnosticCategory.Error, key: \"Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation_7033\", message: \"Property '{0}' implicitly has type 'any', because its get accessor lacks a return type annotation.\" },\n        Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined: { code: 7034, category: ts.DiagnosticCategory.Error, key: \"Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined_7034\", message: \"Variable '{0}' implicitly has type '{1}' in some locations where its type cannot be determined.\" },\n        You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: \"You_cannot_rename_this_element_8000\", message: \"You cannot rename this element.\" },\n        You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: \"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001\", message: \"You cannot rename elements that are defined in the standard TypeScript library.\" },\n        import_can_only_be_used_in_a_ts_file: { code: 8002, category: ts.DiagnosticCategory.Error, key: \"import_can_only_be_used_in_a_ts_file_8002\", message: \"'import ... =' can only be used in a .ts file.\" },\n        export_can_only_be_used_in_a_ts_file: { code: 8003, category: ts.DiagnosticCategory.Error, key: \"export_can_only_be_used_in_a_ts_file_8003\", message: \"'export=' can only be used in a .ts file.\" },\n        type_parameter_declarations_can_only_be_used_in_a_ts_file: { code: 8004, category: ts.DiagnosticCategory.Error, key: \"type_parameter_declarations_can_only_be_used_in_a_ts_file_8004\", message: \"'type parameter declarations' can only be used in a .ts file.\" },\n        implements_clauses_can_only_be_used_in_a_ts_file: { code: 8005, category: ts.DiagnosticCategory.Error, key: \"implements_clauses_can_only_be_used_in_a_ts_file_8005\", message: \"'implements clauses' can only be used in a .ts file.\" },\n        interface_declarations_can_only_be_used_in_a_ts_file: { code: 8006, category: ts.DiagnosticCategory.Error, key: \"interface_declarations_can_only_be_used_in_a_ts_file_8006\", message: \"'interface declarations' can only be used in a .ts file.\" },\n        module_declarations_can_only_be_used_in_a_ts_file: { code: 8007, category: ts.DiagnosticCategory.Error, key: \"module_declarations_can_only_be_used_in_a_ts_file_8007\", message: \"'module declarations' can only be used in a .ts file.\" },\n        type_aliases_can_only_be_used_in_a_ts_file: { code: 8008, category: ts.DiagnosticCategory.Error, key: \"type_aliases_can_only_be_used_in_a_ts_file_8008\", message: \"'type aliases' can only be used in a .ts file.\" },\n        _0_can_only_be_used_in_a_ts_file: { code: 8009, category: ts.DiagnosticCategory.Error, key: \"_0_can_only_be_used_in_a_ts_file_8009\", message: \"'{0}' can only be used in a .ts file.\" },\n        types_can_only_be_used_in_a_ts_file: { code: 8010, category: ts.DiagnosticCategory.Error, key: \"types_can_only_be_used_in_a_ts_file_8010\", message: \"'types' can only be used in a .ts file.\" },\n        type_arguments_can_only_be_used_in_a_ts_file: { code: 8011, category: ts.DiagnosticCategory.Error, key: \"type_arguments_can_only_be_used_in_a_ts_file_8011\", message: \"'type arguments' can only be used in a .ts file.\" },\n        parameter_modifiers_can_only_be_used_in_a_ts_file: { code: 8012, category: ts.DiagnosticCategory.Error, key: \"parameter_modifiers_can_only_be_used_in_a_ts_file_8012\", message: \"'parameter modifiers' can only be used in a .ts file.\" },\n        enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: ts.DiagnosticCategory.Error, key: \"enum_declarations_can_only_be_used_in_a_ts_file_8015\", message: \"'enum declarations' can only be used in a .ts file.\" },\n        type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: \"type_assertion_expressions_can_only_be_used_in_a_ts_file_8016\", message: \"'type assertion expressions' can only be used in a .ts file.\" },\n        Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: \"Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002\", message: \"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.\" },\n        class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: \"class_expressions_are_not_currently_supported_9003\", message: \"'class' expressions are not currently supported.\" },\n        Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: \"Language_service_is_disabled_9004\", message: \"Language service is disabled.\" },\n        JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: \"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000\", message: \"JSX attributes must only be assigned a non-empty 'expression'.\" },\n        JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: ts.DiagnosticCategory.Error, key: \"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001\", message: \"JSX elements cannot have multiple attributes with the same name.\" },\n        Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: \"Expected_corresponding_JSX_closing_tag_for_0_17002\", message: \"Expected corresponding JSX closing tag for '{0}'.\" },\n        JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: \"JSX_attribute_expected_17003\", message: \"JSX attribute expected.\" },\n        Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: \"Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004\", message: \"Cannot use JSX unless the '--jsx' flag is provided.\" },\n        A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: \"A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005\", message: \"A constructor cannot contain a 'super' call when its class extends 'null'\" },\n        An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: \"An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006\", message: \"An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.\" },\n        A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: \"A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007\", message: \"A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.\" },\n        JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: \"JSX_element_0_has_no_corresponding_closing_tag_17008\", message: \"JSX element '{0}' has no corresponding closing tag.\" },\n        super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: \"super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009\", message: \"'super' must be called before accessing 'this' in the constructor of a derived class.\" },\n        Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: \"Unknown_type_acquisition_option_0_17010\", message: \"Unknown type acquisition option '{0}'.\" },\n        Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: \"Circularity_detected_while_resolving_configuration_Colon_0_18000\", message: \"Circularity detected while resolving configuration: {0}\" },\n        A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: \"A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001\", message: \"A path in an 'extends' option must be relative or rooted, but '{0}' is not.\" },\n        The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: \"The_files_list_in_config_file_0_is_empty_18002\", message: \"The 'files' list in config file '{0}' is empty.\" },\n        No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: \"No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003\", message: \"No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'.\" },\n        Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: \"Add_missing_super_call_90001\", message: \"Add missing 'super()' call.\" },\n        Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: \"Make_super_call_the_first_statement_in_the_constructor_90002\", message: \"Make 'super()' call the first statement in the constructor.\" },\n        Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: \"Change_extends_to_implements_90003\", message: \"Change 'extends' to 'implements'\" },\n        Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: \"Remove_unused_identifiers_90004\", message: \"Remove unused identifiers\" },\n        Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: \"Implement_interface_on_reference_90005\", message: \"Implement interface on reference\" },\n        Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: \"Implement_interface_on_class_90006\", message: \"Implement interface on class\" },\n        Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: \"Implement_inherited_abstract_class_90007\", message: \"Implement inherited abstract class\" },\n        Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: \"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009\", message: \"Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig\" },\n        Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010\", message: \"Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated.\" },\n        Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: \"Import_0_from_1_90013\", message: \"Import {0} from {1}\" },\n        Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: \"Change_0_to_1_90014\", message: \"Change {0} to {1}\" },\n        Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: \"Add_0_to_existing_import_declaration_from_1_90015\", message: \"Add {0} to existing import declaration from {1}\" },\n    };\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function tokenIsIdentifierOrKeyword(token) {\n        return token >= 70;\n    }\n    ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword;\n    var textToToken = ts.createMap({\n        \"abstract\": 116,\n        \"any\": 118,\n        \"as\": 117,\n        \"boolean\": 121,\n        \"break\": 71,\n        \"case\": 72,\n        \"catch\": 73,\n        \"class\": 74,\n        \"continue\": 76,\n        \"const\": 75,\n        \"constructor\": 122,\n        \"debugger\": 77,\n        \"declare\": 123,\n        \"default\": 78,\n        \"delete\": 79,\n        \"do\": 80,\n        \"else\": 81,\n        \"enum\": 82,\n        \"export\": 83,\n        \"extends\": 84,\n        \"false\": 85,\n        \"finally\": 86,\n        \"for\": 87,\n        \"from\": 138,\n        \"function\": 88,\n        \"get\": 124,\n        \"if\": 89,\n        \"implements\": 107,\n        \"import\": 90,\n        \"in\": 91,\n        \"instanceof\": 92,\n        \"interface\": 108,\n        \"is\": 125,\n        \"keyof\": 126,\n        \"let\": 109,\n        \"module\": 127,\n        \"namespace\": 128,\n        \"never\": 129,\n        \"new\": 93,\n        \"null\": 94,\n        \"number\": 132,\n        \"package\": 110,\n        \"private\": 111,\n        \"protected\": 112,\n        \"public\": 113,\n        \"readonly\": 130,\n        \"require\": 131,\n        \"global\": 139,\n        \"return\": 95,\n        \"set\": 133,\n        \"static\": 114,\n        \"string\": 134,\n        \"super\": 96,\n        \"switch\": 97,\n        \"symbol\": 135,\n        \"this\": 98,\n        \"throw\": 99,\n        \"true\": 100,\n        \"try\": 101,\n        \"type\": 136,\n        \"typeof\": 102,\n        \"undefined\": 137,\n        \"var\": 103,\n        \"void\": 104,\n        \"while\": 105,\n        \"with\": 106,\n        \"yield\": 115,\n        \"async\": 119,\n        \"await\": 120,\n        \"of\": 140,\n        \"{\": 16,\n        \"}\": 17,\n        \"(\": 18,\n        \")\": 19,\n        \"[\": 20,\n        \"]\": 21,\n        \".\": 22,\n        \"...\": 23,\n        \";\": 24,\n        \",\": 25,\n        \"<\": 26,\n        \">\": 28,\n        \"<=\": 29,\n        \">=\": 30,\n        \"==\": 31,\n        \"!=\": 32,\n        \"===\": 33,\n        \"!==\": 34,\n        \"=>\": 35,\n        \"+\": 36,\n        \"-\": 37,\n        \"**\": 39,\n        \"*\": 38,\n        \"/\": 40,\n        \"%\": 41,\n        \"++\": 42,\n        \"--\": 43,\n        \"<<\": 44,\n        \"</\": 27,\n        \">>\": 45,\n        \">>>\": 46,\n        \"&\": 47,\n        \"|\": 48,\n        \"^\": 49,\n        \"!\": 50,\n        \"~\": 51,\n        \"&&\": 52,\n        \"||\": 53,\n        \"?\": 54,\n        \":\": 55,\n        \"=\": 57,\n        \"+=\": 58,\n        \"-=\": 59,\n        \"*=\": 60,\n        \"**=\": 61,\n        \"/=\": 62,\n        \"%=\": 63,\n        \"<<=\": 64,\n        \">>=\": 65,\n        \">>>=\": 66,\n        \"&=\": 67,\n        \"|=\": 68,\n        \"^=\": 69,\n        \"@\": 56,\n    });\n    var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];\n    var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];\n    var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];\n    var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];\n    function lookupInUnicodeMap(code, map) {\n        if (code < map[0]) {\n            return false;\n        }\n        var lo = 0;\n        var hi = map.length;\n        var mid;\n        while (lo + 1 < hi) {\n            mid = lo + (hi - lo) / 2;\n            mid -= mid % 2;\n            if (map[mid] <= code && code <= map[mid + 1]) {\n                return true;\n            }\n            if (code < map[mid]) {\n                hi = mid;\n            }\n            else {\n                lo = mid + 2;\n            }\n        }\n        return false;\n    }\n    function isUnicodeIdentifierStart(code, languageVersion) {\n        return languageVersion >= 1 ?\n            lookupInUnicodeMap(code, unicodeES5IdentifierStart) :\n            lookupInUnicodeMap(code, unicodeES3IdentifierStart);\n    }\n    ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart;\n    function isUnicodeIdentifierPart(code, languageVersion) {\n        return languageVersion >= 1 ?\n            lookupInUnicodeMap(code, unicodeES5IdentifierPart) :\n            lookupInUnicodeMap(code, unicodeES3IdentifierPart);\n    }\n    function makeReverseMap(source) {\n        var result = [];\n        for (var name_4 in source) {\n            result[source[name_4]] = name_4;\n        }\n        return result;\n    }\n    var tokenStrings = makeReverseMap(textToToken);\n    function tokenToString(t) {\n        return tokenStrings[t];\n    }\n    ts.tokenToString = tokenToString;\n    function stringToToken(s) {\n        return textToToken[s];\n    }\n    ts.stringToToken = stringToToken;\n    function computeLineStarts(text) {\n        var result = new Array();\n        var pos = 0;\n        var lineStart = 0;\n        while (pos < text.length) {\n            var ch = text.charCodeAt(pos);\n            pos++;\n            switch (ch) {\n                case 13:\n                    if (text.charCodeAt(pos) === 10) {\n                        pos++;\n                    }\n                case 10:\n                    result.push(lineStart);\n                    lineStart = pos;\n                    break;\n                default:\n                    if (ch > 127 && isLineBreak(ch)) {\n                        result.push(lineStart);\n                        lineStart = pos;\n                    }\n                    break;\n            }\n        }\n        result.push(lineStart);\n        return result;\n    }\n    ts.computeLineStarts = computeLineStarts;\n    function getPositionOfLineAndCharacter(sourceFile, line, character) {\n        return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character);\n    }\n    ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter;\n    function computePositionOfLineAndCharacter(lineStarts, line, character) {\n        ts.Debug.assert(line >= 0 && line < lineStarts.length);\n        return lineStarts[line] + character;\n    }\n    ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter;\n    function getLineStarts(sourceFile) {\n        return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text));\n    }\n    ts.getLineStarts = getLineStarts;\n    function computeLineAndCharacterOfPosition(lineStarts, position) {\n        var lineNumber = ts.binarySearch(lineStarts, position);\n        if (lineNumber < 0) {\n            lineNumber = ~lineNumber - 1;\n            ts.Debug.assert(lineNumber !== -1, \"position cannot precede the beginning of the file\");\n        }\n        return {\n            line: lineNumber,\n            character: position - lineStarts[lineNumber]\n        };\n    }\n    ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition;\n    function getLineAndCharacterOfPosition(sourceFile, position) {\n        return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position);\n    }\n    ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition;\n    var hasOwnProperty = Object.prototype.hasOwnProperty;\n    function isWhiteSpace(ch) {\n        return isWhiteSpaceSingleLine(ch) || isLineBreak(ch);\n    }\n    ts.isWhiteSpace = isWhiteSpace;\n    function isWhiteSpaceSingleLine(ch) {\n        return ch === 32 ||\n            ch === 9 ||\n            ch === 11 ||\n            ch === 12 ||\n            ch === 160 ||\n            ch === 133 ||\n            ch === 5760 ||\n            ch >= 8192 && ch <= 8203 ||\n            ch === 8239 ||\n            ch === 8287 ||\n            ch === 12288 ||\n            ch === 65279;\n    }\n    ts.isWhiteSpaceSingleLine = isWhiteSpaceSingleLine;\n    function isLineBreak(ch) {\n        return ch === 10 ||\n            ch === 13 ||\n            ch === 8232 ||\n            ch === 8233;\n    }\n    ts.isLineBreak = isLineBreak;\n    function isDigit(ch) {\n        return ch >= 48 && ch <= 57;\n    }\n    function isOctalDigit(ch) {\n        return ch >= 48 && ch <= 55;\n    }\n    ts.isOctalDigit = isOctalDigit;\n    function couldStartTrivia(text, pos) {\n        var ch = text.charCodeAt(pos);\n        switch (ch) {\n            case 13:\n            case 10:\n            case 9:\n            case 11:\n            case 12:\n            case 32:\n            case 47:\n            case 60:\n            case 61:\n            case 62:\n                return true;\n            case 35:\n                return pos === 0;\n            default:\n                return ch > 127;\n        }\n    }\n    ts.couldStartTrivia = couldStartTrivia;\n    function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments) {\n        if (stopAtComments === void 0) { stopAtComments = false; }\n        if (ts.positionIsSynthesized(pos)) {\n            return pos;\n        }\n        while (true) {\n            var ch = text.charCodeAt(pos);\n            switch (ch) {\n                case 13:\n                    if (text.charCodeAt(pos + 1) === 10) {\n                        pos++;\n                    }\n                case 10:\n                    pos++;\n                    if (stopAfterLineBreak) {\n                        return pos;\n                    }\n                    continue;\n                case 9:\n                case 11:\n                case 12:\n                case 32:\n                    pos++;\n                    continue;\n                case 47:\n                    if (stopAtComments) {\n                        break;\n                    }\n                    if (text.charCodeAt(pos + 1) === 47) {\n                        pos += 2;\n                        while (pos < text.length) {\n                            if (isLineBreak(text.charCodeAt(pos))) {\n                                break;\n                            }\n                            pos++;\n                        }\n                        continue;\n                    }\n                    if (text.charCodeAt(pos + 1) === 42) {\n                        pos += 2;\n                        while (pos < text.length) {\n                            if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) {\n                                pos += 2;\n                                break;\n                            }\n                            pos++;\n                        }\n                        continue;\n                    }\n                    break;\n                case 60:\n                case 61:\n                case 62:\n                    if (isConflictMarkerTrivia(text, pos)) {\n                        pos = scanConflictMarkerTrivia(text, pos);\n                        continue;\n                    }\n                    break;\n                case 35:\n                    if (pos === 0 && isShebangTrivia(text, pos)) {\n                        pos = scanShebangTrivia(text, pos);\n                        continue;\n                    }\n                    break;\n                default:\n                    if (ch > 127 && (isWhiteSpace(ch))) {\n                        pos++;\n                        continue;\n                    }\n                    break;\n            }\n            return pos;\n        }\n    }\n    ts.skipTrivia = skipTrivia;\n    var mergeConflictMarkerLength = \"<<<<<<<\".length;\n    function isConflictMarkerTrivia(text, pos) {\n        ts.Debug.assert(pos >= 0);\n        if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) {\n            var ch = text.charCodeAt(pos);\n            if ((pos + mergeConflictMarkerLength) < text.length) {\n                for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) {\n                    if (text.charCodeAt(pos + i) !== ch) {\n                        return false;\n                    }\n                }\n                return ch === 61 ||\n                    text.charCodeAt(pos + mergeConflictMarkerLength) === 32;\n            }\n        }\n        return false;\n    }\n    function scanConflictMarkerTrivia(text, pos, error) {\n        if (error) {\n            error(ts.Diagnostics.Merge_conflict_marker_encountered, mergeConflictMarkerLength);\n        }\n        var ch = text.charCodeAt(pos);\n        var len = text.length;\n        if (ch === 60 || ch === 62) {\n            while (pos < len && !isLineBreak(text.charCodeAt(pos))) {\n                pos++;\n            }\n        }\n        else {\n            ts.Debug.assert(ch === 61);\n            while (pos < len) {\n                var ch_1 = text.charCodeAt(pos);\n                if (ch_1 === 62 && isConflictMarkerTrivia(text, pos)) {\n                    break;\n                }\n                pos++;\n            }\n        }\n        return pos;\n    }\n    var shebangTriviaRegex = /^#!.*/;\n    function isShebangTrivia(text, pos) {\n        ts.Debug.assert(pos === 0);\n        return shebangTriviaRegex.test(text);\n    }\n    function scanShebangTrivia(text, pos) {\n        var shebang = shebangTriviaRegex.exec(text)[0];\n        pos = pos + shebang.length;\n        return pos;\n    }\n    function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) {\n        var pendingPos;\n        var pendingEnd;\n        var pendingKind;\n        var pendingHasTrailingNewLine;\n        var hasPendingCommentRange = false;\n        var collecting = trailing || pos === 0;\n        var accumulator = initial;\n        scan: while (pos >= 0 && pos < text.length) {\n            var ch = text.charCodeAt(pos);\n            switch (ch) {\n                case 13:\n                    if (text.charCodeAt(pos + 1) === 10) {\n                        pos++;\n                    }\n                case 10:\n                    pos++;\n                    if (trailing) {\n                        break scan;\n                    }\n                    collecting = true;\n                    if (hasPendingCommentRange) {\n                        pendingHasTrailingNewLine = true;\n                    }\n                    continue;\n                case 9:\n                case 11:\n                case 12:\n                case 32:\n                    pos++;\n                    continue;\n                case 47:\n                    var nextChar = text.charCodeAt(pos + 1);\n                    var hasTrailingNewLine = false;\n                    if (nextChar === 47 || nextChar === 42) {\n                        var kind = nextChar === 47 ? 2 : 3;\n                        var startPos = pos;\n                        pos += 2;\n                        if (nextChar === 47) {\n                            while (pos < text.length) {\n                                if (isLineBreak(text.charCodeAt(pos))) {\n                                    hasTrailingNewLine = true;\n                                    break;\n                                }\n                                pos++;\n                            }\n                        }\n                        else {\n                            while (pos < text.length) {\n                                if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) {\n                                    pos += 2;\n                                    break;\n                                }\n                                pos++;\n                            }\n                        }\n                        if (collecting) {\n                            if (hasPendingCommentRange) {\n                                accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator);\n                                if (!reduce && accumulator) {\n                                    return accumulator;\n                                }\n                                hasPendingCommentRange = false;\n                            }\n                            pendingPos = startPos;\n                            pendingEnd = pos;\n                            pendingKind = kind;\n                            pendingHasTrailingNewLine = hasTrailingNewLine;\n                            hasPendingCommentRange = true;\n                        }\n                        continue;\n                    }\n                    break scan;\n                default:\n                    if (ch > 127 && (isWhiteSpace(ch))) {\n                        if (hasPendingCommentRange && isLineBreak(ch)) {\n                            pendingHasTrailingNewLine = true;\n                        }\n                        pos++;\n                        continue;\n                    }\n                    break scan;\n            }\n        }\n        if (hasPendingCommentRange) {\n            accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator);\n        }\n        return accumulator;\n    }\n    function forEachLeadingCommentRange(text, pos, cb, state) {\n        return iterateCommentRanges(false, text, pos, false, cb, state);\n    }\n    ts.forEachLeadingCommentRange = forEachLeadingCommentRange;\n    function forEachTrailingCommentRange(text, pos, cb, state) {\n        return iterateCommentRanges(false, text, pos, true, cb, state);\n    }\n    ts.forEachTrailingCommentRange = forEachTrailingCommentRange;\n    function reduceEachLeadingCommentRange(text, pos, cb, state, initial) {\n        return iterateCommentRanges(true, text, pos, false, cb, state, initial);\n    }\n    ts.reduceEachLeadingCommentRange = reduceEachLeadingCommentRange;\n    function reduceEachTrailingCommentRange(text, pos, cb, state, initial) {\n        return iterateCommentRanges(true, text, pos, true, cb, state, initial);\n    }\n    ts.reduceEachTrailingCommentRange = reduceEachTrailingCommentRange;\n    function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments) {\n        if (!comments) {\n            comments = [];\n        }\n        comments.push({ pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine, kind: kind });\n        return comments;\n    }\n    function getLeadingCommentRanges(text, pos) {\n        return reduceEachLeadingCommentRange(text, pos, appendCommentRange, undefined, undefined);\n    }\n    ts.getLeadingCommentRanges = getLeadingCommentRanges;\n    function getTrailingCommentRanges(text, pos) {\n        return reduceEachTrailingCommentRange(text, pos, appendCommentRange, undefined, undefined);\n    }\n    ts.getTrailingCommentRanges = getTrailingCommentRanges;\n    function getShebang(text) {\n        return shebangTriviaRegex.test(text)\n            ? shebangTriviaRegex.exec(text)[0]\n            : undefined;\n    }\n    ts.getShebang = getShebang;\n    function isIdentifierStart(ch, languageVersion) {\n        return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 ||\n            ch === 36 || ch === 95 ||\n            ch > 127 && isUnicodeIdentifierStart(ch, languageVersion);\n    }\n    ts.isIdentifierStart = isIdentifierStart;\n    function isIdentifierPart(ch, languageVersion) {\n        return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 ||\n            ch >= 48 && ch <= 57 || ch === 36 || ch === 95 ||\n            ch > 127 && isUnicodeIdentifierPart(ch, languageVersion);\n    }\n    ts.isIdentifierPart = isIdentifierPart;\n    function isIdentifierText(name, languageVersion) {\n        if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) {\n            return false;\n        }\n        for (var i = 1, n = name.length; i < n; i++) {\n            if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) {\n                return false;\n            }\n        }\n        return true;\n    }\n    ts.isIdentifierText = isIdentifierText;\n    function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) {\n        if (languageVariant === void 0) { languageVariant = 0; }\n        var pos;\n        var end;\n        var startPos;\n        var tokenPos;\n        var token;\n        var tokenValue;\n        var precedingLineBreak;\n        var hasExtendedUnicodeEscape;\n        var tokenIsUnterminated;\n        setText(text, start, length);\n        return {\n            getStartPos: function () { return startPos; },\n            getTextPos: function () { return pos; },\n            getToken: function () { return token; },\n            getTokenPos: function () { return tokenPos; },\n            getTokenText: function () { return text.substring(tokenPos, pos); },\n            getTokenValue: function () { return tokenValue; },\n            hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; },\n            hasPrecedingLineBreak: function () { return precedingLineBreak; },\n            isIdentifier: function () { return token === 70 || token > 106; },\n            isReservedWord: function () { return token >= 71 && token <= 106; },\n            isUnterminated: function () { return tokenIsUnterminated; },\n            reScanGreaterToken: reScanGreaterToken,\n            reScanSlashToken: reScanSlashToken,\n            reScanTemplateToken: reScanTemplateToken,\n            scanJsxIdentifier: scanJsxIdentifier,\n            scanJsxAttributeValue: scanJsxAttributeValue,\n            reScanJsxToken: reScanJsxToken,\n            scanJsxToken: scanJsxToken,\n            scanJSDocToken: scanJSDocToken,\n            scan: scan,\n            getText: getText,\n            setText: setText,\n            setScriptTarget: setScriptTarget,\n            setLanguageVariant: setLanguageVariant,\n            setOnError: setOnError,\n            setTextPos: setTextPos,\n            tryScan: tryScan,\n            lookAhead: lookAhead,\n            scanRange: scanRange,\n        };\n        function error(message, length) {\n            if (onError) {\n                onError(message, length || 0);\n            }\n        }\n        function scanNumber() {\n            var start = pos;\n            while (isDigit(text.charCodeAt(pos)))\n                pos++;\n            if (text.charCodeAt(pos) === 46) {\n                pos++;\n                while (isDigit(text.charCodeAt(pos)))\n                    pos++;\n            }\n            var end = pos;\n            if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) {\n                pos++;\n                if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45)\n                    pos++;\n                if (isDigit(text.charCodeAt(pos))) {\n                    pos++;\n                    while (isDigit(text.charCodeAt(pos)))\n                        pos++;\n                    end = pos;\n                }\n                else {\n                    error(ts.Diagnostics.Digit_expected);\n                }\n            }\n            return \"\" + +(text.substring(start, end));\n        }\n        function scanOctalDigits() {\n            var start = pos;\n            while (isOctalDigit(text.charCodeAt(pos))) {\n                pos++;\n            }\n            return +(text.substring(start, pos));\n        }\n        function scanExactNumberOfHexDigits(count) {\n            return scanHexDigits(count, false);\n        }\n        function scanMinimumNumberOfHexDigits(count) {\n            return scanHexDigits(count, true);\n        }\n        function scanHexDigits(minCount, scanAsManyAsPossible) {\n            var digits = 0;\n            var value = 0;\n            while (digits < minCount || scanAsManyAsPossible) {\n                var ch = text.charCodeAt(pos);\n                if (ch >= 48 && ch <= 57) {\n                    value = value * 16 + ch - 48;\n                }\n                else if (ch >= 65 && ch <= 70) {\n                    value = value * 16 + ch - 65 + 10;\n                }\n                else if (ch >= 97 && ch <= 102) {\n                    value = value * 16 + ch - 97 + 10;\n                }\n                else {\n                    break;\n                }\n                pos++;\n                digits++;\n            }\n            if (digits < minCount) {\n                value = -1;\n            }\n            return value;\n        }\n        function scanString(allowEscapes) {\n            if (allowEscapes === void 0) { allowEscapes = true; }\n            var quote = text.charCodeAt(pos);\n            pos++;\n            var result = \"\";\n            var start = pos;\n            while (true) {\n                if (pos >= end) {\n                    result += text.substring(start, pos);\n                    tokenIsUnterminated = true;\n                    error(ts.Diagnostics.Unterminated_string_literal);\n                    break;\n                }\n                var ch = text.charCodeAt(pos);\n                if (ch === quote) {\n                    result += text.substring(start, pos);\n                    pos++;\n                    break;\n                }\n                if (ch === 92 && allowEscapes) {\n                    result += text.substring(start, pos);\n                    result += scanEscapeSequence();\n                    start = pos;\n                    continue;\n                }\n                if (isLineBreak(ch)) {\n                    result += text.substring(start, pos);\n                    tokenIsUnterminated = true;\n                    error(ts.Diagnostics.Unterminated_string_literal);\n                    break;\n                }\n                pos++;\n            }\n            return result;\n        }\n        function scanTemplateAndSetTokenValue() {\n            var startedWithBacktick = text.charCodeAt(pos) === 96;\n            pos++;\n            var start = pos;\n            var contents = \"\";\n            var resultingToken;\n            while (true) {\n                if (pos >= end) {\n                    contents += text.substring(start, pos);\n                    tokenIsUnterminated = true;\n                    error(ts.Diagnostics.Unterminated_template_literal);\n                    resultingToken = startedWithBacktick ? 12 : 15;\n                    break;\n                }\n                var currChar = text.charCodeAt(pos);\n                if (currChar === 96) {\n                    contents += text.substring(start, pos);\n                    pos++;\n                    resultingToken = startedWithBacktick ? 12 : 15;\n                    break;\n                }\n                if (currChar === 36 && pos + 1 < end && text.charCodeAt(pos + 1) === 123) {\n                    contents += text.substring(start, pos);\n                    pos += 2;\n                    resultingToken = startedWithBacktick ? 13 : 14;\n                    break;\n                }\n                if (currChar === 92) {\n                    contents += text.substring(start, pos);\n                    contents += scanEscapeSequence();\n                    start = pos;\n                    continue;\n                }\n                if (currChar === 13) {\n                    contents += text.substring(start, pos);\n                    pos++;\n                    if (pos < end && text.charCodeAt(pos) === 10) {\n                        pos++;\n                    }\n                    contents += \"\\n\";\n                    start = pos;\n                    continue;\n                }\n                pos++;\n            }\n            ts.Debug.assert(resultingToken !== undefined);\n            tokenValue = contents;\n            return resultingToken;\n        }\n        function scanEscapeSequence() {\n            pos++;\n            if (pos >= end) {\n                error(ts.Diagnostics.Unexpected_end_of_text);\n                return \"\";\n            }\n            var ch = text.charCodeAt(pos);\n            pos++;\n            switch (ch) {\n                case 48:\n                    return \"\\0\";\n                case 98:\n                    return \"\\b\";\n                case 116:\n                    return \"\\t\";\n                case 110:\n                    return \"\\n\";\n                case 118:\n                    return \"\\v\";\n                case 102:\n                    return \"\\f\";\n                case 114:\n                    return \"\\r\";\n                case 39:\n                    return \"\\'\";\n                case 34:\n                    return \"\\\"\";\n                case 117:\n                    if (pos < end && text.charCodeAt(pos) === 123) {\n                        hasExtendedUnicodeEscape = true;\n                        pos++;\n                        return scanExtendedUnicodeEscape();\n                    }\n                    return scanHexadecimalEscape(4);\n                case 120:\n                    return scanHexadecimalEscape(2);\n                case 13:\n                    if (pos < end && text.charCodeAt(pos) === 10) {\n                        pos++;\n                    }\n                case 10:\n                case 8232:\n                case 8233:\n                    return \"\";\n                default:\n                    return String.fromCharCode(ch);\n            }\n        }\n        function scanHexadecimalEscape(numDigits) {\n            var escapedValue = scanExactNumberOfHexDigits(numDigits);\n            if (escapedValue >= 0) {\n                return String.fromCharCode(escapedValue);\n            }\n            else {\n                error(ts.Diagnostics.Hexadecimal_digit_expected);\n                return \"\";\n            }\n        }\n        function scanExtendedUnicodeEscape() {\n            var escapedValue = scanMinimumNumberOfHexDigits(1);\n            var isInvalidExtendedEscape = false;\n            if (escapedValue < 0) {\n                error(ts.Diagnostics.Hexadecimal_digit_expected);\n                isInvalidExtendedEscape = true;\n            }\n            else if (escapedValue > 0x10FFFF) {\n                error(ts.Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);\n                isInvalidExtendedEscape = true;\n            }\n            if (pos >= end) {\n                error(ts.Diagnostics.Unexpected_end_of_text);\n                isInvalidExtendedEscape = true;\n            }\n            else if (text.charCodeAt(pos) === 125) {\n                pos++;\n            }\n            else {\n                error(ts.Diagnostics.Unterminated_Unicode_escape_sequence);\n                isInvalidExtendedEscape = true;\n            }\n            if (isInvalidExtendedEscape) {\n                return \"\";\n            }\n            return utf16EncodeAsString(escapedValue);\n        }\n        function utf16EncodeAsString(codePoint) {\n            ts.Debug.assert(0x0 <= codePoint && codePoint <= 0x10FFFF);\n            if (codePoint <= 65535) {\n                return String.fromCharCode(codePoint);\n            }\n            var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 0xD800;\n            var codeUnit2 = ((codePoint - 65536) % 1024) + 0xDC00;\n            return String.fromCharCode(codeUnit1, codeUnit2);\n        }\n        function peekUnicodeEscape() {\n            if (pos + 5 < end && text.charCodeAt(pos + 1) === 117) {\n                var start_1 = pos;\n                pos += 2;\n                var value = scanExactNumberOfHexDigits(4);\n                pos = start_1;\n                return value;\n            }\n            return -1;\n        }\n        function scanIdentifierParts() {\n            var result = \"\";\n            var start = pos;\n            while (pos < end) {\n                var ch = text.charCodeAt(pos);\n                if (isIdentifierPart(ch, languageVersion)) {\n                    pos++;\n                }\n                else if (ch === 92) {\n                    ch = peekUnicodeEscape();\n                    if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) {\n                        break;\n                    }\n                    result += text.substring(start, pos);\n                    result += String.fromCharCode(ch);\n                    pos += 6;\n                    start = pos;\n                }\n                else {\n                    break;\n                }\n            }\n            result += text.substring(start, pos);\n            return result;\n        }\n        function getIdentifierToken() {\n            var len = tokenValue.length;\n            if (len >= 2 && len <= 11) {\n                var ch = tokenValue.charCodeAt(0);\n                if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) {\n                    return token = textToToken[tokenValue];\n                }\n            }\n            return token = 70;\n        }\n        function scanBinaryOrOctalDigits(base) {\n            ts.Debug.assert(base === 2 || base === 8, \"Expected either base 2 or base 8\");\n            var value = 0;\n            var numberOfDigits = 0;\n            while (true) {\n                var ch = text.charCodeAt(pos);\n                var valueOfCh = ch - 48;\n                if (!isDigit(ch) || valueOfCh >= base) {\n                    break;\n                }\n                value = value * base + valueOfCh;\n                pos++;\n                numberOfDigits++;\n            }\n            if (numberOfDigits === 0) {\n                return -1;\n            }\n            return value;\n        }\n        function scan() {\n            startPos = pos;\n            hasExtendedUnicodeEscape = false;\n            precedingLineBreak = false;\n            tokenIsUnterminated = false;\n            while (true) {\n                tokenPos = pos;\n                if (pos >= end) {\n                    return token = 1;\n                }\n                var ch = text.charCodeAt(pos);\n                if (ch === 35 && pos === 0 && isShebangTrivia(text, pos)) {\n                    pos = scanShebangTrivia(text, pos);\n                    if (skipTrivia) {\n                        continue;\n                    }\n                    else {\n                        return token = 6;\n                    }\n                }\n                switch (ch) {\n                    case 10:\n                    case 13:\n                        precedingLineBreak = true;\n                        if (skipTrivia) {\n                            pos++;\n                            continue;\n                        }\n                        else {\n                            if (ch === 13 && pos + 1 < end && text.charCodeAt(pos + 1) === 10) {\n                                pos += 2;\n                            }\n                            else {\n                                pos++;\n                            }\n                            return token = 4;\n                        }\n                    case 9:\n                    case 11:\n                    case 12:\n                    case 32:\n                        if (skipTrivia) {\n                            pos++;\n                            continue;\n                        }\n                        else {\n                            while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) {\n                                pos++;\n                            }\n                            return token = 5;\n                        }\n                    case 33:\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            if (text.charCodeAt(pos + 2) === 61) {\n                                return pos += 3, token = 34;\n                            }\n                            return pos += 2, token = 32;\n                        }\n                        pos++;\n                        return token = 50;\n                    case 34:\n                    case 39:\n                        tokenValue = scanString();\n                        return token = 9;\n                    case 96:\n                        return token = scanTemplateAndSetTokenValue();\n                    case 37:\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 63;\n                        }\n                        pos++;\n                        return token = 41;\n                    case 38:\n                        if (text.charCodeAt(pos + 1) === 38) {\n                            return pos += 2, token = 52;\n                        }\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 67;\n                        }\n                        pos++;\n                        return token = 47;\n                    case 40:\n                        pos++;\n                        return token = 18;\n                    case 41:\n                        pos++;\n                        return token = 19;\n                    case 42:\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 60;\n                        }\n                        if (text.charCodeAt(pos + 1) === 42) {\n                            if (text.charCodeAt(pos + 2) === 61) {\n                                return pos += 3, token = 61;\n                            }\n                            return pos += 2, token = 39;\n                        }\n                        pos++;\n                        return token = 38;\n                    case 43:\n                        if (text.charCodeAt(pos + 1) === 43) {\n                            return pos += 2, token = 42;\n                        }\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 58;\n                        }\n                        pos++;\n                        return token = 36;\n                    case 44:\n                        pos++;\n                        return token = 25;\n                    case 45:\n                        if (text.charCodeAt(pos + 1) === 45) {\n                            return pos += 2, token = 43;\n                        }\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 59;\n                        }\n                        pos++;\n                        return token = 37;\n                    case 46:\n                        if (isDigit(text.charCodeAt(pos + 1))) {\n                            tokenValue = scanNumber();\n                            return token = 8;\n                        }\n                        if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) {\n                            return pos += 3, token = 23;\n                        }\n                        pos++;\n                        return token = 22;\n                    case 47:\n                        if (text.charCodeAt(pos + 1) === 47) {\n                            pos += 2;\n                            while (pos < end) {\n                                if (isLineBreak(text.charCodeAt(pos))) {\n                                    break;\n                                }\n                                pos++;\n                            }\n                            if (skipTrivia) {\n                                continue;\n                            }\n                            else {\n                                return token = 2;\n                            }\n                        }\n                        if (text.charCodeAt(pos + 1) === 42) {\n                            pos += 2;\n                            var commentClosed = false;\n                            while (pos < end) {\n                                var ch_2 = text.charCodeAt(pos);\n                                if (ch_2 === 42 && text.charCodeAt(pos + 1) === 47) {\n                                    pos += 2;\n                                    commentClosed = true;\n                                    break;\n                                }\n                                if (isLineBreak(ch_2)) {\n                                    precedingLineBreak = true;\n                                }\n                                pos++;\n                            }\n                            if (!commentClosed) {\n                                error(ts.Diagnostics.Asterisk_Slash_expected);\n                            }\n                            if (skipTrivia) {\n                                continue;\n                            }\n                            else {\n                                tokenIsUnterminated = !commentClosed;\n                                return token = 3;\n                            }\n                        }\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 62;\n                        }\n                        pos++;\n                        return token = 40;\n                    case 48:\n                        if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) {\n                            pos += 2;\n                            var value = scanMinimumNumberOfHexDigits(1);\n                            if (value < 0) {\n                                error(ts.Diagnostics.Hexadecimal_digit_expected);\n                                value = 0;\n                            }\n                            tokenValue = \"\" + value;\n                            return token = 8;\n                        }\n                        else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) {\n                            pos += 2;\n                            var value = scanBinaryOrOctalDigits(2);\n                            if (value < 0) {\n                                error(ts.Diagnostics.Binary_digit_expected);\n                                value = 0;\n                            }\n                            tokenValue = \"\" + value;\n                            return token = 8;\n                        }\n                        else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) {\n                            pos += 2;\n                            var value = scanBinaryOrOctalDigits(8);\n                            if (value < 0) {\n                                error(ts.Diagnostics.Octal_digit_expected);\n                                value = 0;\n                            }\n                            tokenValue = \"\" + value;\n                            return token = 8;\n                        }\n                        if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) {\n                            tokenValue = \"\" + scanOctalDigits();\n                            return token = 8;\n                        }\n                    case 49:\n                    case 50:\n                    case 51:\n                    case 52:\n                    case 53:\n                    case 54:\n                    case 55:\n                    case 56:\n                    case 57:\n                        tokenValue = scanNumber();\n                        return token = 8;\n                    case 58:\n                        pos++;\n                        return token = 55;\n                    case 59:\n                        pos++;\n                        return token = 24;\n                    case 60:\n                        if (isConflictMarkerTrivia(text, pos)) {\n                            pos = scanConflictMarkerTrivia(text, pos, error);\n                            if (skipTrivia) {\n                                continue;\n                            }\n                            else {\n                                return token = 7;\n                            }\n                        }\n                        if (text.charCodeAt(pos + 1) === 60) {\n                            if (text.charCodeAt(pos + 2) === 61) {\n                                return pos += 3, token = 64;\n                            }\n                            return pos += 2, token = 44;\n                        }\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 29;\n                        }\n                        if (languageVariant === 1 &&\n                            text.charCodeAt(pos + 1) === 47 &&\n                            text.charCodeAt(pos + 2) !== 42) {\n                            return pos += 2, token = 27;\n                        }\n                        pos++;\n                        return token = 26;\n                    case 61:\n                        if (isConflictMarkerTrivia(text, pos)) {\n                            pos = scanConflictMarkerTrivia(text, pos, error);\n                            if (skipTrivia) {\n                                continue;\n                            }\n                            else {\n                                return token = 7;\n                            }\n                        }\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            if (text.charCodeAt(pos + 2) === 61) {\n                                return pos += 3, token = 33;\n                            }\n                            return pos += 2, token = 31;\n                        }\n                        if (text.charCodeAt(pos + 1) === 62) {\n                            return pos += 2, token = 35;\n                        }\n                        pos++;\n                        return token = 57;\n                    case 62:\n                        if (isConflictMarkerTrivia(text, pos)) {\n                            pos = scanConflictMarkerTrivia(text, pos, error);\n                            if (skipTrivia) {\n                                continue;\n                            }\n                            else {\n                                return token = 7;\n                            }\n                        }\n                        pos++;\n                        return token = 28;\n                    case 63:\n                        pos++;\n                        return token = 54;\n                    case 91:\n                        pos++;\n                        return token = 20;\n                    case 93:\n                        pos++;\n                        return token = 21;\n                    case 94:\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 69;\n                        }\n                        pos++;\n                        return token = 49;\n                    case 123:\n                        pos++;\n                        return token = 16;\n                    case 124:\n                        if (text.charCodeAt(pos + 1) === 124) {\n                            return pos += 2, token = 53;\n                        }\n                        if (text.charCodeAt(pos + 1) === 61) {\n                            return pos += 2, token = 68;\n                        }\n                        pos++;\n                        return token = 48;\n                    case 125:\n                        pos++;\n                        return token = 17;\n                    case 126:\n                        pos++;\n                        return token = 51;\n                    case 64:\n                        pos++;\n                        return token = 56;\n                    case 92:\n                        var cookedChar = peekUnicodeEscape();\n                        if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {\n                            pos += 6;\n                            tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();\n                            return token = getIdentifierToken();\n                        }\n                        error(ts.Diagnostics.Invalid_character);\n                        pos++;\n                        return token = 0;\n                    default:\n                        if (isIdentifierStart(ch, languageVersion)) {\n                            pos++;\n                            while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion))\n                                pos++;\n                            tokenValue = text.substring(tokenPos, pos);\n                            if (ch === 92) {\n                                tokenValue += scanIdentifierParts();\n                            }\n                            return token = getIdentifierToken();\n                        }\n                        else if (isWhiteSpaceSingleLine(ch)) {\n                            pos++;\n                            continue;\n                        }\n                        else if (isLineBreak(ch)) {\n                            precedingLineBreak = true;\n                            pos++;\n                            continue;\n                        }\n                        error(ts.Diagnostics.Invalid_character);\n                        pos++;\n                        return token = 0;\n                }\n            }\n        }\n        function reScanGreaterToken() {\n            if (token === 28) {\n                if (text.charCodeAt(pos) === 62) {\n                    if (text.charCodeAt(pos + 1) === 62) {\n                        if (text.charCodeAt(pos + 2) === 61) {\n                            return pos += 3, token = 66;\n                        }\n                        return pos += 2, token = 46;\n                    }\n                    if (text.charCodeAt(pos + 1) === 61) {\n                        return pos += 2, token = 65;\n                    }\n                    pos++;\n                    return token = 45;\n                }\n                if (text.charCodeAt(pos) === 61) {\n                    pos++;\n                    return token = 30;\n                }\n            }\n            return token;\n        }\n        function reScanSlashToken() {\n            if (token === 40 || token === 62) {\n                var p = tokenPos + 1;\n                var inEscape = false;\n                var inCharacterClass = false;\n                while (true) {\n                    if (p >= end) {\n                        tokenIsUnterminated = true;\n                        error(ts.Diagnostics.Unterminated_regular_expression_literal);\n                        break;\n                    }\n                    var ch = text.charCodeAt(p);\n                    if (isLineBreak(ch)) {\n                        tokenIsUnterminated = true;\n                        error(ts.Diagnostics.Unterminated_regular_expression_literal);\n                        break;\n                    }\n                    if (inEscape) {\n                        inEscape = false;\n                    }\n                    else if (ch === 47 && !inCharacterClass) {\n                        p++;\n                        break;\n                    }\n                    else if (ch === 91) {\n                        inCharacterClass = true;\n                    }\n                    else if (ch === 92) {\n                        inEscape = true;\n                    }\n                    else if (ch === 93) {\n                        inCharacterClass = false;\n                    }\n                    p++;\n                }\n                while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) {\n                    p++;\n                }\n                pos = p;\n                tokenValue = text.substring(tokenPos, pos);\n                token = 11;\n            }\n            return token;\n        }\n        function reScanTemplateToken() {\n            ts.Debug.assert(token === 17, \"'reScanTemplateToken' should only be called on a '}'\");\n            pos = tokenPos;\n            return token = scanTemplateAndSetTokenValue();\n        }\n        function reScanJsxToken() {\n            pos = tokenPos = startPos;\n            return token = scanJsxToken();\n        }\n        function scanJsxToken() {\n            startPos = tokenPos = pos;\n            if (pos >= end) {\n                return token = 1;\n            }\n            var char = text.charCodeAt(pos);\n            if (char === 60) {\n                if (text.charCodeAt(pos + 1) === 47) {\n                    pos += 2;\n                    return token = 27;\n                }\n                pos++;\n                return token = 26;\n            }\n            if (char === 123) {\n                pos++;\n                return token = 16;\n            }\n            while (pos < end) {\n                pos++;\n                char = text.charCodeAt(pos);\n                if ((char === 123) || (char === 60)) {\n                    break;\n                }\n            }\n            return token = 10;\n        }\n        function scanJsxIdentifier() {\n            if (tokenIsIdentifierOrKeyword(token)) {\n                var firstCharPosition = pos;\n                while (pos < end) {\n                    var ch = text.charCodeAt(pos);\n                    if (ch === 45 || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {\n                        pos++;\n                    }\n                    else {\n                        break;\n                    }\n                }\n                tokenValue += text.substr(firstCharPosition, pos - firstCharPosition);\n            }\n            return token;\n        }\n        function scanJsxAttributeValue() {\n            startPos = pos;\n            switch (text.charCodeAt(pos)) {\n                case 34:\n                case 39:\n                    tokenValue = scanString(false);\n                    return token = 9;\n                default:\n                    return scan();\n            }\n        }\n        function scanJSDocToken() {\n            if (pos >= end) {\n                return token = 1;\n            }\n            startPos = pos;\n            tokenPos = pos;\n            var ch = text.charCodeAt(pos);\n            switch (ch) {\n                case 9:\n                case 11:\n                case 12:\n                case 32:\n                    while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) {\n                        pos++;\n                    }\n                    return token = 5;\n                case 64:\n                    pos++;\n                    return token = 56;\n                case 10:\n                case 13:\n                    pos++;\n                    return token = 4;\n                case 42:\n                    pos++;\n                    return token = 38;\n                case 123:\n                    pos++;\n                    return token = 16;\n                case 125:\n                    pos++;\n                    return token = 17;\n                case 91:\n                    pos++;\n                    return token = 20;\n                case 93:\n                    pos++;\n                    return token = 21;\n                case 61:\n                    pos++;\n                    return token = 57;\n                case 44:\n                    pos++;\n                    return token = 25;\n                case 46:\n                    pos++;\n                    return token = 22;\n            }\n            if (isIdentifierStart(ch, 5)) {\n                pos++;\n                while (isIdentifierPart(text.charCodeAt(pos), 5) && pos < end) {\n                    pos++;\n                }\n                return token = 70;\n            }\n            else {\n                return pos += 1, token = 0;\n            }\n        }\n        function speculationHelper(callback, isLookahead) {\n            var savePos = pos;\n            var saveStartPos = startPos;\n            var saveTokenPos = tokenPos;\n            var saveToken = token;\n            var saveTokenValue = tokenValue;\n            var savePrecedingLineBreak = precedingLineBreak;\n            var result = callback();\n            if (!result || isLookahead) {\n                pos = savePos;\n                startPos = saveStartPos;\n                tokenPos = saveTokenPos;\n                token = saveToken;\n                tokenValue = saveTokenValue;\n                precedingLineBreak = savePrecedingLineBreak;\n            }\n            return result;\n        }\n        function scanRange(start, length, callback) {\n            var saveEnd = end;\n            var savePos = pos;\n            var saveStartPos = startPos;\n            var saveTokenPos = tokenPos;\n            var saveToken = token;\n            var savePrecedingLineBreak = precedingLineBreak;\n            var saveTokenValue = tokenValue;\n            var saveHasExtendedUnicodeEscape = hasExtendedUnicodeEscape;\n            var saveTokenIsUnterminated = tokenIsUnterminated;\n            setText(text, start, length);\n            var result = callback();\n            end = saveEnd;\n            pos = savePos;\n            startPos = saveStartPos;\n            tokenPos = saveTokenPos;\n            token = saveToken;\n            precedingLineBreak = savePrecedingLineBreak;\n            tokenValue = saveTokenValue;\n            hasExtendedUnicodeEscape = saveHasExtendedUnicodeEscape;\n            tokenIsUnterminated = saveTokenIsUnterminated;\n            return result;\n        }\n        function lookAhead(callback) {\n            return speculationHelper(callback, true);\n        }\n        function tryScan(callback) {\n            return speculationHelper(callback, false);\n        }\n        function getText() {\n            return text;\n        }\n        function setText(newText, start, length) {\n            text = newText || \"\";\n            end = length === undefined ? text.length : start + length;\n            setTextPos(start || 0);\n        }\n        function setOnError(errorCallback) {\n            onError = errorCallback;\n        }\n        function setScriptTarget(scriptTarget) {\n            languageVersion = scriptTarget;\n        }\n        function setLanguageVariant(variant) {\n            languageVariant = variant;\n        }\n        function setTextPos(textPos) {\n            ts.Debug.assert(textPos >= 0);\n            pos = textPos;\n            startPos = textPos;\n            tokenPos = textPos;\n            token = 0;\n            precedingLineBreak = false;\n            tokenValue = undefined;\n            hasExtendedUnicodeEscape = false;\n            tokenIsUnterminated = false;\n        }\n    }\n    ts.createScanner = createScanner;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    ts.compileOnSaveCommandLineOption = { name: \"compileOnSave\", type: \"boolean\" };\n    ts.optionDeclarations = [\n        {\n            name: \"charset\",\n            type: \"string\",\n        },\n        ts.compileOnSaveCommandLineOption,\n        {\n            name: \"declaration\",\n            shortName: \"d\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Generates_corresponding_d_ts_file,\n        },\n        {\n            name: \"declarationDir\",\n            type: \"string\",\n            isFilePath: true,\n            paramType: ts.Diagnostics.DIRECTORY,\n        },\n        {\n            name: \"diagnostics\",\n            type: \"boolean\",\n        },\n        {\n            name: \"extendedDiagnostics\",\n            type: \"boolean\",\n            experimental: true\n        },\n        {\n            name: \"emitBOM\",\n            type: \"boolean\"\n        },\n        {\n            name: \"help\",\n            shortName: \"h\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Print_this_message,\n        },\n        {\n            name: \"help\",\n            shortName: \"?\",\n            type: \"boolean\"\n        },\n        {\n            name: \"init\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file,\n        },\n        {\n            name: \"inlineSourceMap\",\n            type: \"boolean\",\n        },\n        {\n            name: \"inlineSources\",\n            type: \"boolean\",\n        },\n        {\n            name: \"jsx\",\n            type: ts.createMap({\n                \"preserve\": 1,\n                \"react\": 2\n            }),\n            paramType: ts.Diagnostics.KIND,\n            description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react,\n        },\n        {\n            name: \"reactNamespace\",\n            type: \"string\",\n            description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit\n        },\n        {\n            name: \"jsxFactory\",\n            type: \"string\",\n            description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h\n        },\n        {\n            name: \"listFiles\",\n            type: \"boolean\",\n        },\n        {\n            name: \"locale\",\n            type: \"string\",\n        },\n        {\n            name: \"mapRoot\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,\n            paramType: ts.Diagnostics.LOCATION,\n        },\n        {\n            name: \"module\",\n            shortName: \"m\",\n            type: ts.createMap({\n                \"none\": ts.ModuleKind.None,\n                \"commonjs\": ts.ModuleKind.CommonJS,\n                \"amd\": ts.ModuleKind.AMD,\n                \"system\": ts.ModuleKind.System,\n                \"umd\": ts.ModuleKind.UMD,\n                \"es6\": ts.ModuleKind.ES2015,\n                \"es2015\": ts.ModuleKind.ES2015,\n            }),\n            description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015,\n            paramType: ts.Diagnostics.KIND,\n        },\n        {\n            name: \"newLine\",\n            type: ts.createMap({\n                \"crlf\": 0,\n                \"lf\": 1\n            }),\n            description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,\n            paramType: ts.Diagnostics.NEWLINE,\n        },\n        {\n            name: \"noEmit\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_emit_outputs,\n        },\n        {\n            name: \"noEmitHelpers\",\n            type: \"boolean\"\n        },\n        {\n            name: \"noEmitOnError\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,\n        },\n        {\n            name: \"noErrorTruncation\",\n            type: \"boolean\"\n        },\n        {\n            name: \"noImplicitAny\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type,\n        },\n        {\n            name: \"noImplicitThis\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type,\n        },\n        {\n            name: \"noUnusedLocals\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Report_errors_on_unused_locals,\n        },\n        {\n            name: \"noUnusedParameters\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Report_errors_on_unused_parameters,\n        },\n        {\n            name: \"noLib\",\n            type: \"boolean\",\n        },\n        {\n            name: \"noResolve\",\n            type: \"boolean\",\n        },\n        {\n            name: \"skipDefaultLibCheck\",\n            type: \"boolean\",\n        },\n        {\n            name: \"skipLibCheck\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Skip_type_checking_of_declaration_files,\n        },\n        {\n            name: \"out\",\n            type: \"string\",\n            isFilePath: false,\n            paramType: ts.Diagnostics.FILE,\n        },\n        {\n            name: \"outFile\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file,\n            paramType: ts.Diagnostics.FILE,\n        },\n        {\n            name: \"outDir\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Redirect_output_structure_to_the_directory,\n            paramType: ts.Diagnostics.DIRECTORY,\n        },\n        {\n            name: \"preserveConstEnums\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code\n        },\n        {\n            name: \"pretty\",\n            description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental,\n            type: \"boolean\"\n        },\n        {\n            name: \"project\",\n            shortName: \"p\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Compile_the_project_in_the_given_directory,\n            paramType: ts.Diagnostics.DIRECTORY\n        },\n        {\n            name: \"removeComments\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_emit_comments_to_output,\n        },\n        {\n            name: \"rootDir\",\n            type: \"string\",\n            isFilePath: true,\n            paramType: ts.Diagnostics.LOCATION,\n            description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir,\n        },\n        {\n            name: \"isolatedModules\",\n            type: \"boolean\",\n        },\n        {\n            name: \"sourceMap\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Generates_corresponding_map_file,\n        },\n        {\n            name: \"sourceRoot\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,\n            paramType: ts.Diagnostics.LOCATION,\n        },\n        {\n            name: \"suppressExcessPropertyErrors\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals,\n            experimental: true\n        },\n        {\n            name: \"suppressImplicitAnyIndexErrors\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures,\n        },\n        {\n            name: \"stripInternal\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation,\n            experimental: true\n        },\n        {\n            name: \"target\",\n            shortName: \"t\",\n            type: ts.createMap({\n                \"es3\": 0,\n                \"es5\": 1,\n                \"es6\": 2,\n                \"es2015\": 2,\n                \"es2016\": 3,\n                \"es2017\": 4,\n                \"esnext\": 5,\n            }),\n            description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT,\n            paramType: ts.Diagnostics.VERSION,\n        },\n        {\n            name: \"version\",\n            shortName: \"v\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Print_the_compiler_s_version,\n        },\n        {\n            name: \"watch\",\n            shortName: \"w\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Watch_input_files,\n        },\n        {\n            name: \"experimentalDecorators\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators\n        },\n        {\n            name: \"emitDecoratorMetadata\",\n            type: \"boolean\",\n            experimental: true,\n            description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators\n        },\n        {\n            name: \"moduleResolution\",\n            type: ts.createMap({\n                \"node\": ts.ModuleResolutionKind.NodeJs,\n                \"classic\": ts.ModuleResolutionKind.Classic,\n            }),\n            description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6,\n            paramType: ts.Diagnostics.STRATEGY,\n        },\n        {\n            name: \"allowUnusedLabels\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_report_errors_on_unused_labels\n        },\n        {\n            name: \"noImplicitReturns\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value\n        },\n        {\n            name: \"noFallthroughCasesInSwitch\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement\n        },\n        {\n            name: \"allowUnreachableCode\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code\n        },\n        {\n            name: \"forceConsistentCasingInFileNames\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file\n        },\n        {\n            name: \"baseUrl\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names\n        },\n        {\n            name: \"paths\",\n            type: \"object\",\n            isTSConfigOnly: true\n        },\n        {\n            name: \"rootDirs\",\n            type: \"list\",\n            isTSConfigOnly: true,\n            element: {\n                name: \"rootDirs\",\n                type: \"string\",\n                isFilePath: true\n            }\n        },\n        {\n            name: \"typeRoots\",\n            type: \"list\",\n            element: {\n                name: \"typeRoots\",\n                type: \"string\",\n                isFilePath: true\n            }\n        },\n        {\n            name: \"types\",\n            type: \"list\",\n            element: {\n                name: \"types\",\n                type: \"string\"\n            },\n            description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation\n        },\n        {\n            name: \"traceResolution\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process\n        },\n        {\n            name: \"allowJs\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Allow_javascript_files_to_be_compiled\n        },\n        {\n            name: \"allowSyntheticDefaultImports\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking\n        },\n        {\n            name: \"noImplicitUseStrict\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output\n        },\n        {\n            name: \"maxNodeModuleJsDepth\",\n            type: \"number\",\n            description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files\n        },\n        {\n            name: \"listEmittedFiles\",\n            type: \"boolean\"\n        },\n        {\n            name: \"lib\",\n            type: \"list\",\n            element: {\n                name: \"lib\",\n                type: ts.createMap({\n                    \"es5\": \"lib.es5.d.ts\",\n                    \"es6\": \"lib.es2015.d.ts\",\n                    \"es2015\": \"lib.es2015.d.ts\",\n                    \"es7\": \"lib.es2016.d.ts\",\n                    \"es2016\": \"lib.es2016.d.ts\",\n                    \"es2017\": \"lib.es2017.d.ts\",\n                    \"dom\": \"lib.dom.d.ts\",\n                    \"dom.iterable\": \"lib.dom.iterable.d.ts\",\n                    \"webworker\": \"lib.webworker.d.ts\",\n                    \"scripthost\": \"lib.scripthost.d.ts\",\n                    \"es2015.core\": \"lib.es2015.core.d.ts\",\n                    \"es2015.collection\": \"lib.es2015.collection.d.ts\",\n                    \"es2015.generator\": \"lib.es2015.generator.d.ts\",\n                    \"es2015.iterable\": \"lib.es2015.iterable.d.ts\",\n                    \"es2015.promise\": \"lib.es2015.promise.d.ts\",\n                    \"es2015.proxy\": \"lib.es2015.proxy.d.ts\",\n                    \"es2015.reflect\": \"lib.es2015.reflect.d.ts\",\n                    \"es2015.symbol\": \"lib.es2015.symbol.d.ts\",\n                    \"es2015.symbol.wellknown\": \"lib.es2015.symbol.wellknown.d.ts\",\n                    \"es2016.array.include\": \"lib.es2016.array.include.d.ts\",\n                    \"es2017.object\": \"lib.es2017.object.d.ts\",\n                    \"es2017.sharedmemory\": \"lib.es2017.sharedmemory.d.ts\",\n                    \"es2017.string\": \"lib.es2017.string.d.ts\",\n                }),\n            },\n            description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon\n        },\n        {\n            name: \"disableSizeLimit\",\n            type: \"boolean\"\n        },\n        {\n            name: \"strictNullChecks\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Enable_strict_null_checks\n        },\n        {\n            name: \"importHelpers\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Import_emit_helpers_from_tslib\n        },\n        {\n            name: \"alwaysStrict\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file\n        }\n    ];\n    ts.typeAcquisitionDeclarations = [\n        {\n            name: \"enableAutoDiscovery\",\n            type: \"boolean\",\n        },\n        {\n            name: \"enable\",\n            type: \"boolean\",\n        },\n        {\n            name: \"include\",\n            type: \"list\",\n            element: {\n                name: \"include\",\n                type: \"string\"\n            }\n        },\n        {\n            name: \"exclude\",\n            type: \"list\",\n            element: {\n                name: \"exclude\",\n                type: \"string\"\n            }\n        }\n    ];\n    ts.defaultInitCompilerOptions = {\n        module: ts.ModuleKind.CommonJS,\n        target: 1,\n        noImplicitAny: false,\n        sourceMap: false,\n    };\n    var optionNameMapCache;\n    function convertEnableAutoDiscoveryToEnable(typeAcquisition) {\n        if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) {\n            var result = {\n                enable: typeAcquisition.enableAutoDiscovery,\n                include: typeAcquisition.include || [],\n                exclude: typeAcquisition.exclude || []\n            };\n            return result;\n        }\n        return typeAcquisition;\n    }\n    ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable;\n    function getOptionNameMap() {\n        if (optionNameMapCache) {\n            return optionNameMapCache;\n        }\n        var optionNameMap = ts.createMap();\n        var shortOptionNames = ts.createMap();\n        ts.forEach(ts.optionDeclarations, function (option) {\n            optionNameMap[option.name.toLowerCase()] = option;\n            if (option.shortName) {\n                shortOptionNames[option.shortName] = option.name;\n            }\n        });\n        optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames };\n        return optionNameMapCache;\n    }\n    ts.getOptionNameMap = getOptionNameMap;\n    function createCompilerDiagnosticForInvalidCustomType(opt) {\n        var namesOfType = Object.keys(opt.type).map(function (key) { return \"'\" + key + \"'\"; }).join(\", \");\n        return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, \"--\" + opt.name, namesOfType);\n    }\n    ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType;\n    function parseCustomTypeOption(opt, value, errors) {\n        var key = trimString((value || \"\")).toLowerCase();\n        var map = opt.type;\n        if (key in map) {\n            return map[key];\n        }\n        else {\n            errors.push(createCompilerDiagnosticForInvalidCustomType(opt));\n        }\n    }\n    ts.parseCustomTypeOption = parseCustomTypeOption;\n    function parseListTypeOption(opt, value, errors) {\n        if (value === void 0) { value = \"\"; }\n        value = trimString(value);\n        if (ts.startsWith(value, \"-\")) {\n            return undefined;\n        }\n        if (value === \"\") {\n            return [];\n        }\n        var values = value.split(\",\");\n        switch (opt.element.type) {\n            case \"number\":\n                return ts.map(values, parseInt);\n            case \"string\":\n                return ts.map(values, function (v) { return v || \"\"; });\n            default:\n                return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; });\n        }\n    }\n    ts.parseListTypeOption = parseListTypeOption;\n    function parseCommandLine(commandLine, readFile) {\n        var options = {};\n        var fileNames = [];\n        var errors = [];\n        var _a = getOptionNameMap(), optionNameMap = _a.optionNameMap, shortOptionNames = _a.shortOptionNames;\n        parseStrings(commandLine);\n        return {\n            options: options,\n            fileNames: fileNames,\n            errors: errors\n        };\n        function parseStrings(args) {\n            var i = 0;\n            while (i < args.length) {\n                var s = args[i];\n                i++;\n                if (s.charCodeAt(0) === 64) {\n                    parseResponseFile(s.slice(1));\n                }\n                else if (s.charCodeAt(0) === 45) {\n                    s = s.slice(s.charCodeAt(1) === 45 ? 2 : 1).toLowerCase();\n                    if (s in shortOptionNames) {\n                        s = shortOptionNames[s];\n                    }\n                    if (s in optionNameMap) {\n                        var opt = optionNameMap[s];\n                        if (opt.isTSConfigOnly) {\n                            errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name));\n                        }\n                        else {\n                            if (!args[i] && opt.type !== \"boolean\") {\n                                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name));\n                            }\n                            switch (opt.type) {\n                                case \"number\":\n                                    options[opt.name] = parseInt(args[i]);\n                                    i++;\n                                    break;\n                                case \"boolean\":\n                                    var optValue = args[i];\n                                    options[opt.name] = optValue !== \"false\";\n                                    if (optValue === \"false\" || optValue === \"true\") {\n                                        i++;\n                                    }\n                                    break;\n                                case \"string\":\n                                    options[opt.name] = args[i] || \"\";\n                                    i++;\n                                    break;\n                                case \"list\":\n                                    var result = parseListTypeOption(opt, args[i], errors);\n                                    options[opt.name] = result || [];\n                                    if (result) {\n                                        i++;\n                                    }\n                                    break;\n                                default:\n                                    options[opt.name] = parseCustomTypeOption(opt, args[i], errors);\n                                    i++;\n                                    break;\n                            }\n                        }\n                    }\n                    else {\n                        errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, s));\n                    }\n                }\n                else {\n                    fileNames.push(s);\n                }\n            }\n        }\n        function parseResponseFile(fileName) {\n            var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName);\n            if (!text) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName));\n                return;\n            }\n            var args = [];\n            var pos = 0;\n            while (true) {\n                while (pos < text.length && text.charCodeAt(pos) <= 32)\n                    pos++;\n                if (pos >= text.length)\n                    break;\n                var start = pos;\n                if (text.charCodeAt(start) === 34) {\n                    pos++;\n                    while (pos < text.length && text.charCodeAt(pos) !== 34)\n                        pos++;\n                    if (pos < text.length) {\n                        args.push(text.substring(start + 1, pos));\n                        pos++;\n                    }\n                    else {\n                        errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName));\n                    }\n                }\n                else {\n                    while (text.charCodeAt(pos) > 32)\n                        pos++;\n                    args.push(text.substring(start, pos));\n                }\n            }\n            parseStrings(args);\n        }\n    }\n    ts.parseCommandLine = parseCommandLine;\n    function readConfigFile(fileName, readFile) {\n        var text = \"\";\n        try {\n            text = readFile(fileName);\n        }\n        catch (e) {\n            return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) };\n        }\n        return parseConfigFileTextToJson(fileName, text);\n    }\n    ts.readConfigFile = readConfigFile;\n    function parseConfigFileTextToJson(fileName, jsonText, stripComments) {\n        if (stripComments === void 0) { stripComments = true; }\n        try {\n            var jsonTextToParse = stripComments ? removeComments(jsonText) : jsonText;\n            return { config: /\\S/.test(jsonTextToParse) ? JSON.parse(jsonTextToParse) : {} };\n        }\n        catch (e) {\n            return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) };\n        }\n    }\n    ts.parseConfigFileTextToJson = parseConfigFileTextToJson;\n    function generateTSConfig(options, fileNames) {\n        var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions);\n        var configurations = {\n            compilerOptions: serializeCompilerOptions(compilerOptions)\n        };\n        if (fileNames && fileNames.length) {\n            configurations.files = fileNames;\n        }\n        return configurations;\n        function getCustomTypeMapOfCommandLineOption(optionDefinition) {\n            if (optionDefinition.type === \"string\" || optionDefinition.type === \"number\" || optionDefinition.type === \"boolean\") {\n                return undefined;\n            }\n            else if (optionDefinition.type === \"list\") {\n                return getCustomTypeMapOfCommandLineOption(optionDefinition.element);\n            }\n            else {\n                return optionDefinition.type;\n            }\n        }\n        function getNameOfCompilerOptionValue(value, customTypeMap) {\n            for (var key in customTypeMap) {\n                if (customTypeMap[key] === value) {\n                    return key;\n                }\n            }\n            return undefined;\n        }\n        function serializeCompilerOptions(options) {\n            var result = ts.createMap();\n            var optionsNameMap = getOptionNameMap().optionNameMap;\n            for (var name_5 in options) {\n                if (ts.hasProperty(options, name_5)) {\n                    switch (name_5) {\n                        case \"init\":\n                        case \"watch\":\n                        case \"version\":\n                        case \"help\":\n                        case \"project\":\n                            break;\n                        default:\n                            var value = options[name_5];\n                            var optionDefinition = optionsNameMap[name_5.toLowerCase()];\n                            if (optionDefinition) {\n                                var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition);\n                                if (!customTypeMap) {\n                                    result[name_5] = value;\n                                }\n                                else {\n                                    if (optionDefinition.type === \"list\") {\n                                        var convertedValue = [];\n                                        for (var _i = 0, _a = value; _i < _a.length; _i++) {\n                                            var element = _a[_i];\n                                            convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap));\n                                        }\n                                        result[name_5] = convertedValue;\n                                    }\n                                    else {\n                                        result[name_5] = getNameOfCompilerOptionValue(value, customTypeMap);\n                                    }\n                                }\n                            }\n                            break;\n                    }\n                }\n            }\n            return result;\n        }\n    }\n    ts.generateTSConfig = generateTSConfig;\n    function removeComments(jsonText) {\n        var output = \"\";\n        var scanner = ts.createScanner(1, false, 0, jsonText);\n        var token;\n        while ((token = scanner.scan()) !== 1) {\n            switch (token) {\n                case 2:\n                case 3:\n                    output += scanner.getTokenText().replace(/\\S/g, \" \");\n                    break;\n                default:\n                    output += scanner.getTokenText();\n                    break;\n            }\n        }\n        return output;\n    }\n    function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) {\n        if (existingOptions === void 0) { existingOptions = {}; }\n        if (resolutionStack === void 0) { resolutionStack = []; }\n        var errors = [];\n        var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);\n        var resolvedPath = ts.toPath(configFileName || \"\", basePath, getCanonicalFileName);\n        if (resolutionStack.indexOf(resolvedPath) >= 0) {\n            return {\n                options: {},\n                fileNames: [],\n                typeAcquisition: {},\n                raw: json,\n                errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(\" -> \"))],\n                wildcardDirectories: {}\n            };\n        }\n        var options = convertCompilerOptionsFromJsonWorker(json[\"compilerOptions\"], basePath, errors, configFileName);\n        var jsonOptions = json[\"typeAcquisition\"] || json[\"typingOptions\"];\n        var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);\n        if (json[\"extends\"]) {\n            var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3];\n            if (typeof json[\"extends\"] === \"string\") {\n                _b = (tryExtendsName(json[\"extends\"]) || [include, exclude, files, baseOptions]), include = _b[0], exclude = _b[1], files = _b[2], baseOptions = _b[3];\n            }\n            else {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, \"extends\", \"string\"));\n            }\n            if (include && !json[\"include\"]) {\n                json[\"include\"] = include;\n            }\n            if (exclude && !json[\"exclude\"]) {\n                json[\"exclude\"] = exclude;\n            }\n            if (files && !json[\"files\"]) {\n                json[\"files\"] = files;\n            }\n            options = ts.assign({}, baseOptions, options);\n        }\n        options = ts.extend(existingOptions, options);\n        options.configFilePath = configFileName;\n        var _c = getFileNames(errors), fileNames = _c.fileNames, wildcardDirectories = _c.wildcardDirectories;\n        var compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors);\n        return {\n            options: options,\n            fileNames: fileNames,\n            typeAcquisition: typeAcquisition,\n            raw: json,\n            errors: errors,\n            wildcardDirectories: wildcardDirectories,\n            compileOnSave: compileOnSave\n        };\n        function tryExtendsName(extendedConfig) {\n            if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), \"./\") || ts.startsWith(ts.normalizeSlashes(extendedConfig), \"../\"))) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig));\n                return;\n            }\n            var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName);\n            if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, \".json\")) {\n                extendedConfigPath = extendedConfigPath + \".json\";\n                if (!host.fileExists(extendedConfigPath)) {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig));\n                    return;\n                }\n            }\n            var extendedResult = readConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });\n            if (extendedResult.error) {\n                errors.push(extendedResult.error);\n                return;\n            }\n            var extendedDirname = ts.getDirectoryPath(extendedConfigPath);\n            var relativeDifference = ts.convertToRelativePath(extendedDirname, basePath, getCanonicalFileName);\n            var updatePath = function (path) { return ts.isRootedDiskPath(path) ? path : ts.combinePaths(relativeDifference, path); };\n            var result = parseJsonConfigFileContent(extendedResult.config, host, extendedDirname, undefined, ts.getBaseFileName(extendedConfigPath), resolutionStack.concat([resolvedPath]));\n            errors.push.apply(errors, result.errors);\n            var _a = ts.map([\"include\", \"exclude\", \"files\"], function (key) {\n                if (!json[key] && extendedResult.config[key]) {\n                    return ts.map(extendedResult.config[key], updatePath);\n                }\n            }), include = _a[0], exclude = _a[1], files = _a[2];\n            return [include, exclude, files, result.options];\n        }\n        function getFileNames(errors) {\n            var fileNames;\n            if (ts.hasProperty(json, \"files\")) {\n                if (ts.isArray(json[\"files\"])) {\n                    fileNames = json[\"files\"];\n                    if (fileNames.length === 0) {\n                        errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || \"tsconfig.json\"));\n                    }\n                }\n                else {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, \"files\", \"Array\"));\n                }\n            }\n            var includeSpecs;\n            if (ts.hasProperty(json, \"include\")) {\n                if (ts.isArray(json[\"include\"])) {\n                    includeSpecs = json[\"include\"];\n                }\n                else {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, \"include\", \"Array\"));\n                }\n            }\n            var excludeSpecs;\n            if (ts.hasProperty(json, \"exclude\")) {\n                if (ts.isArray(json[\"exclude\"])) {\n                    excludeSpecs = json[\"exclude\"];\n                }\n                else {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, \"exclude\", \"Array\"));\n                }\n            }\n            else if (ts.hasProperty(json, \"excludes\")) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));\n            }\n            else {\n                excludeSpecs = includeSpecs ? [] : [\"node_modules\", \"bower_components\", \"jspm_packages\"];\n                var outDir = json[\"compilerOptions\"] && json[\"compilerOptions\"][\"outDir\"];\n                if (outDir) {\n                    excludeSpecs.push(outDir);\n                }\n            }\n            if (fileNames === undefined && includeSpecs === undefined) {\n                includeSpecs = [\"**/*\"];\n            }\n            var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors);\n            if (result.fileNames.length === 0 && !ts.hasProperty(json, \"files\") && resolutionStack.length === 0) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || \"tsconfig.json\", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || [])));\n            }\n            return result;\n        }\n        var _b;\n    }\n    ts.parseJsonConfigFileContent = parseJsonConfigFileContent;\n    function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) {\n        if (!ts.hasProperty(jsonOption, ts.compileOnSaveCommandLineOption.name)) {\n            return false;\n        }\n        var result = convertJsonOption(ts.compileOnSaveCommandLineOption, jsonOption[\"compileOnSave\"], basePath, errors);\n        if (typeof result === \"boolean\" && result) {\n            return result;\n        }\n        return false;\n    }\n    ts.convertCompileOnSaveOptionFromJson = convertCompileOnSaveOptionFromJson;\n    function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) {\n        var errors = [];\n        var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName);\n        return { options: options, errors: errors };\n    }\n    ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson;\n    function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) {\n        var errors = [];\n        var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);\n        return { options: options, errors: errors };\n    }\n    ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson;\n    function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {\n        var options = ts.getBaseFileName(configFileName) === \"jsconfig.json\"\n            ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true }\n            : {};\n        convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);\n        return options;\n    }\n    function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) {\n        var options = { enable: ts.getBaseFileName(configFileName) === \"jsconfig.json\", include: [], exclude: [] };\n        var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions);\n        convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors);\n        return options;\n    }\n    function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) {\n        if (!jsonOptions) {\n            return;\n        }\n        var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; });\n        for (var id in jsonOptions) {\n            if (id in optionNameMap) {\n                var opt = optionNameMap[id];\n                defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors);\n            }\n            else {\n                errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id));\n            }\n        }\n    }\n    function convertJsonOption(opt, value, basePath, errors) {\n        var optType = opt.type;\n        var expectedType = typeof optType === \"string\" ? optType : \"string\";\n        if (optType === \"list\" && ts.isArray(value)) {\n            return convertJsonOptionOfListType(opt, value, basePath, errors);\n        }\n        else if (typeof value === expectedType) {\n            if (typeof optType !== \"string\") {\n                return convertJsonOptionOfCustomType(opt, value, errors);\n            }\n            else {\n                if (opt.isFilePath) {\n                    value = ts.normalizePath(ts.combinePaths(basePath, value));\n                    if (value === \"\") {\n                        value = \".\";\n                    }\n                }\n            }\n            return value;\n        }\n        else {\n            errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType));\n        }\n    }\n    function convertJsonOptionOfCustomType(opt, value, errors) {\n        var key = value.toLowerCase();\n        if (key in opt.type) {\n            return opt.type[key];\n        }\n        else {\n            errors.push(createCompilerDiagnosticForInvalidCustomType(opt));\n        }\n    }\n    function convertJsonOptionOfListType(option, values, basePath, errors) {\n        return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; });\n    }\n    function trimString(s) {\n        return typeof s.trim === \"function\" ? s.trim() : s.replace(/^[\\s]+|[\\s]+$/g, \"\");\n    }\n    var invalidTrailingRecursionPattern = /(^|\\/)\\*\\*\\/?$/;\n    var invalidMultipleRecursionPatterns = /(^|\\/)\\*\\*\\/(.*\\/)?\\*\\*($|\\/)/;\n    var invalidDotDotAfterRecursiveWildcardPattern = /(^|\\/)\\*\\*\\/(.*\\/)?\\.\\.($|\\/)/;\n    var watchRecursivePattern = /\\/[^/]*?[*?][^/]*\\//;\n    var wildcardDirectoryPattern = /^[^*?]*(?=\\/[^/]*[*?])/;\n    function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) {\n        basePath = ts.normalizePath(basePath);\n        var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper;\n        var literalFileMap = ts.createMap();\n        var wildcardFileMap = ts.createMap();\n        if (include) {\n            include = validateSpecs(include, errors, false);\n        }\n        if (exclude) {\n            exclude = validateSpecs(exclude, errors, true);\n        }\n        var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames);\n        var supportedExtensions = ts.getSupportedExtensions(options);\n        if (fileNames) {\n            for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) {\n                var fileName = fileNames_1[_i];\n                var file = ts.combinePaths(basePath, fileName);\n                literalFileMap[keyMapper(file)] = file;\n            }\n        }\n        if (include && include.length > 0) {\n            for (var _a = 0, _b = host.readDirectory(basePath, supportedExtensions, exclude, include); _a < _b.length; _a++) {\n                var file = _b[_a];\n                if (hasFileWithHigherPriorityExtension(file, literalFileMap, wildcardFileMap, supportedExtensions, keyMapper)) {\n                    continue;\n                }\n                removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper);\n                var key = keyMapper(file);\n                if (!(key in literalFileMap) && !(key in wildcardFileMap)) {\n                    wildcardFileMap[key] = file;\n                }\n            }\n        }\n        var literalFiles = ts.reduceProperties(literalFileMap, addFileToOutput, []);\n        var wildcardFiles = ts.reduceProperties(wildcardFileMap, addFileToOutput, []);\n        wildcardFiles.sort(host.useCaseSensitiveFileNames ? ts.compareStrings : ts.compareStringsCaseInsensitive);\n        return {\n            fileNames: literalFiles.concat(wildcardFiles),\n            wildcardDirectories: wildcardDirectories\n        };\n    }\n    function validateSpecs(specs, errors, allowTrailingRecursion) {\n        var validSpecs = [];\n        for (var _i = 0, specs_2 = specs; _i < specs_2.length; _i++) {\n            var spec = specs_2[_i];\n            if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec));\n            }\n            else if (invalidMultipleRecursionPatterns.test(spec)) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0, spec));\n            }\n            else if (invalidDotDotAfterRecursiveWildcardPattern.test(spec)) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec));\n            }\n            else {\n                validSpecs.push(spec);\n            }\n        }\n        return validSpecs;\n    }\n    function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) {\n        var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, \"exclude\");\n        var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? \"\" : \"i\");\n        var wildcardDirectories = ts.createMap();\n        if (include !== undefined) {\n            var recursiveKeys = [];\n            for (var _i = 0, include_1 = include; _i < include_1.length; _i++) {\n                var file = include_1[_i];\n                var spec = ts.normalizePath(ts.combinePaths(path, file));\n                if (excludeRegex && excludeRegex.test(spec)) {\n                    continue;\n                }\n                var match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames);\n                if (match) {\n                    var key = match.key, flags = match.flags;\n                    var existingFlags = wildcardDirectories[key];\n                    if (existingFlags === undefined || existingFlags < flags) {\n                        wildcardDirectories[key] = flags;\n                        if (flags === 1) {\n                            recursiveKeys.push(key);\n                        }\n                    }\n                }\n            }\n            for (var key in wildcardDirectories) {\n                for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) {\n                    var recursiveKey = recursiveKeys_1[_a];\n                    if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) {\n                        delete wildcardDirectories[key];\n                    }\n                }\n            }\n        }\n        return wildcardDirectories;\n    }\n    function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames) {\n        var match = wildcardDirectoryPattern.exec(spec);\n        if (match) {\n            return {\n                key: useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase(),\n                flags: watchRecursivePattern.test(spec) ? 1 : 0\n            };\n        }\n        if (ts.isImplicitGlob(spec)) {\n            return { key: spec, flags: 1 };\n        }\n        return undefined;\n    }\n    function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) {\n        var extensionPriority = ts.getExtensionPriority(file, extensions);\n        var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority);\n        for (var i = 0; i < adjustedExtensionPriority; i++) {\n            var higherPriorityExtension = extensions[i];\n            var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension));\n            if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) {\n                return true;\n            }\n        }\n        return false;\n    }\n    function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) {\n        var extensionPriority = ts.getExtensionPriority(file, extensions);\n        var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority);\n        for (var i = nextExtensionPriority; i < extensions.length; i++) {\n            var lowerPriorityExtension = extensions[i];\n            var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension));\n            delete wildcardFiles[lowerPriorityPath];\n        }\n    }\n    function addFileToOutput(output, file) {\n        output.push(file);\n        return output;\n    }\n    function caseSensitiveKeyMapper(key) {\n        return key;\n    }\n    function caseInsensitiveKeyMapper(key) {\n        return key.toLowerCase();\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var JsTyping;\n    (function (JsTyping) {\n        ;\n        ;\n        var safeList;\n        var EmptySafeList = ts.createMap();\n        JsTyping.nodeCoreModuleList = [\n            \"buffer\", \"querystring\", \"events\", \"http\", \"cluster\",\n            \"zlib\", \"os\", \"https\", \"punycode\", \"repl\", \"readline\",\n            \"vm\", \"child_process\", \"url\", \"dns\", \"net\",\n            \"dgram\", \"fs\", \"path\", \"string_decoder\", \"tls\",\n            \"crypto\", \"stream\", \"util\", \"assert\", \"tty\", \"domain\",\n            \"constants\", \"process\", \"v8\", \"timers\", \"console\"\n        ];\n        var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; });\n        function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) {\n            var inferredTypings = ts.createMap();\n            if (!typeAcquisition || !typeAcquisition.enable) {\n                return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] };\n            }\n            fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) {\n                var kind = ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f));\n                return kind === 1 || kind === 2;\n            });\n            if (!safeList) {\n                var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); });\n                safeList = result.config ? ts.createMap(result.config) : EmptySafeList;\n            }\n            var filesToWatch = [];\n            var searchDirs = [];\n            var exclude = [];\n            mergeTypings(typeAcquisition.include);\n            exclude = typeAcquisition.exclude || [];\n            var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);\n            if (projectRootPath) {\n                possibleSearchDirs.push(projectRootPath);\n            }\n            searchDirs = ts.deduplicate(possibleSearchDirs);\n            for (var _i = 0, searchDirs_1 = searchDirs; _i < searchDirs_1.length; _i++) {\n                var searchDir = searchDirs_1[_i];\n                var packageJsonPath = ts.combinePaths(searchDir, \"package.json\");\n                getTypingNamesFromJson(packageJsonPath, filesToWatch);\n                var bowerJsonPath = ts.combinePaths(searchDir, \"bower.json\");\n                getTypingNamesFromJson(bowerJsonPath, filesToWatch);\n                var nodeModulesPath = ts.combinePaths(searchDir, \"node_modules\");\n                getTypingNamesFromNodeModuleFolder(nodeModulesPath);\n            }\n            getTypingNamesFromSourceFileNames(fileNames);\n            if (unresolvedImports) {\n                for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) {\n                    var moduleId = unresolvedImports_1[_a];\n                    var typingName = moduleId in nodeCoreModules ? \"node\" : moduleId;\n                    if (!(typingName in inferredTypings)) {\n                        inferredTypings[typingName] = undefined;\n                    }\n                }\n            }\n            for (var name_6 in packageNameToTypingLocation) {\n                if (name_6 in inferredTypings && !inferredTypings[name_6]) {\n                    inferredTypings[name_6] = packageNameToTypingLocation[name_6];\n                }\n            }\n            for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) {\n                var excludeTypingName = exclude_1[_b];\n                delete inferredTypings[excludeTypingName];\n            }\n            var newTypingNames = [];\n            var cachedTypingPaths = [];\n            for (var typing in inferredTypings) {\n                if (inferredTypings[typing] !== undefined) {\n                    cachedTypingPaths.push(inferredTypings[typing]);\n                }\n                else {\n                    newTypingNames.push(typing);\n                }\n            }\n            return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch };\n            function mergeTypings(typingNames) {\n                if (!typingNames) {\n                    return;\n                }\n                for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) {\n                    var typing = typingNames_1[_i];\n                    if (!(typing in inferredTypings)) {\n                        inferredTypings[typing] = undefined;\n                    }\n                }\n            }\n            function getTypingNamesFromJson(jsonPath, filesToWatch) {\n                if (host.fileExists(jsonPath)) {\n                    filesToWatch.push(jsonPath);\n                }\n                var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); });\n                if (result.config) {\n                    var jsonConfig = result.config;\n                    if (jsonConfig.dependencies) {\n                        mergeTypings(ts.getOwnKeys(jsonConfig.dependencies));\n                    }\n                    if (jsonConfig.devDependencies) {\n                        mergeTypings(ts.getOwnKeys(jsonConfig.devDependencies));\n                    }\n                    if (jsonConfig.optionalDependencies) {\n                        mergeTypings(ts.getOwnKeys(jsonConfig.optionalDependencies));\n                    }\n                    if (jsonConfig.peerDependencies) {\n                        mergeTypings(ts.getOwnKeys(jsonConfig.peerDependencies));\n                    }\n                }\n            }\n            function getTypingNamesFromSourceFileNames(fileNames) {\n                var jsFileNames = ts.filter(fileNames, ts.hasJavaScriptFileExtension);\n                var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); });\n                var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\\.|-)min(?=\\.|$))|((?:-|\\.)\\d+)/g, \"\"); });\n                if (safeList !== EmptySafeList) {\n                    mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; }));\n                }\n                var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2; });\n                if (hasJsxFile) {\n                    mergeTypings([\"react\"]);\n                }\n            }\n            function getTypingNamesFromNodeModuleFolder(nodeModulesPath) {\n                if (!host.directoryExists(nodeModulesPath)) {\n                    return;\n                }\n                var typingNames = [];\n                var fileNames = host.readDirectory(nodeModulesPath, [\".json\"], undefined, undefined, 2);\n                for (var _i = 0, fileNames_2 = fileNames; _i < fileNames_2.length; _i++) {\n                    var fileName = fileNames_2[_i];\n                    var normalizedFileName = ts.normalizePath(fileName);\n                    if (ts.getBaseFileName(normalizedFileName) !== \"package.json\") {\n                        continue;\n                    }\n                    var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); });\n                    if (!result.config) {\n                        continue;\n                    }\n                    var packageJson = result.config;\n                    if (packageJson._requiredBy &&\n                        ts.filter(packageJson._requiredBy, function (r) { return r[0] === \"#\" || r === \"/\"; }).length === 0) {\n                        continue;\n                    }\n                    if (!packageJson.name) {\n                        continue;\n                    }\n                    if (packageJson.typings) {\n                        var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName));\n                        inferredTypings[packageJson.name] = absolutePath;\n                    }\n                    else {\n                        typingNames.push(packageJson.name);\n                    }\n                }\n                mergeTypings(typingNames);\n            }\n        }\n        JsTyping.discoverTypings = discoverTypings;\n    })(JsTyping = ts.JsTyping || (ts.JsTyping = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var server;\n    (function (server) {\n        server.ActionSet = \"action::set\";\n        server.ActionInvalidate = \"action::invalidate\";\n        server.EventBeginInstallTypes = \"event::beginInstallTypes\";\n        server.EventEndInstallTypes = \"event::endInstallTypes\";\n        var Arguments;\n        (function (Arguments) {\n            Arguments.GlobalCacheLocation = \"--globalTypingsCacheLocation\";\n            Arguments.LogFile = \"--logFile\";\n            Arguments.EnableTelemetry = \"--enableTelemetry\";\n        })(Arguments = server.Arguments || (server.Arguments = {}));\n        function hasArgument(argumentName) {\n            return ts.sys.args.indexOf(argumentName) >= 0;\n        }\n        server.hasArgument = hasArgument;\n        function findArgument(argumentName) {\n            var index = ts.sys.args.indexOf(argumentName);\n            return index >= 0 && index < ts.sys.args.length - 1\n                ? ts.sys.args[index + 1]\n                : undefined;\n        }\n        server.findArgument = findArgument;\n    })(server = ts.server || (ts.server = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var server;\n    (function (server) {\n        var LogLevel;\n        (function (LogLevel) {\n            LogLevel[LogLevel[\"terse\"] = 0] = \"terse\";\n            LogLevel[LogLevel[\"normal\"] = 1] = \"normal\";\n            LogLevel[LogLevel[\"requestTime\"] = 2] = \"requestTime\";\n            LogLevel[LogLevel[\"verbose\"] = 3] = \"verbose\";\n        })(LogLevel = server.LogLevel || (server.LogLevel = {}));\n        server.emptyArray = [];\n        var Msg;\n        (function (Msg) {\n            Msg.Err = \"Err\";\n            Msg.Info = \"Info\";\n            Msg.Perf = \"Perf\";\n        })(Msg = server.Msg || (server.Msg = {}));\n        function getProjectRootPath(project) {\n            switch (project.projectKind) {\n                case server.ProjectKind.Configured:\n                    return ts.getDirectoryPath(project.getProjectName());\n                case server.ProjectKind.Inferred:\n                    return \"\";\n                case server.ProjectKind.External:\n                    var projectName = ts.normalizeSlashes(project.getProjectName());\n                    return project.projectService.host.fileExists(projectName) ? ts.getDirectoryPath(projectName) : projectName;\n            }\n        }\n        function createInstallTypingsRequest(project, typeAcquisition, unresolvedImports, cachePath) {\n            return {\n                projectName: project.getProjectName(),\n                fileNames: project.getFileNames(true),\n                compilerOptions: project.getCompilerOptions(),\n                typeAcquisition: typeAcquisition,\n                unresolvedImports: unresolvedImports,\n                projectRootPath: getProjectRootPath(project),\n                cachePath: cachePath,\n                kind: \"discover\"\n            };\n        }\n        server.createInstallTypingsRequest = createInstallTypingsRequest;\n        var Errors;\n        (function (Errors) {\n            function ThrowNoProject() {\n                throw new Error(\"No Project.\");\n            }\n            Errors.ThrowNoProject = ThrowNoProject;\n            function ThrowProjectLanguageServiceDisabled() {\n                throw new Error(\"The project's language service is disabled.\");\n            }\n            Errors.ThrowProjectLanguageServiceDisabled = ThrowProjectLanguageServiceDisabled;\n            function ThrowProjectDoesNotContainDocument(fileName, project) {\n                throw new Error(\"Project '\" + project.getProjectName() + \"' does not contain document '\" + fileName + \"'\");\n            }\n            Errors.ThrowProjectDoesNotContainDocument = ThrowProjectDoesNotContainDocument;\n        })(Errors = server.Errors || (server.Errors = {}));\n        function getDefaultFormatCodeSettings(host) {\n            return {\n                indentSize: 4,\n                tabSize: 4,\n                newLineCharacter: host.newLine || \"\\n\",\n                convertTabsToSpaces: true,\n                indentStyle: ts.IndentStyle.Smart,\n                insertSpaceAfterCommaDelimiter: true,\n                insertSpaceAfterSemicolonInForStatements: true,\n                insertSpaceBeforeAndAfterBinaryOperators: true,\n                insertSpaceAfterKeywordsInControlFlowStatements: true,\n                insertSpaceAfterFunctionKeywordForAnonymousFunctions: false,\n                insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,\n                insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,\n                insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false,\n                insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false,\n                placeOpenBraceOnNewLineForFunctions: false,\n                placeOpenBraceOnNewLineForControlBlocks: false,\n            };\n        }\n        server.getDefaultFormatCodeSettings = getDefaultFormatCodeSettings;\n        function mergeMaps(target, source) {\n            for (var key in source) {\n                if (ts.hasProperty(source, key)) {\n                    target[key] = source[key];\n                }\n            }\n        }\n        server.mergeMaps = mergeMaps;\n        function removeItemFromSet(items, itemToRemove) {\n            if (items.length === 0) {\n                return;\n            }\n            var index = items.indexOf(itemToRemove);\n            if (index < 0) {\n                return;\n            }\n            if (index === items.length - 1) {\n                items.pop();\n            }\n            else {\n                items[index] = items.pop();\n            }\n        }\n        server.removeItemFromSet = removeItemFromSet;\n        function toNormalizedPath(fileName) {\n            return ts.normalizePath(fileName);\n        }\n        server.toNormalizedPath = toNormalizedPath;\n        function normalizedPathToPath(normalizedPath, currentDirectory, getCanonicalFileName) {\n            var f = ts.isRootedDiskPath(normalizedPath) ? normalizedPath : ts.getNormalizedAbsolutePath(normalizedPath, currentDirectory);\n            return getCanonicalFileName(f);\n        }\n        server.normalizedPathToPath = normalizedPathToPath;\n        function asNormalizedPath(fileName) {\n            return fileName;\n        }\n        server.asNormalizedPath = asNormalizedPath;\n        function createNormalizedPathMap() {\n            var map = Object.create(null);\n            return {\n                get: function (path) {\n                    return map[path];\n                },\n                set: function (path, value) {\n                    map[path] = value;\n                },\n                contains: function (path) {\n                    return ts.hasProperty(map, path);\n                },\n                remove: function (path) {\n                    delete map[path];\n                }\n            };\n        }\n        server.createNormalizedPathMap = createNormalizedPathMap;\n        function isInferredProjectName(name) {\n            return /dev\\/null\\/inferredProject\\d+\\*/.test(name);\n        }\n        server.isInferredProjectName = isInferredProjectName;\n        function makeInferredProjectName(counter) {\n            return \"/dev/null/inferredProject\" + counter + \"*\";\n        }\n        server.makeInferredProjectName = makeInferredProjectName;\n        function toSortedReadonlyArray(arr) {\n            arr.sort();\n            return arr;\n        }\n        server.toSortedReadonlyArray = toSortedReadonlyArray;\n        var ThrottledOperations = (function () {\n            function ThrottledOperations(host) {\n                this.host = host;\n                this.pendingTimeouts = ts.createMap();\n            }\n            ThrottledOperations.prototype.schedule = function (operationId, delay, cb) {\n                if (ts.hasProperty(this.pendingTimeouts, operationId)) {\n                    this.host.clearTimeout(this.pendingTimeouts[operationId]);\n                }\n                this.pendingTimeouts[operationId] = this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb);\n            };\n            ThrottledOperations.run = function (self, operationId, cb) {\n                delete self.pendingTimeouts[operationId];\n                cb();\n            };\n            return ThrottledOperations;\n        }());\n        server.ThrottledOperations = ThrottledOperations;\n        var GcTimer = (function () {\n            function GcTimer(host, delay, logger) {\n                this.host = host;\n                this.delay = delay;\n                this.logger = logger;\n            }\n            GcTimer.prototype.scheduleCollect = function () {\n                if (!this.host.gc || this.timerId != undefined) {\n                    return;\n                }\n                this.timerId = this.host.setTimeout(GcTimer.run, this.delay, this);\n            };\n            GcTimer.run = function (self) {\n                self.timerId = undefined;\n                var log = self.logger.hasLevel(LogLevel.requestTime);\n                var before = log && self.host.getMemoryUsage();\n                self.host.gc();\n                if (log) {\n                    var after = self.host.getMemoryUsage();\n                    self.logger.perftrc(\"GC::before \" + before + \", after \" + after);\n                }\n            };\n            return GcTimer;\n        }());\n        server.GcTimer = GcTimer;\n    })(server = ts.server || (ts.server = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function trace(host) {\n        host.trace(ts.formatMessage.apply(undefined, arguments));\n    }\n    ts.trace = trace;\n    function isTraceEnabled(compilerOptions, host) {\n        return compilerOptions.traceResolution && host.trace !== undefined;\n    }\n    ts.isTraceEnabled = isTraceEnabled;\n    function resolvedTypeScriptOnly(resolved) {\n        if (!resolved) {\n            return undefined;\n        }\n        ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension));\n        return resolved.path;\n    }\n    function resolvedFromAnyFile(path) {\n        return { path: path, extension: ts.extensionFromPath(path) };\n    }\n    function resolvedModuleFromResolved(_a, isExternalLibraryImport) {\n        var path = _a.path, extension = _a.extension;\n        return { resolvedFileName: path, extension: extension, isExternalLibraryImport: isExternalLibraryImport };\n    }\n    function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations) {\n        return { resolvedModule: resolved && resolvedModuleFromResolved(resolved, isExternalLibraryImport), failedLookupLocations: failedLookupLocations };\n    }\n    function moduleHasNonRelativeName(moduleName) {\n        return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));\n    }\n    ts.moduleHasNonRelativeName = moduleHasNonRelativeName;\n    function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) {\n        var jsonContent = readJson(packageJsonPath, state.host);\n        switch (extensions) {\n            case 2:\n            case 0:\n                return tryReadFromField(\"typings\") || tryReadFromField(\"types\");\n            case 1:\n                if (typeof jsonContent.main === \"string\") {\n                    if (state.traceEnabled) {\n                        trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main);\n                    }\n                    return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main));\n                }\n                return undefined;\n        }\n        function tryReadFromField(fieldName) {\n            if (ts.hasProperty(jsonContent, fieldName)) {\n                var typesFile = jsonContent[fieldName];\n                if (typeof typesFile === \"string\") {\n                    var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile));\n                    if (state.traceEnabled) {\n                        trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath);\n                    }\n                    return typesFilePath;\n                }\n                else {\n                    if (state.traceEnabled) {\n                        trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof typesFile);\n                    }\n                }\n            }\n        }\n    }\n    function readJson(path, host) {\n        try {\n            var jsonText = host.readFile(path);\n            return jsonText ? JSON.parse(jsonText) : {};\n        }\n        catch (e) {\n            return {};\n        }\n    }\n    function getEffectiveTypeRoots(options, host) {\n        if (options.typeRoots) {\n            return options.typeRoots;\n        }\n        var currentDirectory;\n        if (options.configFilePath) {\n            currentDirectory = ts.getDirectoryPath(options.configFilePath);\n        }\n        else if (host.getCurrentDirectory) {\n            currentDirectory = host.getCurrentDirectory();\n        }\n        if (currentDirectory !== undefined) {\n            return getDefaultTypeRoots(currentDirectory, host);\n        }\n    }\n    ts.getEffectiveTypeRoots = getEffectiveTypeRoots;\n    function getDefaultTypeRoots(currentDirectory, host) {\n        if (!host.directoryExists) {\n            return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)];\n        }\n        var typeRoots;\n        forEachAncestorDirectory(currentDirectory, function (directory) {\n            var atTypes = ts.combinePaths(directory, nodeModulesAtTypes);\n            if (host.directoryExists(atTypes)) {\n                (typeRoots || (typeRoots = [])).push(atTypes);\n            }\n        });\n        return typeRoots;\n    }\n    var nodeModulesAtTypes = ts.combinePaths(\"node_modules\", \"@types\");\n    function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) {\n        var traceEnabled = isTraceEnabled(options, host);\n        var moduleResolutionState = {\n            compilerOptions: options,\n            host: host,\n            traceEnabled: traceEnabled\n        };\n        var typeRoots = getEffectiveTypeRoots(options, host);\n        if (traceEnabled) {\n            if (containingFile === undefined) {\n                if (typeRoots === undefined) {\n                    trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName);\n                }\n                else {\n                    trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, typeRoots);\n                }\n            }\n            else {\n                if (typeRoots === undefined) {\n                    trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile);\n                }\n                else {\n                    trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, typeRoots);\n                }\n            }\n        }\n        var failedLookupLocations = [];\n        var resolved = primaryLookup();\n        var primary = true;\n        if (!resolved) {\n            resolved = secondaryLookup();\n            primary = false;\n        }\n        var resolvedTypeReferenceDirective;\n        if (resolved) {\n            resolved = realpath(resolved, host, traceEnabled);\n            if (traceEnabled) {\n                trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolved, primary);\n            }\n            resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolved };\n        }\n        return { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };\n        function primaryLookup() {\n            if (typeRoots && typeRoots.length) {\n                if (traceEnabled) {\n                    trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(\", \"));\n                }\n                return ts.forEach(typeRoots, function (typeRoot) {\n                    var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName);\n                    var candidateDirectory = ts.getDirectoryPath(candidate);\n                    return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState));\n                });\n            }\n            else {\n                if (traceEnabled) {\n                    trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths);\n                }\n            }\n        }\n        function secondaryLookup() {\n            var resolvedFile;\n            var initialLocationForSecondaryLookup = containingFile && ts.getDirectoryPath(containingFile);\n            if (initialLocationForSecondaryLookup !== undefined) {\n                if (traceEnabled) {\n                    trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);\n                }\n                resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState));\n                if (!resolvedFile && traceEnabled) {\n                    trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName);\n                }\n                return resolvedFile;\n            }\n            else {\n                if (traceEnabled) {\n                    trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder);\n                }\n            }\n        }\n    }\n    ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;\n    function getAutomaticTypeDirectiveNames(options, host) {\n        if (options.types) {\n            return options.types;\n        }\n        var result = [];\n        if (host.directoryExists && host.getDirectories) {\n            var typeRoots = getEffectiveTypeRoots(options, host);\n            if (typeRoots) {\n                for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) {\n                    var root = typeRoots_1[_i];\n                    if (host.directoryExists(root)) {\n                        for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) {\n                            var typeDirectivePath = _b[_a];\n                            var normalized = ts.normalizePath(typeDirectivePath);\n                            var packageJsonPath = pathToPackageJson(ts.combinePaths(root, normalized));\n                            var isNotNeededPackage = host.fileExists(packageJsonPath) && readJson(packageJsonPath, host).typings === null;\n                            if (!isNotNeededPackage) {\n                                result.push(ts.getBaseFileName(normalized));\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        return result;\n    }\n    ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;\n    function resolveModuleName(moduleName, containingFile, compilerOptions, host) {\n        var traceEnabled = isTraceEnabled(compilerOptions, host);\n        if (traceEnabled) {\n            trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile);\n        }\n        var moduleResolution = compilerOptions.moduleResolution;\n        if (moduleResolution === undefined) {\n            moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;\n            if (traceEnabled) {\n                trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]);\n            }\n        }\n        else {\n            if (traceEnabled) {\n                trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]);\n            }\n        }\n        var result;\n        switch (moduleResolution) {\n            case ts.ModuleResolutionKind.NodeJs:\n                result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host);\n                break;\n            case ts.ModuleResolutionKind.Classic:\n                result = classicNameResolver(moduleName, containingFile, compilerOptions, host);\n                break;\n        }\n        if (traceEnabled) {\n            if (result.resolvedModule) {\n                trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName);\n            }\n            else {\n                trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName);\n            }\n        }\n        return result;\n    }\n    ts.resolveModuleName = resolveModuleName;\n    function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) {\n        if (moduleHasNonRelativeName(moduleName)) {\n            return tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state);\n        }\n        else {\n            return tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state);\n        }\n    }\n    function tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) {\n        if (!state.compilerOptions.rootDirs) {\n            return undefined;\n        }\n        if (state.traceEnabled) {\n            trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName);\n        }\n        var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));\n        var matchedRootDir;\n        var matchedNormalizedPrefix;\n        for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) {\n            var rootDir = _a[_i];\n            var normalizedRoot = ts.normalizePath(rootDir);\n            if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) {\n                normalizedRoot += ts.directorySeparator;\n            }\n            var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) &&\n                (matchedNormalizedPrefix === undefined || matchedNormalizedPrefix.length < normalizedRoot.length);\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix);\n            }\n            if (isLongestMatchingPrefix) {\n                matchedNormalizedPrefix = normalizedRoot;\n                matchedRootDir = rootDir;\n            }\n        }\n        if (matchedNormalizedPrefix) {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix);\n            }\n            var suffix = candidate.substr(matchedNormalizedPrefix.length);\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate);\n            }\n            var resolvedFileName = loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state);\n            if (resolvedFileName) {\n                return resolvedFileName;\n            }\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs);\n            }\n            for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) {\n                var rootDir = _c[_b];\n                if (rootDir === matchedRootDir) {\n                    continue;\n                }\n                var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix);\n                if (state.traceEnabled) {\n                    trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1);\n                }\n                var baseDirectory = ts.getDirectoryPath(candidate_1);\n                var resolvedFileName_1 = loader(extensions, candidate_1, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state);\n                if (resolvedFileName_1) {\n                    return resolvedFileName_1;\n                }\n            }\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed);\n            }\n        }\n        return undefined;\n    }\n    function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state) {\n        if (!state.compilerOptions.baseUrl) {\n            return undefined;\n        }\n        if (state.traceEnabled) {\n            trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName);\n        }\n        var matchedPattern = undefined;\n        if (state.compilerOptions.paths) {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName);\n            }\n            matchedPattern = ts.matchPatternOrExact(ts.getOwnKeys(state.compilerOptions.paths), moduleName);\n        }\n        if (matchedPattern) {\n            var matchedStar_1 = typeof matchedPattern === \"string\" ? undefined : ts.matchedText(matchedPattern, moduleName);\n            var matchedPatternText = typeof matchedPattern === \"string\" ? matchedPattern : ts.patternText(matchedPattern);\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPatternText);\n            }\n            return ts.forEach(state.compilerOptions.paths[matchedPatternText], function (subst) {\n                var path = matchedStar_1 ? subst.replace(\"*\", matchedStar_1) : subst;\n                var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, path));\n                if (state.traceEnabled) {\n                    trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path);\n                }\n                var tsExtension = ts.tryGetExtensionFromPath(candidate);\n                if (tsExtension !== undefined) {\n                    var path_1 = tryFile(candidate, failedLookupLocations, false, state);\n                    return path_1 && { path: path_1, extension: tsExtension };\n                }\n                return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);\n            });\n        }\n        else {\n            var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, moduleName));\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate);\n            }\n            return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);\n        }\n    }\n    function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) {\n        var containingDirectory = ts.getDirectoryPath(containingFile);\n        var traceEnabled = isTraceEnabled(compilerOptions, host);\n        var failedLookupLocations = [];\n        var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };\n        var result = tryResolve(0) || tryResolve(1);\n        if (result) {\n            var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport;\n            return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations);\n        }\n        return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };\n        function tryResolve(extensions) {\n            var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state);\n            if (resolved) {\n                return { resolved: resolved, isExternalLibraryImport: false };\n            }\n            if (moduleHasNonRelativeName(moduleName)) {\n                if (traceEnabled) {\n                    trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName);\n                }\n                var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state);\n                return resolved_1 && { resolved: { path: realpath(resolved_1.path, host, traceEnabled), extension: resolved_1.extension }, isExternalLibraryImport: true };\n            }\n            else {\n                var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));\n                var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state);\n                return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false };\n            }\n        }\n    }\n    ts.nodeModuleNameResolver = nodeModuleNameResolver;\n    function realpath(path, host, traceEnabled) {\n        if (!host.realpath) {\n            return path;\n        }\n        var real = ts.normalizePath(host.realpath(path));\n        if (traceEnabled) {\n            trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, path, real);\n        }\n        return real;\n    }\n    function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) {\n        if (state.traceEnabled) {\n            trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate);\n        }\n        var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state);\n        return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state);\n    }\n    function directoryProbablyExists(directoryName, host) {\n        return !host.directoryExists || host.directoryExists(directoryName);\n    }\n    ts.directoryProbablyExists = directoryProbablyExists;\n    function loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) {\n        var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state);\n        if (resolvedByAddingExtension) {\n            return resolvedByAddingExtension;\n        }\n        if (ts.hasJavaScriptFileExtension(candidate)) {\n            var extensionless = ts.removeFileExtension(candidate);\n            if (state.traceEnabled) {\n                var extension = candidate.substring(extensionless.length);\n                trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);\n            }\n            return tryAddingExtensions(extensionless, extensions, failedLookupLocations, onlyRecordFailures, state);\n        }\n    }\n    function tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state) {\n        if (!onlyRecordFailures) {\n            var directory = ts.getDirectoryPath(candidate);\n            if (directory) {\n                onlyRecordFailures = !directoryProbablyExists(directory, state.host);\n            }\n        }\n        switch (extensions) {\n            case 2:\n                return tryExtension(\".d.ts\", ts.Extension.Dts);\n            case 0:\n                return tryExtension(\".ts\", ts.Extension.Ts) || tryExtension(\".tsx\", ts.Extension.Tsx) || tryExtension(\".d.ts\", ts.Extension.Dts);\n            case 1:\n                return tryExtension(\".js\", ts.Extension.Js) || tryExtension(\".jsx\", ts.Extension.Jsx);\n        }\n        function tryExtension(ext, extension) {\n            var path = tryFile(candidate + ext, failedLookupLocations, onlyRecordFailures, state);\n            return path && { path: path, extension: extension };\n        }\n    }\n    function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) {\n        if (!onlyRecordFailures && state.host.fileExists(fileName)) {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName);\n            }\n            return fileName;\n        }\n        else {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName);\n            }\n            failedLookupLocations.push(fileName);\n            return undefined;\n        }\n    }\n    function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) {\n        var packageJsonPath = pathToPackageJson(candidate);\n        var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host);\n        if (directoryExists && state.host.fileExists(packageJsonPath)) {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);\n            }\n            var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state);\n            if (typesFile) {\n                var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host);\n                var fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures_1, state);\n                if (fromFile) {\n                    return resolvedFromAnyFile(fromFile);\n                }\n                var x = tryAddingExtensions(typesFile, 0, failedLookupLocations, onlyRecordFailures_1, state);\n                if (x) {\n                    return x;\n                }\n            }\n            else {\n                if (state.traceEnabled) {\n                    trace(state.host, ts.Diagnostics.package_json_does_not_have_a_types_or_main_field);\n                }\n            }\n        }\n        else {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath);\n            }\n            failedLookupLocations.push(packageJsonPath);\n        }\n        return loadModuleFromFile(extensions, ts.combinePaths(candidate, \"index\"), failedLookupLocations, !directoryExists, state);\n    }\n    function pathToPackageJson(directory) {\n        return ts.combinePaths(directory, \"package.json\");\n    }\n    function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) {\n        var nodeModulesFolder = ts.combinePaths(directory, \"node_modules\");\n        var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host);\n        var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName));\n        return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) ||\n            loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state);\n    }\n    function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state) {\n        return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false);\n    }\n    function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) {\n        return loadModuleFromNodeModulesWorker(2, moduleName, directory, failedLookupLocations, state, true);\n    }\n    function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) {\n        return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) {\n            if (ts.getBaseFileName(ancestorDirectory) !== \"node_modules\") {\n                return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly);\n            }\n        });\n    }\n    function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) {\n        if (typesOnly === void 0) { typesOnly = false; }\n        var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state);\n        if (packageResult) {\n            return packageResult;\n        }\n        if (extensions !== 1) {\n            return loadModuleFromNodeModulesFolder(2, ts.combinePaths(\"@types\", moduleName), directory, failedLookupLocations, state);\n        }\n    }\n    function classicNameResolver(moduleName, containingFile, compilerOptions, host) {\n        var traceEnabled = isTraceEnabled(compilerOptions, host);\n        var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };\n        var failedLookupLocations = [];\n        var containingDirectory = ts.getDirectoryPath(containingFile);\n        var resolved = tryResolve(0) || tryResolve(1);\n        return createResolvedModuleWithFailedLookupLocations(resolved, false, failedLookupLocations);\n        function tryResolve(extensions) {\n            var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state);\n            if (resolvedUsingSettings) {\n                return resolvedUsingSettings;\n            }\n            if (moduleHasNonRelativeName(moduleName)) {\n                var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) {\n                    var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName));\n                    return loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state);\n                });\n                if (resolved_3) {\n                    return resolved_3;\n                }\n                if (extensions === 0) {\n                    return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state);\n                }\n            }\n            else {\n                var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));\n                return loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state);\n            }\n        }\n    }\n    ts.classicNameResolver = classicNameResolver;\n    function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache) {\n        var traceEnabled = isTraceEnabled(compilerOptions, host);\n        if (traceEnabled) {\n            trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache);\n        }\n        var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };\n        var failedLookupLocations = [];\n        var resolved = loadModuleFromNodeModulesOneLevel(2, moduleName, globalCache, failedLookupLocations, state);\n        return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations);\n    }\n    ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;\n    function forEachAncestorDirectory(directory, callback) {\n        while (true) {\n            var result = callback(directory);\n            if (result !== undefined) {\n                return result;\n            }\n            var parentPath = ts.getDirectoryPath(directory);\n            if (parentPath === directory) {\n                return undefined;\n            }\n            directory = parentPath;\n        }\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    ts.externalHelpersModuleNameText = \"tslib\";\n    function getDeclarationOfKind(symbol, kind) {\n        var declarations = symbol.declarations;\n        if (declarations) {\n            for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) {\n                var declaration = declarations_1[_i];\n                if (declaration.kind === kind) {\n                    return declaration;\n                }\n            }\n        }\n        return undefined;\n    }\n    ts.getDeclarationOfKind = getDeclarationOfKind;\n    var stringWriters = [];\n    function getSingleLineStringWriter() {\n        if (stringWriters.length === 0) {\n            var str_1 = \"\";\n            var writeText = function (text) { return str_1 += text; };\n            return {\n                string: function () { return str_1; },\n                writeKeyword: writeText,\n                writeOperator: writeText,\n                writePunctuation: writeText,\n                writeSpace: writeText,\n                writeStringLiteral: writeText,\n                writeParameter: writeText,\n                writeSymbol: writeText,\n                writeLine: function () { return str_1 += \" \"; },\n                increaseIndent: ts.noop,\n                decreaseIndent: ts.noop,\n                clear: function () { return str_1 = \"\"; },\n                trackSymbol: ts.noop,\n                reportInaccessibleThisError: ts.noop\n            };\n        }\n        return stringWriters.pop();\n    }\n    ts.getSingleLineStringWriter = getSingleLineStringWriter;\n    function releaseStringWriter(writer) {\n        writer.clear();\n        stringWriters.push(writer);\n    }\n    ts.releaseStringWriter = releaseStringWriter;\n    function getFullWidth(node) {\n        return node.end - node.pos;\n    }\n    ts.getFullWidth = getFullWidth;\n    function hasResolvedModule(sourceFile, moduleNameText) {\n        return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]);\n    }\n    ts.hasResolvedModule = hasResolvedModule;\n    function getResolvedModule(sourceFile, moduleNameText) {\n        return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;\n    }\n    ts.getResolvedModule = getResolvedModule;\n    function setResolvedModule(sourceFile, moduleNameText, resolvedModule) {\n        if (!sourceFile.resolvedModules) {\n            sourceFile.resolvedModules = ts.createMap();\n        }\n        sourceFile.resolvedModules[moduleNameText] = resolvedModule;\n    }\n    ts.setResolvedModule = setResolvedModule;\n    function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) {\n        if (!sourceFile.resolvedTypeReferenceDirectiveNames) {\n            sourceFile.resolvedTypeReferenceDirectiveNames = ts.createMap();\n        }\n        sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective;\n    }\n    ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;\n    function moduleResolutionIsEqualTo(oldResolution, newResolution) {\n        return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport &&\n            oldResolution.extension === newResolution.extension &&\n            oldResolution.resolvedFileName === newResolution.resolvedFileName;\n    }\n    ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo;\n    function typeDirectiveIsEqualTo(oldResolution, newResolution) {\n        return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary;\n    }\n    ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo;\n    function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) {\n        if (names.length !== newResolutions.length) {\n            return false;\n        }\n        for (var i = 0; i < names.length; i++) {\n            var newResolution = newResolutions[i];\n            var oldResolution = oldResolutions && oldResolutions[names[i]];\n            var changed = oldResolution\n                ? !newResolution || !comparer(oldResolution, newResolution)\n                : newResolution;\n            if (changed) {\n                return true;\n            }\n        }\n        return false;\n    }\n    ts.hasChangesInResolutions = hasChangesInResolutions;\n    function containsParseError(node) {\n        aggregateChildData(node);\n        return (node.flags & 131072) !== 0;\n    }\n    ts.containsParseError = containsParseError;\n    function aggregateChildData(node) {\n        if (!(node.flags & 262144)) {\n            var thisNodeOrAnySubNodesHasError = ((node.flags & 32768) !== 0) ||\n                ts.forEachChild(node, containsParseError);\n            if (thisNodeOrAnySubNodesHasError) {\n                node.flags |= 131072;\n            }\n            node.flags |= 262144;\n        }\n    }\n    function getSourceFileOfNode(node) {\n        while (node && node.kind !== 261) {\n            node = node.parent;\n        }\n        return node;\n    }\n    ts.getSourceFileOfNode = getSourceFileOfNode;\n    function isStatementWithLocals(node) {\n        switch (node.kind) {\n            case 204:\n            case 232:\n            case 211:\n            case 212:\n            case 213:\n                return true;\n        }\n        return false;\n    }\n    ts.isStatementWithLocals = isStatementWithLocals;\n    function getStartPositionOfLine(line, sourceFile) {\n        ts.Debug.assert(line >= 0);\n        return ts.getLineStarts(sourceFile)[line];\n    }\n    ts.getStartPositionOfLine = getStartPositionOfLine;\n    function nodePosToString(node) {\n        var file = getSourceFileOfNode(node);\n        var loc = ts.getLineAndCharacterOfPosition(file, node.pos);\n        return file.fileName + \"(\" + (loc.line + 1) + \",\" + (loc.character + 1) + \")\";\n    }\n    ts.nodePosToString = nodePosToString;\n    function getStartPosOfNode(node) {\n        return node.pos;\n    }\n    ts.getStartPosOfNode = getStartPosOfNode;\n    function isDefined(value) {\n        return value !== undefined;\n    }\n    ts.isDefined = isDefined;\n    function getEndLinePosition(line, sourceFile) {\n        ts.Debug.assert(line >= 0);\n        var lineStarts = ts.getLineStarts(sourceFile);\n        var lineIndex = line;\n        var sourceText = sourceFile.text;\n        if (lineIndex + 1 === lineStarts.length) {\n            return sourceText.length - 1;\n        }\n        else {\n            var start = lineStarts[lineIndex];\n            var pos = lineStarts[lineIndex + 1] - 1;\n            ts.Debug.assert(ts.isLineBreak(sourceText.charCodeAt(pos)));\n            while (start <= pos && ts.isLineBreak(sourceText.charCodeAt(pos))) {\n                pos--;\n            }\n            return pos;\n        }\n    }\n    ts.getEndLinePosition = getEndLinePosition;\n    function nodeIsMissing(node) {\n        if (node === undefined) {\n            return true;\n        }\n        return node.pos === node.end && node.pos >= 0 && node.kind !== 1;\n    }\n    ts.nodeIsMissing = nodeIsMissing;\n    function nodeIsPresent(node) {\n        return !nodeIsMissing(node);\n    }\n    ts.nodeIsPresent = nodeIsPresent;\n    function getTokenPosOfNode(node, sourceFile, includeJsDoc) {\n        if (nodeIsMissing(node)) {\n            return node.pos;\n        }\n        if (isJSDocNode(node)) {\n            return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, false, true);\n        }\n        if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) {\n            return getTokenPosOfNode(node.jsDoc[0]);\n        }\n        if (node.kind === 292 && node._children.length > 0) {\n            return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);\n        }\n        return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);\n    }\n    ts.getTokenPosOfNode = getTokenPosOfNode;\n    function isJSDocNode(node) {\n        return node.kind >= 262 && node.kind <= 288;\n    }\n    ts.isJSDocNode = isJSDocNode;\n    function isJSDocTag(node) {\n        return node.kind >= 278 && node.kind <= 291;\n    }\n    ts.isJSDocTag = isJSDocTag;\n    function getNonDecoratorTokenPosOfNode(node, sourceFile) {\n        if (nodeIsMissing(node) || !node.decorators) {\n            return getTokenPosOfNode(node, sourceFile);\n        }\n        return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.decorators.end);\n    }\n    ts.getNonDecoratorTokenPosOfNode = getNonDecoratorTokenPosOfNode;\n    function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia) {\n        if (includeTrivia === void 0) { includeTrivia = false; }\n        if (nodeIsMissing(node)) {\n            return \"\";\n        }\n        var text = sourceFile.text;\n        return text.substring(includeTrivia ? node.pos : ts.skipTrivia(text, node.pos), node.end);\n    }\n    ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile;\n    function getTextOfNodeFromSourceText(sourceText, node) {\n        if (nodeIsMissing(node)) {\n            return \"\";\n        }\n        return sourceText.substring(ts.skipTrivia(sourceText, node.pos), node.end);\n    }\n    ts.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText;\n    function getTextOfNode(node, includeTrivia) {\n        if (includeTrivia === void 0) { includeTrivia = false; }\n        return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia);\n    }\n    ts.getTextOfNode = getTextOfNode;\n    function getLiteralText(node, sourceFile, languageVersion) {\n        if (languageVersion < 2 && (isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) {\n            return getQuotedEscapedLiteralText('\"', node.text, '\"');\n        }\n        if (!nodeIsSynthesized(node) && node.parent) {\n            var text = getSourceTextOfNodeFromSourceFile(sourceFile, node);\n            if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) {\n                return node.text;\n            }\n            return text;\n        }\n        switch (node.kind) {\n            case 9:\n                return getQuotedEscapedLiteralText('\"', node.text, '\"');\n            case 12:\n                return getQuotedEscapedLiteralText(\"`\", node.text, \"`\");\n            case 13:\n                return getQuotedEscapedLiteralText(\"`\", node.text, \"${\");\n            case 14:\n                return getQuotedEscapedLiteralText(\"}\", node.text, \"${\");\n            case 15:\n                return getQuotedEscapedLiteralText(\"}\", node.text, \"`\");\n            case 8:\n                return node.text;\n        }\n        ts.Debug.fail(\"Literal kind '\" + node.kind + \"' not accounted for.\");\n    }\n    ts.getLiteralText = getLiteralText;\n    function isBinaryOrOctalIntegerLiteral(node, text) {\n        if (node.kind === 8 && text.length > 1) {\n            switch (text.charCodeAt(1)) {\n                case 98:\n                case 66:\n                case 111:\n                case 79:\n                    return true;\n            }\n        }\n        return false;\n    }\n    ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral;\n    function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) {\n        return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote;\n    }\n    function escapeIdentifier(identifier) {\n        return identifier.length >= 2 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 ? \"_\" + identifier : identifier;\n    }\n    ts.escapeIdentifier = escapeIdentifier;\n    function unescapeIdentifier(identifier) {\n        return identifier.length >= 3 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 && identifier.charCodeAt(2) === 95 ? identifier.substr(1) : identifier;\n    }\n    ts.unescapeIdentifier = unescapeIdentifier;\n    function makeIdentifierFromModuleName(moduleName) {\n        return ts.getBaseFileName(moduleName).replace(/^(\\d)/, \"_$1\").replace(/\\W/g, \"_\");\n    }\n    ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName;\n    function isBlockOrCatchScoped(declaration) {\n        return (ts.getCombinedNodeFlags(declaration) & 3) !== 0 ||\n            isCatchClauseVariableDeclarationOrBindingElement(declaration);\n    }\n    ts.isBlockOrCatchScoped = isBlockOrCatchScoped;\n    function isCatchClauseVariableDeclarationOrBindingElement(declaration) {\n        var node = getRootDeclaration(declaration);\n        return node.kind === 223 && node.parent.kind === 256;\n    }\n    ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement;\n    function isAmbientModule(node) {\n        return node && node.kind === 230 &&\n            (node.name.kind === 9 || isGlobalScopeAugmentation(node));\n    }\n    ts.isAmbientModule = isAmbientModule;\n    function isShorthandAmbientModuleSymbol(moduleSymbol) {\n        return isShorthandAmbientModule(moduleSymbol.valueDeclaration);\n    }\n    ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;\n    function isShorthandAmbientModule(node) {\n        return node.kind === 230 && (!node.body);\n    }\n    function isBlockScopedContainerTopLevel(node) {\n        return node.kind === 261 ||\n            node.kind === 230 ||\n            isFunctionLike(node);\n    }\n    ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel;\n    function isGlobalScopeAugmentation(module) {\n        return !!(module.flags & 512);\n    }\n    ts.isGlobalScopeAugmentation = isGlobalScopeAugmentation;\n    function isExternalModuleAugmentation(node) {\n        if (!node || !isAmbientModule(node)) {\n            return false;\n        }\n        switch (node.parent.kind) {\n            case 261:\n                return ts.isExternalModule(node.parent);\n            case 231:\n                return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent);\n        }\n        return false;\n    }\n    ts.isExternalModuleAugmentation = isExternalModuleAugmentation;\n    function isEffectiveExternalModule(node, compilerOptions) {\n        return ts.isExternalModule(node) || compilerOptions.isolatedModules;\n    }\n    ts.isEffectiveExternalModule = isEffectiveExternalModule;\n    function isBlockScope(node, parentNode) {\n        switch (node.kind) {\n            case 261:\n            case 232:\n            case 256:\n            case 230:\n            case 211:\n            case 212:\n            case 213:\n            case 150:\n            case 149:\n            case 151:\n            case 152:\n            case 225:\n            case 184:\n            case 185:\n                return true;\n            case 204:\n                return parentNode && !isFunctionLike(parentNode);\n        }\n        return false;\n    }\n    ts.isBlockScope = isBlockScope;\n    function getEnclosingBlockScopeContainer(node) {\n        var current = node.parent;\n        while (current) {\n            if (isBlockScope(current, current.parent)) {\n                return current;\n            }\n            current = current.parent;\n        }\n    }\n    ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer;\n    function declarationNameToString(name) {\n        return getFullWidth(name) === 0 ? \"(Missing)\" : getTextOfNode(name);\n    }\n    ts.declarationNameToString = declarationNameToString;\n    function getTextOfPropertyName(name) {\n        switch (name.kind) {\n            case 70:\n                return name.text;\n            case 9:\n            case 8:\n                return name.text;\n            case 142:\n                if (isStringOrNumericLiteral(name.expression)) {\n                    return name.expression.text;\n                }\n        }\n        return undefined;\n    }\n    ts.getTextOfPropertyName = getTextOfPropertyName;\n    function entityNameToString(name) {\n        switch (name.kind) {\n            case 70:\n                return getFullWidth(name) === 0 ? unescapeIdentifier(name.text) : getTextOfNode(name);\n            case 141:\n                return entityNameToString(name.left) + \".\" + entityNameToString(name.right);\n            case 177:\n                return entityNameToString(name.expression) + \".\" + entityNameToString(name.name);\n        }\n    }\n    ts.entityNameToString = entityNameToString;\n    function createDiagnosticForNode(node, message, arg0, arg1, arg2) {\n        var sourceFile = getSourceFileOfNode(node);\n        return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2);\n    }\n    ts.createDiagnosticForNode = createDiagnosticForNode;\n    function createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2) {\n        var span = getErrorSpanForNode(sourceFile, node);\n        return ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2);\n    }\n    ts.createDiagnosticForNodeInSourceFile = createDiagnosticForNodeInSourceFile;\n    function createDiagnosticForNodeFromMessageChain(node, messageChain) {\n        var sourceFile = getSourceFileOfNode(node);\n        var span = getErrorSpanForNode(sourceFile, node);\n        return {\n            file: sourceFile,\n            start: span.start,\n            length: span.length,\n            code: messageChain.code,\n            category: messageChain.category,\n            messageText: messageChain.next ? messageChain : messageChain.messageText\n        };\n    }\n    ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain;\n    function getSpanOfTokenAtPosition(sourceFile, pos) {\n        var scanner = ts.createScanner(sourceFile.languageVersion, true, sourceFile.languageVariant, sourceFile.text, undefined, pos);\n        scanner.scan();\n        var start = scanner.getTokenPos();\n        return ts.createTextSpanFromBounds(start, scanner.getTextPos());\n    }\n    ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition;\n    function getErrorSpanForArrowFunction(sourceFile, node) {\n        var pos = ts.skipTrivia(sourceFile.text, node.pos);\n        if (node.body && node.body.kind === 204) {\n            var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line;\n            var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line;\n            if (startLine < endLine) {\n                return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1);\n            }\n        }\n        return ts.createTextSpanFromBounds(pos, node.end);\n    }\n    function getErrorSpanForNode(sourceFile, node) {\n        var errorNode = node;\n        switch (node.kind) {\n            case 261:\n                var pos_1 = ts.skipTrivia(sourceFile.text, 0, false);\n                if (pos_1 === sourceFile.text.length) {\n                    return ts.createTextSpan(0, 0);\n                }\n                return getSpanOfTokenAtPosition(sourceFile, pos_1);\n            case 223:\n            case 174:\n            case 226:\n            case 197:\n            case 227:\n            case 230:\n            case 229:\n            case 260:\n            case 225:\n            case 184:\n            case 149:\n            case 151:\n            case 152:\n            case 228:\n                errorNode = node.name;\n                break;\n            case 185:\n                return getErrorSpanForArrowFunction(sourceFile, node);\n        }\n        if (errorNode === undefined) {\n            return getSpanOfTokenAtPosition(sourceFile, node.pos);\n        }\n        var pos = nodeIsMissing(errorNode)\n            ? errorNode.pos\n            : ts.skipTrivia(sourceFile.text, errorNode.pos);\n        return ts.createTextSpanFromBounds(pos, errorNode.end);\n    }\n    ts.getErrorSpanForNode = getErrorSpanForNode;\n    function isExternalOrCommonJsModule(file) {\n        return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined;\n    }\n    ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule;\n    function isDeclarationFile(file) {\n        return file.isDeclarationFile;\n    }\n    ts.isDeclarationFile = isDeclarationFile;\n    function isConstEnumDeclaration(node) {\n        return node.kind === 229 && isConst(node);\n    }\n    ts.isConstEnumDeclaration = isConstEnumDeclaration;\n    function isConst(node) {\n        return !!(ts.getCombinedNodeFlags(node) & 2)\n            || !!(ts.getCombinedModifierFlags(node) & 2048);\n    }\n    ts.isConst = isConst;\n    function isLet(node) {\n        return !!(ts.getCombinedNodeFlags(node) & 1);\n    }\n    ts.isLet = isLet;\n    function isSuperCall(n) {\n        return n.kind === 179 && n.expression.kind === 96;\n    }\n    ts.isSuperCall = isSuperCall;\n    function isPrologueDirective(node) {\n        return node.kind === 207\n            && node.expression.kind === 9;\n    }\n    ts.isPrologueDirective = isPrologueDirective;\n    function getLeadingCommentRangesOfNode(node, sourceFileOfNode) {\n        return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos);\n    }\n    ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode;\n    function getLeadingCommentRangesOfNodeFromText(node, text) {\n        return ts.getLeadingCommentRanges(text, node.pos);\n    }\n    ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText;\n    function getJSDocCommentRanges(node, text) {\n        var commentRanges = (node.kind === 144 ||\n            node.kind === 143 ||\n            node.kind === 184 ||\n            node.kind === 185) ?\n            ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :\n            getLeadingCommentRangesOfNodeFromText(node, text);\n        return ts.filter(commentRanges, function (comment) {\n            return text.charCodeAt(comment.pos + 1) === 42 &&\n                text.charCodeAt(comment.pos + 2) === 42 &&\n                text.charCodeAt(comment.pos + 3) !== 47;\n        });\n    }\n    ts.getJSDocCommentRanges = getJSDocCommentRanges;\n    ts.fullTripleSlashReferencePathRegEx = /^(\\/\\/\\/\\s*<reference\\s+path\\s*=\\s*)('|\")(.+?)\\2.*?\\/>/;\n    ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\\/\\/\\/\\s*<reference\\s+types\\s*=\\s*)('|\")(.+?)\\2.*?\\/>/;\n    ts.fullTripleSlashAMDReferencePathRegEx = /^(\\/\\/\\/\\s*<amd-dependency\\s+path\\s*=\\s*)('|\")(.+?)\\2.*?\\/>/;\n    function isPartOfTypeNode(node) {\n        if (156 <= node.kind && node.kind <= 171) {\n            return true;\n        }\n        switch (node.kind) {\n            case 118:\n            case 132:\n            case 134:\n            case 121:\n            case 135:\n            case 137:\n            case 129:\n                return true;\n            case 104:\n                return node.parent.kind !== 188;\n            case 199:\n                return !isExpressionWithTypeArgumentsInClassExtendsClause(node);\n            case 70:\n                if (node.parent.kind === 141 && node.parent.right === node) {\n                    node = node.parent;\n                }\n                else if (node.parent.kind === 177 && node.parent.name === node) {\n                    node = node.parent;\n                }\n                ts.Debug.assert(node.kind === 70 || node.kind === 141 || node.kind === 177, \"'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.\");\n            case 141:\n            case 177:\n            case 98:\n                var parent_1 = node.parent;\n                if (parent_1.kind === 160) {\n                    return false;\n                }\n                if (156 <= parent_1.kind && parent_1.kind <= 171) {\n                    return true;\n                }\n                switch (parent_1.kind) {\n                    case 199:\n                        return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1);\n                    case 143:\n                        return node === parent_1.constraint;\n                    case 147:\n                    case 146:\n                    case 144:\n                    case 223:\n                        return node === parent_1.type;\n                    case 225:\n                    case 184:\n                    case 185:\n                    case 150:\n                    case 149:\n                    case 148:\n                    case 151:\n                    case 152:\n                        return node === parent_1.type;\n                    case 153:\n                    case 154:\n                    case 155:\n                        return node === parent_1.type;\n                    case 182:\n                        return node === parent_1.type;\n                    case 179:\n                    case 180:\n                        return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0;\n                    case 181:\n                        return false;\n                }\n        }\n        return false;\n    }\n    ts.isPartOfTypeNode = isPartOfTypeNode;\n    function forEachReturnStatement(body, visitor) {\n        return traverse(body);\n        function traverse(node) {\n            switch (node.kind) {\n                case 216:\n                    return visitor(node);\n                case 232:\n                case 204:\n                case 208:\n                case 209:\n                case 210:\n                case 211:\n                case 212:\n                case 213:\n                case 217:\n                case 218:\n                case 253:\n                case 254:\n                case 219:\n                case 221:\n                case 256:\n                    return ts.forEachChild(node, traverse);\n            }\n        }\n    }\n    ts.forEachReturnStatement = forEachReturnStatement;\n    function forEachYieldExpression(body, visitor) {\n        return traverse(body);\n        function traverse(node) {\n            switch (node.kind) {\n                case 195:\n                    visitor(node);\n                    var operand = node.expression;\n                    if (operand) {\n                        traverse(operand);\n                    }\n                case 229:\n                case 227:\n                case 230:\n                case 228:\n                case 226:\n                case 197:\n                    return;\n                default:\n                    if (isFunctionLike(node)) {\n                        var name_7 = node.name;\n                        if (name_7 && name_7.kind === 142) {\n                            traverse(name_7.expression);\n                            return;\n                        }\n                    }\n                    else if (!isPartOfTypeNode(node)) {\n                        ts.forEachChild(node, traverse);\n                    }\n            }\n        }\n    }\n    ts.forEachYieldExpression = forEachYieldExpression;\n    function isVariableLike(node) {\n        if (node) {\n            switch (node.kind) {\n                case 174:\n                case 260:\n                case 144:\n                case 257:\n                case 147:\n                case 146:\n                case 258:\n                case 223:\n                    return true;\n            }\n        }\n        return false;\n    }\n    ts.isVariableLike = isVariableLike;\n    function isAccessor(node) {\n        return node && (node.kind === 151 || node.kind === 152);\n    }\n    ts.isAccessor = isAccessor;\n    function isClassLike(node) {\n        return node && (node.kind === 226 || node.kind === 197);\n    }\n    ts.isClassLike = isClassLike;\n    function isFunctionLike(node) {\n        return node && isFunctionLikeKind(node.kind);\n    }\n    ts.isFunctionLike = isFunctionLike;\n    function isFunctionLikeKind(kind) {\n        switch (kind) {\n            case 150:\n            case 184:\n            case 225:\n            case 185:\n            case 149:\n            case 148:\n            case 151:\n            case 152:\n            case 153:\n            case 154:\n            case 155:\n            case 158:\n            case 159:\n                return true;\n        }\n        return false;\n    }\n    ts.isFunctionLikeKind = isFunctionLikeKind;\n    function introducesArgumentsExoticObject(node) {\n        switch (node.kind) {\n            case 149:\n            case 148:\n            case 150:\n            case 151:\n            case 152:\n            case 225:\n            case 184:\n                return true;\n        }\n        return false;\n    }\n    ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject;\n    function isIterationStatement(node, lookInLabeledStatements) {\n        switch (node.kind) {\n            case 211:\n            case 212:\n            case 213:\n            case 209:\n            case 210:\n                return true;\n            case 219:\n                return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements);\n        }\n        return false;\n    }\n    ts.isIterationStatement = isIterationStatement;\n    function isFunctionBlock(node) {\n        return node && node.kind === 204 && isFunctionLike(node.parent);\n    }\n    ts.isFunctionBlock = isFunctionBlock;\n    function isObjectLiteralMethod(node) {\n        return node && node.kind === 149 && node.parent.kind === 176;\n    }\n    ts.isObjectLiteralMethod = isObjectLiteralMethod;\n    function isObjectLiteralOrClassExpressionMethod(node) {\n        return node.kind === 149 &&\n            (node.parent.kind === 176 ||\n                node.parent.kind === 197);\n    }\n    ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod;\n    function isIdentifierTypePredicate(predicate) {\n        return predicate && predicate.kind === 1;\n    }\n    ts.isIdentifierTypePredicate = isIdentifierTypePredicate;\n    function isThisTypePredicate(predicate) {\n        return predicate && predicate.kind === 0;\n    }\n    ts.isThisTypePredicate = isThisTypePredicate;\n    function getContainingFunction(node) {\n        while (true) {\n            node = node.parent;\n            if (!node || isFunctionLike(node)) {\n                return node;\n            }\n        }\n    }\n    ts.getContainingFunction = getContainingFunction;\n    function getContainingClass(node) {\n        while (true) {\n            node = node.parent;\n            if (!node || isClassLike(node)) {\n                return node;\n            }\n        }\n    }\n    ts.getContainingClass = getContainingClass;\n    function getThisContainer(node, includeArrowFunctions) {\n        while (true) {\n            node = node.parent;\n            if (!node) {\n                return undefined;\n            }\n            switch (node.kind) {\n                case 142:\n                    if (isClassLike(node.parent.parent)) {\n                        return node;\n                    }\n                    node = node.parent;\n                    break;\n                case 145:\n                    if (node.parent.kind === 144 && isClassElement(node.parent.parent)) {\n                        node = node.parent.parent;\n                    }\n                    else if (isClassElement(node.parent)) {\n                        node = node.parent;\n                    }\n                    break;\n                case 185:\n                    if (!includeArrowFunctions) {\n                        continue;\n                    }\n                case 225:\n                case 184:\n                case 230:\n                case 147:\n                case 146:\n                case 149:\n                case 148:\n                case 150:\n                case 151:\n                case 152:\n                case 153:\n                case 154:\n                case 155:\n                case 229:\n                case 261:\n                    return node;\n            }\n        }\n    }\n    ts.getThisContainer = getThisContainer;\n    function getSuperContainer(node, stopOnFunctions) {\n        while (true) {\n            node = node.parent;\n            if (!node) {\n                return node;\n            }\n            switch (node.kind) {\n                case 142:\n                    node = node.parent;\n                    break;\n                case 225:\n                case 184:\n                case 185:\n                    if (!stopOnFunctions) {\n                        continue;\n                    }\n                case 147:\n                case 146:\n                case 149:\n                case 148:\n                case 150:\n                case 151:\n                case 152:\n                    return node;\n                case 145:\n                    if (node.parent.kind === 144 && isClassElement(node.parent.parent)) {\n                        node = node.parent.parent;\n                    }\n                    else if (isClassElement(node.parent)) {\n                        node = node.parent;\n                    }\n                    break;\n            }\n        }\n    }\n    ts.getSuperContainer = getSuperContainer;\n    function getImmediatelyInvokedFunctionExpression(func) {\n        if (func.kind === 184 || func.kind === 185) {\n            var prev = func;\n            var parent_2 = func.parent;\n            while (parent_2.kind === 183) {\n                prev = parent_2;\n                parent_2 = parent_2.parent;\n            }\n            if (parent_2.kind === 179 && parent_2.expression === prev) {\n                return parent_2;\n            }\n        }\n    }\n    ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression;\n    function isSuperProperty(node) {\n        var kind = node.kind;\n        return (kind === 177 || kind === 178)\n            && node.expression.kind === 96;\n    }\n    ts.isSuperProperty = isSuperProperty;\n    function getEntityNameFromTypeNode(node) {\n        switch (node.kind) {\n            case 157:\n            case 272:\n                return node.typeName;\n            case 199:\n                return isEntityNameExpression(node.expression)\n                    ? node.expression\n                    : undefined;\n            case 70:\n            case 141:\n                return node;\n        }\n        return undefined;\n    }\n    ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode;\n    function isCallLikeExpression(node) {\n        switch (node.kind) {\n            case 179:\n            case 180:\n            case 181:\n            case 145:\n                return true;\n            default:\n                return false;\n        }\n    }\n    ts.isCallLikeExpression = isCallLikeExpression;\n    function getInvokedExpression(node) {\n        if (node.kind === 181) {\n            return node.tag;\n        }\n        return node.expression;\n    }\n    ts.getInvokedExpression = getInvokedExpression;\n    function nodeCanBeDecorated(node) {\n        switch (node.kind) {\n            case 226:\n                return true;\n            case 147:\n                return node.parent.kind === 226;\n            case 151:\n            case 152:\n            case 149:\n                return node.body !== undefined\n                    && node.parent.kind === 226;\n            case 144:\n                return node.parent.body !== undefined\n                    && (node.parent.kind === 150\n                        || node.parent.kind === 149\n                        || node.parent.kind === 152)\n                    && node.parent.parent.kind === 226;\n        }\n        return false;\n    }\n    ts.nodeCanBeDecorated = nodeCanBeDecorated;\n    function nodeIsDecorated(node) {\n        return node.decorators !== undefined\n            && nodeCanBeDecorated(node);\n    }\n    ts.nodeIsDecorated = nodeIsDecorated;\n    function nodeOrChildIsDecorated(node) {\n        return nodeIsDecorated(node) || childIsDecorated(node);\n    }\n    ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated;\n    function childIsDecorated(node) {\n        switch (node.kind) {\n            case 226:\n                return ts.forEach(node.members, nodeOrChildIsDecorated);\n            case 149:\n            case 152:\n                return ts.forEach(node.parameters, nodeIsDecorated);\n        }\n    }\n    ts.childIsDecorated = childIsDecorated;\n    function isJSXTagName(node) {\n        var parent = node.parent;\n        if (parent.kind === 248 ||\n            parent.kind === 247 ||\n            parent.kind === 249) {\n            return parent.tagName === node;\n        }\n        return false;\n    }\n    ts.isJSXTagName = isJSXTagName;\n    function isPartOfExpression(node) {\n        switch (node.kind) {\n            case 98:\n            case 96:\n            case 94:\n            case 100:\n            case 85:\n            case 11:\n            case 175:\n            case 176:\n            case 177:\n            case 178:\n            case 179:\n            case 180:\n            case 181:\n            case 200:\n            case 182:\n            case 201:\n            case 183:\n            case 184:\n            case 197:\n            case 185:\n            case 188:\n            case 186:\n            case 187:\n            case 190:\n            case 191:\n            case 192:\n            case 193:\n            case 196:\n            case 194:\n            case 12:\n            case 198:\n            case 246:\n            case 247:\n            case 195:\n            case 189:\n                return true;\n            case 141:\n                while (node.parent.kind === 141) {\n                    node = node.parent;\n                }\n                return node.parent.kind === 160 || isJSXTagName(node);\n            case 70:\n                if (node.parent.kind === 160 || isJSXTagName(node)) {\n                    return true;\n                }\n            case 8:\n            case 9:\n            case 98:\n                var parent_3 = node.parent;\n                switch (parent_3.kind) {\n                    case 223:\n                    case 144:\n                    case 147:\n                    case 146:\n                    case 260:\n                    case 257:\n                    case 174:\n                        return parent_3.initializer === node;\n                    case 207:\n                    case 208:\n                    case 209:\n                    case 210:\n                    case 216:\n                    case 217:\n                    case 218:\n                    case 253:\n                    case 220:\n                    case 218:\n                        return parent_3.expression === node;\n                    case 211:\n                        var forStatement = parent_3;\n                        return (forStatement.initializer === node && forStatement.initializer.kind !== 224) ||\n                            forStatement.condition === node ||\n                            forStatement.incrementor === node;\n                    case 212:\n                    case 213:\n                        var forInStatement = parent_3;\n                        return (forInStatement.initializer === node && forInStatement.initializer.kind !== 224) ||\n                            forInStatement.expression === node;\n                    case 182:\n                    case 200:\n                        return node === parent_3.expression;\n                    case 202:\n                        return node === parent_3.expression;\n                    case 142:\n                        return node === parent_3.expression;\n                    case 145:\n                    case 252:\n                    case 251:\n                    case 259:\n                        return true;\n                    case 199:\n                        return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3);\n                    default:\n                        if (isPartOfExpression(parent_3)) {\n                            return true;\n                        }\n                }\n        }\n        return false;\n    }\n    ts.isPartOfExpression = isPartOfExpression;\n    function isInstantiatedModule(node, preserveConstEnums) {\n        var moduleState = ts.getModuleInstanceState(node);\n        return moduleState === 1 ||\n            (preserveConstEnums && moduleState === 2);\n    }\n    ts.isInstantiatedModule = isInstantiatedModule;\n    function isExternalModuleImportEqualsDeclaration(node) {\n        return node.kind === 234 && node.moduleReference.kind === 245;\n    }\n    ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration;\n    function getExternalModuleImportEqualsDeclarationExpression(node) {\n        ts.Debug.assert(isExternalModuleImportEqualsDeclaration(node));\n        return node.moduleReference.expression;\n    }\n    ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;\n    function isInternalModuleImportEqualsDeclaration(node) {\n        return node.kind === 234 && node.moduleReference.kind !== 245;\n    }\n    ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration;\n    function isSourceFileJavaScript(file) {\n        return isInJavaScriptFile(file);\n    }\n    ts.isSourceFileJavaScript = isSourceFileJavaScript;\n    function isInJavaScriptFile(node) {\n        return node && !!(node.flags & 65536);\n    }\n    ts.isInJavaScriptFile = isInJavaScriptFile;\n    function isRequireCall(expression, checkArgumentIsStringLiteral) {\n        var isRequire = expression.kind === 179 &&\n            expression.expression.kind === 70 &&\n            expression.expression.text === \"require\" &&\n            expression.arguments.length === 1;\n        return isRequire && (!checkArgumentIsStringLiteral || expression.arguments[0].kind === 9);\n    }\n    ts.isRequireCall = isRequireCall;\n    function isSingleOrDoubleQuote(charCode) {\n        return charCode === 39 || charCode === 34;\n    }\n    ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote;\n    function isDeclarationOfFunctionExpression(s) {\n        if (s.valueDeclaration && s.valueDeclaration.kind === 223) {\n            var declaration = s.valueDeclaration;\n            return declaration.initializer && declaration.initializer.kind === 184;\n        }\n        return false;\n    }\n    ts.isDeclarationOfFunctionExpression = isDeclarationOfFunctionExpression;\n    function getSpecialPropertyAssignmentKind(expression) {\n        if (!isInJavaScriptFile(expression)) {\n            return 0;\n        }\n        if (expression.kind !== 192) {\n            return 0;\n        }\n        var expr = expression;\n        if (expr.operatorToken.kind !== 57 || expr.left.kind !== 177) {\n            return 0;\n        }\n        var lhs = expr.left;\n        if (lhs.expression.kind === 70) {\n            var lhsId = lhs.expression;\n            if (lhsId.text === \"exports\") {\n                return 1;\n            }\n            else if (lhsId.text === \"module\" && lhs.name.text === \"exports\") {\n                return 2;\n            }\n        }\n        else if (lhs.expression.kind === 98) {\n            return 4;\n        }\n        else if (lhs.expression.kind === 177) {\n            var innerPropertyAccess = lhs.expression;\n            if (innerPropertyAccess.expression.kind === 70) {\n                var innerPropertyAccessIdentifier = innerPropertyAccess.expression;\n                if (innerPropertyAccessIdentifier.text === \"module\" && innerPropertyAccess.name.text === \"exports\") {\n                    return 1;\n                }\n                if (innerPropertyAccess.name.text === \"prototype\") {\n                    return 3;\n                }\n            }\n        }\n        return 0;\n    }\n    ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind;\n    function getExternalModuleName(node) {\n        if (node.kind === 235) {\n            return node.moduleSpecifier;\n        }\n        if (node.kind === 234) {\n            var reference = node.moduleReference;\n            if (reference.kind === 245) {\n                return reference.expression;\n            }\n        }\n        if (node.kind === 241) {\n            return node.moduleSpecifier;\n        }\n        if (node.kind === 230 && node.name.kind === 9) {\n            return node.name;\n        }\n    }\n    ts.getExternalModuleName = getExternalModuleName;\n    function getNamespaceDeclarationNode(node) {\n        if (node.kind === 234) {\n            return node;\n        }\n        var importClause = node.importClause;\n        if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 237) {\n            return importClause.namedBindings;\n        }\n    }\n    ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode;\n    function isDefaultImport(node) {\n        return node.kind === 235\n            && node.importClause\n            && !!node.importClause.name;\n    }\n    ts.isDefaultImport = isDefaultImport;\n    function hasQuestionToken(node) {\n        if (node) {\n            switch (node.kind) {\n                case 144:\n                case 149:\n                case 148:\n                case 258:\n                case 257:\n                case 147:\n                case 146:\n                    return node.questionToken !== undefined;\n            }\n        }\n        return false;\n    }\n    ts.hasQuestionToken = hasQuestionToken;\n    function isJSDocConstructSignature(node) {\n        return node.kind === 274 &&\n            node.parameters.length > 0 &&\n            node.parameters[0].type.kind === 276;\n    }\n    ts.isJSDocConstructSignature = isJSDocConstructSignature;\n    function getCommentsFromJSDoc(node) {\n        return ts.map(getJSDocs(node), function (doc) { return doc.comment; });\n    }\n    ts.getCommentsFromJSDoc = getCommentsFromJSDoc;\n    function getJSDocTags(node, kind) {\n        var docs = getJSDocs(node);\n        if (docs) {\n            var result = [];\n            for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) {\n                var doc = docs_1[_i];\n                if (doc.kind === 281) {\n                    if (doc.kind === kind) {\n                        result.push(doc);\n                    }\n                }\n                else {\n                    result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; }));\n                }\n            }\n            return result;\n        }\n    }\n    function getFirstJSDocTag(node, kind) {\n        return node && ts.firstOrUndefined(getJSDocTags(node, kind));\n    }\n    function getJSDocs(node) {\n        var cache = node.jsDocCache;\n        if (!cache) {\n            getJSDocsWorker(node);\n            node.jsDocCache = cache;\n        }\n        return cache;\n        function getJSDocsWorker(node) {\n            var parent = node.parent;\n            var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) &&\n                parent.initializer === node &&\n                parent.parent.parent.kind === 205;\n            var isVariableOfVariableDeclarationStatement = isVariableLike(node) &&\n                parent.parent.kind === 205;\n            var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent :\n                isVariableOfVariableDeclarationStatement ? parent.parent :\n                    undefined;\n            if (variableStatementNode) {\n                getJSDocsWorker(variableStatementNode);\n            }\n            var isSourceOfAssignmentExpressionStatement = parent && parent.parent &&\n                parent.kind === 192 &&\n                parent.operatorToken.kind === 57 &&\n                parent.parent.kind === 207;\n            if (isSourceOfAssignmentExpressionStatement) {\n                getJSDocsWorker(parent.parent);\n            }\n            var isModuleDeclaration = node.kind === 230 &&\n                parent && parent.kind === 230;\n            var isPropertyAssignmentExpression = parent && parent.kind === 257;\n            if (isModuleDeclaration || isPropertyAssignmentExpression) {\n                getJSDocsWorker(parent);\n            }\n            if (node.kind === 144) {\n                cache = ts.concatenate(cache, getJSDocParameterTags(node));\n            }\n            if (isVariableLike(node) && node.initializer) {\n                cache = ts.concatenate(cache, node.initializer.jsDoc);\n            }\n            cache = ts.concatenate(cache, node.jsDoc);\n        }\n    }\n    function getJSDocParameterTags(param) {\n        if (!isParameter(param)) {\n            return undefined;\n        }\n        var func = param.parent;\n        var tags = getJSDocTags(func, 281);\n        if (!param.name) {\n            var i = func.parameters.indexOf(param);\n            var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281; });\n            if (paramTags && 0 <= i && i < paramTags.length) {\n                return [paramTags[i]];\n            }\n        }\n        else if (param.name.kind === 70) {\n            var name_8 = param.name.text;\n            return ts.filter(tags, function (tag) { return tag.kind === 281 && tag.parameterName.text === name_8; });\n        }\n        else {\n            return undefined;\n        }\n    }\n    ts.getJSDocParameterTags = getJSDocParameterTags;\n    function getJSDocType(node) {\n        var tag = getFirstJSDocTag(node, 283);\n        if (!tag && node.kind === 144) {\n            var paramTags = getJSDocParameterTags(node);\n            if (paramTags) {\n                tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; });\n            }\n        }\n        return tag && tag.typeExpression && tag.typeExpression.type;\n    }\n    ts.getJSDocType = getJSDocType;\n    function getJSDocAugmentsTag(node) {\n        return getFirstJSDocTag(node, 280);\n    }\n    ts.getJSDocAugmentsTag = getJSDocAugmentsTag;\n    function getJSDocReturnTag(node) {\n        return getFirstJSDocTag(node, 282);\n    }\n    ts.getJSDocReturnTag = getJSDocReturnTag;\n    function getJSDocTemplateTag(node) {\n        return getFirstJSDocTag(node, 284);\n    }\n    ts.getJSDocTemplateTag = getJSDocTemplateTag;\n    function hasRestParameter(s) {\n        return isRestParameter(ts.lastOrUndefined(s.parameters));\n    }\n    ts.hasRestParameter = hasRestParameter;\n    function hasDeclaredRestParameter(s) {\n        return isDeclaredRestParam(ts.lastOrUndefined(s.parameters));\n    }\n    ts.hasDeclaredRestParameter = hasDeclaredRestParameter;\n    function isRestParameter(node) {\n        if (node && (node.flags & 65536)) {\n            if (node.type && node.type.kind === 275 ||\n                ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275; })) {\n                return true;\n            }\n        }\n        return isDeclaredRestParam(node);\n    }\n    ts.isRestParameter = isRestParameter;\n    function isDeclaredRestParam(node) {\n        return node && node.dotDotDotToken !== undefined;\n    }\n    ts.isDeclaredRestParam = isDeclaredRestParam;\n    function getAssignmentTargetKind(node) {\n        var parent = node.parent;\n        while (true) {\n            switch (parent.kind) {\n                case 192:\n                    var binaryOperator = parent.operatorToken.kind;\n                    return isAssignmentOperator(binaryOperator) && parent.left === node ?\n                        binaryOperator === 57 ? 1 : 2 :\n                        0;\n                case 190:\n                case 191:\n                    var unaryOperator = parent.operator;\n                    return unaryOperator === 42 || unaryOperator === 43 ? 2 : 0;\n                case 212:\n                case 213:\n                    return parent.initializer === node ? 1 : 0;\n                case 183:\n                case 175:\n                case 196:\n                    node = parent;\n                    break;\n                case 258:\n                    if (parent.name !== node) {\n                        return 0;\n                    }\n                case 257:\n                    node = parent.parent;\n                    break;\n                default:\n                    return 0;\n            }\n            parent = node.parent;\n        }\n    }\n    ts.getAssignmentTargetKind = getAssignmentTargetKind;\n    function isAssignmentTarget(node) {\n        return getAssignmentTargetKind(node) !== 0;\n    }\n    ts.isAssignmentTarget = isAssignmentTarget;\n    function isNodeDescendantOf(node, ancestor) {\n        while (node) {\n            if (node === ancestor)\n                return true;\n            node = node.parent;\n        }\n        return false;\n    }\n    ts.isNodeDescendantOf = isNodeDescendantOf;\n    function isInAmbientContext(node) {\n        while (node) {\n            if (hasModifier(node, 2) || (node.kind === 261 && node.isDeclarationFile)) {\n                return true;\n            }\n            node = node.parent;\n        }\n        return false;\n    }\n    ts.isInAmbientContext = isInAmbientContext;\n    function isDeclarationName(name) {\n        if (name.kind !== 70 && name.kind !== 9 && name.kind !== 8) {\n            return false;\n        }\n        var parent = name.parent;\n        if (parent.kind === 239 || parent.kind === 243) {\n            if (parent.propertyName) {\n                return true;\n            }\n        }\n        if (isDeclaration(parent)) {\n            return parent.name === name;\n        }\n        return false;\n    }\n    ts.isDeclarationName = isDeclarationName;\n    function isLiteralComputedPropertyDeclarationName(node) {\n        return (node.kind === 9 || node.kind === 8) &&\n            node.parent.kind === 142 &&\n            isDeclaration(node.parent.parent);\n    }\n    ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName;\n    function isIdentifierName(node) {\n        var parent = node.parent;\n        switch (parent.kind) {\n            case 147:\n            case 146:\n            case 149:\n            case 148:\n            case 151:\n            case 152:\n            case 260:\n            case 257:\n            case 177:\n                return parent.name === node;\n            case 141:\n                if (parent.right === node) {\n                    while (parent.kind === 141) {\n                        parent = parent.parent;\n                    }\n                    return parent.kind === 160;\n                }\n                return false;\n            case 174:\n            case 239:\n                return parent.propertyName === node;\n            case 243:\n                return true;\n        }\n        return false;\n    }\n    ts.isIdentifierName = isIdentifierName;\n    function isAliasSymbolDeclaration(node) {\n        return node.kind === 234 ||\n            node.kind === 233 ||\n            node.kind === 236 && !!node.name ||\n            node.kind === 237 ||\n            node.kind === 239 ||\n            node.kind === 243 ||\n            node.kind === 240 && exportAssignmentIsAlias(node);\n    }\n    ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;\n    function exportAssignmentIsAlias(node) {\n        return isEntityNameExpression(node.expression);\n    }\n    ts.exportAssignmentIsAlias = exportAssignmentIsAlias;\n    function getClassExtendsHeritageClauseElement(node) {\n        var heritageClause = getHeritageClause(node.heritageClauses, 84);\n        return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;\n    }\n    ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement;\n    function getClassImplementsHeritageClauseElements(node) {\n        var heritageClause = getHeritageClause(node.heritageClauses, 107);\n        return heritageClause ? heritageClause.types : undefined;\n    }\n    ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements;\n    function getInterfaceBaseTypeNodes(node) {\n        var heritageClause = getHeritageClause(node.heritageClauses, 84);\n        return heritageClause ? heritageClause.types : undefined;\n    }\n    ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes;\n    function getHeritageClause(clauses, kind) {\n        if (clauses) {\n            for (var _i = 0, clauses_1 = clauses; _i < clauses_1.length; _i++) {\n                var clause = clauses_1[_i];\n                if (clause.token === kind) {\n                    return clause;\n                }\n            }\n        }\n        return undefined;\n    }\n    ts.getHeritageClause = getHeritageClause;\n    function tryResolveScriptReference(host, sourceFile, reference) {\n        if (!host.getCompilerOptions().noResolve) {\n            var referenceFileName = ts.isRootedDiskPath(reference.fileName) ? reference.fileName : ts.combinePaths(ts.getDirectoryPath(sourceFile.fileName), reference.fileName);\n            return host.getSourceFile(referenceFileName);\n        }\n    }\n    ts.tryResolveScriptReference = tryResolveScriptReference;\n    function getAncestor(node, kind) {\n        while (node) {\n            if (node.kind === kind) {\n                return node;\n            }\n            node = node.parent;\n        }\n        return undefined;\n    }\n    ts.getAncestor = getAncestor;\n    function getFileReferenceFromReferencePath(comment, commentRange) {\n        var simpleReferenceRegEx = /^\\/\\/\\/\\s*<reference\\s+/gim;\n        var isNoDefaultLibRegEx = /^(\\/\\/\\/\\s*<reference\\s+no-default-lib\\s*=\\s*)('|\")(.+?)\\2\\s*\\/>/gim;\n        if (simpleReferenceRegEx.test(comment)) {\n            if (isNoDefaultLibRegEx.test(comment)) {\n                return {\n                    isNoDefaultLib: true\n                };\n            }\n            else {\n                var refMatchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment);\n                var refLibResult = !refMatchResult && ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment);\n                if (refMatchResult || refLibResult) {\n                    var start = commentRange.pos;\n                    var end = commentRange.end;\n                    return {\n                        fileReference: {\n                            pos: start,\n                            end: end,\n                            fileName: (refMatchResult || refLibResult)[3]\n                        },\n                        isNoDefaultLib: false,\n                        isTypeReferenceDirective: !!refLibResult\n                    };\n                }\n                return {\n                    diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax,\n                    isNoDefaultLib: false\n                };\n            }\n        }\n        return undefined;\n    }\n    ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath;\n    function isKeyword(token) {\n        return 71 <= token && token <= 140;\n    }\n    ts.isKeyword = isKeyword;\n    function isTrivia(token) {\n        return 2 <= token && token <= 7;\n    }\n    ts.isTrivia = isTrivia;\n    function isAsyncFunctionLike(node) {\n        return isFunctionLike(node) && hasModifier(node, 256) && !isAccessor(node);\n    }\n    ts.isAsyncFunctionLike = isAsyncFunctionLike;\n    function isStringOrNumericLiteral(node) {\n        var kind = node.kind;\n        return kind === 9\n            || kind === 8;\n    }\n    ts.isStringOrNumericLiteral = isStringOrNumericLiteral;\n    function hasDynamicName(declaration) {\n        return declaration.name && isDynamicName(declaration.name);\n    }\n    ts.hasDynamicName = hasDynamicName;\n    function isDynamicName(name) {\n        return name.kind === 142 &&\n            !isStringOrNumericLiteral(name.expression) &&\n            !isWellKnownSymbolSyntactically(name.expression);\n    }\n    ts.isDynamicName = isDynamicName;\n    function isWellKnownSymbolSyntactically(node) {\n        return isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression);\n    }\n    ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically;\n    function getPropertyNameForPropertyNameNode(name) {\n        if (name.kind === 70 || name.kind === 9 || name.kind === 8 || name.kind === 144) {\n            return name.text;\n        }\n        if (name.kind === 142) {\n            var nameExpression = name.expression;\n            if (isWellKnownSymbolSyntactically(nameExpression)) {\n                var rightHandSideName = nameExpression.name.text;\n                return getPropertyNameForKnownSymbolName(rightHandSideName);\n            }\n            else if (nameExpression.kind === 9 || nameExpression.kind === 8) {\n                return nameExpression.text;\n            }\n        }\n        return undefined;\n    }\n    ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode;\n    function getPropertyNameForKnownSymbolName(symbolName) {\n        return \"__@\" + symbolName;\n    }\n    ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName;\n    function isESSymbolIdentifier(node) {\n        return node.kind === 70 && node.text === \"Symbol\";\n    }\n    ts.isESSymbolIdentifier = isESSymbolIdentifier;\n    function isPushOrUnshiftIdentifier(node) {\n        return node.text === \"push\" || node.text === \"unshift\";\n    }\n    ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier;\n    function isModifierKind(token) {\n        switch (token) {\n            case 116:\n            case 119:\n            case 75:\n            case 123:\n            case 78:\n            case 83:\n            case 113:\n            case 111:\n            case 112:\n            case 130:\n            case 114:\n                return true;\n        }\n        return false;\n    }\n    ts.isModifierKind = isModifierKind;\n    function isParameterDeclaration(node) {\n        var root = getRootDeclaration(node);\n        return root.kind === 144;\n    }\n    ts.isParameterDeclaration = isParameterDeclaration;\n    function getRootDeclaration(node) {\n        while (node.kind === 174) {\n            node = node.parent.parent;\n        }\n        return node;\n    }\n    ts.getRootDeclaration = getRootDeclaration;\n    function nodeStartsNewLexicalEnvironment(node) {\n        var kind = node.kind;\n        return kind === 150\n            || kind === 184\n            || kind === 225\n            || kind === 185\n            || kind === 149\n            || kind === 151\n            || kind === 152\n            || kind === 230\n            || kind === 261;\n    }\n    ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment;\n    function nodeIsSynthesized(node) {\n        return ts.positionIsSynthesized(node.pos)\n            || ts.positionIsSynthesized(node.end);\n    }\n    ts.nodeIsSynthesized = nodeIsSynthesized;\n    function getOriginalNode(node, nodeTest) {\n        if (node) {\n            while (node.original !== undefined) {\n                node = node.original;\n            }\n        }\n        return !nodeTest || nodeTest(node) ? node : undefined;\n    }\n    ts.getOriginalNode = getOriginalNode;\n    function isParseTreeNode(node) {\n        return (node.flags & 8) === 0;\n    }\n    ts.isParseTreeNode = isParseTreeNode;\n    function getParseTreeNode(node, nodeTest) {\n        if (isParseTreeNode(node)) {\n            return node;\n        }\n        node = getOriginalNode(node);\n        if (isParseTreeNode(node) && (!nodeTest || nodeTest(node))) {\n            return node;\n        }\n        return undefined;\n    }\n    ts.getParseTreeNode = getParseTreeNode;\n    function getOriginalSourceFiles(sourceFiles) {\n        var originalSourceFiles = [];\n        for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) {\n            var sourceFile = sourceFiles_1[_i];\n            var originalSourceFile = getParseTreeNode(sourceFile, isSourceFile);\n            if (originalSourceFile) {\n                originalSourceFiles.push(originalSourceFile);\n            }\n        }\n        return originalSourceFiles;\n    }\n    ts.getOriginalSourceFiles = getOriginalSourceFiles;\n    function getOriginalNodeId(node) {\n        node = getOriginalNode(node);\n        return node ? ts.getNodeId(node) : 0;\n    }\n    ts.getOriginalNodeId = getOriginalNodeId;\n    function getExpressionAssociativity(expression) {\n        var operator = getOperator(expression);\n        var hasArguments = expression.kind === 180 && expression.arguments !== undefined;\n        return getOperatorAssociativity(expression.kind, operator, hasArguments);\n    }\n    ts.getExpressionAssociativity = getExpressionAssociativity;\n    function getOperatorAssociativity(kind, operator, hasArguments) {\n        switch (kind) {\n            case 180:\n                return hasArguments ? 0 : 1;\n            case 190:\n            case 187:\n            case 188:\n            case 186:\n            case 189:\n            case 193:\n            case 195:\n                return 1;\n            case 192:\n                switch (operator) {\n                    case 39:\n                    case 57:\n                    case 58:\n                    case 59:\n                    case 61:\n                    case 60:\n                    case 62:\n                    case 63:\n                    case 64:\n                    case 65:\n                    case 66:\n                    case 67:\n                    case 69:\n                    case 68:\n                        return 1;\n                }\n        }\n        return 0;\n    }\n    ts.getOperatorAssociativity = getOperatorAssociativity;\n    function getExpressionPrecedence(expression) {\n        var operator = getOperator(expression);\n        var hasArguments = expression.kind === 180 && expression.arguments !== undefined;\n        return getOperatorPrecedence(expression.kind, operator, hasArguments);\n    }\n    ts.getExpressionPrecedence = getExpressionPrecedence;\n    function getOperator(expression) {\n        if (expression.kind === 192) {\n            return expression.operatorToken.kind;\n        }\n        else if (expression.kind === 190 || expression.kind === 191) {\n            return expression.operator;\n        }\n        else {\n            return expression.kind;\n        }\n    }\n    ts.getOperator = getOperator;\n    function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {\n        switch (nodeKind) {\n            case 98:\n            case 96:\n            case 70:\n            case 94:\n            case 100:\n            case 85:\n            case 8:\n            case 9:\n            case 175:\n            case 176:\n            case 184:\n            case 185:\n            case 197:\n            case 246:\n            case 247:\n            case 11:\n            case 12:\n            case 194:\n            case 183:\n            case 198:\n            case 297:\n                return 19;\n            case 181:\n            case 177:\n            case 178:\n                return 18;\n            case 180:\n                return hasArguments ? 18 : 17;\n            case 179:\n                return 17;\n            case 191:\n                return 16;\n            case 190:\n            case 187:\n            case 188:\n            case 186:\n            case 189:\n                return 15;\n            case 192:\n                switch (operatorKind) {\n                    case 50:\n                    case 51:\n                        return 15;\n                    case 39:\n                    case 38:\n                    case 40:\n                    case 41:\n                        return 14;\n                    case 36:\n                    case 37:\n                        return 13;\n                    case 44:\n                    case 45:\n                    case 46:\n                        return 12;\n                    case 26:\n                    case 29:\n                    case 28:\n                    case 30:\n                    case 91:\n                    case 92:\n                        return 11;\n                    case 31:\n                    case 33:\n                    case 32:\n                    case 34:\n                        return 10;\n                    case 47:\n                        return 9;\n                    case 49:\n                        return 8;\n                    case 48:\n                        return 7;\n                    case 52:\n                        return 6;\n                    case 53:\n                        return 5;\n                    case 57:\n                    case 58:\n                    case 59:\n                    case 61:\n                    case 60:\n                    case 62:\n                    case 63:\n                    case 64:\n                    case 65:\n                    case 66:\n                    case 67:\n                    case 69:\n                    case 68:\n                        return 3;\n                    case 25:\n                        return 0;\n                    default:\n                        return -1;\n                }\n            case 193:\n                return 4;\n            case 195:\n                return 2;\n            case 196:\n                return 1;\n            default:\n                return -1;\n        }\n    }\n    ts.getOperatorPrecedence = getOperatorPrecedence;\n    function createDiagnosticCollection() {\n        var nonFileDiagnostics = [];\n        var fileDiagnostics = ts.createMap();\n        var diagnosticsModified = false;\n        var modificationCount = 0;\n        return {\n            add: add,\n            getGlobalDiagnostics: getGlobalDiagnostics,\n            getDiagnostics: getDiagnostics,\n            getModificationCount: getModificationCount,\n            reattachFileDiagnostics: reattachFileDiagnostics\n        };\n        function getModificationCount() {\n            return modificationCount;\n        }\n        function reattachFileDiagnostics(newFile) {\n            if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) {\n                return;\n            }\n            for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) {\n                var diagnostic = _a[_i];\n                diagnostic.file = newFile;\n            }\n        }\n        function add(diagnostic) {\n            var diagnostics;\n            if (diagnostic.file) {\n                diagnostics = fileDiagnostics[diagnostic.file.fileName];\n                if (!diagnostics) {\n                    diagnostics = [];\n                    fileDiagnostics[diagnostic.file.fileName] = diagnostics;\n                }\n            }\n            else {\n                diagnostics = nonFileDiagnostics;\n            }\n            diagnostics.push(diagnostic);\n            diagnosticsModified = true;\n            modificationCount++;\n        }\n        function getGlobalDiagnostics() {\n            sortAndDeduplicate();\n            return nonFileDiagnostics;\n        }\n        function getDiagnostics(fileName) {\n            sortAndDeduplicate();\n            if (fileName) {\n                return fileDiagnostics[fileName] || [];\n            }\n            var allDiagnostics = [];\n            function pushDiagnostic(d) {\n                allDiagnostics.push(d);\n            }\n            ts.forEach(nonFileDiagnostics, pushDiagnostic);\n            for (var key in fileDiagnostics) {\n                ts.forEach(fileDiagnostics[key], pushDiagnostic);\n            }\n            return ts.sortAndDeduplicateDiagnostics(allDiagnostics);\n        }\n        function sortAndDeduplicate() {\n            if (!diagnosticsModified) {\n                return;\n            }\n            diagnosticsModified = false;\n            nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics);\n            for (var key in fileDiagnostics) {\n                fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]);\n            }\n        }\n    }\n    ts.createDiagnosticCollection = createDiagnosticCollection;\n    var escapedCharsRegExp = /[\\\\\\\"\\u0000-\\u001f\\t\\v\\f\\b\\r\\n\\u2028\\u2029\\u0085]/g;\n    var escapedCharsMap = ts.createMap({\n        \"\\0\": \"\\\\0\",\n        \"\\t\": \"\\\\t\",\n        \"\\v\": \"\\\\v\",\n        \"\\f\": \"\\\\f\",\n        \"\\b\": \"\\\\b\",\n        \"\\r\": \"\\\\r\",\n        \"\\n\": \"\\\\n\",\n        \"\\\\\": \"\\\\\\\\\",\n        \"\\\"\": \"\\\\\\\"\",\n        \"\\u2028\": \"\\\\u2028\",\n        \"\\u2029\": \"\\\\u2029\",\n        \"\\u0085\": \"\\\\u0085\"\n    });\n    function escapeString(s) {\n        s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s;\n        return s;\n        function getReplacement(c) {\n            return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0));\n        }\n    }\n    ts.escapeString = escapeString;\n    function isIntrinsicJsxName(name) {\n        var ch = name.substr(0, 1);\n        return ch.toLowerCase() === ch;\n    }\n    ts.isIntrinsicJsxName = isIntrinsicJsxName;\n    function get16BitUnicodeEscapeSequence(charCode) {\n        var hexCharCode = charCode.toString(16).toUpperCase();\n        var paddedHexCode = (\"0000\" + hexCharCode).slice(-4);\n        return \"\\\\u\" + paddedHexCode;\n    }\n    var nonAsciiCharacters = /[^\\u0000-\\u007F]/g;\n    function escapeNonAsciiCharacters(s) {\n        return nonAsciiCharacters.test(s) ?\n            s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) :\n            s;\n    }\n    ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters;\n    var indentStrings = [\"\", \"    \"];\n    function getIndentString(level) {\n        if (indentStrings[level] === undefined) {\n            indentStrings[level] = getIndentString(level - 1) + indentStrings[1];\n        }\n        return indentStrings[level];\n    }\n    ts.getIndentString = getIndentString;\n    function getIndentSize() {\n        return indentStrings[1].length;\n    }\n    ts.getIndentSize = getIndentSize;\n    function createTextWriter(newLine) {\n        var output;\n        var indent;\n        var lineStart;\n        var lineCount;\n        var linePos;\n        function write(s) {\n            if (s && s.length) {\n                if (lineStart) {\n                    output += getIndentString(indent);\n                    lineStart = false;\n                }\n                output += s;\n            }\n        }\n        function reset() {\n            output = \"\";\n            indent = 0;\n            lineStart = true;\n            lineCount = 0;\n            linePos = 0;\n        }\n        function rawWrite(s) {\n            if (s !== undefined) {\n                if (lineStart) {\n                    lineStart = false;\n                }\n                output += s;\n            }\n        }\n        function writeLiteral(s) {\n            if (s && s.length) {\n                write(s);\n                var lineStartsOfS = ts.computeLineStarts(s);\n                if (lineStartsOfS.length > 1) {\n                    lineCount = lineCount + lineStartsOfS.length - 1;\n                    linePos = output.length - s.length + ts.lastOrUndefined(lineStartsOfS);\n                }\n            }\n        }\n        function writeLine() {\n            if (!lineStart) {\n                output += newLine;\n                lineCount++;\n                linePos = output.length;\n                lineStart = true;\n            }\n        }\n        function writeTextOfNode(text, node) {\n            write(getTextOfNodeFromSourceText(text, node));\n        }\n        reset();\n        return {\n            write: write,\n            rawWrite: rawWrite,\n            writeTextOfNode: writeTextOfNode,\n            writeLiteral: writeLiteral,\n            writeLine: writeLine,\n            increaseIndent: function () { indent++; },\n            decreaseIndent: function () { indent--; },\n            getIndent: function () { return indent; },\n            getTextPos: function () { return output.length; },\n            getLine: function () { return lineCount + 1; },\n            getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; },\n            getText: function () { return output; },\n            isAtStartOfLine: function () { return lineStart; },\n            reset: reset\n        };\n    }\n    ts.createTextWriter = createTextWriter;\n    function getResolvedExternalModuleName(host, file) {\n        return file.moduleName || getExternalModuleNameFromPath(host, file.fileName);\n    }\n    ts.getResolvedExternalModuleName = getResolvedExternalModuleName;\n    function getExternalModuleNameFromDeclaration(host, resolver, declaration) {\n        var file = resolver.getExternalModuleFileFromDeclaration(declaration);\n        if (!file || isDeclarationFile(file)) {\n            return undefined;\n        }\n        return getResolvedExternalModuleName(host, file);\n    }\n    ts.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration;\n    function getExternalModuleNameFromPath(host, fileName) {\n        var getCanonicalFileName = function (f) { return host.getCanonicalFileName(f); };\n        var dir = ts.toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName);\n        var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());\n        var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, false);\n        return ts.removeFileExtension(relativePath);\n    }\n    ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath;\n    function getOwnEmitOutputFilePath(sourceFile, host, extension) {\n        var compilerOptions = host.getCompilerOptions();\n        var emitOutputFilePathWithoutExtension;\n        if (compilerOptions.outDir) {\n            emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir));\n        }\n        else {\n            emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName);\n        }\n        return emitOutputFilePathWithoutExtension + extension;\n    }\n    ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath;\n    function getDeclarationEmitOutputFilePath(sourceFile, host) {\n        var options = host.getCompilerOptions();\n        var outputDir = options.declarationDir || options.outDir;\n        var path = outputDir\n            ? getSourceFilePathInNewDir(sourceFile, host, outputDir)\n            : sourceFile.fileName;\n        return ts.removeFileExtension(path) + \".d.ts\";\n    }\n    ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath;\n    function getSourceFilesToEmit(host, targetSourceFile) {\n        var options = host.getCompilerOptions();\n        if (options.outFile || options.out) {\n            var moduleKind = ts.getEmitModuleKind(options);\n            var moduleEmitEnabled = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System;\n            var sourceFiles = getAllEmittableSourceFiles();\n            return ts.filter(sourceFiles, moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule);\n        }\n        else {\n            var sourceFiles = targetSourceFile === undefined ? getAllEmittableSourceFiles() : [targetSourceFile];\n            return filterSourceFilesInDirectory(sourceFiles, function (file) { return host.isSourceFileFromExternalLibrary(file); });\n        }\n        function getAllEmittableSourceFiles() {\n            return options.noEmitForJsFiles ? ts.filter(host.getSourceFiles(), function (sourceFile) { return !isSourceFileJavaScript(sourceFile); }) : host.getSourceFiles();\n        }\n    }\n    ts.getSourceFilesToEmit = getSourceFilesToEmit;\n    function filterSourceFilesInDirectory(sourceFiles, isSourceFileFromExternalLibrary) {\n        return ts.filter(sourceFiles, function (file) { return shouldEmitInDirectory(file, isSourceFileFromExternalLibrary); });\n    }\n    ts.filterSourceFilesInDirectory = filterSourceFilesInDirectory;\n    function isNonDeclarationFile(sourceFile) {\n        return !isDeclarationFile(sourceFile);\n    }\n    function shouldEmitInDirectory(sourceFile, isSourceFileFromExternalLibrary) {\n        return isNonDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile);\n    }\n    function isBundleEmitNonExternalModule(sourceFile) {\n        return isNonDeclarationFile(sourceFile) && !ts.isExternalModule(sourceFile);\n    }\n    function forEachTransformedEmitFile(host, sourceFiles, action, emitOnlyDtsFiles) {\n        var options = host.getCompilerOptions();\n        if (options.outFile || options.out) {\n            onBundledEmit(sourceFiles);\n        }\n        else {\n            for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) {\n                var sourceFile = sourceFiles_2[_i];\n                if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) {\n                    onSingleFileEmit(host, sourceFile);\n                }\n            }\n        }\n        function onSingleFileEmit(host, sourceFile) {\n            var extension = \".js\";\n            if (options.jsx === 1) {\n                if (isSourceFileJavaScript(sourceFile)) {\n                    if (ts.fileExtensionIs(sourceFile.fileName, \".jsx\")) {\n                        extension = \".jsx\";\n                    }\n                }\n                else if (sourceFile.languageVariant === 1) {\n                    extension = \".jsx\";\n                }\n            }\n            var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension);\n            var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options);\n            var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (options.declaration || emitOnlyDtsFiles) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined;\n            action(jsFilePath, sourceMapFilePath, declarationFilePath, [sourceFile], false);\n        }\n        function onBundledEmit(sourceFiles) {\n            if (sourceFiles.length) {\n                var jsFilePath = options.outFile || options.out;\n                var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options);\n                var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + \".d.ts\" : undefined;\n                action(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, true);\n            }\n        }\n    }\n    ts.forEachTransformedEmitFile = forEachTransformedEmitFile;\n    function getSourceMapFilePath(jsFilePath, options) {\n        return options.sourceMap ? jsFilePath + \".map\" : undefined;\n    }\n    function forEachExpectedEmitFile(host, action, targetSourceFile, emitOnlyDtsFiles) {\n        var options = host.getCompilerOptions();\n        if (options.outFile || options.out) {\n            onBundledEmit(host);\n        }\n        else {\n            var sourceFiles = targetSourceFile === undefined ? getSourceFilesToEmit(host) : [targetSourceFile];\n            for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) {\n                var sourceFile = sourceFiles_3[_i];\n                if (shouldEmitInDirectory(sourceFile, function (file) { return host.isSourceFileFromExternalLibrary(file); })) {\n                    onSingleFileEmit(host, sourceFile);\n                }\n            }\n        }\n        function onSingleFileEmit(host, sourceFile) {\n            var extension = \".js\";\n            if (options.jsx === 1) {\n                if (isSourceFileJavaScript(sourceFile)) {\n                    if (ts.fileExtensionIs(sourceFile.fileName, \".jsx\")) {\n                        extension = \".jsx\";\n                    }\n                }\n                else if (sourceFile.languageVariant === 1) {\n                    extension = \".jsx\";\n                }\n            }\n            var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension);\n            var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined;\n            var emitFileNames = {\n                jsFilePath: jsFilePath,\n                sourceMapFilePath: getSourceMapFilePath(jsFilePath, options),\n                declarationFilePath: declarationFilePath\n            };\n            action(emitFileNames, [sourceFile], false, emitOnlyDtsFiles);\n        }\n        function onBundledEmit(host) {\n            var bundledSources = ts.filter(getSourceFilesToEmit(host), function (sourceFile) { return !isDeclarationFile(sourceFile) &&\n                !host.isSourceFileFromExternalLibrary(sourceFile) &&\n                (!ts.isExternalModule(sourceFile) ||\n                    !!ts.getEmitModuleKind(options)); });\n            if (bundledSources.length) {\n                var jsFilePath = options.outFile || options.out;\n                var emitFileNames = {\n                    jsFilePath: jsFilePath,\n                    sourceMapFilePath: getSourceMapFilePath(jsFilePath, options),\n                    declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + \".d.ts\" : undefined\n                };\n                action(emitFileNames, bundledSources, true, emitOnlyDtsFiles);\n            }\n        }\n    }\n    ts.forEachExpectedEmitFile = forEachExpectedEmitFile;\n    function getSourceFilePathInNewDir(sourceFile, host, newDirPath) {\n        var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory());\n        var commonSourceDirectory = host.getCommonSourceDirectory();\n        var isSourceFileInCommonSourceDirectory = host.getCanonicalFileName(sourceFilePath).indexOf(host.getCanonicalFileName(commonSourceDirectory)) === 0;\n        sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath;\n        return ts.combinePaths(newDirPath, sourceFilePath);\n    }\n    ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir;\n    function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) {\n        host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) {\n            diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));\n        }, sourceFiles);\n    }\n    ts.writeFile = writeFile;\n    function getLineOfLocalPosition(currentSourceFile, pos) {\n        return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line;\n    }\n    ts.getLineOfLocalPosition = getLineOfLocalPosition;\n    function getLineOfLocalPositionFromLineMap(lineMap, pos) {\n        return ts.computeLineAndCharacterOfPosition(lineMap, pos).line;\n    }\n    ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap;\n    function getFirstConstructorWithBody(node) {\n        return ts.forEach(node.members, function (member) {\n            if (member.kind === 150 && nodeIsPresent(member.body)) {\n                return member;\n            }\n        });\n    }\n    ts.getFirstConstructorWithBody = getFirstConstructorWithBody;\n    function getSetAccessorTypeAnnotationNode(accessor) {\n        if (accessor && accessor.parameters.length > 0) {\n            var hasThis = accessor.parameters.length === 2 && parameterIsThisKeyword(accessor.parameters[0]);\n            return accessor.parameters[hasThis ? 1 : 0].type;\n        }\n    }\n    ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode;\n    function getThisParameter(signature) {\n        if (signature.parameters.length) {\n            var thisParameter = signature.parameters[0];\n            if (parameterIsThisKeyword(thisParameter)) {\n                return thisParameter;\n            }\n        }\n    }\n    ts.getThisParameter = getThisParameter;\n    function parameterIsThisKeyword(parameter) {\n        return isThisIdentifier(parameter.name);\n    }\n    ts.parameterIsThisKeyword = parameterIsThisKeyword;\n    function isThisIdentifier(node) {\n        return node && node.kind === 70 && identifierIsThisKeyword(node);\n    }\n    ts.isThisIdentifier = isThisIdentifier;\n    function identifierIsThisKeyword(id) {\n        return id.originalKeywordKind === 98;\n    }\n    ts.identifierIsThisKeyword = identifierIsThisKeyword;\n    function getAllAccessorDeclarations(declarations, accessor) {\n        var firstAccessor;\n        var secondAccessor;\n        var getAccessor;\n        var setAccessor;\n        if (hasDynamicName(accessor)) {\n            firstAccessor = accessor;\n            if (accessor.kind === 151) {\n                getAccessor = accessor;\n            }\n            else if (accessor.kind === 152) {\n                setAccessor = accessor;\n            }\n            else {\n                ts.Debug.fail(\"Accessor has wrong kind\");\n            }\n        }\n        else {\n            ts.forEach(declarations, function (member) {\n                if ((member.kind === 151 || member.kind === 152)\n                    && hasModifier(member, 32) === hasModifier(accessor, 32)) {\n                    var memberName = getPropertyNameForPropertyNameNode(member.name);\n                    var accessorName = getPropertyNameForPropertyNameNode(accessor.name);\n                    if (memberName === accessorName) {\n                        if (!firstAccessor) {\n                            firstAccessor = member;\n                        }\n                        else if (!secondAccessor) {\n                            secondAccessor = member;\n                        }\n                        if (member.kind === 151 && !getAccessor) {\n                            getAccessor = member;\n                        }\n                        if (member.kind === 152 && !setAccessor) {\n                            setAccessor = member;\n                        }\n                    }\n                }\n            });\n        }\n        return {\n            firstAccessor: firstAccessor,\n            secondAccessor: secondAccessor,\n            getAccessor: getAccessor,\n            setAccessor: setAccessor\n        };\n    }\n    ts.getAllAccessorDeclarations = getAllAccessorDeclarations;\n    function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) {\n        emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, node.pos, leadingComments);\n    }\n    ts.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments;\n    function emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, pos, leadingComments) {\n        if (leadingComments && leadingComments.length && pos !== leadingComments[0].pos &&\n            getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) {\n            writer.writeLine();\n        }\n    }\n    ts.emitNewLineBeforeLeadingCommentsOfPosition = emitNewLineBeforeLeadingCommentsOfPosition;\n    function emitNewLineBeforeLeadingCommentOfPosition(lineMap, writer, pos, commentPos) {\n        if (pos !== commentPos &&\n            getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, commentPos)) {\n            writer.writeLine();\n        }\n    }\n    ts.emitNewLineBeforeLeadingCommentOfPosition = emitNewLineBeforeLeadingCommentOfPosition;\n    function emitComments(text, lineMap, writer, comments, leadingSeparator, trailingSeparator, newLine, writeComment) {\n        if (comments && comments.length > 0) {\n            if (leadingSeparator) {\n                writer.write(\" \");\n            }\n            var emitInterveningSeparator = false;\n            for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) {\n                var comment = comments_1[_i];\n                if (emitInterveningSeparator) {\n                    writer.write(\" \");\n                    emitInterveningSeparator = false;\n                }\n                writeComment(text, lineMap, writer, comment.pos, comment.end, newLine);\n                if (comment.hasTrailingNewLine) {\n                    writer.writeLine();\n                }\n                else {\n                    emitInterveningSeparator = true;\n                }\n            }\n            if (emitInterveningSeparator && trailingSeparator) {\n                writer.write(\" \");\n            }\n        }\n    }\n    ts.emitComments = emitComments;\n    function emitDetachedComments(text, lineMap, writer, writeComment, node, newLine, removeComments) {\n        var leadingComments;\n        var currentDetachedCommentInfo;\n        if (removeComments) {\n            if (node.pos === 0) {\n                leadingComments = ts.filter(ts.getLeadingCommentRanges(text, node.pos), isPinnedComment);\n            }\n        }\n        else {\n            leadingComments = ts.getLeadingCommentRanges(text, node.pos);\n        }\n        if (leadingComments) {\n            var detachedComments = [];\n            var lastComment = void 0;\n            for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) {\n                var comment = leadingComments_1[_i];\n                if (lastComment) {\n                    var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end);\n                    var commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos);\n                    if (commentLine >= lastCommentLine + 2) {\n                        break;\n                    }\n                }\n                detachedComments.push(comment);\n                lastComment = comment;\n            }\n            if (detachedComments.length) {\n                var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, ts.lastOrUndefined(detachedComments).end);\n                var nodeLine = getLineOfLocalPositionFromLineMap(lineMap, ts.skipTrivia(text, node.pos));\n                if (nodeLine >= lastCommentLine + 2) {\n                    emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments);\n                    emitComments(text, lineMap, writer, detachedComments, false, true, newLine, writeComment);\n                    currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end };\n                }\n            }\n        }\n        return currentDetachedCommentInfo;\n        function isPinnedComment(comment) {\n            return text.charCodeAt(comment.pos + 1) === 42 &&\n                text.charCodeAt(comment.pos + 2) === 33;\n        }\n    }\n    ts.emitDetachedComments = emitDetachedComments;\n    function writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine) {\n        if (text.charCodeAt(commentPos + 1) === 42) {\n            var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, commentPos);\n            var lineCount = lineMap.length;\n            var firstCommentLineIndent = void 0;\n            for (var pos = commentPos, currentLine = firstCommentLineAndCharacter.line; pos < commentEnd; currentLine++) {\n                var nextLineStart = (currentLine + 1) === lineCount\n                    ? text.length + 1\n                    : lineMap[currentLine + 1];\n                if (pos !== commentPos) {\n                    if (firstCommentLineIndent === undefined) {\n                        firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], commentPos);\n                    }\n                    var currentWriterIndentSpacing = writer.getIndent() * getIndentSize();\n                    var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart);\n                    if (spacesToEmit > 0) {\n                        var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize();\n                        var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize());\n                        writer.rawWrite(indentSizeSpaceString);\n                        while (numberOfSingleSpacesToEmit) {\n                            writer.rawWrite(\" \");\n                            numberOfSingleSpacesToEmit--;\n                        }\n                    }\n                    else {\n                        writer.rawWrite(\"\");\n                    }\n                }\n                writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart);\n                pos = nextLineStart;\n            }\n        }\n        else {\n            writer.write(text.substring(commentPos, commentEnd));\n        }\n    }\n    ts.writeCommentRange = writeCommentRange;\n    function writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart) {\n        var end = Math.min(commentEnd, nextLineStart - 1);\n        var currentLineText = text.substring(pos, end).replace(/^\\s+|\\s+$/g, \"\");\n        if (currentLineText) {\n            writer.write(currentLineText);\n            if (end !== commentEnd) {\n                writer.writeLine();\n            }\n        }\n        else {\n            writer.writeLiteral(newLine);\n        }\n    }\n    function calculateIndent(text, pos, end) {\n        var currentLineIndent = 0;\n        for (; pos < end && ts.isWhiteSpaceSingleLine(text.charCodeAt(pos)); pos++) {\n            if (text.charCodeAt(pos) === 9) {\n                currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize());\n            }\n            else {\n                currentLineIndent++;\n            }\n        }\n        return currentLineIndent;\n    }\n    function hasModifiers(node) {\n        return getModifierFlags(node) !== 0;\n    }\n    ts.hasModifiers = hasModifiers;\n    function hasModifier(node, flags) {\n        return (getModifierFlags(node) & flags) !== 0;\n    }\n    ts.hasModifier = hasModifier;\n    function getModifierFlags(node) {\n        if (node.modifierFlagsCache & 536870912) {\n            return node.modifierFlagsCache & ~536870912;\n        }\n        var flags = 0;\n        if (node.modifiers) {\n            for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {\n                var modifier = _a[_i];\n                flags |= modifierToFlag(modifier.kind);\n            }\n        }\n        if (node.flags & 4 || (node.kind === 70 && node.isInJSDocNamespace)) {\n            flags |= 1;\n        }\n        node.modifierFlagsCache = flags | 536870912;\n        return flags;\n    }\n    ts.getModifierFlags = getModifierFlags;\n    function modifierToFlag(token) {\n        switch (token) {\n            case 114: return 32;\n            case 113: return 4;\n            case 112: return 16;\n            case 111: return 8;\n            case 116: return 128;\n            case 83: return 1;\n            case 123: return 2;\n            case 75: return 2048;\n            case 78: return 512;\n            case 119: return 256;\n            case 130: return 64;\n        }\n        return 0;\n    }\n    ts.modifierToFlag = modifierToFlag;\n    function isLogicalOperator(token) {\n        return token === 53\n            || token === 52\n            || token === 50;\n    }\n    ts.isLogicalOperator = isLogicalOperator;\n    function isAssignmentOperator(token) {\n        return token >= 57 && token <= 69;\n    }\n    ts.isAssignmentOperator = isAssignmentOperator;\n    function tryGetClassExtendingExpressionWithTypeArguments(node) {\n        if (node.kind === 199 &&\n            node.parent.token === 84 &&\n            isClassLike(node.parent.parent)) {\n            return node.parent.parent;\n        }\n    }\n    ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments;\n    function isAssignmentExpression(node, excludeCompoundAssignment) {\n        return isBinaryExpression(node)\n            && (excludeCompoundAssignment\n                ? node.operatorToken.kind === 57\n                : isAssignmentOperator(node.operatorToken.kind))\n            && isLeftHandSideExpression(node.left);\n    }\n    ts.isAssignmentExpression = isAssignmentExpression;\n    function isDestructuringAssignment(node) {\n        if (isAssignmentExpression(node, true)) {\n            var kind = node.left.kind;\n            return kind === 176\n                || kind === 175;\n        }\n        return false;\n    }\n    ts.isDestructuringAssignment = isDestructuringAssignment;\n    function isSupportedExpressionWithTypeArguments(node) {\n        return isSupportedExpressionWithTypeArgumentsRest(node.expression);\n    }\n    ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments;\n    function isSupportedExpressionWithTypeArgumentsRest(node) {\n        if (node.kind === 70) {\n            return true;\n        }\n        else if (isPropertyAccessExpression(node)) {\n            return isSupportedExpressionWithTypeArgumentsRest(node.expression);\n        }\n        else {\n            return false;\n        }\n    }\n    function isExpressionWithTypeArgumentsInClassExtendsClause(node) {\n        return tryGetClassExtendingExpressionWithTypeArguments(node) !== undefined;\n    }\n    ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause;\n    function isEntityNameExpression(node) {\n        return node.kind === 70 ||\n            node.kind === 177 && isEntityNameExpression(node.expression);\n    }\n    ts.isEntityNameExpression = isEntityNameExpression;\n    function isRightSideOfQualifiedNameOrPropertyAccess(node) {\n        return (node.parent.kind === 141 && node.parent.right === node) ||\n            (node.parent.kind === 177 && node.parent.name === node);\n    }\n    ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;\n    function isEmptyObjectLiteralOrArrayLiteral(expression) {\n        var kind = expression.kind;\n        if (kind === 176) {\n            return expression.properties.length === 0;\n        }\n        if (kind === 175) {\n            return expression.elements.length === 0;\n        }\n        return false;\n    }\n    ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral;\n    function getLocalSymbolForExportDefault(symbol) {\n        return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512) ? symbol.valueDeclaration.localSymbol : undefined;\n    }\n    ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault;\n    function tryExtractTypeScriptExtension(fileName) {\n        return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); });\n    }\n    ts.tryExtractTypeScriptExtension = tryExtractTypeScriptExtension;\n    function getExpandedCharCodes(input) {\n        var output = [];\n        var length = input.length;\n        for (var i = 0; i < length; i++) {\n            var charCode = input.charCodeAt(i);\n            if (charCode < 0x80) {\n                output.push(charCode);\n            }\n            else if (charCode < 0x800) {\n                output.push((charCode >> 6) | 192);\n                output.push((charCode & 63) | 128);\n            }\n            else if (charCode < 0x10000) {\n                output.push((charCode >> 12) | 224);\n                output.push(((charCode >> 6) & 63) | 128);\n                output.push((charCode & 63) | 128);\n            }\n            else if (charCode < 0x20000) {\n                output.push((charCode >> 18) | 240);\n                output.push(((charCode >> 12) & 63) | 128);\n                output.push(((charCode >> 6) & 63) | 128);\n                output.push((charCode & 63) | 128);\n            }\n            else {\n                ts.Debug.assert(false, \"Unexpected code point\");\n            }\n        }\n        return output;\n    }\n    ts.stringify = typeof JSON !== \"undefined\" && JSON.stringify\n        ? JSON.stringify\n        : stringifyFallback;\n    function stringifyFallback(value) {\n        return value === undefined ? undefined : stringifyValue(value);\n    }\n    function stringifyValue(value) {\n        return typeof value === \"string\" ? \"\\\"\" + escapeString(value) + \"\\\"\"\n            : typeof value === \"number\" ? isFinite(value) ? String(value) : \"null\"\n                : typeof value === \"boolean\" ? value ? \"true\" : \"false\"\n                    : typeof value === \"object\" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value)\n                        : \"null\";\n    }\n    function cycleCheck(cb, value) {\n        ts.Debug.assert(!value.hasOwnProperty(\"__cycle\"), \"Converting circular structure to JSON\");\n        value.__cycle = true;\n        var result = cb(value);\n        delete value.__cycle;\n        return result;\n    }\n    function stringifyArray(value) {\n        return \"[\" + ts.reduceLeft(value, stringifyElement, \"\") + \"]\";\n    }\n    function stringifyElement(memo, value) {\n        return (memo ? memo + \",\" : memo) + stringifyValue(value);\n    }\n    function stringifyObject(value) {\n        return \"{\" + ts.reduceOwnProperties(value, stringifyProperty, \"\") + \"}\";\n    }\n    function stringifyProperty(memo, value, key) {\n        return value === undefined || typeof value === \"function\" || key === \"__cycle\" ? memo\n            : (memo ? memo + \",\" : memo) + (\"\\\"\" + escapeString(key) + \"\\\":\" + stringifyValue(value));\n    }\n    var base64Digits = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n    function convertToBase64(input) {\n        var result = \"\";\n        var charCodes = getExpandedCharCodes(input);\n        var i = 0;\n        var length = charCodes.length;\n        var byte1, byte2, byte3, byte4;\n        while (i < length) {\n            byte1 = charCodes[i] >> 2;\n            byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4;\n            byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6;\n            byte4 = charCodes[i + 2] & 63;\n            if (i + 1 >= length) {\n                byte3 = byte4 = 64;\n            }\n            else if (i + 2 >= length) {\n                byte4 = 64;\n            }\n            result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4);\n            i += 3;\n        }\n        return result;\n    }\n    ts.convertToBase64 = convertToBase64;\n    var carriageReturnLineFeed = \"\\r\\n\";\n    var lineFeed = \"\\n\";\n    function getNewLineCharacter(options) {\n        if (options.newLine === 0) {\n            return carriageReturnLineFeed;\n        }\n        else if (options.newLine === 1) {\n            return lineFeed;\n        }\n        else if (ts.sys) {\n            return ts.sys.newLine;\n        }\n        return carriageReturnLineFeed;\n    }\n    ts.getNewLineCharacter = getNewLineCharacter;\n    function isSimpleExpression(node) {\n        return isSimpleExpressionWorker(node, 0);\n    }\n    ts.isSimpleExpression = isSimpleExpression;\n    function isSimpleExpressionWorker(node, depth) {\n        if (depth <= 5) {\n            var kind = node.kind;\n            if (kind === 9\n                || kind === 8\n                || kind === 11\n                || kind === 12\n                || kind === 70\n                || kind === 98\n                || kind === 96\n                || kind === 100\n                || kind === 85\n                || kind === 94) {\n                return true;\n            }\n            else if (kind === 177) {\n                return isSimpleExpressionWorker(node.expression, depth + 1);\n            }\n            else if (kind === 178) {\n                return isSimpleExpressionWorker(node.expression, depth + 1)\n                    && isSimpleExpressionWorker(node.argumentExpression, depth + 1);\n            }\n            else if (kind === 190\n                || kind === 191) {\n                return isSimpleExpressionWorker(node.operand, depth + 1);\n            }\n            else if (kind === 192) {\n                return node.operatorToken.kind !== 39\n                    && isSimpleExpressionWorker(node.left, depth + 1)\n                    && isSimpleExpressionWorker(node.right, depth + 1);\n            }\n            else if (kind === 193) {\n                return isSimpleExpressionWorker(node.condition, depth + 1)\n                    && isSimpleExpressionWorker(node.whenTrue, depth + 1)\n                    && isSimpleExpressionWorker(node.whenFalse, depth + 1);\n            }\n            else if (kind === 188\n                || kind === 187\n                || kind === 186) {\n                return isSimpleExpressionWorker(node.expression, depth + 1);\n            }\n            else if (kind === 175) {\n                return node.elements.length === 0;\n            }\n            else if (kind === 176) {\n                return node.properties.length === 0;\n            }\n            else if (kind === 179) {\n                if (!isSimpleExpressionWorker(node.expression, depth + 1)) {\n                    return false;\n                }\n                for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {\n                    var argument = _a[_i];\n                    if (!isSimpleExpressionWorker(argument, depth + 1)) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n        }\n        return false;\n    }\n    var syntaxKindCache = ts.createMap();\n    function formatSyntaxKind(kind) {\n        var syntaxKindEnum = ts.SyntaxKind;\n        if (syntaxKindEnum) {\n            if (syntaxKindCache[kind]) {\n                return syntaxKindCache[kind];\n            }\n            for (var name_9 in syntaxKindEnum) {\n                if (syntaxKindEnum[name_9] === kind) {\n                    return syntaxKindCache[kind] = kind.toString() + \" (\" + name_9 + \")\";\n                }\n            }\n        }\n        else {\n            return kind.toString();\n        }\n    }\n    ts.formatSyntaxKind = formatSyntaxKind;\n    function movePos(pos, value) {\n        return ts.positionIsSynthesized(pos) ? -1 : pos + value;\n    }\n    ts.movePos = movePos;\n    function createRange(pos, end) {\n        return { pos: pos, end: end };\n    }\n    ts.createRange = createRange;\n    function moveRangeEnd(range, end) {\n        return createRange(range.pos, end);\n    }\n    ts.moveRangeEnd = moveRangeEnd;\n    function moveRangePos(range, pos) {\n        return createRange(pos, range.end);\n    }\n    ts.moveRangePos = moveRangePos;\n    function moveRangePastDecorators(node) {\n        return node.decorators && node.decorators.length > 0\n            ? moveRangePos(node, node.decorators.end)\n            : node;\n    }\n    ts.moveRangePastDecorators = moveRangePastDecorators;\n    function moveRangePastModifiers(node) {\n        return node.modifiers && node.modifiers.length > 0\n            ? moveRangePos(node, node.modifiers.end)\n            : moveRangePastDecorators(node);\n    }\n    ts.moveRangePastModifiers = moveRangePastModifiers;\n    function isCollapsedRange(range) {\n        return range.pos === range.end;\n    }\n    ts.isCollapsedRange = isCollapsedRange;\n    function collapseRangeToStart(range) {\n        return isCollapsedRange(range) ? range : moveRangeEnd(range, range.pos);\n    }\n    ts.collapseRangeToStart = collapseRangeToStart;\n    function collapseRangeToEnd(range) {\n        return isCollapsedRange(range) ? range : moveRangePos(range, range.end);\n    }\n    ts.collapseRangeToEnd = collapseRangeToEnd;\n    function createTokenRange(pos, token) {\n        return createRange(pos, pos + ts.tokenToString(token).length);\n    }\n    ts.createTokenRange = createTokenRange;\n    function rangeIsOnSingleLine(range, sourceFile) {\n        return rangeStartIsOnSameLineAsRangeEnd(range, range, sourceFile);\n    }\n    ts.rangeIsOnSingleLine = rangeIsOnSingleLine;\n    function rangeStartPositionsAreOnSameLine(range1, range2, sourceFile) {\n        return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), getStartPositionOfRange(range2, sourceFile), sourceFile);\n    }\n    ts.rangeStartPositionsAreOnSameLine = rangeStartPositionsAreOnSameLine;\n    function rangeEndPositionsAreOnSameLine(range1, range2, sourceFile) {\n        return positionsAreOnSameLine(range1.end, range2.end, sourceFile);\n    }\n    ts.rangeEndPositionsAreOnSameLine = rangeEndPositionsAreOnSameLine;\n    function rangeStartIsOnSameLineAsRangeEnd(range1, range2, sourceFile) {\n        return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), range2.end, sourceFile);\n    }\n    ts.rangeStartIsOnSameLineAsRangeEnd = rangeStartIsOnSameLineAsRangeEnd;\n    function rangeEndIsOnSameLineAsRangeStart(range1, range2, sourceFile) {\n        return positionsAreOnSameLine(range1.end, getStartPositionOfRange(range2, sourceFile), sourceFile);\n    }\n    ts.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart;\n    function positionsAreOnSameLine(pos1, pos2, sourceFile) {\n        return pos1 === pos2 ||\n            getLineOfLocalPosition(sourceFile, pos1) === getLineOfLocalPosition(sourceFile, pos2);\n    }\n    ts.positionsAreOnSameLine = positionsAreOnSameLine;\n    function getStartPositionOfRange(range, sourceFile) {\n        return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos);\n    }\n    ts.getStartPositionOfRange = getStartPositionOfRange;\n    function isDeclarationNameOfEnumOrNamespace(node) {\n        var parseNode = getParseTreeNode(node);\n        if (parseNode) {\n            switch (parseNode.parent.kind) {\n                case 229:\n                case 230:\n                    return parseNode === parseNode.parent.name;\n            }\n        }\n        return false;\n    }\n    ts.isDeclarationNameOfEnumOrNamespace = isDeclarationNameOfEnumOrNamespace;\n    function getInitializedVariables(node) {\n        return ts.filter(node.declarations, isInitializedVariable);\n    }\n    ts.getInitializedVariables = getInitializedVariables;\n    function isInitializedVariable(node) {\n        return node.initializer !== undefined;\n    }\n    function isMergedWithClass(node) {\n        if (node.symbol) {\n            for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) {\n                var declaration = _a[_i];\n                if (declaration.kind === 226 && declaration !== node) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n    ts.isMergedWithClass = isMergedWithClass;\n    function isFirstDeclarationOfKind(node, kind) {\n        return node.symbol && getDeclarationOfKind(node.symbol, kind) === node;\n    }\n    ts.isFirstDeclarationOfKind = isFirstDeclarationOfKind;\n    function isNodeArray(array) {\n        return array.hasOwnProperty(\"pos\")\n            && array.hasOwnProperty(\"end\");\n    }\n    ts.isNodeArray = isNodeArray;\n    function isNoSubstitutionTemplateLiteral(node) {\n        return node.kind === 12;\n    }\n    ts.isNoSubstitutionTemplateLiteral = isNoSubstitutionTemplateLiteral;\n    function isLiteralKind(kind) {\n        return 8 <= kind && kind <= 12;\n    }\n    ts.isLiteralKind = isLiteralKind;\n    function isTextualLiteralKind(kind) {\n        return kind === 9 || kind === 12;\n    }\n    ts.isTextualLiteralKind = isTextualLiteralKind;\n    function isLiteralExpression(node) {\n        return isLiteralKind(node.kind);\n    }\n    ts.isLiteralExpression = isLiteralExpression;\n    function isTemplateLiteralKind(kind) {\n        return 12 <= kind && kind <= 15;\n    }\n    ts.isTemplateLiteralKind = isTemplateLiteralKind;\n    function isTemplateHead(node) {\n        return node.kind === 13;\n    }\n    ts.isTemplateHead = isTemplateHead;\n    function isTemplateMiddleOrTemplateTail(node) {\n        var kind = node.kind;\n        return kind === 14\n            || kind === 15;\n    }\n    ts.isTemplateMiddleOrTemplateTail = isTemplateMiddleOrTemplateTail;\n    function isIdentifier(node) {\n        return node.kind === 70;\n    }\n    ts.isIdentifier = isIdentifier;\n    function isGeneratedIdentifier(node) {\n        return isIdentifier(node) && node.autoGenerateKind > 0;\n    }\n    ts.isGeneratedIdentifier = isGeneratedIdentifier;\n    function isModifier(node) {\n        return isModifierKind(node.kind);\n    }\n    ts.isModifier = isModifier;\n    function isQualifiedName(node) {\n        return node.kind === 141;\n    }\n    ts.isQualifiedName = isQualifiedName;\n    function isComputedPropertyName(node) {\n        return node.kind === 142;\n    }\n    ts.isComputedPropertyName = isComputedPropertyName;\n    function isEntityName(node) {\n        var kind = node.kind;\n        return kind === 141\n            || kind === 70;\n    }\n    ts.isEntityName = isEntityName;\n    function isPropertyName(node) {\n        var kind = node.kind;\n        return kind === 70\n            || kind === 9\n            || kind === 8\n            || kind === 142;\n    }\n    ts.isPropertyName = isPropertyName;\n    function isModuleName(node) {\n        var kind = node.kind;\n        return kind === 70\n            || kind === 9;\n    }\n    ts.isModuleName = isModuleName;\n    function isBindingName(node) {\n        var kind = node.kind;\n        return kind === 70\n            || kind === 172\n            || kind === 173;\n    }\n    ts.isBindingName = isBindingName;\n    function isTypeParameter(node) {\n        return node.kind === 143;\n    }\n    ts.isTypeParameter = isTypeParameter;\n    function isParameter(node) {\n        return node.kind === 144;\n    }\n    ts.isParameter = isParameter;\n    function isDecorator(node) {\n        return node.kind === 145;\n    }\n    ts.isDecorator = isDecorator;\n    function isMethodDeclaration(node) {\n        return node.kind === 149;\n    }\n    ts.isMethodDeclaration = isMethodDeclaration;\n    function isClassElement(node) {\n        var kind = node.kind;\n        return kind === 150\n            || kind === 147\n            || kind === 149\n            || kind === 151\n            || kind === 152\n            || kind === 155\n            || kind === 203;\n    }\n    ts.isClassElement = isClassElement;\n    function isObjectLiteralElementLike(node) {\n        var kind = node.kind;\n        return kind === 257\n            || kind === 258\n            || kind === 259\n            || kind === 149\n            || kind === 151\n            || kind === 152\n            || kind === 244;\n    }\n    ts.isObjectLiteralElementLike = isObjectLiteralElementLike;\n    function isTypeNodeKind(kind) {\n        return (kind >= 156 && kind <= 171)\n            || kind === 118\n            || kind === 132\n            || kind === 121\n            || kind === 134\n            || kind === 135\n            || kind === 104\n            || kind === 129\n            || kind === 199;\n    }\n    function isTypeNode(node) {\n        return isTypeNodeKind(node.kind);\n    }\n    ts.isTypeNode = isTypeNode;\n    function isArrayBindingPattern(node) {\n        return node.kind === 173;\n    }\n    ts.isArrayBindingPattern = isArrayBindingPattern;\n    function isObjectBindingPattern(node) {\n        return node.kind === 172;\n    }\n    ts.isObjectBindingPattern = isObjectBindingPattern;\n    function isBindingPattern(node) {\n        if (node) {\n            var kind = node.kind;\n            return kind === 173\n                || kind === 172;\n        }\n        return false;\n    }\n    ts.isBindingPattern = isBindingPattern;\n    function isAssignmentPattern(node) {\n        var kind = node.kind;\n        return kind === 175\n            || kind === 176;\n    }\n    ts.isAssignmentPattern = isAssignmentPattern;\n    function isBindingElement(node) {\n        return node.kind === 174;\n    }\n    ts.isBindingElement = isBindingElement;\n    function isArrayBindingElement(node) {\n        var kind = node.kind;\n        return kind === 174\n            || kind === 198;\n    }\n    ts.isArrayBindingElement = isArrayBindingElement;\n    function isDeclarationBindingElement(bindingElement) {\n        switch (bindingElement.kind) {\n            case 223:\n            case 144:\n            case 174:\n                return true;\n        }\n        return false;\n    }\n    ts.isDeclarationBindingElement = isDeclarationBindingElement;\n    function isBindingOrAssignmentPattern(node) {\n        return isObjectBindingOrAssignmentPattern(node)\n            || isArrayBindingOrAssignmentPattern(node);\n    }\n    ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern;\n    function isObjectBindingOrAssignmentPattern(node) {\n        switch (node.kind) {\n            case 172:\n            case 176:\n                return true;\n        }\n        return false;\n    }\n    ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern;\n    function isArrayBindingOrAssignmentPattern(node) {\n        switch (node.kind) {\n            case 173:\n            case 175:\n                return true;\n        }\n        return false;\n    }\n    ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern;\n    function isArrayLiteralExpression(node) {\n        return node.kind === 175;\n    }\n    ts.isArrayLiteralExpression = isArrayLiteralExpression;\n    function isObjectLiteralExpression(node) {\n        return node.kind === 176;\n    }\n    ts.isObjectLiteralExpression = isObjectLiteralExpression;\n    function isPropertyAccessExpression(node) {\n        return node.kind === 177;\n    }\n    ts.isPropertyAccessExpression = isPropertyAccessExpression;\n    function isElementAccessExpression(node) {\n        return node.kind === 178;\n    }\n    ts.isElementAccessExpression = isElementAccessExpression;\n    function isBinaryExpression(node) {\n        return node.kind === 192;\n    }\n    ts.isBinaryExpression = isBinaryExpression;\n    function isConditionalExpression(node) {\n        return node.kind === 193;\n    }\n    ts.isConditionalExpression = isConditionalExpression;\n    function isCallExpression(node) {\n        return node.kind === 179;\n    }\n    ts.isCallExpression = isCallExpression;\n    function isTemplateLiteral(node) {\n        var kind = node.kind;\n        return kind === 194\n            || kind === 12;\n    }\n    ts.isTemplateLiteral = isTemplateLiteral;\n    function isSpreadExpression(node) {\n        return node.kind === 196;\n    }\n    ts.isSpreadExpression = isSpreadExpression;\n    function isExpressionWithTypeArguments(node) {\n        return node.kind === 199;\n    }\n    ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments;\n    function isLeftHandSideExpressionKind(kind) {\n        return kind === 177\n            || kind === 178\n            || kind === 180\n            || kind === 179\n            || kind === 246\n            || kind === 247\n            || kind === 181\n            || kind === 175\n            || kind === 183\n            || kind === 176\n            || kind === 197\n            || kind === 184\n            || kind === 70\n            || kind === 11\n            || kind === 8\n            || kind === 9\n            || kind === 12\n            || kind === 194\n            || kind === 85\n            || kind === 94\n            || kind === 98\n            || kind === 100\n            || kind === 96\n            || kind === 201\n            || kind === 297;\n    }\n    function isLeftHandSideExpression(node) {\n        return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);\n    }\n    ts.isLeftHandSideExpression = isLeftHandSideExpression;\n    function isUnaryExpressionKind(kind) {\n        return kind === 190\n            || kind === 191\n            || kind === 186\n            || kind === 187\n            || kind === 188\n            || kind === 189\n            || kind === 182\n            || isLeftHandSideExpressionKind(kind);\n    }\n    function isUnaryExpression(node) {\n        return isUnaryExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);\n    }\n    ts.isUnaryExpression = isUnaryExpression;\n    function isExpressionKind(kind) {\n        return kind === 193\n            || kind === 195\n            || kind === 185\n            || kind === 192\n            || kind === 196\n            || kind === 200\n            || kind === 198\n            || kind === 297\n            || isUnaryExpressionKind(kind);\n    }\n    function isExpression(node) {\n        return isExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);\n    }\n    ts.isExpression = isExpression;\n    function isAssertionExpression(node) {\n        var kind = node.kind;\n        return kind === 182\n            || kind === 200;\n    }\n    ts.isAssertionExpression = isAssertionExpression;\n    function isPartiallyEmittedExpression(node) {\n        return node.kind === 294;\n    }\n    ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;\n    function isNotEmittedStatement(node) {\n        return node.kind === 293;\n    }\n    ts.isNotEmittedStatement = isNotEmittedStatement;\n    function isNotEmittedOrPartiallyEmittedNode(node) {\n        return isNotEmittedStatement(node)\n            || isPartiallyEmittedExpression(node);\n    }\n    ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode;\n    function isOmittedExpression(node) {\n        return node.kind === 198;\n    }\n    ts.isOmittedExpression = isOmittedExpression;\n    function isTemplateSpan(node) {\n        return node.kind === 202;\n    }\n    ts.isTemplateSpan = isTemplateSpan;\n    function isBlock(node) {\n        return node.kind === 204;\n    }\n    ts.isBlock = isBlock;\n    function isConciseBody(node) {\n        return isBlock(node)\n            || isExpression(node);\n    }\n    ts.isConciseBody = isConciseBody;\n    function isFunctionBody(node) {\n        return isBlock(node);\n    }\n    ts.isFunctionBody = isFunctionBody;\n    function isForInitializer(node) {\n        return isVariableDeclarationList(node)\n            || isExpression(node);\n    }\n    ts.isForInitializer = isForInitializer;\n    function isVariableDeclaration(node) {\n        return node.kind === 223;\n    }\n    ts.isVariableDeclaration = isVariableDeclaration;\n    function isVariableDeclarationList(node) {\n        return node.kind === 224;\n    }\n    ts.isVariableDeclarationList = isVariableDeclarationList;\n    function isCaseBlock(node) {\n        return node.kind === 232;\n    }\n    ts.isCaseBlock = isCaseBlock;\n    function isModuleBody(node) {\n        var kind = node.kind;\n        return kind === 231\n            || kind === 230;\n    }\n    ts.isModuleBody = isModuleBody;\n    function isImportEqualsDeclaration(node) {\n        return node.kind === 234;\n    }\n    ts.isImportEqualsDeclaration = isImportEqualsDeclaration;\n    function isImportClause(node) {\n        return node.kind === 236;\n    }\n    ts.isImportClause = isImportClause;\n    function isNamedImportBindings(node) {\n        var kind = node.kind;\n        return kind === 238\n            || kind === 237;\n    }\n    ts.isNamedImportBindings = isNamedImportBindings;\n    function isImportSpecifier(node) {\n        return node.kind === 239;\n    }\n    ts.isImportSpecifier = isImportSpecifier;\n    function isNamedExports(node) {\n        return node.kind === 242;\n    }\n    ts.isNamedExports = isNamedExports;\n    function isExportSpecifier(node) {\n        return node.kind === 243;\n    }\n    ts.isExportSpecifier = isExportSpecifier;\n    function isModuleOrEnumDeclaration(node) {\n        return node.kind === 230 || node.kind === 229;\n    }\n    ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration;\n    function isDeclarationKind(kind) {\n        return kind === 185\n            || kind === 174\n            || kind === 226\n            || kind === 197\n            || kind === 150\n            || kind === 229\n            || kind === 260\n            || kind === 243\n            || kind === 225\n            || kind === 184\n            || kind === 151\n            || kind === 236\n            || kind === 234\n            || kind === 239\n            || kind === 227\n            || kind === 149\n            || kind === 148\n            || kind === 230\n            || kind === 233\n            || kind === 237\n            || kind === 144\n            || kind === 257\n            || kind === 147\n            || kind === 146\n            || kind === 152\n            || kind === 258\n            || kind === 228\n            || kind === 143\n            || kind === 223\n            || kind === 285;\n    }\n    function isDeclarationStatementKind(kind) {\n        return kind === 225\n            || kind === 244\n            || kind === 226\n            || kind === 227\n            || kind === 228\n            || kind === 229\n            || kind === 230\n            || kind === 235\n            || kind === 234\n            || kind === 241\n            || kind === 240\n            || kind === 233;\n    }\n    function isStatementKindButNotDeclarationKind(kind) {\n        return kind === 215\n            || kind === 214\n            || kind === 222\n            || kind === 209\n            || kind === 207\n            || kind === 206\n            || kind === 212\n            || kind === 213\n            || kind === 211\n            || kind === 208\n            || kind === 219\n            || kind === 216\n            || kind === 218\n            || kind === 220\n            || kind === 221\n            || kind === 205\n            || kind === 210\n            || kind === 217\n            || kind === 293\n            || kind === 296\n            || kind === 295;\n    }\n    function isDeclaration(node) {\n        return isDeclarationKind(node.kind);\n    }\n    ts.isDeclaration = isDeclaration;\n    function isDeclarationStatement(node) {\n        return isDeclarationStatementKind(node.kind);\n    }\n    ts.isDeclarationStatement = isDeclarationStatement;\n    function isStatementButNotDeclaration(node) {\n        return isStatementKindButNotDeclarationKind(node.kind);\n    }\n    ts.isStatementButNotDeclaration = isStatementButNotDeclaration;\n    function isStatement(node) {\n        var kind = node.kind;\n        return isStatementKindButNotDeclarationKind(kind)\n            || isDeclarationStatementKind(kind)\n            || kind === 204;\n    }\n    ts.isStatement = isStatement;\n    function isModuleReference(node) {\n        var kind = node.kind;\n        return kind === 245\n            || kind === 141\n            || kind === 70;\n    }\n    ts.isModuleReference = isModuleReference;\n    function isJsxOpeningElement(node) {\n        return node.kind === 248;\n    }\n    ts.isJsxOpeningElement = isJsxOpeningElement;\n    function isJsxClosingElement(node) {\n        return node.kind === 249;\n    }\n    ts.isJsxClosingElement = isJsxClosingElement;\n    function isJsxTagNameExpression(node) {\n        var kind = node.kind;\n        return kind === 98\n            || kind === 70\n            || kind === 177;\n    }\n    ts.isJsxTagNameExpression = isJsxTagNameExpression;\n    function isJsxChild(node) {\n        var kind = node.kind;\n        return kind === 246\n            || kind === 252\n            || kind === 247\n            || kind === 10;\n    }\n    ts.isJsxChild = isJsxChild;\n    function isJsxAttributeLike(node) {\n        var kind = node.kind;\n        return kind === 250\n            || kind === 251;\n    }\n    ts.isJsxAttributeLike = isJsxAttributeLike;\n    function isJsxSpreadAttribute(node) {\n        return node.kind === 251;\n    }\n    ts.isJsxSpreadAttribute = isJsxSpreadAttribute;\n    function isJsxAttribute(node) {\n        return node.kind === 250;\n    }\n    ts.isJsxAttribute = isJsxAttribute;\n    function isStringLiteralOrJsxExpression(node) {\n        var kind = node.kind;\n        return kind === 9\n            || kind === 252;\n    }\n    ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression;\n    function isCaseOrDefaultClause(node) {\n        var kind = node.kind;\n        return kind === 253\n            || kind === 254;\n    }\n    ts.isCaseOrDefaultClause = isCaseOrDefaultClause;\n    function isHeritageClause(node) {\n        return node.kind === 255;\n    }\n    ts.isHeritageClause = isHeritageClause;\n    function isCatchClause(node) {\n        return node.kind === 256;\n    }\n    ts.isCatchClause = isCatchClause;\n    function isPropertyAssignment(node) {\n        return node.kind === 257;\n    }\n    ts.isPropertyAssignment = isPropertyAssignment;\n    function isShorthandPropertyAssignment(node) {\n        return node.kind === 258;\n    }\n    ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment;\n    function isEnumMember(node) {\n        return node.kind === 260;\n    }\n    ts.isEnumMember = isEnumMember;\n    function isSourceFile(node) {\n        return node.kind === 261;\n    }\n    ts.isSourceFile = isSourceFile;\n    function isWatchSet(options) {\n        return options.watch && options.hasOwnProperty(\"watch\");\n    }\n    ts.isWatchSet = isWatchSet;\n})(ts || (ts = {}));\n(function (ts) {\n    function getDefaultLibFileName(options) {\n        switch (options.target) {\n            case 5:\n            case 4:\n                return \"lib.es2017.d.ts\";\n            case 3:\n                return \"lib.es2016.d.ts\";\n            case 2:\n                return \"lib.es6.d.ts\";\n            default:\n                return \"lib.d.ts\";\n        }\n    }\n    ts.getDefaultLibFileName = getDefaultLibFileName;\n    function textSpanEnd(span) {\n        return span.start + span.length;\n    }\n    ts.textSpanEnd = textSpanEnd;\n    function textSpanIsEmpty(span) {\n        return span.length === 0;\n    }\n    ts.textSpanIsEmpty = textSpanIsEmpty;\n    function textSpanContainsPosition(span, position) {\n        return position >= span.start && position < textSpanEnd(span);\n    }\n    ts.textSpanContainsPosition = textSpanContainsPosition;\n    function textSpanContainsTextSpan(span, other) {\n        return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span);\n    }\n    ts.textSpanContainsTextSpan = textSpanContainsTextSpan;\n    function textSpanOverlapsWith(span, other) {\n        var overlapStart = Math.max(span.start, other.start);\n        var overlapEnd = Math.min(textSpanEnd(span), textSpanEnd(other));\n        return overlapStart < overlapEnd;\n    }\n    ts.textSpanOverlapsWith = textSpanOverlapsWith;\n    function textSpanOverlap(span1, span2) {\n        var overlapStart = Math.max(span1.start, span2.start);\n        var overlapEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2));\n        if (overlapStart < overlapEnd) {\n            return createTextSpanFromBounds(overlapStart, overlapEnd);\n        }\n        return undefined;\n    }\n    ts.textSpanOverlap = textSpanOverlap;\n    function textSpanIntersectsWithTextSpan(span, other) {\n        return other.start <= textSpanEnd(span) && textSpanEnd(other) >= span.start;\n    }\n    ts.textSpanIntersectsWithTextSpan = textSpanIntersectsWithTextSpan;\n    function textSpanIntersectsWith(span, start, length) {\n        var end = start + length;\n        return start <= textSpanEnd(span) && end >= span.start;\n    }\n    ts.textSpanIntersectsWith = textSpanIntersectsWith;\n    function decodedTextSpanIntersectsWith(start1, length1, start2, length2) {\n        var end1 = start1 + length1;\n        var end2 = start2 + length2;\n        return start2 <= end1 && end2 >= start1;\n    }\n    ts.decodedTextSpanIntersectsWith = decodedTextSpanIntersectsWith;\n    function textSpanIntersectsWithPosition(span, position) {\n        return position <= textSpanEnd(span) && position >= span.start;\n    }\n    ts.textSpanIntersectsWithPosition = textSpanIntersectsWithPosition;\n    function textSpanIntersection(span1, span2) {\n        var intersectStart = Math.max(span1.start, span2.start);\n        var intersectEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2));\n        if (intersectStart <= intersectEnd) {\n            return createTextSpanFromBounds(intersectStart, intersectEnd);\n        }\n        return undefined;\n    }\n    ts.textSpanIntersection = textSpanIntersection;\n    function createTextSpan(start, length) {\n        if (start < 0) {\n            throw new Error(\"start < 0\");\n        }\n        if (length < 0) {\n            throw new Error(\"length < 0\");\n        }\n        return { start: start, length: length };\n    }\n    ts.createTextSpan = createTextSpan;\n    function createTextSpanFromBounds(start, end) {\n        return createTextSpan(start, end - start);\n    }\n    ts.createTextSpanFromBounds = createTextSpanFromBounds;\n    function textChangeRangeNewSpan(range) {\n        return createTextSpan(range.span.start, range.newLength);\n    }\n    ts.textChangeRangeNewSpan = textChangeRangeNewSpan;\n    function textChangeRangeIsUnchanged(range) {\n        return textSpanIsEmpty(range.span) && range.newLength === 0;\n    }\n    ts.textChangeRangeIsUnchanged = textChangeRangeIsUnchanged;\n    function createTextChangeRange(span, newLength) {\n        if (newLength < 0) {\n            throw new Error(\"newLength < 0\");\n        }\n        return { span: span, newLength: newLength };\n    }\n    ts.createTextChangeRange = createTextChangeRange;\n    ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0);\n    function collapseTextChangeRangesAcrossMultipleVersions(changes) {\n        if (changes.length === 0) {\n            return ts.unchangedTextChangeRange;\n        }\n        if (changes.length === 1) {\n            return changes[0];\n        }\n        var change0 = changes[0];\n        var oldStartN = change0.span.start;\n        var oldEndN = textSpanEnd(change0.span);\n        var newEndN = oldStartN + change0.newLength;\n        for (var i = 1; i < changes.length; i++) {\n            var nextChange = changes[i];\n            var oldStart1 = oldStartN;\n            var oldEnd1 = oldEndN;\n            var newEnd1 = newEndN;\n            var oldStart2 = nextChange.span.start;\n            var oldEnd2 = textSpanEnd(nextChange.span);\n            var newEnd2 = oldStart2 + nextChange.newLength;\n            oldStartN = Math.min(oldStart1, oldStart2);\n            oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1));\n            newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2));\n        }\n        return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), newEndN - oldStartN);\n    }\n    ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions;\n    function getTypeParameterOwner(d) {\n        if (d && d.kind === 143) {\n            for (var current = d; current; current = current.parent) {\n                if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 227) {\n                    return current;\n                }\n            }\n        }\n    }\n    ts.getTypeParameterOwner = getTypeParameterOwner;\n    function isParameterPropertyDeclaration(node) {\n        return ts.hasModifier(node, 92) && node.parent.kind === 150 && ts.isClassLike(node.parent.parent);\n    }\n    ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;\n    function walkUpBindingElementsAndPatterns(node) {\n        while (node && (node.kind === 174 || ts.isBindingPattern(node))) {\n            node = node.parent;\n        }\n        return node;\n    }\n    function getCombinedModifierFlags(node) {\n        node = walkUpBindingElementsAndPatterns(node);\n        var flags = ts.getModifierFlags(node);\n        if (node.kind === 223) {\n            node = node.parent;\n        }\n        if (node && node.kind === 224) {\n            flags |= ts.getModifierFlags(node);\n            node = node.parent;\n        }\n        if (node && node.kind === 205) {\n            flags |= ts.getModifierFlags(node);\n        }\n        return flags;\n    }\n    ts.getCombinedModifierFlags = getCombinedModifierFlags;\n    function getCombinedNodeFlags(node) {\n        node = walkUpBindingElementsAndPatterns(node);\n        var flags = node.flags;\n        if (node.kind === 223) {\n            node = node.parent;\n        }\n        if (node && node.kind === 224) {\n            flags |= node.flags;\n            node = node.parent;\n        }\n        if (node && node.kind === 205) {\n            flags |= node.flags;\n        }\n        return flags;\n    }\n    ts.getCombinedNodeFlags = getCombinedNodeFlags;\n    function validateLocaleAndSetLanguage(locale, sys, errors) {\n        var matchResult = /^([a-z]+)([_\\-]([a-z]+))?$/.exec(locale.toLowerCase());\n        if (!matchResult) {\n            if (errors) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, \"en\", \"ja-jp\"));\n            }\n            return;\n        }\n        var language = matchResult[1];\n        var territory = matchResult[3];\n        if (!trySetLanguageAndTerritory(language, territory, errors)) {\n            trySetLanguageAndTerritory(language, undefined, errors);\n        }\n        function trySetLanguageAndTerritory(language, territory, errors) {\n            var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath());\n            var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath);\n            var filePath = ts.combinePaths(containingDirectoryPath, language);\n            if (territory) {\n                filePath = filePath + \"-\" + territory;\n            }\n            filePath = sys.resolvePath(ts.combinePaths(filePath, \"diagnosticMessages.generated.json\"));\n            if (!sys.fileExists(filePath)) {\n                return false;\n            }\n            var fileContents = \"\";\n            try {\n                fileContents = sys.readFile(filePath);\n            }\n            catch (e) {\n                if (errors) {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath));\n                }\n                return false;\n            }\n            try {\n                ts.localizedDiagnosticMessages = JSON.parse(fileContents);\n            }\n            catch (e) {\n                if (errors) {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath));\n                }\n                return false;\n            }\n            return true;\n        }\n    }\n    ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var NodeConstructor;\n    var SourceFileConstructor;\n    function createNode(kind, location, flags) {\n        var ConstructorForKind = kind === 261\n            ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))\n            : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()));\n        var node = location\n            ? new ConstructorForKind(kind, location.pos, location.end)\n            : new ConstructorForKind(kind, -1, -1);\n        node.flags = flags | 8;\n        return node;\n    }\n    function updateNode(updated, original) {\n        if (updated !== original) {\n            setOriginalNode(updated, original);\n            if (original.startsOnNewLine) {\n                updated.startsOnNewLine = true;\n            }\n            ts.aggregateTransformFlags(updated);\n        }\n        return updated;\n    }\n    ts.updateNode = updateNode;\n    function createNodeArray(elements, location, hasTrailingComma) {\n        if (elements) {\n            if (ts.isNodeArray(elements)) {\n                return elements;\n            }\n        }\n        else {\n            elements = [];\n        }\n        var array = elements;\n        if (location) {\n            array.pos = location.pos;\n            array.end = location.end;\n        }\n        else {\n            array.pos = -1;\n            array.end = -1;\n        }\n        if (hasTrailingComma) {\n            array.hasTrailingComma = true;\n        }\n        return array;\n    }\n    ts.createNodeArray = createNodeArray;\n    function createSynthesizedNode(kind, startsOnNewLine) {\n        var node = createNode(kind, undefined);\n        node.startsOnNewLine = startsOnNewLine;\n        return node;\n    }\n    ts.createSynthesizedNode = createSynthesizedNode;\n    function createSynthesizedNodeArray(elements) {\n        return createNodeArray(elements, undefined);\n    }\n    ts.createSynthesizedNodeArray = createSynthesizedNodeArray;\n    function getSynthesizedClone(node) {\n        var clone = createNode(node.kind, undefined, node.flags);\n        setOriginalNode(clone, node);\n        for (var key in node) {\n            if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) {\n                continue;\n            }\n            clone[key] = node[key];\n        }\n        return clone;\n    }\n    ts.getSynthesizedClone = getSynthesizedClone;\n    function getMutableClone(node) {\n        var clone = getSynthesizedClone(node);\n        clone.pos = node.pos;\n        clone.end = node.end;\n        clone.parent = node.parent;\n        return clone;\n    }\n    ts.getMutableClone = getMutableClone;\n    function createLiteral(value, location) {\n        if (typeof value === \"number\") {\n            var node = createNode(8, location, undefined);\n            node.text = value.toString();\n            return node;\n        }\n        else if (typeof value === \"boolean\") {\n            return createNode(value ? 100 : 85, location, undefined);\n        }\n        else if (typeof value === \"string\") {\n            var node = createNode(9, location, undefined);\n            node.text = value;\n            return node;\n        }\n        else if (value) {\n            var node = createNode(9, location, undefined);\n            node.textSourceNode = value;\n            node.text = value.text;\n            return node;\n        }\n    }\n    ts.createLiteral = createLiteral;\n    var nextAutoGenerateId = 0;\n    function createIdentifier(text, location) {\n        var node = createNode(70, location);\n        node.text = ts.escapeIdentifier(text);\n        node.originalKeywordKind = ts.stringToToken(text);\n        node.autoGenerateKind = 0;\n        node.autoGenerateId = 0;\n        return node;\n    }\n    ts.createIdentifier = createIdentifier;\n    function createTempVariable(recordTempVariable, location) {\n        var name = createNode(70, location);\n        name.text = \"\";\n        name.originalKeywordKind = 0;\n        name.autoGenerateKind = 1;\n        name.autoGenerateId = nextAutoGenerateId;\n        nextAutoGenerateId++;\n        if (recordTempVariable) {\n            recordTempVariable(name);\n        }\n        return name;\n    }\n    ts.createTempVariable = createTempVariable;\n    function createLoopVariable(location) {\n        var name = createNode(70, location);\n        name.text = \"\";\n        name.originalKeywordKind = 0;\n        name.autoGenerateKind = 2;\n        name.autoGenerateId = nextAutoGenerateId;\n        nextAutoGenerateId++;\n        return name;\n    }\n    ts.createLoopVariable = createLoopVariable;\n    function createUniqueName(text, location) {\n        var name = createNode(70, location);\n        name.text = text;\n        name.originalKeywordKind = 0;\n        name.autoGenerateKind = 3;\n        name.autoGenerateId = nextAutoGenerateId;\n        nextAutoGenerateId++;\n        return name;\n    }\n    ts.createUniqueName = createUniqueName;\n    function getGeneratedNameForNode(node, location) {\n        var name = createNode(70, location);\n        name.original = node;\n        name.text = \"\";\n        name.originalKeywordKind = 0;\n        name.autoGenerateKind = 4;\n        name.autoGenerateId = nextAutoGenerateId;\n        nextAutoGenerateId++;\n        return name;\n    }\n    ts.getGeneratedNameForNode = getGeneratedNameForNode;\n    function createToken(token) {\n        return createNode(token);\n    }\n    ts.createToken = createToken;\n    function createSuper() {\n        var node = createNode(96);\n        return node;\n    }\n    ts.createSuper = createSuper;\n    function createThis(location) {\n        var node = createNode(98, location);\n        return node;\n    }\n    ts.createThis = createThis;\n    function createNull() {\n        var node = createNode(94);\n        return node;\n    }\n    ts.createNull = createNull;\n    function createComputedPropertyName(expression, location) {\n        var node = createNode(142, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createComputedPropertyName = createComputedPropertyName;\n    function updateComputedPropertyName(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createComputedPropertyName(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateComputedPropertyName = updateComputedPropertyName;\n    function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) {\n        var node = createNode(144, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.dotDotDotToken = dotDotDotToken;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.questionToken = questionToken;\n        node.type = type;\n        node.initializer = initializer ? parenthesizeExpressionForList(initializer) : undefined;\n        return node;\n    }\n    ts.createParameter = createParameter;\n    function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) {\n            return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateParameter = updateParameter;\n    function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) {\n        var node = createNode(147, location);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.questionToken = questionToken;\n        node.type = type;\n        node.initializer = initializer;\n        return node;\n    }\n    ts.createProperty = createProperty;\n    function updateProperty(node, decorators, modifiers, name, type, initializer) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) {\n            return updateNode(createProperty(decorators, modifiers, name, node.questionToken, type, initializer, node), node);\n        }\n        return node;\n    }\n    ts.updateProperty = updateProperty;\n    function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {\n        var node = createNode(149, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.asteriskToken = asteriskToken;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = type;\n        node.body = body;\n        return node;\n    }\n    ts.createMethod = createMethod;\n    function updateMethod(node, decorators, modifiers, name, typeParameters, parameters, type, body) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {\n            return updateNode(createMethod(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateMethod = updateMethod;\n    function createConstructor(decorators, modifiers, parameters, body, location, flags) {\n        var node = createNode(150, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.typeParameters = undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = undefined;\n        node.body = body;\n        return node;\n    }\n    ts.createConstructor = createConstructor;\n    function updateConstructor(node, decorators, modifiers, parameters, body) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.parameters !== parameters || node.body !== body) {\n            return updateNode(createConstructor(decorators, modifiers, parameters, body, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateConstructor = updateConstructor;\n    function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) {\n        var node = createNode(151, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.typeParameters = undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = type;\n        node.body = body;\n        return node;\n    }\n    ts.createGetAccessor = createGetAccessor;\n    function updateGetAccessor(node, decorators, modifiers, name, parameters, type, body) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.type !== type || node.body !== body) {\n            return updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateGetAccessor = updateGetAccessor;\n    function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) {\n        var node = createNode(152, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.typeParameters = undefined;\n        node.parameters = createNodeArray(parameters);\n        node.body = body;\n        return node;\n    }\n    ts.createSetAccessor = createSetAccessor;\n    function updateSetAccessor(node, decorators, modifiers, name, parameters, body) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.body !== body) {\n            return updateNode(createSetAccessor(decorators, modifiers, name, parameters, body, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateSetAccessor = updateSetAccessor;\n    function createObjectBindingPattern(elements, location) {\n        var node = createNode(172, location);\n        node.elements = createNodeArray(elements);\n        return node;\n    }\n    ts.createObjectBindingPattern = createObjectBindingPattern;\n    function updateObjectBindingPattern(node, elements) {\n        if (node.elements !== elements) {\n            return updateNode(createObjectBindingPattern(elements, node), node);\n        }\n        return node;\n    }\n    ts.updateObjectBindingPattern = updateObjectBindingPattern;\n    function createArrayBindingPattern(elements, location) {\n        var node = createNode(173, location);\n        node.elements = createNodeArray(elements);\n        return node;\n    }\n    ts.createArrayBindingPattern = createArrayBindingPattern;\n    function updateArrayBindingPattern(node, elements) {\n        if (node.elements !== elements) {\n            return updateNode(createArrayBindingPattern(elements, node), node);\n        }\n        return node;\n    }\n    ts.updateArrayBindingPattern = updateArrayBindingPattern;\n    function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) {\n        var node = createNode(174, location);\n        node.propertyName = typeof propertyName === \"string\" ? createIdentifier(propertyName) : propertyName;\n        node.dotDotDotToken = dotDotDotToken;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.initializer = initializer;\n        return node;\n    }\n    ts.createBindingElement = createBindingElement;\n    function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) {\n        if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) {\n            return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node);\n        }\n        return node;\n    }\n    ts.updateBindingElement = updateBindingElement;\n    function createArrayLiteral(elements, location, multiLine) {\n        var node = createNode(175, location);\n        node.elements = parenthesizeListElements(createNodeArray(elements));\n        if (multiLine) {\n            node.multiLine = true;\n        }\n        return node;\n    }\n    ts.createArrayLiteral = createArrayLiteral;\n    function updateArrayLiteral(node, elements) {\n        if (node.elements !== elements) {\n            return updateNode(createArrayLiteral(elements, node, node.multiLine), node);\n        }\n        return node;\n    }\n    ts.updateArrayLiteral = updateArrayLiteral;\n    function createObjectLiteral(properties, location, multiLine) {\n        var node = createNode(176, location);\n        node.properties = createNodeArray(properties);\n        if (multiLine) {\n            node.multiLine = true;\n        }\n        return node;\n    }\n    ts.createObjectLiteral = createObjectLiteral;\n    function updateObjectLiteral(node, properties) {\n        if (node.properties !== properties) {\n            return updateNode(createObjectLiteral(properties, node, node.multiLine), node);\n        }\n        return node;\n    }\n    ts.updateObjectLiteral = updateObjectLiteral;\n    function createPropertyAccess(expression, name, location, flags) {\n        var node = createNode(177, location, flags);\n        node.expression = parenthesizeForAccess(expression);\n        (node.emitNode || (node.emitNode = {})).flags |= 65536;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        return node;\n    }\n    ts.createPropertyAccess = createPropertyAccess;\n    function updatePropertyAccess(node, expression, name) {\n        if (node.expression !== expression || node.name !== name) {\n            var propertyAccess = createPropertyAccess(expression, name, node, node.flags);\n            (propertyAccess.emitNode || (propertyAccess.emitNode = {})).flags = getEmitFlags(node);\n            return updateNode(propertyAccess, node);\n        }\n        return node;\n    }\n    ts.updatePropertyAccess = updatePropertyAccess;\n    function createElementAccess(expression, index, location) {\n        var node = createNode(178, location);\n        node.expression = parenthesizeForAccess(expression);\n        node.argumentExpression = typeof index === \"number\" ? createLiteral(index) : index;\n        return node;\n    }\n    ts.createElementAccess = createElementAccess;\n    function updateElementAccess(node, expression, argumentExpression) {\n        if (node.expression !== expression || node.argumentExpression !== argumentExpression) {\n            return updateNode(createElementAccess(expression, argumentExpression, node), node);\n        }\n        return node;\n    }\n    ts.updateElementAccess = updateElementAccess;\n    function createCall(expression, typeArguments, argumentsArray, location, flags) {\n        var node = createNode(179, location, flags);\n        node.expression = parenthesizeForAccess(expression);\n        if (typeArguments) {\n            node.typeArguments = createNodeArray(typeArguments);\n        }\n        node.arguments = parenthesizeListElements(createNodeArray(argumentsArray));\n        return node;\n    }\n    ts.createCall = createCall;\n    function updateCall(node, expression, typeArguments, argumentsArray) {\n        if (expression !== node.expression || typeArguments !== node.typeArguments || argumentsArray !== node.arguments) {\n            return updateNode(createCall(expression, typeArguments, argumentsArray, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateCall = updateCall;\n    function createNew(expression, typeArguments, argumentsArray, location, flags) {\n        var node = createNode(180, location, flags);\n        node.expression = parenthesizeForNew(expression);\n        node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined;\n        node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined;\n        return node;\n    }\n    ts.createNew = createNew;\n    function updateNew(node, expression, typeArguments, argumentsArray) {\n        if (node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray) {\n            return updateNode(createNew(expression, typeArguments, argumentsArray, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateNew = updateNew;\n    function createTaggedTemplate(tag, template, location) {\n        var node = createNode(181, location);\n        node.tag = parenthesizeForAccess(tag);\n        node.template = template;\n        return node;\n    }\n    ts.createTaggedTemplate = createTaggedTemplate;\n    function updateTaggedTemplate(node, tag, template) {\n        if (node.tag !== tag || node.template !== template) {\n            return updateNode(createTaggedTemplate(tag, template, node), node);\n        }\n        return node;\n    }\n    ts.updateTaggedTemplate = updateTaggedTemplate;\n    function createParen(expression, location) {\n        var node = createNode(183, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createParen = createParen;\n    function updateParen(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createParen(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateParen = updateParen;\n    function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {\n        var node = createNode(184, location, flags);\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.asteriskToken = asteriskToken;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = type;\n        node.body = body;\n        return node;\n    }\n    ts.createFunctionExpression = createFunctionExpression;\n    function updateFunctionExpression(node, modifiers, name, typeParameters, parameters, type, body) {\n        if (node.name !== name || node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {\n            return updateNode(createFunctionExpression(modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateFunctionExpression = updateFunctionExpression;\n    function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) {\n        var node = createNode(185, location, flags);\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = type;\n        node.equalsGreaterThanToken = equalsGreaterThanToken || createToken(35);\n        node.body = parenthesizeConciseBody(body);\n        return node;\n    }\n    ts.createArrowFunction = createArrowFunction;\n    function updateArrowFunction(node, modifiers, typeParameters, parameters, type, body) {\n        if (node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {\n            return updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, body, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateArrowFunction = updateArrowFunction;\n    function createDelete(expression, location) {\n        var node = createNode(186, location);\n        node.expression = parenthesizePrefixOperand(expression);\n        return node;\n    }\n    ts.createDelete = createDelete;\n    function updateDelete(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createDelete(expression, node), expression);\n        }\n        return node;\n    }\n    ts.updateDelete = updateDelete;\n    function createTypeOf(expression, location) {\n        var node = createNode(187, location);\n        node.expression = parenthesizePrefixOperand(expression);\n        return node;\n    }\n    ts.createTypeOf = createTypeOf;\n    function updateTypeOf(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createTypeOf(expression, node), expression);\n        }\n        return node;\n    }\n    ts.updateTypeOf = updateTypeOf;\n    function createVoid(expression, location) {\n        var node = createNode(188, location);\n        node.expression = parenthesizePrefixOperand(expression);\n        return node;\n    }\n    ts.createVoid = createVoid;\n    function updateVoid(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createVoid(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateVoid = updateVoid;\n    function createAwait(expression, location) {\n        var node = createNode(189, location);\n        node.expression = parenthesizePrefixOperand(expression);\n        return node;\n    }\n    ts.createAwait = createAwait;\n    function updateAwait(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createAwait(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateAwait = updateAwait;\n    function createPrefix(operator, operand, location) {\n        var node = createNode(190, location);\n        node.operator = operator;\n        node.operand = parenthesizePrefixOperand(operand);\n        return node;\n    }\n    ts.createPrefix = createPrefix;\n    function updatePrefix(node, operand) {\n        if (node.operand !== operand) {\n            return updateNode(createPrefix(node.operator, operand, node), node);\n        }\n        return node;\n    }\n    ts.updatePrefix = updatePrefix;\n    function createPostfix(operand, operator, location) {\n        var node = createNode(191, location);\n        node.operand = parenthesizePostfixOperand(operand);\n        node.operator = operator;\n        return node;\n    }\n    ts.createPostfix = createPostfix;\n    function updatePostfix(node, operand) {\n        if (node.operand !== operand) {\n            return updateNode(createPostfix(operand, node.operator, node), node);\n        }\n        return node;\n    }\n    ts.updatePostfix = updatePostfix;\n    function createBinary(left, operator, right, location) {\n        var operatorToken = typeof operator === \"number\" ? createToken(operator) : operator;\n        var operatorKind = operatorToken.kind;\n        var node = createNode(192, location);\n        node.left = parenthesizeBinaryOperand(operatorKind, left, true, undefined);\n        node.operatorToken = operatorToken;\n        node.right = parenthesizeBinaryOperand(operatorKind, right, false, node.left);\n        return node;\n    }\n    ts.createBinary = createBinary;\n    function updateBinary(node, left, right) {\n        if (node.left !== left || node.right !== right) {\n            return updateNode(createBinary(left, node.operatorToken, right, node), node);\n        }\n        return node;\n    }\n    ts.updateBinary = updateBinary;\n    function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) {\n        var node = createNode(193, whenFalse ? location : colonTokenOrLocation);\n        node.condition = parenthesizeForConditionalHead(condition);\n        if (whenFalse) {\n            node.questionToken = questionTokenOrWhenTrue;\n            node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse);\n            node.colonToken = colonTokenOrLocation;\n            node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse);\n        }\n        else {\n            node.questionToken = createToken(54);\n            node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue);\n            node.colonToken = createToken(55);\n            node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse);\n        }\n        return node;\n    }\n    ts.createConditional = createConditional;\n    function updateConditional(node, condition, whenTrue, whenFalse) {\n        if (node.condition !== condition || node.whenTrue !== whenTrue || node.whenFalse !== whenFalse) {\n            return updateNode(createConditional(condition, node.questionToken, whenTrue, node.colonToken, whenFalse, node), node);\n        }\n        return node;\n    }\n    ts.updateConditional = updateConditional;\n    function createTemplateExpression(head, templateSpans, location) {\n        var node = createNode(194, location);\n        node.head = head;\n        node.templateSpans = createNodeArray(templateSpans);\n        return node;\n    }\n    ts.createTemplateExpression = createTemplateExpression;\n    function updateTemplateExpression(node, head, templateSpans) {\n        if (node.head !== head || node.templateSpans !== templateSpans) {\n            return updateNode(createTemplateExpression(head, templateSpans, node), node);\n        }\n        return node;\n    }\n    ts.updateTemplateExpression = updateTemplateExpression;\n    function createYield(asteriskToken, expression, location) {\n        var node = createNode(195, location);\n        node.asteriskToken = asteriskToken;\n        node.expression = expression;\n        return node;\n    }\n    ts.createYield = createYield;\n    function updateYield(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createYield(node.asteriskToken, expression, node), node);\n        }\n        return node;\n    }\n    ts.updateYield = updateYield;\n    function createSpread(expression, location) {\n        var node = createNode(196, location);\n        node.expression = parenthesizeExpressionForList(expression);\n        return node;\n    }\n    ts.createSpread = createSpread;\n    function updateSpread(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createSpread(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateSpread = updateSpread;\n    function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) {\n        var node = createNode(197, location);\n        node.decorators = undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.name = name;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.heritageClauses = createNodeArray(heritageClauses);\n        node.members = createNodeArray(members);\n        return node;\n    }\n    ts.createClassExpression = createClassExpression;\n    function updateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members) {\n        if (node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) {\n            return updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members, node), node);\n        }\n        return node;\n    }\n    ts.updateClassExpression = updateClassExpression;\n    function createOmittedExpression(location) {\n        var node = createNode(198, location);\n        return node;\n    }\n    ts.createOmittedExpression = createOmittedExpression;\n    function createExpressionWithTypeArguments(typeArguments, expression, location) {\n        var node = createNode(199, location);\n        node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined;\n        node.expression = parenthesizeForAccess(expression);\n        return node;\n    }\n    ts.createExpressionWithTypeArguments = createExpressionWithTypeArguments;\n    function updateExpressionWithTypeArguments(node, typeArguments, expression) {\n        if (node.typeArguments !== typeArguments || node.expression !== expression) {\n            return updateNode(createExpressionWithTypeArguments(typeArguments, expression, node), node);\n        }\n        return node;\n    }\n    ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments;\n    function createTemplateSpan(expression, literal, location) {\n        var node = createNode(202, location);\n        node.expression = expression;\n        node.literal = literal;\n        return node;\n    }\n    ts.createTemplateSpan = createTemplateSpan;\n    function updateTemplateSpan(node, expression, literal) {\n        if (node.expression !== expression || node.literal !== literal) {\n            return updateNode(createTemplateSpan(expression, literal, node), node);\n        }\n        return node;\n    }\n    ts.updateTemplateSpan = updateTemplateSpan;\n    function createBlock(statements, location, multiLine, flags) {\n        var block = createNode(204, location, flags);\n        block.statements = createNodeArray(statements);\n        if (multiLine) {\n            block.multiLine = true;\n        }\n        return block;\n    }\n    ts.createBlock = createBlock;\n    function updateBlock(node, statements) {\n        if (statements !== node.statements) {\n            return updateNode(createBlock(statements, node, node.multiLine, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateBlock = updateBlock;\n    function createVariableStatement(modifiers, declarationList, location, flags) {\n        var node = createNode(205, location, flags);\n        node.decorators = undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList;\n        return node;\n    }\n    ts.createVariableStatement = createVariableStatement;\n    function updateVariableStatement(node, modifiers, declarationList) {\n        if (node.modifiers !== modifiers || node.declarationList !== declarationList) {\n            return updateNode(createVariableStatement(modifiers, declarationList, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateVariableStatement = updateVariableStatement;\n    function createVariableDeclarationList(declarations, location, flags) {\n        var node = createNode(224, location, flags);\n        node.declarations = createNodeArray(declarations);\n        return node;\n    }\n    ts.createVariableDeclarationList = createVariableDeclarationList;\n    function updateVariableDeclarationList(node, declarations) {\n        if (node.declarations !== declarations) {\n            return updateNode(createVariableDeclarationList(declarations, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateVariableDeclarationList = updateVariableDeclarationList;\n    function createVariableDeclaration(name, type, initializer, location, flags) {\n        var node = createNode(223, location, flags);\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.type = type;\n        node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined;\n        return node;\n    }\n    ts.createVariableDeclaration = createVariableDeclaration;\n    function updateVariableDeclaration(node, name, type, initializer) {\n        if (node.name !== name || node.type !== type || node.initializer !== initializer) {\n            return updateNode(createVariableDeclaration(name, type, initializer, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateVariableDeclaration = updateVariableDeclaration;\n    function createEmptyStatement(location) {\n        return createNode(206, location);\n    }\n    ts.createEmptyStatement = createEmptyStatement;\n    function createStatement(expression, location, flags) {\n        var node = createNode(207, location, flags);\n        node.expression = parenthesizeExpressionForExpressionStatement(expression);\n        return node;\n    }\n    ts.createStatement = createStatement;\n    function updateStatement(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createStatement(expression, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateStatement = updateStatement;\n    function createIf(expression, thenStatement, elseStatement, location) {\n        var node = createNode(208, location);\n        node.expression = expression;\n        node.thenStatement = thenStatement;\n        node.elseStatement = elseStatement;\n        return node;\n    }\n    ts.createIf = createIf;\n    function updateIf(node, expression, thenStatement, elseStatement) {\n        if (node.expression !== expression || node.thenStatement !== thenStatement || node.elseStatement !== elseStatement) {\n            return updateNode(createIf(expression, thenStatement, elseStatement, node), node);\n        }\n        return node;\n    }\n    ts.updateIf = updateIf;\n    function createDo(statement, expression, location) {\n        var node = createNode(209, location);\n        node.statement = statement;\n        node.expression = expression;\n        return node;\n    }\n    ts.createDo = createDo;\n    function updateDo(node, statement, expression) {\n        if (node.statement !== statement || node.expression !== expression) {\n            return updateNode(createDo(statement, expression, node), node);\n        }\n        return node;\n    }\n    ts.updateDo = updateDo;\n    function createWhile(expression, statement, location) {\n        var node = createNode(210, location);\n        node.expression = expression;\n        node.statement = statement;\n        return node;\n    }\n    ts.createWhile = createWhile;\n    function updateWhile(node, expression, statement) {\n        if (node.expression !== expression || node.statement !== statement) {\n            return updateNode(createWhile(expression, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateWhile = updateWhile;\n    function createFor(initializer, condition, incrementor, statement, location) {\n        var node = createNode(211, location, undefined);\n        node.initializer = initializer;\n        node.condition = condition;\n        node.incrementor = incrementor;\n        node.statement = statement;\n        return node;\n    }\n    ts.createFor = createFor;\n    function updateFor(node, initializer, condition, incrementor, statement) {\n        if (node.initializer !== initializer || node.condition !== condition || node.incrementor !== incrementor || node.statement !== statement) {\n            return updateNode(createFor(initializer, condition, incrementor, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateFor = updateFor;\n    function createForIn(initializer, expression, statement, location) {\n        var node = createNode(212, location);\n        node.initializer = initializer;\n        node.expression = expression;\n        node.statement = statement;\n        return node;\n    }\n    ts.createForIn = createForIn;\n    function updateForIn(node, initializer, expression, statement) {\n        if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) {\n            return updateNode(createForIn(initializer, expression, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateForIn = updateForIn;\n    function createForOf(initializer, expression, statement, location) {\n        var node = createNode(213, location);\n        node.initializer = initializer;\n        node.expression = expression;\n        node.statement = statement;\n        return node;\n    }\n    ts.createForOf = createForOf;\n    function updateForOf(node, initializer, expression, statement) {\n        if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) {\n            return updateNode(createForOf(initializer, expression, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateForOf = updateForOf;\n    function createContinue(label, location) {\n        var node = createNode(214, location);\n        if (label) {\n            node.label = label;\n        }\n        return node;\n    }\n    ts.createContinue = createContinue;\n    function updateContinue(node, label) {\n        if (node.label !== label) {\n            return updateNode(createContinue(label, node), node);\n        }\n        return node;\n    }\n    ts.updateContinue = updateContinue;\n    function createBreak(label, location) {\n        var node = createNode(215, location);\n        if (label) {\n            node.label = label;\n        }\n        return node;\n    }\n    ts.createBreak = createBreak;\n    function updateBreak(node, label) {\n        if (node.label !== label) {\n            return updateNode(createBreak(label, node), node);\n        }\n        return node;\n    }\n    ts.updateBreak = updateBreak;\n    function createReturn(expression, location) {\n        var node = createNode(216, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createReturn = createReturn;\n    function updateReturn(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createReturn(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateReturn = updateReturn;\n    function createWith(expression, statement, location) {\n        var node = createNode(217, location);\n        node.expression = expression;\n        node.statement = statement;\n        return node;\n    }\n    ts.createWith = createWith;\n    function updateWith(node, expression, statement) {\n        if (node.expression !== expression || node.statement !== statement) {\n            return updateNode(createWith(expression, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateWith = updateWith;\n    function createSwitch(expression, caseBlock, location) {\n        var node = createNode(218, location);\n        node.expression = parenthesizeExpressionForList(expression);\n        node.caseBlock = caseBlock;\n        return node;\n    }\n    ts.createSwitch = createSwitch;\n    function updateSwitch(node, expression, caseBlock) {\n        if (node.expression !== expression || node.caseBlock !== caseBlock) {\n            return updateNode(createSwitch(expression, caseBlock, node), node);\n        }\n        return node;\n    }\n    ts.updateSwitch = updateSwitch;\n    function createLabel(label, statement, location) {\n        var node = createNode(219, location);\n        node.label = typeof label === \"string\" ? createIdentifier(label) : label;\n        node.statement = statement;\n        return node;\n    }\n    ts.createLabel = createLabel;\n    function updateLabel(node, label, statement) {\n        if (node.label !== label || node.statement !== statement) {\n            return updateNode(createLabel(label, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateLabel = updateLabel;\n    function createThrow(expression, location) {\n        var node = createNode(220, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createThrow = createThrow;\n    function updateThrow(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createThrow(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateThrow = updateThrow;\n    function createTry(tryBlock, catchClause, finallyBlock, location) {\n        var node = createNode(221, location);\n        node.tryBlock = tryBlock;\n        node.catchClause = catchClause;\n        node.finallyBlock = finallyBlock;\n        return node;\n    }\n    ts.createTry = createTry;\n    function updateTry(node, tryBlock, catchClause, finallyBlock) {\n        if (node.tryBlock !== tryBlock || node.catchClause !== catchClause || node.finallyBlock !== finallyBlock) {\n            return updateNode(createTry(tryBlock, catchClause, finallyBlock, node), node);\n        }\n        return node;\n    }\n    ts.updateTry = updateTry;\n    function createCaseBlock(clauses, location) {\n        var node = createNode(232, location);\n        node.clauses = createNodeArray(clauses);\n        return node;\n    }\n    ts.createCaseBlock = createCaseBlock;\n    function updateCaseBlock(node, clauses) {\n        if (node.clauses !== clauses) {\n            return updateNode(createCaseBlock(clauses, node), node);\n        }\n        return node;\n    }\n    ts.updateCaseBlock = updateCaseBlock;\n    function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {\n        var node = createNode(225, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.asteriskToken = asteriskToken;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = type;\n        node.body = body;\n        return node;\n    }\n    ts.createFunctionDeclaration = createFunctionDeclaration;\n    function updateFunctionDeclaration(node, decorators, modifiers, name, typeParameters, parameters, type, body) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {\n            return updateNode(createFunctionDeclaration(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateFunctionDeclaration = updateFunctionDeclaration;\n    function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) {\n        var node = createNode(226, location);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.name = name;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.heritageClauses = createNodeArray(heritageClauses);\n        node.members = createNodeArray(members);\n        return node;\n    }\n    ts.createClassDeclaration = createClassDeclaration;\n    function updateClassDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) {\n            return updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, node), node);\n        }\n        return node;\n    }\n    ts.updateClassDeclaration = updateClassDeclaration;\n    function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) {\n        var node = createNode(235, location);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.importClause = importClause;\n        node.moduleSpecifier = moduleSpecifier;\n        return node;\n    }\n    ts.createImportDeclaration = createImportDeclaration;\n    function updateImportDeclaration(node, decorators, modifiers, importClause, moduleSpecifier) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier) {\n            return updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, node), node);\n        }\n        return node;\n    }\n    ts.updateImportDeclaration = updateImportDeclaration;\n    function createImportClause(name, namedBindings, location) {\n        var node = createNode(236, location);\n        node.name = name;\n        node.namedBindings = namedBindings;\n        return node;\n    }\n    ts.createImportClause = createImportClause;\n    function updateImportClause(node, name, namedBindings) {\n        if (node.name !== name || node.namedBindings !== namedBindings) {\n            return updateNode(createImportClause(name, namedBindings, node), node);\n        }\n        return node;\n    }\n    ts.updateImportClause = updateImportClause;\n    function createNamespaceImport(name, location) {\n        var node = createNode(237, location);\n        node.name = name;\n        return node;\n    }\n    ts.createNamespaceImport = createNamespaceImport;\n    function updateNamespaceImport(node, name) {\n        if (node.name !== name) {\n            return updateNode(createNamespaceImport(name, node), node);\n        }\n        return node;\n    }\n    ts.updateNamespaceImport = updateNamespaceImport;\n    function createNamedImports(elements, location) {\n        var node = createNode(238, location);\n        node.elements = createNodeArray(elements);\n        return node;\n    }\n    ts.createNamedImports = createNamedImports;\n    function updateNamedImports(node, elements) {\n        if (node.elements !== elements) {\n            return updateNode(createNamedImports(elements, node), node);\n        }\n        return node;\n    }\n    ts.updateNamedImports = updateNamedImports;\n    function createImportSpecifier(propertyName, name, location) {\n        var node = createNode(239, location);\n        node.propertyName = propertyName;\n        node.name = name;\n        return node;\n    }\n    ts.createImportSpecifier = createImportSpecifier;\n    function updateImportSpecifier(node, propertyName, name) {\n        if (node.propertyName !== propertyName || node.name !== name) {\n            return updateNode(createImportSpecifier(propertyName, name, node), node);\n        }\n        return node;\n    }\n    ts.updateImportSpecifier = updateImportSpecifier;\n    function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) {\n        var node = createNode(240, location);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.isExportEquals = isExportEquals;\n        node.expression = expression;\n        return node;\n    }\n    ts.createExportAssignment = createExportAssignment;\n    function updateExportAssignment(node, decorators, modifiers, expression) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.expression !== expression) {\n            return updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression, node), node);\n        }\n        return node;\n    }\n    ts.updateExportAssignment = updateExportAssignment;\n    function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) {\n        var node = createNode(241, location);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.exportClause = exportClause;\n        node.moduleSpecifier = moduleSpecifier;\n        return node;\n    }\n    ts.createExportDeclaration = createExportDeclaration;\n    function updateExportDeclaration(node, decorators, modifiers, exportClause, moduleSpecifier) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier) {\n            return updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, node), node);\n        }\n        return node;\n    }\n    ts.updateExportDeclaration = updateExportDeclaration;\n    function createNamedExports(elements, location) {\n        var node = createNode(242, location);\n        node.elements = createNodeArray(elements);\n        return node;\n    }\n    ts.createNamedExports = createNamedExports;\n    function updateNamedExports(node, elements) {\n        if (node.elements !== elements) {\n            return updateNode(createNamedExports(elements, node), node);\n        }\n        return node;\n    }\n    ts.updateNamedExports = updateNamedExports;\n    function createExportSpecifier(name, propertyName, location) {\n        var node = createNode(243, location);\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.propertyName = typeof propertyName === \"string\" ? createIdentifier(propertyName) : propertyName;\n        return node;\n    }\n    ts.createExportSpecifier = createExportSpecifier;\n    function updateExportSpecifier(node, name, propertyName) {\n        if (node.name !== name || node.propertyName !== propertyName) {\n            return updateNode(createExportSpecifier(name, propertyName, node), node);\n        }\n        return node;\n    }\n    ts.updateExportSpecifier = updateExportSpecifier;\n    function createJsxElement(openingElement, children, closingElement, location) {\n        var node = createNode(246, location);\n        node.openingElement = openingElement;\n        node.children = createNodeArray(children);\n        node.closingElement = closingElement;\n        return node;\n    }\n    ts.createJsxElement = createJsxElement;\n    function updateJsxElement(node, openingElement, children, closingElement) {\n        if (node.openingElement !== openingElement || node.children !== children || node.closingElement !== closingElement) {\n            return updateNode(createJsxElement(openingElement, children, closingElement, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxElement = updateJsxElement;\n    function createJsxSelfClosingElement(tagName, attributes, location) {\n        var node = createNode(247, location);\n        node.tagName = tagName;\n        node.attributes = createNodeArray(attributes);\n        return node;\n    }\n    ts.createJsxSelfClosingElement = createJsxSelfClosingElement;\n    function updateJsxSelfClosingElement(node, tagName, attributes) {\n        if (node.tagName !== tagName || node.attributes !== attributes) {\n            return updateNode(createJsxSelfClosingElement(tagName, attributes, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement;\n    function createJsxOpeningElement(tagName, attributes, location) {\n        var node = createNode(248, location);\n        node.tagName = tagName;\n        node.attributes = createNodeArray(attributes);\n        return node;\n    }\n    ts.createJsxOpeningElement = createJsxOpeningElement;\n    function updateJsxOpeningElement(node, tagName, attributes) {\n        if (node.tagName !== tagName || node.attributes !== attributes) {\n            return updateNode(createJsxOpeningElement(tagName, attributes, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxOpeningElement = updateJsxOpeningElement;\n    function createJsxClosingElement(tagName, location) {\n        var node = createNode(249, location);\n        node.tagName = tagName;\n        return node;\n    }\n    ts.createJsxClosingElement = createJsxClosingElement;\n    function updateJsxClosingElement(node, tagName) {\n        if (node.tagName !== tagName) {\n            return updateNode(createJsxClosingElement(tagName, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxClosingElement = updateJsxClosingElement;\n    function createJsxAttribute(name, initializer, location) {\n        var node = createNode(250, location);\n        node.name = name;\n        node.initializer = initializer;\n        return node;\n    }\n    ts.createJsxAttribute = createJsxAttribute;\n    function updateJsxAttribute(node, name, initializer) {\n        if (node.name !== name || node.initializer !== initializer) {\n            return updateNode(createJsxAttribute(name, initializer, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxAttribute = updateJsxAttribute;\n    function createJsxSpreadAttribute(expression, location) {\n        var node = createNode(251, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createJsxSpreadAttribute = createJsxSpreadAttribute;\n    function updateJsxSpreadAttribute(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createJsxSpreadAttribute(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute;\n    function createJsxExpression(expression, location) {\n        var node = createNode(252, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createJsxExpression = createJsxExpression;\n    function updateJsxExpression(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createJsxExpression(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxExpression = updateJsxExpression;\n    function createHeritageClause(token, types, location) {\n        var node = createNode(255, location);\n        node.token = token;\n        node.types = createNodeArray(types);\n        return node;\n    }\n    ts.createHeritageClause = createHeritageClause;\n    function updateHeritageClause(node, types) {\n        if (node.types !== types) {\n            return updateNode(createHeritageClause(node.token, types, node), node);\n        }\n        return node;\n    }\n    ts.updateHeritageClause = updateHeritageClause;\n    function createCaseClause(expression, statements, location) {\n        var node = createNode(253, location);\n        node.expression = parenthesizeExpressionForList(expression);\n        node.statements = createNodeArray(statements);\n        return node;\n    }\n    ts.createCaseClause = createCaseClause;\n    function updateCaseClause(node, expression, statements) {\n        if (node.expression !== expression || node.statements !== statements) {\n            return updateNode(createCaseClause(expression, statements, node), node);\n        }\n        return node;\n    }\n    ts.updateCaseClause = updateCaseClause;\n    function createDefaultClause(statements, location) {\n        var node = createNode(254, location);\n        node.statements = createNodeArray(statements);\n        return node;\n    }\n    ts.createDefaultClause = createDefaultClause;\n    function updateDefaultClause(node, statements) {\n        if (node.statements !== statements) {\n            return updateNode(createDefaultClause(statements, node), node);\n        }\n        return node;\n    }\n    ts.updateDefaultClause = updateDefaultClause;\n    function createCatchClause(variableDeclaration, block, location) {\n        var node = createNode(256, location);\n        node.variableDeclaration = typeof variableDeclaration === \"string\" ? createVariableDeclaration(variableDeclaration) : variableDeclaration;\n        node.block = block;\n        return node;\n    }\n    ts.createCatchClause = createCatchClause;\n    function updateCatchClause(node, variableDeclaration, block) {\n        if (node.variableDeclaration !== variableDeclaration || node.block !== block) {\n            return updateNode(createCatchClause(variableDeclaration, block, node), node);\n        }\n        return node;\n    }\n    ts.updateCatchClause = updateCatchClause;\n    function createPropertyAssignment(name, initializer, location) {\n        var node = createNode(257, location);\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.questionToken = undefined;\n        node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined;\n        return node;\n    }\n    ts.createPropertyAssignment = createPropertyAssignment;\n    function updatePropertyAssignment(node, name, initializer) {\n        if (node.name !== name || node.initializer !== initializer) {\n            return updateNode(createPropertyAssignment(name, initializer, node), node);\n        }\n        return node;\n    }\n    ts.updatePropertyAssignment = updatePropertyAssignment;\n    function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) {\n        var node = createNode(258, location);\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined;\n        return node;\n    }\n    ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment;\n    function createSpreadAssignment(expression, location) {\n        var node = createNode(259, location);\n        node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined;\n        return node;\n    }\n    ts.createSpreadAssignment = createSpreadAssignment;\n    function updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer) {\n        if (node.name !== name || node.objectAssignmentInitializer !== objectAssignmentInitializer) {\n            return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer, node), node);\n        }\n        return node;\n    }\n    ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment;\n    function updateSpreadAssignment(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createSpreadAssignment(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateSpreadAssignment = updateSpreadAssignment;\n    function updateSourceFileNode(node, statements) {\n        if (node.statements !== statements) {\n            var updated = createNode(261, node, node.flags);\n            updated.statements = createNodeArray(statements);\n            updated.endOfFileToken = node.endOfFileToken;\n            updated.fileName = node.fileName;\n            updated.path = node.path;\n            updated.text = node.text;\n            if (node.amdDependencies !== undefined)\n                updated.amdDependencies = node.amdDependencies;\n            if (node.moduleName !== undefined)\n                updated.moduleName = node.moduleName;\n            if (node.referencedFiles !== undefined)\n                updated.referencedFiles = node.referencedFiles;\n            if (node.typeReferenceDirectives !== undefined)\n                updated.typeReferenceDirectives = node.typeReferenceDirectives;\n            if (node.languageVariant !== undefined)\n                updated.languageVariant = node.languageVariant;\n            if (node.isDeclarationFile !== undefined)\n                updated.isDeclarationFile = node.isDeclarationFile;\n            if (node.renamedDependencies !== undefined)\n                updated.renamedDependencies = node.renamedDependencies;\n            if (node.hasNoDefaultLib !== undefined)\n                updated.hasNoDefaultLib = node.hasNoDefaultLib;\n            if (node.languageVersion !== undefined)\n                updated.languageVersion = node.languageVersion;\n            if (node.scriptKind !== undefined)\n                updated.scriptKind = node.scriptKind;\n            if (node.externalModuleIndicator !== undefined)\n                updated.externalModuleIndicator = node.externalModuleIndicator;\n            if (node.commonJsModuleIndicator !== undefined)\n                updated.commonJsModuleIndicator = node.commonJsModuleIndicator;\n            if (node.identifiers !== undefined)\n                updated.identifiers = node.identifiers;\n            if (node.nodeCount !== undefined)\n                updated.nodeCount = node.nodeCount;\n            if (node.identifierCount !== undefined)\n                updated.identifierCount = node.identifierCount;\n            if (node.symbolCount !== undefined)\n                updated.symbolCount = node.symbolCount;\n            if (node.parseDiagnostics !== undefined)\n                updated.parseDiagnostics = node.parseDiagnostics;\n            if (node.bindDiagnostics !== undefined)\n                updated.bindDiagnostics = node.bindDiagnostics;\n            if (node.lineMap !== undefined)\n                updated.lineMap = node.lineMap;\n            if (node.classifiableNames !== undefined)\n                updated.classifiableNames = node.classifiableNames;\n            if (node.resolvedModules !== undefined)\n                updated.resolvedModules = node.resolvedModules;\n            if (node.resolvedTypeReferenceDirectiveNames !== undefined)\n                updated.resolvedTypeReferenceDirectiveNames = node.resolvedTypeReferenceDirectiveNames;\n            if (node.imports !== undefined)\n                updated.imports = node.imports;\n            if (node.moduleAugmentations !== undefined)\n                updated.moduleAugmentations = node.moduleAugmentations;\n            return updateNode(updated, node);\n        }\n        return node;\n    }\n    ts.updateSourceFileNode = updateSourceFileNode;\n    function createNotEmittedStatement(original) {\n        var node = createNode(293, original);\n        node.original = original;\n        return node;\n    }\n    ts.createNotEmittedStatement = createNotEmittedStatement;\n    function createEndOfDeclarationMarker(original) {\n        var node = createNode(296);\n        node.emitNode = {};\n        node.original = original;\n        return node;\n    }\n    ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker;\n    function createMergeDeclarationMarker(original) {\n        var node = createNode(295);\n        node.emitNode = {};\n        node.original = original;\n        return node;\n    }\n    ts.createMergeDeclarationMarker = createMergeDeclarationMarker;\n    function createPartiallyEmittedExpression(expression, original, location) {\n        var node = createNode(294, location || original);\n        node.expression = expression;\n        node.original = original;\n        return node;\n    }\n    ts.createPartiallyEmittedExpression = createPartiallyEmittedExpression;\n    function updatePartiallyEmittedExpression(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createPartiallyEmittedExpression(expression, node.original, node), node);\n        }\n        return node;\n    }\n    ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;\n    function createRawExpression(text) {\n        var node = createNode(297);\n        node.text = text;\n        return node;\n    }\n    ts.createRawExpression = createRawExpression;\n    function createComma(left, right) {\n        return createBinary(left, 25, right);\n    }\n    ts.createComma = createComma;\n    function createLessThan(left, right, location) {\n        return createBinary(left, 26, right, location);\n    }\n    ts.createLessThan = createLessThan;\n    function createAssignment(left, right, location) {\n        return createBinary(left, 57, right, location);\n    }\n    ts.createAssignment = createAssignment;\n    function createStrictEquality(left, right) {\n        return createBinary(left, 33, right);\n    }\n    ts.createStrictEquality = createStrictEquality;\n    function createStrictInequality(left, right) {\n        return createBinary(left, 34, right);\n    }\n    ts.createStrictInequality = createStrictInequality;\n    function createAdd(left, right) {\n        return createBinary(left, 36, right);\n    }\n    ts.createAdd = createAdd;\n    function createSubtract(left, right) {\n        return createBinary(left, 37, right);\n    }\n    ts.createSubtract = createSubtract;\n    function createPostfixIncrement(operand, location) {\n        return createPostfix(operand, 42, location);\n    }\n    ts.createPostfixIncrement = createPostfixIncrement;\n    function createLogicalAnd(left, right) {\n        return createBinary(left, 52, right);\n    }\n    ts.createLogicalAnd = createLogicalAnd;\n    function createLogicalOr(left, right) {\n        return createBinary(left, 53, right);\n    }\n    ts.createLogicalOr = createLogicalOr;\n    function createLogicalNot(operand) {\n        return createPrefix(50, operand);\n    }\n    ts.createLogicalNot = createLogicalNot;\n    function createVoidZero() {\n        return createVoid(createLiteral(0));\n    }\n    ts.createVoidZero = createVoidZero;\n    function createTypeCheck(value, tag) {\n        return tag === \"undefined\"\n            ? createStrictEquality(value, createVoidZero())\n            : createStrictEquality(createTypeOf(value), createLiteral(tag));\n    }\n    ts.createTypeCheck = createTypeCheck;\n    function createMemberAccessForPropertyName(target, memberName, location) {\n        if (ts.isComputedPropertyName(memberName)) {\n            return createElementAccess(target, memberName.expression, location);\n        }\n        else {\n            var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location);\n            (expression.emitNode || (expression.emitNode = {})).flags |= 64;\n            return expression;\n        }\n    }\n    ts.createMemberAccessForPropertyName = createMemberAccessForPropertyName;\n    function createFunctionCall(func, thisArg, argumentsList, location) {\n        return createCall(createPropertyAccess(func, \"call\"), undefined, [\n            thisArg\n        ].concat(argumentsList), location);\n    }\n    ts.createFunctionCall = createFunctionCall;\n    function createFunctionApply(func, thisArg, argumentsExpression, location) {\n        return createCall(createPropertyAccess(func, \"apply\"), undefined, [\n            thisArg,\n            argumentsExpression\n        ], location);\n    }\n    ts.createFunctionApply = createFunctionApply;\n    function createArraySlice(array, start) {\n        var argumentsList = [];\n        if (start !== undefined) {\n            argumentsList.push(typeof start === \"number\" ? createLiteral(start) : start);\n        }\n        return createCall(createPropertyAccess(array, \"slice\"), undefined, argumentsList);\n    }\n    ts.createArraySlice = createArraySlice;\n    function createArrayConcat(array, values) {\n        return createCall(createPropertyAccess(array, \"concat\"), undefined, values);\n    }\n    ts.createArrayConcat = createArrayConcat;\n    function createMathPow(left, right, location) {\n        return createCall(createPropertyAccess(createIdentifier(\"Math\"), \"pow\"), undefined, [left, right], location);\n    }\n    ts.createMathPow = createMathPow;\n    function createReactNamespace(reactNamespace, parent) {\n        var react = createIdentifier(reactNamespace || \"React\");\n        react.flags &= ~8;\n        react.parent = ts.getParseTreeNode(parent);\n        return react;\n    }\n    function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) {\n        if (ts.isQualifiedName(jsxFactory)) {\n            var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent);\n            var right = createSynthesizedNode(70);\n            right.text = jsxFactory.right.text;\n            return createPropertyAccess(left, right);\n        }\n        else {\n            return createReactNamespace(jsxFactory.text, parent);\n        }\n    }\n    function createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parent) {\n        return jsxFactoryEntity ?\n            createJsxFactoryExpressionFromEntityName(jsxFactoryEntity, parent) :\n            createPropertyAccess(createReactNamespace(reactNamespace, parent), \"createElement\");\n    }\n    function createExpressionForJsxElement(jsxFactoryEntity, reactNamespace, tagName, props, children, parentElement, location) {\n        var argumentsList = [tagName];\n        if (props) {\n            argumentsList.push(props);\n        }\n        if (children && children.length > 0) {\n            if (!props) {\n                argumentsList.push(createNull());\n            }\n            if (children.length > 1) {\n                for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {\n                    var child = children_1[_i];\n                    child.startsOnNewLine = true;\n                    argumentsList.push(child);\n                }\n            }\n            else {\n                argumentsList.push(children[0]);\n            }\n        }\n        return createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), undefined, argumentsList, location);\n    }\n    ts.createExpressionForJsxElement = createExpressionForJsxElement;\n    function createExportDefault(expression) {\n        return createExportAssignment(undefined, undefined, false, expression);\n    }\n    ts.createExportDefault = createExportDefault;\n    function createExternalModuleExport(exportName) {\n        return createExportDeclaration(undefined, undefined, createNamedExports([createExportSpecifier(exportName)]));\n    }\n    ts.createExternalModuleExport = createExternalModuleExport;\n    function createLetStatement(name, initializer, location) {\n        return createVariableStatement(undefined, createLetDeclarationList([createVariableDeclaration(name, undefined, initializer)]), location);\n    }\n    ts.createLetStatement = createLetStatement;\n    function createLetDeclarationList(declarations, location) {\n        return createVariableDeclarationList(declarations, location, 1);\n    }\n    ts.createLetDeclarationList = createLetDeclarationList;\n    function createConstDeclarationList(declarations, location) {\n        return createVariableDeclarationList(declarations, location, 2);\n    }\n    ts.createConstDeclarationList = createConstDeclarationList;\n    function getHelperName(name) {\n        return setEmitFlags(createIdentifier(name), 4096 | 2);\n    }\n    ts.getHelperName = getHelperName;\n    function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {\n        var target = skipParentheses(node);\n        switch (target.kind) {\n            case 70:\n                return cacheIdentifiers;\n            case 98:\n            case 8:\n            case 9:\n                return false;\n            case 175:\n                var elements = target.elements;\n                if (elements.length === 0) {\n                    return false;\n                }\n                return true;\n            case 176:\n                return target.properties.length > 0;\n            default:\n                return true;\n        }\n    }\n    function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers) {\n        var callee = skipOuterExpressions(expression, 7);\n        var thisArg;\n        var target;\n        if (ts.isSuperProperty(callee)) {\n            thisArg = createThis();\n            target = callee;\n        }\n        else if (callee.kind === 96) {\n            thisArg = createThis();\n            target = languageVersion < 2 ? createIdentifier(\"_super\", callee) : callee;\n        }\n        else {\n            switch (callee.kind) {\n                case 177: {\n                    if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {\n                        thisArg = createTempVariable(recordTempVariable);\n                        target = createPropertyAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.name, callee);\n                    }\n                    else {\n                        thisArg = callee.expression;\n                        target = callee;\n                    }\n                    break;\n                }\n                case 178: {\n                    if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {\n                        thisArg = createTempVariable(recordTempVariable);\n                        target = createElementAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.argumentExpression, callee);\n                    }\n                    else {\n                        thisArg = callee.expression;\n                        target = callee;\n                    }\n                    break;\n                }\n                default: {\n                    thisArg = createVoidZero();\n                    target = parenthesizeForAccess(expression);\n                    break;\n                }\n            }\n        }\n        return { target: target, thisArg: thisArg };\n    }\n    ts.createCallBinding = createCallBinding;\n    function inlineExpressions(expressions) {\n        return ts.reduceLeft(expressions, createComma);\n    }\n    ts.inlineExpressions = inlineExpressions;\n    function createExpressionFromEntityName(node) {\n        if (ts.isQualifiedName(node)) {\n            var left = createExpressionFromEntityName(node.left);\n            var right = getMutableClone(node.right);\n            return createPropertyAccess(left, right, node);\n        }\n        else {\n            return getMutableClone(node);\n        }\n    }\n    ts.createExpressionFromEntityName = createExpressionFromEntityName;\n    function createExpressionForPropertyName(memberName) {\n        if (ts.isIdentifier(memberName)) {\n            return createLiteral(memberName, undefined);\n        }\n        else if (ts.isComputedPropertyName(memberName)) {\n            return getMutableClone(memberName.expression);\n        }\n        else {\n            return getMutableClone(memberName);\n        }\n    }\n    ts.createExpressionForPropertyName = createExpressionForPropertyName;\n    function createExpressionForObjectLiteralElementLike(node, property, receiver) {\n        switch (property.kind) {\n            case 151:\n            case 152:\n                return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine);\n            case 257:\n                return createExpressionForPropertyAssignment(property, receiver);\n            case 258:\n                return createExpressionForShorthandPropertyAssignment(property, receiver);\n            case 149:\n                return createExpressionForMethodDeclaration(property, receiver);\n        }\n    }\n    ts.createExpressionForObjectLiteralElementLike = createExpressionForObjectLiteralElementLike;\n    function createExpressionForAccessorDeclaration(properties, property, receiver, multiLine) {\n        var _a = ts.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;\n        if (property === firstAccessor) {\n            var properties_1 = [];\n            if (getAccessor) {\n                var getterFunction = createFunctionExpression(getAccessor.modifiers, undefined, undefined, undefined, getAccessor.parameters, undefined, getAccessor.body, getAccessor);\n                setOriginalNode(getterFunction, getAccessor);\n                var getter = createPropertyAssignment(\"get\", getterFunction);\n                properties_1.push(getter);\n            }\n            if (setAccessor) {\n                var setterFunction = createFunctionExpression(setAccessor.modifiers, undefined, undefined, undefined, setAccessor.parameters, undefined, setAccessor.body, setAccessor);\n                setOriginalNode(setterFunction, setAccessor);\n                var setter = createPropertyAssignment(\"set\", setterFunction);\n                properties_1.push(setter);\n            }\n            properties_1.push(createPropertyAssignment(\"enumerable\", createLiteral(true)));\n            properties_1.push(createPropertyAssignment(\"configurable\", createLiteral(true)));\n            var expression = createCall(createPropertyAccess(createIdentifier(\"Object\"), \"defineProperty\"), undefined, [\n                receiver,\n                createExpressionForPropertyName(property.name),\n                createObjectLiteral(properties_1, undefined, multiLine)\n            ], firstAccessor);\n            return ts.aggregateTransformFlags(expression);\n        }\n        return undefined;\n    }\n    function createExpressionForPropertyAssignment(property, receiver) {\n        return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), property.initializer, property), property));\n    }\n    function createExpressionForShorthandPropertyAssignment(property, receiver) {\n        return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), getSynthesizedClone(property.name), property), property));\n    }\n    function createExpressionForMethodDeclaration(method, receiver) {\n        return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), setOriginalNode(createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body, method), method), method), method));\n    }\n    function getLocalName(node, allowComments, allowSourceMaps) {\n        return getName(node, allowComments, allowSourceMaps, 16384);\n    }\n    ts.getLocalName = getLocalName;\n    function isLocalName(node) {\n        return (getEmitFlags(node) & 16384) !== 0;\n    }\n    ts.isLocalName = isLocalName;\n    function getExportName(node, allowComments, allowSourceMaps) {\n        return getName(node, allowComments, allowSourceMaps, 8192);\n    }\n    ts.getExportName = getExportName;\n    function isExportName(node) {\n        return (getEmitFlags(node) & 8192) !== 0;\n    }\n    ts.isExportName = isExportName;\n    function getDeclarationName(node, allowComments, allowSourceMaps) {\n        return getName(node, allowComments, allowSourceMaps);\n    }\n    ts.getDeclarationName = getDeclarationName;\n    function getName(node, allowComments, allowSourceMaps, emitFlags) {\n        if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) {\n            var name_10 = getMutableClone(node.name);\n            emitFlags |= getEmitFlags(node.name);\n            if (!allowSourceMaps)\n                emitFlags |= 48;\n            if (!allowComments)\n                emitFlags |= 1536;\n            if (emitFlags)\n                setEmitFlags(name_10, emitFlags);\n            return name_10;\n        }\n        return getGeneratedNameForNode(node);\n    }\n    function getExternalModuleOrNamespaceExportName(ns, node, allowComments, allowSourceMaps) {\n        if (ns && ts.hasModifier(node, 1)) {\n            return getNamespaceMemberName(ns, getName(node), allowComments, allowSourceMaps);\n        }\n        return getExportName(node, allowComments, allowSourceMaps);\n    }\n    ts.getExternalModuleOrNamespaceExportName = getExternalModuleOrNamespaceExportName;\n    function getNamespaceMemberName(ns, name, allowComments, allowSourceMaps) {\n        var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), name);\n        var emitFlags;\n        if (!allowSourceMaps)\n            emitFlags |= 48;\n        if (!allowComments)\n            emitFlags |= 1536;\n        if (emitFlags)\n            setEmitFlags(qualifiedName, emitFlags);\n        return qualifiedName;\n    }\n    ts.getNamespaceMemberName = getNamespaceMemberName;\n    function convertToFunctionBody(node, multiLine) {\n        return ts.isBlock(node) ? node : createBlock([createReturn(node, node)], node, multiLine);\n    }\n    ts.convertToFunctionBody = convertToFunctionBody;\n    function isUseStrictPrologue(node) {\n        return node.expression.text === \"use strict\";\n    }\n    function addPrologueDirectives(target, source, ensureUseStrict, visitor) {\n        ts.Debug.assert(target.length === 0, \"Prologue directives should be at the first statement in the target statements array\");\n        var foundUseStrict = false;\n        var statementOffset = 0;\n        var numStatements = source.length;\n        while (statementOffset < numStatements) {\n            var statement = source[statementOffset];\n            if (ts.isPrologueDirective(statement)) {\n                if (isUseStrictPrologue(statement)) {\n                    foundUseStrict = true;\n                }\n                target.push(statement);\n            }\n            else {\n                break;\n            }\n            statementOffset++;\n        }\n        if (ensureUseStrict && !foundUseStrict) {\n            target.push(startOnNewLine(createStatement(createLiteral(\"use strict\"))));\n        }\n        while (statementOffset < numStatements) {\n            var statement = source[statementOffset];\n            if (getEmitFlags(statement) & 524288) {\n                target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement);\n            }\n            else {\n                break;\n            }\n            statementOffset++;\n        }\n        return statementOffset;\n    }\n    ts.addPrologueDirectives = addPrologueDirectives;\n    function startsWithUseStrict(statements) {\n        var firstStatement = ts.firstOrUndefined(statements);\n        return firstStatement !== undefined\n            && ts.isPrologueDirective(firstStatement)\n            && isUseStrictPrologue(firstStatement);\n    }\n    ts.startsWithUseStrict = startsWithUseStrict;\n    function ensureUseStrict(statements) {\n        var foundUseStrict = false;\n        for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {\n            var statement = statements_1[_i];\n            if (ts.isPrologueDirective(statement)) {\n                if (isUseStrictPrologue(statement)) {\n                    foundUseStrict = true;\n                    break;\n                }\n            }\n            else {\n                break;\n            }\n        }\n        if (!foundUseStrict) {\n            return createNodeArray([\n                startOnNewLine(createStatement(createLiteral(\"use strict\")))\n            ].concat(statements), statements);\n        }\n        return statements;\n    }\n    ts.ensureUseStrict = ensureUseStrict;\n    function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {\n        var skipped = skipPartiallyEmittedExpressions(operand);\n        if (skipped.kind === 183) {\n            return operand;\n        }\n        return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand)\n            ? createParen(operand)\n            : operand;\n    }\n    ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand;\n    function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {\n        var binaryOperatorPrecedence = ts.getOperatorPrecedence(192, binaryOperator);\n        var binaryOperatorAssociativity = ts.getOperatorAssociativity(192, binaryOperator);\n        var emittedOperand = skipPartiallyEmittedExpressions(operand);\n        var operandPrecedence = ts.getExpressionPrecedence(emittedOperand);\n        switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) {\n            case -1:\n                if (!isLeftSideOfBinary\n                    && binaryOperatorAssociativity === 1\n                    && operand.kind === 195) {\n                    return false;\n                }\n                return true;\n            case 1:\n                return false;\n            case 0:\n                if (isLeftSideOfBinary) {\n                    return binaryOperatorAssociativity === 1;\n                }\n                else {\n                    if (ts.isBinaryExpression(emittedOperand)\n                        && emittedOperand.operatorToken.kind === binaryOperator) {\n                        if (operatorHasAssociativeProperty(binaryOperator)) {\n                            return false;\n                        }\n                        if (binaryOperator === 36) {\n                            var leftKind = leftOperand ? getLiteralKindOfBinaryPlusOperand(leftOperand) : 0;\n                            if (ts.isLiteralKind(leftKind) && leftKind === getLiteralKindOfBinaryPlusOperand(emittedOperand)) {\n                                return false;\n                            }\n                        }\n                    }\n                    var operandAssociativity = ts.getExpressionAssociativity(emittedOperand);\n                    return operandAssociativity === 0;\n                }\n        }\n    }\n    function operatorHasAssociativeProperty(binaryOperator) {\n        return binaryOperator === 38\n            || binaryOperator === 48\n            || binaryOperator === 47\n            || binaryOperator === 49;\n    }\n    function getLiteralKindOfBinaryPlusOperand(node) {\n        node = skipPartiallyEmittedExpressions(node);\n        if (ts.isLiteralKind(node.kind)) {\n            return node.kind;\n        }\n        if (node.kind === 192 && node.operatorToken.kind === 36) {\n            if (node.cachedLiteralKind !== undefined) {\n                return node.cachedLiteralKind;\n            }\n            var leftKind = getLiteralKindOfBinaryPlusOperand(node.left);\n            var literalKind = ts.isLiteralKind(leftKind)\n                && leftKind === getLiteralKindOfBinaryPlusOperand(node.right)\n                ? leftKind\n                : 0;\n            node.cachedLiteralKind = literalKind;\n            return literalKind;\n        }\n        return 0;\n    }\n    function parenthesizeForConditionalHead(condition) {\n        var conditionalPrecedence = ts.getOperatorPrecedence(193, 54);\n        var emittedCondition = skipPartiallyEmittedExpressions(condition);\n        var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition);\n        if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) {\n            return createParen(condition);\n        }\n        return condition;\n    }\n    ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead;\n    function parenthesizeSubexpressionOfConditionalExpression(e) {\n        return e.kind === 192 && e.operatorToken.kind === 25\n            ? createParen(e)\n            : e;\n    }\n    function parenthesizeForNew(expression) {\n        var emittedExpression = skipPartiallyEmittedExpressions(expression);\n        switch (emittedExpression.kind) {\n            case 179:\n                return createParen(expression);\n            case 180:\n                return emittedExpression.arguments\n                    ? expression\n                    : createParen(expression);\n        }\n        return parenthesizeForAccess(expression);\n    }\n    ts.parenthesizeForNew = parenthesizeForNew;\n    function parenthesizeForAccess(expression) {\n        var emittedExpression = skipPartiallyEmittedExpressions(expression);\n        if (ts.isLeftHandSideExpression(emittedExpression)\n            && (emittedExpression.kind !== 180 || emittedExpression.arguments)\n            && emittedExpression.kind !== 8) {\n            return expression;\n        }\n        return createParen(expression, expression);\n    }\n    ts.parenthesizeForAccess = parenthesizeForAccess;\n    function parenthesizePostfixOperand(operand) {\n        return ts.isLeftHandSideExpression(operand)\n            ? operand\n            : createParen(operand, operand);\n    }\n    ts.parenthesizePostfixOperand = parenthesizePostfixOperand;\n    function parenthesizePrefixOperand(operand) {\n        return ts.isUnaryExpression(operand)\n            ? operand\n            : createParen(operand, operand);\n    }\n    ts.parenthesizePrefixOperand = parenthesizePrefixOperand;\n    function parenthesizeListElements(elements) {\n        var result;\n        for (var i = 0; i < elements.length; i++) {\n            var element = parenthesizeExpressionForList(elements[i]);\n            if (result !== undefined || element !== elements[i]) {\n                if (result === undefined) {\n                    result = elements.slice(0, i);\n                }\n                result.push(element);\n            }\n        }\n        if (result !== undefined) {\n            return createNodeArray(result, elements, elements.hasTrailingComma);\n        }\n        return elements;\n    }\n    function parenthesizeExpressionForList(expression) {\n        var emittedExpression = skipPartiallyEmittedExpressions(expression);\n        var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression);\n        var commaPrecedence = ts.getOperatorPrecedence(192, 25);\n        return expressionPrecedence > commaPrecedence\n            ? expression\n            : createParen(expression, expression);\n    }\n    ts.parenthesizeExpressionForList = parenthesizeExpressionForList;\n    function parenthesizeExpressionForExpressionStatement(expression) {\n        var emittedExpression = skipPartiallyEmittedExpressions(expression);\n        if (ts.isCallExpression(emittedExpression)) {\n            var callee = emittedExpression.expression;\n            var kind = skipPartiallyEmittedExpressions(callee).kind;\n            if (kind === 184 || kind === 185) {\n                var mutableCall = getMutableClone(emittedExpression);\n                mutableCall.expression = createParen(callee, callee);\n                return recreatePartiallyEmittedExpressions(expression, mutableCall);\n            }\n        }\n        else {\n            var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind;\n            if (leftmostExpressionKind === 176 || leftmostExpressionKind === 184) {\n                return createParen(expression, expression);\n            }\n        }\n        return expression;\n    }\n    ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement;\n    function recreatePartiallyEmittedExpressions(originalOuterExpression, newInnerExpression) {\n        if (ts.isPartiallyEmittedExpression(originalOuterExpression)) {\n            var clone_1 = getMutableClone(originalOuterExpression);\n            clone_1.expression = recreatePartiallyEmittedExpressions(clone_1.expression, newInnerExpression);\n            return clone_1;\n        }\n        return newInnerExpression;\n    }\n    function getLeftmostExpression(node) {\n        while (true) {\n            switch (node.kind) {\n                case 191:\n                    node = node.operand;\n                    continue;\n                case 192:\n                    node = node.left;\n                    continue;\n                case 193:\n                    node = node.condition;\n                    continue;\n                case 179:\n                case 178:\n                case 177:\n                    node = node.expression;\n                    continue;\n                case 294:\n                    node = node.expression;\n                    continue;\n            }\n            return node;\n        }\n    }\n    function parenthesizeConciseBody(body) {\n        var emittedBody = skipPartiallyEmittedExpressions(body);\n        if (emittedBody.kind === 176) {\n            return createParen(body, body);\n        }\n        return body;\n    }\n    ts.parenthesizeConciseBody = parenthesizeConciseBody;\n    function skipOuterExpressions(node, kinds) {\n        if (kinds === void 0) { kinds = 7; }\n        var previousNode;\n        do {\n            previousNode = node;\n            if (kinds & 1) {\n                node = skipParentheses(node);\n            }\n            if (kinds & 2) {\n                node = skipAssertions(node);\n            }\n            if (kinds & 4) {\n                node = skipPartiallyEmittedExpressions(node);\n            }\n        } while (previousNode !== node);\n        return node;\n    }\n    ts.skipOuterExpressions = skipOuterExpressions;\n    function skipParentheses(node) {\n        while (node.kind === 183) {\n            node = node.expression;\n        }\n        return node;\n    }\n    ts.skipParentheses = skipParentheses;\n    function skipAssertions(node) {\n        while (ts.isAssertionExpression(node)) {\n            node = node.expression;\n        }\n        return node;\n    }\n    ts.skipAssertions = skipAssertions;\n    function skipPartiallyEmittedExpressions(node) {\n        while (node.kind === 294) {\n            node = node.expression;\n        }\n        return node;\n    }\n    ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions;\n    function startOnNewLine(node) {\n        node.startsOnNewLine = true;\n        return node;\n    }\n    ts.startOnNewLine = startOnNewLine;\n    function setOriginalNode(node, original) {\n        node.original = original;\n        if (original) {\n            var emitNode = original.emitNode;\n            if (emitNode)\n                node.emitNode = mergeEmitNode(emitNode, node.emitNode);\n        }\n        return node;\n    }\n    ts.setOriginalNode = setOriginalNode;\n    function mergeEmitNode(sourceEmitNode, destEmitNode) {\n        var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers;\n        if (!destEmitNode)\n            destEmitNode = {};\n        if (flags)\n            destEmitNode.flags = flags;\n        if (commentRange)\n            destEmitNode.commentRange = commentRange;\n        if (sourceMapRange)\n            destEmitNode.sourceMapRange = sourceMapRange;\n        if (tokenSourceMapRanges)\n            destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges);\n        if (constantValue !== undefined)\n            destEmitNode.constantValue = constantValue;\n        if (helpers)\n            destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers);\n        return destEmitNode;\n    }\n    function mergeTokenSourceMapRanges(sourceRanges, destRanges) {\n        if (!destRanges)\n            destRanges = ts.createMap();\n        ts.copyProperties(sourceRanges, destRanges);\n        return destRanges;\n    }\n    function disposeEmitNodes(sourceFile) {\n        sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile));\n        var emitNode = sourceFile && sourceFile.emitNode;\n        var annotatedNodes = emitNode && emitNode.annotatedNodes;\n        if (annotatedNodes) {\n            for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) {\n                var node = annotatedNodes_1[_i];\n                node.emitNode = undefined;\n            }\n        }\n    }\n    ts.disposeEmitNodes = disposeEmitNodes;\n    function getOrCreateEmitNode(node) {\n        if (!node.emitNode) {\n            if (ts.isParseTreeNode(node)) {\n                if (node.kind === 261) {\n                    return node.emitNode = { annotatedNodes: [node] };\n                }\n                var sourceFile = ts.getSourceFileOfNode(node);\n                getOrCreateEmitNode(sourceFile).annotatedNodes.push(node);\n            }\n            node.emitNode = {};\n        }\n        return node.emitNode;\n    }\n    ts.getOrCreateEmitNode = getOrCreateEmitNode;\n    function getEmitFlags(node) {\n        var emitNode = node.emitNode;\n        return emitNode && emitNode.flags;\n    }\n    ts.getEmitFlags = getEmitFlags;\n    function setEmitFlags(node, emitFlags) {\n        getOrCreateEmitNode(node).flags = emitFlags;\n        return node;\n    }\n    ts.setEmitFlags = setEmitFlags;\n    function getSourceMapRange(node) {\n        var emitNode = node.emitNode;\n        return (emitNode && emitNode.sourceMapRange) || node;\n    }\n    ts.getSourceMapRange = getSourceMapRange;\n    function setSourceMapRange(node, range) {\n        getOrCreateEmitNode(node).sourceMapRange = range;\n        return node;\n    }\n    ts.setSourceMapRange = setSourceMapRange;\n    function getTokenSourceMapRange(node, token) {\n        var emitNode = node.emitNode;\n        var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges;\n        return tokenSourceMapRanges && tokenSourceMapRanges[token];\n    }\n    ts.getTokenSourceMapRange = getTokenSourceMapRange;\n    function setTokenSourceMapRange(node, token, range) {\n        var emitNode = getOrCreateEmitNode(node);\n        var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap());\n        tokenSourceMapRanges[token] = range;\n        return node;\n    }\n    ts.setTokenSourceMapRange = setTokenSourceMapRange;\n    function getCommentRange(node) {\n        var emitNode = node.emitNode;\n        return (emitNode && emitNode.commentRange) || node;\n    }\n    ts.getCommentRange = getCommentRange;\n    function setCommentRange(node, range) {\n        getOrCreateEmitNode(node).commentRange = range;\n        return node;\n    }\n    ts.setCommentRange = setCommentRange;\n    function getConstantValue(node) {\n        var emitNode = node.emitNode;\n        return emitNode && emitNode.constantValue;\n    }\n    ts.getConstantValue = getConstantValue;\n    function setConstantValue(node, value) {\n        var emitNode = getOrCreateEmitNode(node);\n        emitNode.constantValue = value;\n        return node;\n    }\n    ts.setConstantValue = setConstantValue;\n    function getExternalHelpersModuleName(node) {\n        var parseNode = ts.getOriginalNode(node, ts.isSourceFile);\n        var emitNode = parseNode && parseNode.emitNode;\n        return emitNode && emitNode.externalHelpersModuleName;\n    }\n    ts.getExternalHelpersModuleName = getExternalHelpersModuleName;\n    function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions) {\n        if (compilerOptions.importHelpers && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {\n            var externalHelpersModuleName = getExternalHelpersModuleName(node);\n            if (externalHelpersModuleName) {\n                return externalHelpersModuleName;\n            }\n            var helpers = getEmitHelpers(node);\n            if (helpers) {\n                for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) {\n                    var helper = helpers_1[_i];\n                    if (!helper.scoped) {\n                        var parseNode = ts.getOriginalNode(node, ts.isSourceFile);\n                        var emitNode = getOrCreateEmitNode(parseNode);\n                        return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText));\n                    }\n                }\n            }\n        }\n    }\n    ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded;\n    function addEmitHelper(node, helper) {\n        var emitNode = getOrCreateEmitNode(node);\n        emitNode.helpers = ts.append(emitNode.helpers, helper);\n        return node;\n    }\n    ts.addEmitHelper = addEmitHelper;\n    function addEmitHelpers(node, helpers) {\n        if (ts.some(helpers)) {\n            var emitNode = getOrCreateEmitNode(node);\n            for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {\n                var helper = helpers_2[_i];\n                if (!ts.contains(emitNode.helpers, helper)) {\n                    emitNode.helpers = ts.append(emitNode.helpers, helper);\n                }\n            }\n        }\n        return node;\n    }\n    ts.addEmitHelpers = addEmitHelpers;\n    function removeEmitHelper(node, helper) {\n        var emitNode = node.emitNode;\n        if (emitNode) {\n            var helpers = emitNode.helpers;\n            if (helpers) {\n                return ts.orderedRemoveItem(helpers, helper);\n            }\n        }\n        return false;\n    }\n    ts.removeEmitHelper = removeEmitHelper;\n    function getEmitHelpers(node) {\n        var emitNode = node.emitNode;\n        return emitNode && emitNode.helpers;\n    }\n    ts.getEmitHelpers = getEmitHelpers;\n    function moveEmitHelpers(source, target, predicate) {\n        var sourceEmitNode = source.emitNode;\n        var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers;\n        if (!ts.some(sourceEmitHelpers))\n            return;\n        var targetEmitNode = getOrCreateEmitNode(target);\n        var helpersRemoved = 0;\n        for (var i = 0; i < sourceEmitHelpers.length; i++) {\n            var helper = sourceEmitHelpers[i];\n            if (predicate(helper)) {\n                helpersRemoved++;\n                if (!ts.contains(targetEmitNode.helpers, helper)) {\n                    targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper);\n                }\n            }\n            else if (helpersRemoved > 0) {\n                sourceEmitHelpers[i - helpersRemoved] = helper;\n            }\n        }\n        if (helpersRemoved > 0) {\n            sourceEmitHelpers.length -= helpersRemoved;\n        }\n    }\n    ts.moveEmitHelpers = moveEmitHelpers;\n    function compareEmitHelpers(x, y) {\n        if (x === y)\n            return 0;\n        if (x.priority === y.priority)\n            return 0;\n        if (x.priority === undefined)\n            return 1;\n        if (y.priority === undefined)\n            return -1;\n        return ts.compareValues(x.priority, y.priority);\n    }\n    ts.compareEmitHelpers = compareEmitHelpers;\n    function setTextRange(node, location) {\n        if (location) {\n            node.pos = location.pos;\n            node.end = location.end;\n        }\n        return node;\n    }\n    ts.setTextRange = setTextRange;\n    function setNodeFlags(node, flags) {\n        node.flags = flags;\n        return node;\n    }\n    ts.setNodeFlags = setNodeFlags;\n    function setMultiLine(node, multiLine) {\n        node.multiLine = multiLine;\n        return node;\n    }\n    ts.setMultiLine = setMultiLine;\n    function setHasTrailingComma(nodes, hasTrailingComma) {\n        nodes.hasTrailingComma = hasTrailingComma;\n        return nodes;\n    }\n    ts.setHasTrailingComma = setHasTrailingComma;\n    function getLocalNameForExternalImport(node, sourceFile) {\n        var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);\n        if (namespaceDeclaration && !ts.isDefaultImport(node)) {\n            var name_11 = namespaceDeclaration.name;\n            return ts.isGeneratedIdentifier(name_11) ? name_11 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));\n        }\n        if (node.kind === 235 && node.importClause) {\n            return getGeneratedNameForNode(node);\n        }\n        if (node.kind === 241 && node.moduleSpecifier) {\n            return getGeneratedNameForNode(node);\n        }\n        return undefined;\n    }\n    ts.getLocalNameForExternalImport = getLocalNameForExternalImport;\n    function getExternalModuleNameLiteral(importNode, sourceFile, host, resolver, compilerOptions) {\n        var moduleName = ts.getExternalModuleName(importNode);\n        if (moduleName.kind === 9) {\n            return tryGetModuleNameFromDeclaration(importNode, host, resolver, compilerOptions)\n                || tryRenameExternalModule(moduleName, sourceFile)\n                || getSynthesizedClone(moduleName);\n        }\n        return undefined;\n    }\n    ts.getExternalModuleNameLiteral = getExternalModuleNameLiteral;\n    function tryRenameExternalModule(moduleName, sourceFile) {\n        if (sourceFile.renamedDependencies && ts.hasProperty(sourceFile.renamedDependencies, moduleName.text)) {\n            return createLiteral(sourceFile.renamedDependencies[moduleName.text]);\n        }\n        return undefined;\n    }\n    function tryGetModuleNameFromFile(file, host, options) {\n        if (!file) {\n            return undefined;\n        }\n        if (file.moduleName) {\n            return createLiteral(file.moduleName);\n        }\n        if (!ts.isDeclarationFile(file) && (options.out || options.outFile)) {\n            return createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName));\n        }\n        return undefined;\n    }\n    ts.tryGetModuleNameFromFile = tryGetModuleNameFromFile;\n    function tryGetModuleNameFromDeclaration(declaration, host, resolver, compilerOptions) {\n        return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions);\n    }\n    function getInitializerOfBindingOrAssignmentElement(bindingElement) {\n        if (ts.isDeclarationBindingElement(bindingElement)) {\n            return bindingElement.initializer;\n        }\n        if (ts.isPropertyAssignment(bindingElement)) {\n            return ts.isAssignmentExpression(bindingElement.initializer, true)\n                ? bindingElement.initializer.right\n                : undefined;\n        }\n        if (ts.isShorthandPropertyAssignment(bindingElement)) {\n            return bindingElement.objectAssignmentInitializer;\n        }\n        if (ts.isAssignmentExpression(bindingElement, true)) {\n            return bindingElement.right;\n        }\n        if (ts.isSpreadExpression(bindingElement)) {\n            return getInitializerOfBindingOrAssignmentElement(bindingElement.expression);\n        }\n    }\n    ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement;\n    function getTargetOfBindingOrAssignmentElement(bindingElement) {\n        if (ts.isDeclarationBindingElement(bindingElement)) {\n            return bindingElement.name;\n        }\n        if (ts.isObjectLiteralElementLike(bindingElement)) {\n            switch (bindingElement.kind) {\n                case 257:\n                    return getTargetOfBindingOrAssignmentElement(bindingElement.initializer);\n                case 258:\n                    return bindingElement.name;\n                case 259:\n                    return getTargetOfBindingOrAssignmentElement(bindingElement.expression);\n            }\n            return undefined;\n        }\n        if (ts.isAssignmentExpression(bindingElement, true)) {\n            return getTargetOfBindingOrAssignmentElement(bindingElement.left);\n        }\n        if (ts.isSpreadExpression(bindingElement)) {\n            return getTargetOfBindingOrAssignmentElement(bindingElement.expression);\n        }\n        return bindingElement;\n    }\n    ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement;\n    function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) {\n        switch (bindingElement.kind) {\n            case 144:\n            case 174:\n                return bindingElement.dotDotDotToken;\n            case 196:\n            case 259:\n                return bindingElement;\n        }\n        return undefined;\n    }\n    ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement;\n    function getPropertyNameOfBindingOrAssignmentElement(bindingElement) {\n        switch (bindingElement.kind) {\n            case 174:\n                if (bindingElement.propertyName) {\n                    var propertyName = bindingElement.propertyName;\n                    return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression)\n                        ? propertyName.expression\n                        : propertyName;\n                }\n                break;\n            case 257:\n                if (bindingElement.name) {\n                    var propertyName = bindingElement.name;\n                    return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression)\n                        ? propertyName.expression\n                        : propertyName;\n                }\n                break;\n            case 259:\n                return bindingElement.name;\n        }\n        var target = getTargetOfBindingOrAssignmentElement(bindingElement);\n        if (target && ts.isPropertyName(target)) {\n            return ts.isComputedPropertyName(target) && ts.isStringOrNumericLiteral(target.expression)\n                ? target.expression\n                : target;\n        }\n        ts.Debug.fail(\"Invalid property name for binding element.\");\n    }\n    ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement;\n    function getElementsOfBindingOrAssignmentPattern(name) {\n        switch (name.kind) {\n            case 172:\n            case 173:\n            case 175:\n                return name.elements;\n            case 176:\n                return name.properties;\n        }\n    }\n    ts.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern;\n    function convertToArrayAssignmentElement(element) {\n        if (ts.isBindingElement(element)) {\n            if (element.dotDotDotToken) {\n                ts.Debug.assertNode(element.name, ts.isIdentifier);\n                return setOriginalNode(createSpread(element.name, element), element);\n            }\n            var expression = convertToAssignmentElementTarget(element.name);\n            return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression;\n        }\n        ts.Debug.assertNode(element, ts.isExpression);\n        return element;\n    }\n    ts.convertToArrayAssignmentElement = convertToArrayAssignmentElement;\n    function convertToObjectAssignmentElement(element) {\n        if (ts.isBindingElement(element)) {\n            if (element.dotDotDotToken) {\n                ts.Debug.assertNode(element.name, ts.isIdentifier);\n                return setOriginalNode(createSpreadAssignment(element.name, element), element);\n            }\n            if (element.propertyName) {\n                var expression = convertToAssignmentElementTarget(element.name);\n                return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element);\n            }\n            ts.Debug.assertNode(element.name, ts.isIdentifier);\n            return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element);\n        }\n        ts.Debug.assertNode(element, ts.isObjectLiteralElementLike);\n        return element;\n    }\n    ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement;\n    function convertToAssignmentPattern(node) {\n        switch (node.kind) {\n            case 173:\n            case 175:\n                return convertToArrayAssignmentPattern(node);\n            case 172:\n            case 176:\n                return convertToObjectAssignmentPattern(node);\n        }\n    }\n    ts.convertToAssignmentPattern = convertToAssignmentPattern;\n    function convertToObjectAssignmentPattern(node) {\n        if (ts.isObjectBindingPattern(node)) {\n            return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node);\n        }\n        ts.Debug.assertNode(node, ts.isObjectLiteralExpression);\n        return node;\n    }\n    ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern;\n    function convertToArrayAssignmentPattern(node) {\n        if (ts.isArrayBindingPattern(node)) {\n            return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node);\n        }\n        ts.Debug.assertNode(node, ts.isArrayLiteralExpression);\n        return node;\n    }\n    ts.convertToArrayAssignmentPattern = convertToArrayAssignmentPattern;\n    function convertToAssignmentElementTarget(node) {\n        if (ts.isBindingPattern(node)) {\n            return convertToAssignmentPattern(node);\n        }\n        ts.Debug.assertNode(node, ts.isExpression);\n        return node;\n    }\n    ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget;\n    function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) {\n        var externalImports = [];\n        var exportSpecifiers = ts.createMap();\n        var exportedBindings = ts.createMap();\n        var uniqueExports = ts.createMap();\n        var exportedNames;\n        var hasExportDefault = false;\n        var exportEquals = undefined;\n        var hasExportStarsToExportValues = false;\n        var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions);\n        var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration(undefined, undefined, createImportClause(undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText));\n        if (externalHelpersImportDeclaration) {\n            externalImports.push(externalHelpersImportDeclaration);\n        }\n        for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {\n            var node = _a[_i];\n            switch (node.kind) {\n                case 235:\n                    externalImports.push(node);\n                    break;\n                case 234:\n                    if (node.moduleReference.kind === 245) {\n                        externalImports.push(node);\n                    }\n                    break;\n                case 241:\n                    if (node.moduleSpecifier) {\n                        if (!node.exportClause) {\n                            externalImports.push(node);\n                            hasExportStarsToExportValues = true;\n                        }\n                        else {\n                            externalImports.push(node);\n                        }\n                    }\n                    else {\n                        for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) {\n                            var specifier = _c[_b];\n                            if (!uniqueExports[specifier.name.text]) {\n                                var name_12 = specifier.propertyName || specifier.name;\n                                ts.multiMapAdd(exportSpecifiers, name_12.text, specifier);\n                                var decl = resolver.getReferencedImportDeclaration(name_12)\n                                    || resolver.getReferencedValueDeclaration(name_12);\n                                if (decl) {\n                                    ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name);\n                                }\n                                uniqueExports[specifier.name.text] = true;\n                                exportedNames = ts.append(exportedNames, specifier.name);\n                            }\n                        }\n                    }\n                    break;\n                case 240:\n                    if (node.isExportEquals && !exportEquals) {\n                        exportEquals = node;\n                    }\n                    break;\n                case 205:\n                    if (ts.hasModifier(node, 1)) {\n                        for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {\n                            var decl = _e[_d];\n                            exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames);\n                        }\n                    }\n                    break;\n                case 225:\n                    if (ts.hasModifier(node, 1)) {\n                        if (ts.hasModifier(node, 512)) {\n                            if (!hasExportDefault) {\n                                ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node));\n                                hasExportDefault = true;\n                            }\n                        }\n                        else {\n                            var name_13 = node.name;\n                            if (!uniqueExports[name_13.text]) {\n                                ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_13);\n                                uniqueExports[name_13.text] = true;\n                                exportedNames = ts.append(exportedNames, name_13);\n                            }\n                        }\n                    }\n                    break;\n                case 226:\n                    if (ts.hasModifier(node, 1)) {\n                        if (ts.hasModifier(node, 512)) {\n                            if (!hasExportDefault) {\n                                ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node));\n                                hasExportDefault = true;\n                            }\n                        }\n                        else {\n                            var name_14 = node.name;\n                            if (!uniqueExports[name_14.text]) {\n                                ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_14);\n                                uniqueExports[name_14.text] = true;\n                                exportedNames = ts.append(exportedNames, name_14);\n                            }\n                        }\n                    }\n                    break;\n            }\n        }\n        return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration };\n    }\n    ts.collectExternalModuleInfo = collectExternalModuleInfo;\n    function collectExportedVariableInfo(decl, uniqueExports, exportedNames) {\n        if (ts.isBindingPattern(decl.name)) {\n            for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {\n                var element = _a[_i];\n                if (!ts.isOmittedExpression(element)) {\n                    exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames);\n                }\n            }\n        }\n        else if (!ts.isGeneratedIdentifier(decl.name)) {\n            if (!uniqueExports[decl.name.text]) {\n                uniqueExports[decl.name.text] = true;\n                exportedNames = ts.append(exportedNames, decl.name);\n            }\n        }\n        return exportedNames;\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var NodeConstructor;\n    var TokenConstructor;\n    var IdentifierConstructor;\n    var SourceFileConstructor;\n    function createNode(kind, pos, end) {\n        if (kind === 261) {\n            return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);\n        }\n        else if (kind === 70) {\n            return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);\n        }\n        else if (kind < 141) {\n            return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end);\n        }\n        else {\n            return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end);\n        }\n    }\n    ts.createNode = createNode;\n    function visitNode(cbNode, node) {\n        if (node) {\n            return cbNode(node);\n        }\n    }\n    function visitNodeArray(cbNodes, nodes) {\n        if (nodes) {\n            return cbNodes(nodes);\n        }\n    }\n    function visitEachNode(cbNode, nodes) {\n        if (nodes) {\n            for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {\n                var node = nodes_1[_i];\n                var result = cbNode(node);\n                if (result) {\n                    return result;\n                }\n            }\n        }\n    }\n    function forEachChild(node, cbNode, cbNodeArray) {\n        if (!node) {\n            return;\n        }\n        var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode;\n        var cbNodes = cbNodeArray || cbNode;\n        switch (node.kind) {\n            case 141:\n                return visitNode(cbNode, node.left) ||\n                    visitNode(cbNode, node.right);\n            case 143:\n                return visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.constraint) ||\n                    visitNode(cbNode, node.expression);\n            case 258:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.questionToken) ||\n                    visitNode(cbNode, node.equalsToken) ||\n                    visitNode(cbNode, node.objectAssignmentInitializer);\n            case 259:\n                return visitNode(cbNode, node.expression);\n            case 144:\n            case 147:\n            case 146:\n            case 257:\n            case 223:\n            case 174:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.propertyName) ||\n                    visitNode(cbNode, node.dotDotDotToken) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.questionToken) ||\n                    visitNode(cbNode, node.type) ||\n                    visitNode(cbNode, node.initializer);\n            case 158:\n            case 159:\n            case 153:\n            case 154:\n            case 155:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNodes(cbNodes, node.typeParameters) ||\n                    visitNodes(cbNodes, node.parameters) ||\n                    visitNode(cbNode, node.type);\n            case 149:\n            case 148:\n            case 150:\n            case 151:\n            case 152:\n            case 184:\n            case 225:\n            case 185:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.asteriskToken) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.questionToken) ||\n                    visitNodes(cbNodes, node.typeParameters) ||\n                    visitNodes(cbNodes, node.parameters) ||\n                    visitNode(cbNode, node.type) ||\n                    visitNode(cbNode, node.equalsGreaterThanToken) ||\n                    visitNode(cbNode, node.body);\n            case 157:\n                return visitNode(cbNode, node.typeName) ||\n                    visitNodes(cbNodes, node.typeArguments);\n            case 156:\n                return visitNode(cbNode, node.parameterName) ||\n                    visitNode(cbNode, node.type);\n            case 160:\n                return visitNode(cbNode, node.exprName);\n            case 161:\n                return visitNodes(cbNodes, node.members);\n            case 162:\n                return visitNode(cbNode, node.elementType);\n            case 163:\n                return visitNodes(cbNodes, node.elementTypes);\n            case 164:\n            case 165:\n                return visitNodes(cbNodes, node.types);\n            case 166:\n            case 168:\n                return visitNode(cbNode, node.type);\n            case 169:\n                return visitNode(cbNode, node.objectType) ||\n                    visitNode(cbNode, node.indexType);\n            case 170:\n                return visitNode(cbNode, node.readonlyToken) ||\n                    visitNode(cbNode, node.typeParameter) ||\n                    visitNode(cbNode, node.questionToken) ||\n                    visitNode(cbNode, node.type);\n            case 171:\n                return visitNode(cbNode, node.literal);\n            case 172:\n            case 173:\n                return visitNodes(cbNodes, node.elements);\n            case 175:\n                return visitNodes(cbNodes, node.elements);\n            case 176:\n                return visitNodes(cbNodes, node.properties);\n            case 177:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.name);\n            case 178:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.argumentExpression);\n            case 179:\n            case 180:\n                return visitNode(cbNode, node.expression) ||\n                    visitNodes(cbNodes, node.typeArguments) ||\n                    visitNodes(cbNodes, node.arguments);\n            case 181:\n                return visitNode(cbNode, node.tag) ||\n                    visitNode(cbNode, node.template);\n            case 182:\n                return visitNode(cbNode, node.type) ||\n                    visitNode(cbNode, node.expression);\n            case 183:\n                return visitNode(cbNode, node.expression);\n            case 186:\n                return visitNode(cbNode, node.expression);\n            case 187:\n                return visitNode(cbNode, node.expression);\n            case 188:\n                return visitNode(cbNode, node.expression);\n            case 190:\n                return visitNode(cbNode, node.operand);\n            case 195:\n                return visitNode(cbNode, node.asteriskToken) ||\n                    visitNode(cbNode, node.expression);\n            case 189:\n                return visitNode(cbNode, node.expression);\n            case 191:\n                return visitNode(cbNode, node.operand);\n            case 192:\n                return visitNode(cbNode, node.left) ||\n                    visitNode(cbNode, node.operatorToken) ||\n                    visitNode(cbNode, node.right);\n            case 200:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.type);\n            case 201:\n                return visitNode(cbNode, node.expression);\n            case 193:\n                return visitNode(cbNode, node.condition) ||\n                    visitNode(cbNode, node.questionToken) ||\n                    visitNode(cbNode, node.whenTrue) ||\n                    visitNode(cbNode, node.colonToken) ||\n                    visitNode(cbNode, node.whenFalse);\n            case 196:\n                return visitNode(cbNode, node.expression);\n            case 204:\n            case 231:\n                return visitNodes(cbNodes, node.statements);\n            case 261:\n                return visitNodes(cbNodes, node.statements) ||\n                    visitNode(cbNode, node.endOfFileToken);\n            case 205:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.declarationList);\n            case 224:\n                return visitNodes(cbNodes, node.declarations);\n            case 207:\n                return visitNode(cbNode, node.expression);\n            case 208:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.thenStatement) ||\n                    visitNode(cbNode, node.elseStatement);\n            case 209:\n                return visitNode(cbNode, node.statement) ||\n                    visitNode(cbNode, node.expression);\n            case 210:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.statement);\n            case 211:\n                return visitNode(cbNode, node.initializer) ||\n                    visitNode(cbNode, node.condition) ||\n                    visitNode(cbNode, node.incrementor) ||\n                    visitNode(cbNode, node.statement);\n            case 212:\n                return visitNode(cbNode, node.initializer) ||\n                    visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.statement);\n            case 213:\n                return visitNode(cbNode, node.initializer) ||\n                    visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.statement);\n            case 214:\n            case 215:\n                return visitNode(cbNode, node.label);\n            case 216:\n                return visitNode(cbNode, node.expression);\n            case 217:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.statement);\n            case 218:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.caseBlock);\n            case 232:\n                return visitNodes(cbNodes, node.clauses);\n            case 253:\n                return visitNode(cbNode, node.expression) ||\n                    visitNodes(cbNodes, node.statements);\n            case 254:\n                return visitNodes(cbNodes, node.statements);\n            case 219:\n                return visitNode(cbNode, node.label) ||\n                    visitNode(cbNode, node.statement);\n            case 220:\n                return visitNode(cbNode, node.expression);\n            case 221:\n                return visitNode(cbNode, node.tryBlock) ||\n                    visitNode(cbNode, node.catchClause) ||\n                    visitNode(cbNode, node.finallyBlock);\n            case 256:\n                return visitNode(cbNode, node.variableDeclaration) ||\n                    visitNode(cbNode, node.block);\n            case 145:\n                return visitNode(cbNode, node.expression);\n            case 226:\n            case 197:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNodes(cbNodes, node.typeParameters) ||\n                    visitNodes(cbNodes, node.heritageClauses) ||\n                    visitNodes(cbNodes, node.members);\n            case 227:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNodes(cbNodes, node.typeParameters) ||\n                    visitNodes(cbNodes, node.heritageClauses) ||\n                    visitNodes(cbNodes, node.members);\n            case 228:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNodes(cbNodes, node.typeParameters) ||\n                    visitNode(cbNode, node.type);\n            case 229:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNodes(cbNodes, node.members);\n            case 260:\n                return visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.initializer);\n            case 230:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.body);\n            case 234:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.moduleReference);\n            case 235:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.importClause) ||\n                    visitNode(cbNode, node.moduleSpecifier);\n            case 236:\n                return visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.namedBindings);\n            case 233:\n                return visitNode(cbNode, node.name);\n            case 237:\n                return visitNode(cbNode, node.name);\n            case 238:\n            case 242:\n                return visitNodes(cbNodes, node.elements);\n            case 241:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.exportClause) ||\n                    visitNode(cbNode, node.moduleSpecifier);\n            case 239:\n            case 243:\n                return visitNode(cbNode, node.propertyName) ||\n                    visitNode(cbNode, node.name);\n            case 240:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.expression);\n            case 194:\n                return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans);\n            case 202:\n                return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal);\n            case 142:\n                return visitNode(cbNode, node.expression);\n            case 255:\n                return visitNodes(cbNodes, node.types);\n            case 199:\n                return visitNode(cbNode, node.expression) ||\n                    visitNodes(cbNodes, node.typeArguments);\n            case 245:\n                return visitNode(cbNode, node.expression);\n            case 244:\n                return visitNodes(cbNodes, node.decorators);\n            case 246:\n                return visitNode(cbNode, node.openingElement) ||\n                    visitNodes(cbNodes, node.children) ||\n                    visitNode(cbNode, node.closingElement);\n            case 247:\n            case 248:\n                return visitNode(cbNode, node.tagName) ||\n                    visitNodes(cbNodes, node.attributes);\n            case 250:\n                return visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.initializer);\n            case 251:\n                return visitNode(cbNode, node.expression);\n            case 252:\n                return visitNode(cbNode, node.expression);\n            case 249:\n                return visitNode(cbNode, node.tagName);\n            case 262:\n                return visitNode(cbNode, node.type);\n            case 266:\n                return visitNodes(cbNodes, node.types);\n            case 267:\n                return visitNodes(cbNodes, node.types);\n            case 265:\n                return visitNode(cbNode, node.elementType);\n            case 269:\n                return visitNode(cbNode, node.type);\n            case 268:\n                return visitNode(cbNode, node.type);\n            case 270:\n                return visitNode(cbNode, node.literal);\n            case 272:\n                return visitNode(cbNode, node.name) ||\n                    visitNodes(cbNodes, node.typeArguments);\n            case 273:\n                return visitNode(cbNode, node.type);\n            case 274:\n                return visitNodes(cbNodes, node.parameters) ||\n                    visitNode(cbNode, node.type);\n            case 275:\n                return visitNode(cbNode, node.type);\n            case 276:\n                return visitNode(cbNode, node.type);\n            case 277:\n                return visitNode(cbNode, node.type);\n            case 271:\n                return visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.type);\n            case 278:\n                return visitNodes(cbNodes, node.tags);\n            case 281:\n                return visitNode(cbNode, node.preParameterName) ||\n                    visitNode(cbNode, node.typeExpression) ||\n                    visitNode(cbNode, node.postParameterName);\n            case 282:\n                return visitNode(cbNode, node.typeExpression);\n            case 283:\n                return visitNode(cbNode, node.typeExpression);\n            case 280:\n                return visitNode(cbNode, node.typeExpression);\n            case 284:\n                return visitNodes(cbNodes, node.typeParameters);\n            case 285:\n                return visitNode(cbNode, node.typeExpression) ||\n                    visitNode(cbNode, node.fullName) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.jsDocTypeLiteral);\n            case 287:\n                return visitNodes(cbNodes, node.jsDocPropertyTags);\n            case 286:\n                return visitNode(cbNode, node.typeExpression) ||\n                    visitNode(cbNode, node.name);\n            case 294:\n                return visitNode(cbNode, node.expression);\n            case 288:\n                return visitNode(cbNode, node.literal);\n        }\n    }\n    ts.forEachChild = forEachChild;\n    function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) {\n        if (setParentNodes === void 0) { setParentNodes = false; }\n        ts.performance.mark(\"beforeParse\");\n        var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes, scriptKind);\n        ts.performance.mark(\"afterParse\");\n        ts.performance.measure(\"Parse\", \"beforeParse\", \"afterParse\");\n        return result;\n    }\n    ts.createSourceFile = createSourceFile;\n    function parseIsolatedEntityName(text, languageVersion) {\n        return Parser.parseIsolatedEntityName(text, languageVersion);\n    }\n    ts.parseIsolatedEntityName = parseIsolatedEntityName;\n    function isExternalModule(file) {\n        return file.externalModuleIndicator !== undefined;\n    }\n    ts.isExternalModule = isExternalModule;\n    function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) {\n        return IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);\n    }\n    ts.updateSourceFile = updateSourceFile;\n    function parseIsolatedJSDocComment(content, start, length) {\n        var result = Parser.JSDocParser.parseIsolatedJSDocComment(content, start, length);\n        if (result && result.jsDoc) {\n            Parser.fixupParentReferences(result.jsDoc);\n        }\n        return result;\n    }\n    ts.parseIsolatedJSDocComment = parseIsolatedJSDocComment;\n    function parseJSDocTypeExpressionForTests(content, start, length) {\n        return Parser.JSDocParser.parseJSDocTypeExpressionForTests(content, start, length);\n    }\n    ts.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;\n    var Parser;\n    (function (Parser) {\n        var scanner = ts.createScanner(5, true);\n        var disallowInAndDecoratorContext = 2048 | 8192;\n        var NodeConstructor;\n        var TokenConstructor;\n        var IdentifierConstructor;\n        var SourceFileConstructor;\n        var sourceFile;\n        var parseDiagnostics;\n        var syntaxCursor;\n        var currentToken;\n        var sourceText;\n        var nodeCount;\n        var identifiers;\n        var identifierCount;\n        var parsingContext;\n        var contextFlags;\n        var parseErrorBeforeNextFinishedNode = false;\n        function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes, scriptKind) {\n            scriptKind = ts.ensureScriptKind(fileName, scriptKind);\n            initializeState(sourceText, languageVersion, syntaxCursor, scriptKind);\n            var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind);\n            clearState();\n            return result;\n        }\n        Parser.parseSourceFile = parseSourceFile;\n        function parseIsolatedEntityName(content, languageVersion) {\n            initializeState(content, languageVersion, undefined, 1);\n            nextToken();\n            var entityName = parseEntityName(true);\n            var isInvalid = token() === 1 && !parseDiagnostics.length;\n            clearState();\n            return isInvalid ? entityName : undefined;\n        }\n        Parser.parseIsolatedEntityName = parseIsolatedEntityName;\n        function getLanguageVariant(scriptKind) {\n            return scriptKind === 4 || scriptKind === 2 || scriptKind === 1 ? 1 : 0;\n        }\n        function initializeState(_sourceText, languageVersion, _syntaxCursor, scriptKind) {\n            NodeConstructor = ts.objectAllocator.getNodeConstructor();\n            TokenConstructor = ts.objectAllocator.getTokenConstructor();\n            IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor();\n            SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor();\n            sourceText = _sourceText;\n            syntaxCursor = _syntaxCursor;\n            parseDiagnostics = [];\n            parsingContext = 0;\n            identifiers = ts.createMap();\n            identifierCount = 0;\n            nodeCount = 0;\n            contextFlags = scriptKind === 1 || scriptKind === 2 ? 65536 : 0;\n            parseErrorBeforeNextFinishedNode = false;\n            scanner.setText(sourceText);\n            scanner.setOnError(scanError);\n            scanner.setScriptTarget(languageVersion);\n            scanner.setLanguageVariant(getLanguageVariant(scriptKind));\n        }\n        function clearState() {\n            scanner.setText(\"\");\n            scanner.setOnError(undefined);\n            parseDiagnostics = undefined;\n            sourceFile = undefined;\n            identifiers = undefined;\n            syntaxCursor = undefined;\n            sourceText = undefined;\n        }\n        function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) {\n            sourceFile = createSourceFile(fileName, languageVersion, scriptKind);\n            sourceFile.flags = contextFlags;\n            nextToken();\n            processReferenceComments(sourceFile);\n            sourceFile.statements = parseList(0, parseStatement);\n            ts.Debug.assert(token() === 1);\n            sourceFile.endOfFileToken = parseTokenNode();\n            setExternalModuleIndicator(sourceFile);\n            sourceFile.nodeCount = nodeCount;\n            sourceFile.identifierCount = identifierCount;\n            sourceFile.identifiers = identifiers;\n            sourceFile.parseDiagnostics = parseDiagnostics;\n            if (setParentNodes) {\n                fixupParentReferences(sourceFile);\n            }\n            return sourceFile;\n        }\n        function addJSDocComment(node) {\n            var comments = ts.getJSDocCommentRanges(node, sourceFile.text);\n            if (comments) {\n                for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) {\n                    var comment = comments_2[_i];\n                    var jsDoc = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos);\n                    if (!jsDoc) {\n                        continue;\n                    }\n                    if (!node.jsDoc) {\n                        node.jsDoc = [];\n                    }\n                    node.jsDoc.push(jsDoc);\n                }\n            }\n            return node;\n        }\n        function fixupParentReferences(rootNode) {\n            var parent = rootNode;\n            forEachChild(rootNode, visitNode);\n            return;\n            function visitNode(n) {\n                if (n.parent !== parent) {\n                    n.parent = parent;\n                    var saveParent = parent;\n                    parent = n;\n                    forEachChild(n, visitNode);\n                    if (n.jsDoc) {\n                        for (var _i = 0, _a = n.jsDoc; _i < _a.length; _i++) {\n                            var jsDoc = _a[_i];\n                            jsDoc.parent = n;\n                            parent = jsDoc;\n                            forEachChild(jsDoc, visitNode);\n                        }\n                    }\n                    parent = saveParent;\n                }\n            }\n        }\n        Parser.fixupParentReferences = fixupParentReferences;\n        function createSourceFile(fileName, languageVersion, scriptKind) {\n            var sourceFile = new SourceFileConstructor(261, 0, sourceText.length);\n            nodeCount++;\n            sourceFile.text = sourceText;\n            sourceFile.bindDiagnostics = [];\n            sourceFile.languageVersion = languageVersion;\n            sourceFile.fileName = ts.normalizePath(fileName);\n            sourceFile.languageVariant = getLanguageVariant(scriptKind);\n            sourceFile.isDeclarationFile = ts.fileExtensionIs(sourceFile.fileName, \".d.ts\");\n            sourceFile.scriptKind = scriptKind;\n            return sourceFile;\n        }\n        function setContextFlag(val, flag) {\n            if (val) {\n                contextFlags |= flag;\n            }\n            else {\n                contextFlags &= ~flag;\n            }\n        }\n        function setDisallowInContext(val) {\n            setContextFlag(val, 2048);\n        }\n        function setYieldContext(val) {\n            setContextFlag(val, 4096);\n        }\n        function setDecoratorContext(val) {\n            setContextFlag(val, 8192);\n        }\n        function setAwaitContext(val) {\n            setContextFlag(val, 16384);\n        }\n        function doOutsideOfContext(context, func) {\n            var contextFlagsToClear = context & contextFlags;\n            if (contextFlagsToClear) {\n                setContextFlag(false, contextFlagsToClear);\n                var result = func();\n                setContextFlag(true, contextFlagsToClear);\n                return result;\n            }\n            return func();\n        }\n        function doInsideOfContext(context, func) {\n            var contextFlagsToSet = context & ~contextFlags;\n            if (contextFlagsToSet) {\n                setContextFlag(true, contextFlagsToSet);\n                var result = func();\n                setContextFlag(false, contextFlagsToSet);\n                return result;\n            }\n            return func();\n        }\n        function allowInAnd(func) {\n            return doOutsideOfContext(2048, func);\n        }\n        function disallowInAnd(func) {\n            return doInsideOfContext(2048, func);\n        }\n        function doInYieldContext(func) {\n            return doInsideOfContext(4096, func);\n        }\n        function doInDecoratorContext(func) {\n            return doInsideOfContext(8192, func);\n        }\n        function doInAwaitContext(func) {\n            return doInsideOfContext(16384, func);\n        }\n        function doOutsideOfAwaitContext(func) {\n            return doOutsideOfContext(16384, func);\n        }\n        function doInYieldAndAwaitContext(func) {\n            return doInsideOfContext(4096 | 16384, func);\n        }\n        function inContext(flags) {\n            return (contextFlags & flags) !== 0;\n        }\n        function inYieldContext() {\n            return inContext(4096);\n        }\n        function inDisallowInContext() {\n            return inContext(2048);\n        }\n        function inDecoratorContext() {\n            return inContext(8192);\n        }\n        function inAwaitContext() {\n            return inContext(16384);\n        }\n        function parseErrorAtCurrentToken(message, arg0) {\n            var start = scanner.getTokenPos();\n            var length = scanner.getTextPos() - start;\n            parseErrorAtPosition(start, length, message, arg0);\n        }\n        function parseErrorAtPosition(start, length, message, arg0) {\n            var lastError = ts.lastOrUndefined(parseDiagnostics);\n            if (!lastError || start !== lastError.start) {\n                parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, start, length, message, arg0));\n            }\n            parseErrorBeforeNextFinishedNode = true;\n        }\n        function scanError(message, length) {\n            var pos = scanner.getTextPos();\n            parseErrorAtPosition(pos, length || 0, message);\n        }\n        function getNodePos() {\n            return scanner.getStartPos();\n        }\n        function getNodeEnd() {\n            return scanner.getStartPos();\n        }\n        function token() {\n            return currentToken;\n        }\n        function nextToken() {\n            return currentToken = scanner.scan();\n        }\n        function reScanGreaterToken() {\n            return currentToken = scanner.reScanGreaterToken();\n        }\n        function reScanSlashToken() {\n            return currentToken = scanner.reScanSlashToken();\n        }\n        function reScanTemplateToken() {\n            return currentToken = scanner.reScanTemplateToken();\n        }\n        function scanJsxIdentifier() {\n            return currentToken = scanner.scanJsxIdentifier();\n        }\n        function scanJsxText() {\n            return currentToken = scanner.scanJsxToken();\n        }\n        function scanJsxAttributeValue() {\n            return currentToken = scanner.scanJsxAttributeValue();\n        }\n        function speculationHelper(callback, isLookAhead) {\n            var saveToken = currentToken;\n            var saveParseDiagnosticsLength = parseDiagnostics.length;\n            var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;\n            var saveContextFlags = contextFlags;\n            var result = isLookAhead\n                ? scanner.lookAhead(callback)\n                : scanner.tryScan(callback);\n            ts.Debug.assert(saveContextFlags === contextFlags);\n            if (!result || isLookAhead) {\n                currentToken = saveToken;\n                parseDiagnostics.length = saveParseDiagnosticsLength;\n                parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode;\n            }\n            return result;\n        }\n        function lookAhead(callback) {\n            return speculationHelper(callback, true);\n        }\n        function tryParse(callback) {\n            return speculationHelper(callback, false);\n        }\n        function isIdentifier() {\n            if (token() === 70) {\n                return true;\n            }\n            if (token() === 115 && inYieldContext()) {\n                return false;\n            }\n            if (token() === 120 && inAwaitContext()) {\n                return false;\n            }\n            return token() > 106;\n        }\n        function parseExpected(kind, diagnosticMessage, shouldAdvance) {\n            if (shouldAdvance === void 0) { shouldAdvance = true; }\n            if (token() === kind) {\n                if (shouldAdvance) {\n                    nextToken();\n                }\n                return true;\n            }\n            if (diagnosticMessage) {\n                parseErrorAtCurrentToken(diagnosticMessage);\n            }\n            else {\n                parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));\n            }\n            return false;\n        }\n        function parseOptional(t) {\n            if (token() === t) {\n                nextToken();\n                return true;\n            }\n            return false;\n        }\n        function parseOptionalToken(t) {\n            if (token() === t) {\n                return parseTokenNode();\n            }\n            return undefined;\n        }\n        function parseExpectedToken(t, reportAtCurrentPosition, diagnosticMessage, arg0) {\n            return parseOptionalToken(t) ||\n                createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0);\n        }\n        function parseTokenNode() {\n            var node = createNode(token());\n            nextToken();\n            return finishNode(node);\n        }\n        function canParseSemicolon() {\n            if (token() === 24) {\n                return true;\n            }\n            return token() === 17 || token() === 1 || scanner.hasPrecedingLineBreak();\n        }\n        function parseSemicolon() {\n            if (canParseSemicolon()) {\n                if (token() === 24) {\n                    nextToken();\n                }\n                return true;\n            }\n            else {\n                return parseExpected(24);\n            }\n        }\n        function createNode(kind, pos) {\n            nodeCount++;\n            if (!(pos >= 0)) {\n                pos = scanner.getStartPos();\n            }\n            return kind >= 141 ? new NodeConstructor(kind, pos, pos) :\n                kind === 70 ? new IdentifierConstructor(kind, pos, pos) :\n                    new TokenConstructor(kind, pos, pos);\n        }\n        function createNodeArray(elements, pos) {\n            var array = (elements || []);\n            if (!(pos >= 0)) {\n                pos = getNodePos();\n            }\n            array.pos = pos;\n            array.end = pos;\n            return array;\n        }\n        function finishNode(node, end) {\n            node.end = end === undefined ? scanner.getStartPos() : end;\n            if (contextFlags) {\n                node.flags |= contextFlags;\n            }\n            if (parseErrorBeforeNextFinishedNode) {\n                parseErrorBeforeNextFinishedNode = false;\n                node.flags |= 32768;\n            }\n            return node;\n        }\n        function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, arg0) {\n            if (reportAtCurrentPosition) {\n                parseErrorAtPosition(scanner.getStartPos(), 0, diagnosticMessage, arg0);\n            }\n            else {\n                parseErrorAtCurrentToken(diagnosticMessage, arg0);\n            }\n            var result = createNode(kind, scanner.getStartPos());\n            result.text = \"\";\n            return finishNode(result);\n        }\n        function internIdentifier(text) {\n            text = ts.escapeIdentifier(text);\n            return identifiers[text] || (identifiers[text] = text);\n        }\n        function createIdentifier(isIdentifier, diagnosticMessage) {\n            identifierCount++;\n            if (isIdentifier) {\n                var node = createNode(70);\n                if (token() !== 70) {\n                    node.originalKeywordKind = token();\n                }\n                node.text = internIdentifier(scanner.getTokenValue());\n                nextToken();\n                return finishNode(node);\n            }\n            return createMissingNode(70, false, diagnosticMessage || ts.Diagnostics.Identifier_expected);\n        }\n        function parseIdentifier(diagnosticMessage) {\n            return createIdentifier(isIdentifier(), diagnosticMessage);\n        }\n        function parseIdentifierName() {\n            return createIdentifier(ts.tokenIsIdentifierOrKeyword(token()));\n        }\n        function isLiteralPropertyName() {\n            return ts.tokenIsIdentifierOrKeyword(token()) ||\n                token() === 9 ||\n                token() === 8;\n        }\n        function parsePropertyNameWorker(allowComputedPropertyNames) {\n            if (token() === 9 || token() === 8) {\n                return parseLiteralNode(true);\n            }\n            if (allowComputedPropertyNames && token() === 20) {\n                return parseComputedPropertyName();\n            }\n            return parseIdentifierName();\n        }\n        function parsePropertyName() {\n            return parsePropertyNameWorker(true);\n        }\n        function parseSimplePropertyName() {\n            return parsePropertyNameWorker(false);\n        }\n        function isSimplePropertyName() {\n            return token() === 9 || token() === 8 || ts.tokenIsIdentifierOrKeyword(token());\n        }\n        function parseComputedPropertyName() {\n            var node = createNode(142);\n            parseExpected(20);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(21);\n            return finishNode(node);\n        }\n        function parseContextualModifier(t) {\n            return token() === t && tryParse(nextTokenCanFollowModifier);\n        }\n        function nextTokenIsOnSameLineAndCanFollowModifier() {\n            nextToken();\n            if (scanner.hasPrecedingLineBreak()) {\n                return false;\n            }\n            return canFollowModifier();\n        }\n        function nextTokenCanFollowModifier() {\n            if (token() === 75) {\n                return nextToken() === 82;\n            }\n            if (token() === 83) {\n                nextToken();\n                if (token() === 78) {\n                    return lookAhead(nextTokenIsClassOrFunctionOrAsync);\n                }\n                return token() !== 38 && token() !== 117 && token() !== 16 && canFollowModifier();\n            }\n            if (token() === 78) {\n                return nextTokenIsClassOrFunctionOrAsync();\n            }\n            if (token() === 114) {\n                nextToken();\n                return canFollowModifier();\n            }\n            return nextTokenIsOnSameLineAndCanFollowModifier();\n        }\n        function parseAnyContextualModifier() {\n            return ts.isModifierKind(token()) && tryParse(nextTokenCanFollowModifier);\n        }\n        function canFollowModifier() {\n            return token() === 20\n                || token() === 16\n                || token() === 38\n                || token() === 23\n                || isLiteralPropertyName();\n        }\n        function nextTokenIsClassOrFunctionOrAsync() {\n            nextToken();\n            return token() === 74 || token() === 88 ||\n                (token() === 119 && lookAhead(nextTokenIsFunctionKeywordOnSameLine));\n        }\n        function isListElement(parsingContext, inErrorRecovery) {\n            var node = currentNode(parsingContext);\n            if (node) {\n                return true;\n            }\n            switch (parsingContext) {\n                case 0:\n                case 1:\n                case 3:\n                    return !(token() === 24 && inErrorRecovery) && isStartOfStatement();\n                case 2:\n                    return token() === 72 || token() === 78;\n                case 4:\n                    return lookAhead(isTypeMemberStart);\n                case 5:\n                    return lookAhead(isClassMemberStart) || (token() === 24 && !inErrorRecovery);\n                case 6:\n                    return token() === 20 || isLiteralPropertyName();\n                case 12:\n                    return token() === 20 || token() === 38 || token() === 23 || isLiteralPropertyName();\n                case 17:\n                    return isLiteralPropertyName();\n                case 9:\n                    return token() === 20 || token() === 23 || isLiteralPropertyName();\n                case 7:\n                    if (token() === 16) {\n                        return lookAhead(isValidHeritageClauseObjectLiteral);\n                    }\n                    if (!inErrorRecovery) {\n                        return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword();\n                    }\n                    else {\n                        return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword();\n                    }\n                case 8:\n                    return isIdentifierOrPattern();\n                case 10:\n                    return token() === 25 || token() === 23 || isIdentifierOrPattern();\n                case 18:\n                    return isIdentifier();\n                case 11:\n                case 15:\n                    return token() === 25 || token() === 23 || isStartOfExpression();\n                case 16:\n                    return isStartOfParameter();\n                case 19:\n                case 20:\n                    return token() === 25 || isStartOfType();\n                case 21:\n                    return isHeritageClause();\n                case 22:\n                    return ts.tokenIsIdentifierOrKeyword(token());\n                case 13:\n                    return ts.tokenIsIdentifierOrKeyword(token()) || token() === 16;\n                case 14:\n                    return true;\n                case 23:\n                case 24:\n                case 26:\n                    return JSDocParser.isJSDocType();\n                case 25:\n                    return isSimplePropertyName();\n            }\n            ts.Debug.fail(\"Non-exhaustive case in 'isListElement'.\");\n        }\n        function isValidHeritageClauseObjectLiteral() {\n            ts.Debug.assert(token() === 16);\n            if (nextToken() === 17) {\n                var next = nextToken();\n                return next === 25 || next === 16 || next === 84 || next === 107;\n            }\n            return true;\n        }\n        function nextTokenIsIdentifier() {\n            nextToken();\n            return isIdentifier();\n        }\n        function nextTokenIsIdentifierOrKeyword() {\n            nextToken();\n            return ts.tokenIsIdentifierOrKeyword(token());\n        }\n        function isHeritageClauseExtendsOrImplementsKeyword() {\n            if (token() === 107 ||\n                token() === 84) {\n                return lookAhead(nextTokenIsStartOfExpression);\n            }\n            return false;\n        }\n        function nextTokenIsStartOfExpression() {\n            nextToken();\n            return isStartOfExpression();\n        }\n        function isListTerminator(kind) {\n            if (token() === 1) {\n                return true;\n            }\n            switch (kind) {\n                case 1:\n                case 2:\n                case 4:\n                case 5:\n                case 6:\n                case 12:\n                case 9:\n                case 22:\n                    return token() === 17;\n                case 3:\n                    return token() === 17 || token() === 72 || token() === 78;\n                case 7:\n                    return token() === 16 || token() === 84 || token() === 107;\n                case 8:\n                    return isVariableDeclaratorListTerminator();\n                case 18:\n                    return token() === 28 || token() === 18 || token() === 16 || token() === 84 || token() === 107;\n                case 11:\n                    return token() === 19 || token() === 24;\n                case 15:\n                case 20:\n                case 10:\n                    return token() === 21;\n                case 16:\n                case 17:\n                    return token() === 19 || token() === 21;\n                case 19:\n                    return token() !== 25;\n                case 21:\n                    return token() === 16 || token() === 17;\n                case 13:\n                    return token() === 28 || token() === 40;\n                case 14:\n                    return token() === 26 && lookAhead(nextTokenIsSlash);\n                case 23:\n                    return token() === 19 || token() === 55 || token() === 17;\n                case 24:\n                    return token() === 28 || token() === 17;\n                case 26:\n                    return token() === 21 || token() === 17;\n                case 25:\n                    return token() === 17;\n            }\n        }\n        function isVariableDeclaratorListTerminator() {\n            if (canParseSemicolon()) {\n                return true;\n            }\n            if (isInOrOfKeyword(token())) {\n                return true;\n            }\n            if (token() === 35) {\n                return true;\n            }\n            return false;\n        }\n        function isInSomeParsingContext() {\n            for (var kind = 0; kind < 27; kind++) {\n                if (parsingContext & (1 << kind)) {\n                    if (isListElement(kind, true) || isListTerminator(kind)) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function parseList(kind, parseElement) {\n            var saveParsingContext = parsingContext;\n            parsingContext |= 1 << kind;\n            var result = createNodeArray();\n            while (!isListTerminator(kind)) {\n                if (isListElement(kind, false)) {\n                    var element = parseListElement(kind, parseElement);\n                    result.push(element);\n                    continue;\n                }\n                if (abortParsingListOrMoveToNextToken(kind)) {\n                    break;\n                }\n            }\n            result.end = getNodeEnd();\n            parsingContext = saveParsingContext;\n            return result;\n        }\n        function parseListElement(parsingContext, parseElement) {\n            var node = currentNode(parsingContext);\n            if (node) {\n                return consumeNode(node);\n            }\n            return parseElement();\n        }\n        function currentNode(parsingContext) {\n            if (parseErrorBeforeNextFinishedNode) {\n                return undefined;\n            }\n            if (!syntaxCursor) {\n                return undefined;\n            }\n            var node = syntaxCursor.currentNode(scanner.getStartPos());\n            if (ts.nodeIsMissing(node)) {\n                return undefined;\n            }\n            if (node.intersectsChange) {\n                return undefined;\n            }\n            if (ts.containsParseError(node)) {\n                return undefined;\n            }\n            var nodeContextFlags = node.flags & 96256;\n            if (nodeContextFlags !== contextFlags) {\n                return undefined;\n            }\n            if (!canReuseNode(node, parsingContext)) {\n                return undefined;\n            }\n            return node;\n        }\n        function consumeNode(node) {\n            scanner.setTextPos(node.end);\n            nextToken();\n            return node;\n        }\n        function canReuseNode(node, parsingContext) {\n            switch (parsingContext) {\n                case 5:\n                    return isReusableClassMember(node);\n                case 2:\n                    return isReusableSwitchClause(node);\n                case 0:\n                case 1:\n                case 3:\n                    return isReusableStatement(node);\n                case 6:\n                    return isReusableEnumMember(node);\n                case 4:\n                    return isReusableTypeMember(node);\n                case 8:\n                    return isReusableVariableDeclaration(node);\n                case 16:\n                    return isReusableParameter(node);\n                case 17:\n                    return false;\n                case 21:\n                case 18:\n                case 20:\n                case 19:\n                case 11:\n                case 12:\n                case 7:\n                case 13:\n                case 14:\n            }\n            return false;\n        }\n        function isReusableClassMember(node) {\n            if (node) {\n                switch (node.kind) {\n                    case 150:\n                    case 155:\n                    case 151:\n                    case 152:\n                    case 147:\n                    case 203:\n                        return true;\n                    case 149:\n                        var methodDeclaration = node;\n                        var nameIsConstructor = methodDeclaration.name.kind === 70 &&\n                            methodDeclaration.name.originalKeywordKind === 122;\n                        return !nameIsConstructor;\n                }\n            }\n            return false;\n        }\n        function isReusableSwitchClause(node) {\n            if (node) {\n                switch (node.kind) {\n                    case 253:\n                    case 254:\n                        return true;\n                }\n            }\n            return false;\n        }\n        function isReusableStatement(node) {\n            if (node) {\n                switch (node.kind) {\n                    case 225:\n                    case 205:\n                    case 204:\n                    case 208:\n                    case 207:\n                    case 220:\n                    case 216:\n                    case 218:\n                    case 215:\n                    case 214:\n                    case 212:\n                    case 213:\n                    case 211:\n                    case 210:\n                    case 217:\n                    case 206:\n                    case 221:\n                    case 219:\n                    case 209:\n                    case 222:\n                    case 235:\n                    case 234:\n                    case 241:\n                    case 240:\n                    case 230:\n                    case 226:\n                    case 227:\n                    case 229:\n                    case 228:\n                        return true;\n                }\n            }\n            return false;\n        }\n        function isReusableEnumMember(node) {\n            return node.kind === 260;\n        }\n        function isReusableTypeMember(node) {\n            if (node) {\n                switch (node.kind) {\n                    case 154:\n                    case 148:\n                    case 155:\n                    case 146:\n                    case 153:\n                        return true;\n                }\n            }\n            return false;\n        }\n        function isReusableVariableDeclaration(node) {\n            if (node.kind !== 223) {\n                return false;\n            }\n            var variableDeclarator = node;\n            return variableDeclarator.initializer === undefined;\n        }\n        function isReusableParameter(node) {\n            if (node.kind !== 144) {\n                return false;\n            }\n            var parameter = node;\n            return parameter.initializer === undefined;\n        }\n        function abortParsingListOrMoveToNextToken(kind) {\n            parseErrorAtCurrentToken(parsingContextErrors(kind));\n            if (isInSomeParsingContext()) {\n                return true;\n            }\n            nextToken();\n            return false;\n        }\n        function parsingContextErrors(context) {\n            switch (context) {\n                case 0: return ts.Diagnostics.Declaration_or_statement_expected;\n                case 1: return ts.Diagnostics.Declaration_or_statement_expected;\n                case 2: return ts.Diagnostics.case_or_default_expected;\n                case 3: return ts.Diagnostics.Statement_expected;\n                case 17:\n                case 4: return ts.Diagnostics.Property_or_signature_expected;\n                case 5: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected;\n                case 6: return ts.Diagnostics.Enum_member_expected;\n                case 7: return ts.Diagnostics.Expression_expected;\n                case 8: return ts.Diagnostics.Variable_declaration_expected;\n                case 9: return ts.Diagnostics.Property_destructuring_pattern_expected;\n                case 10: return ts.Diagnostics.Array_element_destructuring_pattern_expected;\n                case 11: return ts.Diagnostics.Argument_expression_expected;\n                case 12: return ts.Diagnostics.Property_assignment_expected;\n                case 15: return ts.Diagnostics.Expression_or_comma_expected;\n                case 16: return ts.Diagnostics.Parameter_declaration_expected;\n                case 18: return ts.Diagnostics.Type_parameter_declaration_expected;\n                case 19: return ts.Diagnostics.Type_argument_expected;\n                case 20: return ts.Diagnostics.Type_expected;\n                case 21: return ts.Diagnostics.Unexpected_token_expected;\n                case 22: return ts.Diagnostics.Identifier_expected;\n                case 13: return ts.Diagnostics.Identifier_expected;\n                case 14: return ts.Diagnostics.Identifier_expected;\n                case 23: return ts.Diagnostics.Parameter_declaration_expected;\n                case 24: return ts.Diagnostics.Type_argument_expected;\n                case 26: return ts.Diagnostics.Type_expected;\n                case 25: return ts.Diagnostics.Property_assignment_expected;\n            }\n        }\n        ;\n        function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) {\n            var saveParsingContext = parsingContext;\n            parsingContext |= 1 << kind;\n            var result = createNodeArray();\n            var commaStart = -1;\n            while (true) {\n                if (isListElement(kind, false)) {\n                    result.push(parseListElement(kind, parseElement));\n                    commaStart = scanner.getTokenPos();\n                    if (parseOptional(25)) {\n                        continue;\n                    }\n                    commaStart = -1;\n                    if (isListTerminator(kind)) {\n                        break;\n                    }\n                    parseExpected(25);\n                    if (considerSemicolonAsDelimiter && token() === 24 && !scanner.hasPrecedingLineBreak()) {\n                        nextToken();\n                    }\n                    continue;\n                }\n                if (isListTerminator(kind)) {\n                    break;\n                }\n                if (abortParsingListOrMoveToNextToken(kind)) {\n                    break;\n                }\n            }\n            if (commaStart >= 0) {\n                result.hasTrailingComma = true;\n            }\n            result.end = getNodeEnd();\n            parsingContext = saveParsingContext;\n            return result;\n        }\n        function createMissingList() {\n            return createNodeArray();\n        }\n        function parseBracketedList(kind, parseElement, open, close) {\n            if (parseExpected(open)) {\n                var result = parseDelimitedList(kind, parseElement);\n                parseExpected(close);\n                return result;\n            }\n            return createMissingList();\n        }\n        function parseEntityName(allowReservedWords, diagnosticMessage) {\n            var entity = parseIdentifier(diagnosticMessage);\n            while (parseOptional(22)) {\n                var node = createNode(141, entity.pos);\n                node.left = entity;\n                node.right = parseRightSideOfDot(allowReservedWords);\n                entity = finishNode(node);\n            }\n            return entity;\n        }\n        function parseRightSideOfDot(allowIdentifierNames) {\n            if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token())) {\n                var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);\n                if (matchesPattern) {\n                    return createMissingNode(70, true, ts.Diagnostics.Identifier_expected);\n                }\n            }\n            return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();\n        }\n        function parseTemplateExpression() {\n            var template = createNode(194);\n            template.head = parseTemplateHead();\n            ts.Debug.assert(template.head.kind === 13, \"Template head has wrong token kind\");\n            var templateSpans = createNodeArray();\n            do {\n                templateSpans.push(parseTemplateSpan());\n            } while (ts.lastOrUndefined(templateSpans).literal.kind === 14);\n            templateSpans.end = getNodeEnd();\n            template.templateSpans = templateSpans;\n            return finishNode(template);\n        }\n        function parseTemplateSpan() {\n            var span = createNode(202);\n            span.expression = allowInAnd(parseExpression);\n            var literal;\n            if (token() === 17) {\n                reScanTemplateToken();\n                literal = parseTemplateMiddleOrTemplateTail();\n            }\n            else {\n                literal = parseExpectedToken(15, false, ts.Diagnostics._0_expected, ts.tokenToString(17));\n            }\n            span.literal = literal;\n            return finishNode(span);\n        }\n        function parseLiteralNode(internName) {\n            return parseLiteralLikeNode(token(), internName);\n        }\n        function parseTemplateHead() {\n            var fragment = parseLiteralLikeNode(token(), false);\n            ts.Debug.assert(fragment.kind === 13, \"Template head has wrong token kind\");\n            return fragment;\n        }\n        function parseTemplateMiddleOrTemplateTail() {\n            var fragment = parseLiteralLikeNode(token(), false);\n            ts.Debug.assert(fragment.kind === 14 || fragment.kind === 15, \"Template fragment has wrong token kind\");\n            return fragment;\n        }\n        function parseLiteralLikeNode(kind, internName) {\n            var node = createNode(kind);\n            var text = scanner.getTokenValue();\n            node.text = internName ? internIdentifier(text) : text;\n            if (scanner.hasExtendedUnicodeEscape()) {\n                node.hasExtendedUnicodeEscape = true;\n            }\n            if (scanner.isUnterminated()) {\n                node.isUnterminated = true;\n            }\n            var tokenPos = scanner.getTokenPos();\n            nextToken();\n            finishNode(node);\n            if (node.kind === 8\n                && sourceText.charCodeAt(tokenPos) === 48\n                && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) {\n                node.isOctalLiteral = true;\n            }\n            return node;\n        }\n        function parseTypeReference() {\n            var typeName = parseEntityName(false, ts.Diagnostics.Type_expected);\n            var node = createNode(157, typeName.pos);\n            node.typeName = typeName;\n            if (!scanner.hasPrecedingLineBreak() && token() === 26) {\n                node.typeArguments = parseBracketedList(19, parseType, 26, 28);\n            }\n            return finishNode(node);\n        }\n        function parseThisTypePredicate(lhs) {\n            nextToken();\n            var node = createNode(156, lhs.pos);\n            node.parameterName = lhs;\n            node.type = parseType();\n            return finishNode(node);\n        }\n        function parseThisTypeNode() {\n            var node = createNode(167);\n            nextToken();\n            return finishNode(node);\n        }\n        function parseTypeQuery() {\n            var node = createNode(160);\n            parseExpected(102);\n            node.exprName = parseEntityName(true);\n            return finishNode(node);\n        }\n        function parseTypeParameter() {\n            var node = createNode(143);\n            node.name = parseIdentifier();\n            if (parseOptional(84)) {\n                if (isStartOfType() || !isStartOfExpression()) {\n                    node.constraint = parseType();\n                }\n                else {\n                    node.expression = parseUnaryExpressionOrHigher();\n                }\n            }\n            return finishNode(node);\n        }\n        function parseTypeParameters() {\n            if (token() === 26) {\n                return parseBracketedList(18, parseTypeParameter, 26, 28);\n            }\n        }\n        function parseParameterType() {\n            if (parseOptional(55)) {\n                return parseType();\n            }\n            return undefined;\n        }\n        function isStartOfParameter() {\n            return token() === 23 || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 56 || token() === 98;\n        }\n        function parseParameter() {\n            var node = createNode(144);\n            if (token() === 98) {\n                node.name = createIdentifier(true, undefined);\n                node.type = parseParameterType();\n                return finishNode(node);\n            }\n            node.decorators = parseDecorators();\n            node.modifiers = parseModifiers();\n            node.dotDotDotToken = parseOptionalToken(23);\n            node.name = parseIdentifierOrPattern();\n            if (ts.getFullWidth(node.name) === 0 && !ts.hasModifiers(node) && ts.isModifierKind(token())) {\n                nextToken();\n            }\n            node.questionToken = parseOptionalToken(54);\n            node.type = parseParameterType();\n            node.initializer = parseBindingElementInitializer(true);\n            return addJSDocComment(finishNode(node));\n        }\n        function parseBindingElementInitializer(inParameter) {\n            return inParameter ? parseParameterInitializer() : parseNonParameterInitializer();\n        }\n        function parseParameterInitializer() {\n            return parseInitializer(true);\n        }\n        function fillSignature(returnToken, yieldContext, awaitContext, requireCompleteParameterList, signature) {\n            var returnTokenRequired = returnToken === 35;\n            signature.typeParameters = parseTypeParameters();\n            signature.parameters = parseParameterList(yieldContext, awaitContext, requireCompleteParameterList);\n            if (returnTokenRequired) {\n                parseExpected(returnToken);\n                signature.type = parseTypeOrTypePredicate();\n            }\n            else if (parseOptional(returnToken)) {\n                signature.type = parseTypeOrTypePredicate();\n            }\n        }\n        function parseParameterList(yieldContext, awaitContext, requireCompleteParameterList) {\n            if (parseExpected(18)) {\n                var savedYieldContext = inYieldContext();\n                var savedAwaitContext = inAwaitContext();\n                setYieldContext(yieldContext);\n                setAwaitContext(awaitContext);\n                var result = parseDelimitedList(16, parseParameter);\n                setYieldContext(savedYieldContext);\n                setAwaitContext(savedAwaitContext);\n                if (!parseExpected(19) && requireCompleteParameterList) {\n                    return undefined;\n                }\n                return result;\n            }\n            return requireCompleteParameterList ? undefined : createMissingList();\n        }\n        function parseTypeMemberSemicolon() {\n            if (parseOptional(25)) {\n                return;\n            }\n            parseSemicolon();\n        }\n        function parseSignatureMember(kind) {\n            var node = createNode(kind);\n            if (kind === 154) {\n                parseExpected(93);\n            }\n            fillSignature(55, false, false, false, node);\n            parseTypeMemberSemicolon();\n            return addJSDocComment(finishNode(node));\n        }\n        function isIndexSignature() {\n            if (token() !== 20) {\n                return false;\n            }\n            return lookAhead(isUnambiguouslyIndexSignature);\n        }\n        function isUnambiguouslyIndexSignature() {\n            nextToken();\n            if (token() === 23 || token() === 21) {\n                return true;\n            }\n            if (ts.isModifierKind(token())) {\n                nextToken();\n                if (isIdentifier()) {\n                    return true;\n                }\n            }\n            else if (!isIdentifier()) {\n                return false;\n            }\n            else {\n                nextToken();\n            }\n            if (token() === 55 || token() === 25) {\n                return true;\n            }\n            if (token() !== 54) {\n                return false;\n            }\n            nextToken();\n            return token() === 55 || token() === 25 || token() === 21;\n        }\n        function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(155, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            node.parameters = parseBracketedList(16, parseParameter, 20, 21);\n            node.type = parseTypeAnnotation();\n            parseTypeMemberSemicolon();\n            return finishNode(node);\n        }\n        function parsePropertyOrMethodSignature(fullStart, modifiers) {\n            var name = parsePropertyName();\n            var questionToken = parseOptionalToken(54);\n            if (token() === 18 || token() === 26) {\n                var method = createNode(148, fullStart);\n                method.modifiers = modifiers;\n                method.name = name;\n                method.questionToken = questionToken;\n                fillSignature(55, false, false, false, method);\n                parseTypeMemberSemicolon();\n                return addJSDocComment(finishNode(method));\n            }\n            else {\n                var property = createNode(146, fullStart);\n                property.modifiers = modifiers;\n                property.name = name;\n                property.questionToken = questionToken;\n                property.type = parseTypeAnnotation();\n                if (token() === 57) {\n                    property.initializer = parseNonParameterInitializer();\n                }\n                parseTypeMemberSemicolon();\n                return addJSDocComment(finishNode(property));\n            }\n        }\n        function isTypeMemberStart() {\n            var idToken;\n            if (token() === 18 || token() === 26) {\n                return true;\n            }\n            while (ts.isModifierKind(token())) {\n                idToken = token();\n                nextToken();\n            }\n            if (token() === 20) {\n                return true;\n            }\n            if (isLiteralPropertyName()) {\n                idToken = token();\n                nextToken();\n            }\n            if (idToken) {\n                return token() === 18 ||\n                    token() === 26 ||\n                    token() === 54 ||\n                    token() === 55 ||\n                    token() === 25 ||\n                    canParseSemicolon();\n            }\n            return false;\n        }\n        function parseTypeMember() {\n            if (token() === 18 || token() === 26) {\n                return parseSignatureMember(153);\n            }\n            if (token() === 93 && lookAhead(isStartOfConstructSignature)) {\n                return parseSignatureMember(154);\n            }\n            var fullStart = getNodePos();\n            var modifiers = parseModifiers();\n            if (isIndexSignature()) {\n                return parseIndexSignatureDeclaration(fullStart, undefined, modifiers);\n            }\n            return parsePropertyOrMethodSignature(fullStart, modifiers);\n        }\n        function isStartOfConstructSignature() {\n            nextToken();\n            return token() === 18 || token() === 26;\n        }\n        function parseTypeLiteral() {\n            var node = createNode(161);\n            node.members = parseObjectTypeMembers();\n            return finishNode(node);\n        }\n        function parseObjectTypeMembers() {\n            var members;\n            if (parseExpected(16)) {\n                members = parseList(4, parseTypeMember);\n                parseExpected(17);\n            }\n            else {\n                members = createMissingList();\n            }\n            return members;\n        }\n        function isStartOfMappedType() {\n            nextToken();\n            if (token() === 130) {\n                nextToken();\n            }\n            return token() === 20 && nextTokenIsIdentifier() && nextToken() === 91;\n        }\n        function parseMappedTypeParameter() {\n            var node = createNode(143);\n            node.name = parseIdentifier();\n            parseExpected(91);\n            node.constraint = parseType();\n            return finishNode(node);\n        }\n        function parseMappedType() {\n            var node = createNode(170);\n            parseExpected(16);\n            node.readonlyToken = parseOptionalToken(130);\n            parseExpected(20);\n            node.typeParameter = parseMappedTypeParameter();\n            parseExpected(21);\n            node.questionToken = parseOptionalToken(54);\n            node.type = parseTypeAnnotation();\n            parseSemicolon();\n            parseExpected(17);\n            return finishNode(node);\n        }\n        function parseTupleType() {\n            var node = createNode(163);\n            node.elementTypes = parseBracketedList(20, parseType, 20, 21);\n            return finishNode(node);\n        }\n        function parseParenthesizedType() {\n            var node = createNode(166);\n            parseExpected(18);\n            node.type = parseType();\n            parseExpected(19);\n            return finishNode(node);\n        }\n        function parseFunctionOrConstructorType(kind) {\n            var node = createNode(kind);\n            if (kind === 159) {\n                parseExpected(93);\n            }\n            fillSignature(35, false, false, false, node);\n            return finishNode(node);\n        }\n        function parseKeywordAndNoDot() {\n            var node = parseTokenNode();\n            return token() === 22 ? undefined : node;\n        }\n        function parseLiteralTypeNode() {\n            var node = createNode(171);\n            node.literal = parseSimpleUnaryExpression();\n            finishNode(node);\n            return node;\n        }\n        function nextTokenIsNumericLiteral() {\n            return nextToken() === 8;\n        }\n        function parseNonArrayType() {\n            switch (token()) {\n                case 118:\n                case 134:\n                case 132:\n                case 121:\n                case 135:\n                case 137:\n                case 129:\n                    var node = tryParse(parseKeywordAndNoDot);\n                    return node || parseTypeReference();\n                case 9:\n                case 8:\n                case 100:\n                case 85:\n                    return parseLiteralTypeNode();\n                case 37:\n                    return lookAhead(nextTokenIsNumericLiteral) ? parseLiteralTypeNode() : parseTypeReference();\n                case 104:\n                case 94:\n                    return parseTokenNode();\n                case 98: {\n                    var thisKeyword = parseThisTypeNode();\n                    if (token() === 125 && !scanner.hasPrecedingLineBreak()) {\n                        return parseThisTypePredicate(thisKeyword);\n                    }\n                    else {\n                        return thisKeyword;\n                    }\n                }\n                case 102:\n                    return parseTypeQuery();\n                case 16:\n                    return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral();\n                case 20:\n                    return parseTupleType();\n                case 18:\n                    return parseParenthesizedType();\n                default:\n                    return parseTypeReference();\n            }\n        }\n        function isStartOfType() {\n            switch (token()) {\n                case 118:\n                case 134:\n                case 132:\n                case 121:\n                case 135:\n                case 104:\n                case 137:\n                case 94:\n                case 98:\n                case 102:\n                case 129:\n                case 16:\n                case 20:\n                case 26:\n                case 48:\n                case 47:\n                case 93:\n                case 9:\n                case 8:\n                case 100:\n                case 85:\n                    return true;\n                case 37:\n                    return lookAhead(nextTokenIsNumericLiteral);\n                case 18:\n                    return lookAhead(isStartOfParenthesizedOrFunctionType);\n                default:\n                    return isIdentifier();\n            }\n        }\n        function isStartOfParenthesizedOrFunctionType() {\n            nextToken();\n            return token() === 19 || isStartOfParameter() || isStartOfType();\n        }\n        function parseArrayTypeOrHigher() {\n            var type = parseNonArrayType();\n            while (!scanner.hasPrecedingLineBreak() && parseOptional(20)) {\n                if (isStartOfType()) {\n                    var node = createNode(169, type.pos);\n                    node.objectType = type;\n                    node.indexType = parseType();\n                    parseExpected(21);\n                    type = finishNode(node);\n                }\n                else {\n                    var node = createNode(162, type.pos);\n                    node.elementType = type;\n                    parseExpected(21);\n                    type = finishNode(node);\n                }\n            }\n            return type;\n        }\n        function parseTypeOperator(operator) {\n            var node = createNode(168);\n            parseExpected(operator);\n            node.operator = operator;\n            node.type = parseTypeOperatorOrHigher();\n            return finishNode(node);\n        }\n        function parseTypeOperatorOrHigher() {\n            switch (token()) {\n                case 126:\n                    return parseTypeOperator(126);\n            }\n            return parseArrayTypeOrHigher();\n        }\n        function parseUnionOrIntersectionType(kind, parseConstituentType, operator) {\n            parseOptional(operator);\n            var type = parseConstituentType();\n            if (token() === operator) {\n                var types = createNodeArray([type], type.pos);\n                while (parseOptional(operator)) {\n                    types.push(parseConstituentType());\n                }\n                types.end = getNodeEnd();\n                var node = createNode(kind, type.pos);\n                node.types = types;\n                type = finishNode(node);\n            }\n            return type;\n        }\n        function parseIntersectionTypeOrHigher() {\n            return parseUnionOrIntersectionType(165, parseTypeOperatorOrHigher, 47);\n        }\n        function parseUnionTypeOrHigher() {\n            return parseUnionOrIntersectionType(164, parseIntersectionTypeOrHigher, 48);\n        }\n        function isStartOfFunctionType() {\n            if (token() === 26) {\n                return true;\n            }\n            return token() === 18 && lookAhead(isUnambiguouslyStartOfFunctionType);\n        }\n        function skipParameterStart() {\n            if (ts.isModifierKind(token())) {\n                parseModifiers();\n            }\n            if (isIdentifier() || token() === 98) {\n                nextToken();\n                return true;\n            }\n            if (token() === 20 || token() === 16) {\n                var previousErrorCount = parseDiagnostics.length;\n                parseIdentifierOrPattern();\n                return previousErrorCount === parseDiagnostics.length;\n            }\n            return false;\n        }\n        function isUnambiguouslyStartOfFunctionType() {\n            nextToken();\n            if (token() === 19 || token() === 23) {\n                return true;\n            }\n            if (skipParameterStart()) {\n                if (token() === 55 || token() === 25 ||\n                    token() === 54 || token() === 57) {\n                    return true;\n                }\n                if (token() === 19) {\n                    nextToken();\n                    if (token() === 35) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function parseTypeOrTypePredicate() {\n            var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix);\n            var type = parseType();\n            if (typePredicateVariable) {\n                var node = createNode(156, typePredicateVariable.pos);\n                node.parameterName = typePredicateVariable;\n                node.type = type;\n                return finishNode(node);\n            }\n            else {\n                return type;\n            }\n        }\n        function parseTypePredicatePrefix() {\n            var id = parseIdentifier();\n            if (token() === 125 && !scanner.hasPrecedingLineBreak()) {\n                nextToken();\n                return id;\n            }\n        }\n        function parseType() {\n            return doOutsideOfContext(20480, parseTypeWorker);\n        }\n        function parseTypeWorker() {\n            if (isStartOfFunctionType()) {\n                return parseFunctionOrConstructorType(158);\n            }\n            if (token() === 93) {\n                return parseFunctionOrConstructorType(159);\n            }\n            return parseUnionTypeOrHigher();\n        }\n        function parseTypeAnnotation() {\n            return parseOptional(55) ? parseType() : undefined;\n        }\n        function isStartOfLeftHandSideExpression() {\n            switch (token()) {\n                case 98:\n                case 96:\n                case 94:\n                case 100:\n                case 85:\n                case 8:\n                case 9:\n                case 12:\n                case 13:\n                case 18:\n                case 20:\n                case 16:\n                case 88:\n                case 74:\n                case 93:\n                case 40:\n                case 62:\n                case 70:\n                    return true;\n                default:\n                    return isIdentifier();\n            }\n        }\n        function isStartOfExpression() {\n            if (isStartOfLeftHandSideExpression()) {\n                return true;\n            }\n            switch (token()) {\n                case 36:\n                case 37:\n                case 51:\n                case 50:\n                case 79:\n                case 102:\n                case 104:\n                case 42:\n                case 43:\n                case 26:\n                case 120:\n                case 115:\n                    return true;\n                default:\n                    if (isBinaryOperator()) {\n                        return true;\n                    }\n                    return isIdentifier();\n            }\n        }\n        function isStartOfExpressionStatement() {\n            return token() !== 16 &&\n                token() !== 88 &&\n                token() !== 74 &&\n                token() !== 56 &&\n                isStartOfExpression();\n        }\n        function parseExpression() {\n            var saveDecoratorContext = inDecoratorContext();\n            if (saveDecoratorContext) {\n                setDecoratorContext(false);\n            }\n            var expr = parseAssignmentExpressionOrHigher();\n            var operatorToken;\n            while ((operatorToken = parseOptionalToken(25))) {\n                expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher());\n            }\n            if (saveDecoratorContext) {\n                setDecoratorContext(true);\n            }\n            return expr;\n        }\n        function parseInitializer(inParameter) {\n            if (token() !== 57) {\n                if (scanner.hasPrecedingLineBreak() || (inParameter && token() === 16) || !isStartOfExpression()) {\n                    return undefined;\n                }\n            }\n            parseExpected(57);\n            return parseAssignmentExpressionOrHigher();\n        }\n        function parseAssignmentExpressionOrHigher() {\n            if (isYieldExpression()) {\n                return parseYieldExpression();\n            }\n            var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();\n            if (arrowExpression) {\n                return arrowExpression;\n            }\n            var expr = parseBinaryExpressionOrHigher(0);\n            if (expr.kind === 70 && token() === 35) {\n                return parseSimpleArrowFunctionExpression(expr);\n            }\n            if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {\n                return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher());\n            }\n            return parseConditionalExpressionRest(expr);\n        }\n        function isYieldExpression() {\n            if (token() === 115) {\n                if (inYieldContext()) {\n                    return true;\n                }\n                return lookAhead(nextTokenIsIdentifierOrKeywordOrNumberOnSameLine);\n            }\n            return false;\n        }\n        function nextTokenIsIdentifierOnSameLine() {\n            nextToken();\n            return !scanner.hasPrecedingLineBreak() && isIdentifier();\n        }\n        function parseYieldExpression() {\n            var node = createNode(195);\n            nextToken();\n            if (!scanner.hasPrecedingLineBreak() &&\n                (token() === 38 || isStartOfExpression())) {\n                node.asteriskToken = parseOptionalToken(38);\n                node.expression = parseAssignmentExpressionOrHigher();\n                return finishNode(node);\n            }\n            else {\n                return finishNode(node);\n            }\n        }\n        function parseSimpleArrowFunctionExpression(identifier, asyncModifier) {\n            ts.Debug.assert(token() === 35, \"parseSimpleArrowFunctionExpression should only have been called if we had a =>\");\n            var node;\n            if (asyncModifier) {\n                node = createNode(185, asyncModifier.pos);\n                node.modifiers = asyncModifier;\n            }\n            else {\n                node = createNode(185, identifier.pos);\n            }\n            var parameter = createNode(144, identifier.pos);\n            parameter.name = identifier;\n            finishNode(parameter);\n            node.parameters = createNodeArray([parameter], parameter.pos);\n            node.parameters.end = parameter.end;\n            node.equalsGreaterThanToken = parseExpectedToken(35, false, ts.Diagnostics._0_expected, \"=>\");\n            node.body = parseArrowFunctionExpressionBody(!!asyncModifier);\n            return addJSDocComment(finishNode(node));\n        }\n        function tryParseParenthesizedArrowFunctionExpression() {\n            var triState = isParenthesizedArrowFunctionExpression();\n            if (triState === 0) {\n                return undefined;\n            }\n            var arrowFunction = triState === 1\n                ? parseParenthesizedArrowFunctionExpressionHead(true)\n                : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead);\n            if (!arrowFunction) {\n                return undefined;\n            }\n            var isAsync = !!(ts.getModifierFlags(arrowFunction) & 256);\n            var lastToken = token();\n            arrowFunction.equalsGreaterThanToken = parseExpectedToken(35, false, ts.Diagnostics._0_expected, \"=>\");\n            arrowFunction.body = (lastToken === 35 || lastToken === 16)\n                ? parseArrowFunctionExpressionBody(isAsync)\n                : parseIdentifier();\n            return addJSDocComment(finishNode(arrowFunction));\n        }\n        function isParenthesizedArrowFunctionExpression() {\n            if (token() === 18 || token() === 26 || token() === 119) {\n                return lookAhead(isParenthesizedArrowFunctionExpressionWorker);\n            }\n            if (token() === 35) {\n                return 1;\n            }\n            return 0;\n        }\n        function isParenthesizedArrowFunctionExpressionWorker() {\n            if (token() === 119) {\n                nextToken();\n                if (scanner.hasPrecedingLineBreak()) {\n                    return 0;\n                }\n                if (token() !== 18 && token() !== 26) {\n                    return 0;\n                }\n            }\n            var first = token();\n            var second = nextToken();\n            if (first === 18) {\n                if (second === 19) {\n                    var third = nextToken();\n                    switch (third) {\n                        case 35:\n                        case 55:\n                        case 16:\n                            return 1;\n                        default:\n                            return 0;\n                    }\n                }\n                if (second === 20 || second === 16) {\n                    return 2;\n                }\n                if (second === 23) {\n                    return 1;\n                }\n                if (!isIdentifier()) {\n                    return 0;\n                }\n                if (nextToken() === 55) {\n                    return 1;\n                }\n                return 2;\n            }\n            else {\n                ts.Debug.assert(first === 26);\n                if (!isIdentifier()) {\n                    return 0;\n                }\n                if (sourceFile.languageVariant === 1) {\n                    var isArrowFunctionInJsx = lookAhead(function () {\n                        var third = nextToken();\n                        if (third === 84) {\n                            var fourth = nextToken();\n                            switch (fourth) {\n                                case 57:\n                                case 28:\n                                    return false;\n                                default:\n                                    return true;\n                            }\n                        }\n                        else if (third === 25) {\n                            return true;\n                        }\n                        return false;\n                    });\n                    if (isArrowFunctionInJsx) {\n                        return 1;\n                    }\n                    return 0;\n                }\n                return 2;\n            }\n        }\n        function parsePossibleParenthesizedArrowFunctionExpressionHead() {\n            return parseParenthesizedArrowFunctionExpressionHead(false);\n        }\n        function tryParseAsyncSimpleArrowFunctionExpression() {\n            if (token() === 119) {\n                var isUnParenthesizedAsyncArrowFunction = lookAhead(isUnParenthesizedAsyncArrowFunctionWorker);\n                if (isUnParenthesizedAsyncArrowFunction === 1) {\n                    var asyncModifier = parseModifiersForArrowFunction();\n                    var expr = parseBinaryExpressionOrHigher(0);\n                    return parseSimpleArrowFunctionExpression(expr, asyncModifier);\n                }\n            }\n            return undefined;\n        }\n        function isUnParenthesizedAsyncArrowFunctionWorker() {\n            if (token() === 119) {\n                nextToken();\n                if (scanner.hasPrecedingLineBreak() || token() === 35) {\n                    return 0;\n                }\n                var expr = parseBinaryExpressionOrHigher(0);\n                if (!scanner.hasPrecedingLineBreak() && expr.kind === 70 && token() === 35) {\n                    return 1;\n                }\n            }\n            return 0;\n        }\n        function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) {\n            var node = createNode(185);\n            node.modifiers = parseModifiersForArrowFunction();\n            var isAsync = !!(ts.getModifierFlags(node) & 256);\n            fillSignature(55, false, isAsync, !allowAmbiguity, node);\n            if (!node.parameters) {\n                return undefined;\n            }\n            if (!allowAmbiguity && token() !== 35 && token() !== 16) {\n                return undefined;\n            }\n            return node;\n        }\n        function parseArrowFunctionExpressionBody(isAsync) {\n            if (token() === 16) {\n                return parseFunctionBlock(false, isAsync, false);\n            }\n            if (token() !== 24 &&\n                token() !== 88 &&\n                token() !== 74 &&\n                isStartOfStatement() &&\n                !isStartOfExpressionStatement()) {\n                return parseFunctionBlock(false, isAsync, true);\n            }\n            return isAsync\n                ? doInAwaitContext(parseAssignmentExpressionOrHigher)\n                : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);\n        }\n        function parseConditionalExpressionRest(leftOperand) {\n            var questionToken = parseOptionalToken(54);\n            if (!questionToken) {\n                return leftOperand;\n            }\n            var node = createNode(193, leftOperand.pos);\n            node.condition = leftOperand;\n            node.questionToken = questionToken;\n            node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);\n            node.colonToken = parseExpectedToken(55, false, ts.Diagnostics._0_expected, ts.tokenToString(55));\n            node.whenFalse = parseAssignmentExpressionOrHigher();\n            return finishNode(node);\n        }\n        function parseBinaryExpressionOrHigher(precedence) {\n            var leftOperand = parseUnaryExpressionOrHigher();\n            return parseBinaryExpressionRest(precedence, leftOperand);\n        }\n        function isInOrOfKeyword(t) {\n            return t === 91 || t === 140;\n        }\n        function parseBinaryExpressionRest(precedence, leftOperand) {\n            while (true) {\n                reScanGreaterToken();\n                var newPrecedence = getBinaryOperatorPrecedence();\n                var consumeCurrentOperator = token() === 39 ?\n                    newPrecedence >= precedence :\n                    newPrecedence > precedence;\n                if (!consumeCurrentOperator) {\n                    break;\n                }\n                if (token() === 91 && inDisallowInContext()) {\n                    break;\n                }\n                if (token() === 117) {\n                    if (scanner.hasPrecedingLineBreak()) {\n                        break;\n                    }\n                    else {\n                        nextToken();\n                        leftOperand = makeAsExpression(leftOperand, parseType());\n                    }\n                }\n                else {\n                    leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence));\n                }\n            }\n            return leftOperand;\n        }\n        function isBinaryOperator() {\n            if (inDisallowInContext() && token() === 91) {\n                return false;\n            }\n            return getBinaryOperatorPrecedence() > 0;\n        }\n        function getBinaryOperatorPrecedence() {\n            switch (token()) {\n                case 53:\n                    return 1;\n                case 52:\n                    return 2;\n                case 48:\n                    return 3;\n                case 49:\n                    return 4;\n                case 47:\n                    return 5;\n                case 31:\n                case 32:\n                case 33:\n                case 34:\n                    return 6;\n                case 26:\n                case 28:\n                case 29:\n                case 30:\n                case 92:\n                case 91:\n                case 117:\n                    return 7;\n                case 44:\n                case 45:\n                case 46:\n                    return 8;\n                case 36:\n                case 37:\n                    return 9;\n                case 38:\n                case 40:\n                case 41:\n                    return 10;\n                case 39:\n                    return 11;\n            }\n            return -1;\n        }\n        function makeBinaryExpression(left, operatorToken, right) {\n            var node = createNode(192, left.pos);\n            node.left = left;\n            node.operatorToken = operatorToken;\n            node.right = right;\n            return finishNode(node);\n        }\n        function makeAsExpression(left, right) {\n            var node = createNode(200, left.pos);\n            node.expression = left;\n            node.type = right;\n            return finishNode(node);\n        }\n        function parsePrefixUnaryExpression() {\n            var node = createNode(190);\n            node.operator = token();\n            nextToken();\n            node.operand = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        function parseDeleteExpression() {\n            var node = createNode(186);\n            nextToken();\n            node.expression = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        function parseTypeOfExpression() {\n            var node = createNode(187);\n            nextToken();\n            node.expression = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        function parseVoidExpression() {\n            var node = createNode(188);\n            nextToken();\n            node.expression = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        function isAwaitExpression() {\n            if (token() === 120) {\n                if (inAwaitContext()) {\n                    return true;\n                }\n                return lookAhead(nextTokenIsIdentifierOnSameLine);\n            }\n            return false;\n        }\n        function parseAwaitExpression() {\n            var node = createNode(189);\n            nextToken();\n            node.expression = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        function parseUnaryExpressionOrHigher() {\n            if (isUpdateExpression()) {\n                var incrementExpression = parseIncrementExpression();\n                return token() === 39 ?\n                    parseBinaryExpressionRest(getBinaryOperatorPrecedence(), incrementExpression) :\n                    incrementExpression;\n            }\n            var unaryOperator = token();\n            var simpleUnaryExpression = parseSimpleUnaryExpression();\n            if (token() === 39) {\n                var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos);\n                if (simpleUnaryExpression.kind === 182) {\n                    parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);\n                }\n                else {\n                    parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, ts.tokenToString(unaryOperator));\n                }\n            }\n            return simpleUnaryExpression;\n        }\n        function parseSimpleUnaryExpression() {\n            switch (token()) {\n                case 36:\n                case 37:\n                case 51:\n                case 50:\n                    return parsePrefixUnaryExpression();\n                case 79:\n                    return parseDeleteExpression();\n                case 102:\n                    return parseTypeOfExpression();\n                case 104:\n                    return parseVoidExpression();\n                case 26:\n                    return parseTypeAssertion();\n                case 120:\n                    if (isAwaitExpression()) {\n                        return parseAwaitExpression();\n                    }\n                default:\n                    return parseIncrementExpression();\n            }\n        }\n        function isUpdateExpression() {\n            switch (token()) {\n                case 36:\n                case 37:\n                case 51:\n                case 50:\n                case 79:\n                case 102:\n                case 104:\n                case 120:\n                    return false;\n                case 26:\n                    if (sourceFile.languageVariant !== 1) {\n                        return false;\n                    }\n                default:\n                    return true;\n            }\n        }\n        function parseIncrementExpression() {\n            if (token() === 42 || token() === 43) {\n                var node = createNode(190);\n                node.operator = token();\n                nextToken();\n                node.operand = parseLeftHandSideExpressionOrHigher();\n                return finishNode(node);\n            }\n            else if (sourceFile.languageVariant === 1 && token() === 26 && lookAhead(nextTokenIsIdentifierOrKeyword)) {\n                return parseJsxElementOrSelfClosingElement(true);\n            }\n            var expression = parseLeftHandSideExpressionOrHigher();\n            ts.Debug.assert(ts.isLeftHandSideExpression(expression));\n            if ((token() === 42 || token() === 43) && !scanner.hasPrecedingLineBreak()) {\n                var node = createNode(191, expression.pos);\n                node.operand = expression;\n                node.operator = token();\n                nextToken();\n                return finishNode(node);\n            }\n            return expression;\n        }\n        function parseLeftHandSideExpressionOrHigher() {\n            var expression = token() === 96\n                ? parseSuperExpression()\n                : parseMemberExpressionOrHigher();\n            return parseCallExpressionRest(expression);\n        }\n        function parseMemberExpressionOrHigher() {\n            var expression = parsePrimaryExpression();\n            return parseMemberExpressionRest(expression);\n        }\n        function parseSuperExpression() {\n            var expression = parseTokenNode();\n            if (token() === 18 || token() === 22 || token() === 20) {\n                return expression;\n            }\n            var node = createNode(177, expression.pos);\n            node.expression = expression;\n            parseExpectedToken(22, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);\n            node.name = parseRightSideOfDot(true);\n            return finishNode(node);\n        }\n        function tagNamesAreEquivalent(lhs, rhs) {\n            if (lhs.kind !== rhs.kind) {\n                return false;\n            }\n            if (lhs.kind === 70) {\n                return lhs.text === rhs.text;\n            }\n            if (lhs.kind === 98) {\n                return true;\n            }\n            return lhs.name.text === rhs.name.text &&\n                tagNamesAreEquivalent(lhs.expression, rhs.expression);\n        }\n        function parseJsxElementOrSelfClosingElement(inExpressionContext) {\n            var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext);\n            var result;\n            if (opening.kind === 248) {\n                var node = createNode(246, opening.pos);\n                node.openingElement = opening;\n                node.children = parseJsxChildren(node.openingElement.tagName);\n                node.closingElement = parseJsxClosingElement(inExpressionContext);\n                if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) {\n                    parseErrorAtPosition(node.closingElement.pos, node.closingElement.end - node.closingElement.pos, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, node.openingElement.tagName));\n                }\n                result = finishNode(node);\n            }\n            else {\n                ts.Debug.assert(opening.kind === 247);\n                result = opening;\n            }\n            if (inExpressionContext && token() === 26) {\n                var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); });\n                if (invalidElement) {\n                    parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element);\n                    var badNode = createNode(192, result.pos);\n                    badNode.end = invalidElement.end;\n                    badNode.left = result;\n                    badNode.right = invalidElement;\n                    badNode.operatorToken = createMissingNode(25, false, undefined);\n                    badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos;\n                    return badNode;\n                }\n            }\n            return result;\n        }\n        function parseJsxText() {\n            var node = createNode(10, scanner.getStartPos());\n            currentToken = scanner.scanJsxToken();\n            return finishNode(node);\n        }\n        function parseJsxChild() {\n            switch (token()) {\n                case 10:\n                    return parseJsxText();\n                case 16:\n                    return parseJsxExpression(false);\n                case 26:\n                    return parseJsxElementOrSelfClosingElement(false);\n            }\n            ts.Debug.fail(\"Unknown JSX child kind \" + token());\n        }\n        function parseJsxChildren(openingTagName) {\n            var result = createNodeArray();\n            var saveParsingContext = parsingContext;\n            parsingContext |= 1 << 14;\n            while (true) {\n                currentToken = scanner.reScanJsxToken();\n                if (token() === 27) {\n                    break;\n                }\n                else if (token() === 1) {\n                    parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName));\n                    break;\n                }\n                result.push(parseJsxChild());\n            }\n            result.end = scanner.getTokenPos();\n            parsingContext = saveParsingContext;\n            return result;\n        }\n        function parseJsxOpeningOrSelfClosingElement(inExpressionContext) {\n            var fullStart = scanner.getStartPos();\n            parseExpected(26);\n            var tagName = parseJsxElementName();\n            var attributes = parseList(13, parseJsxAttribute);\n            var node;\n            if (token() === 28) {\n                node = createNode(248, fullStart);\n                scanJsxText();\n            }\n            else {\n                parseExpected(40);\n                if (inExpressionContext) {\n                    parseExpected(28);\n                }\n                else {\n                    parseExpected(28, undefined, false);\n                    scanJsxText();\n                }\n                node = createNode(247, fullStart);\n            }\n            node.tagName = tagName;\n            node.attributes = attributes;\n            return finishNode(node);\n        }\n        function parseJsxElementName() {\n            scanJsxIdentifier();\n            var expression = token() === 98 ?\n                parseTokenNode() : parseIdentifierName();\n            while (parseOptional(22)) {\n                var propertyAccess = createNode(177, expression.pos);\n                propertyAccess.expression = expression;\n                propertyAccess.name = parseRightSideOfDot(true);\n                expression = finishNode(propertyAccess);\n            }\n            return expression;\n        }\n        function parseJsxExpression(inExpressionContext) {\n            var node = createNode(252);\n            parseExpected(16);\n            if (token() !== 17) {\n                node.expression = parseAssignmentExpressionOrHigher();\n            }\n            if (inExpressionContext) {\n                parseExpected(17);\n            }\n            else {\n                parseExpected(17, undefined, false);\n                scanJsxText();\n            }\n            return finishNode(node);\n        }\n        function parseJsxAttribute() {\n            if (token() === 16) {\n                return parseJsxSpreadAttribute();\n            }\n            scanJsxIdentifier();\n            var node = createNode(250);\n            node.name = parseIdentifierName();\n            if (token() === 57) {\n                switch (scanJsxAttributeValue()) {\n                    case 9:\n                        node.initializer = parseLiteralNode();\n                        break;\n                    default:\n                        node.initializer = parseJsxExpression(true);\n                        break;\n                }\n            }\n            return finishNode(node);\n        }\n        function parseJsxSpreadAttribute() {\n            var node = createNode(251);\n            parseExpected(16);\n            parseExpected(23);\n            node.expression = parseExpression();\n            parseExpected(17);\n            return finishNode(node);\n        }\n        function parseJsxClosingElement(inExpressionContext) {\n            var node = createNode(249);\n            parseExpected(27);\n            node.tagName = parseJsxElementName();\n            if (inExpressionContext) {\n                parseExpected(28);\n            }\n            else {\n                parseExpected(28, undefined, false);\n                scanJsxText();\n            }\n            return finishNode(node);\n        }\n        function parseTypeAssertion() {\n            var node = createNode(182);\n            parseExpected(26);\n            node.type = parseType();\n            parseExpected(28);\n            node.expression = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        function parseMemberExpressionRest(expression) {\n            while (true) {\n                var dotToken = parseOptionalToken(22);\n                if (dotToken) {\n                    var propertyAccess = createNode(177, expression.pos);\n                    propertyAccess.expression = expression;\n                    propertyAccess.name = parseRightSideOfDot(true);\n                    expression = finishNode(propertyAccess);\n                    continue;\n                }\n                if (token() === 50 && !scanner.hasPrecedingLineBreak()) {\n                    nextToken();\n                    var nonNullExpression = createNode(201, expression.pos);\n                    nonNullExpression.expression = expression;\n                    expression = finishNode(nonNullExpression);\n                    continue;\n                }\n                if (!inDecoratorContext() && parseOptional(20)) {\n                    var indexedAccess = createNode(178, expression.pos);\n                    indexedAccess.expression = expression;\n                    if (token() !== 21) {\n                        indexedAccess.argumentExpression = allowInAnd(parseExpression);\n                        if (indexedAccess.argumentExpression.kind === 9 || indexedAccess.argumentExpression.kind === 8) {\n                            var literal = indexedAccess.argumentExpression;\n                            literal.text = internIdentifier(literal.text);\n                        }\n                    }\n                    parseExpected(21);\n                    expression = finishNode(indexedAccess);\n                    continue;\n                }\n                if (token() === 12 || token() === 13) {\n                    var tagExpression = createNode(181, expression.pos);\n                    tagExpression.tag = expression;\n                    tagExpression.template = token() === 12\n                        ? parseLiteralNode()\n                        : parseTemplateExpression();\n                    expression = finishNode(tagExpression);\n                    continue;\n                }\n                return expression;\n            }\n        }\n        function parseCallExpressionRest(expression) {\n            while (true) {\n                expression = parseMemberExpressionRest(expression);\n                if (token() === 26) {\n                    var typeArguments = tryParse(parseTypeArgumentsInExpression);\n                    if (!typeArguments) {\n                        return expression;\n                    }\n                    var callExpr = createNode(179, expression.pos);\n                    callExpr.expression = expression;\n                    callExpr.typeArguments = typeArguments;\n                    callExpr.arguments = parseArgumentList();\n                    expression = finishNode(callExpr);\n                    continue;\n                }\n                else if (token() === 18) {\n                    var callExpr = createNode(179, expression.pos);\n                    callExpr.expression = expression;\n                    callExpr.arguments = parseArgumentList();\n                    expression = finishNode(callExpr);\n                    continue;\n                }\n                return expression;\n            }\n        }\n        function parseArgumentList() {\n            parseExpected(18);\n            var result = parseDelimitedList(11, parseArgumentExpression);\n            parseExpected(19);\n            return result;\n        }\n        function parseTypeArgumentsInExpression() {\n            if (!parseOptional(26)) {\n                return undefined;\n            }\n            var typeArguments = parseDelimitedList(19, parseType);\n            if (!parseExpected(28)) {\n                return undefined;\n            }\n            return typeArguments && canFollowTypeArgumentsInExpression()\n                ? typeArguments\n                : undefined;\n        }\n        function canFollowTypeArgumentsInExpression() {\n            switch (token()) {\n                case 18:\n                case 22:\n                case 19:\n                case 21:\n                case 55:\n                case 24:\n                case 54:\n                case 31:\n                case 33:\n                case 32:\n                case 34:\n                case 52:\n                case 53:\n                case 49:\n                case 47:\n                case 48:\n                case 17:\n                case 1:\n                    return true;\n                case 25:\n                case 16:\n                default:\n                    return false;\n            }\n        }\n        function parsePrimaryExpression() {\n            switch (token()) {\n                case 8:\n                case 9:\n                case 12:\n                    return parseLiteralNode();\n                case 98:\n                case 96:\n                case 94:\n                case 100:\n                case 85:\n                    return parseTokenNode();\n                case 18:\n                    return parseParenthesizedExpression();\n                case 20:\n                    return parseArrayLiteralExpression();\n                case 16:\n                    return parseObjectLiteralExpression();\n                case 119:\n                    if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) {\n                        break;\n                    }\n                    return parseFunctionExpression();\n                case 74:\n                    return parseClassExpression();\n                case 88:\n                    return parseFunctionExpression();\n                case 93:\n                    return parseNewExpression();\n                case 40:\n                case 62:\n                    if (reScanSlashToken() === 11) {\n                        return parseLiteralNode();\n                    }\n                    break;\n                case 13:\n                    return parseTemplateExpression();\n            }\n            return parseIdentifier(ts.Diagnostics.Expression_expected);\n        }\n        function parseParenthesizedExpression() {\n            var node = createNode(183);\n            parseExpected(18);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19);\n            return finishNode(node);\n        }\n        function parseSpreadElement() {\n            var node = createNode(196);\n            parseExpected(23);\n            node.expression = parseAssignmentExpressionOrHigher();\n            return finishNode(node);\n        }\n        function parseArgumentOrArrayLiteralElement() {\n            return token() === 23 ? parseSpreadElement() :\n                token() === 25 ? createNode(198) :\n                    parseAssignmentExpressionOrHigher();\n        }\n        function parseArgumentExpression() {\n            return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);\n        }\n        function parseArrayLiteralExpression() {\n            var node = createNode(175);\n            parseExpected(20);\n            if (scanner.hasPrecedingLineBreak()) {\n                node.multiLine = true;\n            }\n            node.elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement);\n            parseExpected(21);\n            return finishNode(node);\n        }\n        function tryParseAccessorDeclaration(fullStart, decorators, modifiers) {\n            if (parseContextualModifier(124)) {\n                return parseAccessorDeclaration(151, fullStart, decorators, modifiers);\n            }\n            else if (parseContextualModifier(133)) {\n                return parseAccessorDeclaration(152, fullStart, decorators, modifiers);\n            }\n            return undefined;\n        }\n        function parseObjectLiteralElement() {\n            var fullStart = scanner.getStartPos();\n            var dotDotDotToken = parseOptionalToken(23);\n            if (dotDotDotToken) {\n                var spreadElement = createNode(259, fullStart);\n                spreadElement.expression = parseAssignmentExpressionOrHigher();\n                return addJSDocComment(finishNode(spreadElement));\n            }\n            var decorators = parseDecorators();\n            var modifiers = parseModifiers();\n            var accessor = tryParseAccessorDeclaration(fullStart, decorators, modifiers);\n            if (accessor) {\n                return accessor;\n            }\n            var asteriskToken = parseOptionalToken(38);\n            var tokenIsIdentifier = isIdentifier();\n            var propertyName = parsePropertyName();\n            var questionToken = parseOptionalToken(54);\n            if (asteriskToken || token() === 18 || token() === 26) {\n                return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken);\n            }\n            var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 || token() === 17 || token() === 57);\n            if (isShorthandPropertyAssignment) {\n                var shorthandDeclaration = createNode(258, fullStart);\n                shorthandDeclaration.name = propertyName;\n                shorthandDeclaration.questionToken = questionToken;\n                var equalsToken = parseOptionalToken(57);\n                if (equalsToken) {\n                    shorthandDeclaration.equalsToken = equalsToken;\n                    shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher);\n                }\n                return addJSDocComment(finishNode(shorthandDeclaration));\n            }\n            else {\n                var propertyAssignment = createNode(257, fullStart);\n                propertyAssignment.modifiers = modifiers;\n                propertyAssignment.name = propertyName;\n                propertyAssignment.questionToken = questionToken;\n                parseExpected(55);\n                propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher);\n                return addJSDocComment(finishNode(propertyAssignment));\n            }\n        }\n        function parseObjectLiteralExpression() {\n            var node = createNode(176);\n            parseExpected(16);\n            if (scanner.hasPrecedingLineBreak()) {\n                node.multiLine = true;\n            }\n            node.properties = parseDelimitedList(12, parseObjectLiteralElement, true);\n            parseExpected(17);\n            return finishNode(node);\n        }\n        function parseFunctionExpression() {\n            var saveDecoratorContext = inDecoratorContext();\n            if (saveDecoratorContext) {\n                setDecoratorContext(false);\n            }\n            var node = createNode(184);\n            node.modifiers = parseModifiers();\n            parseExpected(88);\n            node.asteriskToken = parseOptionalToken(38);\n            var isGenerator = !!node.asteriskToken;\n            var isAsync = !!(ts.getModifierFlags(node) & 256);\n            node.name =\n                isGenerator && isAsync ? doInYieldAndAwaitContext(parseOptionalIdentifier) :\n                    isGenerator ? doInYieldContext(parseOptionalIdentifier) :\n                        isAsync ? doInAwaitContext(parseOptionalIdentifier) :\n                            parseOptionalIdentifier();\n            fillSignature(55, isGenerator, isAsync, false, node);\n            node.body = parseFunctionBlock(isGenerator, isAsync, false);\n            if (saveDecoratorContext) {\n                setDecoratorContext(true);\n            }\n            return addJSDocComment(finishNode(node));\n        }\n        function parseOptionalIdentifier() {\n            return isIdentifier() ? parseIdentifier() : undefined;\n        }\n        function parseNewExpression() {\n            var node = createNode(180);\n            parseExpected(93);\n            node.expression = parseMemberExpressionOrHigher();\n            node.typeArguments = tryParse(parseTypeArgumentsInExpression);\n            if (node.typeArguments || token() === 18) {\n                node.arguments = parseArgumentList();\n            }\n            return finishNode(node);\n        }\n        function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {\n            var node = createNode(204);\n            if (parseExpected(16, diagnosticMessage) || ignoreMissingOpenBrace) {\n                if (scanner.hasPrecedingLineBreak()) {\n                    node.multiLine = true;\n                }\n                node.statements = parseList(1, parseStatement);\n                parseExpected(17);\n            }\n            else {\n                node.statements = createMissingList();\n            }\n            return finishNode(node);\n        }\n        function parseFunctionBlock(allowYield, allowAwait, ignoreMissingOpenBrace, diagnosticMessage) {\n            var savedYieldContext = inYieldContext();\n            setYieldContext(allowYield);\n            var savedAwaitContext = inAwaitContext();\n            setAwaitContext(allowAwait);\n            var saveDecoratorContext = inDecoratorContext();\n            if (saveDecoratorContext) {\n                setDecoratorContext(false);\n            }\n            var block = parseBlock(ignoreMissingOpenBrace, diagnosticMessage);\n            if (saveDecoratorContext) {\n                setDecoratorContext(true);\n            }\n            setYieldContext(savedYieldContext);\n            setAwaitContext(savedAwaitContext);\n            return block;\n        }\n        function parseEmptyStatement() {\n            var node = createNode(206);\n            parseExpected(24);\n            return finishNode(node);\n        }\n        function parseIfStatement() {\n            var node = createNode(208);\n            parseExpected(89);\n            parseExpected(18);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19);\n            node.thenStatement = parseStatement();\n            node.elseStatement = parseOptional(81) ? parseStatement() : undefined;\n            return finishNode(node);\n        }\n        function parseDoStatement() {\n            var node = createNode(209);\n            parseExpected(80);\n            node.statement = parseStatement();\n            parseExpected(105);\n            parseExpected(18);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19);\n            parseOptional(24);\n            return finishNode(node);\n        }\n        function parseWhileStatement() {\n            var node = createNode(210);\n            parseExpected(105);\n            parseExpected(18);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19);\n            node.statement = parseStatement();\n            return finishNode(node);\n        }\n        function parseForOrForInOrForOfStatement() {\n            var pos = getNodePos();\n            parseExpected(87);\n            parseExpected(18);\n            var initializer = undefined;\n            if (token() !== 24) {\n                if (token() === 103 || token() === 109 || token() === 75) {\n                    initializer = parseVariableDeclarationList(true);\n                }\n                else {\n                    initializer = disallowInAnd(parseExpression);\n                }\n            }\n            var forOrForInOrForOfStatement;\n            if (parseOptional(91)) {\n                var forInStatement = createNode(212, pos);\n                forInStatement.initializer = initializer;\n                forInStatement.expression = allowInAnd(parseExpression);\n                parseExpected(19);\n                forOrForInOrForOfStatement = forInStatement;\n            }\n            else if (parseOptional(140)) {\n                var forOfStatement = createNode(213, pos);\n                forOfStatement.initializer = initializer;\n                forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher);\n                parseExpected(19);\n                forOrForInOrForOfStatement = forOfStatement;\n            }\n            else {\n                var forStatement = createNode(211, pos);\n                forStatement.initializer = initializer;\n                parseExpected(24);\n                if (token() !== 24 && token() !== 19) {\n                    forStatement.condition = allowInAnd(parseExpression);\n                }\n                parseExpected(24);\n                if (token() !== 19) {\n                    forStatement.incrementor = allowInAnd(parseExpression);\n                }\n                parseExpected(19);\n                forOrForInOrForOfStatement = forStatement;\n            }\n            forOrForInOrForOfStatement.statement = parseStatement();\n            return finishNode(forOrForInOrForOfStatement);\n        }\n        function parseBreakOrContinueStatement(kind) {\n            var node = createNode(kind);\n            parseExpected(kind === 215 ? 71 : 76);\n            if (!canParseSemicolon()) {\n                node.label = parseIdentifier();\n            }\n            parseSemicolon();\n            return finishNode(node);\n        }\n        function parseReturnStatement() {\n            var node = createNode(216);\n            parseExpected(95);\n            if (!canParseSemicolon()) {\n                node.expression = allowInAnd(parseExpression);\n            }\n            parseSemicolon();\n            return finishNode(node);\n        }\n        function parseWithStatement() {\n            var node = createNode(217);\n            parseExpected(106);\n            parseExpected(18);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19);\n            node.statement = parseStatement();\n            return finishNode(node);\n        }\n        function parseCaseClause() {\n            var node = createNode(253);\n            parseExpected(72);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(55);\n            node.statements = parseList(3, parseStatement);\n            return finishNode(node);\n        }\n        function parseDefaultClause() {\n            var node = createNode(254);\n            parseExpected(78);\n            parseExpected(55);\n            node.statements = parseList(3, parseStatement);\n            return finishNode(node);\n        }\n        function parseCaseOrDefaultClause() {\n            return token() === 72 ? parseCaseClause() : parseDefaultClause();\n        }\n        function parseSwitchStatement() {\n            var node = createNode(218);\n            parseExpected(97);\n            parseExpected(18);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19);\n            var caseBlock = createNode(232, scanner.getStartPos());\n            parseExpected(16);\n            caseBlock.clauses = parseList(2, parseCaseOrDefaultClause);\n            parseExpected(17);\n            node.caseBlock = finishNode(caseBlock);\n            return finishNode(node);\n        }\n        function parseThrowStatement() {\n            var node = createNode(220);\n            parseExpected(99);\n            node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression);\n            parseSemicolon();\n            return finishNode(node);\n        }\n        function parseTryStatement() {\n            var node = createNode(221);\n            parseExpected(101);\n            node.tryBlock = parseBlock(false);\n            node.catchClause = token() === 73 ? parseCatchClause() : undefined;\n            if (!node.catchClause || token() === 86) {\n                parseExpected(86);\n                node.finallyBlock = parseBlock(false);\n            }\n            return finishNode(node);\n        }\n        function parseCatchClause() {\n            var result = createNode(256);\n            parseExpected(73);\n            if (parseExpected(18)) {\n                result.variableDeclaration = parseVariableDeclaration();\n            }\n            parseExpected(19);\n            result.block = parseBlock(false);\n            return finishNode(result);\n        }\n        function parseDebuggerStatement() {\n            var node = createNode(222);\n            parseExpected(77);\n            parseSemicolon();\n            return finishNode(node);\n        }\n        function parseExpressionOrLabeledStatement() {\n            var fullStart = scanner.getStartPos();\n            var expression = allowInAnd(parseExpression);\n            if (expression.kind === 70 && parseOptional(55)) {\n                var labeledStatement = createNode(219, fullStart);\n                labeledStatement.label = expression;\n                labeledStatement.statement = parseStatement();\n                return addJSDocComment(finishNode(labeledStatement));\n            }\n            else {\n                var expressionStatement = createNode(207, fullStart);\n                expressionStatement.expression = expression;\n                parseSemicolon();\n                return addJSDocComment(finishNode(expressionStatement));\n            }\n        }\n        function nextTokenIsIdentifierOrKeywordOnSameLine() {\n            nextToken();\n            return ts.tokenIsIdentifierOrKeyword(token()) && !scanner.hasPrecedingLineBreak();\n        }\n        function nextTokenIsFunctionKeywordOnSameLine() {\n            nextToken();\n            return token() === 88 && !scanner.hasPrecedingLineBreak();\n        }\n        function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() {\n            nextToken();\n            return (ts.tokenIsIdentifierOrKeyword(token()) || token() === 8) && !scanner.hasPrecedingLineBreak();\n        }\n        function isDeclaration() {\n            while (true) {\n                switch (token()) {\n                    case 103:\n                    case 109:\n                    case 75:\n                    case 88:\n                    case 74:\n                    case 82:\n                        return true;\n                    case 108:\n                    case 136:\n                        return nextTokenIsIdentifierOnSameLine();\n                    case 127:\n                    case 128:\n                        return nextTokenIsIdentifierOrStringLiteralOnSameLine();\n                    case 116:\n                    case 119:\n                    case 123:\n                    case 111:\n                    case 112:\n                    case 113:\n                    case 130:\n                        nextToken();\n                        if (scanner.hasPrecedingLineBreak()) {\n                            return false;\n                        }\n                        continue;\n                    case 139:\n                        nextToken();\n                        return token() === 16 || token() === 70 || token() === 83;\n                    case 90:\n                        nextToken();\n                        return token() === 9 || token() === 38 ||\n                            token() === 16 || ts.tokenIsIdentifierOrKeyword(token());\n                    case 83:\n                        nextToken();\n                        if (token() === 57 || token() === 38 ||\n                            token() === 16 || token() === 78 ||\n                            token() === 117) {\n                            return true;\n                        }\n                        continue;\n                    case 114:\n                        nextToken();\n                        continue;\n                    default:\n                        return false;\n                }\n            }\n        }\n        function isStartOfDeclaration() {\n            return lookAhead(isDeclaration);\n        }\n        function isStartOfStatement() {\n            switch (token()) {\n                case 56:\n                case 24:\n                case 16:\n                case 103:\n                case 109:\n                case 88:\n                case 74:\n                case 82:\n                case 89:\n                case 80:\n                case 105:\n                case 87:\n                case 76:\n                case 71:\n                case 95:\n                case 106:\n                case 97:\n                case 99:\n                case 101:\n                case 77:\n                case 73:\n                case 86:\n                    return true;\n                case 75:\n                case 83:\n                case 90:\n                    return isStartOfDeclaration();\n                case 119:\n                case 123:\n                case 108:\n                case 127:\n                case 128:\n                case 136:\n                case 139:\n                    return true;\n                case 113:\n                case 111:\n                case 112:\n                case 114:\n                case 130:\n                    return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);\n                default:\n                    return isStartOfExpression();\n            }\n        }\n        function nextTokenIsIdentifierOrStartOfDestructuring() {\n            nextToken();\n            return isIdentifier() || token() === 16 || token() === 20;\n        }\n        function isLetDeclaration() {\n            return lookAhead(nextTokenIsIdentifierOrStartOfDestructuring);\n        }\n        function parseStatement() {\n            switch (token()) {\n                case 24:\n                    return parseEmptyStatement();\n                case 16:\n                    return parseBlock(false);\n                case 103:\n                    return parseVariableStatement(scanner.getStartPos(), undefined, undefined);\n                case 109:\n                    if (isLetDeclaration()) {\n                        return parseVariableStatement(scanner.getStartPos(), undefined, undefined);\n                    }\n                    break;\n                case 88:\n                    return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined);\n                case 74:\n                    return parseClassDeclaration(scanner.getStartPos(), undefined, undefined);\n                case 89:\n                    return parseIfStatement();\n                case 80:\n                    return parseDoStatement();\n                case 105:\n                    return parseWhileStatement();\n                case 87:\n                    return parseForOrForInOrForOfStatement();\n                case 76:\n                    return parseBreakOrContinueStatement(214);\n                case 71:\n                    return parseBreakOrContinueStatement(215);\n                case 95:\n                    return parseReturnStatement();\n                case 106:\n                    return parseWithStatement();\n                case 97:\n                    return parseSwitchStatement();\n                case 99:\n                    return parseThrowStatement();\n                case 101:\n                case 73:\n                case 86:\n                    return parseTryStatement();\n                case 77:\n                    return parseDebuggerStatement();\n                case 56:\n                    return parseDeclaration();\n                case 119:\n                case 108:\n                case 136:\n                case 127:\n                case 128:\n                case 123:\n                case 75:\n                case 82:\n                case 83:\n                case 90:\n                case 111:\n                case 112:\n                case 113:\n                case 116:\n                case 114:\n                case 130:\n                case 139:\n                    if (isStartOfDeclaration()) {\n                        return parseDeclaration();\n                    }\n                    break;\n            }\n            return parseExpressionOrLabeledStatement();\n        }\n        function parseDeclaration() {\n            var fullStart = getNodePos();\n            var decorators = parseDecorators();\n            var modifiers = parseModifiers();\n            switch (token()) {\n                case 103:\n                case 109:\n                case 75:\n                    return parseVariableStatement(fullStart, decorators, modifiers);\n                case 88:\n                    return parseFunctionDeclaration(fullStart, decorators, modifiers);\n                case 74:\n                    return parseClassDeclaration(fullStart, decorators, modifiers);\n                case 108:\n                    return parseInterfaceDeclaration(fullStart, decorators, modifiers);\n                case 136:\n                    return parseTypeAliasDeclaration(fullStart, decorators, modifiers);\n                case 82:\n                    return parseEnumDeclaration(fullStart, decorators, modifiers);\n                case 139:\n                case 127:\n                case 128:\n                    return parseModuleDeclaration(fullStart, decorators, modifiers);\n                case 90:\n                    return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers);\n                case 83:\n                    nextToken();\n                    switch (token()) {\n                        case 78:\n                        case 57:\n                            return parseExportAssignment(fullStart, decorators, modifiers);\n                        case 117:\n                            return parseNamespaceExportDeclaration(fullStart, decorators, modifiers);\n                        default:\n                            return parseExportDeclaration(fullStart, decorators, modifiers);\n                    }\n                default:\n                    if (decorators || modifiers) {\n                        var node = createMissingNode(244, true, ts.Diagnostics.Declaration_expected);\n                        node.pos = fullStart;\n                        node.decorators = decorators;\n                        node.modifiers = modifiers;\n                        return finishNode(node);\n                    }\n            }\n        }\n        function nextTokenIsIdentifierOrStringLiteralOnSameLine() {\n            nextToken();\n            return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === 9);\n        }\n        function parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage) {\n            if (token() !== 16 && canParseSemicolon()) {\n                parseSemicolon();\n                return;\n            }\n            return parseFunctionBlock(isGenerator, isAsync, false, diagnosticMessage);\n        }\n        function parseArrayBindingElement() {\n            if (token() === 25) {\n                return createNode(198);\n            }\n            var node = createNode(174);\n            node.dotDotDotToken = parseOptionalToken(23);\n            node.name = parseIdentifierOrPattern();\n            node.initializer = parseBindingElementInitializer(false);\n            return finishNode(node);\n        }\n        function parseObjectBindingElement() {\n            var node = createNode(174);\n            node.dotDotDotToken = parseOptionalToken(23);\n            var tokenIsIdentifier = isIdentifier();\n            var propertyName = parsePropertyName();\n            if (tokenIsIdentifier && token() !== 55) {\n                node.name = propertyName;\n            }\n            else {\n                parseExpected(55);\n                node.propertyName = propertyName;\n                node.name = parseIdentifierOrPattern();\n            }\n            node.initializer = parseBindingElementInitializer(false);\n            return finishNode(node);\n        }\n        function parseObjectBindingPattern() {\n            var node = createNode(172);\n            parseExpected(16);\n            node.elements = parseDelimitedList(9, parseObjectBindingElement);\n            parseExpected(17);\n            return finishNode(node);\n        }\n        function parseArrayBindingPattern() {\n            var node = createNode(173);\n            parseExpected(20);\n            node.elements = parseDelimitedList(10, parseArrayBindingElement);\n            parseExpected(21);\n            return finishNode(node);\n        }\n        function isIdentifierOrPattern() {\n            return token() === 16 || token() === 20 || isIdentifier();\n        }\n        function parseIdentifierOrPattern() {\n            if (token() === 20) {\n                return parseArrayBindingPattern();\n            }\n            if (token() === 16) {\n                return parseObjectBindingPattern();\n            }\n            return parseIdentifier();\n        }\n        function parseVariableDeclaration() {\n            var node = createNode(223);\n            node.name = parseIdentifierOrPattern();\n            node.type = parseTypeAnnotation();\n            if (!isInOrOfKeyword(token())) {\n                node.initializer = parseInitializer(false);\n            }\n            return finishNode(node);\n        }\n        function parseVariableDeclarationList(inForStatementInitializer) {\n            var node = createNode(224);\n            switch (token()) {\n                case 103:\n                    break;\n                case 109:\n                    node.flags |= 1;\n                    break;\n                case 75:\n                    node.flags |= 2;\n                    break;\n                default:\n                    ts.Debug.fail();\n            }\n            nextToken();\n            if (token() === 140 && lookAhead(canFollowContextualOfKeyword)) {\n                node.declarations = createMissingList();\n            }\n            else {\n                var savedDisallowIn = inDisallowInContext();\n                setDisallowInContext(inForStatementInitializer);\n                node.declarations = parseDelimitedList(8, parseVariableDeclaration);\n                setDisallowInContext(savedDisallowIn);\n            }\n            return finishNode(node);\n        }\n        function canFollowContextualOfKeyword() {\n            return nextTokenIsIdentifier() && nextToken() === 19;\n        }\n        function parseVariableStatement(fullStart, decorators, modifiers) {\n            var node = createNode(205, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            node.declarationList = parseVariableDeclarationList(false);\n            parseSemicolon();\n            return addJSDocComment(finishNode(node));\n        }\n        function parseFunctionDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(225, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(88);\n            node.asteriskToken = parseOptionalToken(38);\n            node.name = ts.hasModifier(node, 512) ? parseOptionalIdentifier() : parseIdentifier();\n            var isGenerator = !!node.asteriskToken;\n            var isAsync = ts.hasModifier(node, 256);\n            fillSignature(55, isGenerator, isAsync, false, node);\n            node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected);\n            return addJSDocComment(finishNode(node));\n        }\n        function parseConstructorDeclaration(pos, decorators, modifiers) {\n            var node = createNode(150, pos);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(122);\n            fillSignature(55, false, false, false, node);\n            node.body = parseFunctionBlockOrSemicolon(false, false, ts.Diagnostics.or_expected);\n            return addJSDocComment(finishNode(node));\n        }\n        function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) {\n            var method = createNode(149, fullStart);\n            method.decorators = decorators;\n            method.modifiers = modifiers;\n            method.asteriskToken = asteriskToken;\n            method.name = name;\n            method.questionToken = questionToken;\n            var isGenerator = !!asteriskToken;\n            var isAsync = ts.hasModifier(method, 256);\n            fillSignature(55, isGenerator, isAsync, false, method);\n            method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage);\n            return addJSDocComment(finishNode(method));\n        }\n        function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) {\n            var property = createNode(147, fullStart);\n            property.decorators = decorators;\n            property.modifiers = modifiers;\n            property.name = name;\n            property.questionToken = questionToken;\n            property.type = parseTypeAnnotation();\n            property.initializer = ts.hasModifier(property, 32)\n                ? allowInAnd(parseNonParameterInitializer)\n                : doOutsideOfContext(4096 | 2048, parseNonParameterInitializer);\n            parseSemicolon();\n            return addJSDocComment(finishNode(property));\n        }\n        function parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers) {\n            var asteriskToken = parseOptionalToken(38);\n            var name = parsePropertyName();\n            var questionToken = parseOptionalToken(54);\n            if (asteriskToken || token() === 18 || token() === 26) {\n                return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected);\n            }\n            else {\n                return parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken);\n            }\n        }\n        function parseNonParameterInitializer() {\n            return parseInitializer(false);\n        }\n        function parseAccessorDeclaration(kind, fullStart, decorators, modifiers) {\n            var node = createNode(kind, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            node.name = parsePropertyName();\n            fillSignature(55, false, false, false, node);\n            node.body = parseFunctionBlockOrSemicolon(false, false);\n            return addJSDocComment(finishNode(node));\n        }\n        function isClassMemberModifier(idToken) {\n            switch (idToken) {\n                case 113:\n                case 111:\n                case 112:\n                case 114:\n                case 130:\n                    return true;\n                default:\n                    return false;\n            }\n        }\n        function isClassMemberStart() {\n            var idToken;\n            if (token() === 56) {\n                return true;\n            }\n            while (ts.isModifierKind(token())) {\n                idToken = token();\n                if (isClassMemberModifier(idToken)) {\n                    return true;\n                }\n                nextToken();\n            }\n            if (token() === 38) {\n                return true;\n            }\n            if (isLiteralPropertyName()) {\n                idToken = token();\n                nextToken();\n            }\n            if (token() === 20) {\n                return true;\n            }\n            if (idToken !== undefined) {\n                if (!ts.isKeyword(idToken) || idToken === 133 || idToken === 124) {\n                    return true;\n                }\n                switch (token()) {\n                    case 18:\n                    case 26:\n                    case 55:\n                    case 57:\n                    case 54:\n                        return true;\n                    default:\n                        return canParseSemicolon();\n                }\n            }\n            return false;\n        }\n        function parseDecorators() {\n            var decorators;\n            while (true) {\n                var decoratorStart = getNodePos();\n                if (!parseOptional(56)) {\n                    break;\n                }\n                var decorator = createNode(145, decoratorStart);\n                decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher);\n                finishNode(decorator);\n                if (!decorators) {\n                    decorators = createNodeArray([decorator], decoratorStart);\n                }\n                else {\n                    decorators.push(decorator);\n                }\n            }\n            if (decorators) {\n                decorators.end = getNodeEnd();\n            }\n            return decorators;\n        }\n        function parseModifiers(permitInvalidConstAsModifier) {\n            var modifiers;\n            while (true) {\n                var modifierStart = scanner.getStartPos();\n                var modifierKind = token();\n                if (token() === 75 && permitInvalidConstAsModifier) {\n                    if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) {\n                        break;\n                    }\n                }\n                else {\n                    if (!parseAnyContextualModifier()) {\n                        break;\n                    }\n                }\n                var modifier = finishNode(createNode(modifierKind, modifierStart));\n                if (!modifiers) {\n                    modifiers = createNodeArray([modifier], modifierStart);\n                }\n                else {\n                    modifiers.push(modifier);\n                }\n            }\n            if (modifiers) {\n                modifiers.end = scanner.getStartPos();\n            }\n            return modifiers;\n        }\n        function parseModifiersForArrowFunction() {\n            var modifiers;\n            if (token() === 119) {\n                var modifierStart = scanner.getStartPos();\n                var modifierKind = token();\n                nextToken();\n                var modifier = finishNode(createNode(modifierKind, modifierStart));\n                modifiers = createNodeArray([modifier], modifierStart);\n                modifiers.end = scanner.getStartPos();\n            }\n            return modifiers;\n        }\n        function parseClassElement() {\n            if (token() === 24) {\n                var result = createNode(203);\n                nextToken();\n                return finishNode(result);\n            }\n            var fullStart = getNodePos();\n            var decorators = parseDecorators();\n            var modifiers = parseModifiers(true);\n            var accessor = tryParseAccessorDeclaration(fullStart, decorators, modifiers);\n            if (accessor) {\n                return accessor;\n            }\n            if (token() === 122) {\n                return parseConstructorDeclaration(fullStart, decorators, modifiers);\n            }\n            if (isIndexSignature()) {\n                return parseIndexSignatureDeclaration(fullStart, decorators, modifiers);\n            }\n            if (ts.tokenIsIdentifierOrKeyword(token()) ||\n                token() === 9 ||\n                token() === 8 ||\n                token() === 38 ||\n                token() === 20) {\n                return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers);\n            }\n            if (decorators || modifiers) {\n                var name_15 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected);\n                return parsePropertyDeclaration(fullStart, decorators, modifiers, name_15, undefined);\n            }\n            ts.Debug.fail(\"Should not have attempted to parse class member declaration.\");\n        }\n        function parseClassExpression() {\n            return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 197);\n        }\n        function parseClassDeclaration(fullStart, decorators, modifiers) {\n            return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 226);\n        }\n        function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) {\n            var node = createNode(kind, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(74);\n            node.name = parseNameOfClassDeclarationOrExpression();\n            node.typeParameters = parseTypeParameters();\n            node.heritageClauses = parseHeritageClauses();\n            if (parseExpected(16)) {\n                node.members = parseClassMembers();\n                parseExpected(17);\n            }\n            else {\n                node.members = createMissingList();\n            }\n            return addJSDocComment(finishNode(node));\n        }\n        function parseNameOfClassDeclarationOrExpression() {\n            return isIdentifier() && !isImplementsClause()\n                ? parseIdentifier()\n                : undefined;\n        }\n        function isImplementsClause() {\n            return token() === 107 && lookAhead(nextTokenIsIdentifierOrKeyword);\n        }\n        function parseHeritageClauses() {\n            if (isHeritageClause()) {\n                return parseList(21, parseHeritageClause);\n            }\n            return undefined;\n        }\n        function parseHeritageClause() {\n            if (token() === 84 || token() === 107) {\n                var node = createNode(255);\n                node.token = token();\n                nextToken();\n                node.types = parseDelimitedList(7, parseExpressionWithTypeArguments);\n                return finishNode(node);\n            }\n            return undefined;\n        }\n        function parseExpressionWithTypeArguments() {\n            var node = createNode(199);\n            node.expression = parseLeftHandSideExpressionOrHigher();\n            if (token() === 26) {\n                node.typeArguments = parseBracketedList(19, parseType, 26, 28);\n            }\n            return finishNode(node);\n        }\n        function isHeritageClause() {\n            return token() === 84 || token() === 107;\n        }\n        function parseClassMembers() {\n            return parseList(5, parseClassElement);\n        }\n        function parseInterfaceDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(227, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(108);\n            node.name = parseIdentifier();\n            node.typeParameters = parseTypeParameters();\n            node.heritageClauses = parseHeritageClauses();\n            node.members = parseObjectTypeMembers();\n            return addJSDocComment(finishNode(node));\n        }\n        function parseTypeAliasDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(228, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(136);\n            node.name = parseIdentifier();\n            node.typeParameters = parseTypeParameters();\n            parseExpected(57);\n            node.type = parseType();\n            parseSemicolon();\n            return addJSDocComment(finishNode(node));\n        }\n        function parseEnumMember() {\n            var node = createNode(260, scanner.getStartPos());\n            node.name = parsePropertyName();\n            node.initializer = allowInAnd(parseNonParameterInitializer);\n            return addJSDocComment(finishNode(node));\n        }\n        function parseEnumDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(229, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(82);\n            node.name = parseIdentifier();\n            if (parseExpected(16)) {\n                node.members = parseDelimitedList(6, parseEnumMember);\n                parseExpected(17);\n            }\n            else {\n                node.members = createMissingList();\n            }\n            return addJSDocComment(finishNode(node));\n        }\n        function parseModuleBlock() {\n            var node = createNode(231, scanner.getStartPos());\n            if (parseExpected(16)) {\n                node.statements = parseList(1, parseStatement);\n                parseExpected(17);\n            }\n            else {\n                node.statements = createMissingList();\n            }\n            return finishNode(node);\n        }\n        function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) {\n            var node = createNode(230, fullStart);\n            var namespaceFlag = flags & 16;\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            node.flags |= flags;\n            node.name = parseIdentifier();\n            node.body = parseOptional(22)\n                ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 4 | namespaceFlag)\n                : parseModuleBlock();\n            return addJSDocComment(finishNode(node));\n        }\n        function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(230, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            if (token() === 139) {\n                node.name = parseIdentifier();\n                node.flags |= 512;\n            }\n            else {\n                node.name = parseLiteralNode(true);\n            }\n            if (token() === 16) {\n                node.body = parseModuleBlock();\n            }\n            else {\n                parseSemicolon();\n            }\n            return finishNode(node);\n        }\n        function parseModuleDeclaration(fullStart, decorators, modifiers) {\n            var flags = 0;\n            if (token() === 139) {\n                return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers);\n            }\n            else if (parseOptional(128)) {\n                flags |= 16;\n            }\n            else {\n                parseExpected(127);\n                if (token() === 9) {\n                    return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers);\n                }\n            }\n            return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags);\n        }\n        function isExternalModuleReference() {\n            return token() === 131 &&\n                lookAhead(nextTokenIsOpenParen);\n        }\n        function nextTokenIsOpenParen() {\n            return nextToken() === 18;\n        }\n        function nextTokenIsSlash() {\n            return nextToken() === 40;\n        }\n        function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) {\n            var exportDeclaration = createNode(233, fullStart);\n            exportDeclaration.decorators = decorators;\n            exportDeclaration.modifiers = modifiers;\n            parseExpected(117);\n            parseExpected(128);\n            exportDeclaration.name = parseIdentifier();\n            parseSemicolon();\n            return finishNode(exportDeclaration);\n        }\n        function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) {\n            parseExpected(90);\n            var afterImportPos = scanner.getStartPos();\n            var identifier;\n            if (isIdentifier()) {\n                identifier = parseIdentifier();\n                if (token() !== 25 && token() !== 138) {\n                    var importEqualsDeclaration = createNode(234, fullStart);\n                    importEqualsDeclaration.decorators = decorators;\n                    importEqualsDeclaration.modifiers = modifiers;\n                    importEqualsDeclaration.name = identifier;\n                    parseExpected(57);\n                    importEqualsDeclaration.moduleReference = parseModuleReference();\n                    parseSemicolon();\n                    return addJSDocComment(finishNode(importEqualsDeclaration));\n                }\n            }\n            var importDeclaration = createNode(235, fullStart);\n            importDeclaration.decorators = decorators;\n            importDeclaration.modifiers = modifiers;\n            if (identifier ||\n                token() === 38 ||\n                token() === 16) {\n                importDeclaration.importClause = parseImportClause(identifier, afterImportPos);\n                parseExpected(138);\n            }\n            importDeclaration.moduleSpecifier = parseModuleSpecifier();\n            parseSemicolon();\n            return finishNode(importDeclaration);\n        }\n        function parseImportClause(identifier, fullStart) {\n            var importClause = createNode(236, fullStart);\n            if (identifier) {\n                importClause.name = identifier;\n            }\n            if (!importClause.name ||\n                parseOptional(25)) {\n                importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(238);\n            }\n            return finishNode(importClause);\n        }\n        function parseModuleReference() {\n            return isExternalModuleReference()\n                ? parseExternalModuleReference()\n                : parseEntityName(false);\n        }\n        function parseExternalModuleReference() {\n            var node = createNode(245);\n            parseExpected(131);\n            parseExpected(18);\n            node.expression = parseModuleSpecifier();\n            parseExpected(19);\n            return finishNode(node);\n        }\n        function parseModuleSpecifier() {\n            if (token() === 9) {\n                var result = parseLiteralNode();\n                internIdentifier(result.text);\n                return result;\n            }\n            else {\n                return parseExpression();\n            }\n        }\n        function parseNamespaceImport() {\n            var namespaceImport = createNode(237);\n            parseExpected(38);\n            parseExpected(117);\n            namespaceImport.name = parseIdentifier();\n            return finishNode(namespaceImport);\n        }\n        function parseNamedImportsOrExports(kind) {\n            var node = createNode(kind);\n            node.elements = parseBracketedList(22, kind === 238 ? parseImportSpecifier : parseExportSpecifier, 16, 17);\n            return finishNode(node);\n        }\n        function parseExportSpecifier() {\n            return parseImportOrExportSpecifier(243);\n        }\n        function parseImportSpecifier() {\n            return parseImportOrExportSpecifier(239);\n        }\n        function parseImportOrExportSpecifier(kind) {\n            var node = createNode(kind);\n            var checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();\n            var checkIdentifierStart = scanner.getTokenPos();\n            var checkIdentifierEnd = scanner.getTextPos();\n            var identifierName = parseIdentifierName();\n            if (token() === 117) {\n                node.propertyName = identifierName;\n                parseExpected(117);\n                checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();\n                checkIdentifierStart = scanner.getTokenPos();\n                checkIdentifierEnd = scanner.getTextPos();\n                node.name = parseIdentifierName();\n            }\n            else {\n                node.name = identifierName;\n            }\n            if (kind === 239 && checkIdentifierIsKeyword) {\n                parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected);\n            }\n            return finishNode(node);\n        }\n        function parseExportDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(241, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            if (parseOptional(38)) {\n                parseExpected(138);\n                node.moduleSpecifier = parseModuleSpecifier();\n            }\n            else {\n                node.exportClause = parseNamedImportsOrExports(242);\n                if (token() === 138 || (token() === 9 && !scanner.hasPrecedingLineBreak())) {\n                    parseExpected(138);\n                    node.moduleSpecifier = parseModuleSpecifier();\n                }\n            }\n            parseSemicolon();\n            return finishNode(node);\n        }\n        function parseExportAssignment(fullStart, decorators, modifiers) {\n            var node = createNode(240, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            if (parseOptional(57)) {\n                node.isExportEquals = true;\n            }\n            else {\n                parseExpected(78);\n            }\n            node.expression = parseAssignmentExpressionOrHigher();\n            parseSemicolon();\n            return finishNode(node);\n        }\n        function processReferenceComments(sourceFile) {\n            var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, 0, sourceText);\n            var referencedFiles = [];\n            var typeReferenceDirectives = [];\n            var amdDependencies = [];\n            var amdModuleName;\n            while (true) {\n                var kind = triviaScanner.scan();\n                if (kind !== 2) {\n                    if (ts.isTrivia(kind)) {\n                        continue;\n                    }\n                    else {\n                        break;\n                    }\n                }\n                var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos(), kind: triviaScanner.getToken() };\n                var comment = sourceText.substring(range.pos, range.end);\n                var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range);\n                if (referencePathMatchResult) {\n                    var fileReference = referencePathMatchResult.fileReference;\n                    sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib;\n                    var diagnosticMessage = referencePathMatchResult.diagnosticMessage;\n                    if (fileReference) {\n                        if (referencePathMatchResult.isTypeReferenceDirective) {\n                            typeReferenceDirectives.push(fileReference);\n                        }\n                        else {\n                            referencedFiles.push(fileReference);\n                        }\n                    }\n                    if (diagnosticMessage) {\n                        parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage));\n                    }\n                }\n                else {\n                    var amdModuleNameRegEx = /^\\/\\/\\/\\s*<amd-module\\s+name\\s*=\\s*('|\")(.+?)\\1/gim;\n                    var amdModuleNameMatchResult = amdModuleNameRegEx.exec(comment);\n                    if (amdModuleNameMatchResult) {\n                        if (amdModuleName) {\n                            parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, ts.Diagnostics.An_AMD_module_cannot_have_multiple_name_assignments));\n                        }\n                        amdModuleName = amdModuleNameMatchResult[2];\n                    }\n                    var amdDependencyRegEx = /^\\/\\/\\/\\s*<amd-dependency\\s/gim;\n                    var pathRegex = /\\spath\\s*=\\s*('|\")(.+?)\\1/gim;\n                    var nameRegex = /\\sname\\s*=\\s*('|\")(.+?)\\1/gim;\n                    var amdDependencyMatchResult = amdDependencyRegEx.exec(comment);\n                    if (amdDependencyMatchResult) {\n                        var pathMatchResult = pathRegex.exec(comment);\n                        var nameMatchResult = nameRegex.exec(comment);\n                        if (pathMatchResult) {\n                            var amdDependency = { path: pathMatchResult[2], name: nameMatchResult ? nameMatchResult[2] : undefined };\n                            amdDependencies.push(amdDependency);\n                        }\n                    }\n                }\n            }\n            sourceFile.referencedFiles = referencedFiles;\n            sourceFile.typeReferenceDirectives = typeReferenceDirectives;\n            sourceFile.amdDependencies = amdDependencies;\n            sourceFile.moduleName = amdModuleName;\n        }\n        function setExternalModuleIndicator(sourceFile) {\n            sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) {\n                return ts.hasModifier(node, 1)\n                    || node.kind === 234 && node.moduleReference.kind === 245\n                    || node.kind === 235\n                    || node.kind === 240\n                    || node.kind === 241\n                    ? node\n                    : undefined;\n            });\n        }\n        var JSDocParser;\n        (function (JSDocParser) {\n            function isJSDocType() {\n                switch (token()) {\n                    case 38:\n                    case 54:\n                    case 18:\n                    case 20:\n                    case 50:\n                    case 16:\n                    case 88:\n                    case 23:\n                    case 93:\n                    case 98:\n                        return true;\n                }\n                return ts.tokenIsIdentifierOrKeyword(token());\n            }\n            JSDocParser.isJSDocType = isJSDocType;\n            function parseJSDocTypeExpressionForTests(content, start, length) {\n                initializeState(content, 5, undefined, 1);\n                sourceFile = createSourceFile(\"file.js\", 5, 1);\n                scanner.setText(content, start, length);\n                currentToken = scanner.scan();\n                var jsDocTypeExpression = parseJSDocTypeExpression();\n                var diagnostics = parseDiagnostics;\n                clearState();\n                return jsDocTypeExpression ? { jsDocTypeExpression: jsDocTypeExpression, diagnostics: diagnostics } : undefined;\n            }\n            JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;\n            function parseJSDocTypeExpression() {\n                var result = createNode(262, scanner.getTokenPos());\n                parseExpected(16);\n                result.type = parseJSDocTopLevelType();\n                parseExpected(17);\n                fixupParentReferences(result);\n                return finishNode(result);\n            }\n            JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;\n            function parseJSDocTopLevelType() {\n                var type = parseJSDocType();\n                if (token() === 48) {\n                    var unionType = createNode(266, type.pos);\n                    unionType.types = parseJSDocTypeList(type);\n                    type = finishNode(unionType);\n                }\n                if (token() === 57) {\n                    var optionalType = createNode(273, type.pos);\n                    nextToken();\n                    optionalType.type = type;\n                    type = finishNode(optionalType);\n                }\n                return type;\n            }\n            function parseJSDocType() {\n                var type = parseBasicTypeExpression();\n                while (true) {\n                    if (token() === 20) {\n                        var arrayType = createNode(265, type.pos);\n                        arrayType.elementType = type;\n                        nextToken();\n                        parseExpected(21);\n                        type = finishNode(arrayType);\n                    }\n                    else if (token() === 54) {\n                        var nullableType = createNode(268, type.pos);\n                        nullableType.type = type;\n                        nextToken();\n                        type = finishNode(nullableType);\n                    }\n                    else if (token() === 50) {\n                        var nonNullableType = createNode(269, type.pos);\n                        nonNullableType.type = type;\n                        nextToken();\n                        type = finishNode(nonNullableType);\n                    }\n                    else {\n                        break;\n                    }\n                }\n                return type;\n            }\n            function parseBasicTypeExpression() {\n                switch (token()) {\n                    case 38:\n                        return parseJSDocAllType();\n                    case 54:\n                        return parseJSDocUnknownOrNullableType();\n                    case 18:\n                        return parseJSDocUnionType();\n                    case 20:\n                        return parseJSDocTupleType();\n                    case 50:\n                        return parseJSDocNonNullableType();\n                    case 16:\n                        return parseJSDocRecordType();\n                    case 88:\n                        return parseJSDocFunctionType();\n                    case 23:\n                        return parseJSDocVariadicType();\n                    case 93:\n                        return parseJSDocConstructorType();\n                    case 98:\n                        return parseJSDocThisType();\n                    case 118:\n                    case 134:\n                    case 132:\n                    case 121:\n                    case 135:\n                    case 104:\n                    case 94:\n                    case 137:\n                    case 129:\n                        return parseTokenNode();\n                    case 9:\n                    case 8:\n                    case 100:\n                    case 85:\n                        return parseJSDocLiteralType();\n                }\n                return parseJSDocTypeReference();\n            }\n            function parseJSDocThisType() {\n                var result = createNode(277);\n                nextToken();\n                parseExpected(55);\n                result.type = parseJSDocType();\n                return finishNode(result);\n            }\n            function parseJSDocConstructorType() {\n                var result = createNode(276);\n                nextToken();\n                parseExpected(55);\n                result.type = parseJSDocType();\n                return finishNode(result);\n            }\n            function parseJSDocVariadicType() {\n                var result = createNode(275);\n                nextToken();\n                result.type = parseJSDocType();\n                return finishNode(result);\n            }\n            function parseJSDocFunctionType() {\n                var result = createNode(274);\n                nextToken();\n                parseExpected(18);\n                result.parameters = parseDelimitedList(23, parseJSDocParameter);\n                checkForTrailingComma(result.parameters);\n                parseExpected(19);\n                if (token() === 55) {\n                    nextToken();\n                    result.type = parseJSDocType();\n                }\n                return finishNode(result);\n            }\n            function parseJSDocParameter() {\n                var parameter = createNode(144);\n                parameter.type = parseJSDocType();\n                if (parseOptional(57)) {\n                    parameter.questionToken = createNode(57);\n                }\n                return finishNode(parameter);\n            }\n            function parseJSDocTypeReference() {\n                var result = createNode(272);\n                result.name = parseSimplePropertyName();\n                if (token() === 26) {\n                    result.typeArguments = parseTypeArguments();\n                }\n                else {\n                    while (parseOptional(22)) {\n                        if (token() === 26) {\n                            result.typeArguments = parseTypeArguments();\n                            break;\n                        }\n                        else {\n                            result.name = parseQualifiedName(result.name);\n                        }\n                    }\n                }\n                return finishNode(result);\n            }\n            function parseTypeArguments() {\n                nextToken();\n                var typeArguments = parseDelimitedList(24, parseJSDocType);\n                checkForTrailingComma(typeArguments);\n                checkForEmptyTypeArgumentList(typeArguments);\n                parseExpected(28);\n                return typeArguments;\n            }\n            function checkForEmptyTypeArgumentList(typeArguments) {\n                if (parseDiagnostics.length === 0 && typeArguments && typeArguments.length === 0) {\n                    var start = typeArguments.pos - \"<\".length;\n                    var end = ts.skipTrivia(sourceText, typeArguments.end) + \">\".length;\n                    return parseErrorAtPosition(start, end - start, ts.Diagnostics.Type_argument_list_cannot_be_empty);\n                }\n            }\n            function parseQualifiedName(left) {\n                var result = createNode(141, left.pos);\n                result.left = left;\n                result.right = parseIdentifierName();\n                return finishNode(result);\n            }\n            function parseJSDocRecordType() {\n                var result = createNode(270);\n                result.literal = parseTypeLiteral();\n                return finishNode(result);\n            }\n            function parseJSDocNonNullableType() {\n                var result = createNode(269);\n                nextToken();\n                result.type = parseJSDocType();\n                return finishNode(result);\n            }\n            function parseJSDocTupleType() {\n                var result = createNode(267);\n                nextToken();\n                result.types = parseDelimitedList(26, parseJSDocType);\n                checkForTrailingComma(result.types);\n                parseExpected(21);\n                return finishNode(result);\n            }\n            function checkForTrailingComma(list) {\n                if (parseDiagnostics.length === 0 && list.hasTrailingComma) {\n                    var start = list.end - \",\".length;\n                    parseErrorAtPosition(start, \",\".length, ts.Diagnostics.Trailing_comma_not_allowed);\n                }\n            }\n            function parseJSDocUnionType() {\n                var result = createNode(266);\n                nextToken();\n                result.types = parseJSDocTypeList(parseJSDocType());\n                parseExpected(19);\n                return finishNode(result);\n            }\n            function parseJSDocTypeList(firstType) {\n                ts.Debug.assert(!!firstType);\n                var types = createNodeArray([firstType], firstType.pos);\n                while (parseOptional(48)) {\n                    types.push(parseJSDocType());\n                }\n                types.end = scanner.getStartPos();\n                return types;\n            }\n            function parseJSDocAllType() {\n                var result = createNode(263);\n                nextToken();\n                return finishNode(result);\n            }\n            function parseJSDocLiteralType() {\n                var result = createNode(288);\n                result.literal = parseLiteralTypeNode();\n                return finishNode(result);\n            }\n            function parseJSDocUnknownOrNullableType() {\n                var pos = scanner.getStartPos();\n                nextToken();\n                if (token() === 25 ||\n                    token() === 17 ||\n                    token() === 19 ||\n                    token() === 28 ||\n                    token() === 57 ||\n                    token() === 48) {\n                    var result = createNode(264, pos);\n                    return finishNode(result);\n                }\n                else {\n                    var result = createNode(268, pos);\n                    result.type = parseJSDocType();\n                    return finishNode(result);\n                }\n            }\n            function parseIsolatedJSDocComment(content, start, length) {\n                initializeState(content, 5, undefined, 1);\n                sourceFile = { languageVariant: 0, text: content };\n                var jsDoc = parseJSDocCommentWorker(start, length);\n                var diagnostics = parseDiagnostics;\n                clearState();\n                return jsDoc ? { jsDoc: jsDoc, diagnostics: diagnostics } : undefined;\n            }\n            JSDocParser.parseIsolatedJSDocComment = parseIsolatedJSDocComment;\n            function parseJSDocComment(parent, start, length) {\n                var saveToken = currentToken;\n                var saveParseDiagnosticsLength = parseDiagnostics.length;\n                var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;\n                var comment = parseJSDocCommentWorker(start, length);\n                if (comment) {\n                    comment.parent = parent;\n                }\n                currentToken = saveToken;\n                parseDiagnostics.length = saveParseDiagnosticsLength;\n                parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode;\n                return comment;\n            }\n            JSDocParser.parseJSDocComment = parseJSDocComment;\n            function parseJSDocCommentWorker(start, length) {\n                var content = sourceText;\n                start = start || 0;\n                var end = length === undefined ? content.length : start + length;\n                length = end - start;\n                ts.Debug.assert(start >= 0);\n                ts.Debug.assert(start <= end);\n                ts.Debug.assert(end <= content.length);\n                var tags;\n                var comments = [];\n                var result;\n                if (!isJsDocStart(content, start)) {\n                    return result;\n                }\n                scanner.scanRange(start + 3, length - 5, function () {\n                    var advanceToken = true;\n                    var state = 1;\n                    var margin = undefined;\n                    var indent = start - Math.max(content.lastIndexOf(\"\\n\", start), 0) + 4;\n                    function pushComment(text) {\n                        if (!margin) {\n                            margin = indent;\n                        }\n                        comments.push(text);\n                        indent += text.length;\n                    }\n                    nextJSDocToken();\n                    while (token() === 5) {\n                        nextJSDocToken();\n                    }\n                    if (token() === 4) {\n                        state = 0;\n                        indent = 0;\n                        nextJSDocToken();\n                    }\n                    while (token() !== 1) {\n                        switch (token()) {\n                            case 56:\n                                if (state === 0 || state === 1) {\n                                    removeTrailingNewlines(comments);\n                                    parseTag(indent);\n                                    state = 0;\n                                    advanceToken = false;\n                                    margin = undefined;\n                                    indent++;\n                                }\n                                else {\n                                    pushComment(scanner.getTokenText());\n                                }\n                                break;\n                            case 4:\n                                comments.push(scanner.getTokenText());\n                                state = 0;\n                                indent = 0;\n                                break;\n                            case 38:\n                                var asterisk = scanner.getTokenText();\n                                if (state === 1) {\n                                    state = 2;\n                                    pushComment(asterisk);\n                                }\n                                else {\n                                    state = 1;\n                                    indent += asterisk.length;\n                                }\n                                break;\n                            case 70:\n                                pushComment(scanner.getTokenText());\n                                state = 2;\n                                break;\n                            case 5:\n                                var whitespace = scanner.getTokenText();\n                                if (state === 2 || margin !== undefined && indent + whitespace.length > margin) {\n                                    comments.push(whitespace.slice(margin - indent - 1));\n                                }\n                                indent += whitespace.length;\n                                break;\n                            case 1:\n                                break;\n                            default:\n                                pushComment(scanner.getTokenText());\n                                break;\n                        }\n                        if (advanceToken) {\n                            nextJSDocToken();\n                        }\n                        else {\n                            advanceToken = true;\n                        }\n                    }\n                    removeLeadingNewlines(comments);\n                    removeTrailingNewlines(comments);\n                    result = createJSDocComment();\n                });\n                return result;\n                function removeLeadingNewlines(comments) {\n                    while (comments.length && (comments[0] === \"\\n\" || comments[0] === \"\\r\")) {\n                        comments.shift();\n                    }\n                }\n                function removeTrailingNewlines(comments) {\n                    while (comments.length && (comments[comments.length - 1] === \"\\n\" || comments[comments.length - 1] === \"\\r\")) {\n                        comments.pop();\n                    }\n                }\n                function isJsDocStart(content, start) {\n                    return content.charCodeAt(start) === 47 &&\n                        content.charCodeAt(start + 1) === 42 &&\n                        content.charCodeAt(start + 2) === 42 &&\n                        content.charCodeAt(start + 3) !== 42;\n                }\n                function createJSDocComment() {\n                    var result = createNode(278, start);\n                    result.tags = tags;\n                    result.comment = comments.length ? comments.join(\"\") : undefined;\n                    return finishNode(result, end);\n                }\n                function skipWhitespace() {\n                    while (token() === 5 || token() === 4) {\n                        nextJSDocToken();\n                    }\n                }\n                function parseTag(indent) {\n                    ts.Debug.assert(token() === 56);\n                    var atToken = createNode(56, scanner.getTokenPos());\n                    atToken.end = scanner.getTextPos();\n                    nextJSDocToken();\n                    var tagName = parseJSDocIdentifierName();\n                    skipWhitespace();\n                    if (!tagName) {\n                        return;\n                    }\n                    var tag;\n                    if (tagName) {\n                        switch (tagName.text) {\n                            case \"augments\":\n                                tag = parseAugmentsTag(atToken, tagName);\n                                break;\n                            case \"param\":\n                                tag = parseParamTag(atToken, tagName);\n                                break;\n                            case \"return\":\n                            case \"returns\":\n                                tag = parseReturnTag(atToken, tagName);\n                                break;\n                            case \"template\":\n                                tag = parseTemplateTag(atToken, tagName);\n                                break;\n                            case \"type\":\n                                tag = parseTypeTag(atToken, tagName);\n                                break;\n                            case \"typedef\":\n                                tag = parseTypedefTag(atToken, tagName);\n                                break;\n                            default:\n                                tag = parseUnknownTag(atToken, tagName);\n                                break;\n                        }\n                    }\n                    else {\n                        tag = parseUnknownTag(atToken, tagName);\n                    }\n                    if (!tag) {\n                        return;\n                    }\n                    addTag(tag, parseTagComments(indent + tag.end - tag.pos));\n                }\n                function parseTagComments(indent) {\n                    var comments = [];\n                    var state = 1;\n                    var margin;\n                    function pushComment(text) {\n                        if (!margin) {\n                            margin = indent;\n                        }\n                        comments.push(text);\n                        indent += text.length;\n                    }\n                    while (token() !== 56 && token() !== 1) {\n                        switch (token()) {\n                            case 4:\n                                if (state >= 1) {\n                                    state = 0;\n                                    comments.push(scanner.getTokenText());\n                                }\n                                indent = 0;\n                                break;\n                            case 56:\n                                break;\n                            case 5:\n                                if (state === 2) {\n                                    pushComment(scanner.getTokenText());\n                                }\n                                else {\n                                    var whitespace = scanner.getTokenText();\n                                    if (margin !== undefined && indent + whitespace.length > margin) {\n                                        comments.push(whitespace.slice(margin - indent - 1));\n                                    }\n                                    indent += whitespace.length;\n                                }\n                                break;\n                            case 38:\n                                if (state === 0) {\n                                    state = 1;\n                                    indent += scanner.getTokenText().length;\n                                    break;\n                                }\n                            default:\n                                state = 2;\n                                pushComment(scanner.getTokenText());\n                                break;\n                        }\n                        if (token() === 56) {\n                            break;\n                        }\n                        nextJSDocToken();\n                    }\n                    removeLeadingNewlines(comments);\n                    removeTrailingNewlines(comments);\n                    return comments;\n                }\n                function parseUnknownTag(atToken, tagName) {\n                    var result = createNode(279, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    return finishNode(result);\n                }\n                function addTag(tag, comments) {\n                    tag.comment = comments.join(\"\");\n                    if (!tags) {\n                        tags = createNodeArray([tag], tag.pos);\n                    }\n                    else {\n                        tags.push(tag);\n                    }\n                    tags.end = tag.end;\n                }\n                function tryParseTypeExpression() {\n                    return tryParse(function () {\n                        skipWhitespace();\n                        if (token() !== 16) {\n                            return undefined;\n                        }\n                        return parseJSDocTypeExpression();\n                    });\n                }\n                function parseParamTag(atToken, tagName) {\n                    var typeExpression = tryParseTypeExpression();\n                    skipWhitespace();\n                    var name;\n                    var isBracketed;\n                    if (parseOptionalToken(20)) {\n                        name = parseJSDocIdentifierName();\n                        skipWhitespace();\n                        isBracketed = true;\n                        if (parseOptionalToken(57)) {\n                            parseExpression();\n                        }\n                        parseExpected(21);\n                    }\n                    else if (ts.tokenIsIdentifierOrKeyword(token())) {\n                        name = parseJSDocIdentifierName();\n                    }\n                    if (!name) {\n                        parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);\n                        return undefined;\n                    }\n                    var preName, postName;\n                    if (typeExpression) {\n                        postName = name;\n                    }\n                    else {\n                        preName = name;\n                    }\n                    if (!typeExpression) {\n                        typeExpression = tryParseTypeExpression();\n                    }\n                    var result = createNode(281, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.preParameterName = preName;\n                    result.typeExpression = typeExpression;\n                    result.postParameterName = postName;\n                    result.parameterName = postName || preName;\n                    result.isBracketed = isBracketed;\n                    return finishNode(result);\n                }\n                function parseReturnTag(atToken, tagName) {\n                    if (ts.forEach(tags, function (t) { return t.kind === 282; })) {\n                        parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);\n                    }\n                    var result = createNode(282, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.typeExpression = tryParseTypeExpression();\n                    return finishNode(result);\n                }\n                function parseTypeTag(atToken, tagName) {\n                    if (ts.forEach(tags, function (t) { return t.kind === 283; })) {\n                        parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);\n                    }\n                    var result = createNode(283, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.typeExpression = tryParseTypeExpression();\n                    return finishNode(result);\n                }\n                function parsePropertyTag(atToken, tagName) {\n                    var typeExpression = tryParseTypeExpression();\n                    skipWhitespace();\n                    var name = parseJSDocIdentifierName();\n                    skipWhitespace();\n                    if (!name) {\n                        parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);\n                        return undefined;\n                    }\n                    var result = createNode(286, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.name = name;\n                    result.typeExpression = typeExpression;\n                    return finishNode(result);\n                }\n                function parseAugmentsTag(atToken, tagName) {\n                    var typeExpression = tryParseTypeExpression();\n                    var result = createNode(280, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.typeExpression = typeExpression;\n                    return finishNode(result);\n                }\n                function parseTypedefTag(atToken, tagName) {\n                    var typeExpression = tryParseTypeExpression();\n                    skipWhitespace();\n                    var typedefTag = createNode(285, atToken.pos);\n                    typedefTag.atToken = atToken;\n                    typedefTag.tagName = tagName;\n                    typedefTag.fullName = parseJSDocTypeNameWithNamespace(0);\n                    if (typedefTag.fullName) {\n                        var rightNode = typedefTag.fullName;\n                        while (rightNode.kind !== 70) {\n                            rightNode = rightNode.body;\n                        }\n                        typedefTag.name = rightNode;\n                    }\n                    typedefTag.typeExpression = typeExpression;\n                    skipWhitespace();\n                    if (typeExpression) {\n                        if (typeExpression.type.kind === 272) {\n                            var jsDocTypeReference = typeExpression.type;\n                            if (jsDocTypeReference.name.kind === 70) {\n                                var name_16 = jsDocTypeReference.name;\n                                if (name_16.text === \"Object\") {\n                                    typedefTag.jsDocTypeLiteral = scanChildTags();\n                                }\n                            }\n                        }\n                        if (!typedefTag.jsDocTypeLiteral) {\n                            typedefTag.jsDocTypeLiteral = typeExpression.type;\n                        }\n                    }\n                    else {\n                        typedefTag.jsDocTypeLiteral = scanChildTags();\n                    }\n                    return finishNode(typedefTag);\n                    function scanChildTags() {\n                        var jsDocTypeLiteral = createNode(287, scanner.getStartPos());\n                        var resumePos = scanner.getStartPos();\n                        var canParseTag = true;\n                        var seenAsterisk = false;\n                        var parentTagTerminated = false;\n                        while (token() !== 1 && !parentTagTerminated) {\n                            nextJSDocToken();\n                            switch (token()) {\n                                case 56:\n                                    if (canParseTag) {\n                                        parentTagTerminated = !tryParseChildTag(jsDocTypeLiteral);\n                                        if (!parentTagTerminated) {\n                                            resumePos = scanner.getStartPos();\n                                        }\n                                    }\n                                    seenAsterisk = false;\n                                    break;\n                                case 4:\n                                    resumePos = scanner.getStartPos() - 1;\n                                    canParseTag = true;\n                                    seenAsterisk = false;\n                                    break;\n                                case 38:\n                                    if (seenAsterisk) {\n                                        canParseTag = false;\n                                    }\n                                    seenAsterisk = true;\n                                    break;\n                                case 70:\n                                    canParseTag = false;\n                                case 1:\n                                    break;\n                            }\n                        }\n                        scanner.setTextPos(resumePos);\n                        return finishNode(jsDocTypeLiteral);\n                    }\n                    function parseJSDocTypeNameWithNamespace(flags) {\n                        var pos = scanner.getTokenPos();\n                        var typeNameOrNamespaceName = parseJSDocIdentifierName();\n                        if (typeNameOrNamespaceName && parseOptional(22)) {\n                            var jsDocNamespaceNode = createNode(230, pos);\n                            jsDocNamespaceNode.flags |= flags;\n                            jsDocNamespaceNode.name = typeNameOrNamespaceName;\n                            jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4);\n                            return jsDocNamespaceNode;\n                        }\n                        if (typeNameOrNamespaceName && flags & 4) {\n                            typeNameOrNamespaceName.isInJSDocNamespace = true;\n                        }\n                        return typeNameOrNamespaceName;\n                    }\n                }\n                function tryParseChildTag(parentTag) {\n                    ts.Debug.assert(token() === 56);\n                    var atToken = createNode(56, scanner.getStartPos());\n                    atToken.end = scanner.getTextPos();\n                    nextJSDocToken();\n                    var tagName = parseJSDocIdentifierName();\n                    skipWhitespace();\n                    if (!tagName) {\n                        return false;\n                    }\n                    switch (tagName.text) {\n                        case \"type\":\n                            if (parentTag.jsDocTypeTag) {\n                                return false;\n                            }\n                            parentTag.jsDocTypeTag = parseTypeTag(atToken, tagName);\n                            return true;\n                        case \"prop\":\n                        case \"property\":\n                            var propertyTag = parsePropertyTag(atToken, tagName);\n                            if (propertyTag) {\n                                if (!parentTag.jsDocPropertyTags) {\n                                    parentTag.jsDocPropertyTags = [];\n                                }\n                                parentTag.jsDocPropertyTags.push(propertyTag);\n                                return true;\n                            }\n                            return false;\n                    }\n                    return false;\n                }\n                function parseTemplateTag(atToken, tagName) {\n                    if (ts.forEach(tags, function (t) { return t.kind === 284; })) {\n                        parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);\n                    }\n                    var typeParameters = createNodeArray();\n                    while (true) {\n                        var name_17 = parseJSDocIdentifierName();\n                        skipWhitespace();\n                        if (!name_17) {\n                            parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);\n                            return undefined;\n                        }\n                        var typeParameter = createNode(143, name_17.pos);\n                        typeParameter.name = name_17;\n                        finishNode(typeParameter);\n                        typeParameters.push(typeParameter);\n                        if (token() === 25) {\n                            nextJSDocToken();\n                            skipWhitespace();\n                        }\n                        else {\n                            break;\n                        }\n                    }\n                    var result = createNode(284, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.typeParameters = typeParameters;\n                    finishNode(result);\n                    typeParameters.end = result.end;\n                    return result;\n                }\n                function nextJSDocToken() {\n                    return currentToken = scanner.scanJSDocToken();\n                }\n                function parseJSDocIdentifierName() {\n                    return createJSDocIdentifier(ts.tokenIsIdentifierOrKeyword(token()));\n                }\n                function createJSDocIdentifier(isIdentifier) {\n                    if (!isIdentifier) {\n                        parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);\n                        return undefined;\n                    }\n                    var pos = scanner.getTokenPos();\n                    var end = scanner.getTextPos();\n                    var result = createNode(70, pos);\n                    result.text = content.substring(pos, end);\n                    finishNode(result, end);\n                    nextJSDocToken();\n                    return result;\n                }\n            }\n            JSDocParser.parseJSDocCommentWorker = parseJSDocCommentWorker;\n        })(JSDocParser = Parser.JSDocParser || (Parser.JSDocParser = {}));\n    })(Parser || (Parser = {}));\n    var IncrementalParser;\n    (function (IncrementalParser) {\n        function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) {\n            aggressiveChecks = aggressiveChecks || ts.Debug.shouldAssert(2);\n            checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks);\n            if (ts.textChangeRangeIsUnchanged(textChangeRange)) {\n                return sourceFile;\n            }\n            if (sourceFile.statements.length === 0) {\n                return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, undefined, true, sourceFile.scriptKind);\n            }\n            var incrementalSourceFile = sourceFile;\n            ts.Debug.assert(!incrementalSourceFile.hasBeenIncrementallyParsed);\n            incrementalSourceFile.hasBeenIncrementallyParsed = true;\n            var oldText = sourceFile.text;\n            var syntaxCursor = createSyntaxCursor(sourceFile);\n            var changeRange = extendToAffectedRange(sourceFile, textChangeRange);\n            checkChangeRange(sourceFile, newText, changeRange, aggressiveChecks);\n            ts.Debug.assert(changeRange.span.start <= textChangeRange.span.start);\n            ts.Debug.assert(ts.textSpanEnd(changeRange.span) === ts.textSpanEnd(textChangeRange.span));\n            ts.Debug.assert(ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)) === ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange)));\n            var delta = ts.textChangeRangeNewSpan(changeRange).length - changeRange.span.length;\n            updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, ts.textSpanEnd(changeRange.span), ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks);\n            var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, true, sourceFile.scriptKind);\n            return result;\n        }\n        IncrementalParser.updateSourceFile = updateSourceFile;\n        function moveElementEntirelyPastChangeRange(element, isArray, delta, oldText, newText, aggressiveChecks) {\n            if (isArray) {\n                visitArray(element);\n            }\n            else {\n                visitNode(element);\n            }\n            return;\n            function visitNode(node) {\n                var text = \"\";\n                if (aggressiveChecks && shouldCheckNode(node)) {\n                    text = oldText.substring(node.pos, node.end);\n                }\n                if (node._children) {\n                    node._children = undefined;\n                }\n                node.pos += delta;\n                node.end += delta;\n                if (aggressiveChecks && shouldCheckNode(node)) {\n                    ts.Debug.assert(text === newText.substring(node.pos, node.end));\n                }\n                forEachChild(node, visitNode, visitArray);\n                if (node.jsDoc) {\n                    for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {\n                        var jsDocComment = _a[_i];\n                        forEachChild(jsDocComment, visitNode, visitArray);\n                    }\n                }\n                checkNodePositions(node, aggressiveChecks);\n            }\n            function visitArray(array) {\n                array._children = undefined;\n                array.pos += delta;\n                array.end += delta;\n                for (var _i = 0, array_9 = array; _i < array_9.length; _i++) {\n                    var node = array_9[_i];\n                    visitNode(node);\n                }\n            }\n        }\n        function shouldCheckNode(node) {\n            switch (node.kind) {\n                case 9:\n                case 8:\n                case 70:\n                    return true;\n            }\n            return false;\n        }\n        function adjustIntersectingElement(element, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta) {\n            ts.Debug.assert(element.end >= changeStart, \"Adjusting an element that was entirely before the change range\");\n            ts.Debug.assert(element.pos <= changeRangeOldEnd, \"Adjusting an element that was entirely after the change range\");\n            ts.Debug.assert(element.pos <= element.end);\n            element.pos = Math.min(element.pos, changeRangeNewEnd);\n            if (element.end >= changeRangeOldEnd) {\n                element.end += delta;\n            }\n            else {\n                element.end = Math.min(element.end, changeRangeNewEnd);\n            }\n            ts.Debug.assert(element.pos <= element.end);\n            if (element.parent) {\n                ts.Debug.assert(element.pos >= element.parent.pos);\n                ts.Debug.assert(element.end <= element.parent.end);\n            }\n        }\n        function checkNodePositions(node, aggressiveChecks) {\n            if (aggressiveChecks) {\n                var pos_2 = node.pos;\n                forEachChild(node, function (child) {\n                    ts.Debug.assert(child.pos >= pos_2);\n                    pos_2 = child.end;\n                });\n                ts.Debug.assert(pos_2 <= node.end);\n            }\n        }\n        function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) {\n            visitNode(sourceFile);\n            return;\n            function visitNode(child) {\n                ts.Debug.assert(child.pos <= child.end);\n                if (child.pos > changeRangeOldEnd) {\n                    moveElementEntirelyPastChangeRange(child, false, delta, oldText, newText, aggressiveChecks);\n                    return;\n                }\n                var fullEnd = child.end;\n                if (fullEnd >= changeStart) {\n                    child.intersectsChange = true;\n                    child._children = undefined;\n                    adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);\n                    forEachChild(child, visitNode, visitArray);\n                    checkNodePositions(child, aggressiveChecks);\n                    return;\n                }\n                ts.Debug.assert(fullEnd < changeStart);\n            }\n            function visitArray(array) {\n                ts.Debug.assert(array.pos <= array.end);\n                if (array.pos > changeRangeOldEnd) {\n                    moveElementEntirelyPastChangeRange(array, true, delta, oldText, newText, aggressiveChecks);\n                    return;\n                }\n                var fullEnd = array.end;\n                if (fullEnd >= changeStart) {\n                    array.intersectsChange = true;\n                    array._children = undefined;\n                    adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);\n                    for (var _i = 0, array_10 = array; _i < array_10.length; _i++) {\n                        var node = array_10[_i];\n                        visitNode(node);\n                    }\n                    return;\n                }\n                ts.Debug.assert(fullEnd < changeStart);\n            }\n        }\n        function extendToAffectedRange(sourceFile, changeRange) {\n            var maxLookahead = 1;\n            var start = changeRange.span.start;\n            for (var i = 0; start > 0 && i <= maxLookahead; i++) {\n                var nearestNode = findNearestNodeStartingBeforeOrAtPosition(sourceFile, start);\n                ts.Debug.assert(nearestNode.pos <= start);\n                var position = nearestNode.pos;\n                start = Math.max(0, position - 1);\n            }\n            var finalSpan = ts.createTextSpanFromBounds(start, ts.textSpanEnd(changeRange.span));\n            var finalLength = changeRange.newLength + (changeRange.span.start - start);\n            return ts.createTextChangeRange(finalSpan, finalLength);\n        }\n        function findNearestNodeStartingBeforeOrAtPosition(sourceFile, position) {\n            var bestResult = sourceFile;\n            var lastNodeEntirelyBeforePosition;\n            forEachChild(sourceFile, visit);\n            if (lastNodeEntirelyBeforePosition) {\n                var lastChildOfLastEntireNodeBeforePosition = getLastChild(lastNodeEntirelyBeforePosition);\n                if (lastChildOfLastEntireNodeBeforePosition.pos > bestResult.pos) {\n                    bestResult = lastChildOfLastEntireNodeBeforePosition;\n                }\n            }\n            return bestResult;\n            function getLastChild(node) {\n                while (true) {\n                    var lastChild = getLastChildWorker(node);\n                    if (lastChild) {\n                        node = lastChild;\n                    }\n                    else {\n                        return node;\n                    }\n                }\n            }\n            function getLastChildWorker(node) {\n                var last = undefined;\n                forEachChild(node, function (child) {\n                    if (ts.nodeIsPresent(child)) {\n                        last = child;\n                    }\n                });\n                return last;\n            }\n            function visit(child) {\n                if (ts.nodeIsMissing(child)) {\n                    return;\n                }\n                if (child.pos <= position) {\n                    if (child.pos >= bestResult.pos) {\n                        bestResult = child;\n                    }\n                    if (position < child.end) {\n                        forEachChild(child, visit);\n                        return true;\n                    }\n                    else {\n                        ts.Debug.assert(child.end <= position);\n                        lastNodeEntirelyBeforePosition = child;\n                    }\n                }\n                else {\n                    ts.Debug.assert(child.pos > position);\n                    return true;\n                }\n            }\n        }\n        function checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks) {\n            var oldText = sourceFile.text;\n            if (textChangeRange) {\n                ts.Debug.assert((oldText.length - textChangeRange.span.length + textChangeRange.newLength) === newText.length);\n                if (aggressiveChecks || ts.Debug.shouldAssert(3)) {\n                    var oldTextPrefix = oldText.substr(0, textChangeRange.span.start);\n                    var newTextPrefix = newText.substr(0, textChangeRange.span.start);\n                    ts.Debug.assert(oldTextPrefix === newTextPrefix);\n                    var oldTextSuffix = oldText.substring(ts.textSpanEnd(textChangeRange.span), oldText.length);\n                    var newTextSuffix = newText.substring(ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange)), newText.length);\n                    ts.Debug.assert(oldTextSuffix === newTextSuffix);\n                }\n            }\n        }\n        function createSyntaxCursor(sourceFile) {\n            var currentArray = sourceFile.statements;\n            var currentArrayIndex = 0;\n            ts.Debug.assert(currentArrayIndex < currentArray.length);\n            var current = currentArray[currentArrayIndex];\n            var lastQueriedPosition = -1;\n            return {\n                currentNode: function (position) {\n                    if (position !== lastQueriedPosition) {\n                        if (current && current.end === position && currentArrayIndex < (currentArray.length - 1)) {\n                            currentArrayIndex++;\n                            current = currentArray[currentArrayIndex];\n                        }\n                        if (!current || current.pos !== position) {\n                            findHighestListElementThatStartsAtPosition(position);\n                        }\n                    }\n                    lastQueriedPosition = position;\n                    ts.Debug.assert(!current || current.pos === position);\n                    return current;\n                }\n            };\n            function findHighestListElementThatStartsAtPosition(position) {\n                currentArray = undefined;\n                currentArrayIndex = -1;\n                current = undefined;\n                forEachChild(sourceFile, visitNode, visitArray);\n                return;\n                function visitNode(node) {\n                    if (position >= node.pos && position < node.end) {\n                        forEachChild(node, visitNode, visitArray);\n                        return true;\n                    }\n                    return false;\n                }\n                function visitArray(array) {\n                    if (position >= array.pos && position < array.end) {\n                        for (var i = 0, n = array.length; i < n; i++) {\n                            var child = array[i];\n                            if (child) {\n                                if (child.pos === position) {\n                                    currentArray = array;\n                                    currentArrayIndex = i;\n                                    current = child;\n                                    return true;\n                                }\n                                else {\n                                    if (child.pos < position && position < child.end) {\n                                        forEachChild(child, visitNode, visitArray);\n                                        return true;\n                                    }\n                                }\n                            }\n                        }\n                    }\n                    return false;\n                }\n            }\n        }\n    })(IncrementalParser || (IncrementalParser = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function getModuleInstanceState(node) {\n        if (node.kind === 227 || node.kind === 228) {\n            return 0;\n        }\n        else if (ts.isConstEnumDeclaration(node)) {\n            return 2;\n        }\n        else if ((node.kind === 235 || node.kind === 234) && !(ts.hasModifier(node, 1))) {\n            return 0;\n        }\n        else if (node.kind === 231) {\n            var state_1 = 0;\n            ts.forEachChild(node, function (n) {\n                switch (getModuleInstanceState(n)) {\n                    case 0:\n                        return false;\n                    case 2:\n                        state_1 = 2;\n                        return false;\n                    case 1:\n                        state_1 = 1;\n                        return true;\n                }\n            });\n            return state_1;\n        }\n        else if (node.kind === 230) {\n            var body = node.body;\n            return body ? getModuleInstanceState(body) : 1;\n        }\n        else if (node.kind === 70 && node.isInJSDocNamespace) {\n            return 0;\n        }\n        else {\n            return 1;\n        }\n    }\n    ts.getModuleInstanceState = getModuleInstanceState;\n    var binder = createBinder();\n    function bindSourceFile(file, options) {\n        ts.performance.mark(\"beforeBind\");\n        binder(file, options);\n        ts.performance.mark(\"afterBind\");\n        ts.performance.measure(\"Bind\", \"beforeBind\", \"afterBind\");\n    }\n    ts.bindSourceFile = bindSourceFile;\n    function createBinder() {\n        var file;\n        var options;\n        var languageVersion;\n        var parent;\n        var container;\n        var blockScopeContainer;\n        var lastContainer;\n        var seenThisKeyword;\n        var currentFlow;\n        var currentBreakTarget;\n        var currentContinueTarget;\n        var currentReturnTarget;\n        var currentTrueTarget;\n        var currentFalseTarget;\n        var preSwitchCaseFlow;\n        var activeLabels;\n        var hasExplicitReturn;\n        var emitFlags;\n        var inStrictMode;\n        var symbolCount = 0;\n        var Symbol;\n        var classifiableNames;\n        var unreachableFlow = { flags: 1 };\n        var reportedUnreachableFlow = { flags: 1 };\n        var subtreeTransformFlags = 0;\n        var skipTransformFlagAggregation;\n        function bindSourceFile(f, opts) {\n            file = f;\n            options = opts;\n            languageVersion = ts.getEmitScriptTarget(options);\n            inStrictMode = bindInStrictMode(file, opts);\n            classifiableNames = ts.createMap();\n            symbolCount = 0;\n            skipTransformFlagAggregation = ts.isDeclarationFile(file);\n            Symbol = ts.objectAllocator.getSymbolConstructor();\n            if (!file.locals) {\n                bind(file);\n                file.symbolCount = symbolCount;\n                file.classifiableNames = classifiableNames;\n            }\n            file = undefined;\n            options = undefined;\n            languageVersion = undefined;\n            parent = undefined;\n            container = undefined;\n            blockScopeContainer = undefined;\n            lastContainer = undefined;\n            seenThisKeyword = false;\n            currentFlow = undefined;\n            currentBreakTarget = undefined;\n            currentContinueTarget = undefined;\n            currentReturnTarget = undefined;\n            currentTrueTarget = undefined;\n            currentFalseTarget = undefined;\n            activeLabels = undefined;\n            hasExplicitReturn = false;\n            emitFlags = 0;\n            subtreeTransformFlags = 0;\n        }\n        return bindSourceFile;\n        function bindInStrictMode(file, opts) {\n            if (opts.alwaysStrict && !ts.isDeclarationFile(file)) {\n                return true;\n            }\n            else {\n                return !!file.externalModuleIndicator;\n            }\n        }\n        function createSymbol(flags, name) {\n            symbolCount++;\n            return new Symbol(flags, name);\n        }\n        function addDeclarationToSymbol(symbol, node, symbolFlags) {\n            symbol.flags |= symbolFlags;\n            node.symbol = symbol;\n            if (!symbol.declarations) {\n                symbol.declarations = [];\n            }\n            symbol.declarations.push(node);\n            if (symbolFlags & 1952 && !symbol.exports) {\n                symbol.exports = ts.createMap();\n            }\n            if (symbolFlags & 6240 && !symbol.members) {\n                symbol.members = ts.createMap();\n            }\n            if (symbolFlags & 107455) {\n                var valueDeclaration = symbol.valueDeclaration;\n                if (!valueDeclaration ||\n                    (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 230)) {\n                    symbol.valueDeclaration = node;\n                }\n            }\n        }\n        function getDeclarationName(node) {\n            if (node.name) {\n                if (ts.isAmbientModule(node)) {\n                    return ts.isGlobalScopeAugmentation(node) ? \"__global\" : \"\\\"\" + node.name.text + \"\\\"\";\n                }\n                if (node.name.kind === 142) {\n                    var nameExpression = node.name.expression;\n                    if (ts.isStringOrNumericLiteral(nameExpression)) {\n                        return nameExpression.text;\n                    }\n                    ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression));\n                    return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text);\n                }\n                return node.name.text;\n            }\n            switch (node.kind) {\n                case 150:\n                    return \"__constructor\";\n                case 158:\n                case 153:\n                    return \"__call\";\n                case 159:\n                case 154:\n                    return \"__new\";\n                case 155:\n                    return \"__index\";\n                case 241:\n                    return \"__export\";\n                case 240:\n                    return node.isExportEquals ? \"export=\" : \"default\";\n                case 192:\n                    switch (ts.getSpecialPropertyAssignmentKind(node)) {\n                        case 2:\n                            return \"export=\";\n                        case 1:\n                        case 4:\n                            return node.left.name.text;\n                        case 3:\n                            return node.left.expression.name.text;\n                    }\n                    ts.Debug.fail(\"Unknown binary declaration kind\");\n                    break;\n                case 225:\n                case 226:\n                    return ts.hasModifier(node, 512) ? \"default\" : undefined;\n                case 274:\n                    return ts.isJSDocConstructSignature(node) ? \"__new\" : \"__call\";\n                case 144:\n                    ts.Debug.assert(node.parent.kind === 274);\n                    var functionType = node.parent;\n                    var index = ts.indexOf(functionType.parameters, node);\n                    return \"arg\" + index;\n                case 285:\n                    var parentNode = node.parent && node.parent.parent;\n                    var nameFromParentNode = void 0;\n                    if (parentNode && parentNode.kind === 205) {\n                        if (parentNode.declarationList.declarations.length > 0) {\n                            var nameIdentifier = parentNode.declarationList.declarations[0].name;\n                            if (nameIdentifier.kind === 70) {\n                                nameFromParentNode = nameIdentifier.text;\n                            }\n                        }\n                    }\n                    return nameFromParentNode;\n            }\n        }\n        function getDisplayName(node) {\n            return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node);\n        }\n        function declareSymbol(symbolTable, parent, node, includes, excludes) {\n            ts.Debug.assert(!ts.hasDynamicName(node));\n            var isDefaultExport = ts.hasModifier(node, 512);\n            var name = isDefaultExport && parent ? \"default\" : getDeclarationName(node);\n            var symbol;\n            if (name === undefined) {\n                symbol = createSymbol(0, \"__missing\");\n            }\n            else {\n                symbol = symbolTable[name] || (symbolTable[name] = createSymbol(0, name));\n                if (name && (includes & 788448)) {\n                    classifiableNames[name] = name;\n                }\n                if (symbol.flags & excludes) {\n                    if (symbol.isReplaceableByMethod) {\n                        symbol = symbolTable[name] = createSymbol(0, name);\n                    }\n                    else {\n                        if (node.name) {\n                            node.name.parent = node;\n                        }\n                        var message_1 = symbol.flags & 2\n                            ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0\n                            : ts.Diagnostics.Duplicate_identifier_0;\n                        if (symbol.declarations && symbol.declarations.length) {\n                            if (isDefaultExport) {\n                                message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;\n                            }\n                            else {\n                                if (symbol.declarations && symbol.declarations.length &&\n                                    (isDefaultExport || (node.kind === 240 && !node.isExportEquals))) {\n                                    message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;\n                                }\n                            }\n                        }\n                        ts.forEach(symbol.declarations, function (declaration) {\n                            file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message_1, getDisplayName(declaration)));\n                        });\n                        file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message_1, getDisplayName(node)));\n                        symbol = createSymbol(0, name);\n                    }\n                }\n            }\n            addDeclarationToSymbol(symbol, node, includes);\n            symbol.parent = parent;\n            return symbol;\n        }\n        function declareModuleMember(node, symbolFlags, symbolExcludes) {\n            var hasExportModifier = ts.getCombinedModifierFlags(node) & 1;\n            if (symbolFlags & 8388608) {\n                if (node.kind === 243 || (node.kind === 234 && hasExportModifier)) {\n                    return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);\n                }\n                else {\n                    return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);\n                }\n            }\n            else {\n                var isJSDocTypedefInJSDocNamespace = node.kind === 285 &&\n                    node.name &&\n                    node.name.kind === 70 &&\n                    node.name.isInJSDocNamespace;\n                if ((!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 32)) || isJSDocTypedefInJSDocNamespace) {\n                    var exportKind = (symbolFlags & 107455 ? 1048576 : 0) |\n                        (symbolFlags & 793064 ? 2097152 : 0) |\n                        (symbolFlags & 1920 ? 4194304 : 0);\n                    var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes);\n                    local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);\n                    node.localSymbol = local;\n                    return local;\n                }\n                else {\n                    return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);\n                }\n            }\n        }\n        function bindContainer(node, containerFlags) {\n            var saveContainer = container;\n            var savedBlockScopeContainer = blockScopeContainer;\n            if (containerFlags & 1) {\n                container = blockScopeContainer = node;\n                if (containerFlags & 32) {\n                    container.locals = ts.createMap();\n                }\n                addToContainerChain(container);\n            }\n            else if (containerFlags & 2) {\n                blockScopeContainer = node;\n                blockScopeContainer.locals = undefined;\n            }\n            if (containerFlags & 4) {\n                var saveCurrentFlow = currentFlow;\n                var saveBreakTarget = currentBreakTarget;\n                var saveContinueTarget = currentContinueTarget;\n                var saveReturnTarget = currentReturnTarget;\n                var saveActiveLabels = activeLabels;\n                var saveHasExplicitReturn = hasExplicitReturn;\n                var isIIFE = containerFlags & 16 && !ts.hasModifier(node, 256) && !!ts.getImmediatelyInvokedFunctionExpression(node);\n                if (isIIFE) {\n                    currentReturnTarget = createBranchLabel();\n                }\n                else {\n                    currentFlow = { flags: 2 };\n                    if (containerFlags & (16 | 128)) {\n                        currentFlow.container = node;\n                    }\n                    currentReturnTarget = undefined;\n                }\n                currentBreakTarget = undefined;\n                currentContinueTarget = undefined;\n                activeLabels = undefined;\n                hasExplicitReturn = false;\n                bindChildren(node);\n                node.flags &= ~1408;\n                if (!(currentFlow.flags & 1) && containerFlags & 8 && ts.nodeIsPresent(node.body)) {\n                    node.flags |= 128;\n                    if (hasExplicitReturn)\n                        node.flags |= 256;\n                }\n                if (node.kind === 261) {\n                    node.flags |= emitFlags;\n                }\n                if (isIIFE) {\n                    addAntecedent(currentReturnTarget, currentFlow);\n                    currentFlow = finishFlowLabel(currentReturnTarget);\n                }\n                else {\n                    currentFlow = saveCurrentFlow;\n                }\n                currentBreakTarget = saveBreakTarget;\n                currentContinueTarget = saveContinueTarget;\n                currentReturnTarget = saveReturnTarget;\n                activeLabels = saveActiveLabels;\n                hasExplicitReturn = saveHasExplicitReturn;\n            }\n            else if (containerFlags & 64) {\n                seenThisKeyword = false;\n                bindChildren(node);\n                node.flags = seenThisKeyword ? node.flags | 64 : node.flags & ~64;\n            }\n            else {\n                bindChildren(node);\n            }\n            container = saveContainer;\n            blockScopeContainer = savedBlockScopeContainer;\n        }\n        function bindChildren(node) {\n            if (skipTransformFlagAggregation) {\n                bindChildrenWorker(node);\n            }\n            else if (node.transformFlags & 536870912) {\n                skipTransformFlagAggregation = true;\n                bindChildrenWorker(node);\n                skipTransformFlagAggregation = false;\n                subtreeTransformFlags |= node.transformFlags & ~getTransformFlagsSubtreeExclusions(node.kind);\n            }\n            else {\n                var savedSubtreeTransformFlags = subtreeTransformFlags;\n                subtreeTransformFlags = 0;\n                bindChildrenWorker(node);\n                subtreeTransformFlags = savedSubtreeTransformFlags | computeTransformFlagsForNode(node, subtreeTransformFlags);\n            }\n        }\n        function bindEach(nodes) {\n            if (nodes === undefined) {\n                return;\n            }\n            if (skipTransformFlagAggregation) {\n                ts.forEach(nodes, bind);\n            }\n            else {\n                var savedSubtreeTransformFlags = subtreeTransformFlags;\n                subtreeTransformFlags = 0;\n                var nodeArrayFlags = 0;\n                for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {\n                    var node = nodes_2[_i];\n                    bind(node);\n                    nodeArrayFlags |= node.transformFlags & ~536870912;\n                }\n                nodes.transformFlags = nodeArrayFlags | 536870912;\n                subtreeTransformFlags |= savedSubtreeTransformFlags;\n            }\n        }\n        function bindEachChild(node) {\n            ts.forEachChild(node, bind, bindEach);\n        }\n        function bindChildrenWorker(node) {\n            if (ts.isInJavaScriptFile(node) && node.jsDoc) {\n                ts.forEach(node.jsDoc, bind);\n            }\n            if (checkUnreachable(node)) {\n                bindEachChild(node);\n                return;\n            }\n            switch (node.kind) {\n                case 210:\n                    bindWhileStatement(node);\n                    break;\n                case 209:\n                    bindDoStatement(node);\n                    break;\n                case 211:\n                    bindForStatement(node);\n                    break;\n                case 212:\n                case 213:\n                    bindForInOrForOfStatement(node);\n                    break;\n                case 208:\n                    bindIfStatement(node);\n                    break;\n                case 216:\n                case 220:\n                    bindReturnOrThrow(node);\n                    break;\n                case 215:\n                case 214:\n                    bindBreakOrContinueStatement(node);\n                    break;\n                case 221:\n                    bindTryStatement(node);\n                    break;\n                case 218:\n                    bindSwitchStatement(node);\n                    break;\n                case 232:\n                    bindCaseBlock(node);\n                    break;\n                case 253:\n                    bindCaseClause(node);\n                    break;\n                case 219:\n                    bindLabeledStatement(node);\n                    break;\n                case 190:\n                    bindPrefixUnaryExpressionFlow(node);\n                    break;\n                case 191:\n                    bindPostfixUnaryExpressionFlow(node);\n                    break;\n                case 192:\n                    bindBinaryExpressionFlow(node);\n                    break;\n                case 186:\n                    bindDeleteExpressionFlow(node);\n                    break;\n                case 193:\n                    bindConditionalExpressionFlow(node);\n                    break;\n                case 223:\n                    bindVariableDeclarationFlow(node);\n                    break;\n                case 179:\n                    bindCallExpressionFlow(node);\n                    break;\n                default:\n                    bindEachChild(node);\n                    break;\n            }\n        }\n        function isNarrowingExpression(expr) {\n            switch (expr.kind) {\n                case 70:\n                case 98:\n                case 177:\n                    return isNarrowableReference(expr);\n                case 179:\n                    return hasNarrowableArgument(expr);\n                case 183:\n                    return isNarrowingExpression(expr.expression);\n                case 192:\n                    return isNarrowingBinaryExpression(expr);\n                case 190:\n                    return expr.operator === 50 && isNarrowingExpression(expr.operand);\n            }\n            return false;\n        }\n        function isNarrowableReference(expr) {\n            return expr.kind === 70 ||\n                expr.kind === 98 ||\n                expr.kind === 177 && isNarrowableReference(expr.expression);\n        }\n        function hasNarrowableArgument(expr) {\n            if (expr.arguments) {\n                for (var _i = 0, _a = expr.arguments; _i < _a.length; _i++) {\n                    var argument = _a[_i];\n                    if (isNarrowableReference(argument)) {\n                        return true;\n                    }\n                }\n            }\n            if (expr.expression.kind === 177 &&\n                isNarrowableReference(expr.expression.expression)) {\n                return true;\n            }\n            return false;\n        }\n        function isNarrowingTypeofOperands(expr1, expr2) {\n            return expr1.kind === 187 && isNarrowableOperand(expr1.expression) && expr2.kind === 9;\n        }\n        function isNarrowingBinaryExpression(expr) {\n            switch (expr.operatorToken.kind) {\n                case 57:\n                    return isNarrowableReference(expr.left);\n                case 31:\n                case 32:\n                case 33:\n                case 34:\n                    return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) ||\n                        isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);\n                case 92:\n                    return isNarrowableOperand(expr.left);\n                case 25:\n                    return isNarrowingExpression(expr.right);\n            }\n            return false;\n        }\n        function isNarrowableOperand(expr) {\n            switch (expr.kind) {\n                case 183:\n                    return isNarrowableOperand(expr.expression);\n                case 192:\n                    switch (expr.operatorToken.kind) {\n                        case 57:\n                            return isNarrowableOperand(expr.left);\n                        case 25:\n                            return isNarrowableOperand(expr.right);\n                    }\n            }\n            return isNarrowableReference(expr);\n        }\n        function createBranchLabel() {\n            return {\n                flags: 4,\n                antecedents: undefined\n            };\n        }\n        function createLoopLabel() {\n            return {\n                flags: 8,\n                antecedents: undefined\n            };\n        }\n        function setFlowNodeReferenced(flow) {\n            flow.flags |= flow.flags & 512 ? 1024 : 512;\n        }\n        function addAntecedent(label, antecedent) {\n            if (!(antecedent.flags & 1) && !ts.contains(label.antecedents, antecedent)) {\n                (label.antecedents || (label.antecedents = [])).push(antecedent);\n                setFlowNodeReferenced(antecedent);\n            }\n        }\n        function createFlowCondition(flags, antecedent, expression) {\n            if (antecedent.flags & 1) {\n                return antecedent;\n            }\n            if (!expression) {\n                return flags & 32 ? antecedent : unreachableFlow;\n            }\n            if (expression.kind === 100 && flags & 64 ||\n                expression.kind === 85 && flags & 32) {\n                return unreachableFlow;\n            }\n            if (!isNarrowingExpression(expression)) {\n                return antecedent;\n            }\n            setFlowNodeReferenced(antecedent);\n            return {\n                flags: flags,\n                expression: expression,\n                antecedent: antecedent\n            };\n        }\n        function createFlowSwitchClause(antecedent, switchStatement, clauseStart, clauseEnd) {\n            if (!isNarrowingExpression(switchStatement.expression)) {\n                return antecedent;\n            }\n            setFlowNodeReferenced(antecedent);\n            return {\n                flags: 128,\n                switchStatement: switchStatement,\n                clauseStart: clauseStart,\n                clauseEnd: clauseEnd,\n                antecedent: antecedent\n            };\n        }\n        function createFlowAssignment(antecedent, node) {\n            setFlowNodeReferenced(antecedent);\n            return {\n                flags: 16,\n                antecedent: antecedent,\n                node: node\n            };\n        }\n        function createFlowArrayMutation(antecedent, node) {\n            setFlowNodeReferenced(antecedent);\n            return {\n                flags: 256,\n                antecedent: antecedent,\n                node: node\n            };\n        }\n        function finishFlowLabel(flow) {\n            var antecedents = flow.antecedents;\n            if (!antecedents) {\n                return unreachableFlow;\n            }\n            if (antecedents.length === 1) {\n                return antecedents[0];\n            }\n            return flow;\n        }\n        function isStatementCondition(node) {\n            var parent = node.parent;\n            switch (parent.kind) {\n                case 208:\n                case 210:\n                case 209:\n                    return parent.expression === node;\n                case 211:\n                case 193:\n                    return parent.condition === node;\n            }\n            return false;\n        }\n        function isLogicalExpression(node) {\n            while (true) {\n                if (node.kind === 183) {\n                    node = node.expression;\n                }\n                else if (node.kind === 190 && node.operator === 50) {\n                    node = node.operand;\n                }\n                else {\n                    return node.kind === 192 && (node.operatorToken.kind === 52 ||\n                        node.operatorToken.kind === 53);\n                }\n            }\n        }\n        function isTopLevelLogicalExpression(node) {\n            while (node.parent.kind === 183 ||\n                node.parent.kind === 190 &&\n                    node.parent.operator === 50) {\n                node = node.parent;\n            }\n            return !isStatementCondition(node) && !isLogicalExpression(node.parent);\n        }\n        function bindCondition(node, trueTarget, falseTarget) {\n            var saveTrueTarget = currentTrueTarget;\n            var saveFalseTarget = currentFalseTarget;\n            currentTrueTarget = trueTarget;\n            currentFalseTarget = falseTarget;\n            bind(node);\n            currentTrueTarget = saveTrueTarget;\n            currentFalseTarget = saveFalseTarget;\n            if (!node || !isLogicalExpression(node)) {\n                addAntecedent(trueTarget, createFlowCondition(32, currentFlow, node));\n                addAntecedent(falseTarget, createFlowCondition(64, currentFlow, node));\n            }\n        }\n        function bindIterativeStatement(node, breakTarget, continueTarget) {\n            var saveBreakTarget = currentBreakTarget;\n            var saveContinueTarget = currentContinueTarget;\n            currentBreakTarget = breakTarget;\n            currentContinueTarget = continueTarget;\n            bind(node);\n            currentBreakTarget = saveBreakTarget;\n            currentContinueTarget = saveContinueTarget;\n        }\n        function bindWhileStatement(node) {\n            var preWhileLabel = createLoopLabel();\n            var preBodyLabel = createBranchLabel();\n            var postWhileLabel = createBranchLabel();\n            addAntecedent(preWhileLabel, currentFlow);\n            currentFlow = preWhileLabel;\n            bindCondition(node.expression, preBodyLabel, postWhileLabel);\n            currentFlow = finishFlowLabel(preBodyLabel);\n            bindIterativeStatement(node.statement, postWhileLabel, preWhileLabel);\n            addAntecedent(preWhileLabel, currentFlow);\n            currentFlow = finishFlowLabel(postWhileLabel);\n        }\n        function bindDoStatement(node) {\n            var preDoLabel = createLoopLabel();\n            var enclosingLabeledStatement = node.parent.kind === 219\n                ? ts.lastOrUndefined(activeLabels)\n                : undefined;\n            var preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel();\n            var postDoLabel = enclosingLabeledStatement ? enclosingLabeledStatement.breakTarget : createBranchLabel();\n            addAntecedent(preDoLabel, currentFlow);\n            currentFlow = preDoLabel;\n            bindIterativeStatement(node.statement, postDoLabel, preConditionLabel);\n            addAntecedent(preConditionLabel, currentFlow);\n            currentFlow = finishFlowLabel(preConditionLabel);\n            bindCondition(node.expression, preDoLabel, postDoLabel);\n            currentFlow = finishFlowLabel(postDoLabel);\n        }\n        function bindForStatement(node) {\n            var preLoopLabel = createLoopLabel();\n            var preBodyLabel = createBranchLabel();\n            var postLoopLabel = createBranchLabel();\n            bind(node.initializer);\n            addAntecedent(preLoopLabel, currentFlow);\n            currentFlow = preLoopLabel;\n            bindCondition(node.condition, preBodyLabel, postLoopLabel);\n            currentFlow = finishFlowLabel(preBodyLabel);\n            bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);\n            bind(node.incrementor);\n            addAntecedent(preLoopLabel, currentFlow);\n            currentFlow = finishFlowLabel(postLoopLabel);\n        }\n        function bindForInOrForOfStatement(node) {\n            var preLoopLabel = createLoopLabel();\n            var postLoopLabel = createBranchLabel();\n            addAntecedent(preLoopLabel, currentFlow);\n            currentFlow = preLoopLabel;\n            bind(node.expression);\n            addAntecedent(postLoopLabel, currentFlow);\n            bind(node.initializer);\n            if (node.initializer.kind !== 224) {\n                bindAssignmentTargetFlow(node.initializer);\n            }\n            bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);\n            addAntecedent(preLoopLabel, currentFlow);\n            currentFlow = finishFlowLabel(postLoopLabel);\n        }\n        function bindIfStatement(node) {\n            var thenLabel = createBranchLabel();\n            var elseLabel = createBranchLabel();\n            var postIfLabel = createBranchLabel();\n            bindCondition(node.expression, thenLabel, elseLabel);\n            currentFlow = finishFlowLabel(thenLabel);\n            bind(node.thenStatement);\n            addAntecedent(postIfLabel, currentFlow);\n            currentFlow = finishFlowLabel(elseLabel);\n            bind(node.elseStatement);\n            addAntecedent(postIfLabel, currentFlow);\n            currentFlow = finishFlowLabel(postIfLabel);\n        }\n        function bindReturnOrThrow(node) {\n            bind(node.expression);\n            if (node.kind === 216) {\n                hasExplicitReturn = true;\n                if (currentReturnTarget) {\n                    addAntecedent(currentReturnTarget, currentFlow);\n                }\n            }\n            currentFlow = unreachableFlow;\n        }\n        function findActiveLabel(name) {\n            if (activeLabels) {\n                for (var _i = 0, activeLabels_1 = activeLabels; _i < activeLabels_1.length; _i++) {\n                    var label = activeLabels_1[_i];\n                    if (label.name === name) {\n                        return label;\n                    }\n                }\n            }\n            return undefined;\n        }\n        function bindBreakOrContinueFlow(node, breakTarget, continueTarget) {\n            var flowLabel = node.kind === 215 ? breakTarget : continueTarget;\n            if (flowLabel) {\n                addAntecedent(flowLabel, currentFlow);\n                currentFlow = unreachableFlow;\n            }\n        }\n        function bindBreakOrContinueStatement(node) {\n            bind(node.label);\n            if (node.label) {\n                var activeLabel = findActiveLabel(node.label.text);\n                if (activeLabel) {\n                    activeLabel.referenced = true;\n                    bindBreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget);\n                }\n            }\n            else {\n                bindBreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget);\n            }\n        }\n        function bindTryStatement(node) {\n            var preFinallyLabel = createBranchLabel();\n            var preTryFlow = currentFlow;\n            bind(node.tryBlock);\n            addAntecedent(preFinallyLabel, currentFlow);\n            var flowAfterTry = currentFlow;\n            var flowAfterCatch = unreachableFlow;\n            if (node.catchClause) {\n                currentFlow = preTryFlow;\n                bind(node.catchClause);\n                addAntecedent(preFinallyLabel, currentFlow);\n                flowAfterCatch = currentFlow;\n            }\n            if (node.finallyBlock) {\n                addAntecedent(preFinallyLabel, preTryFlow);\n                currentFlow = finishFlowLabel(preFinallyLabel);\n                bind(node.finallyBlock);\n                if (!(currentFlow.flags & 1)) {\n                    if ((flowAfterTry.flags & 1) && (flowAfterCatch.flags & 1)) {\n                        currentFlow = flowAfterTry === reportedUnreachableFlow || flowAfterCatch === reportedUnreachableFlow\n                            ? reportedUnreachableFlow\n                            : unreachableFlow;\n                    }\n                }\n            }\n            else {\n                currentFlow = finishFlowLabel(preFinallyLabel);\n            }\n        }\n        function bindSwitchStatement(node) {\n            var postSwitchLabel = createBranchLabel();\n            bind(node.expression);\n            var saveBreakTarget = currentBreakTarget;\n            var savePreSwitchCaseFlow = preSwitchCaseFlow;\n            currentBreakTarget = postSwitchLabel;\n            preSwitchCaseFlow = currentFlow;\n            bind(node.caseBlock);\n            addAntecedent(postSwitchLabel, currentFlow);\n            var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 254; });\n            node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents;\n            if (!hasDefault) {\n                addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0));\n            }\n            currentBreakTarget = saveBreakTarget;\n            preSwitchCaseFlow = savePreSwitchCaseFlow;\n            currentFlow = finishFlowLabel(postSwitchLabel);\n        }\n        function bindCaseBlock(node) {\n            var savedSubtreeTransformFlags = subtreeTransformFlags;\n            subtreeTransformFlags = 0;\n            var clauses = node.clauses;\n            var fallthroughFlow = unreachableFlow;\n            for (var i = 0; i < clauses.length; i++) {\n                var clauseStart = i;\n                while (!clauses[i].statements.length && i + 1 < clauses.length) {\n                    bind(clauses[i]);\n                    i++;\n                }\n                var preCaseLabel = createBranchLabel();\n                addAntecedent(preCaseLabel, createFlowSwitchClause(preSwitchCaseFlow, node.parent, clauseStart, i + 1));\n                addAntecedent(preCaseLabel, fallthroughFlow);\n                currentFlow = finishFlowLabel(preCaseLabel);\n                var clause = clauses[i];\n                bind(clause);\n                fallthroughFlow = currentFlow;\n                if (!(currentFlow.flags & 1) && i !== clauses.length - 1 && options.noFallthroughCasesInSwitch) {\n                    errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch);\n                }\n            }\n            clauses.transformFlags = subtreeTransformFlags | 536870912;\n            subtreeTransformFlags |= savedSubtreeTransformFlags;\n        }\n        function bindCaseClause(node) {\n            var saveCurrentFlow = currentFlow;\n            currentFlow = preSwitchCaseFlow;\n            bind(node.expression);\n            currentFlow = saveCurrentFlow;\n            bindEach(node.statements);\n        }\n        function pushActiveLabel(name, breakTarget, continueTarget) {\n            var activeLabel = {\n                name: name,\n                breakTarget: breakTarget,\n                continueTarget: continueTarget,\n                referenced: false\n            };\n            (activeLabels || (activeLabels = [])).push(activeLabel);\n            return activeLabel;\n        }\n        function popActiveLabel() {\n            activeLabels.pop();\n        }\n        function bindLabeledStatement(node) {\n            var preStatementLabel = createLoopLabel();\n            var postStatementLabel = createBranchLabel();\n            bind(node.label);\n            addAntecedent(preStatementLabel, currentFlow);\n            var activeLabel = pushActiveLabel(node.label.text, postStatementLabel, preStatementLabel);\n            bind(node.statement);\n            popActiveLabel();\n            if (!activeLabel.referenced && !options.allowUnusedLabels) {\n                file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label));\n            }\n            if (!node.statement || node.statement.kind !== 209) {\n                addAntecedent(postStatementLabel, currentFlow);\n                currentFlow = finishFlowLabel(postStatementLabel);\n            }\n        }\n        function bindDestructuringTargetFlow(node) {\n            if (node.kind === 192 && node.operatorToken.kind === 57) {\n                bindAssignmentTargetFlow(node.left);\n            }\n            else {\n                bindAssignmentTargetFlow(node);\n            }\n        }\n        function bindAssignmentTargetFlow(node) {\n            if (isNarrowableReference(node)) {\n                currentFlow = createFlowAssignment(currentFlow, node);\n            }\n            else if (node.kind === 175) {\n                for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {\n                    var e = _a[_i];\n                    if (e.kind === 196) {\n                        bindAssignmentTargetFlow(e.expression);\n                    }\n                    else {\n                        bindDestructuringTargetFlow(e);\n                    }\n                }\n            }\n            else if (node.kind === 176) {\n                for (var _b = 0, _c = node.properties; _b < _c.length; _b++) {\n                    var p = _c[_b];\n                    if (p.kind === 257) {\n                        bindDestructuringTargetFlow(p.initializer);\n                    }\n                    else if (p.kind === 258) {\n                        bindAssignmentTargetFlow(p.name);\n                    }\n                    else if (p.kind === 259) {\n                        bindAssignmentTargetFlow(p.expression);\n                    }\n                }\n            }\n        }\n        function bindLogicalExpression(node, trueTarget, falseTarget) {\n            var preRightLabel = createBranchLabel();\n            if (node.operatorToken.kind === 52) {\n                bindCondition(node.left, preRightLabel, falseTarget);\n            }\n            else {\n                bindCondition(node.left, trueTarget, preRightLabel);\n            }\n            currentFlow = finishFlowLabel(preRightLabel);\n            bind(node.operatorToken);\n            bindCondition(node.right, trueTarget, falseTarget);\n        }\n        function bindPrefixUnaryExpressionFlow(node) {\n            if (node.operator === 50) {\n                var saveTrueTarget = currentTrueTarget;\n                currentTrueTarget = currentFalseTarget;\n                currentFalseTarget = saveTrueTarget;\n                bindEachChild(node);\n                currentFalseTarget = currentTrueTarget;\n                currentTrueTarget = saveTrueTarget;\n            }\n            else {\n                bindEachChild(node);\n                if (node.operator === 42 || node.operator === 43) {\n                    bindAssignmentTargetFlow(node.operand);\n                }\n            }\n        }\n        function bindPostfixUnaryExpressionFlow(node) {\n            bindEachChild(node);\n            if (node.operator === 42 || node.operator === 43) {\n                bindAssignmentTargetFlow(node.operand);\n            }\n        }\n        function bindBinaryExpressionFlow(node) {\n            var operator = node.operatorToken.kind;\n            if (operator === 52 || operator === 53) {\n                if (isTopLevelLogicalExpression(node)) {\n                    var postExpressionLabel = createBranchLabel();\n                    bindLogicalExpression(node, postExpressionLabel, postExpressionLabel);\n                    currentFlow = finishFlowLabel(postExpressionLabel);\n                }\n                else {\n                    bindLogicalExpression(node, currentTrueTarget, currentFalseTarget);\n                }\n            }\n            else {\n                bindEachChild(node);\n                if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) {\n                    bindAssignmentTargetFlow(node.left);\n                    if (operator === 57 && node.left.kind === 178) {\n                        var elementAccess = node.left;\n                        if (isNarrowableOperand(elementAccess.expression)) {\n                            currentFlow = createFlowArrayMutation(currentFlow, node);\n                        }\n                    }\n                }\n            }\n        }\n        function bindDeleteExpressionFlow(node) {\n            bindEachChild(node);\n            if (node.expression.kind === 177) {\n                bindAssignmentTargetFlow(node.expression);\n            }\n        }\n        function bindConditionalExpressionFlow(node) {\n            var trueLabel = createBranchLabel();\n            var falseLabel = createBranchLabel();\n            var postExpressionLabel = createBranchLabel();\n            bindCondition(node.condition, trueLabel, falseLabel);\n            currentFlow = finishFlowLabel(trueLabel);\n            bind(node.questionToken);\n            bind(node.whenTrue);\n            addAntecedent(postExpressionLabel, currentFlow);\n            currentFlow = finishFlowLabel(falseLabel);\n            bind(node.colonToken);\n            bind(node.whenFalse);\n            addAntecedent(postExpressionLabel, currentFlow);\n            currentFlow = finishFlowLabel(postExpressionLabel);\n        }\n        function bindInitializedVariableFlow(node) {\n            var name = !ts.isOmittedExpression(node) ? node.name : undefined;\n            if (ts.isBindingPattern(name)) {\n                for (var _i = 0, _a = name.elements; _i < _a.length; _i++) {\n                    var child = _a[_i];\n                    bindInitializedVariableFlow(child);\n                }\n            }\n            else {\n                currentFlow = createFlowAssignment(currentFlow, node);\n            }\n        }\n        function bindVariableDeclarationFlow(node) {\n            bindEachChild(node);\n            if (node.initializer || node.parent.parent.kind === 212 || node.parent.parent.kind === 213) {\n                bindInitializedVariableFlow(node);\n            }\n        }\n        function bindCallExpressionFlow(node) {\n            var expr = node.expression;\n            while (expr.kind === 183) {\n                expr = expr.expression;\n            }\n            if (expr.kind === 184 || expr.kind === 185) {\n                bindEach(node.typeArguments);\n                bindEach(node.arguments);\n                bind(node.expression);\n            }\n            else {\n                bindEachChild(node);\n            }\n            if (node.expression.kind === 177) {\n                var propertyAccess = node.expression;\n                if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) {\n                    currentFlow = createFlowArrayMutation(currentFlow, node);\n                }\n            }\n        }\n        function getContainerFlags(node) {\n            switch (node.kind) {\n                case 197:\n                case 226:\n                case 229:\n                case 176:\n                case 161:\n                case 287:\n                case 270:\n                    return 1;\n                case 227:\n                    return 1 | 64;\n                case 274:\n                case 230:\n                case 228:\n                case 170:\n                    return 1 | 32;\n                case 261:\n                    return 1 | 4 | 32;\n                case 149:\n                    if (ts.isObjectLiteralOrClassExpressionMethod(node)) {\n                        return 1 | 4 | 32 | 8 | 128;\n                    }\n                case 150:\n                case 225:\n                case 148:\n                case 151:\n                case 152:\n                case 153:\n                case 154:\n                case 155:\n                case 158:\n                case 159:\n                    return 1 | 4 | 32 | 8;\n                case 184:\n                case 185:\n                    return 1 | 4 | 32 | 8 | 16;\n                case 231:\n                    return 4;\n                case 147:\n                    return node.initializer ? 4 : 0;\n                case 256:\n                case 211:\n                case 212:\n                case 213:\n                case 232:\n                    return 2;\n                case 204:\n                    return ts.isFunctionLike(node.parent) ? 0 : 2;\n            }\n            return 0;\n        }\n        function addToContainerChain(next) {\n            if (lastContainer) {\n                lastContainer.nextContainer = next;\n            }\n            lastContainer = next;\n        }\n        function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) {\n            return declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes);\n        }\n        function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) {\n            switch (container.kind) {\n                case 230:\n                    return declareModuleMember(node, symbolFlags, symbolExcludes);\n                case 261:\n                    return declareSourceFileMember(node, symbolFlags, symbolExcludes);\n                case 197:\n                case 226:\n                    return declareClassMember(node, symbolFlags, symbolExcludes);\n                case 229:\n                    return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);\n                case 161:\n                case 176:\n                case 227:\n                case 270:\n                case 287:\n                    return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);\n                case 158:\n                case 159:\n                case 153:\n                case 154:\n                case 155:\n                case 149:\n                case 148:\n                case 150:\n                case 151:\n                case 152:\n                case 225:\n                case 184:\n                case 185:\n                case 274:\n                case 228:\n                case 170:\n                    return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);\n            }\n        }\n        function declareClassMember(node, symbolFlags, symbolExcludes) {\n            return ts.hasModifier(node, 32)\n                ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes)\n                : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);\n        }\n        function declareSourceFileMember(node, symbolFlags, symbolExcludes) {\n            return ts.isExternalModule(file)\n                ? declareModuleMember(node, symbolFlags, symbolExcludes)\n                : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes);\n        }\n        function hasExportDeclarations(node) {\n            var body = node.kind === 261 ? node : node.body;\n            if (body && (body.kind === 261 || body.kind === 231)) {\n                for (var _i = 0, _a = body.statements; _i < _a.length; _i++) {\n                    var stat = _a[_i];\n                    if (stat.kind === 241 || stat.kind === 240) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function setExportContextFlag(node) {\n            if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) {\n                node.flags |= 32;\n            }\n            else {\n                node.flags &= ~32;\n            }\n        }\n        function bindModuleDeclaration(node) {\n            setExportContextFlag(node);\n            if (ts.isAmbientModule(node)) {\n                if (ts.hasModifier(node, 1)) {\n                    errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible);\n                }\n                if (ts.isExternalModuleAugmentation(node)) {\n                    declareSymbolAndAddToSymbolTable(node, 1024, 0);\n                }\n                else {\n                    var pattern = void 0;\n                    if (node.name.kind === 9) {\n                        var text = node.name.text;\n                        if (ts.hasZeroOrOneAsteriskCharacter(text)) {\n                            pattern = ts.tryParsePattern(text);\n                        }\n                        else {\n                            errorOnFirstToken(node.name, ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, text);\n                        }\n                    }\n                    var symbol = declareSymbolAndAddToSymbolTable(node, 512, 106639);\n                    if (pattern) {\n                        (file.patternAmbientModules || (file.patternAmbientModules = [])).push({ pattern: pattern, symbol: symbol });\n                    }\n                }\n            }\n            else {\n                var state = getModuleInstanceState(node);\n                if (state === 0) {\n                    declareSymbolAndAddToSymbolTable(node, 1024, 0);\n                }\n                else {\n                    declareSymbolAndAddToSymbolTable(node, 512, 106639);\n                    if (node.symbol.flags & (16 | 32 | 256)) {\n                        node.symbol.constEnumOnlyModule = false;\n                    }\n                    else {\n                        var currentModuleIsConstEnumOnly = state === 2;\n                        if (node.symbol.constEnumOnlyModule === undefined) {\n                            node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly;\n                        }\n                        else {\n                            node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly;\n                        }\n                    }\n                }\n            }\n        }\n        function bindFunctionOrConstructorType(node) {\n            var symbol = createSymbol(131072, getDeclarationName(node));\n            addDeclarationToSymbol(symbol, node, 131072);\n            var typeLiteralSymbol = createSymbol(2048, \"__type\");\n            addDeclarationToSymbol(typeLiteralSymbol, node, 2048);\n            typeLiteralSymbol.members = ts.createMap();\n            typeLiteralSymbol.members[symbol.name] = symbol;\n        }\n        function bindObjectLiteralExpression(node) {\n            if (inStrictMode) {\n                var seen = ts.createMap();\n                for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {\n                    var prop = _a[_i];\n                    if (prop.kind === 259 || prop.name.kind !== 70) {\n                        continue;\n                    }\n                    var identifier = prop.name;\n                    var currentKind = prop.kind === 257 || prop.kind === 258 || prop.kind === 149\n                        ? 1\n                        : 2;\n                    var existingKind = seen[identifier.text];\n                    if (!existingKind) {\n                        seen[identifier.text] = currentKind;\n                        continue;\n                    }\n                    if (currentKind === 1 && existingKind === 1) {\n                        var span_1 = ts.getErrorSpanForNode(file, identifier);\n                        file.bindDiagnostics.push(ts.createFileDiagnostic(file, span_1.start, span_1.length, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode));\n                    }\n                }\n            }\n            return bindAnonymousDeclaration(node, 4096, \"__object\");\n        }\n        function bindAnonymousDeclaration(node, symbolFlags, name) {\n            var symbol = createSymbol(symbolFlags, name);\n            addDeclarationToSymbol(symbol, node, symbolFlags);\n        }\n        function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) {\n            switch (blockScopeContainer.kind) {\n                case 230:\n                    declareModuleMember(node, symbolFlags, symbolExcludes);\n                    break;\n                case 261:\n                    if (ts.isExternalModule(container)) {\n                        declareModuleMember(node, symbolFlags, symbolExcludes);\n                        break;\n                    }\n                default:\n                    if (!blockScopeContainer.locals) {\n                        blockScopeContainer.locals = ts.createMap();\n                        addToContainerChain(blockScopeContainer);\n                    }\n                    declareSymbol(blockScopeContainer.locals, undefined, node, symbolFlags, symbolExcludes);\n            }\n        }\n        function bindBlockScopedVariableDeclaration(node) {\n            bindBlockScopedDeclaration(node, 2, 107455);\n        }\n        function checkStrictModeIdentifier(node) {\n            if (inStrictMode &&\n                node.originalKeywordKind >= 107 &&\n                node.originalKeywordKind <= 115 &&\n                !ts.isIdentifierName(node) &&\n                !ts.isInAmbientContext(node)) {\n                if (!file.parseDiagnostics.length) {\n                    file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node)));\n                }\n            }\n        }\n        function getStrictModeIdentifierMessage(node) {\n            if (ts.getContainingClass(node)) {\n                return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode;\n            }\n            if (file.externalModuleIndicator) {\n                return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode;\n            }\n            return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode;\n        }\n        function checkStrictModeBinaryExpression(node) {\n            if (inStrictMode && ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind)) {\n                checkStrictModeEvalOrArguments(node, node.left);\n            }\n        }\n        function checkStrictModeCatchClause(node) {\n            if (inStrictMode && node.variableDeclaration) {\n                checkStrictModeEvalOrArguments(node, node.variableDeclaration.name);\n            }\n        }\n        function checkStrictModeDeleteExpression(node) {\n            if (inStrictMode && node.expression.kind === 70) {\n                var span_2 = ts.getErrorSpanForNode(file, node.expression);\n                file.bindDiagnostics.push(ts.createFileDiagnostic(file, span_2.start, span_2.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode));\n            }\n        }\n        function isEvalOrArgumentsIdentifier(node) {\n            return node.kind === 70 &&\n                (node.text === \"eval\" || node.text === \"arguments\");\n        }\n        function checkStrictModeEvalOrArguments(contextNode, name) {\n            if (name && name.kind === 70) {\n                var identifier = name;\n                if (isEvalOrArgumentsIdentifier(identifier)) {\n                    var span_3 = ts.getErrorSpanForNode(file, name);\n                    file.bindDiagnostics.push(ts.createFileDiagnostic(file, span_3.start, span_3.length, getStrictModeEvalOrArgumentsMessage(contextNode), identifier.text));\n                }\n            }\n        }\n        function getStrictModeEvalOrArgumentsMessage(node) {\n            if (ts.getContainingClass(node)) {\n                return ts.Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode;\n            }\n            if (file.externalModuleIndicator) {\n                return ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode;\n            }\n            return ts.Diagnostics.Invalid_use_of_0_in_strict_mode;\n        }\n        function checkStrictModeFunctionName(node) {\n            if (inStrictMode) {\n                checkStrictModeEvalOrArguments(node, node.name);\n            }\n        }\n        function getStrictModeBlockScopeFunctionDeclarationMessage(node) {\n            if (ts.getContainingClass(node)) {\n                return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode;\n            }\n            if (file.externalModuleIndicator) {\n                return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode;\n            }\n            return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5;\n        }\n        function checkStrictModeFunctionDeclaration(node) {\n            if (languageVersion < 2) {\n                if (blockScopeContainer.kind !== 261 &&\n                    blockScopeContainer.kind !== 230 &&\n                    !ts.isFunctionLike(blockScopeContainer)) {\n                    var errorSpan = ts.getErrorSpanForNode(file, node);\n                    file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node)));\n                }\n            }\n        }\n        function checkStrictModeNumericLiteral(node) {\n            if (inStrictMode && node.isOctalLiteral) {\n                file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode));\n            }\n        }\n        function checkStrictModePostfixUnaryExpression(node) {\n            if (inStrictMode) {\n                checkStrictModeEvalOrArguments(node, node.operand);\n            }\n        }\n        function checkStrictModePrefixUnaryExpression(node) {\n            if (inStrictMode) {\n                if (node.operator === 42 || node.operator === 43) {\n                    checkStrictModeEvalOrArguments(node, node.operand);\n                }\n            }\n        }\n        function checkStrictModeWithStatement(node) {\n            if (inStrictMode) {\n                errorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode);\n            }\n        }\n        function errorOnFirstToken(node, message, arg0, arg1, arg2) {\n            var span = ts.getSpanOfTokenAtPosition(file, node.pos);\n            file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2));\n        }\n        function getDestructuringParameterName(node) {\n            return \"__\" + ts.indexOf(node.parent.parameters, node);\n        }\n        function bind(node) {\n            if (!node) {\n                return;\n            }\n            node.parent = parent;\n            var saveInStrictMode = inStrictMode;\n            bindWorker(node);\n            if (node.kind > 140) {\n                var saveParent = parent;\n                parent = node;\n                var containerFlags = getContainerFlags(node);\n                if (containerFlags === 0) {\n                    bindChildren(node);\n                }\n                else {\n                    bindContainer(node, containerFlags);\n                }\n                parent = saveParent;\n            }\n            else if (!skipTransformFlagAggregation && (node.transformFlags & 536870912) === 0) {\n                subtreeTransformFlags |= computeTransformFlagsForNode(node, 0);\n            }\n            inStrictMode = saveInStrictMode;\n        }\n        function updateStrictModeStatementList(statements) {\n            if (!inStrictMode) {\n                for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {\n                    var statement = statements_2[_i];\n                    if (!ts.isPrologueDirective(statement)) {\n                        return;\n                    }\n                    if (isUseStrictPrologueDirective(statement)) {\n                        inStrictMode = true;\n                        return;\n                    }\n                }\n            }\n        }\n        function isUseStrictPrologueDirective(node) {\n            var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression);\n            return nodeText === '\"use strict\"' || nodeText === \"'use strict'\";\n        }\n        function bindWorker(node) {\n            switch (node.kind) {\n                case 70:\n                    if (node.isInJSDocNamespace) {\n                        var parentNode = node.parent;\n                        while (parentNode && parentNode.kind !== 285) {\n                            parentNode = parentNode.parent;\n                        }\n                        bindBlockScopedDeclaration(parentNode, 524288, 793064);\n                        break;\n                    }\n                case 98:\n                    if (currentFlow && (ts.isExpression(node) || parent.kind === 258)) {\n                        node.flowNode = currentFlow;\n                    }\n                    return checkStrictModeIdentifier(node);\n                case 177:\n                    if (currentFlow && isNarrowableReference(node)) {\n                        node.flowNode = currentFlow;\n                    }\n                    break;\n                case 192:\n                    if (ts.isInJavaScriptFile(node)) {\n                        var specialKind = ts.getSpecialPropertyAssignmentKind(node);\n                        switch (specialKind) {\n                            case 1:\n                                bindExportsPropertyAssignment(node);\n                                break;\n                            case 2:\n                                bindModuleExportsAssignment(node);\n                                break;\n                            case 3:\n                                bindPrototypePropertyAssignment(node);\n                                break;\n                            case 4:\n                                bindThisPropertyAssignment(node);\n                                break;\n                            case 0:\n                                break;\n                            default:\n                                ts.Debug.fail(\"Unknown special property assignment kind\");\n                        }\n                    }\n                    return checkStrictModeBinaryExpression(node);\n                case 256:\n                    return checkStrictModeCatchClause(node);\n                case 186:\n                    return checkStrictModeDeleteExpression(node);\n                case 8:\n                    return checkStrictModeNumericLiteral(node);\n                case 191:\n                    return checkStrictModePostfixUnaryExpression(node);\n                case 190:\n                    return checkStrictModePrefixUnaryExpression(node);\n                case 217:\n                    return checkStrictModeWithStatement(node);\n                case 167:\n                    seenThisKeyword = true;\n                    return;\n                case 156:\n                    return checkTypePredicate(node);\n                case 143:\n                    return declareSymbolAndAddToSymbolTable(node, 262144, 530920);\n                case 144:\n                    return bindParameter(node);\n                case 223:\n                case 174:\n                    return bindVariableDeclarationOrBindingElement(node);\n                case 147:\n                case 146:\n                case 271:\n                    return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0);\n                case 286:\n                    return bindJSDocProperty(node);\n                case 257:\n                case 258:\n                    return bindPropertyOrMethodOrAccessor(node, 4, 0);\n                case 260:\n                    return bindPropertyOrMethodOrAccessor(node, 8, 900095);\n                case 259:\n                case 251:\n                    var root = container;\n                    var hasRest = false;\n                    while (root.parent) {\n                        if (root.kind === 176 &&\n                            root.parent.kind === 192 &&\n                            root.parent.operatorToken.kind === 57 &&\n                            root.parent.left === root) {\n                            hasRest = true;\n                            break;\n                        }\n                        root = root.parent;\n                    }\n                    return;\n                case 153:\n                case 154:\n                case 155:\n                    return declareSymbolAndAddToSymbolTable(node, 131072, 0);\n                case 149:\n                case 148:\n                    return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263);\n                case 225:\n                    return bindFunctionDeclaration(node);\n                case 150:\n                    return declareSymbolAndAddToSymbolTable(node, 16384, 0);\n                case 151:\n                    return bindPropertyOrMethodOrAccessor(node, 32768, 41919);\n                case 152:\n                    return bindPropertyOrMethodOrAccessor(node, 65536, 74687);\n                case 158:\n                case 159:\n                case 274:\n                    return bindFunctionOrConstructorType(node);\n                case 161:\n                case 170:\n                case 287:\n                case 270:\n                    return bindAnonymousDeclaration(node, 2048, \"__type\");\n                case 176:\n                    return bindObjectLiteralExpression(node);\n                case 184:\n                case 185:\n                    return bindFunctionExpression(node);\n                case 179:\n                    if (ts.isInJavaScriptFile(node)) {\n                        bindCallExpression(node);\n                    }\n                    break;\n                case 197:\n                case 226:\n                    inStrictMode = true;\n                    return bindClassLikeDeclaration(node);\n                case 227:\n                    return bindBlockScopedDeclaration(node, 64, 792968);\n                case 285:\n                    if (!node.fullName || node.fullName.kind === 70) {\n                        return bindBlockScopedDeclaration(node, 524288, 793064);\n                    }\n                    break;\n                case 228:\n                    return bindBlockScopedDeclaration(node, 524288, 793064);\n                case 229:\n                    return bindEnumDeclaration(node);\n                case 230:\n                    return bindModuleDeclaration(node);\n                case 234:\n                case 237:\n                case 239:\n                case 243:\n                    return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608);\n                case 233:\n                    return bindNamespaceExportDeclaration(node);\n                case 236:\n                    return bindImportClause(node);\n                case 241:\n                    return bindExportDeclaration(node);\n                case 240:\n                    return bindExportAssignment(node);\n                case 261:\n                    updateStrictModeStatementList(node.statements);\n                    return bindSourceFileIfExternalModule();\n                case 204:\n                    if (!ts.isFunctionLike(node.parent)) {\n                        return;\n                    }\n                case 231:\n                    return updateStrictModeStatementList(node.statements);\n            }\n        }\n        function checkTypePredicate(node) {\n            var parameterName = node.parameterName, type = node.type;\n            if (parameterName && parameterName.kind === 70) {\n                checkStrictModeIdentifier(parameterName);\n            }\n            if (parameterName && parameterName.kind === 167) {\n                seenThisKeyword = true;\n            }\n            bind(type);\n        }\n        function bindSourceFileIfExternalModule() {\n            setExportContextFlag(file);\n            if (ts.isExternalModule(file)) {\n                bindSourceFileAsExternalModule();\n            }\n        }\n        function bindSourceFileAsExternalModule() {\n            bindAnonymousDeclaration(file, 512, \"\\\"\" + ts.removeFileExtension(file.fileName) + \"\\\"\");\n        }\n        function bindExportAssignment(node) {\n            if (!container.symbol || !container.symbol.exports) {\n                bindAnonymousDeclaration(node, 8388608, getDeclarationName(node));\n            }\n            else {\n                var flags = node.kind === 240 && ts.exportAssignmentIsAlias(node)\n                    ? 8388608\n                    : 4;\n                declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 | 8388608 | 32 | 16);\n            }\n        }\n        function bindNamespaceExportDeclaration(node) {\n            if (node.modifiers && node.modifiers.length) {\n                file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here));\n            }\n            if (node.parent.kind !== 261) {\n                file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level));\n                return;\n            }\n            else {\n                var parent_4 = node.parent;\n                if (!ts.isExternalModule(parent_4)) {\n                    file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files));\n                    return;\n                }\n                if (!parent_4.isDeclarationFile) {\n                    file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files));\n                    return;\n                }\n            }\n            file.symbol.globalExports = file.symbol.globalExports || ts.createMap();\n            declareSymbol(file.symbol.globalExports, file.symbol, node, 8388608, 8388608);\n        }\n        function bindExportDeclaration(node) {\n            if (!container.symbol || !container.symbol.exports) {\n                bindAnonymousDeclaration(node, 1073741824, getDeclarationName(node));\n            }\n            else if (!node.exportClause) {\n                declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0);\n            }\n        }\n        function bindImportClause(node) {\n            if (node.name) {\n                declareSymbolAndAddToSymbolTable(node, 8388608, 8388608);\n            }\n        }\n        function setCommonJsModuleIndicator(node) {\n            if (!file.commonJsModuleIndicator) {\n                file.commonJsModuleIndicator = node;\n                if (!file.externalModuleIndicator) {\n                    bindSourceFileAsExternalModule();\n                }\n            }\n        }\n        function bindExportsPropertyAssignment(node) {\n            setCommonJsModuleIndicator(node);\n            declareSymbol(file.symbol.exports, file.symbol, node.left, 4 | 7340032, 0);\n        }\n        function bindModuleExportsAssignment(node) {\n            setCommonJsModuleIndicator(node);\n            declareSymbol(file.symbol.exports, file.symbol, node, 4 | 7340032 | 512, 0);\n        }\n        function bindThisPropertyAssignment(node) {\n            ts.Debug.assert(ts.isInJavaScriptFile(node));\n            if (container.kind === 225 || container.kind === 184) {\n                container.symbol.members = container.symbol.members || ts.createMap();\n                declareSymbol(container.symbol.members, container.symbol, node, 4, 0 & ~4);\n            }\n            else if (container.kind === 150) {\n                var saveContainer = container;\n                container = container.parent;\n                var symbol = bindPropertyOrMethodOrAccessor(node, 4, 0);\n                if (symbol) {\n                    symbol.isReplaceableByMethod = true;\n                }\n                container = saveContainer;\n            }\n        }\n        function bindPrototypePropertyAssignment(node) {\n            var leftSideOfAssignment = node.left;\n            var classPrototype = leftSideOfAssignment.expression;\n            var constructorFunction = classPrototype.expression;\n            leftSideOfAssignment.parent = node;\n            constructorFunction.parent = classPrototype;\n            classPrototype.parent = leftSideOfAssignment;\n            var funcSymbol = container.locals[constructorFunction.text];\n            if (!funcSymbol || !(funcSymbol.flags & 16 || ts.isDeclarationOfFunctionExpression(funcSymbol))) {\n                return;\n            }\n            if (!funcSymbol.members) {\n                funcSymbol.members = ts.createMap();\n            }\n            declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, 4, 0);\n        }\n        function bindCallExpression(node) {\n            if (!file.commonJsModuleIndicator && ts.isRequireCall(node, false)) {\n                setCommonJsModuleIndicator(node);\n            }\n        }\n        function bindClassLikeDeclaration(node) {\n            if (node.kind === 226) {\n                bindBlockScopedDeclaration(node, 32, 899519);\n            }\n            else {\n                var bindingName = node.name ? node.name.text : \"__class\";\n                bindAnonymousDeclaration(node, 32, bindingName);\n                if (node.name) {\n                    classifiableNames[node.name.text] = node.name.text;\n                }\n            }\n            var symbol = node.symbol;\n            var prototypeSymbol = createSymbol(4 | 134217728, \"prototype\");\n            if (symbol.exports[prototypeSymbol.name]) {\n                if (node.name) {\n                    node.name.parent = node;\n                }\n                file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name));\n            }\n            symbol.exports[prototypeSymbol.name] = prototypeSymbol;\n            prototypeSymbol.parent = symbol;\n        }\n        function bindEnumDeclaration(node) {\n            return ts.isConst(node)\n                ? bindBlockScopedDeclaration(node, 128, 899967)\n                : bindBlockScopedDeclaration(node, 256, 899327);\n        }\n        function bindVariableDeclarationOrBindingElement(node) {\n            if (inStrictMode) {\n                checkStrictModeEvalOrArguments(node, node.name);\n            }\n            if (!ts.isBindingPattern(node.name)) {\n                if (ts.isBlockOrCatchScoped(node)) {\n                    bindBlockScopedVariableDeclaration(node);\n                }\n                else if (ts.isParameterDeclaration(node)) {\n                    declareSymbolAndAddToSymbolTable(node, 1, 107455);\n                }\n                else {\n                    declareSymbolAndAddToSymbolTable(node, 1, 107454);\n                }\n            }\n        }\n        function bindParameter(node) {\n            if (inStrictMode) {\n                checkStrictModeEvalOrArguments(node, node.name);\n            }\n            if (ts.isBindingPattern(node.name)) {\n                bindAnonymousDeclaration(node, 1, getDestructuringParameterName(node));\n            }\n            else {\n                declareSymbolAndAddToSymbolTable(node, 1, 107455);\n            }\n            if (ts.isParameterPropertyDeclaration(node)) {\n                var classDeclaration = node.parent.parent;\n                declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 | (node.questionToken ? 536870912 : 0), 0);\n            }\n        }\n        function bindFunctionDeclaration(node) {\n            if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) {\n                if (ts.isAsyncFunctionLike(node)) {\n                    emitFlags |= 1024;\n                }\n            }\n            checkStrictModeFunctionName(node);\n            if (inStrictMode) {\n                checkStrictModeFunctionDeclaration(node);\n                bindBlockScopedDeclaration(node, 16, 106927);\n            }\n            else {\n                declareSymbolAndAddToSymbolTable(node, 16, 106927);\n            }\n        }\n        function bindFunctionExpression(node) {\n            if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) {\n                if (ts.isAsyncFunctionLike(node)) {\n                    emitFlags |= 1024;\n                }\n            }\n            if (currentFlow) {\n                node.flowNode = currentFlow;\n            }\n            checkStrictModeFunctionName(node);\n            var bindingName = node.name ? node.name.text : \"__function\";\n            return bindAnonymousDeclaration(node, 16, bindingName);\n        }\n        function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) {\n            if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) {\n                if (ts.isAsyncFunctionLike(node)) {\n                    emitFlags |= 1024;\n                }\n            }\n            if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) {\n                node.flowNode = currentFlow;\n            }\n            return ts.hasDynamicName(node)\n                ? bindAnonymousDeclaration(node, symbolFlags, \"__computed\")\n                : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes);\n        }\n        function bindJSDocProperty(node) {\n            return declareSymbolAndAddToSymbolTable(node, 4, 0);\n        }\n        function shouldReportErrorOnModuleDeclaration(node) {\n            var instanceState = getModuleInstanceState(node);\n            return instanceState === 1 || (instanceState === 2 && options.preserveConstEnums);\n        }\n        function checkUnreachable(node) {\n            if (!(currentFlow.flags & 1)) {\n                return false;\n            }\n            if (currentFlow === unreachableFlow) {\n                var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 206) ||\n                    node.kind === 226 ||\n                    (node.kind === 230 && shouldReportErrorOnModuleDeclaration(node)) ||\n                    (node.kind === 229 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums));\n                if (reportError) {\n                    currentFlow = reportedUnreachableFlow;\n                    var reportUnreachableCode = !options.allowUnreachableCode &&\n                        !ts.isInAmbientContext(node) &&\n                        (node.kind !== 205 ||\n                            ts.getCombinedNodeFlags(node.declarationList) & 3 ||\n                            ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; }));\n                    if (reportUnreachableCode) {\n                        errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected);\n                    }\n                }\n            }\n            return true;\n        }\n    }\n    function computeTransformFlagsForNode(node, subtreeFlags) {\n        var kind = node.kind;\n        switch (kind) {\n            case 179:\n                return computeCallExpression(node, subtreeFlags);\n            case 180:\n                return computeNewExpression(node, subtreeFlags);\n            case 230:\n                return computeModuleDeclaration(node, subtreeFlags);\n            case 183:\n                return computeParenthesizedExpression(node, subtreeFlags);\n            case 192:\n                return computeBinaryExpression(node, subtreeFlags);\n            case 207:\n                return computeExpressionStatement(node, subtreeFlags);\n            case 144:\n                return computeParameter(node, subtreeFlags);\n            case 185:\n                return computeArrowFunction(node, subtreeFlags);\n            case 184:\n                return computeFunctionExpression(node, subtreeFlags);\n            case 225:\n                return computeFunctionDeclaration(node, subtreeFlags);\n            case 223:\n                return computeVariableDeclaration(node, subtreeFlags);\n            case 224:\n                return computeVariableDeclarationList(node, subtreeFlags);\n            case 205:\n                return computeVariableStatement(node, subtreeFlags);\n            case 219:\n                return computeLabeledStatement(node, subtreeFlags);\n            case 226:\n                return computeClassDeclaration(node, subtreeFlags);\n            case 197:\n                return computeClassExpression(node, subtreeFlags);\n            case 255:\n                return computeHeritageClause(node, subtreeFlags);\n            case 256:\n                return computeCatchClause(node, subtreeFlags);\n            case 199:\n                return computeExpressionWithTypeArguments(node, subtreeFlags);\n            case 150:\n                return computeConstructor(node, subtreeFlags);\n            case 147:\n                return computePropertyDeclaration(node, subtreeFlags);\n            case 149:\n                return computeMethod(node, subtreeFlags);\n            case 151:\n            case 152:\n                return computeAccessor(node, subtreeFlags);\n            case 234:\n                return computeImportEquals(node, subtreeFlags);\n            case 177:\n                return computePropertyAccess(node, subtreeFlags);\n            default:\n                return computeOther(node, kind, subtreeFlags);\n        }\n    }\n    ts.computeTransformFlagsForNode = computeTransformFlagsForNode;\n    function computeCallExpression(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        var expression = node.expression;\n        var expressionKind = expression.kind;\n        if (node.typeArguments) {\n            transformFlags |= 3;\n        }\n        if (subtreeFlags & 524288\n            || isSuperOrSuperProperty(expression, expressionKind)) {\n            transformFlags |= 192;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~537396545;\n    }\n    function isSuperOrSuperProperty(node, kind) {\n        switch (kind) {\n            case 96:\n                return true;\n            case 177:\n            case 178:\n                var expression = node.expression;\n                var expressionKind = expression.kind;\n                return expressionKind === 96;\n        }\n        return false;\n    }\n    function computeNewExpression(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (node.typeArguments) {\n            transformFlags |= 3;\n        }\n        if (subtreeFlags & 524288) {\n            transformFlags |= 192;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~537396545;\n    }\n    function computeBinaryExpression(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        var operatorTokenKind = node.operatorToken.kind;\n        var leftKind = node.left.kind;\n        if (operatorTokenKind === 57 && leftKind === 176) {\n            transformFlags |= 8 | 192 | 3072;\n        }\n        else if (operatorTokenKind === 57 && leftKind === 175) {\n            transformFlags |= 192 | 3072;\n        }\n        else if (operatorTokenKind === 39\n            || operatorTokenKind === 61) {\n            transformFlags |= 32;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeParameter(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        var modifierFlags = ts.getModifierFlags(node);\n        var name = node.name;\n        var initializer = node.initializer;\n        var dotDotDotToken = node.dotDotDotToken;\n        if (node.questionToken\n            || node.type\n            || subtreeFlags & 4096\n            || ts.isThisIdentifier(name)) {\n            transformFlags |= 3;\n        }\n        if (modifierFlags & 92) {\n            transformFlags |= 3 | 262144;\n        }\n        if (subtreeFlags & 1048576) {\n            transformFlags |= 8;\n        }\n        if (subtreeFlags & 8388608 || initializer || dotDotDotToken) {\n            transformFlags |= 192 | 131072;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeParenthesizedExpression(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        var expression = node.expression;\n        var expressionKind = expression.kind;\n        var expressionTransformFlags = expression.transformFlags;\n        if (expressionKind === 200\n            || expressionKind === 182) {\n            transformFlags |= 3;\n        }\n        if (expressionTransformFlags & 1024) {\n            transformFlags |= 1024;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeClassDeclaration(node, subtreeFlags) {\n        var transformFlags;\n        var modifierFlags = ts.getModifierFlags(node);\n        if (modifierFlags & 2) {\n            transformFlags = 3;\n        }\n        else {\n            transformFlags = subtreeFlags | 192;\n            if ((subtreeFlags & 274432)\n                || node.typeParameters) {\n                transformFlags |= 3;\n            }\n            if (subtreeFlags & 65536) {\n                transformFlags |= 16384;\n            }\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~539358529;\n    }\n    function computeClassExpression(node, subtreeFlags) {\n        var transformFlags = subtreeFlags | 192;\n        if (subtreeFlags & 274432\n            || node.typeParameters) {\n            transformFlags |= 3;\n        }\n        if (subtreeFlags & 65536) {\n            transformFlags |= 16384;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~539358529;\n    }\n    function computeHeritageClause(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        switch (node.token) {\n            case 84:\n                transformFlags |= 192;\n                break;\n            case 107:\n                transformFlags |= 3;\n                break;\n            default:\n                ts.Debug.fail(\"Unexpected token for heritage clause\");\n                break;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeCatchClause(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (node.variableDeclaration && ts.isBindingPattern(node.variableDeclaration.name)) {\n            transformFlags |= 192;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~537920833;\n    }\n    function computeExpressionWithTypeArguments(node, subtreeFlags) {\n        var transformFlags = subtreeFlags | 192;\n        if (node.typeArguments) {\n            transformFlags |= 3;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeConstructor(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (ts.hasModifier(node, 2270)\n            || !node.body) {\n            transformFlags |= 3;\n        }\n        if (subtreeFlags & 1048576) {\n            transformFlags |= 8;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~601015617;\n    }\n    function computeMethod(node, subtreeFlags) {\n        var transformFlags = subtreeFlags | 192;\n        if (node.decorators\n            || ts.hasModifier(node, 2270)\n            || node.typeParameters\n            || node.type\n            || !node.body) {\n            transformFlags |= 3;\n        }\n        if (subtreeFlags & 1048576) {\n            transformFlags |= 8;\n        }\n        if (ts.hasModifier(node, 256)) {\n            transformFlags |= 16;\n        }\n        if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {\n            transformFlags |= 768;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~601015617;\n    }\n    function computeAccessor(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (node.decorators\n            || ts.hasModifier(node, 2270)\n            || node.type\n            || !node.body) {\n            transformFlags |= 3;\n        }\n        if (subtreeFlags & 1048576) {\n            transformFlags |= 8;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~601015617;\n    }\n    function computePropertyDeclaration(node, subtreeFlags) {\n        var transformFlags = subtreeFlags | 3;\n        if (node.initializer) {\n            transformFlags |= 8192;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeFunctionDeclaration(node, subtreeFlags) {\n        var transformFlags;\n        var modifierFlags = ts.getModifierFlags(node);\n        var body = node.body;\n        if (!body || (modifierFlags & 2)) {\n            transformFlags = 3;\n        }\n        else {\n            transformFlags = subtreeFlags | 33554432;\n            if (modifierFlags & 2270\n                || node.typeParameters\n                || node.type) {\n                transformFlags |= 3;\n            }\n            if (modifierFlags & 256) {\n                transformFlags |= 16;\n            }\n            if (subtreeFlags & 1048576) {\n                transformFlags |= 8;\n            }\n            if (subtreeFlags & 163840) {\n                transformFlags |= 192;\n            }\n            if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {\n                transformFlags |= 768;\n            }\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~601281857;\n    }\n    function computeFunctionExpression(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (ts.hasModifier(node, 2270)\n            || node.typeParameters\n            || node.type) {\n            transformFlags |= 3;\n        }\n        if (ts.hasModifier(node, 256)) {\n            transformFlags |= 16;\n        }\n        if (subtreeFlags & 1048576) {\n            transformFlags |= 8;\n        }\n        if (subtreeFlags & 163840) {\n            transformFlags |= 192;\n        }\n        if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {\n            transformFlags |= 768;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~601281857;\n    }\n    function computeArrowFunction(node, subtreeFlags) {\n        var transformFlags = subtreeFlags | 192;\n        if (ts.hasModifier(node, 2270)\n            || node.typeParameters\n            || node.type) {\n            transformFlags |= 3;\n        }\n        if (ts.hasModifier(node, 256)) {\n            transformFlags |= 16;\n        }\n        if (subtreeFlags & 1048576) {\n            transformFlags |= 8;\n        }\n        if (subtreeFlags & 16384) {\n            transformFlags |= 32768;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~601249089;\n    }\n    function computePropertyAccess(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        var expression = node.expression;\n        var expressionKind = expression.kind;\n        if (expressionKind === 96) {\n            transformFlags |= 16384;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeVariableDeclaration(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        transformFlags |= 192 | 8388608;\n        if (subtreeFlags & 1048576) {\n            transformFlags |= 8;\n        }\n        if (node.type) {\n            transformFlags |= 3;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeVariableStatement(node, subtreeFlags) {\n        var transformFlags;\n        var modifierFlags = ts.getModifierFlags(node);\n        var declarationListTransformFlags = node.declarationList.transformFlags;\n        if (modifierFlags & 2) {\n            transformFlags = 3;\n        }\n        else {\n            transformFlags = subtreeFlags;\n            if (declarationListTransformFlags & 8388608) {\n                transformFlags |= 192;\n            }\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeLabeledStatement(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (subtreeFlags & 4194304\n            && ts.isIterationStatement(node, true)) {\n            transformFlags |= 192;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeImportEquals(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (!ts.isExternalModuleImportEqualsDeclaration(node)) {\n            transformFlags |= 3;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeExpressionStatement(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (node.expression.transformFlags & 1024) {\n            transformFlags |= 192;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~536872257;\n    }\n    function computeModuleDeclaration(node, subtreeFlags) {\n        var transformFlags = 3;\n        var modifierFlags = ts.getModifierFlags(node);\n        if ((modifierFlags & 2) === 0) {\n            transformFlags |= subtreeFlags;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~574674241;\n    }\n    function computeVariableDeclarationList(node, subtreeFlags) {\n        var transformFlags = subtreeFlags | 33554432;\n        if (subtreeFlags & 8388608) {\n            transformFlags |= 192;\n        }\n        if (node.flags & 3) {\n            transformFlags |= 192 | 4194304;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~546309441;\n    }\n    function computeOther(node, kind, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        var excludeFlags = 536872257;\n        switch (kind) {\n            case 119:\n            case 189:\n                transformFlags |= 16;\n                break;\n            case 113:\n            case 111:\n            case 112:\n            case 116:\n            case 123:\n            case 75:\n            case 229:\n            case 260:\n            case 182:\n            case 200:\n            case 201:\n            case 130:\n                transformFlags |= 3;\n                break;\n            case 246:\n            case 247:\n            case 248:\n            case 10:\n            case 249:\n            case 250:\n            case 251:\n            case 252:\n                transformFlags |= 4;\n                break;\n            case 213:\n                transformFlags |= 8;\n            case 12:\n            case 13:\n            case 14:\n            case 15:\n            case 194:\n            case 181:\n            case 258:\n            case 114:\n                transformFlags |= 192;\n                break;\n            case 195:\n                transformFlags |= 192 | 16777216;\n                break;\n            case 118:\n            case 132:\n            case 129:\n            case 134:\n            case 121:\n            case 135:\n            case 104:\n            case 143:\n            case 146:\n            case 148:\n            case 153:\n            case 154:\n            case 155:\n            case 156:\n            case 157:\n            case 158:\n            case 159:\n            case 160:\n            case 161:\n            case 162:\n            case 163:\n            case 164:\n            case 165:\n            case 166:\n            case 227:\n            case 228:\n            case 167:\n            case 168:\n            case 169:\n            case 170:\n            case 171:\n                transformFlags = 3;\n                excludeFlags = -3;\n                break;\n            case 142:\n                transformFlags |= 2097152;\n                if (subtreeFlags & 16384) {\n                    transformFlags |= 65536;\n                }\n                break;\n            case 196:\n                transformFlags |= 192 | 524288;\n                break;\n            case 259:\n                transformFlags |= 8 | 1048576;\n                break;\n            case 96:\n                transformFlags |= 192;\n                break;\n            case 98:\n                transformFlags |= 16384;\n                break;\n            case 172:\n                transformFlags |= 192 | 8388608;\n                if (subtreeFlags & 524288) {\n                    transformFlags |= 8 | 1048576;\n                }\n                excludeFlags = 537396545;\n                break;\n            case 173:\n                transformFlags |= 192 | 8388608;\n                excludeFlags = 537396545;\n                break;\n            case 174:\n                transformFlags |= 192;\n                if (node.dotDotDotToken) {\n                    transformFlags |= 524288;\n                }\n                break;\n            case 145:\n                transformFlags |= 3 | 4096;\n                break;\n            case 176:\n                excludeFlags = 540087617;\n                if (subtreeFlags & 2097152) {\n                    transformFlags |= 192;\n                }\n                if (subtreeFlags & 65536) {\n                    transformFlags |= 16384;\n                }\n                if (subtreeFlags & 1048576) {\n                    transformFlags |= 8;\n                }\n                break;\n            case 175:\n            case 180:\n                excludeFlags = 537396545;\n                if (subtreeFlags & 524288) {\n                    transformFlags |= 192;\n                }\n                break;\n            case 209:\n            case 210:\n            case 211:\n            case 212:\n                if (subtreeFlags & 4194304) {\n                    transformFlags |= 192;\n                }\n                break;\n            case 261:\n                if (subtreeFlags & 32768) {\n                    transformFlags |= 192;\n                }\n                break;\n            case 216:\n            case 214:\n            case 215:\n                transformFlags |= 33554432;\n                break;\n        }\n        node.transformFlags = transformFlags | 536870912;\n        return transformFlags & ~excludeFlags;\n    }\n    function getTransformFlagsSubtreeExclusions(kind) {\n        if (kind >= 156 && kind <= 171) {\n            return -3;\n        }\n        switch (kind) {\n            case 179:\n            case 180:\n            case 175:\n                return 537396545;\n            case 230:\n                return 574674241;\n            case 144:\n                return 536872257;\n            case 185:\n                return 601249089;\n            case 184:\n            case 225:\n                return 601281857;\n            case 224:\n                return 546309441;\n            case 226:\n            case 197:\n                return 539358529;\n            case 150:\n                return 601015617;\n            case 149:\n            case 151:\n            case 152:\n                return 601015617;\n            case 118:\n            case 132:\n            case 129:\n            case 134:\n            case 121:\n            case 135:\n            case 104:\n            case 143:\n            case 146:\n            case 148:\n            case 153:\n            case 154:\n            case 155:\n            case 227:\n            case 228:\n                return -3;\n            case 176:\n                return 540087617;\n            case 256:\n                return 537920833;\n            case 172:\n            case 173:\n                return 537396545;\n            default:\n                return 536872257;\n        }\n    }\n    ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var ambientModuleSymbolRegex = /^\".+\"$/;\n    var nextSymbolId = 1;\n    var nextNodeId = 1;\n    var nextMergeId = 1;\n    var nextFlowId = 1;\n    function getNodeId(node) {\n        if (!node.id) {\n            node.id = nextNodeId;\n            nextNodeId++;\n        }\n        return node.id;\n    }\n    ts.getNodeId = getNodeId;\n    function getSymbolId(symbol) {\n        if (!symbol.id) {\n            symbol.id = nextSymbolId;\n            nextSymbolId++;\n        }\n        return symbol.id;\n    }\n    ts.getSymbolId = getSymbolId;\n    function createTypeChecker(host, produceDiagnostics) {\n        var cancellationToken;\n        var requestedExternalEmitHelpers;\n        var externalHelpersModule;\n        var Symbol = ts.objectAllocator.getSymbolConstructor();\n        var Type = ts.objectAllocator.getTypeConstructor();\n        var Signature = ts.objectAllocator.getSignatureConstructor();\n        var typeCount = 0;\n        var symbolCount = 0;\n        var emptyArray = [];\n        var emptySymbols = ts.createMap();\n        var compilerOptions = host.getCompilerOptions();\n        var languageVersion = compilerOptions.target || 0;\n        var modulekind = ts.getEmitModuleKind(compilerOptions);\n        var noUnusedIdentifiers = !!compilerOptions.noUnusedLocals || !!compilerOptions.noUnusedParameters;\n        var allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== \"undefined\" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ts.ModuleKind.System;\n        var strictNullChecks = compilerOptions.strictNullChecks;\n        var emitResolver = createResolver();\n        var undefinedSymbol = createSymbol(4 | 67108864, \"undefined\");\n        undefinedSymbol.declarations = [];\n        var argumentsSymbol = createSymbol(4 | 67108864, \"arguments\");\n        var checker = {\n            getNodeCount: function () { return ts.sum(host.getSourceFiles(), \"nodeCount\"); },\n            getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), \"identifierCount\"); },\n            getSymbolCount: function () { return ts.sum(host.getSourceFiles(), \"symbolCount\") + symbolCount; },\n            getTypeCount: function () { return typeCount; },\n            isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; },\n            isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; },\n            isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; },\n            getDiagnostics: getDiagnostics,\n            getGlobalDiagnostics: getGlobalDiagnostics,\n            getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation,\n            getSymbolsOfParameterPropertyDeclaration: getSymbolsOfParameterPropertyDeclaration,\n            getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol,\n            getPropertiesOfType: getPropertiesOfType,\n            getPropertyOfType: getPropertyOfType,\n            getSignaturesOfType: getSignaturesOfType,\n            getIndexTypeOfType: getIndexTypeOfType,\n            getBaseTypes: getBaseTypes,\n            getReturnTypeOfSignature: getReturnTypeOfSignature,\n            getNonNullableType: getNonNullableType,\n            getSymbolsInScope: getSymbolsInScope,\n            getSymbolAtLocation: getSymbolAtLocation,\n            getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol,\n            getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol,\n            getTypeAtLocation: getTypeOfNode,\n            getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment,\n            typeToString: typeToString,\n            getSymbolDisplayBuilder: getSymbolDisplayBuilder,\n            symbolToString: symbolToString,\n            getAugmentedPropertiesOfType: getAugmentedPropertiesOfType,\n            getRootSymbols: getRootSymbols,\n            getContextualType: getContextualType,\n            getFullyQualifiedName: getFullyQualifiedName,\n            getResolvedSignature: getResolvedSignature,\n            getConstantValue: getConstantValue,\n            isValidPropertyAccess: isValidPropertyAccess,\n            getSignatureFromDeclaration: getSignatureFromDeclaration,\n            isImplementationOfOverload: isImplementationOfOverload,\n            getAliasedSymbol: resolveAlias,\n            getEmitResolver: getEmitResolver,\n            getExportsOfModule: getExportsOfModuleAsArray,\n            getAmbientModules: getAmbientModules,\n            getJsxElementAttributesType: getJsxElementAttributesType,\n            getJsxIntrinsicTagNames: getJsxIntrinsicTagNames,\n            isOptionalParameter: isOptionalParameter,\n            tryGetMemberInModuleExports: tryGetMemberInModuleExports,\n            tryFindAmbientModuleWithoutAugmentations: function (moduleName) {\n                return tryFindAmbientModule(moduleName, false);\n            }\n        };\n        var tupleTypes = [];\n        var unionTypes = ts.createMap();\n        var intersectionTypes = ts.createMap();\n        var stringLiteralTypes = ts.createMap();\n        var numericLiteralTypes = ts.createMap();\n        var indexedAccessTypes = ts.createMap();\n        var evolvingArrayTypes = [];\n        var unknownSymbol = createSymbol(4 | 67108864, \"unknown\");\n        var resolvingSymbol = createSymbol(67108864, \"__resolving__\");\n        var anyType = createIntrinsicType(1, \"any\");\n        var autoType = createIntrinsicType(1, \"any\");\n        var unknownType = createIntrinsicType(1, \"unknown\");\n        var undefinedType = createIntrinsicType(2048, \"undefined\");\n        var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(2048 | 2097152, \"undefined\");\n        var nullType = createIntrinsicType(4096, \"null\");\n        var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(4096 | 2097152, \"null\");\n        var stringType = createIntrinsicType(2, \"string\");\n        var numberType = createIntrinsicType(4, \"number\");\n        var trueType = createIntrinsicType(128, \"true\");\n        var falseType = createIntrinsicType(128, \"false\");\n        var booleanType = createBooleanType([trueType, falseType]);\n        var esSymbolType = createIntrinsicType(512, \"symbol\");\n        var voidType = createIntrinsicType(1024, \"void\");\n        var neverType = createIntrinsicType(8192, \"never\");\n        var silentNeverType = createIntrinsicType(8192, \"never\");\n        var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n        var emptyTypeLiteralSymbol = createSymbol(2048 | 67108864, \"__type\");\n        emptyTypeLiteralSymbol.members = ts.createMap();\n        var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n        var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n        emptyGenericType.instantiations = ts.createMap();\n        var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n        anyFunctionType.flags |= 8388608;\n        var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n        var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false);\n        var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false);\n        var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false);\n        var silentNeverSignature = createSignature(undefined, undefined, undefined, emptyArray, silentNeverType, undefined, 0, false, false);\n        var enumNumberIndexInfo = createIndexInfo(stringType, true);\n        var globals = ts.createMap();\n        var patternAmbientModules;\n        var getGlobalESSymbolConstructorSymbol;\n        var getGlobalPromiseConstructorSymbol;\n        var tryGetGlobalPromiseConstructorSymbol;\n        var globalObjectType;\n        var globalFunctionType;\n        var globalArrayType;\n        var globalReadonlyArrayType;\n        var globalStringType;\n        var globalNumberType;\n        var globalBooleanType;\n        var globalRegExpType;\n        var anyArrayType;\n        var autoArrayType;\n        var anyReadonlyArrayType;\n        var getGlobalTemplateStringsArrayType;\n        var getGlobalESSymbolType;\n        var getGlobalIterableType;\n        var getGlobalIteratorType;\n        var getGlobalIterableIteratorType;\n        var getGlobalClassDecoratorType;\n        var getGlobalParameterDecoratorType;\n        var getGlobalPropertyDecoratorType;\n        var getGlobalMethodDecoratorType;\n        var getGlobalTypedPropertyDescriptorType;\n        var getGlobalPromiseType;\n        var tryGetGlobalPromiseType;\n        var getGlobalPromiseLikeType;\n        var getInstantiatedGlobalPromiseLikeType;\n        var getGlobalPromiseConstructorLikeType;\n        var getGlobalThenableType;\n        var jsxElementClassType;\n        var deferredNodes;\n        var deferredUnusedIdentifierNodes;\n        var flowLoopStart = 0;\n        var flowLoopCount = 0;\n        var visitedFlowCount = 0;\n        var emptyStringType = getLiteralTypeForText(32, \"\");\n        var zeroType = getLiteralTypeForText(64, \"0\");\n        var resolutionTargets = [];\n        var resolutionResults = [];\n        var resolutionPropertyNames = [];\n        var mergedSymbols = [];\n        var symbolLinks = [];\n        var nodeLinks = [];\n        var flowLoopCaches = [];\n        var flowLoopNodes = [];\n        var flowLoopKeys = [];\n        var flowLoopTypes = [];\n        var visitedFlowNodes = [];\n        var visitedFlowTypes = [];\n        var potentialThisCollisions = [];\n        var awaitedTypeStack = [];\n        var diagnostics = ts.createDiagnosticCollection();\n        var typeofEQFacts = ts.createMap({\n            \"string\": 1,\n            \"number\": 2,\n            \"boolean\": 4,\n            \"symbol\": 8,\n            \"undefined\": 16384,\n            \"object\": 16,\n            \"function\": 32\n        });\n        var typeofNEFacts = ts.createMap({\n            \"string\": 128,\n            \"number\": 256,\n            \"boolean\": 512,\n            \"symbol\": 1024,\n            \"undefined\": 131072,\n            \"object\": 2048,\n            \"function\": 4096\n        });\n        var typeofTypesByName = ts.createMap({\n            \"string\": stringType,\n            \"number\": numberType,\n            \"boolean\": booleanType,\n            \"symbol\": esSymbolType,\n            \"undefined\": undefinedType\n        });\n        var jsxElementType;\n        var _jsxNamespace;\n        var _jsxFactoryEntity;\n        var jsxTypes = ts.createMap();\n        var JsxNames = {\n            JSX: \"JSX\",\n            IntrinsicElements: \"IntrinsicElements\",\n            ElementClass: \"ElementClass\",\n            ElementAttributesPropertyNameContainer: \"ElementAttributesProperty\",\n            Element: \"Element\",\n            IntrinsicAttributes: \"IntrinsicAttributes\",\n            IntrinsicClassAttributes: \"IntrinsicClassAttributes\"\n        };\n        var subtypeRelation = ts.createMap();\n        var assignableRelation = ts.createMap();\n        var comparableRelation = ts.createMap();\n        var identityRelation = ts.createMap();\n        var enumRelation = ts.createMap();\n        var _displayBuilder;\n        var builtinGlobals = ts.createMap();\n        builtinGlobals[undefinedSymbol.name] = undefinedSymbol;\n        initializeTypeChecker();\n        return checker;\n        function getJsxNamespace() {\n            if (_jsxNamespace === undefined) {\n                _jsxNamespace = \"React\";\n                if (compilerOptions.jsxFactory) {\n                    _jsxFactoryEntity = ts.parseIsolatedEntityName(compilerOptions.jsxFactory, languageVersion);\n                    if (_jsxFactoryEntity) {\n                        _jsxNamespace = getFirstIdentifier(_jsxFactoryEntity).text;\n                    }\n                }\n                else if (compilerOptions.reactNamespace) {\n                    _jsxNamespace = compilerOptions.reactNamespace;\n                }\n            }\n            return _jsxNamespace;\n        }\n        function getEmitResolver(sourceFile, cancellationToken) {\n            getDiagnostics(sourceFile, cancellationToken);\n            return emitResolver;\n        }\n        function error(location, message, arg0, arg1, arg2) {\n            var diagnostic = location\n                ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2)\n                : ts.createCompilerDiagnostic(message, arg0, arg1, arg2);\n            diagnostics.add(diagnostic);\n        }\n        function createSymbol(flags, name) {\n            symbolCount++;\n            return new Symbol(flags, name);\n        }\n        function getExcludedSymbolFlags(flags) {\n            var result = 0;\n            if (flags & 2)\n                result |= 107455;\n            if (flags & 1)\n                result |= 107454;\n            if (flags & 4)\n                result |= 0;\n            if (flags & 8)\n                result |= 900095;\n            if (flags & 16)\n                result |= 106927;\n            if (flags & 32)\n                result |= 899519;\n            if (flags & 64)\n                result |= 792968;\n            if (flags & 256)\n                result |= 899327;\n            if (flags & 128)\n                result |= 899967;\n            if (flags & 512)\n                result |= 106639;\n            if (flags & 8192)\n                result |= 99263;\n            if (flags & 32768)\n                result |= 41919;\n            if (flags & 65536)\n                result |= 74687;\n            if (flags & 262144)\n                result |= 530920;\n            if (flags & 524288)\n                result |= 793064;\n            if (flags & 8388608)\n                result |= 8388608;\n            return result;\n        }\n        function recordMergedSymbol(target, source) {\n            if (!source.mergeId) {\n                source.mergeId = nextMergeId;\n                nextMergeId++;\n            }\n            mergedSymbols[source.mergeId] = target;\n        }\n        function cloneSymbol(symbol) {\n            var result = createSymbol(symbol.flags | 33554432, symbol.name);\n            result.declarations = symbol.declarations.slice(0);\n            result.parent = symbol.parent;\n            if (symbol.valueDeclaration)\n                result.valueDeclaration = symbol.valueDeclaration;\n            if (symbol.constEnumOnlyModule)\n                result.constEnumOnlyModule = true;\n            if (symbol.members)\n                result.members = ts.cloneMap(symbol.members);\n            if (symbol.exports)\n                result.exports = ts.cloneMap(symbol.exports);\n            recordMergedSymbol(result, symbol);\n            return result;\n        }\n        function mergeSymbol(target, source) {\n            if (!(target.flags & getExcludedSymbolFlags(source.flags))) {\n                if (source.flags & 512 && target.flags & 512 && target.constEnumOnlyModule && !source.constEnumOnlyModule) {\n                    target.constEnumOnlyModule = false;\n                }\n                target.flags |= source.flags;\n                if (source.valueDeclaration &&\n                    (!target.valueDeclaration ||\n                        (target.valueDeclaration.kind === 230 && source.valueDeclaration.kind !== 230))) {\n                    target.valueDeclaration = source.valueDeclaration;\n                }\n                ts.forEach(source.declarations, function (node) {\n                    target.declarations.push(node);\n                });\n                if (source.members) {\n                    if (!target.members)\n                        target.members = ts.createMap();\n                    mergeSymbolTable(target.members, source.members);\n                }\n                if (source.exports) {\n                    if (!target.exports)\n                        target.exports = ts.createMap();\n                    mergeSymbolTable(target.exports, source.exports);\n                }\n                recordMergedSymbol(target, source);\n            }\n            else {\n                var message_2 = target.flags & 2 || source.flags & 2\n                    ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0;\n                ts.forEach(source.declarations, function (node) {\n                    error(node.name ? node.name : node, message_2, symbolToString(source));\n                });\n                ts.forEach(target.declarations, function (node) {\n                    error(node.name ? node.name : node, message_2, symbolToString(source));\n                });\n            }\n        }\n        function mergeSymbolTable(target, source) {\n            for (var id in source) {\n                var targetSymbol = target[id];\n                if (!targetSymbol) {\n                    target[id] = source[id];\n                }\n                else {\n                    if (!(targetSymbol.flags & 33554432)) {\n                        target[id] = targetSymbol = cloneSymbol(targetSymbol);\n                    }\n                    mergeSymbol(targetSymbol, source[id]);\n                }\n            }\n        }\n        function mergeModuleAugmentation(moduleName) {\n            var moduleAugmentation = moduleName.parent;\n            if (moduleAugmentation.symbol.declarations[0] !== moduleAugmentation) {\n                ts.Debug.assert(moduleAugmentation.symbol.declarations.length > 1);\n                return;\n            }\n            if (ts.isGlobalScopeAugmentation(moduleAugmentation)) {\n                mergeSymbolTable(globals, moduleAugmentation.symbol.exports);\n            }\n            else {\n                var moduleNotFoundError = !ts.isInAmbientContext(moduleName.parent.parent)\n                    ? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found\n                    : undefined;\n                var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, true);\n                if (!mainModule) {\n                    return;\n                }\n                mainModule = resolveExternalModuleSymbol(mainModule);\n                if (mainModule.flags & 1920) {\n                    mainModule = mainModule.flags & 33554432 ? mainModule : cloneSymbol(mainModule);\n                    mergeSymbol(mainModule, moduleAugmentation.symbol);\n                }\n                else {\n                    error(moduleName, ts.Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text);\n                }\n            }\n        }\n        function addToSymbolTable(target, source, message) {\n            for (var id in source) {\n                if (target[id]) {\n                    ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message));\n                }\n                else {\n                    target[id] = source[id];\n                }\n            }\n            function addDeclarationDiagnostic(id, message) {\n                return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); };\n            }\n        }\n        function getSymbolLinks(symbol) {\n            if (symbol.flags & 67108864)\n                return symbol;\n            var id = getSymbolId(symbol);\n            return symbolLinks[id] || (symbolLinks[id] = {});\n        }\n        function getNodeLinks(node) {\n            var nodeId = getNodeId(node);\n            return nodeLinks[nodeId] || (nodeLinks[nodeId] = { flags: 0 });\n        }\n        function getObjectFlags(type) {\n            return type.flags & 32768 ? type.objectFlags : 0;\n        }\n        function isGlobalSourceFile(node) {\n            return node.kind === 261 && !ts.isExternalOrCommonJsModule(node);\n        }\n        function getSymbol(symbols, name, meaning) {\n            if (meaning) {\n                var symbol = symbols[name];\n                if (symbol) {\n                    ts.Debug.assert((symbol.flags & 16777216) === 0, \"Should never get an instantiated symbol here.\");\n                    if (symbol.flags & meaning) {\n                        return symbol;\n                    }\n                    if (symbol.flags & 8388608) {\n                        var target = resolveAlias(symbol);\n                        if (target === unknownSymbol || target.flags & meaning) {\n                            return symbol;\n                        }\n                    }\n                }\n            }\n        }\n        function getSymbolsOfParameterPropertyDeclaration(parameter, parameterName) {\n            var constructorDeclaration = parameter.parent;\n            var classDeclaration = parameter.parent.parent;\n            var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 107455);\n            var propertySymbol = getSymbol(classDeclaration.symbol.members, parameterName, 107455);\n            if (parameterSymbol && propertySymbol) {\n                return [parameterSymbol, propertySymbol];\n            }\n            ts.Debug.fail(\"There should exist two symbols, one as property declaration and one as parameter declaration\");\n        }\n        function isBlockScopedNameDeclaredBeforeUse(declaration, usage) {\n            var declarationFile = ts.getSourceFileOfNode(declaration);\n            var useFile = ts.getSourceFileOfNode(usage);\n            if (declarationFile !== useFile) {\n                if ((modulekind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator)) ||\n                    (!compilerOptions.outFile && !compilerOptions.out)) {\n                    return true;\n                }\n                if (isUsedInFunctionOrNonStaticProperty(usage)) {\n                    return true;\n                }\n                var sourceFiles = host.getSourceFiles();\n                return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile);\n            }\n            if (declaration.pos <= usage.pos) {\n                return declaration.kind !== 223 ||\n                    !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);\n            }\n            var container = ts.getEnclosingBlockScopeContainer(declaration);\n            return isUsedInFunctionOrNonStaticProperty(usage, container);\n            function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) {\n                var container = ts.getEnclosingBlockScopeContainer(declaration);\n                switch (declaration.parent.parent.kind) {\n                    case 205:\n                    case 211:\n                    case 213:\n                        if (isSameScopeDescendentOf(usage, declaration, container)) {\n                            return true;\n                        }\n                        break;\n                }\n                switch (declaration.parent.parent.kind) {\n                    case 212:\n                    case 213:\n                        if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) {\n                            return true;\n                        }\n                }\n                return false;\n            }\n            function isUsedInFunctionOrNonStaticProperty(usage, container) {\n                var current = usage;\n                while (current) {\n                    if (current === container) {\n                        return false;\n                    }\n                    if (ts.isFunctionLike(current)) {\n                        return true;\n                    }\n                    var initializerOfNonStaticProperty = current.parent &&\n                        current.parent.kind === 147 &&\n                        (ts.getModifierFlags(current.parent) & 32) === 0 &&\n                        current.parent.initializer === current;\n                    if (initializerOfNonStaticProperty) {\n                        return true;\n                    }\n                    current = current.parent;\n                }\n                return false;\n            }\n        }\n        function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) {\n            var result;\n            var lastLocation;\n            var propertyWithInvalidInitializer;\n            var errorLocation = location;\n            var grandparent;\n            var isInExternalModule = false;\n            loop: while (location) {\n                if (location.locals && !isGlobalSourceFile(location)) {\n                    if (result = getSymbol(location.locals, name, meaning)) {\n                        var useResult = true;\n                        if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) {\n                            if (meaning & result.flags & 793064 && lastLocation.kind !== 278) {\n                                useResult = result.flags & 262144\n                                    ? lastLocation === location.type ||\n                                        lastLocation.kind === 144 ||\n                                        lastLocation.kind === 143\n                                    : false;\n                            }\n                            if (meaning & 107455 && result.flags & 1) {\n                                useResult =\n                                    lastLocation.kind === 144 ||\n                                        (lastLocation === location.type &&\n                                            result.valueDeclaration.kind === 144);\n                            }\n                        }\n                        if (useResult) {\n                            break loop;\n                        }\n                        else {\n                            result = undefined;\n                        }\n                    }\n                }\n                switch (location.kind) {\n                    case 261:\n                        if (!ts.isExternalOrCommonJsModule(location))\n                            break;\n                        isInExternalModule = true;\n                    case 230:\n                        var moduleExports = getSymbolOfNode(location).exports;\n                        if (location.kind === 261 || ts.isAmbientModule(location)) {\n                            if (result = moduleExports[\"default\"]) {\n                                var localSymbol = ts.getLocalSymbolForExportDefault(result);\n                                if (localSymbol && (result.flags & meaning) && localSymbol.name === name) {\n                                    break loop;\n                                }\n                                result = undefined;\n                            }\n                            if (moduleExports[name] &&\n                                moduleExports[name].flags === 8388608 &&\n                                ts.getDeclarationOfKind(moduleExports[name], 243)) {\n                                break;\n                            }\n                        }\n                        if (result = getSymbol(moduleExports, name, meaning & 8914931)) {\n                            break loop;\n                        }\n                        break;\n                    case 229:\n                        if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) {\n                            break loop;\n                        }\n                        break;\n                    case 147:\n                    case 146:\n                        if (ts.isClassLike(location.parent) && !(ts.getModifierFlags(location) & 32)) {\n                            var ctor = findConstructorDeclaration(location.parent);\n                            if (ctor && ctor.locals) {\n                                if (getSymbol(ctor.locals, name, meaning & 107455)) {\n                                    propertyWithInvalidInitializer = location;\n                                }\n                            }\n                        }\n                        break;\n                    case 226:\n                    case 197:\n                    case 227:\n                        if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064)) {\n                            if (lastLocation && ts.getModifierFlags(lastLocation) & 32) {\n                                error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters);\n                                return undefined;\n                            }\n                            break loop;\n                        }\n                        if (location.kind === 197 && meaning & 32) {\n                            var className = location.name;\n                            if (className && name === className.text) {\n                                result = location.symbol;\n                                break loop;\n                            }\n                        }\n                        break;\n                    case 142:\n                        grandparent = location.parent.parent;\n                        if (ts.isClassLike(grandparent) || grandparent.kind === 227) {\n                            if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064)) {\n                                error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);\n                                return undefined;\n                            }\n                        }\n                        break;\n                    case 149:\n                    case 148:\n                    case 150:\n                    case 151:\n                    case 152:\n                    case 225:\n                    case 185:\n                        if (meaning & 3 && name === \"arguments\") {\n                            result = argumentsSymbol;\n                            break loop;\n                        }\n                        break;\n                    case 184:\n                        if (meaning & 3 && name === \"arguments\") {\n                            result = argumentsSymbol;\n                            break loop;\n                        }\n                        if (meaning & 16) {\n                            var functionName = location.name;\n                            if (functionName && name === functionName.text) {\n                                result = location.symbol;\n                                break loop;\n                            }\n                        }\n                        break;\n                    case 145:\n                        if (location.parent && location.parent.kind === 144) {\n                            location = location.parent;\n                        }\n                        if (location.parent && ts.isClassElement(location.parent)) {\n                            location = location.parent;\n                        }\n                        break;\n                }\n                lastLocation = location;\n                location = location.parent;\n            }\n            if (result && nameNotFoundMessage && noUnusedIdentifiers) {\n                result.isReferenced = true;\n            }\n            if (!result) {\n                result = getSymbol(globals, name, meaning);\n            }\n            if (!result) {\n                if (nameNotFoundMessage) {\n                    if (!errorLocation ||\n                        !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&\n                            !checkAndReportErrorForExtendingInterface(errorLocation) &&\n                            !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&\n                            !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) {\n                        error(errorLocation, nameNotFoundMessage, typeof nameArg === \"string\" ? nameArg : ts.declarationNameToString(nameArg));\n                    }\n                }\n                return undefined;\n            }\n            if (nameNotFoundMessage) {\n                if (propertyWithInvalidInitializer) {\n                    var propertyName = propertyWithInvalidInitializer.name;\n                    error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), typeof nameArg === \"string\" ? nameArg : ts.declarationNameToString(nameArg));\n                    return undefined;\n                }\n                if (meaning & 2) {\n                    var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);\n                    if (exportOrLocalSymbol.flags & 2) {\n                        checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);\n                    }\n                }\n                if (result && isInExternalModule && (meaning & 107455) === 107455) {\n                    var decls = result.declarations;\n                    if (decls && decls.length === 1 && decls[0].kind === 233) {\n                        error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name);\n                    }\n                }\n            }\n            return result;\n        }\n        function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) {\n            if ((errorLocation.kind === 70 && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) {\n                return false;\n            }\n            var container = ts.getThisContainer(errorLocation, true);\n            var location = container;\n            while (location) {\n                if (ts.isClassLike(location.parent)) {\n                    var classSymbol = getSymbolOfNode(location.parent);\n                    if (!classSymbol) {\n                        break;\n                    }\n                    var constructorType = getTypeOfSymbol(classSymbol);\n                    if (getPropertyOfType(constructorType, name)) {\n                        error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, typeof nameArg === \"string\" ? nameArg : ts.declarationNameToString(nameArg), symbolToString(classSymbol));\n                        return true;\n                    }\n                    if (location === container && !(ts.getModifierFlags(location) & 32)) {\n                        var instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType;\n                        if (getPropertyOfType(instanceType, name)) {\n                            error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, typeof nameArg === \"string\" ? nameArg : ts.declarationNameToString(nameArg));\n                            return true;\n                        }\n                    }\n                }\n                location = location.parent;\n            }\n            return false;\n        }\n        function checkAndReportErrorForExtendingInterface(errorLocation) {\n            var expression = getEntityNameForExtendingInterface(errorLocation);\n            var isError = !!(expression && resolveEntityName(expression, 64, true));\n            if (isError) {\n                error(errorLocation, ts.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements, ts.getTextOfNode(expression));\n            }\n            return isError;\n        }\n        function getEntityNameForExtendingInterface(node) {\n            switch (node.kind) {\n                case 70:\n                case 177:\n                    return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined;\n                case 199:\n                    ts.Debug.assert(ts.isEntityNameExpression(node.expression));\n                    return node.expression;\n                default:\n                    return undefined;\n            }\n        }\n        function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) {\n            if (meaning === 1920) {\n                var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined));\n                if (symbol) {\n                    error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, name);\n                    return true;\n                }\n            }\n            return false;\n        }\n        function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {\n            if (meaning & (107455 & ~1024)) {\n                var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined));\n                if (symbol && !(symbol.flags & 1024)) {\n                    error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, name);\n                    return true;\n                }\n            }\n            return false;\n        }\n        function checkResolvedBlockScopedVariable(result, errorLocation) {\n            ts.Debug.assert((result.flags & 2) !== 0);\n            var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; });\n            ts.Debug.assert(declaration !== undefined, \"Block-scoped variable declaration is undefined\");\n            if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 223), errorLocation)) {\n                error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name));\n            }\n        }\n        function isSameScopeDescendentOf(initial, parent, stopAt) {\n            if (!parent) {\n                return false;\n            }\n            for (var current = initial; current && current !== stopAt && !ts.isFunctionLike(current); current = current.parent) {\n                if (current === parent) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function getAnyImportSyntax(node) {\n            if (ts.isAliasSymbolDeclaration(node)) {\n                if (node.kind === 234) {\n                    return node;\n                }\n                while (node && node.kind !== 235) {\n                    node = node.parent;\n                }\n                return node;\n            }\n        }\n        function getDeclarationOfAliasSymbol(symbol) {\n            return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; });\n        }\n        function getTargetOfImportEqualsDeclaration(node) {\n            if (node.moduleReference.kind === 245) {\n                return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node)));\n            }\n            return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference);\n        }\n        function getTargetOfImportClause(node) {\n            var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);\n            if (moduleSymbol) {\n                var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ?\n                    moduleSymbol :\n                    moduleSymbol.exports[\"export=\"] ?\n                        getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports[\"export=\"]), \"default\") :\n                        resolveSymbol(moduleSymbol.exports[\"default\"]);\n                if (!exportDefaultSymbol && !allowSyntheticDefaultImports) {\n                    error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));\n                }\n                else if (!exportDefaultSymbol && allowSyntheticDefaultImports) {\n                    return resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol);\n                }\n                return exportDefaultSymbol;\n            }\n        }\n        function getTargetOfNamespaceImport(node) {\n            var moduleSpecifier = node.parent.parent.moduleSpecifier;\n            return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier);\n        }\n        function combineValueAndTypeSymbols(valueSymbol, typeSymbol) {\n            if (valueSymbol.flags & (793064 | 1920)) {\n                return valueSymbol;\n            }\n            var result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.name);\n            result.declarations = ts.concatenate(valueSymbol.declarations, typeSymbol.declarations);\n            result.parent = valueSymbol.parent || typeSymbol.parent;\n            if (valueSymbol.valueDeclaration)\n                result.valueDeclaration = valueSymbol.valueDeclaration;\n            if (typeSymbol.members)\n                result.members = typeSymbol.members;\n            if (valueSymbol.exports)\n                result.exports = valueSymbol.exports;\n            return result;\n        }\n        function getExportOfModule(symbol, name) {\n            if (symbol.flags & 1536) {\n                var exportedSymbol = getExportsOfSymbol(symbol)[name];\n                if (exportedSymbol) {\n                    return resolveSymbol(exportedSymbol);\n                }\n            }\n        }\n        function getPropertyOfVariable(symbol, name) {\n            if (symbol.flags & 3) {\n                var typeAnnotation = symbol.valueDeclaration.type;\n                if (typeAnnotation) {\n                    return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name));\n                }\n            }\n        }\n        function getExternalModuleMember(node, specifier) {\n            var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);\n            var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier);\n            if (targetSymbol) {\n                var name_18 = specifier.propertyName || specifier.name;\n                if (name_18.text) {\n                    if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {\n                        return moduleSymbol;\n                    }\n                    var symbolFromVariable = void 0;\n                    if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports[\"export=\"]) {\n                        symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_18.text);\n                    }\n                    else {\n                        symbolFromVariable = getPropertyOfVariable(targetSymbol, name_18.text);\n                    }\n                    symbolFromVariable = resolveSymbol(symbolFromVariable);\n                    var symbolFromModule = getExportOfModule(targetSymbol, name_18.text);\n                    if (!symbolFromModule && allowSyntheticDefaultImports && name_18.text === \"default\") {\n                        symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol);\n                    }\n                    var symbol = symbolFromModule && symbolFromVariable ?\n                        combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :\n                        symbolFromModule || symbolFromVariable;\n                    if (!symbol) {\n                        error(name_18, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_18));\n                    }\n                    return symbol;\n                }\n            }\n        }\n        function getTargetOfImportSpecifier(node) {\n            return getExternalModuleMember(node.parent.parent.parent, node);\n        }\n        function getTargetOfNamespaceExportDeclaration(node) {\n            return resolveExternalModuleSymbol(node.parent.symbol);\n        }\n        function getTargetOfExportSpecifier(node) {\n            return node.parent.parent.moduleSpecifier ?\n                getExternalModuleMember(node.parent.parent, node) :\n                resolveEntityName(node.propertyName || node.name, 107455 | 793064 | 1920);\n        }\n        function getTargetOfExportAssignment(node) {\n            return resolveEntityName(node.expression, 107455 | 793064 | 1920);\n        }\n        function getTargetOfAliasDeclaration(node) {\n            switch (node.kind) {\n                case 234:\n                    return getTargetOfImportEqualsDeclaration(node);\n                case 236:\n                    return getTargetOfImportClause(node);\n                case 237:\n                    return getTargetOfNamespaceImport(node);\n                case 239:\n                    return getTargetOfImportSpecifier(node);\n                case 243:\n                    return getTargetOfExportSpecifier(node);\n                case 240:\n                    return getTargetOfExportAssignment(node);\n                case 233:\n                    return getTargetOfNamespaceExportDeclaration(node);\n            }\n        }\n        function resolveSymbol(symbol) {\n            return symbol && symbol.flags & 8388608 && !(symbol.flags & (107455 | 793064 | 1920)) ? resolveAlias(symbol) : symbol;\n        }\n        function resolveAlias(symbol) {\n            ts.Debug.assert((symbol.flags & 8388608) !== 0, \"Should only get Alias here.\");\n            var links = getSymbolLinks(symbol);\n            if (!links.target) {\n                links.target = resolvingSymbol;\n                var node = getDeclarationOfAliasSymbol(symbol);\n                ts.Debug.assert(!!node);\n                var target = getTargetOfAliasDeclaration(node);\n                if (links.target === resolvingSymbol) {\n                    links.target = target || unknownSymbol;\n                }\n                else {\n                    error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));\n                }\n            }\n            else if (links.target === resolvingSymbol) {\n                links.target = unknownSymbol;\n            }\n            return links.target;\n        }\n        function markExportAsReferenced(node) {\n            var symbol = getSymbolOfNode(node);\n            var target = resolveAlias(symbol);\n            if (target) {\n                var markAlias = target === unknownSymbol ||\n                    ((target.flags & 107455) && !isConstEnumOrConstEnumOnlyModule(target));\n                if (markAlias) {\n                    markAliasSymbolAsReferenced(symbol);\n                }\n            }\n        }\n        function markAliasSymbolAsReferenced(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.referenced) {\n                links.referenced = true;\n                var node = getDeclarationOfAliasSymbol(symbol);\n                ts.Debug.assert(!!node);\n                if (node.kind === 240) {\n                    checkExpressionCached(node.expression);\n                }\n                else if (node.kind === 243) {\n                    checkExpressionCached(node.propertyName || node.name);\n                }\n                else if (ts.isInternalModuleImportEqualsDeclaration(node)) {\n                    checkExpressionCached(node.moduleReference);\n                }\n            }\n        }\n        function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) {\n            if (entityName.kind === 70 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {\n                entityName = entityName.parent;\n            }\n            if (entityName.kind === 70 || entityName.parent.kind === 141) {\n                return resolveEntityName(entityName, 1920, false, dontResolveAlias);\n            }\n            else {\n                ts.Debug.assert(entityName.parent.kind === 234);\n                return resolveEntityName(entityName, 107455 | 793064 | 1920, false, dontResolveAlias);\n            }\n        }\n        function getFullyQualifiedName(symbol) {\n            return symbol.parent ? getFullyQualifiedName(symbol.parent) + \".\" + symbolToString(symbol) : symbolToString(symbol);\n        }\n        function resolveEntityName(name, meaning, ignoreErrors, dontResolveAlias, location) {\n            if (ts.nodeIsMissing(name)) {\n                return undefined;\n            }\n            var symbol;\n            if (name.kind === 70) {\n                var message = meaning === 1920 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0;\n                symbol = resolveName(location || name, name.text, meaning, ignoreErrors ? undefined : message, name);\n                if (!symbol) {\n                    return undefined;\n                }\n            }\n            else if (name.kind === 141 || name.kind === 177) {\n                var left = name.kind === 141 ? name.left : name.expression;\n                var right = name.kind === 141 ? name.right : name.name;\n                var namespace = resolveEntityName(left, 1920, ignoreErrors, false, location);\n                if (!namespace || ts.nodeIsMissing(right)) {\n                    return undefined;\n                }\n                else if (namespace === unknownSymbol) {\n                    return namespace;\n                }\n                symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning);\n                if (!symbol) {\n                    if (!ignoreErrors) {\n                        error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right));\n                    }\n                    return undefined;\n                }\n            }\n            else {\n                ts.Debug.fail(\"Unknown entity name kind.\");\n            }\n            ts.Debug.assert((symbol.flags & 16777216) === 0, \"Should never get an instantiated symbol here.\");\n            return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol);\n        }\n        function resolveExternalModuleName(location, moduleReferenceExpression) {\n            return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ts.Diagnostics.Cannot_find_module_0);\n        }\n        function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation) {\n            if (isForAugmentation === void 0) { isForAugmentation = false; }\n            if (moduleReferenceExpression.kind !== 9) {\n                return;\n            }\n            var moduleReferenceLiteral = moduleReferenceExpression;\n            return resolveExternalModule(location, moduleReferenceLiteral.text, moduleNotFoundError, moduleReferenceLiteral, isForAugmentation);\n        }\n        function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {\n            if (isForAugmentation === void 0) { isForAugmentation = false; }\n            var moduleName = ts.escapeIdentifier(moduleReference);\n            if (moduleName === undefined) {\n                return;\n            }\n            var ambientModule = tryFindAmbientModule(moduleName, true);\n            if (ambientModule) {\n                return ambientModule;\n            }\n            var isRelative = ts.isExternalModuleNameRelative(moduleName);\n            var resolvedModule = ts.getResolvedModule(ts.getSourceFileOfNode(location), moduleReference);\n            var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);\n            var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);\n            if (sourceFile) {\n                if (sourceFile.symbol) {\n                    return getMergedSymbol(sourceFile.symbol);\n                }\n                if (moduleNotFoundError) {\n                    error(errorNode, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName);\n                }\n                return undefined;\n            }\n            if (patternAmbientModules) {\n                var pattern = ts.findBestPatternMatch(patternAmbientModules, function (_) { return _.pattern; }, moduleName);\n                if (pattern) {\n                    return getMergedSymbol(pattern.symbol);\n                }\n            }\n            if (!isRelative && resolvedModule && !ts.extensionIsTypeScript(resolvedModule.extension)) {\n                if (isForAugmentation) {\n                    ts.Debug.assert(!!moduleNotFoundError);\n                    var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;\n                    error(errorNode, diag, moduleName, resolvedModule.resolvedFileName);\n                }\n                else if (compilerOptions.noImplicitAny && moduleNotFoundError) {\n                    error(errorNode, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedModule.resolvedFileName);\n                }\n                return undefined;\n            }\n            if (moduleNotFoundError) {\n                if (resolutionDiagnostic) {\n                    error(errorNode, resolutionDiagnostic, moduleName, resolvedModule.resolvedFileName);\n                }\n                else {\n                    var tsExtension = ts.tryExtractTypeScriptExtension(moduleName);\n                    if (tsExtension) {\n                        var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;\n                        error(errorNode, diag, tsExtension, ts.removeExtension(moduleName, tsExtension));\n                    }\n                    else {\n                        error(errorNode, moduleNotFoundError, moduleName);\n                    }\n                }\n            }\n            return undefined;\n        }\n        function resolveExternalModuleSymbol(moduleSymbol) {\n            return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports[\"export=\"])) || moduleSymbol;\n        }\n        function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) {\n            var symbol = resolveExternalModuleSymbol(moduleSymbol);\n            if (symbol && !(symbol.flags & (1536 | 3))) {\n                error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol));\n                symbol = undefined;\n            }\n            return symbol;\n        }\n        function hasExportAssignmentSymbol(moduleSymbol) {\n            return moduleSymbol.exports[\"export=\"] !== undefined;\n        }\n        function getExportsOfModuleAsArray(moduleSymbol) {\n            return symbolsToArray(getExportsOfModule(moduleSymbol));\n        }\n        function tryGetMemberInModuleExports(memberName, moduleSymbol) {\n            var symbolTable = getExportsOfModule(moduleSymbol);\n            if (symbolTable) {\n                return symbolTable[memberName];\n            }\n        }\n        function getExportsOfSymbol(symbol) {\n            return symbol.flags & 1536 ? getExportsOfModule(symbol) : symbol.exports || emptySymbols;\n        }\n        function getExportsOfModule(moduleSymbol) {\n            var links = getSymbolLinks(moduleSymbol);\n            return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol));\n        }\n        function extendExportSymbols(target, source, lookupTable, exportNode) {\n            for (var id in source) {\n                if (id !== \"default\" && !target[id]) {\n                    target[id] = source[id];\n                    if (lookupTable && exportNode) {\n                        lookupTable[id] = {\n                            specifierText: ts.getTextOfNode(exportNode.moduleSpecifier)\n                        };\n                    }\n                }\n                else if (lookupTable && exportNode && id !== \"default\" && target[id] && resolveSymbol(target[id]) !== resolveSymbol(source[id])) {\n                    if (!lookupTable[id].exportsWithDuplicate) {\n                        lookupTable[id].exportsWithDuplicate = [exportNode];\n                    }\n                    else {\n                        lookupTable[id].exportsWithDuplicate.push(exportNode);\n                    }\n                }\n            }\n        }\n        function getExportsForModule(moduleSymbol) {\n            var visitedSymbols = [];\n            moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);\n            return visit(moduleSymbol) || moduleSymbol.exports;\n            function visit(symbol) {\n                if (!(symbol && symbol.flags & 1952 && !ts.contains(visitedSymbols, symbol))) {\n                    return;\n                }\n                visitedSymbols.push(symbol);\n                var symbols = ts.cloneMap(symbol.exports);\n                var exportStars = symbol.exports[\"__export\"];\n                if (exportStars) {\n                    var nestedSymbols = ts.createMap();\n                    var lookupTable = ts.createMap();\n                    for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) {\n                        var node = _a[_i];\n                        var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);\n                        var exportedSymbols = visit(resolvedModule);\n                        extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node);\n                    }\n                    for (var id in lookupTable) {\n                        var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate;\n                        if (id === \"export=\" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols[id]) {\n                            continue;\n                        }\n                        for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) {\n                            var node = exportsWithDuplicate_1[_b];\n                            diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id));\n                        }\n                    }\n                    extendExportSymbols(symbols, nestedSymbols);\n                }\n                return symbols;\n            }\n        }\n        function getMergedSymbol(symbol) {\n            var merged;\n            return symbol && symbol.mergeId && (merged = mergedSymbols[symbol.mergeId]) ? merged : symbol;\n        }\n        function getSymbolOfNode(node) {\n            return getMergedSymbol(node.symbol);\n        }\n        function getParentOfSymbol(symbol) {\n            return getMergedSymbol(symbol.parent);\n        }\n        function getExportSymbolOfValueSymbolIfExported(symbol) {\n            return symbol && (symbol.flags & 1048576) !== 0\n                ? getMergedSymbol(symbol.exportSymbol)\n                : symbol;\n        }\n        function symbolIsValue(symbol) {\n            if (symbol.flags & 16777216) {\n                return symbolIsValue(getSymbolLinks(symbol).target);\n            }\n            if (symbol.flags & 107455) {\n                return true;\n            }\n            if (symbol.flags & 8388608) {\n                return (resolveAlias(symbol).flags & 107455) !== 0;\n            }\n            return false;\n        }\n        function findConstructorDeclaration(node) {\n            var members = node.members;\n            for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {\n                var member = members_1[_i];\n                if (member.kind === 150 && ts.nodeIsPresent(member.body)) {\n                    return member;\n                }\n            }\n        }\n        function createType(flags) {\n            var result = new Type(checker, flags);\n            typeCount++;\n            result.id = typeCount;\n            return result;\n        }\n        function createIntrinsicType(kind, intrinsicName) {\n            var type = createType(kind);\n            type.intrinsicName = intrinsicName;\n            return type;\n        }\n        function createBooleanType(trueFalseTypes) {\n            var type = getUnionType(trueFalseTypes);\n            type.flags |= 8;\n            type.intrinsicName = \"boolean\";\n            return type;\n        }\n        function createObjectType(objectFlags, symbol) {\n            var type = createType(32768);\n            type.objectFlags = objectFlags;\n            type.symbol = symbol;\n            return type;\n        }\n        function isReservedMemberName(name) {\n            return name.charCodeAt(0) === 95 &&\n                name.charCodeAt(1) === 95 &&\n                name.charCodeAt(2) !== 95 &&\n                name.charCodeAt(2) !== 64;\n        }\n        function getNamedMembers(members) {\n            var result;\n            for (var id in members) {\n                if (!isReservedMemberName(id)) {\n                    if (!result)\n                        result = [];\n                    var symbol = members[id];\n                    if (symbolIsValue(symbol)) {\n                        result.push(symbol);\n                    }\n                }\n            }\n            return result || emptyArray;\n        }\n        function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) {\n            type.members = members;\n            type.properties = getNamedMembers(members);\n            type.callSignatures = callSignatures;\n            type.constructSignatures = constructSignatures;\n            if (stringIndexInfo)\n                type.stringIndexInfo = stringIndexInfo;\n            if (numberIndexInfo)\n                type.numberIndexInfo = numberIndexInfo;\n            return type;\n        }\n        function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) {\n            return setStructuredTypeMembers(createObjectType(16, symbol), members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n        }\n        function forEachSymbolTableInScope(enclosingDeclaration, callback) {\n            var result;\n            for (var location_1 = enclosingDeclaration; location_1; location_1 = location_1.parent) {\n                if (location_1.locals && !isGlobalSourceFile(location_1)) {\n                    if (result = callback(location_1.locals)) {\n                        return result;\n                    }\n                }\n                switch (location_1.kind) {\n                    case 261:\n                        if (!ts.isExternalOrCommonJsModule(location_1)) {\n                            break;\n                        }\n                    case 230:\n                        if (result = callback(getSymbolOfNode(location_1).exports)) {\n                            return result;\n                        }\n                        break;\n                }\n            }\n            return callback(globals);\n        }\n        function getQualifiedLeftMeaning(rightMeaning) {\n            return rightMeaning === 107455 ? 107455 : 1920;\n        }\n        function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) {\n            function getAccessibleSymbolChainFromSymbolTable(symbols) {\n                function canQualifySymbol(symbolFromSymbolTable, meaning) {\n                    if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) {\n                        return true;\n                    }\n                    var accessibleParent = getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning), useOnlyExternalAliasing);\n                    return !!accessibleParent;\n                }\n                function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) {\n                    if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) {\n                        return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) &&\n                            canQualifySymbol(symbolFromSymbolTable, meaning);\n                    }\n                }\n                if (isAccessible(symbols[symbol.name])) {\n                    return [symbol];\n                }\n                return ts.forEachProperty(symbols, function (symbolFromSymbolTable) {\n                    if (symbolFromSymbolTable.flags & 8388608\n                        && symbolFromSymbolTable.name !== \"export=\"\n                        && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) {\n                        if (!useOnlyExternalAliasing ||\n                            ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) {\n                            var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);\n                            if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) {\n                                return [symbolFromSymbolTable];\n                            }\n                            var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined;\n                            if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) {\n                                return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports);\n                            }\n                        }\n                    }\n                });\n            }\n            if (symbol) {\n                if (!(isPropertyOrMethodDeclarationSymbol(symbol))) {\n                    return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable);\n                }\n            }\n        }\n        function needsQualification(symbol, enclosingDeclaration, meaning) {\n            var qualify = false;\n            forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) {\n                var symbolFromSymbolTable = symbolTable[symbol.name];\n                if (!symbolFromSymbolTable) {\n                    return false;\n                }\n                if (symbolFromSymbolTable === symbol) {\n                    return true;\n                }\n                symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;\n                if (symbolFromSymbolTable.flags & meaning) {\n                    qualify = true;\n                    return true;\n                }\n                return false;\n            });\n            return qualify;\n        }\n        function isPropertyOrMethodDeclarationSymbol(symbol) {\n            if (symbol.declarations && symbol.declarations.length) {\n                for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                    var declaration = _a[_i];\n                    switch (declaration.kind) {\n                        case 147:\n                        case 149:\n                        case 151:\n                        case 152:\n                            continue;\n                        default:\n                            return false;\n                    }\n                }\n                return true;\n            }\n            return false;\n        }\n        function isSymbolAccessible(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible) {\n            if (symbol && enclosingDeclaration && !(symbol.flags & 262144)) {\n                var initialSymbol = symbol;\n                var meaningToLook = meaning;\n                while (symbol) {\n                    var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, false);\n                    if (accessibleSymbolChain) {\n                        var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0], shouldComputeAliasesToMakeVisible);\n                        if (!hasAccessibleDeclarations) {\n                            return {\n                                accessibility: 1,\n                                errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),\n                                errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, 1920) : undefined,\n                            };\n                        }\n                        return hasAccessibleDeclarations;\n                    }\n                    meaningToLook = getQualifiedLeftMeaning(meaning);\n                    symbol = getParentOfSymbol(symbol);\n                }\n                var symbolExternalModule = ts.forEach(initialSymbol.declarations, getExternalModuleContainer);\n                if (symbolExternalModule) {\n                    var enclosingExternalModule = getExternalModuleContainer(enclosingDeclaration);\n                    if (symbolExternalModule !== enclosingExternalModule) {\n                        return {\n                            accessibility: 2,\n                            errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),\n                            errorModuleName: symbolToString(symbolExternalModule)\n                        };\n                    }\n                }\n                return {\n                    accessibility: 1,\n                    errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),\n                };\n            }\n            return { accessibility: 0 };\n            function getExternalModuleContainer(declaration) {\n                for (; declaration; declaration = declaration.parent) {\n                    if (hasExternalModuleSymbol(declaration)) {\n                        return getSymbolOfNode(declaration);\n                    }\n                }\n            }\n        }\n        function hasExternalModuleSymbol(declaration) {\n            return ts.isAmbientModule(declaration) || (declaration.kind === 261 && ts.isExternalOrCommonJsModule(declaration));\n        }\n        function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {\n            var aliasesToMakeVisible;\n            if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) {\n                return undefined;\n            }\n            return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible };\n            function getIsDeclarationVisible(declaration) {\n                if (!isDeclarationVisible(declaration)) {\n                    var anyImportSyntax = getAnyImportSyntax(declaration);\n                    if (anyImportSyntax &&\n                        !(ts.getModifierFlags(anyImportSyntax) & 1) &&\n                        isDeclarationVisible(anyImportSyntax.parent)) {\n                        if (shouldComputeAliasToMakeVisible) {\n                            getNodeLinks(declaration).isVisible = true;\n                            if (aliasesToMakeVisible) {\n                                if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) {\n                                    aliasesToMakeVisible.push(anyImportSyntax);\n                                }\n                            }\n                            else {\n                                aliasesToMakeVisible = [anyImportSyntax];\n                            }\n                        }\n                        return true;\n                    }\n                    return false;\n                }\n                return true;\n            }\n        }\n        function isEntityNameVisible(entityName, enclosingDeclaration) {\n            var meaning;\n            if (entityName.parent.kind === 160 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {\n                meaning = 107455 | 1048576;\n            }\n            else if (entityName.kind === 141 || entityName.kind === 177 ||\n                entityName.parent.kind === 234) {\n                meaning = 1920;\n            }\n            else {\n                meaning = 793064;\n            }\n            var firstIdentifier = getFirstIdentifier(entityName);\n            var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, undefined, undefined);\n            return (symbol && hasVisibleDeclarations(symbol, true)) || {\n                accessibility: 1,\n                errorSymbolName: ts.getTextOfNode(firstIdentifier),\n                errorNode: firstIdentifier\n            };\n        }\n        function writeKeyword(writer, kind) {\n            writer.writeKeyword(ts.tokenToString(kind));\n        }\n        function writePunctuation(writer, kind) {\n            writer.writePunctuation(ts.tokenToString(kind));\n        }\n        function writeSpace(writer) {\n            writer.writeSpace(\" \");\n        }\n        function symbolToString(symbol, enclosingDeclaration, meaning) {\n            var writer = ts.getSingleLineStringWriter();\n            getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning);\n            var result = writer.string();\n            ts.releaseStringWriter(writer);\n            return result;\n        }\n        function signatureToString(signature, enclosingDeclaration, flags, kind) {\n            var writer = ts.getSingleLineStringWriter();\n            getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind);\n            var result = writer.string();\n            ts.releaseStringWriter(writer);\n            return result;\n        }\n        function typeToString(type, enclosingDeclaration, flags) {\n            var writer = ts.getSingleLineStringWriter();\n            getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);\n            var result = writer.string();\n            ts.releaseStringWriter(writer);\n            var maxLength = compilerOptions.noErrorTruncation || flags & 4 ? undefined : 100;\n            if (maxLength && result.length >= maxLength) {\n                result = result.substr(0, maxLength - \"...\".length) + \"...\";\n            }\n            return result;\n        }\n        function typePredicateToString(typePredicate, enclosingDeclaration, flags) {\n            var writer = ts.getSingleLineStringWriter();\n            getSymbolDisplayBuilder().buildTypePredicateDisplay(typePredicate, writer, enclosingDeclaration, flags);\n            var result = writer.string();\n            ts.releaseStringWriter(writer);\n            return result;\n        }\n        function formatUnionTypes(types) {\n            var result = [];\n            var flags = 0;\n            for (var i = 0; i < types.length; i++) {\n                var t = types[i];\n                flags |= t.flags;\n                if (!(t.flags & 6144)) {\n                    if (t.flags & (128 | 256)) {\n                        var baseType = t.flags & 128 ? booleanType : t.baseType;\n                        var count = baseType.types.length;\n                        if (i + count <= types.length && types[i + count - 1] === baseType.types[count - 1]) {\n                            result.push(baseType);\n                            i += count - 1;\n                            continue;\n                        }\n                    }\n                    result.push(t);\n                }\n            }\n            if (flags & 4096)\n                result.push(nullType);\n            if (flags & 2048)\n                result.push(undefinedType);\n            return result || types;\n        }\n        function visibilityToString(flags) {\n            if (flags === 8) {\n                return \"private\";\n            }\n            if (flags === 16) {\n                return \"protected\";\n            }\n            return \"public\";\n        }\n        function getTypeAliasForTypeLiteral(type) {\n            if (type.symbol && type.symbol.flags & 2048) {\n                var node = type.symbol.declarations[0].parent;\n                while (node.kind === 166) {\n                    node = node.parent;\n                }\n                if (node.kind === 228) {\n                    return getSymbolOfNode(node);\n                }\n            }\n            return undefined;\n        }\n        function isTopLevelInExternalModuleAugmentation(node) {\n            return node && node.parent &&\n                node.parent.kind === 231 &&\n                ts.isExternalModuleAugmentation(node.parent.parent);\n        }\n        function literalTypeToString(type) {\n            return type.flags & 32 ? \"\\\"\" + ts.escapeString(type.text) + \"\\\"\" : type.text;\n        }\n        function getSymbolDisplayBuilder() {\n            function getNameOfSymbol(symbol) {\n                if (symbol.declarations && symbol.declarations.length) {\n                    var declaration = symbol.declarations[0];\n                    if (declaration.name) {\n                        return ts.declarationNameToString(declaration.name);\n                    }\n                    switch (declaration.kind) {\n                        case 197:\n                            return \"(Anonymous class)\";\n                        case 184:\n                        case 185:\n                            return \"(Anonymous function)\";\n                    }\n                }\n                return symbol.name;\n            }\n            function appendSymbolNameOnly(symbol, writer) {\n                writer.writeSymbol(getNameOfSymbol(symbol), symbol);\n            }\n            function appendPropertyOrElementAccessForSymbol(symbol, writer) {\n                var symbolName = getNameOfSymbol(symbol);\n                var firstChar = symbolName.charCodeAt(0);\n                var needsElementAccess = !ts.isIdentifierStart(firstChar, languageVersion);\n                if (needsElementAccess) {\n                    writePunctuation(writer, 20);\n                    if (ts.isSingleOrDoubleQuote(firstChar)) {\n                        writer.writeStringLiteral(symbolName);\n                    }\n                    else {\n                        writer.writeSymbol(symbolName, symbol);\n                    }\n                    writePunctuation(writer, 21);\n                }\n                else {\n                    writePunctuation(writer, 22);\n                    writer.writeSymbol(symbolName, symbol);\n                }\n            }\n            function buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags, typeFlags) {\n                var parentSymbol;\n                function appendParentTypeArgumentsAndSymbolName(symbol) {\n                    if (parentSymbol) {\n                        if (flags & 1) {\n                            if (symbol.flags & 16777216) {\n                                buildDisplayForTypeArgumentsAndDelimiters(getTypeParametersOfClassOrInterface(parentSymbol), symbol.mapper, writer, enclosingDeclaration);\n                            }\n                            else {\n                                buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration);\n                            }\n                        }\n                        appendPropertyOrElementAccessForSymbol(symbol, writer);\n                    }\n                    else {\n                        appendSymbolNameOnly(symbol, writer);\n                    }\n                    parentSymbol = symbol;\n                }\n                writer.trackSymbol(symbol, enclosingDeclaration, meaning);\n                function walkSymbol(symbol, meaning, endOfChain) {\n                    var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2));\n                    if (!accessibleSymbolChain ||\n                        needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) {\n                        var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);\n                        if (parent_5) {\n                            walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), false);\n                        }\n                    }\n                    if (accessibleSymbolChain) {\n                        for (var _i = 0, accessibleSymbolChain_1 = accessibleSymbolChain; _i < accessibleSymbolChain_1.length; _i++) {\n                            var accessibleSymbol = accessibleSymbolChain_1[_i];\n                            appendParentTypeArgumentsAndSymbolName(accessibleSymbol);\n                        }\n                    }\n                    else if (endOfChain ||\n                        !(!parentSymbol && ts.forEach(symbol.declarations, hasExternalModuleSymbol)) &&\n                            !(symbol.flags & (2048 | 4096))) {\n                        appendParentTypeArgumentsAndSymbolName(symbol);\n                    }\n                }\n                var isTypeParameter = symbol.flags & 262144;\n                var typeFormatFlag = 128 & typeFlags;\n                if (!isTypeParameter && (enclosingDeclaration || typeFormatFlag)) {\n                    walkSymbol(symbol, meaning, true);\n                }\n                else {\n                    appendParentTypeArgumentsAndSymbolName(symbol);\n                }\n            }\n            function buildTypeDisplay(type, writer, enclosingDeclaration, globalFlags, symbolStack) {\n                var globalFlagsToPass = globalFlags & 16;\n                var inObjectTypeLiteral = false;\n                return writeType(type, globalFlags);\n                function writeType(type, flags) {\n                    var nextFlags = flags & ~512;\n                    if (type.flags & 16015) {\n                        writer.writeKeyword(!(globalFlags & 16) && isTypeAny(type)\n                            ? \"any\"\n                            : type.intrinsicName);\n                    }\n                    else if (type.flags & 16384 && type.isThisType) {\n                        if (inObjectTypeLiteral) {\n                            writer.reportInaccessibleThisError();\n                        }\n                        writer.writeKeyword(\"this\");\n                    }\n                    else if (getObjectFlags(type) & 4) {\n                        writeTypeReference(type, nextFlags);\n                    }\n                    else if (type.flags & 256) {\n                        buildSymbolDisplay(getParentOfSymbol(type.symbol), writer, enclosingDeclaration, 793064, 0, nextFlags);\n                        writePunctuation(writer, 22);\n                        appendSymbolNameOnly(type.symbol, writer);\n                    }\n                    else if (getObjectFlags(type) & 3 || type.flags & (16 | 16384)) {\n                        buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793064, 0, nextFlags);\n                    }\n                    else if (!(flags & 512) && type.aliasSymbol &&\n                        isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, 793064, false).accessibility === 0) {\n                        var typeArguments = type.aliasTypeArguments;\n                        writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);\n                    }\n                    else if (type.flags & 196608) {\n                        writeUnionOrIntersectionType(type, nextFlags);\n                    }\n                    else if (getObjectFlags(type) & (16 | 32)) {\n                        writeAnonymousType(type, nextFlags);\n                    }\n                    else if (type.flags & 96) {\n                        writer.writeStringLiteral(literalTypeToString(type));\n                    }\n                    else if (type.flags & 262144) {\n                        writer.writeKeyword(\"keyof\");\n                        writeSpace(writer);\n                        writeType(type.type, 64);\n                    }\n                    else if (type.flags & 524288) {\n                        writeType(type.objectType, 64);\n                        writePunctuation(writer, 20);\n                        writeType(type.indexType, 0);\n                        writePunctuation(writer, 21);\n                    }\n                    else {\n                        writePunctuation(writer, 16);\n                        writeSpace(writer);\n                        writePunctuation(writer, 23);\n                        writeSpace(writer);\n                        writePunctuation(writer, 17);\n                    }\n                }\n                function writeTypeList(types, delimiter) {\n                    for (var i = 0; i < types.length; i++) {\n                        if (i > 0) {\n                            if (delimiter !== 25) {\n                                writeSpace(writer);\n                            }\n                            writePunctuation(writer, delimiter);\n                            writeSpace(writer);\n                        }\n                        writeType(types[i], delimiter === 25 ? 0 : 64);\n                    }\n                }\n                function writeSymbolTypeReference(symbol, typeArguments, pos, end, flags) {\n                    if (symbol.flags & 32 || !isReservedMemberName(symbol.name)) {\n                        buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793064, 0, flags);\n                    }\n                    if (pos < end) {\n                        writePunctuation(writer, 26);\n                        writeType(typeArguments[pos], 256);\n                        pos++;\n                        while (pos < end) {\n                            writePunctuation(writer, 25);\n                            writeSpace(writer);\n                            writeType(typeArguments[pos], 0);\n                            pos++;\n                        }\n                        writePunctuation(writer, 28);\n                    }\n                }\n                function writeTypeReference(type, flags) {\n                    var typeArguments = type.typeArguments || emptyArray;\n                    if (type.target === globalArrayType && !(flags & 1)) {\n                        writeType(typeArguments[0], 64);\n                        writePunctuation(writer, 20);\n                        writePunctuation(writer, 21);\n                    }\n                    else if (type.target.objectFlags & 8) {\n                        writePunctuation(writer, 20);\n                        writeTypeList(type.typeArguments.slice(0, getTypeReferenceArity(type)), 25);\n                        writePunctuation(writer, 21);\n                    }\n                    else {\n                        var outerTypeParameters = type.target.outerTypeParameters;\n                        var i = 0;\n                        if (outerTypeParameters) {\n                            var length_1 = outerTypeParameters.length;\n                            while (i < length_1) {\n                                var start = i;\n                                var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]);\n                                do {\n                                    i++;\n                                } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6);\n                                if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) {\n                                    writeSymbolTypeReference(parent_6, typeArguments, start, i, flags);\n                                    writePunctuation(writer, 22);\n                                }\n                            }\n                        }\n                        var typeParameterCount = (type.target.typeParameters || emptyArray).length;\n                        writeSymbolTypeReference(type.symbol, typeArguments, i, typeParameterCount, flags);\n                    }\n                }\n                function writeUnionOrIntersectionType(type, flags) {\n                    if (flags & 64) {\n                        writePunctuation(writer, 18);\n                    }\n                    if (type.flags & 65536) {\n                        writeTypeList(formatUnionTypes(type.types), 48);\n                    }\n                    else {\n                        writeTypeList(type.types, 47);\n                    }\n                    if (flags & 64) {\n                        writePunctuation(writer, 19);\n                    }\n                }\n                function writeAnonymousType(type, flags) {\n                    var symbol = type.symbol;\n                    if (symbol) {\n                        if (symbol.flags & (32 | 384 | 512)) {\n                            writeTypeOfSymbol(type, flags);\n                        }\n                        else if (shouldWriteTypeOfFunctionSymbol()) {\n                            writeTypeOfSymbol(type, flags);\n                        }\n                        else if (ts.contains(symbolStack, symbol)) {\n                            var typeAlias = getTypeAliasForTypeLiteral(type);\n                            if (typeAlias) {\n                                buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 793064, 0, flags);\n                            }\n                            else {\n                                writeKeyword(writer, 118);\n                            }\n                        }\n                        else {\n                            if (!symbolStack) {\n                                symbolStack = [];\n                            }\n                            symbolStack.push(symbol);\n                            writeLiteralType(type, flags);\n                            symbolStack.pop();\n                        }\n                    }\n                    else {\n                        writeLiteralType(type, flags);\n                    }\n                    function shouldWriteTypeOfFunctionSymbol() {\n                        var isStaticMethodSymbol = !!(symbol.flags & 8192 &&\n                            ts.forEach(symbol.declarations, function (declaration) { return ts.getModifierFlags(declaration) & 32; }));\n                        var isNonLocalFunctionSymbol = !!(symbol.flags & 16) &&\n                            (symbol.parent ||\n                                ts.forEach(symbol.declarations, function (declaration) {\n                                    return declaration.parent.kind === 261 || declaration.parent.kind === 231;\n                                }));\n                        if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {\n                            return !!(flags & 2) ||\n                                (ts.contains(symbolStack, symbol));\n                        }\n                    }\n                }\n                function writeTypeOfSymbol(type, typeFormatFlags) {\n                    writeKeyword(writer, 102);\n                    writeSpace(writer);\n                    buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags);\n                }\n                function writeIndexSignature(info, keyword) {\n                    if (info) {\n                        if (info.isReadonly) {\n                            writeKeyword(writer, 130);\n                            writeSpace(writer);\n                        }\n                        writePunctuation(writer, 20);\n                        writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : \"x\");\n                        writePunctuation(writer, 55);\n                        writeSpace(writer);\n                        writeKeyword(writer, keyword);\n                        writePunctuation(writer, 21);\n                        writePunctuation(writer, 55);\n                        writeSpace(writer);\n                        writeType(info.type, 0);\n                        writePunctuation(writer, 24);\n                        writer.writeLine();\n                    }\n                }\n                function writePropertyWithModifiers(prop) {\n                    if (isReadonlySymbol(prop)) {\n                        writeKeyword(writer, 130);\n                        writeSpace(writer);\n                    }\n                    buildSymbolDisplay(prop, writer);\n                    if (prop.flags & 536870912) {\n                        writePunctuation(writer, 54);\n                    }\n                }\n                function shouldAddParenthesisAroundFunctionType(callSignature, flags) {\n                    if (flags & 64) {\n                        return true;\n                    }\n                    else if (flags & 256) {\n                        var typeParameters = callSignature.target && (flags & 32) ?\n                            callSignature.target.typeParameters : callSignature.typeParameters;\n                        return typeParameters && typeParameters.length !== 0;\n                    }\n                    return false;\n                }\n                function writeLiteralType(type, flags) {\n                    if (type.objectFlags & 32) {\n                        if (getConstraintTypeFromMappedType(type).flags & (16384 | 262144)) {\n                            writeMappedType(type);\n                            return;\n                        }\n                    }\n                    var resolved = resolveStructuredTypeMembers(type);\n                    if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {\n                        if (!resolved.callSignatures.length && !resolved.constructSignatures.length) {\n                            writePunctuation(writer, 16);\n                            writePunctuation(writer, 17);\n                            return;\n                        }\n                        if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) {\n                            var parenthesizeSignature = shouldAddParenthesisAroundFunctionType(resolved.callSignatures[0], flags);\n                            if (parenthesizeSignature) {\n                                writePunctuation(writer, 18);\n                            }\n                            buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, undefined, symbolStack);\n                            if (parenthesizeSignature) {\n                                writePunctuation(writer, 19);\n                            }\n                            return;\n                        }\n                        if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) {\n                            if (flags & 64) {\n                                writePunctuation(writer, 18);\n                            }\n                            writeKeyword(writer, 93);\n                            writeSpace(writer);\n                            buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, undefined, symbolStack);\n                            if (flags & 64) {\n                                writePunctuation(writer, 19);\n                            }\n                            return;\n                        }\n                    }\n                    var saveInObjectTypeLiteral = inObjectTypeLiteral;\n                    inObjectTypeLiteral = true;\n                    writePunctuation(writer, 16);\n                    writer.writeLine();\n                    writer.increaseIndent();\n                    writeObjectLiteralType(resolved);\n                    writer.decreaseIndent();\n                    writePunctuation(writer, 17);\n                    inObjectTypeLiteral = saveInObjectTypeLiteral;\n                }\n                function writeObjectLiteralType(resolved) {\n                    for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) {\n                        var signature = _a[_i];\n                        buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, undefined, symbolStack);\n                        writePunctuation(writer, 24);\n                        writer.writeLine();\n                    }\n                    for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) {\n                        var signature = _c[_b];\n                        buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, 1, symbolStack);\n                        writePunctuation(writer, 24);\n                        writer.writeLine();\n                    }\n                    writeIndexSignature(resolved.stringIndexInfo, 134);\n                    writeIndexSignature(resolved.numberIndexInfo, 132);\n                    for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) {\n                        var p = _e[_d];\n                        var t = getTypeOfSymbol(p);\n                        if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) {\n                            var signatures = getSignaturesOfType(t, 0);\n                            for (var _f = 0, signatures_1 = signatures; _f < signatures_1.length; _f++) {\n                                var signature = signatures_1[_f];\n                                writePropertyWithModifiers(p);\n                                buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, undefined, symbolStack);\n                                writePunctuation(writer, 24);\n                                writer.writeLine();\n                            }\n                        }\n                        else {\n                            writePropertyWithModifiers(p);\n                            writePunctuation(writer, 55);\n                            writeSpace(writer);\n                            writeType(t, 0);\n                            writePunctuation(writer, 24);\n                            writer.writeLine();\n                        }\n                    }\n                }\n                function writeMappedType(type) {\n                    writePunctuation(writer, 16);\n                    writer.writeLine();\n                    writer.increaseIndent();\n                    if (type.declaration.readonlyToken) {\n                        writeKeyword(writer, 130);\n                        writeSpace(writer);\n                    }\n                    writePunctuation(writer, 20);\n                    appendSymbolNameOnly(getTypeParameterFromMappedType(type).symbol, writer);\n                    writeSpace(writer);\n                    writeKeyword(writer, 91);\n                    writeSpace(writer);\n                    writeType(getConstraintTypeFromMappedType(type), 0);\n                    writePunctuation(writer, 21);\n                    if (type.declaration.questionToken) {\n                        writePunctuation(writer, 54);\n                    }\n                    writePunctuation(writer, 55);\n                    writeSpace(writer);\n                    writeType(getTemplateTypeFromMappedType(type), 0);\n                    writePunctuation(writer, 24);\n                    writer.writeLine();\n                    writer.decreaseIndent();\n                    writePunctuation(writer, 17);\n                }\n            }\n            function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration, flags) {\n                var targetSymbol = getTargetSymbol(symbol);\n                if (targetSymbol.flags & 32 || targetSymbol.flags & 64 || targetSymbol.flags & 524288) {\n                    buildDisplayForTypeParametersAndDelimiters(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol), writer, enclosingDeclaration, flags);\n                }\n            }\n            function buildTypeParameterDisplay(tp, writer, enclosingDeclaration, flags, symbolStack) {\n                appendSymbolNameOnly(tp.symbol, writer);\n                var constraint = getConstraintOfTypeParameter(tp);\n                if (constraint) {\n                    writeSpace(writer);\n                    writeKeyword(writer, 84);\n                    writeSpace(writer);\n                    buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack);\n                }\n            }\n            function buildParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack) {\n                var parameterNode = p.valueDeclaration;\n                if (ts.isRestParameter(parameterNode)) {\n                    writePunctuation(writer, 23);\n                }\n                if (ts.isBindingPattern(parameterNode.name)) {\n                    buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack);\n                }\n                else {\n                    appendSymbolNameOnly(p, writer);\n                }\n                if (isOptionalParameter(parameterNode)) {\n                    writePunctuation(writer, 54);\n                }\n                writePunctuation(writer, 55);\n                writeSpace(writer);\n                buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack);\n            }\n            function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) {\n                if (bindingPattern.kind === 172) {\n                    writePunctuation(writer, 16);\n                    buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); });\n                    writePunctuation(writer, 17);\n                }\n                else if (bindingPattern.kind === 173) {\n                    writePunctuation(writer, 20);\n                    var elements = bindingPattern.elements;\n                    buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); });\n                    if (elements && elements.hasTrailingComma) {\n                        writePunctuation(writer, 25);\n                    }\n                    writePunctuation(writer, 21);\n                }\n            }\n            function buildBindingElementDisplay(bindingElement, writer, enclosingDeclaration, flags, symbolStack) {\n                if (ts.isOmittedExpression(bindingElement)) {\n                    return;\n                }\n                ts.Debug.assert(bindingElement.kind === 174);\n                if (bindingElement.propertyName) {\n                    writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol);\n                    writePunctuation(writer, 55);\n                    writeSpace(writer);\n                }\n                if (ts.isBindingPattern(bindingElement.name)) {\n                    buildBindingPatternDisplay(bindingElement.name, writer, enclosingDeclaration, flags, symbolStack);\n                }\n                else {\n                    if (bindingElement.dotDotDotToken) {\n                        writePunctuation(writer, 23);\n                    }\n                    appendSymbolNameOnly(bindingElement.symbol, writer);\n                }\n            }\n            function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) {\n                if (typeParameters && typeParameters.length) {\n                    writePunctuation(writer, 26);\n                    buildDisplayForCommaSeparatedList(typeParameters, writer, function (p) { return buildTypeParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack); });\n                    writePunctuation(writer, 28);\n                }\n            }\n            function buildDisplayForCommaSeparatedList(list, writer, action) {\n                for (var i = 0; i < list.length; i++) {\n                    if (i > 0) {\n                        writePunctuation(writer, 25);\n                        writeSpace(writer);\n                    }\n                    action(list[i]);\n                }\n            }\n            function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration) {\n                if (typeParameters && typeParameters.length) {\n                    writePunctuation(writer, 26);\n                    var flags = 256;\n                    for (var i = 0; i < typeParameters.length; i++) {\n                        if (i > 0) {\n                            writePunctuation(writer, 25);\n                            writeSpace(writer);\n                            flags = 0;\n                        }\n                        buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, flags);\n                    }\n                    writePunctuation(writer, 28);\n                }\n            }\n            function buildDisplayForParametersAndDelimiters(thisParameter, parameters, writer, enclosingDeclaration, flags, symbolStack) {\n                writePunctuation(writer, 18);\n                if (thisParameter) {\n                    buildParameterDisplay(thisParameter, writer, enclosingDeclaration, flags, symbolStack);\n                }\n                for (var i = 0; i < parameters.length; i++) {\n                    if (i > 0 || thisParameter) {\n                        writePunctuation(writer, 25);\n                        writeSpace(writer);\n                    }\n                    buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, symbolStack);\n                }\n                writePunctuation(writer, 19);\n            }\n            function buildTypePredicateDisplay(predicate, writer, enclosingDeclaration, flags, symbolStack) {\n                if (ts.isIdentifierTypePredicate(predicate)) {\n                    writer.writeParameter(predicate.parameterName);\n                }\n                else {\n                    writeKeyword(writer, 98);\n                }\n                writeSpace(writer);\n                writeKeyword(writer, 125);\n                writeSpace(writer);\n                buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack);\n            }\n            function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) {\n                if (flags & 8) {\n                    writeSpace(writer);\n                    writePunctuation(writer, 35);\n                }\n                else {\n                    writePunctuation(writer, 55);\n                }\n                writeSpace(writer);\n                if (signature.typePredicate) {\n                    buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack);\n                }\n                else {\n                    var returnType = getReturnTypeOfSignature(signature);\n                    buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack);\n                }\n            }\n            function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind, symbolStack) {\n                if (kind === 1) {\n                    writeKeyword(writer, 93);\n                    writeSpace(writer);\n                }\n                if (signature.target && (flags & 32)) {\n                    buildDisplayForTypeArgumentsAndDelimiters(signature.target.typeParameters, signature.mapper, writer, enclosingDeclaration);\n                }\n                else {\n                    buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, symbolStack);\n                }\n                buildDisplayForParametersAndDelimiters(signature.thisParameter, signature.parameters, writer, enclosingDeclaration, flags, symbolStack);\n                buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack);\n            }\n            return _displayBuilder || (_displayBuilder = {\n                buildSymbolDisplay: buildSymbolDisplay,\n                buildTypeDisplay: buildTypeDisplay,\n                buildTypeParameterDisplay: buildTypeParameterDisplay,\n                buildTypePredicateDisplay: buildTypePredicateDisplay,\n                buildParameterDisplay: buildParameterDisplay,\n                buildDisplayForParametersAndDelimiters: buildDisplayForParametersAndDelimiters,\n                buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters,\n                buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol,\n                buildSignatureDisplay: buildSignatureDisplay,\n                buildReturnTypeDisplay: buildReturnTypeDisplay\n            });\n        }\n        function isDeclarationVisible(node) {\n            if (node) {\n                var links = getNodeLinks(node);\n                if (links.isVisible === undefined) {\n                    links.isVisible = !!determineIfDeclarationIsVisible();\n                }\n                return links.isVisible;\n            }\n            return false;\n            function determineIfDeclarationIsVisible() {\n                switch (node.kind) {\n                    case 174:\n                        return isDeclarationVisible(node.parent.parent);\n                    case 223:\n                        if (ts.isBindingPattern(node.name) &&\n                            !node.name.elements.length) {\n                            return false;\n                        }\n                    case 230:\n                    case 226:\n                    case 227:\n                    case 228:\n                    case 225:\n                    case 229:\n                    case 234:\n                        if (ts.isExternalModuleAugmentation(node)) {\n                            return true;\n                        }\n                        var parent_7 = getDeclarationContainer(node);\n                        if (!(ts.getCombinedModifierFlags(node) & 1) &&\n                            !(node.kind !== 234 && parent_7.kind !== 261 && ts.isInAmbientContext(parent_7))) {\n                            return isGlobalSourceFile(parent_7);\n                        }\n                        return isDeclarationVisible(parent_7);\n                    case 147:\n                    case 146:\n                    case 151:\n                    case 152:\n                    case 149:\n                    case 148:\n                        if (ts.getModifierFlags(node) & (8 | 16)) {\n                            return false;\n                        }\n                    case 150:\n                    case 154:\n                    case 153:\n                    case 155:\n                    case 144:\n                    case 231:\n                    case 158:\n                    case 159:\n                    case 161:\n                    case 157:\n                    case 162:\n                    case 163:\n                    case 164:\n                    case 165:\n                    case 166:\n                        return isDeclarationVisible(node.parent);\n                    case 236:\n                    case 237:\n                    case 239:\n                        return false;\n                    case 143:\n                    case 261:\n                    case 233:\n                        return true;\n                    case 240:\n                        return false;\n                    default:\n                        return false;\n                }\n            }\n        }\n        function collectLinkedAliases(node) {\n            var exportSymbol;\n            if (node.parent && node.parent.kind === 240) {\n                exportSymbol = resolveName(node.parent, node.text, 107455 | 793064 | 1920 | 8388608, ts.Diagnostics.Cannot_find_name_0, node);\n            }\n            else if (node.parent.kind === 243) {\n                var exportSpecifier = node.parent;\n                exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ?\n                    getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) :\n                    resolveEntityName(exportSpecifier.propertyName || exportSpecifier.name, 107455 | 793064 | 1920 | 8388608);\n            }\n            var result = [];\n            if (exportSymbol) {\n                buildVisibleNodeList(exportSymbol.declarations);\n            }\n            return result;\n            function buildVisibleNodeList(declarations) {\n                ts.forEach(declarations, function (declaration) {\n                    getNodeLinks(declaration).isVisible = true;\n                    var resultNode = getAnyImportSyntax(declaration) || declaration;\n                    if (!ts.contains(result, resultNode)) {\n                        result.push(resultNode);\n                    }\n                    if (ts.isInternalModuleImportEqualsDeclaration(declaration)) {\n                        var internalModuleReference = declaration.moduleReference;\n                        var firstIdentifier = getFirstIdentifier(internalModuleReference);\n                        var importSymbol = resolveName(declaration, firstIdentifier.text, 107455 | 793064 | 1920, undefined, undefined);\n                        if (importSymbol) {\n                            buildVisibleNodeList(importSymbol.declarations);\n                        }\n                    }\n                });\n            }\n        }\n        function pushTypeResolution(target, propertyName) {\n            var resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName);\n            if (resolutionCycleStartIndex >= 0) {\n                var length_2 = resolutionTargets.length;\n                for (var i = resolutionCycleStartIndex; i < length_2; i++) {\n                    resolutionResults[i] = false;\n                }\n                return false;\n            }\n            resolutionTargets.push(target);\n            resolutionResults.push(true);\n            resolutionPropertyNames.push(propertyName);\n            return true;\n        }\n        function findResolutionCycleStartIndex(target, propertyName) {\n            for (var i = resolutionTargets.length - 1; i >= 0; i--) {\n                if (hasType(resolutionTargets[i], resolutionPropertyNames[i])) {\n                    return -1;\n                }\n                if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {\n                    return i;\n                }\n            }\n            return -1;\n        }\n        function hasType(target, propertyName) {\n            if (propertyName === 0) {\n                return getSymbolLinks(target).type;\n            }\n            if (propertyName === 2) {\n                return getSymbolLinks(target).declaredType;\n            }\n            if (propertyName === 1) {\n                return target.resolvedBaseConstructorType;\n            }\n            if (propertyName === 3) {\n                return target.resolvedReturnType;\n            }\n            ts.Debug.fail(\"Unhandled TypeSystemPropertyName \" + propertyName);\n        }\n        function popTypeResolution() {\n            resolutionTargets.pop();\n            resolutionPropertyNames.pop();\n            return resolutionResults.pop();\n        }\n        function getDeclarationContainer(node) {\n            node = ts.getRootDeclaration(node);\n            while (node) {\n                switch (node.kind) {\n                    case 223:\n                    case 224:\n                    case 239:\n                    case 238:\n                    case 237:\n                    case 236:\n                        node = node.parent;\n                        break;\n                    default:\n                        return node.parent;\n                }\n            }\n        }\n        function getTypeOfPrototypeProperty(prototype) {\n            var classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype));\n            return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType;\n        }\n        function getTypeOfPropertyOfType(type, name) {\n            var prop = getPropertyOfType(type, name);\n            return prop ? getTypeOfSymbol(prop) : undefined;\n        }\n        function isTypeAny(type) {\n            return type && (type.flags & 1) !== 0;\n        }\n        function isTypeNever(type) {\n            return type && (type.flags & 8192) !== 0;\n        }\n        function getTypeForBindingElementParent(node) {\n            var symbol = getSymbolOfNode(node);\n            return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false);\n        }\n        function isComputedNonLiteralName(name) {\n            return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression);\n        }\n        function getRestType(source, properties, symbol) {\n            source = filterType(source, function (t) { return !(t.flags & 6144); });\n            if (source.flags & 8192) {\n                return emptyObjectType;\n            }\n            if (source.flags & 65536) {\n                return mapType(source, function (t) { return getRestType(t, properties, symbol); });\n            }\n            var members = ts.createMap();\n            var names = ts.createMap();\n            for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) {\n                var name_19 = properties_2[_i];\n                names[ts.getTextOfPropertyName(name_19)] = true;\n            }\n            for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {\n                var prop = _b[_a];\n                var inNamesToRemove = prop.name in names;\n                var isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16);\n                var isMethod = prop.flags & 8192;\n                var isSetOnlyAccessor = prop.flags & 65536 && !(prop.flags & 32768);\n                if (!inNamesToRemove && !isPrivate && !isMethod && !isSetOnlyAccessor) {\n                    members[prop.name] = prop;\n                }\n            }\n            var stringIndexInfo = getIndexInfoOfType(source, 0);\n            var numberIndexInfo = getIndexInfoOfType(source, 1);\n            return createAnonymousType(symbol, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);\n        }\n        function getTypeForBindingElement(declaration) {\n            var pattern = declaration.parent;\n            var parentType = getTypeForBindingElementParent(pattern.parent);\n            if (parentType === unknownType) {\n                return unknownType;\n            }\n            if (!parentType || isTypeAny(parentType)) {\n                if (declaration.initializer) {\n                    return checkDeclarationInitializer(declaration);\n                }\n                return parentType;\n            }\n            var type;\n            if (pattern.kind === 172) {\n                if (declaration.dotDotDotToken) {\n                    if (!isValidSpreadType(parentType)) {\n                        error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types);\n                        return unknownType;\n                    }\n                    var literalMembers = [];\n                    for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {\n                        var element = _a[_i];\n                        if (!element.dotDotDotToken) {\n                            literalMembers.push(element.propertyName || element.name);\n                        }\n                    }\n                    type = getRestType(parentType, literalMembers, declaration.symbol);\n                }\n                else {\n                    var name_20 = declaration.propertyName || declaration.name;\n                    if (isComputedNonLiteralName(name_20)) {\n                        return anyType;\n                    }\n                    if (declaration.initializer) {\n                        getContextualType(declaration.initializer);\n                    }\n                    var text = ts.getTextOfPropertyName(name_20);\n                    type = getTypeOfPropertyOfType(parentType, text) ||\n                        isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) ||\n                        getIndexTypeOfType(parentType, 0);\n                    if (!type) {\n                        error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_20));\n                        return unknownType;\n                    }\n                }\n            }\n            else {\n                var elementType = checkIteratedTypeOrElementType(parentType, pattern, false);\n                if (declaration.dotDotDotToken) {\n                    type = createArrayType(elementType);\n                }\n                else {\n                    var propName = \"\" + ts.indexOf(pattern.elements, declaration);\n                    type = isTupleLikeType(parentType)\n                        ? getTypeOfPropertyOfType(parentType, propName)\n                        : elementType;\n                    if (!type) {\n                        if (isTupleType(parentType)) {\n                            error(declaration, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), getTypeReferenceArity(parentType), pattern.elements.length);\n                        }\n                        else {\n                            error(declaration, ts.Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName);\n                        }\n                        return unknownType;\n                    }\n                }\n            }\n            if (strictNullChecks && declaration.initializer && !(getFalsyFlags(checkExpressionCached(declaration.initializer)) & 2048)) {\n                type = getTypeWithFacts(type, 131072);\n            }\n            return declaration.initializer ?\n                getUnionType([type, checkExpressionCached(declaration.initializer)], true) :\n                type;\n        }\n        function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) {\n            var jsdocType = ts.getJSDocType(declaration);\n            if (jsdocType) {\n                return getTypeFromTypeNode(jsdocType);\n            }\n            return undefined;\n        }\n        function isNullOrUndefined(node) {\n            var expr = ts.skipParentheses(node);\n            return expr.kind === 94 || expr.kind === 70 && getResolvedSymbol(expr) === undefinedSymbol;\n        }\n        function isEmptyArrayLiteral(node) {\n            var expr = ts.skipParentheses(node);\n            return expr.kind === 175 && expr.elements.length === 0;\n        }\n        function addOptionality(type, optional) {\n            return strictNullChecks && optional ? includeFalsyTypes(type, 2048) : type;\n        }\n        function getTypeForVariableLikeDeclaration(declaration, includeOptionality) {\n            if (declaration.flags & 65536) {\n                var type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration);\n                if (type && type !== unknownType) {\n                    return type;\n                }\n            }\n            if (declaration.parent.parent.kind === 212) {\n                var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression));\n                return indexType.flags & (16384 | 262144) ? indexType : stringType;\n            }\n            if (declaration.parent.parent.kind === 213) {\n                return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType;\n            }\n            if (ts.isBindingPattern(declaration.parent)) {\n                return getTypeForBindingElement(declaration);\n            }\n            if (declaration.type) {\n                return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality);\n            }\n            if ((compilerOptions.noImplicitAny || declaration.flags & 65536) &&\n                declaration.kind === 223 && !ts.isBindingPattern(declaration.name) &&\n                !(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) {\n                if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) {\n                    return autoType;\n                }\n                if (declaration.initializer && isEmptyArrayLiteral(declaration.initializer)) {\n                    return autoArrayType;\n                }\n            }\n            if (declaration.kind === 144) {\n                var func = declaration.parent;\n                if (func.kind === 152 && !ts.hasDynamicName(func)) {\n                    var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 151);\n                    if (getter) {\n                        var getterSignature = getSignatureFromDeclaration(getter);\n                        var thisParameter = getAccessorThisParameter(func);\n                        if (thisParameter && declaration === thisParameter) {\n                            ts.Debug.assert(!thisParameter.type);\n                            return getTypeOfSymbol(getterSignature.thisParameter);\n                        }\n                        return getReturnTypeOfSignature(getterSignature);\n                    }\n                }\n                var type = void 0;\n                if (declaration.symbol.name === \"this\") {\n                    type = getContextualThisParameterType(func);\n                }\n                else {\n                    type = getContextuallyTypedParameterType(declaration);\n                }\n                if (type) {\n                    return addOptionality(type, declaration.questionToken && includeOptionality);\n                }\n            }\n            if (declaration.initializer) {\n                var type = checkDeclarationInitializer(declaration);\n                return addOptionality(type, declaration.questionToken && includeOptionality);\n            }\n            if (declaration.kind === 258) {\n                return checkIdentifier(declaration.name);\n            }\n            if (ts.isBindingPattern(declaration.name)) {\n                return getTypeFromBindingPattern(declaration.name, false, true);\n            }\n            return undefined;\n        }\n        function getTypeFromBindingElement(element, includePatternInType, reportErrors) {\n            if (element.initializer) {\n                return checkDeclarationInitializer(element);\n            }\n            if (ts.isBindingPattern(element.name)) {\n                return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors);\n            }\n            if (reportErrors && compilerOptions.noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) {\n                reportImplicitAnyError(element, anyType);\n            }\n            return anyType;\n        }\n        function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {\n            var members = ts.createMap();\n            var stringIndexInfo;\n            var hasComputedProperties = false;\n            ts.forEach(pattern.elements, function (e) {\n                var name = e.propertyName || e.name;\n                if (isComputedNonLiteralName(name)) {\n                    hasComputedProperties = true;\n                    return;\n                }\n                if (e.dotDotDotToken) {\n                    stringIndexInfo = createIndexInfo(anyType, false);\n                    return;\n                }\n                var text = ts.getTextOfPropertyName(name);\n                var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0);\n                var symbol = createSymbol(flags, text);\n                symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors);\n                symbol.bindingElement = e;\n                members[symbol.name] = symbol;\n            });\n            var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined);\n            if (includePatternInType) {\n                result.pattern = pattern;\n            }\n            if (hasComputedProperties) {\n                result.objectFlags |= 512;\n            }\n            return result;\n        }\n        function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) {\n            var elements = pattern.elements;\n            var lastElement = ts.lastOrUndefined(elements);\n            if (elements.length === 0 || (!ts.isOmittedExpression(lastElement) && lastElement.dotDotDotToken)) {\n                return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType;\n            }\n            var elementTypes = ts.map(elements, function (e) { return ts.isOmittedExpression(e) ? anyType : getTypeFromBindingElement(e, includePatternInType, reportErrors); });\n            var result = createTupleType(elementTypes);\n            if (includePatternInType) {\n                result = cloneTypeReference(result);\n                result.pattern = pattern;\n            }\n            return result;\n        }\n        function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) {\n            return pattern.kind === 172\n                ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors)\n                : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors);\n        }\n        function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) {\n            var type = getTypeForVariableLikeDeclaration(declaration, true);\n            if (type) {\n                if (reportErrors) {\n                    reportErrorsFromWidening(declaration, type);\n                }\n                if (declaration.kind === 257) {\n                    return type;\n                }\n                return getWidenedType(type);\n            }\n            type = declaration.dotDotDotToken ? anyArrayType : anyType;\n            if (reportErrors && compilerOptions.noImplicitAny) {\n                if (!declarationBelongsToPrivateAmbientMember(declaration)) {\n                    reportImplicitAnyError(declaration, type);\n                }\n            }\n            return type;\n        }\n        function declarationBelongsToPrivateAmbientMember(declaration) {\n            var root = ts.getRootDeclaration(declaration);\n            var memberDeclaration = root.kind === 144 ? root.parent : root;\n            return isPrivateWithinAmbient(memberDeclaration);\n        }\n        function getTypeOfVariableOrParameterOrProperty(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                if (symbol.flags & 134217728) {\n                    return links.type = getTypeOfPrototypeProperty(symbol);\n                }\n                var declaration = symbol.valueDeclaration;\n                if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) {\n                    return links.type = anyType;\n                }\n                if (declaration.kind === 240) {\n                    return links.type = checkExpression(declaration.expression);\n                }\n                if (declaration.flags & 65536 && declaration.kind === 286 && declaration.typeExpression) {\n                    return links.type = getTypeFromTypeNode(declaration.typeExpression.type);\n                }\n                if (!pushTypeResolution(symbol, 0)) {\n                    return unknownType;\n                }\n                var type = void 0;\n                if (declaration.kind === 192 ||\n                    declaration.kind === 177 && declaration.parent.kind === 192) {\n                    if (declaration.flags & 65536) {\n                        var jsdocType = ts.getJSDocType(declaration.parent);\n                        if (jsdocType) {\n                            return links.type = getTypeFromTypeNode(jsdocType);\n                        }\n                    }\n                    var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 ?\n                        checkExpressionCached(decl.right) :\n                        checkExpressionCached(decl.parent.right); });\n                    type = getUnionType(declaredTypes, true);\n                }\n                else {\n                    type = getWidenedTypeForVariableLikeDeclaration(declaration, true);\n                }\n                if (!popTypeResolution()) {\n                    if (symbol.valueDeclaration.type) {\n                        type = unknownType;\n                        error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));\n                    }\n                    else {\n                        type = anyType;\n                        if (compilerOptions.noImplicitAny) {\n                            error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));\n                        }\n                    }\n                }\n                links.type = type;\n            }\n            return links.type;\n        }\n        function getAnnotatedAccessorType(accessor) {\n            if (accessor) {\n                if (accessor.kind === 151) {\n                    return accessor.type && getTypeFromTypeNode(accessor.type);\n                }\n                else {\n                    var setterTypeAnnotation = ts.getSetAccessorTypeAnnotationNode(accessor);\n                    return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation);\n                }\n            }\n            return undefined;\n        }\n        function getAnnotatedAccessorThisParameter(accessor) {\n            var parameter = getAccessorThisParameter(accessor);\n            return parameter && parameter.symbol;\n        }\n        function getThisTypeOfDeclaration(declaration) {\n            return getThisTypeOfSignature(getSignatureFromDeclaration(declaration));\n        }\n        function getTypeOfAccessors(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                var getter = ts.getDeclarationOfKind(symbol, 151);\n                var setter = ts.getDeclarationOfKind(symbol, 152);\n                if (getter && getter.flags & 65536) {\n                    var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter);\n                    if (jsDocType) {\n                        return links.type = jsDocType;\n                    }\n                }\n                if (!pushTypeResolution(symbol, 0)) {\n                    return unknownType;\n                }\n                var type = void 0;\n                var getterReturnType = getAnnotatedAccessorType(getter);\n                if (getterReturnType) {\n                    type = getterReturnType;\n                }\n                else {\n                    var setterParameterType = getAnnotatedAccessorType(setter);\n                    if (setterParameterType) {\n                        type = setterParameterType;\n                    }\n                    else {\n                        if (getter && getter.body) {\n                            type = getReturnTypeFromBody(getter);\n                        }\n                        else {\n                            if (compilerOptions.noImplicitAny) {\n                                if (setter) {\n                                    error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));\n                                }\n                                else {\n                                    ts.Debug.assert(!!getter, \"there must existed getter as we are current checking either setter or getter in this function\");\n                                    error(getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol));\n                                }\n                            }\n                            type = anyType;\n                        }\n                    }\n                }\n                if (!popTypeResolution()) {\n                    type = anyType;\n                    if (compilerOptions.noImplicitAny) {\n                        var getter_1 = ts.getDeclarationOfKind(symbol, 151);\n                        error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));\n                    }\n                }\n                links.type = type;\n            }\n            return links.type;\n        }\n        function getTypeOfFuncClassEnumModule(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                if (symbol.flags & 1536 && ts.isShorthandAmbientModuleSymbol(symbol)) {\n                    links.type = anyType;\n                }\n                else {\n                    var type = createObjectType(16, symbol);\n                    links.type = strictNullChecks && symbol.flags & 536870912 ?\n                        includeFalsyTypes(type, 2048) : type;\n                }\n            }\n            return links.type;\n        }\n        function getTypeOfEnumMember(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                links.type = getDeclaredTypeOfEnumMember(symbol);\n            }\n            return links.type;\n        }\n        function getTypeOfAlias(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                var targetSymbol = resolveAlias(symbol);\n                links.type = targetSymbol.flags & 107455\n                    ? getTypeOfSymbol(targetSymbol)\n                    : unknownType;\n            }\n            return links.type;\n        }\n        function getTypeOfInstantiatedSymbol(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper);\n            }\n            return links.type;\n        }\n        function getTypeOfSymbol(symbol) {\n            if (symbol.flags & 16777216) {\n                return getTypeOfInstantiatedSymbol(symbol);\n            }\n            if (symbol.flags & (3 | 4)) {\n                return getTypeOfVariableOrParameterOrProperty(symbol);\n            }\n            if (symbol.flags & (16 | 8192 | 32 | 384 | 512)) {\n                return getTypeOfFuncClassEnumModule(symbol);\n            }\n            if (symbol.flags & 8) {\n                return getTypeOfEnumMember(symbol);\n            }\n            if (symbol.flags & 98304) {\n                return getTypeOfAccessors(symbol);\n            }\n            if (symbol.flags & 8388608) {\n                return getTypeOfAlias(symbol);\n            }\n            return unknownType;\n        }\n        function getTargetType(type) {\n            return getObjectFlags(type) & 4 ? type.target : type;\n        }\n        function hasBaseType(type, checkBase) {\n            return check(type);\n            function check(type) {\n                var target = getTargetType(type);\n                return target === checkBase || ts.forEach(getBaseTypes(target), check);\n            }\n        }\n        function appendTypeParameters(typeParameters, declarations) {\n            for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) {\n                var declaration = declarations_2[_i];\n                var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration));\n                if (!typeParameters) {\n                    typeParameters = [tp];\n                }\n                else if (!ts.contains(typeParameters, tp)) {\n                    typeParameters.push(tp);\n                }\n            }\n            return typeParameters;\n        }\n        function appendOuterTypeParameters(typeParameters, node) {\n            while (true) {\n                node = node.parent;\n                if (!node) {\n                    return typeParameters;\n                }\n                if (node.kind === 226 || node.kind === 197 ||\n                    node.kind === 225 || node.kind === 184 ||\n                    node.kind === 149 || node.kind === 185) {\n                    var declarations = node.typeParameters;\n                    if (declarations) {\n                        return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations);\n                    }\n                }\n            }\n        }\n        function getOuterTypeParametersOfClassOrInterface(symbol) {\n            var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 227);\n            return appendOuterTypeParameters(undefined, declaration);\n        }\n        function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) {\n            var result;\n            for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                var node = _a[_i];\n                if (node.kind === 227 || node.kind === 226 ||\n                    node.kind === 197 || node.kind === 228) {\n                    var declaration = node;\n                    if (declaration.typeParameters) {\n                        result = appendTypeParameters(result, declaration.typeParameters);\n                    }\n                }\n            }\n            return result;\n        }\n        function getTypeParametersOfClassOrInterface(symbol) {\n            return ts.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol));\n        }\n        function isConstructorType(type) {\n            return type.flags & 32768 && getSignaturesOfType(type, 1).length > 0;\n        }\n        function getBaseTypeNodeOfClass(type) {\n            return ts.getClassExtendsHeritageClauseElement(type.symbol.valueDeclaration);\n        }\n        function getConstructorsForTypeArguments(type, typeArgumentNodes) {\n            var typeArgCount = typeArgumentNodes ? typeArgumentNodes.length : 0;\n            return ts.filter(getSignaturesOfType(type, 1), function (sig) { return (sig.typeParameters ? sig.typeParameters.length : 0) === typeArgCount; });\n        }\n        function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes) {\n            var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes);\n            if (typeArgumentNodes) {\n                var typeArguments_1 = ts.map(typeArgumentNodes, getTypeFromTypeNode);\n                signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments_1); });\n            }\n            return signatures;\n        }\n        function getBaseConstructorTypeOfClass(type) {\n            if (!type.resolvedBaseConstructorType) {\n                var baseTypeNode = getBaseTypeNodeOfClass(type);\n                if (!baseTypeNode) {\n                    return type.resolvedBaseConstructorType = undefinedType;\n                }\n                if (!pushTypeResolution(type, 1)) {\n                    return unknownType;\n                }\n                var baseConstructorType = checkExpression(baseTypeNode.expression);\n                if (baseConstructorType.flags & 32768) {\n                    resolveStructuredTypeMembers(baseConstructorType);\n                }\n                if (!popTypeResolution()) {\n                    error(type.symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol));\n                    return type.resolvedBaseConstructorType = unknownType;\n                }\n                if (baseConstructorType !== unknownType && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) {\n                    error(baseTypeNode.expression, ts.Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType));\n                    return type.resolvedBaseConstructorType = unknownType;\n                }\n                type.resolvedBaseConstructorType = baseConstructorType;\n            }\n            return type.resolvedBaseConstructorType;\n        }\n        function getBaseTypes(type) {\n            if (!type.resolvedBaseTypes) {\n                if (type.objectFlags & 8) {\n                    type.resolvedBaseTypes = [createArrayType(getUnionType(type.typeParameters))];\n                }\n                else if (type.symbol.flags & (32 | 64)) {\n                    if (type.symbol.flags & 32) {\n                        resolveBaseTypesOfClass(type);\n                    }\n                    if (type.symbol.flags & 64) {\n                        resolveBaseTypesOfInterface(type);\n                    }\n                }\n                else {\n                    ts.Debug.fail(\"type must be class or interface\");\n                }\n            }\n            return type.resolvedBaseTypes;\n        }\n        function resolveBaseTypesOfClass(type) {\n            type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray;\n            var baseConstructorType = getBaseConstructorTypeOfClass(type);\n            if (!(baseConstructorType.flags & 32768)) {\n                return;\n            }\n            var baseTypeNode = getBaseTypeNodeOfClass(type);\n            var baseType;\n            var originalBaseType = baseConstructorType && baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : undefined;\n            if (baseConstructorType.symbol && baseConstructorType.symbol.flags & 32 &&\n                areAllOuterTypeParametersApplied(originalBaseType)) {\n                baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol);\n            }\n            else {\n                var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments);\n                if (!constructors.length) {\n                    error(baseTypeNode.expression, ts.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments);\n                    return;\n                }\n                baseType = getReturnTypeOfSignature(constructors[0]);\n            }\n            var valueDecl = type.symbol.valueDeclaration;\n            if (valueDecl && ts.isInJavaScriptFile(valueDecl)) {\n                var augTag = ts.getJSDocAugmentsTag(type.symbol.valueDeclaration);\n                if (augTag) {\n                    baseType = getTypeFromTypeNode(augTag.typeExpression.type);\n                }\n            }\n            if (baseType === unknownType) {\n                return;\n            }\n            if (!(getObjectFlags(getTargetType(baseType)) & 3)) {\n                error(baseTypeNode.expression, ts.Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType));\n                return;\n            }\n            if (type === baseType || hasBaseType(baseType, type)) {\n                error(valueDecl, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1));\n                return;\n            }\n            if (type.resolvedBaseTypes === emptyArray) {\n                type.resolvedBaseTypes = [baseType];\n            }\n            else {\n                type.resolvedBaseTypes.push(baseType);\n            }\n        }\n        function areAllOuterTypeParametersApplied(type) {\n            var outerTypeParameters = type.outerTypeParameters;\n            if (outerTypeParameters) {\n                var last = outerTypeParameters.length - 1;\n                var typeArguments = type.typeArguments;\n                return outerTypeParameters[last].symbol !== typeArguments[last].symbol;\n            }\n            return true;\n        }\n        function resolveBaseTypesOfInterface(type) {\n            type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray;\n            for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) {\n                var declaration = _a[_i];\n                if (declaration.kind === 227 && ts.getInterfaceBaseTypeNodes(declaration)) {\n                    for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) {\n                        var node = _c[_b];\n                        var baseType = getTypeFromTypeNode(node);\n                        if (baseType !== unknownType) {\n                            if (getObjectFlags(getTargetType(baseType)) & 3) {\n                                if (type !== baseType && !hasBaseType(baseType, type)) {\n                                    if (type.resolvedBaseTypes === emptyArray) {\n                                        type.resolvedBaseTypes = [baseType];\n                                    }\n                                    else {\n                                        type.resolvedBaseTypes.push(baseType);\n                                    }\n                                }\n                                else {\n                                    error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1));\n                                }\n                            }\n                            else {\n                                error(node, ts.Diagnostics.An_interface_may_only_extend_a_class_or_another_interface);\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        function isIndependentInterface(symbol) {\n            for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                var declaration = _a[_i];\n                if (declaration.kind === 227) {\n                    if (declaration.flags & 64) {\n                        return false;\n                    }\n                    var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration);\n                    if (baseTypeNodes) {\n                        for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) {\n                            var node = baseTypeNodes_1[_b];\n                            if (ts.isEntityNameExpression(node.expression)) {\n                                var baseSymbol = resolveEntityName(node.expression, 793064, true);\n                                if (!baseSymbol || !(baseSymbol.flags & 64) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) {\n                                    return false;\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n            return true;\n        }\n        function getDeclaredTypeOfClassOrInterface(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                var kind = symbol.flags & 32 ? 1 : 2;\n                var type = links.declaredType = createObjectType(kind, symbol);\n                var outerTypeParameters = getOuterTypeParametersOfClassOrInterface(symbol);\n                var localTypeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);\n                if (outerTypeParameters || localTypeParameters || kind === 1 || !isIndependentInterface(symbol)) {\n                    type.objectFlags |= 4;\n                    type.typeParameters = ts.concatenate(outerTypeParameters, localTypeParameters);\n                    type.outerTypeParameters = outerTypeParameters;\n                    type.localTypeParameters = localTypeParameters;\n                    type.instantiations = ts.createMap();\n                    type.instantiations[getTypeListId(type.typeParameters)] = type;\n                    type.target = type;\n                    type.typeArguments = type.typeParameters;\n                    type.thisType = createType(16384);\n                    type.thisType.isThisType = true;\n                    type.thisType.symbol = symbol;\n                    type.thisType.constraint = type;\n                }\n            }\n            return links.declaredType;\n        }\n        function getDeclaredTypeOfTypeAlias(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                if (!pushTypeResolution(symbol, 2)) {\n                    return unknownType;\n                }\n                var declaration = ts.getDeclarationOfKind(symbol, 285);\n                var type = void 0;\n                if (declaration) {\n                    if (declaration.jsDocTypeLiteral) {\n                        type = getTypeFromTypeNode(declaration.jsDocTypeLiteral);\n                    }\n                    else {\n                        type = getTypeFromTypeNode(declaration.typeExpression.type);\n                    }\n                }\n                else {\n                    declaration = ts.getDeclarationOfKind(symbol, 228);\n                    type = getTypeFromTypeNode(declaration.type);\n                }\n                if (popTypeResolution()) {\n                    var typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);\n                    if (typeParameters) {\n                        links.typeParameters = typeParameters;\n                        links.instantiations = ts.createMap();\n                        links.instantiations[getTypeListId(typeParameters)] = type;\n                    }\n                }\n                else {\n                    type = unknownType;\n                    error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));\n                }\n                links.declaredType = type;\n            }\n            return links.declaredType;\n        }\n        function isLiteralEnumMember(symbol, member) {\n            var expr = member.initializer;\n            if (!expr) {\n                return !ts.isInAmbientContext(member);\n            }\n            return expr.kind === 8 ||\n                expr.kind === 190 && expr.operator === 37 &&\n                    expr.operand.kind === 8 ||\n                expr.kind === 70 && !!symbol.exports[expr.text];\n        }\n        function enumHasLiteralMembers(symbol) {\n            for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                var declaration = _a[_i];\n                if (declaration.kind === 229) {\n                    for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {\n                        var member = _c[_b];\n                        if (!isLiteralEnumMember(symbol, member)) {\n                            return false;\n                        }\n                    }\n                }\n            }\n            return true;\n        }\n        function createEnumLiteralType(symbol, baseType, text) {\n            var type = createType(256);\n            type.symbol = symbol;\n            type.baseType = baseType;\n            type.text = text;\n            return type;\n        }\n        function getDeclaredTypeOfEnum(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                var enumType = links.declaredType = createType(16);\n                enumType.symbol = symbol;\n                if (enumHasLiteralMembers(symbol)) {\n                    var memberTypeList = [];\n                    var memberTypes = ts.createMap();\n                    for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) {\n                        var declaration = _a[_i];\n                        if (declaration.kind === 229) {\n                            computeEnumMemberValues(declaration);\n                            for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {\n                                var member = _c[_b];\n                                var memberSymbol = getSymbolOfNode(member);\n                                var value = getEnumMemberValue(member);\n                                if (!memberTypes[value]) {\n                                    var memberType = memberTypes[value] = createEnumLiteralType(memberSymbol, enumType, \"\" + value);\n                                    memberTypeList.push(memberType);\n                                }\n                            }\n                        }\n                    }\n                    enumType.memberTypes = memberTypes;\n                    if (memberTypeList.length > 1) {\n                        enumType.flags |= 65536;\n                        enumType.types = memberTypeList;\n                        unionTypes[getTypeListId(memberTypeList)] = enumType;\n                    }\n                }\n            }\n            return links.declaredType;\n        }\n        function getDeclaredTypeOfEnumMember(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                var enumType = getDeclaredTypeOfEnum(getParentOfSymbol(symbol));\n                links.declaredType = enumType.flags & 65536 ?\n                    enumType.memberTypes[getEnumMemberValue(symbol.valueDeclaration)] :\n                    enumType;\n            }\n            return links.declaredType;\n        }\n        function getDeclaredTypeOfTypeParameter(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                var type = createType(16384);\n                type.symbol = symbol;\n                if (!ts.getDeclarationOfKind(symbol, 143).constraint) {\n                    type.constraint = noConstraintType;\n                }\n                links.declaredType = type;\n            }\n            return links.declaredType;\n        }\n        function getDeclaredTypeOfAlias(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                links.declaredType = getDeclaredTypeOfSymbol(resolveAlias(symbol));\n            }\n            return links.declaredType;\n        }\n        function getDeclaredTypeOfSymbol(symbol) {\n            ts.Debug.assert((symbol.flags & 16777216) === 0);\n            if (symbol.flags & (32 | 64)) {\n                return getDeclaredTypeOfClassOrInterface(symbol);\n            }\n            if (symbol.flags & 524288) {\n                return getDeclaredTypeOfTypeAlias(symbol);\n            }\n            if (symbol.flags & 262144) {\n                return getDeclaredTypeOfTypeParameter(symbol);\n            }\n            if (symbol.flags & 384) {\n                return getDeclaredTypeOfEnum(symbol);\n            }\n            if (symbol.flags & 8) {\n                return getDeclaredTypeOfEnumMember(symbol);\n            }\n            if (symbol.flags & 8388608) {\n                return getDeclaredTypeOfAlias(symbol);\n            }\n            return unknownType;\n        }\n        function isIndependentTypeReference(node) {\n            if (node.typeArguments) {\n                for (var _i = 0, _a = node.typeArguments; _i < _a.length; _i++) {\n                    var typeNode = _a[_i];\n                    if (!isIndependentType(typeNode)) {\n                        return false;\n                    }\n                }\n            }\n            return true;\n        }\n        function isIndependentType(node) {\n            switch (node.kind) {\n                case 118:\n                case 134:\n                case 132:\n                case 121:\n                case 135:\n                case 104:\n                case 137:\n                case 94:\n                case 129:\n                case 171:\n                    return true;\n                case 162:\n                    return isIndependentType(node.elementType);\n                case 157:\n                    return isIndependentTypeReference(node);\n            }\n            return false;\n        }\n        function isIndependentVariableLikeDeclaration(node) {\n            return node.type && isIndependentType(node.type) || !node.type && !node.initializer;\n        }\n        function isIndependentFunctionLikeDeclaration(node) {\n            if (node.kind !== 150 && (!node.type || !isIndependentType(node.type))) {\n                return false;\n            }\n            for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {\n                var parameter = _a[_i];\n                if (!isIndependentVariableLikeDeclaration(parameter)) {\n                    return false;\n                }\n            }\n            return true;\n        }\n        function isIndependentMember(symbol) {\n            if (symbol.declarations && symbol.declarations.length === 1) {\n                var declaration = symbol.declarations[0];\n                if (declaration) {\n                    switch (declaration.kind) {\n                        case 147:\n                        case 146:\n                            return isIndependentVariableLikeDeclaration(declaration);\n                        case 149:\n                        case 148:\n                        case 150:\n                            return isIndependentFunctionLikeDeclaration(declaration);\n                    }\n                }\n            }\n            return false;\n        }\n        function createSymbolTable(symbols) {\n            var result = ts.createMap();\n            for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {\n                var symbol = symbols_1[_i];\n                result[symbol.name] = symbol;\n            }\n            return result;\n        }\n        function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) {\n            var result = ts.createMap();\n            for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {\n                var symbol = symbols_2[_i];\n                result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper);\n            }\n            return result;\n        }\n        function addInheritedMembers(symbols, baseSymbols) {\n            for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) {\n                var s = baseSymbols_1[_i];\n                if (!symbols[s.name]) {\n                    symbols[s.name] = s;\n                }\n            }\n        }\n        function resolveDeclaredMembers(type) {\n            if (!type.declaredProperties) {\n                var symbol = type.symbol;\n                type.declaredProperties = getNamedMembers(symbol.members);\n                type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members[\"__call\"]);\n                type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members[\"__new\"]);\n                type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0);\n                type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1);\n            }\n            return type;\n        }\n        function getTypeWithThisArgument(type, thisArgument) {\n            if (getObjectFlags(type) & 4) {\n                return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType]));\n            }\n            return type;\n        }\n        function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {\n            var mapper;\n            var members;\n            var callSignatures;\n            var constructSignatures;\n            var stringIndexInfo;\n            var numberIndexInfo;\n            if (ts.rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) {\n                mapper = identityMapper;\n                members = source.symbol ? source.symbol.members : createSymbolTable(source.declaredProperties);\n                callSignatures = source.declaredCallSignatures;\n                constructSignatures = source.declaredConstructSignatures;\n                stringIndexInfo = source.declaredStringIndexInfo;\n                numberIndexInfo = source.declaredNumberIndexInfo;\n            }\n            else {\n                mapper = createTypeMapper(typeParameters, typeArguments);\n                members = createInstantiatedSymbolTable(source.declaredProperties, mapper, typeParameters.length === 1);\n                callSignatures = instantiateSignatures(source.declaredCallSignatures, mapper);\n                constructSignatures = instantiateSignatures(source.declaredConstructSignatures, mapper);\n                stringIndexInfo = instantiateIndexInfo(source.declaredStringIndexInfo, mapper);\n                numberIndexInfo = instantiateIndexInfo(source.declaredNumberIndexInfo, mapper);\n            }\n            var baseTypes = getBaseTypes(source);\n            if (baseTypes.length) {\n                if (source.symbol && members === source.symbol.members) {\n                    members = createSymbolTable(source.declaredProperties);\n                }\n                var thisArgument = ts.lastOrUndefined(typeArguments);\n                for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) {\n                    var baseType = baseTypes_1[_i];\n                    var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType;\n                    addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType));\n                    callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0));\n                    constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1));\n                    stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0);\n                    numberIndexInfo = numberIndexInfo || getIndexInfoOfType(instantiatedBaseType, 1);\n                }\n            }\n            setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n        }\n        function resolveClassOrInterfaceMembers(type) {\n            resolveObjectTypeMembers(type, resolveDeclaredMembers(type), emptyArray, emptyArray);\n        }\n        function resolveTypeReferenceMembers(type) {\n            var source = resolveDeclaredMembers(type.target);\n            var typeParameters = ts.concatenate(source.typeParameters, [source.thisType]);\n            var typeArguments = type.typeArguments && type.typeArguments.length === typeParameters.length ?\n                type.typeArguments : ts.concatenate(type.typeArguments, [type]);\n            resolveObjectTypeMembers(type, source, typeParameters, typeArguments);\n        }\n        function createSignature(declaration, typeParameters, thisParameter, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasLiteralTypes) {\n            var sig = new Signature(checker);\n            sig.declaration = declaration;\n            sig.typeParameters = typeParameters;\n            sig.parameters = parameters;\n            sig.thisParameter = thisParameter;\n            sig.resolvedReturnType = resolvedReturnType;\n            sig.typePredicate = typePredicate;\n            sig.minArgumentCount = minArgumentCount;\n            sig.hasRestParameter = hasRestParameter;\n            sig.hasLiteralTypes = hasLiteralTypes;\n            return sig;\n        }\n        function cloneSignature(sig) {\n            return createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasLiteralTypes);\n        }\n        function getDefaultConstructSignatures(classType) {\n            var baseConstructorType = getBaseConstructorTypeOfClass(classType);\n            var baseSignatures = getSignaturesOfType(baseConstructorType, 1);\n            if (baseSignatures.length === 0) {\n                return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, undefined, 0, false, false)];\n            }\n            var baseTypeNode = getBaseTypeNodeOfClass(classType);\n            var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode);\n            var typeArgCount = typeArguments ? typeArguments.length : 0;\n            var result = [];\n            for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) {\n                var baseSig = baseSignatures_1[_i];\n                var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0;\n                if (typeParamCount === typeArgCount) {\n                    var sig = typeParamCount ? createSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig);\n                    sig.typeParameters = classType.localTypeParameters;\n                    sig.resolvedReturnType = classType;\n                    result.push(sig);\n                }\n            }\n            return result;\n        }\n        function findMatchingSignature(signatureList, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes) {\n            for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) {\n                var s = signatureList_1[_i];\n                if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypesIdentical)) {\n                    return s;\n                }\n            }\n        }\n        function findMatchingSignatures(signatureLists, signature, listIndex) {\n            if (signature.typeParameters) {\n                if (listIndex > 0) {\n                    return undefined;\n                }\n                for (var i = 1; i < signatureLists.length; i++) {\n                    if (!findMatchingSignature(signatureLists[i], signature, false, false, false)) {\n                        return undefined;\n                    }\n                }\n                return [signature];\n            }\n            var result = undefined;\n            for (var i = 0; i < signatureLists.length; i++) {\n                var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, true, true, true);\n                if (!match) {\n                    return undefined;\n                }\n                if (!ts.contains(result, match)) {\n                    (result || (result = [])).push(match);\n                }\n            }\n            return result;\n        }\n        function getUnionSignatures(types, kind) {\n            var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); });\n            var result = undefined;\n            for (var i = 0; i < signatureLists.length; i++) {\n                for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) {\n                    var signature = _a[_i];\n                    if (!result || !findMatchingSignature(result, signature, false, true, true)) {\n                        var unionSignatures = findMatchingSignatures(signatureLists, signature, i);\n                        if (unionSignatures) {\n                            var s = signature;\n                            if (unionSignatures.length > 1) {\n                                s = cloneSignature(signature);\n                                if (ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; })) {\n                                    var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return getTypeOfSymbol(sig.thisParameter) || anyType; }), true);\n                                    s.thisParameter = createTransientSymbol(signature.thisParameter, thisType);\n                                }\n                                s.resolvedReturnType = undefined;\n                                s.unionSignatures = unionSignatures;\n                            }\n                            (result || (result = [])).push(s);\n                        }\n                    }\n                }\n            }\n            return result || emptyArray;\n        }\n        function getUnionIndexInfo(types, kind) {\n            var indexTypes = [];\n            var isAnyReadonly = false;\n            for (var _i = 0, types_1 = types; _i < types_1.length; _i++) {\n                var type = types_1[_i];\n                var indexInfo = getIndexInfoOfType(type, kind);\n                if (!indexInfo) {\n                    return undefined;\n                }\n                indexTypes.push(indexInfo.type);\n                isAnyReadonly = isAnyReadonly || indexInfo.isReadonly;\n            }\n            return createIndexInfo(getUnionType(indexTypes, true), isAnyReadonly);\n        }\n        function resolveUnionTypeMembers(type) {\n            var callSignatures = getUnionSignatures(type.types, 0);\n            var constructSignatures = getUnionSignatures(type.types, 1);\n            var stringIndexInfo = getUnionIndexInfo(type.types, 0);\n            var numberIndexInfo = getUnionIndexInfo(type.types, 1);\n            setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n        }\n        function intersectTypes(type1, type2) {\n            return !type1 ? type2 : !type2 ? type1 : getIntersectionType([type1, type2]);\n        }\n        function intersectIndexInfos(info1, info2) {\n            return !info1 ? info2 : !info2 ? info1 : createIndexInfo(getIntersectionType([info1.type, info2.type]), info1.isReadonly && info2.isReadonly);\n        }\n        function unionSpreadIndexInfos(info1, info2) {\n            return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly);\n        }\n        function resolveIntersectionTypeMembers(type) {\n            var callSignatures = emptyArray;\n            var constructSignatures = emptyArray;\n            var stringIndexInfo = undefined;\n            var numberIndexInfo = undefined;\n            for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                var t = _a[_i];\n                callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0));\n                constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1));\n                stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0));\n                numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1));\n            }\n            setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n        }\n        function resolveAnonymousTypeMembers(type) {\n            var symbol = type.symbol;\n            if (type.target) {\n                var members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, false);\n                var callSignatures = instantiateSignatures(getSignaturesOfType(type.target, 0), type.mapper);\n                var constructSignatures = instantiateSignatures(getSignaturesOfType(type.target, 1), type.mapper);\n                var stringIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 0), type.mapper);\n                var numberIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 1), type.mapper);\n                setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n            }\n            else if (symbol.flags & 2048) {\n                var members = symbol.members;\n                var callSignatures = getSignaturesOfSymbol(members[\"__call\"]);\n                var constructSignatures = getSignaturesOfSymbol(members[\"__new\"]);\n                var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0);\n                var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1);\n                setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n            }\n            else {\n                var members = emptySymbols;\n                var constructSignatures = emptyArray;\n                if (symbol.flags & 1952) {\n                    members = getExportsOfSymbol(symbol);\n                }\n                if (symbol.flags & 32) {\n                    var classType = getDeclaredTypeOfClassOrInterface(symbol);\n                    constructSignatures = getSignaturesOfSymbol(symbol.members[\"__constructor\"]);\n                    if (!constructSignatures.length) {\n                        constructSignatures = getDefaultConstructSignatures(classType);\n                    }\n                    var baseConstructorType = getBaseConstructorTypeOfClass(classType);\n                    if (baseConstructorType.flags & 32768) {\n                        members = createSymbolTable(getNamedMembers(members));\n                        addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType));\n                    }\n                }\n                var numberIndexInfo = symbol.flags & 384 ? enumNumberIndexInfo : undefined;\n                setStructuredTypeMembers(type, members, emptyArray, constructSignatures, undefined, numberIndexInfo);\n                if (symbol.flags & (16 | 8192)) {\n                    type.callSignatures = getSignaturesOfSymbol(symbol);\n                }\n            }\n        }\n        function resolveMappedTypeMembers(type) {\n            var members = ts.createMap();\n            var stringIndexInfo;\n            setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n            var typeParameter = getTypeParameterFromMappedType(type);\n            var constraintType = getConstraintTypeFromMappedType(type);\n            var homomorphicType = getHomomorphicTypeFromMappedType(type);\n            var templateType = getTemplateTypeFromMappedType(type);\n            var templateReadonly = !!type.declaration.readonlyToken;\n            var templateOptional = !!type.declaration.questionToken;\n            var keyType = constraintType.flags & 540672 ? getApparentType(constraintType) : constraintType;\n            var iterationType = keyType.flags & 262144 ? getIndexType(getApparentType(keyType.type)) : keyType;\n            forEachType(iterationType, function (t) {\n                var iterationMapper = createUnaryTypeMapper(typeParameter, t);\n                var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper;\n                var propType = instantiateType(templateType, templateMapper);\n                if (t.flags & 32) {\n                    var propName = t.text;\n                    var homomorphicProp = homomorphicType && getPropertyOfType(homomorphicType, propName);\n                    var isOptional = templateOptional || !!(homomorphicProp && homomorphicProp.flags & 536870912);\n                    var prop = createSymbol(4 | 67108864 | (isOptional ? 536870912 : 0), propName);\n                    prop.type = propType;\n                    prop.isReadonly = templateReadonly || homomorphicProp && isReadonlySymbol(homomorphicProp);\n                    members[propName] = prop;\n                }\n                else if (t.flags & 2) {\n                    stringIndexInfo = createIndexInfo(propType, templateReadonly);\n                }\n            });\n            setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined);\n        }\n        function getTypeParameterFromMappedType(type) {\n            return type.typeParameter ||\n                (type.typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(type.declaration.typeParameter)));\n        }\n        function getConstraintTypeFromMappedType(type) {\n            return type.constraintType ||\n                (type.constraintType = instantiateType(getConstraintOfTypeParameter(getTypeParameterFromMappedType(type)), type.mapper || identityMapper) || unknownType);\n        }\n        function getTemplateTypeFromMappedType(type) {\n            return type.templateType ||\n                (type.templateType = type.declaration.type ?\n                    instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!type.declaration.questionToken), type.mapper || identityMapper) :\n                    unknownType);\n        }\n        function getHomomorphicTypeFromMappedType(type) {\n            var constraint = getConstraintDeclaration(getTypeParameterFromMappedType(type));\n            return constraint.kind === 168 ? instantiateType(getTypeFromTypeNode(constraint.type), type.mapper || identityMapper) : undefined;\n        }\n        function getErasedTemplateTypeFromMappedType(type) {\n            return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType));\n        }\n        function isGenericMappedType(type) {\n            if (getObjectFlags(type) & 32) {\n                var constraintType = getConstraintTypeFromMappedType(type);\n                return maybeTypeOfKind(constraintType, 540672 | 262144);\n            }\n            return false;\n        }\n        function resolveStructuredTypeMembers(type) {\n            if (!type.members) {\n                if (type.flags & 32768) {\n                    if (type.objectFlags & 4) {\n                        resolveTypeReferenceMembers(type);\n                    }\n                    else if (type.objectFlags & 3) {\n                        resolveClassOrInterfaceMembers(type);\n                    }\n                    else if (type.objectFlags & 16) {\n                        resolveAnonymousTypeMembers(type);\n                    }\n                    else if (type.objectFlags & 32) {\n                        resolveMappedTypeMembers(type);\n                    }\n                }\n                else if (type.flags & 65536) {\n                    resolveUnionTypeMembers(type);\n                }\n                else if (type.flags & 131072) {\n                    resolveIntersectionTypeMembers(type);\n                }\n            }\n            return type;\n        }\n        function getPropertiesOfObjectType(type) {\n            if (type.flags & 32768) {\n                return resolveStructuredTypeMembers(type).properties;\n            }\n            return emptyArray;\n        }\n        function getPropertyOfObjectType(type, name) {\n            if (type.flags & 32768) {\n                var resolved = resolveStructuredTypeMembers(type);\n                var symbol = resolved.members[name];\n                if (symbol && symbolIsValue(symbol)) {\n                    return symbol;\n                }\n            }\n        }\n        function getPropertiesOfUnionOrIntersectionType(type) {\n            for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                var current = _a[_i];\n                for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) {\n                    var prop = _c[_b];\n                    getUnionOrIntersectionProperty(type, prop.name);\n                }\n                if (type.flags & 65536) {\n                    break;\n                }\n            }\n            var props = type.resolvedProperties;\n            if (props) {\n                var result = [];\n                for (var key in props) {\n                    var prop = props[key];\n                    if (!(prop.flags & 268435456 && prop.isPartial)) {\n                        result.push(prop);\n                    }\n                }\n                return result;\n            }\n            return emptyArray;\n        }\n        function getPropertiesOfType(type) {\n            type = getApparentType(type);\n            return type.flags & 196608 ?\n                getPropertiesOfUnionOrIntersectionType(type) :\n                getPropertiesOfObjectType(type);\n        }\n        function getApparentTypeOfTypeParameter(type) {\n            if (!type.resolvedApparentType) {\n                var constraintType = getConstraintOfTypeParameter(type);\n                while (constraintType && constraintType.flags & 16384) {\n                    constraintType = getConstraintOfTypeParameter(constraintType);\n                }\n                type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type);\n            }\n            return type.resolvedApparentType;\n        }\n        function getApparentTypeOfIndexedAccess(type) {\n            return getIndexTypeOfType(getApparentType(type.objectType), 0) || type;\n        }\n        function getApparentType(type) {\n            var t = type.flags & 16384 ? getApparentTypeOfTypeParameter(type) :\n                type.flags & 524288 ? getApparentTypeOfIndexedAccess(type) :\n                    type;\n            return t.flags & 262178 ? globalStringType :\n                t.flags & 340 ? globalNumberType :\n                    t.flags & 136 ? globalBooleanType :\n                        t.flags & 512 ? getGlobalESSymbolType() :\n                            t;\n        }\n        function createUnionOrIntersectionProperty(containingType, name) {\n            var types = containingType.types;\n            var props;\n            var commonFlags = (containingType.flags & 131072) ? 536870912 : 0;\n            var isReadonly = false;\n            var isPartial = false;\n            for (var _i = 0, types_2 = types; _i < types_2.length; _i++) {\n                var current = types_2[_i];\n                var type = getApparentType(current);\n                if (type !== unknownType) {\n                    var prop = getPropertyOfType(type, name);\n                    if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16))) {\n                        commonFlags &= prop.flags;\n                        if (!props) {\n                            props = [prop];\n                        }\n                        else if (!ts.contains(props, prop)) {\n                            props.push(prop);\n                        }\n                        if (isReadonlySymbol(prop)) {\n                            isReadonly = true;\n                        }\n                    }\n                    else if (containingType.flags & 65536) {\n                        isPartial = true;\n                    }\n                }\n            }\n            if (!props) {\n                return undefined;\n            }\n            if (props.length === 1 && !isPartial) {\n                return props[0];\n            }\n            var propTypes = [];\n            var declarations = [];\n            var commonType = undefined;\n            var hasNonUniformType = false;\n            for (var _a = 0, props_1 = props; _a < props_1.length; _a++) {\n                var prop = props_1[_a];\n                if (prop.declarations) {\n                    ts.addRange(declarations, prop.declarations);\n                }\n                var type = getTypeOfSymbol(prop);\n                if (!commonType) {\n                    commonType = type;\n                }\n                else if (type !== commonType) {\n                    hasNonUniformType = true;\n                }\n                propTypes.push(type);\n            }\n            var result = createSymbol(4 | 67108864 | 268435456 | commonFlags, name);\n            result.containingType = containingType;\n            result.hasNonUniformType = hasNonUniformType;\n            result.isPartial = isPartial;\n            result.declarations = declarations;\n            result.isReadonly = isReadonly;\n            result.type = containingType.flags & 65536 ? getUnionType(propTypes) : getIntersectionType(propTypes);\n            return result;\n        }\n        function getUnionOrIntersectionProperty(type, name) {\n            var properties = type.resolvedProperties || (type.resolvedProperties = ts.createMap());\n            var property = properties[name];\n            if (!property) {\n                property = createUnionOrIntersectionProperty(type, name);\n                if (property) {\n                    properties[name] = property;\n                }\n            }\n            return property;\n        }\n        function getPropertyOfUnionOrIntersectionType(type, name) {\n            var property = getUnionOrIntersectionProperty(type, name);\n            return property && !(property.flags & 268435456 && property.isPartial) ? property : undefined;\n        }\n        function getPropertyOfType(type, name) {\n            type = getApparentType(type);\n            if (type.flags & 32768) {\n                var resolved = resolveStructuredTypeMembers(type);\n                var symbol = resolved.members[name];\n                if (symbol && symbolIsValue(symbol)) {\n                    return symbol;\n                }\n                if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) {\n                    var symbol_1 = getPropertyOfObjectType(globalFunctionType, name);\n                    if (symbol_1) {\n                        return symbol_1;\n                    }\n                }\n                return getPropertyOfObjectType(globalObjectType, name);\n            }\n            if (type.flags & 196608) {\n                return getPropertyOfUnionOrIntersectionType(type, name);\n            }\n            return undefined;\n        }\n        function getSignaturesOfStructuredType(type, kind) {\n            if (type.flags & 229376) {\n                var resolved = resolveStructuredTypeMembers(type);\n                return kind === 0 ? resolved.callSignatures : resolved.constructSignatures;\n            }\n            return emptyArray;\n        }\n        function getSignaturesOfType(type, kind) {\n            return getSignaturesOfStructuredType(getApparentType(type), kind);\n        }\n        function getIndexInfoOfStructuredType(type, kind) {\n            if (type.flags & 229376) {\n                var resolved = resolveStructuredTypeMembers(type);\n                return kind === 0 ? resolved.stringIndexInfo : resolved.numberIndexInfo;\n            }\n        }\n        function getIndexTypeOfStructuredType(type, kind) {\n            var info = getIndexInfoOfStructuredType(type, kind);\n            return info && info.type;\n        }\n        function getIndexInfoOfType(type, kind) {\n            return getIndexInfoOfStructuredType(getApparentType(type), kind);\n        }\n        function getIndexTypeOfType(type, kind) {\n            return getIndexTypeOfStructuredType(getApparentType(type), kind);\n        }\n        function getImplicitIndexTypeOfType(type, kind) {\n            if (isObjectLiteralType(type)) {\n                var propTypes = [];\n                for (var _i = 0, _a = getPropertiesOfType(type); _i < _a.length; _i++) {\n                    var prop = _a[_i];\n                    if (kind === 0 || isNumericLiteralName(prop.name)) {\n                        propTypes.push(getTypeOfSymbol(prop));\n                    }\n                }\n                if (propTypes.length) {\n                    return getUnionType(propTypes, true);\n                }\n            }\n            return undefined;\n        }\n        function getTypeParametersFromJSDocTemplate(declaration) {\n            if (declaration.flags & 65536) {\n                var templateTag = ts.getJSDocTemplateTag(declaration);\n                if (templateTag) {\n                    return getTypeParametersFromDeclaration(templateTag.typeParameters);\n                }\n            }\n            return undefined;\n        }\n        function getTypeParametersFromDeclaration(typeParameterDeclarations) {\n            var result = [];\n            ts.forEach(typeParameterDeclarations, function (node) {\n                var tp = getDeclaredTypeOfTypeParameter(node.symbol);\n                if (!ts.contains(result, tp)) {\n                    result.push(tp);\n                }\n            });\n            return result;\n        }\n        function symbolsToArray(symbols) {\n            var result = [];\n            for (var id in symbols) {\n                if (!isReservedMemberName(id)) {\n                    result.push(symbols[id]);\n                }\n            }\n            return result;\n        }\n        function isJSDocOptionalParameter(node) {\n            if (node.flags & 65536) {\n                if (node.type && node.type.kind === 273) {\n                    return true;\n                }\n                var paramTags = ts.getJSDocParameterTags(node);\n                if (paramTags) {\n                    for (var _i = 0, paramTags_1 = paramTags; _i < paramTags_1.length; _i++) {\n                        var paramTag = paramTags_1[_i];\n                        if (paramTag.isBracketed) {\n                            return true;\n                        }\n                        if (paramTag.typeExpression) {\n                            return paramTag.typeExpression.type.kind === 273;\n                        }\n                    }\n                }\n            }\n        }\n        function tryFindAmbientModule(moduleName, withAugmentations) {\n            if (ts.isExternalModuleNameRelative(moduleName)) {\n                return undefined;\n            }\n            var symbol = getSymbol(globals, \"\\\"\" + moduleName + \"\\\"\", 512);\n            return symbol && withAugmentations ? getMergedSymbol(symbol) : symbol;\n        }\n        function isOptionalParameter(node) {\n            if (ts.hasQuestionToken(node) || isJSDocOptionalParameter(node)) {\n                return true;\n            }\n            if (node.initializer) {\n                var signatureDeclaration = node.parent;\n                var signature = getSignatureFromDeclaration(signatureDeclaration);\n                var parameterIndex = ts.indexOf(signatureDeclaration.parameters, node);\n                ts.Debug.assert(parameterIndex >= 0);\n                return parameterIndex >= signature.minArgumentCount;\n            }\n            return false;\n        }\n        function createTypePredicateFromTypePredicateNode(node) {\n            if (node.parameterName.kind === 70) {\n                var parameterName = node.parameterName;\n                return {\n                    kind: 1,\n                    parameterName: parameterName ? parameterName.text : undefined,\n                    parameterIndex: parameterName ? getTypePredicateParameterIndex(node.parent.parameters, parameterName) : undefined,\n                    type: getTypeFromTypeNode(node.type)\n                };\n            }\n            else {\n                return {\n                    kind: 0,\n                    type: getTypeFromTypeNode(node.type)\n                };\n            }\n        }\n        function getSignatureFromDeclaration(declaration) {\n            var links = getNodeLinks(declaration);\n            if (!links.resolvedSignature) {\n                var parameters = [];\n                var hasLiteralTypes = false;\n                var minArgumentCount = -1;\n                var thisParameter = undefined;\n                var hasThisParameter = void 0;\n                var isJSConstructSignature = ts.isJSDocConstructSignature(declaration);\n                for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) {\n                    var param = declaration.parameters[i];\n                    var paramSymbol = param.symbol;\n                    if (paramSymbol && !!(paramSymbol.flags & 4) && !ts.isBindingPattern(param.name)) {\n                        var resolvedSymbol = resolveName(param, paramSymbol.name, 107455, undefined, undefined);\n                        paramSymbol = resolvedSymbol;\n                    }\n                    if (i === 0 && paramSymbol.name === \"this\") {\n                        hasThisParameter = true;\n                        thisParameter = param.symbol;\n                    }\n                    else {\n                        parameters.push(paramSymbol);\n                    }\n                    if (param.type && param.type.kind === 171) {\n                        hasLiteralTypes = true;\n                    }\n                    if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) {\n                        if (minArgumentCount < 0) {\n                            minArgumentCount = i - (hasThisParameter ? 1 : 0);\n                        }\n                    }\n                    else {\n                        minArgumentCount = -1;\n                    }\n                }\n                if ((declaration.kind === 151 || declaration.kind === 152) &&\n                    !ts.hasDynamicName(declaration) &&\n                    (!hasThisParameter || !thisParameter)) {\n                    var otherKind = declaration.kind === 151 ? 152 : 151;\n                    var other = ts.getDeclarationOfKind(declaration.symbol, otherKind);\n                    if (other) {\n                        thisParameter = getAnnotatedAccessorThisParameter(other);\n                    }\n                }\n                if (minArgumentCount < 0) {\n                    minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0);\n                }\n                if (isJSConstructSignature) {\n                    minArgumentCount--;\n                }\n                var classType = declaration.kind === 150 ?\n                    getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol))\n                    : undefined;\n                var typeParameters = classType ? classType.localTypeParameters :\n                    declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) :\n                        getTypeParametersFromJSDocTemplate(declaration);\n                var returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType);\n                var typePredicate = declaration.type && declaration.type.kind === 156 ?\n                    createTypePredicateFromTypePredicateNode(declaration.type) :\n                    undefined;\n                links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasLiteralTypes);\n            }\n            return links.resolvedSignature;\n        }\n        function getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType) {\n            if (isJSConstructSignature) {\n                return getTypeFromTypeNode(declaration.parameters[0].type);\n            }\n            else if (classType) {\n                return classType;\n            }\n            else if (declaration.type) {\n                return getTypeFromTypeNode(declaration.type);\n            }\n            if (declaration.flags & 65536) {\n                var type = getReturnTypeFromJSDocComment(declaration);\n                if (type && type !== unknownType) {\n                    return type;\n                }\n            }\n            if (declaration.kind === 151 && !ts.hasDynamicName(declaration)) {\n                var setter = ts.getDeclarationOfKind(declaration.symbol, 152);\n                return getAnnotatedAccessorType(setter);\n            }\n            if (ts.nodeIsMissing(declaration.body)) {\n                return anyType;\n            }\n        }\n        function getSignaturesOfSymbol(symbol) {\n            if (!symbol)\n                return emptyArray;\n            var result = [];\n            for (var i = 0, len = symbol.declarations.length; i < len; i++) {\n                var node = symbol.declarations[i];\n                switch (node.kind) {\n                    case 158:\n                    case 159:\n                    case 225:\n                    case 149:\n                    case 148:\n                    case 150:\n                    case 153:\n                    case 154:\n                    case 155:\n                    case 151:\n                    case 152:\n                    case 184:\n                    case 185:\n                    case 274:\n                        if (i > 0 && node.body) {\n                            var previous = symbol.declarations[i - 1];\n                            if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) {\n                                break;\n                            }\n                        }\n                        result.push(getSignatureFromDeclaration(node));\n                }\n            }\n            return result;\n        }\n        function resolveExternalModuleTypeByLiteral(name) {\n            var moduleSym = resolveExternalModuleName(name, name);\n            if (moduleSym) {\n                var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym);\n                if (resolvedModuleSymbol) {\n                    return getTypeOfSymbol(resolvedModuleSymbol);\n                }\n            }\n            return anyType;\n        }\n        function getThisTypeOfSignature(signature) {\n            if (signature.thisParameter) {\n                return getTypeOfSymbol(signature.thisParameter);\n            }\n        }\n        function getReturnTypeOfSignature(signature) {\n            if (!signature.resolvedReturnType) {\n                if (!pushTypeResolution(signature, 3)) {\n                    return unknownType;\n                }\n                var type = void 0;\n                if (signature.target) {\n                    type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper);\n                }\n                else if (signature.unionSignatures) {\n                    type = getUnionType(ts.map(signature.unionSignatures, getReturnTypeOfSignature), true);\n                }\n                else {\n                    type = getReturnTypeFromBody(signature.declaration);\n                }\n                if (!popTypeResolution()) {\n                    type = anyType;\n                    if (compilerOptions.noImplicitAny) {\n                        var declaration = signature.declaration;\n                        if (declaration.name) {\n                            error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));\n                        }\n                        else {\n                            error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);\n                        }\n                    }\n                }\n                signature.resolvedReturnType = type;\n            }\n            return signature.resolvedReturnType;\n        }\n        function getRestTypeOfSignature(signature) {\n            if (signature.hasRestParameter) {\n                var type = getTypeOfSymbol(ts.lastOrUndefined(signature.parameters));\n                if (getObjectFlags(type) & 4 && type.target === globalArrayType) {\n                    return type.typeArguments[0];\n                }\n            }\n            return anyType;\n        }\n        function getSignatureInstantiation(signature, typeArguments) {\n            var instantiations = signature.instantiations || (signature.instantiations = ts.createMap());\n            var id = getTypeListId(typeArguments);\n            return instantiations[id] || (instantiations[id] = createSignatureInstantiation(signature, typeArguments));\n        }\n        function createSignatureInstantiation(signature, typeArguments) {\n            return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), true);\n        }\n        function getErasedSignature(signature) {\n            if (!signature.typeParameters)\n                return signature;\n            if (!signature.erasedSignatureCache) {\n                signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), true);\n            }\n            return signature.erasedSignatureCache;\n        }\n        function getOrCreateTypeFromSignature(signature) {\n            if (!signature.isolatedSignatureType) {\n                var isConstructor = signature.declaration.kind === 150 || signature.declaration.kind === 154;\n                var type = createObjectType(16);\n                type.members = emptySymbols;\n                type.properties = emptyArray;\n                type.callSignatures = !isConstructor ? [signature] : emptyArray;\n                type.constructSignatures = isConstructor ? [signature] : emptyArray;\n                signature.isolatedSignatureType = type;\n            }\n            return signature.isolatedSignatureType;\n        }\n        function getIndexSymbol(symbol) {\n            return symbol.members[\"__index\"];\n        }\n        function getIndexDeclarationOfSymbol(symbol, kind) {\n            var syntaxKind = kind === 1 ? 132 : 134;\n            var indexSymbol = getIndexSymbol(symbol);\n            if (indexSymbol) {\n                for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    var node = decl;\n                    if (node.parameters.length === 1) {\n                        var parameter = node.parameters[0];\n                        if (parameter && parameter.type && parameter.type.kind === syntaxKind) {\n                            return node;\n                        }\n                    }\n                }\n            }\n            return undefined;\n        }\n        function createIndexInfo(type, isReadonly, declaration) {\n            return { type: type, isReadonly: isReadonly, declaration: declaration };\n        }\n        function getIndexInfoOfSymbol(symbol, kind) {\n            var declaration = getIndexDeclarationOfSymbol(symbol, kind);\n            if (declaration) {\n                return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, (ts.getModifierFlags(declaration) & 64) !== 0, declaration);\n            }\n            return undefined;\n        }\n        function getConstraintDeclaration(type) {\n            return ts.getDeclarationOfKind(type.symbol, 143).constraint;\n        }\n        function hasConstraintReferenceTo(type, target) {\n            var checked;\n            while (type && type.flags & 16384 && !(type.isThisType) && !ts.contains(checked, type)) {\n                if (type === target) {\n                    return true;\n                }\n                (checked || (checked = [])).push(type);\n                var constraintDeclaration = getConstraintDeclaration(type);\n                type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration);\n            }\n            return false;\n        }\n        function getConstraintOfTypeParameter(typeParameter) {\n            if (!typeParameter.constraint) {\n                if (typeParameter.target) {\n                    var targetConstraint = getConstraintOfTypeParameter(typeParameter.target);\n                    typeParameter.constraint = targetConstraint ? instantiateType(targetConstraint, typeParameter.mapper) : noConstraintType;\n                }\n                else {\n                    var constraintDeclaration = getConstraintDeclaration(typeParameter);\n                    var constraint = getTypeFromTypeNode(constraintDeclaration);\n                    if (hasConstraintReferenceTo(constraint, typeParameter)) {\n                        error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter));\n                        constraint = unknownType;\n                    }\n                    typeParameter.constraint = constraint;\n                }\n            }\n            return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint;\n        }\n        function getParentSymbolOfTypeParameter(typeParameter) {\n            return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143).parent);\n        }\n        function getTypeListId(types) {\n            var result = \"\";\n            if (types) {\n                var length_3 = types.length;\n                var i = 0;\n                while (i < length_3) {\n                    var startId = types[i].id;\n                    var count = 1;\n                    while (i + count < length_3 && types[i + count].id === startId + count) {\n                        count++;\n                    }\n                    if (result.length) {\n                        result += \",\";\n                    }\n                    result += startId;\n                    if (count > 1) {\n                        result += \":\" + count;\n                    }\n                    i += count;\n                }\n            }\n            return result;\n        }\n        function getPropagatingFlagsOfTypes(types, excludeKinds) {\n            var result = 0;\n            for (var _i = 0, types_3 = types; _i < types_3.length; _i++) {\n                var type = types_3[_i];\n                if (!(type.flags & excludeKinds)) {\n                    result |= type.flags;\n                }\n            }\n            return result & 14680064;\n        }\n        function createTypeReference(target, typeArguments) {\n            var id = getTypeListId(typeArguments);\n            var type = target.instantiations[id];\n            if (!type) {\n                type = target.instantiations[id] = createObjectType(4, target.symbol);\n                type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, 0) : 0;\n                type.target = target;\n                type.typeArguments = typeArguments;\n            }\n            return type;\n        }\n        function cloneTypeReference(source) {\n            var type = createType(source.flags);\n            type.symbol = source.symbol;\n            type.objectFlags = source.objectFlags;\n            type.target = source.target;\n            type.typeArguments = source.typeArguments;\n            return type;\n        }\n        function getTypeReferenceArity(type) {\n            return type.target.typeParameters ? type.target.typeParameters.length : 0;\n        }\n        function getTypeFromClassOrInterfaceReference(node, symbol) {\n            var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol));\n            var typeParameters = type.localTypeParameters;\n            if (typeParameters) {\n                if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) {\n                    error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length);\n                    return unknownType;\n                }\n                return createTypeReference(type, ts.concatenate(type.outerTypeParameters, ts.map(node.typeArguments, getTypeFromTypeNode)));\n            }\n            if (node.typeArguments) {\n                error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type));\n                return unknownType;\n            }\n            return type;\n        }\n        function getTypeAliasInstantiation(symbol, typeArguments) {\n            var type = getDeclaredTypeOfSymbol(symbol);\n            var links = getSymbolLinks(symbol);\n            var typeParameters = links.typeParameters;\n            var id = getTypeListId(typeArguments);\n            return links.instantiations[id] || (links.instantiations[id] = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments)));\n        }\n        function getTypeFromTypeAliasReference(node, symbol) {\n            var type = getDeclaredTypeOfSymbol(symbol);\n            var typeParameters = getSymbolLinks(symbol).typeParameters;\n            if (typeParameters) {\n                if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) {\n                    error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, symbolToString(symbol), typeParameters.length);\n                    return unknownType;\n                }\n                var typeArguments = ts.map(node.typeArguments, getTypeFromTypeNode);\n                return getTypeAliasInstantiation(symbol, typeArguments);\n            }\n            if (node.typeArguments) {\n                error(node, ts.Diagnostics.Type_0_is_not_generic, symbolToString(symbol));\n                return unknownType;\n            }\n            return type;\n        }\n        function getTypeFromNonGenericTypeReference(node, symbol) {\n            if (node.typeArguments) {\n                error(node, ts.Diagnostics.Type_0_is_not_generic, symbolToString(symbol));\n                return unknownType;\n            }\n            return getDeclaredTypeOfSymbol(symbol);\n        }\n        function getTypeReferenceName(node) {\n            switch (node.kind) {\n                case 157:\n                    return node.typeName;\n                case 272:\n                    return node.name;\n                case 199:\n                    var expr = node.expression;\n                    if (ts.isEntityNameExpression(expr)) {\n                        return expr;\n                    }\n            }\n            return undefined;\n        }\n        function resolveTypeReferenceName(typeReferenceName) {\n            if (!typeReferenceName) {\n                return unknownSymbol;\n            }\n            return resolveEntityName(typeReferenceName, 793064) || unknownSymbol;\n        }\n        function getTypeReferenceType(node, symbol) {\n            if (symbol === unknownSymbol) {\n                return unknownType;\n            }\n            if (symbol.flags & (32 | 64)) {\n                return getTypeFromClassOrInterfaceReference(node, symbol);\n            }\n            if (symbol.flags & 524288) {\n                return getTypeFromTypeAliasReference(node, symbol);\n            }\n            if (symbol.flags & 107455 && node.kind === 272) {\n                return getTypeOfSymbol(symbol);\n            }\n            return getTypeFromNonGenericTypeReference(node, symbol);\n        }\n        function getTypeFromTypeReference(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                var symbol = void 0;\n                var type = void 0;\n                if (node.kind === 272) {\n                    var typeReferenceName = getTypeReferenceName(node);\n                    symbol = resolveTypeReferenceName(typeReferenceName);\n                    type = getTypeReferenceType(node, symbol);\n                }\n                else {\n                    var typeNameOrExpression = node.kind === 157\n                        ? node.typeName\n                        : ts.isEntityNameExpression(node.expression)\n                            ? node.expression\n                            : undefined;\n                    symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793064) || unknownSymbol;\n                    type = symbol === unknownSymbol ? unknownType :\n                        symbol.flags & (32 | 64) ? getTypeFromClassOrInterfaceReference(node, symbol) :\n                            symbol.flags & 524288 ? getTypeFromTypeAliasReference(node, symbol) :\n                                getTypeFromNonGenericTypeReference(node, symbol);\n                }\n                links.resolvedSymbol = symbol;\n                links.resolvedType = type;\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromTypeQueryNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getWidenedType(checkExpression(node.exprName));\n            }\n            return links.resolvedType;\n        }\n        function getTypeOfGlobalSymbol(symbol, arity) {\n            function getTypeDeclaration(symbol) {\n                var declarations = symbol.declarations;\n                for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) {\n                    var declaration = declarations_3[_i];\n                    switch (declaration.kind) {\n                        case 226:\n                        case 227:\n                        case 229:\n                            return declaration;\n                    }\n                }\n            }\n            if (!symbol) {\n                return arity ? emptyGenericType : emptyObjectType;\n            }\n            var type = getDeclaredTypeOfSymbol(symbol);\n            if (!(type.flags & 32768)) {\n                error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name);\n                return arity ? emptyGenericType : emptyObjectType;\n            }\n            if ((type.typeParameters ? type.typeParameters.length : 0) !== arity) {\n                error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbol.name, arity);\n                return arity ? emptyGenericType : emptyObjectType;\n            }\n            return type;\n        }\n        function getGlobalValueSymbol(name) {\n            return getGlobalSymbol(name, 107455, ts.Diagnostics.Cannot_find_global_value_0);\n        }\n        function getGlobalTypeSymbol(name) {\n            return getGlobalSymbol(name, 793064, ts.Diagnostics.Cannot_find_global_type_0);\n        }\n        function getGlobalSymbol(name, meaning, diagnostic) {\n            return resolveName(undefined, name, meaning, diagnostic, name);\n        }\n        function getGlobalType(name, arity) {\n            if (arity === void 0) { arity = 0; }\n            return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), arity);\n        }\n        function getExportedTypeFromNamespace(namespace, name) {\n            var namespaceSymbol = getGlobalSymbol(namespace, 1920, undefined);\n            var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793064);\n            return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol);\n        }\n        function createTypedPropertyDescriptorType(propertyType) {\n            var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType();\n            return globalTypedPropertyDescriptorType !== emptyGenericType\n                ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType])\n                : emptyObjectType;\n        }\n        function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) {\n            return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType;\n        }\n        function createIterableType(elementType) {\n            return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]);\n        }\n        function createIterableIteratorType(elementType) {\n            return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]);\n        }\n        function createArrayType(elementType) {\n            return createTypeFromGenericGlobalType(globalArrayType, [elementType]);\n        }\n        function getTypeFromArrayTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType));\n            }\n            return links.resolvedType;\n        }\n        function createTupleTypeOfArity(arity) {\n            var typeParameters = [];\n            var properties = [];\n            for (var i = 0; i < arity; i++) {\n                var typeParameter = createType(16384);\n                typeParameters.push(typeParameter);\n                var property = createSymbol(4 | 67108864, \"\" + i);\n                property.type = typeParameter;\n                properties.push(property);\n            }\n            var type = createObjectType(8 | 4);\n            type.typeParameters = typeParameters;\n            type.outerTypeParameters = undefined;\n            type.localTypeParameters = typeParameters;\n            type.instantiations = ts.createMap();\n            type.instantiations[getTypeListId(type.typeParameters)] = type;\n            type.target = type;\n            type.typeArguments = type.typeParameters;\n            type.thisType = createType(16384);\n            type.thisType.isThisType = true;\n            type.thisType.constraint = type;\n            type.declaredProperties = properties;\n            type.declaredCallSignatures = emptyArray;\n            type.declaredConstructSignatures = emptyArray;\n            type.declaredStringIndexInfo = undefined;\n            type.declaredNumberIndexInfo = undefined;\n            return type;\n        }\n        function getTupleTypeOfArity(arity) {\n            return tupleTypes[arity] || (tupleTypes[arity] = createTupleTypeOfArity(arity));\n        }\n        function createTupleType(elementTypes) {\n            return createTypeReference(getTupleTypeOfArity(elementTypes.length), elementTypes);\n        }\n        function getTypeFromTupleTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode));\n            }\n            return links.resolvedType;\n        }\n        function binarySearchTypes(types, type) {\n            var low = 0;\n            var high = types.length - 1;\n            var typeId = type.id;\n            while (low <= high) {\n                var middle = low + ((high - low) >> 1);\n                var id = types[middle].id;\n                if (id === typeId) {\n                    return middle;\n                }\n                else if (id > typeId) {\n                    high = middle - 1;\n                }\n                else {\n                    low = middle + 1;\n                }\n            }\n            return ~low;\n        }\n        function containsType(types, type) {\n            return binarySearchTypes(types, type) >= 0;\n        }\n        function addTypeToUnion(typeSet, type) {\n            var flags = type.flags;\n            if (flags & 65536) {\n                addTypesToUnion(typeSet, type.types);\n            }\n            else if (flags & 1) {\n                typeSet.containsAny = true;\n            }\n            else if (!strictNullChecks && flags & 6144) {\n                if (flags & 2048)\n                    typeSet.containsUndefined = true;\n                if (flags & 4096)\n                    typeSet.containsNull = true;\n                if (!(flags & 2097152))\n                    typeSet.containsNonWideningType = true;\n            }\n            else if (!(flags & 8192)) {\n                if (flags & 2)\n                    typeSet.containsString = true;\n                if (flags & 4)\n                    typeSet.containsNumber = true;\n                if (flags & 96)\n                    typeSet.containsStringOrNumberLiteral = true;\n                var len = typeSet.length;\n                var index = len && type.id > typeSet[len - 1].id ? ~len : binarySearchTypes(typeSet, type);\n                if (index < 0) {\n                    if (!(flags & 32768 && type.objectFlags & 16 &&\n                        type.symbol && type.symbol.flags & (16 | 8192) && containsIdenticalType(typeSet, type))) {\n                        typeSet.splice(~index, 0, type);\n                    }\n                }\n            }\n        }\n        function addTypesToUnion(typeSet, types) {\n            for (var _i = 0, types_4 = types; _i < types_4.length; _i++) {\n                var type = types_4[_i];\n                addTypeToUnion(typeSet, type);\n            }\n        }\n        function containsIdenticalType(types, type) {\n            for (var _i = 0, types_5 = types; _i < types_5.length; _i++) {\n                var t = types_5[_i];\n                if (isTypeIdenticalTo(t, type)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function isSubtypeOfAny(candidate, types) {\n            for (var i = 0, len = types.length; i < len; i++) {\n                if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function isSetOfLiteralsFromSameEnum(types) {\n            var first = types[0];\n            if (first.flags & 256) {\n                var firstEnum = getParentOfSymbol(first.symbol);\n                for (var i = 1; i < types.length; i++) {\n                    var other = types[i];\n                    if (!(other.flags & 256) || (firstEnum !== getParentOfSymbol(other.symbol))) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            return false;\n        }\n        function removeSubtypes(types) {\n            if (types.length === 0 || isSetOfLiteralsFromSameEnum(types)) {\n                return;\n            }\n            var i = types.length;\n            while (i > 0) {\n                i--;\n                if (isSubtypeOfAny(types[i], types)) {\n                    ts.orderedRemoveItemAt(types, i);\n                }\n            }\n        }\n        function removeRedundantLiteralTypes(types) {\n            var i = types.length;\n            while (i > 0) {\n                i--;\n                var t = types[i];\n                var remove = t.flags & 32 && types.containsString ||\n                    t.flags & 64 && types.containsNumber ||\n                    t.flags & 96 && t.flags & 1048576 && containsType(types, t.regularType);\n                if (remove) {\n                    ts.orderedRemoveItemAt(types, i);\n                }\n            }\n        }\n        function getUnionType(types, subtypeReduction, aliasSymbol, aliasTypeArguments) {\n            if (types.length === 0) {\n                return neverType;\n            }\n            if (types.length === 1) {\n                return types[0];\n            }\n            var typeSet = [];\n            addTypesToUnion(typeSet, types);\n            if (typeSet.containsAny) {\n                return anyType;\n            }\n            if (subtypeReduction) {\n                removeSubtypes(typeSet);\n            }\n            else if (typeSet.containsStringOrNumberLiteral) {\n                removeRedundantLiteralTypes(typeSet);\n            }\n            if (typeSet.length === 0) {\n                return typeSet.containsNull ? typeSet.containsNonWideningType ? nullType : nullWideningType :\n                    typeSet.containsUndefined ? typeSet.containsNonWideningType ? undefinedType : undefinedWideningType :\n                        neverType;\n            }\n            return getUnionTypeFromSortedList(typeSet, aliasSymbol, aliasTypeArguments);\n        }\n        function getUnionTypeFromSortedList(types, aliasSymbol, aliasTypeArguments) {\n            if (types.length === 0) {\n                return neverType;\n            }\n            if (types.length === 1) {\n                return types[0];\n            }\n            var id = getTypeListId(types);\n            var type = unionTypes[id];\n            if (!type) {\n                var propagatedFlags = getPropagatingFlagsOfTypes(types, 6144);\n                type = unionTypes[id] = createType(65536 | propagatedFlags);\n                type.types = types;\n                type.aliasSymbol = aliasSymbol;\n                type.aliasTypeArguments = aliasTypeArguments;\n            }\n            return type;\n        }\n        function getTypeFromUnionTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), false, getAliasSymbolForTypeNode(node), getAliasTypeArgumentsForTypeNode(node));\n            }\n            return links.resolvedType;\n        }\n        function addTypeToIntersection(typeSet, type) {\n            if (type.flags & 131072) {\n                addTypesToIntersection(typeSet, type.types);\n            }\n            else if (type.flags & 1) {\n                typeSet.containsAny = true;\n            }\n            else if (!(type.flags & 8192) && (strictNullChecks || !(type.flags & 6144)) && !ts.contains(typeSet, type)) {\n                if (type.flags & 65536 && typeSet.unionIndex === undefined) {\n                    typeSet.unionIndex = typeSet.length;\n                }\n                typeSet.push(type);\n            }\n        }\n        function addTypesToIntersection(typeSet, types) {\n            for (var _i = 0, types_6 = types; _i < types_6.length; _i++) {\n                var type = types_6[_i];\n                addTypeToIntersection(typeSet, type);\n            }\n        }\n        function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {\n            if (types.length === 0) {\n                return emptyObjectType;\n            }\n            var typeSet = [];\n            addTypesToIntersection(typeSet, types);\n            if (typeSet.containsAny) {\n                return anyType;\n            }\n            if (typeSet.length === 1) {\n                return typeSet[0];\n            }\n            var unionIndex = typeSet.unionIndex;\n            if (unionIndex !== undefined) {\n                var unionType = typeSet[unionIndex];\n                return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex, t)); }), false, aliasSymbol, aliasTypeArguments);\n            }\n            var id = getTypeListId(typeSet);\n            var type = intersectionTypes[id];\n            if (!type) {\n                var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 6144);\n                type = intersectionTypes[id] = createType(131072 | propagatedFlags);\n                type.types = typeSet;\n                type.aliasSymbol = aliasSymbol;\n                type.aliasTypeArguments = aliasTypeArguments;\n            }\n            return type;\n        }\n        function getTypeFromIntersectionTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), getAliasSymbolForTypeNode(node), getAliasTypeArgumentsForTypeNode(node));\n            }\n            return links.resolvedType;\n        }\n        function getIndexTypeForGenericType(type) {\n            if (!type.resolvedIndexType) {\n                type.resolvedIndexType = createType(262144);\n                type.resolvedIndexType.type = type;\n            }\n            return type.resolvedIndexType;\n        }\n        function getLiteralTypeFromPropertyName(prop) {\n            return getDeclarationModifierFlagsFromSymbol(prop) & 24 || ts.startsWith(prop.name, \"__@\") ?\n                neverType :\n                getLiteralTypeForText(32, ts.unescapeIdentifier(prop.name));\n        }\n        function getLiteralTypeFromPropertyNames(type) {\n            return getUnionType(ts.map(getPropertiesOfType(type), getLiteralTypeFromPropertyName));\n        }\n        function getIndexType(type) {\n            return maybeTypeOfKind(type, 540672) ? getIndexTypeForGenericType(type) :\n                getObjectFlags(type) & 32 ? getConstraintTypeFromMappedType(type) :\n                    type.flags & 1 || getIndexInfoOfType(type, 0) ? stringType :\n                        getLiteralTypeFromPropertyNames(type);\n        }\n        function getIndexTypeOrString(type) {\n            var indexType = getIndexType(type);\n            return indexType !== neverType ? indexType : stringType;\n        }\n        function getTypeFromTypeOperatorNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getIndexType(getTypeFromTypeNode(node.type));\n            }\n            return links.resolvedType;\n        }\n        function createIndexedAccessType(objectType, indexType) {\n            var type = createType(524288);\n            type.objectType = objectType;\n            type.indexType = indexType;\n            return type;\n        }\n        function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) {\n            var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined;\n            var propName = indexType.flags & (32 | 64 | 256) ?\n                indexType.text :\n                accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, false) ?\n                    ts.getPropertyNameForKnownSymbolName(accessExpression.argumentExpression.name.text) :\n                    undefined;\n            if (propName) {\n                var prop = getPropertyOfType(objectType, propName);\n                if (prop) {\n                    if (accessExpression) {\n                        if (ts.isAssignmentTarget(accessExpression) && (isReferenceToReadonlyEntity(accessExpression, prop) || isReferenceThroughNamespaceImport(accessExpression))) {\n                            error(accessExpression.argumentExpression, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(prop));\n                            return unknownType;\n                        }\n                        if (cacheSymbol) {\n                            getNodeLinks(accessNode).resolvedSymbol = prop;\n                        }\n                    }\n                    return getTypeOfSymbol(prop);\n                }\n            }\n            if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 262178 | 340 | 512)) {\n                if (isTypeAny(objectType)) {\n                    return anyType;\n                }\n                var indexInfo = isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340) && getIndexInfoOfType(objectType, 1) ||\n                    getIndexInfoOfType(objectType, 0) ||\n                    undefined;\n                if (indexInfo) {\n                    if (accessExpression && ts.isAssignmentTarget(accessExpression) && indexInfo.isReadonly) {\n                        error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));\n                        return unknownType;\n                    }\n                    return indexInfo.type;\n                }\n                if (accessExpression && !isConstEnumObjectType(objectType)) {\n                    if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) {\n                        if (getIndexTypeOfType(objectType, 1)) {\n                            error(accessExpression.argumentExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number);\n                        }\n                        else {\n                            error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(objectType));\n                        }\n                    }\n                    return anyType;\n                }\n            }\n            if (accessNode) {\n                var indexNode = accessNode.kind === 178 ? accessNode.argumentExpression : accessNode.indexType;\n                if (indexType.flags & (32 | 64)) {\n                    error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.text, typeToString(objectType));\n                }\n                else if (indexType.flags & (2 | 4)) {\n                    error(indexNode, ts.Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType));\n                }\n                else {\n                    error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));\n                }\n            }\n            return unknownType;\n        }\n        function getIndexedAccessForMappedType(type, indexType, accessNode) {\n            var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined;\n            if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) {\n                error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type));\n                return unknownType;\n            }\n            var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType);\n            var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper;\n            return instantiateType(getTemplateTypeFromMappedType(type), templateMapper);\n        }\n        function getIndexedAccessType(objectType, indexType, accessNode) {\n            if (maybeTypeOfKind(indexType, 540672 | 262144) || isGenericMappedType(objectType)) {\n                if (objectType.flags & 1) {\n                    return objectType;\n                }\n                if (accessNode) {\n                    if (!isTypeAssignableTo(indexType, getIndexType(objectType))) {\n                        error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));\n                        return unknownType;\n                    }\n                }\n                if (isGenericMappedType(objectType)) {\n                    return getIndexedAccessForMappedType(objectType, indexType, accessNode);\n                }\n                var id = objectType.id + \",\" + indexType.id;\n                return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType));\n            }\n            var apparentObjectType = getApparentType(objectType);\n            if (indexType.flags & 65536 && !(indexType.flags & 8190)) {\n                var propTypes = [];\n                for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) {\n                    var t = _a[_i];\n                    var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, false);\n                    if (propType === unknownType) {\n                        return unknownType;\n                    }\n                    propTypes.push(propType);\n                }\n                return getUnionType(propTypes);\n            }\n            return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, true);\n        }\n        function getTypeFromIndexedAccessTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getIndexedAccessType(getTypeFromTypeNode(node.objectType), getTypeFromTypeNode(node.indexType), node);\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromMappedTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                var type = createObjectType(32, node.symbol);\n                type.declaration = node;\n                type.aliasSymbol = getAliasSymbolForTypeNode(node);\n                type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node);\n                links.resolvedType = type;\n                getConstraintTypeFromMappedType(type);\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                var aliasSymbol = getAliasSymbolForTypeNode(node);\n                if (ts.isEmpty(node.symbol.members) && !aliasSymbol) {\n                    links.resolvedType = emptyTypeLiteralType;\n                }\n                else {\n                    var type = createObjectType(16, node.symbol);\n                    type.aliasSymbol = aliasSymbol;\n                    type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node);\n                    links.resolvedType = type;\n                }\n            }\n            return links.resolvedType;\n        }\n        function getAliasSymbolForTypeNode(node) {\n            return node.parent.kind === 228 ? getSymbolOfNode(node.parent) : undefined;\n        }\n        function getAliasTypeArgumentsForTypeNode(node) {\n            var symbol = getAliasSymbolForTypeNode(node);\n            return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : undefined;\n        }\n        function getSpreadType(left, right, isFromObjectLiteral) {\n            if (left.flags & 1 || right.flags & 1) {\n                return anyType;\n            }\n            left = filterType(left, function (t) { return !(t.flags & 6144); });\n            if (left.flags & 8192) {\n                return right;\n            }\n            right = filterType(right, function (t) { return !(t.flags & 6144); });\n            if (right.flags & 8192) {\n                return left;\n            }\n            if (left.flags & 65536) {\n                return mapType(left, function (t) { return getSpreadType(t, right, isFromObjectLiteral); });\n            }\n            if (right.flags & 65536) {\n                return mapType(right, function (t) { return getSpreadType(left, t, isFromObjectLiteral); });\n            }\n            var members = ts.createMap();\n            var skippedPrivateMembers = ts.createMap();\n            var stringIndexInfo;\n            var numberIndexInfo;\n            if (left === emptyObjectType) {\n                stringIndexInfo = getIndexInfoOfType(right, 0);\n                numberIndexInfo = getIndexInfoOfType(right, 1);\n            }\n            else {\n                stringIndexInfo = unionSpreadIndexInfos(getIndexInfoOfType(left, 0), getIndexInfoOfType(right, 0));\n                numberIndexInfo = unionSpreadIndexInfos(getIndexInfoOfType(left, 1), getIndexInfoOfType(right, 1));\n            }\n            for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) {\n                var rightProp = _a[_i];\n                var isOwnProperty = !(rightProp.flags & 8192) || isFromObjectLiteral;\n                var isSetterWithoutGetter = rightProp.flags & 65536 && !(rightProp.flags & 32768);\n                if (getDeclarationModifierFlagsFromSymbol(rightProp) & (8 | 16)) {\n                    skippedPrivateMembers[rightProp.name] = true;\n                }\n                else if (isOwnProperty && !isSetterWithoutGetter) {\n                    members[rightProp.name] = rightProp;\n                }\n            }\n            for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) {\n                var leftProp = _c[_b];\n                if (leftProp.flags & 65536 && !(leftProp.flags & 32768)\n                    || leftProp.name in skippedPrivateMembers) {\n                    continue;\n                }\n                if (leftProp.name in members) {\n                    var rightProp = members[leftProp.name];\n                    var rightType = getTypeOfSymbol(rightProp);\n                    if (maybeTypeOfKind(rightType, 2048) || rightProp.flags & 536870912) {\n                        var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations);\n                        var flags = 4 | 67108864 | (leftProp.flags & 536870912);\n                        var result = createSymbol(flags, leftProp.name);\n                        result.type = getUnionType([getTypeOfSymbol(leftProp), getTypeWithFacts(rightType, 131072)]);\n                        result.leftSpread = leftProp;\n                        result.rightSpread = rightProp;\n                        result.declarations = declarations;\n                        result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp);\n                        members[leftProp.name] = result;\n                    }\n                }\n                else {\n                    members[leftProp.name] = leftProp;\n                }\n            }\n            return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);\n        }\n        function createLiteralType(flags, text) {\n            var type = createType(flags);\n            type.text = text;\n            return type;\n        }\n        function getFreshTypeOfLiteralType(type) {\n            if (type.flags & 96 && !(type.flags & 1048576)) {\n                if (!type.freshType) {\n                    var freshType = createLiteralType(type.flags | 1048576, type.text);\n                    freshType.regularType = type;\n                    type.freshType = freshType;\n                }\n                return type.freshType;\n            }\n            return type;\n        }\n        function getRegularTypeOfLiteralType(type) {\n            return type.flags & 96 && type.flags & 1048576 ? type.regularType : type;\n        }\n        function getLiteralTypeForText(flags, text) {\n            var map = flags & 32 ? stringLiteralTypes : numericLiteralTypes;\n            return map[text] || (map[text] = createLiteralType(flags, text));\n        }\n        function getTypeFromLiteralTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getRegularTypeOfLiteralType(checkExpression(node.literal));\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromJSDocVariadicType(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                var type = getTypeFromTypeNode(node.type);\n                links.resolvedType = type ? createArrayType(type) : unknownType;\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromJSDocTupleType(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                var types = ts.map(node.types, getTypeFromTypeNode);\n                links.resolvedType = createTupleType(types);\n            }\n            return links.resolvedType;\n        }\n        function getThisType(node) {\n            var container = ts.getThisContainer(node, false);\n            var parent = container && container.parent;\n            if (parent && (ts.isClassLike(parent) || parent.kind === 227)) {\n                if (!(ts.getModifierFlags(container) & 32) &&\n                    (container.kind !== 150 || ts.isNodeDescendantOf(node, container.body))) {\n                    return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType;\n                }\n            }\n            error(node, ts.Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface);\n            return unknownType;\n        }\n        function getTypeFromThisTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getThisType(node);\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromTypeNode(node) {\n            switch (node.kind) {\n                case 118:\n                case 263:\n                case 264:\n                    return anyType;\n                case 134:\n                    return stringType;\n                case 132:\n                    return numberType;\n                case 121:\n                    return booleanType;\n                case 135:\n                    return esSymbolType;\n                case 104:\n                    return voidType;\n                case 137:\n                    return undefinedType;\n                case 94:\n                    return nullType;\n                case 129:\n                    return neverType;\n                case 289:\n                    return nullType;\n                case 290:\n                    return undefinedType;\n                case 291:\n                    return neverType;\n                case 167:\n                case 98:\n                    return getTypeFromThisTypeNode(node);\n                case 171:\n                    return getTypeFromLiteralTypeNode(node);\n                case 288:\n                    return getTypeFromLiteralTypeNode(node.literal);\n                case 157:\n                case 272:\n                    return getTypeFromTypeReference(node);\n                case 156:\n                    return booleanType;\n                case 199:\n                    return getTypeFromTypeReference(node);\n                case 160:\n                    return getTypeFromTypeQueryNode(node);\n                case 162:\n                case 265:\n                    return getTypeFromArrayTypeNode(node);\n                case 163:\n                    return getTypeFromTupleTypeNode(node);\n                case 164:\n                case 266:\n                    return getTypeFromUnionTypeNode(node);\n                case 165:\n                    return getTypeFromIntersectionTypeNode(node);\n                case 166:\n                case 268:\n                case 269:\n                case 276:\n                case 277:\n                case 273:\n                    return getTypeFromTypeNode(node.type);\n                case 270:\n                    return getTypeFromTypeNode(node.literal);\n                case 158:\n                case 159:\n                case 161:\n                case 287:\n                case 274:\n                    return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);\n                case 168:\n                    return getTypeFromTypeOperatorNode(node);\n                case 169:\n                    return getTypeFromIndexedAccessTypeNode(node);\n                case 170:\n                    return getTypeFromMappedTypeNode(node);\n                case 70:\n                case 141:\n                    var symbol = getSymbolAtLocation(node);\n                    return symbol && getDeclaredTypeOfSymbol(symbol);\n                case 267:\n                    return getTypeFromJSDocTupleType(node);\n                case 275:\n                    return getTypeFromJSDocVariadicType(node);\n                default:\n                    return unknownType;\n            }\n        }\n        function instantiateList(items, mapper, instantiator) {\n            if (items && items.length) {\n                var result = [];\n                for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {\n                    var v = items_1[_i];\n                    result.push(instantiator(v, mapper));\n                }\n                return result;\n            }\n            return items;\n        }\n        function instantiateTypes(types, mapper) {\n            return instantiateList(types, mapper, instantiateType);\n        }\n        function instantiateSignatures(signatures, mapper) {\n            return instantiateList(signatures, mapper, instantiateSignature);\n        }\n        function instantiateCached(type, mapper, instantiator) {\n            var instantiations = mapper.instantiations || (mapper.instantiations = []);\n            return instantiations[type.id] || (instantiations[type.id] = instantiator(type, mapper));\n        }\n        function createUnaryTypeMapper(source, target) {\n            return function (t) { return t === source ? target : t; };\n        }\n        function createBinaryTypeMapper(source1, target1, source2, target2) {\n            return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; };\n        }\n        function createArrayTypeMapper(sources, targets) {\n            return function (t) {\n                for (var i = 0; i < sources.length; i++) {\n                    if (t === sources[i]) {\n                        return targets ? targets[i] : anyType;\n                    }\n                }\n                return t;\n            };\n        }\n        function createTypeMapper(sources, targets) {\n            var count = sources.length;\n            var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) :\n                count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) :\n                    createArrayTypeMapper(sources, targets);\n            mapper.mappedTypes = sources;\n            return mapper;\n        }\n        function createTypeEraser(sources) {\n            return createTypeMapper(sources, undefined);\n        }\n        function getInferenceMapper(context) {\n            if (!context.mapper) {\n                var mapper = function (t) {\n                    var typeParameters = context.signature.typeParameters;\n                    for (var i = 0; i < typeParameters.length; i++) {\n                        if (t === typeParameters[i]) {\n                            context.inferences[i].isFixed = true;\n                            return getInferredType(context, i);\n                        }\n                    }\n                    return t;\n                };\n                mapper.mappedTypes = context.signature.typeParameters;\n                mapper.context = context;\n                context.mapper = mapper;\n            }\n            return context.mapper;\n        }\n        function identityMapper(type) {\n            return type;\n        }\n        function combineTypeMappers(mapper1, mapper2) {\n            var mapper = function (t) { return instantiateType(mapper1(t), mapper2); };\n            mapper.mappedTypes = mapper1.mappedTypes;\n            return mapper;\n        }\n        function cloneTypeParameter(typeParameter) {\n            var result = createType(16384);\n            result.symbol = typeParameter.symbol;\n            result.target = typeParameter;\n            return result;\n        }\n        function cloneTypePredicate(predicate, mapper) {\n            if (ts.isIdentifierTypePredicate(predicate)) {\n                return {\n                    kind: 1,\n                    parameterName: predicate.parameterName,\n                    parameterIndex: predicate.parameterIndex,\n                    type: instantiateType(predicate.type, mapper)\n                };\n            }\n            else {\n                return {\n                    kind: 0,\n                    type: instantiateType(predicate.type, mapper)\n                };\n            }\n        }\n        function instantiateSignature(signature, mapper, eraseTypeParameters) {\n            var freshTypeParameters;\n            var freshTypePredicate;\n            if (signature.typeParameters && !eraseTypeParameters) {\n                freshTypeParameters = ts.map(signature.typeParameters, cloneTypeParameter);\n                mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper);\n                for (var _i = 0, freshTypeParameters_1 = freshTypeParameters; _i < freshTypeParameters_1.length; _i++) {\n                    var tp = freshTypeParameters_1[_i];\n                    tp.mapper = mapper;\n                }\n            }\n            if (signature.typePredicate) {\n                freshTypePredicate = cloneTypePredicate(signature.typePredicate, mapper);\n            }\n            var result = createSignature(signature.declaration, freshTypeParameters, signature.thisParameter && instantiateSymbol(signature.thisParameter, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasLiteralTypes);\n            result.target = signature;\n            result.mapper = mapper;\n            return result;\n        }\n        function instantiateSymbol(symbol, mapper) {\n            if (symbol.flags & 16777216) {\n                var links = getSymbolLinks(symbol);\n                symbol = links.target;\n                mapper = combineTypeMappers(links.mapper, mapper);\n            }\n            var result = createSymbol(16777216 | 67108864 | symbol.flags, symbol.name);\n            result.declarations = symbol.declarations;\n            result.parent = symbol.parent;\n            result.target = symbol;\n            result.mapper = mapper;\n            if (symbol.valueDeclaration) {\n                result.valueDeclaration = symbol.valueDeclaration;\n            }\n            return result;\n        }\n        function instantiateAnonymousType(type, mapper) {\n            var result = createObjectType(16 | 64, type.symbol);\n            result.target = type.objectFlags & 64 ? type.target : type;\n            result.mapper = type.objectFlags & 64 ? combineTypeMappers(type.mapper, mapper) : mapper;\n            result.aliasSymbol = type.aliasSymbol;\n            result.aliasTypeArguments = instantiateTypes(type.aliasTypeArguments, mapper);\n            return result;\n        }\n        function instantiateMappedType(type, mapper) {\n            var constraintType = getConstraintTypeFromMappedType(type);\n            if (constraintType.flags & 262144) {\n                var typeVariable_1 = constraintType.type;\n                var mappedTypeVariable = instantiateType(typeVariable_1, mapper);\n                if (typeVariable_1 !== mappedTypeVariable) {\n                    return mapType(mappedTypeVariable, function (t) {\n                        if (isMappableType(t)) {\n                            var replacementMapper = createUnaryTypeMapper(typeVariable_1, t);\n                            var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper);\n                            combinedMapper.mappedTypes = mapper.mappedTypes;\n                            return instantiateMappedObjectType(type, combinedMapper);\n                        }\n                        return t;\n                    });\n                }\n            }\n            return instantiateMappedObjectType(type, mapper);\n        }\n        function isMappableType(type) {\n            return type.flags & (16384 | 32768 | 131072 | 524288);\n        }\n        function instantiateMappedObjectType(type, mapper) {\n            var result = createObjectType(32 | 64, type.symbol);\n            result.declaration = type.declaration;\n            result.mapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper;\n            result.aliasSymbol = type.aliasSymbol;\n            result.aliasTypeArguments = instantiateTypes(type.aliasTypeArguments, mapper);\n            return result;\n        }\n        function isSymbolInScopeOfMappedTypeParameter(symbol, mapper) {\n            if (!(symbol.declarations && symbol.declarations.length)) {\n                return false;\n            }\n            var mappedTypes = mapper.mappedTypes;\n            var node = symbol.declarations[0].parent;\n            while (node) {\n                switch (node.kind) {\n                    case 158:\n                    case 159:\n                    case 225:\n                    case 149:\n                    case 148:\n                    case 150:\n                    case 153:\n                    case 154:\n                    case 155:\n                    case 151:\n                    case 152:\n                    case 184:\n                    case 185:\n                    case 226:\n                    case 197:\n                    case 227:\n                    case 228:\n                        var declaration = node;\n                        if (declaration.typeParameters) {\n                            for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) {\n                                var d = _a[_i];\n                                if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) {\n                                    return true;\n                                }\n                            }\n                        }\n                        if (ts.isClassLike(node) || node.kind === 227) {\n                            var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType;\n                            if (thisType && ts.contains(mappedTypes, thisType)) {\n                                return true;\n                            }\n                        }\n                        break;\n                    case 230:\n                    case 261:\n                        return false;\n                }\n                node = node.parent;\n            }\n            return false;\n        }\n        function isTopLevelTypeAlias(symbol) {\n            if (symbol.declarations && symbol.declarations.length) {\n                var parentKind = symbol.declarations[0].parent.kind;\n                return parentKind === 261 || parentKind === 231;\n            }\n            return false;\n        }\n        function instantiateType(type, mapper) {\n            if (type && mapper !== identityMapper) {\n                if (type.aliasSymbol && isTopLevelTypeAlias(type.aliasSymbol)) {\n                    if (type.aliasTypeArguments) {\n                        return getTypeAliasInstantiation(type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));\n                    }\n                    return type;\n                }\n                return instantiateTypeNoAlias(type, mapper);\n            }\n            return type;\n        }\n        function instantiateTypeNoAlias(type, mapper) {\n            if (type.flags & 16384) {\n                return mapper(type);\n            }\n            if (type.flags & 32768) {\n                if (type.objectFlags & 16) {\n                    return type.symbol &&\n                        type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) &&\n                        (type.objectFlags & 64 || isSymbolInScopeOfMappedTypeParameter(type.symbol, mapper)) ?\n                        instantiateCached(type, mapper, instantiateAnonymousType) : type;\n                }\n                if (type.objectFlags & 32) {\n                    return instantiateCached(type, mapper, instantiateMappedType);\n                }\n                if (type.objectFlags & 4) {\n                    return createTypeReference(type.target, instantiateTypes(type.typeArguments, mapper));\n                }\n            }\n            if (type.flags & 65536 && !(type.flags & 8190)) {\n                return getUnionType(instantiateTypes(type.types, mapper), false, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));\n            }\n            if (type.flags & 131072) {\n                return getIntersectionType(instantiateTypes(type.types, mapper), type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));\n            }\n            if (type.flags & 262144) {\n                return getIndexType(instantiateType(type.type, mapper));\n            }\n            if (type.flags & 524288) {\n                return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper));\n            }\n            return type;\n        }\n        function instantiateIndexInfo(info, mapper) {\n            return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration);\n        }\n        function isContextSensitive(node) {\n            ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node));\n            switch (node.kind) {\n                case 184:\n                case 185:\n                    return isContextSensitiveFunctionLikeDeclaration(node);\n                case 176:\n                    return ts.forEach(node.properties, isContextSensitive);\n                case 175:\n                    return ts.forEach(node.elements, isContextSensitive);\n                case 193:\n                    return isContextSensitive(node.whenTrue) ||\n                        isContextSensitive(node.whenFalse);\n                case 192:\n                    return node.operatorToken.kind === 53 &&\n                        (isContextSensitive(node.left) || isContextSensitive(node.right));\n                case 257:\n                    return isContextSensitive(node.initializer);\n                case 149:\n                case 148:\n                    return isContextSensitiveFunctionLikeDeclaration(node);\n                case 183:\n                    return isContextSensitive(node.expression);\n            }\n            return false;\n        }\n        function isContextSensitiveFunctionLikeDeclaration(node) {\n            if (node.typeParameters) {\n                return false;\n            }\n            if (ts.forEach(node.parameters, function (p) { return !p.type; })) {\n                return true;\n            }\n            if (node.kind === 185) {\n                return false;\n            }\n            var parameter = ts.firstOrUndefined(node.parameters);\n            return !(parameter && ts.parameterIsThisKeyword(parameter));\n        }\n        function isContextSensitiveFunctionOrObjectLiteralMethod(func) {\n            return (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);\n        }\n        function getTypeWithoutSignatures(type) {\n            if (type.flags & 32768) {\n                var resolved = resolveStructuredTypeMembers(type);\n                if (resolved.constructSignatures.length) {\n                    var result = createObjectType(16, type.symbol);\n                    result.members = resolved.members;\n                    result.properties = resolved.properties;\n                    result.callSignatures = emptyArray;\n                    result.constructSignatures = emptyArray;\n                    type = result;\n                }\n            }\n            return type;\n        }\n        function isTypeIdenticalTo(source, target) {\n            return isTypeRelatedTo(source, target, identityRelation);\n        }\n        function compareTypesIdentical(source, target) {\n            return isTypeRelatedTo(source, target, identityRelation) ? -1 : 0;\n        }\n        function compareTypesAssignable(source, target) {\n            return isTypeRelatedTo(source, target, assignableRelation) ? -1 : 0;\n        }\n        function isTypeSubtypeOf(source, target) {\n            return isTypeRelatedTo(source, target, subtypeRelation);\n        }\n        function isTypeAssignableTo(source, target) {\n            return isTypeRelatedTo(source, target, assignableRelation);\n        }\n        function isTypeInstanceOf(source, target) {\n            return source === target || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target);\n        }\n        function isTypeComparableTo(source, target) {\n            return isTypeRelatedTo(source, target, comparableRelation);\n        }\n        function areTypesComparable(type1, type2) {\n            return isTypeComparableTo(type1, type2) || isTypeComparableTo(type2, type1);\n        }\n        function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) {\n            return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain);\n        }\n        function checkTypeAssignableTo(source, target, errorNode, headMessage, containingMessageChain) {\n            return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain);\n        }\n        function checkTypeComparableTo(source, target, errorNode, headMessage, containingMessageChain) {\n            return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain);\n        }\n        function isSignatureAssignableTo(source, target, ignoreReturnTypes) {\n            return compareSignaturesRelated(source, target, ignoreReturnTypes, false, undefined, compareTypesAssignable) !== 0;\n        }\n        function compareSignaturesRelated(source, target, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) {\n            if (source === target) {\n                return -1;\n            }\n            if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) {\n                return 0;\n            }\n            source = getErasedSignature(source);\n            target = getErasedSignature(target);\n            var result = -1;\n            var sourceThisType = getThisTypeOfSignature(source);\n            if (sourceThisType && sourceThisType !== voidType) {\n                var targetThisType = getThisTypeOfSignature(target);\n                if (targetThisType) {\n                    var related = compareTypes(sourceThisType, targetThisType, false)\n                        || compareTypes(targetThisType, sourceThisType, reportErrors);\n                    if (!related) {\n                        if (reportErrors) {\n                            errorReporter(ts.Diagnostics.The_this_types_of_each_signature_are_incompatible);\n                        }\n                        return 0;\n                    }\n                    result &= related;\n                }\n            }\n            var sourceMax = getNumNonRestParameters(source);\n            var targetMax = getNumNonRestParameters(target);\n            var checkCount = getNumParametersToCheckForSignatureRelatability(source, sourceMax, target, targetMax);\n            var sourceParams = source.parameters;\n            var targetParams = target.parameters;\n            for (var i = 0; i < checkCount; i++) {\n                var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source);\n                var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target);\n                var related = compareTypes(s, t, false) || compareTypes(t, s, reportErrors);\n                if (!related) {\n                    if (reportErrors) {\n                        errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name);\n                    }\n                    return 0;\n                }\n                result &= related;\n            }\n            if (!ignoreReturnTypes) {\n                var targetReturnType = getReturnTypeOfSignature(target);\n                if (targetReturnType === voidType) {\n                    return result;\n                }\n                var sourceReturnType = getReturnTypeOfSignature(source);\n                if (target.typePredicate) {\n                    if (source.typePredicate) {\n                        result &= compareTypePredicateRelatedTo(source.typePredicate, target.typePredicate, reportErrors, errorReporter, compareTypes);\n                    }\n                    else if (ts.isIdentifierTypePredicate(target.typePredicate)) {\n                        if (reportErrors) {\n                            errorReporter(ts.Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source));\n                        }\n                        return 0;\n                    }\n                }\n                else {\n                    result &= compareTypes(sourceReturnType, targetReturnType, reportErrors);\n                }\n            }\n            return result;\n        }\n        function compareTypePredicateRelatedTo(source, target, reportErrors, errorReporter, compareTypes) {\n            if (source.kind !== target.kind) {\n                if (reportErrors) {\n                    errorReporter(ts.Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard);\n                    errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target));\n                }\n                return 0;\n            }\n            if (source.kind === 1) {\n                var sourceIdentifierPredicate = source;\n                var targetIdentifierPredicate = target;\n                if (sourceIdentifierPredicate.parameterIndex !== targetIdentifierPredicate.parameterIndex) {\n                    if (reportErrors) {\n                        errorReporter(ts.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, sourceIdentifierPredicate.parameterName, targetIdentifierPredicate.parameterName);\n                        errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target));\n                    }\n                    return 0;\n                }\n            }\n            var related = compareTypes(source.type, target.type, reportErrors);\n            if (related === 0 && reportErrors) {\n                errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target));\n            }\n            return related;\n        }\n        function isImplementationCompatibleWithOverload(implementation, overload) {\n            var erasedSource = getErasedSignature(implementation);\n            var erasedTarget = getErasedSignature(overload);\n            var sourceReturnType = getReturnTypeOfSignature(erasedSource);\n            var targetReturnType = getReturnTypeOfSignature(erasedTarget);\n            if (targetReturnType === voidType\n                || isTypeRelatedTo(targetReturnType, sourceReturnType, assignableRelation)\n                || isTypeRelatedTo(sourceReturnType, targetReturnType, assignableRelation)) {\n                return isSignatureAssignableTo(erasedSource, erasedTarget, true);\n            }\n            return false;\n        }\n        function getNumNonRestParameters(signature) {\n            var numParams = signature.parameters.length;\n            return signature.hasRestParameter ?\n                numParams - 1 :\n                numParams;\n        }\n        function getNumParametersToCheckForSignatureRelatability(source, sourceNonRestParamCount, target, targetNonRestParamCount) {\n            if (source.hasRestParameter === target.hasRestParameter) {\n                if (source.hasRestParameter) {\n                    return Math.max(sourceNonRestParamCount, targetNonRestParamCount) + 1;\n                }\n                else {\n                    return Math.min(sourceNonRestParamCount, targetNonRestParamCount);\n                }\n            }\n            else {\n                return source.hasRestParameter ?\n                    targetNonRestParamCount :\n                    sourceNonRestParamCount;\n            }\n        }\n        function isEnumTypeRelatedTo(source, target, errorReporter) {\n            if (source === target) {\n                return true;\n            }\n            var id = source.id + \",\" + target.id;\n            if (enumRelation[id] !== undefined) {\n                return enumRelation[id];\n            }\n            if (source.symbol.name !== target.symbol.name ||\n                !(source.symbol.flags & 256) || !(target.symbol.flags & 256) ||\n                (source.flags & 65536) !== (target.flags & 65536)) {\n                return enumRelation[id] = false;\n            }\n            var targetEnumType = getTypeOfSymbol(target.symbol);\n            for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) {\n                var property = _a[_i];\n                if (property.flags & 8) {\n                    var targetProperty = getPropertyOfType(targetEnumType, property.name);\n                    if (!targetProperty || !(targetProperty.flags & 8)) {\n                        if (errorReporter) {\n                            errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128));\n                        }\n                        return enumRelation[id] = false;\n                    }\n                }\n            }\n            return enumRelation[id] = true;\n        }\n        function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {\n            if (target.flags & 8192)\n                return false;\n            if (target.flags & 1 || source.flags & 8192)\n                return true;\n            if (source.flags & 262178 && target.flags & 2)\n                return true;\n            if (source.flags & 340 && target.flags & 4)\n                return true;\n            if (source.flags & 136 && target.flags & 8)\n                return true;\n            if (source.flags & 256 && target.flags & 16 && source.baseType === target)\n                return true;\n            if (source.flags & 16 && target.flags & 16 && isEnumTypeRelatedTo(source, target, errorReporter))\n                return true;\n            if (source.flags & 2048 && (!strictNullChecks || target.flags & (2048 | 1024)))\n                return true;\n            if (source.flags & 4096 && (!strictNullChecks || target.flags & 4096))\n                return true;\n            if (relation === assignableRelation || relation === comparableRelation) {\n                if (source.flags & 1)\n                    return true;\n                if ((source.flags & 4 | source.flags & 64) && target.flags & 272)\n                    return true;\n                if (source.flags & 256 &&\n                    target.flags & 256 &&\n                    source.text === target.text &&\n                    isEnumTypeRelatedTo(source.baseType, target.baseType, errorReporter)) {\n                    return true;\n                }\n                if (source.flags & 256 &&\n                    target.flags & 16 &&\n                    isEnumTypeRelatedTo(target, source.baseType, errorReporter)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function isTypeRelatedTo(source, target, relation) {\n            if (source.flags & 96 && source.flags & 1048576) {\n                source = source.regularType;\n            }\n            if (target.flags & 96 && target.flags & 1048576) {\n                target = target.regularType;\n            }\n            if (source === target || relation !== identityRelation && isSimpleTypeRelatedTo(source, target, relation)) {\n                return true;\n            }\n            if (source.flags & 32768 && target.flags & 32768) {\n                var id = relation !== identityRelation || source.id < target.id ? source.id + \",\" + target.id : target.id + \",\" + source.id;\n                var related = relation[id];\n                if (related !== undefined) {\n                    return related === 1;\n                }\n            }\n            if (source.flags & 507904 || target.flags & 507904) {\n                return checkTypeRelatedTo(source, target, relation, undefined, undefined, undefined);\n            }\n            return false;\n        }\n        function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain) {\n            var errorInfo;\n            var sourceStack;\n            var targetStack;\n            var maybeStack;\n            var expandingFlags;\n            var depth = 0;\n            var overflow = false;\n            ts.Debug.assert(relation !== identityRelation || !errorNode, \"no error reporting in identity checking\");\n            var result = isRelatedTo(source, target, !!errorNode, headMessage);\n            if (overflow) {\n                error(errorNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));\n            }\n            else if (errorInfo) {\n                if (containingMessageChain) {\n                    errorInfo = ts.concatenateDiagnosticMessageChains(containingMessageChain, errorInfo);\n                }\n                diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo));\n            }\n            return result !== 0;\n            function reportError(message, arg0, arg1, arg2) {\n                ts.Debug.assert(!!errorNode);\n                errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2);\n            }\n            function reportRelationError(message, source, target) {\n                var sourceType = typeToString(source);\n                var targetType = typeToString(target);\n                if (sourceType === targetType) {\n                    sourceType = typeToString(source, undefined, 128);\n                    targetType = typeToString(target, undefined, 128);\n                }\n                if (!message) {\n                    if (relation === comparableRelation) {\n                        message = ts.Diagnostics.Type_0_is_not_comparable_to_type_1;\n                    }\n                    else if (sourceType === targetType) {\n                        message = ts.Diagnostics.Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated;\n                    }\n                    else {\n                        message = ts.Diagnostics.Type_0_is_not_assignable_to_type_1;\n                    }\n                }\n                reportError(message, sourceType, targetType);\n            }\n            function tryElaborateErrorsForPrimitivesAndObjects(source, target) {\n                var sourceType = typeToString(source);\n                var targetType = typeToString(target);\n                if ((globalStringType === source && stringType === target) ||\n                    (globalNumberType === source && numberType === target) ||\n                    (globalBooleanType === source && booleanType === target) ||\n                    (getGlobalESSymbolType() === source && esSymbolType === target)) {\n                    reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);\n                }\n            }\n            function isRelatedTo(source, target, reportErrors, headMessage) {\n                var result;\n                if (source.flags & 96 && source.flags & 1048576) {\n                    source = source.regularType;\n                }\n                if (target.flags & 96 && target.flags & 1048576) {\n                    target = target.regularType;\n                }\n                if (source === target)\n                    return -1;\n                if (relation === identityRelation) {\n                    return isIdenticalTo(source, target);\n                }\n                if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))\n                    return -1;\n                if (getObjectFlags(source) & 128 && source.flags & 1048576) {\n                    if (hasExcessProperties(source, target, reportErrors)) {\n                        if (reportErrors) {\n                            reportRelationError(headMessage, source, target);\n                        }\n                        return 0;\n                    }\n                    if (target.flags & 196608) {\n                        source = getRegularTypeOfObjectLiteral(source);\n                    }\n                }\n                var saveErrorInfo = errorInfo;\n                if (source.flags & 65536) {\n                    if (relation === comparableRelation) {\n                        result = someTypeRelatedToType(source, target, reportErrors && !(source.flags & 8190));\n                    }\n                    else {\n                        result = eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 8190));\n                    }\n                    if (result) {\n                        return result;\n                    }\n                }\n                else if (target.flags & 65536) {\n                    if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 8190) && !(target.flags & 8190))) {\n                        return result;\n                    }\n                }\n                else if (target.flags & 131072) {\n                    if (result = typeRelatedToEachType(source, target, reportErrors)) {\n                        return result;\n                    }\n                }\n                else if (source.flags & 131072) {\n                    if (result = someTypeRelatedToType(source, target, false)) {\n                        return result;\n                    }\n                }\n                if (target.flags & 16384) {\n                    if (getObjectFlags(source) & 32 && getConstraintTypeFromMappedType(source) === getIndexType(target)) {\n                        if (!source.declaration.questionToken) {\n                            var templateType = getTemplateTypeFromMappedType(source);\n                            var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source));\n                            if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) {\n                                return result;\n                            }\n                        }\n                    }\n                    else {\n                        var constraint = getConstraintOfTypeParameter(target);\n                        if (constraint && constraint.flags & 262144) {\n                            if (result = isRelatedTo(source, constraint, reportErrors)) {\n                                return result;\n                            }\n                        }\n                    }\n                }\n                else if (target.flags & 262144) {\n                    if (source.flags & 262144) {\n                        if (result = isRelatedTo(target.type, source.type, false)) {\n                            return result;\n                        }\n                    }\n                    if (target.type.flags & 16384) {\n                        var constraint = getConstraintOfTypeParameter(target.type);\n                        if (constraint) {\n                            if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) {\n                                return result;\n                            }\n                        }\n                    }\n                }\n                else if (target.flags & 524288) {\n                    if (source.flags & 524288 && source.indexType === target.indexType) {\n                        if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) {\n                            return result;\n                        }\n                    }\n                }\n                if (source.flags & 16384) {\n                    if (getObjectFlags(target) & 32 && getConstraintTypeFromMappedType(target) === getIndexType(source)) {\n                        var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target));\n                        var templateType = getTemplateTypeFromMappedType(target);\n                        if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) {\n                            return result;\n                        }\n                    }\n                    else {\n                        var constraint = getConstraintOfTypeParameter(source);\n                        if (!constraint || constraint.flags & 1) {\n                            constraint = emptyObjectType;\n                        }\n                        constraint = getTypeWithThisArgument(constraint, source);\n                        var reportConstraintErrors = reportErrors && constraint !== emptyObjectType;\n                        if (result = isRelatedTo(constraint, target, reportConstraintErrors)) {\n                            errorInfo = saveErrorInfo;\n                            return result;\n                        }\n                    }\n                }\n                else {\n                    if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && source.target === target.target) {\n                        if (result = typeArgumentsRelatedTo(source, target, reportErrors)) {\n                            return result;\n                        }\n                    }\n                    var apparentSource = getApparentType(source);\n                    if (apparentSource.flags & (32768 | 131072) && target.flags & 32768) {\n                        var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190);\n                        if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) {\n                            errorInfo = saveErrorInfo;\n                            return result;\n                        }\n                    }\n                }\n                if (reportErrors) {\n                    if (source.flags & 32768 && target.flags & 8190) {\n                        tryElaborateErrorsForPrimitivesAndObjects(source, target);\n                    }\n                    else if (source.symbol && source.flags & 32768 && globalObjectType === source) {\n                        reportError(ts.Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);\n                    }\n                    reportRelationError(headMessage, source, target);\n                }\n                return 0;\n            }\n            function isIdenticalTo(source, target) {\n                var result;\n                if (source.flags & 32768 && target.flags & 32768) {\n                    if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && source.target === target.target) {\n                        if (result = typeArgumentsRelatedTo(source, target, false)) {\n                            return result;\n                        }\n                    }\n                    return objectTypeRelatedTo(source, source, target, false);\n                }\n                if (source.flags & 65536 && target.flags & 65536 ||\n                    source.flags & 131072 && target.flags & 131072) {\n                    if (result = eachTypeRelatedToSomeType(source, target)) {\n                        if (result &= eachTypeRelatedToSomeType(target, source)) {\n                            return result;\n                        }\n                    }\n                }\n                return 0;\n            }\n            function isKnownProperty(type, name) {\n                if (type.flags & 32768) {\n                    var resolved = resolveStructuredTypeMembers(type);\n                    if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyObjectType(resolved)) ||\n                        resolved.stringIndexInfo ||\n                        (resolved.numberIndexInfo && isNumericLiteralName(name)) ||\n                        getPropertyOfType(type, name)) {\n                        return true;\n                    }\n                }\n                else if (type.flags & 196608) {\n                    for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                        var t = _a[_i];\n                        if (isKnownProperty(t, name)) {\n                            return true;\n                        }\n                    }\n                }\n                return false;\n            }\n            function isEmptyObjectType(t) {\n                return t.properties.length === 0 &&\n                    t.callSignatures.length === 0 &&\n                    t.constructSignatures.length === 0 &&\n                    !t.stringIndexInfo &&\n                    !t.numberIndexInfo;\n            }\n            function hasExcessProperties(source, target, reportErrors) {\n                if (maybeTypeOfKind(target, 32768) && !(getObjectFlags(target) & 512)) {\n                    for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {\n                        var prop = _a[_i];\n                        if (!isKnownProperty(target, prop.name)) {\n                            if (reportErrors) {\n                                ts.Debug.assert(!!errorNode);\n                                errorNode = prop.valueDeclaration;\n                                reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target));\n                            }\n                            return true;\n                        }\n                    }\n                }\n                return false;\n            }\n            function eachTypeRelatedToSomeType(source, target) {\n                var result = -1;\n                var sourceTypes = source.types;\n                for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) {\n                    var sourceType = sourceTypes_1[_i];\n                    var related = typeRelatedToSomeType(sourceType, target, false);\n                    if (!related) {\n                        return 0;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            function typeRelatedToSomeType(source, target, reportErrors) {\n                var targetTypes = target.types;\n                if (target.flags & 65536 && containsType(targetTypes, source)) {\n                    return -1;\n                }\n                var len = targetTypes.length;\n                for (var i = 0; i < len; i++) {\n                    var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1);\n                    if (related) {\n                        return related;\n                    }\n                }\n                return 0;\n            }\n            function typeRelatedToEachType(source, target, reportErrors) {\n                var result = -1;\n                var targetTypes = target.types;\n                for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) {\n                    var targetType = targetTypes_1[_i];\n                    var related = isRelatedTo(source, targetType, reportErrors);\n                    if (!related) {\n                        return 0;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            function someTypeRelatedToType(source, target, reportErrors) {\n                var sourceTypes = source.types;\n                if (source.flags & 65536 && containsType(sourceTypes, target)) {\n                    return -1;\n                }\n                var len = sourceTypes.length;\n                for (var i = 0; i < len; i++) {\n                    var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1);\n                    if (related) {\n                        return related;\n                    }\n                }\n                return 0;\n            }\n            function eachTypeRelatedToType(source, target, reportErrors) {\n                var result = -1;\n                var sourceTypes = source.types;\n                for (var _i = 0, sourceTypes_2 = sourceTypes; _i < sourceTypes_2.length; _i++) {\n                    var sourceType = sourceTypes_2[_i];\n                    var related = isRelatedTo(sourceType, target, reportErrors);\n                    if (!related) {\n                        return 0;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            function typeArgumentsRelatedTo(source, target, reportErrors) {\n                var sources = source.typeArguments || emptyArray;\n                var targets = target.typeArguments || emptyArray;\n                if (sources.length !== targets.length && relation === identityRelation) {\n                    return 0;\n                }\n                var length = sources.length <= targets.length ? sources.length : targets.length;\n                var result = -1;\n                for (var i = 0; i < length; i++) {\n                    var related = isRelatedTo(sources[i], targets[i], reportErrors);\n                    if (!related) {\n                        return 0;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            function objectTypeRelatedTo(source, originalSource, target, reportErrors) {\n                if (overflow) {\n                    return 0;\n                }\n                var id = relation !== identityRelation || source.id < target.id ? source.id + \",\" + target.id : target.id + \",\" + source.id;\n                var related = relation[id];\n                if (related !== undefined) {\n                    if (reportErrors && related === 2) {\n                        relation[id] = 3;\n                    }\n                    else {\n                        return related === 1 ? -1 : 0;\n                    }\n                }\n                if (depth > 0) {\n                    for (var i = 0; i < depth; i++) {\n                        if (maybeStack[i][id]) {\n                            return 1;\n                        }\n                    }\n                    if (depth === 100) {\n                        overflow = true;\n                        return 0;\n                    }\n                }\n                else {\n                    sourceStack = [];\n                    targetStack = [];\n                    maybeStack = [];\n                    expandingFlags = 0;\n                }\n                sourceStack[depth] = source;\n                targetStack[depth] = target;\n                maybeStack[depth] = ts.createMap();\n                maybeStack[depth][id] = 1;\n                depth++;\n                var saveExpandingFlags = expandingFlags;\n                if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth))\n                    expandingFlags |= 1;\n                if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth))\n                    expandingFlags |= 2;\n                var result;\n                if (expandingFlags === 3) {\n                    result = 1;\n                }\n                else if (isGenericMappedType(source) || isGenericMappedType(target)) {\n                    result = mappedTypeRelatedTo(source, target, reportErrors);\n                }\n                else {\n                    result = propertiesRelatedTo(source, target, reportErrors);\n                    if (result) {\n                        result &= signaturesRelatedTo(source, target, 0, reportErrors);\n                        if (result) {\n                            result &= signaturesRelatedTo(source, target, 1, reportErrors);\n                            if (result) {\n                                result &= indexTypesRelatedTo(source, originalSource, target, 0, reportErrors);\n                                if (result) {\n                                    result &= indexTypesRelatedTo(source, originalSource, target, 1, reportErrors);\n                                }\n                            }\n                        }\n                    }\n                }\n                expandingFlags = saveExpandingFlags;\n                depth--;\n                if (result) {\n                    var maybeCache = maybeStack[depth];\n                    var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1];\n                    ts.copyProperties(maybeCache, destinationCache);\n                }\n                else {\n                    relation[id] = reportErrors ? 3 : 2;\n                }\n                return result;\n            }\n            function mappedTypeRelatedTo(source, target, reportErrors) {\n                if (isGenericMappedType(target)) {\n                    if (isGenericMappedType(source)) {\n                        var result_2;\n                        if (relation === identityRelation) {\n                            var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken;\n                            var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken;\n                            if (readonlyMatches && optionalMatches) {\n                                if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {\n                                    return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors);\n                                }\n                            }\n                        }\n                        else {\n                            if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) {\n                                if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {\n                                    return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors);\n                                }\n                            }\n                        }\n                    }\n                }\n                else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) {\n                    return -1;\n                }\n                return 0;\n            }\n            function propertiesRelatedTo(source, target, reportErrors) {\n                if (relation === identityRelation) {\n                    return propertiesIdenticalTo(source, target);\n                }\n                var result = -1;\n                var properties = getPropertiesOfObjectType(target);\n                var requireOptionalProperties = relation === subtypeRelation && !(getObjectFlags(source) & 128);\n                for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) {\n                    var targetProp = properties_3[_i];\n                    var sourceProp = getPropertyOfType(source, targetProp.name);\n                    if (sourceProp !== targetProp) {\n                        if (!sourceProp) {\n                            if (!(targetProp.flags & 536870912) || requireOptionalProperties) {\n                                if (reportErrors) {\n                                    reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source));\n                                }\n                                return 0;\n                            }\n                        }\n                        else if (!(targetProp.flags & 134217728)) {\n                            var sourcePropFlags = getDeclarationModifierFlagsFromSymbol(sourceProp);\n                            var targetPropFlags = getDeclarationModifierFlagsFromSymbol(targetProp);\n                            if (sourcePropFlags & 8 || targetPropFlags & 8) {\n                                if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) {\n                                    if (reportErrors) {\n                                        if (sourcePropFlags & 8 && targetPropFlags & 8) {\n                                            reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp));\n                                        }\n                                        else {\n                                            reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 8 ? source : target), typeToString(sourcePropFlags & 8 ? target : source));\n                                        }\n                                    }\n                                    return 0;\n                                }\n                            }\n                            else if (targetPropFlags & 16) {\n                                var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32;\n                                var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(getParentOfSymbol(sourceProp)) : undefined;\n                                var targetClass = getDeclaredTypeOfSymbol(getParentOfSymbol(targetProp));\n                                if (!sourceClass || !hasBaseType(sourceClass, targetClass)) {\n                                    if (reportErrors) {\n                                        reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass));\n                                    }\n                                    return 0;\n                                }\n                            }\n                            else if (sourcePropFlags & 16) {\n                                if (reportErrors) {\n                                    reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target));\n                                }\n                                return 0;\n                            }\n                            var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors);\n                            if (!related) {\n                                if (reportErrors) {\n                                    reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));\n                                }\n                                return 0;\n                            }\n                            result &= related;\n                            if (relation !== comparableRelation && sourceProp.flags & 536870912 && !(targetProp.flags & 536870912)) {\n                                if (reportErrors) {\n                                    reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target));\n                                }\n                                return 0;\n                            }\n                        }\n                    }\n                }\n                return result;\n            }\n            function propertiesIdenticalTo(source, target) {\n                if (!(source.flags & 32768 && target.flags & 32768)) {\n                    return 0;\n                }\n                var sourceProperties = getPropertiesOfObjectType(source);\n                var targetProperties = getPropertiesOfObjectType(target);\n                if (sourceProperties.length !== targetProperties.length) {\n                    return 0;\n                }\n                var result = -1;\n                for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) {\n                    var sourceProp = sourceProperties_1[_i];\n                    var targetProp = getPropertyOfObjectType(target, sourceProp.name);\n                    if (!targetProp) {\n                        return 0;\n                    }\n                    var related = compareProperties(sourceProp, targetProp, isRelatedTo);\n                    if (!related) {\n                        return 0;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            function signaturesRelatedTo(source, target, kind, reportErrors) {\n                if (relation === identityRelation) {\n                    return signaturesIdenticalTo(source, target, kind);\n                }\n                if (target === anyFunctionType || source === anyFunctionType) {\n                    return -1;\n                }\n                var sourceSignatures = getSignaturesOfType(source, kind);\n                var targetSignatures = getSignaturesOfType(target, kind);\n                if (kind === 1 && sourceSignatures.length && targetSignatures.length) {\n                    if (isAbstractConstructorType(source) && !isAbstractConstructorType(target)) {\n                        if (reportErrors) {\n                            reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type);\n                        }\n                        return 0;\n                    }\n                    if (!constructorVisibilitiesAreCompatible(sourceSignatures[0], targetSignatures[0], reportErrors)) {\n                        return 0;\n                    }\n                }\n                var result = -1;\n                var saveErrorInfo = errorInfo;\n                outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) {\n                    var t = targetSignatures_1[_i];\n                    var shouldElaborateErrors = reportErrors;\n                    for (var _a = 0, sourceSignatures_1 = sourceSignatures; _a < sourceSignatures_1.length; _a++) {\n                        var s = sourceSignatures_1[_a];\n                        var related = signatureRelatedTo(s, t, shouldElaborateErrors);\n                        if (related) {\n                            result &= related;\n                            errorInfo = saveErrorInfo;\n                            continue outer;\n                        }\n                        shouldElaborateErrors = false;\n                    }\n                    if (shouldElaborateErrors) {\n                        reportError(ts.Diagnostics.Type_0_provides_no_match_for_the_signature_1, typeToString(source), signatureToString(t, undefined, undefined, kind));\n                    }\n                    return 0;\n                }\n                return result;\n            }\n            function signatureRelatedTo(source, target, reportErrors) {\n                return compareSignaturesRelated(source, target, false, reportErrors, reportError, isRelatedTo);\n            }\n            function signaturesIdenticalTo(source, target, kind) {\n                var sourceSignatures = getSignaturesOfType(source, kind);\n                var targetSignatures = getSignaturesOfType(target, kind);\n                if (sourceSignatures.length !== targetSignatures.length) {\n                    return 0;\n                }\n                var result = -1;\n                for (var i = 0, len = sourceSignatures.length; i < len; i++) {\n                    var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], false, false, false, isRelatedTo);\n                    if (!related) {\n                        return 0;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            function eachPropertyRelatedTo(source, target, kind, reportErrors) {\n                var result = -1;\n                for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {\n                    var prop = _a[_i];\n                    if (kind === 0 || isNumericLiteralName(prop.name)) {\n                        var related = isRelatedTo(getTypeOfSymbol(prop), target, reportErrors);\n                        if (!related) {\n                            if (reportErrors) {\n                                reportError(ts.Diagnostics.Property_0_is_incompatible_with_index_signature, symbolToString(prop));\n                            }\n                            return 0;\n                        }\n                        result &= related;\n                    }\n                }\n                return result;\n            }\n            function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors) {\n                var related = isRelatedTo(sourceInfo.type, targetInfo.type, reportErrors);\n                if (!related && reportErrors) {\n                    reportError(ts.Diagnostics.Index_signatures_are_incompatible);\n                }\n                return related;\n            }\n            function indexTypesRelatedTo(source, originalSource, target, kind, reportErrors) {\n                if (relation === identityRelation) {\n                    return indexTypesIdenticalTo(source, target, kind);\n                }\n                var targetInfo = getIndexInfoOfType(target, kind);\n                if (!targetInfo || ((targetInfo.type.flags & 1) && !(originalSource.flags & 8190))) {\n                    return -1;\n                }\n                var sourceInfo = getIndexInfoOfType(source, kind) ||\n                    kind === 1 && getIndexInfoOfType(source, 0);\n                if (sourceInfo) {\n                    return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors);\n                }\n                if (isObjectLiteralType(source)) {\n                    var related = -1;\n                    if (kind === 0) {\n                        var sourceNumberInfo = getIndexInfoOfType(source, 1);\n                        if (sourceNumberInfo) {\n                            related = indexInfoRelatedTo(sourceNumberInfo, targetInfo, reportErrors);\n                        }\n                    }\n                    if (related) {\n                        related &= eachPropertyRelatedTo(source, targetInfo.type, kind, reportErrors);\n                    }\n                    return related;\n                }\n                if (reportErrors) {\n                    reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source));\n                }\n                return 0;\n            }\n            function indexTypesIdenticalTo(source, target, indexKind) {\n                var targetInfo = getIndexInfoOfType(target, indexKind);\n                var sourceInfo = getIndexInfoOfType(source, indexKind);\n                if (!sourceInfo && !targetInfo) {\n                    return -1;\n                }\n                if (sourceInfo && targetInfo && sourceInfo.isReadonly === targetInfo.isReadonly) {\n                    return isRelatedTo(sourceInfo.type, targetInfo.type);\n                }\n                return 0;\n            }\n            function constructorVisibilitiesAreCompatible(sourceSignature, targetSignature, reportErrors) {\n                if (!sourceSignature.declaration || !targetSignature.declaration) {\n                    return true;\n                }\n                var sourceAccessibility = ts.getModifierFlags(sourceSignature.declaration) & 24;\n                var targetAccessibility = ts.getModifierFlags(targetSignature.declaration) & 24;\n                if (targetAccessibility === 8) {\n                    return true;\n                }\n                if (targetAccessibility === 16 && sourceAccessibility !== 8) {\n                    return true;\n                }\n                if (targetAccessibility !== 16 && !sourceAccessibility) {\n                    return true;\n                }\n                if (reportErrors) {\n                    reportError(ts.Diagnostics.Cannot_assign_a_0_constructor_type_to_a_1_constructor_type, visibilityToString(sourceAccessibility), visibilityToString(targetAccessibility));\n                }\n                return false;\n            }\n        }\n        function isAbstractConstructorType(type) {\n            if (getObjectFlags(type) & 16) {\n                var symbol = type.symbol;\n                if (symbol && symbol.flags & 32) {\n                    var declaration = getClassLikeDeclarationOfSymbol(symbol);\n                    if (declaration && ts.getModifierFlags(declaration) & 128) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function isDeeplyNestedGeneric(type, stack, depth) {\n            if (getObjectFlags(type) & (4 | 64) && depth >= 5) {\n                var symbol = type.symbol;\n                var count = 0;\n                for (var i = 0; i < depth; i++) {\n                    var t = stack[i];\n                    if (getObjectFlags(t) & (4 | 64) && t.symbol === symbol) {\n                        count++;\n                        if (count >= 5)\n                            return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function isPropertyIdenticalTo(sourceProp, targetProp) {\n            return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0;\n        }\n        function compareProperties(sourceProp, targetProp, compareTypes) {\n            if (sourceProp === targetProp) {\n                return -1;\n            }\n            var sourcePropAccessibility = getDeclarationModifierFlagsFromSymbol(sourceProp) & 24;\n            var targetPropAccessibility = getDeclarationModifierFlagsFromSymbol(targetProp) & 24;\n            if (sourcePropAccessibility !== targetPropAccessibility) {\n                return 0;\n            }\n            if (sourcePropAccessibility) {\n                if (getTargetSymbol(sourceProp) !== getTargetSymbol(targetProp)) {\n                    return 0;\n                }\n            }\n            else {\n                if ((sourceProp.flags & 536870912) !== (targetProp.flags & 536870912)) {\n                    return 0;\n                }\n            }\n            if (isReadonlySymbol(sourceProp) !== isReadonlySymbol(targetProp)) {\n                return 0;\n            }\n            return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));\n        }\n        function isMatchingSignature(source, target, partialMatch) {\n            if (source.parameters.length === target.parameters.length &&\n                source.minArgumentCount === target.minArgumentCount &&\n                source.hasRestParameter === target.hasRestParameter) {\n                return true;\n            }\n            var sourceRestCount = source.hasRestParameter ? 1 : 0;\n            var targetRestCount = target.hasRestParameter ? 1 : 0;\n            if (partialMatch && source.minArgumentCount <= target.minArgumentCount && (sourceRestCount > targetRestCount ||\n                sourceRestCount === targetRestCount && source.parameters.length >= target.parameters.length)) {\n                return true;\n            }\n            return false;\n        }\n        function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) {\n            if (source === target) {\n                return -1;\n            }\n            if (!(isMatchingSignature(source, target, partialMatch))) {\n                return 0;\n            }\n            if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) {\n                return 0;\n            }\n            source = getErasedSignature(source);\n            target = getErasedSignature(target);\n            var result = -1;\n            if (!ignoreThisTypes) {\n                var sourceThisType = getThisTypeOfSignature(source);\n                if (sourceThisType) {\n                    var targetThisType = getThisTypeOfSignature(target);\n                    if (targetThisType) {\n                        var related = compareTypes(sourceThisType, targetThisType);\n                        if (!related) {\n                            return 0;\n                        }\n                        result &= related;\n                    }\n                }\n            }\n            var targetLen = target.parameters.length;\n            for (var i = 0; i < targetLen; i++) {\n                var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfParameter(source.parameters[i]);\n                var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfParameter(target.parameters[i]);\n                var related = compareTypes(s, t);\n                if (!related) {\n                    return 0;\n                }\n                result &= related;\n            }\n            if (!ignoreReturnTypes) {\n                result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));\n            }\n            return result;\n        }\n        function isRestParameterIndex(signature, parameterIndex) {\n            return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1;\n        }\n        function isSupertypeOfEach(candidate, types) {\n            for (var _i = 0, types_7 = types; _i < types_7.length; _i++) {\n                var t = types_7[_i];\n                if (candidate !== t && !isTypeSubtypeOf(t, candidate))\n                    return false;\n            }\n            return true;\n        }\n        function literalTypesWithSameBaseType(types) {\n            var commonBaseType;\n            for (var _i = 0, types_8 = types; _i < types_8.length; _i++) {\n                var t = types_8[_i];\n                var baseType = getBaseTypeOfLiteralType(t);\n                if (!commonBaseType) {\n                    commonBaseType = baseType;\n                }\n                if (baseType === t || baseType !== commonBaseType) {\n                    return false;\n                }\n            }\n            return true;\n        }\n        function getSupertypeOrUnion(types) {\n            return literalTypesWithSameBaseType(types) ? getUnionType(types) : ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; });\n        }\n        function getCommonSupertype(types) {\n            if (!strictNullChecks) {\n                return getSupertypeOrUnion(types);\n            }\n            var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 6144); });\n            if (!primaryTypes.length) {\n                return getUnionType(types, true);\n            }\n            var supertype = getSupertypeOrUnion(primaryTypes);\n            return supertype && includeFalsyTypes(supertype, getFalsyFlagsOfTypes(types) & 6144);\n        }\n        function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) {\n            var bestSupertype;\n            var bestSupertypeDownfallType;\n            var bestSupertypeScore = 0;\n            for (var i = 0; i < types.length; i++) {\n                var score = 0;\n                var downfallType = undefined;\n                for (var j = 0; j < types.length; j++) {\n                    if (isTypeSubtypeOf(types[j], types[i])) {\n                        score++;\n                    }\n                    else if (!downfallType) {\n                        downfallType = types[j];\n                    }\n                }\n                ts.Debug.assert(!!downfallType, \"If there is no common supertype, each type should have a downfallType\");\n                if (score > bestSupertypeScore) {\n                    bestSupertype = types[i];\n                    bestSupertypeDownfallType = downfallType;\n                    bestSupertypeScore = score;\n                }\n                if (bestSupertypeScore === types.length - 1) {\n                    break;\n                }\n            }\n            checkTypeSubtypeOf(bestSupertypeDownfallType, bestSupertype, errorLocation, ts.Diagnostics.Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0, errorMessageChainHead);\n        }\n        function isArrayType(type) {\n            return getObjectFlags(type) & 4 && type.target === globalArrayType;\n        }\n        function isArrayLikeType(type) {\n            return getObjectFlags(type) & 4 && (type.target === globalArrayType || type.target === globalReadonlyArrayType) ||\n                !(type.flags & 6144) && isTypeAssignableTo(type, anyReadonlyArrayType);\n        }\n        function isTupleLikeType(type) {\n            return !!getPropertyOfType(type, \"0\");\n        }\n        function isUnitType(type) {\n            return (type.flags & (480 | 2048 | 4096)) !== 0;\n        }\n        function isLiteralType(type) {\n            return type.flags & 8 ? true :\n                type.flags & 65536 ? type.flags & 16 ? true : !ts.forEach(type.types, function (t) { return !isUnitType(t); }) :\n                    isUnitType(type);\n        }\n        function getBaseTypeOfLiteralType(type) {\n            return type.flags & 32 ? stringType :\n                type.flags & 64 ? numberType :\n                    type.flags & 128 ? booleanType :\n                        type.flags & 256 ? type.baseType :\n                            type.flags & 65536 && !(type.flags & 16) ? getUnionType(ts.sameMap(type.types, getBaseTypeOfLiteralType)) :\n                                type;\n        }\n        function getWidenedLiteralType(type) {\n            return type.flags & 32 && type.flags & 1048576 ? stringType :\n                type.flags & 64 && type.flags & 1048576 ? numberType :\n                    type.flags & 128 ? booleanType :\n                        type.flags & 256 ? type.baseType :\n                            type.flags & 65536 && !(type.flags & 16) ? getUnionType(ts.sameMap(type.types, getWidenedLiteralType)) :\n                                type;\n        }\n        function isTupleType(type) {\n            return !!(getObjectFlags(type) & 4 && type.target.objectFlags & 8);\n        }\n        function getFalsyFlagsOfTypes(types) {\n            var result = 0;\n            for (var _i = 0, types_9 = types; _i < types_9.length; _i++) {\n                var t = types_9[_i];\n                result |= getFalsyFlags(t);\n            }\n            return result;\n        }\n        function getFalsyFlags(type) {\n            return type.flags & 65536 ? getFalsyFlagsOfTypes(type.types) :\n                type.flags & 32 ? type.text === \"\" ? 32 : 0 :\n                    type.flags & 64 ? type.text === \"0\" ? 64 : 0 :\n                        type.flags & 128 ? type === falseType ? 128 : 0 :\n                            type.flags & 7406;\n        }\n        function includeFalsyTypes(type, flags) {\n            if ((getFalsyFlags(type) & flags) === flags) {\n                return type;\n            }\n            var types = [type];\n            if (flags & 262178)\n                types.push(emptyStringType);\n            if (flags & 340)\n                types.push(zeroType);\n            if (flags & 136)\n                types.push(falseType);\n            if (flags & 1024)\n                types.push(voidType);\n            if (flags & 2048)\n                types.push(undefinedType);\n            if (flags & 4096)\n                types.push(nullType);\n            return getUnionType(types, true);\n        }\n        function removeDefinitelyFalsyTypes(type) {\n            return getFalsyFlags(type) & 7392 ?\n                filterType(type, function (t) { return !(getFalsyFlags(t) & 7392); }) :\n                type;\n        }\n        function getNonNullableType(type) {\n            return strictNullChecks ? getTypeWithFacts(type, 524288) : type;\n        }\n        function isObjectLiteralType(type) {\n            return type.symbol && (type.symbol.flags & (4096 | 2048)) !== 0 &&\n                getSignaturesOfType(type, 0).length === 0 &&\n                getSignaturesOfType(type, 1).length === 0;\n        }\n        function createTransientSymbol(source, type) {\n            var symbol = createSymbol(source.flags | 67108864, source.name);\n            symbol.declarations = source.declarations;\n            symbol.parent = source.parent;\n            symbol.type = type;\n            symbol.target = source;\n            if (source.valueDeclaration) {\n                symbol.valueDeclaration = source.valueDeclaration;\n            }\n            return symbol;\n        }\n        function transformTypeOfMembers(type, f) {\n            var members = ts.createMap();\n            for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) {\n                var property = _a[_i];\n                var original = getTypeOfSymbol(property);\n                var updated = f(original);\n                members[property.name] = updated === original ? property : createTransientSymbol(property, updated);\n            }\n            ;\n            return members;\n        }\n        function getRegularTypeOfObjectLiteral(type) {\n            if (!(getObjectFlags(type) & 128 && type.flags & 1048576)) {\n                return type;\n            }\n            var regularType = type.regularType;\n            if (regularType) {\n                return regularType;\n            }\n            var resolved = type;\n            var members = transformTypeOfMembers(type, getRegularTypeOfObjectLiteral);\n            var regularNew = createAnonymousType(resolved.symbol, members, resolved.callSignatures, resolved.constructSignatures, resolved.stringIndexInfo, resolved.numberIndexInfo);\n            regularNew.flags = resolved.flags & ~1048576;\n            regularNew.objectFlags |= 128;\n            type.regularType = regularNew;\n            return regularNew;\n        }\n        function getWidenedTypeOfObjectLiteral(type) {\n            var members = transformTypeOfMembers(type, function (prop) {\n                var widened = getWidenedType(prop);\n                return prop === widened ? prop : widened;\n            });\n            var stringIndexInfo = getIndexInfoOfType(type, 0);\n            var numberIndexInfo = getIndexInfoOfType(type, 1);\n            return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly));\n        }\n        function getWidenedConstituentType(type) {\n            return type.flags & 6144 ? type : getWidenedType(type);\n        }\n        function getWidenedType(type) {\n            if (type.flags & 6291456) {\n                if (type.flags & 6144) {\n                    return anyType;\n                }\n                if (getObjectFlags(type) & 128) {\n                    return getWidenedTypeOfObjectLiteral(type);\n                }\n                if (type.flags & 65536) {\n                    return getUnionType(ts.sameMap(type.types, getWidenedConstituentType));\n                }\n                if (isArrayType(type) || isTupleType(type)) {\n                    return createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType));\n                }\n            }\n            return type;\n        }\n        function reportWideningErrorsInType(type) {\n            var errorReported = false;\n            if (type.flags & 65536) {\n                for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                    var t = _a[_i];\n                    if (reportWideningErrorsInType(t)) {\n                        errorReported = true;\n                    }\n                }\n            }\n            if (isArrayType(type) || isTupleType(type)) {\n                for (var _b = 0, _c = type.typeArguments; _b < _c.length; _b++) {\n                    var t = _c[_b];\n                    if (reportWideningErrorsInType(t)) {\n                        errorReported = true;\n                    }\n                }\n            }\n            if (getObjectFlags(type) & 128) {\n                for (var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) {\n                    var p = _e[_d];\n                    var t = getTypeOfSymbol(p);\n                    if (t.flags & 2097152) {\n                        if (!reportWideningErrorsInType(t)) {\n                            error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t)));\n                        }\n                        errorReported = true;\n                    }\n                }\n            }\n            return errorReported;\n        }\n        function reportImplicitAnyError(declaration, type) {\n            var typeAsString = typeToString(getWidenedType(type));\n            var diagnostic;\n            switch (declaration.kind) {\n                case 147:\n                case 146:\n                    diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type;\n                    break;\n                case 144:\n                    diagnostic = declaration.dotDotDotToken ?\n                        ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type :\n                        ts.Diagnostics.Parameter_0_implicitly_has_an_1_type;\n                    break;\n                case 174:\n                    diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type;\n                    break;\n                case 225:\n                case 149:\n                case 148:\n                case 151:\n                case 152:\n                case 184:\n                case 185:\n                    if (!declaration.name) {\n                        error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);\n                        return;\n                    }\n                    diagnostic = ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type;\n                    break;\n                default:\n                    diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type;\n            }\n            error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString);\n        }\n        function reportErrorsFromWidening(declaration, type) {\n            if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 2097152) {\n                if (!reportWideningErrorsInType(type)) {\n                    reportImplicitAnyError(declaration, type);\n                }\n            }\n        }\n        function forEachMatchingParameterType(source, target, callback) {\n            var sourceMax = source.parameters.length;\n            var targetMax = target.parameters.length;\n            var count;\n            if (source.hasRestParameter && target.hasRestParameter) {\n                count = Math.max(sourceMax, targetMax);\n            }\n            else if (source.hasRestParameter) {\n                count = targetMax;\n            }\n            else if (target.hasRestParameter) {\n                count = sourceMax;\n            }\n            else {\n                count = Math.min(sourceMax, targetMax);\n            }\n            for (var i = 0; i < count; i++) {\n                callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i));\n            }\n        }\n        function createInferenceContext(signature, inferUnionTypes) {\n            var inferences = ts.map(signature.typeParameters, createTypeInferencesObject);\n            return {\n                signature: signature,\n                inferUnionTypes: inferUnionTypes,\n                inferences: inferences,\n                inferredTypes: new Array(signature.typeParameters.length),\n            };\n        }\n        function createTypeInferencesObject() {\n            return {\n                primary: undefined,\n                secondary: undefined,\n                topLevel: true,\n                isFixed: false,\n            };\n        }\n        function couldContainTypeVariables(type) {\n            var objectFlags = getObjectFlags(type);\n            return !!(type.flags & 540672 ||\n                objectFlags & 4 && ts.forEach(type.typeArguments, couldContainTypeVariables) ||\n                objectFlags & 16 && type.symbol && type.symbol.flags & (8192 | 2048 | 32) ||\n                objectFlags & 32 ||\n                type.flags & 196608 && couldUnionOrIntersectionContainTypeVariables(type));\n        }\n        function couldUnionOrIntersectionContainTypeVariables(type) {\n            if (type.couldContainTypeVariables === undefined) {\n                type.couldContainTypeVariables = ts.forEach(type.types, couldContainTypeVariables);\n            }\n            return type.couldContainTypeVariables;\n        }\n        function isTypeParameterAtTopLevel(type, typeParameter) {\n            return type === typeParameter || type.flags & 196608 && ts.forEach(type.types, function (t) { return isTypeParameterAtTopLevel(t, typeParameter); });\n        }\n        function inferTypeForHomomorphicMappedType(source, target) {\n            var properties = getPropertiesOfType(source);\n            var indexInfo = getIndexInfoOfType(source, 0);\n            if (properties.length === 0 && !indexInfo) {\n                return undefined;\n            }\n            var typeVariable = getIndexedAccessType(getConstraintTypeFromMappedType(target).type, getTypeParameterFromMappedType(target));\n            var typeVariableArray = [typeVariable];\n            var typeInferences = createTypeInferencesObject();\n            var typeInferencesArray = [typeInferences];\n            var templateType = getTemplateTypeFromMappedType(target);\n            var readonlyMask = target.declaration.readonlyToken ? false : true;\n            var optionalMask = target.declaration.questionToken ? 0 : 536870912;\n            var members = createSymbolTable(properties);\n            for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {\n                var prop = properties_4[_i];\n                var inferredPropType = inferTargetType(getTypeOfSymbol(prop));\n                if (!inferredPropType) {\n                    return undefined;\n                }\n                var inferredProp = createSymbol(4 | 67108864 | prop.flags & optionalMask, prop.name);\n                inferredProp.declarations = prop.declarations;\n                inferredProp.type = inferredPropType;\n                inferredProp.isReadonly = readonlyMask && isReadonlySymbol(prop);\n                members[prop.name] = inferredProp;\n            }\n            if (indexInfo) {\n                var inferredIndexType = inferTargetType(indexInfo.type);\n                if (!inferredIndexType) {\n                    return undefined;\n                }\n                indexInfo = createIndexInfo(inferredIndexType, readonlyMask && indexInfo.isReadonly);\n            }\n            return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfo, undefined);\n            function inferTargetType(sourceType) {\n                typeInferences.primary = undefined;\n                typeInferences.secondary = undefined;\n                inferTypes(typeVariableArray, typeInferencesArray, sourceType, templateType);\n                var inferences = typeInferences.primary || typeInferences.secondary;\n                return inferences && getUnionType(inferences, true);\n            }\n        }\n        function inferTypesWithContext(context, originalSource, originalTarget) {\n            inferTypes(context.signature.typeParameters, context.inferences, originalSource, originalTarget);\n        }\n        function inferTypes(typeVariables, typeInferences, originalSource, originalTarget) {\n            var sourceStack;\n            var targetStack;\n            var depth = 0;\n            var inferiority = 0;\n            var visited = ts.createMap();\n            inferFromTypes(originalSource, originalTarget);\n            function isInProcess(source, target) {\n                for (var i = 0; i < depth; i++) {\n                    if (source === sourceStack[i] && target === targetStack[i]) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n            function inferFromTypes(source, target) {\n                if (!couldContainTypeVariables(target)) {\n                    return;\n                }\n                if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) {\n                    var sourceTypes = source.aliasTypeArguments;\n                    var targetTypes = target.aliasTypeArguments;\n                    for (var i = 0; i < sourceTypes.length; i++) {\n                        inferFromTypes(sourceTypes[i], targetTypes[i]);\n                    }\n                    return;\n                }\n                if (source.flags & 65536 && target.flags & 65536 && !(source.flags & 16 && target.flags & 16) ||\n                    source.flags & 131072 && target.flags & 131072) {\n                    if (source === target) {\n                        for (var _i = 0, _a = source.types; _i < _a.length; _i++) {\n                            var t = _a[_i];\n                            inferFromTypes(t, t);\n                        }\n                        return;\n                    }\n                    var matchingTypes = void 0;\n                    for (var _b = 0, _c = source.types; _b < _c.length; _b++) {\n                        var t = _c[_b];\n                        if (typeIdenticalToSomeType(t, target.types)) {\n                            (matchingTypes || (matchingTypes = [])).push(t);\n                            inferFromTypes(t, t);\n                        }\n                        else if (t.flags & (64 | 32)) {\n                            var b = getBaseTypeOfLiteralType(t);\n                            if (typeIdenticalToSomeType(b, target.types)) {\n                                (matchingTypes || (matchingTypes = [])).push(t, b);\n                            }\n                        }\n                    }\n                    if (matchingTypes) {\n                        source = removeTypesFromUnionOrIntersection(source, matchingTypes);\n                        target = removeTypesFromUnionOrIntersection(target, matchingTypes);\n                    }\n                }\n                if (target.flags & 540672) {\n                    if (source.flags & 8388608) {\n                        return;\n                    }\n                    for (var i = 0; i < typeVariables.length; i++) {\n                        if (target === typeVariables[i]) {\n                            var inferences = typeInferences[i];\n                            if (!inferences.isFixed) {\n                                var candidates = inferiority ?\n                                    inferences.secondary || (inferences.secondary = []) :\n                                    inferences.primary || (inferences.primary = []);\n                                if (!ts.contains(candidates, source)) {\n                                    candidates.push(source);\n                                }\n                                if (target.flags & 16384 && !isTypeParameterAtTopLevel(originalTarget, target)) {\n                                    inferences.topLevel = false;\n                                }\n                            }\n                            return;\n                        }\n                    }\n                }\n                else if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && source.target === target.target) {\n                    var sourceTypes = source.typeArguments || emptyArray;\n                    var targetTypes = target.typeArguments || emptyArray;\n                    var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;\n                    for (var i = 0; i < count; i++) {\n                        inferFromTypes(sourceTypes[i], targetTypes[i]);\n                    }\n                }\n                else if (target.flags & 196608) {\n                    var targetTypes = target.types;\n                    var typeVariableCount = 0;\n                    var typeVariable = void 0;\n                    for (var _d = 0, targetTypes_2 = targetTypes; _d < targetTypes_2.length; _d++) {\n                        var t = targetTypes_2[_d];\n                        if (t.flags & 540672 && ts.contains(typeVariables, t)) {\n                            typeVariable = t;\n                            typeVariableCount++;\n                        }\n                        else {\n                            inferFromTypes(source, t);\n                        }\n                    }\n                    if (typeVariableCount === 1) {\n                        inferiority++;\n                        inferFromTypes(source, typeVariable);\n                        inferiority--;\n                    }\n                }\n                else if (source.flags & 196608) {\n                    var sourceTypes = source.types;\n                    for (var _e = 0, sourceTypes_3 = sourceTypes; _e < sourceTypes_3.length; _e++) {\n                        var sourceType = sourceTypes_3[_e];\n                        inferFromTypes(sourceType, target);\n                    }\n                }\n                else {\n                    source = getApparentType(source);\n                    if (source.flags & 32768) {\n                        if (isInProcess(source, target)) {\n                            return;\n                        }\n                        if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) {\n                            return;\n                        }\n                        var key = source.id + \",\" + target.id;\n                        if (visited[key]) {\n                            return;\n                        }\n                        visited[key] = true;\n                        if (depth === 0) {\n                            sourceStack = [];\n                            targetStack = [];\n                        }\n                        sourceStack[depth] = source;\n                        targetStack[depth] = target;\n                        depth++;\n                        inferFromObjectTypes(source, target);\n                        depth--;\n                    }\n                }\n            }\n            function inferFromObjectTypes(source, target) {\n                if (getObjectFlags(target) & 32) {\n                    var constraintType = getConstraintTypeFromMappedType(target);\n                    if (constraintType.flags & 262144) {\n                        var index = ts.indexOf(typeVariables, constraintType.type);\n                        if (index >= 0 && !typeInferences[index].isFixed) {\n                            var inferredType = inferTypeForHomomorphicMappedType(source, target);\n                            if (inferredType) {\n                                inferiority++;\n                                inferFromTypes(inferredType, typeVariables[index]);\n                                inferiority--;\n                            }\n                        }\n                        return;\n                    }\n                    if (constraintType.flags & 16384) {\n                        inferFromTypes(getIndexType(source), constraintType);\n                        inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target));\n                        return;\n                    }\n                }\n                inferFromProperties(source, target);\n                inferFromSignatures(source, target, 0);\n                inferFromSignatures(source, target, 1);\n                inferFromIndexTypes(source, target);\n            }\n            function inferFromProperties(source, target) {\n                var properties = getPropertiesOfObjectType(target);\n                for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) {\n                    var targetProp = properties_5[_i];\n                    var sourceProp = getPropertyOfObjectType(source, targetProp.name);\n                    if (sourceProp) {\n                        inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));\n                    }\n                }\n            }\n            function inferFromSignatures(source, target, kind) {\n                var sourceSignatures = getSignaturesOfType(source, kind);\n                var targetSignatures = getSignaturesOfType(target, kind);\n                var sourceLen = sourceSignatures.length;\n                var targetLen = targetSignatures.length;\n                var len = sourceLen < targetLen ? sourceLen : targetLen;\n                for (var i = 0; i < len; i++) {\n                    inferFromSignature(getErasedSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i]));\n                }\n            }\n            function inferFromParameterTypes(source, target) {\n                return inferFromTypes(source, target);\n            }\n            function inferFromSignature(source, target) {\n                forEachMatchingParameterType(source, target, inferFromParameterTypes);\n                if (source.typePredicate && target.typePredicate && source.typePredicate.kind === target.typePredicate.kind) {\n                    inferFromTypes(source.typePredicate.type, target.typePredicate.type);\n                }\n                else {\n                    inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));\n                }\n            }\n            function inferFromIndexTypes(source, target) {\n                var targetStringIndexType = getIndexTypeOfType(target, 0);\n                if (targetStringIndexType) {\n                    var sourceIndexType = getIndexTypeOfType(source, 0) ||\n                        getImplicitIndexTypeOfType(source, 0);\n                    if (sourceIndexType) {\n                        inferFromTypes(sourceIndexType, targetStringIndexType);\n                    }\n                }\n                var targetNumberIndexType = getIndexTypeOfType(target, 1);\n                if (targetNumberIndexType) {\n                    var sourceIndexType = getIndexTypeOfType(source, 1) ||\n                        getIndexTypeOfType(source, 0) ||\n                        getImplicitIndexTypeOfType(source, 1);\n                    if (sourceIndexType) {\n                        inferFromTypes(sourceIndexType, targetNumberIndexType);\n                    }\n                }\n            }\n        }\n        function typeIdenticalToSomeType(type, types) {\n            for (var _i = 0, types_10 = types; _i < types_10.length; _i++) {\n                var t = types_10[_i];\n                if (isTypeIdenticalTo(t, type)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function removeTypesFromUnionOrIntersection(type, typesToRemove) {\n            var reducedTypes = [];\n            for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                var t = _a[_i];\n                if (!typeIdenticalToSomeType(t, typesToRemove)) {\n                    reducedTypes.push(t);\n                }\n            }\n            return type.flags & 65536 ? getUnionType(reducedTypes) : getIntersectionType(reducedTypes);\n        }\n        function getInferenceCandidates(context, index) {\n            var inferences = context.inferences[index];\n            return inferences.primary || inferences.secondary || emptyArray;\n        }\n        function hasPrimitiveConstraint(type) {\n            var constraint = getConstraintOfTypeParameter(type);\n            return constraint && maybeTypeOfKind(constraint, 8190 | 262144);\n        }\n        function getInferredType(context, index) {\n            var inferredType = context.inferredTypes[index];\n            var inferenceSucceeded;\n            if (!inferredType) {\n                var inferences = getInferenceCandidates(context, index);\n                if (inferences.length) {\n                    var signature = context.signature;\n                    var widenLiteralTypes = context.inferences[index].topLevel &&\n                        !hasPrimitiveConstraint(signature.typeParameters[index]) &&\n                        (context.inferences[index].isFixed || !isTypeParameterAtTopLevel(getReturnTypeOfSignature(signature), signature.typeParameters[index]));\n                    var baseInferences = widenLiteralTypes ? ts.sameMap(inferences, getWidenedLiteralType) : inferences;\n                    var unionOrSuperType = context.inferUnionTypes ? getUnionType(baseInferences, true) : getCommonSupertype(baseInferences);\n                    inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : unknownType;\n                    inferenceSucceeded = !!unionOrSuperType;\n                }\n                else {\n                    inferredType = emptyObjectType;\n                    inferenceSucceeded = true;\n                }\n                context.inferredTypes[index] = inferredType;\n                if (inferenceSucceeded) {\n                    var constraint = getConstraintOfTypeParameter(context.signature.typeParameters[index]);\n                    if (constraint) {\n                        var instantiatedConstraint = instantiateType(constraint, getInferenceMapper(context));\n                        if (!isTypeAssignableTo(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {\n                            context.inferredTypes[index] = inferredType = instantiatedConstraint;\n                        }\n                    }\n                }\n                else if (context.failedTypeParameterIndex === undefined || context.failedTypeParameterIndex > index) {\n                    context.failedTypeParameterIndex = index;\n                }\n            }\n            return inferredType;\n        }\n        function getInferredTypes(context) {\n            for (var i = 0; i < context.inferredTypes.length; i++) {\n                getInferredType(context, i);\n            }\n            return context.inferredTypes;\n        }\n        function getResolvedSymbol(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedSymbol) {\n                links.resolvedSymbol = !ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node) || unknownSymbol;\n            }\n            return links.resolvedSymbol;\n        }\n        function isInTypeQuery(node) {\n            while (node) {\n                switch (node.kind) {\n                    case 160:\n                        return true;\n                    case 70:\n                    case 141:\n                        node = node.parent;\n                        continue;\n                    default:\n                        return false;\n                }\n            }\n            ts.Debug.fail(\"should not get here\");\n        }\n        function getFlowCacheKey(node) {\n            if (node.kind === 70) {\n                var symbol = getResolvedSymbol(node);\n                return symbol !== unknownSymbol ? \"\" + getSymbolId(symbol) : undefined;\n            }\n            if (node.kind === 98) {\n                return \"0\";\n            }\n            if (node.kind === 177) {\n                var key = getFlowCacheKey(node.expression);\n                return key && key + \".\" + node.name.text;\n            }\n            return undefined;\n        }\n        function getLeftmostIdentifierOrThis(node) {\n            switch (node.kind) {\n                case 70:\n                case 98:\n                    return node;\n                case 177:\n                    return getLeftmostIdentifierOrThis(node.expression);\n            }\n            return undefined;\n        }\n        function isMatchingReference(source, target) {\n            switch (source.kind) {\n                case 70:\n                    return target.kind === 70 && getResolvedSymbol(source) === getResolvedSymbol(target) ||\n                        (target.kind === 223 || target.kind === 174) &&\n                            getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target);\n                case 98:\n                    return target.kind === 98;\n                case 177:\n                    return target.kind === 177 &&\n                        source.name.text === target.name.text &&\n                        isMatchingReference(source.expression, target.expression);\n            }\n            return false;\n        }\n        function containsMatchingReference(source, target) {\n            while (source.kind === 177) {\n                source = source.expression;\n                if (isMatchingReference(source, target)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function containsMatchingReferenceDiscriminant(source, target) {\n            return target.kind === 177 &&\n                containsMatchingReference(source, target.expression) &&\n                isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text);\n        }\n        function getDeclaredTypeOfReference(expr) {\n            if (expr.kind === 70) {\n                return getTypeOfSymbol(getResolvedSymbol(expr));\n            }\n            if (expr.kind === 177) {\n                var type = getDeclaredTypeOfReference(expr.expression);\n                return type && getTypeOfPropertyOfType(type, expr.name.text);\n            }\n            return undefined;\n        }\n        function isDiscriminantProperty(type, name) {\n            if (type && type.flags & 65536) {\n                var prop = getUnionOrIntersectionProperty(type, name);\n                if (prop && prop.flags & 268435456) {\n                    if (prop.isDiscriminantProperty === undefined) {\n                        prop.isDiscriminantProperty = prop.hasNonUniformType && isLiteralType(getTypeOfSymbol(prop));\n                    }\n                    return prop.isDiscriminantProperty;\n                }\n            }\n            return false;\n        }\n        function isOrContainsMatchingReference(source, target) {\n            return isMatchingReference(source, target) || containsMatchingReference(source, target);\n        }\n        function hasMatchingArgument(callExpression, reference) {\n            if (callExpression.arguments) {\n                for (var _i = 0, _a = callExpression.arguments; _i < _a.length; _i++) {\n                    var argument = _a[_i];\n                    if (isOrContainsMatchingReference(reference, argument)) {\n                        return true;\n                    }\n                }\n            }\n            if (callExpression.expression.kind === 177 &&\n                isOrContainsMatchingReference(reference, callExpression.expression.expression)) {\n                return true;\n            }\n            return false;\n        }\n        function getFlowNodeId(flow) {\n            if (!flow.id) {\n                flow.id = nextFlowId;\n                nextFlowId++;\n            }\n            return flow.id;\n        }\n        function typeMaybeAssignableTo(source, target) {\n            if (!(source.flags & 65536)) {\n                return isTypeAssignableTo(source, target);\n            }\n            for (var _i = 0, _a = source.types; _i < _a.length; _i++) {\n                var t = _a[_i];\n                if (isTypeAssignableTo(t, target)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function getAssignmentReducedType(declaredType, assignedType) {\n            if (declaredType !== assignedType) {\n                if (assignedType.flags & 8192) {\n                    return assignedType;\n                }\n                var reducedType = filterType(declaredType, function (t) { return typeMaybeAssignableTo(assignedType, t); });\n                if (!(reducedType.flags & 8192)) {\n                    return reducedType;\n                }\n            }\n            return declaredType;\n        }\n        function getTypeFactsOfTypes(types) {\n            var result = 0;\n            for (var _i = 0, types_11 = types; _i < types_11.length; _i++) {\n                var t = types_11[_i];\n                result |= getTypeFacts(t);\n            }\n            return result;\n        }\n        function isFunctionObjectType(type) {\n            var resolved = resolveStructuredTypeMembers(type);\n            return !!(resolved.callSignatures.length || resolved.constructSignatures.length ||\n                resolved.members[\"bind\"] && isTypeSubtypeOf(type, globalFunctionType));\n        }\n        function getTypeFacts(type) {\n            var flags = type.flags;\n            if (flags & 2) {\n                return strictNullChecks ? 4079361 : 4194049;\n            }\n            if (flags & 32) {\n                return strictNullChecks ?\n                    type.text === \"\" ? 3030785 : 1982209 :\n                    type.text === \"\" ? 3145473 : 4194049;\n            }\n            if (flags & (4 | 16)) {\n                return strictNullChecks ? 4079234 : 4193922;\n            }\n            if (flags & (64 | 256)) {\n                var isZero = type.text === \"0\";\n                return strictNullChecks ?\n                    isZero ? 3030658 : 1982082 :\n                    isZero ? 3145346 : 4193922;\n            }\n            if (flags & 8) {\n                return strictNullChecks ? 4078980 : 4193668;\n            }\n            if (flags & 136) {\n                return strictNullChecks ?\n                    type === falseType ? 3030404 : 1981828 :\n                    type === falseType ? 3145092 : 4193668;\n            }\n            if (flags & 32768) {\n                return isFunctionObjectType(type) ?\n                    strictNullChecks ? 6164448 : 8376288 :\n                    strictNullChecks ? 6166480 : 8378320;\n            }\n            if (flags & (1024 | 2048)) {\n                return 2457472;\n            }\n            if (flags & 4096) {\n                return 2340752;\n            }\n            if (flags & 512) {\n                return strictNullChecks ? 1981320 : 4193160;\n            }\n            if (flags & 16384) {\n                var constraint = getConstraintOfTypeParameter(type);\n                return getTypeFacts(constraint || emptyObjectType);\n            }\n            if (flags & 196608) {\n                return getTypeFactsOfTypes(type.types);\n            }\n            return 8388607;\n        }\n        function getTypeWithFacts(type, include) {\n            return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });\n        }\n        function getTypeWithDefault(type, defaultExpression) {\n            if (defaultExpression) {\n                var defaultType = getTypeOfExpression(defaultExpression);\n                return getUnionType([getTypeWithFacts(type, 131072), defaultType]);\n            }\n            return type;\n        }\n        function getTypeOfDestructuredProperty(type, name) {\n            var text = ts.getTextOfPropertyName(name);\n            return getTypeOfPropertyOfType(type, text) ||\n                isNumericLiteralName(text) && getIndexTypeOfType(type, 1) ||\n                getIndexTypeOfType(type, 0) ||\n                unknownType;\n        }\n        function getTypeOfDestructuredArrayElement(type, index) {\n            return isTupleLikeType(type) && getTypeOfPropertyOfType(type, \"\" + index) ||\n                checkIteratedTypeOrElementType(type, undefined, false) ||\n                unknownType;\n        }\n        function getTypeOfDestructuredSpreadExpression(type) {\n            return createArrayType(checkIteratedTypeOrElementType(type, undefined, false) || unknownType);\n        }\n        function getAssignedTypeOfBinaryExpression(node) {\n            return node.parent.kind === 175 || node.parent.kind === 257 ?\n                getTypeWithDefault(getAssignedType(node), node.right) :\n                getTypeOfExpression(node.right);\n        }\n        function getAssignedTypeOfArrayLiteralElement(node, element) {\n            return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element));\n        }\n        function getAssignedTypeOfSpreadExpression(node) {\n            return getTypeOfDestructuredSpreadExpression(getAssignedType(node.parent));\n        }\n        function getAssignedTypeOfPropertyAssignment(node) {\n            return getTypeOfDestructuredProperty(getAssignedType(node.parent), node.name);\n        }\n        function getAssignedTypeOfShorthandPropertyAssignment(node) {\n            return getTypeWithDefault(getAssignedTypeOfPropertyAssignment(node), node.objectAssignmentInitializer);\n        }\n        function getAssignedType(node) {\n            var parent = node.parent;\n            switch (parent.kind) {\n                case 212:\n                    return stringType;\n                case 213:\n                    return checkRightHandSideOfForOf(parent.expression) || unknownType;\n                case 192:\n                    return getAssignedTypeOfBinaryExpression(parent);\n                case 186:\n                    return undefinedType;\n                case 175:\n                    return getAssignedTypeOfArrayLiteralElement(parent, node);\n                case 196:\n                    return getAssignedTypeOfSpreadExpression(parent);\n                case 257:\n                    return getAssignedTypeOfPropertyAssignment(parent);\n                case 258:\n                    return getAssignedTypeOfShorthandPropertyAssignment(parent);\n            }\n            return unknownType;\n        }\n        function getInitialTypeOfBindingElement(node) {\n            var pattern = node.parent;\n            var parentType = getInitialType(pattern.parent);\n            var type = pattern.kind === 172 ?\n                getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) :\n                !node.dotDotDotToken ?\n                    getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) :\n                    getTypeOfDestructuredSpreadExpression(parentType);\n            return getTypeWithDefault(type, node.initializer);\n        }\n        function getTypeOfInitializer(node) {\n            var links = getNodeLinks(node);\n            return links.resolvedType || getTypeOfExpression(node);\n        }\n        function getInitialTypeOfVariableDeclaration(node) {\n            if (node.initializer) {\n                return getTypeOfInitializer(node.initializer);\n            }\n            if (node.parent.parent.kind === 212) {\n                return stringType;\n            }\n            if (node.parent.parent.kind === 213) {\n                return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType;\n            }\n            return unknownType;\n        }\n        function getInitialType(node) {\n            return node.kind === 223 ?\n                getInitialTypeOfVariableDeclaration(node) :\n                getInitialTypeOfBindingElement(node);\n        }\n        function getInitialOrAssignedType(node) {\n            return node.kind === 223 || node.kind === 174 ?\n                getInitialType(node) :\n                getAssignedType(node);\n        }\n        function isEmptyArrayAssignment(node) {\n            return node.kind === 223 && node.initializer &&\n                isEmptyArrayLiteral(node.initializer) ||\n                node.kind !== 174 && node.parent.kind === 192 &&\n                    isEmptyArrayLiteral(node.parent.right);\n        }\n        function getReferenceCandidate(node) {\n            switch (node.kind) {\n                case 183:\n                    return getReferenceCandidate(node.expression);\n                case 192:\n                    switch (node.operatorToken.kind) {\n                        case 57:\n                            return getReferenceCandidate(node.left);\n                        case 25:\n                            return getReferenceCandidate(node.right);\n                    }\n            }\n            return node;\n        }\n        function getReferenceRoot(node) {\n            var parent = node.parent;\n            return parent.kind === 183 ||\n                parent.kind === 192 && parent.operatorToken.kind === 57 && parent.left === node ||\n                parent.kind === 192 && parent.operatorToken.kind === 25 && parent.right === node ?\n                getReferenceRoot(parent) : node;\n        }\n        function getTypeOfSwitchClause(clause) {\n            if (clause.kind === 253) {\n                var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression));\n                return isUnitType(caseType) ? caseType : undefined;\n            }\n            return neverType;\n        }\n        function getSwitchClauseTypes(switchStatement) {\n            var links = getNodeLinks(switchStatement);\n            if (!links.switchTypes) {\n                var types = ts.map(switchStatement.caseBlock.clauses, getTypeOfSwitchClause);\n                links.switchTypes = !ts.contains(types, undefined) ? types : emptyArray;\n            }\n            return links.switchTypes;\n        }\n        function eachTypeContainedIn(source, types) {\n            return source.flags & 65536 ? !ts.forEach(source.types, function (t) { return !ts.contains(types, t); }) : ts.contains(types, source);\n        }\n        function isTypeSubsetOf(source, target) {\n            return source === target || target.flags & 65536 && isTypeSubsetOfUnion(source, target);\n        }\n        function isTypeSubsetOfUnion(source, target) {\n            if (source.flags & 65536) {\n                for (var _i = 0, _a = source.types; _i < _a.length; _i++) {\n                    var t = _a[_i];\n                    if (!containsType(target.types, t)) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            if (source.flags & 256 && target.flags & 16 && source.baseType === target) {\n                return true;\n            }\n            return containsType(target.types, source);\n        }\n        function forEachType(type, f) {\n            return type.flags & 65536 ? ts.forEach(type.types, f) : f(type);\n        }\n        function filterType(type, f) {\n            if (type.flags & 65536) {\n                var types = type.types;\n                var filtered = ts.filter(types, f);\n                return filtered === types ? type : getUnionTypeFromSortedList(filtered);\n            }\n            return f(type) ? type : neverType;\n        }\n        function mapType(type, f) {\n            return type.flags & 65536 ? getUnionType(ts.map(type.types, f)) : f(type);\n        }\n        function extractTypesOfKind(type, kind) {\n            return filterType(type, function (t) { return (t.flags & kind) !== 0; });\n        }\n        function replacePrimitivesWithLiterals(typeWithPrimitives, typeWithLiterals) {\n            if (isTypeSubsetOf(stringType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, 32) ||\n                isTypeSubsetOf(numberType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, 64)) {\n                return mapType(typeWithPrimitives, function (t) {\n                    return t.flags & 2 ? extractTypesOfKind(typeWithLiterals, 2 | 32) :\n                        t.flags & 4 ? extractTypesOfKind(typeWithLiterals, 4 | 64) :\n                            t;\n                });\n            }\n            return typeWithPrimitives;\n        }\n        function isIncomplete(flowType) {\n            return flowType.flags === 0;\n        }\n        function getTypeFromFlowType(flowType) {\n            return flowType.flags === 0 ? flowType.type : flowType;\n        }\n        function createFlowType(type, incomplete) {\n            return incomplete ? { flags: 0, type: type } : type;\n        }\n        function createEvolvingArrayType(elementType) {\n            var result = createObjectType(256);\n            result.elementType = elementType;\n            return result;\n        }\n        function getEvolvingArrayType(elementType) {\n            return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType));\n        }\n        function addEvolvingArrayElementType(evolvingArrayType, node) {\n            var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node));\n            return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType]));\n        }\n        function createFinalArrayType(elementType) {\n            return elementType.flags & 8192 ?\n                autoArrayType :\n                createArrayType(elementType.flags & 65536 ?\n                    getUnionType(elementType.types, true) :\n                    elementType);\n        }\n        function getFinalArrayType(evolvingArrayType) {\n            return evolvingArrayType.finalArrayType || (evolvingArrayType.finalArrayType = createFinalArrayType(evolvingArrayType.elementType));\n        }\n        function finalizeEvolvingArrayType(type) {\n            return getObjectFlags(type) & 256 ? getFinalArrayType(type) : type;\n        }\n        function getElementTypeOfEvolvingArrayType(type) {\n            return getObjectFlags(type) & 256 ? type.elementType : neverType;\n        }\n        function isEvolvingArrayTypeList(types) {\n            var hasEvolvingArrayType = false;\n            for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {\n                var t = types_12[_i];\n                if (!(t.flags & 8192)) {\n                    if (!(getObjectFlags(t) & 256)) {\n                        return false;\n                    }\n                    hasEvolvingArrayType = true;\n                }\n            }\n            return hasEvolvingArrayType;\n        }\n        function getUnionOrEvolvingArrayType(types, subtypeReduction) {\n            return isEvolvingArrayTypeList(types) ?\n                getEvolvingArrayType(getUnionType(ts.map(types, getElementTypeOfEvolvingArrayType))) :\n                getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction);\n        }\n        function isEvolvingArrayOperationTarget(node) {\n            var root = getReferenceRoot(node);\n            var parent = root.parent;\n            var isLengthPushOrUnshift = parent.kind === 177 && (parent.name.text === \"length\" ||\n                parent.parent.kind === 179 && ts.isPushOrUnshiftIdentifier(parent.name));\n            var isElementAssignment = parent.kind === 178 &&\n                parent.expression === root &&\n                parent.parent.kind === 192 &&\n                parent.parent.operatorToken.kind === 57 &&\n                parent.parent.left === parent &&\n                !ts.isAssignmentTarget(parent.parent) &&\n                isTypeAnyOrAllConstituentTypesHaveKind(getTypeOfExpression(parent.argumentExpression), 340 | 2048);\n            return isLengthPushOrUnshift || isElementAssignment;\n        }\n        function maybeTypePredicateCall(node) {\n            var links = getNodeLinks(node);\n            if (links.maybeTypePredicate === undefined) {\n                links.maybeTypePredicate = getMaybeTypePredicate(node);\n            }\n            return links.maybeTypePredicate;\n        }\n        function getMaybeTypePredicate(node) {\n            if (node.expression.kind !== 96) {\n                var funcType = checkNonNullExpression(node.expression);\n                if (funcType !== silentNeverType) {\n                    var apparentType = getApparentType(funcType);\n                    if (apparentType !== unknownType) {\n                        var callSignatures = getSignaturesOfType(apparentType, 0);\n                        return !!ts.forEach(callSignatures, function (sig) { return sig.typePredicate; });\n                    }\n                }\n            }\n            return false;\n        }\n        function getFlowTypeOfReference(reference, declaredType, assumeInitialized, flowContainer) {\n            var key;\n            if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 1033215)) {\n                return declaredType;\n            }\n            var initialType = assumeInitialized ? declaredType :\n                declaredType === autoType || declaredType === autoArrayType ? undefinedType :\n                    includeFalsyTypes(declaredType, 2048);\n            var visitedFlowStart = visitedFlowCount;\n            var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode));\n            visitedFlowCount = visitedFlowStart;\n            var resultType = getObjectFlags(evolvedType) & 256 && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType);\n            if (reference.parent.kind === 201 && getTypeWithFacts(resultType, 524288).flags & 8192) {\n                return declaredType;\n            }\n            return resultType;\n            function getTypeAtFlowNode(flow) {\n                while (true) {\n                    if (flow.flags & 1024) {\n                        for (var i = visitedFlowStart; i < visitedFlowCount; i++) {\n                            if (visitedFlowNodes[i] === flow) {\n                                return visitedFlowTypes[i];\n                            }\n                        }\n                    }\n                    var type = void 0;\n                    if (flow.flags & 16) {\n                        type = getTypeAtFlowAssignment(flow);\n                        if (!type) {\n                            flow = flow.antecedent;\n                            continue;\n                        }\n                    }\n                    else if (flow.flags & 96) {\n                        type = getTypeAtFlowCondition(flow);\n                    }\n                    else if (flow.flags & 128) {\n                        type = getTypeAtSwitchClause(flow);\n                    }\n                    else if (flow.flags & 12) {\n                        if (flow.antecedents.length === 1) {\n                            flow = flow.antecedents[0];\n                            continue;\n                        }\n                        type = flow.flags & 4 ?\n                            getTypeAtFlowBranchLabel(flow) :\n                            getTypeAtFlowLoopLabel(flow);\n                    }\n                    else if (flow.flags & 256) {\n                        type = getTypeAtFlowArrayMutation(flow);\n                        if (!type) {\n                            flow = flow.antecedent;\n                            continue;\n                        }\n                    }\n                    else if (flow.flags & 2) {\n                        var container = flow.container;\n                        if (container && container !== flowContainer && reference.kind !== 177) {\n                            flow = container.flowNode;\n                            continue;\n                        }\n                        type = initialType;\n                    }\n                    else {\n                        type = convertAutoToAny(declaredType);\n                    }\n                    if (flow.flags & 1024) {\n                        visitedFlowNodes[visitedFlowCount] = flow;\n                        visitedFlowTypes[visitedFlowCount] = type;\n                        visitedFlowCount++;\n                    }\n                    return type;\n                }\n            }\n            function getTypeAtFlowAssignment(flow) {\n                var node = flow.node;\n                if (isMatchingReference(reference, node)) {\n                    if (ts.getAssignmentTargetKind(node) === 2) {\n                        var flowType = getTypeAtFlowNode(flow.antecedent);\n                        return createFlowType(getBaseTypeOfLiteralType(getTypeFromFlowType(flowType)), isIncomplete(flowType));\n                    }\n                    if (declaredType === autoType || declaredType === autoArrayType) {\n                        if (isEmptyArrayAssignment(node)) {\n                            return getEvolvingArrayType(neverType);\n                        }\n                        var assignedType = getBaseTypeOfLiteralType(getInitialOrAssignedType(node));\n                        return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType;\n                    }\n                    if (declaredType.flags & 65536) {\n                        return getAssignmentReducedType(declaredType, getInitialOrAssignedType(node));\n                    }\n                    return declaredType;\n                }\n                if (containsMatchingReference(reference, node)) {\n                    return declaredType;\n                }\n                return undefined;\n            }\n            function getTypeAtFlowArrayMutation(flow) {\n                var node = flow.node;\n                var expr = node.kind === 179 ?\n                    node.expression.expression :\n                    node.left.expression;\n                if (isMatchingReference(reference, getReferenceCandidate(expr))) {\n                    var flowType = getTypeAtFlowNode(flow.antecedent);\n                    var type = getTypeFromFlowType(flowType);\n                    if (getObjectFlags(type) & 256) {\n                        var evolvedType_1 = type;\n                        if (node.kind === 179) {\n                            for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {\n                                var arg = _a[_i];\n                                evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg);\n                            }\n                        }\n                        else {\n                            var indexType = getTypeOfExpression(node.left.argumentExpression);\n                            if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 | 2048)) {\n                                evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right);\n                            }\n                        }\n                        return evolvedType_1 === type ? flowType : createFlowType(evolvedType_1, isIncomplete(flowType));\n                    }\n                    return flowType;\n                }\n                return undefined;\n            }\n            function getTypeAtFlowCondition(flow) {\n                var flowType = getTypeAtFlowNode(flow.antecedent);\n                var type = getTypeFromFlowType(flowType);\n                if (type.flags & 8192) {\n                    return flowType;\n                }\n                var assumeTrue = (flow.flags & 32) !== 0;\n                var nonEvolvingType = finalizeEvolvingArrayType(type);\n                var narrowedType = narrowType(nonEvolvingType, flow.expression, assumeTrue);\n                if (narrowedType === nonEvolvingType) {\n                    return flowType;\n                }\n                var incomplete = isIncomplete(flowType);\n                var resultType = incomplete && narrowedType.flags & 8192 ? silentNeverType : narrowedType;\n                return createFlowType(resultType, incomplete);\n            }\n            function getTypeAtSwitchClause(flow) {\n                var flowType = getTypeAtFlowNode(flow.antecedent);\n                var type = getTypeFromFlowType(flowType);\n                var expr = flow.switchStatement.expression;\n                if (isMatchingReference(reference, expr)) {\n                    type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);\n                }\n                else if (isMatchingReferenceDiscriminant(expr)) {\n                    type = narrowTypeByDiscriminant(type, expr, function (t) { return narrowTypeBySwitchOnDiscriminant(t, flow.switchStatement, flow.clauseStart, flow.clauseEnd); });\n                }\n                return createFlowType(type, isIncomplete(flowType));\n            }\n            function getTypeAtFlowBranchLabel(flow) {\n                var antecedentTypes = [];\n                var subtypeReduction = false;\n                var seenIncomplete = false;\n                for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) {\n                    var antecedent = _a[_i];\n                    var flowType = getTypeAtFlowNode(antecedent);\n                    var type = getTypeFromFlowType(flowType);\n                    if (type === declaredType && declaredType === initialType) {\n                        return type;\n                    }\n                    if (!ts.contains(antecedentTypes, type)) {\n                        antecedentTypes.push(type);\n                    }\n                    if (!isTypeSubsetOf(type, declaredType)) {\n                        subtypeReduction = true;\n                    }\n                    if (isIncomplete(flowType)) {\n                        seenIncomplete = true;\n                    }\n                }\n                return createFlowType(getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction), seenIncomplete);\n            }\n            function getTypeAtFlowLoopLabel(flow) {\n                var id = getFlowNodeId(flow);\n                var cache = flowLoopCaches[id] || (flowLoopCaches[id] = ts.createMap());\n                if (!key) {\n                    key = getFlowCacheKey(reference);\n                }\n                if (cache[key]) {\n                    return cache[key];\n                }\n                for (var i = flowLoopStart; i < flowLoopCount; i++) {\n                    if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key && flowLoopTypes[i].length) {\n                        return createFlowType(getUnionOrEvolvingArrayType(flowLoopTypes[i], false), true);\n                    }\n                }\n                var antecedentTypes = [];\n                var subtypeReduction = false;\n                var firstAntecedentType;\n                flowLoopNodes[flowLoopCount] = flow;\n                flowLoopKeys[flowLoopCount] = key;\n                flowLoopTypes[flowLoopCount] = antecedentTypes;\n                for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) {\n                    var antecedent = _a[_i];\n                    flowLoopCount++;\n                    var flowType = getTypeAtFlowNode(antecedent);\n                    flowLoopCount--;\n                    if (!firstAntecedentType) {\n                        firstAntecedentType = flowType;\n                    }\n                    var type = getTypeFromFlowType(flowType);\n                    if (cache[key]) {\n                        return cache[key];\n                    }\n                    if (!ts.contains(antecedentTypes, type)) {\n                        antecedentTypes.push(type);\n                    }\n                    if (!isTypeSubsetOf(type, declaredType)) {\n                        subtypeReduction = true;\n                    }\n                    if (type === declaredType) {\n                        break;\n                    }\n                }\n                var result = getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction);\n                if (isIncomplete(firstAntecedentType)) {\n                    return createFlowType(result, true);\n                }\n                return cache[key] = result;\n            }\n            function isMatchingReferenceDiscriminant(expr) {\n                return expr.kind === 177 &&\n                    declaredType.flags & 65536 &&\n                    isMatchingReference(reference, expr.expression) &&\n                    isDiscriminantProperty(declaredType, expr.name.text);\n            }\n            function narrowTypeByDiscriminant(type, propAccess, narrowType) {\n                var propName = propAccess.name.text;\n                var propType = getTypeOfPropertyOfType(type, propName);\n                var narrowedPropType = propType && narrowType(propType);\n                return propType === narrowedPropType ? type : filterType(type, function (t) { return isTypeComparableTo(getTypeOfPropertyOfType(t, propName), narrowedPropType); });\n            }\n            function narrowTypeByTruthiness(type, expr, assumeTrue) {\n                if (isMatchingReference(reference, expr)) {\n                    return getTypeWithFacts(type, assumeTrue ? 1048576 : 2097152);\n                }\n                if (isMatchingReferenceDiscriminant(expr)) {\n                    return narrowTypeByDiscriminant(type, expr, function (t) { return getTypeWithFacts(t, assumeTrue ? 1048576 : 2097152); });\n                }\n                if (containsMatchingReferenceDiscriminant(reference, expr)) {\n                    return declaredType;\n                }\n                return type;\n            }\n            function narrowTypeByBinaryExpression(type, expr, assumeTrue) {\n                switch (expr.operatorToken.kind) {\n                    case 57:\n                        return narrowTypeByTruthiness(type, expr.left, assumeTrue);\n                    case 31:\n                    case 32:\n                    case 33:\n                    case 34:\n                        var operator_1 = expr.operatorToken.kind;\n                        var left_1 = getReferenceCandidate(expr.left);\n                        var right_1 = getReferenceCandidate(expr.right);\n                        if (left_1.kind === 187 && right_1.kind === 9) {\n                            return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue);\n                        }\n                        if (right_1.kind === 187 && left_1.kind === 9) {\n                            return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue);\n                        }\n                        if (isMatchingReference(reference, left_1)) {\n                            return narrowTypeByEquality(type, operator_1, right_1, assumeTrue);\n                        }\n                        if (isMatchingReference(reference, right_1)) {\n                            return narrowTypeByEquality(type, operator_1, left_1, assumeTrue);\n                        }\n                        if (isMatchingReferenceDiscriminant(left_1)) {\n                            return narrowTypeByDiscriminant(type, left_1, function (t) { return narrowTypeByEquality(t, operator_1, right_1, assumeTrue); });\n                        }\n                        if (isMatchingReferenceDiscriminant(right_1)) {\n                            return narrowTypeByDiscriminant(type, right_1, function (t) { return narrowTypeByEquality(t, operator_1, left_1, assumeTrue); });\n                        }\n                        if (containsMatchingReferenceDiscriminant(reference, left_1) || containsMatchingReferenceDiscriminant(reference, right_1)) {\n                            return declaredType;\n                        }\n                        break;\n                    case 92:\n                        return narrowTypeByInstanceof(type, expr, assumeTrue);\n                    case 25:\n                        return narrowType(type, expr.right, assumeTrue);\n                }\n                return type;\n            }\n            function narrowTypeByEquality(type, operator, value, assumeTrue) {\n                if (type.flags & 1) {\n                    return type;\n                }\n                if (operator === 32 || operator === 34) {\n                    assumeTrue = !assumeTrue;\n                }\n                var valueType = getTypeOfExpression(value);\n                if (valueType.flags & 6144) {\n                    if (!strictNullChecks) {\n                        return type;\n                    }\n                    var doubleEquals = operator === 31 || operator === 32;\n                    var facts = doubleEquals ?\n                        assumeTrue ? 65536 : 524288 :\n                        value.kind === 94 ?\n                            assumeTrue ? 32768 : 262144 :\n                            assumeTrue ? 16384 : 131072;\n                    return getTypeWithFacts(type, facts);\n                }\n                if (type.flags & 33281) {\n                    return type;\n                }\n                if (assumeTrue) {\n                    var narrowedType = filterType(type, function (t) { return areTypesComparable(t, valueType); });\n                    return narrowedType.flags & 8192 ? type : replacePrimitivesWithLiterals(narrowedType, valueType);\n                }\n                if (isUnitType(valueType)) {\n                    var regularType_1 = getRegularTypeOfLiteralType(valueType);\n                    return filterType(type, function (t) { return getRegularTypeOfLiteralType(t) !== regularType_1; });\n                }\n                return type;\n            }\n            function narrowTypeByTypeof(type, typeOfExpr, operator, literal, assumeTrue) {\n                var target = getReferenceCandidate(typeOfExpr.expression);\n                if (!isMatchingReference(reference, target)) {\n                    if (containsMatchingReference(reference, target)) {\n                        return declaredType;\n                    }\n                    return type;\n                }\n                if (operator === 32 || operator === 34) {\n                    assumeTrue = !assumeTrue;\n                }\n                if (assumeTrue && !(type.flags & 65536)) {\n                    var targetType = typeofTypesByName[literal.text];\n                    if (targetType && isTypeSubtypeOf(targetType, type)) {\n                        return targetType;\n                    }\n                }\n                var facts = assumeTrue ?\n                    typeofEQFacts[literal.text] || 64 :\n                    typeofNEFacts[literal.text] || 8192;\n                return getTypeWithFacts(type, facts);\n            }\n            function narrowTypeBySwitchOnDiscriminant(type, switchStatement, clauseStart, clauseEnd) {\n                var switchTypes = getSwitchClauseTypes(switchStatement);\n                if (!switchTypes.length) {\n                    return type;\n                }\n                var clauseTypes = switchTypes.slice(clauseStart, clauseEnd);\n                var hasDefaultClause = clauseStart === clauseEnd || ts.contains(clauseTypes, neverType);\n                var discriminantType = getUnionType(clauseTypes);\n                var caseType = discriminantType.flags & 8192 ? neverType :\n                    replacePrimitivesWithLiterals(filterType(type, function (t) { return isTypeComparableTo(discriminantType, t); }), discriminantType);\n                if (!hasDefaultClause) {\n                    return caseType;\n                }\n                var defaultType = filterType(type, function (t) { return !(isUnitType(t) && ts.contains(switchTypes, getRegularTypeOfLiteralType(t))); });\n                return caseType.flags & 8192 ? defaultType : getUnionType([caseType, defaultType]);\n            }\n            function narrowTypeByInstanceof(type, expr, assumeTrue) {\n                var left = getReferenceCandidate(expr.left);\n                if (!isMatchingReference(reference, left)) {\n                    if (containsMatchingReference(reference, left)) {\n                        return declaredType;\n                    }\n                    return type;\n                }\n                var rightType = getTypeOfExpression(expr.right);\n                if (!isTypeSubtypeOf(rightType, globalFunctionType)) {\n                    return type;\n                }\n                var targetType;\n                var prototypeProperty = getPropertyOfType(rightType, \"prototype\");\n                if (prototypeProperty) {\n                    var prototypePropertyType = getTypeOfSymbol(prototypeProperty);\n                    if (!isTypeAny(prototypePropertyType)) {\n                        targetType = prototypePropertyType;\n                    }\n                }\n                if (isTypeAny(type) && (targetType === globalObjectType || targetType === globalFunctionType)) {\n                    return type;\n                }\n                if (!targetType) {\n                    var constructSignatures = void 0;\n                    if (getObjectFlags(rightType) & 2) {\n                        constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;\n                    }\n                    else if (getObjectFlags(rightType) & 16) {\n                        constructSignatures = getSignaturesOfType(rightType, 1);\n                    }\n                    if (constructSignatures && constructSignatures.length) {\n                        targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));\n                    }\n                }\n                if (targetType) {\n                    return getNarrowedType(type, targetType, assumeTrue, isTypeInstanceOf);\n                }\n                return type;\n            }\n            function getNarrowedType(type, candidate, assumeTrue, isRelated) {\n                if (!assumeTrue) {\n                    return filterType(type, function (t) { return !isRelated(t, candidate); });\n                }\n                if (type.flags & 65536) {\n                    var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });\n                    if (!(assignableType.flags & 8192)) {\n                        return assignableType;\n                    }\n                }\n                var targetType = type.flags & 16384 ? getApparentType(type) : type;\n                return isTypeSubtypeOf(candidate, type) ? candidate :\n                    isTypeAssignableTo(type, candidate) ? type :\n                        isTypeAssignableTo(candidate, targetType) ? candidate :\n                            getIntersectionType([type, candidate]);\n            }\n            function narrowTypeByTypePredicate(type, callExpression, assumeTrue) {\n                if (!hasMatchingArgument(callExpression, reference) || !maybeTypePredicateCall(callExpression)) {\n                    return type;\n                }\n                var signature = getResolvedSignature(callExpression);\n                var predicate = signature.typePredicate;\n                if (!predicate) {\n                    return type;\n                }\n                if (isTypeAny(type) && (predicate.type === globalObjectType || predicate.type === globalFunctionType)) {\n                    return type;\n                }\n                if (ts.isIdentifierTypePredicate(predicate)) {\n                    var predicateArgument = callExpression.arguments[predicate.parameterIndex];\n                    if (predicateArgument) {\n                        if (isMatchingReference(reference, predicateArgument)) {\n                            return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);\n                        }\n                        if (containsMatchingReference(reference, predicateArgument)) {\n                            return declaredType;\n                        }\n                    }\n                }\n                else {\n                    var invokedExpression = ts.skipParentheses(callExpression.expression);\n                    if (invokedExpression.kind === 178 || invokedExpression.kind === 177) {\n                        var accessExpression = invokedExpression;\n                        var possibleReference = ts.skipParentheses(accessExpression.expression);\n                        if (isMatchingReference(reference, possibleReference)) {\n                            return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);\n                        }\n                        if (containsMatchingReference(reference, possibleReference)) {\n                            return declaredType;\n                        }\n                    }\n                }\n                return type;\n            }\n            function narrowType(type, expr, assumeTrue) {\n                switch (expr.kind) {\n                    case 70:\n                    case 98:\n                    case 177:\n                        return narrowTypeByTruthiness(type, expr, assumeTrue);\n                    case 179:\n                        return narrowTypeByTypePredicate(type, expr, assumeTrue);\n                    case 183:\n                        return narrowType(type, expr.expression, assumeTrue);\n                    case 192:\n                        return narrowTypeByBinaryExpression(type, expr, assumeTrue);\n                    case 190:\n                        if (expr.operator === 50) {\n                            return narrowType(type, expr.operand, !assumeTrue);\n                        }\n                        break;\n                }\n                return type;\n            }\n        }\n        function getTypeOfSymbolAtLocation(symbol, location) {\n            if (location.kind === 70) {\n                if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) {\n                    location = location.parent;\n                }\n                if (ts.isPartOfExpression(location) && !ts.isAssignmentTarget(location)) {\n                    var type = getTypeOfExpression(location);\n                    if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {\n                        return type;\n                    }\n                }\n            }\n            return getTypeOfSymbol(symbol);\n        }\n        function getControlFlowContainer(node) {\n            while (true) {\n                node = node.parent;\n                if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) ||\n                    node.kind === 231 ||\n                    node.kind === 261 ||\n                    node.kind === 147) {\n                    return node;\n                }\n            }\n        }\n        function isParameterAssigned(symbol) {\n            var func = ts.getRootDeclaration(symbol.valueDeclaration).parent;\n            var links = getNodeLinks(func);\n            if (!(links.flags & 4194304)) {\n                links.flags |= 4194304;\n                if (!hasParentWithAssignmentsMarked(func)) {\n                    markParameterAssignments(func);\n                }\n            }\n            return symbol.isAssigned || false;\n        }\n        function hasParentWithAssignmentsMarked(node) {\n            while (true) {\n                node = node.parent;\n                if (!node) {\n                    return false;\n                }\n                if (ts.isFunctionLike(node) && getNodeLinks(node).flags & 4194304) {\n                    return true;\n                }\n            }\n        }\n        function markParameterAssignments(node) {\n            if (node.kind === 70) {\n                if (ts.isAssignmentTarget(node)) {\n                    var symbol = getResolvedSymbol(node);\n                    if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 144) {\n                        symbol.isAssigned = true;\n                    }\n                }\n            }\n            else {\n                ts.forEachChild(node, markParameterAssignments);\n            }\n        }\n        function isConstVariable(symbol) {\n            return symbol.flags & 3 && (getDeclarationNodeFlagsFromSymbol(symbol) & 2) !== 0 && getTypeOfSymbol(symbol) !== autoArrayType;\n        }\n        function checkIdentifier(node) {\n            var symbol = getResolvedSymbol(node);\n            if (symbol === unknownSymbol) {\n                return unknownType;\n            }\n            if (symbol === argumentsSymbol) {\n                var container = ts.getContainingFunction(node);\n                if (languageVersion < 2) {\n                    if (container.kind === 185) {\n                        error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);\n                    }\n                    else if (ts.hasModifier(container, 256)) {\n                        error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method);\n                    }\n                }\n                if (node.flags & 16384) {\n                    getNodeLinks(container).flags |= 8192;\n                }\n                return getTypeOfSymbol(symbol);\n            }\n            if (symbol.flags & 8388608 && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) {\n                markAliasSymbolAsReferenced(symbol);\n            }\n            var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);\n            if (localOrExportSymbol.flags & 32) {\n                var declaration_1 = localOrExportSymbol.valueDeclaration;\n                if (declaration_1.kind === 226\n                    && ts.nodeIsDecorated(declaration_1)) {\n                    var container = ts.getContainingClass(node);\n                    while (container !== undefined) {\n                        if (container === declaration_1 && container.name !== node) {\n                            getNodeLinks(declaration_1).flags |= 8388608;\n                            getNodeLinks(node).flags |= 16777216;\n                            break;\n                        }\n                        container = ts.getContainingClass(container);\n                    }\n                }\n                else if (declaration_1.kind === 197) {\n                    var container = ts.getThisContainer(node, false);\n                    while (container !== undefined) {\n                        if (container.parent === declaration_1) {\n                            if (container.kind === 147 && ts.hasModifier(container, 32)) {\n                                getNodeLinks(declaration_1).flags |= 8388608;\n                                getNodeLinks(node).flags |= 16777216;\n                            }\n                            break;\n                        }\n                        container = ts.getThisContainer(container, false);\n                    }\n                }\n            }\n            checkCollisionWithCapturedSuperVariable(node, node);\n            checkCollisionWithCapturedThisVariable(node, node);\n            checkNestedBlockScopedBinding(node, symbol);\n            var type = getTypeOfSymbol(localOrExportSymbol);\n            var declaration = localOrExportSymbol.valueDeclaration;\n            var assignmentKind = ts.getAssignmentTargetKind(node);\n            if (assignmentKind) {\n                if (!(localOrExportSymbol.flags & 3)) {\n                    error(node, ts.Diagnostics.Cannot_assign_to_0_because_it_is_not_a_variable, symbolToString(symbol));\n                    return unknownType;\n                }\n                if (isReadonlySymbol(localOrExportSymbol)) {\n                    error(node, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(symbol));\n                    return unknownType;\n                }\n            }\n            if (!(localOrExportSymbol.flags & 3) || assignmentKind === 1 || !declaration) {\n                return type;\n            }\n            var isParameter = ts.getRootDeclaration(declaration).kind === 144;\n            var declarationContainer = getControlFlowContainer(declaration);\n            var flowContainer = getControlFlowContainer(node);\n            var isOuterVariable = flowContainer !== declarationContainer;\n            while (flowContainer !== declarationContainer && (flowContainer.kind === 184 ||\n                flowContainer.kind === 185 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&\n                (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {\n                flowContainer = getControlFlowContainer(flowContainer);\n            }\n            var assumeInitialized = isParameter || isOuterVariable ||\n                type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0) ||\n                ts.isInAmbientContext(declaration);\n            var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer);\n            if (type === autoType || type === autoArrayType) {\n                if (flowType === autoType || flowType === autoArrayType) {\n                    if (compilerOptions.noImplicitAny) {\n                        error(declaration.name, ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType));\n                        error(node, ts.Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));\n                    }\n                    return convertAutoToAny(flowType);\n                }\n            }\n            else if (!assumeInitialized && !(getFalsyFlags(type) & 2048) && getFalsyFlags(flowType) & 2048) {\n                error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));\n                return type;\n            }\n            return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;\n        }\n        function isInsideFunction(node, threshold) {\n            var current = node;\n            while (current && current !== threshold) {\n                if (ts.isFunctionLike(current)) {\n                    return true;\n                }\n                current = current.parent;\n            }\n            return false;\n        }\n        function checkNestedBlockScopedBinding(node, symbol) {\n            if (languageVersion >= 2 ||\n                (symbol.flags & (2 | 32)) === 0 ||\n                symbol.valueDeclaration.parent.kind === 256) {\n                return;\n            }\n            var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);\n            var usedInFunction = isInsideFunction(node.parent, container);\n            var current = container;\n            var containedInIterationStatement = false;\n            while (current && !ts.nodeStartsNewLexicalEnvironment(current)) {\n                if (ts.isIterationStatement(current, false)) {\n                    containedInIterationStatement = true;\n                    break;\n                }\n                current = current.parent;\n            }\n            if (containedInIterationStatement) {\n                if (usedInFunction) {\n                    getNodeLinks(current).flags |= 65536;\n                }\n                if (container.kind === 211 &&\n                    ts.getAncestor(symbol.valueDeclaration, 224).parent === container &&\n                    isAssignedInBodyOfForStatement(node, container)) {\n                    getNodeLinks(symbol.valueDeclaration).flags |= 2097152;\n                }\n                getNodeLinks(symbol.valueDeclaration).flags |= 262144;\n            }\n            if (usedInFunction) {\n                getNodeLinks(symbol.valueDeclaration).flags |= 131072;\n            }\n        }\n        function isAssignedInBodyOfForStatement(node, container) {\n            var current = node;\n            while (current.parent.kind === 183) {\n                current = current.parent;\n            }\n            var isAssigned = false;\n            if (ts.isAssignmentTarget(current)) {\n                isAssigned = true;\n            }\n            else if ((current.parent.kind === 190 || current.parent.kind === 191)) {\n                var expr = current.parent;\n                isAssigned = expr.operator === 42 || expr.operator === 43;\n            }\n            if (!isAssigned) {\n                return false;\n            }\n            while (current !== container) {\n                if (current === container.statement) {\n                    return true;\n                }\n                else {\n                    current = current.parent;\n                }\n            }\n            return false;\n        }\n        function captureLexicalThis(node, container) {\n            getNodeLinks(node).flags |= 2;\n            if (container.kind === 147 || container.kind === 150) {\n                var classNode = container.parent;\n                getNodeLinks(classNode).flags |= 4;\n            }\n            else {\n                getNodeLinks(container).flags |= 4;\n            }\n        }\n        function findFirstSuperCall(n) {\n            if (ts.isSuperCall(n)) {\n                return n;\n            }\n            else if (ts.isFunctionLike(n)) {\n                return undefined;\n            }\n            return ts.forEachChild(n, findFirstSuperCall);\n        }\n        function getSuperCallInConstructor(constructor) {\n            var links = getNodeLinks(constructor);\n            if (links.hasSuperCall === undefined) {\n                links.superCall = findFirstSuperCall(constructor.body);\n                links.hasSuperCall = links.superCall ? true : false;\n            }\n            return links.superCall;\n        }\n        function classDeclarationExtendsNull(classDecl) {\n            var classSymbol = getSymbolOfNode(classDecl);\n            var classInstanceType = getDeclaredTypeOfSymbol(classSymbol);\n            var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType);\n            return baseConstructorType === nullWideningType;\n        }\n        function checkThisExpression(node) {\n            var container = ts.getThisContainer(node, true);\n            var needToCaptureLexicalThis = false;\n            if (container.kind === 150) {\n                var containingClassDecl = container.parent;\n                var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl);\n                if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) {\n                    var superCall = getSuperCallInConstructor(container);\n                    if (!superCall || superCall.end > node.pos) {\n                        error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class);\n                    }\n                }\n            }\n            if (container.kind === 185) {\n                container = ts.getThisContainer(container, false);\n                needToCaptureLexicalThis = (languageVersion < 2);\n            }\n            switch (container.kind) {\n                case 230:\n                    error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);\n                    break;\n                case 229:\n                    error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location);\n                    break;\n                case 150:\n                    if (isInConstructorArgumentInitializer(node, container)) {\n                        error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments);\n                    }\n                    break;\n                case 147:\n                case 146:\n                    if (ts.getModifierFlags(container) & 32) {\n                        error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer);\n                    }\n                    break;\n                case 142:\n                    error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);\n                    break;\n            }\n            if (needToCaptureLexicalThis) {\n                captureLexicalThis(node, container);\n            }\n            if (ts.isFunctionLike(container) &&\n                (!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) {\n                if (container.kind === 184 &&\n                    ts.isInJavaScriptFile(container.parent) &&\n                    ts.getSpecialPropertyAssignmentKind(container.parent) === 3) {\n                    var className = container.parent\n                        .left\n                        .expression\n                        .expression;\n                    var classSymbol = checkExpression(className).symbol;\n                    if (classSymbol && classSymbol.members && (classSymbol.flags & 16)) {\n                        return getInferredClassType(classSymbol);\n                    }\n                }\n                var thisType = getThisTypeOfDeclaration(container) || getContextualThisParameterType(container);\n                if (thisType) {\n                    return thisType;\n                }\n            }\n            if (ts.isClassLike(container.parent)) {\n                var symbol = getSymbolOfNode(container.parent);\n                var type = ts.hasModifier(container, 32) ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType;\n                return getFlowTypeOfReference(node, type, true, undefined);\n            }\n            if (ts.isInJavaScriptFile(node)) {\n                var type = getTypeForThisExpressionFromJSDoc(container);\n                if (type && type !== unknownType) {\n                    return type;\n                }\n            }\n            if (compilerOptions.noImplicitThis) {\n                error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation);\n            }\n            return anyType;\n        }\n        function getTypeForThisExpressionFromJSDoc(node) {\n            var jsdocType = ts.getJSDocType(node);\n            if (jsdocType && jsdocType.kind === 274) {\n                var jsDocFunctionType = jsdocType;\n                if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277) {\n                    return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);\n                }\n            }\n        }\n        function isInConstructorArgumentInitializer(node, constructorDecl) {\n            for (var n = node; n && n !== constructorDecl; n = n.parent) {\n                if (n.kind === 144) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function checkSuperExpression(node) {\n            var isCallExpression = node.parent.kind === 179 && node.parent.expression === node;\n            var container = ts.getSuperContainer(node, true);\n            var needToCaptureLexicalThis = false;\n            if (!isCallExpression) {\n                while (container && container.kind === 185) {\n                    container = ts.getSuperContainer(container, true);\n                    needToCaptureLexicalThis = languageVersion < 2;\n                }\n            }\n            var canUseSuperExpression = isLegalUsageOfSuperExpression(container);\n            var nodeCheckFlag = 0;\n            if (!canUseSuperExpression) {\n                var current = node;\n                while (current && current !== container && current.kind !== 142) {\n                    current = current.parent;\n                }\n                if (current && current.kind === 142) {\n                    error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);\n                }\n                else if (isCallExpression) {\n                    error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);\n                }\n                else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 176)) {\n                    error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);\n                }\n                else {\n                    error(node, ts.Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class);\n                }\n                return unknownType;\n            }\n            if ((ts.getModifierFlags(container) & 32) || isCallExpression) {\n                nodeCheckFlag = 512;\n            }\n            else {\n                nodeCheckFlag = 256;\n            }\n            getNodeLinks(node).flags |= nodeCheckFlag;\n            if (container.kind === 149 && ts.getModifierFlags(container) & 256) {\n                if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {\n                    getNodeLinks(container).flags |= 4096;\n                }\n                else {\n                    getNodeLinks(container).flags |= 2048;\n                }\n            }\n            if (needToCaptureLexicalThis) {\n                captureLexicalThis(node.parent, container);\n            }\n            if (container.parent.kind === 176) {\n                if (languageVersion < 2) {\n                    error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);\n                    return unknownType;\n                }\n                else {\n                    return anyType;\n                }\n            }\n            var classLikeDeclaration = container.parent;\n            var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classLikeDeclaration));\n            var baseClassType = classType && getBaseTypes(classType)[0];\n            if (!baseClassType) {\n                if (!ts.getClassExtendsHeritageClauseElement(classLikeDeclaration)) {\n                    error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class);\n                }\n                return unknownType;\n            }\n            if (container.kind === 150 && isInConstructorArgumentInitializer(node, container)) {\n                error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments);\n                return unknownType;\n            }\n            return nodeCheckFlag === 512\n                ? getBaseConstructorTypeOfClass(classType)\n                : getTypeWithThisArgument(baseClassType, classType.thisType);\n            function isLegalUsageOfSuperExpression(container) {\n                if (!container) {\n                    return false;\n                }\n                if (isCallExpression) {\n                    return container.kind === 150;\n                }\n                else {\n                    if (ts.isClassLike(container.parent) || container.parent.kind === 176) {\n                        if (ts.getModifierFlags(container) & 32) {\n                            return container.kind === 149 ||\n                                container.kind === 148 ||\n                                container.kind === 151 ||\n                                container.kind === 152;\n                        }\n                        else {\n                            return container.kind === 149 ||\n                                container.kind === 148 ||\n                                container.kind === 151 ||\n                                container.kind === 152 ||\n                                container.kind === 147 ||\n                                container.kind === 146 ||\n                                container.kind === 150;\n                        }\n                    }\n                }\n                return false;\n            }\n        }\n        function getContextualThisParameterType(func) {\n            if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 185) {\n                var contextualSignature = getContextualSignature(func);\n                if (contextualSignature) {\n                    var thisParameter = contextualSignature.thisParameter;\n                    if (thisParameter) {\n                        return getTypeOfSymbol(thisParameter);\n                    }\n                }\n            }\n            return undefined;\n        }\n        function getContextuallyTypedParameterType(parameter) {\n            var func = parameter.parent;\n            if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) {\n                var iife = ts.getImmediatelyInvokedFunctionExpression(func);\n                if (iife) {\n                    var indexOfParameter = ts.indexOf(func.parameters, parameter);\n                    if (iife.arguments && indexOfParameter < iife.arguments.length) {\n                        if (parameter.dotDotDotToken) {\n                            var restTypes = [];\n                            for (var i = indexOfParameter; i < iife.arguments.length; i++) {\n                                restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i])));\n                            }\n                            return createArrayType(getUnionType(restTypes));\n                        }\n                        var links = getNodeLinks(iife);\n                        var cached = links.resolvedSignature;\n                        links.resolvedSignature = anySignature;\n                        var type = getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter]));\n                        links.resolvedSignature = cached;\n                        return type;\n                    }\n                }\n                var contextualSignature = getContextualSignature(func);\n                if (contextualSignature) {\n                    var funcHasRestParameters = ts.hasRestParameter(func);\n                    var len = func.parameters.length - (funcHasRestParameters ? 1 : 0);\n                    var indexOfParameter = ts.indexOf(func.parameters, parameter);\n                    if (indexOfParameter < len) {\n                        return getTypeAtPosition(contextualSignature, indexOfParameter);\n                    }\n                    if (funcHasRestParameters &&\n                        indexOfParameter === (func.parameters.length - 1) &&\n                        isRestParameterIndex(contextualSignature, func.parameters.length - 1)) {\n                        return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters));\n                    }\n                }\n            }\n            return undefined;\n        }\n        function getContextualTypeForInitializerExpression(node) {\n            var declaration = node.parent;\n            if (node === declaration.initializer) {\n                if (declaration.type) {\n                    return getTypeFromTypeNode(declaration.type);\n                }\n                if (declaration.kind === 144) {\n                    var type = getContextuallyTypedParameterType(declaration);\n                    if (type) {\n                        return type;\n                    }\n                }\n                if (ts.isBindingPattern(declaration.name)) {\n                    return getTypeFromBindingPattern(declaration.name, true, false);\n                }\n                if (ts.isBindingPattern(declaration.parent)) {\n                    var parentDeclaration = declaration.parent.parent;\n                    var name_21 = declaration.propertyName || declaration.name;\n                    if (ts.isVariableLike(parentDeclaration) &&\n                        parentDeclaration.type &&\n                        !ts.isBindingPattern(name_21)) {\n                        var text = ts.getTextOfPropertyName(name_21);\n                        if (text) {\n                            return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text);\n                        }\n                    }\n                }\n            }\n            return undefined;\n        }\n        function getContextualTypeForReturnExpression(node) {\n            var func = ts.getContainingFunction(node);\n            if (ts.isAsyncFunctionLike(func)) {\n                var contextualReturnType = getContextualReturnType(func);\n                if (contextualReturnType) {\n                    return getPromisedType(contextualReturnType);\n                }\n                return undefined;\n            }\n            if (func && !func.asteriskToken) {\n                return getContextualReturnType(func);\n            }\n            return undefined;\n        }\n        function getContextualTypeForYieldOperand(node) {\n            var func = ts.getContainingFunction(node);\n            if (func) {\n                var contextualReturnType = getContextualReturnType(func);\n                if (contextualReturnType) {\n                    return node.asteriskToken\n                        ? contextualReturnType\n                        : getElementTypeOfIterableIterator(contextualReturnType);\n                }\n            }\n            return undefined;\n        }\n        function isInParameterInitializerBeforeContainingFunction(node) {\n            while (node.parent && !ts.isFunctionLike(node.parent)) {\n                if (node.parent.kind === 144 && node.parent.initializer === node) {\n                    return true;\n                }\n                node = node.parent;\n            }\n            return false;\n        }\n        function getContextualReturnType(functionDecl) {\n            if (functionDecl.type ||\n                functionDecl.kind === 150 ||\n                functionDecl.kind === 151 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 152))) {\n                return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl));\n            }\n            var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl);\n            if (signature) {\n                return getReturnTypeOfSignature(signature);\n            }\n            return undefined;\n        }\n        function getContextualTypeForArgument(callTarget, arg) {\n            var args = getEffectiveCallArguments(callTarget);\n            var argIndex = ts.indexOf(args, arg);\n            if (argIndex >= 0) {\n                var signature = getResolvedOrAnySignature(callTarget);\n                return getTypeAtPosition(signature, argIndex);\n            }\n            return undefined;\n        }\n        function getContextualTypeForSubstitutionExpression(template, substitutionExpression) {\n            if (template.parent.kind === 181) {\n                return getContextualTypeForArgument(template.parent, substitutionExpression);\n            }\n            return undefined;\n        }\n        function getContextualTypeForBinaryOperand(node) {\n            var binaryExpression = node.parent;\n            var operator = binaryExpression.operatorToken.kind;\n            if (operator >= 57 && operator <= 69) {\n                if (ts.getSpecialPropertyAssignmentKind(binaryExpression) !== 0) {\n                    return undefined;\n                }\n                if (node === binaryExpression.right) {\n                    return getTypeOfExpression(binaryExpression.left);\n                }\n            }\n            else if (operator === 53) {\n                var type = getContextualType(binaryExpression);\n                if (!type && node === binaryExpression.right) {\n                    type = getTypeOfExpression(binaryExpression.left);\n                }\n                return type;\n            }\n            else if (operator === 52 || operator === 25) {\n                if (node === binaryExpression.right) {\n                    return getContextualType(binaryExpression);\n                }\n            }\n            return undefined;\n        }\n        function applyToContextualType(type, mapper) {\n            if (!(type.flags & 65536)) {\n                return mapper(type);\n            }\n            var types = type.types;\n            var mappedType;\n            var mappedTypes;\n            for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {\n                var current = types_13[_i];\n                var t = mapper(current);\n                if (t) {\n                    if (!mappedType) {\n                        mappedType = t;\n                    }\n                    else if (!mappedTypes) {\n                        mappedTypes = [mappedType, t];\n                    }\n                    else {\n                        mappedTypes.push(t);\n                    }\n                }\n            }\n            return mappedTypes ? getUnionType(mappedTypes) : mappedType;\n        }\n        function getTypeOfPropertyOfContextualType(type, name) {\n            return applyToContextualType(type, function (t) {\n                var prop = t.flags & 229376 ? getPropertyOfType(t, name) : undefined;\n                return prop ? getTypeOfSymbol(prop) : undefined;\n            });\n        }\n        function getIndexTypeOfContextualType(type, kind) {\n            return applyToContextualType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); });\n        }\n        function contextualTypeIsTupleLikeType(type) {\n            return !!(type.flags & 65536 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type));\n        }\n        function getContextualTypeForObjectLiteralMethod(node) {\n            ts.Debug.assert(ts.isObjectLiteralMethod(node));\n            if (isInsideWithStatementBody(node)) {\n                return undefined;\n            }\n            return getContextualTypeForObjectLiteralElement(node);\n        }\n        function getContextualTypeForObjectLiteralElement(element) {\n            var objectLiteral = element.parent;\n            var type = getApparentTypeOfContextualType(objectLiteral);\n            if (type) {\n                if (!ts.hasDynamicName(element)) {\n                    var symbolName = getSymbolOfNode(element).name;\n                    var propertyType = getTypeOfPropertyOfContextualType(type, symbolName);\n                    if (propertyType) {\n                        return propertyType;\n                    }\n                }\n                return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) ||\n                    getIndexTypeOfContextualType(type, 0);\n            }\n            return undefined;\n        }\n        function getContextualTypeForElementExpression(node) {\n            var arrayLiteral = node.parent;\n            var type = getApparentTypeOfContextualType(arrayLiteral);\n            if (type) {\n                var index = ts.indexOf(arrayLiteral.elements, node);\n                return getTypeOfPropertyOfContextualType(type, \"\" + index)\n                    || getIndexTypeOfContextualType(type, 1)\n                    || (languageVersion >= 2 ? getElementTypeOfIterable(type, undefined) : undefined);\n            }\n            return undefined;\n        }\n        function getContextualTypeForConditionalOperand(node) {\n            var conditional = node.parent;\n            return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined;\n        }\n        function getContextualTypeForJsxAttribute(attribute) {\n            var kind = attribute.kind;\n            var jsxElement = attribute.parent;\n            var attrsType = getJsxElementAttributesType(jsxElement);\n            if (attribute.kind === 250) {\n                if (!attrsType || isTypeAny(attrsType)) {\n                    return undefined;\n                }\n                return getTypeOfPropertyOfType(attrsType, attribute.name.text);\n            }\n            else if (attribute.kind === 251) {\n                return attrsType;\n            }\n            ts.Debug.fail(\"Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[\" + kind + \"]\");\n        }\n        function getApparentTypeOfContextualType(node) {\n            var type = getContextualType(node);\n            return type && getApparentType(type);\n        }\n        function getContextualType(node) {\n            if (isInsideWithStatementBody(node)) {\n                return undefined;\n            }\n            if (node.contextualType) {\n                return node.contextualType;\n            }\n            var parent = node.parent;\n            switch (parent.kind) {\n                case 223:\n                case 144:\n                case 147:\n                case 146:\n                case 174:\n                    return getContextualTypeForInitializerExpression(node);\n                case 185:\n                case 216:\n                    return getContextualTypeForReturnExpression(node);\n                case 195:\n                    return getContextualTypeForYieldOperand(parent);\n                case 179:\n                case 180:\n                    return getContextualTypeForArgument(parent, node);\n                case 182:\n                case 200:\n                    return getTypeFromTypeNode(parent.type);\n                case 192:\n                    return getContextualTypeForBinaryOperand(node);\n                case 257:\n                case 258:\n                    return getContextualTypeForObjectLiteralElement(parent);\n                case 175:\n                    return getContextualTypeForElementExpression(node);\n                case 193:\n                    return getContextualTypeForConditionalOperand(node);\n                case 202:\n                    ts.Debug.assert(parent.parent.kind === 194);\n                    return getContextualTypeForSubstitutionExpression(parent.parent, node);\n                case 183:\n                    return getContextualType(parent);\n                case 252:\n                    return getContextualType(parent);\n                case 250:\n                case 251:\n                    return getContextualTypeForJsxAttribute(parent);\n            }\n            return undefined;\n        }\n        function getNonGenericSignature(type, node) {\n            var signatures = getSignaturesOfStructuredType(type, 0);\n            if (signatures.length === 1) {\n                var signature = signatures[0];\n                if (!signature.typeParameters && !isAritySmaller(signature, node)) {\n                    return signature;\n                }\n            }\n        }\n        function isAritySmaller(signature, target) {\n            var targetParameterCount = 0;\n            for (; targetParameterCount < target.parameters.length; targetParameterCount++) {\n                var param = target.parameters[targetParameterCount];\n                if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) {\n                    break;\n                }\n            }\n            if (target.parameters.length && ts.parameterIsThisKeyword(target.parameters[0])) {\n                targetParameterCount--;\n            }\n            var sourceLength = signature.hasRestParameter ? Number.MAX_VALUE : signature.parameters.length;\n            return sourceLength < targetParameterCount;\n        }\n        function isFunctionExpressionOrArrowFunction(node) {\n            return node.kind === 184 || node.kind === 185;\n        }\n        function getContextualSignatureForFunctionLikeDeclaration(node) {\n            return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node)\n                ? getContextualSignature(node)\n                : undefined;\n        }\n        function getContextualTypeForFunctionLikeDeclaration(node) {\n            return ts.isObjectLiteralMethod(node) ?\n                getContextualTypeForObjectLiteralMethod(node) :\n                getApparentTypeOfContextualType(node);\n        }\n        function getContextualSignature(node) {\n            ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node));\n            var type = getContextualTypeForFunctionLikeDeclaration(node);\n            if (!type) {\n                return undefined;\n            }\n            if (!(type.flags & 65536)) {\n                return getNonGenericSignature(type, node);\n            }\n            var signatureList;\n            var types = type.types;\n            for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {\n                var current = types_14[_i];\n                var signature = getNonGenericSignature(current, node);\n                if (signature) {\n                    if (!signatureList) {\n                        signatureList = [signature];\n                    }\n                    else if (!compareSignaturesIdentical(signatureList[0], signature, false, true, true, compareTypesIdentical)) {\n                        return undefined;\n                    }\n                    else {\n                        signatureList.push(signature);\n                    }\n                }\n            }\n            var result;\n            if (signatureList) {\n                result = cloneSignature(signatureList[0]);\n                result.resolvedReturnType = undefined;\n                result.unionSignatures = signatureList;\n            }\n            return result;\n        }\n        function isInferentialContext(mapper) {\n            return mapper && mapper.context;\n        }\n        function checkSpreadExpression(node, contextualMapper) {\n            var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper);\n            return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false);\n        }\n        function hasDefaultValue(node) {\n            return (node.kind === 174 && !!node.initializer) ||\n                (node.kind === 192 && node.operatorToken.kind === 57);\n        }\n        function checkArrayLiteral(node, contextualMapper) {\n            var elements = node.elements;\n            var hasSpreadElement = false;\n            var elementTypes = [];\n            var inDestructuringPattern = ts.isAssignmentTarget(node);\n            for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {\n                var e = elements_1[_i];\n                if (inDestructuringPattern && e.kind === 196) {\n                    var restArrayType = checkExpression(e.expression, contextualMapper);\n                    var restElementType = getIndexTypeOfType(restArrayType, 1) ||\n                        (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined);\n                    if (restElementType) {\n                        elementTypes.push(restElementType);\n                    }\n                }\n                else {\n                    var type = checkExpressionForMutableLocation(e, contextualMapper);\n                    elementTypes.push(type);\n                }\n                hasSpreadElement = hasSpreadElement || e.kind === 196;\n            }\n            if (!hasSpreadElement) {\n                if (inDestructuringPattern && elementTypes.length) {\n                    var type = cloneTypeReference(createTupleType(elementTypes));\n                    type.pattern = node;\n                    return type;\n                }\n                var contextualType = getApparentTypeOfContextualType(node);\n                if (contextualType && contextualTypeIsTupleLikeType(contextualType)) {\n                    var pattern = contextualType.pattern;\n                    if (pattern && (pattern.kind === 173 || pattern.kind === 175)) {\n                        var patternElements = pattern.elements;\n                        for (var i = elementTypes.length; i < patternElements.length; i++) {\n                            var patternElement = patternElements[i];\n                            if (hasDefaultValue(patternElement)) {\n                                elementTypes.push(contextualType.typeArguments[i]);\n                            }\n                            else {\n                                if (patternElement.kind !== 198) {\n                                    error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);\n                                }\n                                elementTypes.push(unknownType);\n                            }\n                        }\n                    }\n                    if (elementTypes.length) {\n                        return createTupleType(elementTypes);\n                    }\n                }\n            }\n            return createArrayType(elementTypes.length ?\n                getUnionType(elementTypes, true) :\n                strictNullChecks ? neverType : undefinedWideningType);\n        }\n        function isNumericName(name) {\n            return name.kind === 142 ? isNumericComputedName(name) : isNumericLiteralName(name.text);\n        }\n        function isNumericComputedName(name) {\n            return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 340);\n        }\n        function isTypeAnyOrAllConstituentTypesHaveKind(type, kind) {\n            return isTypeAny(type) || isTypeOfKind(type, kind);\n        }\n        function isInfinityOrNaNString(name) {\n            return name === \"Infinity\" || name === \"-Infinity\" || name === \"NaN\";\n        }\n        function isNumericLiteralName(name) {\n            return (+name).toString() === name;\n        }\n        function checkComputedPropertyName(node) {\n            var links = getNodeLinks(node.expression);\n            if (!links.resolvedType) {\n                links.resolvedType = checkExpression(node.expression);\n                if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 | 262178 | 512)) {\n                    error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);\n                }\n                else {\n                    checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, true);\n                }\n            }\n            return links.resolvedType;\n        }\n        function getObjectLiteralIndexInfo(propertyNodes, offset, properties, kind) {\n            var propTypes = [];\n            for (var i = 0; i < properties.length; i++) {\n                if (kind === 0 || isNumericName(propertyNodes[i + offset].name)) {\n                    propTypes.push(getTypeOfSymbol(properties[i]));\n                }\n            }\n            var unionType = propTypes.length ? getUnionType(propTypes, true) : undefinedType;\n            return createIndexInfo(unionType, false);\n        }\n        function checkObjectLiteral(node, contextualMapper) {\n            var inDestructuringPattern = ts.isAssignmentTarget(node);\n            checkGrammarObjectLiteralExpression(node, inDestructuringPattern);\n            var propertiesTable = ts.createMap();\n            var propertiesArray = [];\n            var spread = emptyObjectType;\n            var propagatedFlags = 0;\n            var contextualType = getApparentTypeOfContextualType(node);\n            var contextualTypeHasPattern = contextualType && contextualType.pattern &&\n                (contextualType.pattern.kind === 172 || contextualType.pattern.kind === 176);\n            var typeFlags = 0;\n            var patternWithComputedProperties = false;\n            var hasComputedStringProperty = false;\n            var hasComputedNumberProperty = false;\n            var offset = 0;\n            for (var i = 0; i < node.properties.length; i++) {\n                var memberDecl = node.properties[i];\n                var member = memberDecl.symbol;\n                if (memberDecl.kind === 257 ||\n                    memberDecl.kind === 258 ||\n                    ts.isObjectLiteralMethod(memberDecl)) {\n                    var type = void 0;\n                    if (memberDecl.kind === 257) {\n                        type = checkPropertyAssignment(memberDecl, contextualMapper);\n                    }\n                    else if (memberDecl.kind === 149) {\n                        type = checkObjectLiteralMethod(memberDecl, contextualMapper);\n                    }\n                    else {\n                        ts.Debug.assert(memberDecl.kind === 258);\n                        type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper);\n                    }\n                    typeFlags |= type.flags;\n                    var prop = createSymbol(4 | 67108864 | member.flags, member.name);\n                    if (inDestructuringPattern) {\n                        var isOptional = (memberDecl.kind === 257 && hasDefaultValue(memberDecl.initializer)) ||\n                            (memberDecl.kind === 258 && memberDecl.objectAssignmentInitializer);\n                        if (isOptional) {\n                            prop.flags |= 536870912;\n                        }\n                        if (ts.hasDynamicName(memberDecl)) {\n                            patternWithComputedProperties = true;\n                        }\n                    }\n                    else if (contextualTypeHasPattern && !(getObjectFlags(contextualType) & 512)) {\n                        var impliedProp = getPropertyOfType(contextualType, member.name);\n                        if (impliedProp) {\n                            prop.flags |= impliedProp.flags & 536870912;\n                        }\n                        else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, 0)) {\n                            error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType));\n                        }\n                    }\n                    prop.declarations = member.declarations;\n                    prop.parent = member.parent;\n                    if (member.valueDeclaration) {\n                        prop.valueDeclaration = member.valueDeclaration;\n                    }\n                    prop.type = type;\n                    prop.target = member;\n                    member = prop;\n                }\n                else if (memberDecl.kind === 259) {\n                    if (languageVersion < 5) {\n                        checkExternalEmitHelpers(memberDecl, 2);\n                    }\n                    if (propertiesArray.length > 0) {\n                        spread = getSpreadType(spread, createObjectLiteralType(), true);\n                        propertiesArray = [];\n                        propertiesTable = ts.createMap();\n                        hasComputedStringProperty = false;\n                        hasComputedNumberProperty = false;\n                        typeFlags = 0;\n                    }\n                    var type = checkExpression(memberDecl.expression);\n                    if (!isValidSpreadType(type)) {\n                        error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types);\n                        return unknownType;\n                    }\n                    spread = getSpreadType(spread, type, false);\n                    offset = i + 1;\n                    continue;\n                }\n                else {\n                    ts.Debug.assert(memberDecl.kind === 151 || memberDecl.kind === 152);\n                    checkAccessorDeclaration(memberDecl);\n                }\n                if (ts.hasDynamicName(memberDecl)) {\n                    if (isNumericName(memberDecl.name)) {\n                        hasComputedNumberProperty = true;\n                    }\n                    else {\n                        hasComputedStringProperty = true;\n                    }\n                }\n                else {\n                    propertiesTable[member.name] = member;\n                }\n                propertiesArray.push(member);\n            }\n            if (contextualTypeHasPattern) {\n                for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) {\n                    var prop = _a[_i];\n                    if (!propertiesTable[prop.name]) {\n                        if (!(prop.flags & 536870912)) {\n                            error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);\n                        }\n                        propertiesTable[prop.name] = prop;\n                        propertiesArray.push(prop);\n                    }\n                }\n            }\n            if (spread !== emptyObjectType) {\n                if (propertiesArray.length > 0) {\n                    spread = getSpreadType(spread, createObjectLiteralType(), true);\n                }\n                spread.flags |= propagatedFlags;\n                spread.symbol = node.symbol;\n                return spread;\n            }\n            return createObjectLiteralType();\n            function createObjectLiteralType() {\n                var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0) : undefined;\n                var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1) : undefined;\n                var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);\n                var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576;\n                result.flags |= 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064);\n                result.objectFlags |= 128;\n                if (patternWithComputedProperties) {\n                    result.objectFlags |= 512;\n                }\n                if (inDestructuringPattern) {\n                    result.pattern = node;\n                }\n                if (!(result.flags & 6144)) {\n                    propagatedFlags |= (result.flags & 14680064);\n                }\n                return result;\n            }\n        }\n        function isValidSpreadType(type) {\n            return !!(type.flags & (1 | 4096 | 2048) ||\n                type.flags & 32768 && !isGenericMappedType(type) ||\n                type.flags & 196608 && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); }));\n        }\n        function checkJsxSelfClosingElement(node) {\n            checkJsxOpeningLikeElement(node);\n            return jsxElementType || anyType;\n        }\n        function checkJsxElement(node) {\n            checkJsxOpeningLikeElement(node.openingElement);\n            if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) {\n                getIntrinsicTagSymbol(node.closingElement);\n            }\n            else {\n                checkExpression(node.closingElement.tagName);\n            }\n            for (var _i = 0, _a = node.children; _i < _a.length; _i++) {\n                var child = _a[_i];\n                switch (child.kind) {\n                    case 252:\n                        checkJsxExpression(child);\n                        break;\n                    case 246:\n                        checkJsxElement(child);\n                        break;\n                    case 247:\n                        checkJsxSelfClosingElement(child);\n                        break;\n                }\n            }\n            return jsxElementType || anyType;\n        }\n        function isUnhyphenatedJsxName(name) {\n            return name.indexOf(\"-\") < 0;\n        }\n        function isJsxIntrinsicIdentifier(tagName) {\n            if (tagName.kind === 177 || tagName.kind === 98) {\n                return false;\n            }\n            else {\n                return ts.isIntrinsicJsxName(tagName.text);\n            }\n        }\n        function checkJsxAttribute(node, elementAttributesType, nameTable) {\n            var correspondingPropType = undefined;\n            if (elementAttributesType === emptyObjectType && isUnhyphenatedJsxName(node.name.text)) {\n                error(node.parent, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName());\n            }\n            else if (elementAttributesType && !isTypeAny(elementAttributesType)) {\n                var correspondingPropSymbol = getPropertyOfType(elementAttributesType, node.name.text);\n                correspondingPropType = correspondingPropSymbol && getTypeOfSymbol(correspondingPropSymbol);\n                if (isUnhyphenatedJsxName(node.name.text)) {\n                    var attributeType = getTypeOfPropertyOfType(elementAttributesType, ts.getTextOfPropertyName(node.name)) || getIndexTypeOfType(elementAttributesType, 0);\n                    if (attributeType) {\n                        correspondingPropType = attributeType;\n                    }\n                    else {\n                        if (!correspondingPropType) {\n                            error(node.name, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.name.text, typeToString(elementAttributesType));\n                            return unknownType;\n                        }\n                    }\n                }\n            }\n            var exprType;\n            if (node.initializer) {\n                exprType = checkExpression(node.initializer);\n            }\n            else {\n                exprType = booleanType;\n            }\n            if (correspondingPropType) {\n                checkTypeAssignableTo(exprType, correspondingPropType, node);\n            }\n            nameTable[node.name.text] = true;\n            return exprType;\n        }\n        function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) {\n            if (compilerOptions.jsx === 2) {\n                checkExternalEmitHelpers(node, 2);\n            }\n            var type = checkExpression(node.expression);\n            var props = getPropertiesOfType(type);\n            for (var _i = 0, props_2 = props; _i < props_2.length; _i++) {\n                var prop = props_2[_i];\n                if (!nameTable[prop.name]) {\n                    var targetPropSym = getPropertyOfType(elementAttributesType, prop.name);\n                    if (targetPropSym) {\n                        var msg = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property, prop.name);\n                        checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(targetPropSym), node, undefined, msg);\n                    }\n                    nameTable[prop.name] = true;\n                }\n            }\n            return type;\n        }\n        function getJsxType(name) {\n            if (jsxTypes[name] === undefined) {\n                return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType;\n            }\n            return jsxTypes[name];\n        }\n        function getIntrinsicTagSymbol(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedSymbol) {\n                var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements);\n                if (intrinsicElementsType !== unknownType) {\n                    var intrinsicProp = getPropertyOfType(intrinsicElementsType, node.tagName.text);\n                    if (intrinsicProp) {\n                        links.jsxFlags |= 1;\n                        return links.resolvedSymbol = intrinsicProp;\n                    }\n                    var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, 0);\n                    if (indexSignatureType) {\n                        links.jsxFlags |= 2;\n                        return links.resolvedSymbol = intrinsicElementsType.symbol;\n                    }\n                    error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, \"JSX.\" + JsxNames.IntrinsicElements);\n                    return links.resolvedSymbol = unknownSymbol;\n                }\n                else {\n                    if (compilerOptions.noImplicitAny) {\n                        error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements);\n                    }\n                    return links.resolvedSymbol = unknownSymbol;\n                }\n            }\n            return links.resolvedSymbol;\n        }\n        function getJsxElementInstanceType(node, valueType) {\n            ts.Debug.assert(!(valueType.flags & 65536));\n            if (isTypeAny(valueType)) {\n                return anyType;\n            }\n            var signatures = getSignaturesOfType(valueType, 1);\n            if (signatures.length === 0) {\n                signatures = getSignaturesOfType(valueType, 0);\n                if (signatures.length === 0) {\n                    error(node.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(node.tagName));\n                    return unknownType;\n                }\n            }\n            return getUnionType(ts.map(signatures, getReturnTypeOfSignature), true);\n        }\n        function getJsxElementPropertiesName() {\n            var jsxNamespace = getGlobalSymbol(JsxNames.JSX, 1920, undefined);\n            var attribsPropTypeSym = jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.ElementAttributesPropertyNameContainer, 793064);\n            var attribPropType = attribsPropTypeSym && getDeclaredTypeOfSymbol(attribsPropTypeSym);\n            var attribProperties = attribPropType && getPropertiesOfType(attribPropType);\n            if (attribProperties) {\n                if (attribProperties.length === 0) {\n                    return \"\";\n                }\n                else if (attribProperties.length === 1) {\n                    return attribProperties[0].name;\n                }\n                else {\n                    error(attribsPropTypeSym.declarations[0], ts.Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, JsxNames.ElementAttributesPropertyNameContainer);\n                    return undefined;\n                }\n            }\n            else {\n                return undefined;\n            }\n        }\n        function getResolvedJsxType(node, elemType, elemClassType) {\n            if (!elemType) {\n                elemType = checkExpression(node.tagName);\n            }\n            if (elemType.flags & 65536) {\n                var types = elemType.types;\n                return getUnionType(ts.map(types, function (type) {\n                    return getResolvedJsxType(node, type, elemClassType);\n                }), true);\n            }\n            if (elemType.flags & 2) {\n                return anyType;\n            }\n            else if (elemType.flags & 32) {\n                var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements);\n                if (intrinsicElementsType !== unknownType) {\n                    var stringLiteralTypeName = elemType.text;\n                    var intrinsicProp = getPropertyOfType(intrinsicElementsType, stringLiteralTypeName);\n                    if (intrinsicProp) {\n                        return getTypeOfSymbol(intrinsicProp);\n                    }\n                    var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, 0);\n                    if (indexSignatureType) {\n                        return indexSignatureType;\n                    }\n                    error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, stringLiteralTypeName, \"JSX.\" + JsxNames.IntrinsicElements);\n                }\n                return anyType;\n            }\n            var elemInstanceType = getJsxElementInstanceType(node, elemType);\n            if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) {\n                if (jsxElementType) {\n                    var callSignatures = elemType && getSignaturesOfType(elemType, 0);\n                    var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0];\n                    var callReturnType = callSignature && getReturnTypeOfSignature(callSignature);\n                    var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0]));\n                    if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) {\n                        var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes);\n                        if (intrinsicAttributes !== unknownType) {\n                            paramType = intersectTypes(intrinsicAttributes, paramType);\n                        }\n                        return paramType;\n                    }\n                }\n            }\n            if (elemClassType) {\n                checkTypeRelatedTo(elemInstanceType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements);\n            }\n            if (isTypeAny(elemInstanceType)) {\n                return elemInstanceType;\n            }\n            var propsName = getJsxElementPropertiesName();\n            if (propsName === undefined) {\n                return anyType;\n            }\n            else if (propsName === \"\") {\n                return elemInstanceType;\n            }\n            else {\n                var attributesType = getTypeOfPropertyOfType(elemInstanceType, propsName);\n                if (!attributesType) {\n                    return emptyObjectType;\n                }\n                else if (isTypeAny(attributesType) || (attributesType === unknownType)) {\n                    return attributesType;\n                }\n                else if (attributesType.flags & 65536) {\n                    error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type, typeToString(attributesType));\n                    return anyType;\n                }\n                else {\n                    var apparentAttributesType = attributesType;\n                    var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes);\n                    if (intrinsicClassAttribs !== unknownType) {\n                        var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol);\n                        if (typeParams) {\n                            if (typeParams.length === 1) {\n                                apparentAttributesType = intersectTypes(createTypeReference(intrinsicClassAttribs, [elemInstanceType]), apparentAttributesType);\n                            }\n                        }\n                        else {\n                            apparentAttributesType = intersectTypes(attributesType, intrinsicClassAttribs);\n                        }\n                    }\n                    var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes);\n                    if (intrinsicAttribs !== unknownType) {\n                        apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType);\n                    }\n                    return apparentAttributesType;\n                }\n            }\n        }\n        function getJsxElementAttributesType(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedJsxType) {\n                if (isJsxIntrinsicIdentifier(node.tagName)) {\n                    var symbol = getIntrinsicTagSymbol(node);\n                    if (links.jsxFlags & 1) {\n                        return links.resolvedJsxType = getTypeOfSymbol(symbol);\n                    }\n                    else if (links.jsxFlags & 2) {\n                        return links.resolvedJsxType = getIndexInfoOfSymbol(symbol, 0).type;\n                    }\n                    else {\n                        return links.resolvedJsxType = unknownType;\n                    }\n                }\n                else {\n                    var elemClassType = getJsxGlobalElementClassType();\n                    return links.resolvedJsxType = getResolvedJsxType(node, undefined, elemClassType);\n                }\n            }\n            return links.resolvedJsxType;\n        }\n        function getJsxAttributePropertySymbol(attrib) {\n            var attributesType = getJsxElementAttributesType(attrib.parent);\n            var prop = getPropertyOfType(attributesType, attrib.name.text);\n            return prop || unknownSymbol;\n        }\n        function getJsxGlobalElementClassType() {\n            if (!jsxElementClassType) {\n                jsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass);\n            }\n            return jsxElementClassType;\n        }\n        function getJsxIntrinsicTagNames() {\n            var intrinsics = getJsxType(JsxNames.IntrinsicElements);\n            return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray;\n        }\n        function checkJsxPreconditions(errorNode) {\n            if ((compilerOptions.jsx || 0) === 0) {\n                error(errorNode, ts.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided);\n            }\n            if (jsxElementType === undefined) {\n                if (compilerOptions.noImplicitAny) {\n                    error(errorNode, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist);\n                }\n            }\n        }\n        function checkJsxOpeningLikeElement(node) {\n            checkGrammarJsxElement(node);\n            checkJsxPreconditions(node);\n            var reactRefErr = compilerOptions.jsx === 2 ? ts.Diagnostics.Cannot_find_name_0 : undefined;\n            var reactNamespace = getJsxNamespace();\n            var reactSym = resolveName(node.tagName, reactNamespace, 107455, reactRefErr, reactNamespace);\n            if (reactSym) {\n                reactSym.isReferenced = true;\n                if (reactSym.flags & 8388608 && !isConstEnumOrConstEnumOnlyModule(resolveAlias(reactSym))) {\n                    markAliasSymbolAsReferenced(reactSym);\n                }\n            }\n            var targetAttributesType = getJsxElementAttributesType(node);\n            var nameTable = ts.createMap();\n            var sawSpreadedAny = false;\n            for (var i = node.attributes.length - 1; i >= 0; i--) {\n                if (node.attributes[i].kind === 250) {\n                    checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable);\n                }\n                else {\n                    ts.Debug.assert(node.attributes[i].kind === 251);\n                    var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable);\n                    if (isTypeAny(spreadType)) {\n                        sawSpreadedAny = true;\n                    }\n                }\n            }\n            if (targetAttributesType && !sawSpreadedAny) {\n                var targetProperties = getPropertiesOfType(targetAttributesType);\n                for (var i = 0; i < targetProperties.length; i++) {\n                    if (!(targetProperties[i].flags & 536870912) &&\n                        !nameTable[targetProperties[i].name]) {\n                        error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperties[i].name, typeToString(targetAttributesType));\n                    }\n                }\n            }\n        }\n        function checkJsxExpression(node) {\n            if (node.expression) {\n                return checkExpression(node.expression);\n            }\n            else {\n                return unknownType;\n            }\n        }\n        function getDeclarationKindFromSymbol(s) {\n            return s.valueDeclaration ? s.valueDeclaration.kind : 147;\n        }\n        function getDeclarationModifierFlagsFromSymbol(s) {\n            return s.valueDeclaration ? ts.getCombinedModifierFlags(s.valueDeclaration) : s.flags & 134217728 ? 4 | 32 : 0;\n        }\n        function getDeclarationNodeFlagsFromSymbol(s) {\n            return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : 0;\n        }\n      function checkClassPropertyAccess(node, left, type, prop) {\n        return true;//AndroidUIX Modify\n      }\n      function AndroidUIXIgnore_checkClassPropertyAccess(node, left, type, prop) {\n            var flags = getDeclarationModifierFlagsFromSymbol(prop);\n            var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop));\n            var errorNode = node.kind === 177 || node.kind === 223 ?\n                node.name :\n                node.right;\n            if (left.kind === 96) {\n                if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 149) {\n                    error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword);\n                    return false;\n                }\n                if (flags & 128) {\n                    error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(declaringClass));\n                    return false;\n                }\n            }\n            if (!(flags & 24)) {\n                return true;\n            }\n            if (flags & 8) {\n                var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));\n                if (!isNodeWithinClass(node, declaringClassDeclaration)) {\n                    error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass));\n                    return false;\n                }\n                return true;\n            }\n            if (left.kind === 96) {\n                return true;\n            }\n            var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) {\n                var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration));\n                return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined;\n            });\n            if (!enclosingClass) {\n                error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass));\n                return false;\n            }\n            if (flags & 32) {\n                return true;\n            }\n            if (type.flags & 16384 && type.isThisType) {\n                type = getConstraintOfTypeParameter(type);\n            }\n            if (!(getObjectFlags(getTargetType(type)) & 3 && hasBaseType(type, enclosingClass))) {\n                error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass));\n                return false;\n            }\n            return true;\n        }\n        function checkNonNullExpression(node) {\n            var type = checkExpression(node);\n            if (strictNullChecks) {\n                var kind = getFalsyFlags(type) & 6144;\n                if (kind) {\n                    error(node, kind & 2048 ? kind & 4096 ?\n                        ts.Diagnostics.Object_is_possibly_null_or_undefined :\n                        ts.Diagnostics.Object_is_possibly_undefined :\n                        ts.Diagnostics.Object_is_possibly_null);\n                }\n                return getNonNullableType(type);\n            }\n            return type;\n        }\n        function checkPropertyAccessExpression(node) {\n            return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name);\n        }\n        function checkQualifiedName(node) {\n            return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right);\n        }\n        function reportNonexistentProperty(propNode, containingType) {\n            var errorInfo;\n            if (containingType.flags & 65536 && !(containingType.flags & 8190)) {\n                for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) {\n                    var subtype = _a[_i];\n                    if (!getPropertyOfType(subtype, propNode.text)) {\n                        errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(subtype));\n                        break;\n                    }\n                }\n            }\n            errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(containingType));\n            diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(propNode, errorInfo));\n        }\n        function markPropertyAsReferenced(prop) {\n            if (prop &&\n                noUnusedIdentifiers &&\n                (prop.flags & 106500) &&\n                prop.valueDeclaration && (ts.getModifierFlags(prop.valueDeclaration) & 8)) {\n                if (prop.flags & 16777216) {\n                    getSymbolLinks(prop).target.isReferenced = true;\n                }\n                else {\n                    prop.isReferenced = true;\n                }\n            }\n        }\n        function checkPropertyAccessExpressionOrQualifiedName(node, left, right) {\n            var type = checkNonNullExpression(left);\n            if (isTypeAny(type) || type === silentNeverType) {\n                return type;\n            }\n            var apparentType = getApparentType(getWidenedType(type));\n            if (apparentType === unknownType || (type.flags & 16384 && isTypeAny(apparentType))) {\n                return apparentType;\n            }\n            var prop = getPropertyOfType(apparentType, right.text);\n            if (!prop) {\n                if (right.text && !checkAndReportErrorForExtendingInterface(node)) {\n                    reportNonexistentProperty(right, type.flags & 16384 && type.isThisType ? apparentType : type);\n                }\n                return unknownType;\n            }\n            markPropertyAsReferenced(prop);\n            getNodeLinks(node).resolvedSymbol = prop;\n            if (prop.parent && prop.parent.flags & 32) {\n                checkClassPropertyAccess(node, left, apparentType, prop);\n            }\n            var propType = getTypeOfSymbol(prop);\n            var assignmentKind = ts.getAssignmentTargetKind(node);\n            if (assignmentKind) {\n                if (isReferenceToReadonlyEntity(node, prop) || isReferenceThroughNamespaceImport(node)) {\n                    error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, right.text);\n                    return unknownType;\n                }\n            }\n            if (node.kind !== 177 || assignmentKind === 1 ||\n                !(prop.flags & (3 | 4 | 98304)) &&\n                    !(prop.flags & 8192 && propType.flags & 65536)) {\n                return propType;\n            }\n            var flowType = getFlowTypeOfReference(node, propType, true, undefined);\n            return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;\n        }\n        function isValidPropertyAccess(node, propertyName) {\n            var left = node.kind === 177\n                ? node.expression\n                : node.left;\n            var type = checkExpression(left);\n            if (type !== unknownType && !isTypeAny(type)) {\n                var prop = getPropertyOfType(getWidenedType(type), propertyName);\n                if (prop && prop.parent && prop.parent.flags & 32) {\n                    return checkClassPropertyAccess(node, left, type, prop);\n                }\n            }\n            return true;\n        }\n        function getForInVariableSymbol(node) {\n            var initializer = node.initializer;\n            if (initializer.kind === 224) {\n                var variable = initializer.declarations[0];\n                if (variable && !ts.isBindingPattern(variable.name)) {\n                    return getSymbolOfNode(variable);\n                }\n            }\n            else if (initializer.kind === 70) {\n                return getResolvedSymbol(initializer);\n            }\n            return undefined;\n        }\n        function hasNumericPropertyNames(type) {\n            return getIndexTypeOfType(type, 1) && !getIndexTypeOfType(type, 0);\n        }\n        function isForInVariableForNumericPropertyNames(expr) {\n            var e = ts.skipParentheses(expr);\n            if (e.kind === 70) {\n                var symbol = getResolvedSymbol(e);\n                if (symbol.flags & 3) {\n                    var child = expr;\n                    var node = expr.parent;\n                    while (node) {\n                        if (node.kind === 212 &&\n                            child === node.statement &&\n                            getForInVariableSymbol(node) === symbol &&\n                            hasNumericPropertyNames(getTypeOfExpression(node.expression))) {\n                            return true;\n                        }\n                        child = node;\n                        node = node.parent;\n                    }\n                }\n            }\n            return false;\n        }\n        function checkIndexedAccess(node) {\n            var objectType = checkNonNullExpression(node.expression);\n            var indexExpression = node.argumentExpression;\n            if (!indexExpression) {\n                var sourceFile = ts.getSourceFileOfNode(node);\n                if (node.parent.kind === 180 && node.parent.expression === node) {\n                    var start = ts.skipTrivia(sourceFile.text, node.expression.end);\n                    var end = node.end;\n                    grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead);\n                }\n                else {\n                    var start = node.end - \"]\".length;\n                    var end = node.end;\n                    grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected);\n                }\n                return unknownType;\n            }\n            var indexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : checkExpression(indexExpression);\n            if (objectType === unknownType || objectType === silentNeverType) {\n                return objectType;\n            }\n            if (isConstEnumObjectType(objectType) && indexExpression.kind !== 9) {\n                error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);\n                return unknownType;\n            }\n            return getIndexedAccessType(objectType, indexType, node);\n        }\n        function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) {\n            if (expressionType === unknownType) {\n                return false;\n            }\n            if (!ts.isWellKnownSymbolSyntactically(expression)) {\n                return false;\n            }\n            if ((expressionType.flags & 512) === 0) {\n                if (reportError) {\n                    error(expression, ts.Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, ts.getTextOfNode(expression));\n                }\n                return false;\n            }\n            var leftHandSide = expression.expression;\n            var leftHandSideSymbol = getResolvedSymbol(leftHandSide);\n            if (!leftHandSideSymbol) {\n                return false;\n            }\n            var globalESSymbol = getGlobalESSymbolConstructorSymbol();\n            if (!globalESSymbol) {\n                return false;\n            }\n            if (leftHandSideSymbol !== globalESSymbol) {\n                if (reportError) {\n                    error(leftHandSide, ts.Diagnostics.Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object);\n                }\n                return false;\n            }\n            return true;\n        }\n        function resolveUntypedCall(node) {\n            if (node.kind === 181) {\n                checkExpression(node.template);\n            }\n            else if (node.kind !== 145) {\n                ts.forEach(node.arguments, function (argument) {\n                    checkExpression(argument);\n                });\n            }\n            return anySignature;\n        }\n        function resolveErrorCall(node) {\n            resolveUntypedCall(node);\n            return unknownSignature;\n        }\n        function reorderCandidates(signatures, result) {\n            var lastParent;\n            var lastSymbol;\n            var cutoffIndex = 0;\n            var index;\n            var specializedIndex = -1;\n            var spliceIndex;\n            ts.Debug.assert(!result.length);\n            for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) {\n                var signature = signatures_2[_i];\n                var symbol = signature.declaration && getSymbolOfNode(signature.declaration);\n                var parent_8 = signature.declaration && signature.declaration.parent;\n                if (!lastSymbol || symbol === lastSymbol) {\n                    if (lastParent && parent_8 === lastParent) {\n                        index++;\n                    }\n                    else {\n                        lastParent = parent_8;\n                        index = cutoffIndex;\n                    }\n                }\n                else {\n                    index = cutoffIndex = result.length;\n                    lastParent = parent_8;\n                }\n                lastSymbol = symbol;\n                if (signature.hasLiteralTypes) {\n                    specializedIndex++;\n                    spliceIndex = specializedIndex;\n                    cutoffIndex++;\n                }\n                else {\n                    spliceIndex = index;\n                }\n                result.splice(spliceIndex, 0, signature);\n            }\n        }\n        function getSpreadArgumentIndex(args) {\n            for (var i = 0; i < args.length; i++) {\n                var arg = args[i];\n                if (arg && arg.kind === 196) {\n                    return i;\n                }\n            }\n            return -1;\n        }\n        function hasCorrectArity(node, args, signature, signatureHelpTrailingComma) {\n            if (signatureHelpTrailingComma === void 0) { signatureHelpTrailingComma = false; }\n            var argCount;\n            var typeArguments;\n            var callIsIncomplete;\n            var isDecorator;\n            var spreadArgIndex = -1;\n            if (node.kind === 181) {\n                var tagExpression = node;\n                argCount = args.length;\n                typeArguments = undefined;\n                if (tagExpression.template.kind === 194) {\n                    var templateExpression = tagExpression.template;\n                    var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans);\n                    ts.Debug.assert(lastSpan !== undefined);\n                    callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated;\n                }\n                else {\n                    var templateLiteral = tagExpression.template;\n                    ts.Debug.assert(templateLiteral.kind === 12);\n                    callIsIncomplete = !!templateLiteral.isUnterminated;\n                }\n            }\n            else if (node.kind === 145) {\n                isDecorator = true;\n                typeArguments = undefined;\n                argCount = getEffectiveArgumentCount(node, undefined, signature);\n            }\n            else {\n                var callExpression = node;\n                if (!callExpression.arguments) {\n                    ts.Debug.assert(callExpression.kind === 180);\n                    return signature.minArgumentCount === 0;\n                }\n                argCount = signatureHelpTrailingComma ? args.length + 1 : args.length;\n                callIsIncomplete = callExpression.arguments.end === callExpression.end;\n                typeArguments = callExpression.typeArguments;\n                spreadArgIndex = getSpreadArgumentIndex(args);\n            }\n            var hasRightNumberOfTypeArgs = !typeArguments ||\n                (signature.typeParameters && typeArguments.length === signature.typeParameters.length);\n            if (!hasRightNumberOfTypeArgs) {\n                return false;\n            }\n            if (spreadArgIndex >= 0) {\n                return isRestParameterIndex(signature, spreadArgIndex);\n            }\n            if (!signature.hasRestParameter && argCount > signature.parameters.length) {\n                return false;\n            }\n            var hasEnoughArguments = argCount >= signature.minArgumentCount;\n            return callIsIncomplete || hasEnoughArguments;\n        }\n        function getSingleCallSignature(type) {\n            if (type.flags & 32768) {\n                var resolved = resolveStructuredTypeMembers(type);\n                if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 &&\n                    resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {\n                    return resolved.callSignatures[0];\n                }\n            }\n            return undefined;\n        }\n        function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) {\n            var context = createInferenceContext(signature, true);\n            forEachMatchingParameterType(contextualSignature, signature, function (source, target) {\n                inferTypesWithContext(context, instantiateType(source, contextualMapper), target);\n            });\n            return getSignatureInstantiation(signature, getInferredTypes(context));\n        }\n        function inferTypeArguments(node, signature, args, excludeArgument, context) {\n            var typeParameters = signature.typeParameters;\n            var inferenceMapper = getInferenceMapper(context);\n            for (var i = 0; i < typeParameters.length; i++) {\n                if (!context.inferences[i].isFixed) {\n                    context.inferredTypes[i] = undefined;\n                }\n            }\n            if (context.failedTypeParameterIndex !== undefined && !context.inferences[context.failedTypeParameterIndex].isFixed) {\n                context.failedTypeParameterIndex = undefined;\n            }\n            var thisType = getThisTypeOfSignature(signature);\n            if (thisType) {\n                var thisArgumentNode = getThisArgumentOfCall(node);\n                var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType;\n                inferTypesWithContext(context, thisArgumentType, thisType);\n            }\n            var argCount = getEffectiveArgumentCount(node, args, signature);\n            for (var i = 0; i < argCount; i++) {\n                var arg = getEffectiveArgument(node, args, i);\n                if (arg === undefined || arg.kind !== 198) {\n                    var paramType = getTypeAtPosition(signature, i);\n                    var argType = getEffectiveArgumentType(node, i);\n                    if (argType === undefined) {\n                        var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper;\n                        argType = checkExpressionWithContextualType(arg, paramType, mapper);\n                    }\n                    inferTypesWithContext(context, argType, paramType);\n                }\n            }\n            if (excludeArgument) {\n                for (var i = 0; i < argCount; i++) {\n                    if (excludeArgument[i] === false) {\n                        var arg = args[i];\n                        var paramType = getTypeAtPosition(signature, i);\n                        inferTypesWithContext(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType);\n                    }\n                }\n            }\n            getInferredTypes(context);\n        }\n        function checkTypeArguments(signature, typeArgumentNodes, typeArgumentTypes, reportErrors, headMessage) {\n            var typeParameters = signature.typeParameters;\n            var typeArgumentsAreAssignable = true;\n            var mapper;\n            for (var i = 0; i < typeParameters.length; i++) {\n                if (typeArgumentsAreAssignable) {\n                    var constraint = getConstraintOfTypeParameter(typeParameters[i]);\n                    if (constraint) {\n                        var errorInfo = void 0;\n                        var typeArgumentHeadMessage = ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1;\n                        if (reportErrors && headMessage) {\n                            errorInfo = ts.chainDiagnosticMessages(errorInfo, typeArgumentHeadMessage);\n                            typeArgumentHeadMessage = headMessage;\n                        }\n                        if (!mapper) {\n                            mapper = createTypeMapper(typeParameters, typeArgumentTypes);\n                        }\n                        var typeArgument = typeArgumentTypes[i];\n                        typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), reportErrors ? typeArgumentNodes[i] : undefined, typeArgumentHeadMessage, errorInfo);\n                    }\n                }\n            }\n            return typeArgumentsAreAssignable;\n        }\n        function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) {\n            var thisType = getThisTypeOfSignature(signature);\n            if (thisType && thisType !== voidType && node.kind !== 180) {\n                var thisArgumentNode = getThisArgumentOfCall(node);\n                var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType;\n                var errorNode = reportErrors ? (thisArgumentNode || node) : undefined;\n                var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1;\n                if (!checkTypeRelatedTo(thisArgumentType, getThisTypeOfSignature(signature), relation, errorNode, headMessage_1)) {\n                    return false;\n                }\n            }\n            var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1;\n            var argCount = getEffectiveArgumentCount(node, args, signature);\n            for (var i = 0; i < argCount; i++) {\n                var arg = getEffectiveArgument(node, args, i);\n                if (arg === undefined || arg.kind !== 198) {\n                    var paramType = getTypeAtPosition(signature, i);\n                    var argType = getEffectiveArgumentType(node, i);\n                    if (argType === undefined) {\n                        argType = checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined);\n                    }\n                    var errorNode = reportErrors ? getEffectiveArgumentErrorNode(node, i, arg) : undefined;\n                    if (!checkTypeRelatedTo(argType, paramType, relation, errorNode, headMessage)) {\n                        return false;\n                    }\n                }\n            }\n            return true;\n        }\n        function getThisArgumentOfCall(node) {\n            if (node.kind === 179) {\n                var callee = node.expression;\n                if (callee.kind === 177) {\n                    return callee.expression;\n                }\n                else if (callee.kind === 178) {\n                    return callee.expression;\n                }\n            }\n        }\n        function getEffectiveCallArguments(node) {\n            var args;\n            if (node.kind === 181) {\n                var template = node.template;\n                args = [undefined];\n                if (template.kind === 194) {\n                    ts.forEach(template.templateSpans, function (span) {\n                        args.push(span.expression);\n                    });\n                }\n            }\n            else if (node.kind === 145) {\n                return undefined;\n            }\n            else {\n                args = node.arguments || emptyArray;\n            }\n            return args;\n        }\n        function getEffectiveArgumentCount(node, args, signature) {\n            if (node.kind === 145) {\n                switch (node.parent.kind) {\n                    case 226:\n                    case 197:\n                        return 1;\n                    case 147:\n                        return 2;\n                    case 149:\n                    case 151:\n                    case 152:\n                        if (languageVersion === 0) {\n                            return 2;\n                        }\n                        return signature.parameters.length >= 3 ? 3 : 2;\n                    case 144:\n                        return 3;\n                }\n            }\n            else {\n                return args.length;\n            }\n        }\n        function getEffectiveDecoratorFirstArgumentType(node) {\n            if (node.kind === 226) {\n                var classSymbol = getSymbolOfNode(node);\n                return getTypeOfSymbol(classSymbol);\n            }\n            if (node.kind === 144) {\n                node = node.parent;\n                if (node.kind === 150) {\n                    var classSymbol = getSymbolOfNode(node);\n                    return getTypeOfSymbol(classSymbol);\n                }\n            }\n            if (node.kind === 147 ||\n                node.kind === 149 ||\n                node.kind === 151 ||\n                node.kind === 152) {\n                return getParentTypeOfClassElement(node);\n            }\n            ts.Debug.fail(\"Unsupported decorator target.\");\n            return unknownType;\n        }\n        function getEffectiveDecoratorSecondArgumentType(node) {\n            if (node.kind === 226) {\n                ts.Debug.fail(\"Class decorators should not have a second synthetic argument.\");\n                return unknownType;\n            }\n            if (node.kind === 144) {\n                node = node.parent;\n                if (node.kind === 150) {\n                    return anyType;\n                }\n            }\n            if (node.kind === 147 ||\n                node.kind === 149 ||\n                node.kind === 151 ||\n                node.kind === 152) {\n                var element = node;\n                switch (element.name.kind) {\n                    case 70:\n                    case 8:\n                    case 9:\n                        return getLiteralTypeForText(32, element.name.text);\n                    case 142:\n                        var nameType = checkComputedPropertyName(element.name);\n                        if (isTypeOfKind(nameType, 512)) {\n                            return nameType;\n                        }\n                        else {\n                            return stringType;\n                        }\n                    default:\n                        ts.Debug.fail(\"Unsupported property name.\");\n                        return unknownType;\n                }\n            }\n            ts.Debug.fail(\"Unsupported decorator target.\");\n            return unknownType;\n        }\n        function getEffectiveDecoratorThirdArgumentType(node) {\n            if (node.kind === 226) {\n                ts.Debug.fail(\"Class decorators should not have a third synthetic argument.\");\n                return unknownType;\n            }\n            if (node.kind === 144) {\n                return numberType;\n            }\n            if (node.kind === 147) {\n                ts.Debug.fail(\"Property decorators should not have a third synthetic argument.\");\n                return unknownType;\n            }\n            if (node.kind === 149 ||\n                node.kind === 151 ||\n                node.kind === 152) {\n                var propertyType = getTypeOfNode(node);\n                return createTypedPropertyDescriptorType(propertyType);\n            }\n            ts.Debug.fail(\"Unsupported decorator target.\");\n            return unknownType;\n        }\n        function getEffectiveDecoratorArgumentType(node, argIndex) {\n            if (argIndex === 0) {\n                return getEffectiveDecoratorFirstArgumentType(node.parent);\n            }\n            else if (argIndex === 1) {\n                return getEffectiveDecoratorSecondArgumentType(node.parent);\n            }\n            else if (argIndex === 2) {\n                return getEffectiveDecoratorThirdArgumentType(node.parent);\n            }\n            ts.Debug.fail(\"Decorators should not have a fourth synthetic argument.\");\n            return unknownType;\n        }\n        function getEffectiveArgumentType(node, argIndex) {\n            if (node.kind === 145) {\n                return getEffectiveDecoratorArgumentType(node, argIndex);\n            }\n            else if (argIndex === 0 && node.kind === 181) {\n                return getGlobalTemplateStringsArrayType();\n            }\n            return undefined;\n        }\n        function getEffectiveArgument(node, args, argIndex) {\n            if (node.kind === 145 ||\n                (argIndex === 0 && node.kind === 181)) {\n                return undefined;\n            }\n            return args[argIndex];\n        }\n        function getEffectiveArgumentErrorNode(node, argIndex, arg) {\n            if (node.kind === 145) {\n                return node.expression;\n            }\n            else if (argIndex === 0 && node.kind === 181) {\n                return node.template;\n            }\n            else {\n                return arg;\n            }\n        }\n        function resolveCall(node, signatures, candidatesOutArray, headMessage) {\n            var isTaggedTemplate = node.kind === 181;\n            var isDecorator = node.kind === 145;\n            var typeArguments;\n            if (!isTaggedTemplate && !isDecorator) {\n                typeArguments = node.typeArguments;\n                if (node.expression.kind !== 96) {\n                    ts.forEach(typeArguments, checkSourceElement);\n                }\n            }\n            var candidates = candidatesOutArray || [];\n            reorderCandidates(signatures, candidates);\n            if (!candidates.length) {\n                reportError(ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target);\n                return resolveErrorCall(node);\n            }\n            var args = getEffectiveCallArguments(node);\n            var excludeArgument;\n            if (!isDecorator) {\n                for (var i = isTaggedTemplate ? 1 : 0; i < args.length; i++) {\n                    if (isContextSensitive(args[i])) {\n                        if (!excludeArgument) {\n                            excludeArgument = new Array(args.length);\n                        }\n                        excludeArgument[i] = true;\n                    }\n                }\n            }\n            var candidateForArgumentError;\n            var candidateForTypeArgumentError;\n            var resultOfFailedInference;\n            var result;\n            var signatureHelpTrailingComma = candidatesOutArray && node.kind === 179 && node.arguments.hasTrailingComma;\n            if (candidates.length > 1) {\n                result = chooseOverload(candidates, subtypeRelation, signatureHelpTrailingComma);\n            }\n            if (!result) {\n                candidateForArgumentError = undefined;\n                candidateForTypeArgumentError = undefined;\n                resultOfFailedInference = undefined;\n                result = chooseOverload(candidates, assignableRelation, signatureHelpTrailingComma);\n            }\n            if (result) {\n                return result;\n            }\n            if (candidateForArgumentError) {\n                checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, undefined, true);\n            }\n            else if (candidateForTypeArgumentError) {\n                if (!isTaggedTemplate && !isDecorator && typeArguments) {\n                    var typeArguments_2 = node.typeArguments;\n                    checkTypeArguments(candidateForTypeArgumentError, typeArguments_2, ts.map(typeArguments_2, getTypeFromTypeNode), true, headMessage);\n                }\n                else {\n                    ts.Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0);\n                    var failedTypeParameter = candidateForTypeArgumentError.typeParameters[resultOfFailedInference.failedTypeParameterIndex];\n                    var inferenceCandidates = getInferenceCandidates(resultOfFailedInference, resultOfFailedInference.failedTypeParameterIndex);\n                    var diagnosticChainHead = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly, typeToString(failedTypeParameter));\n                    if (headMessage) {\n                        diagnosticChainHead = ts.chainDiagnosticMessages(diagnosticChainHead, headMessage);\n                    }\n                    reportNoCommonSupertypeError(inferenceCandidates, node.expression || node.tag, diagnosticChainHead);\n                }\n            }\n            else {\n                reportError(ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target);\n            }\n            if (!produceDiagnostics) {\n                for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) {\n                    var candidate = candidates_1[_i];\n                    if (hasCorrectArity(node, args, candidate)) {\n                        if (candidate.typeParameters && typeArguments) {\n                            candidate = getSignatureInstantiation(candidate, ts.map(typeArguments, getTypeFromTypeNode));\n                        }\n                        return candidate;\n                    }\n                }\n            }\n            return resolveErrorCall(node);\n            function reportError(message, arg0, arg1, arg2) {\n                var errorInfo;\n                errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2);\n                if (headMessage) {\n                    errorInfo = ts.chainDiagnosticMessages(errorInfo, headMessage);\n                }\n                diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo));\n            }\n            function chooseOverload(candidates, relation, signatureHelpTrailingComma) {\n                if (signatureHelpTrailingComma === void 0) { signatureHelpTrailingComma = false; }\n                for (var _i = 0, candidates_2 = candidates; _i < candidates_2.length; _i++) {\n                    var originalCandidate = candidates_2[_i];\n                    if (!hasCorrectArity(node, args, originalCandidate, signatureHelpTrailingComma)) {\n                        continue;\n                    }\n                    var candidate = void 0;\n                    var typeArgumentsAreValid = void 0;\n                    var inferenceContext = originalCandidate.typeParameters\n                        ? createInferenceContext(originalCandidate, false)\n                        : undefined;\n                    while (true) {\n                        candidate = originalCandidate;\n                        if (candidate.typeParameters) {\n                            var typeArgumentTypes = void 0;\n                            if (typeArguments) {\n                                typeArgumentTypes = ts.map(typeArguments, getTypeFromTypeNode);\n                                typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false);\n                            }\n                            else {\n                                inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext);\n                                typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined;\n                                typeArgumentTypes = inferenceContext.inferredTypes;\n                            }\n                            if (!typeArgumentsAreValid) {\n                                break;\n                            }\n                            candidate = getSignatureInstantiation(candidate, typeArgumentTypes);\n                        }\n                        if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) {\n                            break;\n                        }\n                        var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1;\n                        if (index < 0) {\n                            return candidate;\n                        }\n                        excludeArgument[index] = false;\n                    }\n                    if (originalCandidate.typeParameters) {\n                        var instantiatedCandidate = candidate;\n                        if (typeArgumentsAreValid) {\n                            candidateForArgumentError = instantiatedCandidate;\n                        }\n                        else {\n                            candidateForTypeArgumentError = originalCandidate;\n                            if (!typeArguments) {\n                                resultOfFailedInference = inferenceContext;\n                            }\n                        }\n                    }\n                    else {\n                        ts.Debug.assert(originalCandidate === candidate);\n                        candidateForArgumentError = originalCandidate;\n                    }\n                }\n                return undefined;\n            }\n        }\n        function resolveCallExpression(node, candidatesOutArray) {\n            if (node.expression.kind === 96) {\n                var superType = checkSuperExpression(node.expression);\n                if (superType !== unknownType) {\n                    var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node));\n                    if (baseTypeNode) {\n                        var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments);\n                        return resolveCall(node, baseConstructors, candidatesOutArray);\n                    }\n                }\n                return resolveUntypedCall(node);\n            }\n            var funcType = checkNonNullExpression(node.expression);\n            if (funcType === silentNeverType) {\n                return silentNeverSignature;\n            }\n            var apparentType = getApparentType(funcType);\n            if (apparentType === unknownType) {\n                return resolveErrorCall(node);\n            }\n            var callSignatures = getSignaturesOfType(apparentType, 0);\n            var constructSignatures = getSignaturesOfType(apparentType, 1);\n            if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, constructSignatures.length)) {\n                if (funcType !== unknownType && node.typeArguments) {\n                    error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);\n                }\n                return resolveUntypedCall(node);\n            }\n            if (!callSignatures.length) {\n                if (constructSignatures.length) {\n                    error(node, ts.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));\n                }\n                else {\n                    error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType));\n                }\n                return resolveErrorCall(node);\n            }\n            return resolveCall(node, callSignatures, candidatesOutArray);\n        }\n        function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {\n            if (isTypeAny(funcType)) {\n                return true;\n            }\n            if (isTypeAny(apparentFuncType) && funcType.flags & 16384) {\n                return true;\n            }\n            if (!numCallSignatures && !numConstructSignatures) {\n                if (funcType.flags & 65536) {\n                    return false;\n                }\n                return isTypeAssignableTo(funcType, globalFunctionType);\n            }\n            return false;\n        }\n        function resolveNewExpression(node, candidatesOutArray) {\n            if (node.arguments && languageVersion < 1) {\n                var spreadIndex = getSpreadArgumentIndex(node.arguments);\n                if (spreadIndex >= 0) {\n                    error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher);\n                }\n            }\n            var expressionType = checkNonNullExpression(node.expression);\n            if (expressionType === silentNeverType) {\n                return silentNeverSignature;\n            }\n            expressionType = getApparentType(expressionType);\n            if (expressionType === unknownType) {\n                return resolveErrorCall(node);\n            }\n            var valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol);\n            if (valueDecl && ts.getModifierFlags(valueDecl) & 128) {\n                error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name));\n                return resolveErrorCall(node);\n            }\n            if (isTypeAny(expressionType)) {\n                if (node.typeArguments) {\n                    error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);\n                }\n                return resolveUntypedCall(node);\n            }\n            var constructSignatures = getSignaturesOfType(expressionType, 1);\n            if (constructSignatures.length) {\n                if (!isConstructorAccessible(node, constructSignatures[0])) {\n                    return resolveErrorCall(node);\n                }\n                return resolveCall(node, constructSignatures, candidatesOutArray);\n            }\n            var callSignatures = getSignaturesOfType(expressionType, 0);\n            if (callSignatures.length) {\n                var signature = resolveCall(node, callSignatures, candidatesOutArray);\n                if (getReturnTypeOfSignature(signature) !== voidType) {\n                    error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword);\n                }\n                if (getThisTypeOfSignature(signature) === voidType) {\n                    error(node, ts.Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void);\n                }\n                return signature;\n            }\n            error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature);\n            return resolveErrorCall(node);\n        }\n        function isConstructorAccessible(node, signature) {\n            if (!signature || !signature.declaration) {\n                return true;\n            }\n            var declaration = signature.declaration;\n            var modifiers = ts.getModifierFlags(declaration);\n            if (!(modifiers & 24)) {\n                return true;\n            }\n            var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(declaration.parent.symbol);\n            var declaringClass = getDeclaredTypeOfSymbol(declaration.parent.symbol);\n            if (!isNodeWithinClass(node, declaringClassDeclaration)) {\n                var containingClass = ts.getContainingClass(node);\n                if (containingClass) {\n                    var containingType = getTypeOfNode(containingClass);\n                    var baseTypes = getBaseTypes(containingType);\n                    if (baseTypes.length) {\n                        var baseType = baseTypes[0];\n                        if (modifiers & 16 &&\n                            baseType.symbol === declaration.parent.symbol) {\n                            return true;\n                        }\n                    }\n                }\n                if (modifiers & 8) {\n                    error(node, ts.Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));\n                }\n                if (modifiers & 16) {\n                    error(node, ts.Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));\n                }\n                return false;\n            }\n            return true;\n        }\n        function resolveTaggedTemplateExpression(node, candidatesOutArray) {\n            var tagType = checkExpression(node.tag);\n            var apparentType = getApparentType(tagType);\n            if (apparentType === unknownType) {\n                return resolveErrorCall(node);\n            }\n            var callSignatures = getSignaturesOfType(apparentType, 0);\n            var constructSignatures = getSignaturesOfType(apparentType, 1);\n            if (isUntypedFunctionCall(tagType, apparentType, callSignatures.length, constructSignatures.length)) {\n                return resolveUntypedCall(node);\n            }\n            if (!callSignatures.length) {\n                error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType));\n                return resolveErrorCall(node);\n            }\n            return resolveCall(node, callSignatures, candidatesOutArray);\n        }\n        function getDiagnosticHeadMessageForDecoratorResolution(node) {\n            switch (node.parent.kind) {\n                case 226:\n                case 197:\n                    return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression;\n                case 144:\n                    return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression;\n                case 147:\n                    return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression;\n                case 149:\n                case 151:\n                case 152:\n                    return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression;\n            }\n        }\n        function resolveDecorator(node, candidatesOutArray) {\n            var funcType = checkExpression(node.expression);\n            var apparentType = getApparentType(funcType);\n            if (apparentType === unknownType) {\n                return resolveErrorCall(node);\n            }\n            var callSignatures = getSignaturesOfType(apparentType, 0);\n            var constructSignatures = getSignaturesOfType(apparentType, 1);\n            if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, constructSignatures.length)) {\n                return resolveUntypedCall(node);\n            }\n            var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);\n            if (!callSignatures.length) {\n                var errorInfo = void 0;\n                errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType));\n                errorInfo = ts.chainDiagnosticMessages(errorInfo, headMessage);\n                diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo));\n                return resolveErrorCall(node);\n            }\n            return resolveCall(node, callSignatures, candidatesOutArray, headMessage);\n        }\n        function resolveSignature(node, candidatesOutArray) {\n            switch (node.kind) {\n                case 179:\n                    return resolveCallExpression(node, candidatesOutArray);\n                case 180:\n                    return resolveNewExpression(node, candidatesOutArray);\n                case 181:\n                    return resolveTaggedTemplateExpression(node, candidatesOutArray);\n                case 145:\n                    return resolveDecorator(node, candidatesOutArray);\n            }\n            ts.Debug.fail(\"Branch in 'resolveSignature' should be unreachable.\");\n        }\n        function getResolvedSignature(node, candidatesOutArray) {\n            var links = getNodeLinks(node);\n            var cached = links.resolvedSignature;\n            if (cached && cached !== resolvingSignature && !candidatesOutArray) {\n                return cached;\n            }\n            links.resolvedSignature = resolvingSignature;\n            var result = resolveSignature(node, candidatesOutArray);\n            links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached;\n            return result;\n        }\n        function getResolvedOrAnySignature(node) {\n            return getNodeLinks(node).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(node);\n        }\n        function getInferredClassType(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.inferredClassType) {\n                links.inferredClassType = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, undefined, undefined);\n            }\n            return links.inferredClassType;\n        }\n        function checkCallExpression(node) {\n            checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments);\n            var signature = getResolvedSignature(node);\n            if (node.expression.kind === 96) {\n                return voidType;\n            }\n            if (node.kind === 180) {\n                var declaration = signature.declaration;\n                if (declaration &&\n                    declaration.kind !== 150 &&\n                    declaration.kind !== 154 &&\n                    declaration.kind !== 159 &&\n                    !ts.isJSDocConstructSignature(declaration)) {\n                    var funcSymbol = node.expression.kind === 70 ?\n                        getResolvedSymbol(node.expression) :\n                        checkExpression(node.expression).symbol;\n                    if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16 || ts.isDeclarationOfFunctionExpression(funcSymbol))) {\n                        return getInferredClassType(funcSymbol);\n                    }\n                    else if (compilerOptions.noImplicitAny) {\n                        error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);\n                    }\n                    return anyType;\n                }\n            }\n            if (ts.isInJavaScriptFile(node) && isCommonJsRequire(node)) {\n                return resolveExternalModuleTypeByLiteral(node.arguments[0]);\n            }\n            return getReturnTypeOfSignature(signature);\n        }\n        function isCommonJsRequire(node) {\n            if (!ts.isRequireCall(node, true)) {\n                return false;\n            }\n            var resolvedRequire = resolveName(node.expression, node.expression.text, 107455, undefined, undefined);\n            if (!resolvedRequire) {\n                return true;\n            }\n            if (resolvedRequire.flags & 8388608) {\n                return false;\n            }\n            var targetDeclarationKind = resolvedRequire.flags & 16\n                ? 225\n                : resolvedRequire.flags & 3\n                    ? 223\n                    : 0;\n            if (targetDeclarationKind !== 0) {\n                var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind);\n                return ts.isInAmbientContext(decl);\n            }\n            return false;\n        }\n        function checkTaggedTemplateExpression(node) {\n            return getReturnTypeOfSignature(getResolvedSignature(node));\n        }\n        function checkAssertion(node) {\n            var exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(checkExpression(node.expression)));\n            checkSourceElement(node.type);\n            var targetType = getTypeFromTypeNode(node.type);\n            if (produceDiagnostics && targetType !== unknownType) {\n                var widenedType = getWidenedType(exprType);\n                if (!isTypeComparableTo(targetType, widenedType)) {\n                    checkTypeComparableTo(exprType, targetType, node, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1);\n                }\n            }\n            return targetType;\n        }\n        function checkNonNullAssertion(node) {\n            return getNonNullableType(checkExpression(node.expression));\n        }\n        function getTypeOfParameter(symbol) {\n            var type = getTypeOfSymbol(symbol);\n            if (strictNullChecks) {\n                var declaration = symbol.valueDeclaration;\n                if (declaration && declaration.initializer) {\n                    return includeFalsyTypes(type, 2048);\n                }\n            }\n            return type;\n        }\n        function getTypeAtPosition(signature, pos) {\n            return signature.hasRestParameter ?\n                pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) :\n                pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType;\n        }\n        function assignContextualParameterTypes(signature, context, mapper) {\n            var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0);\n            if (isInferentialContext(mapper)) {\n                for (var i = 0; i < len; i++) {\n                    var declaration = signature.parameters[i].valueDeclaration;\n                    if (declaration.type) {\n                        inferTypesWithContext(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i));\n                    }\n                }\n            }\n            if (context.thisParameter) {\n                var parameter = signature.thisParameter;\n                if (!parameter || parameter.valueDeclaration && !parameter.valueDeclaration.type) {\n                    if (!parameter) {\n                        signature.thisParameter = createTransientSymbol(context.thisParameter, undefined);\n                    }\n                    assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper);\n                }\n            }\n            for (var i = 0; i < len; i++) {\n                var parameter = signature.parameters[i];\n                if (!parameter.valueDeclaration.type) {\n                    var contextualParameterType = getTypeAtPosition(context, i);\n                    assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);\n                }\n            }\n            if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) {\n                var parameter = ts.lastOrUndefined(signature.parameters);\n                if (!parameter.valueDeclaration.type) {\n                    var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters));\n                    assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);\n                }\n            }\n        }\n        function assignBindingElementTypes(node) {\n            if (ts.isBindingPattern(node.name)) {\n                for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        if (element.name.kind === 70) {\n                            getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element);\n                        }\n                        assignBindingElementTypes(element);\n                    }\n                }\n            }\n        }\n        function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) {\n            var links = getSymbolLinks(parameter);\n            if (!links.type) {\n                links.type = instantiateType(contextualType, mapper);\n                if (links.type === emptyObjectType &&\n                    (parameter.valueDeclaration.name.kind === 172 ||\n                        parameter.valueDeclaration.name.kind === 173)) {\n                    links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name);\n                }\n                assignBindingElementTypes(parameter.valueDeclaration);\n            }\n            else if (isInferentialContext(mapper)) {\n                inferTypesWithContext(mapper.context, links.type, instantiateType(contextualType, mapper));\n            }\n        }\n        function getReturnTypeFromJSDocComment(func) {\n            var returnTag = ts.getJSDocReturnTag(func);\n            if (returnTag && returnTag.typeExpression) {\n                return getTypeFromTypeNode(returnTag.typeExpression.type);\n            }\n            return undefined;\n        }\n        function createPromiseType(promisedType) {\n            var globalPromiseType = getGlobalPromiseType();\n            if (globalPromiseType !== emptyGenericType) {\n                promisedType = getAwaitedType(promisedType);\n                return createTypeReference(globalPromiseType, [promisedType]);\n            }\n            return emptyObjectType;\n        }\n        function createPromiseReturnType(func, promisedType) {\n            var promiseType = createPromiseType(promisedType);\n            if (promiseType === emptyObjectType) {\n                error(func, ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option);\n                return unknownType;\n            }\n            return promiseType;\n        }\n        function getReturnTypeFromBody(func, contextualMapper) {\n            var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);\n            if (!func.body) {\n                return unknownType;\n            }\n            var isAsync = ts.isAsyncFunctionLike(func);\n            var type;\n            if (func.body.kind !== 204) {\n                type = checkExpressionCached(func.body, contextualMapper);\n                if (isAsync) {\n                    type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member);\n                }\n            }\n            else {\n                var types = void 0;\n                var funcIsGenerator = !!func.asteriskToken;\n                if (funcIsGenerator) {\n                    types = checkAndAggregateYieldOperandTypes(func, contextualMapper);\n                    if (types.length === 0) {\n                        var iterableIteratorAny = createIterableIteratorType(anyType);\n                        if (compilerOptions.noImplicitAny) {\n                            error(func.asteriskToken, ts.Diagnostics.Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type, typeToString(iterableIteratorAny));\n                        }\n                        return iterableIteratorAny;\n                    }\n                }\n                else {\n                    types = checkAndAggregateReturnExpressionTypes(func, contextualMapper);\n                    if (!types) {\n                        return isAsync ? createPromiseReturnType(func, neverType) : neverType;\n                    }\n                    if (types.length === 0) {\n                        return isAsync ? createPromiseReturnType(func, voidType) : voidType;\n                    }\n                }\n                type = getUnionType(types, true);\n                if (funcIsGenerator) {\n                    type = createIterableIteratorType(type);\n                }\n            }\n            if (!contextualSignature) {\n                reportErrorsFromWidening(func, type);\n            }\n            if (isUnitType(type) &&\n                !(contextualSignature &&\n                    isLiteralContextualType(contextualSignature === getSignatureFromDeclaration(func) ? type : getReturnTypeOfSignature(contextualSignature)))) {\n                type = getWidenedLiteralType(type);\n            }\n            var widenedType = getWidenedType(type);\n            return isAsync ? createPromiseReturnType(func, widenedType) : widenedType;\n        }\n        function checkAndAggregateYieldOperandTypes(func, contextualMapper) {\n            var aggregatedTypes = [];\n            ts.forEachYieldExpression(func.body, function (yieldExpression) {\n                var expr = yieldExpression.expression;\n                if (expr) {\n                    var type = checkExpressionCached(expr, contextualMapper);\n                    if (yieldExpression.asteriskToken) {\n                        type = checkElementTypeOfIterable(type, yieldExpression.expression);\n                    }\n                    if (!ts.contains(aggregatedTypes, type)) {\n                        aggregatedTypes.push(type);\n                    }\n                }\n            });\n            return aggregatedTypes;\n        }\n        function isExhaustiveSwitchStatement(node) {\n            if (!node.possiblyExhaustive) {\n                return false;\n            }\n            var type = getTypeOfExpression(node.expression);\n            if (!isLiteralType(type)) {\n                return false;\n            }\n            var switchTypes = getSwitchClauseTypes(node);\n            if (!switchTypes.length) {\n                return false;\n            }\n            return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes);\n        }\n        function functionHasImplicitReturn(func) {\n            if (!(func.flags & 128)) {\n                return false;\n            }\n            var lastStatement = ts.lastOrUndefined(func.body.statements);\n            if (lastStatement && lastStatement.kind === 218 && isExhaustiveSwitchStatement(lastStatement)) {\n                return false;\n            }\n            return true;\n        }\n        function checkAndAggregateReturnExpressionTypes(func, contextualMapper) {\n            var isAsync = ts.isAsyncFunctionLike(func);\n            var aggregatedTypes = [];\n            var hasReturnWithNoExpression = functionHasImplicitReturn(func);\n            var hasReturnOfTypeNever = false;\n            ts.forEachReturnStatement(func.body, function (returnStatement) {\n                var expr = returnStatement.expression;\n                if (expr) {\n                    var type = checkExpressionCached(expr, contextualMapper);\n                    if (isAsync) {\n                        type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member);\n                    }\n                    if (type.flags & 8192) {\n                        hasReturnOfTypeNever = true;\n                    }\n                    else if (!ts.contains(aggregatedTypes, type)) {\n                        aggregatedTypes.push(type);\n                    }\n                }\n                else {\n                    hasReturnWithNoExpression = true;\n                }\n            });\n            if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever ||\n                func.kind === 184 || func.kind === 185)) {\n                return undefined;\n            }\n            if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) {\n                if (!ts.contains(aggregatedTypes, undefinedType)) {\n                    aggregatedTypes.push(undefinedType);\n                }\n            }\n            return aggregatedTypes;\n        }\n        function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {\n            if (!produceDiagnostics) {\n                return;\n            }\n            if (returnType && maybeTypeOfKind(returnType, 1 | 1024)) {\n                return;\n            }\n            if (ts.nodeIsMissing(func.body) || func.body.kind !== 204 || !functionHasImplicitReturn(func)) {\n                return;\n            }\n            var hasExplicitReturn = func.flags & 256;\n            if (returnType && returnType.flags & 8192) {\n                error(func.type, ts.Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);\n            }\n            else if (returnType && !hasExplicitReturn) {\n                error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);\n            }\n            else if (returnType && strictNullChecks && !isTypeAssignableTo(undefinedType, returnType)) {\n                error(func.type, ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);\n            }\n            else if (compilerOptions.noImplicitReturns) {\n                if (!returnType) {\n                    if (!hasExplicitReturn) {\n                        return;\n                    }\n                    var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func));\n                    if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) {\n                        return;\n                    }\n                }\n                error(func.type || func, ts.Diagnostics.Not_all_code_paths_return_a_value);\n            }\n        }\n        function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) {\n            ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node));\n            var hasGrammarError = checkGrammarFunctionLikeDeclaration(node);\n            if (!hasGrammarError && node.kind === 184) {\n                checkGrammarForGenerator(node);\n            }\n            if (contextualMapper === identityMapper && isContextSensitive(node)) {\n                checkNodeDeferred(node);\n                return anyFunctionType;\n            }\n            var links = getNodeLinks(node);\n            var type = getTypeOfSymbol(node.symbol);\n            var contextSensitive = isContextSensitive(node);\n            var mightFixTypeParameters = contextSensitive && isInferentialContext(contextualMapper);\n            if (mightFixTypeParameters || !(links.flags & 1024)) {\n                var contextualSignature = getContextualSignature(node);\n                var contextChecked = !!(links.flags & 1024);\n                if (mightFixTypeParameters || !contextChecked) {\n                    links.flags |= 1024;\n                    if (contextualSignature) {\n                        var signature = getSignaturesOfType(type, 0)[0];\n                        if (contextSensitive) {\n                            assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);\n                        }\n                        if (mightFixTypeParameters || !node.type && !signature.resolvedReturnType) {\n                            var returnType = getReturnTypeFromBody(node, contextualMapper);\n                            if (!signature.resolvedReturnType) {\n                                signature.resolvedReturnType = returnType;\n                            }\n                        }\n                    }\n                    if (!contextChecked) {\n                        checkSignatureDeclaration(node);\n                        checkNodeDeferred(node);\n                    }\n                }\n            }\n            if (produceDiagnostics && node.kind !== 149) {\n                checkCollisionWithCapturedSuperVariable(node, node.name);\n                checkCollisionWithCapturedThisVariable(node, node.name);\n            }\n            return type;\n        }\n        function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) {\n            ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node));\n            var isAsync = ts.isAsyncFunctionLike(node);\n            var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type));\n            if (!node.asteriskToken) {\n                checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType);\n            }\n            if (node.body) {\n                if (!node.type) {\n                    getReturnTypeOfSignature(getSignatureFromDeclaration(node));\n                }\n                if (node.body.kind === 204) {\n                    checkSourceElement(node.body);\n                }\n                else {\n                    var exprType = checkExpression(node.body);\n                    if (returnOrPromisedType) {\n                        if (isAsync) {\n                            var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member);\n                            checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body);\n                        }\n                        else {\n                            checkTypeAssignableTo(exprType, returnOrPromisedType, node.body);\n                        }\n                    }\n                }\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkArithmeticOperandType(operand, type, diagnostic) {\n            if (!isTypeAnyOrAllConstituentTypesHaveKind(type, 340)) {\n                error(operand, diagnostic);\n                return false;\n            }\n            return true;\n        }\n        function isReadonlySymbol(symbol) {\n            return symbol.isReadonly ||\n                symbol.flags & 4 && (getDeclarationModifierFlagsFromSymbol(symbol) & 64) !== 0 ||\n                symbol.flags & 3 && (getDeclarationNodeFlagsFromSymbol(symbol) & 2) !== 0 ||\n                symbol.flags & 98304 && !(symbol.flags & 65536) ||\n                (symbol.flags & 8) !== 0;\n        }\n        function isReferenceToReadonlyEntity(expr, symbol) {\n            if (isReadonlySymbol(symbol)) {\n                if (symbol.flags & 4 &&\n                    (expr.kind === 177 || expr.kind === 178) &&\n                    expr.expression.kind === 98) {\n                    var func = ts.getContainingFunction(expr);\n                    if (!(func && func.kind === 150))\n                        return true;\n                    return !(func.parent === symbol.valueDeclaration.parent || func === symbol.valueDeclaration.parent);\n                }\n                return true;\n            }\n            return false;\n        }\n        function isReferenceThroughNamespaceImport(expr) {\n            if (expr.kind === 177 || expr.kind === 178) {\n                var node = ts.skipParentheses(expr.expression);\n                if (node.kind === 70) {\n                    var symbol = getNodeLinks(node).resolvedSymbol;\n                    if (symbol.flags & 8388608) {\n                        var declaration = getDeclarationOfAliasSymbol(symbol);\n                        return declaration && declaration.kind === 237;\n                    }\n                }\n            }\n            return false;\n        }\n        function checkReferenceExpression(expr, invalidReferenceMessage) {\n            var node = ts.skipParentheses(expr);\n            if (node.kind !== 70 && node.kind !== 177 && node.kind !== 178) {\n                error(expr, invalidReferenceMessage);\n                return false;\n            }\n            return true;\n        }\n        function checkDeleteExpression(node) {\n            checkExpression(node.expression);\n            return booleanType;\n        }\n        function checkTypeOfExpression(node) {\n            checkExpression(node.expression);\n            return stringType;\n        }\n        function checkVoidExpression(node) {\n            checkExpression(node.expression);\n            return undefinedWideningType;\n        }\n        function checkAwaitExpression(node) {\n            if (produceDiagnostics) {\n                if (!(node.flags & 16384)) {\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function);\n                }\n                if (isInParameterInitializerBeforeContainingFunction(node)) {\n                    error(node, ts.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);\n                }\n            }\n            var operandType = checkExpression(node.expression);\n            return checkAwaitedType(operandType, node);\n        }\n        function checkPrefixUnaryExpression(node) {\n            var operandType = checkExpression(node.operand);\n            if (operandType === silentNeverType) {\n                return silentNeverType;\n            }\n            if (node.operator === 37 && node.operand.kind === 8) {\n                return getFreshTypeOfLiteralType(getLiteralTypeForText(64, \"\" + -node.operand.text));\n            }\n            switch (node.operator) {\n                case 36:\n                case 37:\n                case 51:\n                    if (maybeTypeOfKind(operandType, 512)) {\n                        error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator));\n                    }\n                    return numberType;\n                case 50:\n                    var facts = getTypeFacts(operandType) & (1048576 | 2097152);\n                    return facts === 1048576 ? falseType :\n                        facts === 2097152 ? trueType :\n                            booleanType;\n                case 42:\n                case 43:\n                    var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type);\n                    if (ok) {\n                        checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access);\n                    }\n                    return numberType;\n            }\n            return unknownType;\n        }\n        function checkPostfixUnaryExpression(node) {\n            var operandType = checkExpression(node.operand);\n            if (operandType === silentNeverType) {\n                return silentNeverType;\n            }\n            var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type);\n            if (ok) {\n                checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access);\n            }\n            return numberType;\n        }\n        function maybeTypeOfKind(type, kind) {\n            if (type.flags & kind) {\n                return true;\n            }\n            if (type.flags & 196608) {\n                var types = type.types;\n                for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {\n                    var t = types_15[_i];\n                    if (maybeTypeOfKind(t, kind)) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function isTypeOfKind(type, kind) {\n            if (type.flags & kind) {\n                return true;\n            }\n            if (type.flags & 65536) {\n                var types = type.types;\n                for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {\n                    var t = types_16[_i];\n                    if (!isTypeOfKind(t, kind)) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            if (type.flags & 131072) {\n                var types = type.types;\n                for (var _a = 0, types_17 = types; _a < types_17.length; _a++) {\n                    var t = types_17[_a];\n                    if (isTypeOfKind(t, kind)) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function isConstEnumObjectType(type) {\n            return getObjectFlags(type) & 16 && type.symbol && isConstEnumSymbol(type.symbol);\n        }\n        function isConstEnumSymbol(symbol) {\n            return (symbol.flags & 128) !== 0;\n        }\n        function checkInstanceOfExpression(left, right, leftType, rightType) {\n            if (leftType === silentNeverType || rightType === silentNeverType) {\n                return silentNeverType;\n            }\n            if (isTypeOfKind(leftType, 8190)) {\n                error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);\n            }\n            if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {\n                error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);\n            }\n            return booleanType;\n        }\n        function checkInExpression(left, right, leftType, rightType) {\n            if (leftType === silentNeverType || rightType === silentNeverType) {\n                return silentNeverType;\n            }\n            if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 | 512))) {\n                error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol);\n            }\n            if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672)) {\n                error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);\n            }\n            return booleanType;\n        }\n        function checkObjectLiteralAssignment(node, sourceType) {\n            var properties = node.properties;\n            for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) {\n                var p = properties_6[_i];\n                checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties);\n            }\n            return sourceType;\n        }\n        function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) {\n            if (property.kind === 257 || property.kind === 258) {\n                var name_22 = property.name;\n                if (name_22.kind === 142) {\n                    checkComputedPropertyName(name_22);\n                }\n                if (isComputedNonLiteralName(name_22)) {\n                    return undefined;\n                }\n                var text = ts.getTextOfPropertyName(name_22);\n                var type = isTypeAny(objectLiteralType)\n                    ? objectLiteralType\n                    : getTypeOfPropertyOfType(objectLiteralType, text) ||\n                        isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) ||\n                        getIndexTypeOfType(objectLiteralType, 0);\n                if (type) {\n                    if (property.kind === 258) {\n                        return checkDestructuringAssignment(property, type);\n                    }\n                    else {\n                        return checkDestructuringAssignment(property.initializer, type);\n                    }\n                }\n                else {\n                    error(name_22, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_22));\n                }\n            }\n            else if (property.kind === 259) {\n                if (languageVersion < 5) {\n                    checkExternalEmitHelpers(property, 4);\n                }\n                var nonRestNames = [];\n                if (allProperties) {\n                    for (var i = 0; i < allProperties.length - 1; i++) {\n                        nonRestNames.push(allProperties[i].name);\n                    }\n                }\n                var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol);\n                return checkDestructuringAssignment(property.expression, type);\n            }\n            else {\n                error(property, ts.Diagnostics.Property_assignment_expected);\n            }\n        }\n        function checkArrayLiteralAssignment(node, sourceType, contextualMapper) {\n            var elementType = checkIteratedTypeOrElementType(sourceType, node, false) || unknownType;\n            var elements = node.elements;\n            for (var i = 0; i < elements.length; i++) {\n                checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, contextualMapper);\n            }\n            return sourceType;\n        }\n        function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) {\n            var elements = node.elements;\n            var element = elements[elementIndex];\n            if (element.kind !== 198) {\n                if (element.kind !== 196) {\n                    var propName = \"\" + elementIndex;\n                    var type = isTypeAny(sourceType)\n                        ? sourceType\n                        : isTupleLikeType(sourceType)\n                            ? getTypeOfPropertyOfType(sourceType, propName)\n                            : elementType;\n                    if (type) {\n                        return checkDestructuringAssignment(element, type, contextualMapper);\n                    }\n                    else {\n                        checkExpression(element);\n                        if (isTupleType(sourceType)) {\n                            error(element, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), getTypeReferenceArity(sourceType), elements.length);\n                        }\n                        else {\n                            error(element, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName);\n                        }\n                    }\n                }\n                else {\n                    if (elementIndex < elements.length - 1) {\n                        error(element, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);\n                    }\n                    else {\n                        var restExpression = element.expression;\n                        if (restExpression.kind === 192 && restExpression.operatorToken.kind === 57) {\n                            error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);\n                        }\n                        else {\n                            return checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper);\n                        }\n                    }\n                }\n            }\n            return undefined;\n        }\n        function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) {\n            var target;\n            if (exprOrAssignment.kind === 258) {\n                var prop = exprOrAssignment;\n                if (prop.objectAssignmentInitializer) {\n                    if (strictNullChecks &&\n                        !(getFalsyFlags(checkExpression(prop.objectAssignmentInitializer)) & 2048)) {\n                        sourceType = getTypeWithFacts(sourceType, 131072);\n                    }\n                    checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper);\n                }\n                target = exprOrAssignment.name;\n            }\n            else {\n                target = exprOrAssignment;\n            }\n            if (target.kind === 192 && target.operatorToken.kind === 57) {\n                checkBinaryExpression(target, contextualMapper);\n                target = target.left;\n            }\n            if (target.kind === 176) {\n                return checkObjectLiteralAssignment(target, sourceType);\n            }\n            if (target.kind === 175) {\n                return checkArrayLiteralAssignment(target, sourceType, contextualMapper);\n            }\n            return checkReferenceAssignment(target, sourceType, contextualMapper);\n        }\n        function checkReferenceAssignment(target, sourceType, contextualMapper) {\n            var targetType = checkExpression(target, contextualMapper);\n            var error = target.parent.kind === 259 ?\n                ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access :\n                ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access;\n            if (checkReferenceExpression(target, error)) {\n                checkTypeAssignableTo(sourceType, targetType, target, undefined);\n            }\n            return sourceType;\n        }\n        function isSideEffectFree(node) {\n            node = ts.skipParentheses(node);\n            switch (node.kind) {\n                case 70:\n                case 9:\n                case 11:\n                case 181:\n                case 194:\n                case 12:\n                case 8:\n                case 100:\n                case 85:\n                case 94:\n                case 137:\n                case 184:\n                case 197:\n                case 185:\n                case 175:\n                case 176:\n                case 187:\n                case 201:\n                case 247:\n                case 246:\n                    return true;\n                case 193:\n                    return isSideEffectFree(node.whenTrue) &&\n                        isSideEffectFree(node.whenFalse);\n                case 192:\n                    if (ts.isAssignmentOperator(node.operatorToken.kind)) {\n                        return false;\n                    }\n                    return isSideEffectFree(node.left) &&\n                        isSideEffectFree(node.right);\n                case 190:\n                case 191:\n                    switch (node.operator) {\n                        case 50:\n                        case 36:\n                        case 37:\n                        case 51:\n                            return true;\n                    }\n                    return false;\n                case 188:\n                case 182:\n                case 200:\n                default:\n                    return false;\n            }\n        }\n        function isTypeEqualityComparableTo(source, target) {\n            return (target.flags & 6144) !== 0 || isTypeComparableTo(source, target);\n        }\n        function getBestChoiceType(type1, type2) {\n            var firstAssignableToSecond = isTypeAssignableTo(type1, type2);\n            var secondAssignableToFirst = isTypeAssignableTo(type2, type1);\n            return secondAssignableToFirst && !firstAssignableToSecond ? type1 :\n                firstAssignableToSecond && !secondAssignableToFirst ? type2 :\n                    getUnionType([type1, type2], true);\n        }\n        function checkBinaryExpression(node, contextualMapper) {\n            return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node);\n        }\n        function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) {\n            var operator = operatorToken.kind;\n            if (operator === 57 && (left.kind === 176 || left.kind === 175)) {\n                return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper);\n            }\n            var leftType = checkExpression(left, contextualMapper);\n            var rightType = checkExpression(right, contextualMapper);\n            switch (operator) {\n                case 38:\n                case 39:\n                case 60:\n                case 61:\n                case 40:\n                case 62:\n                case 41:\n                case 63:\n                case 37:\n                case 59:\n                case 44:\n                case 64:\n                case 45:\n                case 65:\n                case 46:\n                case 66:\n                case 48:\n                case 68:\n                case 49:\n                case 69:\n                case 47:\n                case 67:\n                    if (leftType === silentNeverType || rightType === silentNeverType) {\n                        return silentNeverType;\n                    }\n                    if (leftType.flags & 6144)\n                        leftType = rightType;\n                    if (rightType.flags & 6144)\n                        rightType = leftType;\n                    leftType = getNonNullableType(leftType);\n                    rightType = getNonNullableType(rightType);\n                    var suggestedOperator = void 0;\n                    if ((leftType.flags & 136) &&\n                        (rightType.flags & 136) &&\n                        (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== undefined) {\n                        error(errorNode || operatorToken, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(operatorToken.kind), ts.tokenToString(suggestedOperator));\n                    }\n                    else {\n                        var leftOk = checkArithmeticOperandType(left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type);\n                        var rightOk = checkArithmeticOperandType(right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type);\n                        if (leftOk && rightOk) {\n                            checkAssignmentOperator(numberType);\n                        }\n                    }\n                    return numberType;\n                case 36:\n                case 58:\n                    if (leftType === silentNeverType || rightType === silentNeverType) {\n                        return silentNeverType;\n                    }\n                    if (leftType.flags & 6144)\n                        leftType = rightType;\n                    if (rightType.flags & 6144)\n                        rightType = leftType;\n                    leftType = getNonNullableType(leftType);\n                    rightType = getNonNullableType(rightType);\n                    var resultType = void 0;\n                    if (isTypeOfKind(leftType, 340) && isTypeOfKind(rightType, 340)) {\n                        resultType = numberType;\n                    }\n                    else {\n                        if (isTypeOfKind(leftType, 262178) || isTypeOfKind(rightType, 262178)) {\n                            resultType = stringType;\n                        }\n                        else if (isTypeAny(leftType) || isTypeAny(rightType)) {\n                            resultType = leftType === unknownType || rightType === unknownType ? unknownType : anyType;\n                        }\n                        if (resultType && !checkForDisallowedESSymbolOperand(operator)) {\n                            return resultType;\n                        }\n                    }\n                    if (!resultType) {\n                        reportOperatorError();\n                        return anyType;\n                    }\n                    if (operator === 58) {\n                        checkAssignmentOperator(resultType);\n                    }\n                    return resultType;\n                case 26:\n                case 28:\n                case 29:\n                case 30:\n                    if (checkForDisallowedESSymbolOperand(operator)) {\n                        leftType = getBaseTypeOfLiteralType(leftType);\n                        rightType = getBaseTypeOfLiteralType(rightType);\n                        if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {\n                            reportOperatorError();\n                        }\n                    }\n                    return booleanType;\n                case 31:\n                case 32:\n                case 33:\n                case 34:\n                    var leftIsLiteral = isLiteralType(leftType);\n                    var rightIsLiteral = isLiteralType(rightType);\n                    if (!leftIsLiteral || !rightIsLiteral) {\n                        leftType = leftIsLiteral ? getBaseTypeOfLiteralType(leftType) : leftType;\n                        rightType = rightIsLiteral ? getBaseTypeOfLiteralType(rightType) : rightType;\n                    }\n                    if (!isTypeEqualityComparableTo(leftType, rightType) && !isTypeEqualityComparableTo(rightType, leftType)) {\n                        reportOperatorError();\n                    }\n                    return booleanType;\n                case 92:\n                    return checkInstanceOfExpression(left, right, leftType, rightType);\n                case 91:\n                    return checkInExpression(left, right, leftType, rightType);\n                case 52:\n                    return getTypeFacts(leftType) & 1048576 ?\n                        includeFalsyTypes(rightType, getFalsyFlags(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType))) :\n                        leftType;\n                case 53:\n                    return getTypeFacts(leftType) & 2097152 ?\n                        getBestChoiceType(removeDefinitelyFalsyTypes(leftType), rightType) :\n                        leftType;\n                case 57:\n                    checkAssignmentOperator(rightType);\n                    return getRegularTypeOfObjectLiteral(rightType);\n                case 25:\n                    if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left)) {\n                        error(left, ts.Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects);\n                    }\n                    return rightType;\n            }\n            function checkForDisallowedESSymbolOperand(operator) {\n                var offendingSymbolOperand = maybeTypeOfKind(leftType, 512) ? left :\n                    maybeTypeOfKind(rightType, 512) ? right :\n                        undefined;\n                if (offendingSymbolOperand) {\n                    error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator));\n                    return false;\n                }\n                return true;\n            }\n            function getSuggestedBooleanOperator(operator) {\n                switch (operator) {\n                    case 48:\n                    case 68:\n                        return 53;\n                    case 49:\n                    case 69:\n                        return 34;\n                    case 47:\n                    case 67:\n                        return 52;\n                    default:\n                        return undefined;\n                }\n            }\n            function checkAssignmentOperator(valueType) {\n                if (produceDiagnostics && operator >= 57 && operator <= 69) {\n                    if (checkReferenceExpression(left, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) {\n                        checkTypeAssignableTo(valueType, leftType, left, undefined);\n                    }\n                }\n            }\n            function reportOperatorError() {\n                error(errorNode || operatorToken, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), typeToString(leftType), typeToString(rightType));\n            }\n        }\n        function isYieldExpressionInClass(node) {\n            var current = node;\n            var parent = node.parent;\n            while (parent) {\n                if (ts.isFunctionLike(parent) && current === parent.body) {\n                    return false;\n                }\n                else if (ts.isClassLike(current)) {\n                    return true;\n                }\n                current = parent;\n                parent = parent.parent;\n            }\n            return false;\n        }\n        function checkYieldExpression(node) {\n            if (produceDiagnostics) {\n                if (!(node.flags & 4096) || isYieldExpressionInClass(node)) {\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body);\n                }\n                if (isInParameterInitializerBeforeContainingFunction(node)) {\n                    error(node, ts.Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer);\n                }\n            }\n            if (node.expression) {\n                var func = ts.getContainingFunction(node);\n                if (func && func.asteriskToken) {\n                    var expressionType = checkExpressionCached(node.expression, undefined);\n                    var expressionElementType = void 0;\n                    var nodeIsYieldStar = !!node.asteriskToken;\n                    if (nodeIsYieldStar) {\n                        expressionElementType = checkElementTypeOfIterable(expressionType, node.expression);\n                    }\n                    if (func.type) {\n                        var signatureElementType = getElementTypeOfIterableIterator(getTypeFromTypeNode(func.type)) || anyType;\n                        if (nodeIsYieldStar) {\n                            checkTypeAssignableTo(expressionElementType, signatureElementType, node.expression, undefined);\n                        }\n                        else {\n                            checkTypeAssignableTo(expressionType, signatureElementType, node.expression, undefined);\n                        }\n                    }\n                }\n            }\n            return anyType;\n        }\n        function checkConditionalExpression(node, contextualMapper) {\n            checkExpression(node.condition);\n            var type1 = checkExpression(node.whenTrue, contextualMapper);\n            var type2 = checkExpression(node.whenFalse, contextualMapper);\n            return getBestChoiceType(type1, type2);\n        }\n        function checkLiteralExpression(node) {\n            if (node.kind === 8) {\n                checkGrammarNumericLiteral(node);\n            }\n            switch (node.kind) {\n                case 9:\n                    return getFreshTypeOfLiteralType(getLiteralTypeForText(32, node.text));\n                case 8:\n                    return getFreshTypeOfLiteralType(getLiteralTypeForText(64, node.text));\n                case 100:\n                    return trueType;\n                case 85:\n                    return falseType;\n            }\n        }\n        function checkTemplateExpression(node) {\n            ts.forEach(node.templateSpans, function (templateSpan) {\n                checkExpression(templateSpan.expression);\n            });\n            return stringType;\n        }\n        function checkExpressionWithContextualType(node, contextualType, contextualMapper) {\n            var saveContextualType = node.contextualType;\n            node.contextualType = contextualType;\n            var result = checkExpression(node, contextualMapper);\n            node.contextualType = saveContextualType;\n            return result;\n        }\n        function checkExpressionCached(node, contextualMapper) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                var saveFlowLoopStart = flowLoopStart;\n                flowLoopStart = flowLoopCount;\n                links.resolvedType = checkExpression(node, contextualMapper);\n                flowLoopStart = saveFlowLoopStart;\n            }\n            return links.resolvedType;\n        }\n        function isTypeAssertion(node) {\n            node = ts.skipParentheses(node);\n            return node.kind === 182 || node.kind === 200;\n        }\n        function checkDeclarationInitializer(declaration) {\n            var type = checkExpressionCached(declaration.initializer);\n            return ts.getCombinedNodeFlags(declaration) & 2 ||\n                ts.getCombinedModifierFlags(declaration) & 64 && !ts.isParameterPropertyDeclaration(declaration) ||\n                isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type);\n        }\n        function isLiteralContextualType(contextualType) {\n            if (contextualType) {\n                if (contextualType.flags & 16384) {\n                    var apparentType = getApparentTypeOfTypeParameter(contextualType);\n                    if (apparentType.flags & (2 | 4 | 8 | 16)) {\n                        return true;\n                    }\n                    contextualType = apparentType;\n                }\n                return maybeTypeOfKind(contextualType, (480 | 262144));\n            }\n            return false;\n        }\n        function checkExpressionForMutableLocation(node, contextualMapper) {\n            var type = checkExpression(node, contextualMapper);\n            return isTypeAssertion(node) || isLiteralContextualType(getContextualType(node)) ? type : getWidenedLiteralType(type);\n        }\n        function checkPropertyAssignment(node, contextualMapper) {\n            if (node.name.kind === 142) {\n                checkComputedPropertyName(node.name);\n            }\n            return checkExpressionForMutableLocation(node.initializer, contextualMapper);\n        }\n        function checkObjectLiteralMethod(node, contextualMapper) {\n            checkGrammarMethod(node);\n            if (node.name.kind === 142) {\n                checkComputedPropertyName(node.name);\n            }\n            var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper);\n            return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper);\n        }\n        function instantiateTypeWithSingleGenericCallSignature(node, type, contextualMapper) {\n            if (isInferentialContext(contextualMapper)) {\n                var signature = getSingleCallSignature(type);\n                if (signature && signature.typeParameters) {\n                    var contextualType = getApparentTypeOfContextualType(node);\n                    if (contextualType) {\n                        var contextualSignature = getSingleCallSignature(contextualType);\n                        if (contextualSignature && !contextualSignature.typeParameters) {\n                            return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper));\n                        }\n                    }\n                }\n            }\n            return type;\n        }\n        function getTypeOfExpression(node) {\n            if (node.kind === 179 && node.expression.kind !== 96) {\n                var funcType = checkNonNullExpression(node.expression);\n                var signature = getSingleCallSignature(funcType);\n                if (signature && !signature.typeParameters) {\n                    return getReturnTypeOfSignature(signature);\n                }\n            }\n            return checkExpression(node);\n        }\n        function checkExpression(node, contextualMapper) {\n            var type;\n            if (node.kind === 141) {\n                type = checkQualifiedName(node);\n            }\n            else {\n                var uninstantiatedType = checkExpressionWorker(node, contextualMapper);\n                type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper);\n            }\n            if (isConstEnumObjectType(type)) {\n                var ok = (node.parent.kind === 177 && node.parent.expression === node) ||\n                    (node.parent.kind === 178 && node.parent.expression === node) ||\n                    ((node.kind === 70 || node.kind === 141) && isInRightSideOfImportOrExportAssignment(node));\n                if (!ok) {\n                    error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment);\n                }\n            }\n            return type;\n        }\n        function checkExpressionWorker(node, contextualMapper) {\n            switch (node.kind) {\n                case 70:\n                    return checkIdentifier(node);\n                case 98:\n                    return checkThisExpression(node);\n                case 96:\n                    return checkSuperExpression(node);\n                case 94:\n                    return nullWideningType;\n                case 9:\n                case 8:\n                case 100:\n                case 85:\n                    return checkLiteralExpression(node);\n                case 194:\n                    return checkTemplateExpression(node);\n                case 12:\n                    return stringType;\n                case 11:\n                    return globalRegExpType;\n                case 175:\n                    return checkArrayLiteral(node, contextualMapper);\n                case 176:\n                    return checkObjectLiteral(node, contextualMapper);\n                case 177:\n                    return checkPropertyAccessExpression(node);\n                case 178:\n                    return checkIndexedAccess(node);\n                case 179:\n                case 180:\n                    return checkCallExpression(node);\n                case 181:\n                    return checkTaggedTemplateExpression(node);\n                case 183:\n                    return checkExpression(node.expression, contextualMapper);\n                case 197:\n                    return checkClassExpression(node);\n                case 184:\n                case 185:\n                    return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper);\n                case 187:\n                    return checkTypeOfExpression(node);\n                case 182:\n                case 200:\n                    return checkAssertion(node);\n                case 201:\n                    return checkNonNullAssertion(node);\n                case 186:\n                    return checkDeleteExpression(node);\n                case 188:\n                    return checkVoidExpression(node);\n                case 189:\n                    return checkAwaitExpression(node);\n                case 190:\n                    return checkPrefixUnaryExpression(node);\n                case 191:\n                    return checkPostfixUnaryExpression(node);\n                case 192:\n                    return checkBinaryExpression(node, contextualMapper);\n                case 193:\n                    return checkConditionalExpression(node, contextualMapper);\n                case 196:\n                    return checkSpreadExpression(node, contextualMapper);\n                case 198:\n                    return undefinedWideningType;\n                case 195:\n                    return checkYieldExpression(node);\n                case 252:\n                    return checkJsxExpression(node);\n                case 246:\n                    return checkJsxElement(node);\n                case 247:\n                    return checkJsxSelfClosingElement(node);\n                case 248:\n                    ts.Debug.fail(\"Shouldn't ever directly check a JsxOpeningElement\");\n            }\n            return unknownType;\n        }\n        function checkTypeParameter(node) {\n            if (node.expression) {\n                grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected);\n            }\n            checkSourceElement(node.constraint);\n            getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)));\n            if (produceDiagnostics) {\n                checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0);\n            }\n        }\n        function checkParameter(node) {\n            checkGrammarDecorators(node) || checkGrammarModifiers(node);\n            checkVariableLikeDeclaration(node);\n            var func = ts.getContainingFunction(node);\n            if (ts.getModifierFlags(node) & 92) {\n                func = ts.getContainingFunction(node);\n                if (!(func.kind === 150 && ts.nodeIsPresent(func.body))) {\n                    error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);\n                }\n            }\n            if (node.questionToken && ts.isBindingPattern(node.name) && func.body) {\n                error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);\n            }\n            if (node.name.text === \"this\") {\n                if (ts.indexOf(func.parameters, node) !== 0) {\n                    error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter);\n                }\n                if (func.kind === 150 || func.kind === 154 || func.kind === 159) {\n                    error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter);\n                }\n            }\n            if (node.dotDotDotToken && !ts.isBindingPattern(node.name) && !isArrayType(getTypeOfSymbol(node.symbol))) {\n                error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type);\n            }\n        }\n        function isSyntacticallyValidGenerator(node) {\n            if (!node.asteriskToken || !node.body) {\n                return false;\n            }\n            return node.kind === 149 ||\n                node.kind === 225 ||\n                node.kind === 184;\n        }\n        function getTypePredicateParameterIndex(parameterList, parameter) {\n            if (parameterList) {\n                for (var i = 0; i < parameterList.length; i++) {\n                    var param = parameterList[i];\n                    if (param.name.kind === 70 &&\n                        param.name.text === parameter.text) {\n                        return i;\n                    }\n                }\n            }\n            return -1;\n        }\n        function checkTypePredicate(node) {\n            var parent = getTypePredicateParent(node);\n            if (!parent) {\n                error(node, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);\n                return;\n            }\n            var typePredicate = getSignatureFromDeclaration(parent).typePredicate;\n            if (!typePredicate) {\n                return;\n            }\n            var parameterName = node.parameterName;\n            if (ts.isThisTypePredicate(typePredicate)) {\n                getTypeFromThisTypeNode(parameterName);\n            }\n            else {\n                if (typePredicate.parameterIndex >= 0) {\n                    if (parent.parameters[typePredicate.parameterIndex].dotDotDotToken) {\n                        error(parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter);\n                    }\n                    else {\n                        var leadingError = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type);\n                        checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type, undefined, leadingError);\n                    }\n                }\n                else if (parameterName) {\n                    var hasReportedError = false;\n                    for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) {\n                        var name_23 = _a[_i].name;\n                        if (ts.isBindingPattern(name_23) &&\n                            checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, parameterName, typePredicate.parameterName)) {\n                            hasReportedError = true;\n                            break;\n                        }\n                    }\n                    if (!hasReportedError) {\n                        error(node.parameterName, ts.Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName);\n                    }\n                }\n            }\n        }\n        function getTypePredicateParent(node) {\n            switch (node.parent.kind) {\n                case 185:\n                case 153:\n                case 225:\n                case 184:\n                case 158:\n                case 149:\n                case 148:\n                    var parent_9 = node.parent;\n                    if (node === parent_9.type) {\n                        return parent_9;\n                    }\n            }\n        }\n        function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern, predicateVariableNode, predicateVariableName) {\n            for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {\n                var element = _a[_i];\n                if (ts.isOmittedExpression(element)) {\n                    continue;\n                }\n                var name_24 = element.name;\n                if (name_24.kind === 70 &&\n                    name_24.text === predicateVariableName) {\n                    error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);\n                    return true;\n                }\n                else if (name_24.kind === 173 ||\n                    name_24.kind === 172) {\n                    if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_24, predicateVariableNode, predicateVariableName)) {\n                        return true;\n                    }\n                }\n            }\n        }\n        function checkSignatureDeclaration(node) {\n            if (node.kind === 155) {\n                checkGrammarIndexSignature(node);\n            }\n            else if (node.kind === 158 || node.kind === 225 || node.kind === 159 ||\n                node.kind === 153 || node.kind === 150 ||\n                node.kind === 154) {\n                checkGrammarFunctionLikeDeclaration(node);\n            }\n            if (ts.isAsyncFunctionLike(node) && languageVersion < 4) {\n                checkExternalEmitHelpers(node, 64);\n                if (languageVersion < 2) {\n                    checkExternalEmitHelpers(node, 128);\n                }\n            }\n            checkTypeParameters(node.typeParameters);\n            ts.forEach(node.parameters, checkParameter);\n            if (node.type) {\n                checkSourceElement(node.type);\n            }\n            if (produceDiagnostics) {\n                checkCollisionWithArgumentsInGeneratedCode(node);\n                if (compilerOptions.noImplicitAny && !node.type) {\n                    switch (node.kind) {\n                        case 154:\n                            error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);\n                            break;\n                        case 153:\n                            error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);\n                            break;\n                    }\n                }\n                if (node.type) {\n                    if (languageVersion >= 2 && isSyntacticallyValidGenerator(node)) {\n                        var returnType = getTypeFromTypeNode(node.type);\n                        if (returnType === voidType) {\n                            error(node.type, ts.Diagnostics.A_generator_cannot_have_a_void_type_annotation);\n                        }\n                        else {\n                            var generatorElementType = getElementTypeOfIterableIterator(returnType) || anyType;\n                            var iterableIteratorInstantiation = createIterableIteratorType(generatorElementType);\n                            checkTypeAssignableTo(iterableIteratorInstantiation, returnType, node.type);\n                        }\n                    }\n                    else if (ts.isAsyncFunctionLike(node)) {\n                        checkAsyncFunctionReturnType(node);\n                    }\n                }\n                if (noUnusedIdentifiers && !node.body) {\n                    checkUnusedTypeParameters(node);\n                }\n            }\n        }\n        function checkClassForDuplicateDeclarations(node) {\n            var instanceNames = ts.createMap();\n            var staticNames = ts.createMap();\n            for (var _i = 0, _a = node.members; _i < _a.length; _i++) {\n                var member = _a[_i];\n                if (member.kind === 150) {\n                    for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {\n                        var param = _c[_b];\n                        if (ts.isParameterPropertyDeclaration(param)) {\n                            addName(instanceNames, param.name, param.name.text, 3);\n                        }\n                    }\n                }\n                else {\n                    var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 114; });\n                    var names = isStatic ? staticNames : instanceNames;\n                    var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name);\n                    if (memberName) {\n                        switch (member.kind) {\n                            case 151:\n                                addName(names, member.name, memberName, 1);\n                                break;\n                            case 152:\n                                addName(names, member.name, memberName, 2);\n                                break;\n                            case 147:\n                                addName(names, member.name, memberName, 3);\n                                break;\n                        }\n                    }\n                }\n            }\n            function addName(names, location, name, meaning) {\n                var prev = names[name];\n                if (prev) {\n                    if (prev & meaning) {\n                        error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location));\n                    }\n                    else {\n                        names[name] = prev | meaning;\n                    }\n                }\n                else {\n                    names[name] = meaning;\n                }\n            }\n        }\n        function checkObjectTypeForDuplicateDeclarations(node) {\n            var names = ts.createMap();\n            for (var _i = 0, _a = node.members; _i < _a.length; _i++) {\n                var member = _a[_i];\n                if (member.kind == 146) {\n                    var memberName = void 0;\n                    switch (member.name.kind) {\n                        case 9:\n                        case 8:\n                        case 70:\n                            memberName = member.name.text;\n                            break;\n                        default:\n                            continue;\n                    }\n                    if (names[memberName]) {\n                        error(member.symbol.valueDeclaration.name, ts.Diagnostics.Duplicate_identifier_0, memberName);\n                        error(member.name, ts.Diagnostics.Duplicate_identifier_0, memberName);\n                    }\n                    else {\n                        names[memberName] = true;\n                    }\n                }\n            }\n        }\n        function checkTypeForDuplicateIndexSignatures(node) {\n            if (node.kind === 227) {\n                var nodeSymbol = getSymbolOfNode(node);\n                if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) {\n                    return;\n                }\n            }\n            var indexSymbol = getIndexSymbol(getSymbolOfNode(node));\n            if (indexSymbol) {\n                var seenNumericIndexer = false;\n                var seenStringIndexer = false;\n                for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    var declaration = decl;\n                    if (declaration.parameters.length === 1 && declaration.parameters[0].type) {\n                        switch (declaration.parameters[0].type.kind) {\n                            case 134:\n                                if (!seenStringIndexer) {\n                                    seenStringIndexer = true;\n                                }\n                                else {\n                                    error(declaration, ts.Diagnostics.Duplicate_string_index_signature);\n                                }\n                                break;\n                            case 132:\n                                if (!seenNumericIndexer) {\n                                    seenNumericIndexer = true;\n                                }\n                                else {\n                                    error(declaration, ts.Diagnostics.Duplicate_number_index_signature);\n                                }\n                                break;\n                        }\n                    }\n                }\n            }\n        }\n        function checkPropertyDeclaration(node) {\n            checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name);\n            checkVariableLikeDeclaration(node);\n        }\n        function checkMethodDeclaration(node) {\n            checkGrammarMethod(node) || checkGrammarComputedPropertyName(node.name);\n            checkFunctionOrMethodDeclaration(node);\n            if (ts.getModifierFlags(node) & 128 && node.body) {\n                error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name));\n            }\n        }\n        function checkConstructorDeclaration(node) {\n            checkSignatureDeclaration(node);\n            checkGrammarConstructorTypeParameters(node) || checkGrammarConstructorTypeAnnotation(node);\n            checkSourceElement(node.body);\n            registerForUnusedIdentifiersCheck(node);\n            var symbol = getSymbolOfNode(node);\n            var firstDeclaration = ts.getDeclarationOfKind(symbol, node.kind);\n            if (node === firstDeclaration) {\n                checkFunctionOrConstructorSymbol(symbol);\n            }\n            if (ts.nodeIsMissing(node.body)) {\n                return;\n            }\n            if (!produceDiagnostics) {\n                return;\n            }\n            function containsSuperCallAsComputedPropertyName(n) {\n                return n.name && containsSuperCall(n.name);\n            }\n            function containsSuperCall(n) {\n                if (ts.isSuperCall(n)) {\n                    return true;\n                }\n                else if (ts.isFunctionLike(n)) {\n                    return false;\n                }\n                else if (ts.isClassLike(n)) {\n                    return ts.forEach(n.members, containsSuperCallAsComputedPropertyName);\n                }\n                return ts.forEachChild(n, containsSuperCall);\n            }\n            function markThisReferencesAsErrors(n) {\n                if (n.kind === 98) {\n                    error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location);\n                }\n                else if (n.kind !== 184 && n.kind !== 225) {\n                    ts.forEachChild(n, markThisReferencesAsErrors);\n                }\n            }\n            function isInstancePropertyWithInitializer(n) {\n                return n.kind === 147 &&\n                    !(ts.getModifierFlags(n) & 32) &&\n                    !!n.initializer;\n            }\n            var containingClassDecl = node.parent;\n            if (ts.getClassExtendsHeritageClauseElement(containingClassDecl)) {\n                captureLexicalThis(node.parent, containingClassDecl);\n                var classExtendsNull = classDeclarationExtendsNull(containingClassDecl);\n                var superCall = getSuperCallInConstructor(node);\n                if (superCall) {\n                    if (classExtendsNull) {\n                        error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);\n                    }\n                    var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) ||\n                        ts.forEach(node.parameters, function (p) { return ts.getModifierFlags(p) & 92; });\n                    if (superCallShouldBeFirst) {\n                        var statements = node.body.statements;\n                        var superCallStatement = void 0;\n                        for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) {\n                            var statement = statements_3[_i];\n                            if (statement.kind === 207 && ts.isSuperCall(statement.expression)) {\n                                superCallStatement = statement;\n                                break;\n                            }\n                            if (!ts.isPrologueDirective(statement)) {\n                                break;\n                            }\n                        }\n                        if (!superCallStatement) {\n                          error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties);\n                        }\n                    }\n                }\n                else if (!classExtendsNull) {\n                    error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call);\n                }\n            }\n        }\n        function checkAccessorDeclaration(node) {\n            if (produceDiagnostics) {\n                checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name);\n                checkDecorators(node);\n                checkSignatureDeclaration(node);\n                if (node.kind === 151) {\n                    if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 128)) {\n                        if (!(node.flags & 256)) {\n                            error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);\n                        }\n                    }\n                }\n                if (node.name.kind === 142) {\n                    checkComputedPropertyName(node.name);\n                }\n                if (!ts.hasDynamicName(node)) {\n                    var otherKind = node.kind === 151 ? 152 : 151;\n                    var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind);\n                    if (otherAccessor) {\n                        if ((ts.getModifierFlags(node) & 28) !== (ts.getModifierFlags(otherAccessor) & 28)) {\n                            error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility);\n                        }\n                        if (ts.hasModifier(node, 128) !== ts.hasModifier(otherAccessor, 128)) {\n                            error(node.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);\n                        }\n                        checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorType, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type);\n                        checkAccessorDeclarationTypesIdentical(node, otherAccessor, getThisTypeOfDeclaration, ts.Diagnostics.get_and_set_accessor_must_have_the_same_this_type);\n                    }\n                }\n                var returnType = getTypeOfAccessors(getSymbolOfNode(node));\n                if (node.kind === 151) {\n                    checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType);\n                }\n            }\n            if (node.parent.kind !== 176) {\n                checkSourceElement(node.body);\n                registerForUnusedIdentifiersCheck(node);\n            }\n            else {\n                checkNodeDeferred(node);\n            }\n        }\n        function checkAccessorDeclarationTypesIdentical(first, second, getAnnotatedType, message) {\n            var firstType = getAnnotatedType(first);\n            var secondType = getAnnotatedType(second);\n            if (firstType && secondType && !isTypeIdenticalTo(firstType, secondType)) {\n                error(first, message);\n            }\n        }\n        function checkAccessorDeferred(node) {\n            checkSourceElement(node.body);\n            registerForUnusedIdentifiersCheck(node);\n        }\n        function checkMissingDeclaration(node) {\n            checkDecorators(node);\n        }\n        function checkTypeArgumentConstraints(typeParameters, typeArgumentNodes) {\n            var typeArguments;\n            var mapper;\n            var result = true;\n            for (var i = 0; i < typeParameters.length; i++) {\n                var constraint = getConstraintOfTypeParameter(typeParameters[i]);\n                if (constraint) {\n                    if (!typeArguments) {\n                        typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode);\n                        mapper = createTypeMapper(typeParameters, typeArguments);\n                    }\n                    var typeArgument = typeArguments[i];\n                    result = result && checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), typeArgumentNodes[i], ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);\n                }\n            }\n            return result;\n        }\n        function checkTypeReferenceNode(node) {\n            checkGrammarTypeArguments(node, node.typeArguments);\n            var type = getTypeFromTypeReference(node);\n            if (type !== unknownType) {\n                if (node.typeArguments) {\n                    ts.forEach(node.typeArguments, checkSourceElement);\n                    if (produceDiagnostics) {\n                        var symbol = getNodeLinks(node).resolvedSymbol;\n                        var typeParameters = symbol.flags & 524288 ? getSymbolLinks(symbol).typeParameters : type.target.localTypeParameters;\n                        checkTypeArgumentConstraints(typeParameters, node.typeArguments);\n                    }\n                }\n                if (type.flags & 16 && !type.memberTypes && getNodeLinks(node).resolvedSymbol.flags & 8) {\n                    error(node, ts.Diagnostics.Enum_type_0_has_members_with_initializers_that_are_not_literals, typeToString(type));\n                }\n            }\n        }\n        function checkTypeQuery(node) {\n            getTypeFromTypeQueryNode(node);\n        }\n        function checkTypeLiteral(node) {\n            ts.forEach(node.members, checkSourceElement);\n            if (produceDiagnostics) {\n                var type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);\n                checkIndexConstraints(type);\n                checkTypeForDuplicateIndexSignatures(node);\n                checkObjectTypeForDuplicateDeclarations(node);\n            }\n        }\n        function checkArrayType(node) {\n            checkSourceElement(node.elementType);\n        }\n        function checkTupleType(node) {\n            var hasErrorFromDisallowedTrailingComma = checkGrammarForDisallowedTrailingComma(node.elementTypes);\n            if (!hasErrorFromDisallowedTrailingComma && node.elementTypes.length === 0) {\n                grammarErrorOnNode(node, ts.Diagnostics.A_tuple_type_element_list_cannot_be_empty);\n            }\n            ts.forEach(node.elementTypes, checkSourceElement);\n        }\n        function checkUnionOrIntersectionType(node) {\n            ts.forEach(node.types, checkSourceElement);\n        }\n        function checkIndexedAccessType(node) {\n            getTypeFromIndexedAccessTypeNode(node);\n        }\n        function checkMappedType(node) {\n            checkSourceElement(node.typeParameter);\n            checkSourceElement(node.type);\n            var type = getTypeFromMappedTypeNode(node);\n            var constraintType = getConstraintTypeFromMappedType(type);\n            var keyType = constraintType.flags & 16384 ? getApparentTypeOfTypeParameter(constraintType) : constraintType;\n            checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint);\n        }\n        function isPrivateWithinAmbient(node) {\n            return (ts.getModifierFlags(node) & 8) && ts.isInAmbientContext(node);\n        }\n        function getEffectiveDeclarationFlags(n, flagsToCheck) {\n            var flags = ts.getCombinedModifierFlags(n);\n            if (n.parent.kind !== 227 &&\n                n.parent.kind !== 226 &&\n                n.parent.kind !== 197 &&\n                ts.isInAmbientContext(n)) {\n                if (!(flags & 2)) {\n                    flags |= 1;\n                }\n                flags |= 2;\n            }\n            return flags & flagsToCheck;\n        }\n        function checkFunctionOrConstructorSymbol(symbol) {\n            if (!produceDiagnostics) {\n                return;\n            }\n            function getCanonicalOverload(overloads, implementation) {\n                var implementationSharesContainerWithFirstOverload = implementation !== undefined && implementation.parent === overloads[0].parent;\n                return implementationSharesContainerWithFirstOverload ? implementation : overloads[0];\n            }\n            function checkFlagAgreementBetweenOverloads(overloads, implementation, flagsToCheck, someOverloadFlags, allOverloadFlags) {\n                var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags;\n                if (someButNotAllOverloadFlags !== 0) {\n                    var canonicalFlags_1 = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck);\n                    ts.forEach(overloads, function (o) {\n                        var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags_1;\n                        if (deviation & 1) {\n                            error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);\n                        }\n                        else if (deviation & 2) {\n                            error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);\n                        }\n                        else if (deviation & (8 | 16)) {\n                            error(o.name || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);\n                        }\n                        else if (deviation & 128) {\n                            error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);\n                        }\n                    });\n                }\n            }\n            function checkQuestionTokenAgreementBetweenOverloads(overloads, implementation, someHaveQuestionToken, allHaveQuestionToken) {\n                if (someHaveQuestionToken !== allHaveQuestionToken) {\n                    var canonicalHasQuestionToken_1 = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation));\n                    ts.forEach(overloads, function (o) {\n                        var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken_1;\n                        if (deviation) {\n                            error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_optional_or_required);\n                        }\n                    });\n                }\n            }\n            var flagsToCheck = 1 | 2 | 8 | 16 | 128;\n            var someNodeFlags = 0;\n            var allNodeFlags = flagsToCheck;\n            var someHaveQuestionToken = false;\n            var allHaveQuestionToken = true;\n            var hasOverloads = false;\n            var bodyDeclaration;\n            var lastSeenNonAmbientDeclaration;\n            var previousDeclaration;\n            var declarations = symbol.declarations;\n            var isConstructor = (symbol.flags & 16384) !== 0;\n            function reportImplementationExpectedError(node) {\n                if (node.name && ts.nodeIsMissing(node.name)) {\n                    return;\n                }\n                var seen = false;\n                var subsequentNode = ts.forEachChild(node.parent, function (c) {\n                    if (seen) {\n                        return c;\n                    }\n                    else {\n                        seen = c === node;\n                    }\n                });\n                if (subsequentNode && subsequentNode.pos === node.end) {\n                    if (subsequentNode.kind === node.kind) {\n                        var errorNode_1 = subsequentNode.name || subsequentNode;\n                        if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) {\n                            var reportError = (node.kind === 149 || node.kind === 148) &&\n                                (ts.getModifierFlags(node) & 32) !== (ts.getModifierFlags(subsequentNode) & 32);\n                            if (reportError) {\n                                var diagnostic = ts.getModifierFlags(node) & 32 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static;\n                                error(errorNode_1, diagnostic);\n                            }\n                            return;\n                        }\n                        else if (ts.nodeIsPresent(subsequentNode.body)) {\n                            error(errorNode_1, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name));\n                            return;\n                        }\n                    }\n                }\n                var errorNode = node.name || node;\n                if (isConstructor) {\n                    error(errorNode, ts.Diagnostics.Constructor_implementation_is_missing);\n                }\n                else {\n                    if (ts.getModifierFlags(node) & 128) {\n                        error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive);\n                    }\n                    else {\n                        error(errorNode, ts.Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration);\n                    }\n                }\n            }\n            var duplicateFunctionDeclaration = false;\n            var multipleConstructorImplementation = false;\n            for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {\n                var current = declarations_4[_i];\n                var node = current;\n                var inAmbientContext = ts.isInAmbientContext(node);\n                var inAmbientContextOrInterface = node.parent.kind === 227 || node.parent.kind === 161 || inAmbientContext;\n                if (inAmbientContextOrInterface) {\n                    previousDeclaration = undefined;\n                }\n                if (node.kind === 225 || node.kind === 149 || node.kind === 148 || node.kind === 150) {\n                    var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);\n                    someNodeFlags |= currentNodeFlags;\n                    allNodeFlags &= currentNodeFlags;\n                    someHaveQuestionToken = someHaveQuestionToken || ts.hasQuestionToken(node);\n                    allHaveQuestionToken = allHaveQuestionToken && ts.hasQuestionToken(node);\n                    if (ts.nodeIsPresent(node.body) && bodyDeclaration) {\n                        if (isConstructor) {\n                            multipleConstructorImplementation = true;\n                        }\n                        else {\n                            duplicateFunctionDeclaration = true;\n                        }\n                    }\n                    else if (previousDeclaration && previousDeclaration.parent === node.parent && previousDeclaration.end !== node.pos) {\n                        reportImplementationExpectedError(previousDeclaration);\n                    }\n                    if (ts.nodeIsPresent(node.body)) {\n                        if (!bodyDeclaration) {\n                            bodyDeclaration = node;\n                        }\n                    }\n                    else {\n                        hasOverloads = true;\n                    }\n                    previousDeclaration = node;\n                    if (!inAmbientContextOrInterface) {\n                        lastSeenNonAmbientDeclaration = node;\n                    }\n                }\n            }\n            if (multipleConstructorImplementation) {\n                ts.forEach(declarations, function (declaration) {\n                    error(declaration, ts.Diagnostics.Multiple_constructor_implementations_are_not_allowed);\n                });\n            }\n            if (duplicateFunctionDeclaration) {\n                ts.forEach(declarations, function (declaration) {\n                    error(declaration.name, ts.Diagnostics.Duplicate_function_implementation);\n                });\n            }\n            if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body &&\n                !(ts.getModifierFlags(lastSeenNonAmbientDeclaration) & 128) && !lastSeenNonAmbientDeclaration.questionToken) {\n                reportImplementationExpectedError(lastSeenNonAmbientDeclaration);\n            }\n            if (hasOverloads) {\n                checkFlagAgreementBetweenOverloads(declarations, bodyDeclaration, flagsToCheck, someNodeFlags, allNodeFlags);\n                checkQuestionTokenAgreementBetweenOverloads(declarations, bodyDeclaration, someHaveQuestionToken, allHaveQuestionToken);\n                if (bodyDeclaration) {\n                    var signatures = getSignaturesOfSymbol(symbol);\n                    var bodySignature = getSignatureFromDeclaration(bodyDeclaration);\n                    for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) {\n                        var signature = signatures_3[_a];\n                        if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {\n                            error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation);\n                            break;\n                        }\n                    }\n                }\n            }\n        }\n        function checkExportsOnMergedDeclarations(node) {\n            if (!produceDiagnostics) {\n                return;\n            }\n            var symbol = node.localSymbol;\n            if (!symbol) {\n                symbol = getSymbolOfNode(node);\n                if (!(symbol.flags & 7340032)) {\n                    return;\n                }\n            }\n            if (ts.getDeclarationOfKind(symbol, node.kind) !== node) {\n                return;\n            }\n            var exportedDeclarationSpaces = 0;\n            var nonExportedDeclarationSpaces = 0;\n            var defaultExportedDeclarationSpaces = 0;\n            for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                var d = _a[_i];\n                var declarationSpaces = getDeclarationSpaces(d);\n                var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 | 512);\n                if (effectiveDeclarationFlags & 1) {\n                    if (effectiveDeclarationFlags & 512) {\n                        defaultExportedDeclarationSpaces |= declarationSpaces;\n                    }\n                    else {\n                        exportedDeclarationSpaces |= declarationSpaces;\n                    }\n                }\n                else {\n                    nonExportedDeclarationSpaces |= declarationSpaces;\n                }\n            }\n            var nonDefaultExportedDeclarationSpaces = exportedDeclarationSpaces | nonExportedDeclarationSpaces;\n            var commonDeclarationSpacesForExportsAndLocals = exportedDeclarationSpaces & nonExportedDeclarationSpaces;\n            var commonDeclarationSpacesForDefaultAndNonDefault = defaultExportedDeclarationSpaces & nonDefaultExportedDeclarationSpaces;\n            if (commonDeclarationSpacesForExportsAndLocals || commonDeclarationSpacesForDefaultAndNonDefault) {\n                for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) {\n                    var d = _c[_b];\n                    var declarationSpaces = getDeclarationSpaces(d);\n                    if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) {\n                        error(d.name, ts.Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, ts.declarationNameToString(d.name));\n                    }\n                    else if (declarationSpaces & commonDeclarationSpacesForExportsAndLocals) {\n                        error(d.name, ts.Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, ts.declarationNameToString(d.name));\n                    }\n                }\n            }\n            function getDeclarationSpaces(d) {\n                switch (d.kind) {\n                    case 227:\n                        return 2097152;\n                    case 230:\n                        return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0\n                            ? 4194304 | 1048576\n                            : 4194304;\n                    case 226:\n                    case 229:\n                        return 2097152 | 1048576;\n                    case 234:\n                        var result_3 = 0;\n                        var target = resolveAlias(getSymbolOfNode(d));\n                        ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); });\n                        return result_3;\n                    default:\n                        return 1048576;\n                }\n            }\n        }\n        function checkNonThenableType(type, location, message) {\n            type = getWidenedType(type);\n            if (!isTypeAny(type) && !isTypeNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) {\n                if (location) {\n                    if (!message) {\n                        message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member;\n                    }\n                    error(location, message);\n                }\n                return unknownType;\n            }\n            return type;\n        }\n        function getPromisedType(promise) {\n            if (isTypeAny(promise)) {\n                return undefined;\n            }\n            if (getObjectFlags(promise) & 4) {\n                if (promise.target === tryGetGlobalPromiseType()\n                    || promise.target === getGlobalPromiseLikeType()) {\n                    return promise.typeArguments[0];\n                }\n            }\n            var globalPromiseLikeType = getInstantiatedGlobalPromiseLikeType();\n            if (globalPromiseLikeType === emptyObjectType || !isTypeAssignableTo(promise, globalPromiseLikeType)) {\n                return undefined;\n            }\n            var thenFunction = getTypeOfPropertyOfType(promise, \"then\");\n            if (!thenFunction || isTypeAny(thenFunction)) {\n                return undefined;\n            }\n            var thenSignatures = getSignaturesOfType(thenFunction, 0);\n            if (thenSignatures.length === 0) {\n                return undefined;\n            }\n            var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072);\n            if (isTypeAny(onfulfilledParameterType)) {\n                return undefined;\n            }\n            var onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0);\n            if (onfulfilledParameterSignatures.length === 0) {\n                return undefined;\n            }\n            return getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), true);\n        }\n        function getTypeOfFirstParameterOfSignature(signature) {\n            return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType;\n        }\n        function getAwaitedType(type) {\n            return checkAwaitedType(type, undefined, undefined);\n        }\n        function checkAwaitedType(type, location, message) {\n            return checkAwaitedTypeWorker(type);\n            function checkAwaitedTypeWorker(type) {\n                if (type.flags & 65536) {\n                    var types = [];\n                    for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                        var constituentType = _a[_i];\n                        types.push(checkAwaitedTypeWorker(constituentType));\n                    }\n                    return getUnionType(types, true);\n                }\n                else {\n                    var promisedType = getPromisedType(type);\n                    if (promisedType === undefined) {\n                        return checkNonThenableType(type, location, message);\n                    }\n                    else {\n                        if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) {\n                            if (location) {\n                                error(location, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method, symbolToString(type.symbol));\n                            }\n                            return unknownType;\n                        }\n                        awaitedTypeStack.push(type.id);\n                        var awaitedType = checkAwaitedTypeWorker(promisedType);\n                        awaitedTypeStack.pop();\n                        return awaitedType;\n                    }\n                }\n            }\n        }\n        function checkAsyncFunctionReturnType(node) {\n            var returnType = getTypeFromTypeNode(node.type);\n            if (languageVersion >= 2) {\n                if (returnType === unknownType) {\n                    return unknownType;\n                }\n                var globalPromiseType = getGlobalPromiseType();\n                if (globalPromiseType !== emptyGenericType && globalPromiseType !== getTargetType(returnType)) {\n                    error(node.type, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type);\n                    return unknownType;\n                }\n            }\n            else {\n                markTypeNodeAsReferenced(node.type);\n                if (returnType === unknownType) {\n                    return unknownType;\n                }\n                var promiseConstructorName = ts.getEntityNameFromTypeNode(node.type);\n                if (promiseConstructorName === undefined) {\n                    error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType));\n                    return unknownType;\n                }\n                var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 107455, true);\n                var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType;\n                if (promiseConstructorType === unknownType) {\n                    error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName));\n                    return unknownType;\n                }\n                var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType();\n                if (globalPromiseConstructorLikeType === emptyObjectType) {\n                    error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName));\n                    return unknownType;\n                }\n                if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value)) {\n                    return unknownType;\n                }\n                var rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);\n                var collidingSymbol = getSymbol(node.locals, rootName.text, 107455);\n                if (collidingSymbol) {\n                    error(collidingSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, rootName.text, ts.entityNameToString(promiseConstructorName));\n                    return unknownType;\n                }\n            }\n            return checkAwaitedType(returnType, node, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type);\n        }\n        function checkDecorator(node) {\n            var signature = getResolvedSignature(node);\n            var returnType = getReturnTypeOfSignature(signature);\n            if (returnType.flags & 1) {\n                return;\n            }\n            var expectedReturnType;\n            var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);\n            var errorInfo;\n            switch (node.parent.kind) {\n                case 226:\n                    var classSymbol = getSymbolOfNode(node.parent);\n                    var classConstructorType = getTypeOfSymbol(classSymbol);\n                    expectedReturnType = getUnionType([classConstructorType, voidType]);\n                    break;\n                case 144:\n                    expectedReturnType = voidType;\n                    errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);\n                    break;\n                case 147:\n                    expectedReturnType = voidType;\n                    errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);\n                    break;\n                case 149:\n                case 151:\n                case 152:\n                    var methodType = getTypeOfNode(node.parent);\n                    var descriptorType = createTypedPropertyDescriptorType(methodType);\n                    expectedReturnType = getUnionType([descriptorType, voidType]);\n                    break;\n            }\n            checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, errorInfo);\n        }\n        function markTypeNodeAsReferenced(node) {\n            var typeName = node && ts.getEntityNameFromTypeNode(node);\n            var rootName = typeName && getFirstIdentifier(typeName);\n            var rootSymbol = rootName && resolveName(rootName, rootName.text, (typeName.kind === 70 ? 793064 : 1920) | 8388608, undefined, undefined);\n            if (rootSymbol\n                && rootSymbol.flags & 8388608\n                && symbolIsValue(rootSymbol)\n                && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) {\n                markAliasSymbolAsReferenced(rootSymbol);\n            }\n        }\n        function checkDecorators(node) {\n            if (!node.decorators) {\n                return;\n            }\n            if (!ts.nodeCanBeDecorated(node)) {\n                return;\n            }\n            if (!compilerOptions.experimentalDecorators) {\n                error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning);\n            }\n            var firstDecorator = node.decorators[0];\n            checkExternalEmitHelpers(firstDecorator, 8);\n            if (node.kind === 144) {\n                checkExternalEmitHelpers(firstDecorator, 32);\n            }\n            if (compilerOptions.emitDecoratorMetadata) {\n                checkExternalEmitHelpers(firstDecorator, 16);\n                switch (node.kind) {\n                    case 226:\n                        var constructor = ts.getFirstConstructorWithBody(node);\n                        if (constructor) {\n                            for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) {\n                                var parameter = _a[_i];\n                                markTypeNodeAsReferenced(parameter.type);\n                            }\n                        }\n                        break;\n                    case 149:\n                    case 151:\n                    case 152:\n                        for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) {\n                            var parameter = _c[_b];\n                            markTypeNodeAsReferenced(parameter.type);\n                        }\n                        markTypeNodeAsReferenced(node.type);\n                        break;\n                    case 147:\n                    case 144:\n                        markTypeNodeAsReferenced(node.type);\n                        break;\n                }\n            }\n            ts.forEach(node.decorators, checkDecorator);\n        }\n        function checkFunctionDeclaration(node) {\n            if (produceDiagnostics) {\n                checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node);\n                checkCollisionWithCapturedSuperVariable(node, node.name);\n                checkCollisionWithCapturedThisVariable(node, node.name);\n                checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n                checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n            }\n        }\n        function checkFunctionOrMethodDeclaration(node) {\n            checkDecorators(node);\n            checkSignatureDeclaration(node);\n            var isAsync = ts.isAsyncFunctionLike(node);\n            if (node.name && node.name.kind === 142) {\n                checkComputedPropertyName(node.name);\n            }\n            if (!ts.hasDynamicName(node)) {\n                var symbol = getSymbolOfNode(node);\n                var localSymbol = node.localSymbol || symbol;\n                var firstDeclaration = ts.forEach(localSymbol.declarations, function (declaration) { return declaration.kind === node.kind && !ts.isSourceFileJavaScript(ts.getSourceFileOfNode(declaration)) ?\n                    declaration : undefined; });\n                if (node === firstDeclaration) {\n                    checkFunctionOrConstructorSymbol(localSymbol);\n                }\n                if (symbol.parent) {\n                    if (ts.getDeclarationOfKind(symbol, node.kind) === node) {\n                        checkFunctionOrConstructorSymbol(symbol);\n                    }\n                }\n            }\n            checkSourceElement(node.body);\n            if (!node.asteriskToken) {\n                var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type));\n                checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType);\n            }\n            if (produceDiagnostics && !node.type) {\n                if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) {\n                    reportImplicitAnyError(node, anyType);\n                }\n                if (node.asteriskToken && ts.nodeIsPresent(node.body)) {\n                    getReturnTypeOfSignature(getSignatureFromDeclaration(node));\n                }\n            }\n            registerForUnusedIdentifiersCheck(node);\n        }\n        function registerForUnusedIdentifiersCheck(node) {\n            if (deferredUnusedIdentifierNodes) {\n                deferredUnusedIdentifierNodes.push(node);\n            }\n        }\n        function checkUnusedIdentifiers() {\n            if (deferredUnusedIdentifierNodes) {\n                for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) {\n                    var node = deferredUnusedIdentifierNodes_1[_i];\n                    switch (node.kind) {\n                        case 261:\n                        case 230:\n                            checkUnusedModuleMembers(node);\n                            break;\n                        case 226:\n                        case 197:\n                            checkUnusedClassMembers(node);\n                            checkUnusedTypeParameters(node);\n                            break;\n                        case 227:\n                            checkUnusedTypeParameters(node);\n                            break;\n                        case 204:\n                        case 232:\n                        case 211:\n                        case 212:\n                        case 213:\n                            checkUnusedLocalsAndParameters(node);\n                            break;\n                        case 150:\n                        case 184:\n                        case 225:\n                        case 185:\n                        case 149:\n                        case 151:\n                        case 152:\n                            if (node.body) {\n                                checkUnusedLocalsAndParameters(node);\n                            }\n                            checkUnusedTypeParameters(node);\n                            break;\n                        case 148:\n                        case 153:\n                        case 154:\n                        case 155:\n                        case 158:\n                        case 159:\n                            checkUnusedTypeParameters(node);\n                            break;\n                    }\n                    ;\n                }\n            }\n        }\n        function checkUnusedLocalsAndParameters(node) {\n            if (node.parent.kind !== 227 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) {\n                var _loop_2 = function (key) {\n                    var local = node.locals[key];\n                    if (!local.isReferenced) {\n                        if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144) {\n                            var parameter = ts.getRootDeclaration(local.valueDeclaration);\n                            if (compilerOptions.noUnusedParameters &&\n                                !ts.isParameterPropertyDeclaration(parameter) &&\n                                !ts.parameterIsThisKeyword(parameter) &&\n                                !parameterNameStartsWithUnderscore(local.valueDeclaration.name)) {\n                                error(local.valueDeclaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name);\n                            }\n                        }\n                        else if (compilerOptions.noUnusedLocals) {\n                            ts.forEach(local.declarations, function (d) { return errorUnusedLocal(d.name || d, local.name); });\n                        }\n                    }\n                };\n                for (var key in node.locals) {\n                    _loop_2(key);\n                }\n            }\n        }\n        function errorUnusedLocal(node, name) {\n            if (isIdentifierThatStartsWithUnderScore(node)) {\n                var declaration = ts.getRootDeclaration(node.parent);\n                if (declaration.kind === 223 &&\n                    (declaration.parent.parent.kind === 212 ||\n                        declaration.parent.parent.kind === 213)) {\n                    return;\n                }\n            }\n            error(node, ts.Diagnostics._0_is_declared_but_never_used, name);\n        }\n        function parameterNameStartsWithUnderscore(parameterName) {\n            return parameterName && isIdentifierThatStartsWithUnderScore(parameterName);\n        }\n        function isIdentifierThatStartsWithUnderScore(node) {\n            return node.kind === 70 && node.text.charCodeAt(0) === 95;\n        }\n        function checkUnusedClassMembers(node) {\n            if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {\n                if (node.members) {\n                    for (var _i = 0, _a = node.members; _i < _a.length; _i++) {\n                        var member = _a[_i];\n                        if (member.kind === 149 || member.kind === 147) {\n                            if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8) {\n                                error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name);\n                            }\n                        }\n                        else if (member.kind === 150) {\n                            for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {\n                                var parameter = _c[_b];\n                                if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8) {\n                                    error(parameter.name, ts.Diagnostics.Property_0_is_declared_but_never_used, parameter.symbol.name);\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        function checkUnusedTypeParameters(node) {\n            if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {\n                if (node.typeParameters) {\n                    var symbol = getSymbolOfNode(node);\n                    var lastDeclaration = symbol && symbol.declarations && ts.lastOrUndefined(symbol.declarations);\n                    if (lastDeclaration !== node) {\n                        return;\n                    }\n                    for (var _i = 0, _a = node.typeParameters; _i < _a.length; _i++) {\n                        var typeParameter = _a[_i];\n                        if (!getMergedSymbol(typeParameter.symbol).isReferenced) {\n                            error(typeParameter.name, ts.Diagnostics._0_is_declared_but_never_used, typeParameter.symbol.name);\n                        }\n                    }\n                }\n            }\n        }\n        function checkUnusedModuleMembers(node) {\n            if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {\n                for (var key in node.locals) {\n                    var local = node.locals[key];\n                    if (!local.isReferenced && !local.exportSymbol) {\n                        for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) {\n                            var declaration = _a[_i];\n                            if (!ts.isAmbientModule(declaration)) {\n                                error(declaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name);\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        function checkBlock(node) {\n            if (node.kind === 204) {\n                checkGrammarStatementInAmbientContext(node);\n            }\n            ts.forEach(node.statements, checkSourceElement);\n            if (node.locals) {\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkCollisionWithArgumentsInGeneratedCode(node) {\n            if (!ts.hasDeclaredRestParameter(node) || ts.isInAmbientContext(node) || ts.nodeIsMissing(node.body)) {\n                return;\n            }\n            ts.forEach(node.parameters, function (p) {\n                if (p.name && !ts.isBindingPattern(p.name) && p.name.text === argumentsSymbol.name) {\n                    error(p, ts.Diagnostics.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters);\n                }\n            });\n        }\n        function needCollisionCheckForIdentifier(node, identifier, name) {\n            if (!(identifier && identifier.text === name)) {\n                return false;\n            }\n            if (node.kind === 147 ||\n                node.kind === 146 ||\n                node.kind === 149 ||\n                node.kind === 148 ||\n                node.kind === 151 ||\n                node.kind === 152) {\n                return false;\n            }\n            if (ts.isInAmbientContext(node)) {\n                return false;\n            }\n            var root = ts.getRootDeclaration(node);\n            if (root.kind === 144 && ts.nodeIsMissing(root.parent.body)) {\n                return false;\n            }\n            return true;\n        }\n        function checkCollisionWithCapturedThisVariable(node, name) {\n            if (needCollisionCheckForIdentifier(node, name, \"_this\")) {\n                potentialThisCollisions.push(node);\n            }\n        }\n        function checkIfThisIsCapturedInEnclosingScope(node) {\n            var current = node;\n            while (current) {\n                if (getNodeCheckFlags(current) & 4) {\n                    var isDeclaration_1 = node.kind !== 70;\n                    if (isDeclaration_1) {\n                        error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);\n                    }\n                    else {\n                        error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference);\n                    }\n                    return;\n                }\n                current = current.parent;\n            }\n        }\n        function checkCollisionWithCapturedSuperVariable(node, name) {\n            if (!needCollisionCheckForIdentifier(node, name, \"_super\")) {\n                return;\n            }\n            var enclosingClass = ts.getContainingClass(node);\n            if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) {\n                return;\n            }\n            if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) {\n                var isDeclaration_2 = node.kind !== 70;\n                if (isDeclaration_2) {\n                    error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference);\n                }\n                else {\n                    error(node, ts.Diagnostics.Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference);\n                }\n            }\n        }\n        function checkCollisionWithRequireExportsInGeneratedCode(node, name) {\n            if (modulekind >= ts.ModuleKind.ES2015) {\n                return;\n            }\n            if (!needCollisionCheckForIdentifier(node, name, \"require\") && !needCollisionCheckForIdentifier(node, name, \"exports\")) {\n                return;\n            }\n            if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) {\n                return;\n            }\n            var parent = getDeclarationContainer(node);\n            if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent)) {\n                error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name));\n            }\n        }\n        function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) {\n            if (languageVersion >= 4 || !needCollisionCheckForIdentifier(node, name, \"Promise\")) {\n                return;\n            }\n            if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) {\n                return;\n            }\n            var parent = getDeclarationContainer(node);\n            if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) {\n                error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name));\n            }\n        }\n        function checkVarDeclaredNamesNotShadowed(node) {\n            if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) {\n                return;\n            }\n            if (node.kind === 223 && !node.initializer) {\n                return;\n            }\n            var symbol = getSymbolOfNode(node);\n            if (symbol.flags & 1) {\n                var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined);\n                if (localDeclarationSymbol &&\n                    localDeclarationSymbol !== symbol &&\n                    localDeclarationSymbol.flags & 2) {\n                    if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) {\n                        var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 224);\n                        var container = varDeclList.parent.kind === 205 && varDeclList.parent.parent\n                            ? varDeclList.parent.parent\n                            : undefined;\n                        var namesShareScope = container &&\n                            (container.kind === 204 && ts.isFunctionLike(container.parent) ||\n                                container.kind === 231 ||\n                                container.kind === 230 ||\n                                container.kind === 261);\n                        if (!namesShareScope) {\n                            var name_25 = symbolToString(localDeclarationSymbol);\n                            error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_25, name_25);\n                        }\n                    }\n                }\n            }\n        }\n        function checkParameterInitializer(node) {\n            if (ts.getRootDeclaration(node).kind !== 144) {\n                return;\n            }\n            var func = ts.getContainingFunction(node);\n            visit(node.initializer);\n            function visit(n) {\n                if (ts.isTypeNode(n) || ts.isDeclarationName(n)) {\n                    return;\n                }\n                if (n.kind === 177) {\n                    return visit(n.expression);\n                }\n                else if (n.kind === 70) {\n                    var symbol = resolveName(n, n.text, 107455 | 8388608, undefined, undefined);\n                    if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) {\n                        return;\n                    }\n                    if (symbol.valueDeclaration === node) {\n                        error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name));\n                        return;\n                    }\n                    var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);\n                    if (enclosingContainer === func) {\n                        if (symbol.valueDeclaration.kind === 144) {\n                            if (symbol.valueDeclaration.pos < node.pos) {\n                                return;\n                            }\n                            var current = n;\n                            while (current !== node.initializer) {\n                                if (ts.isFunctionLike(current.parent)) {\n                                    return;\n                                }\n                                if (current.parent.kind === 147 &&\n                                    !(ts.hasModifier(current.parent, 32)) &&\n                                    ts.isClassLike(current.parent.parent)) {\n                                    return;\n                                }\n                                current = current.parent;\n                            }\n                        }\n                        error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n));\n                    }\n                }\n                else {\n                    return ts.forEachChild(n, visit);\n                }\n            }\n        }\n        function convertAutoToAny(type) {\n            return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type;\n        }\n        function checkVariableLikeDeclaration(node) {\n            checkDecorators(node);\n            checkSourceElement(node.type);\n            if (node.name.kind === 142) {\n                checkComputedPropertyName(node.name);\n                if (node.initializer) {\n                    checkExpressionCached(node.initializer);\n                }\n            }\n            if (node.kind === 174) {\n                if (node.parent.kind === 172 && languageVersion < 5) {\n                    checkExternalEmitHelpers(node, 4);\n                }\n                if (node.propertyName && node.propertyName.kind === 142) {\n                    checkComputedPropertyName(node.propertyName);\n                }\n                var parent_10 = node.parent.parent;\n                var parentType = getTypeForBindingElementParent(parent_10);\n                var name_26 = node.propertyName || node.name;\n                var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_26));\n                markPropertyAsReferenced(property);\n                if (parent_10.initializer && property && getParentOfSymbol(property)) {\n                    checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property);\n                }\n            }\n            if (ts.isBindingPattern(node.name)) {\n                ts.forEach(node.name.elements, checkSourceElement);\n            }\n            if (node.initializer && ts.getRootDeclaration(node).kind === 144 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {\n                error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);\n                return;\n            }\n            if (ts.isBindingPattern(node.name)) {\n                if (node.initializer && node.parent.parent.kind !== 212) {\n                    checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined);\n                    checkParameterInitializer(node);\n                }\n                return;\n            }\n            var symbol = getSymbolOfNode(node);\n            var type = convertAutoToAny(getTypeOfVariableOrParameterOrProperty(symbol));\n            if (node === symbol.valueDeclaration) {\n                if (node.initializer && node.parent.parent.kind !== 212) {\n                    checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined);\n                    checkParameterInitializer(node);\n                }\n            }\n            else {\n                var declarationType = convertAutoToAny(getWidenedTypeForVariableLikeDeclaration(node));\n                if (type !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(type, declarationType)) {\n                    error(node.name, ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, ts.declarationNameToString(node.name), typeToString(type), typeToString(declarationType));\n                }\n                if (node.initializer) {\n                    checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined);\n                }\n                if (!areDeclarationFlagsIdentical(node, symbol.valueDeclaration)) {\n                    error(symbol.valueDeclaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name));\n                    error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name));\n                }\n            }\n            if (node.kind !== 147 && node.kind !== 146) {\n                checkExportsOnMergedDeclarations(node);\n                if (node.kind === 223 || node.kind === 174) {\n                    checkVarDeclaredNamesNotShadowed(node);\n                }\n                checkCollisionWithCapturedSuperVariable(node, node.name);\n                checkCollisionWithCapturedThisVariable(node, node.name);\n                checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n                checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n            }\n        }\n        function areDeclarationFlagsIdentical(left, right) {\n            if ((left.kind === 144 && right.kind === 223) ||\n                (left.kind === 223 && right.kind === 144)) {\n                return true;\n            }\n            if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) {\n                return false;\n            }\n            var interestingFlags = 8 |\n                16 |\n                256 |\n                128 |\n                64 |\n                32;\n            return (ts.getModifierFlags(left) & interestingFlags) === (ts.getModifierFlags(right) & interestingFlags);\n        }\n        function checkVariableDeclaration(node) {\n            checkGrammarVariableDeclaration(node);\n            return checkVariableLikeDeclaration(node);\n        }\n        function checkBindingElement(node) {\n            checkGrammarBindingElement(node);\n            return checkVariableLikeDeclaration(node);\n        }\n        function checkVariableStatement(node) {\n            checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarVariableDeclarationList(node.declarationList) || checkGrammarForDisallowedLetOrConstStatement(node);\n            ts.forEach(node.declarationList.declarations, checkSourceElement);\n        }\n        function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) {\n            if (node.modifiers && node.parent.kind === 176) {\n                if (ts.isAsyncFunctionLike(node)) {\n                    if (node.modifiers.length > 1) {\n                        return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here);\n                    }\n                }\n                else {\n                    return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here);\n                }\n            }\n        }\n        function checkExpressionStatement(node) {\n            checkGrammarStatementInAmbientContext(node);\n            checkExpression(node.expression);\n        }\n        function checkIfStatement(node) {\n            checkGrammarStatementInAmbientContext(node);\n            checkExpression(node.expression);\n            checkSourceElement(node.thenStatement);\n            if (node.thenStatement.kind === 206) {\n                error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);\n            }\n            checkSourceElement(node.elseStatement);\n        }\n        function checkDoStatement(node) {\n            checkGrammarStatementInAmbientContext(node);\n            checkSourceElement(node.statement);\n            checkExpression(node.expression);\n        }\n        function checkWhileStatement(node) {\n            checkGrammarStatementInAmbientContext(node);\n            checkExpression(node.expression);\n            checkSourceElement(node.statement);\n        }\n        function checkForStatement(node) {\n            if (!checkGrammarStatementInAmbientContext(node)) {\n                if (node.initializer && node.initializer.kind === 224) {\n                    checkGrammarVariableDeclarationList(node.initializer);\n                }\n            }\n            if (node.initializer) {\n                if (node.initializer.kind === 224) {\n                    ts.forEach(node.initializer.declarations, checkVariableDeclaration);\n                }\n                else {\n                    checkExpression(node.initializer);\n                }\n            }\n            if (node.condition)\n                checkExpression(node.condition);\n            if (node.incrementor)\n                checkExpression(node.incrementor);\n            checkSourceElement(node.statement);\n            if (node.locals) {\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkForOfStatement(node) {\n            checkGrammarForInOrForOfStatement(node);\n            if (node.initializer.kind === 224) {\n                checkForInOrForOfVariableDeclaration(node);\n            }\n            else {\n                var varExpr = node.initializer;\n                var iteratedType = checkRightHandSideOfForOf(node.expression);\n                if (varExpr.kind === 175 || varExpr.kind === 176) {\n                    checkDestructuringAssignment(varExpr, iteratedType || unknownType);\n                }\n                else {\n                    var leftType = checkExpression(varExpr);\n                    checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access);\n                    if (iteratedType) {\n                        checkTypeAssignableTo(iteratedType, leftType, varExpr, undefined);\n                    }\n                }\n            }\n            checkSourceElement(node.statement);\n            if (node.locals) {\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkForInStatement(node) {\n            checkGrammarForInOrForOfStatement(node);\n            var rightType = checkNonNullExpression(node.expression);\n            if (node.initializer.kind === 224) {\n                var variable = node.initializer.declarations[0];\n                if (variable && ts.isBindingPattern(variable.name)) {\n                    error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);\n                }\n                checkForInOrForOfVariableDeclaration(node);\n            }\n            else {\n                var varExpr = node.initializer;\n                var leftType = checkExpression(varExpr);\n                if (varExpr.kind === 175 || varExpr.kind === 176) {\n                    error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);\n                }\n                else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {\n                    error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any);\n                }\n                else {\n                    checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access);\n                }\n            }\n            if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672)) {\n                error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter);\n            }\n            checkSourceElement(node.statement);\n            if (node.locals) {\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkForInOrForOfVariableDeclaration(iterationStatement) {\n            var variableDeclarationList = iterationStatement.initializer;\n            if (variableDeclarationList.declarations.length >= 1) {\n                var decl = variableDeclarationList.declarations[0];\n                checkVariableDeclaration(decl);\n            }\n        }\n        function checkRightHandSideOfForOf(rhsExpression) {\n            var expressionType = checkNonNullExpression(rhsExpression);\n            return checkIteratedTypeOrElementType(expressionType, rhsExpression, true);\n        }\n        function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) {\n            if (isTypeAny(inputType)) {\n                return inputType;\n            }\n            if (languageVersion >= 2) {\n                return checkElementTypeOfIterable(inputType, errorNode);\n            }\n            if (allowStringInput) {\n                return checkElementTypeOfArrayOrString(inputType, errorNode);\n            }\n            if (isArrayLikeType(inputType)) {\n                var indexType = getIndexTypeOfType(inputType, 1);\n                if (indexType) {\n                    return indexType;\n                }\n            }\n            if (errorNode) {\n                error(errorNode, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType));\n            }\n            return unknownType;\n        }\n        function checkElementTypeOfIterable(iterable, errorNode) {\n            var elementType = getElementTypeOfIterable(iterable, errorNode);\n            if (errorNode && elementType) {\n                checkTypeAssignableTo(iterable, createIterableType(elementType), errorNode);\n            }\n            return elementType || anyType;\n        }\n        function getElementTypeOfIterable(type, errorNode) {\n            if (isTypeAny(type)) {\n                return undefined;\n            }\n            var typeAsIterable = type;\n            if (!typeAsIterable.iterableElementType) {\n                if ((getObjectFlags(type) & 4) && type.target === getGlobalIterableType()) {\n                    typeAsIterable.iterableElementType = type.typeArguments[0];\n                }\n                else {\n                    var iteratorFunction = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName(\"iterator\"));\n                    if (isTypeAny(iteratorFunction)) {\n                        return undefined;\n                    }\n                    var iteratorFunctionSignatures = iteratorFunction ? getSignaturesOfType(iteratorFunction, 0) : emptyArray;\n                    if (iteratorFunctionSignatures.length === 0) {\n                        if (errorNode) {\n                            error(errorNode, ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator);\n                        }\n                        return undefined;\n                    }\n                    typeAsIterable.iterableElementType = getElementTypeOfIterator(getUnionType(ts.map(iteratorFunctionSignatures, getReturnTypeOfSignature), true), errorNode);\n                }\n            }\n            return typeAsIterable.iterableElementType;\n        }\n        function getElementTypeOfIterator(type, errorNode) {\n            if (isTypeAny(type)) {\n                return undefined;\n            }\n            var typeAsIterator = type;\n            if (!typeAsIterator.iteratorElementType) {\n                if ((getObjectFlags(type) & 4) && type.target === getGlobalIteratorType()) {\n                    typeAsIterator.iteratorElementType = type.typeArguments[0];\n                }\n                else {\n                    var iteratorNextFunction = getTypeOfPropertyOfType(type, \"next\");\n                    if (isTypeAny(iteratorNextFunction)) {\n                        return undefined;\n                    }\n                    var iteratorNextFunctionSignatures = iteratorNextFunction ? getSignaturesOfType(iteratorNextFunction, 0) : emptyArray;\n                    if (iteratorNextFunctionSignatures.length === 0) {\n                        if (errorNode) {\n                            error(errorNode, ts.Diagnostics.An_iterator_must_have_a_next_method);\n                        }\n                        return undefined;\n                    }\n                    var iteratorNextResult = getUnionType(ts.map(iteratorNextFunctionSignatures, getReturnTypeOfSignature), true);\n                    if (isTypeAny(iteratorNextResult)) {\n                        return undefined;\n                    }\n                    var iteratorNextValue = getTypeOfPropertyOfType(iteratorNextResult, \"value\");\n                    if (!iteratorNextValue) {\n                        if (errorNode) {\n                            error(errorNode, ts.Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property);\n                        }\n                        return undefined;\n                    }\n                    typeAsIterator.iteratorElementType = iteratorNextValue;\n                }\n            }\n            return typeAsIterator.iteratorElementType;\n        }\n        function getElementTypeOfIterableIterator(type) {\n            if (isTypeAny(type)) {\n                return undefined;\n            }\n            if ((getObjectFlags(type) & 4) && type.target === getGlobalIterableIteratorType()) {\n                return type.typeArguments[0];\n            }\n            return getElementTypeOfIterable(type, undefined) ||\n                getElementTypeOfIterator(type, undefined);\n        }\n        function checkElementTypeOfArrayOrString(arrayOrStringType, errorNode) {\n            ts.Debug.assert(languageVersion < 2);\n            var arrayType = arrayOrStringType;\n            if (arrayOrStringType.flags & 65536) {\n                var arrayTypes = arrayOrStringType.types;\n                var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178); });\n                if (filteredTypes !== arrayTypes) {\n                    arrayType = getUnionType(filteredTypes, true);\n                }\n            }\n            else if (arrayOrStringType.flags & 262178) {\n                arrayType = neverType;\n            }\n            var hasStringConstituent = arrayOrStringType !== arrayType;\n            var reportedError = false;\n            if (hasStringConstituent) {\n                if (languageVersion < 1) {\n                    error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher);\n                    reportedError = true;\n                }\n                if (arrayType.flags & 8192) {\n                    return stringType;\n                }\n            }\n            if (!isArrayLikeType(arrayType)) {\n                if (!reportedError) {\n                    var diagnostic = hasStringConstituent\n                        ? ts.Diagnostics.Type_0_is_not_an_array_type\n                        : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type;\n                    error(errorNode, diagnostic, typeToString(arrayType));\n                }\n                return hasStringConstituent ? stringType : unknownType;\n            }\n            var arrayElementType = getIndexTypeOfType(arrayType, 1) || unknownType;\n            if (hasStringConstituent) {\n                if (arrayElementType.flags & 262178) {\n                    return stringType;\n                }\n                return getUnionType([arrayElementType, stringType], true);\n            }\n            return arrayElementType;\n        }\n        function checkBreakOrContinueStatement(node) {\n            checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node);\n        }\n        function isGetAccessorWithAnnotatedSetAccessor(node) {\n            return !!(node.kind === 151 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 152)));\n        }\n        function isUnwrappedReturnTypeVoidOrAny(func, returnType) {\n            var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType;\n            return unwrappedReturnType && maybeTypeOfKind(unwrappedReturnType, 1024 | 1);\n        }\n        function checkReturnStatement(node) {\n            if (!checkGrammarStatementInAmbientContext(node)) {\n                var functionBlock = ts.getContainingFunction(node);\n                if (!functionBlock) {\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body);\n                }\n            }\n            var func = ts.getContainingFunction(node);\n            if (func) {\n                var signature = getSignatureFromDeclaration(func);\n                var returnType = getReturnTypeOfSignature(signature);\n                if (strictNullChecks || node.expression || returnType.flags & 8192) {\n                    var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType;\n                    if (func.asteriskToken) {\n                        return;\n                    }\n                    if (func.kind === 152) {\n                        if (node.expression) {\n                            error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value);\n                        }\n                    }\n                    else if (func.kind === 150) {\n                        if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) {\n                            error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);\n                        }\n                    }\n                    else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) {\n                        if (ts.isAsyncFunctionLike(func)) {\n                            var promisedType = getPromisedType(returnType);\n                            var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member);\n                            if (promisedType) {\n                                checkTypeAssignableTo(awaitedType, promisedType, node.expression || node);\n                            }\n                        }\n                        else {\n                            checkTypeAssignableTo(exprType, returnType, node.expression || node);\n                        }\n                    }\n                }\n                else if (func.kind !== 150 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) {\n                    error(node, ts.Diagnostics.Not_all_code_paths_return_a_value);\n                }\n            }\n        }\n        function checkWithStatement(node) {\n            if (!checkGrammarStatementInAmbientContext(node)) {\n                if (node.flags & 16384) {\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block);\n                }\n            }\n            checkExpression(node.expression);\n            var sourceFile = ts.getSourceFileOfNode(node);\n            if (!hasParseDiagnostics(sourceFile)) {\n                var start = ts.getSpanOfTokenAtPosition(sourceFile, node.pos).start;\n                var end = node.statement.pos;\n                grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any);\n            }\n        }\n        function checkSwitchStatement(node) {\n            checkGrammarStatementInAmbientContext(node);\n            var firstDefaultClause;\n            var hasDuplicateDefaultClause = false;\n            var expressionType = checkExpression(node.expression);\n            var expressionIsLiteral = isLiteralType(expressionType);\n            ts.forEach(node.caseBlock.clauses, function (clause) {\n                if (clause.kind === 254 && !hasDuplicateDefaultClause) {\n                    if (firstDefaultClause === undefined) {\n                        firstDefaultClause = clause;\n                    }\n                    else {\n                        var sourceFile = ts.getSourceFileOfNode(node);\n                        var start = ts.skipTrivia(sourceFile.text, clause.pos);\n                        var end = clause.statements.length > 0 ? clause.statements[0].pos : clause.end;\n                        grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement);\n                        hasDuplicateDefaultClause = true;\n                    }\n                }\n                if (produceDiagnostics && clause.kind === 253) {\n                    var caseClause = clause;\n                    var caseType = checkExpression(caseClause.expression);\n                    var caseIsLiteral = isLiteralType(caseType);\n                    var comparedExpressionType = expressionType;\n                    if (!caseIsLiteral || !expressionIsLiteral) {\n                        caseType = caseIsLiteral ? getBaseTypeOfLiteralType(caseType) : caseType;\n                        comparedExpressionType = getBaseTypeOfLiteralType(expressionType);\n                    }\n                    if (!isTypeEqualityComparableTo(comparedExpressionType, caseType)) {\n                        checkTypeComparableTo(caseType, comparedExpressionType, caseClause.expression, undefined);\n                    }\n                }\n                ts.forEach(clause.statements, checkSourceElement);\n            });\n            if (node.caseBlock.locals) {\n                registerForUnusedIdentifiersCheck(node.caseBlock);\n            }\n        }\n        function checkLabeledStatement(node) {\n            if (!checkGrammarStatementInAmbientContext(node)) {\n                var current = node.parent;\n                while (current) {\n                    if (ts.isFunctionLike(current)) {\n                        break;\n                    }\n                    if (current.kind === 219 && current.label.text === node.label.text) {\n                        var sourceFile = ts.getSourceFileOfNode(node);\n                        grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label));\n                        break;\n                    }\n                    current = current.parent;\n                }\n            }\n            checkSourceElement(node.statement);\n        }\n        function checkThrowStatement(node) {\n            if (!checkGrammarStatementInAmbientContext(node)) {\n                if (node.expression === undefined) {\n                    grammarErrorAfterFirstToken(node, ts.Diagnostics.Line_break_not_permitted_here);\n                }\n            }\n            if (node.expression) {\n                checkExpression(node.expression);\n            }\n        }\n        function checkTryStatement(node) {\n            checkGrammarStatementInAmbientContext(node);\n            checkBlock(node.tryBlock);\n            var catchClause = node.catchClause;\n            if (catchClause) {\n                if (catchClause.variableDeclaration) {\n                    if (catchClause.variableDeclaration.type) {\n                        grammarErrorOnFirstToken(catchClause.variableDeclaration.type, ts.Diagnostics.Catch_clause_variable_cannot_have_a_type_annotation);\n                    }\n                    else if (catchClause.variableDeclaration.initializer) {\n                        grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer);\n                    }\n                    else {\n                        var blockLocals = catchClause.block.locals;\n                        if (blockLocals) {\n                            for (var caughtName in catchClause.locals) {\n                                var blockLocal = blockLocals[caughtName];\n                                if (blockLocal && (blockLocal.flags & 2) !== 0) {\n                                    grammarErrorOnNode(blockLocal.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName);\n                                }\n                            }\n                        }\n                    }\n                }\n                checkBlock(catchClause.block);\n            }\n            if (node.finallyBlock) {\n                checkBlock(node.finallyBlock);\n            }\n        }\n        function checkIndexConstraints(type) {\n            var declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, 1);\n            var declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, 0);\n            var stringIndexType = getIndexTypeOfType(type, 0);\n            var numberIndexType = getIndexTypeOfType(type, 1);\n            if (stringIndexType || numberIndexType) {\n                ts.forEach(getPropertiesOfObjectType(type), function (prop) {\n                    var propType = getTypeOfSymbol(prop);\n                    checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0);\n                    checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1);\n                });\n                if (getObjectFlags(type) & 1 && ts.isClassLike(type.symbol.valueDeclaration)) {\n                    var classDeclaration = type.symbol.valueDeclaration;\n                    for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) {\n                        var member = _a[_i];\n                        if (!(ts.getModifierFlags(member) & 32) && ts.hasDynamicName(member)) {\n                            var propType = getTypeOfSymbol(member.symbol);\n                            checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0);\n                            checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1);\n                        }\n                    }\n                }\n            }\n            var errorNode;\n            if (stringIndexType && numberIndexType) {\n                errorNode = declaredNumberIndexer || declaredStringIndexer;\n                if (!errorNode && (getObjectFlags(type) & 2)) {\n                    var someBaseTypeHasBothIndexers = ts.forEach(getBaseTypes(type), function (base) { return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); });\n                    errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0];\n                }\n            }\n            if (errorNode && !isTypeAssignableTo(numberIndexType, stringIndexType)) {\n                error(errorNode, ts.Diagnostics.Numeric_index_type_0_is_not_assignable_to_string_index_type_1, typeToString(numberIndexType), typeToString(stringIndexType));\n            }\n            function checkIndexConstraintForProperty(prop, propertyType, containingType, indexDeclaration, indexType, indexKind) {\n                if (!indexType) {\n                    return;\n                }\n                if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) {\n                    return;\n                }\n                var errorNode;\n                if (prop.valueDeclaration.name.kind === 142 || prop.parent === containingType.symbol) {\n                    errorNode = prop.valueDeclaration;\n                }\n                else if (indexDeclaration) {\n                    errorNode = indexDeclaration;\n                }\n                else if (getObjectFlags(containingType) & 2) {\n                    var someBaseClassHasBothPropertyAndIndexer = ts.forEach(getBaseTypes(containingType), function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); });\n                    errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0];\n                }\n                if (errorNode && !isTypeAssignableTo(propertyType, indexType)) {\n                    var errorMessage = indexKind === 0\n                        ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2\n                        : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2;\n                    error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType));\n                }\n            }\n        }\n        function checkTypeNameIsReserved(name, message) {\n            switch (name.text) {\n                case \"any\":\n                case \"number\":\n                case \"boolean\":\n                case \"string\":\n                case \"symbol\":\n                case \"void\":\n                    error(name, message, name.text);\n            }\n        }\n        function checkTypeParameters(typeParameterDeclarations) {\n            if (typeParameterDeclarations) {\n                for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) {\n                    var node = typeParameterDeclarations[i];\n                    checkTypeParameter(node);\n                    if (produceDiagnostics) {\n                        for (var j = 0; j < i; j++) {\n                            if (typeParameterDeclarations[j].symbol === node.symbol) {\n                                error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name));\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        function checkTypeParameterListsIdentical(node, symbol) {\n            if (symbol.declarations.length === 1) {\n                return;\n            }\n            var firstDecl;\n            for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                var declaration = _a[_i];\n                if (declaration.kind === 226 || declaration.kind === 227) {\n                    if (!firstDecl) {\n                        firstDecl = declaration;\n                    }\n                    else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) {\n                        error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text);\n                    }\n                }\n            }\n        }\n        function checkClassExpression(node) {\n            checkClassLikeDeclaration(node);\n            checkNodeDeferred(node);\n            return getTypeOfSymbol(getSymbolOfNode(node));\n        }\n        function checkClassExpressionDeferred(node) {\n            ts.forEach(node.members, checkSourceElement);\n            registerForUnusedIdentifiersCheck(node);\n        }\n        function checkClassDeclaration(node) {\n            if (!node.name && !(ts.getModifierFlags(node) & 512)) {\n                grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name);\n            }\n            checkClassLikeDeclaration(node);\n            ts.forEach(node.members, checkSourceElement);\n            registerForUnusedIdentifiersCheck(node);\n        }\n        function checkClassLikeDeclaration(node) {\n            checkGrammarClassDeclarationHeritageClauses(node);\n            checkDecorators(node);\n            if (node.name) {\n                checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0);\n                checkCollisionWithCapturedThisVariable(node, node.name);\n                checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n                checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n            }\n            checkTypeParameters(node.typeParameters);\n            checkExportsOnMergedDeclarations(node);\n            var symbol = getSymbolOfNode(node);\n            var type = getDeclaredTypeOfSymbol(symbol);\n            var typeWithThis = getTypeWithThisArgument(type);\n            var staticType = getTypeOfSymbol(symbol);\n            checkTypeParameterListsIdentical(node, symbol);\n            checkClassForDuplicateDeclarations(node);\n            var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node);\n            if (baseTypeNode) {\n                if (languageVersion < 2) {\n                    checkExternalEmitHelpers(baseTypeNode.parent, 1);\n                }\n                var baseTypes = getBaseTypes(type);\n                if (baseTypes.length && produceDiagnostics) {\n                    var baseType_1 = baseTypes[0];\n                    var staticBaseType = getBaseConstructorTypeOfClass(type);\n                    checkBaseTypeAccessibility(staticBaseType, baseTypeNode);\n                    checkSourceElement(baseTypeNode.expression);\n                    if (baseTypeNode.typeArguments) {\n                        ts.forEach(baseTypeNode.typeArguments, checkSourceElement);\n                        for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); _i < _a.length; _i++) {\n                            var constructor = _a[_i];\n                            if (!checkTypeArgumentConstraints(constructor.typeParameters, baseTypeNode.typeArguments)) {\n                                break;\n                            }\n                        }\n                    }\n                    checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1);\n                    checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1);\n                    if (baseType_1.symbol.valueDeclaration &&\n                        !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) &&\n                        baseType_1.symbol.valueDeclaration.kind === 226) {\n                        if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) {\n                            error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class);\n                        }\n                    }\n                    if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32)) {\n                        var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments);\n                        if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1; })) {\n                            error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type);\n                        }\n                    }\n                    checkKindsOfPropertyMemberOverrides(type, baseType_1);\n                }\n            }\n            var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node);\n            if (implementedTypeNodes) {\n                for (var _b = 0, implementedTypeNodes_1 = implementedTypeNodes; _b < implementedTypeNodes_1.length; _b++) {\n                    var typeRefNode = implementedTypeNodes_1[_b];\n                    if (!ts.isEntityNameExpression(typeRefNode.expression)) {\n                        error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments);\n                    }\n                    checkTypeReferenceNode(typeRefNode);\n                    if (produceDiagnostics) {\n                        var t = getTypeFromTypeNode(typeRefNode);\n                        if (t !== unknownType) {\n                            var declaredType = getObjectFlags(t) & 4 ? t.target : t;\n                            if (getObjectFlags(declaredType) & 3) {\n                                checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1);\n                            }\n                            else {\n                                error(typeRefNode, ts.Diagnostics.A_class_may_only_implement_another_class_or_interface);\n                            }\n                        }\n                    }\n                }\n            }\n            if (produceDiagnostics) {\n                checkIndexConstraints(type);\n                checkTypeForDuplicateIndexSignatures(node);\n            }\n        }\n        function checkBaseTypeAccessibility(type, node) {\n            var signatures = getSignaturesOfType(type, 1);\n            if (signatures.length) {\n                var declaration = signatures[0].declaration;\n                if (declaration && ts.getModifierFlags(declaration) & 8) {\n                    var typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol);\n                    if (!isNodeWithinClass(node, typeClassDeclaration)) {\n                        error(node, ts.Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol));\n                    }\n                }\n            }\n        }\n        function getTargetSymbol(s) {\n            return s.flags & 16777216 ? getSymbolLinks(s).target : s;\n        }\n        function getClassLikeDeclarationOfSymbol(symbol) {\n            return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; });\n        }\n        function checkKindsOfPropertyMemberOverrides(type, baseType) {\n            var baseProperties = getPropertiesOfObjectType(baseType);\n            for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {\n                var baseProperty = baseProperties_1[_i];\n                var base = getTargetSymbol(baseProperty);\n                if (base.flags & 134217728) {\n                    continue;\n                }\n                var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name));\n                var baseDeclarationFlags = getDeclarationModifierFlagsFromSymbol(base);\n                ts.Debug.assert(!!derived, \"derived should point to something, even if it is the base class' declaration.\");\n                if (derived) {\n                    if (derived === base) {\n                        var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol);\n                        if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128))) {\n                            if (derivedClassDecl.kind === 197) {\n                                error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));\n                            }\n                            else {\n                                error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType));\n                            }\n                        }\n                    }\n                    else {\n                        var derivedDeclarationFlags = getDeclarationModifierFlagsFromSymbol(derived);\n                        if ((baseDeclarationFlags & 8) || (derivedDeclarationFlags & 8)) {\n                            continue;\n                        }\n                        if ((baseDeclarationFlags & 32) !== (derivedDeclarationFlags & 32)) {\n                            continue;\n                        }\n                        if ((base.flags & derived.flags & 8192) || ((base.flags & 98308) && (derived.flags & 98308))) {\n                            continue;\n                        }\n                        var errorMessage = void 0;\n                        if (base.flags & 8192) {\n                            if (derived.flags & 98304) {\n                                errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;\n                            }\n                            else {\n                                ts.Debug.assert((derived.flags & 4) !== 0);\n                                errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property;\n                            }\n                        }\n                        else if (base.flags & 4) {\n                            ts.Debug.assert((derived.flags & 8192) !== 0);\n                            errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;\n                        }\n                        else {\n                            ts.Debug.assert((base.flags & 98304) !== 0);\n                            ts.Debug.assert((derived.flags & 8192) !== 0);\n                            errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;\n                        }\n                        error(derived.valueDeclaration.name, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));\n                    }\n                }\n            }\n        }\n        function isAccessor(kind) {\n            return kind === 151 || kind === 152;\n        }\n        function areTypeParametersIdentical(list1, list2) {\n            if (!list1 && !list2) {\n                return true;\n            }\n            if (!list1 || !list2 || list1.length !== list2.length) {\n                return false;\n            }\n            for (var i = 0, len = list1.length; i < len; i++) {\n                var tp1 = list1[i];\n                var tp2 = list2[i];\n                if (tp1.name.text !== tp2.name.text) {\n                    return false;\n                }\n                if (!tp1.constraint && !tp2.constraint) {\n                    continue;\n                }\n                if (!tp1.constraint || !tp2.constraint) {\n                    return false;\n                }\n                if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) {\n                    return false;\n                }\n            }\n            return true;\n        }\n        function checkInheritedPropertiesAreIdentical(type, typeNode) {\n            var baseTypes = getBaseTypes(type);\n            if (baseTypes.length < 2) {\n                return true;\n            }\n            var seen = ts.createMap();\n            ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; });\n            var ok = true;\n            for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) {\n                var base = baseTypes_2[_i];\n                var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType));\n                for (var _a = 0, properties_7 = properties; _a < properties_7.length; _a++) {\n                    var prop = properties_7[_a];\n                    var existing = seen[prop.name];\n                    if (!existing) {\n                        seen[prop.name] = { prop: prop, containingType: base };\n                    }\n                    else {\n                        var isInheritedProperty = existing.containingType !== type;\n                        if (isInheritedProperty && !isPropertyIdenticalTo(existing.prop, prop)) {\n                            ok = false;\n                            var typeName1 = typeToString(existing.containingType);\n                            var typeName2 = typeToString(base);\n                            var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2);\n                            errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2);\n                            diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo));\n                        }\n                    }\n                }\n            }\n            return ok;\n        }\n        function checkInterfaceDeclaration(node) {\n            checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarInterfaceDeclaration(node);\n            checkTypeParameters(node.typeParameters);\n            if (produceDiagnostics) {\n                checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0);\n                checkExportsOnMergedDeclarations(node);\n                var symbol = getSymbolOfNode(node);\n                checkTypeParameterListsIdentical(node, symbol);\n                var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 227);\n                if (node === firstInterfaceDecl) {\n                    var type = getDeclaredTypeOfSymbol(symbol);\n                    var typeWithThis = getTypeWithThisArgument(type);\n                    if (checkInheritedPropertiesAreIdentical(type, node.name)) {\n                        for (var _i = 0, _a = getBaseTypes(type); _i < _a.length; _i++) {\n                            var baseType = _a[_i];\n                            checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1);\n                        }\n                        checkIndexConstraints(type);\n                    }\n                }\n                checkObjectTypeForDuplicateDeclarations(node);\n            }\n            ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) {\n                if (!ts.isEntityNameExpression(heritageElement.expression)) {\n                    error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments);\n                }\n                checkTypeReferenceNode(heritageElement);\n            });\n            ts.forEach(node.members, checkSourceElement);\n            if (produceDiagnostics) {\n                checkTypeForDuplicateIndexSignatures(node);\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkTypeAliasDeclaration(node) {\n            checkGrammarDecorators(node) || checkGrammarModifiers(node);\n            checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0);\n            checkTypeParameters(node.typeParameters);\n            checkSourceElement(node.type);\n        }\n        function computeEnumMemberValues(node) {\n            var nodeLinks = getNodeLinks(node);\n            if (!(nodeLinks.flags & 16384)) {\n                var enumSymbol = getSymbolOfNode(node);\n                var enumType = getDeclaredTypeOfSymbol(enumSymbol);\n                var autoValue = 0;\n                var ambient = ts.isInAmbientContext(node);\n                var enumIsConst = ts.isConst(node);\n                for (var _i = 0, _a = node.members; _i < _a.length; _i++) {\n                    var member = _a[_i];\n                    if (isComputedNonLiteralName(member.name)) {\n                        error(member.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums);\n                    }\n                    else {\n                        var text = ts.getTextOfPropertyName(member.name);\n                        if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {\n                            error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name);\n                        }\n                    }\n                    var previousEnumMemberIsNonConstant = autoValue === undefined;\n                    var initializer = member.initializer;\n                    if (initializer) {\n                        autoValue = computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient);\n                    }\n                    else if (ambient && !enumIsConst) {\n                        autoValue = undefined;\n                    }\n                    else if (previousEnumMemberIsNonConstant) {\n                        error(member.name, ts.Diagnostics.Enum_member_must_have_initializer);\n                    }\n                    if (autoValue !== undefined) {\n                        getNodeLinks(member).enumMemberValue = autoValue;\n                        autoValue++;\n                    }\n                }\n                nodeLinks.flags |= 16384;\n            }\n            function computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient) {\n                var reportError = true;\n                var value = evalConstant(initializer);\n                if (reportError) {\n                    if (value === undefined) {\n                        if (enumIsConst) {\n                            error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression);\n                        }\n                        else if (ambient) {\n                            error(initializer, ts.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);\n                        }\n                        else {\n                            checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, undefined);\n                        }\n                    }\n                    else if (enumIsConst) {\n                        if (isNaN(value)) {\n                            error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN);\n                        }\n                        else if (!isFinite(value)) {\n                            error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value);\n                        }\n                    }\n                }\n                return value;\n                function evalConstant(e) {\n                    switch (e.kind) {\n                        case 190:\n                            var value_1 = evalConstant(e.operand);\n                            if (value_1 === undefined) {\n                                return undefined;\n                            }\n                            switch (e.operator) {\n                                case 36: return value_1;\n                                case 37: return -value_1;\n                                case 51: return ~value_1;\n                            }\n                            return undefined;\n                        case 192:\n                            var left = evalConstant(e.left);\n                            if (left === undefined) {\n                                return undefined;\n                            }\n                            var right = evalConstant(e.right);\n                            if (right === undefined) {\n                                return undefined;\n                            }\n                            switch (e.operatorToken.kind) {\n                                case 48: return left | right;\n                                case 47: return left & right;\n                                case 45: return left >> right;\n                                case 46: return left >>> right;\n                                case 44: return left << right;\n                                case 49: return left ^ right;\n                                case 38: return left * right;\n                                case 40: return left / right;\n                                case 36: return left + right;\n                                case 37: return left - right;\n                                case 41: return left % right;\n                            }\n                            return undefined;\n                        case 8:\n                            return +e.text;\n                        case 183:\n                            return evalConstant(e.expression);\n                        case 70:\n                        case 178:\n                        case 177:\n                            var member = initializer.parent;\n                            var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent));\n                            var enumType_1;\n                            var propertyName = void 0;\n                            if (e.kind === 70) {\n                                enumType_1 = currentType;\n                                propertyName = e.text;\n                            }\n                            else {\n                                var expression = void 0;\n                                if (e.kind === 178) {\n                                    if (e.argumentExpression === undefined ||\n                                        e.argumentExpression.kind !== 9) {\n                                        return undefined;\n                                    }\n                                    expression = e.expression;\n                                    propertyName = e.argumentExpression.text;\n                                }\n                                else {\n                                    expression = e.expression;\n                                    propertyName = e.name.text;\n                                }\n                                var current = expression;\n                                while (current) {\n                                    if (current.kind === 70) {\n                                        break;\n                                    }\n                                    else if (current.kind === 177) {\n                                        current = current.expression;\n                                    }\n                                    else {\n                                        return undefined;\n                                    }\n                                }\n                                enumType_1 = getTypeOfExpression(expression);\n                                if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384))) {\n                                    return undefined;\n                                }\n                            }\n                            if (propertyName === undefined) {\n                                return undefined;\n                            }\n                            var property = getPropertyOfObjectType(enumType_1, propertyName);\n                            if (!property || !(property.flags & 8)) {\n                                return undefined;\n                            }\n                            var propertyDecl = property.valueDeclaration;\n                            if (member === propertyDecl) {\n                                return undefined;\n                            }\n                            if (!isBlockScopedNameDeclaredBeforeUse(propertyDecl, member)) {\n                                reportError = false;\n                                error(e, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);\n                                return undefined;\n                            }\n                            return getNodeLinks(propertyDecl).enumMemberValue;\n                    }\n                }\n            }\n        }\n        function checkEnumDeclaration(node) {\n            if (!produceDiagnostics) {\n                return;\n            }\n            checkGrammarDecorators(node) || checkGrammarModifiers(node);\n            checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0);\n            checkCollisionWithCapturedThisVariable(node, node.name);\n            checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n            checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n            checkExportsOnMergedDeclarations(node);\n            computeEnumMemberValues(node);\n            var enumIsConst = ts.isConst(node);\n            if (compilerOptions.isolatedModules && enumIsConst && ts.isInAmbientContext(node)) {\n                error(node.name, ts.Diagnostics.Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided);\n            }\n            var enumSymbol = getSymbolOfNode(node);\n            var firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind);\n            if (node === firstDeclaration) {\n                if (enumSymbol.declarations.length > 1) {\n                    ts.forEach(enumSymbol.declarations, function (decl) {\n                        if (ts.isConstEnumDeclaration(decl) !== enumIsConst) {\n                            error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const);\n                        }\n                    });\n                }\n                var seenEnumMissingInitialInitializer_1 = false;\n                ts.forEach(enumSymbol.declarations, function (declaration) {\n                    if (declaration.kind !== 229) {\n                        return false;\n                    }\n                    var enumDeclaration = declaration;\n                    if (!enumDeclaration.members.length) {\n                        return false;\n                    }\n                    var firstEnumMember = enumDeclaration.members[0];\n                    if (!firstEnumMember.initializer) {\n                        if (seenEnumMissingInitialInitializer_1) {\n                            error(firstEnumMember.name, ts.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element);\n                        }\n                        else {\n                            seenEnumMissingInitialInitializer_1 = true;\n                        }\n                    }\n                });\n            }\n        }\n        function getFirstNonAmbientClassOrFunctionDeclaration(symbol) {\n            var declarations = symbol.declarations;\n            for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {\n                var declaration = declarations_5[_i];\n                if ((declaration.kind === 226 ||\n                    (declaration.kind === 225 && ts.nodeIsPresent(declaration.body))) &&\n                    !ts.isInAmbientContext(declaration)) {\n                    return declaration;\n                }\n            }\n            return undefined;\n        }\n        function inSameLexicalScope(node1, node2) {\n            var container1 = ts.getEnclosingBlockScopeContainer(node1);\n            var container2 = ts.getEnclosingBlockScopeContainer(node2);\n            if (isGlobalSourceFile(container1)) {\n                return isGlobalSourceFile(container2);\n            }\n            else if (isGlobalSourceFile(container2)) {\n                return false;\n            }\n            else {\n                return container1 === container2;\n            }\n        }\n        function checkModuleDeclaration(node) {\n            if (produceDiagnostics) {\n                var isGlobalAugmentation = ts.isGlobalScopeAugmentation(node);\n                var inAmbientContext = ts.isInAmbientContext(node);\n                if (isGlobalAugmentation && !inAmbientContext) {\n                    error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context);\n                }\n                var isAmbientExternalModule = ts.isAmbientModule(node);\n                var contextErrorMessage = isAmbientExternalModule\n                    ? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file\n                    : ts.Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module;\n                if (checkGrammarModuleElementContext(node, contextErrorMessage)) {\n                    return;\n                }\n                if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node)) {\n                    if (!inAmbientContext && node.name.kind === 9) {\n                        grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names);\n                    }\n                }\n                if (ts.isIdentifier(node.name)) {\n                    checkCollisionWithCapturedThisVariable(node, node.name);\n                    checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n                    checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n                }\n                checkExportsOnMergedDeclarations(node);\n                var symbol = getSymbolOfNode(node);\n                if (symbol.flags & 512\n                    && symbol.declarations.length > 1\n                    && !inAmbientContext\n                    && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules)) {\n                    var firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);\n                    if (firstNonAmbientClassOrFunc) {\n                        if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(firstNonAmbientClassOrFunc)) {\n                            error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged);\n                        }\n                        else if (node.pos < firstNonAmbientClassOrFunc.pos) {\n                            error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);\n                        }\n                    }\n                    var mergedClass = ts.getDeclarationOfKind(symbol, 226);\n                    if (mergedClass &&\n                        inSameLexicalScope(node, mergedClass)) {\n                        getNodeLinks(node).flags |= 32768;\n                    }\n                }\n                if (isAmbientExternalModule) {\n                    if (ts.isExternalModuleAugmentation(node)) {\n                        var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 33554432);\n                        if (checkBody && node.body) {\n                            for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) {\n                                var statement = _a[_i];\n                                checkModuleAugmentationElement(statement, isGlobalAugmentation);\n                            }\n                        }\n                    }\n                    else if (isGlobalSourceFile(node.parent)) {\n                        if (isGlobalAugmentation) {\n                            error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);\n                        }\n                        else if (ts.isExternalModuleNameRelative(node.name.text)) {\n                            error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name);\n                        }\n                    }\n                    else {\n                        if (isGlobalAugmentation) {\n                            error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);\n                        }\n                        else {\n                            error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces);\n                        }\n                    }\n                }\n            }\n            if (node.body) {\n                checkSourceElement(node.body);\n                if (!ts.isGlobalScopeAugmentation(node)) {\n                    registerForUnusedIdentifiersCheck(node);\n                }\n            }\n        }\n        function checkModuleAugmentationElement(node, isGlobalAugmentation) {\n            switch (node.kind) {\n                case 205:\n                    for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                        var decl = _a[_i];\n                        checkModuleAugmentationElement(decl, isGlobalAugmentation);\n                    }\n                    break;\n                case 240:\n                case 241:\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);\n                    break;\n                case 234:\n                case 235:\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);\n                    break;\n                case 174:\n                case 223:\n                    var name_27 = node.name;\n                    if (ts.isBindingPattern(name_27)) {\n                        for (var _b = 0, _c = name_27.elements; _b < _c.length; _b++) {\n                            var el = _c[_b];\n                            checkModuleAugmentationElement(el, isGlobalAugmentation);\n                        }\n                        break;\n                    }\n                case 226:\n                case 229:\n                case 225:\n                case 227:\n                case 230:\n                case 228:\n                    if (isGlobalAugmentation) {\n                        return;\n                    }\n                    var symbol = getSymbolOfNode(node);\n                    if (symbol) {\n                        var reportError = !(symbol.flags & 33554432);\n                        if (!reportError) {\n                            reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]);\n                        }\n                    }\n                    break;\n            }\n        }\n        function getFirstIdentifier(node) {\n            switch (node.kind) {\n                case 70:\n                    return node;\n                case 141:\n                    do {\n                        node = node.left;\n                    } while (node.kind !== 70);\n                    return node;\n                case 177:\n                    do {\n                        node = node.expression;\n                    } while (node.kind !== 70);\n                    return node;\n            }\n        }\n        function checkExternalImportOrExportDeclaration(node) {\n            var moduleName = ts.getExternalModuleName(node);\n            if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 9) {\n                error(moduleName, ts.Diagnostics.String_literal_expected);\n                return false;\n            }\n            var inAmbientExternalModule = node.parent.kind === 231 && ts.isAmbientModule(node.parent.parent);\n            if (node.parent.kind !== 261 && !inAmbientExternalModule) {\n                error(moduleName, node.kind === 241 ?\n                    ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace :\n                    ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);\n                return false;\n            }\n            if (inAmbientExternalModule && ts.isExternalModuleNameRelative(moduleName.text)) {\n                if (!isTopLevelInExternalModuleAugmentation(node)) {\n                    error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name);\n                    return false;\n                }\n            }\n            return true;\n        }\n        function checkAliasSymbol(node) {\n            var symbol = getSymbolOfNode(node);\n            var target = resolveAlias(symbol);\n            if (target !== unknownSymbol) {\n                var excludedMeanings = (symbol.flags & (107455 | 1048576) ? 107455 : 0) |\n                    (symbol.flags & 793064 ? 793064 : 0) |\n                    (symbol.flags & 1920 ? 1920 : 0);\n                if (target.flags & excludedMeanings) {\n                    var message = node.kind === 243 ?\n                        ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :\n                        ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;\n                    error(node, message, symbolToString(symbol));\n                }\n            }\n        }\n        function checkImportBinding(node) {\n            checkCollisionWithCapturedThisVariable(node, node.name);\n            checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n            checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n            checkAliasSymbol(node);\n        }\n        function checkImportDeclaration(node) {\n            if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) {\n                return;\n            }\n            if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) {\n                grammarErrorOnFirstToken(node, ts.Diagnostics.An_import_declaration_cannot_have_modifiers);\n            }\n            if (checkExternalImportOrExportDeclaration(node)) {\n                var importClause = node.importClause;\n                if (importClause) {\n                    if (importClause.name) {\n                        checkImportBinding(importClause);\n                    }\n                    if (importClause.namedBindings) {\n                        if (importClause.namedBindings.kind === 237) {\n                            checkImportBinding(importClause.namedBindings);\n                        }\n                        else {\n                            ts.forEach(importClause.namedBindings.elements, checkImportBinding);\n                        }\n                    }\n                }\n            }\n        }\n        function checkImportEqualsDeclaration(node) {\n            if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) {\n                return;\n            }\n            checkGrammarDecorators(node) || checkGrammarModifiers(node);\n            if (ts.isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {\n                checkImportBinding(node);\n                if (ts.getModifierFlags(node) & 1) {\n                    markExportAsReferenced(node);\n                }\n                if (ts.isInternalModuleImportEqualsDeclaration(node)) {\n                    var target = resolveAlias(getSymbolOfNode(node));\n                    if (target !== unknownSymbol) {\n                        if (target.flags & 107455) {\n                            var moduleName = getFirstIdentifier(node.moduleReference);\n                            if (!(resolveEntityName(moduleName, 107455 | 1920).flags & 1920)) {\n                                error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName));\n                            }\n                        }\n                        if (target.flags & 793064) {\n                            checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0);\n                        }\n                    }\n                }\n                else {\n                    if (modulekind === ts.ModuleKind.ES2015 && !ts.isInAmbientContext(node)) {\n                        grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);\n                    }\n                }\n            }\n        }\n        function checkExportDeclaration(node) {\n            if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module)) {\n                return;\n            }\n            if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) {\n                grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers);\n            }\n            if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) {\n                if (node.exportClause) {\n                    ts.forEach(node.exportClause.elements, checkExportSpecifier);\n                    var inAmbientExternalModule = node.parent.kind === 231 && ts.isAmbientModule(node.parent.parent);\n                    if (node.parent.kind !== 261 && !inAmbientExternalModule) {\n                        error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);\n                    }\n                }\n                else {\n                    var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);\n                    if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) {\n                        error(node.moduleSpecifier, ts.Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));\n                    }\n                }\n            }\n        }\n        function checkGrammarModuleElementContext(node, errorMessage) {\n            var isInAppropriateContext = node.parent.kind === 261 || node.parent.kind === 231 || node.parent.kind === 230;\n            if (!isInAppropriateContext) {\n                grammarErrorOnFirstToken(node, errorMessage);\n            }\n            return !isInAppropriateContext;\n        }\n        function checkExportSpecifier(node) {\n            checkAliasSymbol(node);\n            if (!node.parent.parent.moduleSpecifier) {\n                var exportedName = node.propertyName || node.name;\n                var symbol = resolveName(exportedName, exportedName.text, 107455 | 793064 | 1920 | 8388608, undefined, undefined);\n                if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {\n                    error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, exportedName.text);\n                }\n                else {\n                    markExportAsReferenced(node);\n                }\n            }\n        }\n        function checkExportAssignment(node) {\n            if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) {\n                return;\n            }\n            var container = node.parent.kind === 261 ? node.parent : node.parent.parent;\n            if (container.kind === 230 && !ts.isAmbientModule(container)) {\n                error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);\n                return;\n            }\n            if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) {\n                grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);\n            }\n            if (node.expression.kind === 70) {\n                markExportAsReferenced(node);\n            }\n            else {\n                checkExpressionCached(node.expression);\n            }\n            checkExternalModuleExports(container);\n            if (node.isExportEquals && !ts.isInAmbientContext(node)) {\n                if (modulekind === ts.ModuleKind.ES2015) {\n                    grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_default_or_another_module_format_instead);\n                }\n                else if (modulekind === ts.ModuleKind.System) {\n                    grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);\n                }\n            }\n        }\n        function hasExportedMembers(moduleSymbol) {\n            for (var id in moduleSymbol.exports) {\n                if (id !== \"export=\") {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function checkExternalModuleExports(node) {\n            var moduleSymbol = getSymbolOfNode(node);\n            var links = getSymbolLinks(moduleSymbol);\n            if (!links.exportsChecked) {\n                var exportEqualsSymbol = moduleSymbol.exports[\"export=\"];\n                if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) {\n                    var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration;\n                    if (!isTopLevelInExternalModuleAugmentation(declaration)) {\n                        error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);\n                    }\n                }\n                var exports_1 = getExportsOfModule(moduleSymbol);\n                for (var id in exports_1) {\n                    if (id === \"__export\") {\n                        continue;\n                    }\n                    var _a = exports_1[id], declarations = _a.declarations, flags = _a.flags;\n                    if (flags & (1920 | 64 | 384)) {\n                        continue;\n                    }\n                    var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload);\n                    if (flags & 524288 && exportedDeclarationsCount <= 2) {\n                        continue;\n                    }\n                    if (exportedDeclarationsCount > 1) {\n                        for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {\n                            var declaration = declarations_6[_i];\n                            if (isNotOverload(declaration)) {\n                                diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, id));\n                            }\n                        }\n                    }\n                }\n                links.exportsChecked = true;\n            }\n            function isNotOverload(declaration) {\n                return (declaration.kind !== 225 && declaration.kind !== 149) ||\n                    !!declaration.body;\n            }\n        }\n        function checkSourceElement(node) {\n            if (!node) {\n                return;\n            }\n            var kind = node.kind;\n            if (cancellationToken) {\n                switch (kind) {\n                    case 230:\n                    case 226:\n                    case 227:\n                    case 225:\n                        cancellationToken.throwIfCancellationRequested();\n                }\n            }\n            switch (kind) {\n                case 143:\n                    return checkTypeParameter(node);\n                case 144:\n                    return checkParameter(node);\n                case 147:\n                case 146:\n                    return checkPropertyDeclaration(node);\n                case 158:\n                case 159:\n                case 153:\n                case 154:\n                    return checkSignatureDeclaration(node);\n                case 155:\n                    return checkSignatureDeclaration(node);\n                case 149:\n                case 148:\n                    return checkMethodDeclaration(node);\n                case 150:\n                    return checkConstructorDeclaration(node);\n                case 151:\n                case 152:\n                    return checkAccessorDeclaration(node);\n                case 157:\n                    return checkTypeReferenceNode(node);\n                case 156:\n                    return checkTypePredicate(node);\n                case 160:\n                    return checkTypeQuery(node);\n                case 161:\n                    return checkTypeLiteral(node);\n                case 162:\n                    return checkArrayType(node);\n                case 163:\n                    return checkTupleType(node);\n                case 164:\n                case 165:\n                    return checkUnionOrIntersectionType(node);\n                case 166:\n                case 168:\n                    return checkSourceElement(node.type);\n                case 169:\n                    return checkIndexedAccessType(node);\n                case 170:\n                    return checkMappedType(node);\n                case 225:\n                    return checkFunctionDeclaration(node);\n                case 204:\n                case 231:\n                    return checkBlock(node);\n                case 205:\n                    return checkVariableStatement(node);\n                case 207:\n                    return checkExpressionStatement(node);\n                case 208:\n                    return checkIfStatement(node);\n                case 209:\n                    return checkDoStatement(node);\n                case 210:\n                    return checkWhileStatement(node);\n                case 211:\n                    return checkForStatement(node);\n                case 212:\n                    return checkForInStatement(node);\n                case 213:\n                    return checkForOfStatement(node);\n                case 214:\n                case 215:\n                    return checkBreakOrContinueStatement(node);\n                case 216:\n                    return checkReturnStatement(node);\n                case 217:\n                    return checkWithStatement(node);\n                case 218:\n                    return checkSwitchStatement(node);\n                case 219:\n                    return checkLabeledStatement(node);\n                case 220:\n                    return checkThrowStatement(node);\n                case 221:\n                    return checkTryStatement(node);\n                case 223:\n                    return checkVariableDeclaration(node);\n                case 174:\n                    return checkBindingElement(node);\n                case 226:\n                    return checkClassDeclaration(node);\n                case 227:\n                    return checkInterfaceDeclaration(node);\n                case 228:\n                    return checkTypeAliasDeclaration(node);\n                case 229:\n                    return checkEnumDeclaration(node);\n                case 230:\n                    return checkModuleDeclaration(node);\n                case 235:\n                    return checkImportDeclaration(node);\n                case 234:\n                    return checkImportEqualsDeclaration(node);\n                case 241:\n                    return checkExportDeclaration(node);\n                case 240:\n                    return checkExportAssignment(node);\n                case 206:\n                    checkGrammarStatementInAmbientContext(node);\n                    return;\n                case 222:\n                    checkGrammarStatementInAmbientContext(node);\n                    return;\n                case 244:\n                    return checkMissingDeclaration(node);\n            }\n        }\n        function checkNodeDeferred(node) {\n            if (deferredNodes) {\n                deferredNodes.push(node);\n            }\n        }\n        function checkDeferredNodes() {\n            for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) {\n                var node = deferredNodes_1[_i];\n                switch (node.kind) {\n                    case 184:\n                    case 185:\n                    case 149:\n                    case 148:\n                        checkFunctionExpressionOrObjectLiteralMethodDeferred(node);\n                        break;\n                    case 151:\n                    case 152:\n                        checkAccessorDeferred(node);\n                        break;\n                    case 197:\n                        checkClassExpressionDeferred(node);\n                        break;\n                }\n            }\n        }\n        function checkSourceFile(node) {\n            ts.performance.mark(\"beforeCheck\");\n            checkSourceFileWorker(node);\n            ts.performance.mark(\"afterCheck\");\n            ts.performance.measure(\"Check\", \"beforeCheck\", \"afterCheck\");\n        }\n        function checkSourceFileWorker(node) {\n            var links = getNodeLinks(node);\n            if (!(links.flags & 1)) {\n                if (compilerOptions.skipLibCheck && node.isDeclarationFile || compilerOptions.skipDefaultLibCheck && node.hasNoDefaultLib) {\n                    return;\n                }\n                checkGrammarSourceFile(node);\n                potentialThisCollisions.length = 0;\n                deferredNodes = [];\n                deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined;\n                ts.forEach(node.statements, checkSourceElement);\n                checkDeferredNodes();\n                if (ts.isExternalModule(node)) {\n                    registerForUnusedIdentifiersCheck(node);\n                }\n                if (!node.isDeclarationFile) {\n                    checkUnusedIdentifiers();\n                }\n                deferredNodes = undefined;\n                deferredUnusedIdentifierNodes = undefined;\n                if (ts.isExternalOrCommonJsModule(node)) {\n                    checkExternalModuleExports(node);\n                }\n                if (potentialThisCollisions.length) {\n                    ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope);\n                    potentialThisCollisions.length = 0;\n                }\n                links.flags |= 1;\n            }\n        }\n        function getDiagnostics(sourceFile, ct) {\n            try {\n                cancellationToken = ct;\n                return getDiagnosticsWorker(sourceFile);\n            }\n            finally {\n                cancellationToken = undefined;\n            }\n        }\n        function getDiagnosticsWorker(sourceFile) {\n            throwIfNonDiagnosticsProducing();\n            if (sourceFile) {\n                var previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics();\n                var previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length;\n                checkSourceFile(sourceFile);\n                var semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);\n                var currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics();\n                if (currentGlobalDiagnostics !== previousGlobalDiagnostics) {\n                    var deferredGlobalDiagnostics = ts.relativeComplement(previousGlobalDiagnostics, currentGlobalDiagnostics, ts.compareDiagnostics);\n                    return ts.concatenate(deferredGlobalDiagnostics, semanticDiagnostics);\n                }\n                else if (previousGlobalDiagnosticsSize === 0 && currentGlobalDiagnostics.length > 0) {\n                    return ts.concatenate(currentGlobalDiagnostics, semanticDiagnostics);\n                }\n                return semanticDiagnostics;\n            }\n            ts.forEach(host.getSourceFiles(), checkSourceFile);\n            return diagnostics.getDiagnostics();\n        }\n        function getGlobalDiagnostics() {\n            throwIfNonDiagnosticsProducing();\n            return diagnostics.getGlobalDiagnostics();\n        }\n        function throwIfNonDiagnosticsProducing() {\n            if (!produceDiagnostics) {\n                throw new Error(\"Trying to get diagnostics from a type checker that does not produce them.\");\n            }\n        }\n        function isInsideWithStatementBody(node) {\n            if (node) {\n                while (node.parent) {\n                    if (node.parent.kind === 217 && node.parent.statement === node) {\n                        return true;\n                    }\n                    node = node.parent;\n                }\n            }\n            return false;\n        }\n        function getSymbolsInScope(location, meaning) {\n            var symbols = ts.createMap();\n            var memberFlags = 0;\n            if (isInsideWithStatementBody(location)) {\n                return [];\n            }\n            populateSymbols();\n            return symbolsToArray(symbols);\n            function populateSymbols() {\n                while (location) {\n                    if (location.locals && !isGlobalSourceFile(location)) {\n                        copySymbols(location.locals, meaning);\n                    }\n                    switch (location.kind) {\n                        case 261:\n                            if (!ts.isExternalOrCommonJsModule(location)) {\n                                break;\n                            }\n                        case 230:\n                            copySymbols(getSymbolOfNode(location).exports, meaning & 8914931);\n                            break;\n                        case 229:\n                            copySymbols(getSymbolOfNode(location).exports, meaning & 8);\n                            break;\n                        case 197:\n                            var className = location.name;\n                            if (className) {\n                                copySymbol(location.symbol, meaning);\n                            }\n                        case 226:\n                        case 227:\n                            if (!(memberFlags & 32)) {\n                                copySymbols(getSymbolOfNode(location).members, meaning & 793064);\n                            }\n                            break;\n                        case 184:\n                            var funcName = location.name;\n                            if (funcName) {\n                                copySymbol(location.symbol, meaning);\n                            }\n                            break;\n                    }\n                    if (ts.introducesArgumentsExoticObject(location)) {\n                        copySymbol(argumentsSymbol, meaning);\n                    }\n                    memberFlags = ts.getModifierFlags(location);\n                    location = location.parent;\n                }\n                copySymbols(globals, meaning);\n            }\n            function copySymbol(symbol, meaning) {\n                if (symbol.flags & meaning) {\n                    var id = symbol.name;\n                    if (!symbols[id]) {\n                        symbols[id] = symbol;\n                    }\n                }\n            }\n            function copySymbols(source, meaning) {\n                if (meaning) {\n                    for (var id in source) {\n                        var symbol = source[id];\n                        copySymbol(symbol, meaning);\n                    }\n                }\n            }\n        }\n        function isTypeDeclarationName(name) {\n            return name.kind === 70 &&\n                isTypeDeclaration(name.parent) &&\n                name.parent.name === name;\n        }\n        function isTypeDeclaration(node) {\n            switch (node.kind) {\n                case 143:\n                case 226:\n                case 227:\n                case 228:\n                case 229:\n                    return true;\n            }\n        }\n        function isTypeReferenceIdentifier(entityName) {\n            var node = entityName;\n            while (node.parent && node.parent.kind === 141) {\n                node = node.parent;\n            }\n            return node.parent && (node.parent.kind === 157 || node.parent.kind === 272);\n        }\n        function isHeritageClauseElementIdentifier(entityName) {\n            var node = entityName;\n            while (node.parent && node.parent.kind === 177) {\n                node = node.parent;\n            }\n            return node.parent && node.parent.kind === 199;\n        }\n        function forEachEnclosingClass(node, callback) {\n            var result;\n            while (true) {\n                node = ts.getContainingClass(node);\n                if (!node)\n                    break;\n                if (result = callback(node))\n                    break;\n            }\n            return result;\n        }\n        function isNodeWithinClass(node, classDeclaration) {\n            return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; });\n        }\n        function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) {\n            while (nodeOnRightSide.parent.kind === 141) {\n                nodeOnRightSide = nodeOnRightSide.parent;\n            }\n            if (nodeOnRightSide.parent.kind === 234) {\n                return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent;\n            }\n            if (nodeOnRightSide.parent.kind === 240) {\n                return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent;\n            }\n            return undefined;\n        }\n        function isInRightSideOfImportOrExportAssignment(node) {\n            return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined;\n        }\n        function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) {\n            if (ts.isDeclarationName(entityName)) {\n                return getSymbolOfNode(entityName.parent);\n            }\n            if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 177) {\n                var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent);\n                switch (specialPropertyAssignmentKind) {\n                    case 1:\n                    case 3:\n                        return getSymbolOfNode(entityName.parent);\n                    case 4:\n                    case 2:\n                        return getSymbolOfNode(entityName.parent.parent);\n                    default:\n                }\n            }\n            if (entityName.parent.kind === 240 && ts.isEntityNameExpression(entityName)) {\n                return resolveEntityName(entityName, 107455 | 793064 | 1920 | 8388608);\n            }\n            if (entityName.kind !== 177 && isInRightSideOfImportOrExportAssignment(entityName)) {\n                var importEqualsDeclaration = ts.getAncestor(entityName, 234);\n                ts.Debug.assert(importEqualsDeclaration !== undefined);\n                return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, true);\n            }\n            if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {\n                entityName = entityName.parent;\n            }\n            if (isHeritageClauseElementIdentifier(entityName)) {\n                var meaning = 0;\n                if (entityName.parent.kind === 199) {\n                    meaning = 793064;\n                    if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {\n                        meaning |= 107455;\n                    }\n                }\n                else {\n                    meaning = 1920;\n                }\n                meaning |= 8388608;\n                return resolveEntityName(entityName, meaning);\n            }\n            else if (ts.isPartOfExpression(entityName)) {\n                if (ts.nodeIsMissing(entityName)) {\n                    return undefined;\n                }\n                if (entityName.kind === 70) {\n                    if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) {\n                        return getIntrinsicTagSymbol(entityName.parent);\n                    }\n                    return resolveEntityName(entityName, 107455, false, true);\n                }\n                else if (entityName.kind === 177) {\n                    var symbol = getNodeLinks(entityName).resolvedSymbol;\n                    if (!symbol) {\n                        checkPropertyAccessExpression(entityName);\n                    }\n                    return getNodeLinks(entityName).resolvedSymbol;\n                }\n                else if (entityName.kind === 141) {\n                    var symbol = getNodeLinks(entityName).resolvedSymbol;\n                    if (!symbol) {\n                        checkQualifiedName(entityName);\n                    }\n                    return getNodeLinks(entityName).resolvedSymbol;\n                }\n            }\n            else if (isTypeReferenceIdentifier(entityName)) {\n                var meaning = (entityName.parent.kind === 157 || entityName.parent.kind === 272) ? 793064 : 1920;\n                return resolveEntityName(entityName, meaning, false, true);\n            }\n            else if (entityName.parent.kind === 250) {\n                return getJsxAttributePropertySymbol(entityName.parent);\n            }\n            if (entityName.parent.kind === 156) {\n                return resolveEntityName(entityName, 1);\n            }\n            return undefined;\n        }\n        function getSymbolAtLocation(node) {\n            if (node.kind === 261) {\n                return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined;\n            }\n            if (isInsideWithStatementBody(node)) {\n                return undefined;\n            }\n            if (ts.isDeclarationName(node)) {\n                return getSymbolOfNode(node.parent);\n            }\n            else if (ts.isLiteralComputedPropertyDeclarationName(node)) {\n                return getSymbolOfNode(node.parent.parent);\n            }\n            if (node.kind === 70) {\n                if (isInRightSideOfImportOrExportAssignment(node)) {\n                    return getSymbolOfEntityNameOrPropertyAccessExpression(node);\n                }\n                else if (node.parent.kind === 174 &&\n                    node.parent.parent.kind === 172 &&\n                    node === node.parent.propertyName) {\n                    var typeOfPattern = getTypeOfNode(node.parent.parent);\n                    var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text);\n                    if (propertyDeclaration) {\n                        return propertyDeclaration;\n                    }\n                }\n            }\n            switch (node.kind) {\n                case 70:\n                case 177:\n                case 141:\n                    return getSymbolOfEntityNameOrPropertyAccessExpression(node);\n                case 98:\n                    var container = ts.getThisContainer(node, false);\n                    if (ts.isFunctionLike(container)) {\n                        var sig = getSignatureFromDeclaration(container);\n                        if (sig.thisParameter) {\n                            return sig.thisParameter;\n                        }\n                    }\n                case 96:\n                    var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node);\n                    return type.symbol;\n                case 167:\n                    return getTypeFromTypeNode(node).symbol;\n                case 122:\n                    var constructorDeclaration = node.parent;\n                    if (constructorDeclaration && constructorDeclaration.kind === 150) {\n                        return constructorDeclaration.parent.symbol;\n                    }\n                    return undefined;\n                case 9:\n                    if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) &&\n                        ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) ||\n                        ((node.parent.kind === 235 || node.parent.kind === 241) &&\n                            node.parent.moduleSpecifier === node)) {\n                        return resolveExternalModuleName(node, node);\n                    }\n                    if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node.parent, false)) {\n                        return resolveExternalModuleName(node, node);\n                    }\n                case 8:\n                    if (node.parent.kind === 178 && node.parent.argumentExpression === node) {\n                        var objectType = getTypeOfExpression(node.parent.expression);\n                        if (objectType === unknownType)\n                            return undefined;\n                        var apparentType = getApparentType(objectType);\n                        if (apparentType === unknownType)\n                            return undefined;\n                        return getPropertyOfType(apparentType, node.text);\n                    }\n                    break;\n            }\n            return undefined;\n        }\n        function getShorthandAssignmentValueSymbol(location) {\n            if (location && location.kind === 258) {\n                return resolveEntityName(location.name, 107455 | 8388608);\n            }\n            return undefined;\n        }\n        function getExportSpecifierLocalTargetSymbol(node) {\n            return node.parent.parent.moduleSpecifier ?\n                getExternalModuleMember(node.parent.parent, node) :\n                resolveEntityName(node.propertyName || node.name, 107455 | 793064 | 1920 | 8388608);\n        }\n        function getTypeOfNode(node) {\n            if (isInsideWithStatementBody(node)) {\n                return unknownType;\n            }\n            if (ts.isPartOfTypeNode(node)) {\n                return getTypeFromTypeNode(node);\n            }\n            if (ts.isPartOfExpression(node)) {\n                return getRegularTypeOfExpression(node);\n            }\n            if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) {\n                return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0];\n            }\n            if (isTypeDeclaration(node)) {\n                var symbol = getSymbolOfNode(node);\n                return getDeclaredTypeOfSymbol(symbol);\n            }\n            if (isTypeDeclarationName(node)) {\n                var symbol = getSymbolAtLocation(node);\n                return symbol && getDeclaredTypeOfSymbol(symbol);\n            }\n            if (ts.isDeclaration(node)) {\n                var symbol = getSymbolOfNode(node);\n                return getTypeOfSymbol(symbol);\n            }\n            if (ts.isDeclarationName(node)) {\n                var symbol = getSymbolAtLocation(node);\n                return symbol && getTypeOfSymbol(symbol);\n            }\n            if (ts.isBindingPattern(node)) {\n                return getTypeForVariableLikeDeclaration(node.parent, true);\n            }\n            if (isInRightSideOfImportOrExportAssignment(node)) {\n                var symbol = getSymbolAtLocation(node);\n                var declaredType = symbol && getDeclaredTypeOfSymbol(symbol);\n                return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol);\n            }\n            return unknownType;\n        }\n        function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) {\n            ts.Debug.assert(expr.kind === 176 || expr.kind === 175);\n            if (expr.parent.kind === 213) {\n                var iteratedType = checkRightHandSideOfForOf(expr.parent.expression);\n                return checkDestructuringAssignment(expr, iteratedType || unknownType);\n            }\n            if (expr.parent.kind === 192) {\n                var iteratedType = getTypeOfExpression(expr.parent.right);\n                return checkDestructuringAssignment(expr, iteratedType || unknownType);\n            }\n            if (expr.parent.kind === 257) {\n                var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent);\n                return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent);\n            }\n            ts.Debug.assert(expr.parent.kind === 175);\n            var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent);\n            var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false) || unknownType;\n            return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType);\n        }\n        function getPropertySymbolOfDestructuringAssignment(location) {\n            var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent);\n            return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text);\n        }\n        function getRegularTypeOfExpression(expr) {\n            if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) {\n                expr = expr.parent;\n            }\n            return getRegularTypeOfLiteralType(getTypeOfExpression(expr));\n        }\n        function getParentTypeOfClassElement(node) {\n            var classSymbol = getSymbolOfNode(node.parent);\n            return ts.getModifierFlags(node) & 32\n                ? getTypeOfSymbol(classSymbol)\n                : getDeclaredTypeOfSymbol(classSymbol);\n        }\n        function getAugmentedPropertiesOfType(type) {\n            type = getApparentType(type);\n            var propsByName = createSymbolTable(getPropertiesOfType(type));\n            if (getSignaturesOfType(type, 0).length || getSignaturesOfType(type, 1).length) {\n                ts.forEach(getPropertiesOfType(globalFunctionType), function (p) {\n                    if (!propsByName[p.name]) {\n                        propsByName[p.name] = p;\n                    }\n                });\n            }\n            return getNamedMembers(propsByName);\n        }\n        function getRootSymbols(symbol) {\n            if (symbol.flags & 268435456) {\n                var symbols_3 = [];\n                var name_28 = symbol.name;\n                ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) {\n                    var symbol = getPropertyOfType(t, name_28);\n                    if (symbol) {\n                        symbols_3.push(symbol);\n                    }\n                });\n                return symbols_3;\n            }\n            else if (symbol.flags & 67108864) {\n                if (symbol.leftSpread) {\n                    var links = symbol;\n                    return [links.leftSpread, links.rightSpread];\n                }\n                var target = void 0;\n                var next = symbol;\n                while (next = getSymbolLinks(next).target) {\n                    target = next;\n                }\n                if (target) {\n                    return [target];\n                }\n            }\n            return [symbol];\n        }\n        function isArgumentsLocalBinding(node) {\n            if (!ts.isGeneratedIdentifier(node)) {\n                node = ts.getParseTreeNode(node, ts.isIdentifier);\n                if (node) {\n                    return getReferencedValueSymbol(node) === argumentsSymbol;\n                }\n            }\n            return false;\n        }\n        function moduleExportsSomeValue(moduleReferenceExpression) {\n            var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);\n            if (!moduleSymbol || ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {\n                return true;\n            }\n            var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);\n            moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);\n            var symbolLinks = getSymbolLinks(moduleSymbol);\n            if (symbolLinks.exportsSomeValue === undefined) {\n                symbolLinks.exportsSomeValue = hasExportAssignment\n                    ? !!(moduleSymbol.flags & 107455)\n                    : ts.forEachProperty(getExportsOfModule(moduleSymbol), isValue);\n            }\n            return symbolLinks.exportsSomeValue;\n            function isValue(s) {\n                s = resolveSymbol(s);\n                return s && !!(s.flags & 107455);\n            }\n        }\n        function isNameOfModuleOrEnumDeclaration(node) {\n            var parent = node.parent;\n            return parent && ts.isModuleOrEnumDeclaration(parent) && node === parent.name;\n        }\n        function getReferencedExportContainer(node, prefixLocals) {\n            node = ts.getParseTreeNode(node, ts.isIdentifier);\n            if (node) {\n                var symbol = getReferencedValueSymbol(node, isNameOfModuleOrEnumDeclaration(node));\n                if (symbol) {\n                    if (symbol.flags & 1048576) {\n                        var exportSymbol = getMergedSymbol(symbol.exportSymbol);\n                        if (!prefixLocals && exportSymbol.flags & 944) {\n                            return undefined;\n                        }\n                        symbol = exportSymbol;\n                    }\n                    var parentSymbol = getParentOfSymbol(symbol);\n                    if (parentSymbol) {\n                        if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 261) {\n                            var symbolFile = parentSymbol.valueDeclaration;\n                            var referenceFile = ts.getSourceFileOfNode(node);\n                            var symbolIsUmdExport = symbolFile !== referenceFile;\n                            return symbolIsUmdExport ? undefined : symbolFile;\n                        }\n                        for (var n = node.parent; n; n = n.parent) {\n                            if (ts.isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol) {\n                                return n;\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        function getReferencedImportDeclaration(node) {\n            node = ts.getParseTreeNode(node, ts.isIdentifier);\n            if (node) {\n                var symbol = getReferencedValueSymbol(node);\n                if (symbol && symbol.flags & 8388608) {\n                    return getDeclarationOfAliasSymbol(symbol);\n                }\n            }\n            return undefined;\n        }\n        function isSymbolOfDeclarationWithCollidingName(symbol) {\n            if (symbol.flags & 418) {\n                var links = getSymbolLinks(symbol);\n                if (links.isDeclarationWithCollidingName === undefined) {\n                    var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);\n                    if (ts.isStatementWithLocals(container)) {\n                        var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration);\n                        if (!!resolveName(container.parent, symbol.name, 107455, undefined, undefined)) {\n                            links.isDeclarationWithCollidingName = true;\n                        }\n                        else if (nodeLinks_1.flags & 131072) {\n                            var isDeclaredInLoop = nodeLinks_1.flags & 262144;\n                            var inLoopInitializer = ts.isIterationStatement(container, false);\n                            var inLoopBodyBlock = container.kind === 204 && ts.isIterationStatement(container.parent, false);\n                            links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock));\n                        }\n                        else {\n                            links.isDeclarationWithCollidingName = false;\n                        }\n                    }\n                }\n                return links.isDeclarationWithCollidingName;\n            }\n            return false;\n        }\n        function getReferencedDeclarationWithCollidingName(node) {\n            if (!ts.isGeneratedIdentifier(node)) {\n                node = ts.getParseTreeNode(node, ts.isIdentifier);\n                if (node) {\n                    var symbol = getReferencedValueSymbol(node);\n                    if (symbol && isSymbolOfDeclarationWithCollidingName(symbol)) {\n                        return symbol.valueDeclaration;\n                    }\n                }\n            }\n            return undefined;\n        }\n        function isDeclarationWithCollidingName(node) {\n            node = ts.getParseTreeNode(node, ts.isDeclaration);\n            if (node) {\n                var symbol = getSymbolOfNode(node);\n                if (symbol) {\n                    return isSymbolOfDeclarationWithCollidingName(symbol);\n                }\n            }\n            return false;\n        }\n        function isValueAliasDeclaration(node) {\n            node = ts.getParseTreeNode(node);\n            if (node === undefined) {\n                return true;\n            }\n            switch (node.kind) {\n                case 234:\n                case 236:\n                case 237:\n                case 239:\n                case 243:\n                    return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol);\n                case 241:\n                    var exportClause = node.exportClause;\n                    return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration);\n                case 240:\n                    return node.expression\n                        && node.expression.kind === 70\n                        ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol)\n                        : true;\n            }\n            return false;\n        }\n        function isTopLevelValueImportEqualsWithEntityName(node) {\n            node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration);\n            if (node === undefined || node.parent.kind !== 261 || !ts.isInternalModuleImportEqualsDeclaration(node)) {\n                return false;\n            }\n            var isValue = isAliasResolvedToValue(getSymbolOfNode(node));\n            return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference);\n        }\n        function isAliasResolvedToValue(symbol) {\n            var target = resolveAlias(symbol);\n            if (target === unknownSymbol) {\n                return true;\n            }\n            return target.flags & 107455 &&\n                (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target));\n        }\n        function isConstEnumOrConstEnumOnlyModule(s) {\n            return isConstEnumSymbol(s) || s.constEnumOnlyModule;\n        }\n        function isReferencedAliasDeclaration(node, checkChildren) {\n            node = ts.getParseTreeNode(node);\n            if (node === undefined) {\n                return true;\n            }\n            if (ts.isAliasSymbolDeclaration(node)) {\n                var symbol = getSymbolOfNode(node);\n                if (symbol && getSymbolLinks(symbol).referenced) {\n                    return true;\n                }\n            }\n            if (checkChildren) {\n                return ts.forEachChild(node, function (node) { return isReferencedAliasDeclaration(node, checkChildren); });\n            }\n            return false;\n        }\n        function isImplementationOfOverload(node) {\n            if (ts.nodeIsPresent(node.body)) {\n                var symbol = getSymbolOfNode(node);\n                var signaturesOfSymbol = getSignaturesOfSymbol(symbol);\n                return signaturesOfSymbol.length > 1 ||\n                    (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node);\n            }\n            return false;\n        }\n        function getNodeCheckFlags(node) {\n            node = ts.getParseTreeNode(node);\n            return node ? getNodeLinks(node).flags : undefined;\n        }\n        function getEnumMemberValue(node) {\n            computeEnumMemberValues(node.parent);\n            return getNodeLinks(node).enumMemberValue;\n        }\n        function getConstantValue(node) {\n            if (node.kind === 260) {\n                return getEnumMemberValue(node);\n            }\n            var symbol = getNodeLinks(node).resolvedSymbol;\n            if (symbol && (symbol.flags & 8)) {\n                if (ts.isConstEnumDeclaration(symbol.valueDeclaration.parent)) {\n                    return getEnumMemberValue(symbol.valueDeclaration);\n                }\n            }\n            return undefined;\n        }\n        function isFunctionType(type) {\n            return type.flags & 32768 && getSignaturesOfType(type, 0).length > 0;\n        }\n        function getTypeReferenceSerializationKind(typeName, location) {\n            var valueSymbol = resolveEntityName(typeName, 107455, true, false, location);\n            var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol();\n            if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) {\n                return ts.TypeReferenceSerializationKind.Promise;\n            }\n            var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined;\n            if (constructorType && isConstructorType(constructorType)) {\n                return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue;\n            }\n            var typeSymbol = resolveEntityName(typeName, 793064, true, false, location);\n            if (!typeSymbol) {\n                return ts.TypeReferenceSerializationKind.ObjectType;\n            }\n            var type = getDeclaredTypeOfSymbol(typeSymbol);\n            if (type === unknownType) {\n                return ts.TypeReferenceSerializationKind.Unknown;\n            }\n            else if (type.flags & 1) {\n                return ts.TypeReferenceSerializationKind.ObjectType;\n            }\n            else if (isTypeOfKind(type, 1024 | 6144 | 8192)) {\n                return ts.TypeReferenceSerializationKind.VoidNullableOrNeverType;\n            }\n            else if (isTypeOfKind(type, 136)) {\n                return ts.TypeReferenceSerializationKind.BooleanType;\n            }\n            else if (isTypeOfKind(type, 340)) {\n                return ts.TypeReferenceSerializationKind.NumberLikeType;\n            }\n            else if (isTypeOfKind(type, 262178)) {\n                return ts.TypeReferenceSerializationKind.StringLikeType;\n            }\n            else if (isTupleType(type)) {\n                return ts.TypeReferenceSerializationKind.ArrayLikeType;\n            }\n            else if (isTypeOfKind(type, 512)) {\n                return ts.TypeReferenceSerializationKind.ESSymbolType;\n            }\n            else if (isFunctionType(type)) {\n                return ts.TypeReferenceSerializationKind.TypeWithCallSignature;\n            }\n            else if (isArrayType(type)) {\n                return ts.TypeReferenceSerializationKind.ArrayLikeType;\n            }\n            else {\n                return ts.TypeReferenceSerializationKind.ObjectType;\n            }\n        }\n        function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) {\n            var symbol = getSymbolOfNode(declaration);\n            var type = symbol && !(symbol.flags & (2048 | 131072))\n                ? getWidenedLiteralType(getTypeOfSymbol(symbol))\n                : unknownType;\n            getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);\n        }\n        function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) {\n            var signature = getSignatureFromDeclaration(signatureDeclaration);\n            getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags);\n        }\n        function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) {\n            var type = getWidenedType(getRegularTypeOfExpression(expr));\n            getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);\n        }\n        function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) {\n            var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node));\n            resolveBaseTypesOfClass(classType);\n            var baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType;\n            getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags);\n        }\n        function hasGlobalName(name) {\n            return !!globals[name];\n        }\n        function getReferencedValueSymbol(reference, startInDeclarationContainer) {\n            var resolvedSymbol = getNodeLinks(reference).resolvedSymbol;\n            if (resolvedSymbol) {\n                return resolvedSymbol;\n            }\n            var location = reference;\n            if (startInDeclarationContainer) {\n                var parent_11 = reference.parent;\n                if (ts.isDeclaration(parent_11) && reference === parent_11.name) {\n                    location = getDeclarationContainer(parent_11);\n                }\n            }\n            return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined);\n        }\n        function getReferencedValueDeclaration(reference) {\n            if (!ts.isGeneratedIdentifier(reference)) {\n                reference = ts.getParseTreeNode(reference, ts.isIdentifier);\n                if (reference) {\n                    var symbol = getReferencedValueSymbol(reference);\n                    if (symbol) {\n                        return getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration;\n                    }\n                }\n            }\n            return undefined;\n        }\n        function isLiteralConstDeclaration(node) {\n            if (ts.isConst(node)) {\n                var type = getTypeOfSymbol(getSymbolOfNode(node));\n                return !!(type.flags & 96 && type.flags & 1048576);\n            }\n            return false;\n        }\n        function writeLiteralConstValue(node, writer) {\n            var type = getTypeOfSymbol(getSymbolOfNode(node));\n            writer.writeStringLiteral(literalTypeToString(type));\n        }\n        function createResolver() {\n            var resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives();\n            var fileToDirective;\n            if (resolvedTypeReferenceDirectives) {\n                fileToDirective = ts.createFileMap();\n                for (var key in resolvedTypeReferenceDirectives) {\n                    var resolvedDirective = resolvedTypeReferenceDirectives[key];\n                    if (!resolvedDirective) {\n                        continue;\n                    }\n                    var file = host.getSourceFile(resolvedDirective.resolvedFileName);\n                    fileToDirective.set(file.path, key);\n                }\n            }\n            return {\n                getReferencedExportContainer: getReferencedExportContainer,\n                getReferencedImportDeclaration: getReferencedImportDeclaration,\n                getReferencedDeclarationWithCollidingName: getReferencedDeclarationWithCollidingName,\n                isDeclarationWithCollidingName: isDeclarationWithCollidingName,\n                isValueAliasDeclaration: isValueAliasDeclaration,\n                hasGlobalName: hasGlobalName,\n                isReferencedAliasDeclaration: isReferencedAliasDeclaration,\n                getNodeCheckFlags: getNodeCheckFlags,\n                isTopLevelValueImportEqualsWithEntityName: isTopLevelValueImportEqualsWithEntityName,\n                isDeclarationVisible: isDeclarationVisible,\n                isImplementationOfOverload: isImplementationOfOverload,\n                writeTypeOfDeclaration: writeTypeOfDeclaration,\n                writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration,\n                writeTypeOfExpression: writeTypeOfExpression,\n                writeBaseConstructorTypeOfClass: writeBaseConstructorTypeOfClass,\n                isSymbolAccessible: isSymbolAccessible,\n                isEntityNameVisible: isEntityNameVisible,\n                getConstantValue: getConstantValue,\n                collectLinkedAliases: collectLinkedAliases,\n                getReferencedValueDeclaration: getReferencedValueDeclaration,\n                getTypeReferenceSerializationKind: getTypeReferenceSerializationKind,\n                isOptionalParameter: isOptionalParameter,\n                moduleExportsSomeValue: moduleExportsSomeValue,\n                isArgumentsLocalBinding: isArgumentsLocalBinding,\n                getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration,\n                getTypeReferenceDirectivesForEntityName: getTypeReferenceDirectivesForEntityName,\n                getTypeReferenceDirectivesForSymbol: getTypeReferenceDirectivesForSymbol,\n                isLiteralConstDeclaration: isLiteralConstDeclaration,\n                writeLiteralConstValue: writeLiteralConstValue,\n                getJsxFactoryEntity: function () { return _jsxFactoryEntity; }\n            };\n            function getTypeReferenceDirectivesForEntityName(node) {\n                if (!fileToDirective) {\n                    return undefined;\n                }\n                var meaning = (node.kind === 177) || (node.kind === 70 && isInTypeQuery(node))\n                    ? 107455 | 1048576\n                    : 793064 | 1920;\n                var symbol = resolveEntityName(node, meaning, true);\n                return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined;\n            }\n            function getTypeReferenceDirectivesForSymbol(symbol, meaning) {\n                if (!fileToDirective) {\n                    return undefined;\n                }\n                if (!isSymbolFromTypeDeclarationFile(symbol)) {\n                    return undefined;\n                }\n                var typeReferenceDirectives;\n                for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    if (decl.symbol && decl.symbol.flags & meaning) {\n                        var file = ts.getSourceFileOfNode(decl);\n                        var typeReferenceDirective = fileToDirective.get(file.path);\n                        if (typeReferenceDirective) {\n                            (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective);\n                        }\n                        else {\n                            return undefined;\n                        }\n                    }\n                }\n                return typeReferenceDirectives;\n            }\n            function isSymbolFromTypeDeclarationFile(symbol) {\n                if (!symbol.declarations) {\n                    return false;\n                }\n                var current = symbol;\n                while (true) {\n                    var parent_12 = getParentOfSymbol(current);\n                    if (parent_12) {\n                        current = parent_12;\n                    }\n                    else {\n                        break;\n                    }\n                }\n                if (current.valueDeclaration && current.valueDeclaration.kind === 261 && current.flags & 512) {\n                    return false;\n                }\n                for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    var file = ts.getSourceFileOfNode(decl);\n                    if (fileToDirective.contains(file.path)) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n        }\n        function getExternalModuleFileFromDeclaration(declaration) {\n            var specifier = ts.getExternalModuleName(declaration);\n            var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, undefined);\n            if (!moduleSymbol) {\n                return undefined;\n            }\n            return ts.getDeclarationOfKind(moduleSymbol, 261);\n        }\n        function initializeTypeChecker() {\n            for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) {\n                var file = _a[_i];\n                ts.bindSourceFile(file, compilerOptions);\n            }\n            var augmentations;\n            for (var _b = 0, _c = host.getSourceFiles(); _b < _c.length; _b++) {\n                var file = _c[_b];\n                if (!ts.isExternalOrCommonJsModule(file)) {\n                    mergeSymbolTable(globals, file.locals);\n                }\n                if (file.patternAmbientModules && file.patternAmbientModules.length) {\n                    patternAmbientModules = ts.concatenate(patternAmbientModules, file.patternAmbientModules);\n                }\n                if (file.moduleAugmentations.length) {\n                    (augmentations || (augmentations = [])).push(file.moduleAugmentations);\n                }\n                if (file.symbol && file.symbol.globalExports) {\n                    var source = file.symbol.globalExports;\n                    for (var id in source) {\n                        if (!(id in globals)) {\n                            globals[id] = source[id];\n                        }\n                    }\n                }\n            }\n            if (augmentations) {\n                for (var _d = 0, augmentations_1 = augmentations; _d < augmentations_1.length; _d++) {\n                    var list = augmentations_1[_d];\n                    for (var _e = 0, list_1 = list; _e < list_1.length; _e++) {\n                        var augmentation = list_1[_e];\n                        mergeModuleAugmentation(augmentation);\n                    }\n                }\n            }\n            addToSymbolTable(globals, builtinGlobals, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0);\n            getSymbolLinks(undefinedSymbol).type = undefinedWideningType;\n            getSymbolLinks(argumentsSymbol).type = getGlobalType(\"IArguments\");\n            getSymbolLinks(unknownSymbol).type = unknownType;\n            globalArrayType = getGlobalType(\"Array\", 1);\n            globalObjectType = getGlobalType(\"Object\");\n            globalFunctionType = getGlobalType(\"Function\");\n            globalStringType = getGlobalType(\"String\");\n            globalNumberType = getGlobalType(\"Number\");\n            globalBooleanType = getGlobalType(\"Boolean\");\n            globalRegExpType = getGlobalType(\"RegExp\");\n            jsxElementType = getExportedTypeFromNamespace(\"JSX\", JsxNames.Element);\n            getGlobalClassDecoratorType = ts.memoize(function () { return getGlobalType(\"ClassDecorator\"); });\n            getGlobalPropertyDecoratorType = ts.memoize(function () { return getGlobalType(\"PropertyDecorator\"); });\n            getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType(\"MethodDecorator\"); });\n            getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType(\"ParameterDecorator\"); });\n            getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType(\"TypedPropertyDescriptor\", 1); });\n            getGlobalESSymbolConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol(\"Symbol\"); });\n            getGlobalPromiseType = ts.memoize(function () { return getGlobalType(\"Promise\", 1); });\n            tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol(\"Promise\", 793064, undefined) && getGlobalPromiseType(); });\n            getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType(\"PromiseLike\", 1); });\n            getInstantiatedGlobalPromiseLikeType = ts.memoize(createInstantiatedPromiseLikeType);\n            getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol(\"Promise\"); });\n            tryGetGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalSymbol(\"Promise\", 107455, undefined) && getGlobalPromiseConstructorSymbol(); });\n            getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType(\"PromiseConstructorLike\"); });\n            getGlobalThenableType = ts.memoize(createThenableType);\n            getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType(\"TemplateStringsArray\"); });\n            if (languageVersion >= 2) {\n                getGlobalESSymbolType = ts.memoize(function () { return getGlobalType(\"Symbol\"); });\n                getGlobalIterableType = ts.memoize(function () { return getGlobalType(\"Iterable\", 1); });\n                getGlobalIteratorType = ts.memoize(function () { return getGlobalType(\"Iterator\", 1); });\n                getGlobalIterableIteratorType = ts.memoize(function () { return getGlobalType(\"IterableIterator\", 1); });\n            }\n            else {\n                getGlobalESSymbolType = ts.memoize(function () { return emptyObjectType; });\n                getGlobalIterableType = ts.memoize(function () { return emptyGenericType; });\n                getGlobalIteratorType = ts.memoize(function () { return emptyGenericType; });\n                getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; });\n            }\n            anyArrayType = createArrayType(anyType);\n            autoArrayType = createArrayType(autoType);\n            var symbol = getGlobalSymbol(\"ReadonlyArray\", 793064, undefined);\n            globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, 1);\n            anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType;\n        }\n        function checkExternalEmitHelpers(location, helpers) {\n            if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) {\n                var sourceFile = ts.getSourceFileOfNode(location);\n                if (ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {\n                    var helpersModule = resolveHelpersModule(sourceFile, location);\n                    if (helpersModule !== unknownSymbol) {\n                        var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers;\n                        for (var helper = 1; helper <= 128; helper <<= 1) {\n                            if (uncheckedHelpers & helper) {\n                                var name_29 = getHelperName(helper);\n                                var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name_29), 107455);\n                                if (!symbol) {\n                                    error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name_29);\n                                }\n                            }\n                        }\n                    }\n                    requestedExternalEmitHelpers |= helpers;\n                }\n            }\n        }\n        function getHelperName(helper) {\n            switch (helper) {\n                case 1: return \"__extends\";\n                case 2: return \"__assign\";\n                case 4: return \"__rest\";\n                case 8: return \"__decorate\";\n                case 16: return \"__metadata\";\n                case 32: return \"__param\";\n                case 64: return \"__awaiter\";\n                case 128: return \"__generator\";\n            }\n        }\n        function resolveHelpersModule(node, errorNode) {\n            if (!externalHelpersModule) {\n                externalHelpersModule = resolveExternalModule(node, ts.externalHelpersModuleNameText, ts.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol;\n            }\n            return externalHelpersModule;\n        }\n        function createInstantiatedPromiseLikeType() {\n            var promiseLikeType = getGlobalPromiseLikeType();\n            if (promiseLikeType !== emptyGenericType) {\n                return createTypeReference(promiseLikeType, [anyType]);\n            }\n            return emptyObjectType;\n        }\n        function createThenableType() {\n            var thenPropertySymbol = createSymbol(67108864 | 4, \"then\");\n            getSymbolLinks(thenPropertySymbol).type = globalFunctionType;\n            var thenableType = createObjectType(16);\n            thenableType.properties = [thenPropertySymbol];\n            thenableType.members = createSymbolTable(thenableType.properties);\n            thenableType.callSignatures = [];\n            thenableType.constructSignatures = [];\n            return thenableType;\n        }\n        function checkGrammarDecorators(node) {\n            if (!node.decorators) {\n                return false;\n            }\n            if (!ts.nodeCanBeDecorated(node)) {\n                if (node.kind === 149 && !ts.nodeIsPresent(node.body)) {\n                    return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload);\n                }\n                else {\n                    return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here);\n                }\n            }\n            else if (node.kind === 151 || node.kind === 152) {\n                var accessors = ts.getAllAccessorDeclarations(node.parent.members, node);\n                if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) {\n                    return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);\n                }\n            }\n            return false;\n        }\n        function checkGrammarModifiers(node) {\n            var quickResult = reportObviousModifierErrors(node);\n            if (quickResult !== undefined) {\n                return quickResult;\n            }\n            var lastStatic, lastPrivate, lastProtected, lastDeclare, lastAsync, lastReadonly;\n            var flags = 0;\n            for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {\n                var modifier = _a[_i];\n                if (modifier.kind !== 130) {\n                    if (node.kind === 146 || node.kind === 148) {\n                        return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind));\n                    }\n                    if (node.kind === 155) {\n                        return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind));\n                    }\n                }\n                switch (modifier.kind) {\n                    case 75:\n                        if (node.kind !== 229 && node.parent.kind === 226) {\n                            return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75));\n                        }\n                        break;\n                    case 113:\n                    case 112:\n                    case 111:\n                        var text = visibilityToString(ts.modifierToFlag(modifier.kind));\n                        if (modifier.kind === 112) {\n                            lastProtected = modifier;\n                        }\n                        else if (modifier.kind === 111) {\n                            lastPrivate = modifier;\n                        }\n                        if (flags & 28) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen);\n                        }\n                        else if (flags & 32) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, \"static\");\n                        }\n                        else if (flags & 64) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, \"readonly\");\n                        }\n                        else if (flags & 256) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, \"async\");\n                        }\n                        else if (node.parent.kind === 231 || node.parent.kind === 261) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text);\n                        }\n                        else if (flags & 128) {\n                            if (modifier.kind === 111) {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, \"abstract\");\n                            }\n                            else {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, \"abstract\");\n                            }\n                        }\n                        flags |= ts.modifierToFlag(modifier.kind);\n                        break;\n                    case 114:\n                        if (flags & 32) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"static\");\n                        }\n                        else if (flags & 64) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, \"static\", \"readonly\");\n                        }\n                        else if (flags & 256) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, \"static\", \"async\");\n                        }\n                        else if (node.parent.kind === 231 || node.parent.kind === 261) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, \"static\");\n                        }\n                        else if (node.kind === 144) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, \"static\");\n                        }\n                        else if (flags & 128) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, \"static\", \"abstract\");\n                        }\n                        flags |= 32;\n                        lastStatic = modifier;\n                        break;\n                    case 130:\n                        if (flags & 64) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"readonly\");\n                        }\n                        else if (node.kind !== 147 && node.kind !== 146 && node.kind !== 155 && node.kind !== 144) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);\n                        }\n                        flags |= 64;\n                        lastReadonly = modifier;\n                        break;\n                    case 83:\n                        if (flags & 1) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"export\");\n                        }\n                        else if (flags & 2) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, \"export\", \"declare\");\n                        }\n                        else if (flags & 128) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, \"export\", \"abstract\");\n                        }\n                        else if (flags & 256) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, \"export\", \"async\");\n                        }\n                        else if (node.parent.kind === 226) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, \"export\");\n                        }\n                        else if (node.kind === 144) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, \"export\");\n                        }\n                        flags |= 1;\n                        break;\n                    case 123:\n                        if (flags & 2) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"declare\");\n                        }\n                        else if (flags & 256) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, \"async\");\n                        }\n                        else if (node.parent.kind === 226) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, \"declare\");\n                        }\n                        else if (node.kind === 144) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, \"declare\");\n                        }\n                        else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 231) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);\n                        }\n                        flags |= 2;\n                        lastDeclare = modifier;\n                        break;\n                    case 116:\n                        if (flags & 128) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"abstract\");\n                        }\n                        if (node.kind !== 226) {\n                            if (node.kind !== 149 &&\n                                node.kind !== 147 &&\n                                node.kind !== 151 &&\n                                node.kind !== 152) {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);\n                            }\n                            if (!(node.parent.kind === 226 && ts.getModifierFlags(node.parent) & 128)) {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);\n                            }\n                            if (flags & 32) {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, \"static\", \"abstract\");\n                            }\n                            if (flags & 8) {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, \"private\", \"abstract\");\n                            }\n                        }\n                        flags |= 128;\n                        break;\n                    case 119:\n                        if (flags & 256) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"async\");\n                        }\n                        else if (flags & 2 || ts.isInAmbientContext(node.parent)) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, \"async\");\n                        }\n                        else if (node.kind === 144) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, \"async\");\n                        }\n                        flags |= 256;\n                        lastAsync = modifier;\n                        break;\n                }\n            }\n            if (node.kind === 150) {\n                if (flags & 32) {\n                    return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, \"static\");\n                }\n                if (flags & 128) {\n                    return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, \"abstract\");\n                }\n                else if (flags & 256) {\n                    return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, \"async\");\n                }\n                else if (flags & 64) {\n                    return grammarErrorOnNode(lastReadonly, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, \"readonly\");\n                }\n                return;\n            }\n            else if ((node.kind === 235 || node.kind === 234) && flags & 2) {\n                return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, \"declare\");\n            }\n            else if (node.kind === 144 && (flags & 92) && ts.isBindingPattern(node.name)) {\n                return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern);\n            }\n            else if (node.kind === 144 && (flags & 92) && node.dotDotDotToken) {\n                return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter);\n            }\n            if (flags & 256) {\n                return checkGrammarAsyncModifier(node, lastAsync);\n            }\n        }\n        function reportObviousModifierErrors(node) {\n            return !node.modifiers\n                ? false\n                : shouldReportBadModifier(node)\n                    ? grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here)\n                    : undefined;\n        }\n        function shouldReportBadModifier(node) {\n            switch (node.kind) {\n                case 151:\n                case 152:\n                case 150:\n                case 147:\n                case 146:\n                case 149:\n                case 148:\n                case 155:\n                case 230:\n                case 235:\n                case 234:\n                case 241:\n                case 240:\n                case 184:\n                case 185:\n                case 144:\n                    return false;\n                default:\n                    if (node.parent.kind === 231 || node.parent.kind === 261) {\n                        return false;\n                    }\n                    switch (node.kind) {\n                        case 225:\n                            return nodeHasAnyModifiersExcept(node, 119);\n                        case 226:\n                            return nodeHasAnyModifiersExcept(node, 116);\n                        case 227:\n                        case 205:\n                        case 228:\n                            return true;\n                        case 229:\n                            return nodeHasAnyModifiersExcept(node, 75);\n                        default:\n                            ts.Debug.fail();\n                            return false;\n                    }\n            }\n        }\n        function nodeHasAnyModifiersExcept(node, allowedModifier) {\n            return node.modifiers.length > 1 || node.modifiers[0].kind !== allowedModifier;\n        }\n        function checkGrammarAsyncModifier(node, asyncModifier) {\n            switch (node.kind) {\n                case 149:\n                case 225:\n                case 184:\n                case 185:\n                    if (!node.asteriskToken) {\n                        return false;\n                    }\n                    break;\n            }\n            return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, \"async\");\n        }\n        function checkGrammarForDisallowedTrailingComma(list) {\n            if (list && list.hasTrailingComma) {\n                var start = list.end - \",\".length;\n                var end = list.end;\n                var sourceFile = ts.getSourceFileOfNode(list[0]);\n                return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Trailing_comma_not_allowed);\n            }\n        }\n        function checkGrammarTypeParameterList(typeParameters, file) {\n            if (checkGrammarForDisallowedTrailingComma(typeParameters)) {\n                return true;\n            }\n            if (typeParameters && typeParameters.length === 0) {\n                var start = typeParameters.pos - \"<\".length;\n                var end = ts.skipTrivia(file.text, typeParameters.end) + \">\".length;\n                return grammarErrorAtPos(file, start, end - start, ts.Diagnostics.Type_parameter_list_cannot_be_empty);\n            }\n        }\n        function checkGrammarParameterList(parameters) {\n            var seenOptionalParameter = false;\n            var parameterCount = parameters.length;\n            for (var i = 0; i < parameterCount; i++) {\n                var parameter = parameters[i];\n                if (parameter.dotDotDotToken) {\n                    if (i !== (parameterCount - 1)) {\n                        return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);\n                    }\n                    if (ts.isBindingPattern(parameter.name)) {\n                        return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);\n                    }\n                    if (parameter.questionToken) {\n                        return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_rest_parameter_cannot_be_optional);\n                    }\n                    if (parameter.initializer) {\n                        return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer);\n                    }\n                }\n                else if (parameter.questionToken) {\n                    seenOptionalParameter = true;\n                    if (parameter.initializer) {\n                        return grammarErrorOnNode(parameter.name, ts.Diagnostics.Parameter_cannot_have_question_mark_and_initializer);\n                    }\n                }\n                else if (seenOptionalParameter && !parameter.initializer) {\n                    return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter);\n                }\n            }\n        }\n        function checkGrammarFunctionLikeDeclaration(node) {\n            var file = ts.getSourceFileOfNode(node);\n            return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node.typeParameters, file) ||\n                checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file);\n        }\n        function checkGrammarArrowFunction(node, file) {\n            if (node.kind === 185) {\n                var arrowFunction = node;\n                var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line;\n                var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line;\n                if (startLine !== endLine) {\n                    return grammarErrorOnNode(arrowFunction.equalsGreaterThanToken, ts.Diagnostics.Line_terminator_not_permitted_before_arrow);\n                }\n            }\n            return false;\n        }\n        function checkGrammarIndexSignatureParameters(node) {\n            var parameter = node.parameters[0];\n            if (node.parameters.length !== 1) {\n                if (parameter) {\n                    return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter);\n                }\n                else {\n                    return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter);\n                }\n            }\n            if (parameter.dotDotDotToken) {\n                return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter);\n            }\n            if (ts.getModifierFlags(parameter) !== 0) {\n                return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier);\n            }\n            if (parameter.questionToken) {\n                return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark);\n            }\n            if (parameter.initializer) {\n                return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_initializer);\n            }\n            if (!parameter.type) {\n                return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);\n            }\n            if (parameter.type.kind !== 134 && parameter.type.kind !== 132) {\n                return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number);\n            }\n            if (!node.type) {\n                return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation);\n            }\n        }\n        function checkGrammarIndexSignature(node) {\n            return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node);\n        }\n        function checkGrammarForAtLeastOneTypeArgument(node, typeArguments) {\n            if (typeArguments && typeArguments.length === 0) {\n                var sourceFile = ts.getSourceFileOfNode(node);\n                var start = typeArguments.pos - \"<\".length;\n                var end = ts.skipTrivia(sourceFile.text, typeArguments.end) + \">\".length;\n                return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Type_argument_list_cannot_be_empty);\n            }\n        }\n        function checkGrammarTypeArguments(node, typeArguments) {\n            return checkGrammarForDisallowedTrailingComma(typeArguments) ||\n                checkGrammarForAtLeastOneTypeArgument(node, typeArguments);\n        }\n        function checkGrammarForOmittedArgument(node, args) {\n            if (args) {\n                var sourceFile = ts.getSourceFileOfNode(node);\n                for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {\n                    var arg = args_4[_i];\n                    if (arg.kind === 198) {\n                        return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);\n                    }\n                }\n            }\n        }\n        function checkGrammarArguments(node, args) {\n            return checkGrammarForOmittedArgument(node, args);\n        }\n        function checkGrammarHeritageClause(node) {\n            var types = node.types;\n            if (checkGrammarForDisallowedTrailingComma(types)) {\n                return true;\n            }\n            if (types && types.length === 0) {\n                var listType = ts.tokenToString(node.token);\n                var sourceFile = ts.getSourceFileOfNode(node);\n                return grammarErrorAtPos(sourceFile, types.pos, 0, ts.Diagnostics._0_list_cannot_be_empty, listType);\n            }\n        }\n        function checkGrammarClassDeclarationHeritageClauses(node) {\n            var seenExtendsClause = false;\n            var seenImplementsClause = false;\n            if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) {\n                for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {\n                    var heritageClause = _a[_i];\n                    if (heritageClause.token === 84) {\n                        if (seenExtendsClause) {\n                            return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);\n                        }\n                        if (seenImplementsClause) {\n                            return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_must_precede_implements_clause);\n                        }\n                        if (heritageClause.types.length > 1) {\n                            return grammarErrorOnFirstToken(heritageClause.types[1], ts.Diagnostics.Classes_can_only_extend_a_single_class);\n                        }\n                        seenExtendsClause = true;\n                    }\n                    else {\n                        ts.Debug.assert(heritageClause.token === 107);\n                        if (seenImplementsClause) {\n                            return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen);\n                        }\n                        seenImplementsClause = true;\n                    }\n                    checkGrammarHeritageClause(heritageClause);\n                }\n            }\n        }\n        function checkGrammarInterfaceDeclaration(node) {\n            var seenExtendsClause = false;\n            if (node.heritageClauses) {\n                for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {\n                    var heritageClause = _a[_i];\n                    if (heritageClause.token === 84) {\n                        if (seenExtendsClause) {\n                            return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);\n                        }\n                        seenExtendsClause = true;\n                    }\n                    else {\n                        ts.Debug.assert(heritageClause.token === 107);\n                        return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause);\n                    }\n                    checkGrammarHeritageClause(heritageClause);\n                }\n            }\n            return false;\n        }\n        function checkGrammarComputedPropertyName(node) {\n            if (node.kind !== 142) {\n                return false;\n            }\n            var computedPropertyName = node;\n            if (computedPropertyName.expression.kind === 192 && computedPropertyName.expression.operatorToken.kind === 25) {\n                return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);\n            }\n        }\n        function checkGrammarForGenerator(node) {\n            if (node.asteriskToken) {\n                ts.Debug.assert(node.kind === 225 ||\n                    node.kind === 184 ||\n                    node.kind === 149);\n                if (ts.isInAmbientContext(node)) {\n                    return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);\n                }\n                if (!node.body) {\n                    return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator);\n                }\n                if (languageVersion < 2) {\n                    return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher);\n                }\n            }\n        }\n        function checkGrammarForInvalidQuestionMark(questionToken, message) {\n            if (questionToken) {\n                return grammarErrorOnNode(questionToken, message);\n            }\n        }\n        function checkGrammarObjectLiteralExpression(node, inDestructuring) {\n            var seen = ts.createMap();\n            var Property = 1;\n            var GetAccessor = 2;\n            var SetAccessor = 4;\n            var GetOrSetAccessor = GetAccessor | SetAccessor;\n            for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {\n                var prop = _a[_i];\n                if (prop.kind === 259) {\n                    continue;\n                }\n                var name_30 = prop.name;\n                if (name_30.kind === 142) {\n                    checkGrammarComputedPropertyName(name_30);\n                }\n                if (prop.kind === 258 && !inDestructuring && prop.objectAssignmentInitializer) {\n                    return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment);\n                }\n                if (prop.modifiers) {\n                    for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) {\n                        var mod = _c[_b];\n                        if (mod.kind !== 119 || prop.kind !== 149) {\n                            grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod));\n                        }\n                    }\n                }\n                var currentKind = void 0;\n                if (prop.kind === 257 || prop.kind === 258) {\n                    checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);\n                    if (name_30.kind === 8) {\n                        checkGrammarNumericLiteral(name_30);\n                    }\n                    currentKind = Property;\n                }\n                else if (prop.kind === 149) {\n                    currentKind = Property;\n                }\n                else if (prop.kind === 151) {\n                    currentKind = GetAccessor;\n                }\n                else if (prop.kind === 152) {\n                    currentKind = SetAccessor;\n                }\n                else {\n                    ts.Debug.fail(\"Unexpected syntax kind:\" + prop.kind);\n                }\n                var effectiveName = ts.getPropertyNameForPropertyNameNode(name_30);\n                if (effectiveName === undefined) {\n                    continue;\n                }\n                if (!seen[effectiveName]) {\n                    seen[effectiveName] = currentKind;\n                }\n                else {\n                    var existingKind = seen[effectiveName];\n                    if (currentKind === Property && existingKind === Property) {\n                        grammarErrorOnNode(name_30, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_30));\n                    }\n                    else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) {\n                        if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) {\n                            seen[effectiveName] = currentKind | existingKind;\n                        }\n                        else {\n                            return grammarErrorOnNode(name_30, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);\n                        }\n                    }\n                    else {\n                        return grammarErrorOnNode(name_30, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);\n                    }\n                }\n            }\n        }\n        function checkGrammarJsxElement(node) {\n            var seen = ts.createMap();\n            for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) {\n                var attr = _a[_i];\n                if (attr.kind === 251) {\n                    continue;\n                }\n                var jsxAttr = attr;\n                var name_31 = jsxAttr.name;\n                if (!seen[name_31.text]) {\n                    seen[name_31.text] = true;\n                }\n                else {\n                    return grammarErrorOnNode(name_31, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);\n                }\n                var initializer = jsxAttr.initializer;\n                if (initializer && initializer.kind === 252 && !initializer.expression) {\n                    return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression);\n                }\n            }\n        }\n        function checkGrammarForInOrForOfStatement(forInOrOfStatement) {\n            if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) {\n                return true;\n            }\n            if (forInOrOfStatement.initializer.kind === 224) {\n                var variableList = forInOrOfStatement.initializer;\n                if (!checkGrammarVariableDeclarationList(variableList)) {\n                    var declarations = variableList.declarations;\n                    if (!declarations.length) {\n                        return false;\n                    }\n                    if (declarations.length > 1) {\n                        var diagnostic = forInOrOfStatement.kind === 212\n                            ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement\n                            : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement;\n                        return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic);\n                    }\n                    var firstDeclaration = declarations[0];\n                    if (firstDeclaration.initializer) {\n                        var diagnostic = forInOrOfStatement.kind === 212\n                            ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer\n                            : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer;\n                        return grammarErrorOnNode(firstDeclaration.name, diagnostic);\n                    }\n                    if (firstDeclaration.type) {\n                        var diagnostic = forInOrOfStatement.kind === 212\n                            ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation\n                            : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation;\n                        return grammarErrorOnNode(firstDeclaration, diagnostic);\n                    }\n                }\n            }\n            return false;\n        }\n        function checkGrammarAccessor(accessor) {\n            var kind = accessor.kind;\n            if (languageVersion < 1) {\n                return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);\n            }\n            else if (ts.isInAmbientContext(accessor)) {\n                return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context);\n            }\n            else if (accessor.body === undefined && !(ts.getModifierFlags(accessor) & 128)) {\n                return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, \";\".length, ts.Diagnostics._0_expected, \"{\");\n            }\n            else if (accessor.body && ts.getModifierFlags(accessor) & 128) {\n                return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation);\n            }\n            else if (accessor.typeParameters) {\n                return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);\n            }\n            else if (!doesAccessorHaveCorrectParameterCount(accessor)) {\n                return grammarErrorOnNode(accessor.name, kind === 151 ?\n                    ts.Diagnostics.A_get_accessor_cannot_have_parameters :\n                    ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);\n            }\n            else if (kind === 152) {\n                if (accessor.type) {\n                    return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);\n                }\n                else {\n                    var parameter = accessor.parameters[0];\n                    if (parameter.dotDotDotToken) {\n                        return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter);\n                    }\n                    else if (parameter.questionToken) {\n                        return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);\n                    }\n                    else if (parameter.initializer) {\n                        return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer);\n                    }\n                }\n            }\n        }\n        function doesAccessorHaveCorrectParameterCount(accessor) {\n            return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 151 ? 0 : 1);\n        }\n        function getAccessorThisParameter(accessor) {\n            if (accessor.parameters.length === (accessor.kind === 151 ? 1 : 2)) {\n                return ts.getThisParameter(accessor);\n            }\n        }\n        function checkGrammarForNonSymbolComputedProperty(node, message) {\n            if (ts.isDynamicName(node)) {\n                return grammarErrorOnNode(node, message);\n            }\n        }\n        function checkGrammarMethod(node) {\n            if (checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) ||\n                checkGrammarFunctionLikeDeclaration(node) ||\n                checkGrammarForGenerator(node)) {\n                return true;\n            }\n            if (node.parent.kind === 176) {\n                if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) {\n                    return true;\n                }\n                else if (node.body === undefined) {\n                    return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.end - 1, \";\".length, ts.Diagnostics._0_expected, \"{\");\n                }\n            }\n            if (ts.isClassLike(node.parent)) {\n                if (ts.isInAmbientContext(node)) {\n                    return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol);\n                }\n                else if (!node.body) {\n                    return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol);\n                }\n            }\n            else if (node.parent.kind === 227) {\n                return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol);\n            }\n            else if (node.parent.kind === 161) {\n                return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol);\n            }\n        }\n        function checkGrammarBreakOrContinueStatement(node) {\n            var current = node;\n            while (current) {\n                if (ts.isFunctionLike(current)) {\n                    return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary);\n                }\n                switch (current.kind) {\n                    case 219:\n                        if (node.label && current.label.text === node.label.text) {\n                            var isMisplacedContinueLabel = node.kind === 214\n                                && !ts.isIterationStatement(current.statement, true);\n                            if (isMisplacedContinueLabel) {\n                                return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement);\n                            }\n                            return false;\n                        }\n                        break;\n                    case 218:\n                        if (node.kind === 215 && !node.label) {\n                            return false;\n                        }\n                        break;\n                    default:\n                        if (ts.isIterationStatement(current, false) && !node.label) {\n                            return false;\n                        }\n                        break;\n                }\n                current = current.parent;\n            }\n            if (node.label) {\n                var message = node.kind === 215\n                    ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement\n                    : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement;\n                return grammarErrorOnNode(node, message);\n            }\n            else {\n                var message = node.kind === 215\n                    ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement\n                    : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement;\n                return grammarErrorOnNode(node, message);\n            }\n        }\n        function checkGrammarBindingElement(node) {\n            if (node.dotDotDotToken) {\n                var elements = node.parent.elements;\n                if (node !== ts.lastOrUndefined(elements)) {\n                    return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);\n                }\n                if (node.name.kind === 173 || node.name.kind === 172) {\n                    return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);\n                }\n                if (node.initializer) {\n                    return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - 1, 1, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);\n                }\n            }\n        }\n        function isStringOrNumberLiteralExpression(expr) {\n            return expr.kind === 9 || expr.kind === 8 ||\n                expr.kind === 190 && expr.operator === 37 &&\n                    expr.operand.kind === 8;\n        }\n        function checkGrammarVariableDeclaration(node) {\n            if (node.parent.parent.kind !== 212 && node.parent.parent.kind !== 213) {\n                if (ts.isInAmbientContext(node)) {\n                    if (node.initializer) {\n                        if (ts.isConst(node) && !node.type) {\n                            if (!isStringOrNumberLiteralExpression(node.initializer)) {\n                                return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal);\n                            }\n                        }\n                        else {\n                            var equalsTokenLength = \"=\".length;\n                            return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);\n                        }\n                    }\n                    if (node.initializer && !(ts.isConst(node) && isStringOrNumberLiteralExpression(node.initializer))) {\n                        var equalsTokenLength = \"=\".length;\n                        return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);\n                    }\n                }\n                else if (!node.initializer) {\n                    if (ts.isBindingPattern(node.name) && !ts.isBindingPattern(node.parent)) {\n                        return grammarErrorOnNode(node, ts.Diagnostics.A_destructuring_declaration_must_have_an_initializer);\n                    }\n                    if (ts.isConst(node)) {\n                        return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_must_be_initialized);\n                    }\n                }\n            }\n            var checkLetConstNames = (ts.isLet(node) || ts.isConst(node));\n            return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name);\n        }\n        function checkGrammarNameInLetOrConstDeclarations(name) {\n            if (name.kind === 70) {\n                if (name.originalKeywordKind === 109) {\n                    return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations);\n                }\n            }\n            else {\n                var elements = name.elements;\n                for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) {\n                    var element = elements_2[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        checkGrammarNameInLetOrConstDeclarations(element.name);\n                    }\n                }\n            }\n        }\n        function checkGrammarVariableDeclarationList(declarationList) {\n            var declarations = declarationList.declarations;\n            if (checkGrammarForDisallowedTrailingComma(declarationList.declarations)) {\n                return true;\n            }\n            if (!declarationList.declarations.length) {\n                return grammarErrorAtPos(ts.getSourceFileOfNode(declarationList), declarations.pos, declarations.end - declarations.pos, ts.Diagnostics.Variable_declaration_list_cannot_be_empty);\n            }\n        }\n        function allowLetAndConstDeclarations(parent) {\n            switch (parent.kind) {\n                case 208:\n                case 209:\n                case 210:\n                case 217:\n                case 211:\n                case 212:\n                case 213:\n                    return false;\n                case 219:\n                    return allowLetAndConstDeclarations(parent.parent);\n            }\n            return true;\n        }\n        function checkGrammarForDisallowedLetOrConstStatement(node) {\n            if (!allowLetAndConstDeclarations(node.parent)) {\n                if (ts.isLet(node.declarationList)) {\n                    return grammarErrorOnNode(node, ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block);\n                }\n                else if (ts.isConst(node.declarationList)) {\n                    return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_can_only_be_declared_inside_a_block);\n                }\n            }\n        }\n        function hasParseDiagnostics(sourceFile) {\n            return sourceFile.parseDiagnostics.length > 0;\n        }\n        function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) {\n            var sourceFile = ts.getSourceFileOfNode(node);\n            if (!hasParseDiagnostics(sourceFile)) {\n                var span_4 = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);\n                diagnostics.add(ts.createFileDiagnostic(sourceFile, span_4.start, span_4.length, message, arg0, arg1, arg2));\n                return true;\n            }\n        }\n        function grammarErrorAtPos(sourceFile, start, length, message, arg0, arg1, arg2) {\n            if (!hasParseDiagnostics(sourceFile)) {\n                diagnostics.add(ts.createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2));\n                return true;\n            }\n        }\n        function grammarErrorOnNode(node, message, arg0, arg1, arg2) {\n            var sourceFile = ts.getSourceFileOfNode(node);\n            if (!hasParseDiagnostics(sourceFile)) {\n                diagnostics.add(ts.createDiagnosticForNode(node, message, arg0, arg1, arg2));\n                return true;\n            }\n        }\n        function checkGrammarConstructorTypeParameters(node) {\n            if (node.typeParameters) {\n                return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.typeParameters.pos, node.typeParameters.end - node.typeParameters.pos, ts.Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration);\n            }\n        }\n        function checkGrammarConstructorTypeAnnotation(node) {\n            if (node.type) {\n                return grammarErrorOnNode(node.type, ts.Diagnostics.Type_annotation_cannot_appear_on_a_constructor_declaration);\n            }\n        }\n        function checkGrammarProperty(node) {\n            if (ts.isClassLike(node.parent)) {\n                if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) {\n                    return true;\n                }\n            }\n            else if (node.parent.kind === 227) {\n                if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) {\n                    return true;\n                }\n                if (node.initializer) {\n                    return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer);\n                }\n            }\n            else if (node.parent.kind === 161) {\n                if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) {\n                    return true;\n                }\n                if (node.initializer) {\n                    return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_type_literal_property_cannot_have_an_initializer);\n                }\n            }\n            if (ts.isInAmbientContext(node) && node.initializer) {\n                return grammarErrorOnFirstToken(node.initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);\n            }\n        }\n        function checkGrammarTopLevelElementForRequiredDeclareModifier(node) {\n            if (node.kind === 227 ||\n                node.kind === 228 ||\n                node.kind === 235 ||\n                node.kind === 234 ||\n                node.kind === 241 ||\n                node.kind === 240 ||\n                node.kind === 233 ||\n                ts.getModifierFlags(node) & (2 | 1 | 512)) {\n                return false;\n            }\n            return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file);\n        }\n        function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) {\n            for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {\n                var decl = _a[_i];\n                if (ts.isDeclaration(decl) || decl.kind === 205) {\n                    if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) {\n                        return true;\n                    }\n                }\n            }\n        }\n        function checkGrammarSourceFile(node) {\n            return ts.isInAmbientContext(node) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node);\n        }\n        function checkGrammarStatementInAmbientContext(node) {\n            if (ts.isInAmbientContext(node)) {\n                if (isAccessor(node.parent.kind)) {\n                    return getNodeLinks(node).hasReportedStatementInAmbientContext = true;\n                }\n                var links = getNodeLinks(node);\n                if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) {\n                    return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts);\n                }\n                if (node.parent.kind === 204 || node.parent.kind === 231 || node.parent.kind === 261) {\n                    var links_1 = getNodeLinks(node.parent);\n                    if (!links_1.hasReportedStatementInAmbientContext) {\n                        return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts);\n                    }\n                }\n                else {\n                }\n            }\n        }\n        function checkGrammarNumericLiteral(node) {\n            if (node.isOctalLiteral && languageVersion >= 1) {\n                return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher);\n            }\n        }\n        function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) {\n            var sourceFile = ts.getSourceFileOfNode(node);\n            if (!hasParseDiagnostics(sourceFile)) {\n                var span_5 = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);\n                diagnostics.add(ts.createFileDiagnostic(sourceFile, ts.textSpanEnd(span_5), 0, message, arg0, arg1, arg2));\n                return true;\n            }\n        }\n        function getAmbientModules() {\n            var result = [];\n            for (var sym in globals) {\n                if (ambientModuleSymbolRegex.test(sym)) {\n                    result.push(globals[sym]);\n                }\n            }\n            return result;\n        }\n    }\n    ts.createTypeChecker = createTypeChecker;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    ;\n    var nodeEdgeTraversalMap = ts.createMap((_a = {},\n        _a[141] = [\n            { name: \"left\", test: ts.isEntityName },\n            { name: \"right\", test: ts.isIdentifier }\n        ],\n        _a[145] = [\n            { name: \"expression\", test: ts.isLeftHandSideExpression }\n        ],\n        _a[182] = [\n            { name: \"type\", test: ts.isTypeNode },\n            { name: \"expression\", test: ts.isUnaryExpression }\n        ],\n        _a[200] = [\n            { name: \"expression\", test: ts.isExpression },\n            { name: \"type\", test: ts.isTypeNode }\n        ],\n        _a[201] = [\n            { name: \"expression\", test: ts.isLeftHandSideExpression }\n        ],\n        _a[229] = [\n            { name: \"decorators\", test: ts.isDecorator },\n            { name: \"modifiers\", test: ts.isModifier },\n            { name: \"name\", test: ts.isIdentifier },\n            { name: \"members\", test: ts.isEnumMember }\n        ],\n        _a[230] = [\n            { name: \"decorators\", test: ts.isDecorator },\n            { name: \"modifiers\", test: ts.isModifier },\n            { name: \"name\", test: ts.isModuleName },\n            { name: \"body\", test: ts.isModuleBody }\n        ],\n        _a[231] = [\n            { name: \"statements\", test: ts.isStatement }\n        ],\n        _a[234] = [\n            { name: \"decorators\", test: ts.isDecorator },\n            { name: \"modifiers\", test: ts.isModifier },\n            { name: \"name\", test: ts.isIdentifier },\n            { name: \"moduleReference\", test: ts.isModuleReference }\n        ],\n        _a[245] = [\n            { name: \"expression\", test: ts.isExpression, optional: true }\n        ],\n        _a[260] = [\n            { name: \"name\", test: ts.isPropertyName },\n            { name: \"initializer\", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList }\n        ],\n        _a));\n    function reduceNode(node, f, initial) {\n        return node ? f(initial, node) : initial;\n    }\n    function reduceNodeArray(nodes, f, initial) {\n        return nodes ? f(initial, nodes) : initial;\n    }\n    function reduceEachChild(node, initial, cbNode, cbNodeArray) {\n        if (node === undefined) {\n            return initial;\n        }\n        var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft;\n        var cbNodes = cbNodeArray || cbNode;\n        var kind = node.kind;\n        if ((kind > 0 && kind <= 140)) {\n            return initial;\n        }\n        if ((kind >= 156 && kind <= 171)) {\n            return initial;\n        }\n        var result = initial;\n        switch (node.kind) {\n            case 203:\n            case 206:\n            case 198:\n            case 222:\n            case 293:\n                break;\n            case 142:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 144:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            case 145:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 147:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            case 149:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 150:\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 151:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 152:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 172:\n            case 173:\n                result = reduceNodes(node.elements, cbNodes, result);\n                break;\n            case 174:\n                result = reduceNode(node.propertyName, cbNode, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            case 175:\n                result = reduceNodes(node.elements, cbNodes, result);\n                break;\n            case 176:\n                result = reduceNodes(node.properties, cbNodes, result);\n                break;\n            case 177:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.name, cbNode, result);\n                break;\n            case 178:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.argumentExpression, cbNode, result);\n                break;\n            case 179:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNodes(node.typeArguments, cbNodes, result);\n                result = reduceNodes(node.arguments, cbNodes, result);\n                break;\n            case 180:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNodes(node.typeArguments, cbNodes, result);\n                result = reduceNodes(node.arguments, cbNodes, result);\n                break;\n            case 181:\n                result = reduceNode(node.tag, cbNode, result);\n                result = reduceNode(node.template, cbNode, result);\n                break;\n            case 184:\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 185:\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 183:\n            case 186:\n            case 187:\n            case 188:\n            case 189:\n            case 195:\n            case 196:\n            case 201:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 190:\n            case 191:\n                result = reduceNode(node.operand, cbNode, result);\n                break;\n            case 192:\n                result = reduceNode(node.left, cbNode, result);\n                result = reduceNode(node.right, cbNode, result);\n                break;\n            case 193:\n                result = reduceNode(node.condition, cbNode, result);\n                result = reduceNode(node.whenTrue, cbNode, result);\n                result = reduceNode(node.whenFalse, cbNode, result);\n                break;\n            case 194:\n                result = reduceNode(node.head, cbNode, result);\n                result = reduceNodes(node.templateSpans, cbNodes, result);\n                break;\n            case 197:\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.heritageClauses, cbNodes, result);\n                result = reduceNodes(node.members, cbNodes, result);\n                break;\n            case 199:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNodes(node.typeArguments, cbNodes, result);\n                break;\n            case 202:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.literal, cbNode, result);\n                break;\n            case 204:\n                result = reduceNodes(node.statements, cbNodes, result);\n                break;\n            case 205:\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.declarationList, cbNode, result);\n                break;\n            case 207:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 208:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.thenStatement, cbNode, result);\n                result = reduceNode(node.elseStatement, cbNode, result);\n                break;\n            case 209:\n                result = reduceNode(node.statement, cbNode, result);\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 210:\n            case 217:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.statement, cbNode, result);\n                break;\n            case 211:\n                result = reduceNode(node.initializer, cbNode, result);\n                result = reduceNode(node.condition, cbNode, result);\n                result = reduceNode(node.incrementor, cbNode, result);\n                result = reduceNode(node.statement, cbNode, result);\n                break;\n            case 212:\n            case 213:\n                result = reduceNode(node.initializer, cbNode, result);\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.statement, cbNode, result);\n                break;\n            case 216:\n            case 220:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 218:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.caseBlock, cbNode, result);\n                break;\n            case 219:\n                result = reduceNode(node.label, cbNode, result);\n                result = reduceNode(node.statement, cbNode, result);\n                break;\n            case 221:\n                result = reduceNode(node.tryBlock, cbNode, result);\n                result = reduceNode(node.catchClause, cbNode, result);\n                result = reduceNode(node.finallyBlock, cbNode, result);\n                break;\n            case 223:\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            case 224:\n                result = reduceNodes(node.declarations, cbNodes, result);\n                break;\n            case 225:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 226:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.heritageClauses, cbNodes, result);\n                result = reduceNodes(node.members, cbNodes, result);\n                break;\n            case 232:\n                result = reduceNodes(node.clauses, cbNodes, result);\n                break;\n            case 235:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.importClause, cbNode, result);\n                result = reduceNode(node.moduleSpecifier, cbNode, result);\n                break;\n            case 236:\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.namedBindings, cbNode, result);\n                break;\n            case 237:\n                result = reduceNode(node.name, cbNode, result);\n                break;\n            case 238:\n            case 242:\n                result = reduceNodes(node.elements, cbNodes, result);\n                break;\n            case 239:\n            case 243:\n                result = reduceNode(node.propertyName, cbNode, result);\n                result = reduceNode(node.name, cbNode, result);\n                break;\n            case 240:\n                result = ts.reduceLeft(node.decorators, cbNode, result);\n                result = ts.reduceLeft(node.modifiers, cbNode, result);\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 241:\n                result = ts.reduceLeft(node.decorators, cbNode, result);\n                result = ts.reduceLeft(node.modifiers, cbNode, result);\n                result = reduceNode(node.exportClause, cbNode, result);\n                result = reduceNode(node.moduleSpecifier, cbNode, result);\n                break;\n            case 246:\n                result = reduceNode(node.openingElement, cbNode, result);\n                result = ts.reduceLeft(node.children, cbNode, result);\n                result = reduceNode(node.closingElement, cbNode, result);\n                break;\n            case 247:\n            case 248:\n                result = reduceNode(node.tagName, cbNode, result);\n                result = reduceNodes(node.attributes, cbNodes, result);\n                break;\n            case 249:\n                result = reduceNode(node.tagName, cbNode, result);\n                break;\n            case 250:\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            case 251:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 252:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 253:\n                result = reduceNode(node.expression, cbNode, result);\n            case 254:\n                result = reduceNodes(node.statements, cbNodes, result);\n                break;\n            case 255:\n                result = reduceNodes(node.types, cbNodes, result);\n                break;\n            case 256:\n                result = reduceNode(node.variableDeclaration, cbNode, result);\n                result = reduceNode(node.block, cbNode, result);\n                break;\n            case 257:\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            case 258:\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.objectAssignmentInitializer, cbNode, result);\n                break;\n            case 259:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 261:\n                result = reduceNodes(node.statements, cbNodes, result);\n                break;\n            case 294:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            default:\n                var edgeTraversalPath = nodeEdgeTraversalMap[kind];\n                if (edgeTraversalPath) {\n                    for (var _i = 0, edgeTraversalPath_1 = edgeTraversalPath; _i < edgeTraversalPath_1.length; _i++) {\n                        var edge = edgeTraversalPath_1[_i];\n                        var value = node[edge.name];\n                        if (value !== undefined) {\n                            result = ts.isArray(value)\n                                ? reduceNodes(value, cbNodes, result)\n                                : cbNode(result, value);\n                        }\n                    }\n                }\n                break;\n        }\n        return result;\n    }\n    ts.reduceEachChild = reduceEachChild;\n    function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) {\n        if (node === undefined || visitor === undefined) {\n            return node;\n        }\n        aggregateTransformFlags(node);\n        var visited = visitor(node);\n        if (visited === node) {\n            return node;\n        }\n        var visitedNode;\n        if (visited === undefined) {\n            if (!optional) {\n                Debug.failNotOptional();\n            }\n            return undefined;\n        }\n        else if (ts.isArray(visited)) {\n            visitedNode = (lift || extractSingleNode)(visited);\n        }\n        else {\n            visitedNode = visited;\n        }\n        if (parenthesize !== undefined) {\n            visitedNode = parenthesize(visitedNode, parentNode);\n        }\n        Debug.assertNode(visitedNode, test);\n        aggregateTransformFlags(visitedNode);\n        return visitedNode;\n    }\n    ts.visitNode = visitNode;\n    function visitNodes(nodes, visitor, test, start, count, parenthesize, parentNode) {\n        if (nodes === undefined) {\n            return undefined;\n        }\n        var updated;\n        var length = nodes.length;\n        if (start === undefined || start < 0) {\n            start = 0;\n        }\n        if (count === undefined || count > length - start) {\n            count = length - start;\n        }\n        if (start > 0 || count < length) {\n            updated = ts.createNodeArray([], undefined, nodes.hasTrailingComma && start + count === length);\n        }\n        for (var i = 0; i < count; i++) {\n            var node = nodes[i + start];\n            aggregateTransformFlags(node);\n            var visited = node !== undefined ? visitor(node) : undefined;\n            if (updated !== undefined || visited === undefined || visited !== node) {\n                if (updated === undefined) {\n                    updated = ts.createNodeArray(nodes.slice(0, i), nodes, nodes.hasTrailingComma);\n                }\n                if (visited) {\n                    if (ts.isArray(visited)) {\n                        for (var _i = 0, visited_1 = visited; _i < visited_1.length; _i++) {\n                            var visitedNode = visited_1[_i];\n                            visitedNode = parenthesize\n                                ? parenthesize(visitedNode, parentNode)\n                                : visitedNode;\n                            Debug.assertNode(visitedNode, test);\n                            aggregateTransformFlags(visitedNode);\n                            updated.push(visitedNode);\n                        }\n                    }\n                    else {\n                        var visitedNode = parenthesize\n                            ? parenthesize(visited, parentNode)\n                            : visited;\n                        Debug.assertNode(visitedNode, test);\n                        aggregateTransformFlags(visitedNode);\n                        updated.push(visitedNode);\n                    }\n                }\n            }\n        }\n        return updated || nodes;\n    }\n    ts.visitNodes = visitNodes;\n    function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) {\n        context.startLexicalEnvironment();\n        statements = visitNodes(statements, visitor, ts.isStatement, start);\n        if (ensureUseStrict && !ts.startsWithUseStrict(statements)) {\n            statements = ts.createNodeArray([ts.createStatement(ts.createLiteral(\"use strict\"))].concat(statements), statements);\n        }\n        var declarations = context.endLexicalEnvironment();\n        return ts.createNodeArray(ts.concatenate(statements, declarations), statements);\n    }\n    ts.visitLexicalEnvironment = visitLexicalEnvironment;\n    function visitParameterList(nodes, visitor, context) {\n        context.startLexicalEnvironment();\n        var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration);\n        context.suspendLexicalEnvironment();\n        return updated;\n    }\n    ts.visitParameterList = visitParameterList;\n    function visitFunctionBody(node, visitor, context) {\n        context.resumeLexicalEnvironment();\n        var updated = visitNode(node, visitor, ts.isConciseBody);\n        var declarations = context.endLexicalEnvironment();\n        if (ts.some(declarations)) {\n            var block = ts.convertToFunctionBody(updated);\n            var statements = mergeLexicalEnvironment(block.statements, declarations);\n            return ts.updateBlock(block, statements);\n        }\n        return updated;\n    }\n    ts.visitFunctionBody = visitFunctionBody;\n    function visitEachChild(node, visitor, context) {\n        if (node === undefined) {\n            return undefined;\n        }\n        var kind = node.kind;\n        if ((kind > 0 && kind <= 140)) {\n            return node;\n        }\n        if ((kind >= 156 && kind <= 171)) {\n            return node;\n        }\n        switch (node.kind) {\n            case 203:\n            case 206:\n            case 198:\n            case 222:\n                return node;\n            case 142:\n                return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 144:\n                return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));\n            case 147:\n                return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));\n            case 149:\n                return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));\n            case 150:\n                return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context));\n            case 151:\n                return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));\n            case 152:\n                return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context));\n            case 172:\n                return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement));\n            case 173:\n                return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement));\n            case 174:\n                return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true));\n            case 175:\n                return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression));\n            case 176:\n                return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike));\n            case 177:\n                return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier));\n            case 178:\n                return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression));\n            case 179:\n                return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression));\n            case 180:\n                return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression));\n            case 181:\n                return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral));\n            case 183:\n                return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 184:\n                return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));\n            case 185:\n                return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));\n            case 186:\n                return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 187:\n                return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 188:\n                return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 189:\n                return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 192:\n                return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression));\n            case 190:\n                return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression));\n            case 191:\n                return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression));\n            case 193:\n                return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression));\n            case 194:\n                return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan));\n            case 195:\n                return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 196:\n                return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 197:\n                return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement));\n            case 199:\n                return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));\n            case 202:\n                return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail));\n            case 204:\n                return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement));\n            case 205:\n                return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList));\n            case 207:\n                return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 208:\n                return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock));\n            case 209:\n                return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression));\n            case 210:\n                return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));\n            case 211:\n                return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));\n            case 212:\n                return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));\n            case 213:\n                return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));\n            case 214:\n                return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true));\n            case 215:\n                return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true));\n            case 216:\n                return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true));\n            case 217:\n                return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));\n            case 218:\n                return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock));\n            case 219:\n                return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock));\n            case 220:\n                return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 221:\n                return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, true), visitNode(node.finallyBlock, visitor, ts.isBlock, true));\n            case 223:\n                return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));\n            case 224:\n                return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration));\n            case 225:\n                return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));\n            case 226:\n                return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement));\n            case 232:\n                return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause));\n            case 235:\n                return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression));\n            case 236:\n                return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true));\n            case 237:\n                return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier));\n            case 238:\n                return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier));\n            case 239:\n                return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier));\n            case 240:\n                return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression));\n            case 241:\n                return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true));\n            case 242:\n                return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier));\n            case 243:\n                return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier));\n            case 246:\n                return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement));\n            case 247:\n                return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike));\n            case 248:\n                return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike));\n            case 249:\n                return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression));\n            case 250:\n                return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression));\n            case 251:\n                return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 252:\n                return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 253:\n                return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement));\n            case 254:\n                return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement));\n            case 255:\n                return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments));\n            case 256:\n                return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock));\n            case 257:\n                return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));\n            case 258:\n                return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression));\n            case 259:\n                return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 261:\n                return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));\n            case 294:\n                return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));\n            default:\n                var updated = void 0;\n                var edgeTraversalPath = nodeEdgeTraversalMap[kind];\n                if (edgeTraversalPath) {\n                    for (var _i = 0, edgeTraversalPath_2 = edgeTraversalPath; _i < edgeTraversalPath_2.length; _i++) {\n                        var edge = edgeTraversalPath_2[_i];\n                        var value = node[edge.name];\n                        if (value !== undefined) {\n                            var visited = ts.isArray(value)\n                                ? visitNodes(value, visitor, edge.test, 0, value.length, edge.parenthesize, node)\n                                : visitNode(value, visitor, edge.test, edge.optional, edge.lift, edge.parenthesize, node);\n                            if (updated !== undefined || visited !== value) {\n                                if (updated === undefined) {\n                                    updated = ts.getMutableClone(node);\n                                }\n                                if (visited !== value) {\n                                    updated[edge.name] = visited;\n                                }\n                            }\n                        }\n                    }\n                }\n                return updated ? ts.updateNode(updated, node) : node;\n        }\n    }\n    ts.visitEachChild = visitEachChild;\n    function mergeLexicalEnvironment(statements, declarations) {\n        if (!ts.some(declarations)) {\n            return statements;\n        }\n        return ts.isNodeArray(statements)\n            ? ts.createNodeArray(ts.concatenate(statements, declarations), statements)\n            : ts.addRange(statements, declarations);\n    }\n    ts.mergeLexicalEnvironment = mergeLexicalEnvironment;\n    function mergeFunctionBodyLexicalEnvironment(body, declarations) {\n        if (body && declarations !== undefined && declarations.length > 0) {\n            if (ts.isBlock(body)) {\n                return ts.updateBlock(body, ts.createNodeArray(ts.concatenate(body.statements, declarations), body.statements));\n            }\n            else {\n                return ts.createBlock(ts.createNodeArray([ts.createReturn(body, body)].concat(declarations), body), body, true);\n            }\n        }\n        return body;\n    }\n    ts.mergeFunctionBodyLexicalEnvironment = mergeFunctionBodyLexicalEnvironment;\n    function liftToBlock(nodes) {\n        Debug.assert(ts.every(nodes, ts.isStatement), \"Cannot lift nodes to a Block.\");\n        return ts.singleOrUndefined(nodes) || ts.createBlock(nodes);\n    }\n    ts.liftToBlock = liftToBlock;\n    function extractSingleNode(nodes) {\n        Debug.assert(nodes.length <= 1, \"Too many nodes written to output.\");\n        return ts.singleOrUndefined(nodes);\n    }\n    function aggregateTransformFlags(node) {\n        aggregateTransformFlagsForNode(node);\n        return node;\n    }\n    ts.aggregateTransformFlags = aggregateTransformFlags;\n    function aggregateTransformFlagsForNode(node) {\n        if (node === undefined) {\n            return 0;\n        }\n        if (node.transformFlags & 536870912) {\n            return node.transformFlags & ~ts.getTransformFlagsSubtreeExclusions(node.kind);\n        }\n        var subtreeFlags = aggregateTransformFlagsForSubtree(node);\n        return ts.computeTransformFlagsForNode(node, subtreeFlags);\n    }\n    function aggregateTransformFlagsForNodeArray(nodes) {\n        if (nodes === undefined) {\n            return 0;\n        }\n        var subtreeFlags = 0;\n        var nodeArrayFlags = 0;\n        for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) {\n            var node = nodes_3[_i];\n            subtreeFlags |= aggregateTransformFlagsForNode(node);\n            nodeArrayFlags |= node.transformFlags & ~536870912;\n        }\n        nodes.transformFlags = nodeArrayFlags | 536870912;\n        return subtreeFlags;\n    }\n    function aggregateTransformFlagsForSubtree(node) {\n        if (ts.hasModifier(node, 2) || ts.isTypeNode(node)) {\n            return 0;\n        }\n        return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes);\n    }\n    function aggregateTransformFlagsForChildNode(transformFlags, node) {\n        return transformFlags | aggregateTransformFlagsForNode(node);\n    }\n    function aggregateTransformFlagsForChildNodes(transformFlags, nodes) {\n        return transformFlags | aggregateTransformFlagsForNodeArray(nodes);\n    }\n    var Debug;\n    (function (Debug) {\n        Debug.failNotOptional = Debug.shouldAssert(1)\n            ? function (message) { return Debug.assert(false, message || \"Node not optional.\"); }\n            : ts.noop;\n        Debug.failBadSyntaxKind = Debug.shouldAssert(1)\n            ? function (node, message) { return Debug.assert(false, message || \"Unexpected node.\", function () { return \"Node \" + ts.formatSyntaxKind(node.kind) + \" was unexpected.\"; }); }\n            : ts.noop;\n        Debug.assertEachNode = Debug.shouldAssert(1)\n            ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || \"Unexpected node.\", function () { return \"Node array did not pass test '\" + getFunctionName(test) + \"'.\"; }); }\n            : ts.noop;\n        Debug.assertNode = Debug.shouldAssert(1)\n            ? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || \"Unexpected node.\", function () { return \"Node \" + ts.formatSyntaxKind(node.kind) + \" did not pass test '\" + getFunctionName(test) + \"'.\"; }); }\n            : ts.noop;\n        Debug.assertOptionalNode = Debug.shouldAssert(1)\n            ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || \"Unexpected node.\", function () { return \"Node \" + ts.formatSyntaxKind(node.kind) + \" did not pass test '\" + getFunctionName(test) + \"'.\"; }); }\n            : ts.noop;\n        Debug.assertOptionalToken = Debug.shouldAssert(1)\n            ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || \"Unexpected node.\", function () { return \"Node \" + ts.formatSyntaxKind(node.kind) + \" was not a '\" + ts.formatSyntaxKind(kind) + \"' token.\"; }); }\n            : ts.noop;\n        Debug.assertMissingNode = Debug.shouldAssert(1)\n            ? function (node, message) { return Debug.assert(node === undefined, message || \"Unexpected node.\", function () { return \"Node \" + ts.formatSyntaxKind(node.kind) + \" was unexpected'.\"; }); }\n            : ts.noop;\n        function getFunctionName(func) {\n            if (typeof func !== \"function\") {\n                return \"\";\n            }\n            else if (func.hasOwnProperty(\"name\")) {\n                return func.name;\n            }\n            else {\n                var text = Function.prototype.toString.call(func);\n                var match = /^function\\s+([\\w\\$]+)\\s*\\(/.exec(text);\n                return match ? match[1] : \"\";\n            }\n        }\n    })(Debug = ts.Debug || (ts.Debug = {}));\n    var _a;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) {\n        var location = node;\n        var value;\n        if (ts.isDestructuringAssignment(node)) {\n            value = node.right;\n            while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) {\n                if (ts.isDestructuringAssignment(value)) {\n                    location = node = value;\n                    value = node.right;\n                }\n                else {\n                    return value;\n                }\n            }\n        }\n        var expressions;\n        var flattenContext = {\n            context: context,\n            level: level,\n            hoistTempVariables: true,\n            emitExpression: emitExpression,\n            emitBindingOrAssignment: emitBindingOrAssignment,\n            createArrayBindingOrAssignmentPattern: makeArrayAssignmentPattern,\n            createObjectBindingOrAssignmentPattern: makeObjectAssignmentPattern,\n            createArrayBindingOrAssignmentElement: makeAssignmentElement,\n            visitor: visitor\n        };\n        if (value) {\n            value = ts.visitNode(value, visitor, ts.isExpression);\n            if (needsValue) {\n                value = ensureIdentifier(flattenContext, value, true, location);\n            }\n            else if (ts.nodeIsSynthesized(node)) {\n                location = value;\n            }\n        }\n        flattenBindingOrAssignmentElement(flattenContext, node, value, location, ts.isDestructuringAssignment(node));\n        if (value && needsValue) {\n            if (!ts.some(expressions)) {\n                return value;\n            }\n            expressions.push(value);\n        }\n        return ts.aggregateTransformFlags(ts.inlineExpressions(expressions)) || ts.createOmittedExpression();\n        function emitExpression(expression) {\n            ts.setEmitFlags(expression, 64);\n            ts.aggregateTransformFlags(expression);\n            expressions = ts.append(expressions, expression);\n        }\n        function emitBindingOrAssignment(target, value, location, original) {\n            ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression);\n            var expression = createAssignmentCallback\n                ? createAssignmentCallback(target, value, location)\n                : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location);\n            expression.original = original;\n            emitExpression(expression);\n        }\n    }\n    ts.flattenDestructuringAssignment = flattenDestructuringAssignment;\n    function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) {\n        var pendingExpressions;\n        var pendingDeclarations = [];\n        var declarations = [];\n        var flattenContext = {\n            context: context,\n            level: level,\n            hoistTempVariables: hoistTempVariables,\n            emitExpression: emitExpression,\n            emitBindingOrAssignment: emitBindingOrAssignment,\n            createArrayBindingOrAssignmentPattern: makeArrayBindingPattern,\n            createObjectBindingOrAssignmentPattern: makeObjectBindingPattern,\n            createArrayBindingOrAssignmentElement: makeBindingElement,\n            visitor: visitor\n        };\n        flattenBindingOrAssignmentElement(flattenContext, node, rval, node, skipInitializer);\n        if (pendingExpressions) {\n            var temp = ts.createTempVariable(undefined);\n            if (hoistTempVariables) {\n                var value = ts.inlineExpressions(pendingExpressions);\n                pendingExpressions = undefined;\n                emitBindingOrAssignment(temp, value, undefined, undefined);\n            }\n            else {\n                context.hoistVariableDeclaration(temp);\n                var pendingDeclaration = ts.lastOrUndefined(pendingDeclarations);\n                pendingDeclaration.pendingExpressions = ts.append(pendingDeclaration.pendingExpressions, ts.createAssignment(temp, pendingDeclaration.value));\n                ts.addRange(pendingDeclaration.pendingExpressions, pendingExpressions);\n                pendingDeclaration.value = temp;\n            }\n        }\n        for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) {\n            var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_32 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original;\n            var variable = ts.createVariableDeclaration(name_32, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2);\n            variable.original = original;\n            if (ts.isIdentifier(name_32)) {\n                ts.setEmitFlags(variable, 64);\n            }\n            ts.aggregateTransformFlags(variable);\n            declarations.push(variable);\n        }\n        return declarations;\n        function emitExpression(value) {\n            pendingExpressions = ts.append(pendingExpressions, value);\n        }\n        function emitBindingOrAssignment(target, value, location, original) {\n            ts.Debug.assertNode(target, ts.isBindingName);\n            if (pendingExpressions) {\n                value = ts.inlineExpressions(ts.append(pendingExpressions, value));\n                pendingExpressions = undefined;\n            }\n            pendingDeclarations.push({ pendingExpressions: pendingExpressions, name: target, value: value, location: location, original: original });\n        }\n    }\n    ts.flattenDestructuringBinding = flattenDestructuringBinding;\n    function flattenBindingOrAssignmentElement(flattenContext, element, value, location, skipInitializer) {\n        if (!skipInitializer) {\n            var initializer = ts.visitNode(ts.getInitializerOfBindingOrAssignmentElement(element), flattenContext.visitor, ts.isExpression);\n            if (initializer) {\n                value = value ? createDefaultValueCheck(flattenContext, value, initializer, location) : initializer;\n            }\n            else if (!value) {\n                value = ts.createVoidZero();\n            }\n        }\n        var bindingTarget = ts.getTargetOfBindingOrAssignmentElement(element);\n        if (ts.isObjectBindingOrAssignmentPattern(bindingTarget)) {\n            flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);\n        }\n        else if (ts.isArrayBindingOrAssignmentPattern(bindingTarget)) {\n            flattenArrayBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);\n        }\n        else {\n            flattenContext.emitBindingOrAssignment(bindingTarget, value, location, element);\n        }\n    }\n    function flattenObjectBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {\n        var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);\n        var numElements = elements.length;\n        if (numElements !== 1) {\n            var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;\n            value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);\n        }\n        var bindingElements;\n        var computedTempVariables;\n        for (var i = 0; i < numElements; i++) {\n            var element = elements[i];\n            if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {\n                var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(element);\n                if (flattenContext.level >= 1\n                    && !(element.transformFlags & (524288 | 1048576))\n                    && !(ts.getTargetOfBindingOrAssignmentElement(element).transformFlags & (524288 | 1048576))\n                    && !ts.isComputedPropertyName(propertyName)) {\n                    bindingElements = ts.append(bindingElements, element);\n                }\n                else {\n                    if (bindingElements) {\n                        flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);\n                        bindingElements = undefined;\n                    }\n                    var rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName);\n                    if (ts.isComputedPropertyName(propertyName)) {\n                        computedTempVariables = ts.append(computedTempVariables, rhsValue.argumentExpression);\n                    }\n                    flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);\n                }\n            }\n            else if (i === numElements - 1) {\n                if (bindingElements) {\n                    flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);\n                    bindingElements = undefined;\n                }\n                var rhsValue = createRestCall(flattenContext.context, value, elements, computedTempVariables, pattern);\n                flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);\n            }\n        }\n        if (bindingElements) {\n            flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);\n        }\n    }\n    function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {\n        var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);\n        var numElements = elements.length;\n        if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0)) {\n            var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;\n            value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);\n        }\n        var bindingElements;\n        var restContainingElements;\n        for (var i = 0; i < numElements; i++) {\n            var element = elements[i];\n            if (flattenContext.level >= 1) {\n                if (element.transformFlags & 1048576) {\n                    var temp = ts.createTempVariable(undefined);\n                    if (flattenContext.hoistTempVariables) {\n                        flattenContext.context.hoistVariableDeclaration(temp);\n                    }\n                    restContainingElements = ts.append(restContainingElements, [temp, element]);\n                    bindingElements = ts.append(bindingElements, flattenContext.createArrayBindingOrAssignmentElement(temp));\n                }\n                else {\n                    bindingElements = ts.append(bindingElements, element);\n                }\n            }\n            else if (ts.isOmittedExpression(element)) {\n                continue;\n            }\n            else if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {\n                var rhsValue = ts.createElementAccess(value, i);\n                flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);\n            }\n            else if (i === numElements - 1) {\n                var rhsValue = ts.createArraySlice(value, i);\n                flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);\n            }\n        }\n        if (bindingElements) {\n            flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern);\n        }\n        if (restContainingElements) {\n            for (var _i = 0, restContainingElements_1 = restContainingElements; _i < restContainingElements_1.length; _i++) {\n                var _a = restContainingElements_1[_i], id = _a[0], element = _a[1];\n                flattenBindingOrAssignmentElement(flattenContext, element, id, element);\n            }\n        }\n    }\n    function createDefaultValueCheck(flattenContext, value, defaultValue, location) {\n        value = ensureIdentifier(flattenContext, value, true, location);\n        return ts.createConditional(ts.createTypeCheck(value, \"undefined\"), defaultValue, value);\n    }\n    function createDestructuringPropertyAccess(flattenContext, value, propertyName) {\n        if (ts.isComputedPropertyName(propertyName)) {\n            var argumentExpression = ensureIdentifier(flattenContext, propertyName.expression, false, propertyName);\n            return ts.createElementAccess(value, argumentExpression);\n        }\n        else if (ts.isStringOrNumericLiteral(propertyName)) {\n            var argumentExpression = ts.getSynthesizedClone(propertyName);\n            argumentExpression.text = ts.unescapeIdentifier(argumentExpression.text);\n            return ts.createElementAccess(value, argumentExpression);\n        }\n        else {\n            var name_33 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text));\n            return ts.createPropertyAccess(value, name_33);\n        }\n    }\n    function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) {\n        if (ts.isIdentifier(value) && reuseIdentifierExpressions) {\n            return value;\n        }\n        else {\n            var temp = ts.createTempVariable(undefined);\n            if (flattenContext.hoistTempVariables) {\n                flattenContext.context.hoistVariableDeclaration(temp);\n                flattenContext.emitExpression(ts.createAssignment(temp, value, location));\n            }\n            else {\n                flattenContext.emitBindingOrAssignment(temp, value, location, undefined);\n            }\n            return temp;\n        }\n    }\n    function makeArrayBindingPattern(elements) {\n        ts.Debug.assertEachNode(elements, ts.isArrayBindingElement);\n        return ts.createArrayBindingPattern(elements);\n    }\n    function makeArrayAssignmentPattern(elements) {\n        return ts.createArrayLiteral(ts.map(elements, ts.convertToArrayAssignmentElement));\n    }\n    function makeObjectBindingPattern(elements) {\n        ts.Debug.assertEachNode(elements, ts.isBindingElement);\n        return ts.createObjectBindingPattern(elements);\n    }\n    function makeObjectAssignmentPattern(elements) {\n        return ts.createObjectLiteral(ts.map(elements, ts.convertToObjectAssignmentElement));\n    }\n    function makeBindingElement(name) {\n        return ts.createBindingElement(undefined, undefined, name);\n    }\n    function makeAssignmentElement(name) {\n        return name;\n    }\n    var restHelper = {\n        name: \"typescript:rest\",\n        scoped: false,\n        text: \"\\n            var __rest = (this && this.__rest) || function (s, e) {\\n                var t = {};\\n                for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\\n                    t[p] = s[p];\\n                if (s != null && typeof Object.getOwnPropertySymbols === \\\"function\\\")\\n                    for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\\n                        t[p[i]] = s[p[i]];\\n                return t;\\n            };\"\n    };\n    function createRestCall(context, value, elements, computedTempVariables, location) {\n        context.requestEmitHelper(restHelper);\n        var propertyNames = [];\n        var computedTempVariableOffset = 0;\n        for (var i = 0; i < elements.length - 1; i++) {\n            var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(elements[i]);\n            if (propertyName) {\n                if (ts.isComputedPropertyName(propertyName)) {\n                    var temp = computedTempVariables[computedTempVariableOffset];\n                    computedTempVariableOffset++;\n                    propertyNames.push(ts.createConditional(ts.createTypeCheck(temp, \"symbol\"), temp, ts.createAdd(temp, ts.createLiteral(\"\"))));\n                }\n                else {\n                    propertyNames.push(ts.createLiteral(propertyName));\n                }\n            }\n        }\n        return ts.createCall(ts.getHelperName(\"__rest\"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]);\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var USE_NEW_TYPE_METADATA_FORMAT = false;\n    function transformTypeScript(context) {\n        var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;\n        var resolver = context.getEmitResolver();\n        var compilerOptions = context.getCompilerOptions();\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        var moduleKind = ts.getEmitModuleKind(compilerOptions);\n        var previousOnEmitNode = context.onEmitNode;\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        context.onEmitNode = onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        context.enableSubstitution(177);\n        context.enableSubstitution(178);\n        var currentSourceFile;\n        var currentNamespace;\n        var currentNamespaceContainerName;\n        var currentScope;\n        var currentScopeFirstDeclarationsOfName;\n        var enabledSubstitutions;\n        var classAliases;\n        var applicableSubstitutions;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            currentSourceFile = node;\n            var visited = saveStateAndInvoke(node, visitSourceFile);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            currentSourceFile = undefined;\n            return visited;\n        }\n        function saveStateAndInvoke(node, f) {\n            var savedCurrentScope = currentScope;\n            var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;\n            onBeforeVisitNode(node);\n            var visited = f(node);\n            if (currentScope !== savedCurrentScope) {\n                currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;\n            }\n            currentScope = savedCurrentScope;\n            return visited;\n        }\n        function onBeforeVisitNode(node) {\n            switch (node.kind) {\n                case 261:\n                case 232:\n                case 231:\n                case 204:\n                    currentScope = node;\n                    currentScopeFirstDeclarationsOfName = undefined;\n                    break;\n                case 226:\n                case 225:\n                    if (ts.hasModifier(node, 2)) {\n                        break;\n                    }\n                    recordEmittedDeclarationInScope(node);\n                    break;\n            }\n        }\n        function visitor(node) {\n            return saveStateAndInvoke(node, visitorWorker);\n        }\n        function visitorWorker(node) {\n            if (node.transformFlags & 1) {\n                return visitTypeScript(node);\n            }\n            else if (node.transformFlags & 2) {\n                return ts.visitEachChild(node, visitor, context);\n            }\n            return node;\n        }\n        function sourceElementVisitor(node) {\n            return saveStateAndInvoke(node, sourceElementVisitorWorker);\n        }\n        function sourceElementVisitorWorker(node) {\n            switch (node.kind) {\n                case 235:\n                    return visitImportDeclaration(node);\n                case 234:\n                    return visitImportEqualsDeclaration(node);\n                case 240:\n                    return visitExportAssignment(node);\n                case 241:\n                    return visitExportDeclaration(node);\n                default:\n                    return visitorWorker(node);\n            }\n        }\n        function namespaceElementVisitor(node) {\n            return saveStateAndInvoke(node, namespaceElementVisitorWorker);\n        }\n        function namespaceElementVisitorWorker(node) {\n            if (node.kind === 241 ||\n                node.kind === 235 ||\n                node.kind === 236 ||\n                (node.kind === 234 &&\n                    node.moduleReference.kind === 245)) {\n                return undefined;\n            }\n            else if (node.transformFlags & 1 || ts.hasModifier(node, 1)) {\n                return visitTypeScript(node);\n            }\n            else if (node.transformFlags & 2) {\n                return ts.visitEachChild(node, visitor, context);\n            }\n            return node;\n        }\n        function classElementVisitor(node) {\n            return saveStateAndInvoke(node, classElementVisitorWorker);\n        }\n        function classElementVisitorWorker(node) {\n            switch (node.kind) {\n                case 150:\n                    return undefined;\n                case 147:\n                case 155:\n                case 151:\n                case 152:\n                case 149:\n                    return visitorWorker(node);\n                case 203:\n                    return node;\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    return undefined;\n            }\n        }\n        function modifierVisitor(node) {\n            if (ts.modifierToFlag(node.kind) & 2270) {\n                return undefined;\n            }\n            else if (currentNamespace && node.kind === 83) {\n                return undefined;\n            }\n            return node;\n        }\n        function visitTypeScript(node) {\n            if (ts.hasModifier(node, 2) && ts.isStatement(node)) {\n                return ts.createNotEmittedStatement(node);\n            }\n            switch (node.kind) {\n                case 83:\n                case 78:\n                    return currentNamespace ? undefined : node;\n                case 113:\n                case 111:\n                case 112:\n                case 116:\n                case 75:\n                case 123:\n                case 130:\n                case 162:\n                case 163:\n                case 161:\n                case 156:\n                case 143:\n                case 118:\n                case 121:\n                case 134:\n                case 132:\n                case 129:\n                case 104:\n                case 135:\n                case 159:\n                case 158:\n                case 160:\n                case 157:\n                case 164:\n                case 165:\n                case 166:\n                case 167:\n                case 168:\n                case 169:\n                case 170:\n                case 171:\n                case 155:\n                case 145:\n                case 228:\n                case 147:\n                    return undefined;\n                case 150:\n                    return visitConstructor(node);\n                case 227:\n                    return ts.createNotEmittedStatement(node);\n                case 226:\n                    return visitClassDeclaration(node);\n                case 197:\n                    return visitClassExpression(node);\n                case 255:\n                    return visitHeritageClause(node);\n                case 199:\n                    return visitExpressionWithTypeArguments(node);\n                case 149:\n                    return visitMethodDeclaration(node);\n                case 151:\n                    return visitGetAccessor(node);\n                case 152:\n                    return visitSetAccessor(node);\n                case 225:\n                    return visitFunctionDeclaration(node);\n                case 184:\n                    return visitFunctionExpression(node);\n                case 185:\n                    return visitArrowFunction(node);\n                case 144:\n                    return visitParameter(node);\n                case 183:\n                    return visitParenthesizedExpression(node);\n                case 182:\n                case 200:\n                    return visitAssertionExpression(node);\n                case 179:\n                    return visitCallExpression(node);\n                case 180:\n                    return visitNewExpression(node);\n                case 201:\n                    return visitNonNullExpression(node);\n                case 229:\n                    return visitEnumDeclaration(node);\n                case 205:\n                    return visitVariableStatement(node);\n                case 223:\n                    return visitVariableDeclaration(node);\n                case 230:\n                    return visitModuleDeclaration(node);\n                case 234:\n                    return visitImportEqualsDeclaration(node);\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitSourceFile(node) {\n            var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015);\n            return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, 0, alwaysStrict));\n        }\n        function shouldEmitDecorateCallForClass(node) {\n            if (node.decorators && node.decorators.length > 0) {\n                return true;\n            }\n            var constructor = ts.getFirstConstructorWithBody(node);\n            if (constructor) {\n                return ts.forEach(constructor.parameters, shouldEmitDecorateCallForParameter);\n            }\n            return false;\n        }\n        function shouldEmitDecorateCallForParameter(parameter) {\n            return parameter.decorators !== undefined && parameter.decorators.length > 0;\n        }\n        function visitClassDeclaration(node) {\n            var staticProperties = getInitializedProperties(node, true);\n            var hasExtendsClause = ts.getClassExtendsHeritageClauseElement(node) !== undefined;\n            var isDecoratedClass = shouldEmitDecorateCallForClass(node);\n            var name = node.name;\n            if (!name && staticProperties.length > 0) {\n                name = ts.getGeneratedNameForNode(node);\n            }\n            var classStatement = isDecoratedClass\n                ? createClassDeclarationHeadWithDecorators(node, name, hasExtendsClause)\n                : createClassDeclarationHeadWithoutDecorators(node, name, hasExtendsClause, staticProperties.length > 0);\n            var statements = [classStatement];\n            if (staticProperties.length) {\n                addInitializedPropertyStatements(statements, staticProperties, ts.getLocalName(node));\n            }\n            addClassElementDecorationStatements(statements, node, false);\n            addClassElementDecorationStatements(statements, node, true);\n            addConstructorDecorationStatement(statements, node);\n            if (isNamespaceExport(node)) {\n                addExportMemberAssignment(statements, node);\n            }\n            else if (isDecoratedClass) {\n                if (isDefaultExternalModuleExport(node)) {\n                    statements.push(ts.createExportDefault(ts.getLocalName(node, false, true)));\n                }\n                else if (isNamedExternalModuleExport(node)) {\n                    statements.push(ts.createExternalModuleExport(ts.getLocalName(node, false, true)));\n                }\n            }\n            if (statements.length > 1) {\n                statements.push(ts.createEndOfDeclarationMarker(node));\n                ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 2097152);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function createClassDeclarationHeadWithoutDecorators(node, name, hasExtendsClause, hasStaticProperties) {\n            var classDeclaration = ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause), node);\n            var emitFlags = ts.getEmitFlags(node);\n            if (hasStaticProperties) {\n                emitFlags |= 32;\n            }\n            ts.setOriginalNode(classDeclaration, node);\n            ts.setEmitFlags(classDeclaration, emitFlags);\n            return classDeclaration;\n        }\n        function createClassDeclarationHeadWithDecorators(node, name, hasExtendsClause) {\n            var location = ts.moveRangePastDecorators(node);\n            var classAlias = getClassAliasIfNeeded(node);\n            var declName = ts.getLocalName(node, false, true);\n            var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);\n            var members = transformClassMembers(node, hasExtendsClause);\n            var classExpression = ts.createClassExpression(undefined, name, undefined, heritageClauses, members, location);\n            ts.setOriginalNode(classExpression, node);\n            var statement = ts.createLetStatement(declName, classAlias ? ts.createAssignment(classAlias, classExpression) : classExpression, location);\n            ts.setOriginalNode(statement, node);\n            ts.setCommentRange(statement, node);\n            return statement;\n        }\n        function visitClassExpression(node) {\n            var staticProperties = getInitializedProperties(node, true);\n            var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);\n            var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 84; }));\n            var classExpression = ts.setOriginalNode(ts.createClassExpression(undefined, node.name, undefined, heritageClauses, members, node), node);\n            if (staticProperties.length > 0) {\n                var expressions = [];\n                var temp = ts.createTempVariable(hoistVariableDeclaration);\n                if (resolver.getNodeCheckFlags(node) & 8388608) {\n                    enableSubstitutionForClassAliases();\n                    classAliases[ts.getOriginalNodeId(node)] = ts.getSynthesizedClone(temp);\n                }\n                ts.setEmitFlags(classExpression, 32768 | ts.getEmitFlags(classExpression));\n                expressions.push(ts.startOnNewLine(ts.createAssignment(temp, classExpression)));\n                ts.addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp));\n                expressions.push(ts.startOnNewLine(temp));\n                return ts.inlineExpressions(expressions);\n            }\n            return classExpression;\n        }\n        function transformClassMembers(node, hasExtendsClause) {\n            var members = [];\n            var constructor = transformConstructor(node, hasExtendsClause);\n            if (constructor) {\n                members.push(constructor);\n            }\n            ts.addRange(members, ts.visitNodes(node.members, classElementVisitor, ts.isClassElement));\n            return ts.createNodeArray(members, node.members);\n        }\n        function transformConstructor(node, hasExtendsClause) {\n            var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty);\n            var hasParameterPropertyAssignments = node.transformFlags & 262144;\n            var constructor = ts.getFirstConstructorWithBody(node);\n            if (!hasInstancePropertyWithInitializer && !hasParameterPropertyAssignments) {\n                return ts.visitEachChild(constructor, visitor, context);\n            }\n            var parameters = transformConstructorParameters(constructor);\n            var body = transformConstructorBody(node, constructor, hasExtendsClause);\n            return ts.startOnNewLine(ts.setOriginalNode(ts.createConstructor(undefined, undefined, parameters, body, constructor || node), constructor));\n        }\n        function transformConstructorParameters(constructor) {\n            return ts.visitParameterList(constructor && constructor.parameters, visitor, context)\n                || [];\n        }\n        function transformConstructorBody(node, constructor, hasExtendsClause) {\n            var statements = [];\n            var indexOfFirstStatement = 0;\n            resumeLexicalEnvironment();\n            if (constructor) {\n                indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements);\n                var propertyAssignments = getParametersWithPropertyAssignments(constructor);\n                ts.addRange(statements, ts.map(propertyAssignments, transformParameterWithPropertyAssignment));\n            }\n            else if (hasExtendsClause) {\n                statements.push(ts.createStatement(ts.createCall(ts.createSuper(), undefined, [ts.createSpread(ts.createIdentifier(\"arguments\"))])));\n            }\n            var properties = getInitializedProperties(node, false);\n            addInitializedPropertyStatements(statements, properties, ts.createThis());\n            if (constructor) {\n                ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement));\n            }\n            ts.addRange(statements, endLexicalEnvironment());\n            return ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : undefined, true);\n        }\n        function addPrologueDirectivesAndInitialSuperCall(ctor, result) {\n            if (ctor.body) {\n                var statements = ctor.body.statements;\n                var index = ts.addPrologueDirectives(result, statements, false, visitor);\n                if (index === statements.length) {\n                    return index;\n                }\n                var statement = statements[index];\n                if (statement.kind === 207 && ts.isSuperCall(statement.expression)) {\n                    result.push(ts.visitNode(statement, visitor, ts.isStatement));\n                    return index + 1;\n                }\n                return index;\n            }\n            return 0;\n        }\n        function getParametersWithPropertyAssignments(node) {\n            return ts.filter(node.parameters, isParameterWithPropertyAssignment);\n        }\n        function isParameterWithPropertyAssignment(parameter) {\n            return ts.hasModifier(parameter, 92)\n                && ts.isIdentifier(parameter.name);\n        }\n        function transformParameterWithPropertyAssignment(node) {\n            ts.Debug.assert(ts.isIdentifier(node.name));\n            var name = node.name;\n            var propertyName = ts.getMutableClone(name);\n            ts.setEmitFlags(propertyName, 1536 | 48);\n            var localName = ts.getMutableClone(name);\n            ts.setEmitFlags(localName, 1536);\n            return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName, node.name), localName), ts.moveRangePos(node, -1)));\n        }\n        function getInitializedProperties(node, isStatic) {\n            return ts.filter(node.members, isStatic ? isStaticInitializedProperty : isInstanceInitializedProperty);\n        }\n        function isStaticInitializedProperty(member) {\n            return isInitializedProperty(member, true);\n        }\n        function isInstanceInitializedProperty(member) {\n            return isInitializedProperty(member, false);\n        }\n        function isInitializedProperty(member, isStatic) {\n            return member.kind === 147\n                && isStatic === ts.hasModifier(member, 32)\n                && member.initializer !== undefined;\n        }\n        function addInitializedPropertyStatements(statements, properties, receiver) {\n            for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) {\n                var property = properties_8[_i];\n                var statement = ts.createStatement(transformInitializedProperty(property, receiver));\n                ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property));\n                ts.setCommentRange(statement, property);\n                statements.push(statement);\n            }\n        }\n        function generateInitializedPropertyExpressions(properties, receiver) {\n            var expressions = [];\n            for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) {\n                var property = properties_9[_i];\n                var expression = transformInitializedProperty(property, receiver);\n                expression.startsOnNewLine = true;\n                ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property));\n                ts.setCommentRange(expression, property);\n                expressions.push(expression);\n            }\n            return expressions;\n        }\n        function transformInitializedProperty(property, receiver) {\n            var propertyName = visitPropertyNameOfClassElement(property);\n            var initializer = ts.visitNode(property.initializer, visitor, ts.isExpression);\n            var memberAccess = ts.createMemberAccessForPropertyName(receiver, propertyName, propertyName);\n            return ts.createAssignment(memberAccess, initializer);\n        }\n        function getDecoratedClassElements(node, isStatic) {\n            return ts.filter(node.members, isStatic ? isStaticDecoratedClassElement : isInstanceDecoratedClassElement);\n        }\n        function isStaticDecoratedClassElement(member) {\n            return isDecoratedClassElement(member, true);\n        }\n        function isInstanceDecoratedClassElement(member) {\n            return isDecoratedClassElement(member, false);\n        }\n        function isDecoratedClassElement(member, isStatic) {\n            return ts.nodeOrChildIsDecorated(member)\n                && isStatic === ts.hasModifier(member, 32);\n        }\n        function getDecoratorsOfParameters(node) {\n            var decorators;\n            if (node) {\n                var parameters = node.parameters;\n                for (var i = 0; i < parameters.length; i++) {\n                    var parameter = parameters[i];\n                    if (decorators || parameter.decorators) {\n                        if (!decorators) {\n                            decorators = new Array(parameters.length);\n                        }\n                        decorators[i] = parameter.decorators;\n                    }\n                }\n            }\n            return decorators;\n        }\n        function getAllDecoratorsOfConstructor(node) {\n            var decorators = node.decorators;\n            var parameters = getDecoratorsOfParameters(ts.getFirstConstructorWithBody(node));\n            if (!decorators && !parameters) {\n                return undefined;\n            }\n            return {\n                decorators: decorators,\n                parameters: parameters\n            };\n        }\n        function getAllDecoratorsOfClassElement(node, member) {\n            switch (member.kind) {\n                case 151:\n                case 152:\n                    return getAllDecoratorsOfAccessors(node, member);\n                case 149:\n                    return getAllDecoratorsOfMethod(member);\n                case 147:\n                    return getAllDecoratorsOfProperty(member);\n                default:\n                    return undefined;\n            }\n        }\n        function getAllDecoratorsOfAccessors(node, accessor) {\n            if (!accessor.body) {\n                return undefined;\n            }\n            var _a = ts.getAllAccessorDeclarations(node.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, setAccessor = _a.setAccessor;\n            if (accessor !== firstAccessor) {\n                return undefined;\n            }\n            var decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators);\n            var parameters = getDecoratorsOfParameters(setAccessor);\n            if (!decorators && !parameters) {\n                return undefined;\n            }\n            return { decorators: decorators, parameters: parameters };\n        }\n        function getAllDecoratorsOfMethod(method) {\n            if (!method.body) {\n                return undefined;\n            }\n            var decorators = method.decorators;\n            var parameters = getDecoratorsOfParameters(method);\n            if (!decorators && !parameters) {\n                return undefined;\n            }\n            return { decorators: decorators, parameters: parameters };\n        }\n        function getAllDecoratorsOfProperty(property) {\n            var decorators = property.decorators;\n            if (!decorators) {\n                return undefined;\n            }\n            return { decorators: decorators };\n        }\n        function transformAllDecoratorsOfDeclaration(node, allDecorators) {\n            if (!allDecorators) {\n                return undefined;\n            }\n            var decoratorExpressions = [];\n            ts.addRange(decoratorExpressions, ts.map(allDecorators.decorators, transformDecorator));\n            ts.addRange(decoratorExpressions, ts.flatMap(allDecorators.parameters, transformDecoratorsOfParameter));\n            addTypeMetadata(node, decoratorExpressions);\n            return decoratorExpressions;\n        }\n        function addClassElementDecorationStatements(statements, node, isStatic) {\n            ts.addRange(statements, ts.map(generateClassElementDecorationExpressions(node, isStatic), expressionToStatement));\n        }\n        function generateClassElementDecorationExpressions(node, isStatic) {\n            var members = getDecoratedClassElements(node, isStatic);\n            var expressions;\n            for (var _i = 0, members_2 = members; _i < members_2.length; _i++) {\n                var member = members_2[_i];\n                var expression = generateClassElementDecorationExpression(node, member);\n                if (expression) {\n                    if (!expressions) {\n                        expressions = [expression];\n                    }\n                    else {\n                        expressions.push(expression);\n                    }\n                }\n            }\n            return expressions;\n        }\n        function generateClassElementDecorationExpression(node, member) {\n            var allDecorators = getAllDecoratorsOfClassElement(node, member);\n            var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators);\n            if (!decoratorExpressions) {\n                return undefined;\n            }\n            var prefix = getClassMemberPrefix(node, member);\n            var memberName = getExpressionForPropertyName(member, true);\n            var descriptor = languageVersion > 0\n                ? member.kind === 147\n                    ? ts.createVoidZero()\n                    : ts.createNull()\n                : undefined;\n            var helper = createDecorateHelper(context, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member));\n            ts.setEmitFlags(helper, 1536);\n            return helper;\n        }\n        function addConstructorDecorationStatement(statements, node) {\n            var expression = generateConstructorDecorationExpression(node);\n            if (expression) {\n                statements.push(ts.setOriginalNode(ts.createStatement(expression), node));\n            }\n        }\n        function generateConstructorDecorationExpression(node) {\n            var allDecorators = getAllDecoratorsOfConstructor(node);\n            var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators);\n            if (!decoratorExpressions) {\n                return undefined;\n            }\n            var classAlias = classAliases && classAliases[ts.getOriginalNodeId(node)];\n            var localName = ts.getLocalName(node, false, true);\n            var decorate = createDecorateHelper(context, decoratorExpressions, localName);\n            var expression = ts.createAssignment(localName, classAlias ? ts.createAssignment(classAlias, decorate) : decorate);\n            ts.setEmitFlags(expression, 1536);\n            ts.setSourceMapRange(expression, ts.moveRangePastDecorators(node));\n            return expression;\n        }\n        function transformDecorator(decorator) {\n            return ts.visitNode(decorator.expression, visitor, ts.isExpression);\n        }\n        function transformDecoratorsOfParameter(decorators, parameterOffset) {\n            var expressions;\n            if (decorators) {\n                expressions = [];\n                for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) {\n                    var decorator = decorators_1[_i];\n                    var helper = createParamHelper(context, transformDecorator(decorator), parameterOffset, decorator.expression);\n                    ts.setEmitFlags(helper, 1536);\n                    expressions.push(helper);\n                }\n            }\n            return expressions;\n        }\n        function addTypeMetadata(node, decoratorExpressions) {\n            if (USE_NEW_TYPE_METADATA_FORMAT) {\n                addNewTypeMetadata(node, decoratorExpressions);\n            }\n            else {\n                addOldTypeMetadata(node, decoratorExpressions);\n            }\n        }\n        function addOldTypeMetadata(node, decoratorExpressions) {\n            if (compilerOptions.emitDecoratorMetadata) {\n                if (shouldAddTypeMetadata(node)) {\n                    decoratorExpressions.push(createMetadataHelper(context, \"design:type\", serializeTypeOfNode(node)));\n                }\n                if (shouldAddParamTypesMetadata(node)) {\n                    decoratorExpressions.push(createMetadataHelper(context, \"design:paramtypes\", serializeParameterTypesOfNode(node)));\n                }\n                if (shouldAddReturnTypeMetadata(node)) {\n                    decoratorExpressions.push(createMetadataHelper(context, \"design:returntype\", serializeReturnTypeOfNode(node)));\n                }\n            }\n        }\n        function addNewTypeMetadata(node, decoratorExpressions) {\n            if (compilerOptions.emitDecoratorMetadata) {\n                var properties = void 0;\n                if (shouldAddTypeMetadata(node)) {\n                    (properties || (properties = [])).push(ts.createPropertyAssignment(\"type\", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeTypeOfNode(node))));\n                }\n                if (shouldAddParamTypesMetadata(node)) {\n                    (properties || (properties = [])).push(ts.createPropertyAssignment(\"paramTypes\", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeParameterTypesOfNode(node))));\n                }\n                if (shouldAddReturnTypeMetadata(node)) {\n                    (properties || (properties = [])).push(ts.createPropertyAssignment(\"returnType\", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeReturnTypeOfNode(node))));\n                }\n                if (properties) {\n                    decoratorExpressions.push(createMetadataHelper(context, \"design:typeinfo\", ts.createObjectLiteral(properties, undefined, true)));\n                }\n            }\n        }\n        function shouldAddTypeMetadata(node) {\n            var kind = node.kind;\n            return kind === 149\n                || kind === 151\n                || kind === 152\n                || kind === 147;\n        }\n        function shouldAddReturnTypeMetadata(node) {\n            return node.kind === 149;\n        }\n        function shouldAddParamTypesMetadata(node) {\n            var kind = node.kind;\n            return kind === 226\n                || kind === 197\n                || kind === 149\n                || kind === 151\n                || kind === 152;\n        }\n        function serializeTypeOfNode(node) {\n            switch (node.kind) {\n                case 147:\n                case 144:\n                case 151:\n                    return serializeTypeNode(node.type);\n                case 152:\n                    return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node));\n                case 226:\n                case 197:\n                case 149:\n                    return ts.createIdentifier(\"Function\");\n                default:\n                    return ts.createVoidZero();\n            }\n        }\n        function getRestParameterElementType(node) {\n            if (node && node.kind === 162) {\n                return node.elementType;\n            }\n            else if (node && node.kind === 157) {\n                return ts.singleOrUndefined(node.typeArguments);\n            }\n            else {\n                return undefined;\n            }\n        }\n        function serializeParameterTypesOfNode(node) {\n            var valueDeclaration = ts.isClassLike(node)\n                ? ts.getFirstConstructorWithBody(node)\n                : ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)\n                    ? node\n                    : undefined;\n            var expressions = [];\n            if (valueDeclaration) {\n                var parameters = valueDeclaration.parameters;\n                var numParameters = parameters.length;\n                for (var i = 0; i < numParameters; i++) {\n                    var parameter = parameters[i];\n                    if (i === 0 && ts.isIdentifier(parameter.name) && parameter.name.text === \"this\") {\n                        continue;\n                    }\n                    if (parameter.dotDotDotToken) {\n                        expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type)));\n                    }\n                    else {\n                        expressions.push(serializeTypeOfNode(parameter));\n                    }\n                }\n            }\n            return ts.createArrayLiteral(expressions);\n        }\n        function serializeReturnTypeOfNode(node) {\n            if (ts.isFunctionLike(node) && node.type) {\n                return serializeTypeNode(node.type);\n            }\n            else if (ts.isAsyncFunctionLike(node)) {\n                return ts.createIdentifier(\"Promise\");\n            }\n            return ts.createVoidZero();\n        }\n        function serializeTypeNode(node) {\n            if (node === undefined) {\n                return ts.createIdentifier(\"Object\");\n            }\n            switch (node.kind) {\n                case 104:\n                    return ts.createVoidZero();\n                case 166:\n                    return serializeTypeNode(node.type);\n                case 158:\n                case 159:\n                    return ts.createIdentifier(\"Function\");\n                case 162:\n                case 163:\n                    return ts.createIdentifier(\"Array\");\n                case 156:\n                case 121:\n                    return ts.createIdentifier(\"Boolean\");\n                case 134:\n                    return ts.createIdentifier(\"String\");\n                case 171:\n                    switch (node.literal.kind) {\n                        case 9:\n                            return ts.createIdentifier(\"String\");\n                        case 8:\n                            return ts.createIdentifier(\"Number\");\n                        case 100:\n                        case 85:\n                            return ts.createIdentifier(\"Boolean\");\n                        default:\n                            ts.Debug.failBadSyntaxKind(node.literal);\n                            break;\n                    }\n                    break;\n                case 132:\n                    return ts.createIdentifier(\"Number\");\n                case 135:\n                    return languageVersion < 2\n                        ? getGlobalSymbolNameWithFallback()\n                        : ts.createIdentifier(\"Symbol\");\n                case 157:\n                    return serializeTypeReferenceNode(node);\n                case 165:\n                case 164:\n                    {\n                        var unionOrIntersection = node;\n                        var serializedUnion = void 0;\n                        for (var _i = 0, _a = unionOrIntersection.types; _i < _a.length; _i++) {\n                            var typeNode = _a[_i];\n                            var serializedIndividual = serializeTypeNode(typeNode);\n                            if (serializedIndividual.kind !== 70) {\n                                serializedUnion = undefined;\n                                break;\n                            }\n                            if (serializedIndividual.text === \"Object\") {\n                                return serializedIndividual;\n                            }\n                            if (serializedUnion && serializedUnion.text !== serializedIndividual.text) {\n                                serializedUnion = undefined;\n                                break;\n                            }\n                            serializedUnion = serializedIndividual;\n                        }\n                        if (serializedUnion) {\n                            return serializedUnion;\n                        }\n                    }\n                case 160:\n                case 168:\n                case 169:\n                case 170:\n                case 161:\n                case 118:\n                case 167:\n                    break;\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    break;\n            }\n            return ts.createIdentifier(\"Object\");\n        }\n        function serializeTypeReferenceNode(node) {\n            switch (resolver.getTypeReferenceSerializationKind(node.typeName, currentScope)) {\n                case ts.TypeReferenceSerializationKind.Unknown:\n                    var serialized = serializeEntityNameAsExpression(node.typeName, true);\n                    var temp = ts.createTempVariable(hoistVariableDeclaration);\n                    return ts.createLogicalOr(ts.createLogicalAnd(ts.createTypeCheck(ts.createAssignment(temp, serialized), \"function\"), temp), ts.createIdentifier(\"Object\"));\n                case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue:\n                    return serializeEntityNameAsExpression(node.typeName, false);\n                case ts.TypeReferenceSerializationKind.VoidNullableOrNeverType:\n                    return ts.createVoidZero();\n                case ts.TypeReferenceSerializationKind.BooleanType:\n                    return ts.createIdentifier(\"Boolean\");\n                case ts.TypeReferenceSerializationKind.NumberLikeType:\n                    return ts.createIdentifier(\"Number\");\n                case ts.TypeReferenceSerializationKind.StringLikeType:\n                    return ts.createIdentifier(\"String\");\n                case ts.TypeReferenceSerializationKind.ArrayLikeType:\n                    return ts.createIdentifier(\"Array\");\n                case ts.TypeReferenceSerializationKind.ESSymbolType:\n                    return languageVersion < 2\n                        ? getGlobalSymbolNameWithFallback()\n                        : ts.createIdentifier(\"Symbol\");\n                case ts.TypeReferenceSerializationKind.TypeWithCallSignature:\n                    return ts.createIdentifier(\"Function\");\n                case ts.TypeReferenceSerializationKind.Promise:\n                    return ts.createIdentifier(\"Promise\");\n                case ts.TypeReferenceSerializationKind.ObjectType:\n                default:\n                    return ts.createIdentifier(\"Object\");\n            }\n        }\n        function serializeEntityNameAsExpression(node, useFallback) {\n            switch (node.kind) {\n                case 70:\n                    var name_34 = ts.getMutableClone(node);\n                    name_34.flags &= ~8;\n                    name_34.original = undefined;\n                    name_34.parent = currentScope;\n                    if (useFallback) {\n                        return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_34), ts.createLiteral(\"undefined\")), name_34);\n                    }\n                    return name_34;\n                case 141:\n                    return serializeQualifiedNameAsExpression(node, useFallback);\n            }\n        }\n        function serializeQualifiedNameAsExpression(node, useFallback) {\n            var left;\n            if (node.left.kind === 70) {\n                left = serializeEntityNameAsExpression(node.left, useFallback);\n            }\n            else if (useFallback) {\n                var temp = ts.createTempVariable(hoistVariableDeclaration);\n                left = ts.createLogicalAnd(ts.createAssignment(temp, serializeEntityNameAsExpression(node.left, true)), temp);\n            }\n            else {\n                left = serializeEntityNameAsExpression(node.left, false);\n            }\n            return ts.createPropertyAccess(left, node.right);\n        }\n        function getGlobalSymbolNameWithFallback() {\n            return ts.createConditional(ts.createTypeCheck(ts.createIdentifier(\"Symbol\"), \"function\"), ts.createIdentifier(\"Symbol\"), ts.createIdentifier(\"Object\"));\n        }\n        function getExpressionForPropertyName(member, generateNameForComputedPropertyName) {\n            var name = member.name;\n            if (ts.isComputedPropertyName(name)) {\n                return generateNameForComputedPropertyName\n                    ? ts.getGeneratedNameForNode(name)\n                    : name.expression;\n            }\n            else if (ts.isIdentifier(name)) {\n                return ts.createLiteral(ts.unescapeIdentifier(name.text));\n            }\n            else {\n                return ts.getSynthesizedClone(name);\n            }\n        }\n        function visitPropertyNameOfClassElement(member) {\n            var name = member.name;\n            if (ts.isComputedPropertyName(name)) {\n                var expression = ts.visitNode(name.expression, visitor, ts.isExpression);\n                if (member.decorators) {\n                    var generatedName = ts.getGeneratedNameForNode(name);\n                    hoistVariableDeclaration(generatedName);\n                    expression = ts.createAssignment(generatedName, expression);\n                }\n                return ts.setOriginalNode(ts.createComputedPropertyName(expression, name), name);\n            }\n            else {\n                return name;\n            }\n        }\n        function visitHeritageClause(node) {\n            if (node.token === 84) {\n                var types = ts.visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments, 0, 1);\n                return ts.createHeritageClause(84, types, node);\n            }\n            return undefined;\n        }\n        function visitExpressionWithTypeArguments(node) {\n            var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression);\n            return ts.createExpressionWithTypeArguments(undefined, expression, node);\n        }\n        function shouldEmitFunctionLikeDeclaration(node) {\n            return !ts.nodeIsMissing(node.body);\n        }\n        function visitConstructor(node) {\n            if (!shouldEmitFunctionLikeDeclaration(node)) {\n                return undefined;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitMethodDeclaration(node) {\n            if (!shouldEmitFunctionLikeDeclaration(node)) {\n                return undefined;\n            }\n            var updated = ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context));\n            if (updated !== node) {\n                ts.setCommentRange(updated, node);\n                ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));\n            }\n            return updated;\n        }\n        function shouldEmitAccessorDeclaration(node) {\n            return !(ts.nodeIsMissing(node.body) && ts.hasModifier(node, 128));\n        }\n        function visitGetAccessor(node) {\n            if (!shouldEmitAccessorDeclaration(node)) {\n                return undefined;\n            }\n            var updated = ts.updateGetAccessor(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));\n            if (updated !== node) {\n                ts.setCommentRange(updated, node);\n                ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));\n            }\n            return updated;\n        }\n        function visitSetAccessor(node) {\n            if (!shouldEmitAccessorDeclaration(node)) {\n                return undefined;\n            }\n            var updated = ts.updateSetAccessor(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));\n            if (updated !== node) {\n                ts.setCommentRange(updated, node);\n                ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));\n            }\n            return updated;\n        }\n        function visitFunctionDeclaration(node) {\n            if (!shouldEmitFunctionLikeDeclaration(node)) {\n                return ts.createNotEmittedStatement(node);\n            }\n            var updated = ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));\n            if (isNamespaceExport(node)) {\n                var statements = [updated];\n                addExportMemberAssignment(statements, node);\n                return statements;\n            }\n            return updated;\n        }\n        function visitFunctionExpression(node) {\n            if (ts.nodeIsMissing(node.body)) {\n                return ts.createOmittedExpression();\n            }\n            var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context));\n            return updated;\n        }\n        function visitArrowFunction(node) {\n            var updated = ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context));\n            return updated;\n        }\n        function visitParameter(node) {\n            if (ts.parameterIsThisKeyword(node)) {\n                return undefined;\n            }\n            var parameter = ts.createParameter(undefined, undefined, node.dotDotDotToken, ts.visitNode(node.name, visitor, ts.isBindingName), undefined, undefined, ts.visitNode(node.initializer, visitor, ts.isExpression), ts.moveRangePastModifiers(node));\n            ts.setOriginalNode(parameter, node);\n            ts.setCommentRange(parameter, node);\n            ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node));\n            ts.setEmitFlags(parameter.name, 32);\n            return parameter;\n        }\n        function visitVariableStatement(node) {\n            if (isNamespaceExport(node)) {\n                var variables = ts.getInitializedVariables(node.declarationList);\n                if (variables.length === 0) {\n                    return undefined;\n                }\n                return ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable)), node);\n            }\n            else {\n                return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function transformInitializedVariable(node) {\n            var name = node.name;\n            if (ts.isBindingPattern(name)) {\n                return ts.flattenDestructuringAssignment(node, visitor, context, 0, false, createNamespaceExportExpression);\n            }\n            else {\n                return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), node);\n            }\n        }\n        function visitVariableDeclaration(node) {\n            return ts.updateVariableDeclaration(node, ts.visitNode(node.name, visitor, ts.isBindingName), undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));\n        }\n        function visitParenthesizedExpression(node) {\n            var innerExpression = ts.skipOuterExpressions(node.expression, ~2);\n            if (ts.isAssertionExpression(innerExpression)) {\n                var expression = ts.visitNode(node.expression, visitor, ts.isExpression);\n                return ts.createPartiallyEmittedExpression(expression, node);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitAssertionExpression(node) {\n            var expression = ts.visitNode(node.expression, visitor, ts.isExpression);\n            return ts.createPartiallyEmittedExpression(expression, node);\n        }\n        function visitNonNullExpression(node) {\n            var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression);\n            return ts.createPartiallyEmittedExpression(expression, node);\n        }\n        function visitCallExpression(node) {\n            return ts.updateCall(node, ts.visitNode(node.expression, visitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression));\n        }\n        function visitNewExpression(node) {\n            return ts.updateNew(node, ts.visitNode(node.expression, visitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression));\n        }\n        function shouldEmitEnumDeclaration(node) {\n            return !ts.isConst(node)\n                || compilerOptions.preserveConstEnums\n                || compilerOptions.isolatedModules;\n        }\n        function visitEnumDeclaration(node) {\n            if (!shouldEmitEnumDeclaration(node)) {\n                return undefined;\n            }\n            var statements = [];\n            var emitFlags = 2;\n            if (addVarForEnumOrModuleDeclaration(statements, node)) {\n                if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {\n                    emitFlags |= 512;\n                }\n            }\n            var parameterName = getNamespaceParameterName(node);\n            var containerName = getNamespaceContainerName(node);\n            var exportName = ts.hasModifier(node, 1)\n                ? ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, false, true)\n                : ts.getLocalName(node, false, true);\n            var moduleArg = ts.createLogicalOr(exportName, ts.createAssignment(exportName, ts.createObjectLiteral()));\n            if (hasNamespaceQualifiedExportName(node)) {\n                var localName = ts.getLocalName(node, false, true);\n                moduleArg = ts.createAssignment(localName, moduleArg);\n            }\n            var enumStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, transformEnumBody(node, containerName)), undefined, [moduleArg]), node);\n            ts.setOriginalNode(enumStatement, node);\n            ts.setEmitFlags(enumStatement, emitFlags);\n            statements.push(enumStatement);\n            statements.push(ts.createEndOfDeclarationMarker(node));\n            return statements;\n        }\n        function transformEnumBody(node, localName) {\n            var savedCurrentNamespaceLocalName = currentNamespaceContainerName;\n            currentNamespaceContainerName = localName;\n            var statements = [];\n            startLexicalEnvironment();\n            ts.addRange(statements, ts.map(node.members, transformEnumMember));\n            ts.addRange(statements, endLexicalEnvironment());\n            currentNamespaceContainerName = savedCurrentNamespaceLocalName;\n            return ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true);\n        }\n        function transformEnumMember(member) {\n            var name = getExpressionForPropertyName(member, false);\n            return ts.createStatement(ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, name), transformEnumMemberDeclarationValue(member))), name, member), member);\n        }\n        function transformEnumMemberDeclarationValue(member) {\n            var value = resolver.getConstantValue(member);\n            if (value !== undefined) {\n                return ts.createLiteral(value);\n            }\n            else {\n                enableSubstitutionForNonQualifiedEnumMembers();\n                if (member.initializer) {\n                    return ts.visitNode(member.initializer, visitor, ts.isExpression);\n                }\n                else {\n                    return ts.createVoidZero();\n                }\n            }\n        }\n        function shouldEmitModuleDeclaration(node) {\n            return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules);\n        }\n        function hasNamespaceQualifiedExportName(node) {\n            return isNamespaceExport(node)\n                || (isExternalModuleExport(node)\n                    && moduleKind !== ts.ModuleKind.ES2015\n                    && moduleKind !== ts.ModuleKind.System);\n        }\n        function recordEmittedDeclarationInScope(node) {\n            var name = node.symbol && node.symbol.name;\n            if (name) {\n                if (!currentScopeFirstDeclarationsOfName) {\n                    currentScopeFirstDeclarationsOfName = ts.createMap();\n                }\n                if (!(name in currentScopeFirstDeclarationsOfName)) {\n                    currentScopeFirstDeclarationsOfName[name] = node;\n                }\n            }\n        }\n        function isFirstEmittedDeclarationInScope(node) {\n            if (currentScopeFirstDeclarationsOfName) {\n                var name_35 = node.symbol && node.symbol.name;\n                if (name_35) {\n                    return currentScopeFirstDeclarationsOfName[name_35] === node;\n                }\n            }\n            return false;\n        }\n        function addVarForEnumOrModuleDeclaration(statements, node) {\n            var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), [\n                ts.createVariableDeclaration(ts.getLocalName(node, false, true))\n            ]);\n            ts.setOriginalNode(statement, node);\n            recordEmittedDeclarationInScope(node);\n            if (isFirstEmittedDeclarationInScope(node)) {\n                if (node.kind === 229) {\n                    ts.setSourceMapRange(statement.declarationList, node);\n                }\n                else {\n                    ts.setSourceMapRange(statement, node);\n                }\n                ts.setCommentRange(statement, node);\n                ts.setEmitFlags(statement, 1024 | 2097152);\n                statements.push(statement);\n                return true;\n            }\n            else {\n                var mergeMarker = ts.createMergeDeclarationMarker(statement);\n                ts.setEmitFlags(mergeMarker, 1536 | 2097152);\n                statements.push(mergeMarker);\n                return false;\n            }\n        }\n        function visitModuleDeclaration(node) {\n            if (!shouldEmitModuleDeclaration(node)) {\n                return ts.createNotEmittedStatement(node);\n            }\n            ts.Debug.assert(ts.isIdentifier(node.name), \"TypeScript module should have an Identifier name.\");\n            enableSubstitutionForNamespaceExports();\n            var statements = [];\n            var emitFlags = 2;\n            if (addVarForEnumOrModuleDeclaration(statements, node)) {\n                if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {\n                    emitFlags |= 512;\n                }\n            }\n            var parameterName = getNamespaceParameterName(node);\n            var containerName = getNamespaceContainerName(node);\n            var exportName = ts.hasModifier(node, 1)\n                ? ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, false, true)\n                : ts.getLocalName(node, false, true);\n            var moduleArg = ts.createLogicalOr(exportName, ts.createAssignment(exportName, ts.createObjectLiteral()));\n            if (hasNamespaceQualifiedExportName(node)) {\n                var localName = ts.getLocalName(node, false, true);\n                moduleArg = ts.createAssignment(localName, moduleArg);\n            }\n            var moduleStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, transformModuleBody(node, containerName)), undefined, [moduleArg]), node);\n            ts.setOriginalNode(moduleStatement, node);\n            ts.setEmitFlags(moduleStatement, emitFlags);\n            statements.push(moduleStatement);\n            statements.push(ts.createEndOfDeclarationMarker(node));\n            return statements;\n        }\n        function transformModuleBody(node, namespaceLocalName) {\n            var savedCurrentNamespaceContainerName = currentNamespaceContainerName;\n            var savedCurrentNamespace = currentNamespace;\n            var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;\n            currentNamespaceContainerName = namespaceLocalName;\n            currentNamespace = node;\n            currentScopeFirstDeclarationsOfName = undefined;\n            var statements = [];\n            startLexicalEnvironment();\n            var statementsLocation;\n            var blockLocation;\n            var body = node.body;\n            if (body.kind === 231) {\n                ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement));\n                statementsLocation = body.statements;\n                blockLocation = body;\n            }\n            else {\n                var result = visitModuleDeclaration(body);\n                if (result) {\n                    if (ts.isArray(result)) {\n                        ts.addRange(statements, result);\n                    }\n                    else {\n                        statements.push(result);\n                    }\n                }\n                var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body;\n                statementsLocation = ts.moveRangePos(moduleBlock.statements, -1);\n            }\n            ts.addRange(statements, endLexicalEnvironment());\n            currentNamespaceContainerName = savedCurrentNamespaceContainerName;\n            currentNamespace = savedCurrentNamespace;\n            currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;\n            var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true);\n            if (body.kind !== 231) {\n                ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536);\n            }\n            return block;\n        }\n        function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) {\n            if (moduleDeclaration.body.kind === 230) {\n                var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body);\n                return recursiveInnerModule || moduleDeclaration.body;\n            }\n        }\n        function visitImportDeclaration(node) {\n            if (!node.importClause) {\n                return node;\n            }\n            var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause, true);\n            return importClause\n                ? ts.updateImportDeclaration(node, undefined, undefined, importClause, node.moduleSpecifier)\n                : undefined;\n        }\n        function visitImportClause(node) {\n            var name = resolver.isReferencedAliasDeclaration(node) ? node.name : undefined;\n            var namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings, true);\n            return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined;\n        }\n        function visitNamedImportBindings(node) {\n            if (node.kind === 237) {\n                return resolver.isReferencedAliasDeclaration(node) ? node : undefined;\n            }\n            else {\n                var elements = ts.visitNodes(node.elements, visitImportSpecifier, ts.isImportSpecifier);\n                return ts.some(elements) ? ts.updateNamedImports(node, elements) : undefined;\n            }\n        }\n        function visitImportSpecifier(node) {\n            return resolver.isReferencedAliasDeclaration(node) ? node : undefined;\n        }\n        function visitExportAssignment(node) {\n            return resolver.isValueAliasDeclaration(node)\n                ? ts.visitEachChild(node, visitor, context)\n                : undefined;\n        }\n        function visitExportDeclaration(node) {\n            if (!node.exportClause) {\n                return resolver.moduleExportsSomeValue(node.moduleSpecifier) ? node : undefined;\n            }\n            if (!resolver.isValueAliasDeclaration(node)) {\n                return undefined;\n            }\n            var exportClause = ts.visitNode(node.exportClause, visitNamedExports, ts.isNamedExports, true);\n            return exportClause\n                ? ts.updateExportDeclaration(node, undefined, undefined, exportClause, node.moduleSpecifier)\n                : undefined;\n        }\n        function visitNamedExports(node) {\n            var elements = ts.visitNodes(node.elements, visitExportSpecifier, ts.isExportSpecifier);\n            return ts.some(elements) ? ts.updateNamedExports(node, elements) : undefined;\n        }\n        function visitExportSpecifier(node) {\n            return resolver.isValueAliasDeclaration(node) ? node : undefined;\n        }\n        function shouldEmitImportEqualsDeclaration(node) {\n            return resolver.isReferencedAliasDeclaration(node)\n                || (!ts.isExternalModule(currentSourceFile)\n                    && resolver.isTopLevelValueImportEqualsWithEntityName(node));\n        }\n        function visitImportEqualsDeclaration(node) {\n            if (ts.isExternalModuleImportEqualsDeclaration(node)) {\n                return resolver.isReferencedAliasDeclaration(node)\n                    ? ts.visitEachChild(node, visitor, context)\n                    : undefined;\n            }\n            if (!shouldEmitImportEqualsDeclaration(node)) {\n                return undefined;\n            }\n            var moduleReference = ts.createExpressionFromEntityName(node.moduleReference);\n            ts.setEmitFlags(moduleReference, 1536 | 2048);\n            if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) {\n                return ts.setOriginalNode(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([\n                    ts.setOriginalNode(ts.createVariableDeclaration(node.name, undefined, moduleReference), node)\n                ]), node), node);\n            }\n            else {\n                return ts.setOriginalNode(createNamespaceExport(node.name, moduleReference, node), node);\n            }\n        }\n        function isNamespaceExport(node) {\n            return currentNamespace !== undefined && ts.hasModifier(node, 1);\n        }\n        function isExternalModuleExport(node) {\n            return currentNamespace === undefined && ts.hasModifier(node, 1);\n        }\n        function isNamedExternalModuleExport(node) {\n            return isExternalModuleExport(node)\n                && !ts.hasModifier(node, 512);\n        }\n        function isDefaultExternalModuleExport(node) {\n            return isExternalModuleExport(node)\n                && ts.hasModifier(node, 512);\n        }\n        function expressionToStatement(expression) {\n            return ts.createStatement(expression, undefined);\n        }\n        function addExportMemberAssignment(statements, node) {\n            var expression = ts.createAssignment(ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, false, true), ts.getLocalName(node));\n            ts.setSourceMapRange(expression, ts.createRange(node.name.pos, node.end));\n            var statement = ts.createStatement(expression);\n            ts.setSourceMapRange(statement, ts.createRange(-1, node.end));\n            statements.push(statement);\n        }\n        function createNamespaceExport(exportName, exportValue, location) {\n            return ts.createStatement(ts.createAssignment(ts.getNamespaceMemberName(currentNamespaceContainerName, exportName, false, true), exportValue), location);\n        }\n        function createNamespaceExportExpression(exportName, exportValue, location) {\n            return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue, location);\n        }\n        function getNamespaceMemberNameWithSourceMapsAndWithoutComments(name) {\n            return ts.getNamespaceMemberName(currentNamespaceContainerName, name, false, true);\n        }\n        function getNamespaceParameterName(node) {\n            var name = ts.getGeneratedNameForNode(node);\n            ts.setSourceMapRange(name, node.name);\n            return name;\n        }\n        function getNamespaceContainerName(node) {\n            return ts.getGeneratedNameForNode(node);\n        }\n        function getClassAliasIfNeeded(node) {\n            if (resolver.getNodeCheckFlags(node) & 8388608) {\n                enableSubstitutionForClassAliases();\n                var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? node.name.text : \"default\");\n                classAliases[ts.getOriginalNodeId(node)] = classAlias;\n                hoistVariableDeclaration(classAlias);\n                return classAlias;\n            }\n        }\n        function getClassPrototype(node) {\n            return ts.createPropertyAccess(ts.getDeclarationName(node), \"prototype\");\n        }\n        function getClassMemberPrefix(node, member) {\n            return ts.hasModifier(member, 32)\n                ? ts.getDeclarationName(node)\n                : getClassPrototype(node);\n        }\n        function enableSubstitutionForNonQualifiedEnumMembers() {\n            if ((enabledSubstitutions & 8) === 0) {\n                enabledSubstitutions |= 8;\n                context.enableSubstitution(70);\n            }\n        }\n        function enableSubstitutionForClassAliases() {\n            if ((enabledSubstitutions & 1) === 0) {\n                enabledSubstitutions |= 1;\n                context.enableSubstitution(70);\n                classAliases = ts.createMap();\n            }\n        }\n        function enableSubstitutionForNamespaceExports() {\n            if ((enabledSubstitutions & 2) === 0) {\n                enabledSubstitutions |= 2;\n                context.enableSubstitution(70);\n                context.enableSubstitution(258);\n                context.enableEmitNotification(230);\n            }\n        }\n        function isTransformedModuleDeclaration(node) {\n            return ts.getOriginalNode(node).kind === 230;\n        }\n        function isTransformedEnumDeclaration(node) {\n            return ts.getOriginalNode(node).kind === 229;\n        }\n        function onEmitNode(emitContext, node, emitCallback) {\n            var savedApplicableSubstitutions = applicableSubstitutions;\n            if (enabledSubstitutions & 2 && isTransformedModuleDeclaration(node)) {\n                applicableSubstitutions |= 2;\n            }\n            if (enabledSubstitutions & 8 && isTransformedEnumDeclaration(node)) {\n                applicableSubstitutions |= 8;\n            }\n            previousOnEmitNode(emitContext, node, emitCallback);\n            applicableSubstitutions = savedApplicableSubstitutions;\n        }\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (emitContext === 1) {\n                return substituteExpression(node);\n            }\n            else if (ts.isShorthandPropertyAssignment(node)) {\n                return substituteShorthandPropertyAssignment(node);\n            }\n            return node;\n        }\n        function substituteShorthandPropertyAssignment(node) {\n            if (enabledSubstitutions & 2) {\n                var name_36 = node.name;\n                var exportedName = trySubstituteNamespaceExportedName(name_36);\n                if (exportedName) {\n                    if (node.objectAssignmentInitializer) {\n                        var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer);\n                        return ts.createPropertyAssignment(name_36, initializer, node);\n                    }\n                    return ts.createPropertyAssignment(name_36, exportedName, node);\n                }\n            }\n            return node;\n        }\n        function substituteExpression(node) {\n            switch (node.kind) {\n                case 70:\n                    return substituteExpressionIdentifier(node);\n                case 177:\n                    return substitutePropertyAccessExpression(node);\n                case 178:\n                    return substituteElementAccessExpression(node);\n            }\n            return node;\n        }\n        function substituteExpressionIdentifier(node) {\n            return trySubstituteClassAlias(node)\n                || trySubstituteNamespaceExportedName(node)\n                || node;\n        }\n        function trySubstituteClassAlias(node) {\n            if (enabledSubstitutions & 1) {\n                if (resolver.getNodeCheckFlags(node) & 16777216) {\n                    var declaration = resolver.getReferencedValueDeclaration(node);\n                    if (declaration) {\n                        var classAlias = classAliases[declaration.id];\n                        if (classAlias) {\n                            var clone_2 = ts.getSynthesizedClone(classAlias);\n                            ts.setSourceMapRange(clone_2, node);\n                            ts.setCommentRange(clone_2, node);\n                            return clone_2;\n                        }\n                    }\n                }\n            }\n            return undefined;\n        }\n        function trySubstituteNamespaceExportedName(node) {\n            if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {\n                var container = resolver.getReferencedExportContainer(node, false);\n                if (container && container.kind !== 261) {\n                    var substitute = (applicableSubstitutions & 2 && container.kind === 230) ||\n                        (applicableSubstitutions & 8 && container.kind === 229);\n                    if (substitute) {\n                        return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, node);\n                    }\n                }\n            }\n            return undefined;\n        }\n        function substitutePropertyAccessExpression(node) {\n            return substituteConstantValue(node);\n        }\n        function substituteElementAccessExpression(node) {\n            return substituteConstantValue(node);\n        }\n        function substituteConstantValue(node) {\n            var constantValue = tryGetConstEnumValue(node);\n            if (constantValue !== undefined) {\n                var substitute = ts.createLiteral(constantValue);\n                ts.setSourceMapRange(substitute, node);\n                ts.setCommentRange(substitute, node);\n                if (!compilerOptions.removeComments) {\n                    var propertyName = ts.isPropertyAccessExpression(node)\n                        ? ts.declarationNameToString(node.name)\n                        : ts.getTextOfNode(node.argumentExpression);\n                    substitute.trailingComment = \" \" + propertyName + \" \";\n                }\n                ts.setConstantValue(node, constantValue);\n                return substitute;\n            }\n            return node;\n        }\n        function tryGetConstEnumValue(node) {\n            if (compilerOptions.isolatedModules) {\n                return undefined;\n            }\n            return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)\n                ? resolver.getConstantValue(node)\n                : undefined;\n        }\n    }\n    ts.transformTypeScript = transformTypeScript;\n    var paramHelper = {\n        name: \"typescript:param\",\n        scoped: false,\n        priority: 4,\n        text: \"\\n            var __param = (this && this.__param) || function (paramIndex, decorator) {\\n                return function (target, key) { decorator(target, key, paramIndex); }\\n            };\"\n    };\n    function createParamHelper(context, expression, parameterOffset, location) {\n        context.requestEmitHelper(paramHelper);\n        return ts.createCall(ts.getHelperName(\"__param\"), undefined, [\n            ts.createLiteral(parameterOffset),\n            expression\n        ], location);\n    }\n    var metadataHelper = {\n        name: \"typescript:metadata\",\n        scoped: false,\n        priority: 3,\n        text: \"\\n            var __metadata = (this && this.__metadata) || function (k, v) {\\n                if (typeof Reflect === \\\"object\\\" && typeof Reflect.metadata === \\\"function\\\") return Reflect.metadata(k, v);\\n            };\"\n    };\n    function createMetadataHelper(context, metadataKey, metadataValue) {\n        context.requestEmitHelper(metadataHelper);\n        return ts.createCall(ts.getHelperName(\"__metadata\"), undefined, [\n            ts.createLiteral(metadataKey),\n            metadataValue\n        ]);\n    }\n    var decorateHelper = {\n        name: \"typescript:decorate\",\n        scoped: false,\n        priority: 2,\n        text: \"\\n            var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\\n                var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\\n                if (typeof Reflect === \\\"object\\\" && typeof Reflect.decorate === \\\"function\\\") r = Reflect.decorate(decorators, target, key, desc);\\n                else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\\n                return c > 3 && r && Object.defineProperty(target, key, r), r;\\n            };\"\n    };\n    function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) {\n        context.requestEmitHelper(decorateHelper);\n        var argumentsArray = [];\n        argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, undefined, true));\n        argumentsArray.push(target);\n        if (memberName) {\n            argumentsArray.push(memberName);\n            if (descriptor) {\n                argumentsArray.push(descriptor);\n            }\n        }\n        return ts.createCall(ts.getHelperName(\"__decorate\"), undefined, argumentsArray, location);\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformESNext(context) {\n        var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            var visited = ts.visitEachChild(node, visitor, context);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            return visited;\n        }\n        function visitor(node) {\n            return visitorWorker(node, false);\n        }\n        function visitorNoDestructuringValue(node) {\n            return visitorWorker(node, true);\n        }\n        function visitorWorker(node, noDestructuringValue) {\n            if ((node.transformFlags & 8) === 0) {\n                return node;\n            }\n            switch (node.kind) {\n                case 176:\n                    return visitObjectLiteralExpression(node);\n                case 192:\n                    return visitBinaryExpression(node, noDestructuringValue);\n                case 223:\n                    return visitVariableDeclaration(node);\n                case 213:\n                    return visitForOfStatement(node);\n                case 211:\n                    return visitForStatement(node);\n                case 188:\n                    return visitVoidExpression(node);\n                case 150:\n                    return visitConstructorDeclaration(node);\n                case 149:\n                    return visitMethodDeclaration(node);\n                case 151:\n                    return visitGetAccessorDeclaration(node);\n                case 152:\n                    return visitSetAccessorDeclaration(node);\n                case 225:\n                    return visitFunctionDeclaration(node);\n                case 184:\n                    return visitFunctionExpression(node);\n                case 185:\n                    return visitArrowFunction(node);\n                case 144:\n                    return visitParameter(node);\n                case 207:\n                    return visitExpressionStatement(node);\n                case 183:\n                    return visitParenthesizedExpression(node, noDestructuringValue);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function chunkObjectLiteralElements(elements) {\n            var chunkObject;\n            var objects = [];\n            for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {\n                var e = elements_3[_i];\n                if (e.kind === 259) {\n                    if (chunkObject) {\n                        objects.push(ts.createObjectLiteral(chunkObject));\n                        chunkObject = undefined;\n                    }\n                    var target = e.expression;\n                    objects.push(ts.visitNode(target, visitor, ts.isExpression));\n                }\n                else {\n                    if (!chunkObject) {\n                        chunkObject = [];\n                    }\n                    if (e.kind === 257) {\n                        var p = e;\n                        chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression)));\n                    }\n                    else {\n                        chunkObject.push(e);\n                    }\n                }\n            }\n            if (chunkObject) {\n                objects.push(ts.createObjectLiteral(chunkObject));\n            }\n            return objects;\n        }\n        function visitObjectLiteralExpression(node) {\n            if (node.transformFlags & 1048576) {\n                var objects = chunkObjectLiteralElements(node.properties);\n                if (objects.length && objects[0].kind !== 176) {\n                    objects.unshift(ts.createObjectLiteral());\n                }\n                return createAssignHelper(context, objects);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitExpressionStatement(node) {\n            return ts.visitEachChild(node, visitorNoDestructuringValue, context);\n        }\n        function visitParenthesizedExpression(node, noDestructuringValue) {\n            return ts.visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context);\n        }\n        function visitBinaryExpression(node, noDestructuringValue) {\n            if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 1048576) {\n                return ts.flattenDestructuringAssignment(node, visitor, context, 1, !noDestructuringValue);\n            }\n            else if (node.operatorToken.kind === 25) {\n                return ts.updateBinary(node, ts.visitNode(node.left, visitorNoDestructuringValue, ts.isExpression), ts.visitNode(node.right, noDestructuringValue ? visitorNoDestructuringValue : visitor, ts.isExpression));\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitVariableDeclaration(node) {\n            if (ts.isBindingPattern(node.name) && node.name.transformFlags & 1048576) {\n                return ts.flattenDestructuringBinding(node, visitor, context, 1);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitForStatement(node) {\n            return ts.updateFor(node, ts.visitNode(node.initializer, visitorNoDestructuringValue, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement));\n        }\n        function visitVoidExpression(node) {\n            return ts.visitEachChild(node, visitorNoDestructuringValue, context);\n        }\n        function visitForOfStatement(node) {\n            var leadingStatements;\n            var temp;\n            var initializer = ts.skipParentheses(node.initializer);\n            if (initializer.transformFlags & 1048576) {\n                if (ts.isVariableDeclarationList(initializer)) {\n                    temp = ts.createTempVariable(undefined);\n                    var firstDeclaration = ts.firstOrUndefined(initializer.declarations);\n                    var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1, temp, false, true);\n                    if (ts.some(declarations)) {\n                        var statement = ts.createVariableStatement(undefined, ts.updateVariableDeclarationList(initializer, declarations), initializer);\n                        leadingStatements = ts.append(leadingStatements, statement);\n                    }\n                }\n                else if (ts.isAssignmentPattern(initializer)) {\n                    temp = ts.createTempVariable(undefined);\n                    var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, node.initializer)), visitor, context, 1);\n                    leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, node.initializer));\n                }\n            }\n            if (temp) {\n                var expression = ts.visitNode(node.expression, visitor, ts.isExpression);\n                var statement = ts.visitNode(node.statement, visitor, ts.isStatement);\n                var block = ts.isBlock(statement)\n                    ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements))\n                    : ts.createBlock(ts.append(leadingStatements, statement), statement, true);\n                return ts.updateForOf(node, ts.createVariableDeclarationList([\n                    ts.createVariableDeclaration(temp, undefined, undefined, node.initializer)\n                ], node.initializer, 1), expression, block);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitParameter(node) {\n            if (node.transformFlags & 1048576) {\n                return ts.updateParameter(node, undefined, undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitConstructorDeclaration(node) {\n            return ts.updateConstructor(node, undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));\n        }\n        function visitGetAccessorDeclaration(node) {\n            return ts.updateGetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));\n        }\n        function visitSetAccessorDeclaration(node) {\n            return ts.updateSetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));\n        }\n        function visitMethodDeclaration(node) {\n            return ts.updateMethod(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));\n        }\n        function visitFunctionDeclaration(node) {\n            return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));\n        }\n        function visitArrowFunction(node) {\n            return ts.updateArrowFunction(node, node.modifiers, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));\n        }\n        function visitFunctionExpression(node) {\n            return ts.updateFunctionExpression(node, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));\n        }\n        function transformFunctionBody(node) {\n            resumeLexicalEnvironment();\n            var leadingStatements;\n            for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {\n                var parameter = _a[_i];\n                if (parameter.transformFlags & 1048576) {\n                    var temp = ts.getGeneratedNameForNode(parameter);\n                    var declarations = ts.flattenDestructuringBinding(parameter, visitor, context, 1, temp, false, true);\n                    if (ts.some(declarations)) {\n                        var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(declarations));\n                        ts.setEmitFlags(statement, 524288);\n                        leadingStatements = ts.append(leadingStatements, statement);\n                    }\n                }\n            }\n            var body = ts.visitNode(node.body, visitor, ts.isConciseBody);\n            var trailingStatements = endLexicalEnvironment();\n            if (ts.some(leadingStatements) || ts.some(trailingStatements)) {\n                var block = ts.convertToFunctionBody(body, true);\n                return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements));\n            }\n            return body;\n        }\n    }\n    ts.transformESNext = transformESNext;\n    var assignHelper = {\n        name: \"typescript:assign\",\n        scoped: false,\n        priority: 1,\n        text: \"\\n            var __assign = (this && this.__assign) || Object.assign || function(t) {\\n                for (var s, i = 1, n = arguments.length; i < n; i++) {\\n                    s = arguments[i];\\n                    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\\n                        t[p] = s[p];\\n                }\\n                return t;\\n            };\"\n    };\n    function createAssignHelper(context, attributesSegments) {\n        context.requestEmitHelper(assignHelper);\n        return ts.createCall(ts.getHelperName(\"__assign\"), undefined, attributesSegments);\n    }\n    ts.createAssignHelper = createAssignHelper;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformJsx(context) {\n        var compilerOptions = context.getCompilerOptions();\n        var currentSourceFile;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            currentSourceFile = node;\n            var visited = ts.visitEachChild(node, visitor, context);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            currentSourceFile = undefined;\n            return visited;\n        }\n        function visitor(node) {\n            if (node.transformFlags & 4) {\n                return visitorWorker(node);\n            }\n            else {\n                return node;\n            }\n        }\n        function visitorWorker(node) {\n            switch (node.kind) {\n                case 246:\n                    return visitJsxElement(node, false);\n                case 247:\n                    return visitJsxSelfClosingElement(node, false);\n                case 252:\n                    return visitJsxExpression(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function transformJsxChildToExpression(node) {\n            switch (node.kind) {\n                case 10:\n                    return visitJsxText(node);\n                case 252:\n                    return visitJsxExpression(node);\n                case 246:\n                    return visitJsxElement(node, true);\n                case 247:\n                    return visitJsxSelfClosingElement(node, true);\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    return undefined;\n            }\n        }\n        function visitJsxElement(node, isChild) {\n            return visitJsxOpeningLikeElement(node.openingElement, node.children, isChild, node);\n        }\n        function visitJsxSelfClosingElement(node, isChild) {\n            return visitJsxOpeningLikeElement(node, undefined, isChild, node);\n        }\n        function visitJsxOpeningLikeElement(node, children, isChild, location) {\n            var tagName = getTagName(node);\n            var objectProperties;\n            var attrs = node.attributes;\n            if (attrs.length === 0) {\n                objectProperties = ts.createNull();\n            }\n            else {\n                var segments = ts.flatten(ts.spanMap(attrs, ts.isJsxSpreadAttribute, function (attrs, isSpread) { return isSpread\n                    ? ts.map(attrs, transformJsxSpreadAttributeToExpression)\n                    : ts.createObjectLiteral(ts.map(attrs, transformJsxAttributeToObjectLiteralElement)); }));\n                if (ts.isJsxSpreadAttribute(attrs[0])) {\n                    segments.unshift(ts.createObjectLiteral());\n                }\n                objectProperties = ts.singleOrUndefined(segments);\n                if (!objectProperties) {\n                    objectProperties = ts.createAssignHelper(context, segments);\n                }\n            }\n            var element = ts.createExpressionForJsxElement(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location);\n            if (isChild) {\n                ts.startOnNewLine(element);\n            }\n            return element;\n        }\n        function transformJsxSpreadAttributeToExpression(node) {\n            return ts.visitNode(node.expression, visitor, ts.isExpression);\n        }\n        function transformJsxAttributeToObjectLiteralElement(node) {\n            var name = getAttributeName(node);\n            var expression = transformJsxAttributeInitializer(node.initializer);\n            return ts.createPropertyAssignment(name, expression);\n        }\n        function transformJsxAttributeInitializer(node) {\n            if (node === undefined) {\n                return ts.createLiteral(true);\n            }\n            else if (node.kind === 9) {\n                var decoded = tryDecodeEntities(node.text);\n                return decoded ? ts.createLiteral(decoded, node) : node;\n            }\n            else if (node.kind === 252) {\n                return visitJsxExpression(node);\n            }\n            else {\n                ts.Debug.failBadSyntaxKind(node);\n            }\n        }\n        function visitJsxText(node) {\n            var text = ts.getTextOfNode(node, true);\n            var parts;\n            var firstNonWhitespace = 0;\n            var lastNonWhitespace = -1;\n            for (var i = 0; i < text.length; i++) {\n                var c = text.charCodeAt(i);\n                if (ts.isLineBreak(c)) {\n                    if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) {\n                        var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1);\n                        if (!parts) {\n                            parts = [];\n                        }\n                        parts.push(ts.createLiteral(decodeEntities(part)));\n                    }\n                    firstNonWhitespace = -1;\n                }\n                else if (!ts.isWhiteSpace(c)) {\n                    lastNonWhitespace = i;\n                    if (firstNonWhitespace === -1) {\n                        firstNonWhitespace = i;\n                    }\n                }\n            }\n            if (firstNonWhitespace !== -1) {\n                var part = text.substr(firstNonWhitespace);\n                if (!parts) {\n                    parts = [];\n                }\n                parts.push(ts.createLiteral(decodeEntities(part)));\n            }\n            if (parts) {\n                return ts.reduceLeft(parts, aggregateJsxTextParts);\n            }\n            return undefined;\n        }\n        function aggregateJsxTextParts(left, right) {\n            return ts.createAdd(ts.createAdd(left, ts.createLiteral(\" \")), right);\n        }\n        function decodeEntities(text) {\n            return text.replace(/&((#((\\d+)|x([\\da-fA-F]+)))|(\\w+));/g, function (match, _all, _number, _digits, decimal, hex, word) {\n                if (decimal) {\n                    return String.fromCharCode(parseInt(decimal, 10));\n                }\n                else if (hex) {\n                    return String.fromCharCode(parseInt(hex, 16));\n                }\n                else {\n                    var ch = entities[word];\n                    return ch ? String.fromCharCode(ch) : match;\n                }\n            });\n        }\n        function tryDecodeEntities(text) {\n            var decoded = decodeEntities(text);\n            return decoded === text ? undefined : decoded;\n        }\n        function getTagName(node) {\n            if (node.kind === 246) {\n                return getTagName(node.openingElement);\n            }\n            else {\n                var name_37 = node.tagName;\n                if (ts.isIdentifier(name_37) && ts.isIntrinsicJsxName(name_37.text)) {\n                    return ts.createLiteral(name_37.text);\n                }\n                else {\n                    return ts.createExpressionFromEntityName(name_37);\n                }\n            }\n        }\n        function getAttributeName(node) {\n            var name = node.name;\n            if (/^[A-Za-z_]\\w*$/.test(name.text)) {\n                return name;\n            }\n            else {\n                return ts.createLiteral(name.text);\n            }\n        }\n        function visitJsxExpression(node) {\n            return ts.visitNode(node.expression, visitor, ts.isExpression);\n        }\n    }\n    ts.transformJsx = transformJsx;\n    var entities = ts.createMap({\n        \"quot\": 0x0022,\n        \"amp\": 0x0026,\n        \"apos\": 0x0027,\n        \"lt\": 0x003C,\n        \"gt\": 0x003E,\n        \"nbsp\": 0x00A0,\n        \"iexcl\": 0x00A1,\n        \"cent\": 0x00A2,\n        \"pound\": 0x00A3,\n        \"curren\": 0x00A4,\n        \"yen\": 0x00A5,\n        \"brvbar\": 0x00A6,\n        \"sect\": 0x00A7,\n        \"uml\": 0x00A8,\n        \"copy\": 0x00A9,\n        \"ordf\": 0x00AA,\n        \"laquo\": 0x00AB,\n        \"not\": 0x00AC,\n        \"shy\": 0x00AD,\n        \"reg\": 0x00AE,\n        \"macr\": 0x00AF,\n        \"deg\": 0x00B0,\n        \"plusmn\": 0x00B1,\n        \"sup2\": 0x00B2,\n        \"sup3\": 0x00B3,\n        \"acute\": 0x00B4,\n        \"micro\": 0x00B5,\n        \"para\": 0x00B6,\n        \"middot\": 0x00B7,\n        \"cedil\": 0x00B8,\n        \"sup1\": 0x00B9,\n        \"ordm\": 0x00BA,\n        \"raquo\": 0x00BB,\n        \"frac14\": 0x00BC,\n        \"frac12\": 0x00BD,\n        \"frac34\": 0x00BE,\n        \"iquest\": 0x00BF,\n        \"Agrave\": 0x00C0,\n        \"Aacute\": 0x00C1,\n        \"Acirc\": 0x00C2,\n        \"Atilde\": 0x00C3,\n        \"Auml\": 0x00C4,\n        \"Aring\": 0x00C5,\n        \"AElig\": 0x00C6,\n        \"Ccedil\": 0x00C7,\n        \"Egrave\": 0x00C8,\n        \"Eacute\": 0x00C9,\n        \"Ecirc\": 0x00CA,\n        \"Euml\": 0x00CB,\n        \"Igrave\": 0x00CC,\n        \"Iacute\": 0x00CD,\n        \"Icirc\": 0x00CE,\n        \"Iuml\": 0x00CF,\n        \"ETH\": 0x00D0,\n        \"Ntilde\": 0x00D1,\n        \"Ograve\": 0x00D2,\n        \"Oacute\": 0x00D3,\n        \"Ocirc\": 0x00D4,\n        \"Otilde\": 0x00D5,\n        \"Ouml\": 0x00D6,\n        \"times\": 0x00D7,\n        \"Oslash\": 0x00D8,\n        \"Ugrave\": 0x00D9,\n        \"Uacute\": 0x00DA,\n        \"Ucirc\": 0x00DB,\n        \"Uuml\": 0x00DC,\n        \"Yacute\": 0x00DD,\n        \"THORN\": 0x00DE,\n        \"szlig\": 0x00DF,\n        \"agrave\": 0x00E0,\n        \"aacute\": 0x00E1,\n        \"acirc\": 0x00E2,\n        \"atilde\": 0x00E3,\n        \"auml\": 0x00E4,\n        \"aring\": 0x00E5,\n        \"aelig\": 0x00E6,\n        \"ccedil\": 0x00E7,\n        \"egrave\": 0x00E8,\n        \"eacute\": 0x00E9,\n        \"ecirc\": 0x00EA,\n        \"euml\": 0x00EB,\n        \"igrave\": 0x00EC,\n        \"iacute\": 0x00ED,\n        \"icirc\": 0x00EE,\n        \"iuml\": 0x00EF,\n        \"eth\": 0x00F0,\n        \"ntilde\": 0x00F1,\n        \"ograve\": 0x00F2,\n        \"oacute\": 0x00F3,\n        \"ocirc\": 0x00F4,\n        \"otilde\": 0x00F5,\n        \"ouml\": 0x00F6,\n        \"divide\": 0x00F7,\n        \"oslash\": 0x00F8,\n        \"ugrave\": 0x00F9,\n        \"uacute\": 0x00FA,\n        \"ucirc\": 0x00FB,\n        \"uuml\": 0x00FC,\n        \"yacute\": 0x00FD,\n        \"thorn\": 0x00FE,\n        \"yuml\": 0x00FF,\n        \"OElig\": 0x0152,\n        \"oelig\": 0x0153,\n        \"Scaron\": 0x0160,\n        \"scaron\": 0x0161,\n        \"Yuml\": 0x0178,\n        \"fnof\": 0x0192,\n        \"circ\": 0x02C6,\n        \"tilde\": 0x02DC,\n        \"Alpha\": 0x0391,\n        \"Beta\": 0x0392,\n        \"Gamma\": 0x0393,\n        \"Delta\": 0x0394,\n        \"Epsilon\": 0x0395,\n        \"Zeta\": 0x0396,\n        \"Eta\": 0x0397,\n        \"Theta\": 0x0398,\n        \"Iota\": 0x0399,\n        \"Kappa\": 0x039A,\n        \"Lambda\": 0x039B,\n        \"Mu\": 0x039C,\n        \"Nu\": 0x039D,\n        \"Xi\": 0x039E,\n        \"Omicron\": 0x039F,\n        \"Pi\": 0x03A0,\n        \"Rho\": 0x03A1,\n        \"Sigma\": 0x03A3,\n        \"Tau\": 0x03A4,\n        \"Upsilon\": 0x03A5,\n        \"Phi\": 0x03A6,\n        \"Chi\": 0x03A7,\n        \"Psi\": 0x03A8,\n        \"Omega\": 0x03A9,\n        \"alpha\": 0x03B1,\n        \"beta\": 0x03B2,\n        \"gamma\": 0x03B3,\n        \"delta\": 0x03B4,\n        \"epsilon\": 0x03B5,\n        \"zeta\": 0x03B6,\n        \"eta\": 0x03B7,\n        \"theta\": 0x03B8,\n        \"iota\": 0x03B9,\n        \"kappa\": 0x03BA,\n        \"lambda\": 0x03BB,\n        \"mu\": 0x03BC,\n        \"nu\": 0x03BD,\n        \"xi\": 0x03BE,\n        \"omicron\": 0x03BF,\n        \"pi\": 0x03C0,\n        \"rho\": 0x03C1,\n        \"sigmaf\": 0x03C2,\n        \"sigma\": 0x03C3,\n        \"tau\": 0x03C4,\n        \"upsilon\": 0x03C5,\n        \"phi\": 0x03C6,\n        \"chi\": 0x03C7,\n        \"psi\": 0x03C8,\n        \"omega\": 0x03C9,\n        \"thetasym\": 0x03D1,\n        \"upsih\": 0x03D2,\n        \"piv\": 0x03D6,\n        \"ensp\": 0x2002,\n        \"emsp\": 0x2003,\n        \"thinsp\": 0x2009,\n        \"zwnj\": 0x200C,\n        \"zwj\": 0x200D,\n        \"lrm\": 0x200E,\n        \"rlm\": 0x200F,\n        \"ndash\": 0x2013,\n        \"mdash\": 0x2014,\n        \"lsquo\": 0x2018,\n        \"rsquo\": 0x2019,\n        \"sbquo\": 0x201A,\n        \"ldquo\": 0x201C,\n        \"rdquo\": 0x201D,\n        \"bdquo\": 0x201E,\n        \"dagger\": 0x2020,\n        \"Dagger\": 0x2021,\n        \"bull\": 0x2022,\n        \"hellip\": 0x2026,\n        \"permil\": 0x2030,\n        \"prime\": 0x2032,\n        \"Prime\": 0x2033,\n        \"lsaquo\": 0x2039,\n        \"rsaquo\": 0x203A,\n        \"oline\": 0x203E,\n        \"frasl\": 0x2044,\n        \"euro\": 0x20AC,\n        \"image\": 0x2111,\n        \"weierp\": 0x2118,\n        \"real\": 0x211C,\n        \"trade\": 0x2122,\n        \"alefsym\": 0x2135,\n        \"larr\": 0x2190,\n        \"uarr\": 0x2191,\n        \"rarr\": 0x2192,\n        \"darr\": 0x2193,\n        \"harr\": 0x2194,\n        \"crarr\": 0x21B5,\n        \"lArr\": 0x21D0,\n        \"uArr\": 0x21D1,\n        \"rArr\": 0x21D2,\n        \"dArr\": 0x21D3,\n        \"hArr\": 0x21D4,\n        \"forall\": 0x2200,\n        \"part\": 0x2202,\n        \"exist\": 0x2203,\n        \"empty\": 0x2205,\n        \"nabla\": 0x2207,\n        \"isin\": 0x2208,\n        \"notin\": 0x2209,\n        \"ni\": 0x220B,\n        \"prod\": 0x220F,\n        \"sum\": 0x2211,\n        \"minus\": 0x2212,\n        \"lowast\": 0x2217,\n        \"radic\": 0x221A,\n        \"prop\": 0x221D,\n        \"infin\": 0x221E,\n        \"ang\": 0x2220,\n        \"and\": 0x2227,\n        \"or\": 0x2228,\n        \"cap\": 0x2229,\n        \"cup\": 0x222A,\n        \"int\": 0x222B,\n        \"there4\": 0x2234,\n        \"sim\": 0x223C,\n        \"cong\": 0x2245,\n        \"asymp\": 0x2248,\n        \"ne\": 0x2260,\n        \"equiv\": 0x2261,\n        \"le\": 0x2264,\n        \"ge\": 0x2265,\n        \"sub\": 0x2282,\n        \"sup\": 0x2283,\n        \"nsub\": 0x2284,\n        \"sube\": 0x2286,\n        \"supe\": 0x2287,\n        \"oplus\": 0x2295,\n        \"otimes\": 0x2297,\n        \"perp\": 0x22A5,\n        \"sdot\": 0x22C5,\n        \"lceil\": 0x2308,\n        \"rceil\": 0x2309,\n        \"lfloor\": 0x230A,\n        \"rfloor\": 0x230B,\n        \"lang\": 0x2329,\n        \"rang\": 0x232A,\n        \"loz\": 0x25CA,\n        \"spades\": 0x2660,\n        \"clubs\": 0x2663,\n        \"hearts\": 0x2665,\n        \"diams\": 0x2666\n    });\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformES2017(context) {\n        var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;\n        var resolver = context.getEmitResolver();\n        var compilerOptions = context.getCompilerOptions();\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        var currentSourceFile;\n        var enabledSubstitutions;\n        var currentSuperContainer;\n        var previousOnEmitNode = context.onEmitNode;\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        context.onEmitNode = onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            currentSourceFile = node;\n            var visited = ts.visitEachChild(node, visitor, context);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            currentSourceFile = undefined;\n            return visited;\n        }\n        function visitor(node) {\n            if ((node.transformFlags & 16) === 0) {\n                return node;\n            }\n            switch (node.kind) {\n                case 119:\n                    return undefined;\n                case 189:\n                    return visitAwaitExpression(node);\n                case 149:\n                    return visitMethodDeclaration(node);\n                case 225:\n                    return visitFunctionDeclaration(node);\n                case 184:\n                    return visitFunctionExpression(node);\n                case 185:\n                    return visitArrowFunction(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitAwaitExpression(node) {\n            return ts.setOriginalNode(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression), node), node);\n        }\n        function visitMethodDeclaration(node) {\n            return ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)\n                ? transformAsyncFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        function visitFunctionDeclaration(node) {\n            return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)\n                ? transformAsyncFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        function visitFunctionExpression(node) {\n            if (ts.nodeIsMissing(node.body)) {\n                return ts.createOmittedExpression();\n            }\n            return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)\n                ? transformAsyncFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        function visitArrowFunction(node) {\n            return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)\n                ? transformAsyncFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        function transformAsyncFunctionBody(node) {\n            resumeLexicalEnvironment();\n            var original = ts.getOriginalNode(node, ts.isFunctionLike);\n            var nodeType = original.type;\n            var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined;\n            var isArrowFunction = node.kind === 185;\n            var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0;\n            if (!isArrowFunction) {\n                var statements = [];\n                var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, false, visitor);\n                statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset))));\n                ts.addRange(statements, endLexicalEnvironment());\n                var block = ts.createBlock(statements, node.body, true);\n                if (languageVersion >= 2) {\n                    if (resolver.getNodeCheckFlags(node) & 4096) {\n                        enableSubstitutionForAsyncMethodsWithSuper();\n                        ts.addEmitHelper(block, advancedAsyncSuperHelper);\n                    }\n                    else if (resolver.getNodeCheckFlags(node) & 2048) {\n                        enableSubstitutionForAsyncMethodsWithSuper();\n                        ts.addEmitHelper(block, asyncSuperHelper);\n                    }\n                }\n                return block;\n            }\n            else {\n                var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body));\n                var declarations = endLexicalEnvironment();\n                if (ts.some(declarations)) {\n                    var block = ts.convertToFunctionBody(expression);\n                    return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements));\n                }\n                return expression;\n            }\n        }\n        function transformFunctionBodyWorker(body, start) {\n            if (ts.isBlock(body)) {\n                return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start));\n            }\n            else {\n                startLexicalEnvironment();\n                var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody));\n                var declarations = endLexicalEnvironment();\n                return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements));\n            }\n        }\n        function getPromiseConstructor(type) {\n            var typeName = type && ts.getEntityNameFromTypeNode(type);\n            if (typeName && ts.isEntityName(typeName)) {\n                var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);\n                if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue\n                    || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {\n                    return typeName;\n                }\n            }\n            return undefined;\n        }\n        function enableSubstitutionForAsyncMethodsWithSuper() {\n            if ((enabledSubstitutions & 1) === 0) {\n                enabledSubstitutions |= 1;\n                context.enableSubstitution(179);\n                context.enableSubstitution(177);\n                context.enableSubstitution(178);\n                context.enableEmitNotification(226);\n                context.enableEmitNotification(149);\n                context.enableEmitNotification(151);\n                context.enableEmitNotification(152);\n                context.enableEmitNotification(150);\n            }\n        }\n        function substituteExpression(node) {\n            switch (node.kind) {\n                case 177:\n                    return substitutePropertyAccessExpression(node);\n                case 178:\n                    return substituteElementAccessExpression(node);\n                case 179:\n                    if (enabledSubstitutions & 1) {\n                        return substituteCallExpression(node);\n                    }\n                    break;\n            }\n            return node;\n        }\n        function substitutePropertyAccessExpression(node) {\n            if (enabledSubstitutions & 1 && node.expression.kind === 96) {\n                var flags = getSuperContainerAsyncMethodFlags();\n                if (flags) {\n                    return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), flags, node);\n                }\n            }\n            return node;\n        }\n        function substituteElementAccessExpression(node) {\n            if (enabledSubstitutions & 1 && node.expression.kind === 96) {\n                var flags = getSuperContainerAsyncMethodFlags();\n                if (flags) {\n                    return createSuperAccessInAsyncMethod(node.argumentExpression, flags, node);\n                }\n            }\n            return node;\n        }\n        function substituteCallExpression(node) {\n            var expression = node.expression;\n            if (ts.isSuperProperty(expression)) {\n                var flags = getSuperContainerAsyncMethodFlags();\n                if (flags) {\n                    var argumentExpression = ts.isPropertyAccessExpression(expression)\n                        ? substitutePropertyAccessExpression(expression)\n                        : substituteElementAccessExpression(expression);\n                    return ts.createCall(ts.createPropertyAccess(argumentExpression, \"call\"), undefined, [\n                        ts.createThis()\n                    ].concat(node.arguments));\n                }\n            }\n            return node;\n        }\n        function isSuperContainer(node) {\n            var kind = node.kind;\n            return kind === 226\n                || kind === 150\n                || kind === 149\n                || kind === 151\n                || kind === 152;\n        }\n        function onEmitNode(emitContext, node, emitCallback) {\n            if (enabledSubstitutions & 1 && isSuperContainer(node)) {\n                var savedCurrentSuperContainer = currentSuperContainer;\n                currentSuperContainer = node;\n                previousOnEmitNode(emitContext, node, emitCallback);\n                currentSuperContainer = savedCurrentSuperContainer;\n            }\n            else {\n                previousOnEmitNode(emitContext, node, emitCallback);\n            }\n        }\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (emitContext === 1) {\n                return substituteExpression(node);\n            }\n            return node;\n        }\n        function createSuperAccessInAsyncMethod(argumentExpression, flags, location) {\n            if (flags & 4096) {\n                return ts.createPropertyAccess(ts.createCall(ts.createIdentifier(\"_super\"), undefined, [argumentExpression]), \"value\", location);\n            }\n            else {\n                return ts.createCall(ts.createIdentifier(\"_super\"), undefined, [argumentExpression], location);\n            }\n        }\n        function getSuperContainerAsyncMethodFlags() {\n            return currentSuperContainer !== undefined\n                && resolver.getNodeCheckFlags(currentSuperContainer) & (2048 | 4096);\n        }\n    }\n    ts.transformES2017 = transformES2017;\n    function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) {\n        context.requestEmitHelper(awaiterHelper);\n        var generatorFunc = ts.createFunctionExpression(undefined, ts.createToken(38), undefined, undefined, [], undefined, body);\n        (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072;\n        return ts.createCall(ts.getHelperName(\"__awaiter\"), undefined, [\n            ts.createThis(),\n            hasLexicalArguments ? ts.createIdentifier(\"arguments\") : ts.createVoidZero(),\n            promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(),\n            generatorFunc\n        ]);\n    }\n    var awaiterHelper = {\n        name: \"typescript:awaiter\",\n        scoped: false,\n        priority: 5,\n        text: \"\\n            var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\\n                return new (P || (P = Promise))(function (resolve, reject) {\\n                    function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\\n                    function rejected(value) { try { step(generator[\\\"throw\\\"](value)); } catch (e) { reject(e); } }\\n                    function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\\n                    step((generator = generator.apply(thisArg, _arguments)).next());\\n                });\\n            };\"\n    };\n    var asyncSuperHelper = {\n        name: \"typescript:async-super\",\n        scoped: true,\n        text: \"\\n            const _super = name => super[name];\"\n    };\n    var advancedAsyncSuperHelper = {\n        name: \"typescript:advanced-async-super\",\n        scoped: true,\n        text: \"\\n            const _super = (function (geti, seti) {\\n                const cache = Object.create(null);\\n                return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\\n            })(name => super[name], (name, value) => super[name] = value);\"\n    };\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformES2016(context) {\n        var hoistVariableDeclaration = context.hoistVariableDeclaration;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitor(node) {\n            if ((node.transformFlags & 32) === 0) {\n                return node;\n            }\n            switch (node.kind) {\n                case 192:\n                    return visitBinaryExpression(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitBinaryExpression(node) {\n            switch (node.operatorToken.kind) {\n                case 61:\n                    return visitExponentiationAssignmentExpression(node);\n                case 39:\n                    return visitExponentiationExpression(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitExponentiationAssignmentExpression(node) {\n            var target;\n            var value;\n            var left = ts.visitNode(node.left, visitor, ts.isExpression);\n            var right = ts.visitNode(node.right, visitor, ts.isExpression);\n            if (ts.isElementAccessExpression(left)) {\n                var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);\n                var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration);\n                target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left);\n                value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left);\n            }\n            else if (ts.isPropertyAccessExpression(left)) {\n                var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);\n                target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left);\n                value = ts.createPropertyAccess(expressionTemp, left.name, left);\n            }\n            else {\n                target = left;\n                value = left;\n            }\n            return ts.createAssignment(target, ts.createMathPow(value, right, node), node);\n        }\n        function visitExponentiationExpression(node) {\n            var left = ts.visitNode(node.left, visitor, ts.isExpression);\n            var right = ts.visitNode(node.right, visitor, ts.isExpression);\n            return ts.createMathPow(left, right, node);\n        }\n    }\n    ts.transformES2016 = transformES2016;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformES2015(context) {\n        var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;\n        var resolver = context.getEmitResolver();\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        var previousOnEmitNode = context.onEmitNode;\n        context.onEmitNode = onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        var currentSourceFile;\n        var currentText;\n        var currentParent;\n        var currentNode;\n        var enclosingVariableStatement;\n        var enclosingBlockScopeContainer;\n        var enclosingBlockScopeContainerParent;\n        var enclosingFunction;\n        var enclosingNonArrowFunction;\n        var enclosingNonAsyncFunctionBody;\n        var isInConstructorWithCapturedSuper;\n        var convertedLoopState;\n        var enabledSubstitutions;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            currentSourceFile = node;\n            currentText = node.text;\n            var visited = saveStateAndInvoke(node, visitSourceFile);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            currentSourceFile = undefined;\n            currentText = undefined;\n            return visited;\n        }\n        function visitor(node) {\n            return saveStateAndInvoke(node, dispatcher);\n        }\n        function dispatcher(node) {\n            return convertedLoopState\n                ? visitorForConvertedLoopWorker(node)\n                : visitorWorker(node);\n        }\n        function saveStateAndInvoke(node, f) {\n            var savedEnclosingFunction = enclosingFunction;\n            var savedEnclosingNonArrowFunction = enclosingNonArrowFunction;\n            var savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody;\n            var savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer;\n            var savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent;\n            var savedEnclosingVariableStatement = enclosingVariableStatement;\n            var savedCurrentParent = currentParent;\n            var savedCurrentNode = currentNode;\n            var savedConvertedLoopState = convertedLoopState;\n            var savedIsInConstructorWithCapturedSuper = isInConstructorWithCapturedSuper;\n            if (ts.nodeStartsNewLexicalEnvironment(node)) {\n                isInConstructorWithCapturedSuper = false;\n                convertedLoopState = undefined;\n            }\n            onBeforeVisitNode(node);\n            var visited = f(node);\n            isInConstructorWithCapturedSuper = savedIsInConstructorWithCapturedSuper;\n            convertedLoopState = savedConvertedLoopState;\n            enclosingFunction = savedEnclosingFunction;\n            enclosingNonArrowFunction = savedEnclosingNonArrowFunction;\n            enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody;\n            enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer;\n            enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent;\n            enclosingVariableStatement = savedEnclosingVariableStatement;\n            currentParent = savedCurrentParent;\n            currentNode = savedCurrentNode;\n            return visited;\n        }\n        function onBeforeVisitNode(node) {\n            if (currentNode) {\n                if (ts.isBlockScope(currentNode, currentParent)) {\n                    enclosingBlockScopeContainer = currentNode;\n                    enclosingBlockScopeContainerParent = currentParent;\n                }\n                if (ts.isFunctionLike(currentNode)) {\n                    enclosingFunction = currentNode;\n                    if (currentNode.kind !== 185) {\n                        enclosingNonArrowFunction = currentNode;\n                        if (!(ts.getEmitFlags(currentNode) & 131072)) {\n                            enclosingNonAsyncFunctionBody = currentNode;\n                        }\n                    }\n                }\n                switch (currentNode.kind) {\n                    case 205:\n                        enclosingVariableStatement = currentNode;\n                        break;\n                    case 224:\n                    case 223:\n                    case 174:\n                    case 172:\n                    case 173:\n                        break;\n                    default:\n                        enclosingVariableStatement = undefined;\n                }\n            }\n            currentParent = currentNode;\n            currentNode = node;\n        }\n        function returnCapturedThis(node) {\n            return ts.setOriginalNode(ts.createReturn(ts.createIdentifier(\"_this\")), node);\n        }\n        function isReturnVoidStatementInConstructorWithCapturedSuper(node) {\n            return isInConstructorWithCapturedSuper && node.kind === 216 && !node.expression;\n        }\n        function shouldCheckNode(node) {\n            return (node.transformFlags & 64) !== 0 ||\n                node.kind === 219 ||\n                (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node));\n        }\n        function visitorWorker(node) {\n            if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) {\n                return returnCapturedThis(node);\n            }\n            else if (shouldCheckNode(node)) {\n                return visitJavaScript(node);\n            }\n            else if (node.transformFlags & 128 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) {\n                return ts.visitEachChild(node, visitor, context);\n            }\n            else {\n                return node;\n            }\n        }\n        function visitorForConvertedLoopWorker(node) {\n            var result;\n            if (shouldCheckNode(node)) {\n                result = visitJavaScript(node);\n            }\n            else {\n                result = visitNodesInConvertedLoop(node);\n            }\n            return result;\n        }\n        function visitNodesInConvertedLoop(node) {\n            switch (node.kind) {\n                case 216:\n                    node = isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : node;\n                    return visitReturnStatement(node);\n                case 205:\n                    return visitVariableStatement(node);\n                case 218:\n                    return visitSwitchStatement(node);\n                case 215:\n                case 214:\n                    return visitBreakOrContinueStatement(node);\n                case 98:\n                    return visitThisKeyword(node);\n                case 70:\n                    return visitIdentifier(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitJavaScript(node) {\n            switch (node.kind) {\n                case 114:\n                    return undefined;\n                case 226:\n                    return visitClassDeclaration(node);\n                case 197:\n                    return visitClassExpression(node);\n                case 144:\n                    return visitParameter(node);\n                case 225:\n                    return visitFunctionDeclaration(node);\n                case 185:\n                    return visitArrowFunction(node);\n                case 184:\n                    return visitFunctionExpression(node);\n                case 223:\n                    return visitVariableDeclaration(node);\n                case 70:\n                    return visitIdentifier(node);\n                case 224:\n                    return visitVariableDeclarationList(node);\n                case 219:\n                    return visitLabeledStatement(node);\n                case 209:\n                    return visitDoStatement(node);\n                case 210:\n                    return visitWhileStatement(node);\n                case 211:\n                    return visitForStatement(node);\n                case 212:\n                    return visitForInStatement(node);\n                case 213:\n                    return visitForOfStatement(node);\n                case 207:\n                    return visitExpressionStatement(node);\n                case 176:\n                    return visitObjectLiteralExpression(node);\n                case 256:\n                    return visitCatchClause(node);\n                case 258:\n                    return visitShorthandPropertyAssignment(node);\n                case 175:\n                    return visitArrayLiteralExpression(node);\n                case 179:\n                    return visitCallExpression(node);\n                case 180:\n                    return visitNewExpression(node);\n                case 183:\n                    return visitParenthesizedExpression(node, true);\n                case 192:\n                    return visitBinaryExpression(node, true);\n                case 12:\n                case 13:\n                case 14:\n                case 15:\n                    return visitTemplateLiteral(node);\n                case 181:\n                    return visitTaggedTemplateExpression(node);\n                case 194:\n                    return visitTemplateExpression(node);\n                case 195:\n                    return visitYieldExpression(node);\n                case 196:\n                    return visitSpreadElement(node);\n                case 96:\n                    return visitSuperKeyword();\n                case 195:\n                    return ts.visitEachChild(node, visitor, context);\n                case 149:\n                    return visitMethodDeclaration(node);\n                case 205:\n                    return visitVariableStatement(node);\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitSourceFile(node) {\n            var statements = [];\n            startLexicalEnvironment();\n            var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor);\n            addCaptureThisForNodeIfNeeded(statements, node);\n            ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));\n            ts.addRange(statements, endLexicalEnvironment());\n            return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));\n        }\n        function visitSwitchStatement(node) {\n            ts.Debug.assert(convertedLoopState !== undefined);\n            var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps;\n            convertedLoopState.allowedNonLabeledJumps |= 2;\n            var result = ts.visitEachChild(node, visitor, context);\n            convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps;\n            return result;\n        }\n        function visitReturnStatement(node) {\n            ts.Debug.assert(convertedLoopState !== undefined);\n            convertedLoopState.nonLocalJumps |= 8;\n            return ts.createReturn(ts.createObjectLiteral([\n                ts.createPropertyAssignment(ts.createIdentifier(\"value\"), node.expression\n                    ? ts.visitNode(node.expression, visitor, ts.isExpression)\n                    : ts.createVoidZero())\n            ]));\n        }\n        function visitThisKeyword(node) {\n            ts.Debug.assert(convertedLoopState !== undefined);\n            if (enclosingFunction && enclosingFunction.kind === 185) {\n                convertedLoopState.containsLexicalThis = true;\n                return node;\n            }\n            return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName(\"this\"));\n        }\n        function visitIdentifier(node) {\n            if (!convertedLoopState) {\n                return node;\n            }\n            if (ts.isGeneratedIdentifier(node)) {\n                return node;\n            }\n            if (node.text !== \"arguments\" && !resolver.isArgumentsLocalBinding(node)) {\n                return node;\n            }\n            return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName(\"arguments\"));\n        }\n        function visitBreakOrContinueStatement(node) {\n            if (convertedLoopState) {\n                var jump = node.kind === 215 ? 2 : 4;\n                var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) ||\n                    (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump));\n                if (!canUseBreakOrContinue) {\n                    var labelMarker = void 0;\n                    if (!node.label) {\n                        if (node.kind === 215) {\n                            convertedLoopState.nonLocalJumps |= 2;\n                            labelMarker = \"break\";\n                        }\n                        else {\n                            convertedLoopState.nonLocalJumps |= 4;\n                            labelMarker = \"continue\";\n                        }\n                    }\n                    else {\n                        if (node.kind === 215) {\n                            labelMarker = \"break-\" + node.label.text;\n                            setLabeledJump(convertedLoopState, true, node.label.text, labelMarker);\n                        }\n                        else {\n                            labelMarker = \"continue-\" + node.label.text;\n                            setLabeledJump(convertedLoopState, false, node.label.text, labelMarker);\n                        }\n                    }\n                    var returnExpression = ts.createLiteral(labelMarker);\n                    if (convertedLoopState.loopOutParameters.length) {\n                        var outParams = convertedLoopState.loopOutParameters;\n                        var expr = void 0;\n                        for (var i = 0; i < outParams.length; i++) {\n                            var copyExpr = copyOutParameter(outParams[i], 1);\n                            if (i === 0) {\n                                expr = copyExpr;\n                            }\n                            else {\n                                expr = ts.createBinary(expr, 25, copyExpr);\n                            }\n                        }\n                        returnExpression = ts.createBinary(expr, 25, returnExpression);\n                    }\n                    return ts.createReturn(returnExpression);\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitClassDeclaration(node) {\n            var variable = ts.createVariableDeclaration(ts.getLocalName(node, true), undefined, transformClassLikeDeclarationToExpression(node));\n            ts.setOriginalNode(variable, node);\n            var statements = [];\n            var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([variable]), node);\n            ts.setOriginalNode(statement, node);\n            ts.startOnNewLine(statement);\n            statements.push(statement);\n            if (ts.hasModifier(node, 1)) {\n                var exportStatement = ts.hasModifier(node, 512)\n                    ? ts.createExportDefault(ts.getLocalName(node))\n                    : ts.createExternalModuleExport(ts.getLocalName(node));\n                ts.setOriginalNode(exportStatement, statement);\n                statements.push(exportStatement);\n            }\n            var emitFlags = ts.getEmitFlags(node);\n            if ((emitFlags & 2097152) === 0) {\n                statements.push(ts.createEndOfDeclarationMarker(node));\n                ts.setEmitFlags(statement, emitFlags | 2097152);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function visitClassExpression(node) {\n            return transformClassLikeDeclarationToExpression(node);\n        }\n        function transformClassLikeDeclarationToExpression(node) {\n            if (node.name) {\n                enableSubstitutionsForBlockScopedBindings();\n            }\n            var extendsClauseElement = ts.getClassExtendsHeritageClauseElement(node);\n            var classFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, extendsClauseElement ? [ts.createParameter(undefined, undefined, undefined, \"_super\")] : [], undefined, transformClassBody(node, extendsClauseElement));\n            if (ts.getEmitFlags(node) & 32768) {\n                ts.setEmitFlags(classFunction, 32768);\n            }\n            var inner = ts.createPartiallyEmittedExpression(classFunction);\n            inner.end = node.end;\n            ts.setEmitFlags(inner, 1536);\n            var outer = ts.createPartiallyEmittedExpression(inner);\n            outer.end = ts.skipTrivia(currentText, node.pos);\n            ts.setEmitFlags(outer, 1536);\n            return ts.createParen(ts.createCall(outer, undefined, extendsClauseElement\n                ? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)]\n                : []));\n        }\n        function transformClassBody(node, extendsClauseElement) {\n            var statements = [];\n            startLexicalEnvironment();\n            addExtendsHelperIfNeeded(statements, node, extendsClauseElement);\n            addConstructor(statements, node, extendsClauseElement);\n            addClassMembers(statements, node);\n            var closingBraceLocation = ts.createTokenRange(ts.skipTrivia(currentText, node.members.end), 17);\n            var localName = ts.getLocalName(node);\n            var outer = ts.createPartiallyEmittedExpression(localName);\n            outer.end = closingBraceLocation.end;\n            ts.setEmitFlags(outer, 1536);\n            var statement = ts.createReturn(outer);\n            statement.pos = closingBraceLocation.pos;\n            ts.setEmitFlags(statement, 1536 | 384);\n            statements.push(statement);\n            ts.addRange(statements, endLexicalEnvironment());\n            var block = ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true);\n            ts.setEmitFlags(block, 1536);\n            return block;\n        }\n        function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) {\n            if (extendsClauseElement) {\n                statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)), extendsClauseElement));\n            }\n        }\n        function addConstructor(statements, node, extendsClauseElement) {\n            var constructor = ts.getFirstConstructorWithBody(node);\n            var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined);\n            var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), constructor || node);\n            if (extendsClauseElement) {\n                ts.setEmitFlags(constructorFunction, 8);\n            }\n            statements.push(constructorFunction);\n        }\n        function transformConstructorParameters(constructor, hasSynthesizedSuper) {\n            return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context)\n                || [];\n        }\n        function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {\n            var statements = [];\n            resumeLexicalEnvironment();\n            var statementOffset = -1;\n            if (hasSynthesizedSuper) {\n                statementOffset = 0;\n            }\n            else if (constructor) {\n                statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, false, visitor);\n            }\n            if (constructor) {\n                addDefaultValueAssignmentsIfNeeded(statements, constructor);\n                addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);\n                ts.Debug.assert(statementOffset >= 0, \"statementOffset not initialized correctly!\");\n            }\n            var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset);\n            if (superCaptureStatus === 1 || superCaptureStatus === 2) {\n                statementOffset++;\n            }\n            if (constructor) {\n                var body = saveStateAndInvoke(constructor, function (constructor) {\n                    isInConstructorWithCapturedSuper = superCaptureStatus === 1;\n                    return ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset);\n                });\n                ts.addRange(statements, body);\n            }\n            if (extendsClauseElement\n                && superCaptureStatus !== 2\n                && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) {\n                statements.push(ts.createReturn(ts.createIdentifier(\"_this\")));\n            }\n            ts.addRange(statements, endLexicalEnvironment());\n            var block = ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : node, true);\n            if (!constructor) {\n                ts.setEmitFlags(block, 1536);\n            }\n            return block;\n        }\n        function isSufficientlyCoveredByReturnStatements(statement) {\n            if (statement.kind === 216) {\n                return true;\n            }\n            else if (statement.kind === 208) {\n                var ifStatement = statement;\n                if (ifStatement.elseStatement) {\n                    return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) &&\n                        isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement);\n                }\n            }\n            else if (statement.kind === 204) {\n                var lastStatement = ts.lastOrUndefined(statement.statements);\n                if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) {\n            if (!hasExtendsClause) {\n                if (ctor) {\n                    addCaptureThisForNodeIfNeeded(statements, ctor);\n                }\n                return 0;\n            }\n            if (!ctor) {\n                statements.push(ts.createReturn(createDefaultSuperCallOrThis()));\n                return 2;\n            }\n            if (hasSynthesizedSuper) {\n                captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());\n                enableSubstitutionsForCapturedThis();\n                return 1;\n            }\n            var firstStatement;\n            var superCallExpression;\n            var ctorStatements = ctor.body.statements;\n            if (statementOffset < ctorStatements.length) {\n                firstStatement = ctorStatements[statementOffset];\n                if (firstStatement.kind === 207 && ts.isSuperCall(firstStatement.expression)) {\n                    var superCall = firstStatement.expression;\n                    superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall);\n                }\n            }\n            if (superCallExpression && statementOffset === ctorStatements.length - 1) {\n                var returnStatement = ts.createReturn(superCallExpression);\n                if (superCallExpression.kind !== 192\n                    || superCallExpression.left.kind !== 179) {\n                    ts.Debug.fail(\"Assumed generated super call would have form 'super.call(...) || this'.\");\n                }\n                ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536)));\n                statements.push(returnStatement);\n                return 2;\n            }\n            captureThisForNode(statements, ctor, superCallExpression, firstStatement);\n            if (superCallExpression) {\n                return 1;\n            }\n            return 0;\n        }\n        function createDefaultSuperCallOrThis() {\n            var actualThis = ts.createThis();\n            ts.setEmitFlags(actualThis, 4);\n            var superCall = ts.createFunctionApply(ts.createIdentifier(\"_super\"), actualThis, ts.createIdentifier(\"arguments\"));\n            return ts.createLogicalOr(superCall, actualThis);\n        }\n        function visitParameter(node) {\n            if (node.dotDotDotToken) {\n                return undefined;\n            }\n            else if (ts.isBindingPattern(node.name)) {\n                return ts.setOriginalNode(ts.createParameter(undefined, undefined, undefined, ts.getGeneratedNameForNode(node), undefined, undefined, undefined, node), node);\n            }\n            else if (node.initializer) {\n                return ts.setOriginalNode(ts.createParameter(undefined, undefined, undefined, node.name, undefined, undefined, undefined, node), node);\n            }\n            else {\n                return node;\n            }\n        }\n        function shouldAddDefaultValueAssignments(node) {\n            return (node.transformFlags & 131072) !== 0;\n        }\n        function addDefaultValueAssignmentsIfNeeded(statements, node) {\n            if (!shouldAddDefaultValueAssignments(node)) {\n                return;\n            }\n            for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {\n                var parameter = _a[_i];\n                var name_38 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;\n                if (dotDotDotToken) {\n                    continue;\n                }\n                if (ts.isBindingPattern(name_38)) {\n                    addDefaultValueAssignmentForBindingPattern(statements, parameter, name_38, initializer);\n                }\n                else if (initializer) {\n                    addDefaultValueAssignmentForInitializer(statements, parameter, name_38, initializer);\n                }\n            }\n        }\n        function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) {\n            var temp = ts.getGeneratedNameForNode(parameter);\n            if (name.elements.length > 0) {\n                statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0, temp))), 524288));\n            }\n            else if (initializer) {\n                statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 524288));\n            }\n        }\n        function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) {\n            initializer = ts.visitNode(initializer, visitor, ts.isExpression);\n            var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), \"undefined\"), ts.setEmitFlags(ts.createBlock([\n                ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48), ts.setEmitFlags(initializer, 48 | ts.getEmitFlags(initializer)), parameter))\n            ], parameter), 1 | 32 | 384), undefined, parameter);\n            statement.startsOnNewLine = true;\n            ts.setEmitFlags(statement, 384 | 32 | 524288);\n            statements.push(statement);\n        }\n        function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {\n            return node && node.dotDotDotToken && node.name.kind === 70 && !inConstructorWithSynthesizedSuper;\n        }\n        function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {\n            var parameter = ts.lastOrUndefined(node.parameters);\n            if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {\n                return;\n            }\n            var declarationName = ts.getMutableClone(parameter.name);\n            ts.setEmitFlags(declarationName, 48);\n            var expressionName = ts.getSynthesizedClone(parameter.name);\n            var restIndex = node.parameters.length - 1;\n            var temp = ts.createLoopVariable();\n            statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(declarationName, undefined, ts.createArrayLiteral([]))\n            ]), parameter), 524288));\n            var forStatement = ts.createFor(ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(temp, undefined, ts.createLiteral(restIndex))\n            ], parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier(\"arguments\"), \"length\"), parameter), ts.createPostfixIncrement(temp, parameter), ts.createBlock([\n                ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0\n                    ? temp\n                    : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier(\"arguments\"), temp)), parameter))\n            ]));\n            ts.setEmitFlags(forStatement, 524288);\n            ts.startOnNewLine(forStatement);\n            statements.push(forStatement);\n        }\n        function addCaptureThisForNodeIfNeeded(statements, node) {\n            if (node.transformFlags & 32768 && node.kind !== 185) {\n                captureThisForNode(statements, node, ts.createThis());\n            }\n        }\n        function captureThisForNode(statements, node, initializer, originalStatement) {\n            enableSubstitutionsForCapturedThis();\n            var captureThisStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(\"_this\", undefined, initializer)\n            ]), originalStatement);\n            ts.setEmitFlags(captureThisStatement, 1536 | 524288);\n            ts.setSourceMapRange(captureThisStatement, node);\n            statements.push(captureThisStatement);\n        }\n        function addClassMembers(statements, node) {\n            for (var _i = 0, _a = node.members; _i < _a.length; _i++) {\n                var member = _a[_i];\n                switch (member.kind) {\n                    case 203:\n                        statements.push(transformSemicolonClassElementToStatement(member));\n                        break;\n                    case 149:\n                        statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member));\n                        break;\n                    case 151:\n                    case 152:\n                        var accessors = ts.getAllAccessorDeclarations(node.members, member);\n                        if (member === accessors.firstAccessor) {\n                            statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors));\n                        }\n                        break;\n                    case 150:\n                        break;\n                    default:\n                        ts.Debug.failBadSyntaxKind(node);\n                        break;\n                }\n            }\n        }\n        function transformSemicolonClassElementToStatement(member) {\n            return ts.createEmptyStatement(member);\n        }\n        function transformClassMethodDeclarationToStatement(receiver, member) {\n            var commentRange = ts.getCommentRange(member);\n            var sourceMapRange = ts.getSourceMapRange(member);\n            var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name);\n            var memberFunction = transformFunctionLikeToExpression(member, member, undefined);\n            ts.setEmitFlags(memberFunction, 1536);\n            ts.setSourceMapRange(memberFunction, sourceMapRange);\n            var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), member);\n            ts.setOriginalNode(statement, member);\n            ts.setCommentRange(statement, commentRange);\n            ts.setEmitFlags(statement, 48);\n            return statement;\n        }\n        function transformAccessorsToStatement(receiver, accessors) {\n            var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, false), ts.getSourceMapRange(accessors.firstAccessor));\n            ts.setEmitFlags(statement, 1536);\n            return statement;\n        }\n        function transformAccessorsToExpression(receiver, _a, startsOnNewLine) {\n            var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;\n            var target = ts.getMutableClone(receiver);\n            ts.setEmitFlags(target, 1536 | 32);\n            ts.setSourceMapRange(target, firstAccessor.name);\n            var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName));\n            ts.setEmitFlags(propertyName, 1536 | 16);\n            ts.setSourceMapRange(propertyName, firstAccessor.name);\n            var properties = [];\n            if (getAccessor) {\n                var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined);\n                ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor));\n                ts.setEmitFlags(getterFunction, 512);\n                var getter = ts.createPropertyAssignment(\"get\", getterFunction);\n                ts.setCommentRange(getter, ts.getCommentRange(getAccessor));\n                properties.push(getter);\n            }\n            if (setAccessor) {\n                var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined);\n                ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor));\n                ts.setEmitFlags(setterFunction, 512);\n                var setter = ts.createPropertyAssignment(\"set\", setterFunction);\n                ts.setCommentRange(setter, ts.getCommentRange(setAccessor));\n                properties.push(setter);\n            }\n            properties.push(ts.createPropertyAssignment(\"enumerable\", ts.createLiteral(true)), ts.createPropertyAssignment(\"configurable\", ts.createLiteral(true)));\n            var call = ts.createCall(ts.createPropertyAccess(ts.createIdentifier(\"Object\"), \"defineProperty\"), undefined, [\n                target,\n                propertyName,\n                ts.createObjectLiteral(properties, undefined, true)\n            ]);\n            if (startsOnNewLine) {\n                call.startsOnNewLine = true;\n            }\n            return call;\n        }\n        function visitArrowFunction(node) {\n            if (node.transformFlags & 16384) {\n                enableSubstitutionsForCapturedThis();\n            }\n            var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node), node);\n            ts.setOriginalNode(func, node);\n            ts.setEmitFlags(func, 8);\n            return func;\n        }\n        function visitFunctionExpression(node) {\n            return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64\n                ? transformFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        function visitFunctionDeclaration(node) {\n            return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64\n                ? transformFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        function transformFunctionLikeToExpression(node, location, name) {\n            var savedContainingNonArrowFunction = enclosingNonArrowFunction;\n            if (node.kind !== 185) {\n                enclosingNonArrowFunction = node;\n            }\n            var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node);\n            enclosingNonArrowFunction = savedContainingNonArrowFunction;\n            return expression;\n        }\n        function transformFunctionBody(node) {\n            var multiLine = false;\n            var singleLine = false;\n            var statementsLocation;\n            var closeBraceLocation;\n            var statements = [];\n            var body = node.body;\n            var statementOffset;\n            resumeLexicalEnvironment();\n            if (ts.isBlock(body)) {\n                statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor);\n            }\n            addCaptureThisForNodeIfNeeded(statements, node);\n            addDefaultValueAssignmentsIfNeeded(statements, node);\n            addRestParameterIfNeeded(statements, node, false);\n            if (!multiLine && statements.length > 0) {\n                multiLine = true;\n            }\n            if (ts.isBlock(body)) {\n                statementsLocation = body.statements;\n                ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));\n                if (!multiLine && body.multiLine) {\n                    multiLine = true;\n                }\n            }\n            else {\n                ts.Debug.assert(node.kind === 185);\n                statementsLocation = ts.moveRangeEnd(body, -1);\n                var equalsGreaterThanToken = node.equalsGreaterThanToken;\n                if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {\n                    if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {\n                        singleLine = true;\n                    }\n                    else {\n                        multiLine = true;\n                    }\n                }\n                var expression = ts.visitNode(body, visitor, ts.isExpression);\n                var returnStatement = ts.createReturn(expression, body);\n                ts.setEmitFlags(returnStatement, 384 | 32 | 1024);\n                statements.push(returnStatement);\n                closeBraceLocation = body;\n            }\n            var lexicalEnvironment = context.endLexicalEnvironment();\n            ts.addRange(statements, lexicalEnvironment);\n            if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {\n                multiLine = true;\n            }\n            var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine);\n            if (!multiLine && singleLine) {\n                ts.setEmitFlags(block, 1);\n            }\n            if (closeBraceLocation) {\n                ts.setTokenSourceMapRange(block, 17, closeBraceLocation);\n            }\n            ts.setOriginalNode(block, node.body);\n            return block;\n        }\n        function visitExpressionStatement(node) {\n            switch (node.expression.kind) {\n                case 183:\n                    return ts.updateStatement(node, visitParenthesizedExpression(node.expression, false));\n                case 192:\n                    return ts.updateStatement(node, visitBinaryExpression(node.expression, false));\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitParenthesizedExpression(node, needsDestructuringValue) {\n            if (!needsDestructuringValue) {\n                switch (node.expression.kind) {\n                    case 183:\n                        return ts.updateParen(node, visitParenthesizedExpression(node.expression, false));\n                    case 192:\n                        return ts.updateParen(node, visitBinaryExpression(node.expression, false));\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitBinaryExpression(node, needsDestructuringValue) {\n            if (ts.isDestructuringAssignment(node)) {\n                return ts.flattenDestructuringAssignment(node, visitor, context, 0, needsDestructuringValue);\n            }\n        }\n        function visitVariableStatement(node) {\n            if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3) == 0) {\n                var assignments = void 0;\n                for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    hoistVariableDeclarationDeclaredInConvertedLoop(convertedLoopState, decl);\n                    if (decl.initializer) {\n                        var assignment = void 0;\n                        if (ts.isBindingPattern(decl.name)) {\n                            assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0);\n                        }\n                        else {\n                            assignment = ts.createBinary(decl.name, 57, ts.visitNode(decl.initializer, visitor, ts.isExpression));\n                        }\n                        (assignments || (assignments = [])).push(assignment);\n                    }\n                }\n                if (assignments) {\n                    return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25, acc); }), node);\n                }\n                else {\n                    return undefined;\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitVariableDeclarationList(node) {\n            if (node.flags & 3) {\n                enableSubstitutionsForBlockScopedBindings();\n            }\n            var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1\n                ? visitVariableDeclarationInLetDeclarationList\n                : visitVariableDeclaration));\n            var declarationList = ts.createVariableDeclarationList(declarations, node);\n            ts.setOriginalNode(declarationList, node);\n            ts.setCommentRange(declarationList, node);\n            if (node.transformFlags & 8388608\n                && (ts.isBindingPattern(node.declarations[0].name)\n                    || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) {\n                var firstDeclaration = ts.firstOrUndefined(declarations);\n                var lastDeclaration = ts.lastOrUndefined(declarations);\n                ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));\n            }\n            return declarationList;\n        }\n        function shouldEmitExplicitInitializerForLetDeclaration(node) {\n            var flags = resolver.getNodeCheckFlags(node);\n            var isCapturedInFunction = flags & 131072;\n            var isDeclaredInLoop = flags & 262144;\n            var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(enclosingBlockScopeContainer)\n                || (isCapturedInFunction\n                    && isDeclaredInLoop\n                    && ts.isBlock(enclosingBlockScopeContainer)\n                    && ts.isIterationStatement(enclosingBlockScopeContainerParent, false));\n            var emitExplicitInitializer = !emittedAsTopLevel\n                && enclosingBlockScopeContainer.kind !== 212\n                && enclosingBlockScopeContainer.kind !== 213\n                && (!resolver.isDeclarationWithCollidingName(node)\n                    || (isDeclaredInLoop\n                        && !isCapturedInFunction\n                        && !ts.isIterationStatement(enclosingBlockScopeContainer, false)));\n            return emitExplicitInitializer;\n        }\n        function visitVariableDeclarationInLetDeclarationList(node) {\n            var name = node.name;\n            if (ts.isBindingPattern(name)) {\n                return visitVariableDeclaration(node);\n            }\n            if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) {\n                var clone_3 = ts.getMutableClone(node);\n                clone_3.initializer = ts.createVoidZero();\n                return clone_3;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitVariableDeclaration(node) {\n            if (ts.isBindingPattern(node.name)) {\n                var hoistTempVariables = enclosingVariableStatement\n                    && ts.hasModifier(enclosingVariableStatement, 1);\n                return ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, hoistTempVariables);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitLabeledStatement(node) {\n            if (convertedLoopState) {\n                if (!convertedLoopState.labels) {\n                    convertedLoopState.labels = ts.createMap();\n                }\n                convertedLoopState.labels[node.label.text] = node.label.text;\n            }\n            var result;\n            if (ts.isIterationStatement(node.statement, false) && shouldConvertIterationStatementBody(node.statement)) {\n                result = ts.visitNodes(ts.createNodeArray([node.statement]), visitor, ts.isStatement);\n            }\n            else {\n                result = ts.visitEachChild(node, visitor, context);\n            }\n            if (convertedLoopState) {\n                convertedLoopState.labels[node.label.text] = undefined;\n            }\n            return result;\n        }\n        function visitDoStatement(node) {\n            return convertIterationStatementBodyIfNecessary(node);\n        }\n        function visitWhileStatement(node) {\n            return convertIterationStatementBodyIfNecessary(node);\n        }\n        function visitForStatement(node) {\n            return convertIterationStatementBodyIfNecessary(node);\n        }\n        function visitForInStatement(node) {\n            return convertIterationStatementBodyIfNecessary(node);\n        }\n        function visitForOfStatement(node) {\n            return convertIterationStatementBodyIfNecessary(node, convertForOfToFor);\n        }\n        function convertForOfToFor(node, convertedLoopBodyStatements) {\n            var expression = ts.visitNode(node.expression, visitor, ts.isExpression);\n            var initializer = node.initializer;\n            var statements = [];\n            var counter = ts.createLoopVariable();\n            var rhsReference = expression.kind === 70\n                ? ts.createUniqueName(expression.text)\n                : ts.createTempVariable(undefined);\n            var elementAccess = ts.createElementAccess(rhsReference, counter);\n            if (ts.isVariableDeclarationList(initializer)) {\n                if (initializer.flags & 3) {\n                    enableSubstitutionsForBlockScopedBindings();\n                }\n                var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);\n                if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {\n                    var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0, elementAccess);\n                    var declarationList = ts.createVariableDeclarationList(declarations, initializer);\n                    ts.setOriginalNode(declarationList, initializer);\n                    var firstDeclaration = declarations[0];\n                    var lastDeclaration = ts.lastOrUndefined(declarations);\n                    ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));\n                    statements.push(ts.createVariableStatement(undefined, declarationList));\n                }\n                else {\n                    statements.push(ts.createVariableStatement(undefined, ts.setOriginalNode(ts.createVariableDeclarationList([\n                        ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(undefined), undefined, ts.createElementAccess(rhsReference, counter))\n                    ], ts.moveRangePos(initializer, -1)), initializer), ts.moveRangeEnd(initializer, -1)));\n                }\n            }\n            else {\n                var assignment = ts.createAssignment(initializer, elementAccess);\n                if (ts.isDestructuringAssignment(assignment)) {\n                    statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0)));\n                }\n                else {\n                    assignment.end = initializer.end;\n                    statements.push(ts.createStatement(assignment, ts.moveRangeEnd(initializer, -1)));\n                }\n            }\n            var bodyLocation;\n            var statementsLocation;\n            if (convertedLoopBodyStatements) {\n                ts.addRange(statements, convertedLoopBodyStatements);\n            }\n            else {\n                var statement = ts.visitNode(node.statement, visitor, ts.isStatement);\n                if (ts.isBlock(statement)) {\n                    ts.addRange(statements, statement.statements);\n                    bodyLocation = statement;\n                    statementsLocation = statement.statements;\n                }\n                else {\n                    statements.push(statement);\n                }\n            }\n            ts.setEmitFlags(expression, 48 | ts.getEmitFlags(expression));\n            var body = ts.createBlock(ts.createNodeArray(statements, statementsLocation), bodyLocation);\n            ts.setEmitFlags(body, 48 | 384);\n            var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(counter, undefined, ts.createLiteral(0), ts.moveRangePos(node.expression, -1)),\n                ts.createVariableDeclaration(rhsReference, undefined, expression, node.expression)\n            ], node.expression), 1048576), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, \"length\"), node.expression), ts.createPostfixIncrement(counter, node.expression), body, node);\n            ts.setEmitFlags(forStatement, 256);\n            return forStatement;\n        }\n        function visitObjectLiteralExpression(node) {\n            var properties = node.properties;\n            var numProperties = properties.length;\n            var numInitialProperties = numProperties;\n            for (var i = 0; i < numProperties; i++) {\n                var property = properties[i];\n                if (property.transformFlags & 16777216\n                    || property.name.kind === 142) {\n                    numInitialProperties = i;\n                    break;\n                }\n            }\n            ts.Debug.assert(numInitialProperties !== numProperties);\n            var temp = ts.createTempVariable(hoistVariableDeclaration);\n            var expressions = [];\n            var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 32768));\n            if (node.multiLine) {\n                assignment.startsOnNewLine = true;\n            }\n            expressions.push(assignment);\n            addObjectLiteralMembers(expressions, node, temp, numInitialProperties);\n            expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp);\n            return ts.inlineExpressions(expressions);\n        }\n        function shouldConvertIterationStatementBody(node) {\n            return (resolver.getNodeCheckFlags(node) & 65536) !== 0;\n        }\n        function hoistVariableDeclarationDeclaredInConvertedLoop(state, node) {\n            if (!state.hoistedLocalVariables) {\n                state.hoistedLocalVariables = [];\n            }\n            visit(node.name);\n            function visit(node) {\n                if (node.kind === 70) {\n                    state.hoistedLocalVariables.push(node);\n                }\n                else {\n                    for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {\n                        var element = _a[_i];\n                        if (!ts.isOmittedExpression(element)) {\n                            visit(element.name);\n                        }\n                    }\n                }\n            }\n        }\n        function convertIterationStatementBodyIfNecessary(node, convert) {\n            if (!shouldConvertIterationStatementBody(node)) {\n                var saveAllowedNonLabeledJumps = void 0;\n                if (convertedLoopState) {\n                    saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps;\n                    convertedLoopState.allowedNonLabeledJumps = 2 | 4;\n                }\n                var result = convert ? convert(node, undefined) : ts.visitEachChild(node, visitor, context);\n                if (convertedLoopState) {\n                    convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps;\n                }\n                return result;\n            }\n            var functionName = ts.createUniqueName(\"_loop\");\n            var loopInitializer;\n            switch (node.kind) {\n                case 211:\n                case 212:\n                case 213:\n                    var initializer = node.initializer;\n                    if (initializer && initializer.kind === 224) {\n                        loopInitializer = initializer;\n                    }\n                    break;\n            }\n            var loopParameters = [];\n            var loopOutParameters = [];\n            if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 3)) {\n                for (var _i = 0, _a = loopInitializer.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    processLoopVariableDeclaration(decl, loopParameters, loopOutParameters);\n                }\n            }\n            var outerConvertedLoopState = convertedLoopState;\n            convertedLoopState = { loopOutParameters: loopOutParameters };\n            if (outerConvertedLoopState) {\n                if (outerConvertedLoopState.argumentsName) {\n                    convertedLoopState.argumentsName = outerConvertedLoopState.argumentsName;\n                }\n                if (outerConvertedLoopState.thisName) {\n                    convertedLoopState.thisName = outerConvertedLoopState.thisName;\n                }\n                if (outerConvertedLoopState.hoistedLocalVariables) {\n                    convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables;\n                }\n            }\n            var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement);\n            var currentState = convertedLoopState;\n            convertedLoopState = outerConvertedLoopState;\n            if (loopOutParameters.length) {\n                var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody];\n                copyOutParameters(loopOutParameters, 1, statements_4);\n                loopBody = ts.createBlock(statements_4, undefined, true);\n            }\n            if (!ts.isBlock(loopBody)) {\n                loopBody = ts.createBlock([loopBody], undefined, true);\n            }\n            var isAsyncBlockContainingAwait = enclosingNonArrowFunction\n                && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072) !== 0\n                && (node.statement.transformFlags & 16777216) !== 0;\n            var loopBodyFlags = 0;\n            if (currentState.containsLexicalThis) {\n                loopBodyFlags |= 8;\n            }\n            if (isAsyncBlockContainingAwait) {\n                loopBodyFlags |= 131072;\n            }\n            var convertedLoopVariable = ts.createVariableStatement(undefined, ts.setEmitFlags(ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(functionName, undefined, ts.setEmitFlags(ts.createFunctionExpression(undefined, isAsyncBlockContainingAwait ? ts.createToken(38) : undefined, undefined, undefined, loopParameters, undefined, loopBody), loopBodyFlags))\n            ]), 1048576));\n            var statements = [convertedLoopVariable];\n            var extraVariableDeclarations;\n            if (currentState.argumentsName) {\n                if (outerConvertedLoopState) {\n                    outerConvertedLoopState.argumentsName = currentState.argumentsName;\n                }\n                else {\n                    (extraVariableDeclarations || (extraVariableDeclarations = [])).push(ts.createVariableDeclaration(currentState.argumentsName, undefined, ts.createIdentifier(\"arguments\")));\n                }\n            }\n            if (currentState.thisName) {\n                if (outerConvertedLoopState) {\n                    outerConvertedLoopState.thisName = currentState.thisName;\n                }\n                else {\n                    (extraVariableDeclarations || (extraVariableDeclarations = [])).push(ts.createVariableDeclaration(currentState.thisName, undefined, ts.createIdentifier(\"this\")));\n                }\n            }\n            if (currentState.hoistedLocalVariables) {\n                if (outerConvertedLoopState) {\n                    outerConvertedLoopState.hoistedLocalVariables = currentState.hoistedLocalVariables;\n                }\n                else {\n                    if (!extraVariableDeclarations) {\n                        extraVariableDeclarations = [];\n                    }\n                    for (var _b = 0, _c = currentState.hoistedLocalVariables; _b < _c.length; _b++) {\n                        var identifier = _c[_b];\n                        extraVariableDeclarations.push(ts.createVariableDeclaration(identifier));\n                    }\n                }\n            }\n            if (loopOutParameters.length) {\n                if (!extraVariableDeclarations) {\n                    extraVariableDeclarations = [];\n                }\n                for (var _d = 0, loopOutParameters_1 = loopOutParameters; _d < loopOutParameters_1.length; _d++) {\n                    var outParam = loopOutParameters_1[_d];\n                    extraVariableDeclarations.push(ts.createVariableDeclaration(outParam.outParamName));\n                }\n            }\n            if (extraVariableDeclarations) {\n                statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(extraVariableDeclarations)));\n            }\n            var convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait);\n            var loop;\n            if (convert) {\n                loop = convert(node, convertedLoopBodyStatements);\n            }\n            else {\n                loop = ts.getMutableClone(node);\n                loop.statement = undefined;\n                loop = ts.visitEachChild(loop, visitor, context);\n                loop.statement = ts.createBlock(convertedLoopBodyStatements, undefined, true);\n                loop.transformFlags = 0;\n                ts.aggregateTransformFlags(loop);\n            }\n            statements.push(currentParent.kind === 219\n                ? ts.createLabel(currentParent.label, loop)\n                : loop);\n            return statements;\n        }\n        function copyOutParameter(outParam, copyDirection) {\n            var source = copyDirection === 0 ? outParam.outParamName : outParam.originalName;\n            var target = copyDirection === 0 ? outParam.originalName : outParam.outParamName;\n            return ts.createBinary(target, 57, source);\n        }\n        function copyOutParameters(outParams, copyDirection, statements) {\n            for (var _i = 0, outParams_1 = outParams; _i < outParams_1.length; _i++) {\n                var outParam = outParams_1[_i];\n                statements.push(ts.createStatement(copyOutParameter(outParam, copyDirection)));\n            }\n        }\n        function generateCallToConvertedLoop(loopFunctionExpressionName, parameters, state, isAsyncBlockContainingAwait) {\n            var outerConvertedLoopState = convertedLoopState;\n            var statements = [];\n            var isSimpleLoop = !(state.nonLocalJumps & ~4) &&\n                !state.labeledNonLocalBreaks &&\n                !state.labeledNonLocalContinues;\n            var call = ts.createCall(loopFunctionExpressionName, undefined, ts.map(parameters, function (p) { return p.name; }));\n            var callResult = isAsyncBlockContainingAwait ? ts.createYield(ts.createToken(38), call) : call;\n            if (isSimpleLoop) {\n                statements.push(ts.createStatement(callResult));\n                copyOutParameters(state.loopOutParameters, 0, statements);\n            }\n            else {\n                var loopResultName = ts.createUniqueName(\"state\");\n                var stateVariable = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ts.createVariableDeclaration(loopResultName, undefined, callResult)]));\n                statements.push(stateVariable);\n                copyOutParameters(state.loopOutParameters, 0, statements);\n                if (state.nonLocalJumps & 8) {\n                    var returnStatement = void 0;\n                    if (outerConvertedLoopState) {\n                        outerConvertedLoopState.nonLocalJumps |= 8;\n                        returnStatement = ts.createReturn(loopResultName);\n                    }\n                    else {\n                        returnStatement = ts.createReturn(ts.createPropertyAccess(loopResultName, \"value\"));\n                    }\n                    statements.push(ts.createIf(ts.createBinary(ts.createTypeOf(loopResultName), 33, ts.createLiteral(\"object\")), returnStatement));\n                }\n                if (state.nonLocalJumps & 2) {\n                    statements.push(ts.createIf(ts.createBinary(loopResultName, 33, ts.createLiteral(\"break\")), ts.createBreak()));\n                }\n                if (state.labeledNonLocalBreaks || state.labeledNonLocalContinues) {\n                    var caseClauses = [];\n                    processLabeledJumps(state.labeledNonLocalBreaks, true, loopResultName, outerConvertedLoopState, caseClauses);\n                    processLabeledJumps(state.labeledNonLocalContinues, false, loopResultName, outerConvertedLoopState, caseClauses);\n                    statements.push(ts.createSwitch(loopResultName, ts.createCaseBlock(caseClauses)));\n                }\n            }\n            return statements;\n        }\n        function setLabeledJump(state, isBreak, labelText, labelMarker) {\n            if (isBreak) {\n                if (!state.labeledNonLocalBreaks) {\n                    state.labeledNonLocalBreaks = ts.createMap();\n                }\n                state.labeledNonLocalBreaks[labelText] = labelMarker;\n            }\n            else {\n                if (!state.labeledNonLocalContinues) {\n                    state.labeledNonLocalContinues = ts.createMap();\n                }\n                state.labeledNonLocalContinues[labelText] = labelMarker;\n            }\n        }\n        function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) {\n            if (!table) {\n                return;\n            }\n            for (var labelText in table) {\n                var labelMarker = table[labelText];\n                var statements = [];\n                if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) {\n                    var label = ts.createIdentifier(labelText);\n                    statements.push(isBreak ? ts.createBreak(label) : ts.createContinue(label));\n                }\n                else {\n                    setLabeledJump(outerLoop, isBreak, labelText, labelMarker);\n                    statements.push(ts.createReturn(loopResultName));\n                }\n                caseClauses.push(ts.createCaseClause(ts.createLiteral(labelMarker), statements));\n            }\n        }\n        function processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) {\n            var name = decl.name;\n            if (ts.isBindingPattern(name)) {\n                for (var _i = 0, _a = name.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        processLoopVariableDeclaration(element, loopParameters, loopOutParameters);\n                    }\n                }\n            }\n            else {\n                loopParameters.push(ts.createParameter(undefined, undefined, undefined, name));\n                if (resolver.getNodeCheckFlags(decl) & 2097152) {\n                    var outParamName = ts.createUniqueName(\"out_\" + name.text);\n                    loopOutParameters.push({ originalName: name, outParamName: outParamName });\n                }\n            }\n        }\n        function addObjectLiteralMembers(expressions, node, receiver, start) {\n            var properties = node.properties;\n            var numProperties = properties.length;\n            for (var i = start; i < numProperties; i++) {\n                var property = properties[i];\n                switch (property.kind) {\n                    case 151:\n                    case 152:\n                        var accessors = ts.getAllAccessorDeclarations(node.properties, property);\n                        if (property === accessors.firstAccessor) {\n                            expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine));\n                        }\n                        break;\n                    case 257:\n                        expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine));\n                        break;\n                    case 258:\n                        expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine));\n                        break;\n                    case 149:\n                        expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine));\n                        break;\n                    default:\n                        ts.Debug.failBadSyntaxKind(node);\n                        break;\n                }\n            }\n        }\n        function transformPropertyAssignmentToExpression(property, receiver, startsOnNewLine) {\n            var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression), property);\n            if (startsOnNewLine) {\n                expression.startsOnNewLine = true;\n            }\n            return expression;\n        }\n        function transformShorthandPropertyAssignmentToExpression(property, receiver, startsOnNewLine) {\n            var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name), property);\n            if (startsOnNewLine) {\n                expression.startsOnNewLine = true;\n            }\n            return expression;\n        }\n        function transformObjectLiteralMethodDeclarationToExpression(method, receiver, startsOnNewLine) {\n            var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined), method);\n            if (startsOnNewLine) {\n                expression.startsOnNewLine = true;\n            }\n            return expression;\n        }\n        function visitCatchClause(node) {\n            ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name));\n            var temp = ts.createTempVariable(undefined);\n            var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration);\n            var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp);\n            var list = ts.createVariableDeclarationList(vars, node.variableDeclaration, node.variableDeclaration.flags);\n            var destructure = ts.createVariableStatement(undefined, list);\n            return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure));\n        }\n        function addStatementToStartOfBlock(block, statement) {\n            var transformedStatements = ts.visitNodes(block.statements, visitor, ts.isStatement);\n            return ts.updateBlock(block, [statement].concat(transformedStatements));\n        }\n        function visitMethodDeclaration(node) {\n            ts.Debug.assert(!ts.isComputedPropertyName(node.name));\n            var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined);\n            ts.setEmitFlags(functionExpression, 512 | ts.getEmitFlags(functionExpression));\n            return ts.createPropertyAssignment(node.name, functionExpression, node);\n        }\n        function visitShorthandPropertyAssignment(node) {\n            return ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name), node);\n        }\n        function visitYieldExpression(node) {\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitArrayLiteralExpression(node) {\n            return transformAndSpreadElements(node.elements, true, node.multiLine, node.elements.hasTrailingComma);\n        }\n        function visitCallExpression(node) {\n            return visitCallExpressionWithPotentialCapturedThisAssignment(node, true);\n        }\n        function visitImmediateSuperCallInBody(node) {\n            return visitCallExpressionWithPotentialCapturedThisAssignment(node, false);\n        }\n        function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) {\n            var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;\n            if (node.expression.kind === 96) {\n                ts.setEmitFlags(thisArg, 4);\n            }\n            var resultingCall;\n            if (node.transformFlags & 524288) {\n                resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false));\n            }\n            else {\n                resultingCall = ts.createFunctionCall(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node);\n            }\n            if (node.expression.kind === 96) {\n                var actualThis = ts.createThis();\n                ts.setEmitFlags(actualThis, 4);\n                var initializer = ts.createLogicalOr(resultingCall, actualThis);\n                return assignToCapturedThis\n                    ? ts.createAssignment(ts.createIdentifier(\"_this\"), initializer)\n                    : initializer;\n            }\n            return resultingCall;\n        }\n        function visitNewExpression(node) {\n            ts.Debug.assert((node.transformFlags & 524288) !== 0);\n            var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, \"bind\"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;\n            return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []);\n        }\n        function transformAndSpreadElements(elements, needsUniqueCopy, multiLine, hasTrailingComma) {\n            var numElements = elements.length;\n            var segments = ts.flatten(ts.spanMap(elements, partitionSpread, function (partition, visitPartition, _start, end) {\n                return visitPartition(partition, multiLine, hasTrailingComma && end === numElements);\n            }));\n            if (segments.length === 1) {\n                var firstElement = elements[0];\n                return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 175\n                    ? ts.createArraySlice(segments[0])\n                    : segments[0];\n            }\n            return ts.createArrayConcat(segments.shift(), segments);\n        }\n        function partitionSpread(node) {\n            return ts.isSpreadExpression(node)\n                ? visitSpanOfSpreads\n                : visitSpanOfNonSpreads;\n        }\n        function visitSpanOfSpreads(chunk) {\n            return ts.map(chunk, visitExpressionOfSpread);\n        }\n        function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) {\n            return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, undefined, hasTrailingComma), visitor, ts.isExpression), undefined, multiLine);\n        }\n        function visitSpreadElement(node) {\n            return ts.visitNode(node.expression, visitor, ts.isExpression);\n        }\n        function visitExpressionOfSpread(node) {\n            return ts.visitNode(node.expression, visitor, ts.isExpression);\n        }\n        function visitTemplateLiteral(node) {\n            return ts.createLiteral(node.text, node);\n        }\n        function visitTaggedTemplateExpression(node) {\n            var tag = ts.visitNode(node.tag, visitor, ts.isExpression);\n            var temp = ts.createTempVariable(hoistVariableDeclaration);\n            var templateArguments = [temp];\n            var cookedStrings = [];\n            var rawStrings = [];\n            var template = node.template;\n            if (ts.isNoSubstitutionTemplateLiteral(template)) {\n                cookedStrings.push(ts.createLiteral(template.text));\n                rawStrings.push(getRawLiteral(template));\n            }\n            else {\n                cookedStrings.push(ts.createLiteral(template.head.text));\n                rawStrings.push(getRawLiteral(template.head));\n                for (var _i = 0, _a = template.templateSpans; _i < _a.length; _i++) {\n                    var templateSpan = _a[_i];\n                    cookedStrings.push(ts.createLiteral(templateSpan.literal.text));\n                    rawStrings.push(getRawLiteral(templateSpan.literal));\n                    templateArguments.push(ts.visitNode(templateSpan.expression, visitor, ts.isExpression));\n                }\n            }\n            return ts.createParen(ts.inlineExpressions([\n                ts.createAssignment(temp, ts.createArrayLiteral(cookedStrings)),\n                ts.createAssignment(ts.createPropertyAccess(temp, \"raw\"), ts.createArrayLiteral(rawStrings)),\n                ts.createCall(tag, undefined, templateArguments)\n            ]));\n        }\n        function getRawLiteral(node) {\n            var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);\n            var isLast = node.kind === 12 || node.kind === 15;\n            text = text.substring(1, text.length - (isLast ? 1 : 2));\n            text = text.replace(/\\r\\n?/g, \"\\n\");\n            return ts.createLiteral(text, node);\n        }\n        function visitTemplateExpression(node) {\n            var expressions = [];\n            addTemplateHead(expressions, node);\n            addTemplateSpans(expressions, node);\n            var expression = ts.reduceLeft(expressions, ts.createAdd);\n            if (ts.nodeIsSynthesized(expression)) {\n                ts.setTextRange(expression, node);\n            }\n            return expression;\n        }\n        function shouldAddTemplateHead(node) {\n            ts.Debug.assert(node.templateSpans.length !== 0);\n            return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0;\n        }\n        function addTemplateHead(expressions, node) {\n            if (!shouldAddTemplateHead(node)) {\n                return;\n            }\n            expressions.push(ts.createLiteral(node.head.text));\n        }\n        function addTemplateSpans(expressions, node) {\n            for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) {\n                var span_6 = _a[_i];\n                expressions.push(ts.visitNode(span_6.expression, visitor, ts.isExpression));\n                if (span_6.literal.text.length !== 0) {\n                    expressions.push(ts.createLiteral(span_6.literal.text));\n                }\n            }\n        }\n        function visitSuperKeyword() {\n            return enclosingNonAsyncFunctionBody\n                && ts.isClassElement(enclosingNonAsyncFunctionBody)\n                && !ts.hasModifier(enclosingNonAsyncFunctionBody, 32)\n                && currentParent.kind !== 179\n                ? ts.createPropertyAccess(ts.createIdentifier(\"_super\"), \"prototype\")\n                : ts.createIdentifier(\"_super\");\n        }\n        function onEmitNode(emitContext, node, emitCallback) {\n            var savedEnclosingFunction = enclosingFunction;\n            if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) {\n                enclosingFunction = node;\n            }\n            previousOnEmitNode(emitContext, node, emitCallback);\n            enclosingFunction = savedEnclosingFunction;\n        }\n        function enableSubstitutionsForBlockScopedBindings() {\n            if ((enabledSubstitutions & 2) === 0) {\n                enabledSubstitutions |= 2;\n                context.enableSubstitution(70);\n            }\n        }\n        function enableSubstitutionsForCapturedThis() {\n            if ((enabledSubstitutions & 1) === 0) {\n                enabledSubstitutions |= 1;\n                context.enableSubstitution(98);\n                context.enableEmitNotification(150);\n                context.enableEmitNotification(149);\n                context.enableEmitNotification(151);\n                context.enableEmitNotification(152);\n                context.enableEmitNotification(185);\n                context.enableEmitNotification(184);\n                context.enableEmitNotification(225);\n            }\n        }\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (emitContext === 1) {\n                return substituteExpression(node);\n            }\n            if (ts.isIdentifier(node)) {\n                return substituteIdentifier(node);\n            }\n            return node;\n        }\n        function substituteIdentifier(node) {\n            if (enabledSubstitutions & 2) {\n                var original = ts.getParseTreeNode(node, ts.isIdentifier);\n                if (original && isNameOfDeclarationWithCollidingName(original)) {\n                    return ts.getGeneratedNameForNode(original);\n                }\n            }\n            return node;\n        }\n        function isNameOfDeclarationWithCollidingName(node) {\n            var parent = node.parent;\n            switch (parent.kind) {\n                case 174:\n                case 226:\n                case 229:\n                case 223:\n                    return parent.name === node\n                        && resolver.isDeclarationWithCollidingName(parent);\n            }\n            return false;\n        }\n        function substituteExpression(node) {\n            switch (node.kind) {\n                case 70:\n                    return substituteExpressionIdentifier(node);\n                case 98:\n                    return substituteThisKeyword(node);\n            }\n            return node;\n        }\n        function substituteExpressionIdentifier(node) {\n            if (enabledSubstitutions & 2) {\n                var declaration = resolver.getReferencedDeclarationWithCollidingName(node);\n                if (declaration) {\n                    return ts.getGeneratedNameForNode(declaration.name);\n                }\n            }\n            return node;\n        }\n        function substituteThisKeyword(node) {\n            if (enabledSubstitutions & 1\n                && enclosingFunction\n                && ts.getEmitFlags(enclosingFunction) & 8) {\n                return ts.createIdentifier(\"_this\", node);\n            }\n            return node;\n        }\n        function getClassMemberPrefix(node, member) {\n            var expression = ts.getLocalName(node);\n            return ts.hasModifier(member, 32) ? expression : ts.createPropertyAccess(expression, \"prototype\");\n        }\n        function hasSynthesizedDefaultSuperCall(constructor, hasExtendsClause) {\n            if (!constructor || !hasExtendsClause) {\n                return false;\n            }\n            if (ts.some(constructor.parameters)) {\n                return false;\n            }\n            var statement = ts.firstOrUndefined(constructor.body.statements);\n            if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 207) {\n                return false;\n            }\n            var statementExpression = statement.expression;\n            if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 179) {\n                return false;\n            }\n            var callTarget = statementExpression.expression;\n            if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 96) {\n                return false;\n            }\n            var callArgument = ts.singleOrUndefined(statementExpression.arguments);\n            if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 196) {\n                return false;\n            }\n            var expression = callArgument.expression;\n            return ts.isIdentifier(expression) && expression.text === \"arguments\";\n        }\n    }\n    ts.transformES2015 = transformES2015;\n    function createExtendsHelper(context, name) {\n        context.requestEmitHelper(extendsHelper);\n        return ts.createCall(ts.getHelperName(\"__extends\"), undefined, [\n            name,\n            ts.createIdentifier(\"_super\")\n        ]);\n    }\n    var extendsHelper = {\n        name: \"typescript:extends\",\n        scoped: false,\n        priority: 0,\n        text: \"\\n            var __extends = (this && this.__extends) || function (d, b) {\\n                for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\\n                function __() { this.constructor = d; }\\n                d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\\n            };\"\n    };\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var instructionNames = ts.createMap((_a = {},\n        _a[2] = \"return\",\n        _a[3] = \"break\",\n        _a[4] = \"yield\",\n        _a[5] = \"yield*\",\n        _a[7] = \"endfinally\",\n        _a));\n    function transformGenerators(context) {\n        var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration;\n        var compilerOptions = context.getCompilerOptions();\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        var resolver = context.getEmitResolver();\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        context.onSubstituteNode = onSubstituteNode;\n        var currentSourceFile;\n        var renamedCatchVariables;\n        var renamedCatchVariableDeclarations;\n        var inGeneratorFunctionBody;\n        var inStatementContainingYield;\n        var blocks;\n        var blockOffsets;\n        var blockActions;\n        var blockStack;\n        var labelOffsets;\n        var labelExpressions;\n        var nextLabelId = 1;\n        var operations;\n        var operationArguments;\n        var operationLocations;\n        var state;\n        var blockIndex = 0;\n        var labelNumber = 0;\n        var labelNumbers;\n        var lastOperationWasAbrupt;\n        var lastOperationWasCompletion;\n        var clauses;\n        var statements;\n        var exceptionBlockStack;\n        var currentExceptionBlock;\n        var withBlockStack;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)\n                || (node.transformFlags & 512) === 0) {\n                return node;\n            }\n            currentSourceFile = node;\n            var visited = ts.visitEachChild(node, visitor, context);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            currentSourceFile = undefined;\n            return visited;\n        }\n        function visitor(node) {\n            var transformFlags = node.transformFlags;\n            if (inStatementContainingYield) {\n                return visitJavaScriptInStatementContainingYield(node);\n            }\n            else if (inGeneratorFunctionBody) {\n                return visitJavaScriptInGeneratorFunctionBody(node);\n            }\n            else if (transformFlags & 256) {\n                return visitGenerator(node);\n            }\n            else if (transformFlags & 512) {\n                return ts.visitEachChild(node, visitor, context);\n            }\n            else {\n                return node;\n            }\n        }\n        function visitJavaScriptInStatementContainingYield(node) {\n            switch (node.kind) {\n                case 209:\n                    return visitDoStatement(node);\n                case 210:\n                    return visitWhileStatement(node);\n                case 218:\n                    return visitSwitchStatement(node);\n                case 219:\n                    return visitLabeledStatement(node);\n                default:\n                    return visitJavaScriptInGeneratorFunctionBody(node);\n            }\n        }\n        function visitJavaScriptInGeneratorFunctionBody(node) {\n            switch (node.kind) {\n                case 225:\n                    return visitFunctionDeclaration(node);\n                case 184:\n                    return visitFunctionExpression(node);\n                case 151:\n                case 152:\n                    return visitAccessorDeclaration(node);\n                case 205:\n                    return visitVariableStatement(node);\n                case 211:\n                    return visitForStatement(node);\n                case 212:\n                    return visitForInStatement(node);\n                case 215:\n                    return visitBreakStatement(node);\n                case 214:\n                    return visitContinueStatement(node);\n                case 216:\n                    return visitReturnStatement(node);\n                default:\n                    if (node.transformFlags & 16777216) {\n                        return visitJavaScriptContainingYield(node);\n                    }\n                    else if (node.transformFlags & (512 | 33554432)) {\n                        return ts.visitEachChild(node, visitor, context);\n                    }\n                    else {\n                        return node;\n                    }\n            }\n        }\n        function visitJavaScriptContainingYield(node) {\n            switch (node.kind) {\n                case 192:\n                    return visitBinaryExpression(node);\n                case 193:\n                    return visitConditionalExpression(node);\n                case 195:\n                    return visitYieldExpression(node);\n                case 175:\n                    return visitArrayLiteralExpression(node);\n                case 176:\n                    return visitObjectLiteralExpression(node);\n                case 178:\n                    return visitElementAccessExpression(node);\n                case 179:\n                    return visitCallExpression(node);\n                case 180:\n                    return visitNewExpression(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitGenerator(node) {\n            switch (node.kind) {\n                case 225:\n                    return visitFunctionDeclaration(node);\n                case 184:\n                    return visitFunctionExpression(node);\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitFunctionDeclaration(node) {\n            if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {\n                node = ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node);\n            }\n            else {\n                var savedInGeneratorFunctionBody = inGeneratorFunctionBody;\n                var savedInStatementContainingYield = inStatementContainingYield;\n                inGeneratorFunctionBody = false;\n                inStatementContainingYield = false;\n                node = ts.visitEachChild(node, visitor, context);\n                inGeneratorFunctionBody = savedInGeneratorFunctionBody;\n                inStatementContainingYield = savedInStatementContainingYield;\n            }\n            if (inGeneratorFunctionBody) {\n                hoistFunctionDeclaration(node);\n                return undefined;\n            }\n            else {\n                return node;\n            }\n        }\n        function visitFunctionExpression(node) {\n            if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {\n                node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node);\n            }\n            else {\n                var savedInGeneratorFunctionBody = inGeneratorFunctionBody;\n                var savedInStatementContainingYield = inStatementContainingYield;\n                inGeneratorFunctionBody = false;\n                inStatementContainingYield = false;\n                node = ts.visitEachChild(node, visitor, context);\n                inGeneratorFunctionBody = savedInGeneratorFunctionBody;\n                inStatementContainingYield = savedInStatementContainingYield;\n            }\n            return node;\n        }\n        function visitAccessorDeclaration(node) {\n            var savedInGeneratorFunctionBody = inGeneratorFunctionBody;\n            var savedInStatementContainingYield = inStatementContainingYield;\n            inGeneratorFunctionBody = false;\n            inStatementContainingYield = false;\n            node = ts.visitEachChild(node, visitor, context);\n            inGeneratorFunctionBody = savedInGeneratorFunctionBody;\n            inStatementContainingYield = savedInStatementContainingYield;\n            return node;\n        }\n        function transformGeneratorFunctionBody(body) {\n            var statements = [];\n            var savedInGeneratorFunctionBody = inGeneratorFunctionBody;\n            var savedInStatementContainingYield = inStatementContainingYield;\n            var savedBlocks = blocks;\n            var savedBlockOffsets = blockOffsets;\n            var savedBlockActions = blockActions;\n            var savedBlockStack = blockStack;\n            var savedLabelOffsets = labelOffsets;\n            var savedLabelExpressions = labelExpressions;\n            var savedNextLabelId = nextLabelId;\n            var savedOperations = operations;\n            var savedOperationArguments = operationArguments;\n            var savedOperationLocations = operationLocations;\n            var savedState = state;\n            inGeneratorFunctionBody = true;\n            inStatementContainingYield = false;\n            blocks = undefined;\n            blockOffsets = undefined;\n            blockActions = undefined;\n            blockStack = undefined;\n            labelOffsets = undefined;\n            labelExpressions = undefined;\n            nextLabelId = 1;\n            operations = undefined;\n            operationArguments = undefined;\n            operationLocations = undefined;\n            state = ts.createTempVariable(undefined);\n            resumeLexicalEnvironment();\n            var statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor);\n            transformAndEmitStatements(body.statements, statementOffset);\n            var buildResult = build();\n            ts.addRange(statements, endLexicalEnvironment());\n            statements.push(ts.createReturn(buildResult));\n            inGeneratorFunctionBody = savedInGeneratorFunctionBody;\n            inStatementContainingYield = savedInStatementContainingYield;\n            blocks = savedBlocks;\n            blockOffsets = savedBlockOffsets;\n            blockActions = savedBlockActions;\n            blockStack = savedBlockStack;\n            labelOffsets = savedLabelOffsets;\n            labelExpressions = savedLabelExpressions;\n            nextLabelId = savedNextLabelId;\n            operations = savedOperations;\n            operationArguments = savedOperationArguments;\n            operationLocations = savedOperationLocations;\n            state = savedState;\n            return ts.createBlock(statements, body, body.multiLine);\n        }\n        function visitVariableStatement(node) {\n            if (node.transformFlags & 16777216) {\n                transformAndEmitVariableDeclarationList(node.declarationList);\n                return undefined;\n            }\n            else {\n                if (ts.getEmitFlags(node) & 524288) {\n                    return node;\n                }\n                for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                    var variable = _a[_i];\n                    hoistVariableDeclaration(variable.name);\n                }\n                var variables = ts.getInitializedVariables(node.declarationList);\n                if (variables.length === 0) {\n                    return undefined;\n                }\n                return ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable)));\n            }\n        }\n        function visitBinaryExpression(node) {\n            switch (ts.getExpressionAssociativity(node)) {\n                case 0:\n                    return visitLeftAssociativeBinaryExpression(node);\n                case 1:\n                    return visitRightAssociativeBinaryExpression(node);\n                default:\n                    ts.Debug.fail(\"Unknown associativity.\");\n            }\n        }\n        function isCompoundAssignment(kind) {\n            return kind >= 58\n                && kind <= 69;\n        }\n        function getOperatorForCompoundAssignment(kind) {\n            switch (kind) {\n                case 58: return 36;\n                case 59: return 37;\n                case 60: return 38;\n                case 61: return 39;\n                case 62: return 40;\n                case 63: return 41;\n                case 64: return 44;\n                case 65: return 45;\n                case 66: return 46;\n                case 67: return 47;\n                case 68: return 48;\n                case 69: return 49;\n            }\n        }\n        function visitRightAssociativeBinaryExpression(node) {\n            var left = node.left, right = node.right;\n            if (containsYield(right)) {\n                var target = void 0;\n                switch (left.kind) {\n                    case 177:\n                        target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name);\n                        break;\n                    case 178:\n                        target = ts.updateElementAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression)));\n                        break;\n                    default:\n                        target = ts.visitNode(left, visitor, ts.isExpression);\n                        break;\n                }\n                var operator = node.operatorToken.kind;\n                if (isCompoundAssignment(operator)) {\n                    return ts.createBinary(target, 57, ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression), node), node);\n                }\n                else {\n                    return ts.updateBinary(node, target, ts.visitNode(right, visitor, ts.isExpression));\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitLeftAssociativeBinaryExpression(node) {\n            if (containsYield(node.right)) {\n                if (ts.isLogicalOperator(node.operatorToken.kind)) {\n                    return visitLogicalBinaryExpression(node);\n                }\n                else if (node.operatorToken.kind === 25) {\n                    return visitCommaExpression(node);\n                }\n                var clone_4 = ts.getMutableClone(node);\n                clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression));\n                clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression);\n                return clone_4;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitLogicalBinaryExpression(node) {\n            var resultLabel = defineLabel();\n            var resultLocal = declareLocal();\n            emitAssignment(resultLocal, ts.visitNode(node.left, visitor, ts.isExpression), node.left);\n            if (node.operatorToken.kind === 52) {\n                emitBreakWhenFalse(resultLabel, resultLocal, node.left);\n            }\n            else {\n                emitBreakWhenTrue(resultLabel, resultLocal, node.left);\n            }\n            emitAssignment(resultLocal, ts.visitNode(node.right, visitor, ts.isExpression), node.right);\n            markLabel(resultLabel);\n            return resultLocal;\n        }\n        function visitCommaExpression(node) {\n            var pendingExpressions = [];\n            visit(node.left);\n            visit(node.right);\n            return ts.inlineExpressions(pendingExpressions);\n            function visit(node) {\n                if (ts.isBinaryExpression(node) && node.operatorToken.kind === 25) {\n                    visit(node.left);\n                    visit(node.right);\n                }\n                else {\n                    if (containsYield(node) && pendingExpressions.length > 0) {\n                        emitWorker(1, [ts.createStatement(ts.inlineExpressions(pendingExpressions))]);\n                        pendingExpressions = [];\n                    }\n                    pendingExpressions.push(ts.visitNode(node, visitor, ts.isExpression));\n                }\n            }\n        }\n        function visitConditionalExpression(node) {\n            if (containsYield(node.whenTrue) || containsYield(node.whenFalse)) {\n                var whenFalseLabel = defineLabel();\n                var resultLabel = defineLabel();\n                var resultLocal = declareLocal();\n                emitBreakWhenFalse(whenFalseLabel, ts.visitNode(node.condition, visitor, ts.isExpression), node.condition);\n                emitAssignment(resultLocal, ts.visitNode(node.whenTrue, visitor, ts.isExpression), node.whenTrue);\n                emitBreak(resultLabel);\n                markLabel(whenFalseLabel);\n                emitAssignment(resultLocal, ts.visitNode(node.whenFalse, visitor, ts.isExpression), node.whenFalse);\n                markLabel(resultLabel);\n                return resultLocal;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitYieldExpression(node) {\n            var resumeLabel = defineLabel();\n            var expression = ts.visitNode(node.expression, visitor, ts.isExpression);\n            if (node.asteriskToken) {\n                emitYieldStar(expression, node);\n            }\n            else {\n                emitYield(expression, node);\n            }\n            markLabel(resumeLabel);\n            return createGeneratorResume();\n        }\n        function visitArrayLiteralExpression(node) {\n            return visitElements(node.elements, undefined, undefined, node.multiLine);\n        }\n        function visitElements(elements, leadingElement, location, multiLine) {\n            var numInitialElements = countInitialNodesWithoutYield(elements);\n            var temp = declareLocal();\n            var hasAssignedTemp = false;\n            if (numInitialElements > 0) {\n                var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements);\n                emitAssignment(temp, ts.createArrayLiteral(leadingElement\n                    ? [leadingElement].concat(initialElements) : initialElements));\n                leadingElement = undefined;\n                hasAssignedTemp = true;\n            }\n            var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements);\n            return hasAssignedTemp\n                ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)])\n                : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine);\n            function reduceElement(expressions, element) {\n                if (containsYield(element) && expressions.length > 0) {\n                    emitAssignment(temp, hasAssignedTemp\n                        ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)])\n                        : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, undefined, multiLine));\n                    hasAssignedTemp = true;\n                    leadingElement = undefined;\n                    expressions = [];\n                }\n                expressions.push(ts.visitNode(element, visitor, ts.isExpression));\n                return expressions;\n            }\n        }\n        function visitObjectLiteralExpression(node) {\n            var properties = node.properties;\n            var multiLine = node.multiLine;\n            var numInitialProperties = countInitialNodesWithoutYield(properties);\n            var temp = declareLocal();\n            emitAssignment(temp, ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, multiLine));\n            var expressions = ts.reduceLeft(properties, reduceProperty, [], numInitialProperties);\n            expressions.push(multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp);\n            return ts.inlineExpressions(expressions);\n            function reduceProperty(expressions, property) {\n                if (containsYield(property) && expressions.length > 0) {\n                    emitStatement(ts.createStatement(ts.inlineExpressions(expressions)));\n                    expressions = [];\n                }\n                var expression = ts.createExpressionForObjectLiteralElementLike(node, property, temp);\n                var visited = ts.visitNode(expression, visitor, ts.isExpression);\n                if (visited) {\n                    if (multiLine) {\n                        visited.startsOnNewLine = true;\n                    }\n                    expressions.push(visited);\n                }\n                return expressions;\n            }\n        }\n        function visitElementAccessExpression(node) {\n            if (containsYield(node.argumentExpression)) {\n                var clone_5 = ts.getMutableClone(node);\n                clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression));\n                clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression);\n                return clone_5;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitCallExpression(node) {\n            if (ts.forEach(node.arguments, containsYield)) {\n                var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion, true), target = _a.target, thisArg = _a.thisArg;\n                return ts.setOriginalNode(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isLeftHandSideExpression)), thisArg, visitElements(node.arguments), node), node);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitNewExpression(node) {\n            if (ts.forEach(node.arguments, containsYield)) {\n                var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, \"bind\"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;\n                return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, ts.createVoidZero())), undefined, [], node), node);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function transformAndEmitStatements(statements, start) {\n            if (start === void 0) { start = 0; }\n            var numStatements = statements.length;\n            for (var i = start; i < numStatements; i++) {\n                transformAndEmitStatement(statements[i]);\n            }\n        }\n        function transformAndEmitEmbeddedStatement(node) {\n            if (ts.isBlock(node)) {\n                transformAndEmitStatements(node.statements);\n            }\n            else {\n                transformAndEmitStatement(node);\n            }\n        }\n        function transformAndEmitStatement(node) {\n            var savedInStatementContainingYield = inStatementContainingYield;\n            if (!inStatementContainingYield) {\n                inStatementContainingYield = containsYield(node);\n            }\n            transformAndEmitStatementWorker(node);\n            inStatementContainingYield = savedInStatementContainingYield;\n        }\n        function transformAndEmitStatementWorker(node) {\n            switch (node.kind) {\n                case 204:\n                    return transformAndEmitBlock(node);\n                case 207:\n                    return transformAndEmitExpressionStatement(node);\n                case 208:\n                    return transformAndEmitIfStatement(node);\n                case 209:\n                    return transformAndEmitDoStatement(node);\n                case 210:\n                    return transformAndEmitWhileStatement(node);\n                case 211:\n                    return transformAndEmitForStatement(node);\n                case 212:\n                    return transformAndEmitForInStatement(node);\n                case 214:\n                    return transformAndEmitContinueStatement(node);\n                case 215:\n                    return transformAndEmitBreakStatement(node);\n                case 216:\n                    return transformAndEmitReturnStatement(node);\n                case 217:\n                    return transformAndEmitWithStatement(node);\n                case 218:\n                    return transformAndEmitSwitchStatement(node);\n                case 219:\n                    return transformAndEmitLabeledStatement(node);\n                case 220:\n                    return transformAndEmitThrowStatement(node);\n                case 221:\n                    return transformAndEmitTryStatement(node);\n                default:\n                    return emitStatement(ts.visitNode(node, visitor, ts.isStatement, true));\n            }\n        }\n        function transformAndEmitBlock(node) {\n            if (containsYield(node)) {\n                transformAndEmitStatements(node.statements);\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function transformAndEmitExpressionStatement(node) {\n            emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n        }\n        function transformAndEmitVariableDeclarationList(node) {\n            for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) {\n                var variable = _a[_i];\n                hoistVariableDeclaration(variable.name);\n            }\n            var variables = ts.getInitializedVariables(node);\n            var numVariables = variables.length;\n            var variablesWritten = 0;\n            var pendingExpressions = [];\n            while (variablesWritten < numVariables) {\n                for (var i = variablesWritten; i < numVariables; i++) {\n                    var variable = variables[i];\n                    if (containsYield(variable.initializer) && pendingExpressions.length > 0) {\n                        break;\n                    }\n                    pendingExpressions.push(transformInitializedVariable(variable));\n                }\n                if (pendingExpressions.length) {\n                    emitStatement(ts.createStatement(ts.inlineExpressions(pendingExpressions)));\n                    variablesWritten += pendingExpressions.length;\n                    pendingExpressions = [];\n                }\n            }\n            return undefined;\n        }\n        function transformInitializedVariable(node) {\n            return ts.createAssignment(ts.getSynthesizedClone(node.name), ts.visitNode(node.initializer, visitor, ts.isExpression));\n        }\n        function transformAndEmitIfStatement(node) {\n            if (containsYield(node)) {\n                if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) {\n                    var endLabel = defineLabel();\n                    var elseLabel = node.elseStatement ? defineLabel() : undefined;\n                    emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression));\n                    transformAndEmitEmbeddedStatement(node.thenStatement);\n                    if (node.elseStatement) {\n                        emitBreak(endLabel);\n                        markLabel(elseLabel);\n                        transformAndEmitEmbeddedStatement(node.elseStatement);\n                    }\n                    markLabel(endLabel);\n                }\n                else {\n                    emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n                }\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function transformAndEmitDoStatement(node) {\n            if (containsYield(node)) {\n                var conditionLabel = defineLabel();\n                var loopLabel = defineLabel();\n                beginLoopBlock(conditionLabel);\n                markLabel(loopLabel);\n                transformAndEmitEmbeddedStatement(node.statement);\n                markLabel(conditionLabel);\n                emitBreakWhenTrue(loopLabel, ts.visitNode(node.expression, visitor, ts.isExpression));\n                endLoopBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitDoStatement(node) {\n            if (inStatementContainingYield) {\n                beginScriptLoopBlock();\n                node = ts.visitEachChild(node, visitor, context);\n                endLoopBlock();\n                return node;\n            }\n            else {\n                return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function transformAndEmitWhileStatement(node) {\n            if (containsYield(node)) {\n                var loopLabel = defineLabel();\n                var endLabel = beginLoopBlock(loopLabel);\n                markLabel(loopLabel);\n                emitBreakWhenFalse(endLabel, ts.visitNode(node.expression, visitor, ts.isExpression));\n                transformAndEmitEmbeddedStatement(node.statement);\n                emitBreak(loopLabel);\n                endLoopBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitWhileStatement(node) {\n            if (inStatementContainingYield) {\n                beginScriptLoopBlock();\n                node = ts.visitEachChild(node, visitor, context);\n                endLoopBlock();\n                return node;\n            }\n            else {\n                return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function transformAndEmitForStatement(node) {\n            if (containsYield(node)) {\n                var conditionLabel = defineLabel();\n                var incrementLabel = defineLabel();\n                var endLabel = beginLoopBlock(incrementLabel);\n                if (node.initializer) {\n                    var initializer = node.initializer;\n                    if (ts.isVariableDeclarationList(initializer)) {\n                        transformAndEmitVariableDeclarationList(initializer);\n                    }\n                    else {\n                        emitStatement(ts.createStatement(ts.visitNode(initializer, visitor, ts.isExpression), initializer));\n                    }\n                }\n                markLabel(conditionLabel);\n                if (node.condition) {\n                    emitBreakWhenFalse(endLabel, ts.visitNode(node.condition, visitor, ts.isExpression));\n                }\n                transformAndEmitEmbeddedStatement(node.statement);\n                markLabel(incrementLabel);\n                if (node.incrementor) {\n                    emitStatement(ts.createStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression), node.incrementor));\n                }\n                emitBreak(conditionLabel);\n                endLoopBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitForStatement(node) {\n            if (inStatementContainingYield) {\n                beginScriptLoopBlock();\n            }\n            var initializer = node.initializer;\n            if (ts.isVariableDeclarationList(initializer)) {\n                for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) {\n                    var variable = _a[_i];\n                    hoistVariableDeclaration(variable.name);\n                }\n                var variables = ts.getInitializedVariables(initializer);\n                node = ts.updateFor(node, variables.length > 0\n                    ? ts.inlineExpressions(ts.map(variables, transformInitializedVariable))\n                    : undefined, ts.visitNode(node.condition, visitor, ts.isExpression, true), ts.visitNode(node.incrementor, visitor, ts.isExpression, true), ts.visitNode(node.statement, visitor, ts.isStatement, false, ts.liftToBlock));\n            }\n            else {\n                node = ts.visitEachChild(node, visitor, context);\n            }\n            if (inStatementContainingYield) {\n                endLoopBlock();\n            }\n            return node;\n        }\n        function transformAndEmitForInStatement(node) {\n            if (containsYield(node)) {\n                var keysArray = declareLocal();\n                var key = declareLocal();\n                var keysIndex = ts.createLoopVariable();\n                var initializer = node.initializer;\n                hoistVariableDeclaration(keysIndex);\n                emitAssignment(keysArray, ts.createArrayLiteral());\n                emitStatement(ts.createForIn(key, ts.visitNode(node.expression, visitor, ts.isExpression), ts.createStatement(ts.createCall(ts.createPropertyAccess(keysArray, \"push\"), undefined, [key]))));\n                emitAssignment(keysIndex, ts.createLiteral(0));\n                var conditionLabel = defineLabel();\n                var incrementLabel = defineLabel();\n                var endLabel = beginLoopBlock(incrementLabel);\n                markLabel(conditionLabel);\n                emitBreakWhenFalse(endLabel, ts.createLessThan(keysIndex, ts.createPropertyAccess(keysArray, \"length\")));\n                var variable = void 0;\n                if (ts.isVariableDeclarationList(initializer)) {\n                    for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) {\n                        var variable_1 = _a[_i];\n                        hoistVariableDeclaration(variable_1.name);\n                    }\n                    variable = ts.getSynthesizedClone(initializer.declarations[0].name);\n                }\n                else {\n                    variable = ts.visitNode(initializer, visitor, ts.isExpression);\n                    ts.Debug.assert(ts.isLeftHandSideExpression(variable));\n                }\n                emitAssignment(variable, ts.createElementAccess(keysArray, keysIndex));\n                transformAndEmitEmbeddedStatement(node.statement);\n                markLabel(incrementLabel);\n                emitStatement(ts.createStatement(ts.createPostfixIncrement(keysIndex)));\n                emitBreak(conditionLabel);\n                endLoopBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitForInStatement(node) {\n            if (inStatementContainingYield) {\n                beginScriptLoopBlock();\n            }\n            var initializer = node.initializer;\n            if (ts.isVariableDeclarationList(initializer)) {\n                for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) {\n                    var variable = _a[_i];\n                    hoistVariableDeclaration(variable.name);\n                }\n                node = ts.updateForIn(node, initializer.declarations[0].name, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, false, ts.liftToBlock));\n            }\n            else {\n                node = ts.visitEachChild(node, visitor, context);\n            }\n            if (inStatementContainingYield) {\n                endLoopBlock();\n            }\n            return node;\n        }\n        function transformAndEmitContinueStatement(node) {\n            var label = findContinueTarget(node.label ? node.label.text : undefined);\n            ts.Debug.assert(label > 0, \"Expected continue statment to point to a valid Label.\");\n            emitBreak(label, node);\n        }\n        function visitContinueStatement(node) {\n            if (inStatementContainingYield) {\n                var label = findContinueTarget(node.label && node.label.text);\n                if (label > 0) {\n                    return createInlineBreak(label, node);\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function transformAndEmitBreakStatement(node) {\n            var label = findBreakTarget(node.label ? node.label.text : undefined);\n            ts.Debug.assert(label > 0, \"Expected break statment to point to a valid Label.\");\n            emitBreak(label, node);\n        }\n        function visitBreakStatement(node) {\n            if (inStatementContainingYield) {\n                var label = findBreakTarget(node.label && node.label.text);\n                if (label > 0) {\n                    return createInlineBreak(label, node);\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function transformAndEmitReturnStatement(node) {\n            emitReturn(ts.visitNode(node.expression, visitor, ts.isExpression, true), node);\n        }\n        function visitReturnStatement(node) {\n            return createInlineReturn(ts.visitNode(node.expression, visitor, ts.isExpression, true), node);\n        }\n        function transformAndEmitWithStatement(node) {\n            if (containsYield(node)) {\n                beginWithBlock(cacheExpression(ts.visitNode(node.expression, visitor, ts.isExpression)));\n                transformAndEmitEmbeddedStatement(node.statement);\n                endWithBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function transformAndEmitSwitchStatement(node) {\n            if (containsYield(node.caseBlock)) {\n                var caseBlock = node.caseBlock;\n                var numClauses = caseBlock.clauses.length;\n                var endLabel = beginSwitchBlock();\n                var expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isExpression));\n                var clauseLabels = [];\n                var defaultClauseIndex = -1;\n                for (var i = 0; i < numClauses; i++) {\n                    var clause = caseBlock.clauses[i];\n                    clauseLabels.push(defineLabel());\n                    if (clause.kind === 254 && defaultClauseIndex === -1) {\n                        defaultClauseIndex = i;\n                    }\n                }\n                var clausesWritten = 0;\n                var pendingClauses = [];\n                while (clausesWritten < numClauses) {\n                    var defaultClausesSkipped = 0;\n                    for (var i = clausesWritten; i < numClauses; i++) {\n                        var clause = caseBlock.clauses[i];\n                        if (clause.kind === 253) {\n                            var caseClause = clause;\n                            if (containsYield(caseClause.expression) && pendingClauses.length > 0) {\n                                break;\n                            }\n                            pendingClauses.push(ts.createCaseClause(ts.visitNode(caseClause.expression, visitor, ts.isExpression), [\n                                createInlineBreak(clauseLabels[i], caseClause.expression)\n                            ]));\n                        }\n                        else {\n                            defaultClausesSkipped++;\n                        }\n                    }\n                    if (pendingClauses.length) {\n                        emitStatement(ts.createSwitch(expression, ts.createCaseBlock(pendingClauses)));\n                        clausesWritten += pendingClauses.length;\n                        pendingClauses = [];\n                    }\n                    if (defaultClausesSkipped > 0) {\n                        clausesWritten += defaultClausesSkipped;\n                        defaultClausesSkipped = 0;\n                    }\n                }\n                if (defaultClauseIndex >= 0) {\n                    emitBreak(clauseLabels[defaultClauseIndex]);\n                }\n                else {\n                    emitBreak(endLabel);\n                }\n                for (var i = 0; i < numClauses; i++) {\n                    markLabel(clauseLabels[i]);\n                    transformAndEmitStatements(caseBlock.clauses[i].statements);\n                }\n                endSwitchBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitSwitchStatement(node) {\n            if (inStatementContainingYield) {\n                beginScriptSwitchBlock();\n            }\n            node = ts.visitEachChild(node, visitor, context);\n            if (inStatementContainingYield) {\n                endSwitchBlock();\n            }\n            return node;\n        }\n        function transformAndEmitLabeledStatement(node) {\n            if (containsYield(node)) {\n                beginLabeledBlock(node.label.text);\n                transformAndEmitEmbeddedStatement(node.statement);\n                endLabeledBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitLabeledStatement(node) {\n            if (inStatementContainingYield) {\n                beginScriptLabeledBlock(node.label.text);\n            }\n            node = ts.visitEachChild(node, visitor, context);\n            if (inStatementContainingYield) {\n                endLabeledBlock();\n            }\n            return node;\n        }\n        function transformAndEmitThrowStatement(node) {\n            emitThrow(ts.visitNode(node.expression, visitor, ts.isExpression), node);\n        }\n        function transformAndEmitTryStatement(node) {\n            if (containsYield(node)) {\n                beginExceptionBlock();\n                transformAndEmitEmbeddedStatement(node.tryBlock);\n                if (node.catchClause) {\n                    beginCatchBlock(node.catchClause.variableDeclaration);\n                    transformAndEmitEmbeddedStatement(node.catchClause.block);\n                }\n                if (node.finallyBlock) {\n                    beginFinallyBlock();\n                    transformAndEmitEmbeddedStatement(node.finallyBlock);\n                }\n                endExceptionBlock();\n            }\n            else {\n                emitStatement(ts.visitEachChild(node, visitor, context));\n            }\n        }\n        function containsYield(node) {\n            return node && (node.transformFlags & 16777216) !== 0;\n        }\n        function countInitialNodesWithoutYield(nodes) {\n            var numNodes = nodes.length;\n            for (var i = 0; i < numNodes; i++) {\n                if (containsYield(nodes[i])) {\n                    return i;\n                }\n            }\n            return -1;\n        }\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (emitContext === 1) {\n                return substituteExpression(node);\n            }\n            return node;\n        }\n        function substituteExpression(node) {\n            if (ts.isIdentifier(node)) {\n                return substituteExpressionIdentifier(node);\n            }\n            return node;\n        }\n        function substituteExpressionIdentifier(node) {\n            if (renamedCatchVariables && ts.hasProperty(renamedCatchVariables, node.text)) {\n                var original = ts.getOriginalNode(node);\n                if (ts.isIdentifier(original) && original.parent) {\n                    var declaration = resolver.getReferencedValueDeclaration(original);\n                    if (declaration) {\n                        var name_39 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));\n                        if (name_39) {\n                            var clone_6 = ts.getMutableClone(name_39);\n                            ts.setSourceMapRange(clone_6, node);\n                            ts.setCommentRange(clone_6, node);\n                            return clone_6;\n                        }\n                    }\n                }\n            }\n            return node;\n        }\n        function cacheExpression(node) {\n            var temp;\n            if (ts.isGeneratedIdentifier(node)) {\n                return node;\n            }\n            temp = ts.createTempVariable(hoistVariableDeclaration);\n            emitAssignment(temp, node, node);\n            return temp;\n        }\n        function declareLocal(name) {\n            var temp = name\n                ? ts.createUniqueName(name)\n                : ts.createTempVariable(undefined);\n            hoistVariableDeclaration(temp);\n            return temp;\n        }\n        function defineLabel() {\n            if (!labelOffsets) {\n                labelOffsets = [];\n            }\n            var label = nextLabelId;\n            nextLabelId++;\n            labelOffsets[label] = -1;\n            return label;\n        }\n        function markLabel(label) {\n            ts.Debug.assert(labelOffsets !== undefined, \"No labels were defined.\");\n            labelOffsets[label] = operations ? operations.length : 0;\n        }\n        function beginBlock(block) {\n            if (!blocks) {\n                blocks = [];\n                blockActions = [];\n                blockOffsets = [];\n                blockStack = [];\n            }\n            var index = blockActions.length;\n            blockActions[index] = 0;\n            blockOffsets[index] = operations ? operations.length : 0;\n            blocks[index] = block;\n            blockStack.push(block);\n            return index;\n        }\n        function endBlock() {\n            var block = peekBlock();\n            ts.Debug.assert(block !== undefined, \"beginBlock was never called.\");\n            var index = blockActions.length;\n            blockActions[index] = 1;\n            blockOffsets[index] = operations ? operations.length : 0;\n            blocks[index] = block;\n            blockStack.pop();\n            return block;\n        }\n        function peekBlock() {\n            return ts.lastOrUndefined(blockStack);\n        }\n        function peekBlockKind() {\n            var block = peekBlock();\n            return block && block.kind;\n        }\n        function beginWithBlock(expression) {\n            var startLabel = defineLabel();\n            var endLabel = defineLabel();\n            markLabel(startLabel);\n            beginBlock({\n                kind: 1,\n                expression: expression,\n                startLabel: startLabel,\n                endLabel: endLabel\n            });\n        }\n        function endWithBlock() {\n            ts.Debug.assert(peekBlockKind() === 1);\n            var block = endBlock();\n            markLabel(block.endLabel);\n        }\n        function isWithBlock(block) {\n            return block.kind === 1;\n        }\n        function beginExceptionBlock() {\n            var startLabel = defineLabel();\n            var endLabel = defineLabel();\n            markLabel(startLabel);\n            beginBlock({\n                kind: 0,\n                state: 0,\n                startLabel: startLabel,\n                endLabel: endLabel\n            });\n            emitNop();\n            return endLabel;\n        }\n        function beginCatchBlock(variable) {\n            ts.Debug.assert(peekBlockKind() === 0);\n            var text = variable.name.text;\n            var name = declareLocal(text);\n            if (!renamedCatchVariables) {\n                renamedCatchVariables = ts.createMap();\n                renamedCatchVariableDeclarations = ts.createMap();\n                context.enableSubstitution(70);\n            }\n            renamedCatchVariables[text] = true;\n            renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name;\n            var exception = peekBlock();\n            ts.Debug.assert(exception.state < 1);\n            var endLabel = exception.endLabel;\n            emitBreak(endLabel);\n            var catchLabel = defineLabel();\n            markLabel(catchLabel);\n            exception.state = 1;\n            exception.catchVariable = name;\n            exception.catchLabel = catchLabel;\n            emitAssignment(name, ts.createCall(ts.createPropertyAccess(state, \"sent\"), undefined, []));\n            emitNop();\n        }\n        function beginFinallyBlock() {\n            ts.Debug.assert(peekBlockKind() === 0);\n            var exception = peekBlock();\n            ts.Debug.assert(exception.state < 2);\n            var endLabel = exception.endLabel;\n            emitBreak(endLabel);\n            var finallyLabel = defineLabel();\n            markLabel(finallyLabel);\n            exception.state = 2;\n            exception.finallyLabel = finallyLabel;\n        }\n        function endExceptionBlock() {\n            ts.Debug.assert(peekBlockKind() === 0);\n            var exception = endBlock();\n            var state = exception.state;\n            if (state < 2) {\n                emitBreak(exception.endLabel);\n            }\n            else {\n                emitEndfinally();\n            }\n            markLabel(exception.endLabel);\n            emitNop();\n            exception.state = 3;\n        }\n        function isExceptionBlock(block) {\n            return block.kind === 0;\n        }\n        function beginScriptLoopBlock() {\n            beginBlock({\n                kind: 3,\n                isScript: true,\n                breakLabel: -1,\n                continueLabel: -1\n            });\n        }\n        function beginLoopBlock(continueLabel) {\n            var breakLabel = defineLabel();\n            beginBlock({\n                kind: 3,\n                isScript: false,\n                breakLabel: breakLabel,\n                continueLabel: continueLabel\n            });\n            return breakLabel;\n        }\n        function endLoopBlock() {\n            ts.Debug.assert(peekBlockKind() === 3);\n            var block = endBlock();\n            var breakLabel = block.breakLabel;\n            if (!block.isScript) {\n                markLabel(breakLabel);\n            }\n        }\n        function beginScriptSwitchBlock() {\n            beginBlock({\n                kind: 2,\n                isScript: true,\n                breakLabel: -1\n            });\n        }\n        function beginSwitchBlock() {\n            var breakLabel = defineLabel();\n            beginBlock({\n                kind: 2,\n                isScript: false,\n                breakLabel: breakLabel\n            });\n            return breakLabel;\n        }\n        function endSwitchBlock() {\n            ts.Debug.assert(peekBlockKind() === 2);\n            var block = endBlock();\n            var breakLabel = block.breakLabel;\n            if (!block.isScript) {\n                markLabel(breakLabel);\n            }\n        }\n        function beginScriptLabeledBlock(labelText) {\n            beginBlock({\n                kind: 4,\n                isScript: true,\n                labelText: labelText,\n                breakLabel: -1\n            });\n        }\n        function beginLabeledBlock(labelText) {\n            var breakLabel = defineLabel();\n            beginBlock({\n                kind: 4,\n                isScript: false,\n                labelText: labelText,\n                breakLabel: breakLabel\n            });\n        }\n        function endLabeledBlock() {\n            ts.Debug.assert(peekBlockKind() === 4);\n            var block = endBlock();\n            if (!block.isScript) {\n                markLabel(block.breakLabel);\n            }\n        }\n        function supportsUnlabeledBreak(block) {\n            return block.kind === 2\n                || block.kind === 3;\n        }\n        function supportsLabeledBreakOrContinue(block) {\n            return block.kind === 4;\n        }\n        function supportsUnlabeledContinue(block) {\n            return block.kind === 3;\n        }\n        function hasImmediateContainingLabeledBlock(labelText, start) {\n            for (var j = start; j >= 0; j--) {\n                var containingBlock = blockStack[j];\n                if (supportsLabeledBreakOrContinue(containingBlock)) {\n                    if (containingBlock.labelText === labelText) {\n                        return true;\n                    }\n                }\n                else {\n                    break;\n                }\n            }\n            return false;\n        }\n        function findBreakTarget(labelText) {\n            ts.Debug.assert(blocks !== undefined);\n            if (labelText) {\n                for (var i = blockStack.length - 1; i >= 0; i--) {\n                    var block = blockStack[i];\n                    if (supportsLabeledBreakOrContinue(block) && block.labelText === labelText) {\n                        return block.breakLabel;\n                    }\n                    else if (supportsUnlabeledBreak(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) {\n                        return block.breakLabel;\n                    }\n                }\n            }\n            else {\n                for (var i = blockStack.length - 1; i >= 0; i--) {\n                    var block = blockStack[i];\n                    if (supportsUnlabeledBreak(block)) {\n                        return block.breakLabel;\n                    }\n                }\n            }\n            return 0;\n        }\n        function findContinueTarget(labelText) {\n            ts.Debug.assert(blocks !== undefined);\n            if (labelText) {\n                for (var i = blockStack.length - 1; i >= 0; i--) {\n                    var block = blockStack[i];\n                    if (supportsUnlabeledContinue(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) {\n                        return block.continueLabel;\n                    }\n                }\n            }\n            else {\n                for (var i = blockStack.length - 1; i >= 0; i--) {\n                    var block = blockStack[i];\n                    if (supportsUnlabeledContinue(block)) {\n                        return block.continueLabel;\n                    }\n                }\n            }\n            return 0;\n        }\n        function createLabel(label) {\n            if (label > 0) {\n                if (labelExpressions === undefined) {\n                    labelExpressions = [];\n                }\n                var expression = ts.createLiteral(-1);\n                if (labelExpressions[label] === undefined) {\n                    labelExpressions[label] = [expression];\n                }\n                else {\n                    labelExpressions[label].push(expression);\n                }\n                return expression;\n            }\n            return ts.createOmittedExpression();\n        }\n        function createInstruction(instruction) {\n            var literal = ts.createLiteral(instruction);\n            literal.trailingComment = instructionNames[instruction];\n            return literal;\n        }\n        function createInlineBreak(label, location) {\n            ts.Debug.assert(label > 0, \"Invalid label: \" + label);\n            return ts.createReturn(ts.createArrayLiteral([\n                createInstruction(3),\n                createLabel(label)\n            ]), location);\n        }\n        function createInlineReturn(expression, location) {\n            return ts.createReturn(ts.createArrayLiteral(expression\n                ? [createInstruction(2), expression]\n                : [createInstruction(2)]), location);\n        }\n        function createGeneratorResume(location) {\n            return ts.createCall(ts.createPropertyAccess(state, \"sent\"), undefined, [], location);\n        }\n        function emitNop() {\n            emitWorker(0);\n        }\n        function emitStatement(node) {\n            if (node) {\n                emitWorker(1, [node]);\n            }\n            else {\n                emitNop();\n            }\n        }\n        function emitAssignment(left, right, location) {\n            emitWorker(2, [left, right], location);\n        }\n        function emitBreak(label, location) {\n            emitWorker(3, [label], location);\n        }\n        function emitBreakWhenTrue(label, condition, location) {\n            emitWorker(4, [label, condition], location);\n        }\n        function emitBreakWhenFalse(label, condition, location) {\n            emitWorker(5, [label, condition], location);\n        }\n        function emitYieldStar(expression, location) {\n            emitWorker(7, [expression], location);\n        }\n        function emitYield(expression, location) {\n            emitWorker(6, [expression], location);\n        }\n        function emitReturn(expression, location) {\n            emitWorker(8, [expression], location);\n        }\n        function emitThrow(expression, location) {\n            emitWorker(9, [expression], location);\n        }\n        function emitEndfinally() {\n            emitWorker(10);\n        }\n        function emitWorker(code, args, location) {\n            if (operations === undefined) {\n                operations = [];\n                operationArguments = [];\n                operationLocations = [];\n            }\n            if (labelOffsets === undefined) {\n                markLabel(defineLabel());\n            }\n            var operationIndex = operations.length;\n            operations[operationIndex] = code;\n            operationArguments[operationIndex] = args;\n            operationLocations[operationIndex] = location;\n        }\n        function build() {\n            blockIndex = 0;\n            labelNumber = 0;\n            labelNumbers = undefined;\n            lastOperationWasAbrupt = false;\n            lastOperationWasCompletion = false;\n            clauses = undefined;\n            statements = undefined;\n            exceptionBlockStack = undefined;\n            currentExceptionBlock = undefined;\n            withBlockStack = undefined;\n            var buildResult = buildStatements();\n            return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 262144));\n        }\n        function buildStatements() {\n            if (operations) {\n                for (var operationIndex = 0; operationIndex < operations.length; operationIndex++) {\n                    writeOperation(operationIndex);\n                }\n                flushFinalLabel(operations.length);\n            }\n            else {\n                flushFinalLabel(0);\n            }\n            if (clauses) {\n                var labelExpression = ts.createPropertyAccess(state, \"label\");\n                var switchStatement = ts.createSwitch(labelExpression, ts.createCaseBlock(clauses));\n                switchStatement.startsOnNewLine = true;\n                return [switchStatement];\n            }\n            if (statements) {\n                return statements;\n            }\n            return [];\n        }\n        function flushLabel() {\n            if (!statements) {\n                return;\n            }\n            appendLabel(!lastOperationWasAbrupt);\n            lastOperationWasAbrupt = false;\n            lastOperationWasCompletion = false;\n            labelNumber++;\n        }\n        function flushFinalLabel(operationIndex) {\n            if (isFinalLabelReachable(operationIndex)) {\n                tryEnterLabel(operationIndex);\n                withBlockStack = undefined;\n                writeReturn(undefined, undefined);\n            }\n            if (statements && clauses) {\n                appendLabel(false);\n            }\n            updateLabelExpressions();\n        }\n        function isFinalLabelReachable(operationIndex) {\n            if (!lastOperationWasCompletion) {\n                return true;\n            }\n            if (!labelOffsets || !labelExpressions) {\n                return false;\n            }\n            for (var label = 0; label < labelOffsets.length; label++) {\n                if (labelOffsets[label] === operationIndex && labelExpressions[label]) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function appendLabel(markLabelEnd) {\n            if (!clauses) {\n                clauses = [];\n            }\n            if (statements) {\n                if (withBlockStack) {\n                    for (var i = withBlockStack.length - 1; i >= 0; i--) {\n                        var withBlock = withBlockStack[i];\n                        statements = [ts.createWith(withBlock.expression, ts.createBlock(statements))];\n                    }\n                }\n                if (currentExceptionBlock) {\n                    var startLabel = currentExceptionBlock.startLabel, catchLabel = currentExceptionBlock.catchLabel, finallyLabel = currentExceptionBlock.finallyLabel, endLabel = currentExceptionBlock.endLabel;\n                    statements.unshift(ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createPropertyAccess(state, \"trys\"), \"push\"), undefined, [\n                        ts.createArrayLiteral([\n                            createLabel(startLabel),\n                            createLabel(catchLabel),\n                            createLabel(finallyLabel),\n                            createLabel(endLabel)\n                        ])\n                    ])));\n                    currentExceptionBlock = undefined;\n                }\n                if (markLabelEnd) {\n                    statements.push(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(state, \"label\"), ts.createLiteral(labelNumber + 1))));\n                }\n            }\n            clauses.push(ts.createCaseClause(ts.createLiteral(labelNumber), statements || []));\n            statements = undefined;\n        }\n        function tryEnterLabel(operationIndex) {\n            if (!labelOffsets) {\n                return;\n            }\n            for (var label = 0; label < labelOffsets.length; label++) {\n                if (labelOffsets[label] === operationIndex) {\n                    flushLabel();\n                    if (labelNumbers === undefined) {\n                        labelNumbers = [];\n                    }\n                    if (labelNumbers[labelNumber] === undefined) {\n                        labelNumbers[labelNumber] = [label];\n                    }\n                    else {\n                        labelNumbers[labelNumber].push(label);\n                    }\n                }\n            }\n        }\n        function updateLabelExpressions() {\n            if (labelExpressions !== undefined && labelNumbers !== undefined) {\n                for (var labelNumber_1 = 0; labelNumber_1 < labelNumbers.length; labelNumber_1++) {\n                    var labels = labelNumbers[labelNumber_1];\n                    if (labels !== undefined) {\n                        for (var _i = 0, labels_1 = labels; _i < labels_1.length; _i++) {\n                            var label = labels_1[_i];\n                            var expressions = labelExpressions[label];\n                            if (expressions !== undefined) {\n                                for (var _a = 0, expressions_1 = expressions; _a < expressions_1.length; _a++) {\n                                    var expression = expressions_1[_a];\n                                    expression.text = String(labelNumber_1);\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        function tryEnterOrLeaveBlock(operationIndex) {\n            if (blocks) {\n                for (; blockIndex < blockActions.length && blockOffsets[blockIndex] <= operationIndex; blockIndex++) {\n                    var block = blocks[blockIndex];\n                    var blockAction = blockActions[blockIndex];\n                    if (isExceptionBlock(block)) {\n                        if (blockAction === 0) {\n                            if (!exceptionBlockStack) {\n                                exceptionBlockStack = [];\n                            }\n                            if (!statements) {\n                                statements = [];\n                            }\n                            exceptionBlockStack.push(currentExceptionBlock);\n                            currentExceptionBlock = block;\n                        }\n                        else if (blockAction === 1) {\n                            currentExceptionBlock = exceptionBlockStack.pop();\n                        }\n                    }\n                    else if (isWithBlock(block)) {\n                        if (blockAction === 0) {\n                            if (!withBlockStack) {\n                                withBlockStack = [];\n                            }\n                            withBlockStack.push(block);\n                        }\n                        else if (blockAction === 1) {\n                            withBlockStack.pop();\n                        }\n                    }\n                }\n            }\n        }\n        function writeOperation(operationIndex) {\n            tryEnterLabel(operationIndex);\n            tryEnterOrLeaveBlock(operationIndex);\n            if (lastOperationWasAbrupt) {\n                return;\n            }\n            lastOperationWasAbrupt = false;\n            lastOperationWasCompletion = false;\n            var opcode = operations[operationIndex];\n            if (opcode === 0) {\n                return;\n            }\n            else if (opcode === 10) {\n                return writeEndfinally();\n            }\n            var args = operationArguments[operationIndex];\n            if (opcode === 1) {\n                return writeStatement(args[0]);\n            }\n            var location = operationLocations[operationIndex];\n            switch (opcode) {\n                case 2:\n                    return writeAssign(args[0], args[1], location);\n                case 3:\n                    return writeBreak(args[0], location);\n                case 4:\n                    return writeBreakWhenTrue(args[0], args[1], location);\n                case 5:\n                    return writeBreakWhenFalse(args[0], args[1], location);\n                case 6:\n                    return writeYield(args[0], location);\n                case 7:\n                    return writeYieldStar(args[0], location);\n                case 8:\n                    return writeReturn(args[0], location);\n                case 9:\n                    return writeThrow(args[0], location);\n            }\n        }\n        function writeStatement(statement) {\n            if (statement) {\n                if (!statements) {\n                    statements = [statement];\n                }\n                else {\n                    statements.push(statement);\n                }\n            }\n        }\n        function writeAssign(left, right, operationLocation) {\n            writeStatement(ts.createStatement(ts.createAssignment(left, right), operationLocation));\n        }\n        function writeThrow(expression, operationLocation) {\n            lastOperationWasAbrupt = true;\n            lastOperationWasCompletion = true;\n            writeStatement(ts.createThrow(expression, operationLocation));\n        }\n        function writeReturn(expression, operationLocation) {\n            lastOperationWasAbrupt = true;\n            lastOperationWasCompletion = true;\n            writeStatement(ts.createReturn(ts.createArrayLiteral(expression\n                ? [createInstruction(2), expression]\n                : [createInstruction(2)]), operationLocation));\n        }\n        function writeBreak(label, operationLocation) {\n            lastOperationWasAbrupt = true;\n            writeStatement(ts.createReturn(ts.createArrayLiteral([\n                createInstruction(3),\n                createLabel(label)\n            ]), operationLocation));\n        }\n        function writeBreakWhenTrue(label, condition, operationLocation) {\n            writeStatement(ts.createIf(condition, ts.createReturn(ts.createArrayLiteral([\n                createInstruction(3),\n                createLabel(label)\n            ]), operationLocation)));\n        }\n        function writeBreakWhenFalse(label, condition, operationLocation) {\n            writeStatement(ts.createIf(ts.createLogicalNot(condition), ts.createReturn(ts.createArrayLiteral([\n                createInstruction(3),\n                createLabel(label)\n            ]), operationLocation)));\n        }\n        function writeYield(expression, operationLocation) {\n            lastOperationWasAbrupt = true;\n            writeStatement(ts.createReturn(ts.createArrayLiteral(expression\n                ? [createInstruction(4), expression]\n                : [createInstruction(4)]), operationLocation));\n        }\n        function writeYieldStar(expression, operationLocation) {\n            lastOperationWasAbrupt = true;\n            writeStatement(ts.createReturn(ts.createArrayLiteral([\n                createInstruction(5),\n                expression\n            ]), operationLocation));\n        }\n        function writeEndfinally() {\n            lastOperationWasAbrupt = true;\n            writeStatement(ts.createReturn(ts.createArrayLiteral([\n                createInstruction(7)\n            ])));\n        }\n    }\n    ts.transformGenerators = transformGenerators;\n    function createGeneratorHelper(context, body) {\n        context.requestEmitHelper(generatorHelper);\n        return ts.createCall(ts.getHelperName(\"__generator\"), undefined, [ts.createThis(), body]);\n    }\n    var generatorHelper = {\n        name: \"typescript:generator\",\n        scoped: false,\n        priority: 6,\n        text: \"\\n            var __generator = (this && this.__generator) || function (thisArg, body) {\\n                var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\\n                return { next: verb(0), \\\"throw\\\": verb(1), \\\"return\\\": verb(2) };\\n                function verb(n) { return function (v) { return step([n, v]); }; }\\n                function step(op) {\\n                    if (f) throw new TypeError(\\\"Generator is already executing.\\\");\\n                    while (_) try {\\n                        if (f = 1, y && (t = y[op[0] & 2 ? \\\"return\\\" : op[0] ? \\\"throw\\\" : \\\"next\\\"]) && !(t = t.call(y, op[1])).done) return t;\\n                        if (y = 0, t) op = [0, t.value];\\n                        switch (op[0]) {\\n                            case 0: case 1: t = op; break;\\n                            case 4: _.label++; return { value: op[1], done: false };\\n                            case 5: _.label++; y = op[1]; op = [0]; continue;\\n                            case 7: op = _.ops.pop(); _.trys.pop(); continue;\\n                            default:\\n                                if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\\n                                if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\\n                                if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\\n                                if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\\n                                if (t[2]) _.ops.pop();\\n                                _.trys.pop(); continue;\\n                        }\\n                        op = body.call(thisArg, _);\\n                    } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\\n                    if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\\n                }\\n            };\"\n    };\n    var _a;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformES5(context) {\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        context.onSubstituteNode = onSubstituteNode;\n        context.enableSubstitution(177);\n        context.enableSubstitution(257);\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            return node;\n        }\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (ts.isPropertyAccessExpression(node)) {\n                return substitutePropertyAccessExpression(node);\n            }\n            else if (ts.isPropertyAssignment(node)) {\n                return substitutePropertyAssignment(node);\n            }\n            return node;\n        }\n        function substitutePropertyAccessExpression(node) {\n            var literalName = trySubstituteReservedName(node.name);\n            if (literalName) {\n                return ts.createElementAccess(node.expression, literalName, node);\n            }\n            return node;\n        }\n        function substitutePropertyAssignment(node) {\n            var literalName = ts.isIdentifier(node.name) && trySubstituteReservedName(node.name);\n            if (literalName) {\n                return ts.updatePropertyAssignment(node, literalName, node.initializer);\n            }\n            return node;\n        }\n        function trySubstituteReservedName(name) {\n            var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(name.text) : undefined);\n            if (token >= 71 && token <= 106) {\n                return ts.createLiteral(name, name);\n            }\n            return undefined;\n        }\n    }\n    ts.transformES5 = transformES5;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformModule(context) {\n        var transformModuleDelegates = ts.createMap((_a = {},\n            _a[ts.ModuleKind.None] = transformCommonJSModule,\n            _a[ts.ModuleKind.CommonJS] = transformCommonJSModule,\n            _a[ts.ModuleKind.AMD] = transformAMDModule,\n            _a[ts.ModuleKind.UMD] = transformUMDModule,\n            _a));\n        var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;\n        var compilerOptions = context.getCompilerOptions();\n        var resolver = context.getEmitResolver();\n        var host = context.getEmitHost();\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        var moduleKind = ts.getEmitModuleKind(compilerOptions);\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        var previousOnEmitNode = context.onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        context.onEmitNode = onEmitNode;\n        context.enableSubstitution(70);\n        context.enableSubstitution(192);\n        context.enableSubstitution(190);\n        context.enableSubstitution(191);\n        context.enableSubstitution(258);\n        context.enableEmitNotification(261);\n        var moduleInfoMap = ts.createMap();\n        var deferredExports = ts.createMap();\n        var currentSourceFile;\n        var currentModuleInfo;\n        var noSubstitution;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)\n                || !(ts.isExternalModule(node)\n                    || compilerOptions.isolatedModules)) {\n                return node;\n            }\n            currentSourceFile = node;\n            currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions);\n            var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None];\n            var updated = transformModule(node);\n            currentSourceFile = undefined;\n            currentModuleInfo = undefined;\n            return ts.aggregateTransformFlags(updated);\n        }\n        function transformCommonJSModule(node) {\n            startLexicalEnvironment();\n            var statements = [];\n            var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor);\n            ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true));\n            ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));\n            ts.addRange(statements, endLexicalEnvironment());\n            addExportEqualsIfNeeded(statements, false);\n            var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));\n            if (currentModuleInfo.hasExportStarsToExportValues) {\n                ts.addEmitHelper(updated, exportStarHelper);\n            }\n            return updated;\n        }\n        function transformAMDModule(node) {\n            var define = ts.createIdentifier(\"define\");\n            var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);\n            return transformAsynchronousModule(node, define, moduleName, true);\n        }\n        function transformUMDModule(node) {\n            var define = ts.createRawExpression(umdHelper);\n            return transformAsynchronousModule(node, define, undefined, false);\n        }\n        function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) {\n            var _a = collectAsynchronousDependencies(node, includeNonAmdDependencies), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames;\n            return ts.updateSourceFileNode(node, ts.createNodeArray([\n                ts.createStatement(ts.createCall(define, undefined, (moduleName ? [moduleName] : []).concat([\n                    ts.createArrayLiteral([\n                        ts.createLiteral(\"require\"),\n                        ts.createLiteral(\"exports\")\n                    ].concat(aliasedModuleNames, unaliasedModuleNames)),\n                    ts.createFunctionExpression(undefined, undefined, undefined, undefined, [\n                        ts.createParameter(undefined, undefined, undefined, \"require\"),\n                        ts.createParameter(undefined, undefined, undefined, \"exports\")\n                    ].concat(importAliasNames), undefined, transformAsynchronousModuleBody(node))\n                ])))\n            ], node.statements));\n        }\n        function collectAsynchronousDependencies(node, includeNonAmdDependencies) {\n            var aliasedModuleNames = [];\n            var unaliasedModuleNames = [];\n            var importAliasNames = [];\n            for (var _i = 0, _a = node.amdDependencies; _i < _a.length; _i++) {\n                var amdDependency = _a[_i];\n                if (amdDependency.name) {\n                    aliasedModuleNames.push(ts.createLiteral(amdDependency.path));\n                    importAliasNames.push(ts.createParameter(undefined, undefined, undefined, amdDependency.name));\n                }\n                else {\n                    unaliasedModuleNames.push(ts.createLiteral(amdDependency.path));\n                }\n            }\n            for (var _b = 0, _c = currentModuleInfo.externalImports; _b < _c.length; _b++) {\n                var importNode = _c[_b];\n                var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions);\n                var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile);\n                if (includeNonAmdDependencies && importAliasName) {\n                    ts.setEmitFlags(importAliasName, 4);\n                    aliasedModuleNames.push(externalModuleName);\n                    importAliasNames.push(ts.createParameter(undefined, undefined, undefined, importAliasName));\n                }\n                else {\n                    unaliasedModuleNames.push(externalModuleName);\n                }\n            }\n            return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames };\n        }\n        function transformAsynchronousModuleBody(node) {\n            startLexicalEnvironment();\n            var statements = [];\n            var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor);\n            ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true));\n            ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));\n            ts.addRange(statements, endLexicalEnvironment());\n            addExportEqualsIfNeeded(statements, true);\n            var body = ts.createBlock(statements, undefined, true);\n            if (currentModuleInfo.hasExportStarsToExportValues) {\n                ts.addEmitHelper(body, exportStarHelper);\n            }\n            return body;\n        }\n        function addExportEqualsIfNeeded(statements, emitAsReturn) {\n            if (currentModuleInfo.exportEquals) {\n                if (emitAsReturn) {\n                    var statement = ts.createReturn(currentModuleInfo.exportEquals.expression, currentModuleInfo.exportEquals);\n                    ts.setEmitFlags(statement, 384 | 1536);\n                    statements.push(statement);\n                }\n                else {\n                    var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier(\"module\"), \"exports\"), currentModuleInfo.exportEquals.expression), currentModuleInfo.exportEquals);\n                    ts.setEmitFlags(statement, 1536);\n                    statements.push(statement);\n                }\n            }\n        }\n        function sourceElementVisitor(node) {\n            switch (node.kind) {\n                case 235:\n                    return visitImportDeclaration(node);\n                case 234:\n                    return visitImportEqualsDeclaration(node);\n                case 241:\n                    return visitExportDeclaration(node);\n                case 240:\n                    return visitExportAssignment(node);\n                case 205:\n                    return visitVariableStatement(node);\n                case 225:\n                    return visitFunctionDeclaration(node);\n                case 226:\n                    return visitClassDeclaration(node);\n                case 295:\n                    return visitMergeDeclarationMarker(node);\n                case 296:\n                    return visitEndOfDeclarationMarker(node);\n                default:\n                    return node;\n            }\n        }\n        function visitImportDeclaration(node) {\n            var statements;\n            var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);\n            if (moduleKind !== ts.ModuleKind.AMD) {\n                if (!node.importClause) {\n                    return ts.createStatement(createRequireCall(node), node);\n                }\n                else {\n                    var variables = [];\n                    if (namespaceDeclaration && !ts.isDefaultImport(node)) {\n                        variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, createRequireCall(node)));\n                    }\n                    else {\n                        variables.push(ts.createVariableDeclaration(ts.getGeneratedNameForNode(node), undefined, createRequireCall(node)));\n                        if (namespaceDeclaration && ts.isDefaultImport(node)) {\n                            variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node)));\n                        }\n                    }\n                    statements = ts.append(statements, ts.createVariableStatement(undefined, ts.createVariableDeclarationList(variables, undefined, languageVersion >= 2 ? 2 : 0), node));\n                }\n            }\n            else if (namespaceDeclaration && ts.isDefaultImport(node)) {\n                statements = ts.append(statements, ts.createVariableStatement(undefined, ts.createVariableDeclarationList([\n                    ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node), node)\n                ], undefined, languageVersion >= 2 ? 2 : 0)));\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfImportDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function createRequireCall(importNode) {\n            var moduleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions);\n            var args = [];\n            if (moduleName) {\n                args.push(moduleName);\n            }\n            return ts.createCall(ts.createIdentifier(\"require\"), undefined, args);\n        }\n        function visitImportEqualsDeclaration(node) {\n            ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), \"import= for internal module references should be handled in an earlier transformer.\");\n            var statements;\n            if (moduleKind !== ts.ModuleKind.AMD) {\n                if (ts.hasModifier(node, 1)) {\n                    statements = ts.append(statements, ts.createStatement(createExportExpression(node.name, createRequireCall(node)), node));\n                }\n                else {\n                    statements = ts.append(statements, ts.createVariableStatement(undefined, ts.createVariableDeclarationList([\n                        ts.createVariableDeclaration(ts.getSynthesizedClone(node.name), undefined, createRequireCall(node))\n                    ], undefined, languageVersion >= 2 ? 2 : 0), node));\n                }\n            }\n            else {\n                if (ts.hasModifier(node, 1)) {\n                    statements = ts.append(statements, ts.createStatement(createExportExpression(ts.getExportName(node), ts.getLocalName(node)), node));\n                }\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfImportEqualsDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function visitExportDeclaration(node) {\n            if (!node.moduleSpecifier) {\n                return undefined;\n            }\n            var generatedName = ts.getGeneratedNameForNode(node);\n            if (node.exportClause) {\n                var statements = [];\n                if (moduleKind !== ts.ModuleKind.AMD) {\n                    statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([\n                        ts.createVariableDeclaration(generatedName, undefined, createRequireCall(node))\n                    ]), node));\n                }\n                for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) {\n                    var specifier = _a[_i];\n                    var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name);\n                    statements.push(ts.createStatement(createExportExpression(ts.getExportName(specifier), exportedValue), specifier));\n                }\n                return ts.singleOrMany(statements);\n            }\n            else {\n                return ts.createStatement(ts.createCall(ts.createIdentifier(\"__export\"), undefined, [\n                    moduleKind !== ts.ModuleKind.AMD\n                        ? createRequireCall(node)\n                        : generatedName\n                ]), node);\n            }\n        }\n        function visitExportAssignment(node) {\n            if (node.isExportEquals) {\n                return undefined;\n            }\n            var statements;\n            var original = node.original;\n            if (original && hasAssociatedEndOfDeclarationMarker(original)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier(\"default\"), node.expression, node, true);\n            }\n            else {\n                statements = appendExportStatement(statements, ts.createIdentifier(\"default\"), node.expression, node, true);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function visitFunctionDeclaration(node) {\n            var statements;\n            if (ts.hasModifier(node, 1)) {\n                statements = ts.append(statements, ts.setOriginalNode(ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, true, true), undefined, node.parameters, undefined, node.body, node), node));\n            }\n            else {\n                statements = ts.append(statements, node);\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfHoistedDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function visitClassDeclaration(node) {\n            var statements;\n            if (ts.hasModifier(node, 1)) {\n                statements = ts.append(statements, ts.setOriginalNode(ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, true, true), undefined, node.heritageClauses, node.members, node), node));\n            }\n            else {\n                statements = ts.append(statements, node);\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfHoistedDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function visitVariableStatement(node) {\n            var statements;\n            var variables;\n            var expressions;\n            if (ts.hasModifier(node, 1)) {\n                var modifiers = void 0;\n                for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                    var variable = _a[_i];\n                    if (ts.isIdentifier(variable.name) && ts.isLocalName(variable.name)) {\n                        if (!modifiers) {\n                            modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier);\n                        }\n                        variables = ts.append(variables, variable);\n                    }\n                    else if (variable.initializer) {\n                        expressions = ts.append(expressions, transformInitializedVariable(variable));\n                    }\n                }\n                if (variables) {\n                    statements = ts.append(statements, ts.updateVariableStatement(node, modifiers, ts.updateVariableDeclarationList(node.declarationList, variables)));\n                }\n                if (expressions) {\n                    statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), node));\n                }\n            }\n            else {\n                statements = ts.append(statements, node);\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfVariableStatement(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function transformInitializedVariable(node) {\n            if (ts.isBindingPattern(node.name)) {\n                return ts.flattenDestructuringAssignment(node, undefined, context, 0, false, createExportExpression);\n            }\n            else {\n                return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier(\"exports\"), node.name, node.name), node.initializer);\n            }\n        }\n        function visitMergeDeclarationMarker(node) {\n            if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original);\n            }\n            return node;\n        }\n        function hasAssociatedEndOfDeclarationMarker(node) {\n            return (ts.getEmitFlags(node) & 2097152) !== 0;\n        }\n        function visitEndOfDeclarationMarker(node) {\n            var id = ts.getOriginalNodeId(node);\n            var statements = deferredExports[id];\n            if (statements) {\n                delete deferredExports[id];\n                return ts.append(statements, node);\n            }\n            return node;\n        }\n        function appendExportsOfImportDeclaration(statements, decl) {\n            if (currentModuleInfo.exportEquals) {\n                return statements;\n            }\n            var importClause = decl.importClause;\n            if (!importClause) {\n                return statements;\n            }\n            if (importClause.name) {\n                statements = appendExportsOfDeclaration(statements, importClause);\n            }\n            var namedBindings = importClause.namedBindings;\n            if (namedBindings) {\n                switch (namedBindings.kind) {\n                    case 237:\n                        statements = appendExportsOfDeclaration(statements, namedBindings);\n                        break;\n                    case 238:\n                        for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {\n                            var importBinding = _a[_i];\n                            statements = appendExportsOfDeclaration(statements, importBinding);\n                        }\n                        break;\n                }\n            }\n            return statements;\n        }\n        function appendExportsOfImportEqualsDeclaration(statements, decl) {\n            if (currentModuleInfo.exportEquals) {\n                return statements;\n            }\n            return appendExportsOfDeclaration(statements, decl);\n        }\n        function appendExportsOfVariableStatement(statements, node) {\n            if (currentModuleInfo.exportEquals) {\n                return statements;\n            }\n            for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                var decl = _a[_i];\n                statements = appendExportsOfBindingElement(statements, decl);\n            }\n            return statements;\n        }\n        function appendExportsOfBindingElement(statements, decl) {\n            if (currentModuleInfo.exportEquals) {\n                return statements;\n            }\n            if (ts.isBindingPattern(decl.name)) {\n                for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        statements = appendExportsOfBindingElement(statements, element);\n                    }\n                }\n            }\n            else if (!ts.isGeneratedIdentifier(decl.name)) {\n                statements = appendExportsOfDeclaration(statements, decl);\n            }\n            return statements;\n        }\n        function appendExportsOfHoistedDeclaration(statements, decl) {\n            if (currentModuleInfo.exportEquals) {\n                return statements;\n            }\n            if (ts.hasModifier(decl, 1)) {\n                var exportName = ts.hasModifier(decl, 512) ? ts.createIdentifier(\"default\") : decl.name;\n                statements = appendExportStatement(statements, exportName, ts.getLocalName(decl), decl);\n            }\n            if (decl.name) {\n                statements = appendExportsOfDeclaration(statements, decl);\n            }\n            return statements;\n        }\n        function appendExportsOfDeclaration(statements, decl) {\n            var name = ts.getDeclarationName(decl);\n            var exportSpecifiers = currentModuleInfo.exportSpecifiers[name.text];\n            if (exportSpecifiers) {\n                for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) {\n                    var exportSpecifier = exportSpecifiers_1[_i];\n                    statements = appendExportStatement(statements, exportSpecifier.name, name, exportSpecifier.name);\n                }\n            }\n            return statements;\n        }\n        function appendExportStatement(statements, exportName, expression, location, allowComments) {\n            if (exportName.text === \"default\") {\n                var sourceFile = ts.getOriginalNode(currentSourceFile, ts.isSourceFile);\n                if (sourceFile && !sourceFile.symbol.exports[\"___esModule\"]) {\n                    if (languageVersion === 0) {\n                        statements = ts.append(statements, ts.createStatement(createExportExpression(ts.createIdentifier(\"__esModule\"), ts.createLiteral(true))));\n                    }\n                    else {\n                        statements = ts.append(statements, ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier(\"Object\"), \"defineProperty\"), undefined, [\n                            ts.createIdentifier(\"exports\"),\n                            ts.createLiteral(\"__esModule\"),\n                            ts.createObjectLiteral([\n                                ts.createPropertyAssignment(\"value\", ts.createLiteral(true))\n                            ])\n                        ])));\n                    }\n                }\n            }\n            statements = ts.append(statements, createExportStatement(exportName, expression, location, allowComments));\n            return statements;\n        }\n        function createExportStatement(name, value, location, allowComments) {\n            var statement = ts.createStatement(createExportExpression(name, value), location);\n            ts.startOnNewLine(statement);\n            if (!allowComments) {\n                ts.setEmitFlags(statement, 1536);\n            }\n            return statement;\n        }\n        function createExportExpression(name, value, location) {\n            return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier(\"exports\"), ts.getSynthesizedClone(name)), value, location);\n        }\n        function modifierVisitor(node) {\n            switch (node.kind) {\n                case 83:\n                case 78:\n                    return undefined;\n            }\n            return node;\n        }\n        function onEmitNode(emitContext, node, emitCallback) {\n            if (node.kind === 261) {\n                currentSourceFile = node;\n                currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)];\n                noSubstitution = ts.createMap();\n                previousOnEmitNode(emitContext, node, emitCallback);\n                currentSourceFile = undefined;\n                currentModuleInfo = undefined;\n                noSubstitution = undefined;\n            }\n            else {\n                previousOnEmitNode(emitContext, node, emitCallback);\n            }\n        }\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (node.id && noSubstitution[node.id]) {\n                return node;\n            }\n            if (emitContext === 1) {\n                return substituteExpression(node);\n            }\n            else if (ts.isShorthandPropertyAssignment(node)) {\n                return substituteShorthandPropertyAssignment(node);\n            }\n            return node;\n        }\n        function substituteShorthandPropertyAssignment(node) {\n            var name = node.name;\n            var exportedOrImportedName = substituteExpressionIdentifier(name);\n            if (exportedOrImportedName !== name) {\n                if (node.objectAssignmentInitializer) {\n                    var initializer = ts.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer);\n                    return ts.createPropertyAssignment(name, initializer, node);\n                }\n                return ts.createPropertyAssignment(name, exportedOrImportedName, node);\n            }\n            return node;\n        }\n        function substituteExpression(node) {\n            switch (node.kind) {\n                case 70:\n                    return substituteExpressionIdentifier(node);\n                case 192:\n                    return substituteBinaryExpression(node);\n                case 191:\n                case 190:\n                    return substituteUnaryExpression(node);\n            }\n            return node;\n        }\n        function substituteExpressionIdentifier(node) {\n            if (ts.getEmitFlags(node) & 4096) {\n                var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);\n                if (externalHelpersModuleName) {\n                    return ts.createPropertyAccess(externalHelpersModuleName, node);\n                }\n                return node;\n            }\n            if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {\n                var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node));\n                if (exportContainer && exportContainer.kind === 261) {\n                    return ts.createPropertyAccess(ts.createIdentifier(\"exports\"), ts.getSynthesizedClone(node), node);\n                }\n                var importDeclaration = resolver.getReferencedImportDeclaration(node);\n                if (importDeclaration) {\n                    if (ts.isImportClause(importDeclaration)) {\n                        return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier(\"default\"), node);\n                    }\n                    else if (ts.isImportSpecifier(importDeclaration)) {\n                        var name_40 = importDeclaration.propertyName || importDeclaration.name;\n                        return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_40), node);\n                    }\n                }\n            }\n            return node;\n        }\n        function substituteBinaryExpression(node) {\n            if (ts.isAssignmentOperator(node.operatorToken.kind)\n                && ts.isIdentifier(node.left)\n                && !ts.isGeneratedIdentifier(node.left)\n                && !ts.isLocalName(node.left)\n                && !ts.isDeclarationNameOfEnumOrNamespace(node.left)) {\n                var exportedNames = getExports(node.left);\n                if (exportedNames) {\n                    var expression = node;\n                    for (var _i = 0, exportedNames_1 = exportedNames; _i < exportedNames_1.length; _i++) {\n                        var exportName = exportedNames_1[_i];\n                        noSubstitution[ts.getNodeId(expression)] = true;\n                        expression = createExportExpression(exportName, expression, node);\n                    }\n                    return expression;\n                }\n            }\n            return node;\n        }\n        function substituteUnaryExpression(node) {\n            if ((node.operator === 42 || node.operator === 43)\n                && ts.isIdentifier(node.operand)\n                && !ts.isGeneratedIdentifier(node.operand)\n                && !ts.isLocalName(node.operand)\n                && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {\n                var exportedNames = getExports(node.operand);\n                if (exportedNames) {\n                    var expression = node.kind === 191\n                        ? ts.createBinary(node.operand, ts.createToken(node.operator === 42 ? 58 : 59), ts.createLiteral(1), node)\n                        : node;\n                    for (var _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) {\n                        var exportName = exportedNames_2[_i];\n                        noSubstitution[ts.getNodeId(expression)] = true;\n                        expression = createExportExpression(exportName, expression);\n                    }\n                    return expression;\n                }\n            }\n            return node;\n        }\n        function getExports(name) {\n            if (!ts.isGeneratedIdentifier(name)) {\n                var valueDeclaration = resolver.getReferencedImportDeclaration(name)\n                    || resolver.getReferencedValueDeclaration(name);\n                if (valueDeclaration) {\n                    return currentModuleInfo\n                        && currentModuleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)];\n                }\n            }\n        }\n        var _a;\n    }\n    ts.transformModule = transformModule;\n    var exportStarHelper = {\n        name: \"typescript:export-star\",\n        scoped: true,\n        text: \"\\n            function __export(m) {\\n                for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\\n            }\"\n    };\n    var umdHelper = \"\\n        (function (dependencies, factory) {\\n            if (typeof module === 'object' && typeof module.exports === 'object') {\\n                var v = factory(require, exports); if (v !== undefined) module.exports = v;\\n            }\\n            else if (typeof define === 'function' && define.amd) {\\n                define(dependencies, factory);\\n            }\\n        })\";\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformSystemModule(context) {\n        var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;\n        var compilerOptions = context.getCompilerOptions();\n        var resolver = context.getEmitResolver();\n        var host = context.getEmitHost();\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        var previousOnEmitNode = context.onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        context.onEmitNode = onEmitNode;\n        context.enableSubstitution(70);\n        context.enableSubstitution(192);\n        context.enableSubstitution(190);\n        context.enableSubstitution(191);\n        context.enableEmitNotification(261);\n        var moduleInfoMap = ts.createMap();\n        var deferredExports = ts.createMap();\n        var exportFunctionsMap = ts.createMap();\n        var noSubstitutionMap = ts.createMap();\n        var currentSourceFile;\n        var moduleInfo;\n        var exportFunction;\n        var contextObject;\n        var hoistedStatements;\n        var enclosingBlockScopedContainer;\n        var noSubstitution;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)\n                || !(ts.isExternalModule(node)\n                    || compilerOptions.isolatedModules)) {\n                return node;\n            }\n            var id = ts.getOriginalNodeId(node);\n            currentSourceFile = node;\n            enclosingBlockScopedContainer = node;\n            moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions);\n            exportFunction = exportFunctionsMap[id] = ts.createUniqueName(\"exports\");\n            contextObject = ts.createUniqueName(\"context\");\n            var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports);\n            var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups);\n            var moduleBodyFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [\n                ts.createParameter(undefined, undefined, undefined, exportFunction),\n                ts.createParameter(undefined, undefined, undefined, contextObject)\n            ], undefined, moduleBodyBlock);\n            var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);\n            var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; }));\n            var updated = ts.updateSourceFileNode(node, ts.createNodeArray([\n                ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier(\"System\"), \"register\"), undefined, moduleName\n                    ? [moduleName, dependencies, moduleBodyFunction]\n                    : [dependencies, moduleBodyFunction]))\n            ], node.statements));\n            if (!(compilerOptions.outFile || compilerOptions.out)) {\n                ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; });\n            }\n            if (noSubstitution) {\n                noSubstitutionMap[id] = noSubstitution;\n                noSubstitution = undefined;\n            }\n            currentSourceFile = undefined;\n            moduleInfo = undefined;\n            exportFunction = undefined;\n            contextObject = undefined;\n            hoistedStatements = undefined;\n            enclosingBlockScopedContainer = undefined;\n            return ts.aggregateTransformFlags(updated);\n        }\n        function collectDependencyGroups(externalImports) {\n            var groupIndices = ts.createMap();\n            var dependencyGroups = [];\n            for (var i = 0; i < externalImports.length; i++) {\n                var externalImport = externalImports[i];\n                var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions);\n                var text = externalModuleName.text;\n                if (ts.hasProperty(groupIndices, text)) {\n                    var groupIndex = groupIndices[text];\n                    dependencyGroups[groupIndex].externalImports.push(externalImport);\n                }\n                else {\n                    groupIndices[text] = dependencyGroups.length;\n                    dependencyGroups.push({\n                        name: externalModuleName,\n                        externalImports: [externalImport]\n                    });\n                }\n            }\n            return dependencyGroups;\n        }\n        function createSystemModuleBody(node, dependencyGroups) {\n            var statements = [];\n            startLexicalEnvironment();\n            var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor);\n            statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(\"__moduleName\", undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, \"id\")))\n            ])));\n            ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true);\n            var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset);\n            ts.addRange(statements, hoistedStatements);\n            ts.addRange(statements, endLexicalEnvironment());\n            var exportStarFunction = addExportStarIfNeeded(statements);\n            statements.push(ts.createReturn(ts.setMultiLine(ts.createObjectLiteral([\n                ts.createPropertyAssignment(\"setters\", createSettersArray(exportStarFunction, dependencyGroups)),\n                ts.createPropertyAssignment(\"execute\", ts.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, undefined, true)))\n            ]), true)));\n            return ts.createBlock(statements, undefined, true);\n        }\n        function addExportStarIfNeeded(statements) {\n            if (!moduleInfo.hasExportStarsToExportValues) {\n                return;\n            }\n            if (!moduleInfo.exportedNames && ts.isEmpty(moduleInfo.exportSpecifiers)) {\n                var hasExportDeclarationWithExportClause = false;\n                for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) {\n                    var externalImport = _a[_i];\n                    if (externalImport.kind === 241 && externalImport.exportClause) {\n                        hasExportDeclarationWithExportClause = true;\n                        break;\n                    }\n                }\n                if (!hasExportDeclarationWithExportClause) {\n                    var exportStarFunction_1 = createExportStarFunction(undefined);\n                    statements.push(exportStarFunction_1);\n                    return exportStarFunction_1.name;\n                }\n            }\n            var exportedNames = [];\n            if (moduleInfo.exportedNames) {\n                for (var _b = 0, _c = moduleInfo.exportedNames; _b < _c.length; _b++) {\n                    var exportedLocalName = _c[_b];\n                    if (exportedLocalName.text === \"default\") {\n                        continue;\n                    }\n                    exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName), ts.createLiteral(true)));\n                }\n            }\n            for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) {\n                var externalImport = _e[_d];\n                if (externalImport.kind !== 241) {\n                    continue;\n                }\n                var exportDecl = externalImport;\n                if (!exportDecl.exportClause) {\n                    continue;\n                }\n                for (var _f = 0, _g = exportDecl.exportClause.elements; _f < _g.length; _f++) {\n                    var element = _g[_f];\n                    exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createLiteral(true)));\n                }\n            }\n            var exportedNamesStorageRef = ts.createUniqueName(\"exportedNames\");\n            statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(exportedNamesStorageRef, undefined, ts.createObjectLiteral(exportedNames, undefined, true))\n            ])));\n            var exportStarFunction = createExportStarFunction(exportedNamesStorageRef);\n            statements.push(exportStarFunction);\n            return exportStarFunction.name;\n        }\n        function createExportStarFunction(localNames) {\n            var exportStarFunction = ts.createUniqueName(\"exportStar\");\n            var m = ts.createIdentifier(\"m\");\n            var n = ts.createIdentifier(\"n\");\n            var exports = ts.createIdentifier(\"exports\");\n            var condition = ts.createStrictInequality(n, ts.createLiteral(\"default\"));\n            if (localNames) {\n                condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, \"hasOwnProperty\"), undefined, [n])));\n            }\n            return ts.createFunctionDeclaration(undefined, undefined, undefined, exportStarFunction, undefined, [ts.createParameter(undefined, undefined, undefined, m)], undefined, ts.createBlock([\n                ts.createVariableStatement(undefined, ts.createVariableDeclarationList([\n                    ts.createVariableDeclaration(exports, undefined, ts.createObjectLiteral([]))\n                ])),\n                ts.createForIn(ts.createVariableDeclarationList([\n                    ts.createVariableDeclaration(n, undefined)\n                ]), m, ts.createBlock([\n                    ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1)\n                ])),\n                ts.createStatement(ts.createCall(exportFunction, undefined, [exports]))\n            ], undefined, true));\n        }\n        function createSettersArray(exportStarFunction, dependencyGroups) {\n            var setters = [];\n            for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) {\n                var group = dependencyGroups_1[_i];\n                var localName = ts.forEach(group.externalImports, function (i) { return ts.getLocalNameForExternalImport(i, currentSourceFile); });\n                var parameterName = localName ? ts.getGeneratedNameForNode(localName) : ts.createUniqueName(\"\");\n                var statements = [];\n                for (var _a = 0, _b = group.externalImports; _a < _b.length; _a++) {\n                    var entry = _b[_a];\n                    var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile);\n                    switch (entry.kind) {\n                        case 235:\n                            if (!entry.importClause) {\n                                break;\n                            }\n                        case 234:\n                            ts.Debug.assert(importVariableName !== undefined);\n                            statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName)));\n                            break;\n                        case 241:\n                            ts.Debug.assert(importVariableName !== undefined);\n                            if (entry.exportClause) {\n                                var properties = [];\n                                for (var _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) {\n                                    var e = _d[_c];\n                                    properties.push(ts.createPropertyAssignment(ts.createLiteral(e.name.text), ts.createElementAccess(parameterName, ts.createLiteral((e.propertyName || e.name).text))));\n                                }\n                                statements.push(ts.createStatement(ts.createCall(exportFunction, undefined, [ts.createObjectLiteral(properties, undefined, true)])));\n                            }\n                            else {\n                                statements.push(ts.createStatement(ts.createCall(exportStarFunction, undefined, [parameterName])));\n                            }\n                            break;\n                    }\n                }\n                setters.push(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, ts.createBlock(statements, undefined, true)));\n            }\n            return ts.createArrayLiteral(setters, undefined, true);\n        }\n        function sourceElementVisitor(node) {\n            switch (node.kind) {\n                case 235:\n                    return visitImportDeclaration(node);\n                case 234:\n                    return visitImportEqualsDeclaration(node);\n                case 241:\n                    return undefined;\n                case 240:\n                    return visitExportAssignment(node);\n                default:\n                    return nestedElementVisitor(node);\n            }\n        }\n        function visitImportDeclaration(node) {\n            var statements;\n            if (node.importClause) {\n                hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile));\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfImportDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function visitImportEqualsDeclaration(node) {\n            ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), \"import= for internal module references should be handled in an earlier transformer.\");\n            var statements;\n            hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile));\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfImportEqualsDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function visitExportAssignment(node) {\n            if (node.isExportEquals) {\n                return undefined;\n            }\n            var expression = ts.visitNode(node.expression, destructuringVisitor, ts.isExpression);\n            var original = node.original;\n            if (original && hasAssociatedEndOfDeclarationMarker(original)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier(\"default\"), expression, true);\n            }\n            else {\n                return createExportStatement(ts.createIdentifier(\"default\"), expression, true);\n            }\n        }\n        function visitFunctionDeclaration(node) {\n            if (ts.hasModifier(node, 1)) {\n                hoistedStatements = ts.append(hoistedStatements, ts.updateFunctionDeclaration(node, node.decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, true, true), undefined, ts.visitNodes(node.parameters, destructuringVisitor, ts.isParameterDeclaration), undefined, ts.visitNode(node.body, destructuringVisitor, ts.isBlock)));\n            }\n            else {\n                hoistedStatements = ts.append(hoistedStatements, node);\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);\n            }\n            else {\n                hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node);\n            }\n            return undefined;\n        }\n        function visitClassDeclaration(node) {\n            var statements;\n            var name = ts.getLocalName(node);\n            hoistVariableDeclaration(name);\n            statements = ts.append(statements, ts.createStatement(ts.createAssignment(name, ts.createClassExpression(undefined, node.name, undefined, ts.visitNodes(node.heritageClauses, destructuringVisitor, ts.isHeritageClause), ts.visitNodes(node.members, destructuringVisitor, ts.isClassElement), node)), node));\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfHoistedDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function visitVariableStatement(node) {\n            if (!shouldHoistVariableDeclarationList(node.declarationList)) {\n                return ts.visitNode(node, destructuringVisitor, ts.isStatement);\n            }\n            var expressions;\n            var isExportedDeclaration = ts.hasModifier(node, 1);\n            var isMarkedDeclaration = hasAssociatedEndOfDeclarationMarker(node);\n            for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                var variable = _a[_i];\n                if (variable.initializer) {\n                    expressions = ts.append(expressions, transformInitializedVariable(variable, isExportedDeclaration && !isMarkedDeclaration));\n                }\n                else {\n                    hoistBindingElement(variable);\n                }\n            }\n            var statements;\n            if (expressions) {\n                statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), node));\n            }\n            if (isMarkedDeclaration) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration);\n            }\n            else {\n                statements = appendExportsOfVariableStatement(statements, node, false);\n            }\n            return ts.singleOrMany(statements);\n        }\n        function hoistBindingElement(node) {\n            if (ts.isBindingPattern(node.name)) {\n                for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        hoistBindingElement(element);\n                    }\n                }\n            }\n            else {\n                hoistVariableDeclaration(ts.getSynthesizedClone(node.name));\n            }\n        }\n        function shouldHoistVariableDeclarationList(node) {\n            return (ts.getEmitFlags(node) & 1048576) === 0\n                && (enclosingBlockScopedContainer.kind === 261\n                    || (ts.getOriginalNode(node).flags & 3) === 0);\n        }\n        function transformInitializedVariable(node, isExportedDeclaration) {\n            var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment;\n            return ts.isBindingPattern(node.name)\n                ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, false, createAssignment)\n                : createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression));\n        }\n        function createExportedVariableAssignment(name, value, location) {\n            return createVariableAssignment(name, value, location, true);\n        }\n        function createNonExportedVariableAssignment(name, value, location) {\n            return createVariableAssignment(name, value, location, false);\n        }\n        function createVariableAssignment(name, value, location, isExportedDeclaration) {\n            hoistVariableDeclaration(ts.getSynthesizedClone(name));\n            return isExportedDeclaration\n                ? createExportExpression(name, preventSubstitution(ts.createAssignment(name, value, location)))\n                : preventSubstitution(ts.createAssignment(name, value, location));\n        }\n        function visitMergeDeclarationMarker(node) {\n            if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205) {\n                var id = ts.getOriginalNodeId(node);\n                var isExportedDeclaration = ts.hasModifier(node.original, 1);\n                deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration);\n            }\n            return node;\n        }\n        function hasAssociatedEndOfDeclarationMarker(node) {\n            return (ts.getEmitFlags(node) & 2097152) !== 0;\n        }\n        function visitEndOfDeclarationMarker(node) {\n            var id = ts.getOriginalNodeId(node);\n            var statements = deferredExports[id];\n            if (statements) {\n                delete deferredExports[id];\n                return ts.append(statements, node);\n            }\n            return node;\n        }\n        function appendExportsOfImportDeclaration(statements, decl) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            var importClause = decl.importClause;\n            if (!importClause) {\n                return statements;\n            }\n            if (importClause.name) {\n                statements = appendExportsOfDeclaration(statements, importClause);\n            }\n            var namedBindings = importClause.namedBindings;\n            if (namedBindings) {\n                switch (namedBindings.kind) {\n                    case 237:\n                        statements = appendExportsOfDeclaration(statements, namedBindings);\n                        break;\n                    case 238:\n                        for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {\n                            var importBinding = _a[_i];\n                            statements = appendExportsOfDeclaration(statements, importBinding);\n                        }\n                        break;\n                }\n            }\n            return statements;\n        }\n        function appendExportsOfImportEqualsDeclaration(statements, decl) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            return appendExportsOfDeclaration(statements, decl);\n        }\n        function appendExportsOfVariableStatement(statements, node, exportSelf) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                var decl = _a[_i];\n                if (decl.initializer || exportSelf) {\n                    statements = appendExportsOfBindingElement(statements, decl, exportSelf);\n                }\n            }\n            return statements;\n        }\n        function appendExportsOfBindingElement(statements, decl, exportSelf) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            if (ts.isBindingPattern(decl.name)) {\n                for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        statements = appendExportsOfBindingElement(statements, element, exportSelf);\n                    }\n                }\n            }\n            else if (!ts.isGeneratedIdentifier(decl.name)) {\n                var excludeName = void 0;\n                if (exportSelf) {\n                    statements = appendExportStatement(statements, decl.name, ts.getLocalName(decl));\n                    excludeName = decl.name.text;\n                }\n                statements = appendExportsOfDeclaration(statements, decl, excludeName);\n            }\n            return statements;\n        }\n        function appendExportsOfHoistedDeclaration(statements, decl) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            var excludeName;\n            if (ts.hasModifier(decl, 1)) {\n                var exportName = ts.hasModifier(decl, 512) ? ts.createLiteral(\"default\") : decl.name;\n                statements = appendExportStatement(statements, exportName, ts.getLocalName(decl));\n                excludeName = exportName.text;\n            }\n            if (decl.name) {\n                statements = appendExportsOfDeclaration(statements, decl, excludeName);\n            }\n            return statements;\n        }\n        function appendExportsOfDeclaration(statements, decl, excludeName) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            var name = ts.getDeclarationName(decl);\n            var exportSpecifiers = moduleInfo.exportSpecifiers[name.text];\n            if (exportSpecifiers) {\n                for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) {\n                    var exportSpecifier = exportSpecifiers_2[_i];\n                    if (exportSpecifier.name.text !== excludeName) {\n                        statements = appendExportStatement(statements, exportSpecifier.name, name);\n                    }\n                }\n            }\n            return statements;\n        }\n        function appendExportStatement(statements, exportName, expression, allowComments) {\n            statements = ts.append(statements, createExportStatement(exportName, expression, allowComments));\n            return statements;\n        }\n        function createExportStatement(name, value, allowComments) {\n            var statement = ts.createStatement(createExportExpression(name, value));\n            ts.startOnNewLine(statement);\n            if (!allowComments) {\n                ts.setEmitFlags(statement, 1536);\n            }\n            return statement;\n        }\n        function createExportExpression(name, value) {\n            var exportName = ts.isIdentifier(name) ? ts.createLiteral(name) : name;\n            return ts.createCall(exportFunction, undefined, [exportName, value]);\n        }\n        function nestedElementVisitor(node) {\n            switch (node.kind) {\n                case 205:\n                    return visitVariableStatement(node);\n                case 225:\n                    return visitFunctionDeclaration(node);\n                case 226:\n                    return visitClassDeclaration(node);\n                case 211:\n                    return visitForStatement(node);\n                case 212:\n                    return visitForInStatement(node);\n                case 213:\n                    return visitForOfStatement(node);\n                case 209:\n                    return visitDoStatement(node);\n                case 210:\n                    return visitWhileStatement(node);\n                case 219:\n                    return visitLabeledStatement(node);\n                case 217:\n                    return visitWithStatement(node);\n                case 218:\n                    return visitSwitchStatement(node);\n                case 232:\n                    return visitCaseBlock(node);\n                case 253:\n                    return visitCaseClause(node);\n                case 254:\n                    return visitDefaultClause(node);\n                case 221:\n                    return visitTryStatement(node);\n                case 256:\n                    return visitCatchClause(node);\n                case 204:\n                    return visitBlock(node);\n                case 295:\n                    return visitMergeDeclarationMarker(node);\n                case 296:\n                    return visitEndOfDeclarationMarker(node);\n                default:\n                    return destructuringVisitor(node);\n            }\n        }\n        function visitForStatement(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.updateFor(node, visitForInitializer(node.initializer), ts.visitNode(node.condition, destructuringVisitor, ts.isExpression, true), ts.visitNode(node.incrementor, destructuringVisitor, ts.isExpression, true), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement));\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        function visitForInStatement(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.updateForIn(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock));\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        function visitForOfStatement(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.updateForOf(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock));\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        function shouldHoistForInitializer(node) {\n            return ts.isVariableDeclarationList(node)\n                && shouldHoistVariableDeclarationList(node);\n        }\n        function visitForInitializer(node) {\n            if (shouldHoistForInitializer(node)) {\n                var expressions = void 0;\n                for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) {\n                    var variable = _a[_i];\n                    expressions = ts.append(expressions, transformInitializedVariable(variable, false));\n                }\n                return expressions ? ts.inlineExpressions(expressions) : ts.createOmittedExpression();\n            }\n            else {\n                return ts.visitEachChild(node, nestedElementVisitor, context);\n            }\n        }\n        function visitDoStatement(node) {\n            return ts.updateDo(node, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression));\n        }\n        function visitWhileStatement(node) {\n            return ts.updateWhile(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock));\n        }\n        function visitLabeledStatement(node) {\n            return ts.updateLabel(node, node.label, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock));\n        }\n        function visitWithStatement(node) {\n            return ts.updateWith(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock));\n        }\n        function visitSwitchStatement(node) {\n            return ts.updateSwitch(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.caseBlock, nestedElementVisitor, ts.isCaseBlock));\n        }\n        function visitCaseBlock(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.updateCaseBlock(node, ts.visitNodes(node.clauses, nestedElementVisitor, ts.isCaseOrDefaultClause));\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        function visitCaseClause(node) {\n            return ts.updateCaseClause(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNodes(node.statements, nestedElementVisitor, ts.isStatement));\n        }\n        function visitDefaultClause(node) {\n            return ts.visitEachChild(node, nestedElementVisitor, context);\n        }\n        function visitTryStatement(node) {\n            return ts.visitEachChild(node, nestedElementVisitor, context);\n        }\n        function visitCatchClause(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.updateCatchClause(node, node.variableDeclaration, ts.visitNode(node.block, nestedElementVisitor, ts.isBlock));\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        function visitBlock(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.visitEachChild(node, nestedElementVisitor, context);\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        function destructuringVisitor(node) {\n            if (node.transformFlags & 1024\n                && node.kind === 192) {\n                return visitDestructuringAssignment(node);\n            }\n            else if (node.transformFlags & 2048) {\n                return ts.visitEachChild(node, destructuringVisitor, context);\n            }\n            else {\n                return node;\n            }\n        }\n        function visitDestructuringAssignment(node) {\n            if (hasExportedReferenceInDestructuringTarget(node.left)) {\n                return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, true);\n            }\n            return ts.visitEachChild(node, destructuringVisitor, context);\n        }\n        function hasExportedReferenceInDestructuringTarget(node) {\n            if (ts.isAssignmentExpression(node)) {\n                return hasExportedReferenceInDestructuringTarget(node.left);\n            }\n            else if (ts.isSpreadExpression(node)) {\n                return hasExportedReferenceInDestructuringTarget(node.expression);\n            }\n            else if (ts.isObjectLiteralExpression(node)) {\n                return ts.some(node.properties, hasExportedReferenceInDestructuringTarget);\n            }\n            else if (ts.isArrayLiteralExpression(node)) {\n                return ts.some(node.elements, hasExportedReferenceInDestructuringTarget);\n            }\n            else if (ts.isShorthandPropertyAssignment(node)) {\n                return hasExportedReferenceInDestructuringTarget(node.name);\n            }\n            else if (ts.isPropertyAssignment(node)) {\n                return hasExportedReferenceInDestructuringTarget(node.initializer);\n            }\n            else if (ts.isIdentifier(node)) {\n                var container = resolver.getReferencedExportContainer(node);\n                return container !== undefined && container.kind === 261;\n            }\n            else {\n                return false;\n            }\n        }\n        function modifierVisitor(node) {\n            switch (node.kind) {\n                case 83:\n                case 78:\n                    return undefined;\n            }\n            return node;\n        }\n        function onEmitNode(emitContext, node, emitCallback) {\n            if (node.kind === 261) {\n                var id = ts.getOriginalNodeId(node);\n                currentSourceFile = node;\n                moduleInfo = moduleInfoMap[id];\n                exportFunction = exportFunctionsMap[id];\n                noSubstitution = noSubstitutionMap[id];\n                if (noSubstitution) {\n                    delete noSubstitutionMap[id];\n                }\n                previousOnEmitNode(emitContext, node, emitCallback);\n                currentSourceFile = undefined;\n                moduleInfo = undefined;\n                exportFunction = undefined;\n                noSubstitution = undefined;\n            }\n            else {\n                previousOnEmitNode(emitContext, node, emitCallback);\n            }\n        }\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (isSubstitutionPrevented(node)) {\n                return node;\n            }\n            if (emitContext === 1) {\n                return substituteExpression(node);\n            }\n            return node;\n        }\n        function substituteExpression(node) {\n            switch (node.kind) {\n                case 70:\n                    return substituteExpressionIdentifier(node);\n                case 192:\n                    return substituteBinaryExpression(node);\n                case 190:\n                case 191:\n                    return substituteUnaryExpression(node);\n            }\n            return node;\n        }\n        function substituteExpressionIdentifier(node) {\n            if (ts.getEmitFlags(node) & 4096) {\n                var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);\n                if (externalHelpersModuleName) {\n                    return ts.createPropertyAccess(externalHelpersModuleName, node);\n                }\n                return node;\n            }\n            if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {\n                var importDeclaration = resolver.getReferencedImportDeclaration(node);\n                if (importDeclaration) {\n                    if (ts.isImportClause(importDeclaration)) {\n                        return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier(\"default\"), node);\n                    }\n                    else if (ts.isImportSpecifier(importDeclaration)) {\n                        return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(importDeclaration.propertyName || importDeclaration.name), node);\n                    }\n                }\n            }\n            return node;\n        }\n        function substituteBinaryExpression(node) {\n            if (ts.isAssignmentOperator(node.operatorToken.kind)\n                && ts.isIdentifier(node.left)\n                && !ts.isGeneratedIdentifier(node.left)\n                && !ts.isLocalName(node.left)\n                && !ts.isDeclarationNameOfEnumOrNamespace(node.left)) {\n                var exportedNames = getExports(node.left);\n                if (exportedNames) {\n                    var expression = node;\n                    for (var _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) {\n                        var exportName = exportedNames_3[_i];\n                        expression = createExportExpression(exportName, preventSubstitution(expression));\n                    }\n                    return expression;\n                }\n            }\n            return node;\n        }\n        function substituteUnaryExpression(node) {\n            if ((node.operator === 42 || node.operator === 43)\n                && ts.isIdentifier(node.operand)\n                && !ts.isGeneratedIdentifier(node.operand)\n                && !ts.isLocalName(node.operand)\n                && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {\n                var exportedNames = getExports(node.operand);\n                if (exportedNames) {\n                    var expression = node.kind === 191\n                        ? ts.createPrefix(node.operator, node.operand, node)\n                        : node;\n                    for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) {\n                        var exportName = exportedNames_4[_i];\n                        expression = createExportExpression(exportName, preventSubstitution(expression));\n                    }\n                    if (node.kind === 191) {\n                        expression = node.operator === 42\n                            ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1))\n                            : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1));\n                    }\n                    return expression;\n                }\n            }\n            return node;\n        }\n        function getExports(name) {\n            var exportedNames;\n            if (!ts.isGeneratedIdentifier(name)) {\n                var valueDeclaration = resolver.getReferencedImportDeclaration(name)\n                    || resolver.getReferencedValueDeclaration(name);\n                if (valueDeclaration) {\n                    var exportContainer = resolver.getReferencedExportContainer(name, false);\n                    if (exportContainer && exportContainer.kind === 261) {\n                        exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration));\n                    }\n                    exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]);\n                }\n            }\n            return exportedNames;\n        }\n        function preventSubstitution(node) {\n            if (noSubstitution === undefined)\n                noSubstitution = ts.createMap();\n            noSubstitution[ts.getNodeId(node)] = true;\n            return node;\n        }\n        function isSubstitutionPrevented(node) {\n            return noSubstitution && node.id && noSubstitution[node.id];\n        }\n    }\n    ts.transformSystemModule = transformSystemModule;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transformES2015Module(context) {\n        var compilerOptions = context.getCompilerOptions();\n        var previousOnEmitNode = context.onEmitNode;\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        context.onEmitNode = onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        context.enableEmitNotification(261);\n        context.enableSubstitution(70);\n        var currentSourceFile;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {\n                var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions);\n                if (externalHelpersModuleName) {\n                    var statements = [];\n                    var statementOffset = ts.addPrologueDirectives(statements, node.statements);\n                    ts.append(statements, ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)));\n                    ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));\n                    return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));\n                }\n                else {\n                    return ts.visitEachChild(node, visitor, context);\n                }\n            }\n            return node;\n        }\n        function visitor(node) {\n            switch (node.kind) {\n                case 234:\n                    return undefined;\n                case 240:\n                    return visitExportAssignment(node);\n            }\n            return node;\n        }\n        function visitExportAssignment(node) {\n            return node.isExportEquals ? undefined : node;\n        }\n        function onEmitNode(emitContext, node, emitCallback) {\n            if (ts.isSourceFile(node)) {\n                currentSourceFile = node;\n                previousOnEmitNode(emitContext, node, emitCallback);\n                currentSourceFile = undefined;\n            }\n            else {\n                previousOnEmitNode(emitContext, node, emitCallback);\n            }\n        }\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (ts.isIdentifier(node) && emitContext === 1) {\n                return substituteExpressionIdentifier(node);\n            }\n            return node;\n        }\n        function substituteExpressionIdentifier(node) {\n            if (ts.getEmitFlags(node) & 4096) {\n                var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);\n                if (externalHelpersModuleName) {\n                    return ts.createPropertyAccess(externalHelpersModuleName, node);\n                }\n            }\n            return node;\n        }\n    }\n    ts.transformES2015Module = transformES2015Module;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var moduleTransformerMap = ts.createMap((_a = {},\n        _a[ts.ModuleKind.ES2015] = ts.transformES2015Module,\n        _a[ts.ModuleKind.System] = ts.transformSystemModule,\n        _a[ts.ModuleKind.AMD] = ts.transformModule,\n        _a[ts.ModuleKind.CommonJS] = ts.transformModule,\n        _a[ts.ModuleKind.UMD] = ts.transformModule,\n        _a[ts.ModuleKind.None] = ts.transformModule,\n        _a));\n    function getTransformers(compilerOptions) {\n        var jsx = compilerOptions.jsx;\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        var moduleKind = ts.getEmitModuleKind(compilerOptions);\n        var transformers = [];\n        transformers.push(ts.transformTypeScript);\n        if (jsx === 2) {\n            transformers.push(ts.transformJsx);\n        }\n        if (languageVersion < 5) {\n            transformers.push(ts.transformESNext);\n        }\n        if (languageVersion < 4) {\n            transformers.push(ts.transformES2017);\n        }\n        if (languageVersion < 3) {\n            transformers.push(ts.transformES2016);\n        }\n        if (languageVersion < 2) {\n            transformers.push(ts.transformES2015);\n            transformers.push(ts.transformGenerators);\n        }\n        transformers.push(moduleTransformerMap[moduleKind] || moduleTransformerMap[ts.ModuleKind.None]);\n        if (languageVersion < 1) {\n            transformers.push(ts.transformES5);\n        }\n        return transformers;\n    }\n    ts.getTransformers = getTransformers;\n    function transformFiles(resolver, host, sourceFiles, transformers) {\n        var enabledSyntaxKindFeatures = new Array(298);\n        var lexicalEnvironmentDisabled = false;\n        var lexicalEnvironmentVariableDeclarations;\n        var lexicalEnvironmentFunctionDeclarations;\n        var lexicalEnvironmentVariableDeclarationsStack = [];\n        var lexicalEnvironmentFunctionDeclarationsStack = [];\n        var lexicalEnvironmentStackOffset = 0;\n        var lexicalEnvironmentSuspended = false;\n        var emitHelpers;\n        var context = {\n            getCompilerOptions: function () { return host.getCompilerOptions(); },\n            getEmitResolver: function () { return resolver; },\n            getEmitHost: function () { return host; },\n            startLexicalEnvironment: startLexicalEnvironment,\n            suspendLexicalEnvironment: suspendLexicalEnvironment,\n            resumeLexicalEnvironment: resumeLexicalEnvironment,\n            endLexicalEnvironment: endLexicalEnvironment,\n            hoistVariableDeclaration: hoistVariableDeclaration,\n            hoistFunctionDeclaration: hoistFunctionDeclaration,\n            requestEmitHelper: requestEmitHelper,\n            readEmitHelpers: readEmitHelpers,\n            onSubstituteNode: function (_emitContext, node) { return node; },\n            enableSubstitution: enableSubstitution,\n            isSubstitutionEnabled: isSubstitutionEnabled,\n            onEmitNode: function (node, emitContext, emitCallback) { return emitCallback(node, emitContext); },\n            enableEmitNotification: enableEmitNotification,\n            isEmitNotificationEnabled: isEmitNotificationEnabled\n        };\n        var transformation = ts.chain.apply(void 0, transformers)(context);\n        var transformed = ts.map(sourceFiles, transformSourceFile);\n        lexicalEnvironmentDisabled = true;\n        return {\n            transformed: transformed,\n            emitNodeWithSubstitution: emitNodeWithSubstitution,\n            emitNodeWithNotification: emitNodeWithNotification\n        };\n        function transformSourceFile(sourceFile) {\n            if (ts.isDeclarationFile(sourceFile)) {\n                return sourceFile;\n            }\n            return transformation(sourceFile);\n        }\n        function enableSubstitution(kind) {\n            enabledSyntaxKindFeatures[kind] |= 1;\n        }\n        function isSubstitutionEnabled(node) {\n            return (enabledSyntaxKindFeatures[node.kind] & 1) !== 0\n                && (ts.getEmitFlags(node) & 4) === 0;\n        }\n        function emitNodeWithSubstitution(emitContext, node, emitCallback) {\n            if (node) {\n                if (isSubstitutionEnabled(node)) {\n                    var substitute = context.onSubstituteNode(emitContext, node);\n                    if (substitute && substitute !== node) {\n                        emitCallback(emitContext, substitute);\n                        return;\n                    }\n                }\n                emitCallback(emitContext, node);\n            }\n        }\n        function enableEmitNotification(kind) {\n            enabledSyntaxKindFeatures[kind] |= 2;\n        }\n        function isEmitNotificationEnabled(node) {\n            return (enabledSyntaxKindFeatures[node.kind] & 2) !== 0\n                || (ts.getEmitFlags(node) & 2) !== 0;\n        }\n        function emitNodeWithNotification(emitContext, node, emitCallback) {\n            if (node) {\n                if (isEmitNotificationEnabled(node)) {\n                    context.onEmitNode(emitContext, node, emitCallback);\n                }\n                else {\n                    emitCallback(emitContext, node);\n                }\n            }\n        }\n        function hoistVariableDeclaration(name) {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot modify the lexical environment during the print phase.\");\n            var decl = ts.createVariableDeclaration(name);\n            if (!lexicalEnvironmentVariableDeclarations) {\n                lexicalEnvironmentVariableDeclarations = [decl];\n            }\n            else {\n                lexicalEnvironmentVariableDeclarations.push(decl);\n            }\n        }\n        function hoistFunctionDeclaration(func) {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot modify the lexical environment during the print phase.\");\n            if (!lexicalEnvironmentFunctionDeclarations) {\n                lexicalEnvironmentFunctionDeclarations = [func];\n            }\n            else {\n                lexicalEnvironmentFunctionDeclarations.push(func);\n            }\n        }\n        function startLexicalEnvironment() {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot start a lexical environment during the print phase.\");\n            ts.Debug.assert(!lexicalEnvironmentSuspended, \"Lexical environment is suspended.\");\n            lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations;\n            lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations;\n            lexicalEnvironmentStackOffset++;\n            lexicalEnvironmentVariableDeclarations = undefined;\n            lexicalEnvironmentFunctionDeclarations = undefined;\n        }\n        function suspendLexicalEnvironment() {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot suspend a lexical environment during the print phase.\");\n            ts.Debug.assert(!lexicalEnvironmentSuspended, \"Lexical environment is already suspended.\");\n            lexicalEnvironmentSuspended = true;\n        }\n        function resumeLexicalEnvironment() {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot resume a lexical environment during the print phase.\");\n            ts.Debug.assert(lexicalEnvironmentSuspended, \"Lexical environment is not suspended.\");\n            lexicalEnvironmentSuspended = false;\n        }\n        function endLexicalEnvironment() {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot end a lexical environment during the print phase.\");\n            ts.Debug.assert(!lexicalEnvironmentSuspended, \"Lexical environment is suspended.\");\n            var statements;\n            if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) {\n                if (lexicalEnvironmentFunctionDeclarations) {\n                    statements = lexicalEnvironmentFunctionDeclarations.slice();\n                }\n                if (lexicalEnvironmentVariableDeclarations) {\n                    var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations));\n                    if (!statements) {\n                        statements = [statement];\n                    }\n                    else {\n                        statements.push(statement);\n                    }\n                }\n            }\n            lexicalEnvironmentStackOffset--;\n            lexicalEnvironmentVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset];\n            lexicalEnvironmentFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset];\n            if (lexicalEnvironmentStackOffset === 0) {\n                lexicalEnvironmentVariableDeclarationsStack = [];\n                lexicalEnvironmentFunctionDeclarationsStack = [];\n            }\n            return statements;\n        }\n        function requestEmitHelper(helper) {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot modify the lexical environment during the print phase.\");\n            ts.Debug.assert(!helper.scoped, \"Cannot request a scoped emit helper.\");\n            emitHelpers = ts.append(emitHelpers, helper);\n        }\n        function readEmitHelpers() {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot modify the lexical environment during the print phase.\");\n            var helpers = emitHelpers;\n            emitHelpers = undefined;\n            return helpers;\n        }\n    }\n    ts.transformFiles = transformFiles;\n    var _a;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function getDeclarationDiagnostics(host, resolver, targetSourceFile) {\n        var declarationDiagnostics = ts.createDiagnosticCollection();\n        ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile);\n        return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined);\n        function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) {\n            var declarationFilePath = _a.declarationFilePath;\n            emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit, false);\n        }\n    }\n    ts.getDeclarationDiagnostics = getDeclarationDiagnostics;\n    function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles) {\n        var newLine = host.getNewLine();\n        var compilerOptions = host.getCompilerOptions();\n        var write;\n        var writeLine;\n        var increaseIndent;\n        var decreaseIndent;\n        var writeTextOfNode;\n        var writer;\n        createAndSetNewTextWriterWithSymbolWriter();\n        var enclosingDeclaration;\n        var resultHasExternalModuleIndicator;\n        var currentText;\n        var currentLineMap;\n        var currentIdentifiers;\n        var isCurrentFileExternalModule;\n        var reportedDeclarationError = false;\n        var errorNameNode;\n        var emitJsDocComments = compilerOptions.removeComments ? ts.noop : writeJsDocComments;\n        var emit = compilerOptions.stripInternal ? stripInternal : emitNode;\n        var noDeclare;\n        var moduleElementDeclarationEmitInfo = [];\n        var asynchronousSubModuleDeclarationEmitInfo;\n        var referencesOutput = \"\";\n        var usedTypeDirectiveReferences;\n        var emittedReferencedFiles = [];\n        var addedGlobalFileReference = false;\n        var allSourcesModuleElementDeclarationEmitInfo = [];\n        ts.forEach(sourceFiles, function (sourceFile) {\n            if (ts.isSourceFileJavaScript(sourceFile)) {\n                return;\n            }\n            if (!compilerOptions.noResolve) {\n                ts.forEach(sourceFile.referencedFiles, function (fileReference) {\n                    var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference);\n                    if (referencedFile && !ts.contains(emittedReferencedFiles, referencedFile)) {\n                        if (writeReferencePath(referencedFile, !isBundledEmit && !addedGlobalFileReference, emitOnlyDtsFiles)) {\n                            addedGlobalFileReference = true;\n                        }\n                        emittedReferencedFiles.push(referencedFile);\n                    }\n                });\n            }\n            resultHasExternalModuleIndicator = false;\n            if (!isBundledEmit || !ts.isExternalModule(sourceFile)) {\n                noDeclare = false;\n                emitSourceFile(sourceFile);\n            }\n            else if (ts.isExternalModule(sourceFile)) {\n                noDeclare = true;\n                write(\"declare module \\\"\" + ts.getResolvedExternalModuleName(host, sourceFile) + \"\\\" {\");\n                writeLine();\n                increaseIndent();\n                emitSourceFile(sourceFile);\n                decreaseIndent();\n                write(\"}\");\n                writeLine();\n            }\n            if (moduleElementDeclarationEmitInfo.length) {\n                var oldWriter = writer;\n                ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) {\n                    if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) {\n                        ts.Debug.assert(aliasEmitInfo.node.kind === 235);\n                        createAndSetNewTextWriterWithSymbolWriter();\n                        ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit));\n                        for (var i = 0; i < aliasEmitInfo.indent; i++) {\n                            increaseIndent();\n                        }\n                        writeImportDeclaration(aliasEmitInfo.node);\n                        aliasEmitInfo.asynchronousOutput = writer.getText();\n                        for (var i = 0; i < aliasEmitInfo.indent; i++) {\n                            decreaseIndent();\n                        }\n                    }\n                });\n                setWriter(oldWriter);\n                allSourcesModuleElementDeclarationEmitInfo = allSourcesModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo);\n                moduleElementDeclarationEmitInfo = [];\n            }\n            if (!isBundledEmit && ts.isExternalModule(sourceFile) && sourceFile.moduleAugmentations.length && !resultHasExternalModuleIndicator) {\n                write(\"export {};\");\n                writeLine();\n            }\n        });\n        if (usedTypeDirectiveReferences) {\n            for (var directive in usedTypeDirectiveReferences) {\n                referencesOutput += \"/// <reference types=\\\"\" + directive + \"\\\" />\" + newLine;\n            }\n        }\n        return {\n            reportedDeclarationError: reportedDeclarationError,\n            moduleElementDeclarationEmitInfo: allSourcesModuleElementDeclarationEmitInfo,\n            synchronousDeclarationOutput: writer.getText(),\n            referencesOutput: referencesOutput,\n        };\n        function hasInternalAnnotation(range) {\n            var comment = currentText.substring(range.pos, range.end);\n            return comment.indexOf(\"@internal\") >= 0;\n        }\n        function stripInternal(node) {\n            if (node) {\n                var leadingCommentRanges = ts.getLeadingCommentRanges(currentText, node.pos);\n                if (ts.forEach(leadingCommentRanges, hasInternalAnnotation)) {\n                    return;\n                }\n                emitNode(node);\n            }\n        }\n        function createAndSetNewTextWriterWithSymbolWriter() {\n            var writer = ts.createTextWriter(newLine);\n            writer.trackSymbol = trackSymbol;\n            writer.reportInaccessibleThisError = reportInaccessibleThisError;\n            writer.writeKeyword = writer.write;\n            writer.writeOperator = writer.write;\n            writer.writePunctuation = writer.write;\n            writer.writeSpace = writer.write;\n            writer.writeStringLiteral = writer.writeLiteral;\n            writer.writeParameter = writer.write;\n            writer.writeSymbol = writer.write;\n            setWriter(writer);\n        }\n        function setWriter(newWriter) {\n            writer = newWriter;\n            write = newWriter.write;\n            writeTextOfNode = newWriter.writeTextOfNode;\n            writeLine = newWriter.writeLine;\n            increaseIndent = newWriter.increaseIndent;\n            decreaseIndent = newWriter.decreaseIndent;\n        }\n        function writeAsynchronousModuleElements(nodes) {\n            var oldWriter = writer;\n            ts.forEach(nodes, function (declaration) {\n                var nodeToCheck;\n                if (declaration.kind === 223) {\n                    nodeToCheck = declaration.parent.parent;\n                }\n                else if (declaration.kind === 238 || declaration.kind === 239 || declaration.kind === 236) {\n                    ts.Debug.fail(\"We should be getting ImportDeclaration instead to write\");\n                }\n                else {\n                    nodeToCheck = declaration;\n                }\n                var moduleElementEmitInfo = ts.forEach(moduleElementDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; });\n                if (!moduleElementEmitInfo && asynchronousSubModuleDeclarationEmitInfo) {\n                    moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; });\n                }\n                if (moduleElementEmitInfo) {\n                    if (moduleElementEmitInfo.node.kind === 235) {\n                        moduleElementEmitInfo.isVisible = true;\n                    }\n                    else {\n                        createAndSetNewTextWriterWithSymbolWriter();\n                        for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) {\n                            increaseIndent();\n                        }\n                        if (nodeToCheck.kind === 230) {\n                            ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined);\n                            asynchronousSubModuleDeclarationEmitInfo = [];\n                        }\n                        writeModuleElement(nodeToCheck);\n                        if (nodeToCheck.kind === 230) {\n                            moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo;\n                            asynchronousSubModuleDeclarationEmitInfo = undefined;\n                        }\n                        moduleElementEmitInfo.asynchronousOutput = writer.getText();\n                    }\n                }\n            });\n            setWriter(oldWriter);\n        }\n        function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) {\n            if (!typeReferenceDirectives) {\n                return;\n            }\n            if (!usedTypeDirectiveReferences) {\n                usedTypeDirectiveReferences = ts.createMap();\n            }\n            for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) {\n                var directive = typeReferenceDirectives_1[_i];\n                if (!(directive in usedTypeDirectiveReferences)) {\n                    usedTypeDirectiveReferences[directive] = directive;\n                }\n            }\n        }\n        function handleSymbolAccessibilityError(symbolAccessibilityResult) {\n            if (symbolAccessibilityResult.accessibility === 0) {\n                if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) {\n                    writeAsynchronousModuleElements(symbolAccessibilityResult.aliasesToMakeVisible);\n                }\n            }\n            else {\n                reportedDeclarationError = true;\n                var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccessibilityResult);\n                if (errorInfo) {\n                    if (errorInfo.typeName) {\n                        emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName));\n                    }\n                    else {\n                        emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName));\n                    }\n                }\n            }\n        }\n        function trackSymbol(symbol, enclosingDeclaration, meaning) {\n            handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, true));\n            recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning));\n        }\n        function reportInaccessibleThisError() {\n            if (errorNameNode) {\n                reportedDeclarationError = true;\n                emitterDiagnostics.add(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode)));\n            }\n        }\n        function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) {\n            writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic;\n            write(\": \");\n            if (type) {\n                emitType(type);\n            }\n            else {\n                errorNameNode = declaration.name;\n                resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 | 1024, writer);\n                errorNameNode = undefined;\n            }\n        }\n        function writeReturnTypeAtSignature(signature, getSymbolAccessibilityDiagnostic) {\n            writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic;\n            write(\": \");\n            if (signature.type) {\n                emitType(signature.type);\n            }\n            else {\n                errorNameNode = signature.name;\n                resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 | 1024, writer);\n                errorNameNode = undefined;\n            }\n        }\n        function emitLines(nodes) {\n            for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {\n                var node = nodes_4[_i];\n                emit(node);\n            }\n        }\n        function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) {\n            var currentWriterPos = writer.getTextPos();\n            for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) {\n                var node = nodes_5[_i];\n                if (!canEmitFn || canEmitFn(node)) {\n                    if (currentWriterPos !== writer.getTextPos()) {\n                        write(separator);\n                    }\n                    currentWriterPos = writer.getTextPos();\n                    eachNodeEmitFn(node);\n                }\n            }\n        }\n        function emitCommaList(nodes, eachNodeEmitFn, canEmitFn) {\n            emitSeparatedList(nodes, \", \", eachNodeEmitFn, canEmitFn);\n        }\n        function writeJsDocComments(declaration) {\n            if (declaration) {\n                var jsDocComments = ts.getJSDocCommentRanges(declaration, currentText);\n                ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments);\n                ts.emitComments(currentText, currentLineMap, writer, jsDocComments, false, true, newLine, ts.writeCommentRange);\n            }\n        }\n        function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type, getSymbolAccessibilityDiagnostic) {\n            writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic;\n            emitType(type);\n        }\n        function emitType(type) {\n            switch (type.kind) {\n                case 118:\n                case 134:\n                case 132:\n                case 121:\n                case 135:\n                case 104:\n                case 137:\n                case 94:\n                case 129:\n                case 167:\n                case 171:\n                    return writeTextOfNode(currentText, type);\n                case 199:\n                    return emitExpressionWithTypeArguments(type);\n                case 157:\n                    return emitTypeReference(type);\n                case 160:\n                    return emitTypeQuery(type);\n                case 162:\n                    return emitArrayType(type);\n                case 163:\n                    return emitTupleType(type);\n                case 164:\n                    return emitUnionType(type);\n                case 165:\n                    return emitIntersectionType(type);\n                case 166:\n                    return emitParenType(type);\n                case 168:\n                    return emitTypeOperator(type);\n                case 169:\n                    return emitIndexedAccessType(type);\n                case 170:\n                    return emitMappedType(type);\n                case 158:\n                case 159:\n                    return emitSignatureDeclarationWithJsDocComments(type);\n                case 161:\n                    return emitTypeLiteral(type);\n                case 70:\n                    return emitEntityName(type);\n                case 141:\n                    return emitEntityName(type);\n                case 156:\n                    return emitTypePredicate(type);\n            }\n            function writeEntityName(entityName) {\n                if (entityName.kind === 70) {\n                    writeTextOfNode(currentText, entityName);\n                }\n                else {\n                    var left = entityName.kind === 141 ? entityName.left : entityName.expression;\n                    var right = entityName.kind === 141 ? entityName.right : entityName.name;\n                    writeEntityName(left);\n                    write(\".\");\n                    writeTextOfNode(currentText, right);\n                }\n            }\n            function emitEntityName(entityName) {\n                var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 234 ? entityName.parent : enclosingDeclaration);\n                handleSymbolAccessibilityError(visibilityResult);\n                recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName));\n                writeEntityName(entityName);\n            }\n            function emitExpressionWithTypeArguments(node) {\n                if (ts.isEntityNameExpression(node.expression)) {\n                    ts.Debug.assert(node.expression.kind === 70 || node.expression.kind === 177);\n                    emitEntityName(node.expression);\n                    if (node.typeArguments) {\n                        write(\"<\");\n                        emitCommaList(node.typeArguments, emitType);\n                        write(\">\");\n                    }\n                }\n            }\n            function emitTypeReference(type) {\n                emitEntityName(type.typeName);\n                if (type.typeArguments) {\n                    write(\"<\");\n                    emitCommaList(type.typeArguments, emitType);\n                    write(\">\");\n                }\n            }\n            function emitTypePredicate(type) {\n                writeTextOfNode(currentText, type.parameterName);\n                write(\" is \");\n                emitType(type.type);\n            }\n            function emitTypeQuery(type) {\n                write(\"typeof \");\n                emitEntityName(type.exprName);\n            }\n            function emitArrayType(type) {\n                emitType(type.elementType);\n                write(\"[]\");\n            }\n            function emitTupleType(type) {\n                write(\"[\");\n                emitCommaList(type.elementTypes, emitType);\n                write(\"]\");\n            }\n            function emitUnionType(type) {\n                emitSeparatedList(type.types, \" | \", emitType);\n            }\n            function emitIntersectionType(type) {\n                emitSeparatedList(type.types, \" & \", emitType);\n            }\n            function emitParenType(type) {\n                write(\"(\");\n                emitType(type.type);\n                write(\")\");\n            }\n            function emitTypeOperator(type) {\n                write(ts.tokenToString(type.operator));\n                write(\" \");\n                emitType(type.type);\n            }\n            function emitIndexedAccessType(node) {\n                emitType(node.objectType);\n                write(\"[\");\n                emitType(node.indexType);\n                write(\"]\");\n            }\n            function emitMappedType(node) {\n                var prevEnclosingDeclaration = enclosingDeclaration;\n                enclosingDeclaration = node;\n                write(\"{\");\n                writeLine();\n                increaseIndent();\n                if (node.readonlyToken) {\n                    write(\"readonly \");\n                }\n                write(\"[\");\n                writeEntityName(node.typeParameter.name);\n                write(\" in \");\n                emitType(node.typeParameter.constraint);\n                write(\"]\");\n                if (node.questionToken) {\n                    write(\"?\");\n                }\n                write(\": \");\n                emitType(node.type);\n                write(\";\");\n                writeLine();\n                decreaseIndent();\n                write(\"}\");\n                enclosingDeclaration = prevEnclosingDeclaration;\n            }\n            function emitTypeLiteral(type) {\n                write(\"{\");\n                if (type.members.length) {\n                    writeLine();\n                    increaseIndent();\n                    emitLines(type.members);\n                    decreaseIndent();\n                }\n                write(\"}\");\n            }\n        }\n        function emitSourceFile(node) {\n            currentText = node.text;\n            currentLineMap = ts.getLineStarts(node);\n            currentIdentifiers = node.identifiers;\n            isCurrentFileExternalModule = ts.isExternalModule(node);\n            enclosingDeclaration = node;\n            ts.emitDetachedComments(currentText, currentLineMap, writer, ts.writeCommentRange, node, newLine, true);\n            emitLines(node.statements);\n        }\n        function getExportDefaultTempVariableName() {\n            var baseName = \"_default\";\n            if (!(baseName in currentIdentifiers)) {\n                return baseName;\n            }\n            var count = 0;\n            while (true) {\n                count++;\n                var name_41 = baseName + \"_\" + count;\n                if (!(name_41 in currentIdentifiers)) {\n                    return name_41;\n                }\n            }\n        }\n        function emitExportAssignment(node) {\n            if (node.expression.kind === 70) {\n                write(node.isExportEquals ? \"export = \" : \"export default \");\n                writeTextOfNode(currentText, node.expression);\n            }\n            else {\n                var tempVarName = getExportDefaultTempVariableName();\n                if (!noDeclare) {\n                    write(\"declare \");\n                }\n                write(\"var \");\n                write(tempVarName);\n                write(\": \");\n                writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;\n                resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 | 1024, writer);\n                write(\";\");\n                writeLine();\n                write(node.isExportEquals ? \"export = \" : \"export default \");\n                write(tempVarName);\n            }\n            write(\";\");\n            writeLine();\n            if (node.expression.kind === 70) {\n                var nodes = resolver.collectLinkedAliases(node.expression);\n                writeAsynchronousModuleElements(nodes);\n            }\n            function getDefaultExportAccessibilityDiagnostic() {\n                return {\n                    diagnosticMessage: ts.Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0,\n                    errorNode: node\n                };\n            }\n        }\n        function isModuleElementVisible(node) {\n            return resolver.isDeclarationVisible(node);\n        }\n        function emitModuleElement(node, isModuleElementVisible) {\n            if (isModuleElementVisible) {\n                writeModuleElement(node);\n            }\n            else if (node.kind === 234 ||\n                (node.parent.kind === 261 && isCurrentFileExternalModule)) {\n                var isVisible = void 0;\n                if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 261) {\n                    asynchronousSubModuleDeclarationEmitInfo.push({\n                        node: node,\n                        outputPos: writer.getTextPos(),\n                        indent: writer.getIndent(),\n                        isVisible: isVisible\n                    });\n                }\n                else {\n                    if (node.kind === 235) {\n                        var importDeclaration = node;\n                        if (importDeclaration.importClause) {\n                            isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) ||\n                                isVisibleNamedBinding(importDeclaration.importClause.namedBindings);\n                        }\n                    }\n                    moduleElementDeclarationEmitInfo.push({\n                        node: node,\n                        outputPos: writer.getTextPos(),\n                        indent: writer.getIndent(),\n                        isVisible: isVisible\n                    });\n                }\n            }\n        }\n        function writeModuleElement(node) {\n            switch (node.kind) {\n                case 225:\n                    return writeFunctionDeclaration(node);\n                case 205:\n                    return writeVariableStatement(node);\n                case 227:\n                    return writeInterfaceDeclaration(node);\n                case 226:\n                    return writeClassDeclaration(node);\n                case 228:\n                    return writeTypeAliasDeclaration(node);\n                case 229:\n                    return writeEnumDeclaration(node);\n                case 230:\n                    return writeModuleDeclaration(node);\n                case 234:\n                    return writeImportEqualsDeclaration(node);\n                case 235:\n                    return writeImportDeclaration(node);\n                default:\n                    ts.Debug.fail(\"Unknown symbol kind\");\n            }\n        }\n        function emitModuleElementDeclarationFlags(node) {\n            if (node.parent.kind === 261) {\n                var modifiers = ts.getModifierFlags(node);\n                if (modifiers & 1) {\n                    write(\"export \");\n                }\n                if (modifiers & 512) {\n                    write(\"default \");\n                }\n                else if (node.kind !== 227 && !noDeclare) {\n                    write(\"declare \");\n                }\n            }\n        }\n        function emitClassMemberDeclarationFlags(flags) {\n            if (flags & 8) {\n                write(\"private \");\n            }\n            else if (flags & 16) {\n                write(\"protected \");\n            }\n            if (flags & 32) {\n                write(\"static \");\n            }\n            if (flags & 64) {\n                write(\"readonly \");\n            }\n            if (flags & 128) {\n                write(\"abstract \");\n            }\n        }\n        function writeImportEqualsDeclaration(node) {\n            emitJsDocComments(node);\n            if (ts.hasModifier(node, 1)) {\n                write(\"export \");\n            }\n            write(\"import \");\n            writeTextOfNode(currentText, node.name);\n            write(\" = \");\n            if (ts.isInternalModuleImportEqualsDeclaration(node)) {\n                emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.moduleReference, getImportEntityNameVisibilityError);\n                write(\";\");\n            }\n            else {\n                write(\"require(\");\n                emitExternalModuleSpecifier(node);\n                write(\");\");\n            }\n            writer.writeLine();\n            function getImportEntityNameVisibilityError() {\n                return {\n                    diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1,\n                    errorNode: node,\n                    typeName: node.name\n                };\n            }\n        }\n        function isVisibleNamedBinding(namedBindings) {\n            if (namedBindings) {\n                if (namedBindings.kind === 237) {\n                    return resolver.isDeclarationVisible(namedBindings);\n                }\n                else {\n                    return ts.forEach(namedBindings.elements, function (namedImport) { return resolver.isDeclarationVisible(namedImport); });\n                }\n            }\n        }\n        function writeImportDeclaration(node) {\n            emitJsDocComments(node);\n            if (ts.hasModifier(node, 1)) {\n                write(\"export \");\n            }\n            write(\"import \");\n            if (node.importClause) {\n                var currentWriterPos = writer.getTextPos();\n                if (node.importClause.name && resolver.isDeclarationVisible(node.importClause)) {\n                    writeTextOfNode(currentText, node.importClause.name);\n                }\n                if (node.importClause.namedBindings && isVisibleNamedBinding(node.importClause.namedBindings)) {\n                    if (currentWriterPos !== writer.getTextPos()) {\n                        write(\", \");\n                    }\n                    if (node.importClause.namedBindings.kind === 237) {\n                        write(\"* as \");\n                        writeTextOfNode(currentText, node.importClause.namedBindings.name);\n                    }\n                    else {\n                        write(\"{ \");\n                        emitCommaList(node.importClause.namedBindings.elements, emitImportOrExportSpecifier, resolver.isDeclarationVisible);\n                        write(\" }\");\n                    }\n                }\n                write(\" from \");\n            }\n            emitExternalModuleSpecifier(node);\n            write(\";\");\n            writer.writeLine();\n        }\n        function emitExternalModuleSpecifier(parent) {\n            resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 230;\n            var moduleSpecifier;\n            if (parent.kind === 234) {\n                var node = parent;\n                moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node);\n            }\n            else if (parent.kind === 230) {\n                moduleSpecifier = parent.name;\n            }\n            else {\n                var node = parent;\n                moduleSpecifier = node.moduleSpecifier;\n            }\n            if (moduleSpecifier.kind === 9 && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) {\n                var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, parent);\n                if (moduleName) {\n                    write('\"');\n                    write(moduleName);\n                    write('\"');\n                    return;\n                }\n            }\n            writeTextOfNode(currentText, moduleSpecifier);\n        }\n        function emitImportOrExportSpecifier(node) {\n            if (node.propertyName) {\n                writeTextOfNode(currentText, node.propertyName);\n                write(\" as \");\n            }\n            writeTextOfNode(currentText, node.name);\n        }\n        function emitExportSpecifier(node) {\n            emitImportOrExportSpecifier(node);\n            var nodes = resolver.collectLinkedAliases(node.propertyName || node.name);\n            writeAsynchronousModuleElements(nodes);\n        }\n        function emitExportDeclaration(node) {\n            emitJsDocComments(node);\n            write(\"export \");\n            if (node.exportClause) {\n                write(\"{ \");\n                emitCommaList(node.exportClause.elements, emitExportSpecifier);\n                write(\" }\");\n            }\n            else {\n                write(\"*\");\n            }\n            if (node.moduleSpecifier) {\n                write(\" from \");\n                emitExternalModuleSpecifier(node);\n            }\n            write(\";\");\n            writer.writeLine();\n        }\n        function writeModuleDeclaration(node) {\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            if (ts.isGlobalScopeAugmentation(node)) {\n                write(\"global \");\n            }\n            else {\n                if (node.flags & 16) {\n                    write(\"namespace \");\n                }\n                else {\n                    write(\"module \");\n                }\n                if (ts.isExternalModuleAugmentation(node)) {\n                    emitExternalModuleSpecifier(node);\n                }\n                else {\n                    writeTextOfNode(currentText, node.name);\n                }\n            }\n            while (node.body && node.body.kind !== 231) {\n                node = node.body;\n                write(\".\");\n                writeTextOfNode(currentText, node.name);\n            }\n            var prevEnclosingDeclaration = enclosingDeclaration;\n            if (node.body) {\n                enclosingDeclaration = node;\n                write(\" {\");\n                writeLine();\n                increaseIndent();\n                emitLines(node.body.statements);\n                decreaseIndent();\n                write(\"}\");\n                writeLine();\n                enclosingDeclaration = prevEnclosingDeclaration;\n            }\n            else {\n                write(\";\");\n            }\n        }\n        function writeTypeAliasDeclaration(node) {\n            var prevEnclosingDeclaration = enclosingDeclaration;\n            enclosingDeclaration = node;\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            write(\"type \");\n            writeTextOfNode(currentText, node.name);\n            emitTypeParameters(node.typeParameters);\n            write(\" = \");\n            emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError);\n            write(\";\");\n            writeLine();\n            enclosingDeclaration = prevEnclosingDeclaration;\n            function getTypeAliasDeclarationVisibilityError() {\n                return {\n                    diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1,\n                    errorNode: node.type,\n                    typeName: node.name\n                };\n            }\n        }\n        function writeEnumDeclaration(node) {\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            if (ts.isConst(node)) {\n                write(\"const \");\n            }\n            write(\"enum \");\n            writeTextOfNode(currentText, node.name);\n            write(\" {\");\n            writeLine();\n            increaseIndent();\n            emitLines(node.members);\n            decreaseIndent();\n            write(\"}\");\n            writeLine();\n        }\n        function emitEnumMemberDeclaration(node) {\n            emitJsDocComments(node);\n            writeTextOfNode(currentText, node.name);\n            var enumMemberValue = resolver.getConstantValue(node);\n            if (enumMemberValue !== undefined) {\n                write(\" = \");\n                write(enumMemberValue.toString());\n            }\n            write(\",\");\n            writeLine();\n        }\n        function isPrivateMethodTypeParameter(node) {\n            return node.parent.kind === 149 && ts.hasModifier(node.parent, 8);\n        }\n        function emitTypeParameters(typeParameters) {\n            function emitTypeParameter(node) {\n                increaseIndent();\n                emitJsDocComments(node);\n                decreaseIndent();\n                writeTextOfNode(currentText, node.name);\n                if (node.constraint && !isPrivateMethodTypeParameter(node)) {\n                    write(\" extends \");\n                    if (node.parent.kind === 158 ||\n                        node.parent.kind === 159 ||\n                        (node.parent.parent && node.parent.parent.kind === 161)) {\n                        ts.Debug.assert(node.parent.kind === 149 ||\n                            node.parent.kind === 148 ||\n                            node.parent.kind === 158 ||\n                            node.parent.kind === 159 ||\n                            node.parent.kind === 153 ||\n                            node.parent.kind === 154);\n                        emitType(node.constraint);\n                    }\n                    else {\n                        emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError);\n                    }\n                }\n                function getTypeParameterConstraintVisibilityError() {\n                    var diagnosticMessage;\n                    switch (node.parent.kind) {\n                        case 226:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1;\n                            break;\n                        case 227:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;\n                            break;\n                        case 154:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;\n                            break;\n                        case 153:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;\n                            break;\n                        case 149:\n                        case 148:\n                            if (ts.hasModifier(node.parent, 32)) {\n                                diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;\n                            }\n                            else if (node.parent.parent.kind === 226) {\n                                diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;\n                            }\n                            else {\n                                diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;\n                            }\n                            break;\n                        case 225:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;\n                            break;\n                        case 228:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;\n                            break;\n                        default:\n                            ts.Debug.fail(\"This is unknown parent for type parameter: \" + node.parent.kind);\n                    }\n                    return {\n                        diagnosticMessage: diagnosticMessage,\n                        errorNode: node,\n                        typeName: node.name\n                    };\n                }\n            }\n            if (typeParameters) {\n                write(\"<\");\n                emitCommaList(typeParameters, emitTypeParameter);\n                write(\">\");\n            }\n        }\n        function emitHeritageClause(typeReferences, isImplementsList) {\n            if (typeReferences) {\n                write(isImplementsList ? \" implements \" : \" extends \");\n                emitCommaList(typeReferences, emitTypeOfTypeReference);\n            }\n            function emitTypeOfTypeReference(node) {\n                if (ts.isEntityNameExpression(node.expression)) {\n                    emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError);\n                }\n                else if (!isImplementsList && node.expression.kind === 94) {\n                    write(\"null\");\n                }\n                else {\n                    writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError;\n                    resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 | 1024, writer);\n                }\n                function getHeritageClauseVisibilityError() {\n                    var diagnosticMessage;\n                    if (node.parent.parent.kind === 226) {\n                        diagnosticMessage = isImplementsList ?\n                            ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :\n                            ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1;\n                    }\n                    else {\n                        diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1;\n                    }\n                    return {\n                        diagnosticMessage: diagnosticMessage,\n                        errorNode: node,\n                        typeName: node.parent.parent.name\n                    };\n                }\n            }\n        }\n        function writeClassDeclaration(node) {\n            function emitParameterProperties(constructorDeclaration) {\n                if (constructorDeclaration) {\n                    ts.forEach(constructorDeclaration.parameters, function (param) {\n                        if (ts.hasModifier(param, 92)) {\n                            emitPropertyDeclaration(param);\n                        }\n                    });\n                }\n            }\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            if (ts.hasModifier(node, 128)) {\n                write(\"abstract \");\n            }\n            write(\"class \");\n            writeTextOfNode(currentText, node.name);\n            var prevEnclosingDeclaration = enclosingDeclaration;\n            enclosingDeclaration = node;\n            emitTypeParameters(node.typeParameters);\n            var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node);\n            if (baseTypeNode) {\n                emitHeritageClause([baseTypeNode], false);\n            }\n            emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), true);\n            write(\" {\");\n            writeLine();\n            increaseIndent();\n            emitParameterProperties(ts.getFirstConstructorWithBody(node));\n            emitLines(node.members);\n            decreaseIndent();\n            write(\"}\");\n            writeLine();\n            enclosingDeclaration = prevEnclosingDeclaration;\n        }\n        function writeInterfaceDeclaration(node) {\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            write(\"interface \");\n            writeTextOfNode(currentText, node.name);\n            var prevEnclosingDeclaration = enclosingDeclaration;\n            enclosingDeclaration = node;\n            emitTypeParameters(node.typeParameters);\n            var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); });\n            if (interfaceExtendsTypes && interfaceExtendsTypes.length) {\n                emitHeritageClause(interfaceExtendsTypes, false);\n            }\n            write(\" {\");\n            writeLine();\n            increaseIndent();\n            emitLines(node.members);\n            decreaseIndent();\n            write(\"}\");\n            writeLine();\n            enclosingDeclaration = prevEnclosingDeclaration;\n        }\n        function emitPropertyDeclaration(node) {\n            if (ts.hasDynamicName(node)) {\n                return;\n            }\n            emitJsDocComments(node);\n            emitClassMemberDeclarationFlags(ts.getModifierFlags(node));\n            emitVariableDeclaration(node);\n            write(\";\");\n            writeLine();\n        }\n        function emitVariableDeclaration(node) {\n            if (node.kind !== 223 || resolver.isDeclarationVisible(node)) {\n                if (ts.isBindingPattern(node.name)) {\n                    emitBindingPattern(node.name);\n                }\n                else {\n                    writeTextOfNode(currentText, node.name);\n                    if ((node.kind === 147 || node.kind === 146 ||\n                        (node.kind === 144 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) {\n                        write(\"?\");\n                    }\n                    if ((node.kind === 147 || node.kind === 146) && node.parent.kind === 161) {\n                        emitTypeOfVariableDeclarationFromTypeLiteral(node);\n                    }\n                    else if (resolver.isLiteralConstDeclaration(node)) {\n                        write(\" = \");\n                        resolver.writeLiteralConstValue(node, writer);\n                    }\n                    else if (!ts.hasModifier(node, 8)) {\n                        writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError);\n                    }\n                }\n            }\n            function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {\n                if (node.kind === 223) {\n                    return symbolAccessibilityResult.errorModuleName ?\n                        symbolAccessibilityResult.accessibility === 2 ?\n                            ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                            ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 :\n                        ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;\n                }\n                else if (node.kind === 147 || node.kind === 146) {\n                    if (ts.hasModifier(node, 32)) {\n                        return symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 ?\n                                ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;\n                    }\n                    else if (node.parent.kind === 226) {\n                        return symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 ?\n                                ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1;\n                    }\n                    else {\n                        return symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1;\n                    }\n                }\n            }\n            function getVariableDeclarationTypeVisibilityError(symbolAccessibilityResult) {\n                var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);\n                return diagnosticMessage !== undefined ? {\n                    diagnosticMessage: diagnosticMessage,\n                    errorNode: node,\n                    typeName: node.name\n                } : undefined;\n            }\n            function emitBindingPattern(bindingPattern) {\n                var elements = [];\n                for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (element.kind !== 198) {\n                        elements.push(element);\n                    }\n                }\n                emitCommaList(elements, emitBindingElement);\n            }\n            function emitBindingElement(bindingElement) {\n                function getBindingElementTypeVisibilityError(symbolAccessibilityResult) {\n                    var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);\n                    return diagnosticMessage !== undefined ? {\n                        diagnosticMessage: diagnosticMessage,\n                        errorNode: bindingElement,\n                        typeName: bindingElement.name\n                    } : undefined;\n                }\n                if (bindingElement.name) {\n                    if (ts.isBindingPattern(bindingElement.name)) {\n                        emitBindingPattern(bindingElement.name);\n                    }\n                    else {\n                        writeTextOfNode(currentText, bindingElement.name);\n                        writeTypeOfDeclaration(bindingElement, undefined, getBindingElementTypeVisibilityError);\n                    }\n                }\n            }\n        }\n        function emitTypeOfVariableDeclarationFromTypeLiteral(node) {\n            if (node.type) {\n                write(\": \");\n                emitType(node.type);\n            }\n        }\n        function isVariableStatementVisible(node) {\n            return ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); });\n        }\n        function writeVariableStatement(node) {\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            if (ts.isLet(node.declarationList)) {\n                write(\"let \");\n            }\n            else if (ts.isConst(node.declarationList)) {\n                write(\"const \");\n            }\n            else {\n                write(\"var \");\n            }\n            emitCommaList(node.declarationList.declarations, emitVariableDeclaration, resolver.isDeclarationVisible);\n            write(\";\");\n            writeLine();\n        }\n        function emitAccessorDeclaration(node) {\n            if (ts.hasDynamicName(node)) {\n                return;\n            }\n            var accessors = ts.getAllAccessorDeclarations(node.parent.members, node);\n            var accessorWithTypeAnnotation;\n            if (node === accessors.firstAccessor) {\n                emitJsDocComments(accessors.getAccessor);\n                emitJsDocComments(accessors.setAccessor);\n                emitClassMemberDeclarationFlags(ts.getModifierFlags(node) | (accessors.setAccessor ? 0 : 64));\n                writeTextOfNode(currentText, node.name);\n                if (!ts.hasModifier(node, 8)) {\n                    accessorWithTypeAnnotation = node;\n                    var type = getTypeAnnotationFromAccessor(node);\n                    if (!type) {\n                        var anotherAccessor = node.kind === 151 ? accessors.setAccessor : accessors.getAccessor;\n                        type = getTypeAnnotationFromAccessor(anotherAccessor);\n                        if (type) {\n                            accessorWithTypeAnnotation = anotherAccessor;\n                        }\n                    }\n                    writeTypeOfDeclaration(node, type, getAccessorDeclarationTypeVisibilityError);\n                }\n                write(\";\");\n                writeLine();\n            }\n            function getTypeAnnotationFromAccessor(accessor) {\n                if (accessor) {\n                    return accessor.kind === 151\n                        ? accessor.type\n                        : accessor.parameters.length > 0\n                            ? accessor.parameters[0].type\n                            : undefined;\n                }\n            }\n            function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) {\n                var diagnosticMessage;\n                if (accessorWithTypeAnnotation.kind === 152) {\n                    if (ts.hasModifier(accessorWithTypeAnnotation.parent, 32)) {\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1;\n                    }\n                    else {\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1;\n                    }\n                    return {\n                        diagnosticMessage: diagnosticMessage,\n                        errorNode: accessorWithTypeAnnotation.parameters[0],\n                        typeName: accessorWithTypeAnnotation.name\n                    };\n                }\n                else {\n                    if (ts.hasModifier(accessorWithTypeAnnotation, 32)) {\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 ?\n                                ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :\n                                ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0;\n                    }\n                    else {\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 ?\n                                ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :\n                                ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0;\n                    }\n                    return {\n                        diagnosticMessage: diagnosticMessage,\n                        errorNode: accessorWithTypeAnnotation.name,\n                        typeName: undefined\n                    };\n                }\n            }\n        }\n        function writeFunctionDeclaration(node) {\n            if (ts.hasDynamicName(node)) {\n                return;\n            }\n            if (!resolver.isImplementationOfOverload(node)) {\n                emitJsDocComments(node);\n                if (node.kind === 225) {\n                    emitModuleElementDeclarationFlags(node);\n                }\n                else if (node.kind === 149 || node.kind === 150) {\n                    emitClassMemberDeclarationFlags(ts.getModifierFlags(node));\n                }\n                if (node.kind === 225) {\n                    write(\"function \");\n                    writeTextOfNode(currentText, node.name);\n                }\n                else if (node.kind === 150) {\n                    write(\"constructor\");\n                }\n                else {\n                    writeTextOfNode(currentText, node.name);\n                    if (ts.hasQuestionToken(node)) {\n                        write(\"?\");\n                    }\n                }\n                emitSignatureDeclaration(node);\n            }\n        }\n        function emitSignatureDeclarationWithJsDocComments(node) {\n            emitJsDocComments(node);\n            emitSignatureDeclaration(node);\n        }\n        function emitSignatureDeclaration(node) {\n            var prevEnclosingDeclaration = enclosingDeclaration;\n            enclosingDeclaration = node;\n            var closeParenthesizedFunctionType = false;\n            if (node.kind === 155) {\n                emitClassMemberDeclarationFlags(ts.getModifierFlags(node));\n                write(\"[\");\n            }\n            else {\n                if (node.kind === 154 || node.kind === 159) {\n                    write(\"new \");\n                }\n                else if (node.kind === 158) {\n                    var currentOutput = writer.getText();\n                    if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === \"<\") {\n                        closeParenthesizedFunctionType = true;\n                        write(\"(\");\n                    }\n                }\n                emitTypeParameters(node.typeParameters);\n                write(\"(\");\n            }\n            emitCommaList(node.parameters, emitParameterDeclaration);\n            if (node.kind === 155) {\n                write(\"]\");\n            }\n            else {\n                write(\")\");\n            }\n            var isFunctionTypeOrConstructorType = node.kind === 158 || node.kind === 159;\n            if (isFunctionTypeOrConstructorType || node.parent.kind === 161) {\n                if (node.type) {\n                    write(isFunctionTypeOrConstructorType ? \" => \" : \": \");\n                    emitType(node.type);\n                }\n            }\n            else if (node.kind !== 150 && !ts.hasModifier(node, 8)) {\n                writeReturnTypeAtSignature(node, getReturnTypeVisibilityError);\n            }\n            enclosingDeclaration = prevEnclosingDeclaration;\n            if (!isFunctionTypeOrConstructorType) {\n                write(\";\");\n                writeLine();\n            }\n            else if (closeParenthesizedFunctionType) {\n                write(\")\");\n            }\n            function getReturnTypeVisibilityError(symbolAccessibilityResult) {\n                var diagnosticMessage;\n                switch (node.kind) {\n                    case 154:\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;\n                        break;\n                    case 153:\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;\n                        break;\n                    case 155:\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;\n                        break;\n                    case 149:\n                    case 148:\n                        if (ts.hasModifier(node, 32)) {\n                            diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                                symbolAccessibilityResult.accessibility === 2 ?\n                                    ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :\n                                    ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :\n                                ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0;\n                        }\n                        else if (node.parent.kind === 226) {\n                            diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                                symbolAccessibilityResult.accessibility === 2 ?\n                                    ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :\n                                    ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :\n                                ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0;\n                        }\n                        else {\n                            diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                                ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :\n                                ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;\n                        }\n                        break;\n                    case 225:\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 ?\n                                ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :\n                                ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0;\n                        break;\n                    default:\n                        ts.Debug.fail(\"This is unknown kind for signature: \" + node.kind);\n                }\n                return {\n                    diagnosticMessage: diagnosticMessage,\n                    errorNode: node.name || node\n                };\n            }\n        }\n        function emitParameterDeclaration(node) {\n            increaseIndent();\n            emitJsDocComments(node);\n            if (node.dotDotDotToken) {\n                write(\"...\");\n            }\n            if (ts.isBindingPattern(node.name)) {\n                emitBindingPattern(node.name);\n            }\n            else {\n                writeTextOfNode(currentText, node.name);\n            }\n            if (resolver.isOptionalParameter(node)) {\n                write(\"?\");\n            }\n            decreaseIndent();\n            if (node.parent.kind === 158 ||\n                node.parent.kind === 159 ||\n                node.parent.parent.kind === 161) {\n                emitTypeOfVariableDeclarationFromTypeLiteral(node);\n            }\n            else if (!ts.hasModifier(node.parent, 8)) {\n                writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError);\n            }\n            function getParameterDeclarationTypeVisibilityError(symbolAccessibilityResult) {\n                var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);\n                return diagnosticMessage !== undefined ? {\n                    diagnosticMessage: diagnosticMessage,\n                    errorNode: node,\n                    typeName: node.name\n                } : undefined;\n            }\n            function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {\n                switch (node.parent.kind) {\n                    case 150:\n                        return symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 ?\n                                ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;\n                    case 154:\n                        return symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;\n                    case 153:\n                        return symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;\n                    case 155:\n                        return symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1;\n                    case 149:\n                    case 148:\n                        if (ts.hasModifier(node.parent, 32)) {\n                            return symbolAccessibilityResult.errorModuleName ?\n                                symbolAccessibilityResult.accessibility === 2 ?\n                                    ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                    ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                                ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;\n                        }\n                        else if (node.parent.parent.kind === 226) {\n                            return symbolAccessibilityResult.errorModuleName ?\n                                symbolAccessibilityResult.accessibility === 2 ?\n                                    ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                    ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                                ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;\n                        }\n                        else {\n                            return symbolAccessibilityResult.errorModuleName ?\n                                ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :\n                                ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;\n                        }\n                    case 225:\n                        return symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 ?\n                                ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1;\n                    default:\n                        ts.Debug.fail(\"This is unknown parent for parameter: \" + node.parent.kind);\n                }\n            }\n            function emitBindingPattern(bindingPattern) {\n                if (bindingPattern.kind === 172) {\n                    write(\"{\");\n                    emitCommaList(bindingPattern.elements, emitBindingElement);\n                    write(\"}\");\n                }\n                else if (bindingPattern.kind === 173) {\n                    write(\"[\");\n                    var elements = bindingPattern.elements;\n                    emitCommaList(elements, emitBindingElement);\n                    if (elements && elements.hasTrailingComma) {\n                        write(\", \");\n                    }\n                    write(\"]\");\n                }\n            }\n            function emitBindingElement(bindingElement) {\n                if (bindingElement.kind === 198) {\n                    write(\" \");\n                }\n                else if (bindingElement.kind === 174) {\n                    if (bindingElement.propertyName) {\n                        writeTextOfNode(currentText, bindingElement.propertyName);\n                        write(\": \");\n                    }\n                    if (bindingElement.name) {\n                        if (ts.isBindingPattern(bindingElement.name)) {\n                            emitBindingPattern(bindingElement.name);\n                        }\n                        else {\n                            ts.Debug.assert(bindingElement.name.kind === 70);\n                            if (bindingElement.dotDotDotToken) {\n                                write(\"...\");\n                            }\n                            writeTextOfNode(currentText, bindingElement.name);\n                        }\n                    }\n                }\n            }\n        }\n        function emitNode(node) {\n            switch (node.kind) {\n                case 225:\n                case 230:\n                case 234:\n                case 227:\n                case 226:\n                case 228:\n                case 229:\n                    return emitModuleElement(node, isModuleElementVisible(node));\n                case 205:\n                    return emitModuleElement(node, isVariableStatementVisible(node));\n                case 235:\n                    return emitModuleElement(node, !node.importClause);\n                case 241:\n                    return emitExportDeclaration(node);\n                case 150:\n                case 149:\n                case 148:\n                    return writeFunctionDeclaration(node);\n                case 154:\n                case 153:\n                case 155:\n                    return emitSignatureDeclarationWithJsDocComments(node);\n                case 151:\n                case 152:\n                    return emitAccessorDeclaration(node);\n                case 147:\n                case 146:\n                    return emitPropertyDeclaration(node);\n                case 260:\n                    return emitEnumMemberDeclaration(node);\n                case 240:\n                    return emitExportAssignment(node);\n                case 261:\n                    return emitSourceFile(node);\n            }\n        }\n        function writeReferencePath(referencedFile, addBundledFileReference, emitOnlyDtsFiles) {\n            var declFileName;\n            var addedBundledEmitReference = false;\n            if (ts.isDeclarationFile(referencedFile)) {\n                declFileName = referencedFile.fileName;\n            }\n            else {\n                ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles);\n            }\n            if (declFileName) {\n                declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false);\n                referencesOutput += \"/// <reference path=\\\"\" + declFileName + \"\\\" />\" + newLine;\n            }\n            return addedBundledEmitReference;\n            function getDeclFileName(emitFileNames, _sourceFiles, isBundledEmit) {\n                if (isBundledEmit && !addBundledFileReference) {\n                    return;\n                }\n                ts.Debug.assert(!!emitFileNames.declarationFilePath || ts.isSourceFileJavaScript(referencedFile), \"Declaration file is not present only for javascript files\");\n                declFileName = emitFileNames.declarationFilePath || emitFileNames.jsFilePath;\n                addedBundledEmitReference = isBundledEmit;\n            }\n        }\n    }\n    function writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) {\n        var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles);\n        var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit;\n        if (!emitSkipped) {\n            var declarationOutput = emitDeclarationResult.referencesOutput\n                + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo);\n            ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles);\n        }\n        return emitSkipped;\n        function getDeclarationOutput(synchronousDeclarationOutput, moduleElementDeclarationEmitInfo) {\n            var appliedSyncOutputPos = 0;\n            var declarationOutput = \"\";\n            ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) {\n                if (aliasEmitInfo.asynchronousOutput) {\n                    declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos);\n                    declarationOutput += getDeclarationOutput(aliasEmitInfo.asynchronousOutput, aliasEmitInfo.subModuleElementDeclarationEmitInfo);\n                    appliedSyncOutputPos = aliasEmitInfo.outputPos;\n                }\n            });\n            declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos);\n            return declarationOutput;\n        }\n    }\n    ts.writeDeclarationFile = writeDeclarationFile;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var defaultLastEncodedSourceMapSpan = {\n        emittedLine: 1,\n        emittedColumn: 1,\n        sourceLine: 1,\n        sourceColumn: 1,\n        sourceIndex: 0\n    };\n    function createSourceMapWriter(host, writer) {\n        var compilerOptions = host.getCompilerOptions();\n        var extendedDiagnostics = compilerOptions.extendedDiagnostics;\n        var currentSourceFile;\n        var currentSourceText;\n        var sourceMapDir;\n        var sourceMapSourceIndex;\n        var lastRecordedSourceMapSpan;\n        var lastEncodedSourceMapSpan;\n        var lastEncodedNameIndex;\n        var sourceMapData;\n        var disabled = !(compilerOptions.sourceMap || compilerOptions.inlineSourceMap);\n        return {\n            initialize: initialize,\n            reset: reset,\n            getSourceMapData: function () { return sourceMapData; },\n            setSourceFile: setSourceFile,\n            emitPos: emitPos,\n            emitNodeWithSourceMap: emitNodeWithSourceMap,\n            emitTokenWithSourceMap: emitTokenWithSourceMap,\n            getText: getText,\n            getSourceMappingURL: getSourceMappingURL,\n        };\n        function initialize(filePath, sourceMapFilePath, sourceFiles, isBundledEmit) {\n            if (disabled) {\n                return;\n            }\n            if (sourceMapData) {\n                reset();\n            }\n            currentSourceFile = undefined;\n            currentSourceText = undefined;\n            sourceMapSourceIndex = -1;\n            lastRecordedSourceMapSpan = undefined;\n            lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan;\n            lastEncodedNameIndex = 0;\n            sourceMapData = {\n                sourceMapFilePath: sourceMapFilePath,\n                jsSourceMappingURL: !compilerOptions.inlineSourceMap ? ts.getBaseFileName(ts.normalizeSlashes(sourceMapFilePath)) : undefined,\n                sourceMapFile: ts.getBaseFileName(ts.normalizeSlashes(filePath)),\n                sourceMapSourceRoot: compilerOptions.sourceRoot || \"\",\n                sourceMapSources: [],\n                inputSourceFileNames: [],\n                sourceMapNames: [],\n                sourceMapMappings: \"\",\n                sourceMapSourcesContent: compilerOptions.inlineSources ? [] : undefined,\n                sourceMapDecodedMappings: []\n            };\n            sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot);\n            if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47) {\n                sourceMapData.sourceMapSourceRoot += ts.directorySeparator;\n            }\n            if (compilerOptions.mapRoot) {\n                sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot);\n                if (!isBundledEmit) {\n                    ts.Debug.assert(sourceFiles.length === 1);\n                    sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFiles[0], host, sourceMapDir));\n                }\n                if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) {\n                    sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir);\n                    sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(filePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), host.getCurrentDirectory(), host.getCanonicalFileName, true);\n                }\n                else {\n                    sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL);\n                }\n            }\n            else {\n                sourceMapDir = ts.getDirectoryPath(ts.normalizePath(filePath));\n            }\n        }\n        function reset() {\n            if (disabled) {\n                return;\n            }\n            currentSourceFile = undefined;\n            sourceMapDir = undefined;\n            sourceMapSourceIndex = undefined;\n            lastRecordedSourceMapSpan = undefined;\n            lastEncodedSourceMapSpan = undefined;\n            lastEncodedNameIndex = undefined;\n            sourceMapData = undefined;\n        }\n        function encodeLastRecordedSourceMapSpan() {\n            if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) {\n                return;\n            }\n            var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn;\n            if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) {\n                if (sourceMapData.sourceMapMappings) {\n                    sourceMapData.sourceMapMappings += \",\";\n                }\n            }\n            else {\n                for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) {\n                    sourceMapData.sourceMapMappings += \";\";\n                }\n                prevEncodedEmittedColumn = 1;\n            }\n            sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn);\n            sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex);\n            sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine);\n            sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn);\n            if (lastRecordedSourceMapSpan.nameIndex >= 0) {\n                ts.Debug.assert(false, \"We do not support name index right now, Make sure to update updateLastEncodedAndRecordedSpans when we start using this\");\n                sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex);\n                lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex;\n            }\n            lastEncodedSourceMapSpan = lastRecordedSourceMapSpan;\n            sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan);\n        }\n        function emitPos(pos) {\n            if (disabled || ts.positionIsSynthesized(pos)) {\n                return;\n            }\n            if (extendedDiagnostics) {\n                ts.performance.mark(\"beforeSourcemap\");\n            }\n            var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos);\n            sourceLinePos.line++;\n            sourceLinePos.character++;\n            var emittedLine = writer.getLine();\n            var emittedColumn = writer.getColumn();\n            if (!lastRecordedSourceMapSpan ||\n                lastRecordedSourceMapSpan.emittedLine !== emittedLine ||\n                lastRecordedSourceMapSpan.emittedColumn !== emittedColumn ||\n                (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex &&\n                    (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line ||\n                        (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) {\n                encodeLastRecordedSourceMapSpan();\n                lastRecordedSourceMapSpan = {\n                    emittedLine: emittedLine,\n                    emittedColumn: emittedColumn,\n                    sourceLine: sourceLinePos.line,\n                    sourceColumn: sourceLinePos.character,\n                    sourceIndex: sourceMapSourceIndex\n                };\n            }\n            else {\n                lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line;\n                lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character;\n                lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex;\n            }\n            if (extendedDiagnostics) {\n                ts.performance.mark(\"afterSourcemap\");\n                ts.performance.measure(\"Source Map\", \"beforeSourcemap\", \"afterSourcemap\");\n            }\n        }\n        function emitNodeWithSourceMap(emitContext, node, emitCallback) {\n            if (disabled) {\n                return emitCallback(emitContext, node);\n            }\n            if (node) {\n                var emitNode = node.emitNode;\n                var emitFlags = emitNode && emitNode.flags;\n                var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end;\n                if (node.kind !== 293\n                    && (emitFlags & 16) === 0\n                    && pos >= 0) {\n                    emitPos(ts.skipTrivia(currentSourceText, pos));\n                }\n                if (emitFlags & 64) {\n                    disabled = true;\n                    emitCallback(emitContext, node);\n                    disabled = false;\n                }\n                else {\n                    emitCallback(emitContext, node);\n                }\n                if (node.kind !== 293\n                    && (emitFlags & 32) === 0\n                    && end >= 0) {\n                    emitPos(end);\n                }\n            }\n        }\n        function emitTokenWithSourceMap(node, token, tokenPos, emitCallback) {\n            if (disabled) {\n                return emitCallback(token, tokenPos);\n            }\n            var emitNode = node && node.emitNode;\n            var emitFlags = emitNode && emitNode.flags;\n            var range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token];\n            tokenPos = ts.skipTrivia(currentSourceText, range ? range.pos : tokenPos);\n            if ((emitFlags & 128) === 0 && tokenPos >= 0) {\n                emitPos(tokenPos);\n            }\n            tokenPos = emitCallback(token, tokenPos);\n            if (range)\n                tokenPos = range.end;\n            if ((emitFlags & 256) === 0 && tokenPos >= 0) {\n                emitPos(tokenPos);\n            }\n            return tokenPos;\n        }\n        function setSourceFile(sourceFile) {\n            if (disabled) {\n                return;\n            }\n            currentSourceFile = sourceFile;\n            currentSourceText = currentSourceFile.text;\n            var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;\n            var source = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, currentSourceFile.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true);\n            sourceMapSourceIndex = ts.indexOf(sourceMapData.sourceMapSources, source);\n            if (sourceMapSourceIndex === -1) {\n                sourceMapSourceIndex = sourceMapData.sourceMapSources.length;\n                sourceMapData.sourceMapSources.push(source);\n                sourceMapData.inputSourceFileNames.push(currentSourceFile.fileName);\n                if (compilerOptions.inlineSources) {\n                    sourceMapData.sourceMapSourcesContent.push(currentSourceFile.text);\n                }\n            }\n        }\n        function getText() {\n            if (disabled) {\n                return;\n            }\n            encodeLastRecordedSourceMapSpan();\n            return ts.stringify({\n                version: 3,\n                file: sourceMapData.sourceMapFile,\n                sourceRoot: sourceMapData.sourceMapSourceRoot,\n                sources: sourceMapData.sourceMapSources,\n                names: sourceMapData.sourceMapNames,\n                mappings: sourceMapData.sourceMapMappings,\n                sourcesContent: sourceMapData.sourceMapSourcesContent,\n            });\n        }\n        function getSourceMappingURL() {\n            if (disabled) {\n                return;\n            }\n            if (compilerOptions.inlineSourceMap) {\n                var base64SourceMapText = ts.convertToBase64(getText());\n                return sourceMapData.jsSourceMappingURL = \"data:application/json;base64,\" + base64SourceMapText;\n            }\n            else {\n                return sourceMapData.jsSourceMappingURL;\n            }\n        }\n    }\n    ts.createSourceMapWriter = createSourceMapWriter;\n    var base64Chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n    function base64FormatEncode(inValue) {\n        if (inValue < 64) {\n            return base64Chars.charAt(inValue);\n        }\n        throw TypeError(inValue + \": not a 64 based value\");\n    }\n    function base64VLQFormatEncode(inValue) {\n        if (inValue < 0) {\n            inValue = ((-inValue) << 1) + 1;\n        }\n        else {\n            inValue = inValue << 1;\n        }\n        var encodedStr = \"\";\n        do {\n            var currentDigit = inValue & 31;\n            inValue = inValue >> 5;\n            if (inValue > 0) {\n                currentDigit = currentDigit | 32;\n            }\n            encodedStr = encodedStr + base64FormatEncode(currentDigit);\n        } while (inValue > 0);\n        return encodedStr;\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function createCommentWriter(host, writer, sourceMap) {\n        var compilerOptions = host.getCompilerOptions();\n        var extendedDiagnostics = compilerOptions.extendedDiagnostics;\n        var newLine = host.getNewLine();\n        var emitPos = sourceMap.emitPos;\n        var containerPos = -1;\n        var containerEnd = -1;\n        var declarationListContainerEnd = -1;\n        var currentSourceFile;\n        var currentText;\n        var currentLineMap;\n        var detachedCommentsInfo;\n        var hasWrittenComment = false;\n        var disabled = compilerOptions.removeComments;\n        return {\n            reset: reset,\n            setSourceFile: setSourceFile,\n            emitNodeWithComments: emitNodeWithComments,\n            emitBodyWithDetachedComments: emitBodyWithDetachedComments,\n            emitTrailingCommentsOfPosition: emitTrailingCommentsOfPosition,\n        };\n        function emitNodeWithComments(emitContext, node, emitCallback) {\n            if (disabled) {\n                emitCallback(emitContext, node);\n                return;\n            }\n            if (node) {\n                var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;\n                var emitFlags = ts.getEmitFlags(node);\n                if ((pos < 0 && end < 0) || (pos === end)) {\n                    if (emitFlags & 2048) {\n                        disabled = true;\n                        emitCallback(emitContext, node);\n                        disabled = false;\n                    }\n                    else {\n                        emitCallback(emitContext, node);\n                    }\n                }\n                else {\n                    if (extendedDiagnostics) {\n                        ts.performance.mark(\"preEmitNodeWithComment\");\n                    }\n                    var isEmittedNode = node.kind !== 293;\n                    var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0;\n                    var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0;\n                    if (!skipLeadingComments) {\n                        emitLeadingComments(pos, isEmittedNode);\n                    }\n                    var savedContainerPos = containerPos;\n                    var savedContainerEnd = containerEnd;\n                    var savedDeclarationListContainerEnd = declarationListContainerEnd;\n                    if (!skipLeadingComments) {\n                        containerPos = pos;\n                    }\n                    if (!skipTrailingComments) {\n                        containerEnd = end;\n                        if (node.kind === 224) {\n                            declarationListContainerEnd = end;\n                        }\n                    }\n                    if (extendedDiagnostics) {\n                        ts.performance.measure(\"commentTime\", \"preEmitNodeWithComment\");\n                    }\n                    if (emitFlags & 2048) {\n                        disabled = true;\n                        emitCallback(emitContext, node);\n                        disabled = false;\n                    }\n                    else {\n                        emitCallback(emitContext, node);\n                    }\n                    if (extendedDiagnostics) {\n                        ts.performance.mark(\"beginEmitNodeWithComment\");\n                    }\n                    containerPos = savedContainerPos;\n                    containerEnd = savedContainerEnd;\n                    declarationListContainerEnd = savedDeclarationListContainerEnd;\n                    if (!skipTrailingComments && isEmittedNode) {\n                        emitTrailingComments(end);\n                    }\n                    if (extendedDiagnostics) {\n                        ts.performance.measure(\"commentTime\", \"beginEmitNodeWithComment\");\n                    }\n                }\n            }\n        }\n        function emitBodyWithDetachedComments(node, detachedRange, emitCallback) {\n            if (extendedDiagnostics) {\n                ts.performance.mark(\"preEmitBodyWithDetachedComments\");\n            }\n            var pos = detachedRange.pos, end = detachedRange.end;\n            var emitFlags = ts.getEmitFlags(node);\n            var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0;\n            var skipTrailingComments = disabled || end < 0 || (emitFlags & 1024) !== 0;\n            if (!skipLeadingComments) {\n                emitDetachedCommentsAndUpdateCommentsInfo(detachedRange);\n            }\n            if (extendedDiagnostics) {\n                ts.performance.measure(\"commentTime\", \"preEmitBodyWithDetachedComments\");\n            }\n            if (emitFlags & 2048 && !disabled) {\n                disabled = true;\n                emitCallback(node);\n                disabled = false;\n            }\n            else {\n                emitCallback(node);\n            }\n            if (extendedDiagnostics) {\n                ts.performance.mark(\"beginEmitBodyWithDetachedCommetns\");\n            }\n            if (!skipTrailingComments) {\n                emitLeadingComments(detachedRange.end, true);\n            }\n            if (extendedDiagnostics) {\n                ts.performance.measure(\"commentTime\", \"beginEmitBodyWithDetachedCommetns\");\n            }\n        }\n        function emitLeadingComments(pos, isEmittedNode) {\n            hasWrittenComment = false;\n            if (isEmittedNode) {\n                forEachLeadingCommentToEmit(pos, emitLeadingComment);\n            }\n            else if (pos === 0) {\n                forEachLeadingCommentToEmit(pos, emitTripleSlashLeadingComment);\n            }\n        }\n        function emitTripleSlashLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {\n            if (isTripleSlashComment(commentPos, commentEnd)) {\n                emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos);\n            }\n        }\n        function emitLeadingComment(commentPos, commentEnd, _kind, hasTrailingNewLine, rangePos) {\n            if (!hasWrittenComment) {\n                ts.emitNewLineBeforeLeadingCommentOfPosition(currentLineMap, writer, rangePos, commentPos);\n                hasWrittenComment = true;\n            }\n            emitPos(commentPos);\n            ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine);\n            emitPos(commentEnd);\n            if (hasTrailingNewLine) {\n                writer.writeLine();\n            }\n            else {\n                writer.write(\" \");\n            }\n        }\n        function emitTrailingComments(pos) {\n            forEachTrailingCommentToEmit(pos, emitTrailingComment);\n        }\n        function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) {\n            if (!writer.isAtStartOfLine()) {\n                writer.write(\" \");\n            }\n            emitPos(commentPos);\n            ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine);\n            emitPos(commentEnd);\n            if (hasTrailingNewLine) {\n                writer.writeLine();\n            }\n        }\n        function emitTrailingCommentsOfPosition(pos) {\n            if (disabled) {\n                return;\n            }\n            if (extendedDiagnostics) {\n                ts.performance.mark(\"beforeEmitTrailingCommentsOfPosition\");\n            }\n            forEachTrailingCommentToEmit(pos, emitTrailingCommentOfPosition);\n            if (extendedDiagnostics) {\n                ts.performance.measure(\"commentTime\", \"beforeEmitTrailingCommentsOfPosition\");\n            }\n        }\n        function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) {\n            emitPos(commentPos);\n            ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine);\n            emitPos(commentEnd);\n            if (hasTrailingNewLine) {\n                writer.writeLine();\n            }\n            else {\n                writer.write(\" \");\n            }\n        }\n        function forEachLeadingCommentToEmit(pos, cb) {\n            if (containerPos === -1 || pos !== containerPos) {\n                if (hasDetachedComments(pos)) {\n                    forEachLeadingCommentWithoutDetachedComments(cb);\n                }\n                else {\n                    ts.forEachLeadingCommentRange(currentText, pos, cb, pos);\n                }\n            }\n        }\n        function forEachTrailingCommentToEmit(end, cb) {\n            if (containerEnd === -1 || (end !== containerEnd && end !== declarationListContainerEnd)) {\n                ts.forEachTrailingCommentRange(currentText, end, cb);\n            }\n        }\n        function reset() {\n            currentSourceFile = undefined;\n            currentText = undefined;\n            currentLineMap = undefined;\n            detachedCommentsInfo = undefined;\n        }\n        function setSourceFile(sourceFile) {\n            currentSourceFile = sourceFile;\n            currentText = currentSourceFile.text;\n            currentLineMap = ts.getLineStarts(currentSourceFile);\n            detachedCommentsInfo = undefined;\n        }\n        function hasDetachedComments(pos) {\n            return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos;\n        }\n        function forEachLeadingCommentWithoutDetachedComments(cb) {\n            var pos = ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos;\n            if (detachedCommentsInfo.length - 1) {\n                detachedCommentsInfo.pop();\n            }\n            else {\n                detachedCommentsInfo = undefined;\n            }\n            ts.forEachLeadingCommentRange(currentText, pos, cb, pos);\n        }\n        function emitDetachedCommentsAndUpdateCommentsInfo(range) {\n            var currentDetachedCommentInfo = ts.emitDetachedComments(currentText, currentLineMap, writer, writeComment, range, newLine, disabled);\n            if (currentDetachedCommentInfo) {\n                if (detachedCommentsInfo) {\n                    detachedCommentsInfo.push(currentDetachedCommentInfo);\n                }\n                else {\n                    detachedCommentsInfo = [currentDetachedCommentInfo];\n                }\n            }\n        }\n        function writeComment(text, lineMap, writer, commentPos, commentEnd, newLine) {\n            emitPos(commentPos);\n            ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine);\n            emitPos(commentEnd);\n        }\n        function isTripleSlashComment(commentPos, commentEnd) {\n            if (currentText.charCodeAt(commentPos + 1) === 47 &&\n                commentPos + 2 < commentEnd &&\n                currentText.charCodeAt(commentPos + 2) === 47) {\n                var textSubStr = currentText.substring(commentPos, commentEnd);\n                return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) ||\n                    textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ?\n                    true : false;\n            }\n            return false;\n        }\n    }\n    ts.createCommentWriter = createCommentWriter;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var id = function (s) { return s; };\n    var nullTransformers = [function (_) { return id; }];\n    function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) {\n        var delimiters = createDelimiterMap();\n        var brackets = createBracketsMap();\n        var compilerOptions = host.getCompilerOptions();\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        var moduleKind = ts.getEmitModuleKind(compilerOptions);\n        var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined;\n        var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined;\n        var emitterDiagnostics = ts.createDiagnosticCollection();\n        var newLine = host.getNewLine();\n        var transformers = emitOnlyDtsFiles ? nullTransformers : ts.getTransformers(compilerOptions);\n        var writer = ts.createTextWriter(newLine);\n        var write = writer.write, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent;\n        var sourceMap = ts.createSourceMapWriter(host, writer);\n        var emitNodeWithSourceMap = sourceMap.emitNodeWithSourceMap, emitTokenWithSourceMap = sourceMap.emitTokenWithSourceMap;\n        var comments = ts.createCommentWriter(host, writer, sourceMap);\n        var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition;\n        var nodeIdToGeneratedName;\n        var autoGeneratedIdToGeneratedName;\n        var generatedNameSet;\n        var tempFlags;\n        var currentSourceFile;\n        var currentText;\n        var currentFileIdentifiers;\n        var bundledHelpers;\n        var isOwnFileEmit;\n        var emitSkipped = false;\n        var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile);\n        ts.performance.mark(\"beforeTransform\");\n        var _a = ts.transformFiles(resolver, host, sourceFiles, transformers), transformed = _a.transformed, emitNodeWithSubstitution = _a.emitNodeWithSubstitution, emitNodeWithNotification = _a.emitNodeWithNotification;\n        ts.performance.measure(\"transformTime\", \"beforeTransform\");\n        ts.performance.mark(\"beforePrint\");\n        ts.forEachTransformedEmitFile(host, transformed, emitFile, emitOnlyDtsFiles);\n        ts.performance.measure(\"printTime\", \"beforePrint\");\n        for (var _b = 0, sourceFiles_4 = sourceFiles; _b < sourceFiles_4.length; _b++) {\n            var sourceFile = sourceFiles_4[_b];\n            ts.disposeEmitNodes(sourceFile);\n        }\n        return {\n            emitSkipped: emitSkipped,\n            diagnostics: emitterDiagnostics.getDiagnostics(),\n            emittedFiles: emittedFilesList,\n            sourceMaps: sourceMapDataList\n        };\n        function emitFile(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, isBundledEmit) {\n            if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) {\n                if (!emitOnlyDtsFiles) {\n                    printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit);\n                }\n            }\n            else {\n                emitSkipped = true;\n            }\n            if (declarationFilePath) {\n                emitSkipped = ts.writeDeclarationFile(declarationFilePath, ts.getOriginalSourceFiles(sourceFiles), isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) || emitSkipped;\n            }\n            if (!emitSkipped && emittedFilesList) {\n                if (!emitOnlyDtsFiles) {\n                    emittedFilesList.push(jsFilePath);\n                }\n                if (sourceMapFilePath) {\n                    emittedFilesList.push(sourceMapFilePath);\n                }\n                if (declarationFilePath) {\n                    emittedFilesList.push(declarationFilePath);\n                }\n            }\n        }\n        function printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit) {\n            sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit);\n            nodeIdToGeneratedName = [];\n            autoGeneratedIdToGeneratedName = [];\n            generatedNameSet = ts.createMap();\n            bundledHelpers = isBundledEmit ? ts.createMap() : undefined;\n            isOwnFileEmit = !isBundledEmit;\n            if (isBundledEmit && moduleKind) {\n                for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) {\n                    var sourceFile = sourceFiles_5[_a];\n                    emitHelpers(sourceFile, true);\n                }\n            }\n            ts.forEach(sourceFiles, printSourceFile);\n            writeLine();\n            var sourceMappingURL = sourceMap.getSourceMappingURL();\n            if (sourceMappingURL) {\n                write(\"//# \" + \"sourceMappingURL\" + \"=\" + sourceMappingURL);\n            }\n            if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) {\n                ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false, sourceFiles);\n            }\n            if (sourceMapDataList) {\n                sourceMapDataList.push(sourceMap.getSourceMapData());\n            }\n            ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles);\n            sourceMap.reset();\n            comments.reset();\n            writer.reset();\n            tempFlags = 0;\n            currentSourceFile = undefined;\n            currentText = undefined;\n            isOwnFileEmit = false;\n        }\n        function printSourceFile(node) {\n            currentSourceFile = node;\n            currentText = node.text;\n            currentFileIdentifiers = node.identifiers;\n            sourceMap.setSourceFile(node);\n            comments.setSourceFile(node);\n            pipelineEmitWithNotification(0, node);\n        }\n        function emit(node) {\n            pipelineEmitWithNotification(3, node);\n        }\n        function emitIdentifierName(node) {\n            pipelineEmitWithNotification(2, node);\n        }\n        function emitExpression(node) {\n            pipelineEmitWithNotification(1, node);\n        }\n        function pipelineEmitWithNotification(emitContext, node) {\n            emitNodeWithNotification(emitContext, node, pipelineEmitWithComments);\n        }\n        function pipelineEmitWithComments(emitContext, node) {\n            if (emitContext === 0) {\n                pipelineEmitWithSourceMap(emitContext, node);\n                return;\n            }\n            emitNodeWithComments(emitContext, node, pipelineEmitWithSourceMap);\n        }\n        function pipelineEmitWithSourceMap(emitContext, node) {\n            if (emitContext === 0\n                || emitContext === 2) {\n                pipelineEmitWithSubstitution(emitContext, node);\n                return;\n            }\n            emitNodeWithSourceMap(emitContext, node, pipelineEmitWithSubstitution);\n        }\n        function pipelineEmitWithSubstitution(emitContext, node) {\n            emitNodeWithSubstitution(emitContext, node, pipelineEmitForContext);\n        }\n        function pipelineEmitForContext(emitContext, node) {\n            switch (emitContext) {\n                case 0: return pipelineEmitInSourceFileContext(node);\n                case 2: return pipelineEmitInIdentifierNameContext(node);\n                case 3: return pipelineEmitInUnspecifiedContext(node);\n                case 1: return pipelineEmitInExpressionContext(node);\n            }\n        }\n        function pipelineEmitInSourceFileContext(node) {\n            var kind = node.kind;\n            switch (kind) {\n                case 261:\n                    return emitSourceFile(node);\n            }\n        }\n        function pipelineEmitInIdentifierNameContext(node) {\n            var kind = node.kind;\n            switch (kind) {\n                case 70:\n                    return emitIdentifier(node);\n            }\n        }\n        function pipelineEmitInUnspecifiedContext(node) {\n            var kind = node.kind;\n            switch (kind) {\n                case 13:\n                case 14:\n                case 15:\n                    return emitLiteral(node);\n                case 70:\n                    return emitIdentifier(node);\n                case 75:\n                case 78:\n                case 83:\n                case 104:\n                case 111:\n                case 112:\n                case 113:\n                case 114:\n                case 116:\n                case 117:\n                case 118:\n                case 119:\n                case 120:\n                case 121:\n                case 122:\n                case 123:\n                case 124:\n                case 125:\n                case 127:\n                case 128:\n                case 129:\n                case 130:\n                case 131:\n                case 132:\n                case 133:\n                case 134:\n                case 135:\n                case 136:\n                case 137:\n                case 138:\n                case 139:\n                case 140:\n                    writeTokenText(kind);\n                    return;\n                case 141:\n                    return emitQualifiedName(node);\n                case 142:\n                    return emitComputedPropertyName(node);\n                case 143:\n                    return emitTypeParameter(node);\n                case 144:\n                    return emitParameter(node);\n                case 145:\n                    return emitDecorator(node);\n                case 146:\n                    return emitPropertySignature(node);\n                case 147:\n                    return emitPropertyDeclaration(node);\n                case 148:\n                    return emitMethodSignature(node);\n                case 149:\n                    return emitMethodDeclaration(node);\n                case 150:\n                    return emitConstructor(node);\n                case 151:\n                case 152:\n                    return emitAccessorDeclaration(node);\n                case 153:\n                    return emitCallSignature(node);\n                case 154:\n                    return emitConstructSignature(node);\n                case 155:\n                    return emitIndexSignature(node);\n                case 156:\n                    return emitTypePredicate(node);\n                case 157:\n                    return emitTypeReference(node);\n                case 158:\n                    return emitFunctionType(node);\n                case 159:\n                    return emitConstructorType(node);\n                case 160:\n                    return emitTypeQuery(node);\n                case 161:\n                    return emitTypeLiteral(node);\n                case 162:\n                    return emitArrayType(node);\n                case 163:\n                    return emitTupleType(node);\n                case 164:\n                    return emitUnionType(node);\n                case 165:\n                    return emitIntersectionType(node);\n                case 166:\n                    return emitParenthesizedType(node);\n                case 199:\n                    return emitExpressionWithTypeArguments(node);\n                case 167:\n                    return emitThisType();\n                case 168:\n                    return emitTypeOperator(node);\n                case 169:\n                    return emitIndexedAccessType(node);\n                case 170:\n                    return emitMappedType(node);\n                case 171:\n                    return emitLiteralType(node);\n                case 172:\n                    return emitObjectBindingPattern(node);\n                case 173:\n                    return emitArrayBindingPattern(node);\n                case 174:\n                    return emitBindingElement(node);\n                case 202:\n                    return emitTemplateSpan(node);\n                case 203:\n                    return emitSemicolonClassElement();\n                case 204:\n                    return emitBlock(node);\n                case 205:\n                    return emitVariableStatement(node);\n                case 206:\n                    return emitEmptyStatement();\n                case 207:\n                    return emitExpressionStatement(node);\n                case 208:\n                    return emitIfStatement(node);\n                case 209:\n                    return emitDoStatement(node);\n                case 210:\n                    return emitWhileStatement(node);\n                case 211:\n                    return emitForStatement(node);\n                case 212:\n                    return emitForInStatement(node);\n                case 213:\n                    return emitForOfStatement(node);\n                case 214:\n                    return emitContinueStatement(node);\n                case 215:\n                    return emitBreakStatement(node);\n                case 216:\n                    return emitReturnStatement(node);\n                case 217:\n                    return emitWithStatement(node);\n                case 218:\n                    return emitSwitchStatement(node);\n                case 219:\n                    return emitLabeledStatement(node);\n                case 220:\n                    return emitThrowStatement(node);\n                case 221:\n                    return emitTryStatement(node);\n                case 222:\n                    return emitDebuggerStatement(node);\n                case 223:\n                    return emitVariableDeclaration(node);\n                case 224:\n                    return emitVariableDeclarationList(node);\n                case 225:\n                    return emitFunctionDeclaration(node);\n                case 226:\n                    return emitClassDeclaration(node);\n                case 227:\n                    return emitInterfaceDeclaration(node);\n                case 228:\n                    return emitTypeAliasDeclaration(node);\n                case 229:\n                    return emitEnumDeclaration(node);\n                case 230:\n                    return emitModuleDeclaration(node);\n                case 231:\n                    return emitModuleBlock(node);\n                case 232:\n                    return emitCaseBlock(node);\n                case 234:\n                    return emitImportEqualsDeclaration(node);\n                case 235:\n                    return emitImportDeclaration(node);\n                case 236:\n                    return emitImportClause(node);\n                case 237:\n                    return emitNamespaceImport(node);\n                case 238:\n                    return emitNamedImports(node);\n                case 239:\n                    return emitImportSpecifier(node);\n                case 240:\n                    return emitExportAssignment(node);\n                case 241:\n                    return emitExportDeclaration(node);\n                case 242:\n                    return emitNamedExports(node);\n                case 243:\n                    return emitExportSpecifier(node);\n                case 244:\n                    return;\n                case 245:\n                    return emitExternalModuleReference(node);\n                case 10:\n                    return emitJsxText(node);\n                case 248:\n                    return emitJsxOpeningElement(node);\n                case 249:\n                    return emitJsxClosingElement(node);\n                case 250:\n                    return emitJsxAttribute(node);\n                case 251:\n                    return emitJsxSpreadAttribute(node);\n                case 252:\n                    return emitJsxExpression(node);\n                case 253:\n                    return emitCaseClause(node);\n                case 254:\n                    return emitDefaultClause(node);\n                case 255:\n                    return emitHeritageClause(node);\n                case 256:\n                    return emitCatchClause(node);\n                case 257:\n                    return emitPropertyAssignment(node);\n                case 258:\n                    return emitShorthandPropertyAssignment(node);\n                case 259:\n                    return emitSpreadAssignment(node);\n                case 260:\n                    return emitEnumMember(node);\n            }\n            if (ts.isExpression(node)) {\n                return pipelineEmitWithSubstitution(1, node);\n            }\n        }\n        function pipelineEmitInExpressionContext(node) {\n            var kind = node.kind;\n            switch (kind) {\n                case 8:\n                    return emitNumericLiteral(node);\n                case 9:\n                case 11:\n                case 12:\n                    return emitLiteral(node);\n                case 70:\n                    return emitIdentifier(node);\n                case 85:\n                case 94:\n                case 96:\n                case 100:\n                case 98:\n                    writeTokenText(kind);\n                    return;\n                case 175:\n                    return emitArrayLiteralExpression(node);\n                case 176:\n                    return emitObjectLiteralExpression(node);\n                case 177:\n                    return emitPropertyAccessExpression(node);\n                case 178:\n                    return emitElementAccessExpression(node);\n                case 179:\n                    return emitCallExpression(node);\n                case 180:\n                    return emitNewExpression(node);\n                case 181:\n                    return emitTaggedTemplateExpression(node);\n                case 182:\n                    return emitTypeAssertionExpression(node);\n                case 183:\n                    return emitParenthesizedExpression(node);\n                case 184:\n                    return emitFunctionExpression(node);\n                case 185:\n                    return emitArrowFunction(node);\n                case 186:\n                    return emitDeleteExpression(node);\n                case 187:\n                    return emitTypeOfExpression(node);\n                case 188:\n                    return emitVoidExpression(node);\n                case 189:\n                    return emitAwaitExpression(node);\n                case 190:\n                    return emitPrefixUnaryExpression(node);\n                case 191:\n                    return emitPostfixUnaryExpression(node);\n                case 192:\n                    return emitBinaryExpression(node);\n                case 193:\n                    return emitConditionalExpression(node);\n                case 194:\n                    return emitTemplateExpression(node);\n                case 195:\n                    return emitYieldExpression(node);\n                case 196:\n                    return emitSpreadExpression(node);\n                case 197:\n                    return emitClassExpression(node);\n                case 198:\n                    return;\n                case 200:\n                    return emitAsExpression(node);\n                case 201:\n                    return emitNonNullExpression(node);\n                case 246:\n                    return emitJsxElement(node);\n                case 247:\n                    return emitJsxSelfClosingElement(node);\n                case 294:\n                    return emitPartiallyEmittedExpression(node);\n                case 297:\n                    return writeLines(node.text);\n            }\n        }\n        function emitNumericLiteral(node) {\n            emitLiteral(node);\n            if (node.trailingComment) {\n                write(\" /*\" + node.trailingComment + \"*/\");\n            }\n        }\n        function emitLiteral(node) {\n            var text = getLiteralTextOfNode(node);\n            if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap)\n                && (node.kind === 9 || ts.isTemplateLiteralKind(node.kind))) {\n                writer.writeLiteral(text);\n            }\n            else {\n                write(text);\n            }\n        }\n        function emitIdentifier(node) {\n            write(getTextOfNode(node, false));\n        }\n        function emitQualifiedName(node) {\n            emitEntityName(node.left);\n            write(\".\");\n            emit(node.right);\n        }\n        function emitEntityName(node) {\n            if (node.kind === 70) {\n                emitExpression(node);\n            }\n            else {\n                emit(node);\n            }\n        }\n        function emitComputedPropertyName(node) {\n            write(\"[\");\n            emitExpression(node.expression);\n            write(\"]\");\n        }\n        function emitTypeParameter(node) {\n            emit(node.name);\n            emitWithPrefix(\" extends \", node.constraint);\n        }\n        function emitParameter(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            writeIfPresent(node.dotDotDotToken, \"...\");\n            emit(node.name);\n            writeIfPresent(node.questionToken, \"?\");\n            emitExpressionWithPrefix(\" = \", node.initializer);\n            emitWithPrefix(\": \", node.type);\n        }\n        function emitDecorator(decorator) {\n            write(\"@\");\n            emitExpression(decorator.expression);\n        }\n        function emitPropertySignature(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emit(node.name);\n            writeIfPresent(node.questionToken, \"?\");\n            emitWithPrefix(\": \", node.type);\n            write(\";\");\n        }\n        function emitPropertyDeclaration(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emit(node.name);\n            emitWithPrefix(\": \", node.type);\n            emitExpressionWithPrefix(\" = \", node.initializer);\n            write(\";\");\n        }\n        function emitMethodSignature(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emit(node.name);\n            writeIfPresent(node.questionToken, \"?\");\n            emitTypeParameters(node, node.typeParameters);\n            emitParameters(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n            write(\";\");\n        }\n        function emitMethodDeclaration(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            writeIfPresent(node.asteriskToken, \"*\");\n            emit(node.name);\n            emitSignatureAndBody(node, emitSignatureHead);\n        }\n        function emitConstructor(node) {\n            emitModifiers(node, node.modifiers);\n            write(\"constructor\");\n            emitSignatureAndBody(node, emitSignatureHead);\n        }\n        function emitAccessorDeclaration(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(node.kind === 151 ? \"get \" : \"set \");\n            emit(node.name);\n            emitSignatureAndBody(node, emitSignatureHead);\n        }\n        function emitCallSignature(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emitTypeParameters(node, node.typeParameters);\n            emitParameters(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n            write(\";\");\n        }\n        function emitConstructSignature(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(\"new \");\n            emitTypeParameters(node, node.typeParameters);\n            emitParameters(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n            write(\";\");\n        }\n        function emitIndexSignature(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emitParametersForIndexSignature(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n            write(\";\");\n        }\n        function emitSemicolonClassElement() {\n            write(\";\");\n        }\n        function emitTypePredicate(node) {\n            emit(node.parameterName);\n            write(\" is \");\n            emit(node.type);\n        }\n        function emitTypeReference(node) {\n            emit(node.typeName);\n            emitTypeArguments(node, node.typeArguments);\n        }\n        function emitFunctionType(node) {\n            emitTypeParameters(node, node.typeParameters);\n            emitParametersForArrow(node, node.parameters);\n            write(\" => \");\n            emit(node.type);\n        }\n        function emitConstructorType(node) {\n            write(\"new \");\n            emitTypeParameters(node, node.typeParameters);\n            emitParametersForArrow(node, node.parameters);\n            write(\" => \");\n            emit(node.type);\n        }\n        function emitTypeQuery(node) {\n            write(\"typeof \");\n            emit(node.exprName);\n        }\n        function emitTypeLiteral(node) {\n            write(\"{\");\n            emitList(node, node.members, 65);\n            write(\"}\");\n        }\n        function emitArrayType(node) {\n            emit(node.elementType);\n            write(\"[]\");\n        }\n        function emitTupleType(node) {\n            write(\"[\");\n            emitList(node, node.elementTypes, 336);\n            write(\"]\");\n        }\n        function emitUnionType(node) {\n            emitList(node, node.types, 260);\n        }\n        function emitIntersectionType(node) {\n            emitList(node, node.types, 264);\n        }\n        function emitParenthesizedType(node) {\n            write(\"(\");\n            emit(node.type);\n            write(\")\");\n        }\n        function emitThisType() {\n            write(\"this\");\n        }\n        function emitTypeOperator(node) {\n            writeTokenText(node.operator);\n            write(\" \");\n            emit(node.type);\n        }\n        function emitIndexedAccessType(node) {\n            emit(node.objectType);\n            write(\"[\");\n            emit(node.indexType);\n            write(\"]\");\n        }\n        function emitMappedType(node) {\n            write(\"{\");\n            writeLine();\n            increaseIndent();\n            if (node.readonlyToken) {\n                write(\"readonly \");\n            }\n            write(\"[\");\n            emit(node.typeParameter.name);\n            write(\" in \");\n            emit(node.typeParameter.constraint);\n            write(\"]\");\n            if (node.questionToken) {\n                write(\"?\");\n            }\n            write(\": \");\n            emit(node.type);\n            write(\";\");\n            writeLine();\n            decreaseIndent();\n            write(\"}\");\n        }\n        function emitLiteralType(node) {\n            emitExpression(node.literal);\n        }\n        function emitObjectBindingPattern(node) {\n            var elements = node.elements;\n            if (elements.length === 0) {\n                write(\"{}\");\n            }\n            else {\n                write(\"{\");\n                emitList(node, elements, 432);\n                write(\"}\");\n            }\n        }\n        function emitArrayBindingPattern(node) {\n            var elements = node.elements;\n            if (elements.length === 0) {\n                write(\"[]\");\n            }\n            else {\n                write(\"[\");\n                emitList(node, node.elements, 304);\n                write(\"]\");\n            }\n        }\n        function emitBindingElement(node) {\n            emitWithSuffix(node.propertyName, \": \");\n            writeIfPresent(node.dotDotDotToken, \"...\");\n            emit(node.name);\n            emitExpressionWithPrefix(\" = \", node.initializer);\n        }\n        function emitArrayLiteralExpression(node) {\n            var elements = node.elements;\n            if (elements.length === 0) {\n                write(\"[]\");\n            }\n            else {\n                var preferNewLine = node.multiLine ? 32768 : 0;\n                emitExpressionList(node, elements, 4466 | preferNewLine);\n            }\n        }\n        function emitObjectLiteralExpression(node) {\n            var properties = node.properties;\n            if (properties.length === 0) {\n                write(\"{}\");\n            }\n            else {\n                var indentedFlag = ts.getEmitFlags(node) & 32768;\n                if (indentedFlag) {\n                    increaseIndent();\n                }\n                var preferNewLine = node.multiLine ? 32768 : 0;\n                var allowTrailingComma = languageVersion >= 1 ? 32 : 0;\n                emitList(node, properties, 978 | allowTrailingComma | preferNewLine);\n                if (indentedFlag) {\n                    decreaseIndent();\n                }\n            }\n        }\n        function emitPropertyAccessExpression(node) {\n            var indentBeforeDot = false;\n            var indentAfterDot = false;\n            if (!(ts.getEmitFlags(node) & 65536)) {\n                var dotRangeStart = node.expression.end;\n                var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1;\n                var dotToken = { kind: 22, pos: dotRangeStart, end: dotRangeEnd };\n                indentBeforeDot = needsIndentation(node, node.expression, dotToken);\n                indentAfterDot = needsIndentation(node, dotToken, node.name);\n            }\n            emitExpression(node.expression);\n            increaseIndentIf(indentBeforeDot);\n            var shouldEmitDotDot = !indentBeforeDot && needsDotDotForPropertyAccess(node.expression);\n            write(shouldEmitDotDot ? \"..\" : \".\");\n            increaseIndentIf(indentAfterDot);\n            emit(node.name);\n            decreaseIndentIf(indentBeforeDot, indentAfterDot);\n        }\n        function needsDotDotForPropertyAccess(expression) {\n            if (expression.kind === 8) {\n                var text = getLiteralTextOfNode(expression);\n                return text.indexOf(ts.tokenToString(22)) < 0;\n            }\n            else if (ts.isPropertyAccessExpression(expression) || ts.isElementAccessExpression(expression)) {\n                var constantValue = ts.getConstantValue(expression);\n                return isFinite(constantValue)\n                    && Math.floor(constantValue) === constantValue\n                    && compilerOptions.removeComments;\n            }\n        }\n        function emitElementAccessExpression(node) {\n            emitExpression(node.expression);\n            write(\"[\");\n            emitExpression(node.argumentExpression);\n            write(\"]\");\n        }\n        function emitCallExpression(node) {\n            emitExpression(node.expression);\n            emitTypeArguments(node, node.typeArguments);\n            emitExpressionList(node, node.arguments, 1296);\n        }\n        function emitNewExpression(node) {\n            write(\"new \");\n            emitExpression(node.expression);\n            emitTypeArguments(node, node.typeArguments);\n            emitExpressionList(node, node.arguments, 9488);\n        }\n        function emitTaggedTemplateExpression(node) {\n            emitExpression(node.tag);\n            write(\" \");\n            emitExpression(node.template);\n        }\n        function emitTypeAssertionExpression(node) {\n            if (node.type) {\n                write(\"<\");\n                emit(node.type);\n                write(\">\");\n            }\n            emitExpression(node.expression);\n        }\n        function emitParenthesizedExpression(node) {\n            write(\"(\");\n            emitExpression(node.expression);\n            write(\")\");\n        }\n        function emitFunctionExpression(node) {\n            emitFunctionDeclarationOrExpression(node);\n        }\n        function emitArrowFunction(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emitSignatureAndBody(node, emitArrowFunctionHead);\n        }\n        function emitArrowFunctionHead(node) {\n            emitTypeParameters(node, node.typeParameters);\n            emitParametersForArrow(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n            write(\" =>\");\n        }\n        function emitDeleteExpression(node) {\n            write(\"delete \");\n            emitExpression(node.expression);\n        }\n        function emitTypeOfExpression(node) {\n            write(\"typeof \");\n            emitExpression(node.expression);\n        }\n        function emitVoidExpression(node) {\n            write(\"void \");\n            emitExpression(node.expression);\n        }\n        function emitAwaitExpression(node) {\n            write(\"await \");\n            emitExpression(node.expression);\n        }\n        function emitPrefixUnaryExpression(node) {\n            writeTokenText(node.operator);\n            if (shouldEmitWhitespaceBeforeOperand(node)) {\n                write(\" \");\n            }\n            emitExpression(node.operand);\n        }\n        function shouldEmitWhitespaceBeforeOperand(node) {\n            var operand = node.operand;\n            return operand.kind === 190\n                && ((node.operator === 36 && (operand.operator === 36 || operand.operator === 42))\n                    || (node.operator === 37 && (operand.operator === 37 || operand.operator === 43)));\n        }\n        function emitPostfixUnaryExpression(node) {\n            emitExpression(node.operand);\n            writeTokenText(node.operator);\n        }\n        function emitBinaryExpression(node) {\n            var isCommaOperator = node.operatorToken.kind !== 25;\n            var indentBeforeOperator = needsIndentation(node, node.left, node.operatorToken);\n            var indentAfterOperator = needsIndentation(node, node.operatorToken, node.right);\n            emitExpression(node.left);\n            increaseIndentIf(indentBeforeOperator, isCommaOperator ? \" \" : undefined);\n            writeTokenText(node.operatorToken.kind);\n            increaseIndentIf(indentAfterOperator, \" \");\n            emitExpression(node.right);\n            decreaseIndentIf(indentBeforeOperator, indentAfterOperator);\n        }\n        function emitConditionalExpression(node) {\n            var indentBeforeQuestion = needsIndentation(node, node.condition, node.questionToken);\n            var indentAfterQuestion = needsIndentation(node, node.questionToken, node.whenTrue);\n            var indentBeforeColon = needsIndentation(node, node.whenTrue, node.colonToken);\n            var indentAfterColon = needsIndentation(node, node.colonToken, node.whenFalse);\n            emitExpression(node.condition);\n            increaseIndentIf(indentBeforeQuestion, \" \");\n            write(\"?\");\n            increaseIndentIf(indentAfterQuestion, \" \");\n            emitExpression(node.whenTrue);\n            decreaseIndentIf(indentBeforeQuestion, indentAfterQuestion);\n            increaseIndentIf(indentBeforeColon, \" \");\n            write(\":\");\n            increaseIndentIf(indentAfterColon, \" \");\n            emitExpression(node.whenFalse);\n            decreaseIndentIf(indentBeforeColon, indentAfterColon);\n        }\n        function emitTemplateExpression(node) {\n            emit(node.head);\n            emitList(node, node.templateSpans, 131072);\n        }\n        function emitYieldExpression(node) {\n            write(node.asteriskToken ? \"yield*\" : \"yield\");\n            emitExpressionWithPrefix(\" \", node.expression);\n        }\n        function emitSpreadExpression(node) {\n            write(\"...\");\n            emitExpression(node.expression);\n        }\n        function emitClassExpression(node) {\n            emitClassDeclarationOrExpression(node);\n        }\n        function emitExpressionWithTypeArguments(node) {\n            emitExpression(node.expression);\n            emitTypeArguments(node, node.typeArguments);\n        }\n        function emitAsExpression(node) {\n            emitExpression(node.expression);\n            if (node.type) {\n                write(\" as \");\n                emit(node.type);\n            }\n        }\n        function emitNonNullExpression(node) {\n            emitExpression(node.expression);\n            write(\"!\");\n        }\n        function emitTemplateSpan(node) {\n            emitExpression(node.expression);\n            emit(node.literal);\n        }\n        function emitBlock(node) {\n            if (isSingleLineEmptyBlock(node)) {\n                writeToken(16, node.pos, node);\n                write(\" \");\n                writeToken(17, node.statements.end, node);\n            }\n            else {\n                writeToken(16, node.pos, node);\n                emitBlockStatements(node);\n                writeToken(17, node.statements.end, node);\n            }\n        }\n        function emitBlockStatements(node) {\n            if (ts.getEmitFlags(node) & 1) {\n                emitList(node, node.statements, 384);\n            }\n            else {\n                emitList(node, node.statements, 65);\n            }\n        }\n        function emitVariableStatement(node) {\n            emitModifiers(node, node.modifiers);\n            emit(node.declarationList);\n            write(\";\");\n        }\n        function emitEmptyStatement() {\n            write(\";\");\n        }\n        function emitExpressionStatement(node) {\n            emitExpression(node.expression);\n            write(\";\");\n        }\n        function emitIfStatement(node) {\n            var openParenPos = writeToken(89, node.pos, node);\n            write(\" \");\n            writeToken(18, openParenPos, node);\n            emitExpression(node.expression);\n            writeToken(19, node.expression.end, node);\n            emitEmbeddedStatement(node.thenStatement);\n            if (node.elseStatement) {\n                writeLine();\n                writeToken(81, node.thenStatement.end, node);\n                if (node.elseStatement.kind === 208) {\n                    write(\" \");\n                    emit(node.elseStatement);\n                }\n                else {\n                    emitEmbeddedStatement(node.elseStatement);\n                }\n            }\n        }\n        function emitDoStatement(node) {\n            write(\"do\");\n            emitEmbeddedStatement(node.statement);\n            if (ts.isBlock(node.statement)) {\n                write(\" \");\n            }\n            else {\n                writeLine();\n            }\n            write(\"while (\");\n            emitExpression(node.expression);\n            write(\");\");\n        }\n        function emitWhileStatement(node) {\n            write(\"while (\");\n            emitExpression(node.expression);\n            write(\")\");\n            emitEmbeddedStatement(node.statement);\n        }\n        function emitForStatement(node) {\n            var openParenPos = writeToken(87, node.pos);\n            write(\" \");\n            writeToken(18, openParenPos, node);\n            emitForBinding(node.initializer);\n            write(\";\");\n            emitExpressionWithPrefix(\" \", node.condition);\n            write(\";\");\n            emitExpressionWithPrefix(\" \", node.incrementor);\n            write(\")\");\n            emitEmbeddedStatement(node.statement);\n        }\n        function emitForInStatement(node) {\n            var openParenPos = writeToken(87, node.pos);\n            write(\" \");\n            writeToken(18, openParenPos);\n            emitForBinding(node.initializer);\n            write(\" in \");\n            emitExpression(node.expression);\n            writeToken(19, node.expression.end);\n            emitEmbeddedStatement(node.statement);\n        }\n        function emitForOfStatement(node) {\n            var openParenPos = writeToken(87, node.pos);\n            write(\" \");\n            writeToken(18, openParenPos);\n            emitForBinding(node.initializer);\n            write(\" of \");\n            emitExpression(node.expression);\n            writeToken(19, node.expression.end);\n            emitEmbeddedStatement(node.statement);\n        }\n        function emitForBinding(node) {\n            if (node !== undefined) {\n                if (node.kind === 224) {\n                    emit(node);\n                }\n                else {\n                    emitExpression(node);\n                }\n            }\n        }\n        function emitContinueStatement(node) {\n            writeToken(76, node.pos);\n            emitWithPrefix(\" \", node.label);\n            write(\";\");\n        }\n        function emitBreakStatement(node) {\n            writeToken(71, node.pos);\n            emitWithPrefix(\" \", node.label);\n            write(\";\");\n        }\n        function emitReturnStatement(node) {\n            writeToken(95, node.pos, node);\n            emitExpressionWithPrefix(\" \", node.expression);\n            write(\";\");\n        }\n        function emitWithStatement(node) {\n            write(\"with (\");\n            emitExpression(node.expression);\n            write(\")\");\n            emitEmbeddedStatement(node.statement);\n        }\n        function emitSwitchStatement(node) {\n            var openParenPos = writeToken(97, node.pos);\n            write(\" \");\n            writeToken(18, openParenPos);\n            emitExpression(node.expression);\n            writeToken(19, node.expression.end);\n            write(\" \");\n            emit(node.caseBlock);\n        }\n        function emitLabeledStatement(node) {\n            emit(node.label);\n            write(\": \");\n            emit(node.statement);\n        }\n        function emitThrowStatement(node) {\n            write(\"throw\");\n            emitExpressionWithPrefix(\" \", node.expression);\n            write(\";\");\n        }\n        function emitTryStatement(node) {\n            write(\"try \");\n            emit(node.tryBlock);\n            emit(node.catchClause);\n            if (node.finallyBlock) {\n                writeLine();\n                write(\"finally \");\n                emit(node.finallyBlock);\n            }\n        }\n        function emitDebuggerStatement(node) {\n            writeToken(77, node.pos);\n            write(\";\");\n        }\n        function emitVariableDeclaration(node) {\n            emit(node.name);\n            emitWithPrefix(\": \", node.type);\n            emitExpressionWithPrefix(\" = \", node.initializer);\n        }\n        function emitVariableDeclarationList(node) {\n            write(ts.isLet(node) ? \"let \" : ts.isConst(node) ? \"const \" : \"var \");\n            emitList(node, node.declarations, 272);\n        }\n        function emitFunctionDeclaration(node) {\n            emitFunctionDeclarationOrExpression(node);\n        }\n        function emitFunctionDeclarationOrExpression(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(node.asteriskToken ? \"function* \" : \"function \");\n            emitIdentifierName(node.name);\n            emitSignatureAndBody(node, emitSignatureHead);\n        }\n        function emitSignatureAndBody(node, emitSignatureHead) {\n            var body = node.body;\n            if (body) {\n                if (ts.isBlock(body)) {\n                    var indentedFlag = ts.getEmitFlags(node) & 32768;\n                    if (indentedFlag) {\n                        increaseIndent();\n                    }\n                    if (ts.getEmitFlags(node) & 262144) {\n                        emitSignatureHead(node);\n                        emitBlockFunctionBody(body);\n                    }\n                    else {\n                        var savedTempFlags = tempFlags;\n                        tempFlags = 0;\n                        emitSignatureHead(node);\n                        emitBlockFunctionBody(body);\n                        tempFlags = savedTempFlags;\n                    }\n                    if (indentedFlag) {\n                        decreaseIndent();\n                    }\n                }\n                else {\n                    emitSignatureHead(node);\n                    write(\" \");\n                    emitExpression(body);\n                }\n            }\n            else {\n                emitSignatureHead(node);\n                write(\";\");\n            }\n        }\n        function emitSignatureHead(node) {\n            emitTypeParameters(node, node.typeParameters);\n            emitParameters(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n        }\n        function shouldEmitBlockFunctionBodyOnSingleLine(body) {\n            if (ts.getEmitFlags(body) & 1) {\n                return true;\n            }\n            if (body.multiLine) {\n                return false;\n            }\n            if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {\n                return false;\n            }\n            if (shouldWriteLeadingLineTerminator(body, body.statements, 2)\n                || shouldWriteClosingLineTerminator(body, body.statements, 2)) {\n                return false;\n            }\n            var previousStatement;\n            for (var _a = 0, _b = body.statements; _a < _b.length; _a++) {\n                var statement = _b[_a];\n                if (shouldWriteSeparatingLineTerminator(previousStatement, statement, 2)) {\n                    return false;\n                }\n                previousStatement = statement;\n            }\n            return true;\n        }\n        function emitBlockFunctionBody(body) {\n            write(\" {\");\n            increaseIndent();\n            emitBodyWithDetachedComments(body, body.statements, shouldEmitBlockFunctionBodyOnSingleLine(body)\n                ? emitBlockFunctionBodyOnSingleLine\n                : emitBlockFunctionBodyWorker);\n            decreaseIndent();\n            writeToken(17, body.statements.end, body);\n        }\n        function emitBlockFunctionBodyOnSingleLine(body) {\n            emitBlockFunctionBodyWorker(body, true);\n        }\n        function emitBlockFunctionBodyWorker(body, emitBlockFunctionBodyOnSingleLine) {\n            var statementOffset = emitPrologueDirectives(body.statements, true);\n            var helpersEmitted = emitHelpers(body);\n            if (statementOffset === 0 && !helpersEmitted && emitBlockFunctionBodyOnSingleLine) {\n                decreaseIndent();\n                emitList(body, body.statements, 384);\n                increaseIndent();\n            }\n            else {\n                emitList(body, body.statements, 1, statementOffset);\n            }\n        }\n        function emitClassDeclaration(node) {\n            emitClassDeclarationOrExpression(node);\n        }\n        function emitClassDeclarationOrExpression(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(\"class\");\n            emitNodeWithPrefix(\" \", node.name, emitIdentifierName);\n            var indentedFlag = ts.getEmitFlags(node) & 32768;\n            if (indentedFlag) {\n                increaseIndent();\n            }\n            emitTypeParameters(node, node.typeParameters);\n            emitList(node, node.heritageClauses, 256);\n            var savedTempFlags = tempFlags;\n            tempFlags = 0;\n            write(\" {\");\n            emitList(node, node.members, 65);\n            write(\"}\");\n            if (indentedFlag) {\n                decreaseIndent();\n            }\n            tempFlags = savedTempFlags;\n        }\n        function emitInterfaceDeclaration(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(\"interface \");\n            emit(node.name);\n            emitTypeParameters(node, node.typeParameters);\n            emitList(node, node.heritageClauses, 256);\n            write(\" {\");\n            emitList(node, node.members, 65);\n            write(\"}\");\n        }\n        function emitTypeAliasDeclaration(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(\"type \");\n            emit(node.name);\n            emitTypeParameters(node, node.typeParameters);\n            write(\" = \");\n            emit(node.type);\n            write(\";\");\n        }\n        function emitEnumDeclaration(node) {\n            emitModifiers(node, node.modifiers);\n            write(\"enum \");\n            emit(node.name);\n            var savedTempFlags = tempFlags;\n            tempFlags = 0;\n            write(\" {\");\n            emitList(node, node.members, 81);\n            write(\"}\");\n            tempFlags = savedTempFlags;\n        }\n        function emitModuleDeclaration(node) {\n            emitModifiers(node, node.modifiers);\n            write(node.flags & 16 ? \"namespace \" : \"module \");\n            emit(node.name);\n            var body = node.body;\n            while (body.kind === 230) {\n                write(\".\");\n                emit(body.name);\n                body = body.body;\n            }\n            write(\" \");\n            emit(body);\n        }\n        function emitModuleBlock(node) {\n            if (isEmptyBlock(node)) {\n                write(\"{ }\");\n            }\n            else {\n                var savedTempFlags = tempFlags;\n                tempFlags = 0;\n                write(\"{\");\n                increaseIndent();\n                emitBlockStatements(node);\n                write(\"}\");\n                tempFlags = savedTempFlags;\n            }\n        }\n        function emitCaseBlock(node) {\n            writeToken(16, node.pos);\n            emitList(node, node.clauses, 65);\n            writeToken(17, node.clauses.end);\n        }\n        function emitImportEqualsDeclaration(node) {\n            emitModifiers(node, node.modifiers);\n            write(\"import \");\n            emit(node.name);\n            write(\" = \");\n            emitModuleReference(node.moduleReference);\n            write(\";\");\n        }\n        function emitModuleReference(node) {\n            if (node.kind === 70) {\n                emitExpression(node);\n            }\n            else {\n                emit(node);\n            }\n        }\n        function emitImportDeclaration(node) {\n            emitModifiers(node, node.modifiers);\n            write(\"import \");\n            if (node.importClause) {\n                emit(node.importClause);\n                write(\" from \");\n            }\n            emitExpression(node.moduleSpecifier);\n            write(\";\");\n        }\n        function emitImportClause(node) {\n            emit(node.name);\n            if (node.name && node.namedBindings) {\n                write(\", \");\n            }\n            emit(node.namedBindings);\n        }\n        function emitNamespaceImport(node) {\n            write(\"* as \");\n            emit(node.name);\n        }\n        function emitNamedImports(node) {\n            emitNamedImportsOrExports(node);\n        }\n        function emitImportSpecifier(node) {\n            emitImportOrExportSpecifier(node);\n        }\n        function emitExportAssignment(node) {\n            write(node.isExportEquals ? \"export = \" : \"export default \");\n            emitExpression(node.expression);\n            write(\";\");\n        }\n        function emitExportDeclaration(node) {\n            write(\"export \");\n            if (node.exportClause) {\n                emit(node.exportClause);\n            }\n            else {\n                write(\"*\");\n            }\n            if (node.moduleSpecifier) {\n                write(\" from \");\n                emitExpression(node.moduleSpecifier);\n            }\n            write(\";\");\n        }\n        function emitNamedExports(node) {\n            emitNamedImportsOrExports(node);\n        }\n        function emitExportSpecifier(node) {\n            emitImportOrExportSpecifier(node);\n        }\n        function emitNamedImportsOrExports(node) {\n            write(\"{\");\n            emitList(node, node.elements, 432);\n            write(\"}\");\n        }\n        function emitImportOrExportSpecifier(node) {\n            if (node.propertyName) {\n                emit(node.propertyName);\n                write(\" as \");\n            }\n            emit(node.name);\n        }\n        function emitExternalModuleReference(node) {\n            write(\"require(\");\n            emitExpression(node.expression);\n            write(\")\");\n        }\n        function emitJsxElement(node) {\n            emit(node.openingElement);\n            emitList(node, node.children, 131072);\n            emit(node.closingElement);\n        }\n        function emitJsxSelfClosingElement(node) {\n            write(\"<\");\n            emitJsxTagName(node.tagName);\n            write(\" \");\n            emitList(node, node.attributes, 131328);\n            write(\"/>\");\n        }\n        function emitJsxOpeningElement(node) {\n            write(\"<\");\n            emitJsxTagName(node.tagName);\n            writeIfAny(node.attributes, \" \");\n            emitList(node, node.attributes, 131328);\n            write(\">\");\n        }\n        function emitJsxText(node) {\n            writer.writeLiteral(getTextOfNode(node, true));\n        }\n        function emitJsxClosingElement(node) {\n            write(\"</\");\n            emitJsxTagName(node.tagName);\n            write(\">\");\n        }\n        function emitJsxAttribute(node) {\n            emit(node.name);\n            emitWithPrefix(\"=\", node.initializer);\n        }\n        function emitJsxSpreadAttribute(node) {\n            write(\"{...\");\n            emitExpression(node.expression);\n            write(\"}\");\n        }\n        function emitJsxExpression(node) {\n            if (node.expression) {\n                write(\"{\");\n                emitExpression(node.expression);\n                write(\"}\");\n            }\n        }\n        function emitJsxTagName(node) {\n            if (node.kind === 70) {\n                emitExpression(node);\n            }\n            else {\n                emit(node);\n            }\n        }\n        function emitCaseClause(node) {\n            write(\"case \");\n            emitExpression(node.expression);\n            write(\":\");\n            emitCaseOrDefaultClauseStatements(node, node.statements);\n        }\n        function emitDefaultClause(node) {\n            write(\"default:\");\n            emitCaseOrDefaultClauseStatements(node, node.statements);\n        }\n        function emitCaseOrDefaultClauseStatements(parentNode, statements) {\n            var emitAsSingleStatement = statements.length === 1 &&\n                (ts.nodeIsSynthesized(parentNode) ||\n                    ts.nodeIsSynthesized(statements[0]) ||\n                    ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile));\n            if (emitAsSingleStatement) {\n                write(\" \");\n                emit(statements[0]);\n            }\n            else {\n                emitList(parentNode, statements, 81985);\n            }\n        }\n        function emitHeritageClause(node) {\n            write(\" \");\n            writeTokenText(node.token);\n            write(\" \");\n            emitList(node, node.types, 272);\n        }\n        function emitCatchClause(node) {\n            writeLine();\n            var openParenPos = writeToken(73, node.pos);\n            write(\" \");\n            writeToken(18, openParenPos);\n            emit(node.variableDeclaration);\n            writeToken(19, node.variableDeclaration ? node.variableDeclaration.end : openParenPos);\n            write(\" \");\n            emit(node.block);\n        }\n        function emitPropertyAssignment(node) {\n            emit(node.name);\n            write(\": \");\n            var initializer = node.initializer;\n            if ((ts.getEmitFlags(initializer) & 512) === 0) {\n                var commentRange = ts.getCommentRange(initializer);\n                emitTrailingCommentsOfPosition(commentRange.pos);\n            }\n            emitExpression(initializer);\n        }\n        function emitShorthandPropertyAssignment(node) {\n            emit(node.name);\n            if (node.objectAssignmentInitializer) {\n                write(\" = \");\n                emitExpression(node.objectAssignmentInitializer);\n            }\n        }\n        function emitSpreadAssignment(node) {\n            if (node.expression) {\n                write(\"...\");\n                emitExpression(node.expression);\n            }\n        }\n        function emitEnumMember(node) {\n            emit(node.name);\n            emitExpressionWithPrefix(\" = \", node.initializer);\n        }\n        function emitSourceFile(node) {\n            writeLine();\n            emitShebang();\n            emitBodyWithDetachedComments(node, node.statements, emitSourceFileWorker);\n        }\n        function emitSourceFileWorker(node) {\n            var statements = node.statements;\n            var statementOffset = emitPrologueDirectives(statements);\n            var savedTempFlags = tempFlags;\n            tempFlags = 0;\n            emitHelpers(node);\n            emitList(node, statements, 1, statementOffset);\n            tempFlags = savedTempFlags;\n        }\n        function emitPartiallyEmittedExpression(node) {\n            emitExpression(node.expression);\n        }\n        function emitPrologueDirectives(statements, startWithNewLine) {\n            for (var i = 0; i < statements.length; i++) {\n                if (ts.isPrologueDirective(statements[i])) {\n                    if (startWithNewLine || i > 0) {\n                        writeLine();\n                    }\n                    emit(statements[i]);\n                }\n                else {\n                    return i;\n                }\n            }\n            return statements.length;\n        }\n        function emitHelpers(node, isBundle) {\n            var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile;\n            var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined);\n            var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit;\n            var helpersEmitted = false;\n            var helpers = ts.getEmitHelpers(node);\n            if (helpers) {\n                for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) {\n                    var helper = _b[_a];\n                    if (!helper.scoped) {\n                        if (shouldSkip)\n                            continue;\n                        if (shouldBundle) {\n                            if (bundledHelpers[helper.name]) {\n                                continue;\n                            }\n                            bundledHelpers[helper.name] = true;\n                        }\n                    }\n                    else if (isBundle) {\n                        continue;\n                    }\n                    writeLines(helper.text);\n                    helpersEmitted = true;\n                }\n            }\n            if (helpersEmitted) {\n                writeLine();\n            }\n            return helpersEmitted;\n        }\n        function writeLines(text) {\n            var lines = text.split(/\\r\\n?|\\n/g);\n            var indentation = guessIndentation(lines);\n            for (var i = 0; i < lines.length; i++) {\n                var line = indentation ? lines[i].slice(indentation) : lines[i];\n                if (line.length) {\n                    if (i > 0) {\n                        writeLine();\n                    }\n                    write(line);\n                }\n            }\n        }\n        function guessIndentation(lines) {\n            var indentation;\n            for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) {\n                var line = lines_1[_a];\n                for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) {\n                    if (!ts.isWhiteSpace(line.charCodeAt(i))) {\n                        if (indentation === undefined || i < indentation) {\n                            indentation = i;\n                            break;\n                        }\n                    }\n                }\n            }\n            return indentation;\n        }\n        function emitShebang() {\n            var shebang = ts.getShebang(currentText);\n            if (shebang) {\n                write(shebang);\n                writeLine();\n            }\n        }\n        function emitModifiers(node, modifiers) {\n            if (modifiers && modifiers.length) {\n                emitList(node, modifiers, 256);\n                write(\" \");\n            }\n        }\n        function emitWithPrefix(prefix, node) {\n            emitNodeWithPrefix(prefix, node, emit);\n        }\n        function emitExpressionWithPrefix(prefix, node) {\n            emitNodeWithPrefix(prefix, node, emitExpression);\n        }\n        function emitNodeWithPrefix(prefix, node, emit) {\n            if (node) {\n                write(prefix);\n                emit(node);\n            }\n        }\n        function emitWithSuffix(node, suffix) {\n            if (node) {\n                emit(node);\n                write(suffix);\n            }\n        }\n        function emitEmbeddedStatement(node) {\n            if (ts.isBlock(node)) {\n                write(\" \");\n                emit(node);\n            }\n            else {\n                writeLine();\n                increaseIndent();\n                emit(node);\n                decreaseIndent();\n            }\n        }\n        function emitDecorators(parentNode, decorators) {\n            emitList(parentNode, decorators, 24577);\n        }\n        function emitTypeArguments(parentNode, typeArguments) {\n            emitList(parentNode, typeArguments, 26960);\n        }\n        function emitTypeParameters(parentNode, typeParameters) {\n            emitList(parentNode, typeParameters, 26960);\n        }\n        function emitParameters(parentNode, parameters) {\n            emitList(parentNode, parameters, 1360);\n        }\n        function emitParametersForArrow(parentNode, parameters) {\n            if (parameters &&\n                parameters.length === 1 &&\n                parameters[0].type === undefined &&\n                parameters[0].pos === parentNode.pos) {\n                emit(parameters[0]);\n            }\n            else {\n                emitParameters(parentNode, parameters);\n            }\n        }\n        function emitParametersForIndexSignature(parentNode, parameters) {\n            emitList(parentNode, parameters, 4432);\n        }\n        function emitList(parentNode, children, format, start, count) {\n            emitNodeList(emit, parentNode, children, format, start, count);\n        }\n        function emitExpressionList(parentNode, children, format, start, count) {\n            emitNodeList(emitExpression, parentNode, children, format, start, count);\n        }\n        function emitNodeList(emit, parentNode, children, format, start, count) {\n            if (start === void 0) { start = 0; }\n            if (count === void 0) { count = children ? children.length - start : 0; }\n            var isUndefined = children === undefined;\n            if (isUndefined && format & 8192) {\n                return;\n            }\n            var isEmpty = isUndefined || children.length === 0 || start >= children.length || count === 0;\n            if (isEmpty && format & 16384) {\n                return;\n            }\n            if (format & 7680) {\n                write(getOpeningBracket(format));\n            }\n            if (isEmpty) {\n                if (format & 1) {\n                    writeLine();\n                }\n                else if (format & 128) {\n                    write(\" \");\n                }\n            }\n            else {\n                var mayEmitInterveningComments = (format & 131072) === 0;\n                var shouldEmitInterveningComments = mayEmitInterveningComments;\n                if (shouldWriteLeadingLineTerminator(parentNode, children, format)) {\n                    writeLine();\n                    shouldEmitInterveningComments = false;\n                }\n                else if (format & 128) {\n                    write(\" \");\n                }\n                if (format & 64) {\n                    increaseIndent();\n                }\n                var previousSibling = void 0;\n                var shouldDecreaseIndentAfterEmit = void 0;\n                var delimiter = getDelimiter(format);\n                for (var i = 0; i < count; i++) {\n                    var child = children[start + i];\n                    if (previousSibling) {\n                        write(delimiter);\n                        if (shouldWriteSeparatingLineTerminator(previousSibling, child, format)) {\n                            if ((format & (3 | 64)) === 0) {\n                                increaseIndent();\n                                shouldDecreaseIndentAfterEmit = true;\n                            }\n                            writeLine();\n                            shouldEmitInterveningComments = false;\n                        }\n                        else if (previousSibling && format & 256) {\n                            write(\" \");\n                        }\n                    }\n                    if (shouldEmitInterveningComments) {\n                        var commentRange = ts.getCommentRange(child);\n                        emitTrailingCommentsOfPosition(commentRange.pos);\n                    }\n                    else {\n                        shouldEmitInterveningComments = mayEmitInterveningComments;\n                    }\n                    emit(child);\n                    if (shouldDecreaseIndentAfterEmit) {\n                        decreaseIndent();\n                        shouldDecreaseIndentAfterEmit = false;\n                    }\n                    previousSibling = child;\n                }\n                var hasTrailingComma = (format & 32) && children.hasTrailingComma;\n                if (format & 16 && hasTrailingComma) {\n                    write(\",\");\n                }\n                if (format & 64) {\n                    decreaseIndent();\n                }\n                if (shouldWriteClosingLineTerminator(parentNode, children, format)) {\n                    writeLine();\n                }\n                else if (format & 128) {\n                    write(\" \");\n                }\n            }\n            if (format & 7680) {\n                write(getClosingBracket(format));\n            }\n        }\n        function writeIfAny(nodes, text) {\n            if (nodes && nodes.length > 0) {\n                write(text);\n            }\n        }\n        function writeIfPresent(node, text) {\n            if (node !== undefined) {\n                write(text);\n            }\n        }\n        function writeToken(token, pos, contextNode) {\n            return emitTokenWithSourceMap(contextNode, token, pos, writeTokenText);\n        }\n        function writeTokenText(token, pos) {\n            var tokenString = ts.tokenToString(token);\n            write(tokenString);\n            return pos < 0 ? pos : pos + tokenString.length;\n        }\n        function increaseIndentIf(value, valueToWriteWhenNotIndenting) {\n            if (value) {\n                increaseIndent();\n                writeLine();\n            }\n            else if (valueToWriteWhenNotIndenting) {\n                write(valueToWriteWhenNotIndenting);\n            }\n        }\n        function decreaseIndentIf(value1, value2) {\n            if (value1) {\n                decreaseIndent();\n            }\n            if (value2) {\n                decreaseIndent();\n            }\n        }\n        function shouldWriteLeadingLineTerminator(parentNode, children, format) {\n            if (format & 1) {\n                return true;\n            }\n            if (format & 2) {\n                if (format & 32768) {\n                    return true;\n                }\n                var firstChild = children[0];\n                if (firstChild === undefined) {\n                    return !ts.rangeIsOnSingleLine(parentNode, currentSourceFile);\n                }\n                else if (ts.positionIsSynthesized(parentNode.pos) || ts.nodeIsSynthesized(firstChild)) {\n                    return synthesizedNodeStartsOnNewLine(firstChild, format);\n                }\n                else {\n                    return !ts.rangeStartPositionsAreOnSameLine(parentNode, firstChild, currentSourceFile);\n                }\n            }\n            else {\n                return false;\n            }\n        }\n        function shouldWriteSeparatingLineTerminator(previousNode, nextNode, format) {\n            if (format & 1) {\n                return true;\n            }\n            else if (format & 2) {\n                if (previousNode === undefined || nextNode === undefined) {\n                    return false;\n                }\n                else if (ts.nodeIsSynthesized(previousNode) || ts.nodeIsSynthesized(nextNode)) {\n                    return synthesizedNodeStartsOnNewLine(previousNode, format) || synthesizedNodeStartsOnNewLine(nextNode, format);\n                }\n                else {\n                    return !ts.rangeEndIsOnSameLineAsRangeStart(previousNode, nextNode, currentSourceFile);\n                }\n            }\n            else {\n                return nextNode.startsOnNewLine;\n            }\n        }\n        function shouldWriteClosingLineTerminator(parentNode, children, format) {\n            if (format & 1) {\n                return (format & 65536) === 0;\n            }\n            else if (format & 2) {\n                if (format & 32768) {\n                    return true;\n                }\n                var lastChild = ts.lastOrUndefined(children);\n                if (lastChild === undefined) {\n                    return !ts.rangeIsOnSingleLine(parentNode, currentSourceFile);\n                }\n                else if (ts.positionIsSynthesized(parentNode.pos) || ts.nodeIsSynthesized(lastChild)) {\n                    return synthesizedNodeStartsOnNewLine(lastChild, format);\n                }\n                else {\n                    return !ts.rangeEndPositionsAreOnSameLine(parentNode, lastChild, currentSourceFile);\n                }\n            }\n            else {\n                return false;\n            }\n        }\n        function synthesizedNodeStartsOnNewLine(node, format) {\n            if (ts.nodeIsSynthesized(node)) {\n                var startsOnNewLine = node.startsOnNewLine;\n                if (startsOnNewLine === undefined) {\n                    return (format & 32768) !== 0;\n                }\n                return startsOnNewLine;\n            }\n            return (format & 32768) !== 0;\n        }\n        function needsIndentation(parent, node1, node2) {\n            parent = skipSynthesizedParentheses(parent);\n            node1 = skipSynthesizedParentheses(node1);\n            node2 = skipSynthesizedParentheses(node2);\n            if (node2.startsOnNewLine) {\n                return true;\n            }\n            return !ts.nodeIsSynthesized(parent)\n                && !ts.nodeIsSynthesized(node1)\n                && !ts.nodeIsSynthesized(node2)\n                && !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile);\n        }\n        function skipSynthesizedParentheses(node) {\n            while (node.kind === 183 && ts.nodeIsSynthesized(node)) {\n                node = node.expression;\n            }\n            return node;\n        }\n        function getTextOfNode(node, includeTrivia) {\n            if (ts.isGeneratedIdentifier(node)) {\n                return getGeneratedIdentifier(node);\n            }\n            else if (ts.isIdentifier(node) && (ts.nodeIsSynthesized(node) || !node.parent)) {\n                return ts.unescapeIdentifier(node.text);\n            }\n            else if (node.kind === 9 && node.textSourceNode) {\n                return getTextOfNode(node.textSourceNode, includeTrivia);\n            }\n            else if (ts.isLiteralExpression(node) && (ts.nodeIsSynthesized(node) || !node.parent)) {\n                return node.text;\n            }\n            return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node, includeTrivia);\n        }\n        function getLiteralTextOfNode(node) {\n            if (node.kind === 9 && node.textSourceNode) {\n                var textSourceNode = node.textSourceNode;\n                if (ts.isIdentifier(textSourceNode)) {\n                    return \"\\\"\" + ts.escapeNonAsciiCharacters(ts.escapeString(getTextOfNode(textSourceNode))) + \"\\\"\";\n                }\n                else {\n                    return getLiteralTextOfNode(textSourceNode);\n                }\n            }\n            return ts.getLiteralText(node, currentSourceFile, languageVersion);\n        }\n        function isSingleLineEmptyBlock(block) {\n            return !block.multiLine\n                && isEmptyBlock(block);\n        }\n        function isEmptyBlock(block) {\n            return block.statements.length === 0\n                && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);\n        }\n        function isUniqueName(name) {\n            return !resolver.hasGlobalName(name) &&\n                !ts.hasProperty(currentFileIdentifiers, name) &&\n                !ts.hasProperty(generatedNameSet, name);\n        }\n        function isUniqueLocalName(name, container) {\n            for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) {\n                if (node.locals && ts.hasProperty(node.locals, name)) {\n                    if (node.locals[name].flags & (107455 | 1048576 | 8388608)) {\n                        return false;\n                    }\n                }\n            }\n            return true;\n        }\n        function makeTempVariableName(flags) {\n            if (flags && !(tempFlags & flags)) {\n                var name_42 = flags === 268435456 ? \"_i\" : \"_n\";\n                if (isUniqueName(name_42)) {\n                    tempFlags |= flags;\n                    return name_42;\n                }\n            }\n            while (true) {\n                var count = tempFlags & 268435455;\n                tempFlags++;\n                if (count !== 8 && count !== 13) {\n                    var name_43 = count < 26\n                        ? \"_\" + String.fromCharCode(97 + count)\n                        : \"_\" + (count - 26);\n                    if (isUniqueName(name_43)) {\n                        return name_43;\n                    }\n                }\n            }\n        }\n        function makeUniqueName(baseName) {\n            if (baseName.charCodeAt(baseName.length - 1) !== 95) {\n                baseName += \"_\";\n            }\n            var i = 1;\n            while (true) {\n                var generatedName = baseName + i;\n                if (isUniqueName(generatedName)) {\n                    return generatedNameSet[generatedName] = generatedName;\n                }\n                i++;\n            }\n        }\n        function generateNameForModuleOrEnum(node) {\n            var name = getTextOfNode(node.name);\n            return isUniqueLocalName(name, node) ? name : makeUniqueName(name);\n        }\n        function generateNameForImportOrExportDeclaration(node) {\n            var expr = ts.getExternalModuleName(node);\n            var baseName = expr.kind === 9 ?\n                ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : \"module\";\n            return makeUniqueName(baseName);\n        }\n        function generateNameForExportDefault() {\n            return makeUniqueName(\"default\");\n        }\n        function generateNameForClassExpression() {\n            return makeUniqueName(\"class\");\n        }\n        function generateNameForNode(node) {\n            switch (node.kind) {\n                case 70:\n                    return makeUniqueName(getTextOfNode(node));\n                case 230:\n                case 229:\n                    return generateNameForModuleOrEnum(node);\n                case 235:\n                case 241:\n                    return generateNameForImportOrExportDeclaration(node);\n                case 225:\n                case 226:\n                case 240:\n                    return generateNameForExportDefault();\n                case 197:\n                    return generateNameForClassExpression();\n                default:\n                    return makeTempVariableName(0);\n            }\n        }\n        function generateName(name) {\n            switch (name.autoGenerateKind) {\n                case 1:\n                    return makeTempVariableName(0);\n                case 2:\n                    return makeTempVariableName(268435456);\n                case 3:\n                    return makeUniqueName(name.text);\n            }\n            ts.Debug.fail(\"Unsupported GeneratedIdentifierKind.\");\n        }\n        function getNodeForGeneratedName(name) {\n            var autoGenerateId = name.autoGenerateId;\n            var node = name;\n            var original = node.original;\n            while (original) {\n                node = original;\n                if (ts.isIdentifier(node)\n                    && node.autoGenerateKind === 4\n                    && node.autoGenerateId !== autoGenerateId) {\n                    break;\n                }\n                original = node.original;\n            }\n            return node;\n        }\n        function getGeneratedIdentifier(name) {\n            if (name.autoGenerateKind === 4) {\n                var node = getNodeForGeneratedName(name);\n                var nodeId = ts.getNodeId(node);\n                return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node)));\n            }\n            else {\n                var autoGenerateId = name.autoGenerateId;\n                return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = ts.unescapeIdentifier(generateName(name)));\n            }\n        }\n        function createDelimiterMap() {\n            var delimiters = [];\n            delimiters[0] = \"\";\n            delimiters[16] = \",\";\n            delimiters[4] = \" |\";\n            delimiters[8] = \" &\";\n            return delimiters;\n        }\n        function getDelimiter(format) {\n            return delimiters[format & 28];\n        }\n        function createBracketsMap() {\n            var brackets = [];\n            brackets[512] = [\"{\", \"}\"];\n            brackets[1024] = [\"(\", \")\"];\n            brackets[2048] = [\"<\", \">\"];\n            brackets[4096] = [\"[\", \"]\"];\n            return brackets;\n        }\n        function getOpeningBracket(format) {\n            return brackets[format & 7680][0];\n        }\n        function getClosingBracket(format) {\n            return brackets[format & 7680][1];\n        }\n    }\n    ts.emitFiles = emitFiles;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var emptyArray = [];\n    function findConfigFile(searchPath, fileExists, configName) {\n        if (configName === void 0) { configName = \"tsconfig.json\"; }\n        while (true) {\n            var fileName = ts.combinePaths(searchPath, configName);\n            if (fileExists(fileName)) {\n                return fileName;\n            }\n            var parentPath = ts.getDirectoryPath(searchPath);\n            if (parentPath === searchPath) {\n                break;\n            }\n            searchPath = parentPath;\n        }\n        return undefined;\n    }\n    ts.findConfigFile = findConfigFile;\n    function resolveTripleslashReference(moduleName, containingFile) {\n        var basePath = ts.getDirectoryPath(containingFile);\n        var referencedFileName = ts.isRootedDiskPath(moduleName) ? moduleName : ts.combinePaths(basePath, moduleName);\n        return ts.normalizePath(referencedFileName);\n    }\n    ts.resolveTripleslashReference = resolveTripleslashReference;\n    function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) {\n        var commonPathComponents;\n        var failed = ts.forEach(fileNames, function (sourceFile) {\n            var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile, currentDirectory);\n            sourcePathComponents.pop();\n            if (!commonPathComponents) {\n                commonPathComponents = sourcePathComponents;\n                return;\n            }\n            for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) {\n                if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) {\n                    if (i === 0) {\n                        return true;\n                    }\n                    commonPathComponents.length = i;\n                    break;\n                }\n            }\n            if (sourcePathComponents.length < commonPathComponents.length) {\n                commonPathComponents.length = sourcePathComponents.length;\n            }\n        });\n        if (failed) {\n            return \"\";\n        }\n        if (!commonPathComponents) {\n            return currentDirectory;\n        }\n        return ts.getNormalizedPathFromPathComponents(commonPathComponents);\n    }\n    ts.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames;\n    function createCompilerHost(options, setParentNodes) {\n        var existingDirectories = ts.createMap();\n        function getCanonicalFileName(fileName) {\n            return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();\n        }\n        var unsupportedFileEncodingErrorCode = -2147024809;\n        function getSourceFile(fileName, languageVersion, onError) {\n            var text;\n            try {\n                ts.performance.mark(\"beforeIORead\");\n                text = ts.sys.readFile(fileName, options.charset);\n                ts.performance.mark(\"afterIORead\");\n                ts.performance.measure(\"I/O Read\", \"beforeIORead\", \"afterIORead\");\n            }\n            catch (e) {\n                if (onError) {\n                    onError(e.number === unsupportedFileEncodingErrorCode\n                        ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText\n                        : e.message);\n                }\n                text = \"\";\n            }\n            return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined;\n        }\n        function directoryExists(directoryPath) {\n            if (directoryPath in existingDirectories) {\n                return true;\n            }\n            if (ts.sys.directoryExists(directoryPath)) {\n                existingDirectories[directoryPath] = true;\n                return true;\n            }\n            return false;\n        }\n        function ensureDirectoriesExist(directoryPath) {\n            if (directoryPath.length > ts.getRootLength(directoryPath) && !directoryExists(directoryPath)) {\n                var parentDirectory = ts.getDirectoryPath(directoryPath);\n                ensureDirectoriesExist(parentDirectory);\n                ts.sys.createDirectory(directoryPath);\n            }\n        }\n        var outputFingerprints;\n        function writeFileIfUpdated(fileName, data, writeByteOrderMark) {\n            if (!outputFingerprints) {\n                outputFingerprints = ts.createMap();\n            }\n            var hash = ts.sys.createHash(data);\n            var mtimeBefore = ts.sys.getModifiedTime(fileName);\n            if (mtimeBefore && fileName in outputFingerprints) {\n                var fingerprint = outputFingerprints[fileName];\n                if (fingerprint.byteOrderMark === writeByteOrderMark &&\n                    fingerprint.hash === hash &&\n                    fingerprint.mtime.getTime() === mtimeBefore.getTime()) {\n                    return;\n                }\n            }\n            ts.sys.writeFile(fileName, data, writeByteOrderMark);\n            var mtimeAfter = ts.sys.getModifiedTime(fileName);\n            outputFingerprints[fileName] = {\n                hash: hash,\n                byteOrderMark: writeByteOrderMark,\n                mtime: mtimeAfter\n            };\n        }\n        function writeFile(fileName, data, writeByteOrderMark, onError) {\n            try {\n                ts.performance.mark(\"beforeIOWrite\");\n                ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName)));\n                if (ts.isWatchSet(options) && ts.sys.createHash && ts.sys.getModifiedTime) {\n                    writeFileIfUpdated(fileName, data, writeByteOrderMark);\n                }\n                else {\n                    ts.sys.writeFile(fileName, data, writeByteOrderMark);\n                }\n                ts.performance.mark(\"afterIOWrite\");\n                ts.performance.measure(\"I/O Write\", \"beforeIOWrite\", \"afterIOWrite\");\n            }\n            catch (e) {\n                if (onError) {\n                    onError(e.message);\n                }\n            }\n        }\n        function getDefaultLibLocation() {\n            return ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath()));\n        }\n        var newLine = ts.getNewLineCharacter(options);\n        var realpath = ts.sys.realpath && (function (path) { return ts.sys.realpath(path); });\n        return {\n            getSourceFile: getSourceFile,\n            getDefaultLibLocation: getDefaultLibLocation,\n            getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); },\n            writeFile: writeFile,\n            getCurrentDirectory: ts.memoize(function () { return ts.sys.getCurrentDirectory(); }),\n            useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; },\n            getCanonicalFileName: getCanonicalFileName,\n            getNewLine: function () { return newLine; },\n            fileExists: function (fileName) { return ts.sys.fileExists(fileName); },\n            readFile: function (fileName) { return ts.sys.readFile(fileName); },\n            trace: function (s) { return ts.sys.write(s + newLine); },\n            directoryExists: function (directoryName) { return ts.sys.directoryExists(directoryName); },\n            getEnvironmentVariable: function (name) { return ts.sys.getEnvironmentVariable ? ts.sys.getEnvironmentVariable(name) : \"\"; },\n            getDirectories: function (path) { return ts.sys.getDirectories(path); },\n            realpath: realpath\n        };\n    }\n    ts.createCompilerHost = createCompilerHost;\n    function getPreEmitDiagnostics(program, sourceFile, cancellationToken) {\n        var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken));\n        if (program.getCompilerOptions().declaration) {\n            diagnostics = diagnostics.concat(program.getDeclarationDiagnostics(sourceFile, cancellationToken));\n        }\n        return ts.sortAndDeduplicateDiagnostics(diagnostics);\n    }\n    ts.getPreEmitDiagnostics = getPreEmitDiagnostics;\n    function formatDiagnostics(diagnostics, host) {\n        var output = \"\";\n        for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {\n            var diagnostic = diagnostics_1[_i];\n            if (diagnostic.file) {\n                var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character;\n                var fileName = diagnostic.file.fileName;\n                var relativeFileName = ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); });\n                output += relativeFileName + \"(\" + (line + 1) + \",\" + (character + 1) + \"): \";\n            }\n            var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();\n            output += category + \" TS\" + diagnostic.code + \": \" + flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()) + host.getNewLine();\n        }\n        return output;\n    }\n    ts.formatDiagnostics = formatDiagnostics;\n    function flattenDiagnosticMessageText(messageText, newLine) {\n        if (typeof messageText === \"string\") {\n            return messageText;\n        }\n        else {\n            var diagnosticChain = messageText;\n            var result = \"\";\n            var indent = 0;\n            while (diagnosticChain) {\n                if (indent) {\n                    result += newLine;\n                    for (var i = 0; i < indent; i++) {\n                        result += \"  \";\n                    }\n                }\n                result += diagnosticChain.messageText;\n                indent++;\n                diagnosticChain = diagnosticChain.next;\n            }\n            return result;\n        }\n    }\n    ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText;\n    function loadWithLocalCache(names, containingFile, loader) {\n        if (names.length === 0) {\n            return [];\n        }\n        var resolutions = [];\n        var cache = ts.createMap();\n        for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {\n            var name_44 = names_1[_i];\n            var result = name_44 in cache\n                ? cache[name_44]\n                : cache[name_44] = loader(name_44, containingFile);\n            resolutions.push(result);\n        }\n        return resolutions;\n    }\n    function createProgram(rootNames, options, host, oldProgram) {\n        var program;\n        var files = [];\n        var commonSourceDirectory;\n        var diagnosticsProducingTypeChecker;\n        var noDiagnosticsTypeChecker;\n        var classifiableNames;\n        var resolvedTypeReferenceDirectives = ts.createMap();\n        var fileProcessingDiagnostics = ts.createDiagnosticCollection();\n        var maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === \"number\" ? options.maxNodeModuleJsDepth : 0;\n        var currentNodeModulesDepth = 0;\n        var modulesWithElidedImports = ts.createMap();\n        var sourceFilesFoundSearchingNodeModules = ts.createMap();\n        ts.performance.mark(\"beforeProgram\");\n        host = host || createCompilerHost(options);\n        var skipDefaultLib = options.noLib;\n        var programDiagnostics = ts.createDiagnosticCollection();\n        var currentDirectory = host.getCurrentDirectory();\n        var supportedExtensions = ts.getSupportedExtensions(options);\n        var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName);\n        var resolveModuleNamesWorker;\n        if (host.resolveModuleNames) {\n            resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile).map(function (resolved) {\n                if (!resolved || resolved.extension !== undefined) {\n                    return resolved;\n                }\n                var withExtension = ts.clone(resolved);\n                withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName);\n                return withExtension;\n            }); };\n        }\n        else {\n            var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host).resolvedModule; };\n            resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); };\n        }\n        var resolveTypeReferenceDirectiveNamesWorker;\n        if (host.resolveTypeReferenceDirectives) {\n            resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); };\n        }\n        else {\n            var loader_2 = function (typesRef, containingFile) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; };\n            resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader_2); };\n        }\n        var filesByName = ts.createFileMap();\n        var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined;\n        if (!tryReuseStructureFromOldProgram()) {\n            ts.forEach(rootNames, function (name) { return processRootFile(name, false); });\n            var typeReferences = ts.getAutomaticTypeDirectiveNames(options, host);\n            if (typeReferences.length) {\n                var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();\n                var containingFilename = ts.combinePaths(containingDirectory, \"__inferred type names__.ts\");\n                var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);\n                for (var i = 0; i < typeReferences.length; i++) {\n                    processTypeReferenceDirective(typeReferences[i], resolutions[i]);\n                }\n            }\n            if (!skipDefaultLib) {\n                if (!options.lib) {\n                    processRootFile(host.getDefaultLibFileName(options), true);\n                }\n                else {\n                    var libDirectory_1 = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(host.getDefaultLibFileName(options));\n                    ts.forEach(options.lib, function (libFileName) {\n                        processRootFile(ts.combinePaths(libDirectory_1, libFileName), true);\n                    });\n                }\n            }\n        }\n        oldProgram = undefined;\n        program = {\n            getRootFileNames: function () { return rootNames; },\n            getSourceFile: getSourceFile,\n            getSourceFileByPath: getSourceFileByPath,\n            getSourceFiles: function () { return files; },\n            getCompilerOptions: function () { return options; },\n            getSyntacticDiagnostics: getSyntacticDiagnostics,\n            getOptionsDiagnostics: getOptionsDiagnostics,\n            getGlobalDiagnostics: getGlobalDiagnostics,\n            getSemanticDiagnostics: getSemanticDiagnostics,\n            getDeclarationDiagnostics: getDeclarationDiagnostics,\n            getTypeChecker: getTypeChecker,\n            getClassifiableNames: getClassifiableNames,\n            getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker,\n            getCommonSourceDirectory: getCommonSourceDirectory,\n            emit: emit,\n            getCurrentDirectory: function () { return currentDirectory; },\n            getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); },\n            getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); },\n            getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); },\n            getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },\n            getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },\n            getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },\n            isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,\n            dropDiagnosticsProducingTypeChecker: dropDiagnosticsProducingTypeChecker\n        };\n        verifyCompilerOptions();\n        ts.performance.mark(\"afterProgram\");\n        ts.performance.measure(\"Program\", \"beforeProgram\", \"afterProgram\");\n        return program;\n        function getCommonSourceDirectory() {\n            if (commonSourceDirectory === undefined) {\n                var emittedFiles = ts.filterSourceFilesInDirectory(files, isSourceFileFromExternalLibrary);\n                if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) {\n                    commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory);\n                }\n                else {\n                    commonSourceDirectory = computeCommonSourceDirectory(emittedFiles);\n                }\n                if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) {\n                    commonSourceDirectory += ts.directorySeparator;\n                }\n            }\n            return commonSourceDirectory;\n        }\n        function getClassifiableNames() {\n            if (!classifiableNames) {\n                getTypeChecker();\n                classifiableNames = ts.createMap();\n                for (var _i = 0, files_2 = files; _i < files_2.length; _i++) {\n                    var sourceFile = files_2[_i];\n                    ts.copyProperties(sourceFile.classifiableNames, classifiableNames);\n                }\n            }\n            return classifiableNames;\n        }\n        function resolveModuleNamesReusingOldState(moduleNames, containingFile, file, oldProgramState) {\n            if (!oldProgramState && !file.ambientModuleNames.length) {\n                return resolveModuleNamesWorker(moduleNames, containingFile);\n            }\n            var unknownModuleNames;\n            var result;\n            var predictedToResolveToAmbientModuleMarker = {};\n            for (var i = 0; i < moduleNames.length; i++) {\n                var moduleName = moduleNames[i];\n                var isKnownToResolveToAmbientModule = false;\n                if (ts.contains(file.ambientModuleNames, moduleName)) {\n                    isKnownToResolveToAmbientModule = true;\n                    if (ts.isTraceEnabled(options, host)) {\n                        ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName, containingFile);\n                    }\n                }\n                else {\n                    isKnownToResolveToAmbientModule = checkModuleNameResolvedToAmbientModuleInNonModifiedFile(moduleName, oldProgramState);\n                }\n                if (isKnownToResolveToAmbientModule) {\n                    if (!unknownModuleNames) {\n                        result = new Array(moduleNames.length);\n                        unknownModuleNames = moduleNames.slice(0, i);\n                    }\n                    result[i] = predictedToResolveToAmbientModuleMarker;\n                }\n                else if (unknownModuleNames) {\n                    unknownModuleNames.push(moduleName);\n                }\n            }\n            if (!unknownModuleNames) {\n                return resolveModuleNamesWorker(moduleNames, containingFile);\n            }\n            var resolutions = unknownModuleNames.length\n                ? resolveModuleNamesWorker(unknownModuleNames, containingFile)\n                : emptyArray;\n            var j = 0;\n            for (var i = 0; i < result.length; i++) {\n                if (result[i] == predictedToResolveToAmbientModuleMarker) {\n                    result[i] = undefined;\n                }\n                else {\n                    result[i] = resolutions[j];\n                    j++;\n                }\n            }\n            ts.Debug.assert(j === resolutions.length);\n            return result;\n            function checkModuleNameResolvedToAmbientModuleInNonModifiedFile(moduleName, oldProgramState) {\n                if (!oldProgramState) {\n                    return false;\n                }\n                var resolutionToFile = ts.getResolvedModule(oldProgramState.file, moduleName);\n                if (resolutionToFile) {\n                    return false;\n                }\n                var ambientModule = oldProgram.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(moduleName);\n                if (!(ambientModule && ambientModule.declarations)) {\n                    return false;\n                }\n                var firstUnmodifiedFile = ts.forEach(ambientModule.declarations, function (d) {\n                    var f = ts.getSourceFileOfNode(d);\n                    return !ts.contains(oldProgramState.modifiedFilePaths, f.path) && f;\n                });\n                if (!firstUnmodifiedFile) {\n                    return false;\n                }\n                if (ts.isTraceEnabled(options, host)) {\n                    ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName, firstUnmodifiedFile.fileName);\n                }\n                return true;\n            }\n        }\n        function tryReuseStructureFromOldProgram() {\n            if (!oldProgram) {\n                return false;\n            }\n            var oldOptions = oldProgram.getCompilerOptions();\n            if (ts.changesAffectModuleResolution(oldOptions, options)) {\n                return false;\n            }\n            ts.Debug.assert(!oldProgram.structureIsReused);\n            var oldRootNames = oldProgram.getRootFileNames();\n            if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) {\n                return false;\n            }\n            if (!ts.arrayIsEqualTo(options.types, oldOptions.types)) {\n                return false;\n            }\n            var newSourceFiles = [];\n            var filePaths = [];\n            var modifiedSourceFiles = [];\n            for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) {\n                var oldSourceFile = _a[_i];\n                var newSourceFile = host.getSourceFileByPath\n                    ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.path, options.target)\n                    : host.getSourceFile(oldSourceFile.fileName, options.target);\n                if (!newSourceFile) {\n                    return false;\n                }\n                newSourceFile.path = oldSourceFile.path;\n                filePaths.push(newSourceFile.path);\n                if (oldSourceFile !== newSourceFile) {\n                    if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {\n                        return false;\n                    }\n                    if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {\n                        return false;\n                    }\n                    collectExternalModuleReferences(newSourceFile);\n                    if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {\n                        return false;\n                    }\n                    if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {\n                        return false;\n                    }\n                    if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {\n                        return false;\n                    }\n                    modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });\n                }\n                else {\n                    newSourceFile = oldSourceFile;\n                }\n                newSourceFiles.push(newSourceFile);\n            }\n            var modifiedFilePaths = modifiedSourceFiles.map(function (f) { return f.newFile.path; });\n            for (var _b = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _b < modifiedSourceFiles_1.length; _b++) {\n                var _c = modifiedSourceFiles_1[_b], oldSourceFile = _c.oldFile, newSourceFile = _c.newFile;\n                var newSourceFilePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory);\n                if (resolveModuleNamesWorker) {\n                    var moduleNames = ts.map(ts.concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral);\n                    var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFilePath, newSourceFile, { file: oldSourceFile, program: oldProgram, modifiedFilePaths: modifiedFilePaths });\n                    var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo);\n                    if (resolutionsChanged) {\n                        return false;\n                    }\n                }\n                if (resolveTypeReferenceDirectiveNamesWorker) {\n                    var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (x) { return x.fileName; });\n                    var resolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFilePath);\n                    var resolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo);\n                    if (resolutionsChanged) {\n                        return false;\n                    }\n                }\n                newSourceFile.resolvedModules = oldSourceFile.resolvedModules;\n                newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;\n            }\n            for (var i = 0, len = newSourceFiles.length; i < len; i++) {\n                filesByName.set(filePaths[i], newSourceFiles[i]);\n            }\n            files = newSourceFiles;\n            fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();\n            for (var _d = 0, modifiedSourceFiles_2 = modifiedSourceFiles; _d < modifiedSourceFiles_2.length; _d++) {\n                var modifiedFile = modifiedSourceFiles_2[_d];\n                fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile.newFile);\n            }\n            resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();\n            oldProgram.structureIsReused = true;\n            return true;\n        }\n        function getEmitHost(writeFileCallback) {\n            return {\n                getCanonicalFileName: getCanonicalFileName,\n                getCommonSourceDirectory: program.getCommonSourceDirectory,\n                getCompilerOptions: program.getCompilerOptions,\n                getCurrentDirectory: function () { return currentDirectory; },\n                getNewLine: function () { return host.getNewLine(); },\n                getSourceFile: program.getSourceFile,\n                getSourceFileByPath: program.getSourceFileByPath,\n                getSourceFiles: program.getSourceFiles,\n                isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,\n                writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }),\n                isEmitBlocked: isEmitBlocked,\n            };\n        }\n        function isSourceFileFromExternalLibrary(file) {\n            return sourceFilesFoundSearchingNodeModules[file.path];\n        }\n        function getDiagnosticsProducingTypeChecker() {\n            return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true));\n        }\n        function dropDiagnosticsProducingTypeChecker() {\n            diagnosticsProducingTypeChecker = undefined;\n        }\n        function getTypeChecker() {\n            return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false));\n        }\n        function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) {\n            return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles); });\n        }\n        function isEmitBlocked(emitFileName) {\n            return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName));\n        }\n        function emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) {\n            var declarationDiagnostics = [];\n            if (options.noEmit) {\n                return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true };\n            }\n            if (options.noEmitOnError) {\n                var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken));\n                if (diagnostics.length === 0 && program.getCompilerOptions().declaration) {\n                    declarationDiagnostics = program.getDeclarationDiagnostics(undefined, cancellationToken);\n                }\n                if (diagnostics.length > 0 || declarationDiagnostics.length > 0) {\n                    return {\n                        diagnostics: ts.concatenate(diagnostics, declarationDiagnostics),\n                        sourceMaps: undefined,\n                        emittedFiles: undefined,\n                        emitSkipped: true\n                    };\n                }\n            }\n            var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile);\n            ts.performance.mark(\"beforeEmit\");\n            var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles);\n            ts.performance.mark(\"afterEmit\");\n            ts.performance.measure(\"Emit\", \"beforeEmit\", \"afterEmit\");\n            return emitResult;\n        }\n        function getSourceFile(fileName) {\n            return getSourceFileByPath(ts.toPath(fileName, currentDirectory, getCanonicalFileName));\n        }\n        function getSourceFileByPath(path) {\n            return filesByName.get(path);\n        }\n        function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) {\n            if (sourceFile) {\n                return getDiagnostics(sourceFile, cancellationToken);\n            }\n            var allDiagnostics = [];\n            ts.forEach(program.getSourceFiles(), function (sourceFile) {\n                if (cancellationToken) {\n                    cancellationToken.throwIfCancellationRequested();\n                }\n                ts.addRange(allDiagnostics, getDiagnostics(sourceFile, cancellationToken));\n            });\n            return ts.sortAndDeduplicateDiagnostics(allDiagnostics);\n        }\n        function getSyntacticDiagnostics(sourceFile, cancellationToken) {\n            return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken);\n        }\n        function getSemanticDiagnostics(sourceFile, cancellationToken) {\n            return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken);\n        }\n        function getDeclarationDiagnostics(sourceFile, cancellationToken) {\n            var options = program.getCompilerOptions();\n            if (!sourceFile || options.out || options.outFile) {\n                return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);\n            }\n            else {\n                return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken);\n            }\n        }\n        function getSyntacticDiagnosticsForFile(sourceFile) {\n            if (ts.isSourceFileJavaScript(sourceFile)) {\n                if (!sourceFile.additionalSyntacticDiagnostics) {\n                    sourceFile.additionalSyntacticDiagnostics = getJavaScriptSyntacticDiagnosticsForFile(sourceFile);\n                }\n                return ts.concatenate(sourceFile.additionalSyntacticDiagnostics, sourceFile.parseDiagnostics);\n            }\n            return sourceFile.parseDiagnostics;\n        }\n        function runWithCancellationToken(func) {\n            try {\n                return func();\n            }\n            catch (e) {\n                if (e instanceof ts.OperationCanceledException) {\n                    noDiagnosticsTypeChecker = undefined;\n                    diagnosticsProducingTypeChecker = undefined;\n                }\n                throw e;\n            }\n        }\n        function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) {\n            return runWithCancellationToken(function () {\n                var typeChecker = getDiagnosticsProducingTypeChecker();\n                ts.Debug.assert(!!sourceFile.bindDiagnostics);\n                var bindDiagnostics = sourceFile.bindDiagnostics;\n                var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ? [] : typeChecker.getDiagnostics(sourceFile, cancellationToken);\n                var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName);\n                var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);\n                return bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile);\n            });\n        }\n        function getJavaScriptSyntacticDiagnosticsForFile(sourceFile) {\n            return runWithCancellationToken(function () {\n                var diagnostics = [];\n                var parent = sourceFile;\n                walk(sourceFile);\n                return diagnostics;\n                function walk(node) {\n                    switch (parent.kind) {\n                        case 144:\n                        case 147:\n                            if (parent.questionToken === node) {\n                                diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, \"?\"));\n                                return;\n                            }\n                        case 149:\n                        case 148:\n                        case 150:\n                        case 151:\n                        case 152:\n                        case 184:\n                        case 225:\n                        case 185:\n                        case 225:\n                        case 223:\n                            if (parent.type === node) {\n                                diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                    }\n                    switch (node.kind) {\n                        case 234:\n                            diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file));\n                            return;\n                        case 240:\n                            if (node.isExportEquals) {\n                                diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                            break;\n                        case 255:\n                            var heritageClause = node;\n                            if (heritageClause.token === 107) {\n                                diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                            break;\n                        case 227:\n                            diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file));\n                            return;\n                        case 230:\n                            diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file));\n                            return;\n                        case 228:\n                            diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file));\n                            return;\n                        case 229:\n                            diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file));\n                            return;\n                        case 182:\n                            var typeAssertionExpression = node;\n                            diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));\n                            return;\n                    }\n                    var prevParent = parent;\n                    parent = node;\n                    ts.forEachChild(node, walk, walkArray);\n                    parent = prevParent;\n                }\n                function walkArray(nodes) {\n                    if (parent.decorators === nodes && !options.experimentalDecorators) {\n                        diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning));\n                    }\n                    switch (parent.kind) {\n                        case 226:\n                        case 149:\n                        case 148:\n                        case 150:\n                        case 151:\n                        case 152:\n                        case 184:\n                        case 225:\n                        case 185:\n                        case 225:\n                            if (nodes === parent.typeParameters) {\n                                diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                        case 205:\n                            if (nodes === parent.modifiers) {\n                                return checkModifiers(nodes, parent.kind === 205);\n                            }\n                            break;\n                        case 147:\n                            if (nodes === parent.modifiers) {\n                                for (var _i = 0, _a = nodes; _i < _a.length; _i++) {\n                                    var modifier = _a[_i];\n                                    if (modifier.kind !== 114) {\n                                        diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));\n                                    }\n                                }\n                                return;\n                            }\n                            break;\n                        case 144:\n                            if (nodes === parent.modifiers) {\n                                diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                            break;\n                        case 179:\n                        case 180:\n                        case 199:\n                            if (nodes === parent.typeArguments) {\n                                diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                            break;\n                    }\n                    for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) {\n                        var node = nodes_6[_b];\n                        walk(node);\n                    }\n                }\n                function checkModifiers(modifiers, isConstValid) {\n                    for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) {\n                        var modifier = modifiers_1[_i];\n                        switch (modifier.kind) {\n                            case 75:\n                                if (isConstValid) {\n                                    continue;\n                                }\n                            case 113:\n                            case 111:\n                            case 112:\n                            case 130:\n                            case 123:\n                            case 116:\n                                diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));\n                                break;\n                            case 114:\n                            case 83:\n                            case 78:\n                        }\n                    }\n                }\n                function createDiagnosticForNodeArray(nodes, message, arg0, arg1, arg2) {\n                    var start = nodes.pos;\n                    return ts.createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2);\n                }\n                function createDiagnosticForNode(node, message, arg0, arg1, arg2) {\n                    return ts.createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2);\n                }\n            });\n        }\n        function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) {\n            return runWithCancellationToken(function () {\n                var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken);\n                return ts.getDeclarationDiagnostics(getEmitHost(ts.noop), resolver, sourceFile);\n            });\n        }\n        function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) {\n            return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);\n        }\n        function getOptionsDiagnostics() {\n            var allDiagnostics = [];\n            ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics());\n            ts.addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics());\n            return ts.sortAndDeduplicateDiagnostics(allDiagnostics);\n        }\n        function getGlobalDiagnostics() {\n            var allDiagnostics = [];\n            ts.addRange(allDiagnostics, getDiagnosticsProducingTypeChecker().getGlobalDiagnostics());\n            return ts.sortAndDeduplicateDiagnostics(allDiagnostics);\n        }\n        function processRootFile(fileName, isDefaultLib) {\n            processSourceFile(ts.normalizePath(fileName), isDefaultLib);\n        }\n        function fileReferenceIsEqualTo(a, b) {\n            return a.fileName === b.fileName;\n        }\n        function moduleNameIsEqualTo(a, b) {\n            return a.text === b.text;\n        }\n        function getTextOfLiteral(literal) {\n            return literal.text;\n        }\n        function collectExternalModuleReferences(file) {\n            if (file.imports) {\n                return;\n            }\n            var isJavaScriptFile = ts.isSourceFileJavaScript(file);\n            var isExternalModuleFile = ts.isExternalModule(file);\n            var isDtsFile = ts.isDeclarationFile(file);\n            var imports;\n            var moduleAugmentations;\n            var ambientModules;\n            if (options.importHelpers\n                && (options.isolatedModules || isExternalModuleFile)\n                && !file.isDeclarationFile) {\n                var externalHelpersModuleReference = ts.createSynthesizedNode(9);\n                externalHelpersModuleReference.text = ts.externalHelpersModuleNameText;\n                var importDecl = ts.createSynthesizedNode(235);\n                importDecl.parent = file;\n                externalHelpersModuleReference.parent = importDecl;\n                imports = [externalHelpersModuleReference];\n            }\n            for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {\n                var node = _a[_i];\n                collectModuleReferences(node, false);\n                if (isJavaScriptFile) {\n                    collectRequireCalls(node);\n                }\n            }\n            file.imports = imports || emptyArray;\n            file.moduleAugmentations = moduleAugmentations || emptyArray;\n            file.ambientModuleNames = ambientModules || emptyArray;\n            return;\n            function collectModuleReferences(node, inAmbientModule) {\n                switch (node.kind) {\n                    case 235:\n                    case 234:\n                    case 241:\n                        var moduleNameExpr = ts.getExternalModuleName(node);\n                        if (!moduleNameExpr || moduleNameExpr.kind !== 9) {\n                            break;\n                        }\n                        if (!moduleNameExpr.text) {\n                            break;\n                        }\n                        if (!inAmbientModule || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) {\n                            (imports || (imports = [])).push(moduleNameExpr);\n                        }\n                        break;\n                    case 230:\n                        if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2) || ts.isDeclarationFile(file))) {\n                            var moduleName = node.name;\n                            if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) {\n                                (moduleAugmentations || (moduleAugmentations = [])).push(moduleName);\n                            }\n                            else if (!inAmbientModule) {\n                                if (isDtsFile) {\n                                    (ambientModules || (ambientModules = [])).push(moduleName.text);\n                                }\n                                var body = node.body;\n                                if (body) {\n                                    for (var _i = 0, _a = body.statements; _i < _a.length; _i++) {\n                                        var statement = _a[_i];\n                                        collectModuleReferences(statement, true);\n                                    }\n                                }\n                            }\n                        }\n                }\n            }\n            function collectRequireCalls(node) {\n                if (ts.isRequireCall(node, true)) {\n                    (imports || (imports = [])).push(node.arguments[0]);\n                }\n                else {\n                    ts.forEachChild(node, collectRequireCalls);\n                }\n            }\n        }\n        function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) {\n            var diagnosticArgument;\n            var diagnostic;\n            if (ts.hasExtension(fileName)) {\n                if (!options.allowNonTsExtensions && !ts.forEach(supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) {\n                    diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1;\n                    diagnosticArgument = [fileName, \"'\" + supportedExtensions.join(\"', '\") + \"'\"];\n                }\n                else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) {\n                    diagnostic = ts.Diagnostics.File_0_not_found;\n                    diagnosticArgument = [fileName];\n                }\n                else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) {\n                    diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself;\n                    diagnosticArgument = [fileName];\n                }\n            }\n            else {\n                var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd);\n                if (!nonTsFile) {\n                    if (options.allowNonTsExtensions) {\n                        diagnostic = ts.Diagnostics.File_0_not_found;\n                        diagnosticArgument = [fileName];\n                    }\n                    else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) {\n                        diagnostic = ts.Diagnostics.File_0_not_found;\n                        fileName += \".ts\";\n                        diagnosticArgument = [fileName];\n                    }\n                }\n            }\n            if (diagnostic) {\n                if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) {\n                    fileProcessingDiagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument)));\n                }\n                else {\n                    fileProcessingDiagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument)));\n                }\n            }\n        }\n        function reportFileNamesDifferOnlyInCasingError(fileName, existingFileName, refFile, refPos, refEnd) {\n            if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {\n                fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName));\n            }\n            else {\n                fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName));\n            }\n        }\n        function findSourceFile(fileName, path, isDefaultLib, refFile, refPos, refEnd) {\n            if (filesByName.contains(path)) {\n                var file_1 = filesByName.get(path);\n                if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) {\n                    reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd);\n                }\n                if (file_1 && sourceFilesFoundSearchingNodeModules[file_1.path] && currentNodeModulesDepth == 0) {\n                    sourceFilesFoundSearchingNodeModules[file_1.path] = false;\n                    if (!options.noResolve) {\n                        processReferencedFiles(file_1, isDefaultLib);\n                        processTypeReferenceDirectives(file_1);\n                    }\n                    modulesWithElidedImports[file_1.path] = false;\n                    processImportedModules(file_1);\n                }\n                else if (file_1 && modulesWithElidedImports[file_1.path]) {\n                    if (currentNodeModulesDepth < maxNodeModuleJsDepth) {\n                        modulesWithElidedImports[file_1.path] = false;\n                        processImportedModules(file_1);\n                    }\n                }\n                return file_1;\n            }\n            var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) {\n                if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {\n                    fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));\n                }\n                else {\n                    fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));\n                }\n            });\n            filesByName.set(path, file);\n            if (file) {\n                sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0);\n                file.path = path;\n                if (host.useCaseSensitiveFileNames()) {\n                    var existingFile = filesByNameIgnoreCase.get(path);\n                    if (existingFile) {\n                        reportFileNamesDifferOnlyInCasingError(fileName, existingFile.fileName, refFile, refPos, refEnd);\n                    }\n                    else {\n                        filesByNameIgnoreCase.set(path, file);\n                    }\n                }\n                skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib;\n                if (!options.noResolve) {\n                    processReferencedFiles(file, isDefaultLib);\n                    processTypeReferenceDirectives(file);\n                }\n                processImportedModules(file);\n                if (isDefaultLib) {\n                    files.unshift(file);\n                }\n                else {\n                    files.push(file);\n                }\n            }\n            return file;\n        }\n        function processReferencedFiles(file, isDefaultLib) {\n            ts.forEach(file.referencedFiles, function (ref) {\n                var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName);\n                processSourceFile(referencedFileName, isDefaultLib, file, ref.pos, ref.end);\n            });\n        }\n        function processTypeReferenceDirectives(file) {\n            var typeDirectives = ts.map(file.typeReferenceDirectives, function (ref) { return ref.fileName.toLocaleLowerCase(); });\n            var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file.fileName);\n            for (var i = 0; i < typeDirectives.length; i++) {\n                var ref = file.typeReferenceDirectives[i];\n                var resolvedTypeReferenceDirective = resolutions[i];\n                var fileName = ref.fileName.toLocaleLowerCase();\n                ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);\n                processTypeReferenceDirective(fileName, resolvedTypeReferenceDirective, file, ref.pos, ref.end);\n            }\n        }\n        function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) {\n            var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective];\n            if (previousResolution && previousResolution.primary) {\n                return;\n            }\n            var saveResolution = true;\n            if (resolvedTypeReferenceDirective) {\n                if (resolvedTypeReferenceDirective.primary) {\n                    processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, refFile, refPos, refEnd);\n                }\n                else {\n                    if (previousResolution) {\n                        if (resolvedTypeReferenceDirective.resolvedFileName !== previousResolution.resolvedFileName) {\n                            var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName);\n                            if (otherFileText !== getSourceFile(previousResolution.resolvedFileName).text) {\n                                fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict, typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName));\n                            }\n                        }\n                        saveResolution = false;\n                    }\n                    else {\n                        processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, refFile, refPos, refEnd);\n                    }\n                }\n            }\n            else {\n                fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_type_definition_file_for_0, typeReferenceDirective));\n            }\n            if (saveResolution) {\n                resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective;\n            }\n        }\n        function createDiagnostic(refFile, refPos, refEnd, message) {\n            var args = [];\n            for (var _i = 4; _i < arguments.length; _i++) {\n                args[_i - 4] = arguments[_i];\n            }\n            if (refFile === undefined || refPos === undefined || refEnd === undefined) {\n                return ts.createCompilerDiagnostic.apply(void 0, [message].concat(args));\n            }\n            else {\n                return ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, message].concat(args));\n            }\n        }\n        function getCanonicalFileName(fileName) {\n            return host.getCanonicalFileName(fileName);\n        }\n        function processImportedModules(file) {\n            collectExternalModuleReferences(file);\n            if (file.imports.length || file.moduleAugmentations.length) {\n                file.resolvedModules = ts.createMap();\n                var nonGlobalAugmentation = ts.filter(file.moduleAugmentations, function (moduleAugmentation) { return moduleAugmentation.kind === 9; });\n                var moduleNames = ts.map(ts.concatenate(file.imports, nonGlobalAugmentation), getTextOfLiteral);\n                var resolutions = resolveModuleNamesReusingOldState(moduleNames, ts.getNormalizedAbsolutePath(file.fileName, currentDirectory), file);\n                ts.Debug.assert(resolutions.length === moduleNames.length);\n                for (var i = 0; i < moduleNames.length; i++) {\n                    var resolution = resolutions[i];\n                    ts.setResolvedModule(file, moduleNames[i], resolution);\n                    if (!resolution) {\n                        continue;\n                    }\n                    var isFromNodeModulesSearch = resolution.isExternalLibraryImport;\n                    var isJsFileFromNodeModules = isFromNodeModulesSearch && !ts.extensionIsTypeScript(resolution.extension);\n                    var resolvedFileName = resolution.resolvedFileName;\n                    if (isFromNodeModulesSearch) {\n                        currentNodeModulesDepth++;\n                    }\n                    var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth;\n                    var shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport;\n                    if (elideImport) {\n                        modulesWithElidedImports[file.path] = true;\n                    }\n                    else if (shouldAddFile) {\n                        var path = ts.toPath(resolvedFileName, currentDirectory, getCanonicalFileName);\n                        var pos = ts.skipTrivia(file.text, file.imports[i].pos);\n                        findSourceFile(resolvedFileName, path, false, file, pos, file.imports[i].end);\n                    }\n                    if (isFromNodeModulesSearch) {\n                        currentNodeModulesDepth--;\n                    }\n                }\n            }\n            else {\n                file.resolvedModules = undefined;\n            }\n        }\n        function computeCommonSourceDirectory(sourceFiles) {\n            var fileNames = [];\n            for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) {\n                var file = sourceFiles_6[_i];\n                if (!file.isDeclarationFile) {\n                    fileNames.push(file.fileName);\n                }\n            }\n            return computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName);\n        }\n        function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) {\n            var allFilesBelongToPath = true;\n            if (sourceFiles) {\n                var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory));\n                for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) {\n                    var sourceFile = sourceFiles_7[_i];\n                    if (!ts.isDeclarationFile(sourceFile)) {\n                        var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));\n                        if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {\n                            programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir));\n                            allFilesBelongToPath = false;\n                        }\n                    }\n                }\n            }\n            return allFilesBelongToPath;\n        }\n        function verifyCompilerOptions() {\n            if (options.isolatedModules) {\n                if (options.declaration) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"declaration\", \"isolatedModules\"));\n                }\n                if (options.noEmitOnError) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"noEmitOnError\", \"isolatedModules\"));\n                }\n                if (options.out) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"out\", \"isolatedModules\"));\n                }\n                if (options.outFile) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"outFile\", \"isolatedModules\"));\n                }\n            }\n            if (options.inlineSourceMap) {\n                if (options.sourceMap) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"sourceMap\", \"inlineSourceMap\"));\n                }\n                if (options.mapRoot) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"mapRoot\", \"inlineSourceMap\"));\n                }\n            }\n            if (options.paths && options.baseUrl === undefined) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option));\n            }\n            if (options.paths) {\n                for (var key in options.paths) {\n                    if (!ts.hasProperty(options.paths, key)) {\n                        continue;\n                    }\n                    if (!ts.hasZeroOrOneAsteriskCharacter(key)) {\n                        programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key));\n                    }\n                    if (ts.isArray(options.paths[key])) {\n                        if (options.paths[key].length === 0) {\n                            programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitutions_for_pattern_0_shouldn_t_be_an_empty_array, key));\n                        }\n                        for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) {\n                            var subst = _a[_i];\n                            var typeOfSubst = typeof subst;\n                            if (typeOfSubst === \"string\") {\n                                if (!ts.hasZeroOrOneAsteriskCharacter(subst)) {\n                                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key));\n                                }\n                            }\n                            else {\n                                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst));\n                            }\n                        }\n                    }\n                    else {\n                        programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitutions_for_pattern_0_should_be_an_array, key));\n                    }\n                }\n            }\n            if (!options.sourceMap && !options.inlineSourceMap) {\n                if (options.inlineSources) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, \"inlineSources\"));\n                }\n                if (options.sourceRoot) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, \"sourceRoot\"));\n                }\n            }\n            if (options.out && options.outFile) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"out\", \"outFile\"));\n            }\n            if (options.mapRoot && !options.sourceMap) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, \"mapRoot\", \"sourceMap\"));\n            }\n            if (options.declarationDir) {\n                if (!options.declaration) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, \"declarationDir\", \"declaration\"));\n                }\n                if (options.out || options.outFile) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"declarationDir\", options.out ? \"out\" : \"outFile\"));\n                }\n            }\n            if (options.lib && options.noLib) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"lib\", \"noLib\"));\n            }\n            if (options.noImplicitUseStrict && options.alwaysStrict) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"noImplicitUseStrict\", \"alwaysStrict\"));\n            }\n            var languageVersion = options.target || 0;\n            var outFile = options.outFile || options.out;\n            var firstNonAmbientExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; });\n            if (options.isolatedModules) {\n                if (options.module === ts.ModuleKind.None && languageVersion < 2) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher));\n                }\n                var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; });\n                if (firstNonExternalModuleSourceFile) {\n                    var span_7 = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);\n                    programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span_7.start, span_7.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));\n                }\n            }\n            else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 && options.module === ts.ModuleKind.None) {\n                var span_8 = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);\n                programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span_8.start, span_8.length, ts.Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none));\n            }\n            if (outFile) {\n                if (options.module && !(options.module === ts.ModuleKind.AMD || options.module === ts.ModuleKind.System)) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? \"out\" : \"outFile\"));\n                }\n                else if (options.module === undefined && firstNonAmbientExternalModuleSourceFile) {\n                    var span_9 = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);\n                    programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span_9.start, span_9.length, ts.Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, options.out ? \"out\" : \"outFile\"));\n                }\n            }\n            if (options.outDir ||\n                options.sourceRoot ||\n                options.mapRoot) {\n                var dir = getCommonSourceDirectory();\n                if (options.outDir && dir === \"\" && ts.forEach(files, function (file) { return ts.getRootLength(file.fileName) > 1; })) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));\n                }\n            }\n            if (!options.noEmit && options.allowJs && options.declaration) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"allowJs\", \"declaration\"));\n            }\n            if (options.emitDecoratorMetadata &&\n                !options.experimentalDecorators) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, \"emitDecoratorMetadata\", \"experimentalDecorators\"));\n            }\n            if (options.jsxFactory) {\n                if (options.reactNamespace) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"reactNamespace\", \"jsxFactory\"));\n                }\n                if (!ts.parseIsolatedEntityName(options.jsxFactory, languageVersion)) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory));\n                }\n            }\n            else if (options.reactNamespace && !ts.isIdentifierText(options.reactNamespace, languageVersion)) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace));\n            }\n            if (!options.noEmit && !options.suppressOutputPathCheck) {\n                var emitHost = getEmitHost();\n                var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined);\n                ts.forEachExpectedEmitFile(emitHost, function (emitFileNames) {\n                    verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1);\n                    verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1);\n                });\n            }\n            function verifyEmitFilePath(emitFileName, emitFilesSeen) {\n                if (emitFileName) {\n                    var emitFilePath = ts.toPath(emitFileName, currentDirectory, getCanonicalFileName);\n                    if (filesByName.contains(emitFilePath)) {\n                        var chain_1;\n                        if (!options.configFilePath) {\n                            chain_1 = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);\n                        }\n                        chain_1 = ts.chainDiagnosticMessages(chain_1, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);\n                        blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain_1));\n                    }\n                    if (emitFilesSeen.contains(emitFilePath)) {\n                        blockEmittingOfFile(emitFileName, ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files, emitFileName));\n                    }\n                    else {\n                        emitFilesSeen.set(emitFilePath, true);\n                    }\n                }\n            }\n        }\n        function blockEmittingOfFile(emitFileName, diag) {\n            hasEmitBlockingDiagnostics.set(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName), true);\n            programDiagnostics.add(diag);\n        }\n    }\n    ts.createProgram = createProgram;\n    function getResolutionDiagnostic(options, _a) {\n        var extension = _a.extension;\n        switch (extension) {\n            case ts.Extension.Ts:\n            case ts.Extension.Dts:\n                return undefined;\n            case ts.Extension.Tsx:\n                return needJsx();\n            case ts.Extension.Jsx:\n                return needJsx() || needAllowJs();\n            case ts.Extension.Js:\n                return needAllowJs();\n        }\n        function needJsx() {\n            return options.jsx ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set;\n        }\n        function needAllowJs() {\n            return options.allowJs ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_allowJs_is_not_set;\n        }\n    }\n    ts.getResolutionDiagnostic = getResolutionDiagnostic;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var ScriptSnapshot;\n    (function (ScriptSnapshot) {\n        var StringScriptSnapshot = (function () {\n            function StringScriptSnapshot(text) {\n                this.text = text;\n            }\n            StringScriptSnapshot.prototype.getText = function (start, end) {\n                return this.text.substring(start, end);\n            };\n            StringScriptSnapshot.prototype.getLength = function () {\n                return this.text.length;\n            };\n            StringScriptSnapshot.prototype.getChangeRange = function () {\n                return undefined;\n            };\n            return StringScriptSnapshot;\n        }());\n        function fromString(text) {\n            return new StringScriptSnapshot(text);\n        }\n        ScriptSnapshot.fromString = fromString;\n    })(ScriptSnapshot = ts.ScriptSnapshot || (ts.ScriptSnapshot = {}));\n    var TextChange = (function () {\n        function TextChange() {\n        }\n        return TextChange;\n    }());\n    ts.TextChange = TextChange;\n    var HighlightSpanKind;\n    (function (HighlightSpanKind) {\n        HighlightSpanKind.none = \"none\";\n        HighlightSpanKind.definition = \"definition\";\n        HighlightSpanKind.reference = \"reference\";\n        HighlightSpanKind.writtenReference = \"writtenReference\";\n    })(HighlightSpanKind = ts.HighlightSpanKind || (ts.HighlightSpanKind = {}));\n    var IndentStyle;\n    (function (IndentStyle) {\n        IndentStyle[IndentStyle[\"None\"] = 0] = \"None\";\n        IndentStyle[IndentStyle[\"Block\"] = 1] = \"Block\";\n        IndentStyle[IndentStyle[\"Smart\"] = 2] = \"Smart\";\n    })(IndentStyle = ts.IndentStyle || (ts.IndentStyle = {}));\n    var SymbolDisplayPartKind;\n    (function (SymbolDisplayPartKind) {\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"aliasName\"] = 0] = \"aliasName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"className\"] = 1] = \"className\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"enumName\"] = 2] = \"enumName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"fieldName\"] = 3] = \"fieldName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"interfaceName\"] = 4] = \"interfaceName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"keyword\"] = 5] = \"keyword\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"lineBreak\"] = 6] = \"lineBreak\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"numericLiteral\"] = 7] = \"numericLiteral\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"stringLiteral\"] = 8] = \"stringLiteral\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"localName\"] = 9] = \"localName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"methodName\"] = 10] = \"methodName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"moduleName\"] = 11] = \"moduleName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"operator\"] = 12] = \"operator\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"parameterName\"] = 13] = \"parameterName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"propertyName\"] = 14] = \"propertyName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"punctuation\"] = 15] = \"punctuation\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"space\"] = 16] = \"space\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"text\"] = 17] = \"text\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"typeParameterName\"] = 18] = \"typeParameterName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"enumMemberName\"] = 19] = \"enumMemberName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"functionName\"] = 20] = \"functionName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"regularExpressionLiteral\"] = 21] = \"regularExpressionLiteral\";\n    })(SymbolDisplayPartKind = ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {}));\n    var TokenClass;\n    (function (TokenClass) {\n        TokenClass[TokenClass[\"Punctuation\"] = 0] = \"Punctuation\";\n        TokenClass[TokenClass[\"Keyword\"] = 1] = \"Keyword\";\n        TokenClass[TokenClass[\"Operator\"] = 2] = \"Operator\";\n        TokenClass[TokenClass[\"Comment\"] = 3] = \"Comment\";\n        TokenClass[TokenClass[\"Whitespace\"] = 4] = \"Whitespace\";\n        TokenClass[TokenClass[\"Identifier\"] = 5] = \"Identifier\";\n        TokenClass[TokenClass[\"NumberLiteral\"] = 6] = \"NumberLiteral\";\n        TokenClass[TokenClass[\"StringLiteral\"] = 7] = \"StringLiteral\";\n        TokenClass[TokenClass[\"RegExpLiteral\"] = 8] = \"RegExpLiteral\";\n    })(TokenClass = ts.TokenClass || (ts.TokenClass = {}));\n    var ScriptElementKind;\n    (function (ScriptElementKind) {\n        ScriptElementKind.unknown = \"\";\n        ScriptElementKind.warning = \"warning\";\n        ScriptElementKind.keyword = \"keyword\";\n        ScriptElementKind.scriptElement = \"script\";\n        ScriptElementKind.moduleElement = \"module\";\n        ScriptElementKind.classElement = \"class\";\n        ScriptElementKind.localClassElement = \"local class\";\n        ScriptElementKind.interfaceElement = \"interface\";\n        ScriptElementKind.typeElement = \"type\";\n        ScriptElementKind.enumElement = \"enum\";\n        ScriptElementKind.enumMemberElement = \"const\";\n        ScriptElementKind.variableElement = \"var\";\n        ScriptElementKind.localVariableElement = \"local var\";\n        ScriptElementKind.functionElement = \"function\";\n        ScriptElementKind.localFunctionElement = \"local function\";\n        ScriptElementKind.memberFunctionElement = \"method\";\n        ScriptElementKind.memberGetAccessorElement = \"getter\";\n        ScriptElementKind.memberSetAccessorElement = \"setter\";\n        ScriptElementKind.memberVariableElement = \"property\";\n        ScriptElementKind.constructorImplementationElement = \"constructor\";\n        ScriptElementKind.callSignatureElement = \"call\";\n        ScriptElementKind.indexSignatureElement = \"index\";\n        ScriptElementKind.constructSignatureElement = \"construct\";\n        ScriptElementKind.parameterElement = \"parameter\";\n        ScriptElementKind.typeParameterElement = \"type parameter\";\n        ScriptElementKind.primitiveType = \"primitive type\";\n        ScriptElementKind.label = \"label\";\n        ScriptElementKind.alias = \"alias\";\n        ScriptElementKind.constElement = \"const\";\n        ScriptElementKind.letElement = \"let\";\n        ScriptElementKind.directory = \"directory\";\n        ScriptElementKind.externalModuleName = \"external module name\";\n    })(ScriptElementKind = ts.ScriptElementKind || (ts.ScriptElementKind = {}));\n    var ScriptElementKindModifier;\n    (function (ScriptElementKindModifier) {\n        ScriptElementKindModifier.none = \"\";\n        ScriptElementKindModifier.publicMemberModifier = \"public\";\n        ScriptElementKindModifier.privateMemberModifier = \"private\";\n        ScriptElementKindModifier.protectedMemberModifier = \"protected\";\n        ScriptElementKindModifier.exportedModifier = \"export\";\n        ScriptElementKindModifier.ambientModifier = \"declare\";\n        ScriptElementKindModifier.staticModifier = \"static\";\n        ScriptElementKindModifier.abstractModifier = \"abstract\";\n    })(ScriptElementKindModifier = ts.ScriptElementKindModifier || (ts.ScriptElementKindModifier = {}));\n    var ClassificationTypeNames = (function () {\n        function ClassificationTypeNames() {\n        }\n        return ClassificationTypeNames;\n    }());\n    ClassificationTypeNames.comment = \"comment\";\n    ClassificationTypeNames.identifier = \"identifier\";\n    ClassificationTypeNames.keyword = \"keyword\";\n    ClassificationTypeNames.numericLiteral = \"number\";\n    ClassificationTypeNames.operator = \"operator\";\n    ClassificationTypeNames.stringLiteral = \"string\";\n    ClassificationTypeNames.whiteSpace = \"whitespace\";\n    ClassificationTypeNames.text = \"text\";\n    ClassificationTypeNames.punctuation = \"punctuation\";\n    ClassificationTypeNames.className = \"class name\";\n    ClassificationTypeNames.enumName = \"enum name\";\n    ClassificationTypeNames.interfaceName = \"interface name\";\n    ClassificationTypeNames.moduleName = \"module name\";\n    ClassificationTypeNames.typeParameterName = \"type parameter name\";\n    ClassificationTypeNames.typeAliasName = \"type alias name\";\n    ClassificationTypeNames.parameterName = \"parameter name\";\n    ClassificationTypeNames.docCommentTagName = \"doc comment tag name\";\n    ClassificationTypeNames.jsxOpenTagName = \"jsx open tag name\";\n    ClassificationTypeNames.jsxCloseTagName = \"jsx close tag name\";\n    ClassificationTypeNames.jsxSelfClosingTagName = \"jsx self closing tag name\";\n    ClassificationTypeNames.jsxAttribute = \"jsx attribute\";\n    ClassificationTypeNames.jsxText = \"jsx text\";\n    ClassificationTypeNames.jsxAttributeStringLiteralValue = \"jsx attribute string literal value\";\n    ts.ClassificationTypeNames = ClassificationTypeNames;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    ts.scanner = ts.createScanner(5, true);\n    ts.emptyArray = [];\n    function getMeaningFromDeclaration(node) {\n        switch (node.kind) {\n            case 144:\n            case 223:\n            case 174:\n            case 147:\n            case 146:\n            case 257:\n            case 258:\n            case 260:\n            case 149:\n            case 148:\n            case 150:\n            case 151:\n            case 152:\n            case 225:\n            case 184:\n            case 185:\n            case 256:\n                return 1;\n            case 143:\n            case 227:\n            case 228:\n            case 161:\n                return 2;\n            case 226:\n            case 229:\n                return 1 | 2;\n            case 230:\n                if (ts.isAmbientModule(node)) {\n                    return 4 | 1;\n                }\n                else if (ts.getModuleInstanceState(node) === 1) {\n                    return 4 | 1;\n                }\n                else {\n                    return 4;\n                }\n            case 238:\n            case 239:\n            case 234:\n            case 235:\n            case 240:\n            case 241:\n                return 1 | 2 | 4;\n            case 261:\n                return 4 | 1;\n        }\n        return 1 | 2 | 4;\n    }\n    ts.getMeaningFromDeclaration = getMeaningFromDeclaration;\n    function getMeaningFromLocation(node) {\n        if (node.parent.kind === 240) {\n            return 1 | 2 | 4;\n        }\n        else if (isInRightSideOfImport(node)) {\n            return getMeaningFromRightHandSideOfImportEquals(node);\n        }\n        else if (ts.isDeclarationName(node)) {\n            return getMeaningFromDeclaration(node.parent);\n        }\n        else if (isTypeReference(node)) {\n            return 2;\n        }\n        else if (isNamespaceReference(node)) {\n            return 4;\n        }\n        else {\n            return 1;\n        }\n    }\n    ts.getMeaningFromLocation = getMeaningFromLocation;\n    function getMeaningFromRightHandSideOfImportEquals(node) {\n        ts.Debug.assert(node.kind === 70);\n        if (node.parent.kind === 141 &&\n            node.parent.right === node &&\n            node.parent.parent.kind === 234) {\n            return 1 | 2 | 4;\n        }\n        return 4;\n    }\n    function isInRightSideOfImport(node) {\n        while (node.parent.kind === 141) {\n            node = node.parent;\n        }\n        return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node;\n    }\n    function isNamespaceReference(node) {\n        return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node);\n    }\n    function isQualifiedNameNamespaceReference(node) {\n        var root = node;\n        var isLastClause = true;\n        if (root.parent.kind === 141) {\n            while (root.parent && root.parent.kind === 141) {\n                root = root.parent;\n            }\n            isLastClause = root.right === node;\n        }\n        return root.parent.kind === 157 && !isLastClause;\n    }\n    function isPropertyAccessNamespaceReference(node) {\n        var root = node;\n        var isLastClause = true;\n        if (root.parent.kind === 177) {\n            while (root.parent && root.parent.kind === 177) {\n                root = root.parent;\n            }\n            isLastClause = root.name === node;\n        }\n        if (!isLastClause && root.parent.kind === 199 && root.parent.parent.kind === 255) {\n            var decl = root.parent.parent.parent;\n            return (decl.kind === 226 && root.parent.parent.token === 107) ||\n                (decl.kind === 227 && root.parent.parent.token === 84);\n        }\n        return false;\n    }\n    function isTypeReference(node) {\n        if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) {\n            node = node.parent;\n        }\n        return node.parent.kind === 157 ||\n            (node.parent.kind === 199 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) ||\n            (node.kind === 98 && !ts.isPartOfExpression(node)) ||\n            node.kind === 167;\n    }\n    function isCallExpressionTarget(node) {\n        return isCallOrNewExpressionTarget(node, 179);\n    }\n    ts.isCallExpressionTarget = isCallExpressionTarget;\n    function isNewExpressionTarget(node) {\n        return isCallOrNewExpressionTarget(node, 180);\n    }\n    ts.isNewExpressionTarget = isNewExpressionTarget;\n    function isCallOrNewExpressionTarget(node, kind) {\n        var target = climbPastPropertyAccess(node);\n        return target && target.parent && target.parent.kind === kind && target.parent.expression === target;\n    }\n    function climbPastPropertyAccess(node) {\n        return isRightSideOfPropertyAccess(node) ? node.parent : node;\n    }\n    ts.climbPastPropertyAccess = climbPastPropertyAccess;\n    function getTargetLabel(referenceNode, labelName) {\n        while (referenceNode) {\n            if (referenceNode.kind === 219 && referenceNode.label.text === labelName) {\n                return referenceNode.label;\n            }\n            referenceNode = referenceNode.parent;\n        }\n        return undefined;\n    }\n    ts.getTargetLabel = getTargetLabel;\n    function isJumpStatementTarget(node) {\n        return node.kind === 70 &&\n            (node.parent.kind === 215 || node.parent.kind === 214) &&\n            node.parent.label === node;\n    }\n    ts.isJumpStatementTarget = isJumpStatementTarget;\n    function isLabelOfLabeledStatement(node) {\n        return node.kind === 70 &&\n            node.parent.kind === 219 &&\n            node.parent.label === node;\n    }\n    function isLabelName(node) {\n        return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node);\n    }\n    ts.isLabelName = isLabelName;\n    function isRightSideOfQualifiedName(node) {\n        return node.parent.kind === 141 && node.parent.right === node;\n    }\n    ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName;\n    function isRightSideOfPropertyAccess(node) {\n        return node && node.parent && node.parent.kind === 177 && node.parent.name === node;\n    }\n    ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess;\n    function isNameOfModuleDeclaration(node) {\n        return node.parent.kind === 230 && node.parent.name === node;\n    }\n    ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration;\n    function isNameOfFunctionDeclaration(node) {\n        return node.kind === 70 &&\n            ts.isFunctionLike(node.parent) && node.parent.name === node;\n    }\n    ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration;\n    function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) {\n        if (node.kind === 9 || node.kind === 8) {\n            switch (node.parent.kind) {\n                case 147:\n                case 146:\n                case 257:\n                case 260:\n                case 149:\n                case 148:\n                case 151:\n                case 152:\n                case 230:\n                    return node.parent.name === node;\n                case 178:\n                    return node.parent.argumentExpression === node;\n                case 142:\n                    return true;\n            }\n        }\n        return false;\n    }\n    ts.isLiteralNameOfPropertyDeclarationOrIndexAccess = isLiteralNameOfPropertyDeclarationOrIndexAccess;\n    function isExpressionOfExternalModuleImportEqualsDeclaration(node) {\n        return ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) &&\n            ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node;\n    }\n    ts.isExpressionOfExternalModuleImportEqualsDeclaration = isExpressionOfExternalModuleImportEqualsDeclaration;\n    function isInsideComment(sourceFile, token, position) {\n        return position <= token.getStart(sourceFile) &&\n            (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) ||\n                isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart())));\n        function isInsideCommentRange(comments) {\n            return ts.forEach(comments, function (comment) {\n                if (comment.pos < position && position < comment.end) {\n                    return true;\n                }\n                else if (position === comment.end) {\n                    var text = sourceFile.text;\n                    var width = comment.end - comment.pos;\n                    if (width <= 2 || text.charCodeAt(comment.pos + 1) === 47) {\n                        return true;\n                    }\n                    else {\n                        return !(text.charCodeAt(comment.end - 1) === 47 &&\n                            text.charCodeAt(comment.end - 2) === 42);\n                    }\n                }\n                return false;\n            });\n        }\n    }\n    ts.isInsideComment = isInsideComment;\n    function getContainerNode(node) {\n        while (true) {\n            node = node.parent;\n            if (!node) {\n                return undefined;\n            }\n            switch (node.kind) {\n                case 261:\n                case 149:\n                case 148:\n                case 225:\n                case 184:\n                case 151:\n                case 152:\n                case 226:\n                case 227:\n                case 229:\n                case 230:\n                    return node;\n            }\n        }\n    }\n    ts.getContainerNode = getContainerNode;\n    function getNodeKind(node) {\n        switch (node.kind) {\n            case 261:\n                return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement;\n            case 230:\n                return ts.ScriptElementKind.moduleElement;\n            case 226:\n            case 197:\n                return ts.ScriptElementKind.classElement;\n            case 227: return ts.ScriptElementKind.interfaceElement;\n            case 228: return ts.ScriptElementKind.typeElement;\n            case 229: return ts.ScriptElementKind.enumElement;\n            case 223:\n                return getKindOfVariableDeclaration(node);\n            case 174:\n                return getKindOfVariableDeclaration(ts.getRootDeclaration(node));\n            case 185:\n            case 225:\n            case 184:\n                return ts.ScriptElementKind.functionElement;\n            case 151: return ts.ScriptElementKind.memberGetAccessorElement;\n            case 152: return ts.ScriptElementKind.memberSetAccessorElement;\n            case 149:\n            case 148:\n                return ts.ScriptElementKind.memberFunctionElement;\n            case 147:\n            case 146:\n                return ts.ScriptElementKind.memberVariableElement;\n            case 155: return ts.ScriptElementKind.indexSignatureElement;\n            case 154: return ts.ScriptElementKind.constructSignatureElement;\n            case 153: return ts.ScriptElementKind.callSignatureElement;\n            case 150: return ts.ScriptElementKind.constructorImplementationElement;\n            case 143: return ts.ScriptElementKind.typeParameterElement;\n            case 260: return ts.ScriptElementKind.enumMemberElement;\n            case 144: return ts.hasModifier(node, 92) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement;\n            case 234:\n            case 239:\n            case 236:\n            case 243:\n            case 237:\n                return ts.ScriptElementKind.alias;\n            case 285:\n                return ts.ScriptElementKind.typeElement;\n            default:\n                return ts.ScriptElementKind.unknown;\n        }\n        function getKindOfVariableDeclaration(v) {\n            return ts.isConst(v)\n                ? ts.ScriptElementKind.constElement\n                : ts.isLet(v)\n                    ? ts.ScriptElementKind.letElement\n                    : ts.ScriptElementKind.variableElement;\n        }\n    }\n    ts.getNodeKind = getNodeKind;\n    function getStringLiteralTypeForNode(node, typeChecker) {\n        var searchNode = node.parent.kind === 171 ? node.parent : node;\n        var type = typeChecker.getTypeAtLocation(searchNode);\n        if (type && type.flags & 32) {\n            return type;\n        }\n        return undefined;\n    }\n    ts.getStringLiteralTypeForNode = getStringLiteralTypeForNode;\n    function isThis(node) {\n        switch (node.kind) {\n            case 98:\n                return true;\n            case 70:\n                return ts.identifierIsThisKeyword(node) && node.parent.kind === 144;\n            default:\n                return false;\n        }\n    }\n    ts.isThis = isThis;\n    var tripleSlashDirectivePrefixRegex = /^\\/\\/\\/\\s*</;\n    function getLineStartPositionForPosition(position, sourceFile) {\n        var lineStarts = sourceFile.getLineStarts();\n        var line = sourceFile.getLineAndCharacterOfPosition(position).line;\n        return lineStarts[line];\n    }\n    ts.getLineStartPositionForPosition = getLineStartPositionForPosition;\n    function rangeContainsRange(r1, r2) {\n        return startEndContainsRange(r1.pos, r1.end, r2);\n    }\n    ts.rangeContainsRange = rangeContainsRange;\n    function startEndContainsRange(start, end, range) {\n        return start <= range.pos && end >= range.end;\n    }\n    ts.startEndContainsRange = startEndContainsRange;\n    function rangeContainsStartEnd(range, start, end) {\n        return range.pos <= start && range.end >= end;\n    }\n    ts.rangeContainsStartEnd = rangeContainsStartEnd;\n    function rangeOverlapsWithStartEnd(r1, start, end) {\n        return startEndOverlapsWithStartEnd(r1.pos, r1.end, start, end);\n    }\n    ts.rangeOverlapsWithStartEnd = rangeOverlapsWithStartEnd;\n    function startEndOverlapsWithStartEnd(start1, end1, start2, end2) {\n        var start = Math.max(start1, start2);\n        var end = Math.min(end1, end2);\n        return start < end;\n    }\n    ts.startEndOverlapsWithStartEnd = startEndOverlapsWithStartEnd;\n    function positionBelongsToNode(candidate, position, sourceFile) {\n        return candidate.end > position || !isCompletedNode(candidate, sourceFile);\n    }\n    ts.positionBelongsToNode = positionBelongsToNode;\n    function isCompletedNode(n, sourceFile) {\n        if (ts.nodeIsMissing(n)) {\n            return false;\n        }\n        switch (n.kind) {\n            case 226:\n            case 227:\n            case 229:\n            case 176:\n            case 172:\n            case 161:\n            case 204:\n            case 231:\n            case 232:\n            case 238:\n            case 242:\n                return nodeEndsWith(n, 17, sourceFile);\n            case 256:\n                return isCompletedNode(n.block, sourceFile);\n            case 180:\n                if (!n.arguments) {\n                    return true;\n                }\n            case 179:\n            case 183:\n            case 166:\n                return nodeEndsWith(n, 19, sourceFile);\n            case 158:\n            case 159:\n                return isCompletedNode(n.type, sourceFile);\n            case 150:\n            case 151:\n            case 152:\n            case 225:\n            case 184:\n            case 149:\n            case 148:\n            case 154:\n            case 153:\n            case 185:\n                if (n.body) {\n                    return isCompletedNode(n.body, sourceFile);\n                }\n                if (n.type) {\n                    return isCompletedNode(n.type, sourceFile);\n                }\n                return hasChildOfKind(n, 19, sourceFile);\n            case 230:\n                return n.body && isCompletedNode(n.body, sourceFile);\n            case 208:\n                if (n.elseStatement) {\n                    return isCompletedNode(n.elseStatement, sourceFile);\n                }\n                return isCompletedNode(n.thenStatement, sourceFile);\n            case 207:\n                return isCompletedNode(n.expression, sourceFile) ||\n                    hasChildOfKind(n, 24);\n            case 175:\n            case 173:\n            case 178:\n            case 142:\n            case 163:\n                return nodeEndsWith(n, 21, sourceFile);\n            case 155:\n                if (n.type) {\n                    return isCompletedNode(n.type, sourceFile);\n                }\n                return hasChildOfKind(n, 21, sourceFile);\n            case 253:\n            case 254:\n                return false;\n            case 211:\n            case 212:\n            case 213:\n            case 210:\n                return isCompletedNode(n.statement, sourceFile);\n            case 209:\n                var hasWhileKeyword = findChildOfKind(n, 105, sourceFile);\n                if (hasWhileKeyword) {\n                    return nodeEndsWith(n, 19, sourceFile);\n                }\n                return isCompletedNode(n.statement, sourceFile);\n            case 160:\n                return isCompletedNode(n.exprName, sourceFile);\n            case 187:\n            case 186:\n            case 188:\n            case 195:\n            case 196:\n                var unaryWordExpression = n;\n                return isCompletedNode(unaryWordExpression.expression, sourceFile);\n            case 181:\n                return isCompletedNode(n.template, sourceFile);\n            case 194:\n                var lastSpan = ts.lastOrUndefined(n.templateSpans);\n                return isCompletedNode(lastSpan, sourceFile);\n            case 202:\n                return ts.nodeIsPresent(n.literal);\n            case 241:\n            case 235:\n                return ts.nodeIsPresent(n.moduleSpecifier);\n            case 190:\n                return isCompletedNode(n.operand, sourceFile);\n            case 192:\n                return isCompletedNode(n.right, sourceFile);\n            case 193:\n                return isCompletedNode(n.whenFalse, sourceFile);\n            default:\n                return true;\n        }\n    }\n    ts.isCompletedNode = isCompletedNode;\n    function nodeEndsWith(n, expectedLastToken, sourceFile) {\n        var children = n.getChildren(sourceFile);\n        if (children.length) {\n            var last = ts.lastOrUndefined(children);\n            if (last.kind === expectedLastToken) {\n                return true;\n            }\n            else if (last.kind === 24 && children.length !== 1) {\n                return children[children.length - 2].kind === expectedLastToken;\n            }\n        }\n        return false;\n    }\n    function findListItemInfo(node) {\n        var list = findContainingList(node);\n        if (!list) {\n            return undefined;\n        }\n        var children = list.getChildren();\n        var listItemIndex = ts.indexOf(children, node);\n        return {\n            listItemIndex: listItemIndex,\n            list: list\n        };\n    }\n    ts.findListItemInfo = findListItemInfo;\n    function hasChildOfKind(n, kind, sourceFile) {\n        return !!findChildOfKind(n, kind, sourceFile);\n    }\n    ts.hasChildOfKind = hasChildOfKind;\n    function findChildOfKind(n, kind, sourceFile) {\n        return ts.forEach(n.getChildren(sourceFile), function (c) { return c.kind === kind && c; });\n    }\n    ts.findChildOfKind = findChildOfKind;\n    function findContainingList(node) {\n        var syntaxList = ts.forEach(node.parent.getChildren(), function (c) {\n            if (c.kind === 292 && c.pos <= node.pos && c.end >= node.end) {\n                return c;\n            }\n        });\n        ts.Debug.assert(!syntaxList || ts.contains(syntaxList.getChildren(), node));\n        return syntaxList;\n    }\n    ts.findContainingList = findContainingList;\n    function getTouchingWord(sourceFile, position, includeJsDocComment) {\n        if (includeJsDocComment === void 0) { includeJsDocComment = false; }\n        return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }, includeJsDocComment);\n    }\n    ts.getTouchingWord = getTouchingWord;\n    function getTouchingPropertyName(sourceFile, position, includeJsDocComment) {\n        if (includeJsDocComment === void 0) { includeJsDocComment = false; }\n        return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }, includeJsDocComment);\n    }\n    ts.getTouchingPropertyName = getTouchingPropertyName;\n    function getTouchingToken(sourceFile, position, includeItemAtEndPosition, includeJsDocComment) {\n        if (includeJsDocComment === void 0) { includeJsDocComment = false; }\n        return getTokenAtPositionWorker(sourceFile, position, false, includeItemAtEndPosition, includeJsDocComment);\n    }\n    ts.getTouchingToken = getTouchingToken;\n    function getTokenAtPosition(sourceFile, position, includeJsDocComment) {\n        if (includeJsDocComment === void 0) { includeJsDocComment = false; }\n        return getTokenAtPositionWorker(sourceFile, position, true, undefined, includeJsDocComment);\n    }\n    ts.getTokenAtPosition = getTokenAtPosition;\n    function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includeItemAtEndPosition, includeJsDocComment) {\n        if (includeJsDocComment === void 0) { includeJsDocComment = false; }\n        var current = sourceFile;\n        outer: while (true) {\n            if (isToken(current)) {\n                return current;\n            }\n            if (includeJsDocComment) {\n                var jsDocChildren = ts.filter(current.getChildren(), ts.isJSDocNode);\n                for (var _i = 0, jsDocChildren_1 = jsDocChildren; _i < jsDocChildren_1.length; _i++) {\n                    var jsDocChild = jsDocChildren_1[_i];\n                    var start = allowPositionInLeadingTrivia ? jsDocChild.getFullStart() : jsDocChild.getStart(sourceFile, includeJsDocComment);\n                    if (start <= position) {\n                        var end = jsDocChild.getEnd();\n                        if (position < end || (position === end && jsDocChild.kind === 1)) {\n                            current = jsDocChild;\n                            continue outer;\n                        }\n                        else if (includeItemAtEndPosition && end === position) {\n                            var previousToken = findPrecedingToken(position, sourceFile, jsDocChild);\n                            if (previousToken && includeItemAtEndPosition(previousToken)) {\n                                return previousToken;\n                            }\n                        }\n                    }\n                }\n            }\n            for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) {\n                var child = current.getChildAt(i);\n                if (ts.isJSDocNode(child)) {\n                    continue;\n                }\n                var start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile, includeJsDocComment);\n                if (start <= position) {\n                    var end = child.getEnd();\n                    if (position < end || (position === end && child.kind === 1)) {\n                        current = child;\n                        continue outer;\n                    }\n                    else if (includeItemAtEndPosition && end === position) {\n                        var previousToken = findPrecedingToken(position, sourceFile, child);\n                        if (previousToken && includeItemAtEndPosition(previousToken)) {\n                            return previousToken;\n                        }\n                    }\n                }\n            }\n            return current;\n        }\n    }\n    function findTokenOnLeftOfPosition(file, position) {\n        var tokenAtPosition = getTokenAtPosition(file, position);\n        if (isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) {\n            return tokenAtPosition;\n        }\n        return findPrecedingToken(position, file);\n    }\n    ts.findTokenOnLeftOfPosition = findTokenOnLeftOfPosition;\n    function findNextToken(previousToken, parent) {\n        return find(parent);\n        function find(n) {\n            if (isToken(n) && n.pos === previousToken.end) {\n                return n;\n            }\n            var children = n.getChildren();\n            for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {\n                var child = children_2[_i];\n                var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) ||\n                    (child.pos === previousToken.end);\n                if (shouldDiveInChildNode && nodeHasTokens(child)) {\n                    return find(child);\n                }\n            }\n            return undefined;\n        }\n    }\n    ts.findNextToken = findNextToken;\n    function findPrecedingToken(position, sourceFile, startNode) {\n        return find(startNode || sourceFile);\n        function findRightmostToken(n) {\n            if (isToken(n)) {\n                return n;\n            }\n            var children = n.getChildren();\n            var candidate = findRightmostChildNodeWithTokens(children, children.length);\n            return candidate && findRightmostToken(candidate);\n        }\n        function find(n) {\n            if (isToken(n)) {\n                return n;\n            }\n            var children = n.getChildren();\n            for (var i = 0, len = children.length; i < len; i++) {\n                var child = children[i];\n                if (position < child.end && (nodeHasTokens(child) || child.kind === 10)) {\n                    var start = child.getStart(sourceFile);\n                    var lookInPreviousChild = (start >= position) ||\n                        (child.kind === 10 && start === child.end);\n                    if (lookInPreviousChild) {\n                        var candidate = findRightmostChildNodeWithTokens(children, i);\n                        return candidate && findRightmostToken(candidate);\n                    }\n                    else {\n                        return find(child);\n                    }\n                }\n            }\n            ts.Debug.assert(startNode !== undefined || n.kind === 261);\n            if (children.length) {\n                var candidate = findRightmostChildNodeWithTokens(children, children.length);\n                return candidate && findRightmostToken(candidate);\n            }\n        }\n        function findRightmostChildNodeWithTokens(children, exclusiveStartPosition) {\n            for (var i = exclusiveStartPosition - 1; i >= 0; i--) {\n                if (nodeHasTokens(children[i])) {\n                    return children[i];\n                }\n            }\n        }\n    }\n    ts.findPrecedingToken = findPrecedingToken;\n    function isInString(sourceFile, position) {\n        var previousToken = findPrecedingToken(position, sourceFile);\n        if (previousToken && previousToken.kind === 9) {\n            var start = previousToken.getStart();\n            var end = previousToken.getEnd();\n            if (start < position && position < end) {\n                return true;\n            }\n            if (position === end) {\n                return !!previousToken.isUnterminated;\n            }\n        }\n        return false;\n    }\n    ts.isInString = isInString;\n    function isInComment(sourceFile, position) {\n        return isInCommentHelper(sourceFile, position, undefined);\n    }\n    ts.isInComment = isInComment;\n    function isInsideJsxElementOrAttribute(sourceFile, position) {\n        var token = getTokenAtPosition(sourceFile, position);\n        if (!token) {\n            return false;\n        }\n        if (token.kind === 10) {\n            return true;\n        }\n        if (token.kind === 26 && token.parent.kind === 10) {\n            return true;\n        }\n        if (token.kind === 26 && token.parent.kind === 252) {\n            return true;\n        }\n        if (token && token.kind === 17 && token.parent.kind === 252) {\n            return true;\n        }\n        if (token.kind === 26 && token.parent.kind === 249) {\n            return true;\n        }\n        return false;\n    }\n    ts.isInsideJsxElementOrAttribute = isInsideJsxElementOrAttribute;\n    function isInTemplateString(sourceFile, position) {\n        var token = getTokenAtPosition(sourceFile, position);\n        return ts.isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile);\n    }\n    ts.isInTemplateString = isInTemplateString;\n    function isInCommentHelper(sourceFile, position, predicate) {\n        var token = getTokenAtPosition(sourceFile, position);\n        if (token && position <= token.getStart(sourceFile)) {\n            var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);\n            return predicate ?\n                ts.forEach(commentRanges, function (c) { return c.pos < position &&\n                    (c.kind == 2 ? position <= c.end : position < c.end) &&\n                    predicate(c); }) :\n                ts.forEach(commentRanges, function (c) { return c.pos < position &&\n                    (c.kind == 2 ? position <= c.end : position < c.end); });\n        }\n        return false;\n    }\n    ts.isInCommentHelper = isInCommentHelper;\n    function hasDocComment(sourceFile, position) {\n        var token = getTokenAtPosition(sourceFile, position);\n        var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);\n        return ts.forEach(commentRanges, jsDocPrefix);\n        function jsDocPrefix(c) {\n            var text = sourceFile.text;\n            return text.length >= c.pos + 3 && text[c.pos] === \"/\" && text[c.pos + 1] === \"*\" && text[c.pos + 2] === \"*\";\n        }\n    }\n    ts.hasDocComment = hasDocComment;\n    function getJsDocTagAtPosition(sourceFile, position) {\n        var node = ts.getTokenAtPosition(sourceFile, position);\n        if (isToken(node)) {\n            switch (node.kind) {\n                case 103:\n                case 109:\n                case 75:\n                    node = node.parent === undefined ? undefined : node.parent.parent;\n                    break;\n                default:\n                    node = node.parent;\n                    break;\n            }\n        }\n        if (node) {\n            if (node.jsDoc) {\n                for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {\n                    var jsDoc = _a[_i];\n                    if (jsDoc.tags) {\n                        for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) {\n                            var tag = _c[_b];\n                            if (tag.pos <= position && position <= tag.end) {\n                                return tag;\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        return undefined;\n    }\n    ts.getJsDocTagAtPosition = getJsDocTagAtPosition;\n    function nodeHasTokens(n) {\n        return n.getWidth() !== 0;\n    }\n    function getNodeModifiers(node) {\n        var flags = ts.getCombinedModifierFlags(node);\n        var result = [];\n        if (flags & 8)\n            result.push(ts.ScriptElementKindModifier.privateMemberModifier);\n        if (flags & 16)\n            result.push(ts.ScriptElementKindModifier.protectedMemberModifier);\n        if (flags & 4)\n            result.push(ts.ScriptElementKindModifier.publicMemberModifier);\n        if (flags & 32)\n            result.push(ts.ScriptElementKindModifier.staticModifier);\n        if (flags & 128)\n            result.push(ts.ScriptElementKindModifier.abstractModifier);\n        if (flags & 1)\n            result.push(ts.ScriptElementKindModifier.exportedModifier);\n        if (ts.isInAmbientContext(node))\n            result.push(ts.ScriptElementKindModifier.ambientModifier);\n        return result.length > 0 ? result.join(\",\") : ts.ScriptElementKindModifier.none;\n    }\n    ts.getNodeModifiers = getNodeModifiers;\n    function getTypeArgumentOrTypeParameterList(node) {\n        if (node.kind === 157 || node.kind === 179) {\n            return node.typeArguments;\n        }\n        if (ts.isFunctionLike(node) || node.kind === 226 || node.kind === 227) {\n            return node.typeParameters;\n        }\n        return undefined;\n    }\n    ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList;\n    function isToken(n) {\n        return n.kind >= 0 && n.kind <= 140;\n    }\n    ts.isToken = isToken;\n    function isWord(kind) {\n        return kind === 70 || ts.isKeyword(kind);\n    }\n    ts.isWord = isWord;\n    function isPropertyName(kind) {\n        return kind === 9 || kind === 8 || isWord(kind);\n    }\n    function isComment(kind) {\n        return kind === 2 || kind === 3;\n    }\n    ts.isComment = isComment;\n    function isStringOrRegularExpressionOrTemplateLiteral(kind) {\n        if (kind === 9\n            || kind === 11\n            || ts.isTemplateLiteralKind(kind)) {\n            return true;\n        }\n        return false;\n    }\n    ts.isStringOrRegularExpressionOrTemplateLiteral = isStringOrRegularExpressionOrTemplateLiteral;\n    function isPunctuation(kind) {\n        return 16 <= kind && kind <= 69;\n    }\n    ts.isPunctuation = isPunctuation;\n    function isInsideTemplateLiteral(node, position) {\n        return ts.isTemplateLiteralKind(node.kind)\n            && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd());\n    }\n    ts.isInsideTemplateLiteral = isInsideTemplateLiteral;\n    function isAccessibilityModifier(kind) {\n        switch (kind) {\n            case 113:\n            case 111:\n            case 112:\n                return true;\n        }\n        return false;\n    }\n    ts.isAccessibilityModifier = isAccessibilityModifier;\n    function compareDataObjects(dst, src) {\n        for (var e in dst) {\n            if (typeof dst[e] === \"object\") {\n                if (!compareDataObjects(dst[e], src[e])) {\n                    return false;\n                }\n            }\n            else if (typeof dst[e] !== \"function\") {\n                if (dst[e] !== src[e]) {\n                    return false;\n                }\n            }\n        }\n        return true;\n    }\n    ts.compareDataObjects = compareDataObjects;\n    function isArrayLiteralOrObjectLiteralDestructuringPattern(node) {\n        if (node.kind === 175 ||\n            node.kind === 176) {\n            if (node.parent.kind === 192 &&\n                node.parent.left === node &&\n                node.parent.operatorToken.kind === 57) {\n                return true;\n            }\n            if (node.parent.kind === 213 &&\n                node.parent.initializer === node) {\n                return true;\n            }\n            if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 257 ? node.parent.parent : node.parent)) {\n                return true;\n            }\n        }\n        return false;\n    }\n    ts.isArrayLiteralOrObjectLiteralDestructuringPattern = isArrayLiteralOrObjectLiteralDestructuringPattern;\n    function hasTrailingDirectorySeparator(path) {\n        var lastCharacter = path.charAt(path.length - 1);\n        return lastCharacter === \"/\" || lastCharacter === \"\\\\\";\n    }\n    ts.hasTrailingDirectorySeparator = hasTrailingDirectorySeparator;\n    function isInReferenceComment(sourceFile, position) {\n        return isInCommentHelper(sourceFile, position, isReferenceComment);\n        function isReferenceComment(c) {\n            var commentText = sourceFile.text.substring(c.pos, c.end);\n            return tripleSlashDirectivePrefixRegex.test(commentText);\n        }\n    }\n    ts.isInReferenceComment = isInReferenceComment;\n    function isInNonReferenceComment(sourceFile, position) {\n        return isInCommentHelper(sourceFile, position, isNonReferenceComment);\n        function isNonReferenceComment(c) {\n            var commentText = sourceFile.text.substring(c.pos, c.end);\n            return !tripleSlashDirectivePrefixRegex.test(commentText);\n        }\n    }\n    ts.isInNonReferenceComment = isInNonReferenceComment;\n})(ts || (ts = {}));\n(function (ts) {\n    function isFirstDeclarationOfSymbolParameter(symbol) {\n        return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 144;\n    }\n    ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter;\n    var displayPartWriter = getDisplayPartWriter();\n    function getDisplayPartWriter() {\n        var displayParts;\n        var lineStart;\n        var indent;\n        resetWriter();\n        return {\n            displayParts: function () { return displayParts; },\n            writeKeyword: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.keyword); },\n            writeOperator: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.operator); },\n            writePunctuation: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.punctuation); },\n            writeSpace: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.space); },\n            writeStringLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral); },\n            writeParameter: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.parameterName); },\n            writeSymbol: writeSymbol,\n            writeLine: writeLine,\n            increaseIndent: function () { indent++; },\n            decreaseIndent: function () { indent--; },\n            clear: resetWriter,\n            trackSymbol: ts.noop,\n            reportInaccessibleThisError: ts.noop\n        };\n        function writeIndent() {\n            if (lineStart) {\n                var indentString = ts.getIndentString(indent);\n                if (indentString) {\n                    displayParts.push(displayPart(indentString, ts.SymbolDisplayPartKind.space));\n                }\n                lineStart = false;\n            }\n        }\n        function writeKind(text, kind) {\n            writeIndent();\n            displayParts.push(displayPart(text, kind));\n        }\n        function writeSymbol(text, symbol) {\n            writeIndent();\n            displayParts.push(symbolPart(text, symbol));\n        }\n        function writeLine() {\n            displayParts.push(lineBreakPart());\n            lineStart = true;\n        }\n        function resetWriter() {\n            displayParts = [];\n            lineStart = true;\n            indent = 0;\n        }\n    }\n    function symbolPart(text, symbol) {\n        return displayPart(text, displayPartKind(symbol));\n        function displayPartKind(symbol) {\n            var flags = symbol.flags;\n            if (flags & 3) {\n                return isFirstDeclarationOfSymbolParameter(symbol) ? ts.SymbolDisplayPartKind.parameterName : ts.SymbolDisplayPartKind.localName;\n            }\n            else if (flags & 4) {\n                return ts.SymbolDisplayPartKind.propertyName;\n            }\n            else if (flags & 32768) {\n                return ts.SymbolDisplayPartKind.propertyName;\n            }\n            else if (flags & 65536) {\n                return ts.SymbolDisplayPartKind.propertyName;\n            }\n            else if (flags & 8) {\n                return ts.SymbolDisplayPartKind.enumMemberName;\n            }\n            else if (flags & 16) {\n                return ts.SymbolDisplayPartKind.functionName;\n            }\n            else if (flags & 32) {\n                return ts.SymbolDisplayPartKind.className;\n            }\n            else if (flags & 64) {\n                return ts.SymbolDisplayPartKind.interfaceName;\n            }\n            else if (flags & 384) {\n                return ts.SymbolDisplayPartKind.enumName;\n            }\n            else if (flags & 1536) {\n                return ts.SymbolDisplayPartKind.moduleName;\n            }\n            else if (flags & 8192) {\n                return ts.SymbolDisplayPartKind.methodName;\n            }\n            else if (flags & 262144) {\n                return ts.SymbolDisplayPartKind.typeParameterName;\n            }\n            else if (flags & 524288) {\n                return ts.SymbolDisplayPartKind.aliasName;\n            }\n            else if (flags & 8388608) {\n                return ts.SymbolDisplayPartKind.aliasName;\n            }\n            return ts.SymbolDisplayPartKind.text;\n        }\n    }\n    ts.symbolPart = symbolPart;\n    function displayPart(text, kind) {\n        return {\n            text: text,\n            kind: ts.SymbolDisplayPartKind[kind]\n        };\n    }\n    ts.displayPart = displayPart;\n    function spacePart() {\n        return displayPart(\" \", ts.SymbolDisplayPartKind.space);\n    }\n    ts.spacePart = spacePart;\n    function keywordPart(kind) {\n        return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.keyword);\n    }\n    ts.keywordPart = keywordPart;\n    function punctuationPart(kind) {\n        return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.punctuation);\n    }\n    ts.punctuationPart = punctuationPart;\n    function operatorPart(kind) {\n        return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.operator);\n    }\n    ts.operatorPart = operatorPart;\n    function textOrKeywordPart(text) {\n        var kind = ts.stringToToken(text);\n        return kind === undefined\n            ? textPart(text)\n            : keywordPart(kind);\n    }\n    ts.textOrKeywordPart = textOrKeywordPart;\n    function textPart(text) {\n        return displayPart(text, ts.SymbolDisplayPartKind.text);\n    }\n    ts.textPart = textPart;\n    var carriageReturnLineFeed = \"\\r\\n\";\n    function getNewLineOrDefaultFromHost(host) {\n        return host.getNewLine ? host.getNewLine() : carriageReturnLineFeed;\n    }\n    ts.getNewLineOrDefaultFromHost = getNewLineOrDefaultFromHost;\n    function lineBreakPart() {\n        return displayPart(\"\\n\", ts.SymbolDisplayPartKind.lineBreak);\n    }\n    ts.lineBreakPart = lineBreakPart;\n    function mapToDisplayParts(writeDisplayParts) {\n        writeDisplayParts(displayPartWriter);\n        var result = displayPartWriter.displayParts();\n        displayPartWriter.clear();\n        return result;\n    }\n    ts.mapToDisplayParts = mapToDisplayParts;\n    function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags) {\n        return mapToDisplayParts(function (writer) {\n            typechecker.getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);\n        });\n    }\n    ts.typeToDisplayParts = typeToDisplayParts;\n    function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags) {\n        return mapToDisplayParts(function (writer) {\n            typeChecker.getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags);\n        });\n    }\n    ts.symbolToDisplayParts = symbolToDisplayParts;\n    function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, flags) {\n        return mapToDisplayParts(function (writer) {\n            typechecker.getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags);\n        });\n    }\n    ts.signatureToDisplayParts = signatureToDisplayParts;\n    function getDeclaredName(typeChecker, symbol, location) {\n        if (isImportOrExportSpecifierName(location)) {\n            return location.getText();\n        }\n        else if (ts.isStringOrNumericLiteral(location) &&\n            location.parent.kind === 142) {\n            return location.text;\n        }\n        var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol);\n        var name = typeChecker.symbolToString(localExportDefaultSymbol || symbol);\n        return name;\n    }\n    ts.getDeclaredName = getDeclaredName;\n    function isImportOrExportSpecifierName(location) {\n        return location.parent &&\n            (location.parent.kind === 239 || location.parent.kind === 243) &&\n            location.parent.propertyName === location;\n    }\n    ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName;\n    function stripQuotes(name) {\n        var length = name.length;\n        if (length >= 2 &&\n            name.charCodeAt(0) === name.charCodeAt(length - 1) &&\n            (name.charCodeAt(0) === 34 || name.charCodeAt(0) === 39)) {\n            return name.substring(1, length - 1);\n        }\n        ;\n        return name;\n    }\n    ts.stripQuotes = stripQuotes;\n    function scriptKindIs(fileName, host) {\n        var scriptKinds = [];\n        for (var _i = 2; _i < arguments.length; _i++) {\n            scriptKinds[_i - 2] = arguments[_i];\n        }\n        var scriptKind = getScriptKind(fileName, host);\n        return ts.forEach(scriptKinds, function (k) { return k === scriptKind; });\n    }\n    ts.scriptKindIs = scriptKindIs;\n    function getScriptKind(fileName, host) {\n        var scriptKind;\n        if (host && host.getScriptKind) {\n            scriptKind = host.getScriptKind(fileName);\n        }\n        if (!scriptKind) {\n            scriptKind = ts.getScriptKindFromFileName(fileName);\n        }\n        return ts.ensureScriptKind(fileName, scriptKind);\n    }\n    ts.getScriptKind = getScriptKind;\n    function sanitizeConfigFile(configFileName, content) {\n        var options = {\n            fileName: \"config.js\",\n            compilerOptions: {\n                target: 2,\n                removeComments: true\n            },\n            reportDiagnostics: true\n        };\n        var _a = ts.transpileModule(\"(\" + content + \")\", options), outputText = _a.outputText, diagnostics = _a.diagnostics;\n        var trimmedOutput = outputText.trim();\n        for (var _i = 0, diagnostics_2 = diagnostics; _i < diagnostics_2.length; _i++) {\n            var diagnostic = diagnostics_2[_i];\n            diagnostic.start = diagnostic.start - 1;\n        }\n        var _b = ts.parseConfigFileTextToJson(configFileName, trimmedOutput.substring(1, trimmedOutput.length - 2), false), config = _b.config, error = _b.error;\n        return {\n            configJsonObject: config || {},\n            diagnostics: error ? ts.concatenate(diagnostics, [error]) : diagnostics\n        };\n    }\n    ts.sanitizeConfigFile = sanitizeConfigFile;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var BreakpointResolver;\n    (function (BreakpointResolver) {\n        function spanInSourceFileAtLocation(sourceFile, position) {\n            if (sourceFile.isDeclarationFile) {\n                return undefined;\n            }\n            var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position);\n            var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line;\n            if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart(sourceFile)).line > lineOfPosition) {\n                tokenAtLocation = ts.findPrecedingToken(tokenAtLocation.pos, sourceFile);\n                if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) {\n                    return undefined;\n                }\n            }\n            if (ts.isInAmbientContext(tokenAtLocation)) {\n                return undefined;\n            }\n            return spanInNode(tokenAtLocation);\n            function textSpan(startNode, endNode) {\n                var start = startNode.decorators ?\n                    ts.skipTrivia(sourceFile.text, startNode.decorators.end) :\n                    startNode.getStart(sourceFile);\n                return ts.createTextSpanFromBounds(start, (endNode || startNode).getEnd());\n            }\n            function textSpanEndingAtNextToken(startNode, previousTokenToFindNextEndToken) {\n                return textSpan(startNode, ts.findNextToken(previousTokenToFindNextEndToken, previousTokenToFindNextEndToken.parent));\n            }\n            function spanInNodeIfStartsOnSameLine(node, otherwiseOnNode) {\n                if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line) {\n                    return spanInNode(node);\n                }\n                return spanInNode(otherwiseOnNode);\n            }\n            function spanInNodeArray(nodeArray) {\n                return ts.createTextSpanFromBounds(ts.skipTrivia(sourceFile.text, nodeArray.pos), nodeArray.end);\n            }\n            function spanInPreviousNode(node) {\n                return spanInNode(ts.findPrecedingToken(node.pos, sourceFile));\n            }\n            function spanInNextNode(node) {\n                return spanInNode(ts.findNextToken(node, node.parent));\n            }\n            function spanInNode(node) {\n                if (node) {\n                    switch (node.kind) {\n                        case 205:\n                            return spanInVariableDeclaration(node.declarationList.declarations[0]);\n                        case 223:\n                        case 147:\n                        case 146:\n                            return spanInVariableDeclaration(node);\n                        case 144:\n                            return spanInParameterDeclaration(node);\n                        case 225:\n                        case 149:\n                        case 148:\n                        case 151:\n                        case 152:\n                        case 150:\n                        case 184:\n                        case 185:\n                            return spanInFunctionDeclaration(node);\n                        case 204:\n                            if (ts.isFunctionBlock(node)) {\n                                return spanInFunctionBlock(node);\n                            }\n                        case 231:\n                            return spanInBlock(node);\n                        case 256:\n                            return spanInBlock(node.block);\n                        case 207:\n                            return textSpan(node.expression);\n                        case 216:\n                            return textSpan(node.getChildAt(0), node.expression);\n                        case 210:\n                            return textSpanEndingAtNextToken(node, node.expression);\n                        case 209:\n                            return spanInNode(node.statement);\n                        case 222:\n                            return textSpan(node.getChildAt(0));\n                        case 208:\n                            return textSpanEndingAtNextToken(node, node.expression);\n                        case 219:\n                            return spanInNode(node.statement);\n                        case 215:\n                        case 214:\n                            return textSpan(node.getChildAt(0), node.label);\n                        case 211:\n                            return spanInForStatement(node);\n                        case 212:\n                            return textSpanEndingAtNextToken(node, node.expression);\n                        case 213:\n                            return spanInInitializerOfForLike(node);\n                        case 218:\n                            return textSpanEndingAtNextToken(node, node.expression);\n                        case 253:\n                        case 254:\n                            return spanInNode(node.statements[0]);\n                        case 221:\n                            return spanInBlock(node.tryBlock);\n                        case 220:\n                            return textSpan(node, node.expression);\n                        case 240:\n                            return textSpan(node, node.expression);\n                        case 234:\n                            return textSpan(node, node.moduleReference);\n                        case 235:\n                            return textSpan(node, node.moduleSpecifier);\n                        case 241:\n                            return textSpan(node, node.moduleSpecifier);\n                        case 230:\n                            if (ts.getModuleInstanceState(node) !== 1) {\n                                return undefined;\n                            }\n                        case 226:\n                        case 229:\n                        case 260:\n                        case 174:\n                            return textSpan(node);\n                        case 217:\n                            return spanInNode(node.statement);\n                        case 145:\n                            return spanInNodeArray(node.parent.decorators);\n                        case 172:\n                        case 173:\n                            return spanInBindingPattern(node);\n                        case 227:\n                        case 228:\n                            return undefined;\n                        case 24:\n                        case 1:\n                            return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile));\n                        case 25:\n                            return spanInPreviousNode(node);\n                        case 16:\n                            return spanInOpenBraceToken(node);\n                        case 17:\n                            return spanInCloseBraceToken(node);\n                        case 21:\n                            return spanInCloseBracketToken(node);\n                        case 18:\n                            return spanInOpenParenToken(node);\n                        case 19:\n                            return spanInCloseParenToken(node);\n                        case 55:\n                            return spanInColonToken(node);\n                        case 28:\n                        case 26:\n                            return spanInGreaterThanOrLessThanToken(node);\n                        case 105:\n                            return spanInWhileKeyword(node);\n                        case 81:\n                        case 73:\n                        case 86:\n                            return spanInNextNode(node);\n                        case 140:\n                            return spanInOfKeyword(node);\n                        default:\n                            if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node)) {\n                                return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node);\n                            }\n                            if ((node.kind === 70 ||\n                                node.kind == 196 ||\n                                node.kind === 257 ||\n                                node.kind === 258) &&\n                                ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {\n                                return textSpan(node);\n                            }\n                            if (node.kind === 192) {\n                                var binaryExpression = node;\n                                if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left)) {\n                                    return spanInArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left);\n                                }\n                                if (binaryExpression.operatorToken.kind === 57 &&\n                                    ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.parent)) {\n                                    return textSpan(node);\n                                }\n                                if (binaryExpression.operatorToken.kind === 25) {\n                                    return spanInNode(binaryExpression.left);\n                                }\n                            }\n                            if (ts.isPartOfExpression(node)) {\n                                switch (node.parent.kind) {\n                                    case 209:\n                                        return spanInPreviousNode(node);\n                                    case 145:\n                                        return spanInNode(node.parent);\n                                    case 211:\n                                    case 213:\n                                        return textSpan(node);\n                                    case 192:\n                                        if (node.parent.operatorToken.kind === 25) {\n                                            return textSpan(node);\n                                        }\n                                        break;\n                                    case 185:\n                                        if (node.parent.body === node) {\n                                            return textSpan(node);\n                                        }\n                                        break;\n                                }\n                            }\n                            if (node.parent.kind === 257 &&\n                                node.parent.name === node &&\n                                !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) {\n                                return spanInNode(node.parent.initializer);\n                            }\n                            if (node.parent.kind === 182 && node.parent.type === node) {\n                                return spanInNextNode(node.parent.type);\n                            }\n                            if (ts.isFunctionLike(node.parent) && node.parent.type === node) {\n                                return spanInPreviousNode(node);\n                            }\n                            if ((node.parent.kind === 223 ||\n                                node.parent.kind === 144)) {\n                                var paramOrVarDecl = node.parent;\n                                if (paramOrVarDecl.initializer === node ||\n                                    paramOrVarDecl.type === node ||\n                                    ts.isAssignmentOperator(node.kind)) {\n                                    return spanInPreviousNode(node);\n                                }\n                            }\n                            if (node.parent.kind === 192) {\n                                var binaryExpression = node.parent;\n                                if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) &&\n                                    (binaryExpression.right === node ||\n                                        binaryExpression.operatorToken === node)) {\n                                    return spanInPreviousNode(node);\n                                }\n                            }\n                            return spanInNode(node.parent);\n                    }\n                }\n                function textSpanFromVariableDeclaration(variableDeclaration) {\n                    var declarations = variableDeclaration.parent.declarations;\n                    if (declarations && declarations[0] === variableDeclaration) {\n                        return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration);\n                    }\n                    else {\n                        return textSpan(variableDeclaration);\n                    }\n                }\n                function spanInVariableDeclaration(variableDeclaration) {\n                    if (variableDeclaration.parent.parent.kind === 212) {\n                        return spanInNode(variableDeclaration.parent.parent);\n                    }\n                    if (ts.isBindingPattern(variableDeclaration.name)) {\n                        return spanInBindingPattern(variableDeclaration.name);\n                    }\n                    if (variableDeclaration.initializer ||\n                        ts.hasModifier(variableDeclaration, 1) ||\n                        variableDeclaration.parent.parent.kind === 213) {\n                        return textSpanFromVariableDeclaration(variableDeclaration);\n                    }\n                    var declarations = variableDeclaration.parent.declarations;\n                    if (declarations && declarations[0] !== variableDeclaration) {\n                        return spanInNode(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent));\n                    }\n                }\n                function canHaveSpanInParameterDeclaration(parameter) {\n                    return !!parameter.initializer || parameter.dotDotDotToken !== undefined ||\n                        ts.hasModifier(parameter, 4 | 8);\n                }\n                function spanInParameterDeclaration(parameter) {\n                    if (ts.isBindingPattern(parameter.name)) {\n                        return spanInBindingPattern(parameter.name);\n                    }\n                    else if (canHaveSpanInParameterDeclaration(parameter)) {\n                        return textSpan(parameter);\n                    }\n                    else {\n                        var functionDeclaration = parameter.parent;\n                        var indexOfParameter = ts.indexOf(functionDeclaration.parameters, parameter);\n                        if (indexOfParameter) {\n                            return spanInParameterDeclaration(functionDeclaration.parameters[indexOfParameter - 1]);\n                        }\n                        else {\n                            return spanInNode(functionDeclaration.body);\n                        }\n                    }\n                }\n                function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) {\n                    return ts.hasModifier(functionDeclaration, 1) ||\n                        (functionDeclaration.parent.kind === 226 && functionDeclaration.kind !== 150);\n                }\n                function spanInFunctionDeclaration(functionDeclaration) {\n                    if (!functionDeclaration.body) {\n                        return undefined;\n                    }\n                    if (canFunctionHaveSpanInWholeDeclaration(functionDeclaration)) {\n                        return textSpan(functionDeclaration);\n                    }\n                    return spanInNode(functionDeclaration.body);\n                }\n                function spanInFunctionBlock(block) {\n                    var nodeForSpanInBlock = block.statements.length ? block.statements[0] : block.getLastToken();\n                    if (canFunctionHaveSpanInWholeDeclaration(block.parent)) {\n                        return spanInNodeIfStartsOnSameLine(block.parent, nodeForSpanInBlock);\n                    }\n                    return spanInNode(nodeForSpanInBlock);\n                }\n                function spanInBlock(block) {\n                    switch (block.parent.kind) {\n                        case 230:\n                            if (ts.getModuleInstanceState(block.parent) !== 1) {\n                                return undefined;\n                            }\n                        case 210:\n                        case 208:\n                        case 212:\n                            return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]);\n                        case 211:\n                        case 213:\n                            return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]);\n                    }\n                    return spanInNode(block.statements[0]);\n                }\n                function spanInInitializerOfForLike(forLikeStatement) {\n                    if (forLikeStatement.initializer.kind === 224) {\n                        var variableDeclarationList = forLikeStatement.initializer;\n                        if (variableDeclarationList.declarations.length > 0) {\n                            return spanInNode(variableDeclarationList.declarations[0]);\n                        }\n                    }\n                    else {\n                        return spanInNode(forLikeStatement.initializer);\n                    }\n                }\n                function spanInForStatement(forStatement) {\n                    if (forStatement.initializer) {\n                        return spanInInitializerOfForLike(forStatement);\n                    }\n                    if (forStatement.condition) {\n                        return textSpan(forStatement.condition);\n                    }\n                    if (forStatement.incrementor) {\n                        return textSpan(forStatement.incrementor);\n                    }\n                }\n                function spanInBindingPattern(bindingPattern) {\n                    var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 198 ? element : undefined; });\n                    if (firstBindingElement) {\n                        return spanInNode(firstBindingElement);\n                    }\n                    if (bindingPattern.parent.kind === 174) {\n                        return textSpan(bindingPattern.parent);\n                    }\n                    return textSpanFromVariableDeclaration(bindingPattern.parent);\n                }\n                function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) {\n                    ts.Debug.assert(node.kind !== 173 && node.kind !== 172);\n                    var elements = node.kind === 175 ?\n                        node.elements :\n                        node.properties;\n                    var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 198 ? element : undefined; });\n                    if (firstBindingElement) {\n                        return spanInNode(firstBindingElement);\n                    }\n                    return textSpan(node.parent.kind === 192 ? node.parent : node);\n                }\n                function spanInOpenBraceToken(node) {\n                    switch (node.parent.kind) {\n                        case 229:\n                            var enumDeclaration = node.parent;\n                            return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile));\n                        case 226:\n                            var classDeclaration = node.parent;\n                            return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile));\n                        case 232:\n                            return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]);\n                    }\n                    return spanInNode(node.parent);\n                }\n                function spanInCloseBraceToken(node) {\n                    switch (node.parent.kind) {\n                        case 231:\n                            if (ts.getModuleInstanceState(node.parent.parent) !== 1) {\n                                return undefined;\n                            }\n                        case 229:\n                        case 226:\n                            return textSpan(node);\n                        case 204:\n                            if (ts.isFunctionBlock(node.parent)) {\n                                return textSpan(node);\n                            }\n                        case 256:\n                            return spanInNode(ts.lastOrUndefined(node.parent.statements));\n                        case 232:\n                            var caseBlock = node.parent;\n                            var lastClause = ts.lastOrUndefined(caseBlock.clauses);\n                            if (lastClause) {\n                                return spanInNode(ts.lastOrUndefined(lastClause.statements));\n                            }\n                            return undefined;\n                        case 172:\n                            var bindingPattern = node.parent;\n                            return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);\n                        default:\n                            if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {\n                                var objectLiteral = node.parent;\n                                return textSpan(ts.lastOrUndefined(objectLiteral.properties) || objectLiteral);\n                            }\n                            return spanInNode(node.parent);\n                    }\n                }\n                function spanInCloseBracketToken(node) {\n                    switch (node.parent.kind) {\n                        case 173:\n                            var bindingPattern = node.parent;\n                            return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);\n                        default:\n                            if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {\n                                var arrayLiteral = node.parent;\n                                return textSpan(ts.lastOrUndefined(arrayLiteral.elements) || arrayLiteral);\n                            }\n                            return spanInNode(node.parent);\n                    }\n                }\n                function spanInOpenParenToken(node) {\n                    if (node.parent.kind === 209 ||\n                        node.parent.kind === 179 ||\n                        node.parent.kind === 180) {\n                        return spanInPreviousNode(node);\n                    }\n                    if (node.parent.kind === 183) {\n                        return spanInNextNode(node);\n                    }\n                    return spanInNode(node.parent);\n                }\n                function spanInCloseParenToken(node) {\n                    switch (node.parent.kind) {\n                        case 184:\n                        case 225:\n                        case 185:\n                        case 149:\n                        case 148:\n                        case 151:\n                        case 152:\n                        case 150:\n                        case 210:\n                        case 209:\n                        case 211:\n                        case 213:\n                        case 179:\n                        case 180:\n                        case 183:\n                            return spanInPreviousNode(node);\n                        default:\n                            return spanInNode(node.parent);\n                    }\n                }\n                function spanInColonToken(node) {\n                    if (ts.isFunctionLike(node.parent) ||\n                        node.parent.kind === 257 ||\n                        node.parent.kind === 144) {\n                        return spanInPreviousNode(node);\n                    }\n                    return spanInNode(node.parent);\n                }\n                function spanInGreaterThanOrLessThanToken(node) {\n                    if (node.parent.kind === 182) {\n                        return spanInNextNode(node);\n                    }\n                    return spanInNode(node.parent);\n                }\n                function spanInWhileKeyword(node) {\n                    if (node.parent.kind === 209) {\n                        return textSpanEndingAtNextToken(node, node.parent.expression);\n                    }\n                    return spanInNode(node.parent);\n                }\n                function spanInOfKeyword(node) {\n                    if (node.parent.kind === 213) {\n                        return spanInNextNode(node);\n                    }\n                    return spanInNode(node.parent);\n                }\n            }\n        }\n        BreakpointResolver.spanInSourceFileAtLocation = spanInSourceFileAtLocation;\n    })(BreakpointResolver = ts.BreakpointResolver || (ts.BreakpointResolver = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function createClassifier() {\n        var scanner = ts.createScanner(5, false);\n        var noRegexTable = [];\n        noRegexTable[70] = true;\n        noRegexTable[9] = true;\n        noRegexTable[8] = true;\n        noRegexTable[11] = true;\n        noRegexTable[98] = true;\n        noRegexTable[42] = true;\n        noRegexTable[43] = true;\n        noRegexTable[19] = true;\n        noRegexTable[21] = true;\n        noRegexTable[17] = true;\n        noRegexTable[100] = true;\n        noRegexTable[85] = true;\n        var templateStack = [];\n        function canFollow(keyword1, keyword2) {\n            if (ts.isAccessibilityModifier(keyword1)) {\n                if (keyword2 === 124 ||\n                    keyword2 === 133 ||\n                    keyword2 === 122 ||\n                    keyword2 === 114) {\n                    return true;\n                }\n                return false;\n            }\n            return true;\n        }\n        function convertClassifications(classifications, text) {\n            var entries = [];\n            var dense = classifications.spans;\n            var lastEnd = 0;\n            for (var i = 0, n = dense.length; i < n; i += 3) {\n                var start = dense[i];\n                var length_4 = dense[i + 1];\n                var type = dense[i + 2];\n                if (lastEnd >= 0) {\n                    var whitespaceLength_1 = start - lastEnd;\n                    if (whitespaceLength_1 > 0) {\n                        entries.push({ length: whitespaceLength_1, classification: ts.TokenClass.Whitespace });\n                    }\n                }\n                entries.push({ length: length_4, classification: convertClassification(type) });\n                lastEnd = start + length_4;\n            }\n            var whitespaceLength = text.length - lastEnd;\n            if (whitespaceLength > 0) {\n                entries.push({ length: whitespaceLength, classification: ts.TokenClass.Whitespace });\n            }\n            return { entries: entries, finalLexState: classifications.endOfLineState };\n        }\n        function convertClassification(type) {\n            switch (type) {\n                case 1: return ts.TokenClass.Comment;\n                case 3: return ts.TokenClass.Keyword;\n                case 4: return ts.TokenClass.NumberLiteral;\n                case 5: return ts.TokenClass.Operator;\n                case 6: return ts.TokenClass.StringLiteral;\n                case 8: return ts.TokenClass.Whitespace;\n                case 10: return ts.TokenClass.Punctuation;\n                case 2:\n                case 11:\n                case 12:\n                case 13:\n                case 14:\n                case 15:\n                case 16:\n                case 9:\n                case 17:\n                default:\n                    return ts.TokenClass.Identifier;\n            }\n        }\n        function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) {\n            return convertClassifications(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text);\n        }\n        function getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent) {\n            var offset = 0;\n            var token = 0;\n            var lastNonTriviaToken = 0;\n            while (templateStack.length > 0) {\n                templateStack.pop();\n            }\n            switch (lexState) {\n                case 3:\n                    text = \"\\\"\\\\\\n\" + text;\n                    offset = 3;\n                    break;\n                case 2:\n                    text = \"'\\\\\\n\" + text;\n                    offset = 3;\n                    break;\n                case 1:\n                    text = \"/*\\n\" + text;\n                    offset = 3;\n                    break;\n                case 4:\n                    text = \"`\\n\" + text;\n                    offset = 2;\n                    break;\n                case 5:\n                    text = \"}\\n\" + text;\n                    offset = 2;\n                case 6:\n                    templateStack.push(13);\n                    break;\n            }\n            scanner.setText(text);\n            var result = {\n                endOfLineState: 0,\n                spans: []\n            };\n            var angleBracketStack = 0;\n            do {\n                token = scanner.scan();\n                if (!ts.isTrivia(token)) {\n                    if ((token === 40 || token === 62) && !noRegexTable[lastNonTriviaToken]) {\n                        if (scanner.reScanSlashToken() === 11) {\n                            token = 11;\n                        }\n                    }\n                    else if (lastNonTriviaToken === 22 && isKeyword(token)) {\n                        token = 70;\n                    }\n                    else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) {\n                        token = 70;\n                    }\n                    else if (lastNonTriviaToken === 70 &&\n                        token === 26) {\n                        angleBracketStack++;\n                    }\n                    else if (token === 28 && angleBracketStack > 0) {\n                        angleBracketStack--;\n                    }\n                    else if (token === 118 ||\n                        token === 134 ||\n                        token === 132 ||\n                        token === 121 ||\n                        token === 135) {\n                        if (angleBracketStack > 0 && !syntacticClassifierAbsent) {\n                            token = 70;\n                        }\n                    }\n                    else if (token === 13) {\n                        templateStack.push(token);\n                    }\n                    else if (token === 16) {\n                        if (templateStack.length > 0) {\n                            templateStack.push(token);\n                        }\n                    }\n                    else if (token === 17) {\n                        if (templateStack.length > 0) {\n                            var lastTemplateStackToken = ts.lastOrUndefined(templateStack);\n                            if (lastTemplateStackToken === 13) {\n                                token = scanner.reScanTemplateToken();\n                                if (token === 15) {\n                                    templateStack.pop();\n                                }\n                                else {\n                                    ts.Debug.assert(token === 14, \"Should have been a template middle. Was \" + token);\n                                }\n                            }\n                            else {\n                                ts.Debug.assert(lastTemplateStackToken === 16, \"Should have been an open brace. Was: \" + token);\n                                templateStack.pop();\n                            }\n                        }\n                    }\n                    lastNonTriviaToken = token;\n                }\n                processToken();\n            } while (token !== 1);\n            return result;\n            function processToken() {\n                var start = scanner.getTokenPos();\n                var end = scanner.getTextPos();\n                addResult(start, end, classFromKind(token));\n                if (end >= text.length) {\n                    if (token === 9) {\n                        var tokenText = scanner.getTokenText();\n                        if (scanner.isUnterminated()) {\n                            var lastCharIndex = tokenText.length - 1;\n                            var numBackslashes = 0;\n                            while (tokenText.charCodeAt(lastCharIndex - numBackslashes) === 92) {\n                                numBackslashes++;\n                            }\n                            if (numBackslashes & 1) {\n                                var quoteChar = tokenText.charCodeAt(0);\n                                result.endOfLineState = quoteChar === 34\n                                    ? 3\n                                    : 2;\n                            }\n                        }\n                    }\n                    else if (token === 3) {\n                        if (scanner.isUnterminated()) {\n                            result.endOfLineState = 1;\n                        }\n                    }\n                    else if (ts.isTemplateLiteralKind(token)) {\n                        if (scanner.isUnterminated()) {\n                            if (token === 15) {\n                                result.endOfLineState = 5;\n                            }\n                            else if (token === 12) {\n                                result.endOfLineState = 4;\n                            }\n                            else {\n                                ts.Debug.fail(\"Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #\" + token);\n                            }\n                        }\n                    }\n                    else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 13) {\n                        result.endOfLineState = 6;\n                    }\n                }\n            }\n            function addResult(start, end, classification) {\n                if (classification === 8) {\n                    return;\n                }\n                if (start === 0 && offset > 0) {\n                    start += offset;\n                }\n                start -= offset;\n                end -= offset;\n                var length = end - start;\n                if (length > 0) {\n                    result.spans.push(start);\n                    result.spans.push(length);\n                    result.spans.push(classification);\n                }\n            }\n        }\n        function isBinaryExpressionOperatorToken(token) {\n            switch (token) {\n                case 38:\n                case 40:\n                case 41:\n                case 36:\n                case 37:\n                case 44:\n                case 45:\n                case 46:\n                case 26:\n                case 28:\n                case 29:\n                case 30:\n                case 92:\n                case 91:\n                case 117:\n                case 31:\n                case 32:\n                case 33:\n                case 34:\n                case 47:\n                case 49:\n                case 48:\n                case 52:\n                case 53:\n                case 68:\n                case 67:\n                case 69:\n                case 64:\n                case 65:\n                case 66:\n                case 58:\n                case 59:\n                case 60:\n                case 62:\n                case 63:\n                case 57:\n                case 25:\n                    return true;\n                default:\n                    return false;\n            }\n        }\n        function isPrefixUnaryExpressionOperatorToken(token) {\n            switch (token) {\n                case 36:\n                case 37:\n                case 51:\n                case 50:\n                case 42:\n                case 43:\n                    return true;\n                default:\n                    return false;\n            }\n        }\n        function isKeyword(token) {\n            return token >= 71 && token <= 140;\n        }\n        function classFromKind(token) {\n            if (isKeyword(token)) {\n                return 3;\n            }\n            else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) {\n                return 5;\n            }\n            else if (token >= 16 && token <= 69) {\n                return 10;\n            }\n            switch (token) {\n                case 8:\n                    return 4;\n                case 9:\n                    return 6;\n                case 11:\n                    return 7;\n                case 7:\n                case 3:\n                case 2:\n                    return 1;\n                case 5:\n                case 4:\n                    return 8;\n                case 70:\n                default:\n                    if (ts.isTemplateLiteralKind(token)) {\n                        return 6;\n                    }\n                    return 2;\n            }\n        }\n        return {\n            getClassificationsForLine: getClassificationsForLine,\n            getEncodedLexicalClassifications: getEncodedLexicalClassifications\n        };\n    }\n    ts.createClassifier = createClassifier;\n    function getSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span) {\n        return convertClassifications(getEncodedSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span));\n    }\n    ts.getSemanticClassifications = getSemanticClassifications;\n    function checkForClassificationCancellation(cancellationToken, kind) {\n        switch (kind) {\n            case 230:\n            case 226:\n            case 227:\n            case 225:\n                cancellationToken.throwIfCancellationRequested();\n        }\n    }\n    function getEncodedSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span) {\n        var result = [];\n        processNode(sourceFile);\n        return { spans: result, endOfLineState: 0 };\n        function pushClassification(start, length, type) {\n            result.push(start);\n            result.push(length);\n            result.push(type);\n        }\n        function classifySymbol(symbol, meaningAtPosition) {\n            var flags = symbol.getFlags();\n            if ((flags & 788448) === 0) {\n                return;\n            }\n            if (flags & 32) {\n                return 11;\n            }\n            else if (flags & 384) {\n                return 12;\n            }\n            else if (flags & 524288) {\n                return 16;\n            }\n            else if (meaningAtPosition & 2) {\n                if (flags & 64) {\n                    return 13;\n                }\n                else if (flags & 262144) {\n                    return 15;\n                }\n            }\n            else if (flags & 1536) {\n                if (meaningAtPosition & 4 ||\n                    (meaningAtPosition & 1 && hasValueSideModule(symbol))) {\n                    return 14;\n                }\n            }\n            return undefined;\n            function hasValueSideModule(symbol) {\n                return ts.forEach(symbol.declarations, function (declaration) {\n                    return declaration.kind === 230 &&\n                        ts.getModuleInstanceState(declaration) === 1;\n                });\n            }\n        }\n        function processNode(node) {\n            if (node && ts.textSpanIntersectsWith(span, node.getFullStart(), node.getFullWidth())) {\n                var kind = node.kind;\n                checkForClassificationCancellation(cancellationToken, kind);\n                if (kind === 70 && !ts.nodeIsMissing(node)) {\n                    var identifier = node;\n                    if (classifiableNames[identifier.text]) {\n                        var symbol = typeChecker.getSymbolAtLocation(node);\n                        if (symbol) {\n                            var type = classifySymbol(symbol, ts.getMeaningFromLocation(node));\n                            if (type) {\n                                pushClassification(node.getStart(), node.getWidth(), type);\n                            }\n                        }\n                    }\n                }\n                ts.forEachChild(node, processNode);\n            }\n        }\n    }\n    ts.getEncodedSemanticClassifications = getEncodedSemanticClassifications;\n    function getClassificationTypeName(type) {\n        switch (type) {\n            case 1: return ts.ClassificationTypeNames.comment;\n            case 2: return ts.ClassificationTypeNames.identifier;\n            case 3: return ts.ClassificationTypeNames.keyword;\n            case 4: return ts.ClassificationTypeNames.numericLiteral;\n            case 5: return ts.ClassificationTypeNames.operator;\n            case 6: return ts.ClassificationTypeNames.stringLiteral;\n            case 8: return ts.ClassificationTypeNames.whiteSpace;\n            case 9: return ts.ClassificationTypeNames.text;\n            case 10: return ts.ClassificationTypeNames.punctuation;\n            case 11: return ts.ClassificationTypeNames.className;\n            case 12: return ts.ClassificationTypeNames.enumName;\n            case 13: return ts.ClassificationTypeNames.interfaceName;\n            case 14: return ts.ClassificationTypeNames.moduleName;\n            case 15: return ts.ClassificationTypeNames.typeParameterName;\n            case 16: return ts.ClassificationTypeNames.typeAliasName;\n            case 17: return ts.ClassificationTypeNames.parameterName;\n            case 18: return ts.ClassificationTypeNames.docCommentTagName;\n            case 19: return ts.ClassificationTypeNames.jsxOpenTagName;\n            case 20: return ts.ClassificationTypeNames.jsxCloseTagName;\n            case 21: return ts.ClassificationTypeNames.jsxSelfClosingTagName;\n            case 22: return ts.ClassificationTypeNames.jsxAttribute;\n            case 23: return ts.ClassificationTypeNames.jsxText;\n            case 24: return ts.ClassificationTypeNames.jsxAttributeStringLiteralValue;\n        }\n    }\n    function convertClassifications(classifications) {\n        ts.Debug.assert(classifications.spans.length % 3 === 0);\n        var dense = classifications.spans;\n        var result = [];\n        for (var i = 0, n = dense.length; i < n; i += 3) {\n            result.push({\n                textSpan: ts.createTextSpan(dense[i], dense[i + 1]),\n                classificationType: getClassificationTypeName(dense[i + 2])\n            });\n        }\n        return result;\n    }\n    function getSyntacticClassifications(cancellationToken, sourceFile, span) {\n        return convertClassifications(getEncodedSyntacticClassifications(cancellationToken, sourceFile, span));\n    }\n    ts.getSyntacticClassifications = getSyntacticClassifications;\n    function getEncodedSyntacticClassifications(cancellationToken, sourceFile, span) {\n        var spanStart = span.start;\n        var spanLength = span.length;\n        var triviaScanner = ts.createScanner(5, false, sourceFile.languageVariant, sourceFile.text);\n        var mergeConflictScanner = ts.createScanner(5, false, sourceFile.languageVariant, sourceFile.text);\n        var result = [];\n        processElement(sourceFile);\n        return { spans: result, endOfLineState: 0 };\n        function pushClassification(start, length, type) {\n            result.push(start);\n            result.push(length);\n            result.push(type);\n        }\n        function classifyLeadingTriviaAndGetTokenStart(token) {\n            triviaScanner.setTextPos(token.pos);\n            while (true) {\n                var start = triviaScanner.getTextPos();\n                if (!ts.couldStartTrivia(sourceFile.text, start)) {\n                    return start;\n                }\n                var kind = triviaScanner.scan();\n                var end = triviaScanner.getTextPos();\n                var width = end - start;\n                if (!ts.isTrivia(kind)) {\n                    return start;\n                }\n                if (kind === 4 || kind === 5) {\n                    continue;\n                }\n                if (ts.isComment(kind)) {\n                    classifyComment(token, kind, start, width);\n                    triviaScanner.setTextPos(end);\n                    continue;\n                }\n                if (kind === 7) {\n                    var text = sourceFile.text;\n                    var ch = text.charCodeAt(start);\n                    if (ch === 60 || ch === 62) {\n                        pushClassification(start, width, 1);\n                        continue;\n                    }\n                    ts.Debug.assert(ch === 61);\n                    classifyDisabledMergeCode(text, start, end);\n                }\n            }\n        }\n        function classifyComment(token, kind, start, width) {\n            if (kind === 3) {\n                var docCommentAndDiagnostics = ts.parseIsolatedJSDocComment(sourceFile.text, start, width);\n                if (docCommentAndDiagnostics && docCommentAndDiagnostics.jsDoc) {\n                    docCommentAndDiagnostics.jsDoc.parent = token;\n                    classifyJSDocComment(docCommentAndDiagnostics.jsDoc);\n                    return;\n                }\n            }\n            pushCommentRange(start, width);\n        }\n        function pushCommentRange(start, width) {\n            pushClassification(start, width, 1);\n        }\n        function classifyJSDocComment(docComment) {\n            var pos = docComment.pos;\n            if (docComment.tags) {\n                for (var _i = 0, _a = docComment.tags; _i < _a.length; _i++) {\n                    var tag = _a[_i];\n                    if (tag.pos !== pos) {\n                        pushCommentRange(pos, tag.pos - pos);\n                    }\n                    pushClassification(tag.atToken.pos, tag.atToken.end - tag.atToken.pos, 10);\n                    pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18);\n                    pos = tag.tagName.end;\n                    switch (tag.kind) {\n                        case 281:\n                            processJSDocParameterTag(tag);\n                            break;\n                        case 284:\n                            processJSDocTemplateTag(tag);\n                            break;\n                        case 283:\n                            processElement(tag.typeExpression);\n                            break;\n                        case 282:\n                            processElement(tag.typeExpression);\n                            break;\n                    }\n                    pos = tag.end;\n                }\n            }\n            if (pos !== docComment.end) {\n                pushCommentRange(pos, docComment.end - pos);\n            }\n            return;\n            function processJSDocParameterTag(tag) {\n                if (tag.preParameterName) {\n                    pushCommentRange(pos, tag.preParameterName.pos - pos);\n                    pushClassification(tag.preParameterName.pos, tag.preParameterName.end - tag.preParameterName.pos, 17);\n                    pos = tag.preParameterName.end;\n                }\n                if (tag.typeExpression) {\n                    pushCommentRange(pos, tag.typeExpression.pos - pos);\n                    processElement(tag.typeExpression);\n                    pos = tag.typeExpression.end;\n                }\n                if (tag.postParameterName) {\n                    pushCommentRange(pos, tag.postParameterName.pos - pos);\n                    pushClassification(tag.postParameterName.pos, tag.postParameterName.end - tag.postParameterName.pos, 17);\n                    pos = tag.postParameterName.end;\n                }\n            }\n        }\n        function processJSDocTemplateTag(tag) {\n            for (var _i = 0, _a = tag.getChildren(); _i < _a.length; _i++) {\n                var child = _a[_i];\n                processElement(child);\n            }\n        }\n        function classifyDisabledMergeCode(text, start, end) {\n            var i;\n            for (i = start; i < end; i++) {\n                if (ts.isLineBreak(text.charCodeAt(i))) {\n                    break;\n                }\n            }\n            pushClassification(start, i - start, 1);\n            mergeConflictScanner.setTextPos(i);\n            while (mergeConflictScanner.getTextPos() < end) {\n                classifyDisabledCodeToken();\n            }\n        }\n        function classifyDisabledCodeToken() {\n            var start = mergeConflictScanner.getTextPos();\n            var tokenKind = mergeConflictScanner.scan();\n            var end = mergeConflictScanner.getTextPos();\n            var type = classifyTokenType(tokenKind);\n            if (type) {\n                pushClassification(start, end - start, type);\n            }\n        }\n        function tryClassifyNode(node) {\n            if (ts.isJSDocTag(node)) {\n                return true;\n            }\n            if (ts.nodeIsMissing(node)) {\n                return true;\n            }\n            var classifiedElementName = tryClassifyJsxElementName(node);\n            if (!ts.isToken(node) && node.kind !== 10 && classifiedElementName === undefined) {\n                return false;\n            }\n            var tokenStart = node.kind === 10 ? node.pos : classifyLeadingTriviaAndGetTokenStart(node);\n            var tokenWidth = node.end - tokenStart;\n            ts.Debug.assert(tokenWidth >= 0);\n            if (tokenWidth > 0) {\n                var type = classifiedElementName || classifyTokenType(node.kind, node);\n                if (type) {\n                    pushClassification(tokenStart, tokenWidth, type);\n                }\n            }\n            return true;\n        }\n        function tryClassifyJsxElementName(token) {\n            switch (token.parent && token.parent.kind) {\n                case 248:\n                    if (token.parent.tagName === token) {\n                        return 19;\n                    }\n                    break;\n                case 249:\n                    if (token.parent.tagName === token) {\n                        return 20;\n                    }\n                    break;\n                case 247:\n                    if (token.parent.tagName === token) {\n                        return 21;\n                    }\n                    break;\n                case 250:\n                    if (token.parent.name === token) {\n                        return 22;\n                    }\n                    break;\n            }\n            return undefined;\n        }\n        function classifyTokenType(tokenKind, token) {\n            if (ts.isKeyword(tokenKind)) {\n                return 3;\n            }\n            if (tokenKind === 26 || tokenKind === 28) {\n                if (token && ts.getTypeArgumentOrTypeParameterList(token.parent)) {\n                    return 10;\n                }\n            }\n            if (ts.isPunctuation(tokenKind)) {\n                if (token) {\n                    if (tokenKind === 57) {\n                        if (token.parent.kind === 223 ||\n                            token.parent.kind === 147 ||\n                            token.parent.kind === 144 ||\n                            token.parent.kind === 250) {\n                            return 5;\n                        }\n                    }\n                    if (token.parent.kind === 192 ||\n                        token.parent.kind === 190 ||\n                        token.parent.kind === 191 ||\n                        token.parent.kind === 193) {\n                        return 5;\n                    }\n                }\n                return 10;\n            }\n            else if (tokenKind === 8) {\n                return 4;\n            }\n            else if (tokenKind === 9) {\n                return token.parent.kind === 250 ? 24 : 6;\n            }\n            else if (tokenKind === 11) {\n                return 6;\n            }\n            else if (ts.isTemplateLiteralKind(tokenKind)) {\n                return 6;\n            }\n            else if (tokenKind === 10) {\n                return 23;\n            }\n            else if (tokenKind === 70) {\n                if (token) {\n                    switch (token.parent.kind) {\n                        case 226:\n                            if (token.parent.name === token) {\n                                return 11;\n                            }\n                            return;\n                        case 143:\n                            if (token.parent.name === token) {\n                                return 15;\n                            }\n                            return;\n                        case 227:\n                            if (token.parent.name === token) {\n                                return 13;\n                            }\n                            return;\n                        case 229:\n                            if (token.parent.name === token) {\n                                return 12;\n                            }\n                            return;\n                        case 230:\n                            if (token.parent.name === token) {\n                                return 14;\n                            }\n                            return;\n                        case 144:\n                            if (token.parent.name === token) {\n                                return ts.isThisIdentifier(token) ? 3 : 17;\n                            }\n                            return;\n                    }\n                }\n                return 2;\n            }\n        }\n        function processElement(element) {\n            if (!element) {\n                return;\n            }\n            if (ts.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) {\n                checkForClassificationCancellation(cancellationToken, element.kind);\n                var children = element.getChildren(sourceFile);\n                for (var i = 0, n = children.length; i < n; i++) {\n                    var child = children[i];\n                    if (!tryClassifyNode(child)) {\n                        processElement(child);\n                    }\n                }\n            }\n        }\n    }\n    ts.getEncodedSyntacticClassifications = getEncodedSyntacticClassifications;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var Completions;\n    (function (Completions) {\n        function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position) {\n            if (ts.isInReferenceComment(sourceFile, position)) {\n                return getTripleSlashReferenceCompletion(sourceFile, position);\n            }\n            if (ts.isInString(sourceFile, position)) {\n                return getStringLiteralCompletionEntries(sourceFile, position);\n            }\n            var completionData = getCompletionData(typeChecker, log, sourceFile, position);\n            if (!completionData) {\n                return undefined;\n            }\n            var symbols = completionData.symbols, isGlobalCompletion = completionData.isGlobalCompletion, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isJsDocTagName = completionData.isJsDocTagName;\n            if (isJsDocTagName) {\n                return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: ts.JsDoc.getAllJsDocCompletionEntries() };\n            }\n            var entries = [];\n            if (ts.isSourceFileJavaScript(sourceFile)) {\n                var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, true);\n                ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames));\n            }\n            else {\n                if (!symbols || symbols.length === 0) {\n                    if (sourceFile.languageVariant === 1 &&\n                        location.parent && location.parent.kind === 249) {\n                        var tagName = location.parent.parent.openingElement.tagName;\n                        entries.push({\n                            name: tagName.text,\n                            kind: undefined,\n                            kindModifiers: undefined,\n                            sortText: \"0\",\n                        });\n                    }\n                    else {\n                        return undefined;\n                    }\n                }\n                getCompletionEntriesFromSymbols(symbols, entries, location, true);\n            }\n            if (!isMemberCompletion && !isJsDocTagName) {\n                ts.addRange(entries, keywordCompletions);\n            }\n            return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries };\n            function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) {\n                var entries = [];\n                var nameTable = ts.getNameTable(sourceFile);\n                for (var name_45 in nameTable) {\n                    if (nameTable[name_45] === position) {\n                        continue;\n                    }\n                    if (!uniqueNames[name_45]) {\n                        uniqueNames[name_45] = name_45;\n                        var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_45), compilerOptions.target, true);\n                        if (displayName) {\n                            var entry = {\n                                name: displayName,\n                                kind: ts.ScriptElementKind.warning,\n                                kindModifiers: \"\",\n                                sortText: \"1\"\n                            };\n                            entries.push(entry);\n                        }\n                    }\n                }\n                return entries;\n            }\n            function createCompletionEntry(symbol, location, performCharacterChecks) {\n                var displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, compilerOptions.target, performCharacterChecks, location);\n                if (!displayName) {\n                    return undefined;\n                }\n                return {\n                    name: displayName,\n                    kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location),\n                    kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),\n                    sortText: \"0\",\n                };\n            }\n            function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks) {\n                var start = ts.timestamp();\n                var uniqueNames = ts.createMap();\n                if (symbols) {\n                    for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) {\n                        var symbol = symbols_4[_i];\n                        var entry = createCompletionEntry(symbol, location, performCharacterChecks);\n                        if (entry) {\n                            var id = ts.escapeIdentifier(entry.name);\n                            if (!uniqueNames[id]) {\n                                entries.push(entry);\n                                uniqueNames[id] = id;\n                            }\n                        }\n                    }\n                }\n                log(\"getCompletionsAtPosition: getCompletionEntriesFromSymbols: \" + (ts.timestamp() - start));\n                return uniqueNames;\n            }\n            function getStringLiteralCompletionEntries(sourceFile, position) {\n                var node = ts.findPrecedingToken(position, sourceFile);\n                if (!node || node.kind !== 9) {\n                    return undefined;\n                }\n                if (node.parent.kind === 257 &&\n                    node.parent.parent.kind === 176 &&\n                    node.parent.name === node) {\n                    return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent);\n                }\n                else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) {\n                    return getStringLiteralCompletionEntriesFromElementAccess(node.parent);\n                }\n                else if (node.parent.kind === 235 || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) {\n                    return getStringLiteralCompletionEntriesFromModuleNames(node);\n                }\n                else {\n                    var argumentInfo = ts.SignatureHelp.getContainingArgumentInfo(node, position, sourceFile);\n                    if (argumentInfo) {\n                        return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo);\n                    }\n                    return getStringLiteralCompletionEntriesFromContextualType(node);\n                }\n            }\n            function getStringLiteralCompletionEntriesFromPropertyAssignment(element) {\n                var type = typeChecker.getContextualType(element.parent);\n                var entries = [];\n                if (type) {\n                    getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, false);\n                    if (entries.length) {\n                        return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries };\n                    }\n                }\n            }\n            function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo) {\n                var candidates = [];\n                var entries = [];\n                typeChecker.getResolvedSignature(argumentInfo.invocation, candidates);\n                for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) {\n                    var candidate = candidates_3[_i];\n                    if (candidate.parameters.length > argumentInfo.argumentIndex) {\n                        var parameter = candidate.parameters[argumentInfo.argumentIndex];\n                        addStringLiteralCompletionsFromType(typeChecker.getTypeAtLocation(parameter.valueDeclaration), entries);\n                    }\n                }\n                if (entries.length) {\n                    return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries };\n                }\n                return undefined;\n            }\n            function getStringLiteralCompletionEntriesFromElementAccess(node) {\n                var type = typeChecker.getTypeAtLocation(node.expression);\n                var entries = [];\n                if (type) {\n                    getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, false);\n                    if (entries.length) {\n                        return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries };\n                    }\n                }\n                return undefined;\n            }\n            function getStringLiteralCompletionEntriesFromContextualType(node) {\n                var type = typeChecker.getContextualType(node);\n                if (type) {\n                    var entries_2 = [];\n                    addStringLiteralCompletionsFromType(type, entries_2);\n                    if (entries_2.length) {\n                        return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries_2 };\n                    }\n                }\n                return undefined;\n            }\n            function addStringLiteralCompletionsFromType(type, result) {\n                if (!type) {\n                    return;\n                }\n                if (type.flags & 65536) {\n                    ts.forEach(type.types, function (t) { return addStringLiteralCompletionsFromType(t, result); });\n                }\n                else {\n                    if (type.flags & 32) {\n                        result.push({\n                            name: type.text,\n                            kindModifiers: ts.ScriptElementKindModifier.none,\n                            kind: ts.ScriptElementKind.variableElement,\n                            sortText: \"0\"\n                        });\n                    }\n                }\n            }\n            function getStringLiteralCompletionEntriesFromModuleNames(node) {\n                var literalValue = ts.normalizeSlashes(node.text);\n                var scriptPath = node.getSourceFile().path;\n                var scriptDirectory = ts.getDirectoryPath(scriptPath);\n                var span = getDirectoryFragmentTextSpan(node.text, node.getStart() + 1);\n                var entries;\n                if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) {\n                    if (compilerOptions.rootDirs) {\n                        entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), false, span, scriptPath);\n                    }\n                    else {\n                        entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), false, span, scriptPath);\n                    }\n                }\n                else {\n                    entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span);\n                }\n                return {\n                    isGlobalCompletion: false,\n                    isMemberCompletion: false,\n                    isNewIdentifierLocation: true,\n                    entries: entries\n                };\n            }\n            function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase) {\n                rootDirs = ts.map(rootDirs, function (rootDirectory) { return ts.normalizePath(ts.isRootedDiskPath(rootDirectory) ? rootDirectory : ts.combinePaths(basePath, rootDirectory)); });\n                var relativeDirectory;\n                for (var _i = 0, rootDirs_1 = rootDirs; _i < rootDirs_1.length; _i++) {\n                    var rootDirectory = rootDirs_1[_i];\n                    if (ts.containsPath(rootDirectory, scriptPath, basePath, ignoreCase)) {\n                        relativeDirectory = scriptPath.substr(rootDirectory.length);\n                        break;\n                    }\n                }\n                return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); }));\n            }\n            function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, exclude) {\n                var basePath = compilerOptions.project || host.getCurrentDirectory();\n                var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());\n                var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase);\n                var result = [];\n                for (var _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) {\n                    var baseDirectory = baseDirectories_1[_i];\n                    getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, exclude, result);\n                }\n                return result;\n            }\n            function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, exclude, result) {\n                if (result === void 0) { result = []; }\n                if (fragment === undefined) {\n                    fragment = \"\";\n                }\n                fragment = ts.normalizeSlashes(fragment);\n                fragment = ts.getDirectoryPath(fragment);\n                if (fragment === \"\") {\n                    fragment = \".\" + ts.directorySeparator;\n                }\n                fragment = ts.ensureTrailingDirectorySeparator(fragment);\n                var absolutePath = normalizeAndPreserveTrailingSlash(ts.isRootedDiskPath(fragment) ? fragment : ts.combinePaths(scriptPath, fragment));\n                var baseDirectory = ts.getDirectoryPath(absolutePath);\n                var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());\n                if (tryDirectoryExists(host, baseDirectory)) {\n                    var files = tryReadDirectory(host, baseDirectory, extensions, undefined, [\"./*\"]);\n                    if (files) {\n                        var foundFiles = ts.createMap();\n                        for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {\n                            var filePath = files_3[_i];\n                            filePath = ts.normalizePath(filePath);\n                            if (exclude && ts.comparePaths(filePath, exclude, scriptPath, ignoreCase) === 0) {\n                                continue;\n                            }\n                            var foundFileName = includeExtensions ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath));\n                            if (!foundFiles[foundFileName]) {\n                                foundFiles[foundFileName] = true;\n                            }\n                        }\n                        for (var foundFile in foundFiles) {\n                            result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span));\n                        }\n                    }\n                    var directories = tryGetDirectories(host, baseDirectory);\n                    if (directories) {\n                        for (var _a = 0, directories_2 = directories; _a < directories_2.length; _a++) {\n                            var directory = directories_2[_a];\n                            var directoryName = ts.getBaseFileName(ts.normalizePath(directory));\n                            result.push(createCompletionEntryForModule(directoryName, ts.ScriptElementKind.directory, span));\n                        }\n                    }\n                }\n                return result;\n            }\n            function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span) {\n                var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths;\n                var result;\n                if (baseUrl) {\n                    var fileExtensions = ts.getSupportedExtensions(compilerOptions);\n                    var projectDir = compilerOptions.project || host.getCurrentDirectory();\n                    var absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl);\n                    result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, false, span);\n                    if (paths) {\n                        for (var path in paths) {\n                            if (paths.hasOwnProperty(path)) {\n                                if (path === \"*\") {\n                                    if (paths[path]) {\n                                        for (var _i = 0, _a = paths[path]; _i < _a.length; _i++) {\n                                            var pattern = _a[_i];\n                                            for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions); _b < _c.length; _b++) {\n                                                var match = _c[_b];\n                                                result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span));\n                                            }\n                                        }\n                                    }\n                                }\n                                else if (ts.startsWith(path, fragment)) {\n                                    var entry = paths[path] && paths[path].length === 1 && paths[path][0];\n                                    if (entry) {\n                                        result.push(createCompletionEntryForModule(path, ts.ScriptElementKind.externalModuleName, span));\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }\n                else {\n                    result = [];\n                }\n                getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result);\n                for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions); _d < _e.length; _d++) {\n                    var moduleName = _e[_d];\n                    result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span));\n                }\n                return result;\n            }\n            function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions) {\n                if (host.readDirectory) {\n                    var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : undefined;\n                    if (parsed) {\n                        var normalizedPrefix = normalizeAndPreserveTrailingSlash(parsed.prefix);\n                        var normalizedPrefixDirectory = ts.getDirectoryPath(normalizedPrefix);\n                        var normalizedPrefixBase = ts.getBaseFileName(normalizedPrefix);\n                        var fragmentHasPath = fragment.indexOf(ts.directorySeparator) !== -1;\n                        var expandedPrefixDirectory = fragmentHasPath ? ts.combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + ts.getDirectoryPath(fragment)) : normalizedPrefixDirectory;\n                        var normalizedSuffix = ts.normalizePath(parsed.suffix);\n                        var baseDirectory = ts.combinePaths(baseUrl, expandedPrefixDirectory);\n                        var completePrefix = fragmentHasPath ? baseDirectory : ts.ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase;\n                        var includeGlob = normalizedSuffix ? \"**/*\" : \"./*\";\n                        var matches = tryReadDirectory(host, baseDirectory, fileExtensions, undefined, [includeGlob]);\n                        if (matches) {\n                            var result = [];\n                            for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) {\n                                var match = matches_1[_i];\n                                var normalizedMatch = ts.normalizePath(match);\n                                if (!ts.endsWith(normalizedMatch, normalizedSuffix) || !ts.startsWith(normalizedMatch, completePrefix)) {\n                                    continue;\n                                }\n                                var start = completePrefix.length;\n                                var length_5 = normalizedMatch.length - start - normalizedSuffix.length;\n                                result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_5)));\n                            }\n                            return result;\n                        }\n                    }\n                }\n                return undefined;\n            }\n            function enumeratePotentialNonRelativeModules(fragment, scriptPath, options) {\n                var isNestedModule = fragment.indexOf(ts.directorySeparator) !== -1;\n                var moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(ts.directorySeparator)) : undefined;\n                var ambientModules = ts.map(typeChecker.getAmbientModules(), function (sym) { return ts.stripQuotes(sym.name); });\n                var nonRelativeModules = ts.filter(ambientModules, function (moduleName) { return ts.startsWith(moduleName, fragment); });\n                if (isNestedModule) {\n                    var moduleNameWithSeperator_1 = ts.ensureTrailingDirectorySeparator(moduleNameFragment);\n                    nonRelativeModules = ts.map(nonRelativeModules, function (moduleName) {\n                        if (ts.startsWith(fragment, moduleNameWithSeperator_1)) {\n                            return moduleName.substr(moduleNameWithSeperator_1.length);\n                        }\n                        return moduleName;\n                    });\n                }\n                if (!options.moduleResolution || options.moduleResolution === ts.ModuleResolutionKind.NodeJs) {\n                    for (var _i = 0, _a = enumerateNodeModulesVisibleToScript(host, scriptPath); _i < _a.length; _i++) {\n                        var visibleModule = _a[_i];\n                        if (!isNestedModule) {\n                            nonRelativeModules.push(visibleModule.moduleName);\n                        }\n                        else if (ts.startsWith(visibleModule.moduleName, moduleNameFragment)) {\n                            var nestedFiles = tryReadDirectory(host, visibleModule.moduleDir, ts.supportedTypeScriptExtensions, undefined, [\"./*\"]);\n                            if (nestedFiles) {\n                                for (var _b = 0, nestedFiles_1 = nestedFiles; _b < nestedFiles_1.length; _b++) {\n                                    var f = nestedFiles_1[_b];\n                                    f = ts.normalizePath(f);\n                                    var nestedModule = ts.removeFileExtension(ts.getBaseFileName(f));\n                                    nonRelativeModules.push(nestedModule);\n                                }\n                            }\n                        }\n                    }\n                }\n                return ts.deduplicate(nonRelativeModules);\n            }\n            function getTripleSlashReferenceCompletion(sourceFile, position) {\n                var token = ts.getTokenAtPosition(sourceFile, position);\n                if (!token) {\n                    return undefined;\n                }\n                var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);\n                if (!commentRanges || !commentRanges.length) {\n                    return undefined;\n                }\n                var range = ts.forEach(commentRanges, function (commentRange) { return position >= commentRange.pos && position <= commentRange.end && commentRange; });\n                if (!range) {\n                    return undefined;\n                }\n                var completionInfo = {\n                    isGlobalCompletion: false,\n                    isMemberCompletion: false,\n                    isNewIdentifierLocation: true,\n                    entries: []\n                };\n                var text = sourceFile.text.substr(range.pos, position - range.pos);\n                var match = tripleSlashDirectiveFragmentRegex.exec(text);\n                if (match) {\n                    var prefix = match[1];\n                    var kind = match[2];\n                    var toComplete = match[3];\n                    var scriptPath = ts.getDirectoryPath(sourceFile.path);\n                    if (kind === \"path\") {\n                        var span_10 = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length);\n                        completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), true, span_10, sourceFile.path);\n                    }\n                    else {\n                        var span_11 = { start: range.pos + prefix.length, length: match[0].length - prefix.length };\n                        completionInfo.entries = getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span_11);\n                    }\n                }\n                return completionInfo;\n            }\n            function getCompletionEntriesFromTypings(host, options, scriptPath, span, result) {\n                if (result === void 0) { result = []; }\n                if (options.types) {\n                    for (var _i = 0, _a = options.types; _i < _a.length; _i++) {\n                        var moduleName = _a[_i];\n                        result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span));\n                    }\n                }\n                else if (host.getDirectories) {\n                    var typeRoots = void 0;\n                    try {\n                        typeRoots = ts.getEffectiveTypeRoots(options, host);\n                    }\n                    catch (e) { }\n                    if (typeRoots) {\n                        for (var _b = 0, typeRoots_2 = typeRoots; _b < typeRoots_2.length; _b++) {\n                            var root = typeRoots_2[_b];\n                            getCompletionEntriesFromDirectories(host, root, span, result);\n                        }\n                    }\n                }\n                if (host.getDirectories) {\n                    for (var _c = 0, _d = findPackageJsons(scriptPath); _c < _d.length; _c++) {\n                        var packageJson = _d[_c];\n                        var typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), \"node_modules/@types\");\n                        getCompletionEntriesFromDirectories(host, typesDir, span, result);\n                    }\n                }\n                return result;\n            }\n            function getCompletionEntriesFromDirectories(host, directory, span, result) {\n                if (host.getDirectories && tryDirectoryExists(host, directory)) {\n                    var directories = tryGetDirectories(host, directory);\n                    if (directories) {\n                        for (var _i = 0, directories_3 = directories; _i < directories_3.length; _i++) {\n                            var typeDirectory = directories_3[_i];\n                            typeDirectory = ts.normalizePath(typeDirectory);\n                            result.push(createCompletionEntryForModule(ts.getBaseFileName(typeDirectory), ts.ScriptElementKind.externalModuleName, span));\n                        }\n                    }\n                }\n            }\n            function findPackageJsons(currentDir) {\n                var paths = [];\n                var currentConfigPath;\n                while (true) {\n                    currentConfigPath = ts.findConfigFile(currentDir, function (f) { return tryFileExists(host, f); }, \"package.json\");\n                    if (currentConfigPath) {\n                        paths.push(currentConfigPath);\n                        currentDir = ts.getDirectoryPath(currentConfigPath);\n                        var parent_13 = ts.getDirectoryPath(currentDir);\n                        if (currentDir === parent_13) {\n                            break;\n                        }\n                        currentDir = parent_13;\n                    }\n                    else {\n                        break;\n                    }\n                }\n                return paths;\n            }\n            function enumerateNodeModulesVisibleToScript(host, scriptPath) {\n                var result = [];\n                if (host.readFile && host.fileExists) {\n                    for (var _i = 0, _a = findPackageJsons(scriptPath); _i < _a.length; _i++) {\n                        var packageJson = _a[_i];\n                        var contents = tryReadingPackageJson(packageJson);\n                        if (!contents) {\n                            return;\n                        }\n                        var nodeModulesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), \"node_modules\");\n                        var foundModuleNames = [];\n                        for (var _b = 0, nodeModulesDependencyKeys_1 = nodeModulesDependencyKeys; _b < nodeModulesDependencyKeys_1.length; _b++) {\n                            var key = nodeModulesDependencyKeys_1[_b];\n                            addPotentialPackageNames(contents[key], foundModuleNames);\n                        }\n                        for (var _c = 0, foundModuleNames_1 = foundModuleNames; _c < foundModuleNames_1.length; _c++) {\n                            var moduleName = foundModuleNames_1[_c];\n                            var moduleDir = ts.combinePaths(nodeModulesDir, moduleName);\n                            result.push({\n                                moduleName: moduleName,\n                                moduleDir: moduleDir\n                            });\n                        }\n                    }\n                }\n                return result;\n                function tryReadingPackageJson(filePath) {\n                    try {\n                        var fileText = tryReadFile(host, filePath);\n                        return fileText ? JSON.parse(fileText) : undefined;\n                    }\n                    catch (e) {\n                        return undefined;\n                    }\n                }\n                function addPotentialPackageNames(dependencies, result) {\n                    if (dependencies) {\n                        for (var dep in dependencies) {\n                            if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, \"@types/\")) {\n                                result.push(dep);\n                            }\n                        }\n                    }\n                }\n            }\n            function createCompletionEntryForModule(name, kind, replacementSpan) {\n                return { name: name, kind: kind, kindModifiers: ts.ScriptElementKindModifier.none, sortText: name, replacementSpan: replacementSpan };\n            }\n            function getDirectoryFragmentTextSpan(text, textStart) {\n                var index = text.lastIndexOf(ts.directorySeparator);\n                var offset = index !== -1 ? index + 1 : 0;\n                return { start: textStart + offset, length: text.length - offset };\n            }\n            function isPathRelativeToScript(path) {\n                if (path && path.length >= 2 && path.charCodeAt(0) === 46) {\n                    var slashIndex = path.length >= 3 && path.charCodeAt(1) === 46 ? 2 : 1;\n                    var slashCharCode = path.charCodeAt(slashIndex);\n                    return slashCharCode === 47 || slashCharCode === 92;\n                }\n                return false;\n            }\n            function normalizeAndPreserveTrailingSlash(path) {\n                return ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(path)) : ts.normalizePath(path);\n            }\n        }\n        Completions.getCompletionsAtPosition = getCompletionsAtPosition;\n        function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryName) {\n            var completionData = getCompletionData(typeChecker, log, sourceFile, position);\n            if (completionData) {\n                var symbols = completionData.symbols, location_3 = completionData.location;\n                var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_3) === entryName ? s : undefined; });\n                if (symbol) {\n                    var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_3, location_3, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind;\n                    return {\n                        name: entryName,\n                        kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),\n                        kind: symbolKind,\n                        displayParts: displayParts,\n                        documentation: documentation\n                    };\n                }\n            }\n            var keywordCompletion = ts.forEach(keywordCompletions, function (c) { return c.name === entryName; });\n            if (keywordCompletion) {\n                return {\n                    name: entryName,\n                    kind: ts.ScriptElementKind.keyword,\n                    kindModifiers: ts.ScriptElementKindModifier.none,\n                    displayParts: [ts.displayPart(entryName, ts.SymbolDisplayPartKind.keyword)],\n                    documentation: undefined\n                };\n            }\n            return undefined;\n        }\n        Completions.getCompletionEntryDetails = getCompletionEntryDetails;\n        function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryName) {\n            var completionData = getCompletionData(typeChecker, log, sourceFile, position);\n            if (completionData) {\n                var symbols = completionData.symbols, location_4 = completionData.location;\n                return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_4) === entryName ? s : undefined; });\n            }\n            return undefined;\n        }\n        Completions.getCompletionEntrySymbol = getCompletionEntrySymbol;\n        function getCompletionData(typeChecker, log, sourceFile, position) {\n            var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile);\n            var isJsDocTagName = false;\n            var start = ts.timestamp();\n            var currentToken = ts.getTokenAtPosition(sourceFile, position);\n            log(\"getCompletionData: Get current token: \" + (ts.timestamp() - start));\n            start = ts.timestamp();\n            var insideComment = ts.isInsideComment(sourceFile, currentToken, position);\n            log(\"getCompletionData: Is inside comment: \" + (ts.timestamp() - start));\n            if (insideComment) {\n                if (ts.hasDocComment(sourceFile, position) && sourceFile.text.charCodeAt(position - 1) === 64) {\n                    isJsDocTagName = true;\n                }\n                var insideJsDocTagExpression = false;\n                var tag = ts.getJsDocTagAtPosition(sourceFile, position);\n                if (tag) {\n                    if (tag.tagName.pos <= position && position <= tag.tagName.end) {\n                        isJsDocTagName = true;\n                    }\n                    switch (tag.kind) {\n                        case 283:\n                        case 281:\n                        case 282:\n                            var tagWithExpression = tag;\n                            if (tagWithExpression.typeExpression) {\n                                insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end;\n                            }\n                            break;\n                    }\n                }\n                if (isJsDocTagName) {\n                    return { symbols: undefined, isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, location: undefined, isRightOfDot: false, isJsDocTagName: isJsDocTagName };\n                }\n                if (!insideJsDocTagExpression) {\n                    log(\"Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment.\");\n                    return undefined;\n                }\n            }\n            start = ts.timestamp();\n            var previousToken = ts.findPrecedingToken(position, sourceFile);\n            log(\"getCompletionData: Get previous token 1: \" + (ts.timestamp() - start));\n            var contextToken = previousToken;\n            if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) {\n                var start_2 = ts.timestamp();\n                contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile);\n                log(\"getCompletionData: Get previous token 2: \" + (ts.timestamp() - start_2));\n            }\n            var node = currentToken;\n            var isRightOfDot = false;\n            var isRightOfOpenTag = false;\n            var isStartingCloseTag = false;\n            var location = ts.getTouchingPropertyName(sourceFile, position);\n            if (contextToken) {\n                if (isCompletionListBlocker(contextToken)) {\n                    log(\"Returning an empty list because completion was requested in an invalid position.\");\n                    return undefined;\n                }\n                var parent_14 = contextToken.parent, kind = contextToken.kind;\n                if (kind === 22) {\n                    if (parent_14.kind === 177) {\n                        node = contextToken.parent.expression;\n                        isRightOfDot = true;\n                    }\n                    else if (parent_14.kind === 141) {\n                        node = contextToken.parent.left;\n                        isRightOfDot = true;\n                    }\n                    else {\n                        return undefined;\n                    }\n                }\n                else if (sourceFile.languageVariant === 1) {\n                    if (kind === 26) {\n                        isRightOfOpenTag = true;\n                        location = contextToken;\n                    }\n                    else if (kind === 40 && contextToken.parent.kind === 249) {\n                        isStartingCloseTag = true;\n                        location = contextToken;\n                    }\n                }\n            }\n            var semanticStart = ts.timestamp();\n            var isGlobalCompletion = false;\n            var isMemberCompletion;\n            var isNewIdentifierLocation;\n            var symbols = [];\n            if (isRightOfDot) {\n                getTypeScriptMemberSymbols();\n            }\n            else if (isRightOfOpenTag) {\n                var tagSymbols = typeChecker.getJsxIntrinsicTagNames();\n                if (tryGetGlobalSymbols()) {\n                    symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & (107455 | 8388608)); }));\n                }\n                else {\n                    symbols = tagSymbols;\n                }\n                isMemberCompletion = true;\n                isNewIdentifierLocation = false;\n            }\n            else if (isStartingCloseTag) {\n                var tagName = contextToken.parent.parent.openingElement.tagName;\n                var tagSymbol = typeChecker.getSymbolAtLocation(tagName);\n                if (!typeChecker.isUnknownSymbol(tagSymbol)) {\n                    symbols = [tagSymbol];\n                }\n                isMemberCompletion = true;\n                isNewIdentifierLocation = false;\n            }\n            else {\n                if (!tryGetGlobalSymbols()) {\n                    return undefined;\n                }\n            }\n            log(\"getCompletionData: Semantic work: \" + (ts.timestamp() - semanticStart));\n            return { symbols: symbols, isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, location: location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), isJsDocTagName: isJsDocTagName };\n            function getTypeScriptMemberSymbols() {\n                isGlobalCompletion = false;\n                isMemberCompletion = true;\n                isNewIdentifierLocation = false;\n                if (node.kind === 70 || node.kind === 141 || node.kind === 177) {\n                    var symbol = typeChecker.getSymbolAtLocation(node);\n                    if (symbol && symbol.flags & 8388608) {\n                        symbol = typeChecker.getAliasedSymbol(symbol);\n                    }\n                    if (symbol && symbol.flags & 1952) {\n                        var exportedSymbols = typeChecker.getExportsOfModule(symbol);\n                        ts.forEach(exportedSymbols, function (symbol) {\n                            if (typeChecker.isValidPropertyAccess((node.parent), symbol.name)) {\n                                symbols.push(symbol);\n                            }\n                        });\n                    }\n                }\n                var type = typeChecker.getTypeAtLocation(node);\n                addTypeProperties(type);\n            }\n            function addTypeProperties(type) {\n                if (type) {\n                    for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) {\n                        var symbol = _a[_i];\n                        if (typeChecker.isValidPropertyAccess((node.parent), symbol.name)) {\n                            symbols.push(symbol);\n                        }\n                    }\n                    if (isJavaScriptFile && type.flags & 65536) {\n                        var unionType = type;\n                        for (var _b = 0, _c = unionType.types; _b < _c.length; _b++) {\n                            var elementType = _c[_b];\n                            addTypeProperties(elementType);\n                        }\n                    }\n                }\n            }\n            function tryGetGlobalSymbols() {\n                var objectLikeContainer;\n                var namedImportsOrExports;\n                var jsxContainer;\n                if (objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken)) {\n                    return tryGetObjectLikeCompletionSymbols(objectLikeContainer);\n                }\n                if (namedImportsOrExports = tryGetNamedImportsOrExportsForCompletion(contextToken)) {\n                    return tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports);\n                }\n                if (jsxContainer = tryGetContainingJsxElement(contextToken)) {\n                    var attrsType = void 0;\n                    if ((jsxContainer.kind === 247) || (jsxContainer.kind === 248)) {\n                        attrsType = typeChecker.getJsxElementAttributesType(jsxContainer);\n                        if (attrsType) {\n                            symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes);\n                            isMemberCompletion = true;\n                            isNewIdentifierLocation = false;\n                            return true;\n                        }\n                    }\n                }\n                isMemberCompletion = false;\n                isNewIdentifierLocation = isNewIdentifierDefinitionLocation(contextToken);\n                if (previousToken !== contextToken) {\n                    ts.Debug.assert(!!previousToken, \"Expected 'contextToken' to be defined when different from 'previousToken'.\");\n                }\n                var adjustedPosition = previousToken !== contextToken ?\n                    previousToken.getStart() :\n                    position;\n                var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile;\n                if (scopeNode) {\n                    isGlobalCompletion =\n                        scopeNode.kind === 261 ||\n                            scopeNode.kind === 194 ||\n                            scopeNode.kind === 252 ||\n                            ts.isStatement(scopeNode);\n                }\n                var symbolMeanings = 793064 | 107455 | 1920 | 8388608;\n                symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings);\n                return true;\n            }\n            function getScopeNode(initialToken, position, sourceFile) {\n                var scope = initialToken;\n                while (scope && !ts.positionBelongsToNode(scope, position, sourceFile)) {\n                    scope = scope.parent;\n                }\n                return scope;\n            }\n            function isCompletionListBlocker(contextToken) {\n                var start = ts.timestamp();\n                var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) ||\n                    isSolelyIdentifierDefinitionLocation(contextToken) ||\n                    isDotOfNumericLiteral(contextToken) ||\n                    isInJsxText(contextToken);\n                log(\"getCompletionsAtPosition: isCompletionListBlocker: \" + (ts.timestamp() - start));\n                return result;\n            }\n            function isInJsxText(contextToken) {\n                if (contextToken.kind === 10) {\n                    return true;\n                }\n                if (contextToken.kind === 28 && contextToken.parent) {\n                    if (contextToken.parent.kind === 248) {\n                        return true;\n                    }\n                    if (contextToken.parent.kind === 249 || contextToken.parent.kind === 247) {\n                        return contextToken.parent.parent && contextToken.parent.parent.kind === 246;\n                    }\n                }\n                return false;\n            }\n            function isNewIdentifierDefinitionLocation(previousToken) {\n                if (previousToken) {\n                    var containingNodeKind = previousToken.parent.kind;\n                    switch (previousToken.kind) {\n                        case 25:\n                            return containingNodeKind === 179\n                                || containingNodeKind === 150\n                                || containingNodeKind === 180\n                                || containingNodeKind === 175\n                                || containingNodeKind === 192\n                                || containingNodeKind === 158;\n                        case 18:\n                            return containingNodeKind === 179\n                                || containingNodeKind === 150\n                                || containingNodeKind === 180\n                                || containingNodeKind === 183\n                                || containingNodeKind === 166;\n                        case 20:\n                            return containingNodeKind === 175\n                                || containingNodeKind === 155\n                                || containingNodeKind === 142;\n                        case 127:\n                        case 128:\n                            return true;\n                        case 22:\n                            return containingNodeKind === 230;\n                        case 16:\n                            return containingNodeKind === 226;\n                        case 57:\n                            return containingNodeKind === 223\n                                || containingNodeKind === 192;\n                        case 13:\n                            return containingNodeKind === 194;\n                        case 14:\n                            return containingNodeKind === 202;\n                        case 113:\n                        case 111:\n                        case 112:\n                            return containingNodeKind === 147;\n                    }\n                    switch (previousToken.getText()) {\n                        case \"public\":\n                        case \"protected\":\n                        case \"private\":\n                            return true;\n                    }\n                }\n                return false;\n            }\n            function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) {\n                if (contextToken.kind === 9\n                    || contextToken.kind === 11\n                    || ts.isTemplateLiteralKind(contextToken.kind)) {\n                    var start_3 = contextToken.getStart();\n                    var end = contextToken.getEnd();\n                    if (start_3 < position && position < end) {\n                        return true;\n                    }\n                    if (position === end) {\n                        return !!contextToken.isUnterminated\n                            || contextToken.kind === 11;\n                    }\n                }\n                return false;\n            }\n            function tryGetObjectLikeCompletionSymbols(objectLikeContainer) {\n                isMemberCompletion = true;\n                var typeForObject;\n                var existingMembers;\n                if (objectLikeContainer.kind === 176) {\n                    isNewIdentifierLocation = true;\n                    typeForObject = typeChecker.getContextualType(objectLikeContainer);\n                    typeForObject = typeForObject && typeForObject.getNonNullableType();\n                    existingMembers = objectLikeContainer.properties;\n                }\n                else if (objectLikeContainer.kind === 172) {\n                    isNewIdentifierLocation = false;\n                    var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent);\n                    if (ts.isVariableLike(rootDeclaration)) {\n                        var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type);\n                        if (!canGetType && rootDeclaration.kind === 144) {\n                            if (ts.isExpression(rootDeclaration.parent)) {\n                                canGetType = !!typeChecker.getContextualType(rootDeclaration.parent);\n                            }\n                            else if (rootDeclaration.parent.kind === 149 || rootDeclaration.parent.kind === 152) {\n                                canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent);\n                            }\n                        }\n                        if (canGetType) {\n                            typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer);\n                            existingMembers = objectLikeContainer.elements;\n                        }\n                    }\n                    else {\n                        ts.Debug.fail(\"Root declaration is not variable-like.\");\n                    }\n                }\n                else {\n                    ts.Debug.fail(\"Expected object literal or binding pattern, got \" + objectLikeContainer.kind);\n                }\n                if (!typeForObject) {\n                    return false;\n                }\n                var typeMembers = typeChecker.getPropertiesOfType(typeForObject);\n                if (typeMembers && typeMembers.length > 0) {\n                    symbols = filterObjectMembersList(typeMembers, existingMembers);\n                }\n                return true;\n            }\n            function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) {\n                var declarationKind = namedImportsOrExports.kind === 238 ?\n                    235 :\n                    241;\n                var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind);\n                var moduleSpecifier = importOrExportDeclaration.moduleSpecifier;\n                if (!moduleSpecifier) {\n                    return false;\n                }\n                isMemberCompletion = true;\n                isNewIdentifierLocation = false;\n                var exports;\n                var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier);\n                if (moduleSpecifierSymbol) {\n                    exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol);\n                }\n                symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : ts.emptyArray;\n                return true;\n            }\n            function tryGetObjectLikeCompletionContainer(contextToken) {\n                if (contextToken) {\n                    switch (contextToken.kind) {\n                        case 16:\n                        case 25:\n                            var parent_15 = contextToken.parent;\n                            if (parent_15 && (parent_15.kind === 176 || parent_15.kind === 172)) {\n                                return parent_15;\n                            }\n                            break;\n                    }\n                }\n                return undefined;\n            }\n            function tryGetNamedImportsOrExportsForCompletion(contextToken) {\n                if (contextToken) {\n                    switch (contextToken.kind) {\n                        case 16:\n                        case 25:\n                            switch (contextToken.parent.kind) {\n                                case 238:\n                                case 242:\n                                    return contextToken.parent;\n                            }\n                    }\n                }\n                return undefined;\n            }\n            function tryGetContainingJsxElement(contextToken) {\n                if (contextToken) {\n                    var parent_16 = contextToken.parent;\n                    switch (contextToken.kind) {\n                        case 27:\n                        case 40:\n                        case 70:\n                        case 250:\n                        case 251:\n                            if (parent_16 && (parent_16.kind === 247 || parent_16.kind === 248)) {\n                                return parent_16;\n                            }\n                            else if (parent_16.kind === 250) {\n                                return parent_16.parent;\n                            }\n                            break;\n                        case 9:\n                            if (parent_16 && ((parent_16.kind === 250) || (parent_16.kind === 251))) {\n                                return parent_16.parent;\n                            }\n                            break;\n                        case 17:\n                            if (parent_16 &&\n                                parent_16.kind === 252 &&\n                                parent_16.parent &&\n                                (parent_16.parent.kind === 250)) {\n                                return parent_16.parent.parent;\n                            }\n                            if (parent_16 && parent_16.kind === 251) {\n                                return parent_16.parent;\n                            }\n                            break;\n                    }\n                }\n                return undefined;\n            }\n            function isFunction(kind) {\n                switch (kind) {\n                    case 184:\n                    case 185:\n                    case 225:\n                    case 149:\n                    case 148:\n                    case 151:\n                    case 152:\n                    case 153:\n                    case 154:\n                    case 155:\n                        return true;\n                }\n                return false;\n            }\n            function isSolelyIdentifierDefinitionLocation(contextToken) {\n                var containingNodeKind = contextToken.parent.kind;\n                switch (contextToken.kind) {\n                    case 25:\n                        return containingNodeKind === 223 ||\n                            containingNodeKind === 224 ||\n                            containingNodeKind === 205 ||\n                            containingNodeKind === 229 ||\n                            isFunction(containingNodeKind) ||\n                            containingNodeKind === 226 ||\n                            containingNodeKind === 197 ||\n                            containingNodeKind === 227 ||\n                            containingNodeKind === 173 ||\n                            containingNodeKind === 228;\n                    case 22:\n                        return containingNodeKind === 173;\n                    case 55:\n                        return containingNodeKind === 174;\n                    case 20:\n                        return containingNodeKind === 173;\n                    case 18:\n                        return containingNodeKind === 256 ||\n                            isFunction(containingNodeKind);\n                    case 16:\n                        return containingNodeKind === 229 ||\n                            containingNodeKind === 227 ||\n                            containingNodeKind === 161;\n                    case 24:\n                        return containingNodeKind === 146 &&\n                            contextToken.parent && contextToken.parent.parent &&\n                            (contextToken.parent.parent.kind === 227 ||\n                                contextToken.parent.parent.kind === 161);\n                    case 26:\n                        return containingNodeKind === 226 ||\n                            containingNodeKind === 197 ||\n                            containingNodeKind === 227 ||\n                            containingNodeKind === 228 ||\n                            isFunction(containingNodeKind);\n                    case 114:\n                        return containingNodeKind === 147;\n                    case 23:\n                        return containingNodeKind === 144 ||\n                            (contextToken.parent && contextToken.parent.parent &&\n                                contextToken.parent.parent.kind === 173);\n                    case 113:\n                    case 111:\n                    case 112:\n                        return containingNodeKind === 144;\n                    case 117:\n                        return containingNodeKind === 239 ||\n                            containingNodeKind === 243 ||\n                            containingNodeKind === 237;\n                    case 74:\n                    case 82:\n                    case 108:\n                    case 88:\n                    case 103:\n                    case 124:\n                    case 133:\n                    case 90:\n                    case 109:\n                    case 75:\n                    case 115:\n                    case 136:\n                        return true;\n                }\n                switch (contextToken.getText()) {\n                    case \"abstract\":\n                    case \"async\":\n                    case \"class\":\n                    case \"const\":\n                    case \"declare\":\n                    case \"enum\":\n                    case \"function\":\n                    case \"interface\":\n                    case \"let\":\n                    case \"private\":\n                    case \"protected\":\n                    case \"public\":\n                    case \"static\":\n                    case \"var\":\n                    case \"yield\":\n                        return true;\n                }\n                return false;\n            }\n            function isDotOfNumericLiteral(contextToken) {\n                if (contextToken.kind === 8) {\n                    var text = contextToken.getFullText();\n                    return text.charAt(text.length - 1) === \".\";\n                }\n                return false;\n            }\n            function filterNamedImportOrExportCompletionItems(exportsOfModule, namedImportsOrExports) {\n                var existingImportsOrExports = ts.createMap();\n                for (var _i = 0, namedImportsOrExports_1 = namedImportsOrExports; _i < namedImportsOrExports_1.length; _i++) {\n                    var element = namedImportsOrExports_1[_i];\n                    if (element.getStart() <= position && position <= element.getEnd()) {\n                        continue;\n                    }\n                    var name_46 = element.propertyName || element.name;\n                    existingImportsOrExports[name_46.text] = true;\n                }\n                if (!ts.someProperties(existingImportsOrExports)) {\n                    return ts.filter(exportsOfModule, function (e) { return e.name !== \"default\"; });\n                }\n                return ts.filter(exportsOfModule, function (e) { return e.name !== \"default\" && !existingImportsOrExports[e.name]; });\n            }\n            function filterObjectMembersList(contextualMemberSymbols, existingMembers) {\n                if (!existingMembers || existingMembers.length === 0) {\n                    return contextualMemberSymbols;\n                }\n                var existingMemberNames = ts.createMap();\n                for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) {\n                    var m = existingMembers_1[_i];\n                    if (m.kind !== 257 &&\n                        m.kind !== 258 &&\n                        m.kind !== 174 &&\n                        m.kind !== 149 &&\n                        m.kind !== 151 &&\n                        m.kind !== 152) {\n                        continue;\n                    }\n                    if (m.getStart() <= position && position <= m.getEnd()) {\n                        continue;\n                    }\n                    var existingName = void 0;\n                    if (m.kind === 174 && m.propertyName) {\n                        if (m.propertyName.kind === 70) {\n                            existingName = m.propertyName.text;\n                        }\n                    }\n                    else {\n                        existingName = m.name.text;\n                    }\n                    existingMemberNames[existingName] = true;\n                }\n                return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames[m.name]; });\n            }\n            function filterJsxAttributes(symbols, attributes) {\n                var seenNames = ts.createMap();\n                for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) {\n                    var attr = attributes_1[_i];\n                    if (attr.getStart() <= position && position <= attr.getEnd()) {\n                        continue;\n                    }\n                    if (attr.kind === 250) {\n                        seenNames[attr.name.text] = true;\n                    }\n                }\n                return ts.filter(symbols, function (a) { return !seenNames[a.name]; });\n            }\n        }\n        function getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, target, performCharacterChecks, location) {\n            var displayName = ts.getDeclaredName(typeChecker, symbol, location);\n            if (displayName) {\n                var firstCharCode = displayName.charCodeAt(0);\n                if ((symbol.flags & 1920) && (firstCharCode === 39 || firstCharCode === 34)) {\n                    return undefined;\n                }\n            }\n            return getCompletionEntryDisplayName(displayName, target, performCharacterChecks);\n        }\n        function getCompletionEntryDisplayName(name, target, performCharacterChecks) {\n            if (!name) {\n                return undefined;\n            }\n            name = ts.stripQuotes(name);\n            if (!name) {\n                return undefined;\n            }\n            if (performCharacterChecks) {\n                if (!ts.isIdentifierText(name, target)) {\n                    return undefined;\n                }\n            }\n            return name;\n        }\n        var keywordCompletions = [];\n        for (var i = 71; i <= 140; i++) {\n            keywordCompletions.push({\n                name: ts.tokenToString(i),\n                kind: ts.ScriptElementKind.keyword,\n                kindModifiers: ts.ScriptElementKindModifier.none,\n                sortText: \"0\"\n            });\n        }\n        var tripleSlashDirectiveFragmentRegex = /^(\\/\\/\\/\\s*<reference\\s+(path|types)\\s*=\\s*(?:'|\"))([^\\3\"]*)$/;\n        var nodeModulesDependencyKeys = [\"dependencies\", \"devDependencies\", \"peerDependencies\", \"optionalDependencies\"];\n        function tryGetDirectories(host, directoryName) {\n            return tryIOAndConsumeErrors(host, host.getDirectories, directoryName);\n        }\n        function tryReadDirectory(host, path, extensions, exclude, include) {\n            return tryIOAndConsumeErrors(host, host.readDirectory, path, extensions, exclude, include);\n        }\n        function tryReadFile(host, path) {\n            return tryIOAndConsumeErrors(host, host.readFile, path);\n        }\n        function tryFileExists(host, path) {\n            return tryIOAndConsumeErrors(host, host.fileExists, path);\n        }\n        function tryDirectoryExists(host, path) {\n            try {\n                return ts.directoryProbablyExists(path, host);\n            }\n            catch (e) { }\n            return undefined;\n        }\n        function tryIOAndConsumeErrors(host, toApply) {\n            var args = [];\n            for (var _i = 2; _i < arguments.length; _i++) {\n                args[_i - 2] = arguments[_i];\n            }\n            try {\n                return toApply && toApply.apply(host, args);\n            }\n            catch (e) { }\n            return undefined;\n        }\n    })(Completions = ts.Completions || (ts.Completions = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var DocumentHighlights;\n    (function (DocumentHighlights) {\n        function getDocumentHighlights(typeChecker, cancellationToken, sourceFile, position, sourceFilesToSearch) {\n            var node = ts.getTouchingWord(sourceFile, position);\n            if (!node) {\n                return undefined;\n            }\n            return getSemanticDocumentHighlights(node) || getSyntacticDocumentHighlights(node);\n            function getHighlightSpanForNode(node) {\n                var start = node.getStart();\n                var end = node.getEnd();\n                return {\n                    fileName: sourceFile.fileName,\n                    textSpan: ts.createTextSpanFromBounds(start, end),\n                    kind: ts.HighlightSpanKind.none\n                };\n            }\n            function getSemanticDocumentHighlights(node) {\n                if (node.kind === 70 ||\n                    node.kind === 98 ||\n                    node.kind === 167 ||\n                    node.kind === 96 ||\n                    node.kind === 9 ||\n                    ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) {\n                    var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFilesToSearch, false, false, false);\n                    return convertReferencedSymbols(referencedSymbols);\n                }\n                return undefined;\n                function convertReferencedSymbols(referencedSymbols) {\n                    if (!referencedSymbols) {\n                        return undefined;\n                    }\n                    var fileNameToDocumentHighlights = ts.createMap();\n                    var result = [];\n                    for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) {\n                        var referencedSymbol = referencedSymbols_1[_i];\n                        for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {\n                            var referenceEntry = _b[_a];\n                            var fileName = referenceEntry.fileName;\n                            var documentHighlights = fileNameToDocumentHighlights[fileName];\n                            if (!documentHighlights) {\n                                documentHighlights = { fileName: fileName, highlightSpans: [] };\n                                fileNameToDocumentHighlights[fileName] = documentHighlights;\n                                result.push(documentHighlights);\n                            }\n                            documentHighlights.highlightSpans.push({\n                                textSpan: referenceEntry.textSpan,\n                                kind: referenceEntry.isWriteAccess ? ts.HighlightSpanKind.writtenReference : ts.HighlightSpanKind.reference\n                            });\n                        }\n                    }\n                    return result;\n                }\n            }\n            function getSyntacticDocumentHighlights(node) {\n                var fileName = sourceFile.fileName;\n                var highlightSpans = getHighlightSpans(node);\n                if (!highlightSpans || highlightSpans.length === 0) {\n                    return undefined;\n                }\n                return [{ fileName: fileName, highlightSpans: highlightSpans }];\n                function hasKind(node, kind) {\n                    return node !== undefined && node.kind === kind;\n                }\n                function parent(node) {\n                    return node && node.parent;\n                }\n                function getHighlightSpans(node) {\n                    if (node) {\n                        switch (node.kind) {\n                            case 89:\n                            case 81:\n                                if (hasKind(node.parent, 208)) {\n                                    return getIfElseOccurrences(node.parent);\n                                }\n                                break;\n                            case 95:\n                                if (hasKind(node.parent, 216)) {\n                                    return getReturnOccurrences(node.parent);\n                                }\n                                break;\n                            case 99:\n                                if (hasKind(node.parent, 220)) {\n                                    return getThrowOccurrences(node.parent);\n                                }\n                                break;\n                            case 73:\n                                if (hasKind(parent(parent(node)), 221)) {\n                                    return getTryCatchFinallyOccurrences(node.parent.parent);\n                                }\n                                break;\n                            case 101:\n                            case 86:\n                                if (hasKind(parent(node), 221)) {\n                                    return getTryCatchFinallyOccurrences(node.parent);\n                                }\n                                break;\n                            case 97:\n                                if (hasKind(node.parent, 218)) {\n                                    return getSwitchCaseDefaultOccurrences(node.parent);\n                                }\n                                break;\n                            case 72:\n                            case 78:\n                                if (hasKind(parent(parent(parent(node))), 218)) {\n                                    return getSwitchCaseDefaultOccurrences(node.parent.parent.parent);\n                                }\n                                break;\n                            case 71:\n                            case 76:\n                                if (hasKind(node.parent, 215) || hasKind(node.parent, 214)) {\n                                    return getBreakOrContinueStatementOccurrences(node.parent);\n                                }\n                                break;\n                            case 87:\n                                if (hasKind(node.parent, 211) ||\n                                    hasKind(node.parent, 212) ||\n                                    hasKind(node.parent, 213)) {\n                                    return getLoopBreakContinueOccurrences(node.parent);\n                                }\n                                break;\n                            case 105:\n                            case 80:\n                                if (hasKind(node.parent, 210) || hasKind(node.parent, 209)) {\n                                    return getLoopBreakContinueOccurrences(node.parent);\n                                }\n                                break;\n                            case 122:\n                                if (hasKind(node.parent, 150)) {\n                                    return getConstructorOccurrences(node.parent);\n                                }\n                                break;\n                            case 124:\n                            case 133:\n                                if (hasKind(node.parent, 151) || hasKind(node.parent, 152)) {\n                                    return getGetAndSetOccurrences(node.parent);\n                                }\n                                break;\n                            default:\n                                if (ts.isModifierKind(node.kind) && node.parent &&\n                                    (ts.isDeclaration(node.parent) || node.parent.kind === 205)) {\n                                    return getModifierOccurrences(node.kind, node.parent);\n                                }\n                        }\n                    }\n                    return undefined;\n                }\n                function aggregateOwnedThrowStatements(node) {\n                    var statementAccumulator = [];\n                    aggregate(node);\n                    return statementAccumulator;\n                    function aggregate(node) {\n                        if (node.kind === 220) {\n                            statementAccumulator.push(node);\n                        }\n                        else if (node.kind === 221) {\n                            var tryStatement = node;\n                            if (tryStatement.catchClause) {\n                                aggregate(tryStatement.catchClause);\n                            }\n                            else {\n                                aggregate(tryStatement.tryBlock);\n                            }\n                            if (tryStatement.finallyBlock) {\n                                aggregate(tryStatement.finallyBlock);\n                            }\n                        }\n                        else if (!ts.isFunctionLike(node)) {\n                            ts.forEachChild(node, aggregate);\n                        }\n                    }\n                }\n                function getThrowStatementOwner(throwStatement) {\n                    var child = throwStatement;\n                    while (child.parent) {\n                        var parent_17 = child.parent;\n                        if (ts.isFunctionBlock(parent_17) || parent_17.kind === 261) {\n                            return parent_17;\n                        }\n                        if (parent_17.kind === 221) {\n                            var tryStatement = parent_17;\n                            if (tryStatement.tryBlock === child && tryStatement.catchClause) {\n                                return child;\n                            }\n                        }\n                        child = parent_17;\n                    }\n                    return undefined;\n                }\n                function aggregateAllBreakAndContinueStatements(node) {\n                    var statementAccumulator = [];\n                    aggregate(node);\n                    return statementAccumulator;\n                    function aggregate(node) {\n                        if (node.kind === 215 || node.kind === 214) {\n                            statementAccumulator.push(node);\n                        }\n                        else if (!ts.isFunctionLike(node)) {\n                            ts.forEachChild(node, aggregate);\n                        }\n                    }\n                }\n                function ownsBreakOrContinueStatement(owner, statement) {\n                    var actualOwner = getBreakOrContinueOwner(statement);\n                    return actualOwner && actualOwner === owner;\n                }\n                function getBreakOrContinueOwner(statement) {\n                    for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) {\n                        switch (node_1.kind) {\n                            case 218:\n                                if (statement.kind === 214) {\n                                    continue;\n                                }\n                            case 211:\n                            case 212:\n                            case 213:\n                            case 210:\n                            case 209:\n                                if (!statement.label || isLabeledBy(node_1, statement.label.text)) {\n                                    return node_1;\n                                }\n                                break;\n                            default:\n                                if (ts.isFunctionLike(node_1)) {\n                                    return undefined;\n                                }\n                                break;\n                        }\n                    }\n                    return undefined;\n                }\n                function getModifierOccurrences(modifier, declaration) {\n                    var container = declaration.parent;\n                    if (ts.isAccessibilityModifier(modifier)) {\n                        if (!(container.kind === 226 ||\n                            container.kind === 197 ||\n                            (declaration.kind === 144 && hasKind(container, 150)))) {\n                            return undefined;\n                        }\n                    }\n                    else if (modifier === 114) {\n                        if (!(container.kind === 226 || container.kind === 197)) {\n                            return undefined;\n                        }\n                    }\n                    else if (modifier === 83 || modifier === 123) {\n                        if (!(container.kind === 231 || container.kind === 261)) {\n                            return undefined;\n                        }\n                    }\n                    else if (modifier === 116) {\n                        if (!(container.kind === 226 || declaration.kind === 226)) {\n                            return undefined;\n                        }\n                    }\n                    else {\n                        return undefined;\n                    }\n                    var keywords = [];\n                    var modifierFlag = getFlagFromModifier(modifier);\n                    var nodes;\n                    switch (container.kind) {\n                        case 231:\n                        case 261:\n                            if (modifierFlag & 128) {\n                                nodes = declaration.members.concat(declaration);\n                            }\n                            else {\n                                nodes = container.statements;\n                            }\n                            break;\n                        case 150:\n                            nodes = container.parameters.concat(container.parent.members);\n                            break;\n                        case 226:\n                        case 197:\n                            nodes = container.members;\n                            if (modifierFlag & 28) {\n                                var constructor = ts.forEach(container.members, function (member) {\n                                    return member.kind === 150 && member;\n                                });\n                                if (constructor) {\n                                    nodes = nodes.concat(constructor.parameters);\n                                }\n                            }\n                            else if (modifierFlag & 128) {\n                                nodes = nodes.concat(container);\n                            }\n                            break;\n                        default:\n                            ts.Debug.fail(\"Invalid container kind.\");\n                    }\n                    ts.forEach(nodes, function (node) {\n                        if (ts.getModifierFlags(node) & modifierFlag) {\n                            ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); });\n                        }\n                    });\n                    return ts.map(keywords, getHighlightSpanForNode);\n                    function getFlagFromModifier(modifier) {\n                        switch (modifier) {\n                            case 113:\n                                return 4;\n                            case 111:\n                                return 8;\n                            case 112:\n                                return 16;\n                            case 114:\n                                return 32;\n                            case 83:\n                                return 1;\n                            case 123:\n                                return 2;\n                            case 116:\n                                return 128;\n                            default:\n                                ts.Debug.fail();\n                        }\n                    }\n                }\n                function pushKeywordIf(keywordList, token) {\n                    var expected = [];\n                    for (var _i = 2; _i < arguments.length; _i++) {\n                        expected[_i - 2] = arguments[_i];\n                    }\n                    if (token && ts.contains(expected, token.kind)) {\n                        keywordList.push(token);\n                        return true;\n                    }\n                    return false;\n                }\n                function getGetAndSetOccurrences(accessorDeclaration) {\n                    var keywords = [];\n                    tryPushAccessorKeyword(accessorDeclaration.symbol, 151);\n                    tryPushAccessorKeyword(accessorDeclaration.symbol, 152);\n                    return ts.map(keywords, getHighlightSpanForNode);\n                    function tryPushAccessorKeyword(accessorSymbol, accessorKind) {\n                        var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind);\n                        if (accessor) {\n                            ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 124, 133); });\n                        }\n                    }\n                }\n                function getConstructorOccurrences(constructorDeclaration) {\n                    var declarations = constructorDeclaration.symbol.getDeclarations();\n                    var keywords = [];\n                    ts.forEach(declarations, function (declaration) {\n                        ts.forEach(declaration.getChildren(), function (token) {\n                            return pushKeywordIf(keywords, token, 122);\n                        });\n                    });\n                    return ts.map(keywords, getHighlightSpanForNode);\n                }\n                function getLoopBreakContinueOccurrences(loopNode) {\n                    var keywords = [];\n                    if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87, 105, 80)) {\n                        if (loopNode.kind === 209) {\n                            var loopTokens = loopNode.getChildren();\n                            for (var i = loopTokens.length - 1; i >= 0; i--) {\n                                if (pushKeywordIf(keywords, loopTokens[i], 105)) {\n                                    break;\n                                }\n                            }\n                        }\n                    }\n                    var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement);\n                    ts.forEach(breaksAndContinues, function (statement) {\n                        if (ownsBreakOrContinueStatement(loopNode, statement)) {\n                            pushKeywordIf(keywords, statement.getFirstToken(), 71, 76);\n                        }\n                    });\n                    return ts.map(keywords, getHighlightSpanForNode);\n                }\n                function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) {\n                    var owner = getBreakOrContinueOwner(breakOrContinueStatement);\n                    if (owner) {\n                        switch (owner.kind) {\n                            case 211:\n                            case 212:\n                            case 213:\n                            case 209:\n                            case 210:\n                                return getLoopBreakContinueOccurrences(owner);\n                            case 218:\n                                return getSwitchCaseDefaultOccurrences(owner);\n                        }\n                    }\n                    return undefined;\n                }\n                function getSwitchCaseDefaultOccurrences(switchStatement) {\n                    var keywords = [];\n                    pushKeywordIf(keywords, switchStatement.getFirstToken(), 97);\n                    ts.forEach(switchStatement.caseBlock.clauses, function (clause) {\n                        pushKeywordIf(keywords, clause.getFirstToken(), 72, 78);\n                        var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause);\n                        ts.forEach(breaksAndContinues, function (statement) {\n                            if (ownsBreakOrContinueStatement(switchStatement, statement)) {\n                                pushKeywordIf(keywords, statement.getFirstToken(), 71);\n                            }\n                        });\n                    });\n                    return ts.map(keywords, getHighlightSpanForNode);\n                }\n                function getTryCatchFinallyOccurrences(tryStatement) {\n                    var keywords = [];\n                    pushKeywordIf(keywords, tryStatement.getFirstToken(), 101);\n                    if (tryStatement.catchClause) {\n                        pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73);\n                    }\n                    if (tryStatement.finallyBlock) {\n                        var finallyKeyword = ts.findChildOfKind(tryStatement, 86, sourceFile);\n                        pushKeywordIf(keywords, finallyKeyword, 86);\n                    }\n                    return ts.map(keywords, getHighlightSpanForNode);\n                }\n                function getThrowOccurrences(throwStatement) {\n                    var owner = getThrowStatementOwner(throwStatement);\n                    if (!owner) {\n                        return undefined;\n                    }\n                    var keywords = [];\n                    ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) {\n                        pushKeywordIf(keywords, throwStatement.getFirstToken(), 99);\n                    });\n                    if (ts.isFunctionBlock(owner)) {\n                        ts.forEachReturnStatement(owner, function (returnStatement) {\n                            pushKeywordIf(keywords, returnStatement.getFirstToken(), 95);\n                        });\n                    }\n                    return ts.map(keywords, getHighlightSpanForNode);\n                }\n                function getReturnOccurrences(returnStatement) {\n                    var func = ts.getContainingFunction(returnStatement);\n                    if (!(func && hasKind(func.body, 204))) {\n                        return undefined;\n                    }\n                    var keywords = [];\n                    ts.forEachReturnStatement(func.body, function (returnStatement) {\n                        pushKeywordIf(keywords, returnStatement.getFirstToken(), 95);\n                    });\n                    ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) {\n                        pushKeywordIf(keywords, throwStatement.getFirstToken(), 99);\n                    });\n                    return ts.map(keywords, getHighlightSpanForNode);\n                }\n                function getIfElseOccurrences(ifStatement) {\n                    var keywords = [];\n                    while (hasKind(ifStatement.parent, 208) && ifStatement.parent.elseStatement === ifStatement) {\n                        ifStatement = ifStatement.parent;\n                    }\n                    while (ifStatement) {\n                        var children = ifStatement.getChildren();\n                        pushKeywordIf(keywords, children[0], 89);\n                        for (var i = children.length - 1; i >= 0; i--) {\n                            if (pushKeywordIf(keywords, children[i], 81)) {\n                                break;\n                            }\n                        }\n                        if (!hasKind(ifStatement.elseStatement, 208)) {\n                            break;\n                        }\n                        ifStatement = ifStatement.elseStatement;\n                    }\n                    var result = [];\n                    for (var i = 0; i < keywords.length; i++) {\n                        if (keywords[i].kind === 81 && i < keywords.length - 1) {\n                            var elseKeyword = keywords[i];\n                            var ifKeyword = keywords[i + 1];\n                            var shouldCombindElseAndIf = true;\n                            for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) {\n                                if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) {\n                                    shouldCombindElseAndIf = false;\n                                    break;\n                                }\n                            }\n                            if (shouldCombindElseAndIf) {\n                                result.push({\n                                    fileName: fileName,\n                                    textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end),\n                                    kind: ts.HighlightSpanKind.reference\n                                });\n                                i++;\n                                continue;\n                            }\n                        }\n                        result.push(getHighlightSpanForNode(keywords[i]));\n                    }\n                    return result;\n                }\n            }\n        }\n        DocumentHighlights.getDocumentHighlights = getDocumentHighlights;\n        function isLabeledBy(node, labelName) {\n            for (var owner = node.parent; owner.kind === 219; owner = owner.parent) {\n                if (owner.label.text === labelName) {\n                    return true;\n                }\n            }\n            return false;\n        }\n    })(DocumentHighlights = ts.DocumentHighlights || (ts.DocumentHighlights = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) {\n        if (currentDirectory === void 0) { currentDirectory = \"\"; }\n        var buckets = ts.createMap();\n        var getCanonicalFileName = ts.createGetCanonicalFileName(!!useCaseSensitiveFileNames);\n        function getKeyForCompilationSettings(settings) {\n            return \"_\" + settings.target + \"|\" + settings.module + \"|\" + settings.noResolve + \"|\" + settings.jsx + \"|\" + settings.allowJs + \"|\" + settings.baseUrl + \"|\" + JSON.stringify(settings.typeRoots) + \"|\" + JSON.stringify(settings.rootDirs) + \"|\" + JSON.stringify(settings.paths);\n        }\n        function getBucketForCompilationSettings(key, createIfMissing) {\n            var bucket = buckets[key];\n            if (!bucket && createIfMissing) {\n                buckets[key] = bucket = ts.createFileMap();\n            }\n            return bucket;\n        }\n        function reportStats() {\n            var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === \"_\"; }).map(function (name) {\n                var entries = buckets[name];\n                var sourceFiles = [];\n                entries.forEachValue(function (key, entry) {\n                    sourceFiles.push({\n                        name: key,\n                        refCount: entry.languageServiceRefCount,\n                        references: entry.owners.slice(0)\n                    });\n                });\n                sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; });\n                return {\n                    bucket: name,\n                    sourceFiles: sourceFiles\n                };\n            });\n            return JSON.stringify(bucketInfoArray, undefined, 2);\n        }\n        function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) {\n            var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);\n            var key = getKeyForCompilationSettings(compilationSettings);\n            return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind);\n        }\n        function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) {\n            return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, true, scriptKind);\n        }\n        function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) {\n            var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);\n            var key = getKeyForCompilationSettings(compilationSettings);\n            return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind);\n        }\n        function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) {\n            return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, false, scriptKind);\n        }\n        function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) {\n            var bucket = getBucketForCompilationSettings(key, true);\n            var entry = bucket.get(path);\n            if (!entry) {\n                ts.Debug.assert(acquiring, \"How could we be trying to update a document that the registry doesn't have?\");\n                var sourceFile = ts.createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, false, scriptKind);\n                entry = {\n                    sourceFile: sourceFile,\n                    languageServiceRefCount: 0,\n                    owners: []\n                };\n                bucket.set(path, entry);\n            }\n            else {\n                if (entry.sourceFile.version !== version) {\n                    entry.sourceFile = ts.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot));\n                }\n            }\n            if (acquiring) {\n                entry.languageServiceRefCount++;\n            }\n            return entry.sourceFile;\n        }\n        function releaseDocument(fileName, compilationSettings) {\n            var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);\n            var key = getKeyForCompilationSettings(compilationSettings);\n            return releaseDocumentWithKey(path, key);\n        }\n        function releaseDocumentWithKey(path, key) {\n            var bucket = getBucketForCompilationSettings(key, false);\n            ts.Debug.assert(bucket !== undefined);\n            var entry = bucket.get(path);\n            entry.languageServiceRefCount--;\n            ts.Debug.assert(entry.languageServiceRefCount >= 0);\n            if (entry.languageServiceRefCount === 0) {\n                bucket.remove(path);\n            }\n        }\n        return {\n            acquireDocument: acquireDocument,\n            acquireDocumentWithKey: acquireDocumentWithKey,\n            updateDocument: updateDocument,\n            updateDocumentWithKey: updateDocumentWithKey,\n            releaseDocument: releaseDocument,\n            releaseDocumentWithKey: releaseDocumentWithKey,\n            reportStats: reportStats,\n            getKeyForCompilationSettings: getKeyForCompilationSettings\n        };\n    }\n    ts.createDocumentRegistry = createDocumentRegistry;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var FindAllReferences;\n    (function (FindAllReferences) {\n        function findReferencedSymbols(typeChecker, cancellationToken, sourceFiles, sourceFile, position, findInStrings, findInComments) {\n            var node = ts.getTouchingPropertyName(sourceFile, position, true);\n            if (node === sourceFile) {\n                return undefined;\n            }\n            switch (node.kind) {\n                case 8:\n                    if (!ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) {\n                        break;\n                    }\n                case 70:\n                case 98:\n                case 122:\n                case 9:\n                    return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, false);\n            }\n            return undefined;\n        }\n        FindAllReferences.findReferencedSymbols = findReferencedSymbols;\n        function getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, implementations) {\n            if (!implementations) {\n                if (ts.isLabelName(node)) {\n                    if (ts.isJumpStatementTarget(node)) {\n                        var labelDefinition = ts.getTargetLabel(node.parent, node.text);\n                        return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : undefined;\n                    }\n                    else {\n                        return getLabelReferencesInNode(node.parent, node);\n                    }\n                }\n                if (ts.isThis(node)) {\n                    return getReferencesForThisKeyword(node, sourceFiles);\n                }\n                if (node.kind === 96) {\n                    return getReferencesForSuperKeyword(node);\n                }\n            }\n            var symbol = typeChecker.getSymbolAtLocation(node);\n            if (!implementations && !symbol && node.kind === 9) {\n                return getReferencesForStringLiteral(node, sourceFiles);\n            }\n            if (!symbol) {\n                return undefined;\n            }\n            var declarations = symbol.declarations;\n            if (!declarations || !declarations.length) {\n                return undefined;\n            }\n            var result;\n            var searchMeaning = getIntersectingMeaningFromDeclarations(ts.getMeaningFromLocation(node), declarations);\n            var declaredName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node));\n            var scope = getSymbolScope(symbol);\n            var symbolToIndex = [];\n            if (scope) {\n                result = [];\n                getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex);\n            }\n            else {\n                var internedName = getInternedName(symbol, node);\n                for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) {\n                    var sourceFile = sourceFiles_8[_i];\n                    cancellationToken.throwIfCancellationRequested();\n                    var nameTable = ts.getNameTable(sourceFile);\n                    if (nameTable[internedName] !== undefined) {\n                        result = result || [];\n                        getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex);\n                    }\n                }\n            }\n            return result;\n            function getDefinition(symbol) {\n                var info = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), ts.getContainerNode(node), node);\n                var name = ts.map(info.displayParts, function (p) { return p.text; }).join(\"\");\n                var declarations = symbol.declarations;\n                if (!declarations || declarations.length === 0) {\n                    return undefined;\n                }\n                return {\n                    containerKind: \"\",\n                    containerName: \"\",\n                    name: name,\n                    kind: info.symbolKind,\n                    fileName: declarations[0].getSourceFile().fileName,\n                    textSpan: ts.createTextSpan(declarations[0].getStart(), 0),\n                    displayParts: info.displayParts\n                };\n            }\n            function getAliasSymbolForPropertyNameSymbol(symbol, location) {\n                if (symbol.flags & 8388608) {\n                    var defaultImport = ts.getDeclarationOfKind(symbol, 236);\n                    if (defaultImport) {\n                        return typeChecker.getAliasedSymbol(symbol);\n                    }\n                    var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 239 ||\n                        declaration.kind === 243) ? declaration : undefined; });\n                    if (importOrExportSpecifier &&\n                        (!importOrExportSpecifier.propertyName ||\n                            importOrExportSpecifier.propertyName === location)) {\n                        return importOrExportSpecifier.kind === 239 ?\n                            typeChecker.getAliasedSymbol(symbol) :\n                            typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier);\n                    }\n                }\n                return undefined;\n            }\n            function followAliasIfNecessary(symbol, location) {\n                return getAliasSymbolForPropertyNameSymbol(symbol, location) || symbol;\n            }\n            function getPropertySymbolOfDestructuringAssignment(location) {\n                return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) &&\n                    typeChecker.getPropertySymbolOfDestructuringAssignment(location);\n            }\n            function isObjectBindingPatternElementWithoutPropertyName(symbol) {\n                var bindingElement = ts.getDeclarationOfKind(symbol, 174);\n                return bindingElement &&\n                    bindingElement.parent.kind === 172 &&\n                    !bindingElement.propertyName;\n            }\n            function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) {\n                if (isObjectBindingPatternElementWithoutPropertyName(symbol)) {\n                    var bindingElement = ts.getDeclarationOfKind(symbol, 174);\n                    var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent);\n                    return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text);\n                }\n                return undefined;\n            }\n            function getInternedName(symbol, location) {\n                if (ts.isImportOrExportSpecifierName(location)) {\n                    return location.getText();\n                }\n                var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol);\n                symbol = localExportDefaultSymbol || symbol;\n                return ts.stripQuotes(symbol.name);\n            }\n            function getSymbolScope(symbol) {\n                var valueDeclaration = symbol.valueDeclaration;\n                if (valueDeclaration && (valueDeclaration.kind === 184 || valueDeclaration.kind === 197)) {\n                    return valueDeclaration;\n                }\n                if (symbol.flags & (4 | 8192)) {\n                    var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8) ? d : undefined; });\n                    if (privateDeclaration) {\n                        return ts.getAncestor(privateDeclaration, 226);\n                    }\n                }\n                if (symbol.flags & 8388608) {\n                    return undefined;\n                }\n                if (isObjectBindingPatternElementWithoutPropertyName(symbol)) {\n                    return undefined;\n                }\n                if (symbol.parent || (symbol.flags & 268435456)) {\n                    return undefined;\n                }\n                var scope;\n                var declarations = symbol.getDeclarations();\n                if (declarations) {\n                    for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {\n                        var declaration = declarations_7[_i];\n                        var container = ts.getContainerNode(declaration);\n                        if (!container) {\n                            return undefined;\n                        }\n                        if (scope && scope !== container) {\n                            return undefined;\n                        }\n                        if (container.kind === 261 && !ts.isExternalModule(container)) {\n                            return undefined;\n                        }\n                        scope = container;\n                    }\n                }\n                return scope;\n            }\n            function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) {\n                var positions = [];\n                if (!symbolName || !symbolName.length) {\n                    return positions;\n                }\n                var text = sourceFile.text;\n                var sourceLength = text.length;\n                var symbolNameLength = symbolName.length;\n                var position = text.indexOf(symbolName, start);\n                while (position >= 0) {\n                    cancellationToken.throwIfCancellationRequested();\n                    if (position > end)\n                        break;\n                    var endPosition = position + symbolNameLength;\n                    if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 5)) &&\n                        (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 5))) {\n                        positions.push(position);\n                    }\n                    position = text.indexOf(symbolName, position + symbolNameLength + 1);\n                }\n                return positions;\n            }\n            function getLabelReferencesInNode(container, targetLabel) {\n                var references = [];\n                var sourceFile = container.getSourceFile();\n                var labelName = targetLabel.text;\n                var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd());\n                ts.forEach(possiblePositions, function (position) {\n                    cancellationToken.throwIfCancellationRequested();\n                    var node = ts.getTouchingWord(sourceFile, position);\n                    if (!node || node.getWidth() !== labelName.length) {\n                        return;\n                    }\n                    if (node === targetLabel ||\n                        (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel)) {\n                        references.push(getReferenceEntryFromNode(node));\n                    }\n                });\n                var definition = {\n                    containerKind: \"\",\n                    containerName: \"\",\n                    fileName: targetLabel.getSourceFile().fileName,\n                    kind: ts.ScriptElementKind.label,\n                    name: labelName,\n                    textSpan: ts.createTextSpanFromBounds(targetLabel.getStart(), targetLabel.getEnd()),\n                    displayParts: [ts.displayPart(labelName, ts.SymbolDisplayPartKind.text)]\n                };\n                return [{ definition: definition, references: references }];\n            }\n            function isValidReferencePosition(node, searchSymbolName) {\n                if (node) {\n                    switch (node.kind) {\n                        case 70:\n                            return node.getWidth() === searchSymbolName.length;\n                        case 9:\n                            if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) ||\n                                isNameOfExternalModuleImportOrDeclaration(node)) {\n                                return node.getWidth() === searchSymbolName.length + 2;\n                            }\n                            break;\n                        case 8:\n                            if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) {\n                                return node.getWidth() === searchSymbolName.length;\n                            }\n                            break;\n                    }\n                }\n                return false;\n            }\n            function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex) {\n                var sourceFile = container.getSourceFile();\n                var start = findInComments ? container.getFullStart() : container.getStart();\n                var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd());\n                var parents = getParentSymbolsOfPropertyAccess();\n                var inheritsFromCache = ts.createMap();\n                if (possiblePositions.length) {\n                    var searchSymbols_1 = populateSearchSymbolSet(searchSymbol, searchLocation);\n                    ts.forEach(possiblePositions, function (position) {\n                        cancellationToken.throwIfCancellationRequested();\n                        var referenceLocation = ts.getTouchingPropertyName(sourceFile, position);\n                        if (!isValidReferencePosition(referenceLocation, searchText)) {\n                            if (!implementations && ((findInStrings && ts.isInString(sourceFile, position)) ||\n                                (findInComments && ts.isInNonReferenceComment(sourceFile, position)))) {\n                                result.push({\n                                    definition: undefined,\n                                    references: [{\n                                            fileName: sourceFile.fileName,\n                                            textSpan: ts.createTextSpan(position, searchText.length),\n                                            isWriteAccess: false,\n                                            isDefinition: false\n                                        }]\n                                });\n                            }\n                            return;\n                        }\n                        if (!(ts.getMeaningFromLocation(referenceLocation) & searchMeaning)) {\n                            return;\n                        }\n                        var referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation);\n                        if (referenceSymbol) {\n                            var referenceSymbolDeclaration = referenceSymbol.valueDeclaration;\n                            var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration);\n                            var relatedSymbol = getRelatedSymbol(searchSymbols_1, referenceSymbol, referenceLocation, searchLocation.kind === 122, parents, inheritsFromCache);\n                            if (relatedSymbol) {\n                                addReferenceToRelatedSymbol(referenceLocation, relatedSymbol);\n                            }\n                            else if (!(referenceSymbol.flags & 67108864) && searchSymbols_1.indexOf(shorthandValueSymbol) >= 0) {\n                                addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol);\n                            }\n                            else if (searchLocation.kind === 122) {\n                                findAdditionalConstructorReferences(referenceSymbol, referenceLocation);\n                            }\n                        }\n                    });\n                }\n                return;\n                function getParentSymbolsOfPropertyAccess() {\n                    if (implementations) {\n                        var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation);\n                        if (propertyAccessExpression) {\n                            var localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression);\n                            if (localParentType) {\n                                if (localParentType.symbol && localParentType.symbol.flags & (32 | 64) && localParentType.symbol !== searchSymbol.parent) {\n                                    return [localParentType.symbol];\n                                }\n                                else if (localParentType.flags & 196608) {\n                                    return getSymbolsForClassAndInterfaceComponents(localParentType);\n                                }\n                            }\n                        }\n                    }\n                }\n                function getPropertyAccessExpressionFromRightHandSide(node) {\n                    return ts.isRightSideOfPropertyAccess(node) && node.parent;\n                }\n                function findAdditionalConstructorReferences(referenceSymbol, referenceLocation) {\n                    ts.Debug.assert(ts.isClassLike(searchSymbol.valueDeclaration));\n                    var referenceClass = referenceLocation.parent;\n                    if (referenceSymbol === searchSymbol && ts.isClassLike(referenceClass)) {\n                        ts.Debug.assert(referenceClass.name === referenceLocation);\n                        addReferences(findOwnConstructorCalls(searchSymbol));\n                    }\n                    else {\n                        var classExtending = tryGetClassByExtendingIdentifier(referenceLocation);\n                        if (classExtending && ts.isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation) === searchSymbol) {\n                            addReferences(superConstructorAccesses(classExtending));\n                        }\n                    }\n                }\n                function addReferences(references) {\n                    if (references.length) {\n                        var referencedSymbol = getReferencedSymbol(searchSymbol);\n                        ts.addRange(referencedSymbol.references, ts.map(references, getReferenceEntryFromNode));\n                    }\n                }\n                function findOwnConstructorCalls(classSymbol) {\n                    var result = [];\n                    for (var _i = 0, _a = classSymbol.members[\"__constructor\"].declarations; _i < _a.length; _i++) {\n                        var decl = _a[_i];\n                        ts.Debug.assert(decl.kind === 150);\n                        var ctrKeyword = decl.getChildAt(0);\n                        ts.Debug.assert(ctrKeyword.kind === 122);\n                        result.push(ctrKeyword);\n                    }\n                    ts.forEachProperty(classSymbol.exports, function (member) {\n                        var decl = member.valueDeclaration;\n                        if (decl && decl.kind === 149) {\n                            var body = decl.body;\n                            if (body) {\n                                forEachDescendantOfKind(body, 98, function (thisKeyword) {\n                                    if (ts.isNewExpressionTarget(thisKeyword)) {\n                                        result.push(thisKeyword);\n                                    }\n                                });\n                            }\n                        }\n                    });\n                    return result;\n                }\n                function superConstructorAccesses(cls) {\n                    var symbol = cls.symbol;\n                    var ctr = symbol.members[\"__constructor\"];\n                    if (!ctr) {\n                        return [];\n                    }\n                    var result = [];\n                    for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) {\n                        var decl = _a[_i];\n                        ts.Debug.assert(decl.kind === 150);\n                        var body = decl.body;\n                        if (body) {\n                            forEachDescendantOfKind(body, 96, function (node) {\n                                if (ts.isCallExpressionTarget(node)) {\n                                    result.push(node);\n                                }\n                            });\n                        }\n                    }\n                    ;\n                    return result;\n                }\n                function getReferencedSymbol(symbol) {\n                    var symbolId = ts.getSymbolId(symbol);\n                    var index = symbolToIndex[symbolId];\n                    if (index === undefined) {\n                        index = result.length;\n                        symbolToIndex[symbolId] = index;\n                        result.push({\n                            definition: getDefinition(symbol),\n                            references: []\n                        });\n                    }\n                    return result[index];\n                }\n                function addReferenceToRelatedSymbol(node, relatedSymbol) {\n                    var references = getReferencedSymbol(relatedSymbol).references;\n                    if (implementations) {\n                        getImplementationReferenceEntryForNode(node, references);\n                    }\n                    else {\n                        references.push(getReferenceEntryFromNode(node));\n                    }\n                }\n            }\n            function getImplementationReferenceEntryForNode(refNode, result) {\n                if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) {\n                    result.push(getReferenceEntryFromNode(refNode.parent));\n                }\n                else if (refNode.kind === 70) {\n                    if (refNode.parent.kind === 258) {\n                        getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result);\n                    }\n                    var containingClass = getContainingClassIfInHeritageClause(refNode);\n                    if (containingClass) {\n                        result.push(getReferenceEntryFromNode(containingClass));\n                        return;\n                    }\n                    var containingTypeReference = getContainingTypeReference(refNode);\n                    if (containingTypeReference) {\n                        var parent_18 = containingTypeReference.parent;\n                        if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) {\n                            maybeAdd(getReferenceEntryFromNode(parent_18.initializer));\n                        }\n                        else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) {\n                            if (parent_18.body.kind === 204) {\n                                ts.forEachReturnStatement(parent_18.body, function (returnStatement) {\n                                    if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) {\n                                        maybeAdd(getReferenceEntryFromNode(returnStatement.expression));\n                                    }\n                                });\n                            }\n                            else if (isImplementationExpression(parent_18.body)) {\n                                maybeAdd(getReferenceEntryFromNode(parent_18.body));\n                            }\n                        }\n                        else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) {\n                            maybeAdd(getReferenceEntryFromNode(parent_18.expression));\n                        }\n                    }\n                }\n                function maybeAdd(a) {\n                    if (!ts.forEach(result, function (b) { return a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length; })) {\n                        result.push(a);\n                    }\n                }\n            }\n            function getSymbolsForClassAndInterfaceComponents(type, result) {\n                if (result === void 0) { result = []; }\n                for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                    var componentType = _a[_i];\n                    if (componentType.symbol && componentType.symbol.getFlags() & (32 | 64)) {\n                        result.push(componentType.symbol);\n                    }\n                    if (componentType.getFlags() & 196608) {\n                        getSymbolsForClassAndInterfaceComponents(componentType, result);\n                    }\n                }\n                return result;\n            }\n            function getContainingTypeReference(node) {\n                var topLevelTypeReference = undefined;\n                while (node) {\n                    if (ts.isTypeNode(node)) {\n                        topLevelTypeReference = node;\n                    }\n                    node = node.parent;\n                }\n                return topLevelTypeReference;\n            }\n            function getContainingClassIfInHeritageClause(node) {\n                if (node && node.parent) {\n                    if (node.kind === 199\n                        && node.parent.kind === 255\n                        && ts.isClassLike(node.parent.parent)) {\n                        return node.parent.parent;\n                    }\n                    else if (node.kind === 70 || node.kind === 177) {\n                        return getContainingClassIfInHeritageClause(node.parent);\n                    }\n                }\n                return undefined;\n            }\n            function isImplementationExpression(node) {\n                if (node.kind === 183) {\n                    return isImplementationExpression(node.expression);\n                }\n                return node.kind === 185 ||\n                    node.kind === 184 ||\n                    node.kind === 176 ||\n                    node.kind === 197 ||\n                    node.kind === 175;\n            }\n            function explicitlyInheritsFrom(child, parent, cachedResults) {\n                var parentIsInterface = parent.getFlags() & 64;\n                return searchHierarchy(child);\n                function searchHierarchy(symbol) {\n                    if (symbol === parent) {\n                        return true;\n                    }\n                    var key = ts.getSymbolId(symbol) + \",\" + ts.getSymbolId(parent);\n                    if (key in cachedResults) {\n                        return cachedResults[key];\n                    }\n                    cachedResults[key] = false;\n                    var inherits = ts.forEach(symbol.getDeclarations(), function (declaration) {\n                        if (ts.isClassLike(declaration)) {\n                            if (parentIsInterface) {\n                                var interfaceReferences = ts.getClassImplementsHeritageClauseElements(declaration);\n                                if (interfaceReferences) {\n                                    for (var _i = 0, interfaceReferences_1 = interfaceReferences; _i < interfaceReferences_1.length; _i++) {\n                                        var typeReference = interfaceReferences_1[_i];\n                                        if (searchTypeReference(typeReference)) {\n                                            return true;\n                                        }\n                                    }\n                                }\n                            }\n                            return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration));\n                        }\n                        else if (declaration.kind === 227) {\n                            if (parentIsInterface) {\n                                return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference);\n                            }\n                        }\n                        return false;\n                    });\n                    cachedResults[key] = inherits;\n                    return inherits;\n                }\n                function searchTypeReference(typeReference) {\n                    if (typeReference) {\n                        var type = typeChecker.getTypeAtLocation(typeReference);\n                        if (type && type.symbol) {\n                            return searchHierarchy(type.symbol);\n                        }\n                    }\n                    return false;\n                }\n            }\n            function getReferencesForSuperKeyword(superKeyword) {\n                var searchSpaceNode = ts.getSuperContainer(superKeyword, false);\n                if (!searchSpaceNode) {\n                    return undefined;\n                }\n                var staticFlag = 32;\n                switch (searchSpaceNode.kind) {\n                    case 147:\n                    case 146:\n                    case 149:\n                    case 148:\n                    case 150:\n                    case 151:\n                    case 152:\n                        staticFlag &= ts.getModifierFlags(searchSpaceNode);\n                        searchSpaceNode = searchSpaceNode.parent;\n                        break;\n                    default:\n                        return undefined;\n                }\n                var references = [];\n                var sourceFile = searchSpaceNode.getSourceFile();\n                var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, \"super\", searchSpaceNode.getStart(), searchSpaceNode.getEnd());\n                ts.forEach(possiblePositions, function (position) {\n                    cancellationToken.throwIfCancellationRequested();\n                    var node = ts.getTouchingWord(sourceFile, position);\n                    if (!node || node.kind !== 96) {\n                        return;\n                    }\n                    var container = ts.getSuperContainer(node, false);\n                    if (container && (32 & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) {\n                        references.push(getReferenceEntryFromNode(node));\n                    }\n                });\n                var definition = getDefinition(searchSpaceNode.symbol);\n                return [{ definition: definition, references: references }];\n            }\n            function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) {\n                var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false);\n                var staticFlag = 32;\n                switch (searchSpaceNode.kind) {\n                    case 149:\n                    case 148:\n                        if (ts.isObjectLiteralMethod(searchSpaceNode)) {\n                            break;\n                        }\n                    case 147:\n                    case 146:\n                    case 150:\n                    case 151:\n                    case 152:\n                        staticFlag &= ts.getModifierFlags(searchSpaceNode);\n                        searchSpaceNode = searchSpaceNode.parent;\n                        break;\n                    case 261:\n                        if (ts.isExternalModule(searchSpaceNode)) {\n                            return undefined;\n                        }\n                    case 225:\n                    case 184:\n                        break;\n                    default:\n                        return undefined;\n                }\n                var references = [];\n                var possiblePositions;\n                if (searchSpaceNode.kind === 261) {\n                    ts.forEach(sourceFiles, function (sourceFile) {\n                        possiblePositions = getPossibleSymbolReferencePositions(sourceFile, \"this\", sourceFile.getStart(), sourceFile.getEnd());\n                        getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references);\n                    });\n                }\n                else {\n                    var sourceFile = searchSpaceNode.getSourceFile();\n                    possiblePositions = getPossibleSymbolReferencePositions(sourceFile, \"this\", searchSpaceNode.getStart(), searchSpaceNode.getEnd());\n                    getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references);\n                }\n                var thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword);\n                var displayParts = thisOrSuperSymbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), ts.getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts;\n                return [{\n                        definition: {\n                            containerKind: \"\",\n                            containerName: \"\",\n                            fileName: node.getSourceFile().fileName,\n                            kind: ts.ScriptElementKind.variableElement,\n                            name: \"this\",\n                            textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()),\n                            displayParts: displayParts\n                        },\n                        references: references\n                    }];\n                function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) {\n                    ts.forEach(possiblePositions, function (position) {\n                        cancellationToken.throwIfCancellationRequested();\n                        var node = ts.getTouchingWord(sourceFile, position);\n                        if (!node || !ts.isThis(node)) {\n                            return;\n                        }\n                        var container = ts.getThisContainer(node, false);\n                        switch (searchSpaceNode.kind) {\n                            case 184:\n                            case 225:\n                                if (searchSpaceNode.symbol === container.symbol) {\n                                    result.push(getReferenceEntryFromNode(node));\n                                }\n                                break;\n                            case 149:\n                            case 148:\n                                if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) {\n                                    result.push(getReferenceEntryFromNode(node));\n                                }\n                                break;\n                            case 197:\n                            case 226:\n                                if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32) === staticFlag) {\n                                    result.push(getReferenceEntryFromNode(node));\n                                }\n                                break;\n                            case 261:\n                                if (container.kind === 261 && !ts.isExternalModule(container)) {\n                                    result.push(getReferenceEntryFromNode(node));\n                                }\n                                break;\n                        }\n                    });\n                }\n            }\n            function getReferencesForStringLiteral(node, sourceFiles) {\n                var type = ts.getStringLiteralTypeForNode(node, typeChecker);\n                if (!type) {\n                    return undefined;\n                }\n                var references = [];\n                for (var _i = 0, sourceFiles_9 = sourceFiles; _i < sourceFiles_9.length; _i++) {\n                    var sourceFile = sourceFiles_9[_i];\n                    var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd());\n                    getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references);\n                }\n                return [{\n                        definition: {\n                            containerKind: \"\",\n                            containerName: \"\",\n                            fileName: node.getSourceFile().fileName,\n                            kind: ts.ScriptElementKind.variableElement,\n                            name: type.text,\n                            textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()),\n                            displayParts: [ts.displayPart(ts.getTextOfNode(node), ts.SymbolDisplayPartKind.stringLiteral)]\n                        },\n                        references: references\n                    }];\n                function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) {\n                    for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) {\n                        var position = possiblePositions_1[_i];\n                        cancellationToken.throwIfCancellationRequested();\n                        var node_2 = ts.getTouchingWord(sourceFile, position);\n                        if (!node_2 || node_2.kind !== 9) {\n                            return;\n                        }\n                        var type_1 = ts.getStringLiteralTypeForNode(node_2, typeChecker);\n                        if (type_1 === searchType) {\n                            references.push(getReferenceEntryFromNode(node_2));\n                        }\n                    }\n                }\n            }\n            function populateSearchSymbolSet(symbol, location) {\n                var result = [symbol];\n                var containingObjectLiteralElement = getContainingObjectLiteralElement(location);\n                if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 258) {\n                    var propertySymbol = getPropertySymbolOfDestructuringAssignment(location);\n                    if (propertySymbol) {\n                        result.push(propertySymbol);\n                    }\n                }\n                var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location);\n                if (aliasSymbol) {\n                    result = result.concat(populateSearchSymbolSet(aliasSymbol, location));\n                }\n                if (containingObjectLiteralElement) {\n                    ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) {\n                        ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol));\n                    });\n                    var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent);\n                    if (shorthandValueSymbol) {\n                        result.push(shorthandValueSymbol);\n                    }\n                }\n                if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 144 &&\n                    ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) {\n                    result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name));\n                }\n                var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol);\n                if (bindingElementPropertySymbol) {\n                    result.push(bindingElementPropertySymbol);\n                }\n                ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) {\n                    if (rootSymbol !== symbol) {\n                        result.push(rootSymbol);\n                    }\n                    if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) {\n                        getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, ts.createMap());\n                    }\n                });\n                return result;\n            }\n            function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) {\n                if (!symbol) {\n                    return;\n                }\n                if (symbol.name in previousIterationSymbolsCache) {\n                    return;\n                }\n                if (symbol.flags & (32 | 64)) {\n                    ts.forEach(symbol.getDeclarations(), function (declaration) {\n                        if (ts.isClassLike(declaration)) {\n                            getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration));\n                            ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference);\n                        }\n                        else if (declaration.kind === 227) {\n                            ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference);\n                        }\n                    });\n                }\n                return;\n                function getPropertySymbolFromTypeReference(typeReference) {\n                    if (typeReference) {\n                        var type = typeChecker.getTypeAtLocation(typeReference);\n                        if (type) {\n                            var propertySymbol = typeChecker.getPropertyOfType(type, propertyName);\n                            if (propertySymbol) {\n                                result.push.apply(result, typeChecker.getRootSymbols(propertySymbol));\n                            }\n                            previousIterationSymbolsCache[symbol.name] = symbol;\n                            getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache);\n                        }\n                    }\n                }\n            }\n            function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocationIsConstructor, parents, cache) {\n                if (ts.contains(searchSymbols, referenceSymbol)) {\n                    return (!searchLocationIsConstructor || ts.isNewExpressionTarget(referenceLocation)) && referenceSymbol;\n                }\n                var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation);\n                if (aliasSymbol) {\n                    return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache);\n                }\n                var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation);\n                if (containingObjectLiteralElement) {\n                    var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) {\n                        return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; });\n                    });\n                    if (contextualSymbol) {\n                        return contextualSymbol;\n                    }\n                    var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation);\n                    if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) {\n                        return propertySymbol;\n                    }\n                }\n                var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol);\n                if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) {\n                    return bindingElementPropertySymbol;\n                }\n                return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) {\n                    if (searchSymbols.indexOf(rootSymbol) >= 0) {\n                        return rootSymbol;\n                    }\n                    if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) {\n                        if (parents) {\n                            if (!ts.forEach(parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, cache); })) {\n                                return undefined;\n                            }\n                        }\n                        var result_4 = [];\n                        getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, ts.createMap());\n                        return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; });\n                    }\n                    return undefined;\n                });\n            }\n            function getNameFromObjectLiteralElement(node) {\n                if (node.name.kind === 142) {\n                    var nameExpression = node.name.expression;\n                    if (ts.isStringOrNumericLiteral(nameExpression)) {\n                        return nameExpression.text;\n                    }\n                    return undefined;\n                }\n                return node.name.text;\n            }\n            function getPropertySymbolsFromContextualType(node) {\n                var objectLiteral = node.parent;\n                var contextualType = typeChecker.getContextualType(objectLiteral);\n                var name = getNameFromObjectLiteralElement(node);\n                if (name && contextualType) {\n                    var result_5 = [];\n                    var symbol_2 = contextualType.getProperty(name);\n                    if (symbol_2) {\n                        result_5.push(symbol_2);\n                    }\n                    if (contextualType.flags & 65536) {\n                        ts.forEach(contextualType.types, function (t) {\n                            var symbol = t.getProperty(name);\n                            if (symbol) {\n                                result_5.push(symbol);\n                            }\n                        });\n                    }\n                    return result_5;\n                }\n                return undefined;\n            }\n            function getIntersectingMeaningFromDeclarations(meaning, declarations) {\n                if (declarations) {\n                    var lastIterationMeaning = void 0;\n                    do {\n                        lastIterationMeaning = meaning;\n                        for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {\n                            var declaration = declarations_8[_i];\n                            var declarationMeaning = ts.getMeaningFromDeclaration(declaration);\n                            if (declarationMeaning & meaning) {\n                                meaning |= declarationMeaning;\n                            }\n                        }\n                    } while (meaning !== lastIterationMeaning);\n                }\n                return meaning;\n            }\n        }\n        FindAllReferences.getReferencedSymbolsForNode = getReferencedSymbolsForNode;\n        function convertReferences(referenceSymbols) {\n            if (!referenceSymbols) {\n                return undefined;\n            }\n            var referenceEntries = [];\n            for (var _i = 0, referenceSymbols_1 = referenceSymbols; _i < referenceSymbols_1.length; _i++) {\n                var referenceSymbol = referenceSymbols_1[_i];\n                ts.addRange(referenceEntries, referenceSymbol.references);\n            }\n            return referenceEntries;\n        }\n        FindAllReferences.convertReferences = convertReferences;\n        function isImplementation(node) {\n            if (!node) {\n                return false;\n            }\n            else if (ts.isVariableLike(node)) {\n                if (node.initializer) {\n                    return true;\n                }\n                else if (node.kind === 223) {\n                    var parentStatement = getParentStatementOfVariableDeclaration(node);\n                    return parentStatement && ts.hasModifier(parentStatement, 2);\n                }\n            }\n            else if (ts.isFunctionLike(node)) {\n                return !!node.body || ts.hasModifier(node, 2);\n            }\n            else {\n                switch (node.kind) {\n                    case 226:\n                    case 197:\n                    case 229:\n                    case 230:\n                        return true;\n                }\n            }\n            return false;\n        }\n        function getParentStatementOfVariableDeclaration(node) {\n            if (node.parent && node.parent.parent && node.parent.parent.kind === 205) {\n                ts.Debug.assert(node.parent.kind === 224);\n                return node.parent.parent;\n            }\n        }\n        function getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result) {\n            var refSymbol = typeChecker.getSymbolAtLocation(node);\n            var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(refSymbol.valueDeclaration);\n            if (shorthandSymbol) {\n                for (var _i = 0, _a = shorthandSymbol.getDeclarations(); _i < _a.length; _i++) {\n                    var declaration = _a[_i];\n                    if (ts.getMeaningFromDeclaration(declaration) & 1) {\n                        result.push(getReferenceEntryFromNode(declaration));\n                    }\n                }\n            }\n        }\n        FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment = getReferenceEntriesForShorthandPropertyAssignment;\n        function getReferenceEntryFromNode(node) {\n            var start = node.getStart();\n            var end = node.getEnd();\n            if (node.kind === 9) {\n                start += 1;\n                end -= 1;\n            }\n            return {\n                fileName: node.getSourceFile().fileName,\n                textSpan: ts.createTextSpanFromBounds(start, end),\n                isWriteAccess: isWriteAccess(node),\n                isDefinition: ts.isDeclarationName(node) || ts.isLiteralComputedPropertyDeclarationName(node)\n            };\n        }\n        FindAllReferences.getReferenceEntryFromNode = getReferenceEntryFromNode;\n        function isWriteAccess(node) {\n            if (node.kind === 70 && ts.isDeclarationName(node)) {\n                return true;\n            }\n            var parent = node.parent;\n            if (parent) {\n                if (parent.kind === 191 || parent.kind === 190) {\n                    return true;\n                }\n                else if (parent.kind === 192 && parent.left === node) {\n                    var operator = parent.operatorToken.kind;\n                    return 57 <= operator && operator <= 69;\n                }\n            }\n            return false;\n        }\n        function forEachDescendantOfKind(node, kind, action) {\n            ts.forEachChild(node, function (child) {\n                if (child.kind === kind) {\n                    action(child);\n                }\n                forEachDescendantOfKind(child, kind, action);\n            });\n        }\n        function getContainingObjectLiteralElement(node) {\n            switch (node.kind) {\n                case 9:\n                case 8:\n                    if (node.parent.kind === 142) {\n                        return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined;\n                    }\n                case 70:\n                    return isObjectLiteralPropertyDeclaration(node.parent) && node.parent.name === node ? node.parent : undefined;\n            }\n            return undefined;\n        }\n        function isObjectLiteralPropertyDeclaration(node) {\n            switch (node.kind) {\n                case 257:\n                case 258:\n                case 149:\n                case 151:\n                case 152:\n                    return true;\n            }\n            return false;\n        }\n        function tryGetClassByExtendingIdentifier(node) {\n            return ts.tryGetClassExtendingExpressionWithTypeArguments(ts.climbPastPropertyAccess(node).parent);\n        }\n        function isNameOfExternalModuleImportOrDeclaration(node) {\n            if (node.kind === 9) {\n                return ts.isNameOfModuleDeclaration(node) || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node);\n            }\n            return false;\n        }\n    })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var GoToDefinition;\n    (function (GoToDefinition) {\n        function getDefinitionAtPosition(program, sourceFile, position) {\n            var comment = findReferenceInPosition(sourceFile.referencedFiles, position);\n            if (comment) {\n                var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment);\n                if (referenceFile) {\n                    return [getDefinitionInfoForFileReference(comment.fileName, referenceFile.fileName)];\n                }\n                return undefined;\n            }\n            var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position);\n            if (typeReferenceDirective) {\n                var referenceFile = program.getResolvedTypeReferenceDirectives()[typeReferenceDirective.fileName];\n                if (referenceFile && referenceFile.resolvedFileName) {\n                    return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)];\n                }\n                return undefined;\n            }\n            var node = ts.getTouchingPropertyName(sourceFile, position);\n            if (node === sourceFile) {\n                return undefined;\n            }\n            if (ts.isJumpStatementTarget(node)) {\n                var labelName = node.text;\n                var label = ts.getTargetLabel(node.parent, node.text);\n                return label ? [createDefinitionInfo(label, ts.ScriptElementKind.label, labelName, undefined)] : undefined;\n            }\n            var typeChecker = program.getTypeChecker();\n            var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node);\n            if (calledDeclaration) {\n                return [createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration)];\n            }\n            var symbol = typeChecker.getSymbolAtLocation(node);\n            if (!symbol) {\n                return undefined;\n            }\n            if (symbol.flags & 8388608) {\n                var declaration = symbol.declarations[0];\n                if (node.kind === 70 &&\n                    (node.parent === declaration ||\n                        (declaration.kind === 239 && declaration.parent && declaration.parent.kind === 238))) {\n                    symbol = typeChecker.getAliasedSymbol(symbol);\n                }\n            }\n            if (node.parent.kind === 258) {\n                var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);\n                if (!shorthandSymbol) {\n                    return [];\n                }\n                var shorthandDeclarations = shorthandSymbol.getDeclarations();\n                var shorthandSymbolKind_1 = ts.SymbolDisplay.getSymbolKind(typeChecker, shorthandSymbol, node);\n                var shorthandSymbolName_1 = typeChecker.symbolToString(shorthandSymbol);\n                var shorthandContainerName_1 = typeChecker.symbolToString(symbol.parent, node);\n                return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind_1, shorthandSymbolName_1, shorthandContainerName_1); });\n            }\n            return getDefinitionFromSymbol(typeChecker, symbol, node);\n        }\n        GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition;\n        function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) {\n            var node = ts.getTouchingPropertyName(sourceFile, position);\n            if (node === sourceFile) {\n                return undefined;\n            }\n            var symbol = typeChecker.getSymbolAtLocation(node);\n            if (!symbol) {\n                return undefined;\n            }\n            var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node);\n            if (!type) {\n                return undefined;\n            }\n            if (type.flags & 65536 && !(type.flags & 16)) {\n                var result_6 = [];\n                ts.forEach(type.types, function (t) {\n                    if (t.symbol) {\n                        ts.addRange(result_6, getDefinitionFromSymbol(typeChecker, t.symbol, node));\n                    }\n                });\n                return result_6;\n            }\n            if (!type.symbol) {\n                return undefined;\n            }\n            return getDefinitionFromSymbol(typeChecker, type.symbol, node);\n        }\n        GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;\n        function getDefinitionFromSymbol(typeChecker, symbol, node) {\n            var result = [];\n            var declarations = symbol.getDeclarations();\n            var _a = getSymbolInfo(typeChecker, symbol, node), symbolName = _a.symbolName, symbolKind = _a.symbolKind, containerName = _a.containerName;\n            if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) &&\n                !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) {\n                ts.forEach(declarations, function (declaration) {\n                    result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName));\n                });\n            }\n            return result;\n            function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) {\n                if (ts.isNewExpressionTarget(location) || location.kind === 122) {\n                    if (symbol.flags & 32) {\n                        for (var _i = 0, _a = symbol.getDeclarations(); _i < _a.length; _i++) {\n                            var declaration = _a[_i];\n                            if (ts.isClassLike(declaration)) {\n                                return tryAddSignature(declaration.members, true, symbolKind, symbolName, containerName, result);\n                            }\n                        }\n                        ts.Debug.fail(\"Expected declaration to have at least one class-like declaration\");\n                    }\n                }\n                return false;\n            }\n            function tryAddCallSignature(symbol, location, symbolKind, symbolName, containerName, result) {\n                if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location) || ts.isNameOfFunctionDeclaration(location)) {\n                    return tryAddSignature(symbol.declarations, false, symbolKind, symbolName, containerName, result);\n                }\n                return false;\n            }\n            function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) {\n                var declarations = [];\n                var definition;\n                ts.forEach(signatureDeclarations, function (d) {\n                    if ((selectConstructors && d.kind === 150) ||\n                        (!selectConstructors && (d.kind === 225 || d.kind === 149 || d.kind === 148))) {\n                        declarations.push(d);\n                        if (d.body)\n                            definition = d;\n                    }\n                });\n                if (definition) {\n                    result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName));\n                    return true;\n                }\n                else if (declarations.length) {\n                    result.push(createDefinitionInfo(ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName));\n                    return true;\n                }\n                return false;\n            }\n        }\n        function createDefinitionInfo(node, symbolKind, symbolName, containerName) {\n            return {\n                fileName: node.getSourceFile().fileName,\n                textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()),\n                kind: symbolKind,\n                name: symbolName,\n                containerKind: undefined,\n                containerName: containerName\n            };\n        }\n        function getSymbolInfo(typeChecker, symbol, node) {\n            return {\n                symbolName: typeChecker.symbolToString(symbol),\n                symbolKind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node),\n                containerName: symbol.parent ? typeChecker.symbolToString(symbol.parent, node) : \"\"\n            };\n        }\n        function createDefinitionFromSignatureDeclaration(typeChecker, decl) {\n            var _a = getSymbolInfo(typeChecker, decl.symbol, decl), symbolName = _a.symbolName, symbolKind = _a.symbolKind, containerName = _a.containerName;\n            return createDefinitionInfo(decl, symbolKind, symbolName, containerName);\n        }\n        function findReferenceInPosition(refs, pos) {\n            for (var _i = 0, refs_1 = refs; _i < refs_1.length; _i++) {\n                var ref = refs_1[_i];\n                if (ref.pos <= pos && pos < ref.end) {\n                    return ref;\n                }\n            }\n            return undefined;\n        }\n        function getDefinitionInfoForFileReference(name, targetFileName) {\n            return {\n                fileName: targetFileName,\n                textSpan: ts.createTextSpanFromBounds(0, 0),\n                kind: ts.ScriptElementKind.scriptElement,\n                name: name,\n                containerName: undefined,\n                containerKind: undefined\n            };\n        }\n        function getAncestorCallLikeExpression(node) {\n            var target = climbPastManyPropertyAccesses(node);\n            var callLike = target.parent;\n            return callLike && ts.isCallLikeExpression(callLike) && ts.getInvokedExpression(callLike) === target && callLike;\n        }\n        function climbPastManyPropertyAccesses(node) {\n            return ts.isRightSideOfPropertyAccess(node) ? climbPastManyPropertyAccesses(node.parent) : node;\n        }\n        function tryGetSignatureDeclaration(typeChecker, node) {\n            var callLike = getAncestorCallLikeExpression(node);\n            return callLike && typeChecker.getResolvedSignature(callLike).declaration;\n        }\n    })(GoToDefinition = ts.GoToDefinition || (ts.GoToDefinition = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var GoToImplementation;\n    (function (GoToImplementation) {\n        function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) {\n            if (node.parent.kind === 258) {\n                var result = [];\n                ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result);\n                return result.length > 0 ? result : undefined;\n            }\n            else if (node.kind === 96 || ts.isSuperProperty(node.parent)) {\n                var symbol = typeChecker.getSymbolAtLocation(node);\n                return symbol.valueDeclaration && [ts.FindAllReferences.getReferenceEntryFromNode(symbol.valueDeclaration)];\n            }\n            else {\n                var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, false, false, true);\n                var result = ts.flatMap(referencedSymbols, function (symbol) {\n                    return ts.map(symbol.references, function (_a) {\n                        var textSpan = _a.textSpan, fileName = _a.fileName;\n                        return ({ textSpan: textSpan, fileName: fileName });\n                    });\n                });\n                return result && result.length > 0 ? result : undefined;\n            }\n        }\n        GoToImplementation.getImplementationAtPosition = getImplementationAtPosition;\n    })(GoToImplementation = ts.GoToImplementation || (ts.GoToImplementation = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var JsDoc;\n    (function (JsDoc) {\n        var jsDocTagNames = [\n            \"augments\",\n            \"author\",\n            \"argument\",\n            \"borrows\",\n            \"class\",\n            \"constant\",\n            \"constructor\",\n            \"constructs\",\n            \"default\",\n            \"deprecated\",\n            \"description\",\n            \"event\",\n            \"example\",\n            \"extends\",\n            \"field\",\n            \"fileOverview\",\n            \"function\",\n            \"ignore\",\n            \"inner\",\n            \"lends\",\n            \"link\",\n            \"memberOf\",\n            \"name\",\n            \"namespace\",\n            \"param\",\n            \"private\",\n            \"property\",\n            \"public\",\n            \"requires\",\n            \"returns\",\n            \"see\",\n            \"since\",\n            \"static\",\n            \"throws\",\n            \"type\",\n            \"typedef\",\n            \"property\",\n            \"prop\",\n            \"version\"\n        ];\n        var jsDocCompletionEntries;\n        function getJsDocCommentsFromDeclarations(declarations) {\n            var documentationComment = [];\n            forEachUnique(declarations, function (declaration) {\n                var comments = ts.getCommentsFromJSDoc(declaration);\n                if (!comments) {\n                    return;\n                }\n                for (var _i = 0, comments_3 = comments; _i < comments_3.length; _i++) {\n                    var comment = comments_3[_i];\n                    if (comment) {\n                        if (documentationComment.length) {\n                            documentationComment.push(ts.lineBreakPart());\n                        }\n                        documentationComment.push(ts.textPart(comment));\n                    }\n                }\n            });\n            return documentationComment;\n        }\n        JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations;\n        function forEachUnique(array, callback) {\n            if (array) {\n                for (var i = 0, len = array.length; i < len; i++) {\n                    if (ts.indexOf(array, array[i]) === i) {\n                        var result = callback(array[i], i);\n                        if (result) {\n                            return result;\n                        }\n                    }\n                }\n            }\n            return undefined;\n        }\n        function getAllJsDocCompletionEntries() {\n            return jsDocCompletionEntries || (jsDocCompletionEntries = ts.map(jsDocTagNames, function (tagName) {\n                return {\n                    name: tagName,\n                    kind: ts.ScriptElementKind.keyword,\n                    kindModifiers: \"\",\n                    sortText: \"0\",\n                };\n            }));\n        }\n        JsDoc.getAllJsDocCompletionEntries = getAllJsDocCompletionEntries;\n        function getDocCommentTemplateAtPosition(newLine, sourceFile, position) {\n            if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) {\n                return undefined;\n            }\n            var tokenAtPos = ts.getTokenAtPosition(sourceFile, position);\n            var tokenStart = tokenAtPos.getStart();\n            if (!tokenAtPos || tokenStart < position) {\n                return undefined;\n            }\n            var commentOwner;\n            findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) {\n                switch (commentOwner.kind) {\n                    case 225:\n                    case 149:\n                    case 150:\n                    case 226:\n                    case 205:\n                        break findOwner;\n                    case 261:\n                        return undefined;\n                    case 230:\n                        if (commentOwner.parent.kind === 230) {\n                            return undefined;\n                        }\n                        break findOwner;\n                }\n            }\n            if (!commentOwner || commentOwner.getStart() < position) {\n                return undefined;\n            }\n            var parameters = getParametersForJsDocOwningNode(commentOwner);\n            var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position);\n            var lineStart = sourceFile.getLineStarts()[posLineAndChar.line];\n            var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character);\n            var docParams = \"\";\n            for (var i = 0, numParams = parameters.length; i < numParams; i++) {\n                var currentName = parameters[i].name;\n                var paramName = currentName.kind === 70 ?\n                    currentName.text :\n                    \"param\" + i;\n                docParams += indentationStr + \" * @param \" + paramName + newLine;\n            }\n            var preamble = \"/**\" + newLine +\n                indentationStr + \" * \";\n            var result = preamble + newLine +\n                docParams +\n                indentationStr + \" */\" +\n                (tokenStart === position ? newLine + indentationStr : \"\");\n            return { newText: result, caretOffset: preamble.length };\n        }\n        JsDoc.getDocCommentTemplateAtPosition = getDocCommentTemplateAtPosition;\n        function getParametersForJsDocOwningNode(commentOwner) {\n            if (ts.isFunctionLike(commentOwner)) {\n                return commentOwner.parameters;\n            }\n            if (commentOwner.kind === 205) {\n                var varStatement = commentOwner;\n                var varDeclarations = varStatement.declarationList.declarations;\n                if (varDeclarations.length === 1 && varDeclarations[0].initializer) {\n                    return getParametersFromRightHandSideOfAssignment(varDeclarations[0].initializer);\n                }\n            }\n            return ts.emptyArray;\n        }\n        function getParametersFromRightHandSideOfAssignment(rightHandSide) {\n            while (rightHandSide.kind === 183) {\n                rightHandSide = rightHandSide.expression;\n            }\n            switch (rightHandSide.kind) {\n                case 184:\n                case 185:\n                    return rightHandSide.parameters;\n                case 197:\n                    for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) {\n                        var member = _a[_i];\n                        if (member.kind === 150) {\n                            return member.parameters;\n                        }\n                    }\n                    break;\n            }\n            return ts.emptyArray;\n        }\n    })(JsDoc = ts.JsDoc || (ts.JsDoc = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var NavigateTo;\n    (function (NavigateTo) {\n        function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) {\n            var patternMatcher = ts.createPatternMatcher(searchValue);\n            var rawItems = [];\n            ts.forEach(sourceFiles, function (sourceFile) {\n                cancellationToken.throwIfCancellationRequested();\n                if (excludeDtsFiles && ts.fileExtensionIs(sourceFile.fileName, \".d.ts\")) {\n                    return;\n                }\n                var nameToDeclarations = sourceFile.getNamedDeclarations();\n                for (var name_47 in nameToDeclarations) {\n                    var declarations = nameToDeclarations[name_47];\n                    if (declarations) {\n                        var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_47);\n                        if (!matches) {\n                            continue;\n                        }\n                        for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {\n                            var declaration = declarations_9[_i];\n                            if (patternMatcher.patternContainsDots) {\n                                var containers = getContainers(declaration);\n                                if (!containers) {\n                                    return undefined;\n                                }\n                                matches = patternMatcher.getMatches(containers, name_47);\n                                if (!matches) {\n                                    continue;\n                                }\n                            }\n                            var fileName = sourceFile.fileName;\n                            var matchKind = bestMatchKind(matches);\n                            rawItems.push({ name: name_47, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });\n                        }\n                    }\n                }\n            });\n            rawItems = ts.filter(rawItems, function (item) {\n                var decl = item.declaration;\n                if (decl.kind === 236 || decl.kind === 239 || decl.kind === 234) {\n                    var importer = checker.getSymbolAtLocation(decl.name);\n                    var imported = checker.getAliasedSymbol(importer);\n                    return importer.name !== imported.name;\n                }\n                else {\n                    return true;\n                }\n            });\n            rawItems.sort(compareNavigateToItems);\n            if (maxResultCount !== undefined) {\n                rawItems = rawItems.slice(0, maxResultCount);\n            }\n            var items = ts.map(rawItems, createNavigateToItem);\n            return items;\n            function allMatchesAreCaseSensitive(matches) {\n                ts.Debug.assert(matches.length > 0);\n                for (var _i = 0, matches_2 = matches; _i < matches_2.length; _i++) {\n                    var match = matches_2[_i];\n                    if (!match.isCaseSensitive) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            function getTextOfIdentifierOrLiteral(node) {\n                if (node) {\n                    if (node.kind === 70 ||\n                        node.kind === 9 ||\n                        node.kind === 8) {\n                        return node.text;\n                    }\n                }\n                return undefined;\n            }\n            function tryAddSingleDeclarationName(declaration, containers) {\n                if (declaration && declaration.name) {\n                    var text = getTextOfIdentifierOrLiteral(declaration.name);\n                    if (text !== undefined) {\n                        containers.unshift(text);\n                    }\n                    else if (declaration.name.kind === 142) {\n                        return tryAddComputedPropertyName(declaration.name.expression, containers, true);\n                    }\n                    else {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            function tryAddComputedPropertyName(expression, containers, includeLastPortion) {\n                var text = getTextOfIdentifierOrLiteral(expression);\n                if (text !== undefined) {\n                    if (includeLastPortion) {\n                        containers.unshift(text);\n                    }\n                    return true;\n                }\n                if (expression.kind === 177) {\n                    var propertyAccess = expression;\n                    if (includeLastPortion) {\n                        containers.unshift(propertyAccess.name.text);\n                    }\n                    return tryAddComputedPropertyName(propertyAccess.expression, containers, true);\n                }\n                return false;\n            }\n            function getContainers(declaration) {\n                var containers = [];\n                if (declaration.name.kind === 142) {\n                    if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) {\n                        return undefined;\n                    }\n                }\n                declaration = ts.getContainerNode(declaration);\n                while (declaration) {\n                    if (!tryAddSingleDeclarationName(declaration, containers)) {\n                        return undefined;\n                    }\n                    declaration = ts.getContainerNode(declaration);\n                }\n                return containers;\n            }\n            function bestMatchKind(matches) {\n                ts.Debug.assert(matches.length > 0);\n                var bestMatchKind = ts.PatternMatchKind.camelCase;\n                for (var _i = 0, matches_3 = matches; _i < matches_3.length; _i++) {\n                    var match = matches_3[_i];\n                    var kind = match.kind;\n                    if (kind < bestMatchKind) {\n                        bestMatchKind = kind;\n                    }\n                }\n                return bestMatchKind;\n            }\n            function compareNavigateToItems(i1, i2) {\n                return i1.matchKind - i2.matchKind ||\n                    ts.compareStringsCaseInsensitive(i1.name, i2.name) ||\n                    ts.compareStrings(i1.name, i2.name);\n            }\n            function createNavigateToItem(rawItem) {\n                var declaration = rawItem.declaration;\n                var container = ts.getContainerNode(declaration);\n                return {\n                    name: rawItem.name,\n                    kind: ts.getNodeKind(declaration),\n                    kindModifiers: ts.getNodeModifiers(declaration),\n                    matchKind: ts.PatternMatchKind[rawItem.matchKind],\n                    isCaseSensitive: rawItem.isCaseSensitive,\n                    fileName: rawItem.fileName,\n                    textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()),\n                    containerName: container && container.name ? container.name.text : \"\",\n                    containerKind: container && container.name ? ts.getNodeKind(container) : \"\"\n                };\n            }\n        }\n        NavigateTo.getNavigateToItems = getNavigateToItems;\n    })(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var NavigationBar;\n    (function (NavigationBar) {\n        function getNavigationBarItems(sourceFile) {\n            curSourceFile = sourceFile;\n            var result = ts.map(topLevelItems(rootNavigationBarNode(sourceFile)), convertToTopLevelItem);\n            curSourceFile = undefined;\n            return result;\n        }\n        NavigationBar.getNavigationBarItems = getNavigationBarItems;\n        function getNavigationTree(sourceFile) {\n            curSourceFile = sourceFile;\n            var result = convertToTree(rootNavigationBarNode(sourceFile));\n            curSourceFile = undefined;\n            return result;\n        }\n        NavigationBar.getNavigationTree = getNavigationTree;\n        var curSourceFile;\n        function nodeText(node) {\n            return node.getText(curSourceFile);\n        }\n        function navigationBarNodeKind(n) {\n            return n.node.kind;\n        }\n        function pushChild(parent, child) {\n            if (parent.children) {\n                parent.children.push(child);\n            }\n            else {\n                parent.children = [child];\n            }\n        }\n        var parentsStack = [];\n        var parent;\n        function rootNavigationBarNode(sourceFile) {\n            ts.Debug.assert(!parentsStack.length);\n            var root = { node: sourceFile, additionalNodes: undefined, parent: undefined, children: undefined, indent: 0 };\n            parent = root;\n            for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {\n                var statement = _a[_i];\n                addChildrenRecursively(statement);\n            }\n            endNode();\n            ts.Debug.assert(!parent && !parentsStack.length);\n            return root;\n        }\n        function addLeafNode(node) {\n            pushChild(parent, emptyNavigationBarNode(node));\n        }\n        function emptyNavigationBarNode(node) {\n            return {\n                node: node,\n                additionalNodes: undefined,\n                parent: parent,\n                children: undefined,\n                indent: parent.indent + 1\n            };\n        }\n        function startNode(node) {\n            var navNode = emptyNavigationBarNode(node);\n            pushChild(parent, navNode);\n            parentsStack.push(parent);\n            parent = navNode;\n        }\n        function endNode() {\n            if (parent.children) {\n                mergeChildren(parent.children);\n                sortChildren(parent.children);\n            }\n            parent = parentsStack.pop();\n        }\n        function addNodeWithRecursiveChild(node, child) {\n            startNode(node);\n            addChildrenRecursively(child);\n            endNode();\n        }\n        function addChildrenRecursively(node) {\n            if (!node || ts.isToken(node)) {\n                return;\n            }\n            switch (node.kind) {\n                case 150:\n                    var ctr = node;\n                    addNodeWithRecursiveChild(ctr, ctr.body);\n                    for (var _i = 0, _a = ctr.parameters; _i < _a.length; _i++) {\n                        var param = _a[_i];\n                        if (ts.isParameterPropertyDeclaration(param)) {\n                            addLeafNode(param);\n                        }\n                    }\n                    break;\n                case 149:\n                case 151:\n                case 152:\n                case 148:\n                    if (!ts.hasDynamicName(node)) {\n                        addNodeWithRecursiveChild(node, node.body);\n                    }\n                    break;\n                case 147:\n                case 146:\n                    if (!ts.hasDynamicName(node)) {\n                        addLeafNode(node);\n                    }\n                    break;\n                case 236:\n                    var importClause = node;\n                    if (importClause.name) {\n                        addLeafNode(importClause);\n                    }\n                    var namedBindings = importClause.namedBindings;\n                    if (namedBindings) {\n                        if (namedBindings.kind === 237) {\n                            addLeafNode(namedBindings);\n                        }\n                        else {\n                            for (var _b = 0, _c = namedBindings.elements; _b < _c.length; _b++) {\n                                var element = _c[_b];\n                                addLeafNode(element);\n                            }\n                        }\n                    }\n                    break;\n                case 174:\n                case 223:\n                    var decl = node;\n                    var name_48 = decl.name;\n                    if (ts.isBindingPattern(name_48)) {\n                        addChildrenRecursively(name_48);\n                    }\n                    else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) {\n                        addChildrenRecursively(decl.initializer);\n                    }\n                    else {\n                        addNodeWithRecursiveChild(decl, decl.initializer);\n                    }\n                    break;\n                case 185:\n                case 225:\n                case 184:\n                    addNodeWithRecursiveChild(node, node.body);\n                    break;\n                case 229:\n                    startNode(node);\n                    for (var _d = 0, _e = node.members; _d < _e.length; _d++) {\n                        var member = _e[_d];\n                        if (!isComputedProperty(member)) {\n                            addLeafNode(member);\n                        }\n                    }\n                    endNode();\n                    break;\n                case 226:\n                case 197:\n                case 227:\n                    startNode(node);\n                    for (var _f = 0, _g = node.members; _f < _g.length; _f++) {\n                        var member = _g[_f];\n                        addChildrenRecursively(member);\n                    }\n                    endNode();\n                    break;\n                case 230:\n                    addNodeWithRecursiveChild(node, getInteriorModule(node).body);\n                    break;\n                case 243:\n                case 234:\n                case 155:\n                case 153:\n                case 154:\n                case 228:\n                    addLeafNode(node);\n                    break;\n                default:\n                    ts.forEach(node.jsDoc, function (jsDoc) {\n                        ts.forEach(jsDoc.tags, function (tag) {\n                            if (tag.kind === 285) {\n                                addLeafNode(tag);\n                            }\n                        });\n                    });\n                    ts.forEachChild(node, addChildrenRecursively);\n            }\n        }\n        function mergeChildren(children) {\n            var nameToItems = ts.createMap();\n            ts.filterMutate(children, function (child) {\n                var decl = child.node;\n                var name = decl.name && nodeText(decl.name);\n                if (!name) {\n                    return true;\n                }\n                var itemsWithSameName = nameToItems[name];\n                if (!itemsWithSameName) {\n                    nameToItems[name] = child;\n                    return true;\n                }\n                if (itemsWithSameName instanceof Array) {\n                    for (var _i = 0, itemsWithSameName_1 = itemsWithSameName; _i < itemsWithSameName_1.length; _i++) {\n                        var itemWithSameName = itemsWithSameName_1[_i];\n                        if (tryMerge(itemWithSameName, child)) {\n                            return false;\n                        }\n                    }\n                    itemsWithSameName.push(child);\n                    return true;\n                }\n                else {\n                    var itemWithSameName = itemsWithSameName;\n                    if (tryMerge(itemWithSameName, child)) {\n                        return false;\n                    }\n                    nameToItems[name] = [itemWithSameName, child];\n                    return true;\n                }\n                function tryMerge(a, b) {\n                    if (shouldReallyMerge(a.node, b.node)) {\n                        merge(a, b);\n                        return true;\n                    }\n                    return false;\n                }\n            });\n            function shouldReallyMerge(a, b) {\n                return a.kind === b.kind && (a.kind !== 230 || areSameModule(a, b));\n                function areSameModule(a, b) {\n                    if (a.body.kind !== b.body.kind) {\n                        return false;\n                    }\n                    if (a.body.kind !== 230) {\n                        return true;\n                    }\n                    return areSameModule(a.body, b.body);\n                }\n            }\n            function merge(target, source) {\n                target.additionalNodes = target.additionalNodes || [];\n                target.additionalNodes.push(source.node);\n                if (source.additionalNodes) {\n                    (_a = target.additionalNodes).push.apply(_a, source.additionalNodes);\n                }\n                target.children = ts.concatenate(target.children, source.children);\n                if (target.children) {\n                    mergeChildren(target.children);\n                    sortChildren(target.children);\n                }\n                var _a;\n            }\n        }\n        function sortChildren(children) {\n            children.sort(compareChildren);\n        }\n        function compareChildren(child1, child2) {\n            var name1 = tryGetName(child1.node), name2 = tryGetName(child2.node);\n            if (name1 && name2) {\n                var cmp = localeCompareFix(name1, name2);\n                return cmp !== 0 ? cmp : navigationBarNodeKind(child1) - navigationBarNodeKind(child2);\n            }\n            else {\n                return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2);\n            }\n        }\n        var localeCompareIsCorrect = ts.collator && ts.collator.compare(\"a\", \"B\") < 0;\n        var localeCompareFix = localeCompareIsCorrect ? ts.collator.compare : function (a, b) {\n            for (var i = 0; i < Math.min(a.length, b.length); i++) {\n                var chA = a.charAt(i), chB = b.charAt(i);\n                if (chA === \"\\\"\" && chB === \"'\") {\n                    return 1;\n                }\n                if (chA === \"'\" && chB === \"\\\"\") {\n                    return -1;\n                }\n                var cmp = ts.compareStrings(chA.toLocaleLowerCase(), chB.toLocaleLowerCase());\n                if (cmp !== 0) {\n                    return cmp;\n                }\n            }\n            return a.length - b.length;\n        };\n        function tryGetName(node) {\n            if (node.kind === 230) {\n                return getModuleName(node);\n            }\n            var decl = node;\n            if (decl.name) {\n                return ts.getPropertyNameForPropertyNameNode(decl.name);\n            }\n            switch (node.kind) {\n                case 184:\n                case 185:\n                case 197:\n                    return getFunctionOrClassName(node);\n                case 285:\n                    return getJSDocTypedefTagName(node);\n                default:\n                    return undefined;\n            }\n        }\n        function getItemName(node) {\n            if (node.kind === 230) {\n                return getModuleName(node);\n            }\n            var name = node.name;\n            if (name) {\n                var text = nodeText(name);\n                if (text.length > 0) {\n                    return text;\n                }\n            }\n            switch (node.kind) {\n                case 261:\n                    var sourceFile = node;\n                    return ts.isExternalModule(sourceFile)\n                        ? \"\\\"\" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + \"\\\"\"\n                        : \"<global>\";\n                case 185:\n                case 225:\n                case 184:\n                case 226:\n                case 197:\n                    if (ts.getModifierFlags(node) & 512) {\n                        return \"default\";\n                    }\n                    return getFunctionOrClassName(node);\n                case 150:\n                    return \"constructor\";\n                case 154:\n                    return \"new()\";\n                case 153:\n                    return \"()\";\n                case 155:\n                    return \"[]\";\n                case 285:\n                    return getJSDocTypedefTagName(node);\n                default:\n                    return \"<unknown>\";\n            }\n        }\n        function getJSDocTypedefTagName(node) {\n            if (node.name) {\n                return node.name.text;\n            }\n            else {\n                var parentNode = node.parent && node.parent.parent;\n                if (parentNode && parentNode.kind === 205) {\n                    if (parentNode.declarationList.declarations.length > 0) {\n                        var nameIdentifier = parentNode.declarationList.declarations[0].name;\n                        if (nameIdentifier.kind === 70) {\n                            return nameIdentifier.text;\n                        }\n                    }\n                }\n                return \"<typedef>\";\n            }\n        }\n        function topLevelItems(root) {\n            var topLevel = [];\n            function recur(item) {\n                if (isTopLevel(item)) {\n                    topLevel.push(item);\n                    if (item.children) {\n                        for (var _i = 0, _a = item.children; _i < _a.length; _i++) {\n                            var child = _a[_i];\n                            recur(child);\n                        }\n                    }\n                }\n            }\n            recur(root);\n            return topLevel;\n            function isTopLevel(item) {\n                switch (navigationBarNodeKind(item)) {\n                    case 226:\n                    case 197:\n                    case 229:\n                    case 227:\n                    case 230:\n                    case 261:\n                    case 228:\n                    case 285:\n                        return true;\n                    case 150:\n                    case 149:\n                    case 151:\n                    case 152:\n                    case 223:\n                        return hasSomeImportantChild(item);\n                    case 185:\n                    case 225:\n                    case 184:\n                        return isTopLevelFunctionDeclaration(item);\n                    default:\n                        return false;\n                }\n                function isTopLevelFunctionDeclaration(item) {\n                    if (!item.node.body) {\n                        return false;\n                    }\n                    switch (navigationBarNodeKind(item.parent)) {\n                        case 231:\n                        case 261:\n                        case 149:\n                        case 150:\n                            return true;\n                        default:\n                            return hasSomeImportantChild(item);\n                    }\n                }\n                function hasSomeImportantChild(item) {\n                    return ts.forEach(item.children, function (child) {\n                        var childKind = navigationBarNodeKind(child);\n                        return childKind !== 223 && childKind !== 174;\n                    });\n                }\n            }\n        }\n        var emptyChildItemArray = [];\n        function convertToTree(n) {\n            return {\n                text: getItemName(n.node),\n                kind: ts.getNodeKind(n.node),\n                kindModifiers: ts.getNodeModifiers(n.node),\n                spans: getSpans(n),\n                childItems: ts.map(n.children, convertToTree)\n            };\n        }\n        function convertToTopLevelItem(n) {\n            return {\n                text: getItemName(n.node),\n                kind: ts.getNodeKind(n.node),\n                kindModifiers: ts.getNodeModifiers(n.node),\n                spans: getSpans(n),\n                childItems: ts.map(n.children, convertToChildItem) || emptyChildItemArray,\n                indent: n.indent,\n                bolded: false,\n                grayed: false\n            };\n            function convertToChildItem(n) {\n                return {\n                    text: getItemName(n.node),\n                    kind: ts.getNodeKind(n.node),\n                    kindModifiers: ts.getNodeModifiers(n.node),\n                    spans: getSpans(n),\n                    childItems: emptyChildItemArray,\n                    indent: 0,\n                    bolded: false,\n                    grayed: false\n                };\n            }\n        }\n        function getSpans(n) {\n            var spans = [getNodeSpan(n.node)];\n            if (n.additionalNodes) {\n                for (var _i = 0, _a = n.additionalNodes; _i < _a.length; _i++) {\n                    var node = _a[_i];\n                    spans.push(getNodeSpan(node));\n                }\n            }\n            return spans;\n        }\n        function getModuleName(moduleDeclaration) {\n            if (ts.isAmbientModule(moduleDeclaration)) {\n                return ts.getTextOfNode(moduleDeclaration.name);\n            }\n            var result = [];\n            result.push(moduleDeclaration.name.text);\n            while (moduleDeclaration.body && moduleDeclaration.body.kind === 230) {\n                moduleDeclaration = moduleDeclaration.body;\n                result.push(moduleDeclaration.name.text);\n            }\n            return result.join(\".\");\n        }\n        function getInteriorModule(decl) {\n            return decl.body.kind === 230 ? getInteriorModule(decl.body) : decl;\n        }\n        function isComputedProperty(member) {\n            return !member.name || member.name.kind === 142;\n        }\n        function getNodeSpan(node) {\n            return node.kind === 261\n                ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd())\n                : ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd());\n        }\n        function getFunctionOrClassName(node) {\n            if (node.name && ts.getFullWidth(node.name) > 0) {\n                return ts.declarationNameToString(node.name);\n            }\n            else if (node.parent.kind === 223) {\n                return ts.declarationNameToString(node.parent.name);\n            }\n            else if (node.parent.kind === 192 &&\n                node.parent.operatorToken.kind === 57) {\n                return nodeText(node.parent.left).replace(whiteSpaceRegex, \"\");\n            }\n            else if (node.parent.kind === 257 && node.parent.name) {\n                return nodeText(node.parent.name);\n            }\n            else if (ts.getModifierFlags(node) & 512) {\n                return \"default\";\n            }\n            else {\n                return ts.isClassLike(node) ? \"<class>\" : \"<function>\";\n            }\n        }\n        function isFunctionOrClassExpression(node) {\n            return node.kind === 184 || node.kind === 185 || node.kind === 197;\n        }\n        var whiteSpaceRegex = /\\s+/g;\n    })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var OutliningElementsCollector;\n    (function (OutliningElementsCollector) {\n        function collectElements(sourceFile) {\n            var elements = [];\n            var collapseText = \"...\";\n            function addOutliningSpan(hintSpanNode, startElement, endElement, autoCollapse) {\n                if (hintSpanNode && startElement && endElement) {\n                    var span_12 = {\n                        textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end),\n                        hintSpan: ts.createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end),\n                        bannerText: collapseText,\n                        autoCollapse: autoCollapse\n                    };\n                    elements.push(span_12);\n                }\n            }\n            function addOutliningSpanComments(commentSpan, autoCollapse) {\n                if (commentSpan) {\n                    var span_13 = {\n                        textSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end),\n                        hintSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end),\n                        bannerText: collapseText,\n                        autoCollapse: autoCollapse\n                    };\n                    elements.push(span_13);\n                }\n            }\n            function addOutliningForLeadingCommentsForNode(n) {\n                var comments = ts.getLeadingCommentRangesOfNode(n, sourceFile);\n                if (comments) {\n                    var firstSingleLineCommentStart = -1;\n                    var lastSingleLineCommentEnd = -1;\n                    var isFirstSingleLineComment = true;\n                    var singleLineCommentCount = 0;\n                    for (var _i = 0, comments_4 = comments; _i < comments_4.length; _i++) {\n                        var currentComment = comments_4[_i];\n                        if (currentComment.kind === 2) {\n                            if (isFirstSingleLineComment) {\n                                firstSingleLineCommentStart = currentComment.pos;\n                            }\n                            isFirstSingleLineComment = false;\n                            lastSingleLineCommentEnd = currentComment.end;\n                            singleLineCommentCount++;\n                        }\n                        else if (currentComment.kind === 3) {\n                            combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd);\n                            addOutliningSpanComments(currentComment, false);\n                            singleLineCommentCount = 0;\n                            lastSingleLineCommentEnd = -1;\n                            isFirstSingleLineComment = true;\n                        }\n                    }\n                    combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd);\n                }\n            }\n            function combineAndAddMultipleSingleLineComments(count, start, end) {\n                if (count > 1) {\n                    var multipleSingleLineComments = {\n                        pos: start,\n                        end: end,\n                        kind: 2\n                    };\n                    addOutliningSpanComments(multipleSingleLineComments, false);\n                }\n            }\n            function autoCollapse(node) {\n                return ts.isFunctionBlock(node) && node.parent.kind !== 185;\n            }\n            var depth = 0;\n            var maxDepth = 20;\n            function walk(n) {\n                if (depth > maxDepth) {\n                    return;\n                }\n                if (ts.isDeclaration(n)) {\n                    addOutliningForLeadingCommentsForNode(n);\n                }\n                switch (n.kind) {\n                    case 204:\n                        if (!ts.isFunctionBlock(n)) {\n                            var parent_19 = n.parent;\n                            var openBrace = ts.findChildOfKind(n, 16, sourceFile);\n                            var closeBrace = ts.findChildOfKind(n, 17, sourceFile);\n                            if (parent_19.kind === 209 ||\n                                parent_19.kind === 212 ||\n                                parent_19.kind === 213 ||\n                                parent_19.kind === 211 ||\n                                parent_19.kind === 208 ||\n                                parent_19.kind === 210 ||\n                                parent_19.kind === 217 ||\n                                parent_19.kind === 256) {\n                                addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n));\n                                break;\n                            }\n                            if (parent_19.kind === 221) {\n                                var tryStatement = parent_19;\n                                if (tryStatement.tryBlock === n) {\n                                    addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n));\n                                    break;\n                                }\n                                else if (tryStatement.finallyBlock === n) {\n                                    var finallyKeyword = ts.findChildOfKind(tryStatement, 86, sourceFile);\n                                    if (finallyKeyword) {\n                                        addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n));\n                                        break;\n                                    }\n                                }\n                            }\n                            var span_14 = ts.createTextSpanFromBounds(n.getStart(), n.end);\n                            elements.push({\n                                textSpan: span_14,\n                                hintSpan: span_14,\n                                bannerText: collapseText,\n                                autoCollapse: autoCollapse(n)\n                            });\n                            break;\n                        }\n                    case 231: {\n                        var openBrace = ts.findChildOfKind(n, 16, sourceFile);\n                        var closeBrace = ts.findChildOfKind(n, 17, sourceFile);\n                        addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n));\n                        break;\n                    }\n                    case 226:\n                    case 227:\n                    case 229:\n                    case 176:\n                    case 232: {\n                        var openBrace = ts.findChildOfKind(n, 16, sourceFile);\n                        var closeBrace = ts.findChildOfKind(n, 17, sourceFile);\n                        addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n));\n                        break;\n                    }\n                    case 175:\n                        var openBracket = ts.findChildOfKind(n, 20, sourceFile);\n                        var closeBracket = ts.findChildOfKind(n, 21, sourceFile);\n                        addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n));\n                        break;\n                }\n                depth++;\n                ts.forEachChild(n, walk);\n                depth--;\n            }\n            walk(sourceFile);\n            return elements;\n        }\n        OutliningElementsCollector.collectElements = collectElements;\n    })(OutliningElementsCollector = ts.OutliningElementsCollector || (ts.OutliningElementsCollector = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var PatternMatchKind;\n    (function (PatternMatchKind) {\n        PatternMatchKind[PatternMatchKind[\"exact\"] = 0] = \"exact\";\n        PatternMatchKind[PatternMatchKind[\"prefix\"] = 1] = \"prefix\";\n        PatternMatchKind[PatternMatchKind[\"substring\"] = 2] = \"substring\";\n        PatternMatchKind[PatternMatchKind[\"camelCase\"] = 3] = \"camelCase\";\n    })(PatternMatchKind = ts.PatternMatchKind || (ts.PatternMatchKind = {}));\n    function createPatternMatch(kind, punctuationStripped, isCaseSensitive, camelCaseWeight) {\n        return {\n            kind: kind,\n            punctuationStripped: punctuationStripped,\n            isCaseSensitive: isCaseSensitive,\n            camelCaseWeight: camelCaseWeight\n        };\n    }\n    function createPatternMatcher(pattern) {\n        var stringToWordSpans = ts.createMap();\n        pattern = pattern.trim();\n        var dotSeparatedSegments = pattern.split(\".\").map(function (p) { return createSegment(p.trim()); });\n        var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid);\n        return {\n            getMatches: getMatches,\n            getMatchesForLastSegmentOfPattern: getMatchesForLastSegmentOfPattern,\n            patternContainsDots: dotSeparatedSegments.length > 1\n        };\n        function skipMatch(candidate) {\n            return invalidPattern || !candidate;\n        }\n        function getMatchesForLastSegmentOfPattern(candidate) {\n            if (skipMatch(candidate)) {\n                return undefined;\n            }\n            return matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments));\n        }\n        function getMatches(candidateContainers, candidate) {\n            if (skipMatch(candidate)) {\n                return undefined;\n            }\n            var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments));\n            if (!candidateMatch) {\n                return undefined;\n            }\n            candidateContainers = candidateContainers || [];\n            if (dotSeparatedSegments.length - 1 > candidateContainers.length) {\n                return undefined;\n            }\n            var totalMatch = candidateMatch;\n            for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) {\n                var segment = dotSeparatedSegments[i];\n                var containerName = candidateContainers[j];\n                var containerMatch = matchSegment(containerName, segment);\n                if (!containerMatch) {\n                    return undefined;\n                }\n                ts.addRange(totalMatch, containerMatch);\n            }\n            return totalMatch;\n        }\n        function getWordSpans(word) {\n            if (!(word in stringToWordSpans)) {\n                stringToWordSpans[word] = breakIntoWordSpans(word);\n            }\n            return stringToWordSpans[word];\n        }\n        function matchTextChunk(candidate, chunk, punctuationStripped) {\n            var index = indexOfIgnoringCase(candidate, chunk.textLowerCase);\n            if (index === 0) {\n                if (chunk.text.length === candidate.length) {\n                    return createPatternMatch(PatternMatchKind.exact, punctuationStripped, candidate === chunk.text);\n                }\n                else {\n                    return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, ts.startsWith(candidate, chunk.text));\n                }\n            }\n            var isLowercase = chunk.isLowerCase;\n            if (isLowercase) {\n                if (index > 0) {\n                    var wordSpans = getWordSpans(candidate);\n                    for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) {\n                        var span_15 = wordSpans_1[_i];\n                        if (partStartsWith(candidate, span_15, chunk.text, true)) {\n                            return createPatternMatch(PatternMatchKind.substring, punctuationStripped, partStartsWith(candidate, span_15, chunk.text, false));\n                        }\n                    }\n                }\n            }\n            else {\n                if (candidate.indexOf(chunk.text) > 0) {\n                    return createPatternMatch(PatternMatchKind.substring, punctuationStripped, true);\n                }\n            }\n            if (!isLowercase) {\n                if (chunk.characterSpans.length > 0) {\n                    var candidateParts = getWordSpans(candidate);\n                    var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, false);\n                    if (camelCaseWeight !== undefined) {\n                        return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, true, camelCaseWeight);\n                    }\n                    camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, true);\n                    if (camelCaseWeight !== undefined) {\n                        return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, false, camelCaseWeight);\n                    }\n                }\n            }\n            if (isLowercase) {\n                if (chunk.text.length < candidate.length) {\n                    if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) {\n                        return createPatternMatch(PatternMatchKind.substring, punctuationStripped, false);\n                    }\n                }\n            }\n            return undefined;\n        }\n        function containsSpaceOrAsterisk(text) {\n            for (var i = 0; i < text.length; i++) {\n                var ch = text.charCodeAt(i);\n                if (ch === 32 || ch === 42) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function matchSegment(candidate, segment) {\n            if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) {\n                var match = matchTextChunk(candidate, segment.totalTextChunk, false);\n                if (match) {\n                    return [match];\n                }\n            }\n            var subWordTextChunks = segment.subWordTextChunks;\n            var matches = undefined;\n            for (var _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) {\n                var subWordTextChunk = subWordTextChunks_1[_i];\n                var result = matchTextChunk(candidate, subWordTextChunk, true);\n                if (!result) {\n                    return undefined;\n                }\n                matches = matches || [];\n                matches.push(result);\n            }\n            return matches;\n        }\n        function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) {\n            var patternPartStart = patternSpan ? patternSpan.start : 0;\n            var patternPartLength = patternSpan ? patternSpan.length : pattern.length;\n            if (patternPartLength > candidateSpan.length) {\n                return false;\n            }\n            if (ignoreCase) {\n                for (var i = 0; i < patternPartLength; i++) {\n                    var ch1 = pattern.charCodeAt(patternPartStart + i);\n                    var ch2 = candidate.charCodeAt(candidateSpan.start + i);\n                    if (toLowerCase(ch1) !== toLowerCase(ch2)) {\n                        return false;\n                    }\n                }\n            }\n            else {\n                for (var i = 0; i < patternPartLength; i++) {\n                    var ch1 = pattern.charCodeAt(patternPartStart + i);\n                    var ch2 = candidate.charCodeAt(candidateSpan.start + i);\n                    if (ch1 !== ch2) {\n                        return false;\n                    }\n                }\n            }\n            return true;\n        }\n        function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) {\n            var chunkCharacterSpans = chunk.characterSpans;\n            var currentCandidate = 0;\n            var currentChunkSpan = 0;\n            var firstMatch = undefined;\n            var contiguous = undefined;\n            while (true) {\n                if (currentChunkSpan === chunkCharacterSpans.length) {\n                    var weight = 0;\n                    if (contiguous) {\n                        weight += 1;\n                    }\n                    if (firstMatch === 0) {\n                        weight += 2;\n                    }\n                    return weight;\n                }\n                else if (currentCandidate === candidateParts.length) {\n                    return undefined;\n                }\n                var candidatePart = candidateParts[currentCandidate];\n                var gotOneMatchThisCandidate = false;\n                for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) {\n                    var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan];\n                    if (gotOneMatchThisCandidate) {\n                        if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) ||\n                            !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) {\n                            break;\n                        }\n                    }\n                    if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) {\n                        break;\n                    }\n                    gotOneMatchThisCandidate = true;\n                    firstMatch = firstMatch === undefined ? currentCandidate : firstMatch;\n                    contiguous = contiguous === undefined ? true : contiguous;\n                    candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length);\n                }\n                if (!gotOneMatchThisCandidate && contiguous !== undefined) {\n                    contiguous = false;\n                }\n                currentCandidate++;\n            }\n        }\n    }\n    ts.createPatternMatcher = createPatternMatcher;\n    function createSegment(text) {\n        return {\n            totalTextChunk: createTextChunk(text),\n            subWordTextChunks: breakPatternIntoTextChunks(text)\n        };\n    }\n    function segmentIsInvalid(segment) {\n        return segment.subWordTextChunks.length === 0;\n    }\n    function isUpperCaseLetter(ch) {\n        if (ch >= 65 && ch <= 90) {\n            return true;\n        }\n        if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 5)) {\n            return false;\n        }\n        var str = String.fromCharCode(ch);\n        return str === str.toUpperCase();\n    }\n    function isLowerCaseLetter(ch) {\n        if (ch >= 97 && ch <= 122) {\n            return true;\n        }\n        if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 5)) {\n            return false;\n        }\n        var str = String.fromCharCode(ch);\n        return str === str.toLowerCase();\n    }\n    function indexOfIgnoringCase(string, value) {\n        for (var i = 0, n = string.length - value.length; i <= n; i++) {\n            if (startsWithIgnoringCase(string, value, i)) {\n                return i;\n            }\n        }\n        return -1;\n    }\n    function startsWithIgnoringCase(string, value, start) {\n        for (var i = 0, n = value.length; i < n; i++) {\n            var ch1 = toLowerCase(string.charCodeAt(i + start));\n            var ch2 = value.charCodeAt(i);\n            if (ch1 !== ch2) {\n                return false;\n            }\n        }\n        return true;\n    }\n    function toLowerCase(ch) {\n        if (ch >= 65 && ch <= 90) {\n            return 97 + (ch - 65);\n        }\n        if (ch < 127) {\n            return ch;\n        }\n        return String.fromCharCode(ch).toLowerCase().charCodeAt(0);\n    }\n    function isDigit(ch) {\n        return ch >= 48 && ch <= 57;\n    }\n    function isWordChar(ch) {\n        return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit(ch) || ch === 95 || ch === 36;\n    }\n    function breakPatternIntoTextChunks(pattern) {\n        var result = [];\n        var wordStart = 0;\n        var wordLength = 0;\n        for (var i = 0; i < pattern.length; i++) {\n            var ch = pattern.charCodeAt(i);\n            if (isWordChar(ch)) {\n                if (wordLength === 0) {\n                    wordStart = i;\n                }\n                wordLength++;\n            }\n            else {\n                if (wordLength > 0) {\n                    result.push(createTextChunk(pattern.substr(wordStart, wordLength)));\n                    wordLength = 0;\n                }\n            }\n        }\n        if (wordLength > 0) {\n            result.push(createTextChunk(pattern.substr(wordStart, wordLength)));\n        }\n        return result;\n    }\n    function createTextChunk(text) {\n        var textLowerCase = text.toLowerCase();\n        return {\n            text: text,\n            textLowerCase: textLowerCase,\n            isLowerCase: text === textLowerCase,\n            characterSpans: breakIntoCharacterSpans(text)\n        };\n    }\n    function breakIntoCharacterSpans(identifier) {\n        return breakIntoSpans(identifier, false);\n    }\n    ts.breakIntoCharacterSpans = breakIntoCharacterSpans;\n    function breakIntoWordSpans(identifier) {\n        return breakIntoSpans(identifier, true);\n    }\n    ts.breakIntoWordSpans = breakIntoWordSpans;\n    function breakIntoSpans(identifier, word) {\n        var result = [];\n        var wordStart = 0;\n        for (var i = 1, n = identifier.length; i < n; i++) {\n            var lastIsDigit = isDigit(identifier.charCodeAt(i - 1));\n            var currentIsDigit = isDigit(identifier.charCodeAt(i));\n            var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i);\n            var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart);\n            if (charIsPunctuation(identifier.charCodeAt(i - 1)) ||\n                charIsPunctuation(identifier.charCodeAt(i)) ||\n                lastIsDigit !== currentIsDigit ||\n                hasTransitionFromLowerToUpper ||\n                hasTransitionFromUpperToLower) {\n                if (!isAllPunctuation(identifier, wordStart, i)) {\n                    result.push(ts.createTextSpan(wordStart, i - wordStart));\n                }\n                wordStart = i;\n            }\n        }\n        if (!isAllPunctuation(identifier, wordStart, identifier.length)) {\n            result.push(ts.createTextSpan(wordStart, identifier.length - wordStart));\n        }\n        return result;\n    }\n    function charIsPunctuation(ch) {\n        switch (ch) {\n            case 33:\n            case 34:\n            case 35:\n            case 37:\n            case 38:\n            case 39:\n            case 40:\n            case 41:\n            case 42:\n            case 44:\n            case 45:\n            case 46:\n            case 47:\n            case 58:\n            case 59:\n            case 63:\n            case 64:\n            case 91:\n            case 92:\n            case 93:\n            case 95:\n            case 123:\n            case 125:\n                return true;\n        }\n        return false;\n    }\n    function isAllPunctuation(identifier, start, end) {\n        for (var i = start; i < end; i++) {\n            var ch = identifier.charCodeAt(i);\n            if (!charIsPunctuation(ch) || ch === 95 || ch === 36) {\n                return false;\n            }\n        }\n        return true;\n    }\n    function transitionFromUpperToLower(identifier, word, index, wordStart) {\n        if (word) {\n            if (index !== wordStart &&\n                index + 1 < identifier.length) {\n                var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index));\n                var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1));\n                if (currentIsUpper && nextIsLower) {\n                    for (var i = wordStart; i < index; i++) {\n                        if (!isUpperCaseLetter(identifier.charCodeAt(i))) {\n                            return false;\n                        }\n                    }\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n    function transitionFromLowerToUpper(identifier, word, index) {\n        var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1));\n        var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index));\n        var transition = word\n            ? (currentIsUpper && !lastIsUpper)\n            : currentIsUpper;\n        return transition;\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function preProcessFile(sourceText, readImportFiles, detectJavaScriptImports) {\n        if (readImportFiles === void 0) { readImportFiles = true; }\n        if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; }\n        var referencedFiles = [];\n        var typeReferenceDirectives = [];\n        var importedFiles = [];\n        var ambientExternalModules;\n        var isNoDefaultLib = false;\n        var braceNesting = 0;\n        var externalModule = false;\n        function nextToken() {\n            var token = ts.scanner.scan();\n            if (token === 16) {\n                braceNesting++;\n            }\n            else if (token === 17) {\n                braceNesting--;\n            }\n            return token;\n        }\n        function processTripleSlashDirectives() {\n            var commentRanges = ts.getLeadingCommentRanges(sourceText, 0);\n            ts.forEach(commentRanges, function (commentRange) {\n                var comment = sourceText.substring(commentRange.pos, commentRange.end);\n                var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, commentRange);\n                if (referencePathMatchResult) {\n                    isNoDefaultLib = referencePathMatchResult.isNoDefaultLib;\n                    var fileReference = referencePathMatchResult.fileReference;\n                    if (fileReference) {\n                        var collection = referencePathMatchResult.isTypeReferenceDirective\n                            ? typeReferenceDirectives\n                            : referencedFiles;\n                        collection.push(fileReference);\n                    }\n                }\n            });\n        }\n        function getFileReference() {\n            var file = ts.scanner.getTokenValue();\n            var pos = ts.scanner.getTokenPos();\n            return {\n                fileName: file,\n                pos: pos,\n                end: pos + file.length\n            };\n        }\n        function recordAmbientExternalModule() {\n            if (!ambientExternalModules) {\n                ambientExternalModules = [];\n            }\n            ambientExternalModules.push({ ref: getFileReference(), depth: braceNesting });\n        }\n        function recordModuleName() {\n            importedFiles.push(getFileReference());\n            markAsExternalModuleIfTopLevel();\n        }\n        function markAsExternalModuleIfTopLevel() {\n            if (braceNesting === 0) {\n                externalModule = true;\n            }\n        }\n        function tryConsumeDeclare() {\n            var token = ts.scanner.getToken();\n            if (token === 123) {\n                token = nextToken();\n                if (token === 127) {\n                    token = nextToken();\n                    if (token === 9) {\n                        recordAmbientExternalModule();\n                    }\n                }\n                return true;\n            }\n            return false;\n        }\n        function tryConsumeImport() {\n            var token = ts.scanner.getToken();\n            if (token === 90) {\n                token = nextToken();\n                if (token === 9) {\n                    recordModuleName();\n                    return true;\n                }\n                else {\n                    if (token === 70 || ts.isKeyword(token)) {\n                        token = nextToken();\n                        if (token === 138) {\n                            token = nextToken();\n                            if (token === 9) {\n                                recordModuleName();\n                                return true;\n                            }\n                        }\n                        else if (token === 57) {\n                            if (tryConsumeRequireCall(true)) {\n                                return true;\n                            }\n                        }\n                        else if (token === 25) {\n                            token = nextToken();\n                        }\n                        else {\n                            return true;\n                        }\n                    }\n                    if (token === 16) {\n                        token = nextToken();\n                        while (token !== 17 && token !== 1) {\n                            token = nextToken();\n                        }\n                        if (token === 17) {\n                            token = nextToken();\n                            if (token === 138) {\n                                token = nextToken();\n                                if (token === 9) {\n                                    recordModuleName();\n                                }\n                            }\n                        }\n                    }\n                    else if (token === 38) {\n                        token = nextToken();\n                        if (token === 117) {\n                            token = nextToken();\n                            if (token === 70 || ts.isKeyword(token)) {\n                                token = nextToken();\n                                if (token === 138) {\n                                    token = nextToken();\n                                    if (token === 9) {\n                                        recordModuleName();\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }\n                return true;\n            }\n            return false;\n        }\n        function tryConsumeExport() {\n            var token = ts.scanner.getToken();\n            if (token === 83) {\n                markAsExternalModuleIfTopLevel();\n                token = nextToken();\n                if (token === 16) {\n                    token = nextToken();\n                    while (token !== 17 && token !== 1) {\n                        token = nextToken();\n                    }\n                    if (token === 17) {\n                        token = nextToken();\n                        if (token === 138) {\n                            token = nextToken();\n                            if (token === 9) {\n                                recordModuleName();\n                            }\n                        }\n                    }\n                }\n                else if (token === 38) {\n                    token = nextToken();\n                    if (token === 138) {\n                        token = nextToken();\n                        if (token === 9) {\n                            recordModuleName();\n                        }\n                    }\n                }\n                else if (token === 90) {\n                    token = nextToken();\n                    if (token === 70 || ts.isKeyword(token)) {\n                        token = nextToken();\n                        if (token === 57) {\n                            if (tryConsumeRequireCall(true)) {\n                                return true;\n                            }\n                        }\n                    }\n                }\n                return true;\n            }\n            return false;\n        }\n        function tryConsumeRequireCall(skipCurrentToken) {\n            var token = skipCurrentToken ? nextToken() : ts.scanner.getToken();\n            if (token === 131) {\n                token = nextToken();\n                if (token === 18) {\n                    token = nextToken();\n                    if (token === 9) {\n                        recordModuleName();\n                    }\n                }\n                return true;\n            }\n            return false;\n        }\n        function tryConsumeDefine() {\n            var token = ts.scanner.getToken();\n            if (token === 70 && ts.scanner.getTokenValue() === \"define\") {\n                token = nextToken();\n                if (token !== 18) {\n                    return true;\n                }\n                token = nextToken();\n                if (token === 9) {\n                    token = nextToken();\n                    if (token === 25) {\n                        token = nextToken();\n                    }\n                    else {\n                        return true;\n                    }\n                }\n                if (token !== 20) {\n                    return true;\n                }\n                token = nextToken();\n                var i = 0;\n                while (token !== 21 && token !== 1) {\n                    if (token === 9) {\n                        recordModuleName();\n                        i++;\n                    }\n                    token = nextToken();\n                }\n                return true;\n            }\n            return false;\n        }\n        function processImports() {\n            ts.scanner.setText(sourceText);\n            nextToken();\n            while (true) {\n                if (ts.scanner.getToken() === 1) {\n                    break;\n                }\n                if (tryConsumeDeclare() ||\n                    tryConsumeImport() ||\n                    tryConsumeExport() ||\n                    (detectJavaScriptImports && (tryConsumeRequireCall(false) || tryConsumeDefine()))) {\n                    continue;\n                }\n                else {\n                    nextToken();\n                }\n            }\n            ts.scanner.setText(undefined);\n        }\n        if (readImportFiles) {\n            processImports();\n        }\n        processTripleSlashDirectives();\n        if (externalModule) {\n            if (ambientExternalModules) {\n                for (var _i = 0, ambientExternalModules_1 = ambientExternalModules; _i < ambientExternalModules_1.length; _i++) {\n                    var decl = ambientExternalModules_1[_i];\n                    importedFiles.push(decl.ref);\n                }\n            }\n            return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: undefined };\n        }\n        else {\n            var ambientModuleNames = void 0;\n            if (ambientExternalModules) {\n                for (var _a = 0, ambientExternalModules_2 = ambientExternalModules; _a < ambientExternalModules_2.length; _a++) {\n                    var decl = ambientExternalModules_2[_a];\n                    if (decl.depth === 0) {\n                        if (!ambientModuleNames) {\n                            ambientModuleNames = [];\n                        }\n                        ambientModuleNames.push(decl.ref.fileName);\n                    }\n                    else {\n                        importedFiles.push(decl.ref);\n                    }\n                }\n            }\n            return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientModuleNames };\n        }\n    }\n    ts.preProcessFile = preProcessFile;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var Rename;\n    (function (Rename) {\n        function getRenameInfo(typeChecker, defaultLibFileName, getCanonicalFileName, sourceFile, position) {\n            var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName));\n            var node = ts.getTouchingWord(sourceFile, position, true);\n            if (node) {\n                if (node.kind === 70 ||\n                    node.kind === 9 ||\n                    ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) ||\n                    ts.isThis(node)) {\n                    var symbol = typeChecker.getSymbolAtLocation(node);\n                    if (symbol) {\n                        var declarations = symbol.getDeclarations();\n                        if (declarations && declarations.length > 0) {\n                            if (ts.forEach(declarations, isDefinedInLibraryFile)) {\n                                return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library));\n                            }\n                            var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node));\n                            var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node);\n                            if (kind) {\n                                return {\n                                    canRename: true,\n                                    kind: kind,\n                                    displayName: displayName,\n                                    localizedErrorMessage: undefined,\n                                    fullDisplayName: typeChecker.getFullyQualifiedName(symbol),\n                                    kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),\n                                    triggerSpan: createTriggerSpanForNode(node, sourceFile)\n                                };\n                            }\n                        }\n                    }\n                    else if (node.kind === 9) {\n                        var type = ts.getStringLiteralTypeForNode(node, typeChecker);\n                        if (type) {\n                            if (isDefinedInLibraryFile(node)) {\n                                return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library));\n                            }\n                            else {\n                                var displayName = ts.stripQuotes(type.text);\n                                return {\n                                    canRename: true,\n                                    kind: ts.ScriptElementKind.variableElement,\n                                    displayName: displayName,\n                                    localizedErrorMessage: undefined,\n                                    fullDisplayName: displayName,\n                                    kindModifiers: ts.ScriptElementKindModifier.none,\n                                    triggerSpan: createTriggerSpanForNode(node, sourceFile)\n                                };\n                            }\n                        }\n                    }\n                }\n            }\n            return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element));\n            function getRenameInfoError(localizedErrorMessage) {\n                return {\n                    canRename: false,\n                    localizedErrorMessage: localizedErrorMessage,\n                    displayName: undefined,\n                    fullDisplayName: undefined,\n                    kind: undefined,\n                    kindModifiers: undefined,\n                    triggerSpan: undefined\n                };\n            }\n            function isDefinedInLibraryFile(declaration) {\n                if (defaultLibFileName) {\n                    var sourceFile_1 = declaration.getSourceFile();\n                    var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName));\n                    if (canonicalName === canonicalDefaultLibName) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n            function createTriggerSpanForNode(node, sourceFile) {\n                var start = node.getStart(sourceFile);\n                var width = node.getWidth(sourceFile);\n                if (node.kind === 9) {\n                    start += 1;\n                    width -= 2;\n                }\n                return ts.createTextSpan(start, width);\n            }\n        }\n        Rename.getRenameInfo = getRenameInfo;\n    })(Rename = ts.Rename || (ts.Rename = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var SignatureHelp;\n    (function (SignatureHelp) {\n        var emptyArray = [];\n        function getSignatureHelpItems(program, sourceFile, position, cancellationToken) {\n            var typeChecker = program.getTypeChecker();\n            var startingToken = ts.findTokenOnLeftOfPosition(sourceFile, position);\n            if (!startingToken) {\n                return undefined;\n            }\n            var argumentInfo = getContainingArgumentInfo(startingToken, position, sourceFile);\n            cancellationToken.throwIfCancellationRequested();\n            if (!argumentInfo) {\n                return undefined;\n            }\n            var call = argumentInfo.invocation;\n            var candidates = [];\n            var resolvedSignature = typeChecker.getResolvedSignature(call, candidates);\n            cancellationToken.throwIfCancellationRequested();\n            if (!candidates.length) {\n                if (ts.isSourceFileJavaScript(sourceFile)) {\n                    return createJavaScriptSignatureHelpItems(argumentInfo, program);\n                }\n                return undefined;\n            }\n            return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo, typeChecker);\n        }\n        SignatureHelp.getSignatureHelpItems = getSignatureHelpItems;\n        function createJavaScriptSignatureHelpItems(argumentInfo, program) {\n            if (argumentInfo.invocation.kind !== 179) {\n                return undefined;\n            }\n            var callExpression = argumentInfo.invocation;\n            var expression = callExpression.expression;\n            var name = expression.kind === 70\n                ? expression\n                : expression.kind === 177\n                    ? expression.name\n                    : undefined;\n            if (!name || !name.text) {\n                return undefined;\n            }\n            var typeChecker = program.getTypeChecker();\n            for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {\n                var sourceFile = _a[_i];\n                var nameToDeclarations = sourceFile.getNamedDeclarations();\n                var declarations = nameToDeclarations[name.text];\n                if (declarations) {\n                    for (var _b = 0, declarations_10 = declarations; _b < declarations_10.length; _b++) {\n                        var declaration = declarations_10[_b];\n                        var symbol = declaration.symbol;\n                        if (symbol) {\n                            var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration);\n                            if (type) {\n                                var callSignatures = type.getCallSignatures();\n                                if (callSignatures && callSignatures.length) {\n                                    return createSignatureHelpItems(callSignatures, callSignatures[0], argumentInfo, typeChecker);\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        function getImmediatelyContainingArgumentInfo(node, position, sourceFile) {\n            if (node.parent.kind === 179 || node.parent.kind === 180) {\n                var callExpression = node.parent;\n                if (node.kind === 26 ||\n                    node.kind === 18) {\n                    var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile);\n                    var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos;\n                    ts.Debug.assert(list !== undefined);\n                    return {\n                        kind: isTypeArgList ? 0 : 1,\n                        invocation: callExpression,\n                        argumentsSpan: getApplicableSpanForArguments(list, sourceFile),\n                        argumentIndex: 0,\n                        argumentCount: getArgumentCount(list)\n                    };\n                }\n                var listItemInfo = ts.findListItemInfo(node);\n                if (listItemInfo) {\n                    var list = listItemInfo.list;\n                    var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos;\n                    var argumentIndex = getArgumentIndex(list, node);\n                    var argumentCount = getArgumentCount(list);\n                    ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, \"argumentCount < argumentIndex, \" + argumentCount + \" < \" + argumentIndex);\n                    return {\n                        kind: isTypeArgList ? 0 : 1,\n                        invocation: callExpression,\n                        argumentsSpan: getApplicableSpanForArguments(list, sourceFile),\n                        argumentIndex: argumentIndex,\n                        argumentCount: argumentCount\n                    };\n                }\n                return undefined;\n            }\n            else if (node.kind === 12 && node.parent.kind === 181) {\n                if (ts.isInsideTemplateLiteral(node, position)) {\n                    return getArgumentListInfoForTemplate(node.parent, 0, sourceFile);\n                }\n            }\n            else if (node.kind === 13 && node.parent.parent.kind === 181) {\n                var templateExpression = node.parent;\n                var tagExpression = templateExpression.parent;\n                ts.Debug.assert(templateExpression.kind === 194);\n                var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1;\n                return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile);\n            }\n            else if (node.parent.kind === 202 && node.parent.parent.parent.kind === 181) {\n                var templateSpan = node.parent;\n                var templateExpression = templateSpan.parent;\n                var tagExpression = templateExpression.parent;\n                ts.Debug.assert(templateExpression.kind === 194);\n                if (node.kind === 15 && !ts.isInsideTemplateLiteral(node, position)) {\n                    return undefined;\n                }\n                var spanIndex = templateExpression.templateSpans.indexOf(templateSpan);\n                var argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node, position);\n                return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile);\n            }\n            return undefined;\n        }\n        function getArgumentIndex(argumentsList, node) {\n            var argumentIndex = 0;\n            var listChildren = argumentsList.getChildren();\n            for (var _i = 0, listChildren_1 = listChildren; _i < listChildren_1.length; _i++) {\n                var child = listChildren_1[_i];\n                if (child === node) {\n                    break;\n                }\n                if (child.kind !== 25) {\n                    argumentIndex++;\n                }\n            }\n            return argumentIndex;\n        }\n        function getArgumentCount(argumentsList) {\n            var listChildren = argumentsList.getChildren();\n            var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 25; });\n            if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 25) {\n                argumentCount++;\n            }\n            return argumentCount;\n        }\n        function getArgumentIndexForTemplatePiece(spanIndex, node, position) {\n            ts.Debug.assert(position >= node.getStart(), \"Assumed 'position' could not occur before node.\");\n            if (ts.isTemplateLiteralKind(node.kind)) {\n                if (ts.isInsideTemplateLiteral(node, position)) {\n                    return 0;\n                }\n                return spanIndex + 2;\n            }\n            return spanIndex + 1;\n        }\n        function getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile) {\n            var argumentCount = tagExpression.template.kind === 12\n                ? 1\n                : tagExpression.template.templateSpans.length + 1;\n            ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, \"argumentCount < argumentIndex, \" + argumentCount + \" < \" + argumentIndex);\n            return {\n                kind: 2,\n                invocation: tagExpression,\n                argumentsSpan: getApplicableSpanForTaggedTemplate(tagExpression, sourceFile),\n                argumentIndex: argumentIndex,\n                argumentCount: argumentCount\n            };\n        }\n        function getApplicableSpanForArguments(argumentsList, sourceFile) {\n            var applicableSpanStart = argumentsList.getFullStart();\n            var applicableSpanEnd = ts.skipTrivia(sourceFile.text, argumentsList.getEnd(), false);\n            return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);\n        }\n        function getApplicableSpanForTaggedTemplate(taggedTemplate, sourceFile) {\n            var template = taggedTemplate.template;\n            var applicableSpanStart = template.getStart();\n            var applicableSpanEnd = template.getEnd();\n            if (template.kind === 194) {\n                var lastSpan = ts.lastOrUndefined(template.templateSpans);\n                if (lastSpan.literal.getFullWidth() === 0) {\n                    applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false);\n                }\n            }\n            return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);\n        }\n        function getContainingArgumentInfo(node, position, sourceFile) {\n            for (var n = node; n.kind !== 261; n = n.parent) {\n                if (ts.isFunctionBlock(n)) {\n                    return undefined;\n                }\n                if (n.pos < n.parent.pos || n.end > n.parent.end) {\n                    ts.Debug.fail(\"Node of kind \" + n.kind + \" is not a subspan of its parent of kind \" + n.parent.kind);\n                }\n                var argumentInfo = getImmediatelyContainingArgumentInfo(n, position, sourceFile);\n                if (argumentInfo) {\n                    return argumentInfo;\n                }\n            }\n            return undefined;\n        }\n        SignatureHelp.getContainingArgumentInfo = getContainingArgumentInfo;\n        function getChildListThatStartsWithOpenerToken(parent, openerToken, sourceFile) {\n            var children = parent.getChildren(sourceFile);\n            var indexOfOpenerToken = children.indexOf(openerToken);\n            ts.Debug.assert(indexOfOpenerToken >= 0 && children.length > indexOfOpenerToken + 1);\n            return children[indexOfOpenerToken + 1];\n        }\n        function selectBestInvalidOverloadIndex(candidates, argumentCount) {\n            var maxParamsSignatureIndex = -1;\n            var maxParams = -1;\n            for (var i = 0; i < candidates.length; i++) {\n                var candidate = candidates[i];\n                if (candidate.hasRestParameter || candidate.parameters.length >= argumentCount) {\n                    return i;\n                }\n                if (candidate.parameters.length > maxParams) {\n                    maxParams = candidate.parameters.length;\n                    maxParamsSignatureIndex = i;\n                }\n            }\n            return maxParamsSignatureIndex;\n        }\n        function createSignatureHelpItems(candidates, bestSignature, argumentListInfo, typeChecker) {\n            var applicableSpan = argumentListInfo.argumentsSpan;\n            var isTypeParameterList = argumentListInfo.kind === 0;\n            var invocation = argumentListInfo.invocation;\n            var callTarget = ts.getInvokedExpression(invocation);\n            var callTargetSymbol = typeChecker.getSymbolAtLocation(callTarget);\n            var callTargetDisplayParts = callTargetSymbol && ts.symbolToDisplayParts(typeChecker, callTargetSymbol, undefined, undefined);\n            var items = ts.map(candidates, function (candidateSignature) {\n                var signatureHelpParameters;\n                var prefixDisplayParts = [];\n                var suffixDisplayParts = [];\n                if (callTargetDisplayParts) {\n                    ts.addRange(prefixDisplayParts, callTargetDisplayParts);\n                }\n                var isVariadic;\n                if (isTypeParameterList) {\n                    isVariadic = false;\n                    prefixDisplayParts.push(ts.punctuationPart(26));\n                    var typeParameters = candidateSignature.typeParameters;\n                    signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray;\n                    suffixDisplayParts.push(ts.punctuationPart(28));\n                    var parameterParts = ts.mapToDisplayParts(function (writer) {\n                        return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.thisParameter, candidateSignature.parameters, writer, invocation);\n                    });\n                    ts.addRange(suffixDisplayParts, parameterParts);\n                }\n                else {\n                    isVariadic = candidateSignature.hasRestParameter;\n                    var typeParameterParts = ts.mapToDisplayParts(function (writer) {\n                        return typeChecker.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation);\n                    });\n                    ts.addRange(prefixDisplayParts, typeParameterParts);\n                    prefixDisplayParts.push(ts.punctuationPart(18));\n                    var parameters = candidateSignature.parameters;\n                    signatureHelpParameters = parameters.length > 0 ? ts.map(parameters, createSignatureHelpParameterForParameter) : emptyArray;\n                    suffixDisplayParts.push(ts.punctuationPart(19));\n                }\n                var returnTypeParts = ts.mapToDisplayParts(function (writer) {\n                    return typeChecker.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation);\n                });\n                ts.addRange(suffixDisplayParts, returnTypeParts);\n                return {\n                    isVariadic: isVariadic,\n                    prefixDisplayParts: prefixDisplayParts,\n                    suffixDisplayParts: suffixDisplayParts,\n                    separatorDisplayParts: [ts.punctuationPart(25), ts.spacePart()],\n                    parameters: signatureHelpParameters,\n                    documentation: candidateSignature.getDocumentationComment()\n                };\n            });\n            var argumentIndex = argumentListInfo.argumentIndex;\n            var argumentCount = argumentListInfo.argumentCount;\n            var selectedItemIndex = candidates.indexOf(bestSignature);\n            if (selectedItemIndex < 0) {\n                selectedItemIndex = selectBestInvalidOverloadIndex(candidates, argumentCount);\n            }\n            ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, \"argumentCount < argumentIndex, \" + argumentCount + \" < \" + argumentIndex);\n            return {\n                items: items,\n                applicableSpan: applicableSpan,\n                selectedItemIndex: selectedItemIndex,\n                argumentIndex: argumentIndex,\n                argumentCount: argumentCount\n            };\n            function createSignatureHelpParameterForParameter(parameter) {\n                var displayParts = ts.mapToDisplayParts(function (writer) {\n                    return typeChecker.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation);\n                });\n                return {\n                    name: parameter.name,\n                    documentation: parameter.getDocumentationComment(),\n                    displayParts: displayParts,\n                    isOptional: typeChecker.isOptionalParameter(parameter.valueDeclaration)\n                };\n            }\n            function createSignatureHelpParameterForTypeParameter(typeParameter) {\n                var displayParts = ts.mapToDisplayParts(function (writer) {\n                    return typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, invocation);\n                });\n                return {\n                    name: typeParameter.symbol.name,\n                    documentation: emptyArray,\n                    displayParts: displayParts,\n                    isOptional: false\n                };\n            }\n        }\n    })(SignatureHelp = ts.SignatureHelp || (ts.SignatureHelp = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var SymbolDisplay;\n    (function (SymbolDisplay) {\n        function getSymbolKind(typeChecker, symbol, location) {\n            var flags = symbol.getFlags();\n            if (flags & 32)\n                return ts.getDeclarationOfKind(symbol, 197) ?\n                    ts.ScriptElementKind.localClassElement : ts.ScriptElementKind.classElement;\n            if (flags & 384)\n                return ts.ScriptElementKind.enumElement;\n            if (flags & 524288)\n                return ts.ScriptElementKind.typeElement;\n            if (flags & 64)\n                return ts.ScriptElementKind.interfaceElement;\n            if (flags & 262144)\n                return ts.ScriptElementKind.typeParameterElement;\n            var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location);\n            if (result === ts.ScriptElementKind.unknown) {\n                if (flags & 262144)\n                    return ts.ScriptElementKind.typeParameterElement;\n                if (flags & 8)\n                    return ts.ScriptElementKind.variableElement;\n                if (flags & 8388608)\n                    return ts.ScriptElementKind.alias;\n                if (flags & 1536)\n                    return ts.ScriptElementKind.moduleElement;\n            }\n            return result;\n        }\n        SymbolDisplay.getSymbolKind = getSymbolKind;\n        function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location) {\n            if (typeChecker.isUndefinedSymbol(symbol)) {\n                return ts.ScriptElementKind.variableElement;\n            }\n            if (typeChecker.isArgumentsSymbol(symbol)) {\n                return ts.ScriptElementKind.localVariableElement;\n            }\n            if (location.kind === 98 && ts.isExpression(location)) {\n                return ts.ScriptElementKind.parameterElement;\n            }\n            if (flags & 3) {\n                if (ts.isFirstDeclarationOfSymbolParameter(symbol)) {\n                    return ts.ScriptElementKind.parameterElement;\n                }\n                else if (symbol.valueDeclaration && ts.isConst(symbol.valueDeclaration)) {\n                    return ts.ScriptElementKind.constElement;\n                }\n                else if (ts.forEach(symbol.declarations, ts.isLet)) {\n                    return ts.ScriptElementKind.letElement;\n                }\n                return isLocalVariableOrFunction(symbol) ? ts.ScriptElementKind.localVariableElement : ts.ScriptElementKind.variableElement;\n            }\n            if (flags & 16)\n                return isLocalVariableOrFunction(symbol) ? ts.ScriptElementKind.localFunctionElement : ts.ScriptElementKind.functionElement;\n            if (flags & 32768)\n                return ts.ScriptElementKind.memberGetAccessorElement;\n            if (flags & 65536)\n                return ts.ScriptElementKind.memberSetAccessorElement;\n            if (flags & 8192)\n                return ts.ScriptElementKind.memberFunctionElement;\n            if (flags & 16384)\n                return ts.ScriptElementKind.constructorImplementationElement;\n            if (flags & 4) {\n                if (flags & 268435456) {\n                    var unionPropertyKind = ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) {\n                        var rootSymbolFlags = rootSymbol.getFlags();\n                        if (rootSymbolFlags & (98308 | 3)) {\n                            return ts.ScriptElementKind.memberVariableElement;\n                        }\n                        ts.Debug.assert(!!(rootSymbolFlags & 8192));\n                    });\n                    if (!unionPropertyKind) {\n                        var typeOfUnionProperty = typeChecker.getTypeOfSymbolAtLocation(symbol, location);\n                        if (typeOfUnionProperty.getCallSignatures().length) {\n                            return ts.ScriptElementKind.memberFunctionElement;\n                        }\n                        return ts.ScriptElementKind.memberVariableElement;\n                    }\n                    return unionPropertyKind;\n                }\n                return ts.ScriptElementKind.memberVariableElement;\n            }\n            return ts.ScriptElementKind.unknown;\n        }\n        function getSymbolModifiers(symbol) {\n            return symbol && symbol.declarations && symbol.declarations.length > 0\n                ? ts.getNodeModifiers(symbol.declarations[0])\n                : ts.ScriptElementKindModifier.none;\n        }\n        SymbolDisplay.getSymbolModifiers = getSymbolModifiers;\n        function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning) {\n            if (semanticMeaning === void 0) { semanticMeaning = ts.getMeaningFromLocation(location); }\n            var displayParts = [];\n            var documentation;\n            var symbolFlags = symbol.flags;\n            var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, symbolFlags, location);\n            var hasAddedSymbolInfo;\n            var isThisExpression = location.kind === 98 && ts.isExpression(location);\n            var type;\n            if (symbolKind !== ts.ScriptElementKind.unknown || symbolFlags & 32 || symbolFlags & 8388608) {\n                if (symbolKind === ts.ScriptElementKind.memberGetAccessorElement || symbolKind === ts.ScriptElementKind.memberSetAccessorElement) {\n                    symbolKind = ts.ScriptElementKind.memberVariableElement;\n                }\n                var signature = void 0;\n                type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);\n                if (type) {\n                    if (location.parent && location.parent.kind === 177) {\n                        var right = location.parent.name;\n                        if (right === location || (right && right.getFullWidth() === 0)) {\n                            location = location.parent;\n                        }\n                    }\n                    var callExpression = void 0;\n                    if (location.kind === 179 || location.kind === 180) {\n                        callExpression = location;\n                    }\n                    else if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location)) {\n                        callExpression = location.parent;\n                    }\n                    if (callExpression) {\n                        var candidateSignatures = [];\n                        signature = typeChecker.getResolvedSignature(callExpression, candidateSignatures);\n                        if (!signature && candidateSignatures.length) {\n                            signature = candidateSignatures[0];\n                        }\n                        var useConstructSignatures = callExpression.kind === 180 || callExpression.expression.kind === 96;\n                        var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures();\n                        if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) {\n                            signature = allSignatures.length ? allSignatures[0] : undefined;\n                        }\n                        if (signature) {\n                            if (useConstructSignatures && (symbolFlags & 32)) {\n                                symbolKind = ts.ScriptElementKind.constructorImplementationElement;\n                                addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);\n                            }\n                            else if (symbolFlags & 8388608) {\n                                symbolKind = ts.ScriptElementKind.alias;\n                                pushTypePart(symbolKind);\n                                displayParts.push(ts.spacePart());\n                                if (useConstructSignatures) {\n                                    displayParts.push(ts.keywordPart(93));\n                                    displayParts.push(ts.spacePart());\n                                }\n                                addFullSymbolName(symbol);\n                            }\n                            else {\n                                addPrefixForAnyFunctionOrVar(symbol, symbolKind);\n                            }\n                            switch (symbolKind) {\n                                case ts.ScriptElementKind.memberVariableElement:\n                                case ts.ScriptElementKind.variableElement:\n                                case ts.ScriptElementKind.constElement:\n                                case ts.ScriptElementKind.letElement:\n                                case ts.ScriptElementKind.parameterElement:\n                                case ts.ScriptElementKind.localVariableElement:\n                                    displayParts.push(ts.punctuationPart(55));\n                                    displayParts.push(ts.spacePart());\n                                    if (useConstructSignatures) {\n                                        displayParts.push(ts.keywordPart(93));\n                                        displayParts.push(ts.spacePart());\n                                    }\n                                    if (!(type.flags & 32768 && type.objectFlags & 16) && type.symbol) {\n                                        ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, undefined, 1));\n                                    }\n                                    addSignatureDisplayParts(signature, allSignatures, 8);\n                                    break;\n                                default:\n                                    addSignatureDisplayParts(signature, allSignatures);\n                            }\n                            hasAddedSymbolInfo = true;\n                        }\n                    }\n                    else if ((ts.isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) ||\n                        (location.kind === 122 && location.parent.kind === 150)) {\n                        var functionDeclaration = location.parent;\n                        var allSignatures = functionDeclaration.kind === 150 ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();\n                        if (!typeChecker.isImplementationOfOverload(functionDeclaration)) {\n                            signature = typeChecker.getSignatureFromDeclaration(functionDeclaration);\n                        }\n                        else {\n                            signature = allSignatures[0];\n                        }\n                        if (functionDeclaration.kind === 150) {\n                            symbolKind = ts.ScriptElementKind.constructorImplementationElement;\n                            addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);\n                        }\n                        else {\n                            addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 153 &&\n                                !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind);\n                        }\n                        addSignatureDisplayParts(signature, allSignatures);\n                        hasAddedSymbolInfo = true;\n                    }\n                }\n            }\n            if (symbolFlags & 32 && !hasAddedSymbolInfo && !isThisExpression) {\n                if (ts.getDeclarationOfKind(symbol, 197)) {\n                    pushTypePart(ts.ScriptElementKind.localClassElement);\n                }\n                else {\n                    displayParts.push(ts.keywordPart(74));\n                }\n                displayParts.push(ts.spacePart());\n                addFullSymbolName(symbol);\n                writeTypeParametersOfSymbol(symbol, sourceFile);\n            }\n            if ((symbolFlags & 64) && (semanticMeaning & 2)) {\n                addNewLineIfDisplayPartsExist();\n                displayParts.push(ts.keywordPart(108));\n                displayParts.push(ts.spacePart());\n                addFullSymbolName(symbol);\n                writeTypeParametersOfSymbol(symbol, sourceFile);\n            }\n            if (symbolFlags & 524288) {\n                addNewLineIfDisplayPartsExist();\n                displayParts.push(ts.keywordPart(136));\n                displayParts.push(ts.spacePart());\n                addFullSymbolName(symbol);\n                writeTypeParametersOfSymbol(symbol, sourceFile);\n                displayParts.push(ts.spacePart());\n                displayParts.push(ts.operatorPart(57));\n                displayParts.push(ts.spacePart());\n                ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 512));\n            }\n            if (symbolFlags & 384) {\n                addNewLineIfDisplayPartsExist();\n                if (ts.forEach(symbol.declarations, ts.isConstEnumDeclaration)) {\n                    displayParts.push(ts.keywordPart(75));\n                    displayParts.push(ts.spacePart());\n                }\n                displayParts.push(ts.keywordPart(82));\n                displayParts.push(ts.spacePart());\n                addFullSymbolName(symbol);\n            }\n            if (symbolFlags & 1536) {\n                addNewLineIfDisplayPartsExist();\n                var declaration = ts.getDeclarationOfKind(symbol, 230);\n                var isNamespace = declaration && declaration.name && declaration.name.kind === 70;\n                displayParts.push(ts.keywordPart(isNamespace ? 128 : 127));\n                displayParts.push(ts.spacePart());\n                addFullSymbolName(symbol);\n            }\n            if ((symbolFlags & 262144) && (semanticMeaning & 2)) {\n                addNewLineIfDisplayPartsExist();\n                displayParts.push(ts.punctuationPart(18));\n                displayParts.push(ts.textPart(\"type parameter\"));\n                displayParts.push(ts.punctuationPart(19));\n                displayParts.push(ts.spacePart());\n                addFullSymbolName(symbol);\n                if (symbol.parent) {\n                    addInPrefix();\n                    addFullSymbolName(symbol.parent, enclosingDeclaration);\n                    writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration);\n                }\n                else {\n                    var declaration = ts.getDeclarationOfKind(symbol, 143);\n                    ts.Debug.assert(declaration !== undefined);\n                    declaration = declaration.parent;\n                    if (declaration) {\n                        if (ts.isFunctionLikeKind(declaration.kind)) {\n                            addInPrefix();\n                            var signature = typeChecker.getSignatureFromDeclaration(declaration);\n                            if (declaration.kind === 154) {\n                                displayParts.push(ts.keywordPart(93));\n                                displayParts.push(ts.spacePart());\n                            }\n                            else if (declaration.kind !== 153 && declaration.name) {\n                                addFullSymbolName(declaration.symbol);\n                            }\n                            ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32));\n                        }\n                        else if (declaration.kind === 228) {\n                            addInPrefix();\n                            displayParts.push(ts.keywordPart(136));\n                            displayParts.push(ts.spacePart());\n                            addFullSymbolName(declaration.symbol);\n                            writeTypeParametersOfSymbol(declaration.symbol, sourceFile);\n                        }\n                    }\n                }\n            }\n            if (symbolFlags & 8) {\n                addPrefixForAnyFunctionOrVar(symbol, \"enum member\");\n                var declaration = symbol.declarations[0];\n                if (declaration.kind === 260) {\n                    var constantValue = typeChecker.getConstantValue(declaration);\n                    if (constantValue !== undefined) {\n                        displayParts.push(ts.spacePart());\n                        displayParts.push(ts.operatorPart(57));\n                        displayParts.push(ts.spacePart());\n                        displayParts.push(ts.displayPart(constantValue.toString(), ts.SymbolDisplayPartKind.numericLiteral));\n                    }\n                }\n            }\n            if (symbolFlags & 8388608) {\n                addNewLineIfDisplayPartsExist();\n                if (symbol.declarations[0].kind === 233) {\n                    displayParts.push(ts.keywordPart(83));\n                    displayParts.push(ts.spacePart());\n                    displayParts.push(ts.keywordPart(128));\n                }\n                else {\n                    displayParts.push(ts.keywordPart(90));\n                }\n                displayParts.push(ts.spacePart());\n                addFullSymbolName(symbol);\n                ts.forEach(symbol.declarations, function (declaration) {\n                    if (declaration.kind === 234) {\n                        var importEqualsDeclaration = declaration;\n                        if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) {\n                            displayParts.push(ts.spacePart());\n                            displayParts.push(ts.operatorPart(57));\n                            displayParts.push(ts.spacePart());\n                            displayParts.push(ts.keywordPart(131));\n                            displayParts.push(ts.punctuationPart(18));\n                            displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral));\n                            displayParts.push(ts.punctuationPart(19));\n                        }\n                        else {\n                            var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference);\n                            if (internalAliasSymbol) {\n                                displayParts.push(ts.spacePart());\n                                displayParts.push(ts.operatorPart(57));\n                                displayParts.push(ts.spacePart());\n                                addFullSymbolName(internalAliasSymbol, enclosingDeclaration);\n                            }\n                        }\n                        return true;\n                    }\n                });\n            }\n            if (!hasAddedSymbolInfo) {\n                if (symbolKind !== ts.ScriptElementKind.unknown) {\n                    if (type) {\n                        if (isThisExpression) {\n                            addNewLineIfDisplayPartsExist();\n                            displayParts.push(ts.keywordPart(98));\n                        }\n                        else {\n                            addPrefixForAnyFunctionOrVar(symbol, symbolKind);\n                        }\n                        if (symbolKind === ts.ScriptElementKind.memberVariableElement ||\n                            symbolFlags & 3 ||\n                            symbolKind === ts.ScriptElementKind.localVariableElement ||\n                            isThisExpression) {\n                            displayParts.push(ts.punctuationPart(55));\n                            displayParts.push(ts.spacePart());\n                            if (type.symbol && type.symbol.flags & 262144) {\n                                var typeParameterParts = ts.mapToDisplayParts(function (writer) {\n                                    typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplay(type, writer, enclosingDeclaration);\n                                });\n                                ts.addRange(displayParts, typeParameterParts);\n                            }\n                            else {\n                                ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, type, enclosingDeclaration));\n                            }\n                        }\n                        else if (symbolFlags & 16 ||\n                            symbolFlags & 8192 ||\n                            symbolFlags & 16384 ||\n                            symbolFlags & 131072 ||\n                            symbolFlags & 98304 ||\n                            symbolKind === ts.ScriptElementKind.memberFunctionElement) {\n                            var allSignatures = type.getNonNullableType().getCallSignatures();\n                            addSignatureDisplayParts(allSignatures[0], allSignatures);\n                        }\n                    }\n                }\n                else {\n                    symbolKind = getSymbolKind(typeChecker, symbol, location);\n                }\n            }\n            if (!documentation) {\n                documentation = symbol.getDocumentationComment();\n                if (documentation.length === 0 && symbol.flags & 4) {\n                    if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 261; })) {\n                        for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                            var declaration = _a[_i];\n                            if (!declaration.parent || declaration.parent.kind !== 192) {\n                                continue;\n                            }\n                            var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right);\n                            if (!rhsSymbol) {\n                                continue;\n                            }\n                            documentation = rhsSymbol.getDocumentationComment();\n                            if (documentation.length > 0) {\n                                break;\n                            }\n                        }\n                    }\n                }\n            }\n            return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind };\n            function addNewLineIfDisplayPartsExist() {\n                if (displayParts.length) {\n                    displayParts.push(ts.lineBreakPart());\n                }\n            }\n            function addInPrefix() {\n                displayParts.push(ts.spacePart());\n                displayParts.push(ts.keywordPart(91));\n                displayParts.push(ts.spacePart());\n            }\n            function addFullSymbolName(symbol, enclosingDeclaration) {\n                var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration || sourceFile, undefined, 1 | 2);\n                ts.addRange(displayParts, fullSymbolDisplayParts);\n            }\n            function addPrefixForAnyFunctionOrVar(symbol, symbolKind) {\n                addNewLineIfDisplayPartsExist();\n                if (symbolKind) {\n                    pushTypePart(symbolKind);\n                    displayParts.push(ts.spacePart());\n                    addFullSymbolName(symbol);\n                }\n            }\n            function pushTypePart(symbolKind) {\n                switch (symbolKind) {\n                    case ts.ScriptElementKind.variableElement:\n                    case ts.ScriptElementKind.functionElement:\n                    case ts.ScriptElementKind.letElement:\n                    case ts.ScriptElementKind.constElement:\n                    case ts.ScriptElementKind.constructorImplementationElement:\n                        displayParts.push(ts.textOrKeywordPart(symbolKind));\n                        return;\n                    default:\n                        displayParts.push(ts.punctuationPart(18));\n                        displayParts.push(ts.textOrKeywordPart(symbolKind));\n                        displayParts.push(ts.punctuationPart(19));\n                        return;\n                }\n            }\n            function addSignatureDisplayParts(signature, allSignatures, flags) {\n                ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | 32));\n                if (allSignatures.length > 1) {\n                    displayParts.push(ts.spacePart());\n                    displayParts.push(ts.punctuationPart(18));\n                    displayParts.push(ts.operatorPart(36));\n                    displayParts.push(ts.displayPart((allSignatures.length - 1).toString(), ts.SymbolDisplayPartKind.numericLiteral));\n                    displayParts.push(ts.spacePart());\n                    displayParts.push(ts.textPart(allSignatures.length === 2 ? \"overload\" : \"overloads\"));\n                    displayParts.push(ts.punctuationPart(19));\n                }\n                documentation = signature.getDocumentationComment();\n            }\n            function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) {\n                var typeParameterParts = ts.mapToDisplayParts(function (writer) {\n                    typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration);\n                });\n                ts.addRange(displayParts, typeParameterParts);\n            }\n        }\n        SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind;\n        function isLocalVariableOrFunction(symbol) {\n            if (symbol.parent) {\n                return false;\n            }\n            return ts.forEach(symbol.declarations, function (declaration) {\n                if (declaration.kind === 184) {\n                    return true;\n                }\n                if (declaration.kind !== 223 && declaration.kind !== 225) {\n                    return false;\n                }\n                for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) {\n                    if (parent_20.kind === 261 || parent_20.kind === 231) {\n                        return false;\n                    }\n                }\n                return true;\n            });\n        }\n    })(SymbolDisplay = ts.SymbolDisplay || (ts.SymbolDisplay = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function transpileModule(input, transpileOptions) {\n        var diagnostics = [];\n        var options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : ts.getDefaultCompilerOptions();\n        options.isolatedModules = true;\n        options.suppressOutputPathCheck = true;\n        options.allowNonTsExtensions = true;\n        options.noLib = true;\n        options.lib = undefined;\n        options.types = undefined;\n        options.noEmit = undefined;\n        options.noEmitOnError = undefined;\n        options.paths = undefined;\n        options.rootDirs = undefined;\n        options.declaration = undefined;\n        options.declarationDir = undefined;\n        options.out = undefined;\n        options.outFile = undefined;\n        options.noResolve = true;\n        var inputFileName = transpileOptions.fileName || (options.jsx ? \"module.tsx\" : \"module.ts\");\n        var sourceFile = ts.createSourceFile(inputFileName, input, options.target);\n        if (transpileOptions.moduleName) {\n            sourceFile.moduleName = transpileOptions.moduleName;\n        }\n        if (transpileOptions.renamedDependencies) {\n            sourceFile.renamedDependencies = ts.createMap(transpileOptions.renamedDependencies);\n        }\n        var newLine = ts.getNewLineCharacter(options);\n        var outputText;\n        var sourceMapText;\n        var compilerHost = {\n            getSourceFile: function (fileName) { return fileName === ts.normalizePath(inputFileName) ? sourceFile : undefined; },\n            writeFile: function (name, text) {\n                if (ts.fileExtensionIs(name, \".map\")) {\n                    ts.Debug.assert(sourceMapText === undefined, \"Unexpected multiple source map outputs for the file '\" + name + \"'\");\n                    sourceMapText = text;\n                }\n                else {\n                    ts.Debug.assert(outputText === undefined, \"Unexpected multiple outputs for the file: '\" + name + \"'\");\n                    outputText = text;\n                }\n            },\n            getDefaultLibFileName: function () { return \"lib.d.ts\"; },\n            useCaseSensitiveFileNames: function () { return false; },\n            getCanonicalFileName: function (fileName) { return fileName; },\n            getCurrentDirectory: function () { return \"\"; },\n            getNewLine: function () { return newLine; },\n            fileExists: function (fileName) { return fileName === inputFileName; },\n            readFile: function () { return \"\"; },\n            directoryExists: function () { return true; },\n            getDirectories: function () { return []; }\n        };\n        var program = ts.createProgram([inputFileName], options, compilerHost);\n        if (transpileOptions.reportDiagnostics) {\n            ts.addRange(diagnostics, program.getSyntacticDiagnostics(sourceFile));\n            ts.addRange(diagnostics, program.getOptionsDiagnostics());\n        }\n        program.emit();\n        ts.Debug.assert(outputText !== undefined, \"Output generation failed\");\n        return { outputText: outputText, diagnostics: diagnostics, sourceMapText: sourceMapText };\n    }\n    ts.transpileModule = transpileModule;\n    function transpile(input, compilerOptions, fileName, diagnostics, moduleName) {\n        var output = transpileModule(input, { compilerOptions: compilerOptions, fileName: fileName, reportDiagnostics: !!diagnostics, moduleName: moduleName });\n        ts.addRange(diagnostics, output.diagnostics);\n        return output.outputText;\n    }\n    ts.transpile = transpile;\n    var commandLineOptionsStringToEnum;\n    function fixupCompilerOptions(options, diagnostics) {\n        commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) {\n            return typeof o.type === \"object\" && !ts.forEachProperty(o.type, function (v) { return typeof v !== \"number\"; });\n        });\n        options = ts.clone(options);\n        var _loop_3 = function (opt) {\n            if (!ts.hasProperty(options, opt.name)) {\n                return \"continue\";\n            }\n            var value = options[opt.name];\n            if (typeof value === \"string\") {\n                options[opt.name] = ts.parseCustomTypeOption(opt, value, diagnostics);\n            }\n            else {\n                if (!ts.forEachProperty(opt.type, function (v) { return v === value; })) {\n                    diagnostics.push(ts.createCompilerDiagnosticForInvalidCustomType(opt));\n                }\n            }\n        };\n        for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) {\n            var opt = commandLineOptionsStringToEnum_1[_i];\n            _loop_3(opt);\n        }\n        return options;\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var standardScanner = ts.createScanner(5, false, 0);\n        var jsxScanner = ts.createScanner(5, false, 1);\n        var scanner;\n        function getFormattingScanner(sourceFile, startPos, endPos) {\n            ts.Debug.assert(scanner === undefined, \"Scanner should be undefined\");\n            scanner = sourceFile.languageVariant === 1 ? jsxScanner : standardScanner;\n            scanner.setText(sourceFile.text);\n            scanner.setTextPos(startPos);\n            var wasNewLine = true;\n            var leadingTrivia;\n            var trailingTrivia;\n            var savedPos;\n            var lastScanAction;\n            var lastTokenInfo;\n            return {\n                advance: advance,\n                readTokenInfo: readTokenInfo,\n                isOnToken: isOnToken,\n                getCurrentLeadingTrivia: function () { return leadingTrivia; },\n                lastTrailingTriviaWasNewLine: function () { return wasNewLine; },\n                skipToEndOf: skipToEndOf,\n                close: function () {\n                    ts.Debug.assert(scanner !== undefined);\n                    lastTokenInfo = undefined;\n                    scanner.setText(undefined);\n                    scanner = undefined;\n                }\n            };\n            function advance() {\n                ts.Debug.assert(scanner !== undefined, \"Scanner should be present\");\n                lastTokenInfo = undefined;\n                var isStarted = scanner.getStartPos() !== startPos;\n                if (isStarted) {\n                    if (trailingTrivia) {\n                        ts.Debug.assert(trailingTrivia.length !== 0);\n                        wasNewLine = ts.lastOrUndefined(trailingTrivia).kind === 4;\n                    }\n                    else {\n                        wasNewLine = false;\n                    }\n                }\n                leadingTrivia = undefined;\n                trailingTrivia = undefined;\n                if (!isStarted) {\n                    scanner.scan();\n                }\n                var pos = scanner.getStartPos();\n                while (pos < endPos) {\n                    var t = scanner.getToken();\n                    if (!ts.isTrivia(t)) {\n                        break;\n                    }\n                    scanner.scan();\n                    var item = {\n                        pos: pos,\n                        end: scanner.getStartPos(),\n                        kind: t\n                    };\n                    pos = scanner.getStartPos();\n                    if (!leadingTrivia) {\n                        leadingTrivia = [];\n                    }\n                    leadingTrivia.push(item);\n                }\n                savedPos = scanner.getStartPos();\n            }\n            function shouldRescanGreaterThanToken(node) {\n                if (node) {\n                    switch (node.kind) {\n                        case 30:\n                        case 65:\n                        case 66:\n                        case 46:\n                        case 45:\n                            return true;\n                    }\n                }\n                return false;\n            }\n            function shouldRescanJsxIdentifier(node) {\n                if (node.parent) {\n                    switch (node.parent.kind) {\n                        case 250:\n                        case 248:\n                        case 249:\n                        case 247:\n                            return node.kind === 70;\n                    }\n                }\n                return false;\n            }\n            function shouldRescanJsxText(node) {\n                return node && node.kind === 10;\n            }\n            function shouldRescanSlashToken(container) {\n                return container.kind === 11;\n            }\n            function shouldRescanTemplateToken(container) {\n                return container.kind === 14 ||\n                    container.kind === 15;\n            }\n            function startsWithSlashToken(t) {\n                return t === 40 || t === 62;\n            }\n            function readTokenInfo(n) {\n                ts.Debug.assert(scanner !== undefined);\n                if (!isOnToken()) {\n                    return {\n                        leadingTrivia: leadingTrivia,\n                        trailingTrivia: undefined,\n                        token: undefined\n                    };\n                }\n                var expectedScanAction = shouldRescanGreaterThanToken(n)\n                    ? 1\n                    : shouldRescanSlashToken(n)\n                        ? 2\n                        : shouldRescanTemplateToken(n)\n                            ? 3\n                            : shouldRescanJsxIdentifier(n)\n                                ? 4\n                                : shouldRescanJsxText(n)\n                                    ? 5\n                                    : 0;\n                if (lastTokenInfo && expectedScanAction === lastScanAction) {\n                    return fixTokenKind(lastTokenInfo, n);\n                }\n                if (scanner.getStartPos() !== savedPos) {\n                    ts.Debug.assert(lastTokenInfo !== undefined);\n                    scanner.setTextPos(savedPos);\n                    scanner.scan();\n                }\n                var currentToken = scanner.getToken();\n                if (expectedScanAction === 1 && currentToken === 28) {\n                    currentToken = scanner.reScanGreaterToken();\n                    ts.Debug.assert(n.kind === currentToken);\n                    lastScanAction = 1;\n                }\n                else if (expectedScanAction === 2 && startsWithSlashToken(currentToken)) {\n                    currentToken = scanner.reScanSlashToken();\n                    ts.Debug.assert(n.kind === currentToken);\n                    lastScanAction = 2;\n                }\n                else if (expectedScanAction === 3 && currentToken === 17) {\n                    currentToken = scanner.reScanTemplateToken();\n                    lastScanAction = 3;\n                }\n                else if (expectedScanAction === 4 && currentToken === 70) {\n                    currentToken = scanner.scanJsxIdentifier();\n                    lastScanAction = 4;\n                }\n                else if (expectedScanAction === 5) {\n                    currentToken = scanner.reScanJsxToken();\n                    lastScanAction = 5;\n                }\n                else {\n                    lastScanAction = 0;\n                }\n                var token = {\n                    pos: scanner.getStartPos(),\n                    end: scanner.getTextPos(),\n                    kind: currentToken\n                };\n                if (trailingTrivia) {\n                    trailingTrivia = undefined;\n                }\n                while (scanner.getStartPos() < endPos) {\n                    currentToken = scanner.scan();\n                    if (!ts.isTrivia(currentToken)) {\n                        break;\n                    }\n                    var trivia = {\n                        pos: scanner.getStartPos(),\n                        end: scanner.getTextPos(),\n                        kind: currentToken\n                    };\n                    if (!trailingTrivia) {\n                        trailingTrivia = [];\n                    }\n                    trailingTrivia.push(trivia);\n                    if (currentToken === 4) {\n                        scanner.scan();\n                        break;\n                    }\n                }\n                lastTokenInfo = {\n                    leadingTrivia: leadingTrivia,\n                    trailingTrivia: trailingTrivia,\n                    token: token\n                };\n                return fixTokenKind(lastTokenInfo, n);\n            }\n            function isOnToken() {\n                ts.Debug.assert(scanner !== undefined);\n                var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken();\n                var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos();\n                return startPos < endPos && current !== 1 && !ts.isTrivia(current);\n            }\n            function fixTokenKind(tokenInfo, container) {\n                if (ts.isToken(container) && tokenInfo.token.kind !== container.kind) {\n                    tokenInfo.token.kind = container.kind;\n                }\n                return tokenInfo;\n            }\n            function skipToEndOf(node) {\n                scanner.setTextPos(node.end);\n                savedPos = scanner.getStartPos();\n                lastScanAction = undefined;\n                lastTokenInfo = undefined;\n                wasNewLine = false;\n                leadingTrivia = undefined;\n                trailingTrivia = undefined;\n            }\n        }\n        formatting.getFormattingScanner = getFormattingScanner;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var FormattingContext = (function () {\n            function FormattingContext(sourceFile, formattingRequestKind) {\n                this.sourceFile = sourceFile;\n                this.formattingRequestKind = formattingRequestKind;\n            }\n            FormattingContext.prototype.updateContext = function (currentRange, currentTokenParent, nextRange, nextTokenParent, commonParent) {\n                ts.Debug.assert(currentRange !== undefined, \"currentTokenSpan is null\");\n                ts.Debug.assert(currentTokenParent !== undefined, \"currentTokenParent is null\");\n                ts.Debug.assert(nextRange !== undefined, \"nextTokenSpan is null\");\n                ts.Debug.assert(nextTokenParent !== undefined, \"nextTokenParent is null\");\n                ts.Debug.assert(commonParent !== undefined, \"commonParent is null\");\n                this.currentTokenSpan = currentRange;\n                this.currentTokenParent = currentTokenParent;\n                this.nextTokenSpan = nextRange;\n                this.nextTokenParent = nextTokenParent;\n                this.contextNode = commonParent;\n                this.contextNodeAllOnSameLine = undefined;\n                this.nextNodeAllOnSameLine = undefined;\n                this.tokensAreOnSameLine = undefined;\n                this.contextNodeBlockIsOnOneLine = undefined;\n                this.nextNodeBlockIsOnOneLine = undefined;\n            };\n            FormattingContext.prototype.ContextNodeAllOnSameLine = function () {\n                if (this.contextNodeAllOnSameLine === undefined) {\n                    this.contextNodeAllOnSameLine = this.NodeIsOnOneLine(this.contextNode);\n                }\n                return this.contextNodeAllOnSameLine;\n            };\n            FormattingContext.prototype.NextNodeAllOnSameLine = function () {\n                if (this.nextNodeAllOnSameLine === undefined) {\n                    this.nextNodeAllOnSameLine = this.NodeIsOnOneLine(this.nextTokenParent);\n                }\n                return this.nextNodeAllOnSameLine;\n            };\n            FormattingContext.prototype.TokensAreOnSameLine = function () {\n                if (this.tokensAreOnSameLine === undefined) {\n                    var startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line;\n                    var endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line;\n                    this.tokensAreOnSameLine = (startLine === endLine);\n                }\n                return this.tokensAreOnSameLine;\n            };\n            FormattingContext.prototype.ContextNodeBlockIsOnOneLine = function () {\n                if (this.contextNodeBlockIsOnOneLine === undefined) {\n                    this.contextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.contextNode);\n                }\n                return this.contextNodeBlockIsOnOneLine;\n            };\n            FormattingContext.prototype.NextNodeBlockIsOnOneLine = function () {\n                if (this.nextNodeBlockIsOnOneLine === undefined) {\n                    this.nextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.nextTokenParent);\n                }\n                return this.nextNodeBlockIsOnOneLine;\n            };\n            FormattingContext.prototype.NodeIsOnOneLine = function (node) {\n                var startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line;\n                var endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line;\n                return startLine === endLine;\n            };\n            FormattingContext.prototype.BlockIsOnOneLine = function (node) {\n                var openBrace = ts.findChildOfKind(node, 16, this.sourceFile);\n                var closeBrace = ts.findChildOfKind(node, 17, this.sourceFile);\n                if (openBrace && closeBrace) {\n                    var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line;\n                    var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line;\n                    return startLine === endLine;\n                }\n                return false;\n            };\n            return FormattingContext;\n        }());\n        formatting.FormattingContext = FormattingContext;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var Rule = (function () {\n            function Rule(Descriptor, Operation, Flag) {\n                if (Flag === void 0) { Flag = 0; }\n                this.Descriptor = Descriptor;\n                this.Operation = Operation;\n                this.Flag = Flag;\n            }\n            Rule.prototype.toString = function () {\n                return \"[desc=\" + this.Descriptor + \",\" +\n                    \"operation=\" + this.Operation + \",\" +\n                    \"flag=\" + this.Flag + \"]\";\n            };\n            return Rule;\n        }());\n        formatting.Rule = Rule;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var RuleDescriptor = (function () {\n            function RuleDescriptor(LeftTokenRange, RightTokenRange) {\n                this.LeftTokenRange = LeftTokenRange;\n                this.RightTokenRange = RightTokenRange;\n            }\n            RuleDescriptor.prototype.toString = function () {\n                return \"[leftRange=\" + this.LeftTokenRange + \",\" +\n                    \"rightRange=\" + this.RightTokenRange + \"]\";\n            };\n            RuleDescriptor.create1 = function (left, right) {\n                return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), formatting.Shared.TokenRange.FromToken(right));\n            };\n            RuleDescriptor.create2 = function (left, right) {\n                return RuleDescriptor.create4(left, formatting.Shared.TokenRange.FromToken(right));\n            };\n            RuleDescriptor.create3 = function (left, right) {\n                return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), right);\n            };\n            RuleDescriptor.create4 = function (left, right) {\n                return new RuleDescriptor(left, right);\n            };\n            return RuleDescriptor;\n        }());\n        formatting.RuleDescriptor = RuleDescriptor;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var RuleOperation = (function () {\n            function RuleOperation(Context, Action) {\n                this.Context = Context;\n                this.Action = Action;\n            }\n            RuleOperation.prototype.toString = function () {\n                return \"[context=\" + this.Context + \",\" +\n                    \"action=\" + this.Action + \"]\";\n            };\n            RuleOperation.create1 = function (action) {\n                return RuleOperation.create2(formatting.RuleOperationContext.Any, action);\n            };\n            RuleOperation.create2 = function (context, action) {\n                return new RuleOperation(context, action);\n            };\n            return RuleOperation;\n        }());\n        formatting.RuleOperation = RuleOperation;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var RuleOperationContext = (function () {\n            function RuleOperationContext() {\n                var funcs = [];\n                for (var _i = 0; _i < arguments.length; _i++) {\n                    funcs[_i] = arguments[_i];\n                }\n                this.customContextChecks = funcs;\n            }\n            RuleOperationContext.prototype.IsAny = function () {\n                return this === RuleOperationContext.Any;\n            };\n            RuleOperationContext.prototype.InContext = function (context) {\n                if (this.IsAny()) {\n                    return true;\n                }\n                for (var _i = 0, _a = this.customContextChecks; _i < _a.length; _i++) {\n                    var check = _a[_i];\n                    if (!check(context)) {\n                        return false;\n                    }\n                }\n                return true;\n            };\n            return RuleOperationContext;\n        }());\n        RuleOperationContext.Any = new RuleOperationContext();\n        formatting.RuleOperationContext = RuleOperationContext;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var Rules = (function () {\n            function Rules() {\n                this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1));\n                this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1));\n                this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 55), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8));\n                this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8));\n                this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(55, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 2));\n                this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), 2));\n                this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));\n                this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2));\n                this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(17, 81), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));\n                this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(17, 105), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));\n                this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromTokens([19, 21, 25, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(22, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(21, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8));\n                this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments;\n                this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1);\n                this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([70, 3, 74, 83, 90]);\n                this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1);\n                this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([19, 3, 80, 101, 86, 81]);\n                this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1);\n                this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2));\n                this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2));\n                this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8));\n                this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8));\n                this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8));\n                this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4));\n                this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4));\n                this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8));\n                this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(42, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(43, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 42), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 43), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(42, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));\n                this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(36, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));\n                this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(36, 42), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));\n                this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(43, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));\n                this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(37, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));\n                this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(37, 43), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));\n                this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([103, 99, 93, 79, 95, 102, 120]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));\n                this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([109, 75]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2));\n                this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8));\n                this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(88, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2));\n                this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8));\n                this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(104, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2));\n                this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(95, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([19, 80, 81, 72]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNotForContext), 2));\n                this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([101, 86]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));\n                this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124, 133]), 70), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2));\n                this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));\n                this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));\n                this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([127, 131]), 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116, 74, 123, 78, 82, 83, 84, 124, 107, 90, 108, 127, 128, 111, 113, 112, 133, 114, 136, 138]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));\n                this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84, 107, 138])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));\n                this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2));\n                this.SpaceBeforeArrow = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));\n                this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(35, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));\n                this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(23, 70), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.FromTokens([19, 25])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8));\n                this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 26), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8));\n                this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(19, 26), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8));\n                this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(26, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8));\n                this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 28), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8));\n                this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(28, formatting.Shared.TokenRange.FromTokens([18, 20, 28, 25])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8));\n                this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectTypeContext), 8));\n                this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 56), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));\n                this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(56, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116, 70, 83, 78, 74, 114, 113, 111, 112, 124, 133, 20, 38])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2));\n                this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(88, 38), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8));\n                this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(38, formatting.Shared.TokenRange.FromTokens([70, 18])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2));\n                this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(115, 38), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8));\n                this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([115, 38]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2));\n                this.SpaceBetweenAsyncAndOpenParen = new formatting.Rule(formatting.RuleDescriptor.create1(119, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsNonJsxSameLineTokenContext), 2));\n                this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(119, 88), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));\n                this.NoSpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(70, formatting.Shared.TokenRange.FromTokens([12, 13])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.SpaceBeforeJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 70), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNextTokenParentJsxAttribute, Rules.IsNonJsxSameLineTokenContext), 2));\n                this.SpaceBeforeSlashInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 40), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 2));\n                this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create1(40, 28), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 8));\n                this.NoSpaceBeforeEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 57), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8));\n                this.NoSpaceAfterEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create3(57, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8));\n                this.HighPriorityCommonRules = [\n                    this.IgnoreBeforeComment, this.IgnoreAfterLineComment,\n                    this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator,\n                    this.NoSpaceAfterQuestionMark,\n                    this.NoSpaceBeforeDot, this.NoSpaceAfterDot,\n                    this.NoSpaceAfterUnaryPrefixOperator,\n                    this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator,\n                    this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator,\n                    this.SpaceAfterPostincrementWhenFollowedByAdd,\n                    this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement,\n                    this.SpaceAfterPostdecrementWhenFollowedBySubtract,\n                    this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement,\n                    this.NoSpaceAfterCloseBrace,\n                    this.NewLineBeforeCloseBraceInBlockContext,\n                    this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets,\n                    this.NoSpaceBetweenFunctionKeywordAndStar, this.SpaceAfterStarInGeneratorDeclaration,\n                    this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember,\n                    this.NoSpaceBetweenYieldKeywordAndStar, this.SpaceBetweenYieldOrYieldStarAndOperand,\n                    this.NoSpaceBetweenReturnAndSemicolon,\n                    this.SpaceAfterCertainKeywords,\n                    this.SpaceAfterLetConstInVariableDeclaration,\n                    this.NoSpaceBeforeOpenParenInFuncCall,\n                    this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator,\n                    this.SpaceAfterVoidOperator,\n                    this.SpaceBetweenAsyncAndOpenParen, this.SpaceBetweenAsyncAndFunctionKeyword,\n                    this.NoSpaceBetweenTagAndTemplateString,\n                    this.SpaceBeforeJsxAttribute, this.SpaceBeforeSlashInJsxOpeningElement, this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement,\n                    this.NoSpaceBeforeEqualInJsxAttribute, this.NoSpaceAfterEqualInJsxAttribute,\n                    this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport,\n                    this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords,\n                    this.SpaceAfterModuleName,\n                    this.SpaceBeforeArrow, this.SpaceAfterArrow,\n                    this.NoSpaceAfterEllipsis,\n                    this.NoSpaceAfterOptionalParameters,\n                    this.NoSpaceBetweenEmptyInterfaceBraceBrackets,\n                    this.NoSpaceBeforeOpenAngularBracket,\n                    this.NoSpaceBetweenCloseParenAndAngularBracket,\n                    this.NoSpaceAfterOpenAngularBracket,\n                    this.NoSpaceBeforeCloseAngularBracket,\n                    this.NoSpaceAfterCloseAngularBracket,\n                    this.SpaceBeforeAt,\n                    this.NoSpaceAfterAt,\n                    this.SpaceAfterDecorator,\n                ];\n                this.LowPriorityCommonRules = [\n                    this.NoSpaceBeforeSemicolon,\n                    this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock,\n                    this.NoSpaceBeforeComma,\n                    this.NoSpaceBeforeOpenBracket,\n                    this.NoSpaceAfterCloseBracket,\n                    this.SpaceAfterSemicolon,\n                    this.NoSpaceBeforeOpenParenInFuncDecl,\n                    this.SpaceBetweenStatements, this.SpaceAfterTryFinally\n                ];\n                this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNextTokenNotCloseBracket), 2));\n                this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext), 8));\n                this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));\n                this.SpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2));\n                this.NoSpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8));\n                this.NoSpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8));\n                this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2));\n                this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8));\n                this.NewLineBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 4), 1);\n                this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 4), 1);\n                this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4), 1);\n                this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 2));\n                this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 8));\n                this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(18, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));\n                this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));\n                this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(18, 19), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(18, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.SpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));\n                this.SpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));\n                this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(20, 21), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.NoSpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([13, 14]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.SpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([13, 14]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));\n                this.NoSpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([14, 15])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8));\n                this.SpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([14, 15])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2));\n                this.NoSpaceAfterOpenBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 8));\n                this.SpaceAfterOpenBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 2));\n                this.NoSpaceBeforeCloseBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 8));\n                this.SpaceBeforeCloseBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 2));\n                this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(88, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2));\n                this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(88, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8));\n                this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(28, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), 8));\n                this.SpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(28, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), 2));\n            }\n            Rules.prototype.getRuleName = function (rule) {\n                var o = this;\n                for (var name_49 in o) {\n                    if (o[name_49] === rule) {\n                        return name_49;\n                    }\n                }\n                throw new Error(\"Unknown rule\");\n            };\n            Rules.IsForContext = function (context) {\n                return context.contextNode.kind === 211;\n            };\n            Rules.IsNotForContext = function (context) {\n                return !Rules.IsForContext(context);\n            };\n            Rules.IsBinaryOpContext = function (context) {\n                switch (context.contextNode.kind) {\n                    case 192:\n                    case 193:\n                    case 200:\n                    case 243:\n                    case 239:\n                    case 156:\n                    case 164:\n                    case 165:\n                        return true;\n                    case 174:\n                    case 228:\n                    case 234:\n                    case 223:\n                    case 144:\n                    case 260:\n                    case 147:\n                    case 146:\n                        return context.currentTokenSpan.kind === 57 || context.nextTokenSpan.kind === 57;\n                    case 212:\n                        return context.currentTokenSpan.kind === 91 || context.nextTokenSpan.kind === 91;\n                    case 213:\n                        return context.currentTokenSpan.kind === 140 || context.nextTokenSpan.kind === 140;\n                }\n                return false;\n            };\n            Rules.IsNotBinaryOpContext = function (context) {\n                return !Rules.IsBinaryOpContext(context);\n            };\n            Rules.IsConditionalOperatorContext = function (context) {\n                return context.contextNode.kind === 193;\n            };\n            Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) {\n                return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context);\n            };\n            Rules.IsBeforeMultilineBlockContext = function (context) {\n                return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine());\n            };\n            Rules.IsMultilineBlockContext = function (context) {\n                return Rules.IsBlockContext(context) && !(context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine());\n            };\n            Rules.IsSingleLineBlockContext = function (context) {\n                return Rules.IsBlockContext(context) && (context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine());\n            };\n            Rules.IsBlockContext = function (context) {\n                return Rules.NodeIsBlockContext(context.contextNode);\n            };\n            Rules.IsBeforeBlockContext = function (context) {\n                return Rules.NodeIsBlockContext(context.nextTokenParent);\n            };\n            Rules.NodeIsBlockContext = function (node) {\n                if (Rules.NodeIsTypeScriptDeclWithBlockContext(node)) {\n                    return true;\n                }\n                switch (node.kind) {\n                    case 204:\n                    case 232:\n                    case 176:\n                    case 231:\n                        return true;\n                }\n                return false;\n            };\n            Rules.IsFunctionDeclContext = function (context) {\n                switch (context.contextNode.kind) {\n                    case 225:\n                    case 149:\n                    case 148:\n                    case 151:\n                    case 152:\n                    case 153:\n                    case 184:\n                    case 150:\n                    case 185:\n                    case 227:\n                        return true;\n                }\n                return false;\n            };\n            Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) {\n                return context.contextNode.kind === 225 || context.contextNode.kind === 184;\n            };\n            Rules.IsTypeScriptDeclWithBlockContext = function (context) {\n                return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode);\n            };\n            Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) {\n                switch (node.kind) {\n                    case 226:\n                    case 197:\n                    case 227:\n                    case 229:\n                    case 161:\n                    case 230:\n                    case 241:\n                    case 242:\n                    case 235:\n                    case 238:\n                        return true;\n                }\n                return false;\n            };\n            Rules.IsAfterCodeBlockContext = function (context) {\n                switch (context.currentTokenParent.kind) {\n                    case 226:\n                    case 230:\n                    case 229:\n                    case 204:\n                    case 256:\n                    case 231:\n                    case 218:\n                        return true;\n                }\n                return false;\n            };\n            Rules.IsControlDeclContext = function (context) {\n                switch (context.contextNode.kind) {\n                    case 208:\n                    case 218:\n                    case 211:\n                    case 212:\n                    case 213:\n                    case 210:\n                    case 221:\n                    case 209:\n                    case 217:\n                    case 256:\n                        return true;\n                    default:\n                        return false;\n                }\n            };\n            Rules.IsObjectContext = function (context) {\n                return context.contextNode.kind === 176;\n            };\n            Rules.IsFunctionCallContext = function (context) {\n                return context.contextNode.kind === 179;\n            };\n            Rules.IsNewContext = function (context) {\n                return context.contextNode.kind === 180;\n            };\n            Rules.IsFunctionCallOrNewContext = function (context) {\n                return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context);\n            };\n            Rules.IsPreviousTokenNotComma = function (context) {\n                return context.currentTokenSpan.kind !== 25;\n            };\n            Rules.IsNextTokenNotCloseBracket = function (context) {\n                return context.nextTokenSpan.kind !== 21;\n            };\n            Rules.IsArrowFunctionContext = function (context) {\n                return context.contextNode.kind === 185;\n            };\n            Rules.IsNonJsxSameLineTokenContext = function (context) {\n                return context.TokensAreOnSameLine() && context.contextNode.kind !== 10;\n            };\n            Rules.IsNonJsxElementContext = function (context) {\n                return context.contextNode.kind !== 246;\n            };\n            Rules.IsJsxExpressionContext = function (context) {\n                return context.contextNode.kind === 252;\n            };\n            Rules.IsNextTokenParentJsxAttribute = function (context) {\n                return context.nextTokenParent.kind === 250;\n            };\n            Rules.IsJsxAttributeContext = function (context) {\n                return context.contextNode.kind === 250;\n            };\n            Rules.IsJsxSelfClosingElementContext = function (context) {\n                return context.contextNode.kind === 247;\n            };\n            Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) {\n                return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context);\n            };\n            Rules.IsEndOfDecoratorContextOnSameLine = function (context) {\n                return context.TokensAreOnSameLine() &&\n                    context.contextNode.decorators &&\n                    Rules.NodeIsInDecoratorContext(context.currentTokenParent) &&\n                    !Rules.NodeIsInDecoratorContext(context.nextTokenParent);\n            };\n            Rules.NodeIsInDecoratorContext = function (node) {\n                while (ts.isPartOfExpression(node)) {\n                    node = node.parent;\n                }\n                return node.kind === 145;\n            };\n            Rules.IsStartOfVariableDeclarationList = function (context) {\n                return context.currentTokenParent.kind === 224 &&\n                    context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos;\n            };\n            Rules.IsNotFormatOnEnter = function (context) {\n                return context.formattingRequestKind !== 2;\n            };\n            Rules.IsModuleDeclContext = function (context) {\n                return context.contextNode.kind === 230;\n            };\n            Rules.IsObjectTypeContext = function (context) {\n                return context.contextNode.kind === 161;\n            };\n            Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) {\n                if (token.kind !== 26 && token.kind !== 28) {\n                    return false;\n                }\n                switch (parent.kind) {\n                    case 157:\n                    case 182:\n                    case 226:\n                    case 197:\n                    case 227:\n                    case 225:\n                    case 184:\n                    case 185:\n                    case 149:\n                    case 148:\n                    case 153:\n                    case 154:\n                    case 179:\n                    case 180:\n                    case 199:\n                        return true;\n                    default:\n                        return false;\n                }\n            };\n            Rules.IsTypeArgumentOrParameterOrAssertionContext = function (context) {\n                return Rules.IsTypeArgumentOrParameterOrAssertion(context.currentTokenSpan, context.currentTokenParent) ||\n                    Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent);\n            };\n            Rules.IsTypeAssertionContext = function (context) {\n                return context.contextNode.kind === 182;\n            };\n            Rules.IsVoidOpContext = function (context) {\n                return context.currentTokenSpan.kind === 104 && context.currentTokenParent.kind === 188;\n            };\n            Rules.IsYieldOrYieldStarWithOperand = function (context) {\n                return context.contextNode.kind === 195 && context.contextNode.expression !== undefined;\n            };\n            return Rules;\n        }());\n        formatting.Rules = Rules;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var RulesMap = (function () {\n            function RulesMap() {\n                this.map = [];\n                this.mapRowLength = 0;\n            }\n            RulesMap.create = function (rules) {\n                var result = new RulesMap();\n                result.Initialize(rules);\n                return result;\n            };\n            RulesMap.prototype.Initialize = function (rules) {\n                this.mapRowLength = 140 + 1;\n                this.map = new Array(this.mapRowLength * this.mapRowLength);\n                var rulesBucketConstructionStateList = new Array(this.map.length);\n                this.FillRules(rules, rulesBucketConstructionStateList);\n                return this.map;\n            };\n            RulesMap.prototype.FillRules = function (rules, rulesBucketConstructionStateList) {\n                var _this = this;\n                rules.forEach(function (rule) {\n                    _this.FillRule(rule, rulesBucketConstructionStateList);\n                });\n            };\n            RulesMap.prototype.GetRuleBucketIndex = function (row, column) {\n                ts.Debug.assert(row <= 140 && column <= 140, \"Must compute formatting context from tokens\");\n                var rulesBucketIndex = (row * this.mapRowLength) + column;\n                return rulesBucketIndex;\n            };\n            RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) {\n                var _this = this;\n                var specificRule = rule.Descriptor.LeftTokenRange !== formatting.Shared.TokenRange.Any &&\n                    rule.Descriptor.RightTokenRange !== formatting.Shared.TokenRange.Any;\n                rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) {\n                    rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) {\n                        var rulesBucketIndex = _this.GetRuleBucketIndex(left, right);\n                        var rulesBucket = _this.map[rulesBucketIndex];\n                        if (rulesBucket === undefined) {\n                            rulesBucket = _this.map[rulesBucketIndex] = new RulesBucket();\n                        }\n                        rulesBucket.AddRule(rule, specificRule, rulesBucketConstructionStateList, rulesBucketIndex);\n                    });\n                });\n            };\n            RulesMap.prototype.GetRule = function (context) {\n                var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind);\n                var bucket = this.map[bucketIndex];\n                if (bucket) {\n                    for (var _i = 0, _a = bucket.Rules(); _i < _a.length; _i++) {\n                        var rule = _a[_i];\n                        if (rule.Operation.Context.InContext(context)) {\n                            return rule;\n                        }\n                    }\n                }\n                return undefined;\n            };\n            return RulesMap;\n        }());\n        formatting.RulesMap = RulesMap;\n        var MaskBitSize = 5;\n        var Mask = 0x1f;\n        var RulesPosition;\n        (function (RulesPosition) {\n            RulesPosition[RulesPosition[\"IgnoreRulesSpecific\"] = 0] = \"IgnoreRulesSpecific\";\n            RulesPosition[RulesPosition[\"IgnoreRulesAny\"] = MaskBitSize * 1] = \"IgnoreRulesAny\";\n            RulesPosition[RulesPosition[\"ContextRulesSpecific\"] = MaskBitSize * 2] = \"ContextRulesSpecific\";\n            RulesPosition[RulesPosition[\"ContextRulesAny\"] = MaskBitSize * 3] = \"ContextRulesAny\";\n            RulesPosition[RulesPosition[\"NoContextRulesSpecific\"] = MaskBitSize * 4] = \"NoContextRulesSpecific\";\n            RulesPosition[RulesPosition[\"NoContextRulesAny\"] = MaskBitSize * 5] = \"NoContextRulesAny\";\n        })(RulesPosition = formatting.RulesPosition || (formatting.RulesPosition = {}));\n        var RulesBucketConstructionState = (function () {\n            function RulesBucketConstructionState() {\n                this.rulesInsertionIndexBitmap = 0;\n            }\n            RulesBucketConstructionState.prototype.GetInsertionIndex = function (maskPosition) {\n                var index = 0;\n                var pos = 0;\n                var indexBitmap = this.rulesInsertionIndexBitmap;\n                while (pos <= maskPosition) {\n                    index += (indexBitmap & Mask);\n                    indexBitmap >>= MaskBitSize;\n                    pos += MaskBitSize;\n                }\n                return index;\n            };\n            RulesBucketConstructionState.prototype.IncreaseInsertionIndex = function (maskPosition) {\n                var value = (this.rulesInsertionIndexBitmap >> maskPosition) & Mask;\n                value++;\n                ts.Debug.assert((value & Mask) === value, \"Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules.\");\n                var temp = this.rulesInsertionIndexBitmap & ~(Mask << maskPosition);\n                temp |= value << maskPosition;\n                this.rulesInsertionIndexBitmap = temp;\n            };\n            return RulesBucketConstructionState;\n        }());\n        formatting.RulesBucketConstructionState = RulesBucketConstructionState;\n        var RulesBucket = (function () {\n            function RulesBucket() {\n                this.rules = [];\n            }\n            RulesBucket.prototype.Rules = function () {\n                return this.rules;\n            };\n            RulesBucket.prototype.AddRule = function (rule, specificTokens, constructionState, rulesBucketIndex) {\n                var position;\n                if (rule.Operation.Action === 1) {\n                    position = specificTokens ?\n                        RulesPosition.IgnoreRulesSpecific :\n                        RulesPosition.IgnoreRulesAny;\n                }\n                else if (!rule.Operation.Context.IsAny()) {\n                    position = specificTokens ?\n                        RulesPosition.ContextRulesSpecific :\n                        RulesPosition.ContextRulesAny;\n                }\n                else {\n                    position = specificTokens ?\n                        RulesPosition.NoContextRulesSpecific :\n                        RulesPosition.NoContextRulesAny;\n                }\n                var state = constructionState[rulesBucketIndex];\n                if (state === undefined) {\n                    state = constructionState[rulesBucketIndex] = new RulesBucketConstructionState();\n                }\n                var index = state.GetInsertionIndex(position);\n                this.rules.splice(index, 0, rule);\n                state.IncreaseInsertionIndex(position);\n            };\n            return RulesBucket;\n        }());\n        formatting.RulesBucket = RulesBucket;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var Shared;\n        (function (Shared) {\n            var TokenRangeAccess = (function () {\n                function TokenRangeAccess(from, to, except) {\n                    this.tokens = [];\n                    for (var token = from; token <= to; token++) {\n                        if (ts.indexOf(except, token) < 0) {\n                            this.tokens.push(token);\n                        }\n                    }\n                }\n                TokenRangeAccess.prototype.GetTokens = function () {\n                    return this.tokens;\n                };\n                TokenRangeAccess.prototype.Contains = function (token) {\n                    return this.tokens.indexOf(token) >= 0;\n                };\n                return TokenRangeAccess;\n            }());\n            Shared.TokenRangeAccess = TokenRangeAccess;\n            var TokenValuesAccess = (function () {\n                function TokenValuesAccess(tks) {\n                    this.tokens = tks && tks.length ? tks : [];\n                }\n                TokenValuesAccess.prototype.GetTokens = function () {\n                    return this.tokens;\n                };\n                TokenValuesAccess.prototype.Contains = function (token) {\n                    return this.tokens.indexOf(token) >= 0;\n                };\n                return TokenValuesAccess;\n            }());\n            Shared.TokenValuesAccess = TokenValuesAccess;\n            var TokenSingleValueAccess = (function () {\n                function TokenSingleValueAccess(token) {\n                    this.token = token;\n                }\n                TokenSingleValueAccess.prototype.GetTokens = function () {\n                    return [this.token];\n                };\n                TokenSingleValueAccess.prototype.Contains = function (tokenValue) {\n                    return tokenValue === this.token;\n                };\n                return TokenSingleValueAccess;\n            }());\n            Shared.TokenSingleValueAccess = TokenSingleValueAccess;\n            var TokenAllAccess = (function () {\n                function TokenAllAccess() {\n                }\n                TokenAllAccess.prototype.GetTokens = function () {\n                    var result = [];\n                    for (var token = 0; token <= 140; token++) {\n                        result.push(token);\n                    }\n                    return result;\n                };\n                TokenAllAccess.prototype.Contains = function () {\n                    return true;\n                };\n                TokenAllAccess.prototype.toString = function () {\n                    return \"[allTokens]\";\n                };\n                return TokenAllAccess;\n            }());\n            Shared.TokenAllAccess = TokenAllAccess;\n            var TokenRange = (function () {\n                function TokenRange(tokenAccess) {\n                    this.tokenAccess = tokenAccess;\n                }\n                TokenRange.FromToken = function (token) {\n                    return new TokenRange(new TokenSingleValueAccess(token));\n                };\n                TokenRange.FromTokens = function (tokens) {\n                    return new TokenRange(new TokenValuesAccess(tokens));\n                };\n                TokenRange.FromRange = function (f, to, except) {\n                    if (except === void 0) { except = []; }\n                    return new TokenRange(new TokenRangeAccess(f, to, except));\n                };\n                TokenRange.AllTokens = function () {\n                    return new TokenRange(new TokenAllAccess());\n                };\n                TokenRange.prototype.GetTokens = function () {\n                    return this.tokenAccess.GetTokens();\n                };\n                TokenRange.prototype.Contains = function (token) {\n                    return this.tokenAccess.Contains(token);\n                };\n                TokenRange.prototype.toString = function () {\n                    return this.tokenAccess.toString();\n                };\n                return TokenRange;\n            }());\n            TokenRange.Any = TokenRange.AllTokens();\n            TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3]));\n            TokenRange.Keywords = TokenRange.FromRange(71, 140);\n            TokenRange.BinaryOperators = TokenRange.FromRange(26, 69);\n            TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91, 92, 140, 117, 125]);\n            TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([42, 43, 51, 50]);\n            TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8, 70, 18, 20, 16, 98, 93]);\n            TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([70, 18, 98, 93]);\n            TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([70, 19, 21, 93]);\n            TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([70, 18, 98, 93]);\n            TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([70, 19, 21, 93]);\n            TokenRange.Comments = TokenRange.FromTokens([2, 3]);\n            TokenRange.TypeNames = TokenRange.FromTokens([70, 132, 134, 121, 135, 104, 118]);\n            Shared.TokenRange = TokenRange;\n        })(Shared = formatting.Shared || (formatting.Shared = {}));\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var RulesProvider = (function () {\n            function RulesProvider() {\n                this.globalRules = new formatting.Rules();\n            }\n            RulesProvider.prototype.getRuleName = function (rule) {\n                return this.globalRules.getRuleName(rule);\n            };\n            RulesProvider.prototype.getRuleByName = function (name) {\n                return this.globalRules[name];\n            };\n            RulesProvider.prototype.getRulesMap = function () {\n                return this.rulesMap;\n            };\n            RulesProvider.prototype.ensureUpToDate = function (options) {\n                if (!this.options || !ts.compareDataObjects(this.options, options)) {\n                    var activeRules = this.createActiveRules(options);\n                    var rulesMap = formatting.RulesMap.create(activeRules);\n                    this.activeRules = activeRules;\n                    this.rulesMap = rulesMap;\n                    this.options = ts.clone(options);\n                }\n            };\n            RulesProvider.prototype.createActiveRules = function (options) {\n                var rules = this.globalRules.HighPriorityCommonRules.slice(0);\n                if (options.insertSpaceAfterCommaDelimiter) {\n                    rules.push(this.globalRules.SpaceAfterComma);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterComma);\n                }\n                if (options.insertSpaceAfterFunctionKeywordForAnonymousFunctions) {\n                    rules.push(this.globalRules.SpaceAfterAnonymousFunctionKeyword);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterAnonymousFunctionKeyword);\n                }\n                if (options.insertSpaceAfterKeywordsInControlFlowStatements) {\n                    rules.push(this.globalRules.SpaceAfterKeywordInControl);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterKeywordInControl);\n                }\n                if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis) {\n                    rules.push(this.globalRules.SpaceAfterOpenParen);\n                    rules.push(this.globalRules.SpaceBeforeCloseParen);\n                    rules.push(this.globalRules.NoSpaceBetweenParens);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterOpenParen);\n                    rules.push(this.globalRules.NoSpaceBeforeCloseParen);\n                    rules.push(this.globalRules.NoSpaceBetweenParens);\n                }\n                if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets) {\n                    rules.push(this.globalRules.SpaceAfterOpenBracket);\n                    rules.push(this.globalRules.SpaceBeforeCloseBracket);\n                    rules.push(this.globalRules.NoSpaceBetweenBrackets);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterOpenBracket);\n                    rules.push(this.globalRules.NoSpaceBeforeCloseBracket);\n                    rules.push(this.globalRules.NoSpaceBetweenBrackets);\n                }\n                if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces !== false) {\n                    rules.push(this.globalRules.SpaceAfterOpenBrace);\n                    rules.push(this.globalRules.SpaceBeforeCloseBrace);\n                    rules.push(this.globalRules.NoSpaceBetweenEmptyBraceBrackets);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterOpenBrace);\n                    rules.push(this.globalRules.NoSpaceBeforeCloseBrace);\n                    rules.push(this.globalRules.NoSpaceBetweenEmptyBraceBrackets);\n                }\n                if (options.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces) {\n                    rules.push(this.globalRules.SpaceAfterTemplateHeadAndMiddle);\n                    rules.push(this.globalRules.SpaceBeforeTemplateMiddleAndTail);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterTemplateHeadAndMiddle);\n                    rules.push(this.globalRules.NoSpaceBeforeTemplateMiddleAndTail);\n                }\n                if (options.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces) {\n                    rules.push(this.globalRules.SpaceAfterOpenBraceInJsxExpression);\n                    rules.push(this.globalRules.SpaceBeforeCloseBraceInJsxExpression);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterOpenBraceInJsxExpression);\n                    rules.push(this.globalRules.NoSpaceBeforeCloseBraceInJsxExpression);\n                }\n                if (options.insertSpaceAfterSemicolonInForStatements) {\n                    rules.push(this.globalRules.SpaceAfterSemicolonInFor);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterSemicolonInFor);\n                }\n                if (options.insertSpaceBeforeAndAfterBinaryOperators) {\n                    rules.push(this.globalRules.SpaceBeforeBinaryOperator);\n                    rules.push(this.globalRules.SpaceAfterBinaryOperator);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceBeforeBinaryOperator);\n                    rules.push(this.globalRules.NoSpaceAfterBinaryOperator);\n                }\n                if (options.placeOpenBraceOnNewLineForControlBlocks) {\n                    rules.push(this.globalRules.NewLineBeforeOpenBraceInControl);\n                }\n                if (options.placeOpenBraceOnNewLineForFunctions) {\n                    rules.push(this.globalRules.NewLineBeforeOpenBraceInFunction);\n                    rules.push(this.globalRules.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock);\n                }\n                if (options.insertSpaceAfterTypeAssertion) {\n                    rules.push(this.globalRules.SpaceAfterTypeAssertion);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterTypeAssertion);\n                }\n                rules = rules.concat(this.globalRules.LowPriorityCommonRules);\n                return rules;\n            };\n            return RulesProvider;\n        }());\n        formatting.RulesProvider = RulesProvider;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        function formatOnEnter(position, sourceFile, rulesProvider, options) {\n            var line = sourceFile.getLineAndCharacterOfPosition(position).line;\n            if (line === 0) {\n                return [];\n            }\n            var endOfFormatSpan = ts.getEndLinePosition(line, sourceFile);\n            while (ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(endOfFormatSpan))) {\n                endOfFormatSpan--;\n            }\n            if (ts.isLineBreak(sourceFile.text.charCodeAt(endOfFormatSpan))) {\n                endOfFormatSpan--;\n            }\n            var span = {\n                pos: ts.getStartPositionOfLine(line - 1, sourceFile),\n                end: endOfFormatSpan + 1\n            };\n            return formatSpan(span, sourceFile, options, rulesProvider, 2);\n        }\n        formatting.formatOnEnter = formatOnEnter;\n        function formatOnSemicolon(position, sourceFile, rulesProvider, options) {\n            return formatOutermostParent(position, 24, sourceFile, options, rulesProvider, 3);\n        }\n        formatting.formatOnSemicolon = formatOnSemicolon;\n        function formatOnClosingCurly(position, sourceFile, rulesProvider, options) {\n            return formatOutermostParent(position, 17, sourceFile, options, rulesProvider, 4);\n        }\n        formatting.formatOnClosingCurly = formatOnClosingCurly;\n        function formatDocument(sourceFile, rulesProvider, options) {\n            var span = {\n                pos: 0,\n                end: sourceFile.text.length\n            };\n            return formatSpan(span, sourceFile, options, rulesProvider, 0);\n        }\n        formatting.formatDocument = formatDocument;\n        function formatSelection(start, end, sourceFile, rulesProvider, options) {\n            var span = {\n                pos: ts.getLineStartPositionForPosition(start, sourceFile),\n                end: end\n            };\n            return formatSpan(span, sourceFile, options, rulesProvider, 1);\n        }\n        formatting.formatSelection = formatSelection;\n        function formatOutermostParent(position, expectedLastToken, sourceFile, options, rulesProvider, requestKind) {\n            var parent = findOutermostParent(position, expectedLastToken, sourceFile);\n            if (!parent) {\n                return [];\n            }\n            var span = {\n                pos: ts.getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile),\n                end: parent.end\n            };\n            return formatSpan(span, sourceFile, options, rulesProvider, requestKind);\n        }\n        function findOutermostParent(position, expectedTokenKind, sourceFile) {\n            var precedingToken = ts.findPrecedingToken(position, sourceFile);\n            if (!precedingToken ||\n                precedingToken.kind !== expectedTokenKind ||\n                position !== precedingToken.getEnd()) {\n                return undefined;\n            }\n            var current = precedingToken;\n            while (current &&\n                current.parent &&\n                current.parent.end === precedingToken.end &&\n                !isListElement(current.parent, current)) {\n                current = current.parent;\n            }\n            return current;\n        }\n        function isListElement(parent, node) {\n            switch (parent.kind) {\n                case 226:\n                case 227:\n                    return ts.rangeContainsRange(parent.members, node);\n                case 230:\n                    var body = parent.body;\n                    return body && body.kind === 231 && ts.rangeContainsRange(body.statements, node);\n                case 261:\n                case 204:\n                case 231:\n                    return ts.rangeContainsRange(parent.statements, node);\n                case 256:\n                    return ts.rangeContainsRange(parent.block.statements, node);\n            }\n            return false;\n        }\n        function findEnclosingNode(range, sourceFile) {\n            return find(sourceFile);\n            function find(n) {\n                var candidate = ts.forEachChild(n, function (c) { return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; });\n                if (candidate) {\n                    var result = find(candidate);\n                    if (result) {\n                        return result;\n                    }\n                }\n                return n;\n            }\n        }\n        function prepareRangeContainsErrorFunction(errors, originalRange) {\n            if (!errors.length) {\n                return rangeHasNoErrors;\n            }\n            var sorted = errors\n                .filter(function (d) { return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); })\n                .sort(function (e1, e2) { return e1.start - e2.start; });\n            if (!sorted.length) {\n                return rangeHasNoErrors;\n            }\n            var index = 0;\n            return function (r) {\n                while (true) {\n                    if (index >= sorted.length) {\n                        return false;\n                    }\n                    var error = sorted[index];\n                    if (r.end <= error.start) {\n                        return false;\n                    }\n                    if (ts.startEndOverlapsWithStartEnd(r.pos, r.end, error.start, error.start + error.length)) {\n                        return true;\n                    }\n                    index++;\n                }\n            };\n            function rangeHasNoErrors() {\n                return false;\n            }\n        }\n        function getScanStartPosition(enclosingNode, originalRange, sourceFile) {\n            var start = enclosingNode.getStart(sourceFile);\n            if (start === originalRange.pos && enclosingNode.end === originalRange.end) {\n                return start;\n            }\n            var precedingToken = ts.findPrecedingToken(originalRange.pos, sourceFile);\n            if (!precedingToken) {\n                return enclosingNode.pos;\n            }\n            if (precedingToken.end >= originalRange.pos) {\n                return enclosingNode.pos;\n            }\n            return precedingToken.end;\n        }\n        function getOwnOrInheritedDelta(n, options, sourceFile) {\n            var previousLine = -1;\n            var child;\n            while (n) {\n                var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line;\n                if (previousLine !== -1 && line !== previousLine) {\n                    break;\n                }\n                if (formatting.SmartIndenter.shouldIndentChildNode(n, child)) {\n                    return options.indentSize;\n                }\n                previousLine = line;\n                child = n;\n                n = n.parent;\n            }\n            return 0;\n        }\n        function formatSpan(originalRange, sourceFile, options, rulesProvider, requestKind) {\n            var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange);\n            var formattingContext = new formatting.FormattingContext(sourceFile, requestKind);\n            var enclosingNode = findEnclosingNode(originalRange, sourceFile);\n            var formattingScanner = formatting.getFormattingScanner(sourceFile, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end);\n            var initialIndentation = formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options);\n            var previousRangeHasError;\n            var previousRange;\n            var previousParent;\n            var previousRangeStartLine;\n            var lastIndentedLine;\n            var indentationOnLastIndentedLine;\n            var edits = [];\n            formattingScanner.advance();\n            if (formattingScanner.isOnToken()) {\n                var startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line;\n                var undecoratedStartLine = startLine;\n                if (enclosingNode.decorators) {\n                    undecoratedStartLine = sourceFile.getLineAndCharacterOfPosition(ts.getNonDecoratorTokenPosOfNode(enclosingNode, sourceFile)).line;\n                }\n                var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile);\n                processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta);\n            }\n            if (!formattingScanner.isOnToken()) {\n                var leadingTrivia = formattingScanner.getCurrentLeadingTrivia();\n                if (leadingTrivia) {\n                    processTrivia(leadingTrivia, enclosingNode, enclosingNode, undefined);\n                    trimTrailingWhitespacesForRemainingRange();\n                }\n            }\n            formattingScanner.close();\n            return edits;\n            function tryComputeIndentationForListItem(startPos, endPos, parentStartLine, range, inheritedIndentation) {\n                if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos) ||\n                    ts.rangeContainsStartEnd(range, startPos, endPos)) {\n                    if (inheritedIndentation !== -1) {\n                        return inheritedIndentation;\n                    }\n                }\n                else {\n                    var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line;\n                    var startLinePosition = ts.getLineStartPositionForPosition(startPos, sourceFile);\n                    var column = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options);\n                    if (startLine !== parentStartLine || startPos === column) {\n                        var baseIndentSize = formatting.SmartIndenter.getBaseIndentation(options);\n                        return baseIndentSize > column ? baseIndentSize : column;\n                    }\n                }\n                return -1;\n            }\n            function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) {\n                var indentation = inheritedIndentation;\n                var delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.indentSize : 0;\n                if (effectiveParentStartLine === startLine) {\n                    indentation = startLine === lastIndentedLine\n                        ? indentationOnLastIndentedLine\n                        : parentDynamicIndentation.getIndentation();\n                    delta = Math.min(options.indentSize, parentDynamicIndentation.getDelta(node) + delta);\n                }\n                else if (indentation === -1) {\n                    if (formatting.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) {\n                        indentation = parentDynamicIndentation.getIndentation();\n                    }\n                    else {\n                        indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(node);\n                    }\n                }\n                return {\n                    indentation: indentation,\n                    delta: delta\n                };\n            }\n            function getFirstNonDecoratorTokenOfNode(node) {\n                if (node.modifiers && node.modifiers.length) {\n                    return node.modifiers[0].kind;\n                }\n                switch (node.kind) {\n                    case 226: return 74;\n                    case 227: return 108;\n                    case 225: return 88;\n                    case 229: return 229;\n                    case 151: return 124;\n                    case 152: return 133;\n                    case 149:\n                        if (node.asteriskToken) {\n                            return 38;\n                        }\n                    case 147:\n                    case 144:\n                        return node.name.kind;\n                }\n            }\n            function getDynamicIndentation(node, nodeStartLine, indentation, delta) {\n                return {\n                    getIndentationForComment: function (kind, tokenIndentation, container) {\n                        switch (kind) {\n                            case 17:\n                            case 21:\n                            case 19:\n                                return indentation + getEffectiveDelta(delta, container);\n                        }\n                        return tokenIndentation !== -1 ? tokenIndentation : indentation;\n                    },\n                    getIndentationForToken: function (line, kind, container) {\n                        if (nodeStartLine !== line && node.decorators) {\n                            if (kind === getFirstNonDecoratorTokenOfNode(node)) {\n                                return indentation;\n                            }\n                        }\n                        switch (kind) {\n                            case 16:\n                            case 17:\n                            case 20:\n                            case 21:\n                            case 18:\n                            case 19:\n                            case 81:\n                            case 105:\n                            case 56:\n                                return indentation;\n                            default:\n                                return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation;\n                        }\n                    },\n                    getIndentation: function () { return indentation; },\n                    getDelta: function (child) { return getEffectiveDelta(delta, child); },\n                    recomputeIndentation: function (lineAdded) {\n                        if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent, node)) {\n                            if (lineAdded) {\n                                indentation += options.indentSize;\n                            }\n                            else {\n                                indentation -= options.indentSize;\n                            }\n                            if (formatting.SmartIndenter.shouldIndentChildNode(node)) {\n                                delta = options.indentSize;\n                            }\n                            else {\n                                delta = 0;\n                            }\n                        }\n                    }\n                };\n                function getEffectiveDelta(delta, child) {\n                    return formatting.SmartIndenter.nodeWillIndentChild(node, child, true) ? delta : 0;\n                }\n            }\n            function processNode(node, contextNode, nodeStartLine, undecoratedNodeStartLine, indentation, delta) {\n                if (!ts.rangeOverlapsWithStartEnd(originalRange, node.getStart(sourceFile), node.getEnd())) {\n                    return;\n                }\n                var nodeDynamicIndentation = getDynamicIndentation(node, nodeStartLine, indentation, delta);\n                var childContextNode = contextNode;\n                ts.forEachChild(node, function (child) {\n                    processChildNode(child, -1, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, false);\n                }, function (nodes) {\n                    processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation);\n                });\n                while (formattingScanner.isOnToken()) {\n                    var tokenInfo = formattingScanner.readTokenInfo(node);\n                    if (tokenInfo.token.end > node.end) {\n                        break;\n                    }\n                    consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation);\n                }\n                function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {\n                    var childStartPos = child.getStart(sourceFile);\n                    var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line;\n                    var undecoratedChildStartLine = childStartLine;\n                    if (child.decorators) {\n                        undecoratedChildStartLine = sourceFile.getLineAndCharacterOfPosition(ts.getNonDecoratorTokenPosOfNode(child, sourceFile)).line;\n                    }\n                    var childIndentationAmount = -1;\n                    if (isListItem) {\n                        childIndentationAmount = tryComputeIndentationForListItem(childStartPos, child.end, parentStartLine, originalRange, inheritedIndentation);\n                        if (childIndentationAmount !== -1) {\n                            inheritedIndentation = childIndentationAmount;\n                        }\n                    }\n                    if (!ts.rangeOverlapsWithStartEnd(originalRange, child.pos, child.end)) {\n                        if (child.end < originalRange.pos) {\n                            formattingScanner.skipToEndOf(child);\n                        }\n                        return inheritedIndentation;\n                    }\n                    if (child.getFullWidth() === 0) {\n                        return inheritedIndentation;\n                    }\n                    while (formattingScanner.isOnToken()) {\n                        var tokenInfo = formattingScanner.readTokenInfo(node);\n                        if (tokenInfo.token.end > childStartPos) {\n                            break;\n                        }\n                        consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation);\n                    }\n                    if (!formattingScanner.isOnToken()) {\n                        return inheritedIndentation;\n                    }\n                    if (ts.isToken(child) && child.kind !== 10) {\n                        var tokenInfo = formattingScanner.readTokenInfo(child);\n                        ts.Debug.assert(tokenInfo.token.end === child.end, \"Token end is child end\");\n                        consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child);\n                        return inheritedIndentation;\n                    }\n                    var effectiveParentStartLine = child.kind === 145 ? childStartLine : undecoratedParentStartLine;\n                    var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine);\n                    processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta);\n                    childContextNode = node;\n                    if (isFirstListItem && parent.kind === 175 && inheritedIndentation === -1) {\n                        inheritedIndentation = childIndentation.indentation;\n                    }\n                    return inheritedIndentation;\n                }\n                function processChildNodes(nodes, parent, parentStartLine, parentDynamicIndentation) {\n                    var listStartToken = getOpenTokenForList(parent, nodes);\n                    var listEndToken = getCloseTokenForOpenToken(listStartToken);\n                    var listDynamicIndentation = parentDynamicIndentation;\n                    var startLine = parentStartLine;\n                    if (listStartToken !== 0) {\n                        while (formattingScanner.isOnToken()) {\n                            var tokenInfo = formattingScanner.readTokenInfo(parent);\n                            if (tokenInfo.token.end > nodes.pos) {\n                                break;\n                            }\n                            else if (tokenInfo.token.kind === listStartToken) {\n                                startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line;\n                                var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, parentStartLine);\n                                listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_1.indentation, indentation_1.delta);\n                                consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation);\n                            }\n                            else {\n                                consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation);\n                            }\n                        }\n                    }\n                    var inheritedIndentation = -1;\n                    for (var i = 0; i < nodes.length; i++) {\n                        var child = nodes[i];\n                        inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, true, i === 0);\n                    }\n                    if (listEndToken !== 0) {\n                        if (formattingScanner.isOnToken()) {\n                            var tokenInfo = formattingScanner.readTokenInfo(parent);\n                            if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) {\n                                consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation);\n                            }\n                        }\n                    }\n                }\n                function consumeTokenAndAdvanceScanner(currentTokenInfo, parent, dynamicIndentation, container) {\n                    ts.Debug.assert(ts.rangeContainsRange(parent, currentTokenInfo.token));\n                    var lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine();\n                    var indentToken = false;\n                    if (currentTokenInfo.leadingTrivia) {\n                        processTrivia(currentTokenInfo.leadingTrivia, parent, childContextNode, dynamicIndentation);\n                    }\n                    var lineAdded;\n                    var isTokenInRange = ts.rangeContainsRange(originalRange, currentTokenInfo.token);\n                    var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos);\n                    if (isTokenInRange) {\n                        var rangeHasError = rangeContainsError(currentTokenInfo.token);\n                        var savePreviousRange = previousRange;\n                        lineAdded = processRange(currentTokenInfo.token, tokenStart, parent, childContextNode, dynamicIndentation);\n                        if (rangeHasError) {\n                            indentToken = false;\n                        }\n                        else {\n                            if (lineAdded !== undefined) {\n                                indentToken = lineAdded;\n                            }\n                            else {\n                                var prevEndLine = savePreviousRange && sourceFile.getLineAndCharacterOfPosition(savePreviousRange.end).line;\n                                indentToken = lastTriviaWasNewLine && tokenStart.line !== prevEndLine;\n                            }\n                        }\n                    }\n                    if (currentTokenInfo.trailingTrivia) {\n                        processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation);\n                    }\n                    if (indentToken) {\n                        var tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ?\n                            dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container) :\n                            -1;\n                        var indentNextTokenOrTrivia = true;\n                        if (currentTokenInfo.leadingTrivia) {\n                            var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container);\n                            for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) {\n                                var triviaItem = _a[_i];\n                                var triviaInRange = ts.rangeContainsRange(originalRange, triviaItem);\n                                switch (triviaItem.kind) {\n                                    case 3:\n                                        if (triviaInRange) {\n                                            indentMultilineComment(triviaItem, commentIndentation, !indentNextTokenOrTrivia);\n                                        }\n                                        indentNextTokenOrTrivia = false;\n                                        break;\n                                    case 2:\n                                        if (indentNextTokenOrTrivia && triviaInRange) {\n                                            insertIndentation(triviaItem.pos, commentIndentation, false);\n                                        }\n                                        indentNextTokenOrTrivia = false;\n                                        break;\n                                    case 4:\n                                        indentNextTokenOrTrivia = true;\n                                        break;\n                                }\n                            }\n                        }\n                        if (tokenIndentation !== -1 && indentNextTokenOrTrivia) {\n                            insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded);\n                            lastIndentedLine = tokenStart.line;\n                            indentationOnLastIndentedLine = tokenIndentation;\n                        }\n                    }\n                    formattingScanner.advance();\n                    childContextNode = parent;\n                }\n            }\n            function processTrivia(trivia, parent, contextNode, dynamicIndentation) {\n                for (var _i = 0, trivia_1 = trivia; _i < trivia_1.length; _i++) {\n                    var triviaItem = trivia_1[_i];\n                    if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) {\n                        var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos);\n                        processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation);\n                    }\n                }\n            }\n            function processRange(range, rangeStart, parent, contextNode, dynamicIndentation) {\n                var rangeHasError = rangeContainsError(range);\n                var lineAdded;\n                if (!rangeHasError && !previousRangeHasError) {\n                    if (!previousRange) {\n                        var originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos);\n                        trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line);\n                    }\n                    else {\n                        lineAdded =\n                            processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation);\n                    }\n                }\n                previousRange = range;\n                previousParent = parent;\n                previousRangeStartLine = rangeStart.line;\n                previousRangeHasError = rangeHasError;\n                return lineAdded;\n            }\n            function processPair(currentItem, currentStartLine, currentParent, previousItem, previousStartLine, previousParent, contextNode, dynamicIndentation) {\n                formattingContext.updateContext(previousItem, previousParent, currentItem, currentParent, contextNode);\n                var rule = rulesProvider.getRulesMap().GetRule(formattingContext);\n                var trimTrailingWhitespaces;\n                var lineAdded;\n                if (rule) {\n                    applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine);\n                    if (rule.Operation.Action & (2 | 8) && currentStartLine !== previousStartLine) {\n                        lineAdded = false;\n                        if (currentParent.getStart(sourceFile) === currentItem.pos) {\n                            dynamicIndentation.recomputeIndentation(false);\n                        }\n                    }\n                    else if (rule.Operation.Action & 4 && currentStartLine === previousStartLine) {\n                        lineAdded = true;\n                        if (currentParent.getStart(sourceFile) === currentItem.pos) {\n                            dynamicIndentation.recomputeIndentation(true);\n                        }\n                    }\n                    trimTrailingWhitespaces = !(rule.Operation.Action & 8) && rule.Flag !== 1;\n                }\n                else {\n                    trimTrailingWhitespaces = true;\n                }\n                if (currentStartLine !== previousStartLine && trimTrailingWhitespaces) {\n                    trimTrailingWhitespacesForLines(previousStartLine, currentStartLine, previousItem);\n                }\n                return lineAdded;\n            }\n            function insertIndentation(pos, indentation, lineAdded) {\n                var indentationString = getIndentationString(indentation, options);\n                if (lineAdded) {\n                    recordReplace(pos, 0, indentationString);\n                }\n                else {\n                    var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos);\n                    var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile);\n                    if (indentation !== characterToColumn(startLinePosition, tokenStart.character) || indentationIsDifferent(indentationString, startLinePosition)) {\n                        recordReplace(startLinePosition, tokenStart.character, indentationString);\n                    }\n                }\n            }\n            function characterToColumn(startLinePosition, characterInLine) {\n                var column = 0;\n                for (var i = 0; i < characterInLine; i++) {\n                    if (sourceFile.text.charCodeAt(startLinePosition + i) === 9) {\n                        column += options.tabSize - column % options.tabSize;\n                    }\n                    else {\n                        column++;\n                    }\n                }\n                return column;\n            }\n            function indentationIsDifferent(indentationString, startLinePosition) {\n                return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length);\n            }\n            function indentMultilineComment(commentRange, indentation, firstLineIsIndented) {\n                var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line;\n                var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line;\n                var parts;\n                if (startLine === endLine) {\n                    if (!firstLineIsIndented) {\n                        insertIndentation(commentRange.pos, indentation, false);\n                    }\n                    return;\n                }\n                else {\n                    parts = [];\n                    var startPos = commentRange.pos;\n                    for (var line = startLine; line < endLine; line++) {\n                        var endOfLine = ts.getEndLinePosition(line, sourceFile);\n                        parts.push({ pos: startPos, end: endOfLine });\n                        startPos = ts.getStartPositionOfLine(line + 1, sourceFile);\n                    }\n                    parts.push({ pos: startPos, end: commentRange.end });\n                }\n                var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile);\n                var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(startLinePos, parts[0].pos, sourceFile, options);\n                if (indentation === nonWhitespaceColumnInFirstPart.column) {\n                    return;\n                }\n                var startIndex = 0;\n                if (firstLineIsIndented) {\n                    startIndex = 1;\n                    startLine++;\n                }\n                var delta = indentation - nonWhitespaceColumnInFirstPart.column;\n                for (var i = startIndex, len = parts.length; i < len; i++, startLine++) {\n                    var startLinePos_1 = ts.getStartPositionOfLine(startLine, sourceFile);\n                    var nonWhitespaceCharacterAndColumn = i === 0\n                        ? nonWhitespaceColumnInFirstPart\n                        : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options);\n                    var newIndentation = nonWhitespaceCharacterAndColumn.column + delta;\n                    if (newIndentation > 0) {\n                        var indentationString = getIndentationString(newIndentation, options);\n                        recordReplace(startLinePos_1, nonWhitespaceCharacterAndColumn.character, indentationString);\n                    }\n                    else {\n                        recordDelete(startLinePos_1, nonWhitespaceCharacterAndColumn.character);\n                    }\n                }\n            }\n            function trimTrailingWhitespacesForLines(line1, line2, range) {\n                for (var line = line1; line < line2; line++) {\n                    var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile);\n                    var lineEndPosition = ts.getEndLinePosition(line, sourceFile);\n                    if (range && (ts.isComment(range.kind) || ts.isStringOrRegularExpressionOrTemplateLiteral(range.kind)) && range.pos <= lineEndPosition && range.end > lineEndPosition) {\n                        continue;\n                    }\n                    var whitespaceStart = getTrailingWhitespaceStartPosition(lineStartPosition, lineEndPosition);\n                    if (whitespaceStart !== -1) {\n                        ts.Debug.assert(whitespaceStart === lineStartPosition || !ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(whitespaceStart - 1)));\n                        recordDelete(whitespaceStart, lineEndPosition + 1 - whitespaceStart);\n                    }\n                }\n            }\n            function getTrailingWhitespaceStartPosition(start, end) {\n                var pos = end;\n                while (pos >= start && ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(pos))) {\n                    pos--;\n                }\n                if (pos !== end) {\n                    return pos + 1;\n                }\n                return -1;\n            }\n            function trimTrailingWhitespacesForRemainingRange() {\n                var startPosition = previousRange ? previousRange.end : originalRange.pos;\n                var startLine = sourceFile.getLineAndCharacterOfPosition(startPosition).line;\n                var endLine = sourceFile.getLineAndCharacterOfPosition(originalRange.end).line;\n                trimTrailingWhitespacesForLines(startLine, endLine + 1, previousRange);\n            }\n            function newTextChange(start, len, newText) {\n                return { span: ts.createTextSpan(start, len), newText: newText };\n            }\n            function recordDelete(start, len) {\n                if (len) {\n                    edits.push(newTextChange(start, len, \"\"));\n                }\n            }\n            function recordReplace(start, len, newText) {\n                if (len || newText) {\n                    edits.push(newTextChange(start, len, newText));\n                }\n            }\n            function applyRuleEdits(rule, previousRange, previousStartLine, currentRange, currentStartLine) {\n                switch (rule.Operation.Action) {\n                    case 1:\n                        return;\n                    case 8:\n                        if (previousRange.end !== currentRange.pos) {\n                            recordDelete(previousRange.end, currentRange.pos - previousRange.end);\n                        }\n                        break;\n                    case 4:\n                        if (rule.Flag !== 1 && previousStartLine !== currentStartLine) {\n                            return;\n                        }\n                        var lineDelta = currentStartLine - previousStartLine;\n                        if (lineDelta !== 1) {\n                            recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.newLineCharacter);\n                        }\n                        break;\n                    case 2:\n                        if (rule.Flag !== 1 && previousStartLine !== currentStartLine) {\n                            return;\n                        }\n                        var posDelta = currentRange.pos - previousRange.end;\n                        if (posDelta !== 1 || sourceFile.text.charCodeAt(previousRange.end) !== 32) {\n                            recordReplace(previousRange.end, currentRange.pos - previousRange.end, \" \");\n                        }\n                        break;\n                }\n            }\n        }\n        function getOpenTokenForList(node, list) {\n            switch (node.kind) {\n                case 150:\n                case 225:\n                case 184:\n                case 149:\n                case 148:\n                case 185:\n                    if (node.typeParameters === list) {\n                        return 26;\n                    }\n                    else if (node.parameters === list) {\n                        return 18;\n                    }\n                    break;\n                case 179:\n                case 180:\n                    if (node.typeArguments === list) {\n                        return 26;\n                    }\n                    else if (node.arguments === list) {\n                        return 18;\n                    }\n                    break;\n                case 157:\n                    if (node.typeArguments === list) {\n                        return 26;\n                    }\n            }\n            return 0;\n        }\n        function getCloseTokenForOpenToken(kind) {\n            switch (kind) {\n                case 18:\n                    return 19;\n                case 26:\n                    return 28;\n            }\n            return 0;\n        }\n        var internedSizes;\n        var internedTabsIndentation;\n        var internedSpacesIndentation;\n        function getIndentationString(indentation, options) {\n            var resetInternedStrings = !internedSizes || (internedSizes.tabSize !== options.tabSize || internedSizes.indentSize !== options.indentSize);\n            if (resetInternedStrings) {\n                internedSizes = { tabSize: options.tabSize, indentSize: options.indentSize };\n                internedTabsIndentation = internedSpacesIndentation = undefined;\n            }\n            if (!options.convertTabsToSpaces) {\n                var tabs = Math.floor(indentation / options.tabSize);\n                var spaces = indentation - tabs * options.tabSize;\n                var tabString = void 0;\n                if (!internedTabsIndentation) {\n                    internedTabsIndentation = [];\n                }\n                if (internedTabsIndentation[tabs] === undefined) {\n                    internedTabsIndentation[tabs] = tabString = repeat(\"\\t\", tabs);\n                }\n                else {\n                    tabString = internedTabsIndentation[tabs];\n                }\n                return spaces ? tabString + repeat(\" \", spaces) : tabString;\n            }\n            else {\n                var spacesString = void 0;\n                var quotient = Math.floor(indentation / options.indentSize);\n                var remainder = indentation % options.indentSize;\n                if (!internedSpacesIndentation) {\n                    internedSpacesIndentation = [];\n                }\n                if (internedSpacesIndentation[quotient] === undefined) {\n                    spacesString = repeat(\" \", options.indentSize * quotient);\n                    internedSpacesIndentation[quotient] = spacesString;\n                }\n                else {\n                    spacesString = internedSpacesIndentation[quotient];\n                }\n                return remainder ? spacesString + repeat(\" \", remainder) : spacesString;\n            }\n            function repeat(value, count) {\n                var s = \"\";\n                for (var i = 0; i < count; i++) {\n                    s += value;\n                }\n                return s;\n            }\n        }\n        formatting.getIndentationString = getIndentationString;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var SmartIndenter;\n        (function (SmartIndenter) {\n            function getIndentation(position, sourceFile, options) {\n                if (position > sourceFile.text.length) {\n                    return getBaseIndentation(options);\n                }\n                if (options.indentStyle === ts.IndentStyle.None) {\n                    return 0;\n                }\n                var precedingToken = ts.findPrecedingToken(position, sourceFile);\n                if (!precedingToken) {\n                    return getBaseIndentation(options);\n                }\n                var precedingTokenIsLiteral = ts.isStringOrRegularExpressionOrTemplateLiteral(precedingToken.kind);\n                if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) {\n                    return 0;\n                }\n                var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line;\n                if (options.indentStyle === ts.IndentStyle.Block) {\n                    var current_1 = position;\n                    while (current_1 > 0) {\n                        var char = sourceFile.text.charCodeAt(current_1);\n                        if (!ts.isWhiteSpace(char)) {\n                            break;\n                        }\n                        current_1--;\n                    }\n                    var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile);\n                    return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options);\n                }\n                if (precedingToken.kind === 25 && precedingToken.parent.kind !== 192) {\n                    var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options);\n                    if (actualIndentation !== -1) {\n                        return actualIndentation;\n                    }\n                }\n                var previous;\n                var current = precedingToken;\n                var currentStart;\n                var indentationDelta;\n                while (current) {\n                    if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous)) {\n                        currentStart = getStartLineAndCharacterForNode(current, sourceFile);\n                        if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) {\n                            indentationDelta = 0;\n                        }\n                        else {\n                            indentationDelta = lineAtPosition !== currentStart.line ? options.indentSize : 0;\n                        }\n                        break;\n                    }\n                    var actualIndentation = getActualIndentationForListItem(current, sourceFile, options);\n                    if (actualIndentation !== -1) {\n                        return actualIndentation;\n                    }\n                    actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options);\n                    if (actualIndentation !== -1) {\n                        return actualIndentation + options.indentSize;\n                    }\n                    previous = current;\n                    current = current.parent;\n                }\n                if (!current) {\n                    return getBaseIndentation(options);\n                }\n                return getIndentationForNodeWorker(current, currentStart, undefined, indentationDelta, sourceFile, options);\n            }\n            SmartIndenter.getIndentation = getIndentation;\n            function getIndentationForNode(n, ignoreActualIndentationRange, sourceFile, options) {\n                var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile));\n                return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, 0, sourceFile, options);\n            }\n            SmartIndenter.getIndentationForNode = getIndentationForNode;\n            function getBaseIndentation(options) {\n                return options.baseIndentSize || 0;\n            }\n            SmartIndenter.getBaseIndentation = getBaseIndentation;\n            function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) {\n                var parent = current.parent;\n                var parentStart;\n                while (parent) {\n                    var useActualIndentation = true;\n                    if (ignoreActualIndentationRange) {\n                        var start = current.getStart(sourceFile);\n                        useActualIndentation = start < ignoreActualIndentationRange.pos || start > ignoreActualIndentationRange.end;\n                    }\n                    if (useActualIndentation) {\n                        var actualIndentation = getActualIndentationForListItem(current, sourceFile, options);\n                        if (actualIndentation !== -1) {\n                            return actualIndentation + indentationDelta;\n                        }\n                    }\n                    parentStart = getParentStart(parent, current, sourceFile);\n                    var parentAndChildShareLine = parentStart.line === currentStart.line ||\n                        childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile);\n                    if (useActualIndentation) {\n                        var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options);\n                        if (actualIndentation !== -1) {\n                            return actualIndentation + indentationDelta;\n                        }\n                        actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options);\n                        if (actualIndentation !== -1) {\n                            return actualIndentation + indentationDelta;\n                        }\n                    }\n                    if (shouldIndentChildNode(parent, current) && !parentAndChildShareLine) {\n                        indentationDelta += options.indentSize;\n                    }\n                    current = parent;\n                    currentStart = parentStart;\n                    parent = current.parent;\n                }\n                return indentationDelta + getBaseIndentation(options);\n            }\n            function getParentStart(parent, child, sourceFile) {\n                var containingList = getContainingList(child, sourceFile);\n                if (containingList) {\n                    return sourceFile.getLineAndCharacterOfPosition(containingList.pos);\n                }\n                return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile));\n            }\n            function getActualIndentationForListItemBeforeComma(commaToken, sourceFile, options) {\n                var commaItemInfo = ts.findListItemInfo(commaToken);\n                if (commaItemInfo && commaItemInfo.listItemIndex > 0) {\n                    return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options);\n                }\n                else {\n                    return -1;\n                }\n            }\n            function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) {\n                var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) &&\n                    (parent.kind === 261 || !parentAndChildShareLine);\n                if (!useActualIndentation) {\n                    return -1;\n                }\n                return findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options);\n            }\n            function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile) {\n                var nextToken = ts.findNextToken(precedingToken, current);\n                if (!nextToken) {\n                    return false;\n                }\n                if (nextToken.kind === 16) {\n                    return true;\n                }\n                else if (nextToken.kind === 17) {\n                    var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line;\n                    return lineAtPosition === nextTokenStartLine;\n                }\n                return false;\n            }\n            function getStartLineAndCharacterForNode(n, sourceFile) {\n                return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile));\n            }\n            function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) {\n                if (parent.kind === 208 && parent.elseStatement === child) {\n                    var elseKeyword = ts.findChildOfKind(parent, 81, sourceFile);\n                    ts.Debug.assert(elseKeyword !== undefined);\n                    var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line;\n                    return elseKeywordStartLine === childStartLine;\n                }\n                return false;\n            }\n            SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement = childStartsOnTheSameLineWithElseInIfStatement;\n            function getContainingList(node, sourceFile) {\n                if (node.parent) {\n                    switch (node.parent.kind) {\n                        case 157:\n                            if (node.parent.typeArguments &&\n                                ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) {\n                                return node.parent.typeArguments;\n                            }\n                            break;\n                        case 176:\n                            return node.parent.properties;\n                        case 175:\n                            return node.parent.elements;\n                        case 225:\n                        case 184:\n                        case 185:\n                        case 149:\n                        case 148:\n                        case 153:\n                        case 154: {\n                            var start = node.getStart(sourceFile);\n                            if (node.parent.typeParameters &&\n                                ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) {\n                                return node.parent.typeParameters;\n                            }\n                            if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) {\n                                return node.parent.parameters;\n                            }\n                            break;\n                        }\n                        case 180:\n                        case 179: {\n                            var start = node.getStart(sourceFile);\n                            if (node.parent.typeArguments &&\n                                ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) {\n                                return node.parent.typeArguments;\n                            }\n                            if (node.parent.arguments &&\n                                ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) {\n                                return node.parent.arguments;\n                            }\n                            break;\n                        }\n                    }\n                }\n                return undefined;\n            }\n            function getActualIndentationForListItem(node, sourceFile, options) {\n                var containingList = getContainingList(node, sourceFile);\n                return containingList ? getActualIndentationFromList(containingList) : -1;\n                function getActualIndentationFromList(list) {\n                    var index = ts.indexOf(list, node);\n                    return index !== -1 ? deriveActualIndentationFromList(list, index, sourceFile, options) : -1;\n                }\n            }\n            function getLineIndentationWhenExpressionIsInMultiLine(node, sourceFile, options) {\n                if (node.kind === 19) {\n                    return -1;\n                }\n                if (node.parent && (node.parent.kind === 179 ||\n                    node.parent.kind === 180) &&\n                    node.parent.expression !== node) {\n                    var fullCallOrNewExpression = node.parent.expression;\n                    var startingExpression = getStartingExpression(fullCallOrNewExpression);\n                    if (fullCallOrNewExpression === startingExpression) {\n                        return -1;\n                    }\n                    var fullCallOrNewExpressionEnd = sourceFile.getLineAndCharacterOfPosition(fullCallOrNewExpression.end);\n                    var startingExpressionEnd = sourceFile.getLineAndCharacterOfPosition(startingExpression.end);\n                    if (fullCallOrNewExpressionEnd.line === startingExpressionEnd.line) {\n                        return -1;\n                    }\n                    return findColumnForFirstNonWhitespaceCharacterInLine(fullCallOrNewExpressionEnd, sourceFile, options);\n                }\n                return -1;\n                function getStartingExpression(node) {\n                    while (true) {\n                        switch (node.kind) {\n                            case 179:\n                            case 180:\n                            case 177:\n                            case 178:\n                                node = node.expression;\n                                break;\n                            default:\n                                return node;\n                        }\n                    }\n                }\n            }\n            function deriveActualIndentationFromList(list, index, sourceFile, options) {\n                ts.Debug.assert(index >= 0 && index < list.length);\n                var node = list[index];\n                var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile);\n                for (var i = index - 1; i >= 0; i--) {\n                    if (list[i].kind === 25) {\n                        continue;\n                    }\n                    var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line;\n                    if (prevEndLine !== lineAndCharacter.line) {\n                        return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options);\n                    }\n                    lineAndCharacter = getStartLineAndCharacterForNode(list[i], sourceFile);\n                }\n                return -1;\n            }\n            function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options) {\n                var lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0);\n                return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options);\n            }\n            function findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options) {\n                var character = 0;\n                var column = 0;\n                for (var pos = startPos; pos < endPos; pos++) {\n                    var ch = sourceFile.text.charCodeAt(pos);\n                    if (!ts.isWhiteSpaceSingleLine(ch)) {\n                        break;\n                    }\n                    if (ch === 9) {\n                        column += options.tabSize + (column % options.tabSize);\n                    }\n                    else {\n                        column++;\n                    }\n                    character++;\n                }\n                return { column: column, character: character };\n            }\n            SmartIndenter.findFirstNonWhitespaceCharacterAndColumn = findFirstNonWhitespaceCharacterAndColumn;\n            function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) {\n                return findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options).column;\n            }\n            SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn;\n            function nodeContentIsAlwaysIndented(kind) {\n                switch (kind) {\n                    case 207:\n                    case 226:\n                    case 197:\n                    case 227:\n                    case 229:\n                    case 228:\n                    case 175:\n                    case 204:\n                    case 231:\n                    case 176:\n                    case 161:\n                    case 163:\n                    case 232:\n                    case 254:\n                    case 253:\n                    case 183:\n                    case 177:\n                    case 179:\n                    case 180:\n                    case 205:\n                    case 223:\n                    case 240:\n                    case 216:\n                    case 193:\n                    case 173:\n                    case 172:\n                    case 248:\n                    case 247:\n                    case 252:\n                    case 148:\n                    case 153:\n                    case 154:\n                    case 144:\n                    case 158:\n                    case 159:\n                    case 166:\n                    case 181:\n                    case 189:\n                    case 242:\n                    case 238:\n                    case 243:\n                    case 239:\n                        return true;\n                }\n                return false;\n            }\n            function nodeWillIndentChild(parent, child, indentByDefault) {\n                var childKind = child ? child.kind : 0;\n                switch (parent.kind) {\n                    case 209:\n                    case 210:\n                    case 212:\n                    case 213:\n                    case 211:\n                    case 208:\n                    case 225:\n                    case 184:\n                    case 149:\n                    case 185:\n                    case 150:\n                    case 151:\n                    case 152:\n                        return childKind !== 204;\n                    case 241:\n                        return childKind !== 242;\n                    case 235:\n                        return childKind !== 236 ||\n                            (child.namedBindings && child.namedBindings.kind !== 238);\n                    case 246:\n                        return childKind !== 249;\n                }\n                return indentByDefault;\n            }\n            SmartIndenter.nodeWillIndentChild = nodeWillIndentChild;\n            function shouldIndentChildNode(parent, child) {\n                return nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(parent, child, false);\n            }\n            SmartIndenter.shouldIndentChildNode = shouldIndentChildNode;\n        })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {}));\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var codefix;\n    (function (codefix) {\n        var codeFixes = ts.createMap();\n        function registerCodeFix(action) {\n            ts.forEach(action.errorCodes, function (error) {\n                var fixes = codeFixes[error];\n                if (!fixes) {\n                    fixes = [];\n                    codeFixes[error] = fixes;\n                }\n                fixes.push(action);\n            });\n        }\n        codefix.registerCodeFix = registerCodeFix;\n        function getSupportedErrorCodes() {\n            return Object.keys(codeFixes);\n        }\n        codefix.getSupportedErrorCodes = getSupportedErrorCodes;\n        function getFixes(context) {\n            var fixes = codeFixes[context.errorCode];\n            var allActions = [];\n            ts.forEach(fixes, function (f) {\n                var actions = f.getCodeActions(context);\n                if (actions && actions.length > 0) {\n                    allActions = allActions.concat(actions);\n                }\n            });\n            return allActions;\n        }\n        codefix.getFixes = getFixes;\n    })(codefix = ts.codefix || (ts.codefix = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var codefix;\n    (function (codefix) {\n        function getOpenBraceEnd(constructor, sourceFile) {\n            return constructor.body.getFirstToken(sourceFile).getEnd();\n        }\n        codefix.registerCodeFix({\n            errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code],\n            getCodeActions: function (context) {\n                var sourceFile = context.sourceFile;\n                var token = ts.getTokenAtPosition(sourceFile, context.span.start);\n                if (token.kind !== 122) {\n                    return undefined;\n                }\n                var newPosition = getOpenBraceEnd(token.parent, sourceFile);\n                return [{\n                        description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call),\n                        changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: \"super();\", span: { start: newPosition, length: 0 } }] }]\n                    }];\n            }\n        });\n        codefix.registerCodeFix({\n            errorCodes: [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code],\n            getCodeActions: function (context) {\n                var sourceFile = context.sourceFile;\n                var token = ts.getTokenAtPosition(sourceFile, context.span.start);\n                if (token.kind !== 98) {\n                    return undefined;\n                }\n                var constructor = ts.getContainingFunction(token);\n                var superCall = findSuperCall(constructor.body);\n                if (!superCall) {\n                    return undefined;\n                }\n                if (superCall.expression && superCall.expression.kind == 179) {\n                    var arguments_1 = superCall.expression.arguments;\n                    for (var i = 0; i < arguments_1.length; i++) {\n                        if (arguments_1[i].expression === token) {\n                            return undefined;\n                        }\n                    }\n                }\n                var newPosition = getOpenBraceEnd(constructor, sourceFile);\n                var changes = [{\n                        fileName: sourceFile.fileName, textChanges: [{\n                                newText: superCall.getText(sourceFile),\n                                span: { start: newPosition, length: 0 }\n                            },\n                            {\n                                newText: \"\",\n                                span: { start: superCall.getStart(sourceFile), length: superCall.getWidth(sourceFile) }\n                            }]\n                    }];\n                return [{\n                        description: ts.getLocaleSpecificMessage(ts.Diagnostics.Make_super_call_the_first_statement_in_the_constructor),\n                        changes: changes\n                    }];\n                function findSuperCall(n) {\n                    if (n.kind === 207 && ts.isSuperCall(n.expression)) {\n                        return n;\n                    }\n                    if (ts.isFunctionLike(n)) {\n                        return undefined;\n                    }\n                    return ts.forEachChild(n, findSuperCall);\n                }\n            }\n        });\n    })(codefix = ts.codefix || (ts.codefix = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    ts.servicesVersion = \"0.5\";\n    function createNode(kind, pos, end, parent) {\n        var node = kind >= 141 ? new NodeObject(kind, pos, end) :\n            kind === 70 ? new IdentifierObject(70, pos, end) :\n                new TokenObject(kind, pos, end);\n        node.parent = parent;\n        return node;\n    }\n    var NodeObject = (function () {\n        function NodeObject(kind, pos, end) {\n            this.pos = pos;\n            this.end = end;\n            this.flags = 0;\n            this.transformFlags = undefined;\n            this.parent = undefined;\n            this.kind = kind;\n        }\n        NodeObject.prototype.getSourceFile = function () {\n            return ts.getSourceFileOfNode(this);\n        };\n        NodeObject.prototype.getStart = function (sourceFile, includeJsDocComment) {\n            return ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment);\n        };\n        NodeObject.prototype.getFullStart = function () {\n            return this.pos;\n        };\n        NodeObject.prototype.getEnd = function () {\n            return this.end;\n        };\n        NodeObject.prototype.getWidth = function (sourceFile) {\n            return this.getEnd() - this.getStart(sourceFile);\n        };\n        NodeObject.prototype.getFullWidth = function () {\n            return this.end - this.pos;\n        };\n        NodeObject.prototype.getLeadingTriviaWidth = function (sourceFile) {\n            return this.getStart(sourceFile) - this.pos;\n        };\n        NodeObject.prototype.getFullText = function (sourceFile) {\n            return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end);\n        };\n        NodeObject.prototype.getText = function (sourceFile) {\n            if (!sourceFile) {\n                sourceFile = this.getSourceFile();\n            }\n            return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd());\n        };\n        NodeObject.prototype.addSyntheticNodes = function (nodes, pos, end, useJSDocScanner) {\n            ts.scanner.setTextPos(pos);\n            while (pos < end) {\n                var token = useJSDocScanner ? ts.scanner.scanJSDocToken() : ts.scanner.scan();\n                var textPos = ts.scanner.getTextPos();\n                if (textPos <= end) {\n                    nodes.push(createNode(token, pos, textPos, this));\n                }\n                pos = textPos;\n            }\n            return pos;\n        };\n        NodeObject.prototype.createSyntaxList = function (nodes) {\n            var list = createNode(292, nodes.pos, nodes.end, this);\n            list._children = [];\n            var pos = nodes.pos;\n            for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) {\n                var node = nodes_7[_i];\n                if (pos < node.pos) {\n                    pos = this.addSyntheticNodes(list._children, pos, node.pos);\n                }\n                list._children.push(node);\n                pos = node.end;\n            }\n            if (pos < nodes.end) {\n                this.addSyntheticNodes(list._children, pos, nodes.end);\n            }\n            return list;\n        };\n        NodeObject.prototype.createChildren = function (sourceFile) {\n            var _this = this;\n            var children;\n            if (this.kind >= 141) {\n                ts.scanner.setText((sourceFile || this.getSourceFile()).text);\n                children = [];\n                var pos_3 = this.pos;\n                var useJSDocScanner_1 = this.kind >= 278 && this.kind <= 291;\n                var processNode = function (node) {\n                    var isJSDocTagNode = ts.isJSDocTag(node);\n                    if (!isJSDocTagNode && pos_3 < node.pos) {\n                        pos_3 = _this.addSyntheticNodes(children, pos_3, node.pos, useJSDocScanner_1);\n                    }\n                    children.push(node);\n                    if (!isJSDocTagNode) {\n                        pos_3 = node.end;\n                    }\n                };\n                var processNodes = function (nodes) {\n                    if (pos_3 < nodes.pos) {\n                        pos_3 = _this.addSyntheticNodes(children, pos_3, nodes.pos, useJSDocScanner_1);\n                    }\n                    children.push(_this.createSyntaxList(nodes));\n                    pos_3 = nodes.end;\n                };\n                if (this.jsDoc) {\n                    for (var _i = 0, _a = this.jsDoc; _i < _a.length; _i++) {\n                        var jsDocComment = _a[_i];\n                        processNode(jsDocComment);\n                    }\n                }\n                pos_3 = this.pos;\n                ts.forEachChild(this, processNode, processNodes);\n                if (pos_3 < this.end) {\n                    this.addSyntheticNodes(children, pos_3, this.end);\n                }\n                ts.scanner.setText(undefined);\n            }\n            this._children = children || ts.emptyArray;\n        };\n        NodeObject.prototype.getChildCount = function (sourceFile) {\n            if (!this._children)\n                this.createChildren(sourceFile);\n            return this._children.length;\n        };\n        NodeObject.prototype.getChildAt = function (index, sourceFile) {\n            if (!this._children)\n                this.createChildren(sourceFile);\n            return this._children[index];\n        };\n        NodeObject.prototype.getChildren = function (sourceFile) {\n            if (!this._children)\n                this.createChildren(sourceFile);\n            return this._children;\n        };\n        NodeObject.prototype.getFirstToken = function (sourceFile) {\n            var children = this.getChildren(sourceFile);\n            if (!children.length) {\n                return undefined;\n            }\n            var child = children[0];\n            return child.kind < 141 ? child : child.getFirstToken(sourceFile);\n        };\n        NodeObject.prototype.getLastToken = function (sourceFile) {\n            var children = this.getChildren(sourceFile);\n            var child = ts.lastOrUndefined(children);\n            if (!child) {\n                return undefined;\n            }\n            return child.kind < 141 ? child : child.getLastToken(sourceFile);\n        };\n        return NodeObject;\n    }());\n    var TokenOrIdentifierObject = (function () {\n        function TokenOrIdentifierObject(pos, end) {\n            this.pos = pos;\n            this.end = end;\n            this.flags = 0;\n            this.parent = undefined;\n        }\n        TokenOrIdentifierObject.prototype.getSourceFile = function () {\n            return ts.getSourceFileOfNode(this);\n        };\n        TokenOrIdentifierObject.prototype.getStart = function (sourceFile, includeJsDocComment) {\n            return ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment);\n        };\n        TokenOrIdentifierObject.prototype.getFullStart = function () {\n            return this.pos;\n        };\n        TokenOrIdentifierObject.prototype.getEnd = function () {\n            return this.end;\n        };\n        TokenOrIdentifierObject.prototype.getWidth = function (sourceFile) {\n            return this.getEnd() - this.getStart(sourceFile);\n        };\n        TokenOrIdentifierObject.prototype.getFullWidth = function () {\n            return this.end - this.pos;\n        };\n        TokenOrIdentifierObject.prototype.getLeadingTriviaWidth = function (sourceFile) {\n            return this.getStart(sourceFile) - this.pos;\n        };\n        TokenOrIdentifierObject.prototype.getFullText = function (sourceFile) {\n            return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end);\n        };\n        TokenOrIdentifierObject.prototype.getText = function (sourceFile) {\n            return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd());\n        };\n        TokenOrIdentifierObject.prototype.getChildCount = function () {\n            return 0;\n        };\n        TokenOrIdentifierObject.prototype.getChildAt = function () {\n            return undefined;\n        };\n        TokenOrIdentifierObject.prototype.getChildren = function () {\n            return ts.emptyArray;\n        };\n        TokenOrIdentifierObject.prototype.getFirstToken = function () {\n            return undefined;\n        };\n        TokenOrIdentifierObject.prototype.getLastToken = function () {\n            return undefined;\n        };\n        return TokenOrIdentifierObject;\n    }());\n    var SymbolObject = (function () {\n        function SymbolObject(flags, name) {\n            this.flags = flags;\n            this.name = name;\n        }\n        SymbolObject.prototype.getFlags = function () {\n            return this.flags;\n        };\n        SymbolObject.prototype.getName = function () {\n            return this.name;\n        };\n        SymbolObject.prototype.getDeclarations = function () {\n            return this.declarations;\n        };\n        SymbolObject.prototype.getDocumentationComment = function () {\n            if (this.documentationComment === undefined) {\n                this.documentationComment = ts.JsDoc.getJsDocCommentsFromDeclarations(this.declarations);\n            }\n            return this.documentationComment;\n        };\n        return SymbolObject;\n    }());\n    var TokenObject = (function (_super) {\n        __extends(TokenObject, _super);\n        function TokenObject(kind, pos, end) {\n            var _this = _super.call(this, pos, end) || this;\n            _this.kind = kind;\n            return _this;\n        }\n        return TokenObject;\n    }(TokenOrIdentifierObject));\n    var IdentifierObject = (function (_super) {\n        __extends(IdentifierObject, _super);\n        function IdentifierObject(_kind, pos, end) {\n            return _super.call(this, pos, end) || this;\n        }\n        return IdentifierObject;\n    }(TokenOrIdentifierObject));\n    IdentifierObject.prototype.kind = 70;\n    var TypeObject = (function () {\n        function TypeObject(checker, flags) {\n            this.checker = checker;\n            this.flags = flags;\n        }\n        TypeObject.prototype.getFlags = function () {\n            return this.flags;\n        };\n        TypeObject.prototype.getSymbol = function () {\n            return this.symbol;\n        };\n        TypeObject.prototype.getProperties = function () {\n            return this.checker.getPropertiesOfType(this);\n        };\n        TypeObject.prototype.getProperty = function (propertyName) {\n            return this.checker.getPropertyOfType(this, propertyName);\n        };\n        TypeObject.prototype.getApparentProperties = function () {\n            return this.checker.getAugmentedPropertiesOfType(this);\n        };\n        TypeObject.prototype.getCallSignatures = function () {\n            return this.checker.getSignaturesOfType(this, 0);\n        };\n        TypeObject.prototype.getConstructSignatures = function () {\n            return this.checker.getSignaturesOfType(this, 1);\n        };\n        TypeObject.prototype.getStringIndexType = function () {\n            return this.checker.getIndexTypeOfType(this, 0);\n        };\n        TypeObject.prototype.getNumberIndexType = function () {\n            return this.checker.getIndexTypeOfType(this, 1);\n        };\n        TypeObject.prototype.getBaseTypes = function () {\n            return this.flags & 32768 && this.objectFlags & (1 | 2)\n                ? this.checker.getBaseTypes(this)\n                : undefined;\n        };\n        TypeObject.prototype.getNonNullableType = function () {\n            return this.checker.getNonNullableType(this);\n        };\n        return TypeObject;\n    }());\n    var SignatureObject = (function () {\n        function SignatureObject(checker) {\n            this.checker = checker;\n        }\n        SignatureObject.prototype.getDeclaration = function () {\n            return this.declaration;\n        };\n        SignatureObject.prototype.getTypeParameters = function () {\n            return this.typeParameters;\n        };\n        SignatureObject.prototype.getParameters = function () {\n            return this.parameters;\n        };\n        SignatureObject.prototype.getReturnType = function () {\n            return this.checker.getReturnTypeOfSignature(this);\n        };\n        SignatureObject.prototype.getDocumentationComment = function () {\n            if (this.documentationComment === undefined) {\n                this.documentationComment = this.declaration ? ts.JsDoc.getJsDocCommentsFromDeclarations([this.declaration]) : [];\n            }\n            return this.documentationComment;\n        };\n        return SignatureObject;\n    }());\n    var SourceFileObject = (function (_super) {\n        __extends(SourceFileObject, _super);\n        function SourceFileObject(kind, pos, end) {\n            return _super.call(this, kind, pos, end) || this;\n        }\n        SourceFileObject.prototype.update = function (newText, textChangeRange) {\n            return ts.updateSourceFile(this, newText, textChangeRange);\n        };\n        SourceFileObject.prototype.getLineAndCharacterOfPosition = function (position) {\n            return ts.getLineAndCharacterOfPosition(this, position);\n        };\n        SourceFileObject.prototype.getLineStarts = function () {\n            return ts.getLineStarts(this);\n        };\n        SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) {\n            return ts.getPositionOfLineAndCharacter(this, line, character);\n        };\n        SourceFileObject.prototype.getLineEndOfPosition = function (pos) {\n            var line = this.getLineAndCharacterOfPosition(pos).line;\n            var lineStarts = this.getLineStarts();\n            var lastCharPos;\n            if (line + 1 >= lineStarts.length) {\n                lastCharPos = this.getEnd();\n            }\n            if (!lastCharPos) {\n                lastCharPos = lineStarts[line + 1] - 1;\n            }\n            var fullText = this.getFullText();\n            return fullText[lastCharPos] === \"\\n\" && fullText[lastCharPos - 1] === \"\\r\" ? lastCharPos - 1 : lastCharPos;\n        };\n        SourceFileObject.prototype.getNamedDeclarations = function () {\n            if (!this.namedDeclarations) {\n                this.namedDeclarations = this.computeNamedDeclarations();\n            }\n            return this.namedDeclarations;\n        };\n        SourceFileObject.prototype.computeNamedDeclarations = function () {\n            var result = ts.createMap();\n            ts.forEachChild(this, visit);\n            return result;\n            function addDeclaration(declaration) {\n                var name = getDeclarationName(declaration);\n                if (name) {\n                    ts.multiMapAdd(result, name, declaration);\n                }\n            }\n            function getDeclarations(name) {\n                return result[name] || (result[name] = []);\n            }\n            function getDeclarationName(declaration) {\n                if (declaration.name) {\n                    var result_7 = getTextOfIdentifierOrLiteral(declaration.name);\n                    if (result_7 !== undefined) {\n                        return result_7;\n                    }\n                    if (declaration.name.kind === 142) {\n                        var expr = declaration.name.expression;\n                        if (expr.kind === 177) {\n                            return expr.name.text;\n                        }\n                        return getTextOfIdentifierOrLiteral(expr);\n                    }\n                }\n                return undefined;\n            }\n            function getTextOfIdentifierOrLiteral(node) {\n                if (node) {\n                    if (node.kind === 70 ||\n                        node.kind === 9 ||\n                        node.kind === 8) {\n                        return node.text;\n                    }\n                }\n                return undefined;\n            }\n            function visit(node) {\n                switch (node.kind) {\n                    case 225:\n                    case 184:\n                    case 149:\n                    case 148:\n                        var functionDeclaration = node;\n                        var declarationName = getDeclarationName(functionDeclaration);\n                        if (declarationName) {\n                            var declarations = getDeclarations(declarationName);\n                            var lastDeclaration = ts.lastOrUndefined(declarations);\n                            if (lastDeclaration && functionDeclaration.parent === lastDeclaration.parent && functionDeclaration.symbol === lastDeclaration.symbol) {\n                                if (functionDeclaration.body && !lastDeclaration.body) {\n                                    declarations[declarations.length - 1] = functionDeclaration;\n                                }\n                            }\n                            else {\n                                declarations.push(functionDeclaration);\n                            }\n                            ts.forEachChild(node, visit);\n                        }\n                        break;\n                    case 226:\n                    case 197:\n                    case 227:\n                    case 228:\n                    case 229:\n                    case 230:\n                    case 234:\n                    case 243:\n                    case 239:\n                    case 234:\n                    case 236:\n                    case 237:\n                    case 151:\n                    case 152:\n                    case 161:\n                        addDeclaration(node);\n                        ts.forEachChild(node, visit);\n                        break;\n                    case 144:\n                        if (!ts.hasModifier(node, 92)) {\n                            break;\n                        }\n                    case 223:\n                    case 174: {\n                        var decl = node;\n                        if (ts.isBindingPattern(decl.name)) {\n                            ts.forEachChild(decl.name, visit);\n                            break;\n                        }\n                        if (decl.initializer)\n                            visit(decl.initializer);\n                    }\n                    case 260:\n                    case 147:\n                    case 146:\n                        addDeclaration(node);\n                        break;\n                    case 241:\n                        if (node.exportClause) {\n                            ts.forEach(node.exportClause.elements, visit);\n                        }\n                        break;\n                    case 235:\n                        var importClause = node.importClause;\n                        if (importClause) {\n                            if (importClause.name) {\n                                addDeclaration(importClause);\n                            }\n                            if (importClause.namedBindings) {\n                                if (importClause.namedBindings.kind === 237) {\n                                    addDeclaration(importClause.namedBindings);\n                                }\n                                else {\n                                    ts.forEach(importClause.namedBindings.elements, visit);\n                                }\n                            }\n                        }\n                        break;\n                    default:\n                        ts.forEachChild(node, visit);\n                }\n            }\n        };\n        return SourceFileObject;\n    }(NodeObject));\n    function getServicesObjectAllocator() {\n        return {\n            getNodeConstructor: function () { return NodeObject; },\n            getTokenConstructor: function () { return TokenObject; },\n            getIdentifierConstructor: function () { return IdentifierObject; },\n            getSourceFileConstructor: function () { return SourceFileObject; },\n            getSymbolConstructor: function () { return SymbolObject; },\n            getTypeConstructor: function () { return TypeObject; },\n            getSignatureConstructor: function () { return SignatureObject; },\n        };\n    }\n    function toEditorSettings(optionsAsMap) {\n        var allPropertiesAreCamelCased = true;\n        for (var key in optionsAsMap) {\n            if (ts.hasProperty(optionsAsMap, key) && !isCamelCase(key)) {\n                allPropertiesAreCamelCased = false;\n                break;\n            }\n        }\n        if (allPropertiesAreCamelCased) {\n            return optionsAsMap;\n        }\n        var settings = {};\n        for (var key in optionsAsMap) {\n            if (ts.hasProperty(optionsAsMap, key)) {\n                var newKey = isCamelCase(key) ? key : key.charAt(0).toLowerCase() + key.substr(1);\n                settings[newKey] = optionsAsMap[key];\n            }\n        }\n        return settings;\n    }\n    ts.toEditorSettings = toEditorSettings;\n    function isCamelCase(s) {\n        return !s.length || s.charAt(0) === s.charAt(0).toLowerCase();\n    }\n    function displayPartsToString(displayParts) {\n        if (displayParts) {\n            return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join(\"\");\n        }\n        return \"\";\n    }\n    ts.displayPartsToString = displayPartsToString;\n    function getDefaultCompilerOptions() {\n        return {\n            target: 1,\n            jsx: 1\n        };\n    }\n    ts.getDefaultCompilerOptions = getDefaultCompilerOptions;\n    function getSupportedCodeFixes() {\n        return ts.codefix.getSupportedErrorCodes();\n    }\n    ts.getSupportedCodeFixes = getSupportedCodeFixes;\n    var HostCache = (function () {\n        function HostCache(host, getCanonicalFileName) {\n            this.host = host;\n            this.getCanonicalFileName = getCanonicalFileName;\n            this.currentDirectory = host.getCurrentDirectory();\n            this.fileNameToEntry = ts.createFileMap();\n            var rootFileNames = host.getScriptFileNames();\n            for (var _i = 0, rootFileNames_1 = rootFileNames; _i < rootFileNames_1.length; _i++) {\n                var fileName = rootFileNames_1[_i];\n                this.createEntry(fileName, ts.toPath(fileName, this.currentDirectory, getCanonicalFileName));\n            }\n            this._compilationSettings = host.getCompilationSettings() || getDefaultCompilerOptions();\n        }\n        HostCache.prototype.compilationSettings = function () {\n            return this._compilationSettings;\n        };\n        HostCache.prototype.createEntry = function (fileName, path) {\n            var entry;\n            var scriptSnapshot = this.host.getScriptSnapshot(fileName);\n            if (scriptSnapshot) {\n                entry = {\n                    hostFileName: fileName,\n                    version: this.host.getScriptVersion(fileName),\n                    scriptSnapshot: scriptSnapshot,\n                    scriptKind: ts.getScriptKind(fileName, this.host)\n                };\n            }\n            this.fileNameToEntry.set(path, entry);\n            return entry;\n        };\n        HostCache.prototype.getEntry = function (path) {\n            return this.fileNameToEntry.get(path);\n        };\n        HostCache.prototype.contains = function (path) {\n            return this.fileNameToEntry.contains(path);\n        };\n        HostCache.prototype.getOrCreateEntry = function (fileName) {\n            var path = ts.toPath(fileName, this.currentDirectory, this.getCanonicalFileName);\n            return this.getOrCreateEntryByPath(fileName, path);\n        };\n        HostCache.prototype.getOrCreateEntryByPath = function (fileName, path) {\n            return this.contains(path)\n                ? this.getEntry(path)\n                : this.createEntry(fileName, path);\n        };\n        HostCache.prototype.getRootFileNames = function () {\n            var fileNames = [];\n            this.fileNameToEntry.forEachValue(function (_path, value) {\n                if (value) {\n                    fileNames.push(value.hostFileName);\n                }\n            });\n            return fileNames;\n        };\n        HostCache.prototype.getVersion = function (path) {\n            var file = this.getEntry(path);\n            return file && file.version;\n        };\n        HostCache.prototype.getScriptSnapshot = function (path) {\n            var file = this.getEntry(path);\n            return file && file.scriptSnapshot;\n        };\n        return HostCache;\n    }());\n    var SyntaxTreeCache = (function () {\n        function SyntaxTreeCache(host) {\n            this.host = host;\n        }\n        SyntaxTreeCache.prototype.getCurrentSourceFile = function (fileName) {\n            var scriptSnapshot = this.host.getScriptSnapshot(fileName);\n            if (!scriptSnapshot) {\n                throw new Error(\"Could not find file: '\" + fileName + \"'.\");\n            }\n            var scriptKind = ts.getScriptKind(fileName, this.host);\n            var version = this.host.getScriptVersion(fileName);\n            var sourceFile;\n            if (this.currentFileName !== fileName) {\n                sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 5, version, true, scriptKind);\n            }\n            else if (this.currentFileVersion !== version) {\n                var editRange = scriptSnapshot.getChangeRange(this.currentFileScriptSnapshot);\n                sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, editRange);\n            }\n            if (sourceFile) {\n                this.currentFileVersion = version;\n                this.currentFileName = fileName;\n                this.currentFileScriptSnapshot = scriptSnapshot;\n                this.currentSourceFile = sourceFile;\n            }\n            return this.currentSourceFile;\n        };\n        return SyntaxTreeCache;\n    }());\n    function setSourceFileFields(sourceFile, scriptSnapshot, version) {\n        sourceFile.version = version;\n        sourceFile.scriptSnapshot = scriptSnapshot;\n    }\n    function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents, scriptKind) {\n        var text = scriptSnapshot.getText(0, scriptSnapshot.getLength());\n        var sourceFile = ts.createSourceFile(fileName, text, scriptTarget, setNodeParents, scriptKind);\n        setSourceFileFields(sourceFile, scriptSnapshot, version);\n        return sourceFile;\n    }\n    ts.createLanguageServiceSourceFile = createLanguageServiceSourceFile;\n    ts.disableIncrementalParsing = false;\n    function updateLanguageServiceSourceFile(sourceFile, scriptSnapshot, version, textChangeRange, aggressiveChecks) {\n        if (textChangeRange) {\n            if (version !== sourceFile.version) {\n                if (!ts.disableIncrementalParsing) {\n                    var newText = void 0;\n                    var prefix = textChangeRange.span.start !== 0\n                        ? sourceFile.text.substr(0, textChangeRange.span.start)\n                        : \"\";\n                    var suffix = ts.textSpanEnd(textChangeRange.span) !== sourceFile.text.length\n                        ? sourceFile.text.substr(ts.textSpanEnd(textChangeRange.span))\n                        : \"\";\n                    if (textChangeRange.newLength === 0) {\n                        newText = prefix && suffix ? prefix + suffix : prefix || suffix;\n                    }\n                    else {\n                        var changedText = scriptSnapshot.getText(textChangeRange.span.start, textChangeRange.span.start + textChangeRange.newLength);\n                        newText = prefix && suffix\n                            ? prefix + changedText + suffix\n                            : prefix\n                                ? (prefix + changedText)\n                                : (changedText + suffix);\n                    }\n                    var newSourceFile = ts.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);\n                    setSourceFileFields(newSourceFile, scriptSnapshot, version);\n                    newSourceFile.nameTable = undefined;\n                    if (sourceFile !== newSourceFile && sourceFile.scriptSnapshot) {\n                        if (sourceFile.scriptSnapshot.dispose) {\n                            sourceFile.scriptSnapshot.dispose();\n                        }\n                        sourceFile.scriptSnapshot = undefined;\n                    }\n                    return newSourceFile;\n                }\n            }\n        }\n        return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, true, sourceFile.scriptKind);\n    }\n    ts.updateLanguageServiceSourceFile = updateLanguageServiceSourceFile;\n    var CancellationTokenObject = (function () {\n        function CancellationTokenObject(cancellationToken) {\n            this.cancellationToken = cancellationToken;\n        }\n        CancellationTokenObject.prototype.isCancellationRequested = function () {\n            return this.cancellationToken && this.cancellationToken.isCancellationRequested();\n        };\n        CancellationTokenObject.prototype.throwIfCancellationRequested = function () {\n            if (this.isCancellationRequested()) {\n                throw new ts.OperationCanceledException();\n            }\n        };\n        return CancellationTokenObject;\n    }());\n    function createLanguageService(host, documentRegistry) {\n        if (documentRegistry === void 0) { documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); }\n        var syntaxTreeCache = new SyntaxTreeCache(host);\n        var ruleProvider;\n        var program;\n        var lastProjectVersion;\n        var lastTypesRootVersion = 0;\n        var useCaseSensitivefileNames = host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames();\n        var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken());\n        var currentDirectory = host.getCurrentDirectory();\n        if (!ts.localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages) {\n            ts.localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages();\n        }\n        function log(message) {\n            if (host.log) {\n                host.log(message);\n            }\n        }\n        var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitivefileNames);\n        function getValidSourceFile(fileName) {\n            var sourceFile = program.getSourceFile(fileName);\n            if (!sourceFile) {\n                throw new Error(\"Could not find file: '\" + fileName + \"'.\");\n            }\n            return sourceFile;\n        }\n        function getRuleProvider(options) {\n            if (!ruleProvider) {\n                ruleProvider = new ts.formatting.RulesProvider();\n            }\n            ruleProvider.ensureUpToDate(options);\n            return ruleProvider;\n        }\n        function synchronizeHostData() {\n            if (host.getProjectVersion) {\n                var hostProjectVersion = host.getProjectVersion();\n                if (hostProjectVersion) {\n                    if (lastProjectVersion === hostProjectVersion) {\n                        return;\n                    }\n                    lastProjectVersion = hostProjectVersion;\n                }\n            }\n            var typeRootsVersion = host.getTypeRootsVersion ? host.getTypeRootsVersion() : 0;\n            if (lastTypesRootVersion !== typeRootsVersion) {\n                log(\"TypeRoots version has changed; provide new program\");\n                program = undefined;\n                lastTypesRootVersion = typeRootsVersion;\n            }\n            var hostCache = new HostCache(host, getCanonicalFileName);\n            if (programUpToDate()) {\n                return;\n            }\n            var oldSettings = program && program.getCompilerOptions();\n            var newSettings = hostCache.compilationSettings();\n            var shouldCreateNewSourceFiles = oldSettings &&\n                (oldSettings.target !== newSettings.target ||\n                    oldSettings.module !== newSettings.module ||\n                    oldSettings.moduleResolution !== newSettings.moduleResolution ||\n                    oldSettings.noResolve !== newSettings.noResolve ||\n                    oldSettings.jsx !== newSettings.jsx ||\n                    oldSettings.allowJs !== newSettings.allowJs ||\n                    oldSettings.disableSizeLimit !== oldSettings.disableSizeLimit ||\n                    oldSettings.baseUrl !== newSettings.baseUrl ||\n                    !ts.equalOwnProperties(oldSettings.paths, newSettings.paths));\n            var compilerHost = {\n                getSourceFile: getOrCreateSourceFile,\n                getSourceFileByPath: getOrCreateSourceFileByPath,\n                getCancellationToken: function () { return cancellationToken; },\n                getCanonicalFileName: getCanonicalFileName,\n                useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; },\n                getNewLine: function () { return ts.getNewLineOrDefaultFromHost(host); },\n                getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); },\n                writeFile: ts.noop,\n                getCurrentDirectory: function () { return currentDirectory; },\n                fileExists: function (fileName) {\n                    return hostCache.getOrCreateEntry(fileName) !== undefined;\n                },\n                readFile: function (fileName) {\n                    var entry = hostCache.getOrCreateEntry(fileName);\n                    return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength());\n                },\n                directoryExists: function (directoryName) {\n                    return ts.directoryProbablyExists(directoryName, host);\n                },\n                getDirectories: function (path) {\n                    return host.getDirectories ? host.getDirectories(path) : [];\n                }\n            };\n            if (host.trace) {\n                compilerHost.trace = function (message) { return host.trace(message); };\n            }\n            if (host.resolveModuleNames) {\n                compilerHost.resolveModuleNames = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); };\n            }\n            if (host.resolveTypeReferenceDirectives) {\n                compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile) {\n                    return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile);\n                };\n            }\n            var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);\n            var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program);\n            if (program) {\n                var oldSourceFiles = program.getSourceFiles();\n                var oldSettingsKey = documentRegistry.getKeyForCompilationSettings(oldSettings);\n                for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) {\n                    var oldSourceFile = oldSourceFiles_1[_i];\n                    if (!newProgram.getSourceFile(oldSourceFile.fileName) || shouldCreateNewSourceFiles) {\n                        documentRegistry.releaseDocumentWithKey(oldSourceFile.path, oldSettingsKey);\n                    }\n                }\n            }\n            hostCache = undefined;\n            program = newProgram;\n            program.getTypeChecker();\n            return;\n            function getOrCreateSourceFile(fileName) {\n                return getOrCreateSourceFileByPath(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName));\n            }\n            function getOrCreateSourceFileByPath(fileName, path) {\n                ts.Debug.assert(hostCache !== undefined);\n                var hostFileInformation = hostCache.getOrCreateEntryByPath(fileName, path);\n                if (!hostFileInformation) {\n                    return undefined;\n                }\n                if (!shouldCreateNewSourceFiles) {\n                    var oldSourceFile = program && program.getSourceFileByPath(path);\n                    if (oldSourceFile) {\n                        ts.Debug.assert(hostFileInformation.scriptKind === oldSourceFile.scriptKind, \"Registered script kind (\" + oldSourceFile.scriptKind + \") should match new script kind (\" + hostFileInformation.scriptKind + \") for file: \" + path);\n                        return documentRegistry.updateDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind);\n                    }\n                }\n                return documentRegistry.acquireDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind);\n            }\n            function sourceFileUpToDate(sourceFile) {\n                if (!sourceFile) {\n                    return false;\n                }\n                var path = sourceFile.path || ts.toPath(sourceFile.fileName, currentDirectory, getCanonicalFileName);\n                return sourceFile.version === hostCache.getVersion(path);\n            }\n            function programUpToDate() {\n                if (!program) {\n                    return false;\n                }\n                var rootFileNames = hostCache.getRootFileNames();\n                if (program.getSourceFiles().length !== rootFileNames.length) {\n                    return false;\n                }\n                for (var _i = 0, rootFileNames_2 = rootFileNames; _i < rootFileNames_2.length; _i++) {\n                    var fileName = rootFileNames_2[_i];\n                    if (!sourceFileUpToDate(program.getSourceFile(fileName))) {\n                        return false;\n                    }\n                }\n                return ts.compareDataObjects(program.getCompilerOptions(), hostCache.compilationSettings());\n            }\n        }\n        function getProgram() {\n            synchronizeHostData();\n            return program;\n        }\n        function cleanupSemanticCache() {\n            program = undefined;\n        }\n        function dispose() {\n            if (program) {\n                ts.forEach(program.getSourceFiles(), function (f) {\n                    return documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions());\n                });\n            }\n        }\n        function getSyntacticDiagnostics(fileName) {\n            synchronizeHostData();\n            return program.getSyntacticDiagnostics(getValidSourceFile(fileName), cancellationToken);\n        }\n        function getSemanticDiagnostics(fileName) {\n            synchronizeHostData();\n            var targetSourceFile = getValidSourceFile(fileName);\n            var semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken);\n            if (!program.getCompilerOptions().declaration) {\n                return semanticDiagnostics;\n            }\n            var declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken);\n            return ts.concatenate(semanticDiagnostics, declarationDiagnostics);\n        }\n        function getCompilerOptionsDiagnostics() {\n            synchronizeHostData();\n            return program.getOptionsDiagnostics(cancellationToken).concat(program.getGlobalDiagnostics(cancellationToken));\n        }\n        function getCompletionsAtPosition(fileName, position) {\n            synchronizeHostData();\n            return ts.Completions.getCompletionsAtPosition(host, program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position);\n        }\n        function getCompletionEntryDetails(fileName, position, entryName) {\n            synchronizeHostData();\n            return ts.Completions.getCompletionEntryDetails(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, entryName);\n        }\n        function getCompletionEntrySymbol(fileName, position, entryName) {\n            synchronizeHostData();\n            return ts.Completions.getCompletionEntrySymbol(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, entryName);\n        }\n        function getQuickInfoAtPosition(fileName, position) {\n            synchronizeHostData();\n            var sourceFile = getValidSourceFile(fileName);\n            var node = ts.getTouchingPropertyName(sourceFile, position);\n            if (node === sourceFile) {\n                return undefined;\n            }\n            if (ts.isLabelName(node)) {\n                return undefined;\n            }\n            var typeChecker = program.getTypeChecker();\n            var symbol = typeChecker.getSymbolAtLocation(node);\n            if (!symbol || typeChecker.isUnknownSymbol(symbol)) {\n                switch (node.kind) {\n                    case 70:\n                    case 177:\n                    case 141:\n                    case 98:\n                    case 167:\n                    case 96:\n                        var type = typeChecker.getTypeAtLocation(node);\n                        if (type) {\n                            return {\n                                kind: ts.ScriptElementKind.unknown,\n                                kindModifiers: ts.ScriptElementKindModifier.none,\n                                textSpan: ts.createTextSpan(node.getStart(), node.getWidth()),\n                                displayParts: ts.typeToDisplayParts(typeChecker, type, ts.getContainerNode(node)),\n                                documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined\n                            };\n                        }\n                }\n                return undefined;\n            }\n            var displayPartsDocumentationsAndKind = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(node), node);\n            return {\n                kind: displayPartsDocumentationsAndKind.symbolKind,\n                kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),\n                textSpan: ts.createTextSpan(node.getStart(), node.getWidth()),\n                displayParts: displayPartsDocumentationsAndKind.displayParts,\n                documentation: displayPartsDocumentationsAndKind.documentation\n            };\n        }\n        function getDefinitionAtPosition(fileName, position) {\n            synchronizeHostData();\n            return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position);\n        }\n        function getImplementationAtPosition(fileName, position) {\n            synchronizeHostData();\n            return ts.GoToImplementation.getImplementationAtPosition(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), ts.getTouchingPropertyName(getValidSourceFile(fileName), position));\n        }\n        function getTypeDefinitionAtPosition(fileName, position) {\n            synchronizeHostData();\n            return ts.GoToDefinition.getTypeDefinitionAtPosition(program.getTypeChecker(), getValidSourceFile(fileName), position);\n        }\n        function getOccurrencesAtPosition(fileName, position) {\n            var results = getOccurrencesAtPositionCore(fileName, position);\n            if (results) {\n                var sourceFile_2 = getCanonicalFileName(ts.normalizeSlashes(fileName));\n                results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_2; });\n            }\n            return results;\n        }\n        function getDocumentHighlights(fileName, position, filesToSearch) {\n            synchronizeHostData();\n            var sourceFilesToSearch = ts.map(filesToSearch, function (f) { return program.getSourceFile(f); });\n            var sourceFile = getValidSourceFile(fileName);\n            return ts.DocumentHighlights.getDocumentHighlights(program.getTypeChecker(), cancellationToken, sourceFile, position, sourceFilesToSearch);\n        }\n        function getOccurrencesAtPositionCore(fileName, position) {\n            synchronizeHostData();\n            return convertDocumentHighlights(getDocumentHighlights(fileName, position, [fileName]));\n            function convertDocumentHighlights(documentHighlights) {\n                if (!documentHighlights) {\n                    return undefined;\n                }\n                var result = [];\n                for (var _i = 0, documentHighlights_1 = documentHighlights; _i < documentHighlights_1.length; _i++) {\n                    var entry = documentHighlights_1[_i];\n                    for (var _a = 0, _b = entry.highlightSpans; _a < _b.length; _a++) {\n                        var highlightSpan = _b[_a];\n                        result.push({\n                            fileName: entry.fileName,\n                            textSpan: highlightSpan.textSpan,\n                            isWriteAccess: highlightSpan.kind === ts.HighlightSpanKind.writtenReference,\n                            isDefinition: false\n                        });\n                    }\n                }\n                return result;\n            }\n        }\n        function findRenameLocations(fileName, position, findInStrings, findInComments) {\n            var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments);\n            return ts.FindAllReferences.convertReferences(referencedSymbols);\n        }\n        function getReferencesAtPosition(fileName, position) {\n            var referencedSymbols = findReferencedSymbols(fileName, position, false, false);\n            return ts.FindAllReferences.convertReferences(referencedSymbols);\n        }\n        function findReferences(fileName, position) {\n            var referencedSymbols = findReferencedSymbols(fileName, position, false, false);\n            return ts.filter(referencedSymbols, function (rs) { return !!rs.definition; });\n        }\n        function findReferencedSymbols(fileName, position, findInStrings, findInComments) {\n            synchronizeHostData();\n            return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, findInStrings, findInComments);\n        }\n        function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) {\n            synchronizeHostData();\n            var sourceFiles = fileName ? [getValidSourceFile(fileName)] : program.getSourceFiles();\n            return ts.NavigateTo.getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles);\n        }\n        function getEmitOutput(fileName, emitOnlyDtsFiles) {\n            synchronizeHostData();\n            var sourceFile = getValidSourceFile(fileName);\n            var outputFiles = [];\n            function writeFile(fileName, data, writeByteOrderMark) {\n                outputFiles.push({\n                    name: fileName,\n                    writeByteOrderMark: writeByteOrderMark,\n                    text: data\n                });\n            }\n            var emitOutput = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles);\n            return {\n                outputFiles: outputFiles,\n                emitSkipped: emitOutput.emitSkipped\n            };\n        }\n        function getSignatureHelpItems(fileName, position) {\n            synchronizeHostData();\n            var sourceFile = getValidSourceFile(fileName);\n            return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, cancellationToken);\n        }\n        function getNonBoundSourceFile(fileName) {\n            return syntaxTreeCache.getCurrentSourceFile(fileName);\n        }\n        function getSourceFile(fileName) {\n            return getNonBoundSourceFile(fileName);\n        }\n        function getNameOrDottedNameSpan(fileName, startPos, _endPos) {\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            var node = ts.getTouchingPropertyName(sourceFile, startPos);\n            if (node === sourceFile) {\n                return;\n            }\n            switch (node.kind) {\n                case 177:\n                case 141:\n                case 9:\n                case 85:\n                case 100:\n                case 94:\n                case 96:\n                case 98:\n                case 167:\n                case 70:\n                    break;\n                default:\n                    return;\n            }\n            var nodeForStartPos = node;\n            while (true) {\n                if (ts.isRightSideOfPropertyAccess(nodeForStartPos) || ts.isRightSideOfQualifiedName(nodeForStartPos)) {\n                    nodeForStartPos = nodeForStartPos.parent;\n                }\n                else if (ts.isNameOfModuleDeclaration(nodeForStartPos)) {\n                    if (nodeForStartPos.parent.parent.kind === 230 &&\n                        nodeForStartPos.parent.parent.body === nodeForStartPos.parent) {\n                        nodeForStartPos = nodeForStartPos.parent.parent.name;\n                    }\n                    else {\n                        break;\n                    }\n                }\n                else {\n                    break;\n                }\n            }\n            return ts.createTextSpanFromBounds(nodeForStartPos.getStart(), node.getEnd());\n        }\n        function getBreakpointStatementAtPosition(fileName, position) {\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            return ts.BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position);\n        }\n        function getNavigationBarItems(fileName) {\n            return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName));\n        }\n        function getNavigationTree(fileName) {\n            return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName));\n        }\n        function isTsOrTsxFile(fileName) {\n            var kind = ts.getScriptKind(fileName, host);\n            return kind === 3 || kind === 4;\n        }\n        function getSemanticClassifications(fileName, span) {\n            if (!isTsOrTsxFile(fileName)) {\n                return [];\n            }\n            synchronizeHostData();\n            return ts.getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);\n        }\n        function getEncodedSemanticClassifications(fileName, span) {\n            if (!isTsOrTsxFile(fileName)) {\n                return { spans: [], endOfLineState: 0 };\n            }\n            synchronizeHostData();\n            return ts.getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);\n        }\n        function getSyntacticClassifications(fileName, span) {\n            return ts.getSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span);\n        }\n        function getEncodedSyntacticClassifications(fileName, span) {\n            return ts.getEncodedSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span);\n        }\n        function getOutliningSpans(fileName) {\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            return ts.OutliningElementsCollector.collectElements(sourceFile);\n        }\n        function getBraceMatchingAtPosition(fileName, position) {\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            var result = [];\n            var token = ts.getTouchingToken(sourceFile, position);\n            if (token.getStart(sourceFile) === position) {\n                var matchKind = getMatchingTokenKind(token);\n                if (matchKind) {\n                    var parentElement = token.parent;\n                    var childNodes = parentElement.getChildren(sourceFile);\n                    for (var _i = 0, childNodes_1 = childNodes; _i < childNodes_1.length; _i++) {\n                        var current = childNodes_1[_i];\n                        if (current.kind === matchKind) {\n                            var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile));\n                            var range2 = ts.createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile));\n                            if (range1.start < range2.start) {\n                                result.push(range1, range2);\n                            }\n                            else {\n                                result.push(range2, range1);\n                            }\n                            break;\n                        }\n                    }\n                }\n            }\n            return result;\n            function getMatchingTokenKind(token) {\n                switch (token.kind) {\n                    case 16: return 17;\n                    case 18: return 19;\n                    case 20: return 21;\n                    case 26: return 28;\n                    case 17: return 16;\n                    case 19: return 18;\n                    case 21: return 20;\n                    case 28: return 26;\n                }\n                return undefined;\n            }\n        }\n        function getIndentationAtPosition(fileName, position, editorOptions) {\n            var start = ts.timestamp();\n            var settings = toEditorSettings(editorOptions);\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            log(\"getIndentationAtPosition: getCurrentSourceFile: \" + (ts.timestamp() - start));\n            start = ts.timestamp();\n            var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, settings);\n            log(\"getIndentationAtPosition: computeIndentation  : \" + (ts.timestamp() - start));\n            return result;\n        }\n        function getFormattingEditsForRange(fileName, start, end, options) {\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            var settings = toEditorSettings(options);\n            return ts.formatting.formatSelection(start, end, sourceFile, getRuleProvider(settings), settings);\n        }\n        function getFormattingEditsForDocument(fileName, options) {\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            var settings = toEditorSettings(options);\n            return ts.formatting.formatDocument(sourceFile, getRuleProvider(settings), settings);\n        }\n        function getFormattingEditsAfterKeystroke(fileName, position, key, options) {\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            var settings = toEditorSettings(options);\n            if (key === \"}\") {\n                return ts.formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(settings), settings);\n            }\n            else if (key === \";\") {\n                return ts.formatting.formatOnSemicolon(position, sourceFile, getRuleProvider(settings), settings);\n            }\n            else if (key === \"\\n\") {\n                return ts.formatting.formatOnEnter(position, sourceFile, getRuleProvider(settings), settings);\n            }\n            return [];\n        }\n        function getCodeFixesAtPosition(fileName, start, end, errorCodes) {\n            synchronizeHostData();\n            var sourceFile = getValidSourceFile(fileName);\n            var span = { start: start, length: end - start };\n            var newLineChar = ts.getNewLineOrDefaultFromHost(host);\n            var allFixes = [];\n            ts.forEach(errorCodes, function (error) {\n                cancellationToken.throwIfCancellationRequested();\n                var context = {\n                    errorCode: error,\n                    sourceFile: sourceFile,\n                    span: span,\n                    program: program,\n                    newLineCharacter: newLineChar,\n                    host: host,\n                    cancellationToken: cancellationToken\n                };\n                var fixes = ts.codefix.getFixes(context);\n                if (fixes) {\n                    allFixes = allFixes.concat(fixes);\n                }\n            });\n            return allFixes;\n        }\n        function getDocCommentTemplateAtPosition(fileName, position) {\n            return ts.JsDoc.getDocCommentTemplateAtPosition(ts.getNewLineOrDefaultFromHost(host), syntaxTreeCache.getCurrentSourceFile(fileName), position);\n        }\n        function isValidBraceCompletionAtPosition(fileName, position, openingBrace) {\n            if (openingBrace === 60) {\n                return false;\n            }\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position)) {\n                return false;\n            }\n            if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) {\n                return openingBrace === 123;\n            }\n            if (ts.isInTemplateString(sourceFile, position)) {\n                return false;\n            }\n            return true;\n        }\n        function getTodoComments(fileName, descriptors) {\n            synchronizeHostData();\n            var sourceFile = getValidSourceFile(fileName);\n            cancellationToken.throwIfCancellationRequested();\n            var fileContents = sourceFile.text;\n            var result = [];\n            if (descriptors.length > 0) {\n                var regExp = getTodoCommentsRegExp();\n                var matchArray = void 0;\n                while (matchArray = regExp.exec(fileContents)) {\n                    cancellationToken.throwIfCancellationRequested();\n                    var firstDescriptorCaptureIndex = 3;\n                    ts.Debug.assert(matchArray.length === descriptors.length + firstDescriptorCaptureIndex);\n                    var preamble = matchArray[1];\n                    var matchPosition = matchArray.index + preamble.length;\n                    var token = ts.getTokenAtPosition(sourceFile, matchPosition);\n                    if (!ts.isInsideComment(sourceFile, token, matchPosition)) {\n                        continue;\n                    }\n                    var descriptor = undefined;\n                    for (var i = 0, n = descriptors.length; i < n; i++) {\n                        if (matchArray[i + firstDescriptorCaptureIndex]) {\n                            descriptor = descriptors[i];\n                        }\n                    }\n                    ts.Debug.assert(descriptor !== undefined);\n                    if (isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor.text.length))) {\n                        continue;\n                    }\n                    var message = matchArray[2];\n                    result.push({\n                        descriptor: descriptor,\n                        message: message,\n                        position: matchPosition\n                    });\n                }\n            }\n            return result;\n            function escapeRegExp(str) {\n                return str.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\");\n            }\n            function getTodoCommentsRegExp() {\n                var singleLineCommentStart = /(?:\\/\\/+\\s*)/.source;\n                var multiLineCommentStart = /(?:\\/\\*+\\s*)/.source;\n                var anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\\s|\\*)*)/.source;\n                var preamble = \"(\" + anyNumberOfSpacesAndAsterisksAtStartOfLine + \"|\" + singleLineCommentStart + \"|\" + multiLineCommentStart + \")\";\n                var literals = \"(?:\" + ts.map(descriptors, function (d) { return \"(\" + escapeRegExp(d.text) + \")\"; }).join(\"|\") + \")\";\n                var endOfLineOrEndOfComment = /(?:$|\\*\\/)/.source;\n                var messageRemainder = /(?:.*?)/.source;\n                var messagePortion = \"(\" + literals + messageRemainder + \")\";\n                var regExpString = preamble + messagePortion + endOfLineOrEndOfComment;\n                return new RegExp(regExpString, \"gim\");\n            }\n            function isLetterOrDigit(char) {\n                return (char >= 97 && char <= 122) ||\n                    (char >= 65 && char <= 90) ||\n                    (char >= 48 && char <= 57);\n            }\n        }\n        function getRenameInfo(fileName, position) {\n            synchronizeHostData();\n            var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings());\n            return ts.Rename.getRenameInfo(program.getTypeChecker(), defaultLibFileName, getCanonicalFileName, getValidSourceFile(fileName), position);\n        }\n        return {\n            dispose: dispose,\n            cleanupSemanticCache: cleanupSemanticCache,\n            getSyntacticDiagnostics: getSyntacticDiagnostics,\n            getSemanticDiagnostics: getSemanticDiagnostics,\n            getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics,\n            getSyntacticClassifications: getSyntacticClassifications,\n            getSemanticClassifications: getSemanticClassifications,\n            getEncodedSyntacticClassifications: getEncodedSyntacticClassifications,\n            getEncodedSemanticClassifications: getEncodedSemanticClassifications,\n            getCompletionsAtPosition: getCompletionsAtPosition,\n            getCompletionEntryDetails: getCompletionEntryDetails,\n            getCompletionEntrySymbol: getCompletionEntrySymbol,\n            getSignatureHelpItems: getSignatureHelpItems,\n            getQuickInfoAtPosition: getQuickInfoAtPosition,\n            getDefinitionAtPosition: getDefinitionAtPosition,\n            getImplementationAtPosition: getImplementationAtPosition,\n            getTypeDefinitionAtPosition: getTypeDefinitionAtPosition,\n            getReferencesAtPosition: getReferencesAtPosition,\n            findReferences: findReferences,\n            getOccurrencesAtPosition: getOccurrencesAtPosition,\n            getDocumentHighlights: getDocumentHighlights,\n            getNameOrDottedNameSpan: getNameOrDottedNameSpan,\n            getBreakpointStatementAtPosition: getBreakpointStatementAtPosition,\n            getNavigateToItems: getNavigateToItems,\n            getRenameInfo: getRenameInfo,\n            findRenameLocations: findRenameLocations,\n            getNavigationBarItems: getNavigationBarItems,\n            getNavigationTree: getNavigationTree,\n            getOutliningSpans: getOutliningSpans,\n            getTodoComments: getTodoComments,\n            getBraceMatchingAtPosition: getBraceMatchingAtPosition,\n            getIndentationAtPosition: getIndentationAtPosition,\n            getFormattingEditsForRange: getFormattingEditsForRange,\n            getFormattingEditsForDocument: getFormattingEditsForDocument,\n            getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke,\n            getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition,\n            isValidBraceCompletionAtPosition: isValidBraceCompletionAtPosition,\n            getCodeFixesAtPosition: getCodeFixesAtPosition,\n            getEmitOutput: getEmitOutput,\n            getNonBoundSourceFile: getNonBoundSourceFile,\n            getSourceFile: getSourceFile,\n            getProgram: getProgram\n        };\n    }\n    ts.createLanguageService = createLanguageService;\n    function getNameTable(sourceFile) {\n        if (!sourceFile.nameTable) {\n            initializeNameTable(sourceFile);\n        }\n        return sourceFile.nameTable;\n    }\n    ts.getNameTable = getNameTable;\n    function initializeNameTable(sourceFile) {\n        var nameTable = ts.createMap();\n        walk(sourceFile);\n        sourceFile.nameTable = nameTable;\n        function walk(node) {\n            switch (node.kind) {\n                case 70:\n                    nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1;\n                    break;\n                case 9:\n                case 8:\n                    if (ts.isDeclarationName(node) ||\n                        node.parent.kind === 245 ||\n                        isArgumentOfElementAccessExpression(node) ||\n                        ts.isLiteralComputedPropertyDeclarationName(node)) {\n                        nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1;\n                    }\n                    break;\n                default:\n                    ts.forEachChild(node, walk);\n                    if (node.jsDoc) {\n                        for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {\n                            var jsDoc = _a[_i];\n                            ts.forEachChild(jsDoc, walk);\n                        }\n                    }\n            }\n        }\n    }\n    function isArgumentOfElementAccessExpression(node) {\n        return node &&\n            node.parent &&\n            node.parent.kind === 178 &&\n            node.parent.argumentExpression === node;\n    }\n    function getDefaultLibFilePath(options) {\n        if (typeof __dirname !== \"undefined\") {\n            return __dirname + ts.directorySeparator + ts.getDefaultLibFileName(options);\n        }\n        throw new Error(\"getDefaultLibFilePath is only supported when consumed as a node module. \");\n    }\n    ts.getDefaultLibFilePath = getDefaultLibFilePath;\n    function initializeServices() {\n        ts.objectAllocator = getServicesObjectAllocator();\n    }\n    initializeServices();\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var server;\n    (function (server) {\n        var ScriptInfo = (function () {\n            function ScriptInfo(host, fileName, content, scriptKind, isOpen, hasMixedContent) {\n                if (isOpen === void 0) { isOpen = false; }\n                if (hasMixedContent === void 0) { hasMixedContent = false; }\n                this.host = host;\n                this.fileName = fileName;\n                this.scriptKind = scriptKind;\n                this.isOpen = isOpen;\n                this.hasMixedContent = hasMixedContent;\n                this.containingProjects = [];\n                this.path = ts.toPath(fileName, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames));\n                this.svc = server.ScriptVersionCache.fromString(host, content);\n                this.scriptKind = scriptKind\n                    ? scriptKind\n                    : ts.getScriptKindFromFileName(fileName);\n            }\n            ScriptInfo.prototype.getFormatCodeSettings = function () {\n                return this.formatCodeSettings;\n            };\n            ScriptInfo.prototype.attachToProject = function (project) {\n                var isNew = !this.isAttached(project);\n                if (isNew) {\n                    this.containingProjects.push(project);\n                }\n                return isNew;\n            };\n            ScriptInfo.prototype.isAttached = function (project) {\n                switch (this.containingProjects.length) {\n                    case 0: return false;\n                    case 1: return this.containingProjects[0] === project;\n                    case 2: return this.containingProjects[0] === project || this.containingProjects[1] === project;\n                    default: return ts.contains(this.containingProjects, project);\n                }\n            };\n            ScriptInfo.prototype.detachFromProject = function (project) {\n                switch (this.containingProjects.length) {\n                    case 0:\n                        return;\n                    case 1:\n                        if (this.containingProjects[0] === project) {\n                            this.containingProjects.pop();\n                        }\n                        break;\n                    case 2:\n                        if (this.containingProjects[0] === project) {\n                            this.containingProjects[0] = this.containingProjects.pop();\n                        }\n                        else if (this.containingProjects[1] === project) {\n                            this.containingProjects.pop();\n                        }\n                        break;\n                    default:\n                        server.removeItemFromSet(this.containingProjects, project);\n                        break;\n                }\n            };\n            ScriptInfo.prototype.detachAllProjects = function () {\n                for (var _i = 0, _a = this.containingProjects; _i < _a.length; _i++) {\n                    var p = _a[_i];\n                    p.removeFile(this, false);\n                }\n                this.containingProjects.length = 0;\n            };\n            ScriptInfo.prototype.getDefaultProject = function () {\n                if (this.containingProjects.length === 0) {\n                    return server.Errors.ThrowNoProject();\n                }\n                return this.containingProjects[0];\n            };\n            ScriptInfo.prototype.setFormatOptions = function (formatSettings) {\n                if (formatSettings) {\n                    if (!this.formatCodeSettings) {\n                        this.formatCodeSettings = server.getDefaultFormatCodeSettings(this.host);\n                    }\n                    server.mergeMaps(this.formatCodeSettings, formatSettings);\n                }\n            };\n            ScriptInfo.prototype.setWatcher = function (watcher) {\n                this.stopWatcher();\n                this.fileWatcher = watcher;\n            };\n            ScriptInfo.prototype.stopWatcher = function () {\n                if (this.fileWatcher) {\n                    this.fileWatcher.close();\n                    this.fileWatcher = undefined;\n                }\n            };\n            ScriptInfo.prototype.getLatestVersion = function () {\n                return this.svc.latestVersion().toString();\n            };\n            ScriptInfo.prototype.reload = function (script) {\n                this.svc.reload(script);\n                this.markContainingProjectsAsDirty();\n            };\n            ScriptInfo.prototype.saveTo = function (fileName) {\n                var snap = this.snap();\n                this.host.writeFile(fileName, snap.getText(0, snap.getLength()));\n            };\n            ScriptInfo.prototype.reloadFromFile = function (tempFileName) {\n                if (this.hasMixedContent) {\n                    this.reload(\"\");\n                }\n                else {\n                    this.svc.reloadFromFile(tempFileName || this.fileName);\n                    this.markContainingProjectsAsDirty();\n                }\n            };\n            ScriptInfo.prototype.snap = function () {\n                return this.svc.getSnapshot();\n            };\n            ScriptInfo.prototype.getLineInfo = function (line) {\n                var snap = this.snap();\n                return snap.index.lineNumberToInfo(line);\n            };\n            ScriptInfo.prototype.editContent = function (start, end, newText) {\n                this.svc.edit(start, end - start, newText);\n                this.markContainingProjectsAsDirty();\n            };\n            ScriptInfo.prototype.markContainingProjectsAsDirty = function () {\n                for (var _i = 0, _a = this.containingProjects; _i < _a.length; _i++) {\n                    var p = _a[_i];\n                    p.markAsDirty();\n                }\n            };\n            ScriptInfo.prototype.lineToTextSpan = function (line) {\n                var index = this.snap().index;\n                var lineInfo = index.lineNumberToInfo(line + 1);\n                var len;\n                if (lineInfo.leaf) {\n                    len = lineInfo.leaf.text.length;\n                }\n                else {\n                    var nextLineInfo = index.lineNumberToInfo(line + 2);\n                    len = nextLineInfo.offset - lineInfo.offset;\n                }\n                return ts.createTextSpan(lineInfo.offset, len);\n            };\n            ScriptInfo.prototype.lineOffsetToPosition = function (line, offset) {\n                var index = this.snap().index;\n                var lineInfo = index.lineNumberToInfo(line);\n                return (lineInfo.offset + offset - 1);\n            };\n            ScriptInfo.prototype.positionToLineOffset = function (position) {\n                var index = this.snap().index;\n                var lineOffset = index.charOffsetToLineNumberAndPos(position);\n                return { line: lineOffset.line, offset: lineOffset.offset + 1 };\n            };\n            return ScriptInfo;\n        }());\n        server.ScriptInfo = ScriptInfo;\n    })(server = ts.server || (ts.server = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var server;\n    (function (server) {\n        var LSHost = (function () {\n            function LSHost(host, project, cancellationToken) {\n                var _this = this;\n                this.host = host;\n                this.project = project;\n                this.cancellationToken = cancellationToken;\n                this.resolvedModuleNames = ts.createFileMap();\n                this.resolvedTypeReferenceDirectives = ts.createFileMap();\n                this.getCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames);\n                if (host.trace) {\n                    this.trace = function (s) { return host.trace(s); };\n                }\n                this.resolveModuleName = function (moduleName, containingFile, compilerOptions, host) {\n                    var globalCache = _this.project.getTypeAcquisition().enable\n                        ? _this.project.projectService.typingsInstaller.globalTypingsCacheLocation\n                        : undefined;\n                    var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host);\n                    if (!(primaryResult.resolvedModule && ts.extensionIsTypeScript(primaryResult.resolvedModule.extension)) && globalCache !== undefined) {\n                        var _a = ts.loadModuleFromGlobalCache(moduleName, _this.project.getProjectName(), compilerOptions, host, globalCache), resolvedModule = _a.resolvedModule, failedLookupLocations = _a.failedLookupLocations;\n                        if (resolvedModule) {\n                            return { resolvedModule: resolvedModule, failedLookupLocations: primaryResult.failedLookupLocations.concat(failedLookupLocations) };\n                        }\n                    }\n                    return primaryResult;\n                };\n                if (this.host.realpath) {\n                    this.realpath = function (path) { return _this.host.realpath(path); };\n                }\n            }\n            LSHost.prototype.startRecordingFilesWithChangedResolutions = function () {\n                this.filesWithChangedSetOfUnresolvedImports = [];\n            };\n            LSHost.prototype.finishRecordingFilesWithChangedResolutions = function () {\n                var collected = this.filesWithChangedSetOfUnresolvedImports;\n                this.filesWithChangedSetOfUnresolvedImports = undefined;\n                return collected;\n            };\n            LSHost.prototype.resolveNamesWithLocalCache = function (names, containingFile, cache, loader, getResult, getResultFileName, logChanges) {\n                var path = ts.toPath(containingFile, this.host.getCurrentDirectory(), this.getCanonicalFileName);\n                var currentResolutionsInFile = cache.get(path);\n                var newResolutions = ts.createMap();\n                var resolvedModules = [];\n                var compilerOptions = this.getCompilationSettings();\n                var lastDeletedFileName = this.project.projectService.lastDeletedFile && this.project.projectService.lastDeletedFile.fileName;\n                for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {\n                    var name_50 = names_2[_i];\n                    var resolution = newResolutions[name_50];\n                    if (!resolution) {\n                        var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_50];\n                        if (moduleResolutionIsValid(existingResolution)) {\n                            resolution = existingResolution;\n                        }\n                        else {\n                            newResolutions[name_50] = resolution = loader(name_50, containingFile, compilerOptions, this);\n                        }\n                        if (logChanges && this.filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) {\n                            this.filesWithChangedSetOfUnresolvedImports.push(path);\n                            logChanges = false;\n                        }\n                    }\n                    ts.Debug.assert(resolution !== undefined);\n                    resolvedModules.push(getResult(resolution));\n                }\n                cache.set(path, newResolutions);\n                return resolvedModules;\n                function resolutionIsEqualTo(oldResolution, newResolution) {\n                    if (oldResolution === newResolution) {\n                        return true;\n                    }\n                    if (!oldResolution || !newResolution) {\n                        return false;\n                    }\n                    var oldResult = getResult(oldResolution);\n                    var newResult = getResult(newResolution);\n                    if (oldResult === newResult) {\n                        return true;\n                    }\n                    if (!oldResult || !newResult) {\n                        return false;\n                    }\n                    return getResultFileName(oldResult) === getResultFileName(newResult);\n                }\n                function moduleResolutionIsValid(resolution) {\n                    if (!resolution) {\n                        return false;\n                    }\n                    var result = getResult(resolution);\n                    if (result) {\n                        return getResultFileName(result) !== lastDeletedFileName;\n                    }\n                    return resolution.failedLookupLocations.length === 0;\n                }\n            };\n            LSHost.prototype.getProjectVersion = function () {\n                return this.project.getProjectVersion();\n            };\n            LSHost.prototype.getCompilationSettings = function () {\n                return this.compilationSettings;\n            };\n            LSHost.prototype.useCaseSensitiveFileNames = function () {\n                return this.host.useCaseSensitiveFileNames;\n            };\n            LSHost.prototype.getCancellationToken = function () {\n                return this.cancellationToken;\n            };\n            LSHost.prototype.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) {\n                return this.resolveNamesWithLocalCache(typeDirectiveNames, containingFile, this.resolvedTypeReferenceDirectives, ts.resolveTypeReferenceDirective, function (m) { return m.resolvedTypeReferenceDirective; }, function (r) { return r.resolvedFileName; }, false);\n            };\n            LSHost.prototype.resolveModuleNames = function (moduleNames, containingFile) {\n                return this.resolveNamesWithLocalCache(moduleNames, containingFile, this.resolvedModuleNames, this.resolveModuleName, function (m) { return m.resolvedModule; }, function (r) { return r.resolvedFileName; }, true);\n            };\n            LSHost.prototype.getDefaultLibFileName = function () {\n                var nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath()));\n                return ts.combinePaths(nodeModuleBinDir, ts.getDefaultLibFileName(this.compilationSettings));\n            };\n            LSHost.prototype.getScriptSnapshot = function (filename) {\n                var scriptInfo = this.project.getScriptInfoLSHost(filename);\n                if (scriptInfo) {\n                    return scriptInfo.snap();\n                }\n            };\n            LSHost.prototype.getScriptFileNames = function () {\n                return this.project.getRootFilesLSHost();\n            };\n            LSHost.prototype.getTypeRootsVersion = function () {\n                return this.project.typesVersion;\n            };\n            LSHost.prototype.getScriptKind = function (fileName) {\n                var info = this.project.getScriptInfoLSHost(fileName);\n                return info && info.scriptKind;\n            };\n            LSHost.prototype.getScriptVersion = function (filename) {\n                var info = this.project.getScriptInfoLSHost(filename);\n                return info && info.getLatestVersion();\n            };\n            LSHost.prototype.getCurrentDirectory = function () {\n                return this.host.getCurrentDirectory();\n            };\n            LSHost.prototype.resolvePath = function (path) {\n                return this.host.resolvePath(path);\n            };\n            LSHost.prototype.fileExists = function (path) {\n                return this.host.fileExists(path);\n            };\n            LSHost.prototype.readFile = function (fileName) {\n                return this.host.readFile(fileName);\n            };\n            LSHost.prototype.directoryExists = function (path) {\n                return this.host.directoryExists(path);\n            };\n            LSHost.prototype.readDirectory = function (path, extensions, exclude, include) {\n                return this.host.readDirectory(path, extensions, exclude, include);\n            };\n            LSHost.prototype.getDirectories = function (path) {\n                return this.host.getDirectories(path);\n            };\n            LSHost.prototype.notifyFileRemoved = function (info) {\n                this.resolvedModuleNames.remove(info.path);\n                this.resolvedTypeReferenceDirectives.remove(info.path);\n            };\n            LSHost.prototype.setCompilationSettings = function (opt) {\n                if (ts.changesAffectModuleResolution(this.compilationSettings, opt)) {\n                    this.resolvedModuleNames.clear();\n                    this.resolvedTypeReferenceDirectives.clear();\n                }\n                this.compilationSettings = opt;\n            };\n            return LSHost;\n        }());\n        server.LSHost = LSHost;\n    })(server = ts.server || (ts.server = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var server;\n    (function (server) {\n        server.nullTypingsInstaller = {\n            enqueueInstallTypingsRequest: ts.noop,\n            attach: ts.noop,\n            onProjectClosed: ts.noop,\n            globalTypingsCacheLocation: undefined\n        };\n        var TypingsCacheEntry = (function () {\n            function TypingsCacheEntry() {\n            }\n            return TypingsCacheEntry;\n        }());\n        function setIsEqualTo(arr1, arr2) {\n            if (arr1 === arr2) {\n                return true;\n            }\n            if ((arr1 || server.emptyArray).length === 0 && (arr2 || server.emptyArray).length === 0) {\n                return true;\n            }\n            var set = ts.createMap();\n            var unique = 0;\n            for (var _i = 0, arr1_1 = arr1; _i < arr1_1.length; _i++) {\n                var v = arr1_1[_i];\n                if (set[v] !== true) {\n                    set[v] = true;\n                    unique++;\n                }\n            }\n            for (var _a = 0, arr2_1 = arr2; _a < arr2_1.length; _a++) {\n                var v = arr2_1[_a];\n                if (!ts.hasProperty(set, v)) {\n                    return false;\n                }\n                if (set[v] === true) {\n                    set[v] = false;\n                    unique--;\n                }\n            }\n            return unique === 0;\n        }\n        function typeAcquisitionChanged(opt1, opt2) {\n            return opt1.enable !== opt2.enable ||\n                !setIsEqualTo(opt1.include, opt2.include) ||\n                !setIsEqualTo(opt1.exclude, opt2.exclude);\n        }\n        function compilerOptionsChanged(opt1, opt2) {\n            return opt1.allowJs != opt2.allowJs;\n        }\n        function unresolvedImportsChanged(imports1, imports2) {\n            if (imports1 === imports2) {\n                return false;\n            }\n            return !ts.arrayIsEqualTo(imports1, imports2);\n        }\n        var TypingsCache = (function () {\n            function TypingsCache(installer) {\n                this.installer = installer;\n                this.perProjectCache = ts.createMap();\n            }\n            TypingsCache.prototype.getTypingsForProject = function (project, unresolvedImports, forceRefresh) {\n                var typeAcquisition = project.getTypeAcquisition();\n                if (!typeAcquisition || !typeAcquisition.enable) {\n                    return server.emptyArray;\n                }\n                var entry = this.perProjectCache[project.getProjectName()];\n                var result = entry ? entry.typings : server.emptyArray;\n                if (forceRefresh ||\n                    !entry ||\n                    typeAcquisitionChanged(typeAcquisition, entry.typeAcquisition) ||\n                    compilerOptionsChanged(project.getCompilerOptions(), entry.compilerOptions) ||\n                    unresolvedImportsChanged(unresolvedImports, entry.unresolvedImports)) {\n                    this.perProjectCache[project.getProjectName()] = {\n                        compilerOptions: project.getCompilerOptions(),\n                        typeAcquisition: typeAcquisition,\n                        typings: result,\n                        unresolvedImports: unresolvedImports,\n                        poisoned: true\n                    };\n                    this.installer.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports);\n                }\n                return result;\n            };\n            TypingsCache.prototype.updateTypingsForProject = function (projectName, compilerOptions, typeAcquisition, unresolvedImports, newTypings) {\n                this.perProjectCache[projectName] = {\n                    compilerOptions: compilerOptions,\n                    typeAcquisition: typeAcquisition,\n                    typings: server.toSortedReadonlyArray(newTypings),\n                    unresolvedImports: unresolvedImports,\n                    poisoned: false\n                };\n            };\n            TypingsCache.prototype.deleteTypingsForProject = function (projectName) {\n                delete this.perProjectCache[projectName];\n            };\n            TypingsCache.prototype.onProjectClosed = function (project) {\n                delete this.perProjectCache[project.getProjectName()];\n                this.installer.onProjectClosed(project);\n            };\n            return TypingsCache;\n        }());\n        server.TypingsCache = TypingsCache;\n    })(server = ts.server || (ts.server = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var server;\n    (function (server) {\n        function shouldEmitFile(scriptInfo) {\n            return !scriptInfo.hasMixedContent;\n        }\n        server.shouldEmitFile = shouldEmitFile;\n        var BuilderFileInfo = (function () {\n            function BuilderFileInfo(scriptInfo, project) {\n                this.scriptInfo = scriptInfo;\n                this.project = project;\n            }\n            BuilderFileInfo.prototype.isExternalModuleOrHasOnlyAmbientExternalModules = function () {\n                var sourceFile = this.getSourceFile();\n                return ts.isExternalModule(sourceFile) || this.containsOnlyAmbientModules(sourceFile);\n            };\n            BuilderFileInfo.prototype.containsOnlyAmbientModules = function (sourceFile) {\n                for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {\n                    var statement = _a[_i];\n                    if (statement.kind !== 230 || statement.name.kind !== 9) {\n                        return false;\n                    }\n                }\n                return true;\n            };\n            BuilderFileInfo.prototype.computeHash = function (text) {\n                return this.project.projectService.host.createHash(text);\n            };\n            BuilderFileInfo.prototype.getSourceFile = function () {\n                return this.project.getSourceFile(this.scriptInfo.path);\n            };\n            BuilderFileInfo.prototype.updateShapeSignature = function () {\n                var sourceFile = this.getSourceFile();\n                if (!sourceFile) {\n                    return true;\n                }\n                var lastSignature = this.lastCheckedShapeSignature;\n                if (sourceFile.isDeclarationFile) {\n                    this.lastCheckedShapeSignature = this.computeHash(sourceFile.text);\n                }\n                else {\n                    var emitOutput = this.project.getFileEmitOutput(this.scriptInfo, true);\n                    if (emitOutput.outputFiles && emitOutput.outputFiles.length > 0) {\n                        this.lastCheckedShapeSignature = this.computeHash(emitOutput.outputFiles[0].text);\n                    }\n                }\n                return !lastSignature || this.lastCheckedShapeSignature !== lastSignature;\n            };\n            return BuilderFileInfo;\n        }());\n        server.BuilderFileInfo = BuilderFileInfo;\n        var AbstractBuilder = (function () {\n            function AbstractBuilder(project, ctor) {\n                this.project = project;\n                this.ctor = ctor;\n                this.fileInfos = ts.createFileMap();\n            }\n            AbstractBuilder.prototype.getFileInfo = function (path) {\n                return this.fileInfos.get(path);\n            };\n            AbstractBuilder.prototype.getOrCreateFileInfo = function (path) {\n                var fileInfo = this.getFileInfo(path);\n                if (!fileInfo) {\n                    var scriptInfo = this.project.getScriptInfo(path);\n                    fileInfo = new this.ctor(scriptInfo, this.project);\n                    this.setFileInfo(path, fileInfo);\n                }\n                return fileInfo;\n            };\n            AbstractBuilder.prototype.getFileInfoPaths = function () {\n                return this.fileInfos.getKeys();\n            };\n            AbstractBuilder.prototype.setFileInfo = function (path, info) {\n                this.fileInfos.set(path, info);\n            };\n            AbstractBuilder.prototype.removeFileInfo = function (path) {\n                this.fileInfos.remove(path);\n            };\n            AbstractBuilder.prototype.forEachFileInfo = function (action) {\n                this.fileInfos.forEachValue(function (_path, value) { return action(value); });\n            };\n            AbstractBuilder.prototype.emitFile = function (scriptInfo, writeFile) {\n                var fileInfo = this.getFileInfo(scriptInfo.path);\n                if (!fileInfo) {\n                    return false;\n                }\n                var _a = this.project.getFileEmitOutput(fileInfo.scriptInfo, false), emitSkipped = _a.emitSkipped, outputFiles = _a.outputFiles;\n                if (!emitSkipped) {\n                    var projectRootPath = this.project.getProjectRootPath();\n                    for (var _i = 0, outputFiles_1 = outputFiles; _i < outputFiles_1.length; _i++) {\n                        var outputFile = outputFiles_1[_i];\n                        var outputFileAbsoluteFileName = ts.getNormalizedAbsolutePath(outputFile.name, projectRootPath ? projectRootPath : ts.getDirectoryPath(scriptInfo.fileName));\n                        writeFile(outputFileAbsoluteFileName, outputFile.text, outputFile.writeByteOrderMark);\n                    }\n                }\n                return !emitSkipped;\n            };\n            return AbstractBuilder;\n        }());\n        var NonModuleBuilder = (function (_super) {\n            __extends(NonModuleBuilder, _super);\n            function NonModuleBuilder(project) {\n                var _this = _super.call(this, project, BuilderFileInfo) || this;\n                _this.project = project;\n                return _this;\n            }\n            NonModuleBuilder.prototype.onProjectUpdateGraph = function () {\n            };\n            NonModuleBuilder.prototype.getFilesAffectedBy = function (scriptInfo) {\n                var info = this.getOrCreateFileInfo(scriptInfo.path);\n                var singleFileResult = scriptInfo.hasMixedContent ? [] : [scriptInfo.fileName];\n                if (info.updateShapeSignature()) {\n                    var options = this.project.getCompilerOptions();\n                    if (options && (options.out || options.outFile)) {\n                        return singleFileResult;\n                    }\n                    return this.project.getAllEmittableFiles();\n                }\n                return singleFileResult;\n            };\n            return NonModuleBuilder;\n        }(AbstractBuilder));\n        var ModuleBuilderFileInfo = (function (_super) {\n            __extends(ModuleBuilderFileInfo, _super);\n            function ModuleBuilderFileInfo() {\n                var _this = _super.apply(this, arguments) || this;\n                _this.references = [];\n                _this.referencedBy = [];\n                return _this;\n            }\n            ModuleBuilderFileInfo.compareFileInfos = function (lf, rf) {\n                var l = lf.scriptInfo.fileName;\n                var r = rf.scriptInfo.fileName;\n                return (l < r ? -1 : (l > r ? 1 : 0));\n            };\n            ;\n            ModuleBuilderFileInfo.addToReferenceList = function (array, fileInfo) {\n                if (array.length === 0) {\n                    array.push(fileInfo);\n                    return;\n                }\n                var insertIndex = ts.binarySearch(array, fileInfo, ModuleBuilderFileInfo.compareFileInfos);\n                if (insertIndex < 0) {\n                    array.splice(~insertIndex, 0, fileInfo);\n                }\n            };\n            ModuleBuilderFileInfo.removeFromReferenceList = function (array, fileInfo) {\n                if (!array || array.length === 0) {\n                    return;\n                }\n                if (array[0] === fileInfo) {\n                    array.splice(0, 1);\n                    return;\n                }\n                var removeIndex = ts.binarySearch(array, fileInfo, ModuleBuilderFileInfo.compareFileInfos);\n                if (removeIndex >= 0) {\n                    array.splice(removeIndex, 1);\n                }\n            };\n            ModuleBuilderFileInfo.prototype.addReferencedBy = function (fileInfo) {\n                ModuleBuilderFileInfo.addToReferenceList(this.referencedBy, fileInfo);\n            };\n            ModuleBuilderFileInfo.prototype.removeReferencedBy = function (fileInfo) {\n                ModuleBuilderFileInfo.removeFromReferenceList(this.referencedBy, fileInfo);\n            };\n            ModuleBuilderFileInfo.prototype.removeFileReferences = function () {\n                for (var _i = 0, _a = this.references; _i < _a.length; _i++) {\n                    var reference = _a[_i];\n                    reference.removeReferencedBy(this);\n                }\n                this.references = [];\n            };\n            return ModuleBuilderFileInfo;\n        }(BuilderFileInfo));\n        var ModuleBuilder = (function (_super) {\n            __extends(ModuleBuilder, _super);\n            function ModuleBuilder(project) {\n                var _this = _super.call(this, project, ModuleBuilderFileInfo) || this;\n                _this.project = project;\n                return _this;\n            }\n            ModuleBuilder.prototype.getReferencedFileInfos = function (fileInfo) {\n                var _this = this;\n                if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) {\n                    return [];\n                }\n                var referencedFilePaths = this.project.getReferencedFiles(fileInfo.scriptInfo.path);\n                if (referencedFilePaths.length > 0) {\n                    return ts.map(referencedFilePaths, function (f) { return _this.getOrCreateFileInfo(f); }).sort(ModuleBuilderFileInfo.compareFileInfos);\n                }\n                return [];\n            };\n            ModuleBuilder.prototype.onProjectUpdateGraph = function () {\n                this.ensureProjectDependencyGraphUpToDate();\n            };\n            ModuleBuilder.prototype.ensureProjectDependencyGraphUpToDate = function () {\n                var _this = this;\n                if (!this.projectVersionForDependencyGraph || this.project.getProjectVersion() !== this.projectVersionForDependencyGraph) {\n                    var currentScriptInfos = this.project.getScriptInfos();\n                    for (var _i = 0, currentScriptInfos_1 = currentScriptInfos; _i < currentScriptInfos_1.length; _i++) {\n                        var scriptInfo = currentScriptInfos_1[_i];\n                        var fileInfo = this.getOrCreateFileInfo(scriptInfo.path);\n                        this.updateFileReferences(fileInfo);\n                    }\n                    this.forEachFileInfo(function (fileInfo) {\n                        if (!_this.project.containsScriptInfo(fileInfo.scriptInfo)) {\n                            fileInfo.removeFileReferences();\n                            _this.removeFileInfo(fileInfo.scriptInfo.path);\n                        }\n                    });\n                    this.projectVersionForDependencyGraph = this.project.getProjectVersion();\n                }\n            };\n            ModuleBuilder.prototype.updateFileReferences = function (fileInfo) {\n                if (fileInfo.scriptVersionForReferences === fileInfo.scriptInfo.getLatestVersion()) {\n                    return;\n                }\n                var newReferences = this.getReferencedFileInfos(fileInfo);\n                var oldReferences = fileInfo.references;\n                var oldIndex = 0;\n                var newIndex = 0;\n                while (oldIndex < oldReferences.length && newIndex < newReferences.length) {\n                    var oldReference = oldReferences[oldIndex];\n                    var newReference = newReferences[newIndex];\n                    var compare = ModuleBuilderFileInfo.compareFileInfos(oldReference, newReference);\n                    if (compare < 0) {\n                        oldReference.removeReferencedBy(fileInfo);\n                        oldIndex++;\n                    }\n                    else if (compare > 0) {\n                        newReference.addReferencedBy(fileInfo);\n                        newIndex++;\n                    }\n                    else {\n                        oldIndex++;\n                        newIndex++;\n                    }\n                }\n                for (var i = oldIndex; i < oldReferences.length; i++) {\n                    oldReferences[i].removeReferencedBy(fileInfo);\n                }\n                for (var i = newIndex; i < newReferences.length; i++) {\n                    newReferences[i].addReferencedBy(fileInfo);\n                }\n                fileInfo.references = newReferences;\n                fileInfo.scriptVersionForReferences = fileInfo.scriptInfo.getLatestVersion();\n            };\n            ModuleBuilder.prototype.getFilesAffectedBy = function (scriptInfo) {\n                this.ensureProjectDependencyGraphUpToDate();\n                var singleFileResult = scriptInfo.hasMixedContent ? [] : [scriptInfo.fileName];\n                var fileInfo = this.getFileInfo(scriptInfo.path);\n                if (!fileInfo || !fileInfo.updateShapeSignature()) {\n                    return singleFileResult;\n                }\n                if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) {\n                    return this.project.getAllEmittableFiles();\n                }\n                var options = this.project.getCompilerOptions();\n                if (options && (options.isolatedModules || options.out || options.outFile)) {\n                    return singleFileResult;\n                }\n                var queue = fileInfo.referencedBy.slice(0);\n                var fileNameSet = ts.createMap();\n                fileNameSet[scriptInfo.fileName] = scriptInfo;\n                while (queue.length > 0) {\n                    var processingFileInfo = queue.pop();\n                    if (processingFileInfo.updateShapeSignature() && processingFileInfo.referencedBy.length > 0) {\n                        for (var _i = 0, _a = processingFileInfo.referencedBy; _i < _a.length; _i++) {\n                            var potentialFileInfo = _a[_i];\n                            if (!fileNameSet[potentialFileInfo.scriptInfo.fileName]) {\n                                queue.push(potentialFileInfo);\n                            }\n                        }\n                    }\n                    fileNameSet[processingFileInfo.scriptInfo.fileName] = processingFileInfo.scriptInfo;\n                }\n                var result = [];\n                for (var fileName in fileNameSet) {\n                    if (shouldEmitFile(fileNameSet[fileName])) {\n                        result.push(fileName);\n                    }\n                }\n                return result;\n            };\n            return ModuleBuilder;\n        }(AbstractBuilder));\n        function createBuilder(project) {\n            var moduleKind = project.getCompilerOptions().module;\n            switch (moduleKind) {\n                case ts.ModuleKind.None:\n                    return new NonModuleBuilder(project);\n                default:\n                    return new ModuleBuilder(project);\n            }\n        }\n        server.createBuilder = createBuilder;\n    })(server = ts.server || (ts.server = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var server;\n    (function (server) {\n        var ProjectKind;\n        (function (ProjectKind) {\n            ProjectKind[ProjectKind[\"Inferred\"] = 0] = \"Inferred\";\n            ProjectKind[ProjectKind[\"Configured\"] = 1] = \"Configured\";\n            ProjectKind[ProjectKind[\"External\"] = 2] = \"External\";\n        })(ProjectKind = server.ProjectKind || (server.ProjectKind = {}));\n        function remove(items, item) {\n            var index = items.indexOf(item);\n            if (index >= 0) {\n                items.splice(index, 1);\n            }\n        }\n        function countEachFileTypes(infos) {\n            var result = { js: 0, jsx: 0, ts: 0, tsx: 0, dts: 0 };\n            for (var _i = 0, infos_1 = infos; _i < infos_1.length; _i++) {\n                var info = infos_1[_i];\n                switch (info.scriptKind) {\n                    case 1:\n                        result.js += 1;\n                        break;\n                    case 2:\n                        result.jsx += 1;\n                        break;\n                    case 3:\n                        ts.fileExtensionIs(info.fileName, \".d.ts\")\n                            ? result.dts += 1\n                            : result.ts += 1;\n                        break;\n                    case 4:\n                        result.tsx += 1;\n                        break;\n                }\n            }\n            return result;\n        }\n        function hasOneOrMoreJsAndNoTsFiles(project) {\n            var counts = countEachFileTypes(project.getScriptInfos());\n            return counts.js > 0 && counts.ts === 0 && counts.tsx === 0;\n        }\n        function allRootFilesAreJsOrDts(project) {\n            var counts = countEachFileTypes(project.getRootScriptInfos());\n            return counts.ts === 0 && counts.tsx === 0;\n        }\n        server.allRootFilesAreJsOrDts = allRootFilesAreJsOrDts;\n        function allFilesAreJsOrDts(project) {\n            var counts = countEachFileTypes(project.getScriptInfos());\n            return counts.ts === 0 && counts.tsx === 0;\n        }\n        server.allFilesAreJsOrDts = allFilesAreJsOrDts;\n        var UnresolvedImportsMap = (function () {\n            function UnresolvedImportsMap() {\n                this.perFileMap = ts.createFileMap();\n                this.version = 0;\n            }\n            UnresolvedImportsMap.prototype.clear = function () {\n                this.perFileMap.clear();\n                this.version = 0;\n            };\n            UnresolvedImportsMap.prototype.getVersion = function () {\n                return this.version;\n            };\n            UnresolvedImportsMap.prototype.remove = function (path) {\n                this.perFileMap.remove(path);\n                this.version++;\n            };\n            UnresolvedImportsMap.prototype.get = function (path) {\n                return this.perFileMap.get(path);\n            };\n            UnresolvedImportsMap.prototype.set = function (path, value) {\n                this.perFileMap.set(path, value);\n                this.version++;\n            };\n            return UnresolvedImportsMap;\n        }());\n        server.UnresolvedImportsMap = UnresolvedImportsMap;\n        var emptyResult = [];\n        var getEmptyResult = function () { return emptyResult; };\n        var getUndefined = function () { return undefined; };\n        var emptyEncodedSemanticClassifications = { spans: emptyResult, endOfLineState: 0 };\n        function createNoSemanticFeaturesWrapper(realLanguageService) {\n            return {\n                cleanupSemanticCache: ts.noop,\n                getSyntacticDiagnostics: function (fileName) {\n                    return fileName ? realLanguageService.getSyntacticDiagnostics(fileName) : emptyResult;\n                },\n                getSemanticDiagnostics: getEmptyResult,\n                getCompilerOptionsDiagnostics: function () {\n                    return realLanguageService.getCompilerOptionsDiagnostics();\n                },\n                getSyntacticClassifications: function (fileName, span) {\n                    return realLanguageService.getSyntacticClassifications(fileName, span);\n                },\n                getEncodedSyntacticClassifications: function (fileName, span) {\n                    return realLanguageService.getEncodedSyntacticClassifications(fileName, span);\n                },\n                getSemanticClassifications: getEmptyResult,\n                getEncodedSemanticClassifications: function () {\n                    return emptyEncodedSemanticClassifications;\n                },\n                getCompletionsAtPosition: getUndefined,\n                findReferences: getEmptyResult,\n                getCompletionEntryDetails: getUndefined,\n                getQuickInfoAtPosition: getUndefined,\n                findRenameLocations: getEmptyResult,\n                getNameOrDottedNameSpan: function (fileName, startPos, endPos) {\n                    return realLanguageService.getNameOrDottedNameSpan(fileName, startPos, endPos);\n                },\n                getBreakpointStatementAtPosition: function (fileName, position) {\n                    return realLanguageService.getBreakpointStatementAtPosition(fileName, position);\n                },\n                getBraceMatchingAtPosition: function (fileName, position) {\n                    return realLanguageService.getBraceMatchingAtPosition(fileName, position);\n                },\n                getSignatureHelpItems: getUndefined,\n                getDefinitionAtPosition: getEmptyResult,\n                getRenameInfo: function () { return ({\n                    canRename: false,\n                    localizedErrorMessage: ts.getLocaleSpecificMessage(ts.Diagnostics.Language_service_is_disabled),\n                    displayName: undefined,\n                    fullDisplayName: undefined,\n                    kind: undefined,\n                    kindModifiers: undefined,\n                    triggerSpan: undefined\n                }); },\n                getTypeDefinitionAtPosition: getUndefined,\n                getReferencesAtPosition: getEmptyResult,\n                getDocumentHighlights: getEmptyResult,\n                getOccurrencesAtPosition: getEmptyResult,\n                getNavigateToItems: getEmptyResult,\n                getNavigationBarItems: function (fileName) {\n                    return realLanguageService.getNavigationBarItems(fileName);\n                },\n                getNavigationTree: function (fileName) {\n                    return realLanguageService.getNavigationTree(fileName);\n                },\n                getOutliningSpans: function (fileName) {\n                    return realLanguageService.getOutliningSpans(fileName);\n                },\n                getTodoComments: getEmptyResult,\n                getIndentationAtPosition: function (fileName, position, options) {\n                    return realLanguageService.getIndentationAtPosition(fileName, position, options);\n                },\n                getFormattingEditsForRange: function (fileName, start, end, options) {\n                    return realLanguageService.getFormattingEditsForRange(fileName, start, end, options);\n                },\n                getFormattingEditsForDocument: function (fileName, options) {\n                    return realLanguageService.getFormattingEditsForDocument(fileName, options);\n                },\n                getFormattingEditsAfterKeystroke: function (fileName, position, key, options) {\n                    return realLanguageService.getFormattingEditsAfterKeystroke(fileName, position, key, options);\n                },\n                getDocCommentTemplateAtPosition: function (fileName, position) {\n                    return realLanguageService.getDocCommentTemplateAtPosition(fileName, position);\n                },\n                isValidBraceCompletionAtPosition: function (fileName, position, openingBrace) {\n                    return realLanguageService.isValidBraceCompletionAtPosition(fileName, position, openingBrace);\n                },\n                getEmitOutput: getUndefined,\n                getProgram: function () {\n                    return realLanguageService.getProgram();\n                },\n                getNonBoundSourceFile: function (fileName) {\n                    return realLanguageService.getNonBoundSourceFile(fileName);\n                },\n                dispose: function () {\n                    return realLanguageService.dispose();\n                },\n                getCompletionEntrySymbol: getUndefined,\n                getImplementationAtPosition: getEmptyResult,\n                getSourceFile: function (fileName) {\n                    return realLanguageService.getSourceFile(fileName);\n                },\n                getCodeFixesAtPosition: getEmptyResult\n            };\n        }\n        server.createNoSemanticFeaturesWrapper = createNoSemanticFeaturesWrapper;\n        var Project = (function () {\n            function Project(projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) {\n                this.projectName = projectName;\n                this.projectKind = projectKind;\n                this.projectService = projectService;\n                this.documentRegistry = documentRegistry;\n                this.compilerOptions = compilerOptions;\n                this.compileOnSaveEnabled = compileOnSaveEnabled;\n                this.rootFiles = [];\n                this.rootFilesMap = ts.createFileMap();\n                this.cachedUnresolvedImportsPerFile = new UnresolvedImportsMap();\n                this.languageServiceEnabled = true;\n                this.lastReportedVersion = 0;\n                this.projectStructureVersion = 0;\n                this.projectStateVersion = 0;\n                this.typesVersion = 0;\n                if (!this.compilerOptions) {\n                    this.compilerOptions = ts.getDefaultCompilerOptions();\n                    this.compilerOptions.allowNonTsExtensions = true;\n                    this.compilerOptions.allowJs = true;\n                }\n                else if (hasExplicitListOfFiles) {\n                    this.compilerOptions.allowNonTsExtensions = true;\n                }\n                this.setInternalCompilerOptionsForEmittingJsFiles();\n                this.lsHost = new server.LSHost(this.projectService.host, this, this.projectService.cancellationToken);\n                this.lsHost.setCompilationSettings(this.compilerOptions);\n                this.languageService = ts.createLanguageService(this.lsHost, this.documentRegistry);\n                this.noSemanticFeaturesLanguageService = createNoSemanticFeaturesWrapper(this.languageService);\n                if (!languageServiceEnabled) {\n                    this.disableLanguageService();\n                }\n                this.builder = server.createBuilder(this);\n                this.markAsDirty();\n            }\n            Project.prototype.isNonTsProject = function () {\n                this.updateGraph();\n                return allFilesAreJsOrDts(this);\n            };\n            Project.prototype.isJsOnlyProject = function () {\n                this.updateGraph();\n                return hasOneOrMoreJsAndNoTsFiles(this);\n            };\n            Project.prototype.getCachedUnresolvedImportsPerFile_TestOnly = function () {\n                return this.cachedUnresolvedImportsPerFile;\n            };\n            Project.prototype.setInternalCompilerOptionsForEmittingJsFiles = function () {\n                if (this.projectKind === ProjectKind.Inferred || this.projectKind === ProjectKind.External) {\n                    this.compilerOptions.noEmitForJsFiles = true;\n                }\n            };\n            Project.prototype.getProjectErrors = function () {\n                return this.projectErrors;\n            };\n            Project.prototype.getLanguageService = function (ensureSynchronized) {\n                if (ensureSynchronized === void 0) { ensureSynchronized = true; }\n                if (ensureSynchronized) {\n                    this.updateGraph();\n                }\n                return this.languageServiceEnabled\n                    ? this.languageService\n                    : this.noSemanticFeaturesLanguageService;\n            };\n            Project.prototype.getCompileOnSaveAffectedFileList = function (scriptInfo) {\n                if (!this.languageServiceEnabled) {\n                    return [];\n                }\n                this.updateGraph();\n                return this.builder.getFilesAffectedBy(scriptInfo);\n            };\n            Project.prototype.getProjectVersion = function () {\n                return this.projectStateVersion.toString();\n            };\n            Project.prototype.enableLanguageService = function () {\n                if (this.languageServiceEnabled) {\n                    return;\n                }\n                this.languageServiceEnabled = true;\n                this.projectService.onUpdateLanguageServiceStateForProject(this, true);\n            };\n            Project.prototype.disableLanguageService = function () {\n                if (!this.languageServiceEnabled) {\n                    return;\n                }\n                this.languageService.cleanupSemanticCache();\n                this.languageServiceEnabled = false;\n                this.projectService.onUpdateLanguageServiceStateForProject(this, false);\n            };\n            Project.prototype.getProjectName = function () {\n                return this.projectName;\n            };\n            Project.prototype.getSourceFile = function (path) {\n                if (!this.program) {\n                    return undefined;\n                }\n                return this.program.getSourceFileByPath(path);\n            };\n            Project.prototype.updateTypes = function () {\n                this.typesVersion++;\n                this.markAsDirty();\n                this.updateGraph();\n            };\n            Project.prototype.close = function () {\n                if (this.program) {\n                    for (var _i = 0, _a = this.program.getSourceFiles(); _i < _a.length; _i++) {\n                        var f = _a[_i];\n                        var info = this.projectService.getScriptInfo(f.fileName);\n                        info.detachFromProject(this);\n                    }\n                }\n                else {\n                    for (var _b = 0, _c = this.rootFiles; _b < _c.length; _b++) {\n                        var root = _c[_b];\n                        root.detachFromProject(this);\n                    }\n                }\n                this.rootFiles = undefined;\n                this.rootFilesMap = undefined;\n                this.program = undefined;\n                this.languageService.dispose();\n            };\n            Project.prototype.getCompilerOptions = function () {\n                return this.compilerOptions;\n            };\n            Project.prototype.hasRoots = function () {\n                return this.rootFiles && this.rootFiles.length > 0;\n            };\n            Project.prototype.getRootFiles = function () {\n                return this.rootFiles && this.rootFiles.map(function (info) { return info.fileName; });\n            };\n            Project.prototype.getRootFilesLSHost = function () {\n                var result = [];\n                if (this.rootFiles) {\n                    for (var _i = 0, _a = this.rootFiles; _i < _a.length; _i++) {\n                        var f = _a[_i];\n                        result.push(f.fileName);\n                    }\n                    if (this.typingFiles) {\n                        for (var _b = 0, _c = this.typingFiles; _b < _c.length; _b++) {\n                            var f = _c[_b];\n                            result.push(f);\n                        }\n                    }\n                }\n                return result;\n            };\n            Project.prototype.getRootScriptInfos = function () {\n                return this.rootFiles;\n            };\n            Project.prototype.getScriptInfos = function () {\n                var _this = this;\n                return ts.map(this.program.getSourceFiles(), function (sourceFile) {\n                    var scriptInfo = _this.projectService.getScriptInfoForPath(sourceFile.path);\n                    if (!scriptInfo) {\n                        ts.Debug.assert(false, \"scriptInfo for a file '\" + sourceFile.fileName + \"' is missing.\");\n                    }\n                    return scriptInfo;\n                });\n            };\n            Project.prototype.getFileEmitOutput = function (info, emitOnlyDtsFiles) {\n                if (!this.languageServiceEnabled) {\n                    return undefined;\n                }\n                return this.getLanguageService().getEmitOutput(info.fileName, emitOnlyDtsFiles);\n            };\n            Project.prototype.getFileNames = function (excludeFilesFromExternalLibraries) {\n                if (!this.program) {\n                    return [];\n                }\n                if (!this.languageServiceEnabled) {\n                    var rootFiles = this.getRootFiles();\n                    if (this.compilerOptions) {\n                        var defaultLibrary = ts.getDefaultLibFilePath(this.compilerOptions);\n                        if (defaultLibrary) {\n                            (rootFiles || (rootFiles = [])).push(server.asNormalizedPath(defaultLibrary));\n                        }\n                    }\n                    return rootFiles;\n                }\n                var result = [];\n                for (var _i = 0, _a = this.program.getSourceFiles(); _i < _a.length; _i++) {\n                    var f = _a[_i];\n                    if (excludeFilesFromExternalLibraries && this.program.isSourceFileFromExternalLibrary(f)) {\n                        continue;\n                    }\n                    result.push(server.asNormalizedPath(f.fileName));\n                }\n                return result;\n            };\n            Project.prototype.getAllEmittableFiles = function () {\n                if (!this.languageServiceEnabled) {\n                    return [];\n                }\n                var defaultLibraryFileName = ts.getDefaultLibFileName(this.compilerOptions);\n                var infos = this.getScriptInfos();\n                var result = [];\n                for (var _i = 0, infos_2 = infos; _i < infos_2.length; _i++) {\n                    var info = infos_2[_i];\n                    if (ts.getBaseFileName(info.fileName) !== defaultLibraryFileName && server.shouldEmitFile(info)) {\n                        result.push(info.fileName);\n                    }\n                }\n                return result;\n            };\n            Project.prototype.containsScriptInfo = function (info) {\n                return this.isRoot(info) || (this.program && this.program.getSourceFileByPath(info.path) !== undefined);\n            };\n            Project.prototype.containsFile = function (filename, requireOpen) {\n                var info = this.projectService.getScriptInfoForNormalizedPath(filename);\n                if (info && (info.isOpen || !requireOpen)) {\n                    return this.containsScriptInfo(info);\n                }\n            };\n            Project.prototype.isRoot = function (info) {\n                return this.rootFilesMap && this.rootFilesMap.contains(info.path);\n            };\n            Project.prototype.addRoot = function (info) {\n                if (!this.isRoot(info)) {\n                    this.rootFiles.push(info);\n                    this.rootFilesMap.set(info.path, info);\n                    info.attachToProject(this);\n                    this.markAsDirty();\n                }\n            };\n            Project.prototype.removeFile = function (info, detachFromProject) {\n                if (detachFromProject === void 0) { detachFromProject = true; }\n                this.removeRootFileIfNecessary(info);\n                this.lsHost.notifyFileRemoved(info);\n                this.cachedUnresolvedImportsPerFile.remove(info.path);\n                if (detachFromProject) {\n                    info.detachFromProject(this);\n                }\n                this.markAsDirty();\n            };\n            Project.prototype.markAsDirty = function () {\n                this.projectStateVersion++;\n            };\n            Project.prototype.extractUnresolvedImportsFromSourceFile = function (file, result) {\n                var cached = this.cachedUnresolvedImportsPerFile.get(file.path);\n                if (cached) {\n                    for (var _i = 0, cached_1 = cached; _i < cached_1.length; _i++) {\n                        var f = cached_1[_i];\n                        result.push(f);\n                    }\n                    return;\n                }\n                var unresolvedImports;\n                if (file.resolvedModules) {\n                    for (var name_51 in file.resolvedModules) {\n                        if (!file.resolvedModules[name_51] && !ts.isExternalModuleNameRelative(name_51)) {\n                            var trimmed = name_51.trim();\n                            var i = trimmed.indexOf(\"/\");\n                            if (i !== -1 && trimmed.charCodeAt(0) === 64) {\n                                i = trimmed.indexOf(\"/\", i + 1);\n                            }\n                            if (i !== -1) {\n                                trimmed = trimmed.substr(0, i);\n                            }\n                            (unresolvedImports || (unresolvedImports = [])).push(trimmed);\n                            result.push(trimmed);\n                        }\n                    }\n                }\n                this.cachedUnresolvedImportsPerFile.set(file.path, unresolvedImports || server.emptyArray);\n            };\n            Project.prototype.updateGraph = function () {\n                if (!this.languageServiceEnabled) {\n                    return true;\n                }\n                this.lsHost.startRecordingFilesWithChangedResolutions();\n                var hasChanges = this.updateGraphWorker();\n                var changedFiles = this.lsHost.finishRecordingFilesWithChangedResolutions() || server.emptyArray;\n                for (var _i = 0, changedFiles_1 = changedFiles; _i < changedFiles_1.length; _i++) {\n                    var file = changedFiles_1[_i];\n                    this.cachedUnresolvedImportsPerFile.remove(file);\n                }\n                var unresolvedImports;\n                if (hasChanges || changedFiles.length) {\n                    var result = [];\n                    for (var _a = 0, _b = this.program.getSourceFiles(); _a < _b.length; _a++) {\n                        var sourceFile = _b[_a];\n                        this.extractUnresolvedImportsFromSourceFile(sourceFile, result);\n                    }\n                    this.lastCachedUnresolvedImportsList = server.toSortedReadonlyArray(result);\n                }\n                unresolvedImports = this.lastCachedUnresolvedImportsList;\n                var cachedTypings = this.projectService.typingsCache.getTypingsForProject(this, unresolvedImports, hasChanges);\n                if (this.setTypings(cachedTypings)) {\n                    hasChanges = this.updateGraphWorker() || hasChanges;\n                }\n                if (hasChanges) {\n                    this.projectStructureVersion++;\n                }\n                return !hasChanges;\n            };\n            Project.prototype.setTypings = function (typings) {\n                if (ts.arrayIsEqualTo(this.typingFiles, typings)) {\n                    return false;\n                }\n                this.typingFiles = typings;\n                this.markAsDirty();\n                return true;\n            };\n            Project.prototype.updateGraphWorker = function () {\n                var oldProgram = this.program;\n                this.program = this.languageService.getProgram();\n                var hasChanges = false;\n                if (!oldProgram || (this.program !== oldProgram && !oldProgram.structureIsReused)) {\n                    hasChanges = true;\n                    if (oldProgram) {\n                        for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) {\n                            var f = _a[_i];\n                            if (this.program.getSourceFileByPath(f.path)) {\n                                continue;\n                            }\n                            var scriptInfoToDetach = this.projectService.getScriptInfo(f.fileName);\n                            if (scriptInfoToDetach) {\n                                scriptInfoToDetach.detachFromProject(this);\n                            }\n                        }\n                    }\n                }\n                this.builder.onProjectUpdateGraph();\n                return hasChanges;\n            };\n            Project.prototype.getScriptInfoLSHost = function (fileName) {\n                var scriptInfo = this.projectService.getOrCreateScriptInfo(fileName, false);\n                if (scriptInfo) {\n                    scriptInfo.attachToProject(this);\n                }\n                return scriptInfo;\n            };\n            Project.prototype.getScriptInfoForNormalizedPath = function (fileName) {\n                var scriptInfo = this.projectService.getOrCreateScriptInfoForNormalizedPath(fileName, false);\n                if (scriptInfo && !scriptInfo.isAttached(this)) {\n                    return server.Errors.ThrowProjectDoesNotContainDocument(fileName, this);\n                }\n                return scriptInfo;\n            };\n            Project.prototype.getScriptInfo = function (uncheckedFileName) {\n                return this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName));\n            };\n            Project.prototype.filesToString = function () {\n                if (!this.program) {\n                    return \"\";\n                }\n                var strBuilder = \"\";\n                for (var _i = 0, _a = this.program.getSourceFiles(); _i < _a.length; _i++) {\n                    var file = _a[_i];\n                    strBuilder += file.fileName + \"\\n\";\n                }\n                return strBuilder;\n            };\n            Project.prototype.setCompilerOptions = function (compilerOptions) {\n                if (compilerOptions) {\n                    if (this.projectKind === ProjectKind.Inferred) {\n                        compilerOptions.allowJs = true;\n                    }\n                    compilerOptions.allowNonTsExtensions = true;\n                    if (ts.changesAffectModuleResolution(this.compilerOptions, compilerOptions)) {\n                        this.cachedUnresolvedImportsPerFile.clear();\n                        this.lastCachedUnresolvedImportsList = undefined;\n                    }\n                    this.compilerOptions = compilerOptions;\n                    this.setInternalCompilerOptionsForEmittingJsFiles();\n                    this.lsHost.setCompilationSettings(compilerOptions);\n                    this.markAsDirty();\n                }\n            };\n            Project.prototype.reloadScript = function (filename, tempFileName) {\n                var script = this.projectService.getScriptInfoForNormalizedPath(filename);\n                if (script) {\n                    ts.Debug.assert(script.isAttached(this));\n                    script.reloadFromFile(tempFileName);\n                    return true;\n                }\n                return false;\n            };\n            Project.prototype.getChangesSinceVersion = function (lastKnownVersion) {\n                this.updateGraph();\n                var info = {\n                    projectName: this.getProjectName(),\n                    version: this.projectStructureVersion,\n                    isInferred: this.projectKind === ProjectKind.Inferred,\n                    options: this.getCompilerOptions()\n                };\n                if (this.lastReportedFileNames && lastKnownVersion === this.lastReportedVersion) {\n                    if (this.projectStructureVersion == this.lastReportedVersion) {\n                        return { info: info, projectErrors: this.projectErrors };\n                    }\n                    var lastReportedFileNames = this.lastReportedFileNames;\n                    var currentFiles = ts.arrayToMap(this.getFileNames(), function (x) { return x; });\n                    var added = [];\n                    var removed = [];\n                    for (var id in currentFiles) {\n                        if (!ts.hasProperty(lastReportedFileNames, id)) {\n                            added.push(id);\n                        }\n                    }\n                    for (var id in lastReportedFileNames) {\n                        if (!ts.hasProperty(currentFiles, id)) {\n                            removed.push(id);\n                        }\n                    }\n                    this.lastReportedFileNames = currentFiles;\n                    this.lastReportedVersion = this.projectStructureVersion;\n                    return { info: info, changes: { added: added, removed: removed }, projectErrors: this.projectErrors };\n                }\n                else {\n                    var projectFileNames = this.getFileNames();\n                    this.lastReportedFileNames = ts.arrayToMap(projectFileNames, function (x) { return x; });\n                    this.lastReportedVersion = this.projectStructureVersion;\n                    return { info: info, files: projectFileNames, projectErrors: this.projectErrors };\n                }\n            };\n            Project.prototype.getReferencedFiles = function (path) {\n                var _this = this;\n                if (!this.languageServiceEnabled) {\n                    return [];\n                }\n                var sourceFile = this.getSourceFile(path);\n                if (!sourceFile) {\n                    return [];\n                }\n                var referencedFiles = ts.createMap();\n                if (sourceFile.imports && sourceFile.imports.length > 0) {\n                    var checker = this.program.getTypeChecker();\n                    for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) {\n                        var importName = _a[_i];\n                        var symbol = checker.getSymbolAtLocation(importName);\n                        if (symbol && symbol.declarations && symbol.declarations[0]) {\n                            var declarationSourceFile = symbol.declarations[0].getSourceFile();\n                            if (declarationSourceFile) {\n                                referencedFiles[declarationSourceFile.path] = true;\n                            }\n                        }\n                    }\n                }\n                var currentDirectory = ts.getDirectoryPath(path);\n                var getCanonicalFileName = ts.createGetCanonicalFileName(this.projectService.host.useCaseSensitiveFileNames);\n                if (sourceFile.referencedFiles && sourceFile.referencedFiles.length > 0) {\n                    for (var _b = 0, _c = sourceFile.referencedFiles; _b < _c.length; _b++) {\n                        var referencedFile = _c[_b];\n                        var referencedPath = ts.toPath(referencedFile.fileName, currentDirectory, getCanonicalFileName);\n                        referencedFiles[referencedPath] = true;\n                    }\n                }\n                if (sourceFile.resolvedTypeReferenceDirectiveNames) {\n                    for (var typeName in sourceFile.resolvedTypeReferenceDirectiveNames) {\n                        var resolvedTypeReferenceDirective = sourceFile.resolvedTypeReferenceDirectiveNames[typeName];\n                        if (!resolvedTypeReferenceDirective) {\n                            continue;\n                        }\n                        var fileName = resolvedTypeReferenceDirective.resolvedFileName;\n                        var typeFilePath = ts.toPath(fileName, currentDirectory, getCanonicalFileName);\n                        referencedFiles[typeFilePath] = true;\n                    }\n                }\n                var allFileNames = ts.map(Object.keys(referencedFiles), function (key) { return key; });\n                return ts.filter(allFileNames, function (file) { return _this.projectService.host.fileExists(file); });\n            };\n            Project.prototype.removeRootFileIfNecessary = function (info) {\n                if (this.isRoot(info)) {\n                    remove(this.rootFiles, info);\n                    this.rootFilesMap.remove(info.path);\n                }\n            };\n            return Project;\n        }());\n        server.Project = Project;\n        var InferredProject = (function (_super) {\n            __extends(InferredProject, _super);\n            function InferredProject(projectService, documentRegistry, compilerOptions) {\n                var _this = _super.call(this, InferredProject.newName(), ProjectKind.Inferred, projectService, documentRegistry, undefined, true, compilerOptions, false) || this;\n                _this.directoriesWatchedForTsconfig = [];\n                return _this;\n            }\n            InferredProject.prototype.getProjectRootPath = function () {\n                if (this.projectService.useSingleInferredProject) {\n                    return undefined;\n                }\n                var rootFiles = this.getRootFiles();\n                return ts.getDirectoryPath(rootFiles[0]);\n            };\n            InferredProject.prototype.close = function () {\n                _super.prototype.close.call(this);\n                for (var _i = 0, _a = this.directoriesWatchedForTsconfig; _i < _a.length; _i++) {\n                    var directory = _a[_i];\n                    this.projectService.stopWatchingDirectory(directory);\n                }\n            };\n            InferredProject.prototype.getTypeAcquisition = function () {\n                return {\n                    enable: allRootFilesAreJsOrDts(this),\n                    include: [],\n                    exclude: []\n                };\n            };\n            return InferredProject;\n        }(Project));\n        InferredProject.newName = (function () {\n            var nextId = 1;\n            return function () {\n                var id = nextId;\n                nextId++;\n                return server.makeInferredProjectName(id);\n            };\n        })();\n        server.InferredProject = InferredProject;\n        var ConfiguredProject = (function (_super) {\n            __extends(ConfiguredProject, _super);\n            function ConfiguredProject(configFileName, projectService, documentRegistry, hasExplicitListOfFiles, compilerOptions, wildcardDirectories, languageServiceEnabled, compileOnSaveEnabled) {\n                var _this = _super.call(this, configFileName, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this;\n                _this.wildcardDirectories = wildcardDirectories;\n                _this.compileOnSaveEnabled = compileOnSaveEnabled;\n                _this.openRefCount = 0;\n                _this.canonicalConfigFilePath = server.asNormalizedPath(projectService.toCanonicalFileName(configFileName));\n                return _this;\n            }\n            ConfiguredProject.prototype.getConfigFilePath = function () {\n                return this.getProjectName();\n            };\n            ConfiguredProject.prototype.getProjectRootPath = function () {\n                return ts.getDirectoryPath(this.getConfigFilePath());\n            };\n            ConfiguredProject.prototype.setProjectErrors = function (projectErrors) {\n                this.projectErrors = projectErrors;\n            };\n            ConfiguredProject.prototype.setTypeAcquisition = function (newTypeAcquisition) {\n                this.typeAcquisition = newTypeAcquisition;\n            };\n            ConfiguredProject.prototype.getTypeAcquisition = function () {\n                return this.typeAcquisition;\n            };\n            ConfiguredProject.prototype.watchConfigFile = function (callback) {\n                var _this = this;\n                this.projectFileWatcher = this.projectService.host.watchFile(this.getConfigFilePath(), function (_) { return callback(_this); });\n            };\n            ConfiguredProject.prototype.watchTypeRoots = function (callback) {\n                var _this = this;\n                var roots = this.getEffectiveTypeRoots();\n                var watchers = [];\n                for (var _i = 0, roots_1 = roots; _i < roots_1.length; _i++) {\n                    var root = roots_1[_i];\n                    this.projectService.logger.info(\"Add type root watcher for: \" + root);\n                    watchers.push(this.projectService.host.watchDirectory(root, function (path) { return callback(_this, path); }, false));\n                }\n                this.typeRootsWatchers = watchers;\n            };\n            ConfiguredProject.prototype.watchConfigDirectory = function (callback) {\n                var _this = this;\n                if (this.directoryWatcher) {\n                    return;\n                }\n                var directoryToWatch = ts.getDirectoryPath(this.getConfigFilePath());\n                this.projectService.logger.info(\"Add recursive watcher for: \" + directoryToWatch);\n                this.directoryWatcher = this.projectService.host.watchDirectory(directoryToWatch, function (path) { return callback(_this, path); }, true);\n            };\n            ConfiguredProject.prototype.watchWildcards = function (callback) {\n                var _this = this;\n                if (!this.wildcardDirectories) {\n                    return;\n                }\n                var configDirectoryPath = ts.getDirectoryPath(this.getConfigFilePath());\n                this.directoriesWatchedForWildcards = ts.reduceProperties(this.wildcardDirectories, function (watchers, flag, directory) {\n                    if (ts.comparePaths(configDirectoryPath, directory, \".\", !_this.projectService.host.useCaseSensitiveFileNames) !== 0) {\n                        var recursive = (flag & 1) !== 0;\n                        _this.projectService.logger.info(\"Add \" + (recursive ? \"recursive \" : \"\") + \"watcher for: \" + directory);\n                        watchers[directory] = _this.projectService.host.watchDirectory(directory, function (path) { return callback(_this, path); }, recursive);\n                    }\n                    return watchers;\n                }, {});\n            };\n            ConfiguredProject.prototype.stopWatchingDirectory = function () {\n                if (this.directoryWatcher) {\n                    this.directoryWatcher.close();\n                    this.directoryWatcher = undefined;\n                }\n            };\n            ConfiguredProject.prototype.close = function () {\n                _super.prototype.close.call(this);\n                if (this.projectFileWatcher) {\n                    this.projectFileWatcher.close();\n                }\n                if (this.typeRootsWatchers) {\n                    for (var _i = 0, _a = this.typeRootsWatchers; _i < _a.length; _i++) {\n                        var watcher = _a[_i];\n                        watcher.close();\n                    }\n                    this.typeRootsWatchers = undefined;\n                }\n                for (var id in this.directoriesWatchedForWildcards) {\n                    this.directoriesWatchedForWildcards[id].close();\n                }\n                this.directoriesWatchedForWildcards = undefined;\n                this.stopWatchingDirectory();\n            };\n            ConfiguredProject.prototype.addOpenRef = function () {\n                this.openRefCount++;\n            };\n            ConfiguredProject.prototype.deleteOpenRef = function () {\n                this.openRefCount--;\n                return this.openRefCount;\n            };\n            ConfiguredProject.prototype.getEffectiveTypeRoots = function () {\n                return ts.getEffectiveTypeRoots(this.getCompilerOptions(), this.projectService.host) || [];\n            };\n            return ConfiguredProject;\n        }(Project));\n        server.ConfiguredProject = ConfiguredProject;\n        var ExternalProject = (function (_super) {\n            __extends(ExternalProject, _super);\n            function ExternalProject(externalProjectName, projectService, documentRegistry, compilerOptions, languageServiceEnabled, compileOnSaveEnabled, projectFilePath) {\n                var _this = _super.call(this, externalProjectName, ProjectKind.External, projectService, documentRegistry, true, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this;\n                _this.compileOnSaveEnabled = compileOnSaveEnabled;\n                _this.projectFilePath = projectFilePath;\n                return _this;\n            }\n            ExternalProject.prototype.getProjectRootPath = function () {\n                if (this.projectFilePath) {\n                    return ts.getDirectoryPath(this.projectFilePath);\n                }\n                return ts.getDirectoryPath(ts.normalizeSlashes(this.getProjectName()));\n            };\n            ExternalProject.prototype.getTypeAcquisition = function () {\n                return this.typeAcquisition;\n            };\n            ExternalProject.prototype.setProjectErrors = function (projectErrors) {\n                this.projectErrors = projectErrors;\n            };\n            ExternalProject.prototype.setTypeAcquisition = function (newTypeAcquisition) {\n                if (!newTypeAcquisition) {\n                    newTypeAcquisition = {\n                        enable: allRootFilesAreJsOrDts(this),\n                        include: [],\n                        exclude: []\n                    };\n                }\n                else {\n                    if (newTypeAcquisition.enable === undefined) {\n                        newTypeAcquisition.enable = allRootFilesAreJsOrDts(this);\n                    }\n                    if (!newTypeAcquisition.include) {\n                        newTypeAcquisition.include = [];\n                    }\n                    if (!newTypeAcquisition.exclude) {\n                        newTypeAcquisition.exclude = [];\n                    }\n                }\n                this.typeAcquisition = newTypeAcquisition;\n            };\n            return ExternalProject;\n        }(Project));\n        server.ExternalProject = ExternalProject;\n    })(server = ts.server || (ts.server = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var server;\n    (function (server) {\n        server.maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;\n        server.ContextEvent = \"context\";\n        server.ConfigFileDiagEvent = \"configFileDiag\";\n        server.ProjectLanguageServiceStateEvent = \"projectLanguageServiceState\";\n        function prepareConvertersForEnumLikeCompilerOptions(commandLineOptions) {\n            var map = ts.createMap();\n            for (var _i = 0, commandLineOptions_1 = commandLineOptions; _i < commandLineOptions_1.length; _i++) {\n                var option = commandLineOptions_1[_i];\n                if (typeof option.type === \"object\") {\n                    var optionMap = option.type;\n                    for (var id in optionMap) {\n                        ts.Debug.assert(typeof optionMap[id] === \"number\");\n                    }\n                    map[option.name] = optionMap;\n                }\n            }\n            return map;\n        }\n        var compilerOptionConverters = prepareConvertersForEnumLikeCompilerOptions(ts.optionDeclarations);\n        var indentStyle = ts.createMap({\n            \"none\": ts.IndentStyle.None,\n            \"block\": ts.IndentStyle.Block,\n            \"smart\": ts.IndentStyle.Smart\n        });\n        function convertFormatOptions(protocolOptions) {\n            if (typeof protocolOptions.indentStyle === \"string\") {\n                protocolOptions.indentStyle = indentStyle[protocolOptions.indentStyle.toLowerCase()];\n                ts.Debug.assert(protocolOptions.indentStyle !== undefined);\n            }\n            return protocolOptions;\n        }\n        server.convertFormatOptions = convertFormatOptions;\n        function convertCompilerOptions(protocolOptions) {\n            for (var id in compilerOptionConverters) {\n                var propertyValue = protocolOptions[id];\n                if (typeof propertyValue === \"string\") {\n                    var mappedValues = compilerOptionConverters[id];\n                    protocolOptions[id] = mappedValues[propertyValue.toLowerCase()];\n                }\n            }\n            return protocolOptions;\n        }\n        server.convertCompilerOptions = convertCompilerOptions;\n        function tryConvertScriptKindName(scriptKindName) {\n            return typeof scriptKindName === \"string\"\n                ? convertScriptKindName(scriptKindName)\n                : scriptKindName;\n        }\n        server.tryConvertScriptKindName = tryConvertScriptKindName;\n        function convertScriptKindName(scriptKindName) {\n            switch (scriptKindName) {\n                case \"JS\":\n                    return 1;\n                case \"JSX\":\n                    return 2;\n                case \"TS\":\n                    return 3;\n                case \"TSX\":\n                    return 4;\n                default:\n                    return 0;\n            }\n        }\n        server.convertScriptKindName = convertScriptKindName;\n        function combineProjectOutput(projects, action, comparer, areEqual) {\n            var result = projects.reduce(function (previous, current) { return ts.concatenate(previous, action(current)); }, []).sort(comparer);\n            return projects.length > 1 ? ts.deduplicate(result, areEqual) : result;\n        }\n        server.combineProjectOutput = combineProjectOutput;\n        var fileNamePropertyReader = {\n            getFileName: function (x) { return x; },\n            getScriptKind: function (_) { return undefined; },\n            hasMixedContent: function (_) { return false; }\n        };\n        var externalFilePropertyReader = {\n            getFileName: function (x) { return x.fileName; },\n            getScriptKind: function (x) { return tryConvertScriptKindName(x.scriptKind); },\n            hasMixedContent: function (x) { return x.hasMixedContent; }\n        };\n        function findProjectByName(projectName, projects) {\n            for (var _i = 0, projects_1 = projects; _i < projects_1.length; _i++) {\n                var proj = projects_1[_i];\n                if (proj.getProjectName() === projectName) {\n                    return proj;\n                }\n            }\n        }\n        function createFileNotFoundDiagnostic(fileName) {\n            return ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName);\n        }\n        function isRootFileInInferredProject(info) {\n            if (info.containingProjects.length === 0) {\n                return false;\n            }\n            return info.containingProjects[0].projectKind === server.ProjectKind.Inferred && info.containingProjects[0].isRoot(info);\n        }\n        var DirectoryWatchers = (function () {\n            function DirectoryWatchers(projectService) {\n                this.projectService = projectService;\n                this.directoryWatchersForTsconfig = ts.createMap();\n                this.directoryWatchersRefCount = ts.createMap();\n            }\n            DirectoryWatchers.prototype.stopWatchingDirectory = function (directory) {\n                this.directoryWatchersRefCount[directory]--;\n                if (this.directoryWatchersRefCount[directory] === 0) {\n                    this.projectService.logger.info(\"Close directory watcher for: \" + directory);\n                    this.directoryWatchersForTsconfig[directory].close();\n                    delete this.directoryWatchersForTsconfig[directory];\n                }\n            };\n            DirectoryWatchers.prototype.startWatchingContainingDirectoriesForFile = function (fileName, project, callback) {\n                var currentPath = ts.getDirectoryPath(fileName);\n                var parentPath = ts.getDirectoryPath(currentPath);\n                while (currentPath != parentPath) {\n                    if (!this.directoryWatchersForTsconfig[currentPath]) {\n                        this.projectService.logger.info(\"Add watcher for: \" + currentPath);\n                        this.directoryWatchersForTsconfig[currentPath] = this.projectService.host.watchDirectory(currentPath, callback);\n                        this.directoryWatchersRefCount[currentPath] = 1;\n                    }\n                    else {\n                        this.directoryWatchersRefCount[currentPath] += 1;\n                    }\n                    project.directoriesWatchedForTsconfig.push(currentPath);\n                    currentPath = parentPath;\n                    parentPath = ts.getDirectoryPath(parentPath);\n                }\n            };\n            return DirectoryWatchers;\n        }());\n        var ProjectService = (function () {\n            function ProjectService(host, logger, cancellationToken, useSingleInferredProject, typingsInstaller, eventHandler) {\n                if (typingsInstaller === void 0) { typingsInstaller = server.nullTypingsInstaller; }\n                this.host = host;\n                this.logger = logger;\n                this.cancellationToken = cancellationToken;\n                this.useSingleInferredProject = useSingleInferredProject;\n                this.typingsInstaller = typingsInstaller;\n                this.eventHandler = eventHandler;\n                this.filenameToScriptInfo = ts.createFileMap();\n                this.externalProjectToConfiguredProjectMap = ts.createMap();\n                this.externalProjects = [];\n                this.inferredProjects = [];\n                this.configuredProjects = [];\n                this.openFiles = [];\n                ts.Debug.assert(!!host.createHash, \"'ServerHost.createHash' is required for ProjectService\");\n                this.toCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);\n                this.directoryWatchers = new DirectoryWatchers(this);\n                this.throttledOperations = new server.ThrottledOperations(host);\n                this.typingsInstaller.attach(this);\n                this.typingsCache = new server.TypingsCache(this.typingsInstaller);\n                this.hostConfiguration = {\n                    formatCodeOptions: server.getDefaultFormatCodeSettings(this.host),\n                    hostInfo: \"Unknown host\"\n                };\n                this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames, host.getCurrentDirectory());\n            }\n            ProjectService.prototype.getChangedFiles_TestOnly = function () {\n                return this.changedFiles;\n            };\n            ProjectService.prototype.ensureInferredProjectsUpToDate_TestOnly = function () {\n                this.ensureInferredProjectsUpToDate();\n            };\n            ProjectService.prototype.getCompilerOptionsForInferredProjects = function () {\n                return this.compilerOptionsForInferredProjects;\n            };\n            ProjectService.prototype.onUpdateLanguageServiceStateForProject = function (project, languageServiceEnabled) {\n                if (!this.eventHandler) {\n                    return;\n                }\n                this.eventHandler({\n                    eventName: server.ProjectLanguageServiceStateEvent,\n                    data: { project: project, languageServiceEnabled: languageServiceEnabled }\n                });\n            };\n            ProjectService.prototype.updateTypingsForProject = function (response) {\n                var project = this.findProject(response.projectName);\n                if (!project) {\n                    return;\n                }\n                switch (response.kind) {\n                    case server.ActionSet:\n                        this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typeAcquisition, response.unresolvedImports, response.typings);\n                        break;\n                    case server.ActionInvalidate:\n                        this.typingsCache.deleteTypingsForProject(response.projectName);\n                        break;\n                }\n                project.updateGraph();\n            };\n            ProjectService.prototype.setCompilerOptionsForInferredProjects = function (projectCompilerOptions) {\n                this.compilerOptionsForInferredProjects = convertCompilerOptions(projectCompilerOptions);\n                this.compilerOptionsForInferredProjects.allowNonTsExtensions = true;\n                this.compileOnSaveForInferredProjects = projectCompilerOptions.compileOnSave;\n                for (var _i = 0, _a = this.inferredProjects; _i < _a.length; _i++) {\n                    var proj = _a[_i];\n                    proj.setCompilerOptions(this.compilerOptionsForInferredProjects);\n                    proj.compileOnSaveEnabled = projectCompilerOptions.compileOnSave;\n                }\n                this.updateProjectGraphs(this.inferredProjects);\n            };\n            ProjectService.prototype.stopWatchingDirectory = function (directory) {\n                this.directoryWatchers.stopWatchingDirectory(directory);\n            };\n            ProjectService.prototype.findProject = function (projectName) {\n                if (projectName === undefined) {\n                    return undefined;\n                }\n                if (server.isInferredProjectName(projectName)) {\n                    this.ensureInferredProjectsUpToDate();\n                    return findProjectByName(projectName, this.inferredProjects);\n                }\n                return this.findExternalProjectByProjectName(projectName) || this.findConfiguredProjectByProjectName(server.toNormalizedPath(projectName));\n            };\n            ProjectService.prototype.getDefaultProjectForFile = function (fileName, refreshInferredProjects) {\n                if (refreshInferredProjects) {\n                    this.ensureInferredProjectsUpToDate();\n                }\n                var scriptInfo = this.getScriptInfoForNormalizedPath(fileName);\n                return scriptInfo && scriptInfo.getDefaultProject();\n            };\n            ProjectService.prototype.ensureInferredProjectsUpToDate = function () {\n                if (this.changedFiles) {\n                    var projectsToUpdate = void 0;\n                    if (this.changedFiles.length === 1) {\n                        projectsToUpdate = this.changedFiles[0].containingProjects;\n                    }\n                    else {\n                        projectsToUpdate = [];\n                        for (var _i = 0, _a = this.changedFiles; _i < _a.length; _i++) {\n                            var f = _a[_i];\n                            projectsToUpdate = projectsToUpdate.concat(f.containingProjects);\n                        }\n                    }\n                    this.updateProjectGraphs(projectsToUpdate);\n                    this.changedFiles = undefined;\n                }\n            };\n            ProjectService.prototype.findContainingExternalProject = function (fileName) {\n                for (var _i = 0, _a = this.externalProjects; _i < _a.length; _i++) {\n                    var proj = _a[_i];\n                    if (proj.containsFile(fileName)) {\n                        return proj;\n                    }\n                }\n                return undefined;\n            };\n            ProjectService.prototype.getFormatCodeOptions = function (file) {\n                var formatCodeSettings;\n                if (file) {\n                    var info = this.getScriptInfoForNormalizedPath(file);\n                    if (info) {\n                        formatCodeSettings = info.getFormatCodeSettings();\n                    }\n                }\n                return formatCodeSettings || this.hostConfiguration.formatCodeOptions;\n            };\n            ProjectService.prototype.updateProjectGraphs = function (projects) {\n                var shouldRefreshInferredProjects = false;\n                for (var _i = 0, projects_2 = projects; _i < projects_2.length; _i++) {\n                    var p = projects_2[_i];\n                    if (!p.updateGraph()) {\n                        shouldRefreshInferredProjects = true;\n                    }\n                }\n                if (shouldRefreshInferredProjects) {\n                    this.refreshInferredProjects();\n                }\n            };\n            ProjectService.prototype.onSourceFileChanged = function (fileName) {\n                var info = this.getScriptInfoForNormalizedPath(fileName);\n                if (!info) {\n                    this.logger.info(\"Error: got watch notification for unknown file: \" + fileName);\n                    return;\n                }\n                if (!this.host.fileExists(fileName)) {\n                    this.handleDeletedFile(info);\n                }\n                else {\n                    if (info && (!info.isOpen)) {\n                        info.reloadFromFile();\n                        this.updateProjectGraphs(info.containingProjects);\n                    }\n                }\n            };\n            ProjectService.prototype.handleDeletedFile = function (info) {\n                this.logger.info(info.fileName + \" deleted\");\n                info.stopWatcher();\n                if (!info.isOpen) {\n                    this.filenameToScriptInfo.remove(info.path);\n                    this.lastDeletedFile = info;\n                    var containingProjects = info.containingProjects.slice();\n                    info.detachAllProjects();\n                    this.updateProjectGraphs(containingProjects);\n                    this.lastDeletedFile = undefined;\n                    if (!this.eventHandler) {\n                        return;\n                    }\n                    for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) {\n                        var openFile = _a[_i];\n                        this.eventHandler({\n                            eventName: server.ContextEvent,\n                            data: { project: openFile.getDefaultProject(), fileName: openFile.fileName }\n                        });\n                    }\n                }\n                this.printProjects();\n            };\n            ProjectService.prototype.onTypeRootFileChanged = function (project, fileName) {\n                var _this = this;\n                this.logger.info(\"Type root file \" + fileName + \" changed\");\n                this.throttledOperations.schedule(project.getConfigFilePath() + \" * type root\", 250, function () {\n                    project.updateTypes();\n                    _this.updateConfiguredProject(project);\n                    _this.refreshInferredProjects();\n                });\n            };\n            ProjectService.prototype.onSourceFileInDirectoryChangedForConfiguredProject = function (project, fileName) {\n                var _this = this;\n                if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions())) {\n                    return;\n                }\n                this.logger.info(\"Detected source file changes: \" + fileName);\n                this.throttledOperations.schedule(project.getConfigFilePath(), 250, function () { return _this.handleChangeInSourceFileForConfiguredProject(project, fileName); });\n            };\n            ProjectService.prototype.handleChangeInSourceFileForConfiguredProject = function (project, triggerFile) {\n                var _this = this;\n                var _a = this.convertConfigFileContentToProjectOptions(project.getConfigFilePath()), projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors;\n                this.reportConfigFileDiagnostics(project.getProjectName(), configFileErrors, triggerFile);\n                var newRootFiles = projectOptions.files.map((function (f) { return _this.getCanonicalFileName(f); }));\n                var currentRootFiles = project.getRootFiles().map((function (f) { return _this.getCanonicalFileName(f); }));\n                if (!ts.arrayIsEqualTo(currentRootFiles.sort(), newRootFiles.sort())) {\n                    this.logger.info(\"Updating configured project\");\n                    this.updateConfiguredProject(project);\n                    this.refreshInferredProjects();\n                }\n            };\n            ProjectService.prototype.onConfigChangedForConfiguredProject = function (project) {\n                var configFileName = project.getConfigFilePath();\n                this.logger.info(\"Config file changed: \" + configFileName);\n                var configFileErrors = this.updateConfiguredProject(project);\n                this.reportConfigFileDiagnostics(configFileName, configFileErrors, configFileName);\n                this.refreshInferredProjects();\n            };\n            ProjectService.prototype.onConfigFileAddedForInferredProject = function (fileName) {\n                if (ts.getBaseFileName(fileName) != \"tsconfig.json\") {\n                    this.logger.info(fileName + \" is not tsconfig.json\");\n                    return;\n                }\n                var configFileErrors = this.convertConfigFileContentToProjectOptions(fileName).configFileErrors;\n                this.reportConfigFileDiagnostics(fileName, configFileErrors, fileName);\n                this.logger.info(\"Detected newly added tsconfig file: \" + fileName);\n                this.reloadProjects();\n            };\n            ProjectService.prototype.getCanonicalFileName = function (fileName) {\n                var name = this.host.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();\n                return ts.normalizePath(name);\n            };\n            ProjectService.prototype.removeProject = function (project) {\n                this.logger.info(\"remove project: \" + project.getRootFiles().toString());\n                project.close();\n                switch (project.projectKind) {\n                    case server.ProjectKind.External:\n                        server.removeItemFromSet(this.externalProjects, project);\n                        break;\n                    case server.ProjectKind.Configured:\n                        server.removeItemFromSet(this.configuredProjects, project);\n                        break;\n                    case server.ProjectKind.Inferred:\n                        server.removeItemFromSet(this.inferredProjects, project);\n                        break;\n                }\n            };\n            ProjectService.prototype.assignScriptInfoToInferredProjectIfNecessary = function (info, addToListOfOpenFiles) {\n                var externalProject = this.findContainingExternalProject(info.fileName);\n                if (externalProject) {\n                    if (addToListOfOpenFiles) {\n                        this.openFiles.push(info);\n                    }\n                    return;\n                }\n                var foundConfiguredProject = false;\n                for (var _i = 0, _a = info.containingProjects; _i < _a.length; _i++) {\n                    var p = _a[_i];\n                    if (p.projectKind === server.ProjectKind.Configured) {\n                        foundConfiguredProject = true;\n                        if (addToListOfOpenFiles) {\n                            (p).addOpenRef();\n                        }\n                    }\n                }\n                if (foundConfiguredProject) {\n                    if (addToListOfOpenFiles) {\n                        this.openFiles.push(info);\n                    }\n                    return;\n                }\n                if (info.containingProjects.length === 0) {\n                    var inferredProject = this.createInferredProjectWithRootFileIfNecessary(info);\n                    if (!this.useSingleInferredProject) {\n                        for (var _b = 0, _c = this.openFiles; _b < _c.length; _b++) {\n                            var f = _c[_b];\n                            if (f.containingProjects.length === 0) {\n                                continue;\n                            }\n                            var defaultProject = f.getDefaultProject();\n                            if (isRootFileInInferredProject(info) && defaultProject !== inferredProject && inferredProject.containsScriptInfo(f)) {\n                                this.removeProject(defaultProject);\n                                f.attachToProject(inferredProject);\n                            }\n                        }\n                    }\n                }\n                if (addToListOfOpenFiles) {\n                    this.openFiles.push(info);\n                }\n            };\n            ProjectService.prototype.closeOpenFile = function (info) {\n                info.reloadFromFile();\n                server.removeItemFromSet(this.openFiles, info);\n                info.isOpen = false;\n                var projectsToRemove;\n                for (var _i = 0, _a = info.containingProjects; _i < _a.length; _i++) {\n                    var p = _a[_i];\n                    if (p.projectKind === server.ProjectKind.Configured) {\n                        if (p.deleteOpenRef() === 0) {\n                            (projectsToRemove || (projectsToRemove = [])).push(p);\n                        }\n                    }\n                    else if (p.projectKind === server.ProjectKind.Inferred && p.isRoot(info)) {\n                        (projectsToRemove || (projectsToRemove = [])).push(p);\n                    }\n                }\n                if (projectsToRemove) {\n                    for (var _b = 0, projectsToRemove_1 = projectsToRemove; _b < projectsToRemove_1.length; _b++) {\n                        var project = projectsToRemove_1[_b];\n                        this.removeProject(project);\n                    }\n                    var orphanFiles = void 0;\n                    for (var _c = 0, _d = this.openFiles; _c < _d.length; _c++) {\n                        var f = _d[_c];\n                        if (f.containingProjects.length === 0) {\n                            (orphanFiles || (orphanFiles = [])).push(f);\n                        }\n                    }\n                    if (orphanFiles) {\n                        for (var _e = 0, orphanFiles_1 = orphanFiles; _e < orphanFiles_1.length; _e++) {\n                            var f = orphanFiles_1[_e];\n                            this.assignScriptInfoToInferredProjectIfNecessary(f, false);\n                        }\n                    }\n                }\n                if (info.containingProjects.length === 0) {\n                    this.filenameToScriptInfo.remove(info.path);\n                }\n            };\n            ProjectService.prototype.openOrUpdateConfiguredProjectForFile = function (fileName) {\n                var searchPath = ts.getDirectoryPath(fileName);\n                this.logger.info(\"Search path: \" + searchPath);\n                var configFileName = this.findConfigFile(server.asNormalizedPath(searchPath));\n                if (!configFileName) {\n                    this.logger.info(\"No config files found.\");\n                    return {};\n                }\n                this.logger.info(\"Config file name: \" + configFileName);\n                var project = this.findConfiguredProjectByProjectName(configFileName);\n                if (!project) {\n                    var _a = this.openConfigFile(configFileName, fileName), success = _a.success, errors = _a.errors;\n                    if (!success) {\n                        return { configFileName: configFileName, configFileErrors: errors };\n                    }\n                    this.logger.info(\"Opened configuration file \" + configFileName);\n                    if (errors && errors.length > 0) {\n                        return { configFileName: configFileName, configFileErrors: errors };\n                    }\n                }\n                else {\n                    this.updateConfiguredProject(project);\n                }\n                return { configFileName: configFileName };\n            };\n            ProjectService.prototype.findConfigFile = function (searchPath) {\n                while (true) {\n                    var tsconfigFileName = server.asNormalizedPath(ts.combinePaths(searchPath, \"tsconfig.json\"));\n                    if (this.host.fileExists(tsconfigFileName)) {\n                        return tsconfigFileName;\n                    }\n                    var jsconfigFileName = server.asNormalizedPath(ts.combinePaths(searchPath, \"jsconfig.json\"));\n                    if (this.host.fileExists(jsconfigFileName)) {\n                        return jsconfigFileName;\n                    }\n                    var parentPath = server.asNormalizedPath(ts.getDirectoryPath(searchPath));\n                    if (parentPath === searchPath) {\n                        break;\n                    }\n                    searchPath = parentPath;\n                }\n                return undefined;\n            };\n            ProjectService.prototype.printProjects = function () {\n                if (!this.logger.hasLevel(server.LogLevel.verbose)) {\n                    return;\n                }\n                this.logger.startGroup();\n                var counter = 0;\n                counter = printProjects(this.logger, this.externalProjects, counter);\n                counter = printProjects(this.logger, this.configuredProjects, counter);\n                counter = printProjects(this.logger, this.inferredProjects, counter);\n                this.logger.info(\"Open files: \");\n                for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) {\n                    var rootFile = _a[_i];\n                    this.logger.info(rootFile.fileName);\n                }\n                this.logger.endGroup();\n                function printProjects(logger, projects, counter) {\n                    for (var _i = 0, projects_3 = projects; _i < projects_3.length; _i++) {\n                        var project = projects_3[_i];\n                        project.updateGraph();\n                        logger.info(\"Project '\" + project.getProjectName() + \"' (\" + server.ProjectKind[project.projectKind] + \") \" + counter);\n                        logger.info(project.filesToString());\n                        logger.info(\"-----------------------------------------------\");\n                        counter++;\n                    }\n                    return counter;\n                }\n            };\n            ProjectService.prototype.findConfiguredProjectByProjectName = function (configFileName) {\n                configFileName = server.asNormalizedPath(this.toCanonicalFileName(configFileName));\n                for (var _i = 0, _a = this.configuredProjects; _i < _a.length; _i++) {\n                    var proj = _a[_i];\n                    if (proj.canonicalConfigFilePath === configFileName) {\n                        return proj;\n                    }\n                }\n            };\n            ProjectService.prototype.findExternalProjectByProjectName = function (projectFileName) {\n                return findProjectByName(projectFileName, this.externalProjects);\n            };\n            ProjectService.prototype.convertConfigFileContentToProjectOptions = function (configFilename) {\n                configFilename = ts.normalizePath(configFilename);\n                var configFileContent = this.host.readFile(configFilename);\n                var errors;\n                var result = ts.parseConfigFileTextToJson(configFilename, configFileContent);\n                var config = result.config;\n                if (result.error) {\n                    var _a = ts.sanitizeConfigFile(configFilename, configFileContent), sanitizedConfig = _a.configJsonObject, diagnostics = _a.diagnostics;\n                    config = sanitizedConfig;\n                    errors = diagnostics.length ? diagnostics : [result.error];\n                }\n                var parsedCommandLine = ts.parseJsonConfigFileContent(config, this.host, ts.getDirectoryPath(configFilename), {}, configFilename);\n                if (parsedCommandLine.errors.length) {\n                    errors = ts.concatenate(errors, parsedCommandLine.errors);\n                }\n                ts.Debug.assert(!!parsedCommandLine.fileNames);\n                if (parsedCommandLine.fileNames.length === 0) {\n                    (errors || (errors = [])).push(ts.createCompilerDiagnostic(ts.Diagnostics.The_config_file_0_found_doesn_t_contain_any_source_files, configFilename));\n                    return { success: false, configFileErrors: errors };\n                }\n                var projectOptions = {\n                    files: parsedCommandLine.fileNames,\n                    compilerOptions: parsedCommandLine.options,\n                    configHasFilesProperty: config[\"files\"] !== undefined,\n                    wildcardDirectories: ts.createMap(parsedCommandLine.wildcardDirectories),\n                    typeAcquisition: parsedCommandLine.typeAcquisition,\n                    compileOnSave: parsedCommandLine.compileOnSave\n                };\n                return { success: true, projectOptions: projectOptions, configFileErrors: errors };\n            };\n            ProjectService.prototype.exceededTotalSizeLimitForNonTsFiles = function (options, fileNames, propertyReader) {\n                if (options && options.disableSizeLimit || !this.host.getFileSize) {\n                    return false;\n                }\n                var totalNonTsFileSize = 0;\n                for (var _i = 0, fileNames_3 = fileNames; _i < fileNames_3.length; _i++) {\n                    var f = fileNames_3[_i];\n                    var fileName = propertyReader.getFileName(f);\n                    if (ts.hasTypeScriptFileExtension(fileName)) {\n                        continue;\n                    }\n                    totalNonTsFileSize += this.host.getFileSize(fileName);\n                    if (totalNonTsFileSize > server.maxProgramSizeForNonTsFiles) {\n                        return true;\n                    }\n                }\n                return false;\n            };\n            ProjectService.prototype.createAndAddExternalProject = function (projectFileName, files, options, typeAcquisition) {\n                var compilerOptions = convertCompilerOptions(options);\n                var project = new server.ExternalProject(projectFileName, this, this.documentRegistry, compilerOptions, !this.exceededTotalSizeLimitForNonTsFiles(compilerOptions, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave);\n                this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, undefined, typeAcquisition, undefined);\n                this.externalProjects.push(project);\n                return project;\n            };\n            ProjectService.prototype.reportConfigFileDiagnostics = function (configFileName, diagnostics, triggerFile) {\n                if (!this.eventHandler) {\n                    return;\n                }\n                this.eventHandler({\n                    eventName: server.ConfigFileDiagEvent,\n                    data: { configFileName: configFileName, diagnostics: diagnostics || [], triggerFile: triggerFile }\n                });\n            };\n            ProjectService.prototype.createAndAddConfiguredProject = function (configFileName, projectOptions, configFileErrors, clientFileName) {\n                var _this = this;\n                var sizeLimitExceeded = this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader);\n                var project = new server.ConfiguredProject(configFileName, this, this.documentRegistry, projectOptions.configHasFilesProperty, projectOptions.compilerOptions, projectOptions.wildcardDirectories, !sizeLimitExceeded, projectOptions.compileOnSave === undefined ? false : projectOptions.compileOnSave);\n                this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typeAcquisition, configFileErrors);\n                project.watchConfigFile(function (project) { return _this.onConfigChangedForConfiguredProject(project); });\n                if (!sizeLimitExceeded) {\n                    this.watchConfigDirectoryForProject(project, projectOptions);\n                }\n                project.watchWildcards(function (project, path) { return _this.onSourceFileInDirectoryChangedForConfiguredProject(project, path); });\n                project.watchTypeRoots(function (project, path) { return _this.onTypeRootFileChanged(project, path); });\n                this.configuredProjects.push(project);\n                return project;\n            };\n            ProjectService.prototype.watchConfigDirectoryForProject = function (project, options) {\n                var _this = this;\n                if (!options.configHasFilesProperty) {\n                    project.watchConfigDirectory(function (project, path) { return _this.onSourceFileInDirectoryChangedForConfiguredProject(project, path); });\n                }\n            };\n            ProjectService.prototype.addFilesToProjectAndUpdateGraph = function (project, files, propertyReader, clientFileName, typeAcquisition, configFileErrors) {\n                var errors;\n                for (var _i = 0, files_4 = files; _i < files_4.length; _i++) {\n                    var f = files_4[_i];\n                    var rootFilename = propertyReader.getFileName(f);\n                    var scriptKind = propertyReader.getScriptKind(f);\n                    var hasMixedContent = propertyReader.hasMixedContent(f);\n                    if (this.host.fileExists(rootFilename)) {\n                        var info = this.getOrCreateScriptInfoForNormalizedPath(server.toNormalizedPath(rootFilename), clientFileName == rootFilename, undefined, scriptKind, hasMixedContent);\n                        project.addRoot(info);\n                    }\n                    else {\n                        (errors || (errors = [])).push(createFileNotFoundDiagnostic(rootFilename));\n                    }\n                }\n                project.setProjectErrors(ts.concatenate(configFileErrors, errors));\n                project.setTypeAcquisition(typeAcquisition);\n                project.updateGraph();\n            };\n            ProjectService.prototype.openConfigFile = function (configFileName, clientFileName) {\n                var conversionResult = this.convertConfigFileContentToProjectOptions(configFileName);\n                var projectOptions = conversionResult.success\n                    ? conversionResult.projectOptions\n                    : { files: [], compilerOptions: {} };\n                var project = this.createAndAddConfiguredProject(configFileName, projectOptions, conversionResult.configFileErrors, clientFileName);\n                return {\n                    success: conversionResult.success,\n                    project: project,\n                    errors: project.getProjectErrors()\n                };\n            };\n            ProjectService.prototype.updateNonInferredProject = function (project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, configFileErrors) {\n                var oldRootScriptInfos = project.getRootScriptInfos();\n                var newRootScriptInfos = [];\n                var newRootScriptInfoMap = server.createNormalizedPathMap();\n                var projectErrors;\n                var rootFilesChanged = false;\n                for (var _i = 0, newUncheckedFiles_1 = newUncheckedFiles; _i < newUncheckedFiles_1.length; _i++) {\n                    var f = newUncheckedFiles_1[_i];\n                    var newRootFile = propertyReader.getFileName(f);\n                    if (!this.host.fileExists(newRootFile)) {\n                        (projectErrors || (projectErrors = [])).push(createFileNotFoundDiagnostic(newRootFile));\n                        continue;\n                    }\n                    var normalizedPath = server.toNormalizedPath(newRootFile);\n                    var scriptInfo = this.getScriptInfoForNormalizedPath(normalizedPath);\n                    if (!scriptInfo || !project.isRoot(scriptInfo)) {\n                        rootFilesChanged = true;\n                        if (!scriptInfo) {\n                            var scriptKind = propertyReader.getScriptKind(f);\n                            var hasMixedContent = propertyReader.hasMixedContent(f);\n                            scriptInfo = this.getOrCreateScriptInfoForNormalizedPath(normalizedPath, false, undefined, scriptKind, hasMixedContent);\n                        }\n                    }\n                    newRootScriptInfos.push(scriptInfo);\n                    newRootScriptInfoMap.set(scriptInfo.fileName, scriptInfo);\n                }\n                if (rootFilesChanged || newRootScriptInfos.length !== oldRootScriptInfos.length) {\n                    var toAdd = void 0;\n                    var toRemove = void 0;\n                    for (var _a = 0, oldRootScriptInfos_1 = oldRootScriptInfos; _a < oldRootScriptInfos_1.length; _a++) {\n                        var oldFile = oldRootScriptInfos_1[_a];\n                        if (!newRootScriptInfoMap.contains(oldFile.fileName)) {\n                            (toRemove || (toRemove = [])).push(oldFile);\n                        }\n                    }\n                    for (var _b = 0, newRootScriptInfos_1 = newRootScriptInfos; _b < newRootScriptInfos_1.length; _b++) {\n                        var newFile = newRootScriptInfos_1[_b];\n                        if (!project.isRoot(newFile)) {\n                            (toAdd || (toAdd = [])).push(newFile);\n                        }\n                    }\n                    if (toRemove) {\n                        for (var _c = 0, toRemove_1 = toRemove; _c < toRemove_1.length; _c++) {\n                            var f = toRemove_1[_c];\n                            project.removeFile(f);\n                        }\n                    }\n                    if (toAdd) {\n                        for (var _d = 0, toAdd_1 = toAdd; _d < toAdd_1.length; _d++) {\n                            var f = toAdd_1[_d];\n                            if (f.isOpen && isRootFileInInferredProject(f)) {\n                                var inferredProject = f.containingProjects[0];\n                                inferredProject.removeFile(f);\n                                if (!inferredProject.hasRoots()) {\n                                    this.removeProject(inferredProject);\n                                }\n                            }\n                            project.addRoot(f);\n                        }\n                    }\n                }\n                project.setCompilerOptions(newOptions);\n                project.setTypeAcquisition(newTypeAcquisition);\n                if (compileOnSave !== undefined) {\n                    project.compileOnSaveEnabled = compileOnSave;\n                }\n                project.setProjectErrors(ts.concatenate(configFileErrors, projectErrors));\n                project.updateGraph();\n            };\n            ProjectService.prototype.updateConfiguredProject = function (project) {\n                if (!this.host.fileExists(project.getConfigFilePath())) {\n                    this.logger.info(\"Config file deleted\");\n                    this.removeProject(project);\n                    return;\n                }\n                var _a = this.convertConfigFileContentToProjectOptions(project.getConfigFilePath()), success = _a.success, projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors;\n                if (!success) {\n                    this.updateNonInferredProject(project, [], fileNamePropertyReader, {}, {}, false, configFileErrors);\n                    return configFileErrors;\n                }\n                if (this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader)) {\n                    project.setCompilerOptions(projectOptions.compilerOptions);\n                    if (!project.languageServiceEnabled) {\n                        return configFileErrors;\n                    }\n                    project.disableLanguageService();\n                    project.stopWatchingDirectory();\n                }\n                else {\n                    if (!project.languageServiceEnabled) {\n                        project.enableLanguageService();\n                    }\n                    this.watchConfigDirectoryForProject(project, projectOptions);\n                    this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typeAcquisition, projectOptions.compileOnSave, configFileErrors);\n                }\n                return configFileErrors;\n            };\n            ProjectService.prototype.createInferredProjectWithRootFileIfNecessary = function (root) {\n                var _this = this;\n                var useExistingProject = this.useSingleInferredProject && this.inferredProjects.length;\n                var project = useExistingProject\n                    ? this.inferredProjects[0]\n                    : new server.InferredProject(this, this.documentRegistry, this.compilerOptionsForInferredProjects);\n                project.addRoot(root);\n                this.directoryWatchers.startWatchingContainingDirectoriesForFile(root.fileName, project, function (fileName) { return _this.onConfigFileAddedForInferredProject(fileName); });\n                project.updateGraph();\n                if (!useExistingProject) {\n                    this.inferredProjects.push(project);\n                }\n                return project;\n            };\n            ProjectService.prototype.getOrCreateScriptInfo = function (uncheckedFileName, openedByClient, fileContent, scriptKind) {\n                return this.getOrCreateScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName), openedByClient, fileContent, scriptKind);\n            };\n            ProjectService.prototype.getScriptInfo = function (uncheckedFileName) {\n                return this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName));\n            };\n            ProjectService.prototype.getOrCreateScriptInfoForNormalizedPath = function (fileName, openedByClient, fileContent, scriptKind, hasMixedContent) {\n                var _this = this;\n                var info = this.getScriptInfoForNormalizedPath(fileName);\n                if (!info) {\n                    var content = void 0;\n                    if (this.host.fileExists(fileName)) {\n                        content = fileContent || (hasMixedContent ? \"\" : this.host.readFile(fileName));\n                    }\n                    if (!content) {\n                        if (openedByClient) {\n                            content = \"\";\n                        }\n                    }\n                    if (content !== undefined) {\n                        info = new server.ScriptInfo(this.host, fileName, content, scriptKind, openedByClient, hasMixedContent);\n                        this.filenameToScriptInfo.set(info.path, info);\n                        if (!info.isOpen && !hasMixedContent) {\n                            info.setWatcher(this.host.watchFile(fileName, function (_) { return _this.onSourceFileChanged(fileName); }));\n                        }\n                    }\n                }\n                if (info) {\n                    if (fileContent !== undefined) {\n                        info.reload(fileContent);\n                    }\n                    if (openedByClient) {\n                        info.isOpen = true;\n                    }\n                }\n                return info;\n            };\n            ProjectService.prototype.getScriptInfoForNormalizedPath = function (fileName) {\n                return this.getScriptInfoForPath(server.normalizedPathToPath(fileName, this.host.getCurrentDirectory(), this.toCanonicalFileName));\n            };\n            ProjectService.prototype.getScriptInfoForPath = function (fileName) {\n                return this.filenameToScriptInfo.get(fileName);\n            };\n            ProjectService.prototype.setHostConfiguration = function (args) {\n                if (args.file) {\n                    var info = this.getScriptInfoForNormalizedPath(server.toNormalizedPath(args.file));\n                    if (info) {\n                        info.setFormatOptions(convertFormatOptions(args.formatOptions));\n                        this.logger.info(\"Host configuration update for file \" + args.file);\n                    }\n                }\n                else {\n                    if (args.hostInfo !== undefined) {\n                        this.hostConfiguration.hostInfo = args.hostInfo;\n                        this.logger.info(\"Host information \" + args.hostInfo);\n                    }\n                    if (args.formatOptions) {\n                        server.mergeMaps(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions));\n                        this.logger.info(\"Format host information updated\");\n                    }\n                }\n            };\n            ProjectService.prototype.closeLog = function () {\n                this.logger.close();\n            };\n            ProjectService.prototype.reloadProjects = function () {\n                this.logger.info(\"reload projects.\");\n                for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) {\n                    var info = _a[_i];\n                    this.openOrUpdateConfiguredProjectForFile(info.fileName);\n                }\n                this.refreshInferredProjects();\n            };\n            ProjectService.prototype.refreshInferredProjects = function () {\n                this.logger.info(\"updating project structure from ...\");\n                this.printProjects();\n                var orphantedFiles = [];\n                for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) {\n                    var info = _a[_i];\n                    if (info.containingProjects.length === 0) {\n                        orphantedFiles.push(info);\n                    }\n                    else {\n                        if (isRootFileInInferredProject(info) && info.containingProjects.length > 1) {\n                            var inferredProject = info.containingProjects[0];\n                            ts.Debug.assert(inferredProject.projectKind === server.ProjectKind.Inferred);\n                            inferredProject.removeFile(info);\n                            if (!inferredProject.hasRoots()) {\n                                this.removeProject(inferredProject);\n                            }\n                        }\n                    }\n                }\n                for (var _b = 0, orphantedFiles_1 = orphantedFiles; _b < orphantedFiles_1.length; _b++) {\n                    var f = orphantedFiles_1[_b];\n                    this.assignScriptInfoToInferredProjectIfNecessary(f, false);\n                }\n                for (var _c = 0, _d = this.inferredProjects; _c < _d.length; _c++) {\n                    var p = _d[_c];\n                    p.updateGraph();\n                }\n                this.printProjects();\n            };\n            ProjectService.prototype.openClientFile = function (fileName, fileContent, scriptKind) {\n                return this.openClientFileWithNormalizedPath(server.toNormalizedPath(fileName), fileContent, scriptKind);\n            };\n            ProjectService.prototype.openClientFileWithNormalizedPath = function (fileName, fileContent, scriptKind, hasMixedContent) {\n                var _a = this.findContainingExternalProject(fileName)\n                    ? {}\n                    : this.openOrUpdateConfiguredProjectForFile(fileName), _b = _a.configFileName, configFileName = _b === void 0 ? undefined : _b, _c = _a.configFileErrors, configFileErrors = _c === void 0 ? undefined : _c;\n                var info = this.getOrCreateScriptInfoForNormalizedPath(fileName, true, fileContent, scriptKind, hasMixedContent);\n                this.assignScriptInfoToInferredProjectIfNecessary(info, true);\n                this.printProjects();\n                return { configFileName: configFileName, configFileErrors: configFileErrors };\n            };\n            ProjectService.prototype.closeClientFile = function (uncheckedFileName) {\n                var info = this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName));\n                if (info) {\n                    this.closeOpenFile(info);\n                    info.isOpen = false;\n                }\n                this.printProjects();\n            };\n            ProjectService.prototype.collectChanges = function (lastKnownProjectVersions, currentProjects, result) {\n                var _loop_4 = function (proj) {\n                    var knownProject = ts.forEach(lastKnownProjectVersions, function (p) { return p.projectName === proj.getProjectName() && p; });\n                    result.push(proj.getChangesSinceVersion(knownProject && knownProject.version));\n                };\n                for (var _i = 0, currentProjects_1 = currentProjects; _i < currentProjects_1.length; _i++) {\n                    var proj = currentProjects_1[_i];\n                    _loop_4(proj);\n                }\n            };\n            ProjectService.prototype.synchronizeProjectList = function (knownProjects) {\n                var files = [];\n                this.collectChanges(knownProjects, this.externalProjects, files);\n                this.collectChanges(knownProjects, this.configuredProjects, files);\n                this.collectChanges(knownProjects, this.inferredProjects, files);\n                return files;\n            };\n            ProjectService.prototype.applyChangesInOpenFiles = function (openFiles, changedFiles, closedFiles) {\n                var recordChangedFiles = changedFiles && !openFiles && !closedFiles;\n                if (openFiles) {\n                    for (var _i = 0, openFiles_1 = openFiles; _i < openFiles_1.length; _i++) {\n                        var file = openFiles_1[_i];\n                        var scriptInfo = this.getScriptInfo(file.fileName);\n                        ts.Debug.assert(!scriptInfo || !scriptInfo.isOpen);\n                        var normalizedPath = scriptInfo ? scriptInfo.fileName : server.toNormalizedPath(file.fileName);\n                        this.openClientFileWithNormalizedPath(normalizedPath, file.content, tryConvertScriptKindName(file.scriptKind), file.hasMixedContent);\n                    }\n                }\n                if (changedFiles) {\n                    for (var _a = 0, changedFiles_2 = changedFiles; _a < changedFiles_2.length; _a++) {\n                        var file = changedFiles_2[_a];\n                        var scriptInfo = this.getScriptInfo(file.fileName);\n                        ts.Debug.assert(!!scriptInfo);\n                        for (var i = file.changes.length - 1; i >= 0; i--) {\n                            var change = file.changes[i];\n                            scriptInfo.editContent(change.span.start, change.span.start + change.span.length, change.newText);\n                        }\n                        if (recordChangedFiles) {\n                            if (!this.changedFiles) {\n                                this.changedFiles = [scriptInfo];\n                            }\n                            else if (this.changedFiles.indexOf(scriptInfo) < 0) {\n                                this.changedFiles.push(scriptInfo);\n                            }\n                        }\n                    }\n                }\n                if (closedFiles) {\n                    for (var _b = 0, closedFiles_1 = closedFiles; _b < closedFiles_1.length; _b++) {\n                        var file = closedFiles_1[_b];\n                        this.closeClientFile(file);\n                    }\n                }\n                if (openFiles || closedFiles) {\n                    this.refreshInferredProjects();\n                }\n            };\n            ProjectService.prototype.closeConfiguredProject = function (configFile) {\n                var configuredProject = this.findConfiguredProjectByProjectName(configFile);\n                if (configuredProject && configuredProject.deleteOpenRef() === 0) {\n                    this.removeProject(configuredProject);\n                }\n            };\n            ProjectService.prototype.closeExternalProject = function (uncheckedFileName, suppressRefresh) {\n                if (suppressRefresh === void 0) { suppressRefresh = false; }\n                var fileName = server.toNormalizedPath(uncheckedFileName);\n                var configFiles = this.externalProjectToConfiguredProjectMap[fileName];\n                if (configFiles) {\n                    var shouldRefreshInferredProjects = false;\n                    for (var _i = 0, configFiles_1 = configFiles; _i < configFiles_1.length; _i++) {\n                        var configFile = configFiles_1[_i];\n                        if (this.closeConfiguredProject(configFile)) {\n                            shouldRefreshInferredProjects = true;\n                        }\n                    }\n                    delete this.externalProjectToConfiguredProjectMap[fileName];\n                    if (shouldRefreshInferredProjects && !suppressRefresh) {\n                        this.refreshInferredProjects();\n                    }\n                }\n                else {\n                    var externalProject = this.findExternalProjectByProjectName(uncheckedFileName);\n                    if (externalProject) {\n                        this.removeProject(externalProject);\n                        if (!suppressRefresh) {\n                            this.refreshInferredProjects();\n                        }\n                    }\n                }\n            };\n            ProjectService.prototype.openExternalProject = function (proj) {\n                if (proj.typingOptions && !proj.typeAcquisition) {\n                    var typeAcquisition = ts.convertEnableAutoDiscoveryToEnable(proj.typingOptions);\n                    proj.typeAcquisition = typeAcquisition;\n                }\n                var tsConfigFiles;\n                var rootFiles = [];\n                for (var _i = 0, _a = proj.rootFiles; _i < _a.length; _i++) {\n                    var file = _a[_i];\n                    var normalized = server.toNormalizedPath(file.fileName);\n                    if (ts.getBaseFileName(normalized) === \"tsconfig.json\") {\n                        if (this.host.fileExists(normalized)) {\n                            (tsConfigFiles || (tsConfigFiles = [])).push(normalized);\n                        }\n                    }\n                    else {\n                        rootFiles.push(file);\n                    }\n                }\n                if (tsConfigFiles) {\n                    tsConfigFiles.sort();\n                }\n                var externalProject = this.findExternalProjectByProjectName(proj.projectFileName);\n                var exisingConfigFiles;\n                if (externalProject) {\n                    if (!tsConfigFiles) {\n                        this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, convertCompilerOptions(proj.options), proj.typeAcquisition, proj.options.compileOnSave, undefined);\n                        return;\n                    }\n                    this.closeExternalProject(proj.projectFileName, true);\n                }\n                else if (this.externalProjectToConfiguredProjectMap[proj.projectFileName]) {\n                    if (!tsConfigFiles) {\n                        this.closeExternalProject(proj.projectFileName, true);\n                    }\n                    else {\n                        var oldConfigFiles = this.externalProjectToConfiguredProjectMap[proj.projectFileName];\n                        var iNew = 0;\n                        var iOld = 0;\n                        while (iNew < tsConfigFiles.length && iOld < oldConfigFiles.length) {\n                            var newConfig = tsConfigFiles[iNew];\n                            var oldConfig = oldConfigFiles[iOld];\n                            if (oldConfig < newConfig) {\n                                this.closeConfiguredProject(oldConfig);\n                                iOld++;\n                            }\n                            else if (oldConfig > newConfig) {\n                                iNew++;\n                            }\n                            else {\n                                (exisingConfigFiles || (exisingConfigFiles = [])).push(oldConfig);\n                                iOld++;\n                                iNew++;\n                            }\n                        }\n                        for (var i = iOld; i < oldConfigFiles.length; i++) {\n                            this.closeConfiguredProject(oldConfigFiles[i]);\n                        }\n                    }\n                }\n                if (tsConfigFiles) {\n                    this.externalProjectToConfiguredProjectMap[proj.projectFileName] = tsConfigFiles;\n                    for (var _b = 0, tsConfigFiles_1 = tsConfigFiles; _b < tsConfigFiles_1.length; _b++) {\n                        var tsconfigFile = tsConfigFiles_1[_b];\n                        var project = this.findConfiguredProjectByProjectName(tsconfigFile);\n                        if (!project) {\n                            var result = this.openConfigFile(tsconfigFile);\n                            project = result.success && result.project;\n                        }\n                        if (project && !ts.contains(exisingConfigFiles, tsconfigFile)) {\n                            project.addOpenRef();\n                        }\n                    }\n                }\n                else {\n                    delete this.externalProjectToConfiguredProjectMap[proj.projectFileName];\n                    this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition);\n                }\n                this.refreshInferredProjects();\n            };\n            return ProjectService;\n        }());\n        server.ProjectService = ProjectService;\n    })(server = ts.server || (ts.server = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var server;\n    (function (server) {\n        function hrTimeToMilliseconds(time) {\n            var seconds = time[0];\n            var nanoseconds = time[1];\n            return ((1e9 * seconds) + nanoseconds) / 1000000.0;\n        }\n        function shouldSkipSematicCheck(project) {\n            if (project.getCompilerOptions().skipLibCheck !== undefined) {\n                return false;\n            }\n            if ((project.projectKind === server.ProjectKind.Inferred || project.projectKind === server.ProjectKind.External) && project.isJsOnlyProject()) {\n                return true;\n            }\n            return false;\n        }\n        function compareNumber(a, b) {\n            return a - b;\n        }\n        function compareFileStart(a, b) {\n            if (a.file < b.file) {\n                return -1;\n            }\n            else if (a.file == b.file) {\n                var n = compareNumber(a.start.line, b.start.line);\n                if (n === 0) {\n                    return compareNumber(a.start.offset, b.start.offset);\n                }\n                else\n                    return n;\n            }\n            else {\n                return 1;\n            }\n        }\n        function formatDiag(fileName, project, diag) {\n            var scriptInfo = project.getScriptInfoForNormalizedPath(fileName);\n            return {\n                start: scriptInfo.positionToLineOffset(diag.start),\n                end: scriptInfo.positionToLineOffset(diag.start + diag.length),\n                text: ts.flattenDiagnosticMessageText(diag.messageText, \"\\n\"),\n                code: diag.code\n            };\n        }\n        function formatConfigFileDiag(diag) {\n            return {\n                start: undefined,\n                end: undefined,\n                text: ts.flattenDiagnosticMessageText(diag.messageText, \"\\n\")\n            };\n        }\n        function allEditsBeforePos(edits, pos) {\n            for (var _i = 0, edits_1 = edits; _i < edits_1.length; _i++) {\n                var edit = edits_1[_i];\n                if (ts.textSpanEnd(edit.span) >= pos) {\n                    return false;\n                }\n            }\n            return true;\n        }\n        var CommandNames;\n        (function (CommandNames) {\n            CommandNames.Brace = \"brace\";\n            CommandNames.BraceFull = \"brace-full\";\n            CommandNames.BraceCompletion = \"braceCompletion\";\n            CommandNames.Change = \"change\";\n            CommandNames.Close = \"close\";\n            CommandNames.Completions = \"completions\";\n            CommandNames.CompletionsFull = \"completions-full\";\n            CommandNames.CompletionDetails = \"completionEntryDetails\";\n            CommandNames.CompileOnSaveAffectedFileList = \"compileOnSaveAffectedFileList\";\n            CommandNames.CompileOnSaveEmitFile = \"compileOnSaveEmitFile\";\n            CommandNames.Configure = \"configure\";\n            CommandNames.Definition = \"definition\";\n            CommandNames.DefinitionFull = \"definition-full\";\n            CommandNames.Exit = \"exit\";\n            CommandNames.Format = \"format\";\n            CommandNames.Formatonkey = \"formatonkey\";\n            CommandNames.FormatFull = \"format-full\";\n            CommandNames.FormatonkeyFull = \"formatonkey-full\";\n            CommandNames.FormatRangeFull = \"formatRange-full\";\n            CommandNames.Geterr = \"geterr\";\n            CommandNames.GeterrForProject = \"geterrForProject\";\n            CommandNames.Implementation = \"implementation\";\n            CommandNames.ImplementationFull = \"implementation-full\";\n            CommandNames.SemanticDiagnosticsSync = \"semanticDiagnosticsSync\";\n            CommandNames.SyntacticDiagnosticsSync = \"syntacticDiagnosticsSync\";\n            CommandNames.NavBar = \"navbar\";\n            CommandNames.NavBarFull = \"navbar-full\";\n            CommandNames.NavTree = \"navtree\";\n            CommandNames.NavTreeFull = \"navtree-full\";\n            CommandNames.Navto = \"navto\";\n            CommandNames.NavtoFull = \"navto-full\";\n            CommandNames.Occurrences = \"occurrences\";\n            CommandNames.DocumentHighlights = \"documentHighlights\";\n            CommandNames.DocumentHighlightsFull = \"documentHighlights-full\";\n            CommandNames.Open = \"open\";\n            CommandNames.Quickinfo = \"quickinfo\";\n            CommandNames.QuickinfoFull = \"quickinfo-full\";\n            CommandNames.References = \"references\";\n            CommandNames.ReferencesFull = \"references-full\";\n            CommandNames.Reload = \"reload\";\n            CommandNames.Rename = \"rename\";\n            CommandNames.RenameInfoFull = \"rename-full\";\n            CommandNames.RenameLocationsFull = \"renameLocations-full\";\n            CommandNames.Saveto = \"saveto\";\n            CommandNames.SignatureHelp = \"signatureHelp\";\n            CommandNames.SignatureHelpFull = \"signatureHelp-full\";\n            CommandNames.TypeDefinition = \"typeDefinition\";\n            CommandNames.ProjectInfo = \"projectInfo\";\n            CommandNames.ReloadProjects = \"reloadProjects\";\n            CommandNames.Unknown = \"unknown\";\n            CommandNames.OpenExternalProject = \"openExternalProject\";\n            CommandNames.OpenExternalProjects = \"openExternalProjects\";\n            CommandNames.CloseExternalProject = \"closeExternalProject\";\n            CommandNames.SynchronizeProjectList = \"synchronizeProjectList\";\n            CommandNames.ApplyChangedToOpenFiles = \"applyChangedToOpenFiles\";\n            CommandNames.EncodedSemanticClassificationsFull = \"encodedSemanticClassifications-full\";\n            CommandNames.Cleanup = \"cleanup\";\n            CommandNames.OutliningSpans = \"outliningSpans\";\n            CommandNames.TodoComments = \"todoComments\";\n            CommandNames.Indentation = \"indentation\";\n            CommandNames.DocCommentTemplate = \"docCommentTemplate\";\n            CommandNames.CompilerOptionsDiagnosticsFull = \"compilerOptionsDiagnostics-full\";\n            CommandNames.NameOrDottedNameSpan = \"nameOrDottedNameSpan\";\n            CommandNames.BreakpointStatement = \"breakpointStatement\";\n            CommandNames.CompilerOptionsForInferredProjects = \"compilerOptionsForInferredProjects\";\n            CommandNames.GetCodeFixes = \"getCodeFixes\";\n            CommandNames.GetCodeFixesFull = \"getCodeFixes-full\";\n            CommandNames.GetSupportedCodeFixes = \"getSupportedCodeFixes\";\n        })(CommandNames = server.CommandNames || (server.CommandNames = {}));\n        function formatMessage(msg, logger, byteLength, newLine) {\n            var verboseLogging = logger.hasLevel(server.LogLevel.verbose);\n            var json = JSON.stringify(msg);\n            if (verboseLogging) {\n                logger.info(msg.type + \": \" + json);\n            }\n            var len = byteLength(json, \"utf8\");\n            return \"Content-Length: \" + (1 + len) + \"\\r\\n\\r\\n\" + json + newLine;\n        }\n        server.formatMessage = formatMessage;\n        var Session = (function () {\n            function Session(host, cancellationToken, useSingleInferredProject, typingsInstaller, byteLength, hrtime, logger, canUseEvents, eventHandler) {\n                var _this = this;\n                this.host = host;\n                this.typingsInstaller = typingsInstaller;\n                this.byteLength = byteLength;\n                this.hrtime = hrtime;\n                this.logger = logger;\n                this.canUseEvents = canUseEvents;\n                this.changeSeq = 0;\n                this.handlers = ts.createMap((_a = {},\n                    _a[CommandNames.OpenExternalProject] = function (request) {\n                        _this.projectService.openExternalProject(request.arguments);\n                        return _this.requiredResponse(true);\n                    },\n                    _a[CommandNames.OpenExternalProjects] = function (request) {\n                        for (var _i = 0, _a = request.arguments.projects; _i < _a.length; _i++) {\n                            var proj = _a[_i];\n                            _this.projectService.openExternalProject(proj);\n                        }\n                        return _this.requiredResponse(true);\n                    },\n                    _a[CommandNames.CloseExternalProject] = function (request) {\n                        _this.projectService.closeExternalProject(request.arguments.projectFileName);\n                        return _this.requiredResponse(true);\n                    },\n                    _a[CommandNames.SynchronizeProjectList] = function (request) {\n                        var result = _this.projectService.synchronizeProjectList(request.arguments.knownProjects);\n                        if (!result.some(function (p) { return p.projectErrors && p.projectErrors.length !== 0; })) {\n                            return _this.requiredResponse(result);\n                        }\n                        var converted = ts.map(result, function (p) {\n                            if (!p.projectErrors || p.projectErrors.length === 0) {\n                                return p;\n                            }\n                            return {\n                                info: p.info,\n                                changes: p.changes,\n                                files: p.files,\n                                projectErrors: _this.convertToDiagnosticsWithLinePosition(p.projectErrors, undefined)\n                            };\n                        });\n                        return _this.requiredResponse(converted);\n                    },\n                    _a[CommandNames.ApplyChangedToOpenFiles] = function (request) {\n                        _this.projectService.applyChangesInOpenFiles(request.arguments.openFiles, request.arguments.changedFiles, request.arguments.closedFiles);\n                        _this.changeSeq++;\n                        return _this.requiredResponse(true);\n                    },\n                    _a[CommandNames.Exit] = function () {\n                        _this.exit();\n                        return _this.notRequired();\n                    },\n                    _a[CommandNames.Definition] = function (request) {\n                        return _this.requiredResponse(_this.getDefinition(request.arguments, true));\n                    },\n                    _a[CommandNames.DefinitionFull] = function (request) {\n                        return _this.requiredResponse(_this.getDefinition(request.arguments, false));\n                    },\n                    _a[CommandNames.TypeDefinition] = function (request) {\n                        return _this.requiredResponse(_this.getTypeDefinition(request.arguments));\n                    },\n                    _a[CommandNames.Implementation] = function (request) {\n                        return _this.requiredResponse(_this.getImplementation(request.arguments, true));\n                    },\n                    _a[CommandNames.ImplementationFull] = function (request) {\n                        return _this.requiredResponse(_this.getImplementation(request.arguments, false));\n                    },\n                    _a[CommandNames.References] = function (request) {\n                        return _this.requiredResponse(_this.getReferences(request.arguments, true));\n                    },\n                    _a[CommandNames.ReferencesFull] = function (request) {\n                        return _this.requiredResponse(_this.getReferences(request.arguments, false));\n                    },\n                    _a[CommandNames.Rename] = function (request) {\n                        return _this.requiredResponse(_this.getRenameLocations(request.arguments, true));\n                    },\n                    _a[CommandNames.RenameLocationsFull] = function (request) {\n                        return _this.requiredResponse(_this.getRenameLocations(request.arguments, false));\n                    },\n                    _a[CommandNames.RenameInfoFull] = function (request) {\n                        return _this.requiredResponse(_this.getRenameInfo(request.arguments));\n                    },\n                    _a[CommandNames.Open] = function (request) {\n                        _this.openClientFile(server.toNormalizedPath(request.arguments.file), request.arguments.fileContent, server.convertScriptKindName(request.arguments.scriptKindName));\n                        return _this.notRequired();\n                    },\n                    _a[CommandNames.Quickinfo] = function (request) {\n                        return _this.requiredResponse(_this.getQuickInfoWorker(request.arguments, true));\n                    },\n                    _a[CommandNames.QuickinfoFull] = function (request) {\n                        return _this.requiredResponse(_this.getQuickInfoWorker(request.arguments, false));\n                    },\n                    _a[CommandNames.OutliningSpans] = function (request) {\n                        return _this.requiredResponse(_this.getOutliningSpans(request.arguments));\n                    },\n                    _a[CommandNames.TodoComments] = function (request) {\n                        return _this.requiredResponse(_this.getTodoComments(request.arguments));\n                    },\n                    _a[CommandNames.Indentation] = function (request) {\n                        return _this.requiredResponse(_this.getIndentation(request.arguments));\n                    },\n                    _a[CommandNames.NameOrDottedNameSpan] = function (request) {\n                        return _this.requiredResponse(_this.getNameOrDottedNameSpan(request.arguments));\n                    },\n                    _a[CommandNames.BreakpointStatement] = function (request) {\n                        return _this.requiredResponse(_this.getBreakpointStatement(request.arguments));\n                    },\n                    _a[CommandNames.BraceCompletion] = function (request) {\n                        return _this.requiredResponse(_this.isValidBraceCompletion(request.arguments));\n                    },\n                    _a[CommandNames.DocCommentTemplate] = function (request) {\n                        return _this.requiredResponse(_this.getDocCommentTemplate(request.arguments));\n                    },\n                    _a[CommandNames.Format] = function (request) {\n                        return _this.requiredResponse(_this.getFormattingEditsForRange(request.arguments));\n                    },\n                    _a[CommandNames.Formatonkey] = function (request) {\n                        return _this.requiredResponse(_this.getFormattingEditsAfterKeystroke(request.arguments));\n                    },\n                    _a[CommandNames.FormatFull] = function (request) {\n                        return _this.requiredResponse(_this.getFormattingEditsForDocumentFull(request.arguments));\n                    },\n                    _a[CommandNames.FormatonkeyFull] = function (request) {\n                        return _this.requiredResponse(_this.getFormattingEditsAfterKeystrokeFull(request.arguments));\n                    },\n                    _a[CommandNames.FormatRangeFull] = function (request) {\n                        return _this.requiredResponse(_this.getFormattingEditsForRangeFull(request.arguments));\n                    },\n                    _a[CommandNames.Completions] = function (request) {\n                        return _this.requiredResponse(_this.getCompletions(request.arguments, true));\n                    },\n                    _a[CommandNames.CompletionsFull] = function (request) {\n                        return _this.requiredResponse(_this.getCompletions(request.arguments, false));\n                    },\n                    _a[CommandNames.CompletionDetails] = function (request) {\n                        return _this.requiredResponse(_this.getCompletionEntryDetails(request.arguments));\n                    },\n                    _a[CommandNames.CompileOnSaveAffectedFileList] = function (request) {\n                        return _this.requiredResponse(_this.getCompileOnSaveAffectedFileList(request.arguments));\n                    },\n                    _a[CommandNames.CompileOnSaveEmitFile] = function (request) {\n                        return _this.requiredResponse(_this.emitFile(request.arguments));\n                    },\n                    _a[CommandNames.SignatureHelp] = function (request) {\n                        return _this.requiredResponse(_this.getSignatureHelpItems(request.arguments, true));\n                    },\n                    _a[CommandNames.SignatureHelpFull] = function (request) {\n                        return _this.requiredResponse(_this.getSignatureHelpItems(request.arguments, false));\n                    },\n                    _a[CommandNames.CompilerOptionsDiagnosticsFull] = function (request) {\n                        return _this.requiredResponse(_this.getCompilerOptionsDiagnostics(request.arguments));\n                    },\n                    _a[CommandNames.EncodedSemanticClassificationsFull] = function (request) {\n                        return _this.requiredResponse(_this.getEncodedSemanticClassifications(request.arguments));\n                    },\n                    _a[CommandNames.Cleanup] = function () {\n                        _this.cleanup();\n                        return _this.requiredResponse(true);\n                    },\n                    _a[CommandNames.SemanticDiagnosticsSync] = function (request) {\n                        return _this.requiredResponse(_this.getSemanticDiagnosticsSync(request.arguments));\n                    },\n                    _a[CommandNames.SyntacticDiagnosticsSync] = function (request) {\n                        return _this.requiredResponse(_this.getSyntacticDiagnosticsSync(request.arguments));\n                    },\n                    _a[CommandNames.Geterr] = function (request) {\n                        var geterrArgs = request.arguments;\n                        return { response: _this.getDiagnostics(geterrArgs.delay, geterrArgs.files), responseRequired: false };\n                    },\n                    _a[CommandNames.GeterrForProject] = function (request) {\n                        var _a = request.arguments, file = _a.file, delay = _a.delay;\n                        return { response: _this.getDiagnosticsForProject(delay, file), responseRequired: false };\n                    },\n                    _a[CommandNames.Change] = function (request) {\n                        _this.change(request.arguments);\n                        return _this.notRequired();\n                    },\n                    _a[CommandNames.Configure] = function (request) {\n                        _this.projectService.setHostConfiguration(request.arguments);\n                        _this.output(undefined, CommandNames.Configure, request.seq);\n                        return _this.notRequired();\n                    },\n                    _a[CommandNames.Reload] = function (request) {\n                        _this.reload(request.arguments, request.seq);\n                        return _this.requiredResponse({ reloadFinished: true });\n                    },\n                    _a[CommandNames.Saveto] = function (request) {\n                        var savetoArgs = request.arguments;\n                        _this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile);\n                        return _this.notRequired();\n                    },\n                    _a[CommandNames.Close] = function (request) {\n                        var closeArgs = request.arguments;\n                        _this.closeClientFile(closeArgs.file);\n                        return _this.notRequired();\n                    },\n                    _a[CommandNames.Navto] = function (request) {\n                        return _this.requiredResponse(_this.getNavigateToItems(request.arguments, true));\n                    },\n                    _a[CommandNames.NavtoFull] = function (request) {\n                        return _this.requiredResponse(_this.getNavigateToItems(request.arguments, false));\n                    },\n                    _a[CommandNames.Brace] = function (request) {\n                        return _this.requiredResponse(_this.getBraceMatching(request.arguments, true));\n                    },\n                    _a[CommandNames.BraceFull] = function (request) {\n                        return _this.requiredResponse(_this.getBraceMatching(request.arguments, false));\n                    },\n                    _a[CommandNames.NavBar] = function (request) {\n                        return _this.requiredResponse(_this.getNavigationBarItems(request.arguments, true));\n                    },\n                    _a[CommandNames.NavBarFull] = function (request) {\n                        return _this.requiredResponse(_this.getNavigationBarItems(request.arguments, false));\n                    },\n                    _a[CommandNames.NavTree] = function (request) {\n                        return _this.requiredResponse(_this.getNavigationTree(request.arguments, true));\n                    },\n                    _a[CommandNames.NavTreeFull] = function (request) {\n                        return _this.requiredResponse(_this.getNavigationTree(request.arguments, false));\n                    },\n                    _a[CommandNames.Occurrences] = function (request) {\n                        return _this.requiredResponse(_this.getOccurrences(request.arguments));\n                    },\n                    _a[CommandNames.DocumentHighlights] = function (request) {\n                        return _this.requiredResponse(_this.getDocumentHighlights(request.arguments, true));\n                    },\n                    _a[CommandNames.DocumentHighlightsFull] = function (request) {\n                        return _this.requiredResponse(_this.getDocumentHighlights(request.arguments, false));\n                    },\n                    _a[CommandNames.CompilerOptionsForInferredProjects] = function (request) {\n                        _this.setCompilerOptionsForInferredProjects(request.arguments);\n                        return _this.requiredResponse(true);\n                    },\n                    _a[CommandNames.ProjectInfo] = function (request) {\n                        return _this.requiredResponse(_this.getProjectInfo(request.arguments));\n                    },\n                    _a[CommandNames.ReloadProjects] = function () {\n                        _this.projectService.reloadProjects();\n                        return _this.notRequired();\n                    },\n                    _a[CommandNames.GetCodeFixes] = function (request) {\n                        return _this.requiredResponse(_this.getCodeFixes(request.arguments, true));\n                    },\n                    _a[CommandNames.GetCodeFixesFull] = function (request) {\n                        return _this.requiredResponse(_this.getCodeFixes(request.arguments, false));\n                    },\n                    _a[CommandNames.GetSupportedCodeFixes] = function () {\n                        return _this.requiredResponse(_this.getSupportedCodeFixes());\n                    },\n                    _a));\n                this.eventHander = canUseEvents\n                    ? eventHandler || (function (event) { return _this.defaultEventHandler(event); })\n                    : undefined;\n                this.projectService = new server.ProjectService(host, logger, cancellationToken, useSingleInferredProject, typingsInstaller, this.eventHander);\n                this.gcTimer = new server.GcTimer(host, 7000, logger);\n                var _a;\n            }\n            Session.prototype.defaultEventHandler = function (event) {\n                var _this = this;\n                switch (event.eventName) {\n                    case server.ContextEvent:\n                        var _a = event.data, project = _a.project, fileName = _a.fileName;\n                        this.projectService.logger.info(\"got context event, updating diagnostics for \" + fileName);\n                        this.updateErrorCheck([{ fileName: fileName, project: project }], this.changeSeq, function (n) { return n === _this.changeSeq; }, 100);\n                        break;\n                    case server.ConfigFileDiagEvent:\n                        var _b = event.data, triggerFile = _b.triggerFile, configFileName = _b.configFileName, diagnostics = _b.diagnostics;\n                        this.configFileDiagnosticEvent(triggerFile, configFileName, diagnostics);\n                        break;\n                    case server.ProjectLanguageServiceStateEvent:\n                        var eventName = \"projectLanguageServiceState\";\n                        this.event({\n                            projectName: event.data.project.getProjectName(),\n                            languageServiceEnabled: event.data.languageServiceEnabled\n                        }, eventName);\n                        break;\n                }\n            };\n            Session.prototype.logError = function (err, cmd) {\n                var msg = \"Exception on executing command \" + cmd;\n                if (err.message) {\n                    msg += \":\\n\" + err.message;\n                    if (err.stack) {\n                        msg += \"\\n\" + err.stack;\n                    }\n                }\n                this.logger.msg(msg, server.Msg.Err);\n            };\n            Session.prototype.send = function (msg) {\n                if (msg.type === \"event\" && !this.canUseEvents) {\n                    if (this.logger.hasLevel(server.LogLevel.verbose)) {\n                        this.logger.info(\"Session does not support events: ignored event: \" + JSON.stringify(msg));\n                    }\n                    return;\n                }\n                this.host.write(formatMessage(msg, this.logger, this.byteLength, this.host.newLine));\n            };\n            Session.prototype.configFileDiagnosticEvent = function (triggerFile, configFile, diagnostics) {\n                var bakedDiags = ts.map(diagnostics, formatConfigFileDiag);\n                var ev = {\n                    seq: 0,\n                    type: \"event\",\n                    event: \"configFileDiag\",\n                    body: {\n                        triggerFile: triggerFile,\n                        configFile: configFile,\n                        diagnostics: bakedDiags\n                    }\n                };\n                this.send(ev);\n            };\n            Session.prototype.event = function (info, eventName) {\n                var ev = {\n                    seq: 0,\n                    type: \"event\",\n                    event: eventName,\n                    body: info,\n                };\n                this.send(ev);\n            };\n            Session.prototype.output = function (info, cmdName, reqSeq, errorMsg) {\n                if (reqSeq === void 0) { reqSeq = 0; }\n                var res = {\n                    seq: 0,\n                    type: \"response\",\n                    command: cmdName,\n                    request_seq: reqSeq,\n                    success: !errorMsg,\n                };\n                if (!errorMsg) {\n                    res.body = info;\n                }\n                else {\n                    res.message = errorMsg;\n                }\n                this.send(res);\n            };\n            Session.prototype.semanticCheck = function (file, project) {\n                try {\n                    var diags = [];\n                    if (!shouldSkipSematicCheck(project)) {\n                        diags = project.getLanguageService().getSemanticDiagnostics(file);\n                    }\n                    var bakedDiags = diags.map(function (diag) { return formatDiag(file, project, diag); });\n                    this.event({ file: file, diagnostics: bakedDiags }, \"semanticDiag\");\n                }\n                catch (err) {\n                    this.logError(err, \"semantic check\");\n                }\n            };\n            Session.prototype.syntacticCheck = function (file, project) {\n                try {\n                    var diags = project.getLanguageService().getSyntacticDiagnostics(file);\n                    if (diags) {\n                        var bakedDiags = diags.map(function (diag) { return formatDiag(file, project, diag); });\n                        this.event({ file: file, diagnostics: bakedDiags }, \"syntaxDiag\");\n                    }\n                }\n                catch (err) {\n                    this.logError(err, \"syntactic check\");\n                }\n            };\n            Session.prototype.updateProjectStructure = function (seq, matchSeq, ms) {\n                var _this = this;\n                if (ms === void 0) { ms = 1500; }\n                this.host.setTimeout(function () {\n                    if (matchSeq(seq)) {\n                        _this.projectService.refreshInferredProjects();\n                    }\n                }, ms);\n            };\n            Session.prototype.updateErrorCheck = function (checkList, seq, matchSeq, ms, followMs, requireOpen) {\n                var _this = this;\n                if (ms === void 0) { ms = 1500; }\n                if (followMs === void 0) { followMs = 200; }\n                if (requireOpen === void 0) { requireOpen = true; }\n                if (followMs > ms) {\n                    followMs = ms;\n                }\n                if (this.errorTimer) {\n                    this.host.clearTimeout(this.errorTimer);\n                }\n                if (this.immediateId) {\n                    this.host.clearImmediate(this.immediateId);\n                    this.immediateId = undefined;\n                }\n                var index = 0;\n                var checkOne = function () {\n                    if (matchSeq(seq)) {\n                        var checkSpec_1 = checkList[index];\n                        index++;\n                        if (checkSpec_1.project.containsFile(checkSpec_1.fileName, requireOpen)) {\n                            _this.syntacticCheck(checkSpec_1.fileName, checkSpec_1.project);\n                            _this.immediateId = _this.host.setImmediate(function () {\n                                _this.semanticCheck(checkSpec_1.fileName, checkSpec_1.project);\n                                _this.immediateId = undefined;\n                                if (checkList.length > index) {\n                                    _this.errorTimer = _this.host.setTimeout(checkOne, followMs);\n                                }\n                                else {\n                                    _this.errorTimer = undefined;\n                                }\n                            });\n                        }\n                    }\n                };\n                if ((checkList.length > index) && (matchSeq(seq))) {\n                    this.errorTimer = this.host.setTimeout(checkOne, ms);\n                }\n            };\n            Session.prototype.cleanProjects = function (caption, projects) {\n                if (!projects) {\n                    return;\n                }\n                this.logger.info(\"cleaning \" + caption);\n                for (var _i = 0, projects_4 = projects; _i < projects_4.length; _i++) {\n                    var p = projects_4[_i];\n                    p.getLanguageService(false).cleanupSemanticCache();\n                }\n            };\n            Session.prototype.cleanup = function () {\n                this.cleanProjects(\"inferred projects\", this.projectService.inferredProjects);\n                this.cleanProjects(\"configured projects\", this.projectService.configuredProjects);\n                this.cleanProjects(\"external projects\", this.projectService.externalProjects);\n                if (this.host.gc) {\n                    this.logger.info(\"host.gc()\");\n                    this.host.gc();\n                }\n            };\n            Session.prototype.getEncodedSemanticClassifications = function (args) {\n                var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;\n                return project.getLanguageService().getEncodedSemanticClassifications(file, args);\n            };\n            Session.prototype.getProject = function (projectFileName) {\n                return projectFileName && this.projectService.findProject(projectFileName);\n            };\n            Session.prototype.getCompilerOptionsDiagnostics = function (args) {\n                var project = this.getProject(args.projectFileName);\n                return this.convertToDiagnosticsWithLinePosition(project.getLanguageService().getCompilerOptionsDiagnostics(), undefined);\n            };\n            Session.prototype.convertToDiagnosticsWithLinePosition = function (diagnostics, scriptInfo) {\n                var _this = this;\n                return diagnostics.map(function (d) { return ({\n                    message: ts.flattenDiagnosticMessageText(d.messageText, _this.host.newLine),\n                    start: d.start,\n                    length: d.length,\n                    category: ts.DiagnosticCategory[d.category].toLowerCase(),\n                    code: d.code,\n                    startLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start),\n                    endLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start + d.length)\n                }); });\n            };\n            Session.prototype.getDiagnosticsWorker = function (args, isSemantic, selector, includeLinePosition) {\n                var _a = this.getFileAndProject(args), project = _a.project, file = _a.file;\n                if (isSemantic && shouldSkipSematicCheck(project)) {\n                    return [];\n                }\n                var scriptInfo = project.getScriptInfoForNormalizedPath(file);\n                var diagnostics = selector(project, file);\n                return includeLinePosition\n                    ? this.convertToDiagnosticsWithLinePosition(diagnostics, scriptInfo)\n                    : diagnostics.map(function (d) { return formatDiag(file, project, d); });\n            };\n            Session.prototype.getDefinition = function (args, simplifiedResult) {\n                var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;\n                var scriptInfo = project.getScriptInfoForNormalizedPath(file);\n                var position = this.getPosition(args, scriptInfo);\n                var definitions = project.getLanguageService().getDefinitionAtPosition(file, position);\n                if (!definitions) {\n                    return undefined;\n                }\n                if (simplifiedResult) {\n                    return definitions.map(function (def) {\n                        var defScriptInfo = project.getScriptInfo(def.fileName);\n                        return {\n                            file: def.fileName,\n                            start: defScriptInfo.positionToLineOffset(def.textSpan.start),\n                            end: defScriptInfo.positionToLineOffset(ts.textSpanEnd(def.textSpan))\n                        };\n                    });\n                }\n                else {\n                    return definitions;\n                }\n            };\n            Session.prototype.getTypeDefinition = function (args) {\n                var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;\n                var scriptInfo = project.getScriptInfoForNormalizedPath(file);\n                var position = this.getPosition(args, scriptInfo);\n                var definitions = project.getLanguageService().getTypeDefinitionAtPosition(file, position);\n                if (!definitions) {\n                    return undefined;\n                }\n                return definitions.map(function (def) {\n                    var defScriptInfo = project.getScriptInfo(def.fileName);\n                    return {\n                        file: def.fileName,\n                        start: defScriptInfo.positionToLineOffset(def.textSpan.start),\n                        end: defScriptInfo.positionToLineOffset(ts.textSpanEnd(def.textSpan))\n                    };\n                });\n            };\n            Session.prototype.getImplementation = function (args, simplifiedResult) {\n                var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;\n                var scriptInfo = project.getScriptInfoForNormalizedPath(file);\n                var position = this.getPosition(args, scriptInfo);\n                var implementations = project.getLanguageService().getImplementationAtPosition(file, position);\n                if (!implementations) {\n                    return [];\n                }\n                if (simplifiedResult) {\n                    return implementations.map(function (impl) { return ({\n                        file: impl.fileName,\n                        start: scriptInfo.positionToLineOffset(impl.textSpan.start),\n                        end: scriptInfo.positionToLineOffset(ts.textSpanEnd(impl.textSpan))\n                    }); });\n                }\n                else {\n                    return implementations;\n                }\n            };\n            Session.prototype.getOccurrences = function (args) {\n                var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;\n                var scriptInfo = project.getScriptInfoForNormalizedPath(file);\n                var position = this.getPosition(args, scriptInfo);\n                var occurrences = project.getLanguageService().getOccurrencesAtPosition(file, position);\n                if (!occurrences) {\n                    return undefined;\n                }\n                return occurrences.map(function (occurrence) {\n                    var fileName = occurrence.fileName, isWriteAccess = occurrence.isWriteAccess, textSpan = occurrence.textSpan;\n                    var scriptInfo = project.getScriptInfo(fileName);\n                    var start = scriptInfo.positionToLineOffset(textSpan.start);\n                    var end = scriptInfo.positionToLineOffset(ts.textSpanEnd(textSpan));\n                    return {\n                        start: start,\n                        end: end,\n                        file: fileName,\n                        isWriteAccess: isWriteAccess,\n                    };\n                });\n            };\n            Session.prototype.getSyntacticDiagnosticsSync = function (args) {\n                return this.getDiagnosticsWorker(args, false, function (project, file) { return project.getLanguageService().getSyntacticDiagnostics(file); }, args.includeLinePosition);\n            };\n            Session.prototype.getSemanticDiagnosticsSync = function (args) {\n                return this.getDiagnosticsWorker(args, true, function (project, file) { return project.getLanguageService().getSemanticDiagnostics(file); }, args.includeLinePosition);\n            };\n            Session.prototype.getDocumentHighlights = function (args, simplifiedResult) {\n                var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;\n                var scriptInfo = project.getScriptInfoForNormalizedPath(file);\n                var position = this.getPosition(args, scriptInfo);\n                var documentHighlights = project.getLanguageService().getDocumentHighlights(file, position, args.filesToSearch);\n                if (!documentHighlights) {\n                    return undefined;\n                }\n                if (simplifiedResult) {\n                    return documentHighlights.map(convertToDocumentHighlightsItem);\n                }\n                else {\n                    return documentHighlights;\n                }\n                function convertToDocumentHighlightsItem(documentHighlights) {\n                    var fileName = documentHighlights.fileName, highlightSpans = documentHighlights.highlightSpans;\n                    var scriptInfo = project.getScriptInfo(fileName);\n                    return {\n                        file: fileName,\n                        highlightSpans: highlightSpans.map(convertHighlightSpan)\n                    };\n                    function convertHighlightSpan(highlightSpan) {\n                        var textSpan = highlightSpan.textSpan, kind = highlightSpan.kind;\n                        var start = scriptInfo.positionToLineOffset(textSpan.start);\n                        var end = scriptInfo.positionToLineOffset(ts.textSpanEnd(textSpan));\n                        return { start: start, end: end, kind: kind };\n                    }\n                }\n            };\n            Session.prototype.setCompilerOptionsForInferredProjects = function (args) {\n                this.projectService.setCompilerOptionsForInferredProjects(args.options);\n            };\n            Session.prototype.getProjectInfo = function (args) {\n                return this.getProjectInfoWorker(args.file, args.projectFileName, args.needFileNameList);\n            };\n            Session.prototype.getProjectInfoWorker = function (uncheckedFileName, projectFileName, needFileNameList) {\n                var project = this.getFileAndProjectWorker(uncheckedFileName, projectFileName, true, true).project;\n                var projectInfo = {\n                    configFileName: project.getProjectName(),\n                    languageServiceDisabled: !project.languageServiceEnabled,\n                    fileNames: needFileNameList ? project.getFileNames() : undefined\n                };\n                return projectInfo;\n            };\n            Session.prototype.getRenameInfo = function (args) {\n                var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;\n                var scriptInfo = project.getScriptInfoForNormalizedPath(file);\n                var position = this.getPosition(args, scriptInfo);\n                return project.getLanguageService().getRenameInfo(file, position);\n            };\n            Session.prototype.getProjects = function (args) {\n                var projects;\n                if (args.projectFileName) {\n                    var project = this.getProject(args.projectFileName);\n                    if (project) {\n                        projects = [project];\n                    }\n                }\n                else {\n                    var scriptInfo = this.projectService.getScriptInfo(args.file);\n                    projects = scriptInfo.containingProjects;\n                }\n                projects = ts.filter(projects, function (p) { return p.languageServiceEnabled; });\n                if (!projects || !projects.length) {\n                    return server.Errors.ThrowNoProject();\n                }\n                return projects;\n            };\n            Session.prototype.getRenameLocations = function (args, simplifiedResult) {\n                var file = server.toNormalizedPath(args.file);\n                var info = this.projectService.getScriptInfoForNormalizedPath(file);\n                var position = this.getPosition(args, info);\n                var projects = this.getProjects(args);\n                if (simplifiedResult) {\n                    var defaultProject = projects[0];\n                    var renameInfo = defaultProject.getLanguageService().getRenameInfo(file, position);\n                    if (!renameInfo) {\n                        return undefined;\n                    }\n                    if (!renameInfo.canRename) {\n                        return {\n                            info: renameInfo,\n                            locs: []\n                        };\n                    }\n                    var fileSpans = server.combineProjectOutput(projects, function (project) {\n                        var renameLocations = project.getLanguageService().findRenameLocations(file, position, args.findInStrings, args.findInComments);\n                        if (!renameLocations) {\n                            return [];\n                        }\n                        return renameLocations.map(function (location) {\n                            var locationScriptInfo = project.getScriptInfo(location.fileName);\n                            return {\n                                file: location.fileName,\n                                start: locationScriptInfo.positionToLineOffset(location.textSpan.start),\n                                end: locationScriptInfo.positionToLineOffset(ts.textSpanEnd(location.textSpan)),\n                            };\n                        });\n                    }, compareRenameLocation, function (a, b) { return a.file === b.file && a.start.line === b.start.line && a.start.offset === b.start.offset; });\n                    var locs = fileSpans.reduce(function (accum, cur) {\n                        var curFileAccum;\n                        if (accum.length > 0) {\n                            curFileAccum = accum[accum.length - 1];\n                            if (curFileAccum.file !== cur.file) {\n                                curFileAccum = undefined;\n                            }\n                        }\n                        if (!curFileAccum) {\n                            curFileAccum = { file: cur.file, locs: [] };\n                            accum.push(curFileAccum);\n                        }\n                        curFileAccum.locs.push({ start: cur.start, end: cur.end });\n                        return accum;\n                    }, []);\n                    return { info: renameInfo, locs: locs };\n                }\n                else {\n                    return server.combineProjectOutput(projects, function (p) { return p.getLanguageService().findRenameLocations(file, position, args.findInStrings, args.findInComments); }, undefined, renameLocationIsEqualTo);\n                }\n                function renameLocationIsEqualTo(a, b) {\n                    if (a === b) {\n                        return true;\n                    }\n                    if (!a || !b) {\n                        return false;\n                    }\n                    return a.fileName === b.fileName &&\n                        a.textSpan.start === b.textSpan.start &&\n                        a.textSpan.length === b.textSpan.length;\n                }\n                function compareRenameLocation(a, b) {\n                    if (a.file < b.file) {\n                        return -1;\n                    }\n                    else if (a.file > b.file) {\n                        return 1;\n                    }\n                    else {\n                        if (a.start.line < b.start.line) {\n                            return 1;\n                        }\n                        else if (a.start.line > b.start.line) {\n                            return -1;\n                        }\n                        else {\n                            return b.start.offset - a.start.offset;\n                        }\n                    }\n                }\n            };\n            Session.prototype.getReferences = function (args, simplifiedResult) {\n                var file = server.toNormalizedPath(args.file);\n                var projects = this.getProjects(args);\n                var defaultProject = projects[0];\n                var scriptInfo = defaultProject.getScriptInfoForNormalizedPath(file);\n                var position = this.getPosition(args, scriptInfo);\n                if (simplifiedResult) {\n                    var nameInfo = defaultProject.getLanguageService().getQuickInfoAtPosition(file, position);\n                    if (!nameInfo) {\n                        return undefined;\n                    }\n                    var displayString = ts.displayPartsToString(nameInfo.displayParts);\n                    var nameSpan = nameInfo.textSpan;\n                    var nameColStart = scriptInfo.positionToLineOffset(nameSpan.start).offset;\n                    var nameText = scriptInfo.snap().getText(nameSpan.start, ts.textSpanEnd(nameSpan));\n                    var refs = server.combineProjectOutput(projects, function (project) {\n                        var references = project.getLanguageService().getReferencesAtPosition(file, position);\n                        if (!references) {\n                            return [];\n                        }\n                        return references.map(function (ref) {\n                            var refScriptInfo = project.getScriptInfo(ref.fileName);\n                            var start = refScriptInfo.positionToLineOffset(ref.textSpan.start);\n                            var refLineSpan = refScriptInfo.lineToTextSpan(start.line - 1);\n                            var lineText = refScriptInfo.snap().getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\\r|\\n/g, \"\");\n                            return {\n                                file: ref.fileName,\n                                start: start,\n                                lineText: lineText,\n                                end: refScriptInfo.positionToLineOffset(ts.textSpanEnd(ref.textSpan)),\n                                isWriteAccess: ref.isWriteAccess,\n                                isDefinition: ref.isDefinition\n                            };\n                        });\n                    }, compareFileStart, areReferencesResponseItemsForTheSameLocation);\n                    return {\n                        refs: refs,\n                        symbolName: nameText,\n                        symbolStartOffset: nameColStart,\n                        symbolDisplayString: displayString\n                    };\n                }\n                else {\n                    return server.combineProjectOutput(projects, function (project) { return project.getLanguageService().findReferences(file, position); }, undefined, undefined);\n                }\n                function areReferencesResponseItemsForTheSameLocation(a, b) {\n                    if (a && b) {\n                        return a.file === b.file &&\n                            a.start === b.start &&\n                            a.end === b.end;\n                    }\n                    return false;\n                }\n            };\n            Session.prototype.openClientFile = function (fileName, fileContent, scriptKind) {\n                var _a = this.projectService.openClientFileWithNormalizedPath(fileName, fileContent, scriptKind), configFileName = _a.configFileName, configFileErrors = _a.configFileErrors;\n                if (this.eventHander) {\n                    this.eventHander({\n                        eventName: \"configFileDiag\",\n                        data: { triggerFile: fileName, configFileName: configFileName, diagnostics: configFileErrors || [] }\n                    });\n                }\n            };\n            Session.prototype.getPosition = function (args, scriptInfo) {\n                return args.position !== undefined ? args.position : scriptInfo.lineOffsetToPosition(args.line, args.offset);\n            };\n            Session.prototype.getFileAndProject = function (args, errorOnMissingProject) {\n                if (errorOnMissingProject === void 0) { errorOnMissingProject = true; }\n                return this.getFileAndProjectWorker(args.file, args.projectFileName, true, errorOnMissingProject);\n            };\n            Session.prototype.getFileAndProjectWithoutRefreshingInferredProjects = function (args, errorOnMissingProject) {\n                if (errorOnMissingProject === void 0) { errorOnMissingProject = true; }\n                return this.getFileAndProjectWorker(args.file, args.projectFileName, false, errorOnMissingProject);\n            };\n            Session.prototype.getFileAndProjectWorker = function (uncheckedFileName, projectFileName, refreshInferredProjects, errorOnMissingProject) {\n                var file = server.toNormalizedPath(uncheckedFileName);\n                var project = this.getProject(projectFileName) || this.projectService.getDefaultProjectForFile(file, refreshInferredProjects);\n                if (!project && errorOnMissingProject) {\n                    return server.Errors.ThrowNoProject();\n                }\n                return { file: file, project: project };\n            };\n            Session.prototype.getOutliningSpans = function (args) {\n                var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;\n                return project.getLanguageService(false).getOutliningSpans(file);\n            };\n            Session.prototype.getTodoComments = function (args) {\n                var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;\n                return project.getLanguageService().getTodoComments(file, args.descriptors);\n            };\n            Session.prototype.getDocCommentTemplate = function (args) {\n                var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;\n                var scriptInfo = project.getScriptInfoForNormalizedPath(file);\n                var position = this.getPosition(args, scriptInfo);\n                return project.getLanguageService(false).getDocCommentTemplateAtPosition(file, position);\n            };\n            Session.prototype.getIndentation = function (args) {\n                var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;\n                var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file));\n                var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file);\n                var indentation = project.getLanguageService(false).getIndentationAtPosition(file, position, options);\n                return { position: position, indentation: indentation };\n            };\n            Session.prototype.getBreakpointStatement = function (args) {\n                var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;\n                var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file));\n                return project.getLanguageService(false).getBreakpointStatementAtPosition(file, position);\n            };\n            Session.prototype.getNameOrDottedNameSpan = function (args) {\n                var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;\n                var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file));\n                return project.getLanguageService(false).getNameOrDottedNameSpan(file, position, position);\n            };\n            Session.prototype.isValidBraceCompletion = function (args) {\n                var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;\n                var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file));\n                return project.getLanguageService(false).isValidBraceCompletionAtPosition(file, position, args.openingBrace.charCodeAt(0));\n            };\n            Session.prototype.getQuickInfoWorker = function (args, simplifiedResult) {\n                var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;\n                var scriptInfo = project.getScriptInfoForNormalizedPath(file);\n                var quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo));\n                if (!quickInfo) {\n                    return undefined;\n                }\n                if (simplifiedResult) {\n                    var displayString = ts.displayPartsToString(quickInfo.displayParts);\n                    var docString = ts.displayPartsToString(quickInfo.documentation);\n                    return {\n                        kind: quickInfo.kind,\n                        kindModifiers: quickInfo.kindModifiers,\n                        start: scriptInfo.positionToLineOffset(quickInfo.textSpan.start),\n                        end: scriptInfo.positionToLineOffset(ts.textSpanEnd(quickInfo.textSpan)),\n                        displayString: displayString,\n                        documentation: docString,\n                    };\n                }\n                else {\n                    return quickInfo;\n                }\n            };\n            Session.prototype.getFormattingEditsForRange = function (args) {\n                var _this = this;\n                var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;\n                var scriptInfo = project.getScriptInfoForNormalizedPath(file);\n                var startPosition = scriptInfo.lineOffsetToPosition(args.line, args.offset);\n                var endPosition = scriptInfo.lineOffsetToPosition(args.endLine, args.endOffset);\n                var edits = project.getLanguageService(false).getFormattingEditsForRange(file, startPosition, endPosition, this.projectService.getFormatCodeOptions(file));\n                if (!edits) {\n                    return undefined;\n                }\n                return edits.map(function (edit) { return _this.convertTextChangeToCodeEdit(edit, scriptInfo); });\n            };\n            Session.prototype.getFormattingEditsForRangeFull = function (args) {\n                var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;\n                var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file);\n                return project.getLanguageService(false).getFormattingEditsForRange(file, args.position, args.endPosition, options);\n            };\n            Session.prototype.getFormattingEditsForDocumentFull = function (args) {\n                var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;\n                var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file);\n                return project.getLanguageService(false).getFormattingEditsForDocument(file, options);\n            };\n            Session.prototype.getFormattingEditsAfterKeystrokeFull = function (args) {\n                var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;\n                var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file);\n                return project.getLanguageService(false).getFormattingEditsAfterKeystroke(file, args.position, args.key, options);\n            };\n            Session.prototype.getFormattingEditsAfterKeystroke = function (args) {\n                var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;\n                var scriptInfo = project.getScriptInfoForNormalizedPath(file);\n                var position = scriptInfo.lineOffsetToPosition(args.line, args.offset);\n                var formatOptions = this.projectService.getFormatCodeOptions(file);\n                var edits = project.getLanguageService(false).getFormattingEditsAfterKeystroke(file, position, args.key, formatOptions);\n                if ((args.key == \"\\n\") && ((!edits) || (edits.length === 0) || allEditsBeforePos(edits, position))) {\n                    var lineInfo = scriptInfo.getLineInfo(args.line);\n                    if (lineInfo && (lineInfo.leaf) && (lineInfo.leaf.text)) {\n                        var lineText = lineInfo.leaf.text;\n                        if (lineText.search(\"\\\\S\") < 0) {\n                            var preferredIndent = project.getLanguageService(false).getIndentationAtPosition(file, position, formatOptions);\n                            var hasIndent = 0;\n                            var i = void 0, len = void 0;\n                            for (i = 0, len = lineText.length; i < len; i++) {\n                                if (lineText.charAt(i) == \" \") {\n                                    hasIndent++;\n                                }\n                                else if (lineText.charAt(i) == \"\\t\") {\n                                    hasIndent += formatOptions.tabSize;\n                                }\n                                else {\n                                    break;\n                                }\n                            }\n                            if (preferredIndent !== hasIndent) {\n                                var firstNoWhiteSpacePosition = lineInfo.offset + i;\n                                edits.push({\n                                    span: ts.createTextSpanFromBounds(lineInfo.offset, firstNoWhiteSpacePosition),\n                                    newText: ts.formatting.getIndentationString(preferredIndent, formatOptions)\n                                });\n                            }\n                        }\n                    }\n                }\n                if (!edits) {\n                    return undefined;\n                }\n                return edits.map(function (edit) {\n                    return {\n                        start: scriptInfo.positionToLineOffset(edit.span.start),\n                        end: scriptInfo.positionToLineOffset(ts.textSpanEnd(edit.span)),\n                        newText: edit.newText ? edit.newText : \"\"\n                    };\n                });\n            };\n            Session.prototype.getCompletions = function (args, simplifiedResult) {\n                var _this = this;\n                var prefix = args.prefix || \"\";\n                var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;\n                var scriptInfo = project.getScriptInfoForNormalizedPath(file);\n                var position = this.getPosition(args, scriptInfo);\n                var completions = project.getLanguageService().getCompletionsAtPosition(file, position);\n                if (!completions) {\n                    return undefined;\n                }\n                if (simplifiedResult) {\n                    return completions.entries.reduce(function (result, entry) {\n                        if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) {\n                            var name_52 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan;\n                            var convertedSpan = replacementSpan ? _this.decorateSpan(replacementSpan, scriptInfo) : undefined;\n                            result.push({ name: name_52, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan });\n                        }\n                        return result;\n                    }, []).sort(function (a, b) { return ts.compareStrings(a.name, b.name); });\n                }\n                else {\n                    return completions;\n                }\n            };\n            Session.prototype.getCompletionEntryDetails = function (args) {\n                var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;\n                var scriptInfo = project.getScriptInfoForNormalizedPath(file);\n                var position = this.getPosition(args, scriptInfo);\n                return args.entryNames.reduce(function (accum, entryName) {\n                    var details = project.getLanguageService().getCompletionEntryDetails(file, position, entryName);\n                    if (details) {\n                        accum.push(details);\n                    }\n                    return accum;\n                }, []);\n            };\n            Session.prototype.getCompileOnSaveAffectedFileList = function (args) {\n                var info = this.projectService.getScriptInfo(args.file);\n                var result = [];\n                if (!info) {\n                    return [];\n                }\n                var projectsToSearch = args.projectFileName ? [this.projectService.findProject(args.projectFileName)] : info.containingProjects;\n                for (var _i = 0, projectsToSearch_1 = projectsToSearch; _i < projectsToSearch_1.length; _i++) {\n                    var project = projectsToSearch_1[_i];\n                    if (project.compileOnSaveEnabled && project.languageServiceEnabled) {\n                        result.push({\n                            projectFileName: project.getProjectName(),\n                            fileNames: project.getCompileOnSaveAffectedFileList(info)\n                        });\n                    }\n                }\n                return result;\n            };\n            Session.prototype.emitFile = function (args) {\n                var _this = this;\n                var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;\n                if (!project) {\n                    server.Errors.ThrowNoProject();\n                }\n                var scriptInfo = project.getScriptInfo(file);\n                return project.builder.emitFile(scriptInfo, function (path, data, writeByteOrderMark) { return _this.host.writeFile(path, data, writeByteOrderMark); });\n            };\n            Session.prototype.getSignatureHelpItems = function (args, simplifiedResult) {\n                var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;\n                var scriptInfo = project.getScriptInfoForNormalizedPath(file);\n                var position = this.getPosition(args, scriptInfo);\n                var helpItems = project.getLanguageService().getSignatureHelpItems(file, position);\n                if (!helpItems) {\n                    return undefined;\n                }\n                if (simplifiedResult) {\n                    var span_16 = helpItems.applicableSpan;\n                    return {\n                        items: helpItems.items,\n                        applicableSpan: {\n                            start: scriptInfo.positionToLineOffset(span_16.start),\n                            end: scriptInfo.positionToLineOffset(span_16.start + span_16.length)\n                        },\n                        selectedItemIndex: helpItems.selectedItemIndex,\n                        argumentIndex: helpItems.argumentIndex,\n                        argumentCount: helpItems.argumentCount,\n                    };\n                }\n                else {\n                    return helpItems;\n                }\n            };\n            Session.prototype.getDiagnostics = function (delay, fileNames) {\n                var _this = this;\n                var checkList = fileNames.reduce(function (accum, uncheckedFileName) {\n                    var fileName = server.toNormalizedPath(uncheckedFileName);\n                    var project = _this.projectService.getDefaultProjectForFile(fileName, true);\n                    if (project) {\n                        accum.push({ fileName: fileName, project: project });\n                    }\n                    return accum;\n                }, []);\n                if (checkList.length > 0) {\n                    this.updateErrorCheck(checkList, this.changeSeq, function (n) { return n === _this.changeSeq; }, delay);\n                }\n            };\n            Session.prototype.change = function (args) {\n                var _this = this;\n                var _a = this.getFileAndProject(args, false), file = _a.file, project = _a.project;\n                if (project) {\n                    var scriptInfo = project.getScriptInfoForNormalizedPath(file);\n                    var start = scriptInfo.lineOffsetToPosition(args.line, args.offset);\n                    var end = scriptInfo.lineOffsetToPosition(args.endLine, args.endOffset);\n                    if (start >= 0) {\n                        scriptInfo.editContent(start, end, args.insertString);\n                        this.changeSeq++;\n                    }\n                    this.updateProjectStructure(this.changeSeq, function (n) { return n === _this.changeSeq; });\n                }\n            };\n            Session.prototype.reload = function (args, reqSeq) {\n                var file = server.toNormalizedPath(args.file);\n                var tempFileName = args.tmpfile && server.toNormalizedPath(args.tmpfile);\n                var project = this.projectService.getDefaultProjectForFile(file, true);\n                if (project) {\n                    this.changeSeq++;\n                    if (project.reloadScript(file, tempFileName)) {\n                        this.output(undefined, CommandNames.Reload, reqSeq);\n                    }\n                }\n            };\n            Session.prototype.saveToTmp = function (fileName, tempFileName) {\n                var scriptInfo = this.projectService.getScriptInfo(fileName);\n                if (scriptInfo) {\n                    scriptInfo.saveTo(tempFileName);\n                }\n            };\n            Session.prototype.closeClientFile = function (fileName) {\n                if (!fileName) {\n                    return;\n                }\n                var file = ts.normalizePath(fileName);\n                this.projectService.closeClientFile(file);\n            };\n            Session.prototype.decorateNavigationBarItems = function (items, scriptInfo) {\n                var _this = this;\n                return ts.map(items, function (item) { return ({\n                    text: item.text,\n                    kind: item.kind,\n                    kindModifiers: item.kindModifiers,\n                    spans: item.spans.map(function (span) { return _this.decorateSpan(span, scriptInfo); }),\n                    childItems: _this.decorateNavigationBarItems(item.childItems, scriptInfo),\n                    indent: item.indent\n                }); });\n            };\n            Session.prototype.getNavigationBarItems = function (args, simplifiedResult) {\n                var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;\n                var items = project.getLanguageService(false).getNavigationBarItems(file);\n                return !items\n                    ? undefined\n                    : simplifiedResult\n                        ? this.decorateNavigationBarItems(items, project.getScriptInfoForNormalizedPath(file))\n                        : items;\n            };\n            Session.prototype.decorateNavigationTree = function (tree, scriptInfo) {\n                var _this = this;\n                return {\n                    text: tree.text,\n                    kind: tree.kind,\n                    kindModifiers: tree.kindModifiers,\n                    spans: tree.spans.map(function (span) { return _this.decorateSpan(span, scriptInfo); }),\n                    childItems: ts.map(tree.childItems, function (item) { return _this.decorateNavigationTree(item, scriptInfo); })\n                };\n            };\n            Session.prototype.decorateSpan = function (span, scriptInfo) {\n                return {\n                    start: scriptInfo.positionToLineOffset(span.start),\n                    end: scriptInfo.positionToLineOffset(ts.textSpanEnd(span))\n                };\n            };\n            Session.prototype.getNavigationTree = function (args, simplifiedResult) {\n                var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;\n                var tree = project.getLanguageService(false).getNavigationTree(file);\n                return !tree\n                    ? undefined\n                    : simplifiedResult\n                        ? this.decorateNavigationTree(tree, project.getScriptInfoForNormalizedPath(file))\n                        : tree;\n            };\n            Session.prototype.getNavigateToItems = function (args, simplifiedResult) {\n                var projects = this.getProjects(args);\n                var fileName = args.currentFileOnly ? args.file && ts.normalizeSlashes(args.file) : undefined;\n                if (simplifiedResult) {\n                    return server.combineProjectOutput(projects, function (project) {\n                        var navItems = project.getLanguageService().getNavigateToItems(args.searchValue, args.maxResultCount, fileName, project.isNonTsProject());\n                        if (!navItems) {\n                            return [];\n                        }\n                        return navItems.map(function (navItem) {\n                            var scriptInfo = project.getScriptInfo(navItem.fileName);\n                            var start = scriptInfo.positionToLineOffset(navItem.textSpan.start);\n                            var end = scriptInfo.positionToLineOffset(ts.textSpanEnd(navItem.textSpan));\n                            var bakedItem = {\n                                name: navItem.name,\n                                kind: navItem.kind,\n                                file: navItem.fileName,\n                                start: start,\n                                end: end,\n                            };\n                            if (navItem.kindModifiers && (navItem.kindModifiers !== \"\")) {\n                                bakedItem.kindModifiers = navItem.kindModifiers;\n                            }\n                            if (navItem.matchKind !== \"none\") {\n                                bakedItem.matchKind = navItem.matchKind;\n                            }\n                            if (navItem.containerName && (navItem.containerName.length > 0)) {\n                                bakedItem.containerName = navItem.containerName;\n                            }\n                            if (navItem.containerKind && (navItem.containerKind.length > 0)) {\n                                bakedItem.containerKind = navItem.containerKind;\n                            }\n                            return bakedItem;\n                        });\n                    }, undefined, areNavToItemsForTheSameLocation);\n                }\n                else {\n                    return server.combineProjectOutput(projects, function (project) { return project.getLanguageService().getNavigateToItems(args.searchValue, args.maxResultCount, fileName, project.isNonTsProject()); }, undefined, navigateToItemIsEqualTo);\n                }\n                function navigateToItemIsEqualTo(a, b) {\n                    if (a === b) {\n                        return true;\n                    }\n                    if (!a || !b) {\n                        return false;\n                    }\n                    return a.containerKind === b.containerKind &&\n                        a.containerName === b.containerName &&\n                        a.fileName === b.fileName &&\n                        a.isCaseSensitive === b.isCaseSensitive &&\n                        a.kind === b.kind &&\n                        a.kindModifiers === b.containerName &&\n                        a.matchKind === b.matchKind &&\n                        a.name === b.name &&\n                        a.textSpan.start === b.textSpan.start &&\n                        a.textSpan.length === b.textSpan.length;\n                }\n                function areNavToItemsForTheSameLocation(a, b) {\n                    if (a && b) {\n                        return a.file === b.file &&\n                            a.start === b.start &&\n                            a.end === b.end;\n                    }\n                    return false;\n                }\n            };\n            Session.prototype.getSupportedCodeFixes = function () {\n                return ts.getSupportedCodeFixes();\n            };\n            Session.prototype.getCodeFixes = function (args, simplifiedResult) {\n                var _this = this;\n                var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;\n                var scriptInfo = project.getScriptInfoForNormalizedPath(file);\n                var startPosition = getStartPosition();\n                var endPosition = getEndPosition();\n                var codeActions = project.getLanguageService().getCodeFixesAtPosition(file, startPosition, endPosition, args.errorCodes);\n                if (!codeActions) {\n                    return undefined;\n                }\n                if (simplifiedResult) {\n                    return codeActions.map(function (codeAction) { return _this.mapCodeAction(codeAction, scriptInfo); });\n                }\n                else {\n                    return codeActions;\n                }\n                function getStartPosition() {\n                    return args.startPosition !== undefined ? args.startPosition : scriptInfo.lineOffsetToPosition(args.startLine, args.startOffset);\n                }\n                function getEndPosition() {\n                    return args.endPosition !== undefined ? args.endPosition : scriptInfo.lineOffsetToPosition(args.endLine, args.endOffset);\n                }\n            };\n            Session.prototype.mapCodeAction = function (codeAction, scriptInfo) {\n                var _this = this;\n                return {\n                    description: codeAction.description,\n                    changes: codeAction.changes.map(function (change) { return ({\n                        fileName: change.fileName,\n                        textChanges: change.textChanges.map(function (textChange) { return _this.convertTextChangeToCodeEdit(textChange, scriptInfo); })\n                    }); })\n                };\n            };\n            Session.prototype.convertTextChangeToCodeEdit = function (change, scriptInfo) {\n                return {\n                    start: scriptInfo.positionToLineOffset(change.span.start),\n                    end: scriptInfo.positionToLineOffset(change.span.start + change.span.length),\n                    newText: change.newText ? change.newText : \"\"\n                };\n            };\n            Session.prototype.getBraceMatching = function (args, simplifiedResult) {\n                var _this = this;\n                var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;\n                var scriptInfo = project.getScriptInfoForNormalizedPath(file);\n                var position = this.getPosition(args, scriptInfo);\n                var spans = project.getLanguageService(false).getBraceMatchingAtPosition(file, position);\n                return !spans\n                    ? undefined\n                    : simplifiedResult\n                        ? spans.map(function (span) { return _this.decorateSpan(span, scriptInfo); })\n                        : spans;\n            };\n            Session.prototype.getDiagnosticsForProject = function (delay, fileName) {\n                var _this = this;\n                var _a = this.getProjectInfoWorker(fileName, undefined, true), fileNames = _a.fileNames, languageServiceDisabled = _a.languageServiceDisabled;\n                if (languageServiceDisabled) {\n                    return;\n                }\n                var fileNamesInProject = fileNames.filter(function (value) { return value.indexOf(\"lib.d.ts\") < 0; });\n                var highPriorityFiles = [];\n                var mediumPriorityFiles = [];\n                var lowPriorityFiles = [];\n                var veryLowPriorityFiles = [];\n                var normalizedFileName = server.toNormalizedPath(fileName);\n                var project = this.projectService.getDefaultProjectForFile(normalizedFileName, true);\n                for (var _i = 0, fileNamesInProject_1 = fileNamesInProject; _i < fileNamesInProject_1.length; _i++) {\n                    var fileNameInProject = fileNamesInProject_1[_i];\n                    if (this.getCanonicalFileName(fileNameInProject) == this.getCanonicalFileName(fileName))\n                        highPriorityFiles.push(fileNameInProject);\n                    else {\n                        var info = this.projectService.getScriptInfo(fileNameInProject);\n                        if (!info.isOpen) {\n                            if (fileNameInProject.indexOf(\".d.ts\") > 0)\n                                veryLowPriorityFiles.push(fileNameInProject);\n                            else\n                                lowPriorityFiles.push(fileNameInProject);\n                        }\n                        else\n                            mediumPriorityFiles.push(fileNameInProject);\n                    }\n                }\n                fileNamesInProject = highPriorityFiles.concat(mediumPriorityFiles).concat(lowPriorityFiles).concat(veryLowPriorityFiles);\n                if (fileNamesInProject.length > 0) {\n                    var checkList = fileNamesInProject.map(function (fileName) { return ({ fileName: fileName, project: project }); });\n                    this.updateErrorCheck(checkList, this.changeSeq, function (n) { return n == _this.changeSeq; }, delay, 200, false);\n                }\n            };\n            Session.prototype.getCanonicalFileName = function (fileName) {\n                var name = this.host.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();\n                return ts.normalizePath(name);\n            };\n            Session.prototype.exit = function () {\n            };\n            Session.prototype.notRequired = function () {\n                return { responseRequired: false };\n            };\n            Session.prototype.requiredResponse = function (response) {\n                return { response: response, responseRequired: true };\n            };\n            Session.prototype.addProtocolHandler = function (command, handler) {\n                if (command in this.handlers) {\n                    throw new Error(\"Protocol handler already exists for command \\\"\" + command + \"\\\"\");\n                }\n                this.handlers[command] = handler;\n            };\n            Session.prototype.executeCommand = function (request) {\n                var handler = this.handlers[request.command];\n                if (handler) {\n                    return handler(request);\n                }\n                else {\n                    this.logger.msg(\"Unrecognized JSON command: \" + JSON.stringify(request), server.Msg.Err);\n                    this.output(undefined, CommandNames.Unknown, request.seq, \"Unrecognized JSON command: \" + request.command);\n                    return { responseRequired: false };\n                }\n            };\n            Session.prototype.onMessage = function (message) {\n                this.gcTimer.scheduleCollect();\n                var start;\n                if (this.logger.hasLevel(server.LogLevel.requestTime)) {\n                    start = this.hrtime();\n                    if (this.logger.hasLevel(server.LogLevel.verbose)) {\n                        this.logger.info(\"request: \" + message);\n                    }\n                }\n                var request;\n                try {\n                    request = JSON.parse(message);\n                    var _a = this.executeCommand(request), response = _a.response, responseRequired = _a.responseRequired;\n                    if (this.logger.hasLevel(server.LogLevel.requestTime)) {\n                        var elapsedTime = hrTimeToMilliseconds(this.hrtime(start)).toFixed(4);\n                        if (responseRequired) {\n                            this.logger.perftrc(request.seq + \"::\" + request.command + \": elapsed time (in milliseconds) \" + elapsedTime);\n                        }\n                        else {\n                            this.logger.perftrc(request.seq + \"::\" + request.command + \": async elapsed time (in milliseconds) \" + elapsedTime);\n                        }\n                    }\n                    if (response) {\n                        this.output(response, request.command, request.seq);\n                    }\n                    else if (responseRequired) {\n                        this.output(undefined, request.command, request.seq, \"No content available.\");\n                    }\n                }\n                catch (err) {\n                    if (err instanceof ts.OperationCanceledException) {\n                        this.output({ canceled: true }, request.command, request.seq);\n                        return;\n                    }\n                    this.logError(err, message);\n                    this.output(undefined, request ? request.command : CommandNames.Unknown, request ? request.seq : 0, \"Error processing request. \" + err.message + \"\\n\" + err.stack);\n                }\n            };\n            return Session;\n        }());\n        server.Session = Session;\n    })(server = ts.server || (ts.server = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var server;\n    (function (server) {\n        var lineCollectionCapacity = 4;\n        var CharRangeSection;\n        (function (CharRangeSection) {\n            CharRangeSection[CharRangeSection[\"PreStart\"] = 0] = \"PreStart\";\n            CharRangeSection[CharRangeSection[\"Start\"] = 1] = \"Start\";\n            CharRangeSection[CharRangeSection[\"Entire\"] = 2] = \"Entire\";\n            CharRangeSection[CharRangeSection[\"Mid\"] = 3] = \"Mid\";\n            CharRangeSection[CharRangeSection[\"End\"] = 4] = \"End\";\n            CharRangeSection[CharRangeSection[\"PostEnd\"] = 5] = \"PostEnd\";\n        })(CharRangeSection = server.CharRangeSection || (server.CharRangeSection = {}));\n        var BaseLineIndexWalker = (function () {\n            function BaseLineIndexWalker() {\n                this.goSubtree = true;\n                this.done = false;\n            }\n            BaseLineIndexWalker.prototype.leaf = function (_rangeStart, _rangeLength, _ll) {\n            };\n            return BaseLineIndexWalker;\n        }());\n        var EditWalker = (function (_super) {\n            __extends(EditWalker, _super);\n            function EditWalker() {\n                var _this = _super.call(this) || this;\n                _this.lineIndex = new LineIndex();\n                _this.endBranch = [];\n                _this.state = CharRangeSection.Entire;\n                _this.initialText = \"\";\n                _this.trailingText = \"\";\n                _this.suppressTrailingText = false;\n                _this.lineIndex.root = new LineNode();\n                _this.startPath = [_this.lineIndex.root];\n                _this.stack = [_this.lineIndex.root];\n                return _this;\n            }\n            EditWalker.prototype.insertLines = function (insertedText) {\n                if (this.suppressTrailingText) {\n                    this.trailingText = \"\";\n                }\n                if (insertedText) {\n                    insertedText = this.initialText + insertedText + this.trailingText;\n                }\n                else {\n                    insertedText = this.initialText + this.trailingText;\n                }\n                var lm = LineIndex.linesFromText(insertedText);\n                var lines = lm.lines;\n                if (lines.length > 1) {\n                    if (lines[lines.length - 1] == \"\") {\n                        lines.length--;\n                    }\n                }\n                var branchParent;\n                var lastZeroCount;\n                for (var k = this.endBranch.length - 1; k >= 0; k--) {\n                    this.endBranch[k].updateCounts();\n                    if (this.endBranch[k].charCount() === 0) {\n                        lastZeroCount = this.endBranch[k];\n                        if (k > 0) {\n                            branchParent = this.endBranch[k - 1];\n                        }\n                        else {\n                            branchParent = this.branchNode;\n                        }\n                    }\n                }\n                if (lastZeroCount) {\n                    branchParent.remove(lastZeroCount);\n                }\n                var insertionNode = this.startPath[this.startPath.length - 2];\n                var leafNode = this.startPath[this.startPath.length - 1];\n                var len = lines.length;\n                if (len > 0) {\n                    leafNode.text = lines[0];\n                    if (len > 1) {\n                        var insertedNodes = new Array(len - 1);\n                        var startNode = leafNode;\n                        for (var i = 1, len_1 = lines.length; i < len_1; i++) {\n                            insertedNodes[i - 1] = new LineLeaf(lines[i]);\n                        }\n                        var pathIndex = this.startPath.length - 2;\n                        while (pathIndex >= 0) {\n                            insertionNode = this.startPath[pathIndex];\n                            insertedNodes = insertionNode.insertAt(startNode, insertedNodes);\n                            pathIndex--;\n                            startNode = insertionNode;\n                        }\n                        var insertedNodesLen = insertedNodes.length;\n                        while (insertedNodesLen > 0) {\n                            var newRoot = new LineNode();\n                            newRoot.add(this.lineIndex.root);\n                            insertedNodes = newRoot.insertAt(this.lineIndex.root, insertedNodes);\n                            insertedNodesLen = insertedNodes.length;\n                            this.lineIndex.root = newRoot;\n                        }\n                        this.lineIndex.root.updateCounts();\n                    }\n                    else {\n                        for (var j = this.startPath.length - 2; j >= 0; j--) {\n                            this.startPath[j].updateCounts();\n                        }\n                    }\n                }\n                else {\n                    insertionNode.remove(leafNode);\n                    for (var j = this.startPath.length - 2; j >= 0; j--) {\n                        this.startPath[j].updateCounts();\n                    }\n                }\n                return this.lineIndex;\n            };\n            EditWalker.prototype.post = function (_relativeStart, _relativeLength, lineCollection) {\n                if (lineCollection === this.lineCollectionAtBranch) {\n                    this.state = CharRangeSection.End;\n                }\n                this.stack.length--;\n                return undefined;\n            };\n            EditWalker.prototype.pre = function (_relativeStart, _relativeLength, lineCollection, _parent, nodeType) {\n                var currentNode = this.stack[this.stack.length - 1];\n                if ((this.state === CharRangeSection.Entire) && (nodeType === CharRangeSection.Start)) {\n                    this.state = CharRangeSection.Start;\n                    this.branchNode = currentNode;\n                    this.lineCollectionAtBranch = lineCollection;\n                }\n                var child;\n                function fresh(node) {\n                    if (node.isLeaf()) {\n                        return new LineLeaf(\"\");\n                    }\n                    else\n                        return new LineNode();\n                }\n                switch (nodeType) {\n                    case CharRangeSection.PreStart:\n                        this.goSubtree = false;\n                        if (this.state !== CharRangeSection.End) {\n                            currentNode.add(lineCollection);\n                        }\n                        break;\n                    case CharRangeSection.Start:\n                        if (this.state === CharRangeSection.End) {\n                            this.goSubtree = false;\n                        }\n                        else {\n                            child = fresh(lineCollection);\n                            currentNode.add(child);\n                            this.startPath[this.startPath.length] = child;\n                        }\n                        break;\n                    case CharRangeSection.Entire:\n                        if (this.state !== CharRangeSection.End) {\n                            child = fresh(lineCollection);\n                            currentNode.add(child);\n                            this.startPath[this.startPath.length] = child;\n                        }\n                        else {\n                            if (!lineCollection.isLeaf()) {\n                                child = fresh(lineCollection);\n                                currentNode.add(child);\n                                this.endBranch[this.endBranch.length] = child;\n                            }\n                        }\n                        break;\n                    case CharRangeSection.Mid:\n                        this.goSubtree = false;\n                        break;\n                    case CharRangeSection.End:\n                        if (this.state !== CharRangeSection.End) {\n                            this.goSubtree = false;\n                        }\n                        else {\n                            if (!lineCollection.isLeaf()) {\n                                child = fresh(lineCollection);\n                                currentNode.add(child);\n                                this.endBranch[this.endBranch.length] = child;\n                            }\n                        }\n                        break;\n                    case CharRangeSection.PostEnd:\n                        this.goSubtree = false;\n                        if (this.state !== CharRangeSection.Start) {\n                            currentNode.add(lineCollection);\n                        }\n                        break;\n                }\n                if (this.goSubtree) {\n                    this.stack[this.stack.length] = child;\n                }\n                return lineCollection;\n            };\n            EditWalker.prototype.leaf = function (relativeStart, relativeLength, ll) {\n                if (this.state === CharRangeSection.Start) {\n                    this.initialText = ll.text.substring(0, relativeStart);\n                }\n                else if (this.state === CharRangeSection.Entire) {\n                    this.initialText = ll.text.substring(0, relativeStart);\n                    this.trailingText = ll.text.substring(relativeStart + relativeLength);\n                }\n                else {\n                    this.trailingText = ll.text.substring(relativeStart + relativeLength);\n                }\n            };\n            return EditWalker;\n        }(BaseLineIndexWalker));\n        var TextChange = (function () {\n            function TextChange(pos, deleteLen, insertedText) {\n                this.pos = pos;\n                this.deleteLen = deleteLen;\n                this.insertedText = insertedText;\n            }\n            TextChange.prototype.getTextChangeRange = function () {\n                return ts.createTextChangeRange(ts.createTextSpan(this.pos, this.deleteLen), this.insertedText ? this.insertedText.length : 0);\n            };\n            return TextChange;\n        }());\n        server.TextChange = TextChange;\n        var ScriptVersionCache = (function () {\n            function ScriptVersionCache() {\n                this.changes = [];\n                this.versions = new Array(ScriptVersionCache.maxVersions);\n                this.minVersion = 0;\n                this.currentVersion = 0;\n            }\n            ScriptVersionCache.prototype.versionToIndex = function (version) {\n                if (version < this.minVersion || version > this.currentVersion) {\n                    return undefined;\n                }\n                return version % ScriptVersionCache.maxVersions;\n            };\n            ScriptVersionCache.prototype.currentVersionToIndex = function () {\n                return this.currentVersion % ScriptVersionCache.maxVersions;\n            };\n            ScriptVersionCache.prototype.edit = function (pos, deleteLen, insertedText) {\n                this.changes[this.changes.length] = new TextChange(pos, deleteLen, insertedText);\n                if ((this.changes.length > ScriptVersionCache.changeNumberThreshold) ||\n                    (deleteLen > ScriptVersionCache.changeLengthThreshold) ||\n                    (insertedText && (insertedText.length > ScriptVersionCache.changeLengthThreshold))) {\n                    this.getSnapshot();\n                }\n            };\n            ScriptVersionCache.prototype.latest = function () {\n                return this.versions[this.currentVersionToIndex()];\n            };\n            ScriptVersionCache.prototype.latestVersion = function () {\n                if (this.changes.length > 0) {\n                    this.getSnapshot();\n                }\n                return this.currentVersion;\n            };\n            ScriptVersionCache.prototype.reloadFromFile = function (filename) {\n                var content = this.host.readFile(filename);\n                if (!content) {\n                    content = \"\";\n                }\n                this.reload(content);\n            };\n            ScriptVersionCache.prototype.reload = function (script) {\n                this.currentVersion++;\n                this.changes = [];\n                var snap = new LineIndexSnapshot(this.currentVersion, this);\n                for (var i = 0; i < this.versions.length; i++) {\n                    this.versions[i] = undefined;\n                }\n                this.versions[this.currentVersionToIndex()] = snap;\n                snap.index = new LineIndex();\n                var lm = LineIndex.linesFromText(script);\n                snap.index.load(lm.lines);\n                this.minVersion = this.currentVersion;\n            };\n            ScriptVersionCache.prototype.getSnapshot = function () {\n                var snap = this.versions[this.currentVersionToIndex()];\n                if (this.changes.length > 0) {\n                    var snapIndex = snap.index;\n                    for (var i = 0, len = this.changes.length; i < len; i++) {\n                        var change = this.changes[i];\n                        snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText);\n                    }\n                    snap = new LineIndexSnapshot(this.currentVersion + 1, this);\n                    snap.index = snapIndex;\n                    snap.changesSincePreviousVersion = this.changes;\n                    this.currentVersion = snap.version;\n                    this.versions[this.currentVersionToIndex()] = snap;\n                    this.changes = [];\n                    if ((this.currentVersion - this.minVersion) >= ScriptVersionCache.maxVersions) {\n                        this.minVersion = (this.currentVersion - ScriptVersionCache.maxVersions) + 1;\n                    }\n                }\n                return snap;\n            };\n            ScriptVersionCache.prototype.getTextChangesBetweenVersions = function (oldVersion, newVersion) {\n                if (oldVersion < newVersion) {\n                    if (oldVersion >= this.minVersion) {\n                        var textChangeRanges = [];\n                        for (var i = oldVersion + 1; i <= newVersion; i++) {\n                            var snap = this.versions[this.versionToIndex(i)];\n                            for (var j = 0, len = snap.changesSincePreviousVersion.length; j < len; j++) {\n                                var textChange = snap.changesSincePreviousVersion[j];\n                                textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange();\n                            }\n                        }\n                        return ts.collapseTextChangeRangesAcrossMultipleVersions(textChangeRanges);\n                    }\n                    else {\n                        return undefined;\n                    }\n                }\n                else {\n                    return ts.unchangedTextChangeRange;\n                }\n            };\n            ScriptVersionCache.fromString = function (host, script) {\n                var svc = new ScriptVersionCache();\n                var snap = new LineIndexSnapshot(0, svc);\n                svc.versions[svc.currentVersion] = snap;\n                svc.host = host;\n                snap.index = new LineIndex();\n                var lm = LineIndex.linesFromText(script);\n                snap.index.load(lm.lines);\n                return svc;\n            };\n            return ScriptVersionCache;\n        }());\n        ScriptVersionCache.changeNumberThreshold = 8;\n        ScriptVersionCache.changeLengthThreshold = 256;\n        ScriptVersionCache.maxVersions = 8;\n        server.ScriptVersionCache = ScriptVersionCache;\n        var LineIndexSnapshot = (function () {\n            function LineIndexSnapshot(version, cache) {\n                this.version = version;\n                this.cache = cache;\n                this.changesSincePreviousVersion = [];\n            }\n            LineIndexSnapshot.prototype.getText = function (rangeStart, rangeEnd) {\n                return this.index.getText(rangeStart, rangeEnd - rangeStart);\n            };\n            LineIndexSnapshot.prototype.getLength = function () {\n                return this.index.root.charCount();\n            };\n            LineIndexSnapshot.prototype.getLineStartPositions = function () {\n                var starts = [-1];\n                var count = 1;\n                var pos = 0;\n                this.index.every(function (ll) {\n                    starts[count] = pos;\n                    count++;\n                    pos += ll.text.length;\n                    return true;\n                }, 0);\n                return starts;\n            };\n            LineIndexSnapshot.prototype.getLineMapper = function () {\n                var _this = this;\n                return function (line) {\n                    return _this.index.lineNumberToInfo(line).offset;\n                };\n            };\n            LineIndexSnapshot.prototype.getTextChangeRangeSinceVersion = function (scriptVersion) {\n                if (this.version <= scriptVersion) {\n                    return ts.unchangedTextChangeRange;\n                }\n                else {\n                    return this.cache.getTextChangesBetweenVersions(scriptVersion, this.version);\n                }\n            };\n            LineIndexSnapshot.prototype.getChangeRange = function (oldSnapshot) {\n                var oldSnap = oldSnapshot;\n                return this.getTextChangeRangeSinceVersion(oldSnap.version);\n            };\n            return LineIndexSnapshot;\n        }());\n        server.LineIndexSnapshot = LineIndexSnapshot;\n        var LineIndex = (function () {\n            function LineIndex() {\n                this.checkEdits = false;\n            }\n            LineIndex.prototype.charOffsetToLineNumberAndPos = function (charOffset) {\n                return this.root.charOffsetToLineNumberAndPos(1, charOffset);\n            };\n            LineIndex.prototype.lineNumberToInfo = function (lineNumber) {\n                var lineCount = this.root.lineCount();\n                if (lineNumber <= lineCount) {\n                    var lineInfo = this.root.lineNumberToInfo(lineNumber, 0);\n                    lineInfo.line = lineNumber;\n                    return lineInfo;\n                }\n                else {\n                    return {\n                        line: lineNumber,\n                        offset: this.root.charCount()\n                    };\n                }\n            };\n            LineIndex.prototype.load = function (lines) {\n                if (lines.length > 0) {\n                    var leaves = [];\n                    for (var i = 0, len = lines.length; i < len; i++) {\n                        leaves[i] = new LineLeaf(lines[i]);\n                    }\n                    this.root = LineIndex.buildTreeFromBottom(leaves);\n                }\n                else {\n                    this.root = new LineNode();\n                }\n            };\n            LineIndex.prototype.walk = function (rangeStart, rangeLength, walkFns) {\n                this.root.walk(rangeStart, rangeLength, walkFns);\n            };\n            LineIndex.prototype.getText = function (rangeStart, rangeLength) {\n                var accum = \"\";\n                if ((rangeLength > 0) && (rangeStart < this.root.charCount())) {\n                    this.walk(rangeStart, rangeLength, {\n                        goSubtree: true,\n                        done: false,\n                        leaf: function (relativeStart, relativeLength, ll) {\n                            accum = accum.concat(ll.text.substring(relativeStart, relativeStart + relativeLength));\n                        }\n                    });\n                }\n                return accum;\n            };\n            LineIndex.prototype.getLength = function () {\n                return this.root.charCount();\n            };\n            LineIndex.prototype.every = function (f, rangeStart, rangeEnd) {\n                if (!rangeEnd) {\n                    rangeEnd = this.root.charCount();\n                }\n                var walkFns = {\n                    goSubtree: true,\n                    done: false,\n                    leaf: function (relativeStart, relativeLength, ll) {\n                        if (!f(ll, relativeStart, relativeLength)) {\n                            this.done = true;\n                        }\n                    }\n                };\n                this.walk(rangeStart, rangeEnd - rangeStart, walkFns);\n                return !walkFns.done;\n            };\n            LineIndex.prototype.edit = function (pos, deleteLength, newText) {\n                function editFlat(source, s, dl, nt) {\n                    if (nt === void 0) { nt = \"\"; }\n                    return source.substring(0, s) + nt + source.substring(s + dl, source.length);\n                }\n                if (this.root.charCount() === 0) {\n                    if (newText !== undefined) {\n                        this.load(LineIndex.linesFromText(newText).lines);\n                        return this;\n                    }\n                }\n                else {\n                    var checkText = void 0;\n                    if (this.checkEdits) {\n                        checkText = editFlat(this.getText(0, this.root.charCount()), pos, deleteLength, newText);\n                    }\n                    var walker = new EditWalker();\n                    if (pos >= this.root.charCount()) {\n                        pos = this.root.charCount() - 1;\n                        var endString = this.getText(pos, 1);\n                        if (newText) {\n                            newText = endString + newText;\n                        }\n                        else {\n                            newText = endString;\n                        }\n                        deleteLength = 0;\n                        walker.suppressTrailingText = true;\n                    }\n                    else if (deleteLength > 0) {\n                        var e = pos + deleteLength;\n                        var lineInfo = this.charOffsetToLineNumberAndPos(e);\n                        if ((lineInfo && (lineInfo.offset === 0))) {\n                            deleteLength += lineInfo.text.length;\n                            if (newText) {\n                                newText = newText + lineInfo.text;\n                            }\n                            else {\n                                newText = lineInfo.text;\n                            }\n                        }\n                    }\n                    if (pos < this.root.charCount()) {\n                        this.root.walk(pos, deleteLength, walker);\n                        walker.insertLines(newText);\n                    }\n                    if (this.checkEdits) {\n                        var updatedText = this.getText(0, this.root.charCount());\n                        ts.Debug.assert(checkText == updatedText, \"buffer edit mismatch\");\n                    }\n                    return walker.lineIndex;\n                }\n            };\n            LineIndex.buildTreeFromBottom = function (nodes) {\n                var nodeCount = Math.ceil(nodes.length / lineCollectionCapacity);\n                var interiorNodes = [];\n                var nodeIndex = 0;\n                for (var i = 0; i < nodeCount; i++) {\n                    interiorNodes[i] = new LineNode();\n                    var charCount = 0;\n                    var lineCount = 0;\n                    for (var j = 0; j < lineCollectionCapacity; j++) {\n                        if (nodeIndex < nodes.length) {\n                            interiorNodes[i].add(nodes[nodeIndex]);\n                            charCount += nodes[nodeIndex].charCount();\n                            lineCount += nodes[nodeIndex].lineCount();\n                        }\n                        else {\n                            break;\n                        }\n                        nodeIndex++;\n                    }\n                    interiorNodes[i].totalChars = charCount;\n                    interiorNodes[i].totalLines = lineCount;\n                }\n                if (interiorNodes.length === 1) {\n                    return interiorNodes[0];\n                }\n                else {\n                    return this.buildTreeFromBottom(interiorNodes);\n                }\n            };\n            LineIndex.linesFromText = function (text) {\n                var lineStarts = ts.computeLineStarts(text);\n                if (lineStarts.length === 0) {\n                    return { lines: [], lineMap: lineStarts };\n                }\n                var lines = new Array(lineStarts.length);\n                var lc = lineStarts.length - 1;\n                for (var lmi = 0; lmi < lc; lmi++) {\n                    lines[lmi] = text.substring(lineStarts[lmi], lineStarts[lmi + 1]);\n                }\n                var endText = text.substring(lineStarts[lc]);\n                if (endText.length > 0) {\n                    lines[lc] = endText;\n                }\n                else {\n                    lines.length--;\n                }\n                return { lines: lines, lineMap: lineStarts };\n            };\n            return LineIndex;\n        }());\n        server.LineIndex = LineIndex;\n        var LineNode = (function () {\n            function LineNode() {\n                this.totalChars = 0;\n                this.totalLines = 0;\n                this.children = [];\n            }\n            LineNode.prototype.isLeaf = function () {\n                return false;\n            };\n            LineNode.prototype.updateCounts = function () {\n                this.totalChars = 0;\n                this.totalLines = 0;\n                for (var i = 0, len = this.children.length; i < len; i++) {\n                    var child = this.children[i];\n                    this.totalChars += child.charCount();\n                    this.totalLines += child.lineCount();\n                }\n            };\n            LineNode.prototype.execWalk = function (rangeStart, rangeLength, walkFns, childIndex, nodeType) {\n                if (walkFns.pre) {\n                    walkFns.pre(rangeStart, rangeLength, this.children[childIndex], this, nodeType);\n                }\n                if (walkFns.goSubtree) {\n                    this.children[childIndex].walk(rangeStart, rangeLength, walkFns);\n                    if (walkFns.post) {\n                        walkFns.post(rangeStart, rangeLength, this.children[childIndex], this, nodeType);\n                    }\n                }\n                else {\n                    walkFns.goSubtree = true;\n                }\n                return walkFns.done;\n            };\n            LineNode.prototype.skipChild = function (relativeStart, relativeLength, childIndex, walkFns, nodeType) {\n                if (walkFns.pre && (!walkFns.done)) {\n                    walkFns.pre(relativeStart, relativeLength, this.children[childIndex], this, nodeType);\n                    walkFns.goSubtree = true;\n                }\n            };\n            LineNode.prototype.walk = function (rangeStart, rangeLength, walkFns) {\n                var childIndex = 0;\n                var child = this.children[0];\n                var childCharCount = child.charCount();\n                var adjustedStart = rangeStart;\n                while (adjustedStart >= childCharCount) {\n                    this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, CharRangeSection.PreStart);\n                    adjustedStart -= childCharCount;\n                    childIndex++;\n                    child = this.children[childIndex];\n                    childCharCount = child.charCount();\n                }\n                if ((adjustedStart + rangeLength) <= childCharCount) {\n                    if (this.execWalk(adjustedStart, rangeLength, walkFns, childIndex, CharRangeSection.Entire)) {\n                        return;\n                    }\n                }\n                else {\n                    if (this.execWalk(adjustedStart, childCharCount - adjustedStart, walkFns, childIndex, CharRangeSection.Start)) {\n                        return;\n                    }\n                    var adjustedLength = rangeLength - (childCharCount - adjustedStart);\n                    childIndex++;\n                    child = this.children[childIndex];\n                    childCharCount = child.charCount();\n                    while (adjustedLength > childCharCount) {\n                        if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) {\n                            return;\n                        }\n                        adjustedLength -= childCharCount;\n                        childIndex++;\n                        child = this.children[childIndex];\n                        childCharCount = child.charCount();\n                    }\n                    if (adjustedLength > 0) {\n                        if (this.execWalk(0, adjustedLength, walkFns, childIndex, CharRangeSection.End)) {\n                            return;\n                        }\n                    }\n                }\n                if (walkFns.pre) {\n                    var clen = this.children.length;\n                    if (childIndex < (clen - 1)) {\n                        for (var ej = childIndex + 1; ej < clen; ej++) {\n                            this.skipChild(0, 0, ej, walkFns, CharRangeSection.PostEnd);\n                        }\n                    }\n                }\n            };\n            LineNode.prototype.charOffsetToLineNumberAndPos = function (lineNumber, charOffset) {\n                var childInfo = this.childFromCharOffset(lineNumber, charOffset);\n                if (!childInfo.child) {\n                    return {\n                        line: lineNumber,\n                        offset: charOffset,\n                    };\n                }\n                else if (childInfo.childIndex < this.children.length) {\n                    if (childInfo.child.isLeaf()) {\n                        return {\n                            line: childInfo.lineNumber,\n                            offset: childInfo.charOffset,\n                            text: (childInfo.child).text,\n                            leaf: (childInfo.child)\n                        };\n                    }\n                    else {\n                        var lineNode = (childInfo.child);\n                        return lineNode.charOffsetToLineNumberAndPos(childInfo.lineNumber, childInfo.charOffset);\n                    }\n                }\n                else {\n                    var lineInfo = this.lineNumberToInfo(this.lineCount(), 0);\n                    return { line: this.lineCount(), offset: lineInfo.leaf.charCount() };\n                }\n            };\n            LineNode.prototype.lineNumberToInfo = function (lineNumber, charOffset) {\n                var childInfo = this.childFromLineNumber(lineNumber, charOffset);\n                if (!childInfo.child) {\n                    return {\n                        line: lineNumber,\n                        offset: charOffset\n                    };\n                }\n                else if (childInfo.child.isLeaf()) {\n                    return {\n                        line: lineNumber,\n                        offset: childInfo.charOffset,\n                        text: (childInfo.child).text,\n                        leaf: (childInfo.child)\n                    };\n                }\n                else {\n                    var lineNode = (childInfo.child);\n                    return lineNode.lineNumberToInfo(childInfo.relativeLineNumber, childInfo.charOffset);\n                }\n            };\n            LineNode.prototype.childFromLineNumber = function (lineNumber, charOffset) {\n                var child;\n                var relativeLineNumber = lineNumber;\n                var i;\n                var len;\n                for (i = 0, len = this.children.length; i < len; i++) {\n                    child = this.children[i];\n                    var childLineCount = child.lineCount();\n                    if (childLineCount >= relativeLineNumber) {\n                        break;\n                    }\n                    else {\n                        relativeLineNumber -= childLineCount;\n                        charOffset += child.charCount();\n                    }\n                }\n                return {\n                    child: child,\n                    childIndex: i,\n                    relativeLineNumber: relativeLineNumber,\n                    charOffset: charOffset\n                };\n            };\n            LineNode.prototype.childFromCharOffset = function (lineNumber, charOffset) {\n                var child;\n                var i;\n                var len;\n                for (i = 0, len = this.children.length; i < len; i++) {\n                    child = this.children[i];\n                    if (child.charCount() > charOffset) {\n                        break;\n                    }\n                    else {\n                        charOffset -= child.charCount();\n                        lineNumber += child.lineCount();\n                    }\n                }\n                return {\n                    child: child,\n                    childIndex: i,\n                    charOffset: charOffset,\n                    lineNumber: lineNumber\n                };\n            };\n            LineNode.prototype.splitAfter = function (childIndex) {\n                var splitNode;\n                var clen = this.children.length;\n                childIndex++;\n                var endLength = childIndex;\n                if (childIndex < clen) {\n                    splitNode = new LineNode();\n                    while (childIndex < clen) {\n                        splitNode.add(this.children[childIndex]);\n                        childIndex++;\n                    }\n                    splitNode.updateCounts();\n                }\n                this.children.length = endLength;\n                return splitNode;\n            };\n            LineNode.prototype.remove = function (child) {\n                var childIndex = this.findChildIndex(child);\n                var clen = this.children.length;\n                if (childIndex < (clen - 1)) {\n                    for (var i = childIndex; i < (clen - 1); i++) {\n                        this.children[i] = this.children[i + 1];\n                    }\n                }\n                this.children.length--;\n            };\n            LineNode.prototype.findChildIndex = function (child) {\n                var childIndex = 0;\n                var clen = this.children.length;\n                while ((this.children[childIndex] !== child) && (childIndex < clen))\n                    childIndex++;\n                return childIndex;\n            };\n            LineNode.prototype.insertAt = function (child, nodes) {\n                var childIndex = this.findChildIndex(child);\n                var clen = this.children.length;\n                var nodeCount = nodes.length;\n                if ((clen < lineCollectionCapacity) && (childIndex === (clen - 1)) && (nodeCount === 1)) {\n                    this.add(nodes[0]);\n                    this.updateCounts();\n                    return [];\n                }\n                else {\n                    var shiftNode = this.splitAfter(childIndex);\n                    var nodeIndex = 0;\n                    childIndex++;\n                    while ((childIndex < lineCollectionCapacity) && (nodeIndex < nodeCount)) {\n                        this.children[childIndex] = nodes[nodeIndex];\n                        childIndex++;\n                        nodeIndex++;\n                    }\n                    var splitNodes = [];\n                    var splitNodeCount = 0;\n                    if (nodeIndex < nodeCount) {\n                        splitNodeCount = Math.ceil((nodeCount - nodeIndex) / lineCollectionCapacity);\n                        splitNodes = new Array(splitNodeCount);\n                        var splitNodeIndex = 0;\n                        for (var i = 0; i < splitNodeCount; i++) {\n                            splitNodes[i] = new LineNode();\n                        }\n                        var splitNode = splitNodes[0];\n                        while (nodeIndex < nodeCount) {\n                            splitNode.add(nodes[nodeIndex]);\n                            nodeIndex++;\n                            if (splitNode.children.length === lineCollectionCapacity) {\n                                splitNodeIndex++;\n                                splitNode = splitNodes[splitNodeIndex];\n                            }\n                        }\n                        for (var i = splitNodes.length - 1; i >= 0; i--) {\n                            if (splitNodes[i].children.length === 0) {\n                                splitNodes.length--;\n                            }\n                        }\n                    }\n                    if (shiftNode) {\n                        splitNodes[splitNodes.length] = shiftNode;\n                    }\n                    this.updateCounts();\n                    for (var i = 0; i < splitNodeCount; i++) {\n                        splitNodes[i].updateCounts();\n                    }\n                    return splitNodes;\n                }\n            };\n            LineNode.prototype.add = function (collection) {\n                this.children[this.children.length] = collection;\n                return (this.children.length < lineCollectionCapacity);\n            };\n            LineNode.prototype.charCount = function () {\n                return this.totalChars;\n            };\n            LineNode.prototype.lineCount = function () {\n                return this.totalLines;\n            };\n            return LineNode;\n        }());\n        server.LineNode = LineNode;\n        var LineLeaf = (function () {\n            function LineLeaf(text) {\n                this.text = text;\n            }\n            LineLeaf.prototype.isLeaf = function () {\n                return true;\n            };\n            LineLeaf.prototype.walk = function (rangeStart, rangeLength, walkFns) {\n                walkFns.leaf(rangeStart, rangeLength, this);\n            };\n            LineLeaf.prototype.charCount = function () {\n                return this.text.length;\n            };\n            LineLeaf.prototype.lineCount = function () {\n                return 1;\n            };\n            return LineLeaf;\n        }());\n        server.LineLeaf = LineLeaf;\n    })(server = ts.server || (ts.server = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var server;\n    (function (server) {\n        var net = require(\"net\");\n        var childProcess = require(\"child_process\");\n        var os = require(\"os\");\n        function getGlobalTypingsCacheLocation() {\n            var basePath;\n            switch (process.platform) {\n                case \"win32\":\n                    basePath = process.env.LOCALAPPDATA ||\n                        process.env.APPDATA ||\n                        (os.homedir && os.homedir()) ||\n                        process.env.USERPROFILE ||\n                        (process.env.HOMEDRIVE && process.env.HOMEPATH && ts.normalizeSlashes(process.env.HOMEDRIVE + process.env.HOMEPATH)) ||\n                        os.tmpdir();\n                    break;\n                case \"linux\":\n                case \"android\":\n                    basePath = (os.homedir && os.homedir()) ||\n                        process.env.HOME ||\n                        ((process.env.LOGNAME || process.env.USER) && \"/home/\" + (process.env.LOGNAME || process.env.USER)) ||\n                        os.tmpdir();\n                    break;\n                case \"darwin\":\n                    var homeDir = (os.homedir && os.homedir()) ||\n                        process.env.HOME ||\n                        ((process.env.LOGNAME || process.env.USER) && \"/Users/\" + (process.env.LOGNAME || process.env.USER)) ||\n                        os.tmpdir();\n                    basePath = ts.combinePaths(homeDir, \"Library/Application Support/\");\n                    break;\n            }\n            ts.Debug.assert(basePath !== undefined);\n            return ts.combinePaths(ts.normalizeSlashes(basePath), \"Microsoft/TypeScript\");\n        }\n        var readline = require(\"readline\");\n        var fs = require(\"fs\");\n        var rl = readline.createInterface({\n            input: process.stdin,\n            output: process.stdout,\n            terminal: false,\n        });\n        var Logger = (function () {\n            function Logger(logFilename, traceToConsole, level) {\n                this.logFilename = logFilename;\n                this.traceToConsole = traceToConsole;\n                this.level = level;\n                this.fd = -1;\n                this.seq = 0;\n                this.inGroup = false;\n                this.firstInGroup = true;\n            }\n            Logger.padStringRight = function (str, padding) {\n                return (str + padding).slice(0, padding.length);\n            };\n            Logger.prototype.close = function () {\n                if (this.fd >= 0) {\n                    fs.close(this.fd);\n                }\n            };\n            Logger.prototype.getLogFileName = function () {\n                return this.logFilename;\n            };\n            Logger.prototype.perftrc = function (s) {\n                this.msg(s, server.Msg.Perf);\n            };\n            Logger.prototype.info = function (s) {\n                this.msg(s, server.Msg.Info);\n            };\n            Logger.prototype.startGroup = function () {\n                this.inGroup = true;\n                this.firstInGroup = true;\n            };\n            Logger.prototype.endGroup = function () {\n                this.inGroup = false;\n                this.seq++;\n                this.firstInGroup = true;\n            };\n            Logger.prototype.loggingEnabled = function () {\n                return !!this.logFilename || this.traceToConsole;\n            };\n            Logger.prototype.hasLevel = function (level) {\n                return this.loggingEnabled() && this.level >= level;\n            };\n            Logger.prototype.msg = function (s, type) {\n                if (type === void 0) { type = server.Msg.Err; }\n                if (this.fd < 0) {\n                    if (this.logFilename) {\n                        this.fd = fs.openSync(this.logFilename, \"w\");\n                    }\n                }\n                if (this.fd >= 0 || this.traceToConsole) {\n                    s = s + \"\\n\";\n                    var prefix = Logger.padStringRight(type + \" \" + this.seq.toString(), \"          \");\n                    if (this.firstInGroup) {\n                        s = prefix + s;\n                        this.firstInGroup = false;\n                    }\n                    if (!this.inGroup) {\n                        this.seq++;\n                        this.firstInGroup = true;\n                    }\n                    if (this.fd >= 0) {\n                        var buf = new Buffer(s);\n                        fs.writeSync(this.fd, buf, 0, buf.length, null);\n                    }\n                    if (this.traceToConsole) {\n                        console.warn(s);\n                    }\n                }\n            };\n            return Logger;\n        }());\n        var NodeTypingsInstaller = (function () {\n            function NodeTypingsInstaller(telemetryEnabled, logger, host, eventPort, globalTypingsCacheLocation, newLine) {\n                var _this = this;\n                this.telemetryEnabled = telemetryEnabled;\n                this.logger = logger;\n                this.globalTypingsCacheLocation = globalTypingsCacheLocation;\n                this.newLine = newLine;\n                this.installerPidReported = false;\n                this.throttledOperations = new server.ThrottledOperations(host);\n                if (eventPort) {\n                    var s_1 = net.connect({ port: eventPort }, function () {\n                        _this.socket = s_1;\n                        _this.reportInstallerProcessId();\n                    });\n                }\n            }\n            NodeTypingsInstaller.prototype.reportInstallerProcessId = function () {\n                if (this.installerPidReported) {\n                    return;\n                }\n                if (this.socket && this.installer) {\n                    this.sendEvent(0, \"typingsInstallerPid\", { pid: this.installer.pid });\n                    this.installerPidReported = true;\n                }\n            };\n            NodeTypingsInstaller.prototype.sendEvent = function (seq, event, body) {\n                this.socket.write(server.formatMessage({ seq: seq, type: \"event\", event: event, body: body }, this.logger, Buffer.byteLength, this.newLine), \"utf8\");\n            };\n            NodeTypingsInstaller.prototype.setTelemetrySender = function (telemetrySender) {\n                this.eventSender = telemetrySender;\n            };\n            NodeTypingsInstaller.prototype.attach = function (projectService) {\n                var _this = this;\n                this.projectService = projectService;\n                if (this.logger.hasLevel(server.LogLevel.requestTime)) {\n                    this.logger.info(\"Binding...\");\n                }\n                var args = [server.Arguments.GlobalCacheLocation, this.globalTypingsCacheLocation];\n                if (this.telemetryEnabled) {\n                    args.push(server.Arguments.EnableTelemetry);\n                }\n                if (this.logger.loggingEnabled() && this.logger.getLogFileName()) {\n                    args.push(server.Arguments.LogFile, ts.combinePaths(ts.getDirectoryPath(ts.normalizeSlashes(this.logger.getLogFileName())), \"ti-\" + process.pid + \".log\"));\n                }\n                var execArgv = [];\n                {\n                    for (var _i = 0, _a = process.execArgv; _i < _a.length; _i++) {\n                        var arg = _a[_i];\n                        var match = /^--(debug|inspect)(=(\\d+))?$/.exec(arg);\n                        if (match) {\n                            var currentPort = match[3] !== undefined\n                                ? +match[3]\n                                : match[1] === \"debug\" ? 5858 : 9229;\n                            execArgv.push(\"--\" + match[1] + \"=\" + (currentPort + 1));\n                            break;\n                        }\n                    }\n                }\n                this.installer = childProcess.fork(ts.combinePaths(__dirname, \"typingsInstaller.js\"), args, { execArgv: execArgv });\n                this.installer.on(\"message\", function (m) { return _this.handleMessage(m); });\n                this.reportInstallerProcessId();\n                process.on(\"exit\", function () {\n                    _this.installer.kill();\n                });\n            };\n            NodeTypingsInstaller.prototype.onProjectClosed = function (p) {\n                this.installer.send({ projectName: p.getProjectName(), kind: \"closeProject\" });\n            };\n            NodeTypingsInstaller.prototype.enqueueInstallTypingsRequest = function (project, typeAcquisition, unresolvedImports) {\n                var _this = this;\n                var request = server.createInstallTypingsRequest(project, typeAcquisition, unresolvedImports);\n                if (this.logger.hasLevel(server.LogLevel.verbose)) {\n                    if (this.logger.hasLevel(server.LogLevel.verbose)) {\n                        this.logger.info(\"Scheduling throttled operation: \" + JSON.stringify(request));\n                    }\n                }\n                this.throttledOperations.schedule(project.getProjectName(), 250, function () {\n                    if (_this.logger.hasLevel(server.LogLevel.verbose)) {\n                        _this.logger.info(\"Sending request: \" + JSON.stringify(request));\n                    }\n                    _this.installer.send(request);\n                });\n            };\n            NodeTypingsInstaller.prototype.handleMessage = function (response) {\n                if (this.logger.hasLevel(server.LogLevel.verbose)) {\n                    this.logger.info(\"Received response: \" + JSON.stringify(response));\n                }\n                if (response.kind === server.EventBeginInstallTypes) {\n                    if (!this.eventSender) {\n                        return;\n                    }\n                    var body = {\n                        eventId: response.eventId,\n                        packages: response.packagesToInstall,\n                    };\n                    var eventName = \"beginInstallTypes\";\n                    this.eventSender.event(body, eventName);\n                    return;\n                }\n                if (response.kind === server.EventEndInstallTypes) {\n                    if (!this.eventSender) {\n                        return;\n                    }\n                    if (this.telemetryEnabled) {\n                        var body_1 = {\n                            telemetryEventName: \"typingsInstalled\",\n                            payload: {\n                                installedPackages: response.packagesToInstall.join(\",\"),\n                                installSuccess: response.installSuccess,\n                                typingsInstallerVersion: response.typingsInstallerVersion\n                            }\n                        };\n                        var eventName_1 = \"telemetry\";\n                        this.eventSender.event(body_1, eventName_1);\n                    }\n                    var body = {\n                        eventId: response.eventId,\n                        packages: response.packagesToInstall,\n                        success: response.installSuccess,\n                    };\n                    var eventName = \"endInstallTypes\";\n                    this.eventSender.event(body, eventName);\n                    return;\n                }\n                this.projectService.updateTypingsForProject(response);\n                if (response.kind == server.ActionSet && this.socket) {\n                    this.sendEvent(0, \"setTypings\", response);\n                }\n            };\n            return NodeTypingsInstaller;\n        }());\n        var IOSession = (function (_super) {\n            __extends(IOSession, _super);\n            function IOSession(host, cancellationToken, installerEventPort, canUseEvents, useSingleInferredProject, disableAutomaticTypingAcquisition, globalTypingsCacheLocation, telemetryEnabled, logger) {\n                var _this;\n                var typingsInstaller = disableAutomaticTypingAcquisition\n                    ? undefined\n                    : new NodeTypingsInstaller(telemetryEnabled, logger, host, installerEventPort, globalTypingsCacheLocation, host.newLine);\n                _this = _super.call(this, host, cancellationToken, useSingleInferredProject, typingsInstaller || server.nullTypingsInstaller, Buffer.byteLength, process.hrtime, logger, canUseEvents) || this;\n                if (telemetryEnabled && typingsInstaller) {\n                    typingsInstaller.setTelemetrySender(_this);\n                }\n                return _this;\n            }\n            IOSession.prototype.exit = function () {\n                this.logger.info(\"Exiting...\");\n                this.projectService.closeLog();\n                process.exit(0);\n            };\n            IOSession.prototype.listen = function () {\n                var _this = this;\n                rl.on(\"line\", function (input) {\n                    var message = input.trim();\n                    _this.onMessage(message);\n                });\n                rl.on(\"close\", function () {\n                    _this.exit();\n                });\n            };\n            return IOSession;\n        }(server.Session));\n        function parseLoggingEnvironmentString(logEnvStr) {\n            var logEnv = { logToFile: true };\n            var args = logEnvStr.split(\" \");\n            for (var i = 0, len = args.length; i < (len - 1); i += 2) {\n                var option = args[i];\n                var value = args[i + 1];\n                if (option && value) {\n                    switch (option) {\n                        case \"-file\":\n                            logEnv.file = ts.stripQuotes(value);\n                            break;\n                        case \"-level\":\n                            var level = server.LogLevel[value];\n                            logEnv.detailLevel = typeof level === \"number\" ? level : server.LogLevel.normal;\n                            break;\n                        case \"-traceToConsole\":\n                            logEnv.traceToConsole = value.toLowerCase() === \"true\";\n                            break;\n                        case \"-logToFile\":\n                            logEnv.logToFile = value.toLowerCase() === \"true\";\n                            break;\n                    }\n                }\n            }\n            return logEnv;\n        }\n        function createLoggerFromEnv() {\n            var fileName = undefined;\n            var detailLevel = server.LogLevel.normal;\n            var traceToConsole = false;\n            var logEnvStr = process.env[\"TSS_LOG\"];\n            if (logEnvStr) {\n                var logEnv = parseLoggingEnvironmentString(logEnvStr);\n                if (logEnv.logToFile) {\n                    if (logEnv.file) {\n                        fileName = logEnv.file;\n                    }\n                    else {\n                        fileName = __dirname + \"/.log\" + process.pid.toString();\n                    }\n                }\n                if (logEnv.detailLevel) {\n                    detailLevel = logEnv.detailLevel;\n                }\n                traceToConsole = logEnv.traceToConsole;\n            }\n            return new Logger(fileName, traceToConsole, detailLevel);\n        }\n        function createPollingWatchedFileSet(interval, chunkSize) {\n            if (interval === void 0) { interval = 2500; }\n            if (chunkSize === void 0) { chunkSize = 30; }\n            var watchedFiles = [];\n            var nextFileToCheck = 0;\n            var watchTimer;\n            function getModifiedTime(fileName) {\n                return fs.statSync(fileName).mtime;\n            }\n            function poll(checkedIndex) {\n                var watchedFile = watchedFiles[checkedIndex];\n                if (!watchedFile) {\n                    return;\n                }\n                fs.stat(watchedFile.fileName, function (err, stats) {\n                    if (err) {\n                        watchedFile.callback(watchedFile.fileName);\n                    }\n                    else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) {\n                        watchedFile.mtime = getModifiedTime(watchedFile.fileName);\n                        watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0);\n                    }\n                });\n            }\n            function startWatchTimer() {\n                watchTimer = setInterval(function () {\n                    var count = 0;\n                    var nextToCheck = nextFileToCheck;\n                    var firstCheck = -1;\n                    while ((count < chunkSize) && (nextToCheck !== firstCheck)) {\n                        poll(nextToCheck);\n                        if (firstCheck < 0) {\n                            firstCheck = nextToCheck;\n                        }\n                        nextToCheck++;\n                        if (nextToCheck === watchedFiles.length) {\n                            nextToCheck = 0;\n                        }\n                        count++;\n                    }\n                    nextFileToCheck = nextToCheck;\n                }, interval);\n            }\n            function addFile(fileName, callback) {\n                var file = {\n                    fileName: fileName,\n                    callback: callback,\n                    mtime: getModifiedTime(fileName)\n                };\n                watchedFiles.push(file);\n                if (watchedFiles.length === 1) {\n                    startWatchTimer();\n                }\n                return file;\n            }\n            function removeFile(file) {\n                ts.unorderedRemoveItem(watchedFiles, file);\n            }\n            return {\n                getModifiedTime: getModifiedTime,\n                poll: poll,\n                startWatchTimer: startWatchTimer,\n                addFile: addFile,\n                removeFile: removeFile\n            };\n        }\n        var pollingWatchedFileSet = createPollingWatchedFileSet();\n        var logger = createLoggerFromEnv();\n        var pending = [];\n        var canWrite = true;\n        function writeMessage(buf) {\n            if (!canWrite) {\n                pending.push(buf);\n            }\n            else {\n                canWrite = false;\n                process.stdout.write(buf, setCanWriteFlagAndWriteMessageIfNecessary);\n            }\n        }\n        function setCanWriteFlagAndWriteMessageIfNecessary() {\n            canWrite = true;\n            if (pending.length) {\n                writeMessage(pending.shift());\n            }\n        }\n        var sys = ts.sys;\n        sys.write = function (s) { return writeMessage(new Buffer(s, \"utf8\")); };\n        sys.watchFile = function (fileName, callback) {\n            var watchedFile = pollingWatchedFileSet.addFile(fileName, callback);\n            return {\n                close: function () { return pollingWatchedFileSet.removeFile(watchedFile); }\n            };\n        };\n        sys.setTimeout = setTimeout;\n        sys.clearTimeout = clearTimeout;\n        sys.setImmediate = setImmediate;\n        sys.clearImmediate = clearImmediate;\n        if (typeof global !== \"undefined\" && global.gc) {\n            sys.gc = function () { return global.gc(); };\n        }\n        var cancellationToken;\n        try {\n            var factory = require(\"./cancellationToken\");\n            cancellationToken = factory(sys.args);\n        }\n        catch (e) {\n            cancellationToken = {\n                isCancellationRequested: function () { return false; }\n            };\n        }\n        ;\n        var eventPort;\n        {\n            var str = server.findArgument(\"--eventPort\");\n            var v = str && parseInt(str);\n            if (!isNaN(v)) {\n                eventPort = v;\n            }\n        }\n        var localeStr = server.findArgument(\"--locale\");\n        if (localeStr) {\n            ts.validateLocaleAndSetLanguage(localeStr, sys);\n        }\n        var useSingleInferredProject = server.hasArgument(\"--useSingleInferredProject\");\n        var disableAutomaticTypingAcquisition = server.hasArgument(\"--disableAutomaticTypingAcquisition\");\n        var telemetryEnabled = server.hasArgument(server.Arguments.EnableTelemetry);\n        var ioSession = new IOSession(sys, cancellationToken, eventPort, eventPort === undefined, useSingleInferredProject, disableAutomaticTypingAcquisition, getGlobalTypingsCacheLocation(), telemetryEnabled, logger);\n        process.on(\"uncaughtException\", function (err) {\n            ioSession.logError(err, \"unknown\");\n        });\n        process.noAsar = true;\n        ioSession.listen();\n    })(server = ts.server || (ts.server = {}));\n})(ts || (ts = {}));\nvar debugObjectHost = (function () { return this; })();\nvar ts;\n(function (ts) {\n    function logInternalError(logger, err) {\n        if (logger) {\n            logger.log(\"*INTERNAL ERROR* - Exception in typescript services: \" + err.message);\n        }\n    }\n    var ScriptSnapshotShimAdapter = (function () {\n        function ScriptSnapshotShimAdapter(scriptSnapshotShim) {\n            this.scriptSnapshotShim = scriptSnapshotShim;\n        }\n        ScriptSnapshotShimAdapter.prototype.getText = function (start, end) {\n            return this.scriptSnapshotShim.getText(start, end);\n        };\n        ScriptSnapshotShimAdapter.prototype.getLength = function () {\n            return this.scriptSnapshotShim.getLength();\n        };\n        ScriptSnapshotShimAdapter.prototype.getChangeRange = function (oldSnapshot) {\n            var oldSnapshotShim = oldSnapshot;\n            var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim);\n            if (encoded == null) {\n                return null;\n            }\n            var decoded = JSON.parse(encoded);\n            return ts.createTextChangeRange(ts.createTextSpan(decoded.span.start, decoded.span.length), decoded.newLength);\n        };\n        ScriptSnapshotShimAdapter.prototype.dispose = function () {\n            if (\"dispose\" in this.scriptSnapshotShim) {\n                this.scriptSnapshotShim.dispose();\n            }\n        };\n        return ScriptSnapshotShimAdapter;\n    }());\n    var LanguageServiceShimHostAdapter = (function () {\n        function LanguageServiceShimHostAdapter(shimHost) {\n            var _this = this;\n            this.shimHost = shimHost;\n            this.loggingEnabled = false;\n            this.tracingEnabled = false;\n            if (\"getModuleResolutionsForFile\" in this.shimHost) {\n                this.resolveModuleNames = function (moduleNames, containingFile) {\n                    var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile));\n                    return ts.map(moduleNames, function (name) {\n                        var result = ts.getProperty(resolutionsInFile, name);\n                        return result ? { resolvedFileName: result, extension: ts.extensionFromPath(result), isExternalLibraryImport: false } : undefined;\n                    });\n                };\n            }\n            if (\"directoryExists\" in this.shimHost) {\n                this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); };\n            }\n            if (\"getTypeReferenceDirectiveResolutionsForFile\" in this.shimHost) {\n                this.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) {\n                    var typeDirectivesForFile = JSON.parse(_this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile));\n                    return ts.map(typeDirectiveNames, function (name) { return ts.getProperty(typeDirectivesForFile, name); });\n                };\n            }\n        }\n        LanguageServiceShimHostAdapter.prototype.log = function (s) {\n            if (this.loggingEnabled) {\n                this.shimHost.log(s);\n            }\n        };\n        LanguageServiceShimHostAdapter.prototype.trace = function (s) {\n            if (this.tracingEnabled) {\n                this.shimHost.trace(s);\n            }\n        };\n        LanguageServiceShimHostAdapter.prototype.error = function (s) {\n            this.shimHost.error(s);\n        };\n        LanguageServiceShimHostAdapter.prototype.getProjectVersion = function () {\n            if (!this.shimHost.getProjectVersion) {\n                return undefined;\n            }\n            return this.shimHost.getProjectVersion();\n        };\n        LanguageServiceShimHostAdapter.prototype.getTypeRootsVersion = function () {\n            if (!this.shimHost.getTypeRootsVersion) {\n                return 0;\n            }\n            return this.shimHost.getTypeRootsVersion();\n        };\n        LanguageServiceShimHostAdapter.prototype.useCaseSensitiveFileNames = function () {\n            return this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false;\n        };\n        LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () {\n            var settingsJson = this.shimHost.getCompilationSettings();\n            if (settingsJson == null || settingsJson == \"\") {\n                throw Error(\"LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings\");\n            }\n            return JSON.parse(settingsJson);\n        };\n        LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () {\n            var encoded = this.shimHost.getScriptFileNames();\n            return this.files = JSON.parse(encoded);\n        };\n        LanguageServiceShimHostAdapter.prototype.getScriptSnapshot = function (fileName) {\n            var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName);\n            return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot);\n        };\n        LanguageServiceShimHostAdapter.prototype.getScriptKind = function (fileName) {\n            if (\"getScriptKind\" in this.shimHost) {\n                return this.shimHost.getScriptKind(fileName);\n            }\n            else {\n                return 0;\n            }\n        };\n        LanguageServiceShimHostAdapter.prototype.getScriptVersion = function (fileName) {\n            return this.shimHost.getScriptVersion(fileName);\n        };\n        LanguageServiceShimHostAdapter.prototype.getLocalizedDiagnosticMessages = function () {\n            var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages();\n            if (diagnosticMessagesJson == null || diagnosticMessagesJson == \"\") {\n                return null;\n            }\n            try {\n                return JSON.parse(diagnosticMessagesJson);\n            }\n            catch (e) {\n                this.log(e.description || \"diagnosticMessages.generated.json has invalid JSON format\");\n                return null;\n            }\n        };\n        LanguageServiceShimHostAdapter.prototype.getCancellationToken = function () {\n            var hostCancellationToken = this.shimHost.getCancellationToken();\n            return new ThrottledCancellationToken(hostCancellationToken);\n        };\n        LanguageServiceShimHostAdapter.prototype.getCurrentDirectory = function () {\n            return this.shimHost.getCurrentDirectory();\n        };\n        LanguageServiceShimHostAdapter.prototype.getDirectories = function (path) {\n            return JSON.parse(this.shimHost.getDirectories(path));\n        };\n        LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) {\n            return this.shimHost.getDefaultLibFileName(JSON.stringify(options));\n        };\n        LanguageServiceShimHostAdapter.prototype.readDirectory = function (path, extensions, exclude, include, depth) {\n            var pattern = ts.getFileMatcherPatterns(path, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory());\n            return JSON.parse(this.shimHost.readDirectory(path, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth));\n        };\n        LanguageServiceShimHostAdapter.prototype.readFile = function (path, encoding) {\n            return this.shimHost.readFile(path, encoding);\n        };\n        LanguageServiceShimHostAdapter.prototype.fileExists = function (path) {\n            return this.shimHost.fileExists(path);\n        };\n        return LanguageServiceShimHostAdapter;\n    }());\n    ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter;\n    var ThrottledCancellationToken = (function () {\n        function ThrottledCancellationToken(hostCancellationToken) {\n            this.hostCancellationToken = hostCancellationToken;\n            this.lastCancellationCheckTime = 0;\n        }\n        ThrottledCancellationToken.prototype.isCancellationRequested = function () {\n            var time = ts.timestamp();\n            var duration = Math.abs(time - this.lastCancellationCheckTime);\n            if (duration > 10) {\n                this.lastCancellationCheckTime = time;\n                return this.hostCancellationToken.isCancellationRequested();\n            }\n            return false;\n        };\n        return ThrottledCancellationToken;\n    }());\n    var CoreServicesShimHostAdapter = (function () {\n        function CoreServicesShimHostAdapter(shimHost) {\n            var _this = this;\n            this.shimHost = shimHost;\n            this.useCaseSensitiveFileNames = this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false;\n            if (\"directoryExists\" in this.shimHost) {\n                this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); };\n            }\n            if (\"realpath\" in this.shimHost) {\n                this.realpath = function (path) { return _this.shimHost.realpath(path); };\n            }\n        }\n        CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extensions, exclude, include, depth) {\n            try {\n                var pattern = ts.getFileMatcherPatterns(rootDir, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory());\n                return JSON.parse(this.shimHost.readDirectory(rootDir, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth));\n            }\n            catch (e) {\n                var results = [];\n                for (var _i = 0, extensions_2 = extensions; _i < extensions_2.length; _i++) {\n                    var extension = extensions_2[_i];\n                    for (var _a = 0, _b = this.readDirectoryFallback(rootDir, extension, exclude); _a < _b.length; _a++) {\n                        var file = _b[_a];\n                        if (!ts.contains(results, file)) {\n                            results.push(file);\n                        }\n                    }\n                }\n                return results;\n            }\n        };\n        CoreServicesShimHostAdapter.prototype.fileExists = function (fileName) {\n            return this.shimHost.fileExists(fileName);\n        };\n        CoreServicesShimHostAdapter.prototype.readFile = function (fileName) {\n            return this.shimHost.readFile(fileName);\n        };\n        CoreServicesShimHostAdapter.prototype.readDirectoryFallback = function (rootDir, extension, exclude) {\n            return JSON.parse(this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)));\n        };\n        CoreServicesShimHostAdapter.prototype.getDirectories = function (path) {\n            return JSON.parse(this.shimHost.getDirectories(path));\n        };\n        return CoreServicesShimHostAdapter;\n    }());\n    ts.CoreServicesShimHostAdapter = CoreServicesShimHostAdapter;\n    function simpleForwardCall(logger, actionDescription, action, logPerformance) {\n        var start;\n        if (logPerformance) {\n            logger.log(actionDescription);\n            start = ts.timestamp();\n        }\n        var result = action();\n        if (logPerformance) {\n            var end = ts.timestamp();\n            logger.log(actionDescription + \" completed in \" + (end - start) + \" msec\");\n            if (typeof result === \"string\") {\n                var str = result;\n                if (str.length > 128) {\n                    str = str.substring(0, 128) + \"...\";\n                }\n                logger.log(\"  result.length=\" + str.length + \", result='\" + JSON.stringify(str) + \"'\");\n            }\n        }\n        return result;\n    }\n    function forwardJSONCall(logger, actionDescription, action, logPerformance) {\n        return forwardCall(logger, actionDescription, true, action, logPerformance);\n    }\n    function forwardCall(logger, actionDescription, returnJson, action, logPerformance) {\n        try {\n            var result = simpleForwardCall(logger, actionDescription, action, logPerformance);\n            return returnJson ? JSON.stringify({ result: result }) : result;\n        }\n        catch (err) {\n            if (err instanceof ts.OperationCanceledException) {\n                return JSON.stringify({ canceled: true });\n            }\n            logInternalError(logger, err);\n            err.description = actionDescription;\n            return JSON.stringify({ error: err });\n        }\n    }\n    var ShimBase = (function () {\n        function ShimBase(factory) {\n            this.factory = factory;\n            factory.registerShim(this);\n        }\n        ShimBase.prototype.dispose = function (_dummy) {\n            this.factory.unregisterShim(this);\n        };\n        return ShimBase;\n    }());\n    function realizeDiagnostics(diagnostics, newLine) {\n        return diagnostics.map(function (d) { return realizeDiagnostic(d, newLine); });\n    }\n    ts.realizeDiagnostics = realizeDiagnostics;\n    function realizeDiagnostic(diagnostic, newLine) {\n        return {\n            message: ts.flattenDiagnosticMessageText(diagnostic.messageText, newLine),\n            start: diagnostic.start,\n            length: diagnostic.length,\n            category: ts.DiagnosticCategory[diagnostic.category].toLowerCase(),\n            code: diagnostic.code\n        };\n    }\n    var LanguageServiceShimObject = (function (_super) {\n        __extends(LanguageServiceShimObject, _super);\n        function LanguageServiceShimObject(factory, host, languageService) {\n            var _this = _super.call(this, factory) || this;\n            _this.host = host;\n            _this.languageService = languageService;\n            _this.logPerformance = false;\n            _this.logger = _this.host;\n            return _this;\n        }\n        LanguageServiceShimObject.prototype.forwardJSONCall = function (actionDescription, action) {\n            return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance);\n        };\n        LanguageServiceShimObject.prototype.dispose = function (dummy) {\n            this.logger.log(\"dispose()\");\n            this.languageService.dispose();\n            this.languageService = null;\n            if (debugObjectHost && debugObjectHost.CollectGarbage) {\n                debugObjectHost.CollectGarbage();\n                this.logger.log(\"CollectGarbage()\");\n            }\n            this.logger = null;\n            _super.prototype.dispose.call(this, dummy);\n        };\n        LanguageServiceShimObject.prototype.refresh = function (throwOnError) {\n            this.forwardJSONCall(\"refresh(\" + throwOnError + \")\", function () { return null; });\n        };\n        LanguageServiceShimObject.prototype.cleanupSemanticCache = function () {\n            var _this = this;\n            this.forwardJSONCall(\"cleanupSemanticCache()\", function () {\n                _this.languageService.cleanupSemanticCache();\n                return null;\n            });\n        };\n        LanguageServiceShimObject.prototype.realizeDiagnostics = function (diagnostics) {\n            var newLine = ts.getNewLineOrDefaultFromHost(this.host);\n            return ts.realizeDiagnostics(diagnostics, newLine);\n        };\n        LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) {\n            var _this = this;\n            return this.forwardJSONCall(\"getSyntacticClassifications('\" + fileName + \"', \" + start + \", \" + length + \")\", function () { return _this.languageService.getSyntacticClassifications(fileName, ts.createTextSpan(start, length)); });\n        };\n        LanguageServiceShimObject.prototype.getSemanticClassifications = function (fileName, start, length) {\n            var _this = this;\n            return this.forwardJSONCall(\"getSemanticClassifications('\" + fileName + \"', \" + start + \", \" + length + \")\", function () { return _this.languageService.getSemanticClassifications(fileName, ts.createTextSpan(start, length)); });\n        };\n        LanguageServiceShimObject.prototype.getEncodedSyntacticClassifications = function (fileName, start, length) {\n            var _this = this;\n            return this.forwardJSONCall(\"getEncodedSyntacticClassifications('\" + fileName + \"', \" + start + \", \" + length + \")\", function () { return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); });\n        };\n        LanguageServiceShimObject.prototype.getEncodedSemanticClassifications = function (fileName, start, length) {\n            var _this = this;\n            return this.forwardJSONCall(\"getEncodedSemanticClassifications('\" + fileName + \"', \" + start + \", \" + length + \")\", function () { return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); });\n        };\n        LanguageServiceShimObject.prototype.getSyntacticDiagnostics = function (fileName) {\n            var _this = this;\n            return this.forwardJSONCall(\"getSyntacticDiagnostics('\" + fileName + \"')\", function () {\n                var diagnostics = _this.languageService.getSyntacticDiagnostics(fileName);\n                return _this.realizeDiagnostics(diagnostics);\n            });\n        };\n        LanguageServiceShimObject.prototype.getSemanticDiagnostics = function (fileName) {\n            var _this = this;\n            return this.forwardJSONCall(\"getSemanticDiagnostics('\" + fileName + \"')\", function () {\n                var diagnostics = _this.languageService.getSemanticDiagnostics(fileName);\n                return _this.realizeDiagnostics(diagnostics);\n            });\n        };\n        LanguageServiceShimObject.prototype.getCompilerOptionsDiagnostics = function () {\n            var _this = this;\n            return this.forwardJSONCall(\"getCompilerOptionsDiagnostics()\", function () {\n                var diagnostics = _this.languageService.getCompilerOptionsDiagnostics();\n                return _this.realizeDiagnostics(diagnostics);\n            });\n        };\n        LanguageServiceShimObject.prototype.getQuickInfoAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getQuickInfoAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getQuickInfoAtPosition(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.getNameOrDottedNameSpan = function (fileName, startPos, endPos) {\n            var _this = this;\n            return this.forwardJSONCall(\"getNameOrDottedNameSpan('\" + fileName + \"', \" + startPos + \", \" + endPos + \")\", function () { return _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); });\n        };\n        LanguageServiceShimObject.prototype.getBreakpointStatementAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getBreakpointStatementAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getBreakpointStatementAtPosition(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.getSignatureHelpItems = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getSignatureHelpItems('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getSignatureHelpItems(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.getDefinitionAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getDefinitionAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getDefinitionAtPosition(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.getTypeDefinitionAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getTypeDefinitionAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getTypeDefinitionAtPosition(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.getImplementationAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getImplementationAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getImplementationAtPosition(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.getRenameInfo = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getRenameInfo('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getRenameInfo(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments) {\n            var _this = this;\n            return this.forwardJSONCall(\"findRenameLocations('\" + fileName + \"', \" + position + \", \" + findInStrings + \", \" + findInComments + \")\", function () { return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); });\n        };\n        LanguageServiceShimObject.prototype.getBraceMatchingAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getBraceMatchingAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getBraceMatchingAtPosition(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.isValidBraceCompletionAtPosition = function (fileName, position, openingBrace) {\n            var _this = this;\n            return this.forwardJSONCall(\"isValidBraceCompletionAtPosition('\" + fileName + \"', \" + position + \", \" + openingBrace + \")\", function () { return _this.languageService.isValidBraceCompletionAtPosition(fileName, position, openingBrace); });\n        };\n        LanguageServiceShimObject.prototype.getIndentationAtPosition = function (fileName, position, options) {\n            var _this = this;\n            return this.forwardJSONCall(\"getIndentationAtPosition('\" + fileName + \"', \" + position + \")\", function () {\n                var localOptions = JSON.parse(options);\n                return _this.languageService.getIndentationAtPosition(fileName, position, localOptions);\n            });\n        };\n        LanguageServiceShimObject.prototype.getReferencesAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getReferencesAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getReferencesAtPosition(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.findReferences = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"findReferences('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.findReferences(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.getOccurrencesAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getOccurrencesAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getOccurrencesAtPosition(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.getDocumentHighlights = function (fileName, position, filesToSearch) {\n            var _this = this;\n            return this.forwardJSONCall(\"getDocumentHighlights('\" + fileName + \"', \" + position + \")\", function () {\n                var results = _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch));\n                var normalizedName = ts.normalizeSlashes(fileName).toLowerCase();\n                return ts.filter(results, function (r) { return ts.normalizeSlashes(r.fileName).toLowerCase() === normalizedName; });\n            });\n        };\n        LanguageServiceShimObject.prototype.getCompletionsAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getCompletionsAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getCompletionsAtPosition(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.getCompletionEntryDetails = function (fileName, position, entryName) {\n            var _this = this;\n            return this.forwardJSONCall(\"getCompletionEntryDetails('\" + fileName + \"', \" + position + \", '\" + entryName + \"')\", function () { return _this.languageService.getCompletionEntryDetails(fileName, position, entryName); });\n        };\n        LanguageServiceShimObject.prototype.getFormattingEditsForRange = function (fileName, start, end, options) {\n            var _this = this;\n            return this.forwardJSONCall(\"getFormattingEditsForRange('\" + fileName + \"', \" + start + \", \" + end + \")\", function () {\n                var localOptions = JSON.parse(options);\n                return _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions);\n            });\n        };\n        LanguageServiceShimObject.prototype.getFormattingEditsForDocument = function (fileName, options) {\n            var _this = this;\n            return this.forwardJSONCall(\"getFormattingEditsForDocument('\" + fileName + \"')\", function () {\n                var localOptions = JSON.parse(options);\n                return _this.languageService.getFormattingEditsForDocument(fileName, localOptions);\n            });\n        };\n        LanguageServiceShimObject.prototype.getFormattingEditsAfterKeystroke = function (fileName, position, key, options) {\n            var _this = this;\n            return this.forwardJSONCall(\"getFormattingEditsAfterKeystroke('\" + fileName + \"', \" + position + \", '\" + key + \"')\", function () {\n                var localOptions = JSON.parse(options);\n                return _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions);\n            });\n        };\n        LanguageServiceShimObject.prototype.getDocCommentTemplateAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getDocCommentTemplateAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getDocCommentTemplateAtPosition(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount, fileName) {\n            var _this = this;\n            return this.forwardJSONCall(\"getNavigateToItems('\" + searchValue + \"', \" + maxResultCount + \", \" + fileName + \")\", function () { return _this.languageService.getNavigateToItems(searchValue, maxResultCount, fileName); });\n        };\n        LanguageServiceShimObject.prototype.getNavigationBarItems = function (fileName) {\n            var _this = this;\n            return this.forwardJSONCall(\"getNavigationBarItems('\" + fileName + \"')\", function () { return _this.languageService.getNavigationBarItems(fileName); });\n        };\n        LanguageServiceShimObject.prototype.getNavigationTree = function (fileName) {\n            var _this = this;\n            return this.forwardJSONCall(\"getNavigationTree('\" + fileName + \"')\", function () { return _this.languageService.getNavigationTree(fileName); });\n        };\n        LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) {\n            var _this = this;\n            return this.forwardJSONCall(\"getOutliningSpans('\" + fileName + \"')\", function () { return _this.languageService.getOutliningSpans(fileName); });\n        };\n        LanguageServiceShimObject.prototype.getTodoComments = function (fileName, descriptors) {\n            var _this = this;\n            return this.forwardJSONCall(\"getTodoComments('\" + fileName + \"')\", function () { return _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); });\n        };\n        LanguageServiceShimObject.prototype.getEmitOutput = function (fileName) {\n            var _this = this;\n            return this.forwardJSONCall(\"getEmitOutput('\" + fileName + \"')\", function () { return _this.languageService.getEmitOutput(fileName); });\n        };\n        LanguageServiceShimObject.prototype.getEmitOutputObject = function (fileName) {\n            var _this = this;\n            return forwardCall(this.logger, \"getEmitOutput('\" + fileName + \"')\", false, function () { return _this.languageService.getEmitOutput(fileName); }, this.logPerformance);\n        };\n        return LanguageServiceShimObject;\n    }(ShimBase));\n    function convertClassifications(classifications) {\n        return { spans: classifications.spans.join(\",\"), endOfLineState: classifications.endOfLineState };\n    }\n    var ClassifierShimObject = (function (_super) {\n        __extends(ClassifierShimObject, _super);\n        function ClassifierShimObject(factory, logger) {\n            var _this = _super.call(this, factory) || this;\n            _this.logger = logger;\n            _this.logPerformance = false;\n            _this.classifier = ts.createClassifier();\n            return _this;\n        }\n        ClassifierShimObject.prototype.getEncodedLexicalClassifications = function (text, lexState, syntacticClassifierAbsent) {\n            var _this = this;\n            return forwardJSONCall(this.logger, \"getEncodedLexicalClassifications\", function () { return convertClassifications(_this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)); }, this.logPerformance);\n        };\n        ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) {\n            var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics);\n            var result = \"\";\n            for (var _i = 0, _a = classification.entries; _i < _a.length; _i++) {\n                var item = _a[_i];\n                result += item.length + \"\\n\";\n                result += item.classification + \"\\n\";\n            }\n            result += classification.finalLexState;\n            return result;\n        };\n        return ClassifierShimObject;\n    }(ShimBase));\n    var CoreServicesShimObject = (function (_super) {\n        __extends(CoreServicesShimObject, _super);\n        function CoreServicesShimObject(factory, logger, host) {\n            var _this = _super.call(this, factory) || this;\n            _this.logger = logger;\n            _this.host = host;\n            _this.logPerformance = false;\n            return _this;\n        }\n        CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) {\n            return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance);\n        };\n        CoreServicesShimObject.prototype.resolveModuleName = function (fileName, moduleName, compilerOptionsJson) {\n            var _this = this;\n            return this.forwardJSONCall(\"resolveModuleName('\" + fileName + \"')\", function () {\n                var compilerOptions = JSON.parse(compilerOptionsJson);\n                var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host);\n                var resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined;\n                if (resolvedFileName && !compilerOptions.allowJs && ts.fileExtensionIs(resolvedFileName, \".js\")) {\n                    return {\n                        resolvedFileName: undefined,\n                        failedLookupLocations: []\n                    };\n                }\n                return {\n                    resolvedFileName: resolvedFileName,\n                    failedLookupLocations: result.failedLookupLocations\n                };\n            });\n        };\n        CoreServicesShimObject.prototype.resolveTypeReferenceDirective = function (fileName, typeReferenceDirective, compilerOptionsJson) {\n            var _this = this;\n            return this.forwardJSONCall(\"resolveTypeReferenceDirective(\" + fileName + \")\", function () {\n                var compilerOptions = JSON.parse(compilerOptionsJson);\n                var result = ts.resolveTypeReferenceDirective(typeReferenceDirective, ts.normalizeSlashes(fileName), compilerOptions, _this.host);\n                return {\n                    resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : undefined,\n                    primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true,\n                    failedLookupLocations: result.failedLookupLocations\n                };\n            });\n        };\n        CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) {\n            var _this = this;\n            return this.forwardJSONCall(\"getPreProcessedFileInfo('\" + fileName + \"')\", function () {\n                var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), true, true);\n                return {\n                    referencedFiles: _this.convertFileReferences(result.referencedFiles),\n                    importedFiles: _this.convertFileReferences(result.importedFiles),\n                    ambientExternalModules: result.ambientExternalModules,\n                    isLibFile: result.isLibFile,\n                    typeReferenceDirectives: _this.convertFileReferences(result.typeReferenceDirectives)\n                };\n            });\n        };\n        CoreServicesShimObject.prototype.getAutomaticTypeDirectiveNames = function (compilerOptionsJson) {\n            var _this = this;\n            return this.forwardJSONCall(\"getAutomaticTypeDirectiveNames('\" + compilerOptionsJson + \"')\", function () {\n                var compilerOptions = JSON.parse(compilerOptionsJson);\n                return ts.getAutomaticTypeDirectiveNames(compilerOptions, _this.host);\n            });\n        };\n        CoreServicesShimObject.prototype.convertFileReferences = function (refs) {\n            if (!refs) {\n                return undefined;\n            }\n            var result = [];\n            for (var _i = 0, refs_2 = refs; _i < refs_2.length; _i++) {\n                var ref = refs_2[_i];\n                result.push({\n                    path: ts.normalizeSlashes(ref.fileName),\n                    position: ref.pos,\n                    length: ref.end - ref.pos\n                });\n            }\n            return result;\n        };\n        CoreServicesShimObject.prototype.getTSConfigFileInfo = function (fileName, sourceTextSnapshot) {\n            var _this = this;\n            return this.forwardJSONCall(\"getTSConfigFileInfo('\" + fileName + \"')\", function () {\n                var text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength());\n                var result = ts.parseConfigFileTextToJson(fileName, text);\n                if (result.error) {\n                    return {\n                        options: {},\n                        typeAcquisition: {},\n                        files: [],\n                        raw: {},\n                        errors: [realizeDiagnostic(result.error, \"\\r\\n\")]\n                    };\n                }\n                var normalizedFileName = ts.normalizeSlashes(fileName);\n                var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), {}, normalizedFileName);\n                return {\n                    options: configFile.options,\n                    typeAcquisition: configFile.typeAcquisition,\n                    files: configFile.fileNames,\n                    raw: configFile.raw,\n                    errors: realizeDiagnostics(configFile.errors, \"\\r\\n\")\n                };\n            });\n        };\n        CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () {\n            return this.forwardJSONCall(\"getDefaultCompilationSettings()\", function () { return ts.getDefaultCompilerOptions(); });\n        };\n        CoreServicesShimObject.prototype.discoverTypings = function (discoverTypingsJson) {\n            var _this = this;\n            var getCanonicalFileName = ts.createGetCanonicalFileName(false);\n            return this.forwardJSONCall(\"discoverTypings()\", function () {\n                var info = JSON.parse(discoverTypingsJson);\n                return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typeAcquisition, info.unresolvedImports);\n            });\n        };\n        return CoreServicesShimObject;\n    }(ShimBase));\n    var TypeScriptServicesFactory = (function () {\n        function TypeScriptServicesFactory() {\n            this._shims = [];\n        }\n        TypeScriptServicesFactory.prototype.getServicesVersion = function () {\n            return ts.servicesVersion;\n        };\n        TypeScriptServicesFactory.prototype.createLanguageServiceShim = function (host) {\n            try {\n                if (this.documentRegistry === undefined) {\n                    this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory());\n                }\n                var hostAdapter = new LanguageServiceShimHostAdapter(host);\n                var languageService = ts.createLanguageService(hostAdapter, this.documentRegistry);\n                return new LanguageServiceShimObject(this, host, languageService);\n            }\n            catch (err) {\n                logInternalError(host, err);\n                throw err;\n            }\n        };\n        TypeScriptServicesFactory.prototype.createClassifierShim = function (logger) {\n            try {\n                return new ClassifierShimObject(this, logger);\n            }\n            catch (err) {\n                logInternalError(logger, err);\n                throw err;\n            }\n        };\n        TypeScriptServicesFactory.prototype.createCoreServicesShim = function (host) {\n            try {\n                var adapter = new CoreServicesShimHostAdapter(host);\n                return new CoreServicesShimObject(this, host, adapter);\n            }\n            catch (err) {\n                logInternalError(host, err);\n                throw err;\n            }\n        };\n        TypeScriptServicesFactory.prototype.close = function () {\n            this._shims = [];\n            this.documentRegistry = undefined;\n        };\n        TypeScriptServicesFactory.prototype.registerShim = function (shim) {\n            this._shims.push(shim);\n        };\n        TypeScriptServicesFactory.prototype.unregisterShim = function (shim) {\n            for (var i = 0, n = this._shims.length; i < n; i++) {\n                if (this._shims[i] === shim) {\n                    delete this._shims[i];\n                    return;\n                }\n            }\n            throw new Error(\"Invalid operation\");\n        };\n        return TypeScriptServicesFactory;\n    }());\n    ts.TypeScriptServicesFactory = TypeScriptServicesFactory;\n    if (typeof module !== \"undefined\" && module.exports) {\n        module.exports = ts;\n    }\n})(ts || (ts = {}));\nvar TypeScript;\n(function (TypeScript) {\n    var Services;\n    (function (Services) {\n        Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory;\n    })(Services = TypeScript.Services || (TypeScript.Services = {}));\n})(TypeScript || (TypeScript = {}));\nvar toolsVersion = \"2.1\";\n"
  },
  {
    "path": "buildtool/typescript/lib/typescriptServices.js",
    "content": "/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved. \nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0  \n \nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, \nMERCHANTABLITY OR NON-INFRINGEMENT. \n \nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar ts;\n(function (ts) {\n    // token > SyntaxKind.Identifer => token is a keyword\n    // Also, If you add a new SyntaxKind be sure to keep the `Markers` section at the bottom in sync\n    var SyntaxKind;\n    (function (SyntaxKind) {\n        SyntaxKind[SyntaxKind[\"Unknown\"] = 0] = \"Unknown\";\n        SyntaxKind[SyntaxKind[\"EndOfFileToken\"] = 1] = \"EndOfFileToken\";\n        SyntaxKind[SyntaxKind[\"SingleLineCommentTrivia\"] = 2] = \"SingleLineCommentTrivia\";\n        SyntaxKind[SyntaxKind[\"MultiLineCommentTrivia\"] = 3] = \"MultiLineCommentTrivia\";\n        SyntaxKind[SyntaxKind[\"NewLineTrivia\"] = 4] = \"NewLineTrivia\";\n        SyntaxKind[SyntaxKind[\"WhitespaceTrivia\"] = 5] = \"WhitespaceTrivia\";\n        // We detect and preserve #! on the first line\n        SyntaxKind[SyntaxKind[\"ShebangTrivia\"] = 6] = \"ShebangTrivia\";\n        // We detect and provide better error recovery when we encounter a git merge marker.  This\n        // allows us to edit files with git-conflict markers in them in a much more pleasant manner.\n        SyntaxKind[SyntaxKind[\"ConflictMarkerTrivia\"] = 7] = \"ConflictMarkerTrivia\";\n        // Literals\n        SyntaxKind[SyntaxKind[\"NumericLiteral\"] = 8] = \"NumericLiteral\";\n        SyntaxKind[SyntaxKind[\"StringLiteral\"] = 9] = \"StringLiteral\";\n        SyntaxKind[SyntaxKind[\"JsxText\"] = 10] = \"JsxText\";\n        SyntaxKind[SyntaxKind[\"RegularExpressionLiteral\"] = 11] = \"RegularExpressionLiteral\";\n        SyntaxKind[SyntaxKind[\"NoSubstitutionTemplateLiteral\"] = 12] = \"NoSubstitutionTemplateLiteral\";\n        // Pseudo-literals\n        SyntaxKind[SyntaxKind[\"TemplateHead\"] = 13] = \"TemplateHead\";\n        SyntaxKind[SyntaxKind[\"TemplateMiddle\"] = 14] = \"TemplateMiddle\";\n        SyntaxKind[SyntaxKind[\"TemplateTail\"] = 15] = \"TemplateTail\";\n        // Punctuation\n        SyntaxKind[SyntaxKind[\"OpenBraceToken\"] = 16] = \"OpenBraceToken\";\n        SyntaxKind[SyntaxKind[\"CloseBraceToken\"] = 17] = \"CloseBraceToken\";\n        SyntaxKind[SyntaxKind[\"OpenParenToken\"] = 18] = \"OpenParenToken\";\n        SyntaxKind[SyntaxKind[\"CloseParenToken\"] = 19] = \"CloseParenToken\";\n        SyntaxKind[SyntaxKind[\"OpenBracketToken\"] = 20] = \"OpenBracketToken\";\n        SyntaxKind[SyntaxKind[\"CloseBracketToken\"] = 21] = \"CloseBracketToken\";\n        SyntaxKind[SyntaxKind[\"DotToken\"] = 22] = \"DotToken\";\n        SyntaxKind[SyntaxKind[\"DotDotDotToken\"] = 23] = \"DotDotDotToken\";\n        SyntaxKind[SyntaxKind[\"SemicolonToken\"] = 24] = \"SemicolonToken\";\n        SyntaxKind[SyntaxKind[\"CommaToken\"] = 25] = \"CommaToken\";\n        SyntaxKind[SyntaxKind[\"LessThanToken\"] = 26] = \"LessThanToken\";\n        SyntaxKind[SyntaxKind[\"LessThanSlashToken\"] = 27] = \"LessThanSlashToken\";\n        SyntaxKind[SyntaxKind[\"GreaterThanToken\"] = 28] = \"GreaterThanToken\";\n        SyntaxKind[SyntaxKind[\"LessThanEqualsToken\"] = 29] = \"LessThanEqualsToken\";\n        SyntaxKind[SyntaxKind[\"GreaterThanEqualsToken\"] = 30] = \"GreaterThanEqualsToken\";\n        SyntaxKind[SyntaxKind[\"EqualsEqualsToken\"] = 31] = \"EqualsEqualsToken\";\n        SyntaxKind[SyntaxKind[\"ExclamationEqualsToken\"] = 32] = \"ExclamationEqualsToken\";\n        SyntaxKind[SyntaxKind[\"EqualsEqualsEqualsToken\"] = 33] = \"EqualsEqualsEqualsToken\";\n        SyntaxKind[SyntaxKind[\"ExclamationEqualsEqualsToken\"] = 34] = \"ExclamationEqualsEqualsToken\";\n        SyntaxKind[SyntaxKind[\"EqualsGreaterThanToken\"] = 35] = \"EqualsGreaterThanToken\";\n        SyntaxKind[SyntaxKind[\"PlusToken\"] = 36] = \"PlusToken\";\n        SyntaxKind[SyntaxKind[\"MinusToken\"] = 37] = \"MinusToken\";\n        SyntaxKind[SyntaxKind[\"AsteriskToken\"] = 38] = \"AsteriskToken\";\n        SyntaxKind[SyntaxKind[\"AsteriskAsteriskToken\"] = 39] = \"AsteriskAsteriskToken\";\n        SyntaxKind[SyntaxKind[\"SlashToken\"] = 40] = \"SlashToken\";\n        SyntaxKind[SyntaxKind[\"PercentToken\"] = 41] = \"PercentToken\";\n        SyntaxKind[SyntaxKind[\"PlusPlusToken\"] = 42] = \"PlusPlusToken\";\n        SyntaxKind[SyntaxKind[\"MinusMinusToken\"] = 43] = \"MinusMinusToken\";\n        SyntaxKind[SyntaxKind[\"LessThanLessThanToken\"] = 44] = \"LessThanLessThanToken\";\n        SyntaxKind[SyntaxKind[\"GreaterThanGreaterThanToken\"] = 45] = \"GreaterThanGreaterThanToken\";\n        SyntaxKind[SyntaxKind[\"GreaterThanGreaterThanGreaterThanToken\"] = 46] = \"GreaterThanGreaterThanGreaterThanToken\";\n        SyntaxKind[SyntaxKind[\"AmpersandToken\"] = 47] = \"AmpersandToken\";\n        SyntaxKind[SyntaxKind[\"BarToken\"] = 48] = \"BarToken\";\n        SyntaxKind[SyntaxKind[\"CaretToken\"] = 49] = \"CaretToken\";\n        SyntaxKind[SyntaxKind[\"ExclamationToken\"] = 50] = \"ExclamationToken\";\n        SyntaxKind[SyntaxKind[\"TildeToken\"] = 51] = \"TildeToken\";\n        SyntaxKind[SyntaxKind[\"AmpersandAmpersandToken\"] = 52] = \"AmpersandAmpersandToken\";\n        SyntaxKind[SyntaxKind[\"BarBarToken\"] = 53] = \"BarBarToken\";\n        SyntaxKind[SyntaxKind[\"QuestionToken\"] = 54] = \"QuestionToken\";\n        SyntaxKind[SyntaxKind[\"ColonToken\"] = 55] = \"ColonToken\";\n        SyntaxKind[SyntaxKind[\"AtToken\"] = 56] = \"AtToken\";\n        // Assignments\n        SyntaxKind[SyntaxKind[\"EqualsToken\"] = 57] = \"EqualsToken\";\n        SyntaxKind[SyntaxKind[\"PlusEqualsToken\"] = 58] = \"PlusEqualsToken\";\n        SyntaxKind[SyntaxKind[\"MinusEqualsToken\"] = 59] = \"MinusEqualsToken\";\n        SyntaxKind[SyntaxKind[\"AsteriskEqualsToken\"] = 60] = \"AsteriskEqualsToken\";\n        SyntaxKind[SyntaxKind[\"AsteriskAsteriskEqualsToken\"] = 61] = \"AsteriskAsteriskEqualsToken\";\n        SyntaxKind[SyntaxKind[\"SlashEqualsToken\"] = 62] = \"SlashEqualsToken\";\n        SyntaxKind[SyntaxKind[\"PercentEqualsToken\"] = 63] = \"PercentEqualsToken\";\n        SyntaxKind[SyntaxKind[\"LessThanLessThanEqualsToken\"] = 64] = \"LessThanLessThanEqualsToken\";\n        SyntaxKind[SyntaxKind[\"GreaterThanGreaterThanEqualsToken\"] = 65] = \"GreaterThanGreaterThanEqualsToken\";\n        SyntaxKind[SyntaxKind[\"GreaterThanGreaterThanGreaterThanEqualsToken\"] = 66] = \"GreaterThanGreaterThanGreaterThanEqualsToken\";\n        SyntaxKind[SyntaxKind[\"AmpersandEqualsToken\"] = 67] = \"AmpersandEqualsToken\";\n        SyntaxKind[SyntaxKind[\"BarEqualsToken\"] = 68] = \"BarEqualsToken\";\n        SyntaxKind[SyntaxKind[\"CaretEqualsToken\"] = 69] = \"CaretEqualsToken\";\n        // Identifiers\n        SyntaxKind[SyntaxKind[\"Identifier\"] = 70] = \"Identifier\";\n        // Reserved words\n        SyntaxKind[SyntaxKind[\"BreakKeyword\"] = 71] = \"BreakKeyword\";\n        SyntaxKind[SyntaxKind[\"CaseKeyword\"] = 72] = \"CaseKeyword\";\n        SyntaxKind[SyntaxKind[\"CatchKeyword\"] = 73] = \"CatchKeyword\";\n        SyntaxKind[SyntaxKind[\"ClassKeyword\"] = 74] = \"ClassKeyword\";\n        SyntaxKind[SyntaxKind[\"ConstKeyword\"] = 75] = \"ConstKeyword\";\n        SyntaxKind[SyntaxKind[\"ContinueKeyword\"] = 76] = \"ContinueKeyword\";\n        SyntaxKind[SyntaxKind[\"DebuggerKeyword\"] = 77] = \"DebuggerKeyword\";\n        SyntaxKind[SyntaxKind[\"DefaultKeyword\"] = 78] = \"DefaultKeyword\";\n        SyntaxKind[SyntaxKind[\"DeleteKeyword\"] = 79] = \"DeleteKeyword\";\n        SyntaxKind[SyntaxKind[\"DoKeyword\"] = 80] = \"DoKeyword\";\n        SyntaxKind[SyntaxKind[\"ElseKeyword\"] = 81] = \"ElseKeyword\";\n        SyntaxKind[SyntaxKind[\"EnumKeyword\"] = 82] = \"EnumKeyword\";\n        SyntaxKind[SyntaxKind[\"ExportKeyword\"] = 83] = \"ExportKeyword\";\n        SyntaxKind[SyntaxKind[\"ExtendsKeyword\"] = 84] = \"ExtendsKeyword\";\n        SyntaxKind[SyntaxKind[\"FalseKeyword\"] = 85] = \"FalseKeyword\";\n        SyntaxKind[SyntaxKind[\"FinallyKeyword\"] = 86] = \"FinallyKeyword\";\n        SyntaxKind[SyntaxKind[\"ForKeyword\"] = 87] = \"ForKeyword\";\n        SyntaxKind[SyntaxKind[\"FunctionKeyword\"] = 88] = \"FunctionKeyword\";\n        SyntaxKind[SyntaxKind[\"IfKeyword\"] = 89] = \"IfKeyword\";\n        SyntaxKind[SyntaxKind[\"ImportKeyword\"] = 90] = \"ImportKeyword\";\n        SyntaxKind[SyntaxKind[\"InKeyword\"] = 91] = \"InKeyword\";\n        SyntaxKind[SyntaxKind[\"InstanceOfKeyword\"] = 92] = \"InstanceOfKeyword\";\n        SyntaxKind[SyntaxKind[\"NewKeyword\"] = 93] = \"NewKeyword\";\n        SyntaxKind[SyntaxKind[\"NullKeyword\"] = 94] = \"NullKeyword\";\n        SyntaxKind[SyntaxKind[\"ReturnKeyword\"] = 95] = \"ReturnKeyword\";\n        SyntaxKind[SyntaxKind[\"SuperKeyword\"] = 96] = \"SuperKeyword\";\n        SyntaxKind[SyntaxKind[\"SwitchKeyword\"] = 97] = \"SwitchKeyword\";\n        SyntaxKind[SyntaxKind[\"ThisKeyword\"] = 98] = \"ThisKeyword\";\n        SyntaxKind[SyntaxKind[\"ThrowKeyword\"] = 99] = \"ThrowKeyword\";\n        SyntaxKind[SyntaxKind[\"TrueKeyword\"] = 100] = \"TrueKeyword\";\n        SyntaxKind[SyntaxKind[\"TryKeyword\"] = 101] = \"TryKeyword\";\n        SyntaxKind[SyntaxKind[\"TypeOfKeyword\"] = 102] = \"TypeOfKeyword\";\n        SyntaxKind[SyntaxKind[\"VarKeyword\"] = 103] = \"VarKeyword\";\n        SyntaxKind[SyntaxKind[\"VoidKeyword\"] = 104] = \"VoidKeyword\";\n        SyntaxKind[SyntaxKind[\"WhileKeyword\"] = 105] = \"WhileKeyword\";\n        SyntaxKind[SyntaxKind[\"WithKeyword\"] = 106] = \"WithKeyword\";\n        // Strict mode reserved words\n        SyntaxKind[SyntaxKind[\"ImplementsKeyword\"] = 107] = \"ImplementsKeyword\";\n        SyntaxKind[SyntaxKind[\"InterfaceKeyword\"] = 108] = \"InterfaceKeyword\";\n        SyntaxKind[SyntaxKind[\"LetKeyword\"] = 109] = \"LetKeyword\";\n        SyntaxKind[SyntaxKind[\"PackageKeyword\"] = 110] = \"PackageKeyword\";\n        SyntaxKind[SyntaxKind[\"PrivateKeyword\"] = 111] = \"PrivateKeyword\";\n        SyntaxKind[SyntaxKind[\"ProtectedKeyword\"] = 112] = \"ProtectedKeyword\";\n        SyntaxKind[SyntaxKind[\"PublicKeyword\"] = 113] = \"PublicKeyword\";\n        SyntaxKind[SyntaxKind[\"StaticKeyword\"] = 114] = \"StaticKeyword\";\n        SyntaxKind[SyntaxKind[\"YieldKeyword\"] = 115] = \"YieldKeyword\";\n        // Contextual keywords\n        SyntaxKind[SyntaxKind[\"AbstractKeyword\"] = 116] = \"AbstractKeyword\";\n        SyntaxKind[SyntaxKind[\"AsKeyword\"] = 117] = \"AsKeyword\";\n        SyntaxKind[SyntaxKind[\"AnyKeyword\"] = 118] = \"AnyKeyword\";\n        SyntaxKind[SyntaxKind[\"AsyncKeyword\"] = 119] = \"AsyncKeyword\";\n        SyntaxKind[SyntaxKind[\"AwaitKeyword\"] = 120] = \"AwaitKeyword\";\n        SyntaxKind[SyntaxKind[\"BooleanKeyword\"] = 121] = \"BooleanKeyword\";\n        SyntaxKind[SyntaxKind[\"ConstructorKeyword\"] = 122] = \"ConstructorKeyword\";\n        SyntaxKind[SyntaxKind[\"DeclareKeyword\"] = 123] = \"DeclareKeyword\";\n        SyntaxKind[SyntaxKind[\"GetKeyword\"] = 124] = \"GetKeyword\";\n        SyntaxKind[SyntaxKind[\"IsKeyword\"] = 125] = \"IsKeyword\";\n        SyntaxKind[SyntaxKind[\"KeyOfKeyword\"] = 126] = \"KeyOfKeyword\";\n        SyntaxKind[SyntaxKind[\"ModuleKeyword\"] = 127] = \"ModuleKeyword\";\n        SyntaxKind[SyntaxKind[\"NamespaceKeyword\"] = 128] = \"NamespaceKeyword\";\n        SyntaxKind[SyntaxKind[\"NeverKeyword\"] = 129] = \"NeverKeyword\";\n        SyntaxKind[SyntaxKind[\"ReadonlyKeyword\"] = 130] = \"ReadonlyKeyword\";\n        SyntaxKind[SyntaxKind[\"RequireKeyword\"] = 131] = \"RequireKeyword\";\n        SyntaxKind[SyntaxKind[\"NumberKeyword\"] = 132] = \"NumberKeyword\";\n        SyntaxKind[SyntaxKind[\"SetKeyword\"] = 133] = \"SetKeyword\";\n        SyntaxKind[SyntaxKind[\"StringKeyword\"] = 134] = \"StringKeyword\";\n        SyntaxKind[SyntaxKind[\"SymbolKeyword\"] = 135] = \"SymbolKeyword\";\n        SyntaxKind[SyntaxKind[\"TypeKeyword\"] = 136] = \"TypeKeyword\";\n        SyntaxKind[SyntaxKind[\"UndefinedKeyword\"] = 137] = \"UndefinedKeyword\";\n        SyntaxKind[SyntaxKind[\"FromKeyword\"] = 138] = \"FromKeyword\";\n        SyntaxKind[SyntaxKind[\"GlobalKeyword\"] = 139] = \"GlobalKeyword\";\n        SyntaxKind[SyntaxKind[\"OfKeyword\"] = 140] = \"OfKeyword\";\n        // Parse tree nodes\n        // Names\n        SyntaxKind[SyntaxKind[\"QualifiedName\"] = 141] = \"QualifiedName\";\n        SyntaxKind[SyntaxKind[\"ComputedPropertyName\"] = 142] = \"ComputedPropertyName\";\n        // Signature elements\n        SyntaxKind[SyntaxKind[\"TypeParameter\"] = 143] = \"TypeParameter\";\n        SyntaxKind[SyntaxKind[\"Parameter\"] = 144] = \"Parameter\";\n        SyntaxKind[SyntaxKind[\"Decorator\"] = 145] = \"Decorator\";\n        // TypeMember\n        SyntaxKind[SyntaxKind[\"PropertySignature\"] = 146] = \"PropertySignature\";\n        SyntaxKind[SyntaxKind[\"PropertyDeclaration\"] = 147] = \"PropertyDeclaration\";\n        SyntaxKind[SyntaxKind[\"MethodSignature\"] = 148] = \"MethodSignature\";\n        SyntaxKind[SyntaxKind[\"MethodDeclaration\"] = 149] = \"MethodDeclaration\";\n        SyntaxKind[SyntaxKind[\"Constructor\"] = 150] = \"Constructor\";\n        SyntaxKind[SyntaxKind[\"GetAccessor\"] = 151] = \"GetAccessor\";\n        SyntaxKind[SyntaxKind[\"SetAccessor\"] = 152] = \"SetAccessor\";\n        SyntaxKind[SyntaxKind[\"CallSignature\"] = 153] = \"CallSignature\";\n        SyntaxKind[SyntaxKind[\"ConstructSignature\"] = 154] = \"ConstructSignature\";\n        SyntaxKind[SyntaxKind[\"IndexSignature\"] = 155] = \"IndexSignature\";\n        // Type\n        SyntaxKind[SyntaxKind[\"TypePredicate\"] = 156] = \"TypePredicate\";\n        SyntaxKind[SyntaxKind[\"TypeReference\"] = 157] = \"TypeReference\";\n        SyntaxKind[SyntaxKind[\"FunctionType\"] = 158] = \"FunctionType\";\n        SyntaxKind[SyntaxKind[\"ConstructorType\"] = 159] = \"ConstructorType\";\n        SyntaxKind[SyntaxKind[\"TypeQuery\"] = 160] = \"TypeQuery\";\n        SyntaxKind[SyntaxKind[\"TypeLiteral\"] = 161] = \"TypeLiteral\";\n        SyntaxKind[SyntaxKind[\"ArrayType\"] = 162] = \"ArrayType\";\n        SyntaxKind[SyntaxKind[\"TupleType\"] = 163] = \"TupleType\";\n        SyntaxKind[SyntaxKind[\"UnionType\"] = 164] = \"UnionType\";\n        SyntaxKind[SyntaxKind[\"IntersectionType\"] = 165] = \"IntersectionType\";\n        SyntaxKind[SyntaxKind[\"ParenthesizedType\"] = 166] = \"ParenthesizedType\";\n        SyntaxKind[SyntaxKind[\"ThisType\"] = 167] = \"ThisType\";\n        SyntaxKind[SyntaxKind[\"TypeOperator\"] = 168] = \"TypeOperator\";\n        SyntaxKind[SyntaxKind[\"IndexedAccessType\"] = 169] = \"IndexedAccessType\";\n        SyntaxKind[SyntaxKind[\"MappedType\"] = 170] = \"MappedType\";\n        SyntaxKind[SyntaxKind[\"LiteralType\"] = 171] = \"LiteralType\";\n        // Binding patterns\n        SyntaxKind[SyntaxKind[\"ObjectBindingPattern\"] = 172] = \"ObjectBindingPattern\";\n        SyntaxKind[SyntaxKind[\"ArrayBindingPattern\"] = 173] = \"ArrayBindingPattern\";\n        SyntaxKind[SyntaxKind[\"BindingElement\"] = 174] = \"BindingElement\";\n        // Expression\n        SyntaxKind[SyntaxKind[\"ArrayLiteralExpression\"] = 175] = \"ArrayLiteralExpression\";\n        SyntaxKind[SyntaxKind[\"ObjectLiteralExpression\"] = 176] = \"ObjectLiteralExpression\";\n        SyntaxKind[SyntaxKind[\"PropertyAccessExpression\"] = 177] = \"PropertyAccessExpression\";\n        SyntaxKind[SyntaxKind[\"ElementAccessExpression\"] = 178] = \"ElementAccessExpression\";\n        SyntaxKind[SyntaxKind[\"CallExpression\"] = 179] = \"CallExpression\";\n        SyntaxKind[SyntaxKind[\"NewExpression\"] = 180] = \"NewExpression\";\n        SyntaxKind[SyntaxKind[\"TaggedTemplateExpression\"] = 181] = \"TaggedTemplateExpression\";\n        SyntaxKind[SyntaxKind[\"TypeAssertionExpression\"] = 182] = \"TypeAssertionExpression\";\n        SyntaxKind[SyntaxKind[\"ParenthesizedExpression\"] = 183] = \"ParenthesizedExpression\";\n        SyntaxKind[SyntaxKind[\"FunctionExpression\"] = 184] = \"FunctionExpression\";\n        SyntaxKind[SyntaxKind[\"ArrowFunction\"] = 185] = \"ArrowFunction\";\n        SyntaxKind[SyntaxKind[\"DeleteExpression\"] = 186] = \"DeleteExpression\";\n        SyntaxKind[SyntaxKind[\"TypeOfExpression\"] = 187] = \"TypeOfExpression\";\n        SyntaxKind[SyntaxKind[\"VoidExpression\"] = 188] = \"VoidExpression\";\n        SyntaxKind[SyntaxKind[\"AwaitExpression\"] = 189] = \"AwaitExpression\";\n        SyntaxKind[SyntaxKind[\"PrefixUnaryExpression\"] = 190] = \"PrefixUnaryExpression\";\n        SyntaxKind[SyntaxKind[\"PostfixUnaryExpression\"] = 191] = \"PostfixUnaryExpression\";\n        SyntaxKind[SyntaxKind[\"BinaryExpression\"] = 192] = \"BinaryExpression\";\n        SyntaxKind[SyntaxKind[\"ConditionalExpression\"] = 193] = \"ConditionalExpression\";\n        SyntaxKind[SyntaxKind[\"TemplateExpression\"] = 194] = \"TemplateExpression\";\n        SyntaxKind[SyntaxKind[\"YieldExpression\"] = 195] = \"YieldExpression\";\n        SyntaxKind[SyntaxKind[\"SpreadElement\"] = 196] = \"SpreadElement\";\n        SyntaxKind[SyntaxKind[\"ClassExpression\"] = 197] = \"ClassExpression\";\n        SyntaxKind[SyntaxKind[\"OmittedExpression\"] = 198] = \"OmittedExpression\";\n        SyntaxKind[SyntaxKind[\"ExpressionWithTypeArguments\"] = 199] = \"ExpressionWithTypeArguments\";\n        SyntaxKind[SyntaxKind[\"AsExpression\"] = 200] = \"AsExpression\";\n        SyntaxKind[SyntaxKind[\"NonNullExpression\"] = 201] = \"NonNullExpression\";\n        // Misc\n        SyntaxKind[SyntaxKind[\"TemplateSpan\"] = 202] = \"TemplateSpan\";\n        SyntaxKind[SyntaxKind[\"SemicolonClassElement\"] = 203] = \"SemicolonClassElement\";\n        // Element\n        SyntaxKind[SyntaxKind[\"Block\"] = 204] = \"Block\";\n        SyntaxKind[SyntaxKind[\"VariableStatement\"] = 205] = \"VariableStatement\";\n        SyntaxKind[SyntaxKind[\"EmptyStatement\"] = 206] = \"EmptyStatement\";\n        SyntaxKind[SyntaxKind[\"ExpressionStatement\"] = 207] = \"ExpressionStatement\";\n        SyntaxKind[SyntaxKind[\"IfStatement\"] = 208] = \"IfStatement\";\n        SyntaxKind[SyntaxKind[\"DoStatement\"] = 209] = \"DoStatement\";\n        SyntaxKind[SyntaxKind[\"WhileStatement\"] = 210] = \"WhileStatement\";\n        SyntaxKind[SyntaxKind[\"ForStatement\"] = 211] = \"ForStatement\";\n        SyntaxKind[SyntaxKind[\"ForInStatement\"] = 212] = \"ForInStatement\";\n        SyntaxKind[SyntaxKind[\"ForOfStatement\"] = 213] = \"ForOfStatement\";\n        SyntaxKind[SyntaxKind[\"ContinueStatement\"] = 214] = \"ContinueStatement\";\n        SyntaxKind[SyntaxKind[\"BreakStatement\"] = 215] = \"BreakStatement\";\n        SyntaxKind[SyntaxKind[\"ReturnStatement\"] = 216] = \"ReturnStatement\";\n        SyntaxKind[SyntaxKind[\"WithStatement\"] = 217] = \"WithStatement\";\n        SyntaxKind[SyntaxKind[\"SwitchStatement\"] = 218] = \"SwitchStatement\";\n        SyntaxKind[SyntaxKind[\"LabeledStatement\"] = 219] = \"LabeledStatement\";\n        SyntaxKind[SyntaxKind[\"ThrowStatement\"] = 220] = \"ThrowStatement\";\n        SyntaxKind[SyntaxKind[\"TryStatement\"] = 221] = \"TryStatement\";\n        SyntaxKind[SyntaxKind[\"DebuggerStatement\"] = 222] = \"DebuggerStatement\";\n        SyntaxKind[SyntaxKind[\"VariableDeclaration\"] = 223] = \"VariableDeclaration\";\n        SyntaxKind[SyntaxKind[\"VariableDeclarationList\"] = 224] = \"VariableDeclarationList\";\n        SyntaxKind[SyntaxKind[\"FunctionDeclaration\"] = 225] = \"FunctionDeclaration\";\n        SyntaxKind[SyntaxKind[\"ClassDeclaration\"] = 226] = \"ClassDeclaration\";\n        SyntaxKind[SyntaxKind[\"InterfaceDeclaration\"] = 227] = \"InterfaceDeclaration\";\n        SyntaxKind[SyntaxKind[\"TypeAliasDeclaration\"] = 228] = \"TypeAliasDeclaration\";\n        SyntaxKind[SyntaxKind[\"EnumDeclaration\"] = 229] = \"EnumDeclaration\";\n        SyntaxKind[SyntaxKind[\"ModuleDeclaration\"] = 230] = \"ModuleDeclaration\";\n        SyntaxKind[SyntaxKind[\"ModuleBlock\"] = 231] = \"ModuleBlock\";\n        SyntaxKind[SyntaxKind[\"CaseBlock\"] = 232] = \"CaseBlock\";\n        SyntaxKind[SyntaxKind[\"NamespaceExportDeclaration\"] = 233] = \"NamespaceExportDeclaration\";\n        SyntaxKind[SyntaxKind[\"ImportEqualsDeclaration\"] = 234] = \"ImportEqualsDeclaration\";\n        SyntaxKind[SyntaxKind[\"ImportDeclaration\"] = 235] = \"ImportDeclaration\";\n        SyntaxKind[SyntaxKind[\"ImportClause\"] = 236] = \"ImportClause\";\n        SyntaxKind[SyntaxKind[\"NamespaceImport\"] = 237] = \"NamespaceImport\";\n        SyntaxKind[SyntaxKind[\"NamedImports\"] = 238] = \"NamedImports\";\n        SyntaxKind[SyntaxKind[\"ImportSpecifier\"] = 239] = \"ImportSpecifier\";\n        SyntaxKind[SyntaxKind[\"ExportAssignment\"] = 240] = \"ExportAssignment\";\n        SyntaxKind[SyntaxKind[\"ExportDeclaration\"] = 241] = \"ExportDeclaration\";\n        SyntaxKind[SyntaxKind[\"NamedExports\"] = 242] = \"NamedExports\";\n        SyntaxKind[SyntaxKind[\"ExportSpecifier\"] = 243] = \"ExportSpecifier\";\n        SyntaxKind[SyntaxKind[\"MissingDeclaration\"] = 244] = \"MissingDeclaration\";\n        // Module references\n        SyntaxKind[SyntaxKind[\"ExternalModuleReference\"] = 245] = \"ExternalModuleReference\";\n        // JSX\n        SyntaxKind[SyntaxKind[\"JsxElement\"] = 246] = \"JsxElement\";\n        SyntaxKind[SyntaxKind[\"JsxSelfClosingElement\"] = 247] = \"JsxSelfClosingElement\";\n        SyntaxKind[SyntaxKind[\"JsxOpeningElement\"] = 248] = \"JsxOpeningElement\";\n        SyntaxKind[SyntaxKind[\"JsxClosingElement\"] = 249] = \"JsxClosingElement\";\n        SyntaxKind[SyntaxKind[\"JsxAttribute\"] = 250] = \"JsxAttribute\";\n        SyntaxKind[SyntaxKind[\"JsxSpreadAttribute\"] = 251] = \"JsxSpreadAttribute\";\n        SyntaxKind[SyntaxKind[\"JsxExpression\"] = 252] = \"JsxExpression\";\n        // Clauses\n        SyntaxKind[SyntaxKind[\"CaseClause\"] = 253] = \"CaseClause\";\n        SyntaxKind[SyntaxKind[\"DefaultClause\"] = 254] = \"DefaultClause\";\n        SyntaxKind[SyntaxKind[\"HeritageClause\"] = 255] = \"HeritageClause\";\n        SyntaxKind[SyntaxKind[\"CatchClause\"] = 256] = \"CatchClause\";\n        // Property assignments\n        SyntaxKind[SyntaxKind[\"PropertyAssignment\"] = 257] = \"PropertyAssignment\";\n        SyntaxKind[SyntaxKind[\"ShorthandPropertyAssignment\"] = 258] = \"ShorthandPropertyAssignment\";\n        SyntaxKind[SyntaxKind[\"SpreadAssignment\"] = 259] = \"SpreadAssignment\";\n        // Enum\n        SyntaxKind[SyntaxKind[\"EnumMember\"] = 260] = \"EnumMember\";\n        // Top-level nodes\n        SyntaxKind[SyntaxKind[\"SourceFile\"] = 261] = \"SourceFile\";\n        // JSDoc nodes\n        SyntaxKind[SyntaxKind[\"JSDocTypeExpression\"] = 262] = \"JSDocTypeExpression\";\n        // The * type\n        SyntaxKind[SyntaxKind[\"JSDocAllType\"] = 263] = \"JSDocAllType\";\n        // The ? type\n        SyntaxKind[SyntaxKind[\"JSDocUnknownType\"] = 264] = \"JSDocUnknownType\";\n        SyntaxKind[SyntaxKind[\"JSDocArrayType\"] = 265] = \"JSDocArrayType\";\n        SyntaxKind[SyntaxKind[\"JSDocUnionType\"] = 266] = \"JSDocUnionType\";\n        SyntaxKind[SyntaxKind[\"JSDocTupleType\"] = 267] = \"JSDocTupleType\";\n        SyntaxKind[SyntaxKind[\"JSDocNullableType\"] = 268] = \"JSDocNullableType\";\n        SyntaxKind[SyntaxKind[\"JSDocNonNullableType\"] = 269] = \"JSDocNonNullableType\";\n        SyntaxKind[SyntaxKind[\"JSDocRecordType\"] = 270] = \"JSDocRecordType\";\n        SyntaxKind[SyntaxKind[\"JSDocRecordMember\"] = 271] = \"JSDocRecordMember\";\n        SyntaxKind[SyntaxKind[\"JSDocTypeReference\"] = 272] = \"JSDocTypeReference\";\n        SyntaxKind[SyntaxKind[\"JSDocOptionalType\"] = 273] = \"JSDocOptionalType\";\n        SyntaxKind[SyntaxKind[\"JSDocFunctionType\"] = 274] = \"JSDocFunctionType\";\n        SyntaxKind[SyntaxKind[\"JSDocVariadicType\"] = 275] = \"JSDocVariadicType\";\n        SyntaxKind[SyntaxKind[\"JSDocConstructorType\"] = 276] = \"JSDocConstructorType\";\n        SyntaxKind[SyntaxKind[\"JSDocThisType\"] = 277] = \"JSDocThisType\";\n        SyntaxKind[SyntaxKind[\"JSDocComment\"] = 278] = \"JSDocComment\";\n        SyntaxKind[SyntaxKind[\"JSDocTag\"] = 279] = \"JSDocTag\";\n        SyntaxKind[SyntaxKind[\"JSDocAugmentsTag\"] = 280] = \"JSDocAugmentsTag\";\n        SyntaxKind[SyntaxKind[\"JSDocParameterTag\"] = 281] = \"JSDocParameterTag\";\n        SyntaxKind[SyntaxKind[\"JSDocReturnTag\"] = 282] = \"JSDocReturnTag\";\n        SyntaxKind[SyntaxKind[\"JSDocTypeTag\"] = 283] = \"JSDocTypeTag\";\n        SyntaxKind[SyntaxKind[\"JSDocTemplateTag\"] = 284] = \"JSDocTemplateTag\";\n        SyntaxKind[SyntaxKind[\"JSDocTypedefTag\"] = 285] = \"JSDocTypedefTag\";\n        SyntaxKind[SyntaxKind[\"JSDocPropertyTag\"] = 286] = \"JSDocPropertyTag\";\n        SyntaxKind[SyntaxKind[\"JSDocTypeLiteral\"] = 287] = \"JSDocTypeLiteral\";\n        SyntaxKind[SyntaxKind[\"JSDocLiteralType\"] = 288] = \"JSDocLiteralType\";\n        SyntaxKind[SyntaxKind[\"JSDocNullKeyword\"] = 289] = \"JSDocNullKeyword\";\n        SyntaxKind[SyntaxKind[\"JSDocUndefinedKeyword\"] = 290] = \"JSDocUndefinedKeyword\";\n        SyntaxKind[SyntaxKind[\"JSDocNeverKeyword\"] = 291] = \"JSDocNeverKeyword\";\n        // Synthesized list\n        SyntaxKind[SyntaxKind[\"SyntaxList\"] = 292] = \"SyntaxList\";\n        // Transformation nodes\n        SyntaxKind[SyntaxKind[\"NotEmittedStatement\"] = 293] = \"NotEmittedStatement\";\n        SyntaxKind[SyntaxKind[\"PartiallyEmittedExpression\"] = 294] = \"PartiallyEmittedExpression\";\n        SyntaxKind[SyntaxKind[\"MergeDeclarationMarker\"] = 295] = \"MergeDeclarationMarker\";\n        SyntaxKind[SyntaxKind[\"EndOfDeclarationMarker\"] = 296] = \"EndOfDeclarationMarker\";\n        SyntaxKind[SyntaxKind[\"RawExpression\"] = 297] = \"RawExpression\";\n        // Enum value count\n        SyntaxKind[SyntaxKind[\"Count\"] = 298] = \"Count\";\n        // Markers\n        SyntaxKind[SyntaxKind[\"FirstAssignment\"] = 57] = \"FirstAssignment\";\n        SyntaxKind[SyntaxKind[\"LastAssignment\"] = 69] = \"LastAssignment\";\n        SyntaxKind[SyntaxKind[\"FirstCompoundAssignment\"] = 58] = \"FirstCompoundAssignment\";\n        SyntaxKind[SyntaxKind[\"LastCompoundAssignment\"] = 69] = \"LastCompoundAssignment\";\n        SyntaxKind[SyntaxKind[\"FirstReservedWord\"] = 71] = \"FirstReservedWord\";\n        SyntaxKind[SyntaxKind[\"LastReservedWord\"] = 106] = \"LastReservedWord\";\n        SyntaxKind[SyntaxKind[\"FirstKeyword\"] = 71] = \"FirstKeyword\";\n        SyntaxKind[SyntaxKind[\"LastKeyword\"] = 140] = \"LastKeyword\";\n        SyntaxKind[SyntaxKind[\"FirstFutureReservedWord\"] = 107] = \"FirstFutureReservedWord\";\n        SyntaxKind[SyntaxKind[\"LastFutureReservedWord\"] = 115] = \"LastFutureReservedWord\";\n        SyntaxKind[SyntaxKind[\"FirstTypeNode\"] = 156] = \"FirstTypeNode\";\n        SyntaxKind[SyntaxKind[\"LastTypeNode\"] = 171] = \"LastTypeNode\";\n        SyntaxKind[SyntaxKind[\"FirstPunctuation\"] = 16] = \"FirstPunctuation\";\n        SyntaxKind[SyntaxKind[\"LastPunctuation\"] = 69] = \"LastPunctuation\";\n        SyntaxKind[SyntaxKind[\"FirstToken\"] = 0] = \"FirstToken\";\n        SyntaxKind[SyntaxKind[\"LastToken\"] = 140] = \"LastToken\";\n        SyntaxKind[SyntaxKind[\"FirstTriviaToken\"] = 2] = \"FirstTriviaToken\";\n        SyntaxKind[SyntaxKind[\"LastTriviaToken\"] = 7] = \"LastTriviaToken\";\n        SyntaxKind[SyntaxKind[\"FirstLiteralToken\"] = 8] = \"FirstLiteralToken\";\n        SyntaxKind[SyntaxKind[\"LastLiteralToken\"] = 12] = \"LastLiteralToken\";\n        SyntaxKind[SyntaxKind[\"FirstTemplateToken\"] = 12] = \"FirstTemplateToken\";\n        SyntaxKind[SyntaxKind[\"LastTemplateToken\"] = 15] = \"LastTemplateToken\";\n        SyntaxKind[SyntaxKind[\"FirstBinaryOperator\"] = 26] = \"FirstBinaryOperator\";\n        SyntaxKind[SyntaxKind[\"LastBinaryOperator\"] = 69] = \"LastBinaryOperator\";\n        SyntaxKind[SyntaxKind[\"FirstNode\"] = 141] = \"FirstNode\";\n        SyntaxKind[SyntaxKind[\"FirstJSDocNode\"] = 262] = \"FirstJSDocNode\";\n        SyntaxKind[SyntaxKind[\"LastJSDocNode\"] = 288] = \"LastJSDocNode\";\n        SyntaxKind[SyntaxKind[\"FirstJSDocTagNode\"] = 278] = \"FirstJSDocTagNode\";\n        SyntaxKind[SyntaxKind[\"LastJSDocTagNode\"] = 291] = \"LastJSDocTagNode\";\n    })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));\n    var NodeFlags;\n    (function (NodeFlags) {\n        NodeFlags[NodeFlags[\"None\"] = 0] = \"None\";\n        NodeFlags[NodeFlags[\"Let\"] = 1] = \"Let\";\n        NodeFlags[NodeFlags[\"Const\"] = 2] = \"Const\";\n        NodeFlags[NodeFlags[\"NestedNamespace\"] = 4] = \"NestedNamespace\";\n        NodeFlags[NodeFlags[\"Synthesized\"] = 8] = \"Synthesized\";\n        NodeFlags[NodeFlags[\"Namespace\"] = 16] = \"Namespace\";\n        NodeFlags[NodeFlags[\"ExportContext\"] = 32] = \"ExportContext\";\n        NodeFlags[NodeFlags[\"ContainsThis\"] = 64] = \"ContainsThis\";\n        NodeFlags[NodeFlags[\"HasImplicitReturn\"] = 128] = \"HasImplicitReturn\";\n        NodeFlags[NodeFlags[\"HasExplicitReturn\"] = 256] = \"HasExplicitReturn\";\n        NodeFlags[NodeFlags[\"GlobalAugmentation\"] = 512] = \"GlobalAugmentation\";\n        NodeFlags[NodeFlags[\"HasAsyncFunctions\"] = 1024] = \"HasAsyncFunctions\";\n        NodeFlags[NodeFlags[\"DisallowInContext\"] = 2048] = \"DisallowInContext\";\n        NodeFlags[NodeFlags[\"YieldContext\"] = 4096] = \"YieldContext\";\n        NodeFlags[NodeFlags[\"DecoratorContext\"] = 8192] = \"DecoratorContext\";\n        NodeFlags[NodeFlags[\"AwaitContext\"] = 16384] = \"AwaitContext\";\n        NodeFlags[NodeFlags[\"ThisNodeHasError\"] = 32768] = \"ThisNodeHasError\";\n        NodeFlags[NodeFlags[\"JavaScriptFile\"] = 65536] = \"JavaScriptFile\";\n        NodeFlags[NodeFlags[\"ThisNodeOrAnySubNodesHasError\"] = 131072] = \"ThisNodeOrAnySubNodesHasError\";\n        NodeFlags[NodeFlags[\"HasAggregatedChildData\"] = 262144] = \"HasAggregatedChildData\";\n        NodeFlags[NodeFlags[\"BlockScoped\"] = 3] = \"BlockScoped\";\n        NodeFlags[NodeFlags[\"ReachabilityCheckFlags\"] = 384] = \"ReachabilityCheckFlags\";\n        NodeFlags[NodeFlags[\"ReachabilityAndEmitFlags\"] = 1408] = \"ReachabilityAndEmitFlags\";\n        // Parsing context flags\n        NodeFlags[NodeFlags[\"ContextFlags\"] = 96256] = \"ContextFlags\";\n        // Exclude these flags when parsing a Type\n        NodeFlags[NodeFlags[\"TypeExcludesFlags\"] = 20480] = \"TypeExcludesFlags\";\n    })(NodeFlags = ts.NodeFlags || (ts.NodeFlags = {}));\n    var ModifierFlags;\n    (function (ModifierFlags) {\n        ModifierFlags[ModifierFlags[\"None\"] = 0] = \"None\";\n        ModifierFlags[ModifierFlags[\"Export\"] = 1] = \"Export\";\n        ModifierFlags[ModifierFlags[\"Ambient\"] = 2] = \"Ambient\";\n        ModifierFlags[ModifierFlags[\"Public\"] = 4] = \"Public\";\n        ModifierFlags[ModifierFlags[\"Private\"] = 8] = \"Private\";\n        ModifierFlags[ModifierFlags[\"Protected\"] = 16] = \"Protected\";\n        ModifierFlags[ModifierFlags[\"Static\"] = 32] = \"Static\";\n        ModifierFlags[ModifierFlags[\"Readonly\"] = 64] = \"Readonly\";\n        ModifierFlags[ModifierFlags[\"Abstract\"] = 128] = \"Abstract\";\n        ModifierFlags[ModifierFlags[\"Async\"] = 256] = \"Async\";\n        ModifierFlags[ModifierFlags[\"Default\"] = 512] = \"Default\";\n        ModifierFlags[ModifierFlags[\"Const\"] = 2048] = \"Const\";\n        ModifierFlags[ModifierFlags[\"HasComputedFlags\"] = 536870912] = \"HasComputedFlags\";\n        ModifierFlags[ModifierFlags[\"AccessibilityModifier\"] = 28] = \"AccessibilityModifier\";\n        // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property.\n        ModifierFlags[ModifierFlags[\"ParameterPropertyModifier\"] = 92] = \"ParameterPropertyModifier\";\n        ModifierFlags[ModifierFlags[\"NonPublicAccessibilityModifier\"] = 24] = \"NonPublicAccessibilityModifier\";\n        ModifierFlags[ModifierFlags[\"TypeScriptModifier\"] = 2270] = \"TypeScriptModifier\";\n        ModifierFlags[ModifierFlags[\"ExportDefault\"] = 513] = \"ExportDefault\";\n    })(ModifierFlags = ts.ModifierFlags || (ts.ModifierFlags = {}));\n    var JsxFlags;\n    (function (JsxFlags) {\n        JsxFlags[JsxFlags[\"None\"] = 0] = \"None\";\n        /** An element from a named property of the JSX.IntrinsicElements interface */\n        JsxFlags[JsxFlags[\"IntrinsicNamedElement\"] = 1] = \"IntrinsicNamedElement\";\n        /** An element inferred from the string index signature of the JSX.IntrinsicElements interface */\n        JsxFlags[JsxFlags[\"IntrinsicIndexedElement\"] = 2] = \"IntrinsicIndexedElement\";\n        JsxFlags[JsxFlags[\"IntrinsicElement\"] = 3] = \"IntrinsicElement\";\n    })(JsxFlags = ts.JsxFlags || (ts.JsxFlags = {}));\n    /* @internal */\n    var RelationComparisonResult;\n    (function (RelationComparisonResult) {\n        RelationComparisonResult[RelationComparisonResult[\"Succeeded\"] = 1] = \"Succeeded\";\n        RelationComparisonResult[RelationComparisonResult[\"Failed\"] = 2] = \"Failed\";\n        RelationComparisonResult[RelationComparisonResult[\"FailedAndReported\"] = 3] = \"FailedAndReported\";\n    })(RelationComparisonResult = ts.RelationComparisonResult || (ts.RelationComparisonResult = {}));\n    /*@internal*/\n    var GeneratedIdentifierKind;\n    (function (GeneratedIdentifierKind) {\n        GeneratedIdentifierKind[GeneratedIdentifierKind[\"None\"] = 0] = \"None\";\n        GeneratedIdentifierKind[GeneratedIdentifierKind[\"Auto\"] = 1] = \"Auto\";\n        GeneratedIdentifierKind[GeneratedIdentifierKind[\"Loop\"] = 2] = \"Loop\";\n        GeneratedIdentifierKind[GeneratedIdentifierKind[\"Unique\"] = 3] = \"Unique\";\n        GeneratedIdentifierKind[GeneratedIdentifierKind[\"Node\"] = 4] = \"Node\";\n    })(GeneratedIdentifierKind = ts.GeneratedIdentifierKind || (ts.GeneratedIdentifierKind = {}));\n    var FlowFlags;\n    (function (FlowFlags) {\n        FlowFlags[FlowFlags[\"Unreachable\"] = 1] = \"Unreachable\";\n        FlowFlags[FlowFlags[\"Start\"] = 2] = \"Start\";\n        FlowFlags[FlowFlags[\"BranchLabel\"] = 4] = \"BranchLabel\";\n        FlowFlags[FlowFlags[\"LoopLabel\"] = 8] = \"LoopLabel\";\n        FlowFlags[FlowFlags[\"Assignment\"] = 16] = \"Assignment\";\n        FlowFlags[FlowFlags[\"TrueCondition\"] = 32] = \"TrueCondition\";\n        FlowFlags[FlowFlags[\"FalseCondition\"] = 64] = \"FalseCondition\";\n        FlowFlags[FlowFlags[\"SwitchClause\"] = 128] = \"SwitchClause\";\n        FlowFlags[FlowFlags[\"ArrayMutation\"] = 256] = \"ArrayMutation\";\n        FlowFlags[FlowFlags[\"Referenced\"] = 512] = \"Referenced\";\n        FlowFlags[FlowFlags[\"Shared\"] = 1024] = \"Shared\";\n        FlowFlags[FlowFlags[\"Label\"] = 12] = \"Label\";\n        FlowFlags[FlowFlags[\"Condition\"] = 96] = \"Condition\";\n    })(FlowFlags = ts.FlowFlags || (ts.FlowFlags = {}));\n    var OperationCanceledException = (function () {\n        function OperationCanceledException() {\n        }\n        return OperationCanceledException;\n    }());\n    ts.OperationCanceledException = OperationCanceledException;\n    /** Return code used by getEmitOutput function to indicate status of the function */\n    var ExitStatus;\n    (function (ExitStatus) {\n        // Compiler ran successfully.  Either this was a simple do-nothing compilation (for example,\n        // when -version or -help was provided, or this was a normal compilation, no diagnostics\n        // were produced, and all outputs were generated successfully.\n        ExitStatus[ExitStatus[\"Success\"] = 0] = \"Success\";\n        // Diagnostics were produced and because of them no code was generated.\n        ExitStatus[ExitStatus[\"DiagnosticsPresent_OutputsSkipped\"] = 1] = \"DiagnosticsPresent_OutputsSkipped\";\n        // Diagnostics were produced and outputs were generated in spite of them.\n        ExitStatus[ExitStatus[\"DiagnosticsPresent_OutputsGenerated\"] = 2] = \"DiagnosticsPresent_OutputsGenerated\";\n    })(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {}));\n    var TypeFormatFlags;\n    (function (TypeFormatFlags) {\n        TypeFormatFlags[TypeFormatFlags[\"None\"] = 0] = \"None\";\n        TypeFormatFlags[TypeFormatFlags[\"WriteArrayAsGenericType\"] = 1] = \"WriteArrayAsGenericType\";\n        TypeFormatFlags[TypeFormatFlags[\"UseTypeOfFunction\"] = 2] = \"UseTypeOfFunction\";\n        TypeFormatFlags[TypeFormatFlags[\"NoTruncation\"] = 4] = \"NoTruncation\";\n        TypeFormatFlags[TypeFormatFlags[\"WriteArrowStyleSignature\"] = 8] = \"WriteArrowStyleSignature\";\n        TypeFormatFlags[TypeFormatFlags[\"WriteOwnNameForAnyLike\"] = 16] = \"WriteOwnNameForAnyLike\";\n        TypeFormatFlags[TypeFormatFlags[\"WriteTypeArgumentsOfSignature\"] = 32] = \"WriteTypeArgumentsOfSignature\";\n        TypeFormatFlags[TypeFormatFlags[\"InElementType\"] = 64] = \"InElementType\";\n        TypeFormatFlags[TypeFormatFlags[\"UseFullyQualifiedType\"] = 128] = \"UseFullyQualifiedType\";\n        TypeFormatFlags[TypeFormatFlags[\"InFirstTypeArgument\"] = 256] = \"InFirstTypeArgument\";\n        TypeFormatFlags[TypeFormatFlags[\"InTypeAlias\"] = 512] = \"InTypeAlias\";\n        TypeFormatFlags[TypeFormatFlags[\"UseTypeAliasValue\"] = 1024] = \"UseTypeAliasValue\";\n    })(TypeFormatFlags = ts.TypeFormatFlags || (ts.TypeFormatFlags = {}));\n    var SymbolFormatFlags;\n    (function (SymbolFormatFlags) {\n        SymbolFormatFlags[SymbolFormatFlags[\"None\"] = 0] = \"None\";\n        // Write symbols's type argument if it is instantiated symbol\n        // eg. class C<T> { p: T }   <-- Show p as C<T>.p here\n        //     var a: C<number>;\n        //     var p = a.p;  <--- Here p is property of C<number> so show it as C<number>.p instead of just C.p\n        SymbolFormatFlags[SymbolFormatFlags[\"WriteTypeParametersOrArguments\"] = 1] = \"WriteTypeParametersOrArguments\";\n        // Use only external alias information to get the symbol name in the given context\n        // eg.  module m { export class c { } } import x = m.c;\n        // When this flag is specified m.c will be used to refer to the class instead of alias symbol x\n        SymbolFormatFlags[SymbolFormatFlags[\"UseOnlyExternalAliasing\"] = 2] = \"UseOnlyExternalAliasing\";\n    })(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {}));\n    /* @internal */\n    var SymbolAccessibility;\n    (function (SymbolAccessibility) {\n        SymbolAccessibility[SymbolAccessibility[\"Accessible\"] = 0] = \"Accessible\";\n        SymbolAccessibility[SymbolAccessibility[\"NotAccessible\"] = 1] = \"NotAccessible\";\n        SymbolAccessibility[SymbolAccessibility[\"CannotBeNamed\"] = 2] = \"CannotBeNamed\";\n    })(SymbolAccessibility = ts.SymbolAccessibility || (ts.SymbolAccessibility = {}));\n    /* @internal */\n    var SyntheticSymbolKind;\n    (function (SyntheticSymbolKind) {\n        SyntheticSymbolKind[SyntheticSymbolKind[\"UnionOrIntersection\"] = 0] = \"UnionOrIntersection\";\n        SyntheticSymbolKind[SyntheticSymbolKind[\"Spread\"] = 1] = \"Spread\";\n    })(SyntheticSymbolKind = ts.SyntheticSymbolKind || (ts.SyntheticSymbolKind = {}));\n    var TypePredicateKind;\n    (function (TypePredicateKind) {\n        TypePredicateKind[TypePredicateKind[\"This\"] = 0] = \"This\";\n        TypePredicateKind[TypePredicateKind[\"Identifier\"] = 1] = \"Identifier\";\n    })(TypePredicateKind = ts.TypePredicateKind || (ts.TypePredicateKind = {}));\n    /** Indicates how to serialize the name for a TypeReferenceNode when emitting decorator\n      * metadata */\n    /* @internal */\n    var TypeReferenceSerializationKind;\n    (function (TypeReferenceSerializationKind) {\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"Unknown\"] = 0] = \"Unknown\";\n        // should be emitted using a safe fallback.\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"TypeWithConstructSignatureAndValue\"] = 1] = \"TypeWithConstructSignatureAndValue\";\n        // function that can be reached at runtime (e.g. a `class`\n        // declaration or a `var` declaration for the static side\n        // of a type, such as the global `Promise` type in lib.d.ts).\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"VoidNullableOrNeverType\"] = 2] = \"VoidNullableOrNeverType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"NumberLikeType\"] = 3] = \"NumberLikeType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"StringLikeType\"] = 4] = \"StringLikeType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"BooleanType\"] = 5] = \"BooleanType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"ArrayLikeType\"] = 6] = \"ArrayLikeType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"ESSymbolType\"] = 7] = \"ESSymbolType\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"Promise\"] = 8] = \"Promise\";\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"TypeWithCallSignature\"] = 9] = \"TypeWithCallSignature\";\n        // with call signatures.\n        TypeReferenceSerializationKind[TypeReferenceSerializationKind[\"ObjectType\"] = 10] = \"ObjectType\";\n    })(TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {}));\n    var SymbolFlags;\n    (function (SymbolFlags) {\n        SymbolFlags[SymbolFlags[\"None\"] = 0] = \"None\";\n        SymbolFlags[SymbolFlags[\"FunctionScopedVariable\"] = 1] = \"FunctionScopedVariable\";\n        SymbolFlags[SymbolFlags[\"BlockScopedVariable\"] = 2] = \"BlockScopedVariable\";\n        SymbolFlags[SymbolFlags[\"Property\"] = 4] = \"Property\";\n        SymbolFlags[SymbolFlags[\"EnumMember\"] = 8] = \"EnumMember\";\n        SymbolFlags[SymbolFlags[\"Function\"] = 16] = \"Function\";\n        SymbolFlags[SymbolFlags[\"Class\"] = 32] = \"Class\";\n        SymbolFlags[SymbolFlags[\"Interface\"] = 64] = \"Interface\";\n        SymbolFlags[SymbolFlags[\"ConstEnum\"] = 128] = \"ConstEnum\";\n        SymbolFlags[SymbolFlags[\"RegularEnum\"] = 256] = \"RegularEnum\";\n        SymbolFlags[SymbolFlags[\"ValueModule\"] = 512] = \"ValueModule\";\n        SymbolFlags[SymbolFlags[\"NamespaceModule\"] = 1024] = \"NamespaceModule\";\n        SymbolFlags[SymbolFlags[\"TypeLiteral\"] = 2048] = \"TypeLiteral\";\n        SymbolFlags[SymbolFlags[\"ObjectLiteral\"] = 4096] = \"ObjectLiteral\";\n        SymbolFlags[SymbolFlags[\"Method\"] = 8192] = \"Method\";\n        SymbolFlags[SymbolFlags[\"Constructor\"] = 16384] = \"Constructor\";\n        SymbolFlags[SymbolFlags[\"GetAccessor\"] = 32768] = \"GetAccessor\";\n        SymbolFlags[SymbolFlags[\"SetAccessor\"] = 65536] = \"SetAccessor\";\n        SymbolFlags[SymbolFlags[\"Signature\"] = 131072] = \"Signature\";\n        SymbolFlags[SymbolFlags[\"TypeParameter\"] = 262144] = \"TypeParameter\";\n        SymbolFlags[SymbolFlags[\"TypeAlias\"] = 524288] = \"TypeAlias\";\n        SymbolFlags[SymbolFlags[\"ExportValue\"] = 1048576] = \"ExportValue\";\n        SymbolFlags[SymbolFlags[\"ExportType\"] = 2097152] = \"ExportType\";\n        SymbolFlags[SymbolFlags[\"ExportNamespace\"] = 4194304] = \"ExportNamespace\";\n        SymbolFlags[SymbolFlags[\"Alias\"] = 8388608] = \"Alias\";\n        SymbolFlags[SymbolFlags[\"Instantiated\"] = 16777216] = \"Instantiated\";\n        SymbolFlags[SymbolFlags[\"Merged\"] = 33554432] = \"Merged\";\n        SymbolFlags[SymbolFlags[\"Transient\"] = 67108864] = \"Transient\";\n        SymbolFlags[SymbolFlags[\"Prototype\"] = 134217728] = \"Prototype\";\n        SymbolFlags[SymbolFlags[\"SyntheticProperty\"] = 268435456] = \"SyntheticProperty\";\n        SymbolFlags[SymbolFlags[\"Optional\"] = 536870912] = \"Optional\";\n        SymbolFlags[SymbolFlags[\"ExportStar\"] = 1073741824] = \"ExportStar\";\n        SymbolFlags[SymbolFlags[\"Enum\"] = 384] = \"Enum\";\n        SymbolFlags[SymbolFlags[\"Variable\"] = 3] = \"Variable\";\n        SymbolFlags[SymbolFlags[\"Value\"] = 107455] = \"Value\";\n        SymbolFlags[SymbolFlags[\"Type\"] = 793064] = \"Type\";\n        SymbolFlags[SymbolFlags[\"Namespace\"] = 1920] = \"Namespace\";\n        SymbolFlags[SymbolFlags[\"Module\"] = 1536] = \"Module\";\n        SymbolFlags[SymbolFlags[\"Accessor\"] = 98304] = \"Accessor\";\n        // Variables can be redeclared, but can not redeclare a block-scoped declaration with the\n        // same name, or any other value that is not a variable, e.g. ValueModule or Class\n        SymbolFlags[SymbolFlags[\"FunctionScopedVariableExcludes\"] = 107454] = \"FunctionScopedVariableExcludes\";\n        // Block-scoped declarations are not allowed to be re-declared\n        // they can not merge with anything in the value space\n        SymbolFlags[SymbolFlags[\"BlockScopedVariableExcludes\"] = 107455] = \"BlockScopedVariableExcludes\";\n        SymbolFlags[SymbolFlags[\"ParameterExcludes\"] = 107455] = \"ParameterExcludes\";\n        SymbolFlags[SymbolFlags[\"PropertyExcludes\"] = 0] = \"PropertyExcludes\";\n        SymbolFlags[SymbolFlags[\"EnumMemberExcludes\"] = 900095] = \"EnumMemberExcludes\";\n        SymbolFlags[SymbolFlags[\"FunctionExcludes\"] = 106927] = \"FunctionExcludes\";\n        SymbolFlags[SymbolFlags[\"ClassExcludes\"] = 899519] = \"ClassExcludes\";\n        SymbolFlags[SymbolFlags[\"InterfaceExcludes\"] = 792968] = \"InterfaceExcludes\";\n        SymbolFlags[SymbolFlags[\"RegularEnumExcludes\"] = 899327] = \"RegularEnumExcludes\";\n        SymbolFlags[SymbolFlags[\"ConstEnumExcludes\"] = 899967] = \"ConstEnumExcludes\";\n        SymbolFlags[SymbolFlags[\"ValueModuleExcludes\"] = 106639] = \"ValueModuleExcludes\";\n        SymbolFlags[SymbolFlags[\"NamespaceModuleExcludes\"] = 0] = \"NamespaceModuleExcludes\";\n        SymbolFlags[SymbolFlags[\"MethodExcludes\"] = 99263] = \"MethodExcludes\";\n        SymbolFlags[SymbolFlags[\"GetAccessorExcludes\"] = 41919] = \"GetAccessorExcludes\";\n        SymbolFlags[SymbolFlags[\"SetAccessorExcludes\"] = 74687] = \"SetAccessorExcludes\";\n        SymbolFlags[SymbolFlags[\"TypeParameterExcludes\"] = 530920] = \"TypeParameterExcludes\";\n        SymbolFlags[SymbolFlags[\"TypeAliasExcludes\"] = 793064] = \"TypeAliasExcludes\";\n        SymbolFlags[SymbolFlags[\"AliasExcludes\"] = 8388608] = \"AliasExcludes\";\n        SymbolFlags[SymbolFlags[\"ModuleMember\"] = 8914931] = \"ModuleMember\";\n        SymbolFlags[SymbolFlags[\"ExportHasLocal\"] = 944] = \"ExportHasLocal\";\n        SymbolFlags[SymbolFlags[\"HasExports\"] = 1952] = \"HasExports\";\n        SymbolFlags[SymbolFlags[\"HasMembers\"] = 6240] = \"HasMembers\";\n        SymbolFlags[SymbolFlags[\"BlockScoped\"] = 418] = \"BlockScoped\";\n        SymbolFlags[SymbolFlags[\"PropertyOrAccessor\"] = 98308] = \"PropertyOrAccessor\";\n        SymbolFlags[SymbolFlags[\"Export\"] = 7340032] = \"Export\";\n        SymbolFlags[SymbolFlags[\"ClassMember\"] = 106500] = \"ClassMember\";\n        /* @internal */\n        // The set of things we consider semantically classifiable.  Used to speed up the LS during\n        // classification.\n        SymbolFlags[SymbolFlags[\"Classifiable\"] = 788448] = \"Classifiable\";\n    })(SymbolFlags = ts.SymbolFlags || (ts.SymbolFlags = {}));\n    /* @internal */\n    var NodeCheckFlags;\n    (function (NodeCheckFlags) {\n        NodeCheckFlags[NodeCheckFlags[\"TypeChecked\"] = 1] = \"TypeChecked\";\n        NodeCheckFlags[NodeCheckFlags[\"LexicalThis\"] = 2] = \"LexicalThis\";\n        NodeCheckFlags[NodeCheckFlags[\"CaptureThis\"] = 4] = \"CaptureThis\";\n        NodeCheckFlags[NodeCheckFlags[\"SuperInstance\"] = 256] = \"SuperInstance\";\n        NodeCheckFlags[NodeCheckFlags[\"SuperStatic\"] = 512] = \"SuperStatic\";\n        NodeCheckFlags[NodeCheckFlags[\"ContextChecked\"] = 1024] = \"ContextChecked\";\n        NodeCheckFlags[NodeCheckFlags[\"AsyncMethodWithSuper\"] = 2048] = \"AsyncMethodWithSuper\";\n        NodeCheckFlags[NodeCheckFlags[\"AsyncMethodWithSuperBinding\"] = 4096] = \"AsyncMethodWithSuperBinding\";\n        NodeCheckFlags[NodeCheckFlags[\"CaptureArguments\"] = 8192] = \"CaptureArguments\";\n        NodeCheckFlags[NodeCheckFlags[\"EnumValuesComputed\"] = 16384] = \"EnumValuesComputed\";\n        NodeCheckFlags[NodeCheckFlags[\"LexicalModuleMergesWithClass\"] = 32768] = \"LexicalModuleMergesWithClass\";\n        NodeCheckFlags[NodeCheckFlags[\"LoopWithCapturedBlockScopedBinding\"] = 65536] = \"LoopWithCapturedBlockScopedBinding\";\n        NodeCheckFlags[NodeCheckFlags[\"CapturedBlockScopedBinding\"] = 131072] = \"CapturedBlockScopedBinding\";\n        NodeCheckFlags[NodeCheckFlags[\"BlockScopedBindingInLoop\"] = 262144] = \"BlockScopedBindingInLoop\";\n        NodeCheckFlags[NodeCheckFlags[\"ClassWithBodyScopedClassBinding\"] = 524288] = \"ClassWithBodyScopedClassBinding\";\n        NodeCheckFlags[NodeCheckFlags[\"BodyScopedClassBinding\"] = 1048576] = \"BodyScopedClassBinding\";\n        NodeCheckFlags[NodeCheckFlags[\"NeedsLoopOutParameter\"] = 2097152] = \"NeedsLoopOutParameter\";\n        NodeCheckFlags[NodeCheckFlags[\"AssignmentsMarked\"] = 4194304] = \"AssignmentsMarked\";\n        NodeCheckFlags[NodeCheckFlags[\"ClassWithConstructorReference\"] = 8388608] = \"ClassWithConstructorReference\";\n        NodeCheckFlags[NodeCheckFlags[\"ConstructorReferenceInClass\"] = 16777216] = \"ConstructorReferenceInClass\";\n    })(NodeCheckFlags = ts.NodeCheckFlags || (ts.NodeCheckFlags = {}));\n    var TypeFlags;\n    (function (TypeFlags) {\n        TypeFlags[TypeFlags[\"Any\"] = 1] = \"Any\";\n        TypeFlags[TypeFlags[\"String\"] = 2] = \"String\";\n        TypeFlags[TypeFlags[\"Number\"] = 4] = \"Number\";\n        TypeFlags[TypeFlags[\"Boolean\"] = 8] = \"Boolean\";\n        TypeFlags[TypeFlags[\"Enum\"] = 16] = \"Enum\";\n        TypeFlags[TypeFlags[\"StringLiteral\"] = 32] = \"StringLiteral\";\n        TypeFlags[TypeFlags[\"NumberLiteral\"] = 64] = \"NumberLiteral\";\n        TypeFlags[TypeFlags[\"BooleanLiteral\"] = 128] = \"BooleanLiteral\";\n        TypeFlags[TypeFlags[\"EnumLiteral\"] = 256] = \"EnumLiteral\";\n        TypeFlags[TypeFlags[\"ESSymbol\"] = 512] = \"ESSymbol\";\n        TypeFlags[TypeFlags[\"Void\"] = 1024] = \"Void\";\n        TypeFlags[TypeFlags[\"Undefined\"] = 2048] = \"Undefined\";\n        TypeFlags[TypeFlags[\"Null\"] = 4096] = \"Null\";\n        TypeFlags[TypeFlags[\"Never\"] = 8192] = \"Never\";\n        TypeFlags[TypeFlags[\"TypeParameter\"] = 16384] = \"TypeParameter\";\n        TypeFlags[TypeFlags[\"Object\"] = 32768] = \"Object\";\n        TypeFlags[TypeFlags[\"Union\"] = 65536] = \"Union\";\n        TypeFlags[TypeFlags[\"Intersection\"] = 131072] = \"Intersection\";\n        TypeFlags[TypeFlags[\"Index\"] = 262144] = \"Index\";\n        TypeFlags[TypeFlags[\"IndexedAccess\"] = 524288] = \"IndexedAccess\";\n        /* @internal */\n        TypeFlags[TypeFlags[\"FreshLiteral\"] = 1048576] = \"FreshLiteral\";\n        /* @internal */\n        TypeFlags[TypeFlags[\"ContainsWideningType\"] = 2097152] = \"ContainsWideningType\";\n        /* @internal */\n        TypeFlags[TypeFlags[\"ContainsObjectLiteral\"] = 4194304] = \"ContainsObjectLiteral\";\n        /* @internal */\n        TypeFlags[TypeFlags[\"ContainsAnyFunctionType\"] = 8388608] = \"ContainsAnyFunctionType\";\n        /* @internal */\n        TypeFlags[TypeFlags[\"Nullable\"] = 6144] = \"Nullable\";\n        TypeFlags[TypeFlags[\"Literal\"] = 480] = \"Literal\";\n        TypeFlags[TypeFlags[\"StringOrNumberLiteral\"] = 96] = \"StringOrNumberLiteral\";\n        /* @internal */\n        TypeFlags[TypeFlags[\"DefinitelyFalsy\"] = 7392] = \"DefinitelyFalsy\";\n        TypeFlags[TypeFlags[\"PossiblyFalsy\"] = 7406] = \"PossiblyFalsy\";\n        /* @internal */\n        TypeFlags[TypeFlags[\"Intrinsic\"] = 16015] = \"Intrinsic\";\n        /* @internal */\n        TypeFlags[TypeFlags[\"Primitive\"] = 8190] = \"Primitive\";\n        TypeFlags[TypeFlags[\"StringLike\"] = 262178] = \"StringLike\";\n        TypeFlags[TypeFlags[\"NumberLike\"] = 340] = \"NumberLike\";\n        TypeFlags[TypeFlags[\"BooleanLike\"] = 136] = \"BooleanLike\";\n        TypeFlags[TypeFlags[\"EnumLike\"] = 272] = \"EnumLike\";\n        TypeFlags[TypeFlags[\"UnionOrIntersection\"] = 196608] = \"UnionOrIntersection\";\n        TypeFlags[TypeFlags[\"StructuredType\"] = 229376] = \"StructuredType\";\n        TypeFlags[TypeFlags[\"StructuredOrTypeParameter\"] = 507904] = \"StructuredOrTypeParameter\";\n        TypeFlags[TypeFlags[\"TypeVariable\"] = 540672] = \"TypeVariable\";\n        // 'Narrowable' types are types where narrowing actually narrows.\n        // This *should* be every type other than null, undefined, void, and never\n        TypeFlags[TypeFlags[\"Narrowable\"] = 1033215] = \"Narrowable\";\n        TypeFlags[TypeFlags[\"NotUnionOrUnit\"] = 33281] = \"NotUnionOrUnit\";\n        /* @internal */\n        TypeFlags[TypeFlags[\"RequiresWidening\"] = 6291456] = \"RequiresWidening\";\n        /* @internal */\n        TypeFlags[TypeFlags[\"PropagatingFlags\"] = 14680064] = \"PropagatingFlags\";\n    })(TypeFlags = ts.TypeFlags || (ts.TypeFlags = {}));\n    var ObjectFlags;\n    (function (ObjectFlags) {\n        ObjectFlags[ObjectFlags[\"Class\"] = 1] = \"Class\";\n        ObjectFlags[ObjectFlags[\"Interface\"] = 2] = \"Interface\";\n        ObjectFlags[ObjectFlags[\"Reference\"] = 4] = \"Reference\";\n        ObjectFlags[ObjectFlags[\"Tuple\"] = 8] = \"Tuple\";\n        ObjectFlags[ObjectFlags[\"Anonymous\"] = 16] = \"Anonymous\";\n        ObjectFlags[ObjectFlags[\"Mapped\"] = 32] = \"Mapped\";\n        ObjectFlags[ObjectFlags[\"Instantiated\"] = 64] = \"Instantiated\";\n        ObjectFlags[ObjectFlags[\"ObjectLiteral\"] = 128] = \"ObjectLiteral\";\n        ObjectFlags[ObjectFlags[\"EvolvingArray\"] = 256] = \"EvolvingArray\";\n        ObjectFlags[ObjectFlags[\"ObjectLiteralPatternWithComputedProperties\"] = 512] = \"ObjectLiteralPatternWithComputedProperties\";\n        ObjectFlags[ObjectFlags[\"ClassOrInterface\"] = 3] = \"ClassOrInterface\";\n    })(ObjectFlags = ts.ObjectFlags || (ts.ObjectFlags = {}));\n    var SignatureKind;\n    (function (SignatureKind) {\n        SignatureKind[SignatureKind[\"Call\"] = 0] = \"Call\";\n        SignatureKind[SignatureKind[\"Construct\"] = 1] = \"Construct\";\n    })(SignatureKind = ts.SignatureKind || (ts.SignatureKind = {}));\n    var IndexKind;\n    (function (IndexKind) {\n        IndexKind[IndexKind[\"String\"] = 0] = \"String\";\n        IndexKind[IndexKind[\"Number\"] = 1] = \"Number\";\n    })(IndexKind = ts.IndexKind || (ts.IndexKind = {}));\n    /* @internal */\n    var SpecialPropertyAssignmentKind;\n    (function (SpecialPropertyAssignmentKind) {\n        SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind[\"None\"] = 0] = \"None\";\n        /// exports.name = expr\n        SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind[\"ExportsProperty\"] = 1] = \"ExportsProperty\";\n        /// module.exports = expr\n        SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind[\"ModuleExports\"] = 2] = \"ModuleExports\";\n        /// className.prototype.name = expr\n        SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind[\"PrototypeProperty\"] = 3] = \"PrototypeProperty\";\n        /// this.name = expr\n        SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind[\"ThisProperty\"] = 4] = \"ThisProperty\";\n    })(SpecialPropertyAssignmentKind = ts.SpecialPropertyAssignmentKind || (ts.SpecialPropertyAssignmentKind = {}));\n    var DiagnosticCategory;\n    (function (DiagnosticCategory) {\n        DiagnosticCategory[DiagnosticCategory[\"Warning\"] = 0] = \"Warning\";\n        DiagnosticCategory[DiagnosticCategory[\"Error\"] = 1] = \"Error\";\n        DiagnosticCategory[DiagnosticCategory[\"Message\"] = 2] = \"Message\";\n    })(DiagnosticCategory = ts.DiagnosticCategory || (ts.DiagnosticCategory = {}));\n    var ModuleResolutionKind;\n    (function (ModuleResolutionKind) {\n        ModuleResolutionKind[ModuleResolutionKind[\"Classic\"] = 1] = \"Classic\";\n        ModuleResolutionKind[ModuleResolutionKind[\"NodeJs\"] = 2] = \"NodeJs\";\n    })(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));\n    var ModuleKind;\n    (function (ModuleKind) {\n        ModuleKind[ModuleKind[\"None\"] = 0] = \"None\";\n        ModuleKind[ModuleKind[\"CommonJS\"] = 1] = \"CommonJS\";\n        ModuleKind[ModuleKind[\"AMD\"] = 2] = \"AMD\";\n        ModuleKind[ModuleKind[\"UMD\"] = 3] = \"UMD\";\n        ModuleKind[ModuleKind[\"System\"] = 4] = \"System\";\n        ModuleKind[ModuleKind[\"ES2015\"] = 5] = \"ES2015\";\n    })(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));\n    var JsxEmit;\n    (function (JsxEmit) {\n        JsxEmit[JsxEmit[\"None\"] = 0] = \"None\";\n        JsxEmit[JsxEmit[\"Preserve\"] = 1] = \"Preserve\";\n        JsxEmit[JsxEmit[\"React\"] = 2] = \"React\";\n    })(JsxEmit = ts.JsxEmit || (ts.JsxEmit = {}));\n    var NewLineKind;\n    (function (NewLineKind) {\n        NewLineKind[NewLineKind[\"CarriageReturnLineFeed\"] = 0] = \"CarriageReturnLineFeed\";\n        NewLineKind[NewLineKind[\"LineFeed\"] = 1] = \"LineFeed\";\n    })(NewLineKind = ts.NewLineKind || (ts.NewLineKind = {}));\n    var ScriptKind;\n    (function (ScriptKind) {\n        ScriptKind[ScriptKind[\"Unknown\"] = 0] = \"Unknown\";\n        ScriptKind[ScriptKind[\"JS\"] = 1] = \"JS\";\n        ScriptKind[ScriptKind[\"JSX\"] = 2] = \"JSX\";\n        ScriptKind[ScriptKind[\"TS\"] = 3] = \"TS\";\n        ScriptKind[ScriptKind[\"TSX\"] = 4] = \"TSX\";\n    })(ScriptKind = ts.ScriptKind || (ts.ScriptKind = {}));\n    var ScriptTarget;\n    (function (ScriptTarget) {\n        ScriptTarget[ScriptTarget[\"ES3\"] = 0] = \"ES3\";\n        ScriptTarget[ScriptTarget[\"ES5\"] = 1] = \"ES5\";\n        ScriptTarget[ScriptTarget[\"ES2015\"] = 2] = \"ES2015\";\n        ScriptTarget[ScriptTarget[\"ES2016\"] = 3] = \"ES2016\";\n        ScriptTarget[ScriptTarget[\"ES2017\"] = 4] = \"ES2017\";\n        ScriptTarget[ScriptTarget[\"ESNext\"] = 5] = \"ESNext\";\n        ScriptTarget[ScriptTarget[\"Latest\"] = 5] = \"Latest\";\n    })(ScriptTarget = ts.ScriptTarget || (ts.ScriptTarget = {}));\n    var LanguageVariant;\n    (function (LanguageVariant) {\n        LanguageVariant[LanguageVariant[\"Standard\"] = 0] = \"Standard\";\n        LanguageVariant[LanguageVariant[\"JSX\"] = 1] = \"JSX\";\n    })(LanguageVariant = ts.LanguageVariant || (ts.LanguageVariant = {}));\n    /* @internal */\n    var DiagnosticStyle;\n    (function (DiagnosticStyle) {\n        DiagnosticStyle[DiagnosticStyle[\"Simple\"] = 0] = \"Simple\";\n        DiagnosticStyle[DiagnosticStyle[\"Pretty\"] = 1] = \"Pretty\";\n    })(DiagnosticStyle = ts.DiagnosticStyle || (ts.DiagnosticStyle = {}));\n    var WatchDirectoryFlags;\n    (function (WatchDirectoryFlags) {\n        WatchDirectoryFlags[WatchDirectoryFlags[\"None\"] = 0] = \"None\";\n        WatchDirectoryFlags[WatchDirectoryFlags[\"Recursive\"] = 1] = \"Recursive\";\n    })(WatchDirectoryFlags = ts.WatchDirectoryFlags || (ts.WatchDirectoryFlags = {}));\n    /* @internal */\n    var CharacterCodes;\n    (function (CharacterCodes) {\n        CharacterCodes[CharacterCodes[\"nullCharacter\"] = 0] = \"nullCharacter\";\n        CharacterCodes[CharacterCodes[\"maxAsciiCharacter\"] = 127] = \"maxAsciiCharacter\";\n        CharacterCodes[CharacterCodes[\"lineFeed\"] = 10] = \"lineFeed\";\n        CharacterCodes[CharacterCodes[\"carriageReturn\"] = 13] = \"carriageReturn\";\n        CharacterCodes[CharacterCodes[\"lineSeparator\"] = 8232] = \"lineSeparator\";\n        CharacterCodes[CharacterCodes[\"paragraphSeparator\"] = 8233] = \"paragraphSeparator\";\n        CharacterCodes[CharacterCodes[\"nextLine\"] = 133] = \"nextLine\";\n        // Unicode 3.0 space characters\n        CharacterCodes[CharacterCodes[\"space\"] = 32] = \"space\";\n        CharacterCodes[CharacterCodes[\"nonBreakingSpace\"] = 160] = \"nonBreakingSpace\";\n        CharacterCodes[CharacterCodes[\"enQuad\"] = 8192] = \"enQuad\";\n        CharacterCodes[CharacterCodes[\"emQuad\"] = 8193] = \"emQuad\";\n        CharacterCodes[CharacterCodes[\"enSpace\"] = 8194] = \"enSpace\";\n        CharacterCodes[CharacterCodes[\"emSpace\"] = 8195] = \"emSpace\";\n        CharacterCodes[CharacterCodes[\"threePerEmSpace\"] = 8196] = \"threePerEmSpace\";\n        CharacterCodes[CharacterCodes[\"fourPerEmSpace\"] = 8197] = \"fourPerEmSpace\";\n        CharacterCodes[CharacterCodes[\"sixPerEmSpace\"] = 8198] = \"sixPerEmSpace\";\n        CharacterCodes[CharacterCodes[\"figureSpace\"] = 8199] = \"figureSpace\";\n        CharacterCodes[CharacterCodes[\"punctuationSpace\"] = 8200] = \"punctuationSpace\";\n        CharacterCodes[CharacterCodes[\"thinSpace\"] = 8201] = \"thinSpace\";\n        CharacterCodes[CharacterCodes[\"hairSpace\"] = 8202] = \"hairSpace\";\n        CharacterCodes[CharacterCodes[\"zeroWidthSpace\"] = 8203] = \"zeroWidthSpace\";\n        CharacterCodes[CharacterCodes[\"narrowNoBreakSpace\"] = 8239] = \"narrowNoBreakSpace\";\n        CharacterCodes[CharacterCodes[\"ideographicSpace\"] = 12288] = \"ideographicSpace\";\n        CharacterCodes[CharacterCodes[\"mathematicalSpace\"] = 8287] = \"mathematicalSpace\";\n        CharacterCodes[CharacterCodes[\"ogham\"] = 5760] = \"ogham\";\n        CharacterCodes[CharacterCodes[\"_\"] = 95] = \"_\";\n        CharacterCodes[CharacterCodes[\"$\"] = 36] = \"$\";\n        CharacterCodes[CharacterCodes[\"_0\"] = 48] = \"_0\";\n        CharacterCodes[CharacterCodes[\"_1\"] = 49] = \"_1\";\n        CharacterCodes[CharacterCodes[\"_2\"] = 50] = \"_2\";\n        CharacterCodes[CharacterCodes[\"_3\"] = 51] = \"_3\";\n        CharacterCodes[CharacterCodes[\"_4\"] = 52] = \"_4\";\n        CharacterCodes[CharacterCodes[\"_5\"] = 53] = \"_5\";\n        CharacterCodes[CharacterCodes[\"_6\"] = 54] = \"_6\";\n        CharacterCodes[CharacterCodes[\"_7\"] = 55] = \"_7\";\n        CharacterCodes[CharacterCodes[\"_8\"] = 56] = \"_8\";\n        CharacterCodes[CharacterCodes[\"_9\"] = 57] = \"_9\";\n        CharacterCodes[CharacterCodes[\"a\"] = 97] = \"a\";\n        CharacterCodes[CharacterCodes[\"b\"] = 98] = \"b\";\n        CharacterCodes[CharacterCodes[\"c\"] = 99] = \"c\";\n        CharacterCodes[CharacterCodes[\"d\"] = 100] = \"d\";\n        CharacterCodes[CharacterCodes[\"e\"] = 101] = \"e\";\n        CharacterCodes[CharacterCodes[\"f\"] = 102] = \"f\";\n        CharacterCodes[CharacterCodes[\"g\"] = 103] = \"g\";\n        CharacterCodes[CharacterCodes[\"h\"] = 104] = \"h\";\n        CharacterCodes[CharacterCodes[\"i\"] = 105] = \"i\";\n        CharacterCodes[CharacterCodes[\"j\"] = 106] = \"j\";\n        CharacterCodes[CharacterCodes[\"k\"] = 107] = \"k\";\n        CharacterCodes[CharacterCodes[\"l\"] = 108] = \"l\";\n        CharacterCodes[CharacterCodes[\"m\"] = 109] = \"m\";\n        CharacterCodes[CharacterCodes[\"n\"] = 110] = \"n\";\n        CharacterCodes[CharacterCodes[\"o\"] = 111] = \"o\";\n        CharacterCodes[CharacterCodes[\"p\"] = 112] = \"p\";\n        CharacterCodes[CharacterCodes[\"q\"] = 113] = \"q\";\n        CharacterCodes[CharacterCodes[\"r\"] = 114] = \"r\";\n        CharacterCodes[CharacterCodes[\"s\"] = 115] = \"s\";\n        CharacterCodes[CharacterCodes[\"t\"] = 116] = \"t\";\n        CharacterCodes[CharacterCodes[\"u\"] = 117] = \"u\";\n        CharacterCodes[CharacterCodes[\"v\"] = 118] = \"v\";\n        CharacterCodes[CharacterCodes[\"w\"] = 119] = \"w\";\n        CharacterCodes[CharacterCodes[\"x\"] = 120] = \"x\";\n        CharacterCodes[CharacterCodes[\"y\"] = 121] = \"y\";\n        CharacterCodes[CharacterCodes[\"z\"] = 122] = \"z\";\n        CharacterCodes[CharacterCodes[\"A\"] = 65] = \"A\";\n        CharacterCodes[CharacterCodes[\"B\"] = 66] = \"B\";\n        CharacterCodes[CharacterCodes[\"C\"] = 67] = \"C\";\n        CharacterCodes[CharacterCodes[\"D\"] = 68] = \"D\";\n        CharacterCodes[CharacterCodes[\"E\"] = 69] = \"E\";\n        CharacterCodes[CharacterCodes[\"F\"] = 70] = \"F\";\n        CharacterCodes[CharacterCodes[\"G\"] = 71] = \"G\";\n        CharacterCodes[CharacterCodes[\"H\"] = 72] = \"H\";\n        CharacterCodes[CharacterCodes[\"I\"] = 73] = \"I\";\n        CharacterCodes[CharacterCodes[\"J\"] = 74] = \"J\";\n        CharacterCodes[CharacterCodes[\"K\"] = 75] = \"K\";\n        CharacterCodes[CharacterCodes[\"L\"] = 76] = \"L\";\n        CharacterCodes[CharacterCodes[\"M\"] = 77] = \"M\";\n        CharacterCodes[CharacterCodes[\"N\"] = 78] = \"N\";\n        CharacterCodes[CharacterCodes[\"O\"] = 79] = \"O\";\n        CharacterCodes[CharacterCodes[\"P\"] = 80] = \"P\";\n        CharacterCodes[CharacterCodes[\"Q\"] = 81] = \"Q\";\n        CharacterCodes[CharacterCodes[\"R\"] = 82] = \"R\";\n        CharacterCodes[CharacterCodes[\"S\"] = 83] = \"S\";\n        CharacterCodes[CharacterCodes[\"T\"] = 84] = \"T\";\n        CharacterCodes[CharacterCodes[\"U\"] = 85] = \"U\";\n        CharacterCodes[CharacterCodes[\"V\"] = 86] = \"V\";\n        CharacterCodes[CharacterCodes[\"W\"] = 87] = \"W\";\n        CharacterCodes[CharacterCodes[\"X\"] = 88] = \"X\";\n        CharacterCodes[CharacterCodes[\"Y\"] = 89] = \"Y\";\n        CharacterCodes[CharacterCodes[\"Z\"] = 90] = \"Z\";\n        CharacterCodes[CharacterCodes[\"ampersand\"] = 38] = \"ampersand\";\n        CharacterCodes[CharacterCodes[\"asterisk\"] = 42] = \"asterisk\";\n        CharacterCodes[CharacterCodes[\"at\"] = 64] = \"at\";\n        CharacterCodes[CharacterCodes[\"backslash\"] = 92] = \"backslash\";\n        CharacterCodes[CharacterCodes[\"backtick\"] = 96] = \"backtick\";\n        CharacterCodes[CharacterCodes[\"bar\"] = 124] = \"bar\";\n        CharacterCodes[CharacterCodes[\"caret\"] = 94] = \"caret\";\n        CharacterCodes[CharacterCodes[\"closeBrace\"] = 125] = \"closeBrace\";\n        CharacterCodes[CharacterCodes[\"closeBracket\"] = 93] = \"closeBracket\";\n        CharacterCodes[CharacterCodes[\"closeParen\"] = 41] = \"closeParen\";\n        CharacterCodes[CharacterCodes[\"colon\"] = 58] = \"colon\";\n        CharacterCodes[CharacterCodes[\"comma\"] = 44] = \"comma\";\n        CharacterCodes[CharacterCodes[\"dot\"] = 46] = \"dot\";\n        CharacterCodes[CharacterCodes[\"doubleQuote\"] = 34] = \"doubleQuote\";\n        CharacterCodes[CharacterCodes[\"equals\"] = 61] = \"equals\";\n        CharacterCodes[CharacterCodes[\"exclamation\"] = 33] = \"exclamation\";\n        CharacterCodes[CharacterCodes[\"greaterThan\"] = 62] = \"greaterThan\";\n        CharacterCodes[CharacterCodes[\"hash\"] = 35] = \"hash\";\n        CharacterCodes[CharacterCodes[\"lessThan\"] = 60] = \"lessThan\";\n        CharacterCodes[CharacterCodes[\"minus\"] = 45] = \"minus\";\n        CharacterCodes[CharacterCodes[\"openBrace\"] = 123] = \"openBrace\";\n        CharacterCodes[CharacterCodes[\"openBracket\"] = 91] = \"openBracket\";\n        CharacterCodes[CharacterCodes[\"openParen\"] = 40] = \"openParen\";\n        CharacterCodes[CharacterCodes[\"percent\"] = 37] = \"percent\";\n        CharacterCodes[CharacterCodes[\"plus\"] = 43] = \"plus\";\n        CharacterCodes[CharacterCodes[\"question\"] = 63] = \"question\";\n        CharacterCodes[CharacterCodes[\"semicolon\"] = 59] = \"semicolon\";\n        CharacterCodes[CharacterCodes[\"singleQuote\"] = 39] = \"singleQuote\";\n        CharacterCodes[CharacterCodes[\"slash\"] = 47] = \"slash\";\n        CharacterCodes[CharacterCodes[\"tilde\"] = 126] = \"tilde\";\n        CharacterCodes[CharacterCodes[\"backspace\"] = 8] = \"backspace\";\n        CharacterCodes[CharacterCodes[\"formFeed\"] = 12] = \"formFeed\";\n        CharacterCodes[CharacterCodes[\"byteOrderMark\"] = 65279] = \"byteOrderMark\";\n        CharacterCodes[CharacterCodes[\"tab\"] = 9] = \"tab\";\n        CharacterCodes[CharacterCodes[\"verticalTab\"] = 11] = \"verticalTab\";\n    })(CharacterCodes = ts.CharacterCodes || (ts.CharacterCodes = {}));\n    var Extension;\n    (function (Extension) {\n        Extension[Extension[\"Ts\"] = 0] = \"Ts\";\n        Extension[Extension[\"Tsx\"] = 1] = \"Tsx\";\n        Extension[Extension[\"Dts\"] = 2] = \"Dts\";\n        Extension[Extension[\"Js\"] = 3] = \"Js\";\n        Extension[Extension[\"Jsx\"] = 4] = \"Jsx\";\n        Extension[Extension[\"LastTypeScriptExtension\"] = 2] = \"LastTypeScriptExtension\";\n    })(Extension = ts.Extension || (ts.Extension = {}));\n    /* @internal */\n    var TransformFlags;\n    (function (TransformFlags) {\n        TransformFlags[TransformFlags[\"None\"] = 0] = \"None\";\n        // Facts\n        // - Flags used to indicate that a node or subtree contains syntax that requires transformation.\n        TransformFlags[TransformFlags[\"TypeScript\"] = 1] = \"TypeScript\";\n        TransformFlags[TransformFlags[\"ContainsTypeScript\"] = 2] = \"ContainsTypeScript\";\n        TransformFlags[TransformFlags[\"ContainsJsx\"] = 4] = \"ContainsJsx\";\n        TransformFlags[TransformFlags[\"ContainsESNext\"] = 8] = \"ContainsESNext\";\n        TransformFlags[TransformFlags[\"ContainsES2017\"] = 16] = \"ContainsES2017\";\n        TransformFlags[TransformFlags[\"ContainsES2016\"] = 32] = \"ContainsES2016\";\n        TransformFlags[TransformFlags[\"ES2015\"] = 64] = \"ES2015\";\n        TransformFlags[TransformFlags[\"ContainsES2015\"] = 128] = \"ContainsES2015\";\n        TransformFlags[TransformFlags[\"Generator\"] = 256] = \"Generator\";\n        TransformFlags[TransformFlags[\"ContainsGenerator\"] = 512] = \"ContainsGenerator\";\n        TransformFlags[TransformFlags[\"DestructuringAssignment\"] = 1024] = \"DestructuringAssignment\";\n        TransformFlags[TransformFlags[\"ContainsDestructuringAssignment\"] = 2048] = \"ContainsDestructuringAssignment\";\n        // Markers\n        // - Flags used to indicate that a subtree contains a specific transformation.\n        TransformFlags[TransformFlags[\"ContainsDecorators\"] = 4096] = \"ContainsDecorators\";\n        TransformFlags[TransformFlags[\"ContainsPropertyInitializer\"] = 8192] = \"ContainsPropertyInitializer\";\n        TransformFlags[TransformFlags[\"ContainsLexicalThis\"] = 16384] = \"ContainsLexicalThis\";\n        TransformFlags[TransformFlags[\"ContainsCapturedLexicalThis\"] = 32768] = \"ContainsCapturedLexicalThis\";\n        TransformFlags[TransformFlags[\"ContainsLexicalThisInComputedPropertyName\"] = 65536] = \"ContainsLexicalThisInComputedPropertyName\";\n        TransformFlags[TransformFlags[\"ContainsDefaultValueAssignments\"] = 131072] = \"ContainsDefaultValueAssignments\";\n        TransformFlags[TransformFlags[\"ContainsParameterPropertyAssignments\"] = 262144] = \"ContainsParameterPropertyAssignments\";\n        TransformFlags[TransformFlags[\"ContainsSpread\"] = 524288] = \"ContainsSpread\";\n        TransformFlags[TransformFlags[\"ContainsObjectSpread\"] = 1048576] = \"ContainsObjectSpread\";\n        TransformFlags[TransformFlags[\"ContainsRest\"] = 524288] = \"ContainsRest\";\n        TransformFlags[TransformFlags[\"ContainsObjectRest\"] = 1048576] = \"ContainsObjectRest\";\n        TransformFlags[TransformFlags[\"ContainsComputedPropertyName\"] = 2097152] = \"ContainsComputedPropertyName\";\n        TransformFlags[TransformFlags[\"ContainsBlockScopedBinding\"] = 4194304] = \"ContainsBlockScopedBinding\";\n        TransformFlags[TransformFlags[\"ContainsBindingPattern\"] = 8388608] = \"ContainsBindingPattern\";\n        TransformFlags[TransformFlags[\"ContainsYield\"] = 16777216] = \"ContainsYield\";\n        TransformFlags[TransformFlags[\"ContainsHoistedDeclarationOrCompletion\"] = 33554432] = \"ContainsHoistedDeclarationOrCompletion\";\n        TransformFlags[TransformFlags[\"HasComputedFlags\"] = 536870912] = \"HasComputedFlags\";\n        // Assertions\n        // - Bitmasks that are used to assert facts about the syntax of a node and its subtree.\n        TransformFlags[TransformFlags[\"AssertTypeScript\"] = 3] = \"AssertTypeScript\";\n        TransformFlags[TransformFlags[\"AssertJsx\"] = 4] = \"AssertJsx\";\n        TransformFlags[TransformFlags[\"AssertESNext\"] = 8] = \"AssertESNext\";\n        TransformFlags[TransformFlags[\"AssertES2017\"] = 16] = \"AssertES2017\";\n        TransformFlags[TransformFlags[\"AssertES2016\"] = 32] = \"AssertES2016\";\n        TransformFlags[TransformFlags[\"AssertES2015\"] = 192] = \"AssertES2015\";\n        TransformFlags[TransformFlags[\"AssertGenerator\"] = 768] = \"AssertGenerator\";\n        TransformFlags[TransformFlags[\"AssertDestructuringAssignment\"] = 3072] = \"AssertDestructuringAssignment\";\n        // Scope Exclusions\n        // - Bitmasks that exclude flags from propagating out of a specific context\n        //   into the subtree flags of their container.\n        TransformFlags[TransformFlags[\"NodeExcludes\"] = 536872257] = \"NodeExcludes\";\n        TransformFlags[TransformFlags[\"ArrowFunctionExcludes\"] = 601249089] = \"ArrowFunctionExcludes\";\n        TransformFlags[TransformFlags[\"FunctionExcludes\"] = 601281857] = \"FunctionExcludes\";\n        TransformFlags[TransformFlags[\"ConstructorExcludes\"] = 601015617] = \"ConstructorExcludes\";\n        TransformFlags[TransformFlags[\"MethodOrAccessorExcludes\"] = 601015617] = \"MethodOrAccessorExcludes\";\n        TransformFlags[TransformFlags[\"ClassExcludes\"] = 539358529] = \"ClassExcludes\";\n        TransformFlags[TransformFlags[\"ModuleExcludes\"] = 574674241] = \"ModuleExcludes\";\n        TransformFlags[TransformFlags[\"TypeExcludes\"] = -3] = \"TypeExcludes\";\n        TransformFlags[TransformFlags[\"ObjectLiteralExcludes\"] = 540087617] = \"ObjectLiteralExcludes\";\n        TransformFlags[TransformFlags[\"ArrayLiteralOrCallOrNewExcludes\"] = 537396545] = \"ArrayLiteralOrCallOrNewExcludes\";\n        TransformFlags[TransformFlags[\"VariableDeclarationListExcludes\"] = 546309441] = \"VariableDeclarationListExcludes\";\n        TransformFlags[TransformFlags[\"ParameterExcludes\"] = 536872257] = \"ParameterExcludes\";\n        TransformFlags[TransformFlags[\"CatchClauseExcludes\"] = 537920833] = \"CatchClauseExcludes\";\n        TransformFlags[TransformFlags[\"BindingPatternExcludes\"] = 537396545] = \"BindingPatternExcludes\";\n        // Masks\n        // - Additional bitmasks\n        TransformFlags[TransformFlags[\"TypeScriptClassSyntaxMask\"] = 274432] = \"TypeScriptClassSyntaxMask\";\n        TransformFlags[TransformFlags[\"ES2015FunctionSyntaxMask\"] = 163840] = \"ES2015FunctionSyntaxMask\";\n    })(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {}));\n    /* @internal */\n    var EmitFlags;\n    (function (EmitFlags) {\n        EmitFlags[EmitFlags[\"SingleLine\"] = 1] = \"SingleLine\";\n        EmitFlags[EmitFlags[\"AdviseOnEmitNode\"] = 2] = \"AdviseOnEmitNode\";\n        EmitFlags[EmitFlags[\"NoSubstitution\"] = 4] = \"NoSubstitution\";\n        EmitFlags[EmitFlags[\"CapturesThis\"] = 8] = \"CapturesThis\";\n        EmitFlags[EmitFlags[\"NoLeadingSourceMap\"] = 16] = \"NoLeadingSourceMap\";\n        EmitFlags[EmitFlags[\"NoTrailingSourceMap\"] = 32] = \"NoTrailingSourceMap\";\n        EmitFlags[EmitFlags[\"NoSourceMap\"] = 48] = \"NoSourceMap\";\n        EmitFlags[EmitFlags[\"NoNestedSourceMaps\"] = 64] = \"NoNestedSourceMaps\";\n        EmitFlags[EmitFlags[\"NoTokenLeadingSourceMaps\"] = 128] = \"NoTokenLeadingSourceMaps\";\n        EmitFlags[EmitFlags[\"NoTokenTrailingSourceMaps\"] = 256] = \"NoTokenTrailingSourceMaps\";\n        EmitFlags[EmitFlags[\"NoTokenSourceMaps\"] = 384] = \"NoTokenSourceMaps\";\n        EmitFlags[EmitFlags[\"NoLeadingComments\"] = 512] = \"NoLeadingComments\";\n        EmitFlags[EmitFlags[\"NoTrailingComments\"] = 1024] = \"NoTrailingComments\";\n        EmitFlags[EmitFlags[\"NoComments\"] = 1536] = \"NoComments\";\n        EmitFlags[EmitFlags[\"NoNestedComments\"] = 2048] = \"NoNestedComments\";\n        EmitFlags[EmitFlags[\"HelperName\"] = 4096] = \"HelperName\";\n        EmitFlags[EmitFlags[\"ExportName\"] = 8192] = \"ExportName\";\n        EmitFlags[EmitFlags[\"LocalName\"] = 16384] = \"LocalName\";\n        EmitFlags[EmitFlags[\"Indented\"] = 32768] = \"Indented\";\n        EmitFlags[EmitFlags[\"NoIndentation\"] = 65536] = \"NoIndentation\";\n        EmitFlags[EmitFlags[\"AsyncFunctionBody\"] = 131072] = \"AsyncFunctionBody\";\n        EmitFlags[EmitFlags[\"ReuseTempVariableScope\"] = 262144] = \"ReuseTempVariableScope\";\n        EmitFlags[EmitFlags[\"CustomPrologue\"] = 524288] = \"CustomPrologue\";\n        EmitFlags[EmitFlags[\"NoHoisting\"] = 1048576] = \"NoHoisting\";\n        EmitFlags[EmitFlags[\"HasEndOfDeclarationMarker\"] = 2097152] = \"HasEndOfDeclarationMarker\";\n    })(EmitFlags = ts.EmitFlags || (ts.EmitFlags = {}));\n    /**\n     * Used by the checker, this enum keeps track of external emit helpers that should be type\n     * checked.\n     */\n    /* @internal */\n    var ExternalEmitHelpers;\n    (function (ExternalEmitHelpers) {\n        ExternalEmitHelpers[ExternalEmitHelpers[\"Extends\"] = 1] = \"Extends\";\n        ExternalEmitHelpers[ExternalEmitHelpers[\"Assign\"] = 2] = \"Assign\";\n        ExternalEmitHelpers[ExternalEmitHelpers[\"Rest\"] = 4] = \"Rest\";\n        ExternalEmitHelpers[ExternalEmitHelpers[\"Decorate\"] = 8] = \"Decorate\";\n        ExternalEmitHelpers[ExternalEmitHelpers[\"Metadata\"] = 16] = \"Metadata\";\n        ExternalEmitHelpers[ExternalEmitHelpers[\"Param\"] = 32] = \"Param\";\n        ExternalEmitHelpers[ExternalEmitHelpers[\"Awaiter\"] = 64] = \"Awaiter\";\n        ExternalEmitHelpers[ExternalEmitHelpers[\"Generator\"] = 128] = \"Generator\";\n        ExternalEmitHelpers[ExternalEmitHelpers[\"FirstEmitHelper\"] = 1] = \"FirstEmitHelper\";\n        ExternalEmitHelpers[ExternalEmitHelpers[\"LastEmitHelper\"] = 128] = \"LastEmitHelper\";\n    })(ExternalEmitHelpers = ts.ExternalEmitHelpers || (ts.ExternalEmitHelpers = {}));\n    /* @internal */\n    var EmitContext;\n    (function (EmitContext) {\n        EmitContext[EmitContext[\"SourceFile\"] = 0] = \"SourceFile\";\n        EmitContext[EmitContext[\"Expression\"] = 1] = \"Expression\";\n        EmitContext[EmitContext[\"IdentifierName\"] = 2] = \"IdentifierName\";\n        EmitContext[EmitContext[\"Unspecified\"] = 3] = \"Unspecified\";\n    })(EmitContext = ts.EmitContext || (ts.EmitContext = {}));\n})(ts || (ts = {}));\n/*@internal*/\nvar ts;\n(function (ts) {\n    /** Gets a timestamp with (at least) ms resolution */\n    ts.timestamp = typeof performance !== \"undefined\" && performance.now ? function () { return performance.now(); } : Date.now ? Date.now : function () { return +(new Date()); };\n})(ts || (ts = {}));\n/*@internal*/\n/** Performance measurements for the compiler. */\n(function (ts) {\n    var performance;\n    (function (performance) {\n        var profilerEvent = typeof onProfilerEvent === \"function\" && onProfilerEvent.profiler === true\n            ? onProfilerEvent\n            : function (_markName) { };\n        var enabled = false;\n        var profilerStart = 0;\n        var counts;\n        var marks;\n        var measures;\n        /**\n         * Marks a performance event.\n         *\n         * @param markName The name of the mark.\n         */\n        function mark(markName) {\n            if (enabled) {\n                marks[markName] = ts.timestamp();\n                counts[markName] = (counts[markName] || 0) + 1;\n                profilerEvent(markName);\n            }\n        }\n        performance.mark = mark;\n        /**\n         * Adds a performance measurement with the specified name.\n         *\n         * @param measureName The name of the performance measurement.\n         * @param startMarkName The name of the starting mark. If not supplied, the point at which the\n         *      profiler was enabled is used.\n         * @param endMarkName The name of the ending mark. If not supplied, the current timestamp is\n         *      used.\n         */\n        function measure(measureName, startMarkName, endMarkName) {\n            if (enabled) {\n                var end = endMarkName && marks[endMarkName] || ts.timestamp();\n                var start = startMarkName && marks[startMarkName] || profilerStart;\n                measures[measureName] = (measures[measureName] || 0) + (end - start);\n            }\n        }\n        performance.measure = measure;\n        /**\n         * Gets the number of times a marker was encountered.\n         *\n         * @param markName The name of the mark.\n         */\n        function getCount(markName) {\n            return counts && counts[markName] || 0;\n        }\n        performance.getCount = getCount;\n        /**\n         * Gets the total duration of all measurements with the supplied name.\n         *\n         * @param measureName The name of the measure whose durations should be accumulated.\n         */\n        function getDuration(measureName) {\n            return measures && measures[measureName] || 0;\n        }\n        performance.getDuration = getDuration;\n        /**\n         * Iterate over each measure, performing some action\n         *\n         * @param cb The action to perform for each measure\n         */\n        function forEachMeasure(cb) {\n            for (var key in measures) {\n                cb(key, measures[key]);\n            }\n        }\n        performance.forEachMeasure = forEachMeasure;\n        /** Enables (and resets) performance measurements for the compiler. */\n        function enable() {\n            counts = ts.createMap();\n            marks = ts.createMap();\n            measures = ts.createMap();\n            enabled = true;\n            profilerStart = ts.timestamp();\n        }\n        performance.enable = enable;\n        /** Disables performance measurements for the compiler. */\n        function disable() {\n            enabled = false;\n        }\n        performance.disable = disable;\n    })(performance = ts.performance || (ts.performance = {}));\n})(ts || (ts = {}));\n/// <reference path=\"types.ts\"/>\n/// <reference path=\"performance.ts\" />\nvar ts;\n(function (ts) {\n    /** The version of the TypeScript compiler release */\n    ts.version = \"2.1.4\";\n})(ts || (ts = {}));\n/* @internal */\n(function (ts) {\n    /**\n     * Ternary values are defined such that\n     * x & y is False if either x or y is False.\n     * x & y is Maybe if either x or y is Maybe, but neither x or y is False.\n     * x & y is True if both x and y are True.\n     * x | y is False if both x and y are False.\n     * x | y is Maybe if either x or y is Maybe, but neither x or y is True.\n     * x | y is True if either x or y is True.\n     */\n    var Ternary;\n    (function (Ternary) {\n        Ternary[Ternary[\"False\"] = 0] = \"False\";\n        Ternary[Ternary[\"Maybe\"] = 1] = \"Maybe\";\n        Ternary[Ternary[\"True\"] = -1] = \"True\";\n    })(Ternary = ts.Ternary || (ts.Ternary = {}));\n    var createObject = Object.create;\n    // More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times.\n    ts.collator = typeof Intl === \"object\" && typeof Intl.Collator === \"function\" ? new Intl.Collator() : undefined;\n    function createMap(template) {\n        var map = createObject(null); // tslint:disable-line:no-null-keyword\n        // Using 'delete' on an object causes V8 to put the object in dictionary mode.\n        // This disables creation of hidden classes, which are expensive when an object is\n        // constantly changing shape.\n        map[\"__\"] = undefined;\n        delete map[\"__\"];\n        // Copies keys/values from template. Note that for..in will not throw if\n        // template is undefined, and instead will just exit the loop.\n        for (var key in template)\n            if (hasOwnProperty.call(template, key)) {\n                map[key] = template[key];\n            }\n        return map;\n    }\n    ts.createMap = createMap;\n    function createFileMap(keyMapper) {\n        var files = createMap();\n        return {\n            get: get,\n            set: set,\n            contains: contains,\n            remove: remove,\n            forEachValue: forEachValueInMap,\n            getKeys: getKeys,\n            clear: clear,\n        };\n        function forEachValueInMap(f) {\n            for (var key in files) {\n                f(key, files[key]);\n            }\n        }\n        function getKeys() {\n            var keys = [];\n            for (var key in files) {\n                keys.push(key);\n            }\n            return keys;\n        }\n        // path should already be well-formed so it does not need to be normalized\n        function get(path) {\n            return files[toKey(path)];\n        }\n        function set(path, value) {\n            files[toKey(path)] = value;\n        }\n        function contains(path) {\n            return toKey(path) in files;\n        }\n        function remove(path) {\n            var key = toKey(path);\n            delete files[key];\n        }\n        function clear() {\n            files = createMap();\n        }\n        function toKey(path) {\n            return keyMapper ? keyMapper(path) : path;\n        }\n    }\n    ts.createFileMap = createFileMap;\n    function toPath(fileName, basePath, getCanonicalFileName) {\n        var nonCanonicalizedPath = isRootedDiskPath(fileName)\n            ? normalizePath(fileName)\n            : getNormalizedAbsolutePath(fileName, basePath);\n        return getCanonicalFileName(nonCanonicalizedPath);\n    }\n    ts.toPath = toPath;\n    var Comparison;\n    (function (Comparison) {\n        Comparison[Comparison[\"LessThan\"] = -1] = \"LessThan\";\n        Comparison[Comparison[\"EqualTo\"] = 0] = \"EqualTo\";\n        Comparison[Comparison[\"GreaterThan\"] = 1] = \"GreaterThan\";\n    })(Comparison = ts.Comparison || (ts.Comparison = {}));\n    /**\n     * Iterates through 'array' by index and performs the callback on each element of array until the callback\n     * returns a truthy value, then returns that value.\n     * If no such value is found, the callback is applied to each element of array and undefined is returned.\n     */\n    function forEach(array, callback) {\n        if (array) {\n            for (var i = 0, len = array.length; i < len; i++) {\n                var result = callback(array[i], i);\n                if (result) {\n                    return result;\n                }\n            }\n        }\n        return undefined;\n    }\n    ts.forEach = forEach;\n    function zipWith(arrayA, arrayB, callback) {\n        Debug.assert(arrayA.length === arrayB.length);\n        for (var i = 0; i < arrayA.length; i++) {\n            callback(arrayA[i], arrayB[i], i);\n        }\n    }\n    ts.zipWith = zipWith;\n    /**\n     * Iterates through `array` by index and performs the callback on each element of array until the callback\n     * returns a falsey value, then returns false.\n     * If no such value is found, the callback is applied to each element of array and `true` is returned.\n     */\n    function every(array, callback) {\n        if (array) {\n            for (var i = 0, len = array.length; i < len; i++) {\n                if (!callback(array[i], i)) {\n                    return false;\n                }\n            }\n        }\n        return true;\n    }\n    ts.every = every;\n    /** Works like Array.prototype.find, returning `undefined` if no element satisfying the predicate is found. */\n    function find(array, predicate) {\n        for (var i = 0, len = array.length; i < len; i++) {\n            var value = array[i];\n            if (predicate(value, i)) {\n                return value;\n            }\n        }\n        return undefined;\n    }\n    ts.find = find;\n    /**\n     * Returns the first truthy result of `callback`, or else fails.\n     * This is like `forEach`, but never returns undefined.\n     */\n    function findMap(array, callback) {\n        for (var i = 0, len = array.length; i < len; i++) {\n            var result = callback(array[i], i);\n            if (result) {\n                return result;\n            }\n        }\n        Debug.fail();\n    }\n    ts.findMap = findMap;\n    function contains(array, value) {\n        if (array) {\n            for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {\n                var v = array_1[_i];\n                if (v === value) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n    ts.contains = contains;\n    function indexOf(array, value) {\n        if (array) {\n            for (var i = 0, len = array.length; i < len; i++) {\n                if (array[i] === value) {\n                    return i;\n                }\n            }\n        }\n        return -1;\n    }\n    ts.indexOf = indexOf;\n    function indexOfAnyCharCode(text, charCodes, start) {\n        for (var i = start || 0, len = text.length; i < len; i++) {\n            if (contains(charCodes, text.charCodeAt(i))) {\n                return i;\n            }\n        }\n        return -1;\n    }\n    ts.indexOfAnyCharCode = indexOfAnyCharCode;\n    function countWhere(array, predicate) {\n        var count = 0;\n        if (array) {\n            for (var i = 0; i < array.length; i++) {\n                var v = array[i];\n                if (predicate(v, i)) {\n                    count++;\n                }\n            }\n        }\n        return count;\n    }\n    ts.countWhere = countWhere;\n    function filter(array, f) {\n        if (array) {\n            var len = array.length;\n            var i = 0;\n            while (i < len && f(array[i]))\n                i++;\n            if (i < len) {\n                var result = array.slice(0, i);\n                i++;\n                while (i < len) {\n                    var item = array[i];\n                    if (f(item)) {\n                        result.push(item);\n                    }\n                    i++;\n                }\n                return result;\n            }\n        }\n        return array;\n    }\n    ts.filter = filter;\n    function removeWhere(array, f) {\n        var outIndex = 0;\n        for (var _i = 0, array_2 = array; _i < array_2.length; _i++) {\n            var item = array_2[_i];\n            if (!f(item)) {\n                array[outIndex] = item;\n                outIndex++;\n            }\n        }\n        if (outIndex !== array.length) {\n            array.length = outIndex;\n            return true;\n        }\n        return false;\n    }\n    ts.removeWhere = removeWhere;\n    function filterMutate(array, f) {\n        var outIndex = 0;\n        for (var _i = 0, array_3 = array; _i < array_3.length; _i++) {\n            var item = array_3[_i];\n            if (f(item)) {\n                array[outIndex] = item;\n                outIndex++;\n            }\n        }\n        array.length = outIndex;\n    }\n    ts.filterMutate = filterMutate;\n    function map(array, f) {\n        var result;\n        if (array) {\n            result = [];\n            for (var i = 0; i < array.length; i++) {\n                result.push(f(array[i], i));\n            }\n        }\n        return result;\n    }\n    ts.map = map;\n    // Maps from T to T and avoids allocation if all elements map to themselves\n    function sameMap(array, f) {\n        var result;\n        if (array) {\n            for (var i = 0; i < array.length; i++) {\n                if (result) {\n                    result.push(f(array[i], i));\n                }\n                else {\n                    var item = array[i];\n                    var mapped = f(item, i);\n                    if (item !== mapped) {\n                        result = array.slice(0, i);\n                        result.push(mapped);\n                    }\n                }\n            }\n        }\n        return result || array;\n    }\n    ts.sameMap = sameMap;\n    /**\n     * Flattens an array containing a mix of array or non-array elements.\n     *\n     * @param array The array to flatten.\n     */\n    function flatten(array) {\n        var result;\n        if (array) {\n            result = [];\n            for (var _i = 0, array_4 = array; _i < array_4.length; _i++) {\n                var v = array_4[_i];\n                if (v) {\n                    if (isArray(v)) {\n                        addRange(result, v);\n                    }\n                    else {\n                        result.push(v);\n                    }\n                }\n            }\n        }\n        return result;\n    }\n    ts.flatten = flatten;\n    /**\n     * Maps an array. If the mapped value is an array, it is spread into the result.\n     *\n     * @param array The array to map.\n     * @param mapfn The callback used to map the result into one or more values.\n     */\n    function flatMap(array, mapfn) {\n        var result;\n        if (array) {\n            result = [];\n            for (var i = 0; i < array.length; i++) {\n                var v = mapfn(array[i], i);\n                if (v) {\n                    if (isArray(v)) {\n                        addRange(result, v);\n                    }\n                    else {\n                        result.push(v);\n                    }\n                }\n            }\n        }\n        return result;\n    }\n    ts.flatMap = flatMap;\n    /**\n     * Computes the first matching span of elements and returns a tuple of the first span\n     * and the remaining elements.\n     */\n    function span(array, f) {\n        if (array) {\n            for (var i = 0; i < array.length; i++) {\n                if (!f(array[i], i)) {\n                    return [array.slice(0, i), array.slice(i)];\n                }\n            }\n            return [array.slice(0), []];\n        }\n        return undefined;\n    }\n    ts.span = span;\n    /**\n     * Maps contiguous spans of values with the same key.\n     *\n     * @param array The array to map.\n     * @param keyfn A callback used to select the key for an element.\n     * @param mapfn A callback used to map a contiguous chunk of values to a single value.\n     */\n    function spanMap(array, keyfn, mapfn) {\n        var result;\n        if (array) {\n            result = [];\n            var len = array.length;\n            var previousKey = void 0;\n            var key = void 0;\n            var start = 0;\n            var pos = 0;\n            while (start < len) {\n                while (pos < len) {\n                    var value = array[pos];\n                    key = keyfn(value, pos);\n                    if (pos === 0) {\n                        previousKey = key;\n                    }\n                    else if (key !== previousKey) {\n                        break;\n                    }\n                    pos++;\n                }\n                if (start < pos) {\n                    var v = mapfn(array.slice(start, pos), previousKey, start, pos);\n                    if (v) {\n                        result.push(v);\n                    }\n                    start = pos;\n                }\n                previousKey = key;\n                pos++;\n            }\n        }\n        return result;\n    }\n    ts.spanMap = spanMap;\n    function mapObject(object, f) {\n        var result;\n        if (object) {\n            result = {};\n            for (var _i = 0, _a = getOwnKeys(object); _i < _a.length; _i++) {\n                var v = _a[_i];\n                var _b = f(v, object[v]) || [undefined, undefined], key = _b[0], value = _b[1];\n                if (key !== undefined) {\n                    result[key] = value;\n                }\n            }\n        }\n        return result;\n    }\n    ts.mapObject = mapObject;\n    function some(array, predicate) {\n        if (array) {\n            if (predicate) {\n                for (var _i = 0, array_5 = array; _i < array_5.length; _i++) {\n                    var v = array_5[_i];\n                    if (predicate(v)) {\n                        return true;\n                    }\n                }\n            }\n            else {\n                return array.length > 0;\n            }\n        }\n        return false;\n    }\n    ts.some = some;\n    function concatenate(array1, array2) {\n        if (!some(array2))\n            return array1;\n        if (!some(array1))\n            return array2;\n        return array1.concat(array2);\n    }\n    ts.concatenate = concatenate;\n    // TODO: fixme (N^2) - add optional comparer so collection can be sorted before deduplication.\n    function deduplicate(array, areEqual) {\n        var result;\n        if (array) {\n            result = [];\n            loop: for (var _i = 0, array_6 = array; _i < array_6.length; _i++) {\n                var item = array_6[_i];\n                for (var _a = 0, result_1 = result; _a < result_1.length; _a++) {\n                    var res = result_1[_a];\n                    if (areEqual ? areEqual(res, item) : res === item) {\n                        continue loop;\n                    }\n                }\n                result.push(item);\n            }\n        }\n        return result;\n    }\n    ts.deduplicate = deduplicate;\n    function arrayIsEqualTo(array1, array2, equaler) {\n        if (!array1 || !array2) {\n            return array1 === array2;\n        }\n        if (array1.length !== array2.length) {\n            return false;\n        }\n        for (var i = 0; i < array1.length; i++) {\n            var equals = equaler ? equaler(array1[i], array2[i]) : array1[i] === array2[i];\n            if (!equals) {\n                return false;\n            }\n        }\n        return true;\n    }\n    ts.arrayIsEqualTo = arrayIsEqualTo;\n    function changesAffectModuleResolution(oldOptions, newOptions) {\n        return !oldOptions ||\n            (oldOptions.module !== newOptions.module) ||\n            (oldOptions.moduleResolution !== newOptions.moduleResolution) ||\n            (oldOptions.noResolve !== newOptions.noResolve) ||\n            (oldOptions.target !== newOptions.target) ||\n            (oldOptions.noLib !== newOptions.noLib) ||\n            (oldOptions.jsx !== newOptions.jsx) ||\n            (oldOptions.allowJs !== newOptions.allowJs) ||\n            (oldOptions.rootDir !== newOptions.rootDir) ||\n            (oldOptions.configFilePath !== newOptions.configFilePath) ||\n            (oldOptions.baseUrl !== newOptions.baseUrl) ||\n            (oldOptions.maxNodeModuleJsDepth !== newOptions.maxNodeModuleJsDepth) ||\n            !arrayIsEqualTo(oldOptions.lib, newOptions.lib) ||\n            !arrayIsEqualTo(oldOptions.typeRoots, newOptions.typeRoots) ||\n            !arrayIsEqualTo(oldOptions.rootDirs, newOptions.rootDirs) ||\n            !equalOwnProperties(oldOptions.paths, newOptions.paths);\n    }\n    ts.changesAffectModuleResolution = changesAffectModuleResolution;\n    /**\n     * Compacts an array, removing any falsey elements.\n     */\n    function compact(array) {\n        var result;\n        if (array) {\n            for (var i = 0; i < array.length; i++) {\n                var v = array[i];\n                if (result || !v) {\n                    if (!result) {\n                        result = array.slice(0, i);\n                    }\n                    if (v) {\n                        result.push(v);\n                    }\n                }\n            }\n        }\n        return result || array;\n    }\n    ts.compact = compact;\n    /**\n     * Gets the relative complement of `arrayA` with respect to `b`, returning the elements that\n     * are not present in `arrayA` but are present in `arrayB`. Assumes both arrays are sorted\n     * based on the provided comparer.\n     */\n    function relativeComplement(arrayA, arrayB, comparer, offsetA, offsetB) {\n        if (comparer === void 0) { comparer = compareValues; }\n        if (offsetA === void 0) { offsetA = 0; }\n        if (offsetB === void 0) { offsetB = 0; }\n        if (!arrayB || !arrayA || arrayB.length === 0 || arrayA.length === 0)\n            return arrayB;\n        var result = [];\n        outer: for (; offsetB < arrayB.length; offsetB++) {\n            inner: for (; offsetA < arrayA.length; offsetA++) {\n                switch (comparer(arrayB[offsetB], arrayA[offsetA])) {\n                    case -1 /* LessThan */: break inner;\n                    case 0 /* EqualTo */: continue outer;\n                    case 1 /* GreaterThan */: continue inner;\n                }\n            }\n            result.push(arrayB[offsetB]);\n        }\n        return result;\n    }\n    ts.relativeComplement = relativeComplement;\n    function sum(array, prop) {\n        var result = 0;\n        for (var _i = 0, array_7 = array; _i < array_7.length; _i++) {\n            var v = array_7[_i];\n            result += v[prop];\n        }\n        return result;\n    }\n    ts.sum = sum;\n    /**\n     * Appends a value to an array, returning the array.\n     *\n     * @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array\n     * is created if `value` was appended.\n     * @param value The value to append to the array. If `value` is `undefined`, nothing is\n     * appended.\n     */\n    function append(to, value) {\n        if (value === undefined)\n            return to;\n        if (to === undefined)\n            return [value];\n        to.push(value);\n        return to;\n    }\n    ts.append = append;\n    /**\n     * Appends a range of value to an array, returning the array.\n     *\n     * @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array\n     * is created if `value` was appended.\n     * @param from The values to append to the array. If `from` is `undefined`, nothing is\n     * appended. If an element of `from` is `undefined`, that element is not appended.\n     */\n    function addRange(to, from) {\n        if (from === undefined)\n            return to;\n        for (var _i = 0, from_1 = from; _i < from_1.length; _i++) {\n            var v = from_1[_i];\n            to = append(to, v);\n        }\n        return to;\n    }\n    ts.addRange = addRange;\n    /**\n     * Stable sort of an array. Elements equal to each other maintain their relative position in the array.\n     */\n    function stableSort(array, comparer) {\n        if (comparer === void 0) { comparer = compareValues; }\n        return array\n            .map(function (_, i) { return i; }) // create array of indices\n            .sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); }) // sort indices by value then position\n            .map(function (i) { return array[i]; }); // get sorted array\n    }\n    ts.stableSort = stableSort;\n    function rangeEquals(array1, array2, pos, end) {\n        while (pos < end) {\n            if (array1[pos] !== array2[pos]) {\n                return false;\n            }\n            pos++;\n        }\n        return true;\n    }\n    ts.rangeEquals = rangeEquals;\n    /**\n     * Returns the first element of an array if non-empty, `undefined` otherwise.\n     */\n    function firstOrUndefined(array) {\n        return array && array.length > 0\n            ? array[0]\n            : undefined;\n    }\n    ts.firstOrUndefined = firstOrUndefined;\n    /**\n     * Returns the last element of an array if non-empty, `undefined` otherwise.\n     */\n    function lastOrUndefined(array) {\n        return array && array.length > 0\n            ? array[array.length - 1]\n            : undefined;\n    }\n    ts.lastOrUndefined = lastOrUndefined;\n    /**\n     * Returns the only element of an array if it contains only one element, `undefined` otherwise.\n     */\n    function singleOrUndefined(array) {\n        return array && array.length === 1\n            ? array[0]\n            : undefined;\n    }\n    ts.singleOrUndefined = singleOrUndefined;\n    /**\n     * Returns the only element of an array if it contains only one element; otheriwse, returns the\n     * array.\n     */\n    function singleOrMany(array) {\n        return array && array.length === 1\n            ? array[0]\n            : array;\n    }\n    ts.singleOrMany = singleOrMany;\n    function replaceElement(array, index, value) {\n        var result = array.slice(0);\n        result[index] = value;\n        return result;\n    }\n    ts.replaceElement = replaceElement;\n    /**\n     * Performs a binary search, finding the index at which 'value' occurs in 'array'.\n     * If no such index is found, returns the 2's-complement of first index at which\n     * number[index] exceeds number.\n     * @param array A sorted array whose first element must be no larger than number\n     * @param number The value to be searched for in the array.\n     */\n    function binarySearch(array, value, comparer, offset) {\n        if (!array || array.length === 0) {\n            return -1;\n        }\n        var low = offset || 0;\n        var high = array.length - 1;\n        comparer = comparer !== undefined\n            ? comparer\n            : function (v1, v2) { return (v1 < v2 ? -1 : (v1 > v2 ? 1 : 0)); };\n        while (low <= high) {\n            var middle = low + ((high - low) >> 1);\n            var midValue = array[middle];\n            if (comparer(midValue, value) === 0) {\n                return middle;\n            }\n            else if (comparer(midValue, value) > 0) {\n                high = middle - 1;\n            }\n            else {\n                low = middle + 1;\n            }\n        }\n        return ~low;\n    }\n    ts.binarySearch = binarySearch;\n    function reduceLeft(array, f, initial, start, count) {\n        if (array && array.length > 0) {\n            var size = array.length;\n            if (size > 0) {\n                var pos = start === undefined || start < 0 ? 0 : start;\n                var end = count === undefined || pos + count > size - 1 ? size - 1 : pos + count;\n                var result = void 0;\n                if (arguments.length <= 2) {\n                    result = array[pos];\n                    pos++;\n                }\n                else {\n                    result = initial;\n                }\n                while (pos <= end) {\n                    result = f(result, array[pos], pos);\n                    pos++;\n                }\n                return result;\n            }\n        }\n        return initial;\n    }\n    ts.reduceLeft = reduceLeft;\n    function reduceRight(array, f, initial, start, count) {\n        if (array) {\n            var size = array.length;\n            if (size > 0) {\n                var pos = start === undefined || start > size - 1 ? size - 1 : start;\n                var end = count === undefined || pos - count < 0 ? 0 : pos - count;\n                var result = void 0;\n                if (arguments.length <= 2) {\n                    result = array[pos];\n                    pos--;\n                }\n                else {\n                    result = initial;\n                }\n                while (pos >= end) {\n                    result = f(result, array[pos], pos);\n                    pos--;\n                }\n                return result;\n            }\n        }\n        return initial;\n    }\n    ts.reduceRight = reduceRight;\n    var hasOwnProperty = Object.prototype.hasOwnProperty;\n    /**\n     * Indicates whether a map-like contains an own property with the specified key.\n     *\n     * NOTE: This is intended for use only with MapLike<T> objects. For Map<T> objects, use\n     *       the 'in' operator.\n     *\n     * @param map A map-like.\n     * @param key A property key.\n     */\n    function hasProperty(map, key) {\n        return hasOwnProperty.call(map, key);\n    }\n    ts.hasProperty = hasProperty;\n    /**\n     * Gets the value of an owned property in a map-like.\n     *\n     * NOTE: This is intended for use only with MapLike<T> objects. For Map<T> objects, use\n     *       an indexer.\n     *\n     * @param map A map-like.\n     * @param key A property key.\n     */\n    function getProperty(map, key) {\n        return hasOwnProperty.call(map, key) ? map[key] : undefined;\n    }\n    ts.getProperty = getProperty;\n    /**\n     * Gets the owned, enumerable property keys of a map-like.\n     *\n     * NOTE: This is intended for use with MapLike<T> objects. For Map<T> objects, use\n     *       Object.keys instead as it offers better performance.\n     *\n     * @param map A map-like.\n     */\n    function getOwnKeys(map) {\n        var keys = [];\n        for (var key in map)\n            if (hasOwnProperty.call(map, key)) {\n                keys.push(key);\n            }\n        return keys;\n    }\n    ts.getOwnKeys = getOwnKeys;\n    /**\n     * Enumerates the properties of a Map<T>, invoking a callback and returning the first truthy result.\n     *\n     * @param map A map for which properties should be enumerated.\n     * @param callback A callback to invoke for each property.\n     */\n    function forEachProperty(map, callback) {\n        var result;\n        for (var key in map) {\n            if (result = callback(map[key], key))\n                break;\n        }\n        return result;\n    }\n    ts.forEachProperty = forEachProperty;\n    /**\n     * Returns true if a Map<T> has some matching property.\n     *\n     * @param map A map whose properties should be tested.\n     * @param predicate An optional callback used to test each property.\n     */\n    function someProperties(map, predicate) {\n        for (var key in map) {\n            if (!predicate || predicate(map[key], key))\n                return true;\n        }\n        return false;\n    }\n    ts.someProperties = someProperties;\n    /**\n     * Performs a shallow copy of the properties from a source Map<T> to a target MapLike<T>\n     *\n     * @param source A map from which properties should be copied.\n     * @param target A map to which properties should be copied.\n     */\n    function copyProperties(source, target) {\n        for (var key in source) {\n            target[key] = source[key];\n        }\n    }\n    ts.copyProperties = copyProperties;\n    function appendProperty(map, key, value) {\n        if (key === undefined || value === undefined)\n            return map;\n        if (map === undefined)\n            map = createMap();\n        map[key] = value;\n        return map;\n    }\n    ts.appendProperty = appendProperty;\n    function assign(t) {\n        var args = [];\n        for (var _i = 1; _i < arguments.length; _i++) {\n            args[_i - 1] = arguments[_i];\n        }\n        for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {\n            var arg = args_1[_a];\n            for (var _b = 0, _c = getOwnKeys(arg); _b < _c.length; _b++) {\n                var p = _c[_b];\n                t[p] = arg[p];\n            }\n        }\n        return t;\n    }\n    ts.assign = assign;\n    /**\n     * Reduce the properties of a map.\n     *\n     * NOTE: This is intended for use with Map<T> objects. For MapLike<T> objects, use\n     *       reduceOwnProperties instead as it offers better runtime safety.\n     *\n     * @param map The map to reduce\n     * @param callback An aggregation function that is called for each entry in the map\n     * @param initial The initial value for the reduction.\n     */\n    function reduceProperties(map, callback, initial) {\n        var result = initial;\n        for (var key in map) {\n            result = callback(result, map[key], String(key));\n        }\n        return result;\n    }\n    ts.reduceProperties = reduceProperties;\n    /**\n     * Reduce the properties defined on a map-like (but not from its prototype chain).\n     *\n     * NOTE: This is intended for use with MapLike<T> objects. For Map<T> objects, use\n     *       reduceProperties instead as it offers better performance.\n     *\n     * @param map The map-like to reduce\n     * @param callback An aggregation function that is called for each entry in the map\n     * @param initial The initial value for the reduction.\n     */\n    function reduceOwnProperties(map, callback, initial) {\n        var result = initial;\n        for (var key in map)\n            if (hasOwnProperty.call(map, key)) {\n                result = callback(result, map[key], String(key));\n            }\n        return result;\n    }\n    ts.reduceOwnProperties = reduceOwnProperties;\n    /**\n     * Performs a shallow equality comparison of the contents of two map-likes.\n     *\n     * @param left A map-like whose properties should be compared.\n     * @param right A map-like whose properties should be compared.\n     */\n    function equalOwnProperties(left, right, equalityComparer) {\n        if (left === right)\n            return true;\n        if (!left || !right)\n            return false;\n        for (var key in left)\n            if (hasOwnProperty.call(left, key)) {\n                if (!hasOwnProperty.call(right, key) === undefined)\n                    return false;\n                if (equalityComparer ? !equalityComparer(left[key], right[key]) : left[key] !== right[key])\n                    return false;\n            }\n        for (var key in right)\n            if (hasOwnProperty.call(right, key)) {\n                if (!hasOwnProperty.call(left, key))\n                    return false;\n            }\n        return true;\n    }\n    ts.equalOwnProperties = equalOwnProperties;\n    function arrayToMap(array, makeKey, makeValue) {\n        var result = createMap();\n        for (var _i = 0, array_8 = array; _i < array_8.length; _i++) {\n            var value = array_8[_i];\n            result[makeKey(value)] = makeValue ? makeValue(value) : value;\n        }\n        return result;\n    }\n    ts.arrayToMap = arrayToMap;\n    function isEmpty(map) {\n        for (var id in map) {\n            if (hasProperty(map, id)) {\n                return false;\n            }\n        }\n        return true;\n    }\n    ts.isEmpty = isEmpty;\n    function cloneMap(map) {\n        var clone = createMap();\n        copyProperties(map, clone);\n        return clone;\n    }\n    ts.cloneMap = cloneMap;\n    function clone(object) {\n        var result = {};\n        for (var id in object) {\n            if (hasOwnProperty.call(object, id)) {\n                result[id] = object[id];\n            }\n        }\n        return result;\n    }\n    ts.clone = clone;\n    function extend(first, second) {\n        var result = {};\n        for (var id in second)\n            if (hasOwnProperty.call(second, id)) {\n                result[id] = second[id];\n            }\n        for (var id in first)\n            if (hasOwnProperty.call(first, id)) {\n                result[id] = first[id];\n            }\n        return result;\n    }\n    ts.extend = extend;\n    /**\n     * Adds the value to an array of values associated with the key, and returns the array.\n     * Creates the array if it does not already exist.\n     */\n    function multiMapAdd(map, key, value) {\n        var values = map[key];\n        if (values) {\n            values.push(value);\n            return values;\n        }\n        else {\n            return map[key] = [value];\n        }\n    }\n    ts.multiMapAdd = multiMapAdd;\n    /**\n     * Removes a value from an array of values associated with the key.\n     * Does not preserve the order of those values.\n     * Does nothing if `key` is not in `map`, or `value` is not in `map[key]`.\n     */\n    function multiMapRemove(map, key, value) {\n        var values = map[key];\n        if (values) {\n            unorderedRemoveItem(values, value);\n            if (!values.length) {\n                delete map[key];\n            }\n        }\n    }\n    ts.multiMapRemove = multiMapRemove;\n    /**\n     * Tests whether a value is an array.\n     */\n    function isArray(value) {\n        return Array.isArray ? Array.isArray(value) : value instanceof Array;\n    }\n    ts.isArray = isArray;\n    /** Does nothing. */\n    function noop() { }\n    ts.noop = noop;\n    /** Throws an error because a function is not implemented. */\n    function notImplemented() {\n        throw new Error(\"Not implemented\");\n    }\n    ts.notImplemented = notImplemented;\n    function memoize(callback) {\n        var value;\n        return function () {\n            if (callback) {\n                value = callback();\n                callback = undefined;\n            }\n            return value;\n        };\n    }\n    ts.memoize = memoize;\n    function chain(a, b, c, d, e) {\n        if (e) {\n            var args_2 = [];\n            for (var i = 0; i < arguments.length; i++) {\n                args_2[i] = arguments[i];\n            }\n            return function (t) { return compose.apply(void 0, map(args_2, function (f) { return f(t); })); };\n        }\n        else if (d) {\n            return function (t) { return compose(a(t), b(t), c(t), d(t)); };\n        }\n        else if (c) {\n            return function (t) { return compose(a(t), b(t), c(t)); };\n        }\n        else if (b) {\n            return function (t) { return compose(a(t), b(t)); };\n        }\n        else if (a) {\n            return function (t) { return compose(a(t)); };\n        }\n        else {\n            return function (_) { return function (u) { return u; }; };\n        }\n    }\n    ts.chain = chain;\n    function compose(a, b, c, d, e) {\n        if (e) {\n            var args_3 = [];\n            for (var i = 0; i < arguments.length; i++) {\n                args_3[i] = arguments[i];\n            }\n            return function (t) { return reduceLeft(args_3, function (u, f) { return f(u); }, t); };\n        }\n        else if (d) {\n            return function (t) { return d(c(b(a(t)))); };\n        }\n        else if (c) {\n            return function (t) { return c(b(a(t))); };\n        }\n        else if (b) {\n            return function (t) { return b(a(t)); };\n        }\n        else if (a) {\n            return function (t) { return a(t); };\n        }\n        else {\n            return function (t) { return t; };\n        }\n    }\n    ts.compose = compose;\n    function formatStringFromArgs(text, args, baseIndex) {\n        baseIndex = baseIndex || 0;\n        return text.replace(/{(\\d+)}/g, function (_match, index) { return args[+index + baseIndex]; });\n    }\n    ts.localizedDiagnosticMessages = undefined;\n    function getLocaleSpecificMessage(message) {\n        return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message;\n    }\n    ts.getLocaleSpecificMessage = getLocaleSpecificMessage;\n    function createFileDiagnostic(file, start, length, message) {\n        var end = start + length;\n        Debug.assert(start >= 0, \"start must be non-negative, is \" + start);\n        Debug.assert(length >= 0, \"length must be non-negative, is \" + length);\n        if (file) {\n            Debug.assert(start <= file.text.length, \"start must be within the bounds of the file. \" + start + \" > \" + file.text.length);\n            Debug.assert(end <= file.text.length, \"end must be the bounds of the file. \" + end + \" > \" + file.text.length);\n        }\n        var text = getLocaleSpecificMessage(message);\n        if (arguments.length > 4) {\n            text = formatStringFromArgs(text, arguments, 4);\n        }\n        return {\n            file: file,\n            start: start,\n            length: length,\n            messageText: text,\n            category: message.category,\n            code: message.code,\n        };\n    }\n    ts.createFileDiagnostic = createFileDiagnostic;\n    /* internal */\n    function formatMessage(_dummy, message) {\n        var text = getLocaleSpecificMessage(message);\n        if (arguments.length > 2) {\n            text = formatStringFromArgs(text, arguments, 2);\n        }\n        return text;\n    }\n    ts.formatMessage = formatMessage;\n    function createCompilerDiagnostic(message) {\n        var text = getLocaleSpecificMessage(message);\n        if (arguments.length > 1) {\n            text = formatStringFromArgs(text, arguments, 1);\n        }\n        return {\n            file: undefined,\n            start: undefined,\n            length: undefined,\n            messageText: text,\n            category: message.category,\n            code: message.code\n        };\n    }\n    ts.createCompilerDiagnostic = createCompilerDiagnostic;\n    function createCompilerDiagnosticFromMessageChain(chain) {\n        return {\n            file: undefined,\n            start: undefined,\n            length: undefined,\n            code: chain.code,\n            category: chain.category,\n            messageText: chain.next ? chain : chain.messageText\n        };\n    }\n    ts.createCompilerDiagnosticFromMessageChain = createCompilerDiagnosticFromMessageChain;\n    function chainDiagnosticMessages(details, message) {\n        var text = getLocaleSpecificMessage(message);\n        if (arguments.length > 2) {\n            text = formatStringFromArgs(text, arguments, 2);\n        }\n        return {\n            messageText: text,\n            category: message.category,\n            code: message.code,\n            next: details\n        };\n    }\n    ts.chainDiagnosticMessages = chainDiagnosticMessages;\n    function concatenateDiagnosticMessageChains(headChain, tailChain) {\n        var lastChain = headChain;\n        while (lastChain.next) {\n            lastChain = lastChain.next;\n        }\n        lastChain.next = tailChain;\n        return headChain;\n    }\n    ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains;\n    function compareValues(a, b) {\n        if (a === b)\n            return 0 /* EqualTo */;\n        if (a === undefined)\n            return -1 /* LessThan */;\n        if (b === undefined)\n            return 1 /* GreaterThan */;\n        return a < b ? -1 /* LessThan */ : 1 /* GreaterThan */;\n    }\n    ts.compareValues = compareValues;\n    function compareStrings(a, b, ignoreCase) {\n        if (a === b)\n            return 0 /* EqualTo */;\n        if (a === undefined)\n            return -1 /* LessThan */;\n        if (b === undefined)\n            return 1 /* GreaterThan */;\n        if (ignoreCase) {\n            if (ts.collator && String.prototype.localeCompare) {\n                // accent means a ≠ b, a ≠ á, a = A\n                var result = a.localeCompare(b, /*locales*/ undefined, { usage: \"sort\", sensitivity: \"accent\" });\n                return result < 0 ? -1 /* LessThan */ : result > 0 ? 1 /* GreaterThan */ : 0 /* EqualTo */;\n            }\n            a = a.toUpperCase();\n            b = b.toUpperCase();\n            if (a === b)\n                return 0 /* EqualTo */;\n        }\n        return a < b ? -1 /* LessThan */ : 1 /* GreaterThan */;\n    }\n    ts.compareStrings = compareStrings;\n    function compareStringsCaseInsensitive(a, b) {\n        return compareStrings(a, b, /*ignoreCase*/ true);\n    }\n    ts.compareStringsCaseInsensitive = compareStringsCaseInsensitive;\n    function getDiagnosticFileName(diagnostic) {\n        return diagnostic.file ? diagnostic.file.fileName : undefined;\n    }\n    function compareDiagnostics(d1, d2) {\n        return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) ||\n            compareValues(d1.start, d2.start) ||\n            compareValues(d1.length, d2.length) ||\n            compareValues(d1.code, d2.code) ||\n            compareMessageText(d1.messageText, d2.messageText) ||\n            0 /* EqualTo */;\n    }\n    ts.compareDiagnostics = compareDiagnostics;\n    function compareMessageText(text1, text2) {\n        while (text1 && text2) {\n            // We still have both chains.\n            var string1 = typeof text1 === \"string\" ? text1 : text1.messageText;\n            var string2 = typeof text2 === \"string\" ? text2 : text2.messageText;\n            var res = compareValues(string1, string2);\n            if (res) {\n                return res;\n            }\n            text1 = typeof text1 === \"string\" ? undefined : text1.next;\n            text2 = typeof text2 === \"string\" ? undefined : text2.next;\n        }\n        if (!text1 && !text2) {\n            // if the chains are done, then these messages are the same.\n            return 0 /* EqualTo */;\n        }\n        // We still have one chain remaining.  The shorter chain should come first.\n        return text1 ? 1 /* GreaterThan */ : -1 /* LessThan */;\n    }\n    function sortAndDeduplicateDiagnostics(diagnostics) {\n        return deduplicateSortedDiagnostics(diagnostics.sort(compareDiagnostics));\n    }\n    ts.sortAndDeduplicateDiagnostics = sortAndDeduplicateDiagnostics;\n    function deduplicateSortedDiagnostics(diagnostics) {\n        if (diagnostics.length < 2) {\n            return diagnostics;\n        }\n        var newDiagnostics = [diagnostics[0]];\n        var previousDiagnostic = diagnostics[0];\n        for (var i = 1; i < diagnostics.length; i++) {\n            var currentDiagnostic = diagnostics[i];\n            var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === 0 /* EqualTo */;\n            if (!isDupe) {\n                newDiagnostics.push(currentDiagnostic);\n                previousDiagnostic = currentDiagnostic;\n            }\n        }\n        return newDiagnostics;\n    }\n    ts.deduplicateSortedDiagnostics = deduplicateSortedDiagnostics;\n    function normalizeSlashes(path) {\n        return path.replace(/\\\\/g, \"/\");\n    }\n    ts.normalizeSlashes = normalizeSlashes;\n    /**\n     * Returns length of path root (i.e. length of \"/\", \"x:/\", \"//server/share/, file:///user/files\")\n    */\n    function getRootLength(path) {\n        if (path.charCodeAt(0) === 47 /* slash */) {\n            if (path.charCodeAt(1) !== 47 /* slash */)\n                return 1;\n            var p1 = path.indexOf(\"/\", 2);\n            if (p1 < 0)\n                return 2;\n            var p2 = path.indexOf(\"/\", p1 + 1);\n            if (p2 < 0)\n                return p1 + 1;\n            return p2 + 1;\n        }\n        if (path.charCodeAt(1) === 58 /* colon */) {\n            if (path.charCodeAt(2) === 47 /* slash */)\n                return 3;\n            return 2;\n        }\n        // Per RFC 1738 'file' URI schema has the shape file://<host>/<path>\n        // if <host> is omitted then it is assumed that host value is 'localhost',\n        // however slash after the omitted <host> is not removed.\n        // file:///folder1/file1 - this is a correct URI\n        // file://folder2/file2 - this is an incorrect URI\n        if (path.lastIndexOf(\"file:///\", 0) === 0) {\n            return \"file:///\".length;\n        }\n        var idx = path.indexOf(\"://\");\n        if (idx !== -1) {\n            return idx + \"://\".length;\n        }\n        return 0;\n    }\n    ts.getRootLength = getRootLength;\n    /**\n     * Internally, we represent paths as strings with '/' as the directory separator.\n     * When we make system calls (eg: LanguageServiceHost.getDirectory()),\n     * we expect the host to correctly handle paths in our specified format.\n     */\n    ts.directorySeparator = \"/\";\n    var directorySeparatorCharCode = 47 /* slash */;\n    function getNormalizedParts(normalizedSlashedPath, rootLength) {\n        var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator);\n        var normalized = [];\n        for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {\n            var part = parts_1[_i];\n            if (part !== \".\") {\n                if (part === \"..\" && normalized.length > 0 && lastOrUndefined(normalized) !== \"..\") {\n                    normalized.pop();\n                }\n                else {\n                    // A part may be an empty string (which is 'falsy') if the path had consecutive slashes,\n                    // e.g. \"path//file.ts\".  Drop these before re-joining the parts.\n                    if (part) {\n                        normalized.push(part);\n                    }\n                }\n            }\n        }\n        return normalized;\n    }\n    function normalizePath(path) {\n        path = normalizeSlashes(path);\n        var rootLength = getRootLength(path);\n        var root = path.substr(0, rootLength);\n        var normalized = getNormalizedParts(path, rootLength);\n        if (normalized.length) {\n            var joinedParts = root + normalized.join(ts.directorySeparator);\n            return pathEndsWithDirectorySeparator(path) ? joinedParts + ts.directorySeparator : joinedParts;\n        }\n        else {\n            return root;\n        }\n    }\n    ts.normalizePath = normalizePath;\n    /** A path ending with '/' refers to a directory only, never a file. */\n    function pathEndsWithDirectorySeparator(path) {\n        return path.charCodeAt(path.length - 1) === directorySeparatorCharCode;\n    }\n    ts.pathEndsWithDirectorySeparator = pathEndsWithDirectorySeparator;\n    function getDirectoryPath(path) {\n        return path.substr(0, Math.max(getRootLength(path), path.lastIndexOf(ts.directorySeparator)));\n    }\n    ts.getDirectoryPath = getDirectoryPath;\n    function isUrl(path) {\n        return path && !isRootedDiskPath(path) && path.indexOf(\"://\") !== -1;\n    }\n    ts.isUrl = isUrl;\n    function isExternalModuleNameRelative(moduleName) {\n        // TypeScript 1.0 spec (April 2014): 11.2.1\n        // An external module name is \"relative\" if the first term is \".\" or \"..\".\n        return /^\\.\\.?($|[\\\\/])/.test(moduleName);\n    }\n    ts.isExternalModuleNameRelative = isExternalModuleNameRelative;\n    function getEmitScriptTarget(compilerOptions) {\n        return compilerOptions.target || 0 /* ES3 */;\n    }\n    ts.getEmitScriptTarget = getEmitScriptTarget;\n    function getEmitModuleKind(compilerOptions) {\n        return typeof compilerOptions.module === \"number\" ?\n            compilerOptions.module :\n            getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */ ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS;\n    }\n    ts.getEmitModuleKind = getEmitModuleKind;\n    function getEmitModuleResolutionKind(compilerOptions) {\n        var moduleResolution = compilerOptions.moduleResolution;\n        if (moduleResolution === undefined) {\n            moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;\n        }\n        return moduleResolution;\n    }\n    ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;\n    /* @internal */\n    function hasZeroOrOneAsteriskCharacter(str) {\n        var seenAsterisk = false;\n        for (var i = 0; i < str.length; i++) {\n            if (str.charCodeAt(i) === 42 /* asterisk */) {\n                if (!seenAsterisk) {\n                    seenAsterisk = true;\n                }\n                else {\n                    // have already seen asterisk\n                    return false;\n                }\n            }\n        }\n        return true;\n    }\n    ts.hasZeroOrOneAsteriskCharacter = hasZeroOrOneAsteriskCharacter;\n    function isRootedDiskPath(path) {\n        return getRootLength(path) !== 0;\n    }\n    ts.isRootedDiskPath = isRootedDiskPath;\n    function convertToRelativePath(absoluteOrRelativePath, basePath, getCanonicalFileName) {\n        return !isRootedDiskPath(absoluteOrRelativePath)\n            ? absoluteOrRelativePath\n            : getRelativePathToDirectoryOrUrl(basePath, absoluteOrRelativePath, basePath, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);\n    }\n    ts.convertToRelativePath = convertToRelativePath;\n    function normalizedPathComponents(path, rootLength) {\n        var normalizedParts = getNormalizedParts(path, rootLength);\n        return [path.substr(0, rootLength)].concat(normalizedParts);\n    }\n    function getNormalizedPathComponents(path, currentDirectory) {\n        path = normalizeSlashes(path);\n        var rootLength = getRootLength(path);\n        if (rootLength === 0) {\n            // If the path is not rooted it is relative to current directory\n            path = combinePaths(normalizeSlashes(currentDirectory), path);\n            rootLength = getRootLength(path);\n        }\n        return normalizedPathComponents(path, rootLength);\n    }\n    ts.getNormalizedPathComponents = getNormalizedPathComponents;\n    function getNormalizedAbsolutePath(fileName, currentDirectory) {\n        return getNormalizedPathFromPathComponents(getNormalizedPathComponents(fileName, currentDirectory));\n    }\n    ts.getNormalizedAbsolutePath = getNormalizedAbsolutePath;\n    function getNormalizedPathFromPathComponents(pathComponents) {\n        if (pathComponents && pathComponents.length) {\n            return pathComponents[0] + pathComponents.slice(1).join(ts.directorySeparator);\n        }\n    }\n    ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents;\n    function getNormalizedPathComponentsOfUrl(url) {\n        // Get root length of http://www.website.com/folder1/folder2/\n        // In this example the root is:  http://www.website.com/\n        // normalized path components should be [\"http://www.website.com/\", \"folder1\", \"folder2\"]\n        var urlLength = url.length;\n        // Initial root length is http:// part\n        var rootLength = url.indexOf(\"://\") + \"://\".length;\n        while (rootLength < urlLength) {\n            // Consume all immediate slashes in the protocol\n            // eg.initial rootlength is just file:// but it needs to consume another \"/\" in file:///\n            if (url.charCodeAt(rootLength) === 47 /* slash */) {\n                rootLength++;\n            }\n            else {\n                // non slash character means we continue proceeding to next component of root search\n                break;\n            }\n        }\n        // there are no parts after http:// just return current string as the pathComponent\n        if (rootLength === urlLength) {\n            return [url];\n        }\n        // Find the index of \"/\" after website.com so the root can be http://www.website.com/ (from existing http://)\n        var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength);\n        if (indexOfNextSlash !== -1) {\n            // Found the \"/\" after the website.com so the root is length of http://www.website.com/\n            // and get components after the root normally like any other folder components\n            rootLength = indexOfNextSlash + 1;\n            return normalizedPathComponents(url, rootLength);\n        }\n        else {\n            // Can't find the host assume the rest of the string as component\n            // but make sure we append \"/\"  to it as root is not joined using \"/\"\n            // eg. if url passed in was http://website.com we want to use root as [http://website.com/]\n            // so that other path manipulations will be correct and it can be merged with relative paths correctly\n            return [url + ts.directorySeparator];\n        }\n    }\n    function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) {\n        if (isUrl(pathOrUrl)) {\n            return getNormalizedPathComponentsOfUrl(pathOrUrl);\n        }\n        else {\n            return getNormalizedPathComponents(pathOrUrl, currentDirectory);\n        }\n    }\n    function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) {\n        var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory);\n        var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory);\n        if (directoryComponents.length > 1 && lastOrUndefined(directoryComponents) === \"\") {\n            // If the directory path given was of type test/cases/ then we really need components of directory to be only till its name\n            // that is  [\"test\", \"cases\", \"\"] needs to be actually [\"test\", \"cases\"]\n            directoryComponents.length--;\n        }\n        // Find the component that differs\n        var joinStartIndex;\n        for (joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) {\n            if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) {\n                break;\n            }\n        }\n        // Get the relative path\n        if (joinStartIndex) {\n            var relativePath = \"\";\n            var relativePathComponents = pathComponents.slice(joinStartIndex, pathComponents.length);\n            for (; joinStartIndex < directoryComponents.length; joinStartIndex++) {\n                if (directoryComponents[joinStartIndex] !== \"\") {\n                    relativePath = relativePath + \"..\" + ts.directorySeparator;\n                }\n            }\n            return relativePath + relativePathComponents.join(ts.directorySeparator);\n        }\n        // Cant find the relative path, get the absolute path\n        var absolutePath = getNormalizedPathFromPathComponents(pathComponents);\n        if (isAbsolutePathAnUrl && isRootedDiskPath(absolutePath)) {\n            absolutePath = \"file:///\" + absolutePath;\n        }\n        return absolutePath;\n    }\n    ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl;\n    function getBaseFileName(path) {\n        if (path === undefined) {\n            return undefined;\n        }\n        var i = path.lastIndexOf(ts.directorySeparator);\n        return i < 0 ? path : path.substring(i + 1);\n    }\n    ts.getBaseFileName = getBaseFileName;\n    function combinePaths(path1, path2) {\n        if (!(path1 && path1.length))\n            return path2;\n        if (!(path2 && path2.length))\n            return path1;\n        if (getRootLength(path2) !== 0)\n            return path2;\n        if (path1.charAt(path1.length - 1) === ts.directorySeparator)\n            return path1 + path2;\n        return path1 + ts.directorySeparator + path2;\n    }\n    ts.combinePaths = combinePaths;\n    /**\n     * Removes a trailing directory separator from a path.\n     * @param path The path.\n     */\n    function removeTrailingDirectorySeparator(path) {\n        if (path.charAt(path.length - 1) === ts.directorySeparator) {\n            return path.substr(0, path.length - 1);\n        }\n        return path;\n    }\n    ts.removeTrailingDirectorySeparator = removeTrailingDirectorySeparator;\n    /**\n     * Adds a trailing directory separator to a path, if it does not already have one.\n     * @param path The path.\n     */\n    function ensureTrailingDirectorySeparator(path) {\n        if (path.charAt(path.length - 1) !== ts.directorySeparator) {\n            return path + ts.directorySeparator;\n        }\n        return path;\n    }\n    ts.ensureTrailingDirectorySeparator = ensureTrailingDirectorySeparator;\n    function comparePaths(a, b, currentDirectory, ignoreCase) {\n        if (a === b)\n            return 0 /* EqualTo */;\n        if (a === undefined)\n            return -1 /* LessThan */;\n        if (b === undefined)\n            return 1 /* GreaterThan */;\n        a = removeTrailingDirectorySeparator(a);\n        b = removeTrailingDirectorySeparator(b);\n        var aComponents = getNormalizedPathComponents(a, currentDirectory);\n        var bComponents = getNormalizedPathComponents(b, currentDirectory);\n        var sharedLength = Math.min(aComponents.length, bComponents.length);\n        for (var i = 0; i < sharedLength; i++) {\n            var result = compareStrings(aComponents[i], bComponents[i], ignoreCase);\n            if (result !== 0 /* EqualTo */) {\n                return result;\n            }\n        }\n        return compareValues(aComponents.length, bComponents.length);\n    }\n    ts.comparePaths = comparePaths;\n    function containsPath(parent, child, currentDirectory, ignoreCase) {\n        if (parent === undefined || child === undefined)\n            return false;\n        if (parent === child)\n            return true;\n        parent = removeTrailingDirectorySeparator(parent);\n        child = removeTrailingDirectorySeparator(child);\n        if (parent === child)\n            return true;\n        var parentComponents = getNormalizedPathComponents(parent, currentDirectory);\n        var childComponents = getNormalizedPathComponents(child, currentDirectory);\n        if (childComponents.length < parentComponents.length) {\n            return false;\n        }\n        for (var i = 0; i < parentComponents.length; i++) {\n            var result = compareStrings(parentComponents[i], childComponents[i], ignoreCase);\n            if (result !== 0 /* EqualTo */) {\n                return false;\n            }\n        }\n        return true;\n    }\n    ts.containsPath = containsPath;\n    /* @internal */\n    function startsWith(str, prefix) {\n        return str.lastIndexOf(prefix, 0) === 0;\n    }\n    ts.startsWith = startsWith;\n    /* @internal */\n    function endsWith(str, suffix) {\n        var expectedPos = str.length - suffix.length;\n        return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;\n    }\n    ts.endsWith = endsWith;\n    function hasExtension(fileName) {\n        return getBaseFileName(fileName).indexOf(\".\") >= 0;\n    }\n    ts.hasExtension = hasExtension;\n    function fileExtensionIs(path, extension) {\n        return path.length > extension.length && endsWith(path, extension);\n    }\n    ts.fileExtensionIs = fileExtensionIs;\n    function fileExtensionIsAny(path, extensions) {\n        for (var _i = 0, extensions_1 = extensions; _i < extensions_1.length; _i++) {\n            var extension = extensions_1[_i];\n            if (fileExtensionIs(path, extension)) {\n                return true;\n            }\n        }\n        return false;\n    }\n    ts.fileExtensionIsAny = fileExtensionIsAny;\n    // Reserved characters, forces escaping of any non-word (or digit), non-whitespace character.\n    // It may be inefficient (we could just match (/[-[\\]{}()*+?.,\\\\^$|#\\s]/g), but this is future\n    // proof.\n    var reservedCharacterPattern = /[^\\w\\s\\/]/g;\n    var wildcardCharCodes = [42 /* asterisk */, 63 /* question */];\n    /**\n     * Matches any single directory segment unless it is the last segment and a .min.js file\n     * Breakdown:\n     *  [^./]                   # matches everything up to the first . character (excluding directory seperators)\n     *  (\\\\.(?!min\\\\.js$))?     # matches . characters but not if they are part of the .min.js file extension\n     */\n    var singleAsteriskRegexFragmentFiles = \"([^./]|(\\\\.(?!min\\\\.js$))?)*\";\n    var singleAsteriskRegexFragmentOther = \"[^/]*\";\n    function getRegularExpressionForWildcard(specs, basePath, usage) {\n        if (specs === undefined || specs.length === 0) {\n            return undefined;\n        }\n        var replaceWildcardCharacter = usage === \"files\" ? replaceWildCardCharacterFiles : replaceWildCardCharacterOther;\n        var singleAsteriskRegexFragment = usage === \"files\" ? singleAsteriskRegexFragmentFiles : singleAsteriskRegexFragmentOther;\n        /**\n         * Regex for the ** wildcard. Matches any number of subdirectories. When used for including\n         * files or directories, does not match subdirectories that start with a . character\n         */\n        var doubleAsteriskRegexFragment = usage === \"exclude\" ? \"(/.+?)?\" : \"(/[^/.][^/]*)*?\";\n        var pattern = \"\";\n        var hasWrittenSubpattern = false;\n        for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {\n            var spec = specs_1[_i];\n            if (!spec) {\n                continue;\n            }\n            var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter);\n            if (subPattern === undefined) {\n                continue;\n            }\n            if (hasWrittenSubpattern) {\n                pattern += \"|\";\n            }\n            pattern += \"(\" + subPattern + \")\";\n            hasWrittenSubpattern = true;\n        }\n        if (!pattern) {\n            return undefined;\n        }\n        // If excluding, match \"foo/bar/baz...\", but if including, only allow \"foo\".\n        var terminator = usage === \"exclude\" ? \"($|/)\" : \"$\";\n        return \"^(\" + pattern + \")\" + terminator;\n    }\n    ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard;\n    /**\n     * An \"includes\" path \"foo\" is implicitly a glob \"foo/** /*\" (without the space) if its last component has no extension,\n     * and does not contain any glob characters itself.\n     */\n    function isImplicitGlob(lastPathComponent) {\n        return !/[.*?]/.test(lastPathComponent);\n    }\n    ts.isImplicitGlob = isImplicitGlob;\n    function getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter) {\n        var subpattern = \"\";\n        var hasRecursiveDirectoryWildcard = false;\n        var hasWrittenComponent = false;\n        var components = getNormalizedPathComponents(spec, basePath);\n        var lastComponent = lastOrUndefined(components);\n        if (usage !== \"exclude\" && lastComponent === \"**\") {\n            return undefined;\n        }\n        // getNormalizedPathComponents includes the separator for the root component.\n        // We need to remove to create our regex correctly.\n        components[0] = removeTrailingDirectorySeparator(components[0]);\n        if (isImplicitGlob(lastComponent)) {\n            components.push(\"**\", \"*\");\n        }\n        var optionalCount = 0;\n        for (var _i = 0, components_1 = components; _i < components_1.length; _i++) {\n            var component = components_1[_i];\n            if (component === \"**\") {\n                if (hasRecursiveDirectoryWildcard) {\n                    return undefined;\n                }\n                subpattern += doubleAsteriskRegexFragment;\n                hasRecursiveDirectoryWildcard = true;\n            }\n            else {\n                if (usage === \"directories\") {\n                    subpattern += \"(\";\n                    optionalCount++;\n                }\n                if (hasWrittenComponent) {\n                    subpattern += ts.directorySeparator;\n                }\n                if (usage !== \"exclude\") {\n                    // The * and ? wildcards should not match directories or files that start with . if they\n                    // appear first in a component. Dotted directories and files can be included explicitly\n                    // like so: **/.*/.*\n                    if (component.charCodeAt(0) === 42 /* asterisk */) {\n                        subpattern += \"([^./]\" + singleAsteriskRegexFragment + \")?\";\n                        component = component.substr(1);\n                    }\n                    else if (component.charCodeAt(0) === 63 /* question */) {\n                        subpattern += \"[^./]\";\n                        component = component.substr(1);\n                    }\n                }\n                subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter);\n            }\n            hasWrittenComponent = true;\n        }\n        while (optionalCount > 0) {\n            subpattern += \")?\";\n            optionalCount--;\n        }\n        return subpattern;\n    }\n    function replaceWildCardCharacterFiles(match) {\n        return replaceWildcardCharacter(match, singleAsteriskRegexFragmentFiles);\n    }\n    function replaceWildCardCharacterOther(match) {\n        return replaceWildcardCharacter(match, singleAsteriskRegexFragmentOther);\n    }\n    function replaceWildcardCharacter(match, singleAsteriskRegexFragment) {\n        return match === \"*\" ? singleAsteriskRegexFragment : match === \"?\" ? \"[^/]\" : \"\\\\\" + match;\n    }\n    function getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory) {\n        path = normalizePath(path);\n        currentDirectory = normalizePath(currentDirectory);\n        var absolutePath = combinePaths(currentDirectory, path);\n        return {\n            includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, \"files\"),\n            includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, \"directories\"),\n            excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, \"exclude\"),\n            basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames)\n        };\n    }\n    ts.getFileMatcherPatterns = getFileMatcherPatterns;\n    function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, getFileSystemEntries) {\n        path = normalizePath(path);\n        currentDirectory = normalizePath(currentDirectory);\n        var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);\n        var regexFlag = useCaseSensitiveFileNames ? \"\" : \"i\";\n        var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag);\n        var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag);\n        var excludeRegex = patterns.excludePattern && new RegExp(patterns.excludePattern, regexFlag);\n        var result = [];\n        for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {\n            var basePath = _a[_i];\n            visitDirectory(basePath, combinePaths(currentDirectory, basePath));\n        }\n        return result;\n        function visitDirectory(path, absolutePath) {\n            var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;\n            for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {\n                var current = files_1[_i];\n                var name_1 = combinePaths(path, current);\n                var absoluteName = combinePaths(absolutePath, current);\n                if ((!extensions || fileExtensionIsAny(name_1, extensions)) &&\n                    (!includeFileRegex || includeFileRegex.test(absoluteName)) &&\n                    (!excludeRegex || !excludeRegex.test(absoluteName))) {\n                    result.push(name_1);\n                }\n            }\n            for (var _b = 0, directories_1 = directories; _b < directories_1.length; _b++) {\n                var current = directories_1[_b];\n                var name_2 = combinePaths(path, current);\n                var absoluteName = combinePaths(absolutePath, current);\n                if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&\n                    (!excludeRegex || !excludeRegex.test(absoluteName))) {\n                    visitDirectory(name_2, absoluteName);\n                }\n            }\n        }\n    }\n    ts.matchFiles = matchFiles;\n    /**\n     * Computes the unique non-wildcard base paths amongst the provided include patterns.\n     */\n    function getBasePaths(path, includes, useCaseSensitiveFileNames) {\n        // Storage for our results in the form of literal paths (e.g. the paths as written by the user).\n        var basePaths = [path];\n        if (includes) {\n            // Storage for literal base paths amongst the include patterns.\n            var includeBasePaths = [];\n            for (var _i = 0, includes_1 = includes; _i < includes_1.length; _i++) {\n                var include = includes_1[_i];\n                // We also need to check the relative paths by converting them to absolute and normalizing\n                // in case they escape the base path (e.g \"..\\somedirectory\")\n                var absolute = isRootedDiskPath(include) ? include : normalizePath(combinePaths(path, include));\n                // Append the literal and canonical candidate base paths.\n                includeBasePaths.push(getIncludeBasePath(absolute));\n            }\n            // Sort the offsets array using either the literal or canonical path representations.\n            includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive);\n            var _loop_1 = function (includeBasePath) {\n                if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) {\n                    basePaths.push(includeBasePath);\n                }\n            };\n            // Iterate over each include base path and include unique base paths that are not a\n            // subpath of an existing base path\n            for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) {\n                var includeBasePath = includeBasePaths_1[_a];\n                _loop_1(includeBasePath);\n            }\n        }\n        return basePaths;\n    }\n    function getIncludeBasePath(absolute) {\n        var wildcardOffset = indexOfAnyCharCode(absolute, wildcardCharCodes);\n        if (wildcardOffset < 0) {\n            // No \"*\" or \"?\" in the path\n            return !hasExtension(absolute)\n                ? absolute\n                : removeTrailingDirectorySeparator(getDirectoryPath(absolute));\n        }\n        return absolute.substring(0, absolute.lastIndexOf(ts.directorySeparator, wildcardOffset));\n    }\n    function ensureScriptKind(fileName, scriptKind) {\n        // Using scriptKind as a condition handles both:\n        // - 'scriptKind' is unspecified and thus it is `undefined`\n        // - 'scriptKind' is set and it is `Unknown` (0)\n        // If the 'scriptKind' is 'undefined' or 'Unknown' then we attempt\n        // to get the ScriptKind from the file name. If it cannot be resolved\n        // from the file name then the default 'TS' script kind is returned.\n        return (scriptKind || getScriptKindFromFileName(fileName)) || 3 /* TS */;\n    }\n    ts.ensureScriptKind = ensureScriptKind;\n    function getScriptKindFromFileName(fileName) {\n        var ext = fileName.substr(fileName.lastIndexOf(\".\"));\n        switch (ext.toLowerCase()) {\n            case \".js\":\n                return 1 /* JS */;\n            case \".jsx\":\n                return 2 /* JSX */;\n            case \".ts\":\n                return 3 /* TS */;\n            case \".tsx\":\n                return 4 /* TSX */;\n            default:\n                return 0 /* Unknown */;\n        }\n    }\n    ts.getScriptKindFromFileName = getScriptKindFromFileName;\n    /**\n     *  List of supported extensions in order of file resolution precedence.\n     */\n    ts.supportedTypeScriptExtensions = [\".ts\", \".tsx\", \".d.ts\"];\n    /** Must have \".d.ts\" first because if \".ts\" goes first, that will be detected as the extension instead of \".d.ts\". */\n    ts.supportedTypescriptExtensionsForExtractExtension = [\".d.ts\", \".ts\", \".tsx\"];\n    ts.supportedJavascriptExtensions = [\".js\", \".jsx\"];\n    var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions);\n    function getSupportedExtensions(options) {\n        return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions;\n    }\n    ts.getSupportedExtensions = getSupportedExtensions;\n    function hasJavaScriptFileExtension(fileName) {\n        return forEach(ts.supportedJavascriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); });\n    }\n    ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension;\n    function hasTypeScriptFileExtension(fileName) {\n        return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); });\n    }\n    ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension;\n    function isSupportedSourceFileName(fileName, compilerOptions) {\n        if (!fileName) {\n            return false;\n        }\n        for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) {\n            var extension = _a[_i];\n            if (fileExtensionIs(fileName, extension)) {\n                return true;\n            }\n        }\n        return false;\n    }\n    ts.isSupportedSourceFileName = isSupportedSourceFileName;\n    /**\n     * Extension boundaries by priority. Lower numbers indicate higher priorities, and are\n     * aligned to the offset of the highest priority extension in the\n     * allSupportedExtensions array.\n     */\n    var ExtensionPriority;\n    (function (ExtensionPriority) {\n        ExtensionPriority[ExtensionPriority[\"TypeScriptFiles\"] = 0] = \"TypeScriptFiles\";\n        ExtensionPriority[ExtensionPriority[\"DeclarationAndJavaScriptFiles\"] = 2] = \"DeclarationAndJavaScriptFiles\";\n        ExtensionPriority[ExtensionPriority[\"Limit\"] = 5] = \"Limit\";\n        ExtensionPriority[ExtensionPriority[\"Highest\"] = 0] = \"Highest\";\n        ExtensionPriority[ExtensionPriority[\"Lowest\"] = 2] = \"Lowest\";\n    })(ExtensionPriority = ts.ExtensionPriority || (ts.ExtensionPriority = {}));\n    function getExtensionPriority(path, supportedExtensions) {\n        for (var i = supportedExtensions.length - 1; i >= 0; i--) {\n            if (fileExtensionIs(path, supportedExtensions[i])) {\n                return adjustExtensionPriority(i);\n            }\n        }\n        // If its not in the list of supported extensions, this is likely a\n        // TypeScript file with a non-ts extension\n        return 0 /* Highest */;\n    }\n    ts.getExtensionPriority = getExtensionPriority;\n    /**\n     * Adjusts an extension priority to be the highest priority within the same range.\n     */\n    function adjustExtensionPriority(extensionPriority) {\n        if (extensionPriority < 2 /* DeclarationAndJavaScriptFiles */) {\n            return 0 /* TypeScriptFiles */;\n        }\n        else if (extensionPriority < 5 /* Limit */) {\n            return 2 /* DeclarationAndJavaScriptFiles */;\n        }\n        else {\n            return 5 /* Limit */;\n        }\n    }\n    ts.adjustExtensionPriority = adjustExtensionPriority;\n    /**\n     * Gets the next lowest extension priority for a given priority.\n     */\n    function getNextLowestExtensionPriority(extensionPriority) {\n        if (extensionPriority < 2 /* DeclarationAndJavaScriptFiles */) {\n            return 2 /* DeclarationAndJavaScriptFiles */;\n        }\n        else {\n            return 5 /* Limit */;\n        }\n    }\n    ts.getNextLowestExtensionPriority = getNextLowestExtensionPriority;\n    var extensionsToRemove = [\".d.ts\", \".ts\", \".js\", \".tsx\", \".jsx\"];\n    function removeFileExtension(path) {\n        for (var _i = 0, extensionsToRemove_1 = extensionsToRemove; _i < extensionsToRemove_1.length; _i++) {\n            var ext = extensionsToRemove_1[_i];\n            var extensionless = tryRemoveExtension(path, ext);\n            if (extensionless !== undefined) {\n                return extensionless;\n            }\n        }\n        return path;\n    }\n    ts.removeFileExtension = removeFileExtension;\n    function tryRemoveExtension(path, extension) {\n        return fileExtensionIs(path, extension) ? removeExtension(path, extension) : undefined;\n    }\n    ts.tryRemoveExtension = tryRemoveExtension;\n    function removeExtension(path, extension) {\n        return path.substring(0, path.length - extension.length);\n    }\n    ts.removeExtension = removeExtension;\n    function changeExtension(path, newExtension) {\n        return (removeFileExtension(path) + newExtension);\n    }\n    ts.changeExtension = changeExtension;\n    function Symbol(flags, name) {\n        this.flags = flags;\n        this.name = name;\n        this.declarations = undefined;\n    }\n    function Type(_checker, flags) {\n        this.flags = flags;\n    }\n    function Signature() {\n    }\n    function Node(kind, pos, end) {\n        this.id = 0;\n        this.kind = kind;\n        this.pos = pos;\n        this.end = end;\n        this.flags = 0 /* None */;\n        this.modifierFlagsCache = 0 /* None */;\n        this.transformFlags = 0 /* None */;\n        this.parent = undefined;\n        this.original = undefined;\n    }\n    ts.objectAllocator = {\n        getNodeConstructor: function () { return Node; },\n        getTokenConstructor: function () { return Node; },\n        getIdentifierConstructor: function () { return Node; },\n        getSourceFileConstructor: function () { return Node; },\n        getSymbolConstructor: function () { return Symbol; },\n        getTypeConstructor: function () { return Type; },\n        getSignatureConstructor: function () { return Signature; }\n    };\n    var AssertionLevel;\n    (function (AssertionLevel) {\n        AssertionLevel[AssertionLevel[\"None\"] = 0] = \"None\";\n        AssertionLevel[AssertionLevel[\"Normal\"] = 1] = \"Normal\";\n        AssertionLevel[AssertionLevel[\"Aggressive\"] = 2] = \"Aggressive\";\n        AssertionLevel[AssertionLevel[\"VeryAggressive\"] = 3] = \"VeryAggressive\";\n    })(AssertionLevel = ts.AssertionLevel || (ts.AssertionLevel = {}));\n    var Debug;\n    (function (Debug) {\n        Debug.currentAssertionLevel = 0 /* None */;\n        function shouldAssert(level) {\n            return Debug.currentAssertionLevel >= level;\n        }\n        Debug.shouldAssert = shouldAssert;\n        function assert(expression, message, verboseDebugInfo) {\n            if (!expression) {\n                var verboseDebugString = \"\";\n                if (verboseDebugInfo) {\n                    verboseDebugString = \"\\r\\nVerbose Debug Information: \" + verboseDebugInfo();\n                }\n                debugger;\n                throw new Error(\"Debug Failure. False expression: \" + (message || \"\") + verboseDebugString);\n            }\n        }\n        Debug.assert = assert;\n        function fail(message) {\n            Debug.assert(/*expression*/ false, message);\n        }\n        Debug.fail = fail;\n    })(Debug = ts.Debug || (ts.Debug = {}));\n    /** Remove an item from an array, moving everything to its right one space left. */\n    function orderedRemoveItem(array, item) {\n        for (var i = 0; i < array.length; i++) {\n            if (array[i] === item) {\n                orderedRemoveItemAt(array, i);\n                return true;\n            }\n        }\n        return false;\n    }\n    ts.orderedRemoveItem = orderedRemoveItem;\n    /** Remove an item by index from an array, moving everything to its right one space left. */\n    function orderedRemoveItemAt(array, index) {\n        // This seems to be faster than either `array.splice(i, 1)` or `array.copyWithin(i, i+ 1)`.\n        for (var i = index; i < array.length - 1; i++) {\n            array[i] = array[i + 1];\n        }\n        array.pop();\n    }\n    ts.orderedRemoveItemAt = orderedRemoveItemAt;\n    function unorderedRemoveItemAt(array, index) {\n        // Fill in the \"hole\" left at `index`.\n        array[index] = array[array.length - 1];\n        array.pop();\n    }\n    ts.unorderedRemoveItemAt = unorderedRemoveItemAt;\n    /** Remove the *first* occurrence of `item` from the array. */\n    function unorderedRemoveItem(array, item) {\n        unorderedRemoveFirstItemWhere(array, function (element) { return element === item; });\n    }\n    ts.unorderedRemoveItem = unorderedRemoveItem;\n    /** Remove the *first* element satisfying `predicate`. */\n    function unorderedRemoveFirstItemWhere(array, predicate) {\n        for (var i = 0; i < array.length; i++) {\n            if (predicate(array[i])) {\n                unorderedRemoveItemAt(array, i);\n                break;\n            }\n        }\n    }\n    function createGetCanonicalFileName(useCaseSensitiveFileNames) {\n        return useCaseSensitiveFileNames\n            ? (function (fileName) { return fileName; })\n            : (function (fileName) { return fileName.toLowerCase(); });\n    }\n    ts.createGetCanonicalFileName = createGetCanonicalFileName;\n    /**\n     * patternStrings contains both pattern strings (containing \"*\") and regular strings.\n     * Return an exact match if possible, or a pattern match, or undefined.\n     * (These are verified by verifyCompilerOptions to have 0 or 1 \"*\" characters.)\n     */\n    /* @internal */\n    function matchPatternOrExact(patternStrings, candidate) {\n        var patterns = [];\n        for (var _i = 0, patternStrings_1 = patternStrings; _i < patternStrings_1.length; _i++) {\n            var patternString = patternStrings_1[_i];\n            var pattern = tryParsePattern(patternString);\n            if (pattern) {\n                patterns.push(pattern);\n            }\n            else if (patternString === candidate) {\n                // pattern was matched as is - no need to search further\n                return patternString;\n            }\n        }\n        return findBestPatternMatch(patterns, function (_) { return _; }, candidate);\n    }\n    ts.matchPatternOrExact = matchPatternOrExact;\n    /* @internal */\n    function patternText(_a) {\n        var prefix = _a.prefix, suffix = _a.suffix;\n        return prefix + \"*\" + suffix;\n    }\n    ts.patternText = patternText;\n    /**\n     * Given that candidate matches pattern, returns the text matching the '*'.\n     * E.g.: matchedText(tryParsePattern(\"foo*baz\"), \"foobarbaz\") === \"bar\"\n     */\n    /* @internal */\n    function matchedText(pattern, candidate) {\n        Debug.assert(isPatternMatch(pattern, candidate));\n        return candidate.substr(pattern.prefix.length, candidate.length - pattern.suffix.length);\n    }\n    ts.matchedText = matchedText;\n    /** Return the object corresponding to the best pattern to match `candidate`. */\n    /* @internal */\n    function findBestPatternMatch(values, getPattern, candidate) {\n        var matchedValue = undefined;\n        // use length of prefix as betterness criteria\n        var longestMatchPrefixLength = -1;\n        for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {\n            var v = values_1[_i];\n            var pattern = getPattern(v);\n            if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) {\n                longestMatchPrefixLength = pattern.prefix.length;\n                matchedValue = v;\n            }\n        }\n        return matchedValue;\n    }\n    ts.findBestPatternMatch = findBestPatternMatch;\n    function isPatternMatch(_a, candidate) {\n        var prefix = _a.prefix, suffix = _a.suffix;\n        return candidate.length >= prefix.length + suffix.length &&\n            startsWith(candidate, prefix) &&\n            endsWith(candidate, suffix);\n    }\n    /* @internal */\n    function tryParsePattern(pattern) {\n        // This should be verified outside of here and a proper error thrown.\n        Debug.assert(hasZeroOrOneAsteriskCharacter(pattern));\n        var indexOfStar = pattern.indexOf(\"*\");\n        return indexOfStar === -1 ? undefined : {\n            prefix: pattern.substr(0, indexOfStar),\n            suffix: pattern.substr(indexOfStar + 1)\n        };\n    }\n    ts.tryParsePattern = tryParsePattern;\n    function positionIsSynthesized(pos) {\n        // This is a fast way of testing the following conditions:\n        //  pos === undefined || pos === null || isNaN(pos) || pos < 0;\n        return !(pos >= 0);\n    }\n    ts.positionIsSynthesized = positionIsSynthesized;\n    /** True if an extension is one of the supported TypeScript extensions. */\n    function extensionIsTypeScript(ext) {\n        return ext <= ts.Extension.LastTypeScriptExtension;\n    }\n    ts.extensionIsTypeScript = extensionIsTypeScript;\n    /**\n     * Gets the extension from a path.\n     * Path must have a valid extension.\n     */\n    function extensionFromPath(path) {\n        var ext = tryGetExtensionFromPath(path);\n        if (ext !== undefined) {\n            return ext;\n        }\n        Debug.fail(\"File \" + path + \" has unknown extension.\");\n    }\n    ts.extensionFromPath = extensionFromPath;\n    function tryGetExtensionFromPath(path) {\n        if (fileExtensionIs(path, \".d.ts\")) {\n            return ts.Extension.Dts;\n        }\n        if (fileExtensionIs(path, \".ts\")) {\n            return ts.Extension.Ts;\n        }\n        if (fileExtensionIs(path, \".tsx\")) {\n            return ts.Extension.Tsx;\n        }\n        if (fileExtensionIs(path, \".js\")) {\n            return ts.Extension.Js;\n        }\n        if (fileExtensionIs(path, \".jsx\")) {\n            return ts.Extension.Jsx;\n        }\n    }\n    ts.tryGetExtensionFromPath = tryGetExtensionFromPath;\n})(ts || (ts = {}));\n/// <reference path=\"core.ts\"/>\nvar ts;\n(function (ts) {\n    ts.sys = (function () {\n        function getWScriptSystem() {\n            var fso = new ActiveXObject(\"Scripting.FileSystemObject\");\n            var shell = new ActiveXObject(\"WScript.Shell\");\n            var fileStream = new ActiveXObject(\"ADODB.Stream\");\n            fileStream.Type = 2 /*text*/;\n            var binaryStream = new ActiveXObject(\"ADODB.Stream\");\n            binaryStream.Type = 1 /*binary*/;\n            var args = [];\n            for (var i = 0; i < WScript.Arguments.length; i++) {\n                args[i] = WScript.Arguments.Item(i);\n            }\n            function readFile(fileName, encoding) {\n                if (!fso.FileExists(fileName)) {\n                    return undefined;\n                }\n                fileStream.Open();\n                try {\n                    if (encoding) {\n                        fileStream.Charset = encoding;\n                        fileStream.LoadFromFile(fileName);\n                    }\n                    else {\n                        // Load file and read the first two bytes into a string with no interpretation\n                        fileStream.Charset = \"x-ansi\";\n                        fileStream.LoadFromFile(fileName);\n                        var bom = fileStream.ReadText(2) || \"\";\n                        // Position must be at 0 before encoding can be changed\n                        fileStream.Position = 0;\n                        // [0xFF,0xFE] and [0xFE,0xFF] mean utf-16 (little or big endian), otherwise default to utf-8\n                        fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? \"unicode\" : \"utf-8\";\n                    }\n                    // ReadText method always strips byte order mark from resulting string\n                    return fileStream.ReadText();\n                }\n                catch (e) {\n                    throw e;\n                }\n                finally {\n                    fileStream.Close();\n                }\n            }\n            function writeFile(fileName, data, writeByteOrderMark) {\n                fileStream.Open();\n                binaryStream.Open();\n                try {\n                    // Write characters in UTF-8 encoding\n                    fileStream.Charset = \"utf-8\";\n                    fileStream.WriteText(data);\n                    // If we don't want the BOM, then skip it by setting the starting location to 3 (size of BOM).\n                    // If not, start from position 0, as the BOM will be added automatically when charset==utf8.\n                    if (writeByteOrderMark) {\n                        fileStream.Position = 0;\n                    }\n                    else {\n                        fileStream.Position = 3;\n                    }\n                    fileStream.CopyTo(binaryStream);\n                    binaryStream.SaveToFile(fileName, 2 /*overwrite*/);\n                }\n                finally {\n                    binaryStream.Close();\n                    fileStream.Close();\n                }\n            }\n            function getNames(collection) {\n                var result = [];\n                for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) {\n                    result.push(e.item().Name);\n                }\n                return result.sort();\n            }\n            function getDirectories(path) {\n                var folder = fso.GetFolder(path);\n                return getNames(folder.subfolders);\n            }\n            function getAccessibleFileSystemEntries(path) {\n                try {\n                    var folder = fso.GetFolder(path || \".\");\n                    var files = getNames(folder.files);\n                    var directories = getNames(folder.subfolders);\n                    return { files: files, directories: directories };\n                }\n                catch (e) {\n                    return { files: [], directories: [] };\n                }\n            }\n            function readDirectory(path, extensions, excludes, includes) {\n                return ts.matchFiles(path, extensions, excludes, includes, /*useCaseSensitiveFileNames*/ false, shell.CurrentDirectory, getAccessibleFileSystemEntries);\n            }\n            var wscriptSystem = {\n                args: args,\n                newLine: \"\\r\\n\",\n                useCaseSensitiveFileNames: false,\n                write: function (s) {\n                    WScript.StdOut.Write(s);\n                },\n                readFile: readFile,\n                writeFile: writeFile,\n                resolvePath: function (path) {\n                    return fso.GetAbsolutePathName(path);\n                },\n                fileExists: function (path) {\n                    return fso.FileExists(path);\n                },\n                directoryExists: function (path) {\n                    return fso.FolderExists(path);\n                },\n                createDirectory: function (directoryName) {\n                    if (!wscriptSystem.directoryExists(directoryName)) {\n                        fso.CreateFolder(directoryName);\n                    }\n                },\n                getExecutingFilePath: function () {\n                    return WScript.ScriptFullName;\n                },\n                getCurrentDirectory: function () {\n                    return shell.CurrentDirectory;\n                },\n                getDirectories: getDirectories,\n                getEnvironmentVariable: function (name) {\n                    return new ActiveXObject(\"WScript.Shell\").ExpandEnvironmentStrings(\"%\" + name + \"%\");\n                },\n                readDirectory: readDirectory,\n                exit: function (exitCode) {\n                    try {\n                        WScript.Quit(exitCode);\n                    }\n                    catch (e) {\n                    }\n                }\n            };\n            return wscriptSystem;\n        }\n        function getNodeSystem() {\n            var _fs = require(\"fs\");\n            var _path = require(\"path\");\n            var _os = require(\"os\");\n            var _crypto = require(\"crypto\");\n            var useNonPollingWatchers = process.env[\"TSC_NONPOLLING_WATCHER\"];\n            function createWatchedFileSet() {\n                var dirWatchers = ts.createMap();\n                // One file can have multiple watchers\n                var fileWatcherCallbacks = ts.createMap();\n                return { addFile: addFile, removeFile: removeFile };\n                function reduceDirWatcherRefCountForFile(fileName) {\n                    var dirName = ts.getDirectoryPath(fileName);\n                    var watcher = dirWatchers[dirName];\n                    if (watcher) {\n                        watcher.referenceCount -= 1;\n                        if (watcher.referenceCount <= 0) {\n                            watcher.close();\n                            delete dirWatchers[dirName];\n                        }\n                    }\n                }\n                function addDirWatcher(dirPath) {\n                    var watcher = dirWatchers[dirPath];\n                    if (watcher) {\n                        watcher.referenceCount += 1;\n                        return;\n                    }\n                    watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); });\n                    watcher.referenceCount = 1;\n                    dirWatchers[dirPath] = watcher;\n                    return;\n                }\n                function addFileWatcherCallback(filePath, callback) {\n                    ts.multiMapAdd(fileWatcherCallbacks, filePath, callback);\n                }\n                function addFile(fileName, callback) {\n                    addFileWatcherCallback(fileName, callback);\n                    addDirWatcher(ts.getDirectoryPath(fileName));\n                    return { fileName: fileName, callback: callback };\n                }\n                function removeFile(watchedFile) {\n                    removeFileWatcherCallback(watchedFile.fileName, watchedFile.callback);\n                    reduceDirWatcherRefCountForFile(watchedFile.fileName);\n                }\n                function removeFileWatcherCallback(filePath, callback) {\n                    ts.multiMapRemove(fileWatcherCallbacks, filePath, callback);\n                }\n                function fileEventHandler(eventName, relativeFileName, baseDirPath) {\n                    // When files are deleted from disk, the triggered \"rename\" event would have a relativefileName of \"undefined\"\n                    var fileName = typeof relativeFileName !== \"string\"\n                        ? undefined\n                        : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath);\n                    // Some applications save a working file via rename operations\n                    if ((eventName === \"change\" || eventName === \"rename\") && fileWatcherCallbacks[fileName]) {\n                        for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) {\n                            var fileCallback = _a[_i];\n                            fileCallback(fileName);\n                        }\n                    }\n                }\n            }\n            var watchedFileSet = createWatchedFileSet();\n            function isNode4OrLater() {\n                return parseInt(process.version.charAt(1)) >= 4;\n            }\n            function isFileSystemCaseSensitive() {\n                // win32\\win64 are case insensitive platforms\n                if (platform === \"win32\" || platform === \"win64\") {\n                    return false;\n                }\n                // convert current file name to upper case / lower case and check if file exists\n                // (guards against cases when name is already all uppercase or lowercase)\n                return !fileExists(__filename.toUpperCase()) || !fileExists(__filename.toLowerCase());\n            }\n            var platform = _os.platform();\n            var useCaseSensitiveFileNames = isFileSystemCaseSensitive();\n            function readFile(fileName, _encoding) {\n                if (!fileExists(fileName)) {\n                    return undefined;\n                }\n                var buffer = _fs.readFileSync(fileName);\n                var len = buffer.length;\n                if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) {\n                    // Big endian UTF-16 byte order mark detected. Since big endian is not supported by node.js,\n                    // flip all byte pairs and treat as little endian.\n                    len &= ~1;\n                    for (var i = 0; i < len; i += 2) {\n                        var temp = buffer[i];\n                        buffer[i] = buffer[i + 1];\n                        buffer[i + 1] = temp;\n                    }\n                    return buffer.toString(\"utf16le\", 2);\n                }\n                if (len >= 2 && buffer[0] === 0xFF && buffer[1] === 0xFE) {\n                    // Little endian UTF-16 byte order mark detected\n                    return buffer.toString(\"utf16le\", 2);\n                }\n                if (len >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) {\n                    // UTF-8 byte order mark detected\n                    return buffer.toString(\"utf8\", 3);\n                }\n                // Default is UTF-8 with no byte order mark\n                return buffer.toString(\"utf8\");\n            }\n            function writeFile(fileName, data, writeByteOrderMark) {\n                // If a BOM is required, emit one\n                if (writeByteOrderMark) {\n                    data = \"\\uFEFF\" + data;\n                }\n                var fd;\n                try {\n                    fd = _fs.openSync(fileName, \"w\");\n                    _fs.writeSync(fd, data, undefined, \"utf8\");\n                }\n                finally {\n                    if (fd !== undefined) {\n                        _fs.closeSync(fd);\n                    }\n                }\n            }\n            function getAccessibleFileSystemEntries(path) {\n                try {\n                    var entries = _fs.readdirSync(path || \".\").sort();\n                    var files = [];\n                    var directories = [];\n                    for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n                        var entry = entries_1[_i];\n                        // This is necessary because on some file system node fails to exclude\n                        // \".\" and \"..\". See https://github.com/nodejs/node/issues/4002\n                        if (entry === \".\" || entry === \"..\") {\n                            continue;\n                        }\n                        var name_3 = ts.combinePaths(path, entry);\n                        var stat = void 0;\n                        try {\n                            stat = _fs.statSync(name_3);\n                        }\n                        catch (e) {\n                            continue;\n                        }\n                        if (stat.isFile()) {\n                            files.push(entry);\n                        }\n                        else if (stat.isDirectory()) {\n                            directories.push(entry);\n                        }\n                    }\n                    return { files: files, directories: directories };\n                }\n                catch (e) {\n                    return { files: [], directories: [] };\n                }\n            }\n            function readDirectory(path, extensions, excludes, includes) {\n                return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), getAccessibleFileSystemEntries);\n            }\n            var FileSystemEntryKind;\n            (function (FileSystemEntryKind) {\n                FileSystemEntryKind[FileSystemEntryKind[\"File\"] = 0] = \"File\";\n                FileSystemEntryKind[FileSystemEntryKind[\"Directory\"] = 1] = \"Directory\";\n            })(FileSystemEntryKind || (FileSystemEntryKind = {}));\n            function fileSystemEntryExists(path, entryKind) {\n                try {\n                    var stat = _fs.statSync(path);\n                    switch (entryKind) {\n                        case 0 /* File */: return stat.isFile();\n                        case 1 /* Directory */: return stat.isDirectory();\n                    }\n                }\n                catch (e) {\n                    return false;\n                }\n            }\n            function fileExists(path) {\n                return fileSystemEntryExists(path, 0 /* File */);\n            }\n            function directoryExists(path) {\n                return fileSystemEntryExists(path, 1 /* Directory */);\n            }\n            function getDirectories(path) {\n                return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1 /* Directory */); });\n            }\n            var noOpFileWatcher = { close: ts.noop };\n            var nodeSystem = {\n                args: process.argv.slice(2),\n                newLine: _os.EOL,\n                useCaseSensitiveFileNames: useCaseSensitiveFileNames,\n                write: function (s) {\n                    process.stdout.write(s);\n                },\n                readFile: readFile,\n                writeFile: writeFile,\n                watchFile: function (fileName, callback, pollingInterval) {\n                    if (useNonPollingWatchers) {\n                        var watchedFile_1 = watchedFileSet.addFile(fileName, callback);\n                        return {\n                            close: function () { return watchedFileSet.removeFile(watchedFile_1); }\n                        };\n                    }\n                    else {\n                        _fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);\n                        return {\n                            close: function () { return _fs.unwatchFile(fileName, fileChanged); }\n                        };\n                    }\n                    function fileChanged(curr, prev) {\n                        if (+curr.mtime <= +prev.mtime) {\n                            return;\n                        }\n                        callback(fileName);\n                    }\n                },\n                watchDirectory: function (directoryName, callback, recursive) {\n                    // Node 4.0 `fs.watch` function supports the \"recursive\" option on both OSX and Windows\n                    // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)\n                    var options;\n                    if (!directoryExists(directoryName)) {\n                        return noOpFileWatcher;\n                    }\n                    if (isNode4OrLater() && (process.platform === \"win32\" || process.platform === \"darwin\")) {\n                        options = { persistent: true, recursive: !!recursive };\n                    }\n                    else {\n                        options = { persistent: true };\n                    }\n                    return _fs.watch(directoryName, options, function (eventName, relativeFileName) {\n                        // In watchDirectory we only care about adding and removing files (when event name is\n                        // \"rename\"); changes made within files are handled by corresponding fileWatchers (when\n                        // event name is \"change\")\n                        if (eventName === \"rename\") {\n                            // When deleting a file, the passed baseFileName is null\n                            callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName)));\n                        }\n                        ;\n                    });\n                },\n                resolvePath: function (path) {\n                    return _path.resolve(path);\n                },\n                fileExists: fileExists,\n                directoryExists: directoryExists,\n                createDirectory: function (directoryName) {\n                    if (!nodeSystem.directoryExists(directoryName)) {\n                        _fs.mkdirSync(directoryName);\n                    }\n                },\n                getExecutingFilePath: function () {\n                    return __filename;\n                },\n                getCurrentDirectory: function () {\n                    return process.cwd();\n                },\n                getDirectories: getDirectories,\n                getEnvironmentVariable: function (name) {\n                    return process.env[name] || \"\";\n                },\n                readDirectory: readDirectory,\n                getModifiedTime: function (path) {\n                    try {\n                        return _fs.statSync(path).mtime;\n                    }\n                    catch (e) {\n                        return undefined;\n                    }\n                },\n                createHash: function (data) {\n                    var hash = _crypto.createHash(\"md5\");\n                    hash.update(data);\n                    return hash.digest(\"hex\");\n                },\n                getMemoryUsage: function () {\n                    if (global.gc) {\n                        global.gc();\n                    }\n                    return process.memoryUsage().heapUsed;\n                },\n                getFileSize: function (path) {\n                    try {\n                        var stat = _fs.statSync(path);\n                        if (stat.isFile()) {\n                            return stat.size;\n                        }\n                    }\n                    catch (e) { }\n                    return 0;\n                },\n                exit: function (exitCode) {\n                    process.exit(exitCode);\n                },\n                realpath: function (path) {\n                    return _fs.realpathSync(path);\n                },\n                tryEnableSourceMapsForHost: function () {\n                    try {\n                        require(\"source-map-support\").install();\n                    }\n                    catch (e) {\n                    }\n                },\n                setTimeout: setTimeout,\n                clearTimeout: clearTimeout\n            };\n            return nodeSystem;\n        }\n        function getChakraSystem() {\n            var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });\n            return {\n                newLine: ChakraHost.newLine || \"\\r\\n\",\n                args: ChakraHost.args,\n                useCaseSensitiveFileNames: !!ChakraHost.useCaseSensitiveFileNames,\n                write: ChakraHost.echo,\n                readFile: function (path, _encoding) {\n                    // encoding is automatically handled by the implementation in ChakraHost\n                    return ChakraHost.readFile(path);\n                },\n                writeFile: function (path, data, writeByteOrderMark) {\n                    // If a BOM is required, emit one\n                    if (writeByteOrderMark) {\n                        data = \"\\uFEFF\" + data;\n                    }\n                    ChakraHost.writeFile(path, data);\n                },\n                resolvePath: ChakraHost.resolvePath,\n                fileExists: ChakraHost.fileExists,\n                directoryExists: ChakraHost.directoryExists,\n                createDirectory: ChakraHost.createDirectory,\n                getExecutingFilePath: function () { return ChakraHost.executingFile; },\n                getCurrentDirectory: function () { return ChakraHost.currentDirectory; },\n                getDirectories: ChakraHost.getDirectories,\n                getEnvironmentVariable: ChakraHost.getEnvironmentVariable || (function () { return \"\"; }),\n                readDirectory: function (path, extensions, excludes, includes) {\n                    var pattern = ts.getFileMatcherPatterns(path, excludes, includes, !!ChakraHost.useCaseSensitiveFileNames, ChakraHost.currentDirectory);\n                    return ChakraHost.readDirectory(path, extensions, pattern.basePaths, pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern);\n                },\n                exit: ChakraHost.quit,\n                realpath: realpath\n            };\n        }\n        function recursiveCreateDirectory(directoryPath, sys) {\n            var basePath = ts.getDirectoryPath(directoryPath);\n            var shouldCreateParent = directoryPath !== basePath && !sys.directoryExists(basePath);\n            if (shouldCreateParent) {\n                recursiveCreateDirectory(basePath, sys);\n            }\n            if (shouldCreateParent || !sys.directoryExists(directoryPath)) {\n                sys.createDirectory(directoryPath);\n            }\n        }\n        var sys;\n        if (typeof ChakraHost !== \"undefined\") {\n            sys = getChakraSystem();\n        }\n        else if (typeof WScript !== \"undefined\" && typeof ActiveXObject === \"function\") {\n            sys = getWScriptSystem();\n        }\n        else if (typeof process !== \"undefined\" && process.nextTick && !process.browser && typeof require !== \"undefined\") {\n            // process and process.nextTick checks if current environment is node-like\n            // process.browser check excludes webpack and browserify\n            sys = getNodeSystem();\n        }\n        if (sys) {\n            // patch writefile to create folder before writing the file\n            var originalWriteFile_1 = sys.writeFile;\n            sys.writeFile = function (path, data, writeBom) {\n                var directoryPath = ts.getDirectoryPath(ts.normalizeSlashes(path));\n                if (directoryPath && !sys.directoryExists(directoryPath)) {\n                    recursiveCreateDirectory(directoryPath, sys);\n                }\n                originalWriteFile_1.call(sys, path, data, writeBom);\n            };\n        }\n        return sys;\n    })();\n    if (ts.sys && ts.sys.getEnvironmentVariable) {\n        ts.Debug.currentAssertionLevel = /^development$/i.test(ts.sys.getEnvironmentVariable(\"NODE_ENV\"))\n            ? 1 /* Normal */\n            : 0 /* None */;\n    }\n})(ts || (ts = {}));\n// <auto-generated />\n/// <reference path=\"types.ts\" />\n/* @internal */\nvar ts;\n(function (ts) {\n    ts.Diagnostics = {\n        Unterminated_string_literal: { code: 1002, category: ts.DiagnosticCategory.Error, key: \"Unterminated_string_literal_1002\", message: \"Unterminated string literal.\" },\n        Identifier_expected: { code: 1003, category: ts.DiagnosticCategory.Error, key: \"Identifier_expected_1003\", message: \"Identifier expected.\" },\n        _0_expected: { code: 1005, category: ts.DiagnosticCategory.Error, key: \"_0_expected_1005\", message: \"'{0}' expected.\" },\n        A_file_cannot_have_a_reference_to_itself: { code: 1006, category: ts.DiagnosticCategory.Error, key: \"A_file_cannot_have_a_reference_to_itself_1006\", message: \"A file cannot have a reference to itself.\" },\n        Trailing_comma_not_allowed: { code: 1009, category: ts.DiagnosticCategory.Error, key: \"Trailing_comma_not_allowed_1009\", message: \"Trailing comma not allowed.\" },\n        Asterisk_Slash_expected: { code: 1010, category: ts.DiagnosticCategory.Error, key: \"Asterisk_Slash_expected_1010\", message: \"'*/' expected.\" },\n        Unexpected_token: { code: 1012, category: ts.DiagnosticCategory.Error, key: \"Unexpected_token_1012\", message: \"Unexpected token.\" },\n        A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: ts.DiagnosticCategory.Error, key: \"A_rest_parameter_must_be_last_in_a_parameter_list_1014\", message: \"A rest parameter must be last in a parameter list.\" },\n        Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: ts.DiagnosticCategory.Error, key: \"Parameter_cannot_have_question_mark_and_initializer_1015\", message: \"Parameter cannot have question mark and initializer.\" },\n        A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: ts.DiagnosticCategory.Error, key: \"A_required_parameter_cannot_follow_an_optional_parameter_1016\", message: \"A required parameter cannot follow an optional parameter.\" },\n        An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_cannot_have_a_rest_parameter_1017\", message: \"An index signature cannot have a rest parameter.\" },\n        An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_parameter_cannot_have_an_accessibility_modifier_1018\", message: \"An index signature parameter cannot have an accessibility modifier.\" },\n        An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_parameter_cannot_have_a_question_mark_1019\", message: \"An index signature parameter cannot have a question mark.\" },\n        An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_parameter_cannot_have_an_initializer_1020\", message: \"An index signature parameter cannot have an initializer.\" },\n        An_index_signature_must_have_a_type_annotation: { code: 1021, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_must_have_a_type_annotation_1021\", message: \"An index signature must have a type annotation.\" },\n        An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_parameter_must_have_a_type_annotation_1022\", message: \"An index signature parameter must have a type annotation.\" },\n        An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_parameter_type_must_be_string_or_number_1023\", message: \"An index signature parameter type must be 'string' or 'number'.\" },\n        readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature: { code: 1024, category: ts.DiagnosticCategory.Error, key: \"readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature_1024\", message: \"'readonly' modifier can only appear on a property declaration or index signature.\" },\n        Accessibility_modifier_already_seen: { code: 1028, category: ts.DiagnosticCategory.Error, key: \"Accessibility_modifier_already_seen_1028\", message: \"Accessibility modifier already seen.\" },\n        _0_modifier_must_precede_1_modifier: { code: 1029, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_must_precede_1_modifier_1029\", message: \"'{0}' modifier must precede '{1}' modifier.\" },\n        _0_modifier_already_seen: { code: 1030, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_already_seen_1030\", message: \"'{0}' modifier already seen.\" },\n        _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_class_element_1031\", message: \"'{0}' modifier cannot appear on a class element.\" },\n        super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: ts.DiagnosticCategory.Error, key: \"super_must_be_followed_by_an_argument_list_or_member_access_1034\", message: \"'super' must be followed by an argument list or member access.\" },\n        Only_ambient_modules_can_use_quoted_names: { code: 1035, category: ts.DiagnosticCategory.Error, key: \"Only_ambient_modules_can_use_quoted_names_1035\", message: \"Only ambient modules can use quoted names.\" },\n        Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: ts.DiagnosticCategory.Error, key: \"Statements_are_not_allowed_in_ambient_contexts_1036\", message: \"Statements are not allowed in ambient contexts.\" },\n        A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: ts.DiagnosticCategory.Error, key: \"A_declare_modifier_cannot_be_used_in_an_already_ambient_context_1038\", message: \"A 'declare' modifier cannot be used in an already ambient context.\" },\n        Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: ts.DiagnosticCategory.Error, key: \"Initializers_are_not_allowed_in_ambient_contexts_1039\", message: \"Initializers are not allowed in ambient contexts.\" },\n        _0_modifier_cannot_be_used_in_an_ambient_context: { code: 1040, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_be_used_in_an_ambient_context_1040\", message: \"'{0}' modifier cannot be used in an ambient context.\" },\n        _0_modifier_cannot_be_used_with_a_class_declaration: { code: 1041, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_be_used_with_a_class_declaration_1041\", message: \"'{0}' modifier cannot be used with a class declaration.\" },\n        _0_modifier_cannot_be_used_here: { code: 1042, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_be_used_here_1042\", message: \"'{0}' modifier cannot be used here.\" },\n        _0_modifier_cannot_appear_on_a_data_property: { code: 1043, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_data_property_1043\", message: \"'{0}' modifier cannot appear on a data property.\" },\n        _0_modifier_cannot_appear_on_a_module_or_namespace_element: { code: 1044, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044\", message: \"'{0}' modifier cannot appear on a module or namespace element.\" },\n        A_0_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: ts.DiagnosticCategory.Error, key: \"A_0_modifier_cannot_be_used_with_an_interface_declaration_1045\", message: \"A '{0}' modifier cannot be used with an interface declaration.\" },\n        A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: ts.DiagnosticCategory.Error, key: \"A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046\", message: \"A 'declare' modifier is required for a top level declaration in a .d.ts file.\" },\n        A_rest_parameter_cannot_be_optional: { code: 1047, category: ts.DiagnosticCategory.Error, key: \"A_rest_parameter_cannot_be_optional_1047\", message: \"A rest parameter cannot be optional.\" },\n        A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: ts.DiagnosticCategory.Error, key: \"A_rest_parameter_cannot_have_an_initializer_1048\", message: \"A rest parameter cannot have an initializer.\" },\n        A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: ts.DiagnosticCategory.Error, key: \"A_set_accessor_must_have_exactly_one_parameter_1049\", message: \"A 'set' accessor must have exactly one parameter.\" },\n        A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: ts.DiagnosticCategory.Error, key: \"A_set_accessor_cannot_have_an_optional_parameter_1051\", message: \"A 'set' accessor cannot have an optional parameter.\" },\n        A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: ts.DiagnosticCategory.Error, key: \"A_set_accessor_parameter_cannot_have_an_initializer_1052\", message: \"A 'set' accessor parameter cannot have an initializer.\" },\n        A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: ts.DiagnosticCategory.Error, key: \"A_set_accessor_cannot_have_rest_parameter_1053\", message: \"A 'set' accessor cannot have rest parameter.\" },\n        A_get_accessor_cannot_have_parameters: { code: 1054, category: ts.DiagnosticCategory.Error, key: \"A_get_accessor_cannot_have_parameters_1054\", message: \"A 'get' accessor cannot have parameters.\" },\n        Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: { code: 1055, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055\", message: \"Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.\" },\n        Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: \"Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056\", message: \"Accessors are only available when targeting ECMAScript 5 and higher.\" },\n        An_async_function_or_method_must_have_a_valid_awaitable_return_type: { code: 1057, category: ts.DiagnosticCategory.Error, key: \"An_async_function_or_method_must_have_a_valid_awaitable_return_type_1057\", message: \"An async function or method must have a valid awaitable return type.\" },\n        Operand_for_await_does_not_have_a_valid_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: \"Operand_for_await_does_not_have_a_valid_callable_then_member_1058\", message: \"Operand for 'await' does not have a valid callable 'then' member.\" },\n        Return_expression_in_async_function_does_not_have_a_valid_callable_then_member: { code: 1059, category: ts.DiagnosticCategory.Error, key: \"Return_expression_in_async_function_does_not_have_a_valid_callable_then_member_1059\", message: \"Return expression in async function does not have a valid callable 'then' member.\" },\n        Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member: { code: 1060, category: ts.DiagnosticCategory.Error, key: \"Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member_1060\", message: \"Expression body for async arrow function does not have a valid callable 'then' member.\" },\n        Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: \"Enum_member_must_have_initializer_1061\", message: \"Enum member must have initializer.\" },\n        _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: \"_0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062\", message: \"{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method.\" },\n        An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: \"An_export_assignment_cannot_be_used_in_a_namespace_1063\", message: \"An export assignment cannot be used in a namespace.\" },\n        The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { code: 1064, category: ts.DiagnosticCategory.Error, key: \"The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064\", message: \"The return type of an async function or method must be the global Promise<T> type.\" },\n        In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: \"In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066\", message: \"In ambient enum declarations member initializer must be constant expression.\" },\n        Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: \"Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068\", message: \"Unexpected token. A constructor, method, accessor, or property was expected.\" },\n        _0_modifier_cannot_appear_on_a_type_member: { code: 1070, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_type_member_1070\", message: \"'{0}' modifier cannot appear on a type member.\" },\n        _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_an_index_signature_1071\", message: \"'{0}' modifier cannot appear on an index signature.\" },\n        A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: \"A_0_modifier_cannot_be_used_with_an_import_declaration_1079\", message: \"A '{0}' modifier cannot be used with an import declaration.\" },\n        Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: \"Invalid_reference_directive_syntax_1084\", message: \"Invalid 'reference' directive syntax.\" },\n        Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: \"Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085\", message: \"Octal literals are not available when targeting ECMAScript 5 and higher.\" },\n        An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: \"An_accessor_cannot_be_declared_in_an_ambient_context_1086\", message: \"An accessor cannot be declared in an ambient context.\" },\n        _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_constructor_declaration_1089\", message: \"'{0}' modifier cannot appear on a constructor declaration.\" },\n        _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_appear_on_a_parameter_1090\", message: \"'{0}' modifier cannot appear on a parameter.\" },\n        Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: ts.DiagnosticCategory.Error, key: \"Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091\", message: \"Only a single variable declaration is allowed in a 'for...in' statement.\" },\n        Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: ts.DiagnosticCategory.Error, key: \"Type_parameters_cannot_appear_on_a_constructor_declaration_1092\", message: \"Type parameters cannot appear on a constructor declaration.\" },\n        Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: ts.DiagnosticCategory.Error, key: \"Type_annotation_cannot_appear_on_a_constructor_declaration_1093\", message: \"Type annotation cannot appear on a constructor declaration.\" },\n        An_accessor_cannot_have_type_parameters: { code: 1094, category: ts.DiagnosticCategory.Error, key: \"An_accessor_cannot_have_type_parameters_1094\", message: \"An accessor cannot have type parameters.\" },\n        A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: ts.DiagnosticCategory.Error, key: \"A_set_accessor_cannot_have_a_return_type_annotation_1095\", message: \"A 'set' accessor cannot have a return type annotation.\" },\n        An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: ts.DiagnosticCategory.Error, key: \"An_index_signature_must_have_exactly_one_parameter_1096\", message: \"An index signature must have exactly one parameter.\" },\n        _0_list_cannot_be_empty: { code: 1097, category: ts.DiagnosticCategory.Error, key: \"_0_list_cannot_be_empty_1097\", message: \"'{0}' list cannot be empty.\" },\n        Type_parameter_list_cannot_be_empty: { code: 1098, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_list_cannot_be_empty_1098\", message: \"Type parameter list cannot be empty.\" },\n        Type_argument_list_cannot_be_empty: { code: 1099, category: ts.DiagnosticCategory.Error, key: \"Type_argument_list_cannot_be_empty_1099\", message: \"Type argument list cannot be empty.\" },\n        Invalid_use_of_0_in_strict_mode: { code: 1100, category: ts.DiagnosticCategory.Error, key: \"Invalid_use_of_0_in_strict_mode_1100\", message: \"Invalid use of '{0}' in strict mode.\" },\n        with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: ts.DiagnosticCategory.Error, key: \"with_statements_are_not_allowed_in_strict_mode_1101\", message: \"'with' statements are not allowed in strict mode.\" },\n        delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: ts.DiagnosticCategory.Error, key: \"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102\", message: \"'delete' cannot be called on an identifier in strict mode.\" },\n        A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: ts.DiagnosticCategory.Error, key: \"A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104\", message: \"A 'continue' statement can only be used within an enclosing iteration statement.\" },\n        A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: ts.DiagnosticCategory.Error, key: \"A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105\", message: \"A 'break' statement can only be used within an enclosing iteration or switch statement.\" },\n        Jump_target_cannot_cross_function_boundary: { code: 1107, category: ts.DiagnosticCategory.Error, key: \"Jump_target_cannot_cross_function_boundary_1107\", message: \"Jump target cannot cross function boundary.\" },\n        A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: ts.DiagnosticCategory.Error, key: \"A_return_statement_can_only_be_used_within_a_function_body_1108\", message: \"A 'return' statement can only be used within a function body.\" },\n        Expression_expected: { code: 1109, category: ts.DiagnosticCategory.Error, key: \"Expression_expected_1109\", message: \"Expression expected.\" },\n        Type_expected: { code: 1110, category: ts.DiagnosticCategory.Error, key: \"Type_expected_1110\", message: \"Type expected.\" },\n        A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: ts.DiagnosticCategory.Error, key: \"A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113\", message: \"A 'default' clause cannot appear more than once in a 'switch' statement.\" },\n        Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: \"Duplicate_label_0_1114\", message: \"Duplicate label '{0}'\" },\n        A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: ts.DiagnosticCategory.Error, key: \"A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115\", message: \"A 'continue' statement can only jump to a label of an enclosing iteration statement.\" },\n        A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: ts.DiagnosticCategory.Error, key: \"A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116\", message: \"A 'break' statement can only jump to a label of an enclosing statement.\" },\n        An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: ts.DiagnosticCategory.Error, key: \"An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode_1117\", message: \"An object literal cannot have multiple properties with the same name in strict mode.\" },\n        An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: ts.DiagnosticCategory.Error, key: \"An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118\", message: \"An object literal cannot have multiple get/set accessors with the same name.\" },\n        An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: ts.DiagnosticCategory.Error, key: \"An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119\", message: \"An object literal cannot have property and accessor with the same name.\" },\n        An_export_assignment_cannot_have_modifiers: { code: 1120, category: ts.DiagnosticCategory.Error, key: \"An_export_assignment_cannot_have_modifiers_1120\", message: \"An export assignment cannot have modifiers.\" },\n        Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: ts.DiagnosticCategory.Error, key: \"Octal_literals_are_not_allowed_in_strict_mode_1121\", message: \"Octal literals are not allowed in strict mode.\" },\n        A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: ts.DiagnosticCategory.Error, key: \"A_tuple_type_element_list_cannot_be_empty_1122\", message: \"A tuple type element list cannot be empty.\" },\n        Variable_declaration_list_cannot_be_empty: { code: 1123, category: ts.DiagnosticCategory.Error, key: \"Variable_declaration_list_cannot_be_empty_1123\", message: \"Variable declaration list cannot be empty.\" },\n        Digit_expected: { code: 1124, category: ts.DiagnosticCategory.Error, key: \"Digit_expected_1124\", message: \"Digit expected.\" },\n        Hexadecimal_digit_expected: { code: 1125, category: ts.DiagnosticCategory.Error, key: \"Hexadecimal_digit_expected_1125\", message: \"Hexadecimal digit expected.\" },\n        Unexpected_end_of_text: { code: 1126, category: ts.DiagnosticCategory.Error, key: \"Unexpected_end_of_text_1126\", message: \"Unexpected end of text.\" },\n        Invalid_character: { code: 1127, category: ts.DiagnosticCategory.Error, key: \"Invalid_character_1127\", message: \"Invalid character.\" },\n        Declaration_or_statement_expected: { code: 1128, category: ts.DiagnosticCategory.Error, key: \"Declaration_or_statement_expected_1128\", message: \"Declaration or statement expected.\" },\n        Statement_expected: { code: 1129, category: ts.DiagnosticCategory.Error, key: \"Statement_expected_1129\", message: \"Statement expected.\" },\n        case_or_default_expected: { code: 1130, category: ts.DiagnosticCategory.Error, key: \"case_or_default_expected_1130\", message: \"'case' or 'default' expected.\" },\n        Property_or_signature_expected: { code: 1131, category: ts.DiagnosticCategory.Error, key: \"Property_or_signature_expected_1131\", message: \"Property or signature expected.\" },\n        Enum_member_expected: { code: 1132, category: ts.DiagnosticCategory.Error, key: \"Enum_member_expected_1132\", message: \"Enum member expected.\" },\n        Variable_declaration_expected: { code: 1134, category: ts.DiagnosticCategory.Error, key: \"Variable_declaration_expected_1134\", message: \"Variable declaration expected.\" },\n        Argument_expression_expected: { code: 1135, category: ts.DiagnosticCategory.Error, key: \"Argument_expression_expected_1135\", message: \"Argument expression expected.\" },\n        Property_assignment_expected: { code: 1136, category: ts.DiagnosticCategory.Error, key: \"Property_assignment_expected_1136\", message: \"Property assignment expected.\" },\n        Expression_or_comma_expected: { code: 1137, category: ts.DiagnosticCategory.Error, key: \"Expression_or_comma_expected_1137\", message: \"Expression or comma expected.\" },\n        Parameter_declaration_expected: { code: 1138, category: ts.DiagnosticCategory.Error, key: \"Parameter_declaration_expected_1138\", message: \"Parameter declaration expected.\" },\n        Type_parameter_declaration_expected: { code: 1139, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_declaration_expected_1139\", message: \"Type parameter declaration expected.\" },\n        Type_argument_expected: { code: 1140, category: ts.DiagnosticCategory.Error, key: \"Type_argument_expected_1140\", message: \"Type argument expected.\" },\n        String_literal_expected: { code: 1141, category: ts.DiagnosticCategory.Error, key: \"String_literal_expected_1141\", message: \"String literal expected.\" },\n        Line_break_not_permitted_here: { code: 1142, category: ts.DiagnosticCategory.Error, key: \"Line_break_not_permitted_here_1142\", message: \"Line break not permitted here.\" },\n        or_expected: { code: 1144, category: ts.DiagnosticCategory.Error, key: \"or_expected_1144\", message: \"'{' or ';' expected.\" },\n        Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: \"Declaration_expected_1146\", message: \"Declaration expected.\" },\n        Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: \"Import_declarations_in_a_namespace_cannot_reference_a_module_1147\", message: \"Import declarations in a namespace cannot reference a module.\" },\n        Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: { code: 1148, category: ts.DiagnosticCategory.Error, key: \"Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148\", message: \"Cannot use imports, exports, or module augmentations when '--module' is 'none'.\" },\n        File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: \"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149\", message: \"File name '{0}' differs from already included file name '{1}' only in casing\" },\n        new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: ts.DiagnosticCategory.Error, key: \"new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150\", message: \"'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead.\" },\n        const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: \"const_declarations_must_be_initialized_1155\", message: \"'const' declarations must be initialized\" },\n        const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: ts.DiagnosticCategory.Error, key: \"const_declarations_can_only_be_declared_inside_a_block_1156\", message: \"'const' declarations can only be declared inside a block.\" },\n        let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: ts.DiagnosticCategory.Error, key: \"let_declarations_can_only_be_declared_inside_a_block_1157\", message: \"'let' declarations can only be declared inside a block.\" },\n        Unterminated_template_literal: { code: 1160, category: ts.DiagnosticCategory.Error, key: \"Unterminated_template_literal_1160\", message: \"Unterminated template literal.\" },\n        Unterminated_regular_expression_literal: { code: 1161, category: ts.DiagnosticCategory.Error, key: \"Unterminated_regular_expression_literal_1161\", message: \"Unterminated regular expression literal.\" },\n        An_object_member_cannot_be_declared_optional: { code: 1162, category: ts.DiagnosticCategory.Error, key: \"An_object_member_cannot_be_declared_optional_1162\", message: \"An object member cannot be declared optional.\" },\n        A_yield_expression_is_only_allowed_in_a_generator_body: { code: 1163, category: ts.DiagnosticCategory.Error, key: \"A_yield_expression_is_only_allowed_in_a_generator_body_1163\", message: \"A 'yield' expression is only allowed in a generator body.\" },\n        Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: ts.DiagnosticCategory.Error, key: \"Computed_property_names_are_not_allowed_in_enums_1164\", message: \"Computed property names are not allowed in enums.\" },\n        A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol_1165\", message: \"A computed property name in an ambient context must directly refer to a built-in symbol.\" },\n        A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol_1166\", message: \"A computed property name in a class property declaration must directly refer to a built-in symbol.\" },\n        A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol_1168\", message: \"A computed property name in a method overload must directly refer to a built-in symbol.\" },\n        A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol_1169\", message: \"A computed property name in an interface must directly refer to a built-in symbol.\" },\n        A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol_1170\", message: \"A computed property name in a type literal must directly refer to a built-in symbol.\" },\n        A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: ts.DiagnosticCategory.Error, key: \"A_comma_expression_is_not_allowed_in_a_computed_property_name_1171\", message: \"A comma expression is not allowed in a computed property name.\" },\n        extends_clause_already_seen: { code: 1172, category: ts.DiagnosticCategory.Error, key: \"extends_clause_already_seen_1172\", message: \"'extends' clause already seen.\" },\n        extends_clause_must_precede_implements_clause: { code: 1173, category: ts.DiagnosticCategory.Error, key: \"extends_clause_must_precede_implements_clause_1173\", message: \"'extends' clause must precede 'implements' clause.\" },\n        Classes_can_only_extend_a_single_class: { code: 1174, category: ts.DiagnosticCategory.Error, key: \"Classes_can_only_extend_a_single_class_1174\", message: \"Classes can only extend a single class.\" },\n        implements_clause_already_seen: { code: 1175, category: ts.DiagnosticCategory.Error, key: \"implements_clause_already_seen_1175\", message: \"'implements' clause already seen.\" },\n        Interface_declaration_cannot_have_implements_clause: { code: 1176, category: ts.DiagnosticCategory.Error, key: \"Interface_declaration_cannot_have_implements_clause_1176\", message: \"Interface declaration cannot have 'implements' clause.\" },\n        Binary_digit_expected: { code: 1177, category: ts.DiagnosticCategory.Error, key: \"Binary_digit_expected_1177\", message: \"Binary digit expected.\" },\n        Octal_digit_expected: { code: 1178, category: ts.DiagnosticCategory.Error, key: \"Octal_digit_expected_1178\", message: \"Octal digit expected.\" },\n        Unexpected_token_expected: { code: 1179, category: ts.DiagnosticCategory.Error, key: \"Unexpected_token_expected_1179\", message: \"Unexpected token. '{' expected.\" },\n        Property_destructuring_pattern_expected: { code: 1180, category: ts.DiagnosticCategory.Error, key: \"Property_destructuring_pattern_expected_1180\", message: \"Property destructuring pattern expected.\" },\n        Array_element_destructuring_pattern_expected: { code: 1181, category: ts.DiagnosticCategory.Error, key: \"Array_element_destructuring_pattern_expected_1181\", message: \"Array element destructuring pattern expected.\" },\n        A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: ts.DiagnosticCategory.Error, key: \"A_destructuring_declaration_must_have_an_initializer_1182\", message: \"A destructuring declaration must have an initializer.\" },\n        An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1183, category: ts.DiagnosticCategory.Error, key: \"An_implementation_cannot_be_declared_in_ambient_contexts_1183\", message: \"An implementation cannot be declared in ambient contexts.\" },\n        Modifiers_cannot_appear_here: { code: 1184, category: ts.DiagnosticCategory.Error, key: \"Modifiers_cannot_appear_here_1184\", message: \"Modifiers cannot appear here.\" },\n        Merge_conflict_marker_encountered: { code: 1185, category: ts.DiagnosticCategory.Error, key: \"Merge_conflict_marker_encountered_1185\", message: \"Merge conflict marker encountered.\" },\n        A_rest_element_cannot_have_an_initializer: { code: 1186, category: ts.DiagnosticCategory.Error, key: \"A_rest_element_cannot_have_an_initializer_1186\", message: \"A rest element cannot have an initializer.\" },\n        A_parameter_property_may_not_be_declared_using_a_binding_pattern: { code: 1187, category: ts.DiagnosticCategory.Error, key: \"A_parameter_property_may_not_be_declared_using_a_binding_pattern_1187\", message: \"A parameter property may not be declared using a binding pattern.\" },\n        Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: ts.DiagnosticCategory.Error, key: \"Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement_1188\", message: \"Only a single variable declaration is allowed in a 'for...of' statement.\" },\n        The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: ts.DiagnosticCategory.Error, key: \"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189\", message: \"The variable declaration of a 'for...in' statement cannot have an initializer.\" },\n        The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: ts.DiagnosticCategory.Error, key: \"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190\", message: \"The variable declaration of a 'for...of' statement cannot have an initializer.\" },\n        An_import_declaration_cannot_have_modifiers: { code: 1191, category: ts.DiagnosticCategory.Error, key: \"An_import_declaration_cannot_have_modifiers_1191\", message: \"An import declaration cannot have modifiers.\" },\n        Module_0_has_no_default_export: { code: 1192, category: ts.DiagnosticCategory.Error, key: \"Module_0_has_no_default_export_1192\", message: \"Module '{0}' has no default export.\" },\n        An_export_declaration_cannot_have_modifiers: { code: 1193, category: ts.DiagnosticCategory.Error, key: \"An_export_declaration_cannot_have_modifiers_1193\", message: \"An export declaration cannot have modifiers.\" },\n        Export_declarations_are_not_permitted_in_a_namespace: { code: 1194, category: ts.DiagnosticCategory.Error, key: \"Export_declarations_are_not_permitted_in_a_namespace_1194\", message: \"Export declarations are not permitted in a namespace.\" },\n        Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: ts.DiagnosticCategory.Error, key: \"Catch_clause_variable_cannot_have_a_type_annotation_1196\", message: \"Catch clause variable cannot have a type annotation.\" },\n        Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: ts.DiagnosticCategory.Error, key: \"Catch_clause_variable_cannot_have_an_initializer_1197\", message: \"Catch clause variable cannot have an initializer.\" },\n        An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: ts.DiagnosticCategory.Error, key: \"An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198\", message: \"An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive.\" },\n        Unterminated_Unicode_escape_sequence: { code: 1199, category: ts.DiagnosticCategory.Error, key: \"Unterminated_Unicode_escape_sequence_1199\", message: \"Unterminated Unicode escape sequence.\" },\n        Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: \"Line_terminator_not_permitted_before_arrow_1200\", message: \"Line terminator not permitted before arrow.\" },\n        Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: \"Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asteri_1202\", message: \"Import assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'import * as ns from \\\"mod\\\"', 'import {a} from \\\"mod\\\"', 'import d from \\\"mod\\\"', or another module format instead.\" },\n        Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_default_or_another_module_format_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: \"Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_defaul_1203\", message: \"Export assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'export default' or another module format instead.\" },\n        Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: \"Decorators_are_not_valid_here_1206\", message: \"Decorators are not valid here.\" },\n        Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: \"Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207\", message: \"Decorators cannot be applied to multiple get/set accessors of the same name.\" },\n        Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: \"Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208\", message: \"Cannot compile namespaces when the '--isolatedModules' flag is provided.\" },\n        Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: \"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209\", message: \"Ambient const enums are not allowed when the '--isolatedModules' flag is provided.\" },\n        Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: ts.DiagnosticCategory.Error, key: \"Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210\", message: \"Invalid use of '{0}'. Class definitions are automatically in strict mode.\" },\n        A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: \"A_class_declaration_without_the_default_modifier_must_have_a_name_1211\", message: \"A class declaration without the 'default' modifier must have a name\" },\n        Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: \"Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212\", message: \"Identifier expected. '{0}' is a reserved word in strict mode\" },\n        Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: ts.DiagnosticCategory.Error, key: \"Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213\", message: \"Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode.\" },\n        Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: \"Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214\", message: \"Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode.\" },\n        Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: \"Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215\", message: \"Invalid use of '{0}'. Modules are automatically in strict mode.\" },\n        Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: \"Export_assignment_is_not_supported_when_module_flag_is_system_1218\", message: \"Export assignment is not supported when '--module' flag is 'system'.\" },\n        Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: \"Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219\", message: \"Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.\" },\n        Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: { code: 1220, category: ts.DiagnosticCategory.Error, key: \"Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220\", message: \"Generators are only available when targeting ECMAScript 2015 or higher.\" },\n        Generators_are_not_allowed_in_an_ambient_context: { code: 1221, category: ts.DiagnosticCategory.Error, key: \"Generators_are_not_allowed_in_an_ambient_context_1221\", message: \"Generators are not allowed in an ambient context.\" },\n        An_overload_signature_cannot_be_declared_as_a_generator: { code: 1222, category: ts.DiagnosticCategory.Error, key: \"An_overload_signature_cannot_be_declared_as_a_generator_1222\", message: \"An overload signature cannot be declared as a generator.\" },\n        _0_tag_already_specified: { code: 1223, category: ts.DiagnosticCategory.Error, key: \"_0_tag_already_specified_1223\", message: \"'{0}' tag already specified.\" },\n        Signature_0_must_have_a_type_predicate: { code: 1224, category: ts.DiagnosticCategory.Error, key: \"Signature_0_must_have_a_type_predicate_1224\", message: \"Signature '{0}' must have a type predicate.\" },\n        Cannot_find_parameter_0: { code: 1225, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_parameter_0_1225\", message: \"Cannot find parameter '{0}'.\" },\n        Type_predicate_0_is_not_assignable_to_1: { code: 1226, category: ts.DiagnosticCategory.Error, key: \"Type_predicate_0_is_not_assignable_to_1_1226\", message: \"Type predicate '{0}' is not assignable to '{1}'.\" },\n        Parameter_0_is_not_in_the_same_position_as_parameter_1: { code: 1227, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_is_not_in_the_same_position_as_parameter_1_1227\", message: \"Parameter '{0}' is not in the same position as parameter '{1}'.\" },\n        A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods: { code: 1228, category: ts.DiagnosticCategory.Error, key: \"A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods_1228\", message: \"A type predicate is only allowed in return type position for functions and methods.\" },\n        A_type_predicate_cannot_reference_a_rest_parameter: { code: 1229, category: ts.DiagnosticCategory.Error, key: \"A_type_predicate_cannot_reference_a_rest_parameter_1229\", message: \"A type predicate cannot reference a rest parameter.\" },\n        A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: { code: 1230, category: ts.DiagnosticCategory.Error, key: \"A_type_predicate_cannot_reference_element_0_in_a_binding_pattern_1230\", message: \"A type predicate cannot reference element '{0}' in a binding pattern.\" },\n        An_export_assignment_can_only_be_used_in_a_module: { code: 1231, category: ts.DiagnosticCategory.Error, key: \"An_export_assignment_can_only_be_used_in_a_module_1231\", message: \"An export assignment can only be used in a module.\" },\n        An_import_declaration_can_only_be_used_in_a_namespace_or_module: { code: 1232, category: ts.DiagnosticCategory.Error, key: \"An_import_declaration_can_only_be_used_in_a_namespace_or_module_1232\", message: \"An import declaration can only be used in a namespace or module.\" },\n        An_export_declaration_can_only_be_used_in_a_module: { code: 1233, category: ts.DiagnosticCategory.Error, key: \"An_export_declaration_can_only_be_used_in_a_module_1233\", message: \"An export declaration can only be used in a module.\" },\n        An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { code: 1234, category: ts.DiagnosticCategory.Error, key: \"An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234\", message: \"An ambient module declaration is only allowed at the top level in a file.\" },\n        A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { code: 1235, category: ts.DiagnosticCategory.Error, key: \"A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235\", message: \"A namespace declaration is only allowed in a namespace or module.\" },\n        The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { code: 1236, category: ts.DiagnosticCategory.Error, key: \"The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236\", message: \"The return type of a property decorator function must be either 'void' or 'any'.\" },\n        The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { code: 1237, category: ts.DiagnosticCategory.Error, key: \"The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any_1237\", message: \"The return type of a parameter decorator function must be either 'void' or 'any'.\" },\n        Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { code: 1238, category: ts.DiagnosticCategory.Error, key: \"Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression_1238\", message: \"Unable to resolve signature of class decorator when called as an expression.\" },\n        Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: { code: 1239, category: ts.DiagnosticCategory.Error, key: \"Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression_1239\", message: \"Unable to resolve signature of parameter decorator when called as an expression.\" },\n        Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: { code: 1240, category: ts.DiagnosticCategory.Error, key: \"Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression_1240\", message: \"Unable to resolve signature of property decorator when called as an expression.\" },\n        Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: { code: 1241, category: ts.DiagnosticCategory.Error, key: \"Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression_1241\", message: \"Unable to resolve signature of method decorator when called as an expression.\" },\n        abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration: { code: 1242, category: ts.DiagnosticCategory.Error, key: \"abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242\", message: \"'abstract' modifier can only appear on a class, method, or property declaration.\" },\n        _0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: \"_0_modifier_cannot_be_used_with_1_modifier_1243\", message: \"'{0}' modifier cannot be used with '{1}' modifier.\" },\n        Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: \"Abstract_methods_can_only_appear_within_an_abstract_class_1244\", message: \"Abstract methods can only appear within an abstract class.\" },\n        Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: \"Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245\", message: \"Method '{0}' cannot have an implementation because it is marked abstract.\" },\n        An_interface_property_cannot_have_an_initializer: { code: 1246, category: ts.DiagnosticCategory.Error, key: \"An_interface_property_cannot_have_an_initializer_1246\", message: \"An interface property cannot have an initializer.\" },\n        A_type_literal_property_cannot_have_an_initializer: { code: 1247, category: ts.DiagnosticCategory.Error, key: \"A_type_literal_property_cannot_have_an_initializer_1247\", message: \"A type literal property cannot have an initializer.\" },\n        A_class_member_cannot_have_the_0_keyword: { code: 1248, category: ts.DiagnosticCategory.Error, key: \"A_class_member_cannot_have_the_0_keyword_1248\", message: \"A class member cannot have the '{0}' keyword.\" },\n        A_decorator_can_only_decorate_a_method_implementation_not_an_overload: { code: 1249, category: ts.DiagnosticCategory.Error, key: \"A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249\", message: \"A decorator can only decorate a method implementation, not an overload.\" },\n        Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: { code: 1250, category: ts.DiagnosticCategory.Error, key: \"Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250\", message: \"Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.\" },\n        Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: { code: 1251, category: ts.DiagnosticCategory.Error, key: \"Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251\", message: \"Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode.\" },\n        Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: { code: 1252, category: ts.DiagnosticCategory.Error, key: \"Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252\", message: \"Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode.\" },\n        _0_tag_cannot_be_used_independently_as_a_top_level_JSDoc_tag: { code: 1253, category: ts.DiagnosticCategory.Error, key: \"_0_tag_cannot_be_used_independently_as_a_top_level_JSDoc_tag_1253\", message: \"'{0}' tag cannot be used independently as a top level JSDoc tag.\" },\n        A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal: { code: 1254, category: ts.DiagnosticCategory.Error, key: \"A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_1254\", message: \"A 'const' initializer in an ambient context must be a string or numeric literal.\" },\n        with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: \"with_statements_are_not_allowed_in_an_async_function_block_1300\", message: \"'with' statements are not allowed in an async function block.\" },\n        await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: \"await_expression_is_only_allowed_within_an_async_function_1308\", message: \"'await' expression is only allowed within an async function.\" },\n        can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: \"can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312\", message: \"'=' can only be used in an object literal property inside a destructuring assignment.\" },\n        The_body_of_an_if_statement_cannot_be_the_empty_statement: { code: 1313, category: ts.DiagnosticCategory.Error, key: \"The_body_of_an_if_statement_cannot_be_the_empty_statement_1313\", message: \"The body of an 'if' statement cannot be the empty statement.\" },\n        Global_module_exports_may_only_appear_in_module_files: { code: 1314, category: ts.DiagnosticCategory.Error, key: \"Global_module_exports_may_only_appear_in_module_files_1314\", message: \"Global module exports may only appear in module files.\" },\n        Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: \"Global_module_exports_may_only_appear_in_declaration_files_1315\", message: \"Global module exports may only appear in declaration files.\" },\n        Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: \"Global_module_exports_may_only_appear_at_top_level_1316\", message: \"Global module exports may only appear at top level.\" },\n        A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: \"A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317\", message: \"A parameter property cannot be declared using a rest parameter.\" },\n        An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: \"An_abstract_accessor_cannot_have_an_implementation_1318\", message: \"An abstract accessor cannot have an implementation.\" },\n        Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_0_2300\", message: \"Duplicate identifier '{0}'.\" },\n        Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: \"Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301\", message: \"Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor.\" },\n        Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: \"Static_members_cannot_reference_class_type_parameters_2302\", message: \"Static members cannot reference class type parameters.\" },\n        Circular_definition_of_import_alias_0: { code: 2303, category: ts.DiagnosticCategory.Error, key: \"Circular_definition_of_import_alias_0_2303\", message: \"Circular definition of import alias '{0}'.\" },\n        Cannot_find_name_0: { code: 2304, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_name_0_2304\", message: \"Cannot find name '{0}'.\" },\n        Module_0_has_no_exported_member_1: { code: 2305, category: ts.DiagnosticCategory.Error, key: \"Module_0_has_no_exported_member_1_2305\", message: \"Module '{0}' has no exported member '{1}'.\" },\n        File_0_is_not_a_module: { code: 2306, category: ts.DiagnosticCategory.Error, key: \"File_0_is_not_a_module_2306\", message: \"File '{0}' is not a module.\" },\n        Cannot_find_module_0: { code: 2307, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_module_0_2307\", message: \"Cannot find module '{0}'.\" },\n        Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: { code: 2308, category: ts.DiagnosticCategory.Error, key: \"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308\", message: \"Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity.\" },\n        An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: ts.DiagnosticCategory.Error, key: \"An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309\", message: \"An export assignment cannot be used in a module with other exported elements.\" },\n        Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: ts.DiagnosticCategory.Error, key: \"Type_0_recursively_references_itself_as_a_base_type_2310\", message: \"Type '{0}' recursively references itself as a base type.\" },\n        A_class_may_only_extend_another_class: { code: 2311, category: ts.DiagnosticCategory.Error, key: \"A_class_may_only_extend_another_class_2311\", message: \"A class may only extend another class.\" },\n        An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: ts.DiagnosticCategory.Error, key: \"An_interface_may_only_extend_a_class_or_another_interface_2312\", message: \"An interface may only extend a class or another interface.\" },\n        Type_parameter_0_has_a_circular_constraint: { code: 2313, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_has_a_circular_constraint_2313\", message: \"Type parameter '{0}' has a circular constraint.\" },\n        Generic_type_0_requires_1_type_argument_s: { code: 2314, category: ts.DiagnosticCategory.Error, key: \"Generic_type_0_requires_1_type_argument_s_2314\", message: \"Generic type '{0}' requires {1} type argument(s).\" },\n        Type_0_is_not_generic: { code: 2315, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_generic_2315\", message: \"Type '{0}' is not generic.\" },\n        Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: ts.DiagnosticCategory.Error, key: \"Global_type_0_must_be_a_class_or_interface_type_2316\", message: \"Global type '{0}' must be a class or interface type.\" },\n        Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: ts.DiagnosticCategory.Error, key: \"Global_type_0_must_have_1_type_parameter_s_2317\", message: \"Global type '{0}' must have {1} type parameter(s).\" },\n        Cannot_find_global_type_0: { code: 2318, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_global_type_0_2318\", message: \"Cannot find global type '{0}'.\" },\n        Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: ts.DiagnosticCategory.Error, key: \"Named_property_0_of_types_1_and_2_are_not_identical_2319\", message: \"Named property '{0}' of types '{1}' and '{2}' are not identical.\" },\n        Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: ts.DiagnosticCategory.Error, key: \"Interface_0_cannot_simultaneously_extend_types_1_and_2_2320\", message: \"Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'.\" },\n        Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: ts.DiagnosticCategory.Error, key: \"Excessive_stack_depth_comparing_types_0_and_1_2321\", message: \"Excessive stack depth comparing types '{0}' and '{1}'.\" },\n        Type_0_is_not_assignable_to_type_1: { code: 2322, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_assignable_to_type_1_2322\", message: \"Type '{0}' is not assignable to type '{1}'.\" },\n        Cannot_redeclare_exported_variable_0: { code: 2323, category: ts.DiagnosticCategory.Error, key: \"Cannot_redeclare_exported_variable_0_2323\", message: \"Cannot redeclare exported variable '{0}'.\" },\n        Property_0_is_missing_in_type_1: { code: 2324, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_missing_in_type_1_2324\", message: \"Property '{0}' is missing in type '{1}'.\" },\n        Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_private_in_type_1_but_not_in_type_2_2325\", message: \"Property '{0}' is private in type '{1}' but not in type '{2}'.\" },\n        Types_of_property_0_are_incompatible: { code: 2326, category: ts.DiagnosticCategory.Error, key: \"Types_of_property_0_are_incompatible_2326\", message: \"Types of property '{0}' are incompatible.\" },\n        Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_optional_in_type_1_but_required_in_type_2_2327\", message: \"Property '{0}' is optional in type '{1}' but required in type '{2}'.\" },\n        Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: ts.DiagnosticCategory.Error, key: \"Types_of_parameters_0_and_1_are_incompatible_2328\", message: \"Types of parameters '{0}' and '{1}' are incompatible.\" },\n        Index_signature_is_missing_in_type_0: { code: 2329, category: ts.DiagnosticCategory.Error, key: \"Index_signature_is_missing_in_type_0_2329\", message: \"Index signature is missing in type '{0}'.\" },\n        Index_signatures_are_incompatible: { code: 2330, category: ts.DiagnosticCategory.Error, key: \"Index_signatures_are_incompatible_2330\", message: \"Index signatures are incompatible.\" },\n        this_cannot_be_referenced_in_a_module_or_namespace_body: { code: 2331, category: ts.DiagnosticCategory.Error, key: \"this_cannot_be_referenced_in_a_module_or_namespace_body_2331\", message: \"'this' cannot be referenced in a module or namespace body.\" },\n        this_cannot_be_referenced_in_current_location: { code: 2332, category: ts.DiagnosticCategory.Error, key: \"this_cannot_be_referenced_in_current_location_2332\", message: \"'this' cannot be referenced in current location.\" },\n        this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: ts.DiagnosticCategory.Error, key: \"this_cannot_be_referenced_in_constructor_arguments_2333\", message: \"'this' cannot be referenced in constructor arguments.\" },\n        this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: ts.DiagnosticCategory.Error, key: \"this_cannot_be_referenced_in_a_static_property_initializer_2334\", message: \"'this' cannot be referenced in a static property initializer.\" },\n        super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: ts.DiagnosticCategory.Error, key: \"super_can_only_be_referenced_in_a_derived_class_2335\", message: \"'super' can only be referenced in a derived class.\" },\n        super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: ts.DiagnosticCategory.Error, key: \"super_cannot_be_referenced_in_constructor_arguments_2336\", message: \"'super' cannot be referenced in constructor arguments.\" },\n        Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: ts.DiagnosticCategory.Error, key: \"Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors_2337\", message: \"Super calls are not permitted outside constructors or in nested functions inside constructors.\" },\n        super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: ts.DiagnosticCategory.Error, key: \"super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_der_2338\", message: \"'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.\" },\n        Property_0_does_not_exist_on_type_1: { code: 2339, category: ts.DiagnosticCategory.Error, key: \"Property_0_does_not_exist_on_type_1_2339\", message: \"Property '{0}' does not exist on type '{1}'.\" },\n        Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: \"Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340\", message: \"Only public and protected methods of the base class are accessible via the 'super' keyword.\" },\n        Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_private_and_only_accessible_within_class_1_2341\", message: \"Property '{0}' is private and only accessible within class '{1}'.\" },\n        An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: \"An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342\", message: \"An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.\" },\n        This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: \"This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343\", message: \"This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'.\" },\n        Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: \"Type_0_does_not_satisfy_the_constraint_1_2344\", message: \"Type '{0}' does not satisfy the constraint '{1}'.\" },\n        Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: \"Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345\", message: \"Argument of type '{0}' is not assignable to parameter of type '{1}'.\" },\n        Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: \"Supplied_parameters_do_not_match_any_signature_of_call_target_2346\", message: \"Supplied parameters do not match any signature of call target.\" },\n        Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: ts.DiagnosticCategory.Error, key: \"Untyped_function_calls_may_not_accept_type_arguments_2347\", message: \"Untyped function calls may not accept type arguments.\" },\n        Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: ts.DiagnosticCategory.Error, key: \"Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348\", message: \"Value of type '{0}' is not callable. Did you mean to include 'new'?\" },\n        Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures: { code: 2349, category: ts.DiagnosticCategory.Error, key: \"Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatur_2349\", message: \"Cannot invoke an expression whose type lacks a call signature. Type '{0}' has no compatible call signatures.\" },\n        Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: ts.DiagnosticCategory.Error, key: \"Only_a_void_function_can_be_called_with_the_new_keyword_2350\", message: \"Only a void function can be called with the 'new' keyword.\" },\n        Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: \"Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351\", message: \"Cannot use 'new' with an expression whose type lacks a call or construct signature.\" },\n        Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: \"Type_0_cannot_be_converted_to_type_1_2352\", message: \"Type '{0}' cannot be converted to type '{1}'.\" },\n        Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: \"Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353\", message: \"Object literal may only specify known properties, and '{0}' does not exist in type '{1}'.\" },\n        This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: \"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354\", message: \"This syntax requires an imported helper but module '{0}' cannot be found.\" },\n        A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: \"A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355\", message: \"A function whose declared type is neither 'void' nor 'any' must return a value.\" },\n        An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: \"An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356\", message: \"An arithmetic operand must be of type 'any', 'number' or an enum type.\" },\n        The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: \"The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357\", message: \"The operand of an increment or decrement operator must be a variable or a property access.\" },\n        The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358\", message: \"The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.\" },\n        The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: ts.DiagnosticCategory.Error, key: \"The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359\", message: \"The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.\" },\n        The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol_2360\", message: \"The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.\" },\n        The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: \"The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361\", message: \"The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter\" },\n        The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2362\", message: \"The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.\" },\n        The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: \"The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363\", message: \"The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.\" },\n        The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: { code: 2364, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364\", message: \"The left-hand side of an assignment expression must be a variable or a property access.\" },\n        Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: \"Operator_0_cannot_be_applied_to_types_1_and_2_2365\", message: \"Operator '{0}' cannot be applied to types '{1}' and '{2}'.\" },\n        Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: \"Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366\", message: \"Function lacks ending return statement and return type does not include 'undefined'.\" },\n        Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_name_cannot_be_0_2368\", message: \"Type parameter name cannot be '{0}'\" },\n        A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: \"A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369\", message: \"A parameter property is only allowed in a constructor implementation.\" },\n        A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: \"A_rest_parameter_must_be_of_an_array_type_2370\", message: \"A rest parameter must be of an array type.\" },\n        A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: ts.DiagnosticCategory.Error, key: \"A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371\", message: \"A parameter initializer is only allowed in a function or constructor implementation.\" },\n        Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_cannot_be_referenced_in_its_initializer_2372\", message: \"Parameter '{0}' cannot be referenced in its initializer.\" },\n        Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: ts.DiagnosticCategory.Error, key: \"Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373\", message: \"Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.\" },\n        Duplicate_string_index_signature: { code: 2374, category: ts.DiagnosticCategory.Error, key: \"Duplicate_string_index_signature_2374\", message: \"Duplicate string index signature.\" },\n        Duplicate_number_index_signature: { code: 2375, category: ts.DiagnosticCategory.Error, key: \"Duplicate_number_index_signature_2375\", message: \"Duplicate number index signature.\" },\n        A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: ts.DiagnosticCategory.Error, key: \"A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_proper_2376\", message: \"A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.\" },\n        Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: ts.DiagnosticCategory.Error, key: \"Constructors_for_derived_classes_must_contain_a_super_call_2377\", message: \"Constructors for derived classes must contain a 'super' call.\" },\n        A_get_accessor_must_return_a_value: { code: 2378, category: ts.DiagnosticCategory.Error, key: \"A_get_accessor_must_return_a_value_2378\", message: \"A 'get' accessor must return a value.\" },\n        Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: ts.DiagnosticCategory.Error, key: \"Getter_and_setter_accessors_do_not_agree_in_visibility_2379\", message: \"Getter and setter accessors do not agree in visibility.\" },\n        get_and_set_accessor_must_have_the_same_type: { code: 2380, category: ts.DiagnosticCategory.Error, key: \"get_and_set_accessor_must_have_the_same_type_2380\", message: \"'get' and 'set' accessor must have the same type.\" },\n        A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: ts.DiagnosticCategory.Error, key: \"A_signature_with_an_implementation_cannot_use_a_string_literal_type_2381\", message: \"A signature with an implementation cannot use a string literal type.\" },\n        Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: ts.DiagnosticCategory.Error, key: \"Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382\", message: \"Specialized overload signature is not assignable to any non-specialized signature.\" },\n        Overload_signatures_must_all_be_exported_or_non_exported: { code: 2383, category: ts.DiagnosticCategory.Error, key: \"Overload_signatures_must_all_be_exported_or_non_exported_2383\", message: \"Overload signatures must all be exported or non-exported.\" },\n        Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: ts.DiagnosticCategory.Error, key: \"Overload_signatures_must_all_be_ambient_or_non_ambient_2384\", message: \"Overload signatures must all be ambient or non-ambient.\" },\n        Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: ts.DiagnosticCategory.Error, key: \"Overload_signatures_must_all_be_public_private_or_protected_2385\", message: \"Overload signatures must all be public, private or protected.\" },\n        Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: ts.DiagnosticCategory.Error, key: \"Overload_signatures_must_all_be_optional_or_required_2386\", message: \"Overload signatures must all be optional or required.\" },\n        Function_overload_must_be_static: { code: 2387, category: ts.DiagnosticCategory.Error, key: \"Function_overload_must_be_static_2387\", message: \"Function overload must be static.\" },\n        Function_overload_must_not_be_static: { code: 2388, category: ts.DiagnosticCategory.Error, key: \"Function_overload_must_not_be_static_2388\", message: \"Function overload must not be static.\" },\n        Function_implementation_name_must_be_0: { code: 2389, category: ts.DiagnosticCategory.Error, key: \"Function_implementation_name_must_be_0_2389\", message: \"Function implementation name must be '{0}'.\" },\n        Constructor_implementation_is_missing: { code: 2390, category: ts.DiagnosticCategory.Error, key: \"Constructor_implementation_is_missing_2390\", message: \"Constructor implementation is missing.\" },\n        Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: ts.DiagnosticCategory.Error, key: \"Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391\", message: \"Function implementation is missing or not immediately following the declaration.\" },\n        Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: ts.DiagnosticCategory.Error, key: \"Multiple_constructor_implementations_are_not_allowed_2392\", message: \"Multiple constructor implementations are not allowed.\" },\n        Duplicate_function_implementation: { code: 2393, category: ts.DiagnosticCategory.Error, key: \"Duplicate_function_implementation_2393\", message: \"Duplicate function implementation.\" },\n        Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: ts.DiagnosticCategory.Error, key: \"Overload_signature_is_not_compatible_with_function_implementation_2394\", message: \"Overload signature is not compatible with function implementation.\" },\n        Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: ts.DiagnosticCategory.Error, key: \"Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395\", message: \"Individual declarations in merged declaration '{0}' must be all exported or all local.\" },\n        Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters_2396\", message: \"Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.\" },\n        Declaration_name_conflicts_with_built_in_global_identifier_0: { code: 2397, category: ts.DiagnosticCategory.Error, key: \"Declaration_name_conflicts_with_built_in_global_identifier_0_2397\", message: \"Declaration name conflicts with built-in global identifier '{0}'.\" },\n        Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399\", message: \"Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.\" },\n        Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: ts.DiagnosticCategory.Error, key: \"Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400\", message: \"Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference.\" },\n        Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference_2401\", message: \"Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.\" },\n        Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: ts.DiagnosticCategory.Error, key: \"Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference_2402\", message: \"Expression resolves to '_super' that compiler uses to capture base class reference.\" },\n        Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: ts.DiagnosticCategory.Error, key: \"Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403\", message: \"Subsequent variable declarations must have the same type.  Variable '{0}' must be of type '{1}', but here has type '{2}'.\" },\n        The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404\", message: \"The left-hand side of a 'for...in' statement cannot use a type annotation.\" },\n        The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405\", message: \"The left-hand side of a 'for...in' statement must be of type 'string' or 'any'.\" },\n        The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: { code: 2406, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406\", message: \"The left-hand side of a 'for...in' statement must be a variable or a property access.\" },\n        The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: ts.DiagnosticCategory.Error, key: \"The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407\", message: \"The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.\" },\n        Setters_cannot_return_a_value: { code: 2408, category: ts.DiagnosticCategory.Error, key: \"Setters_cannot_return_a_value_2408\", message: \"Setters cannot return a value.\" },\n        Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409\", message: \"Return type of constructor signature must be assignable to the instance type of the class\" },\n        The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: { code: 2410, category: ts.DiagnosticCategory.Error, key: \"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410\", message: \"The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.\" },\n        Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: ts.DiagnosticCategory.Error, key: \"Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411\", message: \"Property '{0}' of type '{1}' is not assignable to string index type '{2}'.\" },\n        Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: ts.DiagnosticCategory.Error, key: \"Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412\", message: \"Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'.\" },\n        Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: ts.DiagnosticCategory.Error, key: \"Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413\", message: \"Numeric index type '{0}' is not assignable to string index type '{1}'.\" },\n        Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: \"Class_name_cannot_be_0_2414\", message: \"Class name cannot be '{0}'\" },\n        Class_0_incorrectly_extends_base_class_1: { code: 2415, category: ts.DiagnosticCategory.Error, key: \"Class_0_incorrectly_extends_base_class_1_2415\", message: \"Class '{0}' incorrectly extends base class '{1}'.\" },\n        Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: ts.DiagnosticCategory.Error, key: \"Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417\", message: \"Class static side '{0}' incorrectly extends base class static side '{1}'.\" },\n        Class_0_incorrectly_implements_interface_1: { code: 2420, category: ts.DiagnosticCategory.Error, key: \"Class_0_incorrectly_implements_interface_1_2420\", message: \"Class '{0}' incorrectly implements interface '{1}'.\" },\n        A_class_may_only_implement_another_class_or_interface: { code: 2422, category: ts.DiagnosticCategory.Error, key: \"A_class_may_only_implement_another_class_or_interface_2422\", message: \"A class may only implement another class or interface.\" },\n        Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: ts.DiagnosticCategory.Error, key: \"Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_access_2423\", message: \"Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.\" },\n        Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: ts.DiagnosticCategory.Error, key: \"Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_proper_2424\", message: \"Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.\" },\n        Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: ts.DiagnosticCategory.Error, key: \"Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425\", message: \"Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.\" },\n        Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: ts.DiagnosticCategory.Error, key: \"Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426\", message: \"Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.\" },\n        Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: \"Interface_name_cannot_be_0_2427\", message: \"Interface name cannot be '{0}'\" },\n        All_declarations_of_0_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: \"All_declarations_of_0_must_have_identical_type_parameters_2428\", message: \"All declarations of '{0}' must have identical type parameters.\" },\n        Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: \"Interface_0_incorrectly_extends_interface_1_2430\", message: \"Interface '{0}' incorrectly extends interface '{1}'.\" },\n        Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: \"Enum_name_cannot_be_0_2431\", message: \"Enum name cannot be '{0}'\" },\n        In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: \"In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432\", message: \"In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element.\" },\n        A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: \"A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433\", message: \"A namespace declaration cannot be in a different file from a class or function with which it is merged\" },\n        A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: \"A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434\", message: \"A namespace declaration cannot be located prior to a class or function with which it is merged\" },\n        Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { code: 2435, category: ts.DiagnosticCategory.Error, key: \"Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435\", message: \"Ambient modules cannot be nested in other modules or namespaces.\" },\n        Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: \"Ambient_module_declaration_cannot_specify_relative_module_name_2436\", message: \"Ambient module declaration cannot specify relative module name.\" },\n        Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: \"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437\", message: \"Module '{0}' is hidden by a local declaration with the same name\" },\n        Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: \"Import_name_cannot_be_0_2438\", message: \"Import name cannot be '{0}'\" },\n        Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: \"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439\", message: \"Import or export declaration in an ambient module declaration cannot reference module through relative module name.\" },\n        Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.DiagnosticCategory.Error, key: \"Import_declaration_conflicts_with_local_declaration_of_0_2440\", message: \"Import declaration conflicts with local declaration of '{0}'\" },\n        Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441\", message: \"Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module.\" },\n        Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: ts.DiagnosticCategory.Error, key: \"Types_have_separate_declarations_of_a_private_property_0_2442\", message: \"Types have separate declarations of a private property '{0}'.\" },\n        Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443\", message: \"Property '{0}' is protected but type '{1}' is not a class derived from '{2}'.\" },\n        Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_protected_in_type_1_but_public_in_type_2_2444\", message: \"Property '{0}' is protected in type '{1}' but public in type '{2}'.\" },\n        Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses_2445\", message: \"Property '{0}' is protected and only accessible within class '{1}' and its subclasses.\" },\n        Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446\", message: \"Property '{0}' is protected and only accessible through an instance of class '{1}'.\" },\n        The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: \"The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447\", message: \"The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead.\" },\n        Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: \"Block_scoped_variable_0_used_before_its_declaration_2448\", message: \"Block-scoped variable '{0}' used before its declaration.\" },\n        Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: \"Cannot_redeclare_block_scoped_variable_0_2451\", message: \"Cannot redeclare block-scoped variable '{0}'.\" },\n        An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: \"An_enum_member_cannot_have_a_numeric_name_2452\", message: \"An enum member cannot have a numeric name.\" },\n        The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: \"The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453\", message: \"The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly.\" },\n        Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: \"Variable_0_is_used_before_being_assigned_2454\", message: \"Variable '{0}' is used before being assigned.\" },\n        Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: \"Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455\", message: \"Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'.\" },\n        Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: \"Type_alias_0_circularly_references_itself_2456\", message: \"Type alias '{0}' circularly references itself.\" },\n        Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: \"Type_alias_name_cannot_be_0_2457\", message: \"Type alias name cannot be '{0}'\" },\n        An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: ts.DiagnosticCategory.Error, key: \"An_AMD_module_cannot_have_multiple_name_assignments_2458\", message: \"An AMD module cannot have multiple name assignments.\" },\n        Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: ts.DiagnosticCategory.Error, key: \"Type_0_has_no_property_1_and_no_string_index_signature_2459\", message: \"Type '{0}' has no property '{1}' and no string index signature.\" },\n        Type_0_has_no_property_1: { code: 2460, category: ts.DiagnosticCategory.Error, key: \"Type_0_has_no_property_1_2460\", message: \"Type '{0}' has no property '{1}'.\" },\n        Type_0_is_not_an_array_type: { code: 2461, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_an_array_type_2461\", message: \"Type '{0}' is not an array type.\" },\n        A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: \"A_rest_element_must_be_last_in_a_destructuring_pattern_2462\", message: \"A rest element must be last in a destructuring pattern\" },\n        A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: ts.DiagnosticCategory.Error, key: \"A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463\", message: \"A binding pattern parameter cannot be optional in an implementation signature.\" },\n        A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464\", message: \"A computed property name must be of type 'string', 'number', 'symbol', or 'any'.\" },\n        this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: ts.DiagnosticCategory.Error, key: \"this_cannot_be_referenced_in_a_computed_property_name_2465\", message: \"'this' cannot be referenced in a computed property name.\" },\n        super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: ts.DiagnosticCategory.Error, key: \"super_cannot_be_referenced_in_a_computed_property_name_2466\", message: \"'super' cannot be referenced in a computed property name.\" },\n        A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type_2467\", message: \"A computed property name cannot reference a type parameter from its containing type.\" },\n        Cannot_find_global_value_0: { code: 2468, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_global_value_0_2468\", message: \"Cannot find global value '{0}'.\" },\n        The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: ts.DiagnosticCategory.Error, key: \"The_0_operator_cannot_be_applied_to_type_symbol_2469\", message: \"The '{0}' operator cannot be applied to type 'symbol'.\" },\n        Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: ts.DiagnosticCategory.Error, key: \"Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object_2470\", message: \"'Symbol' reference does not refer to the global Symbol constructor object.\" },\n        A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: ts.DiagnosticCategory.Error, key: \"A_computed_property_name_of_the_form_0_must_be_of_type_symbol_2471\", message: \"A computed property name of the form '{0}' must be of type 'symbol'.\" },\n        Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: { code: 2472, category: ts.DiagnosticCategory.Error, key: \"Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher_2472\", message: \"Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher.\" },\n        Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: ts.DiagnosticCategory.Error, key: \"Enum_declarations_must_all_be_const_or_non_const_2473\", message: \"Enum declarations must all be const or non-const.\" },\n        In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: ts.DiagnosticCategory.Error, key: \"In_const_enum_declarations_member_initializer_must_be_constant_expression_2474\", message: \"In 'const' enum declarations member initializer must be constant expression.\" },\n        const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: ts.DiagnosticCategory.Error, key: \"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475\", message: \"'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.\" },\n        A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: ts.DiagnosticCategory.Error, key: \"A_const_enum_member_can_only_be_accessed_using_a_string_literal_2476\", message: \"A const enum member can only be accessed using a string literal.\" },\n        const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: ts.DiagnosticCategory.Error, key: \"const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477\", message: \"'const' enum member initializer was evaluated to a non-finite value.\" },\n        const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: ts.DiagnosticCategory.Error, key: \"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478\", message: \"'const' enum member initializer was evaluated to disallowed value 'NaN'.\" },\n        Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: ts.DiagnosticCategory.Error, key: \"Property_0_does_not_exist_on_const_enum_1_2479\", message: \"Property '{0}' does not exist on 'const' enum '{1}'.\" },\n        let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: ts.DiagnosticCategory.Error, key: \"let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480\", message: \"'let' is not allowed to be used as a name in 'let' or 'const' declarations.\" },\n        Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: \"Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481\", message: \"Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'.\" },\n        The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483\", message: \"The left-hand side of a 'for...of' statement cannot use a type annotation.\" },\n        Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: \"Export_declaration_conflicts_with_exported_declaration_of_0_2484\", message: \"Export declaration conflicts with exported declaration of '{0}'\" },\n        The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: { code: 2487, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487\", message: \"The left-hand side of a 'for...of' statement must be a variable or a property access.\" },\n        Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: \"Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488\", message: \"Type must have a '[Symbol.iterator]()' method that returns an iterator.\" },\n        An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: \"An_iterator_must_have_a_next_method_2489\", message: \"An iterator must have a 'next()' method.\" },\n        The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: ts.DiagnosticCategory.Error, key: \"The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490\", message: \"The type returned by the 'next()' method of an iterator must have a 'value' property.\" },\n        The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: ts.DiagnosticCategory.Error, key: \"The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491\", message: \"The left-hand side of a 'for...in' statement cannot be a destructuring pattern.\" },\n        Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: ts.DiagnosticCategory.Error, key: \"Cannot_redeclare_identifier_0_in_catch_clause_2492\", message: \"Cannot redeclare identifier '{0}' in catch clause\" },\n        Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: ts.DiagnosticCategory.Error, key: \"Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2_2493\", message: \"Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'.\" },\n        Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: ts.DiagnosticCategory.Error, key: \"Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494\", message: \"Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher.\" },\n        Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_an_array_type_or_a_string_type_2495\", message: \"Type '{0}' is not an array type or a string type.\" },\n        The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: { code: 2496, category: ts.DiagnosticCategory.Error, key: \"The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_stand_2496\", message: \"The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.\" },\n        Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: \"Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497\", message: \"Module '{0}' resolves to a non-module entity and cannot be imported using this construct.\" },\n        Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: \"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498\", message: \"Module '{0}' uses 'export =' and cannot be used with 'export *'.\" },\n        An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: \"An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments_2499\", message: \"An interface can only extend an identifier/qualified-name with optional type arguments.\" },\n        A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: \"A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments_2500\", message: \"A class can only implement an identifier/qualified-name with optional type arguments.\" },\n        A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: \"A_rest_element_cannot_contain_a_binding_pattern_2501\", message: \"A rest element cannot contain a binding pattern.\" },\n        _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: \"_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502\", message: \"'{0}' is referenced directly or indirectly in its own type annotation.\" },\n        Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_namespace_0_2503\", message: \"Cannot find namespace '{0}'.\" },\n        A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: ts.DiagnosticCategory.Error, key: \"A_generator_cannot_have_a_void_type_annotation_2505\", message: \"A generator cannot have a 'void' type annotation.\" },\n        _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: { code: 2506, category: ts.DiagnosticCategory.Error, key: \"_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506\", message: \"'{0}' is referenced directly or indirectly in its own base expression.\" },\n        Type_0_is_not_a_constructor_function_type: { code: 2507, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_a_constructor_function_type_2507\", message: \"Type '{0}' is not a constructor function type.\" },\n        No_base_constructor_has_the_specified_number_of_type_arguments: { code: 2508, category: ts.DiagnosticCategory.Error, key: \"No_base_constructor_has_the_specified_number_of_type_arguments_2508\", message: \"No base constructor has the specified number of type arguments.\" },\n        Base_constructor_return_type_0_is_not_a_class_or_interface_type: { code: 2509, category: ts.DiagnosticCategory.Error, key: \"Base_constructor_return_type_0_is_not_a_class_or_interface_type_2509\", message: \"Base constructor return type '{0}' is not a class or interface type.\" },\n        Base_constructors_must_all_have_the_same_return_type: { code: 2510, category: ts.DiagnosticCategory.Error, key: \"Base_constructors_must_all_have_the_same_return_type_2510\", message: \"Base constructors must all have the same return type.\" },\n        Cannot_create_an_instance_of_the_abstract_class_0: { code: 2511, category: ts.DiagnosticCategory.Error, key: \"Cannot_create_an_instance_of_the_abstract_class_0_2511\", message: \"Cannot create an instance of the abstract class '{0}'.\" },\n        Overload_signatures_must_all_be_abstract_or_non_abstract: { code: 2512, category: ts.DiagnosticCategory.Error, key: \"Overload_signatures_must_all_be_abstract_or_non_abstract_2512\", message: \"Overload signatures must all be abstract or non-abstract.\" },\n        Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: { code: 2513, category: ts.DiagnosticCategory.Error, key: \"Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513\", message: \"Abstract method '{0}' in class '{1}' cannot be accessed via super expression.\" },\n        Classes_containing_abstract_methods_must_be_marked_abstract: { code: 2514, category: ts.DiagnosticCategory.Error, key: \"Classes_containing_abstract_methods_must_be_marked_abstract_2514\", message: \"Classes containing abstract methods must be marked abstract.\" },\n        Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: \"Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515\", message: \"Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'.\" },\n        All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: \"All_declarations_of_an_abstract_method_must_be_consecutive_2516\", message: \"All declarations of an abstract method must be consecutive.\" },\n        Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: \"Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517\", message: \"Cannot assign an abstract constructor type to a non-abstract constructor type.\" },\n        A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { code: 2518, category: ts.DiagnosticCategory.Error, key: \"A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518\", message: \"A 'this'-based type guard is not compatible with a parameter-based type guard.\" },\n        Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520\", message: \"Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions.\" },\n        Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: \"Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521\", message: \"Expression resolves to variable declaration '{0}' that compiler uses to support async functions.\" },\n        The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: { code: 2522, category: ts.DiagnosticCategory.Error, key: \"The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522\", message: \"The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method.\" },\n        yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: ts.DiagnosticCategory.Error, key: \"yield_expressions_cannot_be_used_in_a_parameter_initializer_2523\", message: \"'yield' expressions cannot be used in a parameter initializer.\" },\n        await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: ts.DiagnosticCategory.Error, key: \"await_expressions_cannot_be_used_in_a_parameter_initializer_2524\", message: \"'await' expressions cannot be used in a parameter initializer.\" },\n        Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: ts.DiagnosticCategory.Error, key: \"Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525\", message: \"Initializer provides no value for this binding element and the binding element has no default value.\" },\n        A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: { code: 2526, category: ts.DiagnosticCategory.Error, key: \"A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526\", message: \"A 'this' type is available only in a non-static member of a class or interface.\" },\n        The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: { code: 2527, category: ts.DiagnosticCategory.Error, key: \"The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary_2527\", message: \"The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary.\" },\n        A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: \"A_module_cannot_have_multiple_default_exports_2528\", message: \"A module cannot have multiple default exports.\" },\n        Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: { code: 2529, category: ts.DiagnosticCategory.Error, key: \"Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529\", message: \"Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions.\" },\n        Property_0_is_incompatible_with_index_signature: { code: 2530, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_incompatible_with_index_signature_2530\", message: \"Property '{0}' is incompatible with index signature.\" },\n        Object_is_possibly_null: { code: 2531, category: ts.DiagnosticCategory.Error, key: \"Object_is_possibly_null_2531\", message: \"Object is possibly 'null'.\" },\n        Object_is_possibly_undefined: { code: 2532, category: ts.DiagnosticCategory.Error, key: \"Object_is_possibly_undefined_2532\", message: \"Object is possibly 'undefined'.\" },\n        Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: \"Object_is_possibly_null_or_undefined_2533\", message: \"Object is possibly 'null' or 'undefined'.\" },\n        A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: \"A_function_returning_never_cannot_have_a_reachable_end_point_2534\", message: \"A function returning 'never' cannot have a reachable end point.\" },\n        Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: \"Enum_type_0_has_members_with_initializers_that_are_not_literals_2535\", message: \"Enum type '{0}' has members with initializers that are not literals.\" },\n        Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: \"Type_0_cannot_be_used_to_index_type_1_2536\", message: \"Type '{0}' cannot be used to index type '{1}'.\" },\n        Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: \"Type_0_has_no_matching_index_signature_for_type_1_2537\", message: \"Type '{0}' has no matching index signature for type '{1}'.\" },\n        Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: \"Type_0_cannot_be_used_as_an_index_type_2538\", message: \"Type '{0}' cannot be used as an index type.\" },\n        Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: \"Cannot_assign_to_0_because_it_is_not_a_variable_2539\", message: \"Cannot assign to '{0}' because it is not a variable.\" },\n        Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: \"Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540\", message: \"Cannot assign to '{0}' because it is a constant or a read-only property.\" },\n        The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: \"The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541\", message: \"The target of an assignment must be a variable or a property access.\" },\n        Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: \"Index_signature_in_type_0_only_permits_reading_2542\", message: \"Index signature in type '{0}' only permits reading.\" },\n        JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: \"JSX_element_attributes_type_0_may_not_be_a_union_type_2600\", message: \"JSX element attributes type '{0}' may not be a union type.\" },\n        The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: \"The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601\", message: \"The return type of a JSX element constructor must return an object type.\" },\n        JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: \"JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602\", message: \"JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist.\" },\n        Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: \"Property_0_in_type_1_is_not_assignable_to_type_2_2603\", message: \"Property '{0}' in type '{1}' is not assignable to type '{2}'\" },\n        JSX_element_type_0_does_not_have_any_construct_or_call_signatures: { code: 2604, category: ts.DiagnosticCategory.Error, key: \"JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604\", message: \"JSX element type '{0}' does not have any construct or call signatures.\" },\n        JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: { code: 2605, category: ts.DiagnosticCategory.Error, key: \"JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements_2605\", message: \"JSX element type '{0}' is not a constructor function for JSX elements.\" },\n        Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: \"Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606\", message: \"Property '{0}' of JSX spread attribute is not assignable to target property.\" },\n        JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: \"JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607\", message: \"JSX element class does not support attributes because it does not have a '{0}' property\" },\n        The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: \"The_global_type_JSX_0_may_not_have_more_than_one_property_2608\", message: \"The global type 'JSX.{0}' may not have more than one property\" },\n        Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: \"Cannot_emit_namespaced_JSX_elements_in_React_2650\", message: \"Cannot emit namespaced JSX elements in React\" },\n        A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: \"A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651\", message: \"A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.\" },\n        Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: \"Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652\", message: \"Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead.\" },\n        Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: ts.DiagnosticCategory.Error, key: \"Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653\", message: \"Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'.\" },\n        Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: \"Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654\", message: \"Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.\" },\n        Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: \"Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656\", message: \"Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition.\" },\n        JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: \"JSX_expressions_must_have_one_parent_element_2657\", message: \"JSX expressions must have one parent element\" },\n        Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: \"Type_0_provides_no_match_for_the_signature_1_2658\", message: \"Type '{0}' provides no match for the signature '{1}'\" },\n        super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { code: 2659, category: ts.DiagnosticCategory.Error, key: \"super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659\", message: \"'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.\" },\n        super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { code: 2660, category: ts.DiagnosticCategory.Error, key: \"super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660\", message: \"'super' can only be referenced in members of derived classes or object literal expressions.\" },\n        Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { code: 2661, category: ts.DiagnosticCategory.Error, key: \"Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661\", message: \"Cannot export '{0}'. Only local declarations can be exported from a module.\" },\n        Cannot_find_name_0_Did_you_mean_the_static_member_1_0: { code: 2662, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662\", message: \"Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?\" },\n        Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: { code: 2663, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663\", message: \"Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?\" },\n        Invalid_module_name_in_augmentation_module_0_cannot_be_found: { code: 2664, category: ts.DiagnosticCategory.Error, key: \"Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664\", message: \"Invalid module name in augmentation, module '{0}' cannot be found.\" },\n        Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented: { code: 2665, category: ts.DiagnosticCategory.Error, key: \"Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augm_2665\", message: \"Invalid module name in augmentation. Module '{0}' resolves to an untyped module at '{1}', which cannot be augmented.\" },\n        Exports_and_export_assignments_are_not_permitted_in_module_augmentations: { code: 2666, category: ts.DiagnosticCategory.Error, key: \"Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666\", message: \"Exports and export assignments are not permitted in module augmentations.\" },\n        Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: { code: 2667, category: ts.DiagnosticCategory.Error, key: \"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667\", message: \"Imports are not permitted in module augmentations. Consider moving them to the enclosing external module.\" },\n        export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: { code: 2668, category: ts.DiagnosticCategory.Error, key: \"export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668\", message: \"'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.\" },\n        Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations: { code: 2669, category: ts.DiagnosticCategory.Error, key: \"Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669\", message: \"Augmentations for the global scope can only be directly nested in external modules or ambient module declarations.\" },\n        Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context: { code: 2670, category: ts.DiagnosticCategory.Error, key: \"Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670\", message: \"Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context.\" },\n        Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity: { code: 2671, category: ts.DiagnosticCategory.Error, key: \"Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671\", message: \"Cannot augment module '{0}' because it resolves to a non-module entity.\" },\n        Cannot_assign_a_0_constructor_type_to_a_1_constructor_type: { code: 2672, category: ts.DiagnosticCategory.Error, key: \"Cannot_assign_a_0_constructor_type_to_a_1_constructor_type_2672\", message: \"Cannot assign a '{0}' constructor type to a '{1}' constructor type.\" },\n        Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration: { code: 2673, category: ts.DiagnosticCategory.Error, key: \"Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration_2673\", message: \"Constructor of class '{0}' is private and only accessible within the class declaration.\" },\n        Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: { code: 2674, category: ts.DiagnosticCategory.Error, key: \"Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674\", message: \"Constructor of class '{0}' is protected and only accessible within the class declaration.\" },\n        Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: { code: 2675, category: ts.DiagnosticCategory.Error, key: \"Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675\", message: \"Cannot extend a class '{0}'. Class constructor is marked as private.\" },\n        Accessors_must_both_be_abstract_or_non_abstract: { code: 2676, category: ts.DiagnosticCategory.Error, key: \"Accessors_must_both_be_abstract_or_non_abstract_2676\", message: \"Accessors must both be abstract or non-abstract.\" },\n        A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: { code: 2677, category: ts.DiagnosticCategory.Error, key: \"A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677\", message: \"A type predicate's type must be assignable to its parameter's type.\" },\n        Type_0_is_not_comparable_to_type_1: { code: 2678, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_comparable_to_type_1_2678\", message: \"Type '{0}' is not comparable to type '{1}'.\" },\n        A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: { code: 2679, category: ts.DiagnosticCategory.Error, key: \"A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679\", message: \"A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'.\" },\n        A_this_parameter_must_be_the_first_parameter: { code: 2680, category: ts.DiagnosticCategory.Error, key: \"A_this_parameter_must_be_the_first_parameter_2680\", message: \"A 'this' parameter must be the first parameter.\" },\n        A_constructor_cannot_have_a_this_parameter: { code: 2681, category: ts.DiagnosticCategory.Error, key: \"A_constructor_cannot_have_a_this_parameter_2681\", message: \"A constructor cannot have a 'this' parameter.\" },\n        get_and_set_accessor_must_have_the_same_this_type: { code: 2682, category: ts.DiagnosticCategory.Error, key: \"get_and_set_accessor_must_have_the_same_this_type_2682\", message: \"'get' and 'set' accessor must have the same 'this' type.\" },\n        this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: { code: 2683, category: ts.DiagnosticCategory.Error, key: \"this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_2683\", message: \"'this' implicitly has type 'any' because it does not have a type annotation.\" },\n        The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: { code: 2684, category: ts.DiagnosticCategory.Error, key: \"The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684\", message: \"The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'.\" },\n        The_this_types_of_each_signature_are_incompatible: { code: 2685, category: ts.DiagnosticCategory.Error, key: \"The_this_types_of_each_signature_are_incompatible_2685\", message: \"The 'this' types of each signature are incompatible.\" },\n        _0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead: { code: 2686, category: ts.DiagnosticCategory.Error, key: \"_0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead_2686\", message: \"'{0}' refers to a UMD global, but the current file is a module. Consider adding an import instead.\" },\n        All_declarations_of_0_must_have_identical_modifiers: { code: 2687, category: ts.DiagnosticCategory.Error, key: \"All_declarations_of_0_must_have_identical_modifiers_2687\", message: \"All declarations of '{0}' must have identical modifiers.\" },\n        Cannot_find_type_definition_file_for_0: { code: 2688, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_type_definition_file_for_0_2688\", message: \"Cannot find type definition file for '{0}'.\" },\n        Cannot_extend_an_interface_0_Did_you_mean_implements: { code: 2689, category: ts.DiagnosticCategory.Error, key: \"Cannot_extend_an_interface_0_Did_you_mean_implements_2689\", message: \"Cannot extend an interface '{0}'. Did you mean 'implements'?\" },\n        A_class_must_be_declared_after_its_base_class: { code: 2690, category: ts.DiagnosticCategory.Error, key: \"A_class_must_be_declared_after_its_base_class_2690\", message: \"A class must be declared after its base class.\" },\n        An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: { code: 2691, category: ts.DiagnosticCategory.Error, key: \"An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691\", message: \"An import path cannot end with a '{0}' extension. Consider importing '{1}' instead.\" },\n        _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: { code: 2692, category: ts.DiagnosticCategory.Error, key: \"_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692\", message: \"'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible.\" },\n        _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: { code: 2693, category: ts.DiagnosticCategory.Error, key: \"_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693\", message: \"'{0}' only refers to a type, but is being used as a value here.\" },\n        Namespace_0_has_no_exported_member_1: { code: 2694, category: ts.DiagnosticCategory.Error, key: \"Namespace_0_has_no_exported_member_1_2694\", message: \"Namespace '{0}' has no exported member '{1}'.\" },\n        Left_side_of_comma_operator_is_unused_and_has_no_side_effects: { code: 2695, category: ts.DiagnosticCategory.Error, key: \"Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695\", message: \"Left side of comma operator is unused and has no side effects.\" },\n        The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: \"The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696\", message: \"The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?\" },\n        An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: \"An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697\", message: \"An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option.\" },\n        Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: \"Spread_types_may_only_be_created_from_object_types_2698\", message: \"Spread types may only be created from object types.\" },\n        Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: \"Rest_types_may_only_be_created_from_object_types_2700\", message: \"Rest types may only be created from object types.\" },\n        The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: \"The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701\", message: \"The target of an object rest assignment must be a variable or a property access.\" },\n        _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: \"_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702\", message: \"'{0}' only refers to a type, but is being used as a namespace here.\" },\n        Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: \"Import_declaration_0_is_using_private_name_1_4000\", message: \"Import declaration '{0}' is using private name '{1}'.\" },\n        Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002\", message: \"Type parameter '{0}' of exported class has or is using private name '{1}'.\" },\n        Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004\", message: \"Type parameter '{0}' of exported interface has or is using private name '{1}'.\" },\n        Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4006\", message: \"Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'.\" },\n        Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4008\", message: \"Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'.\" },\n        Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4010\", message: \"Type parameter '{0}' of public static method from exported class has or is using private name '{1}'.\" },\n        Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4012\", message: \"Type parameter '{0}' of public method from exported class has or is using private name '{1}'.\" },\n        Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014\", message: \"Type parameter '{0}' of method from exported interface has or is using private name '{1}'.\" },\n        Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016\", message: \"Type parameter '{0}' of exported function has or is using private name '{1}'.\" },\n        Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: ts.DiagnosticCategory.Error, key: \"Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019\", message: \"Implements clause of exported class '{0}' has or is using private name '{1}'.\" },\n        Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: ts.DiagnosticCategory.Error, key: \"Extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020\", message: \"Extends clause of exported class '{0}' has or is using private name '{1}'.\" },\n        Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: ts.DiagnosticCategory.Error, key: \"Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022\", message: \"Extends clause of exported interface '{0}' has or is using private name '{1}'.\" },\n        Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: ts.DiagnosticCategory.Error, key: \"Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023\", message: \"Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: ts.DiagnosticCategory.Error, key: \"Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024\", message: \"Exported variable '{0}' has or is using name '{1}' from private module '{2}'.\" },\n        Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: ts.DiagnosticCategory.Error, key: \"Exported_variable_0_has_or_is_using_private_name_1_4025\", message: \"Exported variable '{0}' has or is using private name '{1}'.\" },\n        Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: ts.DiagnosticCategory.Error, key: \"Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot__4026\", message: \"Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: ts.DiagnosticCategory.Error, key: \"Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4027\", message: \"Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'.\" },\n        Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: ts.DiagnosticCategory.Error, key: \"Public_static_property_0_of_exported_class_has_or_is_using_private_name_1_4028\", message: \"Public static property '{0}' of exported class has or is using private name '{1}'.\" },\n        Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: ts.DiagnosticCategory.Error, key: \"Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_name_4029\", message: \"Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: ts.DiagnosticCategory.Error, key: \"Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4030\", message: \"Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'.\" },\n        Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: ts.DiagnosticCategory.Error, key: \"Public_property_0_of_exported_class_has_or_is_using_private_name_1_4031\", message: \"Public property '{0}' of exported class has or is using private name '{1}'.\" },\n        Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: ts.DiagnosticCategory.Error, key: \"Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4032\", message: \"Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'.\" },\n        Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: ts.DiagnosticCategory.Error, key: \"Property_0_of_exported_interface_has_or_is_using_private_name_1_4033\", message: \"Property '{0}' of exported interface has or is using private name '{1}'.\" },\n        Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_4034\", message: \"Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1_4035\", message: \"Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'.\" },\n        Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_4036\", message: \"Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1_4037\", message: \"Parameter '{0}' of public property setter from exported class has or is using private name '{1}'.\" },\n        Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_externa_4038\", message: \"Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named.\" },\n        Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_4039\", message: \"Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0_4040\", message: \"Return type of public static property getter from exported class has or is using private name '{0}'.\" },\n        Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_modul_4041\", message: \"Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named.\" },\n        Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_4042\", message: \"Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0_4043\", message: \"Return type of public property getter from exported class has or is using private name '{0}'.\" },\n        Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_mod_4044\", message: \"Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0_4045\", message: \"Return type of constructor signature from exported interface has or is using private name '{0}'.\" },\n        Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4046\", message: \"Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0_4047\", message: \"Return type of call signature from exported interface has or is using private name '{0}'.\" },\n        Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4048\", message: \"Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0_4049\", message: \"Return type of index signature from exported interface has or is using private name '{0}'.\" },\n        Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module__4050\", message: \"Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named.\" },\n        Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4051\", message: \"Return type of public static method from exported class has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052\", message: \"Return type of public static method from exported class has or is using private name '{0}'.\" },\n        Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_c_4053\", message: \"Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named.\" },\n        Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4054\", message: \"Return type of public method from exported class has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0_4055\", message: \"Return type of public method from exported class has or is using private name '{0}'.\" },\n        Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4056\", message: \"Return type of method from exported interface has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0_4057\", message: \"Return type of method from exported interface has or is using private name '{0}'.\" },\n        Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named_4058\", message: \"Return type of exported function has or is using name '{0}' from external module {1} but cannot be named.\" },\n        Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1_4059\", message: \"Return type of exported function has or is using name '{0}' from private module '{1}'.\" },\n        Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: ts.DiagnosticCategory.Error, key: \"Return_type_of_exported_function_has_or_is_using_private_name_0_4060\", message: \"Return type of exported function has or is using private name '{0}'.\" },\n        Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_can_4061\", message: \"Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2_4062\", message: \"Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1_4063\", message: \"Parameter '{0}' of constructor from exported class has or is using private name '{1}'.\" },\n        Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_mod_4064\", message: \"Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4065\", message: \"Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'.\" },\n        Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4066\", message: \"Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4067\", message: \"Parameter '{0}' of call signature from exported interface has or is using private name '{1}'.\" },\n        Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module__4068\", message: \"Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4069\", message: \"Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4070\", message: \"Parameter '{0}' of public static method from exported class has or is using private name '{1}'.\" },\n        Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_c_4071\", message: \"Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4072\", message: \"Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4073\", message: \"Parameter '{0}' of public method from exported class has or is using private name '{1}'.\" },\n        Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4074\", message: \"Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4075\", message: \"Parameter '{0}' of method from exported interface has or is using private name '{1}'.\" },\n        Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4076\", message: \"Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named.\" },\n        Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2_4077\", message: \"Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078\", message: \"Parameter '{0}' of exported function has or is using private name '{1}'.\" },\n        Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: \"Exported_type_alias_0_has_or_is_using_private_name_1_4081\", message: \"Exported type alias '{0}' has or is using private name '{1}'.\" },\n        Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: \"Default_export_of_the_module_has_or_is_using_private_name_0_4082\", message: \"Default export of the module has or is using private name '{0}'.\" },\n        Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: \"Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083\", message: \"Type parameter '{0}' of exported type alias has or is using private name '{1}'.\" },\n        Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: \"Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090\", message: \"Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict.\" },\n        Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091\", message: \"Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'.\" },\n        Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092\", message: \"Parameter '{0}' of index signature from exported interface has or is using private name '{1}'.\" },\n        The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: \"The_current_host_does_not_support_the_0_option_5001\", message: \"The current host does not support the '{0}' option.\" },\n        Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_the_common_subdirectory_path_for_the_input_files_5009\", message: \"Cannot find the common subdirectory path for the input files.\" },\n        File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: \"File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010\", message: \"File specification cannot end in a recursive directory wildcard ('**'): '{0}'.\" },\n        File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0: { code: 5011, category: ts.DiagnosticCategory.Error, key: \"File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0_5011\", message: \"File specification cannot contain multiple recursive directory wildcards ('**'): '{0}'.\" },\n        Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: \"Cannot_read_file_0_Colon_1_5012\", message: \"Cannot read file '{0}': {1}\" },\n        Unsupported_file_encoding: { code: 5013, category: ts.DiagnosticCategory.Error, key: \"Unsupported_file_encoding_5013\", message: \"Unsupported file encoding.\" },\n        Failed_to_parse_file_0_Colon_1: { code: 5014, category: ts.DiagnosticCategory.Error, key: \"Failed_to_parse_file_0_Colon_1_5014\", message: \"Failed to parse file '{0}': {1}.\" },\n        Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: \"Unknown_compiler_option_0_5023\", message: \"Unknown compiler option '{0}'.\" },\n        Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: \"Compiler_option_0_requires_a_value_of_type_1_5024\", message: \"Compiler option '{0}' requires a value of type {1}.\" },\n        Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: \"Could_not_write_file_0_Colon_1_5033\", message: \"Could not write file '{0}': {1}\" },\n        Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: \"Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042\", message: \"Option 'project' cannot be mixed with source files on a command line.\" },\n        Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: \"Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047\", message: \"Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher.\" },\n        Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: \"Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051\", message: \"Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.\" },\n        Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: \"Option_0_cannot_be_specified_without_specifying_option_1_5052\", message: \"Option '{0}' cannot be specified without specifying option '{1}'.\" },\n        Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: \"Option_0_cannot_be_specified_with_option_1_5053\", message: \"Option '{0}' cannot be specified with option '{1}'.\" },\n        A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: \"A_tsconfig_json_file_is_already_defined_at_Colon_0_5054\", message: \"A 'tsconfig.json' file is already defined at: '{0}'.\" },\n        Cannot_write_file_0_because_it_would_overwrite_input_file: { code: 5055, category: ts.DiagnosticCategory.Error, key: \"Cannot_write_file_0_because_it_would_overwrite_input_file_5055\", message: \"Cannot write file '{0}' because it would overwrite input file.\" },\n        Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { code: 5056, category: ts.DiagnosticCategory.Error, key: \"Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056\", message: \"Cannot write file '{0}' because it would be overwritten by multiple input files.\" },\n        Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: \"Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057\", message: \"Cannot find a tsconfig.json file at the specified directory: '{0}'\" },\n        The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: \"The_specified_path_does_not_exist_Colon_0_5058\", message: \"The specified path does not exist: '{0}'\" },\n        Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { code: 5059, category: ts.DiagnosticCategory.Error, key: \"Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059\", message: \"Invalid value for '--reactNamespace'. '{0}' is not a valid identifier.\" },\n        Option_paths_cannot_be_used_without_specifying_baseUrl_option: { code: 5060, category: ts.DiagnosticCategory.Error, key: \"Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060\", message: \"Option 'paths' cannot be used without specifying '--baseUrl' option.\" },\n        Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: \"Pattern_0_can_have_at_most_one_Asterisk_character_5061\", message: \"Pattern '{0}' can have at most one '*' character\" },\n        Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: \"Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062\", message: \"Substitution '{0}' in pattern '{1}' in can have at most one '*' character\" },\n        Substitutions_for_pattern_0_should_be_an_array: { code: 5063, category: ts.DiagnosticCategory.Error, key: \"Substitutions_for_pattern_0_should_be_an_array_5063\", message: \"Substitutions for pattern '{0}' should be an array.\" },\n        Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: \"Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064\", message: \"Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'.\" },\n        File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5065, category: ts.DiagnosticCategory.Error, key: \"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065\", message: \"File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'.\" },\n        Substitutions_for_pattern_0_shouldn_t_be_an_empty_array: { code: 5066, category: ts.DiagnosticCategory.Error, key: \"Substitutions_for_pattern_0_shouldn_t_be_an_empty_array_5066\", message: \"Substitutions for pattern '{0}' shouldn't be an empty array.\" },\n        Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name: { code: 5067, category: ts.DiagnosticCategory.Error, key: \"Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067\", message: \"Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name.\" },\n        Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: \"Concatenate_and_emit_output_to_single_file_6001\", message: \"Concatenate and emit output to single file.\" },\n        Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: \"Generates_corresponding_d_ts_file_6002\", message: \"Generates corresponding '.d.ts' file.\" },\n        Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: \"Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003\", message: \"Specify the location where debugger should locate map files instead of generated locations.\" },\n        Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: \"Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004\", message: \"Specify the location where debugger should locate TypeScript files instead of source locations.\" },\n        Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: \"Watch_input_files_6005\", message: \"Watch input files.\" },\n        Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: \"Redirect_output_structure_to_the_directory_6006\", message: \"Redirect output structure to the directory.\" },\n        Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: \"Do_not_erase_const_enum_declarations_in_generated_code_6007\", message: \"Do not erase const enum declarations in generated code.\" },\n        Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: \"Do_not_emit_outputs_if_any_errors_were_reported_6008\", message: \"Do not emit outputs if any errors were reported.\" },\n        Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: \"Do_not_emit_comments_to_output_6009\", message: \"Do not emit comments to output.\" },\n        Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: \"Do_not_emit_outputs_6010\", message: \"Do not emit outputs.\" },\n        Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: \"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011\", message: \"Allow default imports from modules with no default export. This does not affect code emit, just typechecking.\" },\n        Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: \"Skip_type_checking_of_declaration_files_6012\", message: \"Skip type checking of declaration files.\" },\n        Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: \"Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015\", message: \"Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'\" },\n        Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: \"Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016\", message: \"Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'\" },\n        Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: \"Print_this_message_6017\", message: \"Print this message.\" },\n        Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: \"Print_the_compiler_s_version_6019\", message: \"Print the compiler's version.\" },\n        Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: \"Compile_the_project_in_the_given_directory_6020\", message: \"Compile the project in the given directory.\" },\n        Syntax_Colon_0: { code: 6023, category: ts.DiagnosticCategory.Message, key: \"Syntax_Colon_0_6023\", message: \"Syntax: {0}\" },\n        options: { code: 6024, category: ts.DiagnosticCategory.Message, key: \"options_6024\", message: \"options\" },\n        file: { code: 6025, category: ts.DiagnosticCategory.Message, key: \"file_6025\", message: \"file\" },\n        Examples_Colon_0: { code: 6026, category: ts.DiagnosticCategory.Message, key: \"Examples_Colon_0_6026\", message: \"Examples: {0}\" },\n        Options_Colon: { code: 6027, category: ts.DiagnosticCategory.Message, key: \"Options_Colon_6027\", message: \"Options:\" },\n        Version_0: { code: 6029, category: ts.DiagnosticCategory.Message, key: \"Version_0_6029\", message: \"Version {0}\" },\n        Insert_command_line_options_and_files_from_a_file: { code: 6030, category: ts.DiagnosticCategory.Message, key: \"Insert_command_line_options_and_files_from_a_file_6030\", message: \"Insert command line options and files from a file.\" },\n        File_change_detected_Starting_incremental_compilation: { code: 6032, category: ts.DiagnosticCategory.Message, key: \"File_change_detected_Starting_incremental_compilation_6032\", message: \"File change detected. Starting incremental compilation...\" },\n        KIND: { code: 6034, category: ts.DiagnosticCategory.Message, key: \"KIND_6034\", message: \"KIND\" },\n        FILE: { code: 6035, category: ts.DiagnosticCategory.Message, key: \"FILE_6035\", message: \"FILE\" },\n        VERSION: { code: 6036, category: ts.DiagnosticCategory.Message, key: \"VERSION_6036\", message: \"VERSION\" },\n        LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: \"LOCATION_6037\", message: \"LOCATION\" },\n        DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: \"DIRECTORY_6038\", message: \"DIRECTORY\" },\n        STRATEGY: { code: 6039, category: ts.DiagnosticCategory.Message, key: \"STRATEGY_6039\", message: \"STRATEGY\" },\n        Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: \"Compilation_complete_Watching_for_file_changes_6042\", message: \"Compilation complete. Watching for file changes.\" },\n        Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: \"Generates_corresponding_map_file_6043\", message: \"Generates corresponding '.map' file.\" },\n        Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: \"Compiler_option_0_expects_an_argument_6044\", message: \"Compiler option '{0}' expects an argument.\" },\n        Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: \"Unterminated_quoted_string_in_response_file_0_6045\", message: \"Unterminated quoted string in response file '{0}'.\" },\n        Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: \"Argument_for_0_option_must_be_Colon_1_6046\", message: \"Argument for '{0}' option must be: {1}\" },\n        Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: \"Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048\", message: \"Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'.\" },\n        Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: \"Unsupported_locale_0_6049\", message: \"Unsupported locale '{0}'.\" },\n        Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: \"Unable_to_open_file_0_6050\", message: \"Unable to open file '{0}'.\" },\n        Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: \"Corrupted_locale_file_0_6051\", message: \"Corrupted locale file {0}.\" },\n        Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: \"Raise_error_on_expressions_and_declarations_with_an_implied_any_type_6052\", message: \"Raise error on expressions and declarations with an implied 'any' type.\" },\n        File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: \"File_0_not_found_6053\", message: \"File '{0}' not found.\" },\n        File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: \"File_0_has_unsupported_extension_The_only_supported_extensions_are_1_6054\", message: \"File '{0}' has unsupported extension. The only supported extensions are {1}.\" },\n        Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: \"Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055\", message: \"Suppress noImplicitAny errors for indexing objects lacking index signatures.\" },\n        Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: \"Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056\", message: \"Do not emit declarations for code that has an '@internal' annotation.\" },\n        Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: \"Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058\", message: \"Specify the root directory of input files. Use to control the output directory structure with --outDir.\" },\n        File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: \"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059\", message: \"File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files.\" },\n        Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: \"Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060\", message: \"Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix).\" },\n        NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: \"NEWLINE_6061\", message: \"NEWLINE\" },\n        Option_0_can_only_be_specified_in_tsconfig_json_file: { code: 6064, category: ts.DiagnosticCategory.Error, key: \"Option_0_can_only_be_specified_in_tsconfig_json_file_6064\", message: \"Option '{0}' can only be specified in 'tsconfig.json' file.\" },\n        Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: \"Enables_experimental_support_for_ES7_decorators_6065\", message: \"Enables experimental support for ES7 decorators.\" },\n        Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: \"Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066\", message: \"Enables experimental support for emitting type metadata for decorators.\" },\n        Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: \"Enables_experimental_support_for_ES7_async_functions_6068\", message: \"Enables experimental support for ES7 async functions.\" },\n        Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: \"Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069\", message: \"Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6).\" },\n        Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: \"Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070\", message: \"Initializes a TypeScript project and creates a tsconfig.json file.\" },\n        Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: \"Successfully_created_a_tsconfig_json_file_6071\", message: \"Successfully created a tsconfig.json file.\" },\n        Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: \"Suppress_excess_property_checks_for_object_literals_6072\", message: \"Suppress excess property checks for object literals.\" },\n        Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: \"Stylize_errors_and_messages_using_color_and_context_experimental_6073\", message: \"Stylize errors and messages using color and context. (experimental)\" },\n        Do_not_report_errors_on_unused_labels: { code: 6074, category: ts.DiagnosticCategory.Message, key: \"Do_not_report_errors_on_unused_labels_6074\", message: \"Do not report errors on unused labels.\" },\n        Report_error_when_not_all_code_paths_in_function_return_a_value: { code: 6075, category: ts.DiagnosticCategory.Message, key: \"Report_error_when_not_all_code_paths_in_function_return_a_value_6075\", message: \"Report error when not all code paths in function return a value.\" },\n        Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: \"Report_errors_for_fallthrough_cases_in_switch_statement_6076\", message: \"Report errors for fallthrough cases in switch statement.\" },\n        Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: \"Do_not_report_errors_on_unreachable_code_6077\", message: \"Do not report errors on unreachable code.\" },\n        Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: \"Disallow_inconsistently_cased_references_to_the_same_file_6078\", message: \"Disallow inconsistently-cased references to the same file.\" },\n        Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: \"Specify_library_files_to_be_included_in_the_compilation_Colon_6079\", message: \"Specify library files to be included in the compilation: \" },\n        Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: \"Specify_JSX_code_generation_Colon_preserve_or_react_6080\", message: \"Specify JSX code generation: 'preserve' or 'react'\" },\n        Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: \"Only_amd_and_system_modules_are_supported_alongside_0_6082\", message: \"Only 'amd' and 'system' modules are supported alongside --{0}.\" },\n        Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: \"Base_directory_to_resolve_non_absolute_module_names_6083\", message: \"Base directory to resolve non-absolute module names.\" },\n        Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: \"Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084\", message: \"Specify the object invoked for createElement and __spread when targeting 'react' JSX emit\" },\n        Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: \"Enable_tracing_of_the_name_resolution_process_6085\", message: \"Enable tracing of the name resolution process.\" },\n        Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: \"Resolving_module_0_from_1_6086\", message: \"======== Resolving module '{0}' from '{1}'. ========\" },\n        Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: \"Explicitly_specified_module_resolution_kind_Colon_0_6087\", message: \"Explicitly specified module resolution kind: '{0}'.\" },\n        Module_resolution_kind_is_not_specified_using_0: { code: 6088, category: ts.DiagnosticCategory.Message, key: \"Module_resolution_kind_is_not_specified_using_0_6088\", message: \"Module resolution kind is not specified, using '{0}'.\" },\n        Module_name_0_was_successfully_resolved_to_1: { code: 6089, category: ts.DiagnosticCategory.Message, key: \"Module_name_0_was_successfully_resolved_to_1_6089\", message: \"======== Module name '{0}' was successfully resolved to '{1}'. ========\" },\n        Module_name_0_was_not_resolved: { code: 6090, category: ts.DiagnosticCategory.Message, key: \"Module_name_0_was_not_resolved_6090\", message: \"======== Module name '{0}' was not resolved. ========\" },\n        paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0: { code: 6091, category: ts.DiagnosticCategory.Message, key: \"paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091\", message: \"'paths' option is specified, looking for a pattern to match module name '{0}'.\" },\n        Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: \"Module_name_0_matched_pattern_1_6092\", message: \"Module name '{0}', matched pattern '{1}'.\" },\n        Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: \"Trying_substitution_0_candidate_module_location_Colon_1_6093\", message: \"Trying substitution '{0}', candidate module location: '{1}'.\" },\n        Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: \"Resolving_module_name_0_relative_to_base_url_1_2_6094\", message: \"Resolving module name '{0}' relative to base url '{1}' - '{2}'.\" },\n        Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: \"Loading_module_as_file_Slash_folder_candidate_module_location_0_6095\", message: \"Loading module as file / folder, candidate module location '{0}'.\" },\n        File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: \"File_0_does_not_exist_6096\", message: \"File '{0}' does not exist.\" },\n        File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: \"File_0_exist_use_it_as_a_name_resolution_result_6097\", message: \"File '{0}' exist - use it as a name resolution result.\" },\n        Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: \"Loading_module_0_from_node_modules_folder_6098\", message: \"Loading module '{0}' from 'node_modules' folder.\" },\n        Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: \"Found_package_json_at_0_6099\", message: \"Found 'package.json' at '{0}'.\" },\n        package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: \"package_json_does_not_have_a_types_or_main_field_6100\", message: \"'package.json' does not have a 'types' or 'main' field.\" },\n        package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: \"package_json_has_0_field_1_that_references_2_6101\", message: \"'package.json' has '{0}' field '{1}' that references '{2}'.\" },\n        Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: \"Allow_javascript_files_to_be_compiled_6102\", message: \"Allow javascript files to be compiled.\" },\n        Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: \"Option_0_should_have_array_of_strings_as_a_value_6103\", message: \"Option '{0}' should have array of strings as a value.\" },\n        Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: \"Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104\", message: \"Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'.\" },\n        Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: \"Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105\", message: \"Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'.\" },\n        baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: \"baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106\", message: \"'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'\" },\n        rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: \"rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107\", message: \"'rootDirs' option is set, using it to resolve relative module name '{0}'\" },\n        Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: \"Longest_matching_prefix_for_0_is_1_6108\", message: \"Longest matching prefix for '{0}' is '{1}'\" },\n        Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: \"Loading_0_from_the_root_dir_1_candidate_location_2_6109\", message: \"Loading '{0}' from the root dir '{1}', candidate location '{2}'\" },\n        Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: \"Trying_other_entries_in_rootDirs_6110\", message: \"Trying other entries in 'rootDirs'\" },\n        Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: \"Module_resolution_using_rootDirs_has_failed_6111\", message: \"Module resolution using 'rootDirs' has failed\" },\n        Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: \"Do_not_emit_use_strict_directives_in_module_output_6112\", message: \"Do not emit 'use strict' directives in module output.\" },\n        Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: \"Enable_strict_null_checks_6113\", message: \"Enable strict null checks.\" },\n        Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: \"Unknown_option_excludes_Did_you_mean_exclude_6114\", message: \"Unknown option 'excludes'. Did you mean 'exclude'?\" },\n        Raise_error_on_this_expressions_with_an_implied_any_type: { code: 6115, category: ts.DiagnosticCategory.Message, key: \"Raise_error_on_this_expressions_with_an_implied_any_type_6115\", message: \"Raise error on 'this' expressions with an implied 'any' type.\" },\n        Resolving_type_reference_directive_0_containing_file_1_root_directory_2: { code: 6116, category: ts.DiagnosticCategory.Message, key: \"Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116\", message: \"======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========\" },\n        Resolving_using_primary_search_paths: { code: 6117, category: ts.DiagnosticCategory.Message, key: \"Resolving_using_primary_search_paths_6117\", message: \"Resolving using primary search paths...\" },\n        Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: \"Resolving_from_node_modules_folder_6118\", message: \"Resolving from node_modules folder...\" },\n        Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: \"Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119\", message: \"======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========\" },\n        Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: \"Type_reference_directive_0_was_not_resolved_6120\", message: \"======== Type reference directive '{0}' was not resolved. ========\" },\n        Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: \"Resolving_with_primary_search_path_0_6121\", message: \"Resolving with primary search path '{0}'\" },\n        Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: \"Root_directory_cannot_be_determined_skipping_primary_search_paths_6122\", message: \"Root directory cannot be determined, skipping primary search paths.\" },\n        Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: \"Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123\", message: \"======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========\" },\n        Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: \"Type_declaration_files_to_be_included_in_compilation_6124\", message: \"Type declaration files to be included in compilation.\" },\n        Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: \"Looking_up_in_node_modules_folder_initial_location_0_6125\", message: \"Looking up in 'node_modules' folder, initial location '{0}'\" },\n        Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: \"Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126\", message: \"Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder.\" },\n        Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: \"Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127\", message: \"======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========\" },\n        Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: \"Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128\", message: \"======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========\" },\n        The_config_file_0_found_doesn_t_contain_any_source_files: { code: 6129, category: ts.DiagnosticCategory.Error, key: \"The_config_file_0_found_doesn_t_contain_any_source_files_6129\", message: \"The config file '{0}' found doesn't contain any source files.\" },\n        Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: \"Resolving_real_path_for_0_result_1_6130\", message: \"Resolving real path for '{0}', result '{1}'\" },\n        Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: \"Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131\", message: \"Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'.\" },\n        File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: \"File_name_0_has_a_1_extension_stripping_it_6132\", message: \"File name '{0}' has a '{1}' extension - stripping it\" },\n        _0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: \"_0_is_declared_but_never_used_6133\", message: \"'{0}' is declared but never used.\" },\n        Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: \"Report_errors_on_unused_locals_6134\", message: \"Report errors on unused locals.\" },\n        Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: \"Report_errors_on_unused_parameters_6135\", message: \"Report errors on unused parameters.\" },\n        The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: \"The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136\", message: \"The maximum dependency depth to search under node_modules and load JavaScript files\" },\n        No_types_specified_in_package_json_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: \"No_types_specified_in_package_json_so_returning_main_value_of_0_6137\", message: \"No types specified in 'package.json', so returning 'main' value of '{0}'\" },\n        Property_0_is_declared_but_never_used: { code: 6138, category: ts.DiagnosticCategory.Error, key: \"Property_0_is_declared_but_never_used_6138\", message: \"Property '{0}' is declared but never used.\" },\n        Import_emit_helpers_from_tslib: { code: 6139, category: ts.DiagnosticCategory.Message, key: \"Import_emit_helpers_from_tslib_6139\", message: \"Import emit helpers from 'tslib'.\" },\n        Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: { code: 6140, category: ts.DiagnosticCategory.Error, key: \"Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140\", message: \"Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'.\" },\n        Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: \"Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141\", message: \"Parse in strict mode and emit \\\"use strict\\\" for each source file\" },\n        Module_0_was_resolved_to_1_but_jsx_is_not_set: { code: 6142, category: ts.DiagnosticCategory.Error, key: \"Module_0_was_resolved_to_1_but_jsx_is_not_set_6142\", message: \"Module '{0}' was resolved to '{1}', but '--jsx' is not set.\" },\n        Module_0_was_resolved_to_1_but_allowJs_is_not_set: { code: 6143, category: ts.DiagnosticCategory.Error, key: \"Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143\", message: \"Module '{0}' was resolved to '{1}', but '--allowJs' is not set.\" },\n        Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: \"Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144\", message: \"Module '{0}' was resolved as locally declared ambient module in file '{1}'.\" },\n        Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: \"Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145\", message: \"Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified.\" },\n        Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: \"Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146\", message: \"Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'.\" },\n        Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: \"Variable_0_implicitly_has_an_1_type_7005\", message: \"Variable '{0}' implicitly has an '{1}' type.\" },\n        Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: \"Parameter_0_implicitly_has_an_1_type_7006\", message: \"Parameter '{0}' implicitly has an '{1}' type.\" },\n        Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: \"Member_0_implicitly_has_an_1_type_7008\", message: \"Member '{0}' implicitly has an '{1}' type.\" },\n        new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: ts.DiagnosticCategory.Error, key: \"new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009\", message: \"'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.\" },\n        _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: ts.DiagnosticCategory.Error, key: \"_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010\", message: \"'{0}', which lacks return-type annotation, implicitly has an '{1}' return type.\" },\n        Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: ts.DiagnosticCategory.Error, key: \"Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011\", message: \"Function expression, which lacks return-type annotation, implicitly has an '{0}' return type.\" },\n        Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: ts.DiagnosticCategory.Error, key: \"Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013\", message: \"Construct signature, which lacks return-type annotation, implicitly has an 'any' return type.\" },\n        Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: { code: 7015, category: ts.DiagnosticCategory.Error, key: \"Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015\", message: \"Element implicitly has an 'any' type because index expression is not of type 'number'.\" },\n        Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type: { code: 7016, category: ts.DiagnosticCategory.Error, key: \"Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type_7016\", message: \"Could not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type.\" },\n        Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature: { code: 7017, category: ts.DiagnosticCategory.Error, key: \"Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017\", message: \"Element implicitly has an 'any' type because type '{0}' has no index signature.\" },\n        Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: \"Object_literal_s_property_0_implicitly_has_an_1_type_7018\", message: \"Object literal's property '{0}' implicitly has an '{1}' type.\" },\n        Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: \"Rest_parameter_0_implicitly_has_an_any_type_7019\", message: \"Rest parameter '{0}' implicitly has an 'any[]' type.\" },\n        Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: \"Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020\", message: \"Call signature, which lacks return-type annotation, implicitly has an 'any' return type.\" },\n        _0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: \"_0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or__7022\", message: \"'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.\" },\n        _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: \"_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023\", message: \"'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.\" },\n        Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: \"Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024\", message: \"Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.\" },\n        Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: ts.DiagnosticCategory.Error, key: \"Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025\", message: \"Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type.\" },\n        JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: \"JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026\", message: \"JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists\" },\n        Unreachable_code_detected: { code: 7027, category: ts.DiagnosticCategory.Error, key: \"Unreachable_code_detected_7027\", message: \"Unreachable code detected.\" },\n        Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: \"Unused_label_7028\", message: \"Unused label.\" },\n        Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: \"Fallthrough_case_in_switch_7029\", message: \"Fallthrough case in switch.\" },\n        Not_all_code_paths_return_a_value: { code: 7030, category: ts.DiagnosticCategory.Error, key: \"Not_all_code_paths_return_a_value_7030\", message: \"Not all code paths return a value.\" },\n        Binding_element_0_implicitly_has_an_1_type: { code: 7031, category: ts.DiagnosticCategory.Error, key: \"Binding_element_0_implicitly_has_an_1_type_7031\", message: \"Binding element '{0}' implicitly has an '{1}' type.\" },\n        Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation: { code: 7032, category: ts.DiagnosticCategory.Error, key: \"Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation_7032\", message: \"Property '{0}' implicitly has type 'any', because its set accessor lacks a parameter type annotation.\" },\n        Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation: { code: 7033, category: ts.DiagnosticCategory.Error, key: \"Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation_7033\", message: \"Property '{0}' implicitly has type 'any', because its get accessor lacks a return type annotation.\" },\n        Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined: { code: 7034, category: ts.DiagnosticCategory.Error, key: \"Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined_7034\", message: \"Variable '{0}' implicitly has type '{1}' in some locations where its type cannot be determined.\" },\n        You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: \"You_cannot_rename_this_element_8000\", message: \"You cannot rename this element.\" },\n        You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: \"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001\", message: \"You cannot rename elements that are defined in the standard TypeScript library.\" },\n        import_can_only_be_used_in_a_ts_file: { code: 8002, category: ts.DiagnosticCategory.Error, key: \"import_can_only_be_used_in_a_ts_file_8002\", message: \"'import ... =' can only be used in a .ts file.\" },\n        export_can_only_be_used_in_a_ts_file: { code: 8003, category: ts.DiagnosticCategory.Error, key: \"export_can_only_be_used_in_a_ts_file_8003\", message: \"'export=' can only be used in a .ts file.\" },\n        type_parameter_declarations_can_only_be_used_in_a_ts_file: { code: 8004, category: ts.DiagnosticCategory.Error, key: \"type_parameter_declarations_can_only_be_used_in_a_ts_file_8004\", message: \"'type parameter declarations' can only be used in a .ts file.\" },\n        implements_clauses_can_only_be_used_in_a_ts_file: { code: 8005, category: ts.DiagnosticCategory.Error, key: \"implements_clauses_can_only_be_used_in_a_ts_file_8005\", message: \"'implements clauses' can only be used in a .ts file.\" },\n        interface_declarations_can_only_be_used_in_a_ts_file: { code: 8006, category: ts.DiagnosticCategory.Error, key: \"interface_declarations_can_only_be_used_in_a_ts_file_8006\", message: \"'interface declarations' can only be used in a .ts file.\" },\n        module_declarations_can_only_be_used_in_a_ts_file: { code: 8007, category: ts.DiagnosticCategory.Error, key: \"module_declarations_can_only_be_used_in_a_ts_file_8007\", message: \"'module declarations' can only be used in a .ts file.\" },\n        type_aliases_can_only_be_used_in_a_ts_file: { code: 8008, category: ts.DiagnosticCategory.Error, key: \"type_aliases_can_only_be_used_in_a_ts_file_8008\", message: \"'type aliases' can only be used in a .ts file.\" },\n        _0_can_only_be_used_in_a_ts_file: { code: 8009, category: ts.DiagnosticCategory.Error, key: \"_0_can_only_be_used_in_a_ts_file_8009\", message: \"'{0}' can only be used in a .ts file.\" },\n        types_can_only_be_used_in_a_ts_file: { code: 8010, category: ts.DiagnosticCategory.Error, key: \"types_can_only_be_used_in_a_ts_file_8010\", message: \"'types' can only be used in a .ts file.\" },\n        type_arguments_can_only_be_used_in_a_ts_file: { code: 8011, category: ts.DiagnosticCategory.Error, key: \"type_arguments_can_only_be_used_in_a_ts_file_8011\", message: \"'type arguments' can only be used in a .ts file.\" },\n        parameter_modifiers_can_only_be_used_in_a_ts_file: { code: 8012, category: ts.DiagnosticCategory.Error, key: \"parameter_modifiers_can_only_be_used_in_a_ts_file_8012\", message: \"'parameter modifiers' can only be used in a .ts file.\" },\n        enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: ts.DiagnosticCategory.Error, key: \"enum_declarations_can_only_be_used_in_a_ts_file_8015\", message: \"'enum declarations' can only be used in a .ts file.\" },\n        type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: \"type_assertion_expressions_can_only_be_used_in_a_ts_file_8016\", message: \"'type assertion expressions' can only be used in a .ts file.\" },\n        Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: \"Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002\", message: \"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.\" },\n        class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: \"class_expressions_are_not_currently_supported_9003\", message: \"'class' expressions are not currently supported.\" },\n        Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: \"Language_service_is_disabled_9004\", message: \"Language service is disabled.\" },\n        JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: \"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000\", message: \"JSX attributes must only be assigned a non-empty 'expression'.\" },\n        JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: ts.DiagnosticCategory.Error, key: \"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001\", message: \"JSX elements cannot have multiple attributes with the same name.\" },\n        Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: \"Expected_corresponding_JSX_closing_tag_for_0_17002\", message: \"Expected corresponding JSX closing tag for '{0}'.\" },\n        JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: \"JSX_attribute_expected_17003\", message: \"JSX attribute expected.\" },\n        Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: \"Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004\", message: \"Cannot use JSX unless the '--jsx' flag is provided.\" },\n        A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: \"A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005\", message: \"A constructor cannot contain a 'super' call when its class extends 'null'\" },\n        An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: \"An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006\", message: \"An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.\" },\n        A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: \"A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007\", message: \"A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.\" },\n        JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: \"JSX_element_0_has_no_corresponding_closing_tag_17008\", message: \"JSX element '{0}' has no corresponding closing tag.\" },\n        super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: \"super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009\", message: \"'super' must be called before accessing 'this' in the constructor of a derived class.\" },\n        Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: \"Unknown_type_acquisition_option_0_17010\", message: \"Unknown type acquisition option '{0}'.\" },\n        Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: \"Circularity_detected_while_resolving_configuration_Colon_0_18000\", message: \"Circularity detected while resolving configuration: {0}\" },\n        A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: \"A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001\", message: \"A path in an 'extends' option must be relative or rooted, but '{0}' is not.\" },\n        The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: \"The_files_list_in_config_file_0_is_empty_18002\", message: \"The 'files' list in config file '{0}' is empty.\" },\n        No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: \"No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003\", message: \"No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'.\" },\n        Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: \"Add_missing_super_call_90001\", message: \"Add missing 'super()' call.\" },\n        Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: \"Make_super_call_the_first_statement_in_the_constructor_90002\", message: \"Make 'super()' call the first statement in the constructor.\" },\n        Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: \"Change_extends_to_implements_90003\", message: \"Change 'extends' to 'implements'\" },\n        Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: \"Remove_unused_identifiers_90004\", message: \"Remove unused identifiers\" },\n        Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: \"Implement_interface_on_reference_90005\", message: \"Implement interface on reference\" },\n        Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: \"Implement_interface_on_class_90006\", message: \"Implement interface on class\" },\n        Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: \"Implement_inherited_abstract_class_90007\", message: \"Implement inherited abstract class\" },\n        Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: \"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009\", message: \"Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig\" },\n        Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: \"Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010\", message: \"Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated.\" },\n        Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: \"Import_0_from_1_90013\", message: \"Import {0} from {1}\" },\n        Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: \"Change_0_to_1_90014\", message: \"Change {0} to {1}\" },\n        Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: \"Add_0_to_existing_import_declaration_from_1_90015\", message: \"Add {0} to existing import declaration from {1}\" },\n    };\n})(ts || (ts = {}));\n/// <reference path=\"core.ts\"/>\n/// <reference path=\"diagnosticInformationMap.generated.ts\"/>\nvar ts;\n(function (ts) {\n    /* @internal */\n    function tokenIsIdentifierOrKeyword(token) {\n        return token >= 70 /* Identifier */;\n    }\n    ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword;\n    var textToToken = ts.createMap({\n        \"abstract\": 116 /* AbstractKeyword */,\n        \"any\": 118 /* AnyKeyword */,\n        \"as\": 117 /* AsKeyword */,\n        \"boolean\": 121 /* BooleanKeyword */,\n        \"break\": 71 /* BreakKeyword */,\n        \"case\": 72 /* CaseKeyword */,\n        \"catch\": 73 /* CatchKeyword */,\n        \"class\": 74 /* ClassKeyword */,\n        \"continue\": 76 /* ContinueKeyword */,\n        \"const\": 75 /* ConstKeyword */,\n        \"constructor\": 122 /* ConstructorKeyword */,\n        \"debugger\": 77 /* DebuggerKeyword */,\n        \"declare\": 123 /* DeclareKeyword */,\n        \"default\": 78 /* DefaultKeyword */,\n        \"delete\": 79 /* DeleteKeyword */,\n        \"do\": 80 /* DoKeyword */,\n        \"else\": 81 /* ElseKeyword */,\n        \"enum\": 82 /* EnumKeyword */,\n        \"export\": 83 /* ExportKeyword */,\n        \"extends\": 84 /* ExtendsKeyword */,\n        \"false\": 85 /* FalseKeyword */,\n        \"finally\": 86 /* FinallyKeyword */,\n        \"for\": 87 /* ForKeyword */,\n        \"from\": 138 /* FromKeyword */,\n        \"function\": 88 /* FunctionKeyword */,\n        \"get\": 124 /* GetKeyword */,\n        \"if\": 89 /* IfKeyword */,\n        \"implements\": 107 /* ImplementsKeyword */,\n        \"import\": 90 /* ImportKeyword */,\n        \"in\": 91 /* InKeyword */,\n        \"instanceof\": 92 /* InstanceOfKeyword */,\n        \"interface\": 108 /* InterfaceKeyword */,\n        \"is\": 125 /* IsKeyword */,\n        \"keyof\": 126 /* KeyOfKeyword */,\n        \"let\": 109 /* LetKeyword */,\n        \"module\": 127 /* ModuleKeyword */,\n        \"namespace\": 128 /* NamespaceKeyword */,\n        \"never\": 129 /* NeverKeyword */,\n        \"new\": 93 /* NewKeyword */,\n        \"null\": 94 /* NullKeyword */,\n        \"number\": 132 /* NumberKeyword */,\n        \"package\": 110 /* PackageKeyword */,\n        \"private\": 111 /* PrivateKeyword */,\n        \"protected\": 112 /* ProtectedKeyword */,\n        \"public\": 113 /* PublicKeyword */,\n        \"readonly\": 130 /* ReadonlyKeyword */,\n        \"require\": 131 /* RequireKeyword */,\n        \"global\": 139 /* GlobalKeyword */,\n        \"return\": 95 /* ReturnKeyword */,\n        \"set\": 133 /* SetKeyword */,\n        \"static\": 114 /* StaticKeyword */,\n        \"string\": 134 /* StringKeyword */,\n        \"super\": 96 /* SuperKeyword */,\n        \"switch\": 97 /* SwitchKeyword */,\n        \"symbol\": 135 /* SymbolKeyword */,\n        \"this\": 98 /* ThisKeyword */,\n        \"throw\": 99 /* ThrowKeyword */,\n        \"true\": 100 /* TrueKeyword */,\n        \"try\": 101 /* TryKeyword */,\n        \"type\": 136 /* TypeKeyword */,\n        \"typeof\": 102 /* TypeOfKeyword */,\n        \"undefined\": 137 /* UndefinedKeyword */,\n        \"var\": 103 /* VarKeyword */,\n        \"void\": 104 /* VoidKeyword */,\n        \"while\": 105 /* WhileKeyword */,\n        \"with\": 106 /* WithKeyword */,\n        \"yield\": 115 /* YieldKeyword */,\n        \"async\": 119 /* AsyncKeyword */,\n        \"await\": 120 /* AwaitKeyword */,\n        \"of\": 140 /* OfKeyword */,\n        \"{\": 16 /* OpenBraceToken */,\n        \"}\": 17 /* CloseBraceToken */,\n        \"(\": 18 /* OpenParenToken */,\n        \")\": 19 /* CloseParenToken */,\n        \"[\": 20 /* OpenBracketToken */,\n        \"]\": 21 /* CloseBracketToken */,\n        \".\": 22 /* DotToken */,\n        \"...\": 23 /* DotDotDotToken */,\n        \";\": 24 /* SemicolonToken */,\n        \",\": 25 /* CommaToken */,\n        \"<\": 26 /* LessThanToken */,\n        \">\": 28 /* GreaterThanToken */,\n        \"<=\": 29 /* LessThanEqualsToken */,\n        \">=\": 30 /* GreaterThanEqualsToken */,\n        \"==\": 31 /* EqualsEqualsToken */,\n        \"!=\": 32 /* ExclamationEqualsToken */,\n        \"===\": 33 /* EqualsEqualsEqualsToken */,\n        \"!==\": 34 /* ExclamationEqualsEqualsToken */,\n        \"=>\": 35 /* EqualsGreaterThanToken */,\n        \"+\": 36 /* PlusToken */,\n        \"-\": 37 /* MinusToken */,\n        \"**\": 39 /* AsteriskAsteriskToken */,\n        \"*\": 38 /* AsteriskToken */,\n        \"/\": 40 /* SlashToken */,\n        \"%\": 41 /* PercentToken */,\n        \"++\": 42 /* PlusPlusToken */,\n        \"--\": 43 /* MinusMinusToken */,\n        \"<<\": 44 /* LessThanLessThanToken */,\n        \"</\": 27 /* LessThanSlashToken */,\n        \">>\": 45 /* GreaterThanGreaterThanToken */,\n        \">>>\": 46 /* GreaterThanGreaterThanGreaterThanToken */,\n        \"&\": 47 /* AmpersandToken */,\n        \"|\": 48 /* BarToken */,\n        \"^\": 49 /* CaretToken */,\n        \"!\": 50 /* ExclamationToken */,\n        \"~\": 51 /* TildeToken */,\n        \"&&\": 52 /* AmpersandAmpersandToken */,\n        \"||\": 53 /* BarBarToken */,\n        \"?\": 54 /* QuestionToken */,\n        \":\": 55 /* ColonToken */,\n        \"=\": 57 /* EqualsToken */,\n        \"+=\": 58 /* PlusEqualsToken */,\n        \"-=\": 59 /* MinusEqualsToken */,\n        \"*=\": 60 /* AsteriskEqualsToken */,\n        \"**=\": 61 /* AsteriskAsteriskEqualsToken */,\n        \"/=\": 62 /* SlashEqualsToken */,\n        \"%=\": 63 /* PercentEqualsToken */,\n        \"<<=\": 64 /* LessThanLessThanEqualsToken */,\n        \">>=\": 65 /* GreaterThanGreaterThanEqualsToken */,\n        \">>>=\": 66 /* GreaterThanGreaterThanGreaterThanEqualsToken */,\n        \"&=\": 67 /* AmpersandEqualsToken */,\n        \"|=\": 68 /* BarEqualsToken */,\n        \"^=\": 69 /* CaretEqualsToken */,\n        \"@\": 56 /* AtToken */,\n    });\n    /*\n        As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers\n        IdentifierStart ::\n            Can contain Unicode 3.0.0  categories:\n            Uppercase letter (Lu),\n            Lowercase letter (Ll),\n            Titlecase letter (Lt),\n            Modifier letter (Lm),\n            Other letter (Lo), or\n            Letter number (Nl).\n        IdentifierPart :: =\n            Can contain IdentifierStart + Unicode 3.0.0  categories:\n            Non-spacing mark (Mn),\n            Combining spacing mark (Mc),\n            Decimal number (Nd), or\n            Connector punctuation (Pc).\n\n        Codepoint ranges for ES3 Identifiers are extracted from the Unicode 3.0.0 specification at:\n        http://www.unicode.org/Public/3.0-Update/UnicodeData-3.0.0.txt\n    */\n    var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];\n    var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];\n    /*\n        As per ECMAScript Language Specification 5th Edition, Section 7.6: ISyntaxToken Names and Identifiers\n        IdentifierStart ::\n            Can contain Unicode 6.2  categories:\n            Uppercase letter (Lu),\n            Lowercase letter (Ll),\n            Titlecase letter (Lt),\n            Modifier letter (Lm),\n            Other letter (Lo), or\n            Letter number (Nl).\n        IdentifierPart ::\n            Can contain IdentifierStart + Unicode 6.2  categories:\n            Non-spacing mark (Mn),\n            Combining spacing mark (Mc),\n            Decimal number (Nd),\n            Connector punctuation (Pc),\n            <ZWNJ>, or\n            <ZWJ>.\n\n        Codepoint ranges for ES5 Identifiers are extracted from the Unicode 6.2 specification at:\n        http://www.unicode.org/Public/6.2.0/ucd/UnicodeData.txt\n    */\n    var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];\n    var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];\n    function lookupInUnicodeMap(code, map) {\n        // Bail out quickly if it couldn't possibly be in the map.\n        if (code < map[0]) {\n            return false;\n        }\n        // Perform binary search in one of the Unicode range maps\n        var lo = 0;\n        var hi = map.length;\n        var mid;\n        while (lo + 1 < hi) {\n            mid = lo + (hi - lo) / 2;\n            // mid has to be even to catch a range's beginning\n            mid -= mid % 2;\n            if (map[mid] <= code && code <= map[mid + 1]) {\n                return true;\n            }\n            if (code < map[mid]) {\n                hi = mid;\n            }\n            else {\n                lo = mid + 2;\n            }\n        }\n        return false;\n    }\n    /* @internal */ function isUnicodeIdentifierStart(code, languageVersion) {\n        return languageVersion >= 1 /* ES5 */ ?\n            lookupInUnicodeMap(code, unicodeES5IdentifierStart) :\n            lookupInUnicodeMap(code, unicodeES3IdentifierStart);\n    }\n    ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart;\n    function isUnicodeIdentifierPart(code, languageVersion) {\n        return languageVersion >= 1 /* ES5 */ ?\n            lookupInUnicodeMap(code, unicodeES5IdentifierPart) :\n            lookupInUnicodeMap(code, unicodeES3IdentifierPart);\n    }\n    function makeReverseMap(source) {\n        var result = [];\n        for (var name_4 in source) {\n            result[source[name_4]] = name_4;\n        }\n        return result;\n    }\n    var tokenStrings = makeReverseMap(textToToken);\n    function tokenToString(t) {\n        return tokenStrings[t];\n    }\n    ts.tokenToString = tokenToString;\n    /* @internal */\n    function stringToToken(s) {\n        return textToToken[s];\n    }\n    ts.stringToToken = stringToToken;\n    /* @internal */\n    function computeLineStarts(text) {\n        var result = new Array();\n        var pos = 0;\n        var lineStart = 0;\n        while (pos < text.length) {\n            var ch = text.charCodeAt(pos);\n            pos++;\n            switch (ch) {\n                case 13 /* carriageReturn */:\n                    if (text.charCodeAt(pos) === 10 /* lineFeed */) {\n                        pos++;\n                    }\n                case 10 /* lineFeed */:\n                    result.push(lineStart);\n                    lineStart = pos;\n                    break;\n                default:\n                    if (ch > 127 /* maxAsciiCharacter */ && isLineBreak(ch)) {\n                        result.push(lineStart);\n                        lineStart = pos;\n                    }\n                    break;\n            }\n        }\n        result.push(lineStart);\n        return result;\n    }\n    ts.computeLineStarts = computeLineStarts;\n    function getPositionOfLineAndCharacter(sourceFile, line, character) {\n        return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character);\n    }\n    ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter;\n    /* @internal */\n    function computePositionOfLineAndCharacter(lineStarts, line, character) {\n        ts.Debug.assert(line >= 0 && line < lineStarts.length);\n        return lineStarts[line] + character;\n    }\n    ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter;\n    /* @internal */\n    function getLineStarts(sourceFile) {\n        return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text));\n    }\n    ts.getLineStarts = getLineStarts;\n    /* @internal */\n    /**\n     * We assume the first line starts at position 0 and 'position' is non-negative.\n     */\n    function computeLineAndCharacterOfPosition(lineStarts, position) {\n        var lineNumber = ts.binarySearch(lineStarts, position);\n        if (lineNumber < 0) {\n            // If the actual position was not found,\n            // the binary search returns the 2's-complement of the next line start\n            // e.g. if the line starts at [5, 10, 23, 80] and the position requested was 20\n            // then the search will return -2.\n            //\n            // We want the index of the previous line start, so we subtract 1.\n            // Review 2's-complement if this is confusing.\n            lineNumber = ~lineNumber - 1;\n            ts.Debug.assert(lineNumber !== -1, \"position cannot precede the beginning of the file\");\n        }\n        return {\n            line: lineNumber,\n            character: position - lineStarts[lineNumber]\n        };\n    }\n    ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition;\n    function getLineAndCharacterOfPosition(sourceFile, position) {\n        return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position);\n    }\n    ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition;\n    var hasOwnProperty = Object.prototype.hasOwnProperty;\n    function isWhiteSpace(ch) {\n        return isWhiteSpaceSingleLine(ch) || isLineBreak(ch);\n    }\n    ts.isWhiteSpace = isWhiteSpace;\n    /** Does not include line breaks. For that, see isWhiteSpaceLike. */\n    function isWhiteSpaceSingleLine(ch) {\n        // Note: nextLine is in the Zs space, and should be considered to be a whitespace.\n        // It is explicitly not a line-break as it isn't in the exact set specified by EcmaScript.\n        return ch === 32 /* space */ ||\n            ch === 9 /* tab */ ||\n            ch === 11 /* verticalTab */ ||\n            ch === 12 /* formFeed */ ||\n            ch === 160 /* nonBreakingSpace */ ||\n            ch === 133 /* nextLine */ ||\n            ch === 5760 /* ogham */ ||\n            ch >= 8192 /* enQuad */ && ch <= 8203 /* zeroWidthSpace */ ||\n            ch === 8239 /* narrowNoBreakSpace */ ||\n            ch === 8287 /* mathematicalSpace */ ||\n            ch === 12288 /* ideographicSpace */ ||\n            ch === 65279 /* byteOrderMark */;\n    }\n    ts.isWhiteSpaceSingleLine = isWhiteSpaceSingleLine;\n    function isLineBreak(ch) {\n        // ES5 7.3:\n        // The ECMAScript line terminator characters are listed in Table 3.\n        //     Table 3: Line Terminator Characters\n        //     Code Unit Value     Name                    Formal Name\n        //     \\u000A              Line Feed               <LF>\n        //     \\u000D              Carriage Return         <CR>\n        //     \\u2028              Line separator          <LS>\n        //     \\u2029              Paragraph separator     <PS>\n        // Only the characters in Table 3 are treated as line terminators. Other new line or line\n        // breaking characters are treated as white space but not as line terminators.\n        return ch === 10 /* lineFeed */ ||\n            ch === 13 /* carriageReturn */ ||\n            ch === 8232 /* lineSeparator */ ||\n            ch === 8233 /* paragraphSeparator */;\n    }\n    ts.isLineBreak = isLineBreak;\n    function isDigit(ch) {\n        return ch >= 48 /* _0 */ && ch <= 57 /* _9 */;\n    }\n    /* @internal */\n    function isOctalDigit(ch) {\n        return ch >= 48 /* _0 */ && ch <= 55 /* _7 */;\n    }\n    ts.isOctalDigit = isOctalDigit;\n    function couldStartTrivia(text, pos) {\n        // Keep in sync with skipTrivia\n        var ch = text.charCodeAt(pos);\n        switch (ch) {\n            case 13 /* carriageReturn */:\n            case 10 /* lineFeed */:\n            case 9 /* tab */:\n            case 11 /* verticalTab */:\n            case 12 /* formFeed */:\n            case 32 /* space */:\n            case 47 /* slash */:\n            // starts of normal trivia\n            case 60 /* lessThan */:\n            case 61 /* equals */:\n            case 62 /* greaterThan */:\n                // Starts of conflict marker trivia\n                return true;\n            case 35 /* hash */:\n                // Only if its the beginning can we have #! trivia\n                return pos === 0;\n            default:\n                return ch > 127 /* maxAsciiCharacter */;\n        }\n    }\n    ts.couldStartTrivia = couldStartTrivia;\n    /* @internal */\n    function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments) {\n        if (stopAtComments === void 0) { stopAtComments = false; }\n        if (ts.positionIsSynthesized(pos)) {\n            return pos;\n        }\n        // Keep in sync with couldStartTrivia\n        while (true) {\n            var ch = text.charCodeAt(pos);\n            switch (ch) {\n                case 13 /* carriageReturn */:\n                    if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {\n                        pos++;\n                    }\n                case 10 /* lineFeed */:\n                    pos++;\n                    if (stopAfterLineBreak) {\n                        return pos;\n                    }\n                    continue;\n                case 9 /* tab */:\n                case 11 /* verticalTab */:\n                case 12 /* formFeed */:\n                case 32 /* space */:\n                    pos++;\n                    continue;\n                case 47 /* slash */:\n                    if (stopAtComments) {\n                        break;\n                    }\n                    if (text.charCodeAt(pos + 1) === 47 /* slash */) {\n                        pos += 2;\n                        while (pos < text.length) {\n                            if (isLineBreak(text.charCodeAt(pos))) {\n                                break;\n                            }\n                            pos++;\n                        }\n                        continue;\n                    }\n                    if (text.charCodeAt(pos + 1) === 42 /* asterisk */) {\n                        pos += 2;\n                        while (pos < text.length) {\n                            if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) {\n                                pos += 2;\n                                break;\n                            }\n                            pos++;\n                        }\n                        continue;\n                    }\n                    break;\n                case 60 /* lessThan */:\n                case 61 /* equals */:\n                case 62 /* greaterThan */:\n                    if (isConflictMarkerTrivia(text, pos)) {\n                        pos = scanConflictMarkerTrivia(text, pos);\n                        continue;\n                    }\n                    break;\n                case 35 /* hash */:\n                    if (pos === 0 && isShebangTrivia(text, pos)) {\n                        pos = scanShebangTrivia(text, pos);\n                        continue;\n                    }\n                    break;\n                default:\n                    if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch))) {\n                        pos++;\n                        continue;\n                    }\n                    break;\n            }\n            return pos;\n        }\n    }\n    ts.skipTrivia = skipTrivia;\n    // All conflict markers consist of the same character repeated seven times.  If it is\n    // a <<<<<<< or >>>>>>> marker then it is also followed by a space.\n    var mergeConflictMarkerLength = \"<<<<<<<\".length;\n    function isConflictMarkerTrivia(text, pos) {\n        ts.Debug.assert(pos >= 0);\n        // Conflict markers must be at the start of a line.\n        if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) {\n            var ch = text.charCodeAt(pos);\n            if ((pos + mergeConflictMarkerLength) < text.length) {\n                for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) {\n                    if (text.charCodeAt(pos + i) !== ch) {\n                        return false;\n                    }\n                }\n                return ch === 61 /* equals */ ||\n                    text.charCodeAt(pos + mergeConflictMarkerLength) === 32 /* space */;\n            }\n        }\n        return false;\n    }\n    function scanConflictMarkerTrivia(text, pos, error) {\n        if (error) {\n            error(ts.Diagnostics.Merge_conflict_marker_encountered, mergeConflictMarkerLength);\n        }\n        var ch = text.charCodeAt(pos);\n        var len = text.length;\n        if (ch === 60 /* lessThan */ || ch === 62 /* greaterThan */) {\n            while (pos < len && !isLineBreak(text.charCodeAt(pos))) {\n                pos++;\n            }\n        }\n        else {\n            ts.Debug.assert(ch === 61 /* equals */);\n            // Consume everything from the start of the mid-conflict marker to the start of the next\n            // end-conflict marker.\n            while (pos < len) {\n                var ch_1 = text.charCodeAt(pos);\n                if (ch_1 === 62 /* greaterThan */ && isConflictMarkerTrivia(text, pos)) {\n                    break;\n                }\n                pos++;\n            }\n        }\n        return pos;\n    }\n    var shebangTriviaRegex = /^#!.*/;\n    function isShebangTrivia(text, pos) {\n        // Shebangs check must only be done at the start of the file\n        ts.Debug.assert(pos === 0);\n        return shebangTriviaRegex.test(text);\n    }\n    function scanShebangTrivia(text, pos) {\n        var shebang = shebangTriviaRegex.exec(text)[0];\n        pos = pos + shebang.length;\n        return pos;\n    }\n    /**\n     * Invokes a callback for each comment range following the provided position.\n     *\n     * Single-line comment ranges include the leading double-slash characters but not the ending\n     * line break. Multi-line comment ranges include the leading slash-asterisk and trailing\n     * asterisk-slash characters.\n     *\n     * @param reduce If true, accumulates the result of calling the callback in a fashion similar\n     *      to reduceLeft. If false, iteration stops when the callback returns a truthy value.\n     * @param text The source text to scan.\n     * @param pos The position at which to start scanning.\n     * @param trailing If false, whitespace is skipped until the first line break and comments\n     *      between that location and the next token are returned. If true, comments occurring\n     *      between the given position and the next line break are returned.\n     * @param cb The callback to execute as each comment range is encountered.\n     * @param state A state value to pass to each iteration of the callback.\n     * @param initial An initial value to pass when accumulating results (when \"reduce\" is true).\n     * @returns If \"reduce\" is true, the accumulated value. If \"reduce\" is false, the first truthy\n     *      return value of the callback.\n     */\n    function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) {\n        var pendingPos;\n        var pendingEnd;\n        var pendingKind;\n        var pendingHasTrailingNewLine;\n        var hasPendingCommentRange = false;\n        var collecting = trailing || pos === 0;\n        var accumulator = initial;\n        scan: while (pos >= 0 && pos < text.length) {\n            var ch = text.charCodeAt(pos);\n            switch (ch) {\n                case 13 /* carriageReturn */:\n                    if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {\n                        pos++;\n                    }\n                case 10 /* lineFeed */:\n                    pos++;\n                    if (trailing) {\n                        break scan;\n                    }\n                    collecting = true;\n                    if (hasPendingCommentRange) {\n                        pendingHasTrailingNewLine = true;\n                    }\n                    continue;\n                case 9 /* tab */:\n                case 11 /* verticalTab */:\n                case 12 /* formFeed */:\n                case 32 /* space */:\n                    pos++;\n                    continue;\n                case 47 /* slash */:\n                    var nextChar = text.charCodeAt(pos + 1);\n                    var hasTrailingNewLine = false;\n                    if (nextChar === 47 /* slash */ || nextChar === 42 /* asterisk */) {\n                        var kind = nextChar === 47 /* slash */ ? 2 /* SingleLineCommentTrivia */ : 3 /* MultiLineCommentTrivia */;\n                        var startPos = pos;\n                        pos += 2;\n                        if (nextChar === 47 /* slash */) {\n                            while (pos < text.length) {\n                                if (isLineBreak(text.charCodeAt(pos))) {\n                                    hasTrailingNewLine = true;\n                                    break;\n                                }\n                                pos++;\n                            }\n                        }\n                        else {\n                            while (pos < text.length) {\n                                if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) {\n                                    pos += 2;\n                                    break;\n                                }\n                                pos++;\n                            }\n                        }\n                        if (collecting) {\n                            if (hasPendingCommentRange) {\n                                accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator);\n                                if (!reduce && accumulator) {\n                                    // If we are not reducing and we have a truthy result, return it.\n                                    return accumulator;\n                                }\n                                hasPendingCommentRange = false;\n                            }\n                            pendingPos = startPos;\n                            pendingEnd = pos;\n                            pendingKind = kind;\n                            pendingHasTrailingNewLine = hasTrailingNewLine;\n                            hasPendingCommentRange = true;\n                        }\n                        continue;\n                    }\n                    break scan;\n                default:\n                    if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch))) {\n                        if (hasPendingCommentRange && isLineBreak(ch)) {\n                            pendingHasTrailingNewLine = true;\n                        }\n                        pos++;\n                        continue;\n                    }\n                    break scan;\n            }\n        }\n        if (hasPendingCommentRange) {\n            accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator);\n        }\n        return accumulator;\n    }\n    function forEachLeadingCommentRange(text, pos, cb, state) {\n        return iterateCommentRanges(/*reduce*/ false, text, pos, /*trailing*/ false, cb, state);\n    }\n    ts.forEachLeadingCommentRange = forEachLeadingCommentRange;\n    function forEachTrailingCommentRange(text, pos, cb, state) {\n        return iterateCommentRanges(/*reduce*/ false, text, pos, /*trailing*/ true, cb, state);\n    }\n    ts.forEachTrailingCommentRange = forEachTrailingCommentRange;\n    function reduceEachLeadingCommentRange(text, pos, cb, state, initial) {\n        return iterateCommentRanges(/*reduce*/ true, text, pos, /*trailing*/ false, cb, state, initial);\n    }\n    ts.reduceEachLeadingCommentRange = reduceEachLeadingCommentRange;\n    function reduceEachTrailingCommentRange(text, pos, cb, state, initial) {\n        return iterateCommentRanges(/*reduce*/ true, text, pos, /*trailing*/ true, cb, state, initial);\n    }\n    ts.reduceEachTrailingCommentRange = reduceEachTrailingCommentRange;\n    function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments) {\n        if (!comments) {\n            comments = [];\n        }\n        comments.push({ pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine, kind: kind });\n        return comments;\n    }\n    function getLeadingCommentRanges(text, pos) {\n        return reduceEachLeadingCommentRange(text, pos, appendCommentRange, undefined, undefined);\n    }\n    ts.getLeadingCommentRanges = getLeadingCommentRanges;\n    function getTrailingCommentRanges(text, pos) {\n        return reduceEachTrailingCommentRange(text, pos, appendCommentRange, undefined, undefined);\n    }\n    ts.getTrailingCommentRanges = getTrailingCommentRanges;\n    /** Optionally, get the shebang */\n    function getShebang(text) {\n        return shebangTriviaRegex.test(text)\n            ? shebangTriviaRegex.exec(text)[0]\n            : undefined;\n    }\n    ts.getShebang = getShebang;\n    function isIdentifierStart(ch, languageVersion) {\n        return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ ||\n            ch === 36 /* $ */ || ch === 95 /* _ */ ||\n            ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion);\n    }\n    ts.isIdentifierStart = isIdentifierStart;\n    function isIdentifierPart(ch, languageVersion) {\n        return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ ||\n            ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ ||\n            ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion);\n    }\n    ts.isIdentifierPart = isIdentifierPart;\n    /* @internal */\n    function isIdentifierText(name, languageVersion) {\n        if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) {\n            return false;\n        }\n        for (var i = 1, n = name.length; i < n; i++) {\n            if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) {\n                return false;\n            }\n        }\n        return true;\n    }\n    ts.isIdentifierText = isIdentifierText;\n    // Creates a scanner over a (possibly unspecified) range of a piece of text.\n    function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) {\n        if (languageVariant === void 0) { languageVariant = 0 /* Standard */; }\n        // Current position (end position of text of current token)\n        var pos;\n        // end of text\n        var end;\n        // Start position of whitespace before current token\n        var startPos;\n        // Start position of text of current token\n        var tokenPos;\n        var token;\n        var tokenValue;\n        var precedingLineBreak;\n        var hasExtendedUnicodeEscape;\n        var tokenIsUnterminated;\n        setText(text, start, length);\n        return {\n            getStartPos: function () { return startPos; },\n            getTextPos: function () { return pos; },\n            getToken: function () { return token; },\n            getTokenPos: function () { return tokenPos; },\n            getTokenText: function () { return text.substring(tokenPos, pos); },\n            getTokenValue: function () { return tokenValue; },\n            hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; },\n            hasPrecedingLineBreak: function () { return precedingLineBreak; },\n            isIdentifier: function () { return token === 70 /* Identifier */ || token > 106 /* LastReservedWord */; },\n            isReservedWord: function () { return token >= 71 /* FirstReservedWord */ && token <= 106 /* LastReservedWord */; },\n            isUnterminated: function () { return tokenIsUnterminated; },\n            reScanGreaterToken: reScanGreaterToken,\n            reScanSlashToken: reScanSlashToken,\n            reScanTemplateToken: reScanTemplateToken,\n            scanJsxIdentifier: scanJsxIdentifier,\n            scanJsxAttributeValue: scanJsxAttributeValue,\n            reScanJsxToken: reScanJsxToken,\n            scanJsxToken: scanJsxToken,\n            scanJSDocToken: scanJSDocToken,\n            scan: scan,\n            getText: getText,\n            setText: setText,\n            setScriptTarget: setScriptTarget,\n            setLanguageVariant: setLanguageVariant,\n            setOnError: setOnError,\n            setTextPos: setTextPos,\n            tryScan: tryScan,\n            lookAhead: lookAhead,\n            scanRange: scanRange,\n        };\n        function error(message, length) {\n            if (onError) {\n                onError(message, length || 0);\n            }\n        }\n        function scanNumber() {\n            var start = pos;\n            while (isDigit(text.charCodeAt(pos)))\n                pos++;\n            if (text.charCodeAt(pos) === 46 /* dot */) {\n                pos++;\n                while (isDigit(text.charCodeAt(pos)))\n                    pos++;\n            }\n            var end = pos;\n            if (text.charCodeAt(pos) === 69 /* E */ || text.charCodeAt(pos) === 101 /* e */) {\n                pos++;\n                if (text.charCodeAt(pos) === 43 /* plus */ || text.charCodeAt(pos) === 45 /* minus */)\n                    pos++;\n                if (isDigit(text.charCodeAt(pos))) {\n                    pos++;\n                    while (isDigit(text.charCodeAt(pos)))\n                        pos++;\n                    end = pos;\n                }\n                else {\n                    error(ts.Diagnostics.Digit_expected);\n                }\n            }\n            return \"\" + +(text.substring(start, end));\n        }\n        function scanOctalDigits() {\n            var start = pos;\n            while (isOctalDigit(text.charCodeAt(pos))) {\n                pos++;\n            }\n            return +(text.substring(start, pos));\n        }\n        /**\n         * Scans the given number of hexadecimal digits in the text,\n         * returning -1 if the given number is unavailable.\n         */\n        function scanExactNumberOfHexDigits(count) {\n            return scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ false);\n        }\n        /**\n         * Scans as many hexadecimal digits as are available in the text,\n         * returning -1 if the given number of digits was unavailable.\n         */\n        function scanMinimumNumberOfHexDigits(count) {\n            return scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ true);\n        }\n        function scanHexDigits(minCount, scanAsManyAsPossible) {\n            var digits = 0;\n            var value = 0;\n            while (digits < minCount || scanAsManyAsPossible) {\n                var ch = text.charCodeAt(pos);\n                if (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) {\n                    value = value * 16 + ch - 48 /* _0 */;\n                }\n                else if (ch >= 65 /* A */ && ch <= 70 /* F */) {\n                    value = value * 16 + ch - 65 /* A */ + 10;\n                }\n                else if (ch >= 97 /* a */ && ch <= 102 /* f */) {\n                    value = value * 16 + ch - 97 /* a */ + 10;\n                }\n                else {\n                    break;\n                }\n                pos++;\n                digits++;\n            }\n            if (digits < minCount) {\n                value = -1;\n            }\n            return value;\n        }\n        function scanString(allowEscapes) {\n            if (allowEscapes === void 0) { allowEscapes = true; }\n            var quote = text.charCodeAt(pos);\n            pos++;\n            var result = \"\";\n            var start = pos;\n            while (true) {\n                if (pos >= end) {\n                    result += text.substring(start, pos);\n                    tokenIsUnterminated = true;\n                    error(ts.Diagnostics.Unterminated_string_literal);\n                    break;\n                }\n                var ch = text.charCodeAt(pos);\n                if (ch === quote) {\n                    result += text.substring(start, pos);\n                    pos++;\n                    break;\n                }\n                if (ch === 92 /* backslash */ && allowEscapes) {\n                    result += text.substring(start, pos);\n                    result += scanEscapeSequence();\n                    start = pos;\n                    continue;\n                }\n                if (isLineBreak(ch)) {\n                    result += text.substring(start, pos);\n                    tokenIsUnterminated = true;\n                    error(ts.Diagnostics.Unterminated_string_literal);\n                    break;\n                }\n                pos++;\n            }\n            return result;\n        }\n        /**\n         * Sets the current 'tokenValue' and returns a NoSubstitutionTemplateLiteral or\n         * a literal component of a TemplateExpression.\n         */\n        function scanTemplateAndSetTokenValue() {\n            var startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */;\n            pos++;\n            var start = pos;\n            var contents = \"\";\n            var resultingToken;\n            while (true) {\n                if (pos >= end) {\n                    contents += text.substring(start, pos);\n                    tokenIsUnterminated = true;\n                    error(ts.Diagnostics.Unterminated_template_literal);\n                    resultingToken = startedWithBacktick ? 12 /* NoSubstitutionTemplateLiteral */ : 15 /* TemplateTail */;\n                    break;\n                }\n                var currChar = text.charCodeAt(pos);\n                // '`'\n                if (currChar === 96 /* backtick */) {\n                    contents += text.substring(start, pos);\n                    pos++;\n                    resultingToken = startedWithBacktick ? 12 /* NoSubstitutionTemplateLiteral */ : 15 /* TemplateTail */;\n                    break;\n                }\n                // '${'\n                if (currChar === 36 /* $ */ && pos + 1 < end && text.charCodeAt(pos + 1) === 123 /* openBrace */) {\n                    contents += text.substring(start, pos);\n                    pos += 2;\n                    resultingToken = startedWithBacktick ? 13 /* TemplateHead */ : 14 /* TemplateMiddle */;\n                    break;\n                }\n                // Escape character\n                if (currChar === 92 /* backslash */) {\n                    contents += text.substring(start, pos);\n                    contents += scanEscapeSequence();\n                    start = pos;\n                    continue;\n                }\n                // Speculated ECMAScript 6 Spec 11.8.6.1:\n                // <CR><LF> and <CR> LineTerminatorSequences are normalized to <LF> for Template Values\n                if (currChar === 13 /* carriageReturn */) {\n                    contents += text.substring(start, pos);\n                    pos++;\n                    if (pos < end && text.charCodeAt(pos) === 10 /* lineFeed */) {\n                        pos++;\n                    }\n                    contents += \"\\n\";\n                    start = pos;\n                    continue;\n                }\n                pos++;\n            }\n            ts.Debug.assert(resultingToken !== undefined);\n            tokenValue = contents;\n            return resultingToken;\n        }\n        function scanEscapeSequence() {\n            pos++;\n            if (pos >= end) {\n                error(ts.Diagnostics.Unexpected_end_of_text);\n                return \"\";\n            }\n            var ch = text.charCodeAt(pos);\n            pos++;\n            switch (ch) {\n                case 48 /* _0 */:\n                    return \"\\0\";\n                case 98 /* b */:\n                    return \"\\b\";\n                case 116 /* t */:\n                    return \"\\t\";\n                case 110 /* n */:\n                    return \"\\n\";\n                case 118 /* v */:\n                    return \"\\v\";\n                case 102 /* f */:\n                    return \"\\f\";\n                case 114 /* r */:\n                    return \"\\r\";\n                case 39 /* singleQuote */:\n                    return \"\\'\";\n                case 34 /* doubleQuote */:\n                    return \"\\\"\";\n                case 117 /* u */:\n                    // '\\u{DDDDDDDD}'\n                    if (pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {\n                        hasExtendedUnicodeEscape = true;\n                        pos++;\n                        return scanExtendedUnicodeEscape();\n                    }\n                    // '\\uDDDD'\n                    return scanHexadecimalEscape(/*numDigits*/ 4);\n                case 120 /* x */:\n                    // '\\xDD'\n                    return scanHexadecimalEscape(/*numDigits*/ 2);\n                // when encountering a LineContinuation (i.e. a backslash and a line terminator sequence),\n                // the line terminator is interpreted to be \"the empty code unit sequence\".\n                case 13 /* carriageReturn */:\n                    if (pos < end && text.charCodeAt(pos) === 10 /* lineFeed */) {\n                        pos++;\n                    }\n                // fall through\n                case 10 /* lineFeed */:\n                case 8232 /* lineSeparator */:\n                case 8233 /* paragraphSeparator */:\n                    return \"\";\n                default:\n                    return String.fromCharCode(ch);\n            }\n        }\n        function scanHexadecimalEscape(numDigits) {\n            var escapedValue = scanExactNumberOfHexDigits(numDigits);\n            if (escapedValue >= 0) {\n                return String.fromCharCode(escapedValue);\n            }\n            else {\n                error(ts.Diagnostics.Hexadecimal_digit_expected);\n                return \"\";\n            }\n        }\n        function scanExtendedUnicodeEscape() {\n            var escapedValue = scanMinimumNumberOfHexDigits(1);\n            var isInvalidExtendedEscape = false;\n            // Validate the value of the digit\n            if (escapedValue < 0) {\n                error(ts.Diagnostics.Hexadecimal_digit_expected);\n                isInvalidExtendedEscape = true;\n            }\n            else if (escapedValue > 0x10FFFF) {\n                error(ts.Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);\n                isInvalidExtendedEscape = true;\n            }\n            if (pos >= end) {\n                error(ts.Diagnostics.Unexpected_end_of_text);\n                isInvalidExtendedEscape = true;\n            }\n            else if (text.charCodeAt(pos) === 125 /* closeBrace */) {\n                // Only swallow the following character up if it's a '}'.\n                pos++;\n            }\n            else {\n                error(ts.Diagnostics.Unterminated_Unicode_escape_sequence);\n                isInvalidExtendedEscape = true;\n            }\n            if (isInvalidExtendedEscape) {\n                return \"\";\n            }\n            return utf16EncodeAsString(escapedValue);\n        }\n        // Derived from the 10.1.1 UTF16Encoding of the ES6 Spec.\n        function utf16EncodeAsString(codePoint) {\n            ts.Debug.assert(0x0 <= codePoint && codePoint <= 0x10FFFF);\n            if (codePoint <= 65535) {\n                return String.fromCharCode(codePoint);\n            }\n            var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 0xD800;\n            var codeUnit2 = ((codePoint - 65536) % 1024) + 0xDC00;\n            return String.fromCharCode(codeUnit1, codeUnit2);\n        }\n        // Current character is known to be a backslash. Check for Unicode escape of the form '\\uXXXX'\n        // and return code point value if valid Unicode escape is found. Otherwise return -1.\n        function peekUnicodeEscape() {\n            if (pos + 5 < end && text.charCodeAt(pos + 1) === 117 /* u */) {\n                var start_1 = pos;\n                pos += 2;\n                var value = scanExactNumberOfHexDigits(4);\n                pos = start_1;\n                return value;\n            }\n            return -1;\n        }\n        function scanIdentifierParts() {\n            var result = \"\";\n            var start = pos;\n            while (pos < end) {\n                var ch = text.charCodeAt(pos);\n                if (isIdentifierPart(ch, languageVersion)) {\n                    pos++;\n                }\n                else if (ch === 92 /* backslash */) {\n                    ch = peekUnicodeEscape();\n                    if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) {\n                        break;\n                    }\n                    result += text.substring(start, pos);\n                    result += String.fromCharCode(ch);\n                    // Valid Unicode escape is always six characters\n                    pos += 6;\n                    start = pos;\n                }\n                else {\n                    break;\n                }\n            }\n            result += text.substring(start, pos);\n            return result;\n        }\n        function getIdentifierToken() {\n            // Reserved words are between 2 and 11 characters long and start with a lowercase letter\n            var len = tokenValue.length;\n            if (len >= 2 && len <= 11) {\n                var ch = tokenValue.charCodeAt(0);\n                if (ch >= 97 /* a */ && ch <= 122 /* z */ && hasOwnProperty.call(textToToken, tokenValue)) {\n                    return token = textToToken[tokenValue];\n                }\n            }\n            return token = 70 /* Identifier */;\n        }\n        function scanBinaryOrOctalDigits(base) {\n            ts.Debug.assert(base === 2 || base === 8, \"Expected either base 2 or base 8\");\n            var value = 0;\n            // For counting number of digits; Valid binaryIntegerLiteral must have at least one binary digit following B or b.\n            // Similarly valid octalIntegerLiteral must have at least one octal digit following o or O.\n            var numberOfDigits = 0;\n            while (true) {\n                var ch = text.charCodeAt(pos);\n                var valueOfCh = ch - 48 /* _0 */;\n                if (!isDigit(ch) || valueOfCh >= base) {\n                    break;\n                }\n                value = value * base + valueOfCh;\n                pos++;\n                numberOfDigits++;\n            }\n            // Invalid binaryIntegerLiteral or octalIntegerLiteral\n            if (numberOfDigits === 0) {\n                return -1;\n            }\n            return value;\n        }\n        function scan() {\n            startPos = pos;\n            hasExtendedUnicodeEscape = false;\n            precedingLineBreak = false;\n            tokenIsUnterminated = false;\n            while (true) {\n                tokenPos = pos;\n                if (pos >= end) {\n                    return token = 1 /* EndOfFileToken */;\n                }\n                var ch = text.charCodeAt(pos);\n                // Special handling for shebang\n                if (ch === 35 /* hash */ && pos === 0 && isShebangTrivia(text, pos)) {\n                    pos = scanShebangTrivia(text, pos);\n                    if (skipTrivia) {\n                        continue;\n                    }\n                    else {\n                        return token = 6 /* ShebangTrivia */;\n                    }\n                }\n                switch (ch) {\n                    case 10 /* lineFeed */:\n                    case 13 /* carriageReturn */:\n                        precedingLineBreak = true;\n                        if (skipTrivia) {\n                            pos++;\n                            continue;\n                        }\n                        else {\n                            if (ch === 13 /* carriageReturn */ && pos + 1 < end && text.charCodeAt(pos + 1) === 10 /* lineFeed */) {\n                                // consume both CR and LF\n                                pos += 2;\n                            }\n                            else {\n                                pos++;\n                            }\n                            return token = 4 /* NewLineTrivia */;\n                        }\n                    case 9 /* tab */:\n                    case 11 /* verticalTab */:\n                    case 12 /* formFeed */:\n                    case 32 /* space */:\n                        if (skipTrivia) {\n                            pos++;\n                            continue;\n                        }\n                        else {\n                            while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) {\n                                pos++;\n                            }\n                            return token = 5 /* WhitespaceTrivia */;\n                        }\n                    case 33 /* exclamation */:\n                        if (text.charCodeAt(pos + 1) === 61 /* equals */) {\n                            if (text.charCodeAt(pos + 2) === 61 /* equals */) {\n                                return pos += 3, token = 34 /* ExclamationEqualsEqualsToken */;\n                            }\n                            return pos += 2, token = 32 /* ExclamationEqualsToken */;\n                        }\n                        pos++;\n                        return token = 50 /* ExclamationToken */;\n                    case 34 /* doubleQuote */:\n                    case 39 /* singleQuote */:\n                        tokenValue = scanString();\n                        return token = 9 /* StringLiteral */;\n                    case 96 /* backtick */:\n                        return token = scanTemplateAndSetTokenValue();\n                    case 37 /* percent */:\n                        if (text.charCodeAt(pos + 1) === 61 /* equals */) {\n                            return pos += 2, token = 63 /* PercentEqualsToken */;\n                        }\n                        pos++;\n                        return token = 41 /* PercentToken */;\n                    case 38 /* ampersand */:\n                        if (text.charCodeAt(pos + 1) === 38 /* ampersand */) {\n                            return pos += 2, token = 52 /* AmpersandAmpersandToken */;\n                        }\n                        if (text.charCodeAt(pos + 1) === 61 /* equals */) {\n                            return pos += 2, token = 67 /* AmpersandEqualsToken */;\n                        }\n                        pos++;\n                        return token = 47 /* AmpersandToken */;\n                    case 40 /* openParen */:\n                        pos++;\n                        return token = 18 /* OpenParenToken */;\n                    case 41 /* closeParen */:\n                        pos++;\n                        return token = 19 /* CloseParenToken */;\n                    case 42 /* asterisk */:\n                        if (text.charCodeAt(pos + 1) === 61 /* equals */) {\n                            return pos += 2, token = 60 /* AsteriskEqualsToken */;\n                        }\n                        if (text.charCodeAt(pos + 1) === 42 /* asterisk */) {\n                            if (text.charCodeAt(pos + 2) === 61 /* equals */) {\n                                return pos += 3, token = 61 /* AsteriskAsteriskEqualsToken */;\n                            }\n                            return pos += 2, token = 39 /* AsteriskAsteriskToken */;\n                        }\n                        pos++;\n                        return token = 38 /* AsteriskToken */;\n                    case 43 /* plus */:\n                        if (text.charCodeAt(pos + 1) === 43 /* plus */) {\n                            return pos += 2, token = 42 /* PlusPlusToken */;\n                        }\n                        if (text.charCodeAt(pos + 1) === 61 /* equals */) {\n                            return pos += 2, token = 58 /* PlusEqualsToken */;\n                        }\n                        pos++;\n                        return token = 36 /* PlusToken */;\n                    case 44 /* comma */:\n                        pos++;\n                        return token = 25 /* CommaToken */;\n                    case 45 /* minus */:\n                        if (text.charCodeAt(pos + 1) === 45 /* minus */) {\n                            return pos += 2, token = 43 /* MinusMinusToken */;\n                        }\n                        if (text.charCodeAt(pos + 1) === 61 /* equals */) {\n                            return pos += 2, token = 59 /* MinusEqualsToken */;\n                        }\n                        pos++;\n                        return token = 37 /* MinusToken */;\n                    case 46 /* dot */:\n                        if (isDigit(text.charCodeAt(pos + 1))) {\n                            tokenValue = scanNumber();\n                            return token = 8 /* NumericLiteral */;\n                        }\n                        if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) {\n                            return pos += 3, token = 23 /* DotDotDotToken */;\n                        }\n                        pos++;\n                        return token = 22 /* DotToken */;\n                    case 47 /* slash */:\n                        // Single-line comment\n                        if (text.charCodeAt(pos + 1) === 47 /* slash */) {\n                            pos += 2;\n                            while (pos < end) {\n                                if (isLineBreak(text.charCodeAt(pos))) {\n                                    break;\n                                }\n                                pos++;\n                            }\n                            if (skipTrivia) {\n                                continue;\n                            }\n                            else {\n                                return token = 2 /* SingleLineCommentTrivia */;\n                            }\n                        }\n                        // Multi-line comment\n                        if (text.charCodeAt(pos + 1) === 42 /* asterisk */) {\n                            pos += 2;\n                            var commentClosed = false;\n                            while (pos < end) {\n                                var ch_2 = text.charCodeAt(pos);\n                                if (ch_2 === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) {\n                                    pos += 2;\n                                    commentClosed = true;\n                                    break;\n                                }\n                                if (isLineBreak(ch_2)) {\n                                    precedingLineBreak = true;\n                                }\n                                pos++;\n                            }\n                            if (!commentClosed) {\n                                error(ts.Diagnostics.Asterisk_Slash_expected);\n                            }\n                            if (skipTrivia) {\n                                continue;\n                            }\n                            else {\n                                tokenIsUnterminated = !commentClosed;\n                                return token = 3 /* MultiLineCommentTrivia */;\n                            }\n                        }\n                        if (text.charCodeAt(pos + 1) === 61 /* equals */) {\n                            return pos += 2, token = 62 /* SlashEqualsToken */;\n                        }\n                        pos++;\n                        return token = 40 /* SlashToken */;\n                    case 48 /* _0 */:\n                        if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) {\n                            pos += 2;\n                            var value = scanMinimumNumberOfHexDigits(1);\n                            if (value < 0) {\n                                error(ts.Diagnostics.Hexadecimal_digit_expected);\n                                value = 0;\n                            }\n                            tokenValue = \"\" + value;\n                            return token = 8 /* NumericLiteral */;\n                        }\n                        else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 /* B */ || text.charCodeAt(pos + 1) === 98 /* b */)) {\n                            pos += 2;\n                            var value = scanBinaryOrOctalDigits(/* base */ 2);\n                            if (value < 0) {\n                                error(ts.Diagnostics.Binary_digit_expected);\n                                value = 0;\n                            }\n                            tokenValue = \"\" + value;\n                            return token = 8 /* NumericLiteral */;\n                        }\n                        else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 /* O */ || text.charCodeAt(pos + 1) === 111 /* o */)) {\n                            pos += 2;\n                            var value = scanBinaryOrOctalDigits(/* base */ 8);\n                            if (value < 0) {\n                                error(ts.Diagnostics.Octal_digit_expected);\n                                value = 0;\n                            }\n                            tokenValue = \"\" + value;\n                            return token = 8 /* NumericLiteral */;\n                        }\n                        // Try to parse as an octal\n                        if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) {\n                            tokenValue = \"\" + scanOctalDigits();\n                            return token = 8 /* NumericLiteral */;\n                        }\n                    // This fall-through is a deviation from the EcmaScript grammar. The grammar says that a leading zero\n                    // can only be followed by an octal digit, a dot, or the end of the number literal. However, we are being\n                    // permissive and allowing decimal digits of the form 08* and 09* (which many browsers also do).\n                    case 49 /* _1 */:\n                    case 50 /* _2 */:\n                    case 51 /* _3 */:\n                    case 52 /* _4 */:\n                    case 53 /* _5 */:\n                    case 54 /* _6 */:\n                    case 55 /* _7 */:\n                    case 56 /* _8 */:\n                    case 57 /* _9 */:\n                        tokenValue = scanNumber();\n                        return token = 8 /* NumericLiteral */;\n                    case 58 /* colon */:\n                        pos++;\n                        return token = 55 /* ColonToken */;\n                    case 59 /* semicolon */:\n                        pos++;\n                        return token = 24 /* SemicolonToken */;\n                    case 60 /* lessThan */:\n                        if (isConflictMarkerTrivia(text, pos)) {\n                            pos = scanConflictMarkerTrivia(text, pos, error);\n                            if (skipTrivia) {\n                                continue;\n                            }\n                            else {\n                                return token = 7 /* ConflictMarkerTrivia */;\n                            }\n                        }\n                        if (text.charCodeAt(pos + 1) === 60 /* lessThan */) {\n                            if (text.charCodeAt(pos + 2) === 61 /* equals */) {\n                                return pos += 3, token = 64 /* LessThanLessThanEqualsToken */;\n                            }\n                            return pos += 2, token = 44 /* LessThanLessThanToken */;\n                        }\n                        if (text.charCodeAt(pos + 1) === 61 /* equals */) {\n                            return pos += 2, token = 29 /* LessThanEqualsToken */;\n                        }\n                        if (languageVariant === 1 /* JSX */ &&\n                            text.charCodeAt(pos + 1) === 47 /* slash */ &&\n                            text.charCodeAt(pos + 2) !== 42 /* asterisk */) {\n                            return pos += 2, token = 27 /* LessThanSlashToken */;\n                        }\n                        pos++;\n                        return token = 26 /* LessThanToken */;\n                    case 61 /* equals */:\n                        if (isConflictMarkerTrivia(text, pos)) {\n                            pos = scanConflictMarkerTrivia(text, pos, error);\n                            if (skipTrivia) {\n                                continue;\n                            }\n                            else {\n                                return token = 7 /* ConflictMarkerTrivia */;\n                            }\n                        }\n                        if (text.charCodeAt(pos + 1) === 61 /* equals */) {\n                            if (text.charCodeAt(pos + 2) === 61 /* equals */) {\n                                return pos += 3, token = 33 /* EqualsEqualsEqualsToken */;\n                            }\n                            return pos += 2, token = 31 /* EqualsEqualsToken */;\n                        }\n                        if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) {\n                            return pos += 2, token = 35 /* EqualsGreaterThanToken */;\n                        }\n                        pos++;\n                        return token = 57 /* EqualsToken */;\n                    case 62 /* greaterThan */:\n                        if (isConflictMarkerTrivia(text, pos)) {\n                            pos = scanConflictMarkerTrivia(text, pos, error);\n                            if (skipTrivia) {\n                                continue;\n                            }\n                            else {\n                                return token = 7 /* ConflictMarkerTrivia */;\n                            }\n                        }\n                        pos++;\n                        return token = 28 /* GreaterThanToken */;\n                    case 63 /* question */:\n                        pos++;\n                        return token = 54 /* QuestionToken */;\n                    case 91 /* openBracket */:\n                        pos++;\n                        return token = 20 /* OpenBracketToken */;\n                    case 93 /* closeBracket */:\n                        pos++;\n                        return token = 21 /* CloseBracketToken */;\n                    case 94 /* caret */:\n                        if (text.charCodeAt(pos + 1) === 61 /* equals */) {\n                            return pos += 2, token = 69 /* CaretEqualsToken */;\n                        }\n                        pos++;\n                        return token = 49 /* CaretToken */;\n                    case 123 /* openBrace */:\n                        pos++;\n                        return token = 16 /* OpenBraceToken */;\n                    case 124 /* bar */:\n                        if (text.charCodeAt(pos + 1) === 124 /* bar */) {\n                            return pos += 2, token = 53 /* BarBarToken */;\n                        }\n                        if (text.charCodeAt(pos + 1) === 61 /* equals */) {\n                            return pos += 2, token = 68 /* BarEqualsToken */;\n                        }\n                        pos++;\n                        return token = 48 /* BarToken */;\n                    case 125 /* closeBrace */:\n                        pos++;\n                        return token = 17 /* CloseBraceToken */;\n                    case 126 /* tilde */:\n                        pos++;\n                        return token = 51 /* TildeToken */;\n                    case 64 /* at */:\n                        pos++;\n                        return token = 56 /* AtToken */;\n                    case 92 /* backslash */:\n                        var cookedChar = peekUnicodeEscape();\n                        if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {\n                            pos += 6;\n                            tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();\n                            return token = getIdentifierToken();\n                        }\n                        error(ts.Diagnostics.Invalid_character);\n                        pos++;\n                        return token = 0 /* Unknown */;\n                    default:\n                        if (isIdentifierStart(ch, languageVersion)) {\n                            pos++;\n                            while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion))\n                                pos++;\n                            tokenValue = text.substring(tokenPos, pos);\n                            if (ch === 92 /* backslash */) {\n                                tokenValue += scanIdentifierParts();\n                            }\n                            return token = getIdentifierToken();\n                        }\n                        else if (isWhiteSpaceSingleLine(ch)) {\n                            pos++;\n                            continue;\n                        }\n                        else if (isLineBreak(ch)) {\n                            precedingLineBreak = true;\n                            pos++;\n                            continue;\n                        }\n                        error(ts.Diagnostics.Invalid_character);\n                        pos++;\n                        return token = 0 /* Unknown */;\n                }\n            }\n        }\n        function reScanGreaterToken() {\n            if (token === 28 /* GreaterThanToken */) {\n                if (text.charCodeAt(pos) === 62 /* greaterThan */) {\n                    if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) {\n                        if (text.charCodeAt(pos + 2) === 61 /* equals */) {\n                            return pos += 3, token = 66 /* GreaterThanGreaterThanGreaterThanEqualsToken */;\n                        }\n                        return pos += 2, token = 46 /* GreaterThanGreaterThanGreaterThanToken */;\n                    }\n                    if (text.charCodeAt(pos + 1) === 61 /* equals */) {\n                        return pos += 2, token = 65 /* GreaterThanGreaterThanEqualsToken */;\n                    }\n                    pos++;\n                    return token = 45 /* GreaterThanGreaterThanToken */;\n                }\n                if (text.charCodeAt(pos) === 61 /* equals */) {\n                    pos++;\n                    return token = 30 /* GreaterThanEqualsToken */;\n                }\n            }\n            return token;\n        }\n        function reScanSlashToken() {\n            if (token === 40 /* SlashToken */ || token === 62 /* SlashEqualsToken */) {\n                var p = tokenPos + 1;\n                var inEscape = false;\n                var inCharacterClass = false;\n                while (true) {\n                    // If we reach the end of a file, or hit a newline, then this is an unterminated\n                    // regex.  Report error and return what we have so far.\n                    if (p >= end) {\n                        tokenIsUnterminated = true;\n                        error(ts.Diagnostics.Unterminated_regular_expression_literal);\n                        break;\n                    }\n                    var ch = text.charCodeAt(p);\n                    if (isLineBreak(ch)) {\n                        tokenIsUnterminated = true;\n                        error(ts.Diagnostics.Unterminated_regular_expression_literal);\n                        break;\n                    }\n                    if (inEscape) {\n                        // Parsing an escape character;\n                        // reset the flag and just advance to the next char.\n                        inEscape = false;\n                    }\n                    else if (ch === 47 /* slash */ && !inCharacterClass) {\n                        // A slash within a character class is permissible,\n                        // but in general it signals the end of the regexp literal.\n                        p++;\n                        break;\n                    }\n                    else if (ch === 91 /* openBracket */) {\n                        inCharacterClass = true;\n                    }\n                    else if (ch === 92 /* backslash */) {\n                        inEscape = true;\n                    }\n                    else if (ch === 93 /* closeBracket */) {\n                        inCharacterClass = false;\n                    }\n                    p++;\n                }\n                while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) {\n                    p++;\n                }\n                pos = p;\n                tokenValue = text.substring(tokenPos, pos);\n                token = 11 /* RegularExpressionLiteral */;\n            }\n            return token;\n        }\n        /**\n         * Unconditionally back up and scan a template expression portion.\n         */\n        function reScanTemplateToken() {\n            ts.Debug.assert(token === 17 /* CloseBraceToken */, \"'reScanTemplateToken' should only be called on a '}'\");\n            pos = tokenPos;\n            return token = scanTemplateAndSetTokenValue();\n        }\n        function reScanJsxToken() {\n            pos = tokenPos = startPos;\n            return token = scanJsxToken();\n        }\n        function scanJsxToken() {\n            startPos = tokenPos = pos;\n            if (pos >= end) {\n                return token = 1 /* EndOfFileToken */;\n            }\n            var char = text.charCodeAt(pos);\n            if (char === 60 /* lessThan */) {\n                if (text.charCodeAt(pos + 1) === 47 /* slash */) {\n                    pos += 2;\n                    return token = 27 /* LessThanSlashToken */;\n                }\n                pos++;\n                return token = 26 /* LessThanToken */;\n            }\n            if (char === 123 /* openBrace */) {\n                pos++;\n                return token = 16 /* OpenBraceToken */;\n            }\n            while (pos < end) {\n                pos++;\n                char = text.charCodeAt(pos);\n                if ((char === 123 /* openBrace */) || (char === 60 /* lessThan */)) {\n                    break;\n                }\n            }\n            return token = 10 /* JsxText */;\n        }\n        // Scans a JSX identifier; these differ from normal identifiers in that\n        // they allow dashes\n        function scanJsxIdentifier() {\n            if (tokenIsIdentifierOrKeyword(token)) {\n                var firstCharPosition = pos;\n                while (pos < end) {\n                    var ch = text.charCodeAt(pos);\n                    if (ch === 45 /* minus */ || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {\n                        pos++;\n                    }\n                    else {\n                        break;\n                    }\n                }\n                tokenValue += text.substr(firstCharPosition, pos - firstCharPosition);\n            }\n            return token;\n        }\n        function scanJsxAttributeValue() {\n            startPos = pos;\n            switch (text.charCodeAt(pos)) {\n                case 34 /* doubleQuote */:\n                case 39 /* singleQuote */:\n                    tokenValue = scanString(/*allowEscapes*/ false);\n                    return token = 9 /* StringLiteral */;\n                default:\n                    // If this scans anything other than `{`, it's a parse error.\n                    return scan();\n            }\n        }\n        function scanJSDocToken() {\n            if (pos >= end) {\n                return token = 1 /* EndOfFileToken */;\n            }\n            startPos = pos;\n            tokenPos = pos;\n            var ch = text.charCodeAt(pos);\n            switch (ch) {\n                case 9 /* tab */:\n                case 11 /* verticalTab */:\n                case 12 /* formFeed */:\n                case 32 /* space */:\n                    while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) {\n                        pos++;\n                    }\n                    return token = 5 /* WhitespaceTrivia */;\n                case 64 /* at */:\n                    pos++;\n                    return token = 56 /* AtToken */;\n                case 10 /* lineFeed */:\n                case 13 /* carriageReturn */:\n                    pos++;\n                    return token = 4 /* NewLineTrivia */;\n                case 42 /* asterisk */:\n                    pos++;\n                    return token = 38 /* AsteriskToken */;\n                case 123 /* openBrace */:\n                    pos++;\n                    return token = 16 /* OpenBraceToken */;\n                case 125 /* closeBrace */:\n                    pos++;\n                    return token = 17 /* CloseBraceToken */;\n                case 91 /* openBracket */:\n                    pos++;\n                    return token = 20 /* OpenBracketToken */;\n                case 93 /* closeBracket */:\n                    pos++;\n                    return token = 21 /* CloseBracketToken */;\n                case 61 /* equals */:\n                    pos++;\n                    return token = 57 /* EqualsToken */;\n                case 44 /* comma */:\n                    pos++;\n                    return token = 25 /* CommaToken */;\n                case 46 /* dot */:\n                    pos++;\n                    return token = 22 /* DotToken */;\n            }\n            if (isIdentifierStart(ch, 5 /* Latest */)) {\n                pos++;\n                while (isIdentifierPart(text.charCodeAt(pos), 5 /* Latest */) && pos < end) {\n                    pos++;\n                }\n                return token = 70 /* Identifier */;\n            }\n            else {\n                return pos += 1, token = 0 /* Unknown */;\n            }\n        }\n        function speculationHelper(callback, isLookahead) {\n            var savePos = pos;\n            var saveStartPos = startPos;\n            var saveTokenPos = tokenPos;\n            var saveToken = token;\n            var saveTokenValue = tokenValue;\n            var savePrecedingLineBreak = precedingLineBreak;\n            var result = callback();\n            // If our callback returned something 'falsy' or we're just looking ahead,\n            // then unconditionally restore us to where we were.\n            if (!result || isLookahead) {\n                pos = savePos;\n                startPos = saveStartPos;\n                tokenPos = saveTokenPos;\n                token = saveToken;\n                tokenValue = saveTokenValue;\n                precedingLineBreak = savePrecedingLineBreak;\n            }\n            return result;\n        }\n        function scanRange(start, length, callback) {\n            var saveEnd = end;\n            var savePos = pos;\n            var saveStartPos = startPos;\n            var saveTokenPos = tokenPos;\n            var saveToken = token;\n            var savePrecedingLineBreak = precedingLineBreak;\n            var saveTokenValue = tokenValue;\n            var saveHasExtendedUnicodeEscape = hasExtendedUnicodeEscape;\n            var saveTokenIsUnterminated = tokenIsUnterminated;\n            setText(text, start, length);\n            var result = callback();\n            end = saveEnd;\n            pos = savePos;\n            startPos = saveStartPos;\n            tokenPos = saveTokenPos;\n            token = saveToken;\n            precedingLineBreak = savePrecedingLineBreak;\n            tokenValue = saveTokenValue;\n            hasExtendedUnicodeEscape = saveHasExtendedUnicodeEscape;\n            tokenIsUnterminated = saveTokenIsUnterminated;\n            return result;\n        }\n        function lookAhead(callback) {\n            return speculationHelper(callback, /*isLookahead*/ true);\n        }\n        function tryScan(callback) {\n            return speculationHelper(callback, /*isLookahead*/ false);\n        }\n        function getText() {\n            return text;\n        }\n        function setText(newText, start, length) {\n            text = newText || \"\";\n            end = length === undefined ? text.length : start + length;\n            setTextPos(start || 0);\n        }\n        function setOnError(errorCallback) {\n            onError = errorCallback;\n        }\n        function setScriptTarget(scriptTarget) {\n            languageVersion = scriptTarget;\n        }\n        function setLanguageVariant(variant) {\n            languageVariant = variant;\n        }\n        function setTextPos(textPos) {\n            ts.Debug.assert(textPos >= 0);\n            pos = textPos;\n            startPos = textPos;\n            tokenPos = textPos;\n            token = 0 /* Unknown */;\n            precedingLineBreak = false;\n            tokenValue = undefined;\n            hasExtendedUnicodeEscape = false;\n            tokenIsUnterminated = false;\n        }\n    }\n    ts.createScanner = createScanner;\n})(ts || (ts = {}));\n/// <reference path=\"sys.ts\" />\n/* @internal */\nvar ts;\n(function (ts) {\n    ts.externalHelpersModuleNameText = \"tslib\";\n    function getDeclarationOfKind(symbol, kind) {\n        var declarations = symbol.declarations;\n        if (declarations) {\n            for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) {\n                var declaration = declarations_1[_i];\n                if (declaration.kind === kind) {\n                    return declaration;\n                }\n            }\n        }\n        return undefined;\n    }\n    ts.getDeclarationOfKind = getDeclarationOfKind;\n    // Pool writers to avoid needing to allocate them for every symbol we write.\n    var stringWriters = [];\n    function getSingleLineStringWriter() {\n        if (stringWriters.length === 0) {\n            var str_1 = \"\";\n            var writeText = function (text) { return str_1 += text; };\n            return {\n                string: function () { return str_1; },\n                writeKeyword: writeText,\n                writeOperator: writeText,\n                writePunctuation: writeText,\n                writeSpace: writeText,\n                writeStringLiteral: writeText,\n                writeParameter: writeText,\n                writeSymbol: writeText,\n                // Completely ignore indentation for string writers.  And map newlines to\n                // a single space.\n                writeLine: function () { return str_1 += \" \"; },\n                increaseIndent: ts.noop,\n                decreaseIndent: ts.noop,\n                clear: function () { return str_1 = \"\"; },\n                trackSymbol: ts.noop,\n                reportInaccessibleThisError: ts.noop\n            };\n        }\n        return stringWriters.pop();\n    }\n    ts.getSingleLineStringWriter = getSingleLineStringWriter;\n    function releaseStringWriter(writer) {\n        writer.clear();\n        stringWriters.push(writer);\n    }\n    ts.releaseStringWriter = releaseStringWriter;\n    function getFullWidth(node) {\n        return node.end - node.pos;\n    }\n    ts.getFullWidth = getFullWidth;\n    function hasResolvedModule(sourceFile, moduleNameText) {\n        return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]);\n    }\n    ts.hasResolvedModule = hasResolvedModule;\n    function getResolvedModule(sourceFile, moduleNameText) {\n        return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;\n    }\n    ts.getResolvedModule = getResolvedModule;\n    function setResolvedModule(sourceFile, moduleNameText, resolvedModule) {\n        if (!sourceFile.resolvedModules) {\n            sourceFile.resolvedModules = ts.createMap();\n        }\n        sourceFile.resolvedModules[moduleNameText] = resolvedModule;\n    }\n    ts.setResolvedModule = setResolvedModule;\n    function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) {\n        if (!sourceFile.resolvedTypeReferenceDirectiveNames) {\n            sourceFile.resolvedTypeReferenceDirectiveNames = ts.createMap();\n        }\n        sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective;\n    }\n    ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;\n    /* @internal */\n    function moduleResolutionIsEqualTo(oldResolution, newResolution) {\n        return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport &&\n            oldResolution.extension === newResolution.extension &&\n            oldResolution.resolvedFileName === newResolution.resolvedFileName;\n    }\n    ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo;\n    /* @internal */\n    function typeDirectiveIsEqualTo(oldResolution, newResolution) {\n        return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary;\n    }\n    ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo;\n    /* @internal */\n    function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) {\n        if (names.length !== newResolutions.length) {\n            return false;\n        }\n        for (var i = 0; i < names.length; i++) {\n            var newResolution = newResolutions[i];\n            var oldResolution = oldResolutions && oldResolutions[names[i]];\n            var changed = oldResolution\n                ? !newResolution || !comparer(oldResolution, newResolution)\n                : newResolution;\n            if (changed) {\n                return true;\n            }\n        }\n        return false;\n    }\n    ts.hasChangesInResolutions = hasChangesInResolutions;\n    // Returns true if this node contains a parse error anywhere underneath it.\n    function containsParseError(node) {\n        aggregateChildData(node);\n        return (node.flags & 131072 /* ThisNodeOrAnySubNodesHasError */) !== 0;\n    }\n    ts.containsParseError = containsParseError;\n    function aggregateChildData(node) {\n        if (!(node.flags & 262144 /* HasAggregatedChildData */)) {\n            // A node is considered to contain a parse error if:\n            //  a) the parser explicitly marked that it had an error\n            //  b) any of it's children reported that it had an error.\n            var thisNodeOrAnySubNodesHasError = ((node.flags & 32768 /* ThisNodeHasError */) !== 0) ||\n                ts.forEachChild(node, containsParseError);\n            // If so, mark ourselves accordingly.\n            if (thisNodeOrAnySubNodesHasError) {\n                node.flags |= 131072 /* ThisNodeOrAnySubNodesHasError */;\n            }\n            // Also mark that we've propagated the child information to this node.  This way we can\n            // always consult the bit directly on this node without needing to check its children\n            // again.\n            node.flags |= 262144 /* HasAggregatedChildData */;\n        }\n    }\n    function getSourceFileOfNode(node) {\n        while (node && node.kind !== 261 /* SourceFile */) {\n            node = node.parent;\n        }\n        return node;\n    }\n    ts.getSourceFileOfNode = getSourceFileOfNode;\n    function isStatementWithLocals(node) {\n        switch (node.kind) {\n            case 204 /* Block */:\n            case 232 /* CaseBlock */:\n            case 211 /* ForStatement */:\n            case 212 /* ForInStatement */:\n            case 213 /* ForOfStatement */:\n                return true;\n        }\n        return false;\n    }\n    ts.isStatementWithLocals = isStatementWithLocals;\n    function getStartPositionOfLine(line, sourceFile) {\n        ts.Debug.assert(line >= 0);\n        return ts.getLineStarts(sourceFile)[line];\n    }\n    ts.getStartPositionOfLine = getStartPositionOfLine;\n    // This is a useful function for debugging purposes.\n    function nodePosToString(node) {\n        var file = getSourceFileOfNode(node);\n        var loc = ts.getLineAndCharacterOfPosition(file, node.pos);\n        return file.fileName + \"(\" + (loc.line + 1) + \",\" + (loc.character + 1) + \")\";\n    }\n    ts.nodePosToString = nodePosToString;\n    function getStartPosOfNode(node) {\n        return node.pos;\n    }\n    ts.getStartPosOfNode = getStartPosOfNode;\n    function isDefined(value) {\n        return value !== undefined;\n    }\n    ts.isDefined = isDefined;\n    function getEndLinePosition(line, sourceFile) {\n        ts.Debug.assert(line >= 0);\n        var lineStarts = ts.getLineStarts(sourceFile);\n        var lineIndex = line;\n        var sourceText = sourceFile.text;\n        if (lineIndex + 1 === lineStarts.length) {\n            // last line - return EOF\n            return sourceText.length - 1;\n        }\n        else {\n            // current line start\n            var start = lineStarts[lineIndex];\n            // take the start position of the next line - 1 = it should be some line break\n            var pos = lineStarts[lineIndex + 1] - 1;\n            ts.Debug.assert(ts.isLineBreak(sourceText.charCodeAt(pos)));\n            // walk backwards skipping line breaks, stop the the beginning of current line.\n            // i.e:\n            // <some text>\n            // $ <- end of line for this position should match the start position\n            while (start <= pos && ts.isLineBreak(sourceText.charCodeAt(pos))) {\n                pos--;\n            }\n            return pos;\n        }\n    }\n    ts.getEndLinePosition = getEndLinePosition;\n    // Returns true if this node is missing from the actual source code. A 'missing' node is different\n    // from 'undefined/defined'. When a node is undefined (which can happen for optional nodes\n    // in the tree), it is definitely missing. However, a node may be defined, but still be\n    // missing.  This happens whenever the parser knows it needs to parse something, but can't\n    // get anything in the source code that it expects at that location. For example:\n    //\n    //          let a: ;\n    //\n    // Here, the Type in the Type-Annotation is not-optional (as there is a colon in the source\n    // code). So the parser will attempt to parse out a type, and will create an actual node.\n    // However, this node will be 'missing' in the sense that no actual source-code/tokens are\n    // contained within it.\n    function nodeIsMissing(node) {\n        if (node === undefined) {\n            return true;\n        }\n        return node.pos === node.end && node.pos >= 0 && node.kind !== 1 /* EndOfFileToken */;\n    }\n    ts.nodeIsMissing = nodeIsMissing;\n    function nodeIsPresent(node) {\n        return !nodeIsMissing(node);\n    }\n    ts.nodeIsPresent = nodeIsPresent;\n    function getTokenPosOfNode(node, sourceFile, includeJsDoc) {\n        // With nodes that have no width (i.e. 'Missing' nodes), we actually *don't*\n        // want to skip trivia because this will launch us forward to the next token.\n        if (nodeIsMissing(node)) {\n            return node.pos;\n        }\n        if (isJSDocNode(node)) {\n            return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, /*stopAfterLineBreak*/ false, /*stopAtComments*/ true);\n        }\n        if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) {\n            return getTokenPosOfNode(node.jsDoc[0]);\n        }\n        // For a syntax list, it is possible that one of its children has JSDocComment nodes, while\n        // the syntax list itself considers them as normal trivia. Therefore if we simply skip\n        // trivia for the list, we may have skipped the JSDocComment as well. So we should process its\n        // first child to determine the actual position of its first token.\n        if (node.kind === 292 /* SyntaxList */ && node._children.length > 0) {\n            return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);\n        }\n        return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);\n    }\n    ts.getTokenPosOfNode = getTokenPosOfNode;\n    function isJSDocNode(node) {\n        return node.kind >= 262 /* FirstJSDocNode */ && node.kind <= 288 /* LastJSDocNode */;\n    }\n    ts.isJSDocNode = isJSDocNode;\n    function isJSDocTag(node) {\n        return node.kind >= 278 /* FirstJSDocTagNode */ && node.kind <= 291 /* LastJSDocTagNode */;\n    }\n    ts.isJSDocTag = isJSDocTag;\n    function getNonDecoratorTokenPosOfNode(node, sourceFile) {\n        if (nodeIsMissing(node) || !node.decorators) {\n            return getTokenPosOfNode(node, sourceFile);\n        }\n        return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.decorators.end);\n    }\n    ts.getNonDecoratorTokenPosOfNode = getNonDecoratorTokenPosOfNode;\n    function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia) {\n        if (includeTrivia === void 0) { includeTrivia = false; }\n        if (nodeIsMissing(node)) {\n            return \"\";\n        }\n        var text = sourceFile.text;\n        return text.substring(includeTrivia ? node.pos : ts.skipTrivia(text, node.pos), node.end);\n    }\n    ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile;\n    function getTextOfNodeFromSourceText(sourceText, node) {\n        if (nodeIsMissing(node)) {\n            return \"\";\n        }\n        return sourceText.substring(ts.skipTrivia(sourceText, node.pos), node.end);\n    }\n    ts.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText;\n    function getTextOfNode(node, includeTrivia) {\n        if (includeTrivia === void 0) { includeTrivia = false; }\n        return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia);\n    }\n    ts.getTextOfNode = getTextOfNode;\n    function getLiteralText(node, sourceFile, languageVersion) {\n        // Any template literal or string literal with an extended escape\n        // (e.g. \"\\u{0067}\") will need to be downleveled as a escaped string literal.\n        if (languageVersion < 2 /* ES2015 */ && (isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) {\n            return getQuotedEscapedLiteralText('\"', node.text, '\"');\n        }\n        // If we don't need to downlevel and we can reach the original source text using\n        // the node's parent reference, then simply get the text as it was originally written.\n        if (!nodeIsSynthesized(node) && node.parent) {\n            var text = getSourceTextOfNodeFromSourceFile(sourceFile, node);\n            if (languageVersion < 2 /* ES2015 */ && isBinaryOrOctalIntegerLiteral(node, text)) {\n                return node.text;\n            }\n            return text;\n        }\n        // If we can't reach the original source text, use the canonical form if it's a number,\n        // or an escaped quoted form of the original text if it's string-like.\n        switch (node.kind) {\n            case 9 /* StringLiteral */:\n                return getQuotedEscapedLiteralText('\"', node.text, '\"');\n            case 12 /* NoSubstitutionTemplateLiteral */:\n                return getQuotedEscapedLiteralText(\"`\", node.text, \"`\");\n            case 13 /* TemplateHead */:\n                return getQuotedEscapedLiteralText(\"`\", node.text, \"${\");\n            case 14 /* TemplateMiddle */:\n                return getQuotedEscapedLiteralText(\"}\", node.text, \"${\");\n            case 15 /* TemplateTail */:\n                return getQuotedEscapedLiteralText(\"}\", node.text, \"`\");\n            case 8 /* NumericLiteral */:\n                return node.text;\n        }\n        ts.Debug.fail(\"Literal kind '\" + node.kind + \"' not accounted for.\");\n    }\n    ts.getLiteralText = getLiteralText;\n    function isBinaryOrOctalIntegerLiteral(node, text) {\n        if (node.kind === 8 /* NumericLiteral */ && text.length > 1) {\n            switch (text.charCodeAt(1)) {\n                case 98 /* b */:\n                case 66 /* B */:\n                case 111 /* o */:\n                case 79 /* O */:\n                    return true;\n            }\n        }\n        return false;\n    }\n    ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral;\n    function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) {\n        return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote;\n    }\n    // Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__'\n    function escapeIdentifier(identifier) {\n        return identifier.length >= 2 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ ? \"_\" + identifier : identifier;\n    }\n    ts.escapeIdentifier = escapeIdentifier;\n    // Remove extra underscore from escaped identifier\n    function unescapeIdentifier(identifier) {\n        return identifier.length >= 3 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ && identifier.charCodeAt(2) === 95 /* _ */ ? identifier.substr(1) : identifier;\n    }\n    ts.unescapeIdentifier = unescapeIdentifier;\n    // Make an identifier from an external module name by extracting the string after the last \"/\" and replacing\n    // all non-alphanumeric characters with underscores\n    function makeIdentifierFromModuleName(moduleName) {\n        return ts.getBaseFileName(moduleName).replace(/^(\\d)/, \"_$1\").replace(/\\W/g, \"_\");\n    }\n    ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName;\n    function isBlockOrCatchScoped(declaration) {\n        return (ts.getCombinedNodeFlags(declaration) & 3 /* BlockScoped */) !== 0 ||\n            isCatchClauseVariableDeclarationOrBindingElement(declaration);\n    }\n    ts.isBlockOrCatchScoped = isBlockOrCatchScoped;\n    function isCatchClauseVariableDeclarationOrBindingElement(declaration) {\n        var node = getRootDeclaration(declaration);\n        return node.kind === 223 /* VariableDeclaration */ && node.parent.kind === 256 /* CatchClause */;\n    }\n    ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement;\n    function isAmbientModule(node) {\n        return node && node.kind === 230 /* ModuleDeclaration */ &&\n            (node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node));\n    }\n    ts.isAmbientModule = isAmbientModule;\n    /** Given a symbol for a module, checks that it is either an untyped import or a shorthand ambient module. */\n    function isShorthandAmbientModuleSymbol(moduleSymbol) {\n        return isShorthandAmbientModule(moduleSymbol.valueDeclaration);\n    }\n    ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;\n    function isShorthandAmbientModule(node) {\n        // The only kind of module that can be missing a body is a shorthand ambient module.\n        return node.kind === 230 /* ModuleDeclaration */ && (!node.body);\n    }\n    function isBlockScopedContainerTopLevel(node) {\n        return node.kind === 261 /* SourceFile */ ||\n            node.kind === 230 /* ModuleDeclaration */ ||\n            isFunctionLike(node);\n    }\n    ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel;\n    function isGlobalScopeAugmentation(module) {\n        return !!(module.flags & 512 /* GlobalAugmentation */);\n    }\n    ts.isGlobalScopeAugmentation = isGlobalScopeAugmentation;\n    function isExternalModuleAugmentation(node) {\n        // external module augmentation is a ambient module declaration that is either:\n        // - defined in the top level scope and source file is an external module\n        // - defined inside ambient module declaration located in the top level scope and source file not an external module\n        if (!node || !isAmbientModule(node)) {\n            return false;\n        }\n        switch (node.parent.kind) {\n            case 261 /* SourceFile */:\n                return ts.isExternalModule(node.parent);\n            case 231 /* ModuleBlock */:\n                return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent);\n        }\n        return false;\n    }\n    ts.isExternalModuleAugmentation = isExternalModuleAugmentation;\n    function isEffectiveExternalModule(node, compilerOptions) {\n        return ts.isExternalModule(node) || compilerOptions.isolatedModules;\n    }\n    ts.isEffectiveExternalModule = isEffectiveExternalModule;\n    function isBlockScope(node, parentNode) {\n        switch (node.kind) {\n            case 261 /* SourceFile */:\n            case 232 /* CaseBlock */:\n            case 256 /* CatchClause */:\n            case 230 /* ModuleDeclaration */:\n            case 211 /* ForStatement */:\n            case 212 /* ForInStatement */:\n            case 213 /* ForOfStatement */:\n            case 150 /* Constructor */:\n            case 149 /* MethodDeclaration */:\n            case 151 /* GetAccessor */:\n            case 152 /* SetAccessor */:\n            case 225 /* FunctionDeclaration */:\n            case 184 /* FunctionExpression */:\n            case 185 /* ArrowFunction */:\n                return true;\n            case 204 /* Block */:\n                // function block is not considered block-scope container\n                // see comment in binder.ts: bind(...), case for SyntaxKind.Block\n                return parentNode && !isFunctionLike(parentNode);\n        }\n        return false;\n    }\n    ts.isBlockScope = isBlockScope;\n    // Gets the nearest enclosing block scope container that has the provided node\n    // as a descendant, that is not the provided node.\n    function getEnclosingBlockScopeContainer(node) {\n        var current = node.parent;\n        while (current) {\n            if (isBlockScope(current, current.parent)) {\n                return current;\n            }\n            current = current.parent;\n        }\n    }\n    ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer;\n    // Return display name of an identifier\n    // Computed property names will just be emitted as \"[<expr>]\", where <expr> is the source\n    // text of the expression in the computed property.\n    function declarationNameToString(name) {\n        return getFullWidth(name) === 0 ? \"(Missing)\" : getTextOfNode(name);\n    }\n    ts.declarationNameToString = declarationNameToString;\n    function getTextOfPropertyName(name) {\n        switch (name.kind) {\n            case 70 /* Identifier */:\n                return name.text;\n            case 9 /* StringLiteral */:\n            case 8 /* NumericLiteral */:\n                return name.text;\n            case 142 /* ComputedPropertyName */:\n                if (isStringOrNumericLiteral(name.expression)) {\n                    return name.expression.text;\n                }\n        }\n        return undefined;\n    }\n    ts.getTextOfPropertyName = getTextOfPropertyName;\n    function entityNameToString(name) {\n        switch (name.kind) {\n            case 70 /* Identifier */:\n                return getFullWidth(name) === 0 ? unescapeIdentifier(name.text) : getTextOfNode(name);\n            case 141 /* QualifiedName */:\n                return entityNameToString(name.left) + \".\" + entityNameToString(name.right);\n            case 177 /* PropertyAccessExpression */:\n                return entityNameToString(name.expression) + \".\" + entityNameToString(name.name);\n        }\n    }\n    ts.entityNameToString = entityNameToString;\n    function createDiagnosticForNode(node, message, arg0, arg1, arg2) {\n        var sourceFile = getSourceFileOfNode(node);\n        return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2);\n    }\n    ts.createDiagnosticForNode = createDiagnosticForNode;\n    function createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2) {\n        var span = getErrorSpanForNode(sourceFile, node);\n        return ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2);\n    }\n    ts.createDiagnosticForNodeInSourceFile = createDiagnosticForNodeInSourceFile;\n    function createDiagnosticForNodeFromMessageChain(node, messageChain) {\n        var sourceFile = getSourceFileOfNode(node);\n        var span = getErrorSpanForNode(sourceFile, node);\n        return {\n            file: sourceFile,\n            start: span.start,\n            length: span.length,\n            code: messageChain.code,\n            category: messageChain.category,\n            messageText: messageChain.next ? messageChain : messageChain.messageText\n        };\n    }\n    ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain;\n    function getSpanOfTokenAtPosition(sourceFile, pos) {\n        var scanner = ts.createScanner(sourceFile.languageVersion, /*skipTrivia*/ true, sourceFile.languageVariant, sourceFile.text, /*onError:*/ undefined, pos);\n        scanner.scan();\n        var start = scanner.getTokenPos();\n        return ts.createTextSpanFromBounds(start, scanner.getTextPos());\n    }\n    ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition;\n    function getErrorSpanForArrowFunction(sourceFile, node) {\n        var pos = ts.skipTrivia(sourceFile.text, node.pos);\n        if (node.body && node.body.kind === 204 /* Block */) {\n            var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line;\n            var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line;\n            if (startLine < endLine) {\n                // The arrow function spans multiple lines,\n                // make the error span be the first line, inclusive.\n                return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1);\n            }\n        }\n        return ts.createTextSpanFromBounds(pos, node.end);\n    }\n    function getErrorSpanForNode(sourceFile, node) {\n        var errorNode = node;\n        switch (node.kind) {\n            case 261 /* SourceFile */:\n                var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false);\n                if (pos_1 === sourceFile.text.length) {\n                    // file is empty - return span for the beginning of the file\n                    return ts.createTextSpan(0, 0);\n                }\n                return getSpanOfTokenAtPosition(sourceFile, pos_1);\n            // This list is a work in progress. Add missing node kinds to improve their error\n            // spans.\n            case 223 /* VariableDeclaration */:\n            case 174 /* BindingElement */:\n            case 226 /* ClassDeclaration */:\n            case 197 /* ClassExpression */:\n            case 227 /* InterfaceDeclaration */:\n            case 230 /* ModuleDeclaration */:\n            case 229 /* EnumDeclaration */:\n            case 260 /* EnumMember */:\n            case 225 /* FunctionDeclaration */:\n            case 184 /* FunctionExpression */:\n            case 149 /* MethodDeclaration */:\n            case 151 /* GetAccessor */:\n            case 152 /* SetAccessor */:\n            case 228 /* TypeAliasDeclaration */:\n                errorNode = node.name;\n                break;\n            case 185 /* ArrowFunction */:\n                return getErrorSpanForArrowFunction(sourceFile, node);\n        }\n        if (errorNode === undefined) {\n            // If we don't have a better node, then just set the error on the first token of\n            // construct.\n            return getSpanOfTokenAtPosition(sourceFile, node.pos);\n        }\n        var pos = nodeIsMissing(errorNode)\n            ? errorNode.pos\n            : ts.skipTrivia(sourceFile.text, errorNode.pos);\n        return ts.createTextSpanFromBounds(pos, errorNode.end);\n    }\n    ts.getErrorSpanForNode = getErrorSpanForNode;\n    function isExternalOrCommonJsModule(file) {\n        return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined;\n    }\n    ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule;\n    function isDeclarationFile(file) {\n        return file.isDeclarationFile;\n    }\n    ts.isDeclarationFile = isDeclarationFile;\n    function isConstEnumDeclaration(node) {\n        return node.kind === 229 /* EnumDeclaration */ && isConst(node);\n    }\n    ts.isConstEnumDeclaration = isConstEnumDeclaration;\n    function isConst(node) {\n        return !!(ts.getCombinedNodeFlags(node) & 2 /* Const */)\n            || !!(ts.getCombinedModifierFlags(node) & 2048 /* Const */);\n    }\n    ts.isConst = isConst;\n    function isLet(node) {\n        return !!(ts.getCombinedNodeFlags(node) & 1 /* Let */);\n    }\n    ts.isLet = isLet;\n    function isSuperCall(n) {\n        return n.kind === 179 /* CallExpression */ && n.expression.kind === 96 /* SuperKeyword */;\n    }\n    ts.isSuperCall = isSuperCall;\n    function isPrologueDirective(node) {\n        return node.kind === 207 /* ExpressionStatement */\n            && node.expression.kind === 9 /* StringLiteral */;\n    }\n    ts.isPrologueDirective = isPrologueDirective;\n    function getLeadingCommentRangesOfNode(node, sourceFileOfNode) {\n        return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos);\n    }\n    ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode;\n    function getLeadingCommentRangesOfNodeFromText(node, text) {\n        return ts.getLeadingCommentRanges(text, node.pos);\n    }\n    ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText;\n    function getJSDocCommentRanges(node, text) {\n        var commentRanges = (node.kind === 144 /* Parameter */ ||\n            node.kind === 143 /* TypeParameter */ ||\n            node.kind === 184 /* FunctionExpression */ ||\n            node.kind === 185 /* ArrowFunction */) ?\n            ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :\n            getLeadingCommentRangesOfNodeFromText(node, text);\n        // True if the comment starts with '/**' but not if it is '/**/'\n        return ts.filter(commentRanges, function (comment) {\n            return text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ &&\n                text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ &&\n                text.charCodeAt(comment.pos + 3) !== 47 /* slash */;\n        });\n    }\n    ts.getJSDocCommentRanges = getJSDocCommentRanges;\n    ts.fullTripleSlashReferencePathRegEx = /^(\\/\\/\\/\\s*<reference\\s+path\\s*=\\s*)('|\")(.+?)\\2.*?\\/>/;\n    ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\\/\\/\\/\\s*<reference\\s+types\\s*=\\s*)('|\")(.+?)\\2.*?\\/>/;\n    ts.fullTripleSlashAMDReferencePathRegEx = /^(\\/\\/\\/\\s*<amd-dependency\\s+path\\s*=\\s*)('|\")(.+?)\\2.*?\\/>/;\n    function isPartOfTypeNode(node) {\n        if (156 /* FirstTypeNode */ <= node.kind && node.kind <= 171 /* LastTypeNode */) {\n            return true;\n        }\n        switch (node.kind) {\n            case 118 /* AnyKeyword */:\n            case 132 /* NumberKeyword */:\n            case 134 /* StringKeyword */:\n            case 121 /* BooleanKeyword */:\n            case 135 /* SymbolKeyword */:\n            case 137 /* UndefinedKeyword */:\n            case 129 /* NeverKeyword */:\n                return true;\n            case 104 /* VoidKeyword */:\n                return node.parent.kind !== 188 /* VoidExpression */;\n            case 199 /* ExpressionWithTypeArguments */:\n                return !isExpressionWithTypeArgumentsInClassExtendsClause(node);\n            // Identifiers and qualified names may be type nodes, depending on their context. Climb\n            // above them to find the lowest container\n            case 70 /* Identifier */:\n                // If the identifier is the RHS of a qualified name, then it's a type iff its parent is.\n                if (node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node) {\n                    node = node.parent;\n                }\n                else if (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node) {\n                    node = node.parent;\n                }\n                // At this point, node is either a qualified name or an identifier\n                ts.Debug.assert(node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */ || node.kind === 177 /* PropertyAccessExpression */, \"'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.\");\n            case 141 /* QualifiedName */:\n            case 177 /* PropertyAccessExpression */:\n            case 98 /* ThisKeyword */:\n                var parent_1 = node.parent;\n                if (parent_1.kind === 160 /* TypeQuery */) {\n                    return false;\n                }\n                // Do not recursively call isPartOfTypeNode on the parent. In the example:\n                //\n                //     let a: A.B.C;\n                //\n                // Calling isPartOfTypeNode would consider the qualified name A.B a type node. Only C or\n                // A.B.C is a type node.\n                if (156 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 171 /* LastTypeNode */) {\n                    return true;\n                }\n                switch (parent_1.kind) {\n                    case 199 /* ExpressionWithTypeArguments */:\n                        return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1);\n                    case 143 /* TypeParameter */:\n                        return node === parent_1.constraint;\n                    case 147 /* PropertyDeclaration */:\n                    case 146 /* PropertySignature */:\n                    case 144 /* Parameter */:\n                    case 223 /* VariableDeclaration */:\n                        return node === parent_1.type;\n                    case 225 /* FunctionDeclaration */:\n                    case 184 /* FunctionExpression */:\n                    case 185 /* ArrowFunction */:\n                    case 150 /* Constructor */:\n                    case 149 /* MethodDeclaration */:\n                    case 148 /* MethodSignature */:\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                        return node === parent_1.type;\n                    case 153 /* CallSignature */:\n                    case 154 /* ConstructSignature */:\n                    case 155 /* IndexSignature */:\n                        return node === parent_1.type;\n                    case 182 /* TypeAssertionExpression */:\n                        return node === parent_1.type;\n                    case 179 /* CallExpression */:\n                    case 180 /* NewExpression */:\n                        return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0;\n                    case 181 /* TaggedTemplateExpression */:\n                        // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments.\n                        return false;\n                }\n        }\n        return false;\n    }\n    ts.isPartOfTypeNode = isPartOfTypeNode;\n    // Warning: This has the same semantics as the forEach family of functions,\n    //          in that traversal terminates in the event that 'visitor' supplies a truthy value.\n    function forEachReturnStatement(body, visitor) {\n        return traverse(body);\n        function traverse(node) {\n            switch (node.kind) {\n                case 216 /* ReturnStatement */:\n                    return visitor(node);\n                case 232 /* CaseBlock */:\n                case 204 /* Block */:\n                case 208 /* IfStatement */:\n                case 209 /* DoStatement */:\n                case 210 /* WhileStatement */:\n                case 211 /* ForStatement */:\n                case 212 /* ForInStatement */:\n                case 213 /* ForOfStatement */:\n                case 217 /* WithStatement */:\n                case 218 /* SwitchStatement */:\n                case 253 /* CaseClause */:\n                case 254 /* DefaultClause */:\n                case 219 /* LabeledStatement */:\n                case 221 /* TryStatement */:\n                case 256 /* CatchClause */:\n                    return ts.forEachChild(node, traverse);\n            }\n        }\n    }\n    ts.forEachReturnStatement = forEachReturnStatement;\n    function forEachYieldExpression(body, visitor) {\n        return traverse(body);\n        function traverse(node) {\n            switch (node.kind) {\n                case 195 /* YieldExpression */:\n                    visitor(node);\n                    var operand = node.expression;\n                    if (operand) {\n                        traverse(operand);\n                    }\n                case 229 /* EnumDeclaration */:\n                case 227 /* InterfaceDeclaration */:\n                case 230 /* ModuleDeclaration */:\n                case 228 /* TypeAliasDeclaration */:\n                case 226 /* ClassDeclaration */:\n                case 197 /* ClassExpression */:\n                    // These are not allowed inside a generator now, but eventually they may be allowed\n                    // as local types. Regardless, any yield statements contained within them should be\n                    // skipped in this traversal.\n                    return;\n                default:\n                    if (isFunctionLike(node)) {\n                        var name_5 = node.name;\n                        if (name_5 && name_5.kind === 142 /* ComputedPropertyName */) {\n                            // Note that we will not include methods/accessors of a class because they would require\n                            // first descending into the class. This is by design.\n                            traverse(name_5.expression);\n                            return;\n                        }\n                    }\n                    else if (!isPartOfTypeNode(node)) {\n                        // This is the general case, which should include mostly expressions and statements.\n                        // Also includes NodeArrays.\n                        ts.forEachChild(node, traverse);\n                    }\n            }\n        }\n    }\n    ts.forEachYieldExpression = forEachYieldExpression;\n    function isVariableLike(node) {\n        if (node) {\n            switch (node.kind) {\n                case 174 /* BindingElement */:\n                case 260 /* EnumMember */:\n                case 144 /* Parameter */:\n                case 257 /* PropertyAssignment */:\n                case 147 /* PropertyDeclaration */:\n                case 146 /* PropertySignature */:\n                case 258 /* ShorthandPropertyAssignment */:\n                case 223 /* VariableDeclaration */:\n                    return true;\n            }\n        }\n        return false;\n    }\n    ts.isVariableLike = isVariableLike;\n    function isAccessor(node) {\n        return node && (node.kind === 151 /* GetAccessor */ || node.kind === 152 /* SetAccessor */);\n    }\n    ts.isAccessor = isAccessor;\n    function isClassLike(node) {\n        return node && (node.kind === 226 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */);\n    }\n    ts.isClassLike = isClassLike;\n    function isFunctionLike(node) {\n        return node && isFunctionLikeKind(node.kind);\n    }\n    ts.isFunctionLike = isFunctionLike;\n    function isFunctionLikeKind(kind) {\n        switch (kind) {\n            case 150 /* Constructor */:\n            case 184 /* FunctionExpression */:\n            case 225 /* FunctionDeclaration */:\n            case 185 /* ArrowFunction */:\n            case 149 /* MethodDeclaration */:\n            case 148 /* MethodSignature */:\n            case 151 /* GetAccessor */:\n            case 152 /* SetAccessor */:\n            case 153 /* CallSignature */:\n            case 154 /* ConstructSignature */:\n            case 155 /* IndexSignature */:\n            case 158 /* FunctionType */:\n            case 159 /* ConstructorType */:\n                return true;\n        }\n        return false;\n    }\n    ts.isFunctionLikeKind = isFunctionLikeKind;\n    function introducesArgumentsExoticObject(node) {\n        switch (node.kind) {\n            case 149 /* MethodDeclaration */:\n            case 148 /* MethodSignature */:\n            case 150 /* Constructor */:\n            case 151 /* GetAccessor */:\n            case 152 /* SetAccessor */:\n            case 225 /* FunctionDeclaration */:\n            case 184 /* FunctionExpression */:\n                return true;\n        }\n        return false;\n    }\n    ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject;\n    function isIterationStatement(node, lookInLabeledStatements) {\n        switch (node.kind) {\n            case 211 /* ForStatement */:\n            case 212 /* ForInStatement */:\n            case 213 /* ForOfStatement */:\n            case 209 /* DoStatement */:\n            case 210 /* WhileStatement */:\n                return true;\n            case 219 /* LabeledStatement */:\n                return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements);\n        }\n        return false;\n    }\n    ts.isIterationStatement = isIterationStatement;\n    function isFunctionBlock(node) {\n        return node && node.kind === 204 /* Block */ && isFunctionLike(node.parent);\n    }\n    ts.isFunctionBlock = isFunctionBlock;\n    function isObjectLiteralMethod(node) {\n        return node && node.kind === 149 /* MethodDeclaration */ && node.parent.kind === 176 /* ObjectLiteralExpression */;\n    }\n    ts.isObjectLiteralMethod = isObjectLiteralMethod;\n    function isObjectLiteralOrClassExpressionMethod(node) {\n        return node.kind === 149 /* MethodDeclaration */ &&\n            (node.parent.kind === 176 /* ObjectLiteralExpression */ ||\n                node.parent.kind === 197 /* ClassExpression */);\n    }\n    ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod;\n    function isIdentifierTypePredicate(predicate) {\n        return predicate && predicate.kind === 1 /* Identifier */;\n    }\n    ts.isIdentifierTypePredicate = isIdentifierTypePredicate;\n    function isThisTypePredicate(predicate) {\n        return predicate && predicate.kind === 0 /* This */;\n    }\n    ts.isThisTypePredicate = isThisTypePredicate;\n    function getContainingFunction(node) {\n        while (true) {\n            node = node.parent;\n            if (!node || isFunctionLike(node)) {\n                return node;\n            }\n        }\n    }\n    ts.getContainingFunction = getContainingFunction;\n    function getContainingClass(node) {\n        while (true) {\n            node = node.parent;\n            if (!node || isClassLike(node)) {\n                return node;\n            }\n        }\n    }\n    ts.getContainingClass = getContainingClass;\n    function getThisContainer(node, includeArrowFunctions) {\n        while (true) {\n            node = node.parent;\n            if (!node) {\n                return undefined;\n            }\n            switch (node.kind) {\n                case 142 /* ComputedPropertyName */:\n                    // If the grandparent node is an object literal (as opposed to a class),\n                    // then the computed property is not a 'this' container.\n                    // A computed property name in a class needs to be a this container\n                    // so that we can error on it.\n                    if (isClassLike(node.parent.parent)) {\n                        return node;\n                    }\n                    // If this is a computed property, then the parent should not\n                    // make it a this container. The parent might be a property\n                    // in an object literal, like a method or accessor. But in order for\n                    // such a parent to be a this container, the reference must be in\n                    // the *body* of the container.\n                    node = node.parent;\n                    break;\n                case 145 /* Decorator */:\n                    // Decorators are always applied outside of the body of a class or method.\n                    if (node.parent.kind === 144 /* Parameter */ && isClassElement(node.parent.parent)) {\n                        // If the decorator's parent is a Parameter, we resolve the this container from\n                        // the grandparent class declaration.\n                        node = node.parent.parent;\n                    }\n                    else if (isClassElement(node.parent)) {\n                        // If the decorator's parent is a class element, we resolve the 'this' container\n                        // from the parent class declaration.\n                        node = node.parent;\n                    }\n                    break;\n                case 185 /* ArrowFunction */:\n                    if (!includeArrowFunctions) {\n                        continue;\n                    }\n                // Fall through\n                case 225 /* FunctionDeclaration */:\n                case 184 /* FunctionExpression */:\n                case 230 /* ModuleDeclaration */:\n                case 147 /* PropertyDeclaration */:\n                case 146 /* PropertySignature */:\n                case 149 /* MethodDeclaration */:\n                case 148 /* MethodSignature */:\n                case 150 /* Constructor */:\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                case 153 /* CallSignature */:\n                case 154 /* ConstructSignature */:\n                case 155 /* IndexSignature */:\n                case 229 /* EnumDeclaration */:\n                case 261 /* SourceFile */:\n                    return node;\n            }\n        }\n    }\n    ts.getThisContainer = getThisContainer;\n    /**\n      * Given an super call/property node, returns the closest node where\n      * - a super call/property access is legal in the node and not legal in the parent node the node.\n      *   i.e. super call is legal in constructor but not legal in the class body.\n      * - the container is an arrow function (so caller might need to call getSuperContainer again in case it needs to climb higher)\n      * - a super call/property is definitely illegal in the container (but might be legal in some subnode)\n      *   i.e. super property access is illegal in function declaration but can be legal in the statement list\n      */\n    function getSuperContainer(node, stopOnFunctions) {\n        while (true) {\n            node = node.parent;\n            if (!node) {\n                return node;\n            }\n            switch (node.kind) {\n                case 142 /* ComputedPropertyName */:\n                    node = node.parent;\n                    break;\n                case 225 /* FunctionDeclaration */:\n                case 184 /* FunctionExpression */:\n                case 185 /* ArrowFunction */:\n                    if (!stopOnFunctions) {\n                        continue;\n                    }\n                case 147 /* PropertyDeclaration */:\n                case 146 /* PropertySignature */:\n                case 149 /* MethodDeclaration */:\n                case 148 /* MethodSignature */:\n                case 150 /* Constructor */:\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                    return node;\n                case 145 /* Decorator */:\n                    // Decorators are always applied outside of the body of a class or method.\n                    if (node.parent.kind === 144 /* Parameter */ && isClassElement(node.parent.parent)) {\n                        // If the decorator's parent is a Parameter, we resolve the this container from\n                        // the grandparent class declaration.\n                        node = node.parent.parent;\n                    }\n                    else if (isClassElement(node.parent)) {\n                        // If the decorator's parent is a class element, we resolve the 'this' container\n                        // from the parent class declaration.\n                        node = node.parent;\n                    }\n                    break;\n            }\n        }\n    }\n    ts.getSuperContainer = getSuperContainer;\n    function getImmediatelyInvokedFunctionExpression(func) {\n        if (func.kind === 184 /* FunctionExpression */ || func.kind === 185 /* ArrowFunction */) {\n            var prev = func;\n            var parent_2 = func.parent;\n            while (parent_2.kind === 183 /* ParenthesizedExpression */) {\n                prev = parent_2;\n                parent_2 = parent_2.parent;\n            }\n            if (parent_2.kind === 179 /* CallExpression */ && parent_2.expression === prev) {\n                return parent_2;\n            }\n        }\n    }\n    ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression;\n    /**\n     * Determines whether a node is a property or element access expression for super.\n     */\n    function isSuperProperty(node) {\n        var kind = node.kind;\n        return (kind === 177 /* PropertyAccessExpression */ || kind === 178 /* ElementAccessExpression */)\n            && node.expression.kind === 96 /* SuperKeyword */;\n    }\n    ts.isSuperProperty = isSuperProperty;\n    function getEntityNameFromTypeNode(node) {\n        switch (node.kind) {\n            case 157 /* TypeReference */:\n            case 272 /* JSDocTypeReference */:\n                return node.typeName;\n            case 199 /* ExpressionWithTypeArguments */:\n                return isEntityNameExpression(node.expression)\n                    ? node.expression\n                    : undefined;\n            case 70 /* Identifier */:\n            case 141 /* QualifiedName */:\n                return node;\n        }\n        return undefined;\n    }\n    ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode;\n    function isCallLikeExpression(node) {\n        switch (node.kind) {\n            case 179 /* CallExpression */:\n            case 180 /* NewExpression */:\n            case 181 /* TaggedTemplateExpression */:\n            case 145 /* Decorator */:\n                return true;\n            default:\n                return false;\n        }\n    }\n    ts.isCallLikeExpression = isCallLikeExpression;\n    function getInvokedExpression(node) {\n        if (node.kind === 181 /* TaggedTemplateExpression */) {\n            return node.tag;\n        }\n        // Will either be a CallExpression, NewExpression, or Decorator.\n        return node.expression;\n    }\n    ts.getInvokedExpression = getInvokedExpression;\n    function nodeCanBeDecorated(node) {\n        switch (node.kind) {\n            case 226 /* ClassDeclaration */:\n                // classes are valid targets\n                return true;\n            case 147 /* PropertyDeclaration */:\n                // property declarations are valid if their parent is a class declaration.\n                return node.parent.kind === 226 /* ClassDeclaration */;\n            case 151 /* GetAccessor */:\n            case 152 /* SetAccessor */:\n            case 149 /* MethodDeclaration */:\n                // if this method has a body and its parent is a class declaration, this is a valid target.\n                return node.body !== undefined\n                    && node.parent.kind === 226 /* ClassDeclaration */;\n            case 144 /* Parameter */:\n                // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target;\n                return node.parent.body !== undefined\n                    && (node.parent.kind === 150 /* Constructor */\n                        || node.parent.kind === 149 /* MethodDeclaration */\n                        || node.parent.kind === 152 /* SetAccessor */)\n                    && node.parent.parent.kind === 226 /* ClassDeclaration */;\n        }\n        return false;\n    }\n    ts.nodeCanBeDecorated = nodeCanBeDecorated;\n    function nodeIsDecorated(node) {\n        return node.decorators !== undefined\n            && nodeCanBeDecorated(node);\n    }\n    ts.nodeIsDecorated = nodeIsDecorated;\n    function nodeOrChildIsDecorated(node) {\n        return nodeIsDecorated(node) || childIsDecorated(node);\n    }\n    ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated;\n    function childIsDecorated(node) {\n        switch (node.kind) {\n            case 226 /* ClassDeclaration */:\n                return ts.forEach(node.members, nodeOrChildIsDecorated);\n            case 149 /* MethodDeclaration */:\n            case 152 /* SetAccessor */:\n                return ts.forEach(node.parameters, nodeIsDecorated);\n        }\n    }\n    ts.childIsDecorated = childIsDecorated;\n    function isJSXTagName(node) {\n        var parent = node.parent;\n        if (parent.kind === 248 /* JsxOpeningElement */ ||\n            parent.kind === 247 /* JsxSelfClosingElement */ ||\n            parent.kind === 249 /* JsxClosingElement */) {\n            return parent.tagName === node;\n        }\n        return false;\n    }\n    ts.isJSXTagName = isJSXTagName;\n    function isPartOfExpression(node) {\n        switch (node.kind) {\n            case 98 /* ThisKeyword */:\n            case 96 /* SuperKeyword */:\n            case 94 /* NullKeyword */:\n            case 100 /* TrueKeyword */:\n            case 85 /* FalseKeyword */:\n            case 11 /* RegularExpressionLiteral */:\n            case 175 /* ArrayLiteralExpression */:\n            case 176 /* ObjectLiteralExpression */:\n            case 177 /* PropertyAccessExpression */:\n            case 178 /* ElementAccessExpression */:\n            case 179 /* CallExpression */:\n            case 180 /* NewExpression */:\n            case 181 /* TaggedTemplateExpression */:\n            case 200 /* AsExpression */:\n            case 182 /* TypeAssertionExpression */:\n            case 201 /* NonNullExpression */:\n            case 183 /* ParenthesizedExpression */:\n            case 184 /* FunctionExpression */:\n            case 197 /* ClassExpression */:\n            case 185 /* ArrowFunction */:\n            case 188 /* VoidExpression */:\n            case 186 /* DeleteExpression */:\n            case 187 /* TypeOfExpression */:\n            case 190 /* PrefixUnaryExpression */:\n            case 191 /* PostfixUnaryExpression */:\n            case 192 /* BinaryExpression */:\n            case 193 /* ConditionalExpression */:\n            case 196 /* SpreadElement */:\n            case 194 /* TemplateExpression */:\n            case 12 /* NoSubstitutionTemplateLiteral */:\n            case 198 /* OmittedExpression */:\n            case 246 /* JsxElement */:\n            case 247 /* JsxSelfClosingElement */:\n            case 195 /* YieldExpression */:\n            case 189 /* AwaitExpression */:\n                return true;\n            case 141 /* QualifiedName */:\n                while (node.parent.kind === 141 /* QualifiedName */) {\n                    node = node.parent;\n                }\n                return node.parent.kind === 160 /* TypeQuery */ || isJSXTagName(node);\n            case 70 /* Identifier */:\n                if (node.parent.kind === 160 /* TypeQuery */ || isJSXTagName(node)) {\n                    return true;\n                }\n            // fall through\n            case 8 /* NumericLiteral */:\n            case 9 /* StringLiteral */:\n            case 98 /* ThisKeyword */:\n                var parent_3 = node.parent;\n                switch (parent_3.kind) {\n                    case 223 /* VariableDeclaration */:\n                    case 144 /* Parameter */:\n                    case 147 /* PropertyDeclaration */:\n                    case 146 /* PropertySignature */:\n                    case 260 /* EnumMember */:\n                    case 257 /* PropertyAssignment */:\n                    case 174 /* BindingElement */:\n                        return parent_3.initializer === node;\n                    case 207 /* ExpressionStatement */:\n                    case 208 /* IfStatement */:\n                    case 209 /* DoStatement */:\n                    case 210 /* WhileStatement */:\n                    case 216 /* ReturnStatement */:\n                    case 217 /* WithStatement */:\n                    case 218 /* SwitchStatement */:\n                    case 253 /* CaseClause */:\n                    case 220 /* ThrowStatement */:\n                    case 218 /* SwitchStatement */:\n                        return parent_3.expression === node;\n                    case 211 /* ForStatement */:\n                        var forStatement = parent_3;\n                        return (forStatement.initializer === node && forStatement.initializer.kind !== 224 /* VariableDeclarationList */) ||\n                            forStatement.condition === node ||\n                            forStatement.incrementor === node;\n                    case 212 /* ForInStatement */:\n                    case 213 /* ForOfStatement */:\n                        var forInStatement = parent_3;\n                        return (forInStatement.initializer === node && forInStatement.initializer.kind !== 224 /* VariableDeclarationList */) ||\n                            forInStatement.expression === node;\n                    case 182 /* TypeAssertionExpression */:\n                    case 200 /* AsExpression */:\n                        return node === parent_3.expression;\n                    case 202 /* TemplateSpan */:\n                        return node === parent_3.expression;\n                    case 142 /* ComputedPropertyName */:\n                        return node === parent_3.expression;\n                    case 145 /* Decorator */:\n                    case 252 /* JsxExpression */:\n                    case 251 /* JsxSpreadAttribute */:\n                    case 259 /* SpreadAssignment */:\n                        return true;\n                    case 199 /* ExpressionWithTypeArguments */:\n                        return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3);\n                    default:\n                        if (isPartOfExpression(parent_3)) {\n                            return true;\n                        }\n                }\n        }\n        return false;\n    }\n    ts.isPartOfExpression = isPartOfExpression;\n    function isInstantiatedModule(node, preserveConstEnums) {\n        var moduleState = ts.getModuleInstanceState(node);\n        return moduleState === 1 /* Instantiated */ ||\n            (preserveConstEnums && moduleState === 2 /* ConstEnumOnly */);\n    }\n    ts.isInstantiatedModule = isInstantiatedModule;\n    function isExternalModuleImportEqualsDeclaration(node) {\n        return node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 245 /* ExternalModuleReference */;\n    }\n    ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration;\n    function getExternalModuleImportEqualsDeclarationExpression(node) {\n        ts.Debug.assert(isExternalModuleImportEqualsDeclaration(node));\n        return node.moduleReference.expression;\n    }\n    ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;\n    function isInternalModuleImportEqualsDeclaration(node) {\n        return node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 245 /* ExternalModuleReference */;\n    }\n    ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration;\n    function isSourceFileJavaScript(file) {\n        return isInJavaScriptFile(file);\n    }\n    ts.isSourceFileJavaScript = isSourceFileJavaScript;\n    function isInJavaScriptFile(node) {\n        return node && !!(node.flags & 65536 /* JavaScriptFile */);\n    }\n    ts.isInJavaScriptFile = isInJavaScriptFile;\n    /**\n     * Returns true if the node is a CallExpression to the identifier 'require' with\n     * exactly one argument.\n     * This function does not test if the node is in a JavaScript file or not.\n    */\n    function isRequireCall(expression, checkArgumentIsStringLiteral) {\n        // of the form 'require(\"name\")'\n        var isRequire = expression.kind === 179 /* CallExpression */ &&\n            expression.expression.kind === 70 /* Identifier */ &&\n            expression.expression.text === \"require\" &&\n            expression.arguments.length === 1;\n        return isRequire && (!checkArgumentIsStringLiteral || expression.arguments[0].kind === 9 /* StringLiteral */);\n    }\n    ts.isRequireCall = isRequireCall;\n    function isSingleOrDoubleQuote(charCode) {\n        return charCode === 39 /* singleQuote */ || charCode === 34 /* doubleQuote */;\n    }\n    ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote;\n    /**\n     * Returns true if the node is a variable declaration whose initializer is a function expression.\n     * This function does not test if the node is in a JavaScript file or not.\n     */\n    function isDeclarationOfFunctionExpression(s) {\n        if (s.valueDeclaration && s.valueDeclaration.kind === 223 /* VariableDeclaration */) {\n            var declaration = s.valueDeclaration;\n            return declaration.initializer && declaration.initializer.kind === 184 /* FunctionExpression */;\n        }\n        return false;\n    }\n    ts.isDeclarationOfFunctionExpression = isDeclarationOfFunctionExpression;\n    /// Given a BinaryExpression, returns SpecialPropertyAssignmentKind for the various kinds of property\n    /// assignments we treat as special in the binder\n    function getSpecialPropertyAssignmentKind(expression) {\n        if (!isInJavaScriptFile(expression)) {\n            return 0 /* None */;\n        }\n        if (expression.kind !== 192 /* BinaryExpression */) {\n            return 0 /* None */;\n        }\n        var expr = expression;\n        if (expr.operatorToken.kind !== 57 /* EqualsToken */ || expr.left.kind !== 177 /* PropertyAccessExpression */) {\n            return 0 /* None */;\n        }\n        var lhs = expr.left;\n        if (lhs.expression.kind === 70 /* Identifier */) {\n            var lhsId = lhs.expression;\n            if (lhsId.text === \"exports\") {\n                // exports.name = expr\n                return 1 /* ExportsProperty */;\n            }\n            else if (lhsId.text === \"module\" && lhs.name.text === \"exports\") {\n                // module.exports = expr\n                return 2 /* ModuleExports */;\n            }\n        }\n        else if (lhs.expression.kind === 98 /* ThisKeyword */) {\n            return 4 /* ThisProperty */;\n        }\n        else if (lhs.expression.kind === 177 /* PropertyAccessExpression */) {\n            // chained dot, e.g. x.y.z = expr; this var is the 'x.y' part\n            var innerPropertyAccess = lhs.expression;\n            if (innerPropertyAccess.expression.kind === 70 /* Identifier */) {\n                // module.exports.name = expr\n                var innerPropertyAccessIdentifier = innerPropertyAccess.expression;\n                if (innerPropertyAccessIdentifier.text === \"module\" && innerPropertyAccess.name.text === \"exports\") {\n                    return 1 /* ExportsProperty */;\n                }\n                if (innerPropertyAccess.name.text === \"prototype\") {\n                    return 3 /* PrototypeProperty */;\n                }\n            }\n        }\n        return 0 /* None */;\n    }\n    ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind;\n    function getExternalModuleName(node) {\n        if (node.kind === 235 /* ImportDeclaration */) {\n            return node.moduleSpecifier;\n        }\n        if (node.kind === 234 /* ImportEqualsDeclaration */) {\n            var reference = node.moduleReference;\n            if (reference.kind === 245 /* ExternalModuleReference */) {\n                return reference.expression;\n            }\n        }\n        if (node.kind === 241 /* ExportDeclaration */) {\n            return node.moduleSpecifier;\n        }\n        if (node.kind === 230 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) {\n            return node.name;\n        }\n    }\n    ts.getExternalModuleName = getExternalModuleName;\n    function getNamespaceDeclarationNode(node) {\n        if (node.kind === 234 /* ImportEqualsDeclaration */) {\n            return node;\n        }\n        var importClause = node.importClause;\n        if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 237 /* NamespaceImport */) {\n            return importClause.namedBindings;\n        }\n    }\n    ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode;\n    function isDefaultImport(node) {\n        return node.kind === 235 /* ImportDeclaration */\n            && node.importClause\n            && !!node.importClause.name;\n    }\n    ts.isDefaultImport = isDefaultImport;\n    function hasQuestionToken(node) {\n        if (node) {\n            switch (node.kind) {\n                case 144 /* Parameter */:\n                case 149 /* MethodDeclaration */:\n                case 148 /* MethodSignature */:\n                case 258 /* ShorthandPropertyAssignment */:\n                case 257 /* PropertyAssignment */:\n                case 147 /* PropertyDeclaration */:\n                case 146 /* PropertySignature */:\n                    return node.questionToken !== undefined;\n            }\n        }\n        return false;\n    }\n    ts.hasQuestionToken = hasQuestionToken;\n    function isJSDocConstructSignature(node) {\n        return node.kind === 274 /* JSDocFunctionType */ &&\n            node.parameters.length > 0 &&\n            node.parameters[0].type.kind === 276 /* JSDocConstructorType */;\n    }\n    ts.isJSDocConstructSignature = isJSDocConstructSignature;\n    function getCommentsFromJSDoc(node) {\n        return ts.map(getJSDocs(node), function (doc) { return doc.comment; });\n    }\n    ts.getCommentsFromJSDoc = getCommentsFromJSDoc;\n    function getJSDocTags(node, kind) {\n        var docs = getJSDocs(node);\n        if (docs) {\n            var result = [];\n            for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) {\n                var doc = docs_1[_i];\n                if (doc.kind === 281 /* JSDocParameterTag */) {\n                    if (doc.kind === kind) {\n                        result.push(doc);\n                    }\n                }\n                else {\n                    result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; }));\n                }\n            }\n            return result;\n        }\n    }\n    function getFirstJSDocTag(node, kind) {\n        return node && ts.firstOrUndefined(getJSDocTags(node, kind));\n    }\n    function getJSDocs(node) {\n        var cache = node.jsDocCache;\n        if (!cache) {\n            getJSDocsWorker(node);\n            node.jsDocCache = cache;\n        }\n        return cache;\n        function getJSDocsWorker(node) {\n            var parent = node.parent;\n            // Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement.\n            // /**\n            //   * @param {number} name\n            //   * @returns {number}\n            //   */\n            // var x = function(name) { return name.length; }\n            var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) &&\n                parent.initializer === node &&\n                parent.parent.parent.kind === 205 /* VariableStatement */;\n            var isVariableOfVariableDeclarationStatement = isVariableLike(node) &&\n                parent.parent.kind === 205 /* VariableStatement */;\n            var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent :\n                isVariableOfVariableDeclarationStatement ? parent.parent :\n                    undefined;\n            if (variableStatementNode) {\n                getJSDocsWorker(variableStatementNode);\n            }\n            // Also recognize when the node is the RHS of an assignment expression\n            var isSourceOfAssignmentExpressionStatement = parent && parent.parent &&\n                parent.kind === 192 /* BinaryExpression */ &&\n                parent.operatorToken.kind === 57 /* EqualsToken */ &&\n                parent.parent.kind === 207 /* ExpressionStatement */;\n            if (isSourceOfAssignmentExpressionStatement) {\n                getJSDocsWorker(parent.parent);\n            }\n            var isModuleDeclaration = node.kind === 230 /* ModuleDeclaration */ &&\n                parent && parent.kind === 230 /* ModuleDeclaration */;\n            var isPropertyAssignmentExpression = parent && parent.kind === 257 /* PropertyAssignment */;\n            if (isModuleDeclaration || isPropertyAssignmentExpression) {\n                getJSDocsWorker(parent);\n            }\n            // Pull parameter comments from declaring function as well\n            if (node.kind === 144 /* Parameter */) {\n                cache = ts.concatenate(cache, getJSDocParameterTags(node));\n            }\n            if (isVariableLike(node) && node.initializer) {\n                cache = ts.concatenate(cache, node.initializer.jsDoc);\n            }\n            cache = ts.concatenate(cache, node.jsDoc);\n        }\n    }\n    function getJSDocParameterTags(param) {\n        if (!isParameter(param)) {\n            return undefined;\n        }\n        var func = param.parent;\n        var tags = getJSDocTags(func, 281 /* JSDocParameterTag */);\n        if (!param.name) {\n            // this is an anonymous jsdoc param from a `function(type1, type2): type3` specification\n            var i = func.parameters.indexOf(param);\n            var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */; });\n            if (paramTags && 0 <= i && i < paramTags.length) {\n                return [paramTags[i]];\n            }\n        }\n        else if (param.name.kind === 70 /* Identifier */) {\n            var name_6 = param.name.text;\n            return ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */ && tag.parameterName.text === name_6; });\n        }\n        else {\n            // TODO: it's a destructured parameter, so it should look up an \"object type\" series of multiple lines\n            // But multi-line object types aren't supported yet either\n            return undefined;\n        }\n    }\n    ts.getJSDocParameterTags = getJSDocParameterTags;\n    function getJSDocType(node) {\n        var tag = getFirstJSDocTag(node, 283 /* JSDocTypeTag */);\n        if (!tag && node.kind === 144 /* Parameter */) {\n            var paramTags = getJSDocParameterTags(node);\n            if (paramTags) {\n                tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; });\n            }\n        }\n        return tag && tag.typeExpression && tag.typeExpression.type;\n    }\n    ts.getJSDocType = getJSDocType;\n    function getJSDocAugmentsTag(node) {\n        return getFirstJSDocTag(node, 280 /* JSDocAugmentsTag */);\n    }\n    ts.getJSDocAugmentsTag = getJSDocAugmentsTag;\n    function getJSDocReturnTag(node) {\n        return getFirstJSDocTag(node, 282 /* JSDocReturnTag */);\n    }\n    ts.getJSDocReturnTag = getJSDocReturnTag;\n    function getJSDocTemplateTag(node) {\n        return getFirstJSDocTag(node, 284 /* JSDocTemplateTag */);\n    }\n    ts.getJSDocTemplateTag = getJSDocTemplateTag;\n    function hasRestParameter(s) {\n        return isRestParameter(ts.lastOrUndefined(s.parameters));\n    }\n    ts.hasRestParameter = hasRestParameter;\n    function hasDeclaredRestParameter(s) {\n        return isDeclaredRestParam(ts.lastOrUndefined(s.parameters));\n    }\n    ts.hasDeclaredRestParameter = hasDeclaredRestParameter;\n    function isRestParameter(node) {\n        if (node && (node.flags & 65536 /* JavaScriptFile */)) {\n            if (node.type && node.type.kind === 275 /* JSDocVariadicType */ ||\n                ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275 /* JSDocVariadicType */; })) {\n                return true;\n            }\n        }\n        return isDeclaredRestParam(node);\n    }\n    ts.isRestParameter = isRestParameter;\n    function isDeclaredRestParam(node) {\n        return node && node.dotDotDotToken !== undefined;\n    }\n    ts.isDeclaredRestParam = isDeclaredRestParam;\n    var AssignmentKind;\n    (function (AssignmentKind) {\n        AssignmentKind[AssignmentKind[\"None\"] = 0] = \"None\";\n        AssignmentKind[AssignmentKind[\"Definite\"] = 1] = \"Definite\";\n        AssignmentKind[AssignmentKind[\"Compound\"] = 2] = \"Compound\";\n    })(AssignmentKind = ts.AssignmentKind || (ts.AssignmentKind = {}));\n    function getAssignmentTargetKind(node) {\n        var parent = node.parent;\n        while (true) {\n            switch (parent.kind) {\n                case 192 /* BinaryExpression */:\n                    var binaryOperator = parent.operatorToken.kind;\n                    return isAssignmentOperator(binaryOperator) && parent.left === node ?\n                        binaryOperator === 57 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ :\n                        0 /* None */;\n                case 190 /* PrefixUnaryExpression */:\n                case 191 /* PostfixUnaryExpression */:\n                    var unaryOperator = parent.operator;\n                    return unaryOperator === 42 /* PlusPlusToken */ || unaryOperator === 43 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */;\n                case 212 /* ForInStatement */:\n                case 213 /* ForOfStatement */:\n                    return parent.initializer === node ? 1 /* Definite */ : 0 /* None */;\n                case 183 /* ParenthesizedExpression */:\n                case 175 /* ArrayLiteralExpression */:\n                case 196 /* SpreadElement */:\n                    node = parent;\n                    break;\n                case 258 /* ShorthandPropertyAssignment */:\n                    if (parent.name !== node) {\n                        return 0 /* None */;\n                    }\n                // Fall through\n                case 257 /* PropertyAssignment */:\n                    node = parent.parent;\n                    break;\n                default:\n                    return 0 /* None */;\n            }\n            parent = node.parent;\n        }\n    }\n    ts.getAssignmentTargetKind = getAssignmentTargetKind;\n    // A node is an assignment target if it is on the left hand side of an '=' token, if it is parented by a property\n    // assignment in an object literal that is an assignment target, or if it is parented by an array literal that is\n    // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ p: a}] = xxx'.\n    function isAssignmentTarget(node) {\n        return getAssignmentTargetKind(node) !== 0 /* None */;\n    }\n    ts.isAssignmentTarget = isAssignmentTarget;\n    function isNodeDescendantOf(node, ancestor) {\n        while (node) {\n            if (node === ancestor)\n                return true;\n            node = node.parent;\n        }\n        return false;\n    }\n    ts.isNodeDescendantOf = isNodeDescendantOf;\n    function isInAmbientContext(node) {\n        while (node) {\n            if (hasModifier(node, 2 /* Ambient */) || (node.kind === 261 /* SourceFile */ && node.isDeclarationFile)) {\n                return true;\n            }\n            node = node.parent;\n        }\n        return false;\n    }\n    ts.isInAmbientContext = isInAmbientContext;\n    // True if the given identifier, string literal, or number literal is the name of a declaration node\n    function isDeclarationName(name) {\n        if (name.kind !== 70 /* Identifier */ && name.kind !== 9 /* StringLiteral */ && name.kind !== 8 /* NumericLiteral */) {\n            return false;\n        }\n        var parent = name.parent;\n        if (parent.kind === 239 /* ImportSpecifier */ || parent.kind === 243 /* ExportSpecifier */) {\n            if (parent.propertyName) {\n                return true;\n            }\n        }\n        if (isDeclaration(parent)) {\n            return parent.name === name;\n        }\n        return false;\n    }\n    ts.isDeclarationName = isDeclarationName;\n    function isLiteralComputedPropertyDeclarationName(node) {\n        return (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) &&\n            node.parent.kind === 142 /* ComputedPropertyName */ &&\n            isDeclaration(node.parent.parent);\n    }\n    ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName;\n    // Return true if the given identifier is classified as an IdentifierName\n    function isIdentifierName(node) {\n        var parent = node.parent;\n        switch (parent.kind) {\n            case 147 /* PropertyDeclaration */:\n            case 146 /* PropertySignature */:\n            case 149 /* MethodDeclaration */:\n            case 148 /* MethodSignature */:\n            case 151 /* GetAccessor */:\n            case 152 /* SetAccessor */:\n            case 260 /* EnumMember */:\n            case 257 /* PropertyAssignment */:\n            case 177 /* PropertyAccessExpression */:\n                // Name in member declaration or property name in property access\n                return parent.name === node;\n            case 141 /* QualifiedName */:\n                // Name on right hand side of dot in a type query\n                if (parent.right === node) {\n                    while (parent.kind === 141 /* QualifiedName */) {\n                        parent = parent.parent;\n                    }\n                    return parent.kind === 160 /* TypeQuery */;\n                }\n                return false;\n            case 174 /* BindingElement */:\n            case 239 /* ImportSpecifier */:\n                // Property name in binding element or import specifier\n                return parent.propertyName === node;\n            case 243 /* ExportSpecifier */:\n                // Any name in an export specifier\n                return true;\n        }\n        return false;\n    }\n    ts.isIdentifierName = isIdentifierName;\n    // An alias symbol is created by one of the following declarations:\n    // import <symbol> = ...\n    // import <symbol> from ...\n    // import * as <symbol> from ...\n    // import { x as <symbol> } from ...\n    // export { x as <symbol> } from ...\n    // export = <EntityNameExpression>\n    // export default <EntityNameExpression>\n    function isAliasSymbolDeclaration(node) {\n        return node.kind === 234 /* ImportEqualsDeclaration */ ||\n            node.kind === 233 /* NamespaceExportDeclaration */ ||\n            node.kind === 236 /* ImportClause */ && !!node.name ||\n            node.kind === 237 /* NamespaceImport */ ||\n            node.kind === 239 /* ImportSpecifier */ ||\n            node.kind === 243 /* ExportSpecifier */ ||\n            node.kind === 240 /* ExportAssignment */ && exportAssignmentIsAlias(node);\n    }\n    ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;\n    function exportAssignmentIsAlias(node) {\n        return isEntityNameExpression(node.expression);\n    }\n    ts.exportAssignmentIsAlias = exportAssignmentIsAlias;\n    function getClassExtendsHeritageClauseElement(node) {\n        var heritageClause = getHeritageClause(node.heritageClauses, 84 /* ExtendsKeyword */);\n        return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;\n    }\n    ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement;\n    function getClassImplementsHeritageClauseElements(node) {\n        var heritageClause = getHeritageClause(node.heritageClauses, 107 /* ImplementsKeyword */);\n        return heritageClause ? heritageClause.types : undefined;\n    }\n    ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements;\n    function getInterfaceBaseTypeNodes(node) {\n        var heritageClause = getHeritageClause(node.heritageClauses, 84 /* ExtendsKeyword */);\n        return heritageClause ? heritageClause.types : undefined;\n    }\n    ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes;\n    function getHeritageClause(clauses, kind) {\n        if (clauses) {\n            for (var _i = 0, clauses_1 = clauses; _i < clauses_1.length; _i++) {\n                var clause = clauses_1[_i];\n                if (clause.token === kind) {\n                    return clause;\n                }\n            }\n        }\n        return undefined;\n    }\n    ts.getHeritageClause = getHeritageClause;\n    function tryResolveScriptReference(host, sourceFile, reference) {\n        if (!host.getCompilerOptions().noResolve) {\n            var referenceFileName = ts.isRootedDiskPath(reference.fileName) ? reference.fileName : ts.combinePaths(ts.getDirectoryPath(sourceFile.fileName), reference.fileName);\n            return host.getSourceFile(referenceFileName);\n        }\n    }\n    ts.tryResolveScriptReference = tryResolveScriptReference;\n    function getAncestor(node, kind) {\n        while (node) {\n            if (node.kind === kind) {\n                return node;\n            }\n            node = node.parent;\n        }\n        return undefined;\n    }\n    ts.getAncestor = getAncestor;\n    function getFileReferenceFromReferencePath(comment, commentRange) {\n        var simpleReferenceRegEx = /^\\/\\/\\/\\s*<reference\\s+/gim;\n        var isNoDefaultLibRegEx = /^(\\/\\/\\/\\s*<reference\\s+no-default-lib\\s*=\\s*)('|\")(.+?)\\2\\s*\\/>/gim;\n        if (simpleReferenceRegEx.test(comment)) {\n            if (isNoDefaultLibRegEx.test(comment)) {\n                return {\n                    isNoDefaultLib: true\n                };\n            }\n            else {\n                var refMatchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment);\n                var refLibResult = !refMatchResult && ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment);\n                if (refMatchResult || refLibResult) {\n                    var start = commentRange.pos;\n                    var end = commentRange.end;\n                    return {\n                        fileReference: {\n                            pos: start,\n                            end: end,\n                            fileName: (refMatchResult || refLibResult)[3]\n                        },\n                        isNoDefaultLib: false,\n                        isTypeReferenceDirective: !!refLibResult\n                    };\n                }\n                return {\n                    diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax,\n                    isNoDefaultLib: false\n                };\n            }\n        }\n        return undefined;\n    }\n    ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath;\n    function isKeyword(token) {\n        return 71 /* FirstKeyword */ <= token && token <= 140 /* LastKeyword */;\n    }\n    ts.isKeyword = isKeyword;\n    function isTrivia(token) {\n        return 2 /* FirstTriviaToken */ <= token && token <= 7 /* LastTriviaToken */;\n    }\n    ts.isTrivia = isTrivia;\n    function isAsyncFunctionLike(node) {\n        return isFunctionLike(node) && hasModifier(node, 256 /* Async */) && !isAccessor(node);\n    }\n    ts.isAsyncFunctionLike = isAsyncFunctionLike;\n    function isStringOrNumericLiteral(node) {\n        var kind = node.kind;\n        return kind === 9 /* StringLiteral */\n            || kind === 8 /* NumericLiteral */;\n    }\n    ts.isStringOrNumericLiteral = isStringOrNumericLiteral;\n    /**\n     * A declaration has a dynamic name if both of the following are true:\n     *   1. The declaration has a computed property name\n     *   2. The computed name is *not* expressed as Symbol.<name>, where name\n     *      is a property of the Symbol constructor that denotes a built in\n     *      Symbol.\n     */\n    function hasDynamicName(declaration) {\n        return declaration.name && isDynamicName(declaration.name);\n    }\n    ts.hasDynamicName = hasDynamicName;\n    function isDynamicName(name) {\n        return name.kind === 142 /* ComputedPropertyName */ &&\n            !isStringOrNumericLiteral(name.expression) &&\n            !isWellKnownSymbolSyntactically(name.expression);\n    }\n    ts.isDynamicName = isDynamicName;\n    /**\n     * Checks if the expression is of the form:\n     *    Symbol.name\n     * where Symbol is literally the word \"Symbol\", and name is any identifierName\n     */\n    function isWellKnownSymbolSyntactically(node) {\n        return isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression);\n    }\n    ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically;\n    function getPropertyNameForPropertyNameNode(name) {\n        if (name.kind === 70 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */ || name.kind === 144 /* Parameter */) {\n            return name.text;\n        }\n        if (name.kind === 142 /* ComputedPropertyName */) {\n            var nameExpression = name.expression;\n            if (isWellKnownSymbolSyntactically(nameExpression)) {\n                var rightHandSideName = nameExpression.name.text;\n                return getPropertyNameForKnownSymbolName(rightHandSideName);\n            }\n            else if (nameExpression.kind === 9 /* StringLiteral */ || nameExpression.kind === 8 /* NumericLiteral */) {\n                return nameExpression.text;\n            }\n        }\n        return undefined;\n    }\n    ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode;\n    function getPropertyNameForKnownSymbolName(symbolName) {\n        return \"__@\" + symbolName;\n    }\n    ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName;\n    /**\n     * Includes the word \"Symbol\" with unicode escapes\n     */\n    function isESSymbolIdentifier(node) {\n        return node.kind === 70 /* Identifier */ && node.text === \"Symbol\";\n    }\n    ts.isESSymbolIdentifier = isESSymbolIdentifier;\n    function isPushOrUnshiftIdentifier(node) {\n        return node.text === \"push\" || node.text === \"unshift\";\n    }\n    ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier;\n    function isModifierKind(token) {\n        switch (token) {\n            case 116 /* AbstractKeyword */:\n            case 119 /* AsyncKeyword */:\n            case 75 /* ConstKeyword */:\n            case 123 /* DeclareKeyword */:\n            case 78 /* DefaultKeyword */:\n            case 83 /* ExportKeyword */:\n            case 113 /* PublicKeyword */:\n            case 111 /* PrivateKeyword */:\n            case 112 /* ProtectedKeyword */:\n            case 130 /* ReadonlyKeyword */:\n            case 114 /* StaticKeyword */:\n                return true;\n        }\n        return false;\n    }\n    ts.isModifierKind = isModifierKind;\n    function isParameterDeclaration(node) {\n        var root = getRootDeclaration(node);\n        return root.kind === 144 /* Parameter */;\n    }\n    ts.isParameterDeclaration = isParameterDeclaration;\n    function getRootDeclaration(node) {\n        while (node.kind === 174 /* BindingElement */) {\n            node = node.parent.parent;\n        }\n        return node;\n    }\n    ts.getRootDeclaration = getRootDeclaration;\n    function nodeStartsNewLexicalEnvironment(node) {\n        var kind = node.kind;\n        return kind === 150 /* Constructor */\n            || kind === 184 /* FunctionExpression */\n            || kind === 225 /* FunctionDeclaration */\n            || kind === 185 /* ArrowFunction */\n            || kind === 149 /* MethodDeclaration */\n            || kind === 151 /* GetAccessor */\n            || kind === 152 /* SetAccessor */\n            || kind === 230 /* ModuleDeclaration */\n            || kind === 261 /* SourceFile */;\n    }\n    ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment;\n    function nodeIsSynthesized(node) {\n        return ts.positionIsSynthesized(node.pos)\n            || ts.positionIsSynthesized(node.end);\n    }\n    ts.nodeIsSynthesized = nodeIsSynthesized;\n    function getOriginalNode(node, nodeTest) {\n        if (node) {\n            while (node.original !== undefined) {\n                node = node.original;\n            }\n        }\n        return !nodeTest || nodeTest(node) ? node : undefined;\n    }\n    ts.getOriginalNode = getOriginalNode;\n    /**\n     * Gets a value indicating whether a node originated in the parse tree.\n     *\n     * @param node The node to test.\n     */\n    function isParseTreeNode(node) {\n        return (node.flags & 8 /* Synthesized */) === 0;\n    }\n    ts.isParseTreeNode = isParseTreeNode;\n    function getParseTreeNode(node, nodeTest) {\n        if (isParseTreeNode(node)) {\n            return node;\n        }\n        node = getOriginalNode(node);\n        if (isParseTreeNode(node) && (!nodeTest || nodeTest(node))) {\n            return node;\n        }\n        return undefined;\n    }\n    ts.getParseTreeNode = getParseTreeNode;\n    function getOriginalSourceFiles(sourceFiles) {\n        var originalSourceFiles = [];\n        for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) {\n            var sourceFile = sourceFiles_1[_i];\n            var originalSourceFile = getParseTreeNode(sourceFile, isSourceFile);\n            if (originalSourceFile) {\n                originalSourceFiles.push(originalSourceFile);\n            }\n        }\n        return originalSourceFiles;\n    }\n    ts.getOriginalSourceFiles = getOriginalSourceFiles;\n    function getOriginalNodeId(node) {\n        node = getOriginalNode(node);\n        return node ? ts.getNodeId(node) : 0;\n    }\n    ts.getOriginalNodeId = getOriginalNodeId;\n    var Associativity;\n    (function (Associativity) {\n        Associativity[Associativity[\"Left\"] = 0] = \"Left\";\n        Associativity[Associativity[\"Right\"] = 1] = \"Right\";\n    })(Associativity = ts.Associativity || (ts.Associativity = {}));\n    function getExpressionAssociativity(expression) {\n        var operator = getOperator(expression);\n        var hasArguments = expression.kind === 180 /* NewExpression */ && expression.arguments !== undefined;\n        return getOperatorAssociativity(expression.kind, operator, hasArguments);\n    }\n    ts.getExpressionAssociativity = getExpressionAssociativity;\n    function getOperatorAssociativity(kind, operator, hasArguments) {\n        switch (kind) {\n            case 180 /* NewExpression */:\n                return hasArguments ? 0 /* Left */ : 1 /* Right */;\n            case 190 /* PrefixUnaryExpression */:\n            case 187 /* TypeOfExpression */:\n            case 188 /* VoidExpression */:\n            case 186 /* DeleteExpression */:\n            case 189 /* AwaitExpression */:\n            case 193 /* ConditionalExpression */:\n            case 195 /* YieldExpression */:\n                return 1 /* Right */;\n            case 192 /* BinaryExpression */:\n                switch (operator) {\n                    case 39 /* AsteriskAsteriskToken */:\n                    case 57 /* EqualsToken */:\n                    case 58 /* PlusEqualsToken */:\n                    case 59 /* MinusEqualsToken */:\n                    case 61 /* AsteriskAsteriskEqualsToken */:\n                    case 60 /* AsteriskEqualsToken */:\n                    case 62 /* SlashEqualsToken */:\n                    case 63 /* PercentEqualsToken */:\n                    case 64 /* LessThanLessThanEqualsToken */:\n                    case 65 /* GreaterThanGreaterThanEqualsToken */:\n                    case 66 /* GreaterThanGreaterThanGreaterThanEqualsToken */:\n                    case 67 /* AmpersandEqualsToken */:\n                    case 69 /* CaretEqualsToken */:\n                    case 68 /* BarEqualsToken */:\n                        return 1 /* Right */;\n                }\n        }\n        return 0 /* Left */;\n    }\n    ts.getOperatorAssociativity = getOperatorAssociativity;\n    function getExpressionPrecedence(expression) {\n        var operator = getOperator(expression);\n        var hasArguments = expression.kind === 180 /* NewExpression */ && expression.arguments !== undefined;\n        return getOperatorPrecedence(expression.kind, operator, hasArguments);\n    }\n    ts.getExpressionPrecedence = getExpressionPrecedence;\n    function getOperator(expression) {\n        if (expression.kind === 192 /* BinaryExpression */) {\n            return expression.operatorToken.kind;\n        }\n        else if (expression.kind === 190 /* PrefixUnaryExpression */ || expression.kind === 191 /* PostfixUnaryExpression */) {\n            return expression.operator;\n        }\n        else {\n            return expression.kind;\n        }\n    }\n    ts.getOperator = getOperator;\n    function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {\n        switch (nodeKind) {\n            case 98 /* ThisKeyword */:\n            case 96 /* SuperKeyword */:\n            case 70 /* Identifier */:\n            case 94 /* NullKeyword */:\n            case 100 /* TrueKeyword */:\n            case 85 /* FalseKeyword */:\n            case 8 /* NumericLiteral */:\n            case 9 /* StringLiteral */:\n            case 175 /* ArrayLiteralExpression */:\n            case 176 /* ObjectLiteralExpression */:\n            case 184 /* FunctionExpression */:\n            case 185 /* ArrowFunction */:\n            case 197 /* ClassExpression */:\n            case 246 /* JsxElement */:\n            case 247 /* JsxSelfClosingElement */:\n            case 11 /* RegularExpressionLiteral */:\n            case 12 /* NoSubstitutionTemplateLiteral */:\n            case 194 /* TemplateExpression */:\n            case 183 /* ParenthesizedExpression */:\n            case 198 /* OmittedExpression */:\n            case 297 /* RawExpression */:\n                return 19;\n            case 181 /* TaggedTemplateExpression */:\n            case 177 /* PropertyAccessExpression */:\n            case 178 /* ElementAccessExpression */:\n                return 18;\n            case 180 /* NewExpression */:\n                return hasArguments ? 18 : 17;\n            case 179 /* CallExpression */:\n                return 17;\n            case 191 /* PostfixUnaryExpression */:\n                return 16;\n            case 190 /* PrefixUnaryExpression */:\n            case 187 /* TypeOfExpression */:\n            case 188 /* VoidExpression */:\n            case 186 /* DeleteExpression */:\n            case 189 /* AwaitExpression */:\n                return 15;\n            case 192 /* BinaryExpression */:\n                switch (operatorKind) {\n                    case 50 /* ExclamationToken */:\n                    case 51 /* TildeToken */:\n                        return 15;\n                    case 39 /* AsteriskAsteriskToken */:\n                    case 38 /* AsteriskToken */:\n                    case 40 /* SlashToken */:\n                    case 41 /* PercentToken */:\n                        return 14;\n                    case 36 /* PlusToken */:\n                    case 37 /* MinusToken */:\n                        return 13;\n                    case 44 /* LessThanLessThanToken */:\n                    case 45 /* GreaterThanGreaterThanToken */:\n                    case 46 /* GreaterThanGreaterThanGreaterThanToken */:\n                        return 12;\n                    case 26 /* LessThanToken */:\n                    case 29 /* LessThanEqualsToken */:\n                    case 28 /* GreaterThanToken */:\n                    case 30 /* GreaterThanEqualsToken */:\n                    case 91 /* InKeyword */:\n                    case 92 /* InstanceOfKeyword */:\n                        return 11;\n                    case 31 /* EqualsEqualsToken */:\n                    case 33 /* EqualsEqualsEqualsToken */:\n                    case 32 /* ExclamationEqualsToken */:\n                    case 34 /* ExclamationEqualsEqualsToken */:\n                        return 10;\n                    case 47 /* AmpersandToken */:\n                        return 9;\n                    case 49 /* CaretToken */:\n                        return 8;\n                    case 48 /* BarToken */:\n                        return 7;\n                    case 52 /* AmpersandAmpersandToken */:\n                        return 6;\n                    case 53 /* BarBarToken */:\n                        return 5;\n                    case 57 /* EqualsToken */:\n                    case 58 /* PlusEqualsToken */:\n                    case 59 /* MinusEqualsToken */:\n                    case 61 /* AsteriskAsteriskEqualsToken */:\n                    case 60 /* AsteriskEqualsToken */:\n                    case 62 /* SlashEqualsToken */:\n                    case 63 /* PercentEqualsToken */:\n                    case 64 /* LessThanLessThanEqualsToken */:\n                    case 65 /* GreaterThanGreaterThanEqualsToken */:\n                    case 66 /* GreaterThanGreaterThanGreaterThanEqualsToken */:\n                    case 67 /* AmpersandEqualsToken */:\n                    case 69 /* CaretEqualsToken */:\n                    case 68 /* BarEqualsToken */:\n                        return 3;\n                    case 25 /* CommaToken */:\n                        return 0;\n                    default:\n                        return -1;\n                }\n            case 193 /* ConditionalExpression */:\n                return 4;\n            case 195 /* YieldExpression */:\n                return 2;\n            case 196 /* SpreadElement */:\n                return 1;\n            default:\n                return -1;\n        }\n    }\n    ts.getOperatorPrecedence = getOperatorPrecedence;\n    function createDiagnosticCollection() {\n        var nonFileDiagnostics = [];\n        var fileDiagnostics = ts.createMap();\n        var diagnosticsModified = false;\n        var modificationCount = 0;\n        return {\n            add: add,\n            getGlobalDiagnostics: getGlobalDiagnostics,\n            getDiagnostics: getDiagnostics,\n            getModificationCount: getModificationCount,\n            reattachFileDiagnostics: reattachFileDiagnostics\n        };\n        function getModificationCount() {\n            return modificationCount;\n        }\n        function reattachFileDiagnostics(newFile) {\n            if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) {\n                return;\n            }\n            for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) {\n                var diagnostic = _a[_i];\n                diagnostic.file = newFile;\n            }\n        }\n        function add(diagnostic) {\n            var diagnostics;\n            if (diagnostic.file) {\n                diagnostics = fileDiagnostics[diagnostic.file.fileName];\n                if (!diagnostics) {\n                    diagnostics = [];\n                    fileDiagnostics[diagnostic.file.fileName] = diagnostics;\n                }\n            }\n            else {\n                diagnostics = nonFileDiagnostics;\n            }\n            diagnostics.push(diagnostic);\n            diagnosticsModified = true;\n            modificationCount++;\n        }\n        function getGlobalDiagnostics() {\n            sortAndDeduplicate();\n            return nonFileDiagnostics;\n        }\n        function getDiagnostics(fileName) {\n            sortAndDeduplicate();\n            if (fileName) {\n                return fileDiagnostics[fileName] || [];\n            }\n            var allDiagnostics = [];\n            function pushDiagnostic(d) {\n                allDiagnostics.push(d);\n            }\n            ts.forEach(nonFileDiagnostics, pushDiagnostic);\n            for (var key in fileDiagnostics) {\n                ts.forEach(fileDiagnostics[key], pushDiagnostic);\n            }\n            return ts.sortAndDeduplicateDiagnostics(allDiagnostics);\n        }\n        function sortAndDeduplicate() {\n            if (!diagnosticsModified) {\n                return;\n            }\n            diagnosticsModified = false;\n            nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics);\n            for (var key in fileDiagnostics) {\n                fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]);\n            }\n        }\n    }\n    ts.createDiagnosticCollection = createDiagnosticCollection;\n    // This consists of the first 19 unprintable ASCII characters, canonical escapes, lineSeparator,\n    // paragraphSeparator, and nextLine. The latter three are just desirable to suppress new lines in\n    // the language service. These characters should be escaped when printing, and if any characters are added,\n    // the map below must be updated. Note that this regexp *does not* include the 'delete' character.\n    // There is no reason for this other than that JSON.stringify does not handle it either.\n    var escapedCharsRegExp = /[\\\\\\\"\\u0000-\\u001f\\t\\v\\f\\b\\r\\n\\u2028\\u2029\\u0085]/g;\n    var escapedCharsMap = ts.createMap({\n        \"\\0\": \"\\\\0\",\n        \"\\t\": \"\\\\t\",\n        \"\\v\": \"\\\\v\",\n        \"\\f\": \"\\\\f\",\n        \"\\b\": \"\\\\b\",\n        \"\\r\": \"\\\\r\",\n        \"\\n\": \"\\\\n\",\n        \"\\\\\": \"\\\\\\\\\",\n        \"\\\"\": \"\\\\\\\"\",\n        \"\\u2028\": \"\\\\u2028\",\n        \"\\u2029\": \"\\\\u2029\",\n        \"\\u0085\": \"\\\\u0085\" // nextLine\n    });\n    /**\n     * Based heavily on the abstract 'Quote'/'QuoteJSONString' operation from ECMA-262 (24.3.2.2),\n     * but augmented for a few select characters (e.g. lineSeparator, paragraphSeparator, nextLine)\n     * Note that this doesn't actually wrap the input in double quotes.\n     */\n    function escapeString(s) {\n        s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s;\n        return s;\n        function getReplacement(c) {\n            return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0));\n        }\n    }\n    ts.escapeString = escapeString;\n    function isIntrinsicJsxName(name) {\n        var ch = name.substr(0, 1);\n        return ch.toLowerCase() === ch;\n    }\n    ts.isIntrinsicJsxName = isIntrinsicJsxName;\n    function get16BitUnicodeEscapeSequence(charCode) {\n        var hexCharCode = charCode.toString(16).toUpperCase();\n        var paddedHexCode = (\"0000\" + hexCharCode).slice(-4);\n        return \"\\\\u\" + paddedHexCode;\n    }\n    var nonAsciiCharacters = /[^\\u0000-\\u007F]/g;\n    function escapeNonAsciiCharacters(s) {\n        // Replace non-ASCII characters with '\\uNNNN' escapes if any exist.\n        // Otherwise just return the original string.\n        return nonAsciiCharacters.test(s) ?\n            s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) :\n            s;\n    }\n    ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters;\n    var indentStrings = [\"\", \"    \"];\n    function getIndentString(level) {\n        if (indentStrings[level] === undefined) {\n            indentStrings[level] = getIndentString(level - 1) + indentStrings[1];\n        }\n        return indentStrings[level];\n    }\n    ts.getIndentString = getIndentString;\n    function getIndentSize() {\n        return indentStrings[1].length;\n    }\n    ts.getIndentSize = getIndentSize;\n    function createTextWriter(newLine) {\n        var output;\n        var indent;\n        var lineStart;\n        var lineCount;\n        var linePos;\n        function write(s) {\n            if (s && s.length) {\n                if (lineStart) {\n                    output += getIndentString(indent);\n                    lineStart = false;\n                }\n                output += s;\n            }\n        }\n        function reset() {\n            output = \"\";\n            indent = 0;\n            lineStart = true;\n            lineCount = 0;\n            linePos = 0;\n        }\n        function rawWrite(s) {\n            if (s !== undefined) {\n                if (lineStart) {\n                    lineStart = false;\n                }\n                output += s;\n            }\n        }\n        function writeLiteral(s) {\n            if (s && s.length) {\n                write(s);\n                var lineStartsOfS = ts.computeLineStarts(s);\n                if (lineStartsOfS.length > 1) {\n                    lineCount = lineCount + lineStartsOfS.length - 1;\n                    linePos = output.length - s.length + ts.lastOrUndefined(lineStartsOfS);\n                }\n            }\n        }\n        function writeLine() {\n            if (!lineStart) {\n                output += newLine;\n                lineCount++;\n                linePos = output.length;\n                lineStart = true;\n            }\n        }\n        function writeTextOfNode(text, node) {\n            write(getTextOfNodeFromSourceText(text, node));\n        }\n        reset();\n        return {\n            write: write,\n            rawWrite: rawWrite,\n            writeTextOfNode: writeTextOfNode,\n            writeLiteral: writeLiteral,\n            writeLine: writeLine,\n            increaseIndent: function () { indent++; },\n            decreaseIndent: function () { indent--; },\n            getIndent: function () { return indent; },\n            getTextPos: function () { return output.length; },\n            getLine: function () { return lineCount + 1; },\n            getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; },\n            getText: function () { return output; },\n            isAtStartOfLine: function () { return lineStart; },\n            reset: reset\n        };\n    }\n    ts.createTextWriter = createTextWriter;\n    function getResolvedExternalModuleName(host, file) {\n        return file.moduleName || getExternalModuleNameFromPath(host, file.fileName);\n    }\n    ts.getResolvedExternalModuleName = getResolvedExternalModuleName;\n    function getExternalModuleNameFromDeclaration(host, resolver, declaration) {\n        var file = resolver.getExternalModuleFileFromDeclaration(declaration);\n        if (!file || isDeclarationFile(file)) {\n            return undefined;\n        }\n        return getResolvedExternalModuleName(host, file);\n    }\n    ts.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration;\n    /**\n     * Resolves a local path to a path which is absolute to the base of the emit\n     */\n    function getExternalModuleNameFromPath(host, fileName) {\n        var getCanonicalFileName = function (f) { return host.getCanonicalFileName(f); };\n        var dir = ts.toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName);\n        var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());\n        var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);\n        return ts.removeFileExtension(relativePath);\n    }\n    ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath;\n    function getOwnEmitOutputFilePath(sourceFile, host, extension) {\n        var compilerOptions = host.getCompilerOptions();\n        var emitOutputFilePathWithoutExtension;\n        if (compilerOptions.outDir) {\n            emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir));\n        }\n        else {\n            emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName);\n        }\n        return emitOutputFilePathWithoutExtension + extension;\n    }\n    ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath;\n    function getDeclarationEmitOutputFilePath(sourceFile, host) {\n        var options = host.getCompilerOptions();\n        var outputDir = options.declarationDir || options.outDir; // Prefer declaration folder if specified\n        var path = outputDir\n            ? getSourceFilePathInNewDir(sourceFile, host, outputDir)\n            : sourceFile.fileName;\n        return ts.removeFileExtension(path) + \".d.ts\";\n    }\n    ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath;\n    /**\n     * Gets the source files that are expected to have an emit output.\n     *\n     * Originally part of `forEachExpectedEmitFile`, this functionality was extracted to support\n     * transformations.\n     *\n     * @param host An EmitHost.\n     * @param targetSourceFile An optional target source file to emit.\n     */\n    function getSourceFilesToEmit(host, targetSourceFile) {\n        var options = host.getCompilerOptions();\n        if (options.outFile || options.out) {\n            var moduleKind = ts.getEmitModuleKind(options);\n            var moduleEmitEnabled = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System;\n            var sourceFiles = getAllEmittableSourceFiles();\n            // Can emit only sources that are not declaration file and are either non module code or module with --module or --target es6 specified\n            return ts.filter(sourceFiles, moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule);\n        }\n        else {\n            var sourceFiles = targetSourceFile === undefined ? getAllEmittableSourceFiles() : [targetSourceFile];\n            return filterSourceFilesInDirectory(sourceFiles, function (file) { return host.isSourceFileFromExternalLibrary(file); });\n        }\n        function getAllEmittableSourceFiles() {\n            return options.noEmitForJsFiles ? ts.filter(host.getSourceFiles(), function (sourceFile) { return !isSourceFileJavaScript(sourceFile); }) : host.getSourceFiles();\n        }\n    }\n    ts.getSourceFilesToEmit = getSourceFilesToEmit;\n    /** Don't call this for `--outFile`, just for `--outDir` or plain emit. */\n    function filterSourceFilesInDirectory(sourceFiles, isSourceFileFromExternalLibrary) {\n        return ts.filter(sourceFiles, function (file) { return shouldEmitInDirectory(file, isSourceFileFromExternalLibrary); });\n    }\n    ts.filterSourceFilesInDirectory = filterSourceFilesInDirectory;\n    function isNonDeclarationFile(sourceFile) {\n        return !isDeclarationFile(sourceFile);\n    }\n    /**\n     * Whether a file should be emitted in a non-`--outFile` case.\n     * Don't emit if source file is a declaration file, or was located under node_modules\n     */\n    function shouldEmitInDirectory(sourceFile, isSourceFileFromExternalLibrary) {\n        return isNonDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile);\n    }\n    function isBundleEmitNonExternalModule(sourceFile) {\n        return isNonDeclarationFile(sourceFile) && !ts.isExternalModule(sourceFile);\n    }\n    /**\n     * Iterates over each source file to emit. The source files are expected to have been\n     * transformed for use by the pretty printer.\n     *\n     * Originally part of `forEachExpectedEmitFile`, this functionality was extracted to support\n     * transformations.\n     *\n     * @param host An EmitHost.\n     * @param sourceFiles The transformed source files to emit.\n     * @param action The action to execute.\n     */\n    function forEachTransformedEmitFile(host, sourceFiles, action, emitOnlyDtsFiles) {\n        var options = host.getCompilerOptions();\n        // Emit on each source file\n        if (options.outFile || options.out) {\n            onBundledEmit(sourceFiles);\n        }\n        else {\n            for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) {\n                var sourceFile = sourceFiles_2[_i];\n                // Don't emit if source file is a declaration file, or was located under node_modules\n                if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) {\n                    onSingleFileEmit(host, sourceFile);\n                }\n            }\n        }\n        function onSingleFileEmit(host, sourceFile) {\n            // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also.\n            // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve.\n            // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve\n            var extension = \".js\";\n            if (options.jsx === 1 /* Preserve */) {\n                if (isSourceFileJavaScript(sourceFile)) {\n                    if (ts.fileExtensionIs(sourceFile.fileName, \".jsx\")) {\n                        extension = \".jsx\";\n                    }\n                }\n                else if (sourceFile.languageVariant === 1 /* JSX */) {\n                    // TypeScript source file preserving JSX syntax\n                    extension = \".jsx\";\n                }\n            }\n            var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension);\n            var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options);\n            var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (options.declaration || emitOnlyDtsFiles) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined;\n            action(jsFilePath, sourceMapFilePath, declarationFilePath, [sourceFile], /*isBundledEmit*/ false);\n        }\n        function onBundledEmit(sourceFiles) {\n            if (sourceFiles.length) {\n                var jsFilePath = options.outFile || options.out;\n                var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options);\n                var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + \".d.ts\" : undefined;\n                action(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, /*isBundledEmit*/ true);\n            }\n        }\n    }\n    ts.forEachTransformedEmitFile = forEachTransformedEmitFile;\n    function getSourceMapFilePath(jsFilePath, options) {\n        return options.sourceMap ? jsFilePath + \".map\" : undefined;\n    }\n    /**\n     * Iterates over the source files that are expected to have an emit output. This function\n     * is used by the legacy emitter and the declaration emitter and should not be used by\n     * the tree transforming emitter.\n     *\n     * @param host An EmitHost.\n     * @param action The action to execute.\n     * @param targetSourceFile An optional target source file to emit.\n     */\n    function forEachExpectedEmitFile(host, action, targetSourceFile, emitOnlyDtsFiles) {\n        var options = host.getCompilerOptions();\n        // Emit on each source file\n        if (options.outFile || options.out) {\n            onBundledEmit(host);\n        }\n        else {\n            var sourceFiles = targetSourceFile === undefined ? getSourceFilesToEmit(host) : [targetSourceFile];\n            for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) {\n                var sourceFile = sourceFiles_3[_i];\n                if (shouldEmitInDirectory(sourceFile, function (file) { return host.isSourceFileFromExternalLibrary(file); })) {\n                    onSingleFileEmit(host, sourceFile);\n                }\n            }\n        }\n        function onSingleFileEmit(host, sourceFile) {\n            // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also.\n            // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve.\n            // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve\n            var extension = \".js\";\n            if (options.jsx === 1 /* Preserve */) {\n                if (isSourceFileJavaScript(sourceFile)) {\n                    if (ts.fileExtensionIs(sourceFile.fileName, \".jsx\")) {\n                        extension = \".jsx\";\n                    }\n                }\n                else if (sourceFile.languageVariant === 1 /* JSX */) {\n                    // TypeScript source file preserving JSX syntax\n                    extension = \".jsx\";\n                }\n            }\n            var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension);\n            var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined;\n            var emitFileNames = {\n                jsFilePath: jsFilePath,\n                sourceMapFilePath: getSourceMapFilePath(jsFilePath, options),\n                declarationFilePath: declarationFilePath\n            };\n            action(emitFileNames, [sourceFile], /*isBundledEmit*/ false, emitOnlyDtsFiles);\n        }\n        function onBundledEmit(host) {\n            // Can emit only sources that are not declaration file and are either non module code or module with\n            // --module or --target es6 specified. Files included by searching under node_modules are also not emitted.\n            var bundledSources = ts.filter(getSourceFilesToEmit(host), function (sourceFile) { return !isDeclarationFile(sourceFile) &&\n                !host.isSourceFileFromExternalLibrary(sourceFile) &&\n                (!ts.isExternalModule(sourceFile) ||\n                    !!ts.getEmitModuleKind(options)); });\n            if (bundledSources.length) {\n                var jsFilePath = options.outFile || options.out;\n                var emitFileNames = {\n                    jsFilePath: jsFilePath,\n                    sourceMapFilePath: getSourceMapFilePath(jsFilePath, options),\n                    declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + \".d.ts\" : undefined\n                };\n                action(emitFileNames, bundledSources, /*isBundledEmit*/ true, emitOnlyDtsFiles);\n            }\n        }\n    }\n    ts.forEachExpectedEmitFile = forEachExpectedEmitFile;\n    function getSourceFilePathInNewDir(sourceFile, host, newDirPath) {\n        var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory());\n        var commonSourceDirectory = host.getCommonSourceDirectory();\n        var isSourceFileInCommonSourceDirectory = host.getCanonicalFileName(sourceFilePath).indexOf(host.getCanonicalFileName(commonSourceDirectory)) === 0;\n        sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath;\n        return ts.combinePaths(newDirPath, sourceFilePath);\n    }\n    ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir;\n    function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) {\n        host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) {\n            diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));\n        }, sourceFiles);\n    }\n    ts.writeFile = writeFile;\n    function getLineOfLocalPosition(currentSourceFile, pos) {\n        return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line;\n    }\n    ts.getLineOfLocalPosition = getLineOfLocalPosition;\n    function getLineOfLocalPositionFromLineMap(lineMap, pos) {\n        return ts.computeLineAndCharacterOfPosition(lineMap, pos).line;\n    }\n    ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap;\n    function getFirstConstructorWithBody(node) {\n        return ts.forEach(node.members, function (member) {\n            if (member.kind === 150 /* Constructor */ && nodeIsPresent(member.body)) {\n                return member;\n            }\n        });\n    }\n    ts.getFirstConstructorWithBody = getFirstConstructorWithBody;\n    /** Get the type annotaion for the value parameter. */\n    function getSetAccessorTypeAnnotationNode(accessor) {\n        if (accessor && accessor.parameters.length > 0) {\n            var hasThis = accessor.parameters.length === 2 && parameterIsThisKeyword(accessor.parameters[0]);\n            return accessor.parameters[hasThis ? 1 : 0].type;\n        }\n    }\n    ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode;\n    function getThisParameter(signature) {\n        if (signature.parameters.length) {\n            var thisParameter = signature.parameters[0];\n            if (parameterIsThisKeyword(thisParameter)) {\n                return thisParameter;\n            }\n        }\n    }\n    ts.getThisParameter = getThisParameter;\n    function parameterIsThisKeyword(parameter) {\n        return isThisIdentifier(parameter.name);\n    }\n    ts.parameterIsThisKeyword = parameterIsThisKeyword;\n    function isThisIdentifier(node) {\n        return node && node.kind === 70 /* Identifier */ && identifierIsThisKeyword(node);\n    }\n    ts.isThisIdentifier = isThisIdentifier;\n    function identifierIsThisKeyword(id) {\n        return id.originalKeywordKind === 98 /* ThisKeyword */;\n    }\n    ts.identifierIsThisKeyword = identifierIsThisKeyword;\n    function getAllAccessorDeclarations(declarations, accessor) {\n        var firstAccessor;\n        var secondAccessor;\n        var getAccessor;\n        var setAccessor;\n        if (hasDynamicName(accessor)) {\n            firstAccessor = accessor;\n            if (accessor.kind === 151 /* GetAccessor */) {\n                getAccessor = accessor;\n            }\n            else if (accessor.kind === 152 /* SetAccessor */) {\n                setAccessor = accessor;\n            }\n            else {\n                ts.Debug.fail(\"Accessor has wrong kind\");\n            }\n        }\n        else {\n            ts.forEach(declarations, function (member) {\n                if ((member.kind === 151 /* GetAccessor */ || member.kind === 152 /* SetAccessor */)\n                    && hasModifier(member, 32 /* Static */) === hasModifier(accessor, 32 /* Static */)) {\n                    var memberName = getPropertyNameForPropertyNameNode(member.name);\n                    var accessorName = getPropertyNameForPropertyNameNode(accessor.name);\n                    if (memberName === accessorName) {\n                        if (!firstAccessor) {\n                            firstAccessor = member;\n                        }\n                        else if (!secondAccessor) {\n                            secondAccessor = member;\n                        }\n                        if (member.kind === 151 /* GetAccessor */ && !getAccessor) {\n                            getAccessor = member;\n                        }\n                        if (member.kind === 152 /* SetAccessor */ && !setAccessor) {\n                            setAccessor = member;\n                        }\n                    }\n                }\n            });\n        }\n        return {\n            firstAccessor: firstAccessor,\n            secondAccessor: secondAccessor,\n            getAccessor: getAccessor,\n            setAccessor: setAccessor\n        };\n    }\n    ts.getAllAccessorDeclarations = getAllAccessorDeclarations;\n    function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) {\n        emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, node.pos, leadingComments);\n    }\n    ts.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments;\n    function emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, pos, leadingComments) {\n        // If the leading comments start on different line than the start of node, write new line\n        if (leadingComments && leadingComments.length && pos !== leadingComments[0].pos &&\n            getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) {\n            writer.writeLine();\n        }\n    }\n    ts.emitNewLineBeforeLeadingCommentsOfPosition = emitNewLineBeforeLeadingCommentsOfPosition;\n    function emitNewLineBeforeLeadingCommentOfPosition(lineMap, writer, pos, commentPos) {\n        // If the leading comments start on different line than the start of node, write new line\n        if (pos !== commentPos &&\n            getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, commentPos)) {\n            writer.writeLine();\n        }\n    }\n    ts.emitNewLineBeforeLeadingCommentOfPosition = emitNewLineBeforeLeadingCommentOfPosition;\n    function emitComments(text, lineMap, writer, comments, leadingSeparator, trailingSeparator, newLine, writeComment) {\n        if (comments && comments.length > 0) {\n            if (leadingSeparator) {\n                writer.write(\" \");\n            }\n            var emitInterveningSeparator = false;\n            for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) {\n                var comment = comments_1[_i];\n                if (emitInterveningSeparator) {\n                    writer.write(\" \");\n                    emitInterveningSeparator = false;\n                }\n                writeComment(text, lineMap, writer, comment.pos, comment.end, newLine);\n                if (comment.hasTrailingNewLine) {\n                    writer.writeLine();\n                }\n                else {\n                    emitInterveningSeparator = true;\n                }\n            }\n            if (emitInterveningSeparator && trailingSeparator) {\n                writer.write(\" \");\n            }\n        }\n    }\n    ts.emitComments = emitComments;\n    /**\n     * Detached comment is a comment at the top of file or function body that is separated from\n     * the next statement by space.\n     */\n    function emitDetachedComments(text, lineMap, writer, writeComment, node, newLine, removeComments) {\n        var leadingComments;\n        var currentDetachedCommentInfo;\n        if (removeComments) {\n            // removeComments is true, only reserve pinned comment at the top of file\n            // For example:\n            //      /*! Pinned Comment */\n            //\n            //      var x = 10;\n            if (node.pos === 0) {\n                leadingComments = ts.filter(ts.getLeadingCommentRanges(text, node.pos), isPinnedComment);\n            }\n        }\n        else {\n            // removeComments is false, just get detached as normal and bypass the process to filter comment\n            leadingComments = ts.getLeadingCommentRanges(text, node.pos);\n        }\n        if (leadingComments) {\n            var detachedComments = [];\n            var lastComment = void 0;\n            for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) {\n                var comment = leadingComments_1[_i];\n                if (lastComment) {\n                    var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end);\n                    var commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos);\n                    if (commentLine >= lastCommentLine + 2) {\n                        // There was a blank line between the last comment and this comment.  This\n                        // comment is not part of the copyright comments.  Return what we have so\n                        // far.\n                        break;\n                    }\n                }\n                detachedComments.push(comment);\n                lastComment = comment;\n            }\n            if (detachedComments.length) {\n                // All comments look like they could have been part of the copyright header.  Make\n                // sure there is at least one blank line between it and the node.  If not, it's not\n                // a copyright header.\n                var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, ts.lastOrUndefined(detachedComments).end);\n                var nodeLine = getLineOfLocalPositionFromLineMap(lineMap, ts.skipTrivia(text, node.pos));\n                if (nodeLine >= lastCommentLine + 2) {\n                    // Valid detachedComments\n                    emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments);\n                    emitComments(text, lineMap, writer, detachedComments, /*leadingSeparator*/ false, /*trailingSeparator*/ true, newLine, writeComment);\n                    currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end };\n                }\n            }\n        }\n        return currentDetachedCommentInfo;\n        function isPinnedComment(comment) {\n            return text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ &&\n                text.charCodeAt(comment.pos + 2) === 33 /* exclamation */;\n        }\n    }\n    ts.emitDetachedComments = emitDetachedComments;\n    function writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine) {\n        if (text.charCodeAt(commentPos + 1) === 42 /* asterisk */) {\n            var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, commentPos);\n            var lineCount = lineMap.length;\n            var firstCommentLineIndent = void 0;\n            for (var pos = commentPos, currentLine = firstCommentLineAndCharacter.line; pos < commentEnd; currentLine++) {\n                var nextLineStart = (currentLine + 1) === lineCount\n                    ? text.length + 1\n                    : lineMap[currentLine + 1];\n                if (pos !== commentPos) {\n                    // If we are not emitting first line, we need to write the spaces to adjust the alignment\n                    if (firstCommentLineIndent === undefined) {\n                        firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], commentPos);\n                    }\n                    // These are number of spaces writer is going to write at current indent\n                    var currentWriterIndentSpacing = writer.getIndent() * getIndentSize();\n                    // Number of spaces we want to be writing\n                    // eg: Assume writer indent\n                    // module m {\n                    //         /* starts at character 9 this is line 1\n                    //    * starts at character pos 4 line                        --1  = 8 - 8 + 3\n                    //   More left indented comment */                            --2  = 8 - 8 + 2\n                    //     class c { }\n                    // }\n                    // module m {\n                    //     /* this is line 1 -- Assume current writer indent 8\n                    //      * line                                                --3 = 8 - 4 + 5\n                    //            More right indented comment */                  --4 = 8 - 4 + 11\n                    //     class c { }\n                    // }\n                    var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart);\n                    if (spacesToEmit > 0) {\n                        var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize();\n                        var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize());\n                        // Write indent size string ( in eg 1: = \"\", 2: \"\" , 3: string with 8 spaces 4: string with 12 spaces\n                        writer.rawWrite(indentSizeSpaceString);\n                        // Emit the single spaces (in eg: 1: 3 spaces, 2: 2 spaces, 3: 1 space, 4: 3 spaces)\n                        while (numberOfSingleSpacesToEmit) {\n                            writer.rawWrite(\" \");\n                            numberOfSingleSpacesToEmit--;\n                        }\n                    }\n                    else {\n                        // No spaces to emit write empty string\n                        writer.rawWrite(\"\");\n                    }\n                }\n                // Write the comment line text\n                writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart);\n                pos = nextLineStart;\n            }\n        }\n        else {\n            // Single line comment of style //....\n            writer.write(text.substring(commentPos, commentEnd));\n        }\n    }\n    ts.writeCommentRange = writeCommentRange;\n    function writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart) {\n        var end = Math.min(commentEnd, nextLineStart - 1);\n        var currentLineText = text.substring(pos, end).replace(/^\\s+|\\s+$/g, \"\");\n        if (currentLineText) {\n            // trimmed forward and ending spaces text\n            writer.write(currentLineText);\n            if (end !== commentEnd) {\n                writer.writeLine();\n            }\n        }\n        else {\n            // Empty string - make sure we write empty line\n            writer.writeLiteral(newLine);\n        }\n    }\n    function calculateIndent(text, pos, end) {\n        var currentLineIndent = 0;\n        for (; pos < end && ts.isWhiteSpaceSingleLine(text.charCodeAt(pos)); pos++) {\n            if (text.charCodeAt(pos) === 9 /* tab */) {\n                // Tabs = TabSize = indent size and go to next tabStop\n                currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize());\n            }\n            else {\n                // Single space\n                currentLineIndent++;\n            }\n        }\n        return currentLineIndent;\n    }\n    function hasModifiers(node) {\n        return getModifierFlags(node) !== 0 /* None */;\n    }\n    ts.hasModifiers = hasModifiers;\n    function hasModifier(node, flags) {\n        return (getModifierFlags(node) & flags) !== 0;\n    }\n    ts.hasModifier = hasModifier;\n    function getModifierFlags(node) {\n        if (node.modifierFlagsCache & 536870912 /* HasComputedFlags */) {\n            return node.modifierFlagsCache & ~536870912 /* HasComputedFlags */;\n        }\n        var flags = 0 /* None */;\n        if (node.modifiers) {\n            for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {\n                var modifier = _a[_i];\n                flags |= modifierToFlag(modifier.kind);\n            }\n        }\n        if (node.flags & 4 /* NestedNamespace */ || (node.kind === 70 /* Identifier */ && node.isInJSDocNamespace)) {\n            flags |= 1 /* Export */;\n        }\n        node.modifierFlagsCache = flags | 536870912 /* HasComputedFlags */;\n        return flags;\n    }\n    ts.getModifierFlags = getModifierFlags;\n    function modifierToFlag(token) {\n        switch (token) {\n            case 114 /* StaticKeyword */: return 32 /* Static */;\n            case 113 /* PublicKeyword */: return 4 /* Public */;\n            case 112 /* ProtectedKeyword */: return 16 /* Protected */;\n            case 111 /* PrivateKeyword */: return 8 /* Private */;\n            case 116 /* AbstractKeyword */: return 128 /* Abstract */;\n            case 83 /* ExportKeyword */: return 1 /* Export */;\n            case 123 /* DeclareKeyword */: return 2 /* Ambient */;\n            case 75 /* ConstKeyword */: return 2048 /* Const */;\n            case 78 /* DefaultKeyword */: return 512 /* Default */;\n            case 119 /* AsyncKeyword */: return 256 /* Async */;\n            case 130 /* ReadonlyKeyword */: return 64 /* Readonly */;\n        }\n        return 0 /* None */;\n    }\n    ts.modifierToFlag = modifierToFlag;\n    function isLogicalOperator(token) {\n        return token === 53 /* BarBarToken */\n            || token === 52 /* AmpersandAmpersandToken */\n            || token === 50 /* ExclamationToken */;\n    }\n    ts.isLogicalOperator = isLogicalOperator;\n    function isAssignmentOperator(token) {\n        return token >= 57 /* FirstAssignment */ && token <= 69 /* LastAssignment */;\n    }\n    ts.isAssignmentOperator = isAssignmentOperator;\n    /** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */\n    function tryGetClassExtendingExpressionWithTypeArguments(node) {\n        if (node.kind === 199 /* ExpressionWithTypeArguments */ &&\n            node.parent.token === 84 /* ExtendsKeyword */ &&\n            isClassLike(node.parent.parent)) {\n            return node.parent.parent;\n        }\n    }\n    ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments;\n    function isAssignmentExpression(node, excludeCompoundAssignment) {\n        return isBinaryExpression(node)\n            && (excludeCompoundAssignment\n                ? node.operatorToken.kind === 57 /* EqualsToken */\n                : isAssignmentOperator(node.operatorToken.kind))\n            && isLeftHandSideExpression(node.left);\n    }\n    ts.isAssignmentExpression = isAssignmentExpression;\n    function isDestructuringAssignment(node) {\n        if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) {\n            var kind = node.left.kind;\n            return kind === 176 /* ObjectLiteralExpression */\n                || kind === 175 /* ArrayLiteralExpression */;\n        }\n        return false;\n    }\n    ts.isDestructuringAssignment = isDestructuringAssignment;\n    // Returns false if this heritage clause element's expression contains something unsupported\n    // (i.e. not a name or dotted name).\n    function isSupportedExpressionWithTypeArguments(node) {\n        return isSupportedExpressionWithTypeArgumentsRest(node.expression);\n    }\n    ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments;\n    function isSupportedExpressionWithTypeArgumentsRest(node) {\n        if (node.kind === 70 /* Identifier */) {\n            return true;\n        }\n        else if (isPropertyAccessExpression(node)) {\n            return isSupportedExpressionWithTypeArgumentsRest(node.expression);\n        }\n        else {\n            return false;\n        }\n    }\n    function isExpressionWithTypeArgumentsInClassExtendsClause(node) {\n        return tryGetClassExtendingExpressionWithTypeArguments(node) !== undefined;\n    }\n    ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause;\n    function isEntityNameExpression(node) {\n        return node.kind === 70 /* Identifier */ ||\n            node.kind === 177 /* PropertyAccessExpression */ && isEntityNameExpression(node.expression);\n    }\n    ts.isEntityNameExpression = isEntityNameExpression;\n    function isRightSideOfQualifiedNameOrPropertyAccess(node) {\n        return (node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node) ||\n            (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node);\n    }\n    ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;\n    function isEmptyObjectLiteralOrArrayLiteral(expression) {\n        var kind = expression.kind;\n        if (kind === 176 /* ObjectLiteralExpression */) {\n            return expression.properties.length === 0;\n        }\n        if (kind === 175 /* ArrayLiteralExpression */) {\n            return expression.elements.length === 0;\n        }\n        return false;\n    }\n    ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral;\n    function getLocalSymbolForExportDefault(symbol) {\n        return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined;\n    }\n    ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault;\n    /** Return \".ts\", \".d.ts\", or \".tsx\", if that is the extension. */\n    function tryExtractTypeScriptExtension(fileName) {\n        return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); });\n    }\n    ts.tryExtractTypeScriptExtension = tryExtractTypeScriptExtension;\n    /**\n     * Replace each instance of non-ascii characters by one, two, three, or four escape sequences\n     * representing the UTF-8 encoding of the character, and return the expanded char code list.\n     */\n    function getExpandedCharCodes(input) {\n        var output = [];\n        var length = input.length;\n        for (var i = 0; i < length; i++) {\n            var charCode = input.charCodeAt(i);\n            // handel utf8\n            if (charCode < 0x80) {\n                output.push(charCode);\n            }\n            else if (charCode < 0x800) {\n                output.push((charCode >> 6) | 192);\n                output.push((charCode & 63) | 128);\n            }\n            else if (charCode < 0x10000) {\n                output.push((charCode >> 12) | 224);\n                output.push(((charCode >> 6) & 63) | 128);\n                output.push((charCode & 63) | 128);\n            }\n            else if (charCode < 0x20000) {\n                output.push((charCode >> 18) | 240);\n                output.push(((charCode >> 12) & 63) | 128);\n                output.push(((charCode >> 6) & 63) | 128);\n                output.push((charCode & 63) | 128);\n            }\n            else {\n                ts.Debug.assert(false, \"Unexpected code point\");\n            }\n        }\n        return output;\n    }\n    /**\n     * Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph\n     * as the fallback implementation does not check for circular references by default.\n     */\n    ts.stringify = typeof JSON !== \"undefined\" && JSON.stringify\n        ? JSON.stringify\n        : stringifyFallback;\n    /**\n     * Serialize an object graph into a JSON string.\n     */\n    function stringifyFallback(value) {\n        // JSON.stringify returns `undefined` here, instead of the string \"undefined\".\n        return value === undefined ? undefined : stringifyValue(value);\n    }\n    function stringifyValue(value) {\n        return typeof value === \"string\" ? \"\\\"\" + escapeString(value) + \"\\\"\"\n            : typeof value === \"number\" ? isFinite(value) ? String(value) : \"null\"\n                : typeof value === \"boolean\" ? value ? \"true\" : \"false\"\n                    : typeof value === \"object\" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value)\n                        : \"null\";\n    }\n    function cycleCheck(cb, value) {\n        ts.Debug.assert(!value.hasOwnProperty(\"__cycle\"), \"Converting circular structure to JSON\");\n        value.__cycle = true;\n        var result = cb(value);\n        delete value.__cycle;\n        return result;\n    }\n    function stringifyArray(value) {\n        return \"[\" + ts.reduceLeft(value, stringifyElement, \"\") + \"]\";\n    }\n    function stringifyElement(memo, value) {\n        return (memo ? memo + \",\" : memo) + stringifyValue(value);\n    }\n    function stringifyObject(value) {\n        return \"{\" + ts.reduceOwnProperties(value, stringifyProperty, \"\") + \"}\";\n    }\n    function stringifyProperty(memo, value, key) {\n        return value === undefined || typeof value === \"function\" || key === \"__cycle\" ? memo\n            : (memo ? memo + \",\" : memo) + (\"\\\"\" + escapeString(key) + \"\\\":\" + stringifyValue(value));\n    }\n    var base64Digits = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n    /**\n     * Converts a string to a base-64 encoded ASCII string.\n     */\n    function convertToBase64(input) {\n        var result = \"\";\n        var charCodes = getExpandedCharCodes(input);\n        var i = 0;\n        var length = charCodes.length;\n        var byte1, byte2, byte3, byte4;\n        while (i < length) {\n            // Convert every 6-bits in the input 3 character points\n            // into a base64 digit\n            byte1 = charCodes[i] >> 2;\n            byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4;\n            byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6;\n            byte4 = charCodes[i + 2] & 63;\n            // We are out of characters in the input, set the extra\n            // digits to 64 (padding character).\n            if (i + 1 >= length) {\n                byte3 = byte4 = 64;\n            }\n            else if (i + 2 >= length) {\n                byte4 = 64;\n            }\n            // Write to the output\n            result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4);\n            i += 3;\n        }\n        return result;\n    }\n    ts.convertToBase64 = convertToBase64;\n    var carriageReturnLineFeed = \"\\r\\n\";\n    var lineFeed = \"\\n\";\n    function getNewLineCharacter(options) {\n        if (options.newLine === 0 /* CarriageReturnLineFeed */) {\n            return carriageReturnLineFeed;\n        }\n        else if (options.newLine === 1 /* LineFeed */) {\n            return lineFeed;\n        }\n        else if (ts.sys) {\n            return ts.sys.newLine;\n        }\n        return carriageReturnLineFeed;\n    }\n    ts.getNewLineCharacter = getNewLineCharacter;\n    /**\n     * Tests whether a node and its subtree is simple enough to have its position\n     * information ignored when emitting source maps in a destructuring assignment.\n     *\n     * @param node The expression to test.\n     */\n    function isSimpleExpression(node) {\n        return isSimpleExpressionWorker(node, 0);\n    }\n    ts.isSimpleExpression = isSimpleExpression;\n    function isSimpleExpressionWorker(node, depth) {\n        if (depth <= 5) {\n            var kind = node.kind;\n            if (kind === 9 /* StringLiteral */\n                || kind === 8 /* NumericLiteral */\n                || kind === 11 /* RegularExpressionLiteral */\n                || kind === 12 /* NoSubstitutionTemplateLiteral */\n                || kind === 70 /* Identifier */\n                || kind === 98 /* ThisKeyword */\n                || kind === 96 /* SuperKeyword */\n                || kind === 100 /* TrueKeyword */\n                || kind === 85 /* FalseKeyword */\n                || kind === 94 /* NullKeyword */) {\n                return true;\n            }\n            else if (kind === 177 /* PropertyAccessExpression */) {\n                return isSimpleExpressionWorker(node.expression, depth + 1);\n            }\n            else if (kind === 178 /* ElementAccessExpression */) {\n                return isSimpleExpressionWorker(node.expression, depth + 1)\n                    && isSimpleExpressionWorker(node.argumentExpression, depth + 1);\n            }\n            else if (kind === 190 /* PrefixUnaryExpression */\n                || kind === 191 /* PostfixUnaryExpression */) {\n                return isSimpleExpressionWorker(node.operand, depth + 1);\n            }\n            else if (kind === 192 /* BinaryExpression */) {\n                return node.operatorToken.kind !== 39 /* AsteriskAsteriskToken */\n                    && isSimpleExpressionWorker(node.left, depth + 1)\n                    && isSimpleExpressionWorker(node.right, depth + 1);\n            }\n            else if (kind === 193 /* ConditionalExpression */) {\n                return isSimpleExpressionWorker(node.condition, depth + 1)\n                    && isSimpleExpressionWorker(node.whenTrue, depth + 1)\n                    && isSimpleExpressionWorker(node.whenFalse, depth + 1);\n            }\n            else if (kind === 188 /* VoidExpression */\n                || kind === 187 /* TypeOfExpression */\n                || kind === 186 /* DeleteExpression */) {\n                return isSimpleExpressionWorker(node.expression, depth + 1);\n            }\n            else if (kind === 175 /* ArrayLiteralExpression */) {\n                return node.elements.length === 0;\n            }\n            else if (kind === 176 /* ObjectLiteralExpression */) {\n                return node.properties.length === 0;\n            }\n            else if (kind === 179 /* CallExpression */) {\n                if (!isSimpleExpressionWorker(node.expression, depth + 1)) {\n                    return false;\n                }\n                for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {\n                    var argument = _a[_i];\n                    if (!isSimpleExpressionWorker(argument, depth + 1)) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n        }\n        return false;\n    }\n    var syntaxKindCache = ts.createMap();\n    function formatSyntaxKind(kind) {\n        var syntaxKindEnum = ts.SyntaxKind;\n        if (syntaxKindEnum) {\n            if (syntaxKindCache[kind]) {\n                return syntaxKindCache[kind];\n            }\n            for (var name_7 in syntaxKindEnum) {\n                if (syntaxKindEnum[name_7] === kind) {\n                    return syntaxKindCache[kind] = kind.toString() + \" (\" + name_7 + \")\";\n                }\n            }\n        }\n        else {\n            return kind.toString();\n        }\n    }\n    ts.formatSyntaxKind = formatSyntaxKind;\n    /**\n     * Increases (or decreases) a position by the provided amount.\n     *\n     * @param pos The position.\n     * @param value The delta.\n     */\n    function movePos(pos, value) {\n        return ts.positionIsSynthesized(pos) ? -1 : pos + value;\n    }\n    ts.movePos = movePos;\n    /**\n     * Creates a new TextRange from the provided pos and end.\n     *\n     * @param pos The start position.\n     * @param end The end position.\n     */\n    function createRange(pos, end) {\n        return { pos: pos, end: end };\n    }\n    ts.createRange = createRange;\n    /**\n     * Creates a new TextRange from a provided range with a new end position.\n     *\n     * @param range A TextRange.\n     * @param end The new end position.\n     */\n    function moveRangeEnd(range, end) {\n        return createRange(range.pos, end);\n    }\n    ts.moveRangeEnd = moveRangeEnd;\n    /**\n     * Creates a new TextRange from a provided range with a new start position.\n     *\n     * @param range A TextRange.\n     * @param pos The new Start position.\n     */\n    function moveRangePos(range, pos) {\n        return createRange(pos, range.end);\n    }\n    ts.moveRangePos = moveRangePos;\n    /**\n     * Moves the start position of a range past any decorators.\n     */\n    function moveRangePastDecorators(node) {\n        return node.decorators && node.decorators.length > 0\n            ? moveRangePos(node, node.decorators.end)\n            : node;\n    }\n    ts.moveRangePastDecorators = moveRangePastDecorators;\n    /**\n     * Moves the start position of a range past any decorators or modifiers.\n     */\n    function moveRangePastModifiers(node) {\n        return node.modifiers && node.modifiers.length > 0\n            ? moveRangePos(node, node.modifiers.end)\n            : moveRangePastDecorators(node);\n    }\n    ts.moveRangePastModifiers = moveRangePastModifiers;\n    /**\n     * Determines whether a TextRange has the same start and end positions.\n     *\n     * @param range A TextRange.\n     */\n    function isCollapsedRange(range) {\n        return range.pos === range.end;\n    }\n    ts.isCollapsedRange = isCollapsedRange;\n    /**\n     * Creates a new TextRange from a provided range with its end position collapsed to its\n     * start position.\n     *\n     * @param range A TextRange.\n     */\n    function collapseRangeToStart(range) {\n        return isCollapsedRange(range) ? range : moveRangeEnd(range, range.pos);\n    }\n    ts.collapseRangeToStart = collapseRangeToStart;\n    /**\n     * Creates a new TextRange from a provided range with its start position collapsed to its\n     * end position.\n     *\n     * @param range A TextRange.\n     */\n    function collapseRangeToEnd(range) {\n        return isCollapsedRange(range) ? range : moveRangePos(range, range.end);\n    }\n    ts.collapseRangeToEnd = collapseRangeToEnd;\n    /**\n     * Creates a new TextRange for a token at the provides start position.\n     *\n     * @param pos The start position.\n     * @param token The token.\n     */\n    function createTokenRange(pos, token) {\n        return createRange(pos, pos + ts.tokenToString(token).length);\n    }\n    ts.createTokenRange = createTokenRange;\n    function rangeIsOnSingleLine(range, sourceFile) {\n        return rangeStartIsOnSameLineAsRangeEnd(range, range, sourceFile);\n    }\n    ts.rangeIsOnSingleLine = rangeIsOnSingleLine;\n    function rangeStartPositionsAreOnSameLine(range1, range2, sourceFile) {\n        return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), getStartPositionOfRange(range2, sourceFile), sourceFile);\n    }\n    ts.rangeStartPositionsAreOnSameLine = rangeStartPositionsAreOnSameLine;\n    function rangeEndPositionsAreOnSameLine(range1, range2, sourceFile) {\n        return positionsAreOnSameLine(range1.end, range2.end, sourceFile);\n    }\n    ts.rangeEndPositionsAreOnSameLine = rangeEndPositionsAreOnSameLine;\n    function rangeStartIsOnSameLineAsRangeEnd(range1, range2, sourceFile) {\n        return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), range2.end, sourceFile);\n    }\n    ts.rangeStartIsOnSameLineAsRangeEnd = rangeStartIsOnSameLineAsRangeEnd;\n    function rangeEndIsOnSameLineAsRangeStart(range1, range2, sourceFile) {\n        return positionsAreOnSameLine(range1.end, getStartPositionOfRange(range2, sourceFile), sourceFile);\n    }\n    ts.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart;\n    function positionsAreOnSameLine(pos1, pos2, sourceFile) {\n        return pos1 === pos2 ||\n            getLineOfLocalPosition(sourceFile, pos1) === getLineOfLocalPosition(sourceFile, pos2);\n    }\n    ts.positionsAreOnSameLine = positionsAreOnSameLine;\n    function getStartPositionOfRange(range, sourceFile) {\n        return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos);\n    }\n    ts.getStartPositionOfRange = getStartPositionOfRange;\n    /**\n     * Determines whether a name was originally the declaration name of an enum or namespace\n     * declaration.\n     */\n    function isDeclarationNameOfEnumOrNamespace(node) {\n        var parseNode = getParseTreeNode(node);\n        if (parseNode) {\n            switch (parseNode.parent.kind) {\n                case 229 /* EnumDeclaration */:\n                case 230 /* ModuleDeclaration */:\n                    return parseNode === parseNode.parent.name;\n            }\n        }\n        return false;\n    }\n    ts.isDeclarationNameOfEnumOrNamespace = isDeclarationNameOfEnumOrNamespace;\n    function getInitializedVariables(node) {\n        return ts.filter(node.declarations, isInitializedVariable);\n    }\n    ts.getInitializedVariables = getInitializedVariables;\n    function isInitializedVariable(node) {\n        return node.initializer !== undefined;\n    }\n    /**\n     * Gets a value indicating whether a node is merged with a class declaration in the same scope.\n     */\n    function isMergedWithClass(node) {\n        if (node.symbol) {\n            for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) {\n                var declaration = _a[_i];\n                if (declaration.kind === 226 /* ClassDeclaration */ && declaration !== node) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n    ts.isMergedWithClass = isMergedWithClass;\n    /**\n     * Gets a value indicating whether a node is the first declaration of its kind.\n     *\n     * @param node A Declaration node.\n     * @param kind The SyntaxKind to find among related declarations.\n     */\n    function isFirstDeclarationOfKind(node, kind) {\n        return node.symbol && getDeclarationOfKind(node.symbol, kind) === node;\n    }\n    ts.isFirstDeclarationOfKind = isFirstDeclarationOfKind;\n    // Node tests\n    //\n    // All node tests in the following list should *not* reference parent pointers so that\n    // they may be used with transformations.\n    // Node Arrays\n    function isNodeArray(array) {\n        return array.hasOwnProperty(\"pos\")\n            && array.hasOwnProperty(\"end\");\n    }\n    ts.isNodeArray = isNodeArray;\n    // Literals\n    function isNoSubstitutionTemplateLiteral(node) {\n        return node.kind === 12 /* NoSubstitutionTemplateLiteral */;\n    }\n    ts.isNoSubstitutionTemplateLiteral = isNoSubstitutionTemplateLiteral;\n    function isLiteralKind(kind) {\n        return 8 /* FirstLiteralToken */ <= kind && kind <= 12 /* LastLiteralToken */;\n    }\n    ts.isLiteralKind = isLiteralKind;\n    function isTextualLiteralKind(kind) {\n        return kind === 9 /* StringLiteral */ || kind === 12 /* NoSubstitutionTemplateLiteral */;\n    }\n    ts.isTextualLiteralKind = isTextualLiteralKind;\n    function isLiteralExpression(node) {\n        return isLiteralKind(node.kind);\n    }\n    ts.isLiteralExpression = isLiteralExpression;\n    // Pseudo-literals\n    function isTemplateLiteralKind(kind) {\n        return 12 /* FirstTemplateToken */ <= kind && kind <= 15 /* LastTemplateToken */;\n    }\n    ts.isTemplateLiteralKind = isTemplateLiteralKind;\n    function isTemplateHead(node) {\n        return node.kind === 13 /* TemplateHead */;\n    }\n    ts.isTemplateHead = isTemplateHead;\n    function isTemplateMiddleOrTemplateTail(node) {\n        var kind = node.kind;\n        return kind === 14 /* TemplateMiddle */\n            || kind === 15 /* TemplateTail */;\n    }\n    ts.isTemplateMiddleOrTemplateTail = isTemplateMiddleOrTemplateTail;\n    // Identifiers\n    function isIdentifier(node) {\n        return node.kind === 70 /* Identifier */;\n    }\n    ts.isIdentifier = isIdentifier;\n    function isGeneratedIdentifier(node) {\n        // Using `>` here catches both `GeneratedIdentifierKind.None` and `undefined`.\n        return isIdentifier(node) && node.autoGenerateKind > 0 /* None */;\n    }\n    ts.isGeneratedIdentifier = isGeneratedIdentifier;\n    // Keywords\n    function isModifier(node) {\n        return isModifierKind(node.kind);\n    }\n    ts.isModifier = isModifier;\n    // Names\n    function isQualifiedName(node) {\n        return node.kind === 141 /* QualifiedName */;\n    }\n    ts.isQualifiedName = isQualifiedName;\n    function isComputedPropertyName(node) {\n        return node.kind === 142 /* ComputedPropertyName */;\n    }\n    ts.isComputedPropertyName = isComputedPropertyName;\n    function isEntityName(node) {\n        var kind = node.kind;\n        return kind === 141 /* QualifiedName */\n            || kind === 70 /* Identifier */;\n    }\n    ts.isEntityName = isEntityName;\n    function isPropertyName(node) {\n        var kind = node.kind;\n        return kind === 70 /* Identifier */\n            || kind === 9 /* StringLiteral */\n            || kind === 8 /* NumericLiteral */\n            || kind === 142 /* ComputedPropertyName */;\n    }\n    ts.isPropertyName = isPropertyName;\n    function isModuleName(node) {\n        var kind = node.kind;\n        return kind === 70 /* Identifier */\n            || kind === 9 /* StringLiteral */;\n    }\n    ts.isModuleName = isModuleName;\n    function isBindingName(node) {\n        var kind = node.kind;\n        return kind === 70 /* Identifier */\n            || kind === 172 /* ObjectBindingPattern */\n            || kind === 173 /* ArrayBindingPattern */;\n    }\n    ts.isBindingName = isBindingName;\n    // Signature elements\n    function isTypeParameter(node) {\n        return node.kind === 143 /* TypeParameter */;\n    }\n    ts.isTypeParameter = isTypeParameter;\n    function isParameter(node) {\n        return node.kind === 144 /* Parameter */;\n    }\n    ts.isParameter = isParameter;\n    function isDecorator(node) {\n        return node.kind === 145 /* Decorator */;\n    }\n    ts.isDecorator = isDecorator;\n    // Type members\n    function isMethodDeclaration(node) {\n        return node.kind === 149 /* MethodDeclaration */;\n    }\n    ts.isMethodDeclaration = isMethodDeclaration;\n    function isClassElement(node) {\n        var kind = node.kind;\n        return kind === 150 /* Constructor */\n            || kind === 147 /* PropertyDeclaration */\n            || kind === 149 /* MethodDeclaration */\n            || kind === 151 /* GetAccessor */\n            || kind === 152 /* SetAccessor */\n            || kind === 155 /* IndexSignature */\n            || kind === 203 /* SemicolonClassElement */;\n    }\n    ts.isClassElement = isClassElement;\n    function isObjectLiteralElementLike(node) {\n        var kind = node.kind;\n        return kind === 257 /* PropertyAssignment */\n            || kind === 258 /* ShorthandPropertyAssignment */\n            || kind === 259 /* SpreadAssignment */\n            || kind === 149 /* MethodDeclaration */\n            || kind === 151 /* GetAccessor */\n            || kind === 152 /* SetAccessor */\n            || kind === 244 /* MissingDeclaration */;\n    }\n    ts.isObjectLiteralElementLike = isObjectLiteralElementLike;\n    // Type\n    function isTypeNodeKind(kind) {\n        return (kind >= 156 /* FirstTypeNode */ && kind <= 171 /* LastTypeNode */)\n            || kind === 118 /* AnyKeyword */\n            || kind === 132 /* NumberKeyword */\n            || kind === 121 /* BooleanKeyword */\n            || kind === 134 /* StringKeyword */\n            || kind === 135 /* SymbolKeyword */\n            || kind === 104 /* VoidKeyword */\n            || kind === 129 /* NeverKeyword */\n            || kind === 199 /* ExpressionWithTypeArguments */;\n    }\n    /**\n     * Node test that determines whether a node is a valid type node.\n     * This differs from the `isPartOfTypeNode` function which determines whether a node is *part*\n     * of a TypeNode.\n     */\n    function isTypeNode(node) {\n        return isTypeNodeKind(node.kind);\n    }\n    ts.isTypeNode = isTypeNode;\n    // Binding patterns\n    function isArrayBindingPattern(node) {\n        return node.kind === 173 /* ArrayBindingPattern */;\n    }\n    ts.isArrayBindingPattern = isArrayBindingPattern;\n    function isObjectBindingPattern(node) {\n        return node.kind === 172 /* ObjectBindingPattern */;\n    }\n    ts.isObjectBindingPattern = isObjectBindingPattern;\n    function isBindingPattern(node) {\n        if (node) {\n            var kind = node.kind;\n            return kind === 173 /* ArrayBindingPattern */\n                || kind === 172 /* ObjectBindingPattern */;\n        }\n        return false;\n    }\n    ts.isBindingPattern = isBindingPattern;\n    function isAssignmentPattern(node) {\n        var kind = node.kind;\n        return kind === 175 /* ArrayLiteralExpression */\n            || kind === 176 /* ObjectLiteralExpression */;\n    }\n    ts.isAssignmentPattern = isAssignmentPattern;\n    function isBindingElement(node) {\n        return node.kind === 174 /* BindingElement */;\n    }\n    ts.isBindingElement = isBindingElement;\n    function isArrayBindingElement(node) {\n        var kind = node.kind;\n        return kind === 174 /* BindingElement */\n            || kind === 198 /* OmittedExpression */;\n    }\n    ts.isArrayBindingElement = isArrayBindingElement;\n    /**\n     * Determines whether the BindingOrAssignmentElement is a BindingElement-like declaration\n     */\n    function isDeclarationBindingElement(bindingElement) {\n        switch (bindingElement.kind) {\n            case 223 /* VariableDeclaration */:\n            case 144 /* Parameter */:\n            case 174 /* BindingElement */:\n                return true;\n        }\n        return false;\n    }\n    ts.isDeclarationBindingElement = isDeclarationBindingElement;\n    /**\n     * Determines whether a node is a BindingOrAssignmentPattern\n     */\n    function isBindingOrAssignmentPattern(node) {\n        return isObjectBindingOrAssignmentPattern(node)\n            || isArrayBindingOrAssignmentPattern(node);\n    }\n    ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern;\n    /**\n     * Determines whether a node is an ObjectBindingOrAssignmentPattern\n     */\n    function isObjectBindingOrAssignmentPattern(node) {\n        switch (node.kind) {\n            case 172 /* ObjectBindingPattern */:\n            case 176 /* ObjectLiteralExpression */:\n                return true;\n        }\n        return false;\n    }\n    ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern;\n    /**\n     * Determines whether a node is an ArrayBindingOrAssignmentPattern\n     */\n    function isArrayBindingOrAssignmentPattern(node) {\n        switch (node.kind) {\n            case 173 /* ArrayBindingPattern */:\n            case 175 /* ArrayLiteralExpression */:\n                return true;\n        }\n        return false;\n    }\n    ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern;\n    // Expression\n    function isArrayLiteralExpression(node) {\n        return node.kind === 175 /* ArrayLiteralExpression */;\n    }\n    ts.isArrayLiteralExpression = isArrayLiteralExpression;\n    function isObjectLiteralExpression(node) {\n        return node.kind === 176 /* ObjectLiteralExpression */;\n    }\n    ts.isObjectLiteralExpression = isObjectLiteralExpression;\n    function isPropertyAccessExpression(node) {\n        return node.kind === 177 /* PropertyAccessExpression */;\n    }\n    ts.isPropertyAccessExpression = isPropertyAccessExpression;\n    function isElementAccessExpression(node) {\n        return node.kind === 178 /* ElementAccessExpression */;\n    }\n    ts.isElementAccessExpression = isElementAccessExpression;\n    function isBinaryExpression(node) {\n        return node.kind === 192 /* BinaryExpression */;\n    }\n    ts.isBinaryExpression = isBinaryExpression;\n    function isConditionalExpression(node) {\n        return node.kind === 193 /* ConditionalExpression */;\n    }\n    ts.isConditionalExpression = isConditionalExpression;\n    function isCallExpression(node) {\n        return node.kind === 179 /* CallExpression */;\n    }\n    ts.isCallExpression = isCallExpression;\n    function isTemplateLiteral(node) {\n        var kind = node.kind;\n        return kind === 194 /* TemplateExpression */\n            || kind === 12 /* NoSubstitutionTemplateLiteral */;\n    }\n    ts.isTemplateLiteral = isTemplateLiteral;\n    function isSpreadExpression(node) {\n        return node.kind === 196 /* SpreadElement */;\n    }\n    ts.isSpreadExpression = isSpreadExpression;\n    function isExpressionWithTypeArguments(node) {\n        return node.kind === 199 /* ExpressionWithTypeArguments */;\n    }\n    ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments;\n    function isLeftHandSideExpressionKind(kind) {\n        return kind === 177 /* PropertyAccessExpression */\n            || kind === 178 /* ElementAccessExpression */\n            || kind === 180 /* NewExpression */\n            || kind === 179 /* CallExpression */\n            || kind === 246 /* JsxElement */\n            || kind === 247 /* JsxSelfClosingElement */\n            || kind === 181 /* TaggedTemplateExpression */\n            || kind === 175 /* ArrayLiteralExpression */\n            || kind === 183 /* ParenthesizedExpression */\n            || kind === 176 /* ObjectLiteralExpression */\n            || kind === 197 /* ClassExpression */\n            || kind === 184 /* FunctionExpression */\n            || kind === 70 /* Identifier */\n            || kind === 11 /* RegularExpressionLiteral */\n            || kind === 8 /* NumericLiteral */\n            || kind === 9 /* StringLiteral */\n            || kind === 12 /* NoSubstitutionTemplateLiteral */\n            || kind === 194 /* TemplateExpression */\n            || kind === 85 /* FalseKeyword */\n            || kind === 94 /* NullKeyword */\n            || kind === 98 /* ThisKeyword */\n            || kind === 100 /* TrueKeyword */\n            || kind === 96 /* SuperKeyword */\n            || kind === 201 /* NonNullExpression */\n            || kind === 297 /* RawExpression */;\n    }\n    function isLeftHandSideExpression(node) {\n        return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);\n    }\n    ts.isLeftHandSideExpression = isLeftHandSideExpression;\n    function isUnaryExpressionKind(kind) {\n        return kind === 190 /* PrefixUnaryExpression */\n            || kind === 191 /* PostfixUnaryExpression */\n            || kind === 186 /* DeleteExpression */\n            || kind === 187 /* TypeOfExpression */\n            || kind === 188 /* VoidExpression */\n            || kind === 189 /* AwaitExpression */\n            || kind === 182 /* TypeAssertionExpression */\n            || isLeftHandSideExpressionKind(kind);\n    }\n    function isUnaryExpression(node) {\n        return isUnaryExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);\n    }\n    ts.isUnaryExpression = isUnaryExpression;\n    function isExpressionKind(kind) {\n        return kind === 193 /* ConditionalExpression */\n            || kind === 195 /* YieldExpression */\n            || kind === 185 /* ArrowFunction */\n            || kind === 192 /* BinaryExpression */\n            || kind === 196 /* SpreadElement */\n            || kind === 200 /* AsExpression */\n            || kind === 198 /* OmittedExpression */\n            || kind === 297 /* RawExpression */\n            || isUnaryExpressionKind(kind);\n    }\n    function isExpression(node) {\n        return isExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);\n    }\n    ts.isExpression = isExpression;\n    function isAssertionExpression(node) {\n        var kind = node.kind;\n        return kind === 182 /* TypeAssertionExpression */\n            || kind === 200 /* AsExpression */;\n    }\n    ts.isAssertionExpression = isAssertionExpression;\n    function isPartiallyEmittedExpression(node) {\n        return node.kind === 294 /* PartiallyEmittedExpression */;\n    }\n    ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;\n    function isNotEmittedStatement(node) {\n        return node.kind === 293 /* NotEmittedStatement */;\n    }\n    ts.isNotEmittedStatement = isNotEmittedStatement;\n    function isNotEmittedOrPartiallyEmittedNode(node) {\n        return isNotEmittedStatement(node)\n            || isPartiallyEmittedExpression(node);\n    }\n    ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode;\n    function isOmittedExpression(node) {\n        return node.kind === 198 /* OmittedExpression */;\n    }\n    ts.isOmittedExpression = isOmittedExpression;\n    // Misc\n    function isTemplateSpan(node) {\n        return node.kind === 202 /* TemplateSpan */;\n    }\n    ts.isTemplateSpan = isTemplateSpan;\n    // Element\n    function isBlock(node) {\n        return node.kind === 204 /* Block */;\n    }\n    ts.isBlock = isBlock;\n    function isConciseBody(node) {\n        return isBlock(node)\n            || isExpression(node);\n    }\n    ts.isConciseBody = isConciseBody;\n    function isFunctionBody(node) {\n        return isBlock(node);\n    }\n    ts.isFunctionBody = isFunctionBody;\n    function isForInitializer(node) {\n        return isVariableDeclarationList(node)\n            || isExpression(node);\n    }\n    ts.isForInitializer = isForInitializer;\n    function isVariableDeclaration(node) {\n        return node.kind === 223 /* VariableDeclaration */;\n    }\n    ts.isVariableDeclaration = isVariableDeclaration;\n    function isVariableDeclarationList(node) {\n        return node.kind === 224 /* VariableDeclarationList */;\n    }\n    ts.isVariableDeclarationList = isVariableDeclarationList;\n    function isCaseBlock(node) {\n        return node.kind === 232 /* CaseBlock */;\n    }\n    ts.isCaseBlock = isCaseBlock;\n    function isModuleBody(node) {\n        var kind = node.kind;\n        return kind === 231 /* ModuleBlock */\n            || kind === 230 /* ModuleDeclaration */;\n    }\n    ts.isModuleBody = isModuleBody;\n    function isImportEqualsDeclaration(node) {\n        return node.kind === 234 /* ImportEqualsDeclaration */;\n    }\n    ts.isImportEqualsDeclaration = isImportEqualsDeclaration;\n    function isImportClause(node) {\n        return node.kind === 236 /* ImportClause */;\n    }\n    ts.isImportClause = isImportClause;\n    function isNamedImportBindings(node) {\n        var kind = node.kind;\n        return kind === 238 /* NamedImports */\n            || kind === 237 /* NamespaceImport */;\n    }\n    ts.isNamedImportBindings = isNamedImportBindings;\n    function isImportSpecifier(node) {\n        return node.kind === 239 /* ImportSpecifier */;\n    }\n    ts.isImportSpecifier = isImportSpecifier;\n    function isNamedExports(node) {\n        return node.kind === 242 /* NamedExports */;\n    }\n    ts.isNamedExports = isNamedExports;\n    function isExportSpecifier(node) {\n        return node.kind === 243 /* ExportSpecifier */;\n    }\n    ts.isExportSpecifier = isExportSpecifier;\n    function isModuleOrEnumDeclaration(node) {\n        return node.kind === 230 /* ModuleDeclaration */ || node.kind === 229 /* EnumDeclaration */;\n    }\n    ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration;\n    function isDeclarationKind(kind) {\n        return kind === 185 /* ArrowFunction */\n            || kind === 174 /* BindingElement */\n            || kind === 226 /* ClassDeclaration */\n            || kind === 197 /* ClassExpression */\n            || kind === 150 /* Constructor */\n            || kind === 229 /* EnumDeclaration */\n            || kind === 260 /* EnumMember */\n            || kind === 243 /* ExportSpecifier */\n            || kind === 225 /* FunctionDeclaration */\n            || kind === 184 /* FunctionExpression */\n            || kind === 151 /* GetAccessor */\n            || kind === 236 /* ImportClause */\n            || kind === 234 /* ImportEqualsDeclaration */\n            || kind === 239 /* ImportSpecifier */\n            || kind === 227 /* InterfaceDeclaration */\n            || kind === 149 /* MethodDeclaration */\n            || kind === 148 /* MethodSignature */\n            || kind === 230 /* ModuleDeclaration */\n            || kind === 233 /* NamespaceExportDeclaration */\n            || kind === 237 /* NamespaceImport */\n            || kind === 144 /* Parameter */\n            || kind === 257 /* PropertyAssignment */\n            || kind === 147 /* PropertyDeclaration */\n            || kind === 146 /* PropertySignature */\n            || kind === 152 /* SetAccessor */\n            || kind === 258 /* ShorthandPropertyAssignment */\n            || kind === 228 /* TypeAliasDeclaration */\n            || kind === 143 /* TypeParameter */\n            || kind === 223 /* VariableDeclaration */\n            || kind === 285 /* JSDocTypedefTag */;\n    }\n    function isDeclarationStatementKind(kind) {\n        return kind === 225 /* FunctionDeclaration */\n            || kind === 244 /* MissingDeclaration */\n            || kind === 226 /* ClassDeclaration */\n            || kind === 227 /* InterfaceDeclaration */\n            || kind === 228 /* TypeAliasDeclaration */\n            || kind === 229 /* EnumDeclaration */\n            || kind === 230 /* ModuleDeclaration */\n            || kind === 235 /* ImportDeclaration */\n            || kind === 234 /* ImportEqualsDeclaration */\n            || kind === 241 /* ExportDeclaration */\n            || kind === 240 /* ExportAssignment */\n            || kind === 233 /* NamespaceExportDeclaration */;\n    }\n    function isStatementKindButNotDeclarationKind(kind) {\n        return kind === 215 /* BreakStatement */\n            || kind === 214 /* ContinueStatement */\n            || kind === 222 /* DebuggerStatement */\n            || kind === 209 /* DoStatement */\n            || kind === 207 /* ExpressionStatement */\n            || kind === 206 /* EmptyStatement */\n            || kind === 212 /* ForInStatement */\n            || kind === 213 /* ForOfStatement */\n            || kind === 211 /* ForStatement */\n            || kind === 208 /* IfStatement */\n            || kind === 219 /* LabeledStatement */\n            || kind === 216 /* ReturnStatement */\n            || kind === 218 /* SwitchStatement */\n            || kind === 220 /* ThrowStatement */\n            || kind === 221 /* TryStatement */\n            || kind === 205 /* VariableStatement */\n            || kind === 210 /* WhileStatement */\n            || kind === 217 /* WithStatement */\n            || kind === 293 /* NotEmittedStatement */\n            || kind === 296 /* EndOfDeclarationMarker */\n            || kind === 295 /* MergeDeclarationMarker */;\n    }\n    function isDeclaration(node) {\n        return isDeclarationKind(node.kind);\n    }\n    ts.isDeclaration = isDeclaration;\n    function isDeclarationStatement(node) {\n        return isDeclarationStatementKind(node.kind);\n    }\n    ts.isDeclarationStatement = isDeclarationStatement;\n    /**\n     * Determines whether the node is a statement that is not also a declaration\n     */\n    function isStatementButNotDeclaration(node) {\n        return isStatementKindButNotDeclarationKind(node.kind);\n    }\n    ts.isStatementButNotDeclaration = isStatementButNotDeclaration;\n    function isStatement(node) {\n        var kind = node.kind;\n        return isStatementKindButNotDeclarationKind(kind)\n            || isDeclarationStatementKind(kind)\n            || kind === 204 /* Block */;\n    }\n    ts.isStatement = isStatement;\n    // Module references\n    function isModuleReference(node) {\n        var kind = node.kind;\n        return kind === 245 /* ExternalModuleReference */\n            || kind === 141 /* QualifiedName */\n            || kind === 70 /* Identifier */;\n    }\n    ts.isModuleReference = isModuleReference;\n    // JSX\n    function isJsxOpeningElement(node) {\n        return node.kind === 248 /* JsxOpeningElement */;\n    }\n    ts.isJsxOpeningElement = isJsxOpeningElement;\n    function isJsxClosingElement(node) {\n        return node.kind === 249 /* JsxClosingElement */;\n    }\n    ts.isJsxClosingElement = isJsxClosingElement;\n    function isJsxTagNameExpression(node) {\n        var kind = node.kind;\n        return kind === 98 /* ThisKeyword */\n            || kind === 70 /* Identifier */\n            || kind === 177 /* PropertyAccessExpression */;\n    }\n    ts.isJsxTagNameExpression = isJsxTagNameExpression;\n    function isJsxChild(node) {\n        var kind = node.kind;\n        return kind === 246 /* JsxElement */\n            || kind === 252 /* JsxExpression */\n            || kind === 247 /* JsxSelfClosingElement */\n            || kind === 10 /* JsxText */;\n    }\n    ts.isJsxChild = isJsxChild;\n    function isJsxAttributeLike(node) {\n        var kind = node.kind;\n        return kind === 250 /* JsxAttribute */\n            || kind === 251 /* JsxSpreadAttribute */;\n    }\n    ts.isJsxAttributeLike = isJsxAttributeLike;\n    function isJsxSpreadAttribute(node) {\n        return node.kind === 251 /* JsxSpreadAttribute */;\n    }\n    ts.isJsxSpreadAttribute = isJsxSpreadAttribute;\n    function isJsxAttribute(node) {\n        return node.kind === 250 /* JsxAttribute */;\n    }\n    ts.isJsxAttribute = isJsxAttribute;\n    function isStringLiteralOrJsxExpression(node) {\n        var kind = node.kind;\n        return kind === 9 /* StringLiteral */\n            || kind === 252 /* JsxExpression */;\n    }\n    ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression;\n    // Clauses\n    function isCaseOrDefaultClause(node) {\n        var kind = node.kind;\n        return kind === 253 /* CaseClause */\n            || kind === 254 /* DefaultClause */;\n    }\n    ts.isCaseOrDefaultClause = isCaseOrDefaultClause;\n    function isHeritageClause(node) {\n        return node.kind === 255 /* HeritageClause */;\n    }\n    ts.isHeritageClause = isHeritageClause;\n    function isCatchClause(node) {\n        return node.kind === 256 /* CatchClause */;\n    }\n    ts.isCatchClause = isCatchClause;\n    // Property assignments\n    function isPropertyAssignment(node) {\n        return node.kind === 257 /* PropertyAssignment */;\n    }\n    ts.isPropertyAssignment = isPropertyAssignment;\n    function isShorthandPropertyAssignment(node) {\n        return node.kind === 258 /* ShorthandPropertyAssignment */;\n    }\n    ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment;\n    // Enum\n    function isEnumMember(node) {\n        return node.kind === 260 /* EnumMember */;\n    }\n    ts.isEnumMember = isEnumMember;\n    // Top-level nodes\n    function isSourceFile(node) {\n        return node.kind === 261 /* SourceFile */;\n    }\n    ts.isSourceFile = isSourceFile;\n    function isWatchSet(options) {\n        // Firefox has Object.prototype.watch\n        return options.watch && options.hasOwnProperty(\"watch\");\n    }\n    ts.isWatchSet = isWatchSet;\n})(ts || (ts = {}));\n(function (ts) {\n    function getDefaultLibFileName(options) {\n        switch (options.target) {\n            case 5 /* ESNext */:\n            case 4 /* ES2017 */:\n                return \"lib.es2017.d.ts\";\n            case 3 /* ES2016 */:\n                return \"lib.es2016.d.ts\";\n            case 2 /* ES2015 */:\n                return \"lib.es6.d.ts\";\n            default:\n                return \"lib.d.ts\";\n        }\n    }\n    ts.getDefaultLibFileName = getDefaultLibFileName;\n    function textSpanEnd(span) {\n        return span.start + span.length;\n    }\n    ts.textSpanEnd = textSpanEnd;\n    function textSpanIsEmpty(span) {\n        return span.length === 0;\n    }\n    ts.textSpanIsEmpty = textSpanIsEmpty;\n    function textSpanContainsPosition(span, position) {\n        return position >= span.start && position < textSpanEnd(span);\n    }\n    ts.textSpanContainsPosition = textSpanContainsPosition;\n    // Returns true if 'span' contains 'other'.\n    function textSpanContainsTextSpan(span, other) {\n        return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span);\n    }\n    ts.textSpanContainsTextSpan = textSpanContainsTextSpan;\n    function textSpanOverlapsWith(span, other) {\n        var overlapStart = Math.max(span.start, other.start);\n        var overlapEnd = Math.min(textSpanEnd(span), textSpanEnd(other));\n        return overlapStart < overlapEnd;\n    }\n    ts.textSpanOverlapsWith = textSpanOverlapsWith;\n    function textSpanOverlap(span1, span2) {\n        var overlapStart = Math.max(span1.start, span2.start);\n        var overlapEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2));\n        if (overlapStart < overlapEnd) {\n            return createTextSpanFromBounds(overlapStart, overlapEnd);\n        }\n        return undefined;\n    }\n    ts.textSpanOverlap = textSpanOverlap;\n    function textSpanIntersectsWithTextSpan(span, other) {\n        return other.start <= textSpanEnd(span) && textSpanEnd(other) >= span.start;\n    }\n    ts.textSpanIntersectsWithTextSpan = textSpanIntersectsWithTextSpan;\n    function textSpanIntersectsWith(span, start, length) {\n        var end = start + length;\n        return start <= textSpanEnd(span) && end >= span.start;\n    }\n    ts.textSpanIntersectsWith = textSpanIntersectsWith;\n    function decodedTextSpanIntersectsWith(start1, length1, start2, length2) {\n        var end1 = start1 + length1;\n        var end2 = start2 + length2;\n        return start2 <= end1 && end2 >= start1;\n    }\n    ts.decodedTextSpanIntersectsWith = decodedTextSpanIntersectsWith;\n    function textSpanIntersectsWithPosition(span, position) {\n        return position <= textSpanEnd(span) && position >= span.start;\n    }\n    ts.textSpanIntersectsWithPosition = textSpanIntersectsWithPosition;\n    function textSpanIntersection(span1, span2) {\n        var intersectStart = Math.max(span1.start, span2.start);\n        var intersectEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2));\n        if (intersectStart <= intersectEnd) {\n            return createTextSpanFromBounds(intersectStart, intersectEnd);\n        }\n        return undefined;\n    }\n    ts.textSpanIntersection = textSpanIntersection;\n    function createTextSpan(start, length) {\n        if (start < 0) {\n            throw new Error(\"start < 0\");\n        }\n        if (length < 0) {\n            throw new Error(\"length < 0\");\n        }\n        return { start: start, length: length };\n    }\n    ts.createTextSpan = createTextSpan;\n    function createTextSpanFromBounds(start, end) {\n        return createTextSpan(start, end - start);\n    }\n    ts.createTextSpanFromBounds = createTextSpanFromBounds;\n    function textChangeRangeNewSpan(range) {\n        return createTextSpan(range.span.start, range.newLength);\n    }\n    ts.textChangeRangeNewSpan = textChangeRangeNewSpan;\n    function textChangeRangeIsUnchanged(range) {\n        return textSpanIsEmpty(range.span) && range.newLength === 0;\n    }\n    ts.textChangeRangeIsUnchanged = textChangeRangeIsUnchanged;\n    function createTextChangeRange(span, newLength) {\n        if (newLength < 0) {\n            throw new Error(\"newLength < 0\");\n        }\n        return { span: span, newLength: newLength };\n    }\n    ts.createTextChangeRange = createTextChangeRange;\n    ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0);\n    /**\n     * Called to merge all the changes that occurred across several versions of a script snapshot\n     * into a single change.  i.e. if a user keeps making successive edits to a script we will\n     * have a text change from V1 to V2, V2 to V3, ..., Vn.\n     *\n     * This function will then merge those changes into a single change range valid between V1 and\n     * Vn.\n     */\n    function collapseTextChangeRangesAcrossMultipleVersions(changes) {\n        if (changes.length === 0) {\n            return ts.unchangedTextChangeRange;\n        }\n        if (changes.length === 1) {\n            return changes[0];\n        }\n        // We change from talking about { { oldStart, oldLength }, newLength } to { oldStart, oldEnd, newEnd }\n        // as it makes things much easier to reason about.\n        var change0 = changes[0];\n        var oldStartN = change0.span.start;\n        var oldEndN = textSpanEnd(change0.span);\n        var newEndN = oldStartN + change0.newLength;\n        for (var i = 1; i < changes.length; i++) {\n            var nextChange = changes[i];\n            // Consider the following case:\n            // i.e. two edits.  The first represents the text change range { { 10, 50 }, 30 }.  i.e. The span starting\n            // at 10, with length 50 is reduced to length 30.  The second represents the text change range { { 30, 30 }, 40 }.\n            // i.e. the span starting at 30 with length 30 is increased to length 40.\n            //\n            //      0         10        20        30        40        50        60        70        80        90        100\n            //      -------------------------------------------------------------------------------------------------------\n            //                |                                                 /\n            //                |                                            /----\n            //  T1            |                                       /----\n            //                |                                  /----\n            //                |                             /----\n            //      -------------------------------------------------------------------------------------------------------\n            //                                     |                            \\\n            //                                     |                               \\\n            //   T2                                |                                 \\\n            //                                     |                                   \\\n            //                                     |                                      \\\n            //      -------------------------------------------------------------------------------------------------------\n            //\n            // Merging these turns out to not be too difficult.  First, determining the new start of the change is trivial\n            // it's just the min of the old and new starts.  i.e.:\n            //\n            //      0         10        20        30        40        50        60        70        80        90        100\n            //      ------------------------------------------------------------*------------------------------------------\n            //                |                                                 /\n            //                |                                            /----\n            //  T1            |                                       /----\n            //                |                                  /----\n            //                |                             /----\n            //      ----------------------------------------$-------------------$------------------------------------------\n            //                .                    |                            \\\n            //                .                    |                               \\\n            //   T2           .                    |                                 \\\n            //                .                    |                                   \\\n            //                .                    |                                      \\\n            //      ----------------------------------------------------------------------*--------------------------------\n            //\n            // (Note the dots represent the newly inferred start.\n            // Determining the new and old end is also pretty simple.  Basically it boils down to paying attention to the\n            // absolute positions at the asterisks, and the relative change between the dollar signs. Basically, we see\n            // which if the two $'s precedes the other, and we move that one forward until they line up.  in this case that\n            // means:\n            //\n            //      0         10        20        30        40        50        60        70        80        90        100\n            //      --------------------------------------------------------------------------------*----------------------\n            //                |                                                                     /\n            //                |                                                                /----\n            //  T1            |                                                           /----\n            //                |                                                      /----\n            //                |                                                 /----\n            //      ------------------------------------------------------------$------------------------------------------\n            //                .                    |                            \\\n            //                .                    |                               \\\n            //   T2           .                    |                                 \\\n            //                .                    |                                   \\\n            //                .                    |                                      \\\n            //      ----------------------------------------------------------------------*--------------------------------\n            //\n            // In other words (in this case), we're recognizing that the second edit happened after where the first edit\n            // ended with a delta of 20 characters (60 - 40).  Thus, if we go back in time to where the first edit started\n            // that's the same as if we started at char 80 instead of 60.\n            //\n            // As it so happens, the same logic applies if the second edit precedes the first edit.  In that case rather\n            // than pushing the first edit forward to match the second, we'll push the second edit forward to match the\n            // first.\n            //\n            // In this case that means we have { oldStart: 10, oldEnd: 80, newEnd: 70 } or, in TextChangeRange\n            // semantics: { { start: 10, length: 70 }, newLength: 60 }\n            //\n            // The math then works out as follows.\n            // If we have { oldStart1, oldEnd1, newEnd1 } and { oldStart2, oldEnd2, newEnd2 } then we can compute the\n            // final result like so:\n            //\n            // {\n            //      oldStart3: Min(oldStart1, oldStart2),\n            //      oldEnd3  : Max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)),\n            //      newEnd3  : Max(newEnd2, newEnd2 + (newEnd1 - oldEnd2))\n            // }\n            var oldStart1 = oldStartN;\n            var oldEnd1 = oldEndN;\n            var newEnd1 = newEndN;\n            var oldStart2 = nextChange.span.start;\n            var oldEnd2 = textSpanEnd(nextChange.span);\n            var newEnd2 = oldStart2 + nextChange.newLength;\n            oldStartN = Math.min(oldStart1, oldStart2);\n            oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1));\n            newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2));\n        }\n        return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), /*newLength:*/ newEndN - oldStartN);\n    }\n    ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions;\n    function getTypeParameterOwner(d) {\n        if (d && d.kind === 143 /* TypeParameter */) {\n            for (var current = d; current; current = current.parent) {\n                if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 227 /* InterfaceDeclaration */) {\n                    return current;\n                }\n            }\n        }\n    }\n    ts.getTypeParameterOwner = getTypeParameterOwner;\n    function isParameterPropertyDeclaration(node) {\n        return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 150 /* Constructor */ && ts.isClassLike(node.parent.parent);\n    }\n    ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;\n    function walkUpBindingElementsAndPatterns(node) {\n        while (node && (node.kind === 174 /* BindingElement */ || ts.isBindingPattern(node))) {\n            node = node.parent;\n        }\n        return node;\n    }\n    function getCombinedModifierFlags(node) {\n        node = walkUpBindingElementsAndPatterns(node);\n        var flags = ts.getModifierFlags(node);\n        if (node.kind === 223 /* VariableDeclaration */) {\n            node = node.parent;\n        }\n        if (node && node.kind === 224 /* VariableDeclarationList */) {\n            flags |= ts.getModifierFlags(node);\n            node = node.parent;\n        }\n        if (node && node.kind === 205 /* VariableStatement */) {\n            flags |= ts.getModifierFlags(node);\n        }\n        return flags;\n    }\n    ts.getCombinedModifierFlags = getCombinedModifierFlags;\n    // Returns the node flags for this node and all relevant parent nodes.  This is done so that\n    // nodes like variable declarations and binding elements can returned a view of their flags\n    // that includes the modifiers from their container.  i.e. flags like export/declare aren't\n    // stored on the variable declaration directly, but on the containing variable statement\n    // (if it has one).  Similarly, flags for let/const are store on the variable declaration\n    // list.  By calling this function, all those flags are combined so that the client can treat\n    // the node as if it actually had those flags.\n    function getCombinedNodeFlags(node) {\n        node = walkUpBindingElementsAndPatterns(node);\n        var flags = node.flags;\n        if (node.kind === 223 /* VariableDeclaration */) {\n            node = node.parent;\n        }\n        if (node && node.kind === 224 /* VariableDeclarationList */) {\n            flags |= node.flags;\n            node = node.parent;\n        }\n        if (node && node.kind === 205 /* VariableStatement */) {\n            flags |= node.flags;\n        }\n        return flags;\n    }\n    ts.getCombinedNodeFlags = getCombinedNodeFlags;\n    /**\n      * Checks to see if the locale is in the appropriate format,\n      * and if it is, attempts to set the appropriate language.\n      */\n    function validateLocaleAndSetLanguage(locale, sys, errors) {\n        var matchResult = /^([a-z]+)([_\\-]([a-z]+))?$/.exec(locale.toLowerCase());\n        if (!matchResult) {\n            if (errors) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, \"en\", \"ja-jp\"));\n            }\n            return;\n        }\n        var language = matchResult[1];\n        var territory = matchResult[3];\n        // First try the entire locale, then fall back to just language if that's all we have.\n        // Either ways do not fail, and fallback to the English diagnostic strings.\n        if (!trySetLanguageAndTerritory(language, territory, errors)) {\n            trySetLanguageAndTerritory(language, /*territory*/ undefined, errors);\n        }\n        function trySetLanguageAndTerritory(language, territory, errors) {\n            var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath());\n            var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath);\n            var filePath = ts.combinePaths(containingDirectoryPath, language);\n            if (territory) {\n                filePath = filePath + \"-\" + territory;\n            }\n            filePath = sys.resolvePath(ts.combinePaths(filePath, \"diagnosticMessages.generated.json\"));\n            if (!sys.fileExists(filePath)) {\n                return false;\n            }\n            // TODO: Add codePage support for readFile?\n            var fileContents = \"\";\n            try {\n                fileContents = sys.readFile(filePath);\n            }\n            catch (e) {\n                if (errors) {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath));\n                }\n                return false;\n            }\n            try {\n                ts.localizedDiagnosticMessages = JSON.parse(fileContents);\n            }\n            catch (e) {\n                if (errors) {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath));\n                }\n                return false;\n            }\n            return true;\n        }\n    }\n    ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage;\n})(ts || (ts = {}));\n/// <reference path=\"core.ts\"/>\n/// <reference path=\"utilities.ts\"/>\n/* @internal */\nvar ts;\n(function (ts) {\n    var NodeConstructor;\n    var SourceFileConstructor;\n    function createNode(kind, location, flags) {\n        var ConstructorForKind = kind === 261 /* SourceFile */\n            ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))\n            : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()));\n        var node = location\n            ? new ConstructorForKind(kind, location.pos, location.end)\n            : new ConstructorForKind(kind, /*pos*/ -1, /*end*/ -1);\n        node.flags = flags | 8 /* Synthesized */;\n        return node;\n    }\n    function updateNode(updated, original) {\n        if (updated !== original) {\n            setOriginalNode(updated, original);\n            if (original.startsOnNewLine) {\n                updated.startsOnNewLine = true;\n            }\n            ts.aggregateTransformFlags(updated);\n        }\n        return updated;\n    }\n    ts.updateNode = updateNode;\n    function createNodeArray(elements, location, hasTrailingComma) {\n        if (elements) {\n            if (ts.isNodeArray(elements)) {\n                return elements;\n            }\n        }\n        else {\n            elements = [];\n        }\n        var array = elements;\n        if (location) {\n            array.pos = location.pos;\n            array.end = location.end;\n        }\n        else {\n            array.pos = -1;\n            array.end = -1;\n        }\n        if (hasTrailingComma) {\n            array.hasTrailingComma = true;\n        }\n        return array;\n    }\n    ts.createNodeArray = createNodeArray;\n    function createSynthesizedNode(kind, startsOnNewLine) {\n        var node = createNode(kind, /*location*/ undefined);\n        node.startsOnNewLine = startsOnNewLine;\n        return node;\n    }\n    ts.createSynthesizedNode = createSynthesizedNode;\n    function createSynthesizedNodeArray(elements) {\n        return createNodeArray(elements, /*location*/ undefined);\n    }\n    ts.createSynthesizedNodeArray = createSynthesizedNodeArray;\n    /**\n     * Creates a shallow, memberwise clone of a node with no source map location.\n     */\n    function getSynthesizedClone(node) {\n        // We don't use \"clone\" from core.ts here, as we need to preserve the prototype chain of\n        // the original node. We also need to exclude specific properties and only include own-\n        // properties (to skip members already defined on the shared prototype).\n        var clone = createNode(node.kind, /*location*/ undefined, node.flags);\n        setOriginalNode(clone, node);\n        for (var key in node) {\n            if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) {\n                continue;\n            }\n            clone[key] = node[key];\n        }\n        return clone;\n    }\n    ts.getSynthesizedClone = getSynthesizedClone;\n    /**\n     * Creates a shallow, memberwise clone of a node for mutation.\n     */\n    function getMutableClone(node) {\n        var clone = getSynthesizedClone(node);\n        clone.pos = node.pos;\n        clone.end = node.end;\n        clone.parent = node.parent;\n        return clone;\n    }\n    ts.getMutableClone = getMutableClone;\n    function createLiteral(value, location) {\n        if (typeof value === \"number\") {\n            var node = createNode(8 /* NumericLiteral */, location, /*flags*/ undefined);\n            node.text = value.toString();\n            return node;\n        }\n        else if (typeof value === \"boolean\") {\n            return createNode(value ? 100 /* TrueKeyword */ : 85 /* FalseKeyword */, location, /*flags*/ undefined);\n        }\n        else if (typeof value === \"string\") {\n            var node = createNode(9 /* StringLiteral */, location, /*flags*/ undefined);\n            node.text = value;\n            return node;\n        }\n        else if (value) {\n            var node = createNode(9 /* StringLiteral */, location, /*flags*/ undefined);\n            node.textSourceNode = value;\n            node.text = value.text;\n            return node;\n        }\n    }\n    ts.createLiteral = createLiteral;\n    // Identifiers\n    var nextAutoGenerateId = 0;\n    function createIdentifier(text, location) {\n        var node = createNode(70 /* Identifier */, location);\n        node.text = ts.escapeIdentifier(text);\n        node.originalKeywordKind = ts.stringToToken(text);\n        node.autoGenerateKind = 0 /* None */;\n        node.autoGenerateId = 0;\n        return node;\n    }\n    ts.createIdentifier = createIdentifier;\n    function createTempVariable(recordTempVariable, location) {\n        var name = createNode(70 /* Identifier */, location);\n        name.text = \"\";\n        name.originalKeywordKind = 0 /* Unknown */;\n        name.autoGenerateKind = 1 /* Auto */;\n        name.autoGenerateId = nextAutoGenerateId;\n        nextAutoGenerateId++;\n        if (recordTempVariable) {\n            recordTempVariable(name);\n        }\n        return name;\n    }\n    ts.createTempVariable = createTempVariable;\n    function createLoopVariable(location) {\n        var name = createNode(70 /* Identifier */, location);\n        name.text = \"\";\n        name.originalKeywordKind = 0 /* Unknown */;\n        name.autoGenerateKind = 2 /* Loop */;\n        name.autoGenerateId = nextAutoGenerateId;\n        nextAutoGenerateId++;\n        return name;\n    }\n    ts.createLoopVariable = createLoopVariable;\n    function createUniqueName(text, location) {\n        var name = createNode(70 /* Identifier */, location);\n        name.text = text;\n        name.originalKeywordKind = 0 /* Unknown */;\n        name.autoGenerateKind = 3 /* Unique */;\n        name.autoGenerateId = nextAutoGenerateId;\n        nextAutoGenerateId++;\n        return name;\n    }\n    ts.createUniqueName = createUniqueName;\n    function getGeneratedNameForNode(node, location) {\n        var name = createNode(70 /* Identifier */, location);\n        name.original = node;\n        name.text = \"\";\n        name.originalKeywordKind = 0 /* Unknown */;\n        name.autoGenerateKind = 4 /* Node */;\n        name.autoGenerateId = nextAutoGenerateId;\n        nextAutoGenerateId++;\n        return name;\n    }\n    ts.getGeneratedNameForNode = getGeneratedNameForNode;\n    // Punctuation\n    function createToken(token) {\n        return createNode(token);\n    }\n    ts.createToken = createToken;\n    // Reserved words\n    function createSuper() {\n        var node = createNode(96 /* SuperKeyword */);\n        return node;\n    }\n    ts.createSuper = createSuper;\n    function createThis(location) {\n        var node = createNode(98 /* ThisKeyword */, location);\n        return node;\n    }\n    ts.createThis = createThis;\n    function createNull() {\n        var node = createNode(94 /* NullKeyword */);\n        return node;\n    }\n    ts.createNull = createNull;\n    // Names\n    function createComputedPropertyName(expression, location) {\n        var node = createNode(142 /* ComputedPropertyName */, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createComputedPropertyName = createComputedPropertyName;\n    function updateComputedPropertyName(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createComputedPropertyName(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateComputedPropertyName = updateComputedPropertyName;\n    // Signature elements\n    function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) {\n        var node = createNode(144 /* Parameter */, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.dotDotDotToken = dotDotDotToken;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.questionToken = questionToken;\n        node.type = type;\n        node.initializer = initializer ? parenthesizeExpressionForList(initializer) : undefined;\n        return node;\n    }\n    ts.createParameter = createParameter;\n    function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) {\n            return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, /*location*/ node, /*flags*/ node.flags), node);\n        }\n        return node;\n    }\n    ts.updateParameter = updateParameter;\n    // Type members\n    function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) {\n        var node = createNode(147 /* PropertyDeclaration */, location);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.questionToken = questionToken;\n        node.type = type;\n        node.initializer = initializer;\n        return node;\n    }\n    ts.createProperty = createProperty;\n    function updateProperty(node, decorators, modifiers, name, type, initializer) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) {\n            return updateNode(createProperty(decorators, modifiers, name, node.questionToken, type, initializer, node), node);\n        }\n        return node;\n    }\n    ts.updateProperty = updateProperty;\n    function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {\n        var node = createNode(149 /* MethodDeclaration */, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.asteriskToken = asteriskToken;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = type;\n        node.body = body;\n        return node;\n    }\n    ts.createMethod = createMethod;\n    function updateMethod(node, decorators, modifiers, name, typeParameters, parameters, type, body) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {\n            return updateNode(createMethod(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, /*location*/ node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateMethod = updateMethod;\n    function createConstructor(decorators, modifiers, parameters, body, location, flags) {\n        var node = createNode(150 /* Constructor */, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.typeParameters = undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = undefined;\n        node.body = body;\n        return node;\n    }\n    ts.createConstructor = createConstructor;\n    function updateConstructor(node, decorators, modifiers, parameters, body) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.parameters !== parameters || node.body !== body) {\n            return updateNode(createConstructor(decorators, modifiers, parameters, body, /*location*/ node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateConstructor = updateConstructor;\n    function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) {\n        var node = createNode(151 /* GetAccessor */, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.typeParameters = undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = type;\n        node.body = body;\n        return node;\n    }\n    ts.createGetAccessor = createGetAccessor;\n    function updateGetAccessor(node, decorators, modifiers, name, parameters, type, body) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.type !== type || node.body !== body) {\n            return updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body, /*location*/ node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateGetAccessor = updateGetAccessor;\n    function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) {\n        var node = createNode(152 /* SetAccessor */, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.typeParameters = undefined;\n        node.parameters = createNodeArray(parameters);\n        node.body = body;\n        return node;\n    }\n    ts.createSetAccessor = createSetAccessor;\n    function updateSetAccessor(node, decorators, modifiers, name, parameters, body) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.body !== body) {\n            return updateNode(createSetAccessor(decorators, modifiers, name, parameters, body, /*location*/ node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateSetAccessor = updateSetAccessor;\n    // Binding Patterns\n    function createObjectBindingPattern(elements, location) {\n        var node = createNode(172 /* ObjectBindingPattern */, location);\n        node.elements = createNodeArray(elements);\n        return node;\n    }\n    ts.createObjectBindingPattern = createObjectBindingPattern;\n    function updateObjectBindingPattern(node, elements) {\n        if (node.elements !== elements) {\n            return updateNode(createObjectBindingPattern(elements, node), node);\n        }\n        return node;\n    }\n    ts.updateObjectBindingPattern = updateObjectBindingPattern;\n    function createArrayBindingPattern(elements, location) {\n        var node = createNode(173 /* ArrayBindingPattern */, location);\n        node.elements = createNodeArray(elements);\n        return node;\n    }\n    ts.createArrayBindingPattern = createArrayBindingPattern;\n    function updateArrayBindingPattern(node, elements) {\n        if (node.elements !== elements) {\n            return updateNode(createArrayBindingPattern(elements, node), node);\n        }\n        return node;\n    }\n    ts.updateArrayBindingPattern = updateArrayBindingPattern;\n    function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) {\n        var node = createNode(174 /* BindingElement */, location);\n        node.propertyName = typeof propertyName === \"string\" ? createIdentifier(propertyName) : propertyName;\n        node.dotDotDotToken = dotDotDotToken;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.initializer = initializer;\n        return node;\n    }\n    ts.createBindingElement = createBindingElement;\n    function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) {\n        if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) {\n            return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node);\n        }\n        return node;\n    }\n    ts.updateBindingElement = updateBindingElement;\n    // Expression\n    function createArrayLiteral(elements, location, multiLine) {\n        var node = createNode(175 /* ArrayLiteralExpression */, location);\n        node.elements = parenthesizeListElements(createNodeArray(elements));\n        if (multiLine) {\n            node.multiLine = true;\n        }\n        return node;\n    }\n    ts.createArrayLiteral = createArrayLiteral;\n    function updateArrayLiteral(node, elements) {\n        if (node.elements !== elements) {\n            return updateNode(createArrayLiteral(elements, node, node.multiLine), node);\n        }\n        return node;\n    }\n    ts.updateArrayLiteral = updateArrayLiteral;\n    function createObjectLiteral(properties, location, multiLine) {\n        var node = createNode(176 /* ObjectLiteralExpression */, location);\n        node.properties = createNodeArray(properties);\n        if (multiLine) {\n            node.multiLine = true;\n        }\n        return node;\n    }\n    ts.createObjectLiteral = createObjectLiteral;\n    function updateObjectLiteral(node, properties) {\n        if (node.properties !== properties) {\n            return updateNode(createObjectLiteral(properties, node, node.multiLine), node);\n        }\n        return node;\n    }\n    ts.updateObjectLiteral = updateObjectLiteral;\n    function createPropertyAccess(expression, name, location, flags) {\n        var node = createNode(177 /* PropertyAccessExpression */, location, flags);\n        node.expression = parenthesizeForAccess(expression);\n        (node.emitNode || (node.emitNode = {})).flags |= 65536 /* NoIndentation */;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        return node;\n    }\n    ts.createPropertyAccess = createPropertyAccess;\n    function updatePropertyAccess(node, expression, name) {\n        if (node.expression !== expression || node.name !== name) {\n            var propertyAccess = createPropertyAccess(expression, name, /*location*/ node, node.flags);\n            // Because we are updating existed propertyAccess we want to inherit its emitFlags instead of using default from createPropertyAccess\n            (propertyAccess.emitNode || (propertyAccess.emitNode = {})).flags = getEmitFlags(node);\n            return updateNode(propertyAccess, node);\n        }\n        return node;\n    }\n    ts.updatePropertyAccess = updatePropertyAccess;\n    function createElementAccess(expression, index, location) {\n        var node = createNode(178 /* ElementAccessExpression */, location);\n        node.expression = parenthesizeForAccess(expression);\n        node.argumentExpression = typeof index === \"number\" ? createLiteral(index) : index;\n        return node;\n    }\n    ts.createElementAccess = createElementAccess;\n    function updateElementAccess(node, expression, argumentExpression) {\n        if (node.expression !== expression || node.argumentExpression !== argumentExpression) {\n            return updateNode(createElementAccess(expression, argumentExpression, node), node);\n        }\n        return node;\n    }\n    ts.updateElementAccess = updateElementAccess;\n    function createCall(expression, typeArguments, argumentsArray, location, flags) {\n        var node = createNode(179 /* CallExpression */, location, flags);\n        node.expression = parenthesizeForAccess(expression);\n        if (typeArguments) {\n            node.typeArguments = createNodeArray(typeArguments);\n        }\n        node.arguments = parenthesizeListElements(createNodeArray(argumentsArray));\n        return node;\n    }\n    ts.createCall = createCall;\n    function updateCall(node, expression, typeArguments, argumentsArray) {\n        if (expression !== node.expression || typeArguments !== node.typeArguments || argumentsArray !== node.arguments) {\n            return updateNode(createCall(expression, typeArguments, argumentsArray, /*location*/ node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateCall = updateCall;\n    function createNew(expression, typeArguments, argumentsArray, location, flags) {\n        var node = createNode(180 /* NewExpression */, location, flags);\n        node.expression = parenthesizeForNew(expression);\n        node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined;\n        node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined;\n        return node;\n    }\n    ts.createNew = createNew;\n    function updateNew(node, expression, typeArguments, argumentsArray) {\n        if (node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray) {\n            return updateNode(createNew(expression, typeArguments, argumentsArray, /*location*/ node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateNew = updateNew;\n    function createTaggedTemplate(tag, template, location) {\n        var node = createNode(181 /* TaggedTemplateExpression */, location);\n        node.tag = parenthesizeForAccess(tag);\n        node.template = template;\n        return node;\n    }\n    ts.createTaggedTemplate = createTaggedTemplate;\n    function updateTaggedTemplate(node, tag, template) {\n        if (node.tag !== tag || node.template !== template) {\n            return updateNode(createTaggedTemplate(tag, template, node), node);\n        }\n        return node;\n    }\n    ts.updateTaggedTemplate = updateTaggedTemplate;\n    function createParen(expression, location) {\n        var node = createNode(183 /* ParenthesizedExpression */, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createParen = createParen;\n    function updateParen(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createParen(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateParen = updateParen;\n    function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {\n        var node = createNode(184 /* FunctionExpression */, location, flags);\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.asteriskToken = asteriskToken;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = type;\n        node.body = body;\n        return node;\n    }\n    ts.createFunctionExpression = createFunctionExpression;\n    function updateFunctionExpression(node, modifiers, name, typeParameters, parameters, type, body) {\n        if (node.name !== name || node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {\n            return updateNode(createFunctionExpression(modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, /*location*/ node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateFunctionExpression = updateFunctionExpression;\n    function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) {\n        var node = createNode(185 /* ArrowFunction */, location, flags);\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = type;\n        node.equalsGreaterThanToken = equalsGreaterThanToken || createToken(35 /* EqualsGreaterThanToken */);\n        node.body = parenthesizeConciseBody(body);\n        return node;\n    }\n    ts.createArrowFunction = createArrowFunction;\n    function updateArrowFunction(node, modifiers, typeParameters, parameters, type, body) {\n        if (node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {\n            return updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, body, /*location*/ node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateArrowFunction = updateArrowFunction;\n    function createDelete(expression, location) {\n        var node = createNode(186 /* DeleteExpression */, location);\n        node.expression = parenthesizePrefixOperand(expression);\n        return node;\n    }\n    ts.createDelete = createDelete;\n    function updateDelete(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createDelete(expression, node), expression);\n        }\n        return node;\n    }\n    ts.updateDelete = updateDelete;\n    function createTypeOf(expression, location) {\n        var node = createNode(187 /* TypeOfExpression */, location);\n        node.expression = parenthesizePrefixOperand(expression);\n        return node;\n    }\n    ts.createTypeOf = createTypeOf;\n    function updateTypeOf(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createTypeOf(expression, node), expression);\n        }\n        return node;\n    }\n    ts.updateTypeOf = updateTypeOf;\n    function createVoid(expression, location) {\n        var node = createNode(188 /* VoidExpression */, location);\n        node.expression = parenthesizePrefixOperand(expression);\n        return node;\n    }\n    ts.createVoid = createVoid;\n    function updateVoid(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createVoid(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateVoid = updateVoid;\n    function createAwait(expression, location) {\n        var node = createNode(189 /* AwaitExpression */, location);\n        node.expression = parenthesizePrefixOperand(expression);\n        return node;\n    }\n    ts.createAwait = createAwait;\n    function updateAwait(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createAwait(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateAwait = updateAwait;\n    function createPrefix(operator, operand, location) {\n        var node = createNode(190 /* PrefixUnaryExpression */, location);\n        node.operator = operator;\n        node.operand = parenthesizePrefixOperand(operand);\n        return node;\n    }\n    ts.createPrefix = createPrefix;\n    function updatePrefix(node, operand) {\n        if (node.operand !== operand) {\n            return updateNode(createPrefix(node.operator, operand, node), node);\n        }\n        return node;\n    }\n    ts.updatePrefix = updatePrefix;\n    function createPostfix(operand, operator, location) {\n        var node = createNode(191 /* PostfixUnaryExpression */, location);\n        node.operand = parenthesizePostfixOperand(operand);\n        node.operator = operator;\n        return node;\n    }\n    ts.createPostfix = createPostfix;\n    function updatePostfix(node, operand) {\n        if (node.operand !== operand) {\n            return updateNode(createPostfix(operand, node.operator, node), node);\n        }\n        return node;\n    }\n    ts.updatePostfix = updatePostfix;\n    function createBinary(left, operator, right, location) {\n        var operatorToken = typeof operator === \"number\" ? createToken(operator) : operator;\n        var operatorKind = operatorToken.kind;\n        var node = createNode(192 /* BinaryExpression */, location);\n        node.left = parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined);\n        node.operatorToken = operatorToken;\n        node.right = parenthesizeBinaryOperand(operatorKind, right, /*isLeftSideOfBinary*/ false, node.left);\n        return node;\n    }\n    ts.createBinary = createBinary;\n    function updateBinary(node, left, right) {\n        if (node.left !== left || node.right !== right) {\n            return updateNode(createBinary(left, node.operatorToken, right, /*location*/ node), node);\n        }\n        return node;\n    }\n    ts.updateBinary = updateBinary;\n    function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) {\n        var node = createNode(193 /* ConditionalExpression */, whenFalse ? location : colonTokenOrLocation);\n        node.condition = parenthesizeForConditionalHead(condition);\n        if (whenFalse) {\n            // second overload\n            node.questionToken = questionTokenOrWhenTrue;\n            node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse);\n            node.colonToken = colonTokenOrLocation;\n            node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse);\n        }\n        else {\n            // first overload\n            node.questionToken = createToken(54 /* QuestionToken */);\n            node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue);\n            node.colonToken = createToken(55 /* ColonToken */);\n            node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse);\n        }\n        return node;\n    }\n    ts.createConditional = createConditional;\n    function updateConditional(node, condition, whenTrue, whenFalse) {\n        if (node.condition !== condition || node.whenTrue !== whenTrue || node.whenFalse !== whenFalse) {\n            return updateNode(createConditional(condition, node.questionToken, whenTrue, node.colonToken, whenFalse, node), node);\n        }\n        return node;\n    }\n    ts.updateConditional = updateConditional;\n    function createTemplateExpression(head, templateSpans, location) {\n        var node = createNode(194 /* TemplateExpression */, location);\n        node.head = head;\n        node.templateSpans = createNodeArray(templateSpans);\n        return node;\n    }\n    ts.createTemplateExpression = createTemplateExpression;\n    function updateTemplateExpression(node, head, templateSpans) {\n        if (node.head !== head || node.templateSpans !== templateSpans) {\n            return updateNode(createTemplateExpression(head, templateSpans, node), node);\n        }\n        return node;\n    }\n    ts.updateTemplateExpression = updateTemplateExpression;\n    function createYield(asteriskToken, expression, location) {\n        var node = createNode(195 /* YieldExpression */, location);\n        node.asteriskToken = asteriskToken;\n        node.expression = expression;\n        return node;\n    }\n    ts.createYield = createYield;\n    function updateYield(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createYield(node.asteriskToken, expression, node), node);\n        }\n        return node;\n    }\n    ts.updateYield = updateYield;\n    function createSpread(expression, location) {\n        var node = createNode(196 /* SpreadElement */, location);\n        node.expression = parenthesizeExpressionForList(expression);\n        return node;\n    }\n    ts.createSpread = createSpread;\n    function updateSpread(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createSpread(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateSpread = updateSpread;\n    function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) {\n        var node = createNode(197 /* ClassExpression */, location);\n        node.decorators = undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.name = name;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.heritageClauses = createNodeArray(heritageClauses);\n        node.members = createNodeArray(members);\n        return node;\n    }\n    ts.createClassExpression = createClassExpression;\n    function updateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members) {\n        if (node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) {\n            return updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members, node), node);\n        }\n        return node;\n    }\n    ts.updateClassExpression = updateClassExpression;\n    function createOmittedExpression(location) {\n        var node = createNode(198 /* OmittedExpression */, location);\n        return node;\n    }\n    ts.createOmittedExpression = createOmittedExpression;\n    function createExpressionWithTypeArguments(typeArguments, expression, location) {\n        var node = createNode(199 /* ExpressionWithTypeArguments */, location);\n        node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined;\n        node.expression = parenthesizeForAccess(expression);\n        return node;\n    }\n    ts.createExpressionWithTypeArguments = createExpressionWithTypeArguments;\n    function updateExpressionWithTypeArguments(node, typeArguments, expression) {\n        if (node.typeArguments !== typeArguments || node.expression !== expression) {\n            return updateNode(createExpressionWithTypeArguments(typeArguments, expression, node), node);\n        }\n        return node;\n    }\n    ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments;\n    // Misc\n    function createTemplateSpan(expression, literal, location) {\n        var node = createNode(202 /* TemplateSpan */, location);\n        node.expression = expression;\n        node.literal = literal;\n        return node;\n    }\n    ts.createTemplateSpan = createTemplateSpan;\n    function updateTemplateSpan(node, expression, literal) {\n        if (node.expression !== expression || node.literal !== literal) {\n            return updateNode(createTemplateSpan(expression, literal, node), node);\n        }\n        return node;\n    }\n    ts.updateTemplateSpan = updateTemplateSpan;\n    // Element\n    function createBlock(statements, location, multiLine, flags) {\n        var block = createNode(204 /* Block */, location, flags);\n        block.statements = createNodeArray(statements);\n        if (multiLine) {\n            block.multiLine = true;\n        }\n        return block;\n    }\n    ts.createBlock = createBlock;\n    function updateBlock(node, statements) {\n        if (statements !== node.statements) {\n            return updateNode(createBlock(statements, /*location*/ node, node.multiLine, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateBlock = updateBlock;\n    function createVariableStatement(modifiers, declarationList, location, flags) {\n        var node = createNode(205 /* VariableStatement */, location, flags);\n        node.decorators = undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList;\n        return node;\n    }\n    ts.createVariableStatement = createVariableStatement;\n    function updateVariableStatement(node, modifiers, declarationList) {\n        if (node.modifiers !== modifiers || node.declarationList !== declarationList) {\n            return updateNode(createVariableStatement(modifiers, declarationList, /*location*/ node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateVariableStatement = updateVariableStatement;\n    function createVariableDeclarationList(declarations, location, flags) {\n        var node = createNode(224 /* VariableDeclarationList */, location, flags);\n        node.declarations = createNodeArray(declarations);\n        return node;\n    }\n    ts.createVariableDeclarationList = createVariableDeclarationList;\n    function updateVariableDeclarationList(node, declarations) {\n        if (node.declarations !== declarations) {\n            return updateNode(createVariableDeclarationList(declarations, /*location*/ node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateVariableDeclarationList = updateVariableDeclarationList;\n    function createVariableDeclaration(name, type, initializer, location, flags) {\n        var node = createNode(223 /* VariableDeclaration */, location, flags);\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.type = type;\n        node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined;\n        return node;\n    }\n    ts.createVariableDeclaration = createVariableDeclaration;\n    function updateVariableDeclaration(node, name, type, initializer) {\n        if (node.name !== name || node.type !== type || node.initializer !== initializer) {\n            return updateNode(createVariableDeclaration(name, type, initializer, /*location*/ node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateVariableDeclaration = updateVariableDeclaration;\n    function createEmptyStatement(location) {\n        return createNode(206 /* EmptyStatement */, location);\n    }\n    ts.createEmptyStatement = createEmptyStatement;\n    function createStatement(expression, location, flags) {\n        var node = createNode(207 /* ExpressionStatement */, location, flags);\n        node.expression = parenthesizeExpressionForExpressionStatement(expression);\n        return node;\n    }\n    ts.createStatement = createStatement;\n    function updateStatement(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createStatement(expression, /*location*/ node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateStatement = updateStatement;\n    function createIf(expression, thenStatement, elseStatement, location) {\n        var node = createNode(208 /* IfStatement */, location);\n        node.expression = expression;\n        node.thenStatement = thenStatement;\n        node.elseStatement = elseStatement;\n        return node;\n    }\n    ts.createIf = createIf;\n    function updateIf(node, expression, thenStatement, elseStatement) {\n        if (node.expression !== expression || node.thenStatement !== thenStatement || node.elseStatement !== elseStatement) {\n            return updateNode(createIf(expression, thenStatement, elseStatement, /*location*/ node), node);\n        }\n        return node;\n    }\n    ts.updateIf = updateIf;\n    function createDo(statement, expression, location) {\n        var node = createNode(209 /* DoStatement */, location);\n        node.statement = statement;\n        node.expression = expression;\n        return node;\n    }\n    ts.createDo = createDo;\n    function updateDo(node, statement, expression) {\n        if (node.statement !== statement || node.expression !== expression) {\n            return updateNode(createDo(statement, expression, node), node);\n        }\n        return node;\n    }\n    ts.updateDo = updateDo;\n    function createWhile(expression, statement, location) {\n        var node = createNode(210 /* WhileStatement */, location);\n        node.expression = expression;\n        node.statement = statement;\n        return node;\n    }\n    ts.createWhile = createWhile;\n    function updateWhile(node, expression, statement) {\n        if (node.expression !== expression || node.statement !== statement) {\n            return updateNode(createWhile(expression, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateWhile = updateWhile;\n    function createFor(initializer, condition, incrementor, statement, location) {\n        var node = createNode(211 /* ForStatement */, location, /*flags*/ undefined);\n        node.initializer = initializer;\n        node.condition = condition;\n        node.incrementor = incrementor;\n        node.statement = statement;\n        return node;\n    }\n    ts.createFor = createFor;\n    function updateFor(node, initializer, condition, incrementor, statement) {\n        if (node.initializer !== initializer || node.condition !== condition || node.incrementor !== incrementor || node.statement !== statement) {\n            return updateNode(createFor(initializer, condition, incrementor, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateFor = updateFor;\n    function createForIn(initializer, expression, statement, location) {\n        var node = createNode(212 /* ForInStatement */, location);\n        node.initializer = initializer;\n        node.expression = expression;\n        node.statement = statement;\n        return node;\n    }\n    ts.createForIn = createForIn;\n    function updateForIn(node, initializer, expression, statement) {\n        if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) {\n            return updateNode(createForIn(initializer, expression, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateForIn = updateForIn;\n    function createForOf(initializer, expression, statement, location) {\n        var node = createNode(213 /* ForOfStatement */, location);\n        node.initializer = initializer;\n        node.expression = expression;\n        node.statement = statement;\n        return node;\n    }\n    ts.createForOf = createForOf;\n    function updateForOf(node, initializer, expression, statement) {\n        if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) {\n            return updateNode(createForOf(initializer, expression, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateForOf = updateForOf;\n    function createContinue(label, location) {\n        var node = createNode(214 /* ContinueStatement */, location);\n        if (label) {\n            node.label = label;\n        }\n        return node;\n    }\n    ts.createContinue = createContinue;\n    function updateContinue(node, label) {\n        if (node.label !== label) {\n            return updateNode(createContinue(label, node), node);\n        }\n        return node;\n    }\n    ts.updateContinue = updateContinue;\n    function createBreak(label, location) {\n        var node = createNode(215 /* BreakStatement */, location);\n        if (label) {\n            node.label = label;\n        }\n        return node;\n    }\n    ts.createBreak = createBreak;\n    function updateBreak(node, label) {\n        if (node.label !== label) {\n            return updateNode(createBreak(label, node), node);\n        }\n        return node;\n    }\n    ts.updateBreak = updateBreak;\n    function createReturn(expression, location) {\n        var node = createNode(216 /* ReturnStatement */, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createReturn = createReturn;\n    function updateReturn(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createReturn(expression, /*location*/ node), node);\n        }\n        return node;\n    }\n    ts.updateReturn = updateReturn;\n    function createWith(expression, statement, location) {\n        var node = createNode(217 /* WithStatement */, location);\n        node.expression = expression;\n        node.statement = statement;\n        return node;\n    }\n    ts.createWith = createWith;\n    function updateWith(node, expression, statement) {\n        if (node.expression !== expression || node.statement !== statement) {\n            return updateNode(createWith(expression, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateWith = updateWith;\n    function createSwitch(expression, caseBlock, location) {\n        var node = createNode(218 /* SwitchStatement */, location);\n        node.expression = parenthesizeExpressionForList(expression);\n        node.caseBlock = caseBlock;\n        return node;\n    }\n    ts.createSwitch = createSwitch;\n    function updateSwitch(node, expression, caseBlock) {\n        if (node.expression !== expression || node.caseBlock !== caseBlock) {\n            return updateNode(createSwitch(expression, caseBlock, node), node);\n        }\n        return node;\n    }\n    ts.updateSwitch = updateSwitch;\n    function createLabel(label, statement, location) {\n        var node = createNode(219 /* LabeledStatement */, location);\n        node.label = typeof label === \"string\" ? createIdentifier(label) : label;\n        node.statement = statement;\n        return node;\n    }\n    ts.createLabel = createLabel;\n    function updateLabel(node, label, statement) {\n        if (node.label !== label || node.statement !== statement) {\n            return updateNode(createLabel(label, statement, node), node);\n        }\n        return node;\n    }\n    ts.updateLabel = updateLabel;\n    function createThrow(expression, location) {\n        var node = createNode(220 /* ThrowStatement */, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createThrow = createThrow;\n    function updateThrow(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createThrow(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateThrow = updateThrow;\n    function createTry(tryBlock, catchClause, finallyBlock, location) {\n        var node = createNode(221 /* TryStatement */, location);\n        node.tryBlock = tryBlock;\n        node.catchClause = catchClause;\n        node.finallyBlock = finallyBlock;\n        return node;\n    }\n    ts.createTry = createTry;\n    function updateTry(node, tryBlock, catchClause, finallyBlock) {\n        if (node.tryBlock !== tryBlock || node.catchClause !== catchClause || node.finallyBlock !== finallyBlock) {\n            return updateNode(createTry(tryBlock, catchClause, finallyBlock, node), node);\n        }\n        return node;\n    }\n    ts.updateTry = updateTry;\n    function createCaseBlock(clauses, location) {\n        var node = createNode(232 /* CaseBlock */, location);\n        node.clauses = createNodeArray(clauses);\n        return node;\n    }\n    ts.createCaseBlock = createCaseBlock;\n    function updateCaseBlock(node, clauses) {\n        if (node.clauses !== clauses) {\n            return updateNode(createCaseBlock(clauses, node), node);\n        }\n        return node;\n    }\n    ts.updateCaseBlock = updateCaseBlock;\n    function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {\n        var node = createNode(225 /* FunctionDeclaration */, location, flags);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.asteriskToken = asteriskToken;\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.parameters = createNodeArray(parameters);\n        node.type = type;\n        node.body = body;\n        return node;\n    }\n    ts.createFunctionDeclaration = createFunctionDeclaration;\n    function updateFunctionDeclaration(node, decorators, modifiers, name, typeParameters, parameters, type, body) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) {\n            return updateNode(createFunctionDeclaration(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, /*location*/ node, node.flags), node);\n        }\n        return node;\n    }\n    ts.updateFunctionDeclaration = updateFunctionDeclaration;\n    function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) {\n        var node = createNode(226 /* ClassDeclaration */, location);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.name = name;\n        node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;\n        node.heritageClauses = createNodeArray(heritageClauses);\n        node.members = createNodeArray(members);\n        return node;\n    }\n    ts.createClassDeclaration = createClassDeclaration;\n    function updateClassDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) {\n            return updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, node), node);\n        }\n        return node;\n    }\n    ts.updateClassDeclaration = updateClassDeclaration;\n    function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) {\n        var node = createNode(235 /* ImportDeclaration */, location);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.importClause = importClause;\n        node.moduleSpecifier = moduleSpecifier;\n        return node;\n    }\n    ts.createImportDeclaration = createImportDeclaration;\n    function updateImportDeclaration(node, decorators, modifiers, importClause, moduleSpecifier) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier) {\n            return updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, node), node);\n        }\n        return node;\n    }\n    ts.updateImportDeclaration = updateImportDeclaration;\n    function createImportClause(name, namedBindings, location) {\n        var node = createNode(236 /* ImportClause */, location);\n        node.name = name;\n        node.namedBindings = namedBindings;\n        return node;\n    }\n    ts.createImportClause = createImportClause;\n    function updateImportClause(node, name, namedBindings) {\n        if (node.name !== name || node.namedBindings !== namedBindings) {\n            return updateNode(createImportClause(name, namedBindings, node), node);\n        }\n        return node;\n    }\n    ts.updateImportClause = updateImportClause;\n    function createNamespaceImport(name, location) {\n        var node = createNode(237 /* NamespaceImport */, location);\n        node.name = name;\n        return node;\n    }\n    ts.createNamespaceImport = createNamespaceImport;\n    function updateNamespaceImport(node, name) {\n        if (node.name !== name) {\n            return updateNode(createNamespaceImport(name, node), node);\n        }\n        return node;\n    }\n    ts.updateNamespaceImport = updateNamespaceImport;\n    function createNamedImports(elements, location) {\n        var node = createNode(238 /* NamedImports */, location);\n        node.elements = createNodeArray(elements);\n        return node;\n    }\n    ts.createNamedImports = createNamedImports;\n    function updateNamedImports(node, elements) {\n        if (node.elements !== elements) {\n            return updateNode(createNamedImports(elements, node), node);\n        }\n        return node;\n    }\n    ts.updateNamedImports = updateNamedImports;\n    function createImportSpecifier(propertyName, name, location) {\n        var node = createNode(239 /* ImportSpecifier */, location);\n        node.propertyName = propertyName;\n        node.name = name;\n        return node;\n    }\n    ts.createImportSpecifier = createImportSpecifier;\n    function updateImportSpecifier(node, propertyName, name) {\n        if (node.propertyName !== propertyName || node.name !== name) {\n            return updateNode(createImportSpecifier(propertyName, name, node), node);\n        }\n        return node;\n    }\n    ts.updateImportSpecifier = updateImportSpecifier;\n    function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) {\n        var node = createNode(240 /* ExportAssignment */, location);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.isExportEquals = isExportEquals;\n        node.expression = expression;\n        return node;\n    }\n    ts.createExportAssignment = createExportAssignment;\n    function updateExportAssignment(node, decorators, modifiers, expression) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.expression !== expression) {\n            return updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression, node), node);\n        }\n        return node;\n    }\n    ts.updateExportAssignment = updateExportAssignment;\n    function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) {\n        var node = createNode(241 /* ExportDeclaration */, location);\n        node.decorators = decorators ? createNodeArray(decorators) : undefined;\n        node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;\n        node.exportClause = exportClause;\n        node.moduleSpecifier = moduleSpecifier;\n        return node;\n    }\n    ts.createExportDeclaration = createExportDeclaration;\n    function updateExportDeclaration(node, decorators, modifiers, exportClause, moduleSpecifier) {\n        if (node.decorators !== decorators || node.modifiers !== modifiers || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier) {\n            return updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, node), node);\n        }\n        return node;\n    }\n    ts.updateExportDeclaration = updateExportDeclaration;\n    function createNamedExports(elements, location) {\n        var node = createNode(242 /* NamedExports */, location);\n        node.elements = createNodeArray(elements);\n        return node;\n    }\n    ts.createNamedExports = createNamedExports;\n    function updateNamedExports(node, elements) {\n        if (node.elements !== elements) {\n            return updateNode(createNamedExports(elements, node), node);\n        }\n        return node;\n    }\n    ts.updateNamedExports = updateNamedExports;\n    function createExportSpecifier(name, propertyName, location) {\n        var node = createNode(243 /* ExportSpecifier */, location);\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.propertyName = typeof propertyName === \"string\" ? createIdentifier(propertyName) : propertyName;\n        return node;\n    }\n    ts.createExportSpecifier = createExportSpecifier;\n    function updateExportSpecifier(node, name, propertyName) {\n        if (node.name !== name || node.propertyName !== propertyName) {\n            return updateNode(createExportSpecifier(name, propertyName, node), node);\n        }\n        return node;\n    }\n    ts.updateExportSpecifier = updateExportSpecifier;\n    // JSX\n    function createJsxElement(openingElement, children, closingElement, location) {\n        var node = createNode(246 /* JsxElement */, location);\n        node.openingElement = openingElement;\n        node.children = createNodeArray(children);\n        node.closingElement = closingElement;\n        return node;\n    }\n    ts.createJsxElement = createJsxElement;\n    function updateJsxElement(node, openingElement, children, closingElement) {\n        if (node.openingElement !== openingElement || node.children !== children || node.closingElement !== closingElement) {\n            return updateNode(createJsxElement(openingElement, children, closingElement, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxElement = updateJsxElement;\n    function createJsxSelfClosingElement(tagName, attributes, location) {\n        var node = createNode(247 /* JsxSelfClosingElement */, location);\n        node.tagName = tagName;\n        node.attributes = createNodeArray(attributes);\n        return node;\n    }\n    ts.createJsxSelfClosingElement = createJsxSelfClosingElement;\n    function updateJsxSelfClosingElement(node, tagName, attributes) {\n        if (node.tagName !== tagName || node.attributes !== attributes) {\n            return updateNode(createJsxSelfClosingElement(tagName, attributes, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement;\n    function createJsxOpeningElement(tagName, attributes, location) {\n        var node = createNode(248 /* JsxOpeningElement */, location);\n        node.tagName = tagName;\n        node.attributes = createNodeArray(attributes);\n        return node;\n    }\n    ts.createJsxOpeningElement = createJsxOpeningElement;\n    function updateJsxOpeningElement(node, tagName, attributes) {\n        if (node.tagName !== tagName || node.attributes !== attributes) {\n            return updateNode(createJsxOpeningElement(tagName, attributes, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxOpeningElement = updateJsxOpeningElement;\n    function createJsxClosingElement(tagName, location) {\n        var node = createNode(249 /* JsxClosingElement */, location);\n        node.tagName = tagName;\n        return node;\n    }\n    ts.createJsxClosingElement = createJsxClosingElement;\n    function updateJsxClosingElement(node, tagName) {\n        if (node.tagName !== tagName) {\n            return updateNode(createJsxClosingElement(tagName, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxClosingElement = updateJsxClosingElement;\n    function createJsxAttribute(name, initializer, location) {\n        var node = createNode(250 /* JsxAttribute */, location);\n        node.name = name;\n        node.initializer = initializer;\n        return node;\n    }\n    ts.createJsxAttribute = createJsxAttribute;\n    function updateJsxAttribute(node, name, initializer) {\n        if (node.name !== name || node.initializer !== initializer) {\n            return updateNode(createJsxAttribute(name, initializer, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxAttribute = updateJsxAttribute;\n    function createJsxSpreadAttribute(expression, location) {\n        var node = createNode(251 /* JsxSpreadAttribute */, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createJsxSpreadAttribute = createJsxSpreadAttribute;\n    function updateJsxSpreadAttribute(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createJsxSpreadAttribute(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute;\n    function createJsxExpression(expression, location) {\n        var node = createNode(252 /* JsxExpression */, location);\n        node.expression = expression;\n        return node;\n    }\n    ts.createJsxExpression = createJsxExpression;\n    function updateJsxExpression(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createJsxExpression(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateJsxExpression = updateJsxExpression;\n    // Clauses\n    function createHeritageClause(token, types, location) {\n        var node = createNode(255 /* HeritageClause */, location);\n        node.token = token;\n        node.types = createNodeArray(types);\n        return node;\n    }\n    ts.createHeritageClause = createHeritageClause;\n    function updateHeritageClause(node, types) {\n        if (node.types !== types) {\n            return updateNode(createHeritageClause(node.token, types, node), node);\n        }\n        return node;\n    }\n    ts.updateHeritageClause = updateHeritageClause;\n    function createCaseClause(expression, statements, location) {\n        var node = createNode(253 /* CaseClause */, location);\n        node.expression = parenthesizeExpressionForList(expression);\n        node.statements = createNodeArray(statements);\n        return node;\n    }\n    ts.createCaseClause = createCaseClause;\n    function updateCaseClause(node, expression, statements) {\n        if (node.expression !== expression || node.statements !== statements) {\n            return updateNode(createCaseClause(expression, statements, node), node);\n        }\n        return node;\n    }\n    ts.updateCaseClause = updateCaseClause;\n    function createDefaultClause(statements, location) {\n        var node = createNode(254 /* DefaultClause */, location);\n        node.statements = createNodeArray(statements);\n        return node;\n    }\n    ts.createDefaultClause = createDefaultClause;\n    function updateDefaultClause(node, statements) {\n        if (node.statements !== statements) {\n            return updateNode(createDefaultClause(statements, node), node);\n        }\n        return node;\n    }\n    ts.updateDefaultClause = updateDefaultClause;\n    function createCatchClause(variableDeclaration, block, location) {\n        var node = createNode(256 /* CatchClause */, location);\n        node.variableDeclaration = typeof variableDeclaration === \"string\" ? createVariableDeclaration(variableDeclaration) : variableDeclaration;\n        node.block = block;\n        return node;\n    }\n    ts.createCatchClause = createCatchClause;\n    function updateCatchClause(node, variableDeclaration, block) {\n        if (node.variableDeclaration !== variableDeclaration || node.block !== block) {\n            return updateNode(createCatchClause(variableDeclaration, block, node), node);\n        }\n        return node;\n    }\n    ts.updateCatchClause = updateCatchClause;\n    // Property assignments\n    function createPropertyAssignment(name, initializer, location) {\n        var node = createNode(257 /* PropertyAssignment */, location);\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.questionToken = undefined;\n        node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined;\n        return node;\n    }\n    ts.createPropertyAssignment = createPropertyAssignment;\n    function updatePropertyAssignment(node, name, initializer) {\n        if (node.name !== name || node.initializer !== initializer) {\n            return updateNode(createPropertyAssignment(name, initializer, node), node);\n        }\n        return node;\n    }\n    ts.updatePropertyAssignment = updatePropertyAssignment;\n    function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) {\n        var node = createNode(258 /* ShorthandPropertyAssignment */, location);\n        node.name = typeof name === \"string\" ? createIdentifier(name) : name;\n        node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined;\n        return node;\n    }\n    ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment;\n    function createSpreadAssignment(expression, location) {\n        var node = createNode(259 /* SpreadAssignment */, location);\n        node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined;\n        return node;\n    }\n    ts.createSpreadAssignment = createSpreadAssignment;\n    function updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer) {\n        if (node.name !== name || node.objectAssignmentInitializer !== objectAssignmentInitializer) {\n            return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer, node), node);\n        }\n        return node;\n    }\n    ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment;\n    function updateSpreadAssignment(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createSpreadAssignment(expression, node), node);\n        }\n        return node;\n    }\n    ts.updateSpreadAssignment = updateSpreadAssignment;\n    // Top-level nodes\n    function updateSourceFileNode(node, statements) {\n        if (node.statements !== statements) {\n            var updated = createNode(261 /* SourceFile */, /*location*/ node, node.flags);\n            updated.statements = createNodeArray(statements);\n            updated.endOfFileToken = node.endOfFileToken;\n            updated.fileName = node.fileName;\n            updated.path = node.path;\n            updated.text = node.text;\n            if (node.amdDependencies !== undefined)\n                updated.amdDependencies = node.amdDependencies;\n            if (node.moduleName !== undefined)\n                updated.moduleName = node.moduleName;\n            if (node.referencedFiles !== undefined)\n                updated.referencedFiles = node.referencedFiles;\n            if (node.typeReferenceDirectives !== undefined)\n                updated.typeReferenceDirectives = node.typeReferenceDirectives;\n            if (node.languageVariant !== undefined)\n                updated.languageVariant = node.languageVariant;\n            if (node.isDeclarationFile !== undefined)\n                updated.isDeclarationFile = node.isDeclarationFile;\n            if (node.renamedDependencies !== undefined)\n                updated.renamedDependencies = node.renamedDependencies;\n            if (node.hasNoDefaultLib !== undefined)\n                updated.hasNoDefaultLib = node.hasNoDefaultLib;\n            if (node.languageVersion !== undefined)\n                updated.languageVersion = node.languageVersion;\n            if (node.scriptKind !== undefined)\n                updated.scriptKind = node.scriptKind;\n            if (node.externalModuleIndicator !== undefined)\n                updated.externalModuleIndicator = node.externalModuleIndicator;\n            if (node.commonJsModuleIndicator !== undefined)\n                updated.commonJsModuleIndicator = node.commonJsModuleIndicator;\n            if (node.identifiers !== undefined)\n                updated.identifiers = node.identifiers;\n            if (node.nodeCount !== undefined)\n                updated.nodeCount = node.nodeCount;\n            if (node.identifierCount !== undefined)\n                updated.identifierCount = node.identifierCount;\n            if (node.symbolCount !== undefined)\n                updated.symbolCount = node.symbolCount;\n            if (node.parseDiagnostics !== undefined)\n                updated.parseDiagnostics = node.parseDiagnostics;\n            if (node.bindDiagnostics !== undefined)\n                updated.bindDiagnostics = node.bindDiagnostics;\n            if (node.lineMap !== undefined)\n                updated.lineMap = node.lineMap;\n            if (node.classifiableNames !== undefined)\n                updated.classifiableNames = node.classifiableNames;\n            if (node.resolvedModules !== undefined)\n                updated.resolvedModules = node.resolvedModules;\n            if (node.resolvedTypeReferenceDirectiveNames !== undefined)\n                updated.resolvedTypeReferenceDirectiveNames = node.resolvedTypeReferenceDirectiveNames;\n            if (node.imports !== undefined)\n                updated.imports = node.imports;\n            if (node.moduleAugmentations !== undefined)\n                updated.moduleAugmentations = node.moduleAugmentations;\n            return updateNode(updated, node);\n        }\n        return node;\n    }\n    ts.updateSourceFileNode = updateSourceFileNode;\n    // Transformation nodes\n    /**\n     * Creates a synthetic statement to act as a placeholder for a not-emitted statement in\n     * order to preserve comments.\n     *\n     * @param original The original statement.\n     */\n    function createNotEmittedStatement(original) {\n        var node = createNode(293 /* NotEmittedStatement */, /*location*/ original);\n        node.original = original;\n        return node;\n    }\n    ts.createNotEmittedStatement = createNotEmittedStatement;\n    /**\n     * Creates a synthetic element to act as a placeholder for the end of an emitted declaration in\n     * order to properly emit exports.\n     */\n    function createEndOfDeclarationMarker(original) {\n        var node = createNode(296 /* EndOfDeclarationMarker */);\n        node.emitNode = {};\n        node.original = original;\n        return node;\n    }\n    ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker;\n    /**\n     * Creates a synthetic element to act as a placeholder for the beginning of a merged declaration in\n     * order to properly emit exports.\n     */\n    function createMergeDeclarationMarker(original) {\n        var node = createNode(295 /* MergeDeclarationMarker */);\n        node.emitNode = {};\n        node.original = original;\n        return node;\n    }\n    ts.createMergeDeclarationMarker = createMergeDeclarationMarker;\n    /**\n     * Creates a synthetic expression to act as a placeholder for a not-emitted expression in\n     * order to preserve comments or sourcemap positions.\n     *\n     * @param expression The inner expression to emit.\n     * @param original The original outer expression.\n     * @param location The location for the expression. Defaults to the positions from \"original\" if provided.\n     */\n    function createPartiallyEmittedExpression(expression, original, location) {\n        var node = createNode(294 /* PartiallyEmittedExpression */, /*location*/ location || original);\n        node.expression = expression;\n        node.original = original;\n        return node;\n    }\n    ts.createPartiallyEmittedExpression = createPartiallyEmittedExpression;\n    function updatePartiallyEmittedExpression(node, expression) {\n        if (node.expression !== expression) {\n            return updateNode(createPartiallyEmittedExpression(expression, node.original, node), node);\n        }\n        return node;\n    }\n    ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;\n    /**\n     * Creates a node that emits a string of raw text in an expression position. Raw text is never\n     * transformed, should be ES3 compliant, and should have the same precedence as\n     * PrimaryExpression.\n     *\n     * @param text The raw text of the node.\n     */\n    function createRawExpression(text) {\n        var node = createNode(297 /* RawExpression */);\n        node.text = text;\n        return node;\n    }\n    ts.createRawExpression = createRawExpression;\n    // Compound nodes\n    function createComma(left, right) {\n        return createBinary(left, 25 /* CommaToken */, right);\n    }\n    ts.createComma = createComma;\n    function createLessThan(left, right, location) {\n        return createBinary(left, 26 /* LessThanToken */, right, location);\n    }\n    ts.createLessThan = createLessThan;\n    function createAssignment(left, right, location) {\n        return createBinary(left, 57 /* EqualsToken */, right, location);\n    }\n    ts.createAssignment = createAssignment;\n    function createStrictEquality(left, right) {\n        return createBinary(left, 33 /* EqualsEqualsEqualsToken */, right);\n    }\n    ts.createStrictEquality = createStrictEquality;\n    function createStrictInequality(left, right) {\n        return createBinary(left, 34 /* ExclamationEqualsEqualsToken */, right);\n    }\n    ts.createStrictInequality = createStrictInequality;\n    function createAdd(left, right) {\n        return createBinary(left, 36 /* PlusToken */, right);\n    }\n    ts.createAdd = createAdd;\n    function createSubtract(left, right) {\n        return createBinary(left, 37 /* MinusToken */, right);\n    }\n    ts.createSubtract = createSubtract;\n    function createPostfixIncrement(operand, location) {\n        return createPostfix(operand, 42 /* PlusPlusToken */, location);\n    }\n    ts.createPostfixIncrement = createPostfixIncrement;\n    function createLogicalAnd(left, right) {\n        return createBinary(left, 52 /* AmpersandAmpersandToken */, right);\n    }\n    ts.createLogicalAnd = createLogicalAnd;\n    function createLogicalOr(left, right) {\n        return createBinary(left, 53 /* BarBarToken */, right);\n    }\n    ts.createLogicalOr = createLogicalOr;\n    function createLogicalNot(operand) {\n        return createPrefix(50 /* ExclamationToken */, operand);\n    }\n    ts.createLogicalNot = createLogicalNot;\n    function createVoidZero() {\n        return createVoid(createLiteral(0));\n    }\n    ts.createVoidZero = createVoidZero;\n    function createTypeCheck(value, tag) {\n        return tag === \"undefined\"\n            ? createStrictEquality(value, createVoidZero())\n            : createStrictEquality(createTypeOf(value), createLiteral(tag));\n    }\n    ts.createTypeCheck = createTypeCheck;\n    function createMemberAccessForPropertyName(target, memberName, location) {\n        if (ts.isComputedPropertyName(memberName)) {\n            return createElementAccess(target, memberName.expression, location);\n        }\n        else {\n            var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location);\n            (expression.emitNode || (expression.emitNode = {})).flags |= 64 /* NoNestedSourceMaps */;\n            return expression;\n        }\n    }\n    ts.createMemberAccessForPropertyName = createMemberAccessForPropertyName;\n    function createFunctionCall(func, thisArg, argumentsList, location) {\n        return createCall(createPropertyAccess(func, \"call\"), \n        /*typeArguments*/ undefined, [\n            thisArg\n        ].concat(argumentsList), location);\n    }\n    ts.createFunctionCall = createFunctionCall;\n    function createFunctionApply(func, thisArg, argumentsExpression, location) {\n        return createCall(createPropertyAccess(func, \"apply\"), \n        /*typeArguments*/ undefined, [\n            thisArg,\n            argumentsExpression\n        ], location);\n    }\n    ts.createFunctionApply = createFunctionApply;\n    function createArraySlice(array, start) {\n        var argumentsList = [];\n        if (start !== undefined) {\n            argumentsList.push(typeof start === \"number\" ? createLiteral(start) : start);\n        }\n        return createCall(createPropertyAccess(array, \"slice\"), /*typeArguments*/ undefined, argumentsList);\n    }\n    ts.createArraySlice = createArraySlice;\n    function createArrayConcat(array, values) {\n        return createCall(createPropertyAccess(array, \"concat\"), \n        /*typeArguments*/ undefined, values);\n    }\n    ts.createArrayConcat = createArrayConcat;\n    function createMathPow(left, right, location) {\n        return createCall(createPropertyAccess(createIdentifier(\"Math\"), \"pow\"), \n        /*typeArguments*/ undefined, [left, right], location);\n    }\n    ts.createMathPow = createMathPow;\n    function createReactNamespace(reactNamespace, parent) {\n        // To ensure the emit resolver can properly resolve the namespace, we need to\n        // treat this identifier as if it were a source tree node by clearing the `Synthesized`\n        // flag and setting a parent node.\n        var react = createIdentifier(reactNamespace || \"React\");\n        react.flags &= ~8 /* Synthesized */;\n        // Set the parent that is in parse tree\n        // this makes sure that parent chain is intact for checker to traverse complete scope tree\n        react.parent = ts.getParseTreeNode(parent);\n        return react;\n    }\n    function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) {\n        if (ts.isQualifiedName(jsxFactory)) {\n            var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent);\n            var right = createSynthesizedNode(70 /* Identifier */);\n            right.text = jsxFactory.right.text;\n            return createPropertyAccess(left, right);\n        }\n        else {\n            return createReactNamespace(jsxFactory.text, parent);\n        }\n    }\n    function createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parent) {\n        return jsxFactoryEntity ?\n            createJsxFactoryExpressionFromEntityName(jsxFactoryEntity, parent) :\n            createPropertyAccess(createReactNamespace(reactNamespace, parent), \"createElement\");\n    }\n    function createExpressionForJsxElement(jsxFactoryEntity, reactNamespace, tagName, props, children, parentElement, location) {\n        var argumentsList = [tagName];\n        if (props) {\n            argumentsList.push(props);\n        }\n        if (children && children.length > 0) {\n            if (!props) {\n                argumentsList.push(createNull());\n            }\n            if (children.length > 1) {\n                for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {\n                    var child = children_1[_i];\n                    child.startsOnNewLine = true;\n                    argumentsList.push(child);\n                }\n            }\n            else {\n                argumentsList.push(children[0]);\n            }\n        }\n        return createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), \n        /*typeArguments*/ undefined, argumentsList, location);\n    }\n    ts.createExpressionForJsxElement = createExpressionForJsxElement;\n    function createExportDefault(expression) {\n        return createExportAssignment(/*decorators*/ undefined, /*modifiers*/ undefined, /*isExportEquals*/ false, expression);\n    }\n    ts.createExportDefault = createExportDefault;\n    function createExternalModuleExport(exportName) {\n        return createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createNamedExports([createExportSpecifier(exportName)]));\n    }\n    ts.createExternalModuleExport = createExternalModuleExport;\n    function createLetStatement(name, initializer, location) {\n        return createVariableStatement(/*modifiers*/ undefined, createLetDeclarationList([createVariableDeclaration(name, /*type*/ undefined, initializer)]), location);\n    }\n    ts.createLetStatement = createLetStatement;\n    function createLetDeclarationList(declarations, location) {\n        return createVariableDeclarationList(declarations, location, 1 /* Let */);\n    }\n    ts.createLetDeclarationList = createLetDeclarationList;\n    function createConstDeclarationList(declarations, location) {\n        return createVariableDeclarationList(declarations, location, 2 /* Const */);\n    }\n    ts.createConstDeclarationList = createConstDeclarationList;\n    // Helpers\n    function getHelperName(name) {\n        return setEmitFlags(createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */);\n    }\n    ts.getHelperName = getHelperName;\n    function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {\n        var target = skipParentheses(node);\n        switch (target.kind) {\n            case 70 /* Identifier */:\n                return cacheIdentifiers;\n            case 98 /* ThisKeyword */:\n            case 8 /* NumericLiteral */:\n            case 9 /* StringLiteral */:\n                return false;\n            case 175 /* ArrayLiteralExpression */:\n                var elements = target.elements;\n                if (elements.length === 0) {\n                    return false;\n                }\n                return true;\n            case 176 /* ObjectLiteralExpression */:\n                return target.properties.length > 0;\n            default:\n                return true;\n        }\n    }\n    function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers) {\n        var callee = skipOuterExpressions(expression, 7 /* All */);\n        var thisArg;\n        var target;\n        if (ts.isSuperProperty(callee)) {\n            thisArg = createThis();\n            target = callee;\n        }\n        else if (callee.kind === 96 /* SuperKeyword */) {\n            thisArg = createThis();\n            target = languageVersion < 2 /* ES2015 */ ? createIdentifier(\"_super\", /*location*/ callee) : callee;\n        }\n        else {\n            switch (callee.kind) {\n                case 177 /* PropertyAccessExpression */: {\n                    if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {\n                        // for `a.b()` target is `(_a = a).b` and thisArg is `_a`\n                        thisArg = createTempVariable(recordTempVariable);\n                        target = createPropertyAccess(createAssignment(thisArg, callee.expression, \n                        /*location*/ callee.expression), callee.name, \n                        /*location*/ callee);\n                    }\n                    else {\n                        thisArg = callee.expression;\n                        target = callee;\n                    }\n                    break;\n                }\n                case 178 /* ElementAccessExpression */: {\n                    if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {\n                        // for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a`\n                        thisArg = createTempVariable(recordTempVariable);\n                        target = createElementAccess(createAssignment(thisArg, callee.expression, \n                        /*location*/ callee.expression), callee.argumentExpression, \n                        /*location*/ callee);\n                    }\n                    else {\n                        thisArg = callee.expression;\n                        target = callee;\n                    }\n                    break;\n                }\n                default: {\n                    // for `a()` target is `a` and thisArg is `void 0`\n                    thisArg = createVoidZero();\n                    target = parenthesizeForAccess(expression);\n                    break;\n                }\n            }\n        }\n        return { target: target, thisArg: thisArg };\n    }\n    ts.createCallBinding = createCallBinding;\n    function inlineExpressions(expressions) {\n        return ts.reduceLeft(expressions, createComma);\n    }\n    ts.inlineExpressions = inlineExpressions;\n    function createExpressionFromEntityName(node) {\n        if (ts.isQualifiedName(node)) {\n            var left = createExpressionFromEntityName(node.left);\n            var right = getMutableClone(node.right);\n            return createPropertyAccess(left, right, /*location*/ node);\n        }\n        else {\n            return getMutableClone(node);\n        }\n    }\n    ts.createExpressionFromEntityName = createExpressionFromEntityName;\n    function createExpressionForPropertyName(memberName) {\n        if (ts.isIdentifier(memberName)) {\n            return createLiteral(memberName, /*location*/ undefined);\n        }\n        else if (ts.isComputedPropertyName(memberName)) {\n            return getMutableClone(memberName.expression);\n        }\n        else {\n            return getMutableClone(memberName);\n        }\n    }\n    ts.createExpressionForPropertyName = createExpressionForPropertyName;\n    function createExpressionForObjectLiteralElementLike(node, property, receiver) {\n        switch (property.kind) {\n            case 151 /* GetAccessor */:\n            case 152 /* SetAccessor */:\n                return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine);\n            case 257 /* PropertyAssignment */:\n                return createExpressionForPropertyAssignment(property, receiver);\n            case 258 /* ShorthandPropertyAssignment */:\n                return createExpressionForShorthandPropertyAssignment(property, receiver);\n            case 149 /* MethodDeclaration */:\n                return createExpressionForMethodDeclaration(property, receiver);\n        }\n    }\n    ts.createExpressionForObjectLiteralElementLike = createExpressionForObjectLiteralElementLike;\n    function createExpressionForAccessorDeclaration(properties, property, receiver, multiLine) {\n        var _a = ts.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;\n        if (property === firstAccessor) {\n            var properties_1 = [];\n            if (getAccessor) {\n                var getterFunction = createFunctionExpression(getAccessor.modifiers, \n                /*asteriskToken*/ undefined, \n                /*name*/ undefined, \n                /*typeParameters*/ undefined, getAccessor.parameters, \n                /*type*/ undefined, getAccessor.body, \n                /*location*/ getAccessor);\n                setOriginalNode(getterFunction, getAccessor);\n                var getter = createPropertyAssignment(\"get\", getterFunction);\n                properties_1.push(getter);\n            }\n            if (setAccessor) {\n                var setterFunction = createFunctionExpression(setAccessor.modifiers, \n                /*asteriskToken*/ undefined, \n                /*name*/ undefined, \n                /*typeParameters*/ undefined, setAccessor.parameters, \n                /*type*/ undefined, setAccessor.body, \n                /*location*/ setAccessor);\n                setOriginalNode(setterFunction, setAccessor);\n                var setter = createPropertyAssignment(\"set\", setterFunction);\n                properties_1.push(setter);\n            }\n            properties_1.push(createPropertyAssignment(\"enumerable\", createLiteral(true)));\n            properties_1.push(createPropertyAssignment(\"configurable\", createLiteral(true)));\n            var expression = createCall(createPropertyAccess(createIdentifier(\"Object\"), \"defineProperty\"), \n            /*typeArguments*/ undefined, [\n                receiver,\n                createExpressionForPropertyName(property.name),\n                createObjectLiteral(properties_1, /*location*/ undefined, multiLine)\n            ], \n            /*location*/ firstAccessor);\n            return ts.aggregateTransformFlags(expression);\n        }\n        return undefined;\n    }\n    function createExpressionForPropertyAssignment(property, receiver) {\n        return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, /*location*/ property.name), property.initializer, \n        /*location*/ property), \n        /*original*/ property));\n    }\n    function createExpressionForShorthandPropertyAssignment(property, receiver) {\n        return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, /*location*/ property.name), getSynthesizedClone(property.name), \n        /*location*/ property), \n        /*original*/ property));\n    }\n    function createExpressionForMethodDeclaration(method, receiver) {\n        return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, /*location*/ method.name), setOriginalNode(createFunctionExpression(method.modifiers, method.asteriskToken, \n        /*name*/ undefined, \n        /*typeParameters*/ undefined, method.parameters, \n        /*type*/ undefined, method.body, \n        /*location*/ method), \n        /*original*/ method), \n        /*location*/ method), \n        /*original*/ method));\n    }\n    /**\n     * Gets the local name of a declaration. This is primarily used for declarations that can be\n     * referred to by name in the declaration's immediate scope (classes, enums, namespaces). A\n     * local name will *never* be prefixed with an module or namespace export modifier like\n     * \"exports.\" when emitted as an expression.\n     *\n     * @param node The declaration.\n     * @param allowComments A value indicating whether comments may be emitted for the name.\n     * @param allowSourceMaps A value indicating whether source maps may be emitted for the name.\n     */\n    function getLocalName(node, allowComments, allowSourceMaps) {\n        return getName(node, allowComments, allowSourceMaps, 16384 /* LocalName */);\n    }\n    ts.getLocalName = getLocalName;\n    /**\n     * Gets whether an identifier should only be referred to by its local name.\n     */\n    function isLocalName(node) {\n        return (getEmitFlags(node) & 16384 /* LocalName */) !== 0;\n    }\n    ts.isLocalName = isLocalName;\n    /**\n     * Gets the export name of a declaration. This is primarily used for declarations that can be\n     * referred to by name in the declaration's immediate scope (classes, enums, namespaces). An\n     * export name will *always* be prefixed with an module or namespace export modifier like\n     * `\"exports.\"` when emitted as an expression if the name points to an exported symbol.\n     *\n     * @param node The declaration.\n     * @param allowComments A value indicating whether comments may be emitted for the name.\n     * @param allowSourceMaps A value indicating whether source maps may be emitted for the name.\n     */\n    function getExportName(node, allowComments, allowSourceMaps) {\n        return getName(node, allowComments, allowSourceMaps, 8192 /* ExportName */);\n    }\n    ts.getExportName = getExportName;\n    /**\n     * Gets whether an identifier should only be referred to by its export representation if the\n     * name points to an exported symbol.\n     */\n    function isExportName(node) {\n        return (getEmitFlags(node) & 8192 /* ExportName */) !== 0;\n    }\n    ts.isExportName = isExportName;\n    /**\n     * Gets the name of a declaration for use in declarations.\n     *\n     * @param node The declaration.\n     * @param allowComments A value indicating whether comments may be emitted for the name.\n     * @param allowSourceMaps A value indicating whether source maps may be emitted for the name.\n     */\n    function getDeclarationName(node, allowComments, allowSourceMaps) {\n        return getName(node, allowComments, allowSourceMaps);\n    }\n    ts.getDeclarationName = getDeclarationName;\n    function getName(node, allowComments, allowSourceMaps, emitFlags) {\n        if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) {\n            var name_8 = getMutableClone(node.name);\n            emitFlags |= getEmitFlags(node.name);\n            if (!allowSourceMaps)\n                emitFlags |= 48 /* NoSourceMap */;\n            if (!allowComments)\n                emitFlags |= 1536 /* NoComments */;\n            if (emitFlags)\n                setEmitFlags(name_8, emitFlags);\n            return name_8;\n        }\n        return getGeneratedNameForNode(node);\n    }\n    /**\n     * Gets the exported name of a declaration for use in expressions.\n     *\n     * An exported name will *always* be prefixed with an module or namespace export modifier like\n     * \"exports.\" if the name points to an exported symbol.\n     *\n     * @param ns The namespace identifier.\n     * @param node The declaration.\n     * @param allowComments A value indicating whether comments may be emitted for the name.\n     * @param allowSourceMaps A value indicating whether source maps may be emitted for the name.\n     */\n    function getExternalModuleOrNamespaceExportName(ns, node, allowComments, allowSourceMaps) {\n        if (ns && ts.hasModifier(node, 1 /* Export */)) {\n            return getNamespaceMemberName(ns, getName(node), allowComments, allowSourceMaps);\n        }\n        return getExportName(node, allowComments, allowSourceMaps);\n    }\n    ts.getExternalModuleOrNamespaceExportName = getExternalModuleOrNamespaceExportName;\n    /**\n     * Gets a namespace-qualified name for use in expressions.\n     *\n     * @param ns The namespace identifier.\n     * @param name The name.\n     * @param allowComments A value indicating whether comments may be emitted for the name.\n     * @param allowSourceMaps A value indicating whether source maps may be emitted for the name.\n     */\n    function getNamespaceMemberName(ns, name, allowComments, allowSourceMaps) {\n        var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), /*location*/ name);\n        var emitFlags;\n        if (!allowSourceMaps)\n            emitFlags |= 48 /* NoSourceMap */;\n        if (!allowComments)\n            emitFlags |= 1536 /* NoComments */;\n        if (emitFlags)\n            setEmitFlags(qualifiedName, emitFlags);\n        return qualifiedName;\n    }\n    ts.getNamespaceMemberName = getNamespaceMemberName;\n    function convertToFunctionBody(node, multiLine) {\n        return ts.isBlock(node) ? node : createBlock([createReturn(node, /*location*/ node)], /*location*/ node, multiLine);\n    }\n    ts.convertToFunctionBody = convertToFunctionBody;\n    function isUseStrictPrologue(node) {\n        return node.expression.text === \"use strict\";\n    }\n    /**\n     * Add any necessary prologue-directives into target statement-array.\n     * The function needs to be called during each transformation step.\n     * This function needs to be called whenever we transform the statement\n     * list of a source file, namespace, or function-like body.\n     *\n     * @param target: result statements array\n     * @param source: origin statements array\n     * @param ensureUseStrict: boolean determining whether the function need to add prologue-directives\n     * @param visitor: Optional callback used to visit any custom prologue directives.\n     */\n    function addPrologueDirectives(target, source, ensureUseStrict, visitor) {\n        ts.Debug.assert(target.length === 0, \"Prologue directives should be at the first statement in the target statements array\");\n        var foundUseStrict = false;\n        var statementOffset = 0;\n        var numStatements = source.length;\n        while (statementOffset < numStatements) {\n            var statement = source[statementOffset];\n            if (ts.isPrologueDirective(statement)) {\n                if (isUseStrictPrologue(statement)) {\n                    foundUseStrict = true;\n                }\n                target.push(statement);\n            }\n            else {\n                break;\n            }\n            statementOffset++;\n        }\n        if (ensureUseStrict && !foundUseStrict) {\n            target.push(startOnNewLine(createStatement(createLiteral(\"use strict\"))));\n        }\n        while (statementOffset < numStatements) {\n            var statement = source[statementOffset];\n            if (getEmitFlags(statement) & 524288 /* CustomPrologue */) {\n                target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement);\n            }\n            else {\n                break;\n            }\n            statementOffset++;\n        }\n        return statementOffset;\n    }\n    ts.addPrologueDirectives = addPrologueDirectives;\n    function startsWithUseStrict(statements) {\n        var firstStatement = ts.firstOrUndefined(statements);\n        return firstStatement !== undefined\n            && ts.isPrologueDirective(firstStatement)\n            && isUseStrictPrologue(firstStatement);\n    }\n    ts.startsWithUseStrict = startsWithUseStrict;\n    /**\n     * Ensures \"use strict\" directive is added\n     *\n     * @param statements An array of statements\n     */\n    function ensureUseStrict(statements) {\n        var foundUseStrict = false;\n        for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {\n            var statement = statements_1[_i];\n            if (ts.isPrologueDirective(statement)) {\n                if (isUseStrictPrologue(statement)) {\n                    foundUseStrict = true;\n                    break;\n                }\n            }\n            else {\n                break;\n            }\n        }\n        if (!foundUseStrict) {\n            return createNodeArray([\n                startOnNewLine(createStatement(createLiteral(\"use strict\")))\n            ].concat(statements), statements);\n        }\n        return statements;\n    }\n    ts.ensureUseStrict = ensureUseStrict;\n    /**\n     * Wraps the operand to a BinaryExpression in parentheses if they are needed to preserve the intended\n     * order of operations.\n     *\n     * @param binaryOperator The operator for the BinaryExpression.\n     * @param operand The operand for the BinaryExpression.\n     * @param isLeftSideOfBinary A value indicating whether the operand is the left side of the\n     *                           BinaryExpression.\n     */\n    function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {\n        var skipped = skipPartiallyEmittedExpressions(operand);\n        // If the resulting expression is already parenthesized, we do not need to do any further processing.\n        if (skipped.kind === 183 /* ParenthesizedExpression */) {\n            return operand;\n        }\n        return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand)\n            ? createParen(operand)\n            : operand;\n    }\n    ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand;\n    /**\n     * Determines whether the operand to a BinaryExpression needs to be parenthesized.\n     *\n     * @param binaryOperator The operator for the BinaryExpression.\n     * @param operand The operand for the BinaryExpression.\n     * @param isLeftSideOfBinary A value indicating whether the operand is the left side of the\n     *                           BinaryExpression.\n     */\n    function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {\n        // If the operand has lower precedence, then it needs to be parenthesized to preserve the\n        // intent of the expression. For example, if the operand is `a + b` and the operator is\n        // `*`, then we need to parenthesize the operand to preserve the intended order of\n        // operations: `(a + b) * x`.\n        //\n        // If the operand has higher precedence, then it does not need to be parenthesized. For\n        // example, if the operand is `a * b` and the operator is `+`, then we do not need to\n        // parenthesize to preserve the intended order of operations: `a * b + x`.\n        //\n        // If the operand has the same precedence, then we need to check the associativity of\n        // the operator based on whether this is the left or right operand of the expression.\n        //\n        // For example, if `a / d` is on the right of operator `*`, we need to parenthesize\n        // to preserve the intended order of operations: `x * (a / d)`\n        //\n        // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve\n        // the intended order of operations: `(a ** b) ** c`\n        var binaryOperatorPrecedence = ts.getOperatorPrecedence(192 /* BinaryExpression */, binaryOperator);\n        var binaryOperatorAssociativity = ts.getOperatorAssociativity(192 /* BinaryExpression */, binaryOperator);\n        var emittedOperand = skipPartiallyEmittedExpressions(operand);\n        var operandPrecedence = ts.getExpressionPrecedence(emittedOperand);\n        switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) {\n            case -1 /* LessThan */:\n                // If the operand is the right side of a right-associative binary operation\n                // and is a yield expression, then we do not need parentheses.\n                if (!isLeftSideOfBinary\n                    && binaryOperatorAssociativity === 1 /* Right */\n                    && operand.kind === 195 /* YieldExpression */) {\n                    return false;\n                }\n                return true;\n            case 1 /* GreaterThan */:\n                return false;\n            case 0 /* EqualTo */:\n                if (isLeftSideOfBinary) {\n                    // No need to parenthesize the left operand when the binary operator is\n                    // left associative:\n                    //  (a*b)/x    ->  a*b/x\n                    //  (a**b)/x   ->  a**b/x\n                    //\n                    // Parentheses are needed for the left operand when the binary operator is\n                    // right associative:\n                    //  (a/b)**x   ->  (a/b)**x\n                    //  (a**b)**x  ->  (a**b)**x\n                    return binaryOperatorAssociativity === 1 /* Right */;\n                }\n                else {\n                    if (ts.isBinaryExpression(emittedOperand)\n                        && emittedOperand.operatorToken.kind === binaryOperator) {\n                        // No need to parenthesize the right operand when the binary operator and\n                        // operand are the same and one of the following:\n                        //  x*(a*b)     => x*a*b\n                        //  x|(a|b)     => x|a|b\n                        //  x&(a&b)     => x&a&b\n                        //  x^(a^b)     => x^a^b\n                        if (operatorHasAssociativeProperty(binaryOperator)) {\n                            return false;\n                        }\n                        // No need to parenthesize the right operand when the binary operator\n                        // is plus (+) if both the left and right operands consist solely of either\n                        // literals of the same kind or binary plus (+) expressions for literals of\n                        // the same kind (recursively).\n                        //  \"a\"+(1+2)       => \"a\"+(1+2)\n                        //  \"a\"+(\"b\"+\"c\")   => \"a\"+\"b\"+\"c\"\n                        if (binaryOperator === 36 /* PlusToken */) {\n                            var leftKind = leftOperand ? getLiteralKindOfBinaryPlusOperand(leftOperand) : 0 /* Unknown */;\n                            if (ts.isLiteralKind(leftKind) && leftKind === getLiteralKindOfBinaryPlusOperand(emittedOperand)) {\n                                return false;\n                            }\n                        }\n                    }\n                    // No need to parenthesize the right operand when the operand is right\n                    // associative:\n                    //  x/(a**b)    -> x/a**b\n                    //  x**(a**b)   -> x**a**b\n                    //\n                    // Parentheses are needed for the right operand when the operand is left\n                    // associative:\n                    //  x/(a*b)     -> x/(a*b)\n                    //  x**(a/b)    -> x**(a/b)\n                    var operandAssociativity = ts.getExpressionAssociativity(emittedOperand);\n                    return operandAssociativity === 0 /* Left */;\n                }\n        }\n    }\n    /**\n     * Determines whether a binary operator is mathematically associative.\n     *\n     * @param binaryOperator The binary operator.\n     */\n    function operatorHasAssociativeProperty(binaryOperator) {\n        // The following operators are associative in JavaScript:\n        //  (a*b)*c     -> a*(b*c)  -> a*b*c\n        //  (a|b)|c     -> a|(b|c)  -> a|b|c\n        //  (a&b)&c     -> a&(b&c)  -> a&b&c\n        //  (a^b)^c     -> a^(b^c)  -> a^b^c\n        //\n        // While addition is associative in mathematics, JavaScript's `+` is not\n        // guaranteed to be associative as it is overloaded with string concatenation.\n        return binaryOperator === 38 /* AsteriskToken */\n            || binaryOperator === 48 /* BarToken */\n            || binaryOperator === 47 /* AmpersandToken */\n            || binaryOperator === 49 /* CaretToken */;\n    }\n    /**\n     * This function determines whether an expression consists of a homogeneous set of\n     * literal expressions or binary plus expressions that all share the same literal kind.\n     * It is used to determine whether the right-hand operand of a binary plus expression can be\n     * emitted without parentheses.\n     */\n    function getLiteralKindOfBinaryPlusOperand(node) {\n        node = skipPartiallyEmittedExpressions(node);\n        if (ts.isLiteralKind(node.kind)) {\n            return node.kind;\n        }\n        if (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 36 /* PlusToken */) {\n            if (node.cachedLiteralKind !== undefined) {\n                return node.cachedLiteralKind;\n            }\n            var leftKind = getLiteralKindOfBinaryPlusOperand(node.left);\n            var literalKind = ts.isLiteralKind(leftKind)\n                && leftKind === getLiteralKindOfBinaryPlusOperand(node.right)\n                ? leftKind\n                : 0 /* Unknown */;\n            node.cachedLiteralKind = literalKind;\n            return literalKind;\n        }\n        return 0 /* Unknown */;\n    }\n    function parenthesizeForConditionalHead(condition) {\n        var conditionalPrecedence = ts.getOperatorPrecedence(193 /* ConditionalExpression */, 54 /* QuestionToken */);\n        var emittedCondition = skipPartiallyEmittedExpressions(condition);\n        var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition);\n        if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) {\n            return createParen(condition);\n        }\n        return condition;\n    }\n    ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead;\n    function parenthesizeSubexpressionOfConditionalExpression(e) {\n        // per ES grammar both 'whenTrue' and 'whenFalse' parts of conditional expression are assignment expressions\n        // so in case when comma expression is introduced as a part of previous transformations\n        // if should be wrapped in parens since comma operator has the lowest precedence\n        return e.kind === 192 /* BinaryExpression */ && e.operatorToken.kind === 25 /* CommaToken */\n            ? createParen(e)\n            : e;\n    }\n    /**\n     * Wraps an expression in parentheses if it is needed in order to use the expression\n     * as the expression of a NewExpression node.\n     *\n     * @param expression The Expression node.\n     */\n    function parenthesizeForNew(expression) {\n        var emittedExpression = skipPartiallyEmittedExpressions(expression);\n        switch (emittedExpression.kind) {\n            case 179 /* CallExpression */:\n                return createParen(expression);\n            case 180 /* NewExpression */:\n                return emittedExpression.arguments\n                    ? expression\n                    : createParen(expression);\n        }\n        return parenthesizeForAccess(expression);\n    }\n    ts.parenthesizeForNew = parenthesizeForNew;\n    /**\n     * Wraps an expression in parentheses if it is needed in order to use the expression for\n     * property or element access.\n     *\n     * @param expr The expression node.\n     */\n    function parenthesizeForAccess(expression) {\n        // isLeftHandSideExpression is almost the correct criterion for when it is not necessary\n        // to parenthesize the expression before a dot. The known exceptions are:\n        //\n        //    NewExpression:\n        //       new C.x        -> not the same as (new C).x\n        //    NumericLiteral\n        //       1.x            -> not the same as (1).x\n        //\n        var emittedExpression = skipPartiallyEmittedExpressions(expression);\n        if (ts.isLeftHandSideExpression(emittedExpression)\n            && (emittedExpression.kind !== 180 /* NewExpression */ || emittedExpression.arguments)\n            && emittedExpression.kind !== 8 /* NumericLiteral */) {\n            return expression;\n        }\n        return createParen(expression, /*location*/ expression);\n    }\n    ts.parenthesizeForAccess = parenthesizeForAccess;\n    function parenthesizePostfixOperand(operand) {\n        return ts.isLeftHandSideExpression(operand)\n            ? operand\n            : createParen(operand, /*location*/ operand);\n    }\n    ts.parenthesizePostfixOperand = parenthesizePostfixOperand;\n    function parenthesizePrefixOperand(operand) {\n        return ts.isUnaryExpression(operand)\n            ? operand\n            : createParen(operand, /*location*/ operand);\n    }\n    ts.parenthesizePrefixOperand = parenthesizePrefixOperand;\n    function parenthesizeListElements(elements) {\n        var result;\n        for (var i = 0; i < elements.length; i++) {\n            var element = parenthesizeExpressionForList(elements[i]);\n            if (result !== undefined || element !== elements[i]) {\n                if (result === undefined) {\n                    result = elements.slice(0, i);\n                }\n                result.push(element);\n            }\n        }\n        if (result !== undefined) {\n            return createNodeArray(result, elements, elements.hasTrailingComma);\n        }\n        return elements;\n    }\n    function parenthesizeExpressionForList(expression) {\n        var emittedExpression = skipPartiallyEmittedExpressions(expression);\n        var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression);\n        var commaPrecedence = ts.getOperatorPrecedence(192 /* BinaryExpression */, 25 /* CommaToken */);\n        return expressionPrecedence > commaPrecedence\n            ? expression\n            : createParen(expression, /*location*/ expression);\n    }\n    ts.parenthesizeExpressionForList = parenthesizeExpressionForList;\n    function parenthesizeExpressionForExpressionStatement(expression) {\n        var emittedExpression = skipPartiallyEmittedExpressions(expression);\n        if (ts.isCallExpression(emittedExpression)) {\n            var callee = emittedExpression.expression;\n            var kind = skipPartiallyEmittedExpressions(callee).kind;\n            if (kind === 184 /* FunctionExpression */ || kind === 185 /* ArrowFunction */) {\n                var mutableCall = getMutableClone(emittedExpression);\n                mutableCall.expression = createParen(callee, /*location*/ callee);\n                return recreatePartiallyEmittedExpressions(expression, mutableCall);\n            }\n        }\n        else {\n            var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind;\n            if (leftmostExpressionKind === 176 /* ObjectLiteralExpression */ || leftmostExpressionKind === 184 /* FunctionExpression */) {\n                return createParen(expression, /*location*/ expression);\n            }\n        }\n        return expression;\n    }\n    ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement;\n    /**\n     * Clones a series of not-emitted expressions with a new inner expression.\n     *\n     * @param originalOuterExpression The original outer expression.\n     * @param newInnerExpression The new inner expression.\n     */\n    function recreatePartiallyEmittedExpressions(originalOuterExpression, newInnerExpression) {\n        if (ts.isPartiallyEmittedExpression(originalOuterExpression)) {\n            var clone_1 = getMutableClone(originalOuterExpression);\n            clone_1.expression = recreatePartiallyEmittedExpressions(clone_1.expression, newInnerExpression);\n            return clone_1;\n        }\n        return newInnerExpression;\n    }\n    function getLeftmostExpression(node) {\n        while (true) {\n            switch (node.kind) {\n                case 191 /* PostfixUnaryExpression */:\n                    node = node.operand;\n                    continue;\n                case 192 /* BinaryExpression */:\n                    node = node.left;\n                    continue;\n                case 193 /* ConditionalExpression */:\n                    node = node.condition;\n                    continue;\n                case 179 /* CallExpression */:\n                case 178 /* ElementAccessExpression */:\n                case 177 /* PropertyAccessExpression */:\n                    node = node.expression;\n                    continue;\n                case 294 /* PartiallyEmittedExpression */:\n                    node = node.expression;\n                    continue;\n            }\n            return node;\n        }\n    }\n    function parenthesizeConciseBody(body) {\n        var emittedBody = skipPartiallyEmittedExpressions(body);\n        if (emittedBody.kind === 176 /* ObjectLiteralExpression */) {\n            return createParen(body, /*location*/ body);\n        }\n        return body;\n    }\n    ts.parenthesizeConciseBody = parenthesizeConciseBody;\n    var OuterExpressionKinds;\n    (function (OuterExpressionKinds) {\n        OuterExpressionKinds[OuterExpressionKinds[\"Parentheses\"] = 1] = \"Parentheses\";\n        OuterExpressionKinds[OuterExpressionKinds[\"Assertions\"] = 2] = \"Assertions\";\n        OuterExpressionKinds[OuterExpressionKinds[\"PartiallyEmittedExpressions\"] = 4] = \"PartiallyEmittedExpressions\";\n        OuterExpressionKinds[OuterExpressionKinds[\"All\"] = 7] = \"All\";\n    })(OuterExpressionKinds = ts.OuterExpressionKinds || (ts.OuterExpressionKinds = {}));\n    function skipOuterExpressions(node, kinds) {\n        if (kinds === void 0) { kinds = 7 /* All */; }\n        var previousNode;\n        do {\n            previousNode = node;\n            if (kinds & 1 /* Parentheses */) {\n                node = skipParentheses(node);\n            }\n            if (kinds & 2 /* Assertions */) {\n                node = skipAssertions(node);\n            }\n            if (kinds & 4 /* PartiallyEmittedExpressions */) {\n                node = skipPartiallyEmittedExpressions(node);\n            }\n        } while (previousNode !== node);\n        return node;\n    }\n    ts.skipOuterExpressions = skipOuterExpressions;\n    function skipParentheses(node) {\n        while (node.kind === 183 /* ParenthesizedExpression */) {\n            node = node.expression;\n        }\n        return node;\n    }\n    ts.skipParentheses = skipParentheses;\n    function skipAssertions(node) {\n        while (ts.isAssertionExpression(node)) {\n            node = node.expression;\n        }\n        return node;\n    }\n    ts.skipAssertions = skipAssertions;\n    function skipPartiallyEmittedExpressions(node) {\n        while (node.kind === 294 /* PartiallyEmittedExpression */) {\n            node = node.expression;\n        }\n        return node;\n    }\n    ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions;\n    function startOnNewLine(node) {\n        node.startsOnNewLine = true;\n        return node;\n    }\n    ts.startOnNewLine = startOnNewLine;\n    function setOriginalNode(node, original) {\n        node.original = original;\n        if (original) {\n            var emitNode = original.emitNode;\n            if (emitNode)\n                node.emitNode = mergeEmitNode(emitNode, node.emitNode);\n        }\n        return node;\n    }\n    ts.setOriginalNode = setOriginalNode;\n    function mergeEmitNode(sourceEmitNode, destEmitNode) {\n        var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers;\n        if (!destEmitNode)\n            destEmitNode = {};\n        if (flags)\n            destEmitNode.flags = flags;\n        if (commentRange)\n            destEmitNode.commentRange = commentRange;\n        if (sourceMapRange)\n            destEmitNode.sourceMapRange = sourceMapRange;\n        if (tokenSourceMapRanges)\n            destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges);\n        if (constantValue !== undefined)\n            destEmitNode.constantValue = constantValue;\n        if (helpers)\n            destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers);\n        return destEmitNode;\n    }\n    function mergeTokenSourceMapRanges(sourceRanges, destRanges) {\n        if (!destRanges)\n            destRanges = ts.createMap();\n        ts.copyProperties(sourceRanges, destRanges);\n        return destRanges;\n    }\n    /**\n     * Clears any EmitNode entries from parse-tree nodes.\n     * @param sourceFile A source file.\n     */\n    function disposeEmitNodes(sourceFile) {\n        // During transformation we may need to annotate a parse tree node with transient\n        // transformation properties. As parse tree nodes live longer than transformation\n        // nodes, we need to make sure we reclaim any memory allocated for custom ranges\n        // from these nodes to ensure we do not hold onto entire subtrees just for position\n        // information. We also need to reset these nodes to a pre-transformation state\n        // for incremental parsing scenarios so that we do not impact later emit.\n        sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile));\n        var emitNode = sourceFile && sourceFile.emitNode;\n        var annotatedNodes = emitNode && emitNode.annotatedNodes;\n        if (annotatedNodes) {\n            for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) {\n                var node = annotatedNodes_1[_i];\n                node.emitNode = undefined;\n            }\n        }\n    }\n    ts.disposeEmitNodes = disposeEmitNodes;\n    /**\n     * Associates a node with the current transformation, initializing\n     * various transient transformation properties.\n     *\n     * @param node The node.\n     */\n    function getOrCreateEmitNode(node) {\n        if (!node.emitNode) {\n            if (ts.isParseTreeNode(node)) {\n                // To avoid holding onto transformation artifacts, we keep track of any\n                // parse tree node we are annotating. This allows us to clean them up after\n                // all transformations have completed.\n                if (node.kind === 261 /* SourceFile */) {\n                    return node.emitNode = { annotatedNodes: [node] };\n                }\n                var sourceFile = ts.getSourceFileOfNode(node);\n                getOrCreateEmitNode(sourceFile).annotatedNodes.push(node);\n            }\n            node.emitNode = {};\n        }\n        return node.emitNode;\n    }\n    ts.getOrCreateEmitNode = getOrCreateEmitNode;\n    /**\n     * Gets flags that control emit behavior of a node.\n     *\n     * @param node The node.\n     */\n    function getEmitFlags(node) {\n        var emitNode = node.emitNode;\n        return emitNode && emitNode.flags;\n    }\n    ts.getEmitFlags = getEmitFlags;\n    /**\n     * Sets flags that control emit behavior of a node.\n     *\n     * @param node The node.\n     * @param emitFlags The NodeEmitFlags for the node.\n     */\n    function setEmitFlags(node, emitFlags) {\n        getOrCreateEmitNode(node).flags = emitFlags;\n        return node;\n    }\n    ts.setEmitFlags = setEmitFlags;\n    /**\n     * Gets a custom text range to use when emitting source maps.\n     *\n     * @param node The node.\n     */\n    function getSourceMapRange(node) {\n        var emitNode = node.emitNode;\n        return (emitNode && emitNode.sourceMapRange) || node;\n    }\n    ts.getSourceMapRange = getSourceMapRange;\n    /**\n     * Sets a custom text range to use when emitting source maps.\n     *\n     * @param node The node.\n     * @param range The text range.\n     */\n    function setSourceMapRange(node, range) {\n        getOrCreateEmitNode(node).sourceMapRange = range;\n        return node;\n    }\n    ts.setSourceMapRange = setSourceMapRange;\n    /**\n     * Gets the TextRange to use for source maps for a token of a node.\n     *\n     * @param node The node.\n     * @param token The token.\n     */\n    function getTokenSourceMapRange(node, token) {\n        var emitNode = node.emitNode;\n        var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges;\n        return tokenSourceMapRanges && tokenSourceMapRanges[token];\n    }\n    ts.getTokenSourceMapRange = getTokenSourceMapRange;\n    /**\n     * Sets the TextRange to use for source maps for a token of a node.\n     *\n     * @param node The node.\n     * @param token The token.\n     * @param range The text range.\n     */\n    function setTokenSourceMapRange(node, token, range) {\n        var emitNode = getOrCreateEmitNode(node);\n        var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap());\n        tokenSourceMapRanges[token] = range;\n        return node;\n    }\n    ts.setTokenSourceMapRange = setTokenSourceMapRange;\n    /**\n     * Gets a custom text range to use when emitting comments.\n     *\n     * @param node The node.\n     */\n    function getCommentRange(node) {\n        var emitNode = node.emitNode;\n        return (emitNode && emitNode.commentRange) || node;\n    }\n    ts.getCommentRange = getCommentRange;\n    /**\n     * Sets a custom text range to use when emitting comments.\n     */\n    function setCommentRange(node, range) {\n        getOrCreateEmitNode(node).commentRange = range;\n        return node;\n    }\n    ts.setCommentRange = setCommentRange;\n    /**\n     * Gets the constant value to emit for an expression.\n     */\n    function getConstantValue(node) {\n        var emitNode = node.emitNode;\n        return emitNode && emitNode.constantValue;\n    }\n    ts.getConstantValue = getConstantValue;\n    /**\n     * Sets the constant value to emit for an expression.\n     */\n    function setConstantValue(node, value) {\n        var emitNode = getOrCreateEmitNode(node);\n        emitNode.constantValue = value;\n        return node;\n    }\n    ts.setConstantValue = setConstantValue;\n    function getExternalHelpersModuleName(node) {\n        var parseNode = ts.getOriginalNode(node, ts.isSourceFile);\n        var emitNode = parseNode && parseNode.emitNode;\n        return emitNode && emitNode.externalHelpersModuleName;\n    }\n    ts.getExternalHelpersModuleName = getExternalHelpersModuleName;\n    function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions) {\n        if (compilerOptions.importHelpers && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {\n            var externalHelpersModuleName = getExternalHelpersModuleName(node);\n            if (externalHelpersModuleName) {\n                return externalHelpersModuleName;\n            }\n            var helpers = getEmitHelpers(node);\n            if (helpers) {\n                for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) {\n                    var helper = helpers_1[_i];\n                    if (!helper.scoped) {\n                        var parseNode = ts.getOriginalNode(node, ts.isSourceFile);\n                        var emitNode = getOrCreateEmitNode(parseNode);\n                        return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText));\n                    }\n                }\n            }\n        }\n    }\n    ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded;\n    /**\n     * Adds an EmitHelper to a node.\n     */\n    function addEmitHelper(node, helper) {\n        var emitNode = getOrCreateEmitNode(node);\n        emitNode.helpers = ts.append(emitNode.helpers, helper);\n        return node;\n    }\n    ts.addEmitHelper = addEmitHelper;\n    /**\n     * Adds an EmitHelper to a node.\n     */\n    function addEmitHelpers(node, helpers) {\n        if (ts.some(helpers)) {\n            var emitNode = getOrCreateEmitNode(node);\n            for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {\n                var helper = helpers_2[_i];\n                if (!ts.contains(emitNode.helpers, helper)) {\n                    emitNode.helpers = ts.append(emitNode.helpers, helper);\n                }\n            }\n        }\n        return node;\n    }\n    ts.addEmitHelpers = addEmitHelpers;\n    /**\n     * Removes an EmitHelper from a node.\n     */\n    function removeEmitHelper(node, helper) {\n        var emitNode = node.emitNode;\n        if (emitNode) {\n            var helpers = emitNode.helpers;\n            if (helpers) {\n                return ts.orderedRemoveItem(helpers, helper);\n            }\n        }\n        return false;\n    }\n    ts.removeEmitHelper = removeEmitHelper;\n    /**\n     * Gets the EmitHelpers of a node.\n     */\n    function getEmitHelpers(node) {\n        var emitNode = node.emitNode;\n        return emitNode && emitNode.helpers;\n    }\n    ts.getEmitHelpers = getEmitHelpers;\n    /**\n     * Moves matching emit helpers from a source node to a target node.\n     */\n    function moveEmitHelpers(source, target, predicate) {\n        var sourceEmitNode = source.emitNode;\n        var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers;\n        if (!ts.some(sourceEmitHelpers))\n            return;\n        var targetEmitNode = getOrCreateEmitNode(target);\n        var helpersRemoved = 0;\n        for (var i = 0; i < sourceEmitHelpers.length; i++) {\n            var helper = sourceEmitHelpers[i];\n            if (predicate(helper)) {\n                helpersRemoved++;\n                if (!ts.contains(targetEmitNode.helpers, helper)) {\n                    targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper);\n                }\n            }\n            else if (helpersRemoved > 0) {\n                sourceEmitHelpers[i - helpersRemoved] = helper;\n            }\n        }\n        if (helpersRemoved > 0) {\n            sourceEmitHelpers.length -= helpersRemoved;\n        }\n    }\n    ts.moveEmitHelpers = moveEmitHelpers;\n    function compareEmitHelpers(x, y) {\n        if (x === y)\n            return 0 /* EqualTo */;\n        if (x.priority === y.priority)\n            return 0 /* EqualTo */;\n        if (x.priority === undefined)\n            return 1 /* GreaterThan */;\n        if (y.priority === undefined)\n            return -1 /* LessThan */;\n        return ts.compareValues(x.priority, y.priority);\n    }\n    ts.compareEmitHelpers = compareEmitHelpers;\n    function setTextRange(node, location) {\n        if (location) {\n            node.pos = location.pos;\n            node.end = location.end;\n        }\n        return node;\n    }\n    ts.setTextRange = setTextRange;\n    function setNodeFlags(node, flags) {\n        node.flags = flags;\n        return node;\n    }\n    ts.setNodeFlags = setNodeFlags;\n    function setMultiLine(node, multiLine) {\n        node.multiLine = multiLine;\n        return node;\n    }\n    ts.setMultiLine = setMultiLine;\n    function setHasTrailingComma(nodes, hasTrailingComma) {\n        nodes.hasTrailingComma = hasTrailingComma;\n        return nodes;\n    }\n    ts.setHasTrailingComma = setHasTrailingComma;\n    /**\n     * Get the name of that target module from an import or export declaration\n     */\n    function getLocalNameForExternalImport(node, sourceFile) {\n        var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);\n        if (namespaceDeclaration && !ts.isDefaultImport(node)) {\n            var name_9 = namespaceDeclaration.name;\n            return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));\n        }\n        if (node.kind === 235 /* ImportDeclaration */ && node.importClause) {\n            return getGeneratedNameForNode(node);\n        }\n        if (node.kind === 241 /* ExportDeclaration */ && node.moduleSpecifier) {\n            return getGeneratedNameForNode(node);\n        }\n        return undefined;\n    }\n    ts.getLocalNameForExternalImport = getLocalNameForExternalImport;\n    /**\n     * Get the name of a target module from an import/export declaration as should be written in the emitted output.\n     * The emitted output name can be different from the input if:\n     *  1. The module has a /// <amd-module name=\"<new name>\" />\n     *  2. --out or --outFile is used, making the name relative to the rootDir\n     *  3- The containing SourceFile has an entry in renamedDependencies for the import as requested by some module loaders (e.g. System).\n     * Otherwise, a new StringLiteral node representing the module name will be returned.\n     */\n    function getExternalModuleNameLiteral(importNode, sourceFile, host, resolver, compilerOptions) {\n        var moduleName = ts.getExternalModuleName(importNode);\n        if (moduleName.kind === 9 /* StringLiteral */) {\n            return tryGetModuleNameFromDeclaration(importNode, host, resolver, compilerOptions)\n                || tryRenameExternalModule(moduleName, sourceFile)\n                || getSynthesizedClone(moduleName);\n        }\n        return undefined;\n    }\n    ts.getExternalModuleNameLiteral = getExternalModuleNameLiteral;\n    /**\n     * Some bundlers (SystemJS builder) sometimes want to rename dependencies.\n     * Here we check if alternative name was provided for a given moduleName and return it if possible.\n     */\n    function tryRenameExternalModule(moduleName, sourceFile) {\n        if (sourceFile.renamedDependencies && ts.hasProperty(sourceFile.renamedDependencies, moduleName.text)) {\n            return createLiteral(sourceFile.renamedDependencies[moduleName.text]);\n        }\n        return undefined;\n    }\n    /**\n     * Get the name of a module as should be written in the emitted output.\n     * The emitted output name can be different from the input if:\n     *  1. The module has a /// <amd-module name=\"<new name>\" />\n     *  2. --out or --outFile is used, making the name relative to the rootDir\n     * Otherwise, a new StringLiteral node representing the module name will be returned.\n     */\n    function tryGetModuleNameFromFile(file, host, options) {\n        if (!file) {\n            return undefined;\n        }\n        if (file.moduleName) {\n            return createLiteral(file.moduleName);\n        }\n        if (!ts.isDeclarationFile(file) && (options.out || options.outFile)) {\n            return createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName));\n        }\n        return undefined;\n    }\n    ts.tryGetModuleNameFromFile = tryGetModuleNameFromFile;\n    function tryGetModuleNameFromDeclaration(declaration, host, resolver, compilerOptions) {\n        return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions);\n    }\n    /**\n     * Gets the initializer of an BindingOrAssignmentElement.\n     */\n    function getInitializerOfBindingOrAssignmentElement(bindingElement) {\n        if (ts.isDeclarationBindingElement(bindingElement)) {\n            // `1` in `let { a = 1 } = ...`\n            // `1` in `let { a: b = 1 } = ...`\n            // `1` in `let { a: {b} = 1 } = ...`\n            // `1` in `let { a: [b] = 1 } = ...`\n            // `1` in `let [a = 1] = ...`\n            // `1` in `let [{a} = 1] = ...`\n            // `1` in `let [[a] = 1] = ...`\n            return bindingElement.initializer;\n        }\n        if (ts.isPropertyAssignment(bindingElement)) {\n            // `1` in `({ a: b = 1 } = ...)`\n            // `1` in `({ a: {b} = 1 } = ...)`\n            // `1` in `({ a: [b] = 1 } = ...)`\n            return ts.isAssignmentExpression(bindingElement.initializer, /*excludeCompoundAssignment*/ true)\n                ? bindingElement.initializer.right\n                : undefined;\n        }\n        if (ts.isShorthandPropertyAssignment(bindingElement)) {\n            // `1` in `({ a = 1 } = ...)`\n            return bindingElement.objectAssignmentInitializer;\n        }\n        if (ts.isAssignmentExpression(bindingElement, /*excludeCompoundAssignment*/ true)) {\n            // `1` in `[a = 1] = ...`\n            // `1` in `[{a} = 1] = ...`\n            // `1` in `[[a] = 1] = ...`\n            return bindingElement.right;\n        }\n        if (ts.isSpreadExpression(bindingElement)) {\n            // Recovery consistent with existing emit.\n            return getInitializerOfBindingOrAssignmentElement(bindingElement.expression);\n        }\n    }\n    ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement;\n    /**\n     * Gets the name of an BindingOrAssignmentElement.\n     */\n    function getTargetOfBindingOrAssignmentElement(bindingElement) {\n        if (ts.isDeclarationBindingElement(bindingElement)) {\n            // `a` in `let { a } = ...`\n            // `a` in `let { a = 1 } = ...`\n            // `b` in `let { a: b } = ...`\n            // `b` in `let { a: b = 1 } = ...`\n            // `a` in `let { ...a } = ...`\n            // `{b}` in `let { a: {b} } = ...`\n            // `{b}` in `let { a: {b} = 1 } = ...`\n            // `[b]` in `let { a: [b] } = ...`\n            // `[b]` in `let { a: [b] = 1 } = ...`\n            // `a` in `let [a] = ...`\n            // `a` in `let [a = 1] = ...`\n            // `a` in `let [...a] = ...`\n            // `{a}` in `let [{a}] = ...`\n            // `{a}` in `let [{a} = 1] = ...`\n            // `[a]` in `let [[a]] = ...`\n            // `[a]` in `let [[a] = 1] = ...`\n            return bindingElement.name;\n        }\n        if (ts.isObjectLiteralElementLike(bindingElement)) {\n            switch (bindingElement.kind) {\n                case 257 /* PropertyAssignment */:\n                    // `b` in `({ a: b } = ...)`\n                    // `b` in `({ a: b = 1 } = ...)`\n                    // `{b}` in `({ a: {b} } = ...)`\n                    // `{b}` in `({ a: {b} = 1 } = ...)`\n                    // `[b]` in `({ a: [b] } = ...)`\n                    // `[b]` in `({ a: [b] = 1 } = ...)`\n                    // `b.c` in `({ a: b.c } = ...)`\n                    // `b.c` in `({ a: b.c = 1 } = ...)`\n                    // `b[0]` in `({ a: b[0] } = ...)`\n                    // `b[0]` in `({ a: b[0] = 1 } = ...)`\n                    return getTargetOfBindingOrAssignmentElement(bindingElement.initializer);\n                case 258 /* ShorthandPropertyAssignment */:\n                    // `a` in `({ a } = ...)`\n                    // `a` in `({ a = 1 } = ...)`\n                    return bindingElement.name;\n                case 259 /* SpreadAssignment */:\n                    // `a` in `({ ...a } = ...)`\n                    return getTargetOfBindingOrAssignmentElement(bindingElement.expression);\n            }\n            // no target\n            return undefined;\n        }\n        if (ts.isAssignmentExpression(bindingElement, /*excludeCompoundAssignment*/ true)) {\n            // `a` in `[a = 1] = ...`\n            // `{a}` in `[{a} = 1] = ...`\n            // `[a]` in `[[a] = 1] = ...`\n            // `a.b` in `[a.b = 1] = ...`\n            // `a[0]` in `[a[0] = 1] = ...`\n            return getTargetOfBindingOrAssignmentElement(bindingElement.left);\n        }\n        if (ts.isSpreadExpression(bindingElement)) {\n            // `a` in `[...a] = ...`\n            return getTargetOfBindingOrAssignmentElement(bindingElement.expression);\n        }\n        // `a` in `[a] = ...`\n        // `{a}` in `[{a}] = ...`\n        // `[a]` in `[[a]] = ...`\n        // `a.b` in `[a.b] = ...`\n        // `a[0]` in `[a[0]] = ...`\n        return bindingElement;\n    }\n    ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement;\n    /**\n     * Determines whether an BindingOrAssignmentElement is a rest element.\n     */\n    function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) {\n        switch (bindingElement.kind) {\n            case 144 /* Parameter */:\n            case 174 /* BindingElement */:\n                // `...` in `let [...a] = ...`\n                return bindingElement.dotDotDotToken;\n            case 196 /* SpreadElement */:\n            case 259 /* SpreadAssignment */:\n                // `...` in `[...a] = ...`\n                return bindingElement;\n        }\n        return undefined;\n    }\n    ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement;\n    /**\n     * Gets the property name of a BindingOrAssignmentElement\n     */\n    function getPropertyNameOfBindingOrAssignmentElement(bindingElement) {\n        switch (bindingElement.kind) {\n            case 174 /* BindingElement */:\n                // `a` in `let { a: b } = ...`\n                // `[a]` in `let { [a]: b } = ...`\n                // `\"a\"` in `let { \"a\": b } = ...`\n                // `1` in `let { 1: b } = ...`\n                if (bindingElement.propertyName) {\n                    var propertyName = bindingElement.propertyName;\n                    return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression)\n                        ? propertyName.expression\n                        : propertyName;\n                }\n                break;\n            case 257 /* PropertyAssignment */:\n                // `a` in `({ a: b } = ...)`\n                // `[a]` in `({ [a]: b } = ...)`\n                // `\"a\"` in `({ \"a\": b } = ...)`\n                // `1` in `({ 1: b } = ...)`\n                if (bindingElement.name) {\n                    var propertyName = bindingElement.name;\n                    return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression)\n                        ? propertyName.expression\n                        : propertyName;\n                }\n                break;\n            case 259 /* SpreadAssignment */:\n                // `a` in `({ ...a } = ...)`\n                return bindingElement.name;\n        }\n        var target = getTargetOfBindingOrAssignmentElement(bindingElement);\n        if (target && ts.isPropertyName(target)) {\n            return ts.isComputedPropertyName(target) && ts.isStringOrNumericLiteral(target.expression)\n                ? target.expression\n                : target;\n        }\n        ts.Debug.fail(\"Invalid property name for binding element.\");\n    }\n    ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement;\n    /**\n     * Gets the elements of a BindingOrAssignmentPattern\n     */\n    function getElementsOfBindingOrAssignmentPattern(name) {\n        switch (name.kind) {\n            case 172 /* ObjectBindingPattern */:\n            case 173 /* ArrayBindingPattern */:\n            case 175 /* ArrayLiteralExpression */:\n                // `a` in `{a}`\n                // `a` in `[a]`\n                return name.elements;\n            case 176 /* ObjectLiteralExpression */:\n                // `a` in `{a}`\n                return name.properties;\n        }\n    }\n    ts.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern;\n    function convertToArrayAssignmentElement(element) {\n        if (ts.isBindingElement(element)) {\n            if (element.dotDotDotToken) {\n                ts.Debug.assertNode(element.name, ts.isIdentifier);\n                return setOriginalNode(createSpread(element.name, element), element);\n            }\n            var expression = convertToAssignmentElementTarget(element.name);\n            return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression;\n        }\n        ts.Debug.assertNode(element, ts.isExpression);\n        return element;\n    }\n    ts.convertToArrayAssignmentElement = convertToArrayAssignmentElement;\n    function convertToObjectAssignmentElement(element) {\n        if (ts.isBindingElement(element)) {\n            if (element.dotDotDotToken) {\n                ts.Debug.assertNode(element.name, ts.isIdentifier);\n                return setOriginalNode(createSpreadAssignment(element.name, element), element);\n            }\n            if (element.propertyName) {\n                var expression = convertToAssignmentElementTarget(element.name);\n                return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element);\n            }\n            ts.Debug.assertNode(element.name, ts.isIdentifier);\n            return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element);\n        }\n        ts.Debug.assertNode(element, ts.isObjectLiteralElementLike);\n        return element;\n    }\n    ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement;\n    function convertToAssignmentPattern(node) {\n        switch (node.kind) {\n            case 173 /* ArrayBindingPattern */:\n            case 175 /* ArrayLiteralExpression */:\n                return convertToArrayAssignmentPattern(node);\n            case 172 /* ObjectBindingPattern */:\n            case 176 /* ObjectLiteralExpression */:\n                return convertToObjectAssignmentPattern(node);\n        }\n    }\n    ts.convertToAssignmentPattern = convertToAssignmentPattern;\n    function convertToObjectAssignmentPattern(node) {\n        if (ts.isObjectBindingPattern(node)) {\n            return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node);\n        }\n        ts.Debug.assertNode(node, ts.isObjectLiteralExpression);\n        return node;\n    }\n    ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern;\n    function convertToArrayAssignmentPattern(node) {\n        if (ts.isArrayBindingPattern(node)) {\n            return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node);\n        }\n        ts.Debug.assertNode(node, ts.isArrayLiteralExpression);\n        return node;\n    }\n    ts.convertToArrayAssignmentPattern = convertToArrayAssignmentPattern;\n    function convertToAssignmentElementTarget(node) {\n        if (ts.isBindingPattern(node)) {\n            return convertToAssignmentPattern(node);\n        }\n        ts.Debug.assertNode(node, ts.isExpression);\n        return node;\n    }\n    ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget;\n    function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) {\n        var externalImports = [];\n        var exportSpecifiers = ts.createMap();\n        var exportedBindings = ts.createMap();\n        var uniqueExports = ts.createMap();\n        var exportedNames;\n        var hasExportDefault = false;\n        var exportEquals = undefined;\n        var hasExportStarsToExportValues = false;\n        var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions);\n        var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration(\n        /*decorators*/ undefined, \n        /*modifiers*/ undefined, createImportClause(/*name*/ undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText));\n        if (externalHelpersImportDeclaration) {\n            externalImports.push(externalHelpersImportDeclaration);\n        }\n        for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {\n            var node = _a[_i];\n            switch (node.kind) {\n                case 235 /* ImportDeclaration */:\n                    // import \"mod\"\n                    // import x from \"mod\"\n                    // import * as x from \"mod\"\n                    // import { x, y } from \"mod\"\n                    externalImports.push(node);\n                    break;\n                case 234 /* ImportEqualsDeclaration */:\n                    if (node.moduleReference.kind === 245 /* ExternalModuleReference */) {\n                        // import x = require(\"mod\")\n                        externalImports.push(node);\n                    }\n                    break;\n                case 241 /* ExportDeclaration */:\n                    if (node.moduleSpecifier) {\n                        if (!node.exportClause) {\n                            // export * from \"mod\"\n                            externalImports.push(node);\n                            hasExportStarsToExportValues = true;\n                        }\n                        else {\n                            // export { x, y } from \"mod\"\n                            externalImports.push(node);\n                        }\n                    }\n                    else {\n                        // export { x, y }\n                        for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) {\n                            var specifier = _c[_b];\n                            if (!uniqueExports[specifier.name.text]) {\n                                var name_10 = specifier.propertyName || specifier.name;\n                                ts.multiMapAdd(exportSpecifiers, name_10.text, specifier);\n                                var decl = resolver.getReferencedImportDeclaration(name_10)\n                                    || resolver.getReferencedValueDeclaration(name_10);\n                                if (decl) {\n                                    ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name);\n                                }\n                                uniqueExports[specifier.name.text] = true;\n                                exportedNames = ts.append(exportedNames, specifier.name);\n                            }\n                        }\n                    }\n                    break;\n                case 240 /* ExportAssignment */:\n                    if (node.isExportEquals && !exportEquals) {\n                        // export = x\n                        exportEquals = node;\n                    }\n                    break;\n                case 205 /* VariableStatement */:\n                    if (ts.hasModifier(node, 1 /* Export */)) {\n                        for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {\n                            var decl = _e[_d];\n                            exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames);\n                        }\n                    }\n                    break;\n                case 225 /* FunctionDeclaration */:\n                    if (ts.hasModifier(node, 1 /* Export */)) {\n                        if (ts.hasModifier(node, 512 /* Default */)) {\n                            // export default function() { }\n                            if (!hasExportDefault) {\n                                ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node));\n                                hasExportDefault = true;\n                            }\n                        }\n                        else {\n                            // export function x() { }\n                            var name_11 = node.name;\n                            if (!uniqueExports[name_11.text]) {\n                                ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_11);\n                                uniqueExports[name_11.text] = true;\n                                exportedNames = ts.append(exportedNames, name_11);\n                            }\n                        }\n                    }\n                    break;\n                case 226 /* ClassDeclaration */:\n                    if (ts.hasModifier(node, 1 /* Export */)) {\n                        if (ts.hasModifier(node, 512 /* Default */)) {\n                            // export default class { }\n                            if (!hasExportDefault) {\n                                ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node));\n                                hasExportDefault = true;\n                            }\n                        }\n                        else {\n                            // export class x { }\n                            var name_12 = node.name;\n                            if (!uniqueExports[name_12.text]) {\n                                ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_12);\n                                uniqueExports[name_12.text] = true;\n                                exportedNames = ts.append(exportedNames, name_12);\n                            }\n                        }\n                    }\n                    break;\n            }\n        }\n        return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration };\n    }\n    ts.collectExternalModuleInfo = collectExternalModuleInfo;\n    function collectExportedVariableInfo(decl, uniqueExports, exportedNames) {\n        if (ts.isBindingPattern(decl.name)) {\n            for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {\n                var element = _a[_i];\n                if (!ts.isOmittedExpression(element)) {\n                    exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames);\n                }\n            }\n        }\n        else if (!ts.isGeneratedIdentifier(decl.name)) {\n            if (!uniqueExports[decl.name.text]) {\n                uniqueExports[decl.name.text] = true;\n                exportedNames = ts.append(exportedNames, decl.name);\n            }\n        }\n        return exportedNames;\n    }\n})(ts || (ts = {}));\n/// <reference path=\"utilities.ts\"/>\n/// <reference path=\"scanner.ts\"/>\n/// <reference path=\"factory.ts\"/>\nvar ts;\n(function (ts) {\n    var NodeConstructor;\n    var TokenConstructor;\n    var IdentifierConstructor;\n    var SourceFileConstructor;\n    function createNode(kind, pos, end) {\n        if (kind === 261 /* SourceFile */) {\n            return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);\n        }\n        else if (kind === 70 /* Identifier */) {\n            return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);\n        }\n        else if (kind < 141 /* FirstNode */) {\n            return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end);\n        }\n        else {\n            return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end);\n        }\n    }\n    ts.createNode = createNode;\n    function visitNode(cbNode, node) {\n        if (node) {\n            return cbNode(node);\n        }\n    }\n    function visitNodeArray(cbNodes, nodes) {\n        if (nodes) {\n            return cbNodes(nodes);\n        }\n    }\n    function visitEachNode(cbNode, nodes) {\n        if (nodes) {\n            for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {\n                var node = nodes_1[_i];\n                var result = cbNode(node);\n                if (result) {\n                    return result;\n                }\n            }\n        }\n    }\n    // Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes\n    // stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise,\n    // embedded arrays are flattened and the 'cbNode' callback is invoked for each element. If a callback returns\n    // a truthy value, iteration stops and that value is returned. Otherwise, undefined is returned.\n    function forEachChild(node, cbNode, cbNodeArray) {\n        if (!node) {\n            return;\n        }\n        // The visitXXX functions could be written as local functions that close over the cbNode and cbNodeArray\n        // callback parameters, but that causes a closure allocation for each invocation with noticeable effects\n        // on performance.\n        var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode;\n        var cbNodes = cbNodeArray || cbNode;\n        switch (node.kind) {\n            case 141 /* QualifiedName */:\n                return visitNode(cbNode, node.left) ||\n                    visitNode(cbNode, node.right);\n            case 143 /* TypeParameter */:\n                return visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.constraint) ||\n                    visitNode(cbNode, node.expression);\n            case 258 /* ShorthandPropertyAssignment */:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.questionToken) ||\n                    visitNode(cbNode, node.equalsToken) ||\n                    visitNode(cbNode, node.objectAssignmentInitializer);\n            case 259 /* SpreadAssignment */:\n                return visitNode(cbNode, node.expression);\n            case 144 /* Parameter */:\n            case 147 /* PropertyDeclaration */:\n            case 146 /* PropertySignature */:\n            case 257 /* PropertyAssignment */:\n            case 223 /* VariableDeclaration */:\n            case 174 /* BindingElement */:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.propertyName) ||\n                    visitNode(cbNode, node.dotDotDotToken) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.questionToken) ||\n                    visitNode(cbNode, node.type) ||\n                    visitNode(cbNode, node.initializer);\n            case 158 /* FunctionType */:\n            case 159 /* ConstructorType */:\n            case 153 /* CallSignature */:\n            case 154 /* ConstructSignature */:\n            case 155 /* IndexSignature */:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNodes(cbNodes, node.typeParameters) ||\n                    visitNodes(cbNodes, node.parameters) ||\n                    visitNode(cbNode, node.type);\n            case 149 /* MethodDeclaration */:\n            case 148 /* MethodSignature */:\n            case 150 /* Constructor */:\n            case 151 /* GetAccessor */:\n            case 152 /* SetAccessor */:\n            case 184 /* FunctionExpression */:\n            case 225 /* FunctionDeclaration */:\n            case 185 /* ArrowFunction */:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.asteriskToken) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.questionToken) ||\n                    visitNodes(cbNodes, node.typeParameters) ||\n                    visitNodes(cbNodes, node.parameters) ||\n                    visitNode(cbNode, node.type) ||\n                    visitNode(cbNode, node.equalsGreaterThanToken) ||\n                    visitNode(cbNode, node.body);\n            case 157 /* TypeReference */:\n                return visitNode(cbNode, node.typeName) ||\n                    visitNodes(cbNodes, node.typeArguments);\n            case 156 /* TypePredicate */:\n                return visitNode(cbNode, node.parameterName) ||\n                    visitNode(cbNode, node.type);\n            case 160 /* TypeQuery */:\n                return visitNode(cbNode, node.exprName);\n            case 161 /* TypeLiteral */:\n                return visitNodes(cbNodes, node.members);\n            case 162 /* ArrayType */:\n                return visitNode(cbNode, node.elementType);\n            case 163 /* TupleType */:\n                return visitNodes(cbNodes, node.elementTypes);\n            case 164 /* UnionType */:\n            case 165 /* IntersectionType */:\n                return visitNodes(cbNodes, node.types);\n            case 166 /* ParenthesizedType */:\n            case 168 /* TypeOperator */:\n                return visitNode(cbNode, node.type);\n            case 169 /* IndexedAccessType */:\n                return visitNode(cbNode, node.objectType) ||\n                    visitNode(cbNode, node.indexType);\n            case 170 /* MappedType */:\n                return visitNode(cbNode, node.readonlyToken) ||\n                    visitNode(cbNode, node.typeParameter) ||\n                    visitNode(cbNode, node.questionToken) ||\n                    visitNode(cbNode, node.type);\n            case 171 /* LiteralType */:\n                return visitNode(cbNode, node.literal);\n            case 172 /* ObjectBindingPattern */:\n            case 173 /* ArrayBindingPattern */:\n                return visitNodes(cbNodes, node.elements);\n            case 175 /* ArrayLiteralExpression */:\n                return visitNodes(cbNodes, node.elements);\n            case 176 /* ObjectLiteralExpression */:\n                return visitNodes(cbNodes, node.properties);\n            case 177 /* PropertyAccessExpression */:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.name);\n            case 178 /* ElementAccessExpression */:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.argumentExpression);\n            case 179 /* CallExpression */:\n            case 180 /* NewExpression */:\n                return visitNode(cbNode, node.expression) ||\n                    visitNodes(cbNodes, node.typeArguments) ||\n                    visitNodes(cbNodes, node.arguments);\n            case 181 /* TaggedTemplateExpression */:\n                return visitNode(cbNode, node.tag) ||\n                    visitNode(cbNode, node.template);\n            case 182 /* TypeAssertionExpression */:\n                return visitNode(cbNode, node.type) ||\n                    visitNode(cbNode, node.expression);\n            case 183 /* ParenthesizedExpression */:\n                return visitNode(cbNode, node.expression);\n            case 186 /* DeleteExpression */:\n                return visitNode(cbNode, node.expression);\n            case 187 /* TypeOfExpression */:\n                return visitNode(cbNode, node.expression);\n            case 188 /* VoidExpression */:\n                return visitNode(cbNode, node.expression);\n            case 190 /* PrefixUnaryExpression */:\n                return visitNode(cbNode, node.operand);\n            case 195 /* YieldExpression */:\n                return visitNode(cbNode, node.asteriskToken) ||\n                    visitNode(cbNode, node.expression);\n            case 189 /* AwaitExpression */:\n                return visitNode(cbNode, node.expression);\n            case 191 /* PostfixUnaryExpression */:\n                return visitNode(cbNode, node.operand);\n            case 192 /* BinaryExpression */:\n                return visitNode(cbNode, node.left) ||\n                    visitNode(cbNode, node.operatorToken) ||\n                    visitNode(cbNode, node.right);\n            case 200 /* AsExpression */:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.type);\n            case 201 /* NonNullExpression */:\n                return visitNode(cbNode, node.expression);\n            case 193 /* ConditionalExpression */:\n                return visitNode(cbNode, node.condition) ||\n                    visitNode(cbNode, node.questionToken) ||\n                    visitNode(cbNode, node.whenTrue) ||\n                    visitNode(cbNode, node.colonToken) ||\n                    visitNode(cbNode, node.whenFalse);\n            case 196 /* SpreadElement */:\n                return visitNode(cbNode, node.expression);\n            case 204 /* Block */:\n            case 231 /* ModuleBlock */:\n                return visitNodes(cbNodes, node.statements);\n            case 261 /* SourceFile */:\n                return visitNodes(cbNodes, node.statements) ||\n                    visitNode(cbNode, node.endOfFileToken);\n            case 205 /* VariableStatement */:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.declarationList);\n            case 224 /* VariableDeclarationList */:\n                return visitNodes(cbNodes, node.declarations);\n            case 207 /* ExpressionStatement */:\n                return visitNode(cbNode, node.expression);\n            case 208 /* IfStatement */:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.thenStatement) ||\n                    visitNode(cbNode, node.elseStatement);\n            case 209 /* DoStatement */:\n                return visitNode(cbNode, node.statement) ||\n                    visitNode(cbNode, node.expression);\n            case 210 /* WhileStatement */:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.statement);\n            case 211 /* ForStatement */:\n                return visitNode(cbNode, node.initializer) ||\n                    visitNode(cbNode, node.condition) ||\n                    visitNode(cbNode, node.incrementor) ||\n                    visitNode(cbNode, node.statement);\n            case 212 /* ForInStatement */:\n                return visitNode(cbNode, node.initializer) ||\n                    visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.statement);\n            case 213 /* ForOfStatement */:\n                return visitNode(cbNode, node.initializer) ||\n                    visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.statement);\n            case 214 /* ContinueStatement */:\n            case 215 /* BreakStatement */:\n                return visitNode(cbNode, node.label);\n            case 216 /* ReturnStatement */:\n                return visitNode(cbNode, node.expression);\n            case 217 /* WithStatement */:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.statement);\n            case 218 /* SwitchStatement */:\n                return visitNode(cbNode, node.expression) ||\n                    visitNode(cbNode, node.caseBlock);\n            case 232 /* CaseBlock */:\n                return visitNodes(cbNodes, node.clauses);\n            case 253 /* CaseClause */:\n                return visitNode(cbNode, node.expression) ||\n                    visitNodes(cbNodes, node.statements);\n            case 254 /* DefaultClause */:\n                return visitNodes(cbNodes, node.statements);\n            case 219 /* LabeledStatement */:\n                return visitNode(cbNode, node.label) ||\n                    visitNode(cbNode, node.statement);\n            case 220 /* ThrowStatement */:\n                return visitNode(cbNode, node.expression);\n            case 221 /* TryStatement */:\n                return visitNode(cbNode, node.tryBlock) ||\n                    visitNode(cbNode, node.catchClause) ||\n                    visitNode(cbNode, node.finallyBlock);\n            case 256 /* CatchClause */:\n                return visitNode(cbNode, node.variableDeclaration) ||\n                    visitNode(cbNode, node.block);\n            case 145 /* Decorator */:\n                return visitNode(cbNode, node.expression);\n            case 226 /* ClassDeclaration */:\n            case 197 /* ClassExpression */:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNodes(cbNodes, node.typeParameters) ||\n                    visitNodes(cbNodes, node.heritageClauses) ||\n                    visitNodes(cbNodes, node.members);\n            case 227 /* InterfaceDeclaration */:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNodes(cbNodes, node.typeParameters) ||\n                    visitNodes(cbNodes, node.heritageClauses) ||\n                    visitNodes(cbNodes, node.members);\n            case 228 /* TypeAliasDeclaration */:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNodes(cbNodes, node.typeParameters) ||\n                    visitNode(cbNode, node.type);\n            case 229 /* EnumDeclaration */:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNodes(cbNodes, node.members);\n            case 260 /* EnumMember */:\n                return visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.initializer);\n            case 230 /* ModuleDeclaration */:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.body);\n            case 234 /* ImportEqualsDeclaration */:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.moduleReference);\n            case 235 /* ImportDeclaration */:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.importClause) ||\n                    visitNode(cbNode, node.moduleSpecifier);\n            case 236 /* ImportClause */:\n                return visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.namedBindings);\n            case 233 /* NamespaceExportDeclaration */:\n                return visitNode(cbNode, node.name);\n            case 237 /* NamespaceImport */:\n                return visitNode(cbNode, node.name);\n            case 238 /* NamedImports */:\n            case 242 /* NamedExports */:\n                return visitNodes(cbNodes, node.elements);\n            case 241 /* ExportDeclaration */:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.exportClause) ||\n                    visitNode(cbNode, node.moduleSpecifier);\n            case 239 /* ImportSpecifier */:\n            case 243 /* ExportSpecifier */:\n                return visitNode(cbNode, node.propertyName) ||\n                    visitNode(cbNode, node.name);\n            case 240 /* ExportAssignment */:\n                return visitNodes(cbNodes, node.decorators) ||\n                    visitNodes(cbNodes, node.modifiers) ||\n                    visitNode(cbNode, node.expression);\n            case 194 /* TemplateExpression */:\n                return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans);\n            case 202 /* TemplateSpan */:\n                return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal);\n            case 142 /* ComputedPropertyName */:\n                return visitNode(cbNode, node.expression);\n            case 255 /* HeritageClause */:\n                return visitNodes(cbNodes, node.types);\n            case 199 /* ExpressionWithTypeArguments */:\n                return visitNode(cbNode, node.expression) ||\n                    visitNodes(cbNodes, node.typeArguments);\n            case 245 /* ExternalModuleReference */:\n                return visitNode(cbNode, node.expression);\n            case 244 /* MissingDeclaration */:\n                return visitNodes(cbNodes, node.decorators);\n            case 246 /* JsxElement */:\n                return visitNode(cbNode, node.openingElement) ||\n                    visitNodes(cbNodes, node.children) ||\n                    visitNode(cbNode, node.closingElement);\n            case 247 /* JsxSelfClosingElement */:\n            case 248 /* JsxOpeningElement */:\n                return visitNode(cbNode, node.tagName) ||\n                    visitNodes(cbNodes, node.attributes);\n            case 250 /* JsxAttribute */:\n                return visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.initializer);\n            case 251 /* JsxSpreadAttribute */:\n                return visitNode(cbNode, node.expression);\n            case 252 /* JsxExpression */:\n                return visitNode(cbNode, node.expression);\n            case 249 /* JsxClosingElement */:\n                return visitNode(cbNode, node.tagName);\n            case 262 /* JSDocTypeExpression */:\n                return visitNode(cbNode, node.type);\n            case 266 /* JSDocUnionType */:\n                return visitNodes(cbNodes, node.types);\n            case 267 /* JSDocTupleType */:\n                return visitNodes(cbNodes, node.types);\n            case 265 /* JSDocArrayType */:\n                return visitNode(cbNode, node.elementType);\n            case 269 /* JSDocNonNullableType */:\n                return visitNode(cbNode, node.type);\n            case 268 /* JSDocNullableType */:\n                return visitNode(cbNode, node.type);\n            case 270 /* JSDocRecordType */:\n                return visitNode(cbNode, node.literal);\n            case 272 /* JSDocTypeReference */:\n                return visitNode(cbNode, node.name) ||\n                    visitNodes(cbNodes, node.typeArguments);\n            case 273 /* JSDocOptionalType */:\n                return visitNode(cbNode, node.type);\n            case 274 /* JSDocFunctionType */:\n                return visitNodes(cbNodes, node.parameters) ||\n                    visitNode(cbNode, node.type);\n            case 275 /* JSDocVariadicType */:\n                return visitNode(cbNode, node.type);\n            case 276 /* JSDocConstructorType */:\n                return visitNode(cbNode, node.type);\n            case 277 /* JSDocThisType */:\n                return visitNode(cbNode, node.type);\n            case 271 /* JSDocRecordMember */:\n                return visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.type);\n            case 278 /* JSDocComment */:\n                return visitNodes(cbNodes, node.tags);\n            case 281 /* JSDocParameterTag */:\n                return visitNode(cbNode, node.preParameterName) ||\n                    visitNode(cbNode, node.typeExpression) ||\n                    visitNode(cbNode, node.postParameterName);\n            case 282 /* JSDocReturnTag */:\n                return visitNode(cbNode, node.typeExpression);\n            case 283 /* JSDocTypeTag */:\n                return visitNode(cbNode, node.typeExpression);\n            case 280 /* JSDocAugmentsTag */:\n                return visitNode(cbNode, node.typeExpression);\n            case 284 /* JSDocTemplateTag */:\n                return visitNodes(cbNodes, node.typeParameters);\n            case 285 /* JSDocTypedefTag */:\n                return visitNode(cbNode, node.typeExpression) ||\n                    visitNode(cbNode, node.fullName) ||\n                    visitNode(cbNode, node.name) ||\n                    visitNode(cbNode, node.jsDocTypeLiteral);\n            case 287 /* JSDocTypeLiteral */:\n                return visitNodes(cbNodes, node.jsDocPropertyTags);\n            case 286 /* JSDocPropertyTag */:\n                return visitNode(cbNode, node.typeExpression) ||\n                    visitNode(cbNode, node.name);\n            case 294 /* PartiallyEmittedExpression */:\n                return visitNode(cbNode, node.expression);\n            case 288 /* JSDocLiteralType */:\n                return visitNode(cbNode, node.literal);\n        }\n    }\n    ts.forEachChild = forEachChild;\n    function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) {\n        if (setParentNodes === void 0) { setParentNodes = false; }\n        ts.performance.mark(\"beforeParse\");\n        var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind);\n        ts.performance.mark(\"afterParse\");\n        ts.performance.measure(\"Parse\", \"beforeParse\", \"afterParse\");\n        return result;\n    }\n    ts.createSourceFile = createSourceFile;\n    function parseIsolatedEntityName(text, languageVersion) {\n        return Parser.parseIsolatedEntityName(text, languageVersion);\n    }\n    ts.parseIsolatedEntityName = parseIsolatedEntityName;\n    function isExternalModule(file) {\n        return file.externalModuleIndicator !== undefined;\n    }\n    ts.isExternalModule = isExternalModule;\n    // Produces a new SourceFile for the 'newText' provided. The 'textChangeRange' parameter\n    // indicates what changed between the 'text' that this SourceFile has and the 'newText'.\n    // The SourceFile will be created with the compiler attempting to reuse as many nodes from\n    // this file as possible.\n    //\n    // Note: this function mutates nodes from this SourceFile. That means any existing nodes\n    // from this SourceFile that are being held onto may change as a result (including\n    // becoming detached from any SourceFile).  It is recommended that this SourceFile not\n    // be used once 'update' is called on it.\n    function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) {\n        return IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);\n    }\n    ts.updateSourceFile = updateSourceFile;\n    /* @internal */\n    function parseIsolatedJSDocComment(content, start, length) {\n        var result = Parser.JSDocParser.parseIsolatedJSDocComment(content, start, length);\n        if (result && result.jsDoc) {\n            // because the jsDocComment was parsed out of the source file, it might\n            // not be covered by the fixupParentReferences.\n            Parser.fixupParentReferences(result.jsDoc);\n        }\n        return result;\n    }\n    ts.parseIsolatedJSDocComment = parseIsolatedJSDocComment;\n    /* @internal */\n    // Exposed only for testing.\n    function parseJSDocTypeExpressionForTests(content, start, length) {\n        return Parser.JSDocParser.parseJSDocTypeExpressionForTests(content, start, length);\n    }\n    ts.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;\n    // Implement the parser as a singleton module.  We do this for perf reasons because creating\n    // parser instances can actually be expensive enough to impact us on projects with many source\n    // files.\n    var Parser;\n    (function (Parser) {\n        // Share a single scanner across all calls to parse a source file.  This helps speed things\n        // up by avoiding the cost of creating/compiling scanners over and over again.\n        var scanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ true);\n        var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */;\n        // capture constructors in 'initializeState' to avoid null checks\n        var NodeConstructor;\n        var TokenConstructor;\n        var IdentifierConstructor;\n        var SourceFileConstructor;\n        var sourceFile;\n        var parseDiagnostics;\n        var syntaxCursor;\n        var currentToken;\n        var sourceText;\n        var nodeCount;\n        var identifiers;\n        var identifierCount;\n        var parsingContext;\n        // Flags that dictate what parsing context we're in.  For example:\n        // Whether or not we are in strict parsing mode.  All that changes in strict parsing mode is\n        // that some tokens that would be considered identifiers may be considered keywords.\n        //\n        // When adding more parser context flags, consider which is the more common case that the\n        // flag will be in.  This should be the 'false' state for that flag.  The reason for this is\n        // that we don't store data in our nodes unless the value is in the *non-default* state.  So,\n        // for example, more often than code 'allows-in' (or doesn't 'disallow-in').  We opt for\n        // 'disallow-in' set to 'false'.  Otherwise, if we had 'allowsIn' set to 'true', then almost\n        // all nodes would need extra state on them to store this info.\n        //\n        // Note:  'allowIn' and 'allowYield' track 1:1 with the [in] and [yield] concepts in the ES6\n        // grammar specification.\n        //\n        // An important thing about these context concepts.  By default they are effectively inherited\n        // while parsing through every grammar production.  i.e. if you don't change them, then when\n        // you parse a sub-production, it will have the same context values as the parent production.\n        // This is great most of the time.  After all, consider all the 'expression' grammar productions\n        // and how nearly all of them pass along the 'in' and 'yield' context values:\n        //\n        // EqualityExpression[In, Yield] :\n        //      RelationalExpression[?In, ?Yield]\n        //      EqualityExpression[?In, ?Yield] == RelationalExpression[?In, ?Yield]\n        //      EqualityExpression[?In, ?Yield] != RelationalExpression[?In, ?Yield]\n        //      EqualityExpression[?In, ?Yield] === RelationalExpression[?In, ?Yield]\n        //      EqualityExpression[?In, ?Yield] !== RelationalExpression[?In, ?Yield]\n        //\n        // Where you have to be careful is then understanding what the points are in the grammar\n        // where the values are *not* passed along.  For example:\n        //\n        // SingleNameBinding[Yield,GeneratorParameter]\n        //      [+GeneratorParameter]BindingIdentifier[Yield] Initializer[In]opt\n        //      [~GeneratorParameter]BindingIdentifier[?Yield]Initializer[In, ?Yield]opt\n        //\n        // Here this is saying that if the GeneratorParameter context flag is set, that we should\n        // explicitly set the 'yield' context flag to false before calling into the BindingIdentifier\n        // and we should explicitly unset the 'yield' context flag before calling into the Initializer.\n        // production.  Conversely, if the GeneratorParameter context flag is not set, then we\n        // should leave the 'yield' context flag alone.\n        //\n        // Getting this all correct is tricky and requires careful reading of the grammar to\n        // understand when these values should be changed versus when they should be inherited.\n        //\n        // Note: it should not be necessary to save/restore these flags during speculative/lookahead\n        // parsing.  These context flags are naturally stored and restored through normal recursive\n        // descent parsing and unwinding.\n        var contextFlags;\n        // Whether or not we've had a parse error since creating the last AST node.  If we have\n        // encountered an error, it will be stored on the next AST node we create.  Parse errors\n        // can be broken down into three categories:\n        //\n        // 1) An error that occurred during scanning.  For example, an unterminated literal, or a\n        //    character that was completely not understood.\n        //\n        // 2) A token was expected, but was not present.  This type of error is commonly produced\n        //    by the 'parseExpected' function.\n        //\n        // 3) A token was present that no parsing function was able to consume.  This type of error\n        //    only occurs in the 'abortParsingListOrMoveToNextToken' function when the parser\n        //    decides to skip the token.\n        //\n        // In all of these cases, we want to mark the next node as having had an error before it.\n        // With this mark, we can know in incremental settings if this node can be reused, or if\n        // we have to reparse it.  If we don't keep this information around, we may just reuse the\n        // node.  in that event we would then not produce the same errors as we did before, causing\n        // significant confusion problems.\n        //\n        // Note: it is necessary that this value be saved/restored during speculative/lookahead\n        // parsing.  During lookahead parsing, we will often create a node.  That node will have\n        // this value attached, and then this value will be set back to 'false'.  If we decide to\n        // rewind, we must get back to the same value we had prior to the lookahead.\n        //\n        // Note: any errors at the end of the file that do not precede a regular node, should get\n        // attached to the EOF token.\n        var parseErrorBeforeNextFinishedNode = false;\n        function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes, scriptKind) {\n            scriptKind = ts.ensureScriptKind(fileName, scriptKind);\n            initializeState(sourceText, languageVersion, syntaxCursor, scriptKind);\n            var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind);\n            clearState();\n            return result;\n        }\n        Parser.parseSourceFile = parseSourceFile;\n        function parseIsolatedEntityName(content, languageVersion) {\n            initializeState(content, languageVersion, /*syntaxCursor*/ undefined, 1 /* JS */);\n            // Prime the scanner.\n            nextToken();\n            var entityName = parseEntityName(/*allowReservedWords*/ true);\n            var isInvalid = token() === 1 /* EndOfFileToken */ && !parseDiagnostics.length;\n            clearState();\n            return isInvalid ? entityName : undefined;\n        }\n        Parser.parseIsolatedEntityName = parseIsolatedEntityName;\n        function getLanguageVariant(scriptKind) {\n            // .tsx and .jsx files are treated as jsx language variant.\n            return scriptKind === 4 /* TSX */ || scriptKind === 2 /* JSX */ || scriptKind === 1 /* JS */ ? 1 /* JSX */ : 0 /* Standard */;\n        }\n        function initializeState(_sourceText, languageVersion, _syntaxCursor, scriptKind) {\n            NodeConstructor = ts.objectAllocator.getNodeConstructor();\n            TokenConstructor = ts.objectAllocator.getTokenConstructor();\n            IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor();\n            SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor();\n            sourceText = _sourceText;\n            syntaxCursor = _syntaxCursor;\n            parseDiagnostics = [];\n            parsingContext = 0;\n            identifiers = ts.createMap();\n            identifierCount = 0;\n            nodeCount = 0;\n            contextFlags = scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */ ? 65536 /* JavaScriptFile */ : 0 /* None */;\n            parseErrorBeforeNextFinishedNode = false;\n            // Initialize and prime the scanner before parsing the source elements.\n            scanner.setText(sourceText);\n            scanner.setOnError(scanError);\n            scanner.setScriptTarget(languageVersion);\n            scanner.setLanguageVariant(getLanguageVariant(scriptKind));\n        }\n        function clearState() {\n            // Clear out the text the scanner is pointing at, so it doesn't keep anything alive unnecessarily.\n            scanner.setText(\"\");\n            scanner.setOnError(undefined);\n            // Clear any data.  We don't want to accidentally hold onto it for too long.\n            parseDiagnostics = undefined;\n            sourceFile = undefined;\n            identifiers = undefined;\n            syntaxCursor = undefined;\n            sourceText = undefined;\n        }\n        function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) {\n            sourceFile = createSourceFile(fileName, languageVersion, scriptKind);\n            sourceFile.flags = contextFlags;\n            // Prime the scanner.\n            nextToken();\n            processReferenceComments(sourceFile);\n            sourceFile.statements = parseList(0 /* SourceElements */, parseStatement);\n            ts.Debug.assert(token() === 1 /* EndOfFileToken */);\n            sourceFile.endOfFileToken = parseTokenNode();\n            setExternalModuleIndicator(sourceFile);\n            sourceFile.nodeCount = nodeCount;\n            sourceFile.identifierCount = identifierCount;\n            sourceFile.identifiers = identifiers;\n            sourceFile.parseDiagnostics = parseDiagnostics;\n            if (setParentNodes) {\n                fixupParentReferences(sourceFile);\n            }\n            return sourceFile;\n        }\n        function addJSDocComment(node) {\n            var comments = ts.getJSDocCommentRanges(node, sourceFile.text);\n            if (comments) {\n                for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) {\n                    var comment = comments_2[_i];\n                    var jsDoc = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos);\n                    if (!jsDoc) {\n                        continue;\n                    }\n                    if (!node.jsDoc) {\n                        node.jsDoc = [];\n                    }\n                    node.jsDoc.push(jsDoc);\n                }\n            }\n            return node;\n        }\n        function fixupParentReferences(rootNode) {\n            // normally parent references are set during binding. However, for clients that only need\n            // a syntax tree, and no semantic features, then the binding process is an unnecessary\n            // overhead.  This functions allows us to set all the parents, without all the expense of\n            // binding.\n            var parent = rootNode;\n            forEachChild(rootNode, visitNode);\n            return;\n            function visitNode(n) {\n                // walk down setting parents that differ from the parent we think it should be.  This\n                // allows us to quickly bail out of setting parents for subtrees during incremental\n                // parsing\n                if (n.parent !== parent) {\n                    n.parent = parent;\n                    var saveParent = parent;\n                    parent = n;\n                    forEachChild(n, visitNode);\n                    if (n.jsDoc) {\n                        for (var _i = 0, _a = n.jsDoc; _i < _a.length; _i++) {\n                            var jsDoc = _a[_i];\n                            jsDoc.parent = n;\n                            parent = jsDoc;\n                            forEachChild(jsDoc, visitNode);\n                        }\n                    }\n                    parent = saveParent;\n                }\n            }\n        }\n        Parser.fixupParentReferences = fixupParentReferences;\n        function createSourceFile(fileName, languageVersion, scriptKind) {\n            // code from createNode is inlined here so createNode won't have to deal with special case of creating source files\n            // this is quite rare comparing to other nodes and createNode should be as fast as possible\n            var sourceFile = new SourceFileConstructor(261 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);\n            nodeCount++;\n            sourceFile.text = sourceText;\n            sourceFile.bindDiagnostics = [];\n            sourceFile.languageVersion = languageVersion;\n            sourceFile.fileName = ts.normalizePath(fileName);\n            sourceFile.languageVariant = getLanguageVariant(scriptKind);\n            sourceFile.isDeclarationFile = ts.fileExtensionIs(sourceFile.fileName, \".d.ts\");\n            sourceFile.scriptKind = scriptKind;\n            return sourceFile;\n        }\n        function setContextFlag(val, flag) {\n            if (val) {\n                contextFlags |= flag;\n            }\n            else {\n                contextFlags &= ~flag;\n            }\n        }\n        function setDisallowInContext(val) {\n            setContextFlag(val, 2048 /* DisallowInContext */);\n        }\n        function setYieldContext(val) {\n            setContextFlag(val, 4096 /* YieldContext */);\n        }\n        function setDecoratorContext(val) {\n            setContextFlag(val, 8192 /* DecoratorContext */);\n        }\n        function setAwaitContext(val) {\n            setContextFlag(val, 16384 /* AwaitContext */);\n        }\n        function doOutsideOfContext(context, func) {\n            // contextFlagsToClear will contain only the context flags that are\n            // currently set that we need to temporarily clear\n            // We don't just blindly reset to the previous flags to ensure\n            // that we do not mutate cached flags for the incremental\n            // parser (ThisNodeHasError, ThisNodeOrAnySubNodesHasError, and\n            // HasAggregatedChildData).\n            var contextFlagsToClear = context & contextFlags;\n            if (contextFlagsToClear) {\n                // clear the requested context flags\n                setContextFlag(/*val*/ false, contextFlagsToClear);\n                var result = func();\n                // restore the context flags we just cleared\n                setContextFlag(/*val*/ true, contextFlagsToClear);\n                return result;\n            }\n            // no need to do anything special as we are not in any of the requested contexts\n            return func();\n        }\n        function doInsideOfContext(context, func) {\n            // contextFlagsToSet will contain only the context flags that\n            // are not currently set that we need to temporarily enable.\n            // We don't just blindly reset to the previous flags to ensure\n            // that we do not mutate cached flags for the incremental\n            // parser (ThisNodeHasError, ThisNodeOrAnySubNodesHasError, and\n            // HasAggregatedChildData).\n            var contextFlagsToSet = context & ~contextFlags;\n            if (contextFlagsToSet) {\n                // set the requested context flags\n                setContextFlag(/*val*/ true, contextFlagsToSet);\n                var result = func();\n                // reset the context flags we just set\n                setContextFlag(/*val*/ false, contextFlagsToSet);\n                return result;\n            }\n            // no need to do anything special as we are already in all of the requested contexts\n            return func();\n        }\n        function allowInAnd(func) {\n            return doOutsideOfContext(2048 /* DisallowInContext */, func);\n        }\n        function disallowInAnd(func) {\n            return doInsideOfContext(2048 /* DisallowInContext */, func);\n        }\n        function doInYieldContext(func) {\n            return doInsideOfContext(4096 /* YieldContext */, func);\n        }\n        function doInDecoratorContext(func) {\n            return doInsideOfContext(8192 /* DecoratorContext */, func);\n        }\n        function doInAwaitContext(func) {\n            return doInsideOfContext(16384 /* AwaitContext */, func);\n        }\n        function doOutsideOfAwaitContext(func) {\n            return doOutsideOfContext(16384 /* AwaitContext */, func);\n        }\n        function doInYieldAndAwaitContext(func) {\n            return doInsideOfContext(4096 /* YieldContext */ | 16384 /* AwaitContext */, func);\n        }\n        function inContext(flags) {\n            return (contextFlags & flags) !== 0;\n        }\n        function inYieldContext() {\n            return inContext(4096 /* YieldContext */);\n        }\n        function inDisallowInContext() {\n            return inContext(2048 /* DisallowInContext */);\n        }\n        function inDecoratorContext() {\n            return inContext(8192 /* DecoratorContext */);\n        }\n        function inAwaitContext() {\n            return inContext(16384 /* AwaitContext */);\n        }\n        function parseErrorAtCurrentToken(message, arg0) {\n            var start = scanner.getTokenPos();\n            var length = scanner.getTextPos() - start;\n            parseErrorAtPosition(start, length, message, arg0);\n        }\n        function parseErrorAtPosition(start, length, message, arg0) {\n            // Don't report another error if it would just be at the same position as the last error.\n            var lastError = ts.lastOrUndefined(parseDiagnostics);\n            if (!lastError || start !== lastError.start) {\n                parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, start, length, message, arg0));\n            }\n            // Mark that we've encountered an error.  We'll set an appropriate bit on the next\n            // node we finish so that it can't be reused incrementally.\n            parseErrorBeforeNextFinishedNode = true;\n        }\n        function scanError(message, length) {\n            var pos = scanner.getTextPos();\n            parseErrorAtPosition(pos, length || 0, message);\n        }\n        function getNodePos() {\n            return scanner.getStartPos();\n        }\n        function getNodeEnd() {\n            return scanner.getStartPos();\n        }\n        // Use this function to access the current token instead of reading the currentToken\n        // variable. Since function results aren't narrowed in control flow analysis, this ensures\n        // that the type checker doesn't make wrong assumptions about the type of the current\n        // token (e.g. a call to nextToken() changes the current token but the checker doesn't\n        // reason about this side effect).  Mainstream VMs inline simple functions like this, so\n        // there is no performance penalty.\n        function token() {\n            return currentToken;\n        }\n        function nextToken() {\n            return currentToken = scanner.scan();\n        }\n        function reScanGreaterToken() {\n            return currentToken = scanner.reScanGreaterToken();\n        }\n        function reScanSlashToken() {\n            return currentToken = scanner.reScanSlashToken();\n        }\n        function reScanTemplateToken() {\n            return currentToken = scanner.reScanTemplateToken();\n        }\n        function scanJsxIdentifier() {\n            return currentToken = scanner.scanJsxIdentifier();\n        }\n        function scanJsxText() {\n            return currentToken = scanner.scanJsxToken();\n        }\n        function scanJsxAttributeValue() {\n            return currentToken = scanner.scanJsxAttributeValue();\n        }\n        function speculationHelper(callback, isLookAhead) {\n            // Keep track of the state we'll need to rollback to if lookahead fails (or if the\n            // caller asked us to always reset our state).\n            var saveToken = currentToken;\n            var saveParseDiagnosticsLength = parseDiagnostics.length;\n            var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;\n            // Note: it is not actually necessary to save/restore the context flags here.  That's\n            // because the saving/restoring of these flags happens naturally through the recursive\n            // descent nature of our parser.  However, we still store this here just so we can\n            // assert that invariant holds.\n            var saveContextFlags = contextFlags;\n            // If we're only looking ahead, then tell the scanner to only lookahead as well.\n            // Otherwise, if we're actually speculatively parsing, then tell the scanner to do the\n            // same.\n            var result = isLookAhead\n                ? scanner.lookAhead(callback)\n                : scanner.tryScan(callback);\n            ts.Debug.assert(saveContextFlags === contextFlags);\n            // If our callback returned something 'falsy' or we're just looking ahead,\n            // then unconditionally restore us to where we were.\n            if (!result || isLookAhead) {\n                currentToken = saveToken;\n                parseDiagnostics.length = saveParseDiagnosticsLength;\n                parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode;\n            }\n            return result;\n        }\n        /** Invokes the provided callback then unconditionally restores the parser to the state it\n         * was in immediately prior to invoking the callback.  The result of invoking the callback\n         * is returned from this function.\n         */\n        function lookAhead(callback) {\n            return speculationHelper(callback, /*isLookAhead*/ true);\n        }\n        /** Invokes the provided callback.  If the callback returns something falsy, then it restores\n         * the parser to the state it was in immediately prior to invoking the callback.  If the\n         * callback returns something truthy, then the parser state is not rolled back.  The result\n         * of invoking the callback is returned from this function.\n         */\n        function tryParse(callback) {\n            return speculationHelper(callback, /*isLookAhead*/ false);\n        }\n        // Ignore strict mode flag because we will report an error in type checker instead.\n        function isIdentifier() {\n            if (token() === 70 /* Identifier */) {\n                return true;\n            }\n            // If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is\n            // considered a keyword and is not an identifier.\n            if (token() === 115 /* YieldKeyword */ && inYieldContext()) {\n                return false;\n            }\n            // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is\n            // considered a keyword and is not an identifier.\n            if (token() === 120 /* AwaitKeyword */ && inAwaitContext()) {\n                return false;\n            }\n            return token() > 106 /* LastReservedWord */;\n        }\n        function parseExpected(kind, diagnosticMessage, shouldAdvance) {\n            if (shouldAdvance === void 0) { shouldAdvance = true; }\n            if (token() === kind) {\n                if (shouldAdvance) {\n                    nextToken();\n                }\n                return true;\n            }\n            // Report specific message if provided with one.  Otherwise, report generic fallback message.\n            if (diagnosticMessage) {\n                parseErrorAtCurrentToken(diagnosticMessage);\n            }\n            else {\n                parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));\n            }\n            return false;\n        }\n        function parseOptional(t) {\n            if (token() === t) {\n                nextToken();\n                return true;\n            }\n            return false;\n        }\n        function parseOptionalToken(t) {\n            if (token() === t) {\n                return parseTokenNode();\n            }\n            return undefined;\n        }\n        function parseExpectedToken(t, reportAtCurrentPosition, diagnosticMessage, arg0) {\n            return parseOptionalToken(t) ||\n                createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0);\n        }\n        function parseTokenNode() {\n            var node = createNode(token());\n            nextToken();\n            return finishNode(node);\n        }\n        function canParseSemicolon() {\n            // If there's a real semicolon, then we can always parse it out.\n            if (token() === 24 /* SemicolonToken */) {\n                return true;\n            }\n            // We can parse out an optional semicolon in ASI cases in the following cases.\n            return token() === 17 /* CloseBraceToken */ || token() === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak();\n        }\n        function parseSemicolon() {\n            if (canParseSemicolon()) {\n                if (token() === 24 /* SemicolonToken */) {\n                    // consume the semicolon if it was explicitly provided.\n                    nextToken();\n                }\n                return true;\n            }\n            else {\n                return parseExpected(24 /* SemicolonToken */);\n            }\n        }\n        // note: this function creates only node\n        function createNode(kind, pos) {\n            nodeCount++;\n            if (!(pos >= 0)) {\n                pos = scanner.getStartPos();\n            }\n            return kind >= 141 /* FirstNode */ ? new NodeConstructor(kind, pos, pos) :\n                kind === 70 /* Identifier */ ? new IdentifierConstructor(kind, pos, pos) :\n                    new TokenConstructor(kind, pos, pos);\n        }\n        function createNodeArray(elements, pos) {\n            var array = (elements || []);\n            if (!(pos >= 0)) {\n                pos = getNodePos();\n            }\n            array.pos = pos;\n            array.end = pos;\n            return array;\n        }\n        function finishNode(node, end) {\n            node.end = end === undefined ? scanner.getStartPos() : end;\n            if (contextFlags) {\n                node.flags |= contextFlags;\n            }\n            // Keep track on the node if we encountered an error while parsing it.  If we did, then\n            // we cannot reuse the node incrementally.  Once we've marked this node, clear out the\n            // flag so that we don't mark any subsequent nodes.\n            if (parseErrorBeforeNextFinishedNode) {\n                parseErrorBeforeNextFinishedNode = false;\n                node.flags |= 32768 /* ThisNodeHasError */;\n            }\n            return node;\n        }\n        function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, arg0) {\n            if (reportAtCurrentPosition) {\n                parseErrorAtPosition(scanner.getStartPos(), 0, diagnosticMessage, arg0);\n            }\n            else {\n                parseErrorAtCurrentToken(diagnosticMessage, arg0);\n            }\n            var result = createNode(kind, scanner.getStartPos());\n            result.text = \"\";\n            return finishNode(result);\n        }\n        function internIdentifier(text) {\n            text = ts.escapeIdentifier(text);\n            return identifiers[text] || (identifiers[text] = text);\n        }\n        // An identifier that starts with two underscores has an extra underscore character prepended to it to avoid issues\n        // with magic property names like '__proto__'. The 'identifiers' object is used to share a single string instance for\n        // each identifier in order to reduce memory consumption.\n        function createIdentifier(isIdentifier, diagnosticMessage) {\n            identifierCount++;\n            if (isIdentifier) {\n                var node = createNode(70 /* Identifier */);\n                // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker\n                if (token() !== 70 /* Identifier */) {\n                    node.originalKeywordKind = token();\n                }\n                node.text = internIdentifier(scanner.getTokenValue());\n                nextToken();\n                return finishNode(node);\n            }\n            return createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics.Identifier_expected);\n        }\n        function parseIdentifier(diagnosticMessage) {\n            return createIdentifier(isIdentifier(), diagnosticMessage);\n        }\n        function parseIdentifierName() {\n            return createIdentifier(ts.tokenIsIdentifierOrKeyword(token()));\n        }\n        function isLiteralPropertyName() {\n            return ts.tokenIsIdentifierOrKeyword(token()) ||\n                token() === 9 /* StringLiteral */ ||\n                token() === 8 /* NumericLiteral */;\n        }\n        function parsePropertyNameWorker(allowComputedPropertyNames) {\n            if (token() === 9 /* StringLiteral */ || token() === 8 /* NumericLiteral */) {\n                return parseLiteralNode(/*internName*/ true);\n            }\n            if (allowComputedPropertyNames && token() === 20 /* OpenBracketToken */) {\n                return parseComputedPropertyName();\n            }\n            return parseIdentifierName();\n        }\n        function parsePropertyName() {\n            return parsePropertyNameWorker(/*allowComputedPropertyNames*/ true);\n        }\n        function parseSimplePropertyName() {\n            return parsePropertyNameWorker(/*allowComputedPropertyNames*/ false);\n        }\n        function isSimplePropertyName() {\n            return token() === 9 /* StringLiteral */ || token() === 8 /* NumericLiteral */ || ts.tokenIsIdentifierOrKeyword(token());\n        }\n        function parseComputedPropertyName() {\n            // PropertyName [Yield]:\n            //      LiteralPropertyName\n            //      ComputedPropertyName[?Yield]\n            var node = createNode(142 /* ComputedPropertyName */);\n            parseExpected(20 /* OpenBracketToken */);\n            // We parse any expression (including a comma expression). But the grammar\n            // says that only an assignment expression is allowed, so the grammar checker\n            // will error if it sees a comma expression.\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(21 /* CloseBracketToken */);\n            return finishNode(node);\n        }\n        function parseContextualModifier(t) {\n            return token() === t && tryParse(nextTokenCanFollowModifier);\n        }\n        function nextTokenIsOnSameLineAndCanFollowModifier() {\n            nextToken();\n            if (scanner.hasPrecedingLineBreak()) {\n                return false;\n            }\n            return canFollowModifier();\n        }\n        function nextTokenCanFollowModifier() {\n            if (token() === 75 /* ConstKeyword */) {\n                // 'const' is only a modifier if followed by 'enum'.\n                return nextToken() === 82 /* EnumKeyword */;\n            }\n            if (token() === 83 /* ExportKeyword */) {\n                nextToken();\n                if (token() === 78 /* DefaultKeyword */) {\n                    return lookAhead(nextTokenIsClassOrFunctionOrAsync);\n                }\n                return token() !== 38 /* AsteriskToken */ && token() !== 117 /* AsKeyword */ && token() !== 16 /* OpenBraceToken */ && canFollowModifier();\n            }\n            if (token() === 78 /* DefaultKeyword */) {\n                return nextTokenIsClassOrFunctionOrAsync();\n            }\n            if (token() === 114 /* StaticKeyword */) {\n                nextToken();\n                return canFollowModifier();\n            }\n            return nextTokenIsOnSameLineAndCanFollowModifier();\n        }\n        function parseAnyContextualModifier() {\n            return ts.isModifierKind(token()) && tryParse(nextTokenCanFollowModifier);\n        }\n        function canFollowModifier() {\n            return token() === 20 /* OpenBracketToken */\n                || token() === 16 /* OpenBraceToken */\n                || token() === 38 /* AsteriskToken */\n                || token() === 23 /* DotDotDotToken */\n                || isLiteralPropertyName();\n        }\n        function nextTokenIsClassOrFunctionOrAsync() {\n            nextToken();\n            return token() === 74 /* ClassKeyword */ || token() === 88 /* FunctionKeyword */ ||\n                (token() === 119 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine));\n        }\n        // True if positioned at the start of a list element\n        function isListElement(parsingContext, inErrorRecovery) {\n            var node = currentNode(parsingContext);\n            if (node) {\n                return true;\n            }\n            switch (parsingContext) {\n                case 0 /* SourceElements */:\n                case 1 /* BlockStatements */:\n                case 3 /* SwitchClauseStatements */:\n                    // If we're in error recovery, then we don't want to treat ';' as an empty statement.\n                    // The problem is that ';' can show up in far too many contexts, and if we see one\n                    // and assume it's a statement, then we may bail out inappropriately from whatever\n                    // we're parsing.  For example, if we have a semicolon in the middle of a class, then\n                    // we really don't want to assume the class is over and we're on a statement in the\n                    // outer module.  We just want to consume and move on.\n                    return !(token() === 24 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement();\n                case 2 /* SwitchClauses */:\n                    return token() === 72 /* CaseKeyword */ || token() === 78 /* DefaultKeyword */;\n                case 4 /* TypeMembers */:\n                    return lookAhead(isTypeMemberStart);\n                case 5 /* ClassMembers */:\n                    // We allow semicolons as class elements (as specified by ES6) as long as we're\n                    // not in error recovery.  If we're in error recovery, we don't want an errant\n                    // semicolon to be treated as a class member (since they're almost always used\n                    // for statements.\n                    return lookAhead(isClassMemberStart) || (token() === 24 /* SemicolonToken */ && !inErrorRecovery);\n                case 6 /* EnumMembers */:\n                    // Include open bracket computed properties. This technically also lets in indexers,\n                    // which would be a candidate for improved error reporting.\n                    return token() === 20 /* OpenBracketToken */ || isLiteralPropertyName();\n                case 12 /* ObjectLiteralMembers */:\n                    return token() === 20 /* OpenBracketToken */ || token() === 38 /* AsteriskToken */ || token() === 23 /* DotDotDotToken */ || isLiteralPropertyName();\n                case 17 /* RestProperties */:\n                    return isLiteralPropertyName();\n                case 9 /* ObjectBindingElements */:\n                    return token() === 20 /* OpenBracketToken */ || token() === 23 /* DotDotDotToken */ || isLiteralPropertyName();\n                case 7 /* HeritageClauseElement */:\n                    // If we see { } then only consume it as an expression if it is followed by , or {\n                    // That way we won't consume the body of a class in its heritage clause.\n                    if (token() === 16 /* OpenBraceToken */) {\n                        return lookAhead(isValidHeritageClauseObjectLiteral);\n                    }\n                    if (!inErrorRecovery) {\n                        return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword();\n                    }\n                    else {\n                        // If we're in error recovery we tighten up what we're willing to match.\n                        // That way we don't treat something like \"this\" as a valid heritage clause\n                        // element during recovery.\n                        return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword();\n                    }\n                case 8 /* VariableDeclarations */:\n                    return isIdentifierOrPattern();\n                case 10 /* ArrayBindingElements */:\n                    return token() === 25 /* CommaToken */ || token() === 23 /* DotDotDotToken */ || isIdentifierOrPattern();\n                case 18 /* TypeParameters */:\n                    return isIdentifier();\n                case 11 /* ArgumentExpressions */:\n                case 15 /* ArrayLiteralMembers */:\n                    return token() === 25 /* CommaToken */ || token() === 23 /* DotDotDotToken */ || isStartOfExpression();\n                case 16 /* Parameters */:\n                    return isStartOfParameter();\n                case 19 /* TypeArguments */:\n                case 20 /* TupleElementTypes */:\n                    return token() === 25 /* CommaToken */ || isStartOfType();\n                case 21 /* HeritageClauses */:\n                    return isHeritageClause();\n                case 22 /* ImportOrExportSpecifiers */:\n                    return ts.tokenIsIdentifierOrKeyword(token());\n                case 13 /* JsxAttributes */:\n                    return ts.tokenIsIdentifierOrKeyword(token()) || token() === 16 /* OpenBraceToken */;\n                case 14 /* JsxChildren */:\n                    return true;\n                case 23 /* JSDocFunctionParameters */:\n                case 24 /* JSDocTypeArguments */:\n                case 26 /* JSDocTupleTypes */:\n                    return JSDocParser.isJSDocType();\n                case 25 /* JSDocRecordMembers */:\n                    return isSimplePropertyName();\n            }\n            ts.Debug.fail(\"Non-exhaustive case in 'isListElement'.\");\n        }\n        function isValidHeritageClauseObjectLiteral() {\n            ts.Debug.assert(token() === 16 /* OpenBraceToken */);\n            if (nextToken() === 17 /* CloseBraceToken */) {\n                // if we see  \"extends {}\" then only treat the {} as what we're extending (and not\n                // the class body) if we have:\n                //\n                //      extends {} {\n                //      extends {},\n                //      extends {} extends\n                //      extends {} implements\n                var next = nextToken();\n                return next === 25 /* CommaToken */ || next === 16 /* OpenBraceToken */ || next === 84 /* ExtendsKeyword */ || next === 107 /* ImplementsKeyword */;\n            }\n            return true;\n        }\n        function nextTokenIsIdentifier() {\n            nextToken();\n            return isIdentifier();\n        }\n        function nextTokenIsIdentifierOrKeyword() {\n            nextToken();\n            return ts.tokenIsIdentifierOrKeyword(token());\n        }\n        function isHeritageClauseExtendsOrImplementsKeyword() {\n            if (token() === 107 /* ImplementsKeyword */ ||\n                token() === 84 /* ExtendsKeyword */) {\n                return lookAhead(nextTokenIsStartOfExpression);\n            }\n            return false;\n        }\n        function nextTokenIsStartOfExpression() {\n            nextToken();\n            return isStartOfExpression();\n        }\n        // True if positioned at a list terminator\n        function isListTerminator(kind) {\n            if (token() === 1 /* EndOfFileToken */) {\n                // Being at the end of the file ends all lists.\n                return true;\n            }\n            switch (kind) {\n                case 1 /* BlockStatements */:\n                case 2 /* SwitchClauses */:\n                case 4 /* TypeMembers */:\n                case 5 /* ClassMembers */:\n                case 6 /* EnumMembers */:\n                case 12 /* ObjectLiteralMembers */:\n                case 9 /* ObjectBindingElements */:\n                case 22 /* ImportOrExportSpecifiers */:\n                    return token() === 17 /* CloseBraceToken */;\n                case 3 /* SwitchClauseStatements */:\n                    return token() === 17 /* CloseBraceToken */ || token() === 72 /* CaseKeyword */ || token() === 78 /* DefaultKeyword */;\n                case 7 /* HeritageClauseElement */:\n                    return token() === 16 /* OpenBraceToken */ || token() === 84 /* ExtendsKeyword */ || token() === 107 /* ImplementsKeyword */;\n                case 8 /* VariableDeclarations */:\n                    return isVariableDeclaratorListTerminator();\n                case 18 /* TypeParameters */:\n                    // Tokens other than '>' are here for better error recovery\n                    return token() === 28 /* GreaterThanToken */ || token() === 18 /* OpenParenToken */ || token() === 16 /* OpenBraceToken */ || token() === 84 /* ExtendsKeyword */ || token() === 107 /* ImplementsKeyword */;\n                case 11 /* ArgumentExpressions */:\n                    // Tokens other than ')' are here for better error recovery\n                    return token() === 19 /* CloseParenToken */ || token() === 24 /* SemicolonToken */;\n                case 15 /* ArrayLiteralMembers */:\n                case 20 /* TupleElementTypes */:\n                case 10 /* ArrayBindingElements */:\n                    return token() === 21 /* CloseBracketToken */;\n                case 16 /* Parameters */:\n                case 17 /* RestProperties */:\n                    // Tokens other than ')' and ']' (the latter for index signatures) are here for better error recovery\n                    return token() === 19 /* CloseParenToken */ || token() === 21 /* CloseBracketToken */ /*|| token === SyntaxKind.OpenBraceToken*/;\n                case 19 /* TypeArguments */:\n                    // All other tokens should cause the type-argument to terminate except comma token\n                    return token() !== 25 /* CommaToken */;\n                case 21 /* HeritageClauses */:\n                    return token() === 16 /* OpenBraceToken */ || token() === 17 /* CloseBraceToken */;\n                case 13 /* JsxAttributes */:\n                    return token() === 28 /* GreaterThanToken */ || token() === 40 /* SlashToken */;\n                case 14 /* JsxChildren */:\n                    return token() === 26 /* LessThanToken */ && lookAhead(nextTokenIsSlash);\n                case 23 /* JSDocFunctionParameters */:\n                    return token() === 19 /* CloseParenToken */ || token() === 55 /* ColonToken */ || token() === 17 /* CloseBraceToken */;\n                case 24 /* JSDocTypeArguments */:\n                    return token() === 28 /* GreaterThanToken */ || token() === 17 /* CloseBraceToken */;\n                case 26 /* JSDocTupleTypes */:\n                    return token() === 21 /* CloseBracketToken */ || token() === 17 /* CloseBraceToken */;\n                case 25 /* JSDocRecordMembers */:\n                    return token() === 17 /* CloseBraceToken */;\n            }\n        }\n        function isVariableDeclaratorListTerminator() {\n            // If we can consume a semicolon (either explicitly, or with ASI), then consider us done\n            // with parsing the list of  variable declarators.\n            if (canParseSemicolon()) {\n                return true;\n            }\n            // in the case where we're parsing the variable declarator of a 'for-in' statement, we\n            // are done if we see an 'in' keyword in front of us. Same with for-of\n            if (isInOrOfKeyword(token())) {\n                return true;\n            }\n            // ERROR RECOVERY TWEAK:\n            // For better error recovery, if we see an '=>' then we just stop immediately.  We've got an\n            // arrow function here and it's going to be very unlikely that we'll resynchronize and get\n            // another variable declaration.\n            if (token() === 35 /* EqualsGreaterThanToken */) {\n                return true;\n            }\n            // Keep trying to parse out variable declarators.\n            return false;\n        }\n        // True if positioned at element or terminator of the current list or any enclosing list\n        function isInSomeParsingContext() {\n            for (var kind = 0; kind < 27 /* Count */; kind++) {\n                if (parsingContext & (1 << kind)) {\n                    if (isListElement(kind, /*inErrorRecovery*/ true) || isListTerminator(kind)) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        // Parses a list of elements\n        function parseList(kind, parseElement) {\n            var saveParsingContext = parsingContext;\n            parsingContext |= 1 << kind;\n            var result = createNodeArray();\n            while (!isListTerminator(kind)) {\n                if (isListElement(kind, /*inErrorRecovery*/ false)) {\n                    var element = parseListElement(kind, parseElement);\n                    result.push(element);\n                    continue;\n                }\n                if (abortParsingListOrMoveToNextToken(kind)) {\n                    break;\n                }\n            }\n            result.end = getNodeEnd();\n            parsingContext = saveParsingContext;\n            return result;\n        }\n        function parseListElement(parsingContext, parseElement) {\n            var node = currentNode(parsingContext);\n            if (node) {\n                return consumeNode(node);\n            }\n            return parseElement();\n        }\n        function currentNode(parsingContext) {\n            // If there is an outstanding parse error that we've encountered, but not attached to\n            // some node, then we cannot get a node from the old source tree.  This is because we\n            // want to mark the next node we encounter as being unusable.\n            //\n            // Note: This may be too conservative.  Perhaps we could reuse the node and set the bit\n            // on it (or its leftmost child) as having the error.  For now though, being conservative\n            // is nice and likely won't ever affect perf.\n            if (parseErrorBeforeNextFinishedNode) {\n                return undefined;\n            }\n            if (!syntaxCursor) {\n                // if we don't have a cursor, we could never return a node from the old tree.\n                return undefined;\n            }\n            var node = syntaxCursor.currentNode(scanner.getStartPos());\n            // Can't reuse a missing node.\n            if (ts.nodeIsMissing(node)) {\n                return undefined;\n            }\n            // Can't reuse a node that intersected the change range.\n            if (node.intersectsChange) {\n                return undefined;\n            }\n            // Can't reuse a node that contains a parse error.  This is necessary so that we\n            // produce the same set of errors again.\n            if (ts.containsParseError(node)) {\n                return undefined;\n            }\n            // We can only reuse a node if it was parsed under the same strict mode that we're\n            // currently in.  i.e. if we originally parsed a node in non-strict mode, but then\n            // the user added 'using strict' at the top of the file, then we can't use that node\n            // again as the presence of strict mode may cause us to parse the tokens in the file\n            // differently.\n            //\n            // Note: we *can* reuse tokens when the strict mode changes.  That's because tokens\n            // are unaffected by strict mode.  It's just the parser will decide what to do with it\n            // differently depending on what mode it is in.\n            //\n            // This also applies to all our other context flags as well.\n            var nodeContextFlags = node.flags & 96256 /* ContextFlags */;\n            if (nodeContextFlags !== contextFlags) {\n                return undefined;\n            }\n            // Ok, we have a node that looks like it could be reused.  Now verify that it is valid\n            // in the current list parsing context that we're currently at.\n            if (!canReuseNode(node, parsingContext)) {\n                return undefined;\n            }\n            return node;\n        }\n        function consumeNode(node) {\n            // Move the scanner so it is after the node we just consumed.\n            scanner.setTextPos(node.end);\n            nextToken();\n            return node;\n        }\n        function canReuseNode(node, parsingContext) {\n            switch (parsingContext) {\n                case 5 /* ClassMembers */:\n                    return isReusableClassMember(node);\n                case 2 /* SwitchClauses */:\n                    return isReusableSwitchClause(node);\n                case 0 /* SourceElements */:\n                case 1 /* BlockStatements */:\n                case 3 /* SwitchClauseStatements */:\n                    return isReusableStatement(node);\n                case 6 /* EnumMembers */:\n                    return isReusableEnumMember(node);\n                case 4 /* TypeMembers */:\n                    return isReusableTypeMember(node);\n                case 8 /* VariableDeclarations */:\n                    return isReusableVariableDeclaration(node);\n                case 16 /* Parameters */:\n                    return isReusableParameter(node);\n                case 17 /* RestProperties */:\n                    return false;\n                // Any other lists we do not care about reusing nodes in.  But feel free to add if\n                // you can do so safely.  Danger areas involve nodes that may involve speculative\n                // parsing.  If speculative parsing is involved with the node, then the range the\n                // parser reached while looking ahead might be in the edited range (see the example\n                // in canReuseVariableDeclaratorNode for a good case of this).\n                case 21 /* HeritageClauses */:\n                // This would probably be safe to reuse.  There is no speculative parsing with\n                // heritage clauses.\n                case 18 /* TypeParameters */:\n                // This would probably be safe to reuse.  There is no speculative parsing with\n                // type parameters.  Note that that's because type *parameters* only occur in\n                // unambiguous *type* contexts.  While type *arguments* occur in very ambiguous\n                // *expression* contexts.\n                case 20 /* TupleElementTypes */:\n                // This would probably be safe to reuse.  There is no speculative parsing with\n                // tuple types.\n                // Technically, type argument list types are probably safe to reuse.  While\n                // speculative parsing is involved with them (since type argument lists are only\n                // produced from speculative parsing a < as a type argument list), we only have\n                // the types because speculative parsing succeeded.  Thus, the lookahead never\n                // went past the end of the list and rewound.\n                case 19 /* TypeArguments */:\n                // Note: these are almost certainly not safe to ever reuse.  Expressions commonly\n                // need a large amount of lookahead, and we should not reuse them as they may\n                // have actually intersected the edit.\n                case 11 /* ArgumentExpressions */:\n                // This is not safe to reuse for the same reason as the 'AssignmentExpression'\n                // cases.  i.e. a property assignment may end with an expression, and thus might\n                // have lookahead far beyond it's old node.\n                case 12 /* ObjectLiteralMembers */:\n                // This is probably not safe to reuse.  There can be speculative parsing with\n                // type names in a heritage clause.  There can be generic names in the type\n                // name list, and there can be left hand side expressions (which can have type\n                // arguments.)\n                case 7 /* HeritageClauseElement */:\n                // Perhaps safe to reuse, but it's unlikely we'd see more than a dozen attributes\n                // on any given element. Same for children.\n                case 13 /* JsxAttributes */:\n                case 14 /* JsxChildren */:\n            }\n            return false;\n        }\n        function isReusableClassMember(node) {\n            if (node) {\n                switch (node.kind) {\n                    case 150 /* Constructor */:\n                    case 155 /* IndexSignature */:\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                    case 147 /* PropertyDeclaration */:\n                    case 203 /* SemicolonClassElement */:\n                        return true;\n                    case 149 /* MethodDeclaration */:\n                        // Method declarations are not necessarily reusable.  An object-literal\n                        // may have a method calls \"constructor(...)\" and we must reparse that\n                        // into an actual .ConstructorDeclaration.\n                        var methodDeclaration = node;\n                        var nameIsConstructor = methodDeclaration.name.kind === 70 /* Identifier */ &&\n                            methodDeclaration.name.originalKeywordKind === 122 /* ConstructorKeyword */;\n                        return !nameIsConstructor;\n                }\n            }\n            return false;\n        }\n        function isReusableSwitchClause(node) {\n            if (node) {\n                switch (node.kind) {\n                    case 253 /* CaseClause */:\n                    case 254 /* DefaultClause */:\n                        return true;\n                }\n            }\n            return false;\n        }\n        function isReusableStatement(node) {\n            if (node) {\n                switch (node.kind) {\n                    case 225 /* FunctionDeclaration */:\n                    case 205 /* VariableStatement */:\n                    case 204 /* Block */:\n                    case 208 /* IfStatement */:\n                    case 207 /* ExpressionStatement */:\n                    case 220 /* ThrowStatement */:\n                    case 216 /* ReturnStatement */:\n                    case 218 /* SwitchStatement */:\n                    case 215 /* BreakStatement */:\n                    case 214 /* ContinueStatement */:\n                    case 212 /* ForInStatement */:\n                    case 213 /* ForOfStatement */:\n                    case 211 /* ForStatement */:\n                    case 210 /* WhileStatement */:\n                    case 217 /* WithStatement */:\n                    case 206 /* EmptyStatement */:\n                    case 221 /* TryStatement */:\n                    case 219 /* LabeledStatement */:\n                    case 209 /* DoStatement */:\n                    case 222 /* DebuggerStatement */:\n                    case 235 /* ImportDeclaration */:\n                    case 234 /* ImportEqualsDeclaration */:\n                    case 241 /* ExportDeclaration */:\n                    case 240 /* ExportAssignment */:\n                    case 230 /* ModuleDeclaration */:\n                    case 226 /* ClassDeclaration */:\n                    case 227 /* InterfaceDeclaration */:\n                    case 229 /* EnumDeclaration */:\n                    case 228 /* TypeAliasDeclaration */:\n                        return true;\n                }\n            }\n            return false;\n        }\n        function isReusableEnumMember(node) {\n            return node.kind === 260 /* EnumMember */;\n        }\n        function isReusableTypeMember(node) {\n            if (node) {\n                switch (node.kind) {\n                    case 154 /* ConstructSignature */:\n                    case 148 /* MethodSignature */:\n                    case 155 /* IndexSignature */:\n                    case 146 /* PropertySignature */:\n                    case 153 /* CallSignature */:\n                        return true;\n                }\n            }\n            return false;\n        }\n        function isReusableVariableDeclaration(node) {\n            if (node.kind !== 223 /* VariableDeclaration */) {\n                return false;\n            }\n            // Very subtle incremental parsing bug.  Consider the following code:\n            //\n            //      let v = new List < A, B\n            //\n            // This is actually legal code.  It's a list of variable declarators \"v = new List<A\"\n            // on one side and \"B\" on the other. If you then change that to:\n            //\n            //      let v = new List < A, B >()\n            //\n            // then we have a problem.  \"v = new List<A\" doesn't intersect the change range, so we\n            // start reparsing at \"B\" and we completely fail to handle this properly.\n            //\n            // In order to prevent this, we do not allow a variable declarator to be reused if it\n            // has an initializer.\n            var variableDeclarator = node;\n            return variableDeclarator.initializer === undefined;\n        }\n        function isReusableParameter(node) {\n            if (node.kind !== 144 /* Parameter */) {\n                return false;\n            }\n            // See the comment in isReusableVariableDeclaration for why we do this.\n            var parameter = node;\n            return parameter.initializer === undefined;\n        }\n        // Returns true if we should abort parsing.\n        function abortParsingListOrMoveToNextToken(kind) {\n            parseErrorAtCurrentToken(parsingContextErrors(kind));\n            if (isInSomeParsingContext()) {\n                return true;\n            }\n            nextToken();\n            return false;\n        }\n        function parsingContextErrors(context) {\n            switch (context) {\n                case 0 /* SourceElements */: return ts.Diagnostics.Declaration_or_statement_expected;\n                case 1 /* BlockStatements */: return ts.Diagnostics.Declaration_or_statement_expected;\n                case 2 /* SwitchClauses */: return ts.Diagnostics.case_or_default_expected;\n                case 3 /* SwitchClauseStatements */: return ts.Diagnostics.Statement_expected;\n                case 17 /* RestProperties */: // fallthrough\n                case 4 /* TypeMembers */: return ts.Diagnostics.Property_or_signature_expected;\n                case 5 /* ClassMembers */: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected;\n                case 6 /* EnumMembers */: return ts.Diagnostics.Enum_member_expected;\n                case 7 /* HeritageClauseElement */: return ts.Diagnostics.Expression_expected;\n                case 8 /* VariableDeclarations */: return ts.Diagnostics.Variable_declaration_expected;\n                case 9 /* ObjectBindingElements */: return ts.Diagnostics.Property_destructuring_pattern_expected;\n                case 10 /* ArrayBindingElements */: return ts.Diagnostics.Array_element_destructuring_pattern_expected;\n                case 11 /* ArgumentExpressions */: return ts.Diagnostics.Argument_expression_expected;\n                case 12 /* ObjectLiteralMembers */: return ts.Diagnostics.Property_assignment_expected;\n                case 15 /* ArrayLiteralMembers */: return ts.Diagnostics.Expression_or_comma_expected;\n                case 16 /* Parameters */: return ts.Diagnostics.Parameter_declaration_expected;\n                case 18 /* TypeParameters */: return ts.Diagnostics.Type_parameter_declaration_expected;\n                case 19 /* TypeArguments */: return ts.Diagnostics.Type_argument_expected;\n                case 20 /* TupleElementTypes */: return ts.Diagnostics.Type_expected;\n                case 21 /* HeritageClauses */: return ts.Diagnostics.Unexpected_token_expected;\n                case 22 /* ImportOrExportSpecifiers */: return ts.Diagnostics.Identifier_expected;\n                case 13 /* JsxAttributes */: return ts.Diagnostics.Identifier_expected;\n                case 14 /* JsxChildren */: return ts.Diagnostics.Identifier_expected;\n                case 23 /* JSDocFunctionParameters */: return ts.Diagnostics.Parameter_declaration_expected;\n                case 24 /* JSDocTypeArguments */: return ts.Diagnostics.Type_argument_expected;\n                case 26 /* JSDocTupleTypes */: return ts.Diagnostics.Type_expected;\n                case 25 /* JSDocRecordMembers */: return ts.Diagnostics.Property_assignment_expected;\n            }\n        }\n        ;\n        // Parses a comma-delimited list of elements\n        function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) {\n            var saveParsingContext = parsingContext;\n            parsingContext |= 1 << kind;\n            var result = createNodeArray();\n            var commaStart = -1; // Meaning the previous token was not a comma\n            while (true) {\n                if (isListElement(kind, /*inErrorRecovery*/ false)) {\n                    result.push(parseListElement(kind, parseElement));\n                    commaStart = scanner.getTokenPos();\n                    if (parseOptional(25 /* CommaToken */)) {\n                        continue;\n                    }\n                    commaStart = -1; // Back to the state where the last token was not a comma\n                    if (isListTerminator(kind)) {\n                        break;\n                    }\n                    // We didn't get a comma, and the list wasn't terminated, explicitly parse\n                    // out a comma so we give a good error message.\n                    parseExpected(25 /* CommaToken */);\n                    // If the token was a semicolon, and the caller allows that, then skip it and\n                    // continue.  This ensures we get back on track and don't result in tons of\n                    // parse errors.  For example, this can happen when people do things like use\n                    // a semicolon to delimit object literal members.   Note: we'll have already\n                    // reported an error when we called parseExpected above.\n                    if (considerSemicolonAsDelimiter && token() === 24 /* SemicolonToken */ && !scanner.hasPrecedingLineBreak()) {\n                        nextToken();\n                    }\n                    continue;\n                }\n                if (isListTerminator(kind)) {\n                    break;\n                }\n                if (abortParsingListOrMoveToNextToken(kind)) {\n                    break;\n                }\n            }\n            // Recording the trailing comma is deliberately done after the previous\n            // loop, and not just if we see a list terminator. This is because the list\n            // may have ended incorrectly, but it is still important to know if there\n            // was a trailing comma.\n            // Check if the last token was a comma.\n            if (commaStart >= 0) {\n                // Always preserve a trailing comma by marking it on the NodeArray\n                result.hasTrailingComma = true;\n            }\n            result.end = getNodeEnd();\n            parsingContext = saveParsingContext;\n            return result;\n        }\n        function createMissingList() {\n            return createNodeArray();\n        }\n        function parseBracketedList(kind, parseElement, open, close) {\n            if (parseExpected(open)) {\n                var result = parseDelimitedList(kind, parseElement);\n                parseExpected(close);\n                return result;\n            }\n            return createMissingList();\n        }\n        // The allowReservedWords parameter controls whether reserved words are permitted after the first dot\n        function parseEntityName(allowReservedWords, diagnosticMessage) {\n            var entity = parseIdentifier(diagnosticMessage);\n            while (parseOptional(22 /* DotToken */)) {\n                var node = createNode(141 /* QualifiedName */, entity.pos); // !!!\n                node.left = entity;\n                node.right = parseRightSideOfDot(allowReservedWords);\n                entity = finishNode(node);\n            }\n            return entity;\n        }\n        function parseRightSideOfDot(allowIdentifierNames) {\n            // Technically a keyword is valid here as all identifiers and keywords are identifier names.\n            // However, often we'll encounter this in error situations when the identifier or keyword\n            // is actually starting another valid construct.\n            //\n            // So, we check for the following specific case:\n            //\n            //      name.\n            //      identifierOrKeyword identifierNameOrKeyword\n            //\n            // Note: the newlines are important here.  For example, if that above code\n            // were rewritten into:\n            //\n            //      name.identifierOrKeyword\n            //      identifierNameOrKeyword\n            //\n            // Then we would consider it valid.  That's because ASI would take effect and\n            // the code would be implicitly: \"name.identifierOrKeyword; identifierNameOrKeyword\".\n            // In the first case though, ASI will not take effect because there is not a\n            // line terminator after the identifier or keyword.\n            if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token())) {\n                var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);\n                if (matchesPattern) {\n                    // Report that we need an identifier.  However, report it right after the dot,\n                    // and not on the next token.  This is because the next token might actually\n                    // be an identifier and the error would be quite confusing.\n                    return createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected);\n                }\n            }\n            return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();\n        }\n        function parseTemplateExpression() {\n            var template = createNode(194 /* TemplateExpression */);\n            template.head = parseTemplateHead();\n            ts.Debug.assert(template.head.kind === 13 /* TemplateHead */, \"Template head has wrong token kind\");\n            var templateSpans = createNodeArray();\n            do {\n                templateSpans.push(parseTemplateSpan());\n            } while (ts.lastOrUndefined(templateSpans).literal.kind === 14 /* TemplateMiddle */);\n            templateSpans.end = getNodeEnd();\n            template.templateSpans = templateSpans;\n            return finishNode(template);\n        }\n        function parseTemplateSpan() {\n            var span = createNode(202 /* TemplateSpan */);\n            span.expression = allowInAnd(parseExpression);\n            var literal;\n            if (token() === 17 /* CloseBraceToken */) {\n                reScanTemplateToken();\n                literal = parseTemplateMiddleOrTemplateTail();\n            }\n            else {\n                literal = parseExpectedToken(15 /* TemplateTail */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(17 /* CloseBraceToken */));\n            }\n            span.literal = literal;\n            return finishNode(span);\n        }\n        function parseLiteralNode(internName) {\n            return parseLiteralLikeNode(token(), internName);\n        }\n        function parseTemplateHead() {\n            var fragment = parseLiteralLikeNode(token(), /*internName*/ false);\n            ts.Debug.assert(fragment.kind === 13 /* TemplateHead */, \"Template head has wrong token kind\");\n            return fragment;\n        }\n        function parseTemplateMiddleOrTemplateTail() {\n            var fragment = parseLiteralLikeNode(token(), /*internName*/ false);\n            ts.Debug.assert(fragment.kind === 14 /* TemplateMiddle */ || fragment.kind === 15 /* TemplateTail */, \"Template fragment has wrong token kind\");\n            return fragment;\n        }\n        function parseLiteralLikeNode(kind, internName) {\n            var node = createNode(kind);\n            var text = scanner.getTokenValue();\n            node.text = internName ? internIdentifier(text) : text;\n            if (scanner.hasExtendedUnicodeEscape()) {\n                node.hasExtendedUnicodeEscape = true;\n            }\n            if (scanner.isUnterminated()) {\n                node.isUnterminated = true;\n            }\n            var tokenPos = scanner.getTokenPos();\n            nextToken();\n            finishNode(node);\n            // Octal literals are not allowed in strict mode or ES5\n            // Note that theoretically the following condition would hold true literals like 009,\n            // which is not octal.But because of how the scanner separates the tokens, we would\n            // never get a token like this. Instead, we would get 00 and 9 as two separate tokens.\n            // We also do not need to check for negatives because any prefix operator would be part of a\n            // parent unary expression.\n            if (node.kind === 8 /* NumericLiteral */\n                && sourceText.charCodeAt(tokenPos) === 48 /* _0 */\n                && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) {\n                node.isOctalLiteral = true;\n            }\n            return node;\n        }\n        // TYPES\n        function parseTypeReference() {\n            var typeName = parseEntityName(/*allowReservedWords*/ false, ts.Diagnostics.Type_expected);\n            var node = createNode(157 /* TypeReference */, typeName.pos);\n            node.typeName = typeName;\n            if (!scanner.hasPrecedingLineBreak() && token() === 26 /* LessThanToken */) {\n                node.typeArguments = parseBracketedList(19 /* TypeArguments */, parseType, 26 /* LessThanToken */, 28 /* GreaterThanToken */);\n            }\n            return finishNode(node);\n        }\n        function parseThisTypePredicate(lhs) {\n            nextToken();\n            var node = createNode(156 /* TypePredicate */, lhs.pos);\n            node.parameterName = lhs;\n            node.type = parseType();\n            return finishNode(node);\n        }\n        function parseThisTypeNode() {\n            var node = createNode(167 /* ThisType */);\n            nextToken();\n            return finishNode(node);\n        }\n        function parseTypeQuery() {\n            var node = createNode(160 /* TypeQuery */);\n            parseExpected(102 /* TypeOfKeyword */);\n            node.exprName = parseEntityName(/*allowReservedWords*/ true);\n            return finishNode(node);\n        }\n        function parseTypeParameter() {\n            var node = createNode(143 /* TypeParameter */);\n            node.name = parseIdentifier();\n            if (parseOptional(84 /* ExtendsKeyword */)) {\n                // It's not uncommon for people to write improper constraints to a generic.  If the\n                // user writes a constraint that is an expression and not an actual type, then parse\n                // it out as an expression (so we can recover well), but report that a type is needed\n                // instead.\n                if (isStartOfType() || !isStartOfExpression()) {\n                    node.constraint = parseType();\n                }\n                else {\n                    // It was not a type, and it looked like an expression.  Parse out an expression\n                    // here so we recover well.  Note: it is important that we call parseUnaryExpression\n                    // and not parseExpression here.  If the user has:\n                    //\n                    //      <T extends \"\">\n                    //\n                    // We do *not* want to consume the  >  as we're consuming the expression for \"\".\n                    node.expression = parseUnaryExpressionOrHigher();\n                }\n            }\n            return finishNode(node);\n        }\n        function parseTypeParameters() {\n            if (token() === 26 /* LessThanToken */) {\n                return parseBracketedList(18 /* TypeParameters */, parseTypeParameter, 26 /* LessThanToken */, 28 /* GreaterThanToken */);\n            }\n        }\n        function parseParameterType() {\n            if (parseOptional(55 /* ColonToken */)) {\n                return parseType();\n            }\n            return undefined;\n        }\n        function isStartOfParameter() {\n            return token() === 23 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 56 /* AtToken */ || token() === 98 /* ThisKeyword */;\n        }\n        function parseParameter() {\n            var node = createNode(144 /* Parameter */);\n            if (token() === 98 /* ThisKeyword */) {\n                node.name = createIdentifier(/*isIdentifier*/ true, undefined);\n                node.type = parseParameterType();\n                return finishNode(node);\n            }\n            node.decorators = parseDecorators();\n            node.modifiers = parseModifiers();\n            node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */);\n            // FormalParameter [Yield,Await]:\n            //      BindingElement[?Yield,?Await]\n            node.name = parseIdentifierOrPattern();\n            if (ts.getFullWidth(node.name) === 0 && !ts.hasModifiers(node) && ts.isModifierKind(token())) {\n                // in cases like\n                // 'use strict'\n                // function foo(static)\n                // isParameter('static') === true, because of isModifier('static')\n                // however 'static' is not a legal identifier in a strict mode.\n                // so result of this function will be ParameterDeclaration (flags = 0, name = missing, type = undefined, initializer = undefined)\n                // and current token will not change => parsing of the enclosing parameter list will last till the end of time (or OOM)\n                // to avoid this we'll advance cursor to the next token.\n                nextToken();\n            }\n            node.questionToken = parseOptionalToken(54 /* QuestionToken */);\n            node.type = parseParameterType();\n            node.initializer = parseBindingElementInitializer(/*inParameter*/ true);\n            // Do not check for initializers in an ambient context for parameters. This is not\n            // a grammar error because the grammar allows arbitrary call signatures in\n            // an ambient context.\n            // It is actually not necessary for this to be an error at all. The reason is that\n            // function/constructor implementations are syntactically disallowed in ambient\n            // contexts. In addition, parameter initializers are semantically disallowed in\n            // overload signatures. So parameter initializers are transitively disallowed in\n            // ambient contexts.\n            return addJSDocComment(finishNode(node));\n        }\n        function parseBindingElementInitializer(inParameter) {\n            return inParameter ? parseParameterInitializer() : parseNonParameterInitializer();\n        }\n        function parseParameterInitializer() {\n            return parseInitializer(/*inParameter*/ true);\n        }\n        function fillSignature(returnToken, yieldContext, awaitContext, requireCompleteParameterList, signature) {\n            var returnTokenRequired = returnToken === 35 /* EqualsGreaterThanToken */;\n            signature.typeParameters = parseTypeParameters();\n            signature.parameters = parseParameterList(yieldContext, awaitContext, requireCompleteParameterList);\n            if (returnTokenRequired) {\n                parseExpected(returnToken);\n                signature.type = parseTypeOrTypePredicate();\n            }\n            else if (parseOptional(returnToken)) {\n                signature.type = parseTypeOrTypePredicate();\n            }\n        }\n        function parseParameterList(yieldContext, awaitContext, requireCompleteParameterList) {\n            // FormalParameters [Yield,Await]: (modified)\n            //      [empty]\n            //      FormalParameterList[?Yield,Await]\n            //\n            // FormalParameter[Yield,Await]: (modified)\n            //      BindingElement[?Yield,Await]\n            //\n            // BindingElement [Yield,Await]: (modified)\n            //      SingleNameBinding[?Yield,?Await]\n            //      BindingPattern[?Yield,?Await]Initializer [In, ?Yield,?Await] opt\n            //\n            // SingleNameBinding [Yield,Await]:\n            //      BindingIdentifier[?Yield,?Await]Initializer [In, ?Yield,?Await] opt\n            if (parseExpected(18 /* OpenParenToken */)) {\n                var savedYieldContext = inYieldContext();\n                var savedAwaitContext = inAwaitContext();\n                setYieldContext(yieldContext);\n                setAwaitContext(awaitContext);\n                var result = parseDelimitedList(16 /* Parameters */, parseParameter);\n                setYieldContext(savedYieldContext);\n                setAwaitContext(savedAwaitContext);\n                if (!parseExpected(19 /* CloseParenToken */) && requireCompleteParameterList) {\n                    // Caller insisted that we had to end with a )   We didn't.  So just return\n                    // undefined here.\n                    return undefined;\n                }\n                return result;\n            }\n            // We didn't even have an open paren.  If the caller requires a complete parameter list,\n            // we definitely can't provide that.  However, if they're ok with an incomplete one,\n            // then just return an empty set of parameters.\n            return requireCompleteParameterList ? undefined : createMissingList();\n        }\n        function parseTypeMemberSemicolon() {\n            // We allow type members to be separated by commas or (possibly ASI) semicolons.\n            // First check if it was a comma.  If so, we're done with the member.\n            if (parseOptional(25 /* CommaToken */)) {\n                return;\n            }\n            // Didn't have a comma.  We must have a (possible ASI) semicolon.\n            parseSemicolon();\n        }\n        function parseSignatureMember(kind) {\n            var node = createNode(kind);\n            if (kind === 154 /* ConstructSignature */) {\n                parseExpected(93 /* NewKeyword */);\n            }\n            fillSignature(55 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node);\n            parseTypeMemberSemicolon();\n            return addJSDocComment(finishNode(node));\n        }\n        function isIndexSignature() {\n            if (token() !== 20 /* OpenBracketToken */) {\n                return false;\n            }\n            return lookAhead(isUnambiguouslyIndexSignature);\n        }\n        function isUnambiguouslyIndexSignature() {\n            // The only allowed sequence is:\n            //\n            //   [id:\n            //\n            // However, for error recovery, we also check the following cases:\n            //\n            //   [...\n            //   [id,\n            //   [id?,\n            //   [id?:\n            //   [id?]\n            //   [public id\n            //   [private id\n            //   [protected id\n            //   []\n            //\n            nextToken();\n            if (token() === 23 /* DotDotDotToken */ || token() === 21 /* CloseBracketToken */) {\n                return true;\n            }\n            if (ts.isModifierKind(token())) {\n                nextToken();\n                if (isIdentifier()) {\n                    return true;\n                }\n            }\n            else if (!isIdentifier()) {\n                return false;\n            }\n            else {\n                // Skip the identifier\n                nextToken();\n            }\n            // A colon signifies a well formed indexer\n            // A comma should be a badly formed indexer because comma expressions are not allowed\n            // in computed properties.\n            if (token() === 55 /* ColonToken */ || token() === 25 /* CommaToken */) {\n                return true;\n            }\n            // Question mark could be an indexer with an optional property,\n            // or it could be a conditional expression in a computed property.\n            if (token() !== 54 /* QuestionToken */) {\n                return false;\n            }\n            // If any of the following tokens are after the question mark, it cannot\n            // be a conditional expression, so treat it as an indexer.\n            nextToken();\n            return token() === 55 /* ColonToken */ || token() === 25 /* CommaToken */ || token() === 21 /* CloseBracketToken */;\n        }\n        function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(155 /* IndexSignature */, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 20 /* OpenBracketToken */, 21 /* CloseBracketToken */);\n            node.type = parseTypeAnnotation();\n            parseTypeMemberSemicolon();\n            return finishNode(node);\n        }\n        function parsePropertyOrMethodSignature(fullStart, modifiers) {\n            var name = parsePropertyName();\n            var questionToken = parseOptionalToken(54 /* QuestionToken */);\n            if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) {\n                var method = createNode(148 /* MethodSignature */, fullStart);\n                method.modifiers = modifiers;\n                method.name = name;\n                method.questionToken = questionToken;\n                // Method signatures don't exist in expression contexts.  So they have neither\n                // [Yield] nor [Await]\n                fillSignature(55 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, method);\n                parseTypeMemberSemicolon();\n                return addJSDocComment(finishNode(method));\n            }\n            else {\n                var property = createNode(146 /* PropertySignature */, fullStart);\n                property.modifiers = modifiers;\n                property.name = name;\n                property.questionToken = questionToken;\n                property.type = parseTypeAnnotation();\n                if (token() === 57 /* EqualsToken */) {\n                    // Although type literal properties cannot not have initializers, we attempt\n                    // to parse an initializer so we can report in the checker that an interface\n                    // property or type literal property cannot have an initializer.\n                    property.initializer = parseNonParameterInitializer();\n                }\n                parseTypeMemberSemicolon();\n                return addJSDocComment(finishNode(property));\n            }\n        }\n        function isTypeMemberStart() {\n            var idToken;\n            // Return true if we have the start of a signature member\n            if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) {\n                return true;\n            }\n            // Eat up all modifiers, but hold on to the last one in case it is actually an identifier\n            while (ts.isModifierKind(token())) {\n                idToken = token();\n                nextToken();\n            }\n            // Index signatures and computed property names are type members\n            if (token() === 20 /* OpenBracketToken */) {\n                return true;\n            }\n            // Try to get the first property-like token following all modifiers\n            if (isLiteralPropertyName()) {\n                idToken = token();\n                nextToken();\n            }\n            // If we were able to get any potential identifier, check that it is\n            // the start of a member declaration\n            if (idToken) {\n                return token() === 18 /* OpenParenToken */ ||\n                    token() === 26 /* LessThanToken */ ||\n                    token() === 54 /* QuestionToken */ ||\n                    token() === 55 /* ColonToken */ ||\n                    token() === 25 /* CommaToken */ ||\n                    canParseSemicolon();\n            }\n            return false;\n        }\n        function parseTypeMember() {\n            if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) {\n                return parseSignatureMember(153 /* CallSignature */);\n            }\n            if (token() === 93 /* NewKeyword */ && lookAhead(isStartOfConstructSignature)) {\n                return parseSignatureMember(154 /* ConstructSignature */);\n            }\n            var fullStart = getNodePos();\n            var modifiers = parseModifiers();\n            if (isIndexSignature()) {\n                return parseIndexSignatureDeclaration(fullStart, /*decorators*/ undefined, modifiers);\n            }\n            return parsePropertyOrMethodSignature(fullStart, modifiers);\n        }\n        function isStartOfConstructSignature() {\n            nextToken();\n            return token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */;\n        }\n        function parseTypeLiteral() {\n            var node = createNode(161 /* TypeLiteral */);\n            node.members = parseObjectTypeMembers();\n            return finishNode(node);\n        }\n        function parseObjectTypeMembers() {\n            var members;\n            if (parseExpected(16 /* OpenBraceToken */)) {\n                members = parseList(4 /* TypeMembers */, parseTypeMember);\n                parseExpected(17 /* CloseBraceToken */);\n            }\n            else {\n                members = createMissingList();\n            }\n            return members;\n        }\n        function isStartOfMappedType() {\n            nextToken();\n            if (token() === 130 /* ReadonlyKeyword */) {\n                nextToken();\n            }\n            return token() === 20 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 91 /* InKeyword */;\n        }\n        function parseMappedTypeParameter() {\n            var node = createNode(143 /* TypeParameter */);\n            node.name = parseIdentifier();\n            parseExpected(91 /* InKeyword */);\n            node.constraint = parseType();\n            return finishNode(node);\n        }\n        function parseMappedType() {\n            var node = createNode(170 /* MappedType */);\n            parseExpected(16 /* OpenBraceToken */);\n            node.readonlyToken = parseOptionalToken(130 /* ReadonlyKeyword */);\n            parseExpected(20 /* OpenBracketToken */);\n            node.typeParameter = parseMappedTypeParameter();\n            parseExpected(21 /* CloseBracketToken */);\n            node.questionToken = parseOptionalToken(54 /* QuestionToken */);\n            node.type = parseTypeAnnotation();\n            parseSemicolon();\n            parseExpected(17 /* CloseBraceToken */);\n            return finishNode(node);\n        }\n        function parseTupleType() {\n            var node = createNode(163 /* TupleType */);\n            node.elementTypes = parseBracketedList(20 /* TupleElementTypes */, parseType, 20 /* OpenBracketToken */, 21 /* CloseBracketToken */);\n            return finishNode(node);\n        }\n        function parseParenthesizedType() {\n            var node = createNode(166 /* ParenthesizedType */);\n            parseExpected(18 /* OpenParenToken */);\n            node.type = parseType();\n            parseExpected(19 /* CloseParenToken */);\n            return finishNode(node);\n        }\n        function parseFunctionOrConstructorType(kind) {\n            var node = createNode(kind);\n            if (kind === 159 /* ConstructorType */) {\n                parseExpected(93 /* NewKeyword */);\n            }\n            fillSignature(35 /* EqualsGreaterThanToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node);\n            return finishNode(node);\n        }\n        function parseKeywordAndNoDot() {\n            var node = parseTokenNode();\n            return token() === 22 /* DotToken */ ? undefined : node;\n        }\n        function parseLiteralTypeNode() {\n            var node = createNode(171 /* LiteralType */);\n            node.literal = parseSimpleUnaryExpression();\n            finishNode(node);\n            return node;\n        }\n        function nextTokenIsNumericLiteral() {\n            return nextToken() === 8 /* NumericLiteral */;\n        }\n        function parseNonArrayType() {\n            switch (token()) {\n                case 118 /* AnyKeyword */:\n                case 134 /* StringKeyword */:\n                case 132 /* NumberKeyword */:\n                case 121 /* BooleanKeyword */:\n                case 135 /* SymbolKeyword */:\n                case 137 /* UndefinedKeyword */:\n                case 129 /* NeverKeyword */:\n                    // If these are followed by a dot, then parse these out as a dotted type reference instead.\n                    var node = tryParse(parseKeywordAndNoDot);\n                    return node || parseTypeReference();\n                case 9 /* StringLiteral */:\n                case 8 /* NumericLiteral */:\n                case 100 /* TrueKeyword */:\n                case 85 /* FalseKeyword */:\n                    return parseLiteralTypeNode();\n                case 37 /* MinusToken */:\n                    return lookAhead(nextTokenIsNumericLiteral) ? parseLiteralTypeNode() : parseTypeReference();\n                case 104 /* VoidKeyword */:\n                case 94 /* NullKeyword */:\n                    return parseTokenNode();\n                case 98 /* ThisKeyword */: {\n                    var thisKeyword = parseThisTypeNode();\n                    if (token() === 125 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {\n                        return parseThisTypePredicate(thisKeyword);\n                    }\n                    else {\n                        return thisKeyword;\n                    }\n                }\n                case 102 /* TypeOfKeyword */:\n                    return parseTypeQuery();\n                case 16 /* OpenBraceToken */:\n                    return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral();\n                case 20 /* OpenBracketToken */:\n                    return parseTupleType();\n                case 18 /* OpenParenToken */:\n                    return parseParenthesizedType();\n                default:\n                    return parseTypeReference();\n            }\n        }\n        function isStartOfType() {\n            switch (token()) {\n                case 118 /* AnyKeyword */:\n                case 134 /* StringKeyword */:\n                case 132 /* NumberKeyword */:\n                case 121 /* BooleanKeyword */:\n                case 135 /* SymbolKeyword */:\n                case 104 /* VoidKeyword */:\n                case 137 /* UndefinedKeyword */:\n                case 94 /* NullKeyword */:\n                case 98 /* ThisKeyword */:\n                case 102 /* TypeOfKeyword */:\n                case 129 /* NeverKeyword */:\n                case 16 /* OpenBraceToken */:\n                case 20 /* OpenBracketToken */:\n                case 26 /* LessThanToken */:\n                case 48 /* BarToken */:\n                case 47 /* AmpersandToken */:\n                case 93 /* NewKeyword */:\n                case 9 /* StringLiteral */:\n                case 8 /* NumericLiteral */:\n                case 100 /* TrueKeyword */:\n                case 85 /* FalseKeyword */:\n                    return true;\n                case 37 /* MinusToken */:\n                    return lookAhead(nextTokenIsNumericLiteral);\n                case 18 /* OpenParenToken */:\n                    // Only consider '(' the start of a type if followed by ')', '...', an identifier, a modifier,\n                    // or something that starts a type. We don't want to consider things like '(1)' a type.\n                    return lookAhead(isStartOfParenthesizedOrFunctionType);\n                default:\n                    return isIdentifier();\n            }\n        }\n        function isStartOfParenthesizedOrFunctionType() {\n            nextToken();\n            return token() === 19 /* CloseParenToken */ || isStartOfParameter() || isStartOfType();\n        }\n        function parseArrayTypeOrHigher() {\n            var type = parseNonArrayType();\n            while (!scanner.hasPrecedingLineBreak() && parseOptional(20 /* OpenBracketToken */)) {\n                if (isStartOfType()) {\n                    var node = createNode(169 /* IndexedAccessType */, type.pos);\n                    node.objectType = type;\n                    node.indexType = parseType();\n                    parseExpected(21 /* CloseBracketToken */);\n                    type = finishNode(node);\n                }\n                else {\n                    var node = createNode(162 /* ArrayType */, type.pos);\n                    node.elementType = type;\n                    parseExpected(21 /* CloseBracketToken */);\n                    type = finishNode(node);\n                }\n            }\n            return type;\n        }\n        function parseTypeOperator(operator) {\n            var node = createNode(168 /* TypeOperator */);\n            parseExpected(operator);\n            node.operator = operator;\n            node.type = parseTypeOperatorOrHigher();\n            return finishNode(node);\n        }\n        function parseTypeOperatorOrHigher() {\n            switch (token()) {\n                case 126 /* KeyOfKeyword */:\n                    return parseTypeOperator(126 /* KeyOfKeyword */);\n            }\n            return parseArrayTypeOrHigher();\n        }\n        function parseUnionOrIntersectionType(kind, parseConstituentType, operator) {\n            parseOptional(operator);\n            var type = parseConstituentType();\n            if (token() === operator) {\n                var types = createNodeArray([type], type.pos);\n                while (parseOptional(operator)) {\n                    types.push(parseConstituentType());\n                }\n                types.end = getNodeEnd();\n                var node = createNode(kind, type.pos);\n                node.types = types;\n                type = finishNode(node);\n            }\n            return type;\n        }\n        function parseIntersectionTypeOrHigher() {\n            return parseUnionOrIntersectionType(165 /* IntersectionType */, parseTypeOperatorOrHigher, 47 /* AmpersandToken */);\n        }\n        function parseUnionTypeOrHigher() {\n            return parseUnionOrIntersectionType(164 /* UnionType */, parseIntersectionTypeOrHigher, 48 /* BarToken */);\n        }\n        function isStartOfFunctionType() {\n            if (token() === 26 /* LessThanToken */) {\n                return true;\n            }\n            return token() === 18 /* OpenParenToken */ && lookAhead(isUnambiguouslyStartOfFunctionType);\n        }\n        function skipParameterStart() {\n            if (ts.isModifierKind(token())) {\n                // Skip modifiers\n                parseModifiers();\n            }\n            if (isIdentifier() || token() === 98 /* ThisKeyword */) {\n                nextToken();\n                return true;\n            }\n            if (token() === 20 /* OpenBracketToken */ || token() === 16 /* OpenBraceToken */) {\n                // Return true if we can parse an array or object binding pattern with no errors\n                var previousErrorCount = parseDiagnostics.length;\n                parseIdentifierOrPattern();\n                return previousErrorCount === parseDiagnostics.length;\n            }\n            return false;\n        }\n        function isUnambiguouslyStartOfFunctionType() {\n            nextToken();\n            if (token() === 19 /* CloseParenToken */ || token() === 23 /* DotDotDotToken */) {\n                // ( )\n                // ( ...\n                return true;\n            }\n            if (skipParameterStart()) {\n                // We successfully skipped modifiers (if any) and an identifier or binding pattern,\n                // now see if we have something that indicates a parameter declaration\n                if (token() === 55 /* ColonToken */ || token() === 25 /* CommaToken */ ||\n                    token() === 54 /* QuestionToken */ || token() === 57 /* EqualsToken */) {\n                    // ( xxx :\n                    // ( xxx ,\n                    // ( xxx ?\n                    // ( xxx =\n                    return true;\n                }\n                if (token() === 19 /* CloseParenToken */) {\n                    nextToken();\n                    if (token() === 35 /* EqualsGreaterThanToken */) {\n                        // ( xxx ) =>\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function parseTypeOrTypePredicate() {\n            var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix);\n            var type = parseType();\n            if (typePredicateVariable) {\n                var node = createNode(156 /* TypePredicate */, typePredicateVariable.pos);\n                node.parameterName = typePredicateVariable;\n                node.type = type;\n                return finishNode(node);\n            }\n            else {\n                return type;\n            }\n        }\n        function parseTypePredicatePrefix() {\n            var id = parseIdentifier();\n            if (token() === 125 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {\n                nextToken();\n                return id;\n            }\n        }\n        function parseType() {\n            // The rules about 'yield' only apply to actual code/expression contexts.  They don't\n            // apply to 'type' contexts.  So we disable these parameters here before moving on.\n            return doOutsideOfContext(20480 /* TypeExcludesFlags */, parseTypeWorker);\n        }\n        function parseTypeWorker() {\n            if (isStartOfFunctionType()) {\n                return parseFunctionOrConstructorType(158 /* FunctionType */);\n            }\n            if (token() === 93 /* NewKeyword */) {\n                return parseFunctionOrConstructorType(159 /* ConstructorType */);\n            }\n            return parseUnionTypeOrHigher();\n        }\n        function parseTypeAnnotation() {\n            return parseOptional(55 /* ColonToken */) ? parseType() : undefined;\n        }\n        // EXPRESSIONS\n        function isStartOfLeftHandSideExpression() {\n            switch (token()) {\n                case 98 /* ThisKeyword */:\n                case 96 /* SuperKeyword */:\n                case 94 /* NullKeyword */:\n                case 100 /* TrueKeyword */:\n                case 85 /* FalseKeyword */:\n                case 8 /* NumericLiteral */:\n                case 9 /* StringLiteral */:\n                case 12 /* NoSubstitutionTemplateLiteral */:\n                case 13 /* TemplateHead */:\n                case 18 /* OpenParenToken */:\n                case 20 /* OpenBracketToken */:\n                case 16 /* OpenBraceToken */:\n                case 88 /* FunctionKeyword */:\n                case 74 /* ClassKeyword */:\n                case 93 /* NewKeyword */:\n                case 40 /* SlashToken */:\n                case 62 /* SlashEqualsToken */:\n                case 70 /* Identifier */:\n                    return true;\n                default:\n                    return isIdentifier();\n            }\n        }\n        function isStartOfExpression() {\n            if (isStartOfLeftHandSideExpression()) {\n                return true;\n            }\n            switch (token()) {\n                case 36 /* PlusToken */:\n                case 37 /* MinusToken */:\n                case 51 /* TildeToken */:\n                case 50 /* ExclamationToken */:\n                case 79 /* DeleteKeyword */:\n                case 102 /* TypeOfKeyword */:\n                case 104 /* VoidKeyword */:\n                case 42 /* PlusPlusToken */:\n                case 43 /* MinusMinusToken */:\n                case 26 /* LessThanToken */:\n                case 120 /* AwaitKeyword */:\n                case 115 /* YieldKeyword */:\n                    // Yield/await always starts an expression.  Either it is an identifier (in which case\n                    // it is definitely an expression).  Or it's a keyword (either because we're in\n                    // a generator or async function, or in strict mode (or both)) and it started a yield or await expression.\n                    return true;\n                default:\n                    // Error tolerance.  If we see the start of some binary operator, we consider\n                    // that the start of an expression.  That way we'll parse out a missing identifier,\n                    // give a good message about an identifier being missing, and then consume the\n                    // rest of the binary expression.\n                    if (isBinaryOperator()) {\n                        return true;\n                    }\n                    return isIdentifier();\n            }\n        }\n        function isStartOfExpressionStatement() {\n            // As per the grammar, none of '{' or 'function' or 'class' can start an expression statement.\n            return token() !== 16 /* OpenBraceToken */ &&\n                token() !== 88 /* FunctionKeyword */ &&\n                token() !== 74 /* ClassKeyword */ &&\n                token() !== 56 /* AtToken */ &&\n                isStartOfExpression();\n        }\n        function parseExpression() {\n            // Expression[in]:\n            //      AssignmentExpression[in]\n            //      Expression[in] , AssignmentExpression[in]\n            // clear the decorator context when parsing Expression, as it should be unambiguous when parsing a decorator\n            var saveDecoratorContext = inDecoratorContext();\n            if (saveDecoratorContext) {\n                setDecoratorContext(/*val*/ false);\n            }\n            var expr = parseAssignmentExpressionOrHigher();\n            var operatorToken;\n            while ((operatorToken = parseOptionalToken(25 /* CommaToken */))) {\n                expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher());\n            }\n            if (saveDecoratorContext) {\n                setDecoratorContext(/*val*/ true);\n            }\n            return expr;\n        }\n        function parseInitializer(inParameter) {\n            if (token() !== 57 /* EqualsToken */) {\n                // It's not uncommon during typing for the user to miss writing the '=' token.  Check if\n                // there is no newline after the last token and if we're on an expression.  If so, parse\n                // this as an equals-value clause with a missing equals.\n                // NOTE: There are two places where we allow equals-value clauses.  The first is in a\n                // variable declarator.  The second is with a parameter.  For variable declarators\n                // it's more likely that a { would be a allowed (as an object literal).  While this\n                // is also allowed for parameters, the risk is that we consume the { as an object\n                // literal when it really will be for the block following the parameter.\n                if (scanner.hasPrecedingLineBreak() || (inParameter && token() === 16 /* OpenBraceToken */) || !isStartOfExpression()) {\n                    // preceding line break, open brace in a parameter (likely a function body) or current token is not an expression -\n                    // do not try to parse initializer\n                    return undefined;\n                }\n            }\n            // Initializer[In, Yield] :\n            //     = AssignmentExpression[?In, ?Yield]\n            parseExpected(57 /* EqualsToken */);\n            return parseAssignmentExpressionOrHigher();\n        }\n        function parseAssignmentExpressionOrHigher() {\n            //  AssignmentExpression[in,yield]:\n            //      1) ConditionalExpression[?in,?yield]\n            //      2) LeftHandSideExpression = AssignmentExpression[?in,?yield]\n            //      3) LeftHandSideExpression AssignmentOperator AssignmentExpression[?in,?yield]\n            //      4) ArrowFunctionExpression[?in,?yield]\n            //      5) AsyncArrowFunctionExpression[in,yield,await]\n            //      6) [+Yield] YieldExpression[?In]\n            //\n            // Note: for ease of implementation we treat productions '2' and '3' as the same thing.\n            // (i.e. they're both BinaryExpressions with an assignment operator in it).\n            // First, do the simple check if we have a YieldExpression (production '6').\n            if (isYieldExpression()) {\n                return parseYieldExpression();\n            }\n            // Then, check if we have an arrow function (production '4' and '5') that starts with a parenthesized\n            // parameter list or is an async arrow function.\n            // AsyncArrowFunctionExpression:\n            //      1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In]\n            //      2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In]\n            // Production (1) of AsyncArrowFunctionExpression is parsed in \"tryParseAsyncSimpleArrowFunctionExpression\".\n            // And production (2) is parsed in \"tryParseParenthesizedArrowFunctionExpression\".\n            //\n            // If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is\n            // not a  LeftHandSideExpression, nor does it start a ConditionalExpression.  So we are done\n            // with AssignmentExpression if we see one.\n            var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();\n            if (arrowExpression) {\n                return arrowExpression;\n            }\n            // Now try to see if we're in production '1', '2' or '3'.  A conditional expression can\n            // start with a LogicalOrExpression, while the assignment productions can only start with\n            // LeftHandSideExpressions.\n            //\n            // So, first, we try to just parse out a BinaryExpression.  If we get something that is a\n            // LeftHandSide or higher, then we can try to parse out the assignment expression part.\n            // Otherwise, we try to parse out the conditional expression bit.  We want to allow any\n            // binary expression here, so we pass in the 'lowest' precedence here so that it matches\n            // and consumes anything.\n            var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);\n            // To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized\n            // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single\n            // identifier and the current token is an arrow.\n            if (expr.kind === 70 /* Identifier */ && token() === 35 /* EqualsGreaterThanToken */) {\n                return parseSimpleArrowFunctionExpression(expr);\n            }\n            // Now see if we might be in cases '2' or '3'.\n            // If the expression was a LHS expression, and we have an assignment operator, then\n            // we're in '2' or '3'. Consume the assignment and return.\n            //\n            // Note: we call reScanGreaterToken so that we get an appropriately merged token\n            // for cases like > > =  becoming >>=\n            if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {\n                return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher());\n            }\n            // It wasn't an assignment or a lambda.  This is a conditional expression:\n            return parseConditionalExpressionRest(expr);\n        }\n        function isYieldExpression() {\n            if (token() === 115 /* YieldKeyword */) {\n                // If we have a 'yield' keyword, and this is a context where yield expressions are\n                // allowed, then definitely parse out a yield expression.\n                if (inYieldContext()) {\n                    return true;\n                }\n                // We're in a context where 'yield expr' is not allowed.  However, if we can\n                // definitely tell that the user was trying to parse a 'yield expr' and not\n                // just a normal expr that start with a 'yield' identifier, then parse out\n                // a 'yield expr'.  We can then report an error later that they are only\n                // allowed in generator expressions.\n                //\n                // for example, if we see 'yield(foo)', then we'll have to treat that as an\n                // invocation expression of something called 'yield'.  However, if we have\n                // 'yield foo' then that is not legal as a normal expression, so we can\n                // definitely recognize this as a yield expression.\n                //\n                // for now we just check if the next token is an identifier.  More heuristics\n                // can be added here later as necessary.  We just need to make sure that we\n                // don't accidentally consume something legal.\n                return lookAhead(nextTokenIsIdentifierOrKeywordOrNumberOnSameLine);\n            }\n            return false;\n        }\n        function nextTokenIsIdentifierOnSameLine() {\n            nextToken();\n            return !scanner.hasPrecedingLineBreak() && isIdentifier();\n        }\n        function parseYieldExpression() {\n            var node = createNode(195 /* YieldExpression */);\n            // YieldExpression[In] :\n            //      yield\n            //      yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield]\n            //      yield [no LineTerminator here] * [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield]\n            nextToken();\n            if (!scanner.hasPrecedingLineBreak() &&\n                (token() === 38 /* AsteriskToken */ || isStartOfExpression())) {\n                node.asteriskToken = parseOptionalToken(38 /* AsteriskToken */);\n                node.expression = parseAssignmentExpressionOrHigher();\n                return finishNode(node);\n            }\n            else {\n                // if the next token is not on the same line as yield.  or we don't have an '*' or\n                // the start of an expression, then this is just a simple \"yield\" expression.\n                return finishNode(node);\n            }\n        }\n        function parseSimpleArrowFunctionExpression(identifier, asyncModifier) {\n            ts.Debug.assert(token() === 35 /* EqualsGreaterThanToken */, \"parseSimpleArrowFunctionExpression should only have been called if we had a =>\");\n            var node;\n            if (asyncModifier) {\n                node = createNode(185 /* ArrowFunction */, asyncModifier.pos);\n                node.modifiers = asyncModifier;\n            }\n            else {\n                node = createNode(185 /* ArrowFunction */, identifier.pos);\n            }\n            var parameter = createNode(144 /* Parameter */, identifier.pos);\n            parameter.name = identifier;\n            finishNode(parameter);\n            node.parameters = createNodeArray([parameter], parameter.pos);\n            node.parameters.end = parameter.end;\n            node.equalsGreaterThanToken = parseExpectedToken(35 /* EqualsGreaterThanToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, \"=>\");\n            node.body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);\n            return addJSDocComment(finishNode(node));\n        }\n        function tryParseParenthesizedArrowFunctionExpression() {\n            var triState = isParenthesizedArrowFunctionExpression();\n            if (triState === 0 /* False */) {\n                // It's definitely not a parenthesized arrow function expression.\n                return undefined;\n            }\n            // If we definitely have an arrow function, then we can just parse one, not requiring a\n            // following => or { token. Otherwise, we *might* have an arrow function.  Try to parse\n            // it out, but don't allow any ambiguity, and return 'undefined' if this could be an\n            // expression instead.\n            var arrowFunction = triState === 1 /* True */\n                ? parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ true)\n                : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead);\n            if (!arrowFunction) {\n                // Didn't appear to actually be a parenthesized arrow function.  Just bail out.\n                return undefined;\n            }\n            var isAsync = !!(ts.getModifierFlags(arrowFunction) & 256 /* Async */);\n            // If we have an arrow, then try to parse the body. Even if not, try to parse if we\n            // have an opening brace, just in case we're in an error state.\n            var lastToken = token();\n            arrowFunction.equalsGreaterThanToken = parseExpectedToken(35 /* EqualsGreaterThanToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, \"=>\");\n            arrowFunction.body = (lastToken === 35 /* EqualsGreaterThanToken */ || lastToken === 16 /* OpenBraceToken */)\n                ? parseArrowFunctionExpressionBody(isAsync)\n                : parseIdentifier();\n            return addJSDocComment(finishNode(arrowFunction));\n        }\n        //  True        -> We definitely expect a parenthesized arrow function here.\n        //  False       -> There *cannot* be a parenthesized arrow function here.\n        //  Unknown     -> There *might* be a parenthesized arrow function here.\n        //                 Speculatively look ahead to be sure, and rollback if not.\n        function isParenthesizedArrowFunctionExpression() {\n            if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */ || token() === 119 /* AsyncKeyword */) {\n                return lookAhead(isParenthesizedArrowFunctionExpressionWorker);\n            }\n            if (token() === 35 /* EqualsGreaterThanToken */) {\n                // ERROR RECOVERY TWEAK:\n                // If we see a standalone => try to parse it as an arrow function expression as that's\n                // likely what the user intended to write.\n                return 1 /* True */;\n            }\n            // Definitely not a parenthesized arrow function.\n            return 0 /* False */;\n        }\n        function isParenthesizedArrowFunctionExpressionWorker() {\n            if (token() === 119 /* AsyncKeyword */) {\n                nextToken();\n                if (scanner.hasPrecedingLineBreak()) {\n                    return 0 /* False */;\n                }\n                if (token() !== 18 /* OpenParenToken */ && token() !== 26 /* LessThanToken */) {\n                    return 0 /* False */;\n                }\n            }\n            var first = token();\n            var second = nextToken();\n            if (first === 18 /* OpenParenToken */) {\n                if (second === 19 /* CloseParenToken */) {\n                    // Simple cases: \"() =>\", \"(): \", and  \"() {\".\n                    // This is an arrow function with no parameters.\n                    // The last one is not actually an arrow function,\n                    // but this is probably what the user intended.\n                    var third = nextToken();\n                    switch (third) {\n                        case 35 /* EqualsGreaterThanToken */:\n                        case 55 /* ColonToken */:\n                        case 16 /* OpenBraceToken */:\n                            return 1 /* True */;\n                        default:\n                            return 0 /* False */;\n                    }\n                }\n                // If encounter \"([\" or \"({\", this could be the start of a binding pattern.\n                // Examples:\n                //      ([ x ]) => { }\n                //      ({ x }) => { }\n                //      ([ x ])\n                //      ({ x })\n                if (second === 20 /* OpenBracketToken */ || second === 16 /* OpenBraceToken */) {\n                    return 2 /* Unknown */;\n                }\n                // Simple case: \"(...\"\n                // This is an arrow function with a rest parameter.\n                if (second === 23 /* DotDotDotToken */) {\n                    return 1 /* True */;\n                }\n                // If we had \"(\" followed by something that's not an identifier,\n                // then this definitely doesn't look like a lambda.\n                // Note: we could be a little more lenient and allow\n                // \"(public\" or \"(private\". These would not ever actually be allowed,\n                // but we could provide a good error message instead of bailing out.\n                if (!isIdentifier()) {\n                    return 0 /* False */;\n                }\n                // If we have something like \"(a:\", then we must have a\n                // type-annotated parameter in an arrow function expression.\n                if (nextToken() === 55 /* ColonToken */) {\n                    return 1 /* True */;\n                }\n                // This *could* be a parenthesized arrow function.\n                // Return Unknown to let the caller know.\n                return 2 /* Unknown */;\n            }\n            else {\n                ts.Debug.assert(first === 26 /* LessThanToken */);\n                // If we have \"<\" not followed by an identifier,\n                // then this definitely is not an arrow function.\n                if (!isIdentifier()) {\n                    return 0 /* False */;\n                }\n                // JSX overrides\n                if (sourceFile.languageVariant === 1 /* JSX */) {\n                    var isArrowFunctionInJsx = lookAhead(function () {\n                        var third = nextToken();\n                        if (third === 84 /* ExtendsKeyword */) {\n                            var fourth = nextToken();\n                            switch (fourth) {\n                                case 57 /* EqualsToken */:\n                                case 28 /* GreaterThanToken */:\n                                    return false;\n                                default:\n                                    return true;\n                            }\n                        }\n                        else if (third === 25 /* CommaToken */) {\n                            return true;\n                        }\n                        return false;\n                    });\n                    if (isArrowFunctionInJsx) {\n                        return 1 /* True */;\n                    }\n                    return 0 /* False */;\n                }\n                // This *could* be a parenthesized arrow function.\n                return 2 /* Unknown */;\n            }\n        }\n        function parsePossibleParenthesizedArrowFunctionExpressionHead() {\n            return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false);\n        }\n        function tryParseAsyncSimpleArrowFunctionExpression() {\n            // We do a check here so that we won't be doing unnecessarily call to \"lookAhead\"\n            if (token() === 119 /* AsyncKeyword */) {\n                var isUnParenthesizedAsyncArrowFunction = lookAhead(isUnParenthesizedAsyncArrowFunctionWorker);\n                if (isUnParenthesizedAsyncArrowFunction === 1 /* True */) {\n                    var asyncModifier = parseModifiersForArrowFunction();\n                    var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);\n                    return parseSimpleArrowFunctionExpression(expr, asyncModifier);\n                }\n            }\n            return undefined;\n        }\n        function isUnParenthesizedAsyncArrowFunctionWorker() {\n            // AsyncArrowFunctionExpression:\n            //      1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In]\n            //      2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In]\n            if (token() === 119 /* AsyncKeyword */) {\n                nextToken();\n                // If the \"async\" is followed by \"=>\" token then it is not a begining of an async arrow-function\n                // but instead a simple arrow-function which will be parsed inside \"parseAssignmentExpressionOrHigher\"\n                if (scanner.hasPrecedingLineBreak() || token() === 35 /* EqualsGreaterThanToken */) {\n                    return 0 /* False */;\n                }\n                // Check for un-parenthesized AsyncArrowFunction\n                var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);\n                if (!scanner.hasPrecedingLineBreak() && expr.kind === 70 /* Identifier */ && token() === 35 /* EqualsGreaterThanToken */) {\n                    return 1 /* True */;\n                }\n            }\n            return 0 /* False */;\n        }\n        function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) {\n            var node = createNode(185 /* ArrowFunction */);\n            node.modifiers = parseModifiersForArrowFunction();\n            var isAsync = !!(ts.getModifierFlags(node) & 256 /* Async */);\n            // Arrow functions are never generators.\n            //\n            // If we're speculatively parsing a signature for a parenthesized arrow function, then\n            // we have to have a complete parameter list.  Otherwise we might see something like\n            // a => (b => c)\n            // And think that \"(b =>\" was actually a parenthesized arrow function with a missing\n            // close paren.\n            fillSignature(55 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ !allowAmbiguity, node);\n            // If we couldn't get parameters, we definitely could not parse out an arrow function.\n            if (!node.parameters) {\n                return undefined;\n            }\n            // Parsing a signature isn't enough.\n            // Parenthesized arrow signatures often look like other valid expressions.\n            // For instance:\n            //  - \"(x = 10)\" is an assignment expression parsed as a signature with a default parameter value.\n            //  - \"(x,y)\" is a comma expression parsed as a signature with two parameters.\n            //  - \"a ? (b): c\" will have \"(b):\" parsed as a signature with a return type annotation.\n            //\n            // So we need just a bit of lookahead to ensure that it can only be a signature.\n            if (!allowAmbiguity && token() !== 35 /* EqualsGreaterThanToken */ && token() !== 16 /* OpenBraceToken */) {\n                // Returning undefined here will cause our caller to rewind to where we started from.\n                return undefined;\n            }\n            return node;\n        }\n        function parseArrowFunctionExpressionBody(isAsync) {\n            if (token() === 16 /* OpenBraceToken */) {\n                return parseFunctionBlock(/*allowYield*/ false, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ false);\n            }\n            if (token() !== 24 /* SemicolonToken */ &&\n                token() !== 88 /* FunctionKeyword */ &&\n                token() !== 74 /* ClassKeyword */ &&\n                isStartOfStatement() &&\n                !isStartOfExpressionStatement()) {\n                // Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations)\n                //\n                // Here we try to recover from a potential error situation in the case where the\n                // user meant to supply a block. For example, if the user wrote:\n                //\n                //  a =>\n                //      let v = 0;\n                //  }\n                //\n                // they may be missing an open brace.  Check to see if that's the case so we can\n                // try to recover better.  If we don't do this, then the next close curly we see may end\n                // up preemptively closing the containing construct.\n                //\n                // Note: even when 'ignoreMissingOpenBrace' is passed as true, parseBody will still error.\n                return parseFunctionBlock(/*allowYield*/ false, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ true);\n            }\n            return isAsync\n                ? doInAwaitContext(parseAssignmentExpressionOrHigher)\n                : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);\n        }\n        function parseConditionalExpressionRest(leftOperand) {\n            // Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher.\n            var questionToken = parseOptionalToken(54 /* QuestionToken */);\n            if (!questionToken) {\n                return leftOperand;\n            }\n            // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and\n            // we do not that for the 'whenFalse' part.\n            var node = createNode(193 /* ConditionalExpression */, leftOperand.pos);\n            node.condition = leftOperand;\n            node.questionToken = questionToken;\n            node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);\n            node.colonToken = parseExpectedToken(55 /* ColonToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(55 /* ColonToken */));\n            node.whenFalse = parseAssignmentExpressionOrHigher();\n            return finishNode(node);\n        }\n        function parseBinaryExpressionOrHigher(precedence) {\n            var leftOperand = parseUnaryExpressionOrHigher();\n            return parseBinaryExpressionRest(precedence, leftOperand);\n        }\n        function isInOrOfKeyword(t) {\n            return t === 91 /* InKeyword */ || t === 140 /* OfKeyword */;\n        }\n        function parseBinaryExpressionRest(precedence, leftOperand) {\n            while (true) {\n                // We either have a binary operator here, or we're finished.  We call\n                // reScanGreaterToken so that we merge token sequences like > and = into >=\n                reScanGreaterToken();\n                var newPrecedence = getBinaryOperatorPrecedence();\n                // Check the precedence to see if we should \"take\" this operator\n                // - For left associative operator (all operator but **), consume the operator,\n                //   recursively call the function below, and parse binaryExpression as a rightOperand\n                //   of the caller if the new precedence of the operator is greater then or equal to the current precedence.\n                //   For example:\n                //      a - b - c;\n                //            ^token; leftOperand = b. Return b to the caller as a rightOperand\n                //      a * b - c\n                //            ^token; leftOperand = b. Return b to the caller as a rightOperand\n                //      a - b * c;\n                //            ^token; leftOperand = b. Return b * c to the caller as a rightOperand\n                // - For right associative operator (**), consume the operator, recursively call the function\n                //   and parse binaryExpression as a rightOperand of the caller if the new precedence of\n                //   the operator is strictly grater than the current precedence\n                //   For example:\n                //      a ** b ** c;\n                //             ^^token; leftOperand = b. Return b ** c to the caller as a rightOperand\n                //      a - b ** c;\n                //            ^^token; leftOperand = b. Return b ** c to the caller as a rightOperand\n                //      a ** b - c\n                //             ^token; leftOperand = b. Return b to the caller as a rightOperand\n                var consumeCurrentOperator = token() === 39 /* AsteriskAsteriskToken */ ?\n                    newPrecedence >= precedence :\n                    newPrecedence > precedence;\n                if (!consumeCurrentOperator) {\n                    break;\n                }\n                if (token() === 91 /* InKeyword */ && inDisallowInContext()) {\n                    break;\n                }\n                if (token() === 117 /* AsKeyword */) {\n                    // Make sure we *do* perform ASI for constructs like this:\n                    //    var x = foo\n                    //    as (Bar)\n                    // This should be parsed as an initialized variable, followed\n                    // by a function call to 'as' with the argument 'Bar'\n                    if (scanner.hasPrecedingLineBreak()) {\n                        break;\n                    }\n                    else {\n                        nextToken();\n                        leftOperand = makeAsExpression(leftOperand, parseType());\n                    }\n                }\n                else {\n                    leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence));\n                }\n            }\n            return leftOperand;\n        }\n        function isBinaryOperator() {\n            if (inDisallowInContext() && token() === 91 /* InKeyword */) {\n                return false;\n            }\n            return getBinaryOperatorPrecedence() > 0;\n        }\n        function getBinaryOperatorPrecedence() {\n            switch (token()) {\n                case 53 /* BarBarToken */:\n                    return 1;\n                case 52 /* AmpersandAmpersandToken */:\n                    return 2;\n                case 48 /* BarToken */:\n                    return 3;\n                case 49 /* CaretToken */:\n                    return 4;\n                case 47 /* AmpersandToken */:\n                    return 5;\n                case 31 /* EqualsEqualsToken */:\n                case 32 /* ExclamationEqualsToken */:\n                case 33 /* EqualsEqualsEqualsToken */:\n                case 34 /* ExclamationEqualsEqualsToken */:\n                    return 6;\n                case 26 /* LessThanToken */:\n                case 28 /* GreaterThanToken */:\n                case 29 /* LessThanEqualsToken */:\n                case 30 /* GreaterThanEqualsToken */:\n                case 92 /* InstanceOfKeyword */:\n                case 91 /* InKeyword */:\n                case 117 /* AsKeyword */:\n                    return 7;\n                case 44 /* LessThanLessThanToken */:\n                case 45 /* GreaterThanGreaterThanToken */:\n                case 46 /* GreaterThanGreaterThanGreaterThanToken */:\n                    return 8;\n                case 36 /* PlusToken */:\n                case 37 /* MinusToken */:\n                    return 9;\n                case 38 /* AsteriskToken */:\n                case 40 /* SlashToken */:\n                case 41 /* PercentToken */:\n                    return 10;\n                case 39 /* AsteriskAsteriskToken */:\n                    return 11;\n            }\n            // -1 is lower than all other precedences.  Returning it will cause binary expression\n            // parsing to stop.\n            return -1;\n        }\n        function makeBinaryExpression(left, operatorToken, right) {\n            var node = createNode(192 /* BinaryExpression */, left.pos);\n            node.left = left;\n            node.operatorToken = operatorToken;\n            node.right = right;\n            return finishNode(node);\n        }\n        function makeAsExpression(left, right) {\n            var node = createNode(200 /* AsExpression */, left.pos);\n            node.expression = left;\n            node.type = right;\n            return finishNode(node);\n        }\n        function parsePrefixUnaryExpression() {\n            var node = createNode(190 /* PrefixUnaryExpression */);\n            node.operator = token();\n            nextToken();\n            node.operand = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        function parseDeleteExpression() {\n            var node = createNode(186 /* DeleteExpression */);\n            nextToken();\n            node.expression = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        function parseTypeOfExpression() {\n            var node = createNode(187 /* TypeOfExpression */);\n            nextToken();\n            node.expression = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        function parseVoidExpression() {\n            var node = createNode(188 /* VoidExpression */);\n            nextToken();\n            node.expression = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        function isAwaitExpression() {\n            if (token() === 120 /* AwaitKeyword */) {\n                if (inAwaitContext()) {\n                    return true;\n                }\n                // here we are using similar heuristics as 'isYieldExpression'\n                return lookAhead(nextTokenIsIdentifierOnSameLine);\n            }\n            return false;\n        }\n        function parseAwaitExpression() {\n            var node = createNode(189 /* AwaitExpression */);\n            nextToken();\n            node.expression = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        /**\n         * Parse ES7 exponential expression and await expression\n         *\n         * ES7 ExponentiationExpression:\n         *      1) UnaryExpression[?Yield]\n         *      2) UpdateExpression[?Yield] ** ExponentiationExpression[?Yield]\n         *\n         */\n        function parseUnaryExpressionOrHigher() {\n            /**\n             * ES7 UpdateExpression:\n             *      1) LeftHandSideExpression[?Yield]\n             *      2) LeftHandSideExpression[?Yield][no LineTerminator here]++\n             *      3) LeftHandSideExpression[?Yield][no LineTerminator here]--\n             *      4) ++UnaryExpression[?Yield]\n             *      5) --UnaryExpression[?Yield]\n             */\n            if (isUpdateExpression()) {\n                var incrementExpression = parseIncrementExpression();\n                return token() === 39 /* AsteriskAsteriskToken */ ?\n                    parseBinaryExpressionRest(getBinaryOperatorPrecedence(), incrementExpression) :\n                    incrementExpression;\n            }\n            /**\n             * ES7 UnaryExpression:\n             *      1) UpdateExpression[?yield]\n             *      2) delete UpdateExpression[?yield]\n             *      3) void UpdateExpression[?yield]\n             *      4) typeof UpdateExpression[?yield]\n             *      5) + UpdateExpression[?yield]\n             *      6) - UpdateExpression[?yield]\n             *      7) ~ UpdateExpression[?yield]\n             *      8) ! UpdateExpression[?yield]\n             */\n            var unaryOperator = token();\n            var simpleUnaryExpression = parseSimpleUnaryExpression();\n            if (token() === 39 /* AsteriskAsteriskToken */) {\n                var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos);\n                if (simpleUnaryExpression.kind === 182 /* TypeAssertionExpression */) {\n                    parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);\n                }\n                else {\n                    parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, ts.tokenToString(unaryOperator));\n                }\n            }\n            return simpleUnaryExpression;\n        }\n        /**\n         * Parse ES7 simple-unary expression or higher:\n         *\n         * ES7 UnaryExpression:\n         *      1) UpdateExpression[?yield]\n         *      2) delete UnaryExpression[?yield]\n         *      3) void UnaryExpression[?yield]\n         *      4) typeof UnaryExpression[?yield]\n         *      5) + UnaryExpression[?yield]\n         *      6) - UnaryExpression[?yield]\n         *      7) ~ UnaryExpression[?yield]\n         *      8) ! UnaryExpression[?yield]\n         *      9) [+Await] await UnaryExpression[?yield]\n         */\n        function parseSimpleUnaryExpression() {\n            switch (token()) {\n                case 36 /* PlusToken */:\n                case 37 /* MinusToken */:\n                case 51 /* TildeToken */:\n                case 50 /* ExclamationToken */:\n                    return parsePrefixUnaryExpression();\n                case 79 /* DeleteKeyword */:\n                    return parseDeleteExpression();\n                case 102 /* TypeOfKeyword */:\n                    return parseTypeOfExpression();\n                case 104 /* VoidKeyword */:\n                    return parseVoidExpression();\n                case 26 /* LessThanToken */:\n                    // This is modified UnaryExpression grammar in TypeScript\n                    //  UnaryExpression (modified):\n                    //      < type > UnaryExpression\n                    return parseTypeAssertion();\n                case 120 /* AwaitKeyword */:\n                    if (isAwaitExpression()) {\n                        return parseAwaitExpression();\n                    }\n                default:\n                    return parseIncrementExpression();\n            }\n        }\n        /**\n         * Check if the current token can possibly be an ES7 increment expression.\n         *\n         * ES7 UpdateExpression:\n         *      LeftHandSideExpression[?Yield]\n         *      LeftHandSideExpression[?Yield][no LineTerminator here]++\n         *      LeftHandSideExpression[?Yield][no LineTerminator here]--\n         *      ++LeftHandSideExpression[?Yield]\n         *      --LeftHandSideExpression[?Yield]\n         */\n        function isUpdateExpression() {\n            // This function is called inside parseUnaryExpression to decide\n            // whether to call parseSimpleUnaryExpression or call parseIncrementExpression directly\n            switch (token()) {\n                case 36 /* PlusToken */:\n                case 37 /* MinusToken */:\n                case 51 /* TildeToken */:\n                case 50 /* ExclamationToken */:\n                case 79 /* DeleteKeyword */:\n                case 102 /* TypeOfKeyword */:\n                case 104 /* VoidKeyword */:\n                case 120 /* AwaitKeyword */:\n                    return false;\n                case 26 /* LessThanToken */:\n                    // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression\n                    if (sourceFile.languageVariant !== 1 /* JSX */) {\n                        return false;\n                    }\n                // We are in JSX context and the token is part of JSXElement.\n                // Fall through\n                default:\n                    return true;\n            }\n        }\n        /**\n         * Parse ES7 IncrementExpression. IncrementExpression is used instead of ES6's PostFixExpression.\n         *\n         * ES7 IncrementExpression[yield]:\n         *      1) LeftHandSideExpression[?yield]\n         *      2) LeftHandSideExpression[?yield] [[no LineTerminator here]]++\n         *      3) LeftHandSideExpression[?yield] [[no LineTerminator here]]--\n         *      4) ++LeftHandSideExpression[?yield]\n         *      5) --LeftHandSideExpression[?yield]\n         * In TypeScript (2), (3) are parsed as PostfixUnaryExpression. (4), (5) are parsed as PrefixUnaryExpression\n         */\n        function parseIncrementExpression() {\n            if (token() === 42 /* PlusPlusToken */ || token() === 43 /* MinusMinusToken */) {\n                var node = createNode(190 /* PrefixUnaryExpression */);\n                node.operator = token();\n                nextToken();\n                node.operand = parseLeftHandSideExpressionOrHigher();\n                return finishNode(node);\n            }\n            else if (sourceFile.languageVariant === 1 /* JSX */ && token() === 26 /* LessThanToken */ && lookAhead(nextTokenIsIdentifierOrKeyword)) {\n                // JSXElement is part of primaryExpression\n                return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true);\n            }\n            var expression = parseLeftHandSideExpressionOrHigher();\n            ts.Debug.assert(ts.isLeftHandSideExpression(expression));\n            if ((token() === 42 /* PlusPlusToken */ || token() === 43 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) {\n                var node = createNode(191 /* PostfixUnaryExpression */, expression.pos);\n                node.operand = expression;\n                node.operator = token();\n                nextToken();\n                return finishNode(node);\n            }\n            return expression;\n        }\n        function parseLeftHandSideExpressionOrHigher() {\n            // Original Ecma:\n            // LeftHandSideExpression: See 11.2\n            //      NewExpression\n            //      CallExpression\n            //\n            // Our simplification:\n            //\n            // LeftHandSideExpression: See 11.2\n            //      MemberExpression\n            //      CallExpression\n            //\n            // See comment in parseMemberExpressionOrHigher on how we replaced NewExpression with\n            // MemberExpression to make our lives easier.\n            //\n            // to best understand the below code, it's important to see how CallExpression expands\n            // out into its own productions:\n            //\n            // CallExpression:\n            //      MemberExpression Arguments\n            //      CallExpression Arguments\n            //      CallExpression[Expression]\n            //      CallExpression.IdentifierName\n            //      super   (   ArgumentListopt   )\n            //      super.IdentifierName\n            //\n            // Because of the recursion in these calls, we need to bottom out first.  There are two\n            // bottom out states we can run into.  Either we see 'super' which must start either of\n            // the last two CallExpression productions.  Or we have a MemberExpression which either\n            // completes the LeftHandSideExpression, or starts the beginning of the first four\n            // CallExpression productions.\n            var expression = token() === 96 /* SuperKeyword */\n                ? parseSuperExpression()\n                : parseMemberExpressionOrHigher();\n            // Now, we *may* be complete.  However, we might have consumed the start of a\n            // CallExpression.  As such, we need to consume the rest of it here to be complete.\n            return parseCallExpressionRest(expression);\n        }\n        function parseMemberExpressionOrHigher() {\n            // Note: to make our lives simpler, we decompose the the NewExpression productions and\n            // place ObjectCreationExpression and FunctionExpression into PrimaryExpression.\n            // like so:\n            //\n            //   PrimaryExpression : See 11.1\n            //      this\n            //      Identifier\n            //      Literal\n            //      ArrayLiteral\n            //      ObjectLiteral\n            //      (Expression)\n            //      FunctionExpression\n            //      new MemberExpression Arguments?\n            //\n            //   MemberExpression : See 11.2\n            //      PrimaryExpression\n            //      MemberExpression[Expression]\n            //      MemberExpression.IdentifierName\n            //\n            //   CallExpression : See 11.2\n            //      MemberExpression\n            //      CallExpression Arguments\n            //      CallExpression[Expression]\n            //      CallExpression.IdentifierName\n            //\n            // Technically this is ambiguous.  i.e. CallExpression defines:\n            //\n            //   CallExpression:\n            //      CallExpression Arguments\n            //\n            // If you see: \"new Foo()\"\n            //\n            // Then that could be treated as a single ObjectCreationExpression, or it could be\n            // treated as the invocation of \"new Foo\".  We disambiguate that in code (to match\n            // the original grammar) by making sure that if we see an ObjectCreationExpression\n            // we always consume arguments if they are there. So we treat \"new Foo()\" as an\n            // object creation only, and not at all as an invocation)  Another way to think\n            // about this is that for every \"new\" that we see, we will consume an argument list if\n            // it is there as part of the *associated* object creation node.  Any additional\n            // argument lists we see, will become invocation expressions.\n            //\n            // Because there are no other places in the grammar now that refer to FunctionExpression\n            // or ObjectCreationExpression, it is safe to push down into the PrimaryExpression\n            // production.\n            //\n            // Because CallExpression and MemberExpression are left recursive, we need to bottom out\n            // of the recursion immediately.  So we parse out a primary expression to start with.\n            var expression = parsePrimaryExpression();\n            return parseMemberExpressionRest(expression);\n        }\n        function parseSuperExpression() {\n            var expression = parseTokenNode();\n            if (token() === 18 /* OpenParenToken */ || token() === 22 /* DotToken */ || token() === 20 /* OpenBracketToken */) {\n                return expression;\n            }\n            // If we have seen \"super\" it must be followed by '(' or '.'.\n            // If it wasn't then just try to parse out a '.' and report an error.\n            var node = createNode(177 /* PropertyAccessExpression */, expression.pos);\n            node.expression = expression;\n            parseExpectedToken(22 /* DotToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);\n            node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);\n            return finishNode(node);\n        }\n        function tagNamesAreEquivalent(lhs, rhs) {\n            if (lhs.kind !== rhs.kind) {\n                return false;\n            }\n            if (lhs.kind === 70 /* Identifier */) {\n                return lhs.text === rhs.text;\n            }\n            if (lhs.kind === 98 /* ThisKeyword */) {\n                return true;\n            }\n            // If we are at this statement then we must have PropertyAccessExpression and because tag name in Jsx element can only\n            // take forms of JsxTagNameExpression which includes an identifier, \"this\" expression, or another propertyAccessExpression\n            // it is safe to case the expression property as such. See parseJsxElementName for how we parse tag name in Jsx element\n            return lhs.name.text === rhs.name.text &&\n                tagNamesAreEquivalent(lhs.expression, rhs.expression);\n        }\n        function parseJsxElementOrSelfClosingElement(inExpressionContext) {\n            var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext);\n            var result;\n            if (opening.kind === 248 /* JsxOpeningElement */) {\n                var node = createNode(246 /* JsxElement */, opening.pos);\n                node.openingElement = opening;\n                node.children = parseJsxChildren(node.openingElement.tagName);\n                node.closingElement = parseJsxClosingElement(inExpressionContext);\n                if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) {\n                    parseErrorAtPosition(node.closingElement.pos, node.closingElement.end - node.closingElement.pos, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, node.openingElement.tagName));\n                }\n                result = finishNode(node);\n            }\n            else {\n                ts.Debug.assert(opening.kind === 247 /* JsxSelfClosingElement */);\n                // Nothing else to do for self-closing elements\n                result = opening;\n            }\n            // If the user writes the invalid code '<div></div><div></div>' in an expression context (i.e. not wrapped in\n            // an enclosing tag), we'll naively try to parse   ^ this as a 'less than' operator and the remainder of the tag\n            // as garbage, which will cause the formatter to badly mangle the JSX. Perform a speculative parse of a JSX\n            // element if we see a < token so that we can wrap it in a synthetic binary expression so the formatter\n            // does less damage and we can report a better error.\n            // Since JSX elements are invalid < operands anyway, this lookahead parse will only occur in error scenarios\n            // of one sort or another.\n            if (inExpressionContext && token() === 26 /* LessThanToken */) {\n                var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); });\n                if (invalidElement) {\n                    parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element);\n                    var badNode = createNode(192 /* BinaryExpression */, result.pos);\n                    badNode.end = invalidElement.end;\n                    badNode.left = result;\n                    badNode.right = invalidElement;\n                    badNode.operatorToken = createMissingNode(25 /* CommaToken */, /*reportAtCurrentPosition*/ false, /*diagnosticMessage*/ undefined);\n                    badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos;\n                    return badNode;\n                }\n            }\n            return result;\n        }\n        function parseJsxText() {\n            var node = createNode(10 /* JsxText */, scanner.getStartPos());\n            currentToken = scanner.scanJsxToken();\n            return finishNode(node);\n        }\n        function parseJsxChild() {\n            switch (token()) {\n                case 10 /* JsxText */:\n                    return parseJsxText();\n                case 16 /* OpenBraceToken */:\n                    return parseJsxExpression(/*inExpressionContext*/ false);\n                case 26 /* LessThanToken */:\n                    return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ false);\n            }\n            ts.Debug.fail(\"Unknown JSX child kind \" + token());\n        }\n        function parseJsxChildren(openingTagName) {\n            var result = createNodeArray();\n            var saveParsingContext = parsingContext;\n            parsingContext |= 1 << 14 /* JsxChildren */;\n            while (true) {\n                currentToken = scanner.reScanJsxToken();\n                if (token() === 27 /* LessThanSlashToken */) {\n                    // Closing tag\n                    break;\n                }\n                else if (token() === 1 /* EndOfFileToken */) {\n                    // If we hit EOF, issue the error at the tag that lacks the closing element\n                    // rather than at the end of the file (which is useless)\n                    parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName));\n                    break;\n                }\n                result.push(parseJsxChild());\n            }\n            result.end = scanner.getTokenPos();\n            parsingContext = saveParsingContext;\n            return result;\n        }\n        function parseJsxOpeningOrSelfClosingElement(inExpressionContext) {\n            var fullStart = scanner.getStartPos();\n            parseExpected(26 /* LessThanToken */);\n            var tagName = parseJsxElementName();\n            var attributes = parseList(13 /* JsxAttributes */, parseJsxAttribute);\n            var node;\n            if (token() === 28 /* GreaterThanToken */) {\n                // Closing tag, so scan the immediately-following text with the JSX scanning instead\n                // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate\n                // scanning errors\n                node = createNode(248 /* JsxOpeningElement */, fullStart);\n                scanJsxText();\n            }\n            else {\n                parseExpected(40 /* SlashToken */);\n                if (inExpressionContext) {\n                    parseExpected(28 /* GreaterThanToken */);\n                }\n                else {\n                    parseExpected(28 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false);\n                    scanJsxText();\n                }\n                node = createNode(247 /* JsxSelfClosingElement */, fullStart);\n            }\n            node.tagName = tagName;\n            node.attributes = attributes;\n            return finishNode(node);\n        }\n        function parseJsxElementName() {\n            scanJsxIdentifier();\n            // JsxElement can have name in the form of\n            //      propertyAccessExpression\n            //      primaryExpression in the form of an identifier and \"this\" keyword\n            // We can't just simply use parseLeftHandSideExpressionOrHigher because then we will start consider class,function etc as a keyword\n            // We only want to consider \"this\" as a primaryExpression\n            var expression = token() === 98 /* ThisKeyword */ ?\n                parseTokenNode() : parseIdentifierName();\n            while (parseOptional(22 /* DotToken */)) {\n                var propertyAccess = createNode(177 /* PropertyAccessExpression */, expression.pos);\n                propertyAccess.expression = expression;\n                propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);\n                expression = finishNode(propertyAccess);\n            }\n            return expression;\n        }\n        function parseJsxExpression(inExpressionContext) {\n            var node = createNode(252 /* JsxExpression */);\n            parseExpected(16 /* OpenBraceToken */);\n            if (token() !== 17 /* CloseBraceToken */) {\n                node.expression = parseAssignmentExpressionOrHigher();\n            }\n            if (inExpressionContext) {\n                parseExpected(17 /* CloseBraceToken */);\n            }\n            else {\n                parseExpected(17 /* CloseBraceToken */, /*message*/ undefined, /*shouldAdvance*/ false);\n                scanJsxText();\n            }\n            return finishNode(node);\n        }\n        function parseJsxAttribute() {\n            if (token() === 16 /* OpenBraceToken */) {\n                return parseJsxSpreadAttribute();\n            }\n            scanJsxIdentifier();\n            var node = createNode(250 /* JsxAttribute */);\n            node.name = parseIdentifierName();\n            if (token() === 57 /* EqualsToken */) {\n                switch (scanJsxAttributeValue()) {\n                    case 9 /* StringLiteral */:\n                        node.initializer = parseLiteralNode();\n                        break;\n                    default:\n                        node.initializer = parseJsxExpression(/*inExpressionContext*/ true);\n                        break;\n                }\n            }\n            return finishNode(node);\n        }\n        function parseJsxSpreadAttribute() {\n            var node = createNode(251 /* JsxSpreadAttribute */);\n            parseExpected(16 /* OpenBraceToken */);\n            parseExpected(23 /* DotDotDotToken */);\n            node.expression = parseExpression();\n            parseExpected(17 /* CloseBraceToken */);\n            return finishNode(node);\n        }\n        function parseJsxClosingElement(inExpressionContext) {\n            var node = createNode(249 /* JsxClosingElement */);\n            parseExpected(27 /* LessThanSlashToken */);\n            node.tagName = parseJsxElementName();\n            if (inExpressionContext) {\n                parseExpected(28 /* GreaterThanToken */);\n            }\n            else {\n                parseExpected(28 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false);\n                scanJsxText();\n            }\n            return finishNode(node);\n        }\n        function parseTypeAssertion() {\n            var node = createNode(182 /* TypeAssertionExpression */);\n            parseExpected(26 /* LessThanToken */);\n            node.type = parseType();\n            parseExpected(28 /* GreaterThanToken */);\n            node.expression = parseSimpleUnaryExpression();\n            return finishNode(node);\n        }\n        function parseMemberExpressionRest(expression) {\n            while (true) {\n                var dotToken = parseOptionalToken(22 /* DotToken */);\n                if (dotToken) {\n                    var propertyAccess = createNode(177 /* PropertyAccessExpression */, expression.pos);\n                    propertyAccess.expression = expression;\n                    propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);\n                    expression = finishNode(propertyAccess);\n                    continue;\n                }\n                if (token() === 50 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {\n                    nextToken();\n                    var nonNullExpression = createNode(201 /* NonNullExpression */, expression.pos);\n                    nonNullExpression.expression = expression;\n                    expression = finishNode(nonNullExpression);\n                    continue;\n                }\n                // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName\n                if (!inDecoratorContext() && parseOptional(20 /* OpenBracketToken */)) {\n                    var indexedAccess = createNode(178 /* ElementAccessExpression */, expression.pos);\n                    indexedAccess.expression = expression;\n                    // It's not uncommon for a user to write: \"new Type[]\".\n                    // Check for that common pattern and report a better error message.\n                    if (token() !== 21 /* CloseBracketToken */) {\n                        indexedAccess.argumentExpression = allowInAnd(parseExpression);\n                        if (indexedAccess.argumentExpression.kind === 9 /* StringLiteral */ || indexedAccess.argumentExpression.kind === 8 /* NumericLiteral */) {\n                            var literal = indexedAccess.argumentExpression;\n                            literal.text = internIdentifier(literal.text);\n                        }\n                    }\n                    parseExpected(21 /* CloseBracketToken */);\n                    expression = finishNode(indexedAccess);\n                    continue;\n                }\n                if (token() === 12 /* NoSubstitutionTemplateLiteral */ || token() === 13 /* TemplateHead */) {\n                    var tagExpression = createNode(181 /* TaggedTemplateExpression */, expression.pos);\n                    tagExpression.tag = expression;\n                    tagExpression.template = token() === 12 /* NoSubstitutionTemplateLiteral */\n                        ? parseLiteralNode()\n                        : parseTemplateExpression();\n                    expression = finishNode(tagExpression);\n                    continue;\n                }\n                return expression;\n            }\n        }\n        function parseCallExpressionRest(expression) {\n            while (true) {\n                expression = parseMemberExpressionRest(expression);\n                if (token() === 26 /* LessThanToken */) {\n                    // See if this is the start of a generic invocation.  If so, consume it and\n                    // keep checking for postfix expressions.  Otherwise, it's just a '<' that's\n                    // part of an arithmetic expression.  Break out so we consume it higher in the\n                    // stack.\n                    var typeArguments = tryParse(parseTypeArgumentsInExpression);\n                    if (!typeArguments) {\n                        return expression;\n                    }\n                    var callExpr = createNode(179 /* CallExpression */, expression.pos);\n                    callExpr.expression = expression;\n                    callExpr.typeArguments = typeArguments;\n                    callExpr.arguments = parseArgumentList();\n                    expression = finishNode(callExpr);\n                    continue;\n                }\n                else if (token() === 18 /* OpenParenToken */) {\n                    var callExpr = createNode(179 /* CallExpression */, expression.pos);\n                    callExpr.expression = expression;\n                    callExpr.arguments = parseArgumentList();\n                    expression = finishNode(callExpr);\n                    continue;\n                }\n                return expression;\n            }\n        }\n        function parseArgumentList() {\n            parseExpected(18 /* OpenParenToken */);\n            var result = parseDelimitedList(11 /* ArgumentExpressions */, parseArgumentExpression);\n            parseExpected(19 /* CloseParenToken */);\n            return result;\n        }\n        function parseTypeArgumentsInExpression() {\n            if (!parseOptional(26 /* LessThanToken */)) {\n                return undefined;\n            }\n            var typeArguments = parseDelimitedList(19 /* TypeArguments */, parseType);\n            if (!parseExpected(28 /* GreaterThanToken */)) {\n                // If it doesn't have the closing >  then it's definitely not an type argument list.\n                return undefined;\n            }\n            // If we have a '<', then only parse this as a argument list if the type arguments\n            // are complete and we have an open paren.  if we don't, rewind and return nothing.\n            return typeArguments && canFollowTypeArgumentsInExpression()\n                ? typeArguments\n                : undefined;\n        }\n        function canFollowTypeArgumentsInExpression() {\n            switch (token()) {\n                case 18 /* OpenParenToken */: // foo<x>(\n                // this case are the only case where this token can legally follow a type argument\n                // list.  So we definitely want to treat this as a type arg list.\n                case 22 /* DotToken */: // foo<x>.\n                case 19 /* CloseParenToken */: // foo<x>)\n                case 21 /* CloseBracketToken */: // foo<x>]\n                case 55 /* ColonToken */: // foo<x>:\n                case 24 /* SemicolonToken */: // foo<x>;\n                case 54 /* QuestionToken */: // foo<x>?\n                case 31 /* EqualsEqualsToken */: // foo<x> ==\n                case 33 /* EqualsEqualsEqualsToken */: // foo<x> ===\n                case 32 /* ExclamationEqualsToken */: // foo<x> !=\n                case 34 /* ExclamationEqualsEqualsToken */: // foo<x> !==\n                case 52 /* AmpersandAmpersandToken */: // foo<x> &&\n                case 53 /* BarBarToken */: // foo<x> ||\n                case 49 /* CaretToken */: // foo<x> ^\n                case 47 /* AmpersandToken */: // foo<x> &\n                case 48 /* BarToken */: // foo<x> |\n                case 17 /* CloseBraceToken */: // foo<x> }\n                case 1 /* EndOfFileToken */:\n                    // these cases can't legally follow a type arg list.  However, they're not legal\n                    // expressions either.  The user is probably in the middle of a generic type. So\n                    // treat it as such.\n                    return true;\n                case 25 /* CommaToken */: // foo<x>,\n                case 16 /* OpenBraceToken */: // foo<x> {\n                // We don't want to treat these as type arguments.  Otherwise we'll parse this\n                // as an invocation expression.  Instead, we want to parse out the expression\n                // in isolation from the type arguments.\n                default:\n                    // Anything else treat as an expression.\n                    return false;\n            }\n        }\n        function parsePrimaryExpression() {\n            switch (token()) {\n                case 8 /* NumericLiteral */:\n                case 9 /* StringLiteral */:\n                case 12 /* NoSubstitutionTemplateLiteral */:\n                    return parseLiteralNode();\n                case 98 /* ThisKeyword */:\n                case 96 /* SuperKeyword */:\n                case 94 /* NullKeyword */:\n                case 100 /* TrueKeyword */:\n                case 85 /* FalseKeyword */:\n                    return parseTokenNode();\n                case 18 /* OpenParenToken */:\n                    return parseParenthesizedExpression();\n                case 20 /* OpenBracketToken */:\n                    return parseArrayLiteralExpression();\n                case 16 /* OpenBraceToken */:\n                    return parseObjectLiteralExpression();\n                case 119 /* AsyncKeyword */:\n                    // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher.\n                    // If we encounter `async [no LineTerminator here] function` then this is an async\n                    // function; otherwise, its an identifier.\n                    if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) {\n                        break;\n                    }\n                    return parseFunctionExpression();\n                case 74 /* ClassKeyword */:\n                    return parseClassExpression();\n                case 88 /* FunctionKeyword */:\n                    return parseFunctionExpression();\n                case 93 /* NewKeyword */:\n                    return parseNewExpression();\n                case 40 /* SlashToken */:\n                case 62 /* SlashEqualsToken */:\n                    if (reScanSlashToken() === 11 /* RegularExpressionLiteral */) {\n                        return parseLiteralNode();\n                    }\n                    break;\n                case 13 /* TemplateHead */:\n                    return parseTemplateExpression();\n            }\n            return parseIdentifier(ts.Diagnostics.Expression_expected);\n        }\n        function parseParenthesizedExpression() {\n            var node = createNode(183 /* ParenthesizedExpression */);\n            parseExpected(18 /* OpenParenToken */);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19 /* CloseParenToken */);\n            return finishNode(node);\n        }\n        function parseSpreadElement() {\n            var node = createNode(196 /* SpreadElement */);\n            parseExpected(23 /* DotDotDotToken */);\n            node.expression = parseAssignmentExpressionOrHigher();\n            return finishNode(node);\n        }\n        function parseArgumentOrArrayLiteralElement() {\n            return token() === 23 /* DotDotDotToken */ ? parseSpreadElement() :\n                token() === 25 /* CommaToken */ ? createNode(198 /* OmittedExpression */) :\n                    parseAssignmentExpressionOrHigher();\n        }\n        function parseArgumentExpression() {\n            return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);\n        }\n        function parseArrayLiteralExpression() {\n            var node = createNode(175 /* ArrayLiteralExpression */);\n            parseExpected(20 /* OpenBracketToken */);\n            if (scanner.hasPrecedingLineBreak()) {\n                node.multiLine = true;\n            }\n            node.elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement);\n            parseExpected(21 /* CloseBracketToken */);\n            return finishNode(node);\n        }\n        function tryParseAccessorDeclaration(fullStart, decorators, modifiers) {\n            if (parseContextualModifier(124 /* GetKeyword */)) {\n                return parseAccessorDeclaration(151 /* GetAccessor */, fullStart, decorators, modifiers);\n            }\n            else if (parseContextualModifier(133 /* SetKeyword */)) {\n                return parseAccessorDeclaration(152 /* SetAccessor */, fullStart, decorators, modifiers);\n            }\n            return undefined;\n        }\n        function parseObjectLiteralElement() {\n            var fullStart = scanner.getStartPos();\n            var dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */);\n            if (dotDotDotToken) {\n                var spreadElement = createNode(259 /* SpreadAssignment */, fullStart);\n                spreadElement.expression = parseAssignmentExpressionOrHigher();\n                return addJSDocComment(finishNode(spreadElement));\n            }\n            var decorators = parseDecorators();\n            var modifiers = parseModifiers();\n            var accessor = tryParseAccessorDeclaration(fullStart, decorators, modifiers);\n            if (accessor) {\n                return accessor;\n            }\n            var asteriskToken = parseOptionalToken(38 /* AsteriskToken */);\n            var tokenIsIdentifier = isIdentifier();\n            var propertyName = parsePropertyName();\n            // Disallowing of optional property assignments happens in the grammar checker.\n            var questionToken = parseOptionalToken(54 /* QuestionToken */);\n            if (asteriskToken || token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) {\n                return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken);\n            }\n            // check if it is short-hand property assignment or normal property assignment\n            // NOTE: if token is EqualsToken it is interpreted as CoverInitializedName production\n            // CoverInitializedName[Yield] :\n            //     IdentifierReference[?Yield] Initializer[In, ?Yield]\n            // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern\n            var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 /* CommaToken */ || token() === 17 /* CloseBraceToken */ || token() === 57 /* EqualsToken */);\n            if (isShorthandPropertyAssignment) {\n                var shorthandDeclaration = createNode(258 /* ShorthandPropertyAssignment */, fullStart);\n                shorthandDeclaration.name = propertyName;\n                shorthandDeclaration.questionToken = questionToken;\n                var equalsToken = parseOptionalToken(57 /* EqualsToken */);\n                if (equalsToken) {\n                    shorthandDeclaration.equalsToken = equalsToken;\n                    shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher);\n                }\n                return addJSDocComment(finishNode(shorthandDeclaration));\n            }\n            else {\n                var propertyAssignment = createNode(257 /* PropertyAssignment */, fullStart);\n                propertyAssignment.modifiers = modifiers;\n                propertyAssignment.name = propertyName;\n                propertyAssignment.questionToken = questionToken;\n                parseExpected(55 /* ColonToken */);\n                propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher);\n                return addJSDocComment(finishNode(propertyAssignment));\n            }\n        }\n        function parseObjectLiteralExpression() {\n            var node = createNode(176 /* ObjectLiteralExpression */);\n            parseExpected(16 /* OpenBraceToken */);\n            if (scanner.hasPrecedingLineBreak()) {\n                node.multiLine = true;\n            }\n            node.properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true);\n            parseExpected(17 /* CloseBraceToken */);\n            return finishNode(node);\n        }\n        function parseFunctionExpression() {\n            // GeneratorExpression:\n            //      function* BindingIdentifier [Yield][opt](FormalParameters[Yield]){ GeneratorBody }\n            //\n            // FunctionExpression:\n            //      function BindingIdentifier[opt](FormalParameters){ FunctionBody }\n            var saveDecoratorContext = inDecoratorContext();\n            if (saveDecoratorContext) {\n                setDecoratorContext(/*val*/ false);\n            }\n            var node = createNode(184 /* FunctionExpression */);\n            node.modifiers = parseModifiers();\n            parseExpected(88 /* FunctionKeyword */);\n            node.asteriskToken = parseOptionalToken(38 /* AsteriskToken */);\n            var isGenerator = !!node.asteriskToken;\n            var isAsync = !!(ts.getModifierFlags(node) & 256 /* Async */);\n            node.name =\n                isGenerator && isAsync ? doInYieldAndAwaitContext(parseOptionalIdentifier) :\n                    isGenerator ? doInYieldContext(parseOptionalIdentifier) :\n                        isAsync ? doInAwaitContext(parseOptionalIdentifier) :\n                            parseOptionalIdentifier();\n            fillSignature(55 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node);\n            node.body = parseFunctionBlock(/*allowYield*/ isGenerator, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ false);\n            if (saveDecoratorContext) {\n                setDecoratorContext(/*val*/ true);\n            }\n            return addJSDocComment(finishNode(node));\n        }\n        function parseOptionalIdentifier() {\n            return isIdentifier() ? parseIdentifier() : undefined;\n        }\n        function parseNewExpression() {\n            var node = createNode(180 /* NewExpression */);\n            parseExpected(93 /* NewKeyword */);\n            node.expression = parseMemberExpressionOrHigher();\n            node.typeArguments = tryParse(parseTypeArgumentsInExpression);\n            if (node.typeArguments || token() === 18 /* OpenParenToken */) {\n                node.arguments = parseArgumentList();\n            }\n            return finishNode(node);\n        }\n        // STATEMENTS\n        function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {\n            var node = createNode(204 /* Block */);\n            if (parseExpected(16 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) {\n                if (scanner.hasPrecedingLineBreak()) {\n                    node.multiLine = true;\n                }\n                node.statements = parseList(1 /* BlockStatements */, parseStatement);\n                parseExpected(17 /* CloseBraceToken */);\n            }\n            else {\n                node.statements = createMissingList();\n            }\n            return finishNode(node);\n        }\n        function parseFunctionBlock(allowYield, allowAwait, ignoreMissingOpenBrace, diagnosticMessage) {\n            var savedYieldContext = inYieldContext();\n            setYieldContext(allowYield);\n            var savedAwaitContext = inAwaitContext();\n            setAwaitContext(allowAwait);\n            // We may be in a [Decorator] context when parsing a function expression or\n            // arrow function. The body of the function is not in [Decorator] context.\n            var saveDecoratorContext = inDecoratorContext();\n            if (saveDecoratorContext) {\n                setDecoratorContext(/*val*/ false);\n            }\n            var block = parseBlock(ignoreMissingOpenBrace, diagnosticMessage);\n            if (saveDecoratorContext) {\n                setDecoratorContext(/*val*/ true);\n            }\n            setYieldContext(savedYieldContext);\n            setAwaitContext(savedAwaitContext);\n            return block;\n        }\n        function parseEmptyStatement() {\n            var node = createNode(206 /* EmptyStatement */);\n            parseExpected(24 /* SemicolonToken */);\n            return finishNode(node);\n        }\n        function parseIfStatement() {\n            var node = createNode(208 /* IfStatement */);\n            parseExpected(89 /* IfKeyword */);\n            parseExpected(18 /* OpenParenToken */);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19 /* CloseParenToken */);\n            node.thenStatement = parseStatement();\n            node.elseStatement = parseOptional(81 /* ElseKeyword */) ? parseStatement() : undefined;\n            return finishNode(node);\n        }\n        function parseDoStatement() {\n            var node = createNode(209 /* DoStatement */);\n            parseExpected(80 /* DoKeyword */);\n            node.statement = parseStatement();\n            parseExpected(105 /* WhileKeyword */);\n            parseExpected(18 /* OpenParenToken */);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19 /* CloseParenToken */);\n            // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html\n            // 157 min --- All allen at wirfs-brock.com CONF --- \"do{;}while(false)false\" prohibited in\n            // spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby\n            //  do;while(0)x will have a semicolon inserted before x.\n            parseOptional(24 /* SemicolonToken */);\n            return finishNode(node);\n        }\n        function parseWhileStatement() {\n            var node = createNode(210 /* WhileStatement */);\n            parseExpected(105 /* WhileKeyword */);\n            parseExpected(18 /* OpenParenToken */);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19 /* CloseParenToken */);\n            node.statement = parseStatement();\n            return finishNode(node);\n        }\n        function parseForOrForInOrForOfStatement() {\n            var pos = getNodePos();\n            parseExpected(87 /* ForKeyword */);\n            parseExpected(18 /* OpenParenToken */);\n            var initializer = undefined;\n            if (token() !== 24 /* SemicolonToken */) {\n                if (token() === 103 /* VarKeyword */ || token() === 109 /* LetKeyword */ || token() === 75 /* ConstKeyword */) {\n                    initializer = parseVariableDeclarationList(/*inForStatementInitializer*/ true);\n                }\n                else {\n                    initializer = disallowInAnd(parseExpression);\n                }\n            }\n            var forOrForInOrForOfStatement;\n            if (parseOptional(91 /* InKeyword */)) {\n                var forInStatement = createNode(212 /* ForInStatement */, pos);\n                forInStatement.initializer = initializer;\n                forInStatement.expression = allowInAnd(parseExpression);\n                parseExpected(19 /* CloseParenToken */);\n                forOrForInOrForOfStatement = forInStatement;\n            }\n            else if (parseOptional(140 /* OfKeyword */)) {\n                var forOfStatement = createNode(213 /* ForOfStatement */, pos);\n                forOfStatement.initializer = initializer;\n                forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher);\n                parseExpected(19 /* CloseParenToken */);\n                forOrForInOrForOfStatement = forOfStatement;\n            }\n            else {\n                var forStatement = createNode(211 /* ForStatement */, pos);\n                forStatement.initializer = initializer;\n                parseExpected(24 /* SemicolonToken */);\n                if (token() !== 24 /* SemicolonToken */ && token() !== 19 /* CloseParenToken */) {\n                    forStatement.condition = allowInAnd(parseExpression);\n                }\n                parseExpected(24 /* SemicolonToken */);\n                if (token() !== 19 /* CloseParenToken */) {\n                    forStatement.incrementor = allowInAnd(parseExpression);\n                }\n                parseExpected(19 /* CloseParenToken */);\n                forOrForInOrForOfStatement = forStatement;\n            }\n            forOrForInOrForOfStatement.statement = parseStatement();\n            return finishNode(forOrForInOrForOfStatement);\n        }\n        function parseBreakOrContinueStatement(kind) {\n            var node = createNode(kind);\n            parseExpected(kind === 215 /* BreakStatement */ ? 71 /* BreakKeyword */ : 76 /* ContinueKeyword */);\n            if (!canParseSemicolon()) {\n                node.label = parseIdentifier();\n            }\n            parseSemicolon();\n            return finishNode(node);\n        }\n        function parseReturnStatement() {\n            var node = createNode(216 /* ReturnStatement */);\n            parseExpected(95 /* ReturnKeyword */);\n            if (!canParseSemicolon()) {\n                node.expression = allowInAnd(parseExpression);\n            }\n            parseSemicolon();\n            return finishNode(node);\n        }\n        function parseWithStatement() {\n            var node = createNode(217 /* WithStatement */);\n            parseExpected(106 /* WithKeyword */);\n            parseExpected(18 /* OpenParenToken */);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19 /* CloseParenToken */);\n            node.statement = parseStatement();\n            return finishNode(node);\n        }\n        function parseCaseClause() {\n            var node = createNode(253 /* CaseClause */);\n            parseExpected(72 /* CaseKeyword */);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(55 /* ColonToken */);\n            node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement);\n            return finishNode(node);\n        }\n        function parseDefaultClause() {\n            var node = createNode(254 /* DefaultClause */);\n            parseExpected(78 /* DefaultKeyword */);\n            parseExpected(55 /* ColonToken */);\n            node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement);\n            return finishNode(node);\n        }\n        function parseCaseOrDefaultClause() {\n            return token() === 72 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause();\n        }\n        function parseSwitchStatement() {\n            var node = createNode(218 /* SwitchStatement */);\n            parseExpected(97 /* SwitchKeyword */);\n            parseExpected(18 /* OpenParenToken */);\n            node.expression = allowInAnd(parseExpression);\n            parseExpected(19 /* CloseParenToken */);\n            var caseBlock = createNode(232 /* CaseBlock */, scanner.getStartPos());\n            parseExpected(16 /* OpenBraceToken */);\n            caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause);\n            parseExpected(17 /* CloseBraceToken */);\n            node.caseBlock = finishNode(caseBlock);\n            return finishNode(node);\n        }\n        function parseThrowStatement() {\n            // ThrowStatement[Yield] :\n            //      throw [no LineTerminator here]Expression[In, ?Yield];\n            // Because of automatic semicolon insertion, we need to report error if this\n            // throw could be terminated with a semicolon.  Note: we can't call 'parseExpression'\n            // directly as that might consume an expression on the following line.\n            // We just return 'undefined' in that case.  The actual error will be reported in the\n            // grammar walker.\n            var node = createNode(220 /* ThrowStatement */);\n            parseExpected(99 /* ThrowKeyword */);\n            node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression);\n            parseSemicolon();\n            return finishNode(node);\n        }\n        // TODO: Review for error recovery\n        function parseTryStatement() {\n            var node = createNode(221 /* TryStatement */);\n            parseExpected(101 /* TryKeyword */);\n            node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);\n            node.catchClause = token() === 73 /* CatchKeyword */ ? parseCatchClause() : undefined;\n            // If we don't have a catch clause, then we must have a finally clause.  Try to parse\n            // one out no matter what.\n            if (!node.catchClause || token() === 86 /* FinallyKeyword */) {\n                parseExpected(86 /* FinallyKeyword */);\n                node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);\n            }\n            return finishNode(node);\n        }\n        function parseCatchClause() {\n            var result = createNode(256 /* CatchClause */);\n            parseExpected(73 /* CatchKeyword */);\n            if (parseExpected(18 /* OpenParenToken */)) {\n                result.variableDeclaration = parseVariableDeclaration();\n            }\n            parseExpected(19 /* CloseParenToken */);\n            result.block = parseBlock(/*ignoreMissingOpenBrace*/ false);\n            return finishNode(result);\n        }\n        function parseDebuggerStatement() {\n            var node = createNode(222 /* DebuggerStatement */);\n            parseExpected(77 /* DebuggerKeyword */);\n            parseSemicolon();\n            return finishNode(node);\n        }\n        function parseExpressionOrLabeledStatement() {\n            // Avoiding having to do the lookahead for a labeled statement by just trying to parse\n            // out an expression, seeing if it is identifier and then seeing if it is followed by\n            // a colon.\n            var fullStart = scanner.getStartPos();\n            var expression = allowInAnd(parseExpression);\n            if (expression.kind === 70 /* Identifier */ && parseOptional(55 /* ColonToken */)) {\n                var labeledStatement = createNode(219 /* LabeledStatement */, fullStart);\n                labeledStatement.label = expression;\n                labeledStatement.statement = parseStatement();\n                return addJSDocComment(finishNode(labeledStatement));\n            }\n            else {\n                var expressionStatement = createNode(207 /* ExpressionStatement */, fullStart);\n                expressionStatement.expression = expression;\n                parseSemicolon();\n                return addJSDocComment(finishNode(expressionStatement));\n            }\n        }\n        function nextTokenIsIdentifierOrKeywordOnSameLine() {\n            nextToken();\n            return ts.tokenIsIdentifierOrKeyword(token()) && !scanner.hasPrecedingLineBreak();\n        }\n        function nextTokenIsFunctionKeywordOnSameLine() {\n            nextToken();\n            return token() === 88 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak();\n        }\n        function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() {\n            nextToken();\n            return (ts.tokenIsIdentifierOrKeyword(token()) || token() === 8 /* NumericLiteral */) && !scanner.hasPrecedingLineBreak();\n        }\n        function isDeclaration() {\n            while (true) {\n                switch (token()) {\n                    case 103 /* VarKeyword */:\n                    case 109 /* LetKeyword */:\n                    case 75 /* ConstKeyword */:\n                    case 88 /* FunctionKeyword */:\n                    case 74 /* ClassKeyword */:\n                    case 82 /* EnumKeyword */:\n                        return true;\n                    // 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers;\n                    // however, an identifier cannot be followed by another identifier on the same line. This is what we\n                    // count on to parse out the respective declarations. For instance, we exploit this to say that\n                    //\n                    //    namespace n\n                    //\n                    // can be none other than the beginning of a namespace declaration, but need to respect that JavaScript sees\n                    //\n                    //    namespace\n                    //    n\n                    //\n                    // as the identifier 'namespace' on one line followed by the identifier 'n' on another.\n                    // We need to look one token ahead to see if it permissible to try parsing a declaration.\n                    //\n                    // *Note*: 'interface' is actually a strict mode reserved word. So while\n                    //\n                    //   \"use strict\"\n                    //   interface\n                    //   I {}\n                    //\n                    // could be legal, it would add complexity for very little gain.\n                    case 108 /* InterfaceKeyword */:\n                    case 136 /* TypeKeyword */:\n                        return nextTokenIsIdentifierOnSameLine();\n                    case 127 /* ModuleKeyword */:\n                    case 128 /* NamespaceKeyword */:\n                        return nextTokenIsIdentifierOrStringLiteralOnSameLine();\n                    case 116 /* AbstractKeyword */:\n                    case 119 /* AsyncKeyword */:\n                    case 123 /* DeclareKeyword */:\n                    case 111 /* PrivateKeyword */:\n                    case 112 /* ProtectedKeyword */:\n                    case 113 /* PublicKeyword */:\n                    case 130 /* ReadonlyKeyword */:\n                        nextToken();\n                        // ASI takes effect for this modifier.\n                        if (scanner.hasPrecedingLineBreak()) {\n                            return false;\n                        }\n                        continue;\n                    case 139 /* GlobalKeyword */:\n                        nextToken();\n                        return token() === 16 /* OpenBraceToken */ || token() === 70 /* Identifier */ || token() === 83 /* ExportKeyword */;\n                    case 90 /* ImportKeyword */:\n                        nextToken();\n                        return token() === 9 /* StringLiteral */ || token() === 38 /* AsteriskToken */ ||\n                            token() === 16 /* OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token());\n                    case 83 /* ExportKeyword */:\n                        nextToken();\n                        if (token() === 57 /* EqualsToken */ || token() === 38 /* AsteriskToken */ ||\n                            token() === 16 /* OpenBraceToken */ || token() === 78 /* DefaultKeyword */ ||\n                            token() === 117 /* AsKeyword */) {\n                            return true;\n                        }\n                        continue;\n                    case 114 /* StaticKeyword */:\n                        nextToken();\n                        continue;\n                    default:\n                        return false;\n                }\n            }\n        }\n        function isStartOfDeclaration() {\n            return lookAhead(isDeclaration);\n        }\n        function isStartOfStatement() {\n            switch (token()) {\n                case 56 /* AtToken */:\n                case 24 /* SemicolonToken */:\n                case 16 /* OpenBraceToken */:\n                case 103 /* VarKeyword */:\n                case 109 /* LetKeyword */:\n                case 88 /* FunctionKeyword */:\n                case 74 /* ClassKeyword */:\n                case 82 /* EnumKeyword */:\n                case 89 /* IfKeyword */:\n                case 80 /* DoKeyword */:\n                case 105 /* WhileKeyword */:\n                case 87 /* ForKeyword */:\n                case 76 /* ContinueKeyword */:\n                case 71 /* BreakKeyword */:\n                case 95 /* ReturnKeyword */:\n                case 106 /* WithKeyword */:\n                case 97 /* SwitchKeyword */:\n                case 99 /* ThrowKeyword */:\n                case 101 /* TryKeyword */:\n                case 77 /* DebuggerKeyword */:\n                // 'catch' and 'finally' do not actually indicate that the code is part of a statement,\n                // however, we say they are here so that we may gracefully parse them and error later.\n                case 73 /* CatchKeyword */:\n                case 86 /* FinallyKeyword */:\n                    return true;\n                case 75 /* ConstKeyword */:\n                case 83 /* ExportKeyword */:\n                case 90 /* ImportKeyword */:\n                    return isStartOfDeclaration();\n                case 119 /* AsyncKeyword */:\n                case 123 /* DeclareKeyword */:\n                case 108 /* InterfaceKeyword */:\n                case 127 /* ModuleKeyword */:\n                case 128 /* NamespaceKeyword */:\n                case 136 /* TypeKeyword */:\n                case 139 /* GlobalKeyword */:\n                    // When these don't start a declaration, they're an identifier in an expression statement\n                    return true;\n                case 113 /* PublicKeyword */:\n                case 111 /* PrivateKeyword */:\n                case 112 /* ProtectedKeyword */:\n                case 114 /* StaticKeyword */:\n                case 130 /* ReadonlyKeyword */:\n                    // When these don't start a declaration, they may be the start of a class member if an identifier\n                    // immediately follows. Otherwise they're an identifier in an expression statement.\n                    return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);\n                default:\n                    return isStartOfExpression();\n            }\n        }\n        function nextTokenIsIdentifierOrStartOfDestructuring() {\n            nextToken();\n            return isIdentifier() || token() === 16 /* OpenBraceToken */ || token() === 20 /* OpenBracketToken */;\n        }\n        function isLetDeclaration() {\n            // In ES6 'let' always starts a lexical declaration if followed by an identifier or {\n            // or [.\n            return lookAhead(nextTokenIsIdentifierOrStartOfDestructuring);\n        }\n        function parseStatement() {\n            switch (token()) {\n                case 24 /* SemicolonToken */:\n                    return parseEmptyStatement();\n                case 16 /* OpenBraceToken */:\n                    return parseBlock(/*ignoreMissingOpenBrace*/ false);\n                case 103 /* VarKeyword */:\n                    return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined);\n                case 109 /* LetKeyword */:\n                    if (isLetDeclaration()) {\n                        return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined);\n                    }\n                    break;\n                case 88 /* FunctionKeyword */:\n                    return parseFunctionDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined);\n                case 74 /* ClassKeyword */:\n                    return parseClassDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined);\n                case 89 /* IfKeyword */:\n                    return parseIfStatement();\n                case 80 /* DoKeyword */:\n                    return parseDoStatement();\n                case 105 /* WhileKeyword */:\n                    return parseWhileStatement();\n                case 87 /* ForKeyword */:\n                    return parseForOrForInOrForOfStatement();\n                case 76 /* ContinueKeyword */:\n                    return parseBreakOrContinueStatement(214 /* ContinueStatement */);\n                case 71 /* BreakKeyword */:\n                    return parseBreakOrContinueStatement(215 /* BreakStatement */);\n                case 95 /* ReturnKeyword */:\n                    return parseReturnStatement();\n                case 106 /* WithKeyword */:\n                    return parseWithStatement();\n                case 97 /* SwitchKeyword */:\n                    return parseSwitchStatement();\n                case 99 /* ThrowKeyword */:\n                    return parseThrowStatement();\n                case 101 /* TryKeyword */:\n                // Include 'catch' and 'finally' for error recovery.\n                case 73 /* CatchKeyword */:\n                case 86 /* FinallyKeyword */:\n                    return parseTryStatement();\n                case 77 /* DebuggerKeyword */:\n                    return parseDebuggerStatement();\n                case 56 /* AtToken */:\n                    return parseDeclaration();\n                case 119 /* AsyncKeyword */:\n                case 108 /* InterfaceKeyword */:\n                case 136 /* TypeKeyword */:\n                case 127 /* ModuleKeyword */:\n                case 128 /* NamespaceKeyword */:\n                case 123 /* DeclareKeyword */:\n                case 75 /* ConstKeyword */:\n                case 82 /* EnumKeyword */:\n                case 83 /* ExportKeyword */:\n                case 90 /* ImportKeyword */:\n                case 111 /* PrivateKeyword */:\n                case 112 /* ProtectedKeyword */:\n                case 113 /* PublicKeyword */:\n                case 116 /* AbstractKeyword */:\n                case 114 /* StaticKeyword */:\n                case 130 /* ReadonlyKeyword */:\n                case 139 /* GlobalKeyword */:\n                    if (isStartOfDeclaration()) {\n                        return parseDeclaration();\n                    }\n                    break;\n            }\n            return parseExpressionOrLabeledStatement();\n        }\n        function parseDeclaration() {\n            var fullStart = getNodePos();\n            var decorators = parseDecorators();\n            var modifiers = parseModifiers();\n            switch (token()) {\n                case 103 /* VarKeyword */:\n                case 109 /* LetKeyword */:\n                case 75 /* ConstKeyword */:\n                    return parseVariableStatement(fullStart, decorators, modifiers);\n                case 88 /* FunctionKeyword */:\n                    return parseFunctionDeclaration(fullStart, decorators, modifiers);\n                case 74 /* ClassKeyword */:\n                    return parseClassDeclaration(fullStart, decorators, modifiers);\n                case 108 /* InterfaceKeyword */:\n                    return parseInterfaceDeclaration(fullStart, decorators, modifiers);\n                case 136 /* TypeKeyword */:\n                    return parseTypeAliasDeclaration(fullStart, decorators, modifiers);\n                case 82 /* EnumKeyword */:\n                    return parseEnumDeclaration(fullStart, decorators, modifiers);\n                case 139 /* GlobalKeyword */:\n                case 127 /* ModuleKeyword */:\n                case 128 /* NamespaceKeyword */:\n                    return parseModuleDeclaration(fullStart, decorators, modifiers);\n                case 90 /* ImportKeyword */:\n                    return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers);\n                case 83 /* ExportKeyword */:\n                    nextToken();\n                    switch (token()) {\n                        case 78 /* DefaultKeyword */:\n                        case 57 /* EqualsToken */:\n                            return parseExportAssignment(fullStart, decorators, modifiers);\n                        case 117 /* AsKeyword */:\n                            return parseNamespaceExportDeclaration(fullStart, decorators, modifiers);\n                        default:\n                            return parseExportDeclaration(fullStart, decorators, modifiers);\n                    }\n                default:\n                    if (decorators || modifiers) {\n                        // We reached this point because we encountered decorators and/or modifiers and assumed a declaration\n                        // would follow. For recovery and error reporting purposes, return an incomplete declaration.\n                        var node = createMissingNode(244 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);\n                        node.pos = fullStart;\n                        node.decorators = decorators;\n                        node.modifiers = modifiers;\n                        return finishNode(node);\n                    }\n            }\n        }\n        function nextTokenIsIdentifierOrStringLiteralOnSameLine() {\n            nextToken();\n            return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === 9 /* StringLiteral */);\n        }\n        function parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage) {\n            if (token() !== 16 /* OpenBraceToken */ && canParseSemicolon()) {\n                parseSemicolon();\n                return;\n            }\n            return parseFunctionBlock(isGenerator, isAsync, /*ignoreMissingOpenBrace*/ false, diagnosticMessage);\n        }\n        // DECLARATIONS\n        function parseArrayBindingElement() {\n            if (token() === 25 /* CommaToken */) {\n                return createNode(198 /* OmittedExpression */);\n            }\n            var node = createNode(174 /* BindingElement */);\n            node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */);\n            node.name = parseIdentifierOrPattern();\n            node.initializer = parseBindingElementInitializer(/*inParameter*/ false);\n            return finishNode(node);\n        }\n        function parseObjectBindingElement() {\n            var node = createNode(174 /* BindingElement */);\n            node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */);\n            var tokenIsIdentifier = isIdentifier();\n            var propertyName = parsePropertyName();\n            if (tokenIsIdentifier && token() !== 55 /* ColonToken */) {\n                node.name = propertyName;\n            }\n            else {\n                parseExpected(55 /* ColonToken */);\n                node.propertyName = propertyName;\n                node.name = parseIdentifierOrPattern();\n            }\n            node.initializer = parseBindingElementInitializer(/*inParameter*/ false);\n            return finishNode(node);\n        }\n        function parseObjectBindingPattern() {\n            var node = createNode(172 /* ObjectBindingPattern */);\n            parseExpected(16 /* OpenBraceToken */);\n            node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);\n            parseExpected(17 /* CloseBraceToken */);\n            return finishNode(node);\n        }\n        function parseArrayBindingPattern() {\n            var node = createNode(173 /* ArrayBindingPattern */);\n            parseExpected(20 /* OpenBracketToken */);\n            node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);\n            parseExpected(21 /* CloseBracketToken */);\n            return finishNode(node);\n        }\n        function isIdentifierOrPattern() {\n            return token() === 16 /* OpenBraceToken */ || token() === 20 /* OpenBracketToken */ || isIdentifier();\n        }\n        function parseIdentifierOrPattern() {\n            if (token() === 20 /* OpenBracketToken */) {\n                return parseArrayBindingPattern();\n            }\n            if (token() === 16 /* OpenBraceToken */) {\n                return parseObjectBindingPattern();\n            }\n            return parseIdentifier();\n        }\n        function parseVariableDeclaration() {\n            var node = createNode(223 /* VariableDeclaration */);\n            node.name = parseIdentifierOrPattern();\n            node.type = parseTypeAnnotation();\n            if (!isInOrOfKeyword(token())) {\n                node.initializer = parseInitializer(/*inParameter*/ false);\n            }\n            return finishNode(node);\n        }\n        function parseVariableDeclarationList(inForStatementInitializer) {\n            var node = createNode(224 /* VariableDeclarationList */);\n            switch (token()) {\n                case 103 /* VarKeyword */:\n                    break;\n                case 109 /* LetKeyword */:\n                    node.flags |= 1 /* Let */;\n                    break;\n                case 75 /* ConstKeyword */:\n                    node.flags |= 2 /* Const */;\n                    break;\n                default:\n                    ts.Debug.fail();\n            }\n            nextToken();\n            // The user may have written the following:\n            //\n            //    for (let of X) { }\n            //\n            // In this case, we want to parse an empty declaration list, and then parse 'of'\n            // as a keyword. The reason this is not automatic is that 'of' is a valid identifier.\n            // So we need to look ahead to determine if 'of' should be treated as a keyword in\n            // this context.\n            // The checker will then give an error that there is an empty declaration list.\n            if (token() === 140 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) {\n                node.declarations = createMissingList();\n            }\n            else {\n                var savedDisallowIn = inDisallowInContext();\n                setDisallowInContext(inForStatementInitializer);\n                node.declarations = parseDelimitedList(8 /* VariableDeclarations */, parseVariableDeclaration);\n                setDisallowInContext(savedDisallowIn);\n            }\n            return finishNode(node);\n        }\n        function canFollowContextualOfKeyword() {\n            return nextTokenIsIdentifier() && nextToken() === 19 /* CloseParenToken */;\n        }\n        function parseVariableStatement(fullStart, decorators, modifiers) {\n            var node = createNode(205 /* VariableStatement */, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false);\n            parseSemicolon();\n            return addJSDocComment(finishNode(node));\n        }\n        function parseFunctionDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(225 /* FunctionDeclaration */, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(88 /* FunctionKeyword */);\n            node.asteriskToken = parseOptionalToken(38 /* AsteriskToken */);\n            node.name = ts.hasModifier(node, 512 /* Default */) ? parseOptionalIdentifier() : parseIdentifier();\n            var isGenerator = !!node.asteriskToken;\n            var isAsync = ts.hasModifier(node, 256 /* Async */);\n            fillSignature(55 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node);\n            node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected);\n            return addJSDocComment(finishNode(node));\n        }\n        function parseConstructorDeclaration(pos, decorators, modifiers) {\n            var node = createNode(150 /* Constructor */, pos);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(122 /* ConstructorKeyword */);\n            fillSignature(55 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node);\n            node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false, ts.Diagnostics.or_expected);\n            return addJSDocComment(finishNode(node));\n        }\n        function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) {\n            var method = createNode(149 /* MethodDeclaration */, fullStart);\n            method.decorators = decorators;\n            method.modifiers = modifiers;\n            method.asteriskToken = asteriskToken;\n            method.name = name;\n            method.questionToken = questionToken;\n            var isGenerator = !!asteriskToken;\n            var isAsync = ts.hasModifier(method, 256 /* Async */);\n            fillSignature(55 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, method);\n            method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage);\n            return addJSDocComment(finishNode(method));\n        }\n        function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) {\n            var property = createNode(147 /* PropertyDeclaration */, fullStart);\n            property.decorators = decorators;\n            property.modifiers = modifiers;\n            property.name = name;\n            property.questionToken = questionToken;\n            property.type = parseTypeAnnotation();\n            // For instance properties specifically, since they are evaluated inside the constructor,\n            // we do *not * want to parse yield expressions, so we specifically turn the yield context\n            // off. The grammar would look something like this:\n            //\n            //    MemberVariableDeclaration[Yield]:\n            //        AccessibilityModifier_opt   PropertyName   TypeAnnotation_opt   Initializer_opt[In];\n            //        AccessibilityModifier_opt  static_opt  PropertyName   TypeAnnotation_opt   Initializer_opt[In, ?Yield];\n            //\n            // The checker may still error in the static case to explicitly disallow the yield expression.\n            property.initializer = ts.hasModifier(property, 32 /* Static */)\n                ? allowInAnd(parseNonParameterInitializer)\n                : doOutsideOfContext(4096 /* YieldContext */ | 2048 /* DisallowInContext */, parseNonParameterInitializer);\n            parseSemicolon();\n            return addJSDocComment(finishNode(property));\n        }\n        function parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers) {\n            var asteriskToken = parseOptionalToken(38 /* AsteriskToken */);\n            var name = parsePropertyName();\n            // Note: this is not legal as per the grammar.  But we allow it in the parser and\n            // report an error in the grammar checker.\n            var questionToken = parseOptionalToken(54 /* QuestionToken */);\n            if (asteriskToken || token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) {\n                return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected);\n            }\n            else {\n                return parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken);\n            }\n        }\n        function parseNonParameterInitializer() {\n            return parseInitializer(/*inParameter*/ false);\n        }\n        function parseAccessorDeclaration(kind, fullStart, decorators, modifiers) {\n            var node = createNode(kind, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            node.name = parsePropertyName();\n            fillSignature(55 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node);\n            node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false);\n            return addJSDocComment(finishNode(node));\n        }\n        function isClassMemberModifier(idToken) {\n            switch (idToken) {\n                case 113 /* PublicKeyword */:\n                case 111 /* PrivateKeyword */:\n                case 112 /* ProtectedKeyword */:\n                case 114 /* StaticKeyword */:\n                case 130 /* ReadonlyKeyword */:\n                    return true;\n                default:\n                    return false;\n            }\n        }\n        function isClassMemberStart() {\n            var idToken;\n            if (token() === 56 /* AtToken */) {\n                return true;\n            }\n            // Eat up all modifiers, but hold on to the last one in case it is actually an identifier.\n            while (ts.isModifierKind(token())) {\n                idToken = token();\n                // If the idToken is a class modifier (protected, private, public, and static), it is\n                // certain that we are starting to parse class member. This allows better error recovery\n                // Example:\n                //      public foo() ...     // true\n                //      public @dec blah ... // true; we will then report an error later\n                //      export public ...    // true; we will then report an error later\n                if (isClassMemberModifier(idToken)) {\n                    return true;\n                }\n                nextToken();\n            }\n            if (token() === 38 /* AsteriskToken */) {\n                return true;\n            }\n            // Try to get the first property-like token following all modifiers.\n            // This can either be an identifier or the 'get' or 'set' keywords.\n            if (isLiteralPropertyName()) {\n                idToken = token();\n                nextToken();\n            }\n            // Index signatures and computed properties are class members; we can parse.\n            if (token() === 20 /* OpenBracketToken */) {\n                return true;\n            }\n            // If we were able to get any potential identifier...\n            if (idToken !== undefined) {\n                // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse.\n                if (!ts.isKeyword(idToken) || idToken === 133 /* SetKeyword */ || idToken === 124 /* GetKeyword */) {\n                    return true;\n                }\n                // If it *is* a keyword, but not an accessor, check a little farther along\n                // to see if it should actually be parsed as a class member.\n                switch (token()) {\n                    case 18 /* OpenParenToken */: // Method declaration\n                    case 26 /* LessThanToken */: // Generic Method declaration\n                    case 55 /* ColonToken */: // Type Annotation for declaration\n                    case 57 /* EqualsToken */: // Initializer for declaration\n                    case 54 /* QuestionToken */:\n                        return true;\n                    default:\n                        // Covers\n                        //  - Semicolons     (declaration termination)\n                        //  - Closing braces (end-of-class, must be declaration)\n                        //  - End-of-files   (not valid, but permitted so that it gets caught later on)\n                        //  - Line-breaks    (enabling *automatic semicolon insertion*)\n                        return canParseSemicolon();\n                }\n            }\n            return false;\n        }\n        function parseDecorators() {\n            var decorators;\n            while (true) {\n                var decoratorStart = getNodePos();\n                if (!parseOptional(56 /* AtToken */)) {\n                    break;\n                }\n                var decorator = createNode(145 /* Decorator */, decoratorStart);\n                decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher);\n                finishNode(decorator);\n                if (!decorators) {\n                    decorators = createNodeArray([decorator], decoratorStart);\n                }\n                else {\n                    decorators.push(decorator);\n                }\n            }\n            if (decorators) {\n                decorators.end = getNodeEnd();\n            }\n            return decorators;\n        }\n        /*\n         * There are situations in which a modifier like 'const' will appear unexpectedly, such as on a class member.\n         * In those situations, if we are entirely sure that 'const' is not valid on its own (such as when ASI takes effect\n         * and turns it into a standalone declaration), then it is better to parse it and report an error later.\n         *\n         * In such situations, 'permitInvalidConstAsModifier' should be set to true.\n         */\n        function parseModifiers(permitInvalidConstAsModifier) {\n            var modifiers;\n            while (true) {\n                var modifierStart = scanner.getStartPos();\n                var modifierKind = token();\n                if (token() === 75 /* ConstKeyword */ && permitInvalidConstAsModifier) {\n                    // We need to ensure that any subsequent modifiers appear on the same line\n                    // so that when 'const' is a standalone declaration, we don't issue an error.\n                    if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) {\n                        break;\n                    }\n                }\n                else {\n                    if (!parseAnyContextualModifier()) {\n                        break;\n                    }\n                }\n                var modifier = finishNode(createNode(modifierKind, modifierStart));\n                if (!modifiers) {\n                    modifiers = createNodeArray([modifier], modifierStart);\n                }\n                else {\n                    modifiers.push(modifier);\n                }\n            }\n            if (modifiers) {\n                modifiers.end = scanner.getStartPos();\n            }\n            return modifiers;\n        }\n        function parseModifiersForArrowFunction() {\n            var modifiers;\n            if (token() === 119 /* AsyncKeyword */) {\n                var modifierStart = scanner.getStartPos();\n                var modifierKind = token();\n                nextToken();\n                var modifier = finishNode(createNode(modifierKind, modifierStart));\n                modifiers = createNodeArray([modifier], modifierStart);\n                modifiers.end = scanner.getStartPos();\n            }\n            return modifiers;\n        }\n        function parseClassElement() {\n            if (token() === 24 /* SemicolonToken */) {\n                var result = createNode(203 /* SemicolonClassElement */);\n                nextToken();\n                return finishNode(result);\n            }\n            var fullStart = getNodePos();\n            var decorators = parseDecorators();\n            var modifiers = parseModifiers(/*permitInvalidConstAsModifier*/ true);\n            var accessor = tryParseAccessorDeclaration(fullStart, decorators, modifiers);\n            if (accessor) {\n                return accessor;\n            }\n            if (token() === 122 /* ConstructorKeyword */) {\n                return parseConstructorDeclaration(fullStart, decorators, modifiers);\n            }\n            if (isIndexSignature()) {\n                return parseIndexSignatureDeclaration(fullStart, decorators, modifiers);\n            }\n            // It is very important that we check this *after* checking indexers because\n            // the [ token can start an index signature or a computed property name\n            if (ts.tokenIsIdentifierOrKeyword(token()) ||\n                token() === 9 /* StringLiteral */ ||\n                token() === 8 /* NumericLiteral */ ||\n                token() === 38 /* AsteriskToken */ ||\n                token() === 20 /* OpenBracketToken */) {\n                return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers);\n            }\n            if (decorators || modifiers) {\n                // treat this as a property declaration with a missing name.\n                var name_13 = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);\n                return parsePropertyDeclaration(fullStart, decorators, modifiers, name_13, /*questionToken*/ undefined);\n            }\n            // 'isClassMemberStart' should have hinted not to attempt parsing.\n            ts.Debug.fail(\"Should not have attempted to parse class member declaration.\");\n        }\n        function parseClassExpression() {\n            return parseClassDeclarationOrExpression(\n            /*fullStart*/ scanner.getStartPos(), \n            /*decorators*/ undefined, \n            /*modifiers*/ undefined, 197 /* ClassExpression */);\n        }\n        function parseClassDeclaration(fullStart, decorators, modifiers) {\n            return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 226 /* ClassDeclaration */);\n        }\n        function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) {\n            var node = createNode(kind, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(74 /* ClassKeyword */);\n            node.name = parseNameOfClassDeclarationOrExpression();\n            node.typeParameters = parseTypeParameters();\n            node.heritageClauses = parseHeritageClauses();\n            if (parseExpected(16 /* OpenBraceToken */)) {\n                // ClassTail[Yield,Await] : (Modified) See 14.5\n                //      ClassHeritage[?Yield,?Await]opt { ClassBody[?Yield,?Await]opt }\n                node.members = parseClassMembers();\n                parseExpected(17 /* CloseBraceToken */);\n            }\n            else {\n                node.members = createMissingList();\n            }\n            return addJSDocComment(finishNode(node));\n        }\n        function parseNameOfClassDeclarationOrExpression() {\n            // implements is a future reserved word so\n            // 'class implements' might mean either\n            // - class expression with omitted name, 'implements' starts heritage clause\n            // - class with name 'implements'\n            // 'isImplementsClause' helps to disambiguate between these two cases\n            return isIdentifier() && !isImplementsClause()\n                ? parseIdentifier()\n                : undefined;\n        }\n        function isImplementsClause() {\n            return token() === 107 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword);\n        }\n        function parseHeritageClauses() {\n            // ClassTail[Yield,Await] : (Modified) See 14.5\n            //      ClassHeritage[?Yield,?Await]opt { ClassBody[?Yield,?Await]opt }\n            if (isHeritageClause()) {\n                return parseList(21 /* HeritageClauses */, parseHeritageClause);\n            }\n            return undefined;\n        }\n        function parseHeritageClause() {\n            if (token() === 84 /* ExtendsKeyword */ || token() === 107 /* ImplementsKeyword */) {\n                var node = createNode(255 /* HeritageClause */);\n                node.token = token();\n                nextToken();\n                node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments);\n                return finishNode(node);\n            }\n            return undefined;\n        }\n        function parseExpressionWithTypeArguments() {\n            var node = createNode(199 /* ExpressionWithTypeArguments */);\n            node.expression = parseLeftHandSideExpressionOrHigher();\n            if (token() === 26 /* LessThanToken */) {\n                node.typeArguments = parseBracketedList(19 /* TypeArguments */, parseType, 26 /* LessThanToken */, 28 /* GreaterThanToken */);\n            }\n            return finishNode(node);\n        }\n        function isHeritageClause() {\n            return token() === 84 /* ExtendsKeyword */ || token() === 107 /* ImplementsKeyword */;\n        }\n        function parseClassMembers() {\n            return parseList(5 /* ClassMembers */, parseClassElement);\n        }\n        function parseInterfaceDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(227 /* InterfaceDeclaration */, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(108 /* InterfaceKeyword */);\n            node.name = parseIdentifier();\n            node.typeParameters = parseTypeParameters();\n            node.heritageClauses = parseHeritageClauses();\n            node.members = parseObjectTypeMembers();\n            return addJSDocComment(finishNode(node));\n        }\n        function parseTypeAliasDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(228 /* TypeAliasDeclaration */, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(136 /* TypeKeyword */);\n            node.name = parseIdentifier();\n            node.typeParameters = parseTypeParameters();\n            parseExpected(57 /* EqualsToken */);\n            node.type = parseType();\n            parseSemicolon();\n            return addJSDocComment(finishNode(node));\n        }\n        // In an ambient declaration, the grammar only allows integer literals as initializers.\n        // In a non-ambient declaration, the grammar allows uninitialized members only in a\n        // ConstantEnumMemberSection, which starts at the beginning of an enum declaration\n        // or any time an integer literal initializer is encountered.\n        function parseEnumMember() {\n            var node = createNode(260 /* EnumMember */, scanner.getStartPos());\n            node.name = parsePropertyName();\n            node.initializer = allowInAnd(parseNonParameterInitializer);\n            return addJSDocComment(finishNode(node));\n        }\n        function parseEnumDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(229 /* EnumDeclaration */, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            parseExpected(82 /* EnumKeyword */);\n            node.name = parseIdentifier();\n            if (parseExpected(16 /* OpenBraceToken */)) {\n                node.members = parseDelimitedList(6 /* EnumMembers */, parseEnumMember);\n                parseExpected(17 /* CloseBraceToken */);\n            }\n            else {\n                node.members = createMissingList();\n            }\n            return addJSDocComment(finishNode(node));\n        }\n        function parseModuleBlock() {\n            var node = createNode(231 /* ModuleBlock */, scanner.getStartPos());\n            if (parseExpected(16 /* OpenBraceToken */)) {\n                node.statements = parseList(1 /* BlockStatements */, parseStatement);\n                parseExpected(17 /* CloseBraceToken */);\n            }\n            else {\n                node.statements = createMissingList();\n            }\n            return finishNode(node);\n        }\n        function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) {\n            var node = createNode(230 /* ModuleDeclaration */, fullStart);\n            // If we are parsing a dotted namespace name, we want to\n            // propagate the 'Namespace' flag across the names if set.\n            var namespaceFlag = flags & 16 /* Namespace */;\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            node.flags |= flags;\n            node.name = parseIdentifier();\n            node.body = parseOptional(22 /* DotToken */)\n                ? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, 4 /* NestedNamespace */ | namespaceFlag)\n                : parseModuleBlock();\n            return addJSDocComment(finishNode(node));\n        }\n        function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(230 /* ModuleDeclaration */, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            if (token() === 139 /* GlobalKeyword */) {\n                // parse 'global' as name of global scope augmentation\n                node.name = parseIdentifier();\n                node.flags |= 512 /* GlobalAugmentation */;\n            }\n            else {\n                node.name = parseLiteralNode(/*internName*/ true);\n            }\n            if (token() === 16 /* OpenBraceToken */) {\n                node.body = parseModuleBlock();\n            }\n            else {\n                parseSemicolon();\n            }\n            return finishNode(node);\n        }\n        function parseModuleDeclaration(fullStart, decorators, modifiers) {\n            var flags = 0;\n            if (token() === 139 /* GlobalKeyword */) {\n                // global augmentation\n                return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers);\n            }\n            else if (parseOptional(128 /* NamespaceKeyword */)) {\n                flags |= 16 /* Namespace */;\n            }\n            else {\n                parseExpected(127 /* ModuleKeyword */);\n                if (token() === 9 /* StringLiteral */) {\n                    return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers);\n                }\n            }\n            return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags);\n        }\n        function isExternalModuleReference() {\n            return token() === 131 /* RequireKeyword */ &&\n                lookAhead(nextTokenIsOpenParen);\n        }\n        function nextTokenIsOpenParen() {\n            return nextToken() === 18 /* OpenParenToken */;\n        }\n        function nextTokenIsSlash() {\n            return nextToken() === 40 /* SlashToken */;\n        }\n        function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) {\n            var exportDeclaration = createNode(233 /* NamespaceExportDeclaration */, fullStart);\n            exportDeclaration.decorators = decorators;\n            exportDeclaration.modifiers = modifiers;\n            parseExpected(117 /* AsKeyword */);\n            parseExpected(128 /* NamespaceKeyword */);\n            exportDeclaration.name = parseIdentifier();\n            parseSemicolon();\n            return finishNode(exportDeclaration);\n        }\n        function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) {\n            parseExpected(90 /* ImportKeyword */);\n            var afterImportPos = scanner.getStartPos();\n            var identifier;\n            if (isIdentifier()) {\n                identifier = parseIdentifier();\n                if (token() !== 25 /* CommaToken */ && token() !== 138 /* FromKeyword */) {\n                    // ImportEquals declaration of type:\n                    // import x = require(\"mod\"); or\n                    // import x = M.x;\n                    var importEqualsDeclaration = createNode(234 /* ImportEqualsDeclaration */, fullStart);\n                    importEqualsDeclaration.decorators = decorators;\n                    importEqualsDeclaration.modifiers = modifiers;\n                    importEqualsDeclaration.name = identifier;\n                    parseExpected(57 /* EqualsToken */);\n                    importEqualsDeclaration.moduleReference = parseModuleReference();\n                    parseSemicolon();\n                    return addJSDocComment(finishNode(importEqualsDeclaration));\n                }\n            }\n            // Import statement\n            var importDeclaration = createNode(235 /* ImportDeclaration */, fullStart);\n            importDeclaration.decorators = decorators;\n            importDeclaration.modifiers = modifiers;\n            // ImportDeclaration:\n            //  import ImportClause from ModuleSpecifier ;\n            //  import ModuleSpecifier;\n            if (identifier ||\n                token() === 38 /* AsteriskToken */ ||\n                token() === 16 /* OpenBraceToken */) {\n                importDeclaration.importClause = parseImportClause(identifier, afterImportPos);\n                parseExpected(138 /* FromKeyword */);\n            }\n            importDeclaration.moduleSpecifier = parseModuleSpecifier();\n            parseSemicolon();\n            return finishNode(importDeclaration);\n        }\n        function parseImportClause(identifier, fullStart) {\n            // ImportClause:\n            //  ImportedDefaultBinding\n            //  NameSpaceImport\n            //  NamedImports\n            //  ImportedDefaultBinding, NameSpaceImport\n            //  ImportedDefaultBinding, NamedImports\n            var importClause = createNode(236 /* ImportClause */, fullStart);\n            if (identifier) {\n                // ImportedDefaultBinding:\n                //  ImportedBinding\n                importClause.name = identifier;\n            }\n            // If there was no default import or if there is comma token after default import\n            // parse namespace or named imports\n            if (!importClause.name ||\n                parseOptional(25 /* CommaToken */)) {\n                importClause.namedBindings = token() === 38 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(238 /* NamedImports */);\n            }\n            return finishNode(importClause);\n        }\n        function parseModuleReference() {\n            return isExternalModuleReference()\n                ? parseExternalModuleReference()\n                : parseEntityName(/*allowReservedWords*/ false);\n        }\n        function parseExternalModuleReference() {\n            var node = createNode(245 /* ExternalModuleReference */);\n            parseExpected(131 /* RequireKeyword */);\n            parseExpected(18 /* OpenParenToken */);\n            node.expression = parseModuleSpecifier();\n            parseExpected(19 /* CloseParenToken */);\n            return finishNode(node);\n        }\n        function parseModuleSpecifier() {\n            if (token() === 9 /* StringLiteral */) {\n                var result = parseLiteralNode();\n                internIdentifier(result.text);\n                return result;\n            }\n            else {\n                // We allow arbitrary expressions here, even though the grammar only allows string\n                // literals.  We check to ensure that it is only a string literal later in the grammar\n                // check pass.\n                return parseExpression();\n            }\n        }\n        function parseNamespaceImport() {\n            // NameSpaceImport:\n            //  * as ImportedBinding\n            var namespaceImport = createNode(237 /* NamespaceImport */);\n            parseExpected(38 /* AsteriskToken */);\n            parseExpected(117 /* AsKeyword */);\n            namespaceImport.name = parseIdentifier();\n            return finishNode(namespaceImport);\n        }\n        function parseNamedImportsOrExports(kind) {\n            var node = createNode(kind);\n            // NamedImports:\n            //  { }\n            //  { ImportsList }\n            //  { ImportsList, }\n            // ImportsList:\n            //  ImportSpecifier\n            //  ImportsList, ImportSpecifier\n            node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 238 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 16 /* OpenBraceToken */, 17 /* CloseBraceToken */);\n            return finishNode(node);\n        }\n        function parseExportSpecifier() {\n            return parseImportOrExportSpecifier(243 /* ExportSpecifier */);\n        }\n        function parseImportSpecifier() {\n            return parseImportOrExportSpecifier(239 /* ImportSpecifier */);\n        }\n        function parseImportOrExportSpecifier(kind) {\n            var node = createNode(kind);\n            // ImportSpecifier:\n            //   BindingIdentifier\n            //   IdentifierName as BindingIdentifier\n            // ExportSpecifier:\n            //   IdentifierName\n            //   IdentifierName as IdentifierName\n            var checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();\n            var checkIdentifierStart = scanner.getTokenPos();\n            var checkIdentifierEnd = scanner.getTextPos();\n            var identifierName = parseIdentifierName();\n            if (token() === 117 /* AsKeyword */) {\n                node.propertyName = identifierName;\n                parseExpected(117 /* AsKeyword */);\n                checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();\n                checkIdentifierStart = scanner.getTokenPos();\n                checkIdentifierEnd = scanner.getTextPos();\n                node.name = parseIdentifierName();\n            }\n            else {\n                node.name = identifierName;\n            }\n            if (kind === 239 /* ImportSpecifier */ && checkIdentifierIsKeyword) {\n                // Report error identifier expected\n                parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected);\n            }\n            return finishNode(node);\n        }\n        function parseExportDeclaration(fullStart, decorators, modifiers) {\n            var node = createNode(241 /* ExportDeclaration */, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            if (parseOptional(38 /* AsteriskToken */)) {\n                parseExpected(138 /* FromKeyword */);\n                node.moduleSpecifier = parseModuleSpecifier();\n            }\n            else {\n                node.exportClause = parseNamedImportsOrExports(242 /* NamedExports */);\n                // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios,\n                // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from \"moduleName\";`)\n                // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect.\n                if (token() === 138 /* FromKeyword */ || (token() === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) {\n                    parseExpected(138 /* FromKeyword */);\n                    node.moduleSpecifier = parseModuleSpecifier();\n                }\n            }\n            parseSemicolon();\n            return finishNode(node);\n        }\n        function parseExportAssignment(fullStart, decorators, modifiers) {\n            var node = createNode(240 /* ExportAssignment */, fullStart);\n            node.decorators = decorators;\n            node.modifiers = modifiers;\n            if (parseOptional(57 /* EqualsToken */)) {\n                node.isExportEquals = true;\n            }\n            else {\n                parseExpected(78 /* DefaultKeyword */);\n            }\n            node.expression = parseAssignmentExpressionOrHigher();\n            parseSemicolon();\n            return finishNode(node);\n        }\n        function processReferenceComments(sourceFile) {\n            var triviaScanner = ts.createScanner(sourceFile.languageVersion, /*skipTrivia*/ false, 0 /* Standard */, sourceText);\n            var referencedFiles = [];\n            var typeReferenceDirectives = [];\n            var amdDependencies = [];\n            var amdModuleName;\n            // Keep scanning all the leading trivia in the file until we get to something that\n            // isn't trivia.  Any single line comment will be analyzed to see if it is a\n            // reference comment.\n            while (true) {\n                var kind = triviaScanner.scan();\n                if (kind !== 2 /* SingleLineCommentTrivia */) {\n                    if (ts.isTrivia(kind)) {\n                        continue;\n                    }\n                    else {\n                        break;\n                    }\n                }\n                var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos(), kind: triviaScanner.getToken() };\n                var comment = sourceText.substring(range.pos, range.end);\n                var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range);\n                if (referencePathMatchResult) {\n                    var fileReference = referencePathMatchResult.fileReference;\n                    sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib;\n                    var diagnosticMessage = referencePathMatchResult.diagnosticMessage;\n                    if (fileReference) {\n                        if (referencePathMatchResult.isTypeReferenceDirective) {\n                            typeReferenceDirectives.push(fileReference);\n                        }\n                        else {\n                            referencedFiles.push(fileReference);\n                        }\n                    }\n                    if (diagnosticMessage) {\n                        parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage));\n                    }\n                }\n                else {\n                    var amdModuleNameRegEx = /^\\/\\/\\/\\s*<amd-module\\s+name\\s*=\\s*('|\")(.+?)\\1/gim;\n                    var amdModuleNameMatchResult = amdModuleNameRegEx.exec(comment);\n                    if (amdModuleNameMatchResult) {\n                        if (amdModuleName) {\n                            parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, ts.Diagnostics.An_AMD_module_cannot_have_multiple_name_assignments));\n                        }\n                        amdModuleName = amdModuleNameMatchResult[2];\n                    }\n                    var amdDependencyRegEx = /^\\/\\/\\/\\s*<amd-dependency\\s/gim;\n                    var pathRegex = /\\spath\\s*=\\s*('|\")(.+?)\\1/gim;\n                    var nameRegex = /\\sname\\s*=\\s*('|\")(.+?)\\1/gim;\n                    var amdDependencyMatchResult = amdDependencyRegEx.exec(comment);\n                    if (amdDependencyMatchResult) {\n                        var pathMatchResult = pathRegex.exec(comment);\n                        var nameMatchResult = nameRegex.exec(comment);\n                        if (pathMatchResult) {\n                            var amdDependency = { path: pathMatchResult[2], name: nameMatchResult ? nameMatchResult[2] : undefined };\n                            amdDependencies.push(amdDependency);\n                        }\n                    }\n                }\n            }\n            sourceFile.referencedFiles = referencedFiles;\n            sourceFile.typeReferenceDirectives = typeReferenceDirectives;\n            sourceFile.amdDependencies = amdDependencies;\n            sourceFile.moduleName = amdModuleName;\n        }\n        function setExternalModuleIndicator(sourceFile) {\n            sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) {\n                return ts.hasModifier(node, 1 /* Export */)\n                    || node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 245 /* ExternalModuleReference */\n                    || node.kind === 235 /* ImportDeclaration */\n                    || node.kind === 240 /* ExportAssignment */\n                    || node.kind === 241 /* ExportDeclaration */\n                    ? node\n                    : undefined;\n            });\n        }\n        var ParsingContext;\n        (function (ParsingContext) {\n            ParsingContext[ParsingContext[\"SourceElements\"] = 0] = \"SourceElements\";\n            ParsingContext[ParsingContext[\"BlockStatements\"] = 1] = \"BlockStatements\";\n            ParsingContext[ParsingContext[\"SwitchClauses\"] = 2] = \"SwitchClauses\";\n            ParsingContext[ParsingContext[\"SwitchClauseStatements\"] = 3] = \"SwitchClauseStatements\";\n            ParsingContext[ParsingContext[\"TypeMembers\"] = 4] = \"TypeMembers\";\n            ParsingContext[ParsingContext[\"ClassMembers\"] = 5] = \"ClassMembers\";\n            ParsingContext[ParsingContext[\"EnumMembers\"] = 6] = \"EnumMembers\";\n            ParsingContext[ParsingContext[\"HeritageClauseElement\"] = 7] = \"HeritageClauseElement\";\n            ParsingContext[ParsingContext[\"VariableDeclarations\"] = 8] = \"VariableDeclarations\";\n            ParsingContext[ParsingContext[\"ObjectBindingElements\"] = 9] = \"ObjectBindingElements\";\n            ParsingContext[ParsingContext[\"ArrayBindingElements\"] = 10] = \"ArrayBindingElements\";\n            ParsingContext[ParsingContext[\"ArgumentExpressions\"] = 11] = \"ArgumentExpressions\";\n            ParsingContext[ParsingContext[\"ObjectLiteralMembers\"] = 12] = \"ObjectLiteralMembers\";\n            ParsingContext[ParsingContext[\"JsxAttributes\"] = 13] = \"JsxAttributes\";\n            ParsingContext[ParsingContext[\"JsxChildren\"] = 14] = \"JsxChildren\";\n            ParsingContext[ParsingContext[\"ArrayLiteralMembers\"] = 15] = \"ArrayLiteralMembers\";\n            ParsingContext[ParsingContext[\"Parameters\"] = 16] = \"Parameters\";\n            ParsingContext[ParsingContext[\"RestProperties\"] = 17] = \"RestProperties\";\n            ParsingContext[ParsingContext[\"TypeParameters\"] = 18] = \"TypeParameters\";\n            ParsingContext[ParsingContext[\"TypeArguments\"] = 19] = \"TypeArguments\";\n            ParsingContext[ParsingContext[\"TupleElementTypes\"] = 20] = \"TupleElementTypes\";\n            ParsingContext[ParsingContext[\"HeritageClauses\"] = 21] = \"HeritageClauses\";\n            ParsingContext[ParsingContext[\"ImportOrExportSpecifiers\"] = 22] = \"ImportOrExportSpecifiers\";\n            ParsingContext[ParsingContext[\"JSDocFunctionParameters\"] = 23] = \"JSDocFunctionParameters\";\n            ParsingContext[ParsingContext[\"JSDocTypeArguments\"] = 24] = \"JSDocTypeArguments\";\n            ParsingContext[ParsingContext[\"JSDocRecordMembers\"] = 25] = \"JSDocRecordMembers\";\n            ParsingContext[ParsingContext[\"JSDocTupleTypes\"] = 26] = \"JSDocTupleTypes\";\n            ParsingContext[ParsingContext[\"Count\"] = 27] = \"Count\"; // Number of parsing contexts\n        })(ParsingContext || (ParsingContext = {}));\n        var Tristate;\n        (function (Tristate) {\n            Tristate[Tristate[\"False\"] = 0] = \"False\";\n            Tristate[Tristate[\"True\"] = 1] = \"True\";\n            Tristate[Tristate[\"Unknown\"] = 2] = \"Unknown\";\n        })(Tristate || (Tristate = {}));\n        var JSDocParser;\n        (function (JSDocParser) {\n            function isJSDocType() {\n                switch (token()) {\n                    case 38 /* AsteriskToken */:\n                    case 54 /* QuestionToken */:\n                    case 18 /* OpenParenToken */:\n                    case 20 /* OpenBracketToken */:\n                    case 50 /* ExclamationToken */:\n                    case 16 /* OpenBraceToken */:\n                    case 88 /* FunctionKeyword */:\n                    case 23 /* DotDotDotToken */:\n                    case 93 /* NewKeyword */:\n                    case 98 /* ThisKeyword */:\n                        return true;\n                }\n                return ts.tokenIsIdentifierOrKeyword(token());\n            }\n            JSDocParser.isJSDocType = isJSDocType;\n            function parseJSDocTypeExpressionForTests(content, start, length) {\n                initializeState(content, 5 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);\n                sourceFile = createSourceFile(\"file.js\", 5 /* Latest */, 1 /* JS */);\n                scanner.setText(content, start, length);\n                currentToken = scanner.scan();\n                var jsDocTypeExpression = parseJSDocTypeExpression();\n                var diagnostics = parseDiagnostics;\n                clearState();\n                return jsDocTypeExpression ? { jsDocTypeExpression: jsDocTypeExpression, diagnostics: diagnostics } : undefined;\n            }\n            JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;\n            // Parses out a JSDoc type expression.\n            /* @internal */\n            function parseJSDocTypeExpression() {\n                var result = createNode(262 /* JSDocTypeExpression */, scanner.getTokenPos());\n                parseExpected(16 /* OpenBraceToken */);\n                result.type = parseJSDocTopLevelType();\n                parseExpected(17 /* CloseBraceToken */);\n                fixupParentReferences(result);\n                return finishNode(result);\n            }\n            JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;\n            function parseJSDocTopLevelType() {\n                var type = parseJSDocType();\n                if (token() === 48 /* BarToken */) {\n                    var unionType = createNode(266 /* JSDocUnionType */, type.pos);\n                    unionType.types = parseJSDocTypeList(type);\n                    type = finishNode(unionType);\n                }\n                if (token() === 57 /* EqualsToken */) {\n                    var optionalType = createNode(273 /* JSDocOptionalType */, type.pos);\n                    nextToken();\n                    optionalType.type = type;\n                    type = finishNode(optionalType);\n                }\n                return type;\n            }\n            function parseJSDocType() {\n                var type = parseBasicTypeExpression();\n                while (true) {\n                    if (token() === 20 /* OpenBracketToken */) {\n                        var arrayType = createNode(265 /* JSDocArrayType */, type.pos);\n                        arrayType.elementType = type;\n                        nextToken();\n                        parseExpected(21 /* CloseBracketToken */);\n                        type = finishNode(arrayType);\n                    }\n                    else if (token() === 54 /* QuestionToken */) {\n                        var nullableType = createNode(268 /* JSDocNullableType */, type.pos);\n                        nullableType.type = type;\n                        nextToken();\n                        type = finishNode(nullableType);\n                    }\n                    else if (token() === 50 /* ExclamationToken */) {\n                        var nonNullableType = createNode(269 /* JSDocNonNullableType */, type.pos);\n                        nonNullableType.type = type;\n                        nextToken();\n                        type = finishNode(nonNullableType);\n                    }\n                    else {\n                        break;\n                    }\n                }\n                return type;\n            }\n            function parseBasicTypeExpression() {\n                switch (token()) {\n                    case 38 /* AsteriskToken */:\n                        return parseJSDocAllType();\n                    case 54 /* QuestionToken */:\n                        return parseJSDocUnknownOrNullableType();\n                    case 18 /* OpenParenToken */:\n                        return parseJSDocUnionType();\n                    case 20 /* OpenBracketToken */:\n                        return parseJSDocTupleType();\n                    case 50 /* ExclamationToken */:\n                        return parseJSDocNonNullableType();\n                    case 16 /* OpenBraceToken */:\n                        return parseJSDocRecordType();\n                    case 88 /* FunctionKeyword */:\n                        return parseJSDocFunctionType();\n                    case 23 /* DotDotDotToken */:\n                        return parseJSDocVariadicType();\n                    case 93 /* NewKeyword */:\n                        return parseJSDocConstructorType();\n                    case 98 /* ThisKeyword */:\n                        return parseJSDocThisType();\n                    case 118 /* AnyKeyword */:\n                    case 134 /* StringKeyword */:\n                    case 132 /* NumberKeyword */:\n                    case 121 /* BooleanKeyword */:\n                    case 135 /* SymbolKeyword */:\n                    case 104 /* VoidKeyword */:\n                    case 94 /* NullKeyword */:\n                    case 137 /* UndefinedKeyword */:\n                    case 129 /* NeverKeyword */:\n                        return parseTokenNode();\n                    case 9 /* StringLiteral */:\n                    case 8 /* NumericLiteral */:\n                    case 100 /* TrueKeyword */:\n                    case 85 /* FalseKeyword */:\n                        return parseJSDocLiteralType();\n                }\n                return parseJSDocTypeReference();\n            }\n            function parseJSDocThisType() {\n                var result = createNode(277 /* JSDocThisType */);\n                nextToken();\n                parseExpected(55 /* ColonToken */);\n                result.type = parseJSDocType();\n                return finishNode(result);\n            }\n            function parseJSDocConstructorType() {\n                var result = createNode(276 /* JSDocConstructorType */);\n                nextToken();\n                parseExpected(55 /* ColonToken */);\n                result.type = parseJSDocType();\n                return finishNode(result);\n            }\n            function parseJSDocVariadicType() {\n                var result = createNode(275 /* JSDocVariadicType */);\n                nextToken();\n                result.type = parseJSDocType();\n                return finishNode(result);\n            }\n            function parseJSDocFunctionType() {\n                var result = createNode(274 /* JSDocFunctionType */);\n                nextToken();\n                parseExpected(18 /* OpenParenToken */);\n                result.parameters = parseDelimitedList(23 /* JSDocFunctionParameters */, parseJSDocParameter);\n                checkForTrailingComma(result.parameters);\n                parseExpected(19 /* CloseParenToken */);\n                if (token() === 55 /* ColonToken */) {\n                    nextToken();\n                    result.type = parseJSDocType();\n                }\n                return finishNode(result);\n            }\n            function parseJSDocParameter() {\n                var parameter = createNode(144 /* Parameter */);\n                parameter.type = parseJSDocType();\n                if (parseOptional(57 /* EqualsToken */)) {\n                    // TODO(rbuckton): Can this be changed to SyntaxKind.QuestionToken?\n                    parameter.questionToken = createNode(57 /* EqualsToken */);\n                }\n                return finishNode(parameter);\n            }\n            function parseJSDocTypeReference() {\n                var result = createNode(272 /* JSDocTypeReference */);\n                result.name = parseSimplePropertyName();\n                if (token() === 26 /* LessThanToken */) {\n                    result.typeArguments = parseTypeArguments();\n                }\n                else {\n                    while (parseOptional(22 /* DotToken */)) {\n                        if (token() === 26 /* LessThanToken */) {\n                            result.typeArguments = parseTypeArguments();\n                            break;\n                        }\n                        else {\n                            result.name = parseQualifiedName(result.name);\n                        }\n                    }\n                }\n                return finishNode(result);\n            }\n            function parseTypeArguments() {\n                // Move past the <\n                nextToken();\n                var typeArguments = parseDelimitedList(24 /* JSDocTypeArguments */, parseJSDocType);\n                checkForTrailingComma(typeArguments);\n                checkForEmptyTypeArgumentList(typeArguments);\n                parseExpected(28 /* GreaterThanToken */);\n                return typeArguments;\n            }\n            function checkForEmptyTypeArgumentList(typeArguments) {\n                if (parseDiagnostics.length === 0 && typeArguments && typeArguments.length === 0) {\n                    var start = typeArguments.pos - \"<\".length;\n                    var end = ts.skipTrivia(sourceText, typeArguments.end) + \">\".length;\n                    return parseErrorAtPosition(start, end - start, ts.Diagnostics.Type_argument_list_cannot_be_empty);\n                }\n            }\n            function parseQualifiedName(left) {\n                var result = createNode(141 /* QualifiedName */, left.pos);\n                result.left = left;\n                result.right = parseIdentifierName();\n                return finishNode(result);\n            }\n            function parseJSDocRecordType() {\n                var result = createNode(270 /* JSDocRecordType */);\n                result.literal = parseTypeLiteral();\n                return finishNode(result);\n            }\n            function parseJSDocNonNullableType() {\n                var result = createNode(269 /* JSDocNonNullableType */);\n                nextToken();\n                result.type = parseJSDocType();\n                return finishNode(result);\n            }\n            function parseJSDocTupleType() {\n                var result = createNode(267 /* JSDocTupleType */);\n                nextToken();\n                result.types = parseDelimitedList(26 /* JSDocTupleTypes */, parseJSDocType);\n                checkForTrailingComma(result.types);\n                parseExpected(21 /* CloseBracketToken */);\n                return finishNode(result);\n            }\n            function checkForTrailingComma(list) {\n                if (parseDiagnostics.length === 0 && list.hasTrailingComma) {\n                    var start = list.end - \",\".length;\n                    parseErrorAtPosition(start, \",\".length, ts.Diagnostics.Trailing_comma_not_allowed);\n                }\n            }\n            function parseJSDocUnionType() {\n                var result = createNode(266 /* JSDocUnionType */);\n                nextToken();\n                result.types = parseJSDocTypeList(parseJSDocType());\n                parseExpected(19 /* CloseParenToken */);\n                return finishNode(result);\n            }\n            function parseJSDocTypeList(firstType) {\n                ts.Debug.assert(!!firstType);\n                var types = createNodeArray([firstType], firstType.pos);\n                while (parseOptional(48 /* BarToken */)) {\n                    types.push(parseJSDocType());\n                }\n                types.end = scanner.getStartPos();\n                return types;\n            }\n            function parseJSDocAllType() {\n                var result = createNode(263 /* JSDocAllType */);\n                nextToken();\n                return finishNode(result);\n            }\n            function parseJSDocLiteralType() {\n                var result = createNode(288 /* JSDocLiteralType */);\n                result.literal = parseLiteralTypeNode();\n                return finishNode(result);\n            }\n            function parseJSDocUnknownOrNullableType() {\n                var pos = scanner.getStartPos();\n                // skip the ?\n                nextToken();\n                // Need to lookahead to decide if this is a nullable or unknown type.\n                // Here are cases where we'll pick the unknown type:\n                //\n                //      Foo(?,\n                //      { a: ? }\n                //      Foo(?)\n                //      Foo<?>\n                //      Foo(?=\n                //      (?|\n                if (token() === 25 /* CommaToken */ ||\n                    token() === 17 /* CloseBraceToken */ ||\n                    token() === 19 /* CloseParenToken */ ||\n                    token() === 28 /* GreaterThanToken */ ||\n                    token() === 57 /* EqualsToken */ ||\n                    token() === 48 /* BarToken */) {\n                    var result = createNode(264 /* JSDocUnknownType */, pos);\n                    return finishNode(result);\n                }\n                else {\n                    var result = createNode(268 /* JSDocNullableType */, pos);\n                    result.type = parseJSDocType();\n                    return finishNode(result);\n                }\n            }\n            function parseIsolatedJSDocComment(content, start, length) {\n                initializeState(content, 5 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);\n                sourceFile = { languageVariant: 0 /* Standard */, text: content };\n                var jsDoc = parseJSDocCommentWorker(start, length);\n                var diagnostics = parseDiagnostics;\n                clearState();\n                return jsDoc ? { jsDoc: jsDoc, diagnostics: diagnostics } : undefined;\n            }\n            JSDocParser.parseIsolatedJSDocComment = parseIsolatedJSDocComment;\n            function parseJSDocComment(parent, start, length) {\n                var saveToken = currentToken;\n                var saveParseDiagnosticsLength = parseDiagnostics.length;\n                var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;\n                var comment = parseJSDocCommentWorker(start, length);\n                if (comment) {\n                    comment.parent = parent;\n                }\n                currentToken = saveToken;\n                parseDiagnostics.length = saveParseDiagnosticsLength;\n                parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode;\n                return comment;\n            }\n            JSDocParser.parseJSDocComment = parseJSDocComment;\n            var JSDocState;\n            (function (JSDocState) {\n                JSDocState[JSDocState[\"BeginningOfLine\"] = 0] = \"BeginningOfLine\";\n                JSDocState[JSDocState[\"SawAsterisk\"] = 1] = \"SawAsterisk\";\n                JSDocState[JSDocState[\"SavingComments\"] = 2] = \"SavingComments\";\n            })(JSDocState || (JSDocState = {}));\n            function parseJSDocCommentWorker(start, length) {\n                var content = sourceText;\n                start = start || 0;\n                var end = length === undefined ? content.length : start + length;\n                length = end - start;\n                ts.Debug.assert(start >= 0);\n                ts.Debug.assert(start <= end);\n                ts.Debug.assert(end <= content.length);\n                var tags;\n                var comments = [];\n                var result;\n                // Check for /** (JSDoc opening part)\n                if (!isJsDocStart(content, start)) {\n                    return result;\n                }\n                // + 3 for leading /**, - 5 in total for /** */\n                scanner.scanRange(start + 3, length - 5, function () {\n                    // Initially we can parse out a tag.  We also have seen a starting asterisk.\n                    // This is so that /** * @type */ doesn't parse.\n                    var advanceToken = true;\n                    var state = 1 /* SawAsterisk */;\n                    var margin = undefined;\n                    // + 4 for leading '/** '\n                    var indent = start - Math.max(content.lastIndexOf(\"\\n\", start), 0) + 4;\n                    function pushComment(text) {\n                        if (!margin) {\n                            margin = indent;\n                        }\n                        comments.push(text);\n                        indent += text.length;\n                    }\n                    nextJSDocToken();\n                    while (token() === 5 /* WhitespaceTrivia */) {\n                        nextJSDocToken();\n                    }\n                    if (token() === 4 /* NewLineTrivia */) {\n                        state = 0 /* BeginningOfLine */;\n                        indent = 0;\n                        nextJSDocToken();\n                    }\n                    while (token() !== 1 /* EndOfFileToken */) {\n                        switch (token()) {\n                            case 56 /* AtToken */:\n                                if (state === 0 /* BeginningOfLine */ || state === 1 /* SawAsterisk */) {\n                                    removeTrailingNewlines(comments);\n                                    parseTag(indent);\n                                    // NOTE: According to usejsdoc.org, a tag goes to end of line, except the last tag.\n                                    // Real-world comments may break this rule, so \"BeginningOfLine\" will not be a real line beginning\n                                    // for malformed examples like `/** @param {string} x @returns {number} the length */`\n                                    state = 0 /* BeginningOfLine */;\n                                    advanceToken = false;\n                                    margin = undefined;\n                                    indent++;\n                                }\n                                else {\n                                    pushComment(scanner.getTokenText());\n                                }\n                                break;\n                            case 4 /* NewLineTrivia */:\n                                comments.push(scanner.getTokenText());\n                                state = 0 /* BeginningOfLine */;\n                                indent = 0;\n                                break;\n                            case 38 /* AsteriskToken */:\n                                var asterisk = scanner.getTokenText();\n                                if (state === 1 /* SawAsterisk */) {\n                                    // If we've already seen an asterisk, then we can no longer parse a tag on this line\n                                    state = 2 /* SavingComments */;\n                                    pushComment(asterisk);\n                                }\n                                else {\n                                    // Ignore the first asterisk on a line\n                                    state = 1 /* SawAsterisk */;\n                                    indent += asterisk.length;\n                                }\n                                break;\n                            case 70 /* Identifier */:\n                                // Anything else is doc comment text. We just save it. Because it\n                                // wasn't a tag, we can no longer parse a tag on this line until we hit the next\n                                // line break.\n                                pushComment(scanner.getTokenText());\n                                state = 2 /* SavingComments */;\n                                break;\n                            case 5 /* WhitespaceTrivia */:\n                                // only collect whitespace if we're already saving comments or have just crossed the comment indent margin\n                                var whitespace = scanner.getTokenText();\n                                if (state === 2 /* SavingComments */ || margin !== undefined && indent + whitespace.length > margin) {\n                                    comments.push(whitespace.slice(margin - indent - 1));\n                                }\n                                indent += whitespace.length;\n                                break;\n                            case 1 /* EndOfFileToken */:\n                                break;\n                            default:\n                                pushComment(scanner.getTokenText());\n                                break;\n                        }\n                        if (advanceToken) {\n                            nextJSDocToken();\n                        }\n                        else {\n                            advanceToken = true;\n                        }\n                    }\n                    removeLeadingNewlines(comments);\n                    removeTrailingNewlines(comments);\n                    result = createJSDocComment();\n                });\n                return result;\n                function removeLeadingNewlines(comments) {\n                    while (comments.length && (comments[0] === \"\\n\" || comments[0] === \"\\r\")) {\n                        comments.shift();\n                    }\n                }\n                function removeTrailingNewlines(comments) {\n                    while (comments.length && (comments[comments.length - 1] === \"\\n\" || comments[comments.length - 1] === \"\\r\")) {\n                        comments.pop();\n                    }\n                }\n                function isJsDocStart(content, start) {\n                    return content.charCodeAt(start) === 47 /* slash */ &&\n                        content.charCodeAt(start + 1) === 42 /* asterisk */ &&\n                        content.charCodeAt(start + 2) === 42 /* asterisk */ &&\n                        content.charCodeAt(start + 3) !== 42 /* asterisk */;\n                }\n                function createJSDocComment() {\n                    var result = createNode(278 /* JSDocComment */, start);\n                    result.tags = tags;\n                    result.comment = comments.length ? comments.join(\"\") : undefined;\n                    return finishNode(result, end);\n                }\n                function skipWhitespace() {\n                    while (token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) {\n                        nextJSDocToken();\n                    }\n                }\n                function parseTag(indent) {\n                    ts.Debug.assert(token() === 56 /* AtToken */);\n                    var atToken = createNode(56 /* AtToken */, scanner.getTokenPos());\n                    atToken.end = scanner.getTextPos();\n                    nextJSDocToken();\n                    var tagName = parseJSDocIdentifierName();\n                    skipWhitespace();\n                    if (!tagName) {\n                        return;\n                    }\n                    var tag;\n                    if (tagName) {\n                        switch (tagName.text) {\n                            case \"augments\":\n                                tag = parseAugmentsTag(atToken, tagName);\n                                break;\n                            case \"param\":\n                                tag = parseParamTag(atToken, tagName);\n                                break;\n                            case \"return\":\n                            case \"returns\":\n                                tag = parseReturnTag(atToken, tagName);\n                                break;\n                            case \"template\":\n                                tag = parseTemplateTag(atToken, tagName);\n                                break;\n                            case \"type\":\n                                tag = parseTypeTag(atToken, tagName);\n                                break;\n                            case \"typedef\":\n                                tag = parseTypedefTag(atToken, tagName);\n                                break;\n                            default:\n                                tag = parseUnknownTag(atToken, tagName);\n                                break;\n                        }\n                    }\n                    else {\n                        tag = parseUnknownTag(atToken, tagName);\n                    }\n                    if (!tag) {\n                        // a badly malformed tag should not be added to the list of tags\n                        return;\n                    }\n                    addTag(tag, parseTagComments(indent + tag.end - tag.pos));\n                }\n                function parseTagComments(indent) {\n                    var comments = [];\n                    var state = 1 /* SawAsterisk */;\n                    var margin;\n                    function pushComment(text) {\n                        if (!margin) {\n                            margin = indent;\n                        }\n                        comments.push(text);\n                        indent += text.length;\n                    }\n                    while (token() !== 56 /* AtToken */ && token() !== 1 /* EndOfFileToken */) {\n                        switch (token()) {\n                            case 4 /* NewLineTrivia */:\n                                if (state >= 1 /* SawAsterisk */) {\n                                    state = 0 /* BeginningOfLine */;\n                                    comments.push(scanner.getTokenText());\n                                }\n                                indent = 0;\n                                break;\n                            case 56 /* AtToken */:\n                                // Done\n                                break;\n                            case 5 /* WhitespaceTrivia */:\n                                if (state === 2 /* SavingComments */) {\n                                    pushComment(scanner.getTokenText());\n                                }\n                                else {\n                                    var whitespace = scanner.getTokenText();\n                                    // if the whitespace crosses the margin, take only the whitespace that passes the margin\n                                    if (margin !== undefined && indent + whitespace.length > margin) {\n                                        comments.push(whitespace.slice(margin - indent - 1));\n                                    }\n                                    indent += whitespace.length;\n                                }\n                                break;\n                            case 38 /* AsteriskToken */:\n                                if (state === 0 /* BeginningOfLine */) {\n                                    // leading asterisks start recording on the *next* (non-whitespace) token\n                                    state = 1 /* SawAsterisk */;\n                                    indent += scanner.getTokenText().length;\n                                    break;\n                                }\n                            // FALLTHROUGH otherwise to record the * as a comment\n                            default:\n                                state = 2 /* SavingComments */; // leading identifiers start recording as well\n                                pushComment(scanner.getTokenText());\n                                break;\n                        }\n                        if (token() === 56 /* AtToken */) {\n                            // Done\n                            break;\n                        }\n                        nextJSDocToken();\n                    }\n                    removeLeadingNewlines(comments);\n                    removeTrailingNewlines(comments);\n                    return comments;\n                }\n                function parseUnknownTag(atToken, tagName) {\n                    var result = createNode(279 /* JSDocTag */, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    return finishNode(result);\n                }\n                function addTag(tag, comments) {\n                    tag.comment = comments.join(\"\");\n                    if (!tags) {\n                        tags = createNodeArray([tag], tag.pos);\n                    }\n                    else {\n                        tags.push(tag);\n                    }\n                    tags.end = tag.end;\n                }\n                function tryParseTypeExpression() {\n                    return tryParse(function () {\n                        skipWhitespace();\n                        if (token() !== 16 /* OpenBraceToken */) {\n                            return undefined;\n                        }\n                        return parseJSDocTypeExpression();\n                    });\n                }\n                function parseParamTag(atToken, tagName) {\n                    var typeExpression = tryParseTypeExpression();\n                    skipWhitespace();\n                    var name;\n                    var isBracketed;\n                    // Looking for something like '[foo]' or 'foo'\n                    if (parseOptionalToken(20 /* OpenBracketToken */)) {\n                        name = parseJSDocIdentifierName();\n                        skipWhitespace();\n                        isBracketed = true;\n                        // May have an optional default, e.g. '[foo = 42]'\n                        if (parseOptionalToken(57 /* EqualsToken */)) {\n                            parseExpression();\n                        }\n                        parseExpected(21 /* CloseBracketToken */);\n                    }\n                    else if (ts.tokenIsIdentifierOrKeyword(token())) {\n                        name = parseJSDocIdentifierName();\n                    }\n                    if (!name) {\n                        parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);\n                        return undefined;\n                    }\n                    var preName, postName;\n                    if (typeExpression) {\n                        postName = name;\n                    }\n                    else {\n                        preName = name;\n                    }\n                    if (!typeExpression) {\n                        typeExpression = tryParseTypeExpression();\n                    }\n                    var result = createNode(281 /* JSDocParameterTag */, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.preParameterName = preName;\n                    result.typeExpression = typeExpression;\n                    result.postParameterName = postName;\n                    result.parameterName = postName || preName;\n                    result.isBracketed = isBracketed;\n                    return finishNode(result);\n                }\n                function parseReturnTag(atToken, tagName) {\n                    if (ts.forEach(tags, function (t) { return t.kind === 282 /* JSDocReturnTag */; })) {\n                        parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);\n                    }\n                    var result = createNode(282 /* JSDocReturnTag */, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.typeExpression = tryParseTypeExpression();\n                    return finishNode(result);\n                }\n                function parseTypeTag(atToken, tagName) {\n                    if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocTypeTag */; })) {\n                        parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);\n                    }\n                    var result = createNode(283 /* JSDocTypeTag */, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.typeExpression = tryParseTypeExpression();\n                    return finishNode(result);\n                }\n                function parsePropertyTag(atToken, tagName) {\n                    var typeExpression = tryParseTypeExpression();\n                    skipWhitespace();\n                    var name = parseJSDocIdentifierName();\n                    skipWhitespace();\n                    if (!name) {\n                        parseErrorAtPosition(scanner.getStartPos(), /*length*/ 0, ts.Diagnostics.Identifier_expected);\n                        return undefined;\n                    }\n                    var result = createNode(286 /* JSDocPropertyTag */, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.name = name;\n                    result.typeExpression = typeExpression;\n                    return finishNode(result);\n                }\n                function parseAugmentsTag(atToken, tagName) {\n                    var typeExpression = tryParseTypeExpression();\n                    var result = createNode(280 /* JSDocAugmentsTag */, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.typeExpression = typeExpression;\n                    return finishNode(result);\n                }\n                function parseTypedefTag(atToken, tagName) {\n                    var typeExpression = tryParseTypeExpression();\n                    skipWhitespace();\n                    var typedefTag = createNode(285 /* JSDocTypedefTag */, atToken.pos);\n                    typedefTag.atToken = atToken;\n                    typedefTag.tagName = tagName;\n                    typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0);\n                    if (typedefTag.fullName) {\n                        var rightNode = typedefTag.fullName;\n                        while (rightNode.kind !== 70 /* Identifier */) {\n                            rightNode = rightNode.body;\n                        }\n                        typedefTag.name = rightNode;\n                    }\n                    typedefTag.typeExpression = typeExpression;\n                    skipWhitespace();\n                    if (typeExpression) {\n                        if (typeExpression.type.kind === 272 /* JSDocTypeReference */) {\n                            var jsDocTypeReference = typeExpression.type;\n                            if (jsDocTypeReference.name.kind === 70 /* Identifier */) {\n                                var name_14 = jsDocTypeReference.name;\n                                if (name_14.text === \"Object\") {\n                                    typedefTag.jsDocTypeLiteral = scanChildTags();\n                                }\n                            }\n                        }\n                        if (!typedefTag.jsDocTypeLiteral) {\n                            typedefTag.jsDocTypeLiteral = typeExpression.type;\n                        }\n                    }\n                    else {\n                        typedefTag.jsDocTypeLiteral = scanChildTags();\n                    }\n                    return finishNode(typedefTag);\n                    function scanChildTags() {\n                        var jsDocTypeLiteral = createNode(287 /* JSDocTypeLiteral */, scanner.getStartPos());\n                        var resumePos = scanner.getStartPos();\n                        var canParseTag = true;\n                        var seenAsterisk = false;\n                        var parentTagTerminated = false;\n                        while (token() !== 1 /* EndOfFileToken */ && !parentTagTerminated) {\n                            nextJSDocToken();\n                            switch (token()) {\n                                case 56 /* AtToken */:\n                                    if (canParseTag) {\n                                        parentTagTerminated = !tryParseChildTag(jsDocTypeLiteral);\n                                        if (!parentTagTerminated) {\n                                            resumePos = scanner.getStartPos();\n                                        }\n                                    }\n                                    seenAsterisk = false;\n                                    break;\n                                case 4 /* NewLineTrivia */:\n                                    resumePos = scanner.getStartPos() - 1;\n                                    canParseTag = true;\n                                    seenAsterisk = false;\n                                    break;\n                                case 38 /* AsteriskToken */:\n                                    if (seenAsterisk) {\n                                        canParseTag = false;\n                                    }\n                                    seenAsterisk = true;\n                                    break;\n                                case 70 /* Identifier */:\n                                    canParseTag = false;\n                                case 1 /* EndOfFileToken */:\n                                    break;\n                            }\n                        }\n                        scanner.setTextPos(resumePos);\n                        return finishNode(jsDocTypeLiteral);\n                    }\n                    function parseJSDocTypeNameWithNamespace(flags) {\n                        var pos = scanner.getTokenPos();\n                        var typeNameOrNamespaceName = parseJSDocIdentifierName();\n                        if (typeNameOrNamespaceName && parseOptional(22 /* DotToken */)) {\n                            var jsDocNamespaceNode = createNode(230 /* ModuleDeclaration */, pos);\n                            jsDocNamespaceNode.flags |= flags;\n                            jsDocNamespaceNode.name = typeNameOrNamespaceName;\n                            jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4 /* NestedNamespace */);\n                            return jsDocNamespaceNode;\n                        }\n                        if (typeNameOrNamespaceName && flags & 4 /* NestedNamespace */) {\n                            typeNameOrNamespaceName.isInJSDocNamespace = true;\n                        }\n                        return typeNameOrNamespaceName;\n                    }\n                }\n                function tryParseChildTag(parentTag) {\n                    ts.Debug.assert(token() === 56 /* AtToken */);\n                    var atToken = createNode(56 /* AtToken */, scanner.getStartPos());\n                    atToken.end = scanner.getTextPos();\n                    nextJSDocToken();\n                    var tagName = parseJSDocIdentifierName();\n                    skipWhitespace();\n                    if (!tagName) {\n                        return false;\n                    }\n                    switch (tagName.text) {\n                        case \"type\":\n                            if (parentTag.jsDocTypeTag) {\n                                // already has a @type tag, terminate the parent tag now.\n                                return false;\n                            }\n                            parentTag.jsDocTypeTag = parseTypeTag(atToken, tagName);\n                            return true;\n                        case \"prop\":\n                        case \"property\":\n                            var propertyTag = parsePropertyTag(atToken, tagName);\n                            if (propertyTag) {\n                                if (!parentTag.jsDocPropertyTags) {\n                                    parentTag.jsDocPropertyTags = [];\n                                }\n                                parentTag.jsDocPropertyTags.push(propertyTag);\n                                return true;\n                            }\n                            // Error parsing property tag\n                            return false;\n                    }\n                    return false;\n                }\n                function parseTemplateTag(atToken, tagName) {\n                    if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocTemplateTag */; })) {\n                        parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);\n                    }\n                    // Type parameter list looks like '@template T,U,V'\n                    var typeParameters = createNodeArray();\n                    while (true) {\n                        var name_15 = parseJSDocIdentifierName();\n                        skipWhitespace();\n                        if (!name_15) {\n                            parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);\n                            return undefined;\n                        }\n                        var typeParameter = createNode(143 /* TypeParameter */, name_15.pos);\n                        typeParameter.name = name_15;\n                        finishNode(typeParameter);\n                        typeParameters.push(typeParameter);\n                        if (token() === 25 /* CommaToken */) {\n                            nextJSDocToken();\n                            skipWhitespace();\n                        }\n                        else {\n                            break;\n                        }\n                    }\n                    var result = createNode(284 /* JSDocTemplateTag */, atToken.pos);\n                    result.atToken = atToken;\n                    result.tagName = tagName;\n                    result.typeParameters = typeParameters;\n                    finishNode(result);\n                    typeParameters.end = result.end;\n                    return result;\n                }\n                function nextJSDocToken() {\n                    return currentToken = scanner.scanJSDocToken();\n                }\n                function parseJSDocIdentifierName() {\n                    return createJSDocIdentifier(ts.tokenIsIdentifierOrKeyword(token()));\n                }\n                function createJSDocIdentifier(isIdentifier) {\n                    if (!isIdentifier) {\n                        parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);\n                        return undefined;\n                    }\n                    var pos = scanner.getTokenPos();\n                    var end = scanner.getTextPos();\n                    var result = createNode(70 /* Identifier */, pos);\n                    result.text = content.substring(pos, end);\n                    finishNode(result, end);\n                    nextJSDocToken();\n                    return result;\n                }\n            }\n            JSDocParser.parseJSDocCommentWorker = parseJSDocCommentWorker;\n        })(JSDocParser = Parser.JSDocParser || (Parser.JSDocParser = {}));\n    })(Parser || (Parser = {}));\n    var IncrementalParser;\n    (function (IncrementalParser) {\n        function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) {\n            aggressiveChecks = aggressiveChecks || ts.Debug.shouldAssert(2 /* Aggressive */);\n            checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks);\n            if (ts.textChangeRangeIsUnchanged(textChangeRange)) {\n                // if the text didn't change, then we can just return our current source file as-is.\n                return sourceFile;\n            }\n            if (sourceFile.statements.length === 0) {\n                // If we don't have any statements in the current source file, then there's no real\n                // way to incrementally parse.  So just do a full parse instead.\n                return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setParentNodes*/ true, sourceFile.scriptKind);\n            }\n            // Make sure we're not trying to incrementally update a source file more than once.  Once\n            // we do an update the original source file is considered unusable from that point onwards.\n            //\n            // This is because we do incremental parsing in-place.  i.e. we take nodes from the old\n            // tree and give them new positions and parents.  From that point on, trusting the old\n            // tree at all is not possible as far too much of it may violate invariants.\n            var incrementalSourceFile = sourceFile;\n            ts.Debug.assert(!incrementalSourceFile.hasBeenIncrementallyParsed);\n            incrementalSourceFile.hasBeenIncrementallyParsed = true;\n            var oldText = sourceFile.text;\n            var syntaxCursor = createSyntaxCursor(sourceFile);\n            // Make the actual change larger so that we know to reparse anything whose lookahead\n            // might have intersected the change.\n            var changeRange = extendToAffectedRange(sourceFile, textChangeRange);\n            checkChangeRange(sourceFile, newText, changeRange, aggressiveChecks);\n            // Ensure that extending the affected range only moved the start of the change range\n            // earlier in the file.\n            ts.Debug.assert(changeRange.span.start <= textChangeRange.span.start);\n            ts.Debug.assert(ts.textSpanEnd(changeRange.span) === ts.textSpanEnd(textChangeRange.span));\n            ts.Debug.assert(ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)) === ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange)));\n            // The is the amount the nodes after the edit range need to be adjusted.  It can be\n            // positive (if the edit added characters), negative (if the edit deleted characters)\n            // or zero (if this was a pure overwrite with nothing added/removed).\n            var delta = ts.textChangeRangeNewSpan(changeRange).length - changeRange.span.length;\n            // If we added or removed characters during the edit, then we need to go and adjust all\n            // the nodes after the edit.  Those nodes may move forward (if we inserted chars) or they\n            // may move backward (if we deleted chars).\n            //\n            // Doing this helps us out in two ways.  First, it means that any nodes/tokens we want\n            // to reuse are already at the appropriate position in the new text.  That way when we\n            // reuse them, we don't have to figure out if they need to be adjusted.  Second, it makes\n            // it very easy to determine if we can reuse a node.  If the node's position is at where\n            // we are in the text, then we can reuse it.  Otherwise we can't.  If the node's position\n            // is ahead of us, then we'll need to rescan tokens.  If the node's position is behind\n            // us, then we'll need to skip it or crumble it as appropriate\n            //\n            // We will also adjust the positions of nodes that intersect the change range as well.\n            // By doing this, we ensure that all the positions in the old tree are consistent, not\n            // just the positions of nodes entirely before/after the change range.  By being\n            // consistent, we can then easily map from positions to nodes in the old tree easily.\n            //\n            // Also, mark any syntax elements that intersect the changed span.  We know, up front,\n            // that we cannot reuse these elements.\n            updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, ts.textSpanEnd(changeRange.span), ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks);\n            // Now that we've set up our internal incremental state just proceed and parse the\n            // source file in the normal fashion.  When possible the parser will retrieve and\n            // reuse nodes from the old tree.\n            //\n            // Note: passing in 'true' for setNodeParents is very important.  When incrementally\n            // parsing, we will be reusing nodes from the old tree, and placing it into new\n            // parents.  If we don't set the parents now, we'll end up with an observably\n            // inconsistent tree.  Setting the parents on the new tree should be very fast.  We\n            // will immediately bail out of walking any subtrees when we can see that their parents\n            // are already correct.\n            var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /*setParentNodes*/ true, sourceFile.scriptKind);\n            return result;\n        }\n        IncrementalParser.updateSourceFile = updateSourceFile;\n        function moveElementEntirelyPastChangeRange(element, isArray, delta, oldText, newText, aggressiveChecks) {\n            if (isArray) {\n                visitArray(element);\n            }\n            else {\n                visitNode(element);\n            }\n            return;\n            function visitNode(node) {\n                var text = \"\";\n                if (aggressiveChecks && shouldCheckNode(node)) {\n                    text = oldText.substring(node.pos, node.end);\n                }\n                // Ditch any existing LS children we may have created.  This way we can avoid\n                // moving them forward.\n                if (node._children) {\n                    node._children = undefined;\n                }\n                node.pos += delta;\n                node.end += delta;\n                if (aggressiveChecks && shouldCheckNode(node)) {\n                    ts.Debug.assert(text === newText.substring(node.pos, node.end));\n                }\n                forEachChild(node, visitNode, visitArray);\n                if (node.jsDoc) {\n                    for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {\n                        var jsDocComment = _a[_i];\n                        forEachChild(jsDocComment, visitNode, visitArray);\n                    }\n                }\n                checkNodePositions(node, aggressiveChecks);\n            }\n            function visitArray(array) {\n                array._children = undefined;\n                array.pos += delta;\n                array.end += delta;\n                for (var _i = 0, array_9 = array; _i < array_9.length; _i++) {\n                    var node = array_9[_i];\n                    visitNode(node);\n                }\n            }\n        }\n        function shouldCheckNode(node) {\n            switch (node.kind) {\n                case 9 /* StringLiteral */:\n                case 8 /* NumericLiteral */:\n                case 70 /* Identifier */:\n                    return true;\n            }\n            return false;\n        }\n        function adjustIntersectingElement(element, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta) {\n            ts.Debug.assert(element.end >= changeStart, \"Adjusting an element that was entirely before the change range\");\n            ts.Debug.assert(element.pos <= changeRangeOldEnd, \"Adjusting an element that was entirely after the change range\");\n            ts.Debug.assert(element.pos <= element.end);\n            // We have an element that intersects the change range in some way.  It may have its\n            // start, or its end (or both) in the changed range.  We want to adjust any part\n            // that intersects such that the final tree is in a consistent state.  i.e. all\n            // children have spans within the span of their parent, and all siblings are ordered\n            // properly.\n            // We may need to update both the 'pos' and the 'end' of the element.\n            // If the 'pos' is before the start of the change, then we don't need to touch it.\n            // If it isn't, then the 'pos' must be inside the change.  How we update it will\n            // depend if delta is  positive or negative.  If delta is positive then we have\n            // something like:\n            //\n            //  -------------------AAA-----------------\n            //  -------------------BBBCCCCCCC-----------------\n            //\n            // In this case, we consider any node that started in the change range to still be\n            // starting at the same position.\n            //\n            // however, if the delta is negative, then we instead have something like this:\n            //\n            //  -------------------XXXYYYYYYY-----------------\n            //  -------------------ZZZ-----------------\n            //\n            // In this case, any element that started in the 'X' range will keep its position.\n            // However any element that started after that will have their pos adjusted to be\n            // at the end of the new range.  i.e. any node that started in the 'Y' range will\n            // be adjusted to have their start at the end of the 'Z' range.\n            //\n            // The element will keep its position if possible.  Or Move backward to the new-end\n            // if it's in the 'Y' range.\n            element.pos = Math.min(element.pos, changeRangeNewEnd);\n            // If the 'end' is after the change range, then we always adjust it by the delta\n            // amount.  However, if the end is in the change range, then how we adjust it\n            // will depend on if delta is  positive or negative.  If delta is positive then we\n            // have something like:\n            //\n            //  -------------------AAA-----------------\n            //  -------------------BBBCCCCCCC-----------------\n            //\n            // In this case, we consider any node that ended inside the change range to keep its\n            // end position.\n            //\n            // however, if the delta is negative, then we instead have something like this:\n            //\n            //  -------------------XXXYYYYYYY-----------------\n            //  -------------------ZZZ-----------------\n            //\n            // In this case, any element that ended in the 'X' range will keep its position.\n            // However any element that ended after that will have their pos adjusted to be\n            // at the end of the new range.  i.e. any node that ended in the 'Y' range will\n            // be adjusted to have their end at the end of the 'Z' range.\n            if (element.end >= changeRangeOldEnd) {\n                // Element ends after the change range.  Always adjust the end pos.\n                element.end += delta;\n            }\n            else {\n                // Element ends in the change range.  The element will keep its position if\n                // possible. Or Move backward to the new-end if it's in the 'Y' range.\n                element.end = Math.min(element.end, changeRangeNewEnd);\n            }\n            ts.Debug.assert(element.pos <= element.end);\n            if (element.parent) {\n                ts.Debug.assert(element.pos >= element.parent.pos);\n                ts.Debug.assert(element.end <= element.parent.end);\n            }\n        }\n        function checkNodePositions(node, aggressiveChecks) {\n            if (aggressiveChecks) {\n                var pos_2 = node.pos;\n                forEachChild(node, function (child) {\n                    ts.Debug.assert(child.pos >= pos_2);\n                    pos_2 = child.end;\n                });\n                ts.Debug.assert(pos_2 <= node.end);\n            }\n        }\n        function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) {\n            visitNode(sourceFile);\n            return;\n            function visitNode(child) {\n                ts.Debug.assert(child.pos <= child.end);\n                if (child.pos > changeRangeOldEnd) {\n                    // Node is entirely past the change range.  We need to move both its pos and\n                    // end, forward or backward appropriately.\n                    moveElementEntirelyPastChangeRange(child, /*isArray*/ false, delta, oldText, newText, aggressiveChecks);\n                    return;\n                }\n                // Check if the element intersects the change range.  If it does, then it is not\n                // reusable.  Also, we'll need to recurse to see what constituent portions we may\n                // be able to use.\n                var fullEnd = child.end;\n                if (fullEnd >= changeStart) {\n                    child.intersectsChange = true;\n                    child._children = undefined;\n                    // Adjust the pos or end (or both) of the intersecting element accordingly.\n                    adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);\n                    forEachChild(child, visitNode, visitArray);\n                    checkNodePositions(child, aggressiveChecks);\n                    return;\n                }\n                // Otherwise, the node is entirely before the change range.  No need to do anything with it.\n                ts.Debug.assert(fullEnd < changeStart);\n            }\n            function visitArray(array) {\n                ts.Debug.assert(array.pos <= array.end);\n                if (array.pos > changeRangeOldEnd) {\n                    // Array is entirely after the change range.  We need to move it, and move any of\n                    // its children.\n                    moveElementEntirelyPastChangeRange(array, /*isArray*/ true, delta, oldText, newText, aggressiveChecks);\n                    return;\n                }\n                // Check if the element intersects the change range.  If it does, then it is not\n                // reusable.  Also, we'll need to recurse to see what constituent portions we may\n                // be able to use.\n                var fullEnd = array.end;\n                if (fullEnd >= changeStart) {\n                    array.intersectsChange = true;\n                    array._children = undefined;\n                    // Adjust the pos or end (or both) of the intersecting array accordingly.\n                    adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);\n                    for (var _i = 0, array_10 = array; _i < array_10.length; _i++) {\n                        var node = array_10[_i];\n                        visitNode(node);\n                    }\n                    return;\n                }\n                // Otherwise, the array is entirely before the change range.  No need to do anything with it.\n                ts.Debug.assert(fullEnd < changeStart);\n            }\n        }\n        function extendToAffectedRange(sourceFile, changeRange) {\n            // Consider the following code:\n            //      void foo() { /; }\n            //\n            // If the text changes with an insertion of / just before the semicolon then we end up with:\n            //      void foo() { //; }\n            //\n            // If we were to just use the changeRange a is, then we would not rescan the { token\n            // (as it does not intersect the actual original change range).  Because an edit may\n            // change the token touching it, we actually need to look back *at least* one token so\n            // that the prior token sees that change.\n            var maxLookahead = 1;\n            var start = changeRange.span.start;\n            // the first iteration aligns us with the change start. subsequent iteration move us to\n            // the left by maxLookahead tokens.  We only need to do this as long as we're not at the\n            // start of the tree.\n            for (var i = 0; start > 0 && i <= maxLookahead; i++) {\n                var nearestNode = findNearestNodeStartingBeforeOrAtPosition(sourceFile, start);\n                ts.Debug.assert(nearestNode.pos <= start);\n                var position = nearestNode.pos;\n                start = Math.max(0, position - 1);\n            }\n            var finalSpan = ts.createTextSpanFromBounds(start, ts.textSpanEnd(changeRange.span));\n            var finalLength = changeRange.newLength + (changeRange.span.start - start);\n            return ts.createTextChangeRange(finalSpan, finalLength);\n        }\n        function findNearestNodeStartingBeforeOrAtPosition(sourceFile, position) {\n            var bestResult = sourceFile;\n            var lastNodeEntirelyBeforePosition;\n            forEachChild(sourceFile, visit);\n            if (lastNodeEntirelyBeforePosition) {\n                var lastChildOfLastEntireNodeBeforePosition = getLastChild(lastNodeEntirelyBeforePosition);\n                if (lastChildOfLastEntireNodeBeforePosition.pos > bestResult.pos) {\n                    bestResult = lastChildOfLastEntireNodeBeforePosition;\n                }\n            }\n            return bestResult;\n            function getLastChild(node) {\n                while (true) {\n                    var lastChild = getLastChildWorker(node);\n                    if (lastChild) {\n                        node = lastChild;\n                    }\n                    else {\n                        return node;\n                    }\n                }\n            }\n            function getLastChildWorker(node) {\n                var last = undefined;\n                forEachChild(node, function (child) {\n                    if (ts.nodeIsPresent(child)) {\n                        last = child;\n                    }\n                });\n                return last;\n            }\n            function visit(child) {\n                if (ts.nodeIsMissing(child)) {\n                    // Missing nodes are effectively invisible to us.  We never even consider them\n                    // When trying to find the nearest node before us.\n                    return;\n                }\n                // If the child intersects this position, then this node is currently the nearest\n                // node that starts before the position.\n                if (child.pos <= position) {\n                    if (child.pos >= bestResult.pos) {\n                        // This node starts before the position, and is closer to the position than\n                        // the previous best node we found.  It is now the new best node.\n                        bestResult = child;\n                    }\n                    // Now, the node may overlap the position, or it may end entirely before the\n                    // position.  If it overlaps with the position, then either it, or one of its\n                    // children must be the nearest node before the position.  So we can just\n                    // recurse into this child to see if we can find something better.\n                    if (position < child.end) {\n                        // The nearest node is either this child, or one of the children inside\n                        // of it.  We've already marked this child as the best so far.  Recurse\n                        // in case one of the children is better.\n                        forEachChild(child, visit);\n                        // Once we look at the children of this node, then there's no need to\n                        // continue any further.\n                        return true;\n                    }\n                    else {\n                        ts.Debug.assert(child.end <= position);\n                        // The child ends entirely before this position.  Say you have the following\n                        // (where $ is the position)\n                        //\n                        //      <complex expr 1> ? <complex expr 2> $ : <...> <...>\n                        //\n                        // We would want to find the nearest preceding node in \"complex expr 2\".\n                        // To support that, we keep track of this node, and once we're done searching\n                        // for a best node, we recurse down this node to see if we can find a good\n                        // result in it.\n                        //\n                        // This approach allows us to quickly skip over nodes that are entirely\n                        // before the position, while still allowing us to find any nodes in the\n                        // last one that might be what we want.\n                        lastNodeEntirelyBeforePosition = child;\n                    }\n                }\n                else {\n                    ts.Debug.assert(child.pos > position);\n                    // We're now at a node that is entirely past the position we're searching for.\n                    // This node (and all following nodes) could never contribute to the result,\n                    // so just skip them by returning 'true' here.\n                    return true;\n                }\n            }\n        }\n        function checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks) {\n            var oldText = sourceFile.text;\n            if (textChangeRange) {\n                ts.Debug.assert((oldText.length - textChangeRange.span.length + textChangeRange.newLength) === newText.length);\n                if (aggressiveChecks || ts.Debug.shouldAssert(3 /* VeryAggressive */)) {\n                    var oldTextPrefix = oldText.substr(0, textChangeRange.span.start);\n                    var newTextPrefix = newText.substr(0, textChangeRange.span.start);\n                    ts.Debug.assert(oldTextPrefix === newTextPrefix);\n                    var oldTextSuffix = oldText.substring(ts.textSpanEnd(textChangeRange.span), oldText.length);\n                    var newTextSuffix = newText.substring(ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange)), newText.length);\n                    ts.Debug.assert(oldTextSuffix === newTextSuffix);\n                }\n            }\n        }\n        function createSyntaxCursor(sourceFile) {\n            var currentArray = sourceFile.statements;\n            var currentArrayIndex = 0;\n            ts.Debug.assert(currentArrayIndex < currentArray.length);\n            var current = currentArray[currentArrayIndex];\n            var lastQueriedPosition = -1 /* Value */;\n            return {\n                currentNode: function (position) {\n                    // Only compute the current node if the position is different than the last time\n                    // we were asked.  The parser commonly asks for the node at the same position\n                    // twice.  Once to know if can read an appropriate list element at a certain point,\n                    // and then to actually read and consume the node.\n                    if (position !== lastQueriedPosition) {\n                        // Much of the time the parser will need the very next node in the array that\n                        // we just returned a node from.So just simply check for that case and move\n                        // forward in the array instead of searching for the node again.\n                        if (current && current.end === position && currentArrayIndex < (currentArray.length - 1)) {\n                            currentArrayIndex++;\n                            current = currentArray[currentArrayIndex];\n                        }\n                        // If we don't have a node, or the node we have isn't in the right position,\n                        // then try to find a viable node at the position requested.\n                        if (!current || current.pos !== position) {\n                            findHighestListElementThatStartsAtPosition(position);\n                        }\n                    }\n                    // Cache this query so that we don't do any extra work if the parser calls back\n                    // into us.  Note: this is very common as the parser will make pairs of calls like\n                    // 'isListElement -> parseListElement'.  If we were unable to find a node when\n                    // called with 'isListElement', we don't want to redo the work when parseListElement\n                    // is called immediately after.\n                    lastQueriedPosition = position;\n                    // Either we don'd have a node, or we have a node at the position being asked for.\n                    ts.Debug.assert(!current || current.pos === position);\n                    return current;\n                }\n            };\n            // Finds the highest element in the tree we can find that starts at the provided position.\n            // The element must be a direct child of some node list in the tree.  This way after we\n            // return it, we can easily return its next sibling in the list.\n            function findHighestListElementThatStartsAtPosition(position) {\n                // Clear out any cached state about the last node we found.\n                currentArray = undefined;\n                currentArrayIndex = -1 /* Value */;\n                current = undefined;\n                // Recurse into the source file to find the highest node at this position.\n                forEachChild(sourceFile, visitNode, visitArray);\n                return;\n                function visitNode(node) {\n                    if (position >= node.pos && position < node.end) {\n                        // Position was within this node.  Keep searching deeper to find the node.\n                        forEachChild(node, visitNode, visitArray);\n                        // don't proceed any further in the search.\n                        return true;\n                    }\n                    // position wasn't in this node, have to keep searching.\n                    return false;\n                }\n                function visitArray(array) {\n                    if (position >= array.pos && position < array.end) {\n                        // position was in this array.  Search through this array to see if we find a\n                        // viable element.\n                        for (var i = 0, n = array.length; i < n; i++) {\n                            var child = array[i];\n                            if (child) {\n                                if (child.pos === position) {\n                                    // Found the right node.  We're done.\n                                    currentArray = array;\n                                    currentArrayIndex = i;\n                                    current = child;\n                                    return true;\n                                }\n                                else {\n                                    if (child.pos < position && position < child.end) {\n                                        // Position in somewhere within this child.  Search in it and\n                                        // stop searching in this array.\n                                        forEachChild(child, visitNode, visitArray);\n                                        return true;\n                                    }\n                                }\n                            }\n                        }\n                    }\n                    // position wasn't in this array, have to keep searching.\n                    return false;\n                }\n            }\n        }\n        var InvalidPosition;\n        (function (InvalidPosition) {\n            InvalidPosition[InvalidPosition[\"Value\"] = -1] = \"Value\";\n        })(InvalidPosition || (InvalidPosition = {}));\n    })(IncrementalParser || (IncrementalParser = {}));\n})(ts || (ts = {}));\n/// <reference path=\"utilities.ts\"/>\n/// <reference path=\"parser.ts\"/>\n/* @internal */\nvar ts;\n(function (ts) {\n    var ModuleInstanceState;\n    (function (ModuleInstanceState) {\n        ModuleInstanceState[ModuleInstanceState[\"NonInstantiated\"] = 0] = \"NonInstantiated\";\n        ModuleInstanceState[ModuleInstanceState[\"Instantiated\"] = 1] = \"Instantiated\";\n        ModuleInstanceState[ModuleInstanceState[\"ConstEnumOnly\"] = 2] = \"ConstEnumOnly\";\n    })(ModuleInstanceState = ts.ModuleInstanceState || (ts.ModuleInstanceState = {}));\n    function getModuleInstanceState(node) {\n        // A module is uninstantiated if it contains only\n        // 1. interface declarations, type alias declarations\n        if (node.kind === 227 /* InterfaceDeclaration */ || node.kind === 228 /* TypeAliasDeclaration */) {\n            return 0 /* NonInstantiated */;\n        }\n        else if (ts.isConstEnumDeclaration(node)) {\n            return 2 /* ConstEnumOnly */;\n        }\n        else if ((node.kind === 235 /* ImportDeclaration */ || node.kind === 234 /* ImportEqualsDeclaration */) && !(ts.hasModifier(node, 1 /* Export */))) {\n            return 0 /* NonInstantiated */;\n        }\n        else if (node.kind === 231 /* ModuleBlock */) {\n            var state_1 = 0 /* NonInstantiated */;\n            ts.forEachChild(node, function (n) {\n                switch (getModuleInstanceState(n)) {\n                    case 0 /* NonInstantiated */:\n                        // child is non-instantiated - continue searching\n                        return false;\n                    case 2 /* ConstEnumOnly */:\n                        // child is const enum only - record state and continue searching\n                        state_1 = 2 /* ConstEnumOnly */;\n                        return false;\n                    case 1 /* Instantiated */:\n                        // child is instantiated - record state and stop\n                        state_1 = 1 /* Instantiated */;\n                        return true;\n                }\n            });\n            return state_1;\n        }\n        else if (node.kind === 230 /* ModuleDeclaration */) {\n            var body = node.body;\n            return body ? getModuleInstanceState(body) : 1 /* Instantiated */;\n        }\n        else if (node.kind === 70 /* Identifier */ && node.isInJSDocNamespace) {\n            return 0 /* NonInstantiated */;\n        }\n        else {\n            return 1 /* Instantiated */;\n        }\n    }\n    ts.getModuleInstanceState = getModuleInstanceState;\n    var ContainerFlags;\n    (function (ContainerFlags) {\n        // The current node is not a container, and no container manipulation should happen before\n        // recursing into it.\n        ContainerFlags[ContainerFlags[\"None\"] = 0] = \"None\";\n        // The current node is a container.  It should be set as the current container (and block-\n        // container) before recursing into it.  The current node does not have locals.  Examples:\n        //\n        //      Classes, ObjectLiterals, TypeLiterals, Interfaces...\n        ContainerFlags[ContainerFlags[\"IsContainer\"] = 1] = \"IsContainer\";\n        // The current node is a block-scoped-container.  It should be set as the current block-\n        // container before recursing into it.  Examples:\n        //\n        //      Blocks (when not parented by functions), Catch clauses, For/For-in/For-of statements...\n        ContainerFlags[ContainerFlags[\"IsBlockScopedContainer\"] = 2] = \"IsBlockScopedContainer\";\n        // The current node is the container of a control flow path. The current control flow should\n        // be saved and restored, and a new control flow initialized within the container.\n        ContainerFlags[ContainerFlags[\"IsControlFlowContainer\"] = 4] = \"IsControlFlowContainer\";\n        ContainerFlags[ContainerFlags[\"IsFunctionLike\"] = 8] = \"IsFunctionLike\";\n        ContainerFlags[ContainerFlags[\"IsFunctionExpression\"] = 16] = \"IsFunctionExpression\";\n        ContainerFlags[ContainerFlags[\"HasLocals\"] = 32] = \"HasLocals\";\n        ContainerFlags[ContainerFlags[\"IsInterface\"] = 64] = \"IsInterface\";\n        ContainerFlags[ContainerFlags[\"IsObjectLiteralOrClassExpressionMethod\"] = 128] = \"IsObjectLiteralOrClassExpressionMethod\";\n    })(ContainerFlags || (ContainerFlags = {}));\n    var binder = createBinder();\n    function bindSourceFile(file, options) {\n        ts.performance.mark(\"beforeBind\");\n        binder(file, options);\n        ts.performance.mark(\"afterBind\");\n        ts.performance.measure(\"Bind\", \"beforeBind\", \"afterBind\");\n    }\n    ts.bindSourceFile = bindSourceFile;\n    function createBinder() {\n        var file;\n        var options;\n        var languageVersion;\n        var parent;\n        var container;\n        var blockScopeContainer;\n        var lastContainer;\n        var seenThisKeyword;\n        // state used by control flow analysis\n        var currentFlow;\n        var currentBreakTarget;\n        var currentContinueTarget;\n        var currentReturnTarget;\n        var currentTrueTarget;\n        var currentFalseTarget;\n        var preSwitchCaseFlow;\n        var activeLabels;\n        var hasExplicitReturn;\n        // state used for emit helpers\n        var emitFlags;\n        // If this file is an external module, then it is automatically in strict-mode according to\n        // ES6.  If it is not an external module, then we'll determine if it is in strict mode or\n        // not depending on if we see \"use strict\" in certain places or if we hit a class/namespace\n        // or if compiler options contain alwaysStrict.\n        var inStrictMode;\n        var symbolCount = 0;\n        var Symbol;\n        var classifiableNames;\n        var unreachableFlow = { flags: 1 /* Unreachable */ };\n        var reportedUnreachableFlow = { flags: 1 /* Unreachable */ };\n        // state used to aggregate transform flags during bind.\n        var subtreeTransformFlags = 0 /* None */;\n        var skipTransformFlagAggregation;\n        function bindSourceFile(f, opts) {\n            file = f;\n            options = opts;\n            languageVersion = ts.getEmitScriptTarget(options);\n            inStrictMode = bindInStrictMode(file, opts);\n            classifiableNames = ts.createMap();\n            symbolCount = 0;\n            skipTransformFlagAggregation = ts.isDeclarationFile(file);\n            Symbol = ts.objectAllocator.getSymbolConstructor();\n            if (!file.locals) {\n                bind(file);\n                file.symbolCount = symbolCount;\n                file.classifiableNames = classifiableNames;\n            }\n            file = undefined;\n            options = undefined;\n            languageVersion = undefined;\n            parent = undefined;\n            container = undefined;\n            blockScopeContainer = undefined;\n            lastContainer = undefined;\n            seenThisKeyword = false;\n            currentFlow = undefined;\n            currentBreakTarget = undefined;\n            currentContinueTarget = undefined;\n            currentReturnTarget = undefined;\n            currentTrueTarget = undefined;\n            currentFalseTarget = undefined;\n            activeLabels = undefined;\n            hasExplicitReturn = false;\n            emitFlags = 0 /* None */;\n            subtreeTransformFlags = 0 /* None */;\n        }\n        return bindSourceFile;\n        function bindInStrictMode(file, opts) {\n            if (opts.alwaysStrict && !ts.isDeclarationFile(file)) {\n                // bind in strict mode source files with alwaysStrict option\n                return true;\n            }\n            else {\n                return !!file.externalModuleIndicator;\n            }\n        }\n        function createSymbol(flags, name) {\n            symbolCount++;\n            return new Symbol(flags, name);\n        }\n        function addDeclarationToSymbol(symbol, node, symbolFlags) {\n            symbol.flags |= symbolFlags;\n            node.symbol = symbol;\n            if (!symbol.declarations) {\n                symbol.declarations = [];\n            }\n            symbol.declarations.push(node);\n            if (symbolFlags & 1952 /* HasExports */ && !symbol.exports) {\n                symbol.exports = ts.createMap();\n            }\n            if (symbolFlags & 6240 /* HasMembers */ && !symbol.members) {\n                symbol.members = ts.createMap();\n            }\n            if (symbolFlags & 107455 /* Value */) {\n                var valueDeclaration = symbol.valueDeclaration;\n                if (!valueDeclaration ||\n                    (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 230 /* ModuleDeclaration */)) {\n                    // other kinds of value declarations take precedence over modules\n                    symbol.valueDeclaration = node;\n                }\n            }\n        }\n        // Should not be called on a declaration with a computed property name,\n        // unless it is a well known Symbol.\n        function getDeclarationName(node) {\n            if (node.name) {\n                if (ts.isAmbientModule(node)) {\n                    return ts.isGlobalScopeAugmentation(node) ? \"__global\" : \"\\\"\" + node.name.text + \"\\\"\";\n                }\n                if (node.name.kind === 142 /* ComputedPropertyName */) {\n                    var nameExpression = node.name.expression;\n                    // treat computed property names where expression is string/numeric literal as just string/numeric literal\n                    if (ts.isStringOrNumericLiteral(nameExpression)) {\n                        return nameExpression.text;\n                    }\n                    ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression));\n                    return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text);\n                }\n                return node.name.text;\n            }\n            switch (node.kind) {\n                case 150 /* Constructor */:\n                    return \"__constructor\";\n                case 158 /* FunctionType */:\n                case 153 /* CallSignature */:\n                    return \"__call\";\n                case 159 /* ConstructorType */:\n                case 154 /* ConstructSignature */:\n                    return \"__new\";\n                case 155 /* IndexSignature */:\n                    return \"__index\";\n                case 241 /* ExportDeclaration */:\n                    return \"__export\";\n                case 240 /* ExportAssignment */:\n                    return node.isExportEquals ? \"export=\" : \"default\";\n                case 192 /* BinaryExpression */:\n                    switch (ts.getSpecialPropertyAssignmentKind(node)) {\n                        case 2 /* ModuleExports */:\n                            // module.exports = ...\n                            return \"export=\";\n                        case 1 /* ExportsProperty */:\n                        case 4 /* ThisProperty */:\n                            // exports.x = ... or this.y = ...\n                            return node.left.name.text;\n                        case 3 /* PrototypeProperty */:\n                            // className.prototype.methodName = ...\n                            return node.left.expression.name.text;\n                    }\n                    ts.Debug.fail(\"Unknown binary declaration kind\");\n                    break;\n                case 225 /* FunctionDeclaration */:\n                case 226 /* ClassDeclaration */:\n                    return ts.hasModifier(node, 512 /* Default */) ? \"default\" : undefined;\n                case 274 /* JSDocFunctionType */:\n                    return ts.isJSDocConstructSignature(node) ? \"__new\" : \"__call\";\n                case 144 /* Parameter */:\n                    // Parameters with names are handled at the top of this function.  Parameters\n                    // without names can only come from JSDocFunctionTypes.\n                    ts.Debug.assert(node.parent.kind === 274 /* JSDocFunctionType */);\n                    var functionType = node.parent;\n                    var index = ts.indexOf(functionType.parameters, node);\n                    return \"arg\" + index;\n                case 285 /* JSDocTypedefTag */:\n                    var parentNode = node.parent && node.parent.parent;\n                    var nameFromParentNode = void 0;\n                    if (parentNode && parentNode.kind === 205 /* VariableStatement */) {\n                        if (parentNode.declarationList.declarations.length > 0) {\n                            var nameIdentifier = parentNode.declarationList.declarations[0].name;\n                            if (nameIdentifier.kind === 70 /* Identifier */) {\n                                nameFromParentNode = nameIdentifier.text;\n                            }\n                        }\n                    }\n                    return nameFromParentNode;\n            }\n        }\n        function getDisplayName(node) {\n            return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node);\n        }\n        /**\n         * Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names.\n         * @param symbolTable - The symbol table which node will be added to.\n         * @param parent - node's parent declaration.\n         * @param node - The declaration to be added to the symbol table\n         * @param includes - The SymbolFlags that node has in addition to its declaration type (eg: export, ambient, etc.)\n         * @param excludes - The flags which node cannot be declared alongside in a symbol table. Used to report forbidden declarations.\n         */\n        function declareSymbol(symbolTable, parent, node, includes, excludes) {\n            ts.Debug.assert(!ts.hasDynamicName(node));\n            var isDefaultExport = ts.hasModifier(node, 512 /* Default */);\n            // The exported symbol for an export default function/class node is always named \"default\"\n            var name = isDefaultExport && parent ? \"default\" : getDeclarationName(node);\n            var symbol;\n            if (name === undefined) {\n                symbol = createSymbol(0 /* None */, \"__missing\");\n            }\n            else {\n                // Check and see if the symbol table already has a symbol with this name.  If not,\n                // create a new symbol with this name and add it to the table.  Note that we don't\n                // give the new symbol any flags *yet*.  This ensures that it will not conflict\n                // with the 'excludes' flags we pass in.\n                //\n                // If we do get an existing symbol, see if it conflicts with the new symbol we're\n                // creating.  For example, a 'var' symbol and a 'class' symbol will conflict within\n                // the same symbol table.  If we have a conflict, report the issue on each\n                // declaration we have for this symbol, and then create a new symbol for this\n                // declaration.\n                //\n                // Note that when properties declared in Javascript constructors\n                // (marked by isReplaceableByMethod) conflict with another symbol, the property loses.\n                // Always. This allows the common Javascript pattern of overwriting a prototype method\n                // with an bound instance method of the same type: `this.method = this.method.bind(this)`\n                //\n                // If we created a new symbol, either because we didn't have a symbol with this name\n                // in the symbol table, or we conflicted with an existing symbol, then just add this\n                // node as the sole declaration of the new symbol.\n                //\n                // Otherwise, we'll be merging into a compatible existing symbol (for example when\n                // you have multiple 'vars' with the same name in the same container).  In this case\n                // just add this node into the declarations list of the symbol.\n                symbol = symbolTable[name] || (symbolTable[name] = createSymbol(0 /* None */, name));\n                if (name && (includes & 788448 /* Classifiable */)) {\n                    classifiableNames[name] = name;\n                }\n                if (symbol.flags & excludes) {\n                    if (symbol.isReplaceableByMethod) {\n                        // Javascript constructor-declared symbols can be discarded in favor of\n                        // prototype symbols like methods.\n                        symbol = symbolTable[name] = createSymbol(0 /* None */, name);\n                    }\n                    else {\n                        if (node.name) {\n                            node.name.parent = node;\n                        }\n                        // Report errors every position with duplicate declaration\n                        // Report errors on previous encountered declarations\n                        var message_1 = symbol.flags & 2 /* BlockScopedVariable */\n                            ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0\n                            : ts.Diagnostics.Duplicate_identifier_0;\n                        if (symbol.declarations && symbol.declarations.length) {\n                            // If the current node is a default export of some sort, then check if\n                            // there are any other default exports that we need to error on.\n                            // We'll know whether we have other default exports depending on if `symbol` already has a declaration list set.\n                            if (isDefaultExport) {\n                                message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;\n                            }\n                            else {\n                                // This is to properly report an error in the case \"export default { }\" is after export default of class declaration or function declaration.\n                                // Error on multiple export default in the following case:\n                                // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default\n                                // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers)\n                                if (symbol.declarations && symbol.declarations.length &&\n                                    (isDefaultExport || (node.kind === 240 /* ExportAssignment */ && !node.isExportEquals))) {\n                                    message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;\n                                }\n                            }\n                        }\n                        ts.forEach(symbol.declarations, function (declaration) {\n                            file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message_1, getDisplayName(declaration)));\n                        });\n                        file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message_1, getDisplayName(node)));\n                        symbol = createSymbol(0 /* None */, name);\n                    }\n                }\n            }\n            addDeclarationToSymbol(symbol, node, includes);\n            symbol.parent = parent;\n            return symbol;\n        }\n        function declareModuleMember(node, symbolFlags, symbolExcludes) {\n            var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */;\n            if (symbolFlags & 8388608 /* Alias */) {\n                if (node.kind === 243 /* ExportSpecifier */ || (node.kind === 234 /* ImportEqualsDeclaration */ && hasExportModifier)) {\n                    return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);\n                }\n                else {\n                    return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);\n                }\n            }\n            else {\n                // Exported module members are given 2 symbols: A local symbol that is classified with an ExportValue,\n                // ExportType, or ExportContainer flag, and an associated export symbol with all the correct flags set\n                // on it. There are 2 main reasons:\n                //\n                //   1. We treat locals and exports of the same name as mutually exclusive within a container.\n                //      That means the binder will issue a Duplicate Identifier error if you mix locals and exports\n                //      with the same name in the same container.\n                //      TODO: Make this a more specific error and decouple it from the exclusion logic.\n                //   2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol,\n                //      but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way\n                //      when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope.\n                // NOTE: Nested ambient modules always should go to to 'locals' table to prevent their automatic merge\n                //       during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation\n                //       and this case is specially handled. Module augmentations should only be merged with original module definition\n                //       and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed.\n                var isJSDocTypedefInJSDocNamespace = node.kind === 285 /* JSDocTypedefTag */ &&\n                    node.name &&\n                    node.name.kind === 70 /* Identifier */ &&\n                    node.name.isInJSDocNamespace;\n                if ((!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 32 /* ExportContext */)) || isJSDocTypedefInJSDocNamespace) {\n                    var exportKind = (symbolFlags & 107455 /* Value */ ? 1048576 /* ExportValue */ : 0) |\n                        (symbolFlags & 793064 /* Type */ ? 2097152 /* ExportType */ : 0) |\n                        (symbolFlags & 1920 /* Namespace */ ? 4194304 /* ExportNamespace */ : 0);\n                    var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes);\n                    local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);\n                    node.localSymbol = local;\n                    return local;\n                }\n                else {\n                    return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);\n                }\n            }\n        }\n        // All container nodes are kept on a linked list in declaration order. This list is used by\n        // the getLocalNameOfContainer function in the type checker to validate that the local name\n        // used for a container is unique.\n        function bindContainer(node, containerFlags) {\n            // Before we recurse into a node's children, we first save the existing parent, container\n            // and block-container.  Then after we pop out of processing the children, we restore\n            // these saved values.\n            var saveContainer = container;\n            var savedBlockScopeContainer = blockScopeContainer;\n            // Depending on what kind of node this is, we may have to adjust the current container\n            // and block-container.   If the current node is a container, then it is automatically\n            // considered the current block-container as well.  Also, for containers that we know\n            // may contain locals, we proactively initialize the .locals field. We do this because\n            // it's highly likely that the .locals will be needed to place some child in (for example,\n            // a parameter, or variable declaration).\n            //\n            // However, we do not proactively create the .locals for block-containers because it's\n            // totally normal and common for block-containers to never actually have a block-scoped\n            // variable in them.  We don't want to end up allocating an object for every 'block' we\n            // run into when most of them won't be necessary.\n            //\n            // Finally, if this is a block-container, then we clear out any existing .locals object\n            // it may contain within it.  This happens in incremental scenarios.  Because we can be\n            // reusing a node from a previous compilation, that node may have had 'locals' created\n            // for it.  We must clear this so we don't accidentally move any stale data forward from\n            // a previous compilation.\n            if (containerFlags & 1 /* IsContainer */) {\n                container = blockScopeContainer = node;\n                if (containerFlags & 32 /* HasLocals */) {\n                    container.locals = ts.createMap();\n                }\n                addToContainerChain(container);\n            }\n            else if (containerFlags & 2 /* IsBlockScopedContainer */) {\n                blockScopeContainer = node;\n                blockScopeContainer.locals = undefined;\n            }\n            if (containerFlags & 4 /* IsControlFlowContainer */) {\n                var saveCurrentFlow = currentFlow;\n                var saveBreakTarget = currentBreakTarget;\n                var saveContinueTarget = currentContinueTarget;\n                var saveReturnTarget = currentReturnTarget;\n                var saveActiveLabels = activeLabels;\n                var saveHasExplicitReturn = hasExplicitReturn;\n                var isIIFE = containerFlags & 16 /* IsFunctionExpression */ && !ts.hasModifier(node, 256 /* Async */) && !!ts.getImmediatelyInvokedFunctionExpression(node);\n                // A non-async IIFE is considered part of the containing control flow. Return statements behave\n                // similarly to break statements that exit to a label just past the statement body.\n                if (isIIFE) {\n                    currentReturnTarget = createBranchLabel();\n                }\n                else {\n                    currentFlow = { flags: 2 /* Start */ };\n                    if (containerFlags & (16 /* IsFunctionExpression */ | 128 /* IsObjectLiteralOrClassExpressionMethod */)) {\n                        currentFlow.container = node;\n                    }\n                    currentReturnTarget = undefined;\n                }\n                currentBreakTarget = undefined;\n                currentContinueTarget = undefined;\n                activeLabels = undefined;\n                hasExplicitReturn = false;\n                bindChildren(node);\n                // Reset all reachability check related flags on node (for incremental scenarios)\n                node.flags &= ~1408 /* ReachabilityAndEmitFlags */;\n                if (!(currentFlow.flags & 1 /* Unreachable */) && containerFlags & 8 /* IsFunctionLike */ && ts.nodeIsPresent(node.body)) {\n                    node.flags |= 128 /* HasImplicitReturn */;\n                    if (hasExplicitReturn)\n                        node.flags |= 256 /* HasExplicitReturn */;\n                }\n                if (node.kind === 261 /* SourceFile */) {\n                    node.flags |= emitFlags;\n                }\n                if (isIIFE) {\n                    addAntecedent(currentReturnTarget, currentFlow);\n                    currentFlow = finishFlowLabel(currentReturnTarget);\n                }\n                else {\n                    currentFlow = saveCurrentFlow;\n                }\n                currentBreakTarget = saveBreakTarget;\n                currentContinueTarget = saveContinueTarget;\n                currentReturnTarget = saveReturnTarget;\n                activeLabels = saveActiveLabels;\n                hasExplicitReturn = saveHasExplicitReturn;\n            }\n            else if (containerFlags & 64 /* IsInterface */) {\n                seenThisKeyword = false;\n                bindChildren(node);\n                node.flags = seenThisKeyword ? node.flags | 64 /* ContainsThis */ : node.flags & ~64 /* ContainsThis */;\n            }\n            else {\n                bindChildren(node);\n            }\n            container = saveContainer;\n            blockScopeContainer = savedBlockScopeContainer;\n        }\n        function bindChildren(node) {\n            if (skipTransformFlagAggregation) {\n                bindChildrenWorker(node);\n            }\n            else if (node.transformFlags & 536870912 /* HasComputedFlags */) {\n                skipTransformFlagAggregation = true;\n                bindChildrenWorker(node);\n                skipTransformFlagAggregation = false;\n                subtreeTransformFlags |= node.transformFlags & ~getTransformFlagsSubtreeExclusions(node.kind);\n            }\n            else {\n                var savedSubtreeTransformFlags = subtreeTransformFlags;\n                subtreeTransformFlags = 0;\n                bindChildrenWorker(node);\n                subtreeTransformFlags = savedSubtreeTransformFlags | computeTransformFlagsForNode(node, subtreeTransformFlags);\n            }\n        }\n        function bindEach(nodes) {\n            if (nodes === undefined) {\n                return;\n            }\n            if (skipTransformFlagAggregation) {\n                ts.forEach(nodes, bind);\n            }\n            else {\n                var savedSubtreeTransformFlags = subtreeTransformFlags;\n                subtreeTransformFlags = 0 /* None */;\n                var nodeArrayFlags = 0 /* None */;\n                for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {\n                    var node = nodes_2[_i];\n                    bind(node);\n                    nodeArrayFlags |= node.transformFlags & ~536870912 /* HasComputedFlags */;\n                }\n                nodes.transformFlags = nodeArrayFlags | 536870912 /* HasComputedFlags */;\n                subtreeTransformFlags |= savedSubtreeTransformFlags;\n            }\n        }\n        function bindEachChild(node) {\n            ts.forEachChild(node, bind, bindEach);\n        }\n        function bindChildrenWorker(node) {\n            // Binding of JsDocComment should be done before the current block scope container changes.\n            // because the scope of JsDocComment should not be affected by whether the current node is a\n            // container or not.\n            if (ts.isInJavaScriptFile(node) && node.jsDoc) {\n                ts.forEach(node.jsDoc, bind);\n            }\n            if (checkUnreachable(node)) {\n                bindEachChild(node);\n                return;\n            }\n            switch (node.kind) {\n                case 210 /* WhileStatement */:\n                    bindWhileStatement(node);\n                    break;\n                case 209 /* DoStatement */:\n                    bindDoStatement(node);\n                    break;\n                case 211 /* ForStatement */:\n                    bindForStatement(node);\n                    break;\n                case 212 /* ForInStatement */:\n                case 213 /* ForOfStatement */:\n                    bindForInOrForOfStatement(node);\n                    break;\n                case 208 /* IfStatement */:\n                    bindIfStatement(node);\n                    break;\n                case 216 /* ReturnStatement */:\n                case 220 /* ThrowStatement */:\n                    bindReturnOrThrow(node);\n                    break;\n                case 215 /* BreakStatement */:\n                case 214 /* ContinueStatement */:\n                    bindBreakOrContinueStatement(node);\n                    break;\n                case 221 /* TryStatement */:\n                    bindTryStatement(node);\n                    break;\n                case 218 /* SwitchStatement */:\n                    bindSwitchStatement(node);\n                    break;\n                case 232 /* CaseBlock */:\n                    bindCaseBlock(node);\n                    break;\n                case 253 /* CaseClause */:\n                    bindCaseClause(node);\n                    break;\n                case 219 /* LabeledStatement */:\n                    bindLabeledStatement(node);\n                    break;\n                case 190 /* PrefixUnaryExpression */:\n                    bindPrefixUnaryExpressionFlow(node);\n                    break;\n                case 191 /* PostfixUnaryExpression */:\n                    bindPostfixUnaryExpressionFlow(node);\n                    break;\n                case 192 /* BinaryExpression */:\n                    bindBinaryExpressionFlow(node);\n                    break;\n                case 186 /* DeleteExpression */:\n                    bindDeleteExpressionFlow(node);\n                    break;\n                case 193 /* ConditionalExpression */:\n                    bindConditionalExpressionFlow(node);\n                    break;\n                case 223 /* VariableDeclaration */:\n                    bindVariableDeclarationFlow(node);\n                    break;\n                case 179 /* CallExpression */:\n                    bindCallExpressionFlow(node);\n                    break;\n                default:\n                    bindEachChild(node);\n                    break;\n            }\n        }\n        function isNarrowingExpression(expr) {\n            switch (expr.kind) {\n                case 70 /* Identifier */:\n                case 98 /* ThisKeyword */:\n                case 177 /* PropertyAccessExpression */:\n                    return isNarrowableReference(expr);\n                case 179 /* CallExpression */:\n                    return hasNarrowableArgument(expr);\n                case 183 /* ParenthesizedExpression */:\n                    return isNarrowingExpression(expr.expression);\n                case 192 /* BinaryExpression */:\n                    return isNarrowingBinaryExpression(expr);\n                case 190 /* PrefixUnaryExpression */:\n                    return expr.operator === 50 /* ExclamationToken */ && isNarrowingExpression(expr.operand);\n            }\n            return false;\n        }\n        function isNarrowableReference(expr) {\n            return expr.kind === 70 /* Identifier */ ||\n                expr.kind === 98 /* ThisKeyword */ ||\n                expr.kind === 177 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression);\n        }\n        function hasNarrowableArgument(expr) {\n            if (expr.arguments) {\n                for (var _i = 0, _a = expr.arguments; _i < _a.length; _i++) {\n                    var argument = _a[_i];\n                    if (isNarrowableReference(argument)) {\n                        return true;\n                    }\n                }\n            }\n            if (expr.expression.kind === 177 /* PropertyAccessExpression */ &&\n                isNarrowableReference(expr.expression.expression)) {\n                return true;\n            }\n            return false;\n        }\n        function isNarrowingTypeofOperands(expr1, expr2) {\n            return expr1.kind === 187 /* TypeOfExpression */ && isNarrowableOperand(expr1.expression) && expr2.kind === 9 /* StringLiteral */;\n        }\n        function isNarrowingBinaryExpression(expr) {\n            switch (expr.operatorToken.kind) {\n                case 57 /* EqualsToken */:\n                    return isNarrowableReference(expr.left);\n                case 31 /* EqualsEqualsToken */:\n                case 32 /* ExclamationEqualsToken */:\n                case 33 /* EqualsEqualsEqualsToken */:\n                case 34 /* ExclamationEqualsEqualsToken */:\n                    return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) ||\n                        isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);\n                case 92 /* InstanceOfKeyword */:\n                    return isNarrowableOperand(expr.left);\n                case 25 /* CommaToken */:\n                    return isNarrowingExpression(expr.right);\n            }\n            return false;\n        }\n        function isNarrowableOperand(expr) {\n            switch (expr.kind) {\n                case 183 /* ParenthesizedExpression */:\n                    return isNarrowableOperand(expr.expression);\n                case 192 /* BinaryExpression */:\n                    switch (expr.operatorToken.kind) {\n                        case 57 /* EqualsToken */:\n                            return isNarrowableOperand(expr.left);\n                        case 25 /* CommaToken */:\n                            return isNarrowableOperand(expr.right);\n                    }\n            }\n            return isNarrowableReference(expr);\n        }\n        function createBranchLabel() {\n            return {\n                flags: 4 /* BranchLabel */,\n                antecedents: undefined\n            };\n        }\n        function createLoopLabel() {\n            return {\n                flags: 8 /* LoopLabel */,\n                antecedents: undefined\n            };\n        }\n        function setFlowNodeReferenced(flow) {\n            // On first reference we set the Referenced flag, thereafter we set the Shared flag\n            flow.flags |= flow.flags & 512 /* Referenced */ ? 1024 /* Shared */ : 512 /* Referenced */;\n        }\n        function addAntecedent(label, antecedent) {\n            if (!(antecedent.flags & 1 /* Unreachable */) && !ts.contains(label.antecedents, antecedent)) {\n                (label.antecedents || (label.antecedents = [])).push(antecedent);\n                setFlowNodeReferenced(antecedent);\n            }\n        }\n        function createFlowCondition(flags, antecedent, expression) {\n            if (antecedent.flags & 1 /* Unreachable */) {\n                return antecedent;\n            }\n            if (!expression) {\n                return flags & 32 /* TrueCondition */ ? antecedent : unreachableFlow;\n            }\n            if (expression.kind === 100 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||\n                expression.kind === 85 /* FalseKeyword */ && flags & 32 /* TrueCondition */) {\n                return unreachableFlow;\n            }\n            if (!isNarrowingExpression(expression)) {\n                return antecedent;\n            }\n            setFlowNodeReferenced(antecedent);\n            return {\n                flags: flags,\n                expression: expression,\n                antecedent: antecedent\n            };\n        }\n        function createFlowSwitchClause(antecedent, switchStatement, clauseStart, clauseEnd) {\n            if (!isNarrowingExpression(switchStatement.expression)) {\n                return antecedent;\n            }\n            setFlowNodeReferenced(antecedent);\n            return {\n                flags: 128 /* SwitchClause */,\n                switchStatement: switchStatement,\n                clauseStart: clauseStart,\n                clauseEnd: clauseEnd,\n                antecedent: antecedent\n            };\n        }\n        function createFlowAssignment(antecedent, node) {\n            setFlowNodeReferenced(antecedent);\n            return {\n                flags: 16 /* Assignment */,\n                antecedent: antecedent,\n                node: node\n            };\n        }\n        function createFlowArrayMutation(antecedent, node) {\n            setFlowNodeReferenced(antecedent);\n            return {\n                flags: 256 /* ArrayMutation */,\n                antecedent: antecedent,\n                node: node\n            };\n        }\n        function finishFlowLabel(flow) {\n            var antecedents = flow.antecedents;\n            if (!antecedents) {\n                return unreachableFlow;\n            }\n            if (antecedents.length === 1) {\n                return antecedents[0];\n            }\n            return flow;\n        }\n        function isStatementCondition(node) {\n            var parent = node.parent;\n            switch (parent.kind) {\n                case 208 /* IfStatement */:\n                case 210 /* WhileStatement */:\n                case 209 /* DoStatement */:\n                    return parent.expression === node;\n                case 211 /* ForStatement */:\n                case 193 /* ConditionalExpression */:\n                    return parent.condition === node;\n            }\n            return false;\n        }\n        function isLogicalExpression(node) {\n            while (true) {\n                if (node.kind === 183 /* ParenthesizedExpression */) {\n                    node = node.expression;\n                }\n                else if (node.kind === 190 /* PrefixUnaryExpression */ && node.operator === 50 /* ExclamationToken */) {\n                    node = node.operand;\n                }\n                else {\n                    return node.kind === 192 /* BinaryExpression */ && (node.operatorToken.kind === 52 /* AmpersandAmpersandToken */ ||\n                        node.operatorToken.kind === 53 /* BarBarToken */);\n                }\n            }\n        }\n        function isTopLevelLogicalExpression(node) {\n            while (node.parent.kind === 183 /* ParenthesizedExpression */ ||\n                node.parent.kind === 190 /* PrefixUnaryExpression */ &&\n                    node.parent.operator === 50 /* ExclamationToken */) {\n                node = node.parent;\n            }\n            return !isStatementCondition(node) && !isLogicalExpression(node.parent);\n        }\n        function bindCondition(node, trueTarget, falseTarget) {\n            var saveTrueTarget = currentTrueTarget;\n            var saveFalseTarget = currentFalseTarget;\n            currentTrueTarget = trueTarget;\n            currentFalseTarget = falseTarget;\n            bind(node);\n            currentTrueTarget = saveTrueTarget;\n            currentFalseTarget = saveFalseTarget;\n            if (!node || !isLogicalExpression(node)) {\n                addAntecedent(trueTarget, createFlowCondition(32 /* TrueCondition */, currentFlow, node));\n                addAntecedent(falseTarget, createFlowCondition(64 /* FalseCondition */, currentFlow, node));\n            }\n        }\n        function bindIterativeStatement(node, breakTarget, continueTarget) {\n            var saveBreakTarget = currentBreakTarget;\n            var saveContinueTarget = currentContinueTarget;\n            currentBreakTarget = breakTarget;\n            currentContinueTarget = continueTarget;\n            bind(node);\n            currentBreakTarget = saveBreakTarget;\n            currentContinueTarget = saveContinueTarget;\n        }\n        function bindWhileStatement(node) {\n            var preWhileLabel = createLoopLabel();\n            var preBodyLabel = createBranchLabel();\n            var postWhileLabel = createBranchLabel();\n            addAntecedent(preWhileLabel, currentFlow);\n            currentFlow = preWhileLabel;\n            bindCondition(node.expression, preBodyLabel, postWhileLabel);\n            currentFlow = finishFlowLabel(preBodyLabel);\n            bindIterativeStatement(node.statement, postWhileLabel, preWhileLabel);\n            addAntecedent(preWhileLabel, currentFlow);\n            currentFlow = finishFlowLabel(postWhileLabel);\n        }\n        function bindDoStatement(node) {\n            var preDoLabel = createLoopLabel();\n            var enclosingLabeledStatement = node.parent.kind === 219 /* LabeledStatement */\n                ? ts.lastOrUndefined(activeLabels)\n                : undefined;\n            // if do statement is wrapped in labeled statement then target labels for break/continue with or without\n            // label should be the same\n            var preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel();\n            var postDoLabel = enclosingLabeledStatement ? enclosingLabeledStatement.breakTarget : createBranchLabel();\n            addAntecedent(preDoLabel, currentFlow);\n            currentFlow = preDoLabel;\n            bindIterativeStatement(node.statement, postDoLabel, preConditionLabel);\n            addAntecedent(preConditionLabel, currentFlow);\n            currentFlow = finishFlowLabel(preConditionLabel);\n            bindCondition(node.expression, preDoLabel, postDoLabel);\n            currentFlow = finishFlowLabel(postDoLabel);\n        }\n        function bindForStatement(node) {\n            var preLoopLabel = createLoopLabel();\n            var preBodyLabel = createBranchLabel();\n            var postLoopLabel = createBranchLabel();\n            bind(node.initializer);\n            addAntecedent(preLoopLabel, currentFlow);\n            currentFlow = preLoopLabel;\n            bindCondition(node.condition, preBodyLabel, postLoopLabel);\n            currentFlow = finishFlowLabel(preBodyLabel);\n            bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);\n            bind(node.incrementor);\n            addAntecedent(preLoopLabel, currentFlow);\n            currentFlow = finishFlowLabel(postLoopLabel);\n        }\n        function bindForInOrForOfStatement(node) {\n            var preLoopLabel = createLoopLabel();\n            var postLoopLabel = createBranchLabel();\n            addAntecedent(preLoopLabel, currentFlow);\n            currentFlow = preLoopLabel;\n            bind(node.expression);\n            addAntecedent(postLoopLabel, currentFlow);\n            bind(node.initializer);\n            if (node.initializer.kind !== 224 /* VariableDeclarationList */) {\n                bindAssignmentTargetFlow(node.initializer);\n            }\n            bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);\n            addAntecedent(preLoopLabel, currentFlow);\n            currentFlow = finishFlowLabel(postLoopLabel);\n        }\n        function bindIfStatement(node) {\n            var thenLabel = createBranchLabel();\n            var elseLabel = createBranchLabel();\n            var postIfLabel = createBranchLabel();\n            bindCondition(node.expression, thenLabel, elseLabel);\n            currentFlow = finishFlowLabel(thenLabel);\n            bind(node.thenStatement);\n            addAntecedent(postIfLabel, currentFlow);\n            currentFlow = finishFlowLabel(elseLabel);\n            bind(node.elseStatement);\n            addAntecedent(postIfLabel, currentFlow);\n            currentFlow = finishFlowLabel(postIfLabel);\n        }\n        function bindReturnOrThrow(node) {\n            bind(node.expression);\n            if (node.kind === 216 /* ReturnStatement */) {\n                hasExplicitReturn = true;\n                if (currentReturnTarget) {\n                    addAntecedent(currentReturnTarget, currentFlow);\n                }\n            }\n            currentFlow = unreachableFlow;\n        }\n        function findActiveLabel(name) {\n            if (activeLabels) {\n                for (var _i = 0, activeLabels_1 = activeLabels; _i < activeLabels_1.length; _i++) {\n                    var label = activeLabels_1[_i];\n                    if (label.name === name) {\n                        return label;\n                    }\n                }\n            }\n            return undefined;\n        }\n        function bindBreakOrContinueFlow(node, breakTarget, continueTarget) {\n            var flowLabel = node.kind === 215 /* BreakStatement */ ? breakTarget : continueTarget;\n            if (flowLabel) {\n                addAntecedent(flowLabel, currentFlow);\n                currentFlow = unreachableFlow;\n            }\n        }\n        function bindBreakOrContinueStatement(node) {\n            bind(node.label);\n            if (node.label) {\n                var activeLabel = findActiveLabel(node.label.text);\n                if (activeLabel) {\n                    activeLabel.referenced = true;\n                    bindBreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget);\n                }\n            }\n            else {\n                bindBreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget);\n            }\n        }\n        function bindTryStatement(node) {\n            var preFinallyLabel = createBranchLabel();\n            var preTryFlow = currentFlow;\n            // TODO: Every statement in try block is potentially an exit point!\n            bind(node.tryBlock);\n            addAntecedent(preFinallyLabel, currentFlow);\n            var flowAfterTry = currentFlow;\n            var flowAfterCatch = unreachableFlow;\n            if (node.catchClause) {\n                currentFlow = preTryFlow;\n                bind(node.catchClause);\n                addAntecedent(preFinallyLabel, currentFlow);\n                flowAfterCatch = currentFlow;\n            }\n            if (node.finallyBlock) {\n                // in finally flow is combined from pre-try/flow from try/flow from catch\n                // pre-flow is necessary to make sure that finally is reachable even if finally flows in both try and finally blocks are unreachable\n                addAntecedent(preFinallyLabel, preTryFlow);\n                currentFlow = finishFlowLabel(preFinallyLabel);\n                bind(node.finallyBlock);\n                // if flow after finally is unreachable - keep it\n                // otherwise check if flows after try and after catch are unreachable\n                // if yes - convert current flow to unreachable\n                // i.e.\n                // try { return \"1\" } finally { console.log(1); }\n                // console.log(2); // this line should be unreachable even if flow falls out of finally block\n                if (!(currentFlow.flags & 1 /* Unreachable */)) {\n                    if ((flowAfterTry.flags & 1 /* Unreachable */) && (flowAfterCatch.flags & 1 /* Unreachable */)) {\n                        currentFlow = flowAfterTry === reportedUnreachableFlow || flowAfterCatch === reportedUnreachableFlow\n                            ? reportedUnreachableFlow\n                            : unreachableFlow;\n                    }\n                }\n            }\n            else {\n                currentFlow = finishFlowLabel(preFinallyLabel);\n            }\n        }\n        function bindSwitchStatement(node) {\n            var postSwitchLabel = createBranchLabel();\n            bind(node.expression);\n            var saveBreakTarget = currentBreakTarget;\n            var savePreSwitchCaseFlow = preSwitchCaseFlow;\n            currentBreakTarget = postSwitchLabel;\n            preSwitchCaseFlow = currentFlow;\n            bind(node.caseBlock);\n            addAntecedent(postSwitchLabel, currentFlow);\n            var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 254 /* DefaultClause */; });\n            // We mark a switch statement as possibly exhaustive if it has no default clause and if all\n            // case clauses have unreachable end points (e.g. they all return).\n            node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents;\n            if (!hasDefault) {\n                addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0));\n            }\n            currentBreakTarget = saveBreakTarget;\n            preSwitchCaseFlow = savePreSwitchCaseFlow;\n            currentFlow = finishFlowLabel(postSwitchLabel);\n        }\n        function bindCaseBlock(node) {\n            var savedSubtreeTransformFlags = subtreeTransformFlags;\n            subtreeTransformFlags = 0;\n            var clauses = node.clauses;\n            var fallthroughFlow = unreachableFlow;\n            for (var i = 0; i < clauses.length; i++) {\n                var clauseStart = i;\n                while (!clauses[i].statements.length && i + 1 < clauses.length) {\n                    bind(clauses[i]);\n                    i++;\n                }\n                var preCaseLabel = createBranchLabel();\n                addAntecedent(preCaseLabel, createFlowSwitchClause(preSwitchCaseFlow, node.parent, clauseStart, i + 1));\n                addAntecedent(preCaseLabel, fallthroughFlow);\n                currentFlow = finishFlowLabel(preCaseLabel);\n                var clause = clauses[i];\n                bind(clause);\n                fallthroughFlow = currentFlow;\n                if (!(currentFlow.flags & 1 /* Unreachable */) && i !== clauses.length - 1 && options.noFallthroughCasesInSwitch) {\n                    errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch);\n                }\n            }\n            clauses.transformFlags = subtreeTransformFlags | 536870912 /* HasComputedFlags */;\n            subtreeTransformFlags |= savedSubtreeTransformFlags;\n        }\n        function bindCaseClause(node) {\n            var saveCurrentFlow = currentFlow;\n            currentFlow = preSwitchCaseFlow;\n            bind(node.expression);\n            currentFlow = saveCurrentFlow;\n            bindEach(node.statements);\n        }\n        function pushActiveLabel(name, breakTarget, continueTarget) {\n            var activeLabel = {\n                name: name,\n                breakTarget: breakTarget,\n                continueTarget: continueTarget,\n                referenced: false\n            };\n            (activeLabels || (activeLabels = [])).push(activeLabel);\n            return activeLabel;\n        }\n        function popActiveLabel() {\n            activeLabels.pop();\n        }\n        function bindLabeledStatement(node) {\n            var preStatementLabel = createLoopLabel();\n            var postStatementLabel = createBranchLabel();\n            bind(node.label);\n            addAntecedent(preStatementLabel, currentFlow);\n            var activeLabel = pushActiveLabel(node.label.text, postStatementLabel, preStatementLabel);\n            bind(node.statement);\n            popActiveLabel();\n            if (!activeLabel.referenced && !options.allowUnusedLabels) {\n                file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label));\n            }\n            if (!node.statement || node.statement.kind !== 209 /* DoStatement */) {\n                // do statement sets current flow inside bindDoStatement\n                addAntecedent(postStatementLabel, currentFlow);\n                currentFlow = finishFlowLabel(postStatementLabel);\n            }\n        }\n        function bindDestructuringTargetFlow(node) {\n            if (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */) {\n                bindAssignmentTargetFlow(node.left);\n            }\n            else {\n                bindAssignmentTargetFlow(node);\n            }\n        }\n        function bindAssignmentTargetFlow(node) {\n            if (isNarrowableReference(node)) {\n                currentFlow = createFlowAssignment(currentFlow, node);\n            }\n            else if (node.kind === 175 /* ArrayLiteralExpression */) {\n                for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {\n                    var e = _a[_i];\n                    if (e.kind === 196 /* SpreadElement */) {\n                        bindAssignmentTargetFlow(e.expression);\n                    }\n                    else {\n                        bindDestructuringTargetFlow(e);\n                    }\n                }\n            }\n            else if (node.kind === 176 /* ObjectLiteralExpression */) {\n                for (var _b = 0, _c = node.properties; _b < _c.length; _b++) {\n                    var p = _c[_b];\n                    if (p.kind === 257 /* PropertyAssignment */) {\n                        bindDestructuringTargetFlow(p.initializer);\n                    }\n                    else if (p.kind === 258 /* ShorthandPropertyAssignment */) {\n                        bindAssignmentTargetFlow(p.name);\n                    }\n                    else if (p.kind === 259 /* SpreadAssignment */) {\n                        bindAssignmentTargetFlow(p.expression);\n                    }\n                }\n            }\n        }\n        function bindLogicalExpression(node, trueTarget, falseTarget) {\n            var preRightLabel = createBranchLabel();\n            if (node.operatorToken.kind === 52 /* AmpersandAmpersandToken */) {\n                bindCondition(node.left, preRightLabel, falseTarget);\n            }\n            else {\n                bindCondition(node.left, trueTarget, preRightLabel);\n            }\n            currentFlow = finishFlowLabel(preRightLabel);\n            bind(node.operatorToken);\n            bindCondition(node.right, trueTarget, falseTarget);\n        }\n        function bindPrefixUnaryExpressionFlow(node) {\n            if (node.operator === 50 /* ExclamationToken */) {\n                var saveTrueTarget = currentTrueTarget;\n                currentTrueTarget = currentFalseTarget;\n                currentFalseTarget = saveTrueTarget;\n                bindEachChild(node);\n                currentFalseTarget = currentTrueTarget;\n                currentTrueTarget = saveTrueTarget;\n            }\n            else {\n                bindEachChild(node);\n                if (node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */) {\n                    bindAssignmentTargetFlow(node.operand);\n                }\n            }\n        }\n        function bindPostfixUnaryExpressionFlow(node) {\n            bindEachChild(node);\n            if (node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */) {\n                bindAssignmentTargetFlow(node.operand);\n            }\n        }\n        function bindBinaryExpressionFlow(node) {\n            var operator = node.operatorToken.kind;\n            if (operator === 52 /* AmpersandAmpersandToken */ || operator === 53 /* BarBarToken */) {\n                if (isTopLevelLogicalExpression(node)) {\n                    var postExpressionLabel = createBranchLabel();\n                    bindLogicalExpression(node, postExpressionLabel, postExpressionLabel);\n                    currentFlow = finishFlowLabel(postExpressionLabel);\n                }\n                else {\n                    bindLogicalExpression(node, currentTrueTarget, currentFalseTarget);\n                }\n            }\n            else {\n                bindEachChild(node);\n                if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) {\n                    bindAssignmentTargetFlow(node.left);\n                    if (operator === 57 /* EqualsToken */ && node.left.kind === 178 /* ElementAccessExpression */) {\n                        var elementAccess = node.left;\n                        if (isNarrowableOperand(elementAccess.expression)) {\n                            currentFlow = createFlowArrayMutation(currentFlow, node);\n                        }\n                    }\n                }\n            }\n        }\n        function bindDeleteExpressionFlow(node) {\n            bindEachChild(node);\n            if (node.expression.kind === 177 /* PropertyAccessExpression */) {\n                bindAssignmentTargetFlow(node.expression);\n            }\n        }\n        function bindConditionalExpressionFlow(node) {\n            var trueLabel = createBranchLabel();\n            var falseLabel = createBranchLabel();\n            var postExpressionLabel = createBranchLabel();\n            bindCondition(node.condition, trueLabel, falseLabel);\n            currentFlow = finishFlowLabel(trueLabel);\n            bind(node.questionToken);\n            bind(node.whenTrue);\n            addAntecedent(postExpressionLabel, currentFlow);\n            currentFlow = finishFlowLabel(falseLabel);\n            bind(node.colonToken);\n            bind(node.whenFalse);\n            addAntecedent(postExpressionLabel, currentFlow);\n            currentFlow = finishFlowLabel(postExpressionLabel);\n        }\n        function bindInitializedVariableFlow(node) {\n            var name = !ts.isOmittedExpression(node) ? node.name : undefined;\n            if (ts.isBindingPattern(name)) {\n                for (var _i = 0, _a = name.elements; _i < _a.length; _i++) {\n                    var child = _a[_i];\n                    bindInitializedVariableFlow(child);\n                }\n            }\n            else {\n                currentFlow = createFlowAssignment(currentFlow, node);\n            }\n        }\n        function bindVariableDeclarationFlow(node) {\n            bindEachChild(node);\n            if (node.initializer || node.parent.parent.kind === 212 /* ForInStatement */ || node.parent.parent.kind === 213 /* ForOfStatement */) {\n                bindInitializedVariableFlow(node);\n            }\n        }\n        function bindCallExpressionFlow(node) {\n            // If the target of the call expression is a function expression or arrow function we have\n            // an immediately invoked function expression (IIFE). Initialize the flowNode property to\n            // the current control flow (which includes evaluation of the IIFE arguments).\n            var expr = node.expression;\n            while (expr.kind === 183 /* ParenthesizedExpression */) {\n                expr = expr.expression;\n            }\n            if (expr.kind === 184 /* FunctionExpression */ || expr.kind === 185 /* ArrowFunction */) {\n                bindEach(node.typeArguments);\n                bindEach(node.arguments);\n                bind(node.expression);\n            }\n            else {\n                bindEachChild(node);\n            }\n            if (node.expression.kind === 177 /* PropertyAccessExpression */) {\n                var propertyAccess = node.expression;\n                if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) {\n                    currentFlow = createFlowArrayMutation(currentFlow, node);\n                }\n            }\n        }\n        function getContainerFlags(node) {\n            switch (node.kind) {\n                case 197 /* ClassExpression */:\n                case 226 /* ClassDeclaration */:\n                case 229 /* EnumDeclaration */:\n                case 176 /* ObjectLiteralExpression */:\n                case 161 /* TypeLiteral */:\n                case 287 /* JSDocTypeLiteral */:\n                case 270 /* JSDocRecordType */:\n                    return 1 /* IsContainer */;\n                case 227 /* InterfaceDeclaration */:\n                    return 1 /* IsContainer */ | 64 /* IsInterface */;\n                case 274 /* JSDocFunctionType */:\n                case 230 /* ModuleDeclaration */:\n                case 228 /* TypeAliasDeclaration */:\n                case 170 /* MappedType */:\n                    return 1 /* IsContainer */ | 32 /* HasLocals */;\n                case 261 /* SourceFile */:\n                    return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;\n                case 149 /* MethodDeclaration */:\n                    if (ts.isObjectLiteralOrClassExpressionMethod(node)) {\n                        return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethod */;\n                    }\n                case 150 /* Constructor */:\n                case 225 /* FunctionDeclaration */:\n                case 148 /* MethodSignature */:\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                case 153 /* CallSignature */:\n                case 154 /* ConstructSignature */:\n                case 155 /* IndexSignature */:\n                case 158 /* FunctionType */:\n                case 159 /* ConstructorType */:\n                    return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;\n                case 184 /* FunctionExpression */:\n                case 185 /* ArrowFunction */:\n                    return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */;\n                case 231 /* ModuleBlock */:\n                    return 4 /* IsControlFlowContainer */;\n                case 147 /* PropertyDeclaration */:\n                    return node.initializer ? 4 /* IsControlFlowContainer */ : 0;\n                case 256 /* CatchClause */:\n                case 211 /* ForStatement */:\n                case 212 /* ForInStatement */:\n                case 213 /* ForOfStatement */:\n                case 232 /* CaseBlock */:\n                    return 2 /* IsBlockScopedContainer */;\n                case 204 /* Block */:\n                    // do not treat blocks directly inside a function as a block-scoped-container.\n                    // Locals that reside in this block should go to the function locals. Otherwise 'x'\n                    // would not appear to be a redeclaration of a block scoped local in the following\n                    // example:\n                    //\n                    //      function foo() {\n                    //          var x;\n                    //          let x;\n                    //      }\n                    //\n                    // If we placed 'var x' into the function locals and 'let x' into the locals of\n                    // the block, then there would be no collision.\n                    //\n                    // By not creating a new block-scoped-container here, we ensure that both 'var x'\n                    // and 'let x' go into the Function-container's locals, and we do get a collision\n                    // conflict.\n                    return ts.isFunctionLike(node.parent) ? 0 /* None */ : 2 /* IsBlockScopedContainer */;\n            }\n            return 0 /* None */;\n        }\n        function addToContainerChain(next) {\n            if (lastContainer) {\n                lastContainer.nextContainer = next;\n            }\n            lastContainer = next;\n        }\n        function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) {\n            // Just call this directly so that the return type of this function stays \"void\".\n            return declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes);\n        }\n        function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) {\n            switch (container.kind) {\n                // Modules, source files, and classes need specialized handling for how their\n                // members are declared (for example, a member of a class will go into a specific\n                // symbol table depending on if it is static or not). We defer to specialized\n                // handlers to take care of declaring these child members.\n                case 230 /* ModuleDeclaration */:\n                    return declareModuleMember(node, symbolFlags, symbolExcludes);\n                case 261 /* SourceFile */:\n                    return declareSourceFileMember(node, symbolFlags, symbolExcludes);\n                case 197 /* ClassExpression */:\n                case 226 /* ClassDeclaration */:\n                    return declareClassMember(node, symbolFlags, symbolExcludes);\n                case 229 /* EnumDeclaration */:\n                    return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);\n                case 161 /* TypeLiteral */:\n                case 176 /* ObjectLiteralExpression */:\n                case 227 /* InterfaceDeclaration */:\n                case 270 /* JSDocRecordType */:\n                case 287 /* JSDocTypeLiteral */:\n                    // Interface/Object-types always have their children added to the 'members' of\n                    // their container. They are only accessible through an instance of their\n                    // container, and are never in scope otherwise (even inside the body of the\n                    // object / type / interface declaring them). An exception is type parameters,\n                    // which are in scope without qualification (similar to 'locals').\n                    return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);\n                case 158 /* FunctionType */:\n                case 159 /* ConstructorType */:\n                case 153 /* CallSignature */:\n                case 154 /* ConstructSignature */:\n                case 155 /* IndexSignature */:\n                case 149 /* MethodDeclaration */:\n                case 148 /* MethodSignature */:\n                case 150 /* Constructor */:\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                case 225 /* FunctionDeclaration */:\n                case 184 /* FunctionExpression */:\n                case 185 /* ArrowFunction */:\n                case 274 /* JSDocFunctionType */:\n                case 228 /* TypeAliasDeclaration */:\n                case 170 /* MappedType */:\n                    // All the children of these container types are never visible through another\n                    // symbol (i.e. through another symbol's 'exports' or 'members').  Instead,\n                    // they're only accessed 'lexically' (i.e. from code that exists underneath\n                    // their container in the tree.  To accomplish this, we simply add their declared\n                    // symbol to the 'locals' of the container.  These symbols can then be found as\n                    // the type checker walks up the containers, checking them for matching names.\n                    return declareSymbol(container.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes);\n            }\n        }\n        function declareClassMember(node, symbolFlags, symbolExcludes) {\n            return ts.hasModifier(node, 32 /* Static */)\n                ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes)\n                : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);\n        }\n        function declareSourceFileMember(node, symbolFlags, symbolExcludes) {\n            return ts.isExternalModule(file)\n                ? declareModuleMember(node, symbolFlags, symbolExcludes)\n                : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes);\n        }\n        function hasExportDeclarations(node) {\n            var body = node.kind === 261 /* SourceFile */ ? node : node.body;\n            if (body && (body.kind === 261 /* SourceFile */ || body.kind === 231 /* ModuleBlock */)) {\n                for (var _i = 0, _a = body.statements; _i < _a.length; _i++) {\n                    var stat = _a[_i];\n                    if (stat.kind === 241 /* ExportDeclaration */ || stat.kind === 240 /* ExportAssignment */) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function setExportContextFlag(node) {\n            // A declaration source file or ambient module declaration that contains no export declarations (but possibly regular\n            // declarations with export modifiers) is an export context in which declarations are implicitly exported.\n            if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) {\n                node.flags |= 32 /* ExportContext */;\n            }\n            else {\n                node.flags &= ~32 /* ExportContext */;\n            }\n        }\n        function bindModuleDeclaration(node) {\n            setExportContextFlag(node);\n            if (ts.isAmbientModule(node)) {\n                if (ts.hasModifier(node, 1 /* Export */)) {\n                    errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible);\n                }\n                if (ts.isExternalModuleAugmentation(node)) {\n                    declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */);\n                }\n                else {\n                    var pattern = void 0;\n                    if (node.name.kind === 9 /* StringLiteral */) {\n                        var text = node.name.text;\n                        if (ts.hasZeroOrOneAsteriskCharacter(text)) {\n                            pattern = ts.tryParsePattern(text);\n                        }\n                        else {\n                            errorOnFirstToken(node.name, ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, text);\n                        }\n                    }\n                    var symbol = declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */);\n                    if (pattern) {\n                        (file.patternAmbientModules || (file.patternAmbientModules = [])).push({ pattern: pattern, symbol: symbol });\n                    }\n                }\n            }\n            else {\n                var state = getModuleInstanceState(node);\n                if (state === 0 /* NonInstantiated */) {\n                    declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */);\n                }\n                else {\n                    declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */);\n                    if (node.symbol.flags & (16 /* Function */ | 32 /* Class */ | 256 /* RegularEnum */)) {\n                        // if module was already merged with some function, class or non-const enum\n                        // treat is a non-const-enum-only\n                        node.symbol.constEnumOnlyModule = false;\n                    }\n                    else {\n                        var currentModuleIsConstEnumOnly = state === 2 /* ConstEnumOnly */;\n                        if (node.symbol.constEnumOnlyModule === undefined) {\n                            // non-merged case - use the current state\n                            node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly;\n                        }\n                        else {\n                            // merged case: module is const enum only if all its pieces are non-instantiated or const enum\n                            node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly;\n                        }\n                    }\n                }\n            }\n        }\n        function bindFunctionOrConstructorType(node) {\n            // For a given function symbol \"<...>(...) => T\" we want to generate a symbol identical\n            // to the one we would get for: { <...>(...): T }\n            //\n            // We do that by making an anonymous type literal symbol, and then setting the function\n            // symbol as its sole member. To the rest of the system, this symbol will be  indistinguishable\n            // from an actual type literal symbol you would have gotten had you used the long form.\n            var symbol = createSymbol(131072 /* Signature */, getDeclarationName(node));\n            addDeclarationToSymbol(symbol, node, 131072 /* Signature */);\n            var typeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, \"__type\");\n            addDeclarationToSymbol(typeLiteralSymbol, node, 2048 /* TypeLiteral */);\n            typeLiteralSymbol.members = ts.createMap();\n            typeLiteralSymbol.members[symbol.name] = symbol;\n        }\n        function bindObjectLiteralExpression(node) {\n            var ElementKind;\n            (function (ElementKind) {\n                ElementKind[ElementKind[\"Property\"] = 1] = \"Property\";\n                ElementKind[ElementKind[\"Accessor\"] = 2] = \"Accessor\";\n            })(ElementKind || (ElementKind = {}));\n            if (inStrictMode) {\n                var seen = ts.createMap();\n                for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {\n                    var prop = _a[_i];\n                    if (prop.kind === 259 /* SpreadAssignment */ || prop.name.kind !== 70 /* Identifier */) {\n                        continue;\n                    }\n                    var identifier = prop.name;\n                    // ECMA-262 11.1.5 Object Initializer\n                    // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true\n                    // a.This production is contained in strict code and IsDataDescriptor(previous) is true and\n                    // IsDataDescriptor(propId.descriptor) is true.\n                    //    b.IsDataDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true.\n                    //    c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.\n                    //    d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true\n                    // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields\n                    var currentKind = prop.kind === 257 /* PropertyAssignment */ || prop.kind === 258 /* ShorthandPropertyAssignment */ || prop.kind === 149 /* MethodDeclaration */\n                        ? 1 /* Property */\n                        : 2 /* Accessor */;\n                    var existingKind = seen[identifier.text];\n                    if (!existingKind) {\n                        seen[identifier.text] = currentKind;\n                        continue;\n                    }\n                    if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) {\n                        var span_1 = ts.getErrorSpanForNode(file, identifier);\n                        file.bindDiagnostics.push(ts.createFileDiagnostic(file, span_1.start, span_1.length, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode));\n                    }\n                }\n            }\n            return bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, \"__object\");\n        }\n        function bindAnonymousDeclaration(node, symbolFlags, name) {\n            var symbol = createSymbol(symbolFlags, name);\n            addDeclarationToSymbol(symbol, node, symbolFlags);\n        }\n        function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) {\n            switch (blockScopeContainer.kind) {\n                case 230 /* ModuleDeclaration */:\n                    declareModuleMember(node, symbolFlags, symbolExcludes);\n                    break;\n                case 261 /* SourceFile */:\n                    if (ts.isExternalModule(container)) {\n                        declareModuleMember(node, symbolFlags, symbolExcludes);\n                        break;\n                    }\n                // fall through.\n                default:\n                    if (!blockScopeContainer.locals) {\n                        blockScopeContainer.locals = ts.createMap();\n                        addToContainerChain(blockScopeContainer);\n                    }\n                    declareSymbol(blockScopeContainer.locals, undefined, node, symbolFlags, symbolExcludes);\n            }\n        }\n        function bindBlockScopedVariableDeclaration(node) {\n            bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */);\n        }\n        // The binder visits every node in the syntax tree so it is a convenient place to perform a single localized\n        // check for reserved words used as identifiers in strict mode code.\n        function checkStrictModeIdentifier(node) {\n            if (inStrictMode &&\n                node.originalKeywordKind >= 107 /* FirstFutureReservedWord */ &&\n                node.originalKeywordKind <= 115 /* LastFutureReservedWord */ &&\n                !ts.isIdentifierName(node) &&\n                !ts.isInAmbientContext(node)) {\n                // Report error only if there are no parse errors in file\n                if (!file.parseDiagnostics.length) {\n                    file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node)));\n                }\n            }\n        }\n        function getStrictModeIdentifierMessage(node) {\n            // Provide specialized messages to help the user understand why we think they're in\n            // strict mode.\n            if (ts.getContainingClass(node)) {\n                return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode;\n            }\n            if (file.externalModuleIndicator) {\n                return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode;\n            }\n            return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode;\n        }\n        function checkStrictModeBinaryExpression(node) {\n            if (inStrictMode && ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind)) {\n                // ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an\n                // Assignment operator(11.13) or of a PostfixExpression(11.3)\n                checkStrictModeEvalOrArguments(node, node.left);\n            }\n        }\n        function checkStrictModeCatchClause(node) {\n            // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the\n            // Catch production is eval or arguments\n            if (inStrictMode && node.variableDeclaration) {\n                checkStrictModeEvalOrArguments(node, node.variableDeclaration.name);\n            }\n        }\n        function checkStrictModeDeleteExpression(node) {\n            // Grammar checking\n            if (inStrictMode && node.expression.kind === 70 /* Identifier */) {\n                // When a delete operator occurs within strict mode code, a SyntaxError is thrown if its\n                // UnaryExpression is a direct reference to a variable, function argument, or function name\n                var span_2 = ts.getErrorSpanForNode(file, node.expression);\n                file.bindDiagnostics.push(ts.createFileDiagnostic(file, span_2.start, span_2.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode));\n            }\n        }\n        function isEvalOrArgumentsIdentifier(node) {\n            return node.kind === 70 /* Identifier */ &&\n                (node.text === \"eval\" || node.text === \"arguments\");\n        }\n        function checkStrictModeEvalOrArguments(contextNode, name) {\n            if (name && name.kind === 70 /* Identifier */) {\n                var identifier = name;\n                if (isEvalOrArgumentsIdentifier(identifier)) {\n                    // We check first if the name is inside class declaration or class expression; if so give explicit message\n                    // otherwise report generic error message.\n                    var span_3 = ts.getErrorSpanForNode(file, name);\n                    file.bindDiagnostics.push(ts.createFileDiagnostic(file, span_3.start, span_3.length, getStrictModeEvalOrArgumentsMessage(contextNode), identifier.text));\n                }\n            }\n        }\n        function getStrictModeEvalOrArgumentsMessage(node) {\n            // Provide specialized messages to help the user understand why we think they're in\n            // strict mode.\n            if (ts.getContainingClass(node)) {\n                return ts.Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode;\n            }\n            if (file.externalModuleIndicator) {\n                return ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode;\n            }\n            return ts.Diagnostics.Invalid_use_of_0_in_strict_mode;\n        }\n        function checkStrictModeFunctionName(node) {\n            if (inStrictMode) {\n                // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a strict mode FunctionDeclaration or FunctionExpression (13.1))\n                checkStrictModeEvalOrArguments(node, node.name);\n            }\n        }\n        function getStrictModeBlockScopeFunctionDeclarationMessage(node) {\n            // Provide specialized messages to help the user understand why we think they're in\n            // strict mode.\n            if (ts.getContainingClass(node)) {\n                return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode;\n            }\n            if (file.externalModuleIndicator) {\n                return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode;\n            }\n            return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5;\n        }\n        function checkStrictModeFunctionDeclaration(node) {\n            if (languageVersion < 2 /* ES2015 */) {\n                // Report error if function is not top level function declaration\n                if (blockScopeContainer.kind !== 261 /* SourceFile */ &&\n                    blockScopeContainer.kind !== 230 /* ModuleDeclaration */ &&\n                    !ts.isFunctionLike(blockScopeContainer)) {\n                    // We check first if the name is inside class declaration or class expression; if so give explicit message\n                    // otherwise report generic error message.\n                    var errorSpan = ts.getErrorSpanForNode(file, node);\n                    file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node)));\n                }\n            }\n        }\n        function checkStrictModeNumericLiteral(node) {\n            if (inStrictMode && node.isOctalLiteral) {\n                file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode));\n            }\n        }\n        function checkStrictModePostfixUnaryExpression(node) {\n            // Grammar checking\n            // The identifier eval or arguments may not appear as the LeftHandSideExpression of an\n            // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression\n            // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator.\n            if (inStrictMode) {\n                checkStrictModeEvalOrArguments(node, node.operand);\n            }\n        }\n        function checkStrictModePrefixUnaryExpression(node) {\n            // Grammar checking\n            if (inStrictMode) {\n                if (node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */) {\n                    checkStrictModeEvalOrArguments(node, node.operand);\n                }\n            }\n        }\n        function checkStrictModeWithStatement(node) {\n            // Grammar checking for withStatement\n            if (inStrictMode) {\n                errorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode);\n            }\n        }\n        function errorOnFirstToken(node, message, arg0, arg1, arg2) {\n            var span = ts.getSpanOfTokenAtPosition(file, node.pos);\n            file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2));\n        }\n        function getDestructuringParameterName(node) {\n            return \"__\" + ts.indexOf(node.parent.parameters, node);\n        }\n        function bind(node) {\n            if (!node) {\n                return;\n            }\n            node.parent = parent;\n            var saveInStrictMode = inStrictMode;\n            // First we bind declaration nodes to a symbol if possible. We'll both create a symbol\n            // and then potentially add the symbol to an appropriate symbol table. Possible\n            // destination symbol tables are:\n            //\n            //  1) The 'exports' table of the current container's symbol.\n            //  2) The 'members' table of the current container's symbol.\n            //  3) The 'locals' table of the current container.\n            //\n            // However, not all symbols will end up in any of these tables. 'Anonymous' symbols\n            // (like TypeLiterals for example) will not be put in any table.\n            bindWorker(node);\n            // Then we recurse into the children of the node to bind them as well. For certain\n            // symbols we do specialized work when we recurse. For example, we'll keep track of\n            // the current 'container' node when it changes. This helps us know which symbol table\n            // a local should go into for example. Since terminal nodes are known not to have\n            // children, as an optimization we don't process those.\n            if (node.kind > 140 /* LastToken */) {\n                var saveParent = parent;\n                parent = node;\n                var containerFlags = getContainerFlags(node);\n                if (containerFlags === 0 /* None */) {\n                    bindChildren(node);\n                }\n                else {\n                    bindContainer(node, containerFlags);\n                }\n                parent = saveParent;\n            }\n            else if (!skipTransformFlagAggregation && (node.transformFlags & 536870912 /* HasComputedFlags */) === 0) {\n                subtreeTransformFlags |= computeTransformFlagsForNode(node, 0);\n            }\n            inStrictMode = saveInStrictMode;\n        }\n        function updateStrictModeStatementList(statements) {\n            if (!inStrictMode) {\n                for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {\n                    var statement = statements_2[_i];\n                    if (!ts.isPrologueDirective(statement)) {\n                        return;\n                    }\n                    if (isUseStrictPrologueDirective(statement)) {\n                        inStrictMode = true;\n                        return;\n                    }\n                }\n            }\n        }\n        /// Should be called only on prologue directives (isPrologueDirective(node) should be true)\n        function isUseStrictPrologueDirective(node) {\n            var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression);\n            // Note: the node text must be exactly \"use strict\" or 'use strict'.  It is not ok for the\n            // string to contain unicode escapes (as per ES5).\n            return nodeText === '\"use strict\"' || nodeText === \"'use strict'\";\n        }\n        function bindWorker(node) {\n            switch (node.kind) {\n                /* Strict mode checks */\n                case 70 /* Identifier */:\n                    // for typedef type names with namespaces, bind the new jsdoc type symbol here\n                    // because it requires all containing namespaces to be in effect, namely the\n                    // current \"blockScopeContainer\" needs to be set to its immediate namespace parent.\n                    if (node.isInJSDocNamespace) {\n                        var parentNode = node.parent;\n                        while (parentNode && parentNode.kind !== 285 /* JSDocTypedefTag */) {\n                            parentNode = parentNode.parent;\n                        }\n                        bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */);\n                        break;\n                    }\n                case 98 /* ThisKeyword */:\n                    if (currentFlow && (ts.isExpression(node) || parent.kind === 258 /* ShorthandPropertyAssignment */)) {\n                        node.flowNode = currentFlow;\n                    }\n                    return checkStrictModeIdentifier(node);\n                case 177 /* PropertyAccessExpression */:\n                    if (currentFlow && isNarrowableReference(node)) {\n                        node.flowNode = currentFlow;\n                    }\n                    break;\n                case 192 /* BinaryExpression */:\n                    if (ts.isInJavaScriptFile(node)) {\n                        var specialKind = ts.getSpecialPropertyAssignmentKind(node);\n                        switch (specialKind) {\n                            case 1 /* ExportsProperty */:\n                                bindExportsPropertyAssignment(node);\n                                break;\n                            case 2 /* ModuleExports */:\n                                bindModuleExportsAssignment(node);\n                                break;\n                            case 3 /* PrototypeProperty */:\n                                bindPrototypePropertyAssignment(node);\n                                break;\n                            case 4 /* ThisProperty */:\n                                bindThisPropertyAssignment(node);\n                                break;\n                            case 0 /* None */:\n                                // Nothing to do\n                                break;\n                            default:\n                                ts.Debug.fail(\"Unknown special property assignment kind\");\n                        }\n                    }\n                    return checkStrictModeBinaryExpression(node);\n                case 256 /* CatchClause */:\n                    return checkStrictModeCatchClause(node);\n                case 186 /* DeleteExpression */:\n                    return checkStrictModeDeleteExpression(node);\n                case 8 /* NumericLiteral */:\n                    return checkStrictModeNumericLiteral(node);\n                case 191 /* PostfixUnaryExpression */:\n                    return checkStrictModePostfixUnaryExpression(node);\n                case 190 /* PrefixUnaryExpression */:\n                    return checkStrictModePrefixUnaryExpression(node);\n                case 217 /* WithStatement */:\n                    return checkStrictModeWithStatement(node);\n                case 167 /* ThisType */:\n                    seenThisKeyword = true;\n                    return;\n                case 156 /* TypePredicate */:\n                    return checkTypePredicate(node);\n                case 143 /* TypeParameter */:\n                    return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530920 /* TypeParameterExcludes */);\n                case 144 /* Parameter */:\n                    return bindParameter(node);\n                case 223 /* VariableDeclaration */:\n                case 174 /* BindingElement */:\n                    return bindVariableDeclarationOrBindingElement(node);\n                case 147 /* PropertyDeclaration */:\n                case 146 /* PropertySignature */:\n                case 271 /* JSDocRecordMember */:\n                    return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */);\n                case 286 /* JSDocPropertyTag */:\n                    return bindJSDocProperty(node);\n                case 257 /* PropertyAssignment */:\n                case 258 /* ShorthandPropertyAssignment */:\n                    return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */);\n                case 260 /* EnumMember */:\n                    return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */);\n                case 259 /* SpreadAssignment */:\n                case 251 /* JsxSpreadAttribute */:\n                    var root = container;\n                    var hasRest = false;\n                    while (root.parent) {\n                        if (root.kind === 176 /* ObjectLiteralExpression */ &&\n                            root.parent.kind === 192 /* BinaryExpression */ &&\n                            root.parent.operatorToken.kind === 57 /* EqualsToken */ &&\n                            root.parent.left === root) {\n                            hasRest = true;\n                            break;\n                        }\n                        root = root.parent;\n                    }\n                    return;\n                case 153 /* CallSignature */:\n                case 154 /* ConstructSignature */:\n                case 155 /* IndexSignature */:\n                    return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */);\n                case 149 /* MethodDeclaration */:\n                case 148 /* MethodSignature */:\n                    // If this is an ObjectLiteralExpression method, then it sits in the same space\n                    // as other properties in the object literal.  So we use SymbolFlags.PropertyExcludes\n                    // so that it will conflict with any other object literal members with the same\n                    // name.\n                    return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 99263 /* MethodExcludes */);\n                case 225 /* FunctionDeclaration */:\n                    return bindFunctionDeclaration(node);\n                case 150 /* Constructor */:\n                    return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */);\n                case 151 /* GetAccessor */:\n                    return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */);\n                case 152 /* SetAccessor */:\n                    return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */);\n                case 158 /* FunctionType */:\n                case 159 /* ConstructorType */:\n                case 274 /* JSDocFunctionType */:\n                    return bindFunctionOrConstructorType(node);\n                case 161 /* TypeLiteral */:\n                case 170 /* MappedType */:\n                case 287 /* JSDocTypeLiteral */:\n                case 270 /* JSDocRecordType */:\n                    return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, \"__type\");\n                case 176 /* ObjectLiteralExpression */:\n                    return bindObjectLiteralExpression(node);\n                case 184 /* FunctionExpression */:\n                case 185 /* ArrowFunction */:\n                    return bindFunctionExpression(node);\n                case 179 /* CallExpression */:\n                    if (ts.isInJavaScriptFile(node)) {\n                        bindCallExpression(node);\n                    }\n                    break;\n                // Members of classes, interfaces, and modules\n                case 197 /* ClassExpression */:\n                case 226 /* ClassDeclaration */:\n                    // All classes are automatically in strict mode in ES6.\n                    inStrictMode = true;\n                    return bindClassLikeDeclaration(node);\n                case 227 /* InterfaceDeclaration */:\n                    return bindBlockScopedDeclaration(node, 64 /* Interface */, 792968 /* InterfaceExcludes */);\n                case 285 /* JSDocTypedefTag */:\n                    if (!node.fullName || node.fullName.kind === 70 /* Identifier */) {\n                        return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */);\n                    }\n                    break;\n                case 228 /* TypeAliasDeclaration */:\n                    return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */);\n                case 229 /* EnumDeclaration */:\n                    return bindEnumDeclaration(node);\n                case 230 /* ModuleDeclaration */:\n                    return bindModuleDeclaration(node);\n                // Imports and exports\n                case 234 /* ImportEqualsDeclaration */:\n                case 237 /* NamespaceImport */:\n                case 239 /* ImportSpecifier */:\n                case 243 /* ExportSpecifier */:\n                    return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */);\n                case 233 /* NamespaceExportDeclaration */:\n                    return bindNamespaceExportDeclaration(node);\n                case 236 /* ImportClause */:\n                    return bindImportClause(node);\n                case 241 /* ExportDeclaration */:\n                    return bindExportDeclaration(node);\n                case 240 /* ExportAssignment */:\n                    return bindExportAssignment(node);\n                case 261 /* SourceFile */:\n                    updateStrictModeStatementList(node.statements);\n                    return bindSourceFileIfExternalModule();\n                case 204 /* Block */:\n                    if (!ts.isFunctionLike(node.parent)) {\n                        return;\n                    }\n                // Fall through\n                case 231 /* ModuleBlock */:\n                    return updateStrictModeStatementList(node.statements);\n            }\n        }\n        function checkTypePredicate(node) {\n            var parameterName = node.parameterName, type = node.type;\n            if (parameterName && parameterName.kind === 70 /* Identifier */) {\n                checkStrictModeIdentifier(parameterName);\n            }\n            if (parameterName && parameterName.kind === 167 /* ThisType */) {\n                seenThisKeyword = true;\n            }\n            bind(type);\n        }\n        function bindSourceFileIfExternalModule() {\n            setExportContextFlag(file);\n            if (ts.isExternalModule(file)) {\n                bindSourceFileAsExternalModule();\n            }\n        }\n        function bindSourceFileAsExternalModule() {\n            bindAnonymousDeclaration(file, 512 /* ValueModule */, \"\\\"\" + ts.removeFileExtension(file.fileName) + \"\\\"\");\n        }\n        function bindExportAssignment(node) {\n            if (!container.symbol || !container.symbol.exports) {\n                // Export assignment in some sort of block construct\n                bindAnonymousDeclaration(node, 8388608 /* Alias */, getDeclarationName(node));\n            }\n            else {\n                // An export default clause with an expression exports a value\n                // We want to exclude both class and function here,  this is necessary to issue an error when there are both\n                // default export-assignment and default export function and class declaration.\n                var flags = node.kind === 240 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node)\n                    ? 8388608 /* Alias */\n                    : 4 /* Property */;\n                declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 /* Property */ | 8388608 /* AliasExcludes */ | 32 /* Class */ | 16 /* Function */);\n            }\n        }\n        function bindNamespaceExportDeclaration(node) {\n            if (node.modifiers && node.modifiers.length) {\n                file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here));\n            }\n            if (node.parent.kind !== 261 /* SourceFile */) {\n                file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level));\n                return;\n            }\n            else {\n                var parent_4 = node.parent;\n                if (!ts.isExternalModule(parent_4)) {\n                    file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files));\n                    return;\n                }\n                if (!parent_4.isDeclarationFile) {\n                    file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files));\n                    return;\n                }\n            }\n            file.symbol.globalExports = file.symbol.globalExports || ts.createMap();\n            declareSymbol(file.symbol.globalExports, file.symbol, node, 8388608 /* Alias */, 8388608 /* AliasExcludes */);\n        }\n        function bindExportDeclaration(node) {\n            if (!container.symbol || !container.symbol.exports) {\n                // Export * in some sort of block construct\n                bindAnonymousDeclaration(node, 1073741824 /* ExportStar */, getDeclarationName(node));\n            }\n            else if (!node.exportClause) {\n                // All export * declarations are collected in an __export symbol\n                declareSymbol(container.symbol.exports, container.symbol, node, 1073741824 /* ExportStar */, 0 /* None */);\n            }\n        }\n        function bindImportClause(node) {\n            if (node.name) {\n                declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */);\n            }\n        }\n        function setCommonJsModuleIndicator(node) {\n            if (!file.commonJsModuleIndicator) {\n                file.commonJsModuleIndicator = node;\n                if (!file.externalModuleIndicator) {\n                    bindSourceFileAsExternalModule();\n                }\n            }\n        }\n        function bindExportsPropertyAssignment(node) {\n            // When we create a property via 'exports.foo = bar', the 'exports.foo' property access\n            // expression is the declaration\n            setCommonJsModuleIndicator(node);\n            declareSymbol(file.symbol.exports, file.symbol, node.left, 4 /* Property */ | 7340032 /* Export */, 0 /* None */);\n        }\n        function bindModuleExportsAssignment(node) {\n            // 'module.exports = expr' assignment\n            setCommonJsModuleIndicator(node);\n            declareSymbol(file.symbol.exports, file.symbol, node, 4 /* Property */ | 7340032 /* Export */ | 512 /* ValueModule */, 0 /* None */);\n        }\n        function bindThisPropertyAssignment(node) {\n            ts.Debug.assert(ts.isInJavaScriptFile(node));\n            // Declare a 'member' if the container is an ES5 class or ES6 constructor\n            if (container.kind === 225 /* FunctionDeclaration */ || container.kind === 184 /* FunctionExpression */) {\n                container.symbol.members = container.symbol.members || ts.createMap();\n                // It's acceptable for multiple 'this' assignments of the same identifier to occur\n                declareSymbol(container.symbol.members, container.symbol, node, 4 /* Property */, 0 /* PropertyExcludes */ & ~4 /* Property */);\n            }\n            else if (container.kind === 150 /* Constructor */) {\n                // this.foo assignment in a JavaScript class\n                // Bind this property to the containing class\n                var saveContainer = container;\n                container = container.parent;\n                var symbol = bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* None */);\n                if (symbol) {\n                    // constructor-declared symbols can be overwritten by subsequent method declarations\n                    symbol.isReplaceableByMethod = true;\n                }\n                container = saveContainer;\n            }\n        }\n        function bindPrototypePropertyAssignment(node) {\n            // We saw a node of the form 'x.prototype.y = z'. Declare a 'member' y on x if x was a function.\n            // Look up the function in the local scope, since prototype assignments should\n            // follow the function declaration\n            var leftSideOfAssignment = node.left;\n            var classPrototype = leftSideOfAssignment.expression;\n            var constructorFunction = classPrototype.expression;\n            // Fix up parent pointers since we're going to use these nodes before we bind into them\n            leftSideOfAssignment.parent = node;\n            constructorFunction.parent = classPrototype;\n            classPrototype.parent = leftSideOfAssignment;\n            var funcSymbol = container.locals[constructorFunction.text];\n            if (!funcSymbol || !(funcSymbol.flags & 16 /* Function */ || ts.isDeclarationOfFunctionExpression(funcSymbol))) {\n                return;\n            }\n            // Set up the members collection if it doesn't exist already\n            if (!funcSymbol.members) {\n                funcSymbol.members = ts.createMap();\n            }\n            // Declare the method/property\n            declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, 4 /* Property */, 0 /* PropertyExcludes */);\n        }\n        function bindCallExpression(node) {\n            // We're only inspecting call expressions to detect CommonJS modules, so we can skip\n            // this check if we've already seen the module indicator\n            if (!file.commonJsModuleIndicator && ts.isRequireCall(node, /*checkArgumentIsStringLiteral*/ false)) {\n                setCommonJsModuleIndicator(node);\n            }\n        }\n        function bindClassLikeDeclaration(node) {\n            if (node.kind === 226 /* ClassDeclaration */) {\n                bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */);\n            }\n            else {\n                var bindingName = node.name ? node.name.text : \"__class\";\n                bindAnonymousDeclaration(node, 32 /* Class */, bindingName);\n                // Add name of class expression into the map for semantic classifier\n                if (node.name) {\n                    classifiableNames[node.name.text] = node.name.text;\n                }\n            }\n            var symbol = node.symbol;\n            // TypeScript 1.0 spec (April 2014): 8.4\n            // Every class automatically contains a static property member named 'prototype', the\n            // type of which is an instantiation of the class type with type Any supplied as a type\n            // argument for each type parameter. It is an error to explicitly declare a static\n            // property member with the name 'prototype'.\n            //\n            // Note: we check for this here because this class may be merging into a module.  The\n            // module might have an exported variable called 'prototype'.  We can't allow that as\n            // that would clash with the built-in 'prototype' for the class.\n            var prototypeSymbol = createSymbol(4 /* Property */ | 134217728 /* Prototype */, \"prototype\");\n            if (symbol.exports[prototypeSymbol.name]) {\n                if (node.name) {\n                    node.name.parent = node;\n                }\n                file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name));\n            }\n            symbol.exports[prototypeSymbol.name] = prototypeSymbol;\n            prototypeSymbol.parent = symbol;\n        }\n        function bindEnumDeclaration(node) {\n            return ts.isConst(node)\n                ? bindBlockScopedDeclaration(node, 128 /* ConstEnum */, 899967 /* ConstEnumExcludes */)\n                : bindBlockScopedDeclaration(node, 256 /* RegularEnum */, 899327 /* RegularEnumExcludes */);\n        }\n        function bindVariableDeclarationOrBindingElement(node) {\n            if (inStrictMode) {\n                checkStrictModeEvalOrArguments(node, node.name);\n            }\n            if (!ts.isBindingPattern(node.name)) {\n                if (ts.isBlockOrCatchScoped(node)) {\n                    bindBlockScopedVariableDeclaration(node);\n                }\n                else if (ts.isParameterDeclaration(node)) {\n                    // It is safe to walk up parent chain to find whether the node is a destructing parameter declaration\n                    // because its parent chain has already been set up, since parents are set before descending into children.\n                    //\n                    // If node is a binding element in parameter declaration, we need to use ParameterExcludes.\n                    // Using ParameterExcludes flag allows the compiler to report an error on duplicate identifiers in Parameter Declaration\n                    // For example:\n                    //      function foo([a,a]) {} // Duplicate Identifier error\n                    //      function bar(a,a) {}   // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter\n                    //                             // which correctly set excluded symbols\n                    declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */);\n                }\n                else {\n                    declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 107454 /* FunctionScopedVariableExcludes */);\n                }\n            }\n        }\n        function bindParameter(node) {\n            if (inStrictMode) {\n                // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a\n                // strict mode FunctionLikeDeclaration or FunctionExpression(13.1)\n                checkStrictModeEvalOrArguments(node, node.name);\n            }\n            if (ts.isBindingPattern(node.name)) {\n                bindAnonymousDeclaration(node, 1 /* FunctionScopedVariable */, getDestructuringParameterName(node));\n            }\n            else {\n                declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */);\n            }\n            // If this is a property-parameter, then also declare the property symbol into the\n            // containing class.\n            if (ts.isParameterPropertyDeclaration(node)) {\n                var classDeclaration = node.parent.parent;\n                declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */);\n            }\n        }\n        function bindFunctionDeclaration(node) {\n            if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) {\n                if (ts.isAsyncFunctionLike(node)) {\n                    emitFlags |= 1024 /* HasAsyncFunctions */;\n                }\n            }\n            checkStrictModeFunctionName(node);\n            if (inStrictMode) {\n                checkStrictModeFunctionDeclaration(node);\n                bindBlockScopedDeclaration(node, 16 /* Function */, 106927 /* FunctionExcludes */);\n            }\n            else {\n                declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 106927 /* FunctionExcludes */);\n            }\n        }\n        function bindFunctionExpression(node) {\n            if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) {\n                if (ts.isAsyncFunctionLike(node)) {\n                    emitFlags |= 1024 /* HasAsyncFunctions */;\n                }\n            }\n            if (currentFlow) {\n                node.flowNode = currentFlow;\n            }\n            checkStrictModeFunctionName(node);\n            var bindingName = node.name ? node.name.text : \"__function\";\n            return bindAnonymousDeclaration(node, 16 /* Function */, bindingName);\n        }\n        function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) {\n            if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) {\n                if (ts.isAsyncFunctionLike(node)) {\n                    emitFlags |= 1024 /* HasAsyncFunctions */;\n                }\n            }\n            if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) {\n                node.flowNode = currentFlow;\n            }\n            return ts.hasDynamicName(node)\n                ? bindAnonymousDeclaration(node, symbolFlags, \"__computed\")\n                : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes);\n        }\n        function bindJSDocProperty(node) {\n            return declareSymbolAndAddToSymbolTable(node, 4 /* Property */, 0 /* PropertyExcludes */);\n        }\n        // reachability checks\n        function shouldReportErrorOnModuleDeclaration(node) {\n            var instanceState = getModuleInstanceState(node);\n            return instanceState === 1 /* Instantiated */ || (instanceState === 2 /* ConstEnumOnly */ && options.preserveConstEnums);\n        }\n        function checkUnreachable(node) {\n            if (!(currentFlow.flags & 1 /* Unreachable */)) {\n                return false;\n            }\n            if (currentFlow === unreachableFlow) {\n                var reportError = \n                // report error on all statements except empty ones\n                (ts.isStatementButNotDeclaration(node) && node.kind !== 206 /* EmptyStatement */) ||\n                    // report error on class declarations\n                    node.kind === 226 /* ClassDeclaration */ ||\n                    // report error on instantiated modules or const-enums only modules if preserveConstEnums is set\n                    (node.kind === 230 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) ||\n                    // report error on regular enums and const enums if preserveConstEnums is set\n                    (node.kind === 229 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums));\n                if (reportError) {\n                    currentFlow = reportedUnreachableFlow;\n                    // unreachable code is reported if\n                    // - user has explicitly asked about it AND\n                    // - statement is in not ambient context (statements in ambient context is already an error\n                    //   so we should not report extras) AND\n                    //   - node is not variable statement OR\n                    //   - node is block scoped variable statement OR\n                    //   - node is not block scoped variable statement and at least one variable declaration has initializer\n                    //   Rationale: we don't want to report errors on non-initialized var's since they are hoisted\n                    //   On the other side we do want to report errors on non-initialized 'lets' because of TDZ\n                    var reportUnreachableCode = !options.allowUnreachableCode &&\n                        !ts.isInAmbientContext(node) &&\n                        (node.kind !== 205 /* VariableStatement */ ||\n                            ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */ ||\n                            ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; }));\n                    if (reportUnreachableCode) {\n                        errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected);\n                    }\n                }\n            }\n            return true;\n        }\n    }\n    /**\n     * Computes the transform flags for a node, given the transform flags of its subtree\n     *\n     * @param node The node to analyze\n     * @param subtreeFlags Transform flags computed for this node's subtree\n     */\n    function computeTransformFlagsForNode(node, subtreeFlags) {\n        var kind = node.kind;\n        switch (kind) {\n            case 179 /* CallExpression */:\n                return computeCallExpression(node, subtreeFlags);\n            case 180 /* NewExpression */:\n                return computeNewExpression(node, subtreeFlags);\n            case 230 /* ModuleDeclaration */:\n                return computeModuleDeclaration(node, subtreeFlags);\n            case 183 /* ParenthesizedExpression */:\n                return computeParenthesizedExpression(node, subtreeFlags);\n            case 192 /* BinaryExpression */:\n                return computeBinaryExpression(node, subtreeFlags);\n            case 207 /* ExpressionStatement */:\n                return computeExpressionStatement(node, subtreeFlags);\n            case 144 /* Parameter */:\n                return computeParameter(node, subtreeFlags);\n            case 185 /* ArrowFunction */:\n                return computeArrowFunction(node, subtreeFlags);\n            case 184 /* FunctionExpression */:\n                return computeFunctionExpression(node, subtreeFlags);\n            case 225 /* FunctionDeclaration */:\n                return computeFunctionDeclaration(node, subtreeFlags);\n            case 223 /* VariableDeclaration */:\n                return computeVariableDeclaration(node, subtreeFlags);\n            case 224 /* VariableDeclarationList */:\n                return computeVariableDeclarationList(node, subtreeFlags);\n            case 205 /* VariableStatement */:\n                return computeVariableStatement(node, subtreeFlags);\n            case 219 /* LabeledStatement */:\n                return computeLabeledStatement(node, subtreeFlags);\n            case 226 /* ClassDeclaration */:\n                return computeClassDeclaration(node, subtreeFlags);\n            case 197 /* ClassExpression */:\n                return computeClassExpression(node, subtreeFlags);\n            case 255 /* HeritageClause */:\n                return computeHeritageClause(node, subtreeFlags);\n            case 256 /* CatchClause */:\n                return computeCatchClause(node, subtreeFlags);\n            case 199 /* ExpressionWithTypeArguments */:\n                return computeExpressionWithTypeArguments(node, subtreeFlags);\n            case 150 /* Constructor */:\n                return computeConstructor(node, subtreeFlags);\n            case 147 /* PropertyDeclaration */:\n                return computePropertyDeclaration(node, subtreeFlags);\n            case 149 /* MethodDeclaration */:\n                return computeMethod(node, subtreeFlags);\n            case 151 /* GetAccessor */:\n            case 152 /* SetAccessor */:\n                return computeAccessor(node, subtreeFlags);\n            case 234 /* ImportEqualsDeclaration */:\n                return computeImportEquals(node, subtreeFlags);\n            case 177 /* PropertyAccessExpression */:\n                return computePropertyAccess(node, subtreeFlags);\n            default:\n                return computeOther(node, kind, subtreeFlags);\n        }\n    }\n    ts.computeTransformFlagsForNode = computeTransformFlagsForNode;\n    function computeCallExpression(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        var expression = node.expression;\n        var expressionKind = expression.kind;\n        if (node.typeArguments) {\n            transformFlags |= 3 /* AssertTypeScript */;\n        }\n        if (subtreeFlags & 524288 /* ContainsSpread */\n            || isSuperOrSuperProperty(expression, expressionKind)) {\n            // If the this node contains a SpreadExpression, or is a super call, then it is an ES6\n            // node.\n            transformFlags |= 192 /* AssertES2015 */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~537396545 /* ArrayLiteralOrCallOrNewExcludes */;\n    }\n    function isSuperOrSuperProperty(node, kind) {\n        switch (kind) {\n            case 96 /* SuperKeyword */:\n                return true;\n            case 177 /* PropertyAccessExpression */:\n            case 178 /* ElementAccessExpression */:\n                var expression = node.expression;\n                var expressionKind = expression.kind;\n                return expressionKind === 96 /* SuperKeyword */;\n        }\n        return false;\n    }\n    function computeNewExpression(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (node.typeArguments) {\n            transformFlags |= 3 /* AssertTypeScript */;\n        }\n        if (subtreeFlags & 524288 /* ContainsSpread */) {\n            // If the this node contains a SpreadElementExpression then it is an ES6\n            // node.\n            transformFlags |= 192 /* AssertES2015 */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~537396545 /* ArrayLiteralOrCallOrNewExcludes */;\n    }\n    function computeBinaryExpression(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        var operatorTokenKind = node.operatorToken.kind;\n        var leftKind = node.left.kind;\n        if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 176 /* ObjectLiteralExpression */) {\n            // Destructuring object assignments with are ES2015 syntax\n            // and possibly ESNext if they contain rest\n            transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */;\n        }\n        else if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 175 /* ArrayLiteralExpression */) {\n            // Destructuring assignments are ES2015 syntax.\n            transformFlags |= 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */;\n        }\n        else if (operatorTokenKind === 39 /* AsteriskAsteriskToken */\n            || operatorTokenKind === 61 /* AsteriskAsteriskEqualsToken */) {\n            // Exponentiation is ES2016 syntax.\n            transformFlags |= 32 /* AssertES2016 */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~536872257 /* NodeExcludes */;\n    }\n    function computeParameter(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        var modifierFlags = ts.getModifierFlags(node);\n        var name = node.name;\n        var initializer = node.initializer;\n        var dotDotDotToken = node.dotDotDotToken;\n        // The '?' token, type annotations, decorators, and 'this' parameters are TypeSCript\n        // syntax.\n        if (node.questionToken\n            || node.type\n            || subtreeFlags & 4096 /* ContainsDecorators */\n            || ts.isThisIdentifier(name)) {\n            transformFlags |= 3 /* AssertTypeScript */;\n        }\n        // If a parameter has an accessibility modifier, then it is TypeScript syntax.\n        if (modifierFlags & 92 /* ParameterPropertyModifier */) {\n            transformFlags |= 3 /* AssertTypeScript */ | 262144 /* ContainsParameterPropertyAssignments */;\n        }\n        // parameters with object rest destructuring are ES Next syntax\n        if (subtreeFlags & 1048576 /* ContainsObjectRest */) {\n            transformFlags |= 8 /* AssertESNext */;\n        }\n        // If a parameter has an initializer, a binding pattern or a dotDotDot token, then\n        // it is ES6 syntax and its container must emit default value assignments or parameter destructuring downlevel.\n        if (subtreeFlags & 8388608 /* ContainsBindingPattern */ || initializer || dotDotDotToken) {\n            transformFlags |= 192 /* AssertES2015 */ | 131072 /* ContainsDefaultValueAssignments */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~536872257 /* ParameterExcludes */;\n    }\n    function computeParenthesizedExpression(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        var expression = node.expression;\n        var expressionKind = expression.kind;\n        var expressionTransformFlags = expression.transformFlags;\n        // If the node is synthesized, it means the emitter put the parentheses there,\n        // not the user. If we didn't want them, the emitter would not have put them\n        // there.\n        if (expressionKind === 200 /* AsExpression */\n            || expressionKind === 182 /* TypeAssertionExpression */) {\n            transformFlags |= 3 /* AssertTypeScript */;\n        }\n        // If the expression of a ParenthesizedExpression is a destructuring assignment,\n        // then the ParenthesizedExpression is a destructuring assignment.\n        if (expressionTransformFlags & 1024 /* DestructuringAssignment */) {\n            transformFlags |= 1024 /* DestructuringAssignment */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~536872257 /* NodeExcludes */;\n    }\n    function computeClassDeclaration(node, subtreeFlags) {\n        var transformFlags;\n        var modifierFlags = ts.getModifierFlags(node);\n        if (modifierFlags & 2 /* Ambient */) {\n            // An ambient declaration is TypeScript syntax.\n            transformFlags = 3 /* AssertTypeScript */;\n        }\n        else {\n            // A ClassDeclaration is ES6 syntax.\n            transformFlags = subtreeFlags | 192 /* AssertES2015 */;\n            // A class with a parameter property assignment, property initializer, or decorator is\n            // TypeScript syntax.\n            // An exported declaration may be TypeScript syntax, but is handled by the visitor\n            // for a namespace declaration.\n            if ((subtreeFlags & 274432 /* TypeScriptClassSyntaxMask */)\n                || node.typeParameters) {\n                transformFlags |= 3 /* AssertTypeScript */;\n            }\n            if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) {\n                // A computed property name containing `this` might need to be rewritten,\n                // so propagate the ContainsLexicalThis flag upward.\n                transformFlags |= 16384 /* ContainsLexicalThis */;\n            }\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~539358529 /* ClassExcludes */;\n    }\n    function computeClassExpression(node, subtreeFlags) {\n        // A ClassExpression is ES6 syntax.\n        var transformFlags = subtreeFlags | 192 /* AssertES2015 */;\n        // A class with a parameter property assignment, property initializer, or decorator is\n        // TypeScript syntax.\n        if (subtreeFlags & 274432 /* TypeScriptClassSyntaxMask */\n            || node.typeParameters) {\n            transformFlags |= 3 /* AssertTypeScript */;\n        }\n        if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) {\n            // A computed property name containing `this` might need to be rewritten,\n            // so propagate the ContainsLexicalThis flag upward.\n            transformFlags |= 16384 /* ContainsLexicalThis */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~539358529 /* ClassExcludes */;\n    }\n    function computeHeritageClause(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        switch (node.token) {\n            case 84 /* ExtendsKeyword */:\n                // An `extends` HeritageClause is ES6 syntax.\n                transformFlags |= 192 /* AssertES2015 */;\n                break;\n            case 107 /* ImplementsKeyword */:\n                // An `implements` HeritageClause is TypeScript syntax.\n                transformFlags |= 3 /* AssertTypeScript */;\n                break;\n            default:\n                ts.Debug.fail(\"Unexpected token for heritage clause\");\n                break;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~536872257 /* NodeExcludes */;\n    }\n    function computeCatchClause(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        if (node.variableDeclaration && ts.isBindingPattern(node.variableDeclaration.name)) {\n            transformFlags |= 192 /* AssertES2015 */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~537920833 /* CatchClauseExcludes */;\n    }\n    function computeExpressionWithTypeArguments(node, subtreeFlags) {\n        // An ExpressionWithTypeArguments is ES6 syntax, as it is used in the\n        // extends clause of a class.\n        var transformFlags = subtreeFlags | 192 /* AssertES2015 */;\n        // If an ExpressionWithTypeArguments contains type arguments, then it\n        // is TypeScript syntax.\n        if (node.typeArguments) {\n            transformFlags |= 3 /* AssertTypeScript */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~536872257 /* NodeExcludes */;\n    }\n    function computeConstructor(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        // TypeScript-specific modifiers and overloads are TypeScript syntax\n        if (ts.hasModifier(node, 2270 /* TypeScriptModifier */)\n            || !node.body) {\n            transformFlags |= 3 /* AssertTypeScript */;\n        }\n        // function declarations with object rest destructuring are ES Next syntax\n        if (subtreeFlags & 1048576 /* ContainsObjectRest */) {\n            transformFlags |= 8 /* AssertESNext */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~601015617 /* ConstructorExcludes */;\n    }\n    function computeMethod(node, subtreeFlags) {\n        // A MethodDeclaration is ES6 syntax.\n        var transformFlags = subtreeFlags | 192 /* AssertES2015 */;\n        // Decorators, TypeScript-specific modifiers, type parameters, type annotations, and\n        // overloads are TypeScript syntax.\n        if (node.decorators\n            || ts.hasModifier(node, 2270 /* TypeScriptModifier */)\n            || node.typeParameters\n            || node.type\n            || !node.body) {\n            transformFlags |= 3 /* AssertTypeScript */;\n        }\n        // function declarations with object rest destructuring are ES Next syntax\n        if (subtreeFlags & 1048576 /* ContainsObjectRest */) {\n            transformFlags |= 8 /* AssertESNext */;\n        }\n        // An async method declaration is ES2017 syntax.\n        if (ts.hasModifier(node, 256 /* Async */)) {\n            transformFlags |= 16 /* AssertES2017 */;\n        }\n        // Currently, we only support generators that were originally async function bodies.\n        if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) {\n            transformFlags |= 768 /* AssertGenerator */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~601015617 /* MethodOrAccessorExcludes */;\n    }\n    function computeAccessor(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        // Decorators, TypeScript-specific modifiers, type annotations, and overloads are\n        // TypeScript syntax.\n        if (node.decorators\n            || ts.hasModifier(node, 2270 /* TypeScriptModifier */)\n            || node.type\n            || !node.body) {\n            transformFlags |= 3 /* AssertTypeScript */;\n        }\n        // function declarations with object rest destructuring are ES Next syntax\n        if (subtreeFlags & 1048576 /* ContainsObjectRest */) {\n            transformFlags |= 8 /* AssertESNext */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~601015617 /* MethodOrAccessorExcludes */;\n    }\n    function computePropertyDeclaration(node, subtreeFlags) {\n        // A PropertyDeclaration is TypeScript syntax.\n        var transformFlags = subtreeFlags | 3 /* AssertTypeScript */;\n        // If the PropertyDeclaration has an initializer, we need to inform its ancestor\n        // so that it handle the transformation.\n        if (node.initializer) {\n            transformFlags |= 8192 /* ContainsPropertyInitializer */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~536872257 /* NodeExcludes */;\n    }\n    function computeFunctionDeclaration(node, subtreeFlags) {\n        var transformFlags;\n        var modifierFlags = ts.getModifierFlags(node);\n        var body = node.body;\n        if (!body || (modifierFlags & 2 /* Ambient */)) {\n            // An ambient declaration is TypeScript syntax.\n            // A FunctionDeclaration without a body is an overload and is TypeScript syntax.\n            transformFlags = 3 /* AssertTypeScript */;\n        }\n        else {\n            transformFlags = subtreeFlags | 33554432 /* ContainsHoistedDeclarationOrCompletion */;\n            // TypeScript-specific modifiers, type parameters, and type annotations are TypeScript\n            // syntax.\n            if (modifierFlags & 2270 /* TypeScriptModifier */\n                || node.typeParameters\n                || node.type) {\n                transformFlags |= 3 /* AssertTypeScript */;\n            }\n            // An async function declaration is ES2017 syntax.\n            if (modifierFlags & 256 /* Async */) {\n                transformFlags |= 16 /* AssertES2017 */;\n            }\n            // function declarations with object rest destructuring are ES Next syntax\n            if (subtreeFlags & 1048576 /* ContainsObjectRest */) {\n                transformFlags |= 8 /* AssertESNext */;\n            }\n            // If a FunctionDeclaration's subtree has marked the container as needing to capture the\n            // lexical this, or the function contains parameters with initializers, then this node is\n            // ES6 syntax.\n            if (subtreeFlags & 163840 /* ES2015FunctionSyntaxMask */) {\n                transformFlags |= 192 /* AssertES2015 */;\n            }\n            // If a FunctionDeclaration is generator function and is the body of a\n            // transformed async function, then this node can be transformed to a\n            // down-level generator.\n            // Currently we do not support transforming any other generator fucntions\n            // down level.\n            if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) {\n                transformFlags |= 768 /* AssertGenerator */;\n            }\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~601281857 /* FunctionExcludes */;\n    }\n    function computeFunctionExpression(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        // TypeScript-specific modifiers, type parameters, and type annotations are TypeScript\n        // syntax.\n        if (ts.hasModifier(node, 2270 /* TypeScriptModifier */)\n            || node.typeParameters\n            || node.type) {\n            transformFlags |= 3 /* AssertTypeScript */;\n        }\n        // An async function expression is ES2017 syntax.\n        if (ts.hasModifier(node, 256 /* Async */)) {\n            transformFlags |= 16 /* AssertES2017 */;\n        }\n        // function expressions with object rest destructuring are ES Next syntax\n        if (subtreeFlags & 1048576 /* ContainsObjectRest */) {\n            transformFlags |= 8 /* AssertESNext */;\n        }\n        // If a FunctionExpression's subtree has marked the container as needing to capture the\n        // lexical this, or the function contains parameters with initializers, then this node is\n        // ES6 syntax.\n        if (subtreeFlags & 163840 /* ES2015FunctionSyntaxMask */) {\n            transformFlags |= 192 /* AssertES2015 */;\n        }\n        // If a FunctionExpression is generator function and is the body of a\n        // transformed async function, then this node can be transformed to a\n        // down-level generator.\n        // Currently we do not support transforming any other generator fucntions\n        // down level.\n        if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) {\n            transformFlags |= 768 /* AssertGenerator */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~601281857 /* FunctionExcludes */;\n    }\n    function computeArrowFunction(node, subtreeFlags) {\n        // An ArrowFunction is ES6 syntax, and excludes markers that should not escape the scope of an ArrowFunction.\n        var transformFlags = subtreeFlags | 192 /* AssertES2015 */;\n        // TypeScript-specific modifiers, type parameters, and type annotations are TypeScript\n        // syntax.\n        if (ts.hasModifier(node, 2270 /* TypeScriptModifier */)\n            || node.typeParameters\n            || node.type) {\n            transformFlags |= 3 /* AssertTypeScript */;\n        }\n        // An async arrow function is ES2017 syntax.\n        if (ts.hasModifier(node, 256 /* Async */)) {\n            transformFlags |= 16 /* AssertES2017 */;\n        }\n        // arrow functions with object rest destructuring are ES Next syntax\n        if (subtreeFlags & 1048576 /* ContainsObjectRest */) {\n            transformFlags |= 8 /* AssertESNext */;\n        }\n        // If an ArrowFunction contains a lexical this, its container must capture the lexical this.\n        if (subtreeFlags & 16384 /* ContainsLexicalThis */) {\n            transformFlags |= 32768 /* ContainsCapturedLexicalThis */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~601249089 /* ArrowFunctionExcludes */;\n    }\n    function computePropertyAccess(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        var expression = node.expression;\n        var expressionKind = expression.kind;\n        // If a PropertyAccessExpression starts with a super keyword, then it is\n        // ES6 syntax, and requires a lexical `this` binding.\n        if (expressionKind === 96 /* SuperKeyword */) {\n            transformFlags |= 16384 /* ContainsLexicalThis */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~536872257 /* NodeExcludes */;\n    }\n    function computeVariableDeclaration(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */;\n        // A VariableDeclaration containing ObjectRest is ESNext syntax\n        if (subtreeFlags & 1048576 /* ContainsObjectRest */) {\n            transformFlags |= 8 /* AssertESNext */;\n        }\n        // Type annotations are TypeScript syntax.\n        if (node.type) {\n            transformFlags |= 3 /* AssertTypeScript */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~536872257 /* NodeExcludes */;\n    }\n    function computeVariableStatement(node, subtreeFlags) {\n        var transformFlags;\n        var modifierFlags = ts.getModifierFlags(node);\n        var declarationListTransformFlags = node.declarationList.transformFlags;\n        // An ambient declaration is TypeScript syntax.\n        if (modifierFlags & 2 /* Ambient */) {\n            transformFlags = 3 /* AssertTypeScript */;\n        }\n        else {\n            transformFlags = subtreeFlags;\n            if (declarationListTransformFlags & 8388608 /* ContainsBindingPattern */) {\n                transformFlags |= 192 /* AssertES2015 */;\n            }\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~536872257 /* NodeExcludes */;\n    }\n    function computeLabeledStatement(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        // A labeled statement containing a block scoped binding *may* need to be transformed from ES6.\n        if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */\n            && ts.isIterationStatement(node, /*lookInLabeledStatements*/ true)) {\n            transformFlags |= 192 /* AssertES2015 */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~536872257 /* NodeExcludes */;\n    }\n    function computeImportEquals(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        // An ImportEqualsDeclaration with a namespace reference is TypeScript.\n        if (!ts.isExternalModuleImportEqualsDeclaration(node)) {\n            transformFlags |= 3 /* AssertTypeScript */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~536872257 /* NodeExcludes */;\n    }\n    function computeExpressionStatement(node, subtreeFlags) {\n        var transformFlags = subtreeFlags;\n        // If the expression of an expression statement is a destructuring assignment,\n        // then we treat the statement as ES6 so that we can indicate that we do not\n        // need to hold on to the right-hand side.\n        if (node.expression.transformFlags & 1024 /* DestructuringAssignment */) {\n            transformFlags |= 192 /* AssertES2015 */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~536872257 /* NodeExcludes */;\n    }\n    function computeModuleDeclaration(node, subtreeFlags) {\n        var transformFlags = 3 /* AssertTypeScript */;\n        var modifierFlags = ts.getModifierFlags(node);\n        if ((modifierFlags & 2 /* Ambient */) === 0) {\n            transformFlags |= subtreeFlags;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~574674241 /* ModuleExcludes */;\n    }\n    function computeVariableDeclarationList(node, subtreeFlags) {\n        var transformFlags = subtreeFlags | 33554432 /* ContainsHoistedDeclarationOrCompletion */;\n        if (subtreeFlags & 8388608 /* ContainsBindingPattern */) {\n            transformFlags |= 192 /* AssertES2015 */;\n        }\n        // If a VariableDeclarationList is `let` or `const`, then it is ES6 syntax.\n        if (node.flags & 3 /* BlockScoped */) {\n            transformFlags |= 192 /* AssertES2015 */ | 4194304 /* ContainsBlockScopedBinding */;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~546309441 /* VariableDeclarationListExcludes */;\n    }\n    function computeOther(node, kind, subtreeFlags) {\n        // Mark transformations needed for each node\n        var transformFlags = subtreeFlags;\n        var excludeFlags = 536872257 /* NodeExcludes */;\n        switch (kind) {\n            case 119 /* AsyncKeyword */:\n            case 189 /* AwaitExpression */:\n                // async/await is ES2017 syntax\n                transformFlags |= 16 /* AssertES2017 */;\n                break;\n            case 113 /* PublicKeyword */:\n            case 111 /* PrivateKeyword */:\n            case 112 /* ProtectedKeyword */:\n            case 116 /* AbstractKeyword */:\n            case 123 /* DeclareKeyword */:\n            case 75 /* ConstKeyword */:\n            case 229 /* EnumDeclaration */:\n            case 260 /* EnumMember */:\n            case 182 /* TypeAssertionExpression */:\n            case 200 /* AsExpression */:\n            case 201 /* NonNullExpression */:\n            case 130 /* ReadonlyKeyword */:\n                // These nodes are TypeScript syntax.\n                transformFlags |= 3 /* AssertTypeScript */;\n                break;\n            case 246 /* JsxElement */:\n            case 247 /* JsxSelfClosingElement */:\n            case 248 /* JsxOpeningElement */:\n            case 10 /* JsxText */:\n            case 249 /* JsxClosingElement */:\n            case 250 /* JsxAttribute */:\n            case 251 /* JsxSpreadAttribute */:\n            case 252 /* JsxExpression */:\n                // These nodes are Jsx syntax.\n                transformFlags |= 4 /* AssertJsx */;\n                break;\n            case 213 /* ForOfStatement */:\n                // for-of might be ESNext if it has a rest destructuring\n                transformFlags |= 8 /* AssertESNext */;\n            // FALLTHROUGH\n            case 12 /* NoSubstitutionTemplateLiteral */:\n            case 13 /* TemplateHead */:\n            case 14 /* TemplateMiddle */:\n            case 15 /* TemplateTail */:\n            case 194 /* TemplateExpression */:\n            case 181 /* TaggedTemplateExpression */:\n            case 258 /* ShorthandPropertyAssignment */:\n            case 114 /* StaticKeyword */:\n                // These nodes are ES6 syntax.\n                transformFlags |= 192 /* AssertES2015 */;\n                break;\n            case 195 /* YieldExpression */:\n                // This node is ES6 syntax.\n                transformFlags |= 192 /* AssertES2015 */ | 16777216 /* ContainsYield */;\n                break;\n            case 118 /* AnyKeyword */:\n            case 132 /* NumberKeyword */:\n            case 129 /* NeverKeyword */:\n            case 134 /* StringKeyword */:\n            case 121 /* BooleanKeyword */:\n            case 135 /* SymbolKeyword */:\n            case 104 /* VoidKeyword */:\n            case 143 /* TypeParameter */:\n            case 146 /* PropertySignature */:\n            case 148 /* MethodSignature */:\n            case 153 /* CallSignature */:\n            case 154 /* ConstructSignature */:\n            case 155 /* IndexSignature */:\n            case 156 /* TypePredicate */:\n            case 157 /* TypeReference */:\n            case 158 /* FunctionType */:\n            case 159 /* ConstructorType */:\n            case 160 /* TypeQuery */:\n            case 161 /* TypeLiteral */:\n            case 162 /* ArrayType */:\n            case 163 /* TupleType */:\n            case 164 /* UnionType */:\n            case 165 /* IntersectionType */:\n            case 166 /* ParenthesizedType */:\n            case 227 /* InterfaceDeclaration */:\n            case 228 /* TypeAliasDeclaration */:\n            case 167 /* ThisType */:\n            case 168 /* TypeOperator */:\n            case 169 /* IndexedAccessType */:\n            case 170 /* MappedType */:\n            case 171 /* LiteralType */:\n                // Types and signatures are TypeScript syntax, and exclude all other facts.\n                transformFlags = 3 /* AssertTypeScript */;\n                excludeFlags = -3 /* TypeExcludes */;\n                break;\n            case 142 /* ComputedPropertyName */:\n                // Even though computed property names are ES6, we don't treat them as such.\n                // This is so that they can flow through PropertyName transforms unaffected.\n                // Instead, we mark the container as ES6, so that it can properly handle the transform.\n                transformFlags |= 2097152 /* ContainsComputedPropertyName */;\n                if (subtreeFlags & 16384 /* ContainsLexicalThis */) {\n                    // A computed method name like `[this.getName()](x: string) { ... }` needs to\n                    // distinguish itself from the normal case of a method body containing `this`:\n                    // `this` inside a method doesn't need to be rewritten (the method provides `this`),\n                    // whereas `this` inside a computed name *might* need to be rewritten if the class/object\n                    // is inside an arrow function:\n                    // `_this = this; () => class K { [_this.getName()]() { ... } }`\n                    // To make this distinction, use ContainsLexicalThisInComputedPropertyName\n                    // instead of ContainsLexicalThis for computed property names\n                    transformFlags |= 65536 /* ContainsLexicalThisInComputedPropertyName */;\n                }\n                break;\n            case 196 /* SpreadElement */:\n                transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */;\n                break;\n            case 259 /* SpreadAssignment */:\n                transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */;\n                break;\n            case 96 /* SuperKeyword */:\n                // This node is ES6 syntax.\n                transformFlags |= 192 /* AssertES2015 */;\n                break;\n            case 98 /* ThisKeyword */:\n                // Mark this node and its ancestors as containing a lexical `this` keyword.\n                transformFlags |= 16384 /* ContainsLexicalThis */;\n                break;\n            case 172 /* ObjectBindingPattern */:\n                transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */;\n                if (subtreeFlags & 524288 /* ContainsRest */) {\n                    transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectRest */;\n                }\n                excludeFlags = 537396545 /* BindingPatternExcludes */;\n                break;\n            case 173 /* ArrayBindingPattern */:\n                transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */;\n                excludeFlags = 537396545 /* BindingPatternExcludes */;\n                break;\n            case 174 /* BindingElement */:\n                transformFlags |= 192 /* AssertES2015 */;\n                if (node.dotDotDotToken) {\n                    transformFlags |= 524288 /* ContainsRest */;\n                }\n                break;\n            case 145 /* Decorator */:\n                // This node is TypeScript syntax, and marks its container as also being TypeScript syntax.\n                transformFlags |= 3 /* AssertTypeScript */ | 4096 /* ContainsDecorators */;\n                break;\n            case 176 /* ObjectLiteralExpression */:\n                excludeFlags = 540087617 /* ObjectLiteralExcludes */;\n                if (subtreeFlags & 2097152 /* ContainsComputedPropertyName */) {\n                    // If an ObjectLiteralExpression contains a ComputedPropertyName, then it\n                    // is an ES6 node.\n                    transformFlags |= 192 /* AssertES2015 */;\n                }\n                if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) {\n                    // A computed property name containing `this` might need to be rewritten,\n                    // so propagate the ContainsLexicalThis flag upward.\n                    transformFlags |= 16384 /* ContainsLexicalThis */;\n                }\n                if (subtreeFlags & 1048576 /* ContainsObjectSpread */) {\n                    // If an ObjectLiteralExpression contains a spread element, then it\n                    // is an ES next node.\n                    transformFlags |= 8 /* AssertESNext */;\n                }\n                break;\n            case 175 /* ArrayLiteralExpression */:\n            case 180 /* NewExpression */:\n                excludeFlags = 537396545 /* ArrayLiteralOrCallOrNewExcludes */;\n                if (subtreeFlags & 524288 /* ContainsSpread */) {\n                    // If the this node contains a SpreadExpression, then it is an ES6\n                    // node.\n                    transformFlags |= 192 /* AssertES2015 */;\n                }\n                break;\n            case 209 /* DoStatement */:\n            case 210 /* WhileStatement */:\n            case 211 /* ForStatement */:\n            case 212 /* ForInStatement */:\n                // A loop containing a block scoped binding *may* need to be transformed from ES6.\n                if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */) {\n                    transformFlags |= 192 /* AssertES2015 */;\n                }\n                break;\n            case 261 /* SourceFile */:\n                if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) {\n                    transformFlags |= 192 /* AssertES2015 */;\n                }\n                break;\n            case 216 /* ReturnStatement */:\n            case 214 /* ContinueStatement */:\n            case 215 /* BreakStatement */:\n                transformFlags |= 33554432 /* ContainsHoistedDeclarationOrCompletion */;\n                break;\n        }\n        node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;\n        return transformFlags & ~excludeFlags;\n    }\n    /**\n     * Gets the transform flags to exclude when unioning the transform flags of a subtree.\n     *\n     * NOTE: This needs to be kept up-to-date with the exclusions used in `computeTransformFlagsForNode`.\n     *       For performance reasons, `computeTransformFlagsForNode` uses local constant values rather\n     *       than calling this function.\n     */\n    /* @internal */\n    function getTransformFlagsSubtreeExclusions(kind) {\n        if (kind >= 156 /* FirstTypeNode */ && kind <= 171 /* LastTypeNode */) {\n            return -3 /* TypeExcludes */;\n        }\n        switch (kind) {\n            case 179 /* CallExpression */:\n            case 180 /* NewExpression */:\n            case 175 /* ArrayLiteralExpression */:\n                return 537396545 /* ArrayLiteralOrCallOrNewExcludes */;\n            case 230 /* ModuleDeclaration */:\n                return 574674241 /* ModuleExcludes */;\n            case 144 /* Parameter */:\n                return 536872257 /* ParameterExcludes */;\n            case 185 /* ArrowFunction */:\n                return 601249089 /* ArrowFunctionExcludes */;\n            case 184 /* FunctionExpression */:\n            case 225 /* FunctionDeclaration */:\n                return 601281857 /* FunctionExcludes */;\n            case 224 /* VariableDeclarationList */:\n                return 546309441 /* VariableDeclarationListExcludes */;\n            case 226 /* ClassDeclaration */:\n            case 197 /* ClassExpression */:\n                return 539358529 /* ClassExcludes */;\n            case 150 /* Constructor */:\n                return 601015617 /* ConstructorExcludes */;\n            case 149 /* MethodDeclaration */:\n            case 151 /* GetAccessor */:\n            case 152 /* SetAccessor */:\n                return 601015617 /* MethodOrAccessorExcludes */;\n            case 118 /* AnyKeyword */:\n            case 132 /* NumberKeyword */:\n            case 129 /* NeverKeyword */:\n            case 134 /* StringKeyword */:\n            case 121 /* BooleanKeyword */:\n            case 135 /* SymbolKeyword */:\n            case 104 /* VoidKeyword */:\n            case 143 /* TypeParameter */:\n            case 146 /* PropertySignature */:\n            case 148 /* MethodSignature */:\n            case 153 /* CallSignature */:\n            case 154 /* ConstructSignature */:\n            case 155 /* IndexSignature */:\n            case 227 /* InterfaceDeclaration */:\n            case 228 /* TypeAliasDeclaration */:\n                return -3 /* TypeExcludes */;\n            case 176 /* ObjectLiteralExpression */:\n                return 540087617 /* ObjectLiteralExcludes */;\n            case 256 /* CatchClause */:\n                return 537920833 /* CatchClauseExcludes */;\n            case 172 /* ObjectBindingPattern */:\n            case 173 /* ArrayBindingPattern */:\n                return 537396545 /* BindingPatternExcludes */;\n            default:\n                return 536872257 /* NodeExcludes */;\n        }\n    }\n    ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions;\n})(ts || (ts = {}));\n/// <reference path=\"core.ts\" />\n/// <reference path=\"diagnosticInformationMap.generated.ts\" />\nvar ts;\n(function (ts) {\n    function trace(host) {\n        host.trace(ts.formatMessage.apply(undefined, arguments));\n    }\n    ts.trace = trace;\n    /* @internal */\n    function isTraceEnabled(compilerOptions, host) {\n        return compilerOptions.traceResolution && host.trace !== undefined;\n    }\n    ts.isTraceEnabled = isTraceEnabled;\n    /**\n     * Kinds of file that we are currently looking for.\n     * Typically there is one pass with Extensions.TypeScript, then a second pass with Extensions.JavaScript.\n     */\n    var Extensions;\n    (function (Extensions) {\n        Extensions[Extensions[\"TypeScript\"] = 0] = \"TypeScript\";\n        Extensions[Extensions[\"JavaScript\"] = 1] = \"JavaScript\";\n        Extensions[Extensions[\"DtsOnly\"] = 2] = \"DtsOnly\"; /** Only '.d.ts' */\n    })(Extensions || (Extensions = {}));\n    /** Used with `Extensions.DtsOnly` to extract the path from TypeScript results. */\n    function resolvedTypeScriptOnly(resolved) {\n        if (!resolved) {\n            return undefined;\n        }\n        ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension));\n        return resolved.path;\n    }\n    /** Create Resolved from a file with unknown extension. */\n    function resolvedFromAnyFile(path) {\n        return { path: path, extension: ts.extensionFromPath(path) };\n    }\n    /** Adds `isExernalLibraryImport` to a Resolved to get a ResolvedModule. */\n    function resolvedModuleFromResolved(_a, isExternalLibraryImport) {\n        var path = _a.path, extension = _a.extension;\n        return { resolvedFileName: path, extension: extension, isExternalLibraryImport: isExternalLibraryImport };\n    }\n    function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations) {\n        return { resolvedModule: resolved && resolvedModuleFromResolved(resolved, isExternalLibraryImport), failedLookupLocations: failedLookupLocations };\n    }\n    function moduleHasNonRelativeName(moduleName) {\n        return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));\n    }\n    ts.moduleHasNonRelativeName = moduleHasNonRelativeName;\n    function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) {\n        var jsonContent = readJson(packageJsonPath, state.host);\n        switch (extensions) {\n            case 2 /* DtsOnly */:\n            case 0 /* TypeScript */:\n                return tryReadFromField(\"typings\") || tryReadFromField(\"types\");\n            case 1 /* JavaScript */:\n                if (typeof jsonContent.main === \"string\") {\n                    if (state.traceEnabled) {\n                        trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main);\n                    }\n                    return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main));\n                }\n                return undefined;\n        }\n        function tryReadFromField(fieldName) {\n            if (ts.hasProperty(jsonContent, fieldName)) {\n                var typesFile = jsonContent[fieldName];\n                if (typeof typesFile === \"string\") {\n                    var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile));\n                    if (state.traceEnabled) {\n                        trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath);\n                    }\n                    return typesFilePath;\n                }\n                else {\n                    if (state.traceEnabled) {\n                        trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof typesFile);\n                    }\n                }\n            }\n        }\n    }\n    function readJson(path, host) {\n        try {\n            var jsonText = host.readFile(path);\n            return jsonText ? JSON.parse(jsonText) : {};\n        }\n        catch (e) {\n            // gracefully handle if readFile fails or returns not JSON\n            return {};\n        }\n    }\n    function getEffectiveTypeRoots(options, host) {\n        if (options.typeRoots) {\n            return options.typeRoots;\n        }\n        var currentDirectory;\n        if (options.configFilePath) {\n            currentDirectory = ts.getDirectoryPath(options.configFilePath);\n        }\n        else if (host.getCurrentDirectory) {\n            currentDirectory = host.getCurrentDirectory();\n        }\n        if (currentDirectory !== undefined) {\n            return getDefaultTypeRoots(currentDirectory, host);\n        }\n    }\n    ts.getEffectiveTypeRoots = getEffectiveTypeRoots;\n    /**\n     * Returns the path to every node_modules/@types directory from some ancestor directory.\n     * Returns undefined if there are none.\n     */\n    function getDefaultTypeRoots(currentDirectory, host) {\n        if (!host.directoryExists) {\n            return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)];\n        }\n        var typeRoots;\n        forEachAncestorDirectory(currentDirectory, function (directory) {\n            var atTypes = ts.combinePaths(directory, nodeModulesAtTypes);\n            if (host.directoryExists(atTypes)) {\n                (typeRoots || (typeRoots = [])).push(atTypes);\n            }\n        });\n        return typeRoots;\n    }\n    var nodeModulesAtTypes = ts.combinePaths(\"node_modules\", \"@types\");\n    /**\n     * @param {string | undefined} containingFile - file that contains type reference directive, can be undefined if containing file is unknown.\n     * This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups\n     * is assumed to be the same as root directory of the project.\n     */\n    function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) {\n        var traceEnabled = isTraceEnabled(options, host);\n        var moduleResolutionState = {\n            compilerOptions: options,\n            host: host,\n            traceEnabled: traceEnabled\n        };\n        var typeRoots = getEffectiveTypeRoots(options, host);\n        if (traceEnabled) {\n            if (containingFile === undefined) {\n                if (typeRoots === undefined) {\n                    trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName);\n                }\n                else {\n                    trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, typeRoots);\n                }\n            }\n            else {\n                if (typeRoots === undefined) {\n                    trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile);\n                }\n                else {\n                    trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, typeRoots);\n                }\n            }\n        }\n        var failedLookupLocations = [];\n        var resolved = primaryLookup();\n        var primary = true;\n        if (!resolved) {\n            resolved = secondaryLookup();\n            primary = false;\n        }\n        var resolvedTypeReferenceDirective;\n        if (resolved) {\n            resolved = realpath(resolved, host, traceEnabled);\n            if (traceEnabled) {\n                trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolved, primary);\n            }\n            resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolved };\n        }\n        return { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };\n        function primaryLookup() {\n            // Check primary library paths\n            if (typeRoots && typeRoots.length) {\n                if (traceEnabled) {\n                    trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(\", \"));\n                }\n                return ts.forEach(typeRoots, function (typeRoot) {\n                    var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName);\n                    var candidateDirectory = ts.getDirectoryPath(candidate);\n                    return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2 /* DtsOnly */, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState));\n                });\n            }\n            else {\n                if (traceEnabled) {\n                    trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths);\n                }\n            }\n        }\n        function secondaryLookup() {\n            var resolvedFile;\n            var initialLocationForSecondaryLookup = containingFile && ts.getDirectoryPath(containingFile);\n            if (initialLocationForSecondaryLookup !== undefined) {\n                // check secondary locations\n                if (traceEnabled) {\n                    trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);\n                }\n                resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2 /* DtsOnly */, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState));\n                if (!resolvedFile && traceEnabled) {\n                    trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName);\n                }\n                return resolvedFile;\n            }\n            else {\n                if (traceEnabled) {\n                    trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder);\n                }\n            }\n        }\n    }\n    ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;\n    /**\n      * Given a set of options, returns the set of type directive names\n      *   that should be included for this program automatically.\n      * This list could either come from the config file,\n      *   or from enumerating the types root + initial secondary types lookup location.\n      * More type directives might appear in the program later as a result of loading actual source files;\n      *   this list is only the set of defaults that are implicitly included.\n      */\n    function getAutomaticTypeDirectiveNames(options, host) {\n        // Use explicit type list from tsconfig.json\n        if (options.types) {\n            return options.types;\n        }\n        // Walk the primary type lookup locations\n        var result = [];\n        if (host.directoryExists && host.getDirectories) {\n            var typeRoots = getEffectiveTypeRoots(options, host);\n            if (typeRoots) {\n                for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) {\n                    var root = typeRoots_1[_i];\n                    if (host.directoryExists(root)) {\n                        for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) {\n                            var typeDirectivePath = _b[_a];\n                            var normalized = ts.normalizePath(typeDirectivePath);\n                            var packageJsonPath = pathToPackageJson(ts.combinePaths(root, normalized));\n                            // tslint:disable-next-line:no-null-keyword\n                            var isNotNeededPackage = host.fileExists(packageJsonPath) && readJson(packageJsonPath, host).typings === null;\n                            if (!isNotNeededPackage) {\n                                // Return just the type directive names\n                                result.push(ts.getBaseFileName(normalized));\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        return result;\n    }\n    ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;\n    function resolveModuleName(moduleName, containingFile, compilerOptions, host) {\n        var traceEnabled = isTraceEnabled(compilerOptions, host);\n        if (traceEnabled) {\n            trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile);\n        }\n        var moduleResolution = compilerOptions.moduleResolution;\n        if (moduleResolution === undefined) {\n            moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;\n            if (traceEnabled) {\n                trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]);\n            }\n        }\n        else {\n            if (traceEnabled) {\n                trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]);\n            }\n        }\n        var result;\n        switch (moduleResolution) {\n            case ts.ModuleResolutionKind.NodeJs:\n                result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host);\n                break;\n            case ts.ModuleResolutionKind.Classic:\n                result = classicNameResolver(moduleName, containingFile, compilerOptions, host);\n                break;\n        }\n        if (traceEnabled) {\n            if (result.resolvedModule) {\n                trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName);\n            }\n            else {\n                trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName);\n            }\n        }\n        return result;\n    }\n    ts.resolveModuleName = resolveModuleName;\n    /**\n     * Any module resolution kind can be augmented with optional settings: 'baseUrl', 'paths' and 'rootDirs' - they are used to\n     * mitigate differences between design time structure of the project and its runtime counterpart so the same import name\n     * can be resolved successfully by TypeScript compiler and runtime module loader.\n     * If these settings are set then loading procedure will try to use them to resolve module name and it can of failure it will\n     * fallback to standard resolution routine.\n     *\n     * - baseUrl - this setting controls how non-relative module names are resolved. If this setting is specified then non-relative\n     * names will be resolved relative to baseUrl: i.e. if baseUrl is '/a/b' then candidate location to resolve module name 'c/d' will\n     * be '/a/b/c/d'\n     * - paths - this setting can only be used when baseUrl is specified. allows to tune how non-relative module names\n     * will be resolved based on the content of the module name.\n     * Structure of 'paths' compiler options\n     * 'paths': {\n     *    pattern-1: [...substitutions],\n     *    pattern-2: [...substitutions],\n     *    ...\n     *    pattern-n: [...substitutions]\n     * }\n     * Pattern here is a string that can contain zero or one '*' character. During module resolution module name will be matched against\n     * all patterns in the list. Matching for patterns that don't contain '*' means that module name must be equal to pattern respecting the case.\n     * If pattern contains '*' then to match pattern \"<prefix>*<suffix>\" module name must start with the <prefix> and end with <suffix>.\n     * <MatchedStar> denotes part of the module name between <prefix> and <suffix>.\n     * If module name can be matches with multiple patterns then pattern with the longest prefix will be picked.\n     * After selecting pattern we'll use list of substitutions to get candidate locations of the module and the try to load module\n     * from the candidate location.\n     * Substitution is a string that can contain zero or one '*'. To get candidate location from substitution we'll pick every\n     * substitution in the list and replace '*' with <MatchedStar> string. If candidate location is not rooted it\n     * will be converted to absolute using baseUrl.\n     * For example:\n     * baseUrl: /a/b/c\n     * \"paths\": {\n     *     // match all module names\n     *     \"*\": [\n     *         \"*\",        // use matched name as is,\n     *                     // <matched name> will be looked as /a/b/c/<matched name>\n     *\n     *         \"folder1/*\" // substitution will convert matched name to 'folder1/<matched name>',\n     *                     // since it is not rooted then final candidate location will be /a/b/c/folder1/<matched name>\n     *     ],\n     *     // match module names that start with 'components/'\n     *     \"components/*\": [ \"/root/components/*\" ] // substitution will convert /components/folder1/<matched name> to '/root/components/folder1/<matched name>',\n     *                                              // it is rooted so it will be final candidate location\n     * }\n     *\n     * 'rootDirs' allows the project to be spreaded across multiple locations and resolve modules with relative names as if\n     * they were in the same location. For example lets say there are two files\n     * '/local/src/content/file1.ts'\n     * '/shared/components/contracts/src/content/protocols/file2.ts'\n     * After bundling content of '/shared/components/contracts/src' will be merged with '/local/src' so\n     * if file1 has the following import 'import {x} from \"./protocols/file2\"' it will be resolved successfully in runtime.\n     * 'rootDirs' provides the way to tell compiler that in order to get the whole project it should behave as if content of all\n     * root dirs were merged together.\n     * I.e. for the example above 'rootDirs' will have two entries: [ '/local/src', '/shared/components/contracts/src' ].\n     * Compiler will first convert './protocols/file2' into absolute path relative to the location of containing file:\n     * '/local/src/content/protocols/file2' and try to load it - failure.\n     * Then it will search 'rootDirs' looking for a longest matching prefix of this absolute path and if such prefix is found - absolute path will\n     * be converted to a path relative to found rootDir entry './content/protocols/file2' (*). As a last step compiler will check all remaining\n     * entries in 'rootDirs', use them to build absolute path out of (*) and try to resolve module from this location.\n     */\n    function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) {\n        if (moduleHasNonRelativeName(moduleName)) {\n            return tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state);\n        }\n        else {\n            return tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state);\n        }\n    }\n    function tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) {\n        if (!state.compilerOptions.rootDirs) {\n            return undefined;\n        }\n        if (state.traceEnabled) {\n            trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName);\n        }\n        var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));\n        var matchedRootDir;\n        var matchedNormalizedPrefix;\n        for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) {\n            var rootDir = _a[_i];\n            // rootDirs are expected to be absolute\n            // in case of tsconfig.json this will happen automatically - compiler will expand relative names\n            // using location of tsconfig.json as base location\n            var normalizedRoot = ts.normalizePath(rootDir);\n            if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) {\n                normalizedRoot += ts.directorySeparator;\n            }\n            var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) &&\n                (matchedNormalizedPrefix === undefined || matchedNormalizedPrefix.length < normalizedRoot.length);\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix);\n            }\n            if (isLongestMatchingPrefix) {\n                matchedNormalizedPrefix = normalizedRoot;\n                matchedRootDir = rootDir;\n            }\n        }\n        if (matchedNormalizedPrefix) {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix);\n            }\n            var suffix = candidate.substr(matchedNormalizedPrefix.length);\n            // first - try to load from a initial location\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate);\n            }\n            var resolvedFileName = loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state);\n            if (resolvedFileName) {\n                return resolvedFileName;\n            }\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs);\n            }\n            // then try to resolve using remaining entries in rootDirs\n            for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) {\n                var rootDir = _c[_b];\n                if (rootDir === matchedRootDir) {\n                    // skip the initially matched entry\n                    continue;\n                }\n                var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix);\n                if (state.traceEnabled) {\n                    trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1);\n                }\n                var baseDirectory = ts.getDirectoryPath(candidate_1);\n                var resolvedFileName_1 = loader(extensions, candidate_1, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state);\n                if (resolvedFileName_1) {\n                    return resolvedFileName_1;\n                }\n            }\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed);\n            }\n        }\n        return undefined;\n    }\n    function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state) {\n        if (!state.compilerOptions.baseUrl) {\n            return undefined;\n        }\n        if (state.traceEnabled) {\n            trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName);\n        }\n        // string is for exact match\n        var matchedPattern = undefined;\n        if (state.compilerOptions.paths) {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName);\n            }\n            matchedPattern = ts.matchPatternOrExact(ts.getOwnKeys(state.compilerOptions.paths), moduleName);\n        }\n        if (matchedPattern) {\n            var matchedStar_1 = typeof matchedPattern === \"string\" ? undefined : ts.matchedText(matchedPattern, moduleName);\n            var matchedPatternText = typeof matchedPattern === \"string\" ? matchedPattern : ts.patternText(matchedPattern);\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPatternText);\n            }\n            return ts.forEach(state.compilerOptions.paths[matchedPatternText], function (subst) {\n                var path = matchedStar_1 ? subst.replace(\"*\", matchedStar_1) : subst;\n                var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, path));\n                if (state.traceEnabled) {\n                    trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path);\n                }\n                // A path mapping may have a \".ts\" extension; in contrast to an import, which should omit it.\n                var tsExtension = ts.tryGetExtensionFromPath(candidate);\n                if (tsExtension !== undefined) {\n                    var path_1 = tryFile(candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state);\n                    return path_1 && { path: path_1, extension: tsExtension };\n                }\n                return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);\n            });\n        }\n        else {\n            var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, moduleName));\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate);\n            }\n            return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);\n        }\n    }\n    function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) {\n        var containingDirectory = ts.getDirectoryPath(containingFile);\n        var traceEnabled = isTraceEnabled(compilerOptions, host);\n        var failedLookupLocations = [];\n        var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };\n        var result = tryResolve(0 /* TypeScript */) || tryResolve(1 /* JavaScript */);\n        if (result) {\n            var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport;\n            return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations);\n        }\n        return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };\n        function tryResolve(extensions) {\n            var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state);\n            if (resolved) {\n                return { resolved: resolved, isExternalLibraryImport: false };\n            }\n            if (moduleHasNonRelativeName(moduleName)) {\n                if (traceEnabled) {\n                    trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName);\n                }\n                var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state);\n                // For node_modules lookups, get the real path so that multiple accesses to an `npm link`-ed module do not create duplicate files.\n                return resolved_1 && { resolved: { path: realpath(resolved_1.path, host, traceEnabled), extension: resolved_1.extension }, isExternalLibraryImport: true };\n            }\n            else {\n                var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));\n                var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state);\n                return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false };\n            }\n        }\n    }\n    ts.nodeModuleNameResolver = nodeModuleNameResolver;\n    function realpath(path, host, traceEnabled) {\n        if (!host.realpath) {\n            return path;\n        }\n        var real = ts.normalizePath(host.realpath(path));\n        if (traceEnabled) {\n            trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, path, real);\n        }\n        return real;\n    }\n    function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) {\n        if (state.traceEnabled) {\n            trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate);\n        }\n        var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state);\n        return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state);\n    }\n    /* @internal */\n    function directoryProbablyExists(directoryName, host) {\n        // if host does not support 'directoryExists' assume that directory will exist\n        return !host.directoryExists || host.directoryExists(directoryName);\n    }\n    ts.directoryProbablyExists = directoryProbablyExists;\n    /**\n     * @param {boolean} onlyRecordFailures - if true then function won't try to actually load files but instead record all attempts as failures. This flag is necessary\n     * in cases when we know upfront that all load attempts will fail (because containing folder does not exists) however we still need to record all failed lookup locations.\n     */\n    function loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) {\n        // First, try adding an extension. An import of \"foo\" could be matched by a file \"foo.ts\", or \"foo.js\" by \"foo.js.ts\"\n        var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state);\n        if (resolvedByAddingExtension) {\n            return resolvedByAddingExtension;\n        }\n        // If that didn't work, try stripping a \".js\" or \".jsx\" extension and replacing it with a TypeScript one;\n        // e.g. \"./foo.js\" can be matched by \"./foo.ts\" or \"./foo.d.ts\"\n        if (ts.hasJavaScriptFileExtension(candidate)) {\n            var extensionless = ts.removeFileExtension(candidate);\n            if (state.traceEnabled) {\n                var extension = candidate.substring(extensionless.length);\n                trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);\n            }\n            return tryAddingExtensions(extensionless, extensions, failedLookupLocations, onlyRecordFailures, state);\n        }\n    }\n    /** Try to return an existing file that adds one of the `extensions` to `candidate`. */\n    function tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state) {\n        if (!onlyRecordFailures) {\n            // check if containing folder exists - if it doesn't then just record failures for all supported extensions without disk probing\n            var directory = ts.getDirectoryPath(candidate);\n            if (directory) {\n                onlyRecordFailures = !directoryProbablyExists(directory, state.host);\n            }\n        }\n        switch (extensions) {\n            case 2 /* DtsOnly */:\n                return tryExtension(\".d.ts\", ts.Extension.Dts);\n            case 0 /* TypeScript */:\n                return tryExtension(\".ts\", ts.Extension.Ts) || tryExtension(\".tsx\", ts.Extension.Tsx) || tryExtension(\".d.ts\", ts.Extension.Dts);\n            case 1 /* JavaScript */:\n                return tryExtension(\".js\", ts.Extension.Js) || tryExtension(\".jsx\", ts.Extension.Jsx);\n        }\n        function tryExtension(ext, extension) {\n            var path = tryFile(candidate + ext, failedLookupLocations, onlyRecordFailures, state);\n            return path && { path: path, extension: extension };\n        }\n    }\n    /** Return the file if it exists. */\n    function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) {\n        if (!onlyRecordFailures && state.host.fileExists(fileName)) {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName);\n            }\n            return fileName;\n        }\n        else {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName);\n            }\n            failedLookupLocations.push(fileName);\n            return undefined;\n        }\n    }\n    function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) {\n        var packageJsonPath = pathToPackageJson(candidate);\n        var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host);\n        if (directoryExists && state.host.fileExists(packageJsonPath)) {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);\n            }\n            var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state);\n            if (typesFile) {\n                var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host);\n                // A package.json \"typings\" may specify an exact filename, or may choose to omit an extension.\n                var fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures_1, state);\n                if (fromFile) {\n                    // Note: this would allow a package.json to specify a \".js\" file as typings. Maybe that should be forbidden.\n                    return resolvedFromAnyFile(fromFile);\n                }\n                var x = tryAddingExtensions(typesFile, 0 /* TypeScript */, failedLookupLocations, onlyRecordFailures_1, state);\n                if (x) {\n                    return x;\n                }\n            }\n            else {\n                if (state.traceEnabled) {\n                    trace(state.host, ts.Diagnostics.package_json_does_not_have_a_types_or_main_field);\n                }\n            }\n        }\n        else {\n            if (state.traceEnabled) {\n                trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath);\n            }\n            // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results\n            failedLookupLocations.push(packageJsonPath);\n        }\n        return loadModuleFromFile(extensions, ts.combinePaths(candidate, \"index\"), failedLookupLocations, !directoryExists, state);\n    }\n    function pathToPackageJson(directory) {\n        return ts.combinePaths(directory, \"package.json\");\n    }\n    function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) {\n        var nodeModulesFolder = ts.combinePaths(directory, \"node_modules\");\n        var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host);\n        var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName));\n        return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) ||\n            loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state);\n    }\n    function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state) {\n        return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ false);\n    }\n    function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) {\n        // Extensions parameter here doesn't actually matter, because typesOnly ensures we're just doing @types lookup, which is always DtsOnly.\n        return loadModuleFromNodeModulesWorker(2 /* DtsOnly */, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ true);\n    }\n    function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) {\n        return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) {\n            if (ts.getBaseFileName(ancestorDirectory) !== \"node_modules\") {\n                return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly);\n            }\n        });\n    }\n    /** Load a module from a single node_modules directory, but not from any ancestors' node_modules directories. */\n    function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) {\n        if (typesOnly === void 0) { typesOnly = false; }\n        var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state);\n        if (packageResult) {\n            return packageResult;\n        }\n        if (extensions !== 1 /* JavaScript */) {\n            return loadModuleFromNodeModulesFolder(2 /* DtsOnly */, ts.combinePaths(\"@types\", moduleName), directory, failedLookupLocations, state);\n        }\n    }\n    function classicNameResolver(moduleName, containingFile, compilerOptions, host) {\n        var traceEnabled = isTraceEnabled(compilerOptions, host);\n        var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };\n        var failedLookupLocations = [];\n        var containingDirectory = ts.getDirectoryPath(containingFile);\n        var resolved = tryResolve(0 /* TypeScript */) || tryResolve(1 /* JavaScript */);\n        return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ false, failedLookupLocations);\n        function tryResolve(extensions) {\n            var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state);\n            if (resolvedUsingSettings) {\n                return resolvedUsingSettings;\n            }\n            if (moduleHasNonRelativeName(moduleName)) {\n                // Climb up parent directories looking for a module.\n                var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) {\n                    var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName));\n                    return loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state);\n                });\n                if (resolved_3) {\n                    return resolved_3;\n                }\n                if (extensions === 0 /* TypeScript */) {\n                    // If we didn't find the file normally, look it up in @types.\n                    return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state);\n                }\n            }\n            else {\n                var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));\n                return loadModuleFromFile(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state);\n            }\n        }\n    }\n    ts.classicNameResolver = classicNameResolver;\n    /**\n     * LSHost may load a module from a global cache of typings.\n     * This is the minumum code needed to expose that functionality; the rest is in LSHost.\n     */\n    /* @internal */\n    function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache) {\n        var traceEnabled = isTraceEnabled(compilerOptions, host);\n        if (traceEnabled) {\n            trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache);\n        }\n        var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };\n        var failedLookupLocations = [];\n        var resolved = loadModuleFromNodeModulesOneLevel(2 /* DtsOnly */, moduleName, globalCache, failedLookupLocations, state);\n        return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations);\n    }\n    ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;\n    /** Calls `callback` on `directory` and every ancestor directory it has, returning the first defined result. */\n    function forEachAncestorDirectory(directory, callback) {\n        while (true) {\n            var result = callback(directory);\n            if (result !== undefined) {\n                return result;\n            }\n            var parentPath = ts.getDirectoryPath(directory);\n            if (parentPath === directory) {\n                return undefined;\n            }\n            directory = parentPath;\n        }\n    }\n})(ts || (ts = {}));\n/// <reference path=\"moduleNameResolver.ts\"/>\n/// <reference path=\"binder.ts\"/>\n/* @internal */\nvar ts;\n(function (ts) {\n    var ambientModuleSymbolRegex = /^\".+\"$/;\n    var nextSymbolId = 1;\n    var nextNodeId = 1;\n    var nextMergeId = 1;\n    var nextFlowId = 1;\n    function getNodeId(node) {\n        if (!node.id) {\n            node.id = nextNodeId;\n            nextNodeId++;\n        }\n        return node.id;\n    }\n    ts.getNodeId = getNodeId;\n    function getSymbolId(symbol) {\n        if (!symbol.id) {\n            symbol.id = nextSymbolId;\n            nextSymbolId++;\n        }\n        return symbol.id;\n    }\n    ts.getSymbolId = getSymbolId;\n    function createTypeChecker(host, produceDiagnostics) {\n        // Cancellation that controls whether or not we can cancel in the middle of type checking.\n        // In general cancelling is *not* safe for the type checker.  We might be in the middle of\n        // computing something, and we will leave our internals in an inconsistent state.  Callers\n        // who set the cancellation token should catch if a cancellation exception occurs, and\n        // should throw away and create a new TypeChecker.\n        //\n        // Currently we only support setting the cancellation token when getting diagnostics.  This\n        // is because diagnostics can be quite expensive, and we want to allow hosts to bail out if\n        // they no longer need the information (for example, if the user started editing again).\n        var cancellationToken;\n        var requestedExternalEmitHelpers;\n        var externalHelpersModule;\n        var Symbol = ts.objectAllocator.getSymbolConstructor();\n        var Type = ts.objectAllocator.getTypeConstructor();\n        var Signature = ts.objectAllocator.getSignatureConstructor();\n        var typeCount = 0;\n        var symbolCount = 0;\n        var emptyArray = [];\n        var emptySymbols = ts.createMap();\n        var compilerOptions = host.getCompilerOptions();\n        var languageVersion = compilerOptions.target || 0 /* ES3 */;\n        var modulekind = ts.getEmitModuleKind(compilerOptions);\n        var noUnusedIdentifiers = !!compilerOptions.noUnusedLocals || !!compilerOptions.noUnusedParameters;\n        var allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== \"undefined\" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ts.ModuleKind.System;\n        var strictNullChecks = compilerOptions.strictNullChecks;\n        var emitResolver = createResolver();\n        var undefinedSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, \"undefined\");\n        undefinedSymbol.declarations = [];\n        var argumentsSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, \"arguments\");\n        var checker = {\n            getNodeCount: function () { return ts.sum(host.getSourceFiles(), \"nodeCount\"); },\n            getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), \"identifierCount\"); },\n            getSymbolCount: function () { return ts.sum(host.getSourceFiles(), \"symbolCount\") + symbolCount; },\n            getTypeCount: function () { return typeCount; },\n            isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; },\n            isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; },\n            isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; },\n            getDiagnostics: getDiagnostics,\n            getGlobalDiagnostics: getGlobalDiagnostics,\n            getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation,\n            getSymbolsOfParameterPropertyDeclaration: getSymbolsOfParameterPropertyDeclaration,\n            getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol,\n            getPropertiesOfType: getPropertiesOfType,\n            getPropertyOfType: getPropertyOfType,\n            getSignaturesOfType: getSignaturesOfType,\n            getIndexTypeOfType: getIndexTypeOfType,\n            getBaseTypes: getBaseTypes,\n            getReturnTypeOfSignature: getReturnTypeOfSignature,\n            getNonNullableType: getNonNullableType,\n            getSymbolsInScope: getSymbolsInScope,\n            getSymbolAtLocation: getSymbolAtLocation,\n            getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol,\n            getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol,\n            getTypeAtLocation: getTypeOfNode,\n            getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment,\n            typeToString: typeToString,\n            getSymbolDisplayBuilder: getSymbolDisplayBuilder,\n            symbolToString: symbolToString,\n            getAugmentedPropertiesOfType: getAugmentedPropertiesOfType,\n            getRootSymbols: getRootSymbols,\n            getContextualType: getContextualType,\n            getFullyQualifiedName: getFullyQualifiedName,\n            getResolvedSignature: getResolvedSignature,\n            getConstantValue: getConstantValue,\n            isValidPropertyAccess: isValidPropertyAccess,\n            getSignatureFromDeclaration: getSignatureFromDeclaration,\n            isImplementationOfOverload: isImplementationOfOverload,\n            getAliasedSymbol: resolveAlias,\n            getEmitResolver: getEmitResolver,\n            getExportsOfModule: getExportsOfModuleAsArray,\n            getAmbientModules: getAmbientModules,\n            getJsxElementAttributesType: getJsxElementAttributesType,\n            getJsxIntrinsicTagNames: getJsxIntrinsicTagNames,\n            isOptionalParameter: isOptionalParameter,\n            tryGetMemberInModuleExports: tryGetMemberInModuleExports,\n            tryFindAmbientModuleWithoutAugmentations: function (moduleName) {\n                // we deliberately exclude augmentations\n                // since we are only interested in declarations of the module itself\n                return tryFindAmbientModule(moduleName, /*withAugmentations*/ false);\n            }\n        };\n        var tupleTypes = [];\n        var unionTypes = ts.createMap();\n        var intersectionTypes = ts.createMap();\n        var stringLiteralTypes = ts.createMap();\n        var numericLiteralTypes = ts.createMap();\n        var indexedAccessTypes = ts.createMap();\n        var evolvingArrayTypes = [];\n        var unknownSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, \"unknown\");\n        var resolvingSymbol = createSymbol(67108864 /* Transient */, \"__resolving__\");\n        var anyType = createIntrinsicType(1 /* Any */, \"any\");\n        var autoType = createIntrinsicType(1 /* Any */, \"any\");\n        var unknownType = createIntrinsicType(1 /* Any */, \"unknown\");\n        var undefinedType = createIntrinsicType(2048 /* Undefined */, \"undefined\");\n        var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(2048 /* Undefined */ | 2097152 /* ContainsWideningType */, \"undefined\");\n        var nullType = createIntrinsicType(4096 /* Null */, \"null\");\n        var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(4096 /* Null */ | 2097152 /* ContainsWideningType */, \"null\");\n        var stringType = createIntrinsicType(2 /* String */, \"string\");\n        var numberType = createIntrinsicType(4 /* Number */, \"number\");\n        var trueType = createIntrinsicType(128 /* BooleanLiteral */, \"true\");\n        var falseType = createIntrinsicType(128 /* BooleanLiteral */, \"false\");\n        var booleanType = createBooleanType([trueType, falseType]);\n        var esSymbolType = createIntrinsicType(512 /* ESSymbol */, \"symbol\");\n        var voidType = createIntrinsicType(1024 /* Void */, \"void\");\n        var neverType = createIntrinsicType(8192 /* Never */, \"never\");\n        var silentNeverType = createIntrinsicType(8192 /* Never */, \"never\");\n        var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n        var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */ | 67108864 /* Transient */, \"__type\");\n        emptyTypeLiteralSymbol.members = ts.createMap();\n        var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n        var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n        emptyGenericType.instantiations = ts.createMap();\n        var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n        // The anyFunctionType contains the anyFunctionType by definition. The flag is further propagated\n        // in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes.\n        anyFunctionType.flags |= 8388608 /* ContainsAnyFunctionType */;\n        var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n        var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);\n        var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);\n        var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);\n        var silentNeverSignature = createSignature(undefined, undefined, undefined, emptyArray, silentNeverType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);\n        var enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true);\n        var globals = ts.createMap();\n        /**\n         * List of every ambient module with a \"*\" wildcard.\n         * Unlike other ambient modules, these can't be stored in `globals` because symbol tables only deal with exact matches.\n         * This is only used if there is no exact match.\n        */\n        var patternAmbientModules;\n        var getGlobalESSymbolConstructorSymbol;\n        var getGlobalPromiseConstructorSymbol;\n        var tryGetGlobalPromiseConstructorSymbol;\n        var globalObjectType;\n        var globalFunctionType;\n        var globalArrayType;\n        var globalReadonlyArrayType;\n        var globalStringType;\n        var globalNumberType;\n        var globalBooleanType;\n        var globalRegExpType;\n        var anyArrayType;\n        var autoArrayType;\n        var anyReadonlyArrayType;\n        // The library files are only loaded when the feature is used.\n        // This allows users to just specify library files they want to used through --lib\n        // and they will not get an error from not having unrelated library files\n        var getGlobalTemplateStringsArrayType;\n        var getGlobalESSymbolType;\n        var getGlobalIterableType;\n        var getGlobalIteratorType;\n        var getGlobalIterableIteratorType;\n        var getGlobalClassDecoratorType;\n        var getGlobalParameterDecoratorType;\n        var getGlobalPropertyDecoratorType;\n        var getGlobalMethodDecoratorType;\n        var getGlobalTypedPropertyDescriptorType;\n        var getGlobalPromiseType;\n        var tryGetGlobalPromiseType;\n        var getGlobalPromiseLikeType;\n        var getInstantiatedGlobalPromiseLikeType;\n        var getGlobalPromiseConstructorLikeType;\n        var getGlobalThenableType;\n        var jsxElementClassType;\n        var deferredNodes;\n        var deferredUnusedIdentifierNodes;\n        var flowLoopStart = 0;\n        var flowLoopCount = 0;\n        var visitedFlowCount = 0;\n        var emptyStringType = getLiteralTypeForText(32 /* StringLiteral */, \"\");\n        var zeroType = getLiteralTypeForText(64 /* NumberLiteral */, \"0\");\n        var resolutionTargets = [];\n        var resolutionResults = [];\n        var resolutionPropertyNames = [];\n        var mergedSymbols = [];\n        var symbolLinks = [];\n        var nodeLinks = [];\n        var flowLoopCaches = [];\n        var flowLoopNodes = [];\n        var flowLoopKeys = [];\n        var flowLoopTypes = [];\n        var visitedFlowNodes = [];\n        var visitedFlowTypes = [];\n        var potentialThisCollisions = [];\n        var awaitedTypeStack = [];\n        var diagnostics = ts.createDiagnosticCollection();\n        var TypeFacts;\n        (function (TypeFacts) {\n            TypeFacts[TypeFacts[\"None\"] = 0] = \"None\";\n            TypeFacts[TypeFacts[\"TypeofEQString\"] = 1] = \"TypeofEQString\";\n            TypeFacts[TypeFacts[\"TypeofEQNumber\"] = 2] = \"TypeofEQNumber\";\n            TypeFacts[TypeFacts[\"TypeofEQBoolean\"] = 4] = \"TypeofEQBoolean\";\n            TypeFacts[TypeFacts[\"TypeofEQSymbol\"] = 8] = \"TypeofEQSymbol\";\n            TypeFacts[TypeFacts[\"TypeofEQObject\"] = 16] = \"TypeofEQObject\";\n            TypeFacts[TypeFacts[\"TypeofEQFunction\"] = 32] = \"TypeofEQFunction\";\n            TypeFacts[TypeFacts[\"TypeofEQHostObject\"] = 64] = \"TypeofEQHostObject\";\n            TypeFacts[TypeFacts[\"TypeofNEString\"] = 128] = \"TypeofNEString\";\n            TypeFacts[TypeFacts[\"TypeofNENumber\"] = 256] = \"TypeofNENumber\";\n            TypeFacts[TypeFacts[\"TypeofNEBoolean\"] = 512] = \"TypeofNEBoolean\";\n            TypeFacts[TypeFacts[\"TypeofNESymbol\"] = 1024] = \"TypeofNESymbol\";\n            TypeFacts[TypeFacts[\"TypeofNEObject\"] = 2048] = \"TypeofNEObject\";\n            TypeFacts[TypeFacts[\"TypeofNEFunction\"] = 4096] = \"TypeofNEFunction\";\n            TypeFacts[TypeFacts[\"TypeofNEHostObject\"] = 8192] = \"TypeofNEHostObject\";\n            TypeFacts[TypeFacts[\"EQUndefined\"] = 16384] = \"EQUndefined\";\n            TypeFacts[TypeFacts[\"EQNull\"] = 32768] = \"EQNull\";\n            TypeFacts[TypeFacts[\"EQUndefinedOrNull\"] = 65536] = \"EQUndefinedOrNull\";\n            TypeFacts[TypeFacts[\"NEUndefined\"] = 131072] = \"NEUndefined\";\n            TypeFacts[TypeFacts[\"NENull\"] = 262144] = \"NENull\";\n            TypeFacts[TypeFacts[\"NEUndefinedOrNull\"] = 524288] = \"NEUndefinedOrNull\";\n            TypeFacts[TypeFacts[\"Truthy\"] = 1048576] = \"Truthy\";\n            TypeFacts[TypeFacts[\"Falsy\"] = 2097152] = \"Falsy\";\n            TypeFacts[TypeFacts[\"Discriminatable\"] = 4194304] = \"Discriminatable\";\n            TypeFacts[TypeFacts[\"All\"] = 8388607] = \"All\";\n            // The following members encode facts about particular kinds of types for use in the getTypeFacts function.\n            // The presence of a particular fact means that the given test is true for some (and possibly all) values\n            // of that kind of type.\n            TypeFacts[TypeFacts[\"BaseStringStrictFacts\"] = 933633] = \"BaseStringStrictFacts\";\n            TypeFacts[TypeFacts[\"BaseStringFacts\"] = 3145473] = \"BaseStringFacts\";\n            TypeFacts[TypeFacts[\"StringStrictFacts\"] = 4079361] = \"StringStrictFacts\";\n            TypeFacts[TypeFacts[\"StringFacts\"] = 4194049] = \"StringFacts\";\n            TypeFacts[TypeFacts[\"EmptyStringStrictFacts\"] = 3030785] = \"EmptyStringStrictFacts\";\n            TypeFacts[TypeFacts[\"EmptyStringFacts\"] = 3145473] = \"EmptyStringFacts\";\n            TypeFacts[TypeFacts[\"NonEmptyStringStrictFacts\"] = 1982209] = \"NonEmptyStringStrictFacts\";\n            TypeFacts[TypeFacts[\"NonEmptyStringFacts\"] = 4194049] = \"NonEmptyStringFacts\";\n            TypeFacts[TypeFacts[\"BaseNumberStrictFacts\"] = 933506] = \"BaseNumberStrictFacts\";\n            TypeFacts[TypeFacts[\"BaseNumberFacts\"] = 3145346] = \"BaseNumberFacts\";\n            TypeFacts[TypeFacts[\"NumberStrictFacts\"] = 4079234] = \"NumberStrictFacts\";\n            TypeFacts[TypeFacts[\"NumberFacts\"] = 4193922] = \"NumberFacts\";\n            TypeFacts[TypeFacts[\"ZeroStrictFacts\"] = 3030658] = \"ZeroStrictFacts\";\n            TypeFacts[TypeFacts[\"ZeroFacts\"] = 3145346] = \"ZeroFacts\";\n            TypeFacts[TypeFacts[\"NonZeroStrictFacts\"] = 1982082] = \"NonZeroStrictFacts\";\n            TypeFacts[TypeFacts[\"NonZeroFacts\"] = 4193922] = \"NonZeroFacts\";\n            TypeFacts[TypeFacts[\"BaseBooleanStrictFacts\"] = 933252] = \"BaseBooleanStrictFacts\";\n            TypeFacts[TypeFacts[\"BaseBooleanFacts\"] = 3145092] = \"BaseBooleanFacts\";\n            TypeFacts[TypeFacts[\"BooleanStrictFacts\"] = 4078980] = \"BooleanStrictFacts\";\n            TypeFacts[TypeFacts[\"BooleanFacts\"] = 4193668] = \"BooleanFacts\";\n            TypeFacts[TypeFacts[\"FalseStrictFacts\"] = 3030404] = \"FalseStrictFacts\";\n            TypeFacts[TypeFacts[\"FalseFacts\"] = 3145092] = \"FalseFacts\";\n            TypeFacts[TypeFacts[\"TrueStrictFacts\"] = 1981828] = \"TrueStrictFacts\";\n            TypeFacts[TypeFacts[\"TrueFacts\"] = 4193668] = \"TrueFacts\";\n            TypeFacts[TypeFacts[\"SymbolStrictFacts\"] = 1981320] = \"SymbolStrictFacts\";\n            TypeFacts[TypeFacts[\"SymbolFacts\"] = 4193160] = \"SymbolFacts\";\n            TypeFacts[TypeFacts[\"ObjectStrictFacts\"] = 6166480] = \"ObjectStrictFacts\";\n            TypeFacts[TypeFacts[\"ObjectFacts\"] = 8378320] = \"ObjectFacts\";\n            TypeFacts[TypeFacts[\"FunctionStrictFacts\"] = 6164448] = \"FunctionStrictFacts\";\n            TypeFacts[TypeFacts[\"FunctionFacts\"] = 8376288] = \"FunctionFacts\";\n            TypeFacts[TypeFacts[\"UndefinedFacts\"] = 2457472] = \"UndefinedFacts\";\n            TypeFacts[TypeFacts[\"NullFacts\"] = 2340752] = \"NullFacts\";\n        })(TypeFacts || (TypeFacts = {}));\n        var typeofEQFacts = ts.createMap({\n            \"string\": 1 /* TypeofEQString */,\n            \"number\": 2 /* TypeofEQNumber */,\n            \"boolean\": 4 /* TypeofEQBoolean */,\n            \"symbol\": 8 /* TypeofEQSymbol */,\n            \"undefined\": 16384 /* EQUndefined */,\n            \"object\": 16 /* TypeofEQObject */,\n            \"function\": 32 /* TypeofEQFunction */\n        });\n        var typeofNEFacts = ts.createMap({\n            \"string\": 128 /* TypeofNEString */,\n            \"number\": 256 /* TypeofNENumber */,\n            \"boolean\": 512 /* TypeofNEBoolean */,\n            \"symbol\": 1024 /* TypeofNESymbol */,\n            \"undefined\": 131072 /* NEUndefined */,\n            \"object\": 2048 /* TypeofNEObject */,\n            \"function\": 4096 /* TypeofNEFunction */\n        });\n        var typeofTypesByName = ts.createMap({\n            \"string\": stringType,\n            \"number\": numberType,\n            \"boolean\": booleanType,\n            \"symbol\": esSymbolType,\n            \"undefined\": undefinedType\n        });\n        var jsxElementType;\n        var _jsxNamespace;\n        var _jsxFactoryEntity;\n        /** Things we lazy load from the JSX namespace */\n        var jsxTypes = ts.createMap();\n        var JsxNames = {\n            JSX: \"JSX\",\n            IntrinsicElements: \"IntrinsicElements\",\n            ElementClass: \"ElementClass\",\n            ElementAttributesPropertyNameContainer: \"ElementAttributesProperty\",\n            Element: \"Element\",\n            IntrinsicAttributes: \"IntrinsicAttributes\",\n            IntrinsicClassAttributes: \"IntrinsicClassAttributes\"\n        };\n        var subtypeRelation = ts.createMap();\n        var assignableRelation = ts.createMap();\n        var comparableRelation = ts.createMap();\n        var identityRelation = ts.createMap();\n        var enumRelation = ts.createMap();\n        // This is for caching the result of getSymbolDisplayBuilder. Do not access directly.\n        var _displayBuilder;\n        var TypeSystemPropertyName;\n        (function (TypeSystemPropertyName) {\n            TypeSystemPropertyName[TypeSystemPropertyName[\"Type\"] = 0] = \"Type\";\n            TypeSystemPropertyName[TypeSystemPropertyName[\"ResolvedBaseConstructorType\"] = 1] = \"ResolvedBaseConstructorType\";\n            TypeSystemPropertyName[TypeSystemPropertyName[\"DeclaredType\"] = 2] = \"DeclaredType\";\n            TypeSystemPropertyName[TypeSystemPropertyName[\"ResolvedReturnType\"] = 3] = \"ResolvedReturnType\";\n        })(TypeSystemPropertyName || (TypeSystemPropertyName = {}));\n        var builtinGlobals = ts.createMap();\n        builtinGlobals[undefinedSymbol.name] = undefinedSymbol;\n        initializeTypeChecker();\n        return checker;\n        function getJsxNamespace() {\n            if (_jsxNamespace === undefined) {\n                _jsxNamespace = \"React\";\n                if (compilerOptions.jsxFactory) {\n                    _jsxFactoryEntity = ts.parseIsolatedEntityName(compilerOptions.jsxFactory, languageVersion);\n                    if (_jsxFactoryEntity) {\n                        _jsxNamespace = getFirstIdentifier(_jsxFactoryEntity).text;\n                    }\n                }\n                else if (compilerOptions.reactNamespace) {\n                    _jsxNamespace = compilerOptions.reactNamespace;\n                }\n            }\n            return _jsxNamespace;\n        }\n        function getEmitResolver(sourceFile, cancellationToken) {\n            // Ensure we have all the type information in place for this file so that all the\n            // emitter questions of this resolver will return the right information.\n            getDiagnostics(sourceFile, cancellationToken);\n            return emitResolver;\n        }\n        function error(location, message, arg0, arg1, arg2) {\n            var diagnostic = location\n                ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2)\n                : ts.createCompilerDiagnostic(message, arg0, arg1, arg2);\n            diagnostics.add(diagnostic);\n        }\n        function createSymbol(flags, name) {\n            symbolCount++;\n            return new Symbol(flags, name);\n        }\n        function getExcludedSymbolFlags(flags) {\n            var result = 0;\n            if (flags & 2 /* BlockScopedVariable */)\n                result |= 107455 /* BlockScopedVariableExcludes */;\n            if (flags & 1 /* FunctionScopedVariable */)\n                result |= 107454 /* FunctionScopedVariableExcludes */;\n            if (flags & 4 /* Property */)\n                result |= 0 /* PropertyExcludes */;\n            if (flags & 8 /* EnumMember */)\n                result |= 900095 /* EnumMemberExcludes */;\n            if (flags & 16 /* Function */)\n                result |= 106927 /* FunctionExcludes */;\n            if (flags & 32 /* Class */)\n                result |= 899519 /* ClassExcludes */;\n            if (flags & 64 /* Interface */)\n                result |= 792968 /* InterfaceExcludes */;\n            if (flags & 256 /* RegularEnum */)\n                result |= 899327 /* RegularEnumExcludes */;\n            if (flags & 128 /* ConstEnum */)\n                result |= 899967 /* ConstEnumExcludes */;\n            if (flags & 512 /* ValueModule */)\n                result |= 106639 /* ValueModuleExcludes */;\n            if (flags & 8192 /* Method */)\n                result |= 99263 /* MethodExcludes */;\n            if (flags & 32768 /* GetAccessor */)\n                result |= 41919 /* GetAccessorExcludes */;\n            if (flags & 65536 /* SetAccessor */)\n                result |= 74687 /* SetAccessorExcludes */;\n            if (flags & 262144 /* TypeParameter */)\n                result |= 530920 /* TypeParameterExcludes */;\n            if (flags & 524288 /* TypeAlias */)\n                result |= 793064 /* TypeAliasExcludes */;\n            if (flags & 8388608 /* Alias */)\n                result |= 8388608 /* AliasExcludes */;\n            return result;\n        }\n        function recordMergedSymbol(target, source) {\n            if (!source.mergeId) {\n                source.mergeId = nextMergeId;\n                nextMergeId++;\n            }\n            mergedSymbols[source.mergeId] = target;\n        }\n        function cloneSymbol(symbol) {\n            var result = createSymbol(symbol.flags | 33554432 /* Merged */, symbol.name);\n            result.declarations = symbol.declarations.slice(0);\n            result.parent = symbol.parent;\n            if (symbol.valueDeclaration)\n                result.valueDeclaration = symbol.valueDeclaration;\n            if (symbol.constEnumOnlyModule)\n                result.constEnumOnlyModule = true;\n            if (symbol.members)\n                result.members = ts.cloneMap(symbol.members);\n            if (symbol.exports)\n                result.exports = ts.cloneMap(symbol.exports);\n            recordMergedSymbol(result, symbol);\n            return result;\n        }\n        function mergeSymbol(target, source) {\n            if (!(target.flags & getExcludedSymbolFlags(source.flags))) {\n                if (source.flags & 512 /* ValueModule */ && target.flags & 512 /* ValueModule */ && target.constEnumOnlyModule && !source.constEnumOnlyModule) {\n                    // reset flag when merging instantiated module into value module that has only const enums\n                    target.constEnumOnlyModule = false;\n                }\n                target.flags |= source.flags;\n                if (source.valueDeclaration &&\n                    (!target.valueDeclaration ||\n                        (target.valueDeclaration.kind === 230 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 230 /* ModuleDeclaration */))) {\n                    // other kinds of value declarations take precedence over modules\n                    target.valueDeclaration = source.valueDeclaration;\n                }\n                ts.forEach(source.declarations, function (node) {\n                    target.declarations.push(node);\n                });\n                if (source.members) {\n                    if (!target.members)\n                        target.members = ts.createMap();\n                    mergeSymbolTable(target.members, source.members);\n                }\n                if (source.exports) {\n                    if (!target.exports)\n                        target.exports = ts.createMap();\n                    mergeSymbolTable(target.exports, source.exports);\n                }\n                recordMergedSymbol(target, source);\n            }\n            else {\n                var message_2 = target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */\n                    ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0;\n                ts.forEach(source.declarations, function (node) {\n                    error(node.name ? node.name : node, message_2, symbolToString(source));\n                });\n                ts.forEach(target.declarations, function (node) {\n                    error(node.name ? node.name : node, message_2, symbolToString(source));\n                });\n            }\n        }\n        function mergeSymbolTable(target, source) {\n            for (var id in source) {\n                var targetSymbol = target[id];\n                if (!targetSymbol) {\n                    target[id] = source[id];\n                }\n                else {\n                    if (!(targetSymbol.flags & 33554432 /* Merged */)) {\n                        target[id] = targetSymbol = cloneSymbol(targetSymbol);\n                    }\n                    mergeSymbol(targetSymbol, source[id]);\n                }\n            }\n        }\n        function mergeModuleAugmentation(moduleName) {\n            var moduleAugmentation = moduleName.parent;\n            if (moduleAugmentation.symbol.declarations[0] !== moduleAugmentation) {\n                // this is a combined symbol for multiple augmentations within the same file.\n                // its symbol already has accumulated information for all declarations\n                // so we need to add it just once - do the work only for first declaration\n                ts.Debug.assert(moduleAugmentation.symbol.declarations.length > 1);\n                return;\n            }\n            if (ts.isGlobalScopeAugmentation(moduleAugmentation)) {\n                mergeSymbolTable(globals, moduleAugmentation.symbol.exports);\n            }\n            else {\n                // find a module that about to be augmented\n                // do not validate names of augmentations that are defined in ambient context\n                var moduleNotFoundError = !ts.isInAmbientContext(moduleName.parent.parent)\n                    ? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found\n                    : undefined;\n                var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true);\n                if (!mainModule) {\n                    return;\n                }\n                // obtain item referenced by 'export='\n                mainModule = resolveExternalModuleSymbol(mainModule);\n                if (mainModule.flags & 1920 /* Namespace */) {\n                    // if module symbol has already been merged - it is safe to use it.\n                    // otherwise clone it\n                    mainModule = mainModule.flags & 33554432 /* Merged */ ? mainModule : cloneSymbol(mainModule);\n                    mergeSymbol(mainModule, moduleAugmentation.symbol);\n                }\n                else {\n                    error(moduleName, ts.Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text);\n                }\n            }\n        }\n        function addToSymbolTable(target, source, message) {\n            for (var id in source) {\n                if (target[id]) {\n                    // Error on redeclarations\n                    ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message));\n                }\n                else {\n                    target[id] = source[id];\n                }\n            }\n            function addDeclarationDiagnostic(id, message) {\n                return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); };\n            }\n        }\n        function getSymbolLinks(symbol) {\n            if (symbol.flags & 67108864 /* Transient */)\n                return symbol;\n            var id = getSymbolId(symbol);\n            return symbolLinks[id] || (symbolLinks[id] = {});\n        }\n        function getNodeLinks(node) {\n            var nodeId = getNodeId(node);\n            return nodeLinks[nodeId] || (nodeLinks[nodeId] = { flags: 0 });\n        }\n        function getObjectFlags(type) {\n            return type.flags & 32768 /* Object */ ? type.objectFlags : 0;\n        }\n        function isGlobalSourceFile(node) {\n            return node.kind === 261 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node);\n        }\n        function getSymbol(symbols, name, meaning) {\n            if (meaning) {\n                var symbol = symbols[name];\n                if (symbol) {\n                    ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0, \"Should never get an instantiated symbol here.\");\n                    if (symbol.flags & meaning) {\n                        return symbol;\n                    }\n                    if (symbol.flags & 8388608 /* Alias */) {\n                        var target = resolveAlias(symbol);\n                        // Unknown symbol means an error occurred in alias resolution, treat it as positive answer to avoid cascading errors\n                        if (target === unknownSymbol || target.flags & meaning) {\n                            return symbol;\n                        }\n                    }\n                }\n            }\n            // return undefined if we can't find a symbol.\n        }\n        /**\n         * Get symbols that represent parameter-property-declaration as parameter and as property declaration\n         * @param parameter a parameterDeclaration node\n         * @param parameterName a name of the parameter to get the symbols for.\n         * @return a tuple of two symbols\n         */\n        function getSymbolsOfParameterPropertyDeclaration(parameter, parameterName) {\n            var constructorDeclaration = parameter.parent;\n            var classDeclaration = parameter.parent.parent;\n            var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 107455 /* Value */);\n            var propertySymbol = getSymbol(classDeclaration.symbol.members, parameterName, 107455 /* Value */);\n            if (parameterSymbol && propertySymbol) {\n                return [parameterSymbol, propertySymbol];\n            }\n            ts.Debug.fail(\"There should exist two symbols, one as property declaration and one as parameter declaration\");\n        }\n        function isBlockScopedNameDeclaredBeforeUse(declaration, usage) {\n            var declarationFile = ts.getSourceFileOfNode(declaration);\n            var useFile = ts.getSourceFileOfNode(usage);\n            if (declarationFile !== useFile) {\n                if ((modulekind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator)) ||\n                    (!compilerOptions.outFile && !compilerOptions.out)) {\n                    // nodes are in different files and order cannot be determines\n                    return true;\n                }\n                // declaration is after usage\n                // can be legal if usage is deferred (i.e. inside function or in initializer of instance property)\n                if (isUsedInFunctionOrNonStaticProperty(usage)) {\n                    return true;\n                }\n                var sourceFiles = host.getSourceFiles();\n                return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile);\n            }\n            if (declaration.pos <= usage.pos) {\n                // declaration is before usage\n                // still might be illegal if usage is in the initializer of the variable declaration\n                return declaration.kind !== 223 /* VariableDeclaration */ ||\n                    !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);\n            }\n            // declaration is after usage\n            // can be legal if usage is deferred (i.e. inside function or in initializer of instance property)\n            var container = ts.getEnclosingBlockScopeContainer(declaration);\n            return isUsedInFunctionOrNonStaticProperty(usage, container);\n            function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) {\n                var container = ts.getEnclosingBlockScopeContainer(declaration);\n                switch (declaration.parent.parent.kind) {\n                    case 205 /* VariableStatement */:\n                    case 211 /* ForStatement */:\n                    case 213 /* ForOfStatement */:\n                        // variable statement/for/for-of statement case,\n                        // use site should not be inside variable declaration (initializer of declaration or binding element)\n                        if (isSameScopeDescendentOf(usage, declaration, container)) {\n                            return true;\n                        }\n                        break;\n                }\n                switch (declaration.parent.parent.kind) {\n                    case 212 /* ForInStatement */:\n                    case 213 /* ForOfStatement */:\n                        // ForIn/ForOf case - use site should not be used in expression part\n                        if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) {\n                            return true;\n                        }\n                }\n                return false;\n            }\n            function isUsedInFunctionOrNonStaticProperty(usage, container) {\n                var current = usage;\n                while (current) {\n                    if (current === container) {\n                        return false;\n                    }\n                    if (ts.isFunctionLike(current)) {\n                        return true;\n                    }\n                    var initializerOfNonStaticProperty = current.parent &&\n                        current.parent.kind === 147 /* PropertyDeclaration */ &&\n                        (ts.getModifierFlags(current.parent) & 32 /* Static */) === 0 &&\n                        current.parent.initializer === current;\n                    if (initializerOfNonStaticProperty) {\n                        return true;\n                    }\n                    current = current.parent;\n                }\n                return false;\n            }\n        }\n        // Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and\n        // the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with\n        // the given name can be found.\n        function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) {\n            var result;\n            var lastLocation;\n            var propertyWithInvalidInitializer;\n            var errorLocation = location;\n            var grandparent;\n            var isInExternalModule = false;\n            loop: while (location) {\n                // Locals of a source file are not in scope (because they get merged into the global symbol table)\n                if (location.locals && !isGlobalSourceFile(location)) {\n                    if (result = getSymbol(location.locals, name, meaning)) {\n                        var useResult = true;\n                        if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) {\n                            // symbol lookup restrictions for function-like declarations\n                            // - Type parameters of a function are in scope in the entire function declaration, including the parameter\n                            //   list and return type. However, local types are only in scope in the function body.\n                            // - parameters are only in the scope of function body\n                            // This restriction does not apply to JSDoc comment types because they are parented\n                            // at a higher level than type parameters would normally be\n                            if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 278 /* JSDocComment */) {\n                                useResult = result.flags & 262144 /* TypeParameter */\n                                    ? lastLocation === location.type ||\n                                        lastLocation.kind === 144 /* Parameter */ ||\n                                        lastLocation.kind === 143 /* TypeParameter */\n                                    : false;\n                            }\n                            if (meaning & 107455 /* Value */ && result.flags & 1 /* FunctionScopedVariable */) {\n                                // parameters are visible only inside function body, parameter list and return type\n                                // technically for parameter list case here we might mix parameters and variables declared in function,\n                                // however it is detected separately when checking initializers of parameters\n                                // to make sure that they reference no variables declared after them.\n                                useResult =\n                                    lastLocation.kind === 144 /* Parameter */ ||\n                                        (lastLocation === location.type &&\n                                            result.valueDeclaration.kind === 144 /* Parameter */);\n                            }\n                        }\n                        if (useResult) {\n                            break loop;\n                        }\n                        else {\n                            result = undefined;\n                        }\n                    }\n                }\n                switch (location.kind) {\n                    case 261 /* SourceFile */:\n                        if (!ts.isExternalOrCommonJsModule(location))\n                            break;\n                        isInExternalModule = true;\n                    case 230 /* ModuleDeclaration */:\n                        var moduleExports = getSymbolOfNode(location).exports;\n                        if (location.kind === 261 /* SourceFile */ || ts.isAmbientModule(location)) {\n                            // It's an external module. First see if the module has an export default and if the local\n                            // name of that export default matches.\n                            if (result = moduleExports[\"default\"]) {\n                                var localSymbol = ts.getLocalSymbolForExportDefault(result);\n                                if (localSymbol && (result.flags & meaning) && localSymbol.name === name) {\n                                    break loop;\n                                }\n                                result = undefined;\n                            }\n                            // Because of module/namespace merging, a module's exports are in scope,\n                            // yet we never want to treat an export specifier as putting a member in scope.\n                            // Therefore, if the name we find is purely an export specifier, it is not actually considered in scope.\n                            // Two things to note about this:\n                            //     1. We have to check this without calling getSymbol. The problem with calling getSymbol\n                            //        on an export specifier is that it might find the export specifier itself, and try to\n                            //        resolve it as an alias. This will cause the checker to consider the export specifier\n                            //        a circular alias reference when it might not be.\n                            //     2. We check === SymbolFlags.Alias in order to check that the symbol is *purely*\n                            //        an alias. If we used &, we'd be throwing out symbols that have non alias aspects,\n                            //        which is not the desired behavior.\n                            if (moduleExports[name] &&\n                                moduleExports[name].flags === 8388608 /* Alias */ &&\n                                ts.getDeclarationOfKind(moduleExports[name], 243 /* ExportSpecifier */)) {\n                                break;\n                            }\n                        }\n                        if (result = getSymbol(moduleExports, name, meaning & 8914931 /* ModuleMember */)) {\n                            break loop;\n                        }\n                        break;\n                    case 229 /* EnumDeclaration */:\n                        if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) {\n                            break loop;\n                        }\n                        break;\n                    case 147 /* PropertyDeclaration */:\n                    case 146 /* PropertySignature */:\n                        // TypeScript 1.0 spec (April 2014): 8.4.1\n                        // Initializer expressions for instance member variables are evaluated in the scope\n                        // of the class constructor body but are not permitted to reference parameters or\n                        // local variables of the constructor. This effectively means that entities from outer scopes\n                        // by the same name as a constructor parameter or local variable are inaccessible\n                        // in initializer expressions for instance member variables.\n                        if (ts.isClassLike(location.parent) && !(ts.getModifierFlags(location) & 32 /* Static */)) {\n                            var ctor = findConstructorDeclaration(location.parent);\n                            if (ctor && ctor.locals) {\n                                if (getSymbol(ctor.locals, name, meaning & 107455 /* Value */)) {\n                                    // Remember the property node, it will be used later to report appropriate error\n                                    propertyWithInvalidInitializer = location;\n                                }\n                            }\n                        }\n                        break;\n                    case 226 /* ClassDeclaration */:\n                    case 197 /* ClassExpression */:\n                    case 227 /* InterfaceDeclaration */:\n                        if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064 /* Type */)) {\n                            if (lastLocation && ts.getModifierFlags(lastLocation) & 32 /* Static */) {\n                                // TypeScript 1.0 spec (April 2014): 3.4.1\n                                // The scope of a type parameter extends over the entire declaration with which the type\n                                // parameter list is associated, with the exception of static member declarations in classes.\n                                error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters);\n                                return undefined;\n                            }\n                            break loop;\n                        }\n                        if (location.kind === 197 /* ClassExpression */ && meaning & 32 /* Class */) {\n                            var className = location.name;\n                            if (className && name === className.text) {\n                                result = location.symbol;\n                                break loop;\n                            }\n                        }\n                        break;\n                    // It is not legal to reference a class's own type parameters from a computed property name that\n                    // belongs to the class. For example:\n                    //\n                    //   function foo<T>() { return '' }\n                    //   class C<T> { // <-- Class's own type parameter T\n                    //       [foo<T>()]() { } // <-- Reference to T from class's own computed property\n                    //   }\n                    //\n                    case 142 /* ComputedPropertyName */:\n                        grandparent = location.parent.parent;\n                        if (ts.isClassLike(grandparent) || grandparent.kind === 227 /* InterfaceDeclaration */) {\n                            // A reference to this grandparent's type parameters would be an error\n                            if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064 /* Type */)) {\n                                error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);\n                                return undefined;\n                            }\n                        }\n                        break;\n                    case 149 /* MethodDeclaration */:\n                    case 148 /* MethodSignature */:\n                    case 150 /* Constructor */:\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                    case 225 /* FunctionDeclaration */:\n                    case 185 /* ArrowFunction */:\n                        if (meaning & 3 /* Variable */ && name === \"arguments\") {\n                            result = argumentsSymbol;\n                            break loop;\n                        }\n                        break;\n                    case 184 /* FunctionExpression */:\n                        if (meaning & 3 /* Variable */ && name === \"arguments\") {\n                            result = argumentsSymbol;\n                            break loop;\n                        }\n                        if (meaning & 16 /* Function */) {\n                            var functionName = location.name;\n                            if (functionName && name === functionName.text) {\n                                result = location.symbol;\n                                break loop;\n                            }\n                        }\n                        break;\n                    case 145 /* Decorator */:\n                        // Decorators are resolved at the class declaration. Resolving at the parameter\n                        // or member would result in looking up locals in the method.\n                        //\n                        //   function y() {}\n                        //   class C {\n                        //       method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter.\n                        //   }\n                        //\n                        if (location.parent && location.parent.kind === 144 /* Parameter */) {\n                            location = location.parent;\n                        }\n                        //\n                        //   function y() {}\n                        //   class C {\n                        //       @y method(x, y) {} // <-- decorator y should be resolved at the class declaration, not the method.\n                        //   }\n                        //\n                        if (location.parent && ts.isClassElement(location.parent)) {\n                            location = location.parent;\n                        }\n                        break;\n                }\n                lastLocation = location;\n                location = location.parent;\n            }\n            if (result && nameNotFoundMessage && noUnusedIdentifiers) {\n                result.isReferenced = true;\n            }\n            if (!result) {\n                result = getSymbol(globals, name, meaning);\n            }\n            if (!result) {\n                if (nameNotFoundMessage) {\n                    if (!errorLocation ||\n                        !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&\n                            !checkAndReportErrorForExtendingInterface(errorLocation) &&\n                            !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&\n                            !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) {\n                        error(errorLocation, nameNotFoundMessage, typeof nameArg === \"string\" ? nameArg : ts.declarationNameToString(nameArg));\n                    }\n                }\n                return undefined;\n            }\n            // Perform extra checks only if error reporting was requested\n            if (nameNotFoundMessage) {\n                if (propertyWithInvalidInitializer) {\n                    // We have a match, but the reference occurred within a property initializer and the identifier also binds\n                    // to a local variable in the constructor where the code will be emitted.\n                    var propertyName = propertyWithInvalidInitializer.name;\n                    error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), typeof nameArg === \"string\" ? nameArg : ts.declarationNameToString(nameArg));\n                    return undefined;\n                }\n                // Only check for block-scoped variable if we are looking for the\n                // name with variable meaning\n                //      For example,\n                //          declare module foo {\n                //              interface bar {}\n                //          }\n                //      const foo/*1*/: foo/*2*/.bar;\n                // The foo at /*1*/ and /*2*/ will share same symbol with two meaning\n                // block - scope variable and namespace module. However, only when we\n                // try to resolve name in /*1*/ which is used in variable position,\n                // we want to check for block- scoped\n                if (meaning & 2 /* BlockScopedVariable */) {\n                    var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);\n                    if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */) {\n                        checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);\n                    }\n                }\n                // If we're in an external module, we can't reference value symbols created from UMD export declarations\n                if (result && isInExternalModule && (meaning & 107455 /* Value */) === 107455 /* Value */) {\n                    var decls = result.declarations;\n                    if (decls && decls.length === 1 && decls[0].kind === 233 /* NamespaceExportDeclaration */) {\n                        error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name);\n                    }\n                }\n            }\n            return result;\n        }\n        function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) {\n            if ((errorLocation.kind === 70 /* Identifier */ && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) {\n                return false;\n            }\n            var container = ts.getThisContainer(errorLocation, /* includeArrowFunctions */ true);\n            var location = container;\n            while (location) {\n                if (ts.isClassLike(location.parent)) {\n                    var classSymbol = getSymbolOfNode(location.parent);\n                    if (!classSymbol) {\n                        break;\n                    }\n                    // Check to see if a static member exists.\n                    var constructorType = getTypeOfSymbol(classSymbol);\n                    if (getPropertyOfType(constructorType, name)) {\n                        error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, typeof nameArg === \"string\" ? nameArg : ts.declarationNameToString(nameArg), symbolToString(classSymbol));\n                        return true;\n                    }\n                    // No static member is present.\n                    // Check if we're in an instance method and look for a relevant instance member.\n                    if (location === container && !(ts.getModifierFlags(location) & 32 /* Static */)) {\n                        var instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType;\n                        if (getPropertyOfType(instanceType, name)) {\n                            error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, typeof nameArg === \"string\" ? nameArg : ts.declarationNameToString(nameArg));\n                            return true;\n                        }\n                    }\n                }\n                location = location.parent;\n            }\n            return false;\n        }\n        function checkAndReportErrorForExtendingInterface(errorLocation) {\n            var expression = getEntityNameForExtendingInterface(errorLocation);\n            var isError = !!(expression && resolveEntityName(expression, 64 /* Interface */, /*ignoreErrors*/ true));\n            if (isError) {\n                error(errorLocation, ts.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements, ts.getTextOfNode(expression));\n            }\n            return isError;\n        }\n        /**\n         * Climbs up parents to an ExpressionWithTypeArguments, and returns its expression,\n         * but returns undefined if that expression is not an EntityNameExpression.\n         */\n        function getEntityNameForExtendingInterface(node) {\n            switch (node.kind) {\n                case 70 /* Identifier */:\n                case 177 /* PropertyAccessExpression */:\n                    return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined;\n                case 199 /* ExpressionWithTypeArguments */:\n                    ts.Debug.assert(ts.isEntityNameExpression(node.expression));\n                    return node.expression;\n                default:\n                    return undefined;\n            }\n        }\n        function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) {\n            if (meaning === 1920 /* Namespace */) {\n                var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 /* Type */ & ~107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined));\n                if (symbol) {\n                    error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, name);\n                    return true;\n                }\n            }\n            return false;\n        }\n        function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {\n            if (meaning & (107455 /* Value */ & ~1024 /* NamespaceModule */)) {\n                var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 /* Type */ & ~107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined));\n                if (symbol && !(symbol.flags & 1024 /* NamespaceModule */)) {\n                    error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, name);\n                    return true;\n                }\n            }\n            return false;\n        }\n        function checkResolvedBlockScopedVariable(result, errorLocation) {\n            ts.Debug.assert((result.flags & 2 /* BlockScopedVariable */) !== 0);\n            // Block-scoped variables cannot be used before their definition\n            var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; });\n            ts.Debug.assert(declaration !== undefined, \"Block-scoped variable declaration is undefined\");\n            if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 223 /* VariableDeclaration */), errorLocation)) {\n                error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name));\n            }\n        }\n        /* Starting from 'initial' node walk up the parent chain until 'stopAt' node is reached.\n         * If at any point current node is equal to 'parent' node - return true.\n         * Return false if 'stopAt' node is reached or isFunctionLike(current) === true.\n         */\n        function isSameScopeDescendentOf(initial, parent, stopAt) {\n            if (!parent) {\n                return false;\n            }\n            for (var current = initial; current && current !== stopAt && !ts.isFunctionLike(current); current = current.parent) {\n                if (current === parent) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function getAnyImportSyntax(node) {\n            if (ts.isAliasSymbolDeclaration(node)) {\n                if (node.kind === 234 /* ImportEqualsDeclaration */) {\n                    return node;\n                }\n                while (node && node.kind !== 235 /* ImportDeclaration */) {\n                    node = node.parent;\n                }\n                return node;\n            }\n        }\n        function getDeclarationOfAliasSymbol(symbol) {\n            return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; });\n        }\n        function getTargetOfImportEqualsDeclaration(node) {\n            if (node.moduleReference.kind === 245 /* ExternalModuleReference */) {\n                return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node)));\n            }\n            return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference);\n        }\n        function getTargetOfImportClause(node) {\n            var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);\n            if (moduleSymbol) {\n                var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ?\n                    moduleSymbol :\n                    moduleSymbol.exports[\"export=\"] ?\n                        getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports[\"export=\"]), \"default\") :\n                        resolveSymbol(moduleSymbol.exports[\"default\"]);\n                if (!exportDefaultSymbol && !allowSyntheticDefaultImports) {\n                    error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));\n                }\n                else if (!exportDefaultSymbol && allowSyntheticDefaultImports) {\n                    return resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol);\n                }\n                return exportDefaultSymbol;\n            }\n        }\n        function getTargetOfNamespaceImport(node) {\n            var moduleSpecifier = node.parent.parent.moduleSpecifier;\n            return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier);\n        }\n        // This function creates a synthetic symbol that combines the value side of one symbol with the\n        // type/namespace side of another symbol. Consider this example:\n        //\n        //   declare module graphics {\n        //       interface Point {\n        //           x: number;\n        //           y: number;\n        //       }\n        //   }\n        //   declare var graphics: {\n        //       Point: new (x: number, y: number) => graphics.Point;\n        //   }\n        //   declare module \"graphics\" {\n        //       export = graphics;\n        //   }\n        //\n        // An 'import { Point } from \"graphics\"' needs to create a symbol that combines the value side 'Point'\n        // property with the type/namespace side interface 'Point'.\n        function combineValueAndTypeSymbols(valueSymbol, typeSymbol) {\n            if (valueSymbol.flags & (793064 /* Type */ | 1920 /* Namespace */)) {\n                return valueSymbol;\n            }\n            var result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.name);\n            result.declarations = ts.concatenate(valueSymbol.declarations, typeSymbol.declarations);\n            result.parent = valueSymbol.parent || typeSymbol.parent;\n            if (valueSymbol.valueDeclaration)\n                result.valueDeclaration = valueSymbol.valueDeclaration;\n            if (typeSymbol.members)\n                result.members = typeSymbol.members;\n            if (valueSymbol.exports)\n                result.exports = valueSymbol.exports;\n            return result;\n        }\n        function getExportOfModule(symbol, name) {\n            if (symbol.flags & 1536 /* Module */) {\n                var exportedSymbol = getExportsOfSymbol(symbol)[name];\n                if (exportedSymbol) {\n                    return resolveSymbol(exportedSymbol);\n                }\n            }\n        }\n        function getPropertyOfVariable(symbol, name) {\n            if (symbol.flags & 3 /* Variable */) {\n                var typeAnnotation = symbol.valueDeclaration.type;\n                if (typeAnnotation) {\n                    return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name));\n                }\n            }\n        }\n        function getExternalModuleMember(node, specifier) {\n            var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);\n            var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier);\n            if (targetSymbol) {\n                var name_16 = specifier.propertyName || specifier.name;\n                if (name_16.text) {\n                    if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {\n                        return moduleSymbol;\n                    }\n                    var symbolFromVariable = void 0;\n                    // First check if module was specified with \"export=\". If so, get the member from the resolved type\n                    if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports[\"export=\"]) {\n                        symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_16.text);\n                    }\n                    else {\n                        symbolFromVariable = getPropertyOfVariable(targetSymbol, name_16.text);\n                    }\n                    // if symbolFromVariable is export - get its final target\n                    symbolFromVariable = resolveSymbol(symbolFromVariable);\n                    var symbolFromModule = getExportOfModule(targetSymbol, name_16.text);\n                    // If the export member we're looking for is default, and there is no real default but allowSyntheticDefaultImports is on, return the entire module as the default\n                    if (!symbolFromModule && allowSyntheticDefaultImports && name_16.text === \"default\") {\n                        symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol);\n                    }\n                    var symbol = symbolFromModule && symbolFromVariable ?\n                        combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :\n                        symbolFromModule || symbolFromVariable;\n                    if (!symbol) {\n                        error(name_16, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_16));\n                    }\n                    return symbol;\n                }\n            }\n        }\n        function getTargetOfImportSpecifier(node) {\n            return getExternalModuleMember(node.parent.parent.parent, node);\n        }\n        function getTargetOfNamespaceExportDeclaration(node) {\n            return resolveExternalModuleSymbol(node.parent.symbol);\n        }\n        function getTargetOfExportSpecifier(node) {\n            return node.parent.parent.moduleSpecifier ?\n                getExternalModuleMember(node.parent.parent, node) :\n                resolveEntityName(node.propertyName || node.name, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */);\n        }\n        function getTargetOfExportAssignment(node) {\n            return resolveEntityName(node.expression, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */);\n        }\n        function getTargetOfAliasDeclaration(node) {\n            switch (node.kind) {\n                case 234 /* ImportEqualsDeclaration */:\n                    return getTargetOfImportEqualsDeclaration(node);\n                case 236 /* ImportClause */:\n                    return getTargetOfImportClause(node);\n                case 237 /* NamespaceImport */:\n                    return getTargetOfNamespaceImport(node);\n                case 239 /* ImportSpecifier */:\n                    return getTargetOfImportSpecifier(node);\n                case 243 /* ExportSpecifier */:\n                    return getTargetOfExportSpecifier(node);\n                case 240 /* ExportAssignment */:\n                    return getTargetOfExportAssignment(node);\n                case 233 /* NamespaceExportDeclaration */:\n                    return getTargetOfNamespaceExportDeclaration(node);\n            }\n        }\n        function resolveSymbol(symbol) {\n            return symbol && symbol.flags & 8388608 /* Alias */ && !(symbol.flags & (107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */)) ? resolveAlias(symbol) : symbol;\n        }\n        function resolveAlias(symbol) {\n            ts.Debug.assert((symbol.flags & 8388608 /* Alias */) !== 0, \"Should only get Alias here.\");\n            var links = getSymbolLinks(symbol);\n            if (!links.target) {\n                links.target = resolvingSymbol;\n                var node = getDeclarationOfAliasSymbol(symbol);\n                ts.Debug.assert(!!node);\n                var target = getTargetOfAliasDeclaration(node);\n                if (links.target === resolvingSymbol) {\n                    links.target = target || unknownSymbol;\n                }\n                else {\n                    error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));\n                }\n            }\n            else if (links.target === resolvingSymbol) {\n                links.target = unknownSymbol;\n            }\n            return links.target;\n        }\n        function markExportAsReferenced(node) {\n            var symbol = getSymbolOfNode(node);\n            var target = resolveAlias(symbol);\n            if (target) {\n                var markAlias = target === unknownSymbol ||\n                    ((target.flags & 107455 /* Value */) && !isConstEnumOrConstEnumOnlyModule(target));\n                if (markAlias) {\n                    markAliasSymbolAsReferenced(symbol);\n                }\n            }\n        }\n        // When an alias symbol is referenced, we need to mark the entity it references as referenced and in turn repeat that until\n        // we reach a non-alias or an exported entity (which is always considered referenced). We do this by checking the target of\n        // the alias as an expression (which recursively takes us back here if the target references another alias).\n        function markAliasSymbolAsReferenced(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.referenced) {\n                links.referenced = true;\n                var node = getDeclarationOfAliasSymbol(symbol);\n                ts.Debug.assert(!!node);\n                if (node.kind === 240 /* ExportAssignment */) {\n                    // export default <symbol>\n                    checkExpressionCached(node.expression);\n                }\n                else if (node.kind === 243 /* ExportSpecifier */) {\n                    // export { <symbol> } or export { <symbol> as foo }\n                    checkExpressionCached(node.propertyName || node.name);\n                }\n                else if (ts.isInternalModuleImportEqualsDeclaration(node)) {\n                    // import foo = <symbol>\n                    checkExpressionCached(node.moduleReference);\n                }\n            }\n        }\n        // This function is only for imports with entity names\n        function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) {\n            // There are three things we might try to look for. In the following examples,\n            // the search term is enclosed in |...|:\n            //\n            //     import a = |b|; // Namespace\n            //     import a = |b.c|; // Value, type, namespace\n            //     import a = |b.c|.d; // Namespace\n            if (entityName.kind === 70 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {\n                entityName = entityName.parent;\n            }\n            // Check for case 1 and 3 in the above example\n            if (entityName.kind === 70 /* Identifier */ || entityName.parent.kind === 141 /* QualifiedName */) {\n                return resolveEntityName(entityName, 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);\n            }\n            else {\n                // Case 2 in above example\n                // entityName.kind could be a QualifiedName or a Missing identifier\n                ts.Debug.assert(entityName.parent.kind === 234 /* ImportEqualsDeclaration */);\n                return resolveEntityName(entityName, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);\n            }\n        }\n        function getFullyQualifiedName(symbol) {\n            return symbol.parent ? getFullyQualifiedName(symbol.parent) + \".\" + symbolToString(symbol) : symbolToString(symbol);\n        }\n        // Resolves a qualified name and any involved aliases\n        function resolveEntityName(name, meaning, ignoreErrors, dontResolveAlias, location) {\n            if (ts.nodeIsMissing(name)) {\n                return undefined;\n            }\n            var symbol;\n            if (name.kind === 70 /* Identifier */) {\n                var message = meaning === 1920 /* Namespace */ ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0;\n                symbol = resolveName(location || name, name.text, meaning, ignoreErrors ? undefined : message, name);\n                if (!symbol) {\n                    return undefined;\n                }\n            }\n            else if (name.kind === 141 /* QualifiedName */ || name.kind === 177 /* PropertyAccessExpression */) {\n                var left = name.kind === 141 /* QualifiedName */ ? name.left : name.expression;\n                var right = name.kind === 141 /* QualifiedName */ ? name.right : name.name;\n                var namespace = resolveEntityName(left, 1920 /* Namespace */, ignoreErrors, /*dontResolveAlias*/ false, location);\n                if (!namespace || ts.nodeIsMissing(right)) {\n                    return undefined;\n                }\n                else if (namespace === unknownSymbol) {\n                    return namespace;\n                }\n                symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning);\n                if (!symbol) {\n                    if (!ignoreErrors) {\n                        error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right));\n                    }\n                    return undefined;\n                }\n            }\n            else {\n                ts.Debug.fail(\"Unknown entity name kind.\");\n            }\n            ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0, \"Should never get an instantiated symbol here.\");\n            return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol);\n        }\n        function resolveExternalModuleName(location, moduleReferenceExpression) {\n            return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ts.Diagnostics.Cannot_find_module_0);\n        }\n        function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation) {\n            if (isForAugmentation === void 0) { isForAugmentation = false; }\n            if (moduleReferenceExpression.kind !== 9 /* StringLiteral */) {\n                return;\n            }\n            var moduleReferenceLiteral = moduleReferenceExpression;\n            return resolveExternalModule(location, moduleReferenceLiteral.text, moduleNotFoundError, moduleReferenceLiteral, isForAugmentation);\n        }\n        function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {\n            if (isForAugmentation === void 0) { isForAugmentation = false; }\n            // Module names are escaped in our symbol table.  However, string literal values aren't.\n            // Escape the name in the \"require(...)\" clause to ensure we find the right symbol.\n            var moduleName = ts.escapeIdentifier(moduleReference);\n            if (moduleName === undefined) {\n                return;\n            }\n            var ambientModule = tryFindAmbientModule(moduleName, /*withAugmentations*/ true);\n            if (ambientModule) {\n                return ambientModule;\n            }\n            var isRelative = ts.isExternalModuleNameRelative(moduleName);\n            var resolvedModule = ts.getResolvedModule(ts.getSourceFileOfNode(location), moduleReference);\n            var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);\n            var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);\n            if (sourceFile) {\n                if (sourceFile.symbol) {\n                    // merged symbol is module declaration symbol combined with all augmentations\n                    return getMergedSymbol(sourceFile.symbol);\n                }\n                if (moduleNotFoundError) {\n                    // report errors only if it was requested\n                    error(errorNode, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName);\n                }\n                return undefined;\n            }\n            if (patternAmbientModules) {\n                var pattern = ts.findBestPatternMatch(patternAmbientModules, function (_) { return _.pattern; }, moduleName);\n                if (pattern) {\n                    return getMergedSymbol(pattern.symbol);\n                }\n            }\n            // May be an untyped module. If so, ignore resolutionDiagnostic.\n            if (!isRelative && resolvedModule && !ts.extensionIsTypeScript(resolvedModule.extension)) {\n                if (isForAugmentation) {\n                    ts.Debug.assert(!!moduleNotFoundError);\n                    var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;\n                    error(errorNode, diag, moduleName, resolvedModule.resolvedFileName);\n                }\n                else if (compilerOptions.noImplicitAny && moduleNotFoundError) {\n                    error(errorNode, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedModule.resolvedFileName);\n                }\n                // Failed imports and untyped modules are both treated in an untyped manner; only difference is whether we give a diagnostic first.\n                return undefined;\n            }\n            if (moduleNotFoundError) {\n                // report errors only if it was requested\n                if (resolutionDiagnostic) {\n                    error(errorNode, resolutionDiagnostic, moduleName, resolvedModule.resolvedFileName);\n                }\n                else {\n                    var tsExtension = ts.tryExtractTypeScriptExtension(moduleName);\n                    if (tsExtension) {\n                        var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;\n                        error(errorNode, diag, tsExtension, ts.removeExtension(moduleName, tsExtension));\n                    }\n                    else {\n                        error(errorNode, moduleNotFoundError, moduleName);\n                    }\n                }\n            }\n            return undefined;\n        }\n        // An external module with an 'export =' declaration resolves to the target of the 'export =' declaration,\n        // and an external module with no 'export =' declaration resolves to the module itself.\n        function resolveExternalModuleSymbol(moduleSymbol) {\n            return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports[\"export=\"])) || moduleSymbol;\n        }\n        // An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export ='\n        // references a symbol that is at least declared as a module or a variable. The target of the 'export =' may\n        // combine other declarations with the module or variable (e.g. a class/module, function/module, interface/variable).\n        function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) {\n            var symbol = resolveExternalModuleSymbol(moduleSymbol);\n            if (symbol && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */))) {\n                error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol));\n                symbol = undefined;\n            }\n            return symbol;\n        }\n        function hasExportAssignmentSymbol(moduleSymbol) {\n            return moduleSymbol.exports[\"export=\"] !== undefined;\n        }\n        function getExportsOfModuleAsArray(moduleSymbol) {\n            return symbolsToArray(getExportsOfModule(moduleSymbol));\n        }\n        function tryGetMemberInModuleExports(memberName, moduleSymbol) {\n            var symbolTable = getExportsOfModule(moduleSymbol);\n            if (symbolTable) {\n                return symbolTable[memberName];\n            }\n        }\n        function getExportsOfSymbol(symbol) {\n            return symbol.flags & 1536 /* Module */ ? getExportsOfModule(symbol) : symbol.exports || emptySymbols;\n        }\n        function getExportsOfModule(moduleSymbol) {\n            var links = getSymbolLinks(moduleSymbol);\n            return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol));\n        }\n        /**\n         * Extends one symbol table with another while collecting information on name collisions for error message generation into the `lookupTable` argument\n         * Not passing `lookupTable` and `exportNode` disables this collection, and just extends the tables\n         */\n        function extendExportSymbols(target, source, lookupTable, exportNode) {\n            for (var id in source) {\n                if (id !== \"default\" && !target[id]) {\n                    target[id] = source[id];\n                    if (lookupTable && exportNode) {\n                        lookupTable[id] = {\n                            specifierText: ts.getTextOfNode(exportNode.moduleSpecifier)\n                        };\n                    }\n                }\n                else if (lookupTable && exportNode && id !== \"default\" && target[id] && resolveSymbol(target[id]) !== resolveSymbol(source[id])) {\n                    if (!lookupTable[id].exportsWithDuplicate) {\n                        lookupTable[id].exportsWithDuplicate = [exportNode];\n                    }\n                    else {\n                        lookupTable[id].exportsWithDuplicate.push(exportNode);\n                    }\n                }\n            }\n        }\n        function getExportsForModule(moduleSymbol) {\n            var visitedSymbols = [];\n            // A module defined by an 'export=' consists on one export that needs to be resolved\n            moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);\n            return visit(moduleSymbol) || moduleSymbol.exports;\n            // The ES6 spec permits export * declarations in a module to circularly reference the module itself. For example,\n            // module 'a' can 'export * from \"b\"' and 'b' can 'export * from \"a\"' without error.\n            function visit(symbol) {\n                if (!(symbol && symbol.flags & 1952 /* HasExports */ && !ts.contains(visitedSymbols, symbol))) {\n                    return;\n                }\n                visitedSymbols.push(symbol);\n                var symbols = ts.cloneMap(symbol.exports);\n                // All export * declarations are collected in an __export symbol by the binder\n                var exportStars = symbol.exports[\"__export\"];\n                if (exportStars) {\n                    var nestedSymbols = ts.createMap();\n                    var lookupTable = ts.createMap();\n                    for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) {\n                        var node = _a[_i];\n                        var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);\n                        var exportedSymbols = visit(resolvedModule);\n                        extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node);\n                    }\n                    for (var id in lookupTable) {\n                        var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate;\n                        // It's not an error if the file with multiple `export *`s with duplicate names exports a member with that name itself\n                        if (id === \"export=\" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols[id]) {\n                            continue;\n                        }\n                        for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) {\n                            var node = exportsWithDuplicate_1[_b];\n                            diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id));\n                        }\n                    }\n                    extendExportSymbols(symbols, nestedSymbols);\n                }\n                return symbols;\n            }\n        }\n        function getMergedSymbol(symbol) {\n            var merged;\n            return symbol && symbol.mergeId && (merged = mergedSymbols[symbol.mergeId]) ? merged : symbol;\n        }\n        function getSymbolOfNode(node) {\n            return getMergedSymbol(node.symbol);\n        }\n        function getParentOfSymbol(symbol) {\n            return getMergedSymbol(symbol.parent);\n        }\n        function getExportSymbolOfValueSymbolIfExported(symbol) {\n            return symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0\n                ? getMergedSymbol(symbol.exportSymbol)\n                : symbol;\n        }\n        function symbolIsValue(symbol) {\n            // If it is an instantiated symbol, then it is a value if the symbol it is an\n            // instantiation of is a value.\n            if (symbol.flags & 16777216 /* Instantiated */) {\n                return symbolIsValue(getSymbolLinks(symbol).target);\n            }\n            // If the symbol has the value flag, it is trivially a value.\n            if (symbol.flags & 107455 /* Value */) {\n                return true;\n            }\n            // If it is an alias, then it is a value if the symbol it resolves to is a value.\n            if (symbol.flags & 8388608 /* Alias */) {\n                return (resolveAlias(symbol).flags & 107455 /* Value */) !== 0;\n            }\n            return false;\n        }\n        function findConstructorDeclaration(node) {\n            var members = node.members;\n            for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {\n                var member = members_1[_i];\n                if (member.kind === 150 /* Constructor */ && ts.nodeIsPresent(member.body)) {\n                    return member;\n                }\n            }\n        }\n        function createType(flags) {\n            var result = new Type(checker, flags);\n            typeCount++;\n            result.id = typeCount;\n            return result;\n        }\n        function createIntrinsicType(kind, intrinsicName) {\n            var type = createType(kind);\n            type.intrinsicName = intrinsicName;\n            return type;\n        }\n        function createBooleanType(trueFalseTypes) {\n            var type = getUnionType(trueFalseTypes);\n            type.flags |= 8 /* Boolean */;\n            type.intrinsicName = \"boolean\";\n            return type;\n        }\n        function createObjectType(objectFlags, symbol) {\n            var type = createType(32768 /* Object */);\n            type.objectFlags = objectFlags;\n            type.symbol = symbol;\n            return type;\n        }\n        // A reserved member name starts with two underscores, but the third character cannot be an underscore\n        // or the @ symbol. A third underscore indicates an escaped form of an identifer that started\n        // with at least two underscores. The @ character indicates that the name is denoted by a well known ES\n        // Symbol instance.\n        function isReservedMemberName(name) {\n            return name.charCodeAt(0) === 95 /* _ */ &&\n                name.charCodeAt(1) === 95 /* _ */ &&\n                name.charCodeAt(2) !== 95 /* _ */ &&\n                name.charCodeAt(2) !== 64 /* at */;\n        }\n        function getNamedMembers(members) {\n            var result;\n            for (var id in members) {\n                if (!isReservedMemberName(id)) {\n                    if (!result)\n                        result = [];\n                    var symbol = members[id];\n                    if (symbolIsValue(symbol)) {\n                        result.push(symbol);\n                    }\n                }\n            }\n            return result || emptyArray;\n        }\n        function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) {\n            type.members = members;\n            type.properties = getNamedMembers(members);\n            type.callSignatures = callSignatures;\n            type.constructSignatures = constructSignatures;\n            if (stringIndexInfo)\n                type.stringIndexInfo = stringIndexInfo;\n            if (numberIndexInfo)\n                type.numberIndexInfo = numberIndexInfo;\n            return type;\n        }\n        function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) {\n            return setStructuredTypeMembers(createObjectType(16 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n        }\n        function forEachSymbolTableInScope(enclosingDeclaration, callback) {\n            var result;\n            for (var location_1 = enclosingDeclaration; location_1; location_1 = location_1.parent) {\n                // Locals of a source file are not in scope (because they get merged into the global symbol table)\n                if (location_1.locals && !isGlobalSourceFile(location_1)) {\n                    if (result = callback(location_1.locals)) {\n                        return result;\n                    }\n                }\n                switch (location_1.kind) {\n                    case 261 /* SourceFile */:\n                        if (!ts.isExternalOrCommonJsModule(location_1)) {\n                            break;\n                        }\n                    case 230 /* ModuleDeclaration */:\n                        if (result = callback(getSymbolOfNode(location_1).exports)) {\n                            return result;\n                        }\n                        break;\n                }\n            }\n            return callback(globals);\n        }\n        function getQualifiedLeftMeaning(rightMeaning) {\n            // If we are looking in value space, the parent meaning is value, other wise it is namespace\n            return rightMeaning === 107455 /* Value */ ? 107455 /* Value */ : 1920 /* Namespace */;\n        }\n        function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) {\n            function getAccessibleSymbolChainFromSymbolTable(symbols) {\n                function canQualifySymbol(symbolFromSymbolTable, meaning) {\n                    // If the symbol is equivalent and doesn't need further qualification, this symbol is accessible\n                    if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) {\n                        return true;\n                    }\n                    // If symbol needs qualification, make sure that parent is accessible, if it is then this symbol is accessible too\n                    var accessibleParent = getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning), useOnlyExternalAliasing);\n                    return !!accessibleParent;\n                }\n                function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) {\n                    if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) {\n                        // if the symbolFromSymbolTable is not external module (it could be if it was determined as ambient external module and would be in globals table)\n                        // and if symbolFromSymbolTable or alias resolution matches the symbol,\n                        // check the symbol can be qualified, it is only then this symbol is accessible\n                        return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) &&\n                            canQualifySymbol(symbolFromSymbolTable, meaning);\n                    }\n                }\n                // If symbol is directly available by its name in the symbol table\n                if (isAccessible(symbols[symbol.name])) {\n                    return [symbol];\n                }\n                // Check if symbol is any of the alias\n                return ts.forEachProperty(symbols, function (symbolFromSymbolTable) {\n                    if (symbolFromSymbolTable.flags & 8388608 /* Alias */\n                        && symbolFromSymbolTable.name !== \"export=\"\n                        && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243 /* ExportSpecifier */)) {\n                        if (!useOnlyExternalAliasing ||\n                            // Is this external alias, then use it to name\n                            ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) {\n                            var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);\n                            if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) {\n                                return [symbolFromSymbolTable];\n                            }\n                            // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain\n                            // but only if the symbolFromSymbolTable can be qualified\n                            var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined;\n                            if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) {\n                                return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports);\n                            }\n                        }\n                    }\n                });\n            }\n            if (symbol) {\n                if (!(isPropertyOrMethodDeclarationSymbol(symbol))) {\n                    return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable);\n                }\n            }\n        }\n        function needsQualification(symbol, enclosingDeclaration, meaning) {\n            var qualify = false;\n            forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) {\n                // If symbol of this name is not available in the symbol table we are ok\n                var symbolFromSymbolTable = symbolTable[symbol.name];\n                if (!symbolFromSymbolTable) {\n                    // Continue to the next symbol table\n                    return false;\n                }\n                // If the symbol with this name is present it should refer to the symbol\n                if (symbolFromSymbolTable === symbol) {\n                    // No need to qualify\n                    return true;\n                }\n                // Qualify if the symbol from symbol table has same meaning as expected\n                symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;\n                if (symbolFromSymbolTable.flags & meaning) {\n                    qualify = true;\n                    return true;\n                }\n                // Continue to the next symbol table\n                return false;\n            });\n            return qualify;\n        }\n        function isPropertyOrMethodDeclarationSymbol(symbol) {\n            if (symbol.declarations && symbol.declarations.length) {\n                for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                    var declaration = _a[_i];\n                    switch (declaration.kind) {\n                        case 147 /* PropertyDeclaration */:\n                        case 149 /* MethodDeclaration */:\n                        case 151 /* GetAccessor */:\n                        case 152 /* SetAccessor */:\n                            continue;\n                        default:\n                            return false;\n                    }\n                }\n                return true;\n            }\n            return false;\n        }\n        /**\n         * Check if the given symbol in given enclosing declaration is accessible and mark all associated alias to be visible if requested\n         *\n         * @param symbol a Symbol to check if accessible\n         * @param enclosingDeclaration a Node containing reference to the symbol\n         * @param meaning a SymbolFlags to check if such meaning of the symbol is accessible\n         * @param shouldComputeAliasToMakeVisible a boolean value to indicate whether to return aliases to be mark visible in case the symbol is accessible\n         */\n        function isSymbolAccessible(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible) {\n            if (symbol && enclosingDeclaration && !(symbol.flags & 262144 /* TypeParameter */)) {\n                var initialSymbol = symbol;\n                var meaningToLook = meaning;\n                while (symbol) {\n                    // Symbol is accessible if it by itself is accessible\n                    var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, /*useOnlyExternalAliasing*/ false);\n                    if (accessibleSymbolChain) {\n                        var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0], shouldComputeAliasesToMakeVisible);\n                        if (!hasAccessibleDeclarations) {\n                            return {\n                                accessibility: 1 /* NotAccessible */,\n                                errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),\n                                errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, 1920 /* Namespace */) : undefined,\n                            };\n                        }\n                        return hasAccessibleDeclarations;\n                    }\n                    // If we haven't got the accessible symbol, it doesn't mean the symbol is actually inaccessible.\n                    // It could be a qualified symbol and hence verify the path\n                    // e.g.:\n                    // module m {\n                    //     export class c {\n                    //     }\n                    // }\n                    // const x: typeof m.c\n                    // In the above example when we start with checking if typeof m.c symbol is accessible,\n                    // we are going to see if c can be accessed in scope directly.\n                    // But it can't, hence the accessible is going to be undefined, but that doesn't mean m.c is inaccessible\n                    // It is accessible if the parent m is accessible because then m.c can be accessed through qualification\n                    meaningToLook = getQualifiedLeftMeaning(meaning);\n                    symbol = getParentOfSymbol(symbol);\n                }\n                // This could be a symbol that is not exported in the external module\n                // or it could be a symbol from different external module that is not aliased and hence cannot be named\n                var symbolExternalModule = ts.forEach(initialSymbol.declarations, getExternalModuleContainer);\n                if (symbolExternalModule) {\n                    var enclosingExternalModule = getExternalModuleContainer(enclosingDeclaration);\n                    if (symbolExternalModule !== enclosingExternalModule) {\n                        // name from different external module that is not visible\n                        return {\n                            accessibility: 2 /* CannotBeNamed */,\n                            errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),\n                            errorModuleName: symbolToString(symbolExternalModule)\n                        };\n                    }\n                }\n                // Just a local name that is not accessible\n                return {\n                    accessibility: 1 /* NotAccessible */,\n                    errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),\n                };\n            }\n            return { accessibility: 0 /* Accessible */ };\n            function getExternalModuleContainer(declaration) {\n                for (; declaration; declaration = declaration.parent) {\n                    if (hasExternalModuleSymbol(declaration)) {\n                        return getSymbolOfNode(declaration);\n                    }\n                }\n            }\n        }\n        function hasExternalModuleSymbol(declaration) {\n            return ts.isAmbientModule(declaration) || (declaration.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));\n        }\n        function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {\n            var aliasesToMakeVisible;\n            if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) {\n                return undefined;\n            }\n            return { accessibility: 0 /* Accessible */, aliasesToMakeVisible: aliasesToMakeVisible };\n            function getIsDeclarationVisible(declaration) {\n                if (!isDeclarationVisible(declaration)) {\n                    // Mark the unexported alias as visible if its parent is visible\n                    // because these kind of aliases can be used to name types in declaration file\n                    var anyImportSyntax = getAnyImportSyntax(declaration);\n                    if (anyImportSyntax &&\n                        !(ts.getModifierFlags(anyImportSyntax) & 1 /* Export */) &&\n                        isDeclarationVisible(anyImportSyntax.parent)) {\n                        // In function \"buildTypeDisplay\" where we decide whether to write type-alias or serialize types,\n                        // we want to just check if type- alias is accessible or not but we don't care about emitting those alias at that time\n                        // since we will do the emitting later in trackSymbol.\n                        if (shouldComputeAliasToMakeVisible) {\n                            getNodeLinks(declaration).isVisible = true;\n                            if (aliasesToMakeVisible) {\n                                if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) {\n                                    aliasesToMakeVisible.push(anyImportSyntax);\n                                }\n                            }\n                            else {\n                                aliasesToMakeVisible = [anyImportSyntax];\n                            }\n                        }\n                        return true;\n                    }\n                    // Declaration is not visible\n                    return false;\n                }\n                return true;\n            }\n        }\n        function isEntityNameVisible(entityName, enclosingDeclaration) {\n            // get symbol of the first identifier of the entityName\n            var meaning;\n            if (entityName.parent.kind === 160 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {\n                // Typeof value\n                meaning = 107455 /* Value */ | 1048576 /* ExportValue */;\n            }\n            else if (entityName.kind === 141 /* QualifiedName */ || entityName.kind === 177 /* PropertyAccessExpression */ ||\n                entityName.parent.kind === 234 /* ImportEqualsDeclaration */) {\n                // Left identifier from type reference or TypeAlias\n                // Entity name of the import declaration\n                meaning = 1920 /* Namespace */;\n            }\n            else {\n                // Type Reference or TypeAlias entity = Identifier\n                meaning = 793064 /* Type */;\n            }\n            var firstIdentifier = getFirstIdentifier(entityName);\n            var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined);\n            // Verify if the symbol is accessible\n            return (symbol && hasVisibleDeclarations(symbol, /*shouldComputeAliasToMakeVisible*/ true)) || {\n                accessibility: 1 /* NotAccessible */,\n                errorSymbolName: ts.getTextOfNode(firstIdentifier),\n                errorNode: firstIdentifier\n            };\n        }\n        function writeKeyword(writer, kind) {\n            writer.writeKeyword(ts.tokenToString(kind));\n        }\n        function writePunctuation(writer, kind) {\n            writer.writePunctuation(ts.tokenToString(kind));\n        }\n        function writeSpace(writer) {\n            writer.writeSpace(\" \");\n        }\n        function symbolToString(symbol, enclosingDeclaration, meaning) {\n            var writer = ts.getSingleLineStringWriter();\n            getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning);\n            var result = writer.string();\n            ts.releaseStringWriter(writer);\n            return result;\n        }\n        function signatureToString(signature, enclosingDeclaration, flags, kind) {\n            var writer = ts.getSingleLineStringWriter();\n            getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind);\n            var result = writer.string();\n            ts.releaseStringWriter(writer);\n            return result;\n        }\n        function typeToString(type, enclosingDeclaration, flags) {\n            var writer = ts.getSingleLineStringWriter();\n            getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);\n            var result = writer.string();\n            ts.releaseStringWriter(writer);\n            var maxLength = compilerOptions.noErrorTruncation || flags & 4 /* NoTruncation */ ? undefined : 100;\n            if (maxLength && result.length >= maxLength) {\n                result = result.substr(0, maxLength - \"...\".length) + \"...\";\n            }\n            return result;\n        }\n        function typePredicateToString(typePredicate, enclosingDeclaration, flags) {\n            var writer = ts.getSingleLineStringWriter();\n            getSymbolDisplayBuilder().buildTypePredicateDisplay(typePredicate, writer, enclosingDeclaration, flags);\n            var result = writer.string();\n            ts.releaseStringWriter(writer);\n            return result;\n        }\n        function formatUnionTypes(types) {\n            var result = [];\n            var flags = 0;\n            for (var i = 0; i < types.length; i++) {\n                var t = types[i];\n                flags |= t.flags;\n                if (!(t.flags & 6144 /* Nullable */)) {\n                    if (t.flags & (128 /* BooleanLiteral */ | 256 /* EnumLiteral */)) {\n                        var baseType = t.flags & 128 /* BooleanLiteral */ ? booleanType : t.baseType;\n                        var count = baseType.types.length;\n                        if (i + count <= types.length && types[i + count - 1] === baseType.types[count - 1]) {\n                            result.push(baseType);\n                            i += count - 1;\n                            continue;\n                        }\n                    }\n                    result.push(t);\n                }\n            }\n            if (flags & 4096 /* Null */)\n                result.push(nullType);\n            if (flags & 2048 /* Undefined */)\n                result.push(undefinedType);\n            return result || types;\n        }\n        function visibilityToString(flags) {\n            if (flags === 8 /* Private */) {\n                return \"private\";\n            }\n            if (flags === 16 /* Protected */) {\n                return \"protected\";\n            }\n            return \"public\";\n        }\n        function getTypeAliasForTypeLiteral(type) {\n            if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) {\n                var node = type.symbol.declarations[0].parent;\n                while (node.kind === 166 /* ParenthesizedType */) {\n                    node = node.parent;\n                }\n                if (node.kind === 228 /* TypeAliasDeclaration */) {\n                    return getSymbolOfNode(node);\n                }\n            }\n            return undefined;\n        }\n        function isTopLevelInExternalModuleAugmentation(node) {\n            return node && node.parent &&\n                node.parent.kind === 231 /* ModuleBlock */ &&\n                ts.isExternalModuleAugmentation(node.parent.parent);\n        }\n        function literalTypeToString(type) {\n            return type.flags & 32 /* StringLiteral */ ? \"\\\"\" + ts.escapeString(type.text) + \"\\\"\" : type.text;\n        }\n        function getSymbolDisplayBuilder() {\n            function getNameOfSymbol(symbol) {\n                if (symbol.declarations && symbol.declarations.length) {\n                    var declaration = symbol.declarations[0];\n                    if (declaration.name) {\n                        return ts.declarationNameToString(declaration.name);\n                    }\n                    switch (declaration.kind) {\n                        case 197 /* ClassExpression */:\n                            return \"(Anonymous class)\";\n                        case 184 /* FunctionExpression */:\n                        case 185 /* ArrowFunction */:\n                            return \"(Anonymous function)\";\n                    }\n                }\n                return symbol.name;\n            }\n            /**\n             * Writes only the name of the symbol out to the writer. Uses the original source text\n             * for the name of the symbol if it is available to match how the user wrote the name.\n             */\n            function appendSymbolNameOnly(symbol, writer) {\n                writer.writeSymbol(getNameOfSymbol(symbol), symbol);\n            }\n            /**\n             * Writes a property access or element access with the name of the symbol out to the writer.\n             * Uses the original source text for the name of the symbol if it is available to match how the user wrote the name,\n             * ensuring that any names written with literals use element accesses.\n             */\n            function appendPropertyOrElementAccessForSymbol(symbol, writer) {\n                var symbolName = getNameOfSymbol(symbol);\n                var firstChar = symbolName.charCodeAt(0);\n                var needsElementAccess = !ts.isIdentifierStart(firstChar, languageVersion);\n                if (needsElementAccess) {\n                    writePunctuation(writer, 20 /* OpenBracketToken */);\n                    if (ts.isSingleOrDoubleQuote(firstChar)) {\n                        writer.writeStringLiteral(symbolName);\n                    }\n                    else {\n                        writer.writeSymbol(symbolName, symbol);\n                    }\n                    writePunctuation(writer, 21 /* CloseBracketToken */);\n                }\n                else {\n                    writePunctuation(writer, 22 /* DotToken */);\n                    writer.writeSymbol(symbolName, symbol);\n                }\n            }\n            /**\n             * Enclosing declaration is optional when we don't want to get qualified name in the enclosing declaration scope\n             * Meaning needs to be specified if the enclosing declaration is given\n             */\n            function buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags, typeFlags) {\n                var parentSymbol;\n                function appendParentTypeArgumentsAndSymbolName(symbol) {\n                    if (parentSymbol) {\n                        // Write type arguments of instantiated class/interface here\n                        if (flags & 1 /* WriteTypeParametersOrArguments */) {\n                            if (symbol.flags & 16777216 /* Instantiated */) {\n                                buildDisplayForTypeArgumentsAndDelimiters(getTypeParametersOfClassOrInterface(parentSymbol), symbol.mapper, writer, enclosingDeclaration);\n                            }\n                            else {\n                                buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration);\n                            }\n                        }\n                        appendPropertyOrElementAccessForSymbol(symbol, writer);\n                    }\n                    else {\n                        appendSymbolNameOnly(symbol, writer);\n                    }\n                    parentSymbol = symbol;\n                }\n                // Let the writer know we just wrote out a symbol.  The declaration emitter writer uses\n                // this to determine if an import it has previously seen (and not written out) needs\n                // to be written to the file once the walk of the tree is complete.\n                //\n                // NOTE(cyrusn): This approach feels somewhat unfortunate.  A simple pass over the tree\n                // up front (for example, during checking) could determine if we need to emit the imports\n                // and we could then access that data during declaration emit.\n                writer.trackSymbol(symbol, enclosingDeclaration, meaning);\n                /** @param endOfChain Set to false for recursive calls; non-recursive calls should always output something. */\n                function walkSymbol(symbol, meaning, endOfChain) {\n                    var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2 /* UseOnlyExternalAliasing */));\n                    if (!accessibleSymbolChain ||\n                        needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) {\n                        // Go up and add our parent.\n                        var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);\n                        if (parent_5) {\n                            walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false);\n                        }\n                    }\n                    if (accessibleSymbolChain) {\n                        for (var _i = 0, accessibleSymbolChain_1 = accessibleSymbolChain; _i < accessibleSymbolChain_1.length; _i++) {\n                            var accessibleSymbol = accessibleSymbolChain_1[_i];\n                            appendParentTypeArgumentsAndSymbolName(accessibleSymbol);\n                        }\n                    }\n                    else if (\n                    // If this is the last part of outputting the symbol, always output. The cases apply only to parent symbols.\n                    endOfChain ||\n                        // If a parent symbol is an external module, don't write it. (We prefer just `x` vs `\"foo/bar\".x`.)\n                        !(!parentSymbol && ts.forEach(symbol.declarations, hasExternalModuleSymbol)) &&\n                            // If a parent symbol is an anonymous type, don't write it.\n                            !(symbol.flags & (2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */))) {\n                        appendParentTypeArgumentsAndSymbolName(symbol);\n                    }\n                }\n                // Get qualified name if the symbol is not a type parameter\n                // and there is an enclosing declaration or we specifically\n                // asked for it\n                var isTypeParameter = symbol.flags & 262144 /* TypeParameter */;\n                var typeFormatFlag = 128 /* UseFullyQualifiedType */ & typeFlags;\n                if (!isTypeParameter && (enclosingDeclaration || typeFormatFlag)) {\n                    walkSymbol(symbol, meaning, /*endOfChain*/ true);\n                }\n                else {\n                    appendParentTypeArgumentsAndSymbolName(symbol);\n                }\n            }\n            function buildTypeDisplay(type, writer, enclosingDeclaration, globalFlags, symbolStack) {\n                var globalFlagsToPass = globalFlags & 16 /* WriteOwnNameForAnyLike */;\n                var inObjectTypeLiteral = false;\n                return writeType(type, globalFlags);\n                function writeType(type, flags) {\n                    var nextFlags = flags & ~512 /* InTypeAlias */;\n                    // Write undefined/null type as any\n                    if (type.flags & 16015 /* Intrinsic */) {\n                        // Special handling for unknown / resolving types, they should show up as any and not unknown or __resolving\n                        writer.writeKeyword(!(globalFlags & 16 /* WriteOwnNameForAnyLike */) && isTypeAny(type)\n                            ? \"any\"\n                            : type.intrinsicName);\n                    }\n                    else if (type.flags & 16384 /* TypeParameter */ && type.isThisType) {\n                        if (inObjectTypeLiteral) {\n                            writer.reportInaccessibleThisError();\n                        }\n                        writer.writeKeyword(\"this\");\n                    }\n                    else if (getObjectFlags(type) & 4 /* Reference */) {\n                        writeTypeReference(type, nextFlags);\n                    }\n                    else if (type.flags & 256 /* EnumLiteral */) {\n                        buildSymbolDisplay(getParentOfSymbol(type.symbol), writer, enclosingDeclaration, 793064 /* Type */, 0 /* None */, nextFlags);\n                        writePunctuation(writer, 22 /* DotToken */);\n                        appendSymbolNameOnly(type.symbol, writer);\n                    }\n                    else if (getObjectFlags(type) & 3 /* ClassOrInterface */ || type.flags & (16 /* Enum */ | 16384 /* TypeParameter */)) {\n                        // The specified symbol flags need to be reinterpreted as type flags\n                        buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793064 /* Type */, 0 /* None */, nextFlags);\n                    }\n                    else if (!(flags & 512 /* InTypeAlias */) && type.aliasSymbol &&\n                        isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, 793064 /* Type */, /*shouldComputeAliasesToMakeVisible*/ false).accessibility === 0 /* Accessible */) {\n                        var typeArguments = type.aliasTypeArguments;\n                        writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);\n                    }\n                    else if (type.flags & 196608 /* UnionOrIntersection */) {\n                        writeUnionOrIntersectionType(type, nextFlags);\n                    }\n                    else if (getObjectFlags(type) & (16 /* Anonymous */ | 32 /* Mapped */)) {\n                        writeAnonymousType(type, nextFlags);\n                    }\n                    else if (type.flags & 96 /* StringOrNumberLiteral */) {\n                        writer.writeStringLiteral(literalTypeToString(type));\n                    }\n                    else if (type.flags & 262144 /* Index */) {\n                        writer.writeKeyword(\"keyof\");\n                        writeSpace(writer);\n                        writeType(type.type, 64 /* InElementType */);\n                    }\n                    else if (type.flags & 524288 /* IndexedAccess */) {\n                        writeType(type.objectType, 64 /* InElementType */);\n                        writePunctuation(writer, 20 /* OpenBracketToken */);\n                        writeType(type.indexType, 0 /* None */);\n                        writePunctuation(writer, 21 /* CloseBracketToken */);\n                    }\n                    else {\n                        // Should never get here\n                        // { ... }\n                        writePunctuation(writer, 16 /* OpenBraceToken */);\n                        writeSpace(writer);\n                        writePunctuation(writer, 23 /* DotDotDotToken */);\n                        writeSpace(writer);\n                        writePunctuation(writer, 17 /* CloseBraceToken */);\n                    }\n                }\n                function writeTypeList(types, delimiter) {\n                    for (var i = 0; i < types.length; i++) {\n                        if (i > 0) {\n                            if (delimiter !== 25 /* CommaToken */) {\n                                writeSpace(writer);\n                            }\n                            writePunctuation(writer, delimiter);\n                            writeSpace(writer);\n                        }\n                        writeType(types[i], delimiter === 25 /* CommaToken */ ? 0 /* None */ : 64 /* InElementType */);\n                    }\n                }\n                function writeSymbolTypeReference(symbol, typeArguments, pos, end, flags) {\n                    // Unnamed function expressions and arrow functions have reserved names that we don't want to display\n                    if (symbol.flags & 32 /* Class */ || !isReservedMemberName(symbol.name)) {\n                        buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793064 /* Type */, 0 /* None */, flags);\n                    }\n                    if (pos < end) {\n                        writePunctuation(writer, 26 /* LessThanToken */);\n                        writeType(typeArguments[pos], 256 /* InFirstTypeArgument */);\n                        pos++;\n                        while (pos < end) {\n                            writePunctuation(writer, 25 /* CommaToken */);\n                            writeSpace(writer);\n                            writeType(typeArguments[pos], 0 /* None */);\n                            pos++;\n                        }\n                        writePunctuation(writer, 28 /* GreaterThanToken */);\n                    }\n                }\n                function writeTypeReference(type, flags) {\n                    var typeArguments = type.typeArguments || emptyArray;\n                    if (type.target === globalArrayType && !(flags & 1 /* WriteArrayAsGenericType */)) {\n                        writeType(typeArguments[0], 64 /* InElementType */);\n                        writePunctuation(writer, 20 /* OpenBracketToken */);\n                        writePunctuation(writer, 21 /* CloseBracketToken */);\n                    }\n                    else if (type.target.objectFlags & 8 /* Tuple */) {\n                        writePunctuation(writer, 20 /* OpenBracketToken */);\n                        writeTypeList(type.typeArguments.slice(0, getTypeReferenceArity(type)), 25 /* CommaToken */);\n                        writePunctuation(writer, 21 /* CloseBracketToken */);\n                    }\n                    else {\n                        // Write the type reference in the format f<A>.g<B>.C<X, Y> where A and B are type arguments\n                        // for outer type parameters, and f and g are the respective declaring containers of those\n                        // type parameters.\n                        var outerTypeParameters = type.target.outerTypeParameters;\n                        var i = 0;\n                        if (outerTypeParameters) {\n                            var length_1 = outerTypeParameters.length;\n                            while (i < length_1) {\n                                // Find group of type arguments for type parameters with the same declaring container.\n                                var start = i;\n                                var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]);\n                                do {\n                                    i++;\n                                } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6);\n                                // When type parameters are their own type arguments for the whole group (i.e. we have\n                                // the default outer type arguments), we don't show the group.\n                                if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) {\n                                    writeSymbolTypeReference(parent_6, typeArguments, start, i, flags);\n                                    writePunctuation(writer, 22 /* DotToken */);\n                                }\n                            }\n                        }\n                        var typeParameterCount = (type.target.typeParameters || emptyArray).length;\n                        writeSymbolTypeReference(type.symbol, typeArguments, i, typeParameterCount, flags);\n                    }\n                }\n                function writeUnionOrIntersectionType(type, flags) {\n                    if (flags & 64 /* InElementType */) {\n                        writePunctuation(writer, 18 /* OpenParenToken */);\n                    }\n                    if (type.flags & 65536 /* Union */) {\n                        writeTypeList(formatUnionTypes(type.types), 48 /* BarToken */);\n                    }\n                    else {\n                        writeTypeList(type.types, 47 /* AmpersandToken */);\n                    }\n                    if (flags & 64 /* InElementType */) {\n                        writePunctuation(writer, 19 /* CloseParenToken */);\n                    }\n                }\n                function writeAnonymousType(type, flags) {\n                    var symbol = type.symbol;\n                    if (symbol) {\n                        // Always use 'typeof T' for type of class, enum, and module objects\n                        if (symbol.flags & (32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) {\n                            writeTypeOfSymbol(type, flags);\n                        }\n                        else if (shouldWriteTypeOfFunctionSymbol()) {\n                            writeTypeOfSymbol(type, flags);\n                        }\n                        else if (ts.contains(symbolStack, symbol)) {\n                            // If type is an anonymous type literal in a type alias declaration, use type alias name\n                            var typeAlias = getTypeAliasForTypeLiteral(type);\n                            if (typeAlias) {\n                                // The specified symbol flags need to be reinterpreted as type flags\n                                buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 793064 /* Type */, 0 /* None */, flags);\n                            }\n                            else {\n                                // Recursive usage, use any\n                                writeKeyword(writer, 118 /* AnyKeyword */);\n                            }\n                        }\n                        else {\n                            // Since instantiations of the same anonymous type have the same symbol, tracking symbols instead\n                            // of types allows us to catch circular references to instantiations of the same anonymous type\n                            if (!symbolStack) {\n                                symbolStack = [];\n                            }\n                            symbolStack.push(symbol);\n                            writeLiteralType(type, flags);\n                            symbolStack.pop();\n                        }\n                    }\n                    else {\n                        // Anonymous types with no symbol are never circular\n                        writeLiteralType(type, flags);\n                    }\n                    function shouldWriteTypeOfFunctionSymbol() {\n                        var isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */ &&\n                            ts.forEach(symbol.declarations, function (declaration) { return ts.getModifierFlags(declaration) & 32 /* Static */; }));\n                        var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) &&\n                            (symbol.parent ||\n                                ts.forEach(symbol.declarations, function (declaration) {\n                                    return declaration.parent.kind === 261 /* SourceFile */ || declaration.parent.kind === 231 /* ModuleBlock */;\n                                }));\n                        if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {\n                            // typeof is allowed only for static/non local functions\n                            return !!(flags & 2 /* UseTypeOfFunction */) ||\n                                (ts.contains(symbolStack, symbol)); // it is type of the symbol uses itself recursively\n                        }\n                    }\n                }\n                function writeTypeOfSymbol(type, typeFormatFlags) {\n                    writeKeyword(writer, 102 /* TypeOfKeyword */);\n                    writeSpace(writer);\n                    buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455 /* Value */, 0 /* None */, typeFormatFlags);\n                }\n                function writeIndexSignature(info, keyword) {\n                    if (info) {\n                        if (info.isReadonly) {\n                            writeKeyword(writer, 130 /* ReadonlyKeyword */);\n                            writeSpace(writer);\n                        }\n                        writePunctuation(writer, 20 /* OpenBracketToken */);\n                        writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : \"x\");\n                        writePunctuation(writer, 55 /* ColonToken */);\n                        writeSpace(writer);\n                        writeKeyword(writer, keyword);\n                        writePunctuation(writer, 21 /* CloseBracketToken */);\n                        writePunctuation(writer, 55 /* ColonToken */);\n                        writeSpace(writer);\n                        writeType(info.type, 0 /* None */);\n                        writePunctuation(writer, 24 /* SemicolonToken */);\n                        writer.writeLine();\n                    }\n                }\n                function writePropertyWithModifiers(prop) {\n                    if (isReadonlySymbol(prop)) {\n                        writeKeyword(writer, 130 /* ReadonlyKeyword */);\n                        writeSpace(writer);\n                    }\n                    buildSymbolDisplay(prop, writer);\n                    if (prop.flags & 536870912 /* Optional */) {\n                        writePunctuation(writer, 54 /* QuestionToken */);\n                    }\n                }\n                function shouldAddParenthesisAroundFunctionType(callSignature, flags) {\n                    if (flags & 64 /* InElementType */) {\n                        return true;\n                    }\n                    else if (flags & 256 /* InFirstTypeArgument */) {\n                        // Add parenthesis around function type for the first type argument to avoid ambiguity\n                        var typeParameters = callSignature.target && (flags & 32 /* WriteTypeArgumentsOfSignature */) ?\n                            callSignature.target.typeParameters : callSignature.typeParameters;\n                        return typeParameters && typeParameters.length !== 0;\n                    }\n                    return false;\n                }\n                function writeLiteralType(type, flags) {\n                    if (type.objectFlags & 32 /* Mapped */) {\n                        if (getConstraintTypeFromMappedType(type).flags & (16384 /* TypeParameter */ | 262144 /* Index */)) {\n                            writeMappedType(type);\n                            return;\n                        }\n                    }\n                    var resolved = resolveStructuredTypeMembers(type);\n                    if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {\n                        if (!resolved.callSignatures.length && !resolved.constructSignatures.length) {\n                            writePunctuation(writer, 16 /* OpenBraceToken */);\n                            writePunctuation(writer, 17 /* CloseBraceToken */);\n                            return;\n                        }\n                        if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) {\n                            var parenthesizeSignature = shouldAddParenthesisAroundFunctionType(resolved.callSignatures[0], flags);\n                            if (parenthesizeSignature) {\n                                writePunctuation(writer, 18 /* OpenParenToken */);\n                            }\n                            buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, /*kind*/ undefined, symbolStack);\n                            if (parenthesizeSignature) {\n                                writePunctuation(writer, 19 /* CloseParenToken */);\n                            }\n                            return;\n                        }\n                        if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) {\n                            if (flags & 64 /* InElementType */) {\n                                writePunctuation(writer, 18 /* OpenParenToken */);\n                            }\n                            writeKeyword(writer, 93 /* NewKeyword */);\n                            writeSpace(writer);\n                            buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, /*kind*/ undefined, symbolStack);\n                            if (flags & 64 /* InElementType */) {\n                                writePunctuation(writer, 19 /* CloseParenToken */);\n                            }\n                            return;\n                        }\n                    }\n                    var saveInObjectTypeLiteral = inObjectTypeLiteral;\n                    inObjectTypeLiteral = true;\n                    writePunctuation(writer, 16 /* OpenBraceToken */);\n                    writer.writeLine();\n                    writer.increaseIndent();\n                    writeObjectLiteralType(resolved);\n                    writer.decreaseIndent();\n                    writePunctuation(writer, 17 /* CloseBraceToken */);\n                    inObjectTypeLiteral = saveInObjectTypeLiteral;\n                }\n                function writeObjectLiteralType(resolved) {\n                    for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) {\n                        var signature = _a[_i];\n                        buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack);\n                        writePunctuation(writer, 24 /* SemicolonToken */);\n                        writer.writeLine();\n                    }\n                    for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) {\n                        var signature = _c[_b];\n                        buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, 1 /* Construct */, symbolStack);\n                        writePunctuation(writer, 24 /* SemicolonToken */);\n                        writer.writeLine();\n                    }\n                    writeIndexSignature(resolved.stringIndexInfo, 134 /* StringKeyword */);\n                    writeIndexSignature(resolved.numberIndexInfo, 132 /* NumberKeyword */);\n                    for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) {\n                        var p = _e[_d];\n                        var t = getTypeOfSymbol(p);\n                        if (p.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(t).length) {\n                            var signatures = getSignaturesOfType(t, 0 /* Call */);\n                            for (var _f = 0, signatures_1 = signatures; _f < signatures_1.length; _f++) {\n                                var signature = signatures_1[_f];\n                                writePropertyWithModifiers(p);\n                                buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack);\n                                writePunctuation(writer, 24 /* SemicolonToken */);\n                                writer.writeLine();\n                            }\n                        }\n                        else {\n                            writePropertyWithModifiers(p);\n                            writePunctuation(writer, 55 /* ColonToken */);\n                            writeSpace(writer);\n                            writeType(t, 0 /* None */);\n                            writePunctuation(writer, 24 /* SemicolonToken */);\n                            writer.writeLine();\n                        }\n                    }\n                }\n                function writeMappedType(type) {\n                    writePunctuation(writer, 16 /* OpenBraceToken */);\n                    writer.writeLine();\n                    writer.increaseIndent();\n                    if (type.declaration.readonlyToken) {\n                        writeKeyword(writer, 130 /* ReadonlyKeyword */);\n                        writeSpace(writer);\n                    }\n                    writePunctuation(writer, 20 /* OpenBracketToken */);\n                    appendSymbolNameOnly(getTypeParameterFromMappedType(type).symbol, writer);\n                    writeSpace(writer);\n                    writeKeyword(writer, 91 /* InKeyword */);\n                    writeSpace(writer);\n                    writeType(getConstraintTypeFromMappedType(type), 0 /* None */);\n                    writePunctuation(writer, 21 /* CloseBracketToken */);\n                    if (type.declaration.questionToken) {\n                        writePunctuation(writer, 54 /* QuestionToken */);\n                    }\n                    writePunctuation(writer, 55 /* ColonToken */);\n                    writeSpace(writer);\n                    writeType(getTemplateTypeFromMappedType(type), 0 /* None */);\n                    writePunctuation(writer, 24 /* SemicolonToken */);\n                    writer.writeLine();\n                    writer.decreaseIndent();\n                    writePunctuation(writer, 17 /* CloseBraceToken */);\n                }\n            }\n            function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration, flags) {\n                var targetSymbol = getTargetSymbol(symbol);\n                if (targetSymbol.flags & 32 /* Class */ || targetSymbol.flags & 64 /* Interface */ || targetSymbol.flags & 524288 /* TypeAlias */) {\n                    buildDisplayForTypeParametersAndDelimiters(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol), writer, enclosingDeclaration, flags);\n                }\n            }\n            function buildTypeParameterDisplay(tp, writer, enclosingDeclaration, flags, symbolStack) {\n                appendSymbolNameOnly(tp.symbol, writer);\n                var constraint = getConstraintOfTypeParameter(tp);\n                if (constraint) {\n                    writeSpace(writer);\n                    writeKeyword(writer, 84 /* ExtendsKeyword */);\n                    writeSpace(writer);\n                    buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack);\n                }\n            }\n            function buildParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack) {\n                var parameterNode = p.valueDeclaration;\n                if (ts.isRestParameter(parameterNode)) {\n                    writePunctuation(writer, 23 /* DotDotDotToken */);\n                }\n                if (ts.isBindingPattern(parameterNode.name)) {\n                    buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack);\n                }\n                else {\n                    appendSymbolNameOnly(p, writer);\n                }\n                if (isOptionalParameter(parameterNode)) {\n                    writePunctuation(writer, 54 /* QuestionToken */);\n                }\n                writePunctuation(writer, 55 /* ColonToken */);\n                writeSpace(writer);\n                buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack);\n            }\n            function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) {\n                // We have to explicitly emit square bracket and bracket because these tokens are not stored inside the node.\n                if (bindingPattern.kind === 172 /* ObjectBindingPattern */) {\n                    writePunctuation(writer, 16 /* OpenBraceToken */);\n                    buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); });\n                    writePunctuation(writer, 17 /* CloseBraceToken */);\n                }\n                else if (bindingPattern.kind === 173 /* ArrayBindingPattern */) {\n                    writePunctuation(writer, 20 /* OpenBracketToken */);\n                    var elements = bindingPattern.elements;\n                    buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); });\n                    if (elements && elements.hasTrailingComma) {\n                        writePunctuation(writer, 25 /* CommaToken */);\n                    }\n                    writePunctuation(writer, 21 /* CloseBracketToken */);\n                }\n            }\n            function buildBindingElementDisplay(bindingElement, writer, enclosingDeclaration, flags, symbolStack) {\n                if (ts.isOmittedExpression(bindingElement)) {\n                    return;\n                }\n                ts.Debug.assert(bindingElement.kind === 174 /* BindingElement */);\n                if (bindingElement.propertyName) {\n                    writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol);\n                    writePunctuation(writer, 55 /* ColonToken */);\n                    writeSpace(writer);\n                }\n                if (ts.isBindingPattern(bindingElement.name)) {\n                    buildBindingPatternDisplay(bindingElement.name, writer, enclosingDeclaration, flags, symbolStack);\n                }\n                else {\n                    if (bindingElement.dotDotDotToken) {\n                        writePunctuation(writer, 23 /* DotDotDotToken */);\n                    }\n                    appendSymbolNameOnly(bindingElement.symbol, writer);\n                }\n            }\n            function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) {\n                if (typeParameters && typeParameters.length) {\n                    writePunctuation(writer, 26 /* LessThanToken */);\n                    buildDisplayForCommaSeparatedList(typeParameters, writer, function (p) { return buildTypeParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack); });\n                    writePunctuation(writer, 28 /* GreaterThanToken */);\n                }\n            }\n            function buildDisplayForCommaSeparatedList(list, writer, action) {\n                for (var i = 0; i < list.length; i++) {\n                    if (i > 0) {\n                        writePunctuation(writer, 25 /* CommaToken */);\n                        writeSpace(writer);\n                    }\n                    action(list[i]);\n                }\n            }\n            function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration) {\n                if (typeParameters && typeParameters.length) {\n                    writePunctuation(writer, 26 /* LessThanToken */);\n                    var flags = 256 /* InFirstTypeArgument */;\n                    for (var i = 0; i < typeParameters.length; i++) {\n                        if (i > 0) {\n                            writePunctuation(writer, 25 /* CommaToken */);\n                            writeSpace(writer);\n                            flags = 0 /* None */;\n                        }\n                        buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, flags);\n                    }\n                    writePunctuation(writer, 28 /* GreaterThanToken */);\n                }\n            }\n            function buildDisplayForParametersAndDelimiters(thisParameter, parameters, writer, enclosingDeclaration, flags, symbolStack) {\n                writePunctuation(writer, 18 /* OpenParenToken */);\n                if (thisParameter) {\n                    buildParameterDisplay(thisParameter, writer, enclosingDeclaration, flags, symbolStack);\n                }\n                for (var i = 0; i < parameters.length; i++) {\n                    if (i > 0 || thisParameter) {\n                        writePunctuation(writer, 25 /* CommaToken */);\n                        writeSpace(writer);\n                    }\n                    buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, symbolStack);\n                }\n                writePunctuation(writer, 19 /* CloseParenToken */);\n            }\n            function buildTypePredicateDisplay(predicate, writer, enclosingDeclaration, flags, symbolStack) {\n                if (ts.isIdentifierTypePredicate(predicate)) {\n                    writer.writeParameter(predicate.parameterName);\n                }\n                else {\n                    writeKeyword(writer, 98 /* ThisKeyword */);\n                }\n                writeSpace(writer);\n                writeKeyword(writer, 125 /* IsKeyword */);\n                writeSpace(writer);\n                buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack);\n            }\n            function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) {\n                if (flags & 8 /* WriteArrowStyleSignature */) {\n                    writeSpace(writer);\n                    writePunctuation(writer, 35 /* EqualsGreaterThanToken */);\n                }\n                else {\n                    writePunctuation(writer, 55 /* ColonToken */);\n                }\n                writeSpace(writer);\n                if (signature.typePredicate) {\n                    buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack);\n                }\n                else {\n                    var returnType = getReturnTypeOfSignature(signature);\n                    buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack);\n                }\n            }\n            function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind, symbolStack) {\n                if (kind === 1 /* Construct */) {\n                    writeKeyword(writer, 93 /* NewKeyword */);\n                    writeSpace(writer);\n                }\n                if (signature.target && (flags & 32 /* WriteTypeArgumentsOfSignature */)) {\n                    // Instantiated signature, write type arguments instead\n                    // This is achieved by passing in the mapper separately\n                    buildDisplayForTypeArgumentsAndDelimiters(signature.target.typeParameters, signature.mapper, writer, enclosingDeclaration);\n                }\n                else {\n                    buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, symbolStack);\n                }\n                buildDisplayForParametersAndDelimiters(signature.thisParameter, signature.parameters, writer, enclosingDeclaration, flags, symbolStack);\n                buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack);\n            }\n            return _displayBuilder || (_displayBuilder = {\n                buildSymbolDisplay: buildSymbolDisplay,\n                buildTypeDisplay: buildTypeDisplay,\n                buildTypeParameterDisplay: buildTypeParameterDisplay,\n                buildTypePredicateDisplay: buildTypePredicateDisplay,\n                buildParameterDisplay: buildParameterDisplay,\n                buildDisplayForParametersAndDelimiters: buildDisplayForParametersAndDelimiters,\n                buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters,\n                buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol,\n                buildSignatureDisplay: buildSignatureDisplay,\n                buildReturnTypeDisplay: buildReturnTypeDisplay\n            });\n        }\n        function isDeclarationVisible(node) {\n            if (node) {\n                var links = getNodeLinks(node);\n                if (links.isVisible === undefined) {\n                    links.isVisible = !!determineIfDeclarationIsVisible();\n                }\n                return links.isVisible;\n            }\n            return false;\n            function determineIfDeclarationIsVisible() {\n                switch (node.kind) {\n                    case 174 /* BindingElement */:\n                        return isDeclarationVisible(node.parent.parent);\n                    case 223 /* VariableDeclaration */:\n                        if (ts.isBindingPattern(node.name) &&\n                            !node.name.elements.length) {\n                            // If the binding pattern is empty, this variable declaration is not visible\n                            return false;\n                        }\n                    // Otherwise fall through\n                    case 230 /* ModuleDeclaration */:\n                    case 226 /* ClassDeclaration */:\n                    case 227 /* InterfaceDeclaration */:\n                    case 228 /* TypeAliasDeclaration */:\n                    case 225 /* FunctionDeclaration */:\n                    case 229 /* EnumDeclaration */:\n                    case 234 /* ImportEqualsDeclaration */:\n                        // external module augmentation is always visible\n                        if (ts.isExternalModuleAugmentation(node)) {\n                            return true;\n                        }\n                        var parent_7 = getDeclarationContainer(node);\n                        // If the node is not exported or it is not ambient module element (except import declaration)\n                        if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) &&\n                            !(node.kind !== 234 /* ImportEqualsDeclaration */ && parent_7.kind !== 261 /* SourceFile */ && ts.isInAmbientContext(parent_7))) {\n                            return isGlobalSourceFile(parent_7);\n                        }\n                        // Exported members/ambient module elements (exception import declaration) are visible if parent is visible\n                        return isDeclarationVisible(parent_7);\n                    case 147 /* PropertyDeclaration */:\n                    case 146 /* PropertySignature */:\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                    case 149 /* MethodDeclaration */:\n                    case 148 /* MethodSignature */:\n                        if (ts.getModifierFlags(node) & (8 /* Private */ | 16 /* Protected */)) {\n                            // Private/protected properties/methods are not visible\n                            return false;\n                        }\n                    // Public properties/methods are visible if its parents are visible, so const it fall into next case statement\n                    case 150 /* Constructor */:\n                    case 154 /* ConstructSignature */:\n                    case 153 /* CallSignature */:\n                    case 155 /* IndexSignature */:\n                    case 144 /* Parameter */:\n                    case 231 /* ModuleBlock */:\n                    case 158 /* FunctionType */:\n                    case 159 /* ConstructorType */:\n                    case 161 /* TypeLiteral */:\n                    case 157 /* TypeReference */:\n                    case 162 /* ArrayType */:\n                    case 163 /* TupleType */:\n                    case 164 /* UnionType */:\n                    case 165 /* IntersectionType */:\n                    case 166 /* ParenthesizedType */:\n                        return isDeclarationVisible(node.parent);\n                    // Default binding, import specifier and namespace import is visible\n                    // only on demand so by default it is not visible\n                    case 236 /* ImportClause */:\n                    case 237 /* NamespaceImport */:\n                    case 239 /* ImportSpecifier */:\n                        return false;\n                    // Type parameters are always visible\n                    case 143 /* TypeParameter */:\n                    // Source file and namespace export are always visible\n                    case 261 /* SourceFile */:\n                    case 233 /* NamespaceExportDeclaration */:\n                        return true;\n                    // Export assignments do not create name bindings outside the module\n                    case 240 /* ExportAssignment */:\n                        return false;\n                    default:\n                        return false;\n                }\n            }\n        }\n        function collectLinkedAliases(node) {\n            var exportSymbol;\n            if (node.parent && node.parent.kind === 240 /* ExportAssignment */) {\n                exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */, ts.Diagnostics.Cannot_find_name_0, node);\n            }\n            else if (node.parent.kind === 243 /* ExportSpecifier */) {\n                var exportSpecifier = node.parent;\n                exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ?\n                    getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) :\n                    resolveEntityName(exportSpecifier.propertyName || exportSpecifier.name, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */);\n            }\n            var result = [];\n            if (exportSymbol) {\n                buildVisibleNodeList(exportSymbol.declarations);\n            }\n            return result;\n            function buildVisibleNodeList(declarations) {\n                ts.forEach(declarations, function (declaration) {\n                    getNodeLinks(declaration).isVisible = true;\n                    var resultNode = getAnyImportSyntax(declaration) || declaration;\n                    if (!ts.contains(result, resultNode)) {\n                        result.push(resultNode);\n                    }\n                    if (ts.isInternalModuleImportEqualsDeclaration(declaration)) {\n                        // Add the referenced top container visible\n                        var internalModuleReference = declaration.moduleReference;\n                        var firstIdentifier = getFirstIdentifier(internalModuleReference);\n                        var importSymbol = resolveName(declaration, firstIdentifier.text, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */, undefined, undefined);\n                        if (importSymbol) {\n                            buildVisibleNodeList(importSymbol.declarations);\n                        }\n                    }\n                });\n            }\n        }\n        /**\n         * Push an entry on the type resolution stack. If an entry with the given target and the given property name\n         * is already on the stack, and no entries in between already have a type, then a circularity has occurred.\n         * In this case, the result values of the existing entry and all entries pushed after it are changed to false,\n         * and the value false is returned. Otherwise, the new entry is just pushed onto the stack, and true is returned.\n         * In order to see if the same query has already been done before, the target object and the propertyName both\n         * must match the one passed in.\n         *\n         * @param target The symbol, type, or signature whose type is being queried\n         * @param propertyName The property name that should be used to query the target for its type\n         */\n        function pushTypeResolution(target, propertyName) {\n            var resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName);\n            if (resolutionCycleStartIndex >= 0) {\n                // A cycle was found\n                var length_2 = resolutionTargets.length;\n                for (var i = resolutionCycleStartIndex; i < length_2; i++) {\n                    resolutionResults[i] = false;\n                }\n                return false;\n            }\n            resolutionTargets.push(target);\n            resolutionResults.push(/*items*/ true);\n            resolutionPropertyNames.push(propertyName);\n            return true;\n        }\n        function findResolutionCycleStartIndex(target, propertyName) {\n            for (var i = resolutionTargets.length - 1; i >= 0; i--) {\n                if (hasType(resolutionTargets[i], resolutionPropertyNames[i])) {\n                    return -1;\n                }\n                if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {\n                    return i;\n                }\n            }\n            return -1;\n        }\n        function hasType(target, propertyName) {\n            if (propertyName === 0 /* Type */) {\n                return getSymbolLinks(target).type;\n            }\n            if (propertyName === 2 /* DeclaredType */) {\n                return getSymbolLinks(target).declaredType;\n            }\n            if (propertyName === 1 /* ResolvedBaseConstructorType */) {\n                return target.resolvedBaseConstructorType;\n            }\n            if (propertyName === 3 /* ResolvedReturnType */) {\n                return target.resolvedReturnType;\n            }\n            ts.Debug.fail(\"Unhandled TypeSystemPropertyName \" + propertyName);\n        }\n        // Pop an entry from the type resolution stack and return its associated result value. The result value will\n        // be true if no circularities were detected, or false if a circularity was found.\n        function popTypeResolution() {\n            resolutionTargets.pop();\n            resolutionPropertyNames.pop();\n            return resolutionResults.pop();\n        }\n        function getDeclarationContainer(node) {\n            node = ts.getRootDeclaration(node);\n            while (node) {\n                switch (node.kind) {\n                    case 223 /* VariableDeclaration */:\n                    case 224 /* VariableDeclarationList */:\n                    case 239 /* ImportSpecifier */:\n                    case 238 /* NamedImports */:\n                    case 237 /* NamespaceImport */:\n                    case 236 /* ImportClause */:\n                        node = node.parent;\n                        break;\n                    default:\n                        return node.parent;\n                }\n            }\n        }\n        function getTypeOfPrototypeProperty(prototype) {\n            // TypeScript 1.0 spec (April 2014): 8.4\n            // Every class automatically contains a static property member named 'prototype',\n            // the type of which is an instantiation of the class type with type Any supplied as a type argument for each type parameter.\n            // It is an error to explicitly declare a static property member with the name 'prototype'.\n            var classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype));\n            return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType;\n        }\n        // Return the type of the given property in the given type, or undefined if no such property exists\n        function getTypeOfPropertyOfType(type, name) {\n            var prop = getPropertyOfType(type, name);\n            return prop ? getTypeOfSymbol(prop) : undefined;\n        }\n        function isTypeAny(type) {\n            return type && (type.flags & 1 /* Any */) !== 0;\n        }\n        function isTypeNever(type) {\n            return type && (type.flags & 8192 /* Never */) !== 0;\n        }\n        // Return the type of a binding element parent. We check SymbolLinks first to see if a type has been\n        // assigned by contextual typing.\n        function getTypeForBindingElementParent(node) {\n            var symbol = getSymbolOfNode(node);\n            return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false);\n        }\n        function isComputedNonLiteralName(name) {\n            return name.kind === 142 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression);\n        }\n        function getRestType(source, properties, symbol) {\n            source = filterType(source, function (t) { return !(t.flags & 6144 /* Nullable */); });\n            if (source.flags & 8192 /* Never */) {\n                return emptyObjectType;\n            }\n            if (source.flags & 65536 /* Union */) {\n                return mapType(source, function (t) { return getRestType(t, properties, symbol); });\n            }\n            var members = ts.createMap();\n            var names = ts.createMap();\n            for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) {\n                var name_17 = properties_2[_i];\n                names[ts.getTextOfPropertyName(name_17)] = true;\n            }\n            for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {\n                var prop = _b[_a];\n                var inNamesToRemove = prop.name in names;\n                var isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */);\n                var isMethod = prop.flags & 8192 /* Method */;\n                var isSetOnlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);\n                if (!inNamesToRemove && !isPrivate && !isMethod && !isSetOnlyAccessor) {\n                    members[prop.name] = prop;\n                }\n            }\n            var stringIndexInfo = getIndexInfoOfType(source, 0 /* String */);\n            var numberIndexInfo = getIndexInfoOfType(source, 1 /* Number */);\n            return createAnonymousType(symbol, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);\n        }\n        /** Return the inferred type for a binding element */\n        function getTypeForBindingElement(declaration) {\n            var pattern = declaration.parent;\n            var parentType = getTypeForBindingElementParent(pattern.parent);\n            // If parent has the unknown (error) type, then so does this binding element\n            if (parentType === unknownType) {\n                return unknownType;\n            }\n            // If no type was specified or inferred for parent, or if the specified or inferred type is any,\n            // infer from the initializer of the binding element if one is present. Otherwise, go with the\n            // undefined or any type of the parent.\n            if (!parentType || isTypeAny(parentType)) {\n                if (declaration.initializer) {\n                    return checkDeclarationInitializer(declaration);\n                }\n                return parentType;\n            }\n            var type;\n            if (pattern.kind === 172 /* ObjectBindingPattern */) {\n                if (declaration.dotDotDotToken) {\n                    if (!isValidSpreadType(parentType)) {\n                        error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types);\n                        return unknownType;\n                    }\n                    var literalMembers = [];\n                    for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {\n                        var element = _a[_i];\n                        if (!element.dotDotDotToken) {\n                            literalMembers.push(element.propertyName || element.name);\n                        }\n                    }\n                    type = getRestType(parentType, literalMembers, declaration.symbol);\n                }\n                else {\n                    // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form)\n                    var name_18 = declaration.propertyName || declaration.name;\n                    if (isComputedNonLiteralName(name_18)) {\n                        // computed properties with non-literal names are treated as 'any'\n                        return anyType;\n                    }\n                    if (declaration.initializer) {\n                        getContextualType(declaration.initializer);\n                    }\n                    // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature,\n                    // or otherwise the type of the string index signature.\n                    var text = ts.getTextOfPropertyName(name_18);\n                    type = getTypeOfPropertyOfType(parentType, text) ||\n                        isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1 /* Number */) ||\n                        getIndexTypeOfType(parentType, 0 /* String */);\n                    if (!type) {\n                        error(name_18, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_18));\n                        return unknownType;\n                    }\n                }\n            }\n            else {\n                // This elementType will be used if the specific property corresponding to this index is not\n                // present (aka the tuple element property). This call also checks that the parentType is in\n                // fact an iterable or array (depending on target language).\n                var elementType = checkIteratedTypeOrElementType(parentType, pattern, /*allowStringInput*/ false);\n                if (declaration.dotDotDotToken) {\n                    // Rest element has an array type with the same element type as the parent type\n                    type = createArrayType(elementType);\n                }\n                else {\n                    // Use specific property type when parent is a tuple or numeric index type when parent is an array\n                    var propName = \"\" + ts.indexOf(pattern.elements, declaration);\n                    type = isTupleLikeType(parentType)\n                        ? getTypeOfPropertyOfType(parentType, propName)\n                        : elementType;\n                    if (!type) {\n                        if (isTupleType(parentType)) {\n                            error(declaration, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), getTypeReferenceArity(parentType), pattern.elements.length);\n                        }\n                        else {\n                            error(declaration, ts.Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName);\n                        }\n                        return unknownType;\n                    }\n                }\n            }\n            // In strict null checking mode, if a default value of a non-undefined type is specified, remove\n            // undefined from the final type.\n            if (strictNullChecks && declaration.initializer && !(getFalsyFlags(checkExpressionCached(declaration.initializer)) & 2048 /* Undefined */)) {\n                type = getTypeWithFacts(type, 131072 /* NEUndefined */);\n            }\n            return declaration.initializer ?\n                getUnionType([type, checkExpressionCached(declaration.initializer)], /*subtypeReduction*/ true) :\n                type;\n        }\n        function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) {\n            var jsdocType = ts.getJSDocType(declaration);\n            if (jsdocType) {\n                return getTypeFromTypeNode(jsdocType);\n            }\n            return undefined;\n        }\n        function isNullOrUndefined(node) {\n            var expr = ts.skipParentheses(node);\n            return expr.kind === 94 /* NullKeyword */ || expr.kind === 70 /* Identifier */ && getResolvedSymbol(expr) === undefinedSymbol;\n        }\n        function isEmptyArrayLiteral(node) {\n            var expr = ts.skipParentheses(node);\n            return expr.kind === 175 /* ArrayLiteralExpression */ && expr.elements.length === 0;\n        }\n        function addOptionality(type, optional) {\n            return strictNullChecks && optional ? includeFalsyTypes(type, 2048 /* Undefined */) : type;\n        }\n        // Return the inferred type for a variable, parameter, or property declaration\n        function getTypeForVariableLikeDeclaration(declaration, includeOptionality) {\n            if (declaration.flags & 65536 /* JavaScriptFile */) {\n                // If this is a variable in a JavaScript file, then use the JSDoc type (if it has\n                // one as its type), otherwise fallback to the below standard TS codepaths to\n                // try to figure it out.\n                var type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration);\n                if (type && type !== unknownType) {\n                    return type;\n                }\n            }\n            // A variable declared in a for..in statement is of type string, or of type keyof T when the\n            // right hand expression is of a type parameter type.\n            if (declaration.parent.parent.kind === 212 /* ForInStatement */) {\n                var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression));\n                return indexType.flags & (16384 /* TypeParameter */ | 262144 /* Index */) ? indexType : stringType;\n            }\n            if (declaration.parent.parent.kind === 213 /* ForOfStatement */) {\n                // checkRightHandSideOfForOf will return undefined if the for-of expression type was\n                // missing properties/signatures required to get its iteratedType (like\n                // [Symbol.iterator] or next). This may be because we accessed properties from anyType,\n                // or it may have led to an error inside getElementTypeOfIterable.\n                return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType;\n            }\n            if (ts.isBindingPattern(declaration.parent)) {\n                return getTypeForBindingElement(declaration);\n            }\n            // Use type from type annotation if one is present\n            if (declaration.type) {\n                return addOptionality(getTypeFromTypeNode(declaration.type), /*optional*/ declaration.questionToken && includeOptionality);\n            }\n            if ((compilerOptions.noImplicitAny || declaration.flags & 65536 /* JavaScriptFile */) &&\n                declaration.kind === 223 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) &&\n                !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !ts.isInAmbientContext(declaration)) {\n                // If --noImplicitAny is on or the declaration is in a Javascript file,\n                // use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no\n                // initializer or a 'null' or 'undefined' initializer.\n                if (!(ts.getCombinedNodeFlags(declaration) & 2 /* Const */) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) {\n                    return autoType;\n                }\n                // Use control flow tracked 'any[]' type for non-ambient, non-exported variables with an empty array\n                // literal initializer.\n                if (declaration.initializer && isEmptyArrayLiteral(declaration.initializer)) {\n                    return autoArrayType;\n                }\n            }\n            if (declaration.kind === 144 /* Parameter */) {\n                var func = declaration.parent;\n                // For a parameter of a set accessor, use the type of the get accessor if one is present\n                if (func.kind === 152 /* SetAccessor */ && !ts.hasDynamicName(func)) {\n                    var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 151 /* GetAccessor */);\n                    if (getter) {\n                        var getterSignature = getSignatureFromDeclaration(getter);\n                        var thisParameter = getAccessorThisParameter(func);\n                        if (thisParameter && declaration === thisParameter) {\n                            // Use the type from the *getter*\n                            ts.Debug.assert(!thisParameter.type);\n                            return getTypeOfSymbol(getterSignature.thisParameter);\n                        }\n                        return getReturnTypeOfSignature(getterSignature);\n                    }\n                }\n                // Use contextual parameter type if one is available\n                var type = void 0;\n                if (declaration.symbol.name === \"this\") {\n                    type = getContextualThisParameterType(func);\n                }\n                else {\n                    type = getContextuallyTypedParameterType(declaration);\n                }\n                if (type) {\n                    return addOptionality(type, /*optional*/ declaration.questionToken && includeOptionality);\n                }\n            }\n            // Use the type of the initializer expression if one is present\n            if (declaration.initializer) {\n                var type = checkDeclarationInitializer(declaration);\n                return addOptionality(type, /*optional*/ declaration.questionToken && includeOptionality);\n            }\n            // If it is a short-hand property assignment, use the type of the identifier\n            if (declaration.kind === 258 /* ShorthandPropertyAssignment */) {\n                return checkIdentifier(declaration.name);\n            }\n            // If the declaration specifies a binding pattern, use the type implied by the binding pattern\n            if (ts.isBindingPattern(declaration.name)) {\n                return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ false, /*reportErrors*/ true);\n            }\n            // No type specified and nothing can be inferred\n            return undefined;\n        }\n        // Return the type implied by a binding pattern element. This is the type of the initializer of the element if\n        // one is present. Otherwise, if the element is itself a binding pattern, it is the type implied by the binding\n        // pattern. Otherwise, it is the type any.\n        function getTypeFromBindingElement(element, includePatternInType, reportErrors) {\n            if (element.initializer) {\n                return checkDeclarationInitializer(element);\n            }\n            if (ts.isBindingPattern(element.name)) {\n                return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors);\n            }\n            if (reportErrors && compilerOptions.noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) {\n                reportImplicitAnyError(element, anyType);\n            }\n            return anyType;\n        }\n        // Return the type implied by an object binding pattern\n        function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {\n            var members = ts.createMap();\n            var stringIndexInfo;\n            var hasComputedProperties = false;\n            ts.forEach(pattern.elements, function (e) {\n                var name = e.propertyName || e.name;\n                if (isComputedNonLiteralName(name)) {\n                    // do not include computed properties in the implied type\n                    hasComputedProperties = true;\n                    return;\n                }\n                if (e.dotDotDotToken) {\n                    stringIndexInfo = createIndexInfo(anyType, /*isReadonly*/ false);\n                    return;\n                }\n                var text = ts.getTextOfPropertyName(name);\n                var flags = 4 /* Property */ | 67108864 /* Transient */ | (e.initializer ? 536870912 /* Optional */ : 0);\n                var symbol = createSymbol(flags, text);\n                symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors);\n                symbol.bindingElement = e;\n                members[symbol.name] = symbol;\n            });\n            var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined);\n            if (includePatternInType) {\n                result.pattern = pattern;\n            }\n            if (hasComputedProperties) {\n                result.objectFlags |= 512 /* ObjectLiteralPatternWithComputedProperties */;\n            }\n            return result;\n        }\n        // Return the type implied by an array binding pattern\n        function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) {\n            var elements = pattern.elements;\n            var lastElement = ts.lastOrUndefined(elements);\n            if (elements.length === 0 || (!ts.isOmittedExpression(lastElement) && lastElement.dotDotDotToken)) {\n                return languageVersion >= 2 /* ES2015 */ ? createIterableType(anyType) : anyArrayType;\n            }\n            // If the pattern has at least one element, and no rest element, then it should imply a tuple type.\n            var elementTypes = ts.map(elements, function (e) { return ts.isOmittedExpression(e) ? anyType : getTypeFromBindingElement(e, includePatternInType, reportErrors); });\n            var result = createTupleType(elementTypes);\n            if (includePatternInType) {\n                result = cloneTypeReference(result);\n                result.pattern = pattern;\n            }\n            return result;\n        }\n        // Return the type implied by a binding pattern. This is the type implied purely by the binding pattern itself\n        // and without regard to its context (i.e. without regard any type annotation or initializer associated with the\n        // declaration in which the binding pattern is contained). For example, the implied type of [x, y] is [any, any]\n        // and the implied type of { x, y: z = 1 } is { x: any; y: number; }. The type implied by a binding pattern is\n        // used as the contextual type of an initializer associated with the binding pattern. Also, for a destructuring\n        // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of\n        // the parameter.\n        function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) {\n            return pattern.kind === 172 /* ObjectBindingPattern */\n                ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors)\n                : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors);\n        }\n        // Return the type associated with a variable, parameter, or property declaration. In the simple case this is the type\n        // specified in a type annotation or inferred from an initializer. However, in the case of a destructuring declaration it\n        // is a bit more involved. For example:\n        //\n        //   var [x, s = \"\"] = [1, \"one\"];\n        //\n        // Here, the array literal [1, \"one\"] is contextually typed by the type [any, string], which is the implied type of the\n        // binding pattern [x, s = \"\"]. Because the contextual type is a tuple type, the resulting type of [1, \"one\"] is the\n        // tuple type [number, string]. Thus, the type inferred for 'x' is number and the type inferred for 's' is string.\n        function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) {\n            var type = getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true);\n            if (type) {\n                if (reportErrors) {\n                    reportErrorsFromWidening(declaration, type);\n                }\n                // During a normal type check we'll never get to here with a property assignment (the check of the containing\n                // object literal uses a different path). We exclude widening only so that language services and type verification\n                // tools see the actual type.\n                if (declaration.kind === 257 /* PropertyAssignment */) {\n                    return type;\n                }\n                return getWidenedType(type);\n            }\n            // Rest parameters default to type any[], other parameters default to type any\n            type = declaration.dotDotDotToken ? anyArrayType : anyType;\n            // Report implicit any errors unless this is a private property within an ambient declaration\n            if (reportErrors && compilerOptions.noImplicitAny) {\n                if (!declarationBelongsToPrivateAmbientMember(declaration)) {\n                    reportImplicitAnyError(declaration, type);\n                }\n            }\n            return type;\n        }\n        function declarationBelongsToPrivateAmbientMember(declaration) {\n            var root = ts.getRootDeclaration(declaration);\n            var memberDeclaration = root.kind === 144 /* Parameter */ ? root.parent : root;\n            return isPrivateWithinAmbient(memberDeclaration);\n        }\n        function getTypeOfVariableOrParameterOrProperty(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                // Handle prototype property\n                if (symbol.flags & 134217728 /* Prototype */) {\n                    return links.type = getTypeOfPrototypeProperty(symbol);\n                }\n                // Handle catch clause variables\n                var declaration = symbol.valueDeclaration;\n                if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) {\n                    return links.type = anyType;\n                }\n                // Handle export default expressions\n                if (declaration.kind === 240 /* ExportAssignment */) {\n                    return links.type = checkExpression(declaration.expression);\n                }\n                if (declaration.flags & 65536 /* JavaScriptFile */ && declaration.kind === 286 /* JSDocPropertyTag */ && declaration.typeExpression) {\n                    return links.type = getTypeFromTypeNode(declaration.typeExpression.type);\n                }\n                // Handle variable, parameter or property\n                if (!pushTypeResolution(symbol, 0 /* Type */)) {\n                    return unknownType;\n                }\n                var type = void 0;\n                // Handle certain special assignment kinds, which happen to union across multiple declarations:\n                // * module.exports = expr\n                // * exports.p = expr\n                // * this.p = expr\n                // * className.prototype.method = expr\n                if (declaration.kind === 192 /* BinaryExpression */ ||\n                    declaration.kind === 177 /* PropertyAccessExpression */ && declaration.parent.kind === 192 /* BinaryExpression */) {\n                    // Use JS Doc type if present on parent expression statement\n                    if (declaration.flags & 65536 /* JavaScriptFile */) {\n                        var jsdocType = ts.getJSDocType(declaration.parent);\n                        if (jsdocType) {\n                            return links.type = getTypeFromTypeNode(jsdocType);\n                        }\n                    }\n                    var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 /* BinaryExpression */ ?\n                        checkExpressionCached(decl.right) :\n                        checkExpressionCached(decl.parent.right); });\n                    type = getUnionType(declaredTypes, /*subtypeReduction*/ true);\n                }\n                else {\n                    type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);\n                }\n                if (!popTypeResolution()) {\n                    if (symbol.valueDeclaration.type) {\n                        // Variable has type annotation that circularly references the variable itself\n                        type = unknownType;\n                        error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));\n                    }\n                    else {\n                        // Variable has initializer that circularly references the variable itself\n                        type = anyType;\n                        if (compilerOptions.noImplicitAny) {\n                            error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));\n                        }\n                    }\n                }\n                links.type = type;\n            }\n            return links.type;\n        }\n        function getAnnotatedAccessorType(accessor) {\n            if (accessor) {\n                if (accessor.kind === 151 /* GetAccessor */) {\n                    return accessor.type && getTypeFromTypeNode(accessor.type);\n                }\n                else {\n                    var setterTypeAnnotation = ts.getSetAccessorTypeAnnotationNode(accessor);\n                    return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation);\n                }\n            }\n            return undefined;\n        }\n        function getAnnotatedAccessorThisParameter(accessor) {\n            var parameter = getAccessorThisParameter(accessor);\n            return parameter && parameter.symbol;\n        }\n        function getThisTypeOfDeclaration(declaration) {\n            return getThisTypeOfSignature(getSignatureFromDeclaration(declaration));\n        }\n        function getTypeOfAccessors(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                var getter = ts.getDeclarationOfKind(symbol, 151 /* GetAccessor */);\n                var setter = ts.getDeclarationOfKind(symbol, 152 /* SetAccessor */);\n                if (getter && getter.flags & 65536 /* JavaScriptFile */) {\n                    var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter);\n                    if (jsDocType) {\n                        return links.type = jsDocType;\n                    }\n                }\n                if (!pushTypeResolution(symbol, 0 /* Type */)) {\n                    return unknownType;\n                }\n                var type = void 0;\n                // First try to see if the user specified a return type on the get-accessor.\n                var getterReturnType = getAnnotatedAccessorType(getter);\n                if (getterReturnType) {\n                    type = getterReturnType;\n                }\n                else {\n                    // If the user didn't specify a return type, try to use the set-accessor's parameter type.\n                    var setterParameterType = getAnnotatedAccessorType(setter);\n                    if (setterParameterType) {\n                        type = setterParameterType;\n                    }\n                    else {\n                        // If there are no specified types, try to infer it from the body of the get accessor if it exists.\n                        if (getter && getter.body) {\n                            type = getReturnTypeFromBody(getter);\n                        }\n                        else {\n                            if (compilerOptions.noImplicitAny) {\n                                if (setter) {\n                                    error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));\n                                }\n                                else {\n                                    ts.Debug.assert(!!getter, \"there must existed getter as we are current checking either setter or getter in this function\");\n                                    error(getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol));\n                                }\n                            }\n                            type = anyType;\n                        }\n                    }\n                }\n                if (!popTypeResolution()) {\n                    type = anyType;\n                    if (compilerOptions.noImplicitAny) {\n                        var getter_1 = ts.getDeclarationOfKind(symbol, 151 /* GetAccessor */);\n                        error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));\n                    }\n                }\n                links.type = type;\n            }\n            return links.type;\n        }\n        function getTypeOfFuncClassEnumModule(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                if (symbol.flags & 1536 /* Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) {\n                    links.type = anyType;\n                }\n                else {\n                    var type = createObjectType(16 /* Anonymous */, symbol);\n                    links.type = strictNullChecks && symbol.flags & 536870912 /* Optional */ ?\n                        includeFalsyTypes(type, 2048 /* Undefined */) : type;\n                }\n            }\n            return links.type;\n        }\n        function getTypeOfEnumMember(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                links.type = getDeclaredTypeOfEnumMember(symbol);\n            }\n            return links.type;\n        }\n        function getTypeOfAlias(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                var targetSymbol = resolveAlias(symbol);\n                // It only makes sense to get the type of a value symbol. If the result of resolving\n                // the alias is not a value, then it has no type. To get the type associated with a\n                // type symbol, call getDeclaredTypeOfSymbol.\n                // This check is important because without it, a call to getTypeOfSymbol could end\n                // up recursively calling getTypeOfAlias, causing a stack overflow.\n                links.type = targetSymbol.flags & 107455 /* Value */\n                    ? getTypeOfSymbol(targetSymbol)\n                    : unknownType;\n            }\n            return links.type;\n        }\n        function getTypeOfInstantiatedSymbol(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.type) {\n                links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper);\n            }\n            return links.type;\n        }\n        function getTypeOfSymbol(symbol) {\n            if (symbol.flags & 16777216 /* Instantiated */) {\n                return getTypeOfInstantiatedSymbol(symbol);\n            }\n            if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) {\n                return getTypeOfVariableOrParameterOrProperty(symbol);\n            }\n            if (symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) {\n                return getTypeOfFuncClassEnumModule(symbol);\n            }\n            if (symbol.flags & 8 /* EnumMember */) {\n                return getTypeOfEnumMember(symbol);\n            }\n            if (symbol.flags & 98304 /* Accessor */) {\n                return getTypeOfAccessors(symbol);\n            }\n            if (symbol.flags & 8388608 /* Alias */) {\n                return getTypeOfAlias(symbol);\n            }\n            return unknownType;\n        }\n        function getTargetType(type) {\n            return getObjectFlags(type) & 4 /* Reference */ ? type.target : type;\n        }\n        function hasBaseType(type, checkBase) {\n            return check(type);\n            function check(type) {\n                var target = getTargetType(type);\n                return target === checkBase || ts.forEach(getBaseTypes(target), check);\n            }\n        }\n        // Appends the type parameters given by a list of declarations to a set of type parameters and returns the resulting set.\n        // The function allocates a new array if the input type parameter set is undefined, but otherwise it modifies the set\n        // in-place and returns the same array.\n        function appendTypeParameters(typeParameters, declarations) {\n            for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) {\n                var declaration = declarations_2[_i];\n                var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration));\n                if (!typeParameters) {\n                    typeParameters = [tp];\n                }\n                else if (!ts.contains(typeParameters, tp)) {\n                    typeParameters.push(tp);\n                }\n            }\n            return typeParameters;\n        }\n        // Appends the outer type parameters of a node to a set of type parameters and returns the resulting set. The function\n        // allocates a new array if the input type parameter set is undefined, but otherwise it modifies the set in-place and\n        // returns the same array.\n        function appendOuterTypeParameters(typeParameters, node) {\n            while (true) {\n                node = node.parent;\n                if (!node) {\n                    return typeParameters;\n                }\n                if (node.kind === 226 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */ ||\n                    node.kind === 225 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */ ||\n                    node.kind === 149 /* MethodDeclaration */ || node.kind === 185 /* ArrowFunction */) {\n                    var declarations = node.typeParameters;\n                    if (declarations) {\n                        return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations);\n                    }\n                }\n            }\n        }\n        // The outer type parameters are those defined by enclosing generic classes, methods, or functions.\n        function getOuterTypeParametersOfClassOrInterface(symbol) {\n            var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 227 /* InterfaceDeclaration */);\n            return appendOuterTypeParameters(undefined, declaration);\n        }\n        // The local type parameters are the combined set of type parameters from all declarations of the class,\n        // interface, or type alias.\n        function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) {\n            var result;\n            for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                var node = _a[_i];\n                if (node.kind === 227 /* InterfaceDeclaration */ || node.kind === 226 /* ClassDeclaration */ ||\n                    node.kind === 197 /* ClassExpression */ || node.kind === 228 /* TypeAliasDeclaration */) {\n                    var declaration = node;\n                    if (declaration.typeParameters) {\n                        result = appendTypeParameters(result, declaration.typeParameters);\n                    }\n                }\n            }\n            return result;\n        }\n        // The full set of type parameters for a generic class or interface type consists of its outer type parameters plus\n        // its locally declared type parameters.\n        function getTypeParametersOfClassOrInterface(symbol) {\n            return ts.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol));\n        }\n        function isConstructorType(type) {\n            return type.flags & 32768 /* Object */ && getSignaturesOfType(type, 1 /* Construct */).length > 0;\n        }\n        function getBaseTypeNodeOfClass(type) {\n            return ts.getClassExtendsHeritageClauseElement(type.symbol.valueDeclaration);\n        }\n        function getConstructorsForTypeArguments(type, typeArgumentNodes) {\n            var typeArgCount = typeArgumentNodes ? typeArgumentNodes.length : 0;\n            return ts.filter(getSignaturesOfType(type, 1 /* Construct */), function (sig) { return (sig.typeParameters ? sig.typeParameters.length : 0) === typeArgCount; });\n        }\n        function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes) {\n            var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes);\n            if (typeArgumentNodes) {\n                var typeArguments_1 = ts.map(typeArgumentNodes, getTypeFromTypeNode);\n                signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments_1); });\n            }\n            return signatures;\n        }\n        // The base constructor of a class can resolve to\n        // undefinedType if the class has no extends clause,\n        // unknownType if an error occurred during resolution of the extends expression,\n        // nullType if the extends expression is the null value, or\n        // an object type with at least one construct signature.\n        function getBaseConstructorTypeOfClass(type) {\n            if (!type.resolvedBaseConstructorType) {\n                var baseTypeNode = getBaseTypeNodeOfClass(type);\n                if (!baseTypeNode) {\n                    return type.resolvedBaseConstructorType = undefinedType;\n                }\n                if (!pushTypeResolution(type, 1 /* ResolvedBaseConstructorType */)) {\n                    return unknownType;\n                }\n                var baseConstructorType = checkExpression(baseTypeNode.expression);\n                if (baseConstructorType.flags & 32768 /* Object */) {\n                    // Resolving the members of a class requires us to resolve the base class of that class.\n                    // We force resolution here such that we catch circularities now.\n                    resolveStructuredTypeMembers(baseConstructorType);\n                }\n                if (!popTypeResolution()) {\n                    error(type.symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol));\n                    return type.resolvedBaseConstructorType = unknownType;\n                }\n                if (baseConstructorType !== unknownType && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) {\n                    error(baseTypeNode.expression, ts.Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType));\n                    return type.resolvedBaseConstructorType = unknownType;\n                }\n                type.resolvedBaseConstructorType = baseConstructorType;\n            }\n            return type.resolvedBaseConstructorType;\n        }\n        function getBaseTypes(type) {\n            if (!type.resolvedBaseTypes) {\n                if (type.objectFlags & 8 /* Tuple */) {\n                    type.resolvedBaseTypes = [createArrayType(getUnionType(type.typeParameters))];\n                }\n                else if (type.symbol.flags & (32 /* Class */ | 64 /* Interface */)) {\n                    if (type.symbol.flags & 32 /* Class */) {\n                        resolveBaseTypesOfClass(type);\n                    }\n                    if (type.symbol.flags & 64 /* Interface */) {\n                        resolveBaseTypesOfInterface(type);\n                    }\n                }\n                else {\n                    ts.Debug.fail(\"type must be class or interface\");\n                }\n            }\n            return type.resolvedBaseTypes;\n        }\n        function resolveBaseTypesOfClass(type) {\n            type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray;\n            var baseConstructorType = getBaseConstructorTypeOfClass(type);\n            if (!(baseConstructorType.flags & 32768 /* Object */)) {\n                return;\n            }\n            var baseTypeNode = getBaseTypeNodeOfClass(type);\n            var baseType;\n            var originalBaseType = baseConstructorType && baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : undefined;\n            if (baseConstructorType.symbol && baseConstructorType.symbol.flags & 32 /* Class */ &&\n                areAllOuterTypeParametersApplied(originalBaseType)) {\n                // When base constructor type is a class with no captured type arguments we know that the constructors all have the same type parameters as the\n                // class and all return the instance type of the class. There is no need for further checks and we can apply the\n                // type arguments in the same manner as a type reference to get the same error reporting experience.\n                baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol);\n            }\n            else {\n                // The class derives from a \"class-like\" constructor function, check that we have at least one construct signature\n                // with a matching number of type parameters and use the return type of the first instantiated signature. Elsewhere\n                // we check that all instantiated signatures return the same type.\n                var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments);\n                if (!constructors.length) {\n                    error(baseTypeNode.expression, ts.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments);\n                    return;\n                }\n                baseType = getReturnTypeOfSignature(constructors[0]);\n            }\n            // In a JS file, you can use the @augments jsdoc tag to specify a base type with type parameters\n            var valueDecl = type.symbol.valueDeclaration;\n            if (valueDecl && ts.isInJavaScriptFile(valueDecl)) {\n                var augTag = ts.getJSDocAugmentsTag(type.symbol.valueDeclaration);\n                if (augTag) {\n                    baseType = getTypeFromTypeNode(augTag.typeExpression.type);\n                }\n            }\n            if (baseType === unknownType) {\n                return;\n            }\n            if (!(getObjectFlags(getTargetType(baseType)) & 3 /* ClassOrInterface */)) {\n                error(baseTypeNode.expression, ts.Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType));\n                return;\n            }\n            if (type === baseType || hasBaseType(baseType, type)) {\n                error(valueDecl, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */));\n                return;\n            }\n            if (type.resolvedBaseTypes === emptyArray) {\n                type.resolvedBaseTypes = [baseType];\n            }\n            else {\n                type.resolvedBaseTypes.push(baseType);\n            }\n        }\n        function areAllOuterTypeParametersApplied(type) {\n            // An unapplied type parameter has its symbol still the same as the matching argument symbol.\n            // Since parameters are applied outer-to-inner, only the last outer parameter needs to be checked.\n            var outerTypeParameters = type.outerTypeParameters;\n            if (outerTypeParameters) {\n                var last = outerTypeParameters.length - 1;\n                var typeArguments = type.typeArguments;\n                return outerTypeParameters[last].symbol !== typeArguments[last].symbol;\n            }\n            return true;\n        }\n        function resolveBaseTypesOfInterface(type) {\n            type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray;\n            for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) {\n                var declaration = _a[_i];\n                if (declaration.kind === 227 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) {\n                    for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) {\n                        var node = _c[_b];\n                        var baseType = getTypeFromTypeNode(node);\n                        if (baseType !== unknownType) {\n                            if (getObjectFlags(getTargetType(baseType)) & 3 /* ClassOrInterface */) {\n                                if (type !== baseType && !hasBaseType(baseType, type)) {\n                                    if (type.resolvedBaseTypes === emptyArray) {\n                                        type.resolvedBaseTypes = [baseType];\n                                    }\n                                    else {\n                                        type.resolvedBaseTypes.push(baseType);\n                                    }\n                                }\n                                else {\n                                    error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */));\n                                }\n                            }\n                            else {\n                                error(node, ts.Diagnostics.An_interface_may_only_extend_a_class_or_another_interface);\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        // Returns true if the interface given by the symbol is free of \"this\" references. Specifically, the result is\n        // true if the interface itself contains no references to \"this\" in its body, if all base types are interfaces,\n        // and if none of the base interfaces have a \"this\" type.\n        function isIndependentInterface(symbol) {\n            for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                var declaration = _a[_i];\n                if (declaration.kind === 227 /* InterfaceDeclaration */) {\n                    if (declaration.flags & 64 /* ContainsThis */) {\n                        return false;\n                    }\n                    var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration);\n                    if (baseTypeNodes) {\n                        for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) {\n                            var node = baseTypeNodes_1[_b];\n                            if (ts.isEntityNameExpression(node.expression)) {\n                                var baseSymbol = resolveEntityName(node.expression, 793064 /* Type */, /*ignoreErrors*/ true);\n                                if (!baseSymbol || !(baseSymbol.flags & 64 /* Interface */) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) {\n                                    return false;\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n            return true;\n        }\n        function getDeclaredTypeOfClassOrInterface(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                var kind = symbol.flags & 32 /* Class */ ? 1 /* Class */ : 2 /* Interface */;\n                var type = links.declaredType = createObjectType(kind, symbol);\n                var outerTypeParameters = getOuterTypeParametersOfClassOrInterface(symbol);\n                var localTypeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);\n                // A class or interface is generic if it has type parameters or a \"this\" type. We always give classes a \"this\" type\n                // because it is not feasible to analyze all members to determine if the \"this\" type escapes the class (in particular,\n                // property types inferred from initializers and method return types inferred from return statements are very hard\n                // to exhaustively analyze). We give interfaces a \"this\" type if we can't definitely determine that they are free of\n                // \"this\" references.\n                if (outerTypeParameters || localTypeParameters || kind === 1 /* Class */ || !isIndependentInterface(symbol)) {\n                    type.objectFlags |= 4 /* Reference */;\n                    type.typeParameters = ts.concatenate(outerTypeParameters, localTypeParameters);\n                    type.outerTypeParameters = outerTypeParameters;\n                    type.localTypeParameters = localTypeParameters;\n                    type.instantiations = ts.createMap();\n                    type.instantiations[getTypeListId(type.typeParameters)] = type;\n                    type.target = type;\n                    type.typeArguments = type.typeParameters;\n                    type.thisType = createType(16384 /* TypeParameter */);\n                    type.thisType.isThisType = true;\n                    type.thisType.symbol = symbol;\n                    type.thisType.constraint = type;\n                }\n            }\n            return links.declaredType;\n        }\n        function getDeclaredTypeOfTypeAlias(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                // Note that we use the links object as the target here because the symbol object is used as the unique\n                // identity for resolution of the 'type' property in SymbolLinks.\n                if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) {\n                    return unknownType;\n                }\n                var declaration = ts.getDeclarationOfKind(symbol, 285 /* JSDocTypedefTag */);\n                var type = void 0;\n                if (declaration) {\n                    if (declaration.jsDocTypeLiteral) {\n                        type = getTypeFromTypeNode(declaration.jsDocTypeLiteral);\n                    }\n                    else {\n                        type = getTypeFromTypeNode(declaration.typeExpression.type);\n                    }\n                }\n                else {\n                    declaration = ts.getDeclarationOfKind(symbol, 228 /* TypeAliasDeclaration */);\n                    type = getTypeFromTypeNode(declaration.type);\n                }\n                if (popTypeResolution()) {\n                    var typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);\n                    if (typeParameters) {\n                        // Initialize the instantiation cache for generic type aliases. The declared type corresponds to\n                        // an instantiation of the type alias with the type parameters supplied as type arguments.\n                        links.typeParameters = typeParameters;\n                        links.instantiations = ts.createMap();\n                        links.instantiations[getTypeListId(typeParameters)] = type;\n                    }\n                }\n                else {\n                    type = unknownType;\n                    error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));\n                }\n                links.declaredType = type;\n            }\n            return links.declaredType;\n        }\n        function isLiteralEnumMember(symbol, member) {\n            var expr = member.initializer;\n            if (!expr) {\n                return !ts.isInAmbientContext(member);\n            }\n            return expr.kind === 8 /* NumericLiteral */ ||\n                expr.kind === 190 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ &&\n                    expr.operand.kind === 8 /* NumericLiteral */ ||\n                expr.kind === 70 /* Identifier */ && !!symbol.exports[expr.text];\n        }\n        function enumHasLiteralMembers(symbol) {\n            for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                var declaration = _a[_i];\n                if (declaration.kind === 229 /* EnumDeclaration */) {\n                    for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {\n                        var member = _c[_b];\n                        if (!isLiteralEnumMember(symbol, member)) {\n                            return false;\n                        }\n                    }\n                }\n            }\n            return true;\n        }\n        function createEnumLiteralType(symbol, baseType, text) {\n            var type = createType(256 /* EnumLiteral */);\n            type.symbol = symbol;\n            type.baseType = baseType;\n            type.text = text;\n            return type;\n        }\n        function getDeclaredTypeOfEnum(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                var enumType = links.declaredType = createType(16 /* Enum */);\n                enumType.symbol = symbol;\n                if (enumHasLiteralMembers(symbol)) {\n                    var memberTypeList = [];\n                    var memberTypes = ts.createMap();\n                    for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) {\n                        var declaration = _a[_i];\n                        if (declaration.kind === 229 /* EnumDeclaration */) {\n                            computeEnumMemberValues(declaration);\n                            for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {\n                                var member = _c[_b];\n                                var memberSymbol = getSymbolOfNode(member);\n                                var value = getEnumMemberValue(member);\n                                if (!memberTypes[value]) {\n                                    var memberType = memberTypes[value] = createEnumLiteralType(memberSymbol, enumType, \"\" + value);\n                                    memberTypeList.push(memberType);\n                                }\n                            }\n                        }\n                    }\n                    enumType.memberTypes = memberTypes;\n                    if (memberTypeList.length > 1) {\n                        enumType.flags |= 65536 /* Union */;\n                        enumType.types = memberTypeList;\n                        unionTypes[getTypeListId(memberTypeList)] = enumType;\n                    }\n                }\n            }\n            return links.declaredType;\n        }\n        function getDeclaredTypeOfEnumMember(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                var enumType = getDeclaredTypeOfEnum(getParentOfSymbol(symbol));\n                links.declaredType = enumType.flags & 65536 /* Union */ ?\n                    enumType.memberTypes[getEnumMemberValue(symbol.valueDeclaration)] :\n                    enumType;\n            }\n            return links.declaredType;\n        }\n        function getDeclaredTypeOfTypeParameter(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                var type = createType(16384 /* TypeParameter */);\n                type.symbol = symbol;\n                if (!ts.getDeclarationOfKind(symbol, 143 /* TypeParameter */).constraint) {\n                    type.constraint = noConstraintType;\n                }\n                links.declaredType = type;\n            }\n            return links.declaredType;\n        }\n        function getDeclaredTypeOfAlias(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.declaredType) {\n                links.declaredType = getDeclaredTypeOfSymbol(resolveAlias(symbol));\n            }\n            return links.declaredType;\n        }\n        function getDeclaredTypeOfSymbol(symbol) {\n            ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0);\n            if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) {\n                return getDeclaredTypeOfClassOrInterface(symbol);\n            }\n            if (symbol.flags & 524288 /* TypeAlias */) {\n                return getDeclaredTypeOfTypeAlias(symbol);\n            }\n            if (symbol.flags & 262144 /* TypeParameter */) {\n                return getDeclaredTypeOfTypeParameter(symbol);\n            }\n            if (symbol.flags & 384 /* Enum */) {\n                return getDeclaredTypeOfEnum(symbol);\n            }\n            if (symbol.flags & 8 /* EnumMember */) {\n                return getDeclaredTypeOfEnumMember(symbol);\n            }\n            if (symbol.flags & 8388608 /* Alias */) {\n                return getDeclaredTypeOfAlias(symbol);\n            }\n            return unknownType;\n        }\n        // A type reference is considered independent if each type argument is considered independent.\n        function isIndependentTypeReference(node) {\n            if (node.typeArguments) {\n                for (var _i = 0, _a = node.typeArguments; _i < _a.length; _i++) {\n                    var typeNode = _a[_i];\n                    if (!isIndependentType(typeNode)) {\n                        return false;\n                    }\n                }\n            }\n            return true;\n        }\n        // A type is considered independent if it the any, string, number, boolean, symbol, or void keyword, a string\n        // literal type, an array with an element type that is considered independent, or a type reference that is\n        // considered independent.\n        function isIndependentType(node) {\n            switch (node.kind) {\n                case 118 /* AnyKeyword */:\n                case 134 /* StringKeyword */:\n                case 132 /* NumberKeyword */:\n                case 121 /* BooleanKeyword */:\n                case 135 /* SymbolKeyword */:\n                case 104 /* VoidKeyword */:\n                case 137 /* UndefinedKeyword */:\n                case 94 /* NullKeyword */:\n                case 129 /* NeverKeyword */:\n                case 171 /* LiteralType */:\n                    return true;\n                case 162 /* ArrayType */:\n                    return isIndependentType(node.elementType);\n                case 157 /* TypeReference */:\n                    return isIndependentTypeReference(node);\n            }\n            return false;\n        }\n        // A variable-like declaration is considered independent (free of this references) if it has a type annotation\n        // that specifies an independent type, or if it has no type annotation and no initializer (and thus of type any).\n        function isIndependentVariableLikeDeclaration(node) {\n            return node.type && isIndependentType(node.type) || !node.type && !node.initializer;\n        }\n        // A function-like declaration is considered independent (free of this references) if it has a return type\n        // annotation that is considered independent and if each parameter is considered independent.\n        function isIndependentFunctionLikeDeclaration(node) {\n            if (node.kind !== 150 /* Constructor */ && (!node.type || !isIndependentType(node.type))) {\n                return false;\n            }\n            for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {\n                var parameter = _a[_i];\n                if (!isIndependentVariableLikeDeclaration(parameter)) {\n                    return false;\n                }\n            }\n            return true;\n        }\n        // Returns true if the class or interface member given by the symbol is free of \"this\" references. The\n        // function may return false for symbols that are actually free of \"this\" references because it is not\n        // feasible to perform a complete analysis in all cases. In particular, property members with types\n        // inferred from their initializers and function members with inferred return types are conservatively\n        // assumed not to be free of \"this\" references.\n        function isIndependentMember(symbol) {\n            if (symbol.declarations && symbol.declarations.length === 1) {\n                var declaration = symbol.declarations[0];\n                if (declaration) {\n                    switch (declaration.kind) {\n                        case 147 /* PropertyDeclaration */:\n                        case 146 /* PropertySignature */:\n                            return isIndependentVariableLikeDeclaration(declaration);\n                        case 149 /* MethodDeclaration */:\n                        case 148 /* MethodSignature */:\n                        case 150 /* Constructor */:\n                            return isIndependentFunctionLikeDeclaration(declaration);\n                    }\n                }\n            }\n            return false;\n        }\n        function createSymbolTable(symbols) {\n            var result = ts.createMap();\n            for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {\n                var symbol = symbols_1[_i];\n                result[symbol.name] = symbol;\n            }\n            return result;\n        }\n        // The mappingThisOnly flag indicates that the only type parameter being mapped is \"this\". When the flag is true,\n        // we check symbols to see if we can quickly conclude they are free of \"this\" references, thus needing no instantiation.\n        function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) {\n            var result = ts.createMap();\n            for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {\n                var symbol = symbols_2[_i];\n                result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper);\n            }\n            return result;\n        }\n        function addInheritedMembers(symbols, baseSymbols) {\n            for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) {\n                var s = baseSymbols_1[_i];\n                if (!symbols[s.name]) {\n                    symbols[s.name] = s;\n                }\n            }\n        }\n        function resolveDeclaredMembers(type) {\n            if (!type.declaredProperties) {\n                var symbol = type.symbol;\n                type.declaredProperties = getNamedMembers(symbol.members);\n                type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members[\"__call\"]);\n                type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members[\"__new\"]);\n                type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0 /* String */);\n                type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1 /* Number */);\n            }\n            return type;\n        }\n        function getTypeWithThisArgument(type, thisArgument) {\n            if (getObjectFlags(type) & 4 /* Reference */) {\n                return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType]));\n            }\n            return type;\n        }\n        function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {\n            var mapper;\n            var members;\n            var callSignatures;\n            var constructSignatures;\n            var stringIndexInfo;\n            var numberIndexInfo;\n            if (ts.rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) {\n                mapper = identityMapper;\n                members = source.symbol ? source.symbol.members : createSymbolTable(source.declaredProperties);\n                callSignatures = source.declaredCallSignatures;\n                constructSignatures = source.declaredConstructSignatures;\n                stringIndexInfo = source.declaredStringIndexInfo;\n                numberIndexInfo = source.declaredNumberIndexInfo;\n            }\n            else {\n                mapper = createTypeMapper(typeParameters, typeArguments);\n                members = createInstantiatedSymbolTable(source.declaredProperties, mapper, /*mappingThisOnly*/ typeParameters.length === 1);\n                callSignatures = instantiateSignatures(source.declaredCallSignatures, mapper);\n                constructSignatures = instantiateSignatures(source.declaredConstructSignatures, mapper);\n                stringIndexInfo = instantiateIndexInfo(source.declaredStringIndexInfo, mapper);\n                numberIndexInfo = instantiateIndexInfo(source.declaredNumberIndexInfo, mapper);\n            }\n            var baseTypes = getBaseTypes(source);\n            if (baseTypes.length) {\n                if (source.symbol && members === source.symbol.members) {\n                    members = createSymbolTable(source.declaredProperties);\n                }\n                var thisArgument = ts.lastOrUndefined(typeArguments);\n                for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) {\n                    var baseType = baseTypes_1[_i];\n                    var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType;\n                    addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType));\n                    callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */));\n                    constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */));\n                    stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0 /* String */);\n                    numberIndexInfo = numberIndexInfo || getIndexInfoOfType(instantiatedBaseType, 1 /* Number */);\n                }\n            }\n            setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n        }\n        function resolveClassOrInterfaceMembers(type) {\n            resolveObjectTypeMembers(type, resolveDeclaredMembers(type), emptyArray, emptyArray);\n        }\n        function resolveTypeReferenceMembers(type) {\n            var source = resolveDeclaredMembers(type.target);\n            var typeParameters = ts.concatenate(source.typeParameters, [source.thisType]);\n            var typeArguments = type.typeArguments && type.typeArguments.length === typeParameters.length ?\n                type.typeArguments : ts.concatenate(type.typeArguments, [type]);\n            resolveObjectTypeMembers(type, source, typeParameters, typeArguments);\n        }\n        function createSignature(declaration, typeParameters, thisParameter, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasLiteralTypes) {\n            var sig = new Signature(checker);\n            sig.declaration = declaration;\n            sig.typeParameters = typeParameters;\n            sig.parameters = parameters;\n            sig.thisParameter = thisParameter;\n            sig.resolvedReturnType = resolvedReturnType;\n            sig.typePredicate = typePredicate;\n            sig.minArgumentCount = minArgumentCount;\n            sig.hasRestParameter = hasRestParameter;\n            sig.hasLiteralTypes = hasLiteralTypes;\n            return sig;\n        }\n        function cloneSignature(sig) {\n            return createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasLiteralTypes);\n        }\n        function getDefaultConstructSignatures(classType) {\n            var baseConstructorType = getBaseConstructorTypeOfClass(classType);\n            var baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* Construct */);\n            if (baseSignatures.length === 0) {\n                return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false)];\n            }\n            var baseTypeNode = getBaseTypeNodeOfClass(classType);\n            var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode);\n            var typeArgCount = typeArguments ? typeArguments.length : 0;\n            var result = [];\n            for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) {\n                var baseSig = baseSignatures_1[_i];\n                var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0;\n                if (typeParamCount === typeArgCount) {\n                    var sig = typeParamCount ? createSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig);\n                    sig.typeParameters = classType.localTypeParameters;\n                    sig.resolvedReturnType = classType;\n                    result.push(sig);\n                }\n            }\n            return result;\n        }\n        function findMatchingSignature(signatureList, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes) {\n            for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) {\n                var s = signatureList_1[_i];\n                if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypesIdentical)) {\n                    return s;\n                }\n            }\n        }\n        function findMatchingSignatures(signatureLists, signature, listIndex) {\n            if (signature.typeParameters) {\n                // We require an exact match for generic signatures, so we only return signatures from the first\n                // signature list and only if they have exact matches in the other signature lists.\n                if (listIndex > 0) {\n                    return undefined;\n                }\n                for (var i = 1; i < signatureLists.length; i++) {\n                    if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false)) {\n                        return undefined;\n                    }\n                }\n                return [signature];\n            }\n            var result = undefined;\n            for (var i = 0; i < signatureLists.length; i++) {\n                // Allow matching non-generic signatures to have excess parameters and different return types\n                var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true);\n                if (!match) {\n                    return undefined;\n                }\n                if (!ts.contains(result, match)) {\n                    (result || (result = [])).push(match);\n                }\n            }\n            return result;\n        }\n        // The signatures of a union type are those signatures that are present in each of the constituent types.\n        // Generic signatures must match exactly, but non-generic signatures are allowed to have extra optional\n        // parameters and may differ in return types. When signatures differ in return types, the resulting return\n        // type is the union of the constituent return types.\n        function getUnionSignatures(types, kind) {\n            var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); });\n            var result = undefined;\n            for (var i = 0; i < signatureLists.length; i++) {\n                for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) {\n                    var signature = _a[_i];\n                    // Only process signatures with parameter lists that aren't already in the result list\n                    if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true)) {\n                        var unionSignatures = findMatchingSignatures(signatureLists, signature, i);\n                        if (unionSignatures) {\n                            var s = signature;\n                            // Union the result types when more than one signature matches\n                            if (unionSignatures.length > 1) {\n                                s = cloneSignature(signature);\n                                if (ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; })) {\n                                    var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return getTypeOfSymbol(sig.thisParameter) || anyType; }), /*subtypeReduction*/ true);\n                                    s.thisParameter = createTransientSymbol(signature.thisParameter, thisType);\n                                }\n                                // Clear resolved return type we possibly got from cloneSignature\n                                s.resolvedReturnType = undefined;\n                                s.unionSignatures = unionSignatures;\n                            }\n                            (result || (result = [])).push(s);\n                        }\n                    }\n                }\n            }\n            return result || emptyArray;\n        }\n        function getUnionIndexInfo(types, kind) {\n            var indexTypes = [];\n            var isAnyReadonly = false;\n            for (var _i = 0, types_1 = types; _i < types_1.length; _i++) {\n                var type = types_1[_i];\n                var indexInfo = getIndexInfoOfType(type, kind);\n                if (!indexInfo) {\n                    return undefined;\n                }\n                indexTypes.push(indexInfo.type);\n                isAnyReadonly = isAnyReadonly || indexInfo.isReadonly;\n            }\n            return createIndexInfo(getUnionType(indexTypes, /*subtypeReduction*/ true), isAnyReadonly);\n        }\n        function resolveUnionTypeMembers(type) {\n            // The members and properties collections are empty for union types. To get all properties of a union\n            // type use getPropertiesOfType (only the language service uses this).\n            var callSignatures = getUnionSignatures(type.types, 0 /* Call */);\n            var constructSignatures = getUnionSignatures(type.types, 1 /* Construct */);\n            var stringIndexInfo = getUnionIndexInfo(type.types, 0 /* String */);\n            var numberIndexInfo = getUnionIndexInfo(type.types, 1 /* Number */);\n            setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n        }\n        function intersectTypes(type1, type2) {\n            return !type1 ? type2 : !type2 ? type1 : getIntersectionType([type1, type2]);\n        }\n        function intersectIndexInfos(info1, info2) {\n            return !info1 ? info2 : !info2 ? info1 : createIndexInfo(getIntersectionType([info1.type, info2.type]), info1.isReadonly && info2.isReadonly);\n        }\n        function unionSpreadIndexInfos(info1, info2) {\n            return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly);\n        }\n        function resolveIntersectionTypeMembers(type) {\n            // The members and properties collections are empty for intersection types. To get all properties of an\n            // intersection type use getPropertiesOfType (only the language service uses this).\n            var callSignatures = emptyArray;\n            var constructSignatures = emptyArray;\n            var stringIndexInfo = undefined;\n            var numberIndexInfo = undefined;\n            for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                var t = _a[_i];\n                callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0 /* Call */));\n                constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1 /* Construct */));\n                stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0 /* String */));\n                numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1 /* Number */));\n            }\n            setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n        }\n        function resolveAnonymousTypeMembers(type) {\n            var symbol = type.symbol;\n            if (type.target) {\n                var members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false);\n                var callSignatures = instantiateSignatures(getSignaturesOfType(type.target, 0 /* Call */), type.mapper);\n                var constructSignatures = instantiateSignatures(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper);\n                var stringIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 0 /* String */), type.mapper);\n                var numberIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 1 /* Number */), type.mapper);\n                setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n            }\n            else if (symbol.flags & 2048 /* TypeLiteral */) {\n                var members = symbol.members;\n                var callSignatures = getSignaturesOfSymbol(members[\"__call\"]);\n                var constructSignatures = getSignaturesOfSymbol(members[\"__new\"]);\n                var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0 /* String */);\n                var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1 /* Number */);\n                setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);\n            }\n            else {\n                // Combinations of function, class, enum and module\n                var members = emptySymbols;\n                var constructSignatures = emptyArray;\n                if (symbol.flags & 1952 /* HasExports */) {\n                    members = getExportsOfSymbol(symbol);\n                }\n                if (symbol.flags & 32 /* Class */) {\n                    var classType = getDeclaredTypeOfClassOrInterface(symbol);\n                    constructSignatures = getSignaturesOfSymbol(symbol.members[\"__constructor\"]);\n                    if (!constructSignatures.length) {\n                        constructSignatures = getDefaultConstructSignatures(classType);\n                    }\n                    var baseConstructorType = getBaseConstructorTypeOfClass(classType);\n                    if (baseConstructorType.flags & 32768 /* Object */) {\n                        members = createSymbolTable(getNamedMembers(members));\n                        addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType));\n                    }\n                }\n                var numberIndexInfo = symbol.flags & 384 /* Enum */ ? enumNumberIndexInfo : undefined;\n                setStructuredTypeMembers(type, members, emptyArray, constructSignatures, undefined, numberIndexInfo);\n                // We resolve the members before computing the signatures because a signature may use\n                // typeof with a qualified name expression that circularly references the type we are\n                // in the process of resolving (see issue #6072). The temporarily empty signature list\n                // will never be observed because a qualified name can't reference signatures.\n                if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {\n                    type.callSignatures = getSignaturesOfSymbol(symbol);\n                }\n            }\n        }\n        /** Resolve the members of a mapped type { [P in K]: T } */\n        function resolveMappedTypeMembers(type) {\n            var members = ts.createMap();\n            var stringIndexInfo;\n            // Resolve upfront such that recursive references see an empty object type.\n            setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined);\n            // In { [P in K]: T }, we refer to P as the type parameter type, K as the constraint type,\n            // and T as the template type. If K is of the form 'keyof S', the mapped type and S are\n            // homomorphic and we copy property modifiers from corresponding properties in S.\n            var typeParameter = getTypeParameterFromMappedType(type);\n            var constraintType = getConstraintTypeFromMappedType(type);\n            var homomorphicType = getHomomorphicTypeFromMappedType(type);\n            var templateType = getTemplateTypeFromMappedType(type);\n            var templateReadonly = !!type.declaration.readonlyToken;\n            var templateOptional = !!type.declaration.questionToken;\n            // First, if the constraint type is a type parameter, obtain the base constraint. Then,\n            // if the key type is a 'keyof X', obtain 'keyof C' where C is the base constraint of X.\n            // Finally, iterate over the constituents of the resulting iteration type.\n            var keyType = constraintType.flags & 540672 /* TypeVariable */ ? getApparentType(constraintType) : constraintType;\n            var iterationType = keyType.flags & 262144 /* Index */ ? getIndexType(getApparentType(keyType.type)) : keyType;\n            forEachType(iterationType, function (t) {\n                // Create a mapper from T to the current iteration type constituent. Then, if the\n                // mapped type is itself an instantiated type, combine the iteration mapper with the\n                // instantiation mapper.\n                var iterationMapper = createUnaryTypeMapper(typeParameter, t);\n                var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper;\n                var propType = instantiateType(templateType, templateMapper);\n                // If the current iteration type constituent is a string literal type, create a property.\n                // Otherwise, for type string create a string index signature.\n                if (t.flags & 32 /* StringLiteral */) {\n                    var propName = t.text;\n                    var homomorphicProp = homomorphicType && getPropertyOfType(homomorphicType, propName);\n                    var isOptional = templateOptional || !!(homomorphicProp && homomorphicProp.flags & 536870912 /* Optional */);\n                    var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | (isOptional ? 536870912 /* Optional */ : 0), propName);\n                    prop.type = propType;\n                    prop.isReadonly = templateReadonly || homomorphicProp && isReadonlySymbol(homomorphicProp);\n                    members[propName] = prop;\n                }\n                else if (t.flags & 2 /* String */) {\n                    stringIndexInfo = createIndexInfo(propType, templateReadonly);\n                }\n            });\n            setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined);\n        }\n        function getTypeParameterFromMappedType(type) {\n            return type.typeParameter ||\n                (type.typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(type.declaration.typeParameter)));\n        }\n        function getConstraintTypeFromMappedType(type) {\n            return type.constraintType ||\n                (type.constraintType = instantiateType(getConstraintOfTypeParameter(getTypeParameterFromMappedType(type)), type.mapper || identityMapper) || unknownType);\n        }\n        function getTemplateTypeFromMappedType(type) {\n            return type.templateType ||\n                (type.templateType = type.declaration.type ?\n                    instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!type.declaration.questionToken), type.mapper || identityMapper) :\n                    unknownType);\n        }\n        function getHomomorphicTypeFromMappedType(type) {\n            var constraint = getConstraintDeclaration(getTypeParameterFromMappedType(type));\n            return constraint.kind === 168 /* TypeOperator */ ? instantiateType(getTypeFromTypeNode(constraint.type), type.mapper || identityMapper) : undefined;\n        }\n        function getErasedTemplateTypeFromMappedType(type) {\n            return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType));\n        }\n        function isGenericMappedType(type) {\n            if (getObjectFlags(type) & 32 /* Mapped */) {\n                var constraintType = getConstraintTypeFromMappedType(type);\n                return maybeTypeOfKind(constraintType, 540672 /* TypeVariable */ | 262144 /* Index */);\n            }\n            return false;\n        }\n        function resolveStructuredTypeMembers(type) {\n            if (!type.members) {\n                if (type.flags & 32768 /* Object */) {\n                    if (type.objectFlags & 4 /* Reference */) {\n                        resolveTypeReferenceMembers(type);\n                    }\n                    else if (type.objectFlags & 3 /* ClassOrInterface */) {\n                        resolveClassOrInterfaceMembers(type);\n                    }\n                    else if (type.objectFlags & 16 /* Anonymous */) {\n                        resolveAnonymousTypeMembers(type);\n                    }\n                    else if (type.objectFlags & 32 /* Mapped */) {\n                        resolveMappedTypeMembers(type);\n                    }\n                }\n                else if (type.flags & 65536 /* Union */) {\n                    resolveUnionTypeMembers(type);\n                }\n                else if (type.flags & 131072 /* Intersection */) {\n                    resolveIntersectionTypeMembers(type);\n                }\n            }\n            return type;\n        }\n        /** Return properties of an object type or an empty array for other types */\n        function getPropertiesOfObjectType(type) {\n            if (type.flags & 32768 /* Object */) {\n                return resolveStructuredTypeMembers(type).properties;\n            }\n            return emptyArray;\n        }\n        /** If the given type is an object type and that type has a property by the given name,\n         * return the symbol for that property. Otherwise return undefined. */\n        function getPropertyOfObjectType(type, name) {\n            if (type.flags & 32768 /* Object */) {\n                var resolved = resolveStructuredTypeMembers(type);\n                var symbol = resolved.members[name];\n                if (symbol && symbolIsValue(symbol)) {\n                    return symbol;\n                }\n            }\n        }\n        function getPropertiesOfUnionOrIntersectionType(type) {\n            for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                var current = _a[_i];\n                for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) {\n                    var prop = _c[_b];\n                    getUnionOrIntersectionProperty(type, prop.name);\n                }\n                // The properties of a union type are those that are present in all constituent types, so\n                // we only need to check the properties of the first type\n                if (type.flags & 65536 /* Union */) {\n                    break;\n                }\n            }\n            var props = type.resolvedProperties;\n            if (props) {\n                var result = [];\n                for (var key in props) {\n                    var prop = props[key];\n                    // We need to filter out partial properties in union types\n                    if (!(prop.flags & 268435456 /* SyntheticProperty */ && prop.isPartial)) {\n                        result.push(prop);\n                    }\n                }\n                return result;\n            }\n            return emptyArray;\n        }\n        function getPropertiesOfType(type) {\n            type = getApparentType(type);\n            return type.flags & 196608 /* UnionOrIntersection */ ?\n                getPropertiesOfUnionOrIntersectionType(type) :\n                getPropertiesOfObjectType(type);\n        }\n        /**\n         * The apparent type of a type parameter is the base constraint instantiated with the type parameter\n         * as the type argument for the 'this' type.\n         */\n        function getApparentTypeOfTypeParameter(type) {\n            if (!type.resolvedApparentType) {\n                var constraintType = getConstraintOfTypeParameter(type);\n                while (constraintType && constraintType.flags & 16384 /* TypeParameter */) {\n                    constraintType = getConstraintOfTypeParameter(constraintType);\n                }\n                type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type);\n            }\n            return type.resolvedApparentType;\n        }\n        /**\n         * The apparent type of an indexed access T[K] is the type of T's string index signature, if any.\n         */\n        function getApparentTypeOfIndexedAccess(type) {\n            return getIndexTypeOfType(getApparentType(type.objectType), 0 /* String */) || type;\n        }\n        /**\n         * For a type parameter, return the base constraint of the type parameter. For the string, number,\n         * boolean, and symbol primitive types, return the corresponding object types. Otherwise return the\n         * type itself. Note that the apparent type of a union type is the union type itself.\n         */\n        function getApparentType(type) {\n            var t = type.flags & 16384 /* TypeParameter */ ? getApparentTypeOfTypeParameter(type) :\n                type.flags & 524288 /* IndexedAccess */ ? getApparentTypeOfIndexedAccess(type) :\n                    type;\n            return t.flags & 262178 /* StringLike */ ? globalStringType :\n                t.flags & 340 /* NumberLike */ ? globalNumberType :\n                    t.flags & 136 /* BooleanLike */ ? globalBooleanType :\n                        t.flags & 512 /* ESSymbol */ ? getGlobalESSymbolType() :\n                            t;\n        }\n        function createUnionOrIntersectionProperty(containingType, name) {\n            var types = containingType.types;\n            var props;\n            // Flags we want to propagate to the result if they exist in all source symbols\n            var commonFlags = (containingType.flags & 131072 /* Intersection */) ? 536870912 /* Optional */ : 0 /* None */;\n            var isReadonly = false;\n            var isPartial = false;\n            for (var _i = 0, types_2 = types; _i < types_2.length; _i++) {\n                var current = types_2[_i];\n                var type = getApparentType(current);\n                if (type !== unknownType) {\n                    var prop = getPropertyOfType(type, name);\n                    if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))) {\n                        commonFlags &= prop.flags;\n                        if (!props) {\n                            props = [prop];\n                        }\n                        else if (!ts.contains(props, prop)) {\n                            props.push(prop);\n                        }\n                        if (isReadonlySymbol(prop)) {\n                            isReadonly = true;\n                        }\n                    }\n                    else if (containingType.flags & 65536 /* Union */) {\n                        isPartial = true;\n                    }\n                }\n            }\n            if (!props) {\n                return undefined;\n            }\n            if (props.length === 1 && !isPartial) {\n                return props[0];\n            }\n            var propTypes = [];\n            var declarations = [];\n            var commonType = undefined;\n            var hasNonUniformType = false;\n            for (var _a = 0, props_1 = props; _a < props_1.length; _a++) {\n                var prop = props_1[_a];\n                if (prop.declarations) {\n                    ts.addRange(declarations, prop.declarations);\n                }\n                var type = getTypeOfSymbol(prop);\n                if (!commonType) {\n                    commonType = type;\n                }\n                else if (type !== commonType) {\n                    hasNonUniformType = true;\n                }\n                propTypes.push(type);\n            }\n            var result = createSymbol(4 /* Property */ | 67108864 /* Transient */ | 268435456 /* SyntheticProperty */ | commonFlags, name);\n            result.containingType = containingType;\n            result.hasNonUniformType = hasNonUniformType;\n            result.isPartial = isPartial;\n            result.declarations = declarations;\n            result.isReadonly = isReadonly;\n            result.type = containingType.flags & 65536 /* Union */ ? getUnionType(propTypes) : getIntersectionType(propTypes);\n            return result;\n        }\n        // Return the symbol for a given property in a union or intersection type, or undefined if the property\n        // does not exist in any constituent type. Note that the returned property may only be present in some\n        // constituents, in which case the isPartial flag is set when the containing type is union type. We need\n        // these partial properties when identifying discriminant properties, but otherwise they are filtered out\n        // and do not appear to be present in the union type.\n        function getUnionOrIntersectionProperty(type, name) {\n            var properties = type.resolvedProperties || (type.resolvedProperties = ts.createMap());\n            var property = properties[name];\n            if (!property) {\n                property = createUnionOrIntersectionProperty(type, name);\n                if (property) {\n                    properties[name] = property;\n                }\n            }\n            return property;\n        }\n        function getPropertyOfUnionOrIntersectionType(type, name) {\n            var property = getUnionOrIntersectionProperty(type, name);\n            // We need to filter out partial properties in union types\n            return property && !(property.flags & 268435456 /* SyntheticProperty */ && property.isPartial) ? property : undefined;\n        }\n        /**\n         * Return the symbol for the property with the given name in the given type. Creates synthetic union properties when\n         * necessary, maps primitive types and type parameters are to their apparent types, and augments with properties from\n         * Object and Function as appropriate.\n         *\n         * @param type a type to look up property from\n         * @param name a name of property to look up in a given type\n         */\n        function getPropertyOfType(type, name) {\n            type = getApparentType(type);\n            if (type.flags & 32768 /* Object */) {\n                var resolved = resolveStructuredTypeMembers(type);\n                var symbol = resolved.members[name];\n                if (symbol && symbolIsValue(symbol)) {\n                    return symbol;\n                }\n                if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) {\n                    var symbol_1 = getPropertyOfObjectType(globalFunctionType, name);\n                    if (symbol_1) {\n                        return symbol_1;\n                    }\n                }\n                return getPropertyOfObjectType(globalObjectType, name);\n            }\n            if (type.flags & 196608 /* UnionOrIntersection */) {\n                return getPropertyOfUnionOrIntersectionType(type, name);\n            }\n            return undefined;\n        }\n        function getSignaturesOfStructuredType(type, kind) {\n            if (type.flags & 229376 /* StructuredType */) {\n                var resolved = resolveStructuredTypeMembers(type);\n                return kind === 0 /* Call */ ? resolved.callSignatures : resolved.constructSignatures;\n            }\n            return emptyArray;\n        }\n        /**\n         * Return the signatures of the given kind in the given type. Creates synthetic union signatures when necessary and\n         * maps primitive types and type parameters are to their apparent types.\n         */\n        function getSignaturesOfType(type, kind) {\n            return getSignaturesOfStructuredType(getApparentType(type), kind);\n        }\n        function getIndexInfoOfStructuredType(type, kind) {\n            if (type.flags & 229376 /* StructuredType */) {\n                var resolved = resolveStructuredTypeMembers(type);\n                return kind === 0 /* String */ ? resolved.stringIndexInfo : resolved.numberIndexInfo;\n            }\n        }\n        function getIndexTypeOfStructuredType(type, kind) {\n            var info = getIndexInfoOfStructuredType(type, kind);\n            return info && info.type;\n        }\n        // Return the indexing info of the given kind in the given type. Creates synthetic union index types when necessary and\n        // maps primitive types and type parameters are to their apparent types.\n        function getIndexInfoOfType(type, kind) {\n            return getIndexInfoOfStructuredType(getApparentType(type), kind);\n        }\n        // Return the index type of the given kind in the given type. Creates synthetic union index types when necessary and\n        // maps primitive types and type parameters are to their apparent types.\n        function getIndexTypeOfType(type, kind) {\n            return getIndexTypeOfStructuredType(getApparentType(type), kind);\n        }\n        function getImplicitIndexTypeOfType(type, kind) {\n            if (isObjectLiteralType(type)) {\n                var propTypes = [];\n                for (var _i = 0, _a = getPropertiesOfType(type); _i < _a.length; _i++) {\n                    var prop = _a[_i];\n                    if (kind === 0 /* String */ || isNumericLiteralName(prop.name)) {\n                        propTypes.push(getTypeOfSymbol(prop));\n                    }\n                }\n                if (propTypes.length) {\n                    return getUnionType(propTypes, /*subtypeReduction*/ true);\n                }\n            }\n            return undefined;\n        }\n        function getTypeParametersFromJSDocTemplate(declaration) {\n            if (declaration.flags & 65536 /* JavaScriptFile */) {\n                var templateTag = ts.getJSDocTemplateTag(declaration);\n                if (templateTag) {\n                    return getTypeParametersFromDeclaration(templateTag.typeParameters);\n                }\n            }\n            return undefined;\n        }\n        // Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual\n        // type checking functions).\n        function getTypeParametersFromDeclaration(typeParameterDeclarations) {\n            var result = [];\n            ts.forEach(typeParameterDeclarations, function (node) {\n                var tp = getDeclaredTypeOfTypeParameter(node.symbol);\n                if (!ts.contains(result, tp)) {\n                    result.push(tp);\n                }\n            });\n            return result;\n        }\n        function symbolsToArray(symbols) {\n            var result = [];\n            for (var id in symbols) {\n                if (!isReservedMemberName(id)) {\n                    result.push(symbols[id]);\n                }\n            }\n            return result;\n        }\n        function isJSDocOptionalParameter(node) {\n            if (node.flags & 65536 /* JavaScriptFile */) {\n                if (node.type && node.type.kind === 273 /* JSDocOptionalType */) {\n                    return true;\n                }\n                var paramTags = ts.getJSDocParameterTags(node);\n                if (paramTags) {\n                    for (var _i = 0, paramTags_1 = paramTags; _i < paramTags_1.length; _i++) {\n                        var paramTag = paramTags_1[_i];\n                        if (paramTag.isBracketed) {\n                            return true;\n                        }\n                        if (paramTag.typeExpression) {\n                            return paramTag.typeExpression.type.kind === 273 /* JSDocOptionalType */;\n                        }\n                    }\n                }\n            }\n        }\n        function tryFindAmbientModule(moduleName, withAugmentations) {\n            if (ts.isExternalModuleNameRelative(moduleName)) {\n                return undefined;\n            }\n            var symbol = getSymbol(globals, \"\\\"\" + moduleName + \"\\\"\", 512 /* ValueModule */);\n            // merged symbol is module declaration symbol combined with all augmentations\n            return symbol && withAugmentations ? getMergedSymbol(symbol) : symbol;\n        }\n        function isOptionalParameter(node) {\n            if (ts.hasQuestionToken(node) || isJSDocOptionalParameter(node)) {\n                return true;\n            }\n            if (node.initializer) {\n                var signatureDeclaration = node.parent;\n                var signature = getSignatureFromDeclaration(signatureDeclaration);\n                var parameterIndex = ts.indexOf(signatureDeclaration.parameters, node);\n                ts.Debug.assert(parameterIndex >= 0);\n                return parameterIndex >= signature.minArgumentCount;\n            }\n            return false;\n        }\n        function createTypePredicateFromTypePredicateNode(node) {\n            if (node.parameterName.kind === 70 /* Identifier */) {\n                var parameterName = node.parameterName;\n                return {\n                    kind: 1 /* Identifier */,\n                    parameterName: parameterName ? parameterName.text : undefined,\n                    parameterIndex: parameterName ? getTypePredicateParameterIndex(node.parent.parameters, parameterName) : undefined,\n                    type: getTypeFromTypeNode(node.type)\n                };\n            }\n            else {\n                return {\n                    kind: 0 /* This */,\n                    type: getTypeFromTypeNode(node.type)\n                };\n            }\n        }\n        function getSignatureFromDeclaration(declaration) {\n            var links = getNodeLinks(declaration);\n            if (!links.resolvedSignature) {\n                var parameters = [];\n                var hasLiteralTypes = false;\n                var minArgumentCount = -1;\n                var thisParameter = undefined;\n                var hasThisParameter = void 0;\n                var isJSConstructSignature = ts.isJSDocConstructSignature(declaration);\n                // If this is a JSDoc construct signature, then skip the first parameter in the\n                // parameter list.  The first parameter represents the return type of the construct\n                // signature.\n                for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) {\n                    var param = declaration.parameters[i];\n                    var paramSymbol = param.symbol;\n                    // Include parameter symbol instead of property symbol in the signature\n                    if (paramSymbol && !!(paramSymbol.flags & 4 /* Property */) && !ts.isBindingPattern(param.name)) {\n                        var resolvedSymbol = resolveName(param, paramSymbol.name, 107455 /* Value */, undefined, undefined);\n                        paramSymbol = resolvedSymbol;\n                    }\n                    if (i === 0 && paramSymbol.name === \"this\") {\n                        hasThisParameter = true;\n                        thisParameter = param.symbol;\n                    }\n                    else {\n                        parameters.push(paramSymbol);\n                    }\n                    if (param.type && param.type.kind === 171 /* LiteralType */) {\n                        hasLiteralTypes = true;\n                    }\n                    if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) {\n                        if (minArgumentCount < 0) {\n                            minArgumentCount = i - (hasThisParameter ? 1 : 0);\n                        }\n                    }\n                    else {\n                        // If we see any required parameters, it means the prior ones were not in fact optional.\n                        minArgumentCount = -1;\n                    }\n                }\n                // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation\n                if ((declaration.kind === 151 /* GetAccessor */ || declaration.kind === 152 /* SetAccessor */) &&\n                    !ts.hasDynamicName(declaration) &&\n                    (!hasThisParameter || !thisParameter)) {\n                    var otherKind = declaration.kind === 151 /* GetAccessor */ ? 152 /* SetAccessor */ : 151 /* GetAccessor */;\n                    var other = ts.getDeclarationOfKind(declaration.symbol, otherKind);\n                    if (other) {\n                        thisParameter = getAnnotatedAccessorThisParameter(other);\n                    }\n                }\n                if (minArgumentCount < 0) {\n                    minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0);\n                }\n                if (isJSConstructSignature) {\n                    minArgumentCount--;\n                }\n                var classType = declaration.kind === 150 /* Constructor */ ?\n                    getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol))\n                    : undefined;\n                var typeParameters = classType ? classType.localTypeParameters :\n                    declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) :\n                        getTypeParametersFromJSDocTemplate(declaration);\n                var returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType);\n                var typePredicate = declaration.type && declaration.type.kind === 156 /* TypePredicate */ ?\n                    createTypePredicateFromTypePredicateNode(declaration.type) :\n                    undefined;\n                links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasLiteralTypes);\n            }\n            return links.resolvedSignature;\n        }\n        function getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType) {\n            if (isJSConstructSignature) {\n                return getTypeFromTypeNode(declaration.parameters[0].type);\n            }\n            else if (classType) {\n                return classType;\n            }\n            else if (declaration.type) {\n                return getTypeFromTypeNode(declaration.type);\n            }\n            if (declaration.flags & 65536 /* JavaScriptFile */) {\n                var type = getReturnTypeFromJSDocComment(declaration);\n                if (type && type !== unknownType) {\n                    return type;\n                }\n            }\n            // TypeScript 1.0 spec (April 2014):\n            // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation.\n            if (declaration.kind === 151 /* GetAccessor */ && !ts.hasDynamicName(declaration)) {\n                var setter = ts.getDeclarationOfKind(declaration.symbol, 152 /* SetAccessor */);\n                return getAnnotatedAccessorType(setter);\n            }\n            if (ts.nodeIsMissing(declaration.body)) {\n                return anyType;\n            }\n        }\n        function getSignaturesOfSymbol(symbol) {\n            if (!symbol)\n                return emptyArray;\n            var result = [];\n            for (var i = 0, len = symbol.declarations.length; i < len; i++) {\n                var node = symbol.declarations[i];\n                switch (node.kind) {\n                    case 158 /* FunctionType */:\n                    case 159 /* ConstructorType */:\n                    case 225 /* FunctionDeclaration */:\n                    case 149 /* MethodDeclaration */:\n                    case 148 /* MethodSignature */:\n                    case 150 /* Constructor */:\n                    case 153 /* CallSignature */:\n                    case 154 /* ConstructSignature */:\n                    case 155 /* IndexSignature */:\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                    case 184 /* FunctionExpression */:\n                    case 185 /* ArrowFunction */:\n                    case 274 /* JSDocFunctionType */:\n                        // Don't include signature if node is the implementation of an overloaded function. A node is considered\n                        // an implementation node if it has a body and the previous node is of the same kind and immediately\n                        // precedes the implementation node (i.e. has the same parent and ends where the implementation starts).\n                        if (i > 0 && node.body) {\n                            var previous = symbol.declarations[i - 1];\n                            if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) {\n                                break;\n                            }\n                        }\n                        result.push(getSignatureFromDeclaration(node));\n                }\n            }\n            return result;\n        }\n        function resolveExternalModuleTypeByLiteral(name) {\n            var moduleSym = resolveExternalModuleName(name, name);\n            if (moduleSym) {\n                var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym);\n                if (resolvedModuleSymbol) {\n                    return getTypeOfSymbol(resolvedModuleSymbol);\n                }\n            }\n            return anyType;\n        }\n        function getThisTypeOfSignature(signature) {\n            if (signature.thisParameter) {\n                return getTypeOfSymbol(signature.thisParameter);\n            }\n        }\n        function getReturnTypeOfSignature(signature) {\n            if (!signature.resolvedReturnType) {\n                if (!pushTypeResolution(signature, 3 /* ResolvedReturnType */)) {\n                    return unknownType;\n                }\n                var type = void 0;\n                if (signature.target) {\n                    type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper);\n                }\n                else if (signature.unionSignatures) {\n                    type = getUnionType(ts.map(signature.unionSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true);\n                }\n                else {\n                    type = getReturnTypeFromBody(signature.declaration);\n                }\n                if (!popTypeResolution()) {\n                    type = anyType;\n                    if (compilerOptions.noImplicitAny) {\n                        var declaration = signature.declaration;\n                        if (declaration.name) {\n                            error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));\n                        }\n                        else {\n                            error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);\n                        }\n                    }\n                }\n                signature.resolvedReturnType = type;\n            }\n            return signature.resolvedReturnType;\n        }\n        function getRestTypeOfSignature(signature) {\n            if (signature.hasRestParameter) {\n                var type = getTypeOfSymbol(ts.lastOrUndefined(signature.parameters));\n                if (getObjectFlags(type) & 4 /* Reference */ && type.target === globalArrayType) {\n                    return type.typeArguments[0];\n                }\n            }\n            return anyType;\n        }\n        function getSignatureInstantiation(signature, typeArguments) {\n            var instantiations = signature.instantiations || (signature.instantiations = ts.createMap());\n            var id = getTypeListId(typeArguments);\n            return instantiations[id] || (instantiations[id] = createSignatureInstantiation(signature, typeArguments));\n        }\n        function createSignatureInstantiation(signature, typeArguments) {\n            return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), /*eraseTypeParameters*/ true);\n        }\n        function getErasedSignature(signature) {\n            if (!signature.typeParameters)\n                return signature;\n            if (!signature.erasedSignatureCache) {\n                signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), /*eraseTypeParameters*/ true);\n            }\n            return signature.erasedSignatureCache;\n        }\n        function getOrCreateTypeFromSignature(signature) {\n            // There are two ways to declare a construct signature, one is by declaring a class constructor\n            // using the constructor keyword, and the other is declaring a bare construct signature in an\n            // object type literal or interface (using the new keyword). Each way of declaring a constructor\n            // will result in a different declaration kind.\n            if (!signature.isolatedSignatureType) {\n                var isConstructor = signature.declaration.kind === 150 /* Constructor */ || signature.declaration.kind === 154 /* ConstructSignature */;\n                var type = createObjectType(16 /* Anonymous */);\n                type.members = emptySymbols;\n                type.properties = emptyArray;\n                type.callSignatures = !isConstructor ? [signature] : emptyArray;\n                type.constructSignatures = isConstructor ? [signature] : emptyArray;\n                signature.isolatedSignatureType = type;\n            }\n            return signature.isolatedSignatureType;\n        }\n        function getIndexSymbol(symbol) {\n            return symbol.members[\"__index\"];\n        }\n        function getIndexDeclarationOfSymbol(symbol, kind) {\n            var syntaxKind = kind === 1 /* Number */ ? 132 /* NumberKeyword */ : 134 /* StringKeyword */;\n            var indexSymbol = getIndexSymbol(symbol);\n            if (indexSymbol) {\n                for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    var node = decl;\n                    if (node.parameters.length === 1) {\n                        var parameter = node.parameters[0];\n                        if (parameter && parameter.type && parameter.type.kind === syntaxKind) {\n                            return node;\n                        }\n                    }\n                }\n            }\n            return undefined;\n        }\n        function createIndexInfo(type, isReadonly, declaration) {\n            return { type: type, isReadonly: isReadonly, declaration: declaration };\n        }\n        function getIndexInfoOfSymbol(symbol, kind) {\n            var declaration = getIndexDeclarationOfSymbol(symbol, kind);\n            if (declaration) {\n                return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, (ts.getModifierFlags(declaration) & 64 /* Readonly */) !== 0, declaration);\n            }\n            return undefined;\n        }\n        function getConstraintDeclaration(type) {\n            return ts.getDeclarationOfKind(type.symbol, 143 /* TypeParameter */).constraint;\n        }\n        function hasConstraintReferenceTo(type, target) {\n            var checked;\n            while (type && type.flags & 16384 /* TypeParameter */ && !(type.isThisType) && !ts.contains(checked, type)) {\n                if (type === target) {\n                    return true;\n                }\n                (checked || (checked = [])).push(type);\n                var constraintDeclaration = getConstraintDeclaration(type);\n                type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration);\n            }\n            return false;\n        }\n        function getConstraintOfTypeParameter(typeParameter) {\n            if (!typeParameter.constraint) {\n                if (typeParameter.target) {\n                    var targetConstraint = getConstraintOfTypeParameter(typeParameter.target);\n                    typeParameter.constraint = targetConstraint ? instantiateType(targetConstraint, typeParameter.mapper) : noConstraintType;\n                }\n                else {\n                    var constraintDeclaration = getConstraintDeclaration(typeParameter);\n                    var constraint = getTypeFromTypeNode(constraintDeclaration);\n                    if (hasConstraintReferenceTo(constraint, typeParameter)) {\n                        error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter));\n                        constraint = unknownType;\n                    }\n                    typeParameter.constraint = constraint;\n                }\n            }\n            return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint;\n        }\n        function getParentSymbolOfTypeParameter(typeParameter) {\n            return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143 /* TypeParameter */).parent);\n        }\n        function getTypeListId(types) {\n            var result = \"\";\n            if (types) {\n                var length_3 = types.length;\n                var i = 0;\n                while (i < length_3) {\n                    var startId = types[i].id;\n                    var count = 1;\n                    while (i + count < length_3 && types[i + count].id === startId + count) {\n                        count++;\n                    }\n                    if (result.length) {\n                        result += \",\";\n                    }\n                    result += startId;\n                    if (count > 1) {\n                        result += \":\" + count;\n                    }\n                    i += count;\n                }\n            }\n            return result;\n        }\n        // This function is used to propagate certain flags when creating new object type references and union types.\n        // It is only necessary to do so if a constituent type might be the undefined type, the null type, the type\n        // of an object literal or the anyFunctionType. This is because there are operations in the type checker\n        // that care about the presence of such types at arbitrary depth in a containing type.\n        function getPropagatingFlagsOfTypes(types, excludeKinds) {\n            var result = 0;\n            for (var _i = 0, types_3 = types; _i < types_3.length; _i++) {\n                var type = types_3[_i];\n                if (!(type.flags & excludeKinds)) {\n                    result |= type.flags;\n                }\n            }\n            return result & 14680064 /* PropagatingFlags */;\n        }\n        function createTypeReference(target, typeArguments) {\n            var id = getTypeListId(typeArguments);\n            var type = target.instantiations[id];\n            if (!type) {\n                type = target.instantiations[id] = createObjectType(4 /* Reference */, target.symbol);\n                type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, /*excludeKinds*/ 0) : 0;\n                type.target = target;\n                type.typeArguments = typeArguments;\n            }\n            return type;\n        }\n        function cloneTypeReference(source) {\n            var type = createType(source.flags);\n            type.symbol = source.symbol;\n            type.objectFlags = source.objectFlags;\n            type.target = source.target;\n            type.typeArguments = source.typeArguments;\n            return type;\n        }\n        function getTypeReferenceArity(type) {\n            return type.target.typeParameters ? type.target.typeParameters.length : 0;\n        }\n        // Get type from reference to class or interface\n        function getTypeFromClassOrInterfaceReference(node, symbol) {\n            var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol));\n            var typeParameters = type.localTypeParameters;\n            if (typeParameters) {\n                if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) {\n                    error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */), typeParameters.length);\n                    return unknownType;\n                }\n                // In a type reference, the outer type parameters of the referenced class or interface are automatically\n                // supplied as type arguments and the type reference only specifies arguments for the local type parameters\n                // of the class or interface.\n                return createTypeReference(type, ts.concatenate(type.outerTypeParameters, ts.map(node.typeArguments, getTypeFromTypeNode)));\n            }\n            if (node.typeArguments) {\n                error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type));\n                return unknownType;\n            }\n            return type;\n        }\n        function getTypeAliasInstantiation(symbol, typeArguments) {\n            var type = getDeclaredTypeOfSymbol(symbol);\n            var links = getSymbolLinks(symbol);\n            var typeParameters = links.typeParameters;\n            var id = getTypeListId(typeArguments);\n            return links.instantiations[id] || (links.instantiations[id] = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments)));\n        }\n        // Get type from reference to type alias. When a type alias is generic, the declared type of the type alias may include\n        // references to the type parameters of the alias. We replace those with the actual type arguments by instantiating the\n        // declared type. Instantiations are cached using the type identities of the type arguments as the key.\n        function getTypeFromTypeAliasReference(node, symbol) {\n            var type = getDeclaredTypeOfSymbol(symbol);\n            var typeParameters = getSymbolLinks(symbol).typeParameters;\n            if (typeParameters) {\n                if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) {\n                    error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, symbolToString(symbol), typeParameters.length);\n                    return unknownType;\n                }\n                var typeArguments = ts.map(node.typeArguments, getTypeFromTypeNode);\n                return getTypeAliasInstantiation(symbol, typeArguments);\n            }\n            if (node.typeArguments) {\n                error(node, ts.Diagnostics.Type_0_is_not_generic, symbolToString(symbol));\n                return unknownType;\n            }\n            return type;\n        }\n        // Get type from reference to named type that cannot be generic (enum or type parameter)\n        function getTypeFromNonGenericTypeReference(node, symbol) {\n            if (node.typeArguments) {\n                error(node, ts.Diagnostics.Type_0_is_not_generic, symbolToString(symbol));\n                return unknownType;\n            }\n            return getDeclaredTypeOfSymbol(symbol);\n        }\n        function getTypeReferenceName(node) {\n            switch (node.kind) {\n                case 157 /* TypeReference */:\n                    return node.typeName;\n                case 272 /* JSDocTypeReference */:\n                    return node.name;\n                case 199 /* ExpressionWithTypeArguments */:\n                    // We only support expressions that are simple qualified names. For other\n                    // expressions this produces undefined.\n                    var expr = node.expression;\n                    if (ts.isEntityNameExpression(expr)) {\n                        return expr;\n                    }\n            }\n            return undefined;\n        }\n        function resolveTypeReferenceName(typeReferenceName) {\n            if (!typeReferenceName) {\n                return unknownSymbol;\n            }\n            return resolveEntityName(typeReferenceName, 793064 /* Type */) || unknownSymbol;\n        }\n        function getTypeReferenceType(node, symbol) {\n            if (symbol === unknownSymbol) {\n                return unknownType;\n            }\n            if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) {\n                return getTypeFromClassOrInterfaceReference(node, symbol);\n            }\n            if (symbol.flags & 524288 /* TypeAlias */) {\n                return getTypeFromTypeAliasReference(node, symbol);\n            }\n            if (symbol.flags & 107455 /* Value */ && node.kind === 272 /* JSDocTypeReference */) {\n                // A JSDocTypeReference may have resolved to a value (as opposed to a type). In\n                // that case, the type of this reference is just the type of the value we resolved\n                // to.\n                return getTypeOfSymbol(symbol);\n            }\n            return getTypeFromNonGenericTypeReference(node, symbol);\n        }\n        function getTypeFromTypeReference(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                var symbol = void 0;\n                var type = void 0;\n                if (node.kind === 272 /* JSDocTypeReference */) {\n                    var typeReferenceName = getTypeReferenceName(node);\n                    symbol = resolveTypeReferenceName(typeReferenceName);\n                    type = getTypeReferenceType(node, symbol);\n                }\n                else {\n                    // We only support expressions that are simple qualified names. For other expressions this produces undefined.\n                    var typeNameOrExpression = node.kind === 157 /* TypeReference */\n                        ? node.typeName\n                        : ts.isEntityNameExpression(node.expression)\n                            ? node.expression\n                            : undefined;\n                    symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793064 /* Type */) || unknownSymbol;\n                    type = symbol === unknownSymbol ? unknownType :\n                        symbol.flags & (32 /* Class */ | 64 /* Interface */) ? getTypeFromClassOrInterfaceReference(node, symbol) :\n                            symbol.flags & 524288 /* TypeAlias */ ? getTypeFromTypeAliasReference(node, symbol) :\n                                getTypeFromNonGenericTypeReference(node, symbol);\n                }\n                // Cache both the resolved symbol and the resolved type. The resolved symbol is needed in when we check the\n                // type reference in checkTypeReferenceOrExpressionWithTypeArguments.\n                links.resolvedSymbol = symbol;\n                links.resolvedType = type;\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromTypeQueryNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                // TypeScript 1.0 spec (April 2014): 3.6.3\n                // The expression is processed as an identifier expression (section 4.3)\n                // or property access expression(section 4.10),\n                // the widened type(section 3.9) of which becomes the result.\n                links.resolvedType = getWidenedType(checkExpression(node.exprName));\n            }\n            return links.resolvedType;\n        }\n        function getTypeOfGlobalSymbol(symbol, arity) {\n            function getTypeDeclaration(symbol) {\n                var declarations = symbol.declarations;\n                for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) {\n                    var declaration = declarations_3[_i];\n                    switch (declaration.kind) {\n                        case 226 /* ClassDeclaration */:\n                        case 227 /* InterfaceDeclaration */:\n                        case 229 /* EnumDeclaration */:\n                            return declaration;\n                    }\n                }\n            }\n            if (!symbol) {\n                return arity ? emptyGenericType : emptyObjectType;\n            }\n            var type = getDeclaredTypeOfSymbol(symbol);\n            if (!(type.flags & 32768 /* Object */)) {\n                error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name);\n                return arity ? emptyGenericType : emptyObjectType;\n            }\n            if ((type.typeParameters ? type.typeParameters.length : 0) !== arity) {\n                error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbol.name, arity);\n                return arity ? emptyGenericType : emptyObjectType;\n            }\n            return type;\n        }\n        function getGlobalValueSymbol(name) {\n            return getGlobalSymbol(name, 107455 /* Value */, ts.Diagnostics.Cannot_find_global_value_0);\n        }\n        function getGlobalTypeSymbol(name) {\n            return getGlobalSymbol(name, 793064 /* Type */, ts.Diagnostics.Cannot_find_global_type_0);\n        }\n        function getGlobalSymbol(name, meaning, diagnostic) {\n            return resolveName(undefined, name, meaning, diagnostic, name);\n        }\n        function getGlobalType(name, arity) {\n            if (arity === void 0) { arity = 0; }\n            return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), arity);\n        }\n        /**\n         * Returns a type that is inside a namespace at the global scope, e.g.\n         * getExportedTypeFromNamespace('JSX', 'Element') returns the JSX.Element type\n         */\n        function getExportedTypeFromNamespace(namespace, name) {\n            var namespaceSymbol = getGlobalSymbol(namespace, 1920 /* Namespace */, /*diagnosticMessage*/ undefined);\n            var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793064 /* Type */);\n            return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol);\n        }\n        /**\n          * Creates a TypeReference for a generic `TypedPropertyDescriptor<T>`.\n          */\n        function createTypedPropertyDescriptorType(propertyType) {\n            var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType();\n            return globalTypedPropertyDescriptorType !== emptyGenericType\n                ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType])\n                : emptyObjectType;\n        }\n        /**\n         * Instantiates a global type that is generic with some element type, and returns that instantiation.\n         */\n        function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) {\n            return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType;\n        }\n        function createIterableType(elementType) {\n            return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]);\n        }\n        function createIterableIteratorType(elementType) {\n            return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]);\n        }\n        function createArrayType(elementType) {\n            return createTypeFromGenericGlobalType(globalArrayType, [elementType]);\n        }\n        function getTypeFromArrayTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType));\n            }\n            return links.resolvedType;\n        }\n        // We represent tuple types as type references to synthesized generic interface types created by\n        // this function. The types are of the form:\n        //\n        //   interface Tuple<T0, T1, T2, ...> extends Array<T0 | T1 | T2 | ...> { 0: T0, 1: T1, 2: T2, ... }\n        //\n        // Note that the generic type created by this function has no symbol associated with it. The same\n        // is true for each of the synthesized type parameters.\n        function createTupleTypeOfArity(arity) {\n            var typeParameters = [];\n            var properties = [];\n            for (var i = 0; i < arity; i++) {\n                var typeParameter = createType(16384 /* TypeParameter */);\n                typeParameters.push(typeParameter);\n                var property = createSymbol(4 /* Property */ | 67108864 /* Transient */, \"\" + i);\n                property.type = typeParameter;\n                properties.push(property);\n            }\n            var type = createObjectType(8 /* Tuple */ | 4 /* Reference */);\n            type.typeParameters = typeParameters;\n            type.outerTypeParameters = undefined;\n            type.localTypeParameters = typeParameters;\n            type.instantiations = ts.createMap();\n            type.instantiations[getTypeListId(type.typeParameters)] = type;\n            type.target = type;\n            type.typeArguments = type.typeParameters;\n            type.thisType = createType(16384 /* TypeParameter */);\n            type.thisType.isThisType = true;\n            type.thisType.constraint = type;\n            type.declaredProperties = properties;\n            type.declaredCallSignatures = emptyArray;\n            type.declaredConstructSignatures = emptyArray;\n            type.declaredStringIndexInfo = undefined;\n            type.declaredNumberIndexInfo = undefined;\n            return type;\n        }\n        function getTupleTypeOfArity(arity) {\n            return tupleTypes[arity] || (tupleTypes[arity] = createTupleTypeOfArity(arity));\n        }\n        function createTupleType(elementTypes) {\n            return createTypeReference(getTupleTypeOfArity(elementTypes.length), elementTypes);\n        }\n        function getTypeFromTupleTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode));\n            }\n            return links.resolvedType;\n        }\n        function binarySearchTypes(types, type) {\n            var low = 0;\n            var high = types.length - 1;\n            var typeId = type.id;\n            while (low <= high) {\n                var middle = low + ((high - low) >> 1);\n                var id = types[middle].id;\n                if (id === typeId) {\n                    return middle;\n                }\n                else if (id > typeId) {\n                    high = middle - 1;\n                }\n                else {\n                    low = middle + 1;\n                }\n            }\n            return ~low;\n        }\n        function containsType(types, type) {\n            return binarySearchTypes(types, type) >= 0;\n        }\n        function addTypeToUnion(typeSet, type) {\n            var flags = type.flags;\n            if (flags & 65536 /* Union */) {\n                addTypesToUnion(typeSet, type.types);\n            }\n            else if (flags & 1 /* Any */) {\n                typeSet.containsAny = true;\n            }\n            else if (!strictNullChecks && flags & 6144 /* Nullable */) {\n                if (flags & 2048 /* Undefined */)\n                    typeSet.containsUndefined = true;\n                if (flags & 4096 /* Null */)\n                    typeSet.containsNull = true;\n                if (!(flags & 2097152 /* ContainsWideningType */))\n                    typeSet.containsNonWideningType = true;\n            }\n            else if (!(flags & 8192 /* Never */)) {\n                if (flags & 2 /* String */)\n                    typeSet.containsString = true;\n                if (flags & 4 /* Number */)\n                    typeSet.containsNumber = true;\n                if (flags & 96 /* StringOrNumberLiteral */)\n                    typeSet.containsStringOrNumberLiteral = true;\n                var len = typeSet.length;\n                var index = len && type.id > typeSet[len - 1].id ? ~len : binarySearchTypes(typeSet, type);\n                if (index < 0) {\n                    if (!(flags & 32768 /* Object */ && type.objectFlags & 16 /* Anonymous */ &&\n                        type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */) && containsIdenticalType(typeSet, type))) {\n                        typeSet.splice(~index, 0, type);\n                    }\n                }\n            }\n        }\n        // Add the given types to the given type set. Order is preserved, duplicates are removed,\n        // and nested types of the given kind are flattened into the set.\n        function addTypesToUnion(typeSet, types) {\n            for (var _i = 0, types_4 = types; _i < types_4.length; _i++) {\n                var type = types_4[_i];\n                addTypeToUnion(typeSet, type);\n            }\n        }\n        function containsIdenticalType(types, type) {\n            for (var _i = 0, types_5 = types; _i < types_5.length; _i++) {\n                var t = types_5[_i];\n                if (isTypeIdenticalTo(t, type)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function isSubtypeOfAny(candidate, types) {\n            for (var i = 0, len = types.length; i < len; i++) {\n                if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function isSetOfLiteralsFromSameEnum(types) {\n            var first = types[0];\n            if (first.flags & 256 /* EnumLiteral */) {\n                var firstEnum = getParentOfSymbol(first.symbol);\n                for (var i = 1; i < types.length; i++) {\n                    var other = types[i];\n                    if (!(other.flags & 256 /* EnumLiteral */) || (firstEnum !== getParentOfSymbol(other.symbol))) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            return false;\n        }\n        function removeSubtypes(types) {\n            if (types.length === 0 || isSetOfLiteralsFromSameEnum(types)) {\n                return;\n            }\n            var i = types.length;\n            while (i > 0) {\n                i--;\n                if (isSubtypeOfAny(types[i], types)) {\n                    ts.orderedRemoveItemAt(types, i);\n                }\n            }\n        }\n        function removeRedundantLiteralTypes(types) {\n            var i = types.length;\n            while (i > 0) {\n                i--;\n                var t = types[i];\n                var remove = t.flags & 32 /* StringLiteral */ && types.containsString ||\n                    t.flags & 64 /* NumberLiteral */ && types.containsNumber ||\n                    t.flags & 96 /* StringOrNumberLiteral */ && t.flags & 1048576 /* FreshLiteral */ && containsType(types, t.regularType);\n                if (remove) {\n                    ts.orderedRemoveItemAt(types, i);\n                }\n            }\n        }\n        // We sort and deduplicate the constituent types based on object identity. If the subtypeReduction\n        // flag is specified we also reduce the constituent type set to only include types that aren't subtypes\n        // of other types. Subtype reduction is expensive for large union types and is possible only when union\n        // types are known not to circularly reference themselves (as is the case with union types created by\n        // expression constructs such as array literals and the || and ?: operators). Named types can\n        // circularly reference themselves and therefore cannot be subtype reduced during their declaration.\n        // For example, \"type Item = string | (() => Item\" is a named type that circularly references itself.\n        function getUnionType(types, subtypeReduction, aliasSymbol, aliasTypeArguments) {\n            if (types.length === 0) {\n                return neverType;\n            }\n            if (types.length === 1) {\n                return types[0];\n            }\n            var typeSet = [];\n            addTypesToUnion(typeSet, types);\n            if (typeSet.containsAny) {\n                return anyType;\n            }\n            if (subtypeReduction) {\n                removeSubtypes(typeSet);\n            }\n            else if (typeSet.containsStringOrNumberLiteral) {\n                removeRedundantLiteralTypes(typeSet);\n            }\n            if (typeSet.length === 0) {\n                return typeSet.containsNull ? typeSet.containsNonWideningType ? nullType : nullWideningType :\n                    typeSet.containsUndefined ? typeSet.containsNonWideningType ? undefinedType : undefinedWideningType :\n                        neverType;\n            }\n            return getUnionTypeFromSortedList(typeSet, aliasSymbol, aliasTypeArguments);\n        }\n        // This function assumes the constituent type list is sorted and deduplicated.\n        function getUnionTypeFromSortedList(types, aliasSymbol, aliasTypeArguments) {\n            if (types.length === 0) {\n                return neverType;\n            }\n            if (types.length === 1) {\n                return types[0];\n            }\n            var id = getTypeListId(types);\n            var type = unionTypes[id];\n            if (!type) {\n                var propagatedFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 6144 /* Nullable */);\n                type = unionTypes[id] = createType(65536 /* Union */ | propagatedFlags);\n                type.types = types;\n                type.aliasSymbol = aliasSymbol;\n                type.aliasTypeArguments = aliasTypeArguments;\n            }\n            return type;\n        }\n        function getTypeFromUnionTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), /*subtypeReduction*/ false, getAliasSymbolForTypeNode(node), getAliasTypeArgumentsForTypeNode(node));\n            }\n            return links.resolvedType;\n        }\n        function addTypeToIntersection(typeSet, type) {\n            if (type.flags & 131072 /* Intersection */) {\n                addTypesToIntersection(typeSet, type.types);\n            }\n            else if (type.flags & 1 /* Any */) {\n                typeSet.containsAny = true;\n            }\n            else if (!(type.flags & 8192 /* Never */) && (strictNullChecks || !(type.flags & 6144 /* Nullable */)) && !ts.contains(typeSet, type)) {\n                if (type.flags & 65536 /* Union */ && typeSet.unionIndex === undefined) {\n                    typeSet.unionIndex = typeSet.length;\n                }\n                typeSet.push(type);\n            }\n        }\n        // Add the given types to the given type set. Order is preserved, duplicates are removed,\n        // and nested types of the given kind are flattened into the set.\n        function addTypesToIntersection(typeSet, types) {\n            for (var _i = 0, types_6 = types; _i < types_6.length; _i++) {\n                var type = types_6[_i];\n                addTypeToIntersection(typeSet, type);\n            }\n        }\n        // We normalize combinations of intersection and union types based on the distributive property of the '&'\n        // operator. Specifically, because X & (A | B) is equivalent to X & A | X & B, we can transform intersection\n        // types with union type constituents into equivalent union types with intersection type constituents and\n        // effectively ensure that union types are always at the top level in type representations.\n        //\n        // We do not perform structural deduplication on intersection types. Intersection types are created only by the &\n        // type operator and we can't reduce those because we want to support recursive intersection types. For example,\n        // a type alias of the form \"type List<T> = T & { next: List<T> }\" cannot be reduced during its declaration.\n        // Also, unlike union types, the order of the constituent types is preserved in order that overload resolution\n        // for intersections of types with signatures can be deterministic.\n        function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {\n            if (types.length === 0) {\n                return emptyObjectType;\n            }\n            var typeSet = [];\n            addTypesToIntersection(typeSet, types);\n            if (typeSet.containsAny) {\n                return anyType;\n            }\n            if (typeSet.length === 1) {\n                return typeSet[0];\n            }\n            var unionIndex = typeSet.unionIndex;\n            if (unionIndex !== undefined) {\n                // We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of\n                // the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain.\n                var unionType = typeSet[unionIndex];\n                return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex, t)); }), \n                /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments);\n            }\n            var id = getTypeListId(typeSet);\n            var type = intersectionTypes[id];\n            if (!type) {\n                var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 6144 /* Nullable */);\n                type = intersectionTypes[id] = createType(131072 /* Intersection */ | propagatedFlags);\n                type.types = typeSet;\n                type.aliasSymbol = aliasSymbol;\n                type.aliasTypeArguments = aliasTypeArguments;\n            }\n            return type;\n        }\n        function getTypeFromIntersectionTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), getAliasSymbolForTypeNode(node), getAliasTypeArgumentsForTypeNode(node));\n            }\n            return links.resolvedType;\n        }\n        function getIndexTypeForGenericType(type) {\n            if (!type.resolvedIndexType) {\n                type.resolvedIndexType = createType(262144 /* Index */);\n                type.resolvedIndexType.type = type;\n            }\n            return type.resolvedIndexType;\n        }\n        function getLiteralTypeFromPropertyName(prop) {\n            return getDeclarationModifierFlagsFromSymbol(prop) & 24 /* NonPublicAccessibilityModifier */ || ts.startsWith(prop.name, \"__@\") ?\n                neverType :\n                getLiteralTypeForText(32 /* StringLiteral */, ts.unescapeIdentifier(prop.name));\n        }\n        function getLiteralTypeFromPropertyNames(type) {\n            return getUnionType(ts.map(getPropertiesOfType(type), getLiteralTypeFromPropertyName));\n        }\n        function getIndexType(type) {\n            return maybeTypeOfKind(type, 540672 /* TypeVariable */) ? getIndexTypeForGenericType(type) :\n                getObjectFlags(type) & 32 /* Mapped */ ? getConstraintTypeFromMappedType(type) :\n                    type.flags & 1 /* Any */ || getIndexInfoOfType(type, 0 /* String */) ? stringType :\n                        getLiteralTypeFromPropertyNames(type);\n        }\n        function getIndexTypeOrString(type) {\n            var indexType = getIndexType(type);\n            return indexType !== neverType ? indexType : stringType;\n        }\n        function getTypeFromTypeOperatorNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getIndexType(getTypeFromTypeNode(node.type));\n            }\n            return links.resolvedType;\n        }\n        function createIndexedAccessType(objectType, indexType) {\n            var type = createType(524288 /* IndexedAccess */);\n            type.objectType = objectType;\n            type.indexType = indexType;\n            return type;\n        }\n        function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) {\n            var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined;\n            var propName = indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */ | 256 /* EnumLiteral */) ?\n                indexType.text :\n                accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ?\n                    ts.getPropertyNameForKnownSymbolName(accessExpression.argumentExpression.name.text) :\n                    undefined;\n            if (propName) {\n                var prop = getPropertyOfType(objectType, propName);\n                if (prop) {\n                    if (accessExpression) {\n                        if (ts.isAssignmentTarget(accessExpression) && (isReferenceToReadonlyEntity(accessExpression, prop) || isReferenceThroughNamespaceImport(accessExpression))) {\n                            error(accessExpression.argumentExpression, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(prop));\n                            return unknownType;\n                        }\n                        if (cacheSymbol) {\n                            getNodeLinks(accessNode).resolvedSymbol = prop;\n                        }\n                    }\n                    return getTypeOfSymbol(prop);\n                }\n            }\n            if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 262178 /* StringLike */ | 340 /* NumberLike */ | 512 /* ESSymbol */)) {\n                if (isTypeAny(objectType)) {\n                    return anyType;\n                }\n                var indexInfo = isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 /* NumberLike */) && getIndexInfoOfType(objectType, 1 /* Number */) ||\n                    getIndexInfoOfType(objectType, 0 /* String */) ||\n                    undefined;\n                if (indexInfo) {\n                    if (accessExpression && ts.isAssignmentTarget(accessExpression) && indexInfo.isReadonly) {\n                        error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));\n                        return unknownType;\n                    }\n                    return indexInfo.type;\n                }\n                if (accessExpression && !isConstEnumObjectType(objectType)) {\n                    if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) {\n                        if (getIndexTypeOfType(objectType, 1 /* Number */)) {\n                            error(accessExpression.argumentExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number);\n                        }\n                        else {\n                            error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(objectType));\n                        }\n                    }\n                    return anyType;\n                }\n            }\n            if (accessNode) {\n                var indexNode = accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.indexType;\n                if (indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */)) {\n                    error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.text, typeToString(objectType));\n                }\n                else if (indexType.flags & (2 /* String */ | 4 /* Number */)) {\n                    error(indexNode, ts.Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType));\n                }\n                else {\n                    error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));\n                }\n            }\n            return unknownType;\n        }\n        function getIndexedAccessForMappedType(type, indexType, accessNode) {\n            var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined;\n            if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) {\n                error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type));\n                return unknownType;\n            }\n            var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType);\n            var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper;\n            return instantiateType(getTemplateTypeFromMappedType(type), templateMapper);\n        }\n        function getIndexedAccessType(objectType, indexType, accessNode) {\n            if (maybeTypeOfKind(indexType, 540672 /* TypeVariable */ | 262144 /* Index */) || isGenericMappedType(objectType)) {\n                if (objectType.flags & 1 /* Any */) {\n                    return objectType;\n                }\n                // If the index type is generic or if the object type is a mapped type with a generic constraint,\n                // we are performing a higher-order index access where we cannot meaningfully access the properties\n                // of the object type. In those cases, we first check that the index type is assignable to 'keyof T'\n                // for the object type.\n                if (accessNode) {\n                    if (!isTypeAssignableTo(indexType, getIndexType(objectType))) {\n                        error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));\n                        return unknownType;\n                    }\n                }\n                // If the object type is a mapped type { [P in K]: E }, we instantiate E using a mapper that substitutes\n                // the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we construct the\n                // type Box<T[X]>.\n                if (isGenericMappedType(objectType)) {\n                    return getIndexedAccessForMappedType(objectType, indexType, accessNode);\n                }\n                // Otherwise we defer the operation by creating an indexed access type.\n                var id = objectType.id + \",\" + indexType.id;\n                return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType));\n            }\n            var apparentObjectType = getApparentType(objectType);\n            if (indexType.flags & 65536 /* Union */ && !(indexType.flags & 8190 /* Primitive */)) {\n                var propTypes = [];\n                for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) {\n                    var t = _a[_i];\n                    var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, /*cacheSymbol*/ false);\n                    if (propType === unknownType) {\n                        return unknownType;\n                    }\n                    propTypes.push(propType);\n                }\n                return getUnionType(propTypes);\n            }\n            return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, /*cacheSymbol*/ true);\n        }\n        function getTypeFromIndexedAccessTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getIndexedAccessType(getTypeFromTypeNode(node.objectType), getTypeFromTypeNode(node.indexType), node);\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromMappedTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                var type = createObjectType(32 /* Mapped */, node.symbol);\n                type.declaration = node;\n                type.aliasSymbol = getAliasSymbolForTypeNode(node);\n                type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node);\n                links.resolvedType = type;\n                // Eagerly resolve the constraint type which forces an error if the constraint type circularly\n                // references itself through one or more type aliases.\n                getConstraintTypeFromMappedType(type);\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                // Deferred resolution of members is handled by resolveObjectTypeMembers\n                var aliasSymbol = getAliasSymbolForTypeNode(node);\n                if (ts.isEmpty(node.symbol.members) && !aliasSymbol) {\n                    links.resolvedType = emptyTypeLiteralType;\n                }\n                else {\n                    var type = createObjectType(16 /* Anonymous */, node.symbol);\n                    type.aliasSymbol = aliasSymbol;\n                    type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node);\n                    links.resolvedType = type;\n                }\n            }\n            return links.resolvedType;\n        }\n        function getAliasSymbolForTypeNode(node) {\n            return node.parent.kind === 228 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined;\n        }\n        function getAliasTypeArgumentsForTypeNode(node) {\n            var symbol = getAliasSymbolForTypeNode(node);\n            return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : undefined;\n        }\n        /**\n         * Since the source of spread types are object literals, which are not binary,\n         * this function should be called in a left folding style, with left = previous result of getSpreadType\n         * and right = the new element to be spread.\n         */\n        function getSpreadType(left, right, isFromObjectLiteral) {\n            if (left.flags & 1 /* Any */ || right.flags & 1 /* Any */) {\n                return anyType;\n            }\n            left = filterType(left, function (t) { return !(t.flags & 6144 /* Nullable */); });\n            if (left.flags & 8192 /* Never */) {\n                return right;\n            }\n            right = filterType(right, function (t) { return !(t.flags & 6144 /* Nullable */); });\n            if (right.flags & 8192 /* Never */) {\n                return left;\n            }\n            if (left.flags & 65536 /* Union */) {\n                return mapType(left, function (t) { return getSpreadType(t, right, isFromObjectLiteral); });\n            }\n            if (right.flags & 65536 /* Union */) {\n                return mapType(right, function (t) { return getSpreadType(left, t, isFromObjectLiteral); });\n            }\n            var members = ts.createMap();\n            var skippedPrivateMembers = ts.createMap();\n            var stringIndexInfo;\n            var numberIndexInfo;\n            if (left === emptyObjectType) {\n                // for the first spread element, left === emptyObjectType, so take the right's string indexer\n                stringIndexInfo = getIndexInfoOfType(right, 0 /* String */);\n                numberIndexInfo = getIndexInfoOfType(right, 1 /* Number */);\n            }\n            else {\n                stringIndexInfo = unionSpreadIndexInfos(getIndexInfoOfType(left, 0 /* String */), getIndexInfoOfType(right, 0 /* String */));\n                numberIndexInfo = unionSpreadIndexInfos(getIndexInfoOfType(left, 1 /* Number */), getIndexInfoOfType(right, 1 /* Number */));\n            }\n            for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) {\n                var rightProp = _a[_i];\n                // we approximate own properties as non-methods plus methods that are inside the object literal\n                var isOwnProperty = !(rightProp.flags & 8192 /* Method */) || isFromObjectLiteral;\n                var isSetterWithoutGetter = rightProp.flags & 65536 /* SetAccessor */ && !(rightProp.flags & 32768 /* GetAccessor */);\n                if (getDeclarationModifierFlagsFromSymbol(rightProp) & (8 /* Private */ | 16 /* Protected */)) {\n                    skippedPrivateMembers[rightProp.name] = true;\n                }\n                else if (isOwnProperty && !isSetterWithoutGetter) {\n                    members[rightProp.name] = rightProp;\n                }\n            }\n            for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) {\n                var leftProp = _c[_b];\n                if (leftProp.flags & 65536 /* SetAccessor */ && !(leftProp.flags & 32768 /* GetAccessor */)\n                    || leftProp.name in skippedPrivateMembers) {\n                    continue;\n                }\n                if (leftProp.name in members) {\n                    var rightProp = members[leftProp.name];\n                    var rightType = getTypeOfSymbol(rightProp);\n                    if (maybeTypeOfKind(rightType, 2048 /* Undefined */) || rightProp.flags & 536870912 /* Optional */) {\n                        var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations);\n                        var flags = 4 /* Property */ | 67108864 /* Transient */ | (leftProp.flags & 536870912 /* Optional */);\n                        var result = createSymbol(flags, leftProp.name);\n                        result.type = getUnionType([getTypeOfSymbol(leftProp), getTypeWithFacts(rightType, 131072 /* NEUndefined */)]);\n                        result.leftSpread = leftProp;\n                        result.rightSpread = rightProp;\n                        result.declarations = declarations;\n                        result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp);\n                        members[leftProp.name] = result;\n                    }\n                }\n                else {\n                    members[leftProp.name] = leftProp;\n                }\n            }\n            return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);\n        }\n        function createLiteralType(flags, text) {\n            var type = createType(flags);\n            type.text = text;\n            return type;\n        }\n        function getFreshTypeOfLiteralType(type) {\n            if (type.flags & 96 /* StringOrNumberLiteral */ && !(type.flags & 1048576 /* FreshLiteral */)) {\n                if (!type.freshType) {\n                    var freshType = createLiteralType(type.flags | 1048576 /* FreshLiteral */, type.text);\n                    freshType.regularType = type;\n                    type.freshType = freshType;\n                }\n                return type.freshType;\n            }\n            return type;\n        }\n        function getRegularTypeOfLiteralType(type) {\n            return type.flags & 96 /* StringOrNumberLiteral */ && type.flags & 1048576 /* FreshLiteral */ ? type.regularType : type;\n        }\n        function getLiteralTypeForText(flags, text) {\n            var map = flags & 32 /* StringLiteral */ ? stringLiteralTypes : numericLiteralTypes;\n            return map[text] || (map[text] = createLiteralType(flags, text));\n        }\n        function getTypeFromLiteralTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getRegularTypeOfLiteralType(checkExpression(node.literal));\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromJSDocVariadicType(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                var type = getTypeFromTypeNode(node.type);\n                links.resolvedType = type ? createArrayType(type) : unknownType;\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromJSDocTupleType(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                var types = ts.map(node.types, getTypeFromTypeNode);\n                links.resolvedType = createTupleType(types);\n            }\n            return links.resolvedType;\n        }\n        function getThisType(node) {\n            var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);\n            var parent = container && container.parent;\n            if (parent && (ts.isClassLike(parent) || parent.kind === 227 /* InterfaceDeclaration */)) {\n                if (!(ts.getModifierFlags(container) & 32 /* Static */) &&\n                    (container.kind !== 150 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) {\n                    return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType;\n                }\n            }\n            error(node, ts.Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface);\n            return unknownType;\n        }\n        function getTypeFromThisTypeNode(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                links.resolvedType = getThisType(node);\n            }\n            return links.resolvedType;\n        }\n        function getTypeFromTypeNode(node) {\n            switch (node.kind) {\n                case 118 /* AnyKeyword */:\n                case 263 /* JSDocAllType */:\n                case 264 /* JSDocUnknownType */:\n                    return anyType;\n                case 134 /* StringKeyword */:\n                    return stringType;\n                case 132 /* NumberKeyword */:\n                    return numberType;\n                case 121 /* BooleanKeyword */:\n                    return booleanType;\n                case 135 /* SymbolKeyword */:\n                    return esSymbolType;\n                case 104 /* VoidKeyword */:\n                    return voidType;\n                case 137 /* UndefinedKeyword */:\n                    return undefinedType;\n                case 94 /* NullKeyword */:\n                    return nullType;\n                case 129 /* NeverKeyword */:\n                    return neverType;\n                case 289 /* JSDocNullKeyword */:\n                    return nullType;\n                case 290 /* JSDocUndefinedKeyword */:\n                    return undefinedType;\n                case 291 /* JSDocNeverKeyword */:\n                    return neverType;\n                case 167 /* ThisType */:\n                case 98 /* ThisKeyword */:\n                    return getTypeFromThisTypeNode(node);\n                case 171 /* LiteralType */:\n                    return getTypeFromLiteralTypeNode(node);\n                case 288 /* JSDocLiteralType */:\n                    return getTypeFromLiteralTypeNode(node.literal);\n                case 157 /* TypeReference */:\n                case 272 /* JSDocTypeReference */:\n                    return getTypeFromTypeReference(node);\n                case 156 /* TypePredicate */:\n                    return booleanType;\n                case 199 /* ExpressionWithTypeArguments */:\n                    return getTypeFromTypeReference(node);\n                case 160 /* TypeQuery */:\n                    return getTypeFromTypeQueryNode(node);\n                case 162 /* ArrayType */:\n                case 265 /* JSDocArrayType */:\n                    return getTypeFromArrayTypeNode(node);\n                case 163 /* TupleType */:\n                    return getTypeFromTupleTypeNode(node);\n                case 164 /* UnionType */:\n                case 266 /* JSDocUnionType */:\n                    return getTypeFromUnionTypeNode(node);\n                case 165 /* IntersectionType */:\n                    return getTypeFromIntersectionTypeNode(node);\n                case 166 /* ParenthesizedType */:\n                case 268 /* JSDocNullableType */:\n                case 269 /* JSDocNonNullableType */:\n                case 276 /* JSDocConstructorType */:\n                case 277 /* JSDocThisType */:\n                case 273 /* JSDocOptionalType */:\n                    return getTypeFromTypeNode(node.type);\n                case 270 /* JSDocRecordType */:\n                    return getTypeFromTypeNode(node.literal);\n                case 158 /* FunctionType */:\n                case 159 /* ConstructorType */:\n                case 161 /* TypeLiteral */:\n                case 287 /* JSDocTypeLiteral */:\n                case 274 /* JSDocFunctionType */:\n                    return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);\n                case 168 /* TypeOperator */:\n                    return getTypeFromTypeOperatorNode(node);\n                case 169 /* IndexedAccessType */:\n                    return getTypeFromIndexedAccessTypeNode(node);\n                case 170 /* MappedType */:\n                    return getTypeFromMappedTypeNode(node);\n                // This function assumes that an identifier or qualified name is a type expression\n                // Callers should first ensure this by calling isTypeNode\n                case 70 /* Identifier */:\n                case 141 /* QualifiedName */:\n                    var symbol = getSymbolAtLocation(node);\n                    return symbol && getDeclaredTypeOfSymbol(symbol);\n                case 267 /* JSDocTupleType */:\n                    return getTypeFromJSDocTupleType(node);\n                case 275 /* JSDocVariadicType */:\n                    return getTypeFromJSDocVariadicType(node);\n                default:\n                    return unknownType;\n            }\n        }\n        function instantiateList(items, mapper, instantiator) {\n            if (items && items.length) {\n                var result = [];\n                for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {\n                    var v = items_1[_i];\n                    result.push(instantiator(v, mapper));\n                }\n                return result;\n            }\n            return items;\n        }\n        function instantiateTypes(types, mapper) {\n            return instantiateList(types, mapper, instantiateType);\n        }\n        function instantiateSignatures(signatures, mapper) {\n            return instantiateList(signatures, mapper, instantiateSignature);\n        }\n        function instantiateCached(type, mapper, instantiator) {\n            var instantiations = mapper.instantiations || (mapper.instantiations = []);\n            return instantiations[type.id] || (instantiations[type.id] = instantiator(type, mapper));\n        }\n        function createUnaryTypeMapper(source, target) {\n            return function (t) { return t === source ? target : t; };\n        }\n        function createBinaryTypeMapper(source1, target1, source2, target2) {\n            return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; };\n        }\n        function createArrayTypeMapper(sources, targets) {\n            return function (t) {\n                for (var i = 0; i < sources.length; i++) {\n                    if (t === sources[i]) {\n                        return targets ? targets[i] : anyType;\n                    }\n                }\n                return t;\n            };\n        }\n        function createTypeMapper(sources, targets) {\n            var count = sources.length;\n            var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) :\n                count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) :\n                    createArrayTypeMapper(sources, targets);\n            mapper.mappedTypes = sources;\n            return mapper;\n        }\n        function createTypeEraser(sources) {\n            return createTypeMapper(sources, undefined);\n        }\n        function getInferenceMapper(context) {\n            if (!context.mapper) {\n                var mapper = function (t) {\n                    var typeParameters = context.signature.typeParameters;\n                    for (var i = 0; i < typeParameters.length; i++) {\n                        if (t === typeParameters[i]) {\n                            context.inferences[i].isFixed = true;\n                            return getInferredType(context, i);\n                        }\n                    }\n                    return t;\n                };\n                mapper.mappedTypes = context.signature.typeParameters;\n                mapper.context = context;\n                context.mapper = mapper;\n            }\n            return context.mapper;\n        }\n        function identityMapper(type) {\n            return type;\n        }\n        function combineTypeMappers(mapper1, mapper2) {\n            var mapper = function (t) { return instantiateType(mapper1(t), mapper2); };\n            mapper.mappedTypes = mapper1.mappedTypes;\n            return mapper;\n        }\n        function cloneTypeParameter(typeParameter) {\n            var result = createType(16384 /* TypeParameter */);\n            result.symbol = typeParameter.symbol;\n            result.target = typeParameter;\n            return result;\n        }\n        function cloneTypePredicate(predicate, mapper) {\n            if (ts.isIdentifierTypePredicate(predicate)) {\n                return {\n                    kind: 1 /* Identifier */,\n                    parameterName: predicate.parameterName,\n                    parameterIndex: predicate.parameterIndex,\n                    type: instantiateType(predicate.type, mapper)\n                };\n            }\n            else {\n                return {\n                    kind: 0 /* This */,\n                    type: instantiateType(predicate.type, mapper)\n                };\n            }\n        }\n        function instantiateSignature(signature, mapper, eraseTypeParameters) {\n            var freshTypeParameters;\n            var freshTypePredicate;\n            if (signature.typeParameters && !eraseTypeParameters) {\n                // First create a fresh set of type parameters, then include a mapping from the old to the\n                // new type parameters in the mapper function. Finally store this mapper in the new type\n                // parameters such that we can use it when instantiating constraints.\n                freshTypeParameters = ts.map(signature.typeParameters, cloneTypeParameter);\n                mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper);\n                for (var _i = 0, freshTypeParameters_1 = freshTypeParameters; _i < freshTypeParameters_1.length; _i++) {\n                    var tp = freshTypeParameters_1[_i];\n                    tp.mapper = mapper;\n                }\n            }\n            if (signature.typePredicate) {\n                freshTypePredicate = cloneTypePredicate(signature.typePredicate, mapper);\n            }\n            var result = createSignature(signature.declaration, freshTypeParameters, signature.thisParameter && instantiateSymbol(signature.thisParameter, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasLiteralTypes);\n            result.target = signature;\n            result.mapper = mapper;\n            return result;\n        }\n        function instantiateSymbol(symbol, mapper) {\n            if (symbol.flags & 16777216 /* Instantiated */) {\n                var links = getSymbolLinks(symbol);\n                // If symbol being instantiated is itself a instantiation, fetch the original target and combine the\n                // type mappers. This ensures that original type identities are properly preserved and that aliases\n                // always reference a non-aliases.\n                symbol = links.target;\n                mapper = combineTypeMappers(links.mapper, mapper);\n            }\n            // Keep the flags from the symbol we're instantiating.  Mark that is instantiated, and\n            // also transient so that we can just store data on it directly.\n            var result = createSymbol(16777216 /* Instantiated */ | 67108864 /* Transient */ | symbol.flags, symbol.name);\n            result.declarations = symbol.declarations;\n            result.parent = symbol.parent;\n            result.target = symbol;\n            result.mapper = mapper;\n            if (symbol.valueDeclaration) {\n                result.valueDeclaration = symbol.valueDeclaration;\n            }\n            return result;\n        }\n        function instantiateAnonymousType(type, mapper) {\n            var result = createObjectType(16 /* Anonymous */ | 64 /* Instantiated */, type.symbol);\n            result.target = type.objectFlags & 64 /* Instantiated */ ? type.target : type;\n            result.mapper = type.objectFlags & 64 /* Instantiated */ ? combineTypeMappers(type.mapper, mapper) : mapper;\n            result.aliasSymbol = type.aliasSymbol;\n            result.aliasTypeArguments = instantiateTypes(type.aliasTypeArguments, mapper);\n            return result;\n        }\n        function instantiateMappedType(type, mapper) {\n            // Check if we have a homomorphic mapped type, i.e. a type of the form { [P in keyof T]: X } for some\n            // type variable T. If so, the mapped type is distributive over a union type and when T is instantiated\n            // to a union type A | B, we produce { [P in keyof A]: X } | { [P in keyof B]: X }. Furthermore, for\n            // homomorphic mapped types we leave primitive types alone. For example, when T is instantiated to a\n            // union type A | undefined, we produce { [P in keyof A]: X } | undefined.\n            var constraintType = getConstraintTypeFromMappedType(type);\n            if (constraintType.flags & 262144 /* Index */) {\n                var typeVariable_1 = constraintType.type;\n                var mappedTypeVariable = instantiateType(typeVariable_1, mapper);\n                if (typeVariable_1 !== mappedTypeVariable) {\n                    return mapType(mappedTypeVariable, function (t) {\n                        if (isMappableType(t)) {\n                            var replacementMapper = createUnaryTypeMapper(typeVariable_1, t);\n                            var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper);\n                            combinedMapper.mappedTypes = mapper.mappedTypes;\n                            return instantiateMappedObjectType(type, combinedMapper);\n                        }\n                        return t;\n                    });\n                }\n            }\n            return instantiateMappedObjectType(type, mapper);\n        }\n        function isMappableType(type) {\n            return type.flags & (16384 /* TypeParameter */ | 32768 /* Object */ | 131072 /* Intersection */ | 524288 /* IndexedAccess */);\n        }\n        function instantiateMappedObjectType(type, mapper) {\n            var result = createObjectType(32 /* Mapped */ | 64 /* Instantiated */, type.symbol);\n            result.declaration = type.declaration;\n            result.mapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper;\n            result.aliasSymbol = type.aliasSymbol;\n            result.aliasTypeArguments = instantiateTypes(type.aliasTypeArguments, mapper);\n            return result;\n        }\n        function isSymbolInScopeOfMappedTypeParameter(symbol, mapper) {\n            if (!(symbol.declarations && symbol.declarations.length)) {\n                return false;\n            }\n            var mappedTypes = mapper.mappedTypes;\n            // Starting with the parent of the symbol's declaration, check if the mapper maps any of\n            // the type parameters introduced by enclosing declarations. We just pick the first\n            // declaration since multiple declarations will all have the same parent anyway.\n            var node = symbol.declarations[0].parent;\n            while (node) {\n                switch (node.kind) {\n                    case 158 /* FunctionType */:\n                    case 159 /* ConstructorType */:\n                    case 225 /* FunctionDeclaration */:\n                    case 149 /* MethodDeclaration */:\n                    case 148 /* MethodSignature */:\n                    case 150 /* Constructor */:\n                    case 153 /* CallSignature */:\n                    case 154 /* ConstructSignature */:\n                    case 155 /* IndexSignature */:\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                    case 184 /* FunctionExpression */:\n                    case 185 /* ArrowFunction */:\n                    case 226 /* ClassDeclaration */:\n                    case 197 /* ClassExpression */:\n                    case 227 /* InterfaceDeclaration */:\n                    case 228 /* TypeAliasDeclaration */:\n                        var declaration = node;\n                        if (declaration.typeParameters) {\n                            for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) {\n                                var d = _a[_i];\n                                if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) {\n                                    return true;\n                                }\n                            }\n                        }\n                        if (ts.isClassLike(node) || node.kind === 227 /* InterfaceDeclaration */) {\n                            var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType;\n                            if (thisType && ts.contains(mappedTypes, thisType)) {\n                                return true;\n                            }\n                        }\n                        break;\n                    case 230 /* ModuleDeclaration */:\n                    case 261 /* SourceFile */:\n                        return false;\n                }\n                node = node.parent;\n            }\n            return false;\n        }\n        function isTopLevelTypeAlias(symbol) {\n            if (symbol.declarations && symbol.declarations.length) {\n                var parentKind = symbol.declarations[0].parent.kind;\n                return parentKind === 261 /* SourceFile */ || parentKind === 231 /* ModuleBlock */;\n            }\n            return false;\n        }\n        function instantiateType(type, mapper) {\n            if (type && mapper !== identityMapper) {\n                // If we are instantiating a type that has a top-level type alias, obtain the instantiation through\n                // the type alias instead in order to share instantiations for the same type arguments. This can\n                // dramatically reduce the number of structurally identical types we generate. Note that we can only\n                // perform this optimization for top-level type aliases. Consider:\n                //\n                //   function f1<T>(x: T) {\n                //     type Foo<X> = { x: X, t: T };\n                //     let obj: Foo<T> = { x: x };\n                //     return obj;\n                //   }\n                //   function f2<U>(x: U) { return f1(x); }\n                //   let z = f2(42);\n                //\n                // Above, the declaration of f2 has an inferred return type that is an instantiation of f1's Foo<X>\n                // equivalent to { x: U, t: U }. When instantiating this return type, we can't go back to Foo<X>'s\n                // cache because all cached instantiations are of the form { x: ???, t: T }, i.e. they have not been\n                // instantiated for T. Instead, we need to further instantiate the { x: U, t: U } form.\n                if (type.aliasSymbol && isTopLevelTypeAlias(type.aliasSymbol)) {\n                    if (type.aliasTypeArguments) {\n                        return getTypeAliasInstantiation(type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));\n                    }\n                    return type;\n                }\n                return instantiateTypeNoAlias(type, mapper);\n            }\n            return type;\n        }\n        function instantiateTypeNoAlias(type, mapper) {\n            if (type.flags & 16384 /* TypeParameter */) {\n                return mapper(type);\n            }\n            if (type.flags & 32768 /* Object */) {\n                if (type.objectFlags & 16 /* Anonymous */) {\n                    // If the anonymous type originates in a declaration of a function, method, class, or\n                    // interface, in an object type literal, or in an object literal expression, we may need\n                    // to instantiate the type because it might reference a type parameter. We skip instantiation\n                    // if none of the type parameters that are in scope in the type's declaration are mapped by\n                    // the given mapper, however we can only do that analysis if the type isn't itself an\n                    // instantiation.\n                    return type.symbol &&\n                        type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) &&\n                        (type.objectFlags & 64 /* Instantiated */ || isSymbolInScopeOfMappedTypeParameter(type.symbol, mapper)) ?\n                        instantiateCached(type, mapper, instantiateAnonymousType) : type;\n                }\n                if (type.objectFlags & 32 /* Mapped */) {\n                    return instantiateCached(type, mapper, instantiateMappedType);\n                }\n                if (type.objectFlags & 4 /* Reference */) {\n                    return createTypeReference(type.target, instantiateTypes(type.typeArguments, mapper));\n                }\n            }\n            if (type.flags & 65536 /* Union */ && !(type.flags & 8190 /* Primitive */)) {\n                return getUnionType(instantiateTypes(type.types, mapper), /*subtypeReduction*/ false, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));\n            }\n            if (type.flags & 131072 /* Intersection */) {\n                return getIntersectionType(instantiateTypes(type.types, mapper), type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));\n            }\n            if (type.flags & 262144 /* Index */) {\n                return getIndexType(instantiateType(type.type, mapper));\n            }\n            if (type.flags & 524288 /* IndexedAccess */) {\n                return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper));\n            }\n            return type;\n        }\n        function instantiateIndexInfo(info, mapper) {\n            return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration);\n        }\n        // Returns true if the given expression contains (at any level of nesting) a function or arrow expression\n        // that is subject to contextual typing.\n        function isContextSensitive(node) {\n            ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));\n            switch (node.kind) {\n                case 184 /* FunctionExpression */:\n                case 185 /* ArrowFunction */:\n                    return isContextSensitiveFunctionLikeDeclaration(node);\n                case 176 /* ObjectLiteralExpression */:\n                    return ts.forEach(node.properties, isContextSensitive);\n                case 175 /* ArrayLiteralExpression */:\n                    return ts.forEach(node.elements, isContextSensitive);\n                case 193 /* ConditionalExpression */:\n                    return isContextSensitive(node.whenTrue) ||\n                        isContextSensitive(node.whenFalse);\n                case 192 /* BinaryExpression */:\n                    return node.operatorToken.kind === 53 /* BarBarToken */ &&\n                        (isContextSensitive(node.left) || isContextSensitive(node.right));\n                case 257 /* PropertyAssignment */:\n                    return isContextSensitive(node.initializer);\n                case 149 /* MethodDeclaration */:\n                case 148 /* MethodSignature */:\n                    return isContextSensitiveFunctionLikeDeclaration(node);\n                case 183 /* ParenthesizedExpression */:\n                    return isContextSensitive(node.expression);\n            }\n            return false;\n        }\n        function isContextSensitiveFunctionLikeDeclaration(node) {\n            // Functions with type parameters are not context sensitive.\n            if (node.typeParameters) {\n                return false;\n            }\n            // Functions with any parameters that lack type annotations are context sensitive.\n            if (ts.forEach(node.parameters, function (p) { return !p.type; })) {\n                return true;\n            }\n            // For arrow functions we now know we're not context sensitive.\n            if (node.kind === 185 /* ArrowFunction */) {\n                return false;\n            }\n            // If the first parameter is not an explicit 'this' parameter, then the function has\n            // an implicit 'this' parameter which is subject to contextual typing. Otherwise we\n            // know that all parameters (including 'this') have type annotations and nothing is\n            // subject to contextual typing.\n            var parameter = ts.firstOrUndefined(node.parameters);\n            return !(parameter && ts.parameterIsThisKeyword(parameter));\n        }\n        function isContextSensitiveFunctionOrObjectLiteralMethod(func) {\n            return (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);\n        }\n        function getTypeWithoutSignatures(type) {\n            if (type.flags & 32768 /* Object */) {\n                var resolved = resolveStructuredTypeMembers(type);\n                if (resolved.constructSignatures.length) {\n                    var result = createObjectType(16 /* Anonymous */, type.symbol);\n                    result.members = resolved.members;\n                    result.properties = resolved.properties;\n                    result.callSignatures = emptyArray;\n                    result.constructSignatures = emptyArray;\n                    type = result;\n                }\n            }\n            return type;\n        }\n        // TYPE CHECKING\n        function isTypeIdenticalTo(source, target) {\n            return isTypeRelatedTo(source, target, identityRelation);\n        }\n        function compareTypesIdentical(source, target) {\n            return isTypeRelatedTo(source, target, identityRelation) ? -1 /* True */ : 0 /* False */;\n        }\n        function compareTypesAssignable(source, target) {\n            return isTypeRelatedTo(source, target, assignableRelation) ? -1 /* True */ : 0 /* False */;\n        }\n        function isTypeSubtypeOf(source, target) {\n            return isTypeRelatedTo(source, target, subtypeRelation);\n        }\n        function isTypeAssignableTo(source, target) {\n            return isTypeRelatedTo(source, target, assignableRelation);\n        }\n        // A type S is considered to be an instance of a type T if S and T are the same type or if S is a\n        // subtype of T but not structurally identical to T. This specifically means that two distinct but\n        // structurally identical types (such as two classes) are not considered instances of each other.\n        function isTypeInstanceOf(source, target) {\n            return source === target || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target);\n        }\n        /**\n         * This is *not* a bi-directional relationship.\n         * If one needs to check both directions for comparability, use a second call to this function or 'checkTypeComparableTo'.\n         */\n        function isTypeComparableTo(source, target) {\n            return isTypeRelatedTo(source, target, comparableRelation);\n        }\n        function areTypesComparable(type1, type2) {\n            return isTypeComparableTo(type1, type2) || isTypeComparableTo(type2, type1);\n        }\n        function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) {\n            return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain);\n        }\n        function checkTypeAssignableTo(source, target, errorNode, headMessage, containingMessageChain) {\n            return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain);\n        }\n        /**\n         * This is *not* a bi-directional relationship.\n         * If one needs to check both directions for comparability, use a second call to this function or 'isTypeComparableTo'.\n         */\n        function checkTypeComparableTo(source, target, errorNode, headMessage, containingMessageChain) {\n            return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain);\n        }\n        function isSignatureAssignableTo(source, target, ignoreReturnTypes) {\n            return compareSignaturesRelated(source, target, ignoreReturnTypes, /*reportErrors*/ false, /*errorReporter*/ undefined, compareTypesAssignable) !== 0 /* False */;\n        }\n        /**\n         * See signatureRelatedTo, compareSignaturesIdentical\n         */\n        function compareSignaturesRelated(source, target, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) {\n            // TODO (drosen): De-duplicate code between related functions.\n            if (source === target) {\n                return -1 /* True */;\n            }\n            if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) {\n                return 0 /* False */;\n            }\n            // Spec 1.0 Section 3.8.3 & 3.8.4:\n            // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N\n            source = getErasedSignature(source);\n            target = getErasedSignature(target);\n            var result = -1 /* True */;\n            var sourceThisType = getThisTypeOfSignature(source);\n            if (sourceThisType && sourceThisType !== voidType) {\n                var targetThisType = getThisTypeOfSignature(target);\n                if (targetThisType) {\n                    // void sources are assignable to anything.\n                    var related = compareTypes(sourceThisType, targetThisType, /*reportErrors*/ false)\n                        || compareTypes(targetThisType, sourceThisType, reportErrors);\n                    if (!related) {\n                        if (reportErrors) {\n                            errorReporter(ts.Diagnostics.The_this_types_of_each_signature_are_incompatible);\n                        }\n                        return 0 /* False */;\n                    }\n                    result &= related;\n                }\n            }\n            var sourceMax = getNumNonRestParameters(source);\n            var targetMax = getNumNonRestParameters(target);\n            var checkCount = getNumParametersToCheckForSignatureRelatability(source, sourceMax, target, targetMax);\n            var sourceParams = source.parameters;\n            var targetParams = target.parameters;\n            for (var i = 0; i < checkCount; i++) {\n                var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source);\n                var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target);\n                var related = compareTypes(s, t, /*reportErrors*/ false) || compareTypes(t, s, reportErrors);\n                if (!related) {\n                    if (reportErrors) {\n                        errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name);\n                    }\n                    return 0 /* False */;\n                }\n                result &= related;\n            }\n            if (!ignoreReturnTypes) {\n                var targetReturnType = getReturnTypeOfSignature(target);\n                if (targetReturnType === voidType) {\n                    return result;\n                }\n                var sourceReturnType = getReturnTypeOfSignature(source);\n                // The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions\n                if (target.typePredicate) {\n                    if (source.typePredicate) {\n                        result &= compareTypePredicateRelatedTo(source.typePredicate, target.typePredicate, reportErrors, errorReporter, compareTypes);\n                    }\n                    else if (ts.isIdentifierTypePredicate(target.typePredicate)) {\n                        if (reportErrors) {\n                            errorReporter(ts.Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source));\n                        }\n                        return 0 /* False */;\n                    }\n                }\n                else {\n                    result &= compareTypes(sourceReturnType, targetReturnType, reportErrors);\n                }\n            }\n            return result;\n        }\n        function compareTypePredicateRelatedTo(source, target, reportErrors, errorReporter, compareTypes) {\n            if (source.kind !== target.kind) {\n                if (reportErrors) {\n                    errorReporter(ts.Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard);\n                    errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target));\n                }\n                return 0 /* False */;\n            }\n            if (source.kind === 1 /* Identifier */) {\n                var sourceIdentifierPredicate = source;\n                var targetIdentifierPredicate = target;\n                if (sourceIdentifierPredicate.parameterIndex !== targetIdentifierPredicate.parameterIndex) {\n                    if (reportErrors) {\n                        errorReporter(ts.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, sourceIdentifierPredicate.parameterName, targetIdentifierPredicate.parameterName);\n                        errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target));\n                    }\n                    return 0 /* False */;\n                }\n            }\n            var related = compareTypes(source.type, target.type, reportErrors);\n            if (related === 0 /* False */ && reportErrors) {\n                errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target));\n            }\n            return related;\n        }\n        function isImplementationCompatibleWithOverload(implementation, overload) {\n            var erasedSource = getErasedSignature(implementation);\n            var erasedTarget = getErasedSignature(overload);\n            // First see if the return types are compatible in either direction.\n            var sourceReturnType = getReturnTypeOfSignature(erasedSource);\n            var targetReturnType = getReturnTypeOfSignature(erasedTarget);\n            if (targetReturnType === voidType\n                || isTypeRelatedTo(targetReturnType, sourceReturnType, assignableRelation)\n                || isTypeRelatedTo(sourceReturnType, targetReturnType, assignableRelation)) {\n                return isSignatureAssignableTo(erasedSource, erasedTarget, /*ignoreReturnTypes*/ true);\n            }\n            return false;\n        }\n        function getNumNonRestParameters(signature) {\n            var numParams = signature.parameters.length;\n            return signature.hasRestParameter ?\n                numParams - 1 :\n                numParams;\n        }\n        function getNumParametersToCheckForSignatureRelatability(source, sourceNonRestParamCount, target, targetNonRestParamCount) {\n            if (source.hasRestParameter === target.hasRestParameter) {\n                if (source.hasRestParameter) {\n                    // If both have rest parameters, get the max and add 1 to\n                    // compensate for the rest parameter.\n                    return Math.max(sourceNonRestParamCount, targetNonRestParamCount) + 1;\n                }\n                else {\n                    return Math.min(sourceNonRestParamCount, targetNonRestParamCount);\n                }\n            }\n            else {\n                // Return the count for whichever signature doesn't have rest parameters.\n                return source.hasRestParameter ?\n                    targetNonRestParamCount :\n                    sourceNonRestParamCount;\n            }\n        }\n        function isEnumTypeRelatedTo(source, target, errorReporter) {\n            if (source === target) {\n                return true;\n            }\n            var id = source.id + \",\" + target.id;\n            if (enumRelation[id] !== undefined) {\n                return enumRelation[id];\n            }\n            if (source.symbol.name !== target.symbol.name ||\n                !(source.symbol.flags & 256 /* RegularEnum */) || !(target.symbol.flags & 256 /* RegularEnum */) ||\n                (source.flags & 65536 /* Union */) !== (target.flags & 65536 /* Union */)) {\n                return enumRelation[id] = false;\n            }\n            var targetEnumType = getTypeOfSymbol(target.symbol);\n            for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) {\n                var property = _a[_i];\n                if (property.flags & 8 /* EnumMember */) {\n                    var targetProperty = getPropertyOfType(targetEnumType, property.name);\n                    if (!targetProperty || !(targetProperty.flags & 8 /* EnumMember */)) {\n                        if (errorReporter) {\n                            errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */));\n                        }\n                        return enumRelation[id] = false;\n                    }\n                }\n            }\n            return enumRelation[id] = true;\n        }\n        function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {\n            if (target.flags & 8192 /* Never */)\n                return false;\n            if (target.flags & 1 /* Any */ || source.flags & 8192 /* Never */)\n                return true;\n            if (source.flags & 262178 /* StringLike */ && target.flags & 2 /* String */)\n                return true;\n            if (source.flags & 340 /* NumberLike */ && target.flags & 4 /* Number */)\n                return true;\n            if (source.flags & 136 /* BooleanLike */ && target.flags & 8 /* Boolean */)\n                return true;\n            if (source.flags & 256 /* EnumLiteral */ && target.flags & 16 /* Enum */ && source.baseType === target)\n                return true;\n            if (source.flags & 16 /* Enum */ && target.flags & 16 /* Enum */ && isEnumTypeRelatedTo(source, target, errorReporter))\n                return true;\n            if (source.flags & 2048 /* Undefined */ && (!strictNullChecks || target.flags & (2048 /* Undefined */ | 1024 /* Void */)))\n                return true;\n            if (source.flags & 4096 /* Null */ && (!strictNullChecks || target.flags & 4096 /* Null */))\n                return true;\n            if (relation === assignableRelation || relation === comparableRelation) {\n                if (source.flags & 1 /* Any */)\n                    return true;\n                if ((source.flags & 4 /* Number */ | source.flags & 64 /* NumberLiteral */) && target.flags & 272 /* EnumLike */)\n                    return true;\n                if (source.flags & 256 /* EnumLiteral */ &&\n                    target.flags & 256 /* EnumLiteral */ &&\n                    source.text === target.text &&\n                    isEnumTypeRelatedTo(source.baseType, target.baseType, errorReporter)) {\n                    return true;\n                }\n                if (source.flags & 256 /* EnumLiteral */ &&\n                    target.flags & 16 /* Enum */ &&\n                    isEnumTypeRelatedTo(target, source.baseType, errorReporter)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function isTypeRelatedTo(source, target, relation) {\n            if (source.flags & 96 /* StringOrNumberLiteral */ && source.flags & 1048576 /* FreshLiteral */) {\n                source = source.regularType;\n            }\n            if (target.flags & 96 /* StringOrNumberLiteral */ && target.flags & 1048576 /* FreshLiteral */) {\n                target = target.regularType;\n            }\n            if (source === target || relation !== identityRelation && isSimpleTypeRelatedTo(source, target, relation)) {\n                return true;\n            }\n            if (source.flags & 32768 /* Object */ && target.flags & 32768 /* Object */) {\n                var id = relation !== identityRelation || source.id < target.id ? source.id + \",\" + target.id : target.id + \",\" + source.id;\n                var related = relation[id];\n                if (related !== undefined) {\n                    return related === 1 /* Succeeded */;\n                }\n            }\n            if (source.flags & 507904 /* StructuredOrTypeParameter */ || target.flags & 507904 /* StructuredOrTypeParameter */) {\n                return checkTypeRelatedTo(source, target, relation, undefined, undefined, undefined);\n            }\n            return false;\n        }\n        /**\n         * Checks if 'source' is related to 'target' (e.g.: is a assignable to).\n         * @param source The left-hand-side of the relation.\n         * @param target The right-hand-side of the relation.\n         * @param relation The relation considered. One of 'identityRelation', 'subtypeRelation', 'assignableRelation', or 'comparableRelation'.\n         * Used as both to determine which checks are performed and as a cache of previously computed results.\n         * @param errorNode The suggested node upon which all errors will be reported, if defined. This may or may not be the actual node used.\n         * @param headMessage If the error chain should be prepended by a head message, then headMessage will be used.\n         * @param containingMessageChain A chain of errors to prepend any new errors found.\n         */\n        function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain) {\n            var errorInfo;\n            var sourceStack;\n            var targetStack;\n            var maybeStack;\n            var expandingFlags;\n            var depth = 0;\n            var overflow = false;\n            ts.Debug.assert(relation !== identityRelation || !errorNode, \"no error reporting in identity checking\");\n            var result = isRelatedTo(source, target, /*reportErrors*/ !!errorNode, headMessage);\n            if (overflow) {\n                error(errorNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));\n            }\n            else if (errorInfo) {\n                if (containingMessageChain) {\n                    errorInfo = ts.concatenateDiagnosticMessageChains(containingMessageChain, errorInfo);\n                }\n                diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo));\n            }\n            return result !== 0 /* False */;\n            function reportError(message, arg0, arg1, arg2) {\n                ts.Debug.assert(!!errorNode);\n                errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2);\n            }\n            function reportRelationError(message, source, target) {\n                var sourceType = typeToString(source);\n                var targetType = typeToString(target);\n                if (sourceType === targetType) {\n                    sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */);\n                    targetType = typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */);\n                }\n                if (!message) {\n                    if (relation === comparableRelation) {\n                        message = ts.Diagnostics.Type_0_is_not_comparable_to_type_1;\n                    }\n                    else if (sourceType === targetType) {\n                        message = ts.Diagnostics.Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated;\n                    }\n                    else {\n                        message = ts.Diagnostics.Type_0_is_not_assignable_to_type_1;\n                    }\n                }\n                reportError(message, sourceType, targetType);\n            }\n            function tryElaborateErrorsForPrimitivesAndObjects(source, target) {\n                var sourceType = typeToString(source);\n                var targetType = typeToString(target);\n                if ((globalStringType === source && stringType === target) ||\n                    (globalNumberType === source && numberType === target) ||\n                    (globalBooleanType === source && booleanType === target) ||\n                    (getGlobalESSymbolType() === source && esSymbolType === target)) {\n                    reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);\n                }\n            }\n            // Compare two types and return\n            // Ternary.True if they are related with no assumptions,\n            // Ternary.Maybe if they are related with assumptions of other relationships, or\n            // Ternary.False if they are not related.\n            function isRelatedTo(source, target, reportErrors, headMessage) {\n                var result;\n                if (source.flags & 96 /* StringOrNumberLiteral */ && source.flags & 1048576 /* FreshLiteral */) {\n                    source = source.regularType;\n                }\n                if (target.flags & 96 /* StringOrNumberLiteral */ && target.flags & 1048576 /* FreshLiteral */) {\n                    target = target.regularType;\n                }\n                // both types are the same - covers 'they are the same primitive type or both are Any' or the same type parameter cases\n                if (source === target)\n                    return -1 /* True */;\n                if (relation === identityRelation) {\n                    return isIdenticalTo(source, target);\n                }\n                if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))\n                    return -1 /* True */;\n                if (getObjectFlags(source) & 128 /* ObjectLiteral */ && source.flags & 1048576 /* FreshLiteral */) {\n                    if (hasExcessProperties(source, target, reportErrors)) {\n                        if (reportErrors) {\n                            reportRelationError(headMessage, source, target);\n                        }\n                        return 0 /* False */;\n                    }\n                    // Above we check for excess properties with respect to the entire target type. When union\n                    // and intersection types are further deconstructed on the target side, we don't want to\n                    // make the check again (as it might fail for a partial target type). Therefore we obtain\n                    // the regular source type and proceed with that.\n                    if (target.flags & 196608 /* UnionOrIntersection */) {\n                        source = getRegularTypeOfObjectLiteral(source);\n                    }\n                }\n                var saveErrorInfo = errorInfo;\n                // Note that these checks are specifically ordered to produce correct results. In particular,\n                // we need to deconstruct unions before intersections (because unions are always at the top),\n                // and we need to handle \"each\" relations before \"some\" relations for the same kind of type.\n                if (source.flags & 65536 /* Union */) {\n                    if (relation === comparableRelation) {\n                        result = someTypeRelatedToType(source, target, reportErrors && !(source.flags & 8190 /* Primitive */));\n                    }\n                    else {\n                        result = eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 8190 /* Primitive */));\n                    }\n                    if (result) {\n                        return result;\n                    }\n                }\n                else if (target.flags & 65536 /* Union */) {\n                    if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 8190 /* Primitive */) && !(target.flags & 8190 /* Primitive */))) {\n                        return result;\n                    }\n                }\n                else if (target.flags & 131072 /* Intersection */) {\n                    if (result = typeRelatedToEachType(source, target, reportErrors)) {\n                        return result;\n                    }\n                }\n                else if (source.flags & 131072 /* Intersection */) {\n                    // Check to see if any constituents of the intersection are immediately related to the target.\n                    //\n                    // Don't report errors though. Checking whether a constituent is related to the source is not actually\n                    // useful and leads to some confusing error messages. Instead it is better to let the below checks\n                    // take care of this, or to not elaborate at all. For instance,\n                    //\n                    //    - For an object type (such as 'C = A & B'), users are usually more interested in structural errors.\n                    //\n                    //    - For a union type (such as '(A | B) = (C & D)'), it's better to hold onto the whole intersection\n                    //          than to report that 'D' is not assignable to 'A' or 'B'.\n                    //\n                    //    - For a primitive type or type parameter (such as 'number = A & B') there is no point in\n                    //          breaking the intersection apart.\n                    if (result = someTypeRelatedToType(source, target, /*reportErrors*/ false)) {\n                        return result;\n                    }\n                }\n                if (target.flags & 16384 /* TypeParameter */) {\n                    // A source type { [P in keyof T]: X } is related to a target type T if X is related to T[P].\n                    if (getObjectFlags(source) & 32 /* Mapped */ && getConstraintTypeFromMappedType(source) === getIndexType(target)) {\n                        if (!source.declaration.questionToken) {\n                            var templateType = getTemplateTypeFromMappedType(source);\n                            var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source));\n                            if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) {\n                                return result;\n                            }\n                        }\n                    }\n                    else {\n                        // Given a type parameter K with a constraint keyof T, a type S is\n                        // assignable to K if S is assignable to keyof T.\n                        var constraint = getConstraintOfTypeParameter(target);\n                        if (constraint && constraint.flags & 262144 /* Index */) {\n                            if (result = isRelatedTo(source, constraint, reportErrors)) {\n                                return result;\n                            }\n                        }\n                    }\n                }\n                else if (target.flags & 262144 /* Index */) {\n                    // A keyof S is related to a keyof T if T is related to S.\n                    if (source.flags & 262144 /* Index */) {\n                        if (result = isRelatedTo(target.type, source.type, /*reportErrors*/ false)) {\n                            return result;\n                        }\n                    }\n                    // Given a type parameter T with a constraint C, a type S is assignable to\n                    // keyof T if S is assignable to keyof C.\n                    if (target.type.flags & 16384 /* TypeParameter */) {\n                        var constraint = getConstraintOfTypeParameter(target.type);\n                        if (constraint) {\n                            if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) {\n                                return result;\n                            }\n                        }\n                    }\n                }\n                else if (target.flags & 524288 /* IndexedAccess */) {\n                    // if we have indexed access types with identical index types, see if relationship holds for\n                    // the two object types.\n                    if (source.flags & 524288 /* IndexedAccess */ && source.indexType === target.indexType) {\n                        if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) {\n                            return result;\n                        }\n                    }\n                }\n                if (source.flags & 16384 /* TypeParameter */) {\n                    // A source type T is related to a target type { [P in keyof T]: X } if T[P] is related to X.\n                    if (getObjectFlags(target) & 32 /* Mapped */ && getConstraintTypeFromMappedType(target) === getIndexType(source)) {\n                        var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target));\n                        var templateType = getTemplateTypeFromMappedType(target);\n                        if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) {\n                            return result;\n                        }\n                    }\n                    else {\n                        var constraint = getConstraintOfTypeParameter(source);\n                        if (!constraint || constraint.flags & 1 /* Any */) {\n                            constraint = emptyObjectType;\n                        }\n                        // The constraint may need to be further instantiated with its 'this' type.\n                        constraint = getTypeWithThisArgument(constraint, source);\n                        // Report constraint errors only if the constraint is not the empty object type\n                        var reportConstraintErrors = reportErrors && constraint !== emptyObjectType;\n                        if (result = isRelatedTo(constraint, target, reportConstraintErrors)) {\n                            errorInfo = saveErrorInfo;\n                            return result;\n                        }\n                    }\n                }\n                else {\n                    if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) {\n                        // We have type references to same target type, see if relationship holds for all type arguments\n                        if (result = typeArgumentsRelatedTo(source, target, reportErrors)) {\n                            return result;\n                        }\n                    }\n                    // Even if relationship doesn't hold for unions, intersections, or generic type references,\n                    // it may hold in a structural comparison.\n                    var apparentSource = getApparentType(source);\n                    // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates\n                    // to X. Failing both of those we want to check if the aggregation of A and B's members structurally\n                    // relates to X. Thus, we include intersection types on the source side here.\n                    if (apparentSource.flags & (32768 /* Object */ | 131072 /* Intersection */) && target.flags & 32768 /* Object */) {\n                        // Report structural errors only if we haven't reported any errors yet\n                        var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190 /* Primitive */);\n                        if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) {\n                            errorInfo = saveErrorInfo;\n                            return result;\n                        }\n                    }\n                }\n                if (reportErrors) {\n                    if (source.flags & 32768 /* Object */ && target.flags & 8190 /* Primitive */) {\n                        tryElaborateErrorsForPrimitivesAndObjects(source, target);\n                    }\n                    else if (source.symbol && source.flags & 32768 /* Object */ && globalObjectType === source) {\n                        reportError(ts.Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);\n                    }\n                    reportRelationError(headMessage, source, target);\n                }\n                return 0 /* False */;\n            }\n            function isIdenticalTo(source, target) {\n                var result;\n                if (source.flags & 32768 /* Object */ && target.flags & 32768 /* Object */) {\n                    if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) {\n                        // We have type references to same target type, see if all type arguments are identical\n                        if (result = typeArgumentsRelatedTo(source, target, /*reportErrors*/ false)) {\n                            return result;\n                        }\n                    }\n                    return objectTypeRelatedTo(source, source, target, /*reportErrors*/ false);\n                }\n                if (source.flags & 65536 /* Union */ && target.flags & 65536 /* Union */ ||\n                    source.flags & 131072 /* Intersection */ && target.flags & 131072 /* Intersection */) {\n                    if (result = eachTypeRelatedToSomeType(source, target)) {\n                        if (result &= eachTypeRelatedToSomeType(target, source)) {\n                            return result;\n                        }\n                    }\n                }\n                return 0 /* False */;\n            }\n            // Check if a property with the given name is known anywhere in the given type. In an object type, a property\n            // is considered known if the object type is empty and the check is for assignability, if the object type has\n            // index signatures, or if the property is actually declared in the object type. In a union or intersection\n            // type, a property is considered known if it is known in any constituent type.\n            function isKnownProperty(type, name) {\n                if (type.flags & 32768 /* Object */) {\n                    var resolved = resolveStructuredTypeMembers(type);\n                    if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyObjectType(resolved)) ||\n                        resolved.stringIndexInfo ||\n                        (resolved.numberIndexInfo && isNumericLiteralName(name)) ||\n                        getPropertyOfType(type, name)) {\n                        return true;\n                    }\n                }\n                else if (type.flags & 196608 /* UnionOrIntersection */) {\n                    for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                        var t = _a[_i];\n                        if (isKnownProperty(t, name)) {\n                            return true;\n                        }\n                    }\n                }\n                return false;\n            }\n            function isEmptyObjectType(t) {\n                return t.properties.length === 0 &&\n                    t.callSignatures.length === 0 &&\n                    t.constructSignatures.length === 0 &&\n                    !t.stringIndexInfo &&\n                    !t.numberIndexInfo;\n            }\n            function hasExcessProperties(source, target, reportErrors) {\n                if (maybeTypeOfKind(target, 32768 /* Object */) && !(getObjectFlags(target) & 512 /* ObjectLiteralPatternWithComputedProperties */)) {\n                    for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {\n                        var prop = _a[_i];\n                        if (!isKnownProperty(target, prop.name)) {\n                            if (reportErrors) {\n                                // We know *exactly* where things went wrong when comparing the types.\n                                // Use this property as the error node as this will be more helpful in\n                                // reasoning about what went wrong.\n                                ts.Debug.assert(!!errorNode);\n                                errorNode = prop.valueDeclaration;\n                                reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target));\n                            }\n                            return true;\n                        }\n                    }\n                }\n                return false;\n            }\n            function eachTypeRelatedToSomeType(source, target) {\n                var result = -1 /* True */;\n                var sourceTypes = source.types;\n                for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) {\n                    var sourceType = sourceTypes_1[_i];\n                    var related = typeRelatedToSomeType(sourceType, target, /*reportErrors*/ false);\n                    if (!related) {\n                        return 0 /* False */;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            function typeRelatedToSomeType(source, target, reportErrors) {\n                var targetTypes = target.types;\n                if (target.flags & 65536 /* Union */ && containsType(targetTypes, source)) {\n                    return -1 /* True */;\n                }\n                var len = targetTypes.length;\n                for (var i = 0; i < len; i++) {\n                    var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1);\n                    if (related) {\n                        return related;\n                    }\n                }\n                return 0 /* False */;\n            }\n            function typeRelatedToEachType(source, target, reportErrors) {\n                var result = -1 /* True */;\n                var targetTypes = target.types;\n                for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) {\n                    var targetType = targetTypes_1[_i];\n                    var related = isRelatedTo(source, targetType, reportErrors);\n                    if (!related) {\n                        return 0 /* False */;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            function someTypeRelatedToType(source, target, reportErrors) {\n                var sourceTypes = source.types;\n                if (source.flags & 65536 /* Union */ && containsType(sourceTypes, target)) {\n                    return -1 /* True */;\n                }\n                var len = sourceTypes.length;\n                for (var i = 0; i < len; i++) {\n                    var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1);\n                    if (related) {\n                        return related;\n                    }\n                }\n                return 0 /* False */;\n            }\n            function eachTypeRelatedToType(source, target, reportErrors) {\n                var result = -1 /* True */;\n                var sourceTypes = source.types;\n                for (var _i = 0, sourceTypes_2 = sourceTypes; _i < sourceTypes_2.length; _i++) {\n                    var sourceType = sourceTypes_2[_i];\n                    var related = isRelatedTo(sourceType, target, reportErrors);\n                    if (!related) {\n                        return 0 /* False */;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            function typeArgumentsRelatedTo(source, target, reportErrors) {\n                var sources = source.typeArguments || emptyArray;\n                var targets = target.typeArguments || emptyArray;\n                if (sources.length !== targets.length && relation === identityRelation) {\n                    return 0 /* False */;\n                }\n                var length = sources.length <= targets.length ? sources.length : targets.length;\n                var result = -1 /* True */;\n                for (var i = 0; i < length; i++) {\n                    var related = isRelatedTo(sources[i], targets[i], reportErrors);\n                    if (!related) {\n                        return 0 /* False */;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            // Determine if two object types are related by structure. First, check if the result is already available in the global cache.\n            // Second, check if we have already started a comparison of the given two types in which case we assume the result to be true.\n            // Third, check if both types are part of deeply nested chains of generic type instantiations and if so assume the types are\n            // equal and infinitely expanding. Fourth, if we have reached a depth of 100 nested comparisons, assume we have runaway recursion\n            // and issue an error. Otherwise, actually compare the structure of the two types.\n            function objectTypeRelatedTo(source, originalSource, target, reportErrors) {\n                if (overflow) {\n                    return 0 /* False */;\n                }\n                var id = relation !== identityRelation || source.id < target.id ? source.id + \",\" + target.id : target.id + \",\" + source.id;\n                var related = relation[id];\n                if (related !== undefined) {\n                    if (reportErrors && related === 2 /* Failed */) {\n                        // We are elaborating errors and the cached result is an unreported failure. Record the result as a reported\n                        // failure and continue computing the relation such that errors get reported.\n                        relation[id] = 3 /* FailedAndReported */;\n                    }\n                    else {\n                        return related === 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */;\n                    }\n                }\n                if (depth > 0) {\n                    for (var i = 0; i < depth; i++) {\n                        // If source and target are already being compared, consider them related with assumptions\n                        if (maybeStack[i][id]) {\n                            return 1 /* Maybe */;\n                        }\n                    }\n                    if (depth === 100) {\n                        overflow = true;\n                        return 0 /* False */;\n                    }\n                }\n                else {\n                    sourceStack = [];\n                    targetStack = [];\n                    maybeStack = [];\n                    expandingFlags = 0;\n                }\n                sourceStack[depth] = source;\n                targetStack[depth] = target;\n                maybeStack[depth] = ts.createMap();\n                maybeStack[depth][id] = 1 /* Succeeded */;\n                depth++;\n                var saveExpandingFlags = expandingFlags;\n                if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth))\n                    expandingFlags |= 1;\n                if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth))\n                    expandingFlags |= 2;\n                var result;\n                if (expandingFlags === 3) {\n                    result = 1 /* Maybe */;\n                }\n                else if (isGenericMappedType(source) || isGenericMappedType(target)) {\n                    result = mappedTypeRelatedTo(source, target, reportErrors);\n                }\n                else {\n                    result = propertiesRelatedTo(source, target, reportErrors);\n                    if (result) {\n                        result &= signaturesRelatedTo(source, target, 0 /* Call */, reportErrors);\n                        if (result) {\n                            result &= signaturesRelatedTo(source, target, 1 /* Construct */, reportErrors);\n                            if (result) {\n                                result &= indexTypesRelatedTo(source, originalSource, target, 0 /* String */, reportErrors);\n                                if (result) {\n                                    result &= indexTypesRelatedTo(source, originalSource, target, 1 /* Number */, reportErrors);\n                                }\n                            }\n                        }\n                    }\n                }\n                expandingFlags = saveExpandingFlags;\n                depth--;\n                if (result) {\n                    var maybeCache = maybeStack[depth];\n                    // If result is definitely true, copy assumptions to global cache, else copy to next level up\n                    var destinationCache = (result === -1 /* True */ || depth === 0) ? relation : maybeStack[depth - 1];\n                    ts.copyProperties(maybeCache, destinationCache);\n                }\n                else {\n                    // A false result goes straight into global cache (when something is false under assumptions it\n                    // will also be false without assumptions)\n                    relation[id] = reportErrors ? 3 /* FailedAndReported */ : 2 /* Failed */;\n                }\n                return result;\n            }\n            // A type [P in S]: X is related to a type [P in T]: Y if T is related to S and X is related to Y.\n            function mappedTypeRelatedTo(source, target, reportErrors) {\n                if (isGenericMappedType(target)) {\n                    if (isGenericMappedType(source)) {\n                        var result_2;\n                        if (relation === identityRelation) {\n                            var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken;\n                            var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken;\n                            if (readonlyMatches && optionalMatches) {\n                                if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {\n                                    return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors);\n                                }\n                            }\n                        }\n                        else {\n                            if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) {\n                                if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {\n                                    return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors);\n                                }\n                            }\n                        }\n                    }\n                }\n                else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) {\n                    return -1 /* True */;\n                }\n                return 0 /* False */;\n            }\n            function propertiesRelatedTo(source, target, reportErrors) {\n                if (relation === identityRelation) {\n                    return propertiesIdenticalTo(source, target);\n                }\n                var result = -1 /* True */;\n                var properties = getPropertiesOfObjectType(target);\n                var requireOptionalProperties = relation === subtypeRelation && !(getObjectFlags(source) & 128 /* ObjectLiteral */);\n                for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) {\n                    var targetProp = properties_3[_i];\n                    var sourceProp = getPropertyOfType(source, targetProp.name);\n                    if (sourceProp !== targetProp) {\n                        if (!sourceProp) {\n                            if (!(targetProp.flags & 536870912 /* Optional */) || requireOptionalProperties) {\n                                if (reportErrors) {\n                                    reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source));\n                                }\n                                return 0 /* False */;\n                            }\n                        }\n                        else if (!(targetProp.flags & 134217728 /* Prototype */)) {\n                            var sourcePropFlags = getDeclarationModifierFlagsFromSymbol(sourceProp);\n                            var targetPropFlags = getDeclarationModifierFlagsFromSymbol(targetProp);\n                            if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) {\n                                if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) {\n                                    if (reportErrors) {\n                                        if (sourcePropFlags & 8 /* Private */ && targetPropFlags & 8 /* Private */) {\n                                            reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp));\n                                        }\n                                        else {\n                                            reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 8 /* Private */ ? source : target), typeToString(sourcePropFlags & 8 /* Private */ ? target : source));\n                                        }\n                                    }\n                                    return 0 /* False */;\n                                }\n                            }\n                            else if (targetPropFlags & 16 /* Protected */) {\n                                var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32 /* Class */;\n                                var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(getParentOfSymbol(sourceProp)) : undefined;\n                                var targetClass = getDeclaredTypeOfSymbol(getParentOfSymbol(targetProp));\n                                if (!sourceClass || !hasBaseType(sourceClass, targetClass)) {\n                                    if (reportErrors) {\n                                        reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass));\n                                    }\n                                    return 0 /* False */;\n                                }\n                            }\n                            else if (sourcePropFlags & 16 /* Protected */) {\n                                if (reportErrors) {\n                                    reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target));\n                                }\n                                return 0 /* False */;\n                            }\n                            var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors);\n                            if (!related) {\n                                if (reportErrors) {\n                                    reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));\n                                }\n                                return 0 /* False */;\n                            }\n                            result &= related;\n                            // When checking for comparability, be more lenient with optional properties.\n                            if (relation !== comparableRelation && sourceProp.flags & 536870912 /* Optional */ && !(targetProp.flags & 536870912 /* Optional */)) {\n                                // TypeScript 1.0 spec (April 2014): 3.8.3\n                                // S is a subtype of a type T, and T is a supertype of S if ...\n                                // S' and T are object types and, for each member M in T..\n                                // M is a property and S' contains a property N where\n                                // if M is a required property, N is also a required property\n                                // (M - property in T)\n                                // (N - property in S)\n                                if (reportErrors) {\n                                    reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target));\n                                }\n                                return 0 /* False */;\n                            }\n                        }\n                    }\n                }\n                return result;\n            }\n            function propertiesIdenticalTo(source, target) {\n                if (!(source.flags & 32768 /* Object */ && target.flags & 32768 /* Object */)) {\n                    return 0 /* False */;\n                }\n                var sourceProperties = getPropertiesOfObjectType(source);\n                var targetProperties = getPropertiesOfObjectType(target);\n                if (sourceProperties.length !== targetProperties.length) {\n                    return 0 /* False */;\n                }\n                var result = -1 /* True */;\n                for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) {\n                    var sourceProp = sourceProperties_1[_i];\n                    var targetProp = getPropertyOfObjectType(target, sourceProp.name);\n                    if (!targetProp) {\n                        return 0 /* False */;\n                    }\n                    var related = compareProperties(sourceProp, targetProp, isRelatedTo);\n                    if (!related) {\n                        return 0 /* False */;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            function signaturesRelatedTo(source, target, kind, reportErrors) {\n                if (relation === identityRelation) {\n                    return signaturesIdenticalTo(source, target, kind);\n                }\n                if (target === anyFunctionType || source === anyFunctionType) {\n                    return -1 /* True */;\n                }\n                var sourceSignatures = getSignaturesOfType(source, kind);\n                var targetSignatures = getSignaturesOfType(target, kind);\n                if (kind === 1 /* Construct */ && sourceSignatures.length && targetSignatures.length) {\n                    if (isAbstractConstructorType(source) && !isAbstractConstructorType(target)) {\n                        // An abstract constructor type is not assignable to a non-abstract constructor type\n                        // as it would otherwise be possible to new an abstract class. Note that the assignability\n                        // check we perform for an extends clause excludes construct signatures from the target,\n                        // so this check never proceeds.\n                        if (reportErrors) {\n                            reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type);\n                        }\n                        return 0 /* False */;\n                    }\n                    if (!constructorVisibilitiesAreCompatible(sourceSignatures[0], targetSignatures[0], reportErrors)) {\n                        return 0 /* False */;\n                    }\n                }\n                var result = -1 /* True */;\n                var saveErrorInfo = errorInfo;\n                outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) {\n                    var t = targetSignatures_1[_i];\n                    // Only elaborate errors from the first failure\n                    var shouldElaborateErrors = reportErrors;\n                    for (var _a = 0, sourceSignatures_1 = sourceSignatures; _a < sourceSignatures_1.length; _a++) {\n                        var s = sourceSignatures_1[_a];\n                        var related = signatureRelatedTo(s, t, shouldElaborateErrors);\n                        if (related) {\n                            result &= related;\n                            errorInfo = saveErrorInfo;\n                            continue outer;\n                        }\n                        shouldElaborateErrors = false;\n                    }\n                    if (shouldElaborateErrors) {\n                        reportError(ts.Diagnostics.Type_0_provides_no_match_for_the_signature_1, typeToString(source), signatureToString(t, /*enclosingDeclaration*/ undefined, /*flags*/ undefined, kind));\n                    }\n                    return 0 /* False */;\n                }\n                return result;\n            }\n            /**\n             * See signatureAssignableTo, compareSignaturesIdentical\n             */\n            function signatureRelatedTo(source, target, reportErrors) {\n                return compareSignaturesRelated(source, target, /*ignoreReturnTypes*/ false, reportErrors, reportError, isRelatedTo);\n            }\n            function signaturesIdenticalTo(source, target, kind) {\n                var sourceSignatures = getSignaturesOfType(source, kind);\n                var targetSignatures = getSignaturesOfType(target, kind);\n                if (sourceSignatures.length !== targetSignatures.length) {\n                    return 0 /* False */;\n                }\n                var result = -1 /* True */;\n                for (var i = 0, len = sourceSignatures.length; i < len; i++) {\n                    var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, isRelatedTo);\n                    if (!related) {\n                        return 0 /* False */;\n                    }\n                    result &= related;\n                }\n                return result;\n            }\n            function eachPropertyRelatedTo(source, target, kind, reportErrors) {\n                var result = -1 /* True */;\n                for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {\n                    var prop = _a[_i];\n                    if (kind === 0 /* String */ || isNumericLiteralName(prop.name)) {\n                        var related = isRelatedTo(getTypeOfSymbol(prop), target, reportErrors);\n                        if (!related) {\n                            if (reportErrors) {\n                                reportError(ts.Diagnostics.Property_0_is_incompatible_with_index_signature, symbolToString(prop));\n                            }\n                            return 0 /* False */;\n                        }\n                        result &= related;\n                    }\n                }\n                return result;\n            }\n            function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors) {\n                var related = isRelatedTo(sourceInfo.type, targetInfo.type, reportErrors);\n                if (!related && reportErrors) {\n                    reportError(ts.Diagnostics.Index_signatures_are_incompatible);\n                }\n                return related;\n            }\n            function indexTypesRelatedTo(source, originalSource, target, kind, reportErrors) {\n                if (relation === identityRelation) {\n                    return indexTypesIdenticalTo(source, target, kind);\n                }\n                var targetInfo = getIndexInfoOfType(target, kind);\n                if (!targetInfo || ((targetInfo.type.flags & 1 /* Any */) && !(originalSource.flags & 8190 /* Primitive */))) {\n                    // Index signature of type any permits assignment from everything but primitives\n                    return -1 /* True */;\n                }\n                var sourceInfo = getIndexInfoOfType(source, kind) ||\n                    kind === 1 /* Number */ && getIndexInfoOfType(source, 0 /* String */);\n                if (sourceInfo) {\n                    return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors);\n                }\n                if (isObjectLiteralType(source)) {\n                    var related = -1 /* True */;\n                    if (kind === 0 /* String */) {\n                        var sourceNumberInfo = getIndexInfoOfType(source, 1 /* Number */);\n                        if (sourceNumberInfo) {\n                            related = indexInfoRelatedTo(sourceNumberInfo, targetInfo, reportErrors);\n                        }\n                    }\n                    if (related) {\n                        related &= eachPropertyRelatedTo(source, targetInfo.type, kind, reportErrors);\n                    }\n                    return related;\n                }\n                if (reportErrors) {\n                    reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source));\n                }\n                return 0 /* False */;\n            }\n            function indexTypesIdenticalTo(source, target, indexKind) {\n                var targetInfo = getIndexInfoOfType(target, indexKind);\n                var sourceInfo = getIndexInfoOfType(source, indexKind);\n                if (!sourceInfo && !targetInfo) {\n                    return -1 /* True */;\n                }\n                if (sourceInfo && targetInfo && sourceInfo.isReadonly === targetInfo.isReadonly) {\n                    return isRelatedTo(sourceInfo.type, targetInfo.type);\n                }\n                return 0 /* False */;\n            }\n            function constructorVisibilitiesAreCompatible(sourceSignature, targetSignature, reportErrors) {\n                if (!sourceSignature.declaration || !targetSignature.declaration) {\n                    return true;\n                }\n                var sourceAccessibility = ts.getModifierFlags(sourceSignature.declaration) & 24 /* NonPublicAccessibilityModifier */;\n                var targetAccessibility = ts.getModifierFlags(targetSignature.declaration) & 24 /* NonPublicAccessibilityModifier */;\n                // A public, protected and private signature is assignable to a private signature.\n                if (targetAccessibility === 8 /* Private */) {\n                    return true;\n                }\n                // A public and protected signature is assignable to a protected signature.\n                if (targetAccessibility === 16 /* Protected */ && sourceAccessibility !== 8 /* Private */) {\n                    return true;\n                }\n                // Only a public signature is assignable to public signature.\n                if (targetAccessibility !== 16 /* Protected */ && !sourceAccessibility) {\n                    return true;\n                }\n                if (reportErrors) {\n                    reportError(ts.Diagnostics.Cannot_assign_a_0_constructor_type_to_a_1_constructor_type, visibilityToString(sourceAccessibility), visibilityToString(targetAccessibility));\n                }\n                return false;\n            }\n        }\n        // Return true if the given type is the constructor type for an abstract class\n        function isAbstractConstructorType(type) {\n            if (getObjectFlags(type) & 16 /* Anonymous */) {\n                var symbol = type.symbol;\n                if (symbol && symbol.flags & 32 /* Class */) {\n                    var declaration = getClassLikeDeclarationOfSymbol(symbol);\n                    if (declaration && ts.getModifierFlags(declaration) & 128 /* Abstract */) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        // Return true if the given type is part of a deeply nested chain of generic instantiations. We consider this to be the case\n        // when structural type comparisons have been started for 10 or more instantiations of the same generic type. It is possible,\n        // though highly unlikely, for this test to be true in a situation where a chain of instantiations is not infinitely expanding.\n        // Effectively, we will generate a false positive when two types are structurally equal to at least 10 levels, but unequal at\n        // some level beyond that.\n        function isDeeplyNestedGeneric(type, stack, depth) {\n            // We track type references (created by createTypeReference) and instantiated types (created by instantiateType)\n            if (getObjectFlags(type) & (4 /* Reference */ | 64 /* Instantiated */) && depth >= 5) {\n                var symbol = type.symbol;\n                var count = 0;\n                for (var i = 0; i < depth; i++) {\n                    var t = stack[i];\n                    if (getObjectFlags(t) & (4 /* Reference */ | 64 /* Instantiated */) && t.symbol === symbol) {\n                        count++;\n                        if (count >= 5)\n                            return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function isPropertyIdenticalTo(sourceProp, targetProp) {\n            return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */;\n        }\n        function compareProperties(sourceProp, targetProp, compareTypes) {\n            // Two members are considered identical when\n            // - they are public properties with identical names, optionality, and types,\n            // - they are private or protected properties originating in the same declaration and having identical types\n            if (sourceProp === targetProp) {\n                return -1 /* True */;\n            }\n            var sourcePropAccessibility = getDeclarationModifierFlagsFromSymbol(sourceProp) & 24 /* NonPublicAccessibilityModifier */;\n            var targetPropAccessibility = getDeclarationModifierFlagsFromSymbol(targetProp) & 24 /* NonPublicAccessibilityModifier */;\n            if (sourcePropAccessibility !== targetPropAccessibility) {\n                return 0 /* False */;\n            }\n            if (sourcePropAccessibility) {\n                if (getTargetSymbol(sourceProp) !== getTargetSymbol(targetProp)) {\n                    return 0 /* False */;\n                }\n            }\n            else {\n                if ((sourceProp.flags & 536870912 /* Optional */) !== (targetProp.flags & 536870912 /* Optional */)) {\n                    return 0 /* False */;\n                }\n            }\n            if (isReadonlySymbol(sourceProp) !== isReadonlySymbol(targetProp)) {\n                return 0 /* False */;\n            }\n            return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));\n        }\n        function isMatchingSignature(source, target, partialMatch) {\n            // A source signature matches a target signature if the two signatures have the same number of required,\n            // optional, and rest parameters.\n            if (source.parameters.length === target.parameters.length &&\n                source.minArgumentCount === target.minArgumentCount &&\n                source.hasRestParameter === target.hasRestParameter) {\n                return true;\n            }\n            // A source signature partially matches a target signature if the target signature has no fewer required\n            // parameters and no more overall parameters than the source signature (where a signature with a rest\n            // parameter is always considered to have more overall parameters than one without).\n            var sourceRestCount = source.hasRestParameter ? 1 : 0;\n            var targetRestCount = target.hasRestParameter ? 1 : 0;\n            if (partialMatch && source.minArgumentCount <= target.minArgumentCount && (sourceRestCount > targetRestCount ||\n                sourceRestCount === targetRestCount && source.parameters.length >= target.parameters.length)) {\n                return true;\n            }\n            return false;\n        }\n        /**\n         * See signatureRelatedTo, compareSignaturesIdentical\n         */\n        function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) {\n            // TODO (drosen): De-duplicate code between related functions.\n            if (source === target) {\n                return -1 /* True */;\n            }\n            if (!(isMatchingSignature(source, target, partialMatch))) {\n                return 0 /* False */;\n            }\n            // Check that the two signatures have the same number of type parameters. We might consider\n            // also checking that any type parameter constraints match, but that would require instantiating\n            // the constraints with a common set of type arguments to get relatable entities in places where\n            // type parameters occur in the constraints. The complexity of doing that doesn't seem worthwhile,\n            // particularly as we're comparing erased versions of the signatures below.\n            if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) {\n                return 0 /* False */;\n            }\n            // Spec 1.0 Section 3.8.3 & 3.8.4:\n            // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N\n            source = getErasedSignature(source);\n            target = getErasedSignature(target);\n            var result = -1 /* True */;\n            if (!ignoreThisTypes) {\n                var sourceThisType = getThisTypeOfSignature(source);\n                if (sourceThisType) {\n                    var targetThisType = getThisTypeOfSignature(target);\n                    if (targetThisType) {\n                        var related = compareTypes(sourceThisType, targetThisType);\n                        if (!related) {\n                            return 0 /* False */;\n                        }\n                        result &= related;\n                    }\n                }\n            }\n            var targetLen = target.parameters.length;\n            for (var i = 0; i < targetLen; i++) {\n                var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfParameter(source.parameters[i]);\n                var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfParameter(target.parameters[i]);\n                var related = compareTypes(s, t);\n                if (!related) {\n                    return 0 /* False */;\n                }\n                result &= related;\n            }\n            if (!ignoreReturnTypes) {\n                result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));\n            }\n            return result;\n        }\n        function isRestParameterIndex(signature, parameterIndex) {\n            return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1;\n        }\n        function isSupertypeOfEach(candidate, types) {\n            for (var _i = 0, types_7 = types; _i < types_7.length; _i++) {\n                var t = types_7[_i];\n                if (candidate !== t && !isTypeSubtypeOf(t, candidate))\n                    return false;\n            }\n            return true;\n        }\n        function literalTypesWithSameBaseType(types) {\n            var commonBaseType;\n            for (var _i = 0, types_8 = types; _i < types_8.length; _i++) {\n                var t = types_8[_i];\n                var baseType = getBaseTypeOfLiteralType(t);\n                if (!commonBaseType) {\n                    commonBaseType = baseType;\n                }\n                if (baseType === t || baseType !== commonBaseType) {\n                    return false;\n                }\n            }\n            return true;\n        }\n        // When the candidate types are all literal types with the same base type, the common\n        // supertype is a union of those literal types. Otherwise, the common supertype is the\n        // first type that is a supertype of each of the other types.\n        function getSupertypeOrUnion(types) {\n            return literalTypesWithSameBaseType(types) ? getUnionType(types) : ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; });\n        }\n        function getCommonSupertype(types) {\n            if (!strictNullChecks) {\n                return getSupertypeOrUnion(types);\n            }\n            var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 6144 /* Nullable */); });\n            if (!primaryTypes.length) {\n                return getUnionType(types, /*subtypeReduction*/ true);\n            }\n            var supertype = getSupertypeOrUnion(primaryTypes);\n            return supertype && includeFalsyTypes(supertype, getFalsyFlagsOfTypes(types) & 6144 /* Nullable */);\n        }\n        function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) {\n            // The downfallType/bestSupertypeDownfallType is the first type that caused a particular candidate\n            // to not be the common supertype. So if it weren't for this one downfallType (and possibly others),\n            // the type in question could have been the common supertype.\n            var bestSupertype;\n            var bestSupertypeDownfallType;\n            var bestSupertypeScore = 0;\n            for (var i = 0; i < types.length; i++) {\n                var score = 0;\n                var downfallType = undefined;\n                for (var j = 0; j < types.length; j++) {\n                    if (isTypeSubtypeOf(types[j], types[i])) {\n                        score++;\n                    }\n                    else if (!downfallType) {\n                        downfallType = types[j];\n                    }\n                }\n                ts.Debug.assert(!!downfallType, \"If there is no common supertype, each type should have a downfallType\");\n                if (score > bestSupertypeScore) {\n                    bestSupertype = types[i];\n                    bestSupertypeDownfallType = downfallType;\n                    bestSupertypeScore = score;\n                }\n                // types.length - 1 is the maximum score, given that getCommonSupertype returned false\n                if (bestSupertypeScore === types.length - 1) {\n                    break;\n                }\n            }\n            // In the following errors, the {1} slot is before the {0} slot because checkTypeSubtypeOf supplies the\n            // subtype as the first argument to the error\n            checkTypeSubtypeOf(bestSupertypeDownfallType, bestSupertype, errorLocation, ts.Diagnostics.Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0, errorMessageChainHead);\n        }\n        function isArrayType(type) {\n            return getObjectFlags(type) & 4 /* Reference */ && type.target === globalArrayType;\n        }\n        function isArrayLikeType(type) {\n            // A type is array-like if it is a reference to the global Array or global ReadonlyArray type,\n            // or if it is not the undefined or null type and if it is assignable to ReadonlyArray<any>\n            return getObjectFlags(type) & 4 /* Reference */ && (type.target === globalArrayType || type.target === globalReadonlyArrayType) ||\n                !(type.flags & 6144 /* Nullable */) && isTypeAssignableTo(type, anyReadonlyArrayType);\n        }\n        function isTupleLikeType(type) {\n            return !!getPropertyOfType(type, \"0\");\n        }\n        function isUnitType(type) {\n            return (type.flags & (480 /* Literal */ | 2048 /* Undefined */ | 4096 /* Null */)) !== 0;\n        }\n        function isLiteralType(type) {\n            return type.flags & 8 /* Boolean */ ? true :\n                type.flags & 65536 /* Union */ ? type.flags & 16 /* Enum */ ? true : !ts.forEach(type.types, function (t) { return !isUnitType(t); }) :\n                    isUnitType(type);\n        }\n        function getBaseTypeOfLiteralType(type) {\n            return type.flags & 32 /* StringLiteral */ ? stringType :\n                type.flags & 64 /* NumberLiteral */ ? numberType :\n                    type.flags & 128 /* BooleanLiteral */ ? booleanType :\n                        type.flags & 256 /* EnumLiteral */ ? type.baseType :\n                            type.flags & 65536 /* Union */ && !(type.flags & 16 /* Enum */) ? getUnionType(ts.sameMap(type.types, getBaseTypeOfLiteralType)) :\n                                type;\n        }\n        function getWidenedLiteralType(type) {\n            return type.flags & 32 /* StringLiteral */ && type.flags & 1048576 /* FreshLiteral */ ? stringType :\n                type.flags & 64 /* NumberLiteral */ && type.flags & 1048576 /* FreshLiteral */ ? numberType :\n                    type.flags & 128 /* BooleanLiteral */ ? booleanType :\n                        type.flags & 256 /* EnumLiteral */ ? type.baseType :\n                            type.flags & 65536 /* Union */ && !(type.flags & 16 /* Enum */) ? getUnionType(ts.sameMap(type.types, getWidenedLiteralType)) :\n                                type;\n        }\n        /**\n         * Check if a Type was written as a tuple type literal.\n         * Prefer using isTupleLikeType() unless the use of `elementTypes` is required.\n         */\n        function isTupleType(type) {\n            return !!(getObjectFlags(type) & 4 /* Reference */ && type.target.objectFlags & 8 /* Tuple */);\n        }\n        function getFalsyFlagsOfTypes(types) {\n            var result = 0;\n            for (var _i = 0, types_9 = types; _i < types_9.length; _i++) {\n                var t = types_9[_i];\n                result |= getFalsyFlags(t);\n            }\n            return result;\n        }\n        // Returns the String, Number, Boolean, StringLiteral, NumberLiteral, BooleanLiteral, Void, Undefined, or Null\n        // flags for the string, number, boolean, \"\", 0, false, void, undefined, or null types respectively. Returns\n        // no flags for all other types (including non-falsy literal types).\n        function getFalsyFlags(type) {\n            return type.flags & 65536 /* Union */ ? getFalsyFlagsOfTypes(type.types) :\n                type.flags & 32 /* StringLiteral */ ? type.text === \"\" ? 32 /* StringLiteral */ : 0 :\n                    type.flags & 64 /* NumberLiteral */ ? type.text === \"0\" ? 64 /* NumberLiteral */ : 0 :\n                        type.flags & 128 /* BooleanLiteral */ ? type === falseType ? 128 /* BooleanLiteral */ : 0 :\n                            type.flags & 7406 /* PossiblyFalsy */;\n        }\n        function includeFalsyTypes(type, flags) {\n            if ((getFalsyFlags(type) & flags) === flags) {\n                return type;\n            }\n            var types = [type];\n            if (flags & 262178 /* StringLike */)\n                types.push(emptyStringType);\n            if (flags & 340 /* NumberLike */)\n                types.push(zeroType);\n            if (flags & 136 /* BooleanLike */)\n                types.push(falseType);\n            if (flags & 1024 /* Void */)\n                types.push(voidType);\n            if (flags & 2048 /* Undefined */)\n                types.push(undefinedType);\n            if (flags & 4096 /* Null */)\n                types.push(nullType);\n            return getUnionType(types, /*subtypeReduction*/ true);\n        }\n        function removeDefinitelyFalsyTypes(type) {\n            return getFalsyFlags(type) & 7392 /* DefinitelyFalsy */ ?\n                filterType(type, function (t) { return !(getFalsyFlags(t) & 7392 /* DefinitelyFalsy */); }) :\n                type;\n        }\n        function getNonNullableType(type) {\n            return strictNullChecks ? getTypeWithFacts(type, 524288 /* NEUndefinedOrNull */) : type;\n        }\n        /**\n         * Return true if type was inferred from an object literal or written as an object type literal\n         * with no call or construct signatures.\n         */\n        function isObjectLiteralType(type) {\n            return type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */)) !== 0 &&\n                getSignaturesOfType(type, 0 /* Call */).length === 0 &&\n                getSignaturesOfType(type, 1 /* Construct */).length === 0;\n        }\n        function createTransientSymbol(source, type) {\n            var symbol = createSymbol(source.flags | 67108864 /* Transient */, source.name);\n            symbol.declarations = source.declarations;\n            symbol.parent = source.parent;\n            symbol.type = type;\n            symbol.target = source;\n            if (source.valueDeclaration) {\n                symbol.valueDeclaration = source.valueDeclaration;\n            }\n            return symbol;\n        }\n        function transformTypeOfMembers(type, f) {\n            var members = ts.createMap();\n            for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) {\n                var property = _a[_i];\n                var original = getTypeOfSymbol(property);\n                var updated = f(original);\n                members[property.name] = updated === original ? property : createTransientSymbol(property, updated);\n            }\n            ;\n            return members;\n        }\n        /**\n         * If the the provided object literal is subject to the excess properties check,\n         * create a new that is exempt. Recursively mark object literal members as exempt.\n         * Leave signatures alone since they are not subject to the check.\n         */\n        function getRegularTypeOfObjectLiteral(type) {\n            if (!(getObjectFlags(type) & 128 /* ObjectLiteral */ && type.flags & 1048576 /* FreshLiteral */)) {\n                return type;\n            }\n            var regularType = type.regularType;\n            if (regularType) {\n                return regularType;\n            }\n            var resolved = type;\n            var members = transformTypeOfMembers(type, getRegularTypeOfObjectLiteral);\n            var regularNew = createAnonymousType(resolved.symbol, members, resolved.callSignatures, resolved.constructSignatures, resolved.stringIndexInfo, resolved.numberIndexInfo);\n            regularNew.flags = resolved.flags & ~1048576 /* FreshLiteral */;\n            regularNew.objectFlags |= 128 /* ObjectLiteral */;\n            type.regularType = regularNew;\n            return regularNew;\n        }\n        function getWidenedTypeOfObjectLiteral(type) {\n            var members = transformTypeOfMembers(type, function (prop) {\n                var widened = getWidenedType(prop);\n                return prop === widened ? prop : widened;\n            });\n            var stringIndexInfo = getIndexInfoOfType(type, 0 /* String */);\n            var numberIndexInfo = getIndexInfoOfType(type, 1 /* Number */);\n            return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly));\n        }\n        function getWidenedConstituentType(type) {\n            return type.flags & 6144 /* Nullable */ ? type : getWidenedType(type);\n        }\n        function getWidenedType(type) {\n            if (type.flags & 6291456 /* RequiresWidening */) {\n                if (type.flags & 6144 /* Nullable */) {\n                    return anyType;\n                }\n                if (getObjectFlags(type) & 128 /* ObjectLiteral */) {\n                    return getWidenedTypeOfObjectLiteral(type);\n                }\n                if (type.flags & 65536 /* Union */) {\n                    return getUnionType(ts.sameMap(type.types, getWidenedConstituentType));\n                }\n                if (isArrayType(type) || isTupleType(type)) {\n                    return createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType));\n                }\n            }\n            return type;\n        }\n        /**\n         * Reports implicit any errors that occur as a result of widening 'null' and 'undefined'\n         * to 'any'. A call to reportWideningErrorsInType is normally accompanied by a call to\n         * getWidenedType. But in some cases getWidenedType is called without reporting errors\n         * (type argument inference is an example).\n         *\n         * The return value indicates whether an error was in fact reported. The particular circumstances\n         * are on a best effort basis. Currently, if the null or undefined that causes widening is inside\n         * an object literal property (arbitrarily deeply), this function reports an error. If no error is\n         * reported, reportImplicitAnyError is a suitable fallback to report a general error.\n         */\n        function reportWideningErrorsInType(type) {\n            var errorReported = false;\n            if (type.flags & 65536 /* Union */) {\n                for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                    var t = _a[_i];\n                    if (reportWideningErrorsInType(t)) {\n                        errorReported = true;\n                    }\n                }\n            }\n            if (isArrayType(type) || isTupleType(type)) {\n                for (var _b = 0, _c = type.typeArguments; _b < _c.length; _b++) {\n                    var t = _c[_b];\n                    if (reportWideningErrorsInType(t)) {\n                        errorReported = true;\n                    }\n                }\n            }\n            if (getObjectFlags(type) & 128 /* ObjectLiteral */) {\n                for (var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) {\n                    var p = _e[_d];\n                    var t = getTypeOfSymbol(p);\n                    if (t.flags & 2097152 /* ContainsWideningType */) {\n                        if (!reportWideningErrorsInType(t)) {\n                            error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t)));\n                        }\n                        errorReported = true;\n                    }\n                }\n            }\n            return errorReported;\n        }\n        function reportImplicitAnyError(declaration, type) {\n            var typeAsString = typeToString(getWidenedType(type));\n            var diagnostic;\n            switch (declaration.kind) {\n                case 147 /* PropertyDeclaration */:\n                case 146 /* PropertySignature */:\n                    diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type;\n                    break;\n                case 144 /* Parameter */:\n                    diagnostic = declaration.dotDotDotToken ?\n                        ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type :\n                        ts.Diagnostics.Parameter_0_implicitly_has_an_1_type;\n                    break;\n                case 174 /* BindingElement */:\n                    diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type;\n                    break;\n                case 225 /* FunctionDeclaration */:\n                case 149 /* MethodDeclaration */:\n                case 148 /* MethodSignature */:\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                case 184 /* FunctionExpression */:\n                case 185 /* ArrowFunction */:\n                    if (!declaration.name) {\n                        error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);\n                        return;\n                    }\n                    diagnostic = ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type;\n                    break;\n                default:\n                    diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type;\n            }\n            error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString);\n        }\n        function reportErrorsFromWidening(declaration, type) {\n            if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 2097152 /* ContainsWideningType */) {\n                // Report implicit any error within type if possible, otherwise report error on declaration\n                if (!reportWideningErrorsInType(type)) {\n                    reportImplicitAnyError(declaration, type);\n                }\n            }\n        }\n        function forEachMatchingParameterType(source, target, callback) {\n            var sourceMax = source.parameters.length;\n            var targetMax = target.parameters.length;\n            var count;\n            if (source.hasRestParameter && target.hasRestParameter) {\n                count = Math.max(sourceMax, targetMax);\n            }\n            else if (source.hasRestParameter) {\n                count = targetMax;\n            }\n            else if (target.hasRestParameter) {\n                count = sourceMax;\n            }\n            else {\n                count = Math.min(sourceMax, targetMax);\n            }\n            for (var i = 0; i < count; i++) {\n                callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i));\n            }\n        }\n        function createInferenceContext(signature, inferUnionTypes) {\n            var inferences = ts.map(signature.typeParameters, createTypeInferencesObject);\n            return {\n                signature: signature,\n                inferUnionTypes: inferUnionTypes,\n                inferences: inferences,\n                inferredTypes: new Array(signature.typeParameters.length),\n            };\n        }\n        function createTypeInferencesObject() {\n            return {\n                primary: undefined,\n                secondary: undefined,\n                topLevel: true,\n                isFixed: false,\n            };\n        }\n        // Return true if the given type could possibly reference a type parameter for which\n        // we perform type inference (i.e. a type parameter of a generic function). We cache\n        // results for union and intersection types for performance reasons.\n        function couldContainTypeVariables(type) {\n            var objectFlags = getObjectFlags(type);\n            return !!(type.flags & 540672 /* TypeVariable */ ||\n                objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeVariables) ||\n                objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */) ||\n                objectFlags & 32 /* Mapped */ ||\n                type.flags & 196608 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeVariables(type));\n        }\n        function couldUnionOrIntersectionContainTypeVariables(type) {\n            if (type.couldContainTypeVariables === undefined) {\n                type.couldContainTypeVariables = ts.forEach(type.types, couldContainTypeVariables);\n            }\n            return type.couldContainTypeVariables;\n        }\n        function isTypeParameterAtTopLevel(type, typeParameter) {\n            return type === typeParameter || type.flags & 196608 /* UnionOrIntersection */ && ts.forEach(type.types, function (t) { return isTypeParameterAtTopLevel(t, typeParameter); });\n        }\n        // Infer a suitable input type for a homomorphic mapped type { [P in keyof T]: X }. We construct\n        // an object type with the same set of properties as the source type, where the type of each\n        // property is computed by inferring from the source property type to X for the type\n        // variable T[P] (i.e. we treat the type T[P] as the type variable we're inferring for).\n        function inferTypeForHomomorphicMappedType(source, target) {\n            var properties = getPropertiesOfType(source);\n            var indexInfo = getIndexInfoOfType(source, 0 /* String */);\n            if (properties.length === 0 && !indexInfo) {\n                return undefined;\n            }\n            var typeVariable = getIndexedAccessType(getConstraintTypeFromMappedType(target).type, getTypeParameterFromMappedType(target));\n            var typeVariableArray = [typeVariable];\n            var typeInferences = createTypeInferencesObject();\n            var typeInferencesArray = [typeInferences];\n            var templateType = getTemplateTypeFromMappedType(target);\n            var readonlyMask = target.declaration.readonlyToken ? false : true;\n            var optionalMask = target.declaration.questionToken ? 0 : 536870912 /* Optional */;\n            var members = createSymbolTable(properties);\n            for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {\n                var prop = properties_4[_i];\n                var inferredPropType = inferTargetType(getTypeOfSymbol(prop));\n                if (!inferredPropType) {\n                    return undefined;\n                }\n                var inferredProp = createSymbol(4 /* Property */ | 67108864 /* Transient */ | prop.flags & optionalMask, prop.name);\n                inferredProp.declarations = prop.declarations;\n                inferredProp.type = inferredPropType;\n                inferredProp.isReadonly = readonlyMask && isReadonlySymbol(prop);\n                members[prop.name] = inferredProp;\n            }\n            if (indexInfo) {\n                var inferredIndexType = inferTargetType(indexInfo.type);\n                if (!inferredIndexType) {\n                    return undefined;\n                }\n                indexInfo = createIndexInfo(inferredIndexType, readonlyMask && indexInfo.isReadonly);\n            }\n            return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfo, undefined);\n            function inferTargetType(sourceType) {\n                typeInferences.primary = undefined;\n                typeInferences.secondary = undefined;\n                inferTypes(typeVariableArray, typeInferencesArray, sourceType, templateType);\n                var inferences = typeInferences.primary || typeInferences.secondary;\n                return inferences && getUnionType(inferences, /*subtypeReduction*/ true);\n            }\n        }\n        function inferTypesWithContext(context, originalSource, originalTarget) {\n            inferTypes(context.signature.typeParameters, context.inferences, originalSource, originalTarget);\n        }\n        function inferTypes(typeVariables, typeInferences, originalSource, originalTarget) {\n            var sourceStack;\n            var targetStack;\n            var depth = 0;\n            var inferiority = 0;\n            var visited = ts.createMap();\n            inferFromTypes(originalSource, originalTarget);\n            function isInProcess(source, target) {\n                for (var i = 0; i < depth; i++) {\n                    if (source === sourceStack[i] && target === targetStack[i]) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n            function inferFromTypes(source, target) {\n                if (!couldContainTypeVariables(target)) {\n                    return;\n                }\n                if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) {\n                    // Source and target are types originating in the same generic type alias declaration.\n                    // Simply infer from source type arguments to target type arguments.\n                    var sourceTypes = source.aliasTypeArguments;\n                    var targetTypes = target.aliasTypeArguments;\n                    for (var i = 0; i < sourceTypes.length; i++) {\n                        inferFromTypes(sourceTypes[i], targetTypes[i]);\n                    }\n                    return;\n                }\n                if (source.flags & 65536 /* Union */ && target.flags & 65536 /* Union */ && !(source.flags & 16 /* Enum */ && target.flags & 16 /* Enum */) ||\n                    source.flags & 131072 /* Intersection */ && target.flags & 131072 /* Intersection */) {\n                    // Source and target are both unions or both intersections. If source and target\n                    // are the same type, just relate each constituent type to itself.\n                    if (source === target) {\n                        for (var _i = 0, _a = source.types; _i < _a.length; _i++) {\n                            var t = _a[_i];\n                            inferFromTypes(t, t);\n                        }\n                        return;\n                    }\n                    // Find each source constituent type that has an identically matching target constituent\n                    // type, and for each such type infer from the type to itself. When inferring from a\n                    // type to itself we effectively find all type parameter occurrences within that type\n                    // and infer themselves as their type arguments. We have special handling for numeric\n                    // and string literals because the number and string types are not represented as unions\n                    // of all their possible values.\n                    var matchingTypes = void 0;\n                    for (var _b = 0, _c = source.types; _b < _c.length; _b++) {\n                        var t = _c[_b];\n                        if (typeIdenticalToSomeType(t, target.types)) {\n                            (matchingTypes || (matchingTypes = [])).push(t);\n                            inferFromTypes(t, t);\n                        }\n                        else if (t.flags & (64 /* NumberLiteral */ | 32 /* StringLiteral */)) {\n                            var b = getBaseTypeOfLiteralType(t);\n                            if (typeIdenticalToSomeType(b, target.types)) {\n                                (matchingTypes || (matchingTypes = [])).push(t, b);\n                            }\n                        }\n                    }\n                    // Next, to improve the quality of inferences, reduce the source and target types by\n                    // removing the identically matched constituents. For example, when inferring from\n                    // 'string | string[]' to 'string | T' we reduce the types to 'string[]' and 'T'.\n                    if (matchingTypes) {\n                        source = removeTypesFromUnionOrIntersection(source, matchingTypes);\n                        target = removeTypesFromUnionOrIntersection(target, matchingTypes);\n                    }\n                }\n                if (target.flags & 540672 /* TypeVariable */) {\n                    // If target is a type parameter, make an inference, unless the source type contains\n                    // the anyFunctionType (the wildcard type that's used to avoid contextually typing functions).\n                    // Because the anyFunctionType is internal, it should not be exposed to the user by adding\n                    // it as an inference candidate. Hopefully, a better candidate will come along that does\n                    // not contain anyFunctionType when we come back to this argument for its second round\n                    // of inference.\n                    if (source.flags & 8388608 /* ContainsAnyFunctionType */) {\n                        return;\n                    }\n                    for (var i = 0; i < typeVariables.length; i++) {\n                        if (target === typeVariables[i]) {\n                            var inferences = typeInferences[i];\n                            if (!inferences.isFixed) {\n                                // Any inferences that are made to a type parameter in a union type are inferior\n                                // to inferences made to a flat (non-union) type. This is because if we infer to\n                                // T | string[], we really don't know if we should be inferring to T or not (because\n                                // the correct constituent on the target side could be string[]). Therefore, we put\n                                // such inferior inferences into a secondary bucket, and only use them if the primary\n                                // bucket is empty.\n                                var candidates = inferiority ?\n                                    inferences.secondary || (inferences.secondary = []) :\n                                    inferences.primary || (inferences.primary = []);\n                                if (!ts.contains(candidates, source)) {\n                                    candidates.push(source);\n                                }\n                                if (target.flags & 16384 /* TypeParameter */ && !isTypeParameterAtTopLevel(originalTarget, target)) {\n                                    inferences.topLevel = false;\n                                }\n                            }\n                            return;\n                        }\n                    }\n                }\n                else if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) {\n                    // If source and target are references to the same generic type, infer from type arguments\n                    var sourceTypes = source.typeArguments || emptyArray;\n                    var targetTypes = target.typeArguments || emptyArray;\n                    var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;\n                    for (var i = 0; i < count; i++) {\n                        inferFromTypes(sourceTypes[i], targetTypes[i]);\n                    }\n                }\n                else if (target.flags & 196608 /* UnionOrIntersection */) {\n                    var targetTypes = target.types;\n                    var typeVariableCount = 0;\n                    var typeVariable = void 0;\n                    // First infer to each type in union or intersection that isn't a type variable\n                    for (var _d = 0, targetTypes_2 = targetTypes; _d < targetTypes_2.length; _d++) {\n                        var t = targetTypes_2[_d];\n                        if (t.flags & 540672 /* TypeVariable */ && ts.contains(typeVariables, t)) {\n                            typeVariable = t;\n                            typeVariableCount++;\n                        }\n                        else {\n                            inferFromTypes(source, t);\n                        }\n                    }\n                    // Next, if target containings a single naked type variable, make a secondary inference to that type\n                    // variable. This gives meaningful results for union types in co-variant positions and intersection\n                    // types in contra-variant positions (such as callback parameters).\n                    if (typeVariableCount === 1) {\n                        inferiority++;\n                        inferFromTypes(source, typeVariable);\n                        inferiority--;\n                    }\n                }\n                else if (source.flags & 196608 /* UnionOrIntersection */) {\n                    // Source is a union or intersection type, infer from each constituent type\n                    var sourceTypes = source.types;\n                    for (var _e = 0, sourceTypes_3 = sourceTypes; _e < sourceTypes_3.length; _e++) {\n                        var sourceType = sourceTypes_3[_e];\n                        inferFromTypes(sourceType, target);\n                    }\n                }\n                else {\n                    source = getApparentType(source);\n                    if (source.flags & 32768 /* Object */) {\n                        if (isInProcess(source, target)) {\n                            return;\n                        }\n                        if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) {\n                            return;\n                        }\n                        var key = source.id + \",\" + target.id;\n                        if (visited[key]) {\n                            return;\n                        }\n                        visited[key] = true;\n                        if (depth === 0) {\n                            sourceStack = [];\n                            targetStack = [];\n                        }\n                        sourceStack[depth] = source;\n                        targetStack[depth] = target;\n                        depth++;\n                        inferFromObjectTypes(source, target);\n                        depth--;\n                    }\n                }\n            }\n            function inferFromObjectTypes(source, target) {\n                if (getObjectFlags(target) & 32 /* Mapped */) {\n                    var constraintType = getConstraintTypeFromMappedType(target);\n                    if (constraintType.flags & 262144 /* Index */) {\n                        // We're inferring from some source type S to a homomorphic mapped type { [P in keyof T]: X },\n                        // where T is a type variable. Use inferTypeForHomomorphicMappedType to infer a suitable source\n                        // type and then make a secondary inference from that type to T. We make a secondary inference\n                        // such that direct inferences to T get priority over inferences to Partial<T>, for example.\n                        var index = ts.indexOf(typeVariables, constraintType.type);\n                        if (index >= 0 && !typeInferences[index].isFixed) {\n                            var inferredType = inferTypeForHomomorphicMappedType(source, target);\n                            if (inferredType) {\n                                inferiority++;\n                                inferFromTypes(inferredType, typeVariables[index]);\n                                inferiority--;\n                            }\n                        }\n                        return;\n                    }\n                    if (constraintType.flags & 16384 /* TypeParameter */) {\n                        // We're inferring from some source type S to a mapped type { [P in T]: X }, where T is a type\n                        // parameter. Infer from 'keyof S' to T and infer from a union of each property type in S to X.\n                        inferFromTypes(getIndexType(source), constraintType);\n                        inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target));\n                        return;\n                    }\n                }\n                inferFromProperties(source, target);\n                inferFromSignatures(source, target, 0 /* Call */);\n                inferFromSignatures(source, target, 1 /* Construct */);\n                inferFromIndexTypes(source, target);\n            }\n            function inferFromProperties(source, target) {\n                var properties = getPropertiesOfObjectType(target);\n                for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) {\n                    var targetProp = properties_5[_i];\n                    var sourceProp = getPropertyOfObjectType(source, targetProp.name);\n                    if (sourceProp) {\n                        inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));\n                    }\n                }\n            }\n            function inferFromSignatures(source, target, kind) {\n                var sourceSignatures = getSignaturesOfType(source, kind);\n                var targetSignatures = getSignaturesOfType(target, kind);\n                var sourceLen = sourceSignatures.length;\n                var targetLen = targetSignatures.length;\n                var len = sourceLen < targetLen ? sourceLen : targetLen;\n                for (var i = 0; i < len; i++) {\n                    inferFromSignature(getErasedSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i]));\n                }\n            }\n            function inferFromParameterTypes(source, target) {\n                return inferFromTypes(source, target);\n            }\n            function inferFromSignature(source, target) {\n                forEachMatchingParameterType(source, target, inferFromParameterTypes);\n                if (source.typePredicate && target.typePredicate && source.typePredicate.kind === target.typePredicate.kind) {\n                    inferFromTypes(source.typePredicate.type, target.typePredicate.type);\n                }\n                else {\n                    inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));\n                }\n            }\n            function inferFromIndexTypes(source, target) {\n                var targetStringIndexType = getIndexTypeOfType(target, 0 /* String */);\n                if (targetStringIndexType) {\n                    var sourceIndexType = getIndexTypeOfType(source, 0 /* String */) ||\n                        getImplicitIndexTypeOfType(source, 0 /* String */);\n                    if (sourceIndexType) {\n                        inferFromTypes(sourceIndexType, targetStringIndexType);\n                    }\n                }\n                var targetNumberIndexType = getIndexTypeOfType(target, 1 /* Number */);\n                if (targetNumberIndexType) {\n                    var sourceIndexType = getIndexTypeOfType(source, 1 /* Number */) ||\n                        getIndexTypeOfType(source, 0 /* String */) ||\n                        getImplicitIndexTypeOfType(source, 1 /* Number */);\n                    if (sourceIndexType) {\n                        inferFromTypes(sourceIndexType, targetNumberIndexType);\n                    }\n                }\n            }\n        }\n        function typeIdenticalToSomeType(type, types) {\n            for (var _i = 0, types_10 = types; _i < types_10.length; _i++) {\n                var t = types_10[_i];\n                if (isTypeIdenticalTo(t, type)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        /**\n         * Return a new union or intersection type computed by removing a given set of types\n         * from a given union or intersection type.\n         */\n        function removeTypesFromUnionOrIntersection(type, typesToRemove) {\n            var reducedTypes = [];\n            for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                var t = _a[_i];\n                if (!typeIdenticalToSomeType(t, typesToRemove)) {\n                    reducedTypes.push(t);\n                }\n            }\n            return type.flags & 65536 /* Union */ ? getUnionType(reducedTypes) : getIntersectionType(reducedTypes);\n        }\n        function getInferenceCandidates(context, index) {\n            var inferences = context.inferences[index];\n            return inferences.primary || inferences.secondary || emptyArray;\n        }\n        function hasPrimitiveConstraint(type) {\n            var constraint = getConstraintOfTypeParameter(type);\n            return constraint && maybeTypeOfKind(constraint, 8190 /* Primitive */ | 262144 /* Index */);\n        }\n        function getInferredType(context, index) {\n            var inferredType = context.inferredTypes[index];\n            var inferenceSucceeded;\n            if (!inferredType) {\n                var inferences = getInferenceCandidates(context, index);\n                if (inferences.length) {\n                    // We widen inferred literal types if\n                    // all inferences were made to top-level ocurrences of the type parameter, and\n                    // the type parameter has no constraint or its constraint includes no primitive or literal types, and\n                    // the type parameter was fixed during inference or does not occur at top-level in the return type.\n                    var signature = context.signature;\n                    var widenLiteralTypes = context.inferences[index].topLevel &&\n                        !hasPrimitiveConstraint(signature.typeParameters[index]) &&\n                        (context.inferences[index].isFixed || !isTypeParameterAtTopLevel(getReturnTypeOfSignature(signature), signature.typeParameters[index]));\n                    var baseInferences = widenLiteralTypes ? ts.sameMap(inferences, getWidenedLiteralType) : inferences;\n                    // Infer widened union or supertype, or the unknown type for no common supertype\n                    var unionOrSuperType = context.inferUnionTypes ? getUnionType(baseInferences, /*subtypeReduction*/ true) : getCommonSupertype(baseInferences);\n                    inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : unknownType;\n                    inferenceSucceeded = !!unionOrSuperType;\n                }\n                else {\n                    // Infer the empty object type when no inferences were made. It is important to remember that\n                    // in this case, inference still succeeds, meaning there is no error for not having inference\n                    // candidates. An inference error only occurs when there are *conflicting* candidates, i.e.\n                    // candidates with no common supertype.\n                    inferredType = emptyObjectType;\n                    inferenceSucceeded = true;\n                }\n                context.inferredTypes[index] = inferredType;\n                // Only do the constraint check if inference succeeded (to prevent cascading errors)\n                if (inferenceSucceeded) {\n                    var constraint = getConstraintOfTypeParameter(context.signature.typeParameters[index]);\n                    if (constraint) {\n                        var instantiatedConstraint = instantiateType(constraint, getInferenceMapper(context));\n                        if (!isTypeAssignableTo(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {\n                            context.inferredTypes[index] = inferredType = instantiatedConstraint;\n                        }\n                    }\n                }\n                else if (context.failedTypeParameterIndex === undefined || context.failedTypeParameterIndex > index) {\n                    // If inference failed, it is necessary to record the index of the failed type parameter (the one we are on).\n                    // It might be that inference has already failed on a later type parameter on a previous call to inferTypeArguments.\n                    // So if this failure is on preceding type parameter, this type parameter is the new failure index.\n                    context.failedTypeParameterIndex = index;\n                }\n            }\n            return inferredType;\n        }\n        function getInferredTypes(context) {\n            for (var i = 0; i < context.inferredTypes.length; i++) {\n                getInferredType(context, i);\n            }\n            return context.inferredTypes;\n        }\n        // EXPRESSION TYPE CHECKING\n        function getResolvedSymbol(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedSymbol) {\n                links.resolvedSymbol = !ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 /* Value */ | 1048576 /* ExportValue */, ts.Diagnostics.Cannot_find_name_0, node) || unknownSymbol;\n            }\n            return links.resolvedSymbol;\n        }\n        function isInTypeQuery(node) {\n            // TypeScript 1.0 spec (April 2014): 3.6.3\n            // A type query consists of the keyword typeof followed by an expression.\n            // The expression is restricted to a single identifier or a sequence of identifiers separated by periods\n            while (node) {\n                switch (node.kind) {\n                    case 160 /* TypeQuery */:\n                        return true;\n                    case 70 /* Identifier */:\n                    case 141 /* QualifiedName */:\n                        node = node.parent;\n                        continue;\n                    default:\n                        return false;\n                }\n            }\n            ts.Debug.fail(\"should not get here\");\n        }\n        // Return the flow cache key for a \"dotted name\" (i.e. a sequence of identifiers\n        // separated by dots). The key consists of the id of the symbol referenced by the\n        // leftmost identifier followed by zero or more property names separated by dots.\n        // The result is undefined if the reference isn't a dotted name.\n        function getFlowCacheKey(node) {\n            if (node.kind === 70 /* Identifier */) {\n                var symbol = getResolvedSymbol(node);\n                return symbol !== unknownSymbol ? \"\" + getSymbolId(symbol) : undefined;\n            }\n            if (node.kind === 98 /* ThisKeyword */) {\n                return \"0\";\n            }\n            if (node.kind === 177 /* PropertyAccessExpression */) {\n                var key = getFlowCacheKey(node.expression);\n                return key && key + \".\" + node.name.text;\n            }\n            return undefined;\n        }\n        function getLeftmostIdentifierOrThis(node) {\n            switch (node.kind) {\n                case 70 /* Identifier */:\n                case 98 /* ThisKeyword */:\n                    return node;\n                case 177 /* PropertyAccessExpression */:\n                    return getLeftmostIdentifierOrThis(node.expression);\n            }\n            return undefined;\n        }\n        function isMatchingReference(source, target) {\n            switch (source.kind) {\n                case 70 /* Identifier */:\n                    return target.kind === 70 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) ||\n                        (target.kind === 223 /* VariableDeclaration */ || target.kind === 174 /* BindingElement */) &&\n                            getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target);\n                case 98 /* ThisKeyword */:\n                    return target.kind === 98 /* ThisKeyword */;\n                case 177 /* PropertyAccessExpression */:\n                    return target.kind === 177 /* PropertyAccessExpression */ &&\n                        source.name.text === target.name.text &&\n                        isMatchingReference(source.expression, target.expression);\n            }\n            return false;\n        }\n        function containsMatchingReference(source, target) {\n            while (source.kind === 177 /* PropertyAccessExpression */) {\n                source = source.expression;\n                if (isMatchingReference(source, target)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        // Return true if target is a property access xxx.yyy, source is a property access xxx.zzz, the declared\n        // type of xxx is a union type, and yyy is a property that is possibly a discriminant. We consider a property\n        // a possible discriminant if its type differs in the constituents of containing union type, and if every\n        // choice is a unit type or a union of unit types.\n        function containsMatchingReferenceDiscriminant(source, target) {\n            return target.kind === 177 /* PropertyAccessExpression */ &&\n                containsMatchingReference(source, target.expression) &&\n                isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text);\n        }\n        function getDeclaredTypeOfReference(expr) {\n            if (expr.kind === 70 /* Identifier */) {\n                return getTypeOfSymbol(getResolvedSymbol(expr));\n            }\n            if (expr.kind === 177 /* PropertyAccessExpression */) {\n                var type = getDeclaredTypeOfReference(expr.expression);\n                return type && getTypeOfPropertyOfType(type, expr.name.text);\n            }\n            return undefined;\n        }\n        function isDiscriminantProperty(type, name) {\n            if (type && type.flags & 65536 /* Union */) {\n                var prop = getUnionOrIntersectionProperty(type, name);\n                if (prop && prop.flags & 268435456 /* SyntheticProperty */) {\n                    if (prop.isDiscriminantProperty === undefined) {\n                        prop.isDiscriminantProperty = prop.hasNonUniformType && isLiteralType(getTypeOfSymbol(prop));\n                    }\n                    return prop.isDiscriminantProperty;\n                }\n            }\n            return false;\n        }\n        function isOrContainsMatchingReference(source, target) {\n            return isMatchingReference(source, target) || containsMatchingReference(source, target);\n        }\n        function hasMatchingArgument(callExpression, reference) {\n            if (callExpression.arguments) {\n                for (var _i = 0, _a = callExpression.arguments; _i < _a.length; _i++) {\n                    var argument = _a[_i];\n                    if (isOrContainsMatchingReference(reference, argument)) {\n                        return true;\n                    }\n                }\n            }\n            if (callExpression.expression.kind === 177 /* PropertyAccessExpression */ &&\n                isOrContainsMatchingReference(reference, callExpression.expression.expression)) {\n                return true;\n            }\n            return false;\n        }\n        function getFlowNodeId(flow) {\n            if (!flow.id) {\n                flow.id = nextFlowId;\n                nextFlowId++;\n            }\n            return flow.id;\n        }\n        function typeMaybeAssignableTo(source, target) {\n            if (!(source.flags & 65536 /* Union */)) {\n                return isTypeAssignableTo(source, target);\n            }\n            for (var _i = 0, _a = source.types; _i < _a.length; _i++) {\n                var t = _a[_i];\n                if (isTypeAssignableTo(t, target)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        // Remove those constituent types of declaredType to which no constituent type of assignedType is assignable.\n        // For example, when a variable of type number | string | boolean is assigned a value of type number | boolean,\n        // we remove type string.\n        function getAssignmentReducedType(declaredType, assignedType) {\n            if (declaredType !== assignedType) {\n                if (assignedType.flags & 8192 /* Never */) {\n                    return assignedType;\n                }\n                var reducedType = filterType(declaredType, function (t) { return typeMaybeAssignableTo(assignedType, t); });\n                if (!(reducedType.flags & 8192 /* Never */)) {\n                    return reducedType;\n                }\n            }\n            return declaredType;\n        }\n        function getTypeFactsOfTypes(types) {\n            var result = 0 /* None */;\n            for (var _i = 0, types_11 = types; _i < types_11.length; _i++) {\n                var t = types_11[_i];\n                result |= getTypeFacts(t);\n            }\n            return result;\n        }\n        function isFunctionObjectType(type) {\n            // We do a quick check for a \"bind\" property before performing the more expensive subtype\n            // check. This gives us a quicker out in the common case where an object type is not a function.\n            var resolved = resolveStructuredTypeMembers(type);\n            return !!(resolved.callSignatures.length || resolved.constructSignatures.length ||\n                resolved.members[\"bind\"] && isTypeSubtypeOf(type, globalFunctionType));\n        }\n        function getTypeFacts(type) {\n            var flags = type.flags;\n            if (flags & 2 /* String */) {\n                return strictNullChecks ? 4079361 /* StringStrictFacts */ : 4194049 /* StringFacts */;\n            }\n            if (flags & 32 /* StringLiteral */) {\n                return strictNullChecks ?\n                    type.text === \"\" ? 3030785 /* EmptyStringStrictFacts */ : 1982209 /* NonEmptyStringStrictFacts */ :\n                    type.text === \"\" ? 3145473 /* EmptyStringFacts */ : 4194049 /* NonEmptyStringFacts */;\n            }\n            if (flags & (4 /* Number */ | 16 /* Enum */)) {\n                return strictNullChecks ? 4079234 /* NumberStrictFacts */ : 4193922 /* NumberFacts */;\n            }\n            if (flags & (64 /* NumberLiteral */ | 256 /* EnumLiteral */)) {\n                var isZero = type.text === \"0\";\n                return strictNullChecks ?\n                    isZero ? 3030658 /* ZeroStrictFacts */ : 1982082 /* NonZeroStrictFacts */ :\n                    isZero ? 3145346 /* ZeroFacts */ : 4193922 /* NonZeroFacts */;\n            }\n            if (flags & 8 /* Boolean */) {\n                return strictNullChecks ? 4078980 /* BooleanStrictFacts */ : 4193668 /* BooleanFacts */;\n            }\n            if (flags & 136 /* BooleanLike */) {\n                return strictNullChecks ?\n                    type === falseType ? 3030404 /* FalseStrictFacts */ : 1981828 /* TrueStrictFacts */ :\n                    type === falseType ? 3145092 /* FalseFacts */ : 4193668 /* TrueFacts */;\n            }\n            if (flags & 32768 /* Object */) {\n                return isFunctionObjectType(type) ?\n                    strictNullChecks ? 6164448 /* FunctionStrictFacts */ : 8376288 /* FunctionFacts */ :\n                    strictNullChecks ? 6166480 /* ObjectStrictFacts */ : 8378320 /* ObjectFacts */;\n            }\n            if (flags & (1024 /* Void */ | 2048 /* Undefined */)) {\n                return 2457472 /* UndefinedFacts */;\n            }\n            if (flags & 4096 /* Null */) {\n                return 2340752 /* NullFacts */;\n            }\n            if (flags & 512 /* ESSymbol */) {\n                return strictNullChecks ? 1981320 /* SymbolStrictFacts */ : 4193160 /* SymbolFacts */;\n            }\n            if (flags & 16384 /* TypeParameter */) {\n                var constraint = getConstraintOfTypeParameter(type);\n                return getTypeFacts(constraint || emptyObjectType);\n            }\n            if (flags & 196608 /* UnionOrIntersection */) {\n                return getTypeFactsOfTypes(type.types);\n            }\n            return 8388607 /* All */;\n        }\n        function getTypeWithFacts(type, include) {\n            return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });\n        }\n        function getTypeWithDefault(type, defaultExpression) {\n            if (defaultExpression) {\n                var defaultType = getTypeOfExpression(defaultExpression);\n                return getUnionType([getTypeWithFacts(type, 131072 /* NEUndefined */), defaultType]);\n            }\n            return type;\n        }\n        function getTypeOfDestructuredProperty(type, name) {\n            var text = ts.getTextOfPropertyName(name);\n            return getTypeOfPropertyOfType(type, text) ||\n                isNumericLiteralName(text) && getIndexTypeOfType(type, 1 /* Number */) ||\n                getIndexTypeOfType(type, 0 /* String */) ||\n                unknownType;\n        }\n        function getTypeOfDestructuredArrayElement(type, index) {\n            return isTupleLikeType(type) && getTypeOfPropertyOfType(type, \"\" + index) ||\n                checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) ||\n                unknownType;\n        }\n        function getTypeOfDestructuredSpreadExpression(type) {\n            return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || unknownType);\n        }\n        function getAssignedTypeOfBinaryExpression(node) {\n            return node.parent.kind === 175 /* ArrayLiteralExpression */ || node.parent.kind === 257 /* PropertyAssignment */ ?\n                getTypeWithDefault(getAssignedType(node), node.right) :\n                getTypeOfExpression(node.right);\n        }\n        function getAssignedTypeOfArrayLiteralElement(node, element) {\n            return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element));\n        }\n        function getAssignedTypeOfSpreadExpression(node) {\n            return getTypeOfDestructuredSpreadExpression(getAssignedType(node.parent));\n        }\n        function getAssignedTypeOfPropertyAssignment(node) {\n            return getTypeOfDestructuredProperty(getAssignedType(node.parent), node.name);\n        }\n        function getAssignedTypeOfShorthandPropertyAssignment(node) {\n            return getTypeWithDefault(getAssignedTypeOfPropertyAssignment(node), node.objectAssignmentInitializer);\n        }\n        function getAssignedType(node) {\n            var parent = node.parent;\n            switch (parent.kind) {\n                case 212 /* ForInStatement */:\n                    return stringType;\n                case 213 /* ForOfStatement */:\n                    return checkRightHandSideOfForOf(parent.expression) || unknownType;\n                case 192 /* BinaryExpression */:\n                    return getAssignedTypeOfBinaryExpression(parent);\n                case 186 /* DeleteExpression */:\n                    return undefinedType;\n                case 175 /* ArrayLiteralExpression */:\n                    return getAssignedTypeOfArrayLiteralElement(parent, node);\n                case 196 /* SpreadElement */:\n                    return getAssignedTypeOfSpreadExpression(parent);\n                case 257 /* PropertyAssignment */:\n                    return getAssignedTypeOfPropertyAssignment(parent);\n                case 258 /* ShorthandPropertyAssignment */:\n                    return getAssignedTypeOfShorthandPropertyAssignment(parent);\n            }\n            return unknownType;\n        }\n        function getInitialTypeOfBindingElement(node) {\n            var pattern = node.parent;\n            var parentType = getInitialType(pattern.parent);\n            var type = pattern.kind === 172 /* ObjectBindingPattern */ ?\n                getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) :\n                !node.dotDotDotToken ?\n                    getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) :\n                    getTypeOfDestructuredSpreadExpression(parentType);\n            return getTypeWithDefault(type, node.initializer);\n        }\n        function getTypeOfInitializer(node) {\n            // Return the cached type if one is available. If the type of the variable was inferred\n            // from its initializer, we'll already have cached the type. Otherwise we compute it now\n            // without caching such that transient types are reflected.\n            var links = getNodeLinks(node);\n            return links.resolvedType || getTypeOfExpression(node);\n        }\n        function getInitialTypeOfVariableDeclaration(node) {\n            if (node.initializer) {\n                return getTypeOfInitializer(node.initializer);\n            }\n            if (node.parent.parent.kind === 212 /* ForInStatement */) {\n                return stringType;\n            }\n            if (node.parent.parent.kind === 213 /* ForOfStatement */) {\n                return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType;\n            }\n            return unknownType;\n        }\n        function getInitialType(node) {\n            return node.kind === 223 /* VariableDeclaration */ ?\n                getInitialTypeOfVariableDeclaration(node) :\n                getInitialTypeOfBindingElement(node);\n        }\n        function getInitialOrAssignedType(node) {\n            return node.kind === 223 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */ ?\n                getInitialType(node) :\n                getAssignedType(node);\n        }\n        function isEmptyArrayAssignment(node) {\n            return node.kind === 223 /* VariableDeclaration */ && node.initializer &&\n                isEmptyArrayLiteral(node.initializer) ||\n                node.kind !== 174 /* BindingElement */ && node.parent.kind === 192 /* BinaryExpression */ &&\n                    isEmptyArrayLiteral(node.parent.right);\n        }\n        function getReferenceCandidate(node) {\n            switch (node.kind) {\n                case 183 /* ParenthesizedExpression */:\n                    return getReferenceCandidate(node.expression);\n                case 192 /* BinaryExpression */:\n                    switch (node.operatorToken.kind) {\n                        case 57 /* EqualsToken */:\n                            return getReferenceCandidate(node.left);\n                        case 25 /* CommaToken */:\n                            return getReferenceCandidate(node.right);\n                    }\n            }\n            return node;\n        }\n        function getReferenceRoot(node) {\n            var parent = node.parent;\n            return parent.kind === 183 /* ParenthesizedExpression */ ||\n                parent.kind === 192 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && parent.left === node ||\n                parent.kind === 192 /* BinaryExpression */ && parent.operatorToken.kind === 25 /* CommaToken */ && parent.right === node ?\n                getReferenceRoot(parent) : node;\n        }\n        function getTypeOfSwitchClause(clause) {\n            if (clause.kind === 253 /* CaseClause */) {\n                var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression));\n                return isUnitType(caseType) ? caseType : undefined;\n            }\n            return neverType;\n        }\n        function getSwitchClauseTypes(switchStatement) {\n            var links = getNodeLinks(switchStatement);\n            if (!links.switchTypes) {\n                // If all case clauses specify expressions that have unit types, we return an array\n                // of those unit types. Otherwise we return an empty array.\n                var types = ts.map(switchStatement.caseBlock.clauses, getTypeOfSwitchClause);\n                links.switchTypes = !ts.contains(types, undefined) ? types : emptyArray;\n            }\n            return links.switchTypes;\n        }\n        function eachTypeContainedIn(source, types) {\n            return source.flags & 65536 /* Union */ ? !ts.forEach(source.types, function (t) { return !ts.contains(types, t); }) : ts.contains(types, source);\n        }\n        function isTypeSubsetOf(source, target) {\n            return source === target || target.flags & 65536 /* Union */ && isTypeSubsetOfUnion(source, target);\n        }\n        function isTypeSubsetOfUnion(source, target) {\n            if (source.flags & 65536 /* Union */) {\n                for (var _i = 0, _a = source.types; _i < _a.length; _i++) {\n                    var t = _a[_i];\n                    if (!containsType(target.types, t)) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            if (source.flags & 256 /* EnumLiteral */ && target.flags & 16 /* Enum */ && source.baseType === target) {\n                return true;\n            }\n            return containsType(target.types, source);\n        }\n        function forEachType(type, f) {\n            return type.flags & 65536 /* Union */ ? ts.forEach(type.types, f) : f(type);\n        }\n        function filterType(type, f) {\n            if (type.flags & 65536 /* Union */) {\n                var types = type.types;\n                var filtered = ts.filter(types, f);\n                return filtered === types ? type : getUnionTypeFromSortedList(filtered);\n            }\n            return f(type) ? type : neverType;\n        }\n        function mapType(type, f) {\n            return type.flags & 65536 /* Union */ ? getUnionType(ts.map(type.types, f)) : f(type);\n        }\n        function extractTypesOfKind(type, kind) {\n            return filterType(type, function (t) { return (t.flags & kind) !== 0; });\n        }\n        // Return a new type in which occurrences of the string and number primitive types in\n        // typeWithPrimitives have been replaced with occurrences of string literals and numeric\n        // literals in typeWithLiterals, respectively.\n        function replacePrimitivesWithLiterals(typeWithPrimitives, typeWithLiterals) {\n            if (isTypeSubsetOf(stringType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, 32 /* StringLiteral */) ||\n                isTypeSubsetOf(numberType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, 64 /* NumberLiteral */)) {\n                return mapType(typeWithPrimitives, function (t) {\n                    return t.flags & 2 /* String */ ? extractTypesOfKind(typeWithLiterals, 2 /* String */ | 32 /* StringLiteral */) :\n                        t.flags & 4 /* Number */ ? extractTypesOfKind(typeWithLiterals, 4 /* Number */ | 64 /* NumberLiteral */) :\n                            t;\n                });\n            }\n            return typeWithPrimitives;\n        }\n        function isIncomplete(flowType) {\n            return flowType.flags === 0;\n        }\n        function getTypeFromFlowType(flowType) {\n            return flowType.flags === 0 ? flowType.type : flowType;\n        }\n        function createFlowType(type, incomplete) {\n            return incomplete ? { flags: 0, type: type } : type;\n        }\n        // An evolving array type tracks the element types that have so far been seen in an\n        // 'x.push(value)' or 'x[n] = value' operation along the control flow graph. Evolving\n        // array types are ultimately converted into manifest array types (using getFinalArrayType)\n        // and never escape the getFlowTypeOfReference function.\n        function createEvolvingArrayType(elementType) {\n            var result = createObjectType(256 /* EvolvingArray */);\n            result.elementType = elementType;\n            return result;\n        }\n        function getEvolvingArrayType(elementType) {\n            return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType));\n        }\n        // When adding evolving array element types we do not perform subtype reduction. Instead,\n        // we defer subtype reduction until the evolving array type is finalized into a manifest\n        // array type.\n        function addEvolvingArrayElementType(evolvingArrayType, node) {\n            var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node));\n            return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType]));\n        }\n        function createFinalArrayType(elementType) {\n            return elementType.flags & 8192 /* Never */ ?\n                autoArrayType :\n                createArrayType(elementType.flags & 65536 /* Union */ ?\n                    getUnionType(elementType.types, /*subtypeReduction*/ true) :\n                    elementType);\n        }\n        // We perform subtype reduction upon obtaining the final array type from an evolving array type.\n        function getFinalArrayType(evolvingArrayType) {\n            return evolvingArrayType.finalArrayType || (evolvingArrayType.finalArrayType = createFinalArrayType(evolvingArrayType.elementType));\n        }\n        function finalizeEvolvingArrayType(type) {\n            return getObjectFlags(type) & 256 /* EvolvingArray */ ? getFinalArrayType(type) : type;\n        }\n        function getElementTypeOfEvolvingArrayType(type) {\n            return getObjectFlags(type) & 256 /* EvolvingArray */ ? type.elementType : neverType;\n        }\n        function isEvolvingArrayTypeList(types) {\n            var hasEvolvingArrayType = false;\n            for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {\n                var t = types_12[_i];\n                if (!(t.flags & 8192 /* Never */)) {\n                    if (!(getObjectFlags(t) & 256 /* EvolvingArray */)) {\n                        return false;\n                    }\n                    hasEvolvingArrayType = true;\n                }\n            }\n            return hasEvolvingArrayType;\n        }\n        // At flow control branch or loop junctions, if the type along every antecedent code path\n        // is an evolving array type, we construct a combined evolving array type. Otherwise we\n        // finalize all evolving array types.\n        function getUnionOrEvolvingArrayType(types, subtypeReduction) {\n            return isEvolvingArrayTypeList(types) ?\n                getEvolvingArrayType(getUnionType(ts.map(types, getElementTypeOfEvolvingArrayType))) :\n                getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction);\n        }\n        // Return true if the given node is 'x' in an 'x.length', x.push(value)', 'x.unshift(value)' or\n        // 'x[n] = value' operation, where 'n' is an expression of type any, undefined, or a number-like type.\n        function isEvolvingArrayOperationTarget(node) {\n            var root = getReferenceRoot(node);\n            var parent = root.parent;\n            var isLengthPushOrUnshift = parent.kind === 177 /* PropertyAccessExpression */ && (parent.name.text === \"length\" ||\n                parent.parent.kind === 179 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name));\n            var isElementAssignment = parent.kind === 178 /* ElementAccessExpression */ &&\n                parent.expression === root &&\n                parent.parent.kind === 192 /* BinaryExpression */ &&\n                parent.parent.operatorToken.kind === 57 /* EqualsToken */ &&\n                parent.parent.left === parent &&\n                !ts.isAssignmentTarget(parent.parent) &&\n                isTypeAnyOrAllConstituentTypesHaveKind(getTypeOfExpression(parent.argumentExpression), 340 /* NumberLike */ | 2048 /* Undefined */);\n            return isLengthPushOrUnshift || isElementAssignment;\n        }\n        function maybeTypePredicateCall(node) {\n            var links = getNodeLinks(node);\n            if (links.maybeTypePredicate === undefined) {\n                links.maybeTypePredicate = getMaybeTypePredicate(node);\n            }\n            return links.maybeTypePredicate;\n        }\n        function getMaybeTypePredicate(node) {\n            if (node.expression.kind !== 96 /* SuperKeyword */) {\n                var funcType = checkNonNullExpression(node.expression);\n                if (funcType !== silentNeverType) {\n                    var apparentType = getApparentType(funcType);\n                    if (apparentType !== unknownType) {\n                        var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */);\n                        return !!ts.forEach(callSignatures, function (sig) { return sig.typePredicate; });\n                    }\n                }\n            }\n            return false;\n        }\n        function getFlowTypeOfReference(reference, declaredType, assumeInitialized, flowContainer) {\n            var key;\n            if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 1033215 /* Narrowable */)) {\n                return declaredType;\n            }\n            var initialType = assumeInitialized ? declaredType :\n                declaredType === autoType || declaredType === autoArrayType ? undefinedType :\n                    includeFalsyTypes(declaredType, 2048 /* Undefined */);\n            var visitedFlowStart = visitedFlowCount;\n            var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode));\n            visitedFlowCount = visitedFlowStart;\n            // When the reference is 'x' in an 'x.length', 'x.push(value)', 'x.unshift(value)' or x[n] = value' operation,\n            // we give type 'any[]' to 'x' instead of using the type determined by control flow analysis such that operations\n            // on empty arrays are possible without implicit any errors and new element types can be inferred without\n            // type mismatch errors.\n            var resultType = getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType);\n            if (reference.parent.kind === 201 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 8192 /* Never */) {\n                return declaredType;\n            }\n            return resultType;\n            function getTypeAtFlowNode(flow) {\n                while (true) {\n                    if (flow.flags & 1024 /* Shared */) {\n                        // We cache results of flow type resolution for shared nodes that were previously visited in\n                        // the same getFlowTypeOfReference invocation. A node is considered shared when it is the\n                        // antecedent of more than one node.\n                        for (var i = visitedFlowStart; i < visitedFlowCount; i++) {\n                            if (visitedFlowNodes[i] === flow) {\n                                return visitedFlowTypes[i];\n                            }\n                        }\n                    }\n                    var type = void 0;\n                    if (flow.flags & 16 /* Assignment */) {\n                        type = getTypeAtFlowAssignment(flow);\n                        if (!type) {\n                            flow = flow.antecedent;\n                            continue;\n                        }\n                    }\n                    else if (flow.flags & 96 /* Condition */) {\n                        type = getTypeAtFlowCondition(flow);\n                    }\n                    else if (flow.flags & 128 /* SwitchClause */) {\n                        type = getTypeAtSwitchClause(flow);\n                    }\n                    else if (flow.flags & 12 /* Label */) {\n                        if (flow.antecedents.length === 1) {\n                            flow = flow.antecedents[0];\n                            continue;\n                        }\n                        type = flow.flags & 4 /* BranchLabel */ ?\n                            getTypeAtFlowBranchLabel(flow) :\n                            getTypeAtFlowLoopLabel(flow);\n                    }\n                    else if (flow.flags & 256 /* ArrayMutation */) {\n                        type = getTypeAtFlowArrayMutation(flow);\n                        if (!type) {\n                            flow = flow.antecedent;\n                            continue;\n                        }\n                    }\n                    else if (flow.flags & 2 /* Start */) {\n                        // Check if we should continue with the control flow of the containing function.\n                        var container = flow.container;\n                        if (container && container !== flowContainer && reference.kind !== 177 /* PropertyAccessExpression */) {\n                            flow = container.flowNode;\n                            continue;\n                        }\n                        // At the top of the flow we have the initial type.\n                        type = initialType;\n                    }\n                    else {\n                        // Unreachable code errors are reported in the binding phase. Here we\n                        // simply return the non-auto declared type to reduce follow-on errors.\n                        type = convertAutoToAny(declaredType);\n                    }\n                    if (flow.flags & 1024 /* Shared */) {\n                        // Record visited node and the associated type in the cache.\n                        visitedFlowNodes[visitedFlowCount] = flow;\n                        visitedFlowTypes[visitedFlowCount] = type;\n                        visitedFlowCount++;\n                    }\n                    return type;\n                }\n            }\n            function getTypeAtFlowAssignment(flow) {\n                var node = flow.node;\n                // Assignments only narrow the computed type if the declared type is a union type. Thus, we\n                // only need to evaluate the assigned type if the declared type is a union type.\n                if (isMatchingReference(reference, node)) {\n                    if (ts.getAssignmentTargetKind(node) === 2 /* Compound */) {\n                        var flowType = getTypeAtFlowNode(flow.antecedent);\n                        return createFlowType(getBaseTypeOfLiteralType(getTypeFromFlowType(flowType)), isIncomplete(flowType));\n                    }\n                    if (declaredType === autoType || declaredType === autoArrayType) {\n                        if (isEmptyArrayAssignment(node)) {\n                            return getEvolvingArrayType(neverType);\n                        }\n                        var assignedType = getBaseTypeOfLiteralType(getInitialOrAssignedType(node));\n                        return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType;\n                    }\n                    if (declaredType.flags & 65536 /* Union */) {\n                        return getAssignmentReducedType(declaredType, getInitialOrAssignedType(node));\n                    }\n                    return declaredType;\n                }\n                // We didn't have a direct match. However, if the reference is a dotted name, this\n                // may be an assignment to a left hand part of the reference. For example, for a\n                // reference 'x.y.z', we may be at an assignment to 'x.y' or 'x'. In that case,\n                // return the declared type.\n                if (containsMatchingReference(reference, node)) {\n                    return declaredType;\n                }\n                // Assignment doesn't affect reference\n                return undefined;\n            }\n            function getTypeAtFlowArrayMutation(flow) {\n                var node = flow.node;\n                var expr = node.kind === 179 /* CallExpression */ ?\n                    node.expression.expression :\n                    node.left.expression;\n                if (isMatchingReference(reference, getReferenceCandidate(expr))) {\n                    var flowType = getTypeAtFlowNode(flow.antecedent);\n                    var type = getTypeFromFlowType(flowType);\n                    if (getObjectFlags(type) & 256 /* EvolvingArray */) {\n                        var evolvedType_1 = type;\n                        if (node.kind === 179 /* CallExpression */) {\n                            for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {\n                                var arg = _a[_i];\n                                evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg);\n                            }\n                        }\n                        else {\n                            var indexType = getTypeOfExpression(node.left.argumentExpression);\n                            if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 /* NumberLike */ | 2048 /* Undefined */)) {\n                                evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right);\n                            }\n                        }\n                        return evolvedType_1 === type ? flowType : createFlowType(evolvedType_1, isIncomplete(flowType));\n                    }\n                    return flowType;\n                }\n                return undefined;\n            }\n            function getTypeAtFlowCondition(flow) {\n                var flowType = getTypeAtFlowNode(flow.antecedent);\n                var type = getTypeFromFlowType(flowType);\n                if (type.flags & 8192 /* Never */) {\n                    return flowType;\n                }\n                // If we have an antecedent type (meaning we're reachable in some way), we first\n                // attempt to narrow the antecedent type. If that produces the never type, and if\n                // the antecedent type is incomplete (i.e. a transient type in a loop), then we\n                // take the type guard as an indication that control *could* reach here once we\n                // have the complete type. We proceed by switching to the silent never type which\n                // doesn't report errors when operators are applied to it. Note that this is the\n                // *only* place a silent never type is ever generated.\n                var assumeTrue = (flow.flags & 32 /* TrueCondition */) !== 0;\n                var nonEvolvingType = finalizeEvolvingArrayType(type);\n                var narrowedType = narrowType(nonEvolvingType, flow.expression, assumeTrue);\n                if (narrowedType === nonEvolvingType) {\n                    return flowType;\n                }\n                var incomplete = isIncomplete(flowType);\n                var resultType = incomplete && narrowedType.flags & 8192 /* Never */ ? silentNeverType : narrowedType;\n                return createFlowType(resultType, incomplete);\n            }\n            function getTypeAtSwitchClause(flow) {\n                var flowType = getTypeAtFlowNode(flow.antecedent);\n                var type = getTypeFromFlowType(flowType);\n                var expr = flow.switchStatement.expression;\n                if (isMatchingReference(reference, expr)) {\n                    type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);\n                }\n                else if (isMatchingReferenceDiscriminant(expr)) {\n                    type = narrowTypeByDiscriminant(type, expr, function (t) { return narrowTypeBySwitchOnDiscriminant(t, flow.switchStatement, flow.clauseStart, flow.clauseEnd); });\n                }\n                return createFlowType(type, isIncomplete(flowType));\n            }\n            function getTypeAtFlowBranchLabel(flow) {\n                var antecedentTypes = [];\n                var subtypeReduction = false;\n                var seenIncomplete = false;\n                for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) {\n                    var antecedent = _a[_i];\n                    var flowType = getTypeAtFlowNode(antecedent);\n                    var type = getTypeFromFlowType(flowType);\n                    // If the type at a particular antecedent path is the declared type and the\n                    // reference is known to always be assigned (i.e. when declared and initial types\n                    // are the same), there is no reason to process more antecedents since the only\n                    // possible outcome is subtypes that will be removed in the final union type anyway.\n                    if (type === declaredType && declaredType === initialType) {\n                        return type;\n                    }\n                    if (!ts.contains(antecedentTypes, type)) {\n                        antecedentTypes.push(type);\n                    }\n                    // If an antecedent type is not a subset of the declared type, we need to perform\n                    // subtype reduction. This happens when a \"foreign\" type is injected into the control\n                    // flow using the instanceof operator or a user defined type predicate.\n                    if (!isTypeSubsetOf(type, declaredType)) {\n                        subtypeReduction = true;\n                    }\n                    if (isIncomplete(flowType)) {\n                        seenIncomplete = true;\n                    }\n                }\n                return createFlowType(getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction), seenIncomplete);\n            }\n            function getTypeAtFlowLoopLabel(flow) {\n                // If we have previously computed the control flow type for the reference at\n                // this flow loop junction, return the cached type.\n                var id = getFlowNodeId(flow);\n                var cache = flowLoopCaches[id] || (flowLoopCaches[id] = ts.createMap());\n                if (!key) {\n                    key = getFlowCacheKey(reference);\n                }\n                if (cache[key]) {\n                    return cache[key];\n                }\n                // If this flow loop junction and reference are already being processed, return\n                // the union of the types computed for each branch so far, marked as incomplete.\n                // It is possible to see an empty array in cases where loops are nested and the\n                // back edge of the outer loop reaches an inner loop that is already being analyzed.\n                // In such cases we restart the analysis of the inner loop, which will then see\n                // a non-empty in-process array for the outer loop and eventually terminate because\n                // the first antecedent of a loop junction is always the non-looping control flow\n                // path that leads to the top.\n                for (var i = flowLoopStart; i < flowLoopCount; i++) {\n                    if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key && flowLoopTypes[i].length) {\n                        return createFlowType(getUnionOrEvolvingArrayType(flowLoopTypes[i], /*subtypeReduction*/ false), /*incomplete*/ true);\n                    }\n                }\n                // Add the flow loop junction and reference to the in-process stack and analyze\n                // each antecedent code path.\n                var antecedentTypes = [];\n                var subtypeReduction = false;\n                var firstAntecedentType;\n                flowLoopNodes[flowLoopCount] = flow;\n                flowLoopKeys[flowLoopCount] = key;\n                flowLoopTypes[flowLoopCount] = antecedentTypes;\n                for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) {\n                    var antecedent = _a[_i];\n                    flowLoopCount++;\n                    var flowType = getTypeAtFlowNode(antecedent);\n                    flowLoopCount--;\n                    if (!firstAntecedentType) {\n                        firstAntecedentType = flowType;\n                    }\n                    var type = getTypeFromFlowType(flowType);\n                    // If we see a value appear in the cache it is a sign that control flow  analysis\n                    // was restarted and completed by checkExpressionCached. We can simply pick up\n                    // the resulting type and bail out.\n                    if (cache[key]) {\n                        return cache[key];\n                    }\n                    if (!ts.contains(antecedentTypes, type)) {\n                        antecedentTypes.push(type);\n                    }\n                    // If an antecedent type is not a subset of the declared type, we need to perform\n                    // subtype reduction. This happens when a \"foreign\" type is injected into the control\n                    // flow using the instanceof operator or a user defined type predicate.\n                    if (!isTypeSubsetOf(type, declaredType)) {\n                        subtypeReduction = true;\n                    }\n                    // If the type at a particular antecedent path is the declared type there is no\n                    // reason to process more antecedents since the only possible outcome is subtypes\n                    // that will be removed in the final union type anyway.\n                    if (type === declaredType) {\n                        break;\n                    }\n                }\n                // The result is incomplete if the first antecedent (the non-looping control flow path)\n                // is incomplete.\n                var result = getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction);\n                if (isIncomplete(firstAntecedentType)) {\n                    return createFlowType(result, /*incomplete*/ true);\n                }\n                return cache[key] = result;\n            }\n            function isMatchingReferenceDiscriminant(expr) {\n                return expr.kind === 177 /* PropertyAccessExpression */ &&\n                    declaredType.flags & 65536 /* Union */ &&\n                    isMatchingReference(reference, expr.expression) &&\n                    isDiscriminantProperty(declaredType, expr.name.text);\n            }\n            function narrowTypeByDiscriminant(type, propAccess, narrowType) {\n                var propName = propAccess.name.text;\n                var propType = getTypeOfPropertyOfType(type, propName);\n                var narrowedPropType = propType && narrowType(propType);\n                return propType === narrowedPropType ? type : filterType(type, function (t) { return isTypeComparableTo(getTypeOfPropertyOfType(t, propName), narrowedPropType); });\n            }\n            function narrowTypeByTruthiness(type, expr, assumeTrue) {\n                if (isMatchingReference(reference, expr)) {\n                    return getTypeWithFacts(type, assumeTrue ? 1048576 /* Truthy */ : 2097152 /* Falsy */);\n                }\n                if (isMatchingReferenceDiscriminant(expr)) {\n                    return narrowTypeByDiscriminant(type, expr, function (t) { return getTypeWithFacts(t, assumeTrue ? 1048576 /* Truthy */ : 2097152 /* Falsy */); });\n                }\n                if (containsMatchingReferenceDiscriminant(reference, expr)) {\n                    return declaredType;\n                }\n                return type;\n            }\n            function narrowTypeByBinaryExpression(type, expr, assumeTrue) {\n                switch (expr.operatorToken.kind) {\n                    case 57 /* EqualsToken */:\n                        return narrowTypeByTruthiness(type, expr.left, assumeTrue);\n                    case 31 /* EqualsEqualsToken */:\n                    case 32 /* ExclamationEqualsToken */:\n                    case 33 /* EqualsEqualsEqualsToken */:\n                    case 34 /* ExclamationEqualsEqualsToken */:\n                        var operator_1 = expr.operatorToken.kind;\n                        var left_1 = getReferenceCandidate(expr.left);\n                        var right_1 = getReferenceCandidate(expr.right);\n                        if (left_1.kind === 187 /* TypeOfExpression */ && right_1.kind === 9 /* StringLiteral */) {\n                            return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue);\n                        }\n                        if (right_1.kind === 187 /* TypeOfExpression */ && left_1.kind === 9 /* StringLiteral */) {\n                            return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue);\n                        }\n                        if (isMatchingReference(reference, left_1)) {\n                            return narrowTypeByEquality(type, operator_1, right_1, assumeTrue);\n                        }\n                        if (isMatchingReference(reference, right_1)) {\n                            return narrowTypeByEquality(type, operator_1, left_1, assumeTrue);\n                        }\n                        if (isMatchingReferenceDiscriminant(left_1)) {\n                            return narrowTypeByDiscriminant(type, left_1, function (t) { return narrowTypeByEquality(t, operator_1, right_1, assumeTrue); });\n                        }\n                        if (isMatchingReferenceDiscriminant(right_1)) {\n                            return narrowTypeByDiscriminant(type, right_1, function (t) { return narrowTypeByEquality(t, operator_1, left_1, assumeTrue); });\n                        }\n                        if (containsMatchingReferenceDiscriminant(reference, left_1) || containsMatchingReferenceDiscriminant(reference, right_1)) {\n                            return declaredType;\n                        }\n                        break;\n                    case 92 /* InstanceOfKeyword */:\n                        return narrowTypeByInstanceof(type, expr, assumeTrue);\n                    case 25 /* CommaToken */:\n                        return narrowType(type, expr.right, assumeTrue);\n                }\n                return type;\n            }\n            function narrowTypeByEquality(type, operator, value, assumeTrue) {\n                if (type.flags & 1 /* Any */) {\n                    return type;\n                }\n                if (operator === 32 /* ExclamationEqualsToken */ || operator === 34 /* ExclamationEqualsEqualsToken */) {\n                    assumeTrue = !assumeTrue;\n                }\n                var valueType = getTypeOfExpression(value);\n                if (valueType.flags & 6144 /* Nullable */) {\n                    if (!strictNullChecks) {\n                        return type;\n                    }\n                    var doubleEquals = operator === 31 /* EqualsEqualsToken */ || operator === 32 /* ExclamationEqualsToken */;\n                    var facts = doubleEquals ?\n                        assumeTrue ? 65536 /* EQUndefinedOrNull */ : 524288 /* NEUndefinedOrNull */ :\n                        value.kind === 94 /* NullKeyword */ ?\n                            assumeTrue ? 32768 /* EQNull */ : 262144 /* NENull */ :\n                            assumeTrue ? 16384 /* EQUndefined */ : 131072 /* NEUndefined */;\n                    return getTypeWithFacts(type, facts);\n                }\n                if (type.flags & 33281 /* NotUnionOrUnit */) {\n                    return type;\n                }\n                if (assumeTrue) {\n                    var narrowedType = filterType(type, function (t) { return areTypesComparable(t, valueType); });\n                    return narrowedType.flags & 8192 /* Never */ ? type : replacePrimitivesWithLiterals(narrowedType, valueType);\n                }\n                if (isUnitType(valueType)) {\n                    var regularType_1 = getRegularTypeOfLiteralType(valueType);\n                    return filterType(type, function (t) { return getRegularTypeOfLiteralType(t) !== regularType_1; });\n                }\n                return type;\n            }\n            function narrowTypeByTypeof(type, typeOfExpr, operator, literal, assumeTrue) {\n                // We have '==', '!=', '====', or !==' operator with 'typeof xxx' and string literal operands\n                var target = getReferenceCandidate(typeOfExpr.expression);\n                if (!isMatchingReference(reference, target)) {\n                    // For a reference of the form 'x.y', a 'typeof x === ...' type guard resets the\n                    // narrowed type of 'y' to its declared type.\n                    if (containsMatchingReference(reference, target)) {\n                        return declaredType;\n                    }\n                    return type;\n                }\n                if (operator === 32 /* ExclamationEqualsToken */ || operator === 34 /* ExclamationEqualsEqualsToken */) {\n                    assumeTrue = !assumeTrue;\n                }\n                if (assumeTrue && !(type.flags & 65536 /* Union */)) {\n                    // We narrow a non-union type to an exact primitive type if the non-union type\n                    // is a supertype of that primitive type. For example, type 'any' can be narrowed\n                    // to one of the primitive types.\n                    var targetType = typeofTypesByName[literal.text];\n                    if (targetType && isTypeSubtypeOf(targetType, type)) {\n                        return targetType;\n                    }\n                }\n                var facts = assumeTrue ?\n                    typeofEQFacts[literal.text] || 64 /* TypeofEQHostObject */ :\n                    typeofNEFacts[literal.text] || 8192 /* TypeofNEHostObject */;\n                return getTypeWithFacts(type, facts);\n            }\n            function narrowTypeBySwitchOnDiscriminant(type, switchStatement, clauseStart, clauseEnd) {\n                // We only narrow if all case expressions specify values with unit types\n                var switchTypes = getSwitchClauseTypes(switchStatement);\n                if (!switchTypes.length) {\n                    return type;\n                }\n                var clauseTypes = switchTypes.slice(clauseStart, clauseEnd);\n                var hasDefaultClause = clauseStart === clauseEnd || ts.contains(clauseTypes, neverType);\n                var discriminantType = getUnionType(clauseTypes);\n                var caseType = discriminantType.flags & 8192 /* Never */ ? neverType :\n                    replacePrimitivesWithLiterals(filterType(type, function (t) { return isTypeComparableTo(discriminantType, t); }), discriminantType);\n                if (!hasDefaultClause) {\n                    return caseType;\n                }\n                var defaultType = filterType(type, function (t) { return !(isUnitType(t) && ts.contains(switchTypes, getRegularTypeOfLiteralType(t))); });\n                return caseType.flags & 8192 /* Never */ ? defaultType : getUnionType([caseType, defaultType]);\n            }\n            function narrowTypeByInstanceof(type, expr, assumeTrue) {\n                var left = getReferenceCandidate(expr.left);\n                if (!isMatchingReference(reference, left)) {\n                    // For a reference of the form 'x.y', an 'x instanceof T' type guard resets the\n                    // narrowed type of 'y' to its declared type.\n                    if (containsMatchingReference(reference, left)) {\n                        return declaredType;\n                    }\n                    return type;\n                }\n                // Check that right operand is a function type with a prototype property\n                var rightType = getTypeOfExpression(expr.right);\n                if (!isTypeSubtypeOf(rightType, globalFunctionType)) {\n                    return type;\n                }\n                var targetType;\n                var prototypeProperty = getPropertyOfType(rightType, \"prototype\");\n                if (prototypeProperty) {\n                    // Target type is type of the prototype property\n                    var prototypePropertyType = getTypeOfSymbol(prototypeProperty);\n                    if (!isTypeAny(prototypePropertyType)) {\n                        targetType = prototypePropertyType;\n                    }\n                }\n                // Don't narrow from 'any' if the target type is exactly 'Object' or 'Function'\n                if (isTypeAny(type) && (targetType === globalObjectType || targetType === globalFunctionType)) {\n                    return type;\n                }\n                if (!targetType) {\n                    // Target type is type of construct signature\n                    var constructSignatures = void 0;\n                    if (getObjectFlags(rightType) & 2 /* Interface */) {\n                        constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;\n                    }\n                    else if (getObjectFlags(rightType) & 16 /* Anonymous */) {\n                        constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */);\n                    }\n                    if (constructSignatures && constructSignatures.length) {\n                        targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));\n                    }\n                }\n                if (targetType) {\n                    return getNarrowedType(type, targetType, assumeTrue, isTypeInstanceOf);\n                }\n                return type;\n            }\n            function getNarrowedType(type, candidate, assumeTrue, isRelated) {\n                if (!assumeTrue) {\n                    return filterType(type, function (t) { return !isRelated(t, candidate); });\n                }\n                // If the current type is a union type, remove all constituents that couldn't be instances of\n                // the candidate type. If one or more constituents remain, return a union of those.\n                if (type.flags & 65536 /* Union */) {\n                    var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });\n                    if (!(assignableType.flags & 8192 /* Never */)) {\n                        return assignableType;\n                    }\n                }\n                // If the candidate type is a subtype of the target type, narrow to the candidate type.\n                // Otherwise, if the target type is assignable to the candidate type, keep the target type.\n                // Otherwise, if the candidate type is assignable to the target type, narrow to the candidate\n                // type. Otherwise, the types are completely unrelated, so narrow to an intersection of the\n                // two types.\n                var targetType = type.flags & 16384 /* TypeParameter */ ? getApparentType(type) : type;\n                return isTypeSubtypeOf(candidate, type) ? candidate :\n                    isTypeAssignableTo(type, candidate) ? type :\n                        isTypeAssignableTo(candidate, targetType) ? candidate :\n                            getIntersectionType([type, candidate]);\n            }\n            function narrowTypeByTypePredicate(type, callExpression, assumeTrue) {\n                if (!hasMatchingArgument(callExpression, reference) || !maybeTypePredicateCall(callExpression)) {\n                    return type;\n                }\n                var signature = getResolvedSignature(callExpression);\n                var predicate = signature.typePredicate;\n                if (!predicate) {\n                    return type;\n                }\n                // Don't narrow from 'any' if the predicate type is exactly 'Object' or 'Function'\n                if (isTypeAny(type) && (predicate.type === globalObjectType || predicate.type === globalFunctionType)) {\n                    return type;\n                }\n                if (ts.isIdentifierTypePredicate(predicate)) {\n                    var predicateArgument = callExpression.arguments[predicate.parameterIndex];\n                    if (predicateArgument) {\n                        if (isMatchingReference(reference, predicateArgument)) {\n                            return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);\n                        }\n                        if (containsMatchingReference(reference, predicateArgument)) {\n                            return declaredType;\n                        }\n                    }\n                }\n                else {\n                    var invokedExpression = ts.skipParentheses(callExpression.expression);\n                    if (invokedExpression.kind === 178 /* ElementAccessExpression */ || invokedExpression.kind === 177 /* PropertyAccessExpression */) {\n                        var accessExpression = invokedExpression;\n                        var possibleReference = ts.skipParentheses(accessExpression.expression);\n                        if (isMatchingReference(reference, possibleReference)) {\n                            return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);\n                        }\n                        if (containsMatchingReference(reference, possibleReference)) {\n                            return declaredType;\n                        }\n                    }\n                }\n                return type;\n            }\n            // Narrow the given type based on the given expression having the assumed boolean value. The returned type\n            // will be a subtype or the same type as the argument.\n            function narrowType(type, expr, assumeTrue) {\n                switch (expr.kind) {\n                    case 70 /* Identifier */:\n                    case 98 /* ThisKeyword */:\n                    case 177 /* PropertyAccessExpression */:\n                        return narrowTypeByTruthiness(type, expr, assumeTrue);\n                    case 179 /* CallExpression */:\n                        return narrowTypeByTypePredicate(type, expr, assumeTrue);\n                    case 183 /* ParenthesizedExpression */:\n                        return narrowType(type, expr.expression, assumeTrue);\n                    case 192 /* BinaryExpression */:\n                        return narrowTypeByBinaryExpression(type, expr, assumeTrue);\n                    case 190 /* PrefixUnaryExpression */:\n                        if (expr.operator === 50 /* ExclamationToken */) {\n                            return narrowType(type, expr.operand, !assumeTrue);\n                        }\n                        break;\n                }\n                return type;\n            }\n        }\n        function getTypeOfSymbolAtLocation(symbol, location) {\n            // If we have an identifier or a property access at the given location, if the location is\n            // an dotted name expression, and if the location is not an assignment target, obtain the type\n            // of the expression (which will reflect control flow analysis). If the expression indeed\n            // resolved to the given symbol, return the narrowed type.\n            if (location.kind === 70 /* Identifier */) {\n                if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) {\n                    location = location.parent;\n                }\n                if (ts.isPartOfExpression(location) && !ts.isAssignmentTarget(location)) {\n                    var type = getTypeOfExpression(location);\n                    if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {\n                        return type;\n                    }\n                }\n            }\n            // The location isn't a reference to the given symbol, meaning we're being asked\n            // a hypothetical question of what type the symbol would have if there was a reference\n            // to it at the given location. Since we have no control flow information for the\n            // hypothetical reference (control flow information is created and attached by the\n            // binder), we simply return the declared type of the symbol.\n            return getTypeOfSymbol(symbol);\n        }\n        function getControlFlowContainer(node) {\n            while (true) {\n                node = node.parent;\n                if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) ||\n                    node.kind === 231 /* ModuleBlock */ ||\n                    node.kind === 261 /* SourceFile */ ||\n                    node.kind === 147 /* PropertyDeclaration */) {\n                    return node;\n                }\n            }\n        }\n        // Check if a parameter is assigned anywhere within its declaring function.\n        function isParameterAssigned(symbol) {\n            var func = ts.getRootDeclaration(symbol.valueDeclaration).parent;\n            var links = getNodeLinks(func);\n            if (!(links.flags & 4194304 /* AssignmentsMarked */)) {\n                links.flags |= 4194304 /* AssignmentsMarked */;\n                if (!hasParentWithAssignmentsMarked(func)) {\n                    markParameterAssignments(func);\n                }\n            }\n            return symbol.isAssigned || false;\n        }\n        function hasParentWithAssignmentsMarked(node) {\n            while (true) {\n                node = node.parent;\n                if (!node) {\n                    return false;\n                }\n                if (ts.isFunctionLike(node) && getNodeLinks(node).flags & 4194304 /* AssignmentsMarked */) {\n                    return true;\n                }\n            }\n        }\n        function markParameterAssignments(node) {\n            if (node.kind === 70 /* Identifier */) {\n                if (ts.isAssignmentTarget(node)) {\n                    var symbol = getResolvedSymbol(node);\n                    if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 144 /* Parameter */) {\n                        symbol.isAssigned = true;\n                    }\n                }\n            }\n            else {\n                ts.forEachChild(node, markParameterAssignments);\n            }\n        }\n        function isConstVariable(symbol) {\n            return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0 && getTypeOfSymbol(symbol) !== autoArrayType;\n        }\n        function checkIdentifier(node) {\n            var symbol = getResolvedSymbol(node);\n            if (symbol === unknownSymbol) {\n                return unknownType;\n            }\n            // As noted in ECMAScript 6 language spec, arrow functions never have an arguments objects.\n            // Although in down-level emit of arrow function, we emit it using function expression which means that\n            // arguments objects will be bound to the inner object; emitting arrow function natively in ES6, arguments objects\n            // will be bound to non-arrow function that contain this arrow function. This results in inconsistent behavior.\n            // To avoid that we will give an error to users if they use arguments objects in arrow function so that they\n            // can explicitly bound arguments objects\n            if (symbol === argumentsSymbol) {\n                var container = ts.getContainingFunction(node);\n                if (languageVersion < 2 /* ES2015 */) {\n                    if (container.kind === 185 /* ArrowFunction */) {\n                        error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);\n                    }\n                    else if (ts.hasModifier(container, 256 /* Async */)) {\n                        error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method);\n                    }\n                }\n                if (node.flags & 16384 /* AwaitContext */) {\n                    getNodeLinks(container).flags |= 8192 /* CaptureArguments */;\n                }\n                return getTypeOfSymbol(symbol);\n            }\n            if (symbol.flags & 8388608 /* Alias */ && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) {\n                markAliasSymbolAsReferenced(symbol);\n            }\n            var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);\n            if (localOrExportSymbol.flags & 32 /* Class */) {\n                var declaration_1 = localOrExportSymbol.valueDeclaration;\n                // Due to the emit for class decorators, any reference to the class from inside of the class body\n                // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind\n                // behavior of class names in ES6.\n                if (declaration_1.kind === 226 /* ClassDeclaration */\n                    && ts.nodeIsDecorated(declaration_1)) {\n                    var container = ts.getContainingClass(node);\n                    while (container !== undefined) {\n                        if (container === declaration_1 && container.name !== node) {\n                            getNodeLinks(declaration_1).flags |= 8388608 /* ClassWithConstructorReference */;\n                            getNodeLinks(node).flags |= 16777216 /* ConstructorReferenceInClass */;\n                            break;\n                        }\n                        container = ts.getContainingClass(container);\n                    }\n                }\n                else if (declaration_1.kind === 197 /* ClassExpression */) {\n                    // When we emit a class expression with static members that contain a reference\n                    // to the constructor in the initializer, we will need to substitute that\n                    // binding with an alias as the class name is not in scope.\n                    var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);\n                    while (container !== undefined) {\n                        if (container.parent === declaration_1) {\n                            if (container.kind === 147 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) {\n                                getNodeLinks(declaration_1).flags |= 8388608 /* ClassWithConstructorReference */;\n                                getNodeLinks(node).flags |= 16777216 /* ConstructorReferenceInClass */;\n                            }\n                            break;\n                        }\n                        container = ts.getThisContainer(container, /*includeArrowFunctions*/ false);\n                    }\n                }\n            }\n            checkCollisionWithCapturedSuperVariable(node, node);\n            checkCollisionWithCapturedThisVariable(node, node);\n            checkNestedBlockScopedBinding(node, symbol);\n            var type = getTypeOfSymbol(localOrExportSymbol);\n            var declaration = localOrExportSymbol.valueDeclaration;\n            var assignmentKind = ts.getAssignmentTargetKind(node);\n            if (assignmentKind) {\n                if (!(localOrExportSymbol.flags & 3 /* Variable */)) {\n                    error(node, ts.Diagnostics.Cannot_assign_to_0_because_it_is_not_a_variable, symbolToString(symbol));\n                    return unknownType;\n                }\n                if (isReadonlySymbol(localOrExportSymbol)) {\n                    error(node, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(symbol));\n                    return unknownType;\n                }\n            }\n            // We only narrow variables and parameters occurring in a non-assignment position. For all other\n            // entities we simply return the declared type.\n            if (!(localOrExportSymbol.flags & 3 /* Variable */) || assignmentKind === 1 /* Definite */ || !declaration) {\n                return type;\n            }\n            // The declaration container is the innermost function that encloses the declaration of the variable\n            // or parameter. The flow container is the innermost function starting with which we analyze the control\n            // flow graph to determine the control flow based type.\n            var isParameter = ts.getRootDeclaration(declaration).kind === 144 /* Parameter */;\n            var declarationContainer = getControlFlowContainer(declaration);\n            var flowContainer = getControlFlowContainer(node);\n            var isOuterVariable = flowContainer !== declarationContainer;\n            // When the control flow originates in a function expression or arrow function and we are referencing\n            // a const variable or parameter from an outer function, we extend the origin of the control flow\n            // analysis to include the immediately enclosing function.\n            while (flowContainer !== declarationContainer && (flowContainer.kind === 184 /* FunctionExpression */ ||\n                flowContainer.kind === 185 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&\n                (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {\n                flowContainer = getControlFlowContainer(flowContainer);\n            }\n            // We only look for uninitialized variables in strict null checking mode, and only when we can analyze\n            // the entire control flow graph from the variable's declaration (i.e. when the flow container and\n            // declaration container are the same).\n            var assumeInitialized = isParameter || isOuterVariable ||\n                type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1 /* Any */) !== 0) ||\n                ts.isInAmbientContext(declaration);\n            var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer);\n            // A variable is considered uninitialized when it is possible to analyze the entire control flow graph\n            // from declaration to use, and when the variable's declared type doesn't include undefined but the\n            // control flow based type does include undefined.\n            if (type === autoType || type === autoArrayType) {\n                if (flowType === autoType || flowType === autoArrayType) {\n                    if (compilerOptions.noImplicitAny) {\n                        error(declaration.name, ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType));\n                        error(node, ts.Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));\n                    }\n                    return convertAutoToAny(flowType);\n                }\n            }\n            else if (!assumeInitialized && !(getFalsyFlags(type) & 2048 /* Undefined */) && getFalsyFlags(flowType) & 2048 /* Undefined */) {\n                error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));\n                // Return the declared type to reduce follow-on errors\n                return type;\n            }\n            return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;\n        }\n        function isInsideFunction(node, threshold) {\n            var current = node;\n            while (current && current !== threshold) {\n                if (ts.isFunctionLike(current)) {\n                    return true;\n                }\n                current = current.parent;\n            }\n            return false;\n        }\n        function checkNestedBlockScopedBinding(node, symbol) {\n            if (languageVersion >= 2 /* ES2015 */ ||\n                (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 ||\n                symbol.valueDeclaration.parent.kind === 256 /* CatchClause */) {\n                return;\n            }\n            // 1. walk from the use site up to the declaration and check\n            // if there is anything function like between declaration and use-site (is binding/class is captured in function).\n            // 2. walk from the declaration up to the boundary of lexical environment and check\n            // if there is an iteration statement in between declaration and boundary (is binding/class declared inside iteration statement)\n            var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);\n            var usedInFunction = isInsideFunction(node.parent, container);\n            var current = container;\n            var containedInIterationStatement = false;\n            while (current && !ts.nodeStartsNewLexicalEnvironment(current)) {\n                if (ts.isIterationStatement(current, /*lookInLabeledStatements*/ false)) {\n                    containedInIterationStatement = true;\n                    break;\n                }\n                current = current.parent;\n            }\n            if (containedInIterationStatement) {\n                if (usedInFunction) {\n                    // mark iteration statement as containing block-scoped binding captured in some function\n                    getNodeLinks(current).flags |= 65536 /* LoopWithCapturedBlockScopedBinding */;\n                }\n                // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement.\n                // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back.\n                if (container.kind === 211 /* ForStatement */ &&\n                    ts.getAncestor(symbol.valueDeclaration, 224 /* VariableDeclarationList */).parent === container &&\n                    isAssignedInBodyOfForStatement(node, container)) {\n                    getNodeLinks(symbol.valueDeclaration).flags |= 2097152 /* NeedsLoopOutParameter */;\n                }\n                // set 'declared inside loop' bit on the block-scoped binding\n                getNodeLinks(symbol.valueDeclaration).flags |= 262144 /* BlockScopedBindingInLoop */;\n            }\n            if (usedInFunction) {\n                getNodeLinks(symbol.valueDeclaration).flags |= 131072 /* CapturedBlockScopedBinding */;\n            }\n        }\n        function isAssignedInBodyOfForStatement(node, container) {\n            var current = node;\n            // skip parenthesized nodes\n            while (current.parent.kind === 183 /* ParenthesizedExpression */) {\n                current = current.parent;\n            }\n            // check if node is used as LHS in some assignment expression\n            var isAssigned = false;\n            if (ts.isAssignmentTarget(current)) {\n                isAssigned = true;\n            }\n            else if ((current.parent.kind === 190 /* PrefixUnaryExpression */ || current.parent.kind === 191 /* PostfixUnaryExpression */)) {\n                var expr = current.parent;\n                isAssigned = expr.operator === 42 /* PlusPlusToken */ || expr.operator === 43 /* MinusMinusToken */;\n            }\n            if (!isAssigned) {\n                return false;\n            }\n            // at this point we know that node is the target of assignment\n            // now check that modification happens inside the statement part of the ForStatement\n            while (current !== container) {\n                if (current === container.statement) {\n                    return true;\n                }\n                else {\n                    current = current.parent;\n                }\n            }\n            return false;\n        }\n        function captureLexicalThis(node, container) {\n            getNodeLinks(node).flags |= 2 /* LexicalThis */;\n            if (container.kind === 147 /* PropertyDeclaration */ || container.kind === 150 /* Constructor */) {\n                var classNode = container.parent;\n                getNodeLinks(classNode).flags |= 4 /* CaptureThis */;\n            }\n            else {\n                getNodeLinks(container).flags |= 4 /* CaptureThis */;\n            }\n        }\n        function findFirstSuperCall(n) {\n            if (ts.isSuperCall(n)) {\n                return n;\n            }\n            else if (ts.isFunctionLike(n)) {\n                return undefined;\n            }\n            return ts.forEachChild(n, findFirstSuperCall);\n        }\n        /**\n         * Return a cached result if super-statement is already found.\n         * Otherwise, find a super statement in a given constructor function and cache the result in the node-links of the constructor\n         *\n         * @param constructor constructor-function to look for super statement\n         */\n        function getSuperCallInConstructor(constructor) {\n            var links = getNodeLinks(constructor);\n            // Only trying to find super-call if we haven't yet tried to find one.  Once we try, we will record the result\n            if (links.hasSuperCall === undefined) {\n                links.superCall = findFirstSuperCall(constructor.body);\n                links.hasSuperCall = links.superCall ? true : false;\n            }\n            return links.superCall;\n        }\n        /**\n         * Check if the given class-declaration extends null then return true.\n         * Otherwise, return false\n         * @param classDecl a class declaration to check if it extends null\n         */\n        function classDeclarationExtendsNull(classDecl) {\n            var classSymbol = getSymbolOfNode(classDecl);\n            var classInstanceType = getDeclaredTypeOfSymbol(classSymbol);\n            var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType);\n            return baseConstructorType === nullWideningType;\n        }\n        function checkThisExpression(node) {\n            // Stop at the first arrow function so that we can\n            // tell whether 'this' needs to be captured.\n            var container = ts.getThisContainer(node, /* includeArrowFunctions */ true);\n            var needToCaptureLexicalThis = false;\n            if (container.kind === 150 /* Constructor */) {\n                var containingClassDecl = container.parent;\n                var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl);\n                // If a containing class does not have extends clause or the class extends null\n                // skip checking whether super statement is called before \"this\" accessing.\n                if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) {\n                    var superCall = getSuperCallInConstructor(container);\n                    // We should give an error in the following cases:\n                    //      - No super-call\n                    //      - \"this\" is accessing before super-call.\n                    //          i.e super(this)\n                    //              this.x; super();\n                    // We want to make sure that super-call is done before accessing \"this\" so that\n                    // \"this\" is not accessed as a parameter of the super-call.\n                    if (!superCall || superCall.end > node.pos) {\n                        // In ES6, super inside constructor of class-declaration has to precede \"this\" accessing\n                        error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class);\n                    }\n                }\n            }\n            // Now skip arrow functions to get the \"real\" owner of 'this'.\n            if (container.kind === 185 /* ArrowFunction */) {\n                container = ts.getThisContainer(container, /* includeArrowFunctions */ false);\n                // When targeting es6, arrow function lexically bind \"this\" so we do not need to do the work of binding \"this\" in emitted code\n                needToCaptureLexicalThis = (languageVersion < 2 /* ES2015 */);\n            }\n            switch (container.kind) {\n                case 230 /* ModuleDeclaration */:\n                    error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);\n                    // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks\n                    break;\n                case 229 /* EnumDeclaration */:\n                    error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location);\n                    // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks\n                    break;\n                case 150 /* Constructor */:\n                    if (isInConstructorArgumentInitializer(node, container)) {\n                        error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments);\n                    }\n                    break;\n                case 147 /* PropertyDeclaration */:\n                case 146 /* PropertySignature */:\n                    if (ts.getModifierFlags(container) & 32 /* Static */) {\n                        error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer);\n                    }\n                    break;\n                case 142 /* ComputedPropertyName */:\n                    error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);\n                    break;\n            }\n            if (needToCaptureLexicalThis) {\n                captureLexicalThis(node, container);\n            }\n            if (ts.isFunctionLike(container) &&\n                (!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) {\n                // Note: a parameter initializer should refer to class-this unless function-this is explicitly annotated.\n                // If this is a function in a JS file, it might be a class method. Check if it's the RHS\n                // of a x.prototype.y = function [name]() { .... }\n                if (container.kind === 184 /* FunctionExpression */ &&\n                    ts.isInJavaScriptFile(container.parent) &&\n                    ts.getSpecialPropertyAssignmentKind(container.parent) === 3 /* PrototypeProperty */) {\n                    // Get the 'x' of 'x.prototype.y = f' (here, 'f' is 'container')\n                    var className = container.parent // x.prototype.y = f\n                        .left // x.prototype.y\n                        .expression // x.prototype\n                        .expression; // x\n                    var classSymbol = checkExpression(className).symbol;\n                    if (classSymbol && classSymbol.members && (classSymbol.flags & 16 /* Function */)) {\n                        return getInferredClassType(classSymbol);\n                    }\n                }\n                var thisType = getThisTypeOfDeclaration(container) || getContextualThisParameterType(container);\n                if (thisType) {\n                    return thisType;\n                }\n            }\n            if (ts.isClassLike(container.parent)) {\n                var symbol = getSymbolOfNode(container.parent);\n                var type = ts.hasModifier(container, 32 /* Static */) ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType;\n                return getFlowTypeOfReference(node, type, /*assumeInitialized*/ true, /*flowContainer*/ undefined);\n            }\n            if (ts.isInJavaScriptFile(node)) {\n                var type = getTypeForThisExpressionFromJSDoc(container);\n                if (type && type !== unknownType) {\n                    return type;\n                }\n            }\n            if (compilerOptions.noImplicitThis) {\n                // With noImplicitThis, functions may not reference 'this' if it has type 'any'\n                error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation);\n            }\n            return anyType;\n        }\n        function getTypeForThisExpressionFromJSDoc(node) {\n            var jsdocType = ts.getJSDocType(node);\n            if (jsdocType && jsdocType.kind === 274 /* JSDocFunctionType */) {\n                var jsDocFunctionType = jsdocType;\n                if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277 /* JSDocThisType */) {\n                    return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);\n                }\n            }\n        }\n        function isInConstructorArgumentInitializer(node, constructorDecl) {\n            for (var n = node; n && n !== constructorDecl; n = n.parent) {\n                if (n.kind === 144 /* Parameter */) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function checkSuperExpression(node) {\n            var isCallExpression = node.parent.kind === 179 /* CallExpression */ && node.parent.expression === node;\n            var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true);\n            var needToCaptureLexicalThis = false;\n            // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting\n            if (!isCallExpression) {\n                while (container && container.kind === 185 /* ArrowFunction */) {\n                    container = ts.getSuperContainer(container, /*stopOnFunctions*/ true);\n                    needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */;\n                }\n            }\n            var canUseSuperExpression = isLegalUsageOfSuperExpression(container);\n            var nodeCheckFlag = 0;\n            if (!canUseSuperExpression) {\n                // issue more specific error if super is used in computed property name\n                // class A { foo() { return \"1\" }}\n                // class B {\n                //     [super.foo()]() {}\n                // }\n                var current = node;\n                while (current && current !== container && current.kind !== 142 /* ComputedPropertyName */) {\n                    current = current.parent;\n                }\n                if (current && current.kind === 142 /* ComputedPropertyName */) {\n                    error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);\n                }\n                else if (isCallExpression) {\n                    error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);\n                }\n                else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 176 /* ObjectLiteralExpression */)) {\n                    error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);\n                }\n                else {\n                    error(node, ts.Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class);\n                }\n                return unknownType;\n            }\n            if ((ts.getModifierFlags(container) & 32 /* Static */) || isCallExpression) {\n                nodeCheckFlag = 512 /* SuperStatic */;\n            }\n            else {\n                nodeCheckFlag = 256 /* SuperInstance */;\n            }\n            getNodeLinks(node).flags |= nodeCheckFlag;\n            // Due to how we emit async functions, we need to specialize the emit for an async method that contains a `super` reference.\n            // This is due to the fact that we emit the body of an async function inside of a generator function. As generator\n            // functions cannot reference `super`, we emit a helper inside of the method body, but outside of the generator. This helper\n            // uses an arrow function, which is permitted to reference `super`.\n            //\n            // There are two primary ways we can access `super` from within an async method. The first is getting the value of a property\n            // or indexed access on super, either as part of a right-hand-side expression or call expression. The second is when setting the value\n            // of a property or indexed access, either as part of an assignment expression or destructuring assignment.\n            //\n            // The simplest case is reading a value, in which case we will emit something like the following:\n            //\n            //  // ts\n            //  ...\n            //  async asyncMethod() {\n            //    let x = await super.asyncMethod();\n            //    return x;\n            //  }\n            //  ...\n            //\n            //  // js\n            //  ...\n            //  asyncMethod() {\n            //      const _super = name => super[name];\n            //      return __awaiter(this, arguments, Promise, function *() {\n            //          let x = yield _super(\"asyncMethod\").call(this);\n            //          return x;\n            //      });\n            //  }\n            //  ...\n            //\n            // The more complex case is when we wish to assign a value, especially as part of a destructuring assignment. As both cases\n            // are legal in ES6, but also likely less frequent, we emit the same more complex helper for both scenarios:\n            //\n            //  // ts\n            //  ...\n            //  async asyncMethod(ar: Promise<any[]>) {\n            //      [super.a, super.b] = await ar;\n            //  }\n            //  ...\n            //\n            //  // js\n            //  ...\n            //  asyncMethod(ar) {\n            //      const _super = (function (geti, seti) {\n            //          const cache = Object.create(null);\n            //          return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n            //      })(name => super[name], (name, value) => super[name] = value);\n            //      return __awaiter(this, arguments, Promise, function *() {\n            //          [_super(\"a\").value, _super(\"b\").value] = yield ar;\n            //      });\n            //  }\n            //  ...\n            //\n            // This helper creates an object with a \"value\" property that wraps the `super` property or indexed access for both get and set.\n            // This is required for destructuring assignments, as a call expression cannot be used as the target of a destructuring assignment\n            // while a property access can.\n            if (container.kind === 149 /* MethodDeclaration */ && ts.getModifierFlags(container) & 256 /* Async */) {\n                if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {\n                    getNodeLinks(container).flags |= 4096 /* AsyncMethodWithSuperBinding */;\n                }\n                else {\n                    getNodeLinks(container).flags |= 2048 /* AsyncMethodWithSuper */;\n                }\n            }\n            if (needToCaptureLexicalThis) {\n                // call expressions are allowed only in constructors so they should always capture correct 'this'\n                // super property access expressions can also appear in arrow functions -\n                // in this case they should also use correct lexical this\n                captureLexicalThis(node.parent, container);\n            }\n            if (container.parent.kind === 176 /* ObjectLiteralExpression */) {\n                if (languageVersion < 2 /* ES2015 */) {\n                    error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);\n                    return unknownType;\n                }\n                else {\n                    // for object literal assume that type of 'super' is 'any'\n                    return anyType;\n                }\n            }\n            // at this point the only legal case for parent is ClassLikeDeclaration\n            var classLikeDeclaration = container.parent;\n            var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classLikeDeclaration));\n            var baseClassType = classType && getBaseTypes(classType)[0];\n            if (!baseClassType) {\n                if (!ts.getClassExtendsHeritageClauseElement(classLikeDeclaration)) {\n                    error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class);\n                }\n                return unknownType;\n            }\n            if (container.kind === 150 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {\n                // issue custom error message for super property access in constructor arguments (to be aligned with old compiler)\n                error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments);\n                return unknownType;\n            }\n            return nodeCheckFlag === 512 /* SuperStatic */\n                ? getBaseConstructorTypeOfClass(classType)\n                : getTypeWithThisArgument(baseClassType, classType.thisType);\n            function isLegalUsageOfSuperExpression(container) {\n                if (!container) {\n                    return false;\n                }\n                if (isCallExpression) {\n                    // TS 1.0 SPEC (April 2014): 4.8.1\n                    // Super calls are only permitted in constructors of derived classes\n                    return container.kind === 150 /* Constructor */;\n                }\n                else {\n                    // TS 1.0 SPEC (April 2014)\n                    // 'super' property access is allowed\n                    // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance\n                    // - In a static member function or static member accessor\n                    // topmost container must be something that is directly nested in the class declaration\\object literal expression\n                    if (ts.isClassLike(container.parent) || container.parent.kind === 176 /* ObjectLiteralExpression */) {\n                        if (ts.getModifierFlags(container) & 32 /* Static */) {\n                            return container.kind === 149 /* MethodDeclaration */ ||\n                                container.kind === 148 /* MethodSignature */ ||\n                                container.kind === 151 /* GetAccessor */ ||\n                                container.kind === 152 /* SetAccessor */;\n                        }\n                        else {\n                            return container.kind === 149 /* MethodDeclaration */ ||\n                                container.kind === 148 /* MethodSignature */ ||\n                                container.kind === 151 /* GetAccessor */ ||\n                                container.kind === 152 /* SetAccessor */ ||\n                                container.kind === 147 /* PropertyDeclaration */ ||\n                                container.kind === 146 /* PropertySignature */ ||\n                                container.kind === 150 /* Constructor */;\n                        }\n                    }\n                }\n                return false;\n            }\n        }\n        function getContextualThisParameterType(func) {\n            if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 185 /* ArrowFunction */) {\n                var contextualSignature = getContextualSignature(func);\n                if (contextualSignature) {\n                    var thisParameter = contextualSignature.thisParameter;\n                    if (thisParameter) {\n                        return getTypeOfSymbol(thisParameter);\n                    }\n                }\n            }\n            return undefined;\n        }\n        // Return contextual type of parameter or undefined if no contextual type is available\n        function getContextuallyTypedParameterType(parameter) {\n            var func = parameter.parent;\n            if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) {\n                var iife = ts.getImmediatelyInvokedFunctionExpression(func);\n                if (iife) {\n                    var indexOfParameter = ts.indexOf(func.parameters, parameter);\n                    if (iife.arguments && indexOfParameter < iife.arguments.length) {\n                        if (parameter.dotDotDotToken) {\n                            var restTypes = [];\n                            for (var i = indexOfParameter; i < iife.arguments.length; i++) {\n                                restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i])));\n                            }\n                            return createArrayType(getUnionType(restTypes));\n                        }\n                        var links = getNodeLinks(iife);\n                        var cached = links.resolvedSignature;\n                        links.resolvedSignature = anySignature;\n                        var type = getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter]));\n                        links.resolvedSignature = cached;\n                        return type;\n                    }\n                }\n                var contextualSignature = getContextualSignature(func);\n                if (contextualSignature) {\n                    var funcHasRestParameters = ts.hasRestParameter(func);\n                    var len = func.parameters.length - (funcHasRestParameters ? 1 : 0);\n                    var indexOfParameter = ts.indexOf(func.parameters, parameter);\n                    if (indexOfParameter < len) {\n                        return getTypeAtPosition(contextualSignature, indexOfParameter);\n                    }\n                    // If last parameter is contextually rest parameter get its type\n                    if (funcHasRestParameters &&\n                        indexOfParameter === (func.parameters.length - 1) &&\n                        isRestParameterIndex(contextualSignature, func.parameters.length - 1)) {\n                        return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters));\n                    }\n                }\n            }\n            return undefined;\n        }\n        // In a variable, parameter or property declaration with a type annotation,\n        //   the contextual type of an initializer expression is the type of the variable, parameter or property.\n        // Otherwise, in a parameter declaration of a contextually typed function expression,\n        //   the contextual type of an initializer expression is the contextual type of the parameter.\n        // Otherwise, in a variable or parameter declaration with a binding pattern name,\n        //   the contextual type of an initializer expression is the type implied by the binding pattern.\n        // Otherwise, in a binding pattern inside a variable or parameter declaration,\n        //   the contextual type of an initializer expression is the type annotation of the containing declaration, if present.\n        function getContextualTypeForInitializerExpression(node) {\n            var declaration = node.parent;\n            if (node === declaration.initializer) {\n                if (declaration.type) {\n                    return getTypeFromTypeNode(declaration.type);\n                }\n                if (declaration.kind === 144 /* Parameter */) {\n                    var type = getContextuallyTypedParameterType(declaration);\n                    if (type) {\n                        return type;\n                    }\n                }\n                if (ts.isBindingPattern(declaration.name)) {\n                    return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ true, /*reportErrors*/ false);\n                }\n                if (ts.isBindingPattern(declaration.parent)) {\n                    var parentDeclaration = declaration.parent.parent;\n                    var name_19 = declaration.propertyName || declaration.name;\n                    if (ts.isVariableLike(parentDeclaration) &&\n                        parentDeclaration.type &&\n                        !ts.isBindingPattern(name_19)) {\n                        var text = ts.getTextOfPropertyName(name_19);\n                        if (text) {\n                            return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text);\n                        }\n                    }\n                }\n            }\n            return undefined;\n        }\n        function getContextualTypeForReturnExpression(node) {\n            var func = ts.getContainingFunction(node);\n            if (ts.isAsyncFunctionLike(func)) {\n                var contextualReturnType = getContextualReturnType(func);\n                if (contextualReturnType) {\n                    return getPromisedType(contextualReturnType);\n                }\n                return undefined;\n            }\n            if (func && !func.asteriskToken) {\n                return getContextualReturnType(func);\n            }\n            return undefined;\n        }\n        function getContextualTypeForYieldOperand(node) {\n            var func = ts.getContainingFunction(node);\n            if (func) {\n                var contextualReturnType = getContextualReturnType(func);\n                if (contextualReturnType) {\n                    return node.asteriskToken\n                        ? contextualReturnType\n                        : getElementTypeOfIterableIterator(contextualReturnType);\n                }\n            }\n            return undefined;\n        }\n        function isInParameterInitializerBeforeContainingFunction(node) {\n            while (node.parent && !ts.isFunctionLike(node.parent)) {\n                if (node.parent.kind === 144 /* Parameter */ && node.parent.initializer === node) {\n                    return true;\n                }\n                node = node.parent;\n            }\n            return false;\n        }\n        function getContextualReturnType(functionDecl) {\n            // If the containing function has a return type annotation, is a constructor, or is a get accessor whose\n            // corresponding set accessor has a type annotation, return statements in the function are contextually typed\n            if (functionDecl.type ||\n                functionDecl.kind === 150 /* Constructor */ ||\n                functionDecl.kind === 151 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 152 /* SetAccessor */))) {\n                return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl));\n            }\n            // Otherwise, if the containing function is contextually typed by a function type with exactly one call signature\n            // and that call signature is non-generic, return statements are contextually typed by the return type of the signature\n            var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl);\n            if (signature) {\n                return getReturnTypeOfSignature(signature);\n            }\n            return undefined;\n        }\n        // In a typed function call, an argument or substitution expression is contextually typed by the type of the corresponding parameter.\n        function getContextualTypeForArgument(callTarget, arg) {\n            var args = getEffectiveCallArguments(callTarget);\n            var argIndex = ts.indexOf(args, arg);\n            if (argIndex >= 0) {\n                var signature = getResolvedOrAnySignature(callTarget);\n                return getTypeAtPosition(signature, argIndex);\n            }\n            return undefined;\n        }\n        function getContextualTypeForSubstitutionExpression(template, substitutionExpression) {\n            if (template.parent.kind === 181 /* TaggedTemplateExpression */) {\n                return getContextualTypeForArgument(template.parent, substitutionExpression);\n            }\n            return undefined;\n        }\n        function getContextualTypeForBinaryOperand(node) {\n            var binaryExpression = node.parent;\n            var operator = binaryExpression.operatorToken.kind;\n            if (operator >= 57 /* FirstAssignment */ && operator <= 69 /* LastAssignment */) {\n                // Don't do this for special property assignments to avoid circularity\n                if (ts.getSpecialPropertyAssignmentKind(binaryExpression) !== 0 /* None */) {\n                    return undefined;\n                }\n                // In an assignment expression, the right operand is contextually typed by the type of the left operand.\n                if (node === binaryExpression.right) {\n                    return getTypeOfExpression(binaryExpression.left);\n                }\n            }\n            else if (operator === 53 /* BarBarToken */) {\n                // When an || expression has a contextual type, the operands are contextually typed by that type. When an ||\n                // expression has no contextual type, the right operand is contextually typed by the type of the left operand.\n                var type = getContextualType(binaryExpression);\n                if (!type && node === binaryExpression.right) {\n                    type = getTypeOfExpression(binaryExpression.left);\n                }\n                return type;\n            }\n            else if (operator === 52 /* AmpersandAmpersandToken */ || operator === 25 /* CommaToken */) {\n                if (node === binaryExpression.right) {\n                    return getContextualType(binaryExpression);\n                }\n            }\n            return undefined;\n        }\n        // Apply a mapping function to a contextual type and return the resulting type. If the contextual type\n        // is a union type, the mapping function is applied to each constituent type and a union of the resulting\n        // types is returned.\n        function applyToContextualType(type, mapper) {\n            if (!(type.flags & 65536 /* Union */)) {\n                return mapper(type);\n            }\n            var types = type.types;\n            var mappedType;\n            var mappedTypes;\n            for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {\n                var current = types_13[_i];\n                var t = mapper(current);\n                if (t) {\n                    if (!mappedType) {\n                        mappedType = t;\n                    }\n                    else if (!mappedTypes) {\n                        mappedTypes = [mappedType, t];\n                    }\n                    else {\n                        mappedTypes.push(t);\n                    }\n                }\n            }\n            return mappedTypes ? getUnionType(mappedTypes) : mappedType;\n        }\n        function getTypeOfPropertyOfContextualType(type, name) {\n            return applyToContextualType(type, function (t) {\n                var prop = t.flags & 229376 /* StructuredType */ ? getPropertyOfType(t, name) : undefined;\n                return prop ? getTypeOfSymbol(prop) : undefined;\n            });\n        }\n        function getIndexTypeOfContextualType(type, kind) {\n            return applyToContextualType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); });\n        }\n        // Return true if the given contextual type is a tuple-like type\n        function contextualTypeIsTupleLikeType(type) {\n            return !!(type.flags & 65536 /* Union */ ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type));\n        }\n        // In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of\n        // the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one\n        // exists. Otherwise, it is the type of the string index signature in T, if one exists.\n        function getContextualTypeForObjectLiteralMethod(node) {\n            ts.Debug.assert(ts.isObjectLiteralMethod(node));\n            if (isInsideWithStatementBody(node)) {\n                // We cannot answer semantic questions within a with block, do not proceed any further\n                return undefined;\n            }\n            return getContextualTypeForObjectLiteralElement(node);\n        }\n        function getContextualTypeForObjectLiteralElement(element) {\n            var objectLiteral = element.parent;\n            var type = getApparentTypeOfContextualType(objectLiteral);\n            if (type) {\n                if (!ts.hasDynamicName(element)) {\n                    // For a (non-symbol) computed property, there is no reason to look up the name\n                    // in the type. It will just be \"__computed\", which does not appear in any\n                    // SymbolTable.\n                    var symbolName = getSymbolOfNode(element).name;\n                    var propertyType = getTypeOfPropertyOfContextualType(type, symbolName);\n                    if (propertyType) {\n                        return propertyType;\n                    }\n                }\n                return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1 /* Number */) ||\n                    getIndexTypeOfContextualType(type, 0 /* String */);\n            }\n            return undefined;\n        }\n        // In an array literal contextually typed by a type T, the contextual type of an element expression at index N is\n        // the type of the property with the numeric name N in T, if one exists. Otherwise, if T has a numeric index signature,\n        // it is the type of the numeric index signature in T. Otherwise, in ES6 and higher, the contextual type is the iterated\n        // type of T.\n        function getContextualTypeForElementExpression(node) {\n            var arrayLiteral = node.parent;\n            var type = getApparentTypeOfContextualType(arrayLiteral);\n            if (type) {\n                var index = ts.indexOf(arrayLiteral.elements, node);\n                return getTypeOfPropertyOfContextualType(type, \"\" + index)\n                    || getIndexTypeOfContextualType(type, 1 /* Number */)\n                    || (languageVersion >= 2 /* ES2015 */ ? getElementTypeOfIterable(type, /*errorNode*/ undefined) : undefined);\n            }\n            return undefined;\n        }\n        // In a contextually typed conditional expression, the true/false expressions are contextually typed by the same type.\n        function getContextualTypeForConditionalOperand(node) {\n            var conditional = node.parent;\n            return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined;\n        }\n        function getContextualTypeForJsxAttribute(attribute) {\n            var kind = attribute.kind;\n            var jsxElement = attribute.parent;\n            var attrsType = getJsxElementAttributesType(jsxElement);\n            if (attribute.kind === 250 /* JsxAttribute */) {\n                if (!attrsType || isTypeAny(attrsType)) {\n                    return undefined;\n                }\n                return getTypeOfPropertyOfType(attrsType, attribute.name.text);\n            }\n            else if (attribute.kind === 251 /* JsxSpreadAttribute */) {\n                return attrsType;\n            }\n            ts.Debug.fail(\"Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[\" + kind + \"]\");\n        }\n        // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily\n        // be \"pushed\" onto a node using the contextualType property.\n        function getApparentTypeOfContextualType(node) {\n            var type = getContextualType(node);\n            return type && getApparentType(type);\n        }\n        /**\n         * Woah! Do you really want to use this function?\n         *\n         * Unless you're trying to get the *non-apparent* type for a\n         * value-literal type or you're authoring relevant portions of this algorithm,\n         * you probably meant to use 'getApparentTypeOfContextualType'.\n         * Otherwise this may not be very useful.\n         *\n         * In cases where you *are* working on this function, you should understand\n         * when it is appropriate to use 'getContextualType' and 'getApparentTypeOfContextualType'.\n         *\n         *   - Use 'getContextualType' when you are simply going to propagate the result to the expression.\n         *   - Use 'getApparentTypeOfContextualType' when you're going to need the members of the type.\n         *\n         * @param node the expression whose contextual type will be returned.\n         * @returns the contextual type of an expression.\n         */\n        function getContextualType(node) {\n            if (isInsideWithStatementBody(node)) {\n                // We cannot answer semantic questions within a with block, do not proceed any further\n                return undefined;\n            }\n            if (node.contextualType) {\n                return node.contextualType;\n            }\n            var parent = node.parent;\n            switch (parent.kind) {\n                case 223 /* VariableDeclaration */:\n                case 144 /* Parameter */:\n                case 147 /* PropertyDeclaration */:\n                case 146 /* PropertySignature */:\n                case 174 /* BindingElement */:\n                    return getContextualTypeForInitializerExpression(node);\n                case 185 /* ArrowFunction */:\n                case 216 /* ReturnStatement */:\n                    return getContextualTypeForReturnExpression(node);\n                case 195 /* YieldExpression */:\n                    return getContextualTypeForYieldOperand(parent);\n                case 179 /* CallExpression */:\n                case 180 /* NewExpression */:\n                    return getContextualTypeForArgument(parent, node);\n                case 182 /* TypeAssertionExpression */:\n                case 200 /* AsExpression */:\n                    return getTypeFromTypeNode(parent.type);\n                case 192 /* BinaryExpression */:\n                    return getContextualTypeForBinaryOperand(node);\n                case 257 /* PropertyAssignment */:\n                case 258 /* ShorthandPropertyAssignment */:\n                    return getContextualTypeForObjectLiteralElement(parent);\n                case 175 /* ArrayLiteralExpression */:\n                    return getContextualTypeForElementExpression(node);\n                case 193 /* ConditionalExpression */:\n                    return getContextualTypeForConditionalOperand(node);\n                case 202 /* TemplateSpan */:\n                    ts.Debug.assert(parent.parent.kind === 194 /* TemplateExpression */);\n                    return getContextualTypeForSubstitutionExpression(parent.parent, node);\n                case 183 /* ParenthesizedExpression */:\n                    return getContextualType(parent);\n                case 252 /* JsxExpression */:\n                    return getContextualType(parent);\n                case 250 /* JsxAttribute */:\n                case 251 /* JsxSpreadAttribute */:\n                    return getContextualTypeForJsxAttribute(parent);\n            }\n            return undefined;\n        }\n        // If the given type is an object or union type, if that type has a single signature, and if\n        // that signature is non-generic, return the signature. Otherwise return undefined.\n        function getNonGenericSignature(type, node) {\n            var signatures = getSignaturesOfStructuredType(type, 0 /* Call */);\n            if (signatures.length === 1) {\n                var signature = signatures[0];\n                if (!signature.typeParameters && !isAritySmaller(signature, node)) {\n                    return signature;\n                }\n            }\n        }\n        /** If the contextual signature has fewer parameters than the function expression, do not use it */\n        function isAritySmaller(signature, target) {\n            var targetParameterCount = 0;\n            for (; targetParameterCount < target.parameters.length; targetParameterCount++) {\n                var param = target.parameters[targetParameterCount];\n                if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) {\n                    break;\n                }\n            }\n            if (target.parameters.length && ts.parameterIsThisKeyword(target.parameters[0])) {\n                targetParameterCount--;\n            }\n            var sourceLength = signature.hasRestParameter ? Number.MAX_VALUE : signature.parameters.length;\n            return sourceLength < targetParameterCount;\n        }\n        function isFunctionExpressionOrArrowFunction(node) {\n            return node.kind === 184 /* FunctionExpression */ || node.kind === 185 /* ArrowFunction */;\n        }\n        function getContextualSignatureForFunctionLikeDeclaration(node) {\n            // Only function expressions, arrow functions, and object literal methods are contextually typed.\n            return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node)\n                ? getContextualSignature(node)\n                : undefined;\n        }\n        function getContextualTypeForFunctionLikeDeclaration(node) {\n            return ts.isObjectLiteralMethod(node) ?\n                getContextualTypeForObjectLiteralMethod(node) :\n                getApparentTypeOfContextualType(node);\n        }\n        // Return the contextual signature for a given expression node. A contextual type provides a\n        // contextual signature if it has a single call signature and if that call signature is non-generic.\n        // If the contextual type is a union type, get the signature from each type possible and if they are\n        // all identical ignoring their return type, the result is same signature but with return type as\n        // union type of return types from these signatures\n        function getContextualSignature(node) {\n            ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));\n            var type = getContextualTypeForFunctionLikeDeclaration(node);\n            if (!type) {\n                return undefined;\n            }\n            if (!(type.flags & 65536 /* Union */)) {\n                return getNonGenericSignature(type, node);\n            }\n            var signatureList;\n            var types = type.types;\n            for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {\n                var current = types_14[_i];\n                var signature = getNonGenericSignature(current, node);\n                if (signature) {\n                    if (!signatureList) {\n                        // This signature will contribute to contextual union signature\n                        signatureList = [signature];\n                    }\n                    else if (!compareSignaturesIdentical(signatureList[0], signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true, compareTypesIdentical)) {\n                        // Signatures aren't identical, do not use\n                        return undefined;\n                    }\n                    else {\n                        // Use this signature for contextual union signature\n                        signatureList.push(signature);\n                    }\n                }\n            }\n            // Result is union of signatures collected (return type is union of return types of this signature set)\n            var result;\n            if (signatureList) {\n                result = cloneSignature(signatureList[0]);\n                // Clear resolved return type we possibly got from cloneSignature\n                result.resolvedReturnType = undefined;\n                result.unionSignatures = signatureList;\n            }\n            return result;\n        }\n        /**\n         * Detect if the mapper implies an inference context. Specifically, there are 4 possible values\n         * for a mapper. Let's go through each one of them:\n         *\n         *    1. undefined - this means we are not doing inferential typing, but we may do contextual typing,\n         *       which could cause us to assign a parameter a type\n         *    2. identityMapper - means we want to avoid assigning a parameter a type, whether or not we are in\n         *       inferential typing (context is undefined for the identityMapper)\n         *    3. a mapper created by createInferenceMapper - we are doing inferential typing, we want to assign\n         *       types to parameters and fix type parameters (context is defined)\n         *    4. an instantiation mapper created by createTypeMapper or createTypeEraser - this should never be\n         *       passed as the contextual mapper when checking an expression (context is undefined for these)\n         *\n         * isInferentialContext is detecting if we are in case 3\n         */\n        function isInferentialContext(mapper) {\n            return mapper && mapper.context;\n        }\n        function checkSpreadExpression(node, contextualMapper) {\n            // It is usually not safe to call checkExpressionCached if we can be contextually typing.\n            // You can tell that we are contextually typing because of the contextualMapper parameter.\n            // While it is true that a spread element can have a contextual type, it does not do anything\n            // with this type. It is neither affected by it, nor does it propagate it to its operand.\n            // So the fact that contextualMapper is passed is not important, because the operand of a spread\n            // element is not contextually typed.\n            var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper);\n            return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false);\n        }\n        function hasDefaultValue(node) {\n            return (node.kind === 174 /* BindingElement */ && !!node.initializer) ||\n                (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */);\n        }\n        function checkArrayLiteral(node, contextualMapper) {\n            var elements = node.elements;\n            var hasSpreadElement = false;\n            var elementTypes = [];\n            var inDestructuringPattern = ts.isAssignmentTarget(node);\n            for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {\n                var e = elements_1[_i];\n                if (inDestructuringPattern && e.kind === 196 /* SpreadElement */) {\n                    // Given the following situation:\n                    //    var c: {};\n                    //    [...c] = [\"\", 0];\n                    //\n                    // c is represented in the tree as a spread element in an array literal.\n                    // But c really functions as a rest element, and its purpose is to provide\n                    // a contextual type for the right hand side of the assignment. Therefore,\n                    // instead of calling checkExpression on \"...c\", which will give an error\n                    // if c is not iterable/array-like, we need to act as if we are trying to\n                    // get the contextual element type from it. So we do something similar to\n                    // getContextualTypeForElementExpression, which will crucially not error\n                    // if there is no index type / iterated type.\n                    var restArrayType = checkExpression(e.expression, contextualMapper);\n                    var restElementType = getIndexTypeOfType(restArrayType, 1 /* Number */) ||\n                        (languageVersion >= 2 /* ES2015 */ ? getElementTypeOfIterable(restArrayType, /*errorNode*/ undefined) : undefined);\n                    if (restElementType) {\n                        elementTypes.push(restElementType);\n                    }\n                }\n                else {\n                    var type = checkExpressionForMutableLocation(e, contextualMapper);\n                    elementTypes.push(type);\n                }\n                hasSpreadElement = hasSpreadElement || e.kind === 196 /* SpreadElement */;\n            }\n            if (!hasSpreadElement) {\n                // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such\n                // that we get the same behavior for \"var [x, y] = []\" and \"[x, y] = []\".\n                if (inDestructuringPattern && elementTypes.length) {\n                    var type = cloneTypeReference(createTupleType(elementTypes));\n                    type.pattern = node;\n                    return type;\n                }\n                var contextualType = getApparentTypeOfContextualType(node);\n                if (contextualType && contextualTypeIsTupleLikeType(contextualType)) {\n                    var pattern = contextualType.pattern;\n                    // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting\n                    // tuple type with the corresponding binding or assignment element types to make the lengths equal.\n                    if (pattern && (pattern.kind === 173 /* ArrayBindingPattern */ || pattern.kind === 175 /* ArrayLiteralExpression */)) {\n                        var patternElements = pattern.elements;\n                        for (var i = elementTypes.length; i < patternElements.length; i++) {\n                            var patternElement = patternElements[i];\n                            if (hasDefaultValue(patternElement)) {\n                                elementTypes.push(contextualType.typeArguments[i]);\n                            }\n                            else {\n                                if (patternElement.kind !== 198 /* OmittedExpression */) {\n                                    error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);\n                                }\n                                elementTypes.push(unknownType);\n                            }\n                        }\n                    }\n                    if (elementTypes.length) {\n                        return createTupleType(elementTypes);\n                    }\n                }\n            }\n            return createArrayType(elementTypes.length ?\n                getUnionType(elementTypes, /*subtypeReduction*/ true) :\n                strictNullChecks ? neverType : undefinedWideningType);\n        }\n        function isNumericName(name) {\n            return name.kind === 142 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text);\n        }\n        function isNumericComputedName(name) {\n            // It seems odd to consider an expression of type Any to result in a numeric name,\n            // but this behavior is consistent with checkIndexedAccess\n            return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 340 /* NumberLike */);\n        }\n        function isTypeAnyOrAllConstituentTypesHaveKind(type, kind) {\n            return isTypeAny(type) || isTypeOfKind(type, kind);\n        }\n        function isInfinityOrNaNString(name) {\n            return name === \"Infinity\" || name === \"-Infinity\" || name === \"NaN\";\n        }\n        function isNumericLiteralName(name) {\n            // The intent of numeric names is that\n            //     - they are names with text in a numeric form, and that\n            //     - setting properties/indexing with them is always equivalent to doing so with the numeric literal 'numLit',\n            //         acquired by applying the abstract 'ToNumber' operation on the name's text.\n            //\n            // The subtlety is in the latter portion, as we cannot reliably say that anything that looks like a numeric literal is a numeric name.\n            // In fact, it is the case that the text of the name must be equal to 'ToString(numLit)' for this to hold.\n            //\n            // Consider the property name '\"0xF00D\"'. When one indexes with '0xF00D', they are actually indexing with the value of 'ToString(0xF00D)'\n            // according to the ECMAScript specification, so it is actually as if the user indexed with the string '\"61453\"'.\n            // Thus, the text of all numeric literals equivalent to '61543' such as '0xF00D', '0xf00D', '0170015', etc. are not valid numeric names\n            // because their 'ToString' representation is not equal to their original text.\n            // This is motivated by ECMA-262 sections 9.3.1, 9.8.1, 11.1.5, and 11.2.1.\n            //\n            // Here, we test whether 'ToString(ToNumber(name))' is exactly equal to 'name'.\n            // The '+' prefix operator is equivalent here to applying the abstract ToNumber operation.\n            // Applying the 'toString()' method on a number gives us the abstract ToString operation on a number.\n            //\n            // Note that this accepts the values 'Infinity', '-Infinity', and 'NaN', and that this is intentional.\n            // This is desired behavior, because when indexing with them as numeric entities, you are indexing\n            // with the strings '\"Infinity\"', '\"-Infinity\"', and '\"NaN\"' respectively.\n            return (+name).toString() === name;\n        }\n        function checkComputedPropertyName(node) {\n            var links = getNodeLinks(node.expression);\n            if (!links.resolvedType) {\n                links.resolvedType = checkExpression(node.expression);\n                // This will allow types number, string, symbol or any. It will also allow enums, the unknown\n                // type, and any union of these types (like string | number).\n                if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 /* NumberLike */ | 262178 /* StringLike */ | 512 /* ESSymbol */)) {\n                    error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);\n                }\n                else {\n                    checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, /*reportError*/ true);\n                }\n            }\n            return links.resolvedType;\n        }\n        function getObjectLiteralIndexInfo(propertyNodes, offset, properties, kind) {\n            var propTypes = [];\n            for (var i = 0; i < properties.length; i++) {\n                if (kind === 0 /* String */ || isNumericName(propertyNodes[i + offset].name)) {\n                    propTypes.push(getTypeOfSymbol(properties[i]));\n                }\n            }\n            var unionType = propTypes.length ? getUnionType(propTypes, /*subtypeReduction*/ true) : undefinedType;\n            return createIndexInfo(unionType, /*isReadonly*/ false);\n        }\n        function checkObjectLiteral(node, contextualMapper) {\n            var inDestructuringPattern = ts.isAssignmentTarget(node);\n            // Grammar checking\n            checkGrammarObjectLiteralExpression(node, inDestructuringPattern);\n            var propertiesTable = ts.createMap();\n            var propertiesArray = [];\n            var spread = emptyObjectType;\n            var propagatedFlags = 0;\n            var contextualType = getApparentTypeOfContextualType(node);\n            var contextualTypeHasPattern = contextualType && contextualType.pattern &&\n                (contextualType.pattern.kind === 172 /* ObjectBindingPattern */ || contextualType.pattern.kind === 176 /* ObjectLiteralExpression */);\n            var typeFlags = 0;\n            var patternWithComputedProperties = false;\n            var hasComputedStringProperty = false;\n            var hasComputedNumberProperty = false;\n            var offset = 0;\n            for (var i = 0; i < node.properties.length; i++) {\n                var memberDecl = node.properties[i];\n                var member = memberDecl.symbol;\n                if (memberDecl.kind === 257 /* PropertyAssignment */ ||\n                    memberDecl.kind === 258 /* ShorthandPropertyAssignment */ ||\n                    ts.isObjectLiteralMethod(memberDecl)) {\n                    var type = void 0;\n                    if (memberDecl.kind === 257 /* PropertyAssignment */) {\n                        type = checkPropertyAssignment(memberDecl, contextualMapper);\n                    }\n                    else if (memberDecl.kind === 149 /* MethodDeclaration */) {\n                        type = checkObjectLiteralMethod(memberDecl, contextualMapper);\n                    }\n                    else {\n                        ts.Debug.assert(memberDecl.kind === 258 /* ShorthandPropertyAssignment */);\n                        type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper);\n                    }\n                    typeFlags |= type.flags;\n                    var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | member.flags, member.name);\n                    if (inDestructuringPattern) {\n                        // If object literal is an assignment pattern and if the assignment pattern specifies a default value\n                        // for the property, make the property optional.\n                        var isOptional = (memberDecl.kind === 257 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) ||\n                            (memberDecl.kind === 258 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer);\n                        if (isOptional) {\n                            prop.flags |= 536870912 /* Optional */;\n                        }\n                        if (ts.hasDynamicName(memberDecl)) {\n                            patternWithComputedProperties = true;\n                        }\n                    }\n                    else if (contextualTypeHasPattern && !(getObjectFlags(contextualType) & 512 /* ObjectLiteralPatternWithComputedProperties */)) {\n                        // If object literal is contextually typed by the implied type of a binding pattern, and if the\n                        // binding pattern specifies a default value for the property, make the property optional.\n                        var impliedProp = getPropertyOfType(contextualType, member.name);\n                        if (impliedProp) {\n                            prop.flags |= impliedProp.flags & 536870912 /* Optional */;\n                        }\n                        else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, 0 /* String */)) {\n                            error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType));\n                        }\n                    }\n                    prop.declarations = member.declarations;\n                    prop.parent = member.parent;\n                    if (member.valueDeclaration) {\n                        prop.valueDeclaration = member.valueDeclaration;\n                    }\n                    prop.type = type;\n                    prop.target = member;\n                    member = prop;\n                }\n                else if (memberDecl.kind === 259 /* SpreadAssignment */) {\n                    if (languageVersion < 5 /* ESNext */) {\n                        checkExternalEmitHelpers(memberDecl, 2 /* Assign */);\n                    }\n                    if (propertiesArray.length > 0) {\n                        spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true);\n                        propertiesArray = [];\n                        propertiesTable = ts.createMap();\n                        hasComputedStringProperty = false;\n                        hasComputedNumberProperty = false;\n                        typeFlags = 0;\n                    }\n                    var type = checkExpression(memberDecl.expression);\n                    if (!isValidSpreadType(type)) {\n                        error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types);\n                        return unknownType;\n                    }\n                    spread = getSpreadType(spread, type, /*isFromObjectLiteral*/ false);\n                    offset = i + 1;\n                    continue;\n                }\n                else {\n                    // TypeScript 1.0 spec (April 2014)\n                    // A get accessor declaration is processed in the same manner as\n                    // an ordinary function declaration(section 6.1) with no parameters.\n                    // A set accessor declaration is processed in the same manner\n                    // as an ordinary function declaration with a single parameter and a Void return type.\n                    ts.Debug.assert(memberDecl.kind === 151 /* GetAccessor */ || memberDecl.kind === 152 /* SetAccessor */);\n                    checkAccessorDeclaration(memberDecl);\n                }\n                if (ts.hasDynamicName(memberDecl)) {\n                    if (isNumericName(memberDecl.name)) {\n                        hasComputedNumberProperty = true;\n                    }\n                    else {\n                        hasComputedStringProperty = true;\n                    }\n                }\n                else {\n                    propertiesTable[member.name] = member;\n                }\n                propertiesArray.push(member);\n            }\n            // If object literal is contextually typed by the implied type of a binding pattern, augment the result\n            // type with those properties for which the binding pattern specifies a default value.\n            if (contextualTypeHasPattern) {\n                for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) {\n                    var prop = _a[_i];\n                    if (!propertiesTable[prop.name]) {\n                        if (!(prop.flags & 536870912 /* Optional */)) {\n                            error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);\n                        }\n                        propertiesTable[prop.name] = prop;\n                        propertiesArray.push(prop);\n                    }\n                }\n            }\n            if (spread !== emptyObjectType) {\n                if (propertiesArray.length > 0) {\n                    spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true);\n                }\n                spread.flags |= propagatedFlags;\n                spread.symbol = node.symbol;\n                return spread;\n            }\n            return createObjectLiteralType();\n            function createObjectLiteralType() {\n                var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0 /* String */) : undefined;\n                var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1 /* Number */) : undefined;\n                var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);\n                var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshLiteral */;\n                result.flags |= 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */);\n                result.objectFlags |= 128 /* ObjectLiteral */;\n                if (patternWithComputedProperties) {\n                    result.objectFlags |= 512 /* ObjectLiteralPatternWithComputedProperties */;\n                }\n                if (inDestructuringPattern) {\n                    result.pattern = node;\n                }\n                if (!(result.flags & 6144 /* Nullable */)) {\n                    propagatedFlags |= (result.flags & 14680064 /* PropagatingFlags */);\n                }\n                return result;\n            }\n        }\n        function isValidSpreadType(type) {\n            return !!(type.flags & (1 /* Any */ | 4096 /* Null */ | 2048 /* Undefined */) ||\n                type.flags & 32768 /* Object */ && !isGenericMappedType(type) ||\n                type.flags & 196608 /* UnionOrIntersection */ && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); }));\n        }\n        function checkJsxSelfClosingElement(node) {\n            checkJsxOpeningLikeElement(node);\n            return jsxElementType || anyType;\n        }\n        function checkJsxElement(node) {\n            // Check attributes\n            checkJsxOpeningLikeElement(node.openingElement);\n            // Perform resolution on the closing tag so that rename/go to definition/etc work\n            if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) {\n                getIntrinsicTagSymbol(node.closingElement);\n            }\n            else {\n                checkExpression(node.closingElement.tagName);\n            }\n            // Check children\n            for (var _i = 0, _a = node.children; _i < _a.length; _i++) {\n                var child = _a[_i];\n                switch (child.kind) {\n                    case 252 /* JsxExpression */:\n                        checkJsxExpression(child);\n                        break;\n                    case 246 /* JsxElement */:\n                        checkJsxElement(child);\n                        break;\n                    case 247 /* JsxSelfClosingElement */:\n                        checkJsxSelfClosingElement(child);\n                        break;\n                }\n            }\n            return jsxElementType || anyType;\n        }\n        /**\n         * Returns true iff the JSX element name would be a valid JS identifier, ignoring restrictions about keywords not being identifiers\n         */\n        function isUnhyphenatedJsxName(name) {\n            // - is the only character supported in JSX attribute names that isn't valid in JavaScript identifiers\n            return name.indexOf(\"-\") < 0;\n        }\n        /**\n         * Returns true iff React would emit this tag name as a string rather than an identifier or qualified name\n         */\n        function isJsxIntrinsicIdentifier(tagName) {\n            // TODO (yuisu): comment\n            if (tagName.kind === 177 /* PropertyAccessExpression */ || tagName.kind === 98 /* ThisKeyword */) {\n                return false;\n            }\n            else {\n                return ts.isIntrinsicJsxName(tagName.text);\n            }\n        }\n        function checkJsxAttribute(node, elementAttributesType, nameTable) {\n            var correspondingPropType = undefined;\n            // Look up the corresponding property for this attribute\n            if (elementAttributesType === emptyObjectType && isUnhyphenatedJsxName(node.name.text)) {\n                // If there is no 'props' property, you may not have non-\"data-\" attributes\n                error(node.parent, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName());\n            }\n            else if (elementAttributesType && !isTypeAny(elementAttributesType)) {\n                var correspondingPropSymbol = getPropertyOfType(elementAttributesType, node.name.text);\n                correspondingPropType = correspondingPropSymbol && getTypeOfSymbol(correspondingPropSymbol);\n                if (isUnhyphenatedJsxName(node.name.text)) {\n                    var attributeType = getTypeOfPropertyOfType(elementAttributesType, ts.getTextOfPropertyName(node.name)) || getIndexTypeOfType(elementAttributesType, 0 /* String */);\n                    if (attributeType) {\n                        correspondingPropType = attributeType;\n                    }\n                    else {\n                        // If there's no corresponding property with this name, error\n                        if (!correspondingPropType) {\n                            error(node.name, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.name.text, typeToString(elementAttributesType));\n                            return unknownType;\n                        }\n                    }\n                }\n            }\n            var exprType;\n            if (node.initializer) {\n                exprType = checkExpression(node.initializer);\n            }\n            else {\n                // <Elem attr /> is sugar for <Elem attr={true} />\n                exprType = booleanType;\n            }\n            if (correspondingPropType) {\n                checkTypeAssignableTo(exprType, correspondingPropType, node);\n            }\n            nameTable[node.name.text] = true;\n            return exprType;\n        }\n        function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) {\n            if (compilerOptions.jsx === 2 /* React */) {\n                checkExternalEmitHelpers(node, 2 /* Assign */);\n            }\n            var type = checkExpression(node.expression);\n            var props = getPropertiesOfType(type);\n            for (var _i = 0, props_2 = props; _i < props_2.length; _i++) {\n                var prop = props_2[_i];\n                // Is there a corresponding property in the element attributes type? Skip checking of properties\n                // that have already been assigned to, as these are not actually pushed into the resulting type\n                if (!nameTable[prop.name]) {\n                    var targetPropSym = getPropertyOfType(elementAttributesType, prop.name);\n                    if (targetPropSym) {\n                        var msg = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property, prop.name);\n                        checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(targetPropSym), node, undefined, msg);\n                    }\n                    nameTable[prop.name] = true;\n                }\n            }\n            return type;\n        }\n        function getJsxType(name) {\n            if (jsxTypes[name] === undefined) {\n                return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType;\n            }\n            return jsxTypes[name];\n        }\n        /**\n          * Looks up an intrinsic tag name and returns a symbol that either points to an intrinsic\n          * property (in which case nodeLinks.jsxFlags will be IntrinsicNamedElement) or an intrinsic\n          * string index signature (in which case nodeLinks.jsxFlags will be IntrinsicIndexedElement).\n          * May also return unknownSymbol if both of these lookups fail.\n          */\n        function getIntrinsicTagSymbol(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedSymbol) {\n                var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements);\n                if (intrinsicElementsType !== unknownType) {\n                    // Property case\n                    var intrinsicProp = getPropertyOfType(intrinsicElementsType, node.tagName.text);\n                    if (intrinsicProp) {\n                        links.jsxFlags |= 1 /* IntrinsicNamedElement */;\n                        return links.resolvedSymbol = intrinsicProp;\n                    }\n                    // Intrinsic string indexer case\n                    var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, 0 /* String */);\n                    if (indexSignatureType) {\n                        links.jsxFlags |= 2 /* IntrinsicIndexedElement */;\n                        return links.resolvedSymbol = intrinsicElementsType.symbol;\n                    }\n                    // Wasn't found\n                    error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, \"JSX.\" + JsxNames.IntrinsicElements);\n                    return links.resolvedSymbol = unknownSymbol;\n                }\n                else {\n                    if (compilerOptions.noImplicitAny) {\n                        error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements);\n                    }\n                    return links.resolvedSymbol = unknownSymbol;\n                }\n            }\n            return links.resolvedSymbol;\n        }\n        /**\n         * Given a JSX element that is a class element, finds the Element Instance Type. If the\n         * element is not a class element, or the class element type cannot be determined, returns 'undefined'.\n         * For example, in the element <MyClass>, the element instance type is `MyClass` (not `typeof MyClass`).\n         */\n        function getJsxElementInstanceType(node, valueType) {\n            ts.Debug.assert(!(valueType.flags & 65536 /* Union */));\n            if (isTypeAny(valueType)) {\n                // Short-circuit if the class tag is using an element type 'any'\n                return anyType;\n            }\n            // Resolve the signatures, preferring constructor\n            var signatures = getSignaturesOfType(valueType, 1 /* Construct */);\n            if (signatures.length === 0) {\n                // No construct signatures, try call signatures\n                signatures = getSignaturesOfType(valueType, 0 /* Call */);\n                if (signatures.length === 0) {\n                    // We found no signatures at all, which is an error\n                    error(node.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(node.tagName));\n                    return unknownType;\n                }\n            }\n            return getUnionType(ts.map(signatures, getReturnTypeOfSignature), /*subtypeReduction*/ true);\n        }\n        /// e.g. \"props\" for React.d.ts,\n        /// or 'undefined' if ElementAttributesProperty doesn't exist (which means all\n        ///     non-intrinsic elements' attributes type is 'any'),\n        /// or '' if it has 0 properties (which means every\n        ///     non-intrinsic elements' attributes type is the element instance type)\n        function getJsxElementPropertiesName() {\n            // JSX\n            var jsxNamespace = getGlobalSymbol(JsxNames.JSX, 1920 /* Namespace */, /*diagnosticMessage*/ undefined);\n            // JSX.ElementAttributesProperty [symbol]\n            var attribsPropTypeSym = jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.ElementAttributesPropertyNameContainer, 793064 /* Type */);\n            // JSX.ElementAttributesProperty [type]\n            var attribPropType = attribsPropTypeSym && getDeclaredTypeOfSymbol(attribsPropTypeSym);\n            // The properties of JSX.ElementAttributesProperty\n            var attribProperties = attribPropType && getPropertiesOfType(attribPropType);\n            if (attribProperties) {\n                // Element Attributes has zero properties, so the element attributes type will be the class instance type\n                if (attribProperties.length === 0) {\n                    return \"\";\n                }\n                else if (attribProperties.length === 1) {\n                    return attribProperties[0].name;\n                }\n                else {\n                    error(attribsPropTypeSym.declarations[0], ts.Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, JsxNames.ElementAttributesPropertyNameContainer);\n                    return undefined;\n                }\n            }\n            else {\n                // No interface exists, so the element attributes type will be an implicit any\n                return undefined;\n            }\n        }\n        /**\n         * Given React element instance type and the class type, resolve the Jsx type\n         * Pass elemType to handle individual type in the union typed element type.\n         */\n        function getResolvedJsxType(node, elemType, elemClassType) {\n            if (!elemType) {\n                elemType = checkExpression(node.tagName);\n            }\n            if (elemType.flags & 65536 /* Union */) {\n                var types = elemType.types;\n                return getUnionType(ts.map(types, function (type) {\n                    return getResolvedJsxType(node, type, elemClassType);\n                }), /*subtypeReduction*/ true);\n            }\n            // If the elemType is a string type, we have to return anyType to prevent an error downstream as we will try to find construct or call signature of the type\n            if (elemType.flags & 2 /* String */) {\n                return anyType;\n            }\n            else if (elemType.flags & 32 /* StringLiteral */) {\n                // If the elemType is a stringLiteral type, we can then provide a check to make sure that the string literal type is one of the Jsx intrinsic element type\n                var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements);\n                if (intrinsicElementsType !== unknownType) {\n                    var stringLiteralTypeName = elemType.text;\n                    var intrinsicProp = getPropertyOfType(intrinsicElementsType, stringLiteralTypeName);\n                    if (intrinsicProp) {\n                        return getTypeOfSymbol(intrinsicProp);\n                    }\n                    var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, 0 /* String */);\n                    if (indexSignatureType) {\n                        return indexSignatureType;\n                    }\n                    error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, stringLiteralTypeName, \"JSX.\" + JsxNames.IntrinsicElements);\n                }\n                // If we need to report an error, we already done so here. So just return any to prevent any more error downstream\n                return anyType;\n            }\n            // Get the element instance type (the result of newing or invoking this tag)\n            var elemInstanceType = getJsxElementInstanceType(node, elemType);\n            if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) {\n                // Is this is a stateless function component? See if its single signature's return type is\n                // assignable to the JSX Element Type\n                if (jsxElementType) {\n                    var callSignatures = elemType && getSignaturesOfType(elemType, 0 /* Call */);\n                    var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0];\n                    var callReturnType = callSignature && getReturnTypeOfSignature(callSignature);\n                    var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0]));\n                    if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) {\n                        // Intersect in JSX.IntrinsicAttributes if it exists\n                        var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes);\n                        if (intrinsicAttributes !== unknownType) {\n                            paramType = intersectTypes(intrinsicAttributes, paramType);\n                        }\n                        return paramType;\n                    }\n                }\n            }\n            // Issue an error if this return type isn't assignable to JSX.ElementClass\n            if (elemClassType) {\n                checkTypeRelatedTo(elemInstanceType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements);\n            }\n            if (isTypeAny(elemInstanceType)) {\n                return elemInstanceType;\n            }\n            var propsName = getJsxElementPropertiesName();\n            if (propsName === undefined) {\n                // There is no type ElementAttributesProperty, return 'any'\n                return anyType;\n            }\n            else if (propsName === \"\") {\n                // If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead\n                return elemInstanceType;\n            }\n            else {\n                var attributesType = getTypeOfPropertyOfType(elemInstanceType, propsName);\n                if (!attributesType) {\n                    // There is no property named 'props' on this instance type\n                    return emptyObjectType;\n                }\n                else if (isTypeAny(attributesType) || (attributesType === unknownType)) {\n                    // Props is of type 'any' or unknown\n                    return attributesType;\n                }\n                else if (attributesType.flags & 65536 /* Union */) {\n                    // Props cannot be a union type\n                    error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type, typeToString(attributesType));\n                    return anyType;\n                }\n                else {\n                    // Normal case -- add in IntrinsicClassElements<T> and IntrinsicElements\n                    var apparentAttributesType = attributesType;\n                    var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes);\n                    if (intrinsicClassAttribs !== unknownType) {\n                        var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol);\n                        if (typeParams) {\n                            if (typeParams.length === 1) {\n                                apparentAttributesType = intersectTypes(createTypeReference(intrinsicClassAttribs, [elemInstanceType]), apparentAttributesType);\n                            }\n                        }\n                        else {\n                            apparentAttributesType = intersectTypes(attributesType, intrinsicClassAttribs);\n                        }\n                    }\n                    var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes);\n                    if (intrinsicAttribs !== unknownType) {\n                        apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType);\n                    }\n                    return apparentAttributesType;\n                }\n            }\n        }\n        /**\n         * Given an opening/self-closing element, get the 'element attributes type', i.e. the type that tells\n         * us which attributes are valid on a given element.\n         */\n        function getJsxElementAttributesType(node) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedJsxType) {\n                if (isJsxIntrinsicIdentifier(node.tagName)) {\n                    var symbol = getIntrinsicTagSymbol(node);\n                    if (links.jsxFlags & 1 /* IntrinsicNamedElement */) {\n                        return links.resolvedJsxType = getTypeOfSymbol(symbol);\n                    }\n                    else if (links.jsxFlags & 2 /* IntrinsicIndexedElement */) {\n                        return links.resolvedJsxType = getIndexInfoOfSymbol(symbol, 0 /* String */).type;\n                    }\n                    else {\n                        return links.resolvedJsxType = unknownType;\n                    }\n                }\n                else {\n                    var elemClassType = getJsxGlobalElementClassType();\n                    return links.resolvedJsxType = getResolvedJsxType(node, undefined, elemClassType);\n                }\n            }\n            return links.resolvedJsxType;\n        }\n        /**\n         * Given a JSX attribute, returns the symbol for the corresponds property\n         * of the element attributes type. Will return unknownSymbol for attributes\n         * that have no matching element attributes type property.\n         */\n        function getJsxAttributePropertySymbol(attrib) {\n            var attributesType = getJsxElementAttributesType(attrib.parent);\n            var prop = getPropertyOfType(attributesType, attrib.name.text);\n            return prop || unknownSymbol;\n        }\n        function getJsxGlobalElementClassType() {\n            if (!jsxElementClassType) {\n                jsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass);\n            }\n            return jsxElementClassType;\n        }\n        /// Returns all the properties of the Jsx.IntrinsicElements interface\n        function getJsxIntrinsicTagNames() {\n            var intrinsics = getJsxType(JsxNames.IntrinsicElements);\n            return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray;\n        }\n        function checkJsxPreconditions(errorNode) {\n            // Preconditions for using JSX\n            if ((compilerOptions.jsx || 0 /* None */) === 0 /* None */) {\n                error(errorNode, ts.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided);\n            }\n            if (jsxElementType === undefined) {\n                if (compilerOptions.noImplicitAny) {\n                    error(errorNode, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist);\n                }\n            }\n        }\n        function checkJsxOpeningLikeElement(node) {\n            checkGrammarJsxElement(node);\n            checkJsxPreconditions(node);\n            // The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.\n            // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.\n            var reactRefErr = compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;\n            var reactNamespace = getJsxNamespace();\n            var reactSym = resolveName(node.tagName, reactNamespace, 107455 /* Value */, reactRefErr, reactNamespace);\n            if (reactSym) {\n                // Mark local symbol as referenced here because it might not have been marked\n                // if jsx emit was not react as there wont be error being emitted\n                reactSym.isReferenced = true;\n                // If react symbol is alias, mark it as refereced\n                if (reactSym.flags & 8388608 /* Alias */ && !isConstEnumOrConstEnumOnlyModule(resolveAlias(reactSym))) {\n                    markAliasSymbolAsReferenced(reactSym);\n                }\n            }\n            var targetAttributesType = getJsxElementAttributesType(node);\n            var nameTable = ts.createMap();\n            // Process this array in right-to-left order so we know which\n            // attributes (mostly from spreads) are being overwritten and\n            // thus should have their types ignored\n            var sawSpreadedAny = false;\n            for (var i = node.attributes.length - 1; i >= 0; i--) {\n                if (node.attributes[i].kind === 250 /* JsxAttribute */) {\n                    checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable);\n                }\n                else {\n                    ts.Debug.assert(node.attributes[i].kind === 251 /* JsxSpreadAttribute */);\n                    var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable);\n                    if (isTypeAny(spreadType)) {\n                        sawSpreadedAny = true;\n                    }\n                }\n            }\n            // Check that all required properties have been provided. If an 'any'\n            // was spreaded in, though, assume that it provided all required properties\n            if (targetAttributesType && !sawSpreadedAny) {\n                var targetProperties = getPropertiesOfType(targetAttributesType);\n                for (var i = 0; i < targetProperties.length; i++) {\n                    if (!(targetProperties[i].flags & 536870912 /* Optional */) &&\n                        !nameTable[targetProperties[i].name]) {\n                        error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperties[i].name, typeToString(targetAttributesType));\n                    }\n                }\n            }\n        }\n        function checkJsxExpression(node) {\n            if (node.expression) {\n                return checkExpression(node.expression);\n            }\n            else {\n                return unknownType;\n            }\n        }\n        // If a symbol is a synthesized symbol with no value declaration, we assume it is a property. Example of this are the synthesized\n        // '.prototype' property as well as synthesized tuple index properties.\n        function getDeclarationKindFromSymbol(s) {\n            return s.valueDeclaration ? s.valueDeclaration.kind : 147 /* PropertyDeclaration */;\n        }\n        function getDeclarationModifierFlagsFromSymbol(s) {\n            return s.valueDeclaration ? ts.getCombinedModifierFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 4 /* Public */ | 32 /* Static */ : 0;\n        }\n        function getDeclarationNodeFlagsFromSymbol(s) {\n            return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : 0;\n        }\n        /**\n         * Check whether the requested property access is valid.\n         * Returns true if node is a valid property access, and false otherwise.\n         * @param node The node to be checked.\n         * @param left The left hand side of the property access (e.g.: the super in `super.foo`).\n         * @param type The type of left.\n         * @param prop The symbol for the right hand side of the property access.\n         */\n        function checkClassPropertyAccess(node, left, type, prop) {\n          return true;//AndroidUIX Modify\n        }\n        function AndroidUIXIgnore_checkClassPropertyAccess(node, left, type, prop) {\n            var flags = getDeclarationModifierFlagsFromSymbol(prop);\n            var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop));\n            var errorNode = node.kind === 177 /* PropertyAccessExpression */ || node.kind === 223 /* VariableDeclaration */ ?\n                node.name :\n                node.right;\n            if (left.kind === 96 /* SuperKeyword */) {\n                // TS 1.0 spec (April 2014): 4.8.2\n                // - In a constructor, instance member function, instance member accessor, or\n                //   instance member variable initializer where this references a derived class instance,\n                //   a super property access is permitted and must specify a public instance member function of the base class.\n                // - In a static member function or static member accessor\n                //   where this references the constructor function object of a derived class,\n                //   a super property access is permitted and must specify a public static member function of the base class.\n                if (languageVersion < 2 /* ES2015 */ && getDeclarationKindFromSymbol(prop) !== 149 /* MethodDeclaration */) {\n                    // `prop` refers to a *property* declared in the super class\n                    // rather than a *method*, so it does not satisfy the above criteria.\n                    error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword);\n                    return false;\n                }\n                if (flags & 128 /* Abstract */) {\n                    // A method cannot be accessed in a super property access if the method is abstract.\n                    // This error could mask a private property access error. But, a member\n                    // cannot simultaneously be private and abstract, so this will trigger an\n                    // additional error elsewhere.\n                    error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(declaringClass));\n                    return false;\n                }\n            }\n            // Public properties are otherwise accessible.\n            if (!(flags & 24 /* NonPublicAccessibilityModifier */)) {\n                return true;\n            }\n            // Property is known to be private or protected at this point\n            // Private property is accessible if the property is within the declaring class\n            if (flags & 8 /* Private */) {\n                var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));\n                if (!isNodeWithinClass(node, declaringClassDeclaration)) {\n                    error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass));\n                    return false;\n                }\n                return true;\n            }\n            // Property is known to be protected at this point\n            // All protected properties of a supertype are accessible in a super access\n            if (left.kind === 96 /* SuperKeyword */) {\n                return true;\n            }\n            // Get the enclosing class that has the declaring class as its base type\n            var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) {\n                var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration));\n                return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined;\n            });\n            // A protected property is accessible if the property is within the declaring class or classes derived from it\n            if (!enclosingClass) {\n                error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass));\n                return false;\n            }\n            // No further restrictions for static properties\n            if (flags & 32 /* Static */) {\n                return true;\n            }\n            // An instance property must be accessed through an instance of the enclosing class\n            if (type.flags & 16384 /* TypeParameter */ && type.isThisType) {\n                // get the original type -- represented as the type constraint of the 'this' type\n                type = getConstraintOfTypeParameter(type);\n            }\n            // TODO: why is the first part of this check here?\n            if (!(getObjectFlags(getTargetType(type)) & 3 /* ClassOrInterface */ && hasBaseType(type, enclosingClass))) {\n                error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass));\n                return false;\n            }\n            return true;\n        }\n        function checkNonNullExpression(node) {\n            var type = checkExpression(node);\n            if (strictNullChecks) {\n                var kind = getFalsyFlags(type) & 6144 /* Nullable */;\n                if (kind) {\n                    error(node, kind & 2048 /* Undefined */ ? kind & 4096 /* Null */ ?\n                        ts.Diagnostics.Object_is_possibly_null_or_undefined :\n                        ts.Diagnostics.Object_is_possibly_undefined :\n                        ts.Diagnostics.Object_is_possibly_null);\n                }\n                return getNonNullableType(type);\n            }\n            return type;\n        }\n        function checkPropertyAccessExpression(node) {\n            return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name);\n        }\n        function checkQualifiedName(node) {\n            return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right);\n        }\n        function reportNonexistentProperty(propNode, containingType) {\n            var errorInfo;\n            if (containingType.flags & 65536 /* Union */ && !(containingType.flags & 8190 /* Primitive */)) {\n                for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) {\n                    var subtype = _a[_i];\n                    if (!getPropertyOfType(subtype, propNode.text)) {\n                        errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(subtype));\n                        break;\n                    }\n                }\n            }\n            errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(containingType));\n            diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(propNode, errorInfo));\n        }\n        function markPropertyAsReferenced(prop) {\n            if (prop &&\n                noUnusedIdentifiers &&\n                (prop.flags & 106500 /* ClassMember */) &&\n                prop.valueDeclaration && (ts.getModifierFlags(prop.valueDeclaration) & 8 /* Private */)) {\n                if (prop.flags & 16777216 /* Instantiated */) {\n                    getSymbolLinks(prop).target.isReferenced = true;\n                }\n                else {\n                    prop.isReferenced = true;\n                }\n            }\n        }\n        function checkPropertyAccessExpressionOrQualifiedName(node, left, right) {\n            var type = checkNonNullExpression(left);\n            if (isTypeAny(type) || type === silentNeverType) {\n                return type;\n            }\n            var apparentType = getApparentType(getWidenedType(type));\n            if (apparentType === unknownType || (type.flags & 16384 /* TypeParameter */ && isTypeAny(apparentType))) {\n                // handle cases when type is Type parameter with invalid or any constraint\n                return apparentType;\n            }\n            var prop = getPropertyOfType(apparentType, right.text);\n            if (!prop) {\n                if (right.text && !checkAndReportErrorForExtendingInterface(node)) {\n                    reportNonexistentProperty(right, type.flags & 16384 /* TypeParameter */ && type.isThisType ? apparentType : type);\n                }\n                return unknownType;\n            }\n            markPropertyAsReferenced(prop);\n            getNodeLinks(node).resolvedSymbol = prop;\n            if (prop.parent && prop.parent.flags & 32 /* Class */) {\n                checkClassPropertyAccess(node, left, apparentType, prop);\n            }\n            var propType = getTypeOfSymbol(prop);\n            var assignmentKind = ts.getAssignmentTargetKind(node);\n            if (assignmentKind) {\n                if (isReferenceToReadonlyEntity(node, prop) || isReferenceThroughNamespaceImport(node)) {\n                    error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, right.text);\n                    return unknownType;\n                }\n            }\n            // Only compute control flow type if this is a property access expression that isn't an\n            // assignment target, and the referenced property was declared as a variable, property,\n            // accessor, or optional method.\n            if (node.kind !== 177 /* PropertyAccessExpression */ || assignmentKind === 1 /* Definite */ ||\n                !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) &&\n                    !(prop.flags & 8192 /* Method */ && propType.flags & 65536 /* Union */)) {\n                return propType;\n            }\n            var flowType = getFlowTypeOfReference(node, propType, /*assumeInitialized*/ true, /*flowContainer*/ undefined);\n            return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;\n        }\n        function isValidPropertyAccess(node, propertyName) {\n            var left = node.kind === 177 /* PropertyAccessExpression */\n                ? node.expression\n                : node.left;\n            var type = checkExpression(left);\n            if (type !== unknownType && !isTypeAny(type)) {\n                var prop = getPropertyOfType(getWidenedType(type), propertyName);\n                if (prop && prop.parent && prop.parent.flags & 32 /* Class */) {\n                    return checkClassPropertyAccess(node, left, type, prop);\n                }\n            }\n            return true;\n        }\n        /**\n         * Return the symbol of the for-in variable declared or referenced by the given for-in statement.\n         */\n        function getForInVariableSymbol(node) {\n            var initializer = node.initializer;\n            if (initializer.kind === 224 /* VariableDeclarationList */) {\n                var variable = initializer.declarations[0];\n                if (variable && !ts.isBindingPattern(variable.name)) {\n                    return getSymbolOfNode(variable);\n                }\n            }\n            else if (initializer.kind === 70 /* Identifier */) {\n                return getResolvedSymbol(initializer);\n            }\n            return undefined;\n        }\n        /**\n         * Return true if the given type is considered to have numeric property names.\n         */\n        function hasNumericPropertyNames(type) {\n            return getIndexTypeOfType(type, 1 /* Number */) && !getIndexTypeOfType(type, 0 /* String */);\n        }\n        /**\n         * Return true if given node is an expression consisting of an identifier (possibly parenthesized)\n         * that references a for-in variable for an object with numeric property names.\n         */\n        function isForInVariableForNumericPropertyNames(expr) {\n            var e = ts.skipParentheses(expr);\n            if (e.kind === 70 /* Identifier */) {\n                var symbol = getResolvedSymbol(e);\n                if (symbol.flags & 3 /* Variable */) {\n                    var child = expr;\n                    var node = expr.parent;\n                    while (node) {\n                        if (node.kind === 212 /* ForInStatement */ &&\n                            child === node.statement &&\n                            getForInVariableSymbol(node) === symbol &&\n                            hasNumericPropertyNames(getTypeOfExpression(node.expression))) {\n                            return true;\n                        }\n                        child = node;\n                        node = node.parent;\n                    }\n                }\n            }\n            return false;\n        }\n        function checkIndexedAccess(node) {\n            var objectType = checkNonNullExpression(node.expression);\n            var indexExpression = node.argumentExpression;\n            if (!indexExpression) {\n                var sourceFile = ts.getSourceFileOfNode(node);\n                if (node.parent.kind === 180 /* NewExpression */ && node.parent.expression === node) {\n                    var start = ts.skipTrivia(sourceFile.text, node.expression.end);\n                    var end = node.end;\n                    grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead);\n                }\n                else {\n                    var start = node.end - \"]\".length;\n                    var end = node.end;\n                    grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected);\n                }\n                return unknownType;\n            }\n            var indexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : checkExpression(indexExpression);\n            if (objectType === unknownType || objectType === silentNeverType) {\n                return objectType;\n            }\n            if (isConstEnumObjectType(objectType) && indexExpression.kind !== 9 /* StringLiteral */) {\n                error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);\n                return unknownType;\n            }\n            return getIndexedAccessType(objectType, indexType, node);\n        }\n        function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) {\n            if (expressionType === unknownType) {\n                // There is already an error, so no need to report one.\n                return false;\n            }\n            if (!ts.isWellKnownSymbolSyntactically(expression)) {\n                return false;\n            }\n            // Make sure the property type is the primitive symbol type\n            if ((expressionType.flags & 512 /* ESSymbol */) === 0) {\n                if (reportError) {\n                    error(expression, ts.Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, ts.getTextOfNode(expression));\n                }\n                return false;\n            }\n            // The name is Symbol.<someName>, so make sure Symbol actually resolves to the\n            // global Symbol object\n            var leftHandSide = expression.expression;\n            var leftHandSideSymbol = getResolvedSymbol(leftHandSide);\n            if (!leftHandSideSymbol) {\n                return false;\n            }\n            var globalESSymbol = getGlobalESSymbolConstructorSymbol();\n            if (!globalESSymbol) {\n                // Already errored when we tried to look up the symbol\n                return false;\n            }\n            if (leftHandSideSymbol !== globalESSymbol) {\n                if (reportError) {\n                    error(leftHandSide, ts.Diagnostics.Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object);\n                }\n                return false;\n            }\n            return true;\n        }\n        function resolveUntypedCall(node) {\n            if (node.kind === 181 /* TaggedTemplateExpression */) {\n                checkExpression(node.template);\n            }\n            else if (node.kind !== 145 /* Decorator */) {\n                ts.forEach(node.arguments, function (argument) {\n                    checkExpression(argument);\n                });\n            }\n            return anySignature;\n        }\n        function resolveErrorCall(node) {\n            resolveUntypedCall(node);\n            return unknownSignature;\n        }\n        // Re-order candidate signatures into the result array. Assumes the result array to be empty.\n        // The candidate list orders groups in reverse, but within a group signatures are kept in declaration order\n        // A nit here is that we reorder only signatures that belong to the same symbol,\n        // so order how inherited signatures are processed is still preserved.\n        // interface A { (x: string): void }\n        // interface B extends A { (x: 'foo'): string }\n        // const b: B;\n        // b('foo') // <- here overloads should be processed as [(x:'foo'): string, (x: string): void]\n        function reorderCandidates(signatures, result) {\n            var lastParent;\n            var lastSymbol;\n            var cutoffIndex = 0;\n            var index;\n            var specializedIndex = -1;\n            var spliceIndex;\n            ts.Debug.assert(!result.length);\n            for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) {\n                var signature = signatures_2[_i];\n                var symbol = signature.declaration && getSymbolOfNode(signature.declaration);\n                var parent_8 = signature.declaration && signature.declaration.parent;\n                if (!lastSymbol || symbol === lastSymbol) {\n                    if (lastParent && parent_8 === lastParent) {\n                        index++;\n                    }\n                    else {\n                        lastParent = parent_8;\n                        index = cutoffIndex;\n                    }\n                }\n                else {\n                    // current declaration belongs to a different symbol\n                    // set cutoffIndex so re-orderings in the future won't change result set from 0 to cutoffIndex\n                    index = cutoffIndex = result.length;\n                    lastParent = parent_8;\n                }\n                lastSymbol = symbol;\n                // specialized signatures always need to be placed before non-specialized signatures regardless\n                // of the cutoff position; see GH#1133\n                if (signature.hasLiteralTypes) {\n                    specializedIndex++;\n                    spliceIndex = specializedIndex;\n                    // The cutoff index always needs to be greater than or equal to the specialized signature index\n                    // in order to prevent non-specialized signatures from being added before a specialized\n                    // signature.\n                    cutoffIndex++;\n                }\n                else {\n                    spliceIndex = index;\n                }\n                result.splice(spliceIndex, 0, signature);\n            }\n        }\n        function getSpreadArgumentIndex(args) {\n            for (var i = 0; i < args.length; i++) {\n                var arg = args[i];\n                if (arg && arg.kind === 196 /* SpreadElement */) {\n                    return i;\n                }\n            }\n            return -1;\n        }\n        function hasCorrectArity(node, args, signature, signatureHelpTrailingComma) {\n            if (signatureHelpTrailingComma === void 0) { signatureHelpTrailingComma = false; }\n            var argCount; // Apparent number of arguments we will have in this call\n            var typeArguments; // Type arguments (undefined if none)\n            var callIsIncomplete; // In incomplete call we want to be lenient when we have too few arguments\n            var isDecorator;\n            var spreadArgIndex = -1;\n            if (node.kind === 181 /* TaggedTemplateExpression */) {\n                var tagExpression = node;\n                // Even if the call is incomplete, we'll have a missing expression as our last argument,\n                // so we can say the count is just the arg list length\n                argCount = args.length;\n                typeArguments = undefined;\n                if (tagExpression.template.kind === 194 /* TemplateExpression */) {\n                    // If a tagged template expression lacks a tail literal, the call is incomplete.\n                    // Specifically, a template only can end in a TemplateTail or a Missing literal.\n                    var templateExpression = tagExpression.template;\n                    var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans);\n                    ts.Debug.assert(lastSpan !== undefined); // we should always have at least one span.\n                    callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated;\n                }\n                else {\n                    // If the template didn't end in a backtick, or its beginning occurred right prior to EOF,\n                    // then this might actually turn out to be a TemplateHead in the future;\n                    // so we consider the call to be incomplete.\n                    var templateLiteral = tagExpression.template;\n                    ts.Debug.assert(templateLiteral.kind === 12 /* NoSubstitutionTemplateLiteral */);\n                    callIsIncomplete = !!templateLiteral.isUnterminated;\n                }\n            }\n            else if (node.kind === 145 /* Decorator */) {\n                isDecorator = true;\n                typeArguments = undefined;\n                argCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature);\n            }\n            else {\n                var callExpression = node;\n                if (!callExpression.arguments) {\n                    // This only happens when we have something of the form: 'new C'\n                    ts.Debug.assert(callExpression.kind === 180 /* NewExpression */);\n                    return signature.minArgumentCount === 0;\n                }\n                argCount = signatureHelpTrailingComma ? args.length + 1 : args.length;\n                // If we are missing the close paren, the call is incomplete.\n                callIsIncomplete = callExpression.arguments.end === callExpression.end;\n                typeArguments = callExpression.typeArguments;\n                spreadArgIndex = getSpreadArgumentIndex(args);\n            }\n            // If the user supplied type arguments, but the number of type arguments does not match\n            // the declared number of type parameters, the call has an incorrect arity.\n            var hasRightNumberOfTypeArgs = !typeArguments ||\n                (signature.typeParameters && typeArguments.length === signature.typeParameters.length);\n            if (!hasRightNumberOfTypeArgs) {\n                return false;\n            }\n            // If spread arguments are present, check that they correspond to a rest parameter. If so, no\n            // further checking is necessary.\n            if (spreadArgIndex >= 0) {\n                return isRestParameterIndex(signature, spreadArgIndex);\n            }\n            // Too many arguments implies incorrect arity.\n            if (!signature.hasRestParameter && argCount > signature.parameters.length) {\n                return false;\n            }\n            // If the call is incomplete, we should skip the lower bound check.\n            var hasEnoughArguments = argCount >= signature.minArgumentCount;\n            return callIsIncomplete || hasEnoughArguments;\n        }\n        // If type has a single call signature and no other members, return that signature. Otherwise, return undefined.\n        function getSingleCallSignature(type) {\n            if (type.flags & 32768 /* Object */) {\n                var resolved = resolveStructuredTypeMembers(type);\n                if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 &&\n                    resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {\n                    return resolved.callSignatures[0];\n                }\n            }\n            return undefined;\n        }\n        // Instantiate a generic signature in the context of a non-generic signature (section 3.8.5 in TypeScript spec)\n        function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) {\n            var context = createInferenceContext(signature, /*inferUnionTypes*/ true);\n            forEachMatchingParameterType(contextualSignature, signature, function (source, target) {\n                // Type parameters from outer context referenced by source type are fixed by instantiation of the source type\n                inferTypesWithContext(context, instantiateType(source, contextualMapper), target);\n            });\n            return getSignatureInstantiation(signature, getInferredTypes(context));\n        }\n        function inferTypeArguments(node, signature, args, excludeArgument, context) {\n            var typeParameters = signature.typeParameters;\n            var inferenceMapper = getInferenceMapper(context);\n            // Clear out all the inference results from the last time inferTypeArguments was called on this context\n            for (var i = 0; i < typeParameters.length; i++) {\n                // As an optimization, we don't have to clear (and later recompute) inferred types\n                // for type parameters that have already been fixed on the previous call to inferTypeArguments.\n                // It would be just as correct to reset all of them. But then we'd be repeating the same work\n                // for the type parameters that were fixed, namely the work done by getInferredType.\n                if (!context.inferences[i].isFixed) {\n                    context.inferredTypes[i] = undefined;\n                }\n            }\n            // On this call to inferTypeArguments, we may get more inferences for certain type parameters that were not\n            // fixed last time. This means that a type parameter that failed inference last time may succeed this time,\n            // or vice versa. Therefore, the failedTypeParameterIndex is useless if it points to an unfixed type parameter,\n            // because it may change. So here we reset it. However, getInferredType will not revisit any type parameters\n            // that were previously fixed. So if a fixed type parameter failed previously, it will fail again because\n            // it will contain the exact same set of inferences. So if we reset the index from a fixed type parameter,\n            // we will lose information that we won't recover this time around.\n            if (context.failedTypeParameterIndex !== undefined && !context.inferences[context.failedTypeParameterIndex].isFixed) {\n                context.failedTypeParameterIndex = undefined;\n            }\n            var thisType = getThisTypeOfSignature(signature);\n            if (thisType) {\n                var thisArgumentNode = getThisArgumentOfCall(node);\n                var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType;\n                inferTypesWithContext(context, thisArgumentType, thisType);\n            }\n            // We perform two passes over the arguments. In the first pass we infer from all arguments, but use\n            // wildcards for all context sensitive function expressions.\n            var argCount = getEffectiveArgumentCount(node, args, signature);\n            for (var i = 0; i < argCount; i++) {\n                var arg = getEffectiveArgument(node, args, i);\n                // If the effective argument is 'undefined', then it is an argument that is present but is synthetic.\n                if (arg === undefined || arg.kind !== 198 /* OmittedExpression */) {\n                    var paramType = getTypeAtPosition(signature, i);\n                    var argType = getEffectiveArgumentType(node, i);\n                    // If the effective argument type is 'undefined', there is no synthetic type\n                    // for the argument. In that case, we should check the argument.\n                    if (argType === undefined) {\n                        // For context sensitive arguments we pass the identityMapper, which is a signal to treat all\n                        // context sensitive function expressions as wildcards\n                        var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper;\n                        argType = checkExpressionWithContextualType(arg, paramType, mapper);\n                    }\n                    inferTypesWithContext(context, argType, paramType);\n                }\n            }\n            // In the second pass we visit only context sensitive arguments, and only those that aren't excluded, this\n            // time treating function expressions normally (which may cause previously inferred type arguments to be fixed\n            // as we construct types for contextually typed parameters)\n            // Decorators will not have `excludeArgument`, as their arguments cannot be contextually typed.\n            // Tagged template expressions will always have `undefined` for `excludeArgument[0]`.\n            if (excludeArgument) {\n                for (var i = 0; i < argCount; i++) {\n                    // No need to check for omitted args and template expressions, their exclusion value is always undefined\n                    if (excludeArgument[i] === false) {\n                        var arg = args[i];\n                        var paramType = getTypeAtPosition(signature, i);\n                        inferTypesWithContext(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType);\n                    }\n                }\n            }\n            getInferredTypes(context);\n        }\n        function checkTypeArguments(signature, typeArgumentNodes, typeArgumentTypes, reportErrors, headMessage) {\n            var typeParameters = signature.typeParameters;\n            var typeArgumentsAreAssignable = true;\n            var mapper;\n            for (var i = 0; i < typeParameters.length; i++) {\n                if (typeArgumentsAreAssignable /* so far */) {\n                    var constraint = getConstraintOfTypeParameter(typeParameters[i]);\n                    if (constraint) {\n                        var errorInfo = void 0;\n                        var typeArgumentHeadMessage = ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1;\n                        if (reportErrors && headMessage) {\n                            errorInfo = ts.chainDiagnosticMessages(errorInfo, typeArgumentHeadMessage);\n                            typeArgumentHeadMessage = headMessage;\n                        }\n                        if (!mapper) {\n                            mapper = createTypeMapper(typeParameters, typeArgumentTypes);\n                        }\n                        var typeArgument = typeArgumentTypes[i];\n                        typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), reportErrors ? typeArgumentNodes[i] : undefined, typeArgumentHeadMessage, errorInfo);\n                    }\n                }\n            }\n            return typeArgumentsAreAssignable;\n        }\n        function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) {\n            var thisType = getThisTypeOfSignature(signature);\n            if (thisType && thisType !== voidType && node.kind !== 180 /* NewExpression */) {\n                // If the called expression is not of the form `x.f` or `x[\"f\"]`, then sourceType = voidType\n                // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible.\n                // If the expression is a new expression, then the check is skipped.\n                var thisArgumentNode = getThisArgumentOfCall(node);\n                var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType;\n                var errorNode = reportErrors ? (thisArgumentNode || node) : undefined;\n                var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1;\n                if (!checkTypeRelatedTo(thisArgumentType, getThisTypeOfSignature(signature), relation, errorNode, headMessage_1)) {\n                    return false;\n                }\n            }\n            var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1;\n            var argCount = getEffectiveArgumentCount(node, args, signature);\n            for (var i = 0; i < argCount; i++) {\n                var arg = getEffectiveArgument(node, args, i);\n                // If the effective argument is 'undefined', then it is an argument that is present but is synthetic.\n                if (arg === undefined || arg.kind !== 198 /* OmittedExpression */) {\n                    // Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter)\n                    var paramType = getTypeAtPosition(signature, i);\n                    var argType = getEffectiveArgumentType(node, i);\n                    // If the effective argument type is 'undefined', there is no synthetic type\n                    // for the argument. In that case, we should check the argument.\n                    if (argType === undefined) {\n                        argType = checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined);\n                    }\n                    // Use argument expression as error location when reporting errors\n                    var errorNode = reportErrors ? getEffectiveArgumentErrorNode(node, i, arg) : undefined;\n                    if (!checkTypeRelatedTo(argType, paramType, relation, errorNode, headMessage)) {\n                        return false;\n                    }\n                }\n            }\n            return true;\n        }\n        /**\n         * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise.\n         */\n        function getThisArgumentOfCall(node) {\n            if (node.kind === 179 /* CallExpression */) {\n                var callee = node.expression;\n                if (callee.kind === 177 /* PropertyAccessExpression */) {\n                    return callee.expression;\n                }\n                else if (callee.kind === 178 /* ElementAccessExpression */) {\n                    return callee.expression;\n                }\n            }\n        }\n        /**\n         * Returns the effective arguments for an expression that works like a function invocation.\n         *\n         * If 'node' is a CallExpression or a NewExpression, then its argument list is returned.\n         * If 'node' is a TaggedTemplateExpression, a new argument list is constructed from the substitution\n         *    expressions, where the first element of the list is `undefined`.\n         * If 'node' is a Decorator, the argument list will be `undefined`, and its arguments and types\n         *    will be supplied from calls to `getEffectiveArgumentCount` and `getEffectiveArgumentType`.\n         */\n        function getEffectiveCallArguments(node) {\n            var args;\n            if (node.kind === 181 /* TaggedTemplateExpression */) {\n                var template = node.template;\n                args = [undefined];\n                if (template.kind === 194 /* TemplateExpression */) {\n                    ts.forEach(template.templateSpans, function (span) {\n                        args.push(span.expression);\n                    });\n                }\n            }\n            else if (node.kind === 145 /* Decorator */) {\n                // For a decorator, we return undefined as we will determine\n                // the number and types of arguments for a decorator using\n                // `getEffectiveArgumentCount` and `getEffectiveArgumentType` below.\n                return undefined;\n            }\n            else {\n                args = node.arguments || emptyArray;\n            }\n            return args;\n        }\n        /**\n          * Returns the effective argument count for a node that works like a function invocation.\n          * If 'node' is a Decorator, the number of arguments is derived from the decoration\n          *    target and the signature:\n          *    If 'node.target' is a class declaration or class expression, the effective argument\n          *       count is 1.\n          *    If 'node.target' is a parameter declaration, the effective argument count is 3.\n          *    If 'node.target' is a property declaration, the effective argument count is 2.\n          *    If 'node.target' is a method or accessor declaration, the effective argument count\n          *       is 3, although it can be 2 if the signature only accepts two arguments, allowing\n          *       us to match a property decorator.\n          * Otherwise, the argument count is the length of the 'args' array.\n          */\n        function getEffectiveArgumentCount(node, args, signature) {\n            if (node.kind === 145 /* Decorator */) {\n                switch (node.parent.kind) {\n                    case 226 /* ClassDeclaration */:\n                    case 197 /* ClassExpression */:\n                        // A class decorator will have one argument (see `ClassDecorator` in core.d.ts)\n                        return 1;\n                    case 147 /* PropertyDeclaration */:\n                        // A property declaration decorator will have two arguments (see\n                        // `PropertyDecorator` in core.d.ts)\n                        return 2;\n                    case 149 /* MethodDeclaration */:\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                        // A method or accessor declaration decorator will have two or three arguments (see\n                        // `PropertyDecorator` and `MethodDecorator` in core.d.ts)\n                        // If we are emitting decorators for ES3, we will only pass two arguments.\n                        if (languageVersion === 0 /* ES3 */) {\n                            return 2;\n                        }\n                        // If the method decorator signature only accepts a target and a key, we will only\n                        // type check those arguments.\n                        return signature.parameters.length >= 3 ? 3 : 2;\n                    case 144 /* Parameter */:\n                        // A parameter declaration decorator will have three arguments (see\n                        // `ParameterDecorator` in core.d.ts)\n                        return 3;\n                }\n            }\n            else {\n                return args.length;\n            }\n        }\n        /**\n          * Returns the effective type of the first argument to a decorator.\n          * If 'node' is a class declaration or class expression, the effective argument type\n          *    is the type of the static side of the class.\n          * If 'node' is a parameter declaration, the effective argument type is either the type\n          *    of the static or instance side of the class for the parameter's parent method,\n          *    depending on whether the method is declared static.\n          *    For a constructor, the type is always the type of the static side of the class.\n          * If 'node' is a property, method, or accessor declaration, the effective argument\n          *    type is the type of the static or instance side of the parent class for class\n          *    element, depending on whether the element is declared static.\n          */\n        function getEffectiveDecoratorFirstArgumentType(node) {\n            // The first argument to a decorator is its `target`.\n            if (node.kind === 226 /* ClassDeclaration */) {\n                // For a class decorator, the `target` is the type of the class (e.g. the\n                // \"static\" or \"constructor\" side of the class)\n                var classSymbol = getSymbolOfNode(node);\n                return getTypeOfSymbol(classSymbol);\n            }\n            if (node.kind === 144 /* Parameter */) {\n                // For a parameter decorator, the `target` is the parent type of the\n                // parameter's containing method.\n                node = node.parent;\n                if (node.kind === 150 /* Constructor */) {\n                    var classSymbol = getSymbolOfNode(node);\n                    return getTypeOfSymbol(classSymbol);\n                }\n            }\n            if (node.kind === 147 /* PropertyDeclaration */ ||\n                node.kind === 149 /* MethodDeclaration */ ||\n                node.kind === 151 /* GetAccessor */ ||\n                node.kind === 152 /* SetAccessor */) {\n                // For a property or method decorator, the `target` is the\n                // \"static\"-side type of the parent of the member if the member is\n                // declared \"static\"; otherwise, it is the \"instance\"-side type of the\n                // parent of the member.\n                return getParentTypeOfClassElement(node);\n            }\n            ts.Debug.fail(\"Unsupported decorator target.\");\n            return unknownType;\n        }\n        /**\n          * Returns the effective type for the second argument to a decorator.\n          * If 'node' is a parameter, its effective argument type is one of the following:\n          *    If 'node.parent' is a constructor, the effective argument type is 'any', as we\n          *       will emit `undefined`.\n          *    If 'node.parent' is a member with an identifier, numeric, or string literal name,\n          *       the effective argument type will be a string literal type for the member name.\n          *    If 'node.parent' is a computed property name, the effective argument type will\n          *       either be a symbol type or the string type.\n          * If 'node' is a member with an identifier, numeric, or string literal name, the\n          *    effective argument type will be a string literal type for the member name.\n          * If 'node' is a computed property name, the effective argument type will either\n          *    be a symbol type or the string type.\n          * A class decorator does not have a second argument type.\n          */\n        function getEffectiveDecoratorSecondArgumentType(node) {\n            // The second argument to a decorator is its `propertyKey`\n            if (node.kind === 226 /* ClassDeclaration */) {\n                ts.Debug.fail(\"Class decorators should not have a second synthetic argument.\");\n                return unknownType;\n            }\n            if (node.kind === 144 /* Parameter */) {\n                node = node.parent;\n                if (node.kind === 150 /* Constructor */) {\n                    // For a constructor parameter decorator, the `propertyKey` will be `undefined`.\n                    return anyType;\n                }\n            }\n            if (node.kind === 147 /* PropertyDeclaration */ ||\n                node.kind === 149 /* MethodDeclaration */ ||\n                node.kind === 151 /* GetAccessor */ ||\n                node.kind === 152 /* SetAccessor */) {\n                // The `propertyKey` for a property or method decorator will be a\n                // string literal type if the member name is an identifier, number, or string;\n                // otherwise, if the member name is a computed property name it will\n                // be either string or symbol.\n                var element = node;\n                switch (element.name.kind) {\n                    case 70 /* Identifier */:\n                    case 8 /* NumericLiteral */:\n                    case 9 /* StringLiteral */:\n                        return getLiteralTypeForText(32 /* StringLiteral */, element.name.text);\n                    case 142 /* ComputedPropertyName */:\n                        var nameType = checkComputedPropertyName(element.name);\n                        if (isTypeOfKind(nameType, 512 /* ESSymbol */)) {\n                            return nameType;\n                        }\n                        else {\n                            return stringType;\n                        }\n                    default:\n                        ts.Debug.fail(\"Unsupported property name.\");\n                        return unknownType;\n                }\n            }\n            ts.Debug.fail(\"Unsupported decorator target.\");\n            return unknownType;\n        }\n        /**\n          * Returns the effective argument type for the third argument to a decorator.\n          * If 'node' is a parameter, the effective argument type is the number type.\n          * If 'node' is a method or accessor, the effective argument type is a\n          *    `TypedPropertyDescriptor<T>` instantiated with the type of the member.\n          * Class and property decorators do not have a third effective argument.\n          */\n        function getEffectiveDecoratorThirdArgumentType(node) {\n            // The third argument to a decorator is either its `descriptor` for a method decorator\n            // or its `parameterIndex` for a parameter decorator\n            if (node.kind === 226 /* ClassDeclaration */) {\n                ts.Debug.fail(\"Class decorators should not have a third synthetic argument.\");\n                return unknownType;\n            }\n            if (node.kind === 144 /* Parameter */) {\n                // The `parameterIndex` for a parameter decorator is always a number\n                return numberType;\n            }\n            if (node.kind === 147 /* PropertyDeclaration */) {\n                ts.Debug.fail(\"Property decorators should not have a third synthetic argument.\");\n                return unknownType;\n            }\n            if (node.kind === 149 /* MethodDeclaration */ ||\n                node.kind === 151 /* GetAccessor */ ||\n                node.kind === 152 /* SetAccessor */) {\n                // The `descriptor` for a method decorator will be a `TypedPropertyDescriptor<T>`\n                // for the type of the member.\n                var propertyType = getTypeOfNode(node);\n                return createTypedPropertyDescriptorType(propertyType);\n            }\n            ts.Debug.fail(\"Unsupported decorator target.\");\n            return unknownType;\n        }\n        /**\n          * Returns the effective argument type for the provided argument to a decorator.\n          */\n        function getEffectiveDecoratorArgumentType(node, argIndex) {\n            if (argIndex === 0) {\n                return getEffectiveDecoratorFirstArgumentType(node.parent);\n            }\n            else if (argIndex === 1) {\n                return getEffectiveDecoratorSecondArgumentType(node.parent);\n            }\n            else if (argIndex === 2) {\n                return getEffectiveDecoratorThirdArgumentType(node.parent);\n            }\n            ts.Debug.fail(\"Decorators should not have a fourth synthetic argument.\");\n            return unknownType;\n        }\n        /**\n          * Gets the effective argument type for an argument in a call expression.\n          */\n        function getEffectiveArgumentType(node, argIndex) {\n            // Decorators provide special arguments, a tagged template expression provides\n            // a special first argument, and string literals get string literal types\n            // unless we're reporting errors\n            if (node.kind === 145 /* Decorator */) {\n                return getEffectiveDecoratorArgumentType(node, argIndex);\n            }\n            else if (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */) {\n                return getGlobalTemplateStringsArrayType();\n            }\n            // This is not a synthetic argument, so we return 'undefined'\n            // to signal that the caller needs to check the argument.\n            return undefined;\n        }\n        /**\n          * Gets the effective argument expression for an argument in a call expression.\n          */\n        function getEffectiveArgument(node, args, argIndex) {\n            // For a decorator or the first argument of a tagged template expression we return undefined.\n            if (node.kind === 145 /* Decorator */ ||\n                (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */)) {\n                return undefined;\n            }\n            return args[argIndex];\n        }\n        /**\n          * Gets the error node to use when reporting errors for an effective argument.\n          */\n        function getEffectiveArgumentErrorNode(node, argIndex, arg) {\n            if (node.kind === 145 /* Decorator */) {\n                // For a decorator, we use the expression of the decorator for error reporting.\n                return node.expression;\n            }\n            else if (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */) {\n                // For a the first argument of a tagged template expression, we use the template of the tag for error reporting.\n                return node.template;\n            }\n            else {\n                return arg;\n            }\n        }\n        function resolveCall(node, signatures, candidatesOutArray, headMessage) {\n            var isTaggedTemplate = node.kind === 181 /* TaggedTemplateExpression */;\n            var isDecorator = node.kind === 145 /* Decorator */;\n            var typeArguments;\n            if (!isTaggedTemplate && !isDecorator) {\n                typeArguments = node.typeArguments;\n                // We already perform checking on the type arguments on the class declaration itself.\n                if (node.expression.kind !== 96 /* SuperKeyword */) {\n                    ts.forEach(typeArguments, checkSourceElement);\n                }\n            }\n            var candidates = candidatesOutArray || [];\n            // reorderCandidates fills up the candidates array directly\n            reorderCandidates(signatures, candidates);\n            if (!candidates.length) {\n                reportError(ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target);\n                return resolveErrorCall(node);\n            }\n            var args = getEffectiveCallArguments(node);\n            // The following applies to any value of 'excludeArgument[i]':\n            //    - true:      the argument at 'i' is susceptible to a one-time permanent contextual typing.\n            //    - undefined: the argument at 'i' is *not* susceptible to permanent contextual typing.\n            //    - false:     the argument at 'i' *was* and *has been* permanently contextually typed.\n            //\n            // The idea is that we will perform type argument inference & assignability checking once\n            // without using the susceptible parameters that are functions, and once more for each of those\n            // parameters, contextually typing each as we go along.\n            //\n            // For a tagged template, then the first argument be 'undefined' if necessary\n            // because it represents a TemplateStringsArray.\n            //\n            // For a decorator, no arguments are susceptible to contextual typing due to the fact\n            // decorators are applied to a declaration by the emitter, and not to an expression.\n            var excludeArgument;\n            if (!isDecorator) {\n                // We do not need to call `getEffectiveArgumentCount` here as it only\n                // applies when calculating the number of arguments for a decorator.\n                for (var i = isTaggedTemplate ? 1 : 0; i < args.length; i++) {\n                    if (isContextSensitive(args[i])) {\n                        if (!excludeArgument) {\n                            excludeArgument = new Array(args.length);\n                        }\n                        excludeArgument[i] = true;\n                    }\n                }\n            }\n            // The following variables are captured and modified by calls to chooseOverload.\n            // If overload resolution or type argument inference fails, we want to report the\n            // best error possible. The best error is one which says that an argument was not\n            // assignable to a parameter. This implies that everything else about the overload\n            // was fine. So if there is any overload that is only incorrect because of an\n            // argument, we will report an error on that one.\n            //\n            //     function foo(s: string) {}\n            //     function foo(n: number) {} // Report argument error on this overload\n            //     function foo() {}\n            //     foo(true);\n            //\n            // If none of the overloads even made it that far, there are two possibilities.\n            // There was a problem with type arguments for some overload, in which case\n            // report an error on that. Or none of the overloads even had correct arity,\n            // in which case give an arity error.\n            //\n            //     function foo<T>(x: T, y: T) {} // Report type argument inference error\n            //     function foo() {}\n            //     foo(0, true);\n            //\n            var candidateForArgumentError;\n            var candidateForTypeArgumentError;\n            var resultOfFailedInference;\n            var result;\n            // If we are in signature help, a trailing comma indicates that we intend to provide another argument,\n            // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments.\n            var signatureHelpTrailingComma = candidatesOutArray && node.kind === 179 /* CallExpression */ && node.arguments.hasTrailingComma;\n            // Section 4.12.1:\n            // if the candidate list contains one or more signatures for which the type of each argument\n            // expression is a subtype of each corresponding parameter type, the return type of the first\n            // of those signatures becomes the return type of the function call.\n            // Otherwise, the return type of the first signature in the candidate list becomes the return\n            // type of the function call.\n            //\n            // Whether the call is an error is determined by assignability of the arguments. The subtype pass\n            // is just important for choosing the best signature. So in the case where there is only one\n            // signature, the subtype pass is useless. So skipping it is an optimization.\n            if (candidates.length > 1) {\n                result = chooseOverload(candidates, subtypeRelation, signatureHelpTrailingComma);\n            }\n            if (!result) {\n                // Reinitialize these pointers for round two\n                candidateForArgumentError = undefined;\n                candidateForTypeArgumentError = undefined;\n                resultOfFailedInference = undefined;\n                result = chooseOverload(candidates, assignableRelation, signatureHelpTrailingComma);\n            }\n            if (result) {\n                return result;\n            }\n            // No signatures were applicable. Now report errors based on the last applicable signature with\n            // no arguments excluded from assignability checks.\n            // If candidate is undefined, it means that no candidates had a suitable arity. In that case,\n            // skip the checkApplicableSignature check.\n            if (candidateForArgumentError) {\n                // excludeArgument is undefined, in this case also equivalent to [undefined, undefined, ...]\n                // The importance of excludeArgument is to prevent us from typing function expression parameters\n                // in arguments too early. If possible, we'd like to only type them once we know the correct\n                // overload. However, this matters for the case where the call is correct. When the call is\n                // an error, we don't need to exclude any arguments, although it would cause no harm to do so.\n                checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, /*excludeArgument*/ undefined, /*reportErrors*/ true);\n            }\n            else if (candidateForTypeArgumentError) {\n                if (!isTaggedTemplate && !isDecorator && typeArguments) {\n                    var typeArguments_2 = node.typeArguments;\n                    checkTypeArguments(candidateForTypeArgumentError, typeArguments_2, ts.map(typeArguments_2, getTypeFromTypeNode), /*reportErrors*/ true, headMessage);\n                }\n                else {\n                    ts.Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0);\n                    var failedTypeParameter = candidateForTypeArgumentError.typeParameters[resultOfFailedInference.failedTypeParameterIndex];\n                    var inferenceCandidates = getInferenceCandidates(resultOfFailedInference, resultOfFailedInference.failedTypeParameterIndex);\n                    var diagnosticChainHead = ts.chainDiagnosticMessages(/*details*/ undefined, // details will be provided by call to reportNoCommonSupertypeError\n                    ts.Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly, typeToString(failedTypeParameter));\n                    if (headMessage) {\n                        diagnosticChainHead = ts.chainDiagnosticMessages(diagnosticChainHead, headMessage);\n                    }\n                    reportNoCommonSupertypeError(inferenceCandidates, node.expression || node.tag, diagnosticChainHead);\n                }\n            }\n            else {\n                reportError(ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target);\n            }\n            // No signature was applicable. We have already reported the errors for the invalid signature.\n            // If this is a type resolution session, e.g. Language Service, try to get better information that anySignature.\n            // Pick the first candidate that matches the arity. This way we can get a contextual type for cases like:\n            //  declare function f(a: { xa: number; xb: number; });\n            //  f({ |\n            if (!produceDiagnostics) {\n                for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) {\n                    var candidate = candidates_1[_i];\n                    if (hasCorrectArity(node, args, candidate)) {\n                        if (candidate.typeParameters && typeArguments) {\n                            candidate = getSignatureInstantiation(candidate, ts.map(typeArguments, getTypeFromTypeNode));\n                        }\n                        return candidate;\n                    }\n                }\n            }\n            return resolveErrorCall(node);\n            function reportError(message, arg0, arg1, arg2) {\n                var errorInfo;\n                errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2);\n                if (headMessage) {\n                    errorInfo = ts.chainDiagnosticMessages(errorInfo, headMessage);\n                }\n                diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo));\n            }\n            function chooseOverload(candidates, relation, signatureHelpTrailingComma) {\n                if (signatureHelpTrailingComma === void 0) { signatureHelpTrailingComma = false; }\n                for (var _i = 0, candidates_2 = candidates; _i < candidates_2.length; _i++) {\n                    var originalCandidate = candidates_2[_i];\n                    if (!hasCorrectArity(node, args, originalCandidate, signatureHelpTrailingComma)) {\n                        continue;\n                    }\n                    var candidate = void 0;\n                    var typeArgumentsAreValid = void 0;\n                    var inferenceContext = originalCandidate.typeParameters\n                        ? createInferenceContext(originalCandidate, /*inferUnionTypes*/ false)\n                        : undefined;\n                    while (true) {\n                        candidate = originalCandidate;\n                        if (candidate.typeParameters) {\n                            var typeArgumentTypes = void 0;\n                            if (typeArguments) {\n                                typeArgumentTypes = ts.map(typeArguments, getTypeFromTypeNode);\n                                typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, /*reportErrors*/ false);\n                            }\n                            else {\n                                inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext);\n                                typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined;\n                                typeArgumentTypes = inferenceContext.inferredTypes;\n                            }\n                            if (!typeArgumentsAreValid) {\n                                break;\n                            }\n                            candidate = getSignatureInstantiation(candidate, typeArgumentTypes);\n                        }\n                        if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, /*reportErrors*/ false)) {\n                            break;\n                        }\n                        var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1;\n                        if (index < 0) {\n                            return candidate;\n                        }\n                        excludeArgument[index] = false;\n                    }\n                    // A post-mortem of this iteration of the loop. The signature was not applicable,\n                    // so we want to track it as a candidate for reporting an error. If the candidate\n                    // had no type parameters, or had no issues related to type arguments, we can\n                    // report an error based on the arguments. If there was an issue with type\n                    // arguments, then we can only report an error based on the type arguments.\n                    if (originalCandidate.typeParameters) {\n                        var instantiatedCandidate = candidate;\n                        if (typeArgumentsAreValid) {\n                            candidateForArgumentError = instantiatedCandidate;\n                        }\n                        else {\n                            candidateForTypeArgumentError = originalCandidate;\n                            if (!typeArguments) {\n                                resultOfFailedInference = inferenceContext;\n                            }\n                        }\n                    }\n                    else {\n                        ts.Debug.assert(originalCandidate === candidate);\n                        candidateForArgumentError = originalCandidate;\n                    }\n                }\n                return undefined;\n            }\n        }\n        function resolveCallExpression(node, candidatesOutArray) {\n            if (node.expression.kind === 96 /* SuperKeyword */) {\n                var superType = checkSuperExpression(node.expression);\n                if (superType !== unknownType) {\n                    // In super call, the candidate signatures are the matching arity signatures of the base constructor function instantiated\n                    // with the type arguments specified in the extends clause.\n                    var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node));\n                    if (baseTypeNode) {\n                        var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments);\n                        return resolveCall(node, baseConstructors, candidatesOutArray);\n                    }\n                }\n                return resolveUntypedCall(node);\n            }\n            var funcType = checkNonNullExpression(node.expression);\n            if (funcType === silentNeverType) {\n                return silentNeverSignature;\n            }\n            var apparentType = getApparentType(funcType);\n            if (apparentType === unknownType) {\n                // Another error has already been reported\n                return resolveErrorCall(node);\n            }\n            // Technically, this signatures list may be incomplete. We are taking the apparent type,\n            // but we are not including call signatures that may have been added to the Object or\n            // Function interface, since they have none by default. This is a bit of a leap of faith\n            // that the user will not add any.\n            var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */);\n            var constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */);\n            // TS 1.0 Spec: 4.12\n            // In an untyped function call no TypeArgs are permitted, Args can be any argument list, no contextual\n            // types are provided for the argument expressions, and the result is always of type Any.\n            if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, constructSignatures.length)) {\n                // The unknownType indicates that an error already occurred (and was reported).  No\n                // need to report another error in this case.\n                if (funcType !== unknownType && node.typeArguments) {\n                    error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);\n                }\n                return resolveUntypedCall(node);\n            }\n            // If FuncExpr's apparent type(section 3.8.1) is a function type, the call is a typed function call.\n            // TypeScript employs overload resolution in typed function calls in order to support functions\n            // with multiple call signatures.\n            if (!callSignatures.length) {\n                if (constructSignatures.length) {\n                    error(node, ts.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));\n                }\n                else {\n                    error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType));\n                }\n                return resolveErrorCall(node);\n            }\n            return resolveCall(node, callSignatures, candidatesOutArray);\n        }\n        /**\n         * TS 1.0 spec: 4.12\n         * If FuncExpr is of type Any, or of an object type that has no call or construct signatures\n         * but is a subtype of the Function interface, the call is an untyped function call.\n         */\n        function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {\n            if (isTypeAny(funcType)) {\n                return true;\n            }\n            if (isTypeAny(apparentFuncType) && funcType.flags & 16384 /* TypeParameter */) {\n                return true;\n            }\n            if (!numCallSignatures && !numConstructSignatures) {\n                // We exclude union types because we may have a union of function types that happen to have\n                // no common signatures.\n                if (funcType.flags & 65536 /* Union */) {\n                    return false;\n                }\n                return isTypeAssignableTo(funcType, globalFunctionType);\n            }\n            return false;\n        }\n        function resolveNewExpression(node, candidatesOutArray) {\n            if (node.arguments && languageVersion < 1 /* ES5 */) {\n                var spreadIndex = getSpreadArgumentIndex(node.arguments);\n                if (spreadIndex >= 0) {\n                    error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher);\n                }\n            }\n            var expressionType = checkNonNullExpression(node.expression);\n            if (expressionType === silentNeverType) {\n                return silentNeverSignature;\n            }\n            // If expressionType's apparent type(section 3.8.1) is an object type with one or\n            // more construct signatures, the expression is processed in the same manner as a\n            // function call, but using the construct signatures as the initial set of candidate\n            // signatures for overload resolution. The result type of the function call becomes\n            // the result type of the operation.\n            expressionType = getApparentType(expressionType);\n            if (expressionType === unknownType) {\n                // Another error has already been reported\n                return resolveErrorCall(node);\n            }\n            // If the expression is a class of abstract type, then it cannot be instantiated.\n            // Note, only class declarations can be declared abstract.\n            // In the case of a merged class-module or class-interface declaration,\n            // only the class declaration node will have the Abstract flag set.\n            var valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol);\n            if (valueDecl && ts.getModifierFlags(valueDecl) & 128 /* Abstract */) {\n                error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name));\n                return resolveErrorCall(node);\n            }\n            // TS 1.0 spec: 4.11\n            // If expressionType is of type Any, Args can be any argument\n            // list and the result of the operation is of type Any.\n            if (isTypeAny(expressionType)) {\n                if (node.typeArguments) {\n                    error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);\n                }\n                return resolveUntypedCall(node);\n            }\n            // Technically, this signatures list may be incomplete. We are taking the apparent type,\n            // but we are not including construct signatures that may have been added to the Object or\n            // Function interface, since they have none by default. This is a bit of a leap of faith\n            // that the user will not add any.\n            var constructSignatures = getSignaturesOfType(expressionType, 1 /* Construct */);\n            if (constructSignatures.length) {\n                if (!isConstructorAccessible(node, constructSignatures[0])) {\n                    return resolveErrorCall(node);\n                }\n                return resolveCall(node, constructSignatures, candidatesOutArray);\n            }\n            // If expressionType's apparent type is an object type with no construct signatures but\n            // one or more call signatures, the expression is processed as a function call. A compile-time\n            // error occurs if the result of the function call is not Void. The type of the result of the\n            // operation is Any. It is an error to have a Void this type.\n            var callSignatures = getSignaturesOfType(expressionType, 0 /* Call */);\n            if (callSignatures.length) {\n                var signature = resolveCall(node, callSignatures, candidatesOutArray);\n                if (getReturnTypeOfSignature(signature) !== voidType) {\n                    error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword);\n                }\n                if (getThisTypeOfSignature(signature) === voidType) {\n                    error(node, ts.Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void);\n                }\n                return signature;\n            }\n            error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature);\n            return resolveErrorCall(node);\n        }\n        function isConstructorAccessible(node, signature) {\n            if (!signature || !signature.declaration) {\n                return true;\n            }\n            var declaration = signature.declaration;\n            var modifiers = ts.getModifierFlags(declaration);\n            // Public constructor is accessible.\n            if (!(modifiers & 24 /* NonPublicAccessibilityModifier */)) {\n                return true;\n            }\n            var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(declaration.parent.symbol);\n            var declaringClass = getDeclaredTypeOfSymbol(declaration.parent.symbol);\n            // A private or protected constructor can only be instantiated within its own class (or a subclass, for protected)\n            if (!isNodeWithinClass(node, declaringClassDeclaration)) {\n                var containingClass = ts.getContainingClass(node);\n                if (containingClass) {\n                    var containingType = getTypeOfNode(containingClass);\n                    var baseTypes = getBaseTypes(containingType);\n                    if (baseTypes.length) {\n                        var baseType = baseTypes[0];\n                        if (modifiers & 16 /* Protected */ &&\n                            baseType.symbol === declaration.parent.symbol) {\n                            return true;\n                        }\n                    }\n                }\n                if (modifiers & 8 /* Private */) {\n                    error(node, ts.Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));\n                }\n                if (modifiers & 16 /* Protected */) {\n                    error(node, ts.Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));\n                }\n                return false;\n            }\n            return true;\n        }\n        function resolveTaggedTemplateExpression(node, candidatesOutArray) {\n            var tagType = checkExpression(node.tag);\n            var apparentType = getApparentType(tagType);\n            if (apparentType === unknownType) {\n                // Another error has already been reported\n                return resolveErrorCall(node);\n            }\n            var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */);\n            var constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */);\n            if (isUntypedFunctionCall(tagType, apparentType, callSignatures.length, constructSignatures.length)) {\n                return resolveUntypedCall(node);\n            }\n            if (!callSignatures.length) {\n                error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType));\n                return resolveErrorCall(node);\n            }\n            return resolveCall(node, callSignatures, candidatesOutArray);\n        }\n        /**\n          * Gets the localized diagnostic head message to use for errors when resolving a decorator as a call expression.\n          */\n        function getDiagnosticHeadMessageForDecoratorResolution(node) {\n            switch (node.parent.kind) {\n                case 226 /* ClassDeclaration */:\n                case 197 /* ClassExpression */:\n                    return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression;\n                case 144 /* Parameter */:\n                    return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression;\n                case 147 /* PropertyDeclaration */:\n                    return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression;\n                case 149 /* MethodDeclaration */:\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                    return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression;\n            }\n        }\n        /**\n          * Resolves a decorator as if it were a call expression.\n          */\n        function resolveDecorator(node, candidatesOutArray) {\n            var funcType = checkExpression(node.expression);\n            var apparentType = getApparentType(funcType);\n            if (apparentType === unknownType) {\n                return resolveErrorCall(node);\n            }\n            var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */);\n            var constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */);\n            if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, constructSignatures.length)) {\n                return resolveUntypedCall(node);\n            }\n            var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);\n            if (!callSignatures.length) {\n                var errorInfo = void 0;\n                errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType));\n                errorInfo = ts.chainDiagnosticMessages(errorInfo, headMessage);\n                diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo));\n                return resolveErrorCall(node);\n            }\n            return resolveCall(node, callSignatures, candidatesOutArray, headMessage);\n        }\n        function resolveSignature(node, candidatesOutArray) {\n            switch (node.kind) {\n                case 179 /* CallExpression */:\n                    return resolveCallExpression(node, candidatesOutArray);\n                case 180 /* NewExpression */:\n                    return resolveNewExpression(node, candidatesOutArray);\n                case 181 /* TaggedTemplateExpression */:\n                    return resolveTaggedTemplateExpression(node, candidatesOutArray);\n                case 145 /* Decorator */:\n                    return resolveDecorator(node, candidatesOutArray);\n            }\n            ts.Debug.fail(\"Branch in 'resolveSignature' should be unreachable.\");\n        }\n        // candidatesOutArray is passed by signature help in the language service, and collectCandidates\n        // must fill it up with the appropriate candidate signatures\n        function getResolvedSignature(node, candidatesOutArray) {\n            var links = getNodeLinks(node);\n            // If getResolvedSignature has already been called, we will have cached the resolvedSignature.\n            // However, it is possible that either candidatesOutArray was not passed in the first time,\n            // or that a different candidatesOutArray was passed in. Therefore, we need to redo the work\n            // to correctly fill the candidatesOutArray.\n            var cached = links.resolvedSignature;\n            if (cached && cached !== resolvingSignature && !candidatesOutArray) {\n                return cached;\n            }\n            links.resolvedSignature = resolvingSignature;\n            var result = resolveSignature(node, candidatesOutArray);\n            // If signature resolution originated in control flow type analysis (for example to compute the\n            // assigned type in a flow assignment) we don't cache the result as it may be based on temporary\n            // types from the control flow analysis.\n            links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached;\n            return result;\n        }\n        function getResolvedOrAnySignature(node) {\n            // If we're already in the process of resolving the given signature, don't resolve again as\n            // that could cause infinite recursion. Instead, return anySignature.\n            return getNodeLinks(node).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(node);\n        }\n        function getInferredClassType(symbol) {\n            var links = getSymbolLinks(symbol);\n            if (!links.inferredClassType) {\n                links.inferredClassType = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined);\n            }\n            return links.inferredClassType;\n        }\n        /**\n         * Syntactically and semantically checks a call or new expression.\n         * @param node The call/new expression to be checked.\n         * @returns On success, the expression's signature's return type. On failure, anyType.\n         */\n        function checkCallExpression(node) {\n            // Grammar checking; stop grammar-checking if checkGrammarTypeArguments return true\n            checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments);\n            var signature = getResolvedSignature(node);\n            if (node.expression.kind === 96 /* SuperKeyword */) {\n                return voidType;\n            }\n            if (node.kind === 180 /* NewExpression */) {\n                var declaration = signature.declaration;\n                if (declaration &&\n                    declaration.kind !== 150 /* Constructor */ &&\n                    declaration.kind !== 154 /* ConstructSignature */ &&\n                    declaration.kind !== 159 /* ConstructorType */ &&\n                    !ts.isJSDocConstructSignature(declaration)) {\n                    // When resolved signature is a call signature (and not a construct signature) the result type is any, unless\n                    // the declaring function had members created through 'x.prototype.y = expr' or 'this.y = expr' psuedodeclarations\n                    // in a JS file\n                    // Note:JS inferred classes might come from a variable declaration instead of a function declaration.\n                    // In this case, using getResolvedSymbol directly is required to avoid losing the members from the declaration.\n                    var funcSymbol = node.expression.kind === 70 /* Identifier */ ?\n                        getResolvedSymbol(node.expression) :\n                        checkExpression(node.expression).symbol;\n                    if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16 /* Function */ || ts.isDeclarationOfFunctionExpression(funcSymbol))) {\n                        return getInferredClassType(funcSymbol);\n                    }\n                    else if (compilerOptions.noImplicitAny) {\n                        error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);\n                    }\n                    return anyType;\n                }\n            }\n            // In JavaScript files, calls to any identifier 'require' are treated as external module imports\n            if (ts.isInJavaScriptFile(node) && isCommonJsRequire(node)) {\n                return resolveExternalModuleTypeByLiteral(node.arguments[0]);\n            }\n            return getReturnTypeOfSignature(signature);\n        }\n        function isCommonJsRequire(node) {\n            if (!ts.isRequireCall(node, /*checkArgumentIsStringLiteral*/ true)) {\n                return false;\n            }\n            // Make sure require is not a local function\n            var resolvedRequire = resolveName(node.expression, node.expression.text, 107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);\n            if (!resolvedRequire) {\n                // project does not contain symbol named 'require' - assume commonjs require\n                return true;\n            }\n            // project includes symbol named 'require' - make sure that it it ambient and local non-alias\n            if (resolvedRequire.flags & 8388608 /* Alias */) {\n                return false;\n            }\n            var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */\n                ? 225 /* FunctionDeclaration */\n                : resolvedRequire.flags & 3 /* Variable */\n                    ? 223 /* VariableDeclaration */\n                    : 0 /* Unknown */;\n            if (targetDeclarationKind !== 0 /* Unknown */) {\n                var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind);\n                // function/variable declaration should be ambient\n                return ts.isInAmbientContext(decl);\n            }\n            return false;\n        }\n        function checkTaggedTemplateExpression(node) {\n            return getReturnTypeOfSignature(getResolvedSignature(node));\n        }\n        function checkAssertion(node) {\n            var exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(checkExpression(node.expression)));\n            checkSourceElement(node.type);\n            var targetType = getTypeFromTypeNode(node.type);\n            if (produceDiagnostics && targetType !== unknownType) {\n                var widenedType = getWidenedType(exprType);\n                if (!isTypeComparableTo(targetType, widenedType)) {\n                    checkTypeComparableTo(exprType, targetType, node, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1);\n                }\n            }\n            return targetType;\n        }\n        function checkNonNullAssertion(node) {\n            return getNonNullableType(checkExpression(node.expression));\n        }\n        function getTypeOfParameter(symbol) {\n            var type = getTypeOfSymbol(symbol);\n            if (strictNullChecks) {\n                var declaration = symbol.valueDeclaration;\n                if (declaration && declaration.initializer) {\n                    return includeFalsyTypes(type, 2048 /* Undefined */);\n                }\n            }\n            return type;\n        }\n        function getTypeAtPosition(signature, pos) {\n            return signature.hasRestParameter ?\n                pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) :\n                pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType;\n        }\n        function assignContextualParameterTypes(signature, context, mapper) {\n            var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0);\n            if (isInferentialContext(mapper)) {\n                for (var i = 0; i < len; i++) {\n                    var declaration = signature.parameters[i].valueDeclaration;\n                    if (declaration.type) {\n                        inferTypesWithContext(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i));\n                    }\n                }\n            }\n            if (context.thisParameter) {\n                var parameter = signature.thisParameter;\n                if (!parameter || parameter.valueDeclaration && !parameter.valueDeclaration.type) {\n                    if (!parameter) {\n                        signature.thisParameter = createTransientSymbol(context.thisParameter, undefined);\n                    }\n                    assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper);\n                }\n            }\n            for (var i = 0; i < len; i++) {\n                var parameter = signature.parameters[i];\n                if (!parameter.valueDeclaration.type) {\n                    var contextualParameterType = getTypeAtPosition(context, i);\n                    assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);\n                }\n            }\n            if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) {\n                var parameter = ts.lastOrUndefined(signature.parameters);\n                if (!parameter.valueDeclaration.type) {\n                    var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters));\n                    assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);\n                }\n            }\n        }\n        // When contextual typing assigns a type to a parameter that contains a binding pattern, we also need to push\n        // the destructured type into the contained binding elements.\n        function assignBindingElementTypes(node) {\n            if (ts.isBindingPattern(node.name)) {\n                for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        if (element.name.kind === 70 /* Identifier */) {\n                            getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element);\n                        }\n                        assignBindingElementTypes(element);\n                    }\n                }\n            }\n        }\n        function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) {\n            var links = getSymbolLinks(parameter);\n            if (!links.type) {\n                links.type = instantiateType(contextualType, mapper);\n                // if inference didn't come up with anything but {}, fall back to the binding pattern if present.\n                if (links.type === emptyObjectType &&\n                    (parameter.valueDeclaration.name.kind === 172 /* ObjectBindingPattern */ ||\n                        parameter.valueDeclaration.name.kind === 173 /* ArrayBindingPattern */)) {\n                    links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name);\n                }\n                assignBindingElementTypes(parameter.valueDeclaration);\n            }\n            else if (isInferentialContext(mapper)) {\n                // Even if the parameter already has a type, it might be because it was given a type while\n                // processing the function as an argument to a prior signature during overload resolution.\n                // If this was the case, it may have caused some type parameters to be fixed. So here,\n                // we need to ensure that type parameters at the same positions get fixed again. This is\n                // done by calling instantiateType to attach the mapper to the contextualType, and then\n                // calling inferTypes to force a walk of contextualType so that all the correct fixing\n                // happens. The choice to pass in links.type may seem kind of arbitrary, but it serves\n                // to make sure that all the correct positions in contextualType are reached by the walk.\n                // Here is an example:\n                //\n                //      interface Base {\n                //          baseProp;\n                //      }\n                //      interface Derived extends Base {\n                //          toBase(): Base;\n                //      }\n                //\n                //      var derived: Derived;\n                //\n                //      declare function foo<T>(x: T, func: (p: T) => T): T;\n                //      declare function foo<T>(x: T, func: (p: T) => T): T;\n                //\n                //      var result = foo(derived, d => d.toBase());\n                //\n                // We are typing d while checking the second overload. But we've already given d\n                // a type (Derived) from the first overload. However, we still want to fix the\n                // T in the second overload so that we do not infer Base as a candidate for T\n                // (inferring Base would make type argument inference inconsistent between the two\n                // overloads).\n                inferTypesWithContext(mapper.context, links.type, instantiateType(contextualType, mapper));\n            }\n        }\n        function getReturnTypeFromJSDocComment(func) {\n            var returnTag = ts.getJSDocReturnTag(func);\n            if (returnTag && returnTag.typeExpression) {\n                return getTypeFromTypeNode(returnTag.typeExpression.type);\n            }\n            return undefined;\n        }\n        function createPromiseType(promisedType) {\n            // creates a `Promise<T>` type where `T` is the promisedType argument\n            var globalPromiseType = getGlobalPromiseType();\n            if (globalPromiseType !== emptyGenericType) {\n                // if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type\n                promisedType = getAwaitedType(promisedType);\n                return createTypeReference(globalPromiseType, [promisedType]);\n            }\n            return emptyObjectType;\n        }\n        function createPromiseReturnType(func, promisedType) {\n            var promiseType = createPromiseType(promisedType);\n            if (promiseType === emptyObjectType) {\n                error(func, ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option);\n                return unknownType;\n            }\n            return promiseType;\n        }\n        function getReturnTypeFromBody(func, contextualMapper) {\n            var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);\n            if (!func.body) {\n                return unknownType;\n            }\n            var isAsync = ts.isAsyncFunctionLike(func);\n            var type;\n            if (func.body.kind !== 204 /* Block */) {\n                type = checkExpressionCached(func.body, contextualMapper);\n                if (isAsync) {\n                    // From within an async function you can return either a non-promise value or a promise. Any\n                    // Promise/A+ compatible implementation will always assimilate any foreign promise, so the\n                    // return type of the body should be unwrapped to its awaited type, which we will wrap in\n                    // the native Promise<T> type later in this function.\n                    type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member);\n                }\n            }\n            else {\n                var types = void 0;\n                var funcIsGenerator = !!func.asteriskToken;\n                if (funcIsGenerator) {\n                    types = checkAndAggregateYieldOperandTypes(func, contextualMapper);\n                    if (types.length === 0) {\n                        var iterableIteratorAny = createIterableIteratorType(anyType);\n                        if (compilerOptions.noImplicitAny) {\n                            error(func.asteriskToken, ts.Diagnostics.Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type, typeToString(iterableIteratorAny));\n                        }\n                        return iterableIteratorAny;\n                    }\n                }\n                else {\n                    types = checkAndAggregateReturnExpressionTypes(func, contextualMapper);\n                    if (!types) {\n                        // For an async function, the return type will not be never, but rather a Promise for never.\n                        return isAsync ? createPromiseReturnType(func, neverType) : neverType;\n                    }\n                    if (types.length === 0) {\n                        // For an async function, the return type will not be void, but rather a Promise for void.\n                        return isAsync ? createPromiseReturnType(func, voidType) : voidType;\n                    }\n                }\n                // Return a union of the return expression types.\n                type = getUnionType(types, /*subtypeReduction*/ true);\n                if (funcIsGenerator) {\n                    type = createIterableIteratorType(type);\n                }\n            }\n            if (!contextualSignature) {\n                reportErrorsFromWidening(func, type);\n            }\n            if (isUnitType(type) &&\n                !(contextualSignature &&\n                    isLiteralContextualType(contextualSignature === getSignatureFromDeclaration(func) ? type : getReturnTypeOfSignature(contextualSignature)))) {\n                type = getWidenedLiteralType(type);\n            }\n            var widenedType = getWidenedType(type);\n            // From within an async function you can return either a non-promise value or a promise. Any\n            // Promise/A+ compatible implementation will always assimilate any foreign promise, so the\n            // return type of the body is awaited type of the body, wrapped in a native Promise<T> type.\n            return isAsync ? createPromiseReturnType(func, widenedType) : widenedType;\n        }\n        function checkAndAggregateYieldOperandTypes(func, contextualMapper) {\n            var aggregatedTypes = [];\n            ts.forEachYieldExpression(func.body, function (yieldExpression) {\n                var expr = yieldExpression.expression;\n                if (expr) {\n                    var type = checkExpressionCached(expr, contextualMapper);\n                    if (yieldExpression.asteriskToken) {\n                        // A yield* expression effectively yields everything that its operand yields\n                        type = checkElementTypeOfIterable(type, yieldExpression.expression);\n                    }\n                    if (!ts.contains(aggregatedTypes, type)) {\n                        aggregatedTypes.push(type);\n                    }\n                }\n            });\n            return aggregatedTypes;\n        }\n        function isExhaustiveSwitchStatement(node) {\n            if (!node.possiblyExhaustive) {\n                return false;\n            }\n            var type = getTypeOfExpression(node.expression);\n            if (!isLiteralType(type)) {\n                return false;\n            }\n            var switchTypes = getSwitchClauseTypes(node);\n            if (!switchTypes.length) {\n                return false;\n            }\n            return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes);\n        }\n        function functionHasImplicitReturn(func) {\n            if (!(func.flags & 128 /* HasImplicitReturn */)) {\n                return false;\n            }\n            var lastStatement = ts.lastOrUndefined(func.body.statements);\n            if (lastStatement && lastStatement.kind === 218 /* SwitchStatement */ && isExhaustiveSwitchStatement(lastStatement)) {\n                return false;\n            }\n            return true;\n        }\n        function checkAndAggregateReturnExpressionTypes(func, contextualMapper) {\n            var isAsync = ts.isAsyncFunctionLike(func);\n            var aggregatedTypes = [];\n            var hasReturnWithNoExpression = functionHasImplicitReturn(func);\n            var hasReturnOfTypeNever = false;\n            ts.forEachReturnStatement(func.body, function (returnStatement) {\n                var expr = returnStatement.expression;\n                if (expr) {\n                    var type = checkExpressionCached(expr, contextualMapper);\n                    if (isAsync) {\n                        // From within an async function you can return either a non-promise value or a promise. Any\n                        // Promise/A+ compatible implementation will always assimilate any foreign promise, so the\n                        // return type of the body should be unwrapped to its awaited type, which should be wrapped in\n                        // the native Promise<T> type by the caller.\n                        type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member);\n                    }\n                    if (type.flags & 8192 /* Never */) {\n                        hasReturnOfTypeNever = true;\n                    }\n                    else if (!ts.contains(aggregatedTypes, type)) {\n                        aggregatedTypes.push(type);\n                    }\n                }\n                else {\n                    hasReturnWithNoExpression = true;\n                }\n            });\n            if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever ||\n                func.kind === 184 /* FunctionExpression */ || func.kind === 185 /* ArrowFunction */)) {\n                return undefined;\n            }\n            if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) {\n                if (!ts.contains(aggregatedTypes, undefinedType)) {\n                    aggregatedTypes.push(undefinedType);\n                }\n            }\n            return aggregatedTypes;\n        }\n        /**\n         * TypeScript Specification 1.0 (6.3) - July 2014\n         *   An explicitly typed function whose return type isn't the Void type,\n         *   the Any type, or a union type containing the Void or Any type as a constituent\n         *   must have at least one return statement somewhere in its body.\n         *   An exception to this rule is if the function implementation consists of a single 'throw' statement.\n         *\n         * @param returnType - return type of the function, can be undefined if return type is not explicitly specified\n         */\n        function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {\n            if (!produceDiagnostics) {\n                return;\n            }\n            // Functions with with an explicitly specified 'void' or 'any' return type don't need any return expressions.\n            if (returnType && maybeTypeOfKind(returnType, 1 /* Any */ | 1024 /* Void */)) {\n                return;\n            }\n            // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check.\n            // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw\n            if (ts.nodeIsMissing(func.body) || func.body.kind !== 204 /* Block */ || !functionHasImplicitReturn(func)) {\n                return;\n            }\n            var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */;\n            if (returnType && returnType.flags & 8192 /* Never */) {\n                error(func.type, ts.Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);\n            }\n            else if (returnType && !hasExplicitReturn) {\n                // minimal check: function has syntactic return type annotation and no explicit return statements in the body\n                // this function does not conform to the specification.\n                // NOTE: having returnType !== undefined is a precondition for entering this branch so func.type will always be present\n                error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);\n            }\n            else if (returnType && strictNullChecks && !isTypeAssignableTo(undefinedType, returnType)) {\n                error(func.type, ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);\n            }\n            else if (compilerOptions.noImplicitReturns) {\n                if (!returnType) {\n                    // If return type annotation is omitted check if function has any explicit return statements.\n                    // If it does not have any - its inferred return type is void - don't do any checks.\n                    // Otherwise get inferred return type from function body and report error only if it is not void / anytype\n                    if (!hasExplicitReturn) {\n                        return;\n                    }\n                    var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func));\n                    if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) {\n                        return;\n                    }\n                }\n                error(func.type || func, ts.Diagnostics.Not_all_code_paths_return_a_value);\n            }\n        }\n        function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) {\n            ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));\n            // Grammar checking\n            var hasGrammarError = checkGrammarFunctionLikeDeclaration(node);\n            if (!hasGrammarError && node.kind === 184 /* FunctionExpression */) {\n                checkGrammarForGenerator(node);\n            }\n            // The identityMapper object is used to indicate that function expressions are wildcards\n            if (contextualMapper === identityMapper && isContextSensitive(node)) {\n                checkNodeDeferred(node);\n                return anyFunctionType;\n            }\n            var links = getNodeLinks(node);\n            var type = getTypeOfSymbol(node.symbol);\n            var contextSensitive = isContextSensitive(node);\n            var mightFixTypeParameters = contextSensitive && isInferentialContext(contextualMapper);\n            // Check if function expression is contextually typed and assign parameter types if so.\n            // See the comment in assignTypeToParameterAndFixTypeParameters to understand why we need to\n            // check mightFixTypeParameters.\n            if (mightFixTypeParameters || !(links.flags & 1024 /* ContextChecked */)) {\n                var contextualSignature = getContextualSignature(node);\n                // If a type check is started at a function expression that is an argument of a function call, obtaining the\n                // contextual type may recursively get back to here during overload resolution of the call. If so, we will have\n                // already assigned contextual types.\n                var contextChecked = !!(links.flags & 1024 /* ContextChecked */);\n                if (mightFixTypeParameters || !contextChecked) {\n                    links.flags |= 1024 /* ContextChecked */;\n                    if (contextualSignature) {\n                        var signature = getSignaturesOfType(type, 0 /* Call */)[0];\n                        if (contextSensitive) {\n                            assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);\n                        }\n                        if (mightFixTypeParameters || !node.type && !signature.resolvedReturnType) {\n                            var returnType = getReturnTypeFromBody(node, contextualMapper);\n                            if (!signature.resolvedReturnType) {\n                                signature.resolvedReturnType = returnType;\n                            }\n                        }\n                    }\n                    if (!contextChecked) {\n                        checkSignatureDeclaration(node);\n                        checkNodeDeferred(node);\n                    }\n                }\n            }\n            if (produceDiagnostics && node.kind !== 149 /* MethodDeclaration */) {\n                checkCollisionWithCapturedSuperVariable(node, node.name);\n                checkCollisionWithCapturedThisVariable(node, node.name);\n            }\n            return type;\n        }\n        function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) {\n            ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));\n            var isAsync = ts.isAsyncFunctionLike(node);\n            var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type));\n            if (!node.asteriskToken) {\n                // return is not necessary in the body of generators\n                checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType);\n            }\n            if (node.body) {\n                if (!node.type) {\n                    // There are some checks that are only performed in getReturnTypeFromBody, that may produce errors\n                    // we need. An example is the noImplicitAny errors resulting from widening the return expression\n                    // of a function. Because checking of function expression bodies is deferred, there was never an\n                    // appropriate time to do this during the main walk of the file (see the comment at the top of\n                    // checkFunctionExpressionBodies). So it must be done now.\n                    getReturnTypeOfSignature(getSignatureFromDeclaration(node));\n                }\n                if (node.body.kind === 204 /* Block */) {\n                    checkSourceElement(node.body);\n                }\n                else {\n                    // From within an async function you can return either a non-promise value or a promise. Any\n                    // Promise/A+ compatible implementation will always assimilate any foreign promise, so we\n                    // should not be checking assignability of a promise to the return type. Instead, we need to\n                    // check assignability of the awaited type of the expression body against the promised type of\n                    // its return type annotation.\n                    var exprType = checkExpression(node.body);\n                    if (returnOrPromisedType) {\n                        if (isAsync) {\n                            var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member);\n                            checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body);\n                        }\n                        else {\n                            checkTypeAssignableTo(exprType, returnOrPromisedType, node.body);\n                        }\n                    }\n                }\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkArithmeticOperandType(operand, type, diagnostic) {\n            if (!isTypeAnyOrAllConstituentTypesHaveKind(type, 340 /* NumberLike */)) {\n                error(operand, diagnostic);\n                return false;\n            }\n            return true;\n        }\n        function isReadonlySymbol(symbol) {\n            // The following symbols are considered read-only:\n            // Properties with a 'readonly' modifier\n            // Variables declared with 'const'\n            // Get accessors without matching set accessors\n            // Enum members\n            // Unions and intersections of the above (unions and intersections eagerly set isReadonly on creation)\n            return symbol.isReadonly ||\n                symbol.flags & 4 /* Property */ && (getDeclarationModifierFlagsFromSymbol(symbol) & 64 /* Readonly */) !== 0 ||\n                symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0 ||\n                symbol.flags & 98304 /* Accessor */ && !(symbol.flags & 65536 /* SetAccessor */) ||\n                (symbol.flags & 8 /* EnumMember */) !== 0;\n        }\n        function isReferenceToReadonlyEntity(expr, symbol) {\n            if (isReadonlySymbol(symbol)) {\n                // Allow assignments to readonly properties within constructors of the same class declaration.\n                if (symbol.flags & 4 /* Property */ &&\n                    (expr.kind === 177 /* PropertyAccessExpression */ || expr.kind === 178 /* ElementAccessExpression */) &&\n                    expr.expression.kind === 98 /* ThisKeyword */) {\n                    // Look for if this is the constructor for the class that `symbol` is a property of.\n                    var func = ts.getContainingFunction(expr);\n                    if (!(func && func.kind === 150 /* Constructor */))\n                        return true;\n                    // If func.parent is a class and symbol is a (readonly) property of that class, or\n                    // if func is a constructor and symbol is a (readonly) parameter property declared in it,\n                    // then symbol is writeable here.\n                    return !(func.parent === symbol.valueDeclaration.parent || func === symbol.valueDeclaration.parent);\n                }\n                return true;\n            }\n            return false;\n        }\n        function isReferenceThroughNamespaceImport(expr) {\n            if (expr.kind === 177 /* PropertyAccessExpression */ || expr.kind === 178 /* ElementAccessExpression */) {\n                var node = ts.skipParentheses(expr.expression);\n                if (node.kind === 70 /* Identifier */) {\n                    var symbol = getNodeLinks(node).resolvedSymbol;\n                    if (symbol.flags & 8388608 /* Alias */) {\n                        var declaration = getDeclarationOfAliasSymbol(symbol);\n                        return declaration && declaration.kind === 237 /* NamespaceImport */;\n                    }\n                }\n            }\n            return false;\n        }\n        function checkReferenceExpression(expr, invalidReferenceMessage) {\n            // References are combinations of identifiers, parentheses, and property accesses.\n            var node = ts.skipParentheses(expr);\n            if (node.kind !== 70 /* Identifier */ && node.kind !== 177 /* PropertyAccessExpression */ && node.kind !== 178 /* ElementAccessExpression */) {\n                error(expr, invalidReferenceMessage);\n                return false;\n            }\n            return true;\n        }\n        function checkDeleteExpression(node) {\n            checkExpression(node.expression);\n            return booleanType;\n        }\n        function checkTypeOfExpression(node) {\n            checkExpression(node.expression);\n            return stringType;\n        }\n        function checkVoidExpression(node) {\n            checkExpression(node.expression);\n            return undefinedWideningType;\n        }\n        function checkAwaitExpression(node) {\n            // Grammar checking\n            if (produceDiagnostics) {\n                if (!(node.flags & 16384 /* AwaitContext */)) {\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function);\n                }\n                if (isInParameterInitializerBeforeContainingFunction(node)) {\n                    error(node, ts.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);\n                }\n            }\n            var operandType = checkExpression(node.expression);\n            return checkAwaitedType(operandType, node);\n        }\n        function checkPrefixUnaryExpression(node) {\n            var operandType = checkExpression(node.operand);\n            if (operandType === silentNeverType) {\n                return silentNeverType;\n            }\n            if (node.operator === 37 /* MinusToken */ && node.operand.kind === 8 /* NumericLiteral */) {\n                return getFreshTypeOfLiteralType(getLiteralTypeForText(64 /* NumberLiteral */, \"\" + -node.operand.text));\n            }\n            switch (node.operator) {\n                case 36 /* PlusToken */:\n                case 37 /* MinusToken */:\n                case 51 /* TildeToken */:\n                    if (maybeTypeOfKind(operandType, 512 /* ESSymbol */)) {\n                        error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator));\n                    }\n                    return numberType;\n                case 50 /* ExclamationToken */:\n                    var facts = getTypeFacts(operandType) & (1048576 /* Truthy */ | 2097152 /* Falsy */);\n                    return facts === 1048576 /* Truthy */ ? falseType :\n                        facts === 2097152 /* Falsy */ ? trueType :\n                            booleanType;\n                case 42 /* PlusPlusToken */:\n                case 43 /* MinusMinusToken */:\n                    var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type);\n                    if (ok) {\n                        // run check only if former checks succeeded to avoid reporting cascading errors\n                        checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access);\n                    }\n                    return numberType;\n            }\n            return unknownType;\n        }\n        function checkPostfixUnaryExpression(node) {\n            var operandType = checkExpression(node.operand);\n            if (operandType === silentNeverType) {\n                return silentNeverType;\n            }\n            var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type);\n            if (ok) {\n                // run check only if former checks succeeded to avoid reporting cascading errors\n                checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access);\n            }\n            return numberType;\n        }\n        // Return true if type might be of the given kind. A union or intersection type might be of a given\n        // kind if at least one constituent type is of the given kind.\n        function maybeTypeOfKind(type, kind) {\n            if (type.flags & kind) {\n                return true;\n            }\n            if (type.flags & 196608 /* UnionOrIntersection */) {\n                var types = type.types;\n                for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {\n                    var t = types_15[_i];\n                    if (maybeTypeOfKind(t, kind)) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        // Return true if type is of the given kind. A union type is of a given kind if all constituent types\n        // are of the given kind. An intersection type is of a given kind if at least one constituent type is\n        // of the given kind.\n        function isTypeOfKind(type, kind) {\n            if (type.flags & kind) {\n                return true;\n            }\n            if (type.flags & 65536 /* Union */) {\n                var types = type.types;\n                for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {\n                    var t = types_16[_i];\n                    if (!isTypeOfKind(t, kind)) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            if (type.flags & 131072 /* Intersection */) {\n                var types = type.types;\n                for (var _a = 0, types_17 = types; _a < types_17.length; _a++) {\n                    var t = types_17[_a];\n                    if (isTypeOfKind(t, kind)) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        function isConstEnumObjectType(type) {\n            return getObjectFlags(type) & 16 /* Anonymous */ && type.symbol && isConstEnumSymbol(type.symbol);\n        }\n        function isConstEnumSymbol(symbol) {\n            return (symbol.flags & 128 /* ConstEnum */) !== 0;\n        }\n        function checkInstanceOfExpression(left, right, leftType, rightType) {\n            if (leftType === silentNeverType || rightType === silentNeverType) {\n                return silentNeverType;\n            }\n            // TypeScript 1.0 spec (April 2014): 4.15.4\n            // The instanceof operator requires the left operand to be of type Any, an object type, or a type parameter type,\n            // and the right operand to be of type Any or a subtype of the 'Function' interface type.\n            // The result is always of the Boolean primitive type.\n            // NOTE: do not raise error if leftType is unknown as related error was already reported\n            if (isTypeOfKind(leftType, 8190 /* Primitive */)) {\n                error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);\n            }\n            // NOTE: do not raise error if right is unknown as related error was already reported\n            if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {\n                error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);\n            }\n            return booleanType;\n        }\n        function checkInExpression(left, right, leftType, rightType) {\n            if (leftType === silentNeverType || rightType === silentNeverType) {\n                return silentNeverType;\n            }\n            // TypeScript 1.0 spec (April 2014): 4.15.5\n            // The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type,\n            // and the right operand to be of type Any, an object type, or a type parameter type.\n            // The result is always of the Boolean primitive type.\n            if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 /* NumberLike */ | 512 /* ESSymbol */))) {\n                error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol);\n            }\n            if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 540672 /* TypeVariable */)) {\n                error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);\n            }\n            return booleanType;\n        }\n        function checkObjectLiteralAssignment(node, sourceType) {\n            var properties = node.properties;\n            for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) {\n                var p = properties_6[_i];\n                checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties);\n            }\n            return sourceType;\n        }\n        /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */\n        function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) {\n            if (property.kind === 257 /* PropertyAssignment */ || property.kind === 258 /* ShorthandPropertyAssignment */) {\n                var name_20 = property.name;\n                if (name_20.kind === 142 /* ComputedPropertyName */) {\n                    checkComputedPropertyName(name_20);\n                }\n                if (isComputedNonLiteralName(name_20)) {\n                    return undefined;\n                }\n                var text = ts.getTextOfPropertyName(name_20);\n                var type = isTypeAny(objectLiteralType)\n                    ? objectLiteralType\n                    : getTypeOfPropertyOfType(objectLiteralType, text) ||\n                        isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1 /* Number */) ||\n                        getIndexTypeOfType(objectLiteralType, 0 /* String */);\n                if (type) {\n                    if (property.kind === 258 /* ShorthandPropertyAssignment */) {\n                        return checkDestructuringAssignment(property, type);\n                    }\n                    else {\n                        // non-shorthand property assignments should always have initializers\n                        return checkDestructuringAssignment(property.initializer, type);\n                    }\n                }\n                else {\n                    error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20));\n                }\n            }\n            else if (property.kind === 259 /* SpreadAssignment */) {\n                if (languageVersion < 5 /* ESNext */) {\n                    checkExternalEmitHelpers(property, 4 /* Rest */);\n                }\n                var nonRestNames = [];\n                if (allProperties) {\n                    for (var i = 0; i < allProperties.length - 1; i++) {\n                        nonRestNames.push(allProperties[i].name);\n                    }\n                }\n                var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol);\n                return checkDestructuringAssignment(property.expression, type);\n            }\n            else {\n                error(property, ts.Diagnostics.Property_assignment_expected);\n            }\n        }\n        function checkArrayLiteralAssignment(node, sourceType, contextualMapper) {\n            // This elementType will be used if the specific property corresponding to this index is not\n            // present (aka the tuple element property). This call also checks that the parentType is in\n            // fact an iterable or array (depending on target language).\n            var elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false) || unknownType;\n            var elements = node.elements;\n            for (var i = 0; i < elements.length; i++) {\n                checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, contextualMapper);\n            }\n            return sourceType;\n        }\n        function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) {\n            var elements = node.elements;\n            var element = elements[elementIndex];\n            if (element.kind !== 198 /* OmittedExpression */) {\n                if (element.kind !== 196 /* SpreadElement */) {\n                    var propName = \"\" + elementIndex;\n                    var type = isTypeAny(sourceType)\n                        ? sourceType\n                        : isTupleLikeType(sourceType)\n                            ? getTypeOfPropertyOfType(sourceType, propName)\n                            : elementType;\n                    if (type) {\n                        return checkDestructuringAssignment(element, type, contextualMapper);\n                    }\n                    else {\n                        // We still need to check element expression here because we may need to set appropriate flag on the expression\n                        // such as NodeCheckFlags.LexicalThis on \"this\"expression.\n                        checkExpression(element);\n                        if (isTupleType(sourceType)) {\n                            error(element, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), getTypeReferenceArity(sourceType), elements.length);\n                        }\n                        else {\n                            error(element, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName);\n                        }\n                    }\n                }\n                else {\n                    if (elementIndex < elements.length - 1) {\n                        error(element, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);\n                    }\n                    else {\n                        var restExpression = element.expression;\n                        if (restExpression.kind === 192 /* BinaryExpression */ && restExpression.operatorToken.kind === 57 /* EqualsToken */) {\n                            error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);\n                        }\n                        else {\n                            return checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper);\n                        }\n                    }\n                }\n            }\n            return undefined;\n        }\n        function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) {\n            var target;\n            if (exprOrAssignment.kind === 258 /* ShorthandPropertyAssignment */) {\n                var prop = exprOrAssignment;\n                if (prop.objectAssignmentInitializer) {\n                    // In strict null checking mode, if a default value of a non-undefined type is specified, remove\n                    // undefined from the final type.\n                    if (strictNullChecks &&\n                        !(getFalsyFlags(checkExpression(prop.objectAssignmentInitializer)) & 2048 /* Undefined */)) {\n                        sourceType = getTypeWithFacts(sourceType, 131072 /* NEUndefined */);\n                    }\n                    checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper);\n                }\n                target = exprOrAssignment.name;\n            }\n            else {\n                target = exprOrAssignment;\n            }\n            if (target.kind === 192 /* BinaryExpression */ && target.operatorToken.kind === 57 /* EqualsToken */) {\n                checkBinaryExpression(target, contextualMapper);\n                target = target.left;\n            }\n            if (target.kind === 176 /* ObjectLiteralExpression */) {\n                return checkObjectLiteralAssignment(target, sourceType);\n            }\n            if (target.kind === 175 /* ArrayLiteralExpression */) {\n                return checkArrayLiteralAssignment(target, sourceType, contextualMapper);\n            }\n            return checkReferenceAssignment(target, sourceType, contextualMapper);\n        }\n        function checkReferenceAssignment(target, sourceType, contextualMapper) {\n            var targetType = checkExpression(target, contextualMapper);\n            var error = target.parent.kind === 259 /* SpreadAssignment */ ?\n                ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access :\n                ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access;\n            if (checkReferenceExpression(target, error)) {\n                checkTypeAssignableTo(sourceType, targetType, target, /*headMessage*/ undefined);\n            }\n            return sourceType;\n        }\n        /**\n         * This is a *shallow* check: An expression is side-effect-free if the\n         * evaluation of the expression *itself* cannot produce side effects.\n         * For example, x++ / 3 is side-effect free because the / operator\n         * does not have side effects.\n         * The intent is to \"smell test\" an expression for correctness in positions where\n         * its value is discarded (e.g. the left side of the comma operator).\n         */\n        function isSideEffectFree(node) {\n            node = ts.skipParentheses(node);\n            switch (node.kind) {\n                case 70 /* Identifier */:\n                case 9 /* StringLiteral */:\n                case 11 /* RegularExpressionLiteral */:\n                case 181 /* TaggedTemplateExpression */:\n                case 194 /* TemplateExpression */:\n                case 12 /* NoSubstitutionTemplateLiteral */:\n                case 8 /* NumericLiteral */:\n                case 100 /* TrueKeyword */:\n                case 85 /* FalseKeyword */:\n                case 94 /* NullKeyword */:\n                case 137 /* UndefinedKeyword */:\n                case 184 /* FunctionExpression */:\n                case 197 /* ClassExpression */:\n                case 185 /* ArrowFunction */:\n                case 175 /* ArrayLiteralExpression */:\n                case 176 /* ObjectLiteralExpression */:\n                case 187 /* TypeOfExpression */:\n                case 201 /* NonNullExpression */:\n                case 247 /* JsxSelfClosingElement */:\n                case 246 /* JsxElement */:\n                    return true;\n                case 193 /* ConditionalExpression */:\n                    return isSideEffectFree(node.whenTrue) &&\n                        isSideEffectFree(node.whenFalse);\n                case 192 /* BinaryExpression */:\n                    if (ts.isAssignmentOperator(node.operatorToken.kind)) {\n                        return false;\n                    }\n                    return isSideEffectFree(node.left) &&\n                        isSideEffectFree(node.right);\n                case 190 /* PrefixUnaryExpression */:\n                case 191 /* PostfixUnaryExpression */:\n                    // Unary operators ~, !, +, and - have no side effects.\n                    // The rest do.\n                    switch (node.operator) {\n                        case 50 /* ExclamationToken */:\n                        case 36 /* PlusToken */:\n                        case 37 /* MinusToken */:\n                        case 51 /* TildeToken */:\n                            return true;\n                    }\n                    return false;\n                // Some forms listed here for clarity\n                case 188 /* VoidExpression */: // Explicit opt-out\n                case 182 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings\n                case 200 /* AsExpression */: // Not SEF, but can produce useful type warnings\n                default:\n                    return false;\n            }\n        }\n        function isTypeEqualityComparableTo(source, target) {\n            return (target.flags & 6144 /* Nullable */) !== 0 || isTypeComparableTo(source, target);\n        }\n        function getBestChoiceType(type1, type2) {\n            var firstAssignableToSecond = isTypeAssignableTo(type1, type2);\n            var secondAssignableToFirst = isTypeAssignableTo(type2, type1);\n            return secondAssignableToFirst && !firstAssignableToSecond ? type1 :\n                firstAssignableToSecond && !secondAssignableToFirst ? type2 :\n                    getUnionType([type1, type2], /*subtypeReduction*/ true);\n        }\n        function checkBinaryExpression(node, contextualMapper) {\n            return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node);\n        }\n        function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) {\n            var operator = operatorToken.kind;\n            if (operator === 57 /* EqualsToken */ && (left.kind === 176 /* ObjectLiteralExpression */ || left.kind === 175 /* ArrayLiteralExpression */)) {\n                return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper);\n            }\n            var leftType = checkExpression(left, contextualMapper);\n            var rightType = checkExpression(right, contextualMapper);\n            switch (operator) {\n                case 38 /* AsteriskToken */:\n                case 39 /* AsteriskAsteriskToken */:\n                case 60 /* AsteriskEqualsToken */:\n                case 61 /* AsteriskAsteriskEqualsToken */:\n                case 40 /* SlashToken */:\n                case 62 /* SlashEqualsToken */:\n                case 41 /* PercentToken */:\n                case 63 /* PercentEqualsToken */:\n                case 37 /* MinusToken */:\n                case 59 /* MinusEqualsToken */:\n                case 44 /* LessThanLessThanToken */:\n                case 64 /* LessThanLessThanEqualsToken */:\n                case 45 /* GreaterThanGreaterThanToken */:\n                case 65 /* GreaterThanGreaterThanEqualsToken */:\n                case 46 /* GreaterThanGreaterThanGreaterThanToken */:\n                case 66 /* GreaterThanGreaterThanGreaterThanEqualsToken */:\n                case 48 /* BarToken */:\n                case 68 /* BarEqualsToken */:\n                case 49 /* CaretToken */:\n                case 69 /* CaretEqualsToken */:\n                case 47 /* AmpersandToken */:\n                case 67 /* AmpersandEqualsToken */:\n                    if (leftType === silentNeverType || rightType === silentNeverType) {\n                        return silentNeverType;\n                    }\n                    // TypeScript 1.0 spec (April 2014): 4.19.1\n                    // These operators require their operands to be of type Any, the Number primitive type,\n                    // or an enum type. Operands of an enum type are treated\n                    // as having the primitive type Number. If one operand is the null or undefined value,\n                    // it is treated as having the type of the other operand.\n                    // The result is always of the Number primitive type.\n                    if (leftType.flags & 6144 /* Nullable */)\n                        leftType = rightType;\n                    if (rightType.flags & 6144 /* Nullable */)\n                        rightType = leftType;\n                    leftType = getNonNullableType(leftType);\n                    rightType = getNonNullableType(rightType);\n                    var suggestedOperator = void 0;\n                    // if a user tries to apply a bitwise operator to 2 boolean operands\n                    // try and return them a helpful suggestion\n                    if ((leftType.flags & 136 /* BooleanLike */) &&\n                        (rightType.flags & 136 /* BooleanLike */) &&\n                        (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== undefined) {\n                        error(errorNode || operatorToken, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(operatorToken.kind), ts.tokenToString(suggestedOperator));\n                    }\n                    else {\n                        // otherwise just check each operand separately and report errors as normal\n                        var leftOk = checkArithmeticOperandType(left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type);\n                        var rightOk = checkArithmeticOperandType(right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type);\n                        if (leftOk && rightOk) {\n                            checkAssignmentOperator(numberType);\n                        }\n                    }\n                    return numberType;\n                case 36 /* PlusToken */:\n                case 58 /* PlusEqualsToken */:\n                    if (leftType === silentNeverType || rightType === silentNeverType) {\n                        return silentNeverType;\n                    }\n                    // TypeScript 1.0 spec (April 2014): 4.19.2\n                    // The binary + operator requires both operands to be of the Number primitive type or an enum type,\n                    // or at least one of the operands to be of type Any or the String primitive type.\n                    // If one operand is the null or undefined value, it is treated as having the type of the other operand.\n                    if (leftType.flags & 6144 /* Nullable */)\n                        leftType = rightType;\n                    if (rightType.flags & 6144 /* Nullable */)\n                        rightType = leftType;\n                    leftType = getNonNullableType(leftType);\n                    rightType = getNonNullableType(rightType);\n                    var resultType = void 0;\n                    if (isTypeOfKind(leftType, 340 /* NumberLike */) && isTypeOfKind(rightType, 340 /* NumberLike */)) {\n                        // Operands of an enum type are treated as having the primitive type Number.\n                        // If both operands are of the Number primitive type, the result is of the Number primitive type.\n                        resultType = numberType;\n                    }\n                    else {\n                        if (isTypeOfKind(leftType, 262178 /* StringLike */) || isTypeOfKind(rightType, 262178 /* StringLike */)) {\n                            // If one or both operands are of the String primitive type, the result is of the String primitive type.\n                            resultType = stringType;\n                        }\n                        else if (isTypeAny(leftType) || isTypeAny(rightType)) {\n                            // Otherwise, the result is of type Any.\n                            // NOTE: unknown type here denotes error type. Old compiler treated this case as any type so do we.\n                            resultType = leftType === unknownType || rightType === unknownType ? unknownType : anyType;\n                        }\n                        // Symbols are not allowed at all in arithmetic expressions\n                        if (resultType && !checkForDisallowedESSymbolOperand(operator)) {\n                            return resultType;\n                        }\n                    }\n                    if (!resultType) {\n                        reportOperatorError();\n                        return anyType;\n                    }\n                    if (operator === 58 /* PlusEqualsToken */) {\n                        checkAssignmentOperator(resultType);\n                    }\n                    return resultType;\n                case 26 /* LessThanToken */:\n                case 28 /* GreaterThanToken */:\n                case 29 /* LessThanEqualsToken */:\n                case 30 /* GreaterThanEqualsToken */:\n                    if (checkForDisallowedESSymbolOperand(operator)) {\n                        leftType = getBaseTypeOfLiteralType(leftType);\n                        rightType = getBaseTypeOfLiteralType(rightType);\n                        if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {\n                            reportOperatorError();\n                        }\n                    }\n                    return booleanType;\n                case 31 /* EqualsEqualsToken */:\n                case 32 /* ExclamationEqualsToken */:\n                case 33 /* EqualsEqualsEqualsToken */:\n                case 34 /* ExclamationEqualsEqualsToken */:\n                    var leftIsLiteral = isLiteralType(leftType);\n                    var rightIsLiteral = isLiteralType(rightType);\n                    if (!leftIsLiteral || !rightIsLiteral) {\n                        leftType = leftIsLiteral ? getBaseTypeOfLiteralType(leftType) : leftType;\n                        rightType = rightIsLiteral ? getBaseTypeOfLiteralType(rightType) : rightType;\n                    }\n                    if (!isTypeEqualityComparableTo(leftType, rightType) && !isTypeEqualityComparableTo(rightType, leftType)) {\n                        reportOperatorError();\n                    }\n                    return booleanType;\n                case 92 /* InstanceOfKeyword */:\n                    return checkInstanceOfExpression(left, right, leftType, rightType);\n                case 91 /* InKeyword */:\n                    return checkInExpression(left, right, leftType, rightType);\n                case 52 /* AmpersandAmpersandToken */:\n                    return getTypeFacts(leftType) & 1048576 /* Truthy */ ?\n                        includeFalsyTypes(rightType, getFalsyFlags(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType))) :\n                        leftType;\n                case 53 /* BarBarToken */:\n                    return getTypeFacts(leftType) & 2097152 /* Falsy */ ?\n                        getBestChoiceType(removeDefinitelyFalsyTypes(leftType), rightType) :\n                        leftType;\n                case 57 /* EqualsToken */:\n                    checkAssignmentOperator(rightType);\n                    return getRegularTypeOfObjectLiteral(rightType);\n                case 25 /* CommaToken */:\n                    if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left)) {\n                        error(left, ts.Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects);\n                    }\n                    return rightType;\n            }\n            // Return true if there was no error, false if there was an error.\n            function checkForDisallowedESSymbolOperand(operator) {\n                var offendingSymbolOperand = maybeTypeOfKind(leftType, 512 /* ESSymbol */) ? left :\n                    maybeTypeOfKind(rightType, 512 /* ESSymbol */) ? right :\n                        undefined;\n                if (offendingSymbolOperand) {\n                    error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator));\n                    return false;\n                }\n                return true;\n            }\n            function getSuggestedBooleanOperator(operator) {\n                switch (operator) {\n                    case 48 /* BarToken */:\n                    case 68 /* BarEqualsToken */:\n                        return 53 /* BarBarToken */;\n                    case 49 /* CaretToken */:\n                    case 69 /* CaretEqualsToken */:\n                        return 34 /* ExclamationEqualsEqualsToken */;\n                    case 47 /* AmpersandToken */:\n                    case 67 /* AmpersandEqualsToken */:\n                        return 52 /* AmpersandAmpersandToken */;\n                    default:\n                        return undefined;\n                }\n            }\n            function checkAssignmentOperator(valueType) {\n                if (produceDiagnostics && operator >= 57 /* FirstAssignment */ && operator <= 69 /* LastAssignment */) {\n                    // TypeScript 1.0 spec (April 2014): 4.17\n                    // An assignment of the form\n                    //    VarExpr = ValueExpr\n                    // requires VarExpr to be classified as a reference\n                    // A compound assignment furthermore requires VarExpr to be classified as a reference (section 4.1)\n                    // and the type of the non - compound operation to be assignable to the type of VarExpr.\n                    if (checkReferenceExpression(left, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) {\n                        // to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported\n                        checkTypeAssignableTo(valueType, leftType, left, /*headMessage*/ undefined);\n                    }\n                }\n            }\n            function reportOperatorError() {\n                error(errorNode || operatorToken, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), typeToString(leftType), typeToString(rightType));\n            }\n        }\n        function isYieldExpressionInClass(node) {\n            var current = node;\n            var parent = node.parent;\n            while (parent) {\n                if (ts.isFunctionLike(parent) && current === parent.body) {\n                    return false;\n                }\n                else if (ts.isClassLike(current)) {\n                    return true;\n                }\n                current = parent;\n                parent = parent.parent;\n            }\n            return false;\n        }\n        function checkYieldExpression(node) {\n            // Grammar checking\n            if (produceDiagnostics) {\n                if (!(node.flags & 4096 /* YieldContext */) || isYieldExpressionInClass(node)) {\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body);\n                }\n                if (isInParameterInitializerBeforeContainingFunction(node)) {\n                    error(node, ts.Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer);\n                }\n            }\n            if (node.expression) {\n                var func = ts.getContainingFunction(node);\n                // If the user's code is syntactically correct, the func should always have a star. After all,\n                // we are in a yield context.\n                if (func && func.asteriskToken) {\n                    var expressionType = checkExpressionCached(node.expression, /*contextualMapper*/ undefined);\n                    var expressionElementType = void 0;\n                    var nodeIsYieldStar = !!node.asteriskToken;\n                    if (nodeIsYieldStar) {\n                        expressionElementType = checkElementTypeOfIterable(expressionType, node.expression);\n                    }\n                    // There is no point in doing an assignability check if the function\n                    // has no explicit return type because the return type is directly computed\n                    // from the yield expressions.\n                    if (func.type) {\n                        var signatureElementType = getElementTypeOfIterableIterator(getTypeFromTypeNode(func.type)) || anyType;\n                        if (nodeIsYieldStar) {\n                            checkTypeAssignableTo(expressionElementType, signatureElementType, node.expression, /*headMessage*/ undefined);\n                        }\n                        else {\n                            checkTypeAssignableTo(expressionType, signatureElementType, node.expression, /*headMessage*/ undefined);\n                        }\n                    }\n                }\n            }\n            // Both yield and yield* expressions have type 'any'\n            return anyType;\n        }\n        function checkConditionalExpression(node, contextualMapper) {\n            checkExpression(node.condition);\n            var type1 = checkExpression(node.whenTrue, contextualMapper);\n            var type2 = checkExpression(node.whenFalse, contextualMapper);\n            return getBestChoiceType(type1, type2);\n        }\n        function checkLiteralExpression(node) {\n            if (node.kind === 8 /* NumericLiteral */) {\n                checkGrammarNumericLiteral(node);\n            }\n            switch (node.kind) {\n                case 9 /* StringLiteral */:\n                    return getFreshTypeOfLiteralType(getLiteralTypeForText(32 /* StringLiteral */, node.text));\n                case 8 /* NumericLiteral */:\n                    return getFreshTypeOfLiteralType(getLiteralTypeForText(64 /* NumberLiteral */, node.text));\n                case 100 /* TrueKeyword */:\n                    return trueType;\n                case 85 /* FalseKeyword */:\n                    return falseType;\n            }\n        }\n        function checkTemplateExpression(node) {\n            // We just want to check each expressions, but we are unconcerned with\n            // the type of each expression, as any value may be coerced into a string.\n            // It is worth asking whether this is what we really want though.\n            // A place where we actually *are* concerned with the expressions' types are\n            // in tagged templates.\n            ts.forEach(node.templateSpans, function (templateSpan) {\n                checkExpression(templateSpan.expression);\n            });\n            return stringType;\n        }\n        function checkExpressionWithContextualType(node, contextualType, contextualMapper) {\n            var saveContextualType = node.contextualType;\n            node.contextualType = contextualType;\n            var result = checkExpression(node, contextualMapper);\n            node.contextualType = saveContextualType;\n            return result;\n        }\n        function checkExpressionCached(node, contextualMapper) {\n            var links = getNodeLinks(node);\n            if (!links.resolvedType) {\n                // When computing a type that we're going to cache, we need to ignore any ongoing control flow\n                // analysis because variables may have transient types in indeterminable states. Moving flowLoopStart\n                // to the top of the stack ensures all transient types are computed from a known point.\n                var saveFlowLoopStart = flowLoopStart;\n                flowLoopStart = flowLoopCount;\n                links.resolvedType = checkExpression(node, contextualMapper);\n                flowLoopStart = saveFlowLoopStart;\n            }\n            return links.resolvedType;\n        }\n        function isTypeAssertion(node) {\n            node = ts.skipParentheses(node);\n            return node.kind === 182 /* TypeAssertionExpression */ || node.kind === 200 /* AsExpression */;\n        }\n        function checkDeclarationInitializer(declaration) {\n            var type = checkExpressionCached(declaration.initializer);\n            return ts.getCombinedNodeFlags(declaration) & 2 /* Const */ ||\n                ts.getCombinedModifierFlags(declaration) & 64 /* Readonly */ && !ts.isParameterPropertyDeclaration(declaration) ||\n                isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type);\n        }\n        function isLiteralContextualType(contextualType) {\n            if (contextualType) {\n                if (contextualType.flags & 16384 /* TypeParameter */) {\n                    var apparentType = getApparentTypeOfTypeParameter(contextualType);\n                    // If the type parameter is constrained to the base primitive type we're checking for,\n                    // consider this a literal context. For example, given a type parameter 'T extends string',\n                    // this causes us to infer string literal types for T.\n                    if (apparentType.flags & (2 /* String */ | 4 /* Number */ | 8 /* Boolean */ | 16 /* Enum */)) {\n                        return true;\n                    }\n                    contextualType = apparentType;\n                }\n                return maybeTypeOfKind(contextualType, (480 /* Literal */ | 262144 /* Index */));\n            }\n            return false;\n        }\n        function checkExpressionForMutableLocation(node, contextualMapper) {\n            var type = checkExpression(node, contextualMapper);\n            return isTypeAssertion(node) || isLiteralContextualType(getContextualType(node)) ? type : getWidenedLiteralType(type);\n        }\n        function checkPropertyAssignment(node, contextualMapper) {\n            // Do not use hasDynamicName here, because that returns false for well known symbols.\n            // We want to perform checkComputedPropertyName for all computed properties, including\n            // well known symbols.\n            if (node.name.kind === 142 /* ComputedPropertyName */) {\n                checkComputedPropertyName(node.name);\n            }\n            return checkExpressionForMutableLocation(node.initializer, contextualMapper);\n        }\n        function checkObjectLiteralMethod(node, contextualMapper) {\n            // Grammar checking\n            checkGrammarMethod(node);\n            // Do not use hasDynamicName here, because that returns false for well known symbols.\n            // We want to perform checkComputedPropertyName for all computed properties, including\n            // well known symbols.\n            if (node.name.kind === 142 /* ComputedPropertyName */) {\n                checkComputedPropertyName(node.name);\n            }\n            var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper);\n            return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper);\n        }\n        function instantiateTypeWithSingleGenericCallSignature(node, type, contextualMapper) {\n            if (isInferentialContext(contextualMapper)) {\n                var signature = getSingleCallSignature(type);\n                if (signature && signature.typeParameters) {\n                    var contextualType = getApparentTypeOfContextualType(node);\n                    if (contextualType) {\n                        var contextualSignature = getSingleCallSignature(contextualType);\n                        if (contextualSignature && !contextualSignature.typeParameters) {\n                            return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper));\n                        }\n                    }\n                }\n            }\n            return type;\n        }\n        // Returns the type of an expression. Unlike checkExpression, this function is simply concerned\n        // with computing the type and may not fully check all contained sub-expressions for errors.\n        function getTypeOfExpression(node) {\n            // Optimize for the common case of a call to a function with a single non-generic call\n            // signature where we can just fetch the return type without checking the arguments.\n            if (node.kind === 179 /* CallExpression */ && node.expression.kind !== 96 /* SuperKeyword */) {\n                var funcType = checkNonNullExpression(node.expression);\n                var signature = getSingleCallSignature(funcType);\n                if (signature && !signature.typeParameters) {\n                    return getReturnTypeOfSignature(signature);\n                }\n            }\n            // Otherwise simply call checkExpression. Ideally, the entire family of checkXXX functions\n            // should have a parameter that indicates whether full error checking is required such that\n            // we can perform the optimizations locally.\n            return checkExpression(node);\n        }\n        // Checks an expression and returns its type. The contextualMapper parameter serves two purposes: When\n        // contextualMapper is not undefined and not equal to the identityMapper function object it indicates that the\n        // expression is being inferentially typed (section 4.15.2 in spec) and provides the type mapper to use in\n        // conjunction with the generic contextual type. When contextualMapper is equal to the identityMapper function\n        // object, it serves as an indicator that all contained function and arrow expressions should be considered to\n        // have the wildcard function type; this form of type check is used during overload resolution to exclude\n        // contextually typed function and arrow expressions in the initial phase.\n        function checkExpression(node, contextualMapper) {\n            var type;\n            if (node.kind === 141 /* QualifiedName */) {\n                type = checkQualifiedName(node);\n            }\n            else {\n                var uninstantiatedType = checkExpressionWorker(node, contextualMapper);\n                type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper);\n            }\n            if (isConstEnumObjectType(type)) {\n                // enum object type for const enums are only permitted in:\n                // - 'left' in property access\n                // - 'object' in indexed access\n                // - target in rhs of import statement\n                var ok = (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.expression === node) ||\n                    (node.parent.kind === 178 /* ElementAccessExpression */ && node.parent.expression === node) ||\n                    ((node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node));\n                if (!ok) {\n                    error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment);\n                }\n            }\n            return type;\n        }\n        function checkExpressionWorker(node, contextualMapper) {\n            switch (node.kind) {\n                case 70 /* Identifier */:\n                    return checkIdentifier(node);\n                case 98 /* ThisKeyword */:\n                    return checkThisExpression(node);\n                case 96 /* SuperKeyword */:\n                    return checkSuperExpression(node);\n                case 94 /* NullKeyword */:\n                    return nullWideningType;\n                case 9 /* StringLiteral */:\n                case 8 /* NumericLiteral */:\n                case 100 /* TrueKeyword */:\n                case 85 /* FalseKeyword */:\n                    return checkLiteralExpression(node);\n                case 194 /* TemplateExpression */:\n                    return checkTemplateExpression(node);\n                case 12 /* NoSubstitutionTemplateLiteral */:\n                    return stringType;\n                case 11 /* RegularExpressionLiteral */:\n                    return globalRegExpType;\n                case 175 /* ArrayLiteralExpression */:\n                    return checkArrayLiteral(node, contextualMapper);\n                case 176 /* ObjectLiteralExpression */:\n                    return checkObjectLiteral(node, contextualMapper);\n                case 177 /* PropertyAccessExpression */:\n                    return checkPropertyAccessExpression(node);\n                case 178 /* ElementAccessExpression */:\n                    return checkIndexedAccess(node);\n                case 179 /* CallExpression */:\n                case 180 /* NewExpression */:\n                    return checkCallExpression(node);\n                case 181 /* TaggedTemplateExpression */:\n                    return checkTaggedTemplateExpression(node);\n                case 183 /* ParenthesizedExpression */:\n                    return checkExpression(node.expression, contextualMapper);\n                case 197 /* ClassExpression */:\n                    return checkClassExpression(node);\n                case 184 /* FunctionExpression */:\n                case 185 /* ArrowFunction */:\n                    return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper);\n                case 187 /* TypeOfExpression */:\n                    return checkTypeOfExpression(node);\n                case 182 /* TypeAssertionExpression */:\n                case 200 /* AsExpression */:\n                    return checkAssertion(node);\n                case 201 /* NonNullExpression */:\n                    return checkNonNullAssertion(node);\n                case 186 /* DeleteExpression */:\n                    return checkDeleteExpression(node);\n                case 188 /* VoidExpression */:\n                    return checkVoidExpression(node);\n                case 189 /* AwaitExpression */:\n                    return checkAwaitExpression(node);\n                case 190 /* PrefixUnaryExpression */:\n                    return checkPrefixUnaryExpression(node);\n                case 191 /* PostfixUnaryExpression */:\n                    return checkPostfixUnaryExpression(node);\n                case 192 /* BinaryExpression */:\n                    return checkBinaryExpression(node, contextualMapper);\n                case 193 /* ConditionalExpression */:\n                    return checkConditionalExpression(node, contextualMapper);\n                case 196 /* SpreadElement */:\n                    return checkSpreadExpression(node, contextualMapper);\n                case 198 /* OmittedExpression */:\n                    return undefinedWideningType;\n                case 195 /* YieldExpression */:\n                    return checkYieldExpression(node);\n                case 252 /* JsxExpression */:\n                    return checkJsxExpression(node);\n                case 246 /* JsxElement */:\n                    return checkJsxElement(node);\n                case 247 /* JsxSelfClosingElement */:\n                    return checkJsxSelfClosingElement(node);\n                case 248 /* JsxOpeningElement */:\n                    ts.Debug.fail(\"Shouldn't ever directly check a JsxOpeningElement\");\n            }\n            return unknownType;\n        }\n        // DECLARATION AND STATEMENT TYPE CHECKING\n        function checkTypeParameter(node) {\n            // Grammar Checking\n            if (node.expression) {\n                grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected);\n            }\n            checkSourceElement(node.constraint);\n            getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)));\n            if (produceDiagnostics) {\n                checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0);\n            }\n        }\n        function checkParameter(node) {\n            // Grammar checking\n            // It is a SyntaxError if the Identifier \"eval\" or the Identifier \"arguments\" occurs as the\n            // Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code\n            // or if its FunctionBody is strict code(11.1.5).\n            // Grammar checking\n            checkGrammarDecorators(node) || checkGrammarModifiers(node);\n            checkVariableLikeDeclaration(node);\n            var func = ts.getContainingFunction(node);\n            if (ts.getModifierFlags(node) & 92 /* ParameterPropertyModifier */) {\n                func = ts.getContainingFunction(node);\n                if (!(func.kind === 150 /* Constructor */ && ts.nodeIsPresent(func.body))) {\n                    error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);\n                }\n            }\n            if (node.questionToken && ts.isBindingPattern(node.name) && func.body) {\n                error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);\n            }\n            if (node.name.text === \"this\") {\n                if (ts.indexOf(func.parameters, node) !== 0) {\n                    error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter);\n                }\n                if (func.kind === 150 /* Constructor */ || func.kind === 154 /* ConstructSignature */ || func.kind === 159 /* ConstructorType */) {\n                    error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter);\n                }\n            }\n            // Only check rest parameter type if it's not a binding pattern. Since binding patterns are\n            // not allowed in a rest parameter, we already have an error from checkGrammarParameterList.\n            if (node.dotDotDotToken && !ts.isBindingPattern(node.name) && !isArrayType(getTypeOfSymbol(node.symbol))) {\n                error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type);\n            }\n        }\n        function isSyntacticallyValidGenerator(node) {\n            if (!node.asteriskToken || !node.body) {\n                return false;\n            }\n            return node.kind === 149 /* MethodDeclaration */ ||\n                node.kind === 225 /* FunctionDeclaration */ ||\n                node.kind === 184 /* FunctionExpression */;\n        }\n        function getTypePredicateParameterIndex(parameterList, parameter) {\n            if (parameterList) {\n                for (var i = 0; i < parameterList.length; i++) {\n                    var param = parameterList[i];\n                    if (param.name.kind === 70 /* Identifier */ &&\n                        param.name.text === parameter.text) {\n                        return i;\n                    }\n                }\n            }\n            return -1;\n        }\n        function checkTypePredicate(node) {\n            var parent = getTypePredicateParent(node);\n            if (!parent) {\n                // The parent must not be valid.\n                error(node, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);\n                return;\n            }\n            var typePredicate = getSignatureFromDeclaration(parent).typePredicate;\n            if (!typePredicate) {\n                return;\n            }\n            var parameterName = node.parameterName;\n            if (ts.isThisTypePredicate(typePredicate)) {\n                getTypeFromThisTypeNode(parameterName);\n            }\n            else {\n                if (typePredicate.parameterIndex >= 0) {\n                    if (parent.parameters[typePredicate.parameterIndex].dotDotDotToken) {\n                        error(parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter);\n                    }\n                    else {\n                        var leadingError = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type);\n                        checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type, \n                        /*headMessage*/ undefined, leadingError);\n                    }\n                }\n                else if (parameterName) {\n                    var hasReportedError = false;\n                    for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) {\n                        var name_21 = _a[_i].name;\n                        if (ts.isBindingPattern(name_21) &&\n                            checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_21, parameterName, typePredicate.parameterName)) {\n                            hasReportedError = true;\n                            break;\n                        }\n                    }\n                    if (!hasReportedError) {\n                        error(node.parameterName, ts.Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName);\n                    }\n                }\n            }\n        }\n        function getTypePredicateParent(node) {\n            switch (node.parent.kind) {\n                case 185 /* ArrowFunction */:\n                case 153 /* CallSignature */:\n                case 225 /* FunctionDeclaration */:\n                case 184 /* FunctionExpression */:\n                case 158 /* FunctionType */:\n                case 149 /* MethodDeclaration */:\n                case 148 /* MethodSignature */:\n                    var parent_9 = node.parent;\n                    if (node === parent_9.type) {\n                        return parent_9;\n                    }\n            }\n        }\n        function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern, predicateVariableNode, predicateVariableName) {\n            for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {\n                var element = _a[_i];\n                if (ts.isOmittedExpression(element)) {\n                    continue;\n                }\n                var name_22 = element.name;\n                if (name_22.kind === 70 /* Identifier */ &&\n                    name_22.text === predicateVariableName) {\n                    error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);\n                    return true;\n                }\n                else if (name_22.kind === 173 /* ArrayBindingPattern */ ||\n                    name_22.kind === 172 /* ObjectBindingPattern */) {\n                    if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, predicateVariableNode, predicateVariableName)) {\n                        return true;\n                    }\n                }\n            }\n        }\n        function checkSignatureDeclaration(node) {\n            // Grammar checking\n            if (node.kind === 155 /* IndexSignature */) {\n                checkGrammarIndexSignature(node);\n            }\n            else if (node.kind === 158 /* FunctionType */ || node.kind === 225 /* FunctionDeclaration */ || node.kind === 159 /* ConstructorType */ ||\n                node.kind === 153 /* CallSignature */ || node.kind === 150 /* Constructor */ ||\n                node.kind === 154 /* ConstructSignature */) {\n                checkGrammarFunctionLikeDeclaration(node);\n            }\n            if (ts.isAsyncFunctionLike(node) && languageVersion < 4 /* ES2017 */) {\n                checkExternalEmitHelpers(node, 64 /* Awaiter */);\n                if (languageVersion < 2 /* ES2015 */) {\n                    checkExternalEmitHelpers(node, 128 /* Generator */);\n                }\n            }\n            checkTypeParameters(node.typeParameters);\n            ts.forEach(node.parameters, checkParameter);\n            if (node.type) {\n                checkSourceElement(node.type);\n            }\n            if (produceDiagnostics) {\n                checkCollisionWithArgumentsInGeneratedCode(node);\n                if (compilerOptions.noImplicitAny && !node.type) {\n                    switch (node.kind) {\n                        case 154 /* ConstructSignature */:\n                            error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);\n                            break;\n                        case 153 /* CallSignature */:\n                            error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);\n                            break;\n                    }\n                }\n                if (node.type) {\n                    if (languageVersion >= 2 /* ES2015 */ && isSyntacticallyValidGenerator(node)) {\n                        var returnType = getTypeFromTypeNode(node.type);\n                        if (returnType === voidType) {\n                            error(node.type, ts.Diagnostics.A_generator_cannot_have_a_void_type_annotation);\n                        }\n                        else {\n                            var generatorElementType = getElementTypeOfIterableIterator(returnType) || anyType;\n                            var iterableIteratorInstantiation = createIterableIteratorType(generatorElementType);\n                            // Naively, one could check that IterableIterator<any> is assignable to the return type annotation.\n                            // However, that would not catch the error in the following case.\n                            //\n                            //    interface BadGenerator extends Iterable<number>, Iterator<string> { }\n                            //    function* g(): BadGenerator { } // Iterable and Iterator have different types!\n                            //\n                            checkTypeAssignableTo(iterableIteratorInstantiation, returnType, node.type);\n                        }\n                    }\n                    else if (ts.isAsyncFunctionLike(node)) {\n                        checkAsyncFunctionReturnType(node);\n                    }\n                }\n                if (noUnusedIdentifiers && !node.body) {\n                    checkUnusedTypeParameters(node);\n                }\n            }\n        }\n        function checkClassForDuplicateDeclarations(node) {\n            var Accessor;\n            (function (Accessor) {\n                Accessor[Accessor[\"Getter\"] = 1] = \"Getter\";\n                Accessor[Accessor[\"Setter\"] = 2] = \"Setter\";\n                Accessor[Accessor[\"Property\"] = 3] = \"Property\";\n            })(Accessor || (Accessor = {}));\n            var instanceNames = ts.createMap();\n            var staticNames = ts.createMap();\n            for (var _i = 0, _a = node.members; _i < _a.length; _i++) {\n                var member = _a[_i];\n                if (member.kind === 150 /* Constructor */) {\n                    for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {\n                        var param = _c[_b];\n                        if (ts.isParameterPropertyDeclaration(param)) {\n                            addName(instanceNames, param.name, param.name.text, 3 /* Property */);\n                        }\n                    }\n                }\n                else {\n                    var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 114 /* StaticKeyword */; });\n                    var names = isStatic ? staticNames : instanceNames;\n                    var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name);\n                    if (memberName) {\n                        switch (member.kind) {\n                            case 151 /* GetAccessor */:\n                                addName(names, member.name, memberName, 1 /* Getter */);\n                                break;\n                            case 152 /* SetAccessor */:\n                                addName(names, member.name, memberName, 2 /* Setter */);\n                                break;\n                            case 147 /* PropertyDeclaration */:\n                                addName(names, member.name, memberName, 3 /* Property */);\n                                break;\n                        }\n                    }\n                }\n            }\n            function addName(names, location, name, meaning) {\n                var prev = names[name];\n                if (prev) {\n                    if (prev & meaning) {\n                        error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location));\n                    }\n                    else {\n                        names[name] = prev | meaning;\n                    }\n                }\n                else {\n                    names[name] = meaning;\n                }\n            }\n        }\n        function checkObjectTypeForDuplicateDeclarations(node) {\n            var names = ts.createMap();\n            for (var _i = 0, _a = node.members; _i < _a.length; _i++) {\n                var member = _a[_i];\n                if (member.kind == 146 /* PropertySignature */) {\n                    var memberName = void 0;\n                    switch (member.name.kind) {\n                        case 9 /* StringLiteral */:\n                        case 8 /* NumericLiteral */:\n                        case 70 /* Identifier */:\n                            memberName = member.name.text;\n                            break;\n                        default:\n                            continue;\n                    }\n                    if (names[memberName]) {\n                        error(member.symbol.valueDeclaration.name, ts.Diagnostics.Duplicate_identifier_0, memberName);\n                        error(member.name, ts.Diagnostics.Duplicate_identifier_0, memberName);\n                    }\n                    else {\n                        names[memberName] = true;\n                    }\n                }\n            }\n        }\n        function checkTypeForDuplicateIndexSignatures(node) {\n            if (node.kind === 227 /* InterfaceDeclaration */) {\n                var nodeSymbol = getSymbolOfNode(node);\n                // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration\n                // to prevent this run check only for the first declaration of a given kind\n                if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) {\n                    return;\n                }\n            }\n            // TypeScript 1.0 spec (April 2014)\n            // 3.7.4: An object type can contain at most one string index signature and one numeric index signature.\n            // 8.5: A class declaration can have at most one string index member declaration and one numeric index member declaration\n            var indexSymbol = getIndexSymbol(getSymbolOfNode(node));\n            if (indexSymbol) {\n                var seenNumericIndexer = false;\n                var seenStringIndexer = false;\n                for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    var declaration = decl;\n                    if (declaration.parameters.length === 1 && declaration.parameters[0].type) {\n                        switch (declaration.parameters[0].type.kind) {\n                            case 134 /* StringKeyword */:\n                                if (!seenStringIndexer) {\n                                    seenStringIndexer = true;\n                                }\n                                else {\n                                    error(declaration, ts.Diagnostics.Duplicate_string_index_signature);\n                                }\n                                break;\n                            case 132 /* NumberKeyword */:\n                                if (!seenNumericIndexer) {\n                                    seenNumericIndexer = true;\n                                }\n                                else {\n                                    error(declaration, ts.Diagnostics.Duplicate_number_index_signature);\n                                }\n                                break;\n                        }\n                    }\n                }\n            }\n        }\n        function checkPropertyDeclaration(node) {\n            // Grammar checking\n            checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name);\n            checkVariableLikeDeclaration(node);\n        }\n        function checkMethodDeclaration(node) {\n            // Grammar checking\n            checkGrammarMethod(node) || checkGrammarComputedPropertyName(node.name);\n            // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration\n            checkFunctionOrMethodDeclaration(node);\n            // Abstract methods cannot have an implementation.\n            // Extra checks are to avoid reporting multiple errors relating to the \"abstractness\" of the node.\n            if (ts.getModifierFlags(node) & 128 /* Abstract */ && node.body) {\n                error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name));\n            }\n        }\n        function checkConstructorDeclaration(node) {\n            // Grammar check on signature of constructor and modifier of the constructor is done in checkSignatureDeclaration function.\n            checkSignatureDeclaration(node);\n            // Grammar check for checking only related to constructorDeclaration\n            checkGrammarConstructorTypeParameters(node) || checkGrammarConstructorTypeAnnotation(node);\n            checkSourceElement(node.body);\n            registerForUnusedIdentifiersCheck(node);\n            var symbol = getSymbolOfNode(node);\n            var firstDeclaration = ts.getDeclarationOfKind(symbol, node.kind);\n            // Only type check the symbol once\n            if (node === firstDeclaration) {\n                checkFunctionOrConstructorSymbol(symbol);\n            }\n            // exit early in the case of signature - super checks are not relevant to them\n            if (ts.nodeIsMissing(node.body)) {\n                return;\n            }\n            if (!produceDiagnostics) {\n                return;\n            }\n            function containsSuperCallAsComputedPropertyName(n) {\n                return n.name && containsSuperCall(n.name);\n            }\n            function containsSuperCall(n) {\n                if (ts.isSuperCall(n)) {\n                    return true;\n                }\n                else if (ts.isFunctionLike(n)) {\n                    return false;\n                }\n                else if (ts.isClassLike(n)) {\n                    return ts.forEach(n.members, containsSuperCallAsComputedPropertyName);\n                }\n                return ts.forEachChild(n, containsSuperCall);\n            }\n            function markThisReferencesAsErrors(n) {\n                if (n.kind === 98 /* ThisKeyword */) {\n                    error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location);\n                }\n                else if (n.kind !== 184 /* FunctionExpression */ && n.kind !== 225 /* FunctionDeclaration */) {\n                    ts.forEachChild(n, markThisReferencesAsErrors);\n                }\n            }\n            function isInstancePropertyWithInitializer(n) {\n                return n.kind === 147 /* PropertyDeclaration */ &&\n                    !(ts.getModifierFlags(n) & 32 /* Static */) &&\n                    !!n.initializer;\n            }\n            // TS 1.0 spec (April 2014): 8.3.2\n            // Constructors of classes with no extends clause may not contain super calls, whereas\n            // constructors of derived classes must contain at least one super call somewhere in their function body.\n            var containingClassDecl = node.parent;\n            if (ts.getClassExtendsHeritageClauseElement(containingClassDecl)) {\n                captureLexicalThis(node.parent, containingClassDecl);\n                var classExtendsNull = classDeclarationExtendsNull(containingClassDecl);\n                var superCall = getSuperCallInConstructor(node);\n                if (superCall) {\n                    if (classExtendsNull) {\n                        error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);\n                    }\n                    // The first statement in the body of a constructor (excluding prologue directives) must be a super call\n                    // if both of the following are true:\n                    // - The containing class is a derived class.\n                    // - The constructor declares parameter properties\n                    //   or the containing class declares instance member variables with initializers.\n                    var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) ||\n                        ts.forEach(node.parameters, function (p) { return ts.getModifierFlags(p) & 92 /* ParameterPropertyModifier */; });\n                    // Skip past any prologue directives to find the first statement\n                    // to ensure that it was a super call.\n                    if (superCallShouldBeFirst) {\n                        var statements = node.body.statements;\n                        var superCallStatement = void 0;\n                        for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) {\n                            var statement = statements_3[_i];\n                            if (statement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {\n                                superCallStatement = statement;\n                                break;\n                            }\n                            if (!ts.isPrologueDirective(statement)) {\n                                break;\n                            }\n                        }\n                        if (!superCallStatement) {\n                            error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties);\n                        }\n                    }\n                }\n                else if (!classExtendsNull) {\n                    error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call);\n                }\n            }\n        }\n        function checkAccessorDeclaration(node) {\n            if (produceDiagnostics) {\n                // Grammar checking accessors\n                checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name);\n                checkDecorators(node);\n                checkSignatureDeclaration(node);\n                if (node.kind === 151 /* GetAccessor */) {\n                    if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 128 /* HasImplicitReturn */)) {\n                        if (!(node.flags & 256 /* HasExplicitReturn */)) {\n                            error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);\n                        }\n                    }\n                }\n                // Do not use hasDynamicName here, because that returns false for well known symbols.\n                // We want to perform checkComputedPropertyName for all computed properties, including\n                // well known symbols.\n                if (node.name.kind === 142 /* ComputedPropertyName */) {\n                    checkComputedPropertyName(node.name);\n                }\n                if (!ts.hasDynamicName(node)) {\n                    // TypeScript 1.0 spec (April 2014): 8.4.3\n                    // Accessors for the same member name must specify the same accessibility.\n                    var otherKind = node.kind === 151 /* GetAccessor */ ? 152 /* SetAccessor */ : 151 /* GetAccessor */;\n                    var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind);\n                    if (otherAccessor) {\n                        if ((ts.getModifierFlags(node) & 28 /* AccessibilityModifier */) !== (ts.getModifierFlags(otherAccessor) & 28 /* AccessibilityModifier */)) {\n                            error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility);\n                        }\n                        if (ts.hasModifier(node, 128 /* Abstract */) !== ts.hasModifier(otherAccessor, 128 /* Abstract */)) {\n                            error(node.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);\n                        }\n                        // TypeScript 1.0 spec (April 2014): 4.5\n                        // If both accessors include type annotations, the specified types must be identical.\n                        checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorType, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type);\n                        checkAccessorDeclarationTypesIdentical(node, otherAccessor, getThisTypeOfDeclaration, ts.Diagnostics.get_and_set_accessor_must_have_the_same_this_type);\n                    }\n                }\n                var returnType = getTypeOfAccessors(getSymbolOfNode(node));\n                if (node.kind === 151 /* GetAccessor */) {\n                    checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType);\n                }\n            }\n            if (node.parent.kind !== 176 /* ObjectLiteralExpression */) {\n                checkSourceElement(node.body);\n                registerForUnusedIdentifiersCheck(node);\n            }\n            else {\n                checkNodeDeferred(node);\n            }\n        }\n        function checkAccessorDeclarationTypesIdentical(first, second, getAnnotatedType, message) {\n            var firstType = getAnnotatedType(first);\n            var secondType = getAnnotatedType(second);\n            if (firstType && secondType && !isTypeIdenticalTo(firstType, secondType)) {\n                error(first, message);\n            }\n        }\n        function checkAccessorDeferred(node) {\n            checkSourceElement(node.body);\n            registerForUnusedIdentifiersCheck(node);\n        }\n        function checkMissingDeclaration(node) {\n            checkDecorators(node);\n        }\n        function checkTypeArgumentConstraints(typeParameters, typeArgumentNodes) {\n            var typeArguments;\n            var mapper;\n            var result = true;\n            for (var i = 0; i < typeParameters.length; i++) {\n                var constraint = getConstraintOfTypeParameter(typeParameters[i]);\n                if (constraint) {\n                    if (!typeArguments) {\n                        typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode);\n                        mapper = createTypeMapper(typeParameters, typeArguments);\n                    }\n                    var typeArgument = typeArguments[i];\n                    result = result && checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), typeArgumentNodes[i], ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);\n                }\n            }\n            return result;\n        }\n        function checkTypeReferenceNode(node) {\n            checkGrammarTypeArguments(node, node.typeArguments);\n            var type = getTypeFromTypeReference(node);\n            if (type !== unknownType) {\n                if (node.typeArguments) {\n                    // Do type argument local checks only if referenced type is successfully resolved\n                    ts.forEach(node.typeArguments, checkSourceElement);\n                    if (produceDiagnostics) {\n                        var symbol = getNodeLinks(node).resolvedSymbol;\n                        var typeParameters = symbol.flags & 524288 /* TypeAlias */ ? getSymbolLinks(symbol).typeParameters : type.target.localTypeParameters;\n                        checkTypeArgumentConstraints(typeParameters, node.typeArguments);\n                    }\n                }\n                if (type.flags & 16 /* Enum */ && !type.memberTypes && getNodeLinks(node).resolvedSymbol.flags & 8 /* EnumMember */) {\n                    error(node, ts.Diagnostics.Enum_type_0_has_members_with_initializers_that_are_not_literals, typeToString(type));\n                }\n            }\n        }\n        function checkTypeQuery(node) {\n            getTypeFromTypeQueryNode(node);\n        }\n        function checkTypeLiteral(node) {\n            ts.forEach(node.members, checkSourceElement);\n            if (produceDiagnostics) {\n                var type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);\n                checkIndexConstraints(type);\n                checkTypeForDuplicateIndexSignatures(node);\n                checkObjectTypeForDuplicateDeclarations(node);\n            }\n        }\n        function checkArrayType(node) {\n            checkSourceElement(node.elementType);\n        }\n        function checkTupleType(node) {\n            // Grammar checking\n            var hasErrorFromDisallowedTrailingComma = checkGrammarForDisallowedTrailingComma(node.elementTypes);\n            if (!hasErrorFromDisallowedTrailingComma && node.elementTypes.length === 0) {\n                grammarErrorOnNode(node, ts.Diagnostics.A_tuple_type_element_list_cannot_be_empty);\n            }\n            ts.forEach(node.elementTypes, checkSourceElement);\n        }\n        function checkUnionOrIntersectionType(node) {\n            ts.forEach(node.types, checkSourceElement);\n        }\n        function checkIndexedAccessType(node) {\n            getTypeFromIndexedAccessTypeNode(node);\n        }\n        function checkMappedType(node) {\n            checkSourceElement(node.typeParameter);\n            checkSourceElement(node.type);\n            var type = getTypeFromMappedTypeNode(node);\n            var constraintType = getConstraintTypeFromMappedType(type);\n            var keyType = constraintType.flags & 16384 /* TypeParameter */ ? getApparentTypeOfTypeParameter(constraintType) : constraintType;\n            checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint);\n        }\n        function isPrivateWithinAmbient(node) {\n            return (ts.getModifierFlags(node) & 8 /* Private */) && ts.isInAmbientContext(node);\n        }\n        function getEffectiveDeclarationFlags(n, flagsToCheck) {\n            var flags = ts.getCombinedModifierFlags(n);\n            // children of classes (even ambient classes) should not be marked as ambient or export\n            // because those flags have no useful semantics there.\n            if (n.parent.kind !== 227 /* InterfaceDeclaration */ &&\n                n.parent.kind !== 226 /* ClassDeclaration */ &&\n                n.parent.kind !== 197 /* ClassExpression */ &&\n                ts.isInAmbientContext(n)) {\n                if (!(flags & 2 /* Ambient */)) {\n                    // It is nested in an ambient context, which means it is automatically exported\n                    flags |= 1 /* Export */;\n                }\n                flags |= 2 /* Ambient */;\n            }\n            return flags & flagsToCheck;\n        }\n        function checkFunctionOrConstructorSymbol(symbol) {\n            if (!produceDiagnostics) {\n                return;\n            }\n            function getCanonicalOverload(overloads, implementation) {\n                // Consider the canonical set of flags to be the flags of the bodyDeclaration or the first declaration\n                // Error on all deviations from this canonical set of flags\n                // The caveat is that if some overloads are defined in lib.d.ts, we don't want to\n                // report the errors on those. To achieve this, we will say that the implementation is\n                // the canonical signature only if it is in the same container as the first overload\n                var implementationSharesContainerWithFirstOverload = implementation !== undefined && implementation.parent === overloads[0].parent;\n                return implementationSharesContainerWithFirstOverload ? implementation : overloads[0];\n            }\n            function checkFlagAgreementBetweenOverloads(overloads, implementation, flagsToCheck, someOverloadFlags, allOverloadFlags) {\n                // Error if some overloads have a flag that is not shared by all overloads. To find the\n                // deviations, we XOR someOverloadFlags with allOverloadFlags\n                var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags;\n                if (someButNotAllOverloadFlags !== 0) {\n                    var canonicalFlags_1 = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck);\n                    ts.forEach(overloads, function (o) {\n                        var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags_1;\n                        if (deviation & 1 /* Export */) {\n                            error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);\n                        }\n                        else if (deviation & 2 /* Ambient */) {\n                            error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);\n                        }\n                        else if (deviation & (8 /* Private */ | 16 /* Protected */)) {\n                            error(o.name || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);\n                        }\n                        else if (deviation & 128 /* Abstract */) {\n                            error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);\n                        }\n                    });\n                }\n            }\n            function checkQuestionTokenAgreementBetweenOverloads(overloads, implementation, someHaveQuestionToken, allHaveQuestionToken) {\n                if (someHaveQuestionToken !== allHaveQuestionToken) {\n                    var canonicalHasQuestionToken_1 = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation));\n                    ts.forEach(overloads, function (o) {\n                        var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken_1;\n                        if (deviation) {\n                            error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_optional_or_required);\n                        }\n                    });\n                }\n            }\n            var flagsToCheck = 1 /* Export */ | 2 /* Ambient */ | 8 /* Private */ | 16 /* Protected */ | 128 /* Abstract */;\n            var someNodeFlags = 0 /* None */;\n            var allNodeFlags = flagsToCheck;\n            var someHaveQuestionToken = false;\n            var allHaveQuestionToken = true;\n            var hasOverloads = false;\n            var bodyDeclaration;\n            var lastSeenNonAmbientDeclaration;\n            var previousDeclaration;\n            var declarations = symbol.declarations;\n            var isConstructor = (symbol.flags & 16384 /* Constructor */) !== 0;\n            function reportImplementationExpectedError(node) {\n                if (node.name && ts.nodeIsMissing(node.name)) {\n                    return;\n                }\n                var seen = false;\n                var subsequentNode = ts.forEachChild(node.parent, function (c) {\n                    if (seen) {\n                        return c;\n                    }\n                    else {\n                        seen = c === node;\n                    }\n                });\n                // We may be here because of some extra nodes between overloads that could not be parsed into a valid node.\n                // In this case the subsequent node is not really consecutive (.pos !== node.end), and we must ignore it here.\n                if (subsequentNode && subsequentNode.pos === node.end) {\n                    if (subsequentNode.kind === node.kind) {\n                        var errorNode_1 = subsequentNode.name || subsequentNode;\n                        // TODO(jfreeman): These are methods, so handle computed name case\n                        if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) {\n                            var reportError = (node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */) &&\n                                (ts.getModifierFlags(node) & 32 /* Static */) !== (ts.getModifierFlags(subsequentNode) & 32 /* Static */);\n                            // we can get here in two cases\n                            // 1. mixed static and instance class members\n                            // 2. something with the same name was defined before the set of overloads that prevents them from merging\n                            // here we'll report error only for the first case since for second we should already report error in binder\n                            if (reportError) {\n                                var diagnostic = ts.getModifierFlags(node) & 32 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static;\n                                error(errorNode_1, diagnostic);\n                            }\n                            return;\n                        }\n                        else if (ts.nodeIsPresent(subsequentNode.body)) {\n                            error(errorNode_1, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name));\n                            return;\n                        }\n                    }\n                }\n                var errorNode = node.name || node;\n                if (isConstructor) {\n                    error(errorNode, ts.Diagnostics.Constructor_implementation_is_missing);\n                }\n                else {\n                    // Report different errors regarding non-consecutive blocks of declarations depending on whether\n                    // the node in question is abstract.\n                    if (ts.getModifierFlags(node) & 128 /* Abstract */) {\n                        error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive);\n                    }\n                    else {\n                        error(errorNode, ts.Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration);\n                    }\n                }\n            }\n            var duplicateFunctionDeclaration = false;\n            var multipleConstructorImplementation = false;\n            for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {\n                var current = declarations_4[_i];\n                var node = current;\n                var inAmbientContext = ts.isInAmbientContext(node);\n                var inAmbientContextOrInterface = node.parent.kind === 227 /* InterfaceDeclaration */ || node.parent.kind === 161 /* TypeLiteral */ || inAmbientContext;\n                if (inAmbientContextOrInterface) {\n                    // check if declarations are consecutive only if they are non-ambient\n                    // 1. ambient declarations can be interleaved\n                    // i.e. this is legal\n                    //     declare function foo();\n                    //     declare function bar();\n                    //     declare function foo();\n                    // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one\n                    previousDeclaration = undefined;\n                }\n                if (node.kind === 225 /* FunctionDeclaration */ || node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */ || node.kind === 150 /* Constructor */) {\n                    var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);\n                    someNodeFlags |= currentNodeFlags;\n                    allNodeFlags &= currentNodeFlags;\n                    someHaveQuestionToken = someHaveQuestionToken || ts.hasQuestionToken(node);\n                    allHaveQuestionToken = allHaveQuestionToken && ts.hasQuestionToken(node);\n                    if (ts.nodeIsPresent(node.body) && bodyDeclaration) {\n                        if (isConstructor) {\n                            multipleConstructorImplementation = true;\n                        }\n                        else {\n                            duplicateFunctionDeclaration = true;\n                        }\n                    }\n                    else if (previousDeclaration && previousDeclaration.parent === node.parent && previousDeclaration.end !== node.pos) {\n                        reportImplementationExpectedError(previousDeclaration);\n                    }\n                    if (ts.nodeIsPresent(node.body)) {\n                        if (!bodyDeclaration) {\n                            bodyDeclaration = node;\n                        }\n                    }\n                    else {\n                        hasOverloads = true;\n                    }\n                    previousDeclaration = node;\n                    if (!inAmbientContextOrInterface) {\n                        lastSeenNonAmbientDeclaration = node;\n                    }\n                }\n            }\n            if (multipleConstructorImplementation) {\n                ts.forEach(declarations, function (declaration) {\n                    error(declaration, ts.Diagnostics.Multiple_constructor_implementations_are_not_allowed);\n                });\n            }\n            if (duplicateFunctionDeclaration) {\n                ts.forEach(declarations, function (declaration) {\n                    error(declaration.name, ts.Diagnostics.Duplicate_function_implementation);\n                });\n            }\n            // Abstract methods can't have an implementation -- in particular, they don't need one.\n            if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body &&\n                !(ts.getModifierFlags(lastSeenNonAmbientDeclaration) & 128 /* Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) {\n                reportImplementationExpectedError(lastSeenNonAmbientDeclaration);\n            }\n            if (hasOverloads) {\n                checkFlagAgreementBetweenOverloads(declarations, bodyDeclaration, flagsToCheck, someNodeFlags, allNodeFlags);\n                checkQuestionTokenAgreementBetweenOverloads(declarations, bodyDeclaration, someHaveQuestionToken, allHaveQuestionToken);\n                if (bodyDeclaration) {\n                    var signatures = getSignaturesOfSymbol(symbol);\n                    var bodySignature = getSignatureFromDeclaration(bodyDeclaration);\n                    for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) {\n                        var signature = signatures_3[_a];\n                        if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {\n                            error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation);\n                            break;\n                        }\n                    }\n                }\n            }\n        }\n        function checkExportsOnMergedDeclarations(node) {\n            if (!produceDiagnostics) {\n                return;\n            }\n            // if localSymbol is defined on node then node itself is exported - check is required\n            var symbol = node.localSymbol;\n            if (!symbol) {\n                // local symbol is undefined => this declaration is non-exported.\n                // however symbol might contain other declarations that are exported\n                symbol = getSymbolOfNode(node);\n                if (!(symbol.flags & 7340032 /* Export */)) {\n                    // this is a pure local symbol (all declarations are non-exported) - no need to check anything\n                    return;\n                }\n            }\n            // run the check only for the first declaration in the list\n            if (ts.getDeclarationOfKind(symbol, node.kind) !== node) {\n                return;\n            }\n            // we use SymbolFlags.ExportValue, SymbolFlags.ExportType and SymbolFlags.ExportNamespace\n            // to denote disjoint declarationSpaces (without making new enum type).\n            var exportedDeclarationSpaces = 0 /* None */;\n            var nonExportedDeclarationSpaces = 0 /* None */;\n            var defaultExportedDeclarationSpaces = 0 /* None */;\n            for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                var d = _a[_i];\n                var declarationSpaces = getDeclarationSpaces(d);\n                var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* Export */ | 512 /* Default */);\n                if (effectiveDeclarationFlags & 1 /* Export */) {\n                    if (effectiveDeclarationFlags & 512 /* Default */) {\n                        defaultExportedDeclarationSpaces |= declarationSpaces;\n                    }\n                    else {\n                        exportedDeclarationSpaces |= declarationSpaces;\n                    }\n                }\n                else {\n                    nonExportedDeclarationSpaces |= declarationSpaces;\n                }\n            }\n            // Spaces for anything not declared a 'default export'.\n            var nonDefaultExportedDeclarationSpaces = exportedDeclarationSpaces | nonExportedDeclarationSpaces;\n            var commonDeclarationSpacesForExportsAndLocals = exportedDeclarationSpaces & nonExportedDeclarationSpaces;\n            var commonDeclarationSpacesForDefaultAndNonDefault = defaultExportedDeclarationSpaces & nonDefaultExportedDeclarationSpaces;\n            if (commonDeclarationSpacesForExportsAndLocals || commonDeclarationSpacesForDefaultAndNonDefault) {\n                // declaration spaces for exported and non-exported declarations intersect\n                for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) {\n                    var d = _c[_b];\n                    var declarationSpaces = getDeclarationSpaces(d);\n                    // Only error on the declarations that contributed to the intersecting spaces.\n                    if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) {\n                        error(d.name, ts.Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, ts.declarationNameToString(d.name));\n                    }\n                    else if (declarationSpaces & commonDeclarationSpacesForExportsAndLocals) {\n                        error(d.name, ts.Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, ts.declarationNameToString(d.name));\n                    }\n                }\n            }\n            function getDeclarationSpaces(d) {\n                switch (d.kind) {\n                    case 227 /* InterfaceDeclaration */:\n                        return 2097152 /* ExportType */;\n                    case 230 /* ModuleDeclaration */:\n                        return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */\n                            ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */\n                            : 4194304 /* ExportNamespace */;\n                    case 226 /* ClassDeclaration */:\n                    case 229 /* EnumDeclaration */:\n                        return 2097152 /* ExportType */ | 1048576 /* ExportValue */;\n                    case 234 /* ImportEqualsDeclaration */:\n                        var result_3 = 0;\n                        var target = resolveAlias(getSymbolOfNode(d));\n                        ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); });\n                        return result_3;\n                    default:\n                        return 1048576 /* ExportValue */;\n                }\n            }\n        }\n        function checkNonThenableType(type, location, message) {\n            type = getWidenedType(type);\n            if (!isTypeAny(type) && !isTypeNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) {\n                if (location) {\n                    if (!message) {\n                        message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member;\n                    }\n                    error(location, message);\n                }\n                return unknownType;\n            }\n            return type;\n        }\n        /**\n          * Gets the \"promised type\" of a promise.\n          * @param type The type of the promise.\n          * @remarks The \"promised type\" of a type is the type of the \"value\" parameter of the \"onfulfilled\" callback.\n          */\n        function getPromisedType(promise) {\n            //\n            //  { // promise\n            //      then( // thenFunction\n            //          onfulfilled: ( // onfulfilledParameterType\n            //              value: T // valueParameterType\n            //          ) => any\n            //      ): any;\n            //  }\n            //\n            if (isTypeAny(promise)) {\n                return undefined;\n            }\n            if (getObjectFlags(promise) & 4 /* Reference */) {\n                if (promise.target === tryGetGlobalPromiseType()\n                    || promise.target === getGlobalPromiseLikeType()) {\n                    return promise.typeArguments[0];\n                }\n            }\n            var globalPromiseLikeType = getInstantiatedGlobalPromiseLikeType();\n            if (globalPromiseLikeType === emptyObjectType || !isTypeAssignableTo(promise, globalPromiseLikeType)) {\n                return undefined;\n            }\n            var thenFunction = getTypeOfPropertyOfType(promise, \"then\");\n            if (!thenFunction || isTypeAny(thenFunction)) {\n                return undefined;\n            }\n            var thenSignatures = getSignaturesOfType(thenFunction, 0 /* Call */);\n            if (thenSignatures.length === 0) {\n                return undefined;\n            }\n            var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072 /* NEUndefined */);\n            if (isTypeAny(onfulfilledParameterType)) {\n                return undefined;\n            }\n            var onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0 /* Call */);\n            if (onfulfilledParameterSignatures.length === 0) {\n                return undefined;\n            }\n            return getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), /*subtypeReduction*/ true);\n        }\n        function getTypeOfFirstParameterOfSignature(signature) {\n            return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType;\n        }\n        /**\n          * Gets the \"awaited type\" of a type.\n          * @param type The type to await.\n          * @remarks The \"awaited type\" of an expression is its \"promised type\" if the expression is a\n          * Promise-like type; otherwise, it is the type of the expression. This is used to reflect\n          * The runtime behavior of the `await` keyword.\n          */\n        function getAwaitedType(type) {\n            return checkAwaitedType(type, /*location*/ undefined, /*message*/ undefined);\n        }\n        function checkAwaitedType(type, location, message) {\n            return checkAwaitedTypeWorker(type);\n            function checkAwaitedTypeWorker(type) {\n                if (type.flags & 65536 /* Union */) {\n                    var types = [];\n                    for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                        var constituentType = _a[_i];\n                        types.push(checkAwaitedTypeWorker(constituentType));\n                    }\n                    return getUnionType(types, /*subtypeReduction*/ true);\n                }\n                else {\n                    var promisedType = getPromisedType(type);\n                    if (promisedType === undefined) {\n                        // The type was not a PromiseLike, so it could not be unwrapped any further.\n                        // As long as the type does not have a callable \"then\" property, it is\n                        // safe to return the type; otherwise, an error will have been reported in\n                        // the call to checkNonThenableType and we will return unknownType.\n                        //\n                        // An example of a non-promise \"thenable\" might be:\n                        //\n                        //  await { then(): void {} }\n                        //\n                        // The \"thenable\" does not match the minimal definition for a PromiseLike. When\n                        // a Promise/A+-compatible or ES6 promise tries to adopt this value, the promise\n                        // will never settle. We treat this as an error to help flag an early indicator\n                        // of a runtime problem. If the user wants to return this value from an async\n                        // function, they would need to wrap it in some other value. If they want it to\n                        // be treated as a promise, they can cast to <any>.\n                        return checkNonThenableType(type, location, message);\n                    }\n                    else {\n                        if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) {\n                            // We have a bad actor in the form of a promise whose promised type is\n                            // the same promise type, or a mutually recursive promise. Return the\n                            // unknown type as we cannot guess the shape. If this were the actual\n                            // case in the JavaScript, this Promise would never resolve.\n                            //\n                            // An example of a bad actor with a singly-recursive promise type might\n                            // be:\n                            //\n                            //  interface BadPromise {\n                            //      then(\n                            //          onfulfilled: (value: BadPromise) => any,\n                            //          onrejected: (error: any) => any): BadPromise;\n                            //  }\n                            //\n                            // The above interface will pass the PromiseLike check, and return a\n                            // promised type of `BadPromise`. Since this is a self reference, we\n                            // don't want to keep recursing ad infinitum.\n                            //\n                            // An example of a bad actor in the form of a mutually-recursive\n                            // promise type might be:\n                            //\n                            //  interface BadPromiseA {\n                            //      then(\n                            //          onfulfilled: (value: BadPromiseB) => any,\n                            //          onrejected: (error: any) => any): BadPromiseB;\n                            //  }\n                            //\n                            //  interface BadPromiseB {\n                            //      then(\n                            //          onfulfilled: (value: BadPromiseA) => any,\n                            //          onrejected: (error: any) => any): BadPromiseA;\n                            //  }\n                            //\n                            if (location) {\n                                error(location, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method, symbolToString(type.symbol));\n                            }\n                            return unknownType;\n                        }\n                        // Keep track of the type we're about to unwrap to avoid bad recursive promise types.\n                        // See the comments above for more information.\n                        awaitedTypeStack.push(type.id);\n                        var awaitedType = checkAwaitedTypeWorker(promisedType);\n                        awaitedTypeStack.pop();\n                        return awaitedType;\n                    }\n                }\n            }\n        }\n        /**\n         * Checks the return type of an async function to ensure it is a compatible\n         * Promise implementation.\n         *\n         * This checks that an async function has a valid Promise-compatible return type,\n         * and returns the *awaited type* of the promise. An async function has a valid\n         * Promise-compatible return type if the resolved value of the return type has a\n         * construct signature that takes in an `initializer` function that in turn supplies\n         * a `resolve` function as one of its arguments and results in an object with a\n         * callable `then` signature.\n         *\n         * @param node The signature to check\n         */\n        function checkAsyncFunctionReturnType(node) {\n            // As part of our emit for an async function, we will need to emit the entity name of\n            // the return type annotation as an expression. To meet the necessary runtime semantics\n            // for __awaiter, we must also check that the type of the declaration (e.g. the static\n            // side or \"constructor\" of the promise type) is compatible `PromiseConstructorLike`.\n            //\n            // An example might be (from lib.es6.d.ts):\n            //\n            //  interface Promise<T> { ... }\n            //  interface PromiseConstructor {\n            //      new <T>(...): Promise<T>;\n            //  }\n            //  declare var Promise: PromiseConstructor;\n            //\n            // When an async function declares a return type annotation of `Promise<T>`, we\n            // need to get the type of the `Promise` variable declaration above, which would\n            // be `PromiseConstructor`.\n            //\n            // The same case applies to a class:\n            //\n            //  declare class Promise<T> {\n            //      constructor(...);\n            //      then<U>(...): Promise<U>;\n            //  }\n            //\n            var returnType = getTypeFromTypeNode(node.type);\n            if (languageVersion >= 2 /* ES2015 */) {\n                if (returnType === unknownType) {\n                    return unknownType;\n                }\n                var globalPromiseType = getGlobalPromiseType();\n                if (globalPromiseType !== emptyGenericType && globalPromiseType !== getTargetType(returnType)) {\n                    // The promise type was not a valid type reference to the global promise type, so we\n                    // report an error and return the unknown type.\n                    error(node.type, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type);\n                    return unknownType;\n                }\n            }\n            else {\n                // Always mark the type node as referenced if it points to a value\n                markTypeNodeAsReferenced(node.type);\n                if (returnType === unknownType) {\n                    return unknownType;\n                }\n                var promiseConstructorName = ts.getEntityNameFromTypeNode(node.type);\n                if (promiseConstructorName === undefined) {\n                    error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType));\n                    return unknownType;\n                }\n                var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 107455 /* Value */, /*ignoreErrors*/ true);\n                var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType;\n                if (promiseConstructorType === unknownType) {\n                    error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName));\n                    return unknownType;\n                }\n                var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType();\n                if (globalPromiseConstructorLikeType === emptyObjectType) {\n                    // If we couldn't resolve the global PromiseConstructorLike type we cannot verify\n                    // compatibility with __awaiter.\n                    error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName));\n                    return unknownType;\n                }\n                if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value)) {\n                    return unknownType;\n                }\n                // Verify there is no local declaration that could collide with the promise constructor.\n                var rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);\n                var collidingSymbol = getSymbol(node.locals, rootName.text, 107455 /* Value */);\n                if (collidingSymbol) {\n                    error(collidingSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, rootName.text, ts.entityNameToString(promiseConstructorName));\n                    return unknownType;\n                }\n            }\n            // Get and return the awaited type of the return type.\n            return checkAwaitedType(returnType, node, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type);\n        }\n        /** Check a decorator */\n        function checkDecorator(node) {\n            var signature = getResolvedSignature(node);\n            var returnType = getReturnTypeOfSignature(signature);\n            if (returnType.flags & 1 /* Any */) {\n                return;\n            }\n            var expectedReturnType;\n            var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);\n            var errorInfo;\n            switch (node.parent.kind) {\n                case 226 /* ClassDeclaration */:\n                    var classSymbol = getSymbolOfNode(node.parent);\n                    var classConstructorType = getTypeOfSymbol(classSymbol);\n                    expectedReturnType = getUnionType([classConstructorType, voidType]);\n                    break;\n                case 144 /* Parameter */:\n                    expectedReturnType = voidType;\n                    errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);\n                    break;\n                case 147 /* PropertyDeclaration */:\n                    expectedReturnType = voidType;\n                    errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);\n                    break;\n                case 149 /* MethodDeclaration */:\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                    var methodType = getTypeOfNode(node.parent);\n                    var descriptorType = createTypedPropertyDescriptorType(methodType);\n                    expectedReturnType = getUnionType([descriptorType, voidType]);\n                    break;\n            }\n            checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, errorInfo);\n        }\n        /**\n         * If a TypeNode can be resolved to a value symbol imported from an external module, it is\n         * marked as referenced to prevent import elision.\n         */\n        function markTypeNodeAsReferenced(node) {\n            var typeName = node && ts.getEntityNameFromTypeNode(node);\n            var rootName = typeName && getFirstIdentifier(typeName);\n            var rootSymbol = rootName && resolveName(rootName, rootName.text, (typeName.kind === 70 /* Identifier */ ? 793064 /* Type */ : 1920 /* Namespace */) | 8388608 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);\n            if (rootSymbol\n                && rootSymbol.flags & 8388608 /* Alias */\n                && symbolIsValue(rootSymbol)\n                && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) {\n                markAliasSymbolAsReferenced(rootSymbol);\n            }\n        }\n        /** Check the decorators of a node */\n        function checkDecorators(node) {\n            if (!node.decorators) {\n                return;\n            }\n            // skip this check for nodes that cannot have decorators. These should have already had an error reported by\n            // checkGrammarDecorators.\n            if (!ts.nodeCanBeDecorated(node)) {\n                return;\n            }\n            if (!compilerOptions.experimentalDecorators) {\n                error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning);\n            }\n            var firstDecorator = node.decorators[0];\n            checkExternalEmitHelpers(firstDecorator, 8 /* Decorate */);\n            if (node.kind === 144 /* Parameter */) {\n                checkExternalEmitHelpers(firstDecorator, 32 /* Param */);\n            }\n            if (compilerOptions.emitDecoratorMetadata) {\n                checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */);\n                // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator.\n                switch (node.kind) {\n                    case 226 /* ClassDeclaration */:\n                        var constructor = ts.getFirstConstructorWithBody(node);\n                        if (constructor) {\n                            for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) {\n                                var parameter = _a[_i];\n                                markTypeNodeAsReferenced(parameter.type);\n                            }\n                        }\n                        break;\n                    case 149 /* MethodDeclaration */:\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                        for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) {\n                            var parameter = _c[_b];\n                            markTypeNodeAsReferenced(parameter.type);\n                        }\n                        markTypeNodeAsReferenced(node.type);\n                        break;\n                    case 147 /* PropertyDeclaration */:\n                    case 144 /* Parameter */:\n                        markTypeNodeAsReferenced(node.type);\n                        break;\n                }\n            }\n            ts.forEach(node.decorators, checkDecorator);\n        }\n        function checkFunctionDeclaration(node) {\n            if (produceDiagnostics) {\n                checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node);\n                checkCollisionWithCapturedSuperVariable(node, node.name);\n                checkCollisionWithCapturedThisVariable(node, node.name);\n                checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n                checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n            }\n        }\n        function checkFunctionOrMethodDeclaration(node) {\n            checkDecorators(node);\n            checkSignatureDeclaration(node);\n            var isAsync = ts.isAsyncFunctionLike(node);\n            // Do not use hasDynamicName here, because that returns false for well known symbols.\n            // We want to perform checkComputedPropertyName for all computed properties, including\n            // well known symbols.\n            if (node.name && node.name.kind === 142 /* ComputedPropertyName */) {\n                // This check will account for methods in class/interface declarations,\n                // as well as accessors in classes/object literals\n                checkComputedPropertyName(node.name);\n            }\n            if (!ts.hasDynamicName(node)) {\n                // first we want to check the local symbol that contain this declaration\n                // - if node.localSymbol !== undefined - this is current declaration is exported and localSymbol points to the local symbol\n                // - if node.localSymbol === undefined - this node is non-exported so we can just pick the result of getSymbolOfNode\n                var symbol = getSymbolOfNode(node);\n                var localSymbol = node.localSymbol || symbol;\n                // Since the javascript won't do semantic analysis like typescript,\n                // if the javascript file comes before the typescript file and both contain same name functions,\n                // checkFunctionOrConstructorSymbol wouldn't be called if we didnt ignore javascript function.\n                var firstDeclaration = ts.forEach(localSymbol.declarations, \n                // Get first non javascript function declaration\n                function (declaration) { return declaration.kind === node.kind && !ts.isSourceFileJavaScript(ts.getSourceFileOfNode(declaration)) ?\n                    declaration : undefined; });\n                // Only type check the symbol once\n                if (node === firstDeclaration) {\n                    checkFunctionOrConstructorSymbol(localSymbol);\n                }\n                if (symbol.parent) {\n                    // run check once for the first declaration\n                    if (ts.getDeclarationOfKind(symbol, node.kind) === node) {\n                        // run check on export symbol to check that modifiers agree across all exported declarations\n                        checkFunctionOrConstructorSymbol(symbol);\n                    }\n                }\n            }\n            checkSourceElement(node.body);\n            if (!node.asteriskToken) {\n                var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type));\n                checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType);\n            }\n            if (produceDiagnostics && !node.type) {\n                // Report an implicit any error if there is no body, no explicit return type, and node is not a private method\n                // in an ambient context\n                if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) {\n                    reportImplicitAnyError(node, anyType);\n                }\n                if (node.asteriskToken && ts.nodeIsPresent(node.body)) {\n                    // A generator with a body and no type annotation can still cause errors. It can error if the\n                    // yielded values have no common supertype, or it can give an implicit any error if it has no\n                    // yielded values. The only way to trigger these errors is to try checking its return type.\n                    getReturnTypeOfSignature(getSignatureFromDeclaration(node));\n                }\n            }\n            registerForUnusedIdentifiersCheck(node);\n        }\n        function registerForUnusedIdentifiersCheck(node) {\n            if (deferredUnusedIdentifierNodes) {\n                deferredUnusedIdentifierNodes.push(node);\n            }\n        }\n        function checkUnusedIdentifiers() {\n            if (deferredUnusedIdentifierNodes) {\n                for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) {\n                    var node = deferredUnusedIdentifierNodes_1[_i];\n                    switch (node.kind) {\n                        case 261 /* SourceFile */:\n                        case 230 /* ModuleDeclaration */:\n                            checkUnusedModuleMembers(node);\n                            break;\n                        case 226 /* ClassDeclaration */:\n                        case 197 /* ClassExpression */:\n                            checkUnusedClassMembers(node);\n                            checkUnusedTypeParameters(node);\n                            break;\n                        case 227 /* InterfaceDeclaration */:\n                            checkUnusedTypeParameters(node);\n                            break;\n                        case 204 /* Block */:\n                        case 232 /* CaseBlock */:\n                        case 211 /* ForStatement */:\n                        case 212 /* ForInStatement */:\n                        case 213 /* ForOfStatement */:\n                            checkUnusedLocalsAndParameters(node);\n                            break;\n                        case 150 /* Constructor */:\n                        case 184 /* FunctionExpression */:\n                        case 225 /* FunctionDeclaration */:\n                        case 185 /* ArrowFunction */:\n                        case 149 /* MethodDeclaration */:\n                        case 151 /* GetAccessor */:\n                        case 152 /* SetAccessor */:\n                            if (node.body) {\n                                checkUnusedLocalsAndParameters(node);\n                            }\n                            checkUnusedTypeParameters(node);\n                            break;\n                        case 148 /* MethodSignature */:\n                        case 153 /* CallSignature */:\n                        case 154 /* ConstructSignature */:\n                        case 155 /* IndexSignature */:\n                        case 158 /* FunctionType */:\n                        case 159 /* ConstructorType */:\n                            checkUnusedTypeParameters(node);\n                            break;\n                    }\n                    ;\n                }\n            }\n        }\n        function checkUnusedLocalsAndParameters(node) {\n            if (node.parent.kind !== 227 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) {\n                var _loop_2 = function (key) {\n                    var local = node.locals[key];\n                    if (!local.isReferenced) {\n                        if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144 /* Parameter */) {\n                            var parameter = ts.getRootDeclaration(local.valueDeclaration);\n                            if (compilerOptions.noUnusedParameters &&\n                                !ts.isParameterPropertyDeclaration(parameter) &&\n                                !ts.parameterIsThisKeyword(parameter) &&\n                                !parameterNameStartsWithUnderscore(local.valueDeclaration.name)) {\n                                error(local.valueDeclaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name);\n                            }\n                        }\n                        else if (compilerOptions.noUnusedLocals) {\n                            ts.forEach(local.declarations, function (d) { return errorUnusedLocal(d.name || d, local.name); });\n                        }\n                    }\n                };\n                for (var key in node.locals) {\n                    _loop_2(key);\n                }\n            }\n        }\n        function errorUnusedLocal(node, name) {\n            if (isIdentifierThatStartsWithUnderScore(node)) {\n                var declaration = ts.getRootDeclaration(node.parent);\n                if (declaration.kind === 223 /* VariableDeclaration */ &&\n                    (declaration.parent.parent.kind === 212 /* ForInStatement */ ||\n                        declaration.parent.parent.kind === 213 /* ForOfStatement */)) {\n                    return;\n                }\n            }\n            error(node, ts.Diagnostics._0_is_declared_but_never_used, name);\n        }\n        function parameterNameStartsWithUnderscore(parameterName) {\n            return parameterName && isIdentifierThatStartsWithUnderScore(parameterName);\n        }\n        function isIdentifierThatStartsWithUnderScore(node) {\n            return node.kind === 70 /* Identifier */ && node.text.charCodeAt(0) === 95 /* _ */;\n        }\n        function checkUnusedClassMembers(node) {\n            if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {\n                if (node.members) {\n                    for (var _i = 0, _a = node.members; _i < _a.length; _i++) {\n                        var member = _a[_i];\n                        if (member.kind === 149 /* MethodDeclaration */ || member.kind === 147 /* PropertyDeclaration */) {\n                            if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8 /* Private */) {\n                                error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name);\n                            }\n                        }\n                        else if (member.kind === 150 /* Constructor */) {\n                            for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {\n                                var parameter = _c[_b];\n                                if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8 /* Private */) {\n                                    error(parameter.name, ts.Diagnostics.Property_0_is_declared_but_never_used, parameter.symbol.name);\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        function checkUnusedTypeParameters(node) {\n            if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {\n                if (node.typeParameters) {\n                    // Only report errors on the last declaration for the type parameter container;\n                    // this ensures that all uses have been accounted for.\n                    var symbol = getSymbolOfNode(node);\n                    var lastDeclaration = symbol && symbol.declarations && ts.lastOrUndefined(symbol.declarations);\n                    if (lastDeclaration !== node) {\n                        return;\n                    }\n                    for (var _i = 0, _a = node.typeParameters; _i < _a.length; _i++) {\n                        var typeParameter = _a[_i];\n                        if (!getMergedSymbol(typeParameter.symbol).isReferenced) {\n                            error(typeParameter.name, ts.Diagnostics._0_is_declared_but_never_used, typeParameter.symbol.name);\n                        }\n                    }\n                }\n            }\n        }\n        function checkUnusedModuleMembers(node) {\n            if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {\n                for (var key in node.locals) {\n                    var local = node.locals[key];\n                    if (!local.isReferenced && !local.exportSymbol) {\n                        for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) {\n                            var declaration = _a[_i];\n                            if (!ts.isAmbientModule(declaration)) {\n                                error(declaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name);\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        function checkBlock(node) {\n            // Grammar checking for SyntaxKind.Block\n            if (node.kind === 204 /* Block */) {\n                checkGrammarStatementInAmbientContext(node);\n            }\n            ts.forEach(node.statements, checkSourceElement);\n            if (node.locals) {\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkCollisionWithArgumentsInGeneratedCode(node) {\n            // no rest parameters \\ declaration context \\ overload - no codegen impact\n            if (!ts.hasDeclaredRestParameter(node) || ts.isInAmbientContext(node) || ts.nodeIsMissing(node.body)) {\n                return;\n            }\n            ts.forEach(node.parameters, function (p) {\n                if (p.name && !ts.isBindingPattern(p.name) && p.name.text === argumentsSymbol.name) {\n                    error(p, ts.Diagnostics.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters);\n                }\n            });\n        }\n        function needCollisionCheckForIdentifier(node, identifier, name) {\n            if (!(identifier && identifier.text === name)) {\n                return false;\n            }\n            if (node.kind === 147 /* PropertyDeclaration */ ||\n                node.kind === 146 /* PropertySignature */ ||\n                node.kind === 149 /* MethodDeclaration */ ||\n                node.kind === 148 /* MethodSignature */ ||\n                node.kind === 151 /* GetAccessor */ ||\n                node.kind === 152 /* SetAccessor */) {\n                // it is ok to have member named '_super' or '_this' - member access is always qualified\n                return false;\n            }\n            if (ts.isInAmbientContext(node)) {\n                // ambient context - no codegen impact\n                return false;\n            }\n            var root = ts.getRootDeclaration(node);\n            if (root.kind === 144 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) {\n                // just an overload - no codegen impact\n                return false;\n            }\n            return true;\n        }\n        function checkCollisionWithCapturedThisVariable(node, name) {\n            if (needCollisionCheckForIdentifier(node, name, \"_this\")) {\n                potentialThisCollisions.push(node);\n            }\n        }\n        // this function will run after checking the source file so 'CaptureThis' is correct for all nodes\n        function checkIfThisIsCapturedInEnclosingScope(node) {\n            var current = node;\n            while (current) {\n                if (getNodeCheckFlags(current) & 4 /* CaptureThis */) {\n                    var isDeclaration_1 = node.kind !== 70 /* Identifier */;\n                    if (isDeclaration_1) {\n                        error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);\n                    }\n                    else {\n                        error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference);\n                    }\n                    return;\n                }\n                current = current.parent;\n            }\n        }\n        function checkCollisionWithCapturedSuperVariable(node, name) {\n            if (!needCollisionCheckForIdentifier(node, name, \"_super\")) {\n                return;\n            }\n            // bubble up and find containing type\n            var enclosingClass = ts.getContainingClass(node);\n            // if containing type was not found or it is ambient - exit (no codegen)\n            if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) {\n                return;\n            }\n            if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) {\n                var isDeclaration_2 = node.kind !== 70 /* Identifier */;\n                if (isDeclaration_2) {\n                    error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference);\n                }\n                else {\n                    error(node, ts.Diagnostics.Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference);\n                }\n            }\n        }\n        function checkCollisionWithRequireExportsInGeneratedCode(node, name) {\n            // No need to check for require or exports for ES6 modules and later\n            if (modulekind >= ts.ModuleKind.ES2015) {\n                return;\n            }\n            if (!needCollisionCheckForIdentifier(node, name, \"require\") && !needCollisionCheckForIdentifier(node, name, \"exports\")) {\n                return;\n            }\n            // Uninstantiated modules shouldnt do this check\n            if (node.kind === 230 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) {\n                return;\n            }\n            // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent\n            var parent = getDeclarationContainer(node);\n            if (parent.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) {\n                // If the declaration happens to be in external module, report error that require and exports are reserved keywords\n                error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name));\n            }\n        }\n        function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) {\n            if (languageVersion >= 4 /* ES2017 */ || !needCollisionCheckForIdentifier(node, name, \"Promise\")) {\n                return;\n            }\n            // Uninstantiated modules shouldnt do this check\n            if (node.kind === 230 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) {\n                return;\n            }\n            // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent\n            var parent = getDeclarationContainer(node);\n            if (parent.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) {\n                // If the declaration happens to be in external module, report error that Promise is a reserved identifier.\n                error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name));\n            }\n        }\n        function checkVarDeclaredNamesNotShadowed(node) {\n            // - ScriptBody : StatementList\n            // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList\n            // also occurs in the VarDeclaredNames of StatementList.\n            // - Block : { StatementList }\n            // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList\n            // also occurs in the VarDeclaredNames of StatementList.\n            // Variable declarations are hoisted to the top of their function scope. They can shadow\n            // block scoped declarations, which bind tighter. this will not be flagged as duplicate definition\n            // by the binder as the declaration scope is different.\n            // A non-initialized declaration is a no-op as the block declaration will resolve before the var\n            // declaration. the problem is if the declaration has an initializer. this will act as a write to the\n            // block declared value. this is fine for let, but not const.\n            // Only consider declarations with initializers, uninitialized const declarations will not\n            // step on a let/const variable.\n            // Do not consider const and const declarations, as duplicate block-scoped declarations\n            // are handled by the binder.\n            // We are only looking for const declarations that step on let\\const declarations from a\n            // different scope. e.g.:\n            //      {\n            //          const x = 0; // localDeclarationSymbol obtained after name resolution will correspond to this declaration\n            //          const x = 0; // symbol for this declaration will be 'symbol'\n            //      }\n            // skip block-scoped variables and parameters\n            if ((ts.getCombinedNodeFlags(node) & 3 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) {\n                return;\n            }\n            // skip variable declarations that don't have initializers\n            // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern\n            // so we'll always treat binding elements as initialized\n            if (node.kind === 223 /* VariableDeclaration */ && !node.initializer) {\n                return;\n            }\n            var symbol = getSymbolOfNode(node);\n            if (symbol.flags & 1 /* FunctionScopedVariable */) {\n                var localDeclarationSymbol = resolveName(node, node.name.text, 3 /* Variable */, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined);\n                if (localDeclarationSymbol &&\n                    localDeclarationSymbol !== symbol &&\n                    localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) {\n                    if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) {\n                        var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 224 /* VariableDeclarationList */);\n                        var container = varDeclList.parent.kind === 205 /* VariableStatement */ && varDeclList.parent.parent\n                            ? varDeclList.parent.parent\n                            : undefined;\n                        // names of block-scoped and function scoped variables can collide only\n                        // if block scoped variable is defined in the function\\module\\source file scope (because of variable hoisting)\n                        var namesShareScope = container &&\n                            (container.kind === 204 /* Block */ && ts.isFunctionLike(container.parent) ||\n                                container.kind === 231 /* ModuleBlock */ ||\n                                container.kind === 230 /* ModuleDeclaration */ ||\n                                container.kind === 261 /* SourceFile */);\n                        // here we know that function scoped variable is shadowed by block scoped one\n                        // if they are defined in the same scope - binder has already reported redeclaration error\n                        // otherwise if variable has an initializer - show error that initialization will fail\n                        // since LHS will be block scoped name instead of function scoped\n                        if (!namesShareScope) {\n                            var name_23 = symbolToString(localDeclarationSymbol);\n                            error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_23, name_23);\n                        }\n                    }\n                }\n            }\n        }\n        // Check that a parameter initializer contains no references to parameters declared to the right of itself\n        function checkParameterInitializer(node) {\n            if (ts.getRootDeclaration(node).kind !== 144 /* Parameter */) {\n                return;\n            }\n            var func = ts.getContainingFunction(node);\n            visit(node.initializer);\n            function visit(n) {\n                if (ts.isTypeNode(n) || ts.isDeclarationName(n)) {\n                    // do not dive in types\n                    // skip declaration names (i.e. in object literal expressions)\n                    return;\n                }\n                if (n.kind === 177 /* PropertyAccessExpression */) {\n                    // skip property names in property access expression\n                    return visit(n.expression);\n                }\n                else if (n.kind === 70 /* Identifier */) {\n                    // check FunctionLikeDeclaration.locals (stores parameters\\function local variable)\n                    // if it contains entry with a specified name\n                    var symbol = resolveName(n, n.text, 107455 /* Value */ | 8388608 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);\n                    if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) {\n                        return;\n                    }\n                    if (symbol.valueDeclaration === node) {\n                        error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name));\n                        return;\n                    }\n                    // locals map for function contain both parameters and function locals\n                    // so we need to do a bit of extra work to check if reference is legal\n                    var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);\n                    if (enclosingContainer === func) {\n                        if (symbol.valueDeclaration.kind === 144 /* Parameter */) {\n                            // it is ok to reference parameter in initializer if either\n                            // - parameter is located strictly on the left of current parameter declaration\n                            if (symbol.valueDeclaration.pos < node.pos) {\n                                return;\n                            }\n                            // - parameter is wrapped in function-like entity\n                            var current = n;\n                            while (current !== node.initializer) {\n                                if (ts.isFunctionLike(current.parent)) {\n                                    return;\n                                }\n                                // computed property names/initializers in instance property declaration of class like entities\n                                // are executed in constructor and thus deferred\n                                if (current.parent.kind === 147 /* PropertyDeclaration */ &&\n                                    !(ts.hasModifier(current.parent, 32 /* Static */)) &&\n                                    ts.isClassLike(current.parent.parent)) {\n                                    return;\n                                }\n                                current = current.parent;\n                            }\n                        }\n                        error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n));\n                    }\n                }\n                else {\n                    return ts.forEachChild(n, visit);\n                }\n            }\n        }\n        function convertAutoToAny(type) {\n            return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type;\n        }\n        // Check variable, parameter, or property declaration\n        function checkVariableLikeDeclaration(node) {\n            checkDecorators(node);\n            checkSourceElement(node.type);\n            // For a computed property, just check the initializer and exit\n            // Do not use hasDynamicName here, because that returns false for well known symbols.\n            // We want to perform checkComputedPropertyName for all computed properties, including\n            // well known symbols.\n            if (node.name.kind === 142 /* ComputedPropertyName */) {\n                checkComputedPropertyName(node.name);\n                if (node.initializer) {\n                    checkExpressionCached(node.initializer);\n                }\n            }\n            if (node.kind === 174 /* BindingElement */) {\n                if (node.parent.kind === 172 /* ObjectBindingPattern */ && languageVersion < 5 /* ESNext */) {\n                    checkExternalEmitHelpers(node, 4 /* Rest */);\n                }\n                // check computed properties inside property names of binding elements\n                if (node.propertyName && node.propertyName.kind === 142 /* ComputedPropertyName */) {\n                    checkComputedPropertyName(node.propertyName);\n                }\n                // check private/protected variable access\n                var parent_10 = node.parent.parent;\n                var parentType = getTypeForBindingElementParent(parent_10);\n                var name_24 = node.propertyName || node.name;\n                var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_24));\n                markPropertyAsReferenced(property);\n                if (parent_10.initializer && property && getParentOfSymbol(property)) {\n                    checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property);\n                }\n            }\n            // For a binding pattern, check contained binding elements\n            if (ts.isBindingPattern(node.name)) {\n                ts.forEach(node.name.elements, checkSourceElement);\n            }\n            // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body\n            if (node.initializer && ts.getRootDeclaration(node).kind === 144 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {\n                error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);\n                return;\n            }\n            // For a binding pattern, validate the initializer and exit\n            if (ts.isBindingPattern(node.name)) {\n                // Don't validate for-in initializer as it is already an error\n                if (node.initializer && node.parent.parent.kind !== 212 /* ForInStatement */) {\n                    checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined);\n                    checkParameterInitializer(node);\n                }\n                return;\n            }\n            var symbol = getSymbolOfNode(node);\n            var type = convertAutoToAny(getTypeOfVariableOrParameterOrProperty(symbol));\n            if (node === symbol.valueDeclaration) {\n                // Node is the primary declaration of the symbol, just validate the initializer\n                // Don't validate for-in initializer as it is already an error\n                if (node.initializer && node.parent.parent.kind !== 212 /* ForInStatement */) {\n                    checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, /*headMessage*/ undefined);\n                    checkParameterInitializer(node);\n                }\n            }\n            else {\n                // Node is a secondary declaration, check that type is identical to primary declaration and check that\n                // initializer is consistent with type associated with the node\n                var declarationType = convertAutoToAny(getWidenedTypeForVariableLikeDeclaration(node));\n                if (type !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(type, declarationType)) {\n                    error(node.name, ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, ts.declarationNameToString(node.name), typeToString(type), typeToString(declarationType));\n                }\n                if (node.initializer) {\n                    checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined);\n                }\n                if (!areDeclarationFlagsIdentical(node, symbol.valueDeclaration)) {\n                    error(symbol.valueDeclaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name));\n                    error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name));\n                }\n            }\n            if (node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 146 /* PropertySignature */) {\n                // We know we don't have a binding pattern or computed name here\n                checkExportsOnMergedDeclarations(node);\n                if (node.kind === 223 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */) {\n                    checkVarDeclaredNamesNotShadowed(node);\n                }\n                checkCollisionWithCapturedSuperVariable(node, node.name);\n                checkCollisionWithCapturedThisVariable(node, node.name);\n                checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n                checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n            }\n        }\n        function areDeclarationFlagsIdentical(left, right) {\n            if ((left.kind === 144 /* Parameter */ && right.kind === 223 /* VariableDeclaration */) ||\n                (left.kind === 223 /* VariableDeclaration */ && right.kind === 144 /* Parameter */)) {\n                // Differences in optionality between parameters and variables are allowed.\n                return true;\n            }\n            if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) {\n                return false;\n            }\n            var interestingFlags = 8 /* Private */ |\n                16 /* Protected */ |\n                256 /* Async */ |\n                128 /* Abstract */ |\n                64 /* Readonly */ |\n                32 /* Static */;\n            return (ts.getModifierFlags(left) & interestingFlags) === (ts.getModifierFlags(right) & interestingFlags);\n        }\n        function checkVariableDeclaration(node) {\n            checkGrammarVariableDeclaration(node);\n            return checkVariableLikeDeclaration(node);\n        }\n        function checkBindingElement(node) {\n            checkGrammarBindingElement(node);\n            return checkVariableLikeDeclaration(node);\n        }\n        function checkVariableStatement(node) {\n            // Grammar checking\n            checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarVariableDeclarationList(node.declarationList) || checkGrammarForDisallowedLetOrConstStatement(node);\n            ts.forEach(node.declarationList.declarations, checkSourceElement);\n        }\n        function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) {\n            // We only disallow modifier on a method declaration if it is a property of object-literal-expression\n            if (node.modifiers && node.parent.kind === 176 /* ObjectLiteralExpression */) {\n                if (ts.isAsyncFunctionLike(node)) {\n                    if (node.modifiers.length > 1) {\n                        return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here);\n                    }\n                }\n                else {\n                    return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here);\n                }\n            }\n        }\n        function checkExpressionStatement(node) {\n            // Grammar checking\n            checkGrammarStatementInAmbientContext(node);\n            checkExpression(node.expression);\n        }\n        function checkIfStatement(node) {\n            // Grammar checking\n            checkGrammarStatementInAmbientContext(node);\n            checkExpression(node.expression);\n            checkSourceElement(node.thenStatement);\n            if (node.thenStatement.kind === 206 /* EmptyStatement */) {\n                error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);\n            }\n            checkSourceElement(node.elseStatement);\n        }\n        function checkDoStatement(node) {\n            // Grammar checking\n            checkGrammarStatementInAmbientContext(node);\n            checkSourceElement(node.statement);\n            checkExpression(node.expression);\n        }\n        function checkWhileStatement(node) {\n            // Grammar checking\n            checkGrammarStatementInAmbientContext(node);\n            checkExpression(node.expression);\n            checkSourceElement(node.statement);\n        }\n        function checkForStatement(node) {\n            // Grammar checking\n            if (!checkGrammarStatementInAmbientContext(node)) {\n                if (node.initializer && node.initializer.kind === 224 /* VariableDeclarationList */) {\n                    checkGrammarVariableDeclarationList(node.initializer);\n                }\n            }\n            if (node.initializer) {\n                if (node.initializer.kind === 224 /* VariableDeclarationList */) {\n                    ts.forEach(node.initializer.declarations, checkVariableDeclaration);\n                }\n                else {\n                    checkExpression(node.initializer);\n                }\n            }\n            if (node.condition)\n                checkExpression(node.condition);\n            if (node.incrementor)\n                checkExpression(node.incrementor);\n            checkSourceElement(node.statement);\n            if (node.locals) {\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkForOfStatement(node) {\n            checkGrammarForInOrForOfStatement(node);\n            // Check the LHS and RHS\n            // If the LHS is a declaration, just check it as a variable declaration, which will in turn check the RHS\n            // via checkRightHandSideOfForOf.\n            // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference.\n            // Then check that the RHS is assignable to it.\n            if (node.initializer.kind === 224 /* VariableDeclarationList */) {\n                checkForInOrForOfVariableDeclaration(node);\n            }\n            else {\n                var varExpr = node.initializer;\n                var iteratedType = checkRightHandSideOfForOf(node.expression);\n                // There may be a destructuring assignment on the left side\n                if (varExpr.kind === 175 /* ArrayLiteralExpression */ || varExpr.kind === 176 /* ObjectLiteralExpression */) {\n                    // iteratedType may be undefined. In this case, we still want to check the structure of\n                    // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like\n                    // to short circuit the type relation checking as much as possible, so we pass the unknownType.\n                    checkDestructuringAssignment(varExpr, iteratedType || unknownType);\n                }\n                else {\n                    var leftType = checkExpression(varExpr);\n                    checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access);\n                    // iteratedType will be undefined if the rightType was missing properties/signatures\n                    // required to get its iteratedType (like [Symbol.iterator] or next). This may be\n                    // because we accessed properties from anyType, or it may have led to an error inside\n                    // getElementTypeOfIterable.\n                    if (iteratedType) {\n                        checkTypeAssignableTo(iteratedType, leftType, varExpr, /*headMessage*/ undefined);\n                    }\n                }\n            }\n            checkSourceElement(node.statement);\n            if (node.locals) {\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkForInStatement(node) {\n            // Grammar checking\n            checkGrammarForInOrForOfStatement(node);\n            var rightType = checkNonNullExpression(node.expression);\n            // TypeScript 1.0 spec  (April 2014): 5.4\n            // In a 'for-in' statement of the form\n            // for (let VarDecl in Expr) Statement\n            //   VarDecl must be a variable declaration without a type annotation that declares a variable of type Any,\n            //   and Expr must be an expression of type Any, an object type, or a type parameter type.\n            if (node.initializer.kind === 224 /* VariableDeclarationList */) {\n                var variable = node.initializer.declarations[0];\n                if (variable && ts.isBindingPattern(variable.name)) {\n                    error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);\n                }\n                checkForInOrForOfVariableDeclaration(node);\n            }\n            else {\n                // In a 'for-in' statement of the form\n                // for (Var in Expr) Statement\n                //   Var must be an expression classified as a reference of type Any or the String primitive type,\n                //   and Expr must be an expression of type Any, an object type, or a type parameter type.\n                var varExpr = node.initializer;\n                var leftType = checkExpression(varExpr);\n                if (varExpr.kind === 175 /* ArrayLiteralExpression */ || varExpr.kind === 176 /* ObjectLiteralExpression */) {\n                    error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);\n                }\n                else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {\n                    error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any);\n                }\n                else {\n                    // run check only former check succeeded to avoid cascading errors\n                    checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access);\n                }\n            }\n            // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved\n            // in this case error about missing name is already reported - do not report extra one\n            if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 540672 /* TypeVariable */)) {\n                error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter);\n            }\n            checkSourceElement(node.statement);\n            if (node.locals) {\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkForInOrForOfVariableDeclaration(iterationStatement) {\n            var variableDeclarationList = iterationStatement.initializer;\n            // checkGrammarForInOrForOfStatement will check that there is exactly one declaration.\n            if (variableDeclarationList.declarations.length >= 1) {\n                var decl = variableDeclarationList.declarations[0];\n                checkVariableDeclaration(decl);\n            }\n        }\n        function checkRightHandSideOfForOf(rhsExpression) {\n            var expressionType = checkNonNullExpression(rhsExpression);\n            return checkIteratedTypeOrElementType(expressionType, rhsExpression, /*allowStringInput*/ true);\n        }\n        function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) {\n            if (isTypeAny(inputType)) {\n                return inputType;\n            }\n            if (languageVersion >= 2 /* ES2015 */) {\n                return checkElementTypeOfIterable(inputType, errorNode);\n            }\n            if (allowStringInput) {\n                return checkElementTypeOfArrayOrString(inputType, errorNode);\n            }\n            if (isArrayLikeType(inputType)) {\n                var indexType = getIndexTypeOfType(inputType, 1 /* Number */);\n                if (indexType) {\n                    return indexType;\n                }\n            }\n            if (errorNode) {\n                error(errorNode, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType));\n            }\n            return unknownType;\n        }\n        /**\n         * When errorNode is undefined, it means we should not report any errors.\n         */\n        function checkElementTypeOfIterable(iterable, errorNode) {\n            var elementType = getElementTypeOfIterable(iterable, errorNode);\n            // Now even though we have extracted the iteratedType, we will have to validate that the type\n            // passed in is actually an Iterable.\n            if (errorNode && elementType) {\n                checkTypeAssignableTo(iterable, createIterableType(elementType), errorNode);\n            }\n            return elementType || anyType;\n        }\n        /**\n         * We want to treat type as an iterable, and get the type it is an iterable of. The iterable\n         * must have the following structure (annotated with the names of the variables below):\n         *\n         * { // iterable\n         *     [Symbol.iterator]: { // iteratorFunction\n         *         (): Iterator<T>\n         *     }\n         * }\n         *\n         * T is the type we are after. At every level that involves analyzing return types\n         * of signatures, we union the return types of all the signatures.\n         *\n         * Another thing to note is that at any step of this process, we could run into a dead end,\n         * meaning either the property is missing, or we run into the anyType. If either of these things\n         * happens, we return undefined to signal that we could not find the iterated type. If a property\n         * is missing, and the previous step did not result in 'any', then we also give an error if the\n         * caller requested it. Then the caller can decide what to do in the case where there is no iterated\n         * type. This is different from returning anyType, because that would signify that we have matched the\n         * whole pattern and that T (above) is 'any'.\n         */\n        function getElementTypeOfIterable(type, errorNode) {\n            if (isTypeAny(type)) {\n                return undefined;\n            }\n            var typeAsIterable = type;\n            if (!typeAsIterable.iterableElementType) {\n                // As an optimization, if the type is instantiated directly using the globalIterableType (Iterable<number>),\n                // then just grab its type argument.\n                if ((getObjectFlags(type) & 4 /* Reference */) && type.target === getGlobalIterableType()) {\n                    typeAsIterable.iterableElementType = type.typeArguments[0];\n                }\n                else {\n                    var iteratorFunction = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName(\"iterator\"));\n                    if (isTypeAny(iteratorFunction)) {\n                        return undefined;\n                    }\n                    var iteratorFunctionSignatures = iteratorFunction ? getSignaturesOfType(iteratorFunction, 0 /* Call */) : emptyArray;\n                    if (iteratorFunctionSignatures.length === 0) {\n                        if (errorNode) {\n                            error(errorNode, ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator);\n                        }\n                        return undefined;\n                    }\n                    typeAsIterable.iterableElementType = getElementTypeOfIterator(getUnionType(ts.map(iteratorFunctionSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true), errorNode);\n                }\n            }\n            return typeAsIterable.iterableElementType;\n        }\n        /**\n         * This function has very similar logic as getElementTypeOfIterable, except that it operates on\n         * Iterators instead of Iterables. Here is the structure:\n         *\n         *  { // iterator\n         *      next: { // iteratorNextFunction\n         *          (): { // iteratorNextResult\n         *              value: T // iteratorNextValue\n         *          }\n         *      }\n         *  }\n         *\n         */\n        function getElementTypeOfIterator(type, errorNode) {\n            if (isTypeAny(type)) {\n                return undefined;\n            }\n            var typeAsIterator = type;\n            if (!typeAsIterator.iteratorElementType) {\n                // As an optimization, if the type is instantiated directly using the globalIteratorType (Iterator<number>),\n                // then just grab its type argument.\n                if ((getObjectFlags(type) & 4 /* Reference */) && type.target === getGlobalIteratorType()) {\n                    typeAsIterator.iteratorElementType = type.typeArguments[0];\n                }\n                else {\n                    var iteratorNextFunction = getTypeOfPropertyOfType(type, \"next\");\n                    if (isTypeAny(iteratorNextFunction)) {\n                        return undefined;\n                    }\n                    var iteratorNextFunctionSignatures = iteratorNextFunction ? getSignaturesOfType(iteratorNextFunction, 0 /* Call */) : emptyArray;\n                    if (iteratorNextFunctionSignatures.length === 0) {\n                        if (errorNode) {\n                            error(errorNode, ts.Diagnostics.An_iterator_must_have_a_next_method);\n                        }\n                        return undefined;\n                    }\n                    var iteratorNextResult = getUnionType(ts.map(iteratorNextFunctionSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true);\n                    if (isTypeAny(iteratorNextResult)) {\n                        return undefined;\n                    }\n                    var iteratorNextValue = getTypeOfPropertyOfType(iteratorNextResult, \"value\");\n                    if (!iteratorNextValue) {\n                        if (errorNode) {\n                            error(errorNode, ts.Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property);\n                        }\n                        return undefined;\n                    }\n                    typeAsIterator.iteratorElementType = iteratorNextValue;\n                }\n            }\n            return typeAsIterator.iteratorElementType;\n        }\n        function getElementTypeOfIterableIterator(type) {\n            if (isTypeAny(type)) {\n                return undefined;\n            }\n            // As an optimization, if the type is instantiated directly using the globalIterableIteratorType (IterableIterator<number>),\n            // then just grab its type argument.\n            if ((getObjectFlags(type) & 4 /* Reference */) && type.target === getGlobalIterableIteratorType()) {\n                return type.typeArguments[0];\n            }\n            return getElementTypeOfIterable(type, /*errorNode*/ undefined) ||\n                getElementTypeOfIterator(type, /*errorNode*/ undefined);\n        }\n        /**\n         * This function does the following steps:\n         *   1. Break up arrayOrStringType (possibly a union) into its string constituents and array constituents.\n         *   2. Take the element types of the array constituents.\n         *   3. Return the union of the element types, and string if there was a string constituent.\n         *\n         * For example:\n         *     string -> string\n         *     number[] -> number\n         *     string[] | number[] -> string | number\n         *     string | number[] -> string | number\n         *     string | string[] | number[] -> string | number\n         *\n         * It also errors if:\n         *   1. Some constituent is neither a string nor an array.\n         *   2. Some constituent is a string and target is less than ES5 (because in ES3 string is not indexable).\n         */\n        function checkElementTypeOfArrayOrString(arrayOrStringType, errorNode) {\n            ts.Debug.assert(languageVersion < 2 /* ES2015 */);\n            var arrayType = arrayOrStringType;\n            if (arrayOrStringType.flags & 65536 /* Union */) {\n                // After we remove all types that are StringLike, we will know if there was a string constituent\n                // based on whether the result of filter is a new array.\n                var arrayTypes = arrayOrStringType.types;\n                var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178 /* StringLike */); });\n                if (filteredTypes !== arrayTypes) {\n                    arrayType = getUnionType(filteredTypes, /*subtypeReduction*/ true);\n                }\n            }\n            else if (arrayOrStringType.flags & 262178 /* StringLike */) {\n                arrayType = neverType;\n            }\n            var hasStringConstituent = arrayOrStringType !== arrayType;\n            var reportedError = false;\n            if (hasStringConstituent) {\n                if (languageVersion < 1 /* ES5 */) {\n                    error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher);\n                    reportedError = true;\n                }\n                // Now that we've removed all the StringLike types, if no constituents remain, then the entire\n                // arrayOrStringType was a string.\n                if (arrayType.flags & 8192 /* Never */) {\n                    return stringType;\n                }\n            }\n            if (!isArrayLikeType(arrayType)) {\n                if (!reportedError) {\n                    // Which error we report depends on whether there was a string constituent. For example,\n                    // if the input type is number | string, we want to say that number is not an array type.\n                    // But if the input was just number, we want to say that number is not an array type\n                    // or a string type.\n                    var diagnostic = hasStringConstituent\n                        ? ts.Diagnostics.Type_0_is_not_an_array_type\n                        : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type;\n                    error(errorNode, diagnostic, typeToString(arrayType));\n                }\n                return hasStringConstituent ? stringType : unknownType;\n            }\n            var arrayElementType = getIndexTypeOfType(arrayType, 1 /* Number */) || unknownType;\n            if (hasStringConstituent) {\n                // This is just an optimization for the case where arrayOrStringType is string | string[]\n                if (arrayElementType.flags & 262178 /* StringLike */) {\n                    return stringType;\n                }\n                return getUnionType([arrayElementType, stringType], /*subtypeReduction*/ true);\n            }\n            return arrayElementType;\n        }\n        function checkBreakOrContinueStatement(node) {\n            // Grammar checking\n            checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node);\n            // TODO: Check that target label is valid\n        }\n        function isGetAccessorWithAnnotatedSetAccessor(node) {\n            return !!(node.kind === 151 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 152 /* SetAccessor */)));\n        }\n        function isUnwrappedReturnTypeVoidOrAny(func, returnType) {\n            var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType;\n            return unwrappedReturnType && maybeTypeOfKind(unwrappedReturnType, 1024 /* Void */ | 1 /* Any */);\n        }\n        function checkReturnStatement(node) {\n            // Grammar checking\n            if (!checkGrammarStatementInAmbientContext(node)) {\n                var functionBlock = ts.getContainingFunction(node);\n                if (!functionBlock) {\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body);\n                }\n            }\n            var func = ts.getContainingFunction(node);\n            if (func) {\n                var signature = getSignatureFromDeclaration(func);\n                var returnType = getReturnTypeOfSignature(signature);\n                if (strictNullChecks || node.expression || returnType.flags & 8192 /* Never */) {\n                    var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType;\n                    if (func.asteriskToken) {\n                        // A generator does not need its return expressions checked against its return type.\n                        // Instead, the yield expressions are checked against the element type.\n                        // TODO: Check return expressions of generators when return type tracking is added\n                        // for generators.\n                        return;\n                    }\n                    if (func.kind === 152 /* SetAccessor */) {\n                        if (node.expression) {\n                            error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value);\n                        }\n                    }\n                    else if (func.kind === 150 /* Constructor */) {\n                        if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) {\n                            error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);\n                        }\n                    }\n                    else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) {\n                        if (ts.isAsyncFunctionLike(func)) {\n                            var promisedType = getPromisedType(returnType);\n                            var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member);\n                            if (promisedType) {\n                                // If the function has a return type, but promisedType is\n                                // undefined, an error will be reported in checkAsyncFunctionReturnType\n                                // so we don't need to report one here.\n                                checkTypeAssignableTo(awaitedType, promisedType, node.expression || node);\n                            }\n                        }\n                        else {\n                            checkTypeAssignableTo(exprType, returnType, node.expression || node);\n                        }\n                    }\n                }\n                else if (func.kind !== 150 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) {\n                    // The function has a return type, but the return statement doesn't have an expression.\n                    error(node, ts.Diagnostics.Not_all_code_paths_return_a_value);\n                }\n            }\n        }\n        function checkWithStatement(node) {\n            // Grammar checking for withStatement\n            if (!checkGrammarStatementInAmbientContext(node)) {\n                if (node.flags & 16384 /* AwaitContext */) {\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block);\n                }\n            }\n            checkExpression(node.expression);\n            var sourceFile = ts.getSourceFileOfNode(node);\n            if (!hasParseDiagnostics(sourceFile)) {\n                var start = ts.getSpanOfTokenAtPosition(sourceFile, node.pos).start;\n                var end = node.statement.pos;\n                grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any);\n            }\n        }\n        function checkSwitchStatement(node) {\n            // Grammar checking\n            checkGrammarStatementInAmbientContext(node);\n            var firstDefaultClause;\n            var hasDuplicateDefaultClause = false;\n            var expressionType = checkExpression(node.expression);\n            var expressionIsLiteral = isLiteralType(expressionType);\n            ts.forEach(node.caseBlock.clauses, function (clause) {\n                // Grammar check for duplicate default clauses, skip if we already report duplicate default clause\n                if (clause.kind === 254 /* DefaultClause */ && !hasDuplicateDefaultClause) {\n                    if (firstDefaultClause === undefined) {\n                        firstDefaultClause = clause;\n                    }\n                    else {\n                        var sourceFile = ts.getSourceFileOfNode(node);\n                        var start = ts.skipTrivia(sourceFile.text, clause.pos);\n                        var end = clause.statements.length > 0 ? clause.statements[0].pos : clause.end;\n                        grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement);\n                        hasDuplicateDefaultClause = true;\n                    }\n                }\n                if (produceDiagnostics && clause.kind === 253 /* CaseClause */) {\n                    var caseClause = clause;\n                    // TypeScript 1.0 spec (April 2014): 5.9\n                    // In a 'switch' statement, each 'case' expression must be of a type that is comparable\n                    // to or from the type of the 'switch' expression.\n                    var caseType = checkExpression(caseClause.expression);\n                    var caseIsLiteral = isLiteralType(caseType);\n                    var comparedExpressionType = expressionType;\n                    if (!caseIsLiteral || !expressionIsLiteral) {\n                        caseType = caseIsLiteral ? getBaseTypeOfLiteralType(caseType) : caseType;\n                        comparedExpressionType = getBaseTypeOfLiteralType(expressionType);\n                    }\n                    if (!isTypeEqualityComparableTo(comparedExpressionType, caseType)) {\n                        // expressionType is not comparable to caseType, try the reversed check and report errors if it fails\n                        checkTypeComparableTo(caseType, comparedExpressionType, caseClause.expression, /*headMessage*/ undefined);\n                    }\n                }\n                ts.forEach(clause.statements, checkSourceElement);\n            });\n            if (node.caseBlock.locals) {\n                registerForUnusedIdentifiersCheck(node.caseBlock);\n            }\n        }\n        function checkLabeledStatement(node) {\n            // Grammar checking\n            if (!checkGrammarStatementInAmbientContext(node)) {\n                var current = node.parent;\n                while (current) {\n                    if (ts.isFunctionLike(current)) {\n                        break;\n                    }\n                    if (current.kind === 219 /* LabeledStatement */ && current.label.text === node.label.text) {\n                        var sourceFile = ts.getSourceFileOfNode(node);\n                        grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label));\n                        break;\n                    }\n                    current = current.parent;\n                }\n            }\n            // ensure that label is unique\n            checkSourceElement(node.statement);\n        }\n        function checkThrowStatement(node) {\n            // Grammar checking\n            if (!checkGrammarStatementInAmbientContext(node)) {\n                if (node.expression === undefined) {\n                    grammarErrorAfterFirstToken(node, ts.Diagnostics.Line_break_not_permitted_here);\n                }\n            }\n            if (node.expression) {\n                checkExpression(node.expression);\n            }\n        }\n        function checkTryStatement(node) {\n            // Grammar checking\n            checkGrammarStatementInAmbientContext(node);\n            checkBlock(node.tryBlock);\n            var catchClause = node.catchClause;\n            if (catchClause) {\n                // Grammar checking\n                if (catchClause.variableDeclaration) {\n                    if (catchClause.variableDeclaration.type) {\n                        grammarErrorOnFirstToken(catchClause.variableDeclaration.type, ts.Diagnostics.Catch_clause_variable_cannot_have_a_type_annotation);\n                    }\n                    else if (catchClause.variableDeclaration.initializer) {\n                        grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer);\n                    }\n                    else {\n                        var blockLocals = catchClause.block.locals;\n                        if (blockLocals) {\n                            for (var caughtName in catchClause.locals) {\n                                var blockLocal = blockLocals[caughtName];\n                                if (blockLocal && (blockLocal.flags & 2 /* BlockScopedVariable */) !== 0) {\n                                    grammarErrorOnNode(blockLocal.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName);\n                                }\n                            }\n                        }\n                    }\n                }\n                checkBlock(catchClause.block);\n            }\n            if (node.finallyBlock) {\n                checkBlock(node.finallyBlock);\n            }\n        }\n        function checkIndexConstraints(type) {\n            var declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, 1 /* Number */);\n            var declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, 0 /* String */);\n            var stringIndexType = getIndexTypeOfType(type, 0 /* String */);\n            var numberIndexType = getIndexTypeOfType(type, 1 /* Number */);\n            if (stringIndexType || numberIndexType) {\n                ts.forEach(getPropertiesOfObjectType(type), function (prop) {\n                    var propType = getTypeOfSymbol(prop);\n                    checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */);\n                    checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */);\n                });\n                if (getObjectFlags(type) & 1 /* Class */ && ts.isClassLike(type.symbol.valueDeclaration)) {\n                    var classDeclaration = type.symbol.valueDeclaration;\n                    for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) {\n                        var member = _a[_i];\n                        // Only process instance properties with computed names here.\n                        // Static properties cannot be in conflict with indexers,\n                        // and properties with literal names were already checked.\n                        if (!(ts.getModifierFlags(member) & 32 /* Static */) && ts.hasDynamicName(member)) {\n                            var propType = getTypeOfSymbol(member.symbol);\n                            checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */);\n                            checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */);\n                        }\n                    }\n                }\n            }\n            var errorNode;\n            if (stringIndexType && numberIndexType) {\n                errorNode = declaredNumberIndexer || declaredStringIndexer;\n                // condition 'errorNode === undefined' may appear if types does not declare nor string neither number indexer\n                if (!errorNode && (getObjectFlags(type) & 2 /* Interface */)) {\n                    var someBaseTypeHasBothIndexers = ts.forEach(getBaseTypes(type), function (base) { return getIndexTypeOfType(base, 0 /* String */) && getIndexTypeOfType(base, 1 /* Number */); });\n                    errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0];\n                }\n            }\n            if (errorNode && !isTypeAssignableTo(numberIndexType, stringIndexType)) {\n                error(errorNode, ts.Diagnostics.Numeric_index_type_0_is_not_assignable_to_string_index_type_1, typeToString(numberIndexType), typeToString(stringIndexType));\n            }\n            function checkIndexConstraintForProperty(prop, propertyType, containingType, indexDeclaration, indexType, indexKind) {\n                if (!indexType) {\n                    return;\n                }\n                // index is numeric and property name is not valid numeric literal\n                if (indexKind === 1 /* Number */ && !isNumericName(prop.valueDeclaration.name)) {\n                    return;\n                }\n                // perform property check if property or indexer is declared in 'type'\n                // this allows to rule out cases when both property and indexer are inherited from the base class\n                var errorNode;\n                if (prop.valueDeclaration.name.kind === 142 /* ComputedPropertyName */ || prop.parent === containingType.symbol) {\n                    errorNode = prop.valueDeclaration;\n                }\n                else if (indexDeclaration) {\n                    errorNode = indexDeclaration;\n                }\n                else if (getObjectFlags(containingType) & 2 /* Interface */) {\n                    // for interfaces property and indexer might be inherited from different bases\n                    // check if any base class already has both property and indexer.\n                    // check should be performed only if 'type' is the first type that brings property\\indexer together\n                    var someBaseClassHasBothPropertyAndIndexer = ts.forEach(getBaseTypes(containingType), function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); });\n                    errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0];\n                }\n                if (errorNode && !isTypeAssignableTo(propertyType, indexType)) {\n                    var errorMessage = indexKind === 0 /* String */\n                        ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2\n                        : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2;\n                    error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType));\n                }\n            }\n        }\n        function checkTypeNameIsReserved(name, message) {\n            // TS 1.0 spec (April 2014): 3.6.1\n            // The predefined type keywords are reserved and cannot be used as names of user defined types.\n            switch (name.text) {\n                case \"any\":\n                case \"number\":\n                case \"boolean\":\n                case \"string\":\n                case \"symbol\":\n                case \"void\":\n                    error(name, message, name.text);\n            }\n        }\n        /** Check each type parameter and check that type parameters have no duplicate type parameter declarations */\n        function checkTypeParameters(typeParameterDeclarations) {\n            if (typeParameterDeclarations) {\n                for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) {\n                    var node = typeParameterDeclarations[i];\n                    checkTypeParameter(node);\n                    if (produceDiagnostics) {\n                        for (var j = 0; j < i; j++) {\n                            if (typeParameterDeclarations[j].symbol === node.symbol) {\n                                error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name));\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        /** Check that type parameter lists are identical across multiple declarations */\n        function checkTypeParameterListsIdentical(node, symbol) {\n            if (symbol.declarations.length === 1) {\n                return;\n            }\n            var firstDecl;\n            for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                var declaration = _a[_i];\n                if (declaration.kind === 226 /* ClassDeclaration */ || declaration.kind === 227 /* InterfaceDeclaration */) {\n                    if (!firstDecl) {\n                        firstDecl = declaration;\n                    }\n                    else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) {\n                        error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text);\n                    }\n                }\n            }\n        }\n        function checkClassExpression(node) {\n            checkClassLikeDeclaration(node);\n            checkNodeDeferred(node);\n            return getTypeOfSymbol(getSymbolOfNode(node));\n        }\n        function checkClassExpressionDeferred(node) {\n            ts.forEach(node.members, checkSourceElement);\n            registerForUnusedIdentifiersCheck(node);\n        }\n        function checkClassDeclaration(node) {\n            if (!node.name && !(ts.getModifierFlags(node) & 512 /* Default */)) {\n                grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name);\n            }\n            checkClassLikeDeclaration(node);\n            ts.forEach(node.members, checkSourceElement);\n            registerForUnusedIdentifiersCheck(node);\n        }\n        function checkClassLikeDeclaration(node) {\n            checkGrammarClassDeclarationHeritageClauses(node);\n            checkDecorators(node);\n            if (node.name) {\n                checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0);\n                checkCollisionWithCapturedThisVariable(node, node.name);\n                checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n                checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n            }\n            checkTypeParameters(node.typeParameters);\n            checkExportsOnMergedDeclarations(node);\n            var symbol = getSymbolOfNode(node);\n            var type = getDeclaredTypeOfSymbol(symbol);\n            var typeWithThis = getTypeWithThisArgument(type);\n            var staticType = getTypeOfSymbol(symbol);\n            checkTypeParameterListsIdentical(node, symbol);\n            checkClassForDuplicateDeclarations(node);\n            var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node);\n            if (baseTypeNode) {\n                if (languageVersion < 2 /* ES2015 */) {\n                    checkExternalEmitHelpers(baseTypeNode.parent, 1 /* Extends */);\n                }\n                var baseTypes = getBaseTypes(type);\n                if (baseTypes.length && produceDiagnostics) {\n                    var baseType_1 = baseTypes[0];\n                    var staticBaseType = getBaseConstructorTypeOfClass(type);\n                    checkBaseTypeAccessibility(staticBaseType, baseTypeNode);\n                    checkSourceElement(baseTypeNode.expression);\n                    if (baseTypeNode.typeArguments) {\n                        ts.forEach(baseTypeNode.typeArguments, checkSourceElement);\n                        for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); _i < _a.length; _i++) {\n                            var constructor = _a[_i];\n                            if (!checkTypeArgumentConstraints(constructor.typeParameters, baseTypeNode.typeArguments)) {\n                                break;\n                            }\n                        }\n                    }\n                    checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1);\n                    checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1);\n                    if (baseType_1.symbol.valueDeclaration &&\n                        !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) &&\n                        baseType_1.symbol.valueDeclaration.kind === 226 /* ClassDeclaration */) {\n                        if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) {\n                            error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class);\n                        }\n                    }\n                    if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */)) {\n                        // When the static base type is a \"class-like\" constructor function (but not actually a class), we verify\n                        // that all instantiated base constructor signatures return the same type. We can simply compare the type\n                        // references (as opposed to checking the structure of the types) because elsewhere we have already checked\n                        // that the base type is a class or interface type (and not, for example, an anonymous object type).\n                        var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments);\n                        if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1; })) {\n                            error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type);\n                        }\n                    }\n                    checkKindsOfPropertyMemberOverrides(type, baseType_1);\n                }\n            }\n            var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node);\n            if (implementedTypeNodes) {\n                for (var _b = 0, implementedTypeNodes_1 = implementedTypeNodes; _b < implementedTypeNodes_1.length; _b++) {\n                    var typeRefNode = implementedTypeNodes_1[_b];\n                    if (!ts.isEntityNameExpression(typeRefNode.expression)) {\n                        error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments);\n                    }\n                    checkTypeReferenceNode(typeRefNode);\n                    if (produceDiagnostics) {\n                        var t = getTypeFromTypeNode(typeRefNode);\n                        if (t !== unknownType) {\n                            var declaredType = getObjectFlags(t) & 4 /* Reference */ ? t.target : t;\n                            if (getObjectFlags(declaredType) & 3 /* ClassOrInterface */) {\n                                checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1);\n                            }\n                            else {\n                                error(typeRefNode, ts.Diagnostics.A_class_may_only_implement_another_class_or_interface);\n                            }\n                        }\n                    }\n                }\n            }\n            if (produceDiagnostics) {\n                checkIndexConstraints(type);\n                checkTypeForDuplicateIndexSignatures(node);\n            }\n        }\n        function checkBaseTypeAccessibility(type, node) {\n            var signatures = getSignaturesOfType(type, 1 /* Construct */);\n            if (signatures.length) {\n                var declaration = signatures[0].declaration;\n                if (declaration && ts.getModifierFlags(declaration) & 8 /* Private */) {\n                    var typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol);\n                    if (!isNodeWithinClass(node, typeClassDeclaration)) {\n                        error(node, ts.Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol));\n                    }\n                }\n            }\n        }\n        function getTargetSymbol(s) {\n            // if symbol is instantiated its flags are not copied from the 'target'\n            // so we'll need to get back original 'target' symbol to work with correct set of flags\n            return s.flags & 16777216 /* Instantiated */ ? getSymbolLinks(s).target : s;\n        }\n        function getClassLikeDeclarationOfSymbol(symbol) {\n            return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; });\n        }\n        function checkKindsOfPropertyMemberOverrides(type, baseType) {\n            // TypeScript 1.0 spec (April 2014): 8.2.3\n            // A derived class inherits all members from its base class it doesn't override.\n            // Inheritance means that a derived class implicitly contains all non - overridden members of the base class.\n            // Both public and private property members are inherited, but only public property members can be overridden.\n            // A property member in a derived class is said to override a property member in a base class\n            // when the derived class property member has the same name and kind(instance or static)\n            // as the base class property member.\n            // The type of an overriding property member must be assignable(section 3.8.4)\n            // to the type of the overridden property member, or otherwise a compile - time error occurs.\n            // Base class instance member functions can be overridden by derived class instance member functions,\n            // but not by other kinds of members.\n            // Base class instance member variables and accessors can be overridden by\n            // derived class instance member variables and accessors, but not by other kinds of members.\n            // NOTE: assignability is checked in checkClassDeclaration\n            var baseProperties = getPropertiesOfObjectType(baseType);\n            for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {\n                var baseProperty = baseProperties_1[_i];\n                var base = getTargetSymbol(baseProperty);\n                if (base.flags & 134217728 /* Prototype */) {\n                    continue;\n                }\n                var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name));\n                var baseDeclarationFlags = getDeclarationModifierFlagsFromSymbol(base);\n                ts.Debug.assert(!!derived, \"derived should point to something, even if it is the base class' declaration.\");\n                if (derived) {\n                    // In order to resolve whether the inherited method was overridden in the base class or not,\n                    // we compare the Symbols obtained. Since getTargetSymbol returns the symbol on the *uninstantiated*\n                    // type declaration, derived and base resolve to the same symbol even in the case of generic classes.\n                    if (derived === base) {\n                        // derived class inherits base without override/redeclaration\n                        var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol);\n                        // It is an error to inherit an abstract member without implementing it or being declared abstract.\n                        // If there is no declaration for the derived class (as in the case of class expressions),\n                        // then the class cannot be declared abstract.\n                        if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128 /* Abstract */))) {\n                            if (derivedClassDecl.kind === 197 /* ClassExpression */) {\n                                error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));\n                            }\n                            else {\n                                error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType));\n                            }\n                        }\n                    }\n                    else {\n                        // derived overrides base.\n                        var derivedDeclarationFlags = getDeclarationModifierFlagsFromSymbol(derived);\n                        if ((baseDeclarationFlags & 8 /* Private */) || (derivedDeclarationFlags & 8 /* Private */)) {\n                            // either base or derived property is private - not override, skip it\n                            continue;\n                        }\n                        if ((baseDeclarationFlags & 32 /* Static */) !== (derivedDeclarationFlags & 32 /* Static */)) {\n                            // value of 'static' is not the same for properties - not override, skip it\n                            continue;\n                        }\n                        if ((base.flags & derived.flags & 8192 /* Method */) || ((base.flags & 98308 /* PropertyOrAccessor */) && (derived.flags & 98308 /* PropertyOrAccessor */))) {\n                            // method is overridden with method or property/accessor is overridden with property/accessor - correct case\n                            continue;\n                        }\n                        var errorMessage = void 0;\n                        if (base.flags & 8192 /* Method */) {\n                            if (derived.flags & 98304 /* Accessor */) {\n                                errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;\n                            }\n                            else {\n                                ts.Debug.assert((derived.flags & 4 /* Property */) !== 0);\n                                errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property;\n                            }\n                        }\n                        else if (base.flags & 4 /* Property */) {\n                            ts.Debug.assert((derived.flags & 8192 /* Method */) !== 0);\n                            errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;\n                        }\n                        else {\n                            ts.Debug.assert((base.flags & 98304 /* Accessor */) !== 0);\n                            ts.Debug.assert((derived.flags & 8192 /* Method */) !== 0);\n                            errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;\n                        }\n                        error(derived.valueDeclaration.name, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));\n                    }\n                }\n            }\n        }\n        function isAccessor(kind) {\n            return kind === 151 /* GetAccessor */ || kind === 152 /* SetAccessor */;\n        }\n        function areTypeParametersIdentical(list1, list2) {\n            if (!list1 && !list2) {\n                return true;\n            }\n            if (!list1 || !list2 || list1.length !== list2.length) {\n                return false;\n            }\n            // TypeScript 1.0 spec (April 2014):\n            // When a generic interface has multiple declarations,  all declarations must have identical type parameter\n            // lists, i.e. identical type parameter names with identical constraints in identical order.\n            for (var i = 0, len = list1.length; i < len; i++) {\n                var tp1 = list1[i];\n                var tp2 = list2[i];\n                if (tp1.name.text !== tp2.name.text) {\n                    return false;\n                }\n                if (!tp1.constraint && !tp2.constraint) {\n                    continue;\n                }\n                if (!tp1.constraint || !tp2.constraint) {\n                    return false;\n                }\n                if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) {\n                    return false;\n                }\n            }\n            return true;\n        }\n        function checkInheritedPropertiesAreIdentical(type, typeNode) {\n            var baseTypes = getBaseTypes(type);\n            if (baseTypes.length < 2) {\n                return true;\n            }\n            var seen = ts.createMap();\n            ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; });\n            var ok = true;\n            for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) {\n                var base = baseTypes_2[_i];\n                var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType));\n                for (var _a = 0, properties_7 = properties; _a < properties_7.length; _a++) {\n                    var prop = properties_7[_a];\n                    var existing = seen[prop.name];\n                    if (!existing) {\n                        seen[prop.name] = { prop: prop, containingType: base };\n                    }\n                    else {\n                        var isInheritedProperty = existing.containingType !== type;\n                        if (isInheritedProperty && !isPropertyIdenticalTo(existing.prop, prop)) {\n                            ok = false;\n                            var typeName1 = typeToString(existing.containingType);\n                            var typeName2 = typeToString(base);\n                            var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2);\n                            errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2);\n                            diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo));\n                        }\n                    }\n                }\n            }\n            return ok;\n        }\n        function checkInterfaceDeclaration(node) {\n            // Grammar checking\n            checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarInterfaceDeclaration(node);\n            checkTypeParameters(node.typeParameters);\n            if (produceDiagnostics) {\n                checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0);\n                checkExportsOnMergedDeclarations(node);\n                var symbol = getSymbolOfNode(node);\n                checkTypeParameterListsIdentical(node, symbol);\n                // Only check this symbol once\n                var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 227 /* InterfaceDeclaration */);\n                if (node === firstInterfaceDecl) {\n                    var type = getDeclaredTypeOfSymbol(symbol);\n                    var typeWithThis = getTypeWithThisArgument(type);\n                    // run subsequent checks only if first set succeeded\n                    if (checkInheritedPropertiesAreIdentical(type, node.name)) {\n                        for (var _i = 0, _a = getBaseTypes(type); _i < _a.length; _i++) {\n                            var baseType = _a[_i];\n                            checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1);\n                        }\n                        checkIndexConstraints(type);\n                    }\n                }\n                checkObjectTypeForDuplicateDeclarations(node);\n            }\n            ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) {\n                if (!ts.isEntityNameExpression(heritageElement.expression)) {\n                    error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments);\n                }\n                checkTypeReferenceNode(heritageElement);\n            });\n            ts.forEach(node.members, checkSourceElement);\n            if (produceDiagnostics) {\n                checkTypeForDuplicateIndexSignatures(node);\n                registerForUnusedIdentifiersCheck(node);\n            }\n        }\n        function checkTypeAliasDeclaration(node) {\n            // Grammar checking\n            checkGrammarDecorators(node) || checkGrammarModifiers(node);\n            checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0);\n            checkTypeParameters(node.typeParameters);\n            checkSourceElement(node.type);\n        }\n        function computeEnumMemberValues(node) {\n            var nodeLinks = getNodeLinks(node);\n            if (!(nodeLinks.flags & 16384 /* EnumValuesComputed */)) {\n                var enumSymbol = getSymbolOfNode(node);\n                var enumType = getDeclaredTypeOfSymbol(enumSymbol);\n                var autoValue = 0; // set to undefined when enum member is non-constant\n                var ambient = ts.isInAmbientContext(node);\n                var enumIsConst = ts.isConst(node);\n                for (var _i = 0, _a = node.members; _i < _a.length; _i++) {\n                    var member = _a[_i];\n                    if (isComputedNonLiteralName(member.name)) {\n                        error(member.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums);\n                    }\n                    else {\n                        var text = ts.getTextOfPropertyName(member.name);\n                        if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {\n                            error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name);\n                        }\n                    }\n                    var previousEnumMemberIsNonConstant = autoValue === undefined;\n                    var initializer = member.initializer;\n                    if (initializer) {\n                        autoValue = computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient);\n                    }\n                    else if (ambient && !enumIsConst) {\n                        // In ambient enum declarations that specify no const modifier, enum member declarations\n                        // that omit a value are considered computed members (as opposed to having auto-incremented values assigned).\n                        autoValue = undefined;\n                    }\n                    else if (previousEnumMemberIsNonConstant) {\n                        // If the member declaration specifies no value, the member is considered a constant enum member.\n                        // If the member is the first member in the enum declaration, it is assigned the value zero.\n                        // Otherwise, it is assigned the value of the immediately preceding member plus one,\n                        // and an error occurs if the immediately preceding member is not a constant enum member\n                        error(member.name, ts.Diagnostics.Enum_member_must_have_initializer);\n                    }\n                    if (autoValue !== undefined) {\n                        getNodeLinks(member).enumMemberValue = autoValue;\n                        autoValue++;\n                    }\n                }\n                nodeLinks.flags |= 16384 /* EnumValuesComputed */;\n            }\n            function computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient) {\n                // Controls if error should be reported after evaluation of constant value is completed\n                // Can be false if another more precise error was already reported during evaluation.\n                var reportError = true;\n                var value = evalConstant(initializer);\n                if (reportError) {\n                    if (value === undefined) {\n                        if (enumIsConst) {\n                            error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression);\n                        }\n                        else if (ambient) {\n                            error(initializer, ts.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);\n                        }\n                        else {\n                            // Only here do we need to check that the initializer is assignable to the enum type.\n                            checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, /*headMessage*/ undefined);\n                        }\n                    }\n                    else if (enumIsConst) {\n                        if (isNaN(value)) {\n                            error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN);\n                        }\n                        else if (!isFinite(value)) {\n                            error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value);\n                        }\n                    }\n                }\n                return value;\n                function evalConstant(e) {\n                    switch (e.kind) {\n                        case 190 /* PrefixUnaryExpression */:\n                            var value_1 = evalConstant(e.operand);\n                            if (value_1 === undefined) {\n                                return undefined;\n                            }\n                            switch (e.operator) {\n                                case 36 /* PlusToken */: return value_1;\n                                case 37 /* MinusToken */: return -value_1;\n                                case 51 /* TildeToken */: return ~value_1;\n                            }\n                            return undefined;\n                        case 192 /* BinaryExpression */:\n                            var left = evalConstant(e.left);\n                            if (left === undefined) {\n                                return undefined;\n                            }\n                            var right = evalConstant(e.right);\n                            if (right === undefined) {\n                                return undefined;\n                            }\n                            switch (e.operatorToken.kind) {\n                                case 48 /* BarToken */: return left | right;\n                                case 47 /* AmpersandToken */: return left & right;\n                                case 45 /* GreaterThanGreaterThanToken */: return left >> right;\n                                case 46 /* GreaterThanGreaterThanGreaterThanToken */: return left >>> right;\n                                case 44 /* LessThanLessThanToken */: return left << right;\n                                case 49 /* CaretToken */: return left ^ right;\n                                case 38 /* AsteriskToken */: return left * right;\n                                case 40 /* SlashToken */: return left / right;\n                                case 36 /* PlusToken */: return left + right;\n                                case 37 /* MinusToken */: return left - right;\n                                case 41 /* PercentToken */: return left % right;\n                            }\n                            return undefined;\n                        case 8 /* NumericLiteral */:\n                            return +e.text;\n                        case 183 /* ParenthesizedExpression */:\n                            return evalConstant(e.expression);\n                        case 70 /* Identifier */:\n                        case 178 /* ElementAccessExpression */:\n                        case 177 /* PropertyAccessExpression */:\n                            var member = initializer.parent;\n                            var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent));\n                            var enumType_1;\n                            var propertyName = void 0;\n                            if (e.kind === 70 /* Identifier */) {\n                                // unqualified names can refer to member that reside in different declaration of the enum so just doing name resolution won't work.\n                                // instead pick current enum type and later try to fetch member from the type\n                                enumType_1 = currentType;\n                                propertyName = e.text;\n                            }\n                            else {\n                                var expression = void 0;\n                                if (e.kind === 178 /* ElementAccessExpression */) {\n                                    if (e.argumentExpression === undefined ||\n                                        e.argumentExpression.kind !== 9 /* StringLiteral */) {\n                                        return undefined;\n                                    }\n                                    expression = e.expression;\n                                    propertyName = e.argumentExpression.text;\n                                }\n                                else {\n                                    expression = e.expression;\n                                    propertyName = e.name.text;\n                                }\n                                // expression part in ElementAccess\\PropertyAccess should be either identifier or dottedName\n                                var current = expression;\n                                while (current) {\n                                    if (current.kind === 70 /* Identifier */) {\n                                        break;\n                                    }\n                                    else if (current.kind === 177 /* PropertyAccessExpression */) {\n                                        current = current.expression;\n                                    }\n                                    else {\n                                        return undefined;\n                                    }\n                                }\n                                enumType_1 = getTypeOfExpression(expression);\n                                // allow references to constant members of other enums\n                                if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384 /* Enum */))) {\n                                    return undefined;\n                                }\n                            }\n                            if (propertyName === undefined) {\n                                return undefined;\n                            }\n                            var property = getPropertyOfObjectType(enumType_1, propertyName);\n                            if (!property || !(property.flags & 8 /* EnumMember */)) {\n                                return undefined;\n                            }\n                            var propertyDecl = property.valueDeclaration;\n                            // self references are illegal\n                            if (member === propertyDecl) {\n                                return undefined;\n                            }\n                            // illegal case: forward reference\n                            if (!isBlockScopedNameDeclaredBeforeUse(propertyDecl, member)) {\n                                reportError = false;\n                                error(e, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);\n                                return undefined;\n                            }\n                            return getNodeLinks(propertyDecl).enumMemberValue;\n                    }\n                }\n            }\n        }\n        function checkEnumDeclaration(node) {\n            if (!produceDiagnostics) {\n                return;\n            }\n            // Grammar checking\n            checkGrammarDecorators(node) || checkGrammarModifiers(node);\n            checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0);\n            checkCollisionWithCapturedThisVariable(node, node.name);\n            checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n            checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n            checkExportsOnMergedDeclarations(node);\n            computeEnumMemberValues(node);\n            var enumIsConst = ts.isConst(node);\n            if (compilerOptions.isolatedModules && enumIsConst && ts.isInAmbientContext(node)) {\n                error(node.name, ts.Diagnostics.Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided);\n            }\n            // Spec 2014 - Section 9.3:\n            // It isn't possible for one enum declaration to continue the automatic numbering sequence of another,\n            // and when an enum type has multiple declarations, only one declaration is permitted to omit a value\n            // for the first member.\n            //\n            // Only perform this check once per symbol\n            var enumSymbol = getSymbolOfNode(node);\n            var firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind);\n            if (node === firstDeclaration) {\n                if (enumSymbol.declarations.length > 1) {\n                    // check that const is placed\\omitted on all enum declarations\n                    ts.forEach(enumSymbol.declarations, function (decl) {\n                        if (ts.isConstEnumDeclaration(decl) !== enumIsConst) {\n                            error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const);\n                        }\n                    });\n                }\n                var seenEnumMissingInitialInitializer_1 = false;\n                ts.forEach(enumSymbol.declarations, function (declaration) {\n                    // return true if we hit a violation of the rule, false otherwise\n                    if (declaration.kind !== 229 /* EnumDeclaration */) {\n                        return false;\n                    }\n                    var enumDeclaration = declaration;\n                    if (!enumDeclaration.members.length) {\n                        return false;\n                    }\n                    var firstEnumMember = enumDeclaration.members[0];\n                    if (!firstEnumMember.initializer) {\n                        if (seenEnumMissingInitialInitializer_1) {\n                            error(firstEnumMember.name, ts.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element);\n                        }\n                        else {\n                            seenEnumMissingInitialInitializer_1 = true;\n                        }\n                    }\n                });\n            }\n        }\n        function getFirstNonAmbientClassOrFunctionDeclaration(symbol) {\n            var declarations = symbol.declarations;\n            for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {\n                var declaration = declarations_5[_i];\n                if ((declaration.kind === 226 /* ClassDeclaration */ ||\n                    (declaration.kind === 225 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) &&\n                    !ts.isInAmbientContext(declaration)) {\n                    return declaration;\n                }\n            }\n            return undefined;\n        }\n        function inSameLexicalScope(node1, node2) {\n            var container1 = ts.getEnclosingBlockScopeContainer(node1);\n            var container2 = ts.getEnclosingBlockScopeContainer(node2);\n            if (isGlobalSourceFile(container1)) {\n                return isGlobalSourceFile(container2);\n            }\n            else if (isGlobalSourceFile(container2)) {\n                return false;\n            }\n            else {\n                return container1 === container2;\n            }\n        }\n        function checkModuleDeclaration(node) {\n            if (produceDiagnostics) {\n                // Grammar checking\n                var isGlobalAugmentation = ts.isGlobalScopeAugmentation(node);\n                var inAmbientContext = ts.isInAmbientContext(node);\n                if (isGlobalAugmentation && !inAmbientContext) {\n                    error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context);\n                }\n                var isAmbientExternalModule = ts.isAmbientModule(node);\n                var contextErrorMessage = isAmbientExternalModule\n                    ? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file\n                    : ts.Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module;\n                if (checkGrammarModuleElementContext(node, contextErrorMessage)) {\n                    // If we hit a module declaration in an illegal context, just bail out to avoid cascading errors.\n                    return;\n                }\n                if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node)) {\n                    if (!inAmbientContext && node.name.kind === 9 /* StringLiteral */) {\n                        grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names);\n                    }\n                }\n                if (ts.isIdentifier(node.name)) {\n                    checkCollisionWithCapturedThisVariable(node, node.name);\n                    checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n                    checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n                }\n                checkExportsOnMergedDeclarations(node);\n                var symbol = getSymbolOfNode(node);\n                // The following checks only apply on a non-ambient instantiated module declaration.\n                if (symbol.flags & 512 /* ValueModule */\n                    && symbol.declarations.length > 1\n                    && !inAmbientContext\n                    && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules)) {\n                    var firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);\n                    if (firstNonAmbientClassOrFunc) {\n                        if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(firstNonAmbientClassOrFunc)) {\n                            error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged);\n                        }\n                        else if (node.pos < firstNonAmbientClassOrFunc.pos) {\n                            error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);\n                        }\n                    }\n                    // if the module merges with a class declaration in the same lexical scope,\n                    // we need to track this to ensure the correct emit.\n                    var mergedClass = ts.getDeclarationOfKind(symbol, 226 /* ClassDeclaration */);\n                    if (mergedClass &&\n                        inSameLexicalScope(node, mergedClass)) {\n                        getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */;\n                    }\n                }\n                if (isAmbientExternalModule) {\n                    if (ts.isExternalModuleAugmentation(node)) {\n                        // body of the augmentation should be checked for consistency only if augmentation was applied to its target (either global scope or module)\n                        // otherwise we'll be swamped in cascading errors.\n                        // We can detect if augmentation was applied using following rules:\n                        // - augmentation for a global scope is always applied\n                        // - augmentation for some external module is applied if symbol for augmentation is merged (it was combined with target module).\n                        var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 33554432 /* Merged */);\n                        if (checkBody && node.body) {\n                            // body of ambient external module is always a module block\n                            for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) {\n                                var statement = _a[_i];\n                                checkModuleAugmentationElement(statement, isGlobalAugmentation);\n                            }\n                        }\n                    }\n                    else if (isGlobalSourceFile(node.parent)) {\n                        if (isGlobalAugmentation) {\n                            error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);\n                        }\n                        else if (ts.isExternalModuleNameRelative(node.name.text)) {\n                            error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name);\n                        }\n                    }\n                    else {\n                        if (isGlobalAugmentation) {\n                            error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);\n                        }\n                        else {\n                            // Node is not an augmentation and is not located on the script level.\n                            // This means that this is declaration of ambient module that is located in other module or namespace which is prohibited.\n                            error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces);\n                        }\n                    }\n                }\n            }\n            if (node.body) {\n                checkSourceElement(node.body);\n                if (!ts.isGlobalScopeAugmentation(node)) {\n                    registerForUnusedIdentifiersCheck(node);\n                }\n            }\n        }\n        function checkModuleAugmentationElement(node, isGlobalAugmentation) {\n            switch (node.kind) {\n                case 205 /* VariableStatement */:\n                    // error each individual name in variable statement instead of marking the entire variable statement\n                    for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                        var decl = _a[_i];\n                        checkModuleAugmentationElement(decl, isGlobalAugmentation);\n                    }\n                    break;\n                case 240 /* ExportAssignment */:\n                case 241 /* ExportDeclaration */:\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);\n                    break;\n                case 234 /* ImportEqualsDeclaration */:\n                case 235 /* ImportDeclaration */:\n                    grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);\n                    break;\n                case 174 /* BindingElement */:\n                case 223 /* VariableDeclaration */:\n                    var name_25 = node.name;\n                    if (ts.isBindingPattern(name_25)) {\n                        for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) {\n                            var el = _c[_b];\n                            // mark individual names in binding pattern\n                            checkModuleAugmentationElement(el, isGlobalAugmentation);\n                        }\n                        break;\n                    }\n                // fallthrough\n                case 226 /* ClassDeclaration */:\n                case 229 /* EnumDeclaration */:\n                case 225 /* FunctionDeclaration */:\n                case 227 /* InterfaceDeclaration */:\n                case 230 /* ModuleDeclaration */:\n                case 228 /* TypeAliasDeclaration */:\n                    if (isGlobalAugmentation) {\n                        return;\n                    }\n                    var symbol = getSymbolOfNode(node);\n                    if (symbol) {\n                        // module augmentations cannot introduce new names on the top level scope of the module\n                        // this is done it two steps\n                        // 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error\n                        // 2. main check - report error if value declaration of the parent symbol is module augmentation)\n                        var reportError = !(symbol.flags & 33554432 /* Merged */);\n                        if (!reportError) {\n                            // symbol should not originate in augmentation\n                            reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]);\n                        }\n                    }\n                    break;\n            }\n        }\n        function getFirstIdentifier(node) {\n            switch (node.kind) {\n                case 70 /* Identifier */:\n                    return node;\n                case 141 /* QualifiedName */:\n                    do {\n                        node = node.left;\n                    } while (node.kind !== 70 /* Identifier */);\n                    return node;\n                case 177 /* PropertyAccessExpression */:\n                    do {\n                        node = node.expression;\n                    } while (node.kind !== 70 /* Identifier */);\n                    return node;\n            }\n        }\n        function checkExternalImportOrExportDeclaration(node) {\n            var moduleName = ts.getExternalModuleName(node);\n            if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 9 /* StringLiteral */) {\n                error(moduleName, ts.Diagnostics.String_literal_expected);\n                return false;\n            }\n            var inAmbientExternalModule = node.parent.kind === 231 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);\n            if (node.parent.kind !== 261 /* SourceFile */ && !inAmbientExternalModule) {\n                error(moduleName, node.kind === 241 /* ExportDeclaration */ ?\n                    ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace :\n                    ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);\n                return false;\n            }\n            if (inAmbientExternalModule && ts.isExternalModuleNameRelative(moduleName.text)) {\n                // we have already reported errors on top level imports\\exports in external module augmentations in checkModuleDeclaration\n                // no need to do this again.\n                if (!isTopLevelInExternalModuleAugmentation(node)) {\n                    // TypeScript 1.0 spec (April 2013): 12.1.6\n                    // An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference\n                    // other external modules only through top - level external module names.\n                    // Relative external module names are not permitted.\n                    error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name);\n                    return false;\n                }\n            }\n            return true;\n        }\n        function checkAliasSymbol(node) {\n            var symbol = getSymbolOfNode(node);\n            var target = resolveAlias(symbol);\n            if (target !== unknownSymbol) {\n                // For external modules symbol represent local symbol for an alias.\n                // This local symbol will merge any other local declarations (excluding other aliases)\n                // and symbol.flags will contains combined representation for all merged declaration.\n                // Based on symbol.flags we can compute a set of excluded meanings (meaning that resolved alias should not have,\n                // otherwise it will conflict with some local declaration). Note that in addition to normal flags we include matching SymbolFlags.Export*\n                // in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names).\n                var excludedMeanings = (symbol.flags & (107455 /* Value */ | 1048576 /* ExportValue */) ? 107455 /* Value */ : 0) |\n                    (symbol.flags & 793064 /* Type */ ? 793064 /* Type */ : 0) |\n                    (symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0);\n                if (target.flags & excludedMeanings) {\n                    var message = node.kind === 243 /* ExportSpecifier */ ?\n                        ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :\n                        ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;\n                    error(node, message, symbolToString(symbol));\n                }\n            }\n        }\n        function checkImportBinding(node) {\n            checkCollisionWithCapturedThisVariable(node, node.name);\n            checkCollisionWithRequireExportsInGeneratedCode(node, node.name);\n            checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);\n            checkAliasSymbol(node);\n        }\n        function checkImportDeclaration(node) {\n            if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) {\n                // If we hit an import declaration in an illegal context, just bail out to avoid cascading errors.\n                return;\n            }\n            if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) {\n                grammarErrorOnFirstToken(node, ts.Diagnostics.An_import_declaration_cannot_have_modifiers);\n            }\n            if (checkExternalImportOrExportDeclaration(node)) {\n                var importClause = node.importClause;\n                if (importClause) {\n                    if (importClause.name) {\n                        checkImportBinding(importClause);\n                    }\n                    if (importClause.namedBindings) {\n                        if (importClause.namedBindings.kind === 237 /* NamespaceImport */) {\n                            checkImportBinding(importClause.namedBindings);\n                        }\n                        else {\n                            ts.forEach(importClause.namedBindings.elements, checkImportBinding);\n                        }\n                    }\n                }\n            }\n        }\n        function checkImportEqualsDeclaration(node) {\n            if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) {\n                // If we hit an import declaration in an illegal context, just bail out to avoid cascading errors.\n                return;\n            }\n            checkGrammarDecorators(node) || checkGrammarModifiers(node);\n            if (ts.isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {\n                checkImportBinding(node);\n                if (ts.getModifierFlags(node) & 1 /* Export */) {\n                    markExportAsReferenced(node);\n                }\n                if (ts.isInternalModuleImportEqualsDeclaration(node)) {\n                    var target = resolveAlias(getSymbolOfNode(node));\n                    if (target !== unknownSymbol) {\n                        if (target.flags & 107455 /* Value */) {\n                            // Target is a value symbol, check that it is not hidden by a local declaration with the same name\n                            var moduleName = getFirstIdentifier(node.moduleReference);\n                            if (!(resolveEntityName(moduleName, 107455 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {\n                                error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName));\n                            }\n                        }\n                        if (target.flags & 793064 /* Type */) {\n                            checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0);\n                        }\n                    }\n                }\n                else {\n                    if (modulekind === ts.ModuleKind.ES2015 && !ts.isInAmbientContext(node)) {\n                        // Import equals declaration is deprecated in es6 or above\n                        grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);\n                    }\n                }\n            }\n        }\n        function checkExportDeclaration(node) {\n            if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module)) {\n                // If we hit an export in an illegal context, just bail out to avoid cascading errors.\n                return;\n            }\n            if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) {\n                grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers);\n            }\n            if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) {\n                if (node.exportClause) {\n                    // export { x, y }\n                    // export { x, y } from \"foo\"\n                    ts.forEach(node.exportClause.elements, checkExportSpecifier);\n                    var inAmbientExternalModule = node.parent.kind === 231 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);\n                    if (node.parent.kind !== 261 /* SourceFile */ && !inAmbientExternalModule) {\n                        error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);\n                    }\n                }\n                else {\n                    // export * from \"foo\"\n                    var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);\n                    if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) {\n                        error(node.moduleSpecifier, ts.Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));\n                    }\n                }\n            }\n        }\n        function checkGrammarModuleElementContext(node, errorMessage) {\n            var isInAppropriateContext = node.parent.kind === 261 /* SourceFile */ || node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 230 /* ModuleDeclaration */;\n            if (!isInAppropriateContext) {\n                grammarErrorOnFirstToken(node, errorMessage);\n            }\n            return !isInAppropriateContext;\n        }\n        function checkExportSpecifier(node) {\n            checkAliasSymbol(node);\n            if (!node.parent.parent.moduleSpecifier) {\n                var exportedName = node.propertyName || node.name;\n                // find immediate value referenced by exported name (SymbolFlags.Alias is set so we don't chase down aliases)\n                var symbol = resolveName(exportedName, exportedName.text, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */, \n                /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);\n                if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {\n                    error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, exportedName.text);\n                }\n                else {\n                    markExportAsReferenced(node);\n                }\n            }\n        }\n        function checkExportAssignment(node) {\n            if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) {\n                // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors.\n                return;\n            }\n            var container = node.parent.kind === 261 /* SourceFile */ ? node.parent : node.parent.parent;\n            if (container.kind === 230 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {\n                error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);\n                return;\n            }\n            // Grammar checking\n            if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) {\n                grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);\n            }\n            if (node.expression.kind === 70 /* Identifier */) {\n                markExportAsReferenced(node);\n            }\n            else {\n                checkExpressionCached(node.expression);\n            }\n            checkExternalModuleExports(container);\n            if (node.isExportEquals && !ts.isInAmbientContext(node)) {\n                if (modulekind === ts.ModuleKind.ES2015) {\n                    // export assignment is not supported in es6 modules\n                    grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_default_or_another_module_format_instead);\n                }\n                else if (modulekind === ts.ModuleKind.System) {\n                    // system modules does not support export assignment\n                    grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);\n                }\n            }\n        }\n        function hasExportedMembers(moduleSymbol) {\n            for (var id in moduleSymbol.exports) {\n                if (id !== \"export=\") {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function checkExternalModuleExports(node) {\n            var moduleSymbol = getSymbolOfNode(node);\n            var links = getSymbolLinks(moduleSymbol);\n            if (!links.exportsChecked) {\n                var exportEqualsSymbol = moduleSymbol.exports[\"export=\"];\n                if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) {\n                    var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration;\n                    if (!isTopLevelInExternalModuleAugmentation(declaration)) {\n                        error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);\n                    }\n                }\n                // Checks for export * conflicts\n                var exports = getExportsOfModule(moduleSymbol);\n                for (var id in exports) {\n                    if (id === \"__export\") {\n                        continue;\n                    }\n                    var _a = exports[id], declarations = _a.declarations, flags = _a.flags;\n                    // ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries.\n                    // (TS Exceptions: namespaces, function overloads, enums, and interfaces)\n                    if (flags & (1920 /* Namespace */ | 64 /* Interface */ | 384 /* Enum */)) {\n                        continue;\n                    }\n                    var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload);\n                    if (flags & 524288 /* TypeAlias */ && exportedDeclarationsCount <= 2) {\n                        // it is legal to merge type alias with other values\n                        // so count should be either 1 (just type alias) or 2 (type alias + merged value)\n                        continue;\n                    }\n                    if (exportedDeclarationsCount > 1) {\n                        for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {\n                            var declaration = declarations_6[_i];\n                            if (isNotOverload(declaration)) {\n                                diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, id));\n                            }\n                        }\n                    }\n                }\n                links.exportsChecked = true;\n            }\n            function isNotOverload(declaration) {\n                return (declaration.kind !== 225 /* FunctionDeclaration */ && declaration.kind !== 149 /* MethodDeclaration */) ||\n                    !!declaration.body;\n            }\n        }\n        function checkSourceElement(node) {\n            if (!node) {\n                return;\n            }\n            var kind = node.kind;\n            if (cancellationToken) {\n                // Only bother checking on a few construct kinds.  We don't want to be excessively\n                // hitting the cancellation token on every node we check.\n                switch (kind) {\n                    case 230 /* ModuleDeclaration */:\n                    case 226 /* ClassDeclaration */:\n                    case 227 /* InterfaceDeclaration */:\n                    case 225 /* FunctionDeclaration */:\n                        cancellationToken.throwIfCancellationRequested();\n                }\n            }\n            switch (kind) {\n                case 143 /* TypeParameter */:\n                    return checkTypeParameter(node);\n                case 144 /* Parameter */:\n                    return checkParameter(node);\n                case 147 /* PropertyDeclaration */:\n                case 146 /* PropertySignature */:\n                    return checkPropertyDeclaration(node);\n                case 158 /* FunctionType */:\n                case 159 /* ConstructorType */:\n                case 153 /* CallSignature */:\n                case 154 /* ConstructSignature */:\n                    return checkSignatureDeclaration(node);\n                case 155 /* IndexSignature */:\n                    return checkSignatureDeclaration(node);\n                case 149 /* MethodDeclaration */:\n                case 148 /* MethodSignature */:\n                    return checkMethodDeclaration(node);\n                case 150 /* Constructor */:\n                    return checkConstructorDeclaration(node);\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                    return checkAccessorDeclaration(node);\n                case 157 /* TypeReference */:\n                    return checkTypeReferenceNode(node);\n                case 156 /* TypePredicate */:\n                    return checkTypePredicate(node);\n                case 160 /* TypeQuery */:\n                    return checkTypeQuery(node);\n                case 161 /* TypeLiteral */:\n                    return checkTypeLiteral(node);\n                case 162 /* ArrayType */:\n                    return checkArrayType(node);\n                case 163 /* TupleType */:\n                    return checkTupleType(node);\n                case 164 /* UnionType */:\n                case 165 /* IntersectionType */:\n                    return checkUnionOrIntersectionType(node);\n                case 166 /* ParenthesizedType */:\n                case 168 /* TypeOperator */:\n                    return checkSourceElement(node.type);\n                case 169 /* IndexedAccessType */:\n                    return checkIndexedAccessType(node);\n                case 170 /* MappedType */:\n                    return checkMappedType(node);\n                case 225 /* FunctionDeclaration */:\n                    return checkFunctionDeclaration(node);\n                case 204 /* Block */:\n                case 231 /* ModuleBlock */:\n                    return checkBlock(node);\n                case 205 /* VariableStatement */:\n                    return checkVariableStatement(node);\n                case 207 /* ExpressionStatement */:\n                    return checkExpressionStatement(node);\n                case 208 /* IfStatement */:\n                    return checkIfStatement(node);\n                case 209 /* DoStatement */:\n                    return checkDoStatement(node);\n                case 210 /* WhileStatement */:\n                    return checkWhileStatement(node);\n                case 211 /* ForStatement */:\n                    return checkForStatement(node);\n                case 212 /* ForInStatement */:\n                    return checkForInStatement(node);\n                case 213 /* ForOfStatement */:\n                    return checkForOfStatement(node);\n                case 214 /* ContinueStatement */:\n                case 215 /* BreakStatement */:\n                    return checkBreakOrContinueStatement(node);\n                case 216 /* ReturnStatement */:\n                    return checkReturnStatement(node);\n                case 217 /* WithStatement */:\n                    return checkWithStatement(node);\n                case 218 /* SwitchStatement */:\n                    return checkSwitchStatement(node);\n                case 219 /* LabeledStatement */:\n                    return checkLabeledStatement(node);\n                case 220 /* ThrowStatement */:\n                    return checkThrowStatement(node);\n                case 221 /* TryStatement */:\n                    return checkTryStatement(node);\n                case 223 /* VariableDeclaration */:\n                    return checkVariableDeclaration(node);\n                case 174 /* BindingElement */:\n                    return checkBindingElement(node);\n                case 226 /* ClassDeclaration */:\n                    return checkClassDeclaration(node);\n                case 227 /* InterfaceDeclaration */:\n                    return checkInterfaceDeclaration(node);\n                case 228 /* TypeAliasDeclaration */:\n                    return checkTypeAliasDeclaration(node);\n                case 229 /* EnumDeclaration */:\n                    return checkEnumDeclaration(node);\n                case 230 /* ModuleDeclaration */:\n                    return checkModuleDeclaration(node);\n                case 235 /* ImportDeclaration */:\n                    return checkImportDeclaration(node);\n                case 234 /* ImportEqualsDeclaration */:\n                    return checkImportEqualsDeclaration(node);\n                case 241 /* ExportDeclaration */:\n                    return checkExportDeclaration(node);\n                case 240 /* ExportAssignment */:\n                    return checkExportAssignment(node);\n                case 206 /* EmptyStatement */:\n                    checkGrammarStatementInAmbientContext(node);\n                    return;\n                case 222 /* DebuggerStatement */:\n                    checkGrammarStatementInAmbientContext(node);\n                    return;\n                case 244 /* MissingDeclaration */:\n                    return checkMissingDeclaration(node);\n            }\n        }\n        // Function and class expression bodies are checked after all statements in the enclosing body. This is\n        // to ensure constructs like the following are permitted:\n        //     const foo = function () {\n        //        const s = foo();\n        //        return \"hello\";\n        //     }\n        // Here, performing a full type check of the body of the function expression whilst in the process of\n        // determining the type of foo would cause foo to be given type any because of the recursive reference.\n        // Delaying the type check of the body ensures foo has been assigned a type.\n        function checkNodeDeferred(node) {\n            if (deferredNodes) {\n                deferredNodes.push(node);\n            }\n        }\n        function checkDeferredNodes() {\n            for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) {\n                var node = deferredNodes_1[_i];\n                switch (node.kind) {\n                    case 184 /* FunctionExpression */:\n                    case 185 /* ArrowFunction */:\n                    case 149 /* MethodDeclaration */:\n                    case 148 /* MethodSignature */:\n                        checkFunctionExpressionOrObjectLiteralMethodDeferred(node);\n                        break;\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                        checkAccessorDeferred(node);\n                        break;\n                    case 197 /* ClassExpression */:\n                        checkClassExpressionDeferred(node);\n                        break;\n                }\n            }\n        }\n        function checkSourceFile(node) {\n            ts.performance.mark(\"beforeCheck\");\n            checkSourceFileWorker(node);\n            ts.performance.mark(\"afterCheck\");\n            ts.performance.measure(\"Check\", \"beforeCheck\", \"afterCheck\");\n        }\n        // Fully type check a source file and collect the relevant diagnostics.\n        function checkSourceFileWorker(node) {\n            var links = getNodeLinks(node);\n            if (!(links.flags & 1 /* TypeChecked */)) {\n                // If skipLibCheck is enabled, skip type checking if file is a declaration file.\n                // If skipDefaultLibCheck is enabled, skip type checking if file contains a\n                // '/// <reference no-default-lib=\"true\"/>' directive.\n                if (compilerOptions.skipLibCheck && node.isDeclarationFile || compilerOptions.skipDefaultLibCheck && node.hasNoDefaultLib) {\n                    return;\n                }\n                // Grammar checking\n                checkGrammarSourceFile(node);\n                potentialThisCollisions.length = 0;\n                deferredNodes = [];\n                deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined;\n                ts.forEach(node.statements, checkSourceElement);\n                checkDeferredNodes();\n                if (ts.isExternalModule(node)) {\n                    registerForUnusedIdentifiersCheck(node);\n                }\n                if (!node.isDeclarationFile) {\n                    checkUnusedIdentifiers();\n                }\n                deferredNodes = undefined;\n                deferredUnusedIdentifierNodes = undefined;\n                if (ts.isExternalOrCommonJsModule(node)) {\n                    checkExternalModuleExports(node);\n                }\n                if (potentialThisCollisions.length) {\n                    ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope);\n                    potentialThisCollisions.length = 0;\n                }\n                links.flags |= 1 /* TypeChecked */;\n            }\n        }\n        function getDiagnostics(sourceFile, ct) {\n            try {\n                // Record the cancellation token so it can be checked later on during checkSourceElement.\n                // Do this in a finally block so we can ensure that it gets reset back to nothing after\n                // this call is done.\n                cancellationToken = ct;\n                return getDiagnosticsWorker(sourceFile);\n            }\n            finally {\n                cancellationToken = undefined;\n            }\n        }\n        function getDiagnosticsWorker(sourceFile) {\n            throwIfNonDiagnosticsProducing();\n            if (sourceFile) {\n                // Some global diagnostics are deferred until they are needed and\n                // may not be reported in the firt call to getGlobalDiagnostics.\n                // We should catch these changes and report them.\n                var previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics();\n                var previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length;\n                checkSourceFile(sourceFile);\n                var semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);\n                var currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics();\n                if (currentGlobalDiagnostics !== previousGlobalDiagnostics) {\n                    // If the arrays are not the same reference, new diagnostics were added.\n                    var deferredGlobalDiagnostics = ts.relativeComplement(previousGlobalDiagnostics, currentGlobalDiagnostics, ts.compareDiagnostics);\n                    return ts.concatenate(deferredGlobalDiagnostics, semanticDiagnostics);\n                }\n                else if (previousGlobalDiagnosticsSize === 0 && currentGlobalDiagnostics.length > 0) {\n                    // If the arrays are the same reference, but the length has changed, a single\n                    // new diagnostic was added as DiagnosticCollection attempts to reuse the\n                    // same array.\n                    return ts.concatenate(currentGlobalDiagnostics, semanticDiagnostics);\n                }\n                return semanticDiagnostics;\n            }\n            // Global diagnostics are always added when a file is not provided to\n            // getDiagnostics\n            ts.forEach(host.getSourceFiles(), checkSourceFile);\n            return diagnostics.getDiagnostics();\n        }\n        function getGlobalDiagnostics() {\n            throwIfNonDiagnosticsProducing();\n            return diagnostics.getGlobalDiagnostics();\n        }\n        function throwIfNonDiagnosticsProducing() {\n            if (!produceDiagnostics) {\n                throw new Error(\"Trying to get diagnostics from a type checker that does not produce them.\");\n            }\n        }\n        // Language service support\n        function isInsideWithStatementBody(node) {\n            if (node) {\n                while (node.parent) {\n                    if (node.parent.kind === 217 /* WithStatement */ && node.parent.statement === node) {\n                        return true;\n                    }\n                    node = node.parent;\n                }\n            }\n            return false;\n        }\n        function getSymbolsInScope(location, meaning) {\n            var symbols = ts.createMap();\n            var memberFlags = 0 /* None */;\n            if (isInsideWithStatementBody(location)) {\n                // We cannot answer semantic questions within a with block, do not proceed any further\n                return [];\n            }\n            populateSymbols();\n            return symbolsToArray(symbols);\n            function populateSymbols() {\n                while (location) {\n                    if (location.locals && !isGlobalSourceFile(location)) {\n                        copySymbols(location.locals, meaning);\n                    }\n                    switch (location.kind) {\n                        case 261 /* SourceFile */:\n                            if (!ts.isExternalOrCommonJsModule(location)) {\n                                break;\n                            }\n                        case 230 /* ModuleDeclaration */:\n                            copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */);\n                            break;\n                        case 229 /* EnumDeclaration */:\n                            copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */);\n                            break;\n                        case 197 /* ClassExpression */:\n                            var className = location.name;\n                            if (className) {\n                                copySymbol(location.symbol, meaning);\n                            }\n                        // fall through; this fall-through is necessary because we would like to handle\n                        // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration\n                        case 226 /* ClassDeclaration */:\n                        case 227 /* InterfaceDeclaration */:\n                            // If we didn't come from static member of class or interface,\n                            // add the type parameters into the symbol table\n                            // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol.\n                            // Note: that the memberFlags come from previous iteration.\n                            if (!(memberFlags & 32 /* Static */)) {\n                                copySymbols(getSymbolOfNode(location).members, meaning & 793064 /* Type */);\n                            }\n                            break;\n                        case 184 /* FunctionExpression */:\n                            var funcName = location.name;\n                            if (funcName) {\n                                copySymbol(location.symbol, meaning);\n                            }\n                            break;\n                    }\n                    if (ts.introducesArgumentsExoticObject(location)) {\n                        copySymbol(argumentsSymbol, meaning);\n                    }\n                    memberFlags = ts.getModifierFlags(location);\n                    location = location.parent;\n                }\n                copySymbols(globals, meaning);\n            }\n            /**\n             * Copy the given symbol into symbol tables if the symbol has the given meaning\n             * and it doesn't already existed in the symbol table\n             * @param key a key for storing in symbol table; if undefined, use symbol.name\n             * @param symbol the symbol to be added into symbol table\n             * @param meaning meaning of symbol to filter by before adding to symbol table\n             */\n            function copySymbol(symbol, meaning) {\n                if (symbol.flags & meaning) {\n                    var id = symbol.name;\n                    // We will copy all symbol regardless of its reserved name because\n                    // symbolsToArray will check whether the key is a reserved name and\n                    // it will not copy symbol with reserved name to the array\n                    if (!symbols[id]) {\n                        symbols[id] = symbol;\n                    }\n                }\n            }\n            function copySymbols(source, meaning) {\n                if (meaning) {\n                    for (var id in source) {\n                        var symbol = source[id];\n                        copySymbol(symbol, meaning);\n                    }\n                }\n            }\n        }\n        function isTypeDeclarationName(name) {\n            return name.kind === 70 /* Identifier */ &&\n                isTypeDeclaration(name.parent) &&\n                name.parent.name === name;\n        }\n        function isTypeDeclaration(node) {\n            switch (node.kind) {\n                case 143 /* TypeParameter */:\n                case 226 /* ClassDeclaration */:\n                case 227 /* InterfaceDeclaration */:\n                case 228 /* TypeAliasDeclaration */:\n                case 229 /* EnumDeclaration */:\n                    return true;\n            }\n        }\n        // True if the given identifier is part of a type reference\n        function isTypeReferenceIdentifier(entityName) {\n            var node = entityName;\n            while (node.parent && node.parent.kind === 141 /* QualifiedName */) {\n                node = node.parent;\n            }\n            return node.parent && (node.parent.kind === 157 /* TypeReference */ || node.parent.kind === 272 /* JSDocTypeReference */);\n        }\n        function isHeritageClauseElementIdentifier(entityName) {\n            var node = entityName;\n            while (node.parent && node.parent.kind === 177 /* PropertyAccessExpression */) {\n                node = node.parent;\n            }\n            return node.parent && node.parent.kind === 199 /* ExpressionWithTypeArguments */;\n        }\n        function forEachEnclosingClass(node, callback) {\n            var result;\n            while (true) {\n                node = ts.getContainingClass(node);\n                if (!node)\n                    break;\n                if (result = callback(node))\n                    break;\n            }\n            return result;\n        }\n        function isNodeWithinClass(node, classDeclaration) {\n            return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; });\n        }\n        function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) {\n            while (nodeOnRightSide.parent.kind === 141 /* QualifiedName */) {\n                nodeOnRightSide = nodeOnRightSide.parent;\n            }\n            if (nodeOnRightSide.parent.kind === 234 /* ImportEqualsDeclaration */) {\n                return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent;\n            }\n            if (nodeOnRightSide.parent.kind === 240 /* ExportAssignment */) {\n                return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent;\n            }\n            return undefined;\n        }\n        function isInRightSideOfImportOrExportAssignment(node) {\n            return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined;\n        }\n        function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) {\n            if (ts.isDeclarationName(entityName)) {\n                return getSymbolOfNode(entityName.parent);\n            }\n            if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 177 /* PropertyAccessExpression */) {\n                var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent);\n                switch (specialPropertyAssignmentKind) {\n                    case 1 /* ExportsProperty */:\n                    case 3 /* PrototypeProperty */:\n                        return getSymbolOfNode(entityName.parent);\n                    case 4 /* ThisProperty */:\n                    case 2 /* ModuleExports */:\n                        return getSymbolOfNode(entityName.parent.parent);\n                    default:\n                }\n            }\n            if (entityName.parent.kind === 240 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {\n                return resolveEntityName(entityName, \n                /*all meanings*/ 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */);\n            }\n            if (entityName.kind !== 177 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) {\n                // Since we already checked for ExportAssignment, this really could only be an Import\n                var importEqualsDeclaration = ts.getAncestor(entityName, 234 /* ImportEqualsDeclaration */);\n                ts.Debug.assert(importEqualsDeclaration !== undefined);\n                return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true);\n            }\n            if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {\n                entityName = entityName.parent;\n            }\n            if (isHeritageClauseElementIdentifier(entityName)) {\n                var meaning = 0 /* None */;\n                // In an interface or class, we're definitely interested in a type.\n                if (entityName.parent.kind === 199 /* ExpressionWithTypeArguments */) {\n                    meaning = 793064 /* Type */;\n                    // In a class 'extends' clause we are also looking for a value.\n                    if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {\n                        meaning |= 107455 /* Value */;\n                    }\n                }\n                else {\n                    meaning = 1920 /* Namespace */;\n                }\n                meaning |= 8388608 /* Alias */;\n                return resolveEntityName(entityName, meaning);\n            }\n            else if (ts.isPartOfExpression(entityName)) {\n                if (ts.nodeIsMissing(entityName)) {\n                    // Missing entity name.\n                    return undefined;\n                }\n                if (entityName.kind === 70 /* Identifier */) {\n                    if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) {\n                        return getIntrinsicTagSymbol(entityName.parent);\n                    }\n                    return resolveEntityName(entityName, 107455 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);\n                }\n                else if (entityName.kind === 177 /* PropertyAccessExpression */) {\n                    var symbol = getNodeLinks(entityName).resolvedSymbol;\n                    if (!symbol) {\n                        checkPropertyAccessExpression(entityName);\n                    }\n                    return getNodeLinks(entityName).resolvedSymbol;\n                }\n                else if (entityName.kind === 141 /* QualifiedName */) {\n                    var symbol = getNodeLinks(entityName).resolvedSymbol;\n                    if (!symbol) {\n                        checkQualifiedName(entityName);\n                    }\n                    return getNodeLinks(entityName).resolvedSymbol;\n                }\n            }\n            else if (isTypeReferenceIdentifier(entityName)) {\n                var meaning = (entityName.parent.kind === 157 /* TypeReference */ || entityName.parent.kind === 272 /* JSDocTypeReference */) ? 793064 /* Type */ : 1920 /* Namespace */;\n                return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);\n            }\n            else if (entityName.parent.kind === 250 /* JsxAttribute */) {\n                return getJsxAttributePropertySymbol(entityName.parent);\n            }\n            if (entityName.parent.kind === 156 /* TypePredicate */) {\n                return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */);\n            }\n            // Do we want to return undefined here?\n            return undefined;\n        }\n        function getSymbolAtLocation(node) {\n            if (node.kind === 261 /* SourceFile */) {\n                return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined;\n            }\n            if (isInsideWithStatementBody(node)) {\n                // We cannot answer semantic questions within a with block, do not proceed any further\n                return undefined;\n            }\n            if (ts.isDeclarationName(node)) {\n                // This is a declaration, call getSymbolOfNode\n                return getSymbolOfNode(node.parent);\n            }\n            else if (ts.isLiteralComputedPropertyDeclarationName(node)) {\n                return getSymbolOfNode(node.parent.parent);\n            }\n            if (node.kind === 70 /* Identifier */) {\n                if (isInRightSideOfImportOrExportAssignment(node)) {\n                    return getSymbolOfEntityNameOrPropertyAccessExpression(node);\n                }\n                else if (node.parent.kind === 174 /* BindingElement */ &&\n                    node.parent.parent.kind === 172 /* ObjectBindingPattern */ &&\n                    node === node.parent.propertyName) {\n                    var typeOfPattern = getTypeOfNode(node.parent.parent);\n                    var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text);\n                    if (propertyDeclaration) {\n                        return propertyDeclaration;\n                    }\n                }\n            }\n            switch (node.kind) {\n                case 70 /* Identifier */:\n                case 177 /* PropertyAccessExpression */:\n                case 141 /* QualifiedName */:\n                    return getSymbolOfEntityNameOrPropertyAccessExpression(node);\n                case 98 /* ThisKeyword */:\n                    var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);\n                    if (ts.isFunctionLike(container)) {\n                        var sig = getSignatureFromDeclaration(container);\n                        if (sig.thisParameter) {\n                            return sig.thisParameter;\n                        }\n                    }\n                // fallthrough\n                case 96 /* SuperKeyword */:\n                    var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node);\n                    return type.symbol;\n                case 167 /* ThisType */:\n                    return getTypeFromTypeNode(node).symbol;\n                case 122 /* ConstructorKeyword */:\n                    // constructor keyword for an overload, should take us to the definition if it exist\n                    var constructorDeclaration = node.parent;\n                    if (constructorDeclaration && constructorDeclaration.kind === 150 /* Constructor */) {\n                        return constructorDeclaration.parent.symbol;\n                    }\n                    return undefined;\n                case 9 /* StringLiteral */:\n                    // External module name in an import declaration\n                    if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) &&\n                        ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) ||\n                        ((node.parent.kind === 235 /* ImportDeclaration */ || node.parent.kind === 241 /* ExportDeclaration */) &&\n                            node.parent.moduleSpecifier === node)) {\n                        return resolveExternalModuleName(node, node);\n                    }\n                    if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteral*/ false)) {\n                        return resolveExternalModuleName(node, node);\n                    }\n                // Fall through\n                case 8 /* NumericLiteral */:\n                    // index access\n                    if (node.parent.kind === 178 /* ElementAccessExpression */ && node.parent.argumentExpression === node) {\n                        var objectType = getTypeOfExpression(node.parent.expression);\n                        if (objectType === unknownType)\n                            return undefined;\n                        var apparentType = getApparentType(objectType);\n                        if (apparentType === unknownType)\n                            return undefined;\n                        return getPropertyOfType(apparentType, node.text);\n                    }\n                    break;\n            }\n            return undefined;\n        }\n        function getShorthandAssignmentValueSymbol(location) {\n            // The function returns a value symbol of an identifier in the short-hand property assignment.\n            // This is necessary as an identifier in short-hand property assignment can contains two meaning:\n            // property name and property value.\n            if (location && location.kind === 258 /* ShorthandPropertyAssignment */) {\n                return resolveEntityName(location.name, 107455 /* Value */ | 8388608 /* Alias */);\n            }\n            return undefined;\n        }\n        /** Returns the target of an export specifier without following aliases */\n        function getExportSpecifierLocalTargetSymbol(node) {\n            return node.parent.parent.moduleSpecifier ?\n                getExternalModuleMember(node.parent.parent, node) :\n                resolveEntityName(node.propertyName || node.name, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */);\n        }\n        function getTypeOfNode(node) {\n            if (isInsideWithStatementBody(node)) {\n                // We cannot answer semantic questions within a with block, do not proceed any further\n                return unknownType;\n            }\n            if (ts.isPartOfTypeNode(node)) {\n                return getTypeFromTypeNode(node);\n            }\n            if (ts.isPartOfExpression(node)) {\n                return getRegularTypeOfExpression(node);\n            }\n            if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) {\n                // A SyntaxKind.ExpressionWithTypeArguments is considered a type node, except when it occurs in the\n                // extends clause of a class. We handle that case here.\n                return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0];\n            }\n            if (isTypeDeclaration(node)) {\n                // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration\n                var symbol = getSymbolOfNode(node);\n                return getDeclaredTypeOfSymbol(symbol);\n            }\n            if (isTypeDeclarationName(node)) {\n                var symbol = getSymbolAtLocation(node);\n                return symbol && getDeclaredTypeOfSymbol(symbol);\n            }\n            if (ts.isDeclaration(node)) {\n                // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration\n                var symbol = getSymbolOfNode(node);\n                return getTypeOfSymbol(symbol);\n            }\n            if (ts.isDeclarationName(node)) {\n                var symbol = getSymbolAtLocation(node);\n                return symbol && getTypeOfSymbol(symbol);\n            }\n            if (ts.isBindingPattern(node)) {\n                return getTypeForVariableLikeDeclaration(node.parent, /*includeOptionality*/ true);\n            }\n            if (isInRightSideOfImportOrExportAssignment(node)) {\n                var symbol = getSymbolAtLocation(node);\n                var declaredType = symbol && getDeclaredTypeOfSymbol(symbol);\n                return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol);\n            }\n            return unknownType;\n        }\n        // Gets the type of object literal or array literal of destructuring assignment.\n        // { a } from\n        //     for ( { a } of elems) {\n        //     }\n        // [ a ] from\n        //     [a] = [ some array ...]\n        function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) {\n            ts.Debug.assert(expr.kind === 176 /* ObjectLiteralExpression */ || expr.kind === 175 /* ArrayLiteralExpression */);\n            // If this is from \"for of\"\n            //     for ( { a } of elems) {\n            //     }\n            if (expr.parent.kind === 213 /* ForOfStatement */) {\n                var iteratedType = checkRightHandSideOfForOf(expr.parent.expression);\n                return checkDestructuringAssignment(expr, iteratedType || unknownType);\n            }\n            // If this is from \"for\" initializer\n            //     for ({a } = elems[0];.....) { }\n            if (expr.parent.kind === 192 /* BinaryExpression */) {\n                var iteratedType = getTypeOfExpression(expr.parent.right);\n                return checkDestructuringAssignment(expr, iteratedType || unknownType);\n            }\n            // If this is from nested object binding pattern\n            //     for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) {\n            if (expr.parent.kind === 257 /* PropertyAssignment */) {\n                var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent);\n                return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent);\n            }\n            // Array literal assignment - array destructuring pattern\n            ts.Debug.assert(expr.parent.kind === 175 /* ArrayLiteralExpression */);\n            //    [{ property1: p1, property2 }] = elems;\n            var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent);\n            var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false) || unknownType;\n            return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType);\n        }\n        // Gets the property symbol corresponding to the property in destructuring assignment\n        // 'property1' from\n        //     for ( { property1: a } of elems) {\n        //     }\n        // 'property1' at location 'a' from:\n        //     [a] = [ property1, property2 ]\n        function getPropertySymbolOfDestructuringAssignment(location) {\n            // Get the type of the object or array literal and then look for property of given name in the type\n            var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent);\n            return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text);\n        }\n        function getRegularTypeOfExpression(expr) {\n            if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) {\n                expr = expr.parent;\n            }\n            return getRegularTypeOfLiteralType(getTypeOfExpression(expr));\n        }\n        /**\n          * Gets either the static or instance type of a class element, based on\n          * whether the element is declared as \"static\".\n          */\n        function getParentTypeOfClassElement(node) {\n            var classSymbol = getSymbolOfNode(node.parent);\n            return ts.getModifierFlags(node) & 32 /* Static */\n                ? getTypeOfSymbol(classSymbol)\n                : getDeclaredTypeOfSymbol(classSymbol);\n        }\n        // Return the list of properties of the given type, augmented with properties from Function\n        // if the type has call or construct signatures\n        function getAugmentedPropertiesOfType(type) {\n            type = getApparentType(type);\n            var propsByName = createSymbolTable(getPropertiesOfType(type));\n            if (getSignaturesOfType(type, 0 /* Call */).length || getSignaturesOfType(type, 1 /* Construct */).length) {\n                ts.forEach(getPropertiesOfType(globalFunctionType), function (p) {\n                    if (!propsByName[p.name]) {\n                        propsByName[p.name] = p;\n                    }\n                });\n            }\n            return getNamedMembers(propsByName);\n        }\n        function getRootSymbols(symbol) {\n            if (symbol.flags & 268435456 /* SyntheticProperty */) {\n                var symbols_3 = [];\n                var name_26 = symbol.name;\n                ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) {\n                    var symbol = getPropertyOfType(t, name_26);\n                    if (symbol) {\n                        symbols_3.push(symbol);\n                    }\n                });\n                return symbols_3;\n            }\n            else if (symbol.flags & 67108864 /* Transient */) {\n                if (symbol.leftSpread) {\n                    var links = symbol;\n                    return [links.leftSpread, links.rightSpread];\n                }\n                var target = void 0;\n                var next = symbol;\n                while (next = getSymbolLinks(next).target) {\n                    target = next;\n                }\n                if (target) {\n                    return [target];\n                }\n            }\n            return [symbol];\n        }\n        // Emitter support\n        function isArgumentsLocalBinding(node) {\n            if (!ts.isGeneratedIdentifier(node)) {\n                node = ts.getParseTreeNode(node, ts.isIdentifier);\n                if (node) {\n                    return getReferencedValueSymbol(node) === argumentsSymbol;\n                }\n            }\n            return false;\n        }\n        function moduleExportsSomeValue(moduleReferenceExpression) {\n            var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);\n            if (!moduleSymbol || ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {\n                // If the module is not found or is shorthand, assume that it may export a value.\n                return true;\n            }\n            var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);\n            // if module has export assignment then 'resolveExternalModuleSymbol' will return resolved symbol for export assignment\n            // otherwise it will return moduleSymbol itself\n            moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);\n            var symbolLinks = getSymbolLinks(moduleSymbol);\n            if (symbolLinks.exportsSomeValue === undefined) {\n                // for export assignments - check if resolved symbol for RHS is itself a value\n                // otherwise - check if at least one export is value\n                symbolLinks.exportsSomeValue = hasExportAssignment\n                    ? !!(moduleSymbol.flags & 107455 /* Value */)\n                    : ts.forEachProperty(getExportsOfModule(moduleSymbol), isValue);\n            }\n            return symbolLinks.exportsSomeValue;\n            function isValue(s) {\n                s = resolveSymbol(s);\n                return s && !!(s.flags & 107455 /* Value */);\n            }\n        }\n        function isNameOfModuleOrEnumDeclaration(node) {\n            var parent = node.parent;\n            return parent && ts.isModuleOrEnumDeclaration(parent) && node === parent.name;\n        }\n        // When resolved as an expression identifier, if the given node references an exported entity, return the declaration\n        // node of the exported entity's container. Otherwise, return undefined.\n        function getReferencedExportContainer(node, prefixLocals) {\n            node = ts.getParseTreeNode(node, ts.isIdentifier);\n            if (node) {\n                // When resolving the export container for the name of a module or enum\n                // declaration, we need to start resolution at the declaration's container.\n                // Otherwise, we could incorrectly resolve the export container as the\n                // declaration if it contains an exported member with the same name.\n                var symbol = getReferencedValueSymbol(node, /*startInDeclarationContainer*/ isNameOfModuleOrEnumDeclaration(node));\n                if (symbol) {\n                    if (symbol.flags & 1048576 /* ExportValue */) {\n                        // If we reference an exported entity within the same module declaration, then whether\n                        // we prefix depends on the kind of entity. SymbolFlags.ExportHasLocal encompasses all the\n                        // kinds that we do NOT prefix.\n                        var exportSymbol = getMergedSymbol(symbol.exportSymbol);\n                        if (!prefixLocals && exportSymbol.flags & 944 /* ExportHasLocal */) {\n                            return undefined;\n                        }\n                        symbol = exportSymbol;\n                    }\n                    var parentSymbol = getParentOfSymbol(symbol);\n                    if (parentSymbol) {\n                        if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 261 /* SourceFile */) {\n                            var symbolFile = parentSymbol.valueDeclaration;\n                            var referenceFile = ts.getSourceFileOfNode(node);\n                            // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined.\n                            var symbolIsUmdExport = symbolFile !== referenceFile;\n                            return symbolIsUmdExport ? undefined : symbolFile;\n                        }\n                        for (var n = node.parent; n; n = n.parent) {\n                            if (ts.isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol) {\n                                return n;\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        // When resolved as an expression identifier, if the given node references an import, return the declaration of\n        // that import. Otherwise, return undefined.\n        function getReferencedImportDeclaration(node) {\n            node = ts.getParseTreeNode(node, ts.isIdentifier);\n            if (node) {\n                var symbol = getReferencedValueSymbol(node);\n                if (symbol && symbol.flags & 8388608 /* Alias */) {\n                    return getDeclarationOfAliasSymbol(symbol);\n                }\n            }\n            return undefined;\n        }\n        function isSymbolOfDeclarationWithCollidingName(symbol) {\n            if (symbol.flags & 418 /* BlockScoped */) {\n                var links = getSymbolLinks(symbol);\n                if (links.isDeclarationWithCollidingName === undefined) {\n                    var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);\n                    if (ts.isStatementWithLocals(container)) {\n                        var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration);\n                        if (!!resolveName(container.parent, symbol.name, 107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined)) {\n                            // redeclaration - always should be renamed\n                            links.isDeclarationWithCollidingName = true;\n                        }\n                        else if (nodeLinks_1.flags & 131072 /* CapturedBlockScopedBinding */) {\n                            // binding is captured in the function\n                            // should be renamed if:\n                            // - binding is not top level - top level bindings never collide with anything\n                            // AND\n                            //   - binding is not declared in loop, should be renamed to avoid name reuse across siblings\n                            //     let a, b\n                            //     { let x = 1; a = () => x;  }\n                            //     { let x = 100; b = () => x; }\n                            //     console.log(a()); // should print '1'\n                            //     console.log(b()); // should print '100'\n                            //     OR\n                            //   - binding is declared inside loop but not in inside initializer of iteration statement or directly inside loop body\n                            //     * variables from initializer are passed to rewritten loop body as parameters so they are not captured directly\n                            //     * variables that are declared immediately in loop body will become top level variable after loop is rewritten and thus\n                            //       they will not collide with anything\n                            var isDeclaredInLoop = nodeLinks_1.flags & 262144 /* BlockScopedBindingInLoop */;\n                            var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false);\n                            var inLoopBodyBlock = container.kind === 204 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false);\n                            links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock));\n                        }\n                        else {\n                            links.isDeclarationWithCollidingName = false;\n                        }\n                    }\n                }\n                return links.isDeclarationWithCollidingName;\n            }\n            return false;\n        }\n        // When resolved as an expression identifier, if the given node references a nested block scoped entity with\n        // a name that either hides an existing name or might hide it when compiled downlevel,\n        // return the declaration of that entity. Otherwise, return undefined.\n        function getReferencedDeclarationWithCollidingName(node) {\n            if (!ts.isGeneratedIdentifier(node)) {\n                node = ts.getParseTreeNode(node, ts.isIdentifier);\n                if (node) {\n                    var symbol = getReferencedValueSymbol(node);\n                    if (symbol && isSymbolOfDeclarationWithCollidingName(symbol)) {\n                        return symbol.valueDeclaration;\n                    }\n                }\n            }\n            return undefined;\n        }\n        // Return true if the given node is a declaration of a nested block scoped entity with a name that either hides an\n        // existing name or might hide a name when compiled downlevel\n        function isDeclarationWithCollidingName(node) {\n            node = ts.getParseTreeNode(node, ts.isDeclaration);\n            if (node) {\n                var symbol = getSymbolOfNode(node);\n                if (symbol) {\n                    return isSymbolOfDeclarationWithCollidingName(symbol);\n                }\n            }\n            return false;\n        }\n        function isValueAliasDeclaration(node) {\n            node = ts.getParseTreeNode(node);\n            if (node === undefined) {\n                // A synthesized node comes from an emit transformation and is always a value.\n                return true;\n            }\n            switch (node.kind) {\n                case 234 /* ImportEqualsDeclaration */:\n                case 236 /* ImportClause */:\n                case 237 /* NamespaceImport */:\n                case 239 /* ImportSpecifier */:\n                case 243 /* ExportSpecifier */:\n                    return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol);\n                case 241 /* ExportDeclaration */:\n                    var exportClause = node.exportClause;\n                    return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration);\n                case 240 /* ExportAssignment */:\n                    return node.expression\n                        && node.expression.kind === 70 /* Identifier */\n                        ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol)\n                        : true;\n            }\n            return false;\n        }\n        function isTopLevelValueImportEqualsWithEntityName(node) {\n            node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration);\n            if (node === undefined || node.parent.kind !== 261 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) {\n                // parent is not source file or it is not reference to internal module\n                return false;\n            }\n            var isValue = isAliasResolvedToValue(getSymbolOfNode(node));\n            return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference);\n        }\n        function isAliasResolvedToValue(symbol) {\n            var target = resolveAlias(symbol);\n            if (target === unknownSymbol) {\n                return true;\n            }\n            // const enums and modules that contain only const enums are not considered values from the emit perspective\n            // unless 'preserveConstEnums' option is set to true\n            return target.flags & 107455 /* Value */ &&\n                (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target));\n        }\n        function isConstEnumOrConstEnumOnlyModule(s) {\n            return isConstEnumSymbol(s) || s.constEnumOnlyModule;\n        }\n        function isReferencedAliasDeclaration(node, checkChildren) {\n            node = ts.getParseTreeNode(node);\n            // Purely synthesized nodes are always emitted.\n            if (node === undefined) {\n                return true;\n            }\n            if (ts.isAliasSymbolDeclaration(node)) {\n                var symbol = getSymbolOfNode(node);\n                if (symbol && getSymbolLinks(symbol).referenced) {\n                    return true;\n                }\n            }\n            if (checkChildren) {\n                return ts.forEachChild(node, function (node) { return isReferencedAliasDeclaration(node, checkChildren); });\n            }\n            return false;\n        }\n        function isImplementationOfOverload(node) {\n            if (ts.nodeIsPresent(node.body)) {\n                var symbol = getSymbolOfNode(node);\n                var signaturesOfSymbol = getSignaturesOfSymbol(symbol);\n                // If this function body corresponds to function with multiple signature, it is implementation of overload\n                // e.g.: function foo(a: string): string;\n                //       function foo(a: number): number;\n                //       function foo(a: any) { // This is implementation of the overloads\n                //           return a;\n                //       }\n                return signaturesOfSymbol.length > 1 ||\n                    // If there is single signature for the symbol, it is overload if that signature isn't coming from the node\n                    // e.g.: function foo(a: string): string;\n                    //       function foo(a: any) { // This is implementation of the overloads\n                    //           return a;\n                    //       }\n                    (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node);\n            }\n            return false;\n        }\n        function getNodeCheckFlags(node) {\n            node = ts.getParseTreeNode(node);\n            return node ? getNodeLinks(node).flags : undefined;\n        }\n        function getEnumMemberValue(node) {\n            computeEnumMemberValues(node.parent);\n            return getNodeLinks(node).enumMemberValue;\n        }\n        function getConstantValue(node) {\n            if (node.kind === 260 /* EnumMember */) {\n                return getEnumMemberValue(node);\n            }\n            var symbol = getNodeLinks(node).resolvedSymbol;\n            if (symbol && (symbol.flags & 8 /* EnumMember */)) {\n                // inline property\\index accesses only for const enums\n                if (ts.isConstEnumDeclaration(symbol.valueDeclaration.parent)) {\n                    return getEnumMemberValue(symbol.valueDeclaration);\n                }\n            }\n            return undefined;\n        }\n        function isFunctionType(type) {\n            return type.flags & 32768 /* Object */ && getSignaturesOfType(type, 0 /* Call */).length > 0;\n        }\n        function getTypeReferenceSerializationKind(typeName, location) {\n            // Resolve the symbol as a value to ensure the type can be reached at runtime during emit.\n            var valueSymbol = resolveEntityName(typeName, 107455 /* Value */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);\n            var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol();\n            if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) {\n                return ts.TypeReferenceSerializationKind.Promise;\n            }\n            var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined;\n            if (constructorType && isConstructorType(constructorType)) {\n                return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue;\n            }\n            // Resolve the symbol as a type so that we can provide a more useful hint for the type serializer.\n            var typeSymbol = resolveEntityName(typeName, 793064 /* Type */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);\n            // We might not be able to resolve type symbol so use unknown type in that case (eg error case)\n            if (!typeSymbol) {\n                return ts.TypeReferenceSerializationKind.ObjectType;\n            }\n            var type = getDeclaredTypeOfSymbol(typeSymbol);\n            if (type === unknownType) {\n                return ts.TypeReferenceSerializationKind.Unknown;\n            }\n            else if (type.flags & 1 /* Any */) {\n                return ts.TypeReferenceSerializationKind.ObjectType;\n            }\n            else if (isTypeOfKind(type, 1024 /* Void */ | 6144 /* Nullable */ | 8192 /* Never */)) {\n                return ts.TypeReferenceSerializationKind.VoidNullableOrNeverType;\n            }\n            else if (isTypeOfKind(type, 136 /* BooleanLike */)) {\n                return ts.TypeReferenceSerializationKind.BooleanType;\n            }\n            else if (isTypeOfKind(type, 340 /* NumberLike */)) {\n                return ts.TypeReferenceSerializationKind.NumberLikeType;\n            }\n            else if (isTypeOfKind(type, 262178 /* StringLike */)) {\n                return ts.TypeReferenceSerializationKind.StringLikeType;\n            }\n            else if (isTupleType(type)) {\n                return ts.TypeReferenceSerializationKind.ArrayLikeType;\n            }\n            else if (isTypeOfKind(type, 512 /* ESSymbol */)) {\n                return ts.TypeReferenceSerializationKind.ESSymbolType;\n            }\n            else if (isFunctionType(type)) {\n                return ts.TypeReferenceSerializationKind.TypeWithCallSignature;\n            }\n            else if (isArrayType(type)) {\n                return ts.TypeReferenceSerializationKind.ArrayLikeType;\n            }\n            else {\n                return ts.TypeReferenceSerializationKind.ObjectType;\n            }\n        }\n        function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) {\n            // Get type of the symbol if this is the valid symbol otherwise get type at location\n            var symbol = getSymbolOfNode(declaration);\n            var type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */))\n                ? getWidenedLiteralType(getTypeOfSymbol(symbol))\n                : unknownType;\n            getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);\n        }\n        function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) {\n            var signature = getSignatureFromDeclaration(signatureDeclaration);\n            getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags);\n        }\n        function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) {\n            var type = getWidenedType(getRegularTypeOfExpression(expr));\n            getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);\n        }\n        function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) {\n            var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node));\n            resolveBaseTypesOfClass(classType);\n            var baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType;\n            getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags);\n        }\n        function hasGlobalName(name) {\n            return !!globals[name];\n        }\n        function getReferencedValueSymbol(reference, startInDeclarationContainer) {\n            var resolvedSymbol = getNodeLinks(reference).resolvedSymbol;\n            if (resolvedSymbol) {\n                return resolvedSymbol;\n            }\n            var location = reference;\n            if (startInDeclarationContainer) {\n                // When resolving the name of a declaration as a value, we need to start resolution\n                // at a point outside of the declaration.\n                var parent_11 = reference.parent;\n                if (ts.isDeclaration(parent_11) && reference === parent_11.name) {\n                    location = getDeclarationContainer(parent_11);\n                }\n            }\n            return resolveName(location, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);\n        }\n        function getReferencedValueDeclaration(reference) {\n            if (!ts.isGeneratedIdentifier(reference)) {\n                reference = ts.getParseTreeNode(reference, ts.isIdentifier);\n                if (reference) {\n                    var symbol = getReferencedValueSymbol(reference);\n                    if (symbol) {\n                        return getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration;\n                    }\n                }\n            }\n            return undefined;\n        }\n        function isLiteralConstDeclaration(node) {\n            if (ts.isConst(node)) {\n                var type = getTypeOfSymbol(getSymbolOfNode(node));\n                return !!(type.flags & 96 /* StringOrNumberLiteral */ && type.flags & 1048576 /* FreshLiteral */);\n            }\n            return false;\n        }\n        function writeLiteralConstValue(node, writer) {\n            var type = getTypeOfSymbol(getSymbolOfNode(node));\n            writer.writeStringLiteral(literalTypeToString(type));\n        }\n        function createResolver() {\n            // this variable and functions that use it are deliberately moved here from the outer scope\n            // to avoid scope pollution\n            var resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives();\n            var fileToDirective;\n            if (resolvedTypeReferenceDirectives) {\n                // populate reverse mapping: file path -> type reference directive that was resolved to this file\n                fileToDirective = ts.createFileMap();\n                for (var key in resolvedTypeReferenceDirectives) {\n                    var resolvedDirective = resolvedTypeReferenceDirectives[key];\n                    if (!resolvedDirective) {\n                        continue;\n                    }\n                    var file = host.getSourceFile(resolvedDirective.resolvedFileName);\n                    fileToDirective.set(file.path, key);\n                }\n            }\n            return {\n                getReferencedExportContainer: getReferencedExportContainer,\n                getReferencedImportDeclaration: getReferencedImportDeclaration,\n                getReferencedDeclarationWithCollidingName: getReferencedDeclarationWithCollidingName,\n                isDeclarationWithCollidingName: isDeclarationWithCollidingName,\n                isValueAliasDeclaration: isValueAliasDeclaration,\n                hasGlobalName: hasGlobalName,\n                isReferencedAliasDeclaration: isReferencedAliasDeclaration,\n                getNodeCheckFlags: getNodeCheckFlags,\n                isTopLevelValueImportEqualsWithEntityName: isTopLevelValueImportEqualsWithEntityName,\n                isDeclarationVisible: isDeclarationVisible,\n                isImplementationOfOverload: isImplementationOfOverload,\n                writeTypeOfDeclaration: writeTypeOfDeclaration,\n                writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration,\n                writeTypeOfExpression: writeTypeOfExpression,\n                writeBaseConstructorTypeOfClass: writeBaseConstructorTypeOfClass,\n                isSymbolAccessible: isSymbolAccessible,\n                isEntityNameVisible: isEntityNameVisible,\n                getConstantValue: getConstantValue,\n                collectLinkedAliases: collectLinkedAliases,\n                getReferencedValueDeclaration: getReferencedValueDeclaration,\n                getTypeReferenceSerializationKind: getTypeReferenceSerializationKind,\n                isOptionalParameter: isOptionalParameter,\n                moduleExportsSomeValue: moduleExportsSomeValue,\n                isArgumentsLocalBinding: isArgumentsLocalBinding,\n                getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration,\n                getTypeReferenceDirectivesForEntityName: getTypeReferenceDirectivesForEntityName,\n                getTypeReferenceDirectivesForSymbol: getTypeReferenceDirectivesForSymbol,\n                isLiteralConstDeclaration: isLiteralConstDeclaration,\n                writeLiteralConstValue: writeLiteralConstValue,\n                getJsxFactoryEntity: function () { return _jsxFactoryEntity; }\n            };\n            // defined here to avoid outer scope pollution\n            function getTypeReferenceDirectivesForEntityName(node) {\n                // program does not have any files with type reference directives - bail out\n                if (!fileToDirective) {\n                    return undefined;\n                }\n                // property access can only be used as values\n                // qualified names can only be used as types\\namespaces\n                // identifiers are treated as values only if they appear in type queries\n                var meaning = (node.kind === 177 /* PropertyAccessExpression */) || (node.kind === 70 /* Identifier */ && isInTypeQuery(node))\n                    ? 107455 /* Value */ | 1048576 /* ExportValue */\n                    : 793064 /* Type */ | 1920 /* Namespace */;\n                var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true);\n                return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined;\n            }\n            // defined here to avoid outer scope pollution\n            function getTypeReferenceDirectivesForSymbol(symbol, meaning) {\n                // program does not have any files with type reference directives - bail out\n                if (!fileToDirective) {\n                    return undefined;\n                }\n                if (!isSymbolFromTypeDeclarationFile(symbol)) {\n                    return undefined;\n                }\n                // check what declarations in the symbol can contribute to the target meaning\n                var typeReferenceDirectives;\n                for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    // check meaning of the local symbol to see if declaration needs to be analyzed further\n                    if (decl.symbol && decl.symbol.flags & meaning) {\n                        var file = ts.getSourceFileOfNode(decl);\n                        var typeReferenceDirective = fileToDirective.get(file.path);\n                        if (typeReferenceDirective) {\n                            (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective);\n                        }\n                        else {\n                            // found at least one entry that does not originate from type reference directive\n                            return undefined;\n                        }\n                    }\n                }\n                return typeReferenceDirectives;\n            }\n            function isSymbolFromTypeDeclarationFile(symbol) {\n                // bail out if symbol does not have associated declarations (i.e. this is transient symbol created for property in binding pattern)\n                if (!symbol.declarations) {\n                    return false;\n                }\n                // walk the parent chain for symbols to make sure that top level parent symbol is in the global scope\n                // external modules cannot define or contribute to type declaration files\n                var current = symbol;\n                while (true) {\n                    var parent_12 = getParentOfSymbol(current);\n                    if (parent_12) {\n                        current = parent_12;\n                    }\n                    else {\n                        break;\n                    }\n                }\n                if (current.valueDeclaration && current.valueDeclaration.kind === 261 /* SourceFile */ && current.flags & 512 /* ValueModule */) {\n                    return false;\n                }\n                // check that at least one declaration of top level symbol originates from type declaration file\n                for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    var file = ts.getSourceFileOfNode(decl);\n                    if (fileToDirective.contains(file.path)) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n        }\n        function getExternalModuleFileFromDeclaration(declaration) {\n            var specifier = ts.getExternalModuleName(declaration);\n            var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined);\n            if (!moduleSymbol) {\n                return undefined;\n            }\n            return ts.getDeclarationOfKind(moduleSymbol, 261 /* SourceFile */);\n        }\n        function initializeTypeChecker() {\n            // Bind all source files and propagate errors\n            for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) {\n                var file = _a[_i];\n                ts.bindSourceFile(file, compilerOptions);\n            }\n            // Initialize global symbol table\n            var augmentations;\n            for (var _b = 0, _c = host.getSourceFiles(); _b < _c.length; _b++) {\n                var file = _c[_b];\n                if (!ts.isExternalOrCommonJsModule(file)) {\n                    mergeSymbolTable(globals, file.locals);\n                }\n                if (file.patternAmbientModules && file.patternAmbientModules.length) {\n                    patternAmbientModules = ts.concatenate(patternAmbientModules, file.patternAmbientModules);\n                }\n                if (file.moduleAugmentations.length) {\n                    (augmentations || (augmentations = [])).push(file.moduleAugmentations);\n                }\n                if (file.symbol && file.symbol.globalExports) {\n                    // Merge in UMD exports with first-in-wins semantics (see #9771)\n                    var source = file.symbol.globalExports;\n                    for (var id in source) {\n                        if (!(id in globals)) {\n                            globals[id] = source[id];\n                        }\n                    }\n                }\n            }\n            if (augmentations) {\n                // merge module augmentations.\n                // this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed\n                for (var _d = 0, augmentations_1 = augmentations; _d < augmentations_1.length; _d++) {\n                    var list = augmentations_1[_d];\n                    for (var _e = 0, list_1 = list; _e < list_1.length; _e++) {\n                        var augmentation = list_1[_e];\n                        mergeModuleAugmentation(augmentation);\n                    }\n                }\n            }\n            // Setup global builtins\n            addToSymbolTable(globals, builtinGlobals, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0);\n            getSymbolLinks(undefinedSymbol).type = undefinedWideningType;\n            getSymbolLinks(argumentsSymbol).type = getGlobalType(\"IArguments\");\n            getSymbolLinks(unknownSymbol).type = unknownType;\n            // Initialize special types\n            globalArrayType = getGlobalType(\"Array\", /*arity*/ 1);\n            globalObjectType = getGlobalType(\"Object\");\n            globalFunctionType = getGlobalType(\"Function\");\n            globalStringType = getGlobalType(\"String\");\n            globalNumberType = getGlobalType(\"Number\");\n            globalBooleanType = getGlobalType(\"Boolean\");\n            globalRegExpType = getGlobalType(\"RegExp\");\n            jsxElementType = getExportedTypeFromNamespace(\"JSX\", JsxNames.Element);\n            getGlobalClassDecoratorType = ts.memoize(function () { return getGlobalType(\"ClassDecorator\"); });\n            getGlobalPropertyDecoratorType = ts.memoize(function () { return getGlobalType(\"PropertyDecorator\"); });\n            getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType(\"MethodDecorator\"); });\n            getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType(\"ParameterDecorator\"); });\n            getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType(\"TypedPropertyDescriptor\", /*arity*/ 1); });\n            getGlobalESSymbolConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol(\"Symbol\"); });\n            getGlobalPromiseType = ts.memoize(function () { return getGlobalType(\"Promise\", /*arity*/ 1); });\n            tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol(\"Promise\", 793064 /* Type */, /*diagnostic*/ undefined) && getGlobalPromiseType(); });\n            getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType(\"PromiseLike\", /*arity*/ 1); });\n            getInstantiatedGlobalPromiseLikeType = ts.memoize(createInstantiatedPromiseLikeType);\n            getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol(\"Promise\"); });\n            tryGetGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalSymbol(\"Promise\", 107455 /* Value */, /*diagnostic*/ undefined) && getGlobalPromiseConstructorSymbol(); });\n            getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType(\"PromiseConstructorLike\"); });\n            getGlobalThenableType = ts.memoize(createThenableType);\n            getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType(\"TemplateStringsArray\"); });\n            if (languageVersion >= 2 /* ES2015 */) {\n                getGlobalESSymbolType = ts.memoize(function () { return getGlobalType(\"Symbol\"); });\n                getGlobalIterableType = ts.memoize(function () { return getGlobalType(\"Iterable\", /*arity*/ 1); });\n                getGlobalIteratorType = ts.memoize(function () { return getGlobalType(\"Iterator\", /*arity*/ 1); });\n                getGlobalIterableIteratorType = ts.memoize(function () { return getGlobalType(\"IterableIterator\", /*arity*/ 1); });\n            }\n            else {\n                getGlobalESSymbolType = ts.memoize(function () { return emptyObjectType; });\n                getGlobalIterableType = ts.memoize(function () { return emptyGenericType; });\n                getGlobalIteratorType = ts.memoize(function () { return emptyGenericType; });\n                getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; });\n            }\n            anyArrayType = createArrayType(anyType);\n            autoArrayType = createArrayType(autoType);\n            var symbol = getGlobalSymbol(\"ReadonlyArray\", 793064 /* Type */, /*diagnostic*/ undefined);\n            globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, /*arity*/ 1);\n            anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType;\n        }\n        function checkExternalEmitHelpers(location, helpers) {\n            if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) {\n                var sourceFile = ts.getSourceFileOfNode(location);\n                if (ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {\n                    var helpersModule = resolveHelpersModule(sourceFile, location);\n                    if (helpersModule !== unknownSymbol) {\n                        var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers;\n                        for (var helper = 1 /* FirstEmitHelper */; helper <= 128 /* LastEmitHelper */; helper <<= 1) {\n                            if (uncheckedHelpers & helper) {\n                                var name_27 = getHelperName(helper);\n                                var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name_27), 107455 /* Value */);\n                                if (!symbol) {\n                                    error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name_27);\n                                }\n                            }\n                        }\n                    }\n                    requestedExternalEmitHelpers |= helpers;\n                }\n            }\n        }\n        function getHelperName(helper) {\n            switch (helper) {\n                case 1 /* Extends */: return \"__extends\";\n                case 2 /* Assign */: return \"__assign\";\n                case 4 /* Rest */: return \"__rest\";\n                case 8 /* Decorate */: return \"__decorate\";\n                case 16 /* Metadata */: return \"__metadata\";\n                case 32 /* Param */: return \"__param\";\n                case 64 /* Awaiter */: return \"__awaiter\";\n                case 128 /* Generator */: return \"__generator\";\n            }\n        }\n        function resolveHelpersModule(node, errorNode) {\n            if (!externalHelpersModule) {\n                externalHelpersModule = resolveExternalModule(node, ts.externalHelpersModuleNameText, ts.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol;\n            }\n            return externalHelpersModule;\n        }\n        function createInstantiatedPromiseLikeType() {\n            var promiseLikeType = getGlobalPromiseLikeType();\n            if (promiseLikeType !== emptyGenericType) {\n                return createTypeReference(promiseLikeType, [anyType]);\n            }\n            return emptyObjectType;\n        }\n        function createThenableType() {\n            // build the thenable type that is used to verify against a non-promise \"thenable\" operand to `await`.\n            var thenPropertySymbol = createSymbol(67108864 /* Transient */ | 4 /* Property */, \"then\");\n            getSymbolLinks(thenPropertySymbol).type = globalFunctionType;\n            var thenableType = createObjectType(16 /* Anonymous */);\n            thenableType.properties = [thenPropertySymbol];\n            thenableType.members = createSymbolTable(thenableType.properties);\n            thenableType.callSignatures = [];\n            thenableType.constructSignatures = [];\n            return thenableType;\n        }\n        // GRAMMAR CHECKING\n        function checkGrammarDecorators(node) {\n            if (!node.decorators) {\n                return false;\n            }\n            if (!ts.nodeCanBeDecorated(node)) {\n                if (node.kind === 149 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) {\n                    return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload);\n                }\n                else {\n                    return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here);\n                }\n            }\n            else if (node.kind === 151 /* GetAccessor */ || node.kind === 152 /* SetAccessor */) {\n                var accessors = ts.getAllAccessorDeclarations(node.parent.members, node);\n                if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) {\n                    return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);\n                }\n            }\n            return false;\n        }\n        function checkGrammarModifiers(node) {\n            var quickResult = reportObviousModifierErrors(node);\n            if (quickResult !== undefined) {\n                return quickResult;\n            }\n            var lastStatic, lastPrivate, lastProtected, lastDeclare, lastAsync, lastReadonly;\n            var flags = 0 /* None */;\n            for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {\n                var modifier = _a[_i];\n                if (modifier.kind !== 130 /* ReadonlyKeyword */) {\n                    if (node.kind === 146 /* PropertySignature */ || node.kind === 148 /* MethodSignature */) {\n                        return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind));\n                    }\n                    if (node.kind === 155 /* IndexSignature */) {\n                        return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind));\n                    }\n                }\n                switch (modifier.kind) {\n                    case 75 /* ConstKeyword */:\n                        if (node.kind !== 229 /* EnumDeclaration */ && node.parent.kind === 226 /* ClassDeclaration */) {\n                            return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75 /* ConstKeyword */));\n                        }\n                        break;\n                    case 113 /* PublicKeyword */:\n                    case 112 /* ProtectedKeyword */:\n                    case 111 /* PrivateKeyword */:\n                        var text = visibilityToString(ts.modifierToFlag(modifier.kind));\n                        if (modifier.kind === 112 /* ProtectedKeyword */) {\n                            lastProtected = modifier;\n                        }\n                        else if (modifier.kind === 111 /* PrivateKeyword */) {\n                            lastPrivate = modifier;\n                        }\n                        if (flags & 28 /* AccessibilityModifier */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen);\n                        }\n                        else if (flags & 32 /* Static */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, \"static\");\n                        }\n                        else if (flags & 64 /* Readonly */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, \"readonly\");\n                        }\n                        else if (flags & 256 /* Async */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, \"async\");\n                        }\n                        else if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text);\n                        }\n                        else if (flags & 128 /* Abstract */) {\n                            if (modifier.kind === 111 /* PrivateKeyword */) {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, \"abstract\");\n                            }\n                            else {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, \"abstract\");\n                            }\n                        }\n                        flags |= ts.modifierToFlag(modifier.kind);\n                        break;\n                    case 114 /* StaticKeyword */:\n                        if (flags & 32 /* Static */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"static\");\n                        }\n                        else if (flags & 64 /* Readonly */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, \"static\", \"readonly\");\n                        }\n                        else if (flags & 256 /* Async */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, \"static\", \"async\");\n                        }\n                        else if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, \"static\");\n                        }\n                        else if (node.kind === 144 /* Parameter */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, \"static\");\n                        }\n                        else if (flags & 128 /* Abstract */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, \"static\", \"abstract\");\n                        }\n                        flags |= 32 /* Static */;\n                        lastStatic = modifier;\n                        break;\n                    case 130 /* ReadonlyKeyword */:\n                        if (flags & 64 /* Readonly */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"readonly\");\n                        }\n                        else if (node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 146 /* PropertySignature */ && node.kind !== 155 /* IndexSignature */ && node.kind !== 144 /* Parameter */) {\n                            // If node.kind === SyntaxKind.Parameter, checkParameter report an error if it's not a parameter property.\n                            return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);\n                        }\n                        flags |= 64 /* Readonly */;\n                        lastReadonly = modifier;\n                        break;\n                    case 83 /* ExportKeyword */:\n                        if (flags & 1 /* Export */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"export\");\n                        }\n                        else if (flags & 2 /* Ambient */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, \"export\", \"declare\");\n                        }\n                        else if (flags & 128 /* Abstract */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, \"export\", \"abstract\");\n                        }\n                        else if (flags & 256 /* Async */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, \"export\", \"async\");\n                        }\n                        else if (node.parent.kind === 226 /* ClassDeclaration */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, \"export\");\n                        }\n                        else if (node.kind === 144 /* Parameter */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, \"export\");\n                        }\n                        flags |= 1 /* Export */;\n                        break;\n                    case 123 /* DeclareKeyword */:\n                        if (flags & 2 /* Ambient */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"declare\");\n                        }\n                        else if (flags & 256 /* Async */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, \"async\");\n                        }\n                        else if (node.parent.kind === 226 /* ClassDeclaration */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, \"declare\");\n                        }\n                        else if (node.kind === 144 /* Parameter */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, \"declare\");\n                        }\n                        else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 231 /* ModuleBlock */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);\n                        }\n                        flags |= 2 /* Ambient */;\n                        lastDeclare = modifier;\n                        break;\n                    case 116 /* AbstractKeyword */:\n                        if (flags & 128 /* Abstract */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"abstract\");\n                        }\n                        if (node.kind !== 226 /* ClassDeclaration */) {\n                            if (node.kind !== 149 /* MethodDeclaration */ &&\n                                node.kind !== 147 /* PropertyDeclaration */ &&\n                                node.kind !== 151 /* GetAccessor */ &&\n                                node.kind !== 152 /* SetAccessor */) {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);\n                            }\n                            if (!(node.parent.kind === 226 /* ClassDeclaration */ && ts.getModifierFlags(node.parent) & 128 /* Abstract */)) {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);\n                            }\n                            if (flags & 32 /* Static */) {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, \"static\", \"abstract\");\n                            }\n                            if (flags & 8 /* Private */) {\n                                return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, \"private\", \"abstract\");\n                            }\n                        }\n                        flags |= 128 /* Abstract */;\n                        break;\n                    case 119 /* AsyncKeyword */:\n                        if (flags & 256 /* Async */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, \"async\");\n                        }\n                        else if (flags & 2 /* Ambient */ || ts.isInAmbientContext(node.parent)) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, \"async\");\n                        }\n                        else if (node.kind === 144 /* Parameter */) {\n                            return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, \"async\");\n                        }\n                        flags |= 256 /* Async */;\n                        lastAsync = modifier;\n                        break;\n                }\n            }\n            if (node.kind === 150 /* Constructor */) {\n                if (flags & 32 /* Static */) {\n                    return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, \"static\");\n                }\n                if (flags & 128 /* Abstract */) {\n                    return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, \"abstract\");\n                }\n                else if (flags & 256 /* Async */) {\n                    return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, \"async\");\n                }\n                else if (flags & 64 /* Readonly */) {\n                    return grammarErrorOnNode(lastReadonly, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, \"readonly\");\n                }\n                return;\n            }\n            else if ((node.kind === 235 /* ImportDeclaration */ || node.kind === 234 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) {\n                return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, \"declare\");\n            }\n            else if (node.kind === 144 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) {\n                return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern);\n            }\n            else if (node.kind === 144 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) {\n                return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter);\n            }\n            if (flags & 256 /* Async */) {\n                return checkGrammarAsyncModifier(node, lastAsync);\n            }\n        }\n        /**\n         * true | false: Early return this value from checkGrammarModifiers.\n         * undefined: Need to do full checking on the modifiers.\n         */\n        function reportObviousModifierErrors(node) {\n            return !node.modifiers\n                ? false\n                : shouldReportBadModifier(node)\n                    ? grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here)\n                    : undefined;\n        }\n        function shouldReportBadModifier(node) {\n            switch (node.kind) {\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                case 150 /* Constructor */:\n                case 147 /* PropertyDeclaration */:\n                case 146 /* PropertySignature */:\n                case 149 /* MethodDeclaration */:\n                case 148 /* MethodSignature */:\n                case 155 /* IndexSignature */:\n                case 230 /* ModuleDeclaration */:\n                case 235 /* ImportDeclaration */:\n                case 234 /* ImportEqualsDeclaration */:\n                case 241 /* ExportDeclaration */:\n                case 240 /* ExportAssignment */:\n                case 184 /* FunctionExpression */:\n                case 185 /* ArrowFunction */:\n                case 144 /* Parameter */:\n                    return false;\n                default:\n                    if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) {\n                        return false;\n                    }\n                    switch (node.kind) {\n                        case 225 /* FunctionDeclaration */:\n                            return nodeHasAnyModifiersExcept(node, 119 /* AsyncKeyword */);\n                        case 226 /* ClassDeclaration */:\n                            return nodeHasAnyModifiersExcept(node, 116 /* AbstractKeyword */);\n                        case 227 /* InterfaceDeclaration */:\n                        case 205 /* VariableStatement */:\n                        case 228 /* TypeAliasDeclaration */:\n                            return true;\n                        case 229 /* EnumDeclaration */:\n                            return nodeHasAnyModifiersExcept(node, 75 /* ConstKeyword */);\n                        default:\n                            ts.Debug.fail();\n                            return false;\n                    }\n            }\n        }\n        function nodeHasAnyModifiersExcept(node, allowedModifier) {\n            return node.modifiers.length > 1 || node.modifiers[0].kind !== allowedModifier;\n        }\n        function checkGrammarAsyncModifier(node, asyncModifier) {\n            switch (node.kind) {\n                case 149 /* MethodDeclaration */:\n                case 225 /* FunctionDeclaration */:\n                case 184 /* FunctionExpression */:\n                case 185 /* ArrowFunction */:\n                    if (!node.asteriskToken) {\n                        return false;\n                    }\n                    break;\n            }\n            return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, \"async\");\n        }\n        function checkGrammarForDisallowedTrailingComma(list) {\n            if (list && list.hasTrailingComma) {\n                var start = list.end - \",\".length;\n                var end = list.end;\n                var sourceFile = ts.getSourceFileOfNode(list[0]);\n                return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Trailing_comma_not_allowed);\n            }\n        }\n        function checkGrammarTypeParameterList(typeParameters, file) {\n            if (checkGrammarForDisallowedTrailingComma(typeParameters)) {\n                return true;\n            }\n            if (typeParameters && typeParameters.length === 0) {\n                var start = typeParameters.pos - \"<\".length;\n                var end = ts.skipTrivia(file.text, typeParameters.end) + \">\".length;\n                return grammarErrorAtPos(file, start, end - start, ts.Diagnostics.Type_parameter_list_cannot_be_empty);\n            }\n        }\n        function checkGrammarParameterList(parameters) {\n            var seenOptionalParameter = false;\n            var parameterCount = parameters.length;\n            for (var i = 0; i < parameterCount; i++) {\n                var parameter = parameters[i];\n                if (parameter.dotDotDotToken) {\n                    if (i !== (parameterCount - 1)) {\n                        return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);\n                    }\n                    if (ts.isBindingPattern(parameter.name)) {\n                        return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);\n                    }\n                    if (parameter.questionToken) {\n                        return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_rest_parameter_cannot_be_optional);\n                    }\n                    if (parameter.initializer) {\n                        return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer);\n                    }\n                }\n                else if (parameter.questionToken) {\n                    seenOptionalParameter = true;\n                    if (parameter.initializer) {\n                        return grammarErrorOnNode(parameter.name, ts.Diagnostics.Parameter_cannot_have_question_mark_and_initializer);\n                    }\n                }\n                else if (seenOptionalParameter && !parameter.initializer) {\n                    return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter);\n                }\n            }\n        }\n        function checkGrammarFunctionLikeDeclaration(node) {\n            // Prevent cascading error by short-circuit\n            var file = ts.getSourceFileOfNode(node);\n            return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node.typeParameters, file) ||\n                checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file);\n        }\n        function checkGrammarArrowFunction(node, file) {\n            if (node.kind === 185 /* ArrowFunction */) {\n                var arrowFunction = node;\n                var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line;\n                var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line;\n                if (startLine !== endLine) {\n                    return grammarErrorOnNode(arrowFunction.equalsGreaterThanToken, ts.Diagnostics.Line_terminator_not_permitted_before_arrow);\n                }\n            }\n            return false;\n        }\n        function checkGrammarIndexSignatureParameters(node) {\n            var parameter = node.parameters[0];\n            if (node.parameters.length !== 1) {\n                if (parameter) {\n                    return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter);\n                }\n                else {\n                    return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter);\n                }\n            }\n            if (parameter.dotDotDotToken) {\n                return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter);\n            }\n            if (ts.getModifierFlags(parameter) !== 0) {\n                return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier);\n            }\n            if (parameter.questionToken) {\n                return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark);\n            }\n            if (parameter.initializer) {\n                return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_initializer);\n            }\n            if (!parameter.type) {\n                return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);\n            }\n            if (parameter.type.kind !== 134 /* StringKeyword */ && parameter.type.kind !== 132 /* NumberKeyword */) {\n                return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number);\n            }\n            if (!node.type) {\n                return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation);\n            }\n        }\n        function checkGrammarIndexSignature(node) {\n            // Prevent cascading error by short-circuit\n            return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node);\n        }\n        function checkGrammarForAtLeastOneTypeArgument(node, typeArguments) {\n            if (typeArguments && typeArguments.length === 0) {\n                var sourceFile = ts.getSourceFileOfNode(node);\n                var start = typeArguments.pos - \"<\".length;\n                var end = ts.skipTrivia(sourceFile.text, typeArguments.end) + \">\".length;\n                return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Type_argument_list_cannot_be_empty);\n            }\n        }\n        function checkGrammarTypeArguments(node, typeArguments) {\n            return checkGrammarForDisallowedTrailingComma(typeArguments) ||\n                checkGrammarForAtLeastOneTypeArgument(node, typeArguments);\n        }\n        function checkGrammarForOmittedArgument(node, args) {\n            if (args) {\n                var sourceFile = ts.getSourceFileOfNode(node);\n                for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {\n                    var arg = args_4[_i];\n                    if (arg.kind === 198 /* OmittedExpression */) {\n                        return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);\n                    }\n                }\n            }\n        }\n        function checkGrammarArguments(node, args) {\n            return checkGrammarForOmittedArgument(node, args);\n        }\n        function checkGrammarHeritageClause(node) {\n            var types = node.types;\n            if (checkGrammarForDisallowedTrailingComma(types)) {\n                return true;\n            }\n            if (types && types.length === 0) {\n                var listType = ts.tokenToString(node.token);\n                var sourceFile = ts.getSourceFileOfNode(node);\n                return grammarErrorAtPos(sourceFile, types.pos, 0, ts.Diagnostics._0_list_cannot_be_empty, listType);\n            }\n        }\n        function checkGrammarClassDeclarationHeritageClauses(node) {\n            var seenExtendsClause = false;\n            var seenImplementsClause = false;\n            if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) {\n                for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {\n                    var heritageClause = _a[_i];\n                    if (heritageClause.token === 84 /* ExtendsKeyword */) {\n                        if (seenExtendsClause) {\n                            return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);\n                        }\n                        if (seenImplementsClause) {\n                            return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_must_precede_implements_clause);\n                        }\n                        if (heritageClause.types.length > 1) {\n                            return grammarErrorOnFirstToken(heritageClause.types[1], ts.Diagnostics.Classes_can_only_extend_a_single_class);\n                        }\n                        seenExtendsClause = true;\n                    }\n                    else {\n                        ts.Debug.assert(heritageClause.token === 107 /* ImplementsKeyword */);\n                        if (seenImplementsClause) {\n                            return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen);\n                        }\n                        seenImplementsClause = true;\n                    }\n                    // Grammar checking heritageClause inside class declaration\n                    checkGrammarHeritageClause(heritageClause);\n                }\n            }\n        }\n        function checkGrammarInterfaceDeclaration(node) {\n            var seenExtendsClause = false;\n            if (node.heritageClauses) {\n                for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {\n                    var heritageClause = _a[_i];\n                    if (heritageClause.token === 84 /* ExtendsKeyword */) {\n                        if (seenExtendsClause) {\n                            return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);\n                        }\n                        seenExtendsClause = true;\n                    }\n                    else {\n                        ts.Debug.assert(heritageClause.token === 107 /* ImplementsKeyword */);\n                        return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause);\n                    }\n                    // Grammar checking heritageClause inside class declaration\n                    checkGrammarHeritageClause(heritageClause);\n                }\n            }\n            return false;\n        }\n        function checkGrammarComputedPropertyName(node) {\n            // If node is not a computedPropertyName, just skip the grammar checking\n            if (node.kind !== 142 /* ComputedPropertyName */) {\n                return false;\n            }\n            var computedPropertyName = node;\n            if (computedPropertyName.expression.kind === 192 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 25 /* CommaToken */) {\n                return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);\n            }\n        }\n        function checkGrammarForGenerator(node) {\n            if (node.asteriskToken) {\n                ts.Debug.assert(node.kind === 225 /* FunctionDeclaration */ ||\n                    node.kind === 184 /* FunctionExpression */ ||\n                    node.kind === 149 /* MethodDeclaration */);\n                if (ts.isInAmbientContext(node)) {\n                    return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);\n                }\n                if (!node.body) {\n                    return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator);\n                }\n                if (languageVersion < 2 /* ES2015 */) {\n                    return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher);\n                }\n            }\n        }\n        function checkGrammarForInvalidQuestionMark(questionToken, message) {\n            if (questionToken) {\n                return grammarErrorOnNode(questionToken, message);\n            }\n        }\n        function checkGrammarObjectLiteralExpression(node, inDestructuring) {\n            var seen = ts.createMap();\n            var Property = 1;\n            var GetAccessor = 2;\n            var SetAccessor = 4;\n            var GetOrSetAccessor = GetAccessor | SetAccessor;\n            for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {\n                var prop = _a[_i];\n                if (prop.kind === 259 /* SpreadAssignment */) {\n                    continue;\n                }\n                var name_28 = prop.name;\n                if (name_28.kind === 142 /* ComputedPropertyName */) {\n                    // If the name is not a ComputedPropertyName, the grammar checking will skip it\n                    checkGrammarComputedPropertyName(name_28);\n                }\n                if (prop.kind === 258 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {\n                    // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern\n                    // outside of destructuring it is a syntax error\n                    return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment);\n                }\n                // Modifiers are never allowed on properties except for 'async' on a method declaration\n                if (prop.modifiers) {\n                    for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) {\n                        var mod = _c[_b];\n                        if (mod.kind !== 119 /* AsyncKeyword */ || prop.kind !== 149 /* MethodDeclaration */) {\n                            grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod));\n                        }\n                    }\n                }\n                // ECMA-262 11.1.5 Object Initializer\n                // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true\n                // a.This production is contained in strict code and IsDataDescriptor(previous) is true and\n                // IsDataDescriptor(propId.descriptor) is true.\n                //    b.IsDataDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true.\n                //    c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.\n                //    d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true\n                // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields\n                var currentKind = void 0;\n                if (prop.kind === 257 /* PropertyAssignment */ || prop.kind === 258 /* ShorthandPropertyAssignment */) {\n                    // Grammar checking for computedPropertyName and shorthandPropertyAssignment\n                    checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);\n                    if (name_28.kind === 8 /* NumericLiteral */) {\n                        checkGrammarNumericLiteral(name_28);\n                    }\n                    currentKind = Property;\n                }\n                else if (prop.kind === 149 /* MethodDeclaration */) {\n                    currentKind = Property;\n                }\n                else if (prop.kind === 151 /* GetAccessor */) {\n                    currentKind = GetAccessor;\n                }\n                else if (prop.kind === 152 /* SetAccessor */) {\n                    currentKind = SetAccessor;\n                }\n                else {\n                    ts.Debug.fail(\"Unexpected syntax kind:\" + prop.kind);\n                }\n                var effectiveName = ts.getPropertyNameForPropertyNameNode(name_28);\n                if (effectiveName === undefined) {\n                    continue;\n                }\n                if (!seen[effectiveName]) {\n                    seen[effectiveName] = currentKind;\n                }\n                else {\n                    var existingKind = seen[effectiveName];\n                    if (currentKind === Property && existingKind === Property) {\n                        grammarErrorOnNode(name_28, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_28));\n                    }\n                    else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) {\n                        if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) {\n                            seen[effectiveName] = currentKind | existingKind;\n                        }\n                        else {\n                            return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);\n                        }\n                    }\n                    else {\n                        return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);\n                    }\n                }\n            }\n        }\n        function checkGrammarJsxElement(node) {\n            var seen = ts.createMap();\n            for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) {\n                var attr = _a[_i];\n                if (attr.kind === 251 /* JsxSpreadAttribute */) {\n                    continue;\n                }\n                var jsxAttr = attr;\n                var name_29 = jsxAttr.name;\n                if (!seen[name_29.text]) {\n                    seen[name_29.text] = true;\n                }\n                else {\n                    return grammarErrorOnNode(name_29, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);\n                }\n                var initializer = jsxAttr.initializer;\n                if (initializer && initializer.kind === 252 /* JsxExpression */ && !initializer.expression) {\n                    return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression);\n                }\n            }\n        }\n        function checkGrammarForInOrForOfStatement(forInOrOfStatement) {\n            if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) {\n                return true;\n            }\n            if (forInOrOfStatement.initializer.kind === 224 /* VariableDeclarationList */) {\n                var variableList = forInOrOfStatement.initializer;\n                if (!checkGrammarVariableDeclarationList(variableList)) {\n                    var declarations = variableList.declarations;\n                    // declarations.length can be zero if there is an error in variable declaration in for-of or for-in\n                    // See http://www.ecma-international.org/ecma-262/6.0/#sec-for-in-and-for-of-statements for details\n                    // For example:\n                    //      var let = 10;\n                    //      for (let of [1,2,3]) {} // this is invalid ES6 syntax\n                    //      for (let in [1,2,3]) {} // this is invalid ES6 syntax\n                    // We will then want to skip on grammar checking on variableList declaration\n                    if (!declarations.length) {\n                        return false;\n                    }\n                    if (declarations.length > 1) {\n                        var diagnostic = forInOrOfStatement.kind === 212 /* ForInStatement */\n                            ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement\n                            : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement;\n                        return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic);\n                    }\n                    var firstDeclaration = declarations[0];\n                    if (firstDeclaration.initializer) {\n                        var diagnostic = forInOrOfStatement.kind === 212 /* ForInStatement */\n                            ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer\n                            : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer;\n                        return grammarErrorOnNode(firstDeclaration.name, diagnostic);\n                    }\n                    if (firstDeclaration.type) {\n                        var diagnostic = forInOrOfStatement.kind === 212 /* ForInStatement */\n                            ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation\n                            : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation;\n                        return grammarErrorOnNode(firstDeclaration, diagnostic);\n                    }\n                }\n            }\n            return false;\n        }\n        function checkGrammarAccessor(accessor) {\n            var kind = accessor.kind;\n            if (languageVersion < 1 /* ES5 */) {\n                return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);\n            }\n            else if (ts.isInAmbientContext(accessor)) {\n                return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context);\n            }\n            else if (accessor.body === undefined && !(ts.getModifierFlags(accessor) & 128 /* Abstract */)) {\n                return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, \";\".length, ts.Diagnostics._0_expected, \"{\");\n            }\n            else if (accessor.body && ts.getModifierFlags(accessor) & 128 /* Abstract */) {\n                return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation);\n            }\n            else if (accessor.typeParameters) {\n                return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);\n            }\n            else if (!doesAccessorHaveCorrectParameterCount(accessor)) {\n                return grammarErrorOnNode(accessor.name, kind === 151 /* GetAccessor */ ?\n                    ts.Diagnostics.A_get_accessor_cannot_have_parameters :\n                    ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);\n            }\n            else if (kind === 152 /* SetAccessor */) {\n                if (accessor.type) {\n                    return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);\n                }\n                else {\n                    var parameter = accessor.parameters[0];\n                    if (parameter.dotDotDotToken) {\n                        return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter);\n                    }\n                    else if (parameter.questionToken) {\n                        return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);\n                    }\n                    else if (parameter.initializer) {\n                        return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer);\n                    }\n                }\n            }\n        }\n        /** Does the accessor have the right number of parameters?\n\n            A get accessor has no parameters or a single `this` parameter.\n            A set accessor has one parameter or a `this` parameter and one more parameter */\n        function doesAccessorHaveCorrectParameterCount(accessor) {\n            return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 151 /* GetAccessor */ ? 0 : 1);\n        }\n        function getAccessorThisParameter(accessor) {\n            if (accessor.parameters.length === (accessor.kind === 151 /* GetAccessor */ ? 1 : 2)) {\n                return ts.getThisParameter(accessor);\n            }\n        }\n        function checkGrammarForNonSymbolComputedProperty(node, message) {\n            if (ts.isDynamicName(node)) {\n                return grammarErrorOnNode(node, message);\n            }\n        }\n        function checkGrammarMethod(node) {\n            if (checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) ||\n                checkGrammarFunctionLikeDeclaration(node) ||\n                checkGrammarForGenerator(node)) {\n                return true;\n            }\n            if (node.parent.kind === 176 /* ObjectLiteralExpression */) {\n                if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) {\n                    return true;\n                }\n                else if (node.body === undefined) {\n                    return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.end - 1, \";\".length, ts.Diagnostics._0_expected, \"{\");\n                }\n            }\n            if (ts.isClassLike(node.parent)) {\n                // Technically, computed properties in ambient contexts is disallowed\n                // for property declarations and accessors too, not just methods.\n                // However, property declarations disallow computed names in general,\n                // and accessors are not allowed in ambient contexts in general,\n                // so this error only really matters for methods.\n                if (ts.isInAmbientContext(node)) {\n                    return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol);\n                }\n                else if (!node.body) {\n                    return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol);\n                }\n            }\n            else if (node.parent.kind === 227 /* InterfaceDeclaration */) {\n                return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol);\n            }\n            else if (node.parent.kind === 161 /* TypeLiteral */) {\n                return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol);\n            }\n        }\n        function checkGrammarBreakOrContinueStatement(node) {\n            var current = node;\n            while (current) {\n                if (ts.isFunctionLike(current)) {\n                    return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary);\n                }\n                switch (current.kind) {\n                    case 219 /* LabeledStatement */:\n                        if (node.label && current.label.text === node.label.text) {\n                            // found matching label - verify that label usage is correct\n                            // continue can only target labels that are on iteration statements\n                            var isMisplacedContinueLabel = node.kind === 214 /* ContinueStatement */\n                                && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true);\n                            if (isMisplacedContinueLabel) {\n                                return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement);\n                            }\n                            return false;\n                        }\n                        break;\n                    case 218 /* SwitchStatement */:\n                        if (node.kind === 215 /* BreakStatement */ && !node.label) {\n                            // unlabeled break within switch statement - ok\n                            return false;\n                        }\n                        break;\n                    default:\n                        if (ts.isIterationStatement(current, /*lookInLabeledStatement*/ false) && !node.label) {\n                            // unlabeled break or continue within iteration statement - ok\n                            return false;\n                        }\n                        break;\n                }\n                current = current.parent;\n            }\n            if (node.label) {\n                var message = node.kind === 215 /* BreakStatement */\n                    ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement\n                    : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement;\n                return grammarErrorOnNode(node, message);\n            }\n            else {\n                var message = node.kind === 215 /* BreakStatement */\n                    ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement\n                    : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement;\n                return grammarErrorOnNode(node, message);\n            }\n        }\n        function checkGrammarBindingElement(node) {\n            if (node.dotDotDotToken) {\n                var elements = node.parent.elements;\n                if (node !== ts.lastOrUndefined(elements)) {\n                    return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);\n                }\n                if (node.name.kind === 173 /* ArrayBindingPattern */ || node.name.kind === 172 /* ObjectBindingPattern */) {\n                    return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);\n                }\n                if (node.initializer) {\n                    // Error on equals token which immediately precedes the initializer\n                    return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - 1, 1, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);\n                }\n            }\n        }\n        function isStringOrNumberLiteralExpression(expr) {\n            return expr.kind === 9 /* StringLiteral */ || expr.kind === 8 /* NumericLiteral */ ||\n                expr.kind === 190 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ &&\n                    expr.operand.kind === 8 /* NumericLiteral */;\n        }\n        function checkGrammarVariableDeclaration(node) {\n            if (node.parent.parent.kind !== 212 /* ForInStatement */ && node.parent.parent.kind !== 213 /* ForOfStatement */) {\n                if (ts.isInAmbientContext(node)) {\n                    if (node.initializer) {\n                        if (ts.isConst(node) && !node.type) {\n                            if (!isStringOrNumberLiteralExpression(node.initializer)) {\n                                return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal);\n                            }\n                        }\n                        else {\n                            // Error on equals token which immediate precedes the initializer\n                            var equalsTokenLength = \"=\".length;\n                            return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);\n                        }\n                    }\n                    if (node.initializer && !(ts.isConst(node) && isStringOrNumberLiteralExpression(node.initializer))) {\n                        // Error on equals token which immediate precedes the initializer\n                        var equalsTokenLength = \"=\".length;\n                        return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);\n                    }\n                }\n                else if (!node.initializer) {\n                    if (ts.isBindingPattern(node.name) && !ts.isBindingPattern(node.parent)) {\n                        return grammarErrorOnNode(node, ts.Diagnostics.A_destructuring_declaration_must_have_an_initializer);\n                    }\n                    if (ts.isConst(node)) {\n                        return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_must_be_initialized);\n                    }\n                }\n            }\n            var checkLetConstNames = (ts.isLet(node) || ts.isConst(node));\n            // 1. LexicalDeclaration : LetOrConst BindingList ;\n            // It is a Syntax Error if the BoundNames of BindingList contains \"let\".\n            // 2. ForDeclaration: ForDeclaration : LetOrConst ForBinding\n            // It is a Syntax Error if the BoundNames of ForDeclaration contains \"let\".\n            // It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code\n            // and its Identifier is eval or arguments\n            return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name);\n        }\n        function checkGrammarNameInLetOrConstDeclarations(name) {\n            if (name.kind === 70 /* Identifier */) {\n                if (name.originalKeywordKind === 109 /* LetKeyword */) {\n                    return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations);\n                }\n            }\n            else {\n                var elements = name.elements;\n                for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) {\n                    var element = elements_2[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        checkGrammarNameInLetOrConstDeclarations(element.name);\n                    }\n                }\n            }\n        }\n        function checkGrammarVariableDeclarationList(declarationList) {\n            var declarations = declarationList.declarations;\n            if (checkGrammarForDisallowedTrailingComma(declarationList.declarations)) {\n                return true;\n            }\n            if (!declarationList.declarations.length) {\n                return grammarErrorAtPos(ts.getSourceFileOfNode(declarationList), declarations.pos, declarations.end - declarations.pos, ts.Diagnostics.Variable_declaration_list_cannot_be_empty);\n            }\n        }\n        function allowLetAndConstDeclarations(parent) {\n            switch (parent.kind) {\n                case 208 /* IfStatement */:\n                case 209 /* DoStatement */:\n                case 210 /* WhileStatement */:\n                case 217 /* WithStatement */:\n                case 211 /* ForStatement */:\n                case 212 /* ForInStatement */:\n                case 213 /* ForOfStatement */:\n                    return false;\n                case 219 /* LabeledStatement */:\n                    return allowLetAndConstDeclarations(parent.parent);\n            }\n            return true;\n        }\n        function checkGrammarForDisallowedLetOrConstStatement(node) {\n            if (!allowLetAndConstDeclarations(node.parent)) {\n                if (ts.isLet(node.declarationList)) {\n                    return grammarErrorOnNode(node, ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block);\n                }\n                else if (ts.isConst(node.declarationList)) {\n                    return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_can_only_be_declared_inside_a_block);\n                }\n            }\n        }\n        function hasParseDiagnostics(sourceFile) {\n            return sourceFile.parseDiagnostics.length > 0;\n        }\n        function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) {\n            var sourceFile = ts.getSourceFileOfNode(node);\n            if (!hasParseDiagnostics(sourceFile)) {\n                var span_4 = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);\n                diagnostics.add(ts.createFileDiagnostic(sourceFile, span_4.start, span_4.length, message, arg0, arg1, arg2));\n                return true;\n            }\n        }\n        function grammarErrorAtPos(sourceFile, start, length, message, arg0, arg1, arg2) {\n            if (!hasParseDiagnostics(sourceFile)) {\n                diagnostics.add(ts.createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2));\n                return true;\n            }\n        }\n        function grammarErrorOnNode(node, message, arg0, arg1, arg2) {\n            var sourceFile = ts.getSourceFileOfNode(node);\n            if (!hasParseDiagnostics(sourceFile)) {\n                diagnostics.add(ts.createDiagnosticForNode(node, message, arg0, arg1, arg2));\n                return true;\n            }\n        }\n        function checkGrammarConstructorTypeParameters(node) {\n            if (node.typeParameters) {\n                return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.typeParameters.pos, node.typeParameters.end - node.typeParameters.pos, ts.Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration);\n            }\n        }\n        function checkGrammarConstructorTypeAnnotation(node) {\n            if (node.type) {\n                return grammarErrorOnNode(node.type, ts.Diagnostics.Type_annotation_cannot_appear_on_a_constructor_declaration);\n            }\n        }\n        function checkGrammarProperty(node) {\n            if (ts.isClassLike(node.parent)) {\n                if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) {\n                    return true;\n                }\n            }\n            else if (node.parent.kind === 227 /* InterfaceDeclaration */) {\n                if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) {\n                    return true;\n                }\n                if (node.initializer) {\n                    return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer);\n                }\n            }\n            else if (node.parent.kind === 161 /* TypeLiteral */) {\n                if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) {\n                    return true;\n                }\n                if (node.initializer) {\n                    return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_type_literal_property_cannot_have_an_initializer);\n                }\n            }\n            if (ts.isInAmbientContext(node) && node.initializer) {\n                return grammarErrorOnFirstToken(node.initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);\n            }\n        }\n        function checkGrammarTopLevelElementForRequiredDeclareModifier(node) {\n            // A declare modifier is required for any top level .d.ts declaration except export=, export default, export as namespace\n            // interfaces and imports categories:\n            //\n            //  DeclarationElement:\n            //     ExportAssignment\n            //     export_opt   InterfaceDeclaration\n            //     export_opt   TypeAliasDeclaration\n            //     export_opt   ImportDeclaration\n            //     export_opt   ExternalImportDeclaration\n            //     export_opt   AmbientDeclaration\n            //\n            // TODO: The spec needs to be amended to reflect this grammar.\n            if (node.kind === 227 /* InterfaceDeclaration */ ||\n                node.kind === 228 /* TypeAliasDeclaration */ ||\n                node.kind === 235 /* ImportDeclaration */ ||\n                node.kind === 234 /* ImportEqualsDeclaration */ ||\n                node.kind === 241 /* ExportDeclaration */ ||\n                node.kind === 240 /* ExportAssignment */ ||\n                node.kind === 233 /* NamespaceExportDeclaration */ ||\n                ts.getModifierFlags(node) & (2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) {\n                return false;\n            }\n            return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file);\n        }\n        function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) {\n            for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {\n                var decl = _a[_i];\n                if (ts.isDeclaration(decl) || decl.kind === 205 /* VariableStatement */) {\n                    if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) {\n                        return true;\n                    }\n                }\n            }\n        }\n        function checkGrammarSourceFile(node) {\n            return ts.isInAmbientContext(node) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node);\n        }\n        function checkGrammarStatementInAmbientContext(node) {\n            if (ts.isInAmbientContext(node)) {\n                // An accessors is already reported about the ambient context\n                if (isAccessor(node.parent.kind)) {\n                    return getNodeLinks(node).hasReportedStatementInAmbientContext = true;\n                }\n                // Find containing block which is either Block, ModuleBlock, SourceFile\n                var links = getNodeLinks(node);\n                if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) {\n                    return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts);\n                }\n                // We are either parented by another statement, or some sort of block.\n                // If we're in a block, we only want to really report an error once\n                // to prevent noisiness.  So use a bit on the block to indicate if\n                // this has already been reported, and don't report if it has.\n                //\n                if (node.parent.kind === 204 /* Block */ || node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) {\n                    var links_1 = getNodeLinks(node.parent);\n                    // Check if the containing block ever report this error\n                    if (!links_1.hasReportedStatementInAmbientContext) {\n                        return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts);\n                    }\n                }\n                else {\n                }\n            }\n        }\n        function checkGrammarNumericLiteral(node) {\n            // Grammar checking\n            if (node.isOctalLiteral && languageVersion >= 1 /* ES5 */) {\n                return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher);\n            }\n        }\n        function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) {\n            var sourceFile = ts.getSourceFileOfNode(node);\n            if (!hasParseDiagnostics(sourceFile)) {\n                var span_5 = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);\n                diagnostics.add(ts.createFileDiagnostic(sourceFile, ts.textSpanEnd(span_5), /*length*/ 0, message, arg0, arg1, arg2));\n                return true;\n            }\n        }\n        function getAmbientModules() {\n            var result = [];\n            for (var sym in globals) {\n                if (ambientModuleSymbolRegex.test(sym)) {\n                    result.push(globals[sym]);\n                }\n            }\n            return result;\n        }\n    }\n    ts.createTypeChecker = createTypeChecker;\n})(ts || (ts = {}));\n/// <reference path=\"checker.ts\" />\n/// <reference path=\"factory.ts\" />\n/// <reference path=\"utilities.ts\" />\n/* @internal */\nvar ts;\n(function (ts) {\n    ;\n    /**\n     * This map contains information about the shape of each Node in \"types.ts\" pertaining to how\n     * each node should be traversed during a transformation.\n     *\n     * Each edge corresponds to a property in a Node subtype that should be traversed when visiting\n     * each child. The properties are assigned in the order in which traversal should occur.\n     *\n     * We only add entries for nodes that do not have a create/update pair defined in factory.ts\n     *\n     * NOTE: This needs to be kept up to date with changes to nodes in \"types.ts\". Currently, this\n     *       map is not comprehensive. Only node edges relevant to tree transformation are\n     *       currently defined. We may extend this to be more comprehensive, and eventually\n     *       supplant the existing `forEachChild` implementation if performance is not\n     *       significantly impacted.\n     */\n    var nodeEdgeTraversalMap = ts.createMap((_a = {},\n        _a[141 /* QualifiedName */] = [\n            { name: \"left\", test: ts.isEntityName },\n            { name: \"right\", test: ts.isIdentifier }\n        ],\n        _a[145 /* Decorator */] = [\n            { name: \"expression\", test: ts.isLeftHandSideExpression }\n        ],\n        _a[182 /* TypeAssertionExpression */] = [\n            { name: \"type\", test: ts.isTypeNode },\n            { name: \"expression\", test: ts.isUnaryExpression }\n        ],\n        _a[200 /* AsExpression */] = [\n            { name: \"expression\", test: ts.isExpression },\n            { name: \"type\", test: ts.isTypeNode }\n        ],\n        _a[201 /* NonNullExpression */] = [\n            { name: \"expression\", test: ts.isLeftHandSideExpression }\n        ],\n        _a[229 /* EnumDeclaration */] = [\n            { name: \"decorators\", test: ts.isDecorator },\n            { name: \"modifiers\", test: ts.isModifier },\n            { name: \"name\", test: ts.isIdentifier },\n            { name: \"members\", test: ts.isEnumMember }\n        ],\n        _a[230 /* ModuleDeclaration */] = [\n            { name: \"decorators\", test: ts.isDecorator },\n            { name: \"modifiers\", test: ts.isModifier },\n            { name: \"name\", test: ts.isModuleName },\n            { name: \"body\", test: ts.isModuleBody }\n        ],\n        _a[231 /* ModuleBlock */] = [\n            { name: \"statements\", test: ts.isStatement }\n        ],\n        _a[234 /* ImportEqualsDeclaration */] = [\n            { name: \"decorators\", test: ts.isDecorator },\n            { name: \"modifiers\", test: ts.isModifier },\n            { name: \"name\", test: ts.isIdentifier },\n            { name: \"moduleReference\", test: ts.isModuleReference }\n        ],\n        _a[245 /* ExternalModuleReference */] = [\n            { name: \"expression\", test: ts.isExpression, optional: true }\n        ],\n        _a[260 /* EnumMember */] = [\n            { name: \"name\", test: ts.isPropertyName },\n            { name: \"initializer\", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList }\n        ],\n        _a));\n    function reduceNode(node, f, initial) {\n        return node ? f(initial, node) : initial;\n    }\n    function reduceNodeArray(nodes, f, initial) {\n        return nodes ? f(initial, nodes) : initial;\n    }\n    /**\n     * Similar to `reduceLeft`, performs a reduction against each child of a node.\n     * NOTE: Unlike `forEachChild`, this does *not* visit every node. Only nodes added to the\n     *       `nodeEdgeTraversalMap` above will be visited.\n     *\n     * @param node The node containing the children to reduce.\n     * @param initial The initial value to supply to the reduction.\n     * @param f The callback function\n     */\n    function reduceEachChild(node, initial, cbNode, cbNodeArray) {\n        if (node === undefined) {\n            return initial;\n        }\n        var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft;\n        var cbNodes = cbNodeArray || cbNode;\n        var kind = node.kind;\n        // No need to visit nodes with no children.\n        if ((kind > 0 /* FirstToken */ && kind <= 140 /* LastToken */)) {\n            return initial;\n        }\n        // We do not yet support types.\n        if ((kind >= 156 /* TypePredicate */ && kind <= 171 /* LiteralType */)) {\n            return initial;\n        }\n        var result = initial;\n        switch (node.kind) {\n            // Leaf nodes\n            case 203 /* SemicolonClassElement */:\n            case 206 /* EmptyStatement */:\n            case 198 /* OmittedExpression */:\n            case 222 /* DebuggerStatement */:\n            case 293 /* NotEmittedStatement */:\n                // No need to visit nodes with no children.\n                break;\n            // Names\n            case 142 /* ComputedPropertyName */:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            // Signature elements\n            case 144 /* Parameter */:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            case 145 /* Decorator */:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            // Type member\n            case 147 /* PropertyDeclaration */:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            case 149 /* MethodDeclaration */:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 150 /* Constructor */:\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 151 /* GetAccessor */:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 152 /* SetAccessor */:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            // Binding patterns\n            case 172 /* ObjectBindingPattern */:\n            case 173 /* ArrayBindingPattern */:\n                result = reduceNodes(node.elements, cbNodes, result);\n                break;\n            case 174 /* BindingElement */:\n                result = reduceNode(node.propertyName, cbNode, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            // Expression\n            case 175 /* ArrayLiteralExpression */:\n                result = reduceNodes(node.elements, cbNodes, result);\n                break;\n            case 176 /* ObjectLiteralExpression */:\n                result = reduceNodes(node.properties, cbNodes, result);\n                break;\n            case 177 /* PropertyAccessExpression */:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.name, cbNode, result);\n                break;\n            case 178 /* ElementAccessExpression */:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.argumentExpression, cbNode, result);\n                break;\n            case 179 /* CallExpression */:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNodes(node.typeArguments, cbNodes, result);\n                result = reduceNodes(node.arguments, cbNodes, result);\n                break;\n            case 180 /* NewExpression */:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNodes(node.typeArguments, cbNodes, result);\n                result = reduceNodes(node.arguments, cbNodes, result);\n                break;\n            case 181 /* TaggedTemplateExpression */:\n                result = reduceNode(node.tag, cbNode, result);\n                result = reduceNode(node.template, cbNode, result);\n                break;\n            case 184 /* FunctionExpression */:\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 185 /* ArrowFunction */:\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 183 /* ParenthesizedExpression */:\n            case 186 /* DeleteExpression */:\n            case 187 /* TypeOfExpression */:\n            case 188 /* VoidExpression */:\n            case 189 /* AwaitExpression */:\n            case 195 /* YieldExpression */:\n            case 196 /* SpreadElement */:\n            case 201 /* NonNullExpression */:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 190 /* PrefixUnaryExpression */:\n            case 191 /* PostfixUnaryExpression */:\n                result = reduceNode(node.operand, cbNode, result);\n                break;\n            case 192 /* BinaryExpression */:\n                result = reduceNode(node.left, cbNode, result);\n                result = reduceNode(node.right, cbNode, result);\n                break;\n            case 193 /* ConditionalExpression */:\n                result = reduceNode(node.condition, cbNode, result);\n                result = reduceNode(node.whenTrue, cbNode, result);\n                result = reduceNode(node.whenFalse, cbNode, result);\n                break;\n            case 194 /* TemplateExpression */:\n                result = reduceNode(node.head, cbNode, result);\n                result = reduceNodes(node.templateSpans, cbNodes, result);\n                break;\n            case 197 /* ClassExpression */:\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.heritageClauses, cbNodes, result);\n                result = reduceNodes(node.members, cbNodes, result);\n                break;\n            case 199 /* ExpressionWithTypeArguments */:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNodes(node.typeArguments, cbNodes, result);\n                break;\n            // Misc\n            case 202 /* TemplateSpan */:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.literal, cbNode, result);\n                break;\n            // Element\n            case 204 /* Block */:\n                result = reduceNodes(node.statements, cbNodes, result);\n                break;\n            case 205 /* VariableStatement */:\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.declarationList, cbNode, result);\n                break;\n            case 207 /* ExpressionStatement */:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 208 /* IfStatement */:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.thenStatement, cbNode, result);\n                result = reduceNode(node.elseStatement, cbNode, result);\n                break;\n            case 209 /* DoStatement */:\n                result = reduceNode(node.statement, cbNode, result);\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 210 /* WhileStatement */:\n            case 217 /* WithStatement */:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.statement, cbNode, result);\n                break;\n            case 211 /* ForStatement */:\n                result = reduceNode(node.initializer, cbNode, result);\n                result = reduceNode(node.condition, cbNode, result);\n                result = reduceNode(node.incrementor, cbNode, result);\n                result = reduceNode(node.statement, cbNode, result);\n                break;\n            case 212 /* ForInStatement */:\n            case 213 /* ForOfStatement */:\n                result = reduceNode(node.initializer, cbNode, result);\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.statement, cbNode, result);\n                break;\n            case 216 /* ReturnStatement */:\n            case 220 /* ThrowStatement */:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 218 /* SwitchStatement */:\n                result = reduceNode(node.expression, cbNode, result);\n                result = reduceNode(node.caseBlock, cbNode, result);\n                break;\n            case 219 /* LabeledStatement */:\n                result = reduceNode(node.label, cbNode, result);\n                result = reduceNode(node.statement, cbNode, result);\n                break;\n            case 221 /* TryStatement */:\n                result = reduceNode(node.tryBlock, cbNode, result);\n                result = reduceNode(node.catchClause, cbNode, result);\n                result = reduceNode(node.finallyBlock, cbNode, result);\n                break;\n            case 223 /* VariableDeclaration */:\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            case 224 /* VariableDeclarationList */:\n                result = reduceNodes(node.declarations, cbNodes, result);\n                break;\n            case 225 /* FunctionDeclaration */:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.parameters, cbNodes, result);\n                result = reduceNode(node.type, cbNode, result);\n                result = reduceNode(node.body, cbNode, result);\n                break;\n            case 226 /* ClassDeclaration */:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNodes(node.typeParameters, cbNodes, result);\n                result = reduceNodes(node.heritageClauses, cbNodes, result);\n                result = reduceNodes(node.members, cbNodes, result);\n                break;\n            case 232 /* CaseBlock */:\n                result = reduceNodes(node.clauses, cbNodes, result);\n                break;\n            case 235 /* ImportDeclaration */:\n                result = reduceNodes(node.decorators, cbNodes, result);\n                result = reduceNodes(node.modifiers, cbNodes, result);\n                result = reduceNode(node.importClause, cbNode, result);\n                result = reduceNode(node.moduleSpecifier, cbNode, result);\n                break;\n            case 236 /* ImportClause */:\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.namedBindings, cbNode, result);\n                break;\n            case 237 /* NamespaceImport */:\n                result = reduceNode(node.name, cbNode, result);\n                break;\n            case 238 /* NamedImports */:\n            case 242 /* NamedExports */:\n                result = reduceNodes(node.elements, cbNodes, result);\n                break;\n            case 239 /* ImportSpecifier */:\n            case 243 /* ExportSpecifier */:\n                result = reduceNode(node.propertyName, cbNode, result);\n                result = reduceNode(node.name, cbNode, result);\n                break;\n            case 240 /* ExportAssignment */:\n                result = ts.reduceLeft(node.decorators, cbNode, result);\n                result = ts.reduceLeft(node.modifiers, cbNode, result);\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 241 /* ExportDeclaration */:\n                result = ts.reduceLeft(node.decorators, cbNode, result);\n                result = ts.reduceLeft(node.modifiers, cbNode, result);\n                result = reduceNode(node.exportClause, cbNode, result);\n                result = reduceNode(node.moduleSpecifier, cbNode, result);\n                break;\n            // JSX\n            case 246 /* JsxElement */:\n                result = reduceNode(node.openingElement, cbNode, result);\n                result = ts.reduceLeft(node.children, cbNode, result);\n                result = reduceNode(node.closingElement, cbNode, result);\n                break;\n            case 247 /* JsxSelfClosingElement */:\n            case 248 /* JsxOpeningElement */:\n                result = reduceNode(node.tagName, cbNode, result);\n                result = reduceNodes(node.attributes, cbNodes, result);\n                break;\n            case 249 /* JsxClosingElement */:\n                result = reduceNode(node.tagName, cbNode, result);\n                break;\n            case 250 /* JsxAttribute */:\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            case 251 /* JsxSpreadAttribute */:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            case 252 /* JsxExpression */:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            // Clauses\n            case 253 /* CaseClause */:\n                result = reduceNode(node.expression, cbNode, result);\n            // fall-through\n            case 254 /* DefaultClause */:\n                result = reduceNodes(node.statements, cbNodes, result);\n                break;\n            case 255 /* HeritageClause */:\n                result = reduceNodes(node.types, cbNodes, result);\n                break;\n            case 256 /* CatchClause */:\n                result = reduceNode(node.variableDeclaration, cbNode, result);\n                result = reduceNode(node.block, cbNode, result);\n                break;\n            // Property assignments\n            case 257 /* PropertyAssignment */:\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.initializer, cbNode, result);\n                break;\n            case 258 /* ShorthandPropertyAssignment */:\n                result = reduceNode(node.name, cbNode, result);\n                result = reduceNode(node.objectAssignmentInitializer, cbNode, result);\n                break;\n            case 259 /* SpreadAssignment */:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            // Top-level nodes\n            case 261 /* SourceFile */:\n                result = reduceNodes(node.statements, cbNodes, result);\n                break;\n            case 294 /* PartiallyEmittedExpression */:\n                result = reduceNode(node.expression, cbNode, result);\n                break;\n            default:\n                var edgeTraversalPath = nodeEdgeTraversalMap[kind];\n                if (edgeTraversalPath) {\n                    for (var _i = 0, edgeTraversalPath_1 = edgeTraversalPath; _i < edgeTraversalPath_1.length; _i++) {\n                        var edge = edgeTraversalPath_1[_i];\n                        var value = node[edge.name];\n                        if (value !== undefined) {\n                            result = ts.isArray(value)\n                                ? reduceNodes(value, cbNodes, result)\n                                : cbNode(result, value);\n                        }\n                    }\n                }\n                break;\n        }\n        return result;\n    }\n    ts.reduceEachChild = reduceEachChild;\n    function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) {\n        if (node === undefined || visitor === undefined) {\n            return node;\n        }\n        aggregateTransformFlags(node);\n        var visited = visitor(node);\n        if (visited === node) {\n            return node;\n        }\n        var visitedNode;\n        if (visited === undefined) {\n            if (!optional) {\n                Debug.failNotOptional();\n            }\n            return undefined;\n        }\n        else if (ts.isArray(visited)) {\n            visitedNode = (lift || extractSingleNode)(visited);\n        }\n        else {\n            visitedNode = visited;\n        }\n        if (parenthesize !== undefined) {\n            visitedNode = parenthesize(visitedNode, parentNode);\n        }\n        Debug.assertNode(visitedNode, test);\n        aggregateTransformFlags(visitedNode);\n        return visitedNode;\n    }\n    ts.visitNode = visitNode;\n    function visitNodes(nodes, visitor, test, start, count, parenthesize, parentNode) {\n        if (nodes === undefined) {\n            return undefined;\n        }\n        var updated;\n        // Ensure start and count have valid values\n        var length = nodes.length;\n        if (start === undefined || start < 0) {\n            start = 0;\n        }\n        if (count === undefined || count > length - start) {\n            count = length - start;\n        }\n        if (start > 0 || count < length) {\n            // If we are not visiting all of the original nodes, we must always create a new array.\n            // Since this is a fragment of a node array, we do not copy over the previous location\n            // and will only copy over `hasTrailingComma` if we are including the last element.\n            updated = ts.createNodeArray([], /*location*/ undefined, \n            /*hasTrailingComma*/ nodes.hasTrailingComma && start + count === length);\n        }\n        // Visit each original node.\n        for (var i = 0; i < count; i++) {\n            var node = nodes[i + start];\n            aggregateTransformFlags(node);\n            var visited = node !== undefined ? visitor(node) : undefined;\n            if (updated !== undefined || visited === undefined || visited !== node) {\n                if (updated === undefined) {\n                    // Ensure we have a copy of `nodes`, up to the current index.\n                    updated = ts.createNodeArray(nodes.slice(0, i), /*location*/ nodes, nodes.hasTrailingComma);\n                }\n                if (visited) {\n                    if (ts.isArray(visited)) {\n                        for (var _i = 0, visited_1 = visited; _i < visited_1.length; _i++) {\n                            var visitedNode = visited_1[_i];\n                            visitedNode = parenthesize\n                                ? parenthesize(visitedNode, parentNode)\n                                : visitedNode;\n                            Debug.assertNode(visitedNode, test);\n                            aggregateTransformFlags(visitedNode);\n                            updated.push(visitedNode);\n                        }\n                    }\n                    else {\n                        var visitedNode = parenthesize\n                            ? parenthesize(visited, parentNode)\n                            : visited;\n                        Debug.assertNode(visitedNode, test);\n                        aggregateTransformFlags(visitedNode);\n                        updated.push(visitedNode);\n                    }\n                }\n            }\n        }\n        return updated || nodes;\n    }\n    ts.visitNodes = visitNodes;\n    /**\n     * Starts a new lexical environment and visits a statement list, ending the lexical environment\n     * and merging hoisted declarations upon completion.\n     */\n    function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) {\n        context.startLexicalEnvironment();\n        statements = visitNodes(statements, visitor, ts.isStatement, start);\n        if (ensureUseStrict && !ts.startsWithUseStrict(statements)) {\n            statements = ts.createNodeArray([ts.createStatement(ts.createLiteral(\"use strict\"))].concat(statements), statements);\n        }\n        var declarations = context.endLexicalEnvironment();\n        return ts.createNodeArray(ts.concatenate(statements, declarations), statements);\n    }\n    ts.visitLexicalEnvironment = visitLexicalEnvironment;\n    /**\n     * Starts a new lexical environment and visits a parameter list, suspending the lexical\n     * environment upon completion.\n     */\n    function visitParameterList(nodes, visitor, context) {\n        context.startLexicalEnvironment();\n        var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration);\n        context.suspendLexicalEnvironment();\n        return updated;\n    }\n    ts.visitParameterList = visitParameterList;\n    function visitFunctionBody(node, visitor, context) {\n        context.resumeLexicalEnvironment();\n        var updated = visitNode(node, visitor, ts.isConciseBody);\n        var declarations = context.endLexicalEnvironment();\n        if (ts.some(declarations)) {\n            var block = ts.convertToFunctionBody(updated);\n            var statements = mergeLexicalEnvironment(block.statements, declarations);\n            return ts.updateBlock(block, statements);\n        }\n        return updated;\n    }\n    ts.visitFunctionBody = visitFunctionBody;\n    function visitEachChild(node, visitor, context) {\n        if (node === undefined) {\n            return undefined;\n        }\n        var kind = node.kind;\n        // No need to visit nodes with no children.\n        if ((kind > 0 /* FirstToken */ && kind <= 140 /* LastToken */)) {\n            return node;\n        }\n        // We do not yet support types.\n        if ((kind >= 156 /* TypePredicate */ && kind <= 171 /* LiteralType */)) {\n            return node;\n        }\n        switch (node.kind) {\n            case 203 /* SemicolonClassElement */:\n            case 206 /* EmptyStatement */:\n            case 198 /* OmittedExpression */:\n            case 222 /* DebuggerStatement */:\n                // No need to visit nodes with no children.\n                return node;\n            // Names\n            case 142 /* ComputedPropertyName */:\n                return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));\n            // Signature elements\n            case 144 /* Parameter */:\n                return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));\n            // Type member\n            case 147 /* PropertyDeclaration */:\n                return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));\n            case 149 /* MethodDeclaration */:\n                return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context));\n            case 150 /* Constructor */:\n                return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context));\n            case 151 /* GetAccessor */:\n                return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context));\n            case 152 /* SetAccessor */:\n                return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context));\n            // Binding patterns\n            case 172 /* ObjectBindingPattern */:\n                return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement));\n            case 173 /* ArrayBindingPattern */:\n                return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement));\n            case 174 /* BindingElement */:\n                return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, /*optional*/ true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));\n            // Expression\n            case 175 /* ArrayLiteralExpression */:\n                return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression));\n            case 176 /* ObjectLiteralExpression */:\n                return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike));\n            case 177 /* PropertyAccessExpression */:\n                return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier));\n            case 178 /* ElementAccessExpression */:\n                return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression));\n            case 179 /* CallExpression */:\n                return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression));\n            case 180 /* NewExpression */:\n                return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression));\n            case 181 /* TaggedTemplateExpression */:\n                return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral));\n            case 183 /* ParenthesizedExpression */:\n                return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 184 /* FunctionExpression */:\n                return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context));\n            case 185 /* ArrowFunction */:\n                return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context));\n            case 186 /* DeleteExpression */:\n                return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 187 /* TypeOfExpression */:\n                return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 188 /* VoidExpression */:\n                return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 189 /* AwaitExpression */:\n                return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 192 /* BinaryExpression */:\n                return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression));\n            case 190 /* PrefixUnaryExpression */:\n                return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression));\n            case 191 /* PostfixUnaryExpression */:\n                return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression));\n            case 193 /* ConditionalExpression */:\n                return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression));\n            case 194 /* TemplateExpression */:\n                return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan));\n            case 195 /* YieldExpression */:\n                return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 196 /* SpreadElement */:\n                return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 197 /* ClassExpression */:\n                return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement));\n            case 199 /* ExpressionWithTypeArguments */:\n                return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));\n            // Misc\n            case 202 /* TemplateSpan */:\n                return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail));\n            // Element\n            case 204 /* Block */:\n                return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement));\n            case 205 /* VariableStatement */:\n                return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList));\n            case 207 /* ExpressionStatement */:\n                return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 208 /* IfStatement */:\n                return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, /*optional*/ true, liftToBlock));\n            case 209 /* DoStatement */:\n                return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression));\n            case 210 /* WhileStatement */:\n                return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock));\n            case 211 /* ForStatement */:\n                return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock));\n            case 212 /* ForInStatement */:\n                return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock));\n            case 213 /* ForOfStatement */:\n                return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock));\n            case 214 /* ContinueStatement */:\n                return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true));\n            case 215 /* BreakStatement */:\n                return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true));\n            case 216 /* ReturnStatement */:\n                return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, /*optional*/ true));\n            case 217 /* WithStatement */:\n                return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock));\n            case 218 /* SwitchStatement */:\n                return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock));\n            case 219 /* LabeledStatement */:\n                return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock));\n            case 220 /* ThrowStatement */:\n                return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 221 /* TryStatement */:\n                return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, /*optional*/ true), visitNode(node.finallyBlock, visitor, ts.isBlock, /*optional*/ true));\n            case 223 /* VariableDeclaration */:\n                return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));\n            case 224 /* VariableDeclarationList */:\n                return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration));\n            case 225 /* FunctionDeclaration */:\n                return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context));\n            case 226 /* ClassDeclaration */:\n                return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement));\n            case 232 /* CaseBlock */:\n                return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause));\n            case 235 /* ImportDeclaration */:\n                return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression));\n            case 236 /* ImportClause */:\n                return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, /*optional*/ true));\n            case 237 /* NamespaceImport */:\n                return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier));\n            case 238 /* NamedImports */:\n                return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier));\n            case 239 /* ImportSpecifier */:\n                return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier));\n            case 240 /* ExportAssignment */:\n                return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression));\n            case 241 /* ExportDeclaration */:\n                return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, /*optional*/ true));\n            case 242 /* NamedExports */:\n                return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier));\n            case 243 /* ExportSpecifier */:\n                return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier));\n            // JSX\n            case 246 /* JsxElement */:\n                return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement));\n            case 247 /* JsxSelfClosingElement */:\n                return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike));\n            case 248 /* JsxOpeningElement */:\n                return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike));\n            case 249 /* JsxClosingElement */:\n                return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression));\n            case 250 /* JsxAttribute */:\n                return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression));\n            case 251 /* JsxSpreadAttribute */:\n                return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression));\n            case 252 /* JsxExpression */:\n                return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression));\n            // Clauses\n            case 253 /* CaseClause */:\n                return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement));\n            case 254 /* DefaultClause */:\n                return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement));\n            case 255 /* HeritageClause */:\n                return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments));\n            case 256 /* CatchClause */:\n                return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock));\n            // Property assignments\n            case 257 /* PropertyAssignment */:\n                return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));\n            case 258 /* ShorthandPropertyAssignment */:\n                return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression));\n            case 259 /* SpreadAssignment */:\n                return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression));\n            // Top-level nodes\n            case 261 /* SourceFile */:\n                return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));\n            // Transformation nodes\n            case 294 /* PartiallyEmittedExpression */:\n                return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));\n            default:\n                var updated = void 0;\n                var edgeTraversalPath = nodeEdgeTraversalMap[kind];\n                if (edgeTraversalPath) {\n                    for (var _i = 0, edgeTraversalPath_2 = edgeTraversalPath; _i < edgeTraversalPath_2.length; _i++) {\n                        var edge = edgeTraversalPath_2[_i];\n                        var value = node[edge.name];\n                        if (value !== undefined) {\n                            var visited = ts.isArray(value)\n                                ? visitNodes(value, visitor, edge.test, 0, value.length, edge.parenthesize, node)\n                                : visitNode(value, visitor, edge.test, edge.optional, edge.lift, edge.parenthesize, node);\n                            if (updated !== undefined || visited !== value) {\n                                if (updated === undefined) {\n                                    updated = ts.getMutableClone(node);\n                                }\n                                if (visited !== value) {\n                                    updated[edge.name] = visited;\n                                }\n                            }\n                        }\n                    }\n                }\n                return updated ? ts.updateNode(updated, node) : node;\n        }\n        // return node;\n    }\n    ts.visitEachChild = visitEachChild;\n    function mergeLexicalEnvironment(statements, declarations) {\n        if (!ts.some(declarations)) {\n            return statements;\n        }\n        return ts.isNodeArray(statements)\n            ? ts.createNodeArray(ts.concatenate(statements, declarations), statements)\n            : ts.addRange(statements, declarations);\n    }\n    ts.mergeLexicalEnvironment = mergeLexicalEnvironment;\n    function mergeFunctionBodyLexicalEnvironment(body, declarations) {\n        if (body && declarations !== undefined && declarations.length > 0) {\n            if (ts.isBlock(body)) {\n                return ts.updateBlock(body, ts.createNodeArray(ts.concatenate(body.statements, declarations), body.statements));\n            }\n            else {\n                return ts.createBlock(ts.createNodeArray([ts.createReturn(body, /*location*/ body)].concat(declarations), body), \n                /*location*/ body, \n                /*multiLine*/ true);\n            }\n        }\n        return body;\n    }\n    ts.mergeFunctionBodyLexicalEnvironment = mergeFunctionBodyLexicalEnvironment;\n    /**\n     * Lifts a NodeArray containing only Statement nodes to a block.\n     *\n     * @param nodes The NodeArray.\n     */\n    function liftToBlock(nodes) {\n        Debug.assert(ts.every(nodes, ts.isStatement), \"Cannot lift nodes to a Block.\");\n        return ts.singleOrUndefined(nodes) || ts.createBlock(nodes);\n    }\n    ts.liftToBlock = liftToBlock;\n    /**\n     * Extracts the single node from a NodeArray.\n     *\n     * @param nodes The NodeArray.\n     */\n    function extractSingleNode(nodes) {\n        Debug.assert(nodes.length <= 1, \"Too many nodes written to output.\");\n        return ts.singleOrUndefined(nodes);\n    }\n    /**\n     * Aggregates the TransformFlags for a Node and its subtree.\n     */\n    function aggregateTransformFlags(node) {\n        aggregateTransformFlagsForNode(node);\n        return node;\n    }\n    ts.aggregateTransformFlags = aggregateTransformFlags;\n    /**\n     * Aggregates the TransformFlags for a Node and its subtree. The flags for the subtree are\n     * computed first, then the transform flags for the current node are computed from the subtree\n     * flags and the state of the current node. Finally, the transform flags of the node are\n     * returned, excluding any flags that should not be included in its parent node's subtree\n     * flags.\n     */\n    function aggregateTransformFlagsForNode(node) {\n        if (node === undefined) {\n            return 0 /* None */;\n        }\n        if (node.transformFlags & 536870912 /* HasComputedFlags */) {\n            return node.transformFlags & ~ts.getTransformFlagsSubtreeExclusions(node.kind);\n        }\n        var subtreeFlags = aggregateTransformFlagsForSubtree(node);\n        return ts.computeTransformFlagsForNode(node, subtreeFlags);\n    }\n    function aggregateTransformFlagsForNodeArray(nodes) {\n        if (nodes === undefined) {\n            return 0 /* None */;\n        }\n        var subtreeFlags = 0 /* None */;\n        var nodeArrayFlags = 0 /* None */;\n        for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) {\n            var node = nodes_3[_i];\n            subtreeFlags |= aggregateTransformFlagsForNode(node);\n            nodeArrayFlags |= node.transformFlags & ~536870912 /* HasComputedFlags */;\n        }\n        nodes.transformFlags = nodeArrayFlags | 536870912 /* HasComputedFlags */;\n        return subtreeFlags;\n    }\n    /**\n     * Aggregates the transform flags for the subtree of a node.\n     */\n    function aggregateTransformFlagsForSubtree(node) {\n        // We do not transform ambient declarations or types, so there is no need to\n        // recursively aggregate transform flags.\n        if (ts.hasModifier(node, 2 /* Ambient */) || ts.isTypeNode(node)) {\n            return 0 /* None */;\n        }\n        // Aggregate the transform flags of each child.\n        return reduceEachChild(node, 0 /* None */, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes);\n    }\n    /**\n     * Aggregates the TransformFlags of a child node with the TransformFlags of its\n     * siblings.\n     */\n    function aggregateTransformFlagsForChildNode(transformFlags, node) {\n        return transformFlags | aggregateTransformFlagsForNode(node);\n    }\n    function aggregateTransformFlagsForChildNodes(transformFlags, nodes) {\n        return transformFlags | aggregateTransformFlagsForNodeArray(nodes);\n    }\n    var Debug;\n    (function (Debug) {\n        Debug.failNotOptional = Debug.shouldAssert(1 /* Normal */)\n            ? function (message) { return Debug.assert(false, message || \"Node not optional.\"); }\n            : ts.noop;\n        Debug.failBadSyntaxKind = Debug.shouldAssert(1 /* Normal */)\n            ? function (node, message) { return Debug.assert(false, message || \"Unexpected node.\", function () { return \"Node \" + ts.formatSyntaxKind(node.kind) + \" was unexpected.\"; }); }\n            : ts.noop;\n        Debug.assertEachNode = Debug.shouldAssert(1 /* Normal */)\n            ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || \"Unexpected node.\", function () { return \"Node array did not pass test '\" + getFunctionName(test) + \"'.\"; }); }\n            : ts.noop;\n        Debug.assertNode = Debug.shouldAssert(1 /* Normal */)\n            ? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || \"Unexpected node.\", function () { return \"Node \" + ts.formatSyntaxKind(node.kind) + \" did not pass test '\" + getFunctionName(test) + \"'.\"; }); }\n            : ts.noop;\n        Debug.assertOptionalNode = Debug.shouldAssert(1 /* Normal */)\n            ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || \"Unexpected node.\", function () { return \"Node \" + ts.formatSyntaxKind(node.kind) + \" did not pass test '\" + getFunctionName(test) + \"'.\"; }); }\n            : ts.noop;\n        Debug.assertOptionalToken = Debug.shouldAssert(1 /* Normal */)\n            ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || \"Unexpected node.\", function () { return \"Node \" + ts.formatSyntaxKind(node.kind) + \" was not a '\" + ts.formatSyntaxKind(kind) + \"' token.\"; }); }\n            : ts.noop;\n        Debug.assertMissingNode = Debug.shouldAssert(1 /* Normal */)\n            ? function (node, message) { return Debug.assert(node === undefined, message || \"Unexpected node.\", function () { return \"Node \" + ts.formatSyntaxKind(node.kind) + \" was unexpected'.\"; }); }\n            : ts.noop;\n        function getFunctionName(func) {\n            if (typeof func !== \"function\") {\n                return \"\";\n            }\n            else if (func.hasOwnProperty(\"name\")) {\n                return func.name;\n            }\n            else {\n                var text = Function.prototype.toString.call(func);\n                var match = /^function\\s+([\\w\\$]+)\\s*\\(/.exec(text);\n                return match ? match[1] : \"\";\n            }\n        }\n    })(Debug = ts.Debug || (ts.Debug = {}));\n    var _a;\n})(ts || (ts = {}));\n/// <reference path=\"../factory.ts\" />\n/// <reference path=\"../visitor.ts\" />\n/*@internal*/\nvar ts;\n(function (ts) {\n    var FlattenLevel;\n    (function (FlattenLevel) {\n        FlattenLevel[FlattenLevel[\"All\"] = 0] = \"All\";\n        FlattenLevel[FlattenLevel[\"ObjectRest\"] = 1] = \"ObjectRest\";\n    })(FlattenLevel = ts.FlattenLevel || (ts.FlattenLevel = {}));\n    /**\n     * Flattens a DestructuringAssignment or a VariableDeclaration to an expression.\n     *\n     * @param node The node to flatten.\n     * @param visitor An optional visitor used to visit initializers.\n     * @param context The transformation context.\n     * @param level Indicates the extent to which flattening should occur.\n     * @param needsValue An optional value indicating whether the value from the right-hand-side of\n     * the destructuring assignment is needed as part of a larger expression.\n     * @param createAssignmentCallback An optional callback used to create the assignment expression.\n     */\n    function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) {\n        var location = node;\n        var value;\n        if (ts.isDestructuringAssignment(node)) {\n            value = node.right;\n            while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) {\n                if (ts.isDestructuringAssignment(value)) {\n                    location = node = value;\n                    value = node.right;\n                }\n                else {\n                    return value;\n                }\n            }\n        }\n        var expressions;\n        var flattenContext = {\n            context: context,\n            level: level,\n            hoistTempVariables: true,\n            emitExpression: emitExpression,\n            emitBindingOrAssignment: emitBindingOrAssignment,\n            createArrayBindingOrAssignmentPattern: makeArrayAssignmentPattern,\n            createObjectBindingOrAssignmentPattern: makeObjectAssignmentPattern,\n            createArrayBindingOrAssignmentElement: makeAssignmentElement,\n            visitor: visitor\n        };\n        if (value) {\n            value = ts.visitNode(value, visitor, ts.isExpression);\n            if (needsValue) {\n                // If the right-hand value of the destructuring assignment needs to be preserved (as\n                // is the case when the destructuring assignment is part of a larger expression),\n                // then we need to cache the right-hand value.\n                //\n                // The source map location for the assignment should point to the entire binary\n                // expression.\n                value = ensureIdentifier(flattenContext, value, /*reuseIdentifierExpressions*/ true, location);\n            }\n            else if (ts.nodeIsSynthesized(node)) {\n                // Generally, the source map location for a destructuring assignment is the root\n                // expression.\n                //\n                // However, if the root expression is synthesized (as in the case\n                // of the initializer when transforming a ForOfStatement), then the source map\n                // location should point to the right-hand value of the expression.\n                location = value;\n            }\n        }\n        flattenBindingOrAssignmentElement(flattenContext, node, value, location, /*skipInitializer*/ ts.isDestructuringAssignment(node));\n        if (value && needsValue) {\n            if (!ts.some(expressions)) {\n                return value;\n            }\n            expressions.push(value);\n        }\n        return ts.aggregateTransformFlags(ts.inlineExpressions(expressions)) || ts.createOmittedExpression();\n        function emitExpression(expression) {\n            // NOTE: this completely disables source maps, but aligns with the behavior of\n            //       `emitAssignment` in the old emitter.\n            ts.setEmitFlags(expression, 64 /* NoNestedSourceMaps */);\n            ts.aggregateTransformFlags(expression);\n            expressions = ts.append(expressions, expression);\n        }\n        function emitBindingOrAssignment(target, value, location, original) {\n            ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression);\n            var expression = createAssignmentCallback\n                ? createAssignmentCallback(target, value, location)\n                : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location);\n            expression.original = original;\n            emitExpression(expression);\n        }\n    }\n    ts.flattenDestructuringAssignment = flattenDestructuringAssignment;\n    /**\n     * Flattens a VariableDeclaration or ParameterDeclaration to one or more variable declarations.\n     *\n     * @param node The node to flatten.\n     * @param visitor An optional visitor used to visit initializers.\n     * @param context The transformation context.\n     * @param boundValue The value bound to the declaration.\n     * @param skipInitializer A value indicating whether to ignore the initializer of `node`.\n     * @param hoistTempVariables Indicates whether temporary variables should not be recorded in-line.\n     * @param level Indicates the extent to which flattening should occur.\n     */\n    function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) {\n        var pendingExpressions;\n        var pendingDeclarations = [];\n        var declarations = [];\n        var flattenContext = {\n            context: context,\n            level: level,\n            hoistTempVariables: hoistTempVariables,\n            emitExpression: emitExpression,\n            emitBindingOrAssignment: emitBindingOrAssignment,\n            createArrayBindingOrAssignmentPattern: makeArrayBindingPattern,\n            createObjectBindingOrAssignmentPattern: makeObjectBindingPattern,\n            createArrayBindingOrAssignmentElement: makeBindingElement,\n            visitor: visitor\n        };\n        flattenBindingOrAssignmentElement(flattenContext, node, rval, node, skipInitializer);\n        if (pendingExpressions) {\n            var temp = ts.createTempVariable(/*recordTempVariable*/ undefined);\n            if (hoistTempVariables) {\n                var value = ts.inlineExpressions(pendingExpressions);\n                pendingExpressions = undefined;\n                emitBindingOrAssignment(temp, value, /*location*/ undefined, /*original*/ undefined);\n            }\n            else {\n                context.hoistVariableDeclaration(temp);\n                var pendingDeclaration = ts.lastOrUndefined(pendingDeclarations);\n                pendingDeclaration.pendingExpressions = ts.append(pendingDeclaration.pendingExpressions, ts.createAssignment(temp, pendingDeclaration.value));\n                ts.addRange(pendingDeclaration.pendingExpressions, pendingExpressions);\n                pendingDeclaration.value = temp;\n            }\n        }\n        for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) {\n            var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_30 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original;\n            var variable = ts.createVariableDeclaration(name_30, \n            /*type*/ undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2);\n            variable.original = original;\n            if (ts.isIdentifier(name_30)) {\n                ts.setEmitFlags(variable, 64 /* NoNestedSourceMaps */);\n            }\n            ts.aggregateTransformFlags(variable);\n            declarations.push(variable);\n        }\n        return declarations;\n        function emitExpression(value) {\n            pendingExpressions = ts.append(pendingExpressions, value);\n        }\n        function emitBindingOrAssignment(target, value, location, original) {\n            ts.Debug.assertNode(target, ts.isBindingName);\n            if (pendingExpressions) {\n                value = ts.inlineExpressions(ts.append(pendingExpressions, value));\n                pendingExpressions = undefined;\n            }\n            pendingDeclarations.push({ pendingExpressions: pendingExpressions, name: target, value: value, location: location, original: original });\n        }\n    }\n    ts.flattenDestructuringBinding = flattenDestructuringBinding;\n    /**\n     * Flattens a BindingOrAssignmentElement into zero or more bindings or assignments.\n     *\n     * @param flattenContext Options used to control flattening.\n     * @param element The element to flatten.\n     * @param value The current RHS value to assign to the element.\n     * @param location The location to use for source maps and comments.\n     * @param skipInitializer An optional value indicating whether to include the initializer\n     * for the element.\n     */\n    function flattenBindingOrAssignmentElement(flattenContext, element, value, location, skipInitializer) {\n        if (!skipInitializer) {\n            var initializer = ts.visitNode(ts.getInitializerOfBindingOrAssignmentElement(element), flattenContext.visitor, ts.isExpression);\n            if (initializer) {\n                // Combine value and initializer\n                value = value ? createDefaultValueCheck(flattenContext, value, initializer, location) : initializer;\n            }\n            else if (!value) {\n                // Use 'void 0' in absence of value and initializer\n                value = ts.createVoidZero();\n            }\n        }\n        var bindingTarget = ts.getTargetOfBindingOrAssignmentElement(element);\n        if (ts.isObjectBindingOrAssignmentPattern(bindingTarget)) {\n            flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);\n        }\n        else if (ts.isArrayBindingOrAssignmentPattern(bindingTarget)) {\n            flattenArrayBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);\n        }\n        else {\n            flattenContext.emitBindingOrAssignment(bindingTarget, value, location, /*original*/ element);\n        }\n    }\n    /**\n     * Flattens an ObjectBindingOrAssignmentPattern into zero or more bindings or assignments.\n     *\n     * @param flattenContext Options used to control flattening.\n     * @param parent The parent element of the pattern.\n     * @param pattern The ObjectBindingOrAssignmentPattern to flatten.\n     * @param value The current RHS value to assign to the element.\n     * @param location The location to use for source maps and comments.\n     */\n    function flattenObjectBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {\n        var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);\n        var numElements = elements.length;\n        if (numElements !== 1) {\n            // For anything other than a single-element destructuring we need to generate a temporary\n            // to ensure value is evaluated exactly once. Additionally, if we have zero elements\n            // we need to emit *something* to ensure that in case a 'var' keyword was already emitted,\n            // so in that case, we'll intentionally create that temporary.\n            var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;\n            value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);\n        }\n        var bindingElements;\n        var computedTempVariables;\n        for (var i = 0; i < numElements; i++) {\n            var element = elements[i];\n            if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {\n                var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(element);\n                if (flattenContext.level >= 1 /* ObjectRest */\n                    && !(element.transformFlags & (524288 /* ContainsRest */ | 1048576 /* ContainsObjectRest */))\n                    && !(ts.getTargetOfBindingOrAssignmentElement(element).transformFlags & (524288 /* ContainsRest */ | 1048576 /* ContainsObjectRest */))\n                    && !ts.isComputedPropertyName(propertyName)) {\n                    bindingElements = ts.append(bindingElements, element);\n                }\n                else {\n                    if (bindingElements) {\n                        flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);\n                        bindingElements = undefined;\n                    }\n                    var rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName);\n                    if (ts.isComputedPropertyName(propertyName)) {\n                        computedTempVariables = ts.append(computedTempVariables, rhsValue.argumentExpression);\n                    }\n                    flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element);\n                }\n            }\n            else if (i === numElements - 1) {\n                if (bindingElements) {\n                    flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);\n                    bindingElements = undefined;\n                }\n                var rhsValue = createRestCall(flattenContext.context, value, elements, computedTempVariables, pattern);\n                flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);\n            }\n        }\n        if (bindingElements) {\n            flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);\n        }\n    }\n    /**\n     * Flattens an ArrayBindingOrAssignmentPattern into zero or more bindings or assignments.\n     *\n     * @param flattenContext Options used to control flattening.\n     * @param parent The parent element of the pattern.\n     * @param pattern The ArrayBindingOrAssignmentPattern to flatten.\n     * @param value The current RHS value to assign to the element.\n     * @param location The location to use for source maps and comments.\n     */\n    function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {\n        var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);\n        var numElements = elements.length;\n        if (numElements !== 1 && (flattenContext.level < 1 /* ObjectRest */ || numElements === 0)) {\n            // For anything other than a single-element destructuring we need to generate a temporary\n            // to ensure value is evaluated exactly once. Additionally, if we have zero elements\n            // we need to emit *something* to ensure that in case a 'var' keyword was already emitted,\n            // so in that case, we'll intentionally create that temporary.\n            var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;\n            value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);\n        }\n        var bindingElements;\n        var restContainingElements;\n        for (var i = 0; i < numElements; i++) {\n            var element = elements[i];\n            if (flattenContext.level >= 1 /* ObjectRest */) {\n                // If an array pattern contains an ObjectRest, we must cache the result so that we\n                // can perform the ObjectRest destructuring in a different declaration\n                if (element.transformFlags & 1048576 /* ContainsObjectRest */) {\n                    var temp = ts.createTempVariable(/*recordTempVariable*/ undefined);\n                    if (flattenContext.hoistTempVariables) {\n                        flattenContext.context.hoistVariableDeclaration(temp);\n                    }\n                    restContainingElements = ts.append(restContainingElements, [temp, element]);\n                    bindingElements = ts.append(bindingElements, flattenContext.createArrayBindingOrAssignmentElement(temp));\n                }\n                else {\n                    bindingElements = ts.append(bindingElements, element);\n                }\n            }\n            else if (ts.isOmittedExpression(element)) {\n                continue;\n            }\n            else if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {\n                var rhsValue = ts.createElementAccess(value, i);\n                flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element);\n            }\n            else if (i === numElements - 1) {\n                var rhsValue = ts.createArraySlice(value, i);\n                flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element);\n            }\n        }\n        if (bindingElements) {\n            flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern);\n        }\n        if (restContainingElements) {\n            for (var _i = 0, restContainingElements_1 = restContainingElements; _i < restContainingElements_1.length; _i++) {\n                var _a = restContainingElements_1[_i], id = _a[0], element = _a[1];\n                flattenBindingOrAssignmentElement(flattenContext, element, id, element);\n            }\n        }\n    }\n    /**\n     * Creates an expression used to provide a default value if a value is `undefined` at runtime.\n     *\n     * @param flattenContext Options used to control flattening.\n     * @param value The RHS value to test.\n     * @param defaultValue The default value to use if `value` is `undefined` at runtime.\n     * @param location The location to use for source maps and comments.\n     */\n    function createDefaultValueCheck(flattenContext, value, defaultValue, location) {\n        value = ensureIdentifier(flattenContext, value, /*reuseIdentifierExpressions*/ true, location);\n        return ts.createConditional(ts.createTypeCheck(value, \"undefined\"), defaultValue, value);\n    }\n    /**\n     * Creates either a PropertyAccessExpression or an ElementAccessExpression for the\n     * right-hand side of a transformed destructuring assignment.\n     *\n     * @link https://tc39.github.io/ecma262/#sec-runtime-semantics-keyeddestructuringassignmentevaluation\n     *\n     * @param flattenContext Options used to control flattening.\n     * @param value The RHS value that is the source of the property.\n     * @param propertyName The destructuring property name.\n     */\n    function createDestructuringPropertyAccess(flattenContext, value, propertyName) {\n        if (ts.isComputedPropertyName(propertyName)) {\n            var argumentExpression = ensureIdentifier(flattenContext, propertyName.expression, /*reuseIdentifierExpressions*/ false, /*location*/ propertyName);\n            return ts.createElementAccess(value, argumentExpression);\n        }\n        else if (ts.isStringOrNumericLiteral(propertyName)) {\n            var argumentExpression = ts.getSynthesizedClone(propertyName);\n            argumentExpression.text = ts.unescapeIdentifier(argumentExpression.text);\n            return ts.createElementAccess(value, argumentExpression);\n        }\n        else {\n            var name_31 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text));\n            return ts.createPropertyAccess(value, name_31);\n        }\n    }\n    /**\n     * Ensures that there exists a declared identifier whose value holds the given expression.\n     * This function is useful to ensure that the expression's value can be read from in subsequent expressions.\n     * Unless 'reuseIdentifierExpressions' is false, 'value' will be returned if it is just an identifier.\n     *\n     * @param flattenContext Options used to control flattening.\n     * @param value the expression whose value needs to be bound.\n     * @param reuseIdentifierExpressions true if identifier expressions can simply be returned;\n     * false if it is necessary to always emit an identifier.\n     * @param location The location to use for source maps and comments.\n     */\n    function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) {\n        if (ts.isIdentifier(value) && reuseIdentifierExpressions) {\n            return value;\n        }\n        else {\n            var temp = ts.createTempVariable(/*recordTempVariable*/ undefined);\n            if (flattenContext.hoistTempVariables) {\n                flattenContext.context.hoistVariableDeclaration(temp);\n                flattenContext.emitExpression(ts.createAssignment(temp, value, location));\n            }\n            else {\n                flattenContext.emitBindingOrAssignment(temp, value, location, /*original*/ undefined);\n            }\n            return temp;\n        }\n    }\n    function makeArrayBindingPattern(elements) {\n        ts.Debug.assertEachNode(elements, ts.isArrayBindingElement);\n        return ts.createArrayBindingPattern(elements);\n    }\n    function makeArrayAssignmentPattern(elements) {\n        return ts.createArrayLiteral(ts.map(elements, ts.convertToArrayAssignmentElement));\n    }\n    function makeObjectBindingPattern(elements) {\n        ts.Debug.assertEachNode(elements, ts.isBindingElement);\n        return ts.createObjectBindingPattern(elements);\n    }\n    function makeObjectAssignmentPattern(elements) {\n        return ts.createObjectLiteral(ts.map(elements, ts.convertToObjectAssignmentElement));\n    }\n    function makeBindingElement(name) {\n        return ts.createBindingElement(/*propertyName*/ undefined, /*dotDotDotToken*/ undefined, name);\n    }\n    function makeAssignmentElement(name) {\n        return name;\n    }\n    var restHelper = {\n        name: \"typescript:rest\",\n        scoped: false,\n        text: \"\\n            var __rest = (this && this.__rest) || function (s, e) {\\n                var t = {};\\n                for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\\n                    t[p] = s[p];\\n                if (s != null && typeof Object.getOwnPropertySymbols === \\\"function\\\")\\n                    for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\\n                        t[p[i]] = s[p[i]];\\n                return t;\\n            };\"\n    };\n    /** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement\n     * `{ a, b, ...p } = o`, create `p = __rest(o, [\"a\", \"b\"]);`*/\n    function createRestCall(context, value, elements, computedTempVariables, location) {\n        context.requestEmitHelper(restHelper);\n        var propertyNames = [];\n        var computedTempVariableOffset = 0;\n        for (var i = 0; i < elements.length - 1; i++) {\n            var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(elements[i]);\n            if (propertyName) {\n                if (ts.isComputedPropertyName(propertyName)) {\n                    var temp = computedTempVariables[computedTempVariableOffset];\n                    computedTempVariableOffset++;\n                    // typeof _tmp === \"symbol\" ? _tmp : _tmp + \"\"\n                    propertyNames.push(ts.createConditional(ts.createTypeCheck(temp, \"symbol\"), temp, ts.createAdd(temp, ts.createLiteral(\"\"))));\n                }\n                else {\n                    propertyNames.push(ts.createLiteral(propertyName));\n                }\n            }\n        }\n        return ts.createCall(ts.getHelperName(\"__rest\"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]);\n    }\n})(ts || (ts = {}));\n/// <reference path=\"../factory.ts\" />\n/// <reference path=\"../visitor.ts\" />\n/// <reference path=\"./destructuring.ts\" />\n/*@internal*/\nvar ts;\n(function (ts) {\n    /**\n     * Indicates whether to emit type metadata in the new format.\n     */\n    var USE_NEW_TYPE_METADATA_FORMAT = false;\n    var TypeScriptSubstitutionFlags;\n    (function (TypeScriptSubstitutionFlags) {\n        /** Enables substitutions for decorated classes. */\n        TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags[\"ClassAliases\"] = 1] = \"ClassAliases\";\n        /** Enables substitutions for namespace exports. */\n        TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags[\"NamespaceExports\"] = 2] = \"NamespaceExports\";\n        /* Enables substitutions for unqualified enum members */\n        TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags[\"NonQualifiedEnumMembers\"] = 8] = \"NonQualifiedEnumMembers\";\n    })(TypeScriptSubstitutionFlags || (TypeScriptSubstitutionFlags = {}));\n    function transformTypeScript(context) {\n        var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;\n        var resolver = context.getEmitResolver();\n        var compilerOptions = context.getCompilerOptions();\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        var moduleKind = ts.getEmitModuleKind(compilerOptions);\n        // Save the previous transformation hooks.\n        var previousOnEmitNode = context.onEmitNode;\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        // Set new transformation hooks.\n        context.onEmitNode = onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        // Enable substitution for property/element access to emit const enum values.\n        context.enableSubstitution(177 /* PropertyAccessExpression */);\n        context.enableSubstitution(178 /* ElementAccessExpression */);\n        // These variables contain state that changes as we descend into the tree.\n        var currentSourceFile;\n        var currentNamespace;\n        var currentNamespaceContainerName;\n        var currentScope;\n        var currentScopeFirstDeclarationsOfName;\n        /**\n         * Keeps track of whether expression substitution has been enabled for specific edge cases.\n         * They are persisted between each SourceFile transformation and should not be reset.\n         */\n        var enabledSubstitutions;\n        /**\n         * A map that keeps track of aliases created for classes with decorators to avoid issues\n         * with the double-binding behavior of classes.\n         */\n        var classAliases;\n        /**\n         * Keeps track of whether  we are within any containing namespaces when performing\n         * just-in-time substitution while printing an expression identifier.\n         */\n        var applicableSubstitutions;\n        return transformSourceFile;\n        /**\n         * Transform TypeScript-specific syntax in a SourceFile.\n         *\n         * @param node A SourceFile node.\n         */\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            currentSourceFile = node;\n            var visited = saveStateAndInvoke(node, visitSourceFile);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            currentSourceFile = undefined;\n            return visited;\n        }\n        /**\n         * Visits a node, saving and restoring state variables on the stack.\n         *\n         * @param node The node to visit.\n         */\n        function saveStateAndInvoke(node, f) {\n            // Save state\n            var savedCurrentScope = currentScope;\n            var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;\n            // Handle state changes before visiting a node.\n            onBeforeVisitNode(node);\n            var visited = f(node);\n            // Restore state\n            if (currentScope !== savedCurrentScope) {\n                currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;\n            }\n            currentScope = savedCurrentScope;\n            return visited;\n        }\n        /**\n         * Performs actions that should always occur immediately before visiting a node.\n         *\n         * @param node The node to visit.\n         */\n        function onBeforeVisitNode(node) {\n            switch (node.kind) {\n                case 261 /* SourceFile */:\n                case 232 /* CaseBlock */:\n                case 231 /* ModuleBlock */:\n                case 204 /* Block */:\n                    currentScope = node;\n                    currentScopeFirstDeclarationsOfName = undefined;\n                    break;\n                case 226 /* ClassDeclaration */:\n                case 225 /* FunctionDeclaration */:\n                    if (ts.hasModifier(node, 2 /* Ambient */)) {\n                        break;\n                    }\n                    recordEmittedDeclarationInScope(node);\n                    break;\n            }\n        }\n        /**\n         * General-purpose node visitor.\n         *\n         * @param node The node to visit.\n         */\n        function visitor(node) {\n            return saveStateAndInvoke(node, visitorWorker);\n        }\n        /**\n         * Visits and possibly transforms any node.\n         *\n         * @param node The node to visit.\n         */\n        function visitorWorker(node) {\n            if (node.transformFlags & 1 /* TypeScript */) {\n                // This node is explicitly marked as TypeScript, so we should transform the node.\n                return visitTypeScript(node);\n            }\n            else if (node.transformFlags & 2 /* ContainsTypeScript */) {\n                // This node contains TypeScript, so we should visit its children.\n                return ts.visitEachChild(node, visitor, context);\n            }\n            return node;\n        }\n        /**\n         * Specialized visitor that visits the immediate children of a SourceFile.\n         *\n         * @param node The node to visit.\n         */\n        function sourceElementVisitor(node) {\n            return saveStateAndInvoke(node, sourceElementVisitorWorker);\n        }\n        /**\n         * Specialized visitor that visits the immediate children of a SourceFile.\n         *\n         * @param node The node to visit.\n         */\n        function sourceElementVisitorWorker(node) {\n            switch (node.kind) {\n                case 235 /* ImportDeclaration */:\n                    return visitImportDeclaration(node);\n                case 234 /* ImportEqualsDeclaration */:\n                    return visitImportEqualsDeclaration(node);\n                case 240 /* ExportAssignment */:\n                    return visitExportAssignment(node);\n                case 241 /* ExportDeclaration */:\n                    return visitExportDeclaration(node);\n                default:\n                    return visitorWorker(node);\n            }\n        }\n        /**\n         * Specialized visitor that visits the immediate children of a namespace.\n         *\n         * @param node The node to visit.\n         */\n        function namespaceElementVisitor(node) {\n            return saveStateAndInvoke(node, namespaceElementVisitorWorker);\n        }\n        /**\n         * Specialized visitor that visits the immediate children of a namespace.\n         *\n         * @param node The node to visit.\n         */\n        function namespaceElementVisitorWorker(node) {\n            if (node.kind === 241 /* ExportDeclaration */ ||\n                node.kind === 235 /* ImportDeclaration */ ||\n                node.kind === 236 /* ImportClause */ ||\n                (node.kind === 234 /* ImportEqualsDeclaration */ &&\n                    node.moduleReference.kind === 245 /* ExternalModuleReference */)) {\n                // do not emit ES6 imports and exports since they are illegal inside a namespace\n                return undefined;\n            }\n            else if (node.transformFlags & 1 /* TypeScript */ || ts.hasModifier(node, 1 /* Export */)) {\n                // This node is explicitly marked as TypeScript, or is exported at the namespace\n                // level, so we should transform the node.\n                return visitTypeScript(node);\n            }\n            else if (node.transformFlags & 2 /* ContainsTypeScript */) {\n                // This node contains TypeScript, so we should visit its children.\n                return ts.visitEachChild(node, visitor, context);\n            }\n            return node;\n        }\n        /**\n         * Specialized visitor that visits the immediate children of a class with TypeScript syntax.\n         *\n         * @param node The node to visit.\n         */\n        function classElementVisitor(node) {\n            return saveStateAndInvoke(node, classElementVisitorWorker);\n        }\n        /**\n         * Specialized visitor that visits the immediate children of a class with TypeScript syntax.\n         *\n         * @param node The node to visit.\n         */\n        function classElementVisitorWorker(node) {\n            switch (node.kind) {\n                case 150 /* Constructor */:\n                    // TypeScript constructors are transformed in `visitClassDeclaration`.\n                    // We elide them here as `visitorWorker` checks transform flags, which could\n                    // erronously include an ES6 constructor without TypeScript syntax.\n                    return undefined;\n                case 147 /* PropertyDeclaration */:\n                case 155 /* IndexSignature */:\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                case 149 /* MethodDeclaration */:\n                    // Fallback to the default visit behavior.\n                    return visitorWorker(node);\n                case 203 /* SemicolonClassElement */:\n                    return node;\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    return undefined;\n            }\n        }\n        function modifierVisitor(node) {\n            if (ts.modifierToFlag(node.kind) & 2270 /* TypeScriptModifier */) {\n                return undefined;\n            }\n            else if (currentNamespace && node.kind === 83 /* ExportKeyword */) {\n                return undefined;\n            }\n            return node;\n        }\n        /**\n         * Branching visitor, visits a TypeScript syntax node.\n         *\n         * @param node The node to visit.\n         */\n        function visitTypeScript(node) {\n            if (ts.hasModifier(node, 2 /* Ambient */) && ts.isStatement(node)) {\n                // TypeScript ambient declarations are elided, but some comments may be preserved.\n                // See the implementation of `getLeadingComments` in comments.ts for more details.\n                return ts.createNotEmittedStatement(node);\n            }\n            switch (node.kind) {\n                case 83 /* ExportKeyword */:\n                case 78 /* DefaultKeyword */:\n                    // ES6 export and default modifiers are elided when inside a namespace.\n                    return currentNamespace ? undefined : node;\n                case 113 /* PublicKeyword */:\n                case 111 /* PrivateKeyword */:\n                case 112 /* ProtectedKeyword */:\n                case 116 /* AbstractKeyword */:\n                case 75 /* ConstKeyword */:\n                case 123 /* DeclareKeyword */:\n                case 130 /* ReadonlyKeyword */:\n                // TypeScript accessibility and readonly modifiers are elided.\n                case 162 /* ArrayType */:\n                case 163 /* TupleType */:\n                case 161 /* TypeLiteral */:\n                case 156 /* TypePredicate */:\n                case 143 /* TypeParameter */:\n                case 118 /* AnyKeyword */:\n                case 121 /* BooleanKeyword */:\n                case 134 /* StringKeyword */:\n                case 132 /* NumberKeyword */:\n                case 129 /* NeverKeyword */:\n                case 104 /* VoidKeyword */:\n                case 135 /* SymbolKeyword */:\n                case 159 /* ConstructorType */:\n                case 158 /* FunctionType */:\n                case 160 /* TypeQuery */:\n                case 157 /* TypeReference */:\n                case 164 /* UnionType */:\n                case 165 /* IntersectionType */:\n                case 166 /* ParenthesizedType */:\n                case 167 /* ThisType */:\n                case 168 /* TypeOperator */:\n                case 169 /* IndexedAccessType */:\n                case 170 /* MappedType */:\n                case 171 /* LiteralType */:\n                // TypeScript type nodes are elided.\n                case 155 /* IndexSignature */:\n                // TypeScript index signatures are elided.\n                case 145 /* Decorator */:\n                // TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration.\n                case 228 /* TypeAliasDeclaration */:\n                // TypeScript type-only declarations are elided.\n                case 147 /* PropertyDeclaration */:\n                    // TypeScript property declarations are elided.\n                    return undefined;\n                case 150 /* Constructor */:\n                    return visitConstructor(node);\n                case 227 /* InterfaceDeclaration */:\n                    // TypeScript interfaces are elided, but some comments may be preserved.\n                    // See the implementation of `getLeadingComments` in comments.ts for more details.\n                    return ts.createNotEmittedStatement(node);\n                case 226 /* ClassDeclaration */:\n                    // This is a class declaration with TypeScript syntax extensions.\n                    //\n                    // TypeScript class syntax extensions include:\n                    // - decorators\n                    // - optional `implements` heritage clause\n                    // - parameter property assignments in the constructor\n                    // - property declarations\n                    // - index signatures\n                    // - method overload signatures\n                    return visitClassDeclaration(node);\n                case 197 /* ClassExpression */:\n                    // This is a class expression with TypeScript syntax extensions.\n                    //\n                    // TypeScript class syntax extensions include:\n                    // - decorators\n                    // - optional `implements` heritage clause\n                    // - parameter property assignments in the constructor\n                    // - property declarations\n                    // - index signatures\n                    // - method overload signatures\n                    return visitClassExpression(node);\n                case 255 /* HeritageClause */:\n                    // This is a heritage clause with TypeScript syntax extensions.\n                    //\n                    // TypeScript heritage clause extensions include:\n                    // - `implements` clause\n                    return visitHeritageClause(node);\n                case 199 /* ExpressionWithTypeArguments */:\n                    // TypeScript supports type arguments on an expression in an `extends` heritage clause.\n                    return visitExpressionWithTypeArguments(node);\n                case 149 /* MethodDeclaration */:\n                    // TypeScript method declarations may have decorators, modifiers\n                    // or type annotations.\n                    return visitMethodDeclaration(node);\n                case 151 /* GetAccessor */:\n                    // Get Accessors can have TypeScript modifiers, decorators, and type annotations.\n                    return visitGetAccessor(node);\n                case 152 /* SetAccessor */:\n                    // Set Accessors can have TypeScript modifiers and type annotations.\n                    return visitSetAccessor(node);\n                case 225 /* FunctionDeclaration */:\n                    // Typescript function declarations can have modifiers, decorators, and type annotations.\n                    return visitFunctionDeclaration(node);\n                case 184 /* FunctionExpression */:\n                    // TypeScript function expressions can have modifiers and type annotations.\n                    return visitFunctionExpression(node);\n                case 185 /* ArrowFunction */:\n                    // TypeScript arrow functions can have modifiers and type annotations.\n                    return visitArrowFunction(node);\n                case 144 /* Parameter */:\n                    // This is a parameter declaration with TypeScript syntax extensions.\n                    //\n                    // TypeScript parameter declaration syntax extensions include:\n                    // - decorators\n                    // - accessibility modifiers\n                    // - the question mark (?) token for optional parameters\n                    // - type annotations\n                    // - this parameters\n                    return visitParameter(node);\n                case 183 /* ParenthesizedExpression */:\n                    // ParenthesizedExpressions are TypeScript if their expression is a\n                    // TypeAssertion or AsExpression\n                    return visitParenthesizedExpression(node);\n                case 182 /* TypeAssertionExpression */:\n                case 200 /* AsExpression */:\n                    // TypeScript type assertions are removed, but their subtrees are preserved.\n                    return visitAssertionExpression(node);\n                case 179 /* CallExpression */:\n                    return visitCallExpression(node);\n                case 180 /* NewExpression */:\n                    return visitNewExpression(node);\n                case 201 /* NonNullExpression */:\n                    // TypeScript non-null expressions are removed, but their subtrees are preserved.\n                    return visitNonNullExpression(node);\n                case 229 /* EnumDeclaration */:\n                    // TypeScript enum declarations do not exist in ES6 and must be rewritten.\n                    return visitEnumDeclaration(node);\n                case 205 /* VariableStatement */:\n                    // TypeScript namespace exports for variable statements must be transformed.\n                    return visitVariableStatement(node);\n                case 223 /* VariableDeclaration */:\n                    return visitVariableDeclaration(node);\n                case 230 /* ModuleDeclaration */:\n                    // TypeScript namespace declarations must be transformed.\n                    return visitModuleDeclaration(node);\n                case 234 /* ImportEqualsDeclaration */:\n                    // TypeScript namespace or external module import.\n                    return visitImportEqualsDeclaration(node);\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitSourceFile(node) {\n            var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015);\n            return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, /*start*/ 0, alwaysStrict));\n        }\n        /**\n         * Tests whether we should emit a __decorate call for a class declaration.\n         */\n        function shouldEmitDecorateCallForClass(node) {\n            if (node.decorators && node.decorators.length > 0) {\n                return true;\n            }\n            var constructor = ts.getFirstConstructorWithBody(node);\n            if (constructor) {\n                return ts.forEach(constructor.parameters, shouldEmitDecorateCallForParameter);\n            }\n            return false;\n        }\n        /**\n         * Tests whether we should emit a __decorate call for a parameter declaration.\n         */\n        function shouldEmitDecorateCallForParameter(parameter) {\n            return parameter.decorators !== undefined && parameter.decorators.length > 0;\n        }\n        /**\n         * Transforms a class declaration with TypeScript syntax into compatible ES6.\n         *\n         * This function will only be called when one of the following conditions are met:\n         * - The class has decorators.\n         * - The class has property declarations with initializers.\n         * - The class contains a constructor that contains parameters with accessibility modifiers.\n         * - The class is an export in a TypeScript namespace.\n         *\n         * @param node The node to transform.\n         */\n        function visitClassDeclaration(node) {\n            var staticProperties = getInitializedProperties(node, /*isStatic*/ true);\n            var hasExtendsClause = ts.getClassExtendsHeritageClauseElement(node) !== undefined;\n            var isDecoratedClass = shouldEmitDecorateCallForClass(node);\n            // emit name if\n            // - node has a name\n            // - node has static initializers\n            //\n            var name = node.name;\n            if (!name && staticProperties.length > 0) {\n                name = ts.getGeneratedNameForNode(node);\n            }\n            var classStatement = isDecoratedClass\n                ? createClassDeclarationHeadWithDecorators(node, name, hasExtendsClause)\n                : createClassDeclarationHeadWithoutDecorators(node, name, hasExtendsClause, staticProperties.length > 0);\n            var statements = [classStatement];\n            // Emit static property assignment. Because classDeclaration is lexically evaluated,\n            // it is safe to emit static property assignment after classDeclaration\n            // From ES6 specification:\n            //      HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using\n            //                                  a lexical declaration such as a LexicalDeclaration or a ClassDeclaration.\n            if (staticProperties.length) {\n                addInitializedPropertyStatements(statements, staticProperties, ts.getLocalName(node));\n            }\n            // Write any decorators of the node.\n            addClassElementDecorationStatements(statements, node, /*isStatic*/ false);\n            addClassElementDecorationStatements(statements, node, /*isStatic*/ true);\n            addConstructorDecorationStatement(statements, node);\n            // If the class is exported as part of a TypeScript namespace, emit the namespace export.\n            // Otherwise, if the class was exported at the top level and was decorated, emit an export\n            // declaration or export default for the class.\n            if (isNamespaceExport(node)) {\n                addExportMemberAssignment(statements, node);\n            }\n            else if (isDecoratedClass) {\n                if (isDefaultExternalModuleExport(node)) {\n                    statements.push(ts.createExportDefault(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)));\n                }\n                else if (isNamedExternalModuleExport(node)) {\n                    statements.push(ts.createExternalModuleExport(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)));\n                }\n            }\n            if (statements.length > 1) {\n                // Add a DeclarationMarker as a marker for the end of the declaration\n                statements.push(ts.createEndOfDeclarationMarker(node));\n                ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 2097152 /* HasEndOfDeclarationMarker */);\n            }\n            return ts.singleOrMany(statements);\n        }\n        /**\n         * Transforms a non-decorated class declaration and appends the resulting statements.\n         *\n         * @param node A ClassDeclaration node.\n         * @param name The name of the class.\n         * @param hasExtendsClause A value indicating whether the class has an extends clause.\n         * @param hasStaticProperties A value indicating whether the class has static properties.\n         */\n        function createClassDeclarationHeadWithoutDecorators(node, name, hasExtendsClause, hasStaticProperties) {\n            //  ${modifiers} class ${name} ${heritageClauses} {\n            //      ${members}\n            //  }\n            var classDeclaration = ts.createClassDeclaration(\n            /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, \n            /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause), node);\n            var emitFlags = ts.getEmitFlags(node);\n            // To better align with the old emitter, we should not emit a trailing source map\n            // entry if the class has static properties.\n            if (hasStaticProperties) {\n                emitFlags |= 32 /* NoTrailingSourceMap */;\n            }\n            ts.setOriginalNode(classDeclaration, node);\n            ts.setEmitFlags(classDeclaration, emitFlags);\n            return classDeclaration;\n        }\n        /**\n         * Transforms a decorated class declaration and appends the resulting statements. If\n         * the class requires an alias to avoid issues with double-binding, the alias is returned.\n         *\n         * @param statements A statement list to which to add the declaration.\n         * @param node A ClassDeclaration node.\n         * @param name The name of the class.\n         * @param hasExtendsClause A value indicating whether the class has an extends clause.\n         */\n        function createClassDeclarationHeadWithDecorators(node, name, hasExtendsClause) {\n            // When we emit an ES6 class that has a class decorator, we must tailor the\n            // emit to certain specific cases.\n            //\n            // In the simplest case, we emit the class declaration as a let declaration, and\n            // evaluate decorators after the close of the class body:\n            //\n            //  [Example 1]\n            //  ---------------------------------------------------------------------\n            //  TypeScript                      | Javascript\n            //  ---------------------------------------------------------------------\n            //  @dec                            | let C = class C {\n            //  class C {                       | }\n            //  }                               | C = __decorate([dec], C);\n            //  ---------------------------------------------------------------------\n            //  @dec                            | let C = class C {\n            //  export class C {                | }\n            //  }                               | C = __decorate([dec], C);\n            //                                  | export { C };\n            //  ---------------------------------------------------------------------\n            //\n            // If a class declaration contains a reference to itself *inside* of the class body,\n            // this introduces two bindings to the class: One outside of the class body, and one\n            // inside of the class body. If we apply decorators as in [Example 1] above, there\n            // is the possibility that the decorator `dec` will return a new value for the\n            // constructor, which would result in the binding inside of the class no longer\n            // pointing to the same reference as the binding outside of the class.\n            //\n            // As a result, we must instead rewrite all references to the class *inside* of the\n            // class body to instead point to a local temporary alias for the class:\n            //\n            //  [Example 2]\n            //  ---------------------------------------------------------------------\n            //  TypeScript                      | Javascript\n            //  ---------------------------------------------------------------------\n            //  @dec                            | let C = C_1 = class C {\n            //  class C {                       |   static x() { return C_1.y; }\n            //    static x() { return C.y; }    | }\n            //    static y = 1;                 | C.y = 1;\n            //  }                               | C = C_1 = __decorate([dec], C);\n            //                                  | var C_1;\n            //  ---------------------------------------------------------------------\n            //  @dec                            | let C = class C {\n            //  export class C {                |   static x() { return C_1.y; }\n            //    static x() { return C.y; }    | }\n            //    static y = 1;                 | C.y = 1;\n            //  }                               | C = C_1 = __decorate([dec], C);\n            //                                  | export { C };\n            //                                  | var C_1;\n            //  ---------------------------------------------------------------------\n            //\n            // If a class declaration is the default export of a module, we instead emit\n            // the export after the decorated declaration:\n            //\n            //  [Example 3]\n            //  ---------------------------------------------------------------------\n            //  TypeScript                      | Javascript\n            //  ---------------------------------------------------------------------\n            //  @dec                            | let default_1 = class {\n            //  export default class {          | }\n            //  }                               | default_1 = __decorate([dec], default_1);\n            //                                  | export default default_1;\n            //  ---------------------------------------------------------------------\n            //  @dec                            | let C = class C {\n            //  export default class C {        | }\n            //  }                               | C = __decorate([dec], C);\n            //                                  | export default C;\n            //  ---------------------------------------------------------------------\n            //\n            // If the class declaration is the default export and a reference to itself\n            // inside of the class body, we must emit both an alias for the class *and*\n            // move the export after the declaration:\n            //\n            //  [Example 4]\n            //  ---------------------------------------------------------------------\n            //  TypeScript                      | Javascript\n            //  ---------------------------------------------------------------------\n            //  @dec                            | let C = class C {\n            //  export default class C {        |   static x() { return C_1.y; }\n            //    static x() { return C.y; }    | }\n            //    static y = 1;                 | C.y = 1;\n            //  }                               | C = C_1 = __decorate([dec], C);\n            //                                  | export default C;\n            //                                  | var C_1;\n            //  ---------------------------------------------------------------------\n            //\n            var location = ts.moveRangePastDecorators(node);\n            var classAlias = getClassAliasIfNeeded(node);\n            var declName = ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true);\n            //  ... = class ${name} ${heritageClauses} {\n            //      ${members}\n            //  }\n            var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);\n            var members = transformClassMembers(node, hasExtendsClause);\n            var classExpression = ts.createClassExpression(/*modifiers*/ undefined, name, /*typeParameters*/ undefined, heritageClauses, members, location);\n            ts.setOriginalNode(classExpression, node);\n            //  let ${name} = ${classExpression} where name is either declaredName if the class doesn't contain self-reference\n            //                                         or decoratedClassAlias if the class contain self-reference.\n            var statement = ts.createLetStatement(declName, classAlias ? ts.createAssignment(classAlias, classExpression) : classExpression, location);\n            ts.setOriginalNode(statement, node);\n            ts.setCommentRange(statement, node);\n            return statement;\n        }\n        /**\n         * Transforms a class expression with TypeScript syntax into compatible ES6.\n         *\n         * This function will only be called when one of the following conditions are met:\n         * - The class has property declarations with initializers.\n         * - The class contains a constructor that contains parameters with accessibility modifiers.\n         *\n         * @param node The node to transform.\n         */\n        function visitClassExpression(node) {\n            var staticProperties = getInitializedProperties(node, /*isStatic*/ true);\n            var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);\n            var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 84 /* ExtendsKeyword */; }));\n            var classExpression = ts.setOriginalNode(ts.createClassExpression(\n            /*modifiers*/ undefined, node.name, \n            /*typeParameters*/ undefined, heritageClauses, members, \n            /*location*/ node), node);\n            if (staticProperties.length > 0) {\n                var expressions = [];\n                var temp = ts.createTempVariable(hoistVariableDeclaration);\n                if (resolver.getNodeCheckFlags(node) & 8388608 /* ClassWithConstructorReference */) {\n                    // record an alias as the class name is not in scope for statics.\n                    enableSubstitutionForClassAliases();\n                    classAliases[ts.getOriginalNodeId(node)] = ts.getSynthesizedClone(temp);\n                }\n                // To preserve the behavior of the old emitter, we explicitly indent\n                // the body of a class with static initializers.\n                ts.setEmitFlags(classExpression, 32768 /* Indented */ | ts.getEmitFlags(classExpression));\n                expressions.push(ts.startOnNewLine(ts.createAssignment(temp, classExpression)));\n                ts.addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp));\n                expressions.push(ts.startOnNewLine(temp));\n                return ts.inlineExpressions(expressions);\n            }\n            return classExpression;\n        }\n        /**\n         * Transforms the members of a class.\n         *\n         * @param node The current class.\n         * @param hasExtendsClause A value indicating whether the class has an extends clause.\n         */\n        function transformClassMembers(node, hasExtendsClause) {\n            var members = [];\n            var constructor = transformConstructor(node, hasExtendsClause);\n            if (constructor) {\n                members.push(constructor);\n            }\n            ts.addRange(members, ts.visitNodes(node.members, classElementVisitor, ts.isClassElement));\n            return ts.createNodeArray(members, /*location*/ node.members);\n        }\n        /**\n         * Transforms (or creates) a constructor for a class.\n         *\n         * @param node The current class.\n         * @param hasExtendsClause A value indicating whether the class has an extends clause.\n         */\n        function transformConstructor(node, hasExtendsClause) {\n            // Check if we have property assignment inside class declaration.\n            // If there is a property assignment, we need to emit constructor whether users define it or not\n            // If there is no property assignment, we can omit constructor if users do not define it\n            var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty);\n            var hasParameterPropertyAssignments = node.transformFlags & 262144 /* ContainsParameterPropertyAssignments */;\n            var constructor = ts.getFirstConstructorWithBody(node);\n            // If the class does not contain nodes that require a synthesized constructor,\n            // accept the current constructor if it exists.\n            if (!hasInstancePropertyWithInitializer && !hasParameterPropertyAssignments) {\n                return ts.visitEachChild(constructor, visitor, context);\n            }\n            var parameters = transformConstructorParameters(constructor);\n            var body = transformConstructorBody(node, constructor, hasExtendsClause);\n            //  constructor(${parameters}) {\n            //      ${body}\n            //  }\n            return ts.startOnNewLine(ts.setOriginalNode(ts.createConstructor(\n            /*decorators*/ undefined, \n            /*modifiers*/ undefined, parameters, body, \n            /*location*/ constructor || node), constructor));\n        }\n        /**\n         * Transforms (or creates) the parameters for the constructor of a class with\n         * parameter property assignments or instance property initializers.\n         *\n         * @param constructor The constructor declaration.\n         * @param hasExtendsClause A value indicating whether the class has an extends clause.\n         */\n        function transformConstructorParameters(constructor) {\n            // The ES2015 spec specifies in 14.5.14. Runtime Semantics: ClassDefinitionEvaluation:\n            // If constructor is empty, then\n            //     If ClassHeritag_eopt is present and protoParent is not null, then\n            //          Let constructor be the result of parsing the source text\n            //              constructor(...args) { super (...args);}\n            //          using the syntactic grammar with the goal symbol MethodDefinition[~Yield].\n            //      Else,\n            //           Let constructor be the result of parsing the source text\n            //               constructor( ){ }\n            //           using the syntactic grammar with the goal symbol MethodDefinition[~Yield].\n            //\n            // While we could emit the '...args' rest parameter, certain later tools in the pipeline might\n            // downlevel the '...args' portion less efficiently by naively copying the contents of 'arguments' to an array.\n            // Instead, we'll avoid using a rest parameter and spread into the super call as\n            // 'super(...arguments)' instead of 'super(...args)', as you can see in \"transformConstructorBody\".\n            return ts.visitParameterList(constructor && constructor.parameters, visitor, context)\n                || [];\n        }\n        /**\n         * Transforms (or creates) a constructor body for a class with parameter property\n         * assignments or instance property initializers.\n         *\n         * @param node The current class.\n         * @param constructor The current class constructor.\n         * @param hasExtendsClause A value indicating whether the class has an extends clause.\n         */\n        function transformConstructorBody(node, constructor, hasExtendsClause) {\n            var statements = [];\n            var indexOfFirstStatement = 0;\n            resumeLexicalEnvironment();\n            if (constructor) {\n                indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements);\n                // Add parameters with property assignments. Transforms this:\n                //\n                //  constructor (public x, public y) {\n                //  }\n                //\n                // Into this:\n                //\n                //  constructor (x, y) {\n                //      this.x = x;\n                //      this.y = y;\n                //  }\n                //\n                var propertyAssignments = getParametersWithPropertyAssignments(constructor);\n                ts.addRange(statements, ts.map(propertyAssignments, transformParameterWithPropertyAssignment));\n            }\n            else if (hasExtendsClause) {\n                // Add a synthetic `super` call:\n                //\n                //  super(...arguments);\n                //\n                statements.push(ts.createStatement(ts.createCall(ts.createSuper(), \n                /*typeArguments*/ undefined, [ts.createSpread(ts.createIdentifier(\"arguments\"))])));\n            }\n            // Add the property initializers. Transforms this:\n            //\n            //  public x = 1;\n            //\n            // Into this:\n            //\n            //  constructor() {\n            //      this.x = 1;\n            //  }\n            //\n            var properties = getInitializedProperties(node, /*isStatic*/ false);\n            addInitializedPropertyStatements(statements, properties, ts.createThis());\n            if (constructor) {\n                // The class already had a constructor, so we should add the existing statements, skipping the initial super call.\n                ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement));\n            }\n            // End the lexical environment.\n            ts.addRange(statements, endLexicalEnvironment());\n            return ts.createBlock(ts.createNodeArray(statements, \n            /*location*/ constructor ? constructor.body.statements : node.members), \n            /*location*/ constructor ? constructor.body : undefined, \n            /*multiLine*/ true);\n        }\n        /**\n         * Adds super call and preceding prologue directives into the list of statements.\n         *\n         * @param ctor The constructor node.\n         * @returns index of the statement that follows super call\n         */\n        function addPrologueDirectivesAndInitialSuperCall(ctor, result) {\n            if (ctor.body) {\n                var statements = ctor.body.statements;\n                // add prologue directives to the list (if any)\n                var index = ts.addPrologueDirectives(result, statements, /*ensureUseStrict*/ false, visitor);\n                if (index === statements.length) {\n                    // list contains nothing but prologue directives (or empty) - exit\n                    return index;\n                }\n                var statement = statements[index];\n                if (statement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {\n                    result.push(ts.visitNode(statement, visitor, ts.isStatement));\n                    return index + 1;\n                }\n                return index;\n            }\n            return 0;\n        }\n        /**\n         * Gets all parameters of a constructor that should be transformed into property assignments.\n         *\n         * @param node The constructor node.\n         */\n        function getParametersWithPropertyAssignments(node) {\n            return ts.filter(node.parameters, isParameterWithPropertyAssignment);\n        }\n        /**\n         * Determines whether a parameter should be transformed into a property assignment.\n         *\n         * @param parameter The parameter node.\n         */\n        function isParameterWithPropertyAssignment(parameter) {\n            return ts.hasModifier(parameter, 92 /* ParameterPropertyModifier */)\n                && ts.isIdentifier(parameter.name);\n        }\n        /**\n         * Transforms a parameter into a property assignment statement.\n         *\n         * @param node The parameter declaration.\n         */\n        function transformParameterWithPropertyAssignment(node) {\n            ts.Debug.assert(ts.isIdentifier(node.name));\n            var name = node.name;\n            var propertyName = ts.getMutableClone(name);\n            ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 48 /* NoSourceMap */);\n            var localName = ts.getMutableClone(name);\n            ts.setEmitFlags(localName, 1536 /* NoComments */);\n            return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName, \n            /*location*/ node.name), localName), \n            /*location*/ ts.moveRangePos(node, -1)));\n        }\n        /**\n         * Gets all property declarations with initializers on either the static or instance side of a class.\n         *\n         * @param node The class node.\n         * @param isStatic A value indicating whether to get properties from the static or instance side of the class.\n         */\n        function getInitializedProperties(node, isStatic) {\n            return ts.filter(node.members, isStatic ? isStaticInitializedProperty : isInstanceInitializedProperty);\n        }\n        /**\n         * Gets a value indicating whether a class element is a static property declaration with an initializer.\n         *\n         * @param member The class element node.\n         */\n        function isStaticInitializedProperty(member) {\n            return isInitializedProperty(member, /*isStatic*/ true);\n        }\n        /**\n         * Gets a value indicating whether a class element is an instance property declaration with an initializer.\n         *\n         * @param member The class element node.\n         */\n        function isInstanceInitializedProperty(member) {\n            return isInitializedProperty(member, /*isStatic*/ false);\n        }\n        /**\n         * Gets a value indicating whether a class element is either a static or an instance property declaration with an initializer.\n         *\n         * @param member The class element node.\n         * @param isStatic A value indicating whether the member should be a static or instance member.\n         */\n        function isInitializedProperty(member, isStatic) {\n            return member.kind === 147 /* PropertyDeclaration */\n                && isStatic === ts.hasModifier(member, 32 /* Static */)\n                && member.initializer !== undefined;\n        }\n        /**\n         * Generates assignment statements for property initializers.\n         *\n         * @param properties An array of property declarations to transform.\n         * @param receiver The receiver on which each property should be assigned.\n         */\n        function addInitializedPropertyStatements(statements, properties, receiver) {\n            for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) {\n                var property = properties_8[_i];\n                var statement = ts.createStatement(transformInitializedProperty(property, receiver));\n                ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property));\n                ts.setCommentRange(statement, property);\n                statements.push(statement);\n            }\n        }\n        /**\n         * Generates assignment expressions for property initializers.\n         *\n         * @param properties An array of property declarations to transform.\n         * @param receiver The receiver on which each property should be assigned.\n         */\n        function generateInitializedPropertyExpressions(properties, receiver) {\n            var expressions = [];\n            for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) {\n                var property = properties_9[_i];\n                var expression = transformInitializedProperty(property, receiver);\n                expression.startsOnNewLine = true;\n                ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property));\n                ts.setCommentRange(expression, property);\n                expressions.push(expression);\n            }\n            return expressions;\n        }\n        /**\n         * Transforms a property initializer into an assignment statement.\n         *\n         * @param property The property declaration.\n         * @param receiver The object receiving the property assignment.\n         */\n        function transformInitializedProperty(property, receiver) {\n            var propertyName = visitPropertyNameOfClassElement(property);\n            var initializer = ts.visitNode(property.initializer, visitor, ts.isExpression);\n            var memberAccess = ts.createMemberAccessForPropertyName(receiver, propertyName, /*location*/ propertyName);\n            return ts.createAssignment(memberAccess, initializer);\n        }\n        /**\n         * Gets either the static or instance members of a class that are decorated, or have\n         * parameters that are decorated.\n         *\n         * @param node The class containing the member.\n         * @param isStatic A value indicating whether to retrieve static or instance members of\n         *                 the class.\n         */\n        function getDecoratedClassElements(node, isStatic) {\n            return ts.filter(node.members, isStatic ? isStaticDecoratedClassElement : isInstanceDecoratedClassElement);\n        }\n        /**\n         * Determines whether a class member is a static member of a class that is decorated, or\n         * has parameters that are decorated.\n         *\n         * @param member The class member.\n         */\n        function isStaticDecoratedClassElement(member) {\n            return isDecoratedClassElement(member, /*isStatic*/ true);\n        }\n        /**\n         * Determines whether a class member is an instance member of a class that is decorated,\n         * or has parameters that are decorated.\n         *\n         * @param member The class member.\n         */\n        function isInstanceDecoratedClassElement(member) {\n            return isDecoratedClassElement(member, /*isStatic*/ false);\n        }\n        /**\n         * Determines whether a class member is either a static or an instance member of a class\n         * that is decorated, or has parameters that are decorated.\n         *\n         * @param member The class member.\n         */\n        function isDecoratedClassElement(member, isStatic) {\n            return ts.nodeOrChildIsDecorated(member)\n                && isStatic === ts.hasModifier(member, 32 /* Static */);\n        }\n        /**\n         * Gets an array of arrays of decorators for the parameters of a function-like node.\n         * The offset into the result array should correspond to the offset of the parameter.\n         *\n         * @param node The function-like node.\n         */\n        function getDecoratorsOfParameters(node) {\n            var decorators;\n            if (node) {\n                var parameters = node.parameters;\n                for (var i = 0; i < parameters.length; i++) {\n                    var parameter = parameters[i];\n                    if (decorators || parameter.decorators) {\n                        if (!decorators) {\n                            decorators = new Array(parameters.length);\n                        }\n                        decorators[i] = parameter.decorators;\n                    }\n                }\n            }\n            return decorators;\n        }\n        /**\n         * Gets an AllDecorators object containing the decorators for the class and the decorators for the\n         * parameters of the constructor of the class.\n         *\n         * @param node The class node.\n         */\n        function getAllDecoratorsOfConstructor(node) {\n            var decorators = node.decorators;\n            var parameters = getDecoratorsOfParameters(ts.getFirstConstructorWithBody(node));\n            if (!decorators && !parameters) {\n                return undefined;\n            }\n            return {\n                decorators: decorators,\n                parameters: parameters\n            };\n        }\n        /**\n         * Gets an AllDecorators object containing the decorators for the member and its parameters.\n         *\n         * @param node The class node that contains the member.\n         * @param member The class member.\n         */\n        function getAllDecoratorsOfClassElement(node, member) {\n            switch (member.kind) {\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                    return getAllDecoratorsOfAccessors(node, member);\n                case 149 /* MethodDeclaration */:\n                    return getAllDecoratorsOfMethod(member);\n                case 147 /* PropertyDeclaration */:\n                    return getAllDecoratorsOfProperty(member);\n                default:\n                    return undefined;\n            }\n        }\n        /**\n         * Gets an AllDecorators object containing the decorators for the accessor and its parameters.\n         *\n         * @param node The class node that contains the accessor.\n         * @param accessor The class accessor member.\n         */\n        function getAllDecoratorsOfAccessors(node, accessor) {\n            if (!accessor.body) {\n                return undefined;\n            }\n            var _a = ts.getAllAccessorDeclarations(node.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, setAccessor = _a.setAccessor;\n            if (accessor !== firstAccessor) {\n                return undefined;\n            }\n            var decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators);\n            var parameters = getDecoratorsOfParameters(setAccessor);\n            if (!decorators && !parameters) {\n                return undefined;\n            }\n            return { decorators: decorators, parameters: parameters };\n        }\n        /**\n         * Gets an AllDecorators object containing the decorators for the method and its parameters.\n         *\n         * @param method The class method member.\n         */\n        function getAllDecoratorsOfMethod(method) {\n            if (!method.body) {\n                return undefined;\n            }\n            var decorators = method.decorators;\n            var parameters = getDecoratorsOfParameters(method);\n            if (!decorators && !parameters) {\n                return undefined;\n            }\n            return { decorators: decorators, parameters: parameters };\n        }\n        /**\n         * Gets an AllDecorators object containing the decorators for the property.\n         *\n         * @param property The class property member.\n         */\n        function getAllDecoratorsOfProperty(property) {\n            var decorators = property.decorators;\n            if (!decorators) {\n                return undefined;\n            }\n            return { decorators: decorators };\n        }\n        /**\n         * Transforms all of the decorators for a declaration into an array of expressions.\n         *\n         * @param node The declaration node.\n         * @param allDecorators An object containing all of the decorators for the declaration.\n         */\n        function transformAllDecoratorsOfDeclaration(node, allDecorators) {\n            if (!allDecorators) {\n                return undefined;\n            }\n            var decoratorExpressions = [];\n            ts.addRange(decoratorExpressions, ts.map(allDecorators.decorators, transformDecorator));\n            ts.addRange(decoratorExpressions, ts.flatMap(allDecorators.parameters, transformDecoratorsOfParameter));\n            addTypeMetadata(node, decoratorExpressions);\n            return decoratorExpressions;\n        }\n        /**\n         * Generates statements used to apply decorators to either the static or instance members\n         * of a class.\n         *\n         * @param node The class node.\n         * @param isStatic A value indicating whether to generate statements for static or\n         *                 instance members.\n         */\n        function addClassElementDecorationStatements(statements, node, isStatic) {\n            ts.addRange(statements, ts.map(generateClassElementDecorationExpressions(node, isStatic), expressionToStatement));\n        }\n        /**\n         * Generates expressions used to apply decorators to either the static or instance members\n         * of a class.\n         *\n         * @param node The class node.\n         * @param isStatic A value indicating whether to generate expressions for static or\n         *                 instance members.\n         */\n        function generateClassElementDecorationExpressions(node, isStatic) {\n            var members = getDecoratedClassElements(node, isStatic);\n            var expressions;\n            for (var _i = 0, members_2 = members; _i < members_2.length; _i++) {\n                var member = members_2[_i];\n                var expression = generateClassElementDecorationExpression(node, member);\n                if (expression) {\n                    if (!expressions) {\n                        expressions = [expression];\n                    }\n                    else {\n                        expressions.push(expression);\n                    }\n                }\n            }\n            return expressions;\n        }\n        /**\n         * Generates an expression used to evaluate class element decorators at runtime.\n         *\n         * @param node The class node that contains the member.\n         * @param member The class member.\n         */\n        function generateClassElementDecorationExpression(node, member) {\n            var allDecorators = getAllDecoratorsOfClassElement(node, member);\n            var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators);\n            if (!decoratorExpressions) {\n                return undefined;\n            }\n            // Emit the call to __decorate. Given the following:\n            //\n            //   class C {\n            //     @dec method(@dec2 x) {}\n            //     @dec get accessor() {}\n            //     @dec prop;\n            //   }\n            //\n            // The emit for a method is:\n            //\n            //   __decorate([\n            //       dec,\n            //       __param(0, dec2),\n            //       __metadata(\"design:type\", Function),\n            //       __metadata(\"design:paramtypes\", [Object]),\n            //       __metadata(\"design:returntype\", void 0)\n            //   ], C.prototype, \"method\", null);\n            //\n            // The emit for an accessor is:\n            //\n            //   __decorate([\n            //       dec\n            //   ], C.prototype, \"accessor\", null);\n            //\n            // The emit for a property is:\n            //\n            //   __decorate([\n            //       dec\n            //   ], C.prototype, \"prop\");\n            //\n            var prefix = getClassMemberPrefix(node, member);\n            var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ true);\n            var descriptor = languageVersion > 0 /* ES3 */\n                ? member.kind === 147 /* PropertyDeclaration */\n                    ? ts.createVoidZero()\n                    : ts.createNull()\n                : undefined;\n            var helper = createDecorateHelper(context, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member));\n            ts.setEmitFlags(helper, 1536 /* NoComments */);\n            return helper;\n        }\n        /**\n         * Generates a __decorate helper call for a class constructor.\n         *\n         * @param node The class node.\n         */\n        function addConstructorDecorationStatement(statements, node) {\n            var expression = generateConstructorDecorationExpression(node);\n            if (expression) {\n                statements.push(ts.setOriginalNode(ts.createStatement(expression), node));\n            }\n        }\n        /**\n         * Generates a __decorate helper call for a class constructor.\n         *\n         * @param node The class node.\n         */\n        function generateConstructorDecorationExpression(node) {\n            var allDecorators = getAllDecoratorsOfConstructor(node);\n            var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators);\n            if (!decoratorExpressions) {\n                return undefined;\n            }\n            var classAlias = classAliases && classAliases[ts.getOriginalNodeId(node)];\n            var localName = ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true);\n            var decorate = createDecorateHelper(context, decoratorExpressions, localName);\n            var expression = ts.createAssignment(localName, classAlias ? ts.createAssignment(classAlias, decorate) : decorate);\n            ts.setEmitFlags(expression, 1536 /* NoComments */);\n            ts.setSourceMapRange(expression, ts.moveRangePastDecorators(node));\n            return expression;\n        }\n        /**\n         * Transforms a decorator into an expression.\n         *\n         * @param decorator The decorator node.\n         */\n        function transformDecorator(decorator) {\n            return ts.visitNode(decorator.expression, visitor, ts.isExpression);\n        }\n        /**\n         * Transforms the decorators of a parameter.\n         *\n         * @param decorators The decorators for the parameter at the provided offset.\n         * @param parameterOffset The offset of the parameter.\n         */\n        function transformDecoratorsOfParameter(decorators, parameterOffset) {\n            var expressions;\n            if (decorators) {\n                expressions = [];\n                for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) {\n                    var decorator = decorators_1[_i];\n                    var helper = createParamHelper(context, transformDecorator(decorator), parameterOffset, \n                    /*location*/ decorator.expression);\n                    ts.setEmitFlags(helper, 1536 /* NoComments */);\n                    expressions.push(helper);\n                }\n            }\n            return expressions;\n        }\n        /**\n         * Adds optional type metadata for a declaration.\n         *\n         * @param node The declaration node.\n         * @param decoratorExpressions The destination array to which to add new decorator expressions.\n         */\n        function addTypeMetadata(node, decoratorExpressions) {\n            if (USE_NEW_TYPE_METADATA_FORMAT) {\n                addNewTypeMetadata(node, decoratorExpressions);\n            }\n            else {\n                addOldTypeMetadata(node, decoratorExpressions);\n            }\n        }\n        function addOldTypeMetadata(node, decoratorExpressions) {\n            if (compilerOptions.emitDecoratorMetadata) {\n                if (shouldAddTypeMetadata(node)) {\n                    decoratorExpressions.push(createMetadataHelper(context, \"design:type\", serializeTypeOfNode(node)));\n                }\n                if (shouldAddParamTypesMetadata(node)) {\n                    decoratorExpressions.push(createMetadataHelper(context, \"design:paramtypes\", serializeParameterTypesOfNode(node)));\n                }\n                if (shouldAddReturnTypeMetadata(node)) {\n                    decoratorExpressions.push(createMetadataHelper(context, \"design:returntype\", serializeReturnTypeOfNode(node)));\n                }\n            }\n        }\n        function addNewTypeMetadata(node, decoratorExpressions) {\n            if (compilerOptions.emitDecoratorMetadata) {\n                var properties = void 0;\n                if (shouldAddTypeMetadata(node)) {\n                    (properties || (properties = [])).push(ts.createPropertyAssignment(\"type\", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeTypeOfNode(node))));\n                }\n                if (shouldAddParamTypesMetadata(node)) {\n                    (properties || (properties = [])).push(ts.createPropertyAssignment(\"paramTypes\", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeParameterTypesOfNode(node))));\n                }\n                if (shouldAddReturnTypeMetadata(node)) {\n                    (properties || (properties = [])).push(ts.createPropertyAssignment(\"returnType\", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeReturnTypeOfNode(node))));\n                }\n                if (properties) {\n                    decoratorExpressions.push(createMetadataHelper(context, \"design:typeinfo\", ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true)));\n                }\n            }\n        }\n        /**\n         * Determines whether to emit the \"design:type\" metadata based on the node's kind.\n         * The caller should have already tested whether the node has decorators and whether the\n         * emitDecoratorMetadata compiler option is set.\n         *\n         * @param node The node to test.\n         */\n        function shouldAddTypeMetadata(node) {\n            var kind = node.kind;\n            return kind === 149 /* MethodDeclaration */\n                || kind === 151 /* GetAccessor */\n                || kind === 152 /* SetAccessor */\n                || kind === 147 /* PropertyDeclaration */;\n        }\n        /**\n         * Determines whether to emit the \"design:returntype\" metadata based on the node's kind.\n         * The caller should have already tested whether the node has decorators and whether the\n         * emitDecoratorMetadata compiler option is set.\n         *\n         * @param node The node to test.\n         */\n        function shouldAddReturnTypeMetadata(node) {\n            return node.kind === 149 /* MethodDeclaration */;\n        }\n        /**\n         * Determines whether to emit the \"design:paramtypes\" metadata based on the node's kind.\n         * The caller should have already tested whether the node has decorators and whether the\n         * emitDecoratorMetadata compiler option is set.\n         *\n         * @param node The node to test.\n         */\n        function shouldAddParamTypesMetadata(node) {\n            var kind = node.kind;\n            return kind === 226 /* ClassDeclaration */\n                || kind === 197 /* ClassExpression */\n                || kind === 149 /* MethodDeclaration */\n                || kind === 151 /* GetAccessor */\n                || kind === 152 /* SetAccessor */;\n        }\n        /**\n         * Serializes the type of a node for use with decorator type metadata.\n         *\n         * @param node The node that should have its type serialized.\n         */\n        function serializeTypeOfNode(node) {\n            switch (node.kind) {\n                case 147 /* PropertyDeclaration */:\n                case 144 /* Parameter */:\n                case 151 /* GetAccessor */:\n                    return serializeTypeNode(node.type);\n                case 152 /* SetAccessor */:\n                    return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node));\n                case 226 /* ClassDeclaration */:\n                case 197 /* ClassExpression */:\n                case 149 /* MethodDeclaration */:\n                    return ts.createIdentifier(\"Function\");\n                default:\n                    return ts.createVoidZero();\n            }\n        }\n        /**\n         * Gets the most likely element type for a TypeNode. This is not an exhaustive test\n         * as it assumes a rest argument can only be an array type (either T[], or Array<T>).\n         *\n         * @param node The type node.\n         */\n        function getRestParameterElementType(node) {\n            if (node && node.kind === 162 /* ArrayType */) {\n                return node.elementType;\n            }\n            else if (node && node.kind === 157 /* TypeReference */) {\n                return ts.singleOrUndefined(node.typeArguments);\n            }\n            else {\n                return undefined;\n            }\n        }\n        /**\n         * Serializes the types of the parameters of a node for use with decorator type metadata.\n         *\n         * @param node The node that should have its parameter types serialized.\n         */\n        function serializeParameterTypesOfNode(node) {\n            var valueDeclaration = ts.isClassLike(node)\n                ? ts.getFirstConstructorWithBody(node)\n                : ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)\n                    ? node\n                    : undefined;\n            var expressions = [];\n            if (valueDeclaration) {\n                var parameters = valueDeclaration.parameters;\n                var numParameters = parameters.length;\n                for (var i = 0; i < numParameters; i++) {\n                    var parameter = parameters[i];\n                    if (i === 0 && ts.isIdentifier(parameter.name) && parameter.name.text === \"this\") {\n                        continue;\n                    }\n                    if (parameter.dotDotDotToken) {\n                        expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type)));\n                    }\n                    else {\n                        expressions.push(serializeTypeOfNode(parameter));\n                    }\n                }\n            }\n            return ts.createArrayLiteral(expressions);\n        }\n        /**\n         * Serializes the return type of a node for use with decorator type metadata.\n         *\n         * @param node The node that should have its return type serialized.\n         */\n        function serializeReturnTypeOfNode(node) {\n            if (ts.isFunctionLike(node) && node.type) {\n                return serializeTypeNode(node.type);\n            }\n            else if (ts.isAsyncFunctionLike(node)) {\n                return ts.createIdentifier(\"Promise\");\n            }\n            return ts.createVoidZero();\n        }\n        /**\n         * Serializes a type node for use with decorator type metadata.\n         *\n         * Types are serialized in the following fashion:\n         * - Void types point to \"undefined\" (e.g. \"void 0\")\n         * - Function and Constructor types point to the global \"Function\" constructor.\n         * - Interface types with a call or construct signature types point to the global\n         *   \"Function\" constructor.\n         * - Array and Tuple types point to the global \"Array\" constructor.\n         * - Type predicates and booleans point to the global \"Boolean\" constructor.\n         * - String literal types and strings point to the global \"String\" constructor.\n         * - Enum and number types point to the global \"Number\" constructor.\n         * - Symbol types point to the global \"Symbol\" constructor.\n         * - Type references to classes (or class-like variables) point to the constructor for the class.\n         * - Anything else points to the global \"Object\" constructor.\n         *\n         * @param node The type node to serialize.\n         */\n        function serializeTypeNode(node) {\n            if (node === undefined) {\n                return ts.createIdentifier(\"Object\");\n            }\n            switch (node.kind) {\n                case 104 /* VoidKeyword */:\n                    return ts.createVoidZero();\n                case 166 /* ParenthesizedType */:\n                    return serializeTypeNode(node.type);\n                case 158 /* FunctionType */:\n                case 159 /* ConstructorType */:\n                    return ts.createIdentifier(\"Function\");\n                case 162 /* ArrayType */:\n                case 163 /* TupleType */:\n                    return ts.createIdentifier(\"Array\");\n                case 156 /* TypePredicate */:\n                case 121 /* BooleanKeyword */:\n                    return ts.createIdentifier(\"Boolean\");\n                case 134 /* StringKeyword */:\n                    return ts.createIdentifier(\"String\");\n                case 171 /* LiteralType */:\n                    switch (node.literal.kind) {\n                        case 9 /* StringLiteral */:\n                            return ts.createIdentifier(\"String\");\n                        case 8 /* NumericLiteral */:\n                            return ts.createIdentifier(\"Number\");\n                        case 100 /* TrueKeyword */:\n                        case 85 /* FalseKeyword */:\n                            return ts.createIdentifier(\"Boolean\");\n                        default:\n                            ts.Debug.failBadSyntaxKind(node.literal);\n                            break;\n                    }\n                    break;\n                case 132 /* NumberKeyword */:\n                    return ts.createIdentifier(\"Number\");\n                case 135 /* SymbolKeyword */:\n                    return languageVersion < 2 /* ES2015 */\n                        ? getGlobalSymbolNameWithFallback()\n                        : ts.createIdentifier(\"Symbol\");\n                case 157 /* TypeReference */:\n                    return serializeTypeReferenceNode(node);\n                case 165 /* IntersectionType */:\n                case 164 /* UnionType */:\n                    {\n                        var unionOrIntersection = node;\n                        var serializedUnion = void 0;\n                        for (var _i = 0, _a = unionOrIntersection.types; _i < _a.length; _i++) {\n                            var typeNode = _a[_i];\n                            var serializedIndividual = serializeTypeNode(typeNode);\n                            // Non identifier\n                            if (serializedIndividual.kind !== 70 /* Identifier */) {\n                                serializedUnion = undefined;\n                                break;\n                            }\n                            // One of the individual is global object, return immediately\n                            if (serializedIndividual.text === \"Object\") {\n                                return serializedIndividual;\n                            }\n                            // Different types\n                            if (serializedUnion && serializedUnion.text !== serializedIndividual.text) {\n                                serializedUnion = undefined;\n                                break;\n                            }\n                            serializedUnion = serializedIndividual;\n                        }\n                        // If we were able to find common type\n                        if (serializedUnion) {\n                            return serializedUnion;\n                        }\n                    }\n                // Fallthrough\n                case 160 /* TypeQuery */:\n                case 168 /* TypeOperator */:\n                case 169 /* IndexedAccessType */:\n                case 170 /* MappedType */:\n                case 161 /* TypeLiteral */:\n                case 118 /* AnyKeyword */:\n                case 167 /* ThisType */:\n                    break;\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    break;\n            }\n            return ts.createIdentifier(\"Object\");\n        }\n        /**\n         * Serializes a TypeReferenceNode to an appropriate JS constructor value for use with\n         * decorator type metadata.\n         *\n         * @param node The type reference node.\n         */\n        function serializeTypeReferenceNode(node) {\n            switch (resolver.getTypeReferenceSerializationKind(node.typeName, currentScope)) {\n                case ts.TypeReferenceSerializationKind.Unknown:\n                    var serialized = serializeEntityNameAsExpression(node.typeName, /*useFallback*/ true);\n                    var temp = ts.createTempVariable(hoistVariableDeclaration);\n                    return ts.createLogicalOr(ts.createLogicalAnd(ts.createTypeCheck(ts.createAssignment(temp, serialized), \"function\"), temp), ts.createIdentifier(\"Object\"));\n                case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue:\n                    return serializeEntityNameAsExpression(node.typeName, /*useFallback*/ false);\n                case ts.TypeReferenceSerializationKind.VoidNullableOrNeverType:\n                    return ts.createVoidZero();\n                case ts.TypeReferenceSerializationKind.BooleanType:\n                    return ts.createIdentifier(\"Boolean\");\n                case ts.TypeReferenceSerializationKind.NumberLikeType:\n                    return ts.createIdentifier(\"Number\");\n                case ts.TypeReferenceSerializationKind.StringLikeType:\n                    return ts.createIdentifier(\"String\");\n                case ts.TypeReferenceSerializationKind.ArrayLikeType:\n                    return ts.createIdentifier(\"Array\");\n                case ts.TypeReferenceSerializationKind.ESSymbolType:\n                    return languageVersion < 2 /* ES2015 */\n                        ? getGlobalSymbolNameWithFallback()\n                        : ts.createIdentifier(\"Symbol\");\n                case ts.TypeReferenceSerializationKind.TypeWithCallSignature:\n                    return ts.createIdentifier(\"Function\");\n                case ts.TypeReferenceSerializationKind.Promise:\n                    return ts.createIdentifier(\"Promise\");\n                case ts.TypeReferenceSerializationKind.ObjectType:\n                default:\n                    return ts.createIdentifier(\"Object\");\n            }\n        }\n        /**\n         * Serializes an entity name as an expression for decorator type metadata.\n         *\n         * @param node The entity name to serialize.\n         * @param useFallback A value indicating whether to use logical operators to test for the\n         *                    entity name at runtime.\n         */\n        function serializeEntityNameAsExpression(node, useFallback) {\n            switch (node.kind) {\n                case 70 /* Identifier */:\n                    // Create a clone of the name with a new parent, and treat it as if it were\n                    // a source tree node for the purposes of the checker.\n                    var name_32 = ts.getMutableClone(node);\n                    name_32.flags &= ~8 /* Synthesized */;\n                    name_32.original = undefined;\n                    name_32.parent = currentScope;\n                    if (useFallback) {\n                        return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_32), ts.createLiteral(\"undefined\")), name_32);\n                    }\n                    return name_32;\n                case 141 /* QualifiedName */:\n                    return serializeQualifiedNameAsExpression(node, useFallback);\n            }\n        }\n        /**\n         * Serializes an qualified name as an expression for decorator type metadata.\n         *\n         * @param node The qualified name to serialize.\n         * @param useFallback A value indicating whether to use logical operators to test for the\n         *                    qualified name at runtime.\n         */\n        function serializeQualifiedNameAsExpression(node, useFallback) {\n            var left;\n            if (node.left.kind === 70 /* Identifier */) {\n                left = serializeEntityNameAsExpression(node.left, useFallback);\n            }\n            else if (useFallback) {\n                var temp = ts.createTempVariable(hoistVariableDeclaration);\n                left = ts.createLogicalAnd(ts.createAssignment(temp, serializeEntityNameAsExpression(node.left, /*useFallback*/ true)), temp);\n            }\n            else {\n                left = serializeEntityNameAsExpression(node.left, /*useFallback*/ false);\n            }\n            return ts.createPropertyAccess(left, node.right);\n        }\n        /**\n         * Gets an expression that points to the global \"Symbol\" constructor at runtime if it is\n         * available.\n         */\n        function getGlobalSymbolNameWithFallback() {\n            return ts.createConditional(ts.createTypeCheck(ts.createIdentifier(\"Symbol\"), \"function\"), ts.createIdentifier(\"Symbol\"), ts.createIdentifier(\"Object\"));\n        }\n        /**\n         * Gets an expression that represents a property name. For a computed property, a\n         * name is generated for the node.\n         *\n         * @param member The member whose name should be converted into an expression.\n         */\n        function getExpressionForPropertyName(member, generateNameForComputedPropertyName) {\n            var name = member.name;\n            if (ts.isComputedPropertyName(name)) {\n                return generateNameForComputedPropertyName\n                    ? ts.getGeneratedNameForNode(name)\n                    : name.expression;\n            }\n            else if (ts.isIdentifier(name)) {\n                return ts.createLiteral(ts.unescapeIdentifier(name.text));\n            }\n            else {\n                return ts.getSynthesizedClone(name);\n            }\n        }\n        /**\n         * Visits the property name of a class element, for use when emitting property\n         * initializers. For a computed property on a node with decorators, a temporary\n         * value is stored for later use.\n         *\n         * @param member The member whose name should be visited.\n         */\n        function visitPropertyNameOfClassElement(member) {\n            var name = member.name;\n            if (ts.isComputedPropertyName(name)) {\n                var expression = ts.visitNode(name.expression, visitor, ts.isExpression);\n                if (member.decorators) {\n                    var generatedName = ts.getGeneratedNameForNode(name);\n                    hoistVariableDeclaration(generatedName);\n                    expression = ts.createAssignment(generatedName, expression);\n                }\n                return ts.setOriginalNode(ts.createComputedPropertyName(expression, /*location*/ name), name);\n            }\n            else {\n                return name;\n            }\n        }\n        /**\n         * Transforms a HeritageClause with TypeScript syntax.\n         *\n         * This function will only be called when one of the following conditions are met:\n         * - The node is a non-`extends` heritage clause that should be elided.\n         * - The node is an `extends` heritage clause that should be visited, but only allow a single type.\n         *\n         * @param node The HeritageClause to transform.\n         */\n        function visitHeritageClause(node) {\n            if (node.token === 84 /* ExtendsKeyword */) {\n                var types = ts.visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments, 0, 1);\n                return ts.createHeritageClause(84 /* ExtendsKeyword */, types, node);\n            }\n            return undefined;\n        }\n        /**\n         * Transforms an ExpressionWithTypeArguments with TypeScript syntax.\n         *\n         * This function will only be called when one of the following conditions are met:\n         * - The node contains type arguments that should be elided.\n         *\n         * @param node The ExpressionWithTypeArguments to transform.\n         */\n        function visitExpressionWithTypeArguments(node) {\n            var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression);\n            return ts.createExpressionWithTypeArguments(\n            /*typeArguments*/ undefined, expression, node);\n        }\n        /**\n         * Determines whether to emit a function-like declaration. We should not emit the\n         * declaration if it does not have a body.\n         *\n         * @param node The declaration node.\n         */\n        function shouldEmitFunctionLikeDeclaration(node) {\n            return !ts.nodeIsMissing(node.body);\n        }\n        function visitConstructor(node) {\n            if (!shouldEmitFunctionLikeDeclaration(node)) {\n                return undefined;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        /**\n         * Visits a method declaration of a class.\n         *\n         * This function will be called when one of the following conditions are met:\n         * - The node is an overload\n         * - The node is marked as abstract, public, private, protected, or readonly\n         * - The node has both a decorator and a computed property name\n         *\n         * @param node The method node.\n         */\n        function visitMethodDeclaration(node) {\n            if (!shouldEmitFunctionLikeDeclaration(node)) {\n                return undefined;\n            }\n            var updated = ts.updateMethod(node, \n            /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), \n            /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context));\n            if (updated !== node) {\n                // While we emit the source map for the node after skipping decorators and modifiers,\n                // we need to emit the comments for the original range.\n                ts.setCommentRange(updated, node);\n                ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));\n            }\n            return updated;\n        }\n        /**\n         * Determines whether to emit an accessor declaration. We should not emit the\n         * declaration if it does not have a body and is abstract.\n         *\n         * @param node The declaration node.\n         */\n        function shouldEmitAccessorDeclaration(node) {\n            return !(ts.nodeIsMissing(node.body) && ts.hasModifier(node, 128 /* Abstract */));\n        }\n        /**\n         * Visits a get accessor declaration of a class.\n         *\n         * This function will be called when one of the following conditions are met:\n         * - The node is marked as abstract, public, private, or protected\n         * - The node has both a decorator and a computed property name\n         *\n         * @param node The get accessor node.\n         */\n        function visitGetAccessor(node) {\n            if (!shouldEmitAccessorDeclaration(node)) {\n                return undefined;\n            }\n            var updated = ts.updateGetAccessor(node, \n            /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));\n            if (updated !== node) {\n                // While we emit the source map for the node after skipping decorators and modifiers,\n                // we need to emit the comments for the original range.\n                ts.setCommentRange(updated, node);\n                ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));\n            }\n            return updated;\n        }\n        /**\n         * Visits a set accessor declaration of a class.\n         *\n         * This function will be called when one of the following conditions are met:\n         * - The node is marked as abstract, public, private, or protected\n         * - The node has both a decorator and a computed property name\n         *\n         * @param node The set accessor node.\n         */\n        function visitSetAccessor(node) {\n            if (!shouldEmitAccessorDeclaration(node)) {\n                return undefined;\n            }\n            var updated = ts.updateSetAccessor(node, \n            /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));\n            if (updated !== node) {\n                // While we emit the source map for the node after skipping decorators and modifiers,\n                // we need to emit the comments for the original range.\n                ts.setCommentRange(updated, node);\n                ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));\n            }\n            return updated;\n        }\n        /**\n         * Visits a function declaration.\n         *\n         * This function will be called when one of the following conditions are met:\n         * - The node is an overload\n         * - The node is exported from a TypeScript namespace\n         * - The node has decorators\n         *\n         * @param node The function node.\n         */\n        function visitFunctionDeclaration(node) {\n            if (!shouldEmitFunctionLikeDeclaration(node)) {\n                return ts.createNotEmittedStatement(node);\n            }\n            var updated = ts.updateFunctionDeclaration(node, \n            /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, \n            /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));\n            if (isNamespaceExport(node)) {\n                var statements = [updated];\n                addExportMemberAssignment(statements, node);\n                return statements;\n            }\n            return updated;\n        }\n        /**\n         * Visits a function expression node.\n         *\n         * This function will be called when one of the following conditions are met:\n         * - The node has type annotations\n         *\n         * @param node The function expression node.\n         */\n        function visitFunctionExpression(node) {\n            if (ts.nodeIsMissing(node.body)) {\n                return ts.createOmittedExpression();\n            }\n            var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, \n            /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context));\n            return updated;\n        }\n        /**\n         * @remarks\n         * This function will be called when one of the following conditions are met:\n         * - The node has type annotations\n         */\n        function visitArrowFunction(node) {\n            var updated = ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), \n            /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context));\n            return updated;\n        }\n        /**\n         * Visits a parameter declaration node.\n         *\n         * This function will be called when one of the following conditions are met:\n         * - The node has an accessibility modifier.\n         * - The node has a questionToken.\n         * - The node's kind is ThisKeyword.\n         *\n         * @param node The parameter declaration node.\n         */\n        function visitParameter(node) {\n            if (ts.parameterIsThisKeyword(node)) {\n                return undefined;\n            }\n            var parameter = ts.createParameter(\n            /*decorators*/ undefined, \n            /*modifiers*/ undefined, node.dotDotDotToken, ts.visitNode(node.name, visitor, ts.isBindingName), \n            /*questionToken*/ undefined, \n            /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression), \n            /*location*/ ts.moveRangePastModifiers(node));\n            // While we emit the source map for the node after skipping decorators and modifiers,\n            // we need to emit the comments for the original range.\n            ts.setOriginalNode(parameter, node);\n            ts.setCommentRange(parameter, node);\n            ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node));\n            ts.setEmitFlags(parameter.name, 32 /* NoTrailingSourceMap */);\n            return parameter;\n        }\n        /**\n         * Visits a variable statement in a namespace.\n         *\n         * This function will be called when one of the following conditions are met:\n         * - The node is exported from a TypeScript namespace.\n         */\n        function visitVariableStatement(node) {\n            if (isNamespaceExport(node)) {\n                var variables = ts.getInitializedVariables(node.declarationList);\n                if (variables.length === 0) {\n                    // elide statement if there are no initialized variables.\n                    return undefined;\n                }\n                return ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable)), \n                /*location*/ node);\n            }\n            else {\n                return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function transformInitializedVariable(node) {\n            var name = node.name;\n            if (ts.isBindingPattern(name)) {\n                return ts.flattenDestructuringAssignment(node, visitor, context, 0 /* All */, \n                /*needsValue*/ false, createNamespaceExportExpression);\n            }\n            else {\n                return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), \n                /*location*/ node);\n            }\n        }\n        function visitVariableDeclaration(node) {\n            return ts.updateVariableDeclaration(node, ts.visitNode(node.name, visitor, ts.isBindingName), \n            /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));\n        }\n        /**\n         * Visits a parenthesized expression that contains either a type assertion or an `as`\n         * expression.\n         *\n         * @param node The parenthesized expression node.\n         */\n        function visitParenthesizedExpression(node) {\n            var innerExpression = ts.skipOuterExpressions(node.expression, ~2 /* Assertions */);\n            if (ts.isAssertionExpression(innerExpression)) {\n                // Make sure we consider all nested cast expressions, e.g.:\n                // (<any><number><any>-A).x;\n                var expression = ts.visitNode(node.expression, visitor, ts.isExpression);\n                // We have an expression of the form: (<Type>SubExpr). Emitting this as (SubExpr)\n                // is really not desirable. We would like to emit the subexpression as-is. Omitting\n                // the parentheses, however, could cause change in the semantics of the generated\n                // code if the casted expression has a lower precedence than the rest of the\n                // expression.\n                //\n                // Due to the auto-parenthesization rules used by the visitor and factory functions\n                // we can safely elide the parentheses here, as a new synthetic\n                // ParenthesizedExpression will be inserted if we remove parentheses too\n                // aggressively.\n                //\n                // To preserve comments, we return a \"PartiallyEmittedExpression\" here which will\n                // preserve the position information of the original expression.\n                return ts.createPartiallyEmittedExpression(expression, node);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitAssertionExpression(node) {\n            var expression = ts.visitNode(node.expression, visitor, ts.isExpression);\n            return ts.createPartiallyEmittedExpression(expression, node);\n        }\n        function visitNonNullExpression(node) {\n            var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression);\n            return ts.createPartiallyEmittedExpression(expression, node);\n        }\n        function visitCallExpression(node) {\n            return ts.updateCall(node, ts.visitNode(node.expression, visitor, ts.isExpression), \n            /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression));\n        }\n        function visitNewExpression(node) {\n            return ts.updateNew(node, ts.visitNode(node.expression, visitor, ts.isExpression), \n            /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression));\n        }\n        /**\n         * Determines whether to emit an enum declaration.\n         *\n         * @param node The enum declaration node.\n         */\n        function shouldEmitEnumDeclaration(node) {\n            return !ts.isConst(node)\n                || compilerOptions.preserveConstEnums\n                || compilerOptions.isolatedModules;\n        }\n        /**\n         * Visits an enum declaration.\n         *\n         * This function will be called any time a TypeScript enum is encountered.\n         *\n         * @param node The enum declaration node.\n         */\n        function visitEnumDeclaration(node) {\n            if (!shouldEmitEnumDeclaration(node)) {\n                return undefined;\n            }\n            var statements = [];\n            // We request to be advised when the printer is about to print this node. This allows\n            // us to set up the correct state for later substitutions.\n            var emitFlags = 2 /* AdviseOnEmitNode */;\n            // If needed, we should emit a variable declaration for the enum. If we emit\n            // a leading variable declaration, we should not emit leading comments for the\n            // enum body.\n            if (addVarForEnumOrModuleDeclaration(statements, node)) {\n                // We should still emit the comments if we are emitting a system module.\n                if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {\n                    emitFlags |= 512 /* NoLeadingComments */;\n                }\n            }\n            // `parameterName` is the declaration name used inside of the enum.\n            var parameterName = getNamespaceParameterName(node);\n            // `containerName` is the expression used inside of the enum for assignments.\n            var containerName = getNamespaceContainerName(node);\n            // `exportName` is the expression used within this node's container for any exported references.\n            var exportName = ts.hasModifier(node, 1 /* Export */)\n                ? ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true)\n                : ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true);\n            //  x || (x = {})\n            //  exports.x || (exports.x = {})\n            var moduleArg = ts.createLogicalOr(exportName, ts.createAssignment(exportName, ts.createObjectLiteral()));\n            if (hasNamespaceQualifiedExportName(node)) {\n                // `localName` is the expression used within this node's containing scope for any local references.\n                var localName = ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true);\n                //  x = (exports.x || (exports.x = {}))\n                moduleArg = ts.createAssignment(localName, moduleArg);\n            }\n            //  (function (x) {\n            //      x[x[\"y\"] = 0] = \"y\";\n            //      ...\n            //  })(x || (x = {}));\n            var enumStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(\n            /*modifiers*/ undefined, \n            /*asteriskToken*/ undefined, \n            /*name*/ undefined, \n            /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, parameterName)], \n            /*type*/ undefined, transformEnumBody(node, containerName)), \n            /*typeArguments*/ undefined, [moduleArg]), \n            /*location*/ node);\n            ts.setOriginalNode(enumStatement, node);\n            ts.setEmitFlags(enumStatement, emitFlags);\n            statements.push(enumStatement);\n            // Add a DeclarationMarker for the enum to preserve trailing comments and mark\n            // the end of the declaration.\n            statements.push(ts.createEndOfDeclarationMarker(node));\n            return statements;\n        }\n        /**\n         * Transforms the body of an enum declaration.\n         *\n         * @param node The enum declaration node.\n         */\n        function transformEnumBody(node, localName) {\n            var savedCurrentNamespaceLocalName = currentNamespaceContainerName;\n            currentNamespaceContainerName = localName;\n            var statements = [];\n            startLexicalEnvironment();\n            ts.addRange(statements, ts.map(node.members, transformEnumMember));\n            ts.addRange(statements, endLexicalEnvironment());\n            currentNamespaceContainerName = savedCurrentNamespaceLocalName;\n            return ts.createBlock(ts.createNodeArray(statements, /*location*/ node.members), \n            /*location*/ undefined, \n            /*multiLine*/ true);\n        }\n        /**\n         * Transforms an enum member into a statement.\n         *\n         * @param member The enum member node.\n         */\n        function transformEnumMember(member) {\n            // enums don't support computed properties\n            // we pass false as 'generateNameForComputedPropertyName' for a backward compatibility purposes\n            // old emitter always generate 'expression' part of the name as-is.\n            var name = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ false);\n            return ts.createStatement(ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, name), transformEnumMemberDeclarationValue(member))), name, \n            /*location*/ member), \n            /*location*/ member);\n        }\n        /**\n         * Transforms the value of an enum member.\n         *\n         * @param member The enum member node.\n         */\n        function transformEnumMemberDeclarationValue(member) {\n            var value = resolver.getConstantValue(member);\n            if (value !== undefined) {\n                return ts.createLiteral(value);\n            }\n            else {\n                enableSubstitutionForNonQualifiedEnumMembers();\n                if (member.initializer) {\n                    return ts.visitNode(member.initializer, visitor, ts.isExpression);\n                }\n                else {\n                    return ts.createVoidZero();\n                }\n            }\n        }\n        /**\n         * Determines whether to elide a module declaration.\n         *\n         * @param node The module declaration node.\n         */\n        function shouldEmitModuleDeclaration(node) {\n            return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules);\n        }\n        /**\n         * Determines whether an exported declaration will have a qualified export name (e.g. `f.x`\n         * or `exports.x`).\n         */\n        function hasNamespaceQualifiedExportName(node) {\n            return isNamespaceExport(node)\n                || (isExternalModuleExport(node)\n                    && moduleKind !== ts.ModuleKind.ES2015\n                    && moduleKind !== ts.ModuleKind.System);\n        }\n        /**\n         * Records that a declaration was emitted in the current scope, if it was the first\n         * declaration for the provided symbol.\n         *\n         * NOTE: if there is ever a transformation above this one, we may not be able to rely\n         *       on symbol names.\n         */\n        function recordEmittedDeclarationInScope(node) {\n            var name = node.symbol && node.symbol.name;\n            if (name) {\n                if (!currentScopeFirstDeclarationsOfName) {\n                    currentScopeFirstDeclarationsOfName = ts.createMap();\n                }\n                if (!(name in currentScopeFirstDeclarationsOfName)) {\n                    currentScopeFirstDeclarationsOfName[name] = node;\n                }\n            }\n        }\n        /**\n         * Determines whether a declaration is the first declaration with the same name emitted\n         * in the current scope.\n         */\n        function isFirstEmittedDeclarationInScope(node) {\n            if (currentScopeFirstDeclarationsOfName) {\n                var name_33 = node.symbol && node.symbol.name;\n                if (name_33) {\n                    return currentScopeFirstDeclarationsOfName[name_33] === node;\n                }\n            }\n            return false;\n        }\n        /**\n         * Adds a leading VariableStatement for a enum or module declaration.\n         */\n        function addVarForEnumOrModuleDeclaration(statements, node) {\n            // Emit a variable statement for the module.\n            var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), [\n                ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true))\n            ]);\n            ts.setOriginalNode(statement, node);\n            recordEmittedDeclarationInScope(node);\n            if (isFirstEmittedDeclarationInScope(node)) {\n                // Adjust the source map emit to match the old emitter.\n                if (node.kind === 229 /* EnumDeclaration */) {\n                    ts.setSourceMapRange(statement.declarationList, node);\n                }\n                else {\n                    ts.setSourceMapRange(statement, node);\n                }\n                // Trailing comments for module declaration should be emitted after the function closure\n                // instead of the variable statement:\n                //\n                //     /** Module comment*/\n                //     module m1 {\n                //         function foo4Export() {\n                //         }\n                //     } // trailing comment module\n                //\n                // Should emit:\n                //\n                //     /** Module comment*/\n                //     var m1;\n                //     (function (m1) {\n                //         function foo4Export() {\n                //         }\n                //     })(m1 || (m1 = {})); // trailing comment module\n                //\n                ts.setCommentRange(statement, node);\n                ts.setEmitFlags(statement, 1024 /* NoTrailingComments */ | 2097152 /* HasEndOfDeclarationMarker */);\n                statements.push(statement);\n                return true;\n            }\n            else {\n                // For an EnumDeclaration or ModuleDeclaration that merges with a preceeding\n                // declaration we do not emit a leading variable declaration. To preserve the\n                // begin/end semantics of the declararation and to properly handle exports\n                // we wrap the leading variable declaration in a `MergeDeclarationMarker`.\n                var mergeMarker = ts.createMergeDeclarationMarker(statement);\n                ts.setEmitFlags(mergeMarker, 1536 /* NoComments */ | 2097152 /* HasEndOfDeclarationMarker */);\n                statements.push(mergeMarker);\n                return false;\n            }\n        }\n        /**\n         * Visits a module declaration node.\n         *\n         * This function will be called any time a TypeScript namespace (ModuleDeclaration) is encountered.\n         *\n         * @param node The module declaration node.\n         */\n        function visitModuleDeclaration(node) {\n            if (!shouldEmitModuleDeclaration(node)) {\n                return ts.createNotEmittedStatement(node);\n            }\n            ts.Debug.assert(ts.isIdentifier(node.name), \"TypeScript module should have an Identifier name.\");\n            enableSubstitutionForNamespaceExports();\n            var statements = [];\n            // We request to be advised when the printer is about to print this node. This allows\n            // us to set up the correct state for later substitutions.\n            var emitFlags = 2 /* AdviseOnEmitNode */;\n            // If needed, we should emit a variable declaration for the module. If we emit\n            // a leading variable declaration, we should not emit leading comments for the\n            // module body.\n            if (addVarForEnumOrModuleDeclaration(statements, node)) {\n                // We should still emit the comments if we are emitting a system module.\n                if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {\n                    emitFlags |= 512 /* NoLeadingComments */;\n                }\n            }\n            // `parameterName` is the declaration name used inside of the namespace.\n            var parameterName = getNamespaceParameterName(node);\n            // `containerName` is the expression used inside of the namespace for exports.\n            var containerName = getNamespaceContainerName(node);\n            // `exportName` is the expression used within this node's container for any exported references.\n            var exportName = ts.hasModifier(node, 1 /* Export */)\n                ? ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true)\n                : ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true);\n            //  x || (x = {})\n            //  exports.x || (exports.x = {})\n            var moduleArg = ts.createLogicalOr(exportName, ts.createAssignment(exportName, ts.createObjectLiteral()));\n            if (hasNamespaceQualifiedExportName(node)) {\n                // `localName` is the expression used within this node's containing scope for any local references.\n                var localName = ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true);\n                //  x = (exports.x || (exports.x = {}))\n                moduleArg = ts.createAssignment(localName, moduleArg);\n            }\n            //  (function (x_1) {\n            //      x_1.y = ...;\n            //  })(x || (x = {}));\n            var moduleStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(\n            /*modifiers*/ undefined, \n            /*asteriskToken*/ undefined, \n            /*name*/ undefined, \n            /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, parameterName)], \n            /*type*/ undefined, transformModuleBody(node, containerName)), \n            /*typeArguments*/ undefined, [moduleArg]), \n            /*location*/ node);\n            ts.setOriginalNode(moduleStatement, node);\n            ts.setEmitFlags(moduleStatement, emitFlags);\n            statements.push(moduleStatement);\n            // Add a DeclarationMarker for the namespace to preserve trailing comments and mark\n            // the end of the declaration.\n            statements.push(ts.createEndOfDeclarationMarker(node));\n            return statements;\n        }\n        /**\n         * Transforms the body of a module declaration.\n         *\n         * @param node The module declaration node.\n         */\n        function transformModuleBody(node, namespaceLocalName) {\n            var savedCurrentNamespaceContainerName = currentNamespaceContainerName;\n            var savedCurrentNamespace = currentNamespace;\n            var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;\n            currentNamespaceContainerName = namespaceLocalName;\n            currentNamespace = node;\n            currentScopeFirstDeclarationsOfName = undefined;\n            var statements = [];\n            startLexicalEnvironment();\n            var statementsLocation;\n            var blockLocation;\n            var body = node.body;\n            if (body.kind === 231 /* ModuleBlock */) {\n                ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement));\n                statementsLocation = body.statements;\n                blockLocation = body;\n            }\n            else {\n                var result = visitModuleDeclaration(body);\n                if (result) {\n                    if (ts.isArray(result)) {\n                        ts.addRange(statements, result);\n                    }\n                    else {\n                        statements.push(result);\n                    }\n                }\n                var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body;\n                statementsLocation = ts.moveRangePos(moduleBlock.statements, -1);\n            }\n            ts.addRange(statements, endLexicalEnvironment());\n            currentNamespaceContainerName = savedCurrentNamespaceContainerName;\n            currentNamespace = savedCurrentNamespace;\n            currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;\n            var block = ts.createBlock(ts.createNodeArray(statements, \n            /*location*/ statementsLocation), \n            /*location*/ blockLocation, \n            /*multiLine*/ true);\n            // namespace hello.hi.world {\n            //      function foo() {}\n            //\n            //      // TODO, blah\n            // }\n            //\n            // should be emitted as\n            //\n            // var hello;\n            // (function (hello) {\n            //     var hi;\n            //     (function (hi) {\n            //         var world;\n            //         (function (world) {\n            //             function foo() { }\n            //             // TODO, blah\n            //         })(world = hi.world || (hi.world = {}));\n            //     })(hi = hello.hi || (hello.hi = {}));\n            // })(hello || (hello = {}));\n            // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces.\n            if (body.kind !== 231 /* ModuleBlock */) {\n                ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */);\n            }\n            return block;\n        }\n        function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) {\n            if (moduleDeclaration.body.kind === 230 /* ModuleDeclaration */) {\n                var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body);\n                return recursiveInnerModule || moduleDeclaration.body;\n            }\n        }\n        /**\n         * Visits an import declaration, eliding it if it is not referenced.\n         *\n         * @param node The import declaration node.\n         */\n        function visitImportDeclaration(node) {\n            if (!node.importClause) {\n                // Do not elide a side-effect only import declaration.\n                //  import \"foo\";\n                return node;\n            }\n            // Elide the declaration if the import clause was elided.\n            var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause, /*optional*/ true);\n            return importClause\n                ? ts.updateImportDeclaration(node, \n                /*decorators*/ undefined, \n                /*modifiers*/ undefined, importClause, node.moduleSpecifier)\n                : undefined;\n        }\n        /**\n         * Visits an import clause, eliding it if it is not referenced.\n         *\n         * @param node The import clause node.\n         */\n        function visitImportClause(node) {\n            // Elide the import clause if we elide both its name and its named bindings.\n            var name = resolver.isReferencedAliasDeclaration(node) ? node.name : undefined;\n            var namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings, /*optional*/ true);\n            return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined;\n        }\n        /**\n         * Visits named import bindings, eliding it if it is not referenced.\n         *\n         * @param node The named import bindings node.\n         */\n        function visitNamedImportBindings(node) {\n            if (node.kind === 237 /* NamespaceImport */) {\n                // Elide a namespace import if it is not referenced.\n                return resolver.isReferencedAliasDeclaration(node) ? node : undefined;\n            }\n            else {\n                // Elide named imports if all of its import specifiers are elided.\n                var elements = ts.visitNodes(node.elements, visitImportSpecifier, ts.isImportSpecifier);\n                return ts.some(elements) ? ts.updateNamedImports(node, elements) : undefined;\n            }\n        }\n        /**\n         * Visits an import specifier, eliding it if it is not referenced.\n         *\n         * @param node The import specifier node.\n         */\n        function visitImportSpecifier(node) {\n            // Elide an import specifier if it is not referenced.\n            return resolver.isReferencedAliasDeclaration(node) ? node : undefined;\n        }\n        /**\n         * Visits an export assignment, eliding it if it does not contain a clause that resolves\n         * to a value.\n         *\n         * @param node The export assignment node.\n         */\n        function visitExportAssignment(node) {\n            // Elide the export assignment if it does not reference a value.\n            return resolver.isValueAliasDeclaration(node)\n                ? ts.visitEachChild(node, visitor, context)\n                : undefined;\n        }\n        /**\n         * Visits an export declaration, eliding it if it does not contain a clause that resolves\n         * to a value.\n         *\n         * @param node The export declaration node.\n         */\n        function visitExportDeclaration(node) {\n            if (!node.exportClause) {\n                // Elide a star export if the module it references does not export a value.\n                return resolver.moduleExportsSomeValue(node.moduleSpecifier) ? node : undefined;\n            }\n            if (!resolver.isValueAliasDeclaration(node)) {\n                // Elide the export declaration if it does not export a value.\n                return undefined;\n            }\n            // Elide the export declaration if all of its named exports are elided.\n            var exportClause = ts.visitNode(node.exportClause, visitNamedExports, ts.isNamedExports, /*optional*/ true);\n            return exportClause\n                ? ts.updateExportDeclaration(node, \n                /*decorators*/ undefined, \n                /*modifiers*/ undefined, exportClause, node.moduleSpecifier)\n                : undefined;\n        }\n        /**\n         * Visits named exports, eliding it if it does not contain an export specifier that\n         * resolves to a value.\n         *\n         * @param node The named exports node.\n         */\n        function visitNamedExports(node) {\n            // Elide the named exports if all of its export specifiers were elided.\n            var elements = ts.visitNodes(node.elements, visitExportSpecifier, ts.isExportSpecifier);\n            return ts.some(elements) ? ts.updateNamedExports(node, elements) : undefined;\n        }\n        /**\n         * Visits an export specifier, eliding it if it does not resolve to a value.\n         *\n         * @param node The export specifier node.\n         */\n        function visitExportSpecifier(node) {\n            // Elide an export specifier if it does not reference a value.\n            return resolver.isValueAliasDeclaration(node) ? node : undefined;\n        }\n        /**\n         * Determines whether to emit an import equals declaration.\n         *\n         * @param node The import equals declaration node.\n         */\n        function shouldEmitImportEqualsDeclaration(node) {\n            // preserve old compiler's behavior: emit 'var' for import declaration (even if we do not consider them referenced) when\n            // - current file is not external module\n            // - import declaration is top level and target is value imported by entity name\n            return resolver.isReferencedAliasDeclaration(node)\n                || (!ts.isExternalModule(currentSourceFile)\n                    && resolver.isTopLevelValueImportEqualsWithEntityName(node));\n        }\n        /**\n         * Visits an import equals declaration.\n         *\n         * @param node The import equals declaration node.\n         */\n        function visitImportEqualsDeclaration(node) {\n            if (ts.isExternalModuleImportEqualsDeclaration(node)) {\n                // Elide external module `import=` if it is not referenced.\n                return resolver.isReferencedAliasDeclaration(node)\n                    ? ts.visitEachChild(node, visitor, context)\n                    : undefined;\n            }\n            if (!shouldEmitImportEqualsDeclaration(node)) {\n                return undefined;\n            }\n            var moduleReference = ts.createExpressionFromEntityName(node.moduleReference);\n            ts.setEmitFlags(moduleReference, 1536 /* NoComments */ | 2048 /* NoNestedComments */);\n            if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) {\n                //  export var ${name} = ${moduleReference};\n                //  var ${name} = ${moduleReference};\n                return ts.setOriginalNode(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([\n                    ts.setOriginalNode(ts.createVariableDeclaration(node.name, \n                    /*type*/ undefined, moduleReference), node)\n                ]), node), node);\n            }\n            else {\n                // exports.${name} = ${moduleReference};\n                return ts.setOriginalNode(createNamespaceExport(node.name, moduleReference, node), node);\n            }\n        }\n        /**\n         * Gets a value indicating whether the node is exported from a namespace.\n         *\n         * @param node The node to test.\n         */\n        function isNamespaceExport(node) {\n            return currentNamespace !== undefined && ts.hasModifier(node, 1 /* Export */);\n        }\n        /**\n         * Gets a value indicating whether the node is exported from an external module.\n         *\n         * @param node The node to test.\n         */\n        function isExternalModuleExport(node) {\n            return currentNamespace === undefined && ts.hasModifier(node, 1 /* Export */);\n        }\n        /**\n         * Gets a value indicating whether the node is a named export from an external module.\n         *\n         * @param node The node to test.\n         */\n        function isNamedExternalModuleExport(node) {\n            return isExternalModuleExport(node)\n                && !ts.hasModifier(node, 512 /* Default */);\n        }\n        /**\n         * Gets a value indicating whether the node is the default export of an external module.\n         *\n         * @param node The node to test.\n         */\n        function isDefaultExternalModuleExport(node) {\n            return isExternalModuleExport(node)\n                && ts.hasModifier(node, 512 /* Default */);\n        }\n        /**\n         * Creates a statement for the provided expression. This is used in calls to `map`.\n         */\n        function expressionToStatement(expression) {\n            return ts.createStatement(expression, /*location*/ undefined);\n        }\n        function addExportMemberAssignment(statements, node) {\n            var expression = ts.createAssignment(ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), ts.getLocalName(node));\n            ts.setSourceMapRange(expression, ts.createRange(node.name.pos, node.end));\n            var statement = ts.createStatement(expression);\n            ts.setSourceMapRange(statement, ts.createRange(-1, node.end));\n            statements.push(statement);\n        }\n        function createNamespaceExport(exportName, exportValue, location) {\n            return ts.createStatement(ts.createAssignment(ts.getNamespaceMemberName(currentNamespaceContainerName, exportName, /*allowComments*/ false, /*allowSourceMaps*/ true), exportValue), location);\n        }\n        function createNamespaceExportExpression(exportName, exportValue, location) {\n            return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue, location);\n        }\n        function getNamespaceMemberNameWithSourceMapsAndWithoutComments(name) {\n            return ts.getNamespaceMemberName(currentNamespaceContainerName, name, /*allowComments*/ false, /*allowSourceMaps*/ true);\n        }\n        /**\n         * Gets the declaration name used inside of a namespace or enum.\n         */\n        function getNamespaceParameterName(node) {\n            var name = ts.getGeneratedNameForNode(node);\n            ts.setSourceMapRange(name, node.name);\n            return name;\n        }\n        /**\n         * Gets the expression used to refer to a namespace or enum within the body\n         * of its declaration.\n         */\n        function getNamespaceContainerName(node) {\n            return ts.getGeneratedNameForNode(node);\n        }\n        /**\n         * Gets a local alias for a class declaration if it is a decorated class with an internal\n         * reference to the static side of the class. This is necessary to avoid issues with\n         * double-binding semantics for the class name.\n         */\n        function getClassAliasIfNeeded(node) {\n            if (resolver.getNodeCheckFlags(node) & 8388608 /* ClassWithConstructorReference */) {\n                enableSubstitutionForClassAliases();\n                var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? node.name.text : \"default\");\n                classAliases[ts.getOriginalNodeId(node)] = classAlias;\n                hoistVariableDeclaration(classAlias);\n                return classAlias;\n            }\n        }\n        function getClassPrototype(node) {\n            return ts.createPropertyAccess(ts.getDeclarationName(node), \"prototype\");\n        }\n        function getClassMemberPrefix(node, member) {\n            return ts.hasModifier(member, 32 /* Static */)\n                ? ts.getDeclarationName(node)\n                : getClassPrototype(node);\n        }\n        function enableSubstitutionForNonQualifiedEnumMembers() {\n            if ((enabledSubstitutions & 8 /* NonQualifiedEnumMembers */) === 0) {\n                enabledSubstitutions |= 8 /* NonQualifiedEnumMembers */;\n                context.enableSubstitution(70 /* Identifier */);\n            }\n        }\n        function enableSubstitutionForClassAliases() {\n            if ((enabledSubstitutions & 1 /* ClassAliases */) === 0) {\n                enabledSubstitutions |= 1 /* ClassAliases */;\n                // We need to enable substitutions for identifiers. This allows us to\n                // substitute class names inside of a class declaration.\n                context.enableSubstitution(70 /* Identifier */);\n                // Keep track of class aliases.\n                classAliases = ts.createMap();\n            }\n        }\n        function enableSubstitutionForNamespaceExports() {\n            if ((enabledSubstitutions & 2 /* NamespaceExports */) === 0) {\n                enabledSubstitutions |= 2 /* NamespaceExports */;\n                // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to\n                // substitute the names of exported members of a namespace.\n                context.enableSubstitution(70 /* Identifier */);\n                context.enableSubstitution(258 /* ShorthandPropertyAssignment */);\n                // We need to be notified when entering and exiting namespaces.\n                context.enableEmitNotification(230 /* ModuleDeclaration */);\n            }\n        }\n        function isTransformedModuleDeclaration(node) {\n            return ts.getOriginalNode(node).kind === 230 /* ModuleDeclaration */;\n        }\n        function isTransformedEnumDeclaration(node) {\n            return ts.getOriginalNode(node).kind === 229 /* EnumDeclaration */;\n        }\n        /**\n         * Hook for node emit.\n         *\n         * @param emitContext A context hint for the emitter.\n         * @param node The node to emit.\n         * @param emit A callback used to emit the node in the printer.\n         */\n        function onEmitNode(emitContext, node, emitCallback) {\n            var savedApplicableSubstitutions = applicableSubstitutions;\n            if (enabledSubstitutions & 2 /* NamespaceExports */ && isTransformedModuleDeclaration(node)) {\n                applicableSubstitutions |= 2 /* NamespaceExports */;\n            }\n            if (enabledSubstitutions & 8 /* NonQualifiedEnumMembers */ && isTransformedEnumDeclaration(node)) {\n                applicableSubstitutions |= 8 /* NonQualifiedEnumMembers */;\n            }\n            previousOnEmitNode(emitContext, node, emitCallback);\n            applicableSubstitutions = savedApplicableSubstitutions;\n        }\n        /**\n         * Hooks node substitutions.\n         *\n         * @param emitContext A context hint for the emitter.\n         * @param node The node to substitute.\n         */\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (emitContext === 1 /* Expression */) {\n                return substituteExpression(node);\n            }\n            else if (ts.isShorthandPropertyAssignment(node)) {\n                return substituteShorthandPropertyAssignment(node);\n            }\n            return node;\n        }\n        function substituteShorthandPropertyAssignment(node) {\n            if (enabledSubstitutions & 2 /* NamespaceExports */) {\n                var name_34 = node.name;\n                var exportedName = trySubstituteNamespaceExportedName(name_34);\n                if (exportedName) {\n                    // A shorthand property with an assignment initializer is probably part of a\n                    // destructuring assignment\n                    if (node.objectAssignmentInitializer) {\n                        var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer);\n                        return ts.createPropertyAssignment(name_34, initializer, /*location*/ node);\n                    }\n                    return ts.createPropertyAssignment(name_34, exportedName, /*location*/ node);\n                }\n            }\n            return node;\n        }\n        function substituteExpression(node) {\n            switch (node.kind) {\n                case 70 /* Identifier */:\n                    return substituteExpressionIdentifier(node);\n                case 177 /* PropertyAccessExpression */:\n                    return substitutePropertyAccessExpression(node);\n                case 178 /* ElementAccessExpression */:\n                    return substituteElementAccessExpression(node);\n            }\n            return node;\n        }\n        function substituteExpressionIdentifier(node) {\n            return trySubstituteClassAlias(node)\n                || trySubstituteNamespaceExportedName(node)\n                || node;\n        }\n        function trySubstituteClassAlias(node) {\n            if (enabledSubstitutions & 1 /* ClassAliases */) {\n                if (resolver.getNodeCheckFlags(node) & 16777216 /* ConstructorReferenceInClass */) {\n                    // Due to the emit for class decorators, any reference to the class from inside of the class body\n                    // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind\n                    // behavior of class names in ES6.\n                    // Also, when emitting statics for class expressions, we must substitute a class alias for\n                    // constructor references in static property initializers.\n                    var declaration = resolver.getReferencedValueDeclaration(node);\n                    if (declaration) {\n                        var classAlias = classAliases[declaration.id];\n                        if (classAlias) {\n                            var clone_2 = ts.getSynthesizedClone(classAlias);\n                            ts.setSourceMapRange(clone_2, node);\n                            ts.setCommentRange(clone_2, node);\n                            return clone_2;\n                        }\n                    }\n                }\n            }\n            return undefined;\n        }\n        function trySubstituteNamespaceExportedName(node) {\n            // If this is explicitly a local name, do not substitute.\n            if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {\n                // If we are nested within a namespace declaration, we may need to qualifiy\n                // an identifier that is exported from a merged namespace.\n                var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false);\n                if (container && container.kind !== 261 /* SourceFile */) {\n                    var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 230 /* ModuleDeclaration */) ||\n                        (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 229 /* EnumDeclaration */);\n                    if (substitute) {\n                        return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, /*location*/ node);\n                    }\n                }\n            }\n            return undefined;\n        }\n        function substitutePropertyAccessExpression(node) {\n            return substituteConstantValue(node);\n        }\n        function substituteElementAccessExpression(node) {\n            return substituteConstantValue(node);\n        }\n        function substituteConstantValue(node) {\n            var constantValue = tryGetConstEnumValue(node);\n            if (constantValue !== undefined) {\n                var substitute = ts.createLiteral(constantValue);\n                ts.setSourceMapRange(substitute, node);\n                ts.setCommentRange(substitute, node);\n                if (!compilerOptions.removeComments) {\n                    var propertyName = ts.isPropertyAccessExpression(node)\n                        ? ts.declarationNameToString(node.name)\n                        : ts.getTextOfNode(node.argumentExpression);\n                    substitute.trailingComment = \" \" + propertyName + \" \";\n                }\n                ts.setConstantValue(node, constantValue);\n                return substitute;\n            }\n            return node;\n        }\n        function tryGetConstEnumValue(node) {\n            if (compilerOptions.isolatedModules) {\n                return undefined;\n            }\n            return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)\n                ? resolver.getConstantValue(node)\n                : undefined;\n        }\n    }\n    ts.transformTypeScript = transformTypeScript;\n    var paramHelper = {\n        name: \"typescript:param\",\n        scoped: false,\n        priority: 4,\n        text: \"\\n            var __param = (this && this.__param) || function (paramIndex, decorator) {\\n                return function (target, key) { decorator(target, key, paramIndex); }\\n            };\"\n    };\n    function createParamHelper(context, expression, parameterOffset, location) {\n        context.requestEmitHelper(paramHelper);\n        return ts.createCall(ts.getHelperName(\"__param\"), \n        /*typeArguments*/ undefined, [\n            ts.createLiteral(parameterOffset),\n            expression\n        ], location);\n    }\n    var metadataHelper = {\n        name: \"typescript:metadata\",\n        scoped: false,\n        priority: 3,\n        text: \"\\n            var __metadata = (this && this.__metadata) || function (k, v) {\\n                if (typeof Reflect === \\\"object\\\" && typeof Reflect.metadata === \\\"function\\\") return Reflect.metadata(k, v);\\n            };\"\n    };\n    function createMetadataHelper(context, metadataKey, metadataValue) {\n        context.requestEmitHelper(metadataHelper);\n        return ts.createCall(ts.getHelperName(\"__metadata\"), \n        /*typeArguments*/ undefined, [\n            ts.createLiteral(metadataKey),\n            metadataValue\n        ]);\n    }\n    var decorateHelper = {\n        name: \"typescript:decorate\",\n        scoped: false,\n        priority: 2,\n        text: \"\\n            var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\\n                var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\\n                if (typeof Reflect === \\\"object\\\" && typeof Reflect.decorate === \\\"function\\\") r = Reflect.decorate(decorators, target, key, desc);\\n                else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\\n                return c > 3 && r && Object.defineProperty(target, key, r), r;\\n            };\"\n    };\n    function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) {\n        context.requestEmitHelper(decorateHelper);\n        var argumentsArray = [];\n        argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, /*location*/ undefined, /*multiLine*/ true));\n        argumentsArray.push(target);\n        if (memberName) {\n            argumentsArray.push(memberName);\n            if (descriptor) {\n                argumentsArray.push(descriptor);\n            }\n        }\n        return ts.createCall(ts.getHelperName(\"__decorate\"), /*typeArguments*/ undefined, argumentsArray, location);\n    }\n})(ts || (ts = {}));\n/// <reference path=\"../factory.ts\" />\n/// <reference path=\"../visitor.ts\" />\n/*@internal*/\nvar ts;\n(function (ts) {\n    function transformESNext(context) {\n        var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            var visited = ts.visitEachChild(node, visitor, context);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            return visited;\n        }\n        function visitor(node) {\n            return visitorWorker(node, /*noDestructuringValue*/ false);\n        }\n        function visitorNoDestructuringValue(node) {\n            return visitorWorker(node, /*noDestructuringValue*/ true);\n        }\n        function visitorWorker(node, noDestructuringValue) {\n            if ((node.transformFlags & 8 /* ContainsESNext */) === 0) {\n                return node;\n            }\n            switch (node.kind) {\n                case 176 /* ObjectLiteralExpression */:\n                    return visitObjectLiteralExpression(node);\n                case 192 /* BinaryExpression */:\n                    return visitBinaryExpression(node, noDestructuringValue);\n                case 223 /* VariableDeclaration */:\n                    return visitVariableDeclaration(node);\n                case 213 /* ForOfStatement */:\n                    return visitForOfStatement(node);\n                case 211 /* ForStatement */:\n                    return visitForStatement(node);\n                case 188 /* VoidExpression */:\n                    return visitVoidExpression(node);\n                case 150 /* Constructor */:\n                    return visitConstructorDeclaration(node);\n                case 149 /* MethodDeclaration */:\n                    return visitMethodDeclaration(node);\n                case 151 /* GetAccessor */:\n                    return visitGetAccessorDeclaration(node);\n                case 152 /* SetAccessor */:\n                    return visitSetAccessorDeclaration(node);\n                case 225 /* FunctionDeclaration */:\n                    return visitFunctionDeclaration(node);\n                case 184 /* FunctionExpression */:\n                    return visitFunctionExpression(node);\n                case 185 /* ArrowFunction */:\n                    return visitArrowFunction(node);\n                case 144 /* Parameter */:\n                    return visitParameter(node);\n                case 207 /* ExpressionStatement */:\n                    return visitExpressionStatement(node);\n                case 183 /* ParenthesizedExpression */:\n                    return visitParenthesizedExpression(node, noDestructuringValue);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function chunkObjectLiteralElements(elements) {\n            var chunkObject;\n            var objects = [];\n            for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {\n                var e = elements_3[_i];\n                if (e.kind === 259 /* SpreadAssignment */) {\n                    if (chunkObject) {\n                        objects.push(ts.createObjectLiteral(chunkObject));\n                        chunkObject = undefined;\n                    }\n                    var target = e.expression;\n                    objects.push(ts.visitNode(target, visitor, ts.isExpression));\n                }\n                else {\n                    if (!chunkObject) {\n                        chunkObject = [];\n                    }\n                    if (e.kind === 257 /* PropertyAssignment */) {\n                        var p = e;\n                        chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression)));\n                    }\n                    else {\n                        chunkObject.push(e);\n                    }\n                }\n            }\n            if (chunkObject) {\n                objects.push(ts.createObjectLiteral(chunkObject));\n            }\n            return objects;\n        }\n        function visitObjectLiteralExpression(node) {\n            if (node.transformFlags & 1048576 /* ContainsObjectSpread */) {\n                // spread elements emit like so:\n                // non-spread elements are chunked together into object literals, and then all are passed to __assign:\n                //     { a, ...o, b } => __assign({a}, o, {b});\n                // If the first element is a spread element, then the first argument to __assign is {}:\n                //     { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)\n                var objects = chunkObjectLiteralElements(node.properties);\n                if (objects.length && objects[0].kind !== 176 /* ObjectLiteralExpression */) {\n                    objects.unshift(ts.createObjectLiteral());\n                }\n                return createAssignHelper(context, objects);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitExpressionStatement(node) {\n            return ts.visitEachChild(node, visitorNoDestructuringValue, context);\n        }\n        function visitParenthesizedExpression(node, noDestructuringValue) {\n            return ts.visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context);\n        }\n        /**\n         * Visits a BinaryExpression that contains a destructuring assignment.\n         *\n         * @param node A BinaryExpression node.\n         */\n        function visitBinaryExpression(node, noDestructuringValue) {\n            if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 1048576 /* ContainsObjectRest */) {\n                return ts.flattenDestructuringAssignment(node, visitor, context, 1 /* ObjectRest */, !noDestructuringValue);\n            }\n            else if (node.operatorToken.kind === 25 /* CommaToken */) {\n                return ts.updateBinary(node, ts.visitNode(node.left, visitorNoDestructuringValue, ts.isExpression), ts.visitNode(node.right, noDestructuringValue ? visitorNoDestructuringValue : visitor, ts.isExpression));\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        /**\n         * Visits a VariableDeclaration node with a binding pattern.\n         *\n         * @param node A VariableDeclaration node.\n         */\n        function visitVariableDeclaration(node) {\n            // If we are here it is because the name contains a binding pattern with a rest somewhere in it.\n            if (ts.isBindingPattern(node.name) && node.name.transformFlags & 1048576 /* ContainsObjectRest */) {\n                return ts.flattenDestructuringBinding(node, visitor, context, 1 /* ObjectRest */);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitForStatement(node) {\n            return ts.updateFor(node, ts.visitNode(node.initializer, visitorNoDestructuringValue, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement));\n        }\n        function visitVoidExpression(node) {\n            return ts.visitEachChild(node, visitorNoDestructuringValue, context);\n        }\n        /**\n         * Visits a ForOfStatement and converts it into a ES2015-compatible ForOfStatement.\n         *\n         * @param node A ForOfStatement.\n         */\n        function visitForOfStatement(node) {\n            var leadingStatements;\n            var temp;\n            var initializer = ts.skipParentheses(node.initializer);\n            if (initializer.transformFlags & 1048576 /* ContainsObjectRest */) {\n                if (ts.isVariableDeclarationList(initializer)) {\n                    temp = ts.createTempVariable(/*recordTempVariable*/ undefined);\n                    var firstDeclaration = ts.firstOrUndefined(initializer.declarations);\n                    var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1 /* ObjectRest */, temp, \n                    /*doNotRecordTempVariablesInLine*/ false, \n                    /*skipInitializer*/ true);\n                    if (ts.some(declarations)) {\n                        var statement = ts.createVariableStatement(\n                        /*modifiers*/ undefined, ts.updateVariableDeclarationList(initializer, declarations), \n                        /*location*/ initializer);\n                        leadingStatements = ts.append(leadingStatements, statement);\n                    }\n                }\n                else if (ts.isAssignmentPattern(initializer)) {\n                    temp = ts.createTempVariable(/*recordTempVariable*/ undefined);\n                    var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, /*location*/ node.initializer)), visitor, context, 1 /* ObjectRest */);\n                    leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, /*location*/ node.initializer));\n                }\n            }\n            if (temp) {\n                var expression = ts.visitNode(node.expression, visitor, ts.isExpression);\n                var statement = ts.visitNode(node.statement, visitor, ts.isStatement);\n                var block = ts.isBlock(statement)\n                    ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements))\n                    : ts.createBlock(ts.append(leadingStatements, statement), statement, /*multiLine*/ true);\n                return ts.updateForOf(node, ts.createVariableDeclarationList([\n                    ts.createVariableDeclaration(temp, /*type*/ undefined, /*initializer*/ undefined, node.initializer)\n                ], node.initializer, 1 /* Let */), expression, block);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitParameter(node) {\n            if (node.transformFlags & 1048576 /* ContainsObjectRest */) {\n                // Binding patterns are converted into a generated name and are\n                // evaluated inside the function body.\n                return ts.updateParameter(node, \n                /*decorators*/ undefined, \n                /*modifiers*/ undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), \n                /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitConstructorDeclaration(node) {\n            return ts.updateConstructor(node, \n            /*decorators*/ undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));\n        }\n        function visitGetAccessorDeclaration(node) {\n            return ts.updateGetAccessor(node, \n            /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, transformFunctionBody(node));\n        }\n        function visitSetAccessorDeclaration(node) {\n            return ts.updateSetAccessor(node, \n            /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));\n        }\n        function visitMethodDeclaration(node) {\n            return ts.updateMethod(node, \n            /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), \n            /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, transformFunctionBody(node));\n        }\n        function visitFunctionDeclaration(node) {\n            return ts.updateFunctionDeclaration(node, \n            /*decorators*/ undefined, node.modifiers, node.name, \n            /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, transformFunctionBody(node));\n        }\n        function visitArrowFunction(node) {\n            return ts.updateArrowFunction(node, node.modifiers, \n            /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, transformFunctionBody(node));\n        }\n        function visitFunctionExpression(node) {\n            return ts.updateFunctionExpression(node, node.modifiers, node.name, \n            /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, transformFunctionBody(node));\n        }\n        function transformFunctionBody(node) {\n            resumeLexicalEnvironment();\n            var leadingStatements;\n            for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {\n                var parameter = _a[_i];\n                if (parameter.transformFlags & 1048576 /* ContainsObjectRest */) {\n                    var temp = ts.getGeneratedNameForNode(parameter);\n                    var declarations = ts.flattenDestructuringBinding(parameter, visitor, context, 1 /* ObjectRest */, temp, \n                    /*doNotRecordTempVariablesInLine*/ false, \n                    /*skipInitializer*/ true);\n                    if (ts.some(declarations)) {\n                        var statement = ts.createVariableStatement(\n                        /*modifiers*/ undefined, ts.createVariableDeclarationList(declarations));\n                        ts.setEmitFlags(statement, 524288 /* CustomPrologue */);\n                        leadingStatements = ts.append(leadingStatements, statement);\n                    }\n                }\n            }\n            var body = ts.visitNode(node.body, visitor, ts.isConciseBody);\n            var trailingStatements = endLexicalEnvironment();\n            if (ts.some(leadingStatements) || ts.some(trailingStatements)) {\n                var block = ts.convertToFunctionBody(body, /*multiLine*/ true);\n                return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements));\n            }\n            return body;\n        }\n    }\n    ts.transformESNext = transformESNext;\n    var assignHelper = {\n        name: \"typescript:assign\",\n        scoped: false,\n        priority: 1,\n        text: \"\\n            var __assign = (this && this.__assign) || Object.assign || function(t) {\\n                for (var s, i = 1, n = arguments.length; i < n; i++) {\\n                    s = arguments[i];\\n                    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\\n                        t[p] = s[p];\\n                }\\n                return t;\\n            };\"\n    };\n    function createAssignHelper(context, attributesSegments) {\n        context.requestEmitHelper(assignHelper);\n        return ts.createCall(ts.getHelperName(\"__assign\"), \n        /*typeArguments*/ undefined, attributesSegments);\n    }\n    ts.createAssignHelper = createAssignHelper;\n})(ts || (ts = {}));\n/// <reference path=\"../factory.ts\" />\n/// <reference path=\"../visitor.ts\" />\n/// <reference path=\"./esnext.ts\" />\n/*@internal*/\nvar ts;\n(function (ts) {\n    function transformJsx(context) {\n        var compilerOptions = context.getCompilerOptions();\n        var currentSourceFile;\n        return transformSourceFile;\n        /**\n         * Transform JSX-specific syntax in a SourceFile.\n         *\n         * @param node A SourceFile node.\n         */\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            currentSourceFile = node;\n            var visited = ts.visitEachChild(node, visitor, context);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            currentSourceFile = undefined;\n            return visited;\n        }\n        function visitor(node) {\n            if (node.transformFlags & 4 /* ContainsJsx */) {\n                return visitorWorker(node);\n            }\n            else {\n                return node;\n            }\n        }\n        function visitorWorker(node) {\n            switch (node.kind) {\n                case 246 /* JsxElement */:\n                    return visitJsxElement(node, /*isChild*/ false);\n                case 247 /* JsxSelfClosingElement */:\n                    return visitJsxSelfClosingElement(node, /*isChild*/ false);\n                case 252 /* JsxExpression */:\n                    return visitJsxExpression(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function transformJsxChildToExpression(node) {\n            switch (node.kind) {\n                case 10 /* JsxText */:\n                    return visitJsxText(node);\n                case 252 /* JsxExpression */:\n                    return visitJsxExpression(node);\n                case 246 /* JsxElement */:\n                    return visitJsxElement(node, /*isChild*/ true);\n                case 247 /* JsxSelfClosingElement */:\n                    return visitJsxSelfClosingElement(node, /*isChild*/ true);\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    return undefined;\n            }\n        }\n        function visitJsxElement(node, isChild) {\n            return visitJsxOpeningLikeElement(node.openingElement, node.children, isChild, /*location*/ node);\n        }\n        function visitJsxSelfClosingElement(node, isChild) {\n            return visitJsxOpeningLikeElement(node, /*children*/ undefined, isChild, /*location*/ node);\n        }\n        function visitJsxOpeningLikeElement(node, children, isChild, location) {\n            var tagName = getTagName(node);\n            var objectProperties;\n            var attrs = node.attributes;\n            if (attrs.length === 0) {\n                // When there are no attributes, React wants \"null\"\n                objectProperties = ts.createNull();\n            }\n            else {\n                // Map spans of JsxAttribute nodes into object literals and spans\n                // of JsxSpreadAttribute nodes into expressions.\n                var segments = ts.flatten(ts.spanMap(attrs, ts.isJsxSpreadAttribute, function (attrs, isSpread) { return isSpread\n                    ? ts.map(attrs, transformJsxSpreadAttributeToExpression)\n                    : ts.createObjectLiteral(ts.map(attrs, transformJsxAttributeToObjectLiteralElement)); }));\n                if (ts.isJsxSpreadAttribute(attrs[0])) {\n                    // We must always emit at least one object literal before a spread\n                    // argument.\n                    segments.unshift(ts.createObjectLiteral());\n                }\n                // Either emit one big object literal (no spread attribs), or\n                // a call to the __assign helper.\n                objectProperties = ts.singleOrUndefined(segments);\n                if (!objectProperties) {\n                    objectProperties = ts.createAssignHelper(context, segments);\n                }\n            }\n            var element = ts.createExpressionForJsxElement(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location);\n            if (isChild) {\n                ts.startOnNewLine(element);\n            }\n            return element;\n        }\n        function transformJsxSpreadAttributeToExpression(node) {\n            return ts.visitNode(node.expression, visitor, ts.isExpression);\n        }\n        function transformJsxAttributeToObjectLiteralElement(node) {\n            var name = getAttributeName(node);\n            var expression = transformJsxAttributeInitializer(node.initializer);\n            return ts.createPropertyAssignment(name, expression);\n        }\n        function transformJsxAttributeInitializer(node) {\n            if (node === undefined) {\n                return ts.createLiteral(true);\n            }\n            else if (node.kind === 9 /* StringLiteral */) {\n                var decoded = tryDecodeEntities(node.text);\n                return decoded ? ts.createLiteral(decoded, /*location*/ node) : node;\n            }\n            else if (node.kind === 252 /* JsxExpression */) {\n                return visitJsxExpression(node);\n            }\n            else {\n                ts.Debug.failBadSyntaxKind(node);\n            }\n        }\n        function visitJsxText(node) {\n            var text = ts.getTextOfNode(node, /*includeTrivia*/ true);\n            var parts;\n            var firstNonWhitespace = 0;\n            var lastNonWhitespace = -1;\n            // JSX trims whitespace at the end and beginning of lines, except that the\n            // start/end of a tag is considered a start/end of a line only if that line is\n            // on the same line as the closing tag. See examples in\n            // tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx\n            for (var i = 0; i < text.length; i++) {\n                var c = text.charCodeAt(i);\n                if (ts.isLineBreak(c)) {\n                    if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) {\n                        var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1);\n                        if (!parts) {\n                            parts = [];\n                        }\n                        // We do not escape the string here as that is handled by the printer\n                        // when it emits the literal. We do, however, need to decode JSX entities.\n                        parts.push(ts.createLiteral(decodeEntities(part)));\n                    }\n                    firstNonWhitespace = -1;\n                }\n                else if (!ts.isWhiteSpace(c)) {\n                    lastNonWhitespace = i;\n                    if (firstNonWhitespace === -1) {\n                        firstNonWhitespace = i;\n                    }\n                }\n            }\n            if (firstNonWhitespace !== -1) {\n                var part = text.substr(firstNonWhitespace);\n                if (!parts) {\n                    parts = [];\n                }\n                // We do not escape the string here as that is handled by the printer\n                // when it emits the literal. We do, however, need to decode JSX entities.\n                parts.push(ts.createLiteral(decodeEntities(part)));\n            }\n            if (parts) {\n                return ts.reduceLeft(parts, aggregateJsxTextParts);\n            }\n            return undefined;\n        }\n        /**\n         * Aggregates two expressions by interpolating them with a whitespace literal.\n         */\n        function aggregateJsxTextParts(left, right) {\n            return ts.createAdd(ts.createAdd(left, ts.createLiteral(\" \")), right);\n        }\n        /**\n         * Replace entities like \"&nbsp;\", \"&#123;\", and \"&#xDEADBEEF;\" with the characters they encode.\n         * See https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references\n         */\n        function decodeEntities(text) {\n            return text.replace(/&((#((\\d+)|x([\\da-fA-F]+)))|(\\w+));/g, function (match, _all, _number, _digits, decimal, hex, word) {\n                if (decimal) {\n                    return String.fromCharCode(parseInt(decimal, 10));\n                }\n                else if (hex) {\n                    return String.fromCharCode(parseInt(hex, 16));\n                }\n                else {\n                    var ch = entities[word];\n                    // If this is not a valid entity, then just use `match` (replace it with itself, i.e. don't replace)\n                    return ch ? String.fromCharCode(ch) : match;\n                }\n            });\n        }\n        /** Like `decodeEntities` but returns `undefined` if there were no entities to decode. */\n        function tryDecodeEntities(text) {\n            var decoded = decodeEntities(text);\n            return decoded === text ? undefined : decoded;\n        }\n        function getTagName(node) {\n            if (node.kind === 246 /* JsxElement */) {\n                return getTagName(node.openingElement);\n            }\n            else {\n                var name_35 = node.tagName;\n                if (ts.isIdentifier(name_35) && ts.isIntrinsicJsxName(name_35.text)) {\n                    return ts.createLiteral(name_35.text);\n                }\n                else {\n                    return ts.createExpressionFromEntityName(name_35);\n                }\n            }\n        }\n        /**\n         * Emit an attribute name, which is quoted if it needs to be quoted. Because\n         * these emit into an object literal property name, we don't need to be worried\n         * about keywords, just non-identifier characters\n         */\n        function getAttributeName(node) {\n            var name = node.name;\n            if (/^[A-Za-z_]\\w*$/.test(name.text)) {\n                return name;\n            }\n            else {\n                return ts.createLiteral(name.text);\n            }\n        }\n        function visitJsxExpression(node) {\n            return ts.visitNode(node.expression, visitor, ts.isExpression);\n        }\n    }\n    ts.transformJsx = transformJsx;\n    var entities = ts.createMap({\n        \"quot\": 0x0022,\n        \"amp\": 0x0026,\n        \"apos\": 0x0027,\n        \"lt\": 0x003C,\n        \"gt\": 0x003E,\n        \"nbsp\": 0x00A0,\n        \"iexcl\": 0x00A1,\n        \"cent\": 0x00A2,\n        \"pound\": 0x00A3,\n        \"curren\": 0x00A4,\n        \"yen\": 0x00A5,\n        \"brvbar\": 0x00A6,\n        \"sect\": 0x00A7,\n        \"uml\": 0x00A8,\n        \"copy\": 0x00A9,\n        \"ordf\": 0x00AA,\n        \"laquo\": 0x00AB,\n        \"not\": 0x00AC,\n        \"shy\": 0x00AD,\n        \"reg\": 0x00AE,\n        \"macr\": 0x00AF,\n        \"deg\": 0x00B0,\n        \"plusmn\": 0x00B1,\n        \"sup2\": 0x00B2,\n        \"sup3\": 0x00B3,\n        \"acute\": 0x00B4,\n        \"micro\": 0x00B5,\n        \"para\": 0x00B6,\n        \"middot\": 0x00B7,\n        \"cedil\": 0x00B8,\n        \"sup1\": 0x00B9,\n        \"ordm\": 0x00BA,\n        \"raquo\": 0x00BB,\n        \"frac14\": 0x00BC,\n        \"frac12\": 0x00BD,\n        \"frac34\": 0x00BE,\n        \"iquest\": 0x00BF,\n        \"Agrave\": 0x00C0,\n        \"Aacute\": 0x00C1,\n        \"Acirc\": 0x00C2,\n        \"Atilde\": 0x00C3,\n        \"Auml\": 0x00C4,\n        \"Aring\": 0x00C5,\n        \"AElig\": 0x00C6,\n        \"Ccedil\": 0x00C7,\n        \"Egrave\": 0x00C8,\n        \"Eacute\": 0x00C9,\n        \"Ecirc\": 0x00CA,\n        \"Euml\": 0x00CB,\n        \"Igrave\": 0x00CC,\n        \"Iacute\": 0x00CD,\n        \"Icirc\": 0x00CE,\n        \"Iuml\": 0x00CF,\n        \"ETH\": 0x00D0,\n        \"Ntilde\": 0x00D1,\n        \"Ograve\": 0x00D2,\n        \"Oacute\": 0x00D3,\n        \"Ocirc\": 0x00D4,\n        \"Otilde\": 0x00D5,\n        \"Ouml\": 0x00D6,\n        \"times\": 0x00D7,\n        \"Oslash\": 0x00D8,\n        \"Ugrave\": 0x00D9,\n        \"Uacute\": 0x00DA,\n        \"Ucirc\": 0x00DB,\n        \"Uuml\": 0x00DC,\n        \"Yacute\": 0x00DD,\n        \"THORN\": 0x00DE,\n        \"szlig\": 0x00DF,\n        \"agrave\": 0x00E0,\n        \"aacute\": 0x00E1,\n        \"acirc\": 0x00E2,\n        \"atilde\": 0x00E3,\n        \"auml\": 0x00E4,\n        \"aring\": 0x00E5,\n        \"aelig\": 0x00E6,\n        \"ccedil\": 0x00E7,\n        \"egrave\": 0x00E8,\n        \"eacute\": 0x00E9,\n        \"ecirc\": 0x00EA,\n        \"euml\": 0x00EB,\n        \"igrave\": 0x00EC,\n        \"iacute\": 0x00ED,\n        \"icirc\": 0x00EE,\n        \"iuml\": 0x00EF,\n        \"eth\": 0x00F0,\n        \"ntilde\": 0x00F1,\n        \"ograve\": 0x00F2,\n        \"oacute\": 0x00F3,\n        \"ocirc\": 0x00F4,\n        \"otilde\": 0x00F5,\n        \"ouml\": 0x00F6,\n        \"divide\": 0x00F7,\n        \"oslash\": 0x00F8,\n        \"ugrave\": 0x00F9,\n        \"uacute\": 0x00FA,\n        \"ucirc\": 0x00FB,\n        \"uuml\": 0x00FC,\n        \"yacute\": 0x00FD,\n        \"thorn\": 0x00FE,\n        \"yuml\": 0x00FF,\n        \"OElig\": 0x0152,\n        \"oelig\": 0x0153,\n        \"Scaron\": 0x0160,\n        \"scaron\": 0x0161,\n        \"Yuml\": 0x0178,\n        \"fnof\": 0x0192,\n        \"circ\": 0x02C6,\n        \"tilde\": 0x02DC,\n        \"Alpha\": 0x0391,\n        \"Beta\": 0x0392,\n        \"Gamma\": 0x0393,\n        \"Delta\": 0x0394,\n        \"Epsilon\": 0x0395,\n        \"Zeta\": 0x0396,\n        \"Eta\": 0x0397,\n        \"Theta\": 0x0398,\n        \"Iota\": 0x0399,\n        \"Kappa\": 0x039A,\n        \"Lambda\": 0x039B,\n        \"Mu\": 0x039C,\n        \"Nu\": 0x039D,\n        \"Xi\": 0x039E,\n        \"Omicron\": 0x039F,\n        \"Pi\": 0x03A0,\n        \"Rho\": 0x03A1,\n        \"Sigma\": 0x03A3,\n        \"Tau\": 0x03A4,\n        \"Upsilon\": 0x03A5,\n        \"Phi\": 0x03A6,\n        \"Chi\": 0x03A7,\n        \"Psi\": 0x03A8,\n        \"Omega\": 0x03A9,\n        \"alpha\": 0x03B1,\n        \"beta\": 0x03B2,\n        \"gamma\": 0x03B3,\n        \"delta\": 0x03B4,\n        \"epsilon\": 0x03B5,\n        \"zeta\": 0x03B6,\n        \"eta\": 0x03B7,\n        \"theta\": 0x03B8,\n        \"iota\": 0x03B9,\n        \"kappa\": 0x03BA,\n        \"lambda\": 0x03BB,\n        \"mu\": 0x03BC,\n        \"nu\": 0x03BD,\n        \"xi\": 0x03BE,\n        \"omicron\": 0x03BF,\n        \"pi\": 0x03C0,\n        \"rho\": 0x03C1,\n        \"sigmaf\": 0x03C2,\n        \"sigma\": 0x03C3,\n        \"tau\": 0x03C4,\n        \"upsilon\": 0x03C5,\n        \"phi\": 0x03C6,\n        \"chi\": 0x03C7,\n        \"psi\": 0x03C8,\n        \"omega\": 0x03C9,\n        \"thetasym\": 0x03D1,\n        \"upsih\": 0x03D2,\n        \"piv\": 0x03D6,\n        \"ensp\": 0x2002,\n        \"emsp\": 0x2003,\n        \"thinsp\": 0x2009,\n        \"zwnj\": 0x200C,\n        \"zwj\": 0x200D,\n        \"lrm\": 0x200E,\n        \"rlm\": 0x200F,\n        \"ndash\": 0x2013,\n        \"mdash\": 0x2014,\n        \"lsquo\": 0x2018,\n        \"rsquo\": 0x2019,\n        \"sbquo\": 0x201A,\n        \"ldquo\": 0x201C,\n        \"rdquo\": 0x201D,\n        \"bdquo\": 0x201E,\n        \"dagger\": 0x2020,\n        \"Dagger\": 0x2021,\n        \"bull\": 0x2022,\n        \"hellip\": 0x2026,\n        \"permil\": 0x2030,\n        \"prime\": 0x2032,\n        \"Prime\": 0x2033,\n        \"lsaquo\": 0x2039,\n        \"rsaquo\": 0x203A,\n        \"oline\": 0x203E,\n        \"frasl\": 0x2044,\n        \"euro\": 0x20AC,\n        \"image\": 0x2111,\n        \"weierp\": 0x2118,\n        \"real\": 0x211C,\n        \"trade\": 0x2122,\n        \"alefsym\": 0x2135,\n        \"larr\": 0x2190,\n        \"uarr\": 0x2191,\n        \"rarr\": 0x2192,\n        \"darr\": 0x2193,\n        \"harr\": 0x2194,\n        \"crarr\": 0x21B5,\n        \"lArr\": 0x21D0,\n        \"uArr\": 0x21D1,\n        \"rArr\": 0x21D2,\n        \"dArr\": 0x21D3,\n        \"hArr\": 0x21D4,\n        \"forall\": 0x2200,\n        \"part\": 0x2202,\n        \"exist\": 0x2203,\n        \"empty\": 0x2205,\n        \"nabla\": 0x2207,\n        \"isin\": 0x2208,\n        \"notin\": 0x2209,\n        \"ni\": 0x220B,\n        \"prod\": 0x220F,\n        \"sum\": 0x2211,\n        \"minus\": 0x2212,\n        \"lowast\": 0x2217,\n        \"radic\": 0x221A,\n        \"prop\": 0x221D,\n        \"infin\": 0x221E,\n        \"ang\": 0x2220,\n        \"and\": 0x2227,\n        \"or\": 0x2228,\n        \"cap\": 0x2229,\n        \"cup\": 0x222A,\n        \"int\": 0x222B,\n        \"there4\": 0x2234,\n        \"sim\": 0x223C,\n        \"cong\": 0x2245,\n        \"asymp\": 0x2248,\n        \"ne\": 0x2260,\n        \"equiv\": 0x2261,\n        \"le\": 0x2264,\n        \"ge\": 0x2265,\n        \"sub\": 0x2282,\n        \"sup\": 0x2283,\n        \"nsub\": 0x2284,\n        \"sube\": 0x2286,\n        \"supe\": 0x2287,\n        \"oplus\": 0x2295,\n        \"otimes\": 0x2297,\n        \"perp\": 0x22A5,\n        \"sdot\": 0x22C5,\n        \"lceil\": 0x2308,\n        \"rceil\": 0x2309,\n        \"lfloor\": 0x230A,\n        \"rfloor\": 0x230B,\n        \"lang\": 0x2329,\n        \"rang\": 0x232A,\n        \"loz\": 0x25CA,\n        \"spades\": 0x2660,\n        \"clubs\": 0x2663,\n        \"hearts\": 0x2665,\n        \"diams\": 0x2666\n    });\n})(ts || (ts = {}));\n/// <reference path=\"../factory.ts\" />\n/// <reference path=\"../visitor.ts\" />\n/*@internal*/\nvar ts;\n(function (ts) {\n    var ES2017SubstitutionFlags;\n    (function (ES2017SubstitutionFlags) {\n        /** Enables substitutions for async methods with `super` calls. */\n        ES2017SubstitutionFlags[ES2017SubstitutionFlags[\"AsyncMethodsWithSuper\"] = 1] = \"AsyncMethodsWithSuper\";\n    })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {}));\n    function transformES2017(context) {\n        var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;\n        var resolver = context.getEmitResolver();\n        var compilerOptions = context.getCompilerOptions();\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        // These variables contain state that changes as we descend into the tree.\n        var currentSourceFile;\n        /**\n         * Keeps track of whether expression substitution has been enabled for specific edge cases.\n         * They are persisted between each SourceFile transformation and should not be reset.\n         */\n        var enabledSubstitutions;\n        /**\n         * This keeps track of containers where `super` is valid, for use with\n         * just-in-time substitution for `super` expressions inside of async methods.\n         */\n        var currentSuperContainer;\n        // Save the previous transformation hooks.\n        var previousOnEmitNode = context.onEmitNode;\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        // Set new transformation hooks.\n        context.onEmitNode = onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            currentSourceFile = node;\n            var visited = ts.visitEachChild(node, visitor, context);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            currentSourceFile = undefined;\n            return visited;\n        }\n        function visitor(node) {\n            if ((node.transformFlags & 16 /* ContainsES2017 */) === 0) {\n                return node;\n            }\n            switch (node.kind) {\n                case 119 /* AsyncKeyword */:\n                    // ES2017 async modifier should be elided for targets < ES2017\n                    return undefined;\n                case 189 /* AwaitExpression */:\n                    // ES2017 'await' expressions must be transformed for targets < ES2017.\n                    return visitAwaitExpression(node);\n                case 149 /* MethodDeclaration */:\n                    // ES2017 method declarations may be 'async'\n                    return visitMethodDeclaration(node);\n                case 225 /* FunctionDeclaration */:\n                    // ES2017 function declarations may be 'async'\n                    return visitFunctionDeclaration(node);\n                case 184 /* FunctionExpression */:\n                    // ES2017 function expressions may be 'async'\n                    return visitFunctionExpression(node);\n                case 185 /* ArrowFunction */:\n                    // ES2017 arrow functions may be 'async'\n                    return visitArrowFunction(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        /**\n         * Visits an AwaitExpression node.\n         *\n         * This function will be called any time a ES2017 await expression is encountered.\n         *\n         * @param node The node to visit.\n         */\n        function visitAwaitExpression(node) {\n            return ts.setOriginalNode(ts.createYield(\n            /*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression), \n            /*location*/ node), node);\n        }\n        /**\n         * Visits a MethodDeclaration node.\n         *\n         * This function will be called when one of the following conditions are met:\n         * - The node is marked as async\n         *\n         * @param node The node to visit.\n         */\n        function visitMethodDeclaration(node) {\n            return ts.updateMethod(node, \n            /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, \n            /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, ts.isAsyncFunctionLike(node)\n                ? transformAsyncFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        /**\n         * Visits a FunctionDeclaration node.\n         *\n         * This function will be called when one of the following conditions are met:\n         * - The node is marked async\n         *\n         * @param node The node to visit.\n         */\n        function visitFunctionDeclaration(node) {\n            return ts.updateFunctionDeclaration(node, \n            /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, \n            /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, ts.isAsyncFunctionLike(node)\n                ? transformAsyncFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        /**\n         * Visits a FunctionExpression node.\n         *\n         * This function will be called when one of the following conditions are met:\n         * - The node is marked async\n         *\n         * @param node The node to visit.\n         */\n        function visitFunctionExpression(node) {\n            if (ts.nodeIsMissing(node.body)) {\n                return ts.createOmittedExpression();\n            }\n            return ts.updateFunctionExpression(node, \n            /*modifiers*/ undefined, node.name, \n            /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, ts.isAsyncFunctionLike(node)\n                ? transformAsyncFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        /**\n         * Visits an ArrowFunction.\n         *\n         * This function will be called when one of the following conditions are met:\n         * - The node is marked async\n         *\n         * @param node The node to visit.\n         */\n        function visitArrowFunction(node) {\n            return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), \n            /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, ts.isAsyncFunctionLike(node)\n                ? transformAsyncFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        function transformAsyncFunctionBody(node) {\n            resumeLexicalEnvironment();\n            var original = ts.getOriginalNode(node, ts.isFunctionLike);\n            var nodeType = original.type;\n            var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined;\n            var isArrowFunction = node.kind === 185 /* ArrowFunction */;\n            var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0;\n            // An async function is emit as an outer function that calls an inner\n            // generator function. To preserve lexical bindings, we pass the current\n            // `this` and `arguments` objects to `__awaiter`. The generator function\n            // passed to `__awaiter` is executed inside of the callback to the\n            // promise constructor.\n            if (!isArrowFunction) {\n                var statements = [];\n                var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, /*ensureUseStrict*/ false, visitor);\n                statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset))));\n                ts.addRange(statements, endLexicalEnvironment());\n                var block = ts.createBlock(statements, /*location*/ node.body, /*multiLine*/ true);\n                // Minor optimization, emit `_super` helper to capture `super` access in an arrow.\n                // This step isn't needed if we eventually transform this to ES5.\n                if (languageVersion >= 2 /* ES2015 */) {\n                    if (resolver.getNodeCheckFlags(node) & 4096 /* AsyncMethodWithSuperBinding */) {\n                        enableSubstitutionForAsyncMethodsWithSuper();\n                        ts.addEmitHelper(block, advancedAsyncSuperHelper);\n                    }\n                    else if (resolver.getNodeCheckFlags(node) & 2048 /* AsyncMethodWithSuper */) {\n                        enableSubstitutionForAsyncMethodsWithSuper();\n                        ts.addEmitHelper(block, asyncSuperHelper);\n                    }\n                }\n                return block;\n            }\n            else {\n                var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body));\n                var declarations = endLexicalEnvironment();\n                if (ts.some(declarations)) {\n                    var block = ts.convertToFunctionBody(expression);\n                    return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements));\n                }\n                return expression;\n            }\n        }\n        function transformFunctionBodyWorker(body, start) {\n            if (ts.isBlock(body)) {\n                return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start));\n            }\n            else {\n                startLexicalEnvironment();\n                var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody));\n                var declarations = endLexicalEnvironment();\n                return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements));\n            }\n        }\n        function getPromiseConstructor(type) {\n            var typeName = type && ts.getEntityNameFromTypeNode(type);\n            if (typeName && ts.isEntityName(typeName)) {\n                var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);\n                if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue\n                    || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {\n                    return typeName;\n                }\n            }\n            return undefined;\n        }\n        function enableSubstitutionForAsyncMethodsWithSuper() {\n            if ((enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) === 0) {\n                enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */;\n                // We need to enable substitutions for call, property access, and element access\n                // if we need to rewrite super calls.\n                context.enableSubstitution(179 /* CallExpression */);\n                context.enableSubstitution(177 /* PropertyAccessExpression */);\n                context.enableSubstitution(178 /* ElementAccessExpression */);\n                // We need to be notified when entering and exiting declarations that bind super.\n                context.enableEmitNotification(226 /* ClassDeclaration */);\n                context.enableEmitNotification(149 /* MethodDeclaration */);\n                context.enableEmitNotification(151 /* GetAccessor */);\n                context.enableEmitNotification(152 /* SetAccessor */);\n                context.enableEmitNotification(150 /* Constructor */);\n            }\n        }\n        function substituteExpression(node) {\n            switch (node.kind) {\n                case 177 /* PropertyAccessExpression */:\n                    return substitutePropertyAccessExpression(node);\n                case 178 /* ElementAccessExpression */:\n                    return substituteElementAccessExpression(node);\n                case 179 /* CallExpression */:\n                    if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) {\n                        return substituteCallExpression(node);\n                    }\n                    break;\n            }\n            return node;\n        }\n        function substitutePropertyAccessExpression(node) {\n            if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && node.expression.kind === 96 /* SuperKeyword */) {\n                var flags = getSuperContainerAsyncMethodFlags();\n                if (flags) {\n                    return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), flags, node);\n                }\n            }\n            return node;\n        }\n        function substituteElementAccessExpression(node) {\n            if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && node.expression.kind === 96 /* SuperKeyword */) {\n                var flags = getSuperContainerAsyncMethodFlags();\n                if (flags) {\n                    return createSuperAccessInAsyncMethod(node.argumentExpression, flags, node);\n                }\n            }\n            return node;\n        }\n        function substituteCallExpression(node) {\n            var expression = node.expression;\n            if (ts.isSuperProperty(expression)) {\n                var flags = getSuperContainerAsyncMethodFlags();\n                if (flags) {\n                    var argumentExpression = ts.isPropertyAccessExpression(expression)\n                        ? substitutePropertyAccessExpression(expression)\n                        : substituteElementAccessExpression(expression);\n                    return ts.createCall(ts.createPropertyAccess(argumentExpression, \"call\"), \n                    /*typeArguments*/ undefined, [\n                        ts.createThis()\n                    ].concat(node.arguments));\n                }\n            }\n            return node;\n        }\n        function isSuperContainer(node) {\n            var kind = node.kind;\n            return kind === 226 /* ClassDeclaration */\n                || kind === 150 /* Constructor */\n                || kind === 149 /* MethodDeclaration */\n                || kind === 151 /* GetAccessor */\n                || kind === 152 /* SetAccessor */;\n        }\n        /**\n         * Hook for node emit.\n         *\n         * @param node The node to emit.\n         * @param emit A callback used to emit the node in the printer.\n         */\n        function onEmitNode(emitContext, node, emitCallback) {\n            // If we need to support substitutions for `super` in an async method,\n            // we should track it here.\n            if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {\n                var savedCurrentSuperContainer = currentSuperContainer;\n                currentSuperContainer = node;\n                previousOnEmitNode(emitContext, node, emitCallback);\n                currentSuperContainer = savedCurrentSuperContainer;\n            }\n            else {\n                previousOnEmitNode(emitContext, node, emitCallback);\n            }\n        }\n        /**\n         * Hooks node substitutions.\n         *\n         * @param node The node to substitute.\n         * @param isExpression A value indicating whether the node is to be used in an expression\n         *                     position.\n         */\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (emitContext === 1 /* Expression */) {\n                return substituteExpression(node);\n            }\n            return node;\n        }\n        function createSuperAccessInAsyncMethod(argumentExpression, flags, location) {\n            if (flags & 4096 /* AsyncMethodWithSuperBinding */) {\n                return ts.createPropertyAccess(ts.createCall(ts.createIdentifier(\"_super\"), \n                /*typeArguments*/ undefined, [argumentExpression]), \"value\", location);\n            }\n            else {\n                return ts.createCall(ts.createIdentifier(\"_super\"), \n                /*typeArguments*/ undefined, [argumentExpression], location);\n            }\n        }\n        function getSuperContainerAsyncMethodFlags() {\n            return currentSuperContainer !== undefined\n                && resolver.getNodeCheckFlags(currentSuperContainer) & (2048 /* AsyncMethodWithSuper */ | 4096 /* AsyncMethodWithSuperBinding */);\n        }\n    }\n    ts.transformES2017 = transformES2017;\n    function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) {\n        context.requestEmitHelper(awaiterHelper);\n        var generatorFunc = ts.createFunctionExpression(\n        /*modifiers*/ undefined, ts.createToken(38 /* AsteriskToken */), \n        /*name*/ undefined, \n        /*typeParameters*/ undefined, \n        /*parameters*/ [], \n        /*type*/ undefined, body);\n        // Mark this node as originally an async function\n        (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072 /* AsyncFunctionBody */;\n        return ts.createCall(ts.getHelperName(\"__awaiter\"), \n        /*typeArguments*/ undefined, [\n            ts.createThis(),\n            hasLexicalArguments ? ts.createIdentifier(\"arguments\") : ts.createVoidZero(),\n            promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(),\n            generatorFunc\n        ]);\n    }\n    var awaiterHelper = {\n        name: \"typescript:awaiter\",\n        scoped: false,\n        priority: 5,\n        text: \"\\n            var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\\n                return new (P || (P = Promise))(function (resolve, reject) {\\n                    function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\\n                    function rejected(value) { try { step(generator[\\\"throw\\\"](value)); } catch (e) { reject(e); } }\\n                    function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\\n                    step((generator = generator.apply(thisArg, _arguments)).next());\\n                });\\n            };\"\n    };\n    var asyncSuperHelper = {\n        name: \"typescript:async-super\",\n        scoped: true,\n        text: \"\\n            const _super = name => super[name];\"\n    };\n    var advancedAsyncSuperHelper = {\n        name: \"typescript:advanced-async-super\",\n        scoped: true,\n        text: \"\\n            const _super = (function (geti, seti) {\\n                const cache = Object.create(null);\\n                return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\\n            })(name => super[name], (name, value) => super[name] = value);\"\n    };\n})(ts || (ts = {}));\n/// <reference path=\"../factory.ts\" />\n/// <reference path=\"../visitor.ts\" />\n/*@internal*/\nvar ts;\n(function (ts) {\n    function transformES2016(context) {\n        var hoistVariableDeclaration = context.hoistVariableDeclaration;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitor(node) {\n            if ((node.transformFlags & 32 /* ContainsES2016 */) === 0) {\n                return node;\n            }\n            switch (node.kind) {\n                case 192 /* BinaryExpression */:\n                    return visitBinaryExpression(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitBinaryExpression(node) {\n            switch (node.operatorToken.kind) {\n                case 61 /* AsteriskAsteriskEqualsToken */:\n                    return visitExponentiationAssignmentExpression(node);\n                case 39 /* AsteriskAsteriskToken */:\n                    return visitExponentiationExpression(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitExponentiationAssignmentExpression(node) {\n            var target;\n            var value;\n            var left = ts.visitNode(node.left, visitor, ts.isExpression);\n            var right = ts.visitNode(node.right, visitor, ts.isExpression);\n            if (ts.isElementAccessExpression(left)) {\n                // Transforms `a[x] **= b` into `(_a = a)[_x = x] = Math.pow(_a[_x], b)`\n                var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);\n                var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration);\n                target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, /*location*/ left.argumentExpression), \n                /*location*/ left);\n                value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, \n                /*location*/ left);\n            }\n            else if (ts.isPropertyAccessExpression(left)) {\n                // Transforms `a.x **= b` into `(_a = a).x = Math.pow(_a.x, b)`\n                var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);\n                target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), left.name, \n                /*location*/ left);\n                value = ts.createPropertyAccess(expressionTemp, left.name, \n                /*location*/ left);\n            }\n            else {\n                // Transforms `a **= b` into `a = Math.pow(a, b)`\n                target = left;\n                value = left;\n            }\n            return ts.createAssignment(target, ts.createMathPow(value, right, /*location*/ node), /*location*/ node);\n        }\n        function visitExponentiationExpression(node) {\n            // Transforms `a ** b` into `Math.pow(a, b)`\n            var left = ts.visitNode(node.left, visitor, ts.isExpression);\n            var right = ts.visitNode(node.right, visitor, ts.isExpression);\n            return ts.createMathPow(left, right, /*location*/ node);\n        }\n    }\n    ts.transformES2016 = transformES2016;\n})(ts || (ts = {}));\n/// <reference path=\"../factory.ts\" />\n/// <reference path=\"../visitor.ts\" />\n/*@internal*/\nvar ts;\n(function (ts) {\n    var ES2015SubstitutionFlags;\n    (function (ES2015SubstitutionFlags) {\n        /** Enables substitutions for captured `this` */\n        ES2015SubstitutionFlags[ES2015SubstitutionFlags[\"CapturedThis\"] = 1] = \"CapturedThis\";\n        /** Enables substitutions for block-scoped bindings. */\n        ES2015SubstitutionFlags[ES2015SubstitutionFlags[\"BlockScopedBindings\"] = 2] = \"BlockScopedBindings\";\n    })(ES2015SubstitutionFlags || (ES2015SubstitutionFlags = {}));\n    var CopyDirection;\n    (function (CopyDirection) {\n        CopyDirection[CopyDirection[\"ToOriginal\"] = 0] = \"ToOriginal\";\n        CopyDirection[CopyDirection[\"ToOutParameter\"] = 1] = \"ToOutParameter\";\n    })(CopyDirection || (CopyDirection = {}));\n    var Jump;\n    (function (Jump) {\n        Jump[Jump[\"Break\"] = 2] = \"Break\";\n        Jump[Jump[\"Continue\"] = 4] = \"Continue\";\n        Jump[Jump[\"Return\"] = 8] = \"Return\";\n    })(Jump || (Jump = {}));\n    var SuperCaptureResult;\n    (function (SuperCaptureResult) {\n        /**\n         * A capture may have been added for calls to 'super', but\n         * the caller should emit subsequent statements normally.\n         */\n        SuperCaptureResult[SuperCaptureResult[\"NoReplacement\"] = 0] = \"NoReplacement\";\n        /**\n         * A call to 'super()' got replaced with a capturing statement like:\n         *\n         *  var _this = _super.call(...) || this;\n         *\n         * Callers should skip the current statement.\n         */\n        SuperCaptureResult[SuperCaptureResult[\"ReplaceSuperCapture\"] = 1] = \"ReplaceSuperCapture\";\n        /**\n         * A call to 'super()' got replaced with a capturing statement like:\n         *\n         *  return _super.call(...) || this;\n         *\n         * Callers should skip the current statement and avoid any returns of '_this'.\n         */\n        SuperCaptureResult[SuperCaptureResult[\"ReplaceWithReturn\"] = 2] = \"ReplaceWithReturn\";\n    })(SuperCaptureResult || (SuperCaptureResult = {}));\n    function transformES2015(context) {\n        var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;\n        var resolver = context.getEmitResolver();\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        var previousOnEmitNode = context.onEmitNode;\n        context.onEmitNode = onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        var currentSourceFile;\n        var currentText;\n        var currentParent;\n        var currentNode;\n        var enclosingVariableStatement;\n        var enclosingBlockScopeContainer;\n        var enclosingBlockScopeContainerParent;\n        var enclosingFunction;\n        var enclosingNonArrowFunction;\n        var enclosingNonAsyncFunctionBody;\n        var isInConstructorWithCapturedSuper;\n        /**\n         * Used to track if we are emitting body of the converted loop\n         */\n        var convertedLoopState;\n        /**\n         * Keeps track of whether substitutions have been enabled for specific cases.\n         * They are persisted between each SourceFile transformation and should not\n         * be reset.\n         */\n        var enabledSubstitutions;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            currentSourceFile = node;\n            currentText = node.text;\n            var visited = saveStateAndInvoke(node, visitSourceFile);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            currentSourceFile = undefined;\n            currentText = undefined;\n            return visited;\n        }\n        function visitor(node) {\n            return saveStateAndInvoke(node, dispatcher);\n        }\n        function dispatcher(node) {\n            return convertedLoopState\n                ? visitorForConvertedLoopWorker(node)\n                : visitorWorker(node);\n        }\n        function saveStateAndInvoke(node, f) {\n            var savedEnclosingFunction = enclosingFunction;\n            var savedEnclosingNonArrowFunction = enclosingNonArrowFunction;\n            var savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody;\n            var savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer;\n            var savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent;\n            var savedEnclosingVariableStatement = enclosingVariableStatement;\n            var savedCurrentParent = currentParent;\n            var savedCurrentNode = currentNode;\n            var savedConvertedLoopState = convertedLoopState;\n            var savedIsInConstructorWithCapturedSuper = isInConstructorWithCapturedSuper;\n            if (ts.nodeStartsNewLexicalEnvironment(node)) {\n                // don't treat content of nodes that start new lexical environment as part of converted loop copy or constructor body\n                isInConstructorWithCapturedSuper = false;\n                convertedLoopState = undefined;\n            }\n            onBeforeVisitNode(node);\n            var visited = f(node);\n            isInConstructorWithCapturedSuper = savedIsInConstructorWithCapturedSuper;\n            convertedLoopState = savedConvertedLoopState;\n            enclosingFunction = savedEnclosingFunction;\n            enclosingNonArrowFunction = savedEnclosingNonArrowFunction;\n            enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody;\n            enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer;\n            enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent;\n            enclosingVariableStatement = savedEnclosingVariableStatement;\n            currentParent = savedCurrentParent;\n            currentNode = savedCurrentNode;\n            return visited;\n        }\n        function onBeforeVisitNode(node) {\n            if (currentNode) {\n                if (ts.isBlockScope(currentNode, currentParent)) {\n                    enclosingBlockScopeContainer = currentNode;\n                    enclosingBlockScopeContainerParent = currentParent;\n                }\n                if (ts.isFunctionLike(currentNode)) {\n                    enclosingFunction = currentNode;\n                    if (currentNode.kind !== 185 /* ArrowFunction */) {\n                        enclosingNonArrowFunction = currentNode;\n                        if (!(ts.getEmitFlags(currentNode) & 131072 /* AsyncFunctionBody */)) {\n                            enclosingNonAsyncFunctionBody = currentNode;\n                        }\n                    }\n                }\n                // keep track of the enclosing variable statement when in the context of\n                // variable statements, variable declarations, binding elements, and binding\n                // patterns.\n                switch (currentNode.kind) {\n                    case 205 /* VariableStatement */:\n                        enclosingVariableStatement = currentNode;\n                        break;\n                    case 224 /* VariableDeclarationList */:\n                    case 223 /* VariableDeclaration */:\n                    case 174 /* BindingElement */:\n                    case 172 /* ObjectBindingPattern */:\n                    case 173 /* ArrayBindingPattern */:\n                        break;\n                    default:\n                        enclosingVariableStatement = undefined;\n                }\n            }\n            currentParent = currentNode;\n            currentNode = node;\n        }\n        function returnCapturedThis(node) {\n            return ts.setOriginalNode(ts.createReturn(ts.createIdentifier(\"_this\")), node);\n        }\n        function isReturnVoidStatementInConstructorWithCapturedSuper(node) {\n            return isInConstructorWithCapturedSuper && node.kind === 216 /* ReturnStatement */ && !node.expression;\n        }\n        function shouldCheckNode(node) {\n            return (node.transformFlags & 64 /* ES2015 */) !== 0 ||\n                node.kind === 219 /* LabeledStatement */ ||\n                (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node));\n        }\n        function visitorWorker(node) {\n            if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) {\n                return returnCapturedThis(node);\n            }\n            else if (shouldCheckNode(node)) {\n                return visitJavaScript(node);\n            }\n            else if (node.transformFlags & 128 /* ContainsES2015 */ || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) {\n                // we want to dive in this branch either if node has children with ES2015 specific syntax\n                // or we are inside constructor that captures result of the super call so all returns without expression should be\n                // rewritten. Note: we skip expressions since returns should never appear there\n                return ts.visitEachChild(node, visitor, context);\n            }\n            else {\n                return node;\n            }\n        }\n        function visitorForConvertedLoopWorker(node) {\n            var result;\n            if (shouldCheckNode(node)) {\n                result = visitJavaScript(node);\n            }\n            else {\n                result = visitNodesInConvertedLoop(node);\n            }\n            return result;\n        }\n        function visitNodesInConvertedLoop(node) {\n            switch (node.kind) {\n                case 216 /* ReturnStatement */:\n                    node = isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : node;\n                    return visitReturnStatement(node);\n                case 205 /* VariableStatement */:\n                    return visitVariableStatement(node);\n                case 218 /* SwitchStatement */:\n                    return visitSwitchStatement(node);\n                case 215 /* BreakStatement */:\n                case 214 /* ContinueStatement */:\n                    return visitBreakOrContinueStatement(node);\n                case 98 /* ThisKeyword */:\n                    return visitThisKeyword(node);\n                case 70 /* Identifier */:\n                    return visitIdentifier(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitJavaScript(node) {\n            switch (node.kind) {\n                case 114 /* StaticKeyword */:\n                    return undefined; // elide static keyword\n                case 226 /* ClassDeclaration */:\n                    return visitClassDeclaration(node);\n                case 197 /* ClassExpression */:\n                    return visitClassExpression(node);\n                case 144 /* Parameter */:\n                    return visitParameter(node);\n                case 225 /* FunctionDeclaration */:\n                    return visitFunctionDeclaration(node);\n                case 185 /* ArrowFunction */:\n                    return visitArrowFunction(node);\n                case 184 /* FunctionExpression */:\n                    return visitFunctionExpression(node);\n                case 223 /* VariableDeclaration */:\n                    return visitVariableDeclaration(node);\n                case 70 /* Identifier */:\n                    return visitIdentifier(node);\n                case 224 /* VariableDeclarationList */:\n                    return visitVariableDeclarationList(node);\n                case 219 /* LabeledStatement */:\n                    return visitLabeledStatement(node);\n                case 209 /* DoStatement */:\n                    return visitDoStatement(node);\n                case 210 /* WhileStatement */:\n                    return visitWhileStatement(node);\n                case 211 /* ForStatement */:\n                    return visitForStatement(node);\n                case 212 /* ForInStatement */:\n                    return visitForInStatement(node);\n                case 213 /* ForOfStatement */:\n                    return visitForOfStatement(node);\n                case 207 /* ExpressionStatement */:\n                    return visitExpressionStatement(node);\n                case 176 /* ObjectLiteralExpression */:\n                    return visitObjectLiteralExpression(node);\n                case 256 /* CatchClause */:\n                    return visitCatchClause(node);\n                case 258 /* ShorthandPropertyAssignment */:\n                    return visitShorthandPropertyAssignment(node);\n                case 175 /* ArrayLiteralExpression */:\n                    return visitArrayLiteralExpression(node);\n                case 179 /* CallExpression */:\n                    return visitCallExpression(node);\n                case 180 /* NewExpression */:\n                    return visitNewExpression(node);\n                case 183 /* ParenthesizedExpression */:\n                    return visitParenthesizedExpression(node, /*needsDestructuringValue*/ true);\n                case 192 /* BinaryExpression */:\n                    return visitBinaryExpression(node, /*needsDestructuringValue*/ true);\n                case 12 /* NoSubstitutionTemplateLiteral */:\n                case 13 /* TemplateHead */:\n                case 14 /* TemplateMiddle */:\n                case 15 /* TemplateTail */:\n                    return visitTemplateLiteral(node);\n                case 181 /* TaggedTemplateExpression */:\n                    return visitTaggedTemplateExpression(node);\n                case 194 /* TemplateExpression */:\n                    return visitTemplateExpression(node);\n                case 195 /* YieldExpression */:\n                    return visitYieldExpression(node);\n                case 196 /* SpreadElement */:\n                    return visitSpreadElement(node);\n                case 96 /* SuperKeyword */:\n                    return visitSuperKeyword();\n                case 195 /* YieldExpression */:\n                    // `yield` will be handled by a generators transform.\n                    return ts.visitEachChild(node, visitor, context);\n                case 149 /* MethodDeclaration */:\n                    return visitMethodDeclaration(node);\n                case 205 /* VariableStatement */:\n                    return visitVariableStatement(node);\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function visitSourceFile(node) {\n            var statements = [];\n            startLexicalEnvironment();\n            var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor);\n            addCaptureThisForNodeIfNeeded(statements, node);\n            ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));\n            ts.addRange(statements, endLexicalEnvironment());\n            return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));\n        }\n        function visitSwitchStatement(node) {\n            ts.Debug.assert(convertedLoopState !== undefined);\n            var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps;\n            // for switch statement allow only non-labeled break\n            convertedLoopState.allowedNonLabeledJumps |= 2 /* Break */;\n            var result = ts.visitEachChild(node, visitor, context);\n            convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps;\n            return result;\n        }\n        function visitReturnStatement(node) {\n            ts.Debug.assert(convertedLoopState !== undefined);\n            convertedLoopState.nonLocalJumps |= 8 /* Return */;\n            return ts.createReturn(ts.createObjectLiteral([\n                ts.createPropertyAssignment(ts.createIdentifier(\"value\"), node.expression\n                    ? ts.visitNode(node.expression, visitor, ts.isExpression)\n                    : ts.createVoidZero())\n            ]));\n        }\n        function visitThisKeyword(node) {\n            ts.Debug.assert(convertedLoopState !== undefined);\n            if (enclosingFunction && enclosingFunction.kind === 185 /* ArrowFunction */) {\n                // if the enclosing function is an ArrowFunction is then we use the captured 'this' keyword.\n                convertedLoopState.containsLexicalThis = true;\n                return node;\n            }\n            return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName(\"this\"));\n        }\n        function visitIdentifier(node) {\n            if (!convertedLoopState) {\n                return node;\n            }\n            if (ts.isGeneratedIdentifier(node)) {\n                return node;\n            }\n            if (node.text !== \"arguments\" && !resolver.isArgumentsLocalBinding(node)) {\n                return node;\n            }\n            return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName(\"arguments\"));\n        }\n        function visitBreakOrContinueStatement(node) {\n            if (convertedLoopState) {\n                // check if we can emit break/continue as is\n                // it is possible if either\n                //   - break/continue is labeled and label is located inside the converted loop\n                //   - break/continue is non-labeled and located in non-converted loop/switch statement\n                var jump = node.kind === 215 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */;\n                var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) ||\n                    (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump));\n                if (!canUseBreakOrContinue) {\n                    var labelMarker = void 0;\n                    if (!node.label) {\n                        if (node.kind === 215 /* BreakStatement */) {\n                            convertedLoopState.nonLocalJumps |= 2 /* Break */;\n                            labelMarker = \"break\";\n                        }\n                        else {\n                            convertedLoopState.nonLocalJumps |= 4 /* Continue */;\n                            // note: return value is emitted only to simplify debugging, call to converted loop body does not do any dispatching on it.\n                            labelMarker = \"continue\";\n                        }\n                    }\n                    else {\n                        if (node.kind === 215 /* BreakStatement */) {\n                            labelMarker = \"break-\" + node.label.text;\n                            setLabeledJump(convertedLoopState, /*isBreak*/ true, node.label.text, labelMarker);\n                        }\n                        else {\n                            labelMarker = \"continue-\" + node.label.text;\n                            setLabeledJump(convertedLoopState, /*isBreak*/ false, node.label.text, labelMarker);\n                        }\n                    }\n                    var returnExpression = ts.createLiteral(labelMarker);\n                    if (convertedLoopState.loopOutParameters.length) {\n                        var outParams = convertedLoopState.loopOutParameters;\n                        var expr = void 0;\n                        for (var i = 0; i < outParams.length; i++) {\n                            var copyExpr = copyOutParameter(outParams[i], 1 /* ToOutParameter */);\n                            if (i === 0) {\n                                expr = copyExpr;\n                            }\n                            else {\n                                expr = ts.createBinary(expr, 25 /* CommaToken */, copyExpr);\n                            }\n                        }\n                        returnExpression = ts.createBinary(expr, 25 /* CommaToken */, returnExpression);\n                    }\n                    return ts.createReturn(returnExpression);\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        /**\n         * Visits a ClassDeclaration and transforms it into a variable statement.\n         *\n         * @param node A ClassDeclaration node.\n         */\n        function visitClassDeclaration(node) {\n            // [source]\n            //      class C { }\n            //\n            // [output]\n            //      var C = (function () {\n            //          function C() {\n            //          }\n            //          return C;\n            //      }());\n            var variable = ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ true), \n            /*type*/ undefined, transformClassLikeDeclarationToExpression(node));\n            ts.setOriginalNode(variable, node);\n            var statements = [];\n            var statement = ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList([variable]), /*location*/ node);\n            ts.setOriginalNode(statement, node);\n            ts.startOnNewLine(statement);\n            statements.push(statement);\n            // Add an `export default` statement for default exports (for `--target es5 --module es6`)\n            if (ts.hasModifier(node, 1 /* Export */)) {\n                var exportStatement = ts.hasModifier(node, 512 /* Default */)\n                    ? ts.createExportDefault(ts.getLocalName(node))\n                    : ts.createExternalModuleExport(ts.getLocalName(node));\n                ts.setOriginalNode(exportStatement, statement);\n                statements.push(exportStatement);\n            }\n            var emitFlags = ts.getEmitFlags(node);\n            if ((emitFlags & 2097152 /* HasEndOfDeclarationMarker */) === 0) {\n                // Add a DeclarationMarker as a marker for the end of the declaration\n                statements.push(ts.createEndOfDeclarationMarker(node));\n                ts.setEmitFlags(statement, emitFlags | 2097152 /* HasEndOfDeclarationMarker */);\n            }\n            return ts.singleOrMany(statements);\n        }\n        /**\n         * Visits a ClassExpression and transforms it into an expression.\n         *\n         * @param node A ClassExpression node.\n         */\n        function visitClassExpression(node) {\n            // [source]\n            //      C = class { }\n            //\n            // [output]\n            //      C = (function () {\n            //          function class_1() {\n            //          }\n            //          return class_1;\n            //      }())\n            return transformClassLikeDeclarationToExpression(node);\n        }\n        /**\n         * Transforms a ClassExpression or ClassDeclaration into an expression.\n         *\n         * @param node A ClassExpression or ClassDeclaration node.\n         */\n        function transformClassLikeDeclarationToExpression(node) {\n            // [source]\n            //      class C extends D {\n            //          constructor() {}\n            //          method() {}\n            //          get prop() {}\n            //          set prop(v) {}\n            //      }\n            //\n            // [output]\n            //      (function (_super) {\n            //          __extends(C, _super);\n            //          function C() {\n            //          }\n            //          C.prototype.method = function () {}\n            //          Object.defineProperty(C.prototype, \"prop\", {\n            //              get: function() {},\n            //              set: function() {},\n            //              enumerable: true,\n            //              configurable: true\n            //          });\n            //          return C;\n            //      }(D))\n            if (node.name) {\n                enableSubstitutionsForBlockScopedBindings();\n            }\n            var extendsClauseElement = ts.getClassExtendsHeritageClauseElement(node);\n            var classFunction = ts.createFunctionExpression(\n            /*modifiers*/ undefined, \n            /*asteriskToken*/ undefined, \n            /*name*/ undefined, \n            /*typeParameters*/ undefined, extendsClauseElement ? [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, \"_super\")] : [], \n            /*type*/ undefined, transformClassBody(node, extendsClauseElement));\n            // To preserve the behavior of the old emitter, we explicitly indent\n            // the body of the function here if it was requested in an earlier\n            // transformation.\n            if (ts.getEmitFlags(node) & 32768 /* Indented */) {\n                ts.setEmitFlags(classFunction, 32768 /* Indented */);\n            }\n            // \"inner\" and \"outer\" below are added purely to preserve source map locations from\n            // the old emitter\n            var inner = ts.createPartiallyEmittedExpression(classFunction);\n            inner.end = node.end;\n            ts.setEmitFlags(inner, 1536 /* NoComments */);\n            var outer = ts.createPartiallyEmittedExpression(inner);\n            outer.end = ts.skipTrivia(currentText, node.pos);\n            ts.setEmitFlags(outer, 1536 /* NoComments */);\n            return ts.createParen(ts.createCall(outer, \n            /*typeArguments*/ undefined, extendsClauseElement\n                ? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)]\n                : []));\n        }\n        /**\n         * Transforms a ClassExpression or ClassDeclaration into a function body.\n         *\n         * @param node A ClassExpression or ClassDeclaration node.\n         * @param extendsClauseElement The expression for the class `extends` clause.\n         */\n        function transformClassBody(node, extendsClauseElement) {\n            var statements = [];\n            startLexicalEnvironment();\n            addExtendsHelperIfNeeded(statements, node, extendsClauseElement);\n            addConstructor(statements, node, extendsClauseElement);\n            addClassMembers(statements, node);\n            // Create a synthetic text range for the return statement.\n            var closingBraceLocation = ts.createTokenRange(ts.skipTrivia(currentText, node.members.end), 17 /* CloseBraceToken */);\n            var localName = ts.getLocalName(node);\n            // The following partially-emitted expression exists purely to align our sourcemap\n            // emit with the original emitter.\n            var outer = ts.createPartiallyEmittedExpression(localName);\n            outer.end = closingBraceLocation.end;\n            ts.setEmitFlags(outer, 1536 /* NoComments */);\n            var statement = ts.createReturn(outer);\n            statement.pos = closingBraceLocation.pos;\n            ts.setEmitFlags(statement, 1536 /* NoComments */ | 384 /* NoTokenSourceMaps */);\n            statements.push(statement);\n            ts.addRange(statements, endLexicalEnvironment());\n            var block = ts.createBlock(ts.createNodeArray(statements, /*location*/ node.members), /*location*/ undefined, /*multiLine*/ true);\n            ts.setEmitFlags(block, 1536 /* NoComments */);\n            return block;\n        }\n        /**\n         * Adds a call to the `__extends` helper if needed for a class.\n         *\n         * @param statements The statements of the class body function.\n         * @param node The ClassExpression or ClassDeclaration node.\n         * @param extendsClauseElement The expression for the class `extends` clause.\n         */\n        function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) {\n            if (extendsClauseElement) {\n                statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)), \n                /*location*/ extendsClauseElement));\n            }\n        }\n        /**\n         * Adds the constructor of the class to a class body function.\n         *\n         * @param statements The statements of the class body function.\n         * @param node The ClassExpression or ClassDeclaration node.\n         * @param extendsClauseElement The expression for the class `extends` clause.\n         */\n        function addConstructor(statements, node, extendsClauseElement) {\n            var constructor = ts.getFirstConstructorWithBody(node);\n            var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined);\n            var constructorFunction = ts.createFunctionDeclaration(\n            /*decorators*/ undefined, \n            /*modifiers*/ undefined, \n            /*asteriskToken*/ undefined, ts.getDeclarationName(node), \n            /*typeParameters*/ undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), \n            /*type*/ undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), \n            /*location*/ constructor || node);\n            if (extendsClauseElement) {\n                ts.setEmitFlags(constructorFunction, 8 /* CapturesThis */);\n            }\n            statements.push(constructorFunction);\n        }\n        /**\n         * Transforms the parameters of the constructor declaration of a class.\n         *\n         * @param constructor The constructor for the class.\n         * @param hasSynthesizedSuper A value indicating whether the constructor starts with a\n         *                            synthesized `super` call.\n         */\n        function transformConstructorParameters(constructor, hasSynthesizedSuper) {\n            // If the TypeScript transformer needed to synthesize a constructor for property\n            // initializers, it would have also added a synthetic `...args` parameter and\n            // `super` call.\n            // If this is the case, we do not include the synthetic `...args` parameter and\n            // will instead use the `arguments` object in ES5/3.\n            return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context)\n                || [];\n        }\n        /**\n         * Transforms the body of a constructor declaration of a class.\n         *\n         * @param constructor The constructor for the class.\n         * @param node The node which contains the constructor.\n         * @param extendsClauseElement The expression for the class `extends` clause.\n         * @param hasSynthesizedSuper A value indicating whether the constructor starts with a\n         *                            synthesized `super` call.\n         */\n        function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {\n            var statements = [];\n            resumeLexicalEnvironment();\n            var statementOffset = -1;\n            if (hasSynthesizedSuper) {\n                // If a super call has already been synthesized,\n                // we're going to assume that we should just transform everything after that.\n                // The assumption is that no prior step in the pipeline has added any prologue directives.\n                statementOffset = 0;\n            }\n            else if (constructor) {\n                // Otherwise, try to emit all potential prologue directives first.\n                statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, /*ensureUseStrict*/ false, visitor);\n            }\n            if (constructor) {\n                addDefaultValueAssignmentsIfNeeded(statements, constructor);\n                addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);\n                ts.Debug.assert(statementOffset >= 0, \"statementOffset not initialized correctly!\");\n            }\n            var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset);\n            // The last statement expression was replaced. Skip it.\n            if (superCaptureStatus === 1 /* ReplaceSuperCapture */ || superCaptureStatus === 2 /* ReplaceWithReturn */) {\n                statementOffset++;\n            }\n            if (constructor) {\n                var body = saveStateAndInvoke(constructor, function (constructor) {\n                    isInConstructorWithCapturedSuper = superCaptureStatus === 1 /* ReplaceSuperCapture */;\n                    return ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, /*start*/ statementOffset);\n                });\n                ts.addRange(statements, body);\n            }\n            // Return `_this` unless we're sure enough that it would be pointless to add a return statement.\n            // If there's a constructor that we can tell returns in enough places, then we *do not* want to add a return.\n            if (extendsClauseElement\n                && superCaptureStatus !== 2 /* ReplaceWithReturn */\n                && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) {\n                statements.push(ts.createReturn(ts.createIdentifier(\"_this\")));\n            }\n            ts.addRange(statements, endLexicalEnvironment());\n            var block = ts.createBlock(ts.createNodeArray(statements, \n            /*location*/ constructor ? constructor.body.statements : node.members), \n            /*location*/ constructor ? constructor.body : node, \n            /*multiLine*/ true);\n            if (!constructor) {\n                ts.setEmitFlags(block, 1536 /* NoComments */);\n            }\n            return block;\n        }\n        /**\n         * We want to try to avoid emitting a return statement in certain cases if a user already returned something.\n         * It would generate obviously dead code, so we'll try to make things a little bit prettier\n         * by doing a minimal check on whether some common patterns always explicitly return.\n         */\n        function isSufficientlyCoveredByReturnStatements(statement) {\n            // A return statement is considered covered.\n            if (statement.kind === 216 /* ReturnStatement */) {\n                return true;\n            }\n            else if (statement.kind === 208 /* IfStatement */) {\n                var ifStatement = statement;\n                if (ifStatement.elseStatement) {\n                    return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) &&\n                        isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement);\n                }\n            }\n            else if (statement.kind === 204 /* Block */) {\n                var lastStatement = ts.lastOrUndefined(statement.statements);\n                if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        /**\n         * Declares a `_this` variable for derived classes and for when arrow functions capture `this`.\n         *\n         * @returns The new statement offset into the `statements` array.\n         */\n        function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) {\n            // If this isn't a derived class, just capture 'this' for arrow functions if necessary.\n            if (!hasExtendsClause) {\n                if (ctor) {\n                    addCaptureThisForNodeIfNeeded(statements, ctor);\n                }\n                return 0 /* NoReplacement */;\n            }\n            // We must be here because the user didn't write a constructor\n            // but we needed to call 'super(...args)' anyway as per 14.5.14 of the ES2016 spec.\n            // If that's the case we can just immediately return the result of a 'super()' call.\n            if (!ctor) {\n                statements.push(ts.createReturn(createDefaultSuperCallOrThis()));\n                return 2 /* ReplaceWithReturn */;\n            }\n            // The constructor exists, but it and the 'super()' call it contains were generated\n            // for something like property initializers.\n            // Create a captured '_this' variable and assume it will subsequently be used.\n            if (hasSynthesizedSuper) {\n                captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());\n                enableSubstitutionsForCapturedThis();\n                return 1 /* ReplaceSuperCapture */;\n            }\n            // Most of the time, a 'super' call will be the first real statement in a constructor body.\n            // In these cases, we'd like to transform these into a *single* statement instead of a declaration\n            // followed by an assignment statement for '_this'. For instance, if we emitted without an initializer,\n            // we'd get:\n            //\n            //      var _this;\n            //      _this = _super.call(...) || this;\n            //\n            // instead of\n            //\n            //      var _this = _super.call(...) || this;\n            //\n            // Additionally, if the 'super()' call is the last statement, we should just avoid capturing\n            // entirely and immediately return the result like so:\n            //\n            //      return _super.call(...) || this;\n            //\n            var firstStatement;\n            var superCallExpression;\n            var ctorStatements = ctor.body.statements;\n            if (statementOffset < ctorStatements.length) {\n                firstStatement = ctorStatements[statementOffset];\n                if (firstStatement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) {\n                    var superCall = firstStatement.expression;\n                    superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall);\n                }\n            }\n            // Return the result if we have an immediate super() call on the last statement.\n            if (superCallExpression && statementOffset === ctorStatements.length - 1) {\n                var returnStatement = ts.createReturn(superCallExpression);\n                if (superCallExpression.kind !== 192 /* BinaryExpression */\n                    || superCallExpression.left.kind !== 179 /* CallExpression */) {\n                    ts.Debug.fail(\"Assumed generated super call would have form 'super.call(...) || this'.\");\n                }\n                // Shift comments from the original super call to the return statement.\n                ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536 /* NoComments */)));\n                statements.push(returnStatement);\n                return 2 /* ReplaceWithReturn */;\n            }\n            // Perform the capture.\n            captureThisForNode(statements, ctor, superCallExpression, firstStatement);\n            // If we're actually replacing the original statement, we need to signal this to the caller.\n            if (superCallExpression) {\n                return 1 /* ReplaceSuperCapture */;\n            }\n            return 0 /* NoReplacement */;\n        }\n        function createDefaultSuperCallOrThis() {\n            var actualThis = ts.createThis();\n            ts.setEmitFlags(actualThis, 4 /* NoSubstitution */);\n            var superCall = ts.createFunctionApply(ts.createIdentifier(\"_super\"), actualThis, ts.createIdentifier(\"arguments\"));\n            return ts.createLogicalOr(superCall, actualThis);\n        }\n        /**\n         * Visits a parameter declaration.\n         *\n         * @param node A ParameterDeclaration node.\n         */\n        function visitParameter(node) {\n            if (node.dotDotDotToken) {\n                // rest parameters are elided\n                return undefined;\n            }\n            else if (ts.isBindingPattern(node.name)) {\n                // Binding patterns are converted into a generated name and are\n                // evaluated inside the function body.\n                return ts.setOriginalNode(ts.createParameter(\n                /*decorators*/ undefined, \n                /*modifiers*/ undefined, \n                /*dotDotDotToken*/ undefined, ts.getGeneratedNameForNode(node), \n                /*questionToken*/ undefined, \n                /*type*/ undefined, \n                /*initializer*/ undefined, \n                /*location*/ node), \n                /*original*/ node);\n            }\n            else if (node.initializer) {\n                // Initializers are elided\n                return ts.setOriginalNode(ts.createParameter(\n                /*decorators*/ undefined, \n                /*modifiers*/ undefined, \n                /*dotDotDotToken*/ undefined, node.name, \n                /*questionToken*/ undefined, \n                /*type*/ undefined, \n                /*initializer*/ undefined, \n                /*location*/ node), \n                /*original*/ node);\n            }\n            else {\n                return node;\n            }\n        }\n        /**\n         * Gets a value indicating whether we need to add default value assignments for a\n         * function-like node.\n         *\n         * @param node A function-like node.\n         */\n        function shouldAddDefaultValueAssignments(node) {\n            return (node.transformFlags & 131072 /* ContainsDefaultValueAssignments */) !== 0;\n        }\n        /**\n         * Adds statements to the body of a function-like node if it contains parameters with\n         * binding patterns or initializers.\n         *\n         * @param statements The statements for the new function body.\n         * @param node A function-like node.\n         */\n        function addDefaultValueAssignmentsIfNeeded(statements, node) {\n            if (!shouldAddDefaultValueAssignments(node)) {\n                return;\n            }\n            for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {\n                var parameter = _a[_i];\n                var name_36 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;\n                // A rest parameter cannot have a binding pattern or an initializer,\n                // so let's just ignore it.\n                if (dotDotDotToken) {\n                    continue;\n                }\n                if (ts.isBindingPattern(name_36)) {\n                    addDefaultValueAssignmentForBindingPattern(statements, parameter, name_36, initializer);\n                }\n                else if (initializer) {\n                    addDefaultValueAssignmentForInitializer(statements, parameter, name_36, initializer);\n                }\n            }\n        }\n        /**\n         * Adds statements to the body of a function-like node for parameters with binding patterns\n         *\n         * @param statements The statements for the new function body.\n         * @param parameter The parameter for the function.\n         * @param name The name of the parameter.\n         * @param initializer The initializer for the parameter.\n         */\n        function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) {\n            var temp = ts.getGeneratedNameForNode(parameter);\n            // In cases where a binding pattern is simply '[]' or '{}',\n            // we usually don't want to emit a var declaration; however, in the presence\n            // of an initializer, we must emit that expression to preserve side effects.\n            if (name.elements.length > 0) {\n                statements.push(ts.setEmitFlags(ts.createVariableStatement(\n                /*modifiers*/ undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0 /* All */, temp))), 524288 /* CustomPrologue */));\n            }\n            else if (initializer) {\n                statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 524288 /* CustomPrologue */));\n            }\n        }\n        /**\n         * Adds statements to the body of a function-like node for parameters with initializers.\n         *\n         * @param statements The statements for the new function body.\n         * @param parameter The parameter for the function.\n         * @param name The name of the parameter.\n         * @param initializer The initializer for the parameter.\n         */\n        function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) {\n            initializer = ts.visitNode(initializer, visitor, ts.isExpression);\n            var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), \"undefined\"), ts.setEmitFlags(ts.createBlock([\n                ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48 /* NoSourceMap */), ts.setEmitFlags(initializer, 48 /* NoSourceMap */ | ts.getEmitFlags(initializer)), \n                /*location*/ parameter))\n            ], /*location*/ parameter), 1 /* SingleLine */ | 32 /* NoTrailingSourceMap */ | 384 /* NoTokenSourceMaps */), \n            /*elseStatement*/ undefined, \n            /*location*/ parameter);\n            statement.startsOnNewLine = true;\n            ts.setEmitFlags(statement, 384 /* NoTokenSourceMaps */ | 32 /* NoTrailingSourceMap */ | 524288 /* CustomPrologue */);\n            statements.push(statement);\n        }\n        /**\n         * Gets a value indicating whether we need to add statements to handle a rest parameter.\n         *\n         * @param node A ParameterDeclaration node.\n         * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is\n         *                                          part of a constructor declaration with a\n         *                                          synthesized call to `super`\n         */\n        function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {\n            return node && node.dotDotDotToken && node.name.kind === 70 /* Identifier */ && !inConstructorWithSynthesizedSuper;\n        }\n        /**\n         * Adds statements to the body of a function-like node if it contains a rest parameter.\n         *\n         * @param statements The statements for the new function body.\n         * @param node A function-like node.\n         * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is\n         *                                          part of a constructor declaration with a\n         *                                          synthesized call to `super`\n         */\n        function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {\n            var parameter = ts.lastOrUndefined(node.parameters);\n            if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {\n                return;\n            }\n            // `declarationName` is the name of the local declaration for the parameter.\n            var declarationName = ts.getMutableClone(parameter.name);\n            ts.setEmitFlags(declarationName, 48 /* NoSourceMap */);\n            // `expressionName` is the name of the parameter used in expressions.\n            var expressionName = ts.getSynthesizedClone(parameter.name);\n            var restIndex = node.parameters.length - 1;\n            var temp = ts.createLoopVariable();\n            // var param = [];\n            statements.push(ts.setEmitFlags(ts.createVariableStatement(\n            /*modifiers*/ undefined, ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(declarationName, \n                /*type*/ undefined, ts.createArrayLiteral([]))\n            ]), \n            /*location*/ parameter), 524288 /* CustomPrologue */));\n            // for (var _i = restIndex; _i < arguments.length; _i++) {\n            //   param[_i - restIndex] = arguments[_i];\n            // }\n            var forStatement = ts.createFor(ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(temp, /*type*/ undefined, ts.createLiteral(restIndex))\n            ], /*location*/ parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier(\"arguments\"), \"length\"), \n            /*location*/ parameter), ts.createPostfixIncrement(temp, /*location*/ parameter), ts.createBlock([\n                ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0\n                    ? temp\n                    : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier(\"arguments\"), temp)), \n                /*location*/ parameter))\n            ]));\n            ts.setEmitFlags(forStatement, 524288 /* CustomPrologue */);\n            ts.startOnNewLine(forStatement);\n            statements.push(forStatement);\n        }\n        /**\n         * Adds a statement to capture the `this` of a function declaration if it is needed.\n         *\n         * @param statements The statements for the new function body.\n         * @param node A node.\n         */\n        function addCaptureThisForNodeIfNeeded(statements, node) {\n            if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 185 /* ArrowFunction */) {\n                captureThisForNode(statements, node, ts.createThis());\n            }\n        }\n        function captureThisForNode(statements, node, initializer, originalStatement) {\n            enableSubstitutionsForCapturedThis();\n            var captureThisStatement = ts.createVariableStatement(\n            /*modifiers*/ undefined, ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(\"_this\", \n                /*type*/ undefined, initializer)\n            ]), originalStatement);\n            ts.setEmitFlags(captureThisStatement, 1536 /* NoComments */ | 524288 /* CustomPrologue */);\n            ts.setSourceMapRange(captureThisStatement, node);\n            statements.push(captureThisStatement);\n        }\n        /**\n         * Adds statements to the class body function for a class to define the members of the\n         * class.\n         *\n         * @param statements The statements for the class body function.\n         * @param node The ClassExpression or ClassDeclaration node.\n         */\n        function addClassMembers(statements, node) {\n            for (var _i = 0, _a = node.members; _i < _a.length; _i++) {\n                var member = _a[_i];\n                switch (member.kind) {\n                    case 203 /* SemicolonClassElement */:\n                        statements.push(transformSemicolonClassElementToStatement(member));\n                        break;\n                    case 149 /* MethodDeclaration */:\n                        statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member));\n                        break;\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                        var accessors = ts.getAllAccessorDeclarations(node.members, member);\n                        if (member === accessors.firstAccessor) {\n                            statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors));\n                        }\n                        break;\n                    case 150 /* Constructor */:\n                        // Constructors are handled in visitClassExpression/visitClassDeclaration\n                        break;\n                    default:\n                        ts.Debug.failBadSyntaxKind(node);\n                        break;\n                }\n            }\n        }\n        /**\n         * Transforms a SemicolonClassElement into a statement for a class body function.\n         *\n         * @param member The SemicolonClassElement node.\n         */\n        function transformSemicolonClassElementToStatement(member) {\n            return ts.createEmptyStatement(/*location*/ member);\n        }\n        /**\n         * Transforms a MethodDeclaration into a statement for a class body function.\n         *\n         * @param receiver The receiver for the member.\n         * @param member The MethodDeclaration node.\n         */\n        function transformClassMethodDeclarationToStatement(receiver, member) {\n            var commentRange = ts.getCommentRange(member);\n            var sourceMapRange = ts.getSourceMapRange(member);\n            var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), /*location*/ member.name);\n            var memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined);\n            ts.setEmitFlags(memberFunction, 1536 /* NoComments */);\n            ts.setSourceMapRange(memberFunction, sourceMapRange);\n            var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), \n            /*location*/ member);\n            ts.setOriginalNode(statement, member);\n            ts.setCommentRange(statement, commentRange);\n            // The location for the statement is used to emit comments only.\n            // No source map should be emitted for this statement to align with the\n            // old emitter.\n            ts.setEmitFlags(statement, 48 /* NoSourceMap */);\n            return statement;\n        }\n        /**\n         * Transforms a set of related of get/set accessors into a statement for a class body function.\n         *\n         * @param receiver The receiver for the member.\n         * @param accessors The set of related get/set accessors.\n         */\n        function transformAccessorsToStatement(receiver, accessors) {\n            var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, /*startsOnNewLine*/ false), \n            /*location*/ ts.getSourceMapRange(accessors.firstAccessor));\n            // The location for the statement is used to emit source maps only.\n            // No comments should be emitted for this statement to align with the\n            // old emitter.\n            ts.setEmitFlags(statement, 1536 /* NoComments */);\n            return statement;\n        }\n        /**\n         * Transforms a set of related get/set accessors into an expression for either a class\n         * body function or an ObjectLiteralExpression with computed properties.\n         *\n         * @param receiver The receiver for the member.\n         */\n        function transformAccessorsToExpression(receiver, _a, startsOnNewLine) {\n            var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;\n            // To align with source maps in the old emitter, the receiver and property name\n            // arguments are both mapped contiguously to the accessor name.\n            var target = ts.getMutableClone(receiver);\n            ts.setEmitFlags(target, 1536 /* NoComments */ | 32 /* NoTrailingSourceMap */);\n            ts.setSourceMapRange(target, firstAccessor.name);\n            var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName));\n            ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 16 /* NoLeadingSourceMap */);\n            ts.setSourceMapRange(propertyName, firstAccessor.name);\n            var properties = [];\n            if (getAccessor) {\n                var getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined);\n                ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor));\n                ts.setEmitFlags(getterFunction, 512 /* NoLeadingComments */);\n                var getter = ts.createPropertyAssignment(\"get\", getterFunction);\n                ts.setCommentRange(getter, ts.getCommentRange(getAccessor));\n                properties.push(getter);\n            }\n            if (setAccessor) {\n                var setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined);\n                ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor));\n                ts.setEmitFlags(setterFunction, 512 /* NoLeadingComments */);\n                var setter = ts.createPropertyAssignment(\"set\", setterFunction);\n                ts.setCommentRange(setter, ts.getCommentRange(setAccessor));\n                properties.push(setter);\n            }\n            properties.push(ts.createPropertyAssignment(\"enumerable\", ts.createLiteral(true)), ts.createPropertyAssignment(\"configurable\", ts.createLiteral(true)));\n            var call = ts.createCall(ts.createPropertyAccess(ts.createIdentifier(\"Object\"), \"defineProperty\"), \n            /*typeArguments*/ undefined, [\n                target,\n                propertyName,\n                ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true)\n            ]);\n            if (startsOnNewLine) {\n                call.startsOnNewLine = true;\n            }\n            return call;\n        }\n        /**\n         * Visits an ArrowFunction and transforms it into a FunctionExpression.\n         *\n         * @param node An ArrowFunction node.\n         */\n        function visitArrowFunction(node) {\n            if (node.transformFlags & 16384 /* ContainsLexicalThis */) {\n                enableSubstitutionsForCapturedThis();\n            }\n            var func = ts.createFunctionExpression(\n            /*modifiers*/ undefined, \n            /*asteriskToken*/ undefined, \n            /*name*/ undefined, \n            /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, transformFunctionBody(node), node);\n            ts.setOriginalNode(func, node);\n            ts.setEmitFlags(func, 8 /* CapturesThis */);\n            return func;\n        }\n        /**\n         * Visits a FunctionExpression node.\n         *\n         * @param node a FunctionExpression node.\n         */\n        function visitFunctionExpression(node) {\n            return ts.updateFunctionExpression(node, \n            /*modifiers*/ undefined, node.name, \n            /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, node.transformFlags & 64 /* ES2015 */\n                ? transformFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        /**\n         * Visits a FunctionDeclaration node.\n         *\n         * @param node a FunctionDeclaration node.\n         */\n        function visitFunctionDeclaration(node) {\n            return ts.updateFunctionDeclaration(node, \n            /*decorators*/ undefined, node.modifiers, node.name, \n            /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, node.transformFlags & 64 /* ES2015 */\n                ? transformFunctionBody(node)\n                : ts.visitFunctionBody(node.body, visitor, context));\n        }\n        /**\n         * Transforms a function-like node into a FunctionExpression.\n         *\n         * @param node The function-like node to transform.\n         * @param location The source-map location for the new FunctionExpression.\n         * @param name The name of the new FunctionExpression.\n         */\n        function transformFunctionLikeToExpression(node, location, name) {\n            var savedContainingNonArrowFunction = enclosingNonArrowFunction;\n            if (node.kind !== 185 /* ArrowFunction */) {\n                enclosingNonArrowFunction = node;\n            }\n            var expression = ts.setOriginalNode(ts.createFunctionExpression(\n            /*modifiers*/ undefined, node.asteriskToken, name, \n            /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n            /*type*/ undefined, saveStateAndInvoke(node, transformFunctionBody), location), \n            /*original*/ node);\n            enclosingNonArrowFunction = savedContainingNonArrowFunction;\n            return expression;\n        }\n        /**\n         * Transforms the body of a function-like node.\n         *\n         * @param node A function-like node.\n         */\n        function transformFunctionBody(node) {\n            var multiLine = false; // indicates whether the block *must* be emitted as multiple lines\n            var singleLine = false; // indicates whether the block *may* be emitted as a single line\n            var statementsLocation;\n            var closeBraceLocation;\n            var statements = [];\n            var body = node.body;\n            var statementOffset;\n            resumeLexicalEnvironment();\n            if (ts.isBlock(body)) {\n                // ensureUseStrict is false because no new prologue-directive should be added.\n                // addPrologueDirectives will simply put already-existing directives at the beginning of the target statement-array\n                statementOffset = ts.addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor);\n            }\n            addCaptureThisForNodeIfNeeded(statements, node);\n            addDefaultValueAssignmentsIfNeeded(statements, node);\n            addRestParameterIfNeeded(statements, node, /*inConstructorWithSynthesizedSuper*/ false);\n            // If we added any generated statements, this must be a multi-line block.\n            if (!multiLine && statements.length > 0) {\n                multiLine = true;\n            }\n            if (ts.isBlock(body)) {\n                statementsLocation = body.statements;\n                ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));\n                // If the original body was a multi-line block, this must be a multi-line block.\n                if (!multiLine && body.multiLine) {\n                    multiLine = true;\n                }\n            }\n            else {\n                ts.Debug.assert(node.kind === 185 /* ArrowFunction */);\n                // To align with the old emitter, we use a synthetic end position on the location\n                // for the statement list we synthesize when we down-level an arrow function with\n                // an expression function body. This prevents both comments and source maps from\n                // being emitted for the end position only.\n                statementsLocation = ts.moveRangeEnd(body, -1);\n                var equalsGreaterThanToken = node.equalsGreaterThanToken;\n                if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {\n                    if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {\n                        singleLine = true;\n                    }\n                    else {\n                        multiLine = true;\n                    }\n                }\n                var expression = ts.visitNode(body, visitor, ts.isExpression);\n                var returnStatement = ts.createReturn(expression, /*location*/ body);\n                ts.setEmitFlags(returnStatement, 384 /* NoTokenSourceMaps */ | 32 /* NoTrailingSourceMap */ | 1024 /* NoTrailingComments */);\n                statements.push(returnStatement);\n                // To align with the source map emit for the old emitter, we set a custom\n                // source map location for the close brace.\n                closeBraceLocation = body;\n            }\n            var lexicalEnvironment = context.endLexicalEnvironment();\n            ts.addRange(statements, lexicalEnvironment);\n            // If we added any final generated statements, this must be a multi-line block\n            if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {\n                multiLine = true;\n            }\n            var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine);\n            if (!multiLine && singleLine) {\n                ts.setEmitFlags(block, 1 /* SingleLine */);\n            }\n            if (closeBraceLocation) {\n                ts.setTokenSourceMapRange(block, 17 /* CloseBraceToken */, closeBraceLocation);\n            }\n            ts.setOriginalNode(block, node.body);\n            return block;\n        }\n        /**\n         * Visits an ExpressionStatement that contains a destructuring assignment.\n         *\n         * @param node An ExpressionStatement node.\n         */\n        function visitExpressionStatement(node) {\n            // If we are here it is most likely because our expression is a destructuring assignment.\n            switch (node.expression.kind) {\n                case 183 /* ParenthesizedExpression */:\n                    return ts.updateStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false));\n                case 192 /* BinaryExpression */:\n                    return ts.updateStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false));\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        /**\n         * Visits a ParenthesizedExpression that may contain a destructuring assignment.\n         *\n         * @param node A ParenthesizedExpression node.\n         * @param needsDestructuringValue A value indicating whether we need to hold onto the rhs\n         *                                of a destructuring assignment.\n         */\n        function visitParenthesizedExpression(node, needsDestructuringValue) {\n            // If we are here it is most likely because our expression is a destructuring assignment.\n            if (!needsDestructuringValue) {\n                switch (node.expression.kind) {\n                    case 183 /* ParenthesizedExpression */:\n                        return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false));\n                    case 192 /* BinaryExpression */:\n                        return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false));\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        /**\n         * Visits a BinaryExpression that contains a destructuring assignment.\n         *\n         * @param node A BinaryExpression node.\n         * @param needsDestructuringValue A value indicating whether we need to hold onto the rhs\n         *                                of a destructuring assignment.\n         */\n        function visitBinaryExpression(node, needsDestructuringValue) {\n            // If we are here it is because this is a destructuring assignment.\n            if (ts.isDestructuringAssignment(node)) {\n                return ts.flattenDestructuringAssignment(node, visitor, context, 0 /* All */, needsDestructuringValue);\n            }\n        }\n        function visitVariableStatement(node) {\n            if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */) == 0) {\n                // we are inside a converted loop - hoist variable declarations\n                var assignments = void 0;\n                for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    hoistVariableDeclarationDeclaredInConvertedLoop(convertedLoopState, decl);\n                    if (decl.initializer) {\n                        var assignment = void 0;\n                        if (ts.isBindingPattern(decl.name)) {\n                            assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0 /* All */);\n                        }\n                        else {\n                            assignment = ts.createBinary(decl.name, 57 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression));\n                        }\n                        (assignments || (assignments = [])).push(assignment);\n                    }\n                }\n                if (assignments) {\n                    return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25 /* CommaToken */, acc); }), node);\n                }\n                else {\n                    // none of declarations has initializer - the entire variable statement can be deleted\n                    return undefined;\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        /**\n         * Visits a VariableDeclarationList that is block scoped (e.g. `let` or `const`).\n         *\n         * @param node A VariableDeclarationList node.\n         */\n        function visitVariableDeclarationList(node) {\n            if (node.flags & 3 /* BlockScoped */) {\n                enableSubstitutionsForBlockScopedBindings();\n            }\n            var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 /* Let */\n                ? visitVariableDeclarationInLetDeclarationList\n                : visitVariableDeclaration));\n            var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ node);\n            ts.setOriginalNode(declarationList, node);\n            ts.setCommentRange(declarationList, node);\n            if (node.transformFlags & 8388608 /* ContainsBindingPattern */\n                && (ts.isBindingPattern(node.declarations[0].name)\n                    || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) {\n                // If the first or last declaration is a binding pattern, we need to modify\n                // the source map range for the declaration list.\n                var firstDeclaration = ts.firstOrUndefined(declarations);\n                var lastDeclaration = ts.lastOrUndefined(declarations);\n                ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));\n            }\n            return declarationList;\n        }\n        /**\n         * Gets a value indicating whether we should emit an explicit initializer for a variable\n         * declaration in a `let` declaration list.\n         *\n         * @param node A VariableDeclaration node.\n         */\n        function shouldEmitExplicitInitializerForLetDeclaration(node) {\n            // Nested let bindings might need to be initialized explicitly to preserve\n            // ES6 semantic:\n            //\n            //  { let x = 1; }\n            //  { let x; } // x here should be undefined. not 1\n            //\n            // Top level bindings never collide with anything and thus don't require\n            // explicit initialization. As for nested let bindings there are two cases:\n            //\n            // - Nested let bindings that were not renamed definitely should be\n            //   initialized explicitly:\n            //\n            //    { let x = 1; }\n            //    { let x; if (some-condition) { x = 1}; if (x) { /*1*/ } }\n            //\n            //   Without explicit initialization code in /*1*/ can be executed even if\n            //   some-condition is evaluated to false.\n            //\n            // - Renaming introduces fresh name that should not collide with any\n            //   existing names, however renamed bindings sometimes also should be\n            //   explicitly initialized. One particular case: non-captured binding\n            //   declared inside loop body (but not in loop initializer):\n            //\n            //    let x;\n            //    for (;;) {\n            //        let x;\n            //    }\n            //\n            //   In downlevel codegen inner 'x' will be renamed so it won't collide\n            //   with outer 'x' however it will should be reset on every iteration as\n            //   if it was declared anew.\n            //\n            //   * Why non-captured binding?\n            //     - Because if loop contains block scoped binding captured in some\n            //       function then loop body will be rewritten to have a fresh scope\n            //       on every iteration so everything will just work.\n            //\n            //   * Why loop initializer is excluded?\n            //     - Since we've introduced a fresh name it already will be undefined.\n            var flags = resolver.getNodeCheckFlags(node);\n            var isCapturedInFunction = flags & 131072 /* CapturedBlockScopedBinding */;\n            var isDeclaredInLoop = flags & 262144 /* BlockScopedBindingInLoop */;\n            var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(enclosingBlockScopeContainer)\n                || (isCapturedInFunction\n                    && isDeclaredInLoop\n                    && ts.isBlock(enclosingBlockScopeContainer)\n                    && ts.isIterationStatement(enclosingBlockScopeContainerParent, /*lookInLabeledStatements*/ false));\n            var emitExplicitInitializer = !emittedAsTopLevel\n                && enclosingBlockScopeContainer.kind !== 212 /* ForInStatement */\n                && enclosingBlockScopeContainer.kind !== 213 /* ForOfStatement */\n                && (!resolver.isDeclarationWithCollidingName(node)\n                    || (isDeclaredInLoop\n                        && !isCapturedInFunction\n                        && !ts.isIterationStatement(enclosingBlockScopeContainer, /*lookInLabeledStatements*/ false)));\n            return emitExplicitInitializer;\n        }\n        /**\n         * Visits a VariableDeclaration in a `let` declaration list.\n         *\n         * @param node A VariableDeclaration node.\n         */\n        function visitVariableDeclarationInLetDeclarationList(node) {\n            // For binding pattern names that lack initializers there is no point to emit\n            // explicit initializer since downlevel codegen for destructuring will fail\n            // in the absence of initializer so all binding elements will say uninitialized\n            var name = node.name;\n            if (ts.isBindingPattern(name)) {\n                return visitVariableDeclaration(node);\n            }\n            if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) {\n                var clone_3 = ts.getMutableClone(node);\n                clone_3.initializer = ts.createVoidZero();\n                return clone_3;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        /**\n         * Visits a VariableDeclaration node with a binding pattern.\n         *\n         * @param node A VariableDeclaration node.\n         */\n        function visitVariableDeclaration(node) {\n            // If we are here it is because the name contains a binding pattern.\n            if (ts.isBindingPattern(node.name)) {\n                var hoistTempVariables = enclosingVariableStatement\n                    && ts.hasModifier(enclosingVariableStatement, 1 /* Export */);\n                return ts.flattenDestructuringBinding(node, visitor, context, 0 /* All */, \n                /*value*/ undefined, hoistTempVariables);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitLabeledStatement(node) {\n            if (convertedLoopState) {\n                if (!convertedLoopState.labels) {\n                    convertedLoopState.labels = ts.createMap();\n                }\n                convertedLoopState.labels[node.label.text] = node.label.text;\n            }\n            var result;\n            if (ts.isIterationStatement(node.statement, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node.statement)) {\n                result = ts.visitNodes(ts.createNodeArray([node.statement]), visitor, ts.isStatement);\n            }\n            else {\n                result = ts.visitEachChild(node, visitor, context);\n            }\n            if (convertedLoopState) {\n                convertedLoopState.labels[node.label.text] = undefined;\n            }\n            return result;\n        }\n        function visitDoStatement(node) {\n            return convertIterationStatementBodyIfNecessary(node);\n        }\n        function visitWhileStatement(node) {\n            return convertIterationStatementBodyIfNecessary(node);\n        }\n        function visitForStatement(node) {\n            return convertIterationStatementBodyIfNecessary(node);\n        }\n        function visitForInStatement(node) {\n            return convertIterationStatementBodyIfNecessary(node);\n        }\n        /**\n         * Visits a ForOfStatement and converts it into a compatible ForStatement.\n         *\n         * @param node A ForOfStatement.\n         */\n        function visitForOfStatement(node) {\n            return convertIterationStatementBodyIfNecessary(node, convertForOfToFor);\n        }\n        function convertForOfToFor(node, convertedLoopBodyStatements) {\n            // The following ES6 code:\n            //\n            //    for (let v of expr) { }\n            //\n            // should be emitted as\n            //\n            //    for (var _i = 0, _a = expr; _i < _a.length; _i++) {\n            //        var v = _a[_i];\n            //    }\n            //\n            // where _a and _i are temps emitted to capture the RHS and the counter,\n            // respectively.\n            // When the left hand side is an expression instead of a let declaration,\n            // the \"let v\" is not emitted.\n            // When the left hand side is a let/const, the v is renamed if there is\n            // another v in scope.\n            // Note that all assignments to the LHS are emitted in the body, including\n            // all destructuring.\n            // Note also that because an extra statement is needed to assign to the LHS,\n            // for-of bodies are always emitted as blocks.\n            var expression = ts.visitNode(node.expression, visitor, ts.isExpression);\n            var initializer = node.initializer;\n            var statements = [];\n            // In the case where the user wrote an identifier as the RHS, like this:\n            //\n            //     for (let v of arr) { }\n            //\n            // we don't want to emit a temporary variable for the RHS, just use it directly.\n            var counter = ts.createLoopVariable();\n            var rhsReference = expression.kind === 70 /* Identifier */\n                ? ts.createUniqueName(expression.text)\n                : ts.createTempVariable(/*recordTempVariable*/ undefined);\n            var elementAccess = ts.createElementAccess(rhsReference, counter);\n            // Initialize LHS\n            // var v = _a[_i];\n            if (ts.isVariableDeclarationList(initializer)) {\n                if (initializer.flags & 3 /* BlockScoped */) {\n                    enableSubstitutionsForBlockScopedBindings();\n                }\n                var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);\n                if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {\n                    // This works whether the declaration is a var, let, or const.\n                    // It will use rhsIterationValue _a[_i] as the initializer.\n                    var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0 /* All */, elementAccess);\n                    var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ initializer);\n                    ts.setOriginalNode(declarationList, initializer);\n                    // Adjust the source map range for the first declaration to align with the old\n                    // emitter.\n                    var firstDeclaration = declarations[0];\n                    var lastDeclaration = ts.lastOrUndefined(declarations);\n                    ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));\n                    statements.push(ts.createVariableStatement(\n                    /*modifiers*/ undefined, declarationList));\n                }\n                else {\n                    // The following call does not include the initializer, so we have\n                    // to emit it separately.\n                    statements.push(ts.createVariableStatement(\n                    /*modifiers*/ undefined, ts.setOriginalNode(ts.createVariableDeclarationList([\n                        ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(/*recordTempVariable*/ undefined), \n                        /*type*/ undefined, ts.createElementAccess(rhsReference, counter))\n                    ], /*location*/ ts.moveRangePos(initializer, -1)), initializer), \n                    /*location*/ ts.moveRangeEnd(initializer, -1)));\n                }\n            }\n            else {\n                // Initializer is an expression. Emit the expression in the body, so that it's\n                // evaluated on every iteration.\n                var assignment = ts.createAssignment(initializer, elementAccess);\n                if (ts.isDestructuringAssignment(assignment)) {\n                    // This is a destructuring pattern, so we flatten the destructuring instead.\n                    statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0 /* All */)));\n                }\n                else {\n                    // Currently there is not way to check that assignment is binary expression of destructing assignment\n                    // so we have to cast never type to binaryExpression\n                    assignment.end = initializer.end;\n                    statements.push(ts.createStatement(assignment, /*location*/ ts.moveRangeEnd(initializer, -1)));\n                }\n            }\n            var bodyLocation;\n            var statementsLocation;\n            if (convertedLoopBodyStatements) {\n                ts.addRange(statements, convertedLoopBodyStatements);\n            }\n            else {\n                var statement = ts.visitNode(node.statement, visitor, ts.isStatement);\n                if (ts.isBlock(statement)) {\n                    ts.addRange(statements, statement.statements);\n                    bodyLocation = statement;\n                    statementsLocation = statement.statements;\n                }\n                else {\n                    statements.push(statement);\n                }\n            }\n            // The old emitter does not emit source maps for the expression\n            ts.setEmitFlags(expression, 48 /* NoSourceMap */ | ts.getEmitFlags(expression));\n            // The old emitter does not emit source maps for the block.\n            // We add the location to preserve comments.\n            var body = ts.createBlock(ts.createNodeArray(statements, /*location*/ statementsLocation), \n            /*location*/ bodyLocation);\n            ts.setEmitFlags(body, 48 /* NoSourceMap */ | 384 /* NoTokenSourceMaps */);\n            var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(counter, /*type*/ undefined, ts.createLiteral(0), /*location*/ ts.moveRangePos(node.expression, -1)),\n                ts.createVariableDeclaration(rhsReference, /*type*/ undefined, expression, /*location*/ node.expression)\n            ], /*location*/ node.expression), 1048576 /* NoHoisting */), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, \"length\"), \n            /*location*/ node.expression), ts.createPostfixIncrement(counter, /*location*/ node.expression), body, \n            /*location*/ node);\n            // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter.\n            ts.setEmitFlags(forStatement, 256 /* NoTokenTrailingSourceMaps */);\n            return forStatement;\n        }\n        /**\n         * Visits an ObjectLiteralExpression with computed propety names.\n         *\n         * @param node An ObjectLiteralExpression node.\n         */\n        function visitObjectLiteralExpression(node) {\n            // We are here because a ComputedPropertyName was used somewhere in the expression.\n            var properties = node.properties;\n            var numProperties = properties.length;\n            // Find the first computed property.\n            // Everything until that point can be emitted as part of the initial object literal.\n            var numInitialProperties = numProperties;\n            for (var i = 0; i < numProperties; i++) {\n                var property = properties[i];\n                if (property.transformFlags & 16777216 /* ContainsYield */\n                    || property.name.kind === 142 /* ComputedPropertyName */) {\n                    numInitialProperties = i;\n                    break;\n                }\n            }\n            ts.Debug.assert(numInitialProperties !== numProperties);\n            // For computed properties, we need to create a unique handle to the object\n            // literal so we can modify it without risking internal assignments tainting the object.\n            var temp = ts.createTempVariable(hoistVariableDeclaration);\n            // Write out the first non-computed properties, then emit the rest through indexing on the temp variable.\n            var expressions = [];\n            var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), \n            /*location*/ undefined, node.multiLine), 32768 /* Indented */));\n            if (node.multiLine) {\n                assignment.startsOnNewLine = true;\n            }\n            expressions.push(assignment);\n            addObjectLiteralMembers(expressions, node, temp, numInitialProperties);\n            // We need to clone the temporary identifier so that we can write it on a\n            // new line\n            expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp);\n            return ts.inlineExpressions(expressions);\n        }\n        function shouldConvertIterationStatementBody(node) {\n            return (resolver.getNodeCheckFlags(node) & 65536 /* LoopWithCapturedBlockScopedBinding */) !== 0;\n        }\n        /**\n         * Records constituents of name for the given variable to be hoisted in the outer scope.\n         */\n        function hoistVariableDeclarationDeclaredInConvertedLoop(state, node) {\n            if (!state.hoistedLocalVariables) {\n                state.hoistedLocalVariables = [];\n            }\n            visit(node.name);\n            function visit(node) {\n                if (node.kind === 70 /* Identifier */) {\n                    state.hoistedLocalVariables.push(node);\n                }\n                else {\n                    for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {\n                        var element = _a[_i];\n                        if (!ts.isOmittedExpression(element)) {\n                            visit(element.name);\n                        }\n                    }\n                }\n            }\n        }\n        function convertIterationStatementBodyIfNecessary(node, convert) {\n            if (!shouldConvertIterationStatementBody(node)) {\n                var saveAllowedNonLabeledJumps = void 0;\n                if (convertedLoopState) {\n                    // we get here if we are trying to emit normal loop loop inside converted loop\n                    // set allowedNonLabeledJumps to Break | Continue to mark that break\\continue inside the loop should be emitted as is\n                    saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps;\n                    convertedLoopState.allowedNonLabeledJumps = 2 /* Break */ | 4 /* Continue */;\n                }\n                var result = convert ? convert(node, /*convertedLoopBodyStatements*/ undefined) : ts.visitEachChild(node, visitor, context);\n                if (convertedLoopState) {\n                    convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps;\n                }\n                return result;\n            }\n            var functionName = ts.createUniqueName(\"_loop\");\n            var loopInitializer;\n            switch (node.kind) {\n                case 211 /* ForStatement */:\n                case 212 /* ForInStatement */:\n                case 213 /* ForOfStatement */:\n                    var initializer = node.initializer;\n                    if (initializer && initializer.kind === 224 /* VariableDeclarationList */) {\n                        loopInitializer = initializer;\n                    }\n                    break;\n            }\n            // variables that will be passed to the loop as parameters\n            var loopParameters = [];\n            // variables declared in the loop initializer that will be changed inside the loop\n            var loopOutParameters = [];\n            if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 3 /* BlockScoped */)) {\n                for (var _i = 0, _a = loopInitializer.declarations; _i < _a.length; _i++) {\n                    var decl = _a[_i];\n                    processLoopVariableDeclaration(decl, loopParameters, loopOutParameters);\n                }\n            }\n            var outerConvertedLoopState = convertedLoopState;\n            convertedLoopState = { loopOutParameters: loopOutParameters };\n            if (outerConvertedLoopState) {\n                // convertedOuterLoopState !== undefined means that this converted loop is nested in another converted loop.\n                // if outer converted loop has already accumulated some state - pass it through\n                if (outerConvertedLoopState.argumentsName) {\n                    // outer loop has already used 'arguments' so we've already have some name to alias it\n                    // use the same name in all nested loops\n                    convertedLoopState.argumentsName = outerConvertedLoopState.argumentsName;\n                }\n                if (outerConvertedLoopState.thisName) {\n                    // outer loop has already used 'this' so we've already have some name to alias it\n                    // use the same name in all nested loops\n                    convertedLoopState.thisName = outerConvertedLoopState.thisName;\n                }\n                if (outerConvertedLoopState.hoistedLocalVariables) {\n                    // we've already collected some non-block scoped variable declarations in enclosing loop\n                    // use the same storage in nested loop\n                    convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables;\n                }\n            }\n            var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement);\n            var currentState = convertedLoopState;\n            convertedLoopState = outerConvertedLoopState;\n            if (loopOutParameters.length) {\n                var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody];\n                copyOutParameters(loopOutParameters, 1 /* ToOutParameter */, statements_4);\n                loopBody = ts.createBlock(statements_4, /*location*/ undefined, /*multiline*/ true);\n            }\n            if (!ts.isBlock(loopBody)) {\n                loopBody = ts.createBlock([loopBody], /*location*/ undefined, /*multiline*/ true);\n            }\n            var isAsyncBlockContainingAwait = enclosingNonArrowFunction\n                && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072 /* AsyncFunctionBody */) !== 0\n                && (node.statement.transformFlags & 16777216 /* ContainsYield */) !== 0;\n            var loopBodyFlags = 0;\n            if (currentState.containsLexicalThis) {\n                loopBodyFlags |= 8 /* CapturesThis */;\n            }\n            if (isAsyncBlockContainingAwait) {\n                loopBodyFlags |= 131072 /* AsyncFunctionBody */;\n            }\n            var convertedLoopVariable = ts.createVariableStatement(\n            /*modifiers*/ undefined, ts.setEmitFlags(ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(functionName, \n                /*type*/ undefined, ts.setEmitFlags(ts.createFunctionExpression(\n                /*modifiers*/ undefined, isAsyncBlockContainingAwait ? ts.createToken(38 /* AsteriskToken */) : undefined, \n                /*name*/ undefined, \n                /*typeParameters*/ undefined, loopParameters, \n                /*type*/ undefined, loopBody), loopBodyFlags))\n            ]), 1048576 /* NoHoisting */));\n            var statements = [convertedLoopVariable];\n            var extraVariableDeclarations;\n            // propagate state from the inner loop to the outer loop if necessary\n            if (currentState.argumentsName) {\n                // if alias for arguments is set\n                if (outerConvertedLoopState) {\n                    // pass it to outer converted loop\n                    outerConvertedLoopState.argumentsName = currentState.argumentsName;\n                }\n                else {\n                    // this is top level converted loop and we need to create an alias for 'arguments' object\n                    (extraVariableDeclarations || (extraVariableDeclarations = [])).push(ts.createVariableDeclaration(currentState.argumentsName, \n                    /*type*/ undefined, ts.createIdentifier(\"arguments\")));\n                }\n            }\n            if (currentState.thisName) {\n                // if alias for this is set\n                if (outerConvertedLoopState) {\n                    // pass it to outer converted loop\n                    outerConvertedLoopState.thisName = currentState.thisName;\n                }\n                else {\n                    // this is top level converted loop so we need to create an alias for 'this' here\n                    // NOTE:\n                    // if converted loops were all nested in arrow function then we'll always emit '_this' so convertedLoopState.thisName will not be set.\n                    // If it is set this means that all nested loops are not nested in arrow function and it is safe to capture 'this'.\n                    (extraVariableDeclarations || (extraVariableDeclarations = [])).push(ts.createVariableDeclaration(currentState.thisName, \n                    /*type*/ undefined, ts.createIdentifier(\"this\")));\n                }\n            }\n            if (currentState.hoistedLocalVariables) {\n                // if hoistedLocalVariables !== undefined this means that we've possibly collected some variable declarations to be hoisted later\n                if (outerConvertedLoopState) {\n                    // pass them to outer converted loop\n                    outerConvertedLoopState.hoistedLocalVariables = currentState.hoistedLocalVariables;\n                }\n                else {\n                    if (!extraVariableDeclarations) {\n                        extraVariableDeclarations = [];\n                    }\n                    // hoist collected variable declarations\n                    for (var _b = 0, _c = currentState.hoistedLocalVariables; _b < _c.length; _b++) {\n                        var identifier = _c[_b];\n                        extraVariableDeclarations.push(ts.createVariableDeclaration(identifier));\n                    }\n                }\n            }\n            // add extra variables to hold out parameters if necessary\n            if (loopOutParameters.length) {\n                if (!extraVariableDeclarations) {\n                    extraVariableDeclarations = [];\n                }\n                for (var _d = 0, loopOutParameters_1 = loopOutParameters; _d < loopOutParameters_1.length; _d++) {\n                    var outParam = loopOutParameters_1[_d];\n                    extraVariableDeclarations.push(ts.createVariableDeclaration(outParam.outParamName));\n                }\n            }\n            // create variable statement to hold all introduced variable declarations\n            if (extraVariableDeclarations) {\n                statements.push(ts.createVariableStatement(\n                /*modifiers*/ undefined, ts.createVariableDeclarationList(extraVariableDeclarations)));\n            }\n            var convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait);\n            var loop;\n            if (convert) {\n                loop = convert(node, convertedLoopBodyStatements);\n            }\n            else {\n                loop = ts.getMutableClone(node);\n                // clean statement part\n                loop.statement = undefined;\n                // visit childnodes to transform initializer/condition/incrementor parts\n                loop = ts.visitEachChild(loop, visitor, context);\n                // set loop statement\n                loop.statement = ts.createBlock(convertedLoopBodyStatements, \n                /*location*/ undefined, \n                /*multiline*/ true);\n                // reset and re-aggregate the transform flags\n                loop.transformFlags = 0;\n                ts.aggregateTransformFlags(loop);\n            }\n            statements.push(currentParent.kind === 219 /* LabeledStatement */\n                ? ts.createLabel(currentParent.label, loop)\n                : loop);\n            return statements;\n        }\n        function copyOutParameter(outParam, copyDirection) {\n            var source = copyDirection === 0 /* ToOriginal */ ? outParam.outParamName : outParam.originalName;\n            var target = copyDirection === 0 /* ToOriginal */ ? outParam.originalName : outParam.outParamName;\n            return ts.createBinary(target, 57 /* EqualsToken */, source);\n        }\n        function copyOutParameters(outParams, copyDirection, statements) {\n            for (var _i = 0, outParams_1 = outParams; _i < outParams_1.length; _i++) {\n                var outParam = outParams_1[_i];\n                statements.push(ts.createStatement(copyOutParameter(outParam, copyDirection)));\n            }\n        }\n        function generateCallToConvertedLoop(loopFunctionExpressionName, parameters, state, isAsyncBlockContainingAwait) {\n            var outerConvertedLoopState = convertedLoopState;\n            var statements = [];\n            // loop is considered simple if it does not have any return statements or break\\continue that transfer control outside of the loop\n            // simple loops are emitted as just 'loop()';\n            // NOTE: if loop uses only 'continue' it still will be emitted as simple loop\n            var isSimpleLoop = !(state.nonLocalJumps & ~4 /* Continue */) &&\n                !state.labeledNonLocalBreaks &&\n                !state.labeledNonLocalContinues;\n            var call = ts.createCall(loopFunctionExpressionName, /*typeArguments*/ undefined, ts.map(parameters, function (p) { return p.name; }));\n            var callResult = isAsyncBlockContainingAwait ? ts.createYield(ts.createToken(38 /* AsteriskToken */), call) : call;\n            if (isSimpleLoop) {\n                statements.push(ts.createStatement(callResult));\n                copyOutParameters(state.loopOutParameters, 0 /* ToOriginal */, statements);\n            }\n            else {\n                var loopResultName = ts.createUniqueName(\"state\");\n                var stateVariable = ts.createVariableStatement(\n                /*modifiers*/ undefined, ts.createVariableDeclarationList([ts.createVariableDeclaration(loopResultName, /*type*/ undefined, callResult)]));\n                statements.push(stateVariable);\n                copyOutParameters(state.loopOutParameters, 0 /* ToOriginal */, statements);\n                if (state.nonLocalJumps & 8 /* Return */) {\n                    var returnStatement = void 0;\n                    if (outerConvertedLoopState) {\n                        outerConvertedLoopState.nonLocalJumps |= 8 /* Return */;\n                        returnStatement = ts.createReturn(loopResultName);\n                    }\n                    else {\n                        returnStatement = ts.createReturn(ts.createPropertyAccess(loopResultName, \"value\"));\n                    }\n                    statements.push(ts.createIf(ts.createBinary(ts.createTypeOf(loopResultName), 33 /* EqualsEqualsEqualsToken */, ts.createLiteral(\"object\")), returnStatement));\n                }\n                if (state.nonLocalJumps & 2 /* Break */) {\n                    statements.push(ts.createIf(ts.createBinary(loopResultName, 33 /* EqualsEqualsEqualsToken */, ts.createLiteral(\"break\")), ts.createBreak()));\n                }\n                if (state.labeledNonLocalBreaks || state.labeledNonLocalContinues) {\n                    var caseClauses = [];\n                    processLabeledJumps(state.labeledNonLocalBreaks, /*isBreak*/ true, loopResultName, outerConvertedLoopState, caseClauses);\n                    processLabeledJumps(state.labeledNonLocalContinues, /*isBreak*/ false, loopResultName, outerConvertedLoopState, caseClauses);\n                    statements.push(ts.createSwitch(loopResultName, ts.createCaseBlock(caseClauses)));\n                }\n            }\n            return statements;\n        }\n        function setLabeledJump(state, isBreak, labelText, labelMarker) {\n            if (isBreak) {\n                if (!state.labeledNonLocalBreaks) {\n                    state.labeledNonLocalBreaks = ts.createMap();\n                }\n                state.labeledNonLocalBreaks[labelText] = labelMarker;\n            }\n            else {\n                if (!state.labeledNonLocalContinues) {\n                    state.labeledNonLocalContinues = ts.createMap();\n                }\n                state.labeledNonLocalContinues[labelText] = labelMarker;\n            }\n        }\n        function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) {\n            if (!table) {\n                return;\n            }\n            for (var labelText in table) {\n                var labelMarker = table[labelText];\n                var statements = [];\n                // if there are no outer converted loop or outer label in question is located inside outer converted loop\n                // then emit labeled break\\continue\n                // otherwise propagate pair 'label -> marker' to outer converted loop and emit 'return labelMarker' so outer loop can later decide what to do\n                if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) {\n                    var label = ts.createIdentifier(labelText);\n                    statements.push(isBreak ? ts.createBreak(label) : ts.createContinue(label));\n                }\n                else {\n                    setLabeledJump(outerLoop, isBreak, labelText, labelMarker);\n                    statements.push(ts.createReturn(loopResultName));\n                }\n                caseClauses.push(ts.createCaseClause(ts.createLiteral(labelMarker), statements));\n            }\n        }\n        function processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) {\n            var name = decl.name;\n            if (ts.isBindingPattern(name)) {\n                for (var _i = 0, _a = name.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        processLoopVariableDeclaration(element, loopParameters, loopOutParameters);\n                    }\n                }\n            }\n            else {\n                loopParameters.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, name));\n                if (resolver.getNodeCheckFlags(decl) & 2097152 /* NeedsLoopOutParameter */) {\n                    var outParamName = ts.createUniqueName(\"out_\" + name.text);\n                    loopOutParameters.push({ originalName: name, outParamName: outParamName });\n                }\n            }\n        }\n        /**\n         * Adds the members of an object literal to an array of expressions.\n         *\n         * @param expressions An array of expressions.\n         * @param node An ObjectLiteralExpression node.\n         * @param receiver The receiver for members of the ObjectLiteralExpression.\n         * @param numInitialNonComputedProperties The number of initial properties without\n         *                                        computed property names.\n         */\n        function addObjectLiteralMembers(expressions, node, receiver, start) {\n            var properties = node.properties;\n            var numProperties = properties.length;\n            for (var i = start; i < numProperties; i++) {\n                var property = properties[i];\n                switch (property.kind) {\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                        var accessors = ts.getAllAccessorDeclarations(node.properties, property);\n                        if (property === accessors.firstAccessor) {\n                            expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine));\n                        }\n                        break;\n                    case 257 /* PropertyAssignment */:\n                        expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine));\n                        break;\n                    case 258 /* ShorthandPropertyAssignment */:\n                        expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine));\n                        break;\n                    case 149 /* MethodDeclaration */:\n                        expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine));\n                        break;\n                    default:\n                        ts.Debug.failBadSyntaxKind(node);\n                        break;\n                }\n            }\n        }\n        /**\n         * Transforms a PropertyAssignment node into an expression.\n         *\n         * @param node The ObjectLiteralExpression that contains the PropertyAssignment.\n         * @param property The PropertyAssignment node.\n         * @param receiver The receiver for the assignment.\n         */\n        function transformPropertyAssignmentToExpression(property, receiver, startsOnNewLine) {\n            var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression), \n            /*location*/ property);\n            if (startsOnNewLine) {\n                expression.startsOnNewLine = true;\n            }\n            return expression;\n        }\n        /**\n         * Transforms a ShorthandPropertyAssignment node into an expression.\n         *\n         * @param node The ObjectLiteralExpression that contains the ShorthandPropertyAssignment.\n         * @param property The ShorthandPropertyAssignment node.\n         * @param receiver The receiver for the assignment.\n         */\n        function transformShorthandPropertyAssignmentToExpression(property, receiver, startsOnNewLine) {\n            var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name), \n            /*location*/ property);\n            if (startsOnNewLine) {\n                expression.startsOnNewLine = true;\n            }\n            return expression;\n        }\n        /**\n         * Transforms a MethodDeclaration of an ObjectLiteralExpression into an expression.\n         *\n         * @param node The ObjectLiteralExpression that contains the MethodDeclaration.\n         * @param method The MethodDeclaration node.\n         * @param receiver The receiver for the assignment.\n         */\n        function transformObjectLiteralMethodDeclarationToExpression(method, receiver, startsOnNewLine) {\n            var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, /*location*/ method, /*name*/ undefined), \n            /*location*/ method);\n            if (startsOnNewLine) {\n                expression.startsOnNewLine = true;\n            }\n            return expression;\n        }\n        function visitCatchClause(node) {\n            ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name));\n            var temp = ts.createTempVariable(undefined);\n            var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration);\n            var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0 /* All */, temp);\n            var list = ts.createVariableDeclarationList(vars, /*location*/ node.variableDeclaration, /*flags*/ node.variableDeclaration.flags);\n            var destructure = ts.createVariableStatement(undefined, list);\n            return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure));\n        }\n        function addStatementToStartOfBlock(block, statement) {\n            var transformedStatements = ts.visitNodes(block.statements, visitor, ts.isStatement);\n            return ts.updateBlock(block, [statement].concat(transformedStatements));\n        }\n        /**\n         * Visits a MethodDeclaration of an ObjectLiteralExpression and transforms it into a\n         * PropertyAssignment.\n         *\n         * @param node A MethodDeclaration node.\n         */\n        function visitMethodDeclaration(node) {\n            // We should only get here for methods on an object literal with regular identifier names.\n            // Methods on classes are handled in visitClassDeclaration/visitClassExpression.\n            // Methods with computed property names are handled in visitObjectLiteralExpression.\n            ts.Debug.assert(!ts.isComputedPropertyName(node.name));\n            var functionExpression = transformFunctionLikeToExpression(node, /*location*/ ts.moveRangePos(node, -1), /*name*/ undefined);\n            ts.setEmitFlags(functionExpression, 512 /* NoLeadingComments */ | ts.getEmitFlags(functionExpression));\n            return ts.createPropertyAssignment(node.name, functionExpression, \n            /*location*/ node);\n        }\n        /**\n         * Visits a ShorthandPropertyAssignment and transforms it into a PropertyAssignment.\n         *\n         * @param node A ShorthandPropertyAssignment node.\n         */\n        function visitShorthandPropertyAssignment(node) {\n            return ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name), \n            /*location*/ node);\n        }\n        /**\n         * Visits a YieldExpression node.\n         *\n         * @param node A YieldExpression node.\n         */\n        function visitYieldExpression(node) {\n            // `yield` expressions are transformed using the generators transformer.\n            return ts.visitEachChild(node, visitor, context);\n        }\n        /**\n         * Visits an ArrayLiteralExpression that contains a spread element.\n         *\n         * @param node An ArrayLiteralExpression node.\n         */\n        function visitArrayLiteralExpression(node) {\n            // We are here because we contain a SpreadElementExpression.\n            return transformAndSpreadElements(node.elements, /*needsUniqueCopy*/ true, node.multiLine, /*hasTrailingComma*/ node.elements.hasTrailingComma);\n        }\n        /**\n         * Visits a CallExpression that contains either a spread element or `super`.\n         *\n         * @param node a CallExpression.\n         */\n        function visitCallExpression(node) {\n            return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true);\n        }\n        function visitImmediateSuperCallInBody(node) {\n            return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ false);\n        }\n        function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) {\n            // We are here either because SuperKeyword was used somewhere in the expression, or\n            // because we contain a SpreadElementExpression.\n            var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;\n            if (node.expression.kind === 96 /* SuperKeyword */) {\n                ts.setEmitFlags(thisArg, 4 /* NoSubstitution */);\n            }\n            var resultingCall;\n            if (node.transformFlags & 524288 /* ContainsSpread */) {\n                // [source]\n                //      f(...a, b)\n                //      x.m(...a, b)\n                //      super(...a, b)\n                //      super.m(...a, b) // in static\n                //      super.m(...a, b) // in instance\n                //\n                // [output]\n                //      f.apply(void 0, a.concat([b]))\n                //      (_a = x).m.apply(_a, a.concat([b]))\n                //      _super.apply(this, a.concat([b]))\n                //      _super.m.apply(this, a.concat([b]))\n                //      _super.prototype.m.apply(this, a.concat([b]))\n                resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false));\n            }\n            else {\n                // [source]\n                //      super(a)\n                //      super.m(a) // in static\n                //      super.m(a) // in instance\n                //\n                // [output]\n                //      _super.call(this, a)\n                //      _super.m.call(this, a)\n                //      _super.prototype.m.call(this, a)\n                resultingCall = ts.createFunctionCall(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), \n                /*location*/ node);\n            }\n            if (node.expression.kind === 96 /* SuperKeyword */) {\n                var actualThis = ts.createThis();\n                ts.setEmitFlags(actualThis, 4 /* NoSubstitution */);\n                var initializer = ts.createLogicalOr(resultingCall, actualThis);\n                return assignToCapturedThis\n                    ? ts.createAssignment(ts.createIdentifier(\"_this\"), initializer)\n                    : initializer;\n            }\n            return resultingCall;\n        }\n        /**\n         * Visits a NewExpression that contains a spread element.\n         *\n         * @param node A NewExpression node.\n         */\n        function visitNewExpression(node) {\n            // We are here because we contain a SpreadElementExpression.\n            ts.Debug.assert((node.transformFlags & 524288 /* ContainsSpread */) !== 0);\n            // [source]\n            //      new C(...a)\n            //\n            // [output]\n            //      new ((_a = C).bind.apply(_a, [void 0].concat(a)))()\n            var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, \"bind\"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;\n            return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)), \n            /*typeArguments*/ undefined, []);\n        }\n        /**\n         * Transforms an array of Expression nodes that contains a SpreadExpression.\n         *\n         * @param elements The array of Expression nodes.\n         * @param needsUniqueCopy A value indicating whether to ensure that the result is a fresh array.\n         * @param multiLine A value indicating whether the result should be emitted on multiple lines.\n         */\n        function transformAndSpreadElements(elements, needsUniqueCopy, multiLine, hasTrailingComma) {\n            // [source]\n            //      [a, ...b, c]\n            //\n            // [output]\n            //      [a].concat(b, [c])\n            // Map spans of spread expressions into their expressions and spans of other\n            // expressions into an array literal.\n            var numElements = elements.length;\n            var segments = ts.flatten(ts.spanMap(elements, partitionSpread, function (partition, visitPartition, _start, end) {\n                return visitPartition(partition, multiLine, hasTrailingComma && end === numElements);\n            }));\n            if (segments.length === 1) {\n                var firstElement = elements[0];\n                return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 175 /* ArrayLiteralExpression */\n                    ? ts.createArraySlice(segments[0])\n                    : segments[0];\n            }\n            // Rewrite using the pattern <segment0>.concat(<segment1>, <segment2>, ...)\n            return ts.createArrayConcat(segments.shift(), segments);\n        }\n        function partitionSpread(node) {\n            return ts.isSpreadExpression(node)\n                ? visitSpanOfSpreads\n                : visitSpanOfNonSpreads;\n        }\n        function visitSpanOfSpreads(chunk) {\n            return ts.map(chunk, visitExpressionOfSpread);\n        }\n        function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) {\n            return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, /*location*/ undefined, hasTrailingComma), visitor, ts.isExpression), \n            /*location*/ undefined, multiLine);\n        }\n        function visitSpreadElement(node) {\n            return ts.visitNode(node.expression, visitor, ts.isExpression);\n        }\n        /**\n         * Transforms the expression of a SpreadExpression node.\n         *\n         * @param node A SpreadExpression node.\n         */\n        function visitExpressionOfSpread(node) {\n            return ts.visitNode(node.expression, visitor, ts.isExpression);\n        }\n        /**\n         * Visits a template literal.\n         *\n         * @param node A template literal.\n         */\n        function visitTemplateLiteral(node) {\n            return ts.createLiteral(node.text, /*location*/ node);\n        }\n        /**\n         * Visits a TaggedTemplateExpression node.\n         *\n         * @param node A TaggedTemplateExpression node.\n         */\n        function visitTaggedTemplateExpression(node) {\n            // Visit the tag expression\n            var tag = ts.visitNode(node.tag, visitor, ts.isExpression);\n            // Allocate storage for the template site object\n            var temp = ts.createTempVariable(hoistVariableDeclaration);\n            // Build up the template arguments and the raw and cooked strings for the template.\n            var templateArguments = [temp];\n            var cookedStrings = [];\n            var rawStrings = [];\n            var template = node.template;\n            if (ts.isNoSubstitutionTemplateLiteral(template)) {\n                cookedStrings.push(ts.createLiteral(template.text));\n                rawStrings.push(getRawLiteral(template));\n            }\n            else {\n                cookedStrings.push(ts.createLiteral(template.head.text));\n                rawStrings.push(getRawLiteral(template.head));\n                for (var _i = 0, _a = template.templateSpans; _i < _a.length; _i++) {\n                    var templateSpan = _a[_i];\n                    cookedStrings.push(ts.createLiteral(templateSpan.literal.text));\n                    rawStrings.push(getRawLiteral(templateSpan.literal));\n                    templateArguments.push(ts.visitNode(templateSpan.expression, visitor, ts.isExpression));\n                }\n            }\n            // NOTE: The parentheses here is entirely optional as we are now able to auto-\n            //       parenthesize when rebuilding the tree. This should be removed in a\n            //       future version. It is here for now to match our existing emit.\n            return ts.createParen(ts.inlineExpressions([\n                ts.createAssignment(temp, ts.createArrayLiteral(cookedStrings)),\n                ts.createAssignment(ts.createPropertyAccess(temp, \"raw\"), ts.createArrayLiteral(rawStrings)),\n                ts.createCall(tag, /*typeArguments*/ undefined, templateArguments)\n            ]));\n        }\n        /**\n         * Creates an ES5 compatible literal from an ES6 template literal.\n         *\n         * @param node The ES6 template literal.\n         */\n        function getRawLiteral(node) {\n            // Find original source text, since we need to emit the raw strings of the tagged template.\n            // The raw strings contain the (escaped) strings of what the user wrote.\n            // Examples: `\\n` is converted to \"\\\\n\", a template string with a newline to \"\\n\".\n            var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);\n            // text contains the original source, it will also contain quotes (\"`\"), dolar signs and braces (\"${\" and \"}\"),\n            // thus we need to remove those characters.\n            // First template piece starts with \"`\", others with \"}\"\n            // Last template piece ends with \"`\", others with \"${\"\n            var isLast = node.kind === 12 /* NoSubstitutionTemplateLiteral */ || node.kind === 15 /* TemplateTail */;\n            text = text.substring(1, text.length - (isLast ? 1 : 2));\n            // Newline normalization:\n            // ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's\n            // <CR><LF> and <CR> LineTerminatorSequences are normalized to <LF> for both TV and TRV.\n            text = text.replace(/\\r\\n?/g, \"\\n\");\n            return ts.createLiteral(text, /*location*/ node);\n        }\n        /**\n         * Visits a TemplateExpression node.\n         *\n         * @param node A TemplateExpression node.\n         */\n        function visitTemplateExpression(node) {\n            var expressions = [];\n            addTemplateHead(expressions, node);\n            addTemplateSpans(expressions, node);\n            // createAdd will check if each expression binds less closely than binary '+'.\n            // If it does, it wraps the expression in parentheses. Otherwise, something like\n            //    `abc${ 1 << 2 }`\n            // becomes\n            //    \"abc\" + 1 << 2 + \"\"\n            // which is really\n            //    (\"abc\" + 1) << (2 + \"\")\n            // rather than\n            //    \"abc\" + (1 << 2) + \"\"\n            var expression = ts.reduceLeft(expressions, ts.createAdd);\n            if (ts.nodeIsSynthesized(expression)) {\n                ts.setTextRange(expression, node);\n            }\n            return expression;\n        }\n        /**\n         * Gets a value indicating whether we need to include the head of a TemplateExpression.\n         *\n         * @param node A TemplateExpression node.\n         */\n        function shouldAddTemplateHead(node) {\n            // If this expression has an empty head literal and the first template span has a non-empty\n            // literal, then emitting the empty head literal is not necessary.\n            //     `${ foo } and ${ bar }`\n            // can be emitted as\n            //     foo + \" and \" + bar\n            // This is because it is only required that one of the first two operands in the emit\n            // output must be a string literal, so that the other operand and all following operands\n            // are forced into strings.\n            //\n            // If the first template span has an empty literal, then the head must still be emitted.\n            //     `${ foo }${ bar }`\n            // must still be emitted as\n            //     \"\" + foo + bar\n            // There is always atleast one templateSpan in this code path, since\n            // NoSubstitutionTemplateLiterals are directly emitted via emitLiteral()\n            ts.Debug.assert(node.templateSpans.length !== 0);\n            return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0;\n        }\n        /**\n         * Adds the head of a TemplateExpression to an array of expressions.\n         *\n         * @param expressions An array of expressions.\n         * @param node A TemplateExpression node.\n         */\n        function addTemplateHead(expressions, node) {\n            if (!shouldAddTemplateHead(node)) {\n                return;\n            }\n            expressions.push(ts.createLiteral(node.head.text));\n        }\n        /**\n         * Visits and adds the template spans of a TemplateExpression to an array of expressions.\n         *\n         * @param expressions An array of expressions.\n         * @param node A TemplateExpression node.\n         */\n        function addTemplateSpans(expressions, node) {\n            for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) {\n                var span_6 = _a[_i];\n                expressions.push(ts.visitNode(span_6.expression, visitor, ts.isExpression));\n                // Only emit if the literal is non-empty.\n                // The binary '+' operator is left-associative, so the first string concatenation\n                // with the head will force the result up to this point to be a string.\n                // Emitting a '+ \"\"' has no semantic effect for middles and tails.\n                if (span_6.literal.text.length !== 0) {\n                    expressions.push(ts.createLiteral(span_6.literal.text));\n                }\n            }\n        }\n        /**\n         * Visits the `super` keyword\n         */\n        function visitSuperKeyword() {\n            return enclosingNonAsyncFunctionBody\n                && ts.isClassElement(enclosingNonAsyncFunctionBody)\n                && !ts.hasModifier(enclosingNonAsyncFunctionBody, 32 /* Static */)\n                && currentParent.kind !== 179 /* CallExpression */\n                ? ts.createPropertyAccess(ts.createIdentifier(\"_super\"), \"prototype\")\n                : ts.createIdentifier(\"_super\");\n        }\n        /**\n         * Called by the printer just before a node is printed.\n         *\n         * @param node The node to be printed.\n         */\n        function onEmitNode(emitContext, node, emitCallback) {\n            var savedEnclosingFunction = enclosingFunction;\n            if (enabledSubstitutions & 1 /* CapturedThis */ && ts.isFunctionLike(node)) {\n                // If we are tracking a captured `this`, keep track of the enclosing function.\n                enclosingFunction = node;\n            }\n            previousOnEmitNode(emitContext, node, emitCallback);\n            enclosingFunction = savedEnclosingFunction;\n        }\n        /**\n         * Enables a more costly code path for substitutions when we determine a source file\n         * contains block-scoped bindings (e.g. `let` or `const`).\n         */\n        function enableSubstitutionsForBlockScopedBindings() {\n            if ((enabledSubstitutions & 2 /* BlockScopedBindings */) === 0) {\n                enabledSubstitutions |= 2 /* BlockScopedBindings */;\n                context.enableSubstitution(70 /* Identifier */);\n            }\n        }\n        /**\n         * Enables a more costly code path for substitutions when we determine a source file\n         * contains a captured `this`.\n         */\n        function enableSubstitutionsForCapturedThis() {\n            if ((enabledSubstitutions & 1 /* CapturedThis */) === 0) {\n                enabledSubstitutions |= 1 /* CapturedThis */;\n                context.enableSubstitution(98 /* ThisKeyword */);\n                context.enableEmitNotification(150 /* Constructor */);\n                context.enableEmitNotification(149 /* MethodDeclaration */);\n                context.enableEmitNotification(151 /* GetAccessor */);\n                context.enableEmitNotification(152 /* SetAccessor */);\n                context.enableEmitNotification(185 /* ArrowFunction */);\n                context.enableEmitNotification(184 /* FunctionExpression */);\n                context.enableEmitNotification(225 /* FunctionDeclaration */);\n            }\n        }\n        /**\n         * Hooks node substitutions.\n         *\n         * @param emitContext The context for the emitter.\n         * @param node The node to substitute.\n         */\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (emitContext === 1 /* Expression */) {\n                return substituteExpression(node);\n            }\n            if (ts.isIdentifier(node)) {\n                return substituteIdentifier(node);\n            }\n            return node;\n        }\n        /**\n         * Hooks substitutions for non-expression identifiers.\n         */\n        function substituteIdentifier(node) {\n            // Only substitute the identifier if we have enabled substitutions for block-scoped\n            // bindings.\n            if (enabledSubstitutions & 2 /* BlockScopedBindings */) {\n                var original = ts.getParseTreeNode(node, ts.isIdentifier);\n                if (original && isNameOfDeclarationWithCollidingName(original)) {\n                    return ts.getGeneratedNameForNode(original);\n                }\n            }\n            return node;\n        }\n        /**\n         * Determines whether a name is the name of a declaration with a colliding name.\n         * NOTE: This function expects to be called with an original source tree node.\n         *\n         * @param node An original source tree node.\n         */\n        function isNameOfDeclarationWithCollidingName(node) {\n            var parent = node.parent;\n            switch (parent.kind) {\n                case 174 /* BindingElement */:\n                case 226 /* ClassDeclaration */:\n                case 229 /* EnumDeclaration */:\n                case 223 /* VariableDeclaration */:\n                    return parent.name === node\n                        && resolver.isDeclarationWithCollidingName(parent);\n            }\n            return false;\n        }\n        /**\n         * Substitutes an expression.\n         *\n         * @param node An Expression node.\n         */\n        function substituteExpression(node) {\n            switch (node.kind) {\n                case 70 /* Identifier */:\n                    return substituteExpressionIdentifier(node);\n                case 98 /* ThisKeyword */:\n                    return substituteThisKeyword(node);\n            }\n            return node;\n        }\n        /**\n         * Substitutes an expression identifier.\n         *\n         * @param node An Identifier node.\n         */\n        function substituteExpressionIdentifier(node) {\n            if (enabledSubstitutions & 2 /* BlockScopedBindings */) {\n                var declaration = resolver.getReferencedDeclarationWithCollidingName(node);\n                if (declaration) {\n                    return ts.getGeneratedNameForNode(declaration.name);\n                }\n            }\n            return node;\n        }\n        /**\n         * Substitutes `this` when contained within an arrow function.\n         *\n         * @param node The ThisKeyword node.\n         */\n        function substituteThisKeyword(node) {\n            if (enabledSubstitutions & 1 /* CapturedThis */\n                && enclosingFunction\n                && ts.getEmitFlags(enclosingFunction) & 8 /* CapturesThis */) {\n                return ts.createIdentifier(\"_this\", /*location*/ node);\n            }\n            return node;\n        }\n        function getClassMemberPrefix(node, member) {\n            var expression = ts.getLocalName(node);\n            return ts.hasModifier(member, 32 /* Static */) ? expression : ts.createPropertyAccess(expression, \"prototype\");\n        }\n        function hasSynthesizedDefaultSuperCall(constructor, hasExtendsClause) {\n            if (!constructor || !hasExtendsClause) {\n                return false;\n            }\n            if (ts.some(constructor.parameters)) {\n                return false;\n            }\n            var statement = ts.firstOrUndefined(constructor.body.statements);\n            if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 207 /* ExpressionStatement */) {\n                return false;\n            }\n            var statementExpression = statement.expression;\n            if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 179 /* CallExpression */) {\n                return false;\n            }\n            var callTarget = statementExpression.expression;\n            if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 96 /* SuperKeyword */) {\n                return false;\n            }\n            var callArgument = ts.singleOrUndefined(statementExpression.arguments);\n            if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 196 /* SpreadElement */) {\n                return false;\n            }\n            var expression = callArgument.expression;\n            return ts.isIdentifier(expression) && expression.text === \"arguments\";\n        }\n    }\n    ts.transformES2015 = transformES2015;\n    function createExtendsHelper(context, name) {\n        context.requestEmitHelper(extendsHelper);\n        return ts.createCall(ts.getHelperName(\"__extends\"), \n        /*typeArguments*/ undefined, [\n            name,\n            ts.createIdentifier(\"_super\")\n        ]);\n    }\n    var extendsHelper = {\n        name: \"typescript:extends\",\n        scoped: false,\n        priority: 0,\n        text: \"\\n            var __extends = (this && this.__extends) || function (d, b) {\\n                for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\\n                function __() { this.constructor = d; }\\n                d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\\n            };\"\n    };\n})(ts || (ts = {}));\n/// <reference path=\"../factory.ts\" />\n/// <reference path=\"../visitor.ts\" />\n// Transforms generator functions into a compatible ES5 representation with similar runtime\n// semantics. This is accomplished by first transforming the body of each generator\n// function into an intermediate representation that is the compiled into a JavaScript\n// switch statement.\n//\n// Many functions in this transformer will contain comments indicating the expected\n// intermediate representation. For illustrative purposes, the following intermediate\n// language is used to define this intermediate representation:\n//\n//  .nop                            - Performs no operation.\n//  .local NAME, ...                - Define local variable declarations.\n//  .mark LABEL                     - Mark the location of a label.\n//  .br LABEL                       - Jump to a label. If jumping out of a protected\n//                                    region, all .finally blocks are executed.\n//  .brtrue LABEL, (x)              - Jump to a label IIF the expression `x` is truthy.\n//                                    If jumping out of a protected region, all .finally\n//                                    blocks are executed.\n//  .brfalse LABEL, (x)             - Jump to a label IIF the expression `x` is falsey.\n//                                    If jumping out of a protected region, all .finally\n//                                    blocks are executed.\n//  .yield (x)                      - Yield the value of the optional expression `x`.\n//                                    Resume at the next label.\n//  .yieldstar (x)                  - Delegate yield to the value of the optional\n//                                    expression `x`. Resume at the next label.\n//                                    NOTE: `x` must be an Iterator, not an Iterable.\n//  .loop CONTINUE, BREAK           - Marks the beginning of a loop. Any \"continue\" or\n//                                    \"break\" abrupt completions jump to the CONTINUE or\n//                                    BREAK labels, respectively.\n//  .endloop                        - Marks the end of a loop.\n//  .with (x)                       - Marks the beginning of a WithStatement block, using\n//                                    the supplied expression.\n//  .endwith                        - Marks the end of a WithStatement.\n//  .switch                         - Marks the beginning of a SwitchStatement.\n//  .endswitch                      - Marks the end of a SwitchStatement.\n//  .labeled NAME                   - Marks the beginning of a LabeledStatement with the\n//                                    supplied name.\n//  .endlabeled                     - Marks the end of a LabeledStatement.\n//  .try TRY, CATCH, FINALLY, END   - Marks the beginning of a protected region, and the\n//                                    labels for each block.\n//  .catch (x)                      - Marks the beginning of a catch block.\n//  .finally                        - Marks the beginning of a finally block.\n//  .endfinally                     - Marks the end of a finally block.\n//  .endtry                         - Marks the end of a protected region.\n//  .throw (x)                      - Throws the value of the expression `x`.\n//  .return (x)                     - Returns the value of the expression `x`.\n//\n// In addition, the illustrative intermediate representation introduces some special\n// variables:\n//\n//  %sent%                          - Either returns the next value sent to the generator,\n//                                    returns the result of a delegated yield, or throws\n//                                    the exception sent to the generator.\n//  %error%                         - Returns the value of the current exception in a\n//                                    catch block.\n//\n// This intermediate representation is then compiled into JavaScript syntax. The resulting\n// compilation output looks something like the following:\n//\n//  function f() {\n//      var /*locals*/;\n//      /*functions*/\n//      return __generator(function (state) {\n//          switch (state.label) {\n//              /*cases per label*/\n//          }\n//      });\n//  }\n//\n// Each of the above instructions corresponds to JavaScript emit similar to the following:\n//\n//  .local NAME                   | var NAME;\n// -------------------------------|----------------------------------------------\n//  .mark LABEL                   | case LABEL:\n// -------------------------------|----------------------------------------------\n//  .br LABEL                     |     return [3 /*break*/, LABEL];\n// -------------------------------|----------------------------------------------\n//  .brtrue LABEL, (x)            |     if (x) return [3 /*break*/, LABEL];\n// -------------------------------|----------------------------------------------\n//  .brfalse LABEL, (x)           |     if (!(x)) return [3, /*break*/, LABEL];\n// -------------------------------|----------------------------------------------\n//  .yield (x)                    |     return [4 /*yield*/, x];\n//  .mark RESUME                  | case RESUME:\n//      a = %sent%;               |     a = state.sent();\n// -------------------------------|----------------------------------------------\n//  .yieldstar (x)                |     return [5 /*yield**/, x];\n//  .mark RESUME                  | case RESUME:\n//      a = %sent%;               |     a = state.sent();\n// -------------------------------|----------------------------------------------\n//  .with (_a)                    |     with (_a) {\n//      a();                      |         a();\n//                                |     }\n//                                |     state.label = LABEL;\n//  .mark LABEL                   | case LABEL:\n//                                |     with (_a) {\n//      b();                      |         b();\n//                                |     }\n//  .endwith                      |\n// -------------------------------|----------------------------------------------\n//                                | case 0:\n//                                |     state.trys = [];\n//                                | ...\n//  .try TRY, CATCH, FINALLY, END |\n//  .mark TRY                     | case TRY:\n//                                |     state.trys.push([TRY, CATCH, FINALLY, END]);\n//  .nop                          |\n//      a();                      |     a();\n//  .br END                       |     return [3 /*break*/, END];\n//  .catch (e)                    |\n//  .mark CATCH                   | case CATCH:\n//                                |     e = state.sent();\n//      b();                      |     b();\n//  .br END                       |     return [3 /*break*/, END];\n//  .finally                      |\n//  .mark FINALLY                 | case FINALLY:\n//      c();                      |     c();\n//  .endfinally                   |     return [7 /*endfinally*/];\n//  .endtry                       |\n//  .mark END                     | case END:\n/*@internal*/\nvar ts;\n(function (ts) {\n    var OpCode;\n    (function (OpCode) {\n        OpCode[OpCode[\"Nop\"] = 0] = \"Nop\";\n        OpCode[OpCode[\"Statement\"] = 1] = \"Statement\";\n        OpCode[OpCode[\"Assign\"] = 2] = \"Assign\";\n        OpCode[OpCode[\"Break\"] = 3] = \"Break\";\n        OpCode[OpCode[\"BreakWhenTrue\"] = 4] = \"BreakWhenTrue\";\n        OpCode[OpCode[\"BreakWhenFalse\"] = 5] = \"BreakWhenFalse\";\n        OpCode[OpCode[\"Yield\"] = 6] = \"Yield\";\n        OpCode[OpCode[\"YieldStar\"] = 7] = \"YieldStar\";\n        OpCode[OpCode[\"Return\"] = 8] = \"Return\";\n        OpCode[OpCode[\"Throw\"] = 9] = \"Throw\";\n        OpCode[OpCode[\"Endfinally\"] = 10] = \"Endfinally\"; // Marks the end of a `finally` block\n    })(OpCode || (OpCode = {}));\n    // whether a generated code block is opening or closing at the current operation for a FunctionBuilder\n    var BlockAction;\n    (function (BlockAction) {\n        BlockAction[BlockAction[\"Open\"] = 0] = \"Open\";\n        BlockAction[BlockAction[\"Close\"] = 1] = \"Close\";\n    })(BlockAction || (BlockAction = {}));\n    // the kind for a generated code block in a FunctionBuilder\n    var CodeBlockKind;\n    (function (CodeBlockKind) {\n        CodeBlockKind[CodeBlockKind[\"Exception\"] = 0] = \"Exception\";\n        CodeBlockKind[CodeBlockKind[\"With\"] = 1] = \"With\";\n        CodeBlockKind[CodeBlockKind[\"Switch\"] = 2] = \"Switch\";\n        CodeBlockKind[CodeBlockKind[\"Loop\"] = 3] = \"Loop\";\n        CodeBlockKind[CodeBlockKind[\"Labeled\"] = 4] = \"Labeled\";\n    })(CodeBlockKind || (CodeBlockKind = {}));\n    // the state for a generated code exception block\n    var ExceptionBlockState;\n    (function (ExceptionBlockState) {\n        ExceptionBlockState[ExceptionBlockState[\"Try\"] = 0] = \"Try\";\n        ExceptionBlockState[ExceptionBlockState[\"Catch\"] = 1] = \"Catch\";\n        ExceptionBlockState[ExceptionBlockState[\"Finally\"] = 2] = \"Finally\";\n        ExceptionBlockState[ExceptionBlockState[\"Done\"] = 3] = \"Done\";\n    })(ExceptionBlockState || (ExceptionBlockState = {}));\n    // NOTE: changes to this enum should be reflected in the __generator helper.\n    var Instruction;\n    (function (Instruction) {\n        Instruction[Instruction[\"Next\"] = 0] = \"Next\";\n        Instruction[Instruction[\"Throw\"] = 1] = \"Throw\";\n        Instruction[Instruction[\"Return\"] = 2] = \"Return\";\n        Instruction[Instruction[\"Break\"] = 3] = \"Break\";\n        Instruction[Instruction[\"Yield\"] = 4] = \"Yield\";\n        Instruction[Instruction[\"YieldStar\"] = 5] = \"YieldStar\";\n        Instruction[Instruction[\"Catch\"] = 6] = \"Catch\";\n        Instruction[Instruction[\"Endfinally\"] = 7] = \"Endfinally\";\n    })(Instruction || (Instruction = {}));\n    var instructionNames = ts.createMap((_a = {},\n        _a[2 /* Return */] = \"return\",\n        _a[3 /* Break */] = \"break\",\n        _a[4 /* Yield */] = \"yield\",\n        _a[5 /* YieldStar */] = \"yield*\",\n        _a[7 /* Endfinally */] = \"endfinally\",\n        _a));\n    function transformGenerators(context) {\n        var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration;\n        var compilerOptions = context.getCompilerOptions();\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        var resolver = context.getEmitResolver();\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        context.onSubstituteNode = onSubstituteNode;\n        var currentSourceFile;\n        var renamedCatchVariables;\n        var renamedCatchVariableDeclarations;\n        var inGeneratorFunctionBody;\n        var inStatementContainingYield;\n        // The following three arrays store information about generated code blocks.\n        // All three arrays are correlated by their index. This approach is used over allocating\n        // objects to store the same information to avoid GC overhead.\n        //\n        var blocks; // Information about the code block\n        var blockOffsets; // The operation offset at which a code block begins or ends\n        var blockActions; // Whether the code block is opened or closed\n        var blockStack; // A stack of currently open code blocks\n        // Labels are used to mark locations in the code that can be the target of a Break (jump)\n        // operation. These are translated into case clauses in a switch statement.\n        // The following two arrays are correlated by their index. This approach is used over\n        // allocating objects to store the same information to avoid GC overhead.\n        //\n        var labelOffsets; // The operation offset at which the label is defined.\n        var labelExpressions; // The NumericLiteral nodes bound to each label.\n        var nextLabelId = 1; // The next label id to use.\n        // Operations store information about generated code for the function body. This\n        // Includes things like statements, assignments, breaks (jumps), and yields.\n        // The following three arrays are correlated by their index. This approach is used over\n        // allocating objects to store the same information to avoid GC overhead.\n        //\n        var operations; // The operation to perform.\n        var operationArguments; // The arguments to the operation.\n        var operationLocations; // The source map location for the operation.\n        var state; // The name of the state object used by the generator at runtime.\n        // The following variables store information used by the `build` function:\n        //\n        var blockIndex = 0; // The index of the current block.\n        var labelNumber = 0; // The current label number.\n        var labelNumbers;\n        var lastOperationWasAbrupt; // Indicates whether the last operation was abrupt (break/continue).\n        var lastOperationWasCompletion; // Indicates whether the last operation was a completion (return/throw).\n        var clauses; // The case clauses generated for labels.\n        var statements; // The statements for the current label.\n        var exceptionBlockStack; // A stack of containing exception blocks.\n        var currentExceptionBlock; // The current exception block.\n        var withBlockStack; // A stack containing `with` blocks.\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)\n                || (node.transformFlags & 512 /* ContainsGenerator */) === 0) {\n                return node;\n            }\n            currentSourceFile = node;\n            var visited = ts.visitEachChild(node, visitor, context);\n            ts.addEmitHelpers(visited, context.readEmitHelpers());\n            currentSourceFile = undefined;\n            return visited;\n        }\n        /**\n         * Visits a node.\n         *\n         * @param node The node to visit.\n         */\n        function visitor(node) {\n            var transformFlags = node.transformFlags;\n            if (inStatementContainingYield) {\n                return visitJavaScriptInStatementContainingYield(node);\n            }\n            else if (inGeneratorFunctionBody) {\n                return visitJavaScriptInGeneratorFunctionBody(node);\n            }\n            else if (transformFlags & 256 /* Generator */) {\n                return visitGenerator(node);\n            }\n            else if (transformFlags & 512 /* ContainsGenerator */) {\n                return ts.visitEachChild(node, visitor, context);\n            }\n            else {\n                return node;\n            }\n        }\n        /**\n         * Visits a node that is contained within a statement that contains yield.\n         *\n         * @param node The node to visit.\n         */\n        function visitJavaScriptInStatementContainingYield(node) {\n            switch (node.kind) {\n                case 209 /* DoStatement */:\n                    return visitDoStatement(node);\n                case 210 /* WhileStatement */:\n                    return visitWhileStatement(node);\n                case 218 /* SwitchStatement */:\n                    return visitSwitchStatement(node);\n                case 219 /* LabeledStatement */:\n                    return visitLabeledStatement(node);\n                default:\n                    return visitJavaScriptInGeneratorFunctionBody(node);\n            }\n        }\n        /**\n         * Visits a node that is contained within a generator function.\n         *\n         * @param node The node to visit.\n         */\n        function visitJavaScriptInGeneratorFunctionBody(node) {\n            switch (node.kind) {\n                case 225 /* FunctionDeclaration */:\n                    return visitFunctionDeclaration(node);\n                case 184 /* FunctionExpression */:\n                    return visitFunctionExpression(node);\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                    return visitAccessorDeclaration(node);\n                case 205 /* VariableStatement */:\n                    return visitVariableStatement(node);\n                case 211 /* ForStatement */:\n                    return visitForStatement(node);\n                case 212 /* ForInStatement */:\n                    return visitForInStatement(node);\n                case 215 /* BreakStatement */:\n                    return visitBreakStatement(node);\n                case 214 /* ContinueStatement */:\n                    return visitContinueStatement(node);\n                case 216 /* ReturnStatement */:\n                    return visitReturnStatement(node);\n                default:\n                    if (node.transformFlags & 16777216 /* ContainsYield */) {\n                        return visitJavaScriptContainingYield(node);\n                    }\n                    else if (node.transformFlags & (512 /* ContainsGenerator */ | 33554432 /* ContainsHoistedDeclarationOrCompletion */)) {\n                        return ts.visitEachChild(node, visitor, context);\n                    }\n                    else {\n                        return node;\n                    }\n            }\n        }\n        /**\n         * Visits a node that contains a YieldExpression.\n         *\n         * @param node The node to visit.\n         */\n        function visitJavaScriptContainingYield(node) {\n            switch (node.kind) {\n                case 192 /* BinaryExpression */:\n                    return visitBinaryExpression(node);\n                case 193 /* ConditionalExpression */:\n                    return visitConditionalExpression(node);\n                case 195 /* YieldExpression */:\n                    return visitYieldExpression(node);\n                case 175 /* ArrayLiteralExpression */:\n                    return visitArrayLiteralExpression(node);\n                case 176 /* ObjectLiteralExpression */:\n                    return visitObjectLiteralExpression(node);\n                case 178 /* ElementAccessExpression */:\n                    return visitElementAccessExpression(node);\n                case 179 /* CallExpression */:\n                    return visitCallExpression(node);\n                case 180 /* NewExpression */:\n                    return visitNewExpression(node);\n                default:\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        /**\n         * Visits a generator function.\n         *\n         * @param node The node to visit.\n         */\n        function visitGenerator(node) {\n            switch (node.kind) {\n                case 225 /* FunctionDeclaration */:\n                    return visitFunctionDeclaration(node);\n                case 184 /* FunctionExpression */:\n                    return visitFunctionExpression(node);\n                default:\n                    ts.Debug.failBadSyntaxKind(node);\n                    return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        /**\n         * Visits a function declaration.\n         *\n         * This will be called when one of the following conditions are met:\n         * - The function declaration is a generator function.\n         * - The function declaration is contained within the body of a generator function.\n         *\n         * @param node The node to visit.\n         */\n        function visitFunctionDeclaration(node) {\n            // Currently, we only support generators that were originally async functions.\n            if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) {\n                node = ts.setOriginalNode(ts.createFunctionDeclaration(\n                /*decorators*/ undefined, node.modifiers, \n                /*asteriskToken*/ undefined, node.name, \n                /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n                /*type*/ undefined, transformGeneratorFunctionBody(node.body), \n                /*location*/ node), node);\n            }\n            else {\n                var savedInGeneratorFunctionBody = inGeneratorFunctionBody;\n                var savedInStatementContainingYield = inStatementContainingYield;\n                inGeneratorFunctionBody = false;\n                inStatementContainingYield = false;\n                node = ts.visitEachChild(node, visitor, context);\n                inGeneratorFunctionBody = savedInGeneratorFunctionBody;\n                inStatementContainingYield = savedInStatementContainingYield;\n            }\n            if (inGeneratorFunctionBody) {\n                // Function declarations in a generator function body are hoisted\n                // to the top of the lexical scope and elided from the current statement.\n                hoistFunctionDeclaration(node);\n                return undefined;\n            }\n            else {\n                return node;\n            }\n        }\n        /**\n         * Visits a function expression.\n         *\n         * This will be called when one of the following conditions are met:\n         * - The function expression is a generator function.\n         * - The function expression is contained within the body of a generator function.\n         *\n         * @param node The node to visit.\n         */\n        function visitFunctionExpression(node) {\n            // Currently, we only support generators that were originally async functions.\n            if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) {\n                node = ts.setOriginalNode(ts.createFunctionExpression(\n                /*modifiers*/ undefined, \n                /*asteriskToken*/ undefined, node.name, \n                /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n                /*type*/ undefined, transformGeneratorFunctionBody(node.body), \n                /*location*/ node), node);\n            }\n            else {\n                var savedInGeneratorFunctionBody = inGeneratorFunctionBody;\n                var savedInStatementContainingYield = inStatementContainingYield;\n                inGeneratorFunctionBody = false;\n                inStatementContainingYield = false;\n                node = ts.visitEachChild(node, visitor, context);\n                inGeneratorFunctionBody = savedInGeneratorFunctionBody;\n                inStatementContainingYield = savedInStatementContainingYield;\n            }\n            return node;\n        }\n        /**\n         * Visits a get or set accessor declaration.\n         *\n         * This will be called when one of the following conditions are met:\n         * - The accessor is contained within the body of a generator function.\n         *\n         * @param node The node to visit.\n         */\n        function visitAccessorDeclaration(node) {\n            var savedInGeneratorFunctionBody = inGeneratorFunctionBody;\n            var savedInStatementContainingYield = inStatementContainingYield;\n            inGeneratorFunctionBody = false;\n            inStatementContainingYield = false;\n            node = ts.visitEachChild(node, visitor, context);\n            inGeneratorFunctionBody = savedInGeneratorFunctionBody;\n            inStatementContainingYield = savedInStatementContainingYield;\n            return node;\n        }\n        /**\n         * Transforms the body of a generator function declaration.\n         *\n         * @param node The function body to transform.\n         */\n        function transformGeneratorFunctionBody(body) {\n            // Save existing generator state\n            var statements = [];\n            var savedInGeneratorFunctionBody = inGeneratorFunctionBody;\n            var savedInStatementContainingYield = inStatementContainingYield;\n            var savedBlocks = blocks;\n            var savedBlockOffsets = blockOffsets;\n            var savedBlockActions = blockActions;\n            var savedBlockStack = blockStack;\n            var savedLabelOffsets = labelOffsets;\n            var savedLabelExpressions = labelExpressions;\n            var savedNextLabelId = nextLabelId;\n            var savedOperations = operations;\n            var savedOperationArguments = operationArguments;\n            var savedOperationLocations = operationLocations;\n            var savedState = state;\n            // Initialize generator state\n            inGeneratorFunctionBody = true;\n            inStatementContainingYield = false;\n            blocks = undefined;\n            blockOffsets = undefined;\n            blockActions = undefined;\n            blockStack = undefined;\n            labelOffsets = undefined;\n            labelExpressions = undefined;\n            nextLabelId = 1;\n            operations = undefined;\n            operationArguments = undefined;\n            operationLocations = undefined;\n            state = ts.createTempVariable(/*recordTempVariable*/ undefined);\n            // Build the generator\n            resumeLexicalEnvironment();\n            var statementOffset = ts.addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor);\n            transformAndEmitStatements(body.statements, statementOffset);\n            var buildResult = build();\n            ts.addRange(statements, endLexicalEnvironment());\n            statements.push(ts.createReturn(buildResult));\n            // Restore previous generator state\n            inGeneratorFunctionBody = savedInGeneratorFunctionBody;\n            inStatementContainingYield = savedInStatementContainingYield;\n            blocks = savedBlocks;\n            blockOffsets = savedBlockOffsets;\n            blockActions = savedBlockActions;\n            blockStack = savedBlockStack;\n            labelOffsets = savedLabelOffsets;\n            labelExpressions = savedLabelExpressions;\n            nextLabelId = savedNextLabelId;\n            operations = savedOperations;\n            operationArguments = savedOperationArguments;\n            operationLocations = savedOperationLocations;\n            state = savedState;\n            return ts.createBlock(statements, /*location*/ body, body.multiLine);\n        }\n        /**\n         * Visits a variable statement.\n         *\n         * This will be called when one of the following conditions are met:\n         * - The variable statement is contained within the body of a generator function.\n         *\n         * @param node The node to visit.\n         */\n        function visitVariableStatement(node) {\n            if (node.transformFlags & 16777216 /* ContainsYield */) {\n                transformAndEmitVariableDeclarationList(node.declarationList);\n                return undefined;\n            }\n            else {\n                // Do not hoist custom prologues.\n                if (ts.getEmitFlags(node) & 524288 /* CustomPrologue */) {\n                    return node;\n                }\n                for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                    var variable = _a[_i];\n                    hoistVariableDeclaration(variable.name);\n                }\n                var variables = ts.getInitializedVariables(node.declarationList);\n                if (variables.length === 0) {\n                    return undefined;\n                }\n                return ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable)));\n            }\n        }\n        /**\n         * Visits a binary expression.\n         *\n         * This will be called when one of the following conditions are met:\n         * - The node contains a YieldExpression.\n         *\n         * @param node The node to visit.\n         */\n        function visitBinaryExpression(node) {\n            switch (ts.getExpressionAssociativity(node)) {\n                case 0 /* Left */:\n                    return visitLeftAssociativeBinaryExpression(node);\n                case 1 /* Right */:\n                    return visitRightAssociativeBinaryExpression(node);\n                default:\n                    ts.Debug.fail(\"Unknown associativity.\");\n            }\n        }\n        function isCompoundAssignment(kind) {\n            return kind >= 58 /* FirstCompoundAssignment */\n                && kind <= 69 /* LastCompoundAssignment */;\n        }\n        function getOperatorForCompoundAssignment(kind) {\n            switch (kind) {\n                case 58 /* PlusEqualsToken */: return 36 /* PlusToken */;\n                case 59 /* MinusEqualsToken */: return 37 /* MinusToken */;\n                case 60 /* AsteriskEqualsToken */: return 38 /* AsteriskToken */;\n                case 61 /* AsteriskAsteriskEqualsToken */: return 39 /* AsteriskAsteriskToken */;\n                case 62 /* SlashEqualsToken */: return 40 /* SlashToken */;\n                case 63 /* PercentEqualsToken */: return 41 /* PercentToken */;\n                case 64 /* LessThanLessThanEqualsToken */: return 44 /* LessThanLessThanToken */;\n                case 65 /* GreaterThanGreaterThanEqualsToken */: return 45 /* GreaterThanGreaterThanToken */;\n                case 66 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 46 /* GreaterThanGreaterThanGreaterThanToken */;\n                case 67 /* AmpersandEqualsToken */: return 47 /* AmpersandToken */;\n                case 68 /* BarEqualsToken */: return 48 /* BarToken */;\n                case 69 /* CaretEqualsToken */: return 49 /* CaretToken */;\n            }\n        }\n        /**\n         * Visits a right-associative binary expression containing `yield`.\n         *\n         * @param node The node to visit.\n         */\n        function visitRightAssociativeBinaryExpression(node) {\n            var left = node.left, right = node.right;\n            if (containsYield(right)) {\n                var target = void 0;\n                switch (left.kind) {\n                    case 177 /* PropertyAccessExpression */:\n                        // [source]\n                        //      a.b = yield;\n                        //\n                        // [intermediate]\n                        //  .local _a\n                        //      _a = a;\n                        //  .yield resumeLabel\n                        //  .mark resumeLabel\n                        //      _a.b = %sent%;\n                        target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name);\n                        break;\n                    case 178 /* ElementAccessExpression */:\n                        // [source]\n                        //      a[b] = yield;\n                        //\n                        // [intermediate]\n                        //  .local _a, _b\n                        //      _a = a;\n                        //      _b = b;\n                        //  .yield resumeLabel\n                        //  .mark resumeLabel\n                        //      _a[_b] = %sent%;\n                        target = ts.updateElementAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression)));\n                        break;\n                    default:\n                        target = ts.visitNode(left, visitor, ts.isExpression);\n                        break;\n                }\n                var operator = node.operatorToken.kind;\n                if (isCompoundAssignment(operator)) {\n                    return ts.createBinary(target, 57 /* EqualsToken */, ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression), node), node);\n                }\n                else {\n                    return ts.updateBinary(node, target, ts.visitNode(right, visitor, ts.isExpression));\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitLeftAssociativeBinaryExpression(node) {\n            if (containsYield(node.right)) {\n                if (ts.isLogicalOperator(node.operatorToken.kind)) {\n                    return visitLogicalBinaryExpression(node);\n                }\n                else if (node.operatorToken.kind === 25 /* CommaToken */) {\n                    return visitCommaExpression(node);\n                }\n                // [source]\n                //      a() + (yield) + c()\n                //\n                // [intermediate]\n                //  .local _a\n                //      _a = a();\n                //  .yield resumeLabel\n                //      _a + %sent% + c()\n                var clone_4 = ts.getMutableClone(node);\n                clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression));\n                clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression);\n                return clone_4;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        /**\n         * Visits a logical binary expression containing `yield`.\n         *\n         * @param node A node to visit.\n         */\n        function visitLogicalBinaryExpression(node) {\n            // Logical binary expressions (`&&` and `||`) are shortcutting expressions and need\n            // to be transformed as such:\n            //\n            // [source]\n            //      x = a() && yield;\n            //\n            // [intermediate]\n            //  .local _a\n            //      _a = a();\n            //  .brfalse resultLabel, (_a)\n            //  .yield resumeLabel\n            //  .mark resumeLabel\n            //      _a = %sent%;\n            //  .mark resultLabel\n            //      x = _a;\n            //\n            // [source]\n            //      x = a() || yield;\n            //\n            // [intermediate]\n            //  .local _a\n            //      _a = a();\n            //  .brtrue resultLabel, (_a)\n            //  .yield resumeLabel\n            //  .mark resumeLabel\n            //      _a = %sent%;\n            //  .mark resultLabel\n            //      x = _a;\n            var resultLabel = defineLabel();\n            var resultLocal = declareLocal();\n            emitAssignment(resultLocal, ts.visitNode(node.left, visitor, ts.isExpression), /*location*/ node.left);\n            if (node.operatorToken.kind === 52 /* AmpersandAmpersandToken */) {\n                // Logical `&&` shortcuts when the left-hand operand is falsey.\n                emitBreakWhenFalse(resultLabel, resultLocal, /*location*/ node.left);\n            }\n            else {\n                // Logical `||` shortcuts when the left-hand operand is truthy.\n                emitBreakWhenTrue(resultLabel, resultLocal, /*location*/ node.left);\n            }\n            emitAssignment(resultLocal, ts.visitNode(node.right, visitor, ts.isExpression), /*location*/ node.right);\n            markLabel(resultLabel);\n            return resultLocal;\n        }\n        /**\n         * Visits a comma expression containing `yield`.\n         *\n         * @param node The node to visit.\n         */\n        function visitCommaExpression(node) {\n            // [source]\n            //      x = a(), yield, b();\n            //\n            // [intermediate]\n            //      a();\n            //  .yield resumeLabel\n            //  .mark resumeLabel\n            //      x = %sent%, b();\n            var pendingExpressions = [];\n            visit(node.left);\n            visit(node.right);\n            return ts.inlineExpressions(pendingExpressions);\n            function visit(node) {\n                if (ts.isBinaryExpression(node) && node.operatorToken.kind === 25 /* CommaToken */) {\n                    visit(node.left);\n                    visit(node.right);\n                }\n                else {\n                    if (containsYield(node) && pendingExpressions.length > 0) {\n                        emitWorker(1 /* Statement */, [ts.createStatement(ts.inlineExpressions(pendingExpressions))]);\n                        pendingExpressions = [];\n                    }\n                    pendingExpressions.push(ts.visitNode(node, visitor, ts.isExpression));\n                }\n            }\n        }\n        /**\n         * Visits a conditional expression containing `yield`.\n         *\n         * @param node The node to visit.\n         */\n        function visitConditionalExpression(node) {\n            // [source]\n            //      x = a() ? yield : b();\n            //\n            // [intermediate]\n            //  .local _a\n            //  .brfalse whenFalseLabel, (a())\n            //  .yield resumeLabel\n            //  .mark resumeLabel\n            //      _a = %sent%;\n            //  .br resultLabel\n            //  .mark whenFalseLabel\n            //      _a = b();\n            //  .mark resultLabel\n            //      x = _a;\n            // We only need to perform a specific transformation if a `yield` expression exists\n            // in either the `whenTrue` or `whenFalse` branches.\n            // A `yield` in the condition will be handled by the normal visitor.\n            if (containsYield(node.whenTrue) || containsYield(node.whenFalse)) {\n                var whenFalseLabel = defineLabel();\n                var resultLabel = defineLabel();\n                var resultLocal = declareLocal();\n                emitBreakWhenFalse(whenFalseLabel, ts.visitNode(node.condition, visitor, ts.isExpression), /*location*/ node.condition);\n                emitAssignment(resultLocal, ts.visitNode(node.whenTrue, visitor, ts.isExpression), /*location*/ node.whenTrue);\n                emitBreak(resultLabel);\n                markLabel(whenFalseLabel);\n                emitAssignment(resultLocal, ts.visitNode(node.whenFalse, visitor, ts.isExpression), /*location*/ node.whenFalse);\n                markLabel(resultLabel);\n                return resultLocal;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        /**\n         * Visits a `yield` expression.\n         *\n         * @param node The node to visit.\n         */\n        function visitYieldExpression(node) {\n            // [source]\n            //      x = yield a();\n            //\n            // [intermediate]\n            //  .yield resumeLabel, (a())\n            //  .mark resumeLabel\n            //      x = %sent%;\n            // NOTE: we are explicitly not handling YieldStar at this time.\n            var resumeLabel = defineLabel();\n            var expression = ts.visitNode(node.expression, visitor, ts.isExpression);\n            if (node.asteriskToken) {\n                emitYieldStar(expression, /*location*/ node);\n            }\n            else {\n                emitYield(expression, /*location*/ node);\n            }\n            markLabel(resumeLabel);\n            return createGeneratorResume();\n        }\n        /**\n         * Visits an ArrayLiteralExpression that contains a YieldExpression.\n         *\n         * @param node The node to visit.\n         */\n        function visitArrayLiteralExpression(node) {\n            return visitElements(node.elements, /*leadingElement*/ undefined, /*location*/ undefined, node.multiLine);\n        }\n        /**\n         * Visits an array of expressions containing one or more YieldExpression nodes\n         * and returns an expression for the resulting value.\n         *\n         * @param elements The elements to visit.\n         * @param multiLine Whether array literals created should be emitted on multiple lines.\n         */\n        function visitElements(elements, leadingElement, location, multiLine) {\n            // [source]\n            //      ar = [1, yield, 2];\n            //\n            // [intermediate]\n            //  .local _a\n            //      _a = [1];\n            //  .yield resumeLabel\n            //  .mark resumeLabel\n            //      ar = _a.concat([%sent%, 2]);\n            var numInitialElements = countInitialNodesWithoutYield(elements);\n            var temp = declareLocal();\n            var hasAssignedTemp = false;\n            if (numInitialElements > 0) {\n                var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements);\n                emitAssignment(temp, ts.createArrayLiteral(leadingElement\n                    ? [leadingElement].concat(initialElements) : initialElements));\n                leadingElement = undefined;\n                hasAssignedTemp = true;\n            }\n            var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements);\n            return hasAssignedTemp\n                ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, /*location*/ undefined, multiLine)])\n                : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine);\n            function reduceElement(expressions, element) {\n                if (containsYield(element) && expressions.length > 0) {\n                    emitAssignment(temp, hasAssignedTemp\n                        ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, /*location*/ undefined, multiLine)])\n                        : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, \n                        /*location*/ undefined, multiLine));\n                    hasAssignedTemp = true;\n                    leadingElement = undefined;\n                    expressions = [];\n                }\n                expressions.push(ts.visitNode(element, visitor, ts.isExpression));\n                return expressions;\n            }\n        }\n        function visitObjectLiteralExpression(node) {\n            // [source]\n            //      o = {\n            //          a: 1,\n            //          b: yield,\n            //          c: 2\n            //      };\n            //\n            // [intermediate]\n            //  .local _a\n            //      _a = {\n            //          a: 1\n            //      };\n            //  .yield resumeLabel\n            //  .mark resumeLabel\n            //      o = (_a.b = %sent%,\n            //          _a.c = 2,\n            //          _a);\n            var properties = node.properties;\n            var multiLine = node.multiLine;\n            var numInitialProperties = countInitialNodesWithoutYield(properties);\n            var temp = declareLocal();\n            emitAssignment(temp, ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), \n            /*location*/ undefined, multiLine));\n            var expressions = ts.reduceLeft(properties, reduceProperty, [], numInitialProperties);\n            expressions.push(multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp);\n            return ts.inlineExpressions(expressions);\n            function reduceProperty(expressions, property) {\n                if (containsYield(property) && expressions.length > 0) {\n                    emitStatement(ts.createStatement(ts.inlineExpressions(expressions)));\n                    expressions = [];\n                }\n                var expression = ts.createExpressionForObjectLiteralElementLike(node, property, temp);\n                var visited = ts.visitNode(expression, visitor, ts.isExpression);\n                if (visited) {\n                    if (multiLine) {\n                        visited.startsOnNewLine = true;\n                    }\n                    expressions.push(visited);\n                }\n                return expressions;\n            }\n        }\n        /**\n         * Visits an ElementAccessExpression that contains a YieldExpression.\n         *\n         * @param node The node to visit.\n         */\n        function visitElementAccessExpression(node) {\n            if (containsYield(node.argumentExpression)) {\n                // [source]\n                //      a = x[yield];\n                //\n                // [intermediate]\n                //  .local _a\n                //      _a = x;\n                //  .yield resumeLabel\n                //  .mark resumeLabel\n                //      a = _a[%sent%]\n                var clone_5 = ts.getMutableClone(node);\n                clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression));\n                clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression);\n                return clone_5;\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitCallExpression(node) {\n            if (ts.forEach(node.arguments, containsYield)) {\n                // [source]\n                //      a.b(1, yield, 2);\n                //\n                // [intermediate]\n                //  .local _a, _b, _c\n                //      _b = (_a = a).b;\n                //      _c = [1];\n                //  .yield resumeLabel\n                //  .mark resumeLabel\n                //      _b.apply(_a, _c.concat([%sent%, 2]));\n                var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion, /*cacheIdentifiers*/ true), target = _a.target, thisArg = _a.thisArg;\n                return ts.setOriginalNode(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isLeftHandSideExpression)), thisArg, visitElements(node.arguments), \n                /*location*/ node), node);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function visitNewExpression(node) {\n            if (ts.forEach(node.arguments, containsYield)) {\n                // [source]\n                //      new a.b(1, yield, 2);\n                //\n                // [intermediate]\n                //  .local _a, _b, _c\n                //      _b = (_a = a.b).bind;\n                //      _c = [1];\n                //  .yield resumeLabel\n                //  .mark resumeLabel\n                //      new (_b.apply(_a, _c.concat([%sent%, 2])));\n                var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, \"bind\"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;\n                return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, \n                /*leadingElement*/ ts.createVoidZero())), \n                /*typeArguments*/ undefined, [], \n                /*location*/ node), node);\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function transformAndEmitStatements(statements, start) {\n            if (start === void 0) { start = 0; }\n            var numStatements = statements.length;\n            for (var i = start; i < numStatements; i++) {\n                transformAndEmitStatement(statements[i]);\n            }\n        }\n        function transformAndEmitEmbeddedStatement(node) {\n            if (ts.isBlock(node)) {\n                transformAndEmitStatements(node.statements);\n            }\n            else {\n                transformAndEmitStatement(node);\n            }\n        }\n        function transformAndEmitStatement(node) {\n            var savedInStatementContainingYield = inStatementContainingYield;\n            if (!inStatementContainingYield) {\n                inStatementContainingYield = containsYield(node);\n            }\n            transformAndEmitStatementWorker(node);\n            inStatementContainingYield = savedInStatementContainingYield;\n        }\n        function transformAndEmitStatementWorker(node) {\n            switch (node.kind) {\n                case 204 /* Block */:\n                    return transformAndEmitBlock(node);\n                case 207 /* ExpressionStatement */:\n                    return transformAndEmitExpressionStatement(node);\n                case 208 /* IfStatement */:\n                    return transformAndEmitIfStatement(node);\n                case 209 /* DoStatement */:\n                    return transformAndEmitDoStatement(node);\n                case 210 /* WhileStatement */:\n                    return transformAndEmitWhileStatement(node);\n                case 211 /* ForStatement */:\n                    return transformAndEmitForStatement(node);\n                case 212 /* ForInStatement */:\n                    return transformAndEmitForInStatement(node);\n                case 214 /* ContinueStatement */:\n                    return transformAndEmitContinueStatement(node);\n                case 215 /* BreakStatement */:\n                    return transformAndEmitBreakStatement(node);\n                case 216 /* ReturnStatement */:\n                    return transformAndEmitReturnStatement(node);\n                case 217 /* WithStatement */:\n                    return transformAndEmitWithStatement(node);\n                case 218 /* SwitchStatement */:\n                    return transformAndEmitSwitchStatement(node);\n                case 219 /* LabeledStatement */:\n                    return transformAndEmitLabeledStatement(node);\n                case 220 /* ThrowStatement */:\n                    return transformAndEmitThrowStatement(node);\n                case 221 /* TryStatement */:\n                    return transformAndEmitTryStatement(node);\n                default:\n                    return emitStatement(ts.visitNode(node, visitor, ts.isStatement, /*optional*/ true));\n            }\n        }\n        function transformAndEmitBlock(node) {\n            if (containsYield(node)) {\n                transformAndEmitStatements(node.statements);\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function transformAndEmitExpressionStatement(node) {\n            emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n        }\n        function transformAndEmitVariableDeclarationList(node) {\n            for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) {\n                var variable = _a[_i];\n                hoistVariableDeclaration(variable.name);\n            }\n            var variables = ts.getInitializedVariables(node);\n            var numVariables = variables.length;\n            var variablesWritten = 0;\n            var pendingExpressions = [];\n            while (variablesWritten < numVariables) {\n                for (var i = variablesWritten; i < numVariables; i++) {\n                    var variable = variables[i];\n                    if (containsYield(variable.initializer) && pendingExpressions.length > 0) {\n                        break;\n                    }\n                    pendingExpressions.push(transformInitializedVariable(variable));\n                }\n                if (pendingExpressions.length) {\n                    emitStatement(ts.createStatement(ts.inlineExpressions(pendingExpressions)));\n                    variablesWritten += pendingExpressions.length;\n                    pendingExpressions = [];\n                }\n            }\n            return undefined;\n        }\n        function transformInitializedVariable(node) {\n            return ts.createAssignment(ts.getSynthesizedClone(node.name), ts.visitNode(node.initializer, visitor, ts.isExpression));\n        }\n        function transformAndEmitIfStatement(node) {\n            if (containsYield(node)) {\n                // [source]\n                //      if (x)\n                //          /*thenStatement*/\n                //      else\n                //          /*elseStatement*/\n                //\n                // [intermediate]\n                //  .brfalse elseLabel, (x)\n                //      /*thenStatement*/\n                //  .br endLabel\n                //  .mark elseLabel\n                //      /*elseStatement*/\n                //  .mark endLabel\n                if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) {\n                    var endLabel = defineLabel();\n                    var elseLabel = node.elseStatement ? defineLabel() : undefined;\n                    emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression));\n                    transformAndEmitEmbeddedStatement(node.thenStatement);\n                    if (node.elseStatement) {\n                        emitBreak(endLabel);\n                        markLabel(elseLabel);\n                        transformAndEmitEmbeddedStatement(node.elseStatement);\n                    }\n                    markLabel(endLabel);\n                }\n                else {\n                    emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n                }\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function transformAndEmitDoStatement(node) {\n            if (containsYield(node)) {\n                // [source]\n                //      do {\n                //          /*body*/\n                //      }\n                //      while (i < 10);\n                //\n                // [intermediate]\n                //  .loop conditionLabel, endLabel\n                //  .mark loopLabel\n                //      /*body*/\n                //  .mark conditionLabel\n                //  .brtrue loopLabel, (i < 10)\n                //  .endloop\n                //  .mark endLabel\n                var conditionLabel = defineLabel();\n                var loopLabel = defineLabel();\n                beginLoopBlock(/*continueLabel*/ conditionLabel);\n                markLabel(loopLabel);\n                transformAndEmitEmbeddedStatement(node.statement);\n                markLabel(conditionLabel);\n                emitBreakWhenTrue(loopLabel, ts.visitNode(node.expression, visitor, ts.isExpression));\n                endLoopBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitDoStatement(node) {\n            if (inStatementContainingYield) {\n                beginScriptLoopBlock();\n                node = ts.visitEachChild(node, visitor, context);\n                endLoopBlock();\n                return node;\n            }\n            else {\n                return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function transformAndEmitWhileStatement(node) {\n            if (containsYield(node)) {\n                // [source]\n                //      while (i < 10) {\n                //          /*body*/\n                //      }\n                //\n                // [intermediate]\n                //  .loop loopLabel, endLabel\n                //  .mark loopLabel\n                //  .brfalse endLabel, (i < 10)\n                //      /*body*/\n                //  .br loopLabel\n                //  .endloop\n                //  .mark endLabel\n                var loopLabel = defineLabel();\n                var endLabel = beginLoopBlock(loopLabel);\n                markLabel(loopLabel);\n                emitBreakWhenFalse(endLabel, ts.visitNode(node.expression, visitor, ts.isExpression));\n                transformAndEmitEmbeddedStatement(node.statement);\n                emitBreak(loopLabel);\n                endLoopBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitWhileStatement(node) {\n            if (inStatementContainingYield) {\n                beginScriptLoopBlock();\n                node = ts.visitEachChild(node, visitor, context);\n                endLoopBlock();\n                return node;\n            }\n            else {\n                return ts.visitEachChild(node, visitor, context);\n            }\n        }\n        function transformAndEmitForStatement(node) {\n            if (containsYield(node)) {\n                // [source]\n                //      for (var i = 0; i < 10; i++) {\n                //          /*body*/\n                //      }\n                //\n                // [intermediate]\n                //  .local i\n                //      i = 0;\n                //  .loop incrementLabel, endLoopLabel\n                //  .mark conditionLabel\n                //  .brfalse endLoopLabel, (i < 10)\n                //      /*body*/\n                //  .mark incrementLabel\n                //      i++;\n                //  .br conditionLabel\n                //  .endloop\n                //  .mark endLoopLabel\n                var conditionLabel = defineLabel();\n                var incrementLabel = defineLabel();\n                var endLabel = beginLoopBlock(incrementLabel);\n                if (node.initializer) {\n                    var initializer = node.initializer;\n                    if (ts.isVariableDeclarationList(initializer)) {\n                        transformAndEmitVariableDeclarationList(initializer);\n                    }\n                    else {\n                        emitStatement(ts.createStatement(ts.visitNode(initializer, visitor, ts.isExpression), \n                        /*location*/ initializer));\n                    }\n                }\n                markLabel(conditionLabel);\n                if (node.condition) {\n                    emitBreakWhenFalse(endLabel, ts.visitNode(node.condition, visitor, ts.isExpression));\n                }\n                transformAndEmitEmbeddedStatement(node.statement);\n                markLabel(incrementLabel);\n                if (node.incrementor) {\n                    emitStatement(ts.createStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression), \n                    /*location*/ node.incrementor));\n                }\n                emitBreak(conditionLabel);\n                endLoopBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitForStatement(node) {\n            if (inStatementContainingYield) {\n                beginScriptLoopBlock();\n            }\n            var initializer = node.initializer;\n            if (ts.isVariableDeclarationList(initializer)) {\n                for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) {\n                    var variable = _a[_i];\n                    hoistVariableDeclaration(variable.name);\n                }\n                var variables = ts.getInitializedVariables(initializer);\n                node = ts.updateFor(node, variables.length > 0\n                    ? ts.inlineExpressions(ts.map(variables, transformInitializedVariable))\n                    : undefined, ts.visitNode(node.condition, visitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.incrementor, visitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, ts.liftToBlock));\n            }\n            else {\n                node = ts.visitEachChild(node, visitor, context);\n            }\n            if (inStatementContainingYield) {\n                endLoopBlock();\n            }\n            return node;\n        }\n        function transformAndEmitForInStatement(node) {\n            // TODO(rbuckton): Source map locations\n            if (containsYield(node)) {\n                // [source]\n                //      for (var p in o) {\n                //          /*body*/\n                //      }\n                //\n                // [intermediate]\n                //  .local _a, _b, _i\n                //      _a = [];\n                //      for (_b in o) _a.push(_b);\n                //      _i = 0;\n                //  .loop incrementLabel, endLoopLabel\n                //  .mark conditionLabel\n                //  .brfalse endLoopLabel, (_i < _a.length)\n                //      p = _a[_i];\n                //      /*body*/\n                //  .mark incrementLabel\n                //      _b++;\n                //  .br conditionLabel\n                //  .endloop\n                //  .mark endLoopLabel\n                var keysArray = declareLocal(); // _a\n                var key = declareLocal(); // _b\n                var keysIndex = ts.createLoopVariable(); // _i\n                var initializer = node.initializer;\n                hoistVariableDeclaration(keysIndex);\n                emitAssignment(keysArray, ts.createArrayLiteral());\n                emitStatement(ts.createForIn(key, ts.visitNode(node.expression, visitor, ts.isExpression), ts.createStatement(ts.createCall(ts.createPropertyAccess(keysArray, \"push\"), \n                /*typeArguments*/ undefined, [key]))));\n                emitAssignment(keysIndex, ts.createLiteral(0));\n                var conditionLabel = defineLabel();\n                var incrementLabel = defineLabel();\n                var endLabel = beginLoopBlock(incrementLabel);\n                markLabel(conditionLabel);\n                emitBreakWhenFalse(endLabel, ts.createLessThan(keysIndex, ts.createPropertyAccess(keysArray, \"length\")));\n                var variable = void 0;\n                if (ts.isVariableDeclarationList(initializer)) {\n                    for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) {\n                        var variable_1 = _a[_i];\n                        hoistVariableDeclaration(variable_1.name);\n                    }\n                    variable = ts.getSynthesizedClone(initializer.declarations[0].name);\n                }\n                else {\n                    variable = ts.visitNode(initializer, visitor, ts.isExpression);\n                    ts.Debug.assert(ts.isLeftHandSideExpression(variable));\n                }\n                emitAssignment(variable, ts.createElementAccess(keysArray, keysIndex));\n                transformAndEmitEmbeddedStatement(node.statement);\n                markLabel(incrementLabel);\n                emitStatement(ts.createStatement(ts.createPostfixIncrement(keysIndex)));\n                emitBreak(conditionLabel);\n                endLoopBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitForInStatement(node) {\n            // [source]\n            //      for (var x in a) {\n            //          /*body*/\n            //      }\n            //\n            // [intermediate]\n            //  .local x\n            //  .loop\n            //      for (x in a) {\n            //          /*body*/\n            //      }\n            //  .endloop\n            if (inStatementContainingYield) {\n                beginScriptLoopBlock();\n            }\n            var initializer = node.initializer;\n            if (ts.isVariableDeclarationList(initializer)) {\n                for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) {\n                    var variable = _a[_i];\n                    hoistVariableDeclaration(variable.name);\n                }\n                node = ts.updateForIn(node, initializer.declarations[0].name, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, ts.liftToBlock));\n            }\n            else {\n                node = ts.visitEachChild(node, visitor, context);\n            }\n            if (inStatementContainingYield) {\n                endLoopBlock();\n            }\n            return node;\n        }\n        function transformAndEmitContinueStatement(node) {\n            var label = findContinueTarget(node.label ? node.label.text : undefined);\n            ts.Debug.assert(label > 0, \"Expected continue statment to point to a valid Label.\");\n            emitBreak(label, /*location*/ node);\n        }\n        function visitContinueStatement(node) {\n            if (inStatementContainingYield) {\n                var label = findContinueTarget(node.label && node.label.text);\n                if (label > 0) {\n                    return createInlineBreak(label, /*location*/ node);\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function transformAndEmitBreakStatement(node) {\n            var label = findBreakTarget(node.label ? node.label.text : undefined);\n            ts.Debug.assert(label > 0, \"Expected break statment to point to a valid Label.\");\n            emitBreak(label, /*location*/ node);\n        }\n        function visitBreakStatement(node) {\n            if (inStatementContainingYield) {\n                var label = findBreakTarget(node.label && node.label.text);\n                if (label > 0) {\n                    return createInlineBreak(label, /*location*/ node);\n                }\n            }\n            return ts.visitEachChild(node, visitor, context);\n        }\n        function transformAndEmitReturnStatement(node) {\n            emitReturn(ts.visitNode(node.expression, visitor, ts.isExpression, /*optional*/ true), \n            /*location*/ node);\n        }\n        function visitReturnStatement(node) {\n            return createInlineReturn(ts.visitNode(node.expression, visitor, ts.isExpression, /*optional*/ true), \n            /*location*/ node);\n        }\n        function transformAndEmitWithStatement(node) {\n            if (containsYield(node)) {\n                // [source]\n                //      with (x) {\n                //          /*body*/\n                //      }\n                //\n                // [intermediate]\n                //  .with (x)\n                //      /*body*/\n                //  .endwith\n                beginWithBlock(cacheExpression(ts.visitNode(node.expression, visitor, ts.isExpression)));\n                transformAndEmitEmbeddedStatement(node.statement);\n                endWithBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function transformAndEmitSwitchStatement(node) {\n            if (containsYield(node.caseBlock)) {\n                // [source]\n                //      switch (x) {\n                //          case a:\n                //              /*caseStatements*/\n                //          case b:\n                //              /*caseStatements*/\n                //          default:\n                //              /*defaultStatements*/\n                //      }\n                //\n                // [intermediate]\n                //  .local _a\n                //  .switch endLabel\n                //      _a = x;\n                //      switch (_a) {\n                //          case a:\n                //  .br clauseLabels[0]\n                //      }\n                //      switch (_a) {\n                //          case b:\n                //  .br clauseLabels[1]\n                //      }\n                //  .br clauseLabels[2]\n                //  .mark clauseLabels[0]\n                //      /*caseStatements*/\n                //  .mark clauseLabels[1]\n                //      /*caseStatements*/\n                //  .mark clauseLabels[2]\n                //      /*caseStatements*/\n                //  .endswitch\n                //  .mark endLabel\n                var caseBlock = node.caseBlock;\n                var numClauses = caseBlock.clauses.length;\n                var endLabel = beginSwitchBlock();\n                var expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isExpression));\n                // Create labels for each clause and find the index of the first default clause.\n                var clauseLabels = [];\n                var defaultClauseIndex = -1;\n                for (var i = 0; i < numClauses; i++) {\n                    var clause = caseBlock.clauses[i];\n                    clauseLabels.push(defineLabel());\n                    if (clause.kind === 254 /* DefaultClause */ && defaultClauseIndex === -1) {\n                        defaultClauseIndex = i;\n                    }\n                }\n                // Emit switch statements for each run of case clauses either from the first case\n                // clause or the next case clause with a `yield` in its expression, up to the next\n                // case clause with a `yield` in its expression.\n                var clausesWritten = 0;\n                var pendingClauses = [];\n                while (clausesWritten < numClauses) {\n                    var defaultClausesSkipped = 0;\n                    for (var i = clausesWritten; i < numClauses; i++) {\n                        var clause = caseBlock.clauses[i];\n                        if (clause.kind === 253 /* CaseClause */) {\n                            var caseClause = clause;\n                            if (containsYield(caseClause.expression) && pendingClauses.length > 0) {\n                                break;\n                            }\n                            pendingClauses.push(ts.createCaseClause(ts.visitNode(caseClause.expression, visitor, ts.isExpression), [\n                                createInlineBreak(clauseLabels[i], /*location*/ caseClause.expression)\n                            ]));\n                        }\n                        else {\n                            defaultClausesSkipped++;\n                        }\n                    }\n                    if (pendingClauses.length) {\n                        emitStatement(ts.createSwitch(expression, ts.createCaseBlock(pendingClauses)));\n                        clausesWritten += pendingClauses.length;\n                        pendingClauses = [];\n                    }\n                    if (defaultClausesSkipped > 0) {\n                        clausesWritten += defaultClausesSkipped;\n                        defaultClausesSkipped = 0;\n                    }\n                }\n                if (defaultClauseIndex >= 0) {\n                    emitBreak(clauseLabels[defaultClauseIndex]);\n                }\n                else {\n                    emitBreak(endLabel);\n                }\n                for (var i = 0; i < numClauses; i++) {\n                    markLabel(clauseLabels[i]);\n                    transformAndEmitStatements(caseBlock.clauses[i].statements);\n                }\n                endSwitchBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitSwitchStatement(node) {\n            if (inStatementContainingYield) {\n                beginScriptSwitchBlock();\n            }\n            node = ts.visitEachChild(node, visitor, context);\n            if (inStatementContainingYield) {\n                endSwitchBlock();\n            }\n            return node;\n        }\n        function transformAndEmitLabeledStatement(node) {\n            if (containsYield(node)) {\n                // [source]\n                //      x: {\n                //          /*body*/\n                //      }\n                //\n                // [intermediate]\n                //  .labeled \"x\", endLabel\n                //      /*body*/\n                //  .endlabeled\n                //  .mark endLabel\n                beginLabeledBlock(node.label.text);\n                transformAndEmitEmbeddedStatement(node.statement);\n                endLabeledBlock();\n            }\n            else {\n                emitStatement(ts.visitNode(node, visitor, ts.isStatement));\n            }\n        }\n        function visitLabeledStatement(node) {\n            if (inStatementContainingYield) {\n                beginScriptLabeledBlock(node.label.text);\n            }\n            node = ts.visitEachChild(node, visitor, context);\n            if (inStatementContainingYield) {\n                endLabeledBlock();\n            }\n            return node;\n        }\n        function transformAndEmitThrowStatement(node) {\n            emitThrow(ts.visitNode(node.expression, visitor, ts.isExpression), \n            /*location*/ node);\n        }\n        function transformAndEmitTryStatement(node) {\n            if (containsYield(node)) {\n                // [source]\n                //      try {\n                //          /*tryBlock*/\n                //      }\n                //      catch (e) {\n                //          /*catchBlock*/\n                //      }\n                //      finally {\n                //          /*finallyBlock*/\n                //      }\n                //\n                // [intermediate]\n                //  .local _a\n                //  .try tryLabel, catchLabel, finallyLabel, endLabel\n                //  .mark tryLabel\n                //  .nop\n                //      /*tryBlock*/\n                //  .br endLabel\n                //  .catch\n                //  .mark catchLabel\n                //      _a = %error%;\n                //      /*catchBlock*/\n                //  .br endLabel\n                //  .finally\n                //  .mark finallyLabel\n                //      /*finallyBlock*/\n                //  .endfinally\n                //  .endtry\n                //  .mark endLabel\n                beginExceptionBlock();\n                transformAndEmitEmbeddedStatement(node.tryBlock);\n                if (node.catchClause) {\n                    beginCatchBlock(node.catchClause.variableDeclaration);\n                    transformAndEmitEmbeddedStatement(node.catchClause.block);\n                }\n                if (node.finallyBlock) {\n                    beginFinallyBlock();\n                    transformAndEmitEmbeddedStatement(node.finallyBlock);\n                }\n                endExceptionBlock();\n            }\n            else {\n                emitStatement(ts.visitEachChild(node, visitor, context));\n            }\n        }\n        function containsYield(node) {\n            return node && (node.transformFlags & 16777216 /* ContainsYield */) !== 0;\n        }\n        function countInitialNodesWithoutYield(nodes) {\n            var numNodes = nodes.length;\n            for (var i = 0; i < numNodes; i++) {\n                if (containsYield(nodes[i])) {\n                    return i;\n                }\n            }\n            return -1;\n        }\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (emitContext === 1 /* Expression */) {\n                return substituteExpression(node);\n            }\n            return node;\n        }\n        function substituteExpression(node) {\n            if (ts.isIdentifier(node)) {\n                return substituteExpressionIdentifier(node);\n            }\n            return node;\n        }\n        function substituteExpressionIdentifier(node) {\n            if (renamedCatchVariables && ts.hasProperty(renamedCatchVariables, node.text)) {\n                var original = ts.getOriginalNode(node);\n                if (ts.isIdentifier(original) && original.parent) {\n                    var declaration = resolver.getReferencedValueDeclaration(original);\n                    if (declaration) {\n                        var name_37 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));\n                        if (name_37) {\n                            var clone_6 = ts.getMutableClone(name_37);\n                            ts.setSourceMapRange(clone_6, node);\n                            ts.setCommentRange(clone_6, node);\n                            return clone_6;\n                        }\n                    }\n                }\n            }\n            return node;\n        }\n        function cacheExpression(node) {\n            var temp;\n            if (ts.isGeneratedIdentifier(node)) {\n                return node;\n            }\n            temp = ts.createTempVariable(hoistVariableDeclaration);\n            emitAssignment(temp, node, /*location*/ node);\n            return temp;\n        }\n        function declareLocal(name) {\n            var temp = name\n                ? ts.createUniqueName(name)\n                : ts.createTempVariable(/*recordTempVariable*/ undefined);\n            hoistVariableDeclaration(temp);\n            return temp;\n        }\n        /**\n         * Defines a label, uses as the target of a Break operation.\n         */\n        function defineLabel() {\n            if (!labelOffsets) {\n                labelOffsets = [];\n            }\n            var label = nextLabelId;\n            nextLabelId++;\n            labelOffsets[label] = -1;\n            return label;\n        }\n        /**\n         * Marks the current operation with the specified label.\n         */\n        function markLabel(label) {\n            ts.Debug.assert(labelOffsets !== undefined, \"No labels were defined.\");\n            labelOffsets[label] = operations ? operations.length : 0;\n        }\n        /**\n         * Begins a block operation (With, Break/Continue, Try/Catch/Finally)\n         *\n         * @param block Information about the block.\n         */\n        function beginBlock(block) {\n            if (!blocks) {\n                blocks = [];\n                blockActions = [];\n                blockOffsets = [];\n                blockStack = [];\n            }\n            var index = blockActions.length;\n            blockActions[index] = 0 /* Open */;\n            blockOffsets[index] = operations ? operations.length : 0;\n            blocks[index] = block;\n            blockStack.push(block);\n            return index;\n        }\n        /**\n         * Ends the current block operation.\n         */\n        function endBlock() {\n            var block = peekBlock();\n            ts.Debug.assert(block !== undefined, \"beginBlock was never called.\");\n            var index = blockActions.length;\n            blockActions[index] = 1 /* Close */;\n            blockOffsets[index] = operations ? operations.length : 0;\n            blocks[index] = block;\n            blockStack.pop();\n            return block;\n        }\n        /**\n         * Gets the current open block.\n         */\n        function peekBlock() {\n            return ts.lastOrUndefined(blockStack);\n        }\n        /**\n         * Gets the kind of the current open block.\n         */\n        function peekBlockKind() {\n            var block = peekBlock();\n            return block && block.kind;\n        }\n        /**\n         * Begins a code block for a generated `with` statement.\n         *\n         * @param expression An identifier representing expression for the `with` block.\n         */\n        function beginWithBlock(expression) {\n            var startLabel = defineLabel();\n            var endLabel = defineLabel();\n            markLabel(startLabel);\n            beginBlock({\n                kind: 1 /* With */,\n                expression: expression,\n                startLabel: startLabel,\n                endLabel: endLabel\n            });\n        }\n        /**\n         * Ends a code block for a generated `with` statement.\n         */\n        function endWithBlock() {\n            ts.Debug.assert(peekBlockKind() === 1 /* With */);\n            var block = endBlock();\n            markLabel(block.endLabel);\n        }\n        function isWithBlock(block) {\n            return block.kind === 1 /* With */;\n        }\n        /**\n         * Begins a code block for a generated `try` statement.\n         */\n        function beginExceptionBlock() {\n            var startLabel = defineLabel();\n            var endLabel = defineLabel();\n            markLabel(startLabel);\n            beginBlock({\n                kind: 0 /* Exception */,\n                state: 0 /* Try */,\n                startLabel: startLabel,\n                endLabel: endLabel\n            });\n            emitNop();\n            return endLabel;\n        }\n        /**\n         * Enters the `catch` clause of a generated `try` statement.\n         *\n         * @param variable The catch variable.\n         */\n        function beginCatchBlock(variable) {\n            ts.Debug.assert(peekBlockKind() === 0 /* Exception */);\n            var text = variable.name.text;\n            var name = declareLocal(text);\n            if (!renamedCatchVariables) {\n                renamedCatchVariables = ts.createMap();\n                renamedCatchVariableDeclarations = ts.createMap();\n                context.enableSubstitution(70 /* Identifier */);\n            }\n            renamedCatchVariables[text] = true;\n            renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name;\n            var exception = peekBlock();\n            ts.Debug.assert(exception.state < 1 /* Catch */);\n            var endLabel = exception.endLabel;\n            emitBreak(endLabel);\n            var catchLabel = defineLabel();\n            markLabel(catchLabel);\n            exception.state = 1 /* Catch */;\n            exception.catchVariable = name;\n            exception.catchLabel = catchLabel;\n            emitAssignment(name, ts.createCall(ts.createPropertyAccess(state, \"sent\"), /*typeArguments*/ undefined, []));\n            emitNop();\n        }\n        /**\n         * Enters the `finally` block of a generated `try` statement.\n         */\n        function beginFinallyBlock() {\n            ts.Debug.assert(peekBlockKind() === 0 /* Exception */);\n            var exception = peekBlock();\n            ts.Debug.assert(exception.state < 2 /* Finally */);\n            var endLabel = exception.endLabel;\n            emitBreak(endLabel);\n            var finallyLabel = defineLabel();\n            markLabel(finallyLabel);\n            exception.state = 2 /* Finally */;\n            exception.finallyLabel = finallyLabel;\n        }\n        /**\n         * Ends the code block for a generated `try` statement.\n         */\n        function endExceptionBlock() {\n            ts.Debug.assert(peekBlockKind() === 0 /* Exception */);\n            var exception = endBlock();\n            var state = exception.state;\n            if (state < 2 /* Finally */) {\n                emitBreak(exception.endLabel);\n            }\n            else {\n                emitEndfinally();\n            }\n            markLabel(exception.endLabel);\n            emitNop();\n            exception.state = 3 /* Done */;\n        }\n        function isExceptionBlock(block) {\n            return block.kind === 0 /* Exception */;\n        }\n        /**\n         * Begins a code block that supports `break` or `continue` statements that are defined in\n         * the source tree and not from generated code.\n         *\n         * @param labelText Names from containing labeled statements.\n         */\n        function beginScriptLoopBlock() {\n            beginBlock({\n                kind: 3 /* Loop */,\n                isScript: true,\n                breakLabel: -1,\n                continueLabel: -1\n            });\n        }\n        /**\n         * Begins a code block that supports `break` or `continue` statements that are defined in\n         * generated code. Returns a label used to mark the operation to which to jump when a\n         * `break` statement targets this block.\n         *\n         * @param continueLabel A Label used to mark the operation to which to jump when a\n         *                      `continue` statement targets this block.\n         */\n        function beginLoopBlock(continueLabel) {\n            var breakLabel = defineLabel();\n            beginBlock({\n                kind: 3 /* Loop */,\n                isScript: false,\n                breakLabel: breakLabel,\n                continueLabel: continueLabel\n            });\n            return breakLabel;\n        }\n        /**\n         * Ends a code block that supports `break` or `continue` statements that are defined in\n         * generated code or in the source tree.\n         */\n        function endLoopBlock() {\n            ts.Debug.assert(peekBlockKind() === 3 /* Loop */);\n            var block = endBlock();\n            var breakLabel = block.breakLabel;\n            if (!block.isScript) {\n                markLabel(breakLabel);\n            }\n        }\n        /**\n         * Begins a code block that supports `break` statements that are defined in the source\n         * tree and not from generated code.\n         *\n         */\n        function beginScriptSwitchBlock() {\n            beginBlock({\n                kind: 2 /* Switch */,\n                isScript: true,\n                breakLabel: -1\n            });\n        }\n        /**\n         * Begins a code block that supports `break` statements that are defined in generated code.\n         * Returns a label used to mark the operation to which to jump when a `break` statement\n         * targets this block.\n         */\n        function beginSwitchBlock() {\n            var breakLabel = defineLabel();\n            beginBlock({\n                kind: 2 /* Switch */,\n                isScript: false,\n                breakLabel: breakLabel\n            });\n            return breakLabel;\n        }\n        /**\n         * Ends a code block that supports `break` statements that are defined in generated code.\n         */\n        function endSwitchBlock() {\n            ts.Debug.assert(peekBlockKind() === 2 /* Switch */);\n            var block = endBlock();\n            var breakLabel = block.breakLabel;\n            if (!block.isScript) {\n                markLabel(breakLabel);\n            }\n        }\n        function beginScriptLabeledBlock(labelText) {\n            beginBlock({\n                kind: 4 /* Labeled */,\n                isScript: true,\n                labelText: labelText,\n                breakLabel: -1\n            });\n        }\n        function beginLabeledBlock(labelText) {\n            var breakLabel = defineLabel();\n            beginBlock({\n                kind: 4 /* Labeled */,\n                isScript: false,\n                labelText: labelText,\n                breakLabel: breakLabel\n            });\n        }\n        function endLabeledBlock() {\n            ts.Debug.assert(peekBlockKind() === 4 /* Labeled */);\n            var block = endBlock();\n            if (!block.isScript) {\n                markLabel(block.breakLabel);\n            }\n        }\n        /**\n         * Indicates whether the provided block supports `break` statements.\n         *\n         * @param block A code block.\n         */\n        function supportsUnlabeledBreak(block) {\n            return block.kind === 2 /* Switch */\n                || block.kind === 3 /* Loop */;\n        }\n        /**\n         * Indicates whether the provided block supports `break` statements with labels.\n         *\n         * @param block A code block.\n         */\n        function supportsLabeledBreakOrContinue(block) {\n            return block.kind === 4 /* Labeled */;\n        }\n        /**\n         * Indicates whether the provided block supports `continue` statements.\n         *\n         * @param block A code block.\n         */\n        function supportsUnlabeledContinue(block) {\n            return block.kind === 3 /* Loop */;\n        }\n        function hasImmediateContainingLabeledBlock(labelText, start) {\n            for (var j = start; j >= 0; j--) {\n                var containingBlock = blockStack[j];\n                if (supportsLabeledBreakOrContinue(containingBlock)) {\n                    if (containingBlock.labelText === labelText) {\n                        return true;\n                    }\n                }\n                else {\n                    break;\n                }\n            }\n            return false;\n        }\n        /**\n         * Finds the label that is the target for a `break` statement.\n         *\n         * @param labelText An optional name of a containing labeled statement.\n         */\n        function findBreakTarget(labelText) {\n            ts.Debug.assert(blocks !== undefined);\n            if (labelText) {\n                for (var i = blockStack.length - 1; i >= 0; i--) {\n                    var block = blockStack[i];\n                    if (supportsLabeledBreakOrContinue(block) && block.labelText === labelText) {\n                        return block.breakLabel;\n                    }\n                    else if (supportsUnlabeledBreak(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) {\n                        return block.breakLabel;\n                    }\n                }\n            }\n            else {\n                for (var i = blockStack.length - 1; i >= 0; i--) {\n                    var block = blockStack[i];\n                    if (supportsUnlabeledBreak(block)) {\n                        return block.breakLabel;\n                    }\n                }\n            }\n            return 0;\n        }\n        /**\n         * Finds the label that is the target for a `continue` statement.\n         *\n         * @param labelText An optional name of a containing labeled statement.\n         */\n        function findContinueTarget(labelText) {\n            ts.Debug.assert(blocks !== undefined);\n            if (labelText) {\n                for (var i = blockStack.length - 1; i >= 0; i--) {\n                    var block = blockStack[i];\n                    if (supportsUnlabeledContinue(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) {\n                        return block.continueLabel;\n                    }\n                }\n            }\n            else {\n                for (var i = blockStack.length - 1; i >= 0; i--) {\n                    var block = blockStack[i];\n                    if (supportsUnlabeledContinue(block)) {\n                        return block.continueLabel;\n                    }\n                }\n            }\n            return 0;\n        }\n        /**\n         * Creates an expression that can be used to indicate the value for a label.\n         *\n         * @param label A label.\n         */\n        function createLabel(label) {\n            if (label > 0) {\n                if (labelExpressions === undefined) {\n                    labelExpressions = [];\n                }\n                var expression = ts.createLiteral(-1);\n                if (labelExpressions[label] === undefined) {\n                    labelExpressions[label] = [expression];\n                }\n                else {\n                    labelExpressions[label].push(expression);\n                }\n                return expression;\n            }\n            return ts.createOmittedExpression();\n        }\n        /**\n         * Creates a numeric literal for the provided instruction.\n         */\n        function createInstruction(instruction) {\n            var literal = ts.createLiteral(instruction);\n            literal.trailingComment = instructionNames[instruction];\n            return literal;\n        }\n        /**\n         * Creates a statement that can be used indicate a Break operation to the provided label.\n         *\n         * @param label A label.\n         * @param location An optional source map location for the statement.\n         */\n        function createInlineBreak(label, location) {\n            ts.Debug.assert(label > 0, \"Invalid label: \" + label);\n            return ts.createReturn(ts.createArrayLiteral([\n                createInstruction(3 /* Break */),\n                createLabel(label)\n            ]), location);\n        }\n        /**\n         * Creates a statement that can be used indicate a Return operation.\n         *\n         * @param expression The expression for the return statement.\n         * @param location An optional source map location for the statement.\n         */\n        function createInlineReturn(expression, location) {\n            return ts.createReturn(ts.createArrayLiteral(expression\n                ? [createInstruction(2 /* Return */), expression]\n                : [createInstruction(2 /* Return */)]), location);\n        }\n        /**\n         * Creates an expression that can be used to resume from a Yield operation.\n         */\n        function createGeneratorResume(location) {\n            return ts.createCall(ts.createPropertyAccess(state, \"sent\"), /*typeArguments*/ undefined, [], location);\n        }\n        /**\n         * Emits an empty instruction.\n         */\n        function emitNop() {\n            emitWorker(0 /* Nop */);\n        }\n        /**\n         * Emits a Statement.\n         *\n         * @param node A statement.\n         */\n        function emitStatement(node) {\n            if (node) {\n                emitWorker(1 /* Statement */, [node]);\n            }\n            else {\n                emitNop();\n            }\n        }\n        /**\n         * Emits an Assignment operation.\n         *\n         * @param left The left-hand side of the assignment.\n         * @param right The right-hand side of the assignment.\n         * @param location An optional source map location for the assignment.\n         */\n        function emitAssignment(left, right, location) {\n            emitWorker(2 /* Assign */, [left, right], location);\n        }\n        /**\n         * Emits a Break operation to the specified label.\n         *\n         * @param label A label.\n         * @param location An optional source map location for the assignment.\n         */\n        function emitBreak(label, location) {\n            emitWorker(3 /* Break */, [label], location);\n        }\n        /**\n         * Emits a Break operation to the specified label when a condition evaluates to a truthy\n         * value at runtime.\n         *\n         * @param label A label.\n         * @param condition The condition.\n         * @param location An optional source map location for the assignment.\n         */\n        function emitBreakWhenTrue(label, condition, location) {\n            emitWorker(4 /* BreakWhenTrue */, [label, condition], location);\n        }\n        /**\n         * Emits a Break to the specified label when a condition evaluates to a falsey value at\n         * runtime.\n         *\n         * @param label A label.\n         * @param condition The condition.\n         * @param location An optional source map location for the assignment.\n         */\n        function emitBreakWhenFalse(label, condition, location) {\n            emitWorker(5 /* BreakWhenFalse */, [label, condition], location);\n        }\n        /**\n         * Emits a YieldStar operation for the provided expression.\n         *\n         * @param expression An optional value for the yield operation.\n         * @param location An optional source map location for the assignment.\n         */\n        function emitYieldStar(expression, location) {\n            emitWorker(7 /* YieldStar */, [expression], location);\n        }\n        /**\n         * Emits a Yield operation for the provided expression.\n         *\n         * @param expression An optional value for the yield operation.\n         * @param location An optional source map location for the assignment.\n         */\n        function emitYield(expression, location) {\n            emitWorker(6 /* Yield */, [expression], location);\n        }\n        /**\n         * Emits a Return operation for the provided expression.\n         *\n         * @param expression An optional value for the operation.\n         * @param location An optional source map location for the assignment.\n         */\n        function emitReturn(expression, location) {\n            emitWorker(8 /* Return */, [expression], location);\n        }\n        /**\n         * Emits a Throw operation for the provided expression.\n         *\n         * @param expression A value for the operation.\n         * @param location An optional source map location for the assignment.\n         */\n        function emitThrow(expression, location) {\n            emitWorker(9 /* Throw */, [expression], location);\n        }\n        /**\n         * Emits an Endfinally operation. This is used to handle `finally` block semantics.\n         */\n        function emitEndfinally() {\n            emitWorker(10 /* Endfinally */);\n        }\n        /**\n         * Emits an operation.\n         *\n         * @param code The OpCode for the operation.\n         * @param args The optional arguments for the operation.\n         */\n        function emitWorker(code, args, location) {\n            if (operations === undefined) {\n                operations = [];\n                operationArguments = [];\n                operationLocations = [];\n            }\n            if (labelOffsets === undefined) {\n                // mark entry point\n                markLabel(defineLabel());\n            }\n            var operationIndex = operations.length;\n            operations[operationIndex] = code;\n            operationArguments[operationIndex] = args;\n            operationLocations[operationIndex] = location;\n        }\n        /**\n         * Builds the generator function body.\n         */\n        function build() {\n            blockIndex = 0;\n            labelNumber = 0;\n            labelNumbers = undefined;\n            lastOperationWasAbrupt = false;\n            lastOperationWasCompletion = false;\n            clauses = undefined;\n            statements = undefined;\n            exceptionBlockStack = undefined;\n            currentExceptionBlock = undefined;\n            withBlockStack = undefined;\n            var buildResult = buildStatements();\n            return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(\n            /*modifiers*/ undefined, \n            /*asteriskToken*/ undefined, \n            /*name*/ undefined, \n            /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, state)], \n            /*type*/ undefined, ts.createBlock(buildResult, \n            /*location*/ undefined, \n            /*multiLine*/ buildResult.length > 0)), 262144 /* ReuseTempVariableScope */));\n        }\n        /**\n         * Builds the statements for the generator function body.\n         */\n        function buildStatements() {\n            if (operations) {\n                for (var operationIndex = 0; operationIndex < operations.length; operationIndex++) {\n                    writeOperation(operationIndex);\n                }\n                flushFinalLabel(operations.length);\n            }\n            else {\n                flushFinalLabel(0);\n            }\n            if (clauses) {\n                var labelExpression = ts.createPropertyAccess(state, \"label\");\n                var switchStatement = ts.createSwitch(labelExpression, ts.createCaseBlock(clauses));\n                switchStatement.startsOnNewLine = true;\n                return [switchStatement];\n            }\n            if (statements) {\n                return statements;\n            }\n            return [];\n        }\n        /**\n         * Flush the current label and advance to a new label.\n         */\n        function flushLabel() {\n            if (!statements) {\n                return;\n            }\n            appendLabel(/*markLabelEnd*/ !lastOperationWasAbrupt);\n            lastOperationWasAbrupt = false;\n            lastOperationWasCompletion = false;\n            labelNumber++;\n        }\n        /**\n         * Flush the final label of the generator function body.\n         */\n        function flushFinalLabel(operationIndex) {\n            if (isFinalLabelReachable(operationIndex)) {\n                tryEnterLabel(operationIndex);\n                withBlockStack = undefined;\n                writeReturn(/*expression*/ undefined, /*operationLocation*/ undefined);\n            }\n            if (statements && clauses) {\n                appendLabel(/*markLabelEnd*/ false);\n            }\n            updateLabelExpressions();\n        }\n        /**\n         * Tests whether the final label of the generator function body\n         * is reachable by user code.\n         */\n        function isFinalLabelReachable(operationIndex) {\n            // if the last operation was *not* a completion (return/throw) then\n            // the final label is reachable.\n            if (!lastOperationWasCompletion) {\n                return true;\n            }\n            // if there are no labels defined or referenced, then the final label is\n            // not reachable.\n            if (!labelOffsets || !labelExpressions) {\n                return false;\n            }\n            // if the label for this offset is referenced, then the final label\n            // is reachable.\n            for (var label = 0; label < labelOffsets.length; label++) {\n                if (labelOffsets[label] === operationIndex && labelExpressions[label]) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        /**\n         * Appends a case clause for the last label and sets the new label.\n         *\n         * @param markLabelEnd Indicates that the transition between labels was a fall-through\n         *                     from a previous case clause and the change in labels should be\n         *                     reflected on the `state` object.\n         */\n        function appendLabel(markLabelEnd) {\n            if (!clauses) {\n                clauses = [];\n            }\n            if (statements) {\n                if (withBlockStack) {\n                    // The previous label was nested inside one or more `with` blocks, so we\n                    // surround the statements in generated `with` blocks to create the same environment.\n                    for (var i = withBlockStack.length - 1; i >= 0; i--) {\n                        var withBlock = withBlockStack[i];\n                        statements = [ts.createWith(withBlock.expression, ts.createBlock(statements))];\n                    }\n                }\n                if (currentExceptionBlock) {\n                    // The previous label was nested inside of an exception block, so we must\n                    // indicate entry into a protected region by pushing the label numbers\n                    // for each block in the protected region.\n                    var startLabel = currentExceptionBlock.startLabel, catchLabel = currentExceptionBlock.catchLabel, finallyLabel = currentExceptionBlock.finallyLabel, endLabel = currentExceptionBlock.endLabel;\n                    statements.unshift(ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createPropertyAccess(state, \"trys\"), \"push\"), \n                    /*typeArguments*/ undefined, [\n                        ts.createArrayLiteral([\n                            createLabel(startLabel),\n                            createLabel(catchLabel),\n                            createLabel(finallyLabel),\n                            createLabel(endLabel)\n                        ])\n                    ])));\n                    currentExceptionBlock = undefined;\n                }\n                if (markLabelEnd) {\n                    // The case clause for the last label falls through to this label, so we\n                    // add an assignment statement to reflect the change in labels.\n                    statements.push(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(state, \"label\"), ts.createLiteral(labelNumber + 1))));\n                }\n            }\n            clauses.push(ts.createCaseClause(ts.createLiteral(labelNumber), statements || []));\n            statements = undefined;\n        }\n        /**\n         * Tries to enter into a new label at the current operation index.\n         */\n        function tryEnterLabel(operationIndex) {\n            if (!labelOffsets) {\n                return;\n            }\n            for (var label = 0; label < labelOffsets.length; label++) {\n                if (labelOffsets[label] === operationIndex) {\n                    flushLabel();\n                    if (labelNumbers === undefined) {\n                        labelNumbers = [];\n                    }\n                    if (labelNumbers[labelNumber] === undefined) {\n                        labelNumbers[labelNumber] = [label];\n                    }\n                    else {\n                        labelNumbers[labelNumber].push(label);\n                    }\n                }\n            }\n        }\n        /**\n         * Updates literal expressions for labels with actual label numbers.\n         */\n        function updateLabelExpressions() {\n            if (labelExpressions !== undefined && labelNumbers !== undefined) {\n                for (var labelNumber_1 = 0; labelNumber_1 < labelNumbers.length; labelNumber_1++) {\n                    var labels = labelNumbers[labelNumber_1];\n                    if (labels !== undefined) {\n                        for (var _i = 0, labels_1 = labels; _i < labels_1.length; _i++) {\n                            var label = labels_1[_i];\n                            var expressions = labelExpressions[label];\n                            if (expressions !== undefined) {\n                                for (var _a = 0, expressions_1 = expressions; _a < expressions_1.length; _a++) {\n                                    var expression = expressions_1[_a];\n                                    expression.text = String(labelNumber_1);\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        /**\n         * Tries to enter or leave a code block.\n         */\n        function tryEnterOrLeaveBlock(operationIndex) {\n            if (blocks) {\n                for (; blockIndex < blockActions.length && blockOffsets[blockIndex] <= operationIndex; blockIndex++) {\n                    var block = blocks[blockIndex];\n                    var blockAction = blockActions[blockIndex];\n                    if (isExceptionBlock(block)) {\n                        if (blockAction === 0 /* Open */) {\n                            if (!exceptionBlockStack) {\n                                exceptionBlockStack = [];\n                            }\n                            if (!statements) {\n                                statements = [];\n                            }\n                            exceptionBlockStack.push(currentExceptionBlock);\n                            currentExceptionBlock = block;\n                        }\n                        else if (blockAction === 1 /* Close */) {\n                            currentExceptionBlock = exceptionBlockStack.pop();\n                        }\n                    }\n                    else if (isWithBlock(block)) {\n                        if (blockAction === 0 /* Open */) {\n                            if (!withBlockStack) {\n                                withBlockStack = [];\n                            }\n                            withBlockStack.push(block);\n                        }\n                        else if (blockAction === 1 /* Close */) {\n                            withBlockStack.pop();\n                        }\n                    }\n                }\n            }\n        }\n        /**\n         * Writes an operation as a statement to the current label's statement list.\n         *\n         * @param operation The OpCode of the operation\n         */\n        function writeOperation(operationIndex) {\n            tryEnterLabel(operationIndex);\n            tryEnterOrLeaveBlock(operationIndex);\n            // early termination, nothing else to process in this label\n            if (lastOperationWasAbrupt) {\n                return;\n            }\n            lastOperationWasAbrupt = false;\n            lastOperationWasCompletion = false;\n            var opcode = operations[operationIndex];\n            if (opcode === 0 /* Nop */) {\n                return;\n            }\n            else if (opcode === 10 /* Endfinally */) {\n                return writeEndfinally();\n            }\n            var args = operationArguments[operationIndex];\n            if (opcode === 1 /* Statement */) {\n                return writeStatement(args[0]);\n            }\n            var location = operationLocations[operationIndex];\n            switch (opcode) {\n                case 2 /* Assign */:\n                    return writeAssign(args[0], args[1], location);\n                case 3 /* Break */:\n                    return writeBreak(args[0], location);\n                case 4 /* BreakWhenTrue */:\n                    return writeBreakWhenTrue(args[0], args[1], location);\n                case 5 /* BreakWhenFalse */:\n                    return writeBreakWhenFalse(args[0], args[1], location);\n                case 6 /* Yield */:\n                    return writeYield(args[0], location);\n                case 7 /* YieldStar */:\n                    return writeYieldStar(args[0], location);\n                case 8 /* Return */:\n                    return writeReturn(args[0], location);\n                case 9 /* Throw */:\n                    return writeThrow(args[0], location);\n            }\n        }\n        /**\n         * Writes a statement to the current label's statement list.\n         *\n         * @param statement A statement to write.\n         */\n        function writeStatement(statement) {\n            if (statement) {\n                if (!statements) {\n                    statements = [statement];\n                }\n                else {\n                    statements.push(statement);\n                }\n            }\n        }\n        /**\n         * Writes an Assign operation to the current label's statement list.\n         *\n         * @param left The left-hand side of the assignment.\n         * @param right The right-hand side of the assignment.\n         * @param operationLocation The source map location for the operation.\n         */\n        function writeAssign(left, right, operationLocation) {\n            writeStatement(ts.createStatement(ts.createAssignment(left, right), operationLocation));\n        }\n        /**\n         * Writes a Throw operation to the current label's statement list.\n         *\n         * @param expression The value to throw.\n         * @param operationLocation The source map location for the operation.\n         */\n        function writeThrow(expression, operationLocation) {\n            lastOperationWasAbrupt = true;\n            lastOperationWasCompletion = true;\n            writeStatement(ts.createThrow(expression, operationLocation));\n        }\n        /**\n         * Writes a Return operation to the current label's statement list.\n         *\n         * @param expression The value to return.\n         * @param operationLocation The source map location for the operation.\n         */\n        function writeReturn(expression, operationLocation) {\n            lastOperationWasAbrupt = true;\n            lastOperationWasCompletion = true;\n            writeStatement(ts.createReturn(ts.createArrayLiteral(expression\n                ? [createInstruction(2 /* Return */), expression]\n                : [createInstruction(2 /* Return */)]), operationLocation));\n        }\n        /**\n         * Writes a Break operation to the current label's statement list.\n         *\n         * @param label The label for the Break.\n         * @param operationLocation The source map location for the operation.\n         */\n        function writeBreak(label, operationLocation) {\n            lastOperationWasAbrupt = true;\n            writeStatement(ts.createReturn(ts.createArrayLiteral([\n                createInstruction(3 /* Break */),\n                createLabel(label)\n            ]), operationLocation));\n        }\n        /**\n         * Writes a BreakWhenTrue operation to the current label's statement list.\n         *\n         * @param label The label for the Break.\n         * @param condition The condition for the Break.\n         * @param operationLocation The source map location for the operation.\n         */\n        function writeBreakWhenTrue(label, condition, operationLocation) {\n            writeStatement(ts.createIf(condition, ts.createReturn(ts.createArrayLiteral([\n                createInstruction(3 /* Break */),\n                createLabel(label)\n            ]), operationLocation)));\n        }\n        /**\n         * Writes a BreakWhenFalse operation to the current label's statement list.\n         *\n         * @param label The label for the Break.\n         * @param condition The condition for the Break.\n         * @param operationLocation The source map location for the operation.\n         */\n        function writeBreakWhenFalse(label, condition, operationLocation) {\n            writeStatement(ts.createIf(ts.createLogicalNot(condition), ts.createReturn(ts.createArrayLiteral([\n                createInstruction(3 /* Break */),\n                createLabel(label)\n            ]), operationLocation)));\n        }\n        /**\n         * Writes a Yield operation to the current label's statement list.\n         *\n         * @param expression The expression to yield.\n         * @param operationLocation The source map location for the operation.\n         */\n        function writeYield(expression, operationLocation) {\n            lastOperationWasAbrupt = true;\n            writeStatement(ts.createReturn(ts.createArrayLiteral(expression\n                ? [createInstruction(4 /* Yield */), expression]\n                : [createInstruction(4 /* Yield */)]), operationLocation));\n        }\n        /**\n         * Writes a YieldStar instruction to the current label's statement list.\n         *\n         * @param expression The expression to yield.\n         * @param operationLocation The source map location for the operation.\n         */\n        function writeYieldStar(expression, operationLocation) {\n            lastOperationWasAbrupt = true;\n            writeStatement(ts.createReturn(ts.createArrayLiteral([\n                createInstruction(5 /* YieldStar */),\n                expression\n            ]), operationLocation));\n        }\n        /**\n         * Writes an Endfinally instruction to the current label's statement list.\n         */\n        function writeEndfinally() {\n            lastOperationWasAbrupt = true;\n            writeStatement(ts.createReturn(ts.createArrayLiteral([\n                createInstruction(7 /* Endfinally */)\n            ])));\n        }\n    }\n    ts.transformGenerators = transformGenerators;\n    function createGeneratorHelper(context, body) {\n        context.requestEmitHelper(generatorHelper);\n        return ts.createCall(ts.getHelperName(\"__generator\"), \n        /*typeArguments*/ undefined, [ts.createThis(), body]);\n    }\n    // The __generator helper is used by down-level transformations to emulate the runtime\n    // semantics of an ES2015 generator function. When called, this helper returns an\n    // object that implements the Iterator protocol, in that it has `next`, `return`, and\n    // `throw` methods that step through the generator when invoked.\n    //\n    // parameters:\n    //  thisArg  The value to use as the `this` binding for the transformed generator body.\n    //  body     A function that acts as the transformed generator body.\n    //\n    // variables:\n    //  _       Persistent state for the generator that is shared between the helper and the\n    //          generator body. The state object has the following members:\n    //            sent() - A method that returns or throws the current completion value.\n    //            label  - The next point at which to resume evaluation of the generator body.\n    //            trys   - A stack of protected regions (try/catch/finally blocks).\n    //            ops    - A stack of pending instructions when inside of a finally block.\n    //  f       A value indicating whether the generator is executing.\n    //  y       An iterator to delegate for a yield*.\n    //  t       A temporary variable that holds one of the following values (note that these\n    //          cases do not overlap):\n    //          - The completion value when resuming from a `yield` or `yield*`.\n    //          - The error value for a catch block.\n    //          - The current protected region (array of try/catch/finally/end labels).\n    //          - The verb (`next`, `throw`, or `return` method) to delegate to the expression\n    //            of a `yield*`.\n    //          - The result of evaluating the verb delegated to the expression of a `yield*`.\n    //\n    // functions:\n    //  verb(n)     Creates a bound callback to the `step` function for opcode `n`.\n    //  step(op)    Evaluates opcodes in a generator body until execution is suspended or\n    //              completed.\n    //\n    // The __generator helper understands a limited set of instructions:\n    //  0: next(value?)     - Start or resume the generator with the specified value.\n    //  1: throw(error)     - Resume the generator with an exception. If the generator is\n    //                        suspended inside of one or more protected regions, evaluates\n    //                        any intervening finally blocks between the current label and\n    //                        the nearest catch block or function boundary. If uncaught, the\n    //                        exception is thrown to the caller.\n    //  2: return(value?)   - Resume the generator as if with a return. If the generator is\n    //                        suspended inside of one or more protected regions, evaluates any\n    //                        intervening finally blocks.\n    //  3: break(label)     - Jump to the specified label. If the label is outside of the\n    //                        current protected region, evaluates any intervening finally\n    //                        blocks.\n    //  4: yield(value?)    - Yield execution to the caller with an optional value. When\n    //                        resumed, the generator will continue at the next label.\n    //  5: yield*(value)    - Delegates evaluation to the supplied iterator. When\n    //                        delegation completes, the generator will continue at the next\n    //                        label.\n    //  6: catch(error)     - Handles an exception thrown from within the generator body. If\n    //                        the current label is inside of one or more protected regions,\n    //                        evaluates any intervening finally blocks between the current\n    //                        label and the nearest catch block or function boundary. If\n    //                        uncaught, the exception is thrown to the caller.\n    //  7: endfinally       - Ends a finally block, resuming the last instruction prior to\n    //                        entering a finally block.\n    //\n    // For examples of how these are used, see the comments in ./transformers/generators.ts\n    var generatorHelper = {\n        name: \"typescript:generator\",\n        scoped: false,\n        priority: 6,\n        text: \"\\n            var __generator = (this && this.__generator) || function (thisArg, body) {\\n                var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\\n                return { next: verb(0), \\\"throw\\\": verb(1), \\\"return\\\": verb(2) };\\n                function verb(n) { return function (v) { return step([n, v]); }; }\\n                function step(op) {\\n                    if (f) throw new TypeError(\\\"Generator is already executing.\\\");\\n                    while (_) try {\\n                        if (f = 1, y && (t = y[op[0] & 2 ? \\\"return\\\" : op[0] ? \\\"throw\\\" : \\\"next\\\"]) && !(t = t.call(y, op[1])).done) return t;\\n                        if (y = 0, t) op = [0, t.value];\\n                        switch (op[0]) {\\n                            case 0: case 1: t = op; break;\\n                            case 4: _.label++; return { value: op[1], done: false };\\n                            case 5: _.label++; y = op[1]; op = [0]; continue;\\n                            case 7: op = _.ops.pop(); _.trys.pop(); continue;\\n                            default:\\n                                if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\\n                                if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\\n                                if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\\n                                if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\\n                                if (t[2]) _.ops.pop();\\n                                _.trys.pop(); continue;\\n                        }\\n                        op = body.call(thisArg, _);\\n                    } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\\n                    if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\\n                }\\n            };\"\n    };\n    var _a;\n})(ts || (ts = {}));\n/// <reference path=\"../factory.ts\" />\n/// <reference path=\"../visitor.ts\" />\n/*@internal*/\nvar ts;\n(function (ts) {\n    /**\n     * Transforms ES5 syntax into ES3 syntax.\n     *\n     * @param context Context and state information for the transformation.\n     */\n    function transformES5(context) {\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        context.onSubstituteNode = onSubstituteNode;\n        context.enableSubstitution(177 /* PropertyAccessExpression */);\n        context.enableSubstitution(257 /* PropertyAssignment */);\n        return transformSourceFile;\n        /**\n         * Transforms an ES5 source file to ES3.\n         *\n         * @param node A SourceFile\n         */\n        function transformSourceFile(node) {\n            return node;\n        }\n        /**\n         * Hooks node substitutions.\n         *\n         * @param emitContext The context for the emitter.\n         * @param node The node to substitute.\n         */\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (ts.isPropertyAccessExpression(node)) {\n                return substitutePropertyAccessExpression(node);\n            }\n            else if (ts.isPropertyAssignment(node)) {\n                return substitutePropertyAssignment(node);\n            }\n            return node;\n        }\n        /**\n         * Substitutes a PropertyAccessExpression whose name is a reserved word.\n         *\n         * @param node A PropertyAccessExpression\n         */\n        function substitutePropertyAccessExpression(node) {\n            var literalName = trySubstituteReservedName(node.name);\n            if (literalName) {\n                return ts.createElementAccess(node.expression, literalName, /*location*/ node);\n            }\n            return node;\n        }\n        /**\n         * Substitutes a PropertyAssignment whose name is a reserved word.\n         *\n         * @param node A PropertyAssignment\n         */\n        function substitutePropertyAssignment(node) {\n            var literalName = ts.isIdentifier(node.name) && trySubstituteReservedName(node.name);\n            if (literalName) {\n                return ts.updatePropertyAssignment(node, literalName, node.initializer);\n            }\n            return node;\n        }\n        /**\n         * If an identifier name is a reserved word, returns a string literal for the name.\n         *\n         * @param name An Identifier\n         */\n        function trySubstituteReservedName(name) {\n            var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(name.text) : undefined);\n            if (token >= 71 /* FirstReservedWord */ && token <= 106 /* LastReservedWord */) {\n                return ts.createLiteral(name, /*location*/ name);\n            }\n            return undefined;\n        }\n    }\n    ts.transformES5 = transformES5;\n})(ts || (ts = {}));\n/// <reference path=\"../../factory.ts\" />\n/// <reference path=\"../../visitor.ts\" />\n/*@internal*/\nvar ts;\n(function (ts) {\n    function transformES2015Module(context) {\n        var compilerOptions = context.getCompilerOptions();\n        var previousOnEmitNode = context.onEmitNode;\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        context.onEmitNode = onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        context.enableEmitNotification(261 /* SourceFile */);\n        context.enableSubstitution(70 /* Identifier */);\n        var currentSourceFile;\n        return transformSourceFile;\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)) {\n                return node;\n            }\n            if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {\n                var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions);\n                if (externalHelpersModuleName) {\n                    var statements = [];\n                    var statementOffset = ts.addPrologueDirectives(statements, node.statements);\n                    ts.append(statements, ts.createImportDeclaration(\n                    /*decorators*/ undefined, \n                    /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)));\n                    ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));\n                    return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));\n                }\n                else {\n                    return ts.visitEachChild(node, visitor, context);\n                }\n            }\n            return node;\n        }\n        function visitor(node) {\n            switch (node.kind) {\n                case 234 /* ImportEqualsDeclaration */:\n                    // Elide `import=` as it is not legal with --module ES6\n                    return undefined;\n                case 240 /* ExportAssignment */:\n                    return visitExportAssignment(node);\n            }\n            return node;\n        }\n        function visitExportAssignment(node) {\n            // Elide `export=` as it is not legal with --module ES6\n            return node.isExportEquals ? undefined : node;\n        }\n        //\n        // Emit Notification\n        //\n        /**\n         * Hook for node emit.\n         *\n         * @param emitContext A context hint for the emitter.\n         * @param node The node to emit.\n         * @param emit A callback used to emit the node in the printer.\n         */\n        function onEmitNode(emitContext, node, emitCallback) {\n            if (ts.isSourceFile(node)) {\n                currentSourceFile = node;\n                previousOnEmitNode(emitContext, node, emitCallback);\n                currentSourceFile = undefined;\n            }\n            else {\n                previousOnEmitNode(emitContext, node, emitCallback);\n            }\n        }\n        //\n        // Substitutions\n        //\n        /**\n         * Hooks node substitutions.\n         *\n         * @param emitContext A context hint for the emitter.\n         * @param node The node to substitute.\n         */\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (ts.isIdentifier(node) && emitContext === 1 /* Expression */) {\n                return substituteExpressionIdentifier(node);\n            }\n            return node;\n        }\n        function substituteExpressionIdentifier(node) {\n            if (ts.getEmitFlags(node) & 4096 /* HelperName */) {\n                var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);\n                if (externalHelpersModuleName) {\n                    return ts.createPropertyAccess(externalHelpersModuleName, node);\n                }\n            }\n            return node;\n        }\n    }\n    ts.transformES2015Module = transformES2015Module;\n})(ts || (ts = {}));\n/// <reference path=\"../../factory.ts\" />\n/// <reference path=\"../../visitor.ts\" />\n/*@internal*/\nvar ts;\n(function (ts) {\n    function transformSystemModule(context) {\n        var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;\n        var compilerOptions = context.getCompilerOptions();\n        var resolver = context.getEmitResolver();\n        var host = context.getEmitHost();\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        var previousOnEmitNode = context.onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        context.onEmitNode = onEmitNode;\n        context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers for imported symbols.\n        context.enableSubstitution(192 /* BinaryExpression */); // Substitutes assignments to exported symbols.\n        context.enableSubstitution(190 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.\n        context.enableSubstitution(191 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.\n        context.enableEmitNotification(261 /* SourceFile */); // Restore state when substituting nodes in a file.\n        var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file.\n        var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found.\n        var exportFunctionsMap = ts.createMap(); // The export function associated with a source file.\n        var noSubstitutionMap = ts.createMap(); // Set of nodes for which substitution rules should be ignored for each file.\n        var currentSourceFile; // The current file.\n        var moduleInfo; // ExternalModuleInfo for the current file.\n        var exportFunction; // The export function for the current file.\n        var contextObject; // The context object for the current file.\n        var hoistedStatements;\n        var enclosingBlockScopedContainer;\n        var noSubstitution; // Set of nodes for which substitution rules should be ignored.\n        return transformSourceFile;\n        /**\n         * Transforms the module aspects of a SourceFile.\n         *\n         * @param node The SourceFile node.\n         */\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)\n                || !(ts.isExternalModule(node)\n                    || compilerOptions.isolatedModules)) {\n                return node;\n            }\n            var id = ts.getOriginalNodeId(node);\n            currentSourceFile = node;\n            enclosingBlockScopedContainer = node;\n            // System modules have the following shape:\n            //\n            //     System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */})\n            //\n            // The parameter 'exports' here is a callback '<T>(name: string, value: T) => T' that\n            // is used to publish exported values. 'exports' returns its 'value' argument so in\n            // most cases expressions that mutate exported values can be rewritten as:\n            //\n            //     expr -> exports('name', expr)\n            //\n            // The only exception in this rule is postfix unary operators,\n            // see comment to 'substitutePostfixUnaryExpression' for more details\n            // Collect information about the external module and dependency groups.\n            moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions);\n            // Make sure that the name of the 'exports' function does not conflict with\n            // existing identifiers.\n            exportFunction = exportFunctionsMap[id] = ts.createUniqueName(\"exports\");\n            contextObject = ts.createUniqueName(\"context\");\n            // Add the body of the module.\n            var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports);\n            var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups);\n            var moduleBodyFunction = ts.createFunctionExpression(\n            /*modifiers*/ undefined, \n            /*asteriskToken*/ undefined, \n            /*name*/ undefined, \n            /*typeParameters*/ undefined, [\n                ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, exportFunction),\n                ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, contextObject)\n            ], \n            /*type*/ undefined, moduleBodyBlock);\n            // Write the call to `System.register`\n            // Clear the emit-helpers flag for later passes since we'll have already used it in the module body\n            // So the helper will be emit at the correct position instead of at the top of the source-file\n            var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);\n            var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; }));\n            var updated = ts.updateSourceFileNode(node, ts.createNodeArray([\n                ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier(\"System\"), \"register\"), \n                /*typeArguments*/ undefined, moduleName\n                    ? [moduleName, dependencies, moduleBodyFunction]\n                    : [dependencies, moduleBodyFunction]))\n            ], node.statements));\n            if (!(compilerOptions.outFile || compilerOptions.out)) {\n                ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; });\n            }\n            if (noSubstitution) {\n                noSubstitutionMap[id] = noSubstitution;\n                noSubstitution = undefined;\n            }\n            currentSourceFile = undefined;\n            moduleInfo = undefined;\n            exportFunction = undefined;\n            contextObject = undefined;\n            hoistedStatements = undefined;\n            enclosingBlockScopedContainer = undefined;\n            return ts.aggregateTransformFlags(updated);\n        }\n        /**\n         * Collects the dependency groups for this files imports.\n         *\n         * @param externalImports The imports for the file.\n         */\n        function collectDependencyGroups(externalImports) {\n            var groupIndices = ts.createMap();\n            var dependencyGroups = [];\n            for (var i = 0; i < externalImports.length; i++) {\n                var externalImport = externalImports[i];\n                var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions);\n                var text = externalModuleName.text;\n                if (ts.hasProperty(groupIndices, text)) {\n                    // deduplicate/group entries in dependency list by the dependency name\n                    var groupIndex = groupIndices[text];\n                    dependencyGroups[groupIndex].externalImports.push(externalImport);\n                }\n                else {\n                    groupIndices[text] = dependencyGroups.length;\n                    dependencyGroups.push({\n                        name: externalModuleName,\n                        externalImports: [externalImport]\n                    });\n                }\n            }\n            return dependencyGroups;\n        }\n        /**\n         * Adds the statements for the module body function for the source file.\n         *\n         * @param node The source file for the module.\n         * @param dependencyGroups The grouped dependencies of the module.\n         */\n        function createSystemModuleBody(node, dependencyGroups) {\n            // Shape of the body in system modules:\n            //\n            //  function (exports) {\n            //      <list of local aliases for imports>\n            //      <hoisted variable declarations>\n            //      <hoisted function declarations>\n            //      return {\n            //          setters: [\n            //              <list of setter function for imports>\n            //          ],\n            //          execute: function() {\n            //              <module statements>\n            //          }\n            //      }\n            //      <temp declarations>\n            //  }\n            //\n            // i.e:\n            //\n            //   import {x} from 'file1'\n            //   var y = 1;\n            //   export function foo() { return y + x(); }\n            //   console.log(y);\n            //\n            // Will be transformed to:\n            //\n            //  function(exports) {\n            //      function foo() { return y + file_1.x(); }\n            //      exports(\"foo\", foo);\n            //      var file_1, y;\n            //      return {\n            //          setters: [\n            //              function(v) { file_1 = v }\n            //          ],\n            //          execute(): function() {\n            //              y = 1;\n            //              console.log(y);\n            //          }\n            //      };\n            //  }\n            var statements = [];\n            // We start a new lexical environment in this function body, but *not* in the\n            // body of the execute function. This allows us to emit temporary declarations\n            // only in the outer module body and not in the inner one.\n            startLexicalEnvironment();\n            // Add any prologue directives.\n            var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor);\n            // var __moduleName = context_1 && context_1.id;\n            statements.push(ts.createVariableStatement(\n            /*modifiers*/ undefined, ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(\"__moduleName\", \n                /*type*/ undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, \"id\")))\n            ])));\n            // Visit the synthetic external helpers import declaration if present\n            ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true);\n            // Visit the statements of the source file, emitting any transformations into\n            // the `executeStatements` array. We do this *before* we fill the `setters` array\n            // as we both emit transformations as well as aggregate some data used when creating\n            // setters. This allows us to reduce the number of times we need to loop through the\n            // statements of the source file.\n            var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset);\n            // Emit early exports for function declarations.\n            ts.addRange(statements, hoistedStatements);\n            // We emit hoisted variables early to align roughly with our previous emit output.\n            // Two key differences in this approach are:\n            // - Temporary variables will appear at the top rather than at the bottom of the file\n            ts.addRange(statements, endLexicalEnvironment());\n            var exportStarFunction = addExportStarIfNeeded(statements);\n            statements.push(ts.createReturn(ts.setMultiLine(ts.createObjectLiteral([\n                ts.createPropertyAssignment(\"setters\", createSettersArray(exportStarFunction, dependencyGroups)),\n                ts.createPropertyAssignment(\"execute\", ts.createFunctionExpression(\n                /*modifiers*/ undefined, \n                /*asteriskToken*/ undefined, \n                /*name*/ undefined, \n                /*typeParameters*/ undefined, \n                /*parameters*/ [], \n                /*type*/ undefined, ts.createBlock(executeStatements, \n                /*location*/ undefined, \n                /*multiLine*/ true)))\n            ]), \n            /*multiLine*/ true)));\n            return ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true);\n        }\n        /**\n         * Adds an exportStar function to a statement list if it is needed for the file.\n         *\n         * @param statements A statement list.\n         */\n        function addExportStarIfNeeded(statements) {\n            if (!moduleInfo.hasExportStarsToExportValues) {\n                return;\n            }\n            // when resolving exports local exported entries/indirect exported entries in the module\n            // should always win over entries with similar names that were added via star exports\n            // to support this we store names of local/indirect exported entries in a set.\n            // this set is used to filter names brought by star expors.\n            // local names set should only be added if we have anything exported\n            if (!moduleInfo.exportedNames && ts.isEmpty(moduleInfo.exportSpecifiers)) {\n                // no exported declarations (export var ...) or export specifiers (export {x})\n                // check if we have any non star export declarations.\n                var hasExportDeclarationWithExportClause = false;\n                for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) {\n                    var externalImport = _a[_i];\n                    if (externalImport.kind === 241 /* ExportDeclaration */ && externalImport.exportClause) {\n                        hasExportDeclarationWithExportClause = true;\n                        break;\n                    }\n                }\n                if (!hasExportDeclarationWithExportClause) {\n                    // we still need to emit exportStar helper\n                    var exportStarFunction_1 = createExportStarFunction(/*localNames*/ undefined);\n                    statements.push(exportStarFunction_1);\n                    return exportStarFunction_1.name;\n                }\n            }\n            var exportedNames = [];\n            if (moduleInfo.exportedNames) {\n                for (var _b = 0, _c = moduleInfo.exportedNames; _b < _c.length; _b++) {\n                    var exportedLocalName = _c[_b];\n                    if (exportedLocalName.text === \"default\") {\n                        continue;\n                    }\n                    // write name of exported declaration, i.e 'export var x...'\n                    exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName), ts.createLiteral(true)));\n                }\n            }\n            for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) {\n                var externalImport = _e[_d];\n                if (externalImport.kind !== 241 /* ExportDeclaration */) {\n                    continue;\n                }\n                var exportDecl = externalImport;\n                if (!exportDecl.exportClause) {\n                    // export * from ...\n                    continue;\n                }\n                for (var _f = 0, _g = exportDecl.exportClause.elements; _f < _g.length; _f++) {\n                    var element = _g[_f];\n                    // write name of indirectly exported entry, i.e. 'export {x} from ...'\n                    exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createLiteral(true)));\n                }\n            }\n            var exportedNamesStorageRef = ts.createUniqueName(\"exportedNames\");\n            statements.push(ts.createVariableStatement(\n            /*modifiers*/ undefined, ts.createVariableDeclarationList([\n                ts.createVariableDeclaration(exportedNamesStorageRef, \n                /*type*/ undefined, ts.createObjectLiteral(exportedNames, /*location*/ undefined, /*multiline*/ true))\n            ])));\n            var exportStarFunction = createExportStarFunction(exportedNamesStorageRef);\n            statements.push(exportStarFunction);\n            return exportStarFunction.name;\n        }\n        /**\n         * Creates an exportStar function for the file, with an optional set of excluded local\n         * names.\n         *\n         * @param localNames An optional reference to an object containing a set of excluded local\n         * names.\n         */\n        function createExportStarFunction(localNames) {\n            var exportStarFunction = ts.createUniqueName(\"exportStar\");\n            var m = ts.createIdentifier(\"m\");\n            var n = ts.createIdentifier(\"n\");\n            var exports = ts.createIdentifier(\"exports\");\n            var condition = ts.createStrictInequality(n, ts.createLiteral(\"default\"));\n            if (localNames) {\n                condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, \"hasOwnProperty\"), \n                /*typeArguments*/ undefined, [n])));\n            }\n            return ts.createFunctionDeclaration(\n            /*decorators*/ undefined, \n            /*modifiers*/ undefined, \n            /*asteriskToken*/ undefined, exportStarFunction, \n            /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, m)], \n            /*type*/ undefined, ts.createBlock([\n                ts.createVariableStatement(\n                /*modifiers*/ undefined, ts.createVariableDeclarationList([\n                    ts.createVariableDeclaration(exports, \n                    /*type*/ undefined, ts.createObjectLiteral([]))\n                ])),\n                ts.createForIn(ts.createVariableDeclarationList([\n                    ts.createVariableDeclaration(n, /*type*/ undefined)\n                ]), m, ts.createBlock([\n                    ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1 /* SingleLine */)\n                ])),\n                ts.createStatement(ts.createCall(exportFunction, \n                /*typeArguments*/ undefined, [exports]))\n            ], \n            /*location*/ undefined, \n            /*multiline*/ true));\n        }\n        /**\n         * Creates an array setter callbacks for each dependency group.\n         *\n         * @param exportStarFunction A reference to an exportStarFunction for the file.\n         * @param dependencyGroups An array of grouped dependencies.\n         */\n        function createSettersArray(exportStarFunction, dependencyGroups) {\n            var setters = [];\n            for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) {\n                var group = dependencyGroups_1[_i];\n                // derive a unique name for parameter from the first named entry in the group\n                var localName = ts.forEach(group.externalImports, function (i) { return ts.getLocalNameForExternalImport(i, currentSourceFile); });\n                var parameterName = localName ? ts.getGeneratedNameForNode(localName) : ts.createUniqueName(\"\");\n                var statements = [];\n                for (var _a = 0, _b = group.externalImports; _a < _b.length; _a++) {\n                    var entry = _b[_a];\n                    var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile);\n                    switch (entry.kind) {\n                        case 235 /* ImportDeclaration */:\n                            if (!entry.importClause) {\n                                // 'import \"...\"' case\n                                // module is imported only for side-effects, no emit required\n                                break;\n                            }\n                        // fall-through\n                        case 234 /* ImportEqualsDeclaration */:\n                            ts.Debug.assert(importVariableName !== undefined);\n                            // save import into the local\n                            statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName)));\n                            break;\n                        case 241 /* ExportDeclaration */:\n                            ts.Debug.assert(importVariableName !== undefined);\n                            if (entry.exportClause) {\n                                //  export {a, b as c} from 'foo'\n                                //\n                                // emit as:\n                                //\n                                //  exports_({\n                                //     \"a\": _[\"a\"],\n                                //     \"c\": _[\"b\"]\n                                //  });\n                                var properties = [];\n                                for (var _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) {\n                                    var e = _d[_c];\n                                    properties.push(ts.createPropertyAssignment(ts.createLiteral(e.name.text), ts.createElementAccess(parameterName, ts.createLiteral((e.propertyName || e.name).text))));\n                                }\n                                statements.push(ts.createStatement(ts.createCall(exportFunction, \n                                /*typeArguments*/ undefined, [ts.createObjectLiteral(properties, /*location*/ undefined, /*multiline*/ true)])));\n                            }\n                            else {\n                                //  export * from 'foo'\n                                //\n                                // emit as:\n                                //\n                                //  exportStar(foo_1_1);\n                                statements.push(ts.createStatement(ts.createCall(exportStarFunction, \n                                /*typeArguments*/ undefined, [parameterName])));\n                            }\n                            break;\n                    }\n                }\n                setters.push(ts.createFunctionExpression(\n                /*modifiers*/ undefined, \n                /*asteriskToken*/ undefined, \n                /*name*/ undefined, \n                /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, parameterName)], \n                /*type*/ undefined, ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true)));\n            }\n            return ts.createArrayLiteral(setters, /*location*/ undefined, /*multiLine*/ true);\n        }\n        //\n        // Top-level Source Element Visitors\n        //\n        /**\n         * Visit source elements at the top-level of a module.\n         *\n         * @param node The node to visit.\n         */\n        function sourceElementVisitor(node) {\n            switch (node.kind) {\n                case 235 /* ImportDeclaration */:\n                    return visitImportDeclaration(node);\n                case 234 /* ImportEqualsDeclaration */:\n                    return visitImportEqualsDeclaration(node);\n                case 241 /* ExportDeclaration */:\n                    // ExportDeclarations are elided as they are handled via\n                    // `appendExportsOfDeclaration`.\n                    return undefined;\n                case 240 /* ExportAssignment */:\n                    return visitExportAssignment(node);\n                default:\n                    return nestedElementVisitor(node);\n            }\n        }\n        /**\n         * Visits an ImportDeclaration node.\n         *\n         * @param node The node to visit.\n         */\n        function visitImportDeclaration(node) {\n            var statements;\n            if (node.importClause) {\n                hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile));\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                // Defer exports until we encounter an EndOfDeclarationMarker node\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfImportDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        /**\n         * Visits an ImportEqualsDeclaration node.\n         *\n         * @param node The node to visit.\n         */\n        function visitImportEqualsDeclaration(node) {\n            ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), \"import= for internal module references should be handled in an earlier transformer.\");\n            var statements;\n            hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile));\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                // Defer exports until we encounter an EndOfDeclarationMarker node\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfImportEqualsDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        /**\n         * Visits an ExportAssignment node.\n         *\n         * @param node The node to visit.\n         */\n        function visitExportAssignment(node) {\n            if (node.isExportEquals) {\n                // Elide `export=` as it is illegal in a SystemJS module.\n                return undefined;\n            }\n            var expression = ts.visitNode(node.expression, destructuringVisitor, ts.isExpression);\n            var original = node.original;\n            if (original && hasAssociatedEndOfDeclarationMarker(original)) {\n                // Defer exports until we encounter an EndOfDeclarationMarker node\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier(\"default\"), expression, /*allowComments*/ true);\n            }\n            else {\n                return createExportStatement(ts.createIdentifier(\"default\"), expression, /*allowComments*/ true);\n            }\n        }\n        /**\n         * Visits a FunctionDeclaration, hoisting it to the outer module body function.\n         *\n         * @param node The node to visit.\n         */\n        function visitFunctionDeclaration(node) {\n            if (ts.hasModifier(node, 1 /* Export */)) {\n                hoistedStatements = ts.append(hoistedStatements, ts.updateFunctionDeclaration(node, node.decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), \n                /*typeParameters*/ undefined, ts.visitNodes(node.parameters, destructuringVisitor, ts.isParameterDeclaration), \n                /*type*/ undefined, ts.visitNode(node.body, destructuringVisitor, ts.isBlock)));\n            }\n            else {\n                hoistedStatements = ts.append(hoistedStatements, node);\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                // Defer exports until we encounter an EndOfDeclarationMarker node\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);\n            }\n            else {\n                hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node);\n            }\n            return undefined;\n        }\n        /**\n         * Visits a ClassDeclaration, hoisting its name to the outer module body function.\n         *\n         * @param node The node to visit.\n         */\n        function visitClassDeclaration(node) {\n            var statements;\n            // Hoist the name of the class declaration to the outer module body function.\n            var name = ts.getLocalName(node);\n            hoistVariableDeclaration(name);\n            // Rewrite the class declaration into an assignment of a class expression.\n            statements = ts.append(statements, ts.createStatement(ts.createAssignment(name, ts.createClassExpression(\n            /*modifiers*/ undefined, node.name, \n            /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, destructuringVisitor, ts.isHeritageClause), ts.visitNodes(node.members, destructuringVisitor, ts.isClassElement), \n            /*location*/ node)), \n            /*location*/ node));\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                // Defer exports until we encounter an EndOfDeclarationMarker node\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfHoistedDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        /**\n         * Visits a variable statement, hoisting declared names to the top-level module body.\n         * Each declaration is rewritten into an assignment expression.\n         *\n         * @param node The node to visit.\n         */\n        function visitVariableStatement(node) {\n            if (!shouldHoistVariableDeclarationList(node.declarationList)) {\n                return ts.visitNode(node, destructuringVisitor, ts.isStatement);\n            }\n            var expressions;\n            var isExportedDeclaration = ts.hasModifier(node, 1 /* Export */);\n            var isMarkedDeclaration = hasAssociatedEndOfDeclarationMarker(node);\n            for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                var variable = _a[_i];\n                if (variable.initializer) {\n                    expressions = ts.append(expressions, transformInitializedVariable(variable, isExportedDeclaration && !isMarkedDeclaration));\n                }\n                else {\n                    hoistBindingElement(variable);\n                }\n            }\n            var statements;\n            if (expressions) {\n                statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), /*location*/ node));\n            }\n            if (isMarkedDeclaration) {\n                // Defer exports until we encounter an EndOfDeclarationMarker node\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration);\n            }\n            else {\n                statements = appendExportsOfVariableStatement(statements, node, /*exportSelf*/ false);\n            }\n            return ts.singleOrMany(statements);\n        }\n        /**\n         * Hoists the declared names of a VariableDeclaration or BindingElement.\n         *\n         * @param node The declaration to hoist.\n         */\n        function hoistBindingElement(node) {\n            if (ts.isBindingPattern(node.name)) {\n                for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        hoistBindingElement(element);\n                    }\n                }\n            }\n            else {\n                hoistVariableDeclaration(ts.getSynthesizedClone(node.name));\n            }\n        }\n        /**\n         * Determines whether a VariableDeclarationList should be hoisted.\n         *\n         * @param node The node to test.\n         */\n        function shouldHoistVariableDeclarationList(node) {\n            // hoist only non-block scoped declarations or block scoped declarations parented by source file\n            return (ts.getEmitFlags(node) & 1048576 /* NoHoisting */) === 0\n                && (enclosingBlockScopedContainer.kind === 261 /* SourceFile */\n                    || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0);\n        }\n        /**\n         * Transform an initialized variable declaration into an expression.\n         *\n         * @param node The node to transform.\n         * @param isExportedDeclaration A value indicating whether the variable is exported.\n         */\n        function transformInitializedVariable(node, isExportedDeclaration) {\n            var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment;\n            return ts.isBindingPattern(node.name)\n                ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */, \n                /*needsValue*/ false, createAssignment)\n                : createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression));\n        }\n        /**\n         * Creates an assignment expression for an exported variable declaration.\n         *\n         * @param name The name of the variable.\n         * @param value The value of the variable's initializer.\n         * @param location The source map location for the assignment.\n         */\n        function createExportedVariableAssignment(name, value, location) {\n            return createVariableAssignment(name, value, location, /*isExportedDeclaration*/ true);\n        }\n        /**\n         * Creates an assignment expression for a non-exported variable declaration.\n         *\n         * @param name The name of the variable.\n         * @param value The value of the variable's initializer.\n         * @param location The source map location for the assignment.\n         */\n        function createNonExportedVariableAssignment(name, value, location) {\n            return createVariableAssignment(name, value, location, /*isExportedDeclaration*/ false);\n        }\n        /**\n         * Creates an assignment expression for a variable declaration.\n         *\n         * @param name The name of the variable.\n         * @param value The value of the variable's initializer.\n         * @param location The source map location for the assignment.\n         * @param isExportedDeclaration A value indicating whether the variable is exported.\n         */\n        function createVariableAssignment(name, value, location, isExportedDeclaration) {\n            hoistVariableDeclaration(ts.getSynthesizedClone(name));\n            return isExportedDeclaration\n                ? createExportExpression(name, preventSubstitution(ts.createAssignment(name, value, location)))\n                : preventSubstitution(ts.createAssignment(name, value, location));\n        }\n        /**\n         * Visits a MergeDeclarationMarker used as a placeholder for the beginning of a merged\n         * and transformed declaration.\n         *\n         * @param node The node to visit.\n         */\n        function visitMergeDeclarationMarker(node) {\n            // For an EnumDeclaration or ModuleDeclaration that merges with a preceeding\n            // declaration we do not emit a leading variable declaration. To preserve the\n            // begin/end semantics of the declararation and to properly handle exports\n            // we wrapped the leading variable declaration in a `MergeDeclarationMarker`.\n            //\n            // To balance the declaration, we defer the exports of the elided variable\n            // statement until we visit this declaration's `EndOfDeclarationMarker`.\n            if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205 /* VariableStatement */) {\n                var id = ts.getOriginalNodeId(node);\n                var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */);\n                deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration);\n            }\n            return node;\n        }\n        /**\n         * Determines whether a node has an associated EndOfDeclarationMarker.\n         *\n         * @param node The node to test.\n         */\n        function hasAssociatedEndOfDeclarationMarker(node) {\n            return (ts.getEmitFlags(node) & 2097152 /* HasEndOfDeclarationMarker */) !== 0;\n        }\n        /**\n         * Visits a DeclarationMarker used as a placeholder for the end of a transformed\n         * declaration.\n         *\n         * @param node The node to visit.\n         */\n        function visitEndOfDeclarationMarker(node) {\n            // For some transformations we emit an `EndOfDeclarationMarker` to mark the actual\n            // end of the transformed declaration. We use this marker to emit any deferred exports\n            // of the declaration.\n            var id = ts.getOriginalNodeId(node);\n            var statements = deferredExports[id];\n            if (statements) {\n                delete deferredExports[id];\n                return ts.append(statements, node);\n            }\n            return node;\n        }\n        /**\n         * Appends the exports of an ImportDeclaration to a statement list, returning the\n         * statement list.\n         *\n         * @param statements A statement list to which the down-level export statements are to be\n         * appended. If `statements` is `undefined`, a new array is allocated if statements are\n         * appended.\n         * @param decl The declaration whose exports are to be recorded.\n         */\n        function appendExportsOfImportDeclaration(statements, decl) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            var importClause = decl.importClause;\n            if (!importClause) {\n                return statements;\n            }\n            if (importClause.name) {\n                statements = appendExportsOfDeclaration(statements, importClause);\n            }\n            var namedBindings = importClause.namedBindings;\n            if (namedBindings) {\n                switch (namedBindings.kind) {\n                    case 237 /* NamespaceImport */:\n                        statements = appendExportsOfDeclaration(statements, namedBindings);\n                        break;\n                    case 238 /* NamedImports */:\n                        for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {\n                            var importBinding = _a[_i];\n                            statements = appendExportsOfDeclaration(statements, importBinding);\n                        }\n                        break;\n                }\n            }\n            return statements;\n        }\n        /**\n         * Appends the export of an ImportEqualsDeclaration to a statement list, returning the\n         * statement list.\n         *\n         * @param statements A statement list to which the down-level export statements are to be\n         * appended. If `statements` is `undefined`, a new array is allocated if statements are\n         * appended.\n         * @param decl The declaration whose exports are to be recorded.\n         */\n        function appendExportsOfImportEqualsDeclaration(statements, decl) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            return appendExportsOfDeclaration(statements, decl);\n        }\n        /**\n         * Appends the exports of a VariableStatement to a statement list, returning the statement\n         * list.\n         *\n         * @param statements A statement list to which the down-level export statements are to be\n         * appended. If `statements` is `undefined`, a new array is allocated if statements are\n         * appended.\n         * @param node The VariableStatement whose exports are to be recorded.\n         * @param exportSelf A value indicating whether to also export each VariableDeclaration of\n         * `nodes` declaration list.\n         */\n        function appendExportsOfVariableStatement(statements, node, exportSelf) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                var decl = _a[_i];\n                if (decl.initializer || exportSelf) {\n                    statements = appendExportsOfBindingElement(statements, decl, exportSelf);\n                }\n            }\n            return statements;\n        }\n        /**\n         * Appends the exports of a VariableDeclaration or BindingElement to a statement list,\n         * returning the statement list.\n         *\n         * @param statements A statement list to which the down-level export statements are to be\n         * appended. If `statements` is `undefined`, a new array is allocated if statements are\n         * appended.\n         * @param decl The declaration whose exports are to be recorded.\n         * @param exportSelf A value indicating whether to also export the declaration itself.\n         */\n        function appendExportsOfBindingElement(statements, decl, exportSelf) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            if (ts.isBindingPattern(decl.name)) {\n                for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        statements = appendExportsOfBindingElement(statements, element, exportSelf);\n                    }\n                }\n            }\n            else if (!ts.isGeneratedIdentifier(decl.name)) {\n                var excludeName = void 0;\n                if (exportSelf) {\n                    statements = appendExportStatement(statements, decl.name, ts.getLocalName(decl));\n                    excludeName = decl.name.text;\n                }\n                statements = appendExportsOfDeclaration(statements, decl, excludeName);\n            }\n            return statements;\n        }\n        /**\n         * Appends the exports of a ClassDeclaration or FunctionDeclaration to a statement list,\n         * returning the statement list.\n         *\n         * @param statements A statement list to which the down-level export statements are to be\n         * appended. If `statements` is `undefined`, a new array is allocated if statements are\n         * appended.\n         * @param decl The declaration whose exports are to be recorded.\n         */\n        function appendExportsOfHoistedDeclaration(statements, decl) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            var excludeName;\n            if (ts.hasModifier(decl, 1 /* Export */)) {\n                var exportName = ts.hasModifier(decl, 512 /* Default */) ? ts.createLiteral(\"default\") : decl.name;\n                statements = appendExportStatement(statements, exportName, ts.getLocalName(decl));\n                excludeName = exportName.text;\n            }\n            if (decl.name) {\n                statements = appendExportsOfDeclaration(statements, decl, excludeName);\n            }\n            return statements;\n        }\n        /**\n         * Appends the exports of a declaration to a statement list, returning the statement list.\n         *\n         * @param statements A statement list to which the down-level export statements are to be\n         * appended. If `statements` is `undefined`, a new array is allocated if statements are\n         * appended.\n         * @param decl The declaration to export.\n         * @param excludeName An optional name to exclude from exports.\n         */\n        function appendExportsOfDeclaration(statements, decl, excludeName) {\n            if (moduleInfo.exportEquals) {\n                return statements;\n            }\n            var name = ts.getDeclarationName(decl);\n            var exportSpecifiers = moduleInfo.exportSpecifiers[name.text];\n            if (exportSpecifiers) {\n                for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) {\n                    var exportSpecifier = exportSpecifiers_1[_i];\n                    if (exportSpecifier.name.text !== excludeName) {\n                        statements = appendExportStatement(statements, exportSpecifier.name, name);\n                    }\n                }\n            }\n            return statements;\n        }\n        /**\n         * Appends the down-level representation of an export to a statement list, returning the\n         * statement list.\n         *\n         * @param statements A statement list to which the down-level export statements are to be\n         * appended. If `statements` is `undefined`, a new array is allocated if statements are\n         * appended.\n         * @param exportName The name of the export.\n         * @param expression The expression to export.\n         * @param allowComments Whether to allow comments on the export.\n         */\n        function appendExportStatement(statements, exportName, expression, allowComments) {\n            statements = ts.append(statements, createExportStatement(exportName, expression, allowComments));\n            return statements;\n        }\n        /**\n         * Creates a call to the current file's export function to export a value.\n         *\n         * @param name The bound name of the export.\n         * @param value The exported value.\n         * @param allowComments An optional value indicating whether to emit comments for the statement.\n         */\n        function createExportStatement(name, value, allowComments) {\n            var statement = ts.createStatement(createExportExpression(name, value));\n            ts.startOnNewLine(statement);\n            if (!allowComments) {\n                ts.setEmitFlags(statement, 1536 /* NoComments */);\n            }\n            return statement;\n        }\n        /**\n         * Creates a call to the current file's export function to export a value.\n         *\n         * @param name The bound name of the export.\n         * @param value The exported value.\n         */\n        function createExportExpression(name, value) {\n            var exportName = ts.isIdentifier(name) ? ts.createLiteral(name) : name;\n            return ts.createCall(exportFunction, /*typeArguments*/ undefined, [exportName, value]);\n        }\n        //\n        // Top-Level or Nested Source Element Visitors\n        //\n        /**\n         * Visit nested elements at the top-level of a module.\n         *\n         * @param node The node to visit.\n         */\n        function nestedElementVisitor(node) {\n            switch (node.kind) {\n                case 205 /* VariableStatement */:\n                    return visitVariableStatement(node);\n                case 225 /* FunctionDeclaration */:\n                    return visitFunctionDeclaration(node);\n                case 226 /* ClassDeclaration */:\n                    return visitClassDeclaration(node);\n                case 211 /* ForStatement */:\n                    return visitForStatement(node);\n                case 212 /* ForInStatement */:\n                    return visitForInStatement(node);\n                case 213 /* ForOfStatement */:\n                    return visitForOfStatement(node);\n                case 209 /* DoStatement */:\n                    return visitDoStatement(node);\n                case 210 /* WhileStatement */:\n                    return visitWhileStatement(node);\n                case 219 /* LabeledStatement */:\n                    return visitLabeledStatement(node);\n                case 217 /* WithStatement */:\n                    return visitWithStatement(node);\n                case 218 /* SwitchStatement */:\n                    return visitSwitchStatement(node);\n                case 232 /* CaseBlock */:\n                    return visitCaseBlock(node);\n                case 253 /* CaseClause */:\n                    return visitCaseClause(node);\n                case 254 /* DefaultClause */:\n                    return visitDefaultClause(node);\n                case 221 /* TryStatement */:\n                    return visitTryStatement(node);\n                case 256 /* CatchClause */:\n                    return visitCatchClause(node);\n                case 204 /* Block */:\n                    return visitBlock(node);\n                case 295 /* MergeDeclarationMarker */:\n                    return visitMergeDeclarationMarker(node);\n                case 296 /* EndOfDeclarationMarker */:\n                    return visitEndOfDeclarationMarker(node);\n                default:\n                    return destructuringVisitor(node);\n            }\n        }\n        /**\n         * Visits the body of a ForStatement to hoist declarations.\n         *\n         * @param node The node to visit.\n         */\n        function visitForStatement(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.updateFor(node, visitForInitializer(node.initializer), ts.visitNode(node.condition, destructuringVisitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.incrementor, destructuringVisitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement));\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        /**\n         * Visits the body of a ForInStatement to hoist declarations.\n         *\n         * @param node The node to visit.\n         */\n        function visitForInStatement(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.updateForIn(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock));\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        /**\n         * Visits the body of a ForOfStatement to hoist declarations.\n         *\n         * @param node The node to visit.\n         */\n        function visitForOfStatement(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.updateForOf(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock));\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        /**\n         * Determines whether to hoist the initializer of a ForStatement, ForInStatement, or\n         * ForOfStatement.\n         *\n         * @param node The node to test.\n         */\n        function shouldHoistForInitializer(node) {\n            return ts.isVariableDeclarationList(node)\n                && shouldHoistVariableDeclarationList(node);\n        }\n        /**\n         * Visits the initializer of a ForStatement, ForInStatement, or ForOfStatement\n         *\n         * @param node The node to visit.\n         */\n        function visitForInitializer(node) {\n            if (shouldHoistForInitializer(node)) {\n                var expressions = void 0;\n                for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) {\n                    var variable = _a[_i];\n                    expressions = ts.append(expressions, transformInitializedVariable(variable, /*isExportedDeclaration*/ false));\n                }\n                return expressions ? ts.inlineExpressions(expressions) : ts.createOmittedExpression();\n            }\n            else {\n                return ts.visitEachChild(node, nestedElementVisitor, context);\n            }\n        }\n        /**\n         * Visits the body of a DoStatement to hoist declarations.\n         *\n         * @param node The node to visit.\n         */\n        function visitDoStatement(node) {\n            return ts.updateDo(node, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression));\n        }\n        /**\n         * Visits the body of a WhileStatement to hoist declarations.\n         *\n         * @param node The node to visit.\n         */\n        function visitWhileStatement(node) {\n            return ts.updateWhile(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock));\n        }\n        /**\n         * Visits the body of a LabeledStatement to hoist declarations.\n         *\n         * @param node The node to visit.\n         */\n        function visitLabeledStatement(node) {\n            return ts.updateLabel(node, node.label, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock));\n        }\n        /**\n         * Visits the body of a WithStatement to hoist declarations.\n         *\n         * @param node The node to visit.\n         */\n        function visitWithStatement(node) {\n            return ts.updateWith(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock));\n        }\n        /**\n         * Visits the body of a SwitchStatement to hoist declarations.\n         *\n         * @param node The node to visit.\n         */\n        function visitSwitchStatement(node) {\n            return ts.updateSwitch(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.caseBlock, nestedElementVisitor, ts.isCaseBlock));\n        }\n        /**\n         * Visits the body of a CaseBlock to hoist declarations.\n         *\n         * @param node The node to visit.\n         */\n        function visitCaseBlock(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.updateCaseBlock(node, ts.visitNodes(node.clauses, nestedElementVisitor, ts.isCaseOrDefaultClause));\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        /**\n         * Visits the body of a CaseClause to hoist declarations.\n         *\n         * @param node The node to visit.\n         */\n        function visitCaseClause(node) {\n            return ts.updateCaseClause(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNodes(node.statements, nestedElementVisitor, ts.isStatement));\n        }\n        /**\n         * Visits the body of a DefaultClause to hoist declarations.\n         *\n         * @param node The node to visit.\n         */\n        function visitDefaultClause(node) {\n            return ts.visitEachChild(node, nestedElementVisitor, context);\n        }\n        /**\n         * Visits the body of a TryStatement to hoist declarations.\n         *\n         * @param node The node to visit.\n         */\n        function visitTryStatement(node) {\n            return ts.visitEachChild(node, nestedElementVisitor, context);\n        }\n        /**\n         * Visits the body of a CatchClause to hoist declarations.\n         *\n         * @param node The node to visit.\n         */\n        function visitCatchClause(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.updateCatchClause(node, node.variableDeclaration, ts.visitNode(node.block, nestedElementVisitor, ts.isBlock));\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        /**\n         * Visits the body of a Block to hoist declarations.\n         *\n         * @param node The node to visit.\n         */\n        function visitBlock(node) {\n            var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;\n            enclosingBlockScopedContainer = node;\n            node = ts.visitEachChild(node, nestedElementVisitor, context);\n            enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;\n            return node;\n        }\n        //\n        // Destructuring Assignment Visitors\n        //\n        /**\n         * Visit nodes to flatten destructuring assignments to exported symbols.\n         *\n         * @param node The node to visit.\n         */\n        function destructuringVisitor(node) {\n            if (node.transformFlags & 1024 /* DestructuringAssignment */\n                && node.kind === 192 /* BinaryExpression */) {\n                return visitDestructuringAssignment(node);\n            }\n            else if (node.transformFlags & 2048 /* ContainsDestructuringAssignment */) {\n                return ts.visitEachChild(node, destructuringVisitor, context);\n            }\n            else {\n                return node;\n            }\n        }\n        /**\n         * Visits a DestructuringAssignment to flatten destructuring to exported symbols.\n         *\n         * @param node The node to visit.\n         */\n        function visitDestructuringAssignment(node) {\n            if (hasExportedReferenceInDestructuringTarget(node.left)) {\n                return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */, \n                /*needsValue*/ true);\n            }\n            return ts.visitEachChild(node, destructuringVisitor, context);\n        }\n        /**\n         * Determines whether the target of a destructuring assigment refers to an exported symbol.\n         *\n         * @param node The destructuring target.\n         */\n        function hasExportedReferenceInDestructuringTarget(node) {\n            if (ts.isAssignmentExpression(node)) {\n                return hasExportedReferenceInDestructuringTarget(node.left);\n            }\n            else if (ts.isSpreadExpression(node)) {\n                return hasExportedReferenceInDestructuringTarget(node.expression);\n            }\n            else if (ts.isObjectLiteralExpression(node)) {\n                return ts.some(node.properties, hasExportedReferenceInDestructuringTarget);\n            }\n            else if (ts.isArrayLiteralExpression(node)) {\n                return ts.some(node.elements, hasExportedReferenceInDestructuringTarget);\n            }\n            else if (ts.isShorthandPropertyAssignment(node)) {\n                return hasExportedReferenceInDestructuringTarget(node.name);\n            }\n            else if (ts.isPropertyAssignment(node)) {\n                return hasExportedReferenceInDestructuringTarget(node.initializer);\n            }\n            else if (ts.isIdentifier(node)) {\n                var container = resolver.getReferencedExportContainer(node);\n                return container !== undefined && container.kind === 261 /* SourceFile */;\n            }\n            else {\n                return false;\n            }\n        }\n        //\n        // Modifier Visitors\n        //\n        /**\n         * Visit nodes to elide module-specific modifiers.\n         *\n         * @param node The node to visit.\n         */\n        function modifierVisitor(node) {\n            switch (node.kind) {\n                case 83 /* ExportKeyword */:\n                case 78 /* DefaultKeyword */:\n                    return undefined;\n            }\n            return node;\n        }\n        //\n        // Emit Notification\n        //\n        /**\n         * Hook for node emit notifications.\n         *\n         * @param emitContext A context hint for the emitter.\n         * @param node The node to emit.\n         * @param emit A callback used to emit the node in the printer.\n         */\n        function onEmitNode(emitContext, node, emitCallback) {\n            if (node.kind === 261 /* SourceFile */) {\n                var id = ts.getOriginalNodeId(node);\n                currentSourceFile = node;\n                moduleInfo = moduleInfoMap[id];\n                exportFunction = exportFunctionsMap[id];\n                noSubstitution = noSubstitutionMap[id];\n                if (noSubstitution) {\n                    delete noSubstitutionMap[id];\n                }\n                previousOnEmitNode(emitContext, node, emitCallback);\n                currentSourceFile = undefined;\n                moduleInfo = undefined;\n                exportFunction = undefined;\n                noSubstitution = undefined;\n            }\n            else {\n                previousOnEmitNode(emitContext, node, emitCallback);\n            }\n        }\n        //\n        // Substitutions\n        //\n        /**\n         * Hooks node substitutions.\n         *\n         * @param emitContext A context hint for the emitter.\n         * @param node The node to substitute.\n         */\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (isSubstitutionPrevented(node)) {\n                return node;\n            }\n            if (emitContext === 1 /* Expression */) {\n                return substituteExpression(node);\n            }\n            return node;\n        }\n        /**\n         * Substitute the expression, if necessary.\n         *\n         * @param node The node to substitute.\n         */\n        function substituteExpression(node) {\n            switch (node.kind) {\n                case 70 /* Identifier */:\n                    return substituteExpressionIdentifier(node);\n                case 192 /* BinaryExpression */:\n                    return substituteBinaryExpression(node);\n                case 190 /* PrefixUnaryExpression */:\n                case 191 /* PostfixUnaryExpression */:\n                    return substituteUnaryExpression(node);\n            }\n            return node;\n        }\n        /**\n         * Substitution for an Identifier expression that may contain an imported or exported symbol.\n         *\n         * @param node The node to substitute.\n         */\n        function substituteExpressionIdentifier(node) {\n            if (ts.getEmitFlags(node) & 4096 /* HelperName */) {\n                var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);\n                if (externalHelpersModuleName) {\n                    return ts.createPropertyAccess(externalHelpersModuleName, node);\n                }\n                return node;\n            }\n            // When we see an identifier in an expression position that\n            // points to an imported symbol, we should substitute a qualified\n            // reference to the imported symbol if one is needed.\n            //\n            // - We do not substitute generated identifiers for any reason.\n            // - We do not substitute identifiers tagged with the LocalName flag.\n            if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {\n                var importDeclaration = resolver.getReferencedImportDeclaration(node);\n                if (importDeclaration) {\n                    if (ts.isImportClause(importDeclaration)) {\n                        return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier(\"default\"), \n                        /*location*/ node);\n                    }\n                    else if (ts.isImportSpecifier(importDeclaration)) {\n                        return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(importDeclaration.propertyName || importDeclaration.name), \n                        /*location*/ node);\n                    }\n                }\n            }\n            return node;\n        }\n        /**\n         * Substitution for a BinaryExpression that may contain an imported or exported symbol.\n         *\n         * @param node The node to substitute.\n         */\n        function substituteBinaryExpression(node) {\n            // When we see an assignment expression whose left-hand side is an exported symbol,\n            // we should ensure all exports of that symbol are updated with the correct value.\n            //\n            // - We do not substitute generated identifiers for any reason.\n            // - We do not substitute identifiers tagged with the LocalName flag.\n            // - We do not substitute identifiers that were originally the name of an enum or\n            //   namespace due to how they are transformed in TypeScript.\n            // - We only substitute identifiers that are exported at the top level.\n            if (ts.isAssignmentOperator(node.operatorToken.kind)\n                && ts.isIdentifier(node.left)\n                && !ts.isGeneratedIdentifier(node.left)\n                && !ts.isLocalName(node.left)\n                && !ts.isDeclarationNameOfEnumOrNamespace(node.left)) {\n                var exportedNames = getExports(node.left);\n                if (exportedNames) {\n                    // For each additional export of the declaration, apply an export assignment.\n                    var expression = node;\n                    for (var _i = 0, exportedNames_1 = exportedNames; _i < exportedNames_1.length; _i++) {\n                        var exportName = exportedNames_1[_i];\n                        expression = createExportExpression(exportName, preventSubstitution(expression));\n                    }\n                    return expression;\n                }\n            }\n            return node;\n        }\n        /**\n         * Substitution for a UnaryExpression that may contain an imported or exported symbol.\n         *\n         * @param node The node to substitute.\n         */\n        function substituteUnaryExpression(node) {\n            // When we see a prefix or postfix increment expression whose operand is an exported\n            // symbol, we should ensure all exports of that symbol are updated with the correct\n            // value.\n            //\n            // - We do not substitute generated identifiers for any reason.\n            // - We do not substitute identifiers tagged with the LocalName flag.\n            // - We do not substitute identifiers that were originally the name of an enum or\n            //   namespace due to how they are transformed in TypeScript.\n            // - We only substitute identifiers that are exported at the top level.\n            if ((node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */)\n                && ts.isIdentifier(node.operand)\n                && !ts.isGeneratedIdentifier(node.operand)\n                && !ts.isLocalName(node.operand)\n                && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {\n                var exportedNames = getExports(node.operand);\n                if (exportedNames) {\n                    var expression = node.kind === 191 /* PostfixUnaryExpression */\n                        ? ts.createPrefix(node.operator, node.operand, \n                        /*location*/ node)\n                        : node;\n                    for (var _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) {\n                        var exportName = exportedNames_2[_i];\n                        expression = createExportExpression(exportName, preventSubstitution(expression));\n                    }\n                    if (node.kind === 191 /* PostfixUnaryExpression */) {\n                        expression = node.operator === 42 /* PlusPlusToken */\n                            ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1))\n                            : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1));\n                    }\n                    return expression;\n                }\n            }\n            return node;\n        }\n        /**\n         * Gets the exports of a name.\n         *\n         * @param name The name.\n         */\n        function getExports(name) {\n            var exportedNames;\n            if (!ts.isGeneratedIdentifier(name)) {\n                var valueDeclaration = resolver.getReferencedImportDeclaration(name)\n                    || resolver.getReferencedValueDeclaration(name);\n                if (valueDeclaration) {\n                    var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false);\n                    if (exportContainer && exportContainer.kind === 261 /* SourceFile */) {\n                        exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration));\n                    }\n                    exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]);\n                }\n            }\n            return exportedNames;\n        }\n        /**\n         * Prevent substitution of a node for this transformer.\n         *\n         * @param node The node which should not be substituted.\n         */\n        function preventSubstitution(node) {\n            if (noSubstitution === undefined)\n                noSubstitution = ts.createMap();\n            noSubstitution[ts.getNodeId(node)] = true;\n            return node;\n        }\n        /**\n         * Determines whether a node should not be substituted.\n         *\n         * @param node The node to test.\n         */\n        function isSubstitutionPrevented(node) {\n            return noSubstitution && node.id && noSubstitution[node.id];\n        }\n    }\n    ts.transformSystemModule = transformSystemModule;\n})(ts || (ts = {}));\n/// <reference path=\"../../factory.ts\" />\n/// <reference path=\"../../visitor.ts\" />\n/*@internal*/\nvar ts;\n(function (ts) {\n    function transformModule(context) {\n        var transformModuleDelegates = ts.createMap((_a = {},\n            _a[ts.ModuleKind.None] = transformCommonJSModule,\n            _a[ts.ModuleKind.CommonJS] = transformCommonJSModule,\n            _a[ts.ModuleKind.AMD] = transformAMDModule,\n            _a[ts.ModuleKind.UMD] = transformUMDModule,\n            _a));\n        var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;\n        var compilerOptions = context.getCompilerOptions();\n        var resolver = context.getEmitResolver();\n        var host = context.getEmitHost();\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        var moduleKind = ts.getEmitModuleKind(compilerOptions);\n        var previousOnSubstituteNode = context.onSubstituteNode;\n        var previousOnEmitNode = context.onEmitNode;\n        context.onSubstituteNode = onSubstituteNode;\n        context.onEmitNode = onEmitNode;\n        context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols.\n        context.enableSubstitution(192 /* BinaryExpression */); // Substitutes assignments to exported symbols.\n        context.enableSubstitution(190 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.\n        context.enableSubstitution(191 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.\n        context.enableSubstitution(258 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols.\n        context.enableEmitNotification(261 /* SourceFile */); // Restore state when substituting nodes in a file.\n        var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file.\n        var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found.\n        var currentSourceFile; // The current file.\n        var currentModuleInfo; // The ExternalModuleInfo for the current file.\n        var noSubstitution; // Set of nodes for which substitution rules should be ignored.\n        return transformSourceFile;\n        /**\n         * Transforms the module aspects of a SourceFile.\n         *\n         * @param node The SourceFile node.\n         */\n        function transformSourceFile(node) {\n            if (ts.isDeclarationFile(node)\n                || !(ts.isExternalModule(node)\n                    || compilerOptions.isolatedModules)) {\n                return node;\n            }\n            currentSourceFile = node;\n            currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions);\n            // Perform the transformation.\n            var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None];\n            var updated = transformModule(node);\n            currentSourceFile = undefined;\n            currentModuleInfo = undefined;\n            return ts.aggregateTransformFlags(updated);\n        }\n        /**\n         * Transforms a SourceFile into a CommonJS module.\n         *\n         * @param node The SourceFile node.\n         */\n        function transformCommonJSModule(node) {\n            startLexicalEnvironment();\n            var statements = [];\n            var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor);\n            ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true));\n            ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));\n            ts.addRange(statements, endLexicalEnvironment());\n            addExportEqualsIfNeeded(statements, /*emitAsReturn*/ false);\n            var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));\n            if (currentModuleInfo.hasExportStarsToExportValues) {\n                ts.addEmitHelper(updated, exportStarHelper);\n            }\n            return updated;\n        }\n        /**\n         * Transforms a SourceFile into an AMD module.\n         *\n         * @param node The SourceFile node.\n         */\n        function transformAMDModule(node) {\n            var define = ts.createIdentifier(\"define\");\n            var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);\n            return transformAsynchronousModule(node, define, moduleName, /*includeNonAmdDependencies*/ true);\n        }\n        /**\n         * Transforms a SourceFile into a UMD module.\n         *\n         * @param node The SourceFile node.\n         */\n        function transformUMDModule(node) {\n            var define = ts.createRawExpression(umdHelper);\n            return transformAsynchronousModule(node, define, /*moduleName*/ undefined, /*includeNonAmdDependencies*/ false);\n        }\n        /**\n         * Transforms a SourceFile into an AMD or UMD module.\n         *\n         * @param node The SourceFile node.\n         * @param define The expression used to define the module.\n         * @param moduleName An expression for the module name, if available.\n         * @param includeNonAmdDependencies A value indicating whether to incldue any non-AMD dependencies.\n         */\n        function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) {\n            // An AMD define function has the following shape:\n            //\n            //     define(id?, dependencies?, factory);\n            //\n            // This has the shape of the following:\n            //\n            //     define(name, [\"module1\", \"module2\"], function (module1Alias) { ... }\n            //\n            // The location of the alias in the parameter list in the factory function needs to\n            // match the position of the module name in the dependency list.\n            //\n            // To ensure this is true in cases of modules with no aliases, e.g.:\n            //\n            //     import \"module\"\n            //\n            // or\n            //\n            //     /// <amd-dependency path= \"a.css\" />\n            //\n            // we need to add modules without alias names to the end of the dependencies list\n            var _a = collectAsynchronousDependencies(node, includeNonAmdDependencies), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames;\n            // Create an updated SourceFile:\n            //\n            //     define(moduleName?, [\"module1\", \"module2\"], function ...\n            return ts.updateSourceFileNode(node, ts.createNodeArray([\n                ts.createStatement(ts.createCall(define, \n                /*typeArguments*/ undefined, (moduleName ? [moduleName] : []).concat([\n                    // Add the dependency array argument:\n                    //\n                    //     [\"require\", \"exports\", module1\", \"module2\", ...]\n                    ts.createArrayLiteral([\n                        ts.createLiteral(\"require\"),\n                        ts.createLiteral(\"exports\")\n                    ].concat(aliasedModuleNames, unaliasedModuleNames)),\n                    // Add the module body function argument:\n                    //\n                    //     function (require, exports, module1, module2) ...\n                    ts.createFunctionExpression(\n                    /*modifiers*/ undefined, \n                    /*asteriskToken*/ undefined, \n                    /*name*/ undefined, \n                    /*typeParameters*/ undefined, [\n                        ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, \"require\"),\n                        ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, \"exports\")\n                    ].concat(importAliasNames), \n                    /*type*/ undefined, transformAsynchronousModuleBody(node))\n                ])))\n            ], \n            /*location*/ node.statements));\n        }\n        /**\n         * Collect the additional asynchronous dependencies for the module.\n         *\n         * @param node The source file.\n         * @param includeNonAmdDependencies A value indicating whether to include non-AMD dependencies.\n         */\n        function collectAsynchronousDependencies(node, includeNonAmdDependencies) {\n            // names of modules with corresponding parameter in the factory function\n            var aliasedModuleNames = [];\n            // names of modules with no corresponding parameters in factory function\n            var unaliasedModuleNames = [];\n            // names of the parameters in the factory function; these\n            // parameters need to match the indexes of the corresponding\n            // module names in aliasedModuleNames.\n            var importAliasNames = [];\n            // Fill in amd-dependency tags\n            for (var _i = 0, _a = node.amdDependencies; _i < _a.length; _i++) {\n                var amdDependency = _a[_i];\n                if (amdDependency.name) {\n                    aliasedModuleNames.push(ts.createLiteral(amdDependency.path));\n                    importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, amdDependency.name));\n                }\n                else {\n                    unaliasedModuleNames.push(ts.createLiteral(amdDependency.path));\n                }\n            }\n            for (var _b = 0, _c = currentModuleInfo.externalImports; _b < _c.length; _b++) {\n                var importNode = _c[_b];\n                // Find the name of the external module\n                var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions);\n                // Find the name of the module alias, if there is one\n                var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile);\n                if (includeNonAmdDependencies && importAliasName) {\n                    // Set emitFlags on the name of the classDeclaration\n                    // This is so that when printer will not substitute the identifier\n                    ts.setEmitFlags(importAliasName, 4 /* NoSubstitution */);\n                    aliasedModuleNames.push(externalModuleName);\n                    importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, importAliasName));\n                }\n                else {\n                    unaliasedModuleNames.push(externalModuleName);\n                }\n            }\n            return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames };\n        }\n        /**\n         * Transforms a SourceFile into an AMD or UMD module body.\n         *\n         * @param node The SourceFile node.\n         */\n        function transformAsynchronousModuleBody(node) {\n            startLexicalEnvironment();\n            var statements = [];\n            var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor);\n            // Visit each statement of the module body.\n            ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true));\n            ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));\n            // End the lexical environment for the module body\n            // and merge any new lexical declarations.\n            ts.addRange(statements, endLexicalEnvironment());\n            // Append the 'export =' statement if provided.\n            addExportEqualsIfNeeded(statements, /*emitAsReturn*/ true);\n            var body = ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true);\n            if (currentModuleInfo.hasExportStarsToExportValues) {\n                // If we have any `export * from ...` declarations\n                // we need to inform the emitter to add the __export helper.\n                ts.addEmitHelper(body, exportStarHelper);\n            }\n            return body;\n        }\n        /**\n         * Adds the down-level representation of `export=` to the statement list if one exists\n         * in the source file.\n         *\n         * @param statements The Statement list to modify.\n         * @param emitAsReturn A value indicating whether to emit the `export=` statement as a\n         * return statement.\n         */\n        function addExportEqualsIfNeeded(statements, emitAsReturn) {\n            if (currentModuleInfo.exportEquals) {\n                if (emitAsReturn) {\n                    var statement = ts.createReturn(currentModuleInfo.exportEquals.expression, \n                    /*location*/ currentModuleInfo.exportEquals);\n                    ts.setEmitFlags(statement, 384 /* NoTokenSourceMaps */ | 1536 /* NoComments */);\n                    statements.push(statement);\n                }\n                else {\n                    var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier(\"module\"), \"exports\"), currentModuleInfo.exportEquals.expression), \n                    /*location*/ currentModuleInfo.exportEquals);\n                    ts.setEmitFlags(statement, 1536 /* NoComments */);\n                    statements.push(statement);\n                }\n            }\n        }\n        //\n        // Top-Level Source Element Visitors\n        //\n        /**\n         * Visits a node at the top level of the source file.\n         *\n         * @param node The node to visit.\n         */\n        function sourceElementVisitor(node) {\n            switch (node.kind) {\n                case 235 /* ImportDeclaration */:\n                    return visitImportDeclaration(node);\n                case 234 /* ImportEqualsDeclaration */:\n                    return visitImportEqualsDeclaration(node);\n                case 241 /* ExportDeclaration */:\n                    return visitExportDeclaration(node);\n                case 240 /* ExportAssignment */:\n                    return visitExportAssignment(node);\n                case 205 /* VariableStatement */:\n                    return visitVariableStatement(node);\n                case 225 /* FunctionDeclaration */:\n                    return visitFunctionDeclaration(node);\n                case 226 /* ClassDeclaration */:\n                    return visitClassDeclaration(node);\n                case 295 /* MergeDeclarationMarker */:\n                    return visitMergeDeclarationMarker(node);\n                case 296 /* EndOfDeclarationMarker */:\n                    return visitEndOfDeclarationMarker(node);\n                default:\n                    // This visitor does not descend into the tree, as export/import statements\n                    // are only transformed at the top level of a file.\n                    return node;\n            }\n        }\n        /**\n         * Visits an ImportDeclaration node.\n         *\n         * @param node The node to visit.\n         */\n        function visitImportDeclaration(node) {\n            var statements;\n            var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);\n            if (moduleKind !== ts.ModuleKind.AMD) {\n                if (!node.importClause) {\n                    // import \"mod\";\n                    return ts.createStatement(createRequireCall(node), /*location*/ node);\n                }\n                else {\n                    var variables = [];\n                    if (namespaceDeclaration && !ts.isDefaultImport(node)) {\n                        // import * as n from \"mod\";\n                        variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), \n                        /*type*/ undefined, createRequireCall(node)));\n                    }\n                    else {\n                        // import d from \"mod\";\n                        // import { x, y } from \"mod\";\n                        // import d, { x, y } from \"mod\";\n                        // import d, * as n from \"mod\";\n                        variables.push(ts.createVariableDeclaration(ts.getGeneratedNameForNode(node), \n                        /*type*/ undefined, createRequireCall(node)));\n                        if (namespaceDeclaration && ts.isDefaultImport(node)) {\n                            variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), \n                            /*type*/ undefined, ts.getGeneratedNameForNode(node)));\n                        }\n                    }\n                    statements = ts.append(statements, ts.createVariableStatement(\n                    /*modifiers*/ undefined, ts.createVariableDeclarationList(variables, \n                    /*location*/ undefined, languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */), \n                    /*location*/ node));\n                }\n            }\n            else if (namespaceDeclaration && ts.isDefaultImport(node)) {\n                // import d, * as n from \"mod\";\n                statements = ts.append(statements, ts.createVariableStatement(\n                /*modifiers*/ undefined, ts.createVariableDeclarationList([\n                    ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), \n                    /*type*/ undefined, ts.getGeneratedNameForNode(node), \n                    /*location*/ node)\n                ], \n                /*location*/ undefined, languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */)));\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                // Defer exports until we encounter an EndOfDeclarationMarker node\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfImportDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        /**\n         * Creates a `require()` call to import an external module.\n         *\n         * @param importNode The declararation to import.\n         */\n        function createRequireCall(importNode) {\n            var moduleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions);\n            var args = [];\n            if (moduleName) {\n                args.push(moduleName);\n            }\n            return ts.createCall(ts.createIdentifier(\"require\"), /*typeArguments*/ undefined, args);\n        }\n        /**\n         * Visits an ImportEqualsDeclaration node.\n         *\n         * @param node The node to visit.\n         */\n        function visitImportEqualsDeclaration(node) {\n            ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), \"import= for internal module references should be handled in an earlier transformer.\");\n            var statements;\n            if (moduleKind !== ts.ModuleKind.AMD) {\n                if (ts.hasModifier(node, 1 /* Export */)) {\n                    statements = ts.append(statements, ts.createStatement(createExportExpression(node.name, createRequireCall(node)), \n                    /*location*/ node));\n                }\n                else {\n                    statements = ts.append(statements, ts.createVariableStatement(\n                    /*modifiers*/ undefined, ts.createVariableDeclarationList([\n                        ts.createVariableDeclaration(ts.getSynthesizedClone(node.name), \n                        /*type*/ undefined, createRequireCall(node))\n                    ], \n                    /*location*/ undefined, \n                    /*flags*/ languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */), \n                    /*location*/ node));\n                }\n            }\n            else {\n                if (ts.hasModifier(node, 1 /* Export */)) {\n                    statements = ts.append(statements, ts.createStatement(createExportExpression(ts.getExportName(node), ts.getLocalName(node)), \n                    /*location*/ node));\n                }\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                // Defer exports until we encounter an EndOfDeclarationMarker node\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfImportEqualsDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        /**\n         * Visits an ExportDeclaration node.\n         *\n         * @param The node to visit.\n         */\n        function visitExportDeclaration(node) {\n            if (!node.moduleSpecifier) {\n                // Elide export declarations with no module specifier as they are handled\n                // elsewhere.\n                return undefined;\n            }\n            var generatedName = ts.getGeneratedNameForNode(node);\n            if (node.exportClause) {\n                var statements = [];\n                // export { x, y } from \"mod\";\n                if (moduleKind !== ts.ModuleKind.AMD) {\n                    statements.push(ts.createVariableStatement(\n                    /*modifiers*/ undefined, ts.createVariableDeclarationList([\n                        ts.createVariableDeclaration(generatedName, \n                        /*type*/ undefined, createRequireCall(node))\n                    ]), \n                    /*location*/ node));\n                }\n                for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) {\n                    var specifier = _a[_i];\n                    var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name);\n                    statements.push(ts.createStatement(createExportExpression(ts.getExportName(specifier), exportedValue), \n                    /*location*/ specifier));\n                }\n                return ts.singleOrMany(statements);\n            }\n            else {\n                // export * from \"mod\";\n                return ts.createStatement(ts.createCall(ts.createIdentifier(\"__export\"), \n                /*typeArguments*/ undefined, [\n                    moduleKind !== ts.ModuleKind.AMD\n                        ? createRequireCall(node)\n                        : generatedName\n                ]), \n                /*location*/ node);\n            }\n        }\n        /**\n         * Visits an ExportAssignment node.\n         *\n         * @param node The node to visit.\n         */\n        function visitExportAssignment(node) {\n            if (node.isExportEquals) {\n                return undefined;\n            }\n            var statements;\n            var original = node.original;\n            if (original && hasAssociatedEndOfDeclarationMarker(original)) {\n                // Defer exports until we encounter an EndOfDeclarationMarker node\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier(\"default\"), node.expression, /*location*/ node, /*allowComments*/ true);\n            }\n            else {\n                statements = appendExportStatement(statements, ts.createIdentifier(\"default\"), node.expression, /*location*/ node, /*allowComments*/ true);\n            }\n            return ts.singleOrMany(statements);\n        }\n        /**\n         * Visits a FunctionDeclaration node.\n         *\n         * @param node The node to visit.\n         */\n        function visitFunctionDeclaration(node) {\n            var statements;\n            if (ts.hasModifier(node, 1 /* Export */)) {\n                statements = ts.append(statements, ts.setOriginalNode(ts.createFunctionDeclaration(\n                /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), \n                /*typeParameters*/ undefined, node.parameters, \n                /*type*/ undefined, node.body, \n                /*location*/ node), \n                /*original*/ node));\n            }\n            else {\n                statements = ts.append(statements, node);\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                // Defer exports until we encounter an EndOfDeclarationMarker node\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfHoistedDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        /**\n         * Visits a ClassDeclaration node.\n         *\n         * @param node The node to visit.\n         */\n        function visitClassDeclaration(node) {\n            var statements;\n            if (ts.hasModifier(node, 1 /* Export */)) {\n                statements = ts.append(statements, ts.setOriginalNode(ts.createClassDeclaration(\n                /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), \n                /*typeParameters*/ undefined, node.heritageClauses, node.members, \n                /*location*/ node), \n                /*original*/ node));\n            }\n            else {\n                statements = ts.append(statements, node);\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                // Defer exports until we encounter an EndOfDeclarationMarker node\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfHoistedDeclaration(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        /**\n         * Visits a VariableStatement node.\n         *\n         * @param node The node to visit.\n         */\n        function visitVariableStatement(node) {\n            var statements;\n            var variables;\n            var expressions;\n            if (ts.hasModifier(node, 1 /* Export */)) {\n                var modifiers = void 0;\n                // If we're exporting these variables, then these just become assignments to 'exports.x'.\n                // We only want to emit assignments for variables with initializers.\n                for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                    var variable = _a[_i];\n                    if (ts.isIdentifier(variable.name) && ts.isLocalName(variable.name)) {\n                        if (!modifiers) {\n                            modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier);\n                        }\n                        variables = ts.append(variables, variable);\n                    }\n                    else if (variable.initializer) {\n                        expressions = ts.append(expressions, transformInitializedVariable(variable));\n                    }\n                }\n                if (variables) {\n                    statements = ts.append(statements, ts.updateVariableStatement(node, modifiers, ts.updateVariableDeclarationList(node.declarationList, variables)));\n                }\n                if (expressions) {\n                    statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), /*location*/ node));\n                }\n            }\n            else {\n                statements = ts.append(statements, node);\n            }\n            if (hasAssociatedEndOfDeclarationMarker(node)) {\n                // Defer exports until we encounter an EndOfDeclarationMarker node\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node);\n            }\n            else {\n                statements = appendExportsOfVariableStatement(statements, node);\n            }\n            return ts.singleOrMany(statements);\n        }\n        /**\n         * Transforms an exported variable with an initializer into an expression.\n         *\n         * @param node The node to transform.\n         */\n        function transformInitializedVariable(node) {\n            if (ts.isBindingPattern(node.name)) {\n                return ts.flattenDestructuringAssignment(node, \n                /*visitor*/ undefined, context, 0 /* All */, \n                /*needsValue*/ false, createExportExpression);\n            }\n            else {\n                return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier(\"exports\"), node.name, \n                /*location*/ node.name), node.initializer);\n            }\n        }\n        /**\n         * Visits a MergeDeclarationMarker used as a placeholder for the beginning of a merged\n         * and transformed declaration.\n         *\n         * @param node The node to visit.\n         */\n        function visitMergeDeclarationMarker(node) {\n            // For an EnumDeclaration or ModuleDeclaration that merges with a preceeding\n            // declaration we do not emit a leading variable declaration. To preserve the\n            // begin/end semantics of the declararation and to properly handle exports\n            // we wrapped the leading variable declaration in a `MergeDeclarationMarker`.\n            //\n            // To balance the declaration, add the exports of the elided variable\n            // statement.\n            if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205 /* VariableStatement */) {\n                var id = ts.getOriginalNodeId(node);\n                deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original);\n            }\n            return node;\n        }\n        /**\n         * Determines whether a node has an associated EndOfDeclarationMarker.\n         *\n         * @param node The node to test.\n         */\n        function hasAssociatedEndOfDeclarationMarker(node) {\n            return (ts.getEmitFlags(node) & 2097152 /* HasEndOfDeclarationMarker */) !== 0;\n        }\n        /**\n         * Visits a DeclarationMarker used as a placeholder for the end of a transformed\n         * declaration.\n         *\n         * @param node The node to visit.\n         */\n        function visitEndOfDeclarationMarker(node) {\n            // For some transformations we emit an `EndOfDeclarationMarker` to mark the actual\n            // end of the transformed declaration. We use this marker to emit any deferred exports\n            // of the declaration.\n            var id = ts.getOriginalNodeId(node);\n            var statements = deferredExports[id];\n            if (statements) {\n                delete deferredExports[id];\n                return ts.append(statements, node);\n            }\n            return node;\n        }\n        /**\n         * Appends the exports of an ImportDeclaration to a statement list, returning the\n         * statement list.\n         *\n         * @param statements A statement list to which the down-level export statements are to be\n         * appended. If `statements` is `undefined`, a new array is allocated if statements are\n         * appended.\n         * @param decl The declaration whose exports are to be recorded.\n         */\n        function appendExportsOfImportDeclaration(statements, decl) {\n            if (currentModuleInfo.exportEquals) {\n                return statements;\n            }\n            var importClause = decl.importClause;\n            if (!importClause) {\n                return statements;\n            }\n            if (importClause.name) {\n                statements = appendExportsOfDeclaration(statements, importClause);\n            }\n            var namedBindings = importClause.namedBindings;\n            if (namedBindings) {\n                switch (namedBindings.kind) {\n                    case 237 /* NamespaceImport */:\n                        statements = appendExportsOfDeclaration(statements, namedBindings);\n                        break;\n                    case 238 /* NamedImports */:\n                        for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {\n                            var importBinding = _a[_i];\n                            statements = appendExportsOfDeclaration(statements, importBinding);\n                        }\n                        break;\n                }\n            }\n            return statements;\n        }\n        /**\n         * Appends the exports of an ImportEqualsDeclaration to a statement list, returning the\n         * statement list.\n         *\n         * @param statements A statement list to which the down-level export statements are to be\n         * appended. If `statements` is `undefined`, a new array is allocated if statements are\n         * appended.\n         * @param decl The declaration whose exports are to be recorded.\n         */\n        function appendExportsOfImportEqualsDeclaration(statements, decl) {\n            if (currentModuleInfo.exportEquals) {\n                return statements;\n            }\n            return appendExportsOfDeclaration(statements, decl);\n        }\n        /**\n         * Appends the exports of a VariableStatement to a statement list, returning the statement\n         * list.\n         *\n         * @param statements A statement list to which the down-level export statements are to be\n         * appended. If `statements` is `undefined`, a new array is allocated if statements are\n         * appended.\n         * @param node The VariableStatement whose exports are to be recorded.\n         */\n        function appendExportsOfVariableStatement(statements, node) {\n            if (currentModuleInfo.exportEquals) {\n                return statements;\n            }\n            for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {\n                var decl = _a[_i];\n                statements = appendExportsOfBindingElement(statements, decl);\n            }\n            return statements;\n        }\n        /**\n         * Appends the exports of a VariableDeclaration or BindingElement to a statement list,\n         * returning the statement list.\n         *\n         * @param statements A statement list to which the down-level export statements are to be\n         * appended. If `statements` is `undefined`, a new array is allocated if statements are\n         * appended.\n         * @param decl The declaration whose exports are to be recorded.\n         */\n        function appendExportsOfBindingElement(statements, decl) {\n            if (currentModuleInfo.exportEquals) {\n                return statements;\n            }\n            if (ts.isBindingPattern(decl.name)) {\n                for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (!ts.isOmittedExpression(element)) {\n                        statements = appendExportsOfBindingElement(statements, element);\n                    }\n                }\n            }\n            else if (!ts.isGeneratedIdentifier(decl.name)) {\n                statements = appendExportsOfDeclaration(statements, decl);\n            }\n            return statements;\n        }\n        /**\n         * Appends the exports of a ClassDeclaration or FunctionDeclaration to a statement list,\n         * returning the statement list.\n         *\n         * @param statements A statement list to which the down-level export statements are to be\n         * appended. If `statements` is `undefined`, a new array is allocated if statements are\n         * appended.\n         * @param decl The declaration whose exports are to be recorded.\n         */\n        function appendExportsOfHoistedDeclaration(statements, decl) {\n            if (currentModuleInfo.exportEquals) {\n                return statements;\n            }\n            if (ts.hasModifier(decl, 1 /* Export */)) {\n                var exportName = ts.hasModifier(decl, 512 /* Default */) ? ts.createIdentifier(\"default\") : decl.name;\n                statements = appendExportStatement(statements, exportName, ts.getLocalName(decl), /*location*/ decl);\n            }\n            if (decl.name) {\n                statements = appendExportsOfDeclaration(statements, decl);\n            }\n            return statements;\n        }\n        /**\n         * Appends the exports of a declaration to a statement list, returning the statement list.\n         *\n         * @param statements A statement list to which the down-level export statements are to be\n         * appended. If `statements` is `undefined`, a new array is allocated if statements are\n         * appended.\n         * @param decl The declaration to export.\n         */\n        function appendExportsOfDeclaration(statements, decl) {\n            var name = ts.getDeclarationName(decl);\n            var exportSpecifiers = currentModuleInfo.exportSpecifiers[name.text];\n            if (exportSpecifiers) {\n                for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) {\n                    var exportSpecifier = exportSpecifiers_2[_i];\n                    statements = appendExportStatement(statements, exportSpecifier.name, name, /*location*/ exportSpecifier.name);\n                }\n            }\n            return statements;\n        }\n        /**\n         * Appends the down-level representation of an export to a statement list, returning the\n         * statement list.\n         *\n         * @param statements A statement list to which the down-level export statements are to be\n         * appended. If `statements` is `undefined`, a new array is allocated if statements are\n         * appended.\n         * @param exportName The name of the export.\n         * @param expression The expression to export.\n         * @param location The location to use for source maps and comments for the export.\n         * @param allowComments Whether to allow comments on the export.\n         */\n        function appendExportStatement(statements, exportName, expression, location, allowComments) {\n            if (exportName.text === \"default\") {\n                var sourceFile = ts.getOriginalNode(currentSourceFile, ts.isSourceFile);\n                if (sourceFile && !sourceFile.symbol.exports[\"___esModule\"]) {\n                    if (languageVersion === 0 /* ES3 */) {\n                        statements = ts.append(statements, ts.createStatement(createExportExpression(ts.createIdentifier(\"__esModule\"), ts.createLiteral(true))));\n                    }\n                    else {\n                        statements = ts.append(statements, ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier(\"Object\"), \"defineProperty\"), \n                        /*typeArguments*/ undefined, [\n                            ts.createIdentifier(\"exports\"),\n                            ts.createLiteral(\"__esModule\"),\n                            ts.createObjectLiteral([\n                                ts.createPropertyAssignment(\"value\", ts.createLiteral(true))\n                            ])\n                        ])));\n                    }\n                }\n            }\n            statements = ts.append(statements, createExportStatement(exportName, expression, location, allowComments));\n            return statements;\n        }\n        /**\n         * Creates a call to the current file's export function to export a value.\n         *\n         * @param name The bound name of the export.\n         * @param value The exported value.\n         * @param location The location to use for source maps and comments for the export.\n         * @param allowComments An optional value indicating whether to emit comments for the statement.\n         */\n        function createExportStatement(name, value, location, allowComments) {\n            var statement = ts.createStatement(createExportExpression(name, value), location);\n            ts.startOnNewLine(statement);\n            if (!allowComments) {\n                ts.setEmitFlags(statement, 1536 /* NoComments */);\n            }\n            return statement;\n        }\n        /**\n         * Creates a call to the current file's export function to export a value.\n         *\n         * @param name The bound name of the export.\n         * @param value The exported value.\n         * @param location The location to use for source maps and comments for the export.\n         */\n        function createExportExpression(name, value, location) {\n            return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier(\"exports\"), ts.getSynthesizedClone(name)), value, location);\n        }\n        //\n        // Modifier Visitors\n        //\n        /**\n         * Visit nodes to elide module-specific modifiers.\n         *\n         * @param node The node to visit.\n         */\n        function modifierVisitor(node) {\n            // Elide module-specific modifiers.\n            switch (node.kind) {\n                case 83 /* ExportKeyword */:\n                case 78 /* DefaultKeyword */:\n                    return undefined;\n            }\n            return node;\n        }\n        //\n        // Emit Notification\n        //\n        /**\n         * Hook for node emit notifications.\n         *\n         * @param emitContext A context hint for the emitter.\n         * @param node The node to emit.\n         * @param emit A callback used to emit the node in the printer.\n         */\n        function onEmitNode(emitContext, node, emitCallback) {\n            if (node.kind === 261 /* SourceFile */) {\n                currentSourceFile = node;\n                currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)];\n                noSubstitution = ts.createMap();\n                previousOnEmitNode(emitContext, node, emitCallback);\n                currentSourceFile = undefined;\n                currentModuleInfo = undefined;\n                noSubstitution = undefined;\n            }\n            else {\n                previousOnEmitNode(emitContext, node, emitCallback);\n            }\n        }\n        //\n        // Substitutions\n        //\n        /**\n         * Hooks node substitutions.\n         *\n         * @param emitContext A context hint for the emitter.\n         * @param node The node to substitute.\n         */\n        function onSubstituteNode(emitContext, node) {\n            node = previousOnSubstituteNode(emitContext, node);\n            if (node.id && noSubstitution[node.id]) {\n                return node;\n            }\n            if (emitContext === 1 /* Expression */) {\n                return substituteExpression(node);\n            }\n            else if (ts.isShorthandPropertyAssignment(node)) {\n                return substituteShorthandPropertyAssignment(node);\n            }\n            return node;\n        }\n        /**\n         * Substitution for a ShorthandPropertyAssignment whose declaration name is an imported\n         * or exported symbol.\n         *\n         * @param node The node to substitute.\n         */\n        function substituteShorthandPropertyAssignment(node) {\n            var name = node.name;\n            var exportedOrImportedName = substituteExpressionIdentifier(name);\n            if (exportedOrImportedName !== name) {\n                // A shorthand property with an assignment initializer is probably part of a\n                // destructuring assignment\n                if (node.objectAssignmentInitializer) {\n                    var initializer = ts.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer);\n                    return ts.createPropertyAssignment(name, initializer, /*location*/ node);\n                }\n                return ts.createPropertyAssignment(name, exportedOrImportedName, /*location*/ node);\n            }\n            return node;\n        }\n        /**\n         * Substitution for an Expression that may contain an imported or exported symbol.\n         *\n         * @param node The node to substitute.\n         */\n        function substituteExpression(node) {\n            switch (node.kind) {\n                case 70 /* Identifier */:\n                    return substituteExpressionIdentifier(node);\n                case 192 /* BinaryExpression */:\n                    return substituteBinaryExpression(node);\n                case 191 /* PostfixUnaryExpression */:\n                case 190 /* PrefixUnaryExpression */:\n                    return substituteUnaryExpression(node);\n            }\n            return node;\n        }\n        /**\n         * Substitution for an Identifier expression that may contain an imported or exported\n         * symbol.\n         *\n         * @param node The node to substitute.\n         */\n        function substituteExpressionIdentifier(node) {\n            if (ts.getEmitFlags(node) & 4096 /* HelperName */) {\n                var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);\n                if (externalHelpersModuleName) {\n                    return ts.createPropertyAccess(externalHelpersModuleName, node);\n                }\n                return node;\n            }\n            if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {\n                var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node));\n                if (exportContainer && exportContainer.kind === 261 /* SourceFile */) {\n                    return ts.createPropertyAccess(ts.createIdentifier(\"exports\"), ts.getSynthesizedClone(node), \n                    /*location*/ node);\n                }\n                var importDeclaration = resolver.getReferencedImportDeclaration(node);\n                if (importDeclaration) {\n                    if (ts.isImportClause(importDeclaration)) {\n                        return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier(\"default\"), \n                        /*location*/ node);\n                    }\n                    else if (ts.isImportSpecifier(importDeclaration)) {\n                        var name_38 = importDeclaration.propertyName || importDeclaration.name;\n                        return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_38), \n                        /*location*/ node);\n                    }\n                }\n            }\n            return node;\n        }\n        /**\n         * Substitution for a BinaryExpression that may contain an imported or exported symbol.\n         *\n         * @param node The node to substitute.\n         */\n        function substituteBinaryExpression(node) {\n            // When we see an assignment expression whose left-hand side is an exported symbol,\n            // we should ensure all exports of that symbol are updated with the correct value.\n            //\n            // - We do not substitute generated identifiers for any reason.\n            // - We do not substitute identifiers tagged with the LocalName flag.\n            // - We do not substitute identifiers that were originally the name of an enum or\n            //   namespace due to how they are transformed in TypeScript.\n            // - We only substitute identifiers that are exported at the top level.\n            if (ts.isAssignmentOperator(node.operatorToken.kind)\n                && ts.isIdentifier(node.left)\n                && !ts.isGeneratedIdentifier(node.left)\n                && !ts.isLocalName(node.left)\n                && !ts.isDeclarationNameOfEnumOrNamespace(node.left)) {\n                var exportedNames = getExports(node.left);\n                if (exportedNames) {\n                    // For each additional export of the declaration, apply an export assignment.\n                    var expression = node;\n                    for (var _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) {\n                        var exportName = exportedNames_3[_i];\n                        // Mark the node to prevent triggering this rule again.\n                        noSubstitution[ts.getNodeId(expression)] = true;\n                        expression = createExportExpression(exportName, expression, /*location*/ node);\n                    }\n                    return expression;\n                }\n            }\n            return node;\n        }\n        /**\n         * Substitution for a UnaryExpression that may contain an imported or exported symbol.\n         *\n         * @param node The node to substitute.\n         */\n        function substituteUnaryExpression(node) {\n            // When we see a prefix or postfix increment expression whose operand is an exported\n            // symbol, we should ensure all exports of that symbol are updated with the correct\n            // value.\n            //\n            // - We do not substitute generated identifiers for any reason.\n            // - We do not substitute identifiers tagged with the LocalName flag.\n            // - We do not substitute identifiers that were originally the name of an enum or\n            //   namespace due to how they are transformed in TypeScript.\n            // - We only substitute identifiers that are exported at the top level.\n            if ((node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */)\n                && ts.isIdentifier(node.operand)\n                && !ts.isGeneratedIdentifier(node.operand)\n                && !ts.isLocalName(node.operand)\n                && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {\n                var exportedNames = getExports(node.operand);\n                if (exportedNames) {\n                    var expression = node.kind === 191 /* PostfixUnaryExpression */\n                        ? ts.createBinary(node.operand, ts.createToken(node.operator === 42 /* PlusPlusToken */ ? 58 /* PlusEqualsToken */ : 59 /* MinusEqualsToken */), ts.createLiteral(1), \n                        /*location*/ node)\n                        : node;\n                    for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) {\n                        var exportName = exportedNames_4[_i];\n                        // Mark the node to prevent triggering this rule again.\n                        noSubstitution[ts.getNodeId(expression)] = true;\n                        expression = createExportExpression(exportName, expression);\n                    }\n                    return expression;\n                }\n            }\n            return node;\n        }\n        /**\n         * Gets the additional exports of a name.\n         *\n         * @param name The name.\n         */\n        function getExports(name) {\n            if (!ts.isGeneratedIdentifier(name)) {\n                var valueDeclaration = resolver.getReferencedImportDeclaration(name)\n                    || resolver.getReferencedValueDeclaration(name);\n                if (valueDeclaration) {\n                    return currentModuleInfo\n                        && currentModuleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)];\n                }\n            }\n        }\n        var _a;\n    }\n    ts.transformModule = transformModule;\n    // emit output for the __export helper function\n    var exportStarHelper = {\n        name: \"typescript:export-star\",\n        scoped: true,\n        text: \"\\n            function __export(m) {\\n                for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\\n            }\"\n    };\n    // emit output for the UMD helper function.\n    var umdHelper = \"\\n        (function (dependencies, factory) {\\n            if (typeof module === 'object' && typeof module.exports === 'object') {\\n                var v = factory(require, exports); if (v !== undefined) module.exports = v;\\n            }\\n            else if (typeof define === 'function' && define.amd) {\\n                define(dependencies, factory);\\n            }\\n        })\";\n})(ts || (ts = {}));\n/// <reference path=\"visitor.ts\" />\n/// <reference path=\"transformers/ts.ts\" />\n/// <reference path=\"transformers/jsx.ts\" />\n/// <reference path=\"transformers/esnext.ts\" />\n/// <reference path=\"transformers/es2017.ts\" />\n/// <reference path=\"transformers/es2016.ts\" />\n/// <reference path=\"transformers/es2015.ts\" />\n/// <reference path=\"transformers/generators.ts\" />\n/// <reference path=\"transformers/es5.ts\" />\n/// <reference path=\"transformers/module/module.ts\" />\n/// <reference path=\"transformers/module/system.ts\" />\n/// <reference path=\"transformers/module/es2015.ts\" />\n/* @internal */\nvar ts;\n(function (ts) {\n    var moduleTransformerMap = ts.createMap((_a = {},\n        _a[ts.ModuleKind.ES2015] = ts.transformES2015Module,\n        _a[ts.ModuleKind.System] = ts.transformSystemModule,\n        _a[ts.ModuleKind.AMD] = ts.transformModule,\n        _a[ts.ModuleKind.CommonJS] = ts.transformModule,\n        _a[ts.ModuleKind.UMD] = ts.transformModule,\n        _a[ts.ModuleKind.None] = ts.transformModule,\n        _a));\n    var SyntaxKindFeatureFlags;\n    (function (SyntaxKindFeatureFlags) {\n        SyntaxKindFeatureFlags[SyntaxKindFeatureFlags[\"Substitution\"] = 1] = \"Substitution\";\n        SyntaxKindFeatureFlags[SyntaxKindFeatureFlags[\"EmitNotifications\"] = 2] = \"EmitNotifications\";\n    })(SyntaxKindFeatureFlags || (SyntaxKindFeatureFlags = {}));\n    function getTransformers(compilerOptions) {\n        var jsx = compilerOptions.jsx;\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        var moduleKind = ts.getEmitModuleKind(compilerOptions);\n        var transformers = [];\n        transformers.push(ts.transformTypeScript);\n        if (jsx === 2 /* React */) {\n            transformers.push(ts.transformJsx);\n        }\n        if (languageVersion < 5 /* ESNext */) {\n            transformers.push(ts.transformESNext);\n        }\n        if (languageVersion < 4 /* ES2017 */) {\n            transformers.push(ts.transformES2017);\n        }\n        if (languageVersion < 3 /* ES2016 */) {\n            transformers.push(ts.transformES2016);\n        }\n        if (languageVersion < 2 /* ES2015 */) {\n            transformers.push(ts.transformES2015);\n            transformers.push(ts.transformGenerators);\n        }\n        transformers.push(moduleTransformerMap[moduleKind] || moduleTransformerMap[ts.ModuleKind.None]);\n        // The ES5 transformer is last so that it can substitute expressions like `exports.default`\n        // for ES3.\n        if (languageVersion < 1 /* ES5 */) {\n            transformers.push(ts.transformES5);\n        }\n        return transformers;\n    }\n    ts.getTransformers = getTransformers;\n    /**\n     * Transforms an array of SourceFiles by passing them through each transformer.\n     *\n     * @param resolver The emit resolver provided by the checker.\n     * @param host The emit host.\n     * @param sourceFiles An array of source files\n     * @param transforms An array of Transformers.\n     */\n    function transformFiles(resolver, host, sourceFiles, transformers) {\n        var enabledSyntaxKindFeatures = new Array(298 /* Count */);\n        var lexicalEnvironmentDisabled = false;\n        var lexicalEnvironmentVariableDeclarations;\n        var lexicalEnvironmentFunctionDeclarations;\n        var lexicalEnvironmentVariableDeclarationsStack = [];\n        var lexicalEnvironmentFunctionDeclarationsStack = [];\n        var lexicalEnvironmentStackOffset = 0;\n        var lexicalEnvironmentSuspended = false;\n        var emitHelpers;\n        // The transformation context is provided to each transformer as part of transformer\n        // initialization.\n        var context = {\n            getCompilerOptions: function () { return host.getCompilerOptions(); },\n            getEmitResolver: function () { return resolver; },\n            getEmitHost: function () { return host; },\n            startLexicalEnvironment: startLexicalEnvironment,\n            suspendLexicalEnvironment: suspendLexicalEnvironment,\n            resumeLexicalEnvironment: resumeLexicalEnvironment,\n            endLexicalEnvironment: endLexicalEnvironment,\n            hoistVariableDeclaration: hoistVariableDeclaration,\n            hoistFunctionDeclaration: hoistFunctionDeclaration,\n            requestEmitHelper: requestEmitHelper,\n            readEmitHelpers: readEmitHelpers,\n            onSubstituteNode: function (_emitContext, node) { return node; },\n            enableSubstitution: enableSubstitution,\n            isSubstitutionEnabled: isSubstitutionEnabled,\n            onEmitNode: function (node, emitContext, emitCallback) { return emitCallback(node, emitContext); },\n            enableEmitNotification: enableEmitNotification,\n            isEmitNotificationEnabled: isEmitNotificationEnabled\n        };\n        // Chain together and initialize each transformer.\n        var transformation = ts.chain.apply(void 0, transformers)(context);\n        // Transform each source file.\n        var transformed = ts.map(sourceFiles, transformSourceFile);\n        // Disable modification of the lexical environment.\n        lexicalEnvironmentDisabled = true;\n        return {\n            transformed: transformed,\n            emitNodeWithSubstitution: emitNodeWithSubstitution,\n            emitNodeWithNotification: emitNodeWithNotification\n        };\n        /**\n         * Transforms a source file.\n         *\n         * @param sourceFile The source file to transform.\n         */\n        function transformSourceFile(sourceFile) {\n            if (ts.isDeclarationFile(sourceFile)) {\n                return sourceFile;\n            }\n            return transformation(sourceFile);\n        }\n        /**\n         * Enables expression substitutions in the pretty printer for the provided SyntaxKind.\n         */\n        function enableSubstitution(kind) {\n            enabledSyntaxKindFeatures[kind] |= 1 /* Substitution */;\n        }\n        /**\n         * Determines whether expression substitutions are enabled for the provided node.\n         */\n        function isSubstitutionEnabled(node) {\n            return (enabledSyntaxKindFeatures[node.kind] & 1 /* Substitution */) !== 0\n                && (ts.getEmitFlags(node) & 4 /* NoSubstitution */) === 0;\n        }\n        /**\n         * Emits a node with possible substitution.\n         *\n         * @param emitContext The current emit context.\n         * @param node The node to emit.\n         * @param emitCallback The callback used to emit the node or its substitute.\n         */\n        function emitNodeWithSubstitution(emitContext, node, emitCallback) {\n            if (node) {\n                if (isSubstitutionEnabled(node)) {\n                    var substitute = context.onSubstituteNode(emitContext, node);\n                    if (substitute && substitute !== node) {\n                        emitCallback(emitContext, substitute);\n                        return;\n                    }\n                }\n                emitCallback(emitContext, node);\n            }\n        }\n        /**\n         * Enables before/after emit notifications in the pretty printer for the provided SyntaxKind.\n         */\n        function enableEmitNotification(kind) {\n            enabledSyntaxKindFeatures[kind] |= 2 /* EmitNotifications */;\n        }\n        /**\n         * Determines whether before/after emit notifications should be raised in the pretty\n         * printer when it emits a node.\n         */\n        function isEmitNotificationEnabled(node) {\n            return (enabledSyntaxKindFeatures[node.kind] & 2 /* EmitNotifications */) !== 0\n                || (ts.getEmitFlags(node) & 2 /* AdviseOnEmitNode */) !== 0;\n        }\n        /**\n         * Emits a node with possible emit notification.\n         *\n         * @param emitContext The current emit context.\n         * @param node The node to emit.\n         * @param emitCallback The callback used to emit the node.\n         */\n        function emitNodeWithNotification(emitContext, node, emitCallback) {\n            if (node) {\n                if (isEmitNotificationEnabled(node)) {\n                    context.onEmitNode(emitContext, node, emitCallback);\n                }\n                else {\n                    emitCallback(emitContext, node);\n                }\n            }\n        }\n        /**\n         * Records a hoisted variable declaration for the provided name within a lexical environment.\n         */\n        function hoistVariableDeclaration(name) {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot modify the lexical environment during the print phase.\");\n            var decl = ts.createVariableDeclaration(name);\n            if (!lexicalEnvironmentVariableDeclarations) {\n                lexicalEnvironmentVariableDeclarations = [decl];\n            }\n            else {\n                lexicalEnvironmentVariableDeclarations.push(decl);\n            }\n        }\n        /**\n         * Records a hoisted function declaration within a lexical environment.\n         */\n        function hoistFunctionDeclaration(func) {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot modify the lexical environment during the print phase.\");\n            if (!lexicalEnvironmentFunctionDeclarations) {\n                lexicalEnvironmentFunctionDeclarations = [func];\n            }\n            else {\n                lexicalEnvironmentFunctionDeclarations.push(func);\n            }\n        }\n        /**\n         * Starts a new lexical environment. Any existing hoisted variable or function declarations\n         * are pushed onto a stack, and the related storage variables are reset.\n         */\n        function startLexicalEnvironment() {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot start a lexical environment during the print phase.\");\n            ts.Debug.assert(!lexicalEnvironmentSuspended, \"Lexical environment is suspended.\");\n            // Save the current lexical environment. Rather than resizing the array we adjust the\n            // stack size variable. This allows us to reuse existing array slots we've\n            // already allocated between transformations to avoid allocation and GC overhead during\n            // transformation.\n            lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations;\n            lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations;\n            lexicalEnvironmentStackOffset++;\n            lexicalEnvironmentVariableDeclarations = undefined;\n            lexicalEnvironmentFunctionDeclarations = undefined;\n        }\n        /** Suspends the current lexical environment, usually after visiting a parameter list. */\n        function suspendLexicalEnvironment() {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot suspend a lexical environment during the print phase.\");\n            ts.Debug.assert(!lexicalEnvironmentSuspended, \"Lexical environment is already suspended.\");\n            lexicalEnvironmentSuspended = true;\n        }\n        /** Resumes a suspended lexical environment, usually before visiting a function body. */\n        function resumeLexicalEnvironment() {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot resume a lexical environment during the print phase.\");\n            ts.Debug.assert(lexicalEnvironmentSuspended, \"Lexical environment is not suspended.\");\n            lexicalEnvironmentSuspended = false;\n        }\n        /**\n         * Ends a lexical environment. The previous set of hoisted declarations are restored and\n         * any hoisted declarations added in this environment are returned.\n         */\n        function endLexicalEnvironment() {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot end a lexical environment during the print phase.\");\n            ts.Debug.assert(!lexicalEnvironmentSuspended, \"Lexical environment is suspended.\");\n            var statements;\n            if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) {\n                if (lexicalEnvironmentFunctionDeclarations) {\n                    statements = lexicalEnvironmentFunctionDeclarations.slice();\n                }\n                if (lexicalEnvironmentVariableDeclarations) {\n                    var statement = ts.createVariableStatement(\n                    /*modifiers*/ undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations));\n                    if (!statements) {\n                        statements = [statement];\n                    }\n                    else {\n                        statements.push(statement);\n                    }\n                }\n            }\n            // Restore the previous lexical environment.\n            lexicalEnvironmentStackOffset--;\n            lexicalEnvironmentVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset];\n            lexicalEnvironmentFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset];\n            if (lexicalEnvironmentStackOffset === 0) {\n                lexicalEnvironmentVariableDeclarationsStack = [];\n                lexicalEnvironmentFunctionDeclarationsStack = [];\n            }\n            return statements;\n        }\n        function requestEmitHelper(helper) {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot modify the lexical environment during the print phase.\");\n            ts.Debug.assert(!helper.scoped, \"Cannot request a scoped emit helper.\");\n            emitHelpers = ts.append(emitHelpers, helper);\n        }\n        function readEmitHelpers() {\n            ts.Debug.assert(!lexicalEnvironmentDisabled, \"Cannot modify the lexical environment during the print phase.\");\n            var helpers = emitHelpers;\n            emitHelpers = undefined;\n            return helpers;\n        }\n    }\n    ts.transformFiles = transformFiles;\n    var _a;\n})(ts || (ts = {}));\n/// <reference path=\"checker.ts\"/>\n/* @internal */\nvar ts;\n(function (ts) {\n    // Used for initialize lastEncodedSourceMapSpan and reset lastEncodedSourceMapSpan when updateLastEncodedAndRecordedSpans\n    var defaultLastEncodedSourceMapSpan = {\n        emittedLine: 1,\n        emittedColumn: 1,\n        sourceLine: 1,\n        sourceColumn: 1,\n        sourceIndex: 0\n    };\n    function createSourceMapWriter(host, writer) {\n        var compilerOptions = host.getCompilerOptions();\n        var extendedDiagnostics = compilerOptions.extendedDiagnostics;\n        var currentSourceFile;\n        var currentSourceText;\n        var sourceMapDir; // The directory in which sourcemap will be\n        // Current source map file and its index in the sources list\n        var sourceMapSourceIndex;\n        // Last recorded and encoded spans\n        var lastRecordedSourceMapSpan;\n        var lastEncodedSourceMapSpan;\n        var lastEncodedNameIndex;\n        // Source map data\n        var sourceMapData;\n        var disabled = !(compilerOptions.sourceMap || compilerOptions.inlineSourceMap);\n        return {\n            initialize: initialize,\n            reset: reset,\n            getSourceMapData: function () { return sourceMapData; },\n            setSourceFile: setSourceFile,\n            emitPos: emitPos,\n            emitNodeWithSourceMap: emitNodeWithSourceMap,\n            emitTokenWithSourceMap: emitTokenWithSourceMap,\n            getText: getText,\n            getSourceMappingURL: getSourceMappingURL,\n        };\n        /**\n         * Initialize the SourceMapWriter for a new output file.\n         *\n         * @param filePath The path to the generated output file.\n         * @param sourceMapFilePath The path to the output source map file.\n         * @param sourceFiles The input source files for the program.\n         * @param isBundledEmit A value indicating whether the generated output file is a bundle.\n         */\n        function initialize(filePath, sourceMapFilePath, sourceFiles, isBundledEmit) {\n            if (disabled) {\n                return;\n            }\n            if (sourceMapData) {\n                reset();\n            }\n            currentSourceFile = undefined;\n            currentSourceText = undefined;\n            // Current source map file and its index in the sources list\n            sourceMapSourceIndex = -1;\n            // Last recorded and encoded spans\n            lastRecordedSourceMapSpan = undefined;\n            lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan;\n            lastEncodedNameIndex = 0;\n            // Initialize source map data\n            sourceMapData = {\n                sourceMapFilePath: sourceMapFilePath,\n                jsSourceMappingURL: !compilerOptions.inlineSourceMap ? ts.getBaseFileName(ts.normalizeSlashes(sourceMapFilePath)) : undefined,\n                sourceMapFile: ts.getBaseFileName(ts.normalizeSlashes(filePath)),\n                sourceMapSourceRoot: compilerOptions.sourceRoot || \"\",\n                sourceMapSources: [],\n                inputSourceFileNames: [],\n                sourceMapNames: [],\n                sourceMapMappings: \"\",\n                sourceMapSourcesContent: compilerOptions.inlineSources ? [] : undefined,\n                sourceMapDecodedMappings: []\n            };\n            // Normalize source root and make sure it has trailing \"/\" so that it can be used to combine paths with the\n            // relative paths of the sources list in the sourcemap\n            sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot);\n            if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47 /* slash */) {\n                sourceMapData.sourceMapSourceRoot += ts.directorySeparator;\n            }\n            if (compilerOptions.mapRoot) {\n                sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot);\n                if (!isBundledEmit) {\n                    ts.Debug.assert(sourceFiles.length === 1);\n                    // For modules or multiple emit files the mapRoot will have directory structure like the sources\n                    // So if src\\a.ts and src\\lib\\b.ts are compiled together user would be moving the maps into mapRoot\\a.js.map and mapRoot\\lib\\b.js.map\n                    sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFiles[0], host, sourceMapDir));\n                }\n                if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) {\n                    // The relative paths are relative to the common directory\n                    sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir);\n                    sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(filePath)), // get the relative sourceMapDir path based on jsFilePath\n                    ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap\n                    host.getCurrentDirectory(), host.getCanonicalFileName, \n                    /*isAbsolutePathAnUrl*/ true);\n                }\n                else {\n                    sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL);\n                }\n            }\n            else {\n                sourceMapDir = ts.getDirectoryPath(ts.normalizePath(filePath));\n            }\n        }\n        /**\n         * Reset the SourceMapWriter to an empty state.\n         */\n        function reset() {\n            if (disabled) {\n                return;\n            }\n            currentSourceFile = undefined;\n            sourceMapDir = undefined;\n            sourceMapSourceIndex = undefined;\n            lastRecordedSourceMapSpan = undefined;\n            lastEncodedSourceMapSpan = undefined;\n            lastEncodedNameIndex = undefined;\n            sourceMapData = undefined;\n        }\n        // Encoding for sourcemap span\n        function encodeLastRecordedSourceMapSpan() {\n            if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) {\n                return;\n            }\n            var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn;\n            // Line/Comma delimiters\n            if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) {\n                // Emit comma to separate the entry\n                if (sourceMapData.sourceMapMappings) {\n                    sourceMapData.sourceMapMappings += \",\";\n                }\n            }\n            else {\n                // Emit line delimiters\n                for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) {\n                    sourceMapData.sourceMapMappings += \";\";\n                }\n                prevEncodedEmittedColumn = 1;\n            }\n            // 1. Relative Column 0 based\n            sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn);\n            // 2. Relative sourceIndex\n            sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex);\n            // 3. Relative sourceLine 0 based\n            sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine);\n            // 4. Relative sourceColumn 0 based\n            sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn);\n            // 5. Relative namePosition 0 based\n            if (lastRecordedSourceMapSpan.nameIndex >= 0) {\n                ts.Debug.assert(false, \"We do not support name index right now, Make sure to update updateLastEncodedAndRecordedSpans when we start using this\");\n                sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex);\n                lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex;\n            }\n            lastEncodedSourceMapSpan = lastRecordedSourceMapSpan;\n            sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan);\n        }\n        /**\n         * Emits a mapping.\n         *\n         * If the position is synthetic (undefined or a negative value), no mapping will be\n         * created.\n         *\n         * @param pos The position.\n         */\n        function emitPos(pos) {\n            if (disabled || ts.positionIsSynthesized(pos)) {\n                return;\n            }\n            if (extendedDiagnostics) {\n                ts.performance.mark(\"beforeSourcemap\");\n            }\n            var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos);\n            // Convert the location to be one-based.\n            sourceLinePos.line++;\n            sourceLinePos.character++;\n            var emittedLine = writer.getLine();\n            var emittedColumn = writer.getColumn();\n            // If this location wasn't recorded or the location in source is going backwards, record the span\n            if (!lastRecordedSourceMapSpan ||\n                lastRecordedSourceMapSpan.emittedLine !== emittedLine ||\n                lastRecordedSourceMapSpan.emittedColumn !== emittedColumn ||\n                (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex &&\n                    (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line ||\n                        (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) {\n                // Encode the last recordedSpan before assigning new\n                encodeLastRecordedSourceMapSpan();\n                // New span\n                lastRecordedSourceMapSpan = {\n                    emittedLine: emittedLine,\n                    emittedColumn: emittedColumn,\n                    sourceLine: sourceLinePos.line,\n                    sourceColumn: sourceLinePos.character,\n                    sourceIndex: sourceMapSourceIndex\n                };\n            }\n            else {\n                // Take the new pos instead since there is no change in emittedLine and column since last location\n                lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line;\n                lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character;\n                lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex;\n            }\n            if (extendedDiagnostics) {\n                ts.performance.mark(\"afterSourcemap\");\n                ts.performance.measure(\"Source Map\", \"beforeSourcemap\", \"afterSourcemap\");\n            }\n        }\n        /**\n         * Emits a node with possible leading and trailing source maps.\n         *\n         * @param node The node to emit.\n         * @param emitCallback The callback used to emit the node.\n         */\n        function emitNodeWithSourceMap(emitContext, node, emitCallback) {\n            if (disabled) {\n                return emitCallback(emitContext, node);\n            }\n            if (node) {\n                var emitNode = node.emitNode;\n                var emitFlags = emitNode && emitNode.flags;\n                var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end;\n                if (node.kind !== 293 /* NotEmittedStatement */\n                    && (emitFlags & 16 /* NoLeadingSourceMap */) === 0\n                    && pos >= 0) {\n                    emitPos(ts.skipTrivia(currentSourceText, pos));\n                }\n                if (emitFlags & 64 /* NoNestedSourceMaps */) {\n                    disabled = true;\n                    emitCallback(emitContext, node);\n                    disabled = false;\n                }\n                else {\n                    emitCallback(emitContext, node);\n                }\n                if (node.kind !== 293 /* NotEmittedStatement */\n                    && (emitFlags & 32 /* NoTrailingSourceMap */) === 0\n                    && end >= 0) {\n                    emitPos(end);\n                }\n            }\n        }\n        /**\n         * Emits a token of a node with possible leading and trailing source maps.\n         *\n         * @param node The node containing the token.\n         * @param token The token to emit.\n         * @param tokenStartPos The start pos of the token.\n         * @param emitCallback The callback used to emit the token.\n         */\n        function emitTokenWithSourceMap(node, token, tokenPos, emitCallback) {\n            if (disabled) {\n                return emitCallback(token, tokenPos);\n            }\n            var emitNode = node && node.emitNode;\n            var emitFlags = emitNode && emitNode.flags;\n            var range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token];\n            tokenPos = ts.skipTrivia(currentSourceText, range ? range.pos : tokenPos);\n            if ((emitFlags & 128 /* NoTokenLeadingSourceMaps */) === 0 && tokenPos >= 0) {\n                emitPos(tokenPos);\n            }\n            tokenPos = emitCallback(token, tokenPos);\n            if (range)\n                tokenPos = range.end;\n            if ((emitFlags & 256 /* NoTokenTrailingSourceMaps */) === 0 && tokenPos >= 0) {\n                emitPos(tokenPos);\n            }\n            return tokenPos;\n        }\n        /**\n         * Set the current source file.\n         *\n         * @param sourceFile The source file.\n         */\n        function setSourceFile(sourceFile) {\n            if (disabled) {\n                return;\n            }\n            currentSourceFile = sourceFile;\n            currentSourceText = currentSourceFile.text;\n            // Add the file to tsFilePaths\n            // If sourceroot option: Use the relative path corresponding to the common directory path\n            // otherwise source locations relative to map file location\n            var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;\n            var source = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, currentSourceFile.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, \n            /*isAbsolutePathAnUrl*/ true);\n            sourceMapSourceIndex = ts.indexOf(sourceMapData.sourceMapSources, source);\n            if (sourceMapSourceIndex === -1) {\n                sourceMapSourceIndex = sourceMapData.sourceMapSources.length;\n                sourceMapData.sourceMapSources.push(source);\n                // The one that can be used from program to get the actual source file\n                sourceMapData.inputSourceFileNames.push(currentSourceFile.fileName);\n                if (compilerOptions.inlineSources) {\n                    sourceMapData.sourceMapSourcesContent.push(currentSourceFile.text);\n                }\n            }\n        }\n        /**\n         * Gets the text for the source map.\n         */\n        function getText() {\n            if (disabled) {\n                return;\n            }\n            encodeLastRecordedSourceMapSpan();\n            return ts.stringify({\n                version: 3,\n                file: sourceMapData.sourceMapFile,\n                sourceRoot: sourceMapData.sourceMapSourceRoot,\n                sources: sourceMapData.sourceMapSources,\n                names: sourceMapData.sourceMapNames,\n                mappings: sourceMapData.sourceMapMappings,\n                sourcesContent: sourceMapData.sourceMapSourcesContent,\n            });\n        }\n        /**\n         * Gets the SourceMappingURL for the source map.\n         */\n        function getSourceMappingURL() {\n            if (disabled) {\n                return;\n            }\n            if (compilerOptions.inlineSourceMap) {\n                // Encode the sourceMap into the sourceMap url\n                var base64SourceMapText = ts.convertToBase64(getText());\n                return sourceMapData.jsSourceMappingURL = \"data:application/json;base64,\" + base64SourceMapText;\n            }\n            else {\n                return sourceMapData.jsSourceMappingURL;\n            }\n        }\n    }\n    ts.createSourceMapWriter = createSourceMapWriter;\n    var base64Chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n    function base64FormatEncode(inValue) {\n        if (inValue < 64) {\n            return base64Chars.charAt(inValue);\n        }\n        throw TypeError(inValue + \": not a 64 based value\");\n    }\n    function base64VLQFormatEncode(inValue) {\n        // Add a new least significant bit that has the sign of the value.\n        // if negative number the least significant bit that gets added to the number has value 1\n        // else least significant bit value that gets added is 0\n        // eg. -1 changes to binary : 01 [1] => 3\n        //     +1 changes to binary : 01 [0] => 2\n        if (inValue < 0) {\n            inValue = ((-inValue) << 1) + 1;\n        }\n        else {\n            inValue = inValue << 1;\n        }\n        // Encode 5 bits at a time starting from least significant bits\n        var encodedStr = \"\";\n        do {\n            var currentDigit = inValue & 31; // 11111\n            inValue = inValue >> 5;\n            if (inValue > 0) {\n                // There are still more digits to decode, set the msb (6th bit)\n                currentDigit = currentDigit | 32;\n            }\n            encodedStr = encodedStr + base64FormatEncode(currentDigit);\n        } while (inValue > 0);\n        return encodedStr;\n    }\n})(ts || (ts = {}));\n/// <reference path=\"sourcemap.ts\" />\n/* @internal */\nvar ts;\n(function (ts) {\n    function createCommentWriter(host, writer, sourceMap) {\n        var compilerOptions = host.getCompilerOptions();\n        var extendedDiagnostics = compilerOptions.extendedDiagnostics;\n        var newLine = host.getNewLine();\n        var emitPos = sourceMap.emitPos;\n        var containerPos = -1;\n        var containerEnd = -1;\n        var declarationListContainerEnd = -1;\n        var currentSourceFile;\n        var currentText;\n        var currentLineMap;\n        var detachedCommentsInfo;\n        var hasWrittenComment = false;\n        var disabled = compilerOptions.removeComments;\n        return {\n            reset: reset,\n            setSourceFile: setSourceFile,\n            emitNodeWithComments: emitNodeWithComments,\n            emitBodyWithDetachedComments: emitBodyWithDetachedComments,\n            emitTrailingCommentsOfPosition: emitTrailingCommentsOfPosition,\n        };\n        function emitNodeWithComments(emitContext, node, emitCallback) {\n            if (disabled) {\n                emitCallback(emitContext, node);\n                return;\n            }\n            if (node) {\n                var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;\n                var emitFlags = ts.getEmitFlags(node);\n                if ((pos < 0 && end < 0) || (pos === end)) {\n                    // Both pos and end are synthesized, so just emit the node without comments.\n                    if (emitFlags & 2048 /* NoNestedComments */) {\n                        disabled = true;\n                        emitCallback(emitContext, node);\n                        disabled = false;\n                    }\n                    else {\n                        emitCallback(emitContext, node);\n                    }\n                }\n                else {\n                    if (extendedDiagnostics) {\n                        ts.performance.mark(\"preEmitNodeWithComment\");\n                    }\n                    var isEmittedNode = node.kind !== 293 /* NotEmittedStatement */;\n                    var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0;\n                    var skipTrailingComments = end < 0 || (emitFlags & 1024 /* NoTrailingComments */) !== 0;\n                    // Emit leading comments if the position is not synthesized and the node\n                    // has not opted out from emitting leading comments.\n                    if (!skipLeadingComments) {\n                        emitLeadingComments(pos, isEmittedNode);\n                    }\n                    // Save current container state on the stack.\n                    var savedContainerPos = containerPos;\n                    var savedContainerEnd = containerEnd;\n                    var savedDeclarationListContainerEnd = declarationListContainerEnd;\n                    if (!skipLeadingComments) {\n                        containerPos = pos;\n                    }\n                    if (!skipTrailingComments) {\n                        containerEnd = end;\n                        // To avoid invalid comment emit in a down-level binding pattern, we\n                        // keep track of the last declaration list container's end\n                        if (node.kind === 224 /* VariableDeclarationList */) {\n                            declarationListContainerEnd = end;\n                        }\n                    }\n                    if (extendedDiagnostics) {\n                        ts.performance.measure(\"commentTime\", \"preEmitNodeWithComment\");\n                    }\n                    if (emitFlags & 2048 /* NoNestedComments */) {\n                        disabled = true;\n                        emitCallback(emitContext, node);\n                        disabled = false;\n                    }\n                    else {\n                        emitCallback(emitContext, node);\n                    }\n                    if (extendedDiagnostics) {\n                        ts.performance.mark(\"beginEmitNodeWithComment\");\n                    }\n                    // Restore previous container state.\n                    containerPos = savedContainerPos;\n                    containerEnd = savedContainerEnd;\n                    declarationListContainerEnd = savedDeclarationListContainerEnd;\n                    // Emit trailing comments if the position is not synthesized and the node\n                    // has not opted out from emitting leading comments and is an emitted node.\n                    if (!skipTrailingComments && isEmittedNode) {\n                        emitTrailingComments(end);\n                    }\n                    if (extendedDiagnostics) {\n                        ts.performance.measure(\"commentTime\", \"beginEmitNodeWithComment\");\n                    }\n                }\n            }\n        }\n        function emitBodyWithDetachedComments(node, detachedRange, emitCallback) {\n            if (extendedDiagnostics) {\n                ts.performance.mark(\"preEmitBodyWithDetachedComments\");\n            }\n            var pos = detachedRange.pos, end = detachedRange.end;\n            var emitFlags = ts.getEmitFlags(node);\n            var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0;\n            var skipTrailingComments = disabled || end < 0 || (emitFlags & 1024 /* NoTrailingComments */) !== 0;\n            if (!skipLeadingComments) {\n                emitDetachedCommentsAndUpdateCommentsInfo(detachedRange);\n            }\n            if (extendedDiagnostics) {\n                ts.performance.measure(\"commentTime\", \"preEmitBodyWithDetachedComments\");\n            }\n            if (emitFlags & 2048 /* NoNestedComments */ && !disabled) {\n                disabled = true;\n                emitCallback(node);\n                disabled = false;\n            }\n            else {\n                emitCallback(node);\n            }\n            if (extendedDiagnostics) {\n                ts.performance.mark(\"beginEmitBodyWithDetachedCommetns\");\n            }\n            if (!skipTrailingComments) {\n                emitLeadingComments(detachedRange.end, /*isEmittedNode*/ true);\n            }\n            if (extendedDiagnostics) {\n                ts.performance.measure(\"commentTime\", \"beginEmitBodyWithDetachedCommetns\");\n            }\n        }\n        function emitLeadingComments(pos, isEmittedNode) {\n            hasWrittenComment = false;\n            if (isEmittedNode) {\n                forEachLeadingCommentToEmit(pos, emitLeadingComment);\n            }\n            else if (pos === 0) {\n                // If the node will not be emitted in JS, remove all the comments(normal, pinned and ///) associated with the node,\n                // unless it is a triple slash comment at the top of the file.\n                // For Example:\n                //      /// <reference-path ...>\n                //      declare var x;\n                //      /// <reference-path ...>\n                //      interface F {}\n                //  The first /// will NOT be removed while the second one will be removed even though both node will not be emitted\n                forEachLeadingCommentToEmit(pos, emitTripleSlashLeadingComment);\n            }\n        }\n        function emitTripleSlashLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {\n            if (isTripleSlashComment(commentPos, commentEnd)) {\n                emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos);\n            }\n        }\n        function emitLeadingComment(commentPos, commentEnd, _kind, hasTrailingNewLine, rangePos) {\n            if (!hasWrittenComment) {\n                ts.emitNewLineBeforeLeadingCommentOfPosition(currentLineMap, writer, rangePos, commentPos);\n                hasWrittenComment = true;\n            }\n            // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space\n            emitPos(commentPos);\n            ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine);\n            emitPos(commentEnd);\n            if (hasTrailingNewLine) {\n                writer.writeLine();\n            }\n            else {\n                writer.write(\" \");\n            }\n        }\n        function emitTrailingComments(pos) {\n            forEachTrailingCommentToEmit(pos, emitTrailingComment);\n        }\n        function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) {\n            // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment2*/\n            if (!writer.isAtStartOfLine()) {\n                writer.write(\" \");\n            }\n            emitPos(commentPos);\n            ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine);\n            emitPos(commentEnd);\n            if (hasTrailingNewLine) {\n                writer.writeLine();\n            }\n        }\n        function emitTrailingCommentsOfPosition(pos) {\n            if (disabled) {\n                return;\n            }\n            if (extendedDiagnostics) {\n                ts.performance.mark(\"beforeEmitTrailingCommentsOfPosition\");\n            }\n            forEachTrailingCommentToEmit(pos, emitTrailingCommentOfPosition);\n            if (extendedDiagnostics) {\n                ts.performance.measure(\"commentTime\", \"beforeEmitTrailingCommentsOfPosition\");\n            }\n        }\n        function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) {\n            // trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space\n            emitPos(commentPos);\n            ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine);\n            emitPos(commentEnd);\n            if (hasTrailingNewLine) {\n                writer.writeLine();\n            }\n            else {\n                writer.write(\" \");\n            }\n        }\n        function forEachLeadingCommentToEmit(pos, cb) {\n            // Emit the leading comments only if the container's pos doesn't match because the container should take care of emitting these comments\n            if (containerPos === -1 || pos !== containerPos) {\n                if (hasDetachedComments(pos)) {\n                    forEachLeadingCommentWithoutDetachedComments(cb);\n                }\n                else {\n                    ts.forEachLeadingCommentRange(currentText, pos, cb, /*state*/ pos);\n                }\n            }\n        }\n        function forEachTrailingCommentToEmit(end, cb) {\n            // Emit the trailing comments only if the container's end doesn't match because the container should take care of emitting these comments\n            if (containerEnd === -1 || (end !== containerEnd && end !== declarationListContainerEnd)) {\n                ts.forEachTrailingCommentRange(currentText, end, cb);\n            }\n        }\n        function reset() {\n            currentSourceFile = undefined;\n            currentText = undefined;\n            currentLineMap = undefined;\n            detachedCommentsInfo = undefined;\n        }\n        function setSourceFile(sourceFile) {\n            currentSourceFile = sourceFile;\n            currentText = currentSourceFile.text;\n            currentLineMap = ts.getLineStarts(currentSourceFile);\n            detachedCommentsInfo = undefined;\n        }\n        function hasDetachedComments(pos) {\n            return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos;\n        }\n        function forEachLeadingCommentWithoutDetachedComments(cb) {\n            // get the leading comments from detachedPos\n            var pos = ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos;\n            if (detachedCommentsInfo.length - 1) {\n                detachedCommentsInfo.pop();\n            }\n            else {\n                detachedCommentsInfo = undefined;\n            }\n            ts.forEachLeadingCommentRange(currentText, pos, cb, /*state*/ pos);\n        }\n        function emitDetachedCommentsAndUpdateCommentsInfo(range) {\n            var currentDetachedCommentInfo = ts.emitDetachedComments(currentText, currentLineMap, writer, writeComment, range, newLine, disabled);\n            if (currentDetachedCommentInfo) {\n                if (detachedCommentsInfo) {\n                    detachedCommentsInfo.push(currentDetachedCommentInfo);\n                }\n                else {\n                    detachedCommentsInfo = [currentDetachedCommentInfo];\n                }\n            }\n        }\n        function writeComment(text, lineMap, writer, commentPos, commentEnd, newLine) {\n            emitPos(commentPos);\n            ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine);\n            emitPos(commentEnd);\n        }\n        /**\n         * Determine if the given comment is a triple-slash\n         *\n         * @return true if the comment is a triple-slash comment else false\n         **/\n        function isTripleSlashComment(commentPos, commentEnd) {\n            // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text\n            // so that we don't end up computing comment string and doing match for all // comments\n            if (currentText.charCodeAt(commentPos + 1) === 47 /* slash */ &&\n                commentPos + 2 < commentEnd &&\n                currentText.charCodeAt(commentPos + 2) === 47 /* slash */) {\n                var textSubStr = currentText.substring(commentPos, commentEnd);\n                return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) ||\n                    textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ?\n                    true : false;\n            }\n            return false;\n        }\n    }\n    ts.createCommentWriter = createCommentWriter;\n})(ts || (ts = {}));\n/// <reference path=\"checker.ts\"/>\n/* @internal */\nvar ts;\n(function (ts) {\n    function getDeclarationDiagnostics(host, resolver, targetSourceFile) {\n        var declarationDiagnostics = ts.createDiagnosticCollection();\n        ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile);\n        return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined);\n        function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) {\n            var declarationFilePath = _a.declarationFilePath;\n            emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit, /*emitOnlyDtsFiles*/ false);\n        }\n    }\n    ts.getDeclarationDiagnostics = getDeclarationDiagnostics;\n    function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles) {\n        var newLine = host.getNewLine();\n        var compilerOptions = host.getCompilerOptions();\n        var write;\n        var writeLine;\n        var increaseIndent;\n        var decreaseIndent;\n        var writeTextOfNode;\n        var writer;\n        createAndSetNewTextWriterWithSymbolWriter();\n        var enclosingDeclaration;\n        var resultHasExternalModuleIndicator;\n        var currentText;\n        var currentLineMap;\n        var currentIdentifiers;\n        var isCurrentFileExternalModule;\n        var reportedDeclarationError = false;\n        var errorNameNode;\n        var emitJsDocComments = compilerOptions.removeComments ? ts.noop : writeJsDocComments;\n        var emit = compilerOptions.stripInternal ? stripInternal : emitNode;\n        var noDeclare;\n        var moduleElementDeclarationEmitInfo = [];\n        var asynchronousSubModuleDeclarationEmitInfo;\n        // Contains the reference paths that needs to go in the declaration file.\n        // Collecting this separately because reference paths need to be first thing in the declaration file\n        // and we could be collecting these paths from multiple files into single one with --out option\n        var referencesOutput = \"\";\n        var usedTypeDirectiveReferences;\n        // Emit references corresponding to each file\n        var emittedReferencedFiles = [];\n        var addedGlobalFileReference = false;\n        var allSourcesModuleElementDeclarationEmitInfo = [];\n        ts.forEach(sourceFiles, function (sourceFile) {\n            // Dont emit for javascript file\n            if (ts.isSourceFileJavaScript(sourceFile)) {\n                return;\n            }\n            // Check what references need to be added\n            if (!compilerOptions.noResolve) {\n                ts.forEach(sourceFile.referencedFiles, function (fileReference) {\n                    var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference);\n                    // Emit reference in dts, if the file reference was not already emitted\n                    if (referencedFile && !ts.contains(emittedReferencedFiles, referencedFile)) {\n                        // Add a reference to generated dts file,\n                        // global file reference is added only\n                        //  - if it is not bundled emit (because otherwise it would be self reference)\n                        //  - and it is not already added\n                        if (writeReferencePath(referencedFile, !isBundledEmit && !addedGlobalFileReference, emitOnlyDtsFiles)) {\n                            addedGlobalFileReference = true;\n                        }\n                        emittedReferencedFiles.push(referencedFile);\n                    }\n                });\n            }\n            resultHasExternalModuleIndicator = false;\n            if (!isBundledEmit || !ts.isExternalModule(sourceFile)) {\n                noDeclare = false;\n                emitSourceFile(sourceFile);\n            }\n            else if (ts.isExternalModule(sourceFile)) {\n                noDeclare = true;\n                write(\"declare module \\\"\" + ts.getResolvedExternalModuleName(host, sourceFile) + \"\\\" {\");\n                writeLine();\n                increaseIndent();\n                emitSourceFile(sourceFile);\n                decreaseIndent();\n                write(\"}\");\n                writeLine();\n            }\n            // create asynchronous output for the importDeclarations\n            if (moduleElementDeclarationEmitInfo.length) {\n                var oldWriter = writer;\n                ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) {\n                    if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) {\n                        ts.Debug.assert(aliasEmitInfo.node.kind === 235 /* ImportDeclaration */);\n                        createAndSetNewTextWriterWithSymbolWriter();\n                        ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit));\n                        for (var i = 0; i < aliasEmitInfo.indent; i++) {\n                            increaseIndent();\n                        }\n                        writeImportDeclaration(aliasEmitInfo.node);\n                        aliasEmitInfo.asynchronousOutput = writer.getText();\n                        for (var i = 0; i < aliasEmitInfo.indent; i++) {\n                            decreaseIndent();\n                        }\n                    }\n                });\n                setWriter(oldWriter);\n                allSourcesModuleElementDeclarationEmitInfo = allSourcesModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo);\n                moduleElementDeclarationEmitInfo = [];\n            }\n            if (!isBundledEmit && ts.isExternalModule(sourceFile) && sourceFile.moduleAugmentations.length && !resultHasExternalModuleIndicator) {\n                // if file was external module with augmentations - this fact should be preserved in .d.ts as well.\n                // in case if we didn't write any external module specifiers in .d.ts we need to emit something\n                // that will force compiler to think that this file is an external module - 'export {}' is a reasonable choice here.\n                write(\"export {};\");\n                writeLine();\n            }\n        });\n        if (usedTypeDirectiveReferences) {\n            for (var directive in usedTypeDirectiveReferences) {\n                referencesOutput += \"/// <reference types=\\\"\" + directive + \"\\\" />\" + newLine;\n            }\n        }\n        return {\n            reportedDeclarationError: reportedDeclarationError,\n            moduleElementDeclarationEmitInfo: allSourcesModuleElementDeclarationEmitInfo,\n            synchronousDeclarationOutput: writer.getText(),\n            referencesOutput: referencesOutput,\n        };\n        function hasInternalAnnotation(range) {\n            var comment = currentText.substring(range.pos, range.end);\n            return comment.indexOf(\"@internal\") >= 0;\n        }\n        function stripInternal(node) {\n            if (node) {\n                var leadingCommentRanges = ts.getLeadingCommentRanges(currentText, node.pos);\n                if (ts.forEach(leadingCommentRanges, hasInternalAnnotation)) {\n                    return;\n                }\n                emitNode(node);\n            }\n        }\n        function createAndSetNewTextWriterWithSymbolWriter() {\n            var writer = ts.createTextWriter(newLine);\n            writer.trackSymbol = trackSymbol;\n            writer.reportInaccessibleThisError = reportInaccessibleThisError;\n            writer.writeKeyword = writer.write;\n            writer.writeOperator = writer.write;\n            writer.writePunctuation = writer.write;\n            writer.writeSpace = writer.write;\n            writer.writeStringLiteral = writer.writeLiteral;\n            writer.writeParameter = writer.write;\n            writer.writeSymbol = writer.write;\n            setWriter(writer);\n        }\n        function setWriter(newWriter) {\n            writer = newWriter;\n            write = newWriter.write;\n            writeTextOfNode = newWriter.writeTextOfNode;\n            writeLine = newWriter.writeLine;\n            increaseIndent = newWriter.increaseIndent;\n            decreaseIndent = newWriter.decreaseIndent;\n        }\n        function writeAsynchronousModuleElements(nodes) {\n            var oldWriter = writer;\n            ts.forEach(nodes, function (declaration) {\n                var nodeToCheck;\n                if (declaration.kind === 223 /* VariableDeclaration */) {\n                    nodeToCheck = declaration.parent.parent;\n                }\n                else if (declaration.kind === 238 /* NamedImports */ || declaration.kind === 239 /* ImportSpecifier */ || declaration.kind === 236 /* ImportClause */) {\n                    ts.Debug.fail(\"We should be getting ImportDeclaration instead to write\");\n                }\n                else {\n                    nodeToCheck = declaration;\n                }\n                var moduleElementEmitInfo = ts.forEach(moduleElementDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; });\n                if (!moduleElementEmitInfo && asynchronousSubModuleDeclarationEmitInfo) {\n                    moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; });\n                }\n                // If the alias was marked as not visible when we saw its declaration, we would have saved the aliasEmitInfo, but if we haven't yet visited the alias declaration\n                // then we don't need to write it at this point. We will write it when we actually see its declaration\n                // Eg.\n                // export function bar(a: foo.Foo) { }\n                // import foo = require(\"foo\");\n                // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing,\n                // we would write alias foo declaration when we visit it since it would now be marked as visible\n                if (moduleElementEmitInfo) {\n                    if (moduleElementEmitInfo.node.kind === 235 /* ImportDeclaration */) {\n                        // we have to create asynchronous output only after we have collected complete information\n                        // because it is possible to enable multiple bindings as asynchronously visible\n                        moduleElementEmitInfo.isVisible = true;\n                    }\n                    else {\n                        createAndSetNewTextWriterWithSymbolWriter();\n                        for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) {\n                            increaseIndent();\n                        }\n                        if (nodeToCheck.kind === 230 /* ModuleDeclaration */) {\n                            ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined);\n                            asynchronousSubModuleDeclarationEmitInfo = [];\n                        }\n                        writeModuleElement(nodeToCheck);\n                        if (nodeToCheck.kind === 230 /* ModuleDeclaration */) {\n                            moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo;\n                            asynchronousSubModuleDeclarationEmitInfo = undefined;\n                        }\n                        moduleElementEmitInfo.asynchronousOutput = writer.getText();\n                    }\n                }\n            });\n            setWriter(oldWriter);\n        }\n        function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) {\n            if (!typeReferenceDirectives) {\n                return;\n            }\n            if (!usedTypeDirectiveReferences) {\n                usedTypeDirectiveReferences = ts.createMap();\n            }\n            for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) {\n                var directive = typeReferenceDirectives_1[_i];\n                if (!(directive in usedTypeDirectiveReferences)) {\n                    usedTypeDirectiveReferences[directive] = directive;\n                }\n            }\n        }\n        function handleSymbolAccessibilityError(symbolAccessibilityResult) {\n            if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) {\n                // write the aliases\n                if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) {\n                    writeAsynchronousModuleElements(symbolAccessibilityResult.aliasesToMakeVisible);\n                }\n            }\n            else {\n                // Report error\n                reportedDeclarationError = true;\n                var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccessibilityResult);\n                if (errorInfo) {\n                    if (errorInfo.typeName) {\n                        emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName));\n                    }\n                    else {\n                        emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName));\n                    }\n                }\n            }\n        }\n        function trackSymbol(symbol, enclosingDeclaration, meaning) {\n            handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, /*shouldComputeAliasesToMakeVisible*/ true));\n            recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning));\n        }\n        function reportInaccessibleThisError() {\n            if (errorNameNode) {\n                reportedDeclarationError = true;\n                emitterDiagnostics.add(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode)));\n            }\n        }\n        function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) {\n            writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic;\n            write(\": \");\n            if (type) {\n                // Write the type\n                emitType(type);\n            }\n            else {\n                errorNameNode = declaration.name;\n                resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);\n                errorNameNode = undefined;\n            }\n        }\n        function writeReturnTypeAtSignature(signature, getSymbolAccessibilityDiagnostic) {\n            writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic;\n            write(\": \");\n            if (signature.type) {\n                // Write the type\n                emitType(signature.type);\n            }\n            else {\n                errorNameNode = signature.name;\n                resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);\n                errorNameNode = undefined;\n            }\n        }\n        function emitLines(nodes) {\n            for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {\n                var node = nodes_4[_i];\n                emit(node);\n            }\n        }\n        function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) {\n            var currentWriterPos = writer.getTextPos();\n            for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) {\n                var node = nodes_5[_i];\n                if (!canEmitFn || canEmitFn(node)) {\n                    if (currentWriterPos !== writer.getTextPos()) {\n                        write(separator);\n                    }\n                    currentWriterPos = writer.getTextPos();\n                    eachNodeEmitFn(node);\n                }\n            }\n        }\n        function emitCommaList(nodes, eachNodeEmitFn, canEmitFn) {\n            emitSeparatedList(nodes, \", \", eachNodeEmitFn, canEmitFn);\n        }\n        function writeJsDocComments(declaration) {\n            if (declaration) {\n                var jsDocComments = ts.getJSDocCommentRanges(declaration, currentText);\n                ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments);\n                // jsDoc comments are emitted at /*leading comment1 */space/*leading comment*/space\n                ts.emitComments(currentText, currentLineMap, writer, jsDocComments, /*leadingSeparator*/ false, /*trailingSeparator*/ true, newLine, ts.writeCommentRange);\n            }\n        }\n        function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type, getSymbolAccessibilityDiagnostic) {\n            writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic;\n            emitType(type);\n        }\n        function emitType(type) {\n            switch (type.kind) {\n                case 118 /* AnyKeyword */:\n                case 134 /* StringKeyword */:\n                case 132 /* NumberKeyword */:\n                case 121 /* BooleanKeyword */:\n                case 135 /* SymbolKeyword */:\n                case 104 /* VoidKeyword */:\n                case 137 /* UndefinedKeyword */:\n                case 94 /* NullKeyword */:\n                case 129 /* NeverKeyword */:\n                case 167 /* ThisType */:\n                case 171 /* LiteralType */:\n                    return writeTextOfNode(currentText, type);\n                case 199 /* ExpressionWithTypeArguments */:\n                    return emitExpressionWithTypeArguments(type);\n                case 157 /* TypeReference */:\n                    return emitTypeReference(type);\n                case 160 /* TypeQuery */:\n                    return emitTypeQuery(type);\n                case 162 /* ArrayType */:\n                    return emitArrayType(type);\n                case 163 /* TupleType */:\n                    return emitTupleType(type);\n                case 164 /* UnionType */:\n                    return emitUnionType(type);\n                case 165 /* IntersectionType */:\n                    return emitIntersectionType(type);\n                case 166 /* ParenthesizedType */:\n                    return emitParenType(type);\n                case 168 /* TypeOperator */:\n                    return emitTypeOperator(type);\n                case 169 /* IndexedAccessType */:\n                    return emitIndexedAccessType(type);\n                case 170 /* MappedType */:\n                    return emitMappedType(type);\n                case 158 /* FunctionType */:\n                case 159 /* ConstructorType */:\n                    return emitSignatureDeclarationWithJsDocComments(type);\n                case 161 /* TypeLiteral */:\n                    return emitTypeLiteral(type);\n                case 70 /* Identifier */:\n                    return emitEntityName(type);\n                case 141 /* QualifiedName */:\n                    return emitEntityName(type);\n                case 156 /* TypePredicate */:\n                    return emitTypePredicate(type);\n            }\n            function writeEntityName(entityName) {\n                if (entityName.kind === 70 /* Identifier */) {\n                    writeTextOfNode(currentText, entityName);\n                }\n                else {\n                    var left = entityName.kind === 141 /* QualifiedName */ ? entityName.left : entityName.expression;\n                    var right = entityName.kind === 141 /* QualifiedName */ ? entityName.right : entityName.name;\n                    writeEntityName(left);\n                    write(\".\");\n                    writeTextOfNode(currentText, right);\n                }\n            }\n            function emitEntityName(entityName) {\n                var visibilityResult = resolver.isEntityNameVisible(entityName, \n                // Aliases can be written asynchronously so use correct enclosing declaration\n                entityName.parent.kind === 234 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration);\n                handleSymbolAccessibilityError(visibilityResult);\n                recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName));\n                writeEntityName(entityName);\n            }\n            function emitExpressionWithTypeArguments(node) {\n                if (ts.isEntityNameExpression(node.expression)) {\n                    ts.Debug.assert(node.expression.kind === 70 /* Identifier */ || node.expression.kind === 177 /* PropertyAccessExpression */);\n                    emitEntityName(node.expression);\n                    if (node.typeArguments) {\n                        write(\"<\");\n                        emitCommaList(node.typeArguments, emitType);\n                        write(\">\");\n                    }\n                }\n            }\n            function emitTypeReference(type) {\n                emitEntityName(type.typeName);\n                if (type.typeArguments) {\n                    write(\"<\");\n                    emitCommaList(type.typeArguments, emitType);\n                    write(\">\");\n                }\n            }\n            function emitTypePredicate(type) {\n                writeTextOfNode(currentText, type.parameterName);\n                write(\" is \");\n                emitType(type.type);\n            }\n            function emitTypeQuery(type) {\n                write(\"typeof \");\n                emitEntityName(type.exprName);\n            }\n            function emitArrayType(type) {\n                emitType(type.elementType);\n                write(\"[]\");\n            }\n            function emitTupleType(type) {\n                write(\"[\");\n                emitCommaList(type.elementTypes, emitType);\n                write(\"]\");\n            }\n            function emitUnionType(type) {\n                emitSeparatedList(type.types, \" | \", emitType);\n            }\n            function emitIntersectionType(type) {\n                emitSeparatedList(type.types, \" & \", emitType);\n            }\n            function emitParenType(type) {\n                write(\"(\");\n                emitType(type.type);\n                write(\")\");\n            }\n            function emitTypeOperator(type) {\n                write(ts.tokenToString(type.operator));\n                write(\" \");\n                emitType(type.type);\n            }\n            function emitIndexedAccessType(node) {\n                emitType(node.objectType);\n                write(\"[\");\n                emitType(node.indexType);\n                write(\"]\");\n            }\n            function emitMappedType(node) {\n                var prevEnclosingDeclaration = enclosingDeclaration;\n                enclosingDeclaration = node;\n                write(\"{\");\n                writeLine();\n                increaseIndent();\n                if (node.readonlyToken) {\n                    write(\"readonly \");\n                }\n                write(\"[\");\n                writeEntityName(node.typeParameter.name);\n                write(\" in \");\n                emitType(node.typeParameter.constraint);\n                write(\"]\");\n                if (node.questionToken) {\n                    write(\"?\");\n                }\n                write(\": \");\n                emitType(node.type);\n                write(\";\");\n                writeLine();\n                decreaseIndent();\n                write(\"}\");\n                enclosingDeclaration = prevEnclosingDeclaration;\n            }\n            function emitTypeLiteral(type) {\n                write(\"{\");\n                if (type.members.length) {\n                    writeLine();\n                    increaseIndent();\n                    // write members\n                    emitLines(type.members);\n                    decreaseIndent();\n                }\n                write(\"}\");\n            }\n        }\n        function emitSourceFile(node) {\n            currentText = node.text;\n            currentLineMap = ts.getLineStarts(node);\n            currentIdentifiers = node.identifiers;\n            isCurrentFileExternalModule = ts.isExternalModule(node);\n            enclosingDeclaration = node;\n            ts.emitDetachedComments(currentText, currentLineMap, writer, ts.writeCommentRange, node, newLine, true /* remove comments */);\n            emitLines(node.statements);\n        }\n        // Return a temp variable name to be used in `export default` statements.\n        // The temp name will be of the form _default_counter.\n        // Note that export default is only allowed at most once in a module, so we\n        // do not need to keep track of created temp names.\n        function getExportDefaultTempVariableName() {\n            var baseName = \"_default\";\n            if (!(baseName in currentIdentifiers)) {\n                return baseName;\n            }\n            var count = 0;\n            while (true) {\n                count++;\n                var name_39 = baseName + \"_\" + count;\n                if (!(name_39 in currentIdentifiers)) {\n                    return name_39;\n                }\n            }\n        }\n        function emitExportAssignment(node) {\n            if (node.expression.kind === 70 /* Identifier */) {\n                write(node.isExportEquals ? \"export = \" : \"export default \");\n                writeTextOfNode(currentText, node.expression);\n            }\n            else {\n                // Expression\n                var tempVarName = getExportDefaultTempVariableName();\n                if (!noDeclare) {\n                    write(\"declare \");\n                }\n                write(\"var \");\n                write(tempVarName);\n                write(\": \");\n                writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;\n                resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);\n                write(\";\");\n                writeLine();\n                write(node.isExportEquals ? \"export = \" : \"export default \");\n                write(tempVarName);\n            }\n            write(\";\");\n            writeLine();\n            // Make all the declarations visible for the export name\n            if (node.expression.kind === 70 /* Identifier */) {\n                var nodes = resolver.collectLinkedAliases(node.expression);\n                // write each of these declarations asynchronously\n                writeAsynchronousModuleElements(nodes);\n            }\n            function getDefaultExportAccessibilityDiagnostic() {\n                return {\n                    diagnosticMessage: ts.Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0,\n                    errorNode: node\n                };\n            }\n        }\n        function isModuleElementVisible(node) {\n            return resolver.isDeclarationVisible(node);\n        }\n        function emitModuleElement(node, isModuleElementVisible) {\n            if (isModuleElementVisible) {\n                writeModuleElement(node);\n            }\n            else if (node.kind === 234 /* ImportEqualsDeclaration */ ||\n                (node.parent.kind === 261 /* SourceFile */ && isCurrentFileExternalModule)) {\n                var isVisible = void 0;\n                if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 261 /* SourceFile */) {\n                    // Import declaration of another module that is visited async so lets put it in right spot\n                    asynchronousSubModuleDeclarationEmitInfo.push({\n                        node: node,\n                        outputPos: writer.getTextPos(),\n                        indent: writer.getIndent(),\n                        isVisible: isVisible\n                    });\n                }\n                else {\n                    if (node.kind === 235 /* ImportDeclaration */) {\n                        var importDeclaration = node;\n                        if (importDeclaration.importClause) {\n                            isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) ||\n                                isVisibleNamedBinding(importDeclaration.importClause.namedBindings);\n                        }\n                    }\n                    moduleElementDeclarationEmitInfo.push({\n                        node: node,\n                        outputPos: writer.getTextPos(),\n                        indent: writer.getIndent(),\n                        isVisible: isVisible\n                    });\n                }\n            }\n        }\n        function writeModuleElement(node) {\n            switch (node.kind) {\n                case 225 /* FunctionDeclaration */:\n                    return writeFunctionDeclaration(node);\n                case 205 /* VariableStatement */:\n                    return writeVariableStatement(node);\n                case 227 /* InterfaceDeclaration */:\n                    return writeInterfaceDeclaration(node);\n                case 226 /* ClassDeclaration */:\n                    return writeClassDeclaration(node);\n                case 228 /* TypeAliasDeclaration */:\n                    return writeTypeAliasDeclaration(node);\n                case 229 /* EnumDeclaration */:\n                    return writeEnumDeclaration(node);\n                case 230 /* ModuleDeclaration */:\n                    return writeModuleDeclaration(node);\n                case 234 /* ImportEqualsDeclaration */:\n                    return writeImportEqualsDeclaration(node);\n                case 235 /* ImportDeclaration */:\n                    return writeImportDeclaration(node);\n                default:\n                    ts.Debug.fail(\"Unknown symbol kind\");\n            }\n        }\n        function emitModuleElementDeclarationFlags(node) {\n            // If the node is parented in the current source file we need to emit export declare or just export\n            if (node.parent.kind === 261 /* SourceFile */) {\n                var modifiers = ts.getModifierFlags(node);\n                // If the node is exported\n                if (modifiers & 1 /* Export */) {\n                    write(\"export \");\n                }\n                if (modifiers & 512 /* Default */) {\n                    write(\"default \");\n                }\n                else if (node.kind !== 227 /* InterfaceDeclaration */ && !noDeclare) {\n                    write(\"declare \");\n                }\n            }\n        }\n        function emitClassMemberDeclarationFlags(flags) {\n            if (flags & 8 /* Private */) {\n                write(\"private \");\n            }\n            else if (flags & 16 /* Protected */) {\n                write(\"protected \");\n            }\n            if (flags & 32 /* Static */) {\n                write(\"static \");\n            }\n            if (flags & 64 /* Readonly */) {\n                write(\"readonly \");\n            }\n            if (flags & 128 /* Abstract */) {\n                write(\"abstract \");\n            }\n        }\n        function writeImportEqualsDeclaration(node) {\n            // note usage of writer. methods instead of aliases created, just to make sure we are using\n            // correct writer especially to handle asynchronous alias writing\n            emitJsDocComments(node);\n            if (ts.hasModifier(node, 1 /* Export */)) {\n                write(\"export \");\n            }\n            write(\"import \");\n            writeTextOfNode(currentText, node.name);\n            write(\" = \");\n            if (ts.isInternalModuleImportEqualsDeclaration(node)) {\n                emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.moduleReference, getImportEntityNameVisibilityError);\n                write(\";\");\n            }\n            else {\n                write(\"require(\");\n                emitExternalModuleSpecifier(node);\n                write(\");\");\n            }\n            writer.writeLine();\n            function getImportEntityNameVisibilityError() {\n                return {\n                    diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1,\n                    errorNode: node,\n                    typeName: node.name\n                };\n            }\n        }\n        function isVisibleNamedBinding(namedBindings) {\n            if (namedBindings) {\n                if (namedBindings.kind === 237 /* NamespaceImport */) {\n                    return resolver.isDeclarationVisible(namedBindings);\n                }\n                else {\n                    return ts.forEach(namedBindings.elements, function (namedImport) { return resolver.isDeclarationVisible(namedImport); });\n                }\n            }\n        }\n        function writeImportDeclaration(node) {\n            emitJsDocComments(node);\n            if (ts.hasModifier(node, 1 /* Export */)) {\n                write(\"export \");\n            }\n            write(\"import \");\n            if (node.importClause) {\n                var currentWriterPos = writer.getTextPos();\n                if (node.importClause.name && resolver.isDeclarationVisible(node.importClause)) {\n                    writeTextOfNode(currentText, node.importClause.name);\n                }\n                if (node.importClause.namedBindings && isVisibleNamedBinding(node.importClause.namedBindings)) {\n                    if (currentWriterPos !== writer.getTextPos()) {\n                        // If the default binding was emitted, write the separated\n                        write(\", \");\n                    }\n                    if (node.importClause.namedBindings.kind === 237 /* NamespaceImport */) {\n                        write(\"* as \");\n                        writeTextOfNode(currentText, node.importClause.namedBindings.name);\n                    }\n                    else {\n                        write(\"{ \");\n                        emitCommaList(node.importClause.namedBindings.elements, emitImportOrExportSpecifier, resolver.isDeclarationVisible);\n                        write(\" }\");\n                    }\n                }\n                write(\" from \");\n            }\n            emitExternalModuleSpecifier(node);\n            write(\";\");\n            writer.writeLine();\n        }\n        function emitExternalModuleSpecifier(parent) {\n            // emitExternalModuleSpecifier is usually called when we emit something in the.d.ts file that will make it an external module (i.e. import/export declarations).\n            // the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered\n            // external modules since they are indistinguishable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}'\n            // so compiler will treat them as external modules.\n            resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 230 /* ModuleDeclaration */;\n            var moduleSpecifier;\n            if (parent.kind === 234 /* ImportEqualsDeclaration */) {\n                var node = parent;\n                moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node);\n            }\n            else if (parent.kind === 230 /* ModuleDeclaration */) {\n                moduleSpecifier = parent.name;\n            }\n            else {\n                var node = parent;\n                moduleSpecifier = node.moduleSpecifier;\n            }\n            if (moduleSpecifier.kind === 9 /* StringLiteral */ && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) {\n                var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, parent);\n                if (moduleName) {\n                    write('\"');\n                    write(moduleName);\n                    write('\"');\n                    return;\n                }\n            }\n            writeTextOfNode(currentText, moduleSpecifier);\n        }\n        function emitImportOrExportSpecifier(node) {\n            if (node.propertyName) {\n                writeTextOfNode(currentText, node.propertyName);\n                write(\" as \");\n            }\n            writeTextOfNode(currentText, node.name);\n        }\n        function emitExportSpecifier(node) {\n            emitImportOrExportSpecifier(node);\n            // Make all the declarations visible for the export name\n            var nodes = resolver.collectLinkedAliases(node.propertyName || node.name);\n            // write each of these declarations asynchronously\n            writeAsynchronousModuleElements(nodes);\n        }\n        function emitExportDeclaration(node) {\n            emitJsDocComments(node);\n            write(\"export \");\n            if (node.exportClause) {\n                write(\"{ \");\n                emitCommaList(node.exportClause.elements, emitExportSpecifier);\n                write(\" }\");\n            }\n            else {\n                write(\"*\");\n            }\n            if (node.moduleSpecifier) {\n                write(\" from \");\n                emitExternalModuleSpecifier(node);\n            }\n            write(\";\");\n            writer.writeLine();\n        }\n        function writeModuleDeclaration(node) {\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            if (ts.isGlobalScopeAugmentation(node)) {\n                write(\"global \");\n            }\n            else {\n                if (node.flags & 16 /* Namespace */) {\n                    write(\"namespace \");\n                }\n                else {\n                    write(\"module \");\n                }\n                if (ts.isExternalModuleAugmentation(node)) {\n                    emitExternalModuleSpecifier(node);\n                }\n                else {\n                    writeTextOfNode(currentText, node.name);\n                }\n            }\n            while (node.body && node.body.kind !== 231 /* ModuleBlock */) {\n                node = node.body;\n                write(\".\");\n                writeTextOfNode(currentText, node.name);\n            }\n            var prevEnclosingDeclaration = enclosingDeclaration;\n            if (node.body) {\n                enclosingDeclaration = node;\n                write(\" {\");\n                writeLine();\n                increaseIndent();\n                emitLines(node.body.statements);\n                decreaseIndent();\n                write(\"}\");\n                writeLine();\n                enclosingDeclaration = prevEnclosingDeclaration;\n            }\n            else {\n                write(\";\");\n            }\n        }\n        function writeTypeAliasDeclaration(node) {\n            var prevEnclosingDeclaration = enclosingDeclaration;\n            enclosingDeclaration = node;\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            write(\"type \");\n            writeTextOfNode(currentText, node.name);\n            emitTypeParameters(node.typeParameters);\n            write(\" = \");\n            emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError);\n            write(\";\");\n            writeLine();\n            enclosingDeclaration = prevEnclosingDeclaration;\n            function getTypeAliasDeclarationVisibilityError() {\n                return {\n                    diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1,\n                    errorNode: node.type,\n                    typeName: node.name\n                };\n            }\n        }\n        function writeEnumDeclaration(node) {\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            if (ts.isConst(node)) {\n                write(\"const \");\n            }\n            write(\"enum \");\n            writeTextOfNode(currentText, node.name);\n            write(\" {\");\n            writeLine();\n            increaseIndent();\n            emitLines(node.members);\n            decreaseIndent();\n            write(\"}\");\n            writeLine();\n        }\n        function emitEnumMemberDeclaration(node) {\n            emitJsDocComments(node);\n            writeTextOfNode(currentText, node.name);\n            var enumMemberValue = resolver.getConstantValue(node);\n            if (enumMemberValue !== undefined) {\n                write(\" = \");\n                write(enumMemberValue.toString());\n            }\n            write(\",\");\n            writeLine();\n        }\n        function isPrivateMethodTypeParameter(node) {\n            return node.parent.kind === 149 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */);\n        }\n        function emitTypeParameters(typeParameters) {\n            function emitTypeParameter(node) {\n                increaseIndent();\n                emitJsDocComments(node);\n                decreaseIndent();\n                writeTextOfNode(currentText, node.name);\n                // If there is constraint present and this is not a type parameter of the private method emit the constraint\n                if (node.constraint && !isPrivateMethodTypeParameter(node)) {\n                    write(\" extends \");\n                    if (node.parent.kind === 158 /* FunctionType */ ||\n                        node.parent.kind === 159 /* ConstructorType */ ||\n                        (node.parent.parent && node.parent.parent.kind === 161 /* TypeLiteral */)) {\n                        ts.Debug.assert(node.parent.kind === 149 /* MethodDeclaration */ ||\n                            node.parent.kind === 148 /* MethodSignature */ ||\n                            node.parent.kind === 158 /* FunctionType */ ||\n                            node.parent.kind === 159 /* ConstructorType */ ||\n                            node.parent.kind === 153 /* CallSignature */ ||\n                            node.parent.kind === 154 /* ConstructSignature */);\n                        emitType(node.constraint);\n                    }\n                    else {\n                        emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError);\n                    }\n                }\n                function getTypeParameterConstraintVisibilityError() {\n                    // Type parameter constraints are named by user so we should always be able to name it\n                    var diagnosticMessage;\n                    switch (node.parent.kind) {\n                        case 226 /* ClassDeclaration */:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1;\n                            break;\n                        case 227 /* InterfaceDeclaration */:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;\n                            break;\n                        case 154 /* ConstructSignature */:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;\n                            break;\n                        case 153 /* CallSignature */:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;\n                            break;\n                        case 149 /* MethodDeclaration */:\n                        case 148 /* MethodSignature */:\n                            if (ts.hasModifier(node.parent, 32 /* Static */)) {\n                                diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;\n                            }\n                            else if (node.parent.parent.kind === 226 /* ClassDeclaration */) {\n                                diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;\n                            }\n                            else {\n                                diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;\n                            }\n                            break;\n                        case 225 /* FunctionDeclaration */:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;\n                            break;\n                        case 228 /* TypeAliasDeclaration */:\n                            diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;\n                            break;\n                        default:\n                            ts.Debug.fail(\"This is unknown parent for type parameter: \" + node.parent.kind);\n                    }\n                    return {\n                        diagnosticMessage: diagnosticMessage,\n                        errorNode: node,\n                        typeName: node.name\n                    };\n                }\n            }\n            if (typeParameters) {\n                write(\"<\");\n                emitCommaList(typeParameters, emitTypeParameter);\n                write(\">\");\n            }\n        }\n        function emitHeritageClause(typeReferences, isImplementsList) {\n            if (typeReferences) {\n                write(isImplementsList ? \" implements \" : \" extends \");\n                emitCommaList(typeReferences, emitTypeOfTypeReference);\n            }\n            function emitTypeOfTypeReference(node) {\n                if (ts.isEntityNameExpression(node.expression)) {\n                    emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError);\n                }\n                else if (!isImplementsList && node.expression.kind === 94 /* NullKeyword */) {\n                    write(\"null\");\n                }\n                else {\n                    writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError;\n                    resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);\n                }\n                function getHeritageClauseVisibilityError() {\n                    var diagnosticMessage;\n                    // Heritage clause is written by user so it can always be named\n                    if (node.parent.parent.kind === 226 /* ClassDeclaration */) {\n                        // Class or Interface implemented/extended is inaccessible\n                        diagnosticMessage = isImplementsList ?\n                            ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :\n                            ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1;\n                    }\n                    else {\n                        // interface is inaccessible\n                        diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1;\n                    }\n                    return {\n                        diagnosticMessage: diagnosticMessage,\n                        errorNode: node,\n                        typeName: node.parent.parent.name\n                    };\n                }\n            }\n        }\n        function writeClassDeclaration(node) {\n            function emitParameterProperties(constructorDeclaration) {\n                if (constructorDeclaration) {\n                    ts.forEach(constructorDeclaration.parameters, function (param) {\n                        if (ts.hasModifier(param, 92 /* ParameterPropertyModifier */)) {\n                            emitPropertyDeclaration(param);\n                        }\n                    });\n                }\n            }\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            if (ts.hasModifier(node, 128 /* Abstract */)) {\n                write(\"abstract \");\n            }\n            write(\"class \");\n            writeTextOfNode(currentText, node.name);\n            var prevEnclosingDeclaration = enclosingDeclaration;\n            enclosingDeclaration = node;\n            emitTypeParameters(node.typeParameters);\n            var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node);\n            if (baseTypeNode) {\n                emitHeritageClause([baseTypeNode], /*isImplementsList*/ false);\n            }\n            emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), /*isImplementsList*/ true);\n            write(\" {\");\n            writeLine();\n            increaseIndent();\n            emitParameterProperties(ts.getFirstConstructorWithBody(node));\n            emitLines(node.members);\n            decreaseIndent();\n            write(\"}\");\n            writeLine();\n            enclosingDeclaration = prevEnclosingDeclaration;\n        }\n        function writeInterfaceDeclaration(node) {\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            write(\"interface \");\n            writeTextOfNode(currentText, node.name);\n            var prevEnclosingDeclaration = enclosingDeclaration;\n            enclosingDeclaration = node;\n            emitTypeParameters(node.typeParameters);\n            var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); });\n            if (interfaceExtendsTypes && interfaceExtendsTypes.length) {\n                emitHeritageClause(interfaceExtendsTypes, /*isImplementsList*/ false);\n            }\n            write(\" {\");\n            writeLine();\n            increaseIndent();\n            emitLines(node.members);\n            decreaseIndent();\n            write(\"}\");\n            writeLine();\n            enclosingDeclaration = prevEnclosingDeclaration;\n        }\n        function emitPropertyDeclaration(node) {\n            if (ts.hasDynamicName(node)) {\n                return;\n            }\n            emitJsDocComments(node);\n            emitClassMemberDeclarationFlags(ts.getModifierFlags(node));\n            emitVariableDeclaration(node);\n            write(\";\");\n            writeLine();\n        }\n        function emitVariableDeclaration(node) {\n            // If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted\n            // so there is no check needed to see if declaration is visible\n            if (node.kind !== 223 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) {\n                if (ts.isBindingPattern(node.name)) {\n                    emitBindingPattern(node.name);\n                }\n                else {\n                    // If this node is a computed name, it can only be a symbol, because we've already skipped\n                    // it if it's not a well known symbol. In that case, the text of the name will be exactly\n                    // what we want, namely the name expression enclosed in brackets.\n                    writeTextOfNode(currentText, node.name);\n                    // If optional property emit ? but in the case of parameterProperty declaration with \"?\" indicating optional parameter for the constructor\n                    // we don't want to emit property declaration with \"?\"\n                    if ((node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */ ||\n                        (node.kind === 144 /* Parameter */ && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) {\n                        write(\"?\");\n                    }\n                    if ((node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */) && node.parent.kind === 161 /* TypeLiteral */) {\n                        emitTypeOfVariableDeclarationFromTypeLiteral(node);\n                    }\n                    else if (resolver.isLiteralConstDeclaration(node)) {\n                        write(\" = \");\n                        resolver.writeLiteralConstValue(node, writer);\n                    }\n                    else if (!ts.hasModifier(node, 8 /* Private */)) {\n                        writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError);\n                    }\n                }\n            }\n            function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {\n                if (node.kind === 223 /* VariableDeclaration */) {\n                    return symbolAccessibilityResult.errorModuleName ?\n                        symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?\n                            ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                            ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 :\n                        ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;\n                }\n                else if (node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */) {\n                    // TODO(jfreeman): Deal with computed properties in error reporting.\n                    if (ts.hasModifier(node, 32 /* Static */)) {\n                        return symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?\n                                ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;\n                    }\n                    else if (node.parent.kind === 226 /* ClassDeclaration */) {\n                        return symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?\n                                ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1;\n                    }\n                    else {\n                        // Interfaces cannot have types that cannot be named\n                        return symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1;\n                    }\n                }\n            }\n            function getVariableDeclarationTypeVisibilityError(symbolAccessibilityResult) {\n                var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);\n                return diagnosticMessage !== undefined ? {\n                    diagnosticMessage: diagnosticMessage,\n                    errorNode: node,\n                    typeName: node.name\n                } : undefined;\n            }\n            function emitBindingPattern(bindingPattern) {\n                // Only select non-omitted expression from the bindingPattern's elements.\n                // We have to do this to avoid emitting trailing commas.\n                // For example:\n                //      original: var [, c,,] = [ 2,3,4]\n                //      emitted: declare var c: number; // instead of declare var c:number, ;\n                var elements = [];\n                for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) {\n                    var element = _a[_i];\n                    if (element.kind !== 198 /* OmittedExpression */) {\n                        elements.push(element);\n                    }\n                }\n                emitCommaList(elements, emitBindingElement);\n            }\n            function emitBindingElement(bindingElement) {\n                function getBindingElementTypeVisibilityError(symbolAccessibilityResult) {\n                    var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);\n                    return diagnosticMessage !== undefined ? {\n                        diagnosticMessage: diagnosticMessage,\n                        errorNode: bindingElement,\n                        typeName: bindingElement.name\n                    } : undefined;\n                }\n                if (bindingElement.name) {\n                    if (ts.isBindingPattern(bindingElement.name)) {\n                        emitBindingPattern(bindingElement.name);\n                    }\n                    else {\n                        writeTextOfNode(currentText, bindingElement.name);\n                        writeTypeOfDeclaration(bindingElement, /*type*/ undefined, getBindingElementTypeVisibilityError);\n                    }\n                }\n            }\n        }\n        function emitTypeOfVariableDeclarationFromTypeLiteral(node) {\n            // if this is property of type literal,\n            // or is parameter of method/call/construct/index signature of type literal\n            // emit only if type is specified\n            if (node.type) {\n                write(\": \");\n                emitType(node.type);\n            }\n        }\n        function isVariableStatementVisible(node) {\n            return ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); });\n        }\n        function writeVariableStatement(node) {\n            emitJsDocComments(node);\n            emitModuleElementDeclarationFlags(node);\n            if (ts.isLet(node.declarationList)) {\n                write(\"let \");\n            }\n            else if (ts.isConst(node.declarationList)) {\n                write(\"const \");\n            }\n            else {\n                write(\"var \");\n            }\n            emitCommaList(node.declarationList.declarations, emitVariableDeclaration, resolver.isDeclarationVisible);\n            write(\";\");\n            writeLine();\n        }\n        function emitAccessorDeclaration(node) {\n            if (ts.hasDynamicName(node)) {\n                return;\n            }\n            var accessors = ts.getAllAccessorDeclarations(node.parent.members, node);\n            var accessorWithTypeAnnotation;\n            if (node === accessors.firstAccessor) {\n                emitJsDocComments(accessors.getAccessor);\n                emitJsDocComments(accessors.setAccessor);\n                emitClassMemberDeclarationFlags(ts.getModifierFlags(node) | (accessors.setAccessor ? 0 : 64 /* Readonly */));\n                writeTextOfNode(currentText, node.name);\n                if (!ts.hasModifier(node, 8 /* Private */)) {\n                    accessorWithTypeAnnotation = node;\n                    var type = getTypeAnnotationFromAccessor(node);\n                    if (!type) {\n                        // couldn't get type for the first accessor, try the another one\n                        var anotherAccessor = node.kind === 151 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor;\n                        type = getTypeAnnotationFromAccessor(anotherAccessor);\n                        if (type) {\n                            accessorWithTypeAnnotation = anotherAccessor;\n                        }\n                    }\n                    writeTypeOfDeclaration(node, type, getAccessorDeclarationTypeVisibilityError);\n                }\n                write(\";\");\n                writeLine();\n            }\n            function getTypeAnnotationFromAccessor(accessor) {\n                if (accessor) {\n                    return accessor.kind === 151 /* GetAccessor */\n                        ? accessor.type // Getter - return type\n                        : accessor.parameters.length > 0\n                            ? accessor.parameters[0].type // Setter parameter type\n                            : undefined;\n                }\n            }\n            function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) {\n                var diagnosticMessage;\n                if (accessorWithTypeAnnotation.kind === 152 /* SetAccessor */) {\n                    // Setters have to have type named and cannot infer it so, the type should always be named\n                    if (ts.hasModifier(accessorWithTypeAnnotation.parent, 32 /* Static */)) {\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1;\n                    }\n                    else {\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1;\n                    }\n                    return {\n                        diagnosticMessage: diagnosticMessage,\n                        errorNode: accessorWithTypeAnnotation.parameters[0],\n                        // TODO(jfreeman): Investigate why we are passing node.name instead of node.parameters[0].name\n                        typeName: accessorWithTypeAnnotation.name\n                    };\n                }\n                else {\n                    if (ts.hasModifier(accessorWithTypeAnnotation, 32 /* Static */)) {\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?\n                                ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :\n                                ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0;\n                    }\n                    else {\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?\n                                ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :\n                                ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0;\n                    }\n                    return {\n                        diagnosticMessage: diagnosticMessage,\n                        errorNode: accessorWithTypeAnnotation.name,\n                        typeName: undefined\n                    };\n                }\n            }\n        }\n        function writeFunctionDeclaration(node) {\n            if (ts.hasDynamicName(node)) {\n                return;\n            }\n            // If we are emitting Method/Constructor it isn't moduleElement and hence already determined to be emitting\n            // so no need to verify if the declaration is visible\n            if (!resolver.isImplementationOfOverload(node)) {\n                emitJsDocComments(node);\n                if (node.kind === 225 /* FunctionDeclaration */) {\n                    emitModuleElementDeclarationFlags(node);\n                }\n                else if (node.kind === 149 /* MethodDeclaration */ || node.kind === 150 /* Constructor */) {\n                    emitClassMemberDeclarationFlags(ts.getModifierFlags(node));\n                }\n                if (node.kind === 225 /* FunctionDeclaration */) {\n                    write(\"function \");\n                    writeTextOfNode(currentText, node.name);\n                }\n                else if (node.kind === 150 /* Constructor */) {\n                    write(\"constructor\");\n                }\n                else {\n                    writeTextOfNode(currentText, node.name);\n                    if (ts.hasQuestionToken(node)) {\n                        write(\"?\");\n                    }\n                }\n                emitSignatureDeclaration(node);\n            }\n        }\n        function emitSignatureDeclarationWithJsDocComments(node) {\n            emitJsDocComments(node);\n            emitSignatureDeclaration(node);\n        }\n        function emitSignatureDeclaration(node) {\n            var prevEnclosingDeclaration = enclosingDeclaration;\n            enclosingDeclaration = node;\n            var closeParenthesizedFunctionType = false;\n            if (node.kind === 155 /* IndexSignature */) {\n                // Index signature can have readonly modifier\n                emitClassMemberDeclarationFlags(ts.getModifierFlags(node));\n                write(\"[\");\n            }\n            else {\n                // Construct signature or constructor type write new Signature\n                if (node.kind === 154 /* ConstructSignature */ || node.kind === 159 /* ConstructorType */) {\n                    write(\"new \");\n                }\n                else if (node.kind === 158 /* FunctionType */) {\n                    var currentOutput = writer.getText();\n                    // Do not generate incorrect type when function type with type parameters is type argument\n                    // This could happen if user used space between two '<' making it error free\n                    // e.g var x: A< <Tany>(a: Tany)=>Tany>;\n                    if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === \"<\") {\n                        closeParenthesizedFunctionType = true;\n                        write(\"(\");\n                    }\n                }\n                emitTypeParameters(node.typeParameters);\n                write(\"(\");\n            }\n            // Parameters\n            emitCommaList(node.parameters, emitParameterDeclaration);\n            if (node.kind === 155 /* IndexSignature */) {\n                write(\"]\");\n            }\n            else {\n                write(\")\");\n            }\n            // If this is not a constructor and is not private, emit the return type\n            var isFunctionTypeOrConstructorType = node.kind === 158 /* FunctionType */ || node.kind === 159 /* ConstructorType */;\n            if (isFunctionTypeOrConstructorType || node.parent.kind === 161 /* TypeLiteral */) {\n                // Emit type literal signature return type only if specified\n                if (node.type) {\n                    write(isFunctionTypeOrConstructorType ? \" => \" : \": \");\n                    emitType(node.type);\n                }\n            }\n            else if (node.kind !== 150 /* Constructor */ && !ts.hasModifier(node, 8 /* Private */)) {\n                writeReturnTypeAtSignature(node, getReturnTypeVisibilityError);\n            }\n            enclosingDeclaration = prevEnclosingDeclaration;\n            if (!isFunctionTypeOrConstructorType) {\n                write(\";\");\n                writeLine();\n            }\n            else if (closeParenthesizedFunctionType) {\n                write(\")\");\n            }\n            function getReturnTypeVisibilityError(symbolAccessibilityResult) {\n                var diagnosticMessage;\n                switch (node.kind) {\n                    case 154 /* ConstructSignature */:\n                        // Interfaces cannot have return types that cannot be named\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;\n                        break;\n                    case 153 /* CallSignature */:\n                        // Interfaces cannot have return types that cannot be named\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;\n                        break;\n                    case 155 /* IndexSignature */:\n                        // Interfaces cannot have return types that cannot be named\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;\n                        break;\n                    case 149 /* MethodDeclaration */:\n                    case 148 /* MethodSignature */:\n                        if (ts.hasModifier(node, 32 /* Static */)) {\n                            diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                                symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?\n                                    ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :\n                                    ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :\n                                ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0;\n                        }\n                        else if (node.parent.kind === 226 /* ClassDeclaration */) {\n                            diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                                symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?\n                                    ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :\n                                    ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :\n                                ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0;\n                        }\n                        else {\n                            // Interfaces cannot have return types that cannot be named\n                            diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                                ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :\n                                ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;\n                        }\n                        break;\n                    case 225 /* FunctionDeclaration */:\n                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?\n                                ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :\n                                ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 :\n                            ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0;\n                        break;\n                    default:\n                        ts.Debug.fail(\"This is unknown kind for signature: \" + node.kind);\n                }\n                return {\n                    diagnosticMessage: diagnosticMessage,\n                    errorNode: node.name || node\n                };\n            }\n        }\n        function emitParameterDeclaration(node) {\n            increaseIndent();\n            emitJsDocComments(node);\n            if (node.dotDotDotToken) {\n                write(\"...\");\n            }\n            if (ts.isBindingPattern(node.name)) {\n                // For bindingPattern, we can't simply writeTextOfNode from the source file\n                // because we want to omit the initializer and using writeTextOfNode will result in initializer get emitted.\n                // Therefore, we will have to recursively emit each element in the bindingPattern.\n                emitBindingPattern(node.name);\n            }\n            else {\n                writeTextOfNode(currentText, node.name);\n            }\n            if (resolver.isOptionalParameter(node)) {\n                write(\"?\");\n            }\n            decreaseIndent();\n            if (node.parent.kind === 158 /* FunctionType */ ||\n                node.parent.kind === 159 /* ConstructorType */ ||\n                node.parent.parent.kind === 161 /* TypeLiteral */) {\n                emitTypeOfVariableDeclarationFromTypeLiteral(node);\n            }\n            else if (!ts.hasModifier(node.parent, 8 /* Private */)) {\n                writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError);\n            }\n            function getParameterDeclarationTypeVisibilityError(symbolAccessibilityResult) {\n                var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);\n                return diagnosticMessage !== undefined ? {\n                    diagnosticMessage: diagnosticMessage,\n                    errorNode: node,\n                    typeName: node.name\n                } : undefined;\n            }\n            function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {\n                switch (node.parent.kind) {\n                    case 150 /* Constructor */:\n                        return symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?\n                                ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;\n                    case 154 /* ConstructSignature */:\n                        // Interfaces cannot have parameter types that cannot be named\n                        return symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;\n                    case 153 /* CallSignature */:\n                        // Interfaces cannot have parameter types that cannot be named\n                        return symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;\n                    case 155 /* IndexSignature */:\n                        // Interfaces cannot have parameter types that cannot be named\n                        return symbolAccessibilityResult.errorModuleName ?\n                            ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1;\n                    case 149 /* MethodDeclaration */:\n                    case 148 /* MethodSignature */:\n                        if (ts.hasModifier(node.parent, 32 /* Static */)) {\n                            return symbolAccessibilityResult.errorModuleName ?\n                                symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?\n                                    ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                    ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                                ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;\n                        }\n                        else if (node.parent.parent.kind === 226 /* ClassDeclaration */) {\n                            return symbolAccessibilityResult.errorModuleName ?\n                                symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?\n                                    ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                    ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :\n                                ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;\n                        }\n                        else {\n                            // Interfaces cannot have parameter types that cannot be named\n                            return symbolAccessibilityResult.errorModuleName ?\n                                ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :\n                                ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;\n                        }\n                    case 225 /* FunctionDeclaration */:\n                        return symbolAccessibilityResult.errorModuleName ?\n                            symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?\n                                ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :\n                                ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 :\n                            ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1;\n                    default:\n                        ts.Debug.fail(\"This is unknown parent for parameter: \" + node.parent.kind);\n                }\n            }\n            function emitBindingPattern(bindingPattern) {\n                // We have to explicitly emit square bracket and bracket because these tokens are not store inside the node.\n                if (bindingPattern.kind === 172 /* ObjectBindingPattern */) {\n                    write(\"{\");\n                    emitCommaList(bindingPattern.elements, emitBindingElement);\n                    write(\"}\");\n                }\n                else if (bindingPattern.kind === 173 /* ArrayBindingPattern */) {\n                    write(\"[\");\n                    var elements = bindingPattern.elements;\n                    emitCommaList(elements, emitBindingElement);\n                    if (elements && elements.hasTrailingComma) {\n                        write(\", \");\n                    }\n                    write(\"]\");\n                }\n            }\n            function emitBindingElement(bindingElement) {\n                if (bindingElement.kind === 198 /* OmittedExpression */) {\n                    // If bindingElement is an omittedExpression (i.e. containing elision),\n                    // we will emit blank space (although this may differ from users' original code,\n                    // it allows emitSeparatedList to write separator appropriately)\n                    // Example:\n                    //      original: function foo([, x, ,]) {}\n                    //      emit    : function foo([ , x,  , ]) {}\n                    write(\" \");\n                }\n                else if (bindingElement.kind === 174 /* BindingElement */) {\n                    if (bindingElement.propertyName) {\n                        // bindingElement has propertyName property in the following case:\n                        //      { y: [a,b,c] ...} -> bindingPattern will have a property called propertyName for \"y\"\n                        // We have to explicitly emit the propertyName before descending into its binding elements.\n                        // Example:\n                        //      original: function foo({y: [a,b,c]}) {}\n                        //      emit    : declare function foo({y: [a, b, c]}: { y: [any, any, any] }) void;\n                        writeTextOfNode(currentText, bindingElement.propertyName);\n                        write(\": \");\n                    }\n                    if (bindingElement.name) {\n                        if (ts.isBindingPattern(bindingElement.name)) {\n                            // If it is a nested binding pattern, we will recursively descend into each element and emit each one separately.\n                            // In the case of rest element, we will omit rest element.\n                            // Example:\n                            //      original: function foo([a, [[b]], c] = [1,[[\"string\"]], 3]) {}\n                            //      emit    : declare function foo([a, [[b]], c]: [number, [[string]], number]): void;\n                            //      original with rest: function foo([a, ...c]) {}\n                            //      emit              : declare function foo([a, ...c]): void;\n                            emitBindingPattern(bindingElement.name);\n                        }\n                        else {\n                            ts.Debug.assert(bindingElement.name.kind === 70 /* Identifier */);\n                            // If the node is just an identifier, we will simply emit the text associated with the node's name\n                            // Example:\n                            //      original: function foo({y = 10, x}) {}\n                            //      emit    : declare function foo({y, x}: {number, any}): void;\n                            if (bindingElement.dotDotDotToken) {\n                                write(\"...\");\n                            }\n                            writeTextOfNode(currentText, bindingElement.name);\n                        }\n                    }\n                }\n            }\n        }\n        function emitNode(node) {\n            switch (node.kind) {\n                case 225 /* FunctionDeclaration */:\n                case 230 /* ModuleDeclaration */:\n                case 234 /* ImportEqualsDeclaration */:\n                case 227 /* InterfaceDeclaration */:\n                case 226 /* ClassDeclaration */:\n                case 228 /* TypeAliasDeclaration */:\n                case 229 /* EnumDeclaration */:\n                    return emitModuleElement(node, isModuleElementVisible(node));\n                case 205 /* VariableStatement */:\n                    return emitModuleElement(node, isVariableStatementVisible(node));\n                case 235 /* ImportDeclaration */:\n                    // Import declaration without import clause is visible, otherwise it is not visible\n                    return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause);\n                case 241 /* ExportDeclaration */:\n                    return emitExportDeclaration(node);\n                case 150 /* Constructor */:\n                case 149 /* MethodDeclaration */:\n                case 148 /* MethodSignature */:\n                    return writeFunctionDeclaration(node);\n                case 154 /* ConstructSignature */:\n                case 153 /* CallSignature */:\n                case 155 /* IndexSignature */:\n                    return emitSignatureDeclarationWithJsDocComments(node);\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                    return emitAccessorDeclaration(node);\n                case 147 /* PropertyDeclaration */:\n                case 146 /* PropertySignature */:\n                    return emitPropertyDeclaration(node);\n                case 260 /* EnumMember */:\n                    return emitEnumMemberDeclaration(node);\n                case 240 /* ExportAssignment */:\n                    return emitExportAssignment(node);\n                case 261 /* SourceFile */:\n                    return emitSourceFile(node);\n            }\n        }\n        /**\n         * Adds the reference to referenced file, returns true if global file reference was emitted\n         * @param referencedFile\n         * @param addBundledFileReference Determines if global file reference corresponding to bundled file should be emitted or not\n         */\n        function writeReferencePath(referencedFile, addBundledFileReference, emitOnlyDtsFiles) {\n            var declFileName;\n            var addedBundledEmitReference = false;\n            if (ts.isDeclarationFile(referencedFile)) {\n                // Declaration file, use declaration file name\n                declFileName = referencedFile.fileName;\n            }\n            else {\n                // Get the declaration file path\n                ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles);\n            }\n            if (declFileName) {\n                declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, \n                /*isAbsolutePathAnUrl*/ false);\n                referencesOutput += \"/// <reference path=\\\"\" + declFileName + \"\\\" />\" + newLine;\n            }\n            return addedBundledEmitReference;\n            function getDeclFileName(emitFileNames, _sourceFiles, isBundledEmit) {\n                // Dont add reference path to this file if it is a bundled emit and caller asked not emit bundled file path\n                if (isBundledEmit && !addBundledFileReference) {\n                    return;\n                }\n                ts.Debug.assert(!!emitFileNames.declarationFilePath || ts.isSourceFileJavaScript(referencedFile), \"Declaration file is not present only for javascript files\");\n                declFileName = emitFileNames.declarationFilePath || emitFileNames.jsFilePath;\n                addedBundledEmitReference = isBundledEmit;\n            }\n        }\n    }\n    /* @internal */\n    function writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) {\n        var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles);\n        var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit;\n        if (!emitSkipped) {\n            var declarationOutput = emitDeclarationResult.referencesOutput\n                + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo);\n            ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles);\n        }\n        return emitSkipped;\n        function getDeclarationOutput(synchronousDeclarationOutput, moduleElementDeclarationEmitInfo) {\n            var appliedSyncOutputPos = 0;\n            var declarationOutput = \"\";\n            // apply asynchronous additions to the synchronous output\n            ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) {\n                if (aliasEmitInfo.asynchronousOutput) {\n                    declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos);\n                    declarationOutput += getDeclarationOutput(aliasEmitInfo.asynchronousOutput, aliasEmitInfo.subModuleElementDeclarationEmitInfo);\n                    appliedSyncOutputPos = aliasEmitInfo.outputPos;\n                }\n            });\n            declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos);\n            return declarationOutput;\n        }\n    }\n    ts.writeDeclarationFile = writeDeclarationFile;\n})(ts || (ts = {}));\n/// <reference path=\"checker.ts\"/>\n/// <reference path=\"transformer.ts\" />\n/// <reference path=\"declarationEmitter.ts\"/>\n/// <reference path=\"sourcemap.ts\"/>\n/// <reference path=\"comments.ts\" />\n/* @internal */\nvar ts;\n(function (ts) {\n    // Flags enum to track count of temp variables and a few dedicated names\n    var TempFlags;\n    (function (TempFlags) {\n        TempFlags[TempFlags[\"Auto\"] = 0] = \"Auto\";\n        TempFlags[TempFlags[\"CountMask\"] = 268435455] = \"CountMask\";\n        TempFlags[TempFlags[\"_i\"] = 268435456] = \"_i\";\n    })(TempFlags || (TempFlags = {}));\n    var id = function (s) { return s; };\n    var nullTransformers = [function (_) { return id; }];\n    // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature\n    function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) {\n        var delimiters = createDelimiterMap();\n        var brackets = createBracketsMap();\n        var compilerOptions = host.getCompilerOptions();\n        var languageVersion = ts.getEmitScriptTarget(compilerOptions);\n        var moduleKind = ts.getEmitModuleKind(compilerOptions);\n        var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined;\n        var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined;\n        var emitterDiagnostics = ts.createDiagnosticCollection();\n        var newLine = host.getNewLine();\n        var transformers = emitOnlyDtsFiles ? nullTransformers : ts.getTransformers(compilerOptions);\n        var writer = ts.createTextWriter(newLine);\n        var write = writer.write, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent;\n        var sourceMap = ts.createSourceMapWriter(host, writer);\n        var emitNodeWithSourceMap = sourceMap.emitNodeWithSourceMap, emitTokenWithSourceMap = sourceMap.emitTokenWithSourceMap;\n        var comments = ts.createCommentWriter(host, writer, sourceMap);\n        var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition;\n        var nodeIdToGeneratedName;\n        var autoGeneratedIdToGeneratedName;\n        var generatedNameSet;\n        var tempFlags;\n        var currentSourceFile;\n        var currentText;\n        var currentFileIdentifiers;\n        var bundledHelpers;\n        var isOwnFileEmit;\n        var emitSkipped = false;\n        var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile);\n        // Transform the source files\n        ts.performance.mark(\"beforeTransform\");\n        var _a = ts.transformFiles(resolver, host, sourceFiles, transformers), transformed = _a.transformed, emitNodeWithSubstitution = _a.emitNodeWithSubstitution, emitNodeWithNotification = _a.emitNodeWithNotification;\n        ts.performance.measure(\"transformTime\", \"beforeTransform\");\n        // Emit each output file\n        ts.performance.mark(\"beforePrint\");\n        ts.forEachTransformedEmitFile(host, transformed, emitFile, emitOnlyDtsFiles);\n        ts.performance.measure(\"printTime\", \"beforePrint\");\n        // Clean up emit nodes on parse tree\n        for (var _b = 0, sourceFiles_4 = sourceFiles; _b < sourceFiles_4.length; _b++) {\n            var sourceFile = sourceFiles_4[_b];\n            ts.disposeEmitNodes(sourceFile);\n        }\n        return {\n            emitSkipped: emitSkipped,\n            diagnostics: emitterDiagnostics.getDiagnostics(),\n            emittedFiles: emittedFilesList,\n            sourceMaps: sourceMapDataList\n        };\n        function emitFile(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, isBundledEmit) {\n            // Make sure not to write js file and source map file if any of them cannot be written\n            if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) {\n                if (!emitOnlyDtsFiles) {\n                    printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit);\n                }\n            }\n            else {\n                emitSkipped = true;\n            }\n            if (declarationFilePath) {\n                emitSkipped = ts.writeDeclarationFile(declarationFilePath, ts.getOriginalSourceFiles(sourceFiles), isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) || emitSkipped;\n            }\n            if (!emitSkipped && emittedFilesList) {\n                if (!emitOnlyDtsFiles) {\n                    emittedFilesList.push(jsFilePath);\n                }\n                if (sourceMapFilePath) {\n                    emittedFilesList.push(sourceMapFilePath);\n                }\n                if (declarationFilePath) {\n                    emittedFilesList.push(declarationFilePath);\n                }\n            }\n        }\n        function printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit) {\n            sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit);\n            nodeIdToGeneratedName = [];\n            autoGeneratedIdToGeneratedName = [];\n            generatedNameSet = ts.createMap();\n            bundledHelpers = isBundledEmit ? ts.createMap() : undefined;\n            isOwnFileEmit = !isBundledEmit;\n            // Emit helpers from all the files\n            if (isBundledEmit && moduleKind) {\n                for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) {\n                    var sourceFile = sourceFiles_5[_a];\n                    emitHelpers(sourceFile, /*isBundle*/ true);\n                }\n            }\n            // Print each transformed source file.\n            ts.forEach(sourceFiles, printSourceFile);\n            writeLine();\n            var sourceMappingURL = sourceMap.getSourceMappingURL();\n            if (sourceMappingURL) {\n                write(\"//# \" + \"sourceMappingURL\" + \"=\" + sourceMappingURL); // Sometimes tools can sometimes see this line as a source mapping url comment\n            }\n            // Write the source map\n            if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) {\n                ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false, sourceFiles);\n            }\n            // Record source map data for the test harness.\n            if (sourceMapDataList) {\n                sourceMapDataList.push(sourceMap.getSourceMapData());\n            }\n            // Write the output file\n            ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles);\n            // Reset state\n            sourceMap.reset();\n            comments.reset();\n            writer.reset();\n            tempFlags = 0 /* Auto */;\n            currentSourceFile = undefined;\n            currentText = undefined;\n            isOwnFileEmit = false;\n        }\n        function printSourceFile(node) {\n            currentSourceFile = node;\n            currentText = node.text;\n            currentFileIdentifiers = node.identifiers;\n            sourceMap.setSourceFile(node);\n            comments.setSourceFile(node);\n            pipelineEmitWithNotification(0 /* SourceFile */, node);\n        }\n        /**\n         * Emits a node.\n         */\n        function emit(node) {\n            pipelineEmitWithNotification(3 /* Unspecified */, node);\n        }\n        /**\n         * Emits an IdentifierName.\n         */\n        function emitIdentifierName(node) {\n            pipelineEmitWithNotification(2 /* IdentifierName */, node);\n        }\n        /**\n         * Emits an expression node.\n         */\n        function emitExpression(node) {\n            pipelineEmitWithNotification(1 /* Expression */, node);\n        }\n        /**\n         * Emits a node with possible notification.\n         *\n         * NOTE: Do not call this method directly. It is part of the emit pipeline\n         * and should only be called from printSourceFile, emit, emitExpression, or\n         * emitIdentifierName.\n         */\n        function pipelineEmitWithNotification(emitContext, node) {\n            emitNodeWithNotification(emitContext, node, pipelineEmitWithComments);\n        }\n        /**\n         * Emits a node with comments.\n         *\n         * NOTE: Do not call this method directly. It is part of the emit pipeline\n         * and should only be called indirectly from pipelineEmitWithNotification.\n         */\n        function pipelineEmitWithComments(emitContext, node) {\n            // Do not emit comments for SourceFile\n            if (emitContext === 0 /* SourceFile */) {\n                pipelineEmitWithSourceMap(emitContext, node);\n                return;\n            }\n            emitNodeWithComments(emitContext, node, pipelineEmitWithSourceMap);\n        }\n        /**\n         * Emits a node with source maps.\n         *\n         * NOTE: Do not call this method directly. It is part of the emit pipeline\n         * and should only be called indirectly from pipelineEmitWithComments.\n         */\n        function pipelineEmitWithSourceMap(emitContext, node) {\n            // Do not emit source mappings for SourceFile or IdentifierName\n            if (emitContext === 0 /* SourceFile */\n                || emitContext === 2 /* IdentifierName */) {\n                pipelineEmitWithSubstitution(emitContext, node);\n                return;\n            }\n            emitNodeWithSourceMap(emitContext, node, pipelineEmitWithSubstitution);\n        }\n        /**\n         * Emits a node with possible substitution.\n         *\n         * NOTE: Do not call this method directly. It is part of the emit pipeline\n         * and should only be called indirectly from pipelineEmitWithSourceMap or\n         * pipelineEmitInUnspecifiedContext (when picking a more specific context).\n         */\n        function pipelineEmitWithSubstitution(emitContext, node) {\n            emitNodeWithSubstitution(emitContext, node, pipelineEmitForContext);\n        }\n        /**\n         * Emits a node.\n         *\n         * NOTE: Do not call this method directly. It is part of the emit pipeline\n         * and should only be called indirectly from pipelineEmitWithSubstitution.\n         */\n        function pipelineEmitForContext(emitContext, node) {\n            switch (emitContext) {\n                case 0 /* SourceFile */: return pipelineEmitInSourceFileContext(node);\n                case 2 /* IdentifierName */: return pipelineEmitInIdentifierNameContext(node);\n                case 3 /* Unspecified */: return pipelineEmitInUnspecifiedContext(node);\n                case 1 /* Expression */: return pipelineEmitInExpressionContext(node);\n            }\n        }\n        /**\n         * Emits a node in the SourceFile EmitContext.\n         *\n         * NOTE: Do not call this method directly. It is part of the emit pipeline\n         * and should only be called indirectly from pipelineEmitForContext.\n         */\n        function pipelineEmitInSourceFileContext(node) {\n            var kind = node.kind;\n            switch (kind) {\n                // Top-level nodes\n                case 261 /* SourceFile */:\n                    return emitSourceFile(node);\n            }\n        }\n        /**\n         * Emits a node in the IdentifierName EmitContext.\n         *\n         * NOTE: Do not call this method directly. It is part of the emit pipeline\n         * and should only be called indirectly from pipelineEmitForContext.\n         */\n        function pipelineEmitInIdentifierNameContext(node) {\n            var kind = node.kind;\n            switch (kind) {\n                // Identifiers\n                case 70 /* Identifier */:\n                    return emitIdentifier(node);\n            }\n        }\n        /**\n         * Emits a node in the Unspecified EmitContext.\n         *\n         * NOTE: Do not call this method directly. It is part of the emit pipeline\n         * and should only be called indirectly from pipelineEmitForContext.\n         */\n        function pipelineEmitInUnspecifiedContext(node) {\n            var kind = node.kind;\n            switch (kind) {\n                // Pseudo-literals\n                case 13 /* TemplateHead */:\n                case 14 /* TemplateMiddle */:\n                case 15 /* TemplateTail */:\n                    return emitLiteral(node);\n                // Identifiers\n                case 70 /* Identifier */:\n                    return emitIdentifier(node);\n                // Reserved words\n                case 75 /* ConstKeyword */:\n                case 78 /* DefaultKeyword */:\n                case 83 /* ExportKeyword */:\n                case 104 /* VoidKeyword */:\n                // Strict mode reserved words\n                case 111 /* PrivateKeyword */:\n                case 112 /* ProtectedKeyword */:\n                case 113 /* PublicKeyword */:\n                case 114 /* StaticKeyword */:\n                // Contextual keywords\n                case 116 /* AbstractKeyword */:\n                case 117 /* AsKeyword */:\n                case 118 /* AnyKeyword */:\n                case 119 /* AsyncKeyword */:\n                case 120 /* AwaitKeyword */:\n                case 121 /* BooleanKeyword */:\n                case 122 /* ConstructorKeyword */:\n                case 123 /* DeclareKeyword */:\n                case 124 /* GetKeyword */:\n                case 125 /* IsKeyword */:\n                case 127 /* ModuleKeyword */:\n                case 128 /* NamespaceKeyword */:\n                case 129 /* NeverKeyword */:\n                case 130 /* ReadonlyKeyword */:\n                case 131 /* RequireKeyword */:\n                case 132 /* NumberKeyword */:\n                case 133 /* SetKeyword */:\n                case 134 /* StringKeyword */:\n                case 135 /* SymbolKeyword */:\n                case 136 /* TypeKeyword */:\n                case 137 /* UndefinedKeyword */:\n                case 138 /* FromKeyword */:\n                case 139 /* GlobalKeyword */:\n                case 140 /* OfKeyword */:\n                    writeTokenText(kind);\n                    return;\n                // Parse tree nodes\n                // Names\n                case 141 /* QualifiedName */:\n                    return emitQualifiedName(node);\n                case 142 /* ComputedPropertyName */:\n                    return emitComputedPropertyName(node);\n                // Signature elements\n                case 143 /* TypeParameter */:\n                    return emitTypeParameter(node);\n                case 144 /* Parameter */:\n                    return emitParameter(node);\n                case 145 /* Decorator */:\n                    return emitDecorator(node);\n                // Type members\n                case 146 /* PropertySignature */:\n                    return emitPropertySignature(node);\n                case 147 /* PropertyDeclaration */:\n                    return emitPropertyDeclaration(node);\n                case 148 /* MethodSignature */:\n                    return emitMethodSignature(node);\n                case 149 /* MethodDeclaration */:\n                    return emitMethodDeclaration(node);\n                case 150 /* Constructor */:\n                    return emitConstructor(node);\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                    return emitAccessorDeclaration(node);\n                case 153 /* CallSignature */:\n                    return emitCallSignature(node);\n                case 154 /* ConstructSignature */:\n                    return emitConstructSignature(node);\n                case 155 /* IndexSignature */:\n                    return emitIndexSignature(node);\n                // Types\n                case 156 /* TypePredicate */:\n                    return emitTypePredicate(node);\n                case 157 /* TypeReference */:\n                    return emitTypeReference(node);\n                case 158 /* FunctionType */:\n                    return emitFunctionType(node);\n                case 159 /* ConstructorType */:\n                    return emitConstructorType(node);\n                case 160 /* TypeQuery */:\n                    return emitTypeQuery(node);\n                case 161 /* TypeLiteral */:\n                    return emitTypeLiteral(node);\n                case 162 /* ArrayType */:\n                    return emitArrayType(node);\n                case 163 /* TupleType */:\n                    return emitTupleType(node);\n                case 164 /* UnionType */:\n                    return emitUnionType(node);\n                case 165 /* IntersectionType */:\n                    return emitIntersectionType(node);\n                case 166 /* ParenthesizedType */:\n                    return emitParenthesizedType(node);\n                case 199 /* ExpressionWithTypeArguments */:\n                    return emitExpressionWithTypeArguments(node);\n                case 167 /* ThisType */:\n                    return emitThisType();\n                case 168 /* TypeOperator */:\n                    return emitTypeOperator(node);\n                case 169 /* IndexedAccessType */:\n                    return emitIndexedAccessType(node);\n                case 170 /* MappedType */:\n                    return emitMappedType(node);\n                case 171 /* LiteralType */:\n                    return emitLiteralType(node);\n                // Binding patterns\n                case 172 /* ObjectBindingPattern */:\n                    return emitObjectBindingPattern(node);\n                case 173 /* ArrayBindingPattern */:\n                    return emitArrayBindingPattern(node);\n                case 174 /* BindingElement */:\n                    return emitBindingElement(node);\n                // Misc\n                case 202 /* TemplateSpan */:\n                    return emitTemplateSpan(node);\n                case 203 /* SemicolonClassElement */:\n                    return emitSemicolonClassElement();\n                // Statements\n                case 204 /* Block */:\n                    return emitBlock(node);\n                case 205 /* VariableStatement */:\n                    return emitVariableStatement(node);\n                case 206 /* EmptyStatement */:\n                    return emitEmptyStatement();\n                case 207 /* ExpressionStatement */:\n                    return emitExpressionStatement(node);\n                case 208 /* IfStatement */:\n                    return emitIfStatement(node);\n                case 209 /* DoStatement */:\n                    return emitDoStatement(node);\n                case 210 /* WhileStatement */:\n                    return emitWhileStatement(node);\n                case 211 /* ForStatement */:\n                    return emitForStatement(node);\n                case 212 /* ForInStatement */:\n                    return emitForInStatement(node);\n                case 213 /* ForOfStatement */:\n                    return emitForOfStatement(node);\n                case 214 /* ContinueStatement */:\n                    return emitContinueStatement(node);\n                case 215 /* BreakStatement */:\n                    return emitBreakStatement(node);\n                case 216 /* ReturnStatement */:\n                    return emitReturnStatement(node);\n                case 217 /* WithStatement */:\n                    return emitWithStatement(node);\n                case 218 /* SwitchStatement */:\n                    return emitSwitchStatement(node);\n                case 219 /* LabeledStatement */:\n                    return emitLabeledStatement(node);\n                case 220 /* ThrowStatement */:\n                    return emitThrowStatement(node);\n                case 221 /* TryStatement */:\n                    return emitTryStatement(node);\n                case 222 /* DebuggerStatement */:\n                    return emitDebuggerStatement(node);\n                // Declarations\n                case 223 /* VariableDeclaration */:\n                    return emitVariableDeclaration(node);\n                case 224 /* VariableDeclarationList */:\n                    return emitVariableDeclarationList(node);\n                case 225 /* FunctionDeclaration */:\n                    return emitFunctionDeclaration(node);\n                case 226 /* ClassDeclaration */:\n                    return emitClassDeclaration(node);\n                case 227 /* InterfaceDeclaration */:\n                    return emitInterfaceDeclaration(node);\n                case 228 /* TypeAliasDeclaration */:\n                    return emitTypeAliasDeclaration(node);\n                case 229 /* EnumDeclaration */:\n                    return emitEnumDeclaration(node);\n                case 230 /* ModuleDeclaration */:\n                    return emitModuleDeclaration(node);\n                case 231 /* ModuleBlock */:\n                    return emitModuleBlock(node);\n                case 232 /* CaseBlock */:\n                    return emitCaseBlock(node);\n                case 234 /* ImportEqualsDeclaration */:\n                    return emitImportEqualsDeclaration(node);\n                case 235 /* ImportDeclaration */:\n                    return emitImportDeclaration(node);\n                case 236 /* ImportClause */:\n                    return emitImportClause(node);\n                case 237 /* NamespaceImport */:\n                    return emitNamespaceImport(node);\n                case 238 /* NamedImports */:\n                    return emitNamedImports(node);\n                case 239 /* ImportSpecifier */:\n                    return emitImportSpecifier(node);\n                case 240 /* ExportAssignment */:\n                    return emitExportAssignment(node);\n                case 241 /* ExportDeclaration */:\n                    return emitExportDeclaration(node);\n                case 242 /* NamedExports */:\n                    return emitNamedExports(node);\n                case 243 /* ExportSpecifier */:\n                    return emitExportSpecifier(node);\n                case 244 /* MissingDeclaration */:\n                    return;\n                // Module references\n                case 245 /* ExternalModuleReference */:\n                    return emitExternalModuleReference(node);\n                // JSX (non-expression)\n                case 10 /* JsxText */:\n                    return emitJsxText(node);\n                case 248 /* JsxOpeningElement */:\n                    return emitJsxOpeningElement(node);\n                case 249 /* JsxClosingElement */:\n                    return emitJsxClosingElement(node);\n                case 250 /* JsxAttribute */:\n                    return emitJsxAttribute(node);\n                case 251 /* JsxSpreadAttribute */:\n                    return emitJsxSpreadAttribute(node);\n                case 252 /* JsxExpression */:\n                    return emitJsxExpression(node);\n                // Clauses\n                case 253 /* CaseClause */:\n                    return emitCaseClause(node);\n                case 254 /* DefaultClause */:\n                    return emitDefaultClause(node);\n                case 255 /* HeritageClause */:\n                    return emitHeritageClause(node);\n                case 256 /* CatchClause */:\n                    return emitCatchClause(node);\n                // Property assignments\n                case 257 /* PropertyAssignment */:\n                    return emitPropertyAssignment(node);\n                case 258 /* ShorthandPropertyAssignment */:\n                    return emitShorthandPropertyAssignment(node);\n                case 259 /* SpreadAssignment */:\n                    return emitSpreadAssignment(node);\n                // Enum\n                case 260 /* EnumMember */:\n                    return emitEnumMember(node);\n            }\n            // If the node is an expression, try to emit it as an expression with\n            // substitution.\n            if (ts.isExpression(node)) {\n                return pipelineEmitWithSubstitution(1 /* Expression */, node);\n            }\n        }\n        /**\n         * Emits a node in the Expression EmitContext.\n         *\n         * NOTE: Do not call this method directly. It is part of the emit pipeline\n         * and should only be called indirectly from pipelineEmitForContext.\n         */\n        function pipelineEmitInExpressionContext(node) {\n            var kind = node.kind;\n            switch (kind) {\n                // Literals\n                case 8 /* NumericLiteral */:\n                    return emitNumericLiteral(node);\n                case 9 /* StringLiteral */:\n                case 11 /* RegularExpressionLiteral */:\n                case 12 /* NoSubstitutionTemplateLiteral */:\n                    return emitLiteral(node);\n                // Identifiers\n                case 70 /* Identifier */:\n                    return emitIdentifier(node);\n                // Reserved words\n                case 85 /* FalseKeyword */:\n                case 94 /* NullKeyword */:\n                case 96 /* SuperKeyword */:\n                case 100 /* TrueKeyword */:\n                case 98 /* ThisKeyword */:\n                    writeTokenText(kind);\n                    return;\n                // Expressions\n                case 175 /* ArrayLiteralExpression */:\n                    return emitArrayLiteralExpression(node);\n                case 176 /* ObjectLiteralExpression */:\n                    return emitObjectLiteralExpression(node);\n                case 177 /* PropertyAccessExpression */:\n                    return emitPropertyAccessExpression(node);\n                case 178 /* ElementAccessExpression */:\n                    return emitElementAccessExpression(node);\n                case 179 /* CallExpression */:\n                    return emitCallExpression(node);\n                case 180 /* NewExpression */:\n                    return emitNewExpression(node);\n                case 181 /* TaggedTemplateExpression */:\n                    return emitTaggedTemplateExpression(node);\n                case 182 /* TypeAssertionExpression */:\n                    return emitTypeAssertionExpression(node);\n                case 183 /* ParenthesizedExpression */:\n                    return emitParenthesizedExpression(node);\n                case 184 /* FunctionExpression */:\n                    return emitFunctionExpression(node);\n                case 185 /* ArrowFunction */:\n                    return emitArrowFunction(node);\n                case 186 /* DeleteExpression */:\n                    return emitDeleteExpression(node);\n                case 187 /* TypeOfExpression */:\n                    return emitTypeOfExpression(node);\n                case 188 /* VoidExpression */:\n                    return emitVoidExpression(node);\n                case 189 /* AwaitExpression */:\n                    return emitAwaitExpression(node);\n                case 190 /* PrefixUnaryExpression */:\n                    return emitPrefixUnaryExpression(node);\n                case 191 /* PostfixUnaryExpression */:\n                    return emitPostfixUnaryExpression(node);\n                case 192 /* BinaryExpression */:\n                    return emitBinaryExpression(node);\n                case 193 /* ConditionalExpression */:\n                    return emitConditionalExpression(node);\n                case 194 /* TemplateExpression */:\n                    return emitTemplateExpression(node);\n                case 195 /* YieldExpression */:\n                    return emitYieldExpression(node);\n                case 196 /* SpreadElement */:\n                    return emitSpreadExpression(node);\n                case 197 /* ClassExpression */:\n                    return emitClassExpression(node);\n                case 198 /* OmittedExpression */:\n                    return;\n                case 200 /* AsExpression */:\n                    return emitAsExpression(node);\n                case 201 /* NonNullExpression */:\n                    return emitNonNullExpression(node);\n                // JSX\n                case 246 /* JsxElement */:\n                    return emitJsxElement(node);\n                case 247 /* JsxSelfClosingElement */:\n                    return emitJsxSelfClosingElement(node);\n                // Transformation nodes\n                case 294 /* PartiallyEmittedExpression */:\n                    return emitPartiallyEmittedExpression(node);\n                case 297 /* RawExpression */:\n                    return writeLines(node.text);\n            }\n        }\n        //\n        // Literals/Pseudo-literals\n        //\n        // SyntaxKind.NumericLiteral\n        function emitNumericLiteral(node) {\n            emitLiteral(node);\n            if (node.trailingComment) {\n                write(\" /*\" + node.trailingComment + \"*/\");\n            }\n        }\n        // SyntaxKind.StringLiteral\n        // SyntaxKind.RegularExpressionLiteral\n        // SyntaxKind.NoSubstitutionTemplateLiteral\n        // SyntaxKind.TemplateHead\n        // SyntaxKind.TemplateMiddle\n        // SyntaxKind.TemplateTail\n        function emitLiteral(node) {\n            var text = getLiteralTextOfNode(node);\n            if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap)\n                && (node.kind === 9 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) {\n                writer.writeLiteral(text);\n            }\n            else {\n                write(text);\n            }\n        }\n        //\n        // Identifiers\n        //\n        function emitIdentifier(node) {\n            write(getTextOfNode(node, /*includeTrivia*/ false));\n        }\n        //\n        // Names\n        //\n        function emitQualifiedName(node) {\n            emitEntityName(node.left);\n            write(\".\");\n            emit(node.right);\n        }\n        function emitEntityName(node) {\n            if (node.kind === 70 /* Identifier */) {\n                emitExpression(node);\n            }\n            else {\n                emit(node);\n            }\n        }\n        function emitComputedPropertyName(node) {\n            write(\"[\");\n            emitExpression(node.expression);\n            write(\"]\");\n        }\n        //\n        // Signature elements\n        //\n        function emitTypeParameter(node) {\n            emit(node.name);\n            emitWithPrefix(\" extends \", node.constraint);\n        }\n        function emitParameter(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            writeIfPresent(node.dotDotDotToken, \"...\");\n            emit(node.name);\n            writeIfPresent(node.questionToken, \"?\");\n            emitExpressionWithPrefix(\" = \", node.initializer);\n            emitWithPrefix(\": \", node.type);\n        }\n        function emitDecorator(decorator) {\n            write(\"@\");\n            emitExpression(decorator.expression);\n        }\n        //\n        // Type members\n        //\n        function emitPropertySignature(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emit(node.name);\n            writeIfPresent(node.questionToken, \"?\");\n            emitWithPrefix(\": \", node.type);\n            write(\";\");\n        }\n        function emitPropertyDeclaration(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emit(node.name);\n            emitWithPrefix(\": \", node.type);\n            emitExpressionWithPrefix(\" = \", node.initializer);\n            write(\";\");\n        }\n        function emitMethodSignature(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emit(node.name);\n            writeIfPresent(node.questionToken, \"?\");\n            emitTypeParameters(node, node.typeParameters);\n            emitParameters(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n            write(\";\");\n        }\n        function emitMethodDeclaration(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            writeIfPresent(node.asteriskToken, \"*\");\n            emit(node.name);\n            emitSignatureAndBody(node, emitSignatureHead);\n        }\n        function emitConstructor(node) {\n            emitModifiers(node, node.modifiers);\n            write(\"constructor\");\n            emitSignatureAndBody(node, emitSignatureHead);\n        }\n        function emitAccessorDeclaration(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(node.kind === 151 /* GetAccessor */ ? \"get \" : \"set \");\n            emit(node.name);\n            emitSignatureAndBody(node, emitSignatureHead);\n        }\n        function emitCallSignature(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emitTypeParameters(node, node.typeParameters);\n            emitParameters(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n            write(\";\");\n        }\n        function emitConstructSignature(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(\"new \");\n            emitTypeParameters(node, node.typeParameters);\n            emitParameters(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n            write(\";\");\n        }\n        function emitIndexSignature(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emitParametersForIndexSignature(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n            write(\";\");\n        }\n        function emitSemicolonClassElement() {\n            write(\";\");\n        }\n        //\n        // Types\n        //\n        function emitTypePredicate(node) {\n            emit(node.parameterName);\n            write(\" is \");\n            emit(node.type);\n        }\n        function emitTypeReference(node) {\n            emit(node.typeName);\n            emitTypeArguments(node, node.typeArguments);\n        }\n        function emitFunctionType(node) {\n            emitTypeParameters(node, node.typeParameters);\n            emitParametersForArrow(node, node.parameters);\n            write(\" => \");\n            emit(node.type);\n        }\n        function emitConstructorType(node) {\n            write(\"new \");\n            emitTypeParameters(node, node.typeParameters);\n            emitParametersForArrow(node, node.parameters);\n            write(\" => \");\n            emit(node.type);\n        }\n        function emitTypeQuery(node) {\n            write(\"typeof \");\n            emit(node.exprName);\n        }\n        function emitTypeLiteral(node) {\n            write(\"{\");\n            emitList(node, node.members, 65 /* TypeLiteralMembers */);\n            write(\"}\");\n        }\n        function emitArrayType(node) {\n            emit(node.elementType);\n            write(\"[]\");\n        }\n        function emitTupleType(node) {\n            write(\"[\");\n            emitList(node, node.elementTypes, 336 /* TupleTypeElements */);\n            write(\"]\");\n        }\n        function emitUnionType(node) {\n            emitList(node, node.types, 260 /* UnionTypeConstituents */);\n        }\n        function emitIntersectionType(node) {\n            emitList(node, node.types, 264 /* IntersectionTypeConstituents */);\n        }\n        function emitParenthesizedType(node) {\n            write(\"(\");\n            emit(node.type);\n            write(\")\");\n        }\n        function emitThisType() {\n            write(\"this\");\n        }\n        function emitTypeOperator(node) {\n            writeTokenText(node.operator);\n            write(\" \");\n            emit(node.type);\n        }\n        function emitIndexedAccessType(node) {\n            emit(node.objectType);\n            write(\"[\");\n            emit(node.indexType);\n            write(\"]\");\n        }\n        function emitMappedType(node) {\n            write(\"{\");\n            writeLine();\n            increaseIndent();\n            if (node.readonlyToken) {\n                write(\"readonly \");\n            }\n            write(\"[\");\n            emit(node.typeParameter.name);\n            write(\" in \");\n            emit(node.typeParameter.constraint);\n            write(\"]\");\n            if (node.questionToken) {\n                write(\"?\");\n            }\n            write(\": \");\n            emit(node.type);\n            write(\";\");\n            writeLine();\n            decreaseIndent();\n            write(\"}\");\n        }\n        function emitLiteralType(node) {\n            emitExpression(node.literal);\n        }\n        //\n        // Binding patterns\n        //\n        function emitObjectBindingPattern(node) {\n            var elements = node.elements;\n            if (elements.length === 0) {\n                write(\"{}\");\n            }\n            else {\n                write(\"{\");\n                emitList(node, elements, 432 /* ObjectBindingPatternElements */);\n                write(\"}\");\n            }\n        }\n        function emitArrayBindingPattern(node) {\n            var elements = node.elements;\n            if (elements.length === 0) {\n                write(\"[]\");\n            }\n            else {\n                write(\"[\");\n                emitList(node, node.elements, 304 /* ArrayBindingPatternElements */);\n                write(\"]\");\n            }\n        }\n        function emitBindingElement(node) {\n            emitWithSuffix(node.propertyName, \": \");\n            writeIfPresent(node.dotDotDotToken, \"...\");\n            emit(node.name);\n            emitExpressionWithPrefix(\" = \", node.initializer);\n        }\n        //\n        // Expressions\n        //\n        function emitArrayLiteralExpression(node) {\n            var elements = node.elements;\n            if (elements.length === 0) {\n                write(\"[]\");\n            }\n            else {\n                var preferNewLine = node.multiLine ? 32768 /* PreferNewLine */ : 0 /* None */;\n                emitExpressionList(node, elements, 4466 /* ArrayLiteralExpressionElements */ | preferNewLine);\n            }\n        }\n        function emitObjectLiteralExpression(node) {\n            var properties = node.properties;\n            if (properties.length === 0) {\n                write(\"{}\");\n            }\n            else {\n                var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */;\n                if (indentedFlag) {\n                    increaseIndent();\n                }\n                var preferNewLine = node.multiLine ? 32768 /* PreferNewLine */ : 0 /* None */;\n                var allowTrailingComma = languageVersion >= 1 /* ES5 */ ? 32 /* AllowTrailingComma */ : 0 /* None */;\n                emitList(node, properties, 978 /* ObjectLiteralExpressionProperties */ | allowTrailingComma | preferNewLine);\n                if (indentedFlag) {\n                    decreaseIndent();\n                }\n            }\n        }\n        function emitPropertyAccessExpression(node) {\n            var indentBeforeDot = false;\n            var indentAfterDot = false;\n            if (!(ts.getEmitFlags(node) & 65536 /* NoIndentation */)) {\n                var dotRangeStart = node.expression.end;\n                var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1;\n                var dotToken = { kind: 22 /* DotToken */, pos: dotRangeStart, end: dotRangeEnd };\n                indentBeforeDot = needsIndentation(node, node.expression, dotToken);\n                indentAfterDot = needsIndentation(node, dotToken, node.name);\n            }\n            emitExpression(node.expression);\n            increaseIndentIf(indentBeforeDot);\n            var shouldEmitDotDot = !indentBeforeDot && needsDotDotForPropertyAccess(node.expression);\n            write(shouldEmitDotDot ? \"..\" : \".\");\n            increaseIndentIf(indentAfterDot);\n            emit(node.name);\n            decreaseIndentIf(indentBeforeDot, indentAfterDot);\n        }\n        // 1..toString is a valid property access, emit a dot after the literal\n        // Also emit a dot if expression is a integer const enum value - it will appear in generated code as numeric literal\n        function needsDotDotForPropertyAccess(expression) {\n            if (expression.kind === 8 /* NumericLiteral */) {\n                // check if numeric literal was originally written with a dot\n                var text = getLiteralTextOfNode(expression);\n                return text.indexOf(ts.tokenToString(22 /* DotToken */)) < 0;\n            }\n            else if (ts.isPropertyAccessExpression(expression) || ts.isElementAccessExpression(expression)) {\n                // check if constant enum value is integer\n                var constantValue = ts.getConstantValue(expression);\n                // isFinite handles cases when constantValue is undefined\n                return isFinite(constantValue)\n                    && Math.floor(constantValue) === constantValue\n                    && compilerOptions.removeComments;\n            }\n        }\n        function emitElementAccessExpression(node) {\n            emitExpression(node.expression);\n            write(\"[\");\n            emitExpression(node.argumentExpression);\n            write(\"]\");\n        }\n        function emitCallExpression(node) {\n            emitExpression(node.expression);\n            emitTypeArguments(node, node.typeArguments);\n            emitExpressionList(node, node.arguments, 1296 /* CallExpressionArguments */);\n        }\n        function emitNewExpression(node) {\n            write(\"new \");\n            emitExpression(node.expression);\n            emitTypeArguments(node, node.typeArguments);\n            emitExpressionList(node, node.arguments, 9488 /* NewExpressionArguments */);\n        }\n        function emitTaggedTemplateExpression(node) {\n            emitExpression(node.tag);\n            write(\" \");\n            emitExpression(node.template);\n        }\n        function emitTypeAssertionExpression(node) {\n            if (node.type) {\n                write(\"<\");\n                emit(node.type);\n                write(\">\");\n            }\n            emitExpression(node.expression);\n        }\n        function emitParenthesizedExpression(node) {\n            write(\"(\");\n            emitExpression(node.expression);\n            write(\")\");\n        }\n        function emitFunctionExpression(node) {\n            emitFunctionDeclarationOrExpression(node);\n        }\n        function emitArrowFunction(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            emitSignatureAndBody(node, emitArrowFunctionHead);\n        }\n        function emitArrowFunctionHead(node) {\n            emitTypeParameters(node, node.typeParameters);\n            emitParametersForArrow(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n            write(\" =>\");\n        }\n        function emitDeleteExpression(node) {\n            write(\"delete \");\n            emitExpression(node.expression);\n        }\n        function emitTypeOfExpression(node) {\n            write(\"typeof \");\n            emitExpression(node.expression);\n        }\n        function emitVoidExpression(node) {\n            write(\"void \");\n            emitExpression(node.expression);\n        }\n        function emitAwaitExpression(node) {\n            write(\"await \");\n            emitExpression(node.expression);\n        }\n        function emitPrefixUnaryExpression(node) {\n            writeTokenText(node.operator);\n            if (shouldEmitWhitespaceBeforeOperand(node)) {\n                write(\" \");\n            }\n            emitExpression(node.operand);\n        }\n        function shouldEmitWhitespaceBeforeOperand(node) {\n            // In some cases, we need to emit a space between the operator and the operand. One obvious case\n            // is when the operator is an identifier, like delete or typeof. We also need to do this for plus\n            // and minus expressions in certain cases. Specifically, consider the following two cases (parens\n            // are just for clarity of exposition, and not part of the source code):\n            //\n            //  (+(+1))\n            //  (+(++1))\n            //\n            // We need to emit a space in both cases. In the first case, the absence of a space will make\n            // the resulting expression a prefix increment operation. And in the second, it will make the resulting\n            // expression a prefix increment whose operand is a plus expression - (++(+x))\n            // The same is true of minus of course.\n            var operand = node.operand;\n            return operand.kind === 190 /* PrefixUnaryExpression */\n                && ((node.operator === 36 /* PlusToken */ && (operand.operator === 36 /* PlusToken */ || operand.operator === 42 /* PlusPlusToken */))\n                    || (node.operator === 37 /* MinusToken */ && (operand.operator === 37 /* MinusToken */ || operand.operator === 43 /* MinusMinusToken */)));\n        }\n        function emitPostfixUnaryExpression(node) {\n            emitExpression(node.operand);\n            writeTokenText(node.operator);\n        }\n        function emitBinaryExpression(node) {\n            var isCommaOperator = node.operatorToken.kind !== 25 /* CommaToken */;\n            var indentBeforeOperator = needsIndentation(node, node.left, node.operatorToken);\n            var indentAfterOperator = needsIndentation(node, node.operatorToken, node.right);\n            emitExpression(node.left);\n            increaseIndentIf(indentBeforeOperator, isCommaOperator ? \" \" : undefined);\n            writeTokenText(node.operatorToken.kind);\n            increaseIndentIf(indentAfterOperator, \" \");\n            emitExpression(node.right);\n            decreaseIndentIf(indentBeforeOperator, indentAfterOperator);\n        }\n        function emitConditionalExpression(node) {\n            var indentBeforeQuestion = needsIndentation(node, node.condition, node.questionToken);\n            var indentAfterQuestion = needsIndentation(node, node.questionToken, node.whenTrue);\n            var indentBeforeColon = needsIndentation(node, node.whenTrue, node.colonToken);\n            var indentAfterColon = needsIndentation(node, node.colonToken, node.whenFalse);\n            emitExpression(node.condition);\n            increaseIndentIf(indentBeforeQuestion, \" \");\n            write(\"?\");\n            increaseIndentIf(indentAfterQuestion, \" \");\n            emitExpression(node.whenTrue);\n            decreaseIndentIf(indentBeforeQuestion, indentAfterQuestion);\n            increaseIndentIf(indentBeforeColon, \" \");\n            write(\":\");\n            increaseIndentIf(indentAfterColon, \" \");\n            emitExpression(node.whenFalse);\n            decreaseIndentIf(indentBeforeColon, indentAfterColon);\n        }\n        function emitTemplateExpression(node) {\n            emit(node.head);\n            emitList(node, node.templateSpans, 131072 /* TemplateExpressionSpans */);\n        }\n        function emitYieldExpression(node) {\n            write(node.asteriskToken ? \"yield*\" : \"yield\");\n            emitExpressionWithPrefix(\" \", node.expression);\n        }\n        function emitSpreadExpression(node) {\n            write(\"...\");\n            emitExpression(node.expression);\n        }\n        function emitClassExpression(node) {\n            emitClassDeclarationOrExpression(node);\n        }\n        function emitExpressionWithTypeArguments(node) {\n            emitExpression(node.expression);\n            emitTypeArguments(node, node.typeArguments);\n        }\n        function emitAsExpression(node) {\n            emitExpression(node.expression);\n            if (node.type) {\n                write(\" as \");\n                emit(node.type);\n            }\n        }\n        function emitNonNullExpression(node) {\n            emitExpression(node.expression);\n            write(\"!\");\n        }\n        //\n        // Misc\n        //\n        function emitTemplateSpan(node) {\n            emitExpression(node.expression);\n            emit(node.literal);\n        }\n        //\n        // Statements\n        //\n        function emitBlock(node) {\n            if (isSingleLineEmptyBlock(node)) {\n                writeToken(16 /* OpenBraceToken */, node.pos, /*contextNode*/ node);\n                write(\" \");\n                writeToken(17 /* CloseBraceToken */, node.statements.end, /*contextNode*/ node);\n            }\n            else {\n                writeToken(16 /* OpenBraceToken */, node.pos, /*contextNode*/ node);\n                emitBlockStatements(node);\n                writeToken(17 /* CloseBraceToken */, node.statements.end, /*contextNode*/ node);\n            }\n        }\n        function emitBlockStatements(node) {\n            if (ts.getEmitFlags(node) & 1 /* SingleLine */) {\n                emitList(node, node.statements, 384 /* SingleLineBlockStatements */);\n            }\n            else {\n                emitList(node, node.statements, 65 /* MultiLineBlockStatements */);\n            }\n        }\n        function emitVariableStatement(node) {\n            emitModifiers(node, node.modifiers);\n            emit(node.declarationList);\n            write(\";\");\n        }\n        function emitEmptyStatement() {\n            write(\";\");\n        }\n        function emitExpressionStatement(node) {\n            emitExpression(node.expression);\n            write(\";\");\n        }\n        function emitIfStatement(node) {\n            var openParenPos = writeToken(89 /* IfKeyword */, node.pos, node);\n            write(\" \");\n            writeToken(18 /* OpenParenToken */, openParenPos, node);\n            emitExpression(node.expression);\n            writeToken(19 /* CloseParenToken */, node.expression.end, node);\n            emitEmbeddedStatement(node.thenStatement);\n            if (node.elseStatement) {\n                writeLine();\n                writeToken(81 /* ElseKeyword */, node.thenStatement.end, node);\n                if (node.elseStatement.kind === 208 /* IfStatement */) {\n                    write(\" \");\n                    emit(node.elseStatement);\n                }\n                else {\n                    emitEmbeddedStatement(node.elseStatement);\n                }\n            }\n        }\n        function emitDoStatement(node) {\n            write(\"do\");\n            emitEmbeddedStatement(node.statement);\n            if (ts.isBlock(node.statement)) {\n                write(\" \");\n            }\n            else {\n                writeLine();\n            }\n            write(\"while (\");\n            emitExpression(node.expression);\n            write(\");\");\n        }\n        function emitWhileStatement(node) {\n            write(\"while (\");\n            emitExpression(node.expression);\n            write(\")\");\n            emitEmbeddedStatement(node.statement);\n        }\n        function emitForStatement(node) {\n            var openParenPos = writeToken(87 /* ForKeyword */, node.pos);\n            write(\" \");\n            writeToken(18 /* OpenParenToken */, openParenPos, /*contextNode*/ node);\n            emitForBinding(node.initializer);\n            write(\";\");\n            emitExpressionWithPrefix(\" \", node.condition);\n            write(\";\");\n            emitExpressionWithPrefix(\" \", node.incrementor);\n            write(\")\");\n            emitEmbeddedStatement(node.statement);\n        }\n        function emitForInStatement(node) {\n            var openParenPos = writeToken(87 /* ForKeyword */, node.pos);\n            write(\" \");\n            writeToken(18 /* OpenParenToken */, openParenPos);\n            emitForBinding(node.initializer);\n            write(\" in \");\n            emitExpression(node.expression);\n            writeToken(19 /* CloseParenToken */, node.expression.end);\n            emitEmbeddedStatement(node.statement);\n        }\n        function emitForOfStatement(node) {\n            var openParenPos = writeToken(87 /* ForKeyword */, node.pos);\n            write(\" \");\n            writeToken(18 /* OpenParenToken */, openParenPos);\n            emitForBinding(node.initializer);\n            write(\" of \");\n            emitExpression(node.expression);\n            writeToken(19 /* CloseParenToken */, node.expression.end);\n            emitEmbeddedStatement(node.statement);\n        }\n        function emitForBinding(node) {\n            if (node !== undefined) {\n                if (node.kind === 224 /* VariableDeclarationList */) {\n                    emit(node);\n                }\n                else {\n                    emitExpression(node);\n                }\n            }\n        }\n        function emitContinueStatement(node) {\n            writeToken(76 /* ContinueKeyword */, node.pos);\n            emitWithPrefix(\" \", node.label);\n            write(\";\");\n        }\n        function emitBreakStatement(node) {\n            writeToken(71 /* BreakKeyword */, node.pos);\n            emitWithPrefix(\" \", node.label);\n            write(\";\");\n        }\n        function emitReturnStatement(node) {\n            writeToken(95 /* ReturnKeyword */, node.pos, /*contextNode*/ node);\n            emitExpressionWithPrefix(\" \", node.expression);\n            write(\";\");\n        }\n        function emitWithStatement(node) {\n            write(\"with (\");\n            emitExpression(node.expression);\n            write(\")\");\n            emitEmbeddedStatement(node.statement);\n        }\n        function emitSwitchStatement(node) {\n            var openParenPos = writeToken(97 /* SwitchKeyword */, node.pos);\n            write(\" \");\n            writeToken(18 /* OpenParenToken */, openParenPos);\n            emitExpression(node.expression);\n            writeToken(19 /* CloseParenToken */, node.expression.end);\n            write(\" \");\n            emit(node.caseBlock);\n        }\n        function emitLabeledStatement(node) {\n            emit(node.label);\n            write(\": \");\n            emit(node.statement);\n        }\n        function emitThrowStatement(node) {\n            write(\"throw\");\n            emitExpressionWithPrefix(\" \", node.expression);\n            write(\";\");\n        }\n        function emitTryStatement(node) {\n            write(\"try \");\n            emit(node.tryBlock);\n            emit(node.catchClause);\n            if (node.finallyBlock) {\n                writeLine();\n                write(\"finally \");\n                emit(node.finallyBlock);\n            }\n        }\n        function emitDebuggerStatement(node) {\n            writeToken(77 /* DebuggerKeyword */, node.pos);\n            write(\";\");\n        }\n        //\n        // Declarations\n        //\n        function emitVariableDeclaration(node) {\n            emit(node.name);\n            emitWithPrefix(\": \", node.type);\n            emitExpressionWithPrefix(\" = \", node.initializer);\n        }\n        function emitVariableDeclarationList(node) {\n            write(ts.isLet(node) ? \"let \" : ts.isConst(node) ? \"const \" : \"var \");\n            emitList(node, node.declarations, 272 /* VariableDeclarationList */);\n        }\n        function emitFunctionDeclaration(node) {\n            emitFunctionDeclarationOrExpression(node);\n        }\n        function emitFunctionDeclarationOrExpression(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(node.asteriskToken ? \"function* \" : \"function \");\n            emitIdentifierName(node.name);\n            emitSignatureAndBody(node, emitSignatureHead);\n        }\n        function emitSignatureAndBody(node, emitSignatureHead) {\n            var body = node.body;\n            if (body) {\n                if (ts.isBlock(body)) {\n                    var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */;\n                    if (indentedFlag) {\n                        increaseIndent();\n                    }\n                    if (ts.getEmitFlags(node) & 262144 /* ReuseTempVariableScope */) {\n                        emitSignatureHead(node);\n                        emitBlockFunctionBody(body);\n                    }\n                    else {\n                        var savedTempFlags = tempFlags;\n                        tempFlags = 0;\n                        emitSignatureHead(node);\n                        emitBlockFunctionBody(body);\n                        tempFlags = savedTempFlags;\n                    }\n                    if (indentedFlag) {\n                        decreaseIndent();\n                    }\n                }\n                else {\n                    emitSignatureHead(node);\n                    write(\" \");\n                    emitExpression(body);\n                }\n            }\n            else {\n                emitSignatureHead(node);\n                write(\";\");\n            }\n        }\n        function emitSignatureHead(node) {\n            emitTypeParameters(node, node.typeParameters);\n            emitParameters(node, node.parameters);\n            emitWithPrefix(\": \", node.type);\n        }\n        function shouldEmitBlockFunctionBodyOnSingleLine(body) {\n            // We must emit a function body as a single-line body in the following case:\n            // * The body has NodeEmitFlags.SingleLine specified.\n            // We must emit a function body as a multi-line body in the following cases:\n            // * The body is explicitly marked as multi-line.\n            // * A non-synthesized body's start and end position are on different lines.\n            // * Any statement in the body starts on a new line.\n            if (ts.getEmitFlags(body) & 1 /* SingleLine */) {\n                return true;\n            }\n            if (body.multiLine) {\n                return false;\n            }\n            if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {\n                return false;\n            }\n            if (shouldWriteLeadingLineTerminator(body, body.statements, 2 /* PreserveLines */)\n                || shouldWriteClosingLineTerminator(body, body.statements, 2 /* PreserveLines */)) {\n                return false;\n            }\n            var previousStatement;\n            for (var _a = 0, _b = body.statements; _a < _b.length; _a++) {\n                var statement = _b[_a];\n                if (shouldWriteSeparatingLineTerminator(previousStatement, statement, 2 /* PreserveLines */)) {\n                    return false;\n                }\n                previousStatement = statement;\n            }\n            return true;\n        }\n        function emitBlockFunctionBody(body) {\n            write(\" {\");\n            increaseIndent();\n            emitBodyWithDetachedComments(body, body.statements, shouldEmitBlockFunctionBodyOnSingleLine(body)\n                ? emitBlockFunctionBodyOnSingleLine\n                : emitBlockFunctionBodyWorker);\n            decreaseIndent();\n            writeToken(17 /* CloseBraceToken */, body.statements.end, body);\n        }\n        function emitBlockFunctionBodyOnSingleLine(body) {\n            emitBlockFunctionBodyWorker(body, /*emitBlockFunctionBodyOnSingleLine*/ true);\n        }\n        function emitBlockFunctionBodyWorker(body, emitBlockFunctionBodyOnSingleLine) {\n            // Emit all the prologue directives (like \"use strict\").\n            var statementOffset = emitPrologueDirectives(body.statements, /*startWithNewLine*/ true);\n            var helpersEmitted = emitHelpers(body);\n            if (statementOffset === 0 && !helpersEmitted && emitBlockFunctionBodyOnSingleLine) {\n                decreaseIndent();\n                emitList(body, body.statements, 384 /* SingleLineFunctionBodyStatements */);\n                increaseIndent();\n            }\n            else {\n                emitList(body, body.statements, 1 /* MultiLineFunctionBodyStatements */, statementOffset);\n            }\n        }\n        function emitClassDeclaration(node) {\n            emitClassDeclarationOrExpression(node);\n        }\n        function emitClassDeclarationOrExpression(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(\"class\");\n            emitNodeWithPrefix(\" \", node.name, emitIdentifierName);\n            var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */;\n            if (indentedFlag) {\n                increaseIndent();\n            }\n            emitTypeParameters(node, node.typeParameters);\n            emitList(node, node.heritageClauses, 256 /* ClassHeritageClauses */);\n            var savedTempFlags = tempFlags;\n            tempFlags = 0;\n            write(\" {\");\n            emitList(node, node.members, 65 /* ClassMembers */);\n            write(\"}\");\n            if (indentedFlag) {\n                decreaseIndent();\n            }\n            tempFlags = savedTempFlags;\n        }\n        function emitInterfaceDeclaration(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(\"interface \");\n            emit(node.name);\n            emitTypeParameters(node, node.typeParameters);\n            emitList(node, node.heritageClauses, 256 /* HeritageClauses */);\n            write(\" {\");\n            emitList(node, node.members, 65 /* InterfaceMembers */);\n            write(\"}\");\n        }\n        function emitTypeAliasDeclaration(node) {\n            emitDecorators(node, node.decorators);\n            emitModifiers(node, node.modifiers);\n            write(\"type \");\n            emit(node.name);\n            emitTypeParameters(node, node.typeParameters);\n            write(\" = \");\n            emit(node.type);\n            write(\";\");\n        }\n        function emitEnumDeclaration(node) {\n            emitModifiers(node, node.modifiers);\n            write(\"enum \");\n            emit(node.name);\n            var savedTempFlags = tempFlags;\n            tempFlags = 0;\n            write(\" {\");\n            emitList(node, node.members, 81 /* EnumMembers */);\n            write(\"}\");\n            tempFlags = savedTempFlags;\n        }\n        function emitModuleDeclaration(node) {\n            emitModifiers(node, node.modifiers);\n            write(node.flags & 16 /* Namespace */ ? \"namespace \" : \"module \");\n            emit(node.name);\n            var body = node.body;\n            while (body.kind === 230 /* ModuleDeclaration */) {\n                write(\".\");\n                emit(body.name);\n                body = body.body;\n            }\n            write(\" \");\n            emit(body);\n        }\n        function emitModuleBlock(node) {\n            if (isEmptyBlock(node)) {\n                write(\"{ }\");\n            }\n            else {\n                var savedTempFlags = tempFlags;\n                tempFlags = 0;\n                write(\"{\");\n                increaseIndent();\n                emitBlockStatements(node);\n                write(\"}\");\n                tempFlags = savedTempFlags;\n            }\n        }\n        function emitCaseBlock(node) {\n            writeToken(16 /* OpenBraceToken */, node.pos);\n            emitList(node, node.clauses, 65 /* CaseBlockClauses */);\n            writeToken(17 /* CloseBraceToken */, node.clauses.end);\n        }\n        function emitImportEqualsDeclaration(node) {\n            emitModifiers(node, node.modifiers);\n            write(\"import \");\n            emit(node.name);\n            write(\" = \");\n            emitModuleReference(node.moduleReference);\n            write(\";\");\n        }\n        function emitModuleReference(node) {\n            if (node.kind === 70 /* Identifier */) {\n                emitExpression(node);\n            }\n            else {\n                emit(node);\n            }\n        }\n        function emitImportDeclaration(node) {\n            emitModifiers(node, node.modifiers);\n            write(\"import \");\n            if (node.importClause) {\n                emit(node.importClause);\n                write(\" from \");\n            }\n            emitExpression(node.moduleSpecifier);\n            write(\";\");\n        }\n        function emitImportClause(node) {\n            emit(node.name);\n            if (node.name && node.namedBindings) {\n                write(\", \");\n            }\n            emit(node.namedBindings);\n        }\n        function emitNamespaceImport(node) {\n            write(\"* as \");\n            emit(node.name);\n        }\n        function emitNamedImports(node) {\n            emitNamedImportsOrExports(node);\n        }\n        function emitImportSpecifier(node) {\n            emitImportOrExportSpecifier(node);\n        }\n        function emitExportAssignment(node) {\n            write(node.isExportEquals ? \"export = \" : \"export default \");\n            emitExpression(node.expression);\n            write(\";\");\n        }\n        function emitExportDeclaration(node) {\n            write(\"export \");\n            if (node.exportClause) {\n                emit(node.exportClause);\n            }\n            else {\n                write(\"*\");\n            }\n            if (node.moduleSpecifier) {\n                write(\" from \");\n                emitExpression(node.moduleSpecifier);\n            }\n            write(\";\");\n        }\n        function emitNamedExports(node) {\n            emitNamedImportsOrExports(node);\n        }\n        function emitExportSpecifier(node) {\n            emitImportOrExportSpecifier(node);\n        }\n        function emitNamedImportsOrExports(node) {\n            write(\"{\");\n            emitList(node, node.elements, 432 /* NamedImportsOrExportsElements */);\n            write(\"}\");\n        }\n        function emitImportOrExportSpecifier(node) {\n            if (node.propertyName) {\n                emit(node.propertyName);\n                write(\" as \");\n            }\n            emit(node.name);\n        }\n        //\n        // Module references\n        //\n        function emitExternalModuleReference(node) {\n            write(\"require(\");\n            emitExpression(node.expression);\n            write(\")\");\n        }\n        //\n        // JSX\n        //\n        function emitJsxElement(node) {\n            emit(node.openingElement);\n            emitList(node, node.children, 131072 /* JsxElementChildren */);\n            emit(node.closingElement);\n        }\n        function emitJsxSelfClosingElement(node) {\n            write(\"<\");\n            emitJsxTagName(node.tagName);\n            write(\" \");\n            emitList(node, node.attributes, 131328 /* JsxElementAttributes */);\n            write(\"/>\");\n        }\n        function emitJsxOpeningElement(node) {\n            write(\"<\");\n            emitJsxTagName(node.tagName);\n            writeIfAny(node.attributes, \" \");\n            emitList(node, node.attributes, 131328 /* JsxElementAttributes */);\n            write(\">\");\n        }\n        function emitJsxText(node) {\n            writer.writeLiteral(getTextOfNode(node, /*includeTrivia*/ true));\n        }\n        function emitJsxClosingElement(node) {\n            write(\"</\");\n            emitJsxTagName(node.tagName);\n            write(\">\");\n        }\n        function emitJsxAttribute(node) {\n            emit(node.name);\n            emitWithPrefix(\"=\", node.initializer);\n        }\n        function emitJsxSpreadAttribute(node) {\n            write(\"{...\");\n            emitExpression(node.expression);\n            write(\"}\");\n        }\n        function emitJsxExpression(node) {\n            if (node.expression) {\n                write(\"{\");\n                emitExpression(node.expression);\n                write(\"}\");\n            }\n        }\n        function emitJsxTagName(node) {\n            if (node.kind === 70 /* Identifier */) {\n                emitExpression(node);\n            }\n            else {\n                emit(node);\n            }\n        }\n        //\n        // Clauses\n        //\n        function emitCaseClause(node) {\n            write(\"case \");\n            emitExpression(node.expression);\n            write(\":\");\n            emitCaseOrDefaultClauseStatements(node, node.statements);\n        }\n        function emitDefaultClause(node) {\n            write(\"default:\");\n            emitCaseOrDefaultClauseStatements(node, node.statements);\n        }\n        function emitCaseOrDefaultClauseStatements(parentNode, statements) {\n            var emitAsSingleStatement = statements.length === 1 &&\n                (\n                // treat synthesized nodes as located on the same line for emit purposes\n                ts.nodeIsSynthesized(parentNode) ||\n                    ts.nodeIsSynthesized(statements[0]) ||\n                    ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile));\n            if (emitAsSingleStatement) {\n                write(\" \");\n                emit(statements[0]);\n            }\n            else {\n                emitList(parentNode, statements, 81985 /* CaseOrDefaultClauseStatements */);\n            }\n        }\n        function emitHeritageClause(node) {\n            write(\" \");\n            writeTokenText(node.token);\n            write(\" \");\n            emitList(node, node.types, 272 /* HeritageClauseTypes */);\n        }\n        function emitCatchClause(node) {\n            writeLine();\n            var openParenPos = writeToken(73 /* CatchKeyword */, node.pos);\n            write(\" \");\n            writeToken(18 /* OpenParenToken */, openParenPos);\n            emit(node.variableDeclaration);\n            writeToken(19 /* CloseParenToken */, node.variableDeclaration ? node.variableDeclaration.end : openParenPos);\n            write(\" \");\n            emit(node.block);\n        }\n        //\n        // Property assignments\n        //\n        function emitPropertyAssignment(node) {\n            emit(node.name);\n            write(\": \");\n            // This is to ensure that we emit comment in the following case:\n            //      For example:\n            //          obj = {\n            //              id: /*comment1*/ ()=>void\n            //          }\n            // \"comment1\" is not considered to be leading comment for node.initializer\n            // but rather a trailing comment on the previous node.\n            var initializer = node.initializer;\n            if ((ts.getEmitFlags(initializer) & 512 /* NoLeadingComments */) === 0) {\n                var commentRange = ts.getCommentRange(initializer);\n                emitTrailingCommentsOfPosition(commentRange.pos);\n            }\n            emitExpression(initializer);\n        }\n        function emitShorthandPropertyAssignment(node) {\n            emit(node.name);\n            if (node.objectAssignmentInitializer) {\n                write(\" = \");\n                emitExpression(node.objectAssignmentInitializer);\n            }\n        }\n        function emitSpreadAssignment(node) {\n            if (node.expression) {\n                write(\"...\");\n                emitExpression(node.expression);\n            }\n        }\n        //\n        // Enum\n        //\n        function emitEnumMember(node) {\n            emit(node.name);\n            emitExpressionWithPrefix(\" = \", node.initializer);\n        }\n        //\n        // Top-level nodes\n        //\n        function emitSourceFile(node) {\n            writeLine();\n            emitShebang();\n            emitBodyWithDetachedComments(node, node.statements, emitSourceFileWorker);\n        }\n        function emitSourceFileWorker(node) {\n            var statements = node.statements;\n            var statementOffset = emitPrologueDirectives(statements);\n            var savedTempFlags = tempFlags;\n            tempFlags = 0;\n            emitHelpers(node);\n            emitList(node, statements, 1 /* MultiLine */, statementOffset);\n            tempFlags = savedTempFlags;\n        }\n        // Transformation nodes\n        function emitPartiallyEmittedExpression(node) {\n            emitExpression(node.expression);\n        }\n        /**\n         * Emits any prologue directives at the start of a Statement list, returning the\n         * number of prologue directives written to the output.\n         */\n        function emitPrologueDirectives(statements, startWithNewLine) {\n            for (var i = 0; i < statements.length; i++) {\n                if (ts.isPrologueDirective(statements[i])) {\n                    if (startWithNewLine || i > 0) {\n                        writeLine();\n                    }\n                    emit(statements[i]);\n                }\n                else {\n                    // return index of the first non prologue directive\n                    return i;\n                }\n            }\n            return statements.length;\n        }\n        function emitHelpers(node, isBundle) {\n            var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile;\n            var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined);\n            var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit;\n            var helpersEmitted = false;\n            var helpers = ts.getEmitHelpers(node);\n            if (helpers) {\n                for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) {\n                    var helper = _b[_a];\n                    if (!helper.scoped) {\n                        // Skip the helper if it can be skipped and the noEmitHelpers compiler\n                        // option is set, or if it can be imported and the importHelpers compiler\n                        // option is set.\n                        if (shouldSkip)\n                            continue;\n                        // Skip the helper if it can be bundled but hasn't already been emitted and we\n                        // are emitting a bundled module.\n                        if (shouldBundle) {\n                            if (bundledHelpers[helper.name]) {\n                                continue;\n                            }\n                            bundledHelpers[helper.name] = true;\n                        }\n                    }\n                    else if (isBundle) {\n                        // Skip the helper if it is scoped and we are emitting bundled helpers\n                        continue;\n                    }\n                    writeLines(helper.text);\n                    helpersEmitted = true;\n                }\n            }\n            if (helpersEmitted) {\n                writeLine();\n            }\n            return helpersEmitted;\n        }\n        function writeLines(text) {\n            var lines = text.split(/\\r\\n?|\\n/g);\n            var indentation = guessIndentation(lines);\n            for (var i = 0; i < lines.length; i++) {\n                var line = indentation ? lines[i].slice(indentation) : lines[i];\n                if (line.length) {\n                    if (i > 0) {\n                        writeLine();\n                    }\n                    write(line);\n                }\n            }\n        }\n        function guessIndentation(lines) {\n            var indentation;\n            for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) {\n                var line = lines_1[_a];\n                for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) {\n                    if (!ts.isWhiteSpace(line.charCodeAt(i))) {\n                        if (indentation === undefined || i < indentation) {\n                            indentation = i;\n                            break;\n                        }\n                    }\n                }\n            }\n            return indentation;\n        }\n        //\n        // Helpers\n        //\n        function emitShebang() {\n            var shebang = ts.getShebang(currentText);\n            if (shebang) {\n                write(shebang);\n                writeLine();\n            }\n        }\n        function emitModifiers(node, modifiers) {\n            if (modifiers && modifiers.length) {\n                emitList(node, modifiers, 256 /* Modifiers */);\n                write(\" \");\n            }\n        }\n        function emitWithPrefix(prefix, node) {\n            emitNodeWithPrefix(prefix, node, emit);\n        }\n        function emitExpressionWithPrefix(prefix, node) {\n            emitNodeWithPrefix(prefix, node, emitExpression);\n        }\n        function emitNodeWithPrefix(prefix, node, emit) {\n            if (node) {\n                write(prefix);\n                emit(node);\n            }\n        }\n        function emitWithSuffix(node, suffix) {\n            if (node) {\n                emit(node);\n                write(suffix);\n            }\n        }\n        function emitEmbeddedStatement(node) {\n            if (ts.isBlock(node)) {\n                write(\" \");\n                emit(node);\n            }\n            else {\n                writeLine();\n                increaseIndent();\n                emit(node);\n                decreaseIndent();\n            }\n        }\n        function emitDecorators(parentNode, decorators) {\n            emitList(parentNode, decorators, 24577 /* Decorators */);\n        }\n        function emitTypeArguments(parentNode, typeArguments) {\n            emitList(parentNode, typeArguments, 26960 /* TypeArguments */);\n        }\n        function emitTypeParameters(parentNode, typeParameters) {\n            emitList(parentNode, typeParameters, 26960 /* TypeParameters */);\n        }\n        function emitParameters(parentNode, parameters) {\n            emitList(parentNode, parameters, 1360 /* Parameters */);\n        }\n        function emitParametersForArrow(parentNode, parameters) {\n            if (parameters &&\n                parameters.length === 1 &&\n                parameters[0].type === undefined &&\n                parameters[0].pos === parentNode.pos) {\n                emit(parameters[0]);\n            }\n            else {\n                emitParameters(parentNode, parameters);\n            }\n        }\n        function emitParametersForIndexSignature(parentNode, parameters) {\n            emitList(parentNode, parameters, 4432 /* IndexSignatureParameters */);\n        }\n        function emitList(parentNode, children, format, start, count) {\n            emitNodeList(emit, parentNode, children, format, start, count);\n        }\n        function emitExpressionList(parentNode, children, format, start, count) {\n            emitNodeList(emitExpression, parentNode, children, format, start, count);\n        }\n        function emitNodeList(emit, parentNode, children, format, start, count) {\n            if (start === void 0) { start = 0; }\n            if (count === void 0) { count = children ? children.length - start : 0; }\n            var isUndefined = children === undefined;\n            if (isUndefined && format & 8192 /* OptionalIfUndefined */) {\n                return;\n            }\n            var isEmpty = isUndefined || children.length === 0 || start >= children.length || count === 0;\n            if (isEmpty && format & 16384 /* OptionalIfEmpty */) {\n                return;\n            }\n            if (format & 7680 /* BracketsMask */) {\n                write(getOpeningBracket(format));\n            }\n            if (isEmpty) {\n                // Write a line terminator if the parent node was multi-line\n                if (format & 1 /* MultiLine */) {\n                    writeLine();\n                }\n                else if (format & 128 /* SpaceBetweenBraces */) {\n                    write(\" \");\n                }\n            }\n            else {\n                // Write the opening line terminator or leading whitespace.\n                var mayEmitInterveningComments = (format & 131072 /* NoInterveningComments */) === 0;\n                var shouldEmitInterveningComments = mayEmitInterveningComments;\n                if (shouldWriteLeadingLineTerminator(parentNode, children, format)) {\n                    writeLine();\n                    shouldEmitInterveningComments = false;\n                }\n                else if (format & 128 /* SpaceBetweenBraces */) {\n                    write(\" \");\n                }\n                // Increase the indent, if requested.\n                if (format & 64 /* Indented */) {\n                    increaseIndent();\n                }\n                // Emit each child.\n                var previousSibling = void 0;\n                var shouldDecreaseIndentAfterEmit = void 0;\n                var delimiter = getDelimiter(format);\n                for (var i = 0; i < count; i++) {\n                    var child = children[start + i];\n                    // Write the delimiter if this is not the first node.\n                    if (previousSibling) {\n                        write(delimiter);\n                        // Write either a line terminator or whitespace to separate the elements.\n                        if (shouldWriteSeparatingLineTerminator(previousSibling, child, format)) {\n                            // If a synthesized node in a single-line list starts on a new\n                            // line, we should increase the indent.\n                            if ((format & (3 /* LinesMask */ | 64 /* Indented */)) === 0 /* SingleLine */) {\n                                increaseIndent();\n                                shouldDecreaseIndentAfterEmit = true;\n                            }\n                            writeLine();\n                            shouldEmitInterveningComments = false;\n                        }\n                        else if (previousSibling && format & 256 /* SpaceBetweenSiblings */) {\n                            write(\" \");\n                        }\n                    }\n                    if (shouldEmitInterveningComments) {\n                        var commentRange = ts.getCommentRange(child);\n                        emitTrailingCommentsOfPosition(commentRange.pos);\n                    }\n                    else {\n                        shouldEmitInterveningComments = mayEmitInterveningComments;\n                    }\n                    // Emit this child.\n                    emit(child);\n                    if (shouldDecreaseIndentAfterEmit) {\n                        decreaseIndent();\n                        shouldDecreaseIndentAfterEmit = false;\n                    }\n                    previousSibling = child;\n                }\n                // Write a trailing comma, if requested.\n                var hasTrailingComma = (format & 32 /* AllowTrailingComma */) && children.hasTrailingComma;\n                if (format & 16 /* CommaDelimited */ && hasTrailingComma) {\n                    write(\",\");\n                }\n                // Decrease the indent, if requested.\n                if (format & 64 /* Indented */) {\n                    decreaseIndent();\n                }\n                // Write the closing line terminator or closing whitespace.\n                if (shouldWriteClosingLineTerminator(parentNode, children, format)) {\n                    writeLine();\n                }\n                else if (format & 128 /* SpaceBetweenBraces */) {\n                    write(\" \");\n                }\n            }\n            if (format & 7680 /* BracketsMask */) {\n                write(getClosingBracket(format));\n            }\n        }\n        function writeIfAny(nodes, text) {\n            if (nodes && nodes.length > 0) {\n                write(text);\n            }\n        }\n        function writeIfPresent(node, text) {\n            if (node !== undefined) {\n                write(text);\n            }\n        }\n        function writeToken(token, pos, contextNode) {\n            return emitTokenWithSourceMap(contextNode, token, pos, writeTokenText);\n        }\n        function writeTokenText(token, pos) {\n            var tokenString = ts.tokenToString(token);\n            write(tokenString);\n            return pos < 0 ? pos : pos + tokenString.length;\n        }\n        function increaseIndentIf(value, valueToWriteWhenNotIndenting) {\n            if (value) {\n                increaseIndent();\n                writeLine();\n            }\n            else if (valueToWriteWhenNotIndenting) {\n                write(valueToWriteWhenNotIndenting);\n            }\n        }\n        // Helper function to decrease the indent if we previously indented.  Allows multiple\n        // previous indent values to be considered at a time.  This also allows caller to just\n        // call this once, passing in all their appropriate indent values, instead of needing\n        // to call this helper function multiple times.\n        function decreaseIndentIf(value1, value2) {\n            if (value1) {\n                decreaseIndent();\n            }\n            if (value2) {\n                decreaseIndent();\n            }\n        }\n        function shouldWriteLeadingLineTerminator(parentNode, children, format) {\n            if (format & 1 /* MultiLine */) {\n                return true;\n            }\n            if (format & 2 /* PreserveLines */) {\n                if (format & 32768 /* PreferNewLine */) {\n                    return true;\n                }\n                var firstChild = children[0];\n                if (firstChild === undefined) {\n                    return !ts.rangeIsOnSingleLine(parentNode, currentSourceFile);\n                }\n                else if (ts.positionIsSynthesized(parentNode.pos) || ts.nodeIsSynthesized(firstChild)) {\n                    return synthesizedNodeStartsOnNewLine(firstChild, format);\n                }\n                else {\n                    return !ts.rangeStartPositionsAreOnSameLine(parentNode, firstChild, currentSourceFile);\n                }\n            }\n            else {\n                return false;\n            }\n        }\n        function shouldWriteSeparatingLineTerminator(previousNode, nextNode, format) {\n            if (format & 1 /* MultiLine */) {\n                return true;\n            }\n            else if (format & 2 /* PreserveLines */) {\n                if (previousNode === undefined || nextNode === undefined) {\n                    return false;\n                }\n                else if (ts.nodeIsSynthesized(previousNode) || ts.nodeIsSynthesized(nextNode)) {\n                    return synthesizedNodeStartsOnNewLine(previousNode, format) || synthesizedNodeStartsOnNewLine(nextNode, format);\n                }\n                else {\n                    return !ts.rangeEndIsOnSameLineAsRangeStart(previousNode, nextNode, currentSourceFile);\n                }\n            }\n            else {\n                return nextNode.startsOnNewLine;\n            }\n        }\n        function shouldWriteClosingLineTerminator(parentNode, children, format) {\n            if (format & 1 /* MultiLine */) {\n                return (format & 65536 /* NoTrailingNewLine */) === 0;\n            }\n            else if (format & 2 /* PreserveLines */) {\n                if (format & 32768 /* PreferNewLine */) {\n                    return true;\n                }\n                var lastChild = ts.lastOrUndefined(children);\n                if (lastChild === undefined) {\n                    return !ts.rangeIsOnSingleLine(parentNode, currentSourceFile);\n                }\n                else if (ts.positionIsSynthesized(parentNode.pos) || ts.nodeIsSynthesized(lastChild)) {\n                    return synthesizedNodeStartsOnNewLine(lastChild, format);\n                }\n                else {\n                    return !ts.rangeEndPositionsAreOnSameLine(parentNode, lastChild, currentSourceFile);\n                }\n            }\n            else {\n                return false;\n            }\n        }\n        function synthesizedNodeStartsOnNewLine(node, format) {\n            if (ts.nodeIsSynthesized(node)) {\n                var startsOnNewLine = node.startsOnNewLine;\n                if (startsOnNewLine === undefined) {\n                    return (format & 32768 /* PreferNewLine */) !== 0;\n                }\n                return startsOnNewLine;\n            }\n            return (format & 32768 /* PreferNewLine */) !== 0;\n        }\n        function needsIndentation(parent, node1, node2) {\n            parent = skipSynthesizedParentheses(parent);\n            node1 = skipSynthesizedParentheses(node1);\n            node2 = skipSynthesizedParentheses(node2);\n            // Always use a newline for synthesized code if the synthesizer desires it.\n            if (node2.startsOnNewLine) {\n                return true;\n            }\n            return !ts.nodeIsSynthesized(parent)\n                && !ts.nodeIsSynthesized(node1)\n                && !ts.nodeIsSynthesized(node2)\n                && !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile);\n        }\n        function skipSynthesizedParentheses(node) {\n            while (node.kind === 183 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {\n                node = node.expression;\n            }\n            return node;\n        }\n        function getTextOfNode(node, includeTrivia) {\n            if (ts.isGeneratedIdentifier(node)) {\n                return getGeneratedIdentifier(node);\n            }\n            else if (ts.isIdentifier(node) && (ts.nodeIsSynthesized(node) || !node.parent)) {\n                return ts.unescapeIdentifier(node.text);\n            }\n            else if (node.kind === 9 /* StringLiteral */ && node.textSourceNode) {\n                return getTextOfNode(node.textSourceNode, includeTrivia);\n            }\n            else if (ts.isLiteralExpression(node) && (ts.nodeIsSynthesized(node) || !node.parent)) {\n                return node.text;\n            }\n            return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node, includeTrivia);\n        }\n        function getLiteralTextOfNode(node) {\n            if (node.kind === 9 /* StringLiteral */ && node.textSourceNode) {\n                var textSourceNode = node.textSourceNode;\n                if (ts.isIdentifier(textSourceNode)) {\n                    return \"\\\"\" + ts.escapeNonAsciiCharacters(ts.escapeString(getTextOfNode(textSourceNode))) + \"\\\"\";\n                }\n                else {\n                    return getLiteralTextOfNode(textSourceNode);\n                }\n            }\n            return ts.getLiteralText(node, currentSourceFile, languageVersion);\n        }\n        function isSingleLineEmptyBlock(block) {\n            return !block.multiLine\n                && isEmptyBlock(block);\n        }\n        function isEmptyBlock(block) {\n            return block.statements.length === 0\n                && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);\n        }\n        function isUniqueName(name) {\n            return !resolver.hasGlobalName(name) &&\n                !ts.hasProperty(currentFileIdentifiers, name) &&\n                !ts.hasProperty(generatedNameSet, name);\n        }\n        function isUniqueLocalName(name, container) {\n            for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) {\n                if (node.locals && ts.hasProperty(node.locals, name)) {\n                    // We conservatively include alias symbols to cover cases where they're emitted as locals\n                    if (node.locals[name].flags & (107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */)) {\n                        return false;\n                    }\n                }\n            }\n            return true;\n        }\n        /**\n        * Return the next available name in the pattern _a ... _z, _0, _1, ...\n        * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name.\n        * Note that names generated by makeTempVariableName and makeUniqueName will never conflict.\n        */\n        function makeTempVariableName(flags) {\n            if (flags && !(tempFlags & flags)) {\n                var name_40 = flags === 268435456 /* _i */ ? \"_i\" : \"_n\";\n                if (isUniqueName(name_40)) {\n                    tempFlags |= flags;\n                    return name_40;\n                }\n            }\n            while (true) {\n                var count = tempFlags & 268435455 /* CountMask */;\n                tempFlags++;\n                // Skip over 'i' and 'n'\n                if (count !== 8 && count !== 13) {\n                    var name_41 = count < 26\n                        ? \"_\" + String.fromCharCode(97 /* a */ + count)\n                        : \"_\" + (count - 26);\n                    if (isUniqueName(name_41)) {\n                        return name_41;\n                    }\n                }\n            }\n        }\n        // Generate a name that is unique within the current file and doesn't conflict with any names\n        // in global scope. The name is formed by adding an '_n' suffix to the specified base name,\n        // where n is a positive integer. Note that names generated by makeTempVariableName and\n        // makeUniqueName are guaranteed to never conflict.\n        function makeUniqueName(baseName) {\n            // Find the first unique 'name_n', where n is a positive number\n            if (baseName.charCodeAt(baseName.length - 1) !== 95 /* _ */) {\n                baseName += \"_\";\n            }\n            var i = 1;\n            while (true) {\n                var generatedName = baseName + i;\n                if (isUniqueName(generatedName)) {\n                    return generatedNameSet[generatedName] = generatedName;\n                }\n                i++;\n            }\n        }\n        function generateNameForModuleOrEnum(node) {\n            var name = getTextOfNode(node.name);\n            // Use module/enum name itself if it is unique, otherwise make a unique variation\n            return isUniqueLocalName(name, node) ? name : makeUniqueName(name);\n        }\n        function generateNameForImportOrExportDeclaration(node) {\n            var expr = ts.getExternalModuleName(node);\n            var baseName = expr.kind === 9 /* StringLiteral */ ?\n                ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : \"module\";\n            return makeUniqueName(baseName);\n        }\n        function generateNameForExportDefault() {\n            return makeUniqueName(\"default\");\n        }\n        function generateNameForClassExpression() {\n            return makeUniqueName(\"class\");\n        }\n        /**\n         * Generates a unique name from a node.\n         *\n         * @param node A node.\n         */\n        function generateNameForNode(node) {\n            switch (node.kind) {\n                case 70 /* Identifier */:\n                    return makeUniqueName(getTextOfNode(node));\n                case 230 /* ModuleDeclaration */:\n                case 229 /* EnumDeclaration */:\n                    return generateNameForModuleOrEnum(node);\n                case 235 /* ImportDeclaration */:\n                case 241 /* ExportDeclaration */:\n                    return generateNameForImportOrExportDeclaration(node);\n                case 225 /* FunctionDeclaration */:\n                case 226 /* ClassDeclaration */:\n                case 240 /* ExportAssignment */:\n                    return generateNameForExportDefault();\n                case 197 /* ClassExpression */:\n                    return generateNameForClassExpression();\n                default:\n                    return makeTempVariableName(0 /* Auto */);\n            }\n        }\n        /**\n         * Generates a unique identifier for a node.\n         *\n         * @param name A generated name.\n         */\n        function generateName(name) {\n            switch (name.autoGenerateKind) {\n                case 1 /* Auto */:\n                    return makeTempVariableName(0 /* Auto */);\n                case 2 /* Loop */:\n                    return makeTempVariableName(268435456 /* _i */);\n                case 3 /* Unique */:\n                    return makeUniqueName(name.text);\n            }\n            ts.Debug.fail(\"Unsupported GeneratedIdentifierKind.\");\n        }\n        /**\n         * Gets the node from which a name should be generated.\n         *\n         * @param name A generated name wrapper.\n         */\n        function getNodeForGeneratedName(name) {\n            var autoGenerateId = name.autoGenerateId;\n            var node = name;\n            var original = node.original;\n            while (original) {\n                node = original;\n                // if \"node\" is a different generated name (having a different\n                // \"autoGenerateId\"), use it and stop traversing.\n                if (ts.isIdentifier(node)\n                    && node.autoGenerateKind === 4 /* Node */\n                    && node.autoGenerateId !== autoGenerateId) {\n                    break;\n                }\n                original = node.original;\n            }\n            // otherwise, return the original node for the source;\n            return node;\n        }\n        /**\n         * Gets the generated identifier text from a generated identifier.\n         *\n         * @param name The generated identifier.\n         */\n        function getGeneratedIdentifier(name) {\n            if (name.autoGenerateKind === 4 /* Node */) {\n                // Generated names generate unique names based on their original node\n                // and are cached based on that node's id\n                var node = getNodeForGeneratedName(name);\n                var nodeId = ts.getNodeId(node);\n                return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node)));\n            }\n            else {\n                // Auto, Loop, and Unique names are cached based on their unique\n                // autoGenerateId.\n                var autoGenerateId = name.autoGenerateId;\n                return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = ts.unescapeIdentifier(generateName(name)));\n            }\n        }\n        function createDelimiterMap() {\n            var delimiters = [];\n            delimiters[0 /* None */] = \"\";\n            delimiters[16 /* CommaDelimited */] = \",\";\n            delimiters[4 /* BarDelimited */] = \" |\";\n            delimiters[8 /* AmpersandDelimited */] = \" &\";\n            return delimiters;\n        }\n        function getDelimiter(format) {\n            return delimiters[format & 28 /* DelimitersMask */];\n        }\n        function createBracketsMap() {\n            var brackets = [];\n            brackets[512 /* Braces */] = [\"{\", \"}\"];\n            brackets[1024 /* Parenthesis */] = [\"(\", \")\"];\n            brackets[2048 /* AngleBrackets */] = [\"<\", \">\"];\n            brackets[4096 /* SquareBrackets */] = [\"[\", \"]\"];\n            return brackets;\n        }\n        function getOpeningBracket(format) {\n            return brackets[format & 7680 /* BracketsMask */][0];\n        }\n        function getClosingBracket(format) {\n            return brackets[format & 7680 /* BracketsMask */][1];\n        }\n    }\n    ts.emitFiles = emitFiles;\n    var ListFormat;\n    (function (ListFormat) {\n        ListFormat[ListFormat[\"None\"] = 0] = \"None\";\n        // Line separators\n        ListFormat[ListFormat[\"SingleLine\"] = 0] = \"SingleLine\";\n        ListFormat[ListFormat[\"MultiLine\"] = 1] = \"MultiLine\";\n        ListFormat[ListFormat[\"PreserveLines\"] = 2] = \"PreserveLines\";\n        ListFormat[ListFormat[\"LinesMask\"] = 3] = \"LinesMask\";\n        // Delimiters\n        ListFormat[ListFormat[\"NotDelimited\"] = 0] = \"NotDelimited\";\n        ListFormat[ListFormat[\"BarDelimited\"] = 4] = \"BarDelimited\";\n        ListFormat[ListFormat[\"AmpersandDelimited\"] = 8] = \"AmpersandDelimited\";\n        ListFormat[ListFormat[\"CommaDelimited\"] = 16] = \"CommaDelimited\";\n        ListFormat[ListFormat[\"DelimitersMask\"] = 28] = \"DelimitersMask\";\n        ListFormat[ListFormat[\"AllowTrailingComma\"] = 32] = \"AllowTrailingComma\";\n        // Whitespace\n        ListFormat[ListFormat[\"Indented\"] = 64] = \"Indented\";\n        ListFormat[ListFormat[\"SpaceBetweenBraces\"] = 128] = \"SpaceBetweenBraces\";\n        ListFormat[ListFormat[\"SpaceBetweenSiblings\"] = 256] = \"SpaceBetweenSiblings\";\n        // Brackets/Braces\n        ListFormat[ListFormat[\"Braces\"] = 512] = \"Braces\";\n        ListFormat[ListFormat[\"Parenthesis\"] = 1024] = \"Parenthesis\";\n        ListFormat[ListFormat[\"AngleBrackets\"] = 2048] = \"AngleBrackets\";\n        ListFormat[ListFormat[\"SquareBrackets\"] = 4096] = \"SquareBrackets\";\n        ListFormat[ListFormat[\"BracketsMask\"] = 7680] = \"BracketsMask\";\n        ListFormat[ListFormat[\"OptionalIfUndefined\"] = 8192] = \"OptionalIfUndefined\";\n        ListFormat[ListFormat[\"OptionalIfEmpty\"] = 16384] = \"OptionalIfEmpty\";\n        ListFormat[ListFormat[\"Optional\"] = 24576] = \"Optional\";\n        // Other\n        ListFormat[ListFormat[\"PreferNewLine\"] = 32768] = \"PreferNewLine\";\n        ListFormat[ListFormat[\"NoTrailingNewLine\"] = 65536] = \"NoTrailingNewLine\";\n        ListFormat[ListFormat[\"NoInterveningComments\"] = 131072] = \"NoInterveningComments\";\n        // Precomputed Formats\n        ListFormat[ListFormat[\"Modifiers\"] = 256] = \"Modifiers\";\n        ListFormat[ListFormat[\"HeritageClauses\"] = 256] = \"HeritageClauses\";\n        ListFormat[ListFormat[\"TypeLiteralMembers\"] = 65] = \"TypeLiteralMembers\";\n        ListFormat[ListFormat[\"TupleTypeElements\"] = 336] = \"TupleTypeElements\";\n        ListFormat[ListFormat[\"UnionTypeConstituents\"] = 260] = \"UnionTypeConstituents\";\n        ListFormat[ListFormat[\"IntersectionTypeConstituents\"] = 264] = \"IntersectionTypeConstituents\";\n        ListFormat[ListFormat[\"ObjectBindingPatternElements\"] = 432] = \"ObjectBindingPatternElements\";\n        ListFormat[ListFormat[\"ArrayBindingPatternElements\"] = 304] = \"ArrayBindingPatternElements\";\n        ListFormat[ListFormat[\"ObjectLiteralExpressionProperties\"] = 978] = \"ObjectLiteralExpressionProperties\";\n        ListFormat[ListFormat[\"ArrayLiteralExpressionElements\"] = 4466] = \"ArrayLiteralExpressionElements\";\n        ListFormat[ListFormat[\"CallExpressionArguments\"] = 1296] = \"CallExpressionArguments\";\n        ListFormat[ListFormat[\"NewExpressionArguments\"] = 9488] = \"NewExpressionArguments\";\n        ListFormat[ListFormat[\"TemplateExpressionSpans\"] = 131072] = \"TemplateExpressionSpans\";\n        ListFormat[ListFormat[\"SingleLineBlockStatements\"] = 384] = \"SingleLineBlockStatements\";\n        ListFormat[ListFormat[\"MultiLineBlockStatements\"] = 65] = \"MultiLineBlockStatements\";\n        ListFormat[ListFormat[\"VariableDeclarationList\"] = 272] = \"VariableDeclarationList\";\n        ListFormat[ListFormat[\"SingleLineFunctionBodyStatements\"] = 384] = \"SingleLineFunctionBodyStatements\";\n        ListFormat[ListFormat[\"MultiLineFunctionBodyStatements\"] = 1] = \"MultiLineFunctionBodyStatements\";\n        ListFormat[ListFormat[\"ClassHeritageClauses\"] = 256] = \"ClassHeritageClauses\";\n        ListFormat[ListFormat[\"ClassMembers\"] = 65] = \"ClassMembers\";\n        ListFormat[ListFormat[\"InterfaceMembers\"] = 65] = \"InterfaceMembers\";\n        ListFormat[ListFormat[\"EnumMembers\"] = 81] = \"EnumMembers\";\n        ListFormat[ListFormat[\"CaseBlockClauses\"] = 65] = \"CaseBlockClauses\";\n        ListFormat[ListFormat[\"NamedImportsOrExportsElements\"] = 432] = \"NamedImportsOrExportsElements\";\n        ListFormat[ListFormat[\"JsxElementChildren\"] = 131072] = \"JsxElementChildren\";\n        ListFormat[ListFormat[\"JsxElementAttributes\"] = 131328] = \"JsxElementAttributes\";\n        ListFormat[ListFormat[\"CaseOrDefaultClauseStatements\"] = 81985] = \"CaseOrDefaultClauseStatements\";\n        ListFormat[ListFormat[\"HeritageClauseTypes\"] = 272] = \"HeritageClauseTypes\";\n        ListFormat[ListFormat[\"SourceFileStatements\"] = 65537] = \"SourceFileStatements\";\n        ListFormat[ListFormat[\"Decorators\"] = 24577] = \"Decorators\";\n        ListFormat[ListFormat[\"TypeArguments\"] = 26960] = \"TypeArguments\";\n        ListFormat[ListFormat[\"TypeParameters\"] = 26960] = \"TypeParameters\";\n        ListFormat[ListFormat[\"Parameters\"] = 1360] = \"Parameters\";\n        ListFormat[ListFormat[\"IndexSignatureParameters\"] = 4432] = \"IndexSignatureParameters\";\n    })(ListFormat || (ListFormat = {}));\n})(ts || (ts = {}));\n/// <reference path=\"sys.ts\" />\n/// <reference path=\"emitter.ts\" />\n/// <reference path=\"core.ts\" />\nvar ts;\n(function (ts) {\n    var emptyArray = [];\n    function findConfigFile(searchPath, fileExists, configName) {\n        if (configName === void 0) { configName = \"tsconfig.json\"; }\n        while (true) {\n            var fileName = ts.combinePaths(searchPath, configName);\n            if (fileExists(fileName)) {\n                return fileName;\n            }\n            var parentPath = ts.getDirectoryPath(searchPath);\n            if (parentPath === searchPath) {\n                break;\n            }\n            searchPath = parentPath;\n        }\n        return undefined;\n    }\n    ts.findConfigFile = findConfigFile;\n    function resolveTripleslashReference(moduleName, containingFile) {\n        var basePath = ts.getDirectoryPath(containingFile);\n        var referencedFileName = ts.isRootedDiskPath(moduleName) ? moduleName : ts.combinePaths(basePath, moduleName);\n        return ts.normalizePath(referencedFileName);\n    }\n    ts.resolveTripleslashReference = resolveTripleslashReference;\n    /* @internal */\n    function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) {\n        var commonPathComponents;\n        var failed = ts.forEach(fileNames, function (sourceFile) {\n            // Each file contributes into common source file path\n            var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile, currentDirectory);\n            sourcePathComponents.pop(); // The base file name is not part of the common directory path\n            if (!commonPathComponents) {\n                // first file\n                commonPathComponents = sourcePathComponents;\n                return;\n            }\n            for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) {\n                if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) {\n                    if (i === 0) {\n                        // Failed to find any common path component\n                        return true;\n                    }\n                    // New common path found that is 0 -> i-1\n                    commonPathComponents.length = i;\n                    break;\n                }\n            }\n            // If the sourcePathComponents was shorter than the commonPathComponents, truncate to the sourcePathComponents\n            if (sourcePathComponents.length < commonPathComponents.length) {\n                commonPathComponents.length = sourcePathComponents.length;\n            }\n        });\n        // A common path can not be found when paths span multiple drives on windows, for example\n        if (failed) {\n            return \"\";\n        }\n        if (!commonPathComponents) {\n            return currentDirectory;\n        }\n        return ts.getNormalizedPathFromPathComponents(commonPathComponents);\n    }\n    ts.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames;\n    function createCompilerHost(options, setParentNodes) {\n        var existingDirectories = ts.createMap();\n        function getCanonicalFileName(fileName) {\n            // if underlying system can distinguish between two files whose names differs only in cases then file name already in canonical form.\n            // otherwise use toLowerCase as a canonical form.\n            return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();\n        }\n        // returned by CScript sys environment\n        var unsupportedFileEncodingErrorCode = -2147024809;\n        function getSourceFile(fileName, languageVersion, onError) {\n            var text;\n            try {\n                ts.performance.mark(\"beforeIORead\");\n                text = ts.sys.readFile(fileName, options.charset);\n                ts.performance.mark(\"afterIORead\");\n                ts.performance.measure(\"I/O Read\", \"beforeIORead\", \"afterIORead\");\n            }\n            catch (e) {\n                if (onError) {\n                    onError(e.number === unsupportedFileEncodingErrorCode\n                        ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText\n                        : e.message);\n                }\n                text = \"\";\n            }\n            return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined;\n        }\n        function directoryExists(directoryPath) {\n            if (directoryPath in existingDirectories) {\n                return true;\n            }\n            if (ts.sys.directoryExists(directoryPath)) {\n                existingDirectories[directoryPath] = true;\n                return true;\n            }\n            return false;\n        }\n        function ensureDirectoriesExist(directoryPath) {\n            if (directoryPath.length > ts.getRootLength(directoryPath) && !directoryExists(directoryPath)) {\n                var parentDirectory = ts.getDirectoryPath(directoryPath);\n                ensureDirectoriesExist(parentDirectory);\n                ts.sys.createDirectory(directoryPath);\n            }\n        }\n        var outputFingerprints;\n        function writeFileIfUpdated(fileName, data, writeByteOrderMark) {\n            if (!outputFingerprints) {\n                outputFingerprints = ts.createMap();\n            }\n            var hash = ts.sys.createHash(data);\n            var mtimeBefore = ts.sys.getModifiedTime(fileName);\n            if (mtimeBefore && fileName in outputFingerprints) {\n                var fingerprint = outputFingerprints[fileName];\n                // If output has not been changed, and the file has no external modification\n                if (fingerprint.byteOrderMark === writeByteOrderMark &&\n                    fingerprint.hash === hash &&\n                    fingerprint.mtime.getTime() === mtimeBefore.getTime()) {\n                    return;\n                }\n            }\n            ts.sys.writeFile(fileName, data, writeByteOrderMark);\n            var mtimeAfter = ts.sys.getModifiedTime(fileName);\n            outputFingerprints[fileName] = {\n                hash: hash,\n                byteOrderMark: writeByteOrderMark,\n                mtime: mtimeAfter\n            };\n        }\n        function writeFile(fileName, data, writeByteOrderMark, onError) {\n            try {\n                ts.performance.mark(\"beforeIOWrite\");\n                ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName)));\n                if (ts.isWatchSet(options) && ts.sys.createHash && ts.sys.getModifiedTime) {\n                    writeFileIfUpdated(fileName, data, writeByteOrderMark);\n                }\n                else {\n                    ts.sys.writeFile(fileName, data, writeByteOrderMark);\n                }\n                ts.performance.mark(\"afterIOWrite\");\n                ts.performance.measure(\"I/O Write\", \"beforeIOWrite\", \"afterIOWrite\");\n            }\n            catch (e) {\n                if (onError) {\n                    onError(e.message);\n                }\n            }\n        }\n        function getDefaultLibLocation() {\n            return ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath()));\n        }\n        var newLine = ts.getNewLineCharacter(options);\n        var realpath = ts.sys.realpath && (function (path) { return ts.sys.realpath(path); });\n        return {\n            getSourceFile: getSourceFile,\n            getDefaultLibLocation: getDefaultLibLocation,\n            getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); },\n            writeFile: writeFile,\n            getCurrentDirectory: ts.memoize(function () { return ts.sys.getCurrentDirectory(); }),\n            useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; },\n            getCanonicalFileName: getCanonicalFileName,\n            getNewLine: function () { return newLine; },\n            fileExists: function (fileName) { return ts.sys.fileExists(fileName); },\n            readFile: function (fileName) { return ts.sys.readFile(fileName); },\n            trace: function (s) { return ts.sys.write(s + newLine); },\n            directoryExists: function (directoryName) { return ts.sys.directoryExists(directoryName); },\n            getEnvironmentVariable: function (name) { return ts.sys.getEnvironmentVariable ? ts.sys.getEnvironmentVariable(name) : \"\"; },\n            getDirectories: function (path) { return ts.sys.getDirectories(path); },\n            realpath: realpath\n        };\n    }\n    ts.createCompilerHost = createCompilerHost;\n    function getPreEmitDiagnostics(program, sourceFile, cancellationToken) {\n        var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken));\n        if (program.getCompilerOptions().declaration) {\n            diagnostics = diagnostics.concat(program.getDeclarationDiagnostics(sourceFile, cancellationToken));\n        }\n        return ts.sortAndDeduplicateDiagnostics(diagnostics);\n    }\n    ts.getPreEmitDiagnostics = getPreEmitDiagnostics;\n    function formatDiagnostics(diagnostics, host) {\n        var output = \"\";\n        for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {\n            var diagnostic = diagnostics_1[_i];\n            if (diagnostic.file) {\n                var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character;\n                var fileName = diagnostic.file.fileName;\n                var relativeFileName = ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); });\n                output += relativeFileName + \"(\" + (line + 1) + \",\" + (character + 1) + \"): \";\n            }\n            var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();\n            output += category + \" TS\" + diagnostic.code + \": \" + flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()) + host.getNewLine();\n        }\n        return output;\n    }\n    ts.formatDiagnostics = formatDiagnostics;\n    function flattenDiagnosticMessageText(messageText, newLine) {\n        if (typeof messageText === \"string\") {\n            return messageText;\n        }\n        else {\n            var diagnosticChain = messageText;\n            var result = \"\";\n            var indent = 0;\n            while (diagnosticChain) {\n                if (indent) {\n                    result += newLine;\n                    for (var i = 0; i < indent; i++) {\n                        result += \"  \";\n                    }\n                }\n                result += diagnosticChain.messageText;\n                indent++;\n                diagnosticChain = diagnosticChain.next;\n            }\n            return result;\n        }\n    }\n    ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText;\n    function loadWithLocalCache(names, containingFile, loader) {\n        if (names.length === 0) {\n            return [];\n        }\n        var resolutions = [];\n        var cache = ts.createMap();\n        for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {\n            var name_42 = names_1[_i];\n            var result = name_42 in cache\n                ? cache[name_42]\n                : cache[name_42] = loader(name_42, containingFile);\n            resolutions.push(result);\n        }\n        return resolutions;\n    }\n    function createProgram(rootNames, options, host, oldProgram) {\n        var program;\n        var files = [];\n        var commonSourceDirectory;\n        var diagnosticsProducingTypeChecker;\n        var noDiagnosticsTypeChecker;\n        var classifiableNames;\n        var resolvedTypeReferenceDirectives = ts.createMap();\n        var fileProcessingDiagnostics = ts.createDiagnosticCollection();\n        // The below settings are to track if a .js file should be add to the program if loaded via searching under node_modules.\n        // This works as imported modules are discovered recursively in a depth first manner, specifically:\n        // - For each root file, findSourceFile is called.\n        // - This calls processImportedModules for each module imported in the source file.\n        // - This calls resolveModuleNames, and then calls findSourceFile for each resolved module.\n        // As all these operations happen - and are nested - within the createProgram call, they close over the below variables.\n        // The current resolution depth is tracked by incrementing/decrementing as the depth first search progresses.\n        var maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === \"number\" ? options.maxNodeModuleJsDepth : 0;\n        var currentNodeModulesDepth = 0;\n        // If a module has some of its imports skipped due to being at the depth limit under node_modules, then track\n        // this, as it may be imported at a shallower depth later, and then it will need its skipped imports processed.\n        var modulesWithElidedImports = ts.createMap();\n        // Track source files that are source files found by searching under node_modules, as these shouldn't be compiled.\n        var sourceFilesFoundSearchingNodeModules = ts.createMap();\n        ts.performance.mark(\"beforeProgram\");\n        host = host || createCompilerHost(options);\n        var skipDefaultLib = options.noLib;\n        var programDiagnostics = ts.createDiagnosticCollection();\n        var currentDirectory = host.getCurrentDirectory();\n        var supportedExtensions = ts.getSupportedExtensions(options);\n        // Map storing if there is emit blocking diagnostics for given input\n        var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName);\n        var resolveModuleNamesWorker;\n        if (host.resolveModuleNames) {\n            resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile).map(function (resolved) {\n                // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.\n                if (!resolved || resolved.extension !== undefined) {\n                    return resolved;\n                }\n                var withExtension = ts.clone(resolved);\n                withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName);\n                return withExtension;\n            }); };\n        }\n        else {\n            var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host).resolvedModule; };\n            resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); };\n        }\n        var resolveTypeReferenceDirectiveNamesWorker;\n        if (host.resolveTypeReferenceDirectives) {\n            resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); };\n        }\n        else {\n            var loader_2 = function (typesRef, containingFile) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; };\n            resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader_2); };\n        }\n        var filesByName = ts.createFileMap();\n        // stores 'filename -> file association' ignoring case\n        // used to track cases when two file names differ only in casing\n        var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined;\n        if (!tryReuseStructureFromOldProgram()) {\n            ts.forEach(rootNames, function (name) { return processRootFile(name, /*isDefaultLib*/ false); });\n            // load type declarations specified via 'types' argument or implicitly from types/ and node_modules/@types folders\n            var typeReferences = ts.getAutomaticTypeDirectiveNames(options, host);\n            if (typeReferences.length) {\n                // This containingFilename needs to match with the one used in managed-side\n                var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();\n                var containingFilename = ts.combinePaths(containingDirectory, \"__inferred type names__.ts\");\n                var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);\n                for (var i = 0; i < typeReferences.length; i++) {\n                    processTypeReferenceDirective(typeReferences[i], resolutions[i]);\n                }\n            }\n            // Do not process the default library if:\n            //  - The '--noLib' flag is used.\n            //  - A 'no-default-lib' reference comment is encountered in\n            //      processing the root files.\n            if (!skipDefaultLib) {\n                // If '--lib' is not specified, include default library file according to '--target'\n                // otherwise, using options specified in '--lib' instead of '--target' default library file\n                if (!options.lib) {\n                    processRootFile(host.getDefaultLibFileName(options), /*isDefaultLib*/ true);\n                }\n                else {\n                    var libDirectory_1 = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(host.getDefaultLibFileName(options));\n                    ts.forEach(options.lib, function (libFileName) {\n                        processRootFile(ts.combinePaths(libDirectory_1, libFileName), /*isDefaultLib*/ true);\n                    });\n                }\n            }\n        }\n        // unconditionally set oldProgram to undefined to prevent it from being captured in closure\n        oldProgram = undefined;\n        program = {\n            getRootFileNames: function () { return rootNames; },\n            getSourceFile: getSourceFile,\n            getSourceFileByPath: getSourceFileByPath,\n            getSourceFiles: function () { return files; },\n            getCompilerOptions: function () { return options; },\n            getSyntacticDiagnostics: getSyntacticDiagnostics,\n            getOptionsDiagnostics: getOptionsDiagnostics,\n            getGlobalDiagnostics: getGlobalDiagnostics,\n            getSemanticDiagnostics: getSemanticDiagnostics,\n            getDeclarationDiagnostics: getDeclarationDiagnostics,\n            getTypeChecker: getTypeChecker,\n            getClassifiableNames: getClassifiableNames,\n            getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker,\n            getCommonSourceDirectory: getCommonSourceDirectory,\n            emit: emit,\n            getCurrentDirectory: function () { return currentDirectory; },\n            getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); },\n            getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); },\n            getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); },\n            getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },\n            getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },\n            getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },\n            isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,\n            dropDiagnosticsProducingTypeChecker: dropDiagnosticsProducingTypeChecker\n        };\n        verifyCompilerOptions();\n        ts.performance.mark(\"afterProgram\");\n        ts.performance.measure(\"Program\", \"beforeProgram\", \"afterProgram\");\n        return program;\n        function getCommonSourceDirectory() {\n            if (commonSourceDirectory === undefined) {\n                var emittedFiles = ts.filterSourceFilesInDirectory(files, isSourceFileFromExternalLibrary);\n                if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) {\n                    // If a rootDir is specified and is valid use it as the commonSourceDirectory\n                    commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory);\n                }\n                else {\n                    commonSourceDirectory = computeCommonSourceDirectory(emittedFiles);\n                }\n                if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) {\n                    // Make sure directory path ends with directory separator so this string can directly\n                    // used to replace with \"\" to get the relative path of the source file and the relative path doesn't\n                    // start with / making it rooted path\n                    commonSourceDirectory += ts.directorySeparator;\n                }\n            }\n            return commonSourceDirectory;\n        }\n        function getClassifiableNames() {\n            if (!classifiableNames) {\n                // Initialize a checker so that all our files are bound.\n                getTypeChecker();\n                classifiableNames = ts.createMap();\n                for (var _i = 0, files_2 = files; _i < files_2.length; _i++) {\n                    var sourceFile = files_2[_i];\n                    ts.copyProperties(sourceFile.classifiableNames, classifiableNames);\n                }\n            }\n            return classifiableNames;\n        }\n        function resolveModuleNamesReusingOldState(moduleNames, containingFile, file, oldProgramState) {\n            if (!oldProgramState && !file.ambientModuleNames.length) {\n                // if old program state is not supplied and file does not contain locally defined ambient modules\n                // then the best we can do is fallback to the default logic\n                return resolveModuleNamesWorker(moduleNames, containingFile);\n            }\n            // at this point we know that either\n            // - file has local declarations for ambient modules\n            // OR\n            // - old program state is available\n            // OR\n            // - both of items above\n            // With this it is possible that we can tell how some module names from the initial list will be resolved\n            // without doing actual resolution (in particular if some name was resolved to ambient module).\n            // Such names should be excluded from the list of module names that will be provided to `resolveModuleNamesWorker`\n            // since we don't want to resolve them again.\n            // this is a list of modules for which we cannot predict resolution so they should be actually resolved\n            var unknownModuleNames;\n            // this is a list of combined results assembles from predicted and resolved results.\n            // Order in this list matches the order in the original list of module names `moduleNames` which is important\n            // so later we can split results to resolutions of modules and resolutions of module augmentations.\n            var result;\n            // a transient placeholder that is used to mark predicted resolution in the result list\n            var predictedToResolveToAmbientModuleMarker = {};\n            for (var i = 0; i < moduleNames.length; i++) {\n                var moduleName = moduleNames[i];\n                // module name is known to be resolved to ambient module if\n                // - module name is contained in the list of ambient modules that are locally declared in the file\n                // - in the old program module name was resolved to ambient module whose declaration is in non-modified file\n                //   (so the same module declaration will land in the new program)\n                var isKnownToResolveToAmbientModule = false;\n                if (ts.contains(file.ambientModuleNames, moduleName)) {\n                    isKnownToResolveToAmbientModule = true;\n                    if (ts.isTraceEnabled(options, host)) {\n                        ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName, containingFile);\n                    }\n                }\n                else {\n                    isKnownToResolveToAmbientModule = checkModuleNameResolvedToAmbientModuleInNonModifiedFile(moduleName, oldProgramState);\n                }\n                if (isKnownToResolveToAmbientModule) {\n                    if (!unknownModuleNames) {\n                        // found a first module name for which result can be prediced\n                        // this means that this module name should not be passed to `resolveModuleNamesWorker`.\n                        // We'll use a separate list for module names that are definitely unknown.\n                        result = new Array(moduleNames.length);\n                        // copy all module names that appear before the current one in the list\n                        // since they are known to be unknown\n                        unknownModuleNames = moduleNames.slice(0, i);\n                    }\n                    // mark prediced resolution in the result list\n                    result[i] = predictedToResolveToAmbientModuleMarker;\n                }\n                else if (unknownModuleNames) {\n                    // found unknown module name and we are already using separate list for those - add it to the list\n                    unknownModuleNames.push(moduleName);\n                }\n            }\n            if (!unknownModuleNames) {\n                // we've looked throught the list but have not seen any predicted resolution\n                // use default logic\n                return resolveModuleNamesWorker(moduleNames, containingFile);\n            }\n            var resolutions = unknownModuleNames.length\n                ? resolveModuleNamesWorker(unknownModuleNames, containingFile)\n                : emptyArray;\n            // combine results of resolutions and predicted results\n            var j = 0;\n            for (var i = 0; i < result.length; i++) {\n                if (result[i] == predictedToResolveToAmbientModuleMarker) {\n                    result[i] = undefined;\n                }\n                else {\n                    result[i] = resolutions[j];\n                    j++;\n                }\n            }\n            ts.Debug.assert(j === resolutions.length);\n            return result;\n            function checkModuleNameResolvedToAmbientModuleInNonModifiedFile(moduleName, oldProgramState) {\n                if (!oldProgramState) {\n                    return false;\n                }\n                var resolutionToFile = ts.getResolvedModule(oldProgramState.file, moduleName);\n                if (resolutionToFile) {\n                    // module used to be resolved to file - ignore it\n                    return false;\n                }\n                var ambientModule = oldProgram.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(moduleName);\n                if (!(ambientModule && ambientModule.declarations)) {\n                    return false;\n                }\n                // at least one of declarations should come from non-modified source file\n                var firstUnmodifiedFile = ts.forEach(ambientModule.declarations, function (d) {\n                    var f = ts.getSourceFileOfNode(d);\n                    return !ts.contains(oldProgramState.modifiedFilePaths, f.path) && f;\n                });\n                if (!firstUnmodifiedFile) {\n                    return false;\n                }\n                if (ts.isTraceEnabled(options, host)) {\n                    ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName, firstUnmodifiedFile.fileName);\n                }\n                return true;\n            }\n        }\n        function tryReuseStructureFromOldProgram() {\n            if (!oldProgram) {\n                return false;\n            }\n            // check properties that can affect structure of the program or module resolution strategy\n            // if any of these properties has changed - structure cannot be reused\n            var oldOptions = oldProgram.getCompilerOptions();\n            if (ts.changesAffectModuleResolution(oldOptions, options)) {\n                return false;\n            }\n            ts.Debug.assert(!oldProgram.structureIsReused);\n            // there is an old program, check if we can reuse its structure\n            var oldRootNames = oldProgram.getRootFileNames();\n            if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) {\n                return false;\n            }\n            if (!ts.arrayIsEqualTo(options.types, oldOptions.types)) {\n                return false;\n            }\n            // check if program source files has changed in the way that can affect structure of the program\n            var newSourceFiles = [];\n            var filePaths = [];\n            var modifiedSourceFiles = [];\n            for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) {\n                var oldSourceFile = _a[_i];\n                var newSourceFile = host.getSourceFileByPath\n                    ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.path, options.target)\n                    : host.getSourceFile(oldSourceFile.fileName, options.target);\n                if (!newSourceFile) {\n                    return false;\n                }\n                newSourceFile.path = oldSourceFile.path;\n                filePaths.push(newSourceFile.path);\n                if (oldSourceFile !== newSourceFile) {\n                    if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {\n                        // value of no-default-lib has changed\n                        // this will affect if default library is injected into the list of files\n                        return false;\n                    }\n                    // check tripleslash references\n                    if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {\n                        // tripleslash references has changed\n                        return false;\n                    }\n                    // check imports and module augmentations\n                    collectExternalModuleReferences(newSourceFile);\n                    if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {\n                        // imports has changed\n                        return false;\n                    }\n                    if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {\n                        // moduleAugmentations has changed\n                        return false;\n                    }\n                    if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {\n                        // 'types' references has changed\n                        return false;\n                    }\n                    // tentatively approve the file\n                    modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });\n                }\n                else {\n                    // file has no changes - use it as is\n                    newSourceFile = oldSourceFile;\n                }\n                // if file has passed all checks it should be safe to reuse it\n                newSourceFiles.push(newSourceFile);\n            }\n            var modifiedFilePaths = modifiedSourceFiles.map(function (f) { return f.newFile.path; });\n            // try to verify results of module resolution\n            for (var _b = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _b < modifiedSourceFiles_1.length; _b++) {\n                var _c = modifiedSourceFiles_1[_b], oldSourceFile = _c.oldFile, newSourceFile = _c.newFile;\n                var newSourceFilePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory);\n                if (resolveModuleNamesWorker) {\n                    var moduleNames = ts.map(ts.concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral);\n                    var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFilePath, newSourceFile, { file: oldSourceFile, program: oldProgram, modifiedFilePaths: modifiedFilePaths });\n                    // ensure that module resolution results are still correct\n                    var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo);\n                    if (resolutionsChanged) {\n                        return false;\n                    }\n                }\n                if (resolveTypeReferenceDirectiveNamesWorker) {\n                    var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (x) { return x.fileName; });\n                    var resolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFilePath);\n                    // ensure that types resolutions are still correct\n                    var resolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo);\n                    if (resolutionsChanged) {\n                        return false;\n                    }\n                }\n                // pass the cache of module/types resolutions from the old source file\n                newSourceFile.resolvedModules = oldSourceFile.resolvedModules;\n                newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;\n            }\n            // update fileName -> file mapping\n            for (var i = 0, len = newSourceFiles.length; i < len; i++) {\n                filesByName.set(filePaths[i], newSourceFiles[i]);\n            }\n            files = newSourceFiles;\n            fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();\n            for (var _d = 0, modifiedSourceFiles_2 = modifiedSourceFiles; _d < modifiedSourceFiles_2.length; _d++) {\n                var modifiedFile = modifiedSourceFiles_2[_d];\n                fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile.newFile);\n            }\n            resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();\n            oldProgram.structureIsReused = true;\n            return true;\n        }\n        function getEmitHost(writeFileCallback) {\n            return {\n                getCanonicalFileName: getCanonicalFileName,\n                getCommonSourceDirectory: program.getCommonSourceDirectory,\n                getCompilerOptions: program.getCompilerOptions,\n                getCurrentDirectory: function () { return currentDirectory; },\n                getNewLine: function () { return host.getNewLine(); },\n                getSourceFile: program.getSourceFile,\n                getSourceFileByPath: program.getSourceFileByPath,\n                getSourceFiles: program.getSourceFiles,\n                isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,\n                writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }),\n                isEmitBlocked: isEmitBlocked,\n            };\n        }\n        function isSourceFileFromExternalLibrary(file) {\n            return sourceFilesFoundSearchingNodeModules[file.path];\n        }\n        function getDiagnosticsProducingTypeChecker() {\n            return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ true));\n        }\n        function dropDiagnosticsProducingTypeChecker() {\n            diagnosticsProducingTypeChecker = undefined;\n        }\n        function getTypeChecker() {\n            return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ false));\n        }\n        function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) {\n            return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles); });\n        }\n        function isEmitBlocked(emitFileName) {\n            return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName));\n        }\n        function emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) {\n            var declarationDiagnostics = [];\n            if (options.noEmit) {\n                return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true };\n            }\n            // If the noEmitOnError flag is set, then check if we have any errors so far.  If so,\n            // immediately bail out.  Note that we pass 'undefined' for 'sourceFile' so that we\n            // get any preEmit diagnostics, not just the ones\n            if (options.noEmitOnError) {\n                var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken));\n                if (diagnostics.length === 0 && program.getCompilerOptions().declaration) {\n                    declarationDiagnostics = program.getDeclarationDiagnostics(/*sourceFile*/ undefined, cancellationToken);\n                }\n                if (diagnostics.length > 0 || declarationDiagnostics.length > 0) {\n                    return {\n                        diagnostics: ts.concatenate(diagnostics, declarationDiagnostics),\n                        sourceMaps: undefined,\n                        emittedFiles: undefined,\n                        emitSkipped: true\n                    };\n                }\n            }\n            // Create the emit resolver outside of the \"emitTime\" tracking code below.  That way\n            // any cost associated with it (like type checking) are appropriate associated with\n            // the type-checking counter.\n            //\n            // If the -out option is specified, we should not pass the source file to getEmitResolver.\n            // This is because in the -out scenario all files need to be emitted, and therefore all\n            // files need to be type checked. And the way to specify that all files need to be type\n            // checked is to not pass the file to getEmitResolver.\n            var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile);\n            ts.performance.mark(\"beforeEmit\");\n            var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles);\n            ts.performance.mark(\"afterEmit\");\n            ts.performance.measure(\"Emit\", \"beforeEmit\", \"afterEmit\");\n            return emitResult;\n        }\n        function getSourceFile(fileName) {\n            return getSourceFileByPath(ts.toPath(fileName, currentDirectory, getCanonicalFileName));\n        }\n        function getSourceFileByPath(path) {\n            return filesByName.get(path);\n        }\n        function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) {\n            if (sourceFile) {\n                return getDiagnostics(sourceFile, cancellationToken);\n            }\n            var allDiagnostics = [];\n            ts.forEach(program.getSourceFiles(), function (sourceFile) {\n                if (cancellationToken) {\n                    cancellationToken.throwIfCancellationRequested();\n                }\n                ts.addRange(allDiagnostics, getDiagnostics(sourceFile, cancellationToken));\n            });\n            return ts.sortAndDeduplicateDiagnostics(allDiagnostics);\n        }\n        function getSyntacticDiagnostics(sourceFile, cancellationToken) {\n            return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken);\n        }\n        function getSemanticDiagnostics(sourceFile, cancellationToken) {\n            return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken);\n        }\n        function getDeclarationDiagnostics(sourceFile, cancellationToken) {\n            var options = program.getCompilerOptions();\n            // collect diagnostics from the program only once if either no source file was specified or out/outFile is set (bundled emit)\n            if (!sourceFile || options.out || options.outFile) {\n                return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);\n            }\n            else {\n                return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken);\n            }\n        }\n        function getSyntacticDiagnosticsForFile(sourceFile) {\n            // For JavaScript files, we report semantic errors for using TypeScript-only\n            // constructs from within a JavaScript file as syntactic errors.\n            if (ts.isSourceFileJavaScript(sourceFile)) {\n                if (!sourceFile.additionalSyntacticDiagnostics) {\n                    sourceFile.additionalSyntacticDiagnostics = getJavaScriptSyntacticDiagnosticsForFile(sourceFile);\n                }\n                return ts.concatenate(sourceFile.additionalSyntacticDiagnostics, sourceFile.parseDiagnostics);\n            }\n            return sourceFile.parseDiagnostics;\n        }\n        function runWithCancellationToken(func) {\n            try {\n                return func();\n            }\n            catch (e) {\n                if (e instanceof ts.OperationCanceledException) {\n                    // We were canceled while performing the operation.  Because our type checker\n                    // might be a bad state, we need to throw it away.\n                    //\n                    // Note: we are overly aggressive here.  We do not actually *have* to throw away\n                    // the \"noDiagnosticsTypeChecker\".  However, for simplicity, i'd like to keep\n                    // the lifetimes of these two TypeCheckers the same.  Also, we generally only\n                    // cancel when the user has made a change anyways.  And, in that case, we (the\n                    // program instance) will get thrown away anyways.  So trying to keep one of\n                    // these type checkers alive doesn't serve much purpose.\n                    noDiagnosticsTypeChecker = undefined;\n                    diagnosticsProducingTypeChecker = undefined;\n                }\n                throw e;\n            }\n        }\n        function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) {\n            return runWithCancellationToken(function () {\n                var typeChecker = getDiagnosticsProducingTypeChecker();\n                ts.Debug.assert(!!sourceFile.bindDiagnostics);\n                var bindDiagnostics = sourceFile.bindDiagnostics;\n                // For JavaScript files, we don't want to report semantic errors.\n                // Instead, we'll report errors for using TypeScript-only constructs from within a\n                // JavaScript file when we get syntactic diagnostics for the file.\n                var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ? [] : typeChecker.getDiagnostics(sourceFile, cancellationToken);\n                var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName);\n                var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);\n                return bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile);\n            });\n        }\n        function getJavaScriptSyntacticDiagnosticsForFile(sourceFile) {\n            return runWithCancellationToken(function () {\n                var diagnostics = [];\n                var parent = sourceFile;\n                walk(sourceFile);\n                return diagnostics;\n                function walk(node) {\n                    // Return directly from the case if the given node doesnt want to visit each child\n                    // Otherwise break to visit each child\n                    switch (parent.kind) {\n                        case 144 /* Parameter */:\n                        case 147 /* PropertyDeclaration */:\n                            if (parent.questionToken === node) {\n                                diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, \"?\"));\n                                return;\n                            }\n                        // Pass through\n                        case 149 /* MethodDeclaration */:\n                        case 148 /* MethodSignature */:\n                        case 150 /* Constructor */:\n                        case 151 /* GetAccessor */:\n                        case 152 /* SetAccessor */:\n                        case 184 /* FunctionExpression */:\n                        case 225 /* FunctionDeclaration */:\n                        case 185 /* ArrowFunction */:\n                        case 225 /* FunctionDeclaration */:\n                        case 223 /* VariableDeclaration */:\n                            // type annotation\n                            if (parent.type === node) {\n                                diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                    }\n                    switch (node.kind) {\n                        case 234 /* ImportEqualsDeclaration */:\n                            diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file));\n                            return;\n                        case 240 /* ExportAssignment */:\n                            if (node.isExportEquals) {\n                                diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                            break;\n                        case 255 /* HeritageClause */:\n                            var heritageClause = node;\n                            if (heritageClause.token === 107 /* ImplementsKeyword */) {\n                                diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                            break;\n                        case 227 /* InterfaceDeclaration */:\n                            diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file));\n                            return;\n                        case 230 /* ModuleDeclaration */:\n                            diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file));\n                            return;\n                        case 228 /* TypeAliasDeclaration */:\n                            diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file));\n                            return;\n                        case 229 /* EnumDeclaration */:\n                            diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file));\n                            return;\n                        case 182 /* TypeAssertionExpression */:\n                            var typeAssertionExpression = node;\n                            diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));\n                            return;\n                    }\n                    var prevParent = parent;\n                    parent = node;\n                    ts.forEachChild(node, walk, walkArray);\n                    parent = prevParent;\n                }\n                function walkArray(nodes) {\n                    if (parent.decorators === nodes && !options.experimentalDecorators) {\n                        diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning));\n                    }\n                    switch (parent.kind) {\n                        case 226 /* ClassDeclaration */:\n                        case 149 /* MethodDeclaration */:\n                        case 148 /* MethodSignature */:\n                        case 150 /* Constructor */:\n                        case 151 /* GetAccessor */:\n                        case 152 /* SetAccessor */:\n                        case 184 /* FunctionExpression */:\n                        case 225 /* FunctionDeclaration */:\n                        case 185 /* ArrowFunction */:\n                        case 225 /* FunctionDeclaration */:\n                            // Check type parameters\n                            if (nodes === parent.typeParameters) {\n                                diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                        // pass through\n                        case 205 /* VariableStatement */:\n                            // Check modifiers\n                            if (nodes === parent.modifiers) {\n                                return checkModifiers(nodes, parent.kind === 205 /* VariableStatement */);\n                            }\n                            break;\n                        case 147 /* PropertyDeclaration */:\n                            // Check modifiers of property declaration\n                            if (nodes === parent.modifiers) {\n                                for (var _i = 0, _a = nodes; _i < _a.length; _i++) {\n                                    var modifier = _a[_i];\n                                    if (modifier.kind !== 114 /* StaticKeyword */) {\n                                        diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));\n                                    }\n                                }\n                                return;\n                            }\n                            break;\n                        case 144 /* Parameter */:\n                            // Check modifiers of parameter declaration\n                            if (nodes === parent.modifiers) {\n                                diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                            break;\n                        case 179 /* CallExpression */:\n                        case 180 /* NewExpression */:\n                        case 199 /* ExpressionWithTypeArguments */:\n                            // Check type arguments\n                            if (nodes === parent.typeArguments) {\n                                diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file));\n                                return;\n                            }\n                            break;\n                    }\n                    for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) {\n                        var node = nodes_6[_b];\n                        walk(node);\n                    }\n                }\n                function checkModifiers(modifiers, isConstValid) {\n                    for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) {\n                        var modifier = modifiers_1[_i];\n                        switch (modifier.kind) {\n                            case 75 /* ConstKeyword */:\n                                if (isConstValid) {\n                                    continue;\n                                }\n                            // Fallthrough to report error\n                            case 113 /* PublicKeyword */:\n                            case 111 /* PrivateKeyword */:\n                            case 112 /* ProtectedKeyword */:\n                            case 130 /* ReadonlyKeyword */:\n                            case 123 /* DeclareKeyword */:\n                            case 116 /* AbstractKeyword */:\n                                diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));\n                                break;\n                            // These are all legal modifiers.\n                            case 114 /* StaticKeyword */:\n                            case 83 /* ExportKeyword */:\n                            case 78 /* DefaultKeyword */:\n                        }\n                    }\n                }\n                function createDiagnosticForNodeArray(nodes, message, arg0, arg1, arg2) {\n                    var start = nodes.pos;\n                    return ts.createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2);\n                }\n                // Since these are syntactic diagnostics, parent might not have been set\n                // this means the sourceFile cannot be infered from the node\n                function createDiagnosticForNode(node, message, arg0, arg1, arg2) {\n                    return ts.createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2);\n                }\n            });\n        }\n        function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) {\n            return runWithCancellationToken(function () {\n                var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken);\n                // Don't actually write any files since we're just getting diagnostics.\n                return ts.getDeclarationDiagnostics(getEmitHost(ts.noop), resolver, sourceFile);\n            });\n        }\n        function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) {\n            return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);\n        }\n        function getOptionsDiagnostics() {\n            var allDiagnostics = [];\n            ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics());\n            ts.addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics());\n            return ts.sortAndDeduplicateDiagnostics(allDiagnostics);\n        }\n        function getGlobalDiagnostics() {\n            var allDiagnostics = [];\n            ts.addRange(allDiagnostics, getDiagnosticsProducingTypeChecker().getGlobalDiagnostics());\n            return ts.sortAndDeduplicateDiagnostics(allDiagnostics);\n        }\n        function processRootFile(fileName, isDefaultLib) {\n            processSourceFile(ts.normalizePath(fileName), isDefaultLib);\n        }\n        function fileReferenceIsEqualTo(a, b) {\n            return a.fileName === b.fileName;\n        }\n        function moduleNameIsEqualTo(a, b) {\n            return a.text === b.text;\n        }\n        function getTextOfLiteral(literal) {\n            return literal.text;\n        }\n        function collectExternalModuleReferences(file) {\n            if (file.imports) {\n                return;\n            }\n            var isJavaScriptFile = ts.isSourceFileJavaScript(file);\n            var isExternalModuleFile = ts.isExternalModule(file);\n            var isDtsFile = ts.isDeclarationFile(file);\n            var imports;\n            var moduleAugmentations;\n            var ambientModules;\n            // If we are importing helpers, we need to add a synthetic reference to resolve the\n            // helpers library.\n            if (options.importHelpers\n                && (options.isolatedModules || isExternalModuleFile)\n                && !file.isDeclarationFile) {\n                // synthesize 'import \"tslib\"' declaration\n                var externalHelpersModuleReference = ts.createSynthesizedNode(9 /* StringLiteral */);\n                externalHelpersModuleReference.text = ts.externalHelpersModuleNameText;\n                var importDecl = ts.createSynthesizedNode(235 /* ImportDeclaration */);\n                importDecl.parent = file;\n                externalHelpersModuleReference.parent = importDecl;\n                imports = [externalHelpersModuleReference];\n            }\n            for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {\n                var node = _a[_i];\n                collectModuleReferences(node, /*inAmbientModule*/ false);\n                if (isJavaScriptFile) {\n                    collectRequireCalls(node);\n                }\n            }\n            file.imports = imports || emptyArray;\n            file.moduleAugmentations = moduleAugmentations || emptyArray;\n            file.ambientModuleNames = ambientModules || emptyArray;\n            return;\n            function collectModuleReferences(node, inAmbientModule) {\n                switch (node.kind) {\n                    case 235 /* ImportDeclaration */:\n                    case 234 /* ImportEqualsDeclaration */:\n                    case 241 /* ExportDeclaration */:\n                        var moduleNameExpr = ts.getExternalModuleName(node);\n                        if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) {\n                            break;\n                        }\n                        if (!moduleNameExpr.text) {\n                            break;\n                        }\n                        // TypeScript 1.0 spec (April 2014): 12.1.6\n                        // An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference other external modules\n                        // only through top - level external module names. Relative external module names are not permitted.\n                        if (!inAmbientModule || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) {\n                            (imports || (imports = [])).push(moduleNameExpr);\n                        }\n                        break;\n                    case 230 /* ModuleDeclaration */:\n                        if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2 /* Ambient */) || ts.isDeclarationFile(file))) {\n                            var moduleName = node.name;\n                            // Ambient module declarations can be interpreted as augmentations for some existing external modules.\n                            // This will happen in two cases:\n                            // - if current file is external module then module augmentation is a ambient module declaration defined in the top level scope\n                            // - if current file is not external module then module augmentation is an ambient module declaration with non-relative module name\n                            //   immediately nested in top level ambient module declaration .\n                            if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) {\n                                (moduleAugmentations || (moduleAugmentations = [])).push(moduleName);\n                            }\n                            else if (!inAmbientModule) {\n                                if (isDtsFile) {\n                                    // for global .d.ts files record name of ambient module\n                                    (ambientModules || (ambientModules = [])).push(moduleName.text);\n                                }\n                                // An AmbientExternalModuleDeclaration declares an external module.\n                                // This type of declaration is permitted only in the global module.\n                                // The StringLiteral must specify a top - level external module name.\n                                // Relative external module names are not permitted\n                                // NOTE: body of ambient module is always a module block, if it exists\n                                var body = node.body;\n                                if (body) {\n                                    for (var _i = 0, _a = body.statements; _i < _a.length; _i++) {\n                                        var statement = _a[_i];\n                                        collectModuleReferences(statement, /*inAmbientModule*/ true);\n                                    }\n                                }\n                            }\n                        }\n                }\n            }\n            function collectRequireCalls(node) {\n                if (ts.isRequireCall(node, /*checkArgumentIsStringLiteral*/ true)) {\n                    (imports || (imports = [])).push(node.arguments[0]);\n                }\n                else {\n                    ts.forEachChild(node, collectRequireCalls);\n                }\n            }\n        }\n        function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) {\n            var diagnosticArgument;\n            var diagnostic;\n            if (ts.hasExtension(fileName)) {\n                if (!options.allowNonTsExtensions && !ts.forEach(supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) {\n                    diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1;\n                    diagnosticArgument = [fileName, \"'\" + supportedExtensions.join(\"', '\") + \"'\"];\n                }\n                else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) {\n                    diagnostic = ts.Diagnostics.File_0_not_found;\n                    diagnosticArgument = [fileName];\n                }\n                else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) {\n                    diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself;\n                    diagnosticArgument = [fileName];\n                }\n            }\n            else {\n                var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd);\n                if (!nonTsFile) {\n                    if (options.allowNonTsExtensions) {\n                        diagnostic = ts.Diagnostics.File_0_not_found;\n                        diagnosticArgument = [fileName];\n                    }\n                    else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) {\n                        diagnostic = ts.Diagnostics.File_0_not_found;\n                        fileName += \".ts\";\n                        diagnosticArgument = [fileName];\n                    }\n                }\n            }\n            if (diagnostic) {\n                if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) {\n                    fileProcessingDiagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument)));\n                }\n                else {\n                    fileProcessingDiagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument)));\n                }\n            }\n        }\n        function reportFileNamesDifferOnlyInCasingError(fileName, existingFileName, refFile, refPos, refEnd) {\n            if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {\n                fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName));\n            }\n            else {\n                fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName));\n            }\n        }\n        // Get source file from normalized fileName\n        function findSourceFile(fileName, path, isDefaultLib, refFile, refPos, refEnd) {\n            if (filesByName.contains(path)) {\n                var file_1 = filesByName.get(path);\n                // try to check if we've already seen this file but with a different casing in path\n                // NOTE: this only makes sense for case-insensitive file systems\n                if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) {\n                    reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd);\n                }\n                // If the file was previously found via a node_modules search, but is now being processed as a root file,\n                // then everything it sucks in may also be marked incorrectly, and needs to be checked again.\n                if (file_1 && sourceFilesFoundSearchingNodeModules[file_1.path] && currentNodeModulesDepth == 0) {\n                    sourceFilesFoundSearchingNodeModules[file_1.path] = false;\n                    if (!options.noResolve) {\n                        processReferencedFiles(file_1, isDefaultLib);\n                        processTypeReferenceDirectives(file_1);\n                    }\n                    modulesWithElidedImports[file_1.path] = false;\n                    processImportedModules(file_1);\n                }\n                else if (file_1 && modulesWithElidedImports[file_1.path]) {\n                    if (currentNodeModulesDepth < maxNodeModuleJsDepth) {\n                        modulesWithElidedImports[file_1.path] = false;\n                        processImportedModules(file_1);\n                    }\n                }\n                return file_1;\n            }\n            // We haven't looked for this file, do so now and cache result\n            var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) {\n                if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {\n                    fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));\n                }\n                else {\n                    fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));\n                }\n            });\n            filesByName.set(path, file);\n            if (file) {\n                sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0);\n                file.path = path;\n                if (host.useCaseSensitiveFileNames()) {\n                    // for case-sensitive file systems check if we've already seen some file with similar filename ignoring case\n                    var existingFile = filesByNameIgnoreCase.get(path);\n                    if (existingFile) {\n                        reportFileNamesDifferOnlyInCasingError(fileName, existingFile.fileName, refFile, refPos, refEnd);\n                    }\n                    else {\n                        filesByNameIgnoreCase.set(path, file);\n                    }\n                }\n                skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib;\n                if (!options.noResolve) {\n                    processReferencedFiles(file, isDefaultLib);\n                    processTypeReferenceDirectives(file);\n                }\n                // always process imported modules to record module name resolutions\n                processImportedModules(file);\n                if (isDefaultLib) {\n                    files.unshift(file);\n                }\n                else {\n                    files.push(file);\n                }\n            }\n            return file;\n        }\n        function processReferencedFiles(file, isDefaultLib) {\n            ts.forEach(file.referencedFiles, function (ref) {\n                var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName);\n                processSourceFile(referencedFileName, isDefaultLib, file, ref.pos, ref.end);\n            });\n        }\n        function processTypeReferenceDirectives(file) {\n            // We lower-case all type references because npm automatically lowercases all packages. See GH#9824.\n            var typeDirectives = ts.map(file.typeReferenceDirectives, function (ref) { return ref.fileName.toLocaleLowerCase(); });\n            var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file.fileName);\n            for (var i = 0; i < typeDirectives.length; i++) {\n                var ref = file.typeReferenceDirectives[i];\n                var resolvedTypeReferenceDirective = resolutions[i];\n                // store resolved type directive on the file\n                var fileName = ref.fileName.toLocaleLowerCase();\n                ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);\n                processTypeReferenceDirective(fileName, resolvedTypeReferenceDirective, file, ref.pos, ref.end);\n            }\n        }\n        function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) {\n            // If we already found this library as a primary reference - nothing to do\n            var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective];\n            if (previousResolution && previousResolution.primary) {\n                return;\n            }\n            var saveResolution = true;\n            if (resolvedTypeReferenceDirective) {\n                if (resolvedTypeReferenceDirective.primary) {\n                    // resolved from the primary path\n                    processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, /*isDefaultLib*/ false, refFile, refPos, refEnd);\n                }\n                else {\n                    // If we already resolved to this file, it must have been a secondary reference. Check file contents\n                    // for sameness and possibly issue an error\n                    if (previousResolution) {\n                        // Don't bother reading the file again if it's the same file.\n                        if (resolvedTypeReferenceDirective.resolvedFileName !== previousResolution.resolvedFileName) {\n                            var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName);\n                            if (otherFileText !== getSourceFile(previousResolution.resolvedFileName).text) {\n                                fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict, typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName));\n                            }\n                        }\n                        // don't overwrite previous resolution result\n                        saveResolution = false;\n                    }\n                    else {\n                        // First resolution of this library\n                        processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, /*isDefaultLib*/ false, refFile, refPos, refEnd);\n                    }\n                }\n            }\n            else {\n                fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_type_definition_file_for_0, typeReferenceDirective));\n            }\n            if (saveResolution) {\n                resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective;\n            }\n        }\n        function createDiagnostic(refFile, refPos, refEnd, message) {\n            var args = [];\n            for (var _i = 4; _i < arguments.length; _i++) {\n                args[_i - 4] = arguments[_i];\n            }\n            if (refFile === undefined || refPos === undefined || refEnd === undefined) {\n                return ts.createCompilerDiagnostic.apply(void 0, [message].concat(args));\n            }\n            else {\n                return ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, message].concat(args));\n            }\n        }\n        function getCanonicalFileName(fileName) {\n            return host.getCanonicalFileName(fileName);\n        }\n        function processImportedModules(file) {\n            collectExternalModuleReferences(file);\n            if (file.imports.length || file.moduleAugmentations.length) {\n                file.resolvedModules = ts.createMap();\n                // Because global augmentation doesn't have string literal name, we can check for global augmentation as such.\n                var nonGlobalAugmentation = ts.filter(file.moduleAugmentations, function (moduleAugmentation) { return moduleAugmentation.kind === 9 /* StringLiteral */; });\n                var moduleNames = ts.map(ts.concatenate(file.imports, nonGlobalAugmentation), getTextOfLiteral);\n                var resolutions = resolveModuleNamesReusingOldState(moduleNames, ts.getNormalizedAbsolutePath(file.fileName, currentDirectory), file);\n                ts.Debug.assert(resolutions.length === moduleNames.length);\n                for (var i = 0; i < moduleNames.length; i++) {\n                    var resolution = resolutions[i];\n                    ts.setResolvedModule(file, moduleNames[i], resolution);\n                    if (!resolution) {\n                        continue;\n                    }\n                    var isFromNodeModulesSearch = resolution.isExternalLibraryImport;\n                    var isJsFileFromNodeModules = isFromNodeModulesSearch && !ts.extensionIsTypeScript(resolution.extension);\n                    var resolvedFileName = resolution.resolvedFileName;\n                    if (isFromNodeModulesSearch) {\n                        currentNodeModulesDepth++;\n                    }\n                    // add file to program only if:\n                    // - resolution was successful\n                    // - noResolve is falsy\n                    // - module name comes from the list of imports\n                    // - it's not a top level JavaScript module that exceeded the search max\n                    var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth;\n                    // Don't add the file if it has a bad extension (e.g. 'tsx' if we don't have '--allowJs')\n                    // This may still end up being an untyped module -- the file won't be included but imports will be allowed.\n                    var shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport;\n                    if (elideImport) {\n                        modulesWithElidedImports[file.path] = true;\n                    }\n                    else if (shouldAddFile) {\n                        var path = ts.toPath(resolvedFileName, currentDirectory, getCanonicalFileName);\n                        var pos = ts.skipTrivia(file.text, file.imports[i].pos);\n                        findSourceFile(resolvedFileName, path, /*isDefaultLib*/ false, file, pos, file.imports[i].end);\n                    }\n                    if (isFromNodeModulesSearch) {\n                        currentNodeModulesDepth--;\n                    }\n                }\n            }\n            else {\n                // no imports - drop cached module resolutions\n                file.resolvedModules = undefined;\n            }\n        }\n        function computeCommonSourceDirectory(sourceFiles) {\n            var fileNames = [];\n            for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) {\n                var file = sourceFiles_6[_i];\n                if (!file.isDeclarationFile) {\n                    fileNames.push(file.fileName);\n                }\n            }\n            return computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName);\n        }\n        function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) {\n            var allFilesBelongToPath = true;\n            if (sourceFiles) {\n                var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory));\n                for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) {\n                    var sourceFile = sourceFiles_7[_i];\n                    if (!ts.isDeclarationFile(sourceFile)) {\n                        var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));\n                        if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {\n                            programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir));\n                            allFilesBelongToPath = false;\n                        }\n                    }\n                }\n            }\n            return allFilesBelongToPath;\n        }\n        function verifyCompilerOptions() {\n            if (options.isolatedModules) {\n                if (options.declaration) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"declaration\", \"isolatedModules\"));\n                }\n                if (options.noEmitOnError) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"noEmitOnError\", \"isolatedModules\"));\n                }\n                if (options.out) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"out\", \"isolatedModules\"));\n                }\n                if (options.outFile) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"outFile\", \"isolatedModules\"));\n                }\n            }\n            if (options.inlineSourceMap) {\n                if (options.sourceMap) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"sourceMap\", \"inlineSourceMap\"));\n                }\n                if (options.mapRoot) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"mapRoot\", \"inlineSourceMap\"));\n                }\n            }\n            if (options.paths && options.baseUrl === undefined) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option));\n            }\n            if (options.paths) {\n                for (var key in options.paths) {\n                    if (!ts.hasProperty(options.paths, key)) {\n                        continue;\n                    }\n                    if (!ts.hasZeroOrOneAsteriskCharacter(key)) {\n                        programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key));\n                    }\n                    if (ts.isArray(options.paths[key])) {\n                        if (options.paths[key].length === 0) {\n                            programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitutions_for_pattern_0_shouldn_t_be_an_empty_array, key));\n                        }\n                        for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) {\n                            var subst = _a[_i];\n                            var typeOfSubst = typeof subst;\n                            if (typeOfSubst === \"string\") {\n                                if (!ts.hasZeroOrOneAsteriskCharacter(subst)) {\n                                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key));\n                                }\n                            }\n                            else {\n                                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst));\n                            }\n                        }\n                    }\n                    else {\n                        programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitutions_for_pattern_0_should_be_an_array, key));\n                    }\n                }\n            }\n            if (!options.sourceMap && !options.inlineSourceMap) {\n                if (options.inlineSources) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, \"inlineSources\"));\n                }\n                if (options.sourceRoot) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, \"sourceRoot\"));\n                }\n            }\n            if (options.out && options.outFile) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"out\", \"outFile\"));\n            }\n            if (options.mapRoot && !options.sourceMap) {\n                // Error to specify --mapRoot without --sourcemap\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, \"mapRoot\", \"sourceMap\"));\n            }\n            if (options.declarationDir) {\n                if (!options.declaration) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, \"declarationDir\", \"declaration\"));\n                }\n                if (options.out || options.outFile) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"declarationDir\", options.out ? \"out\" : \"outFile\"));\n                }\n            }\n            if (options.lib && options.noLib) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"lib\", \"noLib\"));\n            }\n            if (options.noImplicitUseStrict && options.alwaysStrict) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"noImplicitUseStrict\", \"alwaysStrict\"));\n            }\n            var languageVersion = options.target || 0 /* ES3 */;\n            var outFile = options.outFile || options.out;\n            var firstNonAmbientExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; });\n            if (options.isolatedModules) {\n                if (options.module === ts.ModuleKind.None && languageVersion < 2 /* ES2015 */) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher));\n                }\n                var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; });\n                if (firstNonExternalModuleSourceFile) {\n                    var span_7 = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);\n                    programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span_7.start, span_7.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));\n                }\n            }\n            else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ES2015 */ && options.module === ts.ModuleKind.None) {\n                // We cannot use createDiagnosticFromNode because nodes do not have parents yet\n                var span_8 = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);\n                programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span_8.start, span_8.length, ts.Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none));\n            }\n            // Cannot specify module gen that isn't amd or system with --out\n            if (outFile) {\n                if (options.module && !(options.module === ts.ModuleKind.AMD || options.module === ts.ModuleKind.System)) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? \"out\" : \"outFile\"));\n                }\n                else if (options.module === undefined && firstNonAmbientExternalModuleSourceFile) {\n                    var span_9 = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);\n                    programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span_9.start, span_9.length, ts.Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, options.out ? \"out\" : \"outFile\"));\n                }\n            }\n            // there has to be common source directory if user specified --outdir || --sourceRoot\n            // if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted\n            if (options.outDir ||\n                options.sourceRoot ||\n                options.mapRoot) {\n                // Precalculate and cache the common source directory\n                var dir = getCommonSourceDirectory();\n                // If we failed to find a good common directory, but outDir is specified and at least one of our files is on a windows drive/URL/other resource, add a failure\n                if (options.outDir && dir === \"\" && ts.forEach(files, function (file) { return ts.getRootLength(file.fileName) > 1; })) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));\n                }\n            }\n            if (!options.noEmit && options.allowJs && options.declaration) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"allowJs\", \"declaration\"));\n            }\n            if (options.emitDecoratorMetadata &&\n                !options.experimentalDecorators) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, \"emitDecoratorMetadata\", \"experimentalDecorators\"));\n            }\n            if (options.jsxFactory) {\n                if (options.reactNamespace) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, \"reactNamespace\", \"jsxFactory\"));\n                }\n                if (!ts.parseIsolatedEntityName(options.jsxFactory, languageVersion)) {\n                    programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory));\n                }\n            }\n            else if (options.reactNamespace && !ts.isIdentifierText(options.reactNamespace, languageVersion)) {\n                programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace));\n            }\n            // If the emit is enabled make sure that every output file is unique and not overwriting any of the input files\n            if (!options.noEmit && !options.suppressOutputPathCheck) {\n                var emitHost = getEmitHost();\n                var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined);\n                ts.forEachExpectedEmitFile(emitHost, function (emitFileNames) {\n                    verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1);\n                    verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1);\n                });\n            }\n            // Verify that all the emit files are unique and don't overwrite input files\n            function verifyEmitFilePath(emitFileName, emitFilesSeen) {\n                if (emitFileName) {\n                    var emitFilePath = ts.toPath(emitFileName, currentDirectory, getCanonicalFileName);\n                    // Report error if the output overwrites input file\n                    if (filesByName.contains(emitFilePath)) {\n                        var chain_1;\n                        if (!options.configFilePath) {\n                            // The program is from either an inferred project or an external project\n                            chain_1 = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);\n                        }\n                        chain_1 = ts.chainDiagnosticMessages(chain_1, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);\n                        blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain_1));\n                    }\n                    // Report error if multiple files write into same file\n                    if (emitFilesSeen.contains(emitFilePath)) {\n                        // Already seen the same emit file - report error\n                        blockEmittingOfFile(emitFileName, ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files, emitFileName));\n                    }\n                    else {\n                        emitFilesSeen.set(emitFilePath, true);\n                    }\n                }\n            }\n        }\n        function blockEmittingOfFile(emitFileName, diag) {\n            hasEmitBlockingDiagnostics.set(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName), true);\n            programDiagnostics.add(diag);\n        }\n    }\n    ts.createProgram = createProgram;\n    /* @internal */\n    /**\n     * Returns a DiagnosticMessage if we won't include a resolved module due to its extension.\n     * The DiagnosticMessage's parameters are the imported module name, and the filename it resolved to.\n     * This returns a diagnostic even if the module will be an untyped module.\n     */\n    function getResolutionDiagnostic(options, _a) {\n        var extension = _a.extension;\n        switch (extension) {\n            case ts.Extension.Ts:\n            case ts.Extension.Dts:\n                // These are always allowed.\n                return undefined;\n            case ts.Extension.Tsx:\n                return needJsx();\n            case ts.Extension.Jsx:\n                return needJsx() || needAllowJs();\n            case ts.Extension.Js:\n                return needAllowJs();\n        }\n        function needJsx() {\n            return options.jsx ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set;\n        }\n        function needAllowJs() {\n            return options.allowJs ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_allowJs_is_not_set;\n        }\n    }\n    ts.getResolutionDiagnostic = getResolutionDiagnostic;\n})(ts || (ts = {}));\n/// <reference path=\"sys.ts\"/>\n/// <reference path=\"types.ts\"/>\n/// <reference path=\"core.ts\"/>\n/// <reference path=\"diagnosticInformationMap.generated.ts\"/>\n/// <reference path=\"scanner.ts\"/>\nvar ts;\n(function (ts) {\n    /* @internal */\n    ts.compileOnSaveCommandLineOption = { name: \"compileOnSave\", type: \"boolean\" };\n    /* @internal */\n    ts.optionDeclarations = [\n        {\n            name: \"charset\",\n            type: \"string\",\n        },\n        ts.compileOnSaveCommandLineOption,\n        {\n            name: \"declaration\",\n            shortName: \"d\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Generates_corresponding_d_ts_file,\n        },\n        {\n            name: \"declarationDir\",\n            type: \"string\",\n            isFilePath: true,\n            paramType: ts.Diagnostics.DIRECTORY,\n        },\n        {\n            name: \"diagnostics\",\n            type: \"boolean\",\n        },\n        {\n            name: \"extendedDiagnostics\",\n            type: \"boolean\",\n            experimental: true\n        },\n        {\n            name: \"emitBOM\",\n            type: \"boolean\"\n        },\n        {\n            name: \"help\",\n            shortName: \"h\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Print_this_message,\n        },\n        {\n            name: \"help\",\n            shortName: \"?\",\n            type: \"boolean\"\n        },\n        {\n            name: \"init\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file,\n        },\n        {\n            name: \"inlineSourceMap\",\n            type: \"boolean\",\n        },\n        {\n            name: \"inlineSources\",\n            type: \"boolean\",\n        },\n        {\n            name: \"jsx\",\n            type: ts.createMap({\n                \"preserve\": 1 /* Preserve */,\n                \"react\": 2 /* React */\n            }),\n            paramType: ts.Diagnostics.KIND,\n            description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react,\n        },\n        {\n            name: \"reactNamespace\",\n            type: \"string\",\n            description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit\n        },\n        {\n            name: \"jsxFactory\",\n            type: \"string\",\n            description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h\n        },\n        {\n            name: \"listFiles\",\n            type: \"boolean\",\n        },\n        {\n            name: \"locale\",\n            type: \"string\",\n        },\n        {\n            name: \"mapRoot\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,\n            paramType: ts.Diagnostics.LOCATION,\n        },\n        {\n            name: \"module\",\n            shortName: \"m\",\n            type: ts.createMap({\n                \"none\": ts.ModuleKind.None,\n                \"commonjs\": ts.ModuleKind.CommonJS,\n                \"amd\": ts.ModuleKind.AMD,\n                \"system\": ts.ModuleKind.System,\n                \"umd\": ts.ModuleKind.UMD,\n                \"es6\": ts.ModuleKind.ES2015,\n                \"es2015\": ts.ModuleKind.ES2015,\n            }),\n            description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015,\n            paramType: ts.Diagnostics.KIND,\n        },\n        {\n            name: \"newLine\",\n            type: ts.createMap({\n                \"crlf\": 0 /* CarriageReturnLineFeed */,\n                \"lf\": 1 /* LineFeed */\n            }),\n            description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,\n            paramType: ts.Diagnostics.NEWLINE,\n        },\n        {\n            name: \"noEmit\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_emit_outputs,\n        },\n        {\n            name: \"noEmitHelpers\",\n            type: \"boolean\"\n        },\n        {\n            name: \"noEmitOnError\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,\n        },\n        {\n            name: \"noErrorTruncation\",\n            type: \"boolean\"\n        },\n        {\n            name: \"noImplicitAny\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type,\n        },\n        {\n            name: \"noImplicitThis\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type,\n        },\n        {\n            name: \"noUnusedLocals\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Report_errors_on_unused_locals,\n        },\n        {\n            name: \"noUnusedParameters\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Report_errors_on_unused_parameters,\n        },\n        {\n            name: \"noLib\",\n            type: \"boolean\",\n        },\n        {\n            name: \"noResolve\",\n            type: \"boolean\",\n        },\n        {\n            name: \"skipDefaultLibCheck\",\n            type: \"boolean\",\n        },\n        {\n            name: \"skipLibCheck\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Skip_type_checking_of_declaration_files,\n        },\n        {\n            name: \"out\",\n            type: \"string\",\n            isFilePath: false,\n            // for correct behaviour, please use outFile\n            paramType: ts.Diagnostics.FILE,\n        },\n        {\n            name: \"outFile\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file,\n            paramType: ts.Diagnostics.FILE,\n        },\n        {\n            name: \"outDir\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Redirect_output_structure_to_the_directory,\n            paramType: ts.Diagnostics.DIRECTORY,\n        },\n        {\n            name: \"preserveConstEnums\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code\n        },\n        {\n            name: \"pretty\",\n            description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental,\n            type: \"boolean\"\n        },\n        {\n            name: \"project\",\n            shortName: \"p\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Compile_the_project_in_the_given_directory,\n            paramType: ts.Diagnostics.DIRECTORY\n        },\n        {\n            name: \"removeComments\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_emit_comments_to_output,\n        },\n        {\n            name: \"rootDir\",\n            type: \"string\",\n            isFilePath: true,\n            paramType: ts.Diagnostics.LOCATION,\n            description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir,\n        },\n        {\n            name: \"isolatedModules\",\n            type: \"boolean\",\n        },\n        {\n            name: \"sourceMap\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Generates_corresponding_map_file,\n        },\n        {\n            name: \"sourceRoot\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,\n            paramType: ts.Diagnostics.LOCATION,\n        },\n        {\n            name: \"suppressExcessPropertyErrors\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals,\n            experimental: true\n        },\n        {\n            name: \"suppressImplicitAnyIndexErrors\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures,\n        },\n        {\n            name: \"stripInternal\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation,\n            experimental: true\n        },\n        {\n            name: \"target\",\n            shortName: \"t\",\n            type: ts.createMap({\n                \"es3\": 0 /* ES3 */,\n                \"es5\": 1 /* ES5 */,\n                \"es6\": 2 /* ES2015 */,\n                \"es2015\": 2 /* ES2015 */,\n                \"es2016\": 3 /* ES2016 */,\n                \"es2017\": 4 /* ES2017 */,\n                \"esnext\": 5 /* ESNext */,\n            }),\n            description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT,\n            paramType: ts.Diagnostics.VERSION,\n        },\n        {\n            name: \"version\",\n            shortName: \"v\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Print_the_compiler_s_version,\n        },\n        {\n            name: \"watch\",\n            shortName: \"w\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Watch_input_files,\n        },\n        {\n            name: \"experimentalDecorators\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators\n        },\n        {\n            name: \"emitDecoratorMetadata\",\n            type: \"boolean\",\n            experimental: true,\n            description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators\n        },\n        {\n            name: \"moduleResolution\",\n            type: ts.createMap({\n                \"node\": ts.ModuleResolutionKind.NodeJs,\n                \"classic\": ts.ModuleResolutionKind.Classic,\n            }),\n            description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6,\n            paramType: ts.Diagnostics.STRATEGY,\n        },\n        {\n            name: \"allowUnusedLabels\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_report_errors_on_unused_labels\n        },\n        {\n            name: \"noImplicitReturns\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value\n        },\n        {\n            name: \"noFallthroughCasesInSwitch\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement\n        },\n        {\n            name: \"allowUnreachableCode\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code\n        },\n        {\n            name: \"forceConsistentCasingInFileNames\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file\n        },\n        {\n            name: \"baseUrl\",\n            type: \"string\",\n            isFilePath: true,\n            description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names\n        },\n        {\n            // this option can only be specified in tsconfig.json\n            // use type = object to copy the value as-is\n            name: \"paths\",\n            type: \"object\",\n            isTSConfigOnly: true\n        },\n        {\n            // this option can only be specified in tsconfig.json\n            // use type = object to copy the value as-is\n            name: \"rootDirs\",\n            type: \"list\",\n            isTSConfigOnly: true,\n            element: {\n                name: \"rootDirs\",\n                type: \"string\",\n                isFilePath: true\n            }\n        },\n        {\n            name: \"typeRoots\",\n            type: \"list\",\n            element: {\n                name: \"typeRoots\",\n                type: \"string\",\n                isFilePath: true\n            }\n        },\n        {\n            name: \"types\",\n            type: \"list\",\n            element: {\n                name: \"types\",\n                type: \"string\"\n            },\n            description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation\n        },\n        {\n            name: \"traceResolution\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process\n        },\n        {\n            name: \"allowJs\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Allow_javascript_files_to_be_compiled\n        },\n        {\n            name: \"allowSyntheticDefaultImports\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking\n        },\n        {\n            name: \"noImplicitUseStrict\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output\n        },\n        {\n            name: \"maxNodeModuleJsDepth\",\n            type: \"number\",\n            description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files\n        },\n        {\n            name: \"listEmittedFiles\",\n            type: \"boolean\"\n        },\n        {\n            name: \"lib\",\n            type: \"list\",\n            element: {\n                name: \"lib\",\n                type: ts.createMap({\n                    // JavaScript only\n                    \"es5\": \"lib.es5.d.ts\",\n                    \"es6\": \"lib.es2015.d.ts\",\n                    \"es2015\": \"lib.es2015.d.ts\",\n                    \"es7\": \"lib.es2016.d.ts\",\n                    \"es2016\": \"lib.es2016.d.ts\",\n                    \"es2017\": \"lib.es2017.d.ts\",\n                    // Host only\n                    \"dom\": \"lib.dom.d.ts\",\n                    \"dom.iterable\": \"lib.dom.iterable.d.ts\",\n                    \"webworker\": \"lib.webworker.d.ts\",\n                    \"scripthost\": \"lib.scripthost.d.ts\",\n                    // ES2015 Or ESNext By-feature options\n                    \"es2015.core\": \"lib.es2015.core.d.ts\",\n                    \"es2015.collection\": \"lib.es2015.collection.d.ts\",\n                    \"es2015.generator\": \"lib.es2015.generator.d.ts\",\n                    \"es2015.iterable\": \"lib.es2015.iterable.d.ts\",\n                    \"es2015.promise\": \"lib.es2015.promise.d.ts\",\n                    \"es2015.proxy\": \"lib.es2015.proxy.d.ts\",\n                    \"es2015.reflect\": \"lib.es2015.reflect.d.ts\",\n                    \"es2015.symbol\": \"lib.es2015.symbol.d.ts\",\n                    \"es2015.symbol.wellknown\": \"lib.es2015.symbol.wellknown.d.ts\",\n                    \"es2016.array.include\": \"lib.es2016.array.include.d.ts\",\n                    \"es2017.object\": \"lib.es2017.object.d.ts\",\n                    \"es2017.sharedmemory\": \"lib.es2017.sharedmemory.d.ts\",\n                    \"es2017.string\": \"lib.es2017.string.d.ts\",\n                }),\n            },\n            description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon\n        },\n        {\n            name: \"disableSizeLimit\",\n            type: \"boolean\"\n        },\n        {\n            name: \"strictNullChecks\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Enable_strict_null_checks\n        },\n        {\n            name: \"importHelpers\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Import_emit_helpers_from_tslib\n        },\n        {\n            name: \"alwaysStrict\",\n            type: \"boolean\",\n            description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file\n        }\n    ];\n    /* @internal */\n    ts.typeAcquisitionDeclarations = [\n        {\n            /* @deprecated typingOptions.enableAutoDiscovery\n             * Use typeAcquisition.enable instead.\n             */\n            name: \"enableAutoDiscovery\",\n            type: \"boolean\",\n        },\n        {\n            name: \"enable\",\n            type: \"boolean\",\n        },\n        {\n            name: \"include\",\n            type: \"list\",\n            element: {\n                name: \"include\",\n                type: \"string\"\n            }\n        },\n        {\n            name: \"exclude\",\n            type: \"list\",\n            element: {\n                name: \"exclude\",\n                type: \"string\"\n            }\n        }\n    ];\n    /* @internal */\n    ts.defaultInitCompilerOptions = {\n        module: ts.ModuleKind.CommonJS,\n        target: 1 /* ES5 */,\n        noImplicitAny: false,\n        sourceMap: false,\n    };\n    var optionNameMapCache;\n    /* @internal */\n    function convertEnableAutoDiscoveryToEnable(typeAcquisition) {\n        // Convert deprecated typingOptions.enableAutoDiscovery to typeAcquisition.enable\n        if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) {\n            var result = {\n                enable: typeAcquisition.enableAutoDiscovery,\n                include: typeAcquisition.include || [],\n                exclude: typeAcquisition.exclude || []\n            };\n            return result;\n        }\n        return typeAcquisition;\n    }\n    ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable;\n    /* @internal */\n    function getOptionNameMap() {\n        if (optionNameMapCache) {\n            return optionNameMapCache;\n        }\n        var optionNameMap = ts.createMap();\n        var shortOptionNames = ts.createMap();\n        ts.forEach(ts.optionDeclarations, function (option) {\n            optionNameMap[option.name.toLowerCase()] = option;\n            if (option.shortName) {\n                shortOptionNames[option.shortName] = option.name;\n            }\n        });\n        optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames };\n        return optionNameMapCache;\n    }\n    ts.getOptionNameMap = getOptionNameMap;\n    /* @internal */\n    function createCompilerDiagnosticForInvalidCustomType(opt) {\n        var namesOfType = Object.keys(opt.type).map(function (key) { return \"'\" + key + \"'\"; }).join(\", \");\n        return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, \"--\" + opt.name, namesOfType);\n    }\n    ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType;\n    /* @internal */\n    function parseCustomTypeOption(opt, value, errors) {\n        var key = trimString((value || \"\")).toLowerCase();\n        var map = opt.type;\n        if (key in map) {\n            return map[key];\n        }\n        else {\n            errors.push(createCompilerDiagnosticForInvalidCustomType(opt));\n        }\n    }\n    ts.parseCustomTypeOption = parseCustomTypeOption;\n    /* @internal */\n    function parseListTypeOption(opt, value, errors) {\n        if (value === void 0) { value = \"\"; }\n        value = trimString(value);\n        if (ts.startsWith(value, \"-\")) {\n            return undefined;\n        }\n        if (value === \"\") {\n            return [];\n        }\n        var values = value.split(\",\");\n        switch (opt.element.type) {\n            case \"number\":\n                return ts.map(values, parseInt);\n            case \"string\":\n                return ts.map(values, function (v) { return v || \"\"; });\n            default:\n                return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; });\n        }\n    }\n    ts.parseListTypeOption = parseListTypeOption;\n    /* @internal */\n    function parseCommandLine(commandLine, readFile) {\n        var options = {};\n        var fileNames = [];\n        var errors = [];\n        var _a = getOptionNameMap(), optionNameMap = _a.optionNameMap, shortOptionNames = _a.shortOptionNames;\n        parseStrings(commandLine);\n        return {\n            options: options,\n            fileNames: fileNames,\n            errors: errors\n        };\n        function parseStrings(args) {\n            var i = 0;\n            while (i < args.length) {\n                var s = args[i];\n                i++;\n                if (s.charCodeAt(0) === 64 /* at */) {\n                    parseResponseFile(s.slice(1));\n                }\n                else if (s.charCodeAt(0) === 45 /* minus */) {\n                    s = s.slice(s.charCodeAt(1) === 45 /* minus */ ? 2 : 1).toLowerCase();\n                    // Try to translate short option names to their full equivalents.\n                    if (s in shortOptionNames) {\n                        s = shortOptionNames[s];\n                    }\n                    if (s in optionNameMap) {\n                        var opt = optionNameMap[s];\n                        if (opt.isTSConfigOnly) {\n                            errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name));\n                        }\n                        else {\n                            // Check to see if no argument was provided (e.g. \"--locale\" is the last command-line argument).\n                            if (!args[i] && opt.type !== \"boolean\") {\n                                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name));\n                            }\n                            switch (opt.type) {\n                                case \"number\":\n                                    options[opt.name] = parseInt(args[i]);\n                                    i++;\n                                    break;\n                                case \"boolean\":\n                                    // boolean flag has optional value true, false, others\n                                    var optValue = args[i];\n                                    options[opt.name] = optValue !== \"false\";\n                                    // consume next argument as boolean flag value\n                                    if (optValue === \"false\" || optValue === \"true\") {\n                                        i++;\n                                    }\n                                    break;\n                                case \"string\":\n                                    options[opt.name] = args[i] || \"\";\n                                    i++;\n                                    break;\n                                case \"list\":\n                                    var result = parseListTypeOption(opt, args[i], errors);\n                                    options[opt.name] = result || [];\n                                    if (result) {\n                                        i++;\n                                    }\n                                    break;\n                                // If not a primitive, the possible types are specified in what is effectively a map of options.\n                                default:\n                                    options[opt.name] = parseCustomTypeOption(opt, args[i], errors);\n                                    i++;\n                                    break;\n                            }\n                        }\n                    }\n                    else {\n                        errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, s));\n                    }\n                }\n                else {\n                    fileNames.push(s);\n                }\n            }\n        }\n        function parseResponseFile(fileName) {\n            var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName);\n            if (!text) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName));\n                return;\n            }\n            var args = [];\n            var pos = 0;\n            while (true) {\n                while (pos < text.length && text.charCodeAt(pos) <= 32 /* space */)\n                    pos++;\n                if (pos >= text.length)\n                    break;\n                var start = pos;\n                if (text.charCodeAt(start) === 34 /* doubleQuote */) {\n                    pos++;\n                    while (pos < text.length && text.charCodeAt(pos) !== 34 /* doubleQuote */)\n                        pos++;\n                    if (pos < text.length) {\n                        args.push(text.substring(start + 1, pos));\n                        pos++;\n                    }\n                    else {\n                        errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName));\n                    }\n                }\n                else {\n                    while (text.charCodeAt(pos) > 32 /* space */)\n                        pos++;\n                    args.push(text.substring(start, pos));\n                }\n            }\n            parseStrings(args);\n        }\n    }\n    ts.parseCommandLine = parseCommandLine;\n    /**\n      * Read tsconfig.json file\n      * @param fileName The path to the config file\n      */\n    function readConfigFile(fileName, readFile) {\n        var text = \"\";\n        try {\n            text = readFile(fileName);\n        }\n        catch (e) {\n            return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) };\n        }\n        return parseConfigFileTextToJson(fileName, text);\n    }\n    ts.readConfigFile = readConfigFile;\n    /**\n      * Parse the text of the tsconfig.json file\n      * @param fileName The path to the config file\n      * @param jsonText The text of the config file\n      */\n    function parseConfigFileTextToJson(fileName, jsonText, stripComments) {\n        if (stripComments === void 0) { stripComments = true; }\n        try {\n            var jsonTextToParse = stripComments ? removeComments(jsonText) : jsonText;\n            return { config: /\\S/.test(jsonTextToParse) ? JSON.parse(jsonTextToParse) : {} };\n        }\n        catch (e) {\n            return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) };\n        }\n    }\n    ts.parseConfigFileTextToJson = parseConfigFileTextToJson;\n    /**\n     * Generate tsconfig configuration when running command line \"--init\"\n     * @param options commandlineOptions to be generated into tsconfig.json\n     * @param fileNames array of filenames to be generated into tsconfig.json\n     */\n    /* @internal */\n    function generateTSConfig(options, fileNames) {\n        var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions);\n        var configurations = {\n            compilerOptions: serializeCompilerOptions(compilerOptions)\n        };\n        if (fileNames && fileNames.length) {\n            // only set the files property if we have at least one file\n            configurations.files = fileNames;\n        }\n        return configurations;\n        function getCustomTypeMapOfCommandLineOption(optionDefinition) {\n            if (optionDefinition.type === \"string\" || optionDefinition.type === \"number\" || optionDefinition.type === \"boolean\") {\n                // this is of a type CommandLineOptionOfPrimitiveType\n                return undefined;\n            }\n            else if (optionDefinition.type === \"list\") {\n                return getCustomTypeMapOfCommandLineOption(optionDefinition.element);\n            }\n            else {\n                return optionDefinition.type;\n            }\n        }\n        function getNameOfCompilerOptionValue(value, customTypeMap) {\n            // There is a typeMap associated with this command-line option so use it to map value back to its name\n            for (var key in customTypeMap) {\n                if (customTypeMap[key] === value) {\n                    return key;\n                }\n            }\n            return undefined;\n        }\n        function serializeCompilerOptions(options) {\n            var result = ts.createMap();\n            var optionsNameMap = getOptionNameMap().optionNameMap;\n            for (var name_43 in options) {\n                if (ts.hasProperty(options, name_43)) {\n                    // tsconfig only options cannot be specified via command line,\n                    // so we can assume that only types that can appear here string | number | boolean\n                    switch (name_43) {\n                        case \"init\":\n                        case \"watch\":\n                        case \"version\":\n                        case \"help\":\n                        case \"project\":\n                            break;\n                        default:\n                            var value = options[name_43];\n                            var optionDefinition = optionsNameMap[name_43.toLowerCase()];\n                            if (optionDefinition) {\n                                var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition);\n                                if (!customTypeMap) {\n                                    // There is no map associated with this compiler option then use the value as-is\n                                    // This is the case if the value is expect to be string, number, boolean or list of string\n                                    result[name_43] = value;\n                                }\n                                else {\n                                    if (optionDefinition.type === \"list\") {\n                                        var convertedValue = [];\n                                        for (var _i = 0, _a = value; _i < _a.length; _i++) {\n                                            var element = _a[_i];\n                                            convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap));\n                                        }\n                                        result[name_43] = convertedValue;\n                                    }\n                                    else {\n                                        // There is a typeMap associated with this command-line option so use it to map value back to its name\n                                        result[name_43] = getNameOfCompilerOptionValue(value, customTypeMap);\n                                    }\n                                }\n                            }\n                            break;\n                    }\n                }\n            }\n            return result;\n        }\n    }\n    ts.generateTSConfig = generateTSConfig;\n    /**\n     * Remove the comments from a json like text.\n     * Comments can be single line comments (starting with # or //) or multiline comments using / * * /\n     *\n     * This method replace comment content by whitespace rather than completely remove them to keep positions in json parsing error reporting accurate.\n     */\n    function removeComments(jsonText) {\n        var output = \"\";\n        var scanner = ts.createScanner(1 /* ES5 */, /* skipTrivia */ false, 0 /* Standard */, jsonText);\n        var token;\n        while ((token = scanner.scan()) !== 1 /* EndOfFileToken */) {\n            switch (token) {\n                case 2 /* SingleLineCommentTrivia */:\n                case 3 /* MultiLineCommentTrivia */:\n                    // replace comments with whitespace to preserve original character positions\n                    output += scanner.getTokenText().replace(/\\S/g, \" \");\n                    break;\n                default:\n                    output += scanner.getTokenText();\n                    break;\n            }\n        }\n        return output;\n    }\n    /**\n      * Parse the contents of a config file (tsconfig.json).\n      * @param json The contents of the config file to parse\n      * @param host Instance of ParseConfigHost used to enumerate files in folder.\n      * @param basePath A root directory to resolve relative path entries in the config\n      *    file to. e.g. outDir\n      */\n    function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) {\n        if (existingOptions === void 0) { existingOptions = {}; }\n        if (resolutionStack === void 0) { resolutionStack = []; }\n        var errors = [];\n        var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);\n        var resolvedPath = ts.toPath(configFileName || \"\", basePath, getCanonicalFileName);\n        if (resolutionStack.indexOf(resolvedPath) >= 0) {\n            return {\n                options: {},\n                fileNames: [],\n                typeAcquisition: {},\n                raw: json,\n                errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(\" -> \"))],\n                wildcardDirectories: {}\n            };\n        }\n        var options = convertCompilerOptionsFromJsonWorker(json[\"compilerOptions\"], basePath, errors, configFileName);\n        // typingOptions has been deprecated and is only supported for backward compatibility purposes.\n        // It should be removed in future releases - use typeAcquisition instead.\n        var jsonOptions = json[\"typeAcquisition\"] || json[\"typingOptions\"];\n        var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);\n        if (json[\"extends\"]) {\n            var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3];\n            if (typeof json[\"extends\"] === \"string\") {\n                _b = (tryExtendsName(json[\"extends\"]) || [include, exclude, files, baseOptions]), include = _b[0], exclude = _b[1], files = _b[2], baseOptions = _b[3];\n            }\n            else {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, \"extends\", \"string\"));\n            }\n            if (include && !json[\"include\"]) {\n                json[\"include\"] = include;\n            }\n            if (exclude && !json[\"exclude\"]) {\n                json[\"exclude\"] = exclude;\n            }\n            if (files && !json[\"files\"]) {\n                json[\"files\"] = files;\n            }\n            options = ts.assign({}, baseOptions, options);\n        }\n        options = ts.extend(existingOptions, options);\n        options.configFilePath = configFileName;\n        var _c = getFileNames(errors), fileNames = _c.fileNames, wildcardDirectories = _c.wildcardDirectories;\n        var compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors);\n        return {\n            options: options,\n            fileNames: fileNames,\n            typeAcquisition: typeAcquisition,\n            raw: json,\n            errors: errors,\n            wildcardDirectories: wildcardDirectories,\n            compileOnSave: compileOnSave\n        };\n        function tryExtendsName(extendedConfig) {\n            // If the path isn't a rooted or relative path, don't try to resolve it (we reserve the right to special case module-id like paths in the future)\n            if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), \"./\") || ts.startsWith(ts.normalizeSlashes(extendedConfig), \"../\"))) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig));\n                return;\n            }\n            var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName);\n            if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, \".json\")) {\n                extendedConfigPath = extendedConfigPath + \".json\";\n                if (!host.fileExists(extendedConfigPath)) {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig));\n                    return;\n                }\n            }\n            var extendedResult = readConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });\n            if (extendedResult.error) {\n                errors.push(extendedResult.error);\n                return;\n            }\n            var extendedDirname = ts.getDirectoryPath(extendedConfigPath);\n            var relativeDifference = ts.convertToRelativePath(extendedDirname, basePath, getCanonicalFileName);\n            var updatePath = function (path) { return ts.isRootedDiskPath(path) ? path : ts.combinePaths(relativeDifference, path); };\n            // Merge configs (copy the resolution stack so it is never reused between branches in potential diamond-problem scenarios)\n            var result = parseJsonConfigFileContent(extendedResult.config, host, extendedDirname, /*existingOptions*/ undefined, ts.getBaseFileName(extendedConfigPath), resolutionStack.concat([resolvedPath]));\n            errors.push.apply(errors, result.errors);\n            var _a = ts.map([\"include\", \"exclude\", \"files\"], function (key) {\n                if (!json[key] && extendedResult.config[key]) {\n                    return ts.map(extendedResult.config[key], updatePath);\n                }\n            }), include = _a[0], exclude = _a[1], files = _a[2];\n            return [include, exclude, files, result.options];\n        }\n        function getFileNames(errors) {\n            var fileNames;\n            if (ts.hasProperty(json, \"files\")) {\n                if (ts.isArray(json[\"files\"])) {\n                    fileNames = json[\"files\"];\n                    if (fileNames.length === 0) {\n                        errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || \"tsconfig.json\"));\n                    }\n                }\n                else {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, \"files\", \"Array\"));\n                }\n            }\n            var includeSpecs;\n            if (ts.hasProperty(json, \"include\")) {\n                if (ts.isArray(json[\"include\"])) {\n                    includeSpecs = json[\"include\"];\n                }\n                else {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, \"include\", \"Array\"));\n                }\n            }\n            var excludeSpecs;\n            if (ts.hasProperty(json, \"exclude\")) {\n                if (ts.isArray(json[\"exclude\"])) {\n                    excludeSpecs = json[\"exclude\"];\n                }\n                else {\n                    errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, \"exclude\", \"Array\"));\n                }\n            }\n            else if (ts.hasProperty(json, \"excludes\")) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));\n            }\n            else {\n                // If no includes were specified, exclude common package folders and the outDir\n                excludeSpecs = includeSpecs ? [] : [\"node_modules\", \"bower_components\", \"jspm_packages\"];\n                var outDir = json[\"compilerOptions\"] && json[\"compilerOptions\"][\"outDir\"];\n                if (outDir) {\n                    excludeSpecs.push(outDir);\n                }\n            }\n            if (fileNames === undefined && includeSpecs === undefined) {\n                includeSpecs = [\"**/*\"];\n            }\n            var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors);\n            if (result.fileNames.length === 0 && !ts.hasProperty(json, \"files\") && resolutionStack.length === 0) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || \"tsconfig.json\", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || [])));\n            }\n            return result;\n        }\n        var _b;\n    }\n    ts.parseJsonConfigFileContent = parseJsonConfigFileContent;\n    function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) {\n        if (!ts.hasProperty(jsonOption, ts.compileOnSaveCommandLineOption.name)) {\n            return false;\n        }\n        var result = convertJsonOption(ts.compileOnSaveCommandLineOption, jsonOption[\"compileOnSave\"], basePath, errors);\n        if (typeof result === \"boolean\" && result) {\n            return result;\n        }\n        return false;\n    }\n    ts.convertCompileOnSaveOptionFromJson = convertCompileOnSaveOptionFromJson;\n    function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) {\n        var errors = [];\n        var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName);\n        return { options: options, errors: errors };\n    }\n    ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson;\n    function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) {\n        var errors = [];\n        var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);\n        return { options: options, errors: errors };\n    }\n    ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson;\n    function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {\n        var options = ts.getBaseFileName(configFileName) === \"jsconfig.json\"\n            ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true }\n            : {};\n        convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);\n        return options;\n    }\n    function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) {\n        var options = { enable: ts.getBaseFileName(configFileName) === \"jsconfig.json\", include: [], exclude: [] };\n        var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions);\n        convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors);\n        return options;\n    }\n    function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) {\n        if (!jsonOptions) {\n            return;\n        }\n        var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; });\n        for (var id in jsonOptions) {\n            if (id in optionNameMap) {\n                var opt = optionNameMap[id];\n                defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors);\n            }\n            else {\n                errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id));\n            }\n        }\n    }\n    function convertJsonOption(opt, value, basePath, errors) {\n        var optType = opt.type;\n        var expectedType = typeof optType === \"string\" ? optType : \"string\";\n        if (optType === \"list\" && ts.isArray(value)) {\n            return convertJsonOptionOfListType(opt, value, basePath, errors);\n        }\n        else if (typeof value === expectedType) {\n            if (typeof optType !== \"string\") {\n                return convertJsonOptionOfCustomType(opt, value, errors);\n            }\n            else {\n                if (opt.isFilePath) {\n                    value = ts.normalizePath(ts.combinePaths(basePath, value));\n                    if (value === \"\") {\n                        value = \".\";\n                    }\n                }\n            }\n            return value;\n        }\n        else {\n            errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType));\n        }\n    }\n    function convertJsonOptionOfCustomType(opt, value, errors) {\n        var key = value.toLowerCase();\n        if (key in opt.type) {\n            return opt.type[key];\n        }\n        else {\n            errors.push(createCompilerDiagnosticForInvalidCustomType(opt));\n        }\n    }\n    function convertJsonOptionOfListType(option, values, basePath, errors) {\n        return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; });\n    }\n    function trimString(s) {\n        return typeof s.trim === \"function\" ? s.trim() : s.replace(/^[\\s]+|[\\s]+$/g, \"\");\n    }\n    /**\n     * Tests for a path that ends in a recursive directory wildcard.\n     * Matches **, \\**, **\\, and \\**\\, but not a**b.\n     *\n     * NOTE: used \\ in place of / above to avoid issues with multiline comments.\n     *\n     * Breakdown:\n     *  (^|\\/)      # matches either the beginning of the string or a directory separator.\n     *  \\*\\*        # matches the recursive directory wildcard \"**\".\n     *  \\/?$        # matches an optional trailing directory separator at the end of the string.\n     */\n    var invalidTrailingRecursionPattern = /(^|\\/)\\*\\*\\/?$/;\n    /**\n     * Tests for a path with multiple recursive directory wildcards.\n     * Matches **\\** and **\\a\\**, but not **\\a**b.\n     *\n     * NOTE: used \\ in place of / above to avoid issues with multiline comments.\n     *\n     * Breakdown:\n     *  (^|\\/)      # matches either the beginning of the string or a directory separator.\n     *  \\*\\*\\/      # matches a recursive directory wildcard \"**\" followed by a directory separator.\n     *  (.*\\/)?     # optionally matches any number of characters followed by a directory separator.\n     *  \\*\\*        # matches a recursive directory wildcard \"**\"\n     *  ($|\\/)      # matches either the end of the string or a directory separator.\n     */\n    var invalidMultipleRecursionPatterns = /(^|\\/)\\*\\*\\/(.*\\/)?\\*\\*($|\\/)/;\n    /**\n     * Tests for a path where .. appears after a recursive directory wildcard.\n     * Matches **\\..\\*, **\\a\\..\\*, and **\\.., but not ..\\**\\*\n     *\n     * NOTE: used \\ in place of / above to avoid issues with multiline comments.\n     *\n     * Breakdown:\n     *  (^|\\/)      # matches either the beginning of the string or a directory separator.\n     *  \\*\\*\\/      # matches a recursive directory wildcard \"**\" followed by a directory separator.\n     *  (.*\\/)?     # optionally matches any number of characters followed by a directory separator.\n     *  \\.\\.        # matches a parent directory path component \"..\"\n     *  ($|\\/)      # matches either the end of the string or a directory separator.\n     */\n    var invalidDotDotAfterRecursiveWildcardPattern = /(^|\\/)\\*\\*\\/(.*\\/)?\\.\\.($|\\/)/;\n    /**\n     * Tests for a path containing a wildcard character in a directory component of the path.\n     * Matches \\*\\, \\?\\, and \\a*b\\, but not \\a\\ or \\a\\*.\n     *\n     * NOTE: used \\ in place of / above to avoid issues with multiline comments.\n     *\n     * Breakdown:\n     *  \\/          # matches a directory separator.\n     *  [^/]*?      # matches any number of characters excluding directory separators (non-greedy).\n     *  [*?]        # matches either a wildcard character (* or ?)\n     *  [^/]*       # matches any number of characters excluding directory separators (greedy).\n     *  \\/          # matches a directory separator.\n     */\n    var watchRecursivePattern = /\\/[^/]*?[*?][^/]*\\//;\n    /**\n     * Matches the portion of a wildcard path that does not contain wildcards.\n     * Matches \\a of \\a\\*, or \\a\\b\\c of \\a\\b\\c\\?\\d.\n     *\n     * NOTE: used \\ in place of / above to avoid issues with multiline comments.\n     *\n     * Breakdown:\n     *  ^                   # matches the beginning of the string\n     *  [^*?]*              # matches any number of non-wildcard characters\n     *  (?=\\/[^/]*[*?])     # lookahead that matches a directory separator followed by\n     *                      # a path component that contains at least one wildcard character (* or ?).\n     */\n    var wildcardDirectoryPattern = /^[^*?]*(?=\\/[^/]*[*?])/;\n    /**\n     * Expands an array of file specifications.\n     *\n     * @param fileNames The literal file names to include.\n     * @param include The wildcard file specifications to include.\n     * @param exclude The wildcard file specifications to exclude.\n     * @param basePath The base path for any relative file specifications.\n     * @param options Compiler options.\n     * @param host The host used to resolve files and directories.\n     * @param errors An array for diagnostic reporting.\n     */\n    function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) {\n        basePath = ts.normalizePath(basePath);\n        // The exclude spec list is converted into a regular expression, which allows us to quickly\n        // test whether a file or directory should be excluded before recursively traversing the\n        // file system.\n        var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper;\n        // Literal file names (provided via the \"files\" array in tsconfig.json) are stored in a\n        // file map with a possibly case insensitive key. We use this map later when when including\n        // wildcard paths.\n        var literalFileMap = ts.createMap();\n        // Wildcard paths (provided via the \"includes\" array in tsconfig.json) are stored in a\n        // file map with a possibly case insensitive key. We use this map to store paths matched\n        // via wildcard, and to handle extension priority.\n        var wildcardFileMap = ts.createMap();\n        if (include) {\n            include = validateSpecs(include, errors, /*allowTrailingRecursion*/ false);\n        }\n        if (exclude) {\n            exclude = validateSpecs(exclude, errors, /*allowTrailingRecursion*/ true);\n        }\n        // Wildcard directories (provided as part of a wildcard path) are stored in a\n        // file map that marks whether it was a regular wildcard match (with a `*` or `?` token),\n        // or a recursive directory. This information is used by filesystem watchers to monitor for\n        // new entries in these paths.\n        var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames);\n        // Rather than requery this for each file and filespec, we query the supported extensions\n        // once and store it on the expansion context.\n        var supportedExtensions = ts.getSupportedExtensions(options);\n        // Literal files are always included verbatim. An \"include\" or \"exclude\" specification cannot\n        // remove a literal file.\n        if (fileNames) {\n            for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) {\n                var fileName = fileNames_1[_i];\n                var file = ts.combinePaths(basePath, fileName);\n                literalFileMap[keyMapper(file)] = file;\n            }\n        }\n        if (include && include.length > 0) {\n            for (var _a = 0, _b = host.readDirectory(basePath, supportedExtensions, exclude, include); _a < _b.length; _a++) {\n                var file = _b[_a];\n                // If we have already included a literal or wildcard path with a\n                // higher priority extension, we should skip this file.\n                //\n                // This handles cases where we may encounter both <file>.ts and\n                // <file>.d.ts (or <file>.js if \"allowJs\" is enabled) in the same\n                // directory when they are compilation outputs.\n                if (hasFileWithHigherPriorityExtension(file, literalFileMap, wildcardFileMap, supportedExtensions, keyMapper)) {\n                    continue;\n                }\n                // We may have included a wildcard path with a lower priority\n                // extension due to the user-defined order of entries in the\n                // \"include\" array. If there is a lower priority extension in the\n                // same directory, we should remove it.\n                removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper);\n                var key = keyMapper(file);\n                if (!(key in literalFileMap) && !(key in wildcardFileMap)) {\n                    wildcardFileMap[key] = file;\n                }\n            }\n        }\n        var literalFiles = ts.reduceProperties(literalFileMap, addFileToOutput, []);\n        var wildcardFiles = ts.reduceProperties(wildcardFileMap, addFileToOutput, []);\n        wildcardFiles.sort(host.useCaseSensitiveFileNames ? ts.compareStrings : ts.compareStringsCaseInsensitive);\n        return {\n            fileNames: literalFiles.concat(wildcardFiles),\n            wildcardDirectories: wildcardDirectories\n        };\n    }\n    function validateSpecs(specs, errors, allowTrailingRecursion) {\n        var validSpecs = [];\n        for (var _i = 0, specs_2 = specs; _i < specs_2.length; _i++) {\n            var spec = specs_2[_i];\n            if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec));\n            }\n            else if (invalidMultipleRecursionPatterns.test(spec)) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0, spec));\n            }\n            else if (invalidDotDotAfterRecursiveWildcardPattern.test(spec)) {\n                errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec));\n            }\n            else {\n                validSpecs.push(spec);\n            }\n        }\n        return validSpecs;\n    }\n    /**\n     * Gets directories in a set of include patterns that should be watched for changes.\n     */\n    function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) {\n        // We watch a directory recursively if it contains a wildcard anywhere in a directory segment\n        // of the pattern:\n        //\n        //  /a/b/**/d   - Watch /a/b recursively to catch changes to any d in any subfolder recursively\n        //  /a/b/*/d    - Watch /a/b recursively to catch any d in any immediate subfolder, even if a new subfolder is added\n        //  /a/b        - Watch /a/b recursively to catch changes to anything in any recursive subfoler\n        //\n        // We watch a directory without recursion if it contains a wildcard in the file segment of\n        // the pattern:\n        //\n        //  /a/b/*      - Watch /a/b directly to catch any new file\n        //  /a/b/a?z    - Watch /a/b directly to catch any new file matching a?z\n        var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, \"exclude\");\n        var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? \"\" : \"i\");\n        var wildcardDirectories = ts.createMap();\n        if (include !== undefined) {\n            var recursiveKeys = [];\n            for (var _i = 0, include_1 = include; _i < include_1.length; _i++) {\n                var file = include_1[_i];\n                var spec = ts.normalizePath(ts.combinePaths(path, file));\n                if (excludeRegex && excludeRegex.test(spec)) {\n                    continue;\n                }\n                var match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames);\n                if (match) {\n                    var key = match.key, flags = match.flags;\n                    var existingFlags = wildcardDirectories[key];\n                    if (existingFlags === undefined || existingFlags < flags) {\n                        wildcardDirectories[key] = flags;\n                        if (flags === 1 /* Recursive */) {\n                            recursiveKeys.push(key);\n                        }\n                    }\n                }\n            }\n            // Remove any subpaths under an existing recursively watched directory.\n            for (var key in wildcardDirectories) {\n                for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) {\n                    var recursiveKey = recursiveKeys_1[_a];\n                    if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) {\n                        delete wildcardDirectories[key];\n                    }\n                }\n            }\n        }\n        return wildcardDirectories;\n    }\n    function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames) {\n        var match = wildcardDirectoryPattern.exec(spec);\n        if (match) {\n            return {\n                key: useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase(),\n                flags: watchRecursivePattern.test(spec) ? 1 /* Recursive */ : 0 /* None */\n            };\n        }\n        if (ts.isImplicitGlob(spec)) {\n            return { key: spec, flags: 1 /* Recursive */ };\n        }\n        return undefined;\n    }\n    /**\n     * Determines whether a literal or wildcard file has already been included that has a higher\n     * extension priority.\n     *\n     * @param file The path to the file.\n     * @param extensionPriority The priority of the extension.\n     * @param context The expansion context.\n     */\n    function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) {\n        var extensionPriority = ts.getExtensionPriority(file, extensions);\n        var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority);\n        for (var i = 0 /* Highest */; i < adjustedExtensionPriority; i++) {\n            var higherPriorityExtension = extensions[i];\n            var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension));\n            if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) {\n                return true;\n            }\n        }\n        return false;\n    }\n    /**\n     * Removes files included via wildcard expansion with a lower extension priority that have\n     * already been included.\n     *\n     * @param file The path to the file.\n     * @param extensionPriority The priority of the extension.\n     * @param context The expansion context.\n     */\n    function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) {\n        var extensionPriority = ts.getExtensionPriority(file, extensions);\n        var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority);\n        for (var i = nextExtensionPriority; i < extensions.length; i++) {\n            var lowerPriorityExtension = extensions[i];\n            var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension));\n            delete wildcardFiles[lowerPriorityPath];\n        }\n    }\n    /**\n     * Adds a file to an array of files.\n     *\n     * @param output The output array.\n     * @param file The file path.\n     */\n    function addFileToOutput(output, file) {\n        output.push(file);\n        return output;\n    }\n    /**\n     * Gets a case sensitive key.\n     *\n     * @param key The original key.\n     */\n    function caseSensitiveKeyMapper(key) {\n        return key;\n    }\n    /**\n     * Gets a case insensitive key.\n     *\n     * @param key The original key.\n     */\n    function caseInsensitiveKeyMapper(key) {\n        return key.toLowerCase();\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    var ScriptSnapshot;\n    (function (ScriptSnapshot) {\n        var StringScriptSnapshot = (function () {\n            function StringScriptSnapshot(text) {\n                this.text = text;\n            }\n            StringScriptSnapshot.prototype.getText = function (start, end) {\n                return this.text.substring(start, end);\n            };\n            StringScriptSnapshot.prototype.getLength = function () {\n                return this.text.length;\n            };\n            StringScriptSnapshot.prototype.getChangeRange = function () {\n                // Text-based snapshots do not support incremental parsing. Return undefined\n                // to signal that to the caller.\n                return undefined;\n            };\n            return StringScriptSnapshot;\n        }());\n        function fromString(text) {\n            return new StringScriptSnapshot(text);\n        }\n        ScriptSnapshot.fromString = fromString;\n    })(ScriptSnapshot = ts.ScriptSnapshot || (ts.ScriptSnapshot = {}));\n    var TextChange = (function () {\n        function TextChange() {\n        }\n        return TextChange;\n    }());\n    ts.TextChange = TextChange;\n    var HighlightSpanKind;\n    (function (HighlightSpanKind) {\n        HighlightSpanKind.none = \"none\";\n        HighlightSpanKind.definition = \"definition\";\n        HighlightSpanKind.reference = \"reference\";\n        HighlightSpanKind.writtenReference = \"writtenReference\";\n    })(HighlightSpanKind = ts.HighlightSpanKind || (ts.HighlightSpanKind = {}));\n    var IndentStyle;\n    (function (IndentStyle) {\n        IndentStyle[IndentStyle[\"None\"] = 0] = \"None\";\n        IndentStyle[IndentStyle[\"Block\"] = 1] = \"Block\";\n        IndentStyle[IndentStyle[\"Smart\"] = 2] = \"Smart\";\n    })(IndentStyle = ts.IndentStyle || (ts.IndentStyle = {}));\n    var SymbolDisplayPartKind;\n    (function (SymbolDisplayPartKind) {\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"aliasName\"] = 0] = \"aliasName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"className\"] = 1] = \"className\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"enumName\"] = 2] = \"enumName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"fieldName\"] = 3] = \"fieldName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"interfaceName\"] = 4] = \"interfaceName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"keyword\"] = 5] = \"keyword\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"lineBreak\"] = 6] = \"lineBreak\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"numericLiteral\"] = 7] = \"numericLiteral\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"stringLiteral\"] = 8] = \"stringLiteral\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"localName\"] = 9] = \"localName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"methodName\"] = 10] = \"methodName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"moduleName\"] = 11] = \"moduleName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"operator\"] = 12] = \"operator\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"parameterName\"] = 13] = \"parameterName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"propertyName\"] = 14] = \"propertyName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"punctuation\"] = 15] = \"punctuation\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"space\"] = 16] = \"space\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"text\"] = 17] = \"text\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"typeParameterName\"] = 18] = \"typeParameterName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"enumMemberName\"] = 19] = \"enumMemberName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"functionName\"] = 20] = \"functionName\";\n        SymbolDisplayPartKind[SymbolDisplayPartKind[\"regularExpressionLiteral\"] = 21] = \"regularExpressionLiteral\";\n    })(SymbolDisplayPartKind = ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {}));\n    var OutputFileType;\n    (function (OutputFileType) {\n        OutputFileType[OutputFileType[\"JavaScript\"] = 0] = \"JavaScript\";\n        OutputFileType[OutputFileType[\"SourceMap\"] = 1] = \"SourceMap\";\n        OutputFileType[OutputFileType[\"Declaration\"] = 2] = \"Declaration\";\n    })(OutputFileType = ts.OutputFileType || (ts.OutputFileType = {}));\n    var EndOfLineState;\n    (function (EndOfLineState) {\n        EndOfLineState[EndOfLineState[\"None\"] = 0] = \"None\";\n        EndOfLineState[EndOfLineState[\"InMultiLineCommentTrivia\"] = 1] = \"InMultiLineCommentTrivia\";\n        EndOfLineState[EndOfLineState[\"InSingleQuoteStringLiteral\"] = 2] = \"InSingleQuoteStringLiteral\";\n        EndOfLineState[EndOfLineState[\"InDoubleQuoteStringLiteral\"] = 3] = \"InDoubleQuoteStringLiteral\";\n        EndOfLineState[EndOfLineState[\"InTemplateHeadOrNoSubstitutionTemplate\"] = 4] = \"InTemplateHeadOrNoSubstitutionTemplate\";\n        EndOfLineState[EndOfLineState[\"InTemplateMiddleOrTail\"] = 5] = \"InTemplateMiddleOrTail\";\n        EndOfLineState[EndOfLineState[\"InTemplateSubstitutionPosition\"] = 6] = \"InTemplateSubstitutionPosition\";\n    })(EndOfLineState = ts.EndOfLineState || (ts.EndOfLineState = {}));\n    var TokenClass;\n    (function (TokenClass) {\n        TokenClass[TokenClass[\"Punctuation\"] = 0] = \"Punctuation\";\n        TokenClass[TokenClass[\"Keyword\"] = 1] = \"Keyword\";\n        TokenClass[TokenClass[\"Operator\"] = 2] = \"Operator\";\n        TokenClass[TokenClass[\"Comment\"] = 3] = \"Comment\";\n        TokenClass[TokenClass[\"Whitespace\"] = 4] = \"Whitespace\";\n        TokenClass[TokenClass[\"Identifier\"] = 5] = \"Identifier\";\n        TokenClass[TokenClass[\"NumberLiteral\"] = 6] = \"NumberLiteral\";\n        TokenClass[TokenClass[\"StringLiteral\"] = 7] = \"StringLiteral\";\n        TokenClass[TokenClass[\"RegExpLiteral\"] = 8] = \"RegExpLiteral\";\n    })(TokenClass = ts.TokenClass || (ts.TokenClass = {}));\n    // TODO: move these to enums\n    var ScriptElementKind;\n    (function (ScriptElementKind) {\n        ScriptElementKind.unknown = \"\";\n        ScriptElementKind.warning = \"warning\";\n        /** predefined type (void) or keyword (class) */\n        ScriptElementKind.keyword = \"keyword\";\n        /** top level script node */\n        ScriptElementKind.scriptElement = \"script\";\n        /** module foo {} */\n        ScriptElementKind.moduleElement = \"module\";\n        /** class X {} */\n        ScriptElementKind.classElement = \"class\";\n        /** var x = class X {} */\n        ScriptElementKind.localClassElement = \"local class\";\n        /** interface Y {} */\n        ScriptElementKind.interfaceElement = \"interface\";\n        /** type T = ... */\n        ScriptElementKind.typeElement = \"type\";\n        /** enum E */\n        ScriptElementKind.enumElement = \"enum\";\n        // TODO: GH#9983\n        ScriptElementKind.enumMemberElement = \"const\";\n        /**\n         * Inside module and script only\n         * const v = ..\n         */\n        ScriptElementKind.variableElement = \"var\";\n        /** Inside function */\n        ScriptElementKind.localVariableElement = \"local var\";\n        /**\n         * Inside module and script only\n         * function f() { }\n         */\n        ScriptElementKind.functionElement = \"function\";\n        /** Inside function */\n        ScriptElementKind.localFunctionElement = \"local function\";\n        /** class X { [public|private]* foo() {} } */\n        ScriptElementKind.memberFunctionElement = \"method\";\n        /** class X { [public|private]* [get|set] foo:number; } */\n        ScriptElementKind.memberGetAccessorElement = \"getter\";\n        ScriptElementKind.memberSetAccessorElement = \"setter\";\n        /**\n         * class X { [public|private]* foo:number; }\n         * interface Y { foo:number; }\n         */\n        ScriptElementKind.memberVariableElement = \"property\";\n        /** class X { constructor() { } } */\n        ScriptElementKind.constructorImplementationElement = \"constructor\";\n        /** interface Y { ():number; } */\n        ScriptElementKind.callSignatureElement = \"call\";\n        /** interface Y { []:number; } */\n        ScriptElementKind.indexSignatureElement = \"index\";\n        /** interface Y { new():Y; } */\n        ScriptElementKind.constructSignatureElement = \"construct\";\n        /** function foo(*Y*: string) */\n        ScriptElementKind.parameterElement = \"parameter\";\n        ScriptElementKind.typeParameterElement = \"type parameter\";\n        ScriptElementKind.primitiveType = \"primitive type\";\n        ScriptElementKind.label = \"label\";\n        ScriptElementKind.alias = \"alias\";\n        ScriptElementKind.constElement = \"const\";\n        ScriptElementKind.letElement = \"let\";\n        ScriptElementKind.directory = \"directory\";\n        ScriptElementKind.externalModuleName = \"external module name\";\n    })(ScriptElementKind = ts.ScriptElementKind || (ts.ScriptElementKind = {}));\n    var ScriptElementKindModifier;\n    (function (ScriptElementKindModifier) {\n        ScriptElementKindModifier.none = \"\";\n        ScriptElementKindModifier.publicMemberModifier = \"public\";\n        ScriptElementKindModifier.privateMemberModifier = \"private\";\n        ScriptElementKindModifier.protectedMemberModifier = \"protected\";\n        ScriptElementKindModifier.exportedModifier = \"export\";\n        ScriptElementKindModifier.ambientModifier = \"declare\";\n        ScriptElementKindModifier.staticModifier = \"static\";\n        ScriptElementKindModifier.abstractModifier = \"abstract\";\n    })(ScriptElementKindModifier = ts.ScriptElementKindModifier || (ts.ScriptElementKindModifier = {}));\n    var ClassificationTypeNames = (function () {\n        function ClassificationTypeNames() {\n        }\n        return ClassificationTypeNames;\n    }());\n    ClassificationTypeNames.comment = \"comment\";\n    ClassificationTypeNames.identifier = \"identifier\";\n    ClassificationTypeNames.keyword = \"keyword\";\n    ClassificationTypeNames.numericLiteral = \"number\";\n    ClassificationTypeNames.operator = \"operator\";\n    ClassificationTypeNames.stringLiteral = \"string\";\n    ClassificationTypeNames.whiteSpace = \"whitespace\";\n    ClassificationTypeNames.text = \"text\";\n    ClassificationTypeNames.punctuation = \"punctuation\";\n    ClassificationTypeNames.className = \"class name\";\n    ClassificationTypeNames.enumName = \"enum name\";\n    ClassificationTypeNames.interfaceName = \"interface name\";\n    ClassificationTypeNames.moduleName = \"module name\";\n    ClassificationTypeNames.typeParameterName = \"type parameter name\";\n    ClassificationTypeNames.typeAliasName = \"type alias name\";\n    ClassificationTypeNames.parameterName = \"parameter name\";\n    ClassificationTypeNames.docCommentTagName = \"doc comment tag name\";\n    ClassificationTypeNames.jsxOpenTagName = \"jsx open tag name\";\n    ClassificationTypeNames.jsxCloseTagName = \"jsx close tag name\";\n    ClassificationTypeNames.jsxSelfClosingTagName = \"jsx self closing tag name\";\n    ClassificationTypeNames.jsxAttribute = \"jsx attribute\";\n    ClassificationTypeNames.jsxText = \"jsx text\";\n    ClassificationTypeNames.jsxAttributeStringLiteralValue = \"jsx attribute string literal value\";\n    ts.ClassificationTypeNames = ClassificationTypeNames;\n    var ClassificationType;\n    (function (ClassificationType) {\n        ClassificationType[ClassificationType[\"comment\"] = 1] = \"comment\";\n        ClassificationType[ClassificationType[\"identifier\"] = 2] = \"identifier\";\n        ClassificationType[ClassificationType[\"keyword\"] = 3] = \"keyword\";\n        ClassificationType[ClassificationType[\"numericLiteral\"] = 4] = \"numericLiteral\";\n        ClassificationType[ClassificationType[\"operator\"] = 5] = \"operator\";\n        ClassificationType[ClassificationType[\"stringLiteral\"] = 6] = \"stringLiteral\";\n        ClassificationType[ClassificationType[\"regularExpressionLiteral\"] = 7] = \"regularExpressionLiteral\";\n        ClassificationType[ClassificationType[\"whiteSpace\"] = 8] = \"whiteSpace\";\n        ClassificationType[ClassificationType[\"text\"] = 9] = \"text\";\n        ClassificationType[ClassificationType[\"punctuation\"] = 10] = \"punctuation\";\n        ClassificationType[ClassificationType[\"className\"] = 11] = \"className\";\n        ClassificationType[ClassificationType[\"enumName\"] = 12] = \"enumName\";\n        ClassificationType[ClassificationType[\"interfaceName\"] = 13] = \"interfaceName\";\n        ClassificationType[ClassificationType[\"moduleName\"] = 14] = \"moduleName\";\n        ClassificationType[ClassificationType[\"typeParameterName\"] = 15] = \"typeParameterName\";\n        ClassificationType[ClassificationType[\"typeAliasName\"] = 16] = \"typeAliasName\";\n        ClassificationType[ClassificationType[\"parameterName\"] = 17] = \"parameterName\";\n        ClassificationType[ClassificationType[\"docCommentTagName\"] = 18] = \"docCommentTagName\";\n        ClassificationType[ClassificationType[\"jsxOpenTagName\"] = 19] = \"jsxOpenTagName\";\n        ClassificationType[ClassificationType[\"jsxCloseTagName\"] = 20] = \"jsxCloseTagName\";\n        ClassificationType[ClassificationType[\"jsxSelfClosingTagName\"] = 21] = \"jsxSelfClosingTagName\";\n        ClassificationType[ClassificationType[\"jsxAttribute\"] = 22] = \"jsxAttribute\";\n        ClassificationType[ClassificationType[\"jsxText\"] = 23] = \"jsxText\";\n        ClassificationType[ClassificationType[\"jsxAttributeStringLiteralValue\"] = 24] = \"jsxAttributeStringLiteralValue\";\n    })(ClassificationType = ts.ClassificationType || (ts.ClassificationType = {}));\n})(ts || (ts = {}));\n// These utilities are common to multiple language service features.\n/* @internal */\nvar ts;\n(function (ts) {\n    ts.scanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ true);\n    ts.emptyArray = [];\n    var SemanticMeaning;\n    (function (SemanticMeaning) {\n        SemanticMeaning[SemanticMeaning[\"None\"] = 0] = \"None\";\n        SemanticMeaning[SemanticMeaning[\"Value\"] = 1] = \"Value\";\n        SemanticMeaning[SemanticMeaning[\"Type\"] = 2] = \"Type\";\n        SemanticMeaning[SemanticMeaning[\"Namespace\"] = 4] = \"Namespace\";\n        SemanticMeaning[SemanticMeaning[\"All\"] = 7] = \"All\";\n    })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {}));\n    function getMeaningFromDeclaration(node) {\n        switch (node.kind) {\n            case 144 /* Parameter */:\n            case 223 /* VariableDeclaration */:\n            case 174 /* BindingElement */:\n            case 147 /* PropertyDeclaration */:\n            case 146 /* PropertySignature */:\n            case 257 /* PropertyAssignment */:\n            case 258 /* ShorthandPropertyAssignment */:\n            case 260 /* EnumMember */:\n            case 149 /* MethodDeclaration */:\n            case 148 /* MethodSignature */:\n            case 150 /* Constructor */:\n            case 151 /* GetAccessor */:\n            case 152 /* SetAccessor */:\n            case 225 /* FunctionDeclaration */:\n            case 184 /* FunctionExpression */:\n            case 185 /* ArrowFunction */:\n            case 256 /* CatchClause */:\n                return 1 /* Value */;\n            case 143 /* TypeParameter */:\n            case 227 /* InterfaceDeclaration */:\n            case 228 /* TypeAliasDeclaration */:\n            case 161 /* TypeLiteral */:\n                return 2 /* Type */;\n            case 226 /* ClassDeclaration */:\n            case 229 /* EnumDeclaration */:\n                return 1 /* Value */ | 2 /* Type */;\n            case 230 /* ModuleDeclaration */:\n                if (ts.isAmbientModule(node)) {\n                    return 4 /* Namespace */ | 1 /* Value */;\n                }\n                else if (ts.getModuleInstanceState(node) === 1 /* Instantiated */) {\n                    return 4 /* Namespace */ | 1 /* Value */;\n                }\n                else {\n                    return 4 /* Namespace */;\n                }\n            case 238 /* NamedImports */:\n            case 239 /* ImportSpecifier */:\n            case 234 /* ImportEqualsDeclaration */:\n            case 235 /* ImportDeclaration */:\n            case 240 /* ExportAssignment */:\n            case 241 /* ExportDeclaration */:\n                return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */;\n            // An external module can be a Value\n            case 261 /* SourceFile */:\n                return 4 /* Namespace */ | 1 /* Value */;\n        }\n        return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */;\n    }\n    ts.getMeaningFromDeclaration = getMeaningFromDeclaration;\n    function getMeaningFromLocation(node) {\n        if (node.parent.kind === 240 /* ExportAssignment */) {\n            return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */;\n        }\n        else if (isInRightSideOfImport(node)) {\n            return getMeaningFromRightHandSideOfImportEquals(node);\n        }\n        else if (ts.isDeclarationName(node)) {\n            return getMeaningFromDeclaration(node.parent);\n        }\n        else if (isTypeReference(node)) {\n            return 2 /* Type */;\n        }\n        else if (isNamespaceReference(node)) {\n            return 4 /* Namespace */;\n        }\n        else {\n            return 1 /* Value */;\n        }\n    }\n    ts.getMeaningFromLocation = getMeaningFromLocation;\n    function getMeaningFromRightHandSideOfImportEquals(node) {\n        ts.Debug.assert(node.kind === 70 /* Identifier */);\n        //     import a = |b|; // Namespace\n        //     import a = |b.c|; // Value, type, namespace\n        //     import a = |b.c|.d; // Namespace\n        if (node.parent.kind === 141 /* QualifiedName */ &&\n            node.parent.right === node &&\n            node.parent.parent.kind === 234 /* ImportEqualsDeclaration */) {\n            return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */;\n        }\n        return 4 /* Namespace */;\n    }\n    function isInRightSideOfImport(node) {\n        while (node.parent.kind === 141 /* QualifiedName */) {\n            node = node.parent;\n        }\n        return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node;\n    }\n    function isNamespaceReference(node) {\n        return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node);\n    }\n    function isQualifiedNameNamespaceReference(node) {\n        var root = node;\n        var isLastClause = true;\n        if (root.parent.kind === 141 /* QualifiedName */) {\n            while (root.parent && root.parent.kind === 141 /* QualifiedName */) {\n                root = root.parent;\n            }\n            isLastClause = root.right === node;\n        }\n        return root.parent.kind === 157 /* TypeReference */ && !isLastClause;\n    }\n    function isPropertyAccessNamespaceReference(node) {\n        var root = node;\n        var isLastClause = true;\n        if (root.parent.kind === 177 /* PropertyAccessExpression */) {\n            while (root.parent && root.parent.kind === 177 /* PropertyAccessExpression */) {\n                root = root.parent;\n            }\n            isLastClause = root.name === node;\n        }\n        if (!isLastClause && root.parent.kind === 199 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 255 /* HeritageClause */) {\n            var decl = root.parent.parent.parent;\n            return (decl.kind === 226 /* ClassDeclaration */ && root.parent.parent.token === 107 /* ImplementsKeyword */) ||\n                (decl.kind === 227 /* InterfaceDeclaration */ && root.parent.parent.token === 84 /* ExtendsKeyword */);\n        }\n        return false;\n    }\n    function isTypeReference(node) {\n        if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) {\n            node = node.parent;\n        }\n        return node.parent.kind === 157 /* TypeReference */ ||\n            (node.parent.kind === 199 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) ||\n            (node.kind === 98 /* ThisKeyword */ && !ts.isPartOfExpression(node)) ||\n            node.kind === 167 /* ThisType */;\n    }\n    function isCallExpressionTarget(node) {\n        return isCallOrNewExpressionTarget(node, 179 /* CallExpression */);\n    }\n    ts.isCallExpressionTarget = isCallExpressionTarget;\n    function isNewExpressionTarget(node) {\n        return isCallOrNewExpressionTarget(node, 180 /* NewExpression */);\n    }\n    ts.isNewExpressionTarget = isNewExpressionTarget;\n    function isCallOrNewExpressionTarget(node, kind) {\n        var target = climbPastPropertyAccess(node);\n        return target && target.parent && target.parent.kind === kind && target.parent.expression === target;\n    }\n    function climbPastPropertyAccess(node) {\n        return isRightSideOfPropertyAccess(node) ? node.parent : node;\n    }\n    ts.climbPastPropertyAccess = climbPastPropertyAccess;\n    function getTargetLabel(referenceNode, labelName) {\n        while (referenceNode) {\n            if (referenceNode.kind === 219 /* LabeledStatement */ && referenceNode.label.text === labelName) {\n                return referenceNode.label;\n            }\n            referenceNode = referenceNode.parent;\n        }\n        return undefined;\n    }\n    ts.getTargetLabel = getTargetLabel;\n    function isJumpStatementTarget(node) {\n        return node.kind === 70 /* Identifier */ &&\n            (node.parent.kind === 215 /* BreakStatement */ || node.parent.kind === 214 /* ContinueStatement */) &&\n            node.parent.label === node;\n    }\n    ts.isJumpStatementTarget = isJumpStatementTarget;\n    function isLabelOfLabeledStatement(node) {\n        return node.kind === 70 /* Identifier */ &&\n            node.parent.kind === 219 /* LabeledStatement */ &&\n            node.parent.label === node;\n    }\n    function isLabelName(node) {\n        return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node);\n    }\n    ts.isLabelName = isLabelName;\n    function isRightSideOfQualifiedName(node) {\n        return node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node;\n    }\n    ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName;\n    function isRightSideOfPropertyAccess(node) {\n        return node && node.parent && node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node;\n    }\n    ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess;\n    function isNameOfModuleDeclaration(node) {\n        return node.parent.kind === 230 /* ModuleDeclaration */ && node.parent.name === node;\n    }\n    ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration;\n    function isNameOfFunctionDeclaration(node) {\n        return node.kind === 70 /* Identifier */ &&\n            ts.isFunctionLike(node.parent) && node.parent.name === node;\n    }\n    ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration;\n    function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) {\n        if (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) {\n            switch (node.parent.kind) {\n                case 147 /* PropertyDeclaration */:\n                case 146 /* PropertySignature */:\n                case 257 /* PropertyAssignment */:\n                case 260 /* EnumMember */:\n                case 149 /* MethodDeclaration */:\n                case 148 /* MethodSignature */:\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                case 230 /* ModuleDeclaration */:\n                    return node.parent.name === node;\n                case 178 /* ElementAccessExpression */:\n                    return node.parent.argumentExpression === node;\n                case 142 /* ComputedPropertyName */:\n                    return true;\n            }\n        }\n        return false;\n    }\n    ts.isLiteralNameOfPropertyDeclarationOrIndexAccess = isLiteralNameOfPropertyDeclarationOrIndexAccess;\n    function isExpressionOfExternalModuleImportEqualsDeclaration(node) {\n        return ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) &&\n            ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node;\n    }\n    ts.isExpressionOfExternalModuleImportEqualsDeclaration = isExpressionOfExternalModuleImportEqualsDeclaration;\n    /** Returns true if the position is within a comment */\n    function isInsideComment(sourceFile, token, position) {\n        // The position has to be: 1. in the leading trivia (before token.getStart()), and 2. within a comment\n        return position <= token.getStart(sourceFile) &&\n            (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) ||\n                isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart())));\n        function isInsideCommentRange(comments) {\n            return ts.forEach(comments, function (comment) {\n                // either we are 1. completely inside the comment, or 2. at the end of the comment\n                if (comment.pos < position && position < comment.end) {\n                    return true;\n                }\n                else if (position === comment.end) {\n                    var text = sourceFile.text;\n                    var width = comment.end - comment.pos;\n                    // is single line comment or just /*\n                    if (width <= 2 || text.charCodeAt(comment.pos + 1) === 47 /* slash */) {\n                        return true;\n                    }\n                    else {\n                        // is unterminated multi-line comment\n                        return !(text.charCodeAt(comment.end - 1) === 47 /* slash */ &&\n                            text.charCodeAt(comment.end - 2) === 42 /* asterisk */);\n                    }\n                }\n                return false;\n            });\n        }\n    }\n    ts.isInsideComment = isInsideComment;\n    function getContainerNode(node) {\n        while (true) {\n            node = node.parent;\n            if (!node) {\n                return undefined;\n            }\n            switch (node.kind) {\n                case 261 /* SourceFile */:\n                case 149 /* MethodDeclaration */:\n                case 148 /* MethodSignature */:\n                case 225 /* FunctionDeclaration */:\n                case 184 /* FunctionExpression */:\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                case 226 /* ClassDeclaration */:\n                case 227 /* InterfaceDeclaration */:\n                case 229 /* EnumDeclaration */:\n                case 230 /* ModuleDeclaration */:\n                    return node;\n            }\n        }\n    }\n    ts.getContainerNode = getContainerNode;\n    function getNodeKind(node) {\n        switch (node.kind) {\n            case 261 /* SourceFile */:\n                return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement;\n            case 230 /* ModuleDeclaration */:\n                return ts.ScriptElementKind.moduleElement;\n            case 226 /* ClassDeclaration */:\n            case 197 /* ClassExpression */:\n                return ts.ScriptElementKind.classElement;\n            case 227 /* InterfaceDeclaration */: return ts.ScriptElementKind.interfaceElement;\n            case 228 /* TypeAliasDeclaration */: return ts.ScriptElementKind.typeElement;\n            case 229 /* EnumDeclaration */: return ts.ScriptElementKind.enumElement;\n            case 223 /* VariableDeclaration */:\n                return getKindOfVariableDeclaration(node);\n            case 174 /* BindingElement */:\n                return getKindOfVariableDeclaration(ts.getRootDeclaration(node));\n            case 185 /* ArrowFunction */:\n            case 225 /* FunctionDeclaration */:\n            case 184 /* FunctionExpression */:\n                return ts.ScriptElementKind.functionElement;\n            case 151 /* GetAccessor */: return ts.ScriptElementKind.memberGetAccessorElement;\n            case 152 /* SetAccessor */: return ts.ScriptElementKind.memberSetAccessorElement;\n            case 149 /* MethodDeclaration */:\n            case 148 /* MethodSignature */:\n                return ts.ScriptElementKind.memberFunctionElement;\n            case 147 /* PropertyDeclaration */:\n            case 146 /* PropertySignature */:\n                return ts.ScriptElementKind.memberVariableElement;\n            case 155 /* IndexSignature */: return ts.ScriptElementKind.indexSignatureElement;\n            case 154 /* ConstructSignature */: return ts.ScriptElementKind.constructSignatureElement;\n            case 153 /* CallSignature */: return ts.ScriptElementKind.callSignatureElement;\n            case 150 /* Constructor */: return ts.ScriptElementKind.constructorImplementationElement;\n            case 143 /* TypeParameter */: return ts.ScriptElementKind.typeParameterElement;\n            case 260 /* EnumMember */: return ts.ScriptElementKind.enumMemberElement;\n            case 144 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement;\n            case 234 /* ImportEqualsDeclaration */:\n            case 239 /* ImportSpecifier */:\n            case 236 /* ImportClause */:\n            case 243 /* ExportSpecifier */:\n            case 237 /* NamespaceImport */:\n                return ts.ScriptElementKind.alias;\n            case 285 /* JSDocTypedefTag */:\n                return ts.ScriptElementKind.typeElement;\n            default:\n                return ts.ScriptElementKind.unknown;\n        }\n        function getKindOfVariableDeclaration(v) {\n            return ts.isConst(v)\n                ? ts.ScriptElementKind.constElement\n                : ts.isLet(v)\n                    ? ts.ScriptElementKind.letElement\n                    : ts.ScriptElementKind.variableElement;\n        }\n    }\n    ts.getNodeKind = getNodeKind;\n    function getStringLiteralTypeForNode(node, typeChecker) {\n        var searchNode = node.parent.kind === 171 /* LiteralType */ ? node.parent : node;\n        var type = typeChecker.getTypeAtLocation(searchNode);\n        if (type && type.flags & 32 /* StringLiteral */) {\n            return type;\n        }\n        return undefined;\n    }\n    ts.getStringLiteralTypeForNode = getStringLiteralTypeForNode;\n    function isThis(node) {\n        switch (node.kind) {\n            case 98 /* ThisKeyword */:\n                // case SyntaxKind.ThisType: TODO: GH#9267\n                return true;\n            case 70 /* Identifier */:\n                // 'this' as a parameter\n                return ts.identifierIsThisKeyword(node) && node.parent.kind === 144 /* Parameter */;\n            default:\n                return false;\n        }\n    }\n    ts.isThis = isThis;\n    // Matches the beginning of a triple slash directive\n    var tripleSlashDirectivePrefixRegex = /^\\/\\/\\/\\s*</;\n    function getLineStartPositionForPosition(position, sourceFile) {\n        var lineStarts = sourceFile.getLineStarts();\n        var line = sourceFile.getLineAndCharacterOfPosition(position).line;\n        return lineStarts[line];\n    }\n    ts.getLineStartPositionForPosition = getLineStartPositionForPosition;\n    function rangeContainsRange(r1, r2) {\n        return startEndContainsRange(r1.pos, r1.end, r2);\n    }\n    ts.rangeContainsRange = rangeContainsRange;\n    function startEndContainsRange(start, end, range) {\n        return start <= range.pos && end >= range.end;\n    }\n    ts.startEndContainsRange = startEndContainsRange;\n    function rangeContainsStartEnd(range, start, end) {\n        return range.pos <= start && range.end >= end;\n    }\n    ts.rangeContainsStartEnd = rangeContainsStartEnd;\n    function rangeOverlapsWithStartEnd(r1, start, end) {\n        return startEndOverlapsWithStartEnd(r1.pos, r1.end, start, end);\n    }\n    ts.rangeOverlapsWithStartEnd = rangeOverlapsWithStartEnd;\n    function startEndOverlapsWithStartEnd(start1, end1, start2, end2) {\n        var start = Math.max(start1, start2);\n        var end = Math.min(end1, end2);\n        return start < end;\n    }\n    ts.startEndOverlapsWithStartEnd = startEndOverlapsWithStartEnd;\n    function positionBelongsToNode(candidate, position, sourceFile) {\n        return candidate.end > position || !isCompletedNode(candidate, sourceFile);\n    }\n    ts.positionBelongsToNode = positionBelongsToNode;\n    function isCompletedNode(n, sourceFile) {\n        if (ts.nodeIsMissing(n)) {\n            return false;\n        }\n        switch (n.kind) {\n            case 226 /* ClassDeclaration */:\n            case 227 /* InterfaceDeclaration */:\n            case 229 /* EnumDeclaration */:\n            case 176 /* ObjectLiteralExpression */:\n            case 172 /* ObjectBindingPattern */:\n            case 161 /* TypeLiteral */:\n            case 204 /* Block */:\n            case 231 /* ModuleBlock */:\n            case 232 /* CaseBlock */:\n            case 238 /* NamedImports */:\n            case 242 /* NamedExports */:\n                return nodeEndsWith(n, 17 /* CloseBraceToken */, sourceFile);\n            case 256 /* CatchClause */:\n                return isCompletedNode(n.block, sourceFile);\n            case 180 /* NewExpression */:\n                if (!n.arguments) {\n                    return true;\n                }\n            // fall through\n            case 179 /* CallExpression */:\n            case 183 /* ParenthesizedExpression */:\n            case 166 /* ParenthesizedType */:\n                return nodeEndsWith(n, 19 /* CloseParenToken */, sourceFile);\n            case 158 /* FunctionType */:\n            case 159 /* ConstructorType */:\n                return isCompletedNode(n.type, sourceFile);\n            case 150 /* Constructor */:\n            case 151 /* GetAccessor */:\n            case 152 /* SetAccessor */:\n            case 225 /* FunctionDeclaration */:\n            case 184 /* FunctionExpression */:\n            case 149 /* MethodDeclaration */:\n            case 148 /* MethodSignature */:\n            case 154 /* ConstructSignature */:\n            case 153 /* CallSignature */:\n            case 185 /* ArrowFunction */:\n                if (n.body) {\n                    return isCompletedNode(n.body, sourceFile);\n                }\n                if (n.type) {\n                    return isCompletedNode(n.type, sourceFile);\n                }\n                // Even though type parameters can be unclosed, we can get away with\n                // having at least a closing paren.\n                return hasChildOfKind(n, 19 /* CloseParenToken */, sourceFile);\n            case 230 /* ModuleDeclaration */:\n                return n.body && isCompletedNode(n.body, sourceFile);\n            case 208 /* IfStatement */:\n                if (n.elseStatement) {\n                    return isCompletedNode(n.elseStatement, sourceFile);\n                }\n                return isCompletedNode(n.thenStatement, sourceFile);\n            case 207 /* ExpressionStatement */:\n                return isCompletedNode(n.expression, sourceFile) ||\n                    hasChildOfKind(n, 24 /* SemicolonToken */);\n            case 175 /* ArrayLiteralExpression */:\n            case 173 /* ArrayBindingPattern */:\n            case 178 /* ElementAccessExpression */:\n            case 142 /* ComputedPropertyName */:\n            case 163 /* TupleType */:\n                return nodeEndsWith(n, 21 /* CloseBracketToken */, sourceFile);\n            case 155 /* IndexSignature */:\n                if (n.type) {\n                    return isCompletedNode(n.type, sourceFile);\n                }\n                return hasChildOfKind(n, 21 /* CloseBracketToken */, sourceFile);\n            case 253 /* CaseClause */:\n            case 254 /* DefaultClause */:\n                // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed\n                return false;\n            case 211 /* ForStatement */:\n            case 212 /* ForInStatement */:\n            case 213 /* ForOfStatement */:\n            case 210 /* WhileStatement */:\n                return isCompletedNode(n.statement, sourceFile);\n            case 209 /* DoStatement */:\n                // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')';\n                var hasWhileKeyword = findChildOfKind(n, 105 /* WhileKeyword */, sourceFile);\n                if (hasWhileKeyword) {\n                    return nodeEndsWith(n, 19 /* CloseParenToken */, sourceFile);\n                }\n                return isCompletedNode(n.statement, sourceFile);\n            case 160 /* TypeQuery */:\n                return isCompletedNode(n.exprName, sourceFile);\n            case 187 /* TypeOfExpression */:\n            case 186 /* DeleteExpression */:\n            case 188 /* VoidExpression */:\n            case 195 /* YieldExpression */:\n            case 196 /* SpreadElement */:\n                var unaryWordExpression = n;\n                return isCompletedNode(unaryWordExpression.expression, sourceFile);\n            case 181 /* TaggedTemplateExpression */:\n                return isCompletedNode(n.template, sourceFile);\n            case 194 /* TemplateExpression */:\n                var lastSpan = ts.lastOrUndefined(n.templateSpans);\n                return isCompletedNode(lastSpan, sourceFile);\n            case 202 /* TemplateSpan */:\n                return ts.nodeIsPresent(n.literal);\n            case 241 /* ExportDeclaration */:\n            case 235 /* ImportDeclaration */:\n                return ts.nodeIsPresent(n.moduleSpecifier);\n            case 190 /* PrefixUnaryExpression */:\n                return isCompletedNode(n.operand, sourceFile);\n            case 192 /* BinaryExpression */:\n                return isCompletedNode(n.right, sourceFile);\n            case 193 /* ConditionalExpression */:\n                return isCompletedNode(n.whenFalse, sourceFile);\n            default:\n                return true;\n        }\n    }\n    ts.isCompletedNode = isCompletedNode;\n    /*\n     * Checks if node ends with 'expectedLastToken'.\n     * If child at position 'length - 1' is 'SemicolonToken' it is skipped and 'expectedLastToken' is compared with child at position 'length - 2'.\n     */\n    function nodeEndsWith(n, expectedLastToken, sourceFile) {\n        var children = n.getChildren(sourceFile);\n        if (children.length) {\n            var last = ts.lastOrUndefined(children);\n            if (last.kind === expectedLastToken) {\n                return true;\n            }\n            else if (last.kind === 24 /* SemicolonToken */ && children.length !== 1) {\n                return children[children.length - 2].kind === expectedLastToken;\n            }\n        }\n        return false;\n    }\n    function findListItemInfo(node) {\n        var list = findContainingList(node);\n        // It is possible at this point for syntaxList to be undefined, either if\n        // node.parent had no list child, or if none of its list children contained\n        // the span of node. If this happens, return undefined. The caller should\n        // handle this case.\n        if (!list) {\n            return undefined;\n        }\n        var children = list.getChildren();\n        var listItemIndex = ts.indexOf(children, node);\n        return {\n            listItemIndex: listItemIndex,\n            list: list\n        };\n    }\n    ts.findListItemInfo = findListItemInfo;\n    function hasChildOfKind(n, kind, sourceFile) {\n        return !!findChildOfKind(n, kind, sourceFile);\n    }\n    ts.hasChildOfKind = hasChildOfKind;\n    function findChildOfKind(n, kind, sourceFile) {\n        return ts.forEach(n.getChildren(sourceFile), function (c) { return c.kind === kind && c; });\n    }\n    ts.findChildOfKind = findChildOfKind;\n    function findContainingList(node) {\n        // The node might be a list element (nonsynthetic) or a comma (synthetic). Either way, it will\n        // be parented by the container of the SyntaxList, not the SyntaxList itself.\n        // In order to find the list item index, we first need to locate SyntaxList itself and then search\n        // for the position of the relevant node (or comma).\n        var syntaxList = ts.forEach(node.parent.getChildren(), function (c) {\n            // find syntax list that covers the span of the node\n            if (c.kind === 292 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) {\n                return c;\n            }\n        });\n        // Either we didn't find an appropriate list, or the list must contain us.\n        ts.Debug.assert(!syntaxList || ts.contains(syntaxList.getChildren(), node));\n        return syntaxList;\n    }\n    ts.findContainingList = findContainingList;\n    /* Gets the token whose text has range [start, end) and\n     * position >= start and (position < end or (position === end && token is keyword or identifier))\n     */\n    function getTouchingWord(sourceFile, position, includeJsDocComment) {\n        if (includeJsDocComment === void 0) { includeJsDocComment = false; }\n        return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }, includeJsDocComment);\n    }\n    ts.getTouchingWord = getTouchingWord;\n    /* Gets the token whose text has range [start, end) and position >= start\n     * and (position < end or (position === end && token is keyword or identifier or numeric/string literal))\n     */\n    function getTouchingPropertyName(sourceFile, position, includeJsDocComment) {\n        if (includeJsDocComment === void 0) { includeJsDocComment = false; }\n        return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }, includeJsDocComment);\n    }\n    ts.getTouchingPropertyName = getTouchingPropertyName;\n    /** Returns the token if position is in [start, end) or if position === end and includeItemAtEndPosition(token) === true */\n    function getTouchingToken(sourceFile, position, includeItemAtEndPosition, includeJsDocComment) {\n        if (includeJsDocComment === void 0) { includeJsDocComment = false; }\n        return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ false, includeItemAtEndPosition, includeJsDocComment);\n    }\n    ts.getTouchingToken = getTouchingToken;\n    /** Returns a token if position is in [start-of-leading-trivia, end) */\n    function getTokenAtPosition(sourceFile, position, includeJsDocComment) {\n        if (includeJsDocComment === void 0) { includeJsDocComment = false; }\n        return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ true, /*includeItemAtEndPosition*/ undefined, includeJsDocComment);\n    }\n    ts.getTokenAtPosition = getTokenAtPosition;\n    /** Get the token whose text contains the position */\n    function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includeItemAtEndPosition, includeJsDocComment) {\n        if (includeJsDocComment === void 0) { includeJsDocComment = false; }\n        var current = sourceFile;\n        outer: while (true) {\n            if (isToken(current)) {\n                // exit early\n                return current;\n            }\n            if (includeJsDocComment) {\n                var jsDocChildren = ts.filter(current.getChildren(), ts.isJSDocNode);\n                for (var _i = 0, jsDocChildren_1 = jsDocChildren; _i < jsDocChildren_1.length; _i++) {\n                    var jsDocChild = jsDocChildren_1[_i];\n                    var start = allowPositionInLeadingTrivia ? jsDocChild.getFullStart() : jsDocChild.getStart(sourceFile, includeJsDocComment);\n                    if (start <= position) {\n                        var end = jsDocChild.getEnd();\n                        if (position < end || (position === end && jsDocChild.kind === 1 /* EndOfFileToken */)) {\n                            current = jsDocChild;\n                            continue outer;\n                        }\n                        else if (includeItemAtEndPosition && end === position) {\n                            var previousToken = findPrecedingToken(position, sourceFile, jsDocChild);\n                            if (previousToken && includeItemAtEndPosition(previousToken)) {\n                                return previousToken;\n                            }\n                        }\n                    }\n                }\n            }\n            // find the child that contains 'position'\n            for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) {\n                var child = current.getChildAt(i);\n                // all jsDocComment nodes were already visited\n                if (ts.isJSDocNode(child)) {\n                    continue;\n                }\n                var start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile, includeJsDocComment);\n                if (start <= position) {\n                    var end = child.getEnd();\n                    if (position < end || (position === end && child.kind === 1 /* EndOfFileToken */)) {\n                        current = child;\n                        continue outer;\n                    }\n                    else if (includeItemAtEndPosition && end === position) {\n                        var previousToken = findPrecedingToken(position, sourceFile, child);\n                        if (previousToken && includeItemAtEndPosition(previousToken)) {\n                            return previousToken;\n                        }\n                    }\n                }\n            }\n            return current;\n        }\n    }\n    /**\n      * The token on the left of the position is the token that strictly includes the position\n      * or sits to the left of the cursor if it is on a boundary. For example\n      *\n      *   fo|o               -> will return foo\n      *   foo <comment> |bar -> will return foo\n      *\n      */\n    function findTokenOnLeftOfPosition(file, position) {\n        // Ideally, getTokenAtPosition should return a token. However, it is currently\n        // broken, so we do a check to make sure the result was indeed a token.\n        var tokenAtPosition = getTokenAtPosition(file, position);\n        if (isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) {\n            return tokenAtPosition;\n        }\n        return findPrecedingToken(position, file);\n    }\n    ts.findTokenOnLeftOfPosition = findTokenOnLeftOfPosition;\n    function findNextToken(previousToken, parent) {\n        return find(parent);\n        function find(n) {\n            if (isToken(n) && n.pos === previousToken.end) {\n                // this is token that starts at the end of previous token - return it\n                return n;\n            }\n            var children = n.getChildren();\n            for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {\n                var child = children_2[_i];\n                var shouldDiveInChildNode = \n                // previous token is enclosed somewhere in the child\n                (child.pos <= previousToken.pos && child.end > previousToken.end) ||\n                    // previous token ends exactly at the beginning of child\n                    (child.pos === previousToken.end);\n                if (shouldDiveInChildNode && nodeHasTokens(child)) {\n                    return find(child);\n                }\n            }\n            return undefined;\n        }\n    }\n    ts.findNextToken = findNextToken;\n    function findPrecedingToken(position, sourceFile, startNode) {\n        return find(startNode || sourceFile);\n        function findRightmostToken(n) {\n            if (isToken(n)) {\n                return n;\n            }\n            var children = n.getChildren();\n            var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length);\n            return candidate && findRightmostToken(candidate);\n        }\n        function find(n) {\n            if (isToken(n)) {\n                return n;\n            }\n            var children = n.getChildren();\n            for (var i = 0, len = children.length; i < len; i++) {\n                var child = children[i];\n                // condition 'position < child.end' checks if child node end after the position\n                // in the example below this condition will be false for 'aaaa' and 'bbbb' and true for 'ccc'\n                // aaaa___bbbb___$__ccc\n                // after we found child node with end after the position we check if start of the node is after the position.\n                // if yes - then position is in the trivia and we need to look into the previous child to find the token in question.\n                // if no - position is in the node itself so we should recurse in it.\n                // NOTE: JsxText is a weird kind of node that can contain only whitespaces (since they are not counted as trivia).\n                // if this is the case - then we should assume that token in question is located in previous child.\n                if (position < child.end && (nodeHasTokens(child) || child.kind === 10 /* JsxText */)) {\n                    var start = child.getStart(sourceFile);\n                    var lookInPreviousChild = (start >= position) ||\n                        (child.kind === 10 /* JsxText */ && start === child.end); // whitespace only JsxText\n                    if (lookInPreviousChild) {\n                        // actual start of the node is past the position - previous token should be at the end of previous child\n                        var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i);\n                        return candidate && findRightmostToken(candidate);\n                    }\n                    else {\n                        // candidate should be in this node\n                        return find(child);\n                    }\n                }\n            }\n            ts.Debug.assert(startNode !== undefined || n.kind === 261 /* SourceFile */);\n            // Here we know that none of child token nodes embrace the position,\n            // the only known case is when position is at the end of the file.\n            // Try to find the rightmost token in the file without filtering.\n            // Namely we are skipping the check: 'position < node.end'\n            if (children.length) {\n                var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length);\n                return candidate && findRightmostToken(candidate);\n            }\n        }\n        /// finds last node that is considered as candidate for search (isCandidate(node) === true) starting from 'exclusiveStartPosition'\n        function findRightmostChildNodeWithTokens(children, exclusiveStartPosition) {\n            for (var i = exclusiveStartPosition - 1; i >= 0; i--) {\n                if (nodeHasTokens(children[i])) {\n                    return children[i];\n                }\n            }\n        }\n    }\n    ts.findPrecedingToken = findPrecedingToken;\n    function isInString(sourceFile, position) {\n        var previousToken = findPrecedingToken(position, sourceFile);\n        if (previousToken && previousToken.kind === 9 /* StringLiteral */) {\n            var start = previousToken.getStart();\n            var end = previousToken.getEnd();\n            // To be \"in\" one of these literals, the position has to be:\n            //   1. entirely within the token text.\n            //   2. at the end position of an unterminated token.\n            //   3. at the end of a regular expression (due to trailing flags like '/foo/g').\n            if (start < position && position < end) {\n                return true;\n            }\n            if (position === end) {\n                return !!previousToken.isUnterminated;\n            }\n        }\n        return false;\n    }\n    ts.isInString = isInString;\n    function isInComment(sourceFile, position) {\n        return isInCommentHelper(sourceFile, position, /*predicate*/ undefined);\n    }\n    ts.isInComment = isInComment;\n    /**\n     * returns true if the position is in between the open and close elements of an JSX expression.\n     */\n    function isInsideJsxElementOrAttribute(sourceFile, position) {\n        var token = getTokenAtPosition(sourceFile, position);\n        if (!token) {\n            return false;\n        }\n        if (token.kind === 10 /* JsxText */) {\n            return true;\n        }\n        // <div>Hello |</div>\n        if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 10 /* JsxText */) {\n            return true;\n        }\n        // <div> { | </div> or <div a={| </div>\n        if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 252 /* JsxExpression */) {\n            return true;\n        }\n        // <div> {\n        // |\n        // } < /div>\n        if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 252 /* JsxExpression */) {\n            return true;\n        }\n        // <div>|</div>\n        if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 249 /* JsxClosingElement */) {\n            return true;\n        }\n        return false;\n    }\n    ts.isInsideJsxElementOrAttribute = isInsideJsxElementOrAttribute;\n    function isInTemplateString(sourceFile, position) {\n        var token = getTokenAtPosition(sourceFile, position);\n        return ts.isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile);\n    }\n    ts.isInTemplateString = isInTemplateString;\n    /**\n     * Returns true if the cursor at position in sourceFile is within a comment that additionally\n     * satisfies predicate, and false otherwise.\n     */\n    function isInCommentHelper(sourceFile, position, predicate) {\n        var token = getTokenAtPosition(sourceFile, position);\n        if (token && position <= token.getStart(sourceFile)) {\n            var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);\n            // The end marker of a single-line comment does not include the newline character.\n            // In the following case, we are inside a comment (^ denotes the cursor position):\n            //\n            //    // asdf   ^\\n\n            //\n            // But for multi-line comments, we don't want to be inside the comment in the following case:\n            //\n            //    /* asdf */^\n            //\n            // Internally, we represent the end of the comment at the newline and closing '/', respectively.\n            return predicate ?\n                ts.forEach(commentRanges, function (c) { return c.pos < position &&\n                    (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end) &&\n                    predicate(c); }) :\n                ts.forEach(commentRanges, function (c) { return c.pos < position &&\n                    (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end); });\n        }\n        return false;\n    }\n    ts.isInCommentHelper = isInCommentHelper;\n    function hasDocComment(sourceFile, position) {\n        var token = getTokenAtPosition(sourceFile, position);\n        // First, we have to see if this position actually landed in a comment.\n        var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);\n        return ts.forEach(commentRanges, jsDocPrefix);\n        function jsDocPrefix(c) {\n            var text = sourceFile.text;\n            return text.length >= c.pos + 3 && text[c.pos] === \"/\" && text[c.pos + 1] === \"*\" && text[c.pos + 2] === \"*\";\n        }\n    }\n    ts.hasDocComment = hasDocComment;\n    /**\n     * Get the corresponding JSDocTag node if the position is in a jsDoc comment\n     */\n    function getJsDocTagAtPosition(sourceFile, position) {\n        var node = ts.getTokenAtPosition(sourceFile, position);\n        if (isToken(node)) {\n            switch (node.kind) {\n                case 103 /* VarKeyword */:\n                case 109 /* LetKeyword */:\n                case 75 /* ConstKeyword */:\n                    // if the current token is var, let or const, skip the VariableDeclarationList\n                    node = node.parent === undefined ? undefined : node.parent.parent;\n                    break;\n                default:\n                    node = node.parent;\n                    break;\n            }\n        }\n        if (node) {\n            if (node.jsDoc) {\n                for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {\n                    var jsDoc = _a[_i];\n                    if (jsDoc.tags) {\n                        for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) {\n                            var tag = _c[_b];\n                            if (tag.pos <= position && position <= tag.end) {\n                                return tag;\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        return undefined;\n    }\n    ts.getJsDocTagAtPosition = getJsDocTagAtPosition;\n    function nodeHasTokens(n) {\n        // If we have a token or node that has a non-zero width, it must have tokens.\n        // Note, that getWidth() does not take trivia into account.\n        return n.getWidth() !== 0;\n    }\n    function getNodeModifiers(node) {\n        var flags = ts.getCombinedModifierFlags(node);\n        var result = [];\n        if (flags & 8 /* Private */)\n            result.push(ts.ScriptElementKindModifier.privateMemberModifier);\n        if (flags & 16 /* Protected */)\n            result.push(ts.ScriptElementKindModifier.protectedMemberModifier);\n        if (flags & 4 /* Public */)\n            result.push(ts.ScriptElementKindModifier.publicMemberModifier);\n        if (flags & 32 /* Static */)\n            result.push(ts.ScriptElementKindModifier.staticModifier);\n        if (flags & 128 /* Abstract */)\n            result.push(ts.ScriptElementKindModifier.abstractModifier);\n        if (flags & 1 /* Export */)\n            result.push(ts.ScriptElementKindModifier.exportedModifier);\n        if (ts.isInAmbientContext(node))\n            result.push(ts.ScriptElementKindModifier.ambientModifier);\n        return result.length > 0 ? result.join(\",\") : ts.ScriptElementKindModifier.none;\n    }\n    ts.getNodeModifiers = getNodeModifiers;\n    function getTypeArgumentOrTypeParameterList(node) {\n        if (node.kind === 157 /* TypeReference */ || node.kind === 179 /* CallExpression */) {\n            return node.typeArguments;\n        }\n        if (ts.isFunctionLike(node) || node.kind === 226 /* ClassDeclaration */ || node.kind === 227 /* InterfaceDeclaration */) {\n            return node.typeParameters;\n        }\n        return undefined;\n    }\n    ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList;\n    function isToken(n) {\n        return n.kind >= 0 /* FirstToken */ && n.kind <= 140 /* LastToken */;\n    }\n    ts.isToken = isToken;\n    function isWord(kind) {\n        return kind === 70 /* Identifier */ || ts.isKeyword(kind);\n    }\n    ts.isWord = isWord;\n    function isPropertyName(kind) {\n        return kind === 9 /* StringLiteral */ || kind === 8 /* NumericLiteral */ || isWord(kind);\n    }\n    function isComment(kind) {\n        return kind === 2 /* SingleLineCommentTrivia */ || kind === 3 /* MultiLineCommentTrivia */;\n    }\n    ts.isComment = isComment;\n    function isStringOrRegularExpressionOrTemplateLiteral(kind) {\n        if (kind === 9 /* StringLiteral */\n            || kind === 11 /* RegularExpressionLiteral */\n            || ts.isTemplateLiteralKind(kind)) {\n            return true;\n        }\n        return false;\n    }\n    ts.isStringOrRegularExpressionOrTemplateLiteral = isStringOrRegularExpressionOrTemplateLiteral;\n    function isPunctuation(kind) {\n        return 16 /* FirstPunctuation */ <= kind && kind <= 69 /* LastPunctuation */;\n    }\n    ts.isPunctuation = isPunctuation;\n    function isInsideTemplateLiteral(node, position) {\n        return ts.isTemplateLiteralKind(node.kind)\n            && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd());\n    }\n    ts.isInsideTemplateLiteral = isInsideTemplateLiteral;\n    function isAccessibilityModifier(kind) {\n        switch (kind) {\n            case 113 /* PublicKeyword */:\n            case 111 /* PrivateKeyword */:\n            case 112 /* ProtectedKeyword */:\n                return true;\n        }\n        return false;\n    }\n    ts.isAccessibilityModifier = isAccessibilityModifier;\n    function compareDataObjects(dst, src) {\n        for (var e in dst) {\n            if (typeof dst[e] === \"object\") {\n                if (!compareDataObjects(dst[e], src[e])) {\n                    return false;\n                }\n            }\n            else if (typeof dst[e] !== \"function\") {\n                if (dst[e] !== src[e]) {\n                    return false;\n                }\n            }\n        }\n        return true;\n    }\n    ts.compareDataObjects = compareDataObjects;\n    function isArrayLiteralOrObjectLiteralDestructuringPattern(node) {\n        if (node.kind === 175 /* ArrayLiteralExpression */ ||\n            node.kind === 176 /* ObjectLiteralExpression */) {\n            // [a,b,c] from:\n            // [a, b, c] = someExpression;\n            if (node.parent.kind === 192 /* BinaryExpression */ &&\n                node.parent.left === node &&\n                node.parent.operatorToken.kind === 57 /* EqualsToken */) {\n                return true;\n            }\n            // [a, b, c] from:\n            // for([a, b, c] of expression)\n            if (node.parent.kind === 213 /* ForOfStatement */ &&\n                node.parent.initializer === node) {\n                return true;\n            }\n            // [a, b, c] of\n            // [x, [a, b, c] ] = someExpression\n            // or\n            // {x, a: {a, b, c} } = someExpression\n            if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 257 /* PropertyAssignment */ ? node.parent.parent : node.parent)) {\n                return true;\n            }\n        }\n        return false;\n    }\n    ts.isArrayLiteralOrObjectLiteralDestructuringPattern = isArrayLiteralOrObjectLiteralDestructuringPattern;\n    function hasTrailingDirectorySeparator(path) {\n        var lastCharacter = path.charAt(path.length - 1);\n        return lastCharacter === \"/\" || lastCharacter === \"\\\\\";\n    }\n    ts.hasTrailingDirectorySeparator = hasTrailingDirectorySeparator;\n    function isInReferenceComment(sourceFile, position) {\n        return isInCommentHelper(sourceFile, position, isReferenceComment);\n        function isReferenceComment(c) {\n            var commentText = sourceFile.text.substring(c.pos, c.end);\n            return tripleSlashDirectivePrefixRegex.test(commentText);\n        }\n    }\n    ts.isInReferenceComment = isInReferenceComment;\n    function isInNonReferenceComment(sourceFile, position) {\n        return isInCommentHelper(sourceFile, position, isNonReferenceComment);\n        function isNonReferenceComment(c) {\n            var commentText = sourceFile.text.substring(c.pos, c.end);\n            return !tripleSlashDirectivePrefixRegex.test(commentText);\n        }\n    }\n    ts.isInNonReferenceComment = isInNonReferenceComment;\n})(ts || (ts = {}));\n// Display-part writer helpers\n/* @internal */\n(function (ts) {\n    function isFirstDeclarationOfSymbolParameter(symbol) {\n        return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 144 /* Parameter */;\n    }\n    ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter;\n    var displayPartWriter = getDisplayPartWriter();\n    function getDisplayPartWriter() {\n        var displayParts;\n        var lineStart;\n        var indent;\n        resetWriter();\n        return {\n            displayParts: function () { return displayParts; },\n            writeKeyword: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.keyword); },\n            writeOperator: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.operator); },\n            writePunctuation: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.punctuation); },\n            writeSpace: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.space); },\n            writeStringLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral); },\n            writeParameter: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.parameterName); },\n            writeSymbol: writeSymbol,\n            writeLine: writeLine,\n            increaseIndent: function () { indent++; },\n            decreaseIndent: function () { indent--; },\n            clear: resetWriter,\n            trackSymbol: ts.noop,\n            reportInaccessibleThisError: ts.noop\n        };\n        function writeIndent() {\n            if (lineStart) {\n                var indentString = ts.getIndentString(indent);\n                if (indentString) {\n                    displayParts.push(displayPart(indentString, ts.SymbolDisplayPartKind.space));\n                }\n                lineStart = false;\n            }\n        }\n        function writeKind(text, kind) {\n            writeIndent();\n            displayParts.push(displayPart(text, kind));\n        }\n        function writeSymbol(text, symbol) {\n            writeIndent();\n            displayParts.push(symbolPart(text, symbol));\n        }\n        function writeLine() {\n            displayParts.push(lineBreakPart());\n            lineStart = true;\n        }\n        function resetWriter() {\n            displayParts = [];\n            lineStart = true;\n            indent = 0;\n        }\n    }\n    function symbolPart(text, symbol) {\n        return displayPart(text, displayPartKind(symbol));\n        function displayPartKind(symbol) {\n            var flags = symbol.flags;\n            if (flags & 3 /* Variable */) {\n                return isFirstDeclarationOfSymbolParameter(symbol) ? ts.SymbolDisplayPartKind.parameterName : ts.SymbolDisplayPartKind.localName;\n            }\n            else if (flags & 4 /* Property */) {\n                return ts.SymbolDisplayPartKind.propertyName;\n            }\n            else if (flags & 32768 /* GetAccessor */) {\n                return ts.SymbolDisplayPartKind.propertyName;\n            }\n            else if (flags & 65536 /* SetAccessor */) {\n                return ts.SymbolDisplayPartKind.propertyName;\n            }\n            else if (flags & 8 /* EnumMember */) {\n                return ts.SymbolDisplayPartKind.enumMemberName;\n            }\n            else if (flags & 16 /* Function */) {\n                return ts.SymbolDisplayPartKind.functionName;\n            }\n            else if (flags & 32 /* Class */) {\n                return ts.SymbolDisplayPartKind.className;\n            }\n            else if (flags & 64 /* Interface */) {\n                return ts.SymbolDisplayPartKind.interfaceName;\n            }\n            else if (flags & 384 /* Enum */) {\n                return ts.SymbolDisplayPartKind.enumName;\n            }\n            else if (flags & 1536 /* Module */) {\n                return ts.SymbolDisplayPartKind.moduleName;\n            }\n            else if (flags & 8192 /* Method */) {\n                return ts.SymbolDisplayPartKind.methodName;\n            }\n            else if (flags & 262144 /* TypeParameter */) {\n                return ts.SymbolDisplayPartKind.typeParameterName;\n            }\n            else if (flags & 524288 /* TypeAlias */) {\n                return ts.SymbolDisplayPartKind.aliasName;\n            }\n            else if (flags & 8388608 /* Alias */) {\n                return ts.SymbolDisplayPartKind.aliasName;\n            }\n            return ts.SymbolDisplayPartKind.text;\n        }\n    }\n    ts.symbolPart = symbolPart;\n    function displayPart(text, kind) {\n        return {\n            text: text,\n            kind: ts.SymbolDisplayPartKind[kind]\n        };\n    }\n    ts.displayPart = displayPart;\n    function spacePart() {\n        return displayPart(\" \", ts.SymbolDisplayPartKind.space);\n    }\n    ts.spacePart = spacePart;\n    function keywordPart(kind) {\n        return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.keyword);\n    }\n    ts.keywordPart = keywordPart;\n    function punctuationPart(kind) {\n        return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.punctuation);\n    }\n    ts.punctuationPart = punctuationPart;\n    function operatorPart(kind) {\n        return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.operator);\n    }\n    ts.operatorPart = operatorPart;\n    function textOrKeywordPart(text) {\n        var kind = ts.stringToToken(text);\n        return kind === undefined\n            ? textPart(text)\n            : keywordPart(kind);\n    }\n    ts.textOrKeywordPart = textOrKeywordPart;\n    function textPart(text) {\n        return displayPart(text, ts.SymbolDisplayPartKind.text);\n    }\n    ts.textPart = textPart;\n    var carriageReturnLineFeed = \"\\r\\n\";\n    /**\n     * The default is CRLF.\n     */\n    function getNewLineOrDefaultFromHost(host) {\n        return host.getNewLine ? host.getNewLine() : carriageReturnLineFeed;\n    }\n    ts.getNewLineOrDefaultFromHost = getNewLineOrDefaultFromHost;\n    function lineBreakPart() {\n        return displayPart(\"\\n\", ts.SymbolDisplayPartKind.lineBreak);\n    }\n    ts.lineBreakPart = lineBreakPart;\n    function mapToDisplayParts(writeDisplayParts) {\n        writeDisplayParts(displayPartWriter);\n        var result = displayPartWriter.displayParts();\n        displayPartWriter.clear();\n        return result;\n    }\n    ts.mapToDisplayParts = mapToDisplayParts;\n    function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags) {\n        return mapToDisplayParts(function (writer) {\n            typechecker.getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);\n        });\n    }\n    ts.typeToDisplayParts = typeToDisplayParts;\n    function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags) {\n        return mapToDisplayParts(function (writer) {\n            typeChecker.getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags);\n        });\n    }\n    ts.symbolToDisplayParts = symbolToDisplayParts;\n    function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, flags) {\n        return mapToDisplayParts(function (writer) {\n            typechecker.getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags);\n        });\n    }\n    ts.signatureToDisplayParts = signatureToDisplayParts;\n    function getDeclaredName(typeChecker, symbol, location) {\n        // If this is an export or import specifier it could have been renamed using the 'as' syntax.\n        // If so we want to search for whatever is under the cursor.\n        if (isImportOrExportSpecifierName(location)) {\n            return location.getText();\n        }\n        else if (ts.isStringOrNumericLiteral(location) &&\n            location.parent.kind === 142 /* ComputedPropertyName */) {\n            return location.text;\n        }\n        // Try to get the local symbol if we're dealing with an 'export default'\n        // since that symbol has the \"true\" name.\n        var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol);\n        var name = typeChecker.symbolToString(localExportDefaultSymbol || symbol);\n        return name;\n    }\n    ts.getDeclaredName = getDeclaredName;\n    function isImportOrExportSpecifierName(location) {\n        return location.parent &&\n            (location.parent.kind === 239 /* ImportSpecifier */ || location.parent.kind === 243 /* ExportSpecifier */) &&\n            location.parent.propertyName === location;\n    }\n    ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName;\n    /**\n     * Strip off existed single quotes or double quotes from a given string\n     *\n     * @return non-quoted string\n     */\n    function stripQuotes(name) {\n        var length = name.length;\n        if (length >= 2 &&\n            name.charCodeAt(0) === name.charCodeAt(length - 1) &&\n            (name.charCodeAt(0) === 34 /* doubleQuote */ || name.charCodeAt(0) === 39 /* singleQuote */)) {\n            return name.substring(1, length - 1);\n        }\n        ;\n        return name;\n    }\n    ts.stripQuotes = stripQuotes;\n    function scriptKindIs(fileName, host) {\n        var scriptKinds = [];\n        for (var _i = 2; _i < arguments.length; _i++) {\n            scriptKinds[_i - 2] = arguments[_i];\n        }\n        var scriptKind = getScriptKind(fileName, host);\n        return ts.forEach(scriptKinds, function (k) { return k === scriptKind; });\n    }\n    ts.scriptKindIs = scriptKindIs;\n    function getScriptKind(fileName, host) {\n        // First check to see if the script kind was specified by the host. Chances are the host\n        // may override the default script kind for the file extension.\n        var scriptKind;\n        if (host && host.getScriptKind) {\n            scriptKind = host.getScriptKind(fileName);\n        }\n        if (!scriptKind) {\n            scriptKind = ts.getScriptKindFromFileName(fileName);\n        }\n        return ts.ensureScriptKind(fileName, scriptKind);\n    }\n    ts.getScriptKind = getScriptKind;\n    function sanitizeConfigFile(configFileName, content) {\n        var options = {\n            fileName: \"config.js\",\n            compilerOptions: {\n                target: 2 /* ES2015 */,\n                removeComments: true\n            },\n            reportDiagnostics: true\n        };\n        var _a = ts.transpileModule(\"(\" + content + \")\", options), outputText = _a.outputText, diagnostics = _a.diagnostics;\n        // Becasue the content was wrapped in \"()\", the start position of diagnostics needs to be subtract by 1\n        // also, the emitted result will have \"(\" in the beginning and \");\" in the end. We need to strip these\n        // as well\n        var trimmedOutput = outputText.trim();\n        for (var _i = 0, diagnostics_2 = diagnostics; _i < diagnostics_2.length; _i++) {\n            var diagnostic = diagnostics_2[_i];\n            diagnostic.start = diagnostic.start - 1;\n        }\n        var _b = ts.parseConfigFileTextToJson(configFileName, trimmedOutput.substring(1, trimmedOutput.length - 2), /*stripComments*/ false), config = _b.config, error = _b.error;\n        return {\n            configJsonObject: config || {},\n            diagnostics: error ? ts.concatenate(diagnostics, [error]) : diagnostics\n        };\n    }\n    ts.sanitizeConfigFile = sanitizeConfigFile;\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    /// Classifier\n    function createClassifier() {\n        var scanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false);\n        /// We do not have a full parser support to know when we should parse a regex or not\n        /// If we consider every slash token to be a regex, we could be missing cases like \"1/2/3\", where\n        /// we have a series of divide operator. this list allows us to be more accurate by ruling out\n        /// locations where a regexp cannot exist.\n        var noRegexTable = [];\n        noRegexTable[70 /* Identifier */] = true;\n        noRegexTable[9 /* StringLiteral */] = true;\n        noRegexTable[8 /* NumericLiteral */] = true;\n        noRegexTable[11 /* RegularExpressionLiteral */] = true;\n        noRegexTable[98 /* ThisKeyword */] = true;\n        noRegexTable[42 /* PlusPlusToken */] = true;\n        noRegexTable[43 /* MinusMinusToken */] = true;\n        noRegexTable[19 /* CloseParenToken */] = true;\n        noRegexTable[21 /* CloseBracketToken */] = true;\n        noRegexTable[17 /* CloseBraceToken */] = true;\n        noRegexTable[100 /* TrueKeyword */] = true;\n        noRegexTable[85 /* FalseKeyword */] = true;\n        // Just a stack of TemplateHeads and OpenCurlyBraces, used to perform rudimentary (inexact)\n        // classification on template strings. Because of the context free nature of templates,\n        // the only precise way to classify a template portion would be by propagating the stack across\n        // lines, just as we do with the end-of-line state. However, this is a burden for implementers,\n        // and the behavior is entirely subsumed by the syntactic classifier anyway, so we instead\n        // flatten any nesting when the template stack is non-empty and encode it in the end-of-line state.\n        // Situations in which this fails are\n        //  1) When template strings are nested across different lines:\n        //          `hello ${ `world\n        //          ` }`\n        //\n        //     Where on the second line, you will get the closing of a template,\n        //     a closing curly, and a new template.\n        //\n        //  2) When substitution expressions have curly braces and the curly brace falls on the next line:\n        //          `hello ${ () => {\n        //          return \"world\" } } `\n        //\n        //     Where on the second line, you will get the 'return' keyword,\n        //     a string literal, and a template end consisting of '} } `'.\n        var templateStack = [];\n        /** Returns true if 'keyword2' can legally follow 'keyword1' in any language construct. */\n        function canFollow(keyword1, keyword2) {\n            if (ts.isAccessibilityModifier(keyword1)) {\n                if (keyword2 === 124 /* GetKeyword */ ||\n                    keyword2 === 133 /* SetKeyword */ ||\n                    keyword2 === 122 /* ConstructorKeyword */ ||\n                    keyword2 === 114 /* StaticKeyword */) {\n                    // Allow things like \"public get\", \"public constructor\" and \"public static\".\n                    // These are all legal.\n                    return true;\n                }\n                // Any other keyword following \"public\" is actually an identifier an not a real\n                // keyword.\n                return false;\n            }\n            // Assume any other keyword combination is legal.  This can be refined in the future\n            // if there are more cases we want the classifier to be better at.\n            return true;\n        }\n        function convertClassifications(classifications, text) {\n            var entries = [];\n            var dense = classifications.spans;\n            var lastEnd = 0;\n            for (var i = 0, n = dense.length; i < n; i += 3) {\n                var start = dense[i];\n                var length_4 = dense[i + 1];\n                var type = dense[i + 2];\n                // Make a whitespace entry between the last item and this one.\n                if (lastEnd >= 0) {\n                    var whitespaceLength_1 = start - lastEnd;\n                    if (whitespaceLength_1 > 0) {\n                        entries.push({ length: whitespaceLength_1, classification: ts.TokenClass.Whitespace });\n                    }\n                }\n                entries.push({ length: length_4, classification: convertClassification(type) });\n                lastEnd = start + length_4;\n            }\n            var whitespaceLength = text.length - lastEnd;\n            if (whitespaceLength > 0) {\n                entries.push({ length: whitespaceLength, classification: ts.TokenClass.Whitespace });\n            }\n            return { entries: entries, finalLexState: classifications.endOfLineState };\n        }\n        function convertClassification(type) {\n            switch (type) {\n                case 1 /* comment */: return ts.TokenClass.Comment;\n                case 3 /* keyword */: return ts.TokenClass.Keyword;\n                case 4 /* numericLiteral */: return ts.TokenClass.NumberLiteral;\n                case 5 /* operator */: return ts.TokenClass.Operator;\n                case 6 /* stringLiteral */: return ts.TokenClass.StringLiteral;\n                case 8 /* whiteSpace */: return ts.TokenClass.Whitespace;\n                case 10 /* punctuation */: return ts.TokenClass.Punctuation;\n                case 2 /* identifier */:\n                case 11 /* className */:\n                case 12 /* enumName */:\n                case 13 /* interfaceName */:\n                case 14 /* moduleName */:\n                case 15 /* typeParameterName */:\n                case 16 /* typeAliasName */:\n                case 9 /* text */:\n                case 17 /* parameterName */:\n                default:\n                    return ts.TokenClass.Identifier;\n            }\n        }\n        function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) {\n            return convertClassifications(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text);\n        }\n        // If there is a syntactic classifier ('syntacticClassifierAbsent' is false),\n        // we will be more conservative in order to avoid conflicting with the syntactic classifier.\n        function getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent) {\n            var offset = 0;\n            var token = 0 /* Unknown */;\n            var lastNonTriviaToken = 0 /* Unknown */;\n            // Empty out the template stack for reuse.\n            while (templateStack.length > 0) {\n                templateStack.pop();\n            }\n            // If we're in a string literal, then prepend: \"\\\n            // (and a newline).  That way when we lex we'll think we're still in a string literal.\n            //\n            // If we're in a multiline comment, then prepend: /*\n            // (and a newline).  That way when we lex we'll think we're still in a multiline comment.\n            switch (lexState) {\n                case 3 /* InDoubleQuoteStringLiteral */:\n                    text = \"\\\"\\\\\\n\" + text;\n                    offset = 3;\n                    break;\n                case 2 /* InSingleQuoteStringLiteral */:\n                    text = \"'\\\\\\n\" + text;\n                    offset = 3;\n                    break;\n                case 1 /* InMultiLineCommentTrivia */:\n                    text = \"/*\\n\" + text;\n                    offset = 3;\n                    break;\n                case 4 /* InTemplateHeadOrNoSubstitutionTemplate */:\n                    text = \"`\\n\" + text;\n                    offset = 2;\n                    break;\n                case 5 /* InTemplateMiddleOrTail */:\n                    text = \"}\\n\" + text;\n                    offset = 2;\n                // fallthrough\n                case 6 /* InTemplateSubstitutionPosition */:\n                    templateStack.push(13 /* TemplateHead */);\n                    break;\n            }\n            scanner.setText(text);\n            var result = {\n                endOfLineState: 0 /* None */,\n                spans: []\n            };\n            // We can run into an unfortunate interaction between the lexical and syntactic classifier\n            // when the user is typing something generic.  Consider the case where the user types:\n            //\n            //      Foo<number\n            //\n            // From the lexical classifier's perspective, 'number' is a keyword, and so the word will\n            // be classified as such.  However, from the syntactic classifier's tree-based perspective\n            // this is simply an expression with the identifier 'number' on the RHS of the less than\n            // token.  So the classification will go back to being an identifier.  The moment the user\n            // types again, number will become a keyword, then an identifier, etc. etc.\n            //\n            // To try to avoid this problem, we avoid classifying contextual keywords as keywords\n            // when the user is potentially typing something generic.  We just can't do a good enough\n            // job at the lexical level, and so well leave it up to the syntactic classifier to make\n            // the determination.\n            //\n            // In order to determine if the user is potentially typing something generic, we use a\n            // weak heuristic where we track < and > tokens.  It's a weak heuristic, but should\n            // work well enough in practice.\n            var angleBracketStack = 0;\n            do {\n                token = scanner.scan();\n                if (!ts.isTrivia(token)) {\n                    if ((token === 40 /* SlashToken */ || token === 62 /* SlashEqualsToken */) && !noRegexTable[lastNonTriviaToken]) {\n                        if (scanner.reScanSlashToken() === 11 /* RegularExpressionLiteral */) {\n                            token = 11 /* RegularExpressionLiteral */;\n                        }\n                    }\n                    else if (lastNonTriviaToken === 22 /* DotToken */ && isKeyword(token)) {\n                        token = 70 /* Identifier */;\n                    }\n                    else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) {\n                        // We have two keywords in a row.  Only treat the second as a keyword if\n                        // it's a sequence that could legally occur in the language.  Otherwise\n                        // treat it as an identifier.  This way, if someone writes \"private var\"\n                        // we recognize that 'var' is actually an identifier here.\n                        token = 70 /* Identifier */;\n                    }\n                    else if (lastNonTriviaToken === 70 /* Identifier */ &&\n                        token === 26 /* LessThanToken */) {\n                        // Could be the start of something generic.  Keep track of that by bumping\n                        // up the current count of generic contexts we may be in.\n                        angleBracketStack++;\n                    }\n                    else if (token === 28 /* GreaterThanToken */ && angleBracketStack > 0) {\n                        // If we think we're currently in something generic, then mark that that\n                        // generic entity is complete.\n                        angleBracketStack--;\n                    }\n                    else if (token === 118 /* AnyKeyword */ ||\n                        token === 134 /* StringKeyword */ ||\n                        token === 132 /* NumberKeyword */ ||\n                        token === 121 /* BooleanKeyword */ ||\n                        token === 135 /* SymbolKeyword */) {\n                        if (angleBracketStack > 0 && !syntacticClassifierAbsent) {\n                            // If it looks like we're could be in something generic, don't classify this\n                            // as a keyword.  We may just get overwritten by the syntactic classifier,\n                            // causing a noisy experience for the user.\n                            token = 70 /* Identifier */;\n                        }\n                    }\n                    else if (token === 13 /* TemplateHead */) {\n                        templateStack.push(token);\n                    }\n                    else if (token === 16 /* OpenBraceToken */) {\n                        // If we don't have anything on the template stack,\n                        // then we aren't trying to keep track of a previously scanned template head.\n                        if (templateStack.length > 0) {\n                            templateStack.push(token);\n                        }\n                    }\n                    else if (token === 17 /* CloseBraceToken */) {\n                        // If we don't have anything on the template stack,\n                        // then we aren't trying to keep track of a previously scanned template head.\n                        if (templateStack.length > 0) {\n                            var lastTemplateStackToken = ts.lastOrUndefined(templateStack);\n                            if (lastTemplateStackToken === 13 /* TemplateHead */) {\n                                token = scanner.reScanTemplateToken();\n                                // Only pop on a TemplateTail; a TemplateMiddle indicates there is more for us.\n                                if (token === 15 /* TemplateTail */) {\n                                    templateStack.pop();\n                                }\n                                else {\n                                    ts.Debug.assert(token === 14 /* TemplateMiddle */, \"Should have been a template middle. Was \" + token);\n                                }\n                            }\n                            else {\n                                ts.Debug.assert(lastTemplateStackToken === 16 /* OpenBraceToken */, \"Should have been an open brace. Was: \" + token);\n                                templateStack.pop();\n                            }\n                        }\n                    }\n                    lastNonTriviaToken = token;\n                }\n                processToken();\n            } while (token !== 1 /* EndOfFileToken */);\n            return result;\n            function processToken() {\n                var start = scanner.getTokenPos();\n                var end = scanner.getTextPos();\n                addResult(start, end, classFromKind(token));\n                if (end >= text.length) {\n                    if (token === 9 /* StringLiteral */) {\n                        // Check to see if we finished up on a multiline string literal.\n                        var tokenText = scanner.getTokenText();\n                        if (scanner.isUnterminated()) {\n                            var lastCharIndex = tokenText.length - 1;\n                            var numBackslashes = 0;\n                            while (tokenText.charCodeAt(lastCharIndex - numBackslashes) === 92 /* backslash */) {\n                                numBackslashes++;\n                            }\n                            // If we have an odd number of backslashes, then the multiline string is unclosed\n                            if (numBackslashes & 1) {\n                                var quoteChar = tokenText.charCodeAt(0);\n                                result.endOfLineState = quoteChar === 34 /* doubleQuote */\n                                    ? 3 /* InDoubleQuoteStringLiteral */\n                                    : 2 /* InSingleQuoteStringLiteral */;\n                            }\n                        }\n                    }\n                    else if (token === 3 /* MultiLineCommentTrivia */) {\n                        // Check to see if the multiline comment was unclosed.\n                        if (scanner.isUnterminated()) {\n                            result.endOfLineState = 1 /* InMultiLineCommentTrivia */;\n                        }\n                    }\n                    else if (ts.isTemplateLiteralKind(token)) {\n                        if (scanner.isUnterminated()) {\n                            if (token === 15 /* TemplateTail */) {\n                                result.endOfLineState = 5 /* InTemplateMiddleOrTail */;\n                            }\n                            else if (token === 12 /* NoSubstitutionTemplateLiteral */) {\n                                result.endOfLineState = 4 /* InTemplateHeadOrNoSubstitutionTemplate */;\n                            }\n                            else {\n                                ts.Debug.fail(\"Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #\" + token);\n                            }\n                        }\n                    }\n                    else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 13 /* TemplateHead */) {\n                        result.endOfLineState = 6 /* InTemplateSubstitutionPosition */;\n                    }\n                }\n            }\n            function addResult(start, end, classification) {\n                if (classification === 8 /* whiteSpace */) {\n                    // Don't bother with whitespace classifications.  They're not needed.\n                    return;\n                }\n                if (start === 0 && offset > 0) {\n                    // We're classifying the first token, and this was a case where we prepended\n                    // text.  We should consider the start of this token to be at the start of\n                    // the original text.\n                    start += offset;\n                }\n                // All our tokens are in relation to the augmented text.  Move them back to be\n                // relative to the original text.\n                start -= offset;\n                end -= offset;\n                var length = end - start;\n                if (length > 0) {\n                    result.spans.push(start);\n                    result.spans.push(length);\n                    result.spans.push(classification);\n                }\n            }\n        }\n        function isBinaryExpressionOperatorToken(token) {\n            switch (token) {\n                case 38 /* AsteriskToken */:\n                case 40 /* SlashToken */:\n                case 41 /* PercentToken */:\n                case 36 /* PlusToken */:\n                case 37 /* MinusToken */:\n                case 44 /* LessThanLessThanToken */:\n                case 45 /* GreaterThanGreaterThanToken */:\n                case 46 /* GreaterThanGreaterThanGreaterThanToken */:\n                case 26 /* LessThanToken */:\n                case 28 /* GreaterThanToken */:\n                case 29 /* LessThanEqualsToken */:\n                case 30 /* GreaterThanEqualsToken */:\n                case 92 /* InstanceOfKeyword */:\n                case 91 /* InKeyword */:\n                case 117 /* AsKeyword */:\n                case 31 /* EqualsEqualsToken */:\n                case 32 /* ExclamationEqualsToken */:\n                case 33 /* EqualsEqualsEqualsToken */:\n                case 34 /* ExclamationEqualsEqualsToken */:\n                case 47 /* AmpersandToken */:\n                case 49 /* CaretToken */:\n                case 48 /* BarToken */:\n                case 52 /* AmpersandAmpersandToken */:\n                case 53 /* BarBarToken */:\n                case 68 /* BarEqualsToken */:\n                case 67 /* AmpersandEqualsToken */:\n                case 69 /* CaretEqualsToken */:\n                case 64 /* LessThanLessThanEqualsToken */:\n                case 65 /* GreaterThanGreaterThanEqualsToken */:\n                case 66 /* GreaterThanGreaterThanGreaterThanEqualsToken */:\n                case 58 /* PlusEqualsToken */:\n                case 59 /* MinusEqualsToken */:\n                case 60 /* AsteriskEqualsToken */:\n                case 62 /* SlashEqualsToken */:\n                case 63 /* PercentEqualsToken */:\n                case 57 /* EqualsToken */:\n                case 25 /* CommaToken */:\n                    return true;\n                default:\n                    return false;\n            }\n        }\n        function isPrefixUnaryExpressionOperatorToken(token) {\n            switch (token) {\n                case 36 /* PlusToken */:\n                case 37 /* MinusToken */:\n                case 51 /* TildeToken */:\n                case 50 /* ExclamationToken */:\n                case 42 /* PlusPlusToken */:\n                case 43 /* MinusMinusToken */:\n                    return true;\n                default:\n                    return false;\n            }\n        }\n        function isKeyword(token) {\n            return token >= 71 /* FirstKeyword */ && token <= 140 /* LastKeyword */;\n        }\n        function classFromKind(token) {\n            if (isKeyword(token)) {\n                return 3 /* keyword */;\n            }\n            else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) {\n                return 5 /* operator */;\n            }\n            else if (token >= 16 /* FirstPunctuation */ && token <= 69 /* LastPunctuation */) {\n                return 10 /* punctuation */;\n            }\n            switch (token) {\n                case 8 /* NumericLiteral */:\n                    return 4 /* numericLiteral */;\n                case 9 /* StringLiteral */:\n                    return 6 /* stringLiteral */;\n                case 11 /* RegularExpressionLiteral */:\n                    return 7 /* regularExpressionLiteral */;\n                case 7 /* ConflictMarkerTrivia */:\n                case 3 /* MultiLineCommentTrivia */:\n                case 2 /* SingleLineCommentTrivia */:\n                    return 1 /* comment */;\n                case 5 /* WhitespaceTrivia */:\n                case 4 /* NewLineTrivia */:\n                    return 8 /* whiteSpace */;\n                case 70 /* Identifier */:\n                default:\n                    if (ts.isTemplateLiteralKind(token)) {\n                        return 6 /* stringLiteral */;\n                    }\n                    return 2 /* identifier */;\n            }\n        }\n        return {\n            getClassificationsForLine: getClassificationsForLine,\n            getEncodedLexicalClassifications: getEncodedLexicalClassifications\n        };\n    }\n    ts.createClassifier = createClassifier;\n    /* @internal */\n    function getSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span) {\n        return convertClassifications(getEncodedSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span));\n    }\n    ts.getSemanticClassifications = getSemanticClassifications;\n    function checkForClassificationCancellation(cancellationToken, kind) {\n        // We don't want to actually call back into our host on every node to find out if we've\n        // been canceled.  That would be an enormous amount of chattyness, along with the all\n        // the overhead of marshalling the data to/from the host.  So instead we pick a few\n        // reasonable node kinds to bother checking on.  These node kinds represent high level\n        // constructs that we would expect to see commonly, but just at a far less frequent\n        // interval.\n        //\n        // For example, in checker.ts (around 750k) we only have around 600 of these constructs.\n        // That means we're calling back into the host around every 1.2k of the file we process.\n        // Lib.d.ts has similar numbers.\n        switch (kind) {\n            case 230 /* ModuleDeclaration */:\n            case 226 /* ClassDeclaration */:\n            case 227 /* InterfaceDeclaration */:\n            case 225 /* FunctionDeclaration */:\n                cancellationToken.throwIfCancellationRequested();\n        }\n    }\n    /* @internal */\n    function getEncodedSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span) {\n        var result = [];\n        processNode(sourceFile);\n        return { spans: result, endOfLineState: 0 /* None */ };\n        function pushClassification(start, length, type) {\n            result.push(start);\n            result.push(length);\n            result.push(type);\n        }\n        function classifySymbol(symbol, meaningAtPosition) {\n            var flags = symbol.getFlags();\n            if ((flags & 788448 /* Classifiable */) === 0 /* None */) {\n                return;\n            }\n            if (flags & 32 /* Class */) {\n                return 11 /* className */;\n            }\n            else if (flags & 384 /* Enum */) {\n                return 12 /* enumName */;\n            }\n            else if (flags & 524288 /* TypeAlias */) {\n                return 16 /* typeAliasName */;\n            }\n            else if (meaningAtPosition & 2 /* Type */) {\n                if (flags & 64 /* Interface */) {\n                    return 13 /* interfaceName */;\n                }\n                else if (flags & 262144 /* TypeParameter */) {\n                    return 15 /* typeParameterName */;\n                }\n            }\n            else if (flags & 1536 /* Module */) {\n                // Only classify a module as such if\n                //  - It appears in a namespace context.\n                //  - There exists a module declaration which actually impacts the value side.\n                if (meaningAtPosition & 4 /* Namespace */ ||\n                    (meaningAtPosition & 1 /* Value */ && hasValueSideModule(symbol))) {\n                    return 14 /* moduleName */;\n                }\n            }\n            return undefined;\n            /**\n             * Returns true if there exists a module that introduces entities on the value side.\n             */\n            function hasValueSideModule(symbol) {\n                return ts.forEach(symbol.declarations, function (declaration) {\n                    return declaration.kind === 230 /* ModuleDeclaration */ &&\n                        ts.getModuleInstanceState(declaration) === 1 /* Instantiated */;\n                });\n            }\n        }\n        function processNode(node) {\n            // Only walk into nodes that intersect the requested span.\n            if (node && ts.textSpanIntersectsWith(span, node.getFullStart(), node.getFullWidth())) {\n                var kind = node.kind;\n                checkForClassificationCancellation(cancellationToken, kind);\n                if (kind === 70 /* Identifier */ && !ts.nodeIsMissing(node)) {\n                    var identifier = node;\n                    // Only bother calling into the typechecker if this is an identifier that\n                    // could possibly resolve to a type name.  This makes classification run\n                    // in a third of the time it would normally take.\n                    if (classifiableNames[identifier.text]) {\n                        var symbol = typeChecker.getSymbolAtLocation(node);\n                        if (symbol) {\n                            var type = classifySymbol(symbol, ts.getMeaningFromLocation(node));\n                            if (type) {\n                                pushClassification(node.getStart(), node.getWidth(), type);\n                            }\n                        }\n                    }\n                }\n                ts.forEachChild(node, processNode);\n            }\n        }\n    }\n    ts.getEncodedSemanticClassifications = getEncodedSemanticClassifications;\n    function getClassificationTypeName(type) {\n        switch (type) {\n            case 1 /* comment */: return ts.ClassificationTypeNames.comment;\n            case 2 /* identifier */: return ts.ClassificationTypeNames.identifier;\n            case 3 /* keyword */: return ts.ClassificationTypeNames.keyword;\n            case 4 /* numericLiteral */: return ts.ClassificationTypeNames.numericLiteral;\n            case 5 /* operator */: return ts.ClassificationTypeNames.operator;\n            case 6 /* stringLiteral */: return ts.ClassificationTypeNames.stringLiteral;\n            case 8 /* whiteSpace */: return ts.ClassificationTypeNames.whiteSpace;\n            case 9 /* text */: return ts.ClassificationTypeNames.text;\n            case 10 /* punctuation */: return ts.ClassificationTypeNames.punctuation;\n            case 11 /* className */: return ts.ClassificationTypeNames.className;\n            case 12 /* enumName */: return ts.ClassificationTypeNames.enumName;\n            case 13 /* interfaceName */: return ts.ClassificationTypeNames.interfaceName;\n            case 14 /* moduleName */: return ts.ClassificationTypeNames.moduleName;\n            case 15 /* typeParameterName */: return ts.ClassificationTypeNames.typeParameterName;\n            case 16 /* typeAliasName */: return ts.ClassificationTypeNames.typeAliasName;\n            case 17 /* parameterName */: return ts.ClassificationTypeNames.parameterName;\n            case 18 /* docCommentTagName */: return ts.ClassificationTypeNames.docCommentTagName;\n            case 19 /* jsxOpenTagName */: return ts.ClassificationTypeNames.jsxOpenTagName;\n            case 20 /* jsxCloseTagName */: return ts.ClassificationTypeNames.jsxCloseTagName;\n            case 21 /* jsxSelfClosingTagName */: return ts.ClassificationTypeNames.jsxSelfClosingTagName;\n            case 22 /* jsxAttribute */: return ts.ClassificationTypeNames.jsxAttribute;\n            case 23 /* jsxText */: return ts.ClassificationTypeNames.jsxText;\n            case 24 /* jsxAttributeStringLiteralValue */: return ts.ClassificationTypeNames.jsxAttributeStringLiteralValue;\n        }\n    }\n    function convertClassifications(classifications) {\n        ts.Debug.assert(classifications.spans.length % 3 === 0);\n        var dense = classifications.spans;\n        var result = [];\n        for (var i = 0, n = dense.length; i < n; i += 3) {\n            result.push({\n                textSpan: ts.createTextSpan(dense[i], dense[i + 1]),\n                classificationType: getClassificationTypeName(dense[i + 2])\n            });\n        }\n        return result;\n    }\n    /* @internal */\n    function getSyntacticClassifications(cancellationToken, sourceFile, span) {\n        return convertClassifications(getEncodedSyntacticClassifications(cancellationToken, sourceFile, span));\n    }\n    ts.getSyntacticClassifications = getSyntacticClassifications;\n    /* @internal */\n    function getEncodedSyntacticClassifications(cancellationToken, sourceFile, span) {\n        var spanStart = span.start;\n        var spanLength = span.length;\n        // Make a scanner we can get trivia from.\n        var triviaScanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);\n        var mergeConflictScanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);\n        var result = [];\n        processElement(sourceFile);\n        return { spans: result, endOfLineState: 0 /* None */ };\n        function pushClassification(start, length, type) {\n            result.push(start);\n            result.push(length);\n            result.push(type);\n        }\n        function classifyLeadingTriviaAndGetTokenStart(token) {\n            triviaScanner.setTextPos(token.pos);\n            while (true) {\n                var start = triviaScanner.getTextPos();\n                // only bother scanning if we have something that could be trivia.\n                if (!ts.couldStartTrivia(sourceFile.text, start)) {\n                    return start;\n                }\n                var kind = triviaScanner.scan();\n                var end = triviaScanner.getTextPos();\n                var width = end - start;\n                // The moment we get something that isn't trivia, then stop processing.\n                if (!ts.isTrivia(kind)) {\n                    return start;\n                }\n                // Don't bother with newlines/whitespace.\n                if (kind === 4 /* NewLineTrivia */ || kind === 5 /* WhitespaceTrivia */) {\n                    continue;\n                }\n                // Only bother with the trivia if it at least intersects the span of interest.\n                if (ts.isComment(kind)) {\n                    classifyComment(token, kind, start, width);\n                    // Classifying a comment might cause us to reuse the trivia scanner\n                    // (because of jsdoc comments).  So after we classify the comment make\n                    // sure we set the scanner position back to where it needs to be.\n                    triviaScanner.setTextPos(end);\n                    continue;\n                }\n                if (kind === 7 /* ConflictMarkerTrivia */) {\n                    var text = sourceFile.text;\n                    var ch = text.charCodeAt(start);\n                    // for the <<<<<<< and >>>>>>> markers, we just add them in as comments\n                    // in the classification stream.\n                    if (ch === 60 /* lessThan */ || ch === 62 /* greaterThan */) {\n                        pushClassification(start, width, 1 /* comment */);\n                        continue;\n                    }\n                    // for the ======== add a comment for the first line, and then lex all\n                    // subsequent lines up until the end of the conflict marker.\n                    ts.Debug.assert(ch === 61 /* equals */);\n                    classifyDisabledMergeCode(text, start, end);\n                }\n            }\n        }\n        function classifyComment(token, kind, start, width) {\n            if (kind === 3 /* MultiLineCommentTrivia */) {\n                // See if this is a doc comment.  If so, we'll classify certain portions of it\n                // specially.\n                var docCommentAndDiagnostics = ts.parseIsolatedJSDocComment(sourceFile.text, start, width);\n                if (docCommentAndDiagnostics && docCommentAndDiagnostics.jsDoc) {\n                    docCommentAndDiagnostics.jsDoc.parent = token;\n                    classifyJSDocComment(docCommentAndDiagnostics.jsDoc);\n                    return;\n                }\n            }\n            // Simple comment.  Just add as is.\n            pushCommentRange(start, width);\n        }\n        function pushCommentRange(start, width) {\n            pushClassification(start, width, 1 /* comment */);\n        }\n        function classifyJSDocComment(docComment) {\n            var pos = docComment.pos;\n            if (docComment.tags) {\n                for (var _i = 0, _a = docComment.tags; _i < _a.length; _i++) {\n                    var tag = _a[_i];\n                    // As we walk through each tag, classify the portion of text from the end of\n                    // the last tag (or the start of the entire doc comment) as 'comment'.\n                    if (tag.pos !== pos) {\n                        pushCommentRange(pos, tag.pos - pos);\n                    }\n                    pushClassification(tag.atToken.pos, tag.atToken.end - tag.atToken.pos, 10 /* punctuation */);\n                    pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */);\n                    pos = tag.tagName.end;\n                    switch (tag.kind) {\n                        case 281 /* JSDocParameterTag */:\n                            processJSDocParameterTag(tag);\n                            break;\n                        case 284 /* JSDocTemplateTag */:\n                            processJSDocTemplateTag(tag);\n                            break;\n                        case 283 /* JSDocTypeTag */:\n                            processElement(tag.typeExpression);\n                            break;\n                        case 282 /* JSDocReturnTag */:\n                            processElement(tag.typeExpression);\n                            break;\n                    }\n                    pos = tag.end;\n                }\n            }\n            if (pos !== docComment.end) {\n                pushCommentRange(pos, docComment.end - pos);\n            }\n            return;\n            function processJSDocParameterTag(tag) {\n                if (tag.preParameterName) {\n                    pushCommentRange(pos, tag.preParameterName.pos - pos);\n                    pushClassification(tag.preParameterName.pos, tag.preParameterName.end - tag.preParameterName.pos, 17 /* parameterName */);\n                    pos = tag.preParameterName.end;\n                }\n                if (tag.typeExpression) {\n                    pushCommentRange(pos, tag.typeExpression.pos - pos);\n                    processElement(tag.typeExpression);\n                    pos = tag.typeExpression.end;\n                }\n                if (tag.postParameterName) {\n                    pushCommentRange(pos, tag.postParameterName.pos - pos);\n                    pushClassification(tag.postParameterName.pos, tag.postParameterName.end - tag.postParameterName.pos, 17 /* parameterName */);\n                    pos = tag.postParameterName.end;\n                }\n            }\n        }\n        function processJSDocTemplateTag(tag) {\n            for (var _i = 0, _a = tag.getChildren(); _i < _a.length; _i++) {\n                var child = _a[_i];\n                processElement(child);\n            }\n        }\n        function classifyDisabledMergeCode(text, start, end) {\n            // Classify the line that the ======= marker is on as a comment.  Then just lex\n            // all further tokens and add them to the result.\n            var i;\n            for (i = start; i < end; i++) {\n                if (ts.isLineBreak(text.charCodeAt(i))) {\n                    break;\n                }\n            }\n            pushClassification(start, i - start, 1 /* comment */);\n            mergeConflictScanner.setTextPos(i);\n            while (mergeConflictScanner.getTextPos() < end) {\n                classifyDisabledCodeToken();\n            }\n        }\n        function classifyDisabledCodeToken() {\n            var start = mergeConflictScanner.getTextPos();\n            var tokenKind = mergeConflictScanner.scan();\n            var end = mergeConflictScanner.getTextPos();\n            var type = classifyTokenType(tokenKind);\n            if (type) {\n                pushClassification(start, end - start, type);\n            }\n        }\n        /**\n         * Returns true if node should be treated as classified and no further processing is required.\n         * False will mean that node is not classified and traverse routine should recurse into node contents.\n         */\n        function tryClassifyNode(node) {\n            if (ts.isJSDocTag(node)) {\n                return true;\n            }\n            if (ts.nodeIsMissing(node)) {\n                return true;\n            }\n            var classifiedElementName = tryClassifyJsxElementName(node);\n            if (!ts.isToken(node) && node.kind !== 10 /* JsxText */ && classifiedElementName === undefined) {\n                return false;\n            }\n            var tokenStart = node.kind === 10 /* JsxText */ ? node.pos : classifyLeadingTriviaAndGetTokenStart(node);\n            var tokenWidth = node.end - tokenStart;\n            ts.Debug.assert(tokenWidth >= 0);\n            if (tokenWidth > 0) {\n                var type = classifiedElementName || classifyTokenType(node.kind, node);\n                if (type) {\n                    pushClassification(tokenStart, tokenWidth, type);\n                }\n            }\n            return true;\n        }\n        function tryClassifyJsxElementName(token) {\n            switch (token.parent && token.parent.kind) {\n                case 248 /* JsxOpeningElement */:\n                    if (token.parent.tagName === token) {\n                        return 19 /* jsxOpenTagName */;\n                    }\n                    break;\n                case 249 /* JsxClosingElement */:\n                    if (token.parent.tagName === token) {\n                        return 20 /* jsxCloseTagName */;\n                    }\n                    break;\n                case 247 /* JsxSelfClosingElement */:\n                    if (token.parent.tagName === token) {\n                        return 21 /* jsxSelfClosingTagName */;\n                    }\n                    break;\n                case 250 /* JsxAttribute */:\n                    if (token.parent.name === token) {\n                        return 22 /* jsxAttribute */;\n                    }\n                    break;\n            }\n            return undefined;\n        }\n        // for accurate classification, the actual token should be passed in.  however, for\n        // cases like 'disabled merge code' classification, we just get the token kind and\n        // classify based on that instead.\n        function classifyTokenType(tokenKind, token) {\n            if (ts.isKeyword(tokenKind)) {\n                return 3 /* keyword */;\n            }\n            // Special case < and >  If they appear in a generic context they are punctuation,\n            // not operators.\n            if (tokenKind === 26 /* LessThanToken */ || tokenKind === 28 /* GreaterThanToken */) {\n                // If the node owning the token has a type argument list or type parameter list, then\n                // we can effectively assume that a '<' and '>' belong to those lists.\n                if (token && ts.getTypeArgumentOrTypeParameterList(token.parent)) {\n                    return 10 /* punctuation */;\n                }\n            }\n            if (ts.isPunctuation(tokenKind)) {\n                if (token) {\n                    if (tokenKind === 57 /* EqualsToken */) {\n                        // the '=' in a variable declaration is special cased here.\n                        if (token.parent.kind === 223 /* VariableDeclaration */ ||\n                            token.parent.kind === 147 /* PropertyDeclaration */ ||\n                            token.parent.kind === 144 /* Parameter */ ||\n                            token.parent.kind === 250 /* JsxAttribute */) {\n                            return 5 /* operator */;\n                        }\n                    }\n                    if (token.parent.kind === 192 /* BinaryExpression */ ||\n                        token.parent.kind === 190 /* PrefixUnaryExpression */ ||\n                        token.parent.kind === 191 /* PostfixUnaryExpression */ ||\n                        token.parent.kind === 193 /* ConditionalExpression */) {\n                        return 5 /* operator */;\n                    }\n                }\n                return 10 /* punctuation */;\n            }\n            else if (tokenKind === 8 /* NumericLiteral */) {\n                return 4 /* numericLiteral */;\n            }\n            else if (tokenKind === 9 /* StringLiteral */) {\n                return token.parent.kind === 250 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */;\n            }\n            else if (tokenKind === 11 /* RegularExpressionLiteral */) {\n                // TODO: we should get another classification type for these literals.\n                return 6 /* stringLiteral */;\n            }\n            else if (ts.isTemplateLiteralKind(tokenKind)) {\n                // TODO (drosen): we should *also* get another classification type for these literals.\n                return 6 /* stringLiteral */;\n            }\n            else if (tokenKind === 10 /* JsxText */) {\n                return 23 /* jsxText */;\n            }\n            else if (tokenKind === 70 /* Identifier */) {\n                if (token) {\n                    switch (token.parent.kind) {\n                        case 226 /* ClassDeclaration */:\n                            if (token.parent.name === token) {\n                                return 11 /* className */;\n                            }\n                            return;\n                        case 143 /* TypeParameter */:\n                            if (token.parent.name === token) {\n                                return 15 /* typeParameterName */;\n                            }\n                            return;\n                        case 227 /* InterfaceDeclaration */:\n                            if (token.parent.name === token) {\n                                return 13 /* interfaceName */;\n                            }\n                            return;\n                        case 229 /* EnumDeclaration */:\n                            if (token.parent.name === token) {\n                                return 12 /* enumName */;\n                            }\n                            return;\n                        case 230 /* ModuleDeclaration */:\n                            if (token.parent.name === token) {\n                                return 14 /* moduleName */;\n                            }\n                            return;\n                        case 144 /* Parameter */:\n                            if (token.parent.name === token) {\n                                return ts.isThisIdentifier(token) ? 3 /* keyword */ : 17 /* parameterName */;\n                            }\n                            return;\n                    }\n                }\n                return 2 /* identifier */;\n            }\n        }\n        function processElement(element) {\n            if (!element) {\n                return;\n            }\n            // Ignore nodes that don't intersect the original span to classify.\n            if (ts.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) {\n                checkForClassificationCancellation(cancellationToken, element.kind);\n                var children = element.getChildren(sourceFile);\n                for (var i = 0, n = children.length; i < n; i++) {\n                    var child = children[i];\n                    if (!tryClassifyNode(child)) {\n                        // Recurse into our child nodes.\n                        processElement(child);\n                    }\n                }\n            }\n        }\n    }\n    ts.getEncodedSyntacticClassifications = getEncodedSyntacticClassifications;\n})(ts || (ts = {}));\n/// <reference path='../compiler/utilities.ts' />\n/* @internal */\nvar ts;\n(function (ts) {\n    var Completions;\n    (function (Completions) {\n        function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position) {\n            if (ts.isInReferenceComment(sourceFile, position)) {\n                return getTripleSlashReferenceCompletion(sourceFile, position);\n            }\n            if (ts.isInString(sourceFile, position)) {\n                return getStringLiteralCompletionEntries(sourceFile, position);\n            }\n            var completionData = getCompletionData(typeChecker, log, sourceFile, position);\n            if (!completionData) {\n                return undefined;\n            }\n            var symbols = completionData.symbols, isGlobalCompletion = completionData.isGlobalCompletion, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isJsDocTagName = completionData.isJsDocTagName;\n            if (isJsDocTagName) {\n                // If the current position is a jsDoc tag name, only tag names should be provided for completion\n                return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: ts.JsDoc.getAllJsDocCompletionEntries() };\n            }\n            var entries = [];\n            if (ts.isSourceFileJavaScript(sourceFile)) {\n                var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true);\n                ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames));\n            }\n            else {\n                if (!symbols || symbols.length === 0) {\n                    if (sourceFile.languageVariant === 1 /* JSX */ &&\n                        location.parent && location.parent.kind === 249 /* JsxClosingElement */) {\n                        // In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag,\n                        // instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element.\n                        // For example:\n                        //     var x = <div> </ /*1*/>  completion list at \"1\" will contain \"div\" with type any\n                        var tagName = location.parent.parent.openingElement.tagName;\n                        entries.push({\n                            name: tagName.text,\n                            kind: undefined,\n                            kindModifiers: undefined,\n                            sortText: \"0\",\n                        });\n                    }\n                    else {\n                        return undefined;\n                    }\n                }\n                getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true);\n            }\n            // Add keywords if this is not a member completion list\n            if (!isMemberCompletion && !isJsDocTagName) {\n                ts.addRange(entries, keywordCompletions);\n            }\n            return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries };\n            function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) {\n                var entries = [];\n                var nameTable = ts.getNameTable(sourceFile);\n                for (var name_44 in nameTable) {\n                    // Skip identifiers produced only from the current location\n                    if (nameTable[name_44] === position) {\n                        continue;\n                    }\n                    if (!uniqueNames[name_44]) {\n                        uniqueNames[name_44] = name_44;\n                        var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_44), compilerOptions.target, /*performCharacterChecks*/ true);\n                        if (displayName) {\n                            var entry = {\n                                name: displayName,\n                                kind: ts.ScriptElementKind.warning,\n                                kindModifiers: \"\",\n                                sortText: \"1\"\n                            };\n                            entries.push(entry);\n                        }\n                    }\n                }\n                return entries;\n            }\n            function createCompletionEntry(symbol, location, performCharacterChecks) {\n                // Try to get a valid display name for this symbol, if we could not find one, then ignore it.\n                // We would like to only show things that can be added after a dot, so for instance numeric properties can\n                // not be accessed with a dot (a.1 <- invalid)\n                var displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, compilerOptions.target, performCharacterChecks, location);\n                if (!displayName) {\n                    return undefined;\n                }\n                // TODO(drosen): Right now we just permit *all* semantic meanings when calling\n                // 'getSymbolKind' which is permissible given that it is backwards compatible; but\n                // really we should consider passing the meaning for the node so that we don't report\n                // that a suggestion for a value is an interface.  We COULD also just do what\n                // 'getSymbolModifiers' does, which is to use the first declaration.\n                // Use a 'sortText' of 0' so that all symbol completion entries come before any other\n                // entries (like JavaScript identifier entries).\n                return {\n                    name: displayName,\n                    kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location),\n                    kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),\n                    sortText: \"0\",\n                };\n            }\n            function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks) {\n                var start = ts.timestamp();\n                var uniqueNames = ts.createMap();\n                if (symbols) {\n                    for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) {\n                        var symbol = symbols_4[_i];\n                        var entry = createCompletionEntry(symbol, location, performCharacterChecks);\n                        if (entry) {\n                            var id = ts.escapeIdentifier(entry.name);\n                            if (!uniqueNames[id]) {\n                                entries.push(entry);\n                                uniqueNames[id] = id;\n                            }\n                        }\n                    }\n                }\n                log(\"getCompletionsAtPosition: getCompletionEntriesFromSymbols: \" + (ts.timestamp() - start));\n                return uniqueNames;\n            }\n            function getStringLiteralCompletionEntries(sourceFile, position) {\n                var node = ts.findPrecedingToken(position, sourceFile);\n                if (!node || node.kind !== 9 /* StringLiteral */) {\n                    return undefined;\n                }\n                if (node.parent.kind === 257 /* PropertyAssignment */ &&\n                    node.parent.parent.kind === 176 /* ObjectLiteralExpression */ &&\n                    node.parent.name === node) {\n                    // Get quoted name of properties of the object literal expression\n                    // i.e. interface ConfigFiles {\n                    //          'jspm:dev': string\n                    //      }\n                    //      let files: ConfigFiles = {\n                    //          '/*completion position*/'\n                    //      }\n                    //\n                    //      function foo(c: ConfigFiles) {}\n                    //      foo({\n                    //          '/*completion position*/'\n                    //      });\n                    return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent);\n                }\n                else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) {\n                    // Get all names of properties on the expression\n                    // i.e. interface A {\n                    //      'prop1': string\n                    // }\n                    // let a: A;\n                    // a['/*completion position*/']\n                    return getStringLiteralCompletionEntriesFromElementAccess(node.parent);\n                }\n                else if (node.parent.kind === 235 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) {\n                    // Get all known external module names or complete a path to a module\n                    // i.e. import * as ns from \"/*completion position*/\";\n                    //      import x = require(\"/*completion position*/\");\n                    //      var y = require(\"/*completion position*/\");\n                    return getStringLiteralCompletionEntriesFromModuleNames(node);\n                }\n                else {\n                    var argumentInfo = ts.SignatureHelp.getContainingArgumentInfo(node, position, sourceFile);\n                    if (argumentInfo) {\n                        // Get string literal completions from specialized signatures of the target\n                        // i.e. declare function f(a: 'A');\n                        // f(\"/*completion position*/\")\n                        return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo);\n                    }\n                    // Get completion for string literal from string literal type\n                    // i.e. var x: \"hi\" | \"hello\" = \"/*completion position*/\"\n                    return getStringLiteralCompletionEntriesFromContextualType(node);\n                }\n            }\n            function getStringLiteralCompletionEntriesFromPropertyAssignment(element) {\n                var type = typeChecker.getContextualType(element.parent);\n                var entries = [];\n                if (type) {\n                    getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, /*performCharacterChecks*/ false);\n                    if (entries.length) {\n                        return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries };\n                    }\n                }\n            }\n            function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo) {\n                var candidates = [];\n                var entries = [];\n                typeChecker.getResolvedSignature(argumentInfo.invocation, candidates);\n                for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) {\n                    var candidate = candidates_3[_i];\n                    if (candidate.parameters.length > argumentInfo.argumentIndex) {\n                        var parameter = candidate.parameters[argumentInfo.argumentIndex];\n                        addStringLiteralCompletionsFromType(typeChecker.getTypeAtLocation(parameter.valueDeclaration), entries);\n                    }\n                }\n                if (entries.length) {\n                    return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries };\n                }\n                return undefined;\n            }\n            function getStringLiteralCompletionEntriesFromElementAccess(node) {\n                var type = typeChecker.getTypeAtLocation(node.expression);\n                var entries = [];\n                if (type) {\n                    getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, /*performCharacterChecks*/ false);\n                    if (entries.length) {\n                        return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries };\n                    }\n                }\n                return undefined;\n            }\n            function getStringLiteralCompletionEntriesFromContextualType(node) {\n                var type = typeChecker.getContextualType(node);\n                if (type) {\n                    var entries_2 = [];\n                    addStringLiteralCompletionsFromType(type, entries_2);\n                    if (entries_2.length) {\n                        return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries_2 };\n                    }\n                }\n                return undefined;\n            }\n            function addStringLiteralCompletionsFromType(type, result) {\n                if (!type) {\n                    return;\n                }\n                if (type.flags & 65536 /* Union */) {\n                    ts.forEach(type.types, function (t) { return addStringLiteralCompletionsFromType(t, result); });\n                }\n                else {\n                    if (type.flags & 32 /* StringLiteral */) {\n                        result.push({\n                            name: type.text,\n                            kindModifiers: ts.ScriptElementKindModifier.none,\n                            kind: ts.ScriptElementKind.variableElement,\n                            sortText: \"0\"\n                        });\n                    }\n                }\n            }\n            function getStringLiteralCompletionEntriesFromModuleNames(node) {\n                var literalValue = ts.normalizeSlashes(node.text);\n                var scriptPath = node.getSourceFile().path;\n                var scriptDirectory = ts.getDirectoryPath(scriptPath);\n                var span = getDirectoryFragmentTextSpan(node.text, node.getStart() + 1);\n                var entries;\n                if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) {\n                    if (compilerOptions.rootDirs) {\n                        entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ false, span, scriptPath);\n                    }\n                    else {\n                        entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ false, span, scriptPath);\n                    }\n                }\n                else {\n                    // Check for node modules\n                    entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span);\n                }\n                return {\n                    isGlobalCompletion: false,\n                    isMemberCompletion: false,\n                    isNewIdentifierLocation: true,\n                    entries: entries\n                };\n            }\n            /**\n             * Takes a script path and returns paths for all potential folders that could be merged with its\n             * containing folder via the \"rootDirs\" compiler option\n             */\n            function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase) {\n                // Make all paths absolute/normalized if they are not already\n                rootDirs = ts.map(rootDirs, function (rootDirectory) { return ts.normalizePath(ts.isRootedDiskPath(rootDirectory) ? rootDirectory : ts.combinePaths(basePath, rootDirectory)); });\n                // Determine the path to the directory containing the script relative to the root directory it is contained within\n                var relativeDirectory;\n                for (var _i = 0, rootDirs_1 = rootDirs; _i < rootDirs_1.length; _i++) {\n                    var rootDirectory = rootDirs_1[_i];\n                    if (ts.containsPath(rootDirectory, scriptPath, basePath, ignoreCase)) {\n                        relativeDirectory = scriptPath.substr(rootDirectory.length);\n                        break;\n                    }\n                }\n                // Now find a path for each potential directory that is to be merged with the one containing the script\n                return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); }));\n            }\n            function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, exclude) {\n                var basePath = compilerOptions.project || host.getCurrentDirectory();\n                var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());\n                var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase);\n                var result = [];\n                for (var _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) {\n                    var baseDirectory = baseDirectories_1[_i];\n                    getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, exclude, result);\n                }\n                return result;\n            }\n            /**\n             * Given a path ending at a directory, gets the completions for the path, and filters for those entries containing the basename.\n             */\n            function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, exclude, result) {\n                if (result === void 0) { result = []; }\n                if (fragment === undefined) {\n                    fragment = \"\";\n                }\n                fragment = ts.normalizeSlashes(fragment);\n                /**\n                 * Remove the basename from the path. Note that we don't use the basename to filter completions;\n                 * the client is responsible for refining completions.\n                 */\n                fragment = ts.getDirectoryPath(fragment);\n                if (fragment === \"\") {\n                    fragment = \".\" + ts.directorySeparator;\n                }\n                fragment = ts.ensureTrailingDirectorySeparator(fragment);\n                var absolutePath = normalizeAndPreserveTrailingSlash(ts.isRootedDiskPath(fragment) ? fragment : ts.combinePaths(scriptPath, fragment));\n                var baseDirectory = ts.getDirectoryPath(absolutePath);\n                var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());\n                if (tryDirectoryExists(host, baseDirectory)) {\n                    // Enumerate the available files if possible\n                    var files = tryReadDirectory(host, baseDirectory, extensions, /*exclude*/ undefined, /*include*/ [\"./*\"]);\n                    if (files) {\n                        /**\n                         * Multiple file entries might map to the same truncated name once we remove extensions\n                         * (happens iff includeExtensions === false)so we use a set-like data structure. Eg:\n                         *\n                         * both foo.ts and foo.tsx become foo\n                         */\n                        var foundFiles = ts.createMap();\n                        for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {\n                            var filePath = files_3[_i];\n                            filePath = ts.normalizePath(filePath);\n                            if (exclude && ts.comparePaths(filePath, exclude, scriptPath, ignoreCase) === 0 /* EqualTo */) {\n                                continue;\n                            }\n                            var foundFileName = includeExtensions ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath));\n                            if (!foundFiles[foundFileName]) {\n                                foundFiles[foundFileName] = true;\n                            }\n                        }\n                        for (var foundFile in foundFiles) {\n                            result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span));\n                        }\n                    }\n                    // If possible, get folder completion as well\n                    var directories = tryGetDirectories(host, baseDirectory);\n                    if (directories) {\n                        for (var _a = 0, directories_2 = directories; _a < directories_2.length; _a++) {\n                            var directory = directories_2[_a];\n                            var directoryName = ts.getBaseFileName(ts.normalizePath(directory));\n                            result.push(createCompletionEntryForModule(directoryName, ts.ScriptElementKind.directory, span));\n                        }\n                    }\n                }\n                return result;\n            }\n            /**\n             * Check all of the declared modules and those in node modules. Possible sources of modules:\n             *      Modules that are found by the type checker\n             *      Modules found relative to \"baseUrl\" compliler options (including patterns from \"paths\" compiler option)\n             *      Modules from node_modules (i.e. those listed in package.json)\n             *          This includes all files that are found in node_modules/moduleName/ with acceptable file extensions\n             */\n            function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span) {\n                var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths;\n                var result;\n                if (baseUrl) {\n                    var fileExtensions = ts.getSupportedExtensions(compilerOptions);\n                    var projectDir = compilerOptions.project || host.getCurrentDirectory();\n                    var absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl);\n                    result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, /*includeExtensions*/ false, span);\n                    if (paths) {\n                        for (var path in paths) {\n                            if (paths.hasOwnProperty(path)) {\n                                if (path === \"*\") {\n                                    if (paths[path]) {\n                                        for (var _i = 0, _a = paths[path]; _i < _a.length; _i++) {\n                                            var pattern = _a[_i];\n                                            for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions); _b < _c.length; _b++) {\n                                                var match = _c[_b];\n                                                result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span));\n                                            }\n                                        }\n                                    }\n                                }\n                                else if (ts.startsWith(path, fragment)) {\n                                    var entry = paths[path] && paths[path].length === 1 && paths[path][0];\n                                    if (entry) {\n                                        result.push(createCompletionEntryForModule(path, ts.ScriptElementKind.externalModuleName, span));\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }\n                else {\n                    result = [];\n                }\n                getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result);\n                for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions); _d < _e.length; _d++) {\n                    var moduleName = _e[_d];\n                    result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span));\n                }\n                return result;\n            }\n            function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions) {\n                if (host.readDirectory) {\n                    var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : undefined;\n                    if (parsed) {\n                        // The prefix has two effective parts: the directory path and the base component after the filepath that is not a\n                        // full directory component. For example: directory/path/of/prefix/base*\n                        var normalizedPrefix = normalizeAndPreserveTrailingSlash(parsed.prefix);\n                        var normalizedPrefixDirectory = ts.getDirectoryPath(normalizedPrefix);\n                        var normalizedPrefixBase = ts.getBaseFileName(normalizedPrefix);\n                        var fragmentHasPath = fragment.indexOf(ts.directorySeparator) !== -1;\n                        // Try and expand the prefix to include any path from the fragment so that we can limit the readDirectory call\n                        var expandedPrefixDirectory = fragmentHasPath ? ts.combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + ts.getDirectoryPath(fragment)) : normalizedPrefixDirectory;\n                        var normalizedSuffix = ts.normalizePath(parsed.suffix);\n                        var baseDirectory = ts.combinePaths(baseUrl, expandedPrefixDirectory);\n                        var completePrefix = fragmentHasPath ? baseDirectory : ts.ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase;\n                        // If we have a suffix, then we need to read the directory all the way down. We could create a glob\n                        // that encodes the suffix, but we would have to escape the character \"?\" which readDirectory\n                        // doesn't support. For now, this is safer but slower\n                        var includeGlob = normalizedSuffix ? \"**/*\" : \"./*\";\n                        var matches = tryReadDirectory(host, baseDirectory, fileExtensions, undefined, [includeGlob]);\n                        if (matches) {\n                            var result = [];\n                            // Trim away prefix and suffix\n                            for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) {\n                                var match = matches_1[_i];\n                                var normalizedMatch = ts.normalizePath(match);\n                                if (!ts.endsWith(normalizedMatch, normalizedSuffix) || !ts.startsWith(normalizedMatch, completePrefix)) {\n                                    continue;\n                                }\n                                var start = completePrefix.length;\n                                var length_5 = normalizedMatch.length - start - normalizedSuffix.length;\n                                result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_5)));\n                            }\n                            return result;\n                        }\n                    }\n                }\n                return undefined;\n            }\n            function enumeratePotentialNonRelativeModules(fragment, scriptPath, options) {\n                // Check If this is a nested module\n                var isNestedModule = fragment.indexOf(ts.directorySeparator) !== -1;\n                var moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(ts.directorySeparator)) : undefined;\n                // Get modules that the type checker picked up\n                var ambientModules = ts.map(typeChecker.getAmbientModules(), function (sym) { return ts.stripQuotes(sym.name); });\n                var nonRelativeModules = ts.filter(ambientModules, function (moduleName) { return ts.startsWith(moduleName, fragment); });\n                // Nested modules of the form \"module-name/sub\" need to be adjusted to only return the string\n                // after the last '/' that appears in the fragment because that's where the replacement span\n                // starts\n                if (isNestedModule) {\n                    var moduleNameWithSeperator_1 = ts.ensureTrailingDirectorySeparator(moduleNameFragment);\n                    nonRelativeModules = ts.map(nonRelativeModules, function (moduleName) {\n                        if (ts.startsWith(fragment, moduleNameWithSeperator_1)) {\n                            return moduleName.substr(moduleNameWithSeperator_1.length);\n                        }\n                        return moduleName;\n                    });\n                }\n                if (!options.moduleResolution || options.moduleResolution === ts.ModuleResolutionKind.NodeJs) {\n                    for (var _i = 0, _a = enumerateNodeModulesVisibleToScript(host, scriptPath); _i < _a.length; _i++) {\n                        var visibleModule = _a[_i];\n                        if (!isNestedModule) {\n                            nonRelativeModules.push(visibleModule.moduleName);\n                        }\n                        else if (ts.startsWith(visibleModule.moduleName, moduleNameFragment)) {\n                            var nestedFiles = tryReadDirectory(host, visibleModule.moduleDir, ts.supportedTypeScriptExtensions, /*exclude*/ undefined, /*include*/ [\"./*\"]);\n                            if (nestedFiles) {\n                                for (var _b = 0, nestedFiles_1 = nestedFiles; _b < nestedFiles_1.length; _b++) {\n                                    var f = nestedFiles_1[_b];\n                                    f = ts.normalizePath(f);\n                                    var nestedModule = ts.removeFileExtension(ts.getBaseFileName(f));\n                                    nonRelativeModules.push(nestedModule);\n                                }\n                            }\n                        }\n                    }\n                }\n                return ts.deduplicate(nonRelativeModules);\n            }\n            function getTripleSlashReferenceCompletion(sourceFile, position) {\n                var token = ts.getTokenAtPosition(sourceFile, position);\n                if (!token) {\n                    return undefined;\n                }\n                var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);\n                if (!commentRanges || !commentRanges.length) {\n                    return undefined;\n                }\n                var range = ts.forEach(commentRanges, function (commentRange) { return position >= commentRange.pos && position <= commentRange.end && commentRange; });\n                if (!range) {\n                    return undefined;\n                }\n                var completionInfo = {\n                    /**\n                     * We don't want the editor to offer any other completions, such as snippets, inside a comment.\n                     */\n                    isGlobalCompletion: false,\n                    isMemberCompletion: false,\n                    /**\n                     * The user may type in a path that doesn't yet exist, creating a \"new identifier\"\n                     * with respect to the collection of identifiers the server is aware of.\n                     */\n                    isNewIdentifierLocation: true,\n                    entries: []\n                };\n                var text = sourceFile.text.substr(range.pos, position - range.pos);\n                var match = tripleSlashDirectiveFragmentRegex.exec(text);\n                if (match) {\n                    var prefix = match[1];\n                    var kind = match[2];\n                    var toComplete = match[3];\n                    var scriptPath = ts.getDirectoryPath(sourceFile.path);\n                    if (kind === \"path\") {\n                        // Give completions for a relative path\n                        var span_10 = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length);\n                        completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ true, span_10, sourceFile.path);\n                    }\n                    else {\n                        // Give completions based on the typings available\n                        var span_11 = { start: range.pos + prefix.length, length: match[0].length - prefix.length };\n                        completionInfo.entries = getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span_11);\n                    }\n                }\n                return completionInfo;\n            }\n            function getCompletionEntriesFromTypings(host, options, scriptPath, span, result) {\n                if (result === void 0) { result = []; }\n                // Check for typings specified in compiler options\n                if (options.types) {\n                    for (var _i = 0, _a = options.types; _i < _a.length; _i++) {\n                        var moduleName = _a[_i];\n                        result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span));\n                    }\n                }\n                else if (host.getDirectories) {\n                    var typeRoots = void 0;\n                    try {\n                        // Wrap in try catch because getEffectiveTypeRoots touches the filesystem\n                        typeRoots = ts.getEffectiveTypeRoots(options, host);\n                    }\n                    catch (e) { }\n                    if (typeRoots) {\n                        for (var _b = 0, typeRoots_2 = typeRoots; _b < typeRoots_2.length; _b++) {\n                            var root = typeRoots_2[_b];\n                            getCompletionEntriesFromDirectories(host, root, span, result);\n                        }\n                    }\n                }\n                if (host.getDirectories) {\n                    // Also get all @types typings installed in visible node_modules directories\n                    for (var _c = 0, _d = findPackageJsons(scriptPath); _c < _d.length; _c++) {\n                        var packageJson = _d[_c];\n                        var typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), \"node_modules/@types\");\n                        getCompletionEntriesFromDirectories(host, typesDir, span, result);\n                    }\n                }\n                return result;\n            }\n            function getCompletionEntriesFromDirectories(host, directory, span, result) {\n                if (host.getDirectories && tryDirectoryExists(host, directory)) {\n                    var directories = tryGetDirectories(host, directory);\n                    if (directories) {\n                        for (var _i = 0, directories_3 = directories; _i < directories_3.length; _i++) {\n                            var typeDirectory = directories_3[_i];\n                            typeDirectory = ts.normalizePath(typeDirectory);\n                            result.push(createCompletionEntryForModule(ts.getBaseFileName(typeDirectory), ts.ScriptElementKind.externalModuleName, span));\n                        }\n                    }\n                }\n            }\n            function findPackageJsons(currentDir) {\n                var paths = [];\n                var currentConfigPath;\n                while (true) {\n                    currentConfigPath = ts.findConfigFile(currentDir, function (f) { return tryFileExists(host, f); }, \"package.json\");\n                    if (currentConfigPath) {\n                        paths.push(currentConfigPath);\n                        currentDir = ts.getDirectoryPath(currentConfigPath);\n                        var parent_13 = ts.getDirectoryPath(currentDir);\n                        if (currentDir === parent_13) {\n                            break;\n                        }\n                        currentDir = parent_13;\n                    }\n                    else {\n                        break;\n                    }\n                }\n                return paths;\n            }\n            function enumerateNodeModulesVisibleToScript(host, scriptPath) {\n                var result = [];\n                if (host.readFile && host.fileExists) {\n                    for (var _i = 0, _a = findPackageJsons(scriptPath); _i < _a.length; _i++) {\n                        var packageJson = _a[_i];\n                        var contents = tryReadingPackageJson(packageJson);\n                        if (!contents) {\n                            return;\n                        }\n                        var nodeModulesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), \"node_modules\");\n                        var foundModuleNames = [];\n                        // Provide completions for all non @types dependencies\n                        for (var _b = 0, nodeModulesDependencyKeys_1 = nodeModulesDependencyKeys; _b < nodeModulesDependencyKeys_1.length; _b++) {\n                            var key = nodeModulesDependencyKeys_1[_b];\n                            addPotentialPackageNames(contents[key], foundModuleNames);\n                        }\n                        for (var _c = 0, foundModuleNames_1 = foundModuleNames; _c < foundModuleNames_1.length; _c++) {\n                            var moduleName = foundModuleNames_1[_c];\n                            var moduleDir = ts.combinePaths(nodeModulesDir, moduleName);\n                            result.push({\n                                moduleName: moduleName,\n                                moduleDir: moduleDir\n                            });\n                        }\n                    }\n                }\n                return result;\n                function tryReadingPackageJson(filePath) {\n                    try {\n                        var fileText = tryReadFile(host, filePath);\n                        return fileText ? JSON.parse(fileText) : undefined;\n                    }\n                    catch (e) {\n                        return undefined;\n                    }\n                }\n                function addPotentialPackageNames(dependencies, result) {\n                    if (dependencies) {\n                        for (var dep in dependencies) {\n                            if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, \"@types/\")) {\n                                result.push(dep);\n                            }\n                        }\n                    }\n                }\n            }\n            function createCompletionEntryForModule(name, kind, replacementSpan) {\n                return { name: name, kind: kind, kindModifiers: ts.ScriptElementKindModifier.none, sortText: name, replacementSpan: replacementSpan };\n            }\n            // Replace everything after the last directory seperator that appears\n            function getDirectoryFragmentTextSpan(text, textStart) {\n                var index = text.lastIndexOf(ts.directorySeparator);\n                var offset = index !== -1 ? index + 1 : 0;\n                return { start: textStart + offset, length: text.length - offset };\n            }\n            // Returns true if the path is explicitly relative to the script (i.e. relative to . or ..)\n            function isPathRelativeToScript(path) {\n                if (path && path.length >= 2 && path.charCodeAt(0) === 46 /* dot */) {\n                    var slashIndex = path.length >= 3 && path.charCodeAt(1) === 46 /* dot */ ? 2 : 1;\n                    var slashCharCode = path.charCodeAt(slashIndex);\n                    return slashCharCode === 47 /* slash */ || slashCharCode === 92 /* backslash */;\n                }\n                return false;\n            }\n            function normalizeAndPreserveTrailingSlash(path) {\n                return ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(path)) : ts.normalizePath(path);\n            }\n        }\n        Completions.getCompletionsAtPosition = getCompletionsAtPosition;\n        function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryName) {\n            // Compute all the completion symbols again.\n            var completionData = getCompletionData(typeChecker, log, sourceFile, position);\n            if (completionData) {\n                var symbols = completionData.symbols, location_3 = completionData.location;\n                // Find the symbol with the matching entry name.\n                // We don't need to perform character checks here because we're only comparing the\n                // name against 'entryName' (which is known to be good), not building a new\n                // completion entry.\n                var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_3) === entryName ? s : undefined; });\n                if (symbol) {\n                    var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_3, location_3, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind;\n                    return {\n                        name: entryName,\n                        kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),\n                        kind: symbolKind,\n                        displayParts: displayParts,\n                        documentation: documentation\n                    };\n                }\n            }\n            // Didn't find a symbol with this name.  See if we can find a keyword instead.\n            var keywordCompletion = ts.forEach(keywordCompletions, function (c) { return c.name === entryName; });\n            if (keywordCompletion) {\n                return {\n                    name: entryName,\n                    kind: ts.ScriptElementKind.keyword,\n                    kindModifiers: ts.ScriptElementKindModifier.none,\n                    displayParts: [ts.displayPart(entryName, ts.SymbolDisplayPartKind.keyword)],\n                    documentation: undefined\n                };\n            }\n            return undefined;\n        }\n        Completions.getCompletionEntryDetails = getCompletionEntryDetails;\n        function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryName) {\n            // Compute all the completion symbols again.\n            var completionData = getCompletionData(typeChecker, log, sourceFile, position);\n            if (completionData) {\n                var symbols = completionData.symbols, location_4 = completionData.location;\n                // Find the symbol with the matching entry name.\n                // We don't need to perform character checks here because we're only comparing the\n                // name against 'entryName' (which is known to be good), not building a new\n                // completion entry.\n                return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_4) === entryName ? s : undefined; });\n            }\n            return undefined;\n        }\n        Completions.getCompletionEntrySymbol = getCompletionEntrySymbol;\n        function getCompletionData(typeChecker, log, sourceFile, position) {\n            var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile);\n            var isJsDocTagName = false;\n            var start = ts.timestamp();\n            var currentToken = ts.getTokenAtPosition(sourceFile, position);\n            log(\"getCompletionData: Get current token: \" + (ts.timestamp() - start));\n            start = ts.timestamp();\n            // Completion not allowed inside comments, bail out if this is the case\n            var insideComment = ts.isInsideComment(sourceFile, currentToken, position);\n            log(\"getCompletionData: Is inside comment: \" + (ts.timestamp() - start));\n            if (insideComment) {\n                // The current position is next to the '@' sign, when no tag name being provided yet.\n                // Provide a full list of tag names\n                if (ts.hasDocComment(sourceFile, position) && sourceFile.text.charCodeAt(position - 1) === 64 /* at */) {\n                    isJsDocTagName = true;\n                }\n                // Completion should work inside certain JsDoc tags. For example:\n                //     /** @type {number | string} */\n                // Completion should work in the brackets\n                var insideJsDocTagExpression = false;\n                var tag = ts.getJsDocTagAtPosition(sourceFile, position);\n                if (tag) {\n                    if (tag.tagName.pos <= position && position <= tag.tagName.end) {\n                        isJsDocTagName = true;\n                    }\n                    switch (tag.kind) {\n                        case 283 /* JSDocTypeTag */:\n                        case 281 /* JSDocParameterTag */:\n                        case 282 /* JSDocReturnTag */:\n                            var tagWithExpression = tag;\n                            if (tagWithExpression.typeExpression) {\n                                insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end;\n                            }\n                            break;\n                    }\n                }\n                if (isJsDocTagName) {\n                    return { symbols: undefined, isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, location: undefined, isRightOfDot: false, isJsDocTagName: isJsDocTagName };\n                }\n                if (!insideJsDocTagExpression) {\n                    // Proceed if the current position is in jsDoc tag expression; otherwise it is a normal\n                    // comment or the plain text part of a jsDoc comment, so no completion should be available\n                    log(\"Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment.\");\n                    return undefined;\n                }\n            }\n            start = ts.timestamp();\n            var previousToken = ts.findPrecedingToken(position, sourceFile);\n            log(\"getCompletionData: Get previous token 1: \" + (ts.timestamp() - start));\n            // The decision to provide completion depends on the contextToken, which is determined through the previousToken.\n            // Note: 'previousToken' (and thus 'contextToken') can be undefined if we are the beginning of the file\n            var contextToken = previousToken;\n            // Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS|\n            // Skip this partial identifier and adjust the contextToken to the token that precedes it.\n            if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) {\n                var start_2 = ts.timestamp();\n                contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile);\n                log(\"getCompletionData: Get previous token 2: \" + (ts.timestamp() - start_2));\n            }\n            // Find the node where completion is requested on.\n            // Also determine whether we are trying to complete with members of that node\n            // or attributes of a JSX tag.\n            var node = currentToken;\n            var isRightOfDot = false;\n            var isRightOfOpenTag = false;\n            var isStartingCloseTag = false;\n            var location = ts.getTouchingPropertyName(sourceFile, position);\n            if (contextToken) {\n                // Bail out if this is a known invalid completion location\n                if (isCompletionListBlocker(contextToken)) {\n                    log(\"Returning an empty list because completion was requested in an invalid position.\");\n                    return undefined;\n                }\n                var parent_14 = contextToken.parent, kind = contextToken.kind;\n                if (kind === 22 /* DotToken */) {\n                    if (parent_14.kind === 177 /* PropertyAccessExpression */) {\n                        node = contextToken.parent.expression;\n                        isRightOfDot = true;\n                    }\n                    else if (parent_14.kind === 141 /* QualifiedName */) {\n                        node = contextToken.parent.left;\n                        isRightOfDot = true;\n                    }\n                    else {\n                        // There is nothing that precedes the dot, so this likely just a stray character\n                        // or leading into a '...' token. Just bail out instead.\n                        return undefined;\n                    }\n                }\n                else if (sourceFile.languageVariant === 1 /* JSX */) {\n                    if (kind === 26 /* LessThanToken */) {\n                        isRightOfOpenTag = true;\n                        location = contextToken;\n                    }\n                    else if (kind === 40 /* SlashToken */ && contextToken.parent.kind === 249 /* JsxClosingElement */) {\n                        isStartingCloseTag = true;\n                        location = contextToken;\n                    }\n                }\n            }\n            var semanticStart = ts.timestamp();\n            var isGlobalCompletion = false;\n            var isMemberCompletion;\n            var isNewIdentifierLocation;\n            var symbols = [];\n            if (isRightOfDot) {\n                getTypeScriptMemberSymbols();\n            }\n            else if (isRightOfOpenTag) {\n                var tagSymbols = typeChecker.getJsxIntrinsicTagNames();\n                if (tryGetGlobalSymbols()) {\n                    symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & (107455 /* Value */ | 8388608 /* Alias */)); }));\n                }\n                else {\n                    symbols = tagSymbols;\n                }\n                isMemberCompletion = true;\n                isNewIdentifierLocation = false;\n            }\n            else if (isStartingCloseTag) {\n                var tagName = contextToken.parent.parent.openingElement.tagName;\n                var tagSymbol = typeChecker.getSymbolAtLocation(tagName);\n                if (!typeChecker.isUnknownSymbol(tagSymbol)) {\n                    symbols = [tagSymbol];\n                }\n                isMemberCompletion = true;\n                isNewIdentifierLocation = false;\n            }\n            else {\n                // For JavaScript or TypeScript, if we're not after a dot, then just try to get the\n                // global symbols in scope.  These results should be valid for either language as\n                // the set of symbols that can be referenced from this location.\n                if (!tryGetGlobalSymbols()) {\n                    return undefined;\n                }\n            }\n            log(\"getCompletionData: Semantic work: \" + (ts.timestamp() - semanticStart));\n            return { symbols: symbols, isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, location: location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), isJsDocTagName: isJsDocTagName };\n            function getTypeScriptMemberSymbols() {\n                // Right of dot member completion list\n                isGlobalCompletion = false;\n                isMemberCompletion = true;\n                isNewIdentifierLocation = false;\n                if (node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */ || node.kind === 177 /* PropertyAccessExpression */) {\n                    var symbol = typeChecker.getSymbolAtLocation(node);\n                    // This is an alias, follow what it aliases\n                    if (symbol && symbol.flags & 8388608 /* Alias */) {\n                        symbol = typeChecker.getAliasedSymbol(symbol);\n                    }\n                    if (symbol && symbol.flags & 1952 /* HasExports */) {\n                        // Extract module or enum members\n                        var exportedSymbols = typeChecker.getExportsOfModule(symbol);\n                        ts.forEach(exportedSymbols, function (symbol) {\n                            if (typeChecker.isValidPropertyAccess((node.parent), symbol.name)) {\n                                symbols.push(symbol);\n                            }\n                        });\n                    }\n                }\n                var type = typeChecker.getTypeAtLocation(node);\n                addTypeProperties(type);\n            }\n            function addTypeProperties(type) {\n                if (type) {\n                    // Filter private properties\n                    for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) {\n                        var symbol = _a[_i];\n                        if (typeChecker.isValidPropertyAccess((node.parent), symbol.name)) {\n                            symbols.push(symbol);\n                        }\n                    }\n                    if (isJavaScriptFile && type.flags & 65536 /* Union */) {\n                        // In javascript files, for union types, we don't just get the members that\n                        // the individual types have in common, we also include all the members that\n                        // each individual type has.  This is because we're going to add all identifiers\n                        // anyways.  So we might as well elevate the members that were at least part\n                        // of the individual types to a higher status since we know what they are.\n                        var unionType = type;\n                        for (var _b = 0, _c = unionType.types; _b < _c.length; _b++) {\n                            var elementType = _c[_b];\n                            addTypeProperties(elementType);\n                        }\n                    }\n                }\n            }\n            function tryGetGlobalSymbols() {\n                var objectLikeContainer;\n                var namedImportsOrExports;\n                var jsxContainer;\n                if (objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken)) {\n                    return tryGetObjectLikeCompletionSymbols(objectLikeContainer);\n                }\n                if (namedImportsOrExports = tryGetNamedImportsOrExportsForCompletion(contextToken)) {\n                    // cursor is in an import clause\n                    // try to show exported member for imported module\n                    return tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports);\n                }\n                if (jsxContainer = tryGetContainingJsxElement(contextToken)) {\n                    var attrsType = void 0;\n                    if ((jsxContainer.kind === 247 /* JsxSelfClosingElement */) || (jsxContainer.kind === 248 /* JsxOpeningElement */)) {\n                        // Cursor is inside a JSX self-closing element or opening element\n                        attrsType = typeChecker.getJsxElementAttributesType(jsxContainer);\n                        if (attrsType) {\n                            symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes);\n                            isMemberCompletion = true;\n                            isNewIdentifierLocation = false;\n                            return true;\n                        }\n                    }\n                }\n                // Get all entities in the current scope.\n                isMemberCompletion = false;\n                isNewIdentifierLocation = isNewIdentifierDefinitionLocation(contextToken);\n                if (previousToken !== contextToken) {\n                    ts.Debug.assert(!!previousToken, \"Expected 'contextToken' to be defined when different from 'previousToken'.\");\n                }\n                // We need to find the node that will give us an appropriate scope to begin\n                // aggregating completion candidates. This is achieved in 'getScopeNode'\n                // by finding the first node that encompasses a position, accounting for whether a node\n                // is \"complete\" to decide whether a position belongs to the node.\n                //\n                // However, at the end of an identifier, we are interested in the scope of the identifier\n                // itself, but fall outside of the identifier. For instance:\n                //\n                //      xyz => x$\n                //\n                // the cursor is outside of both the 'x' and the arrow function 'xyz => x',\n                // so 'xyz' is not returned in our results.\n                //\n                // We define 'adjustedPosition' so that we may appropriately account for\n                // being at the end of an identifier. The intention is that if requesting completion\n                // at the end of an identifier, it should be effectively equivalent to requesting completion\n                // anywhere inside/at the beginning of the identifier. So in the previous case, the\n                // 'adjustedPosition' will work as if requesting completion in the following:\n                //\n                //      xyz => $x\n                //\n                // If previousToken !== contextToken, then\n                //   - 'contextToken' was adjusted to the token prior to 'previousToken'\n                //      because we were at the end of an identifier.\n                //   - 'previousToken' is defined.\n                var adjustedPosition = previousToken !== contextToken ?\n                    previousToken.getStart() :\n                    position;\n                var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile;\n                if (scopeNode) {\n                    isGlobalCompletion =\n                        scopeNode.kind === 261 /* SourceFile */ ||\n                            scopeNode.kind === 194 /* TemplateExpression */ ||\n                            scopeNode.kind === 252 /* JsxExpression */ ||\n                            ts.isStatement(scopeNode);\n                }\n                /// TODO filter meaning based on the current context\n                var symbolMeanings = 793064 /* Type */ | 107455 /* Value */ | 1920 /* Namespace */ | 8388608 /* Alias */;\n                symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings);\n                return true;\n            }\n            /**\n             * Finds the first node that \"embraces\" the position, so that one may\n             * accurately aggregate locals from the closest containing scope.\n             */\n            function getScopeNode(initialToken, position, sourceFile) {\n                var scope = initialToken;\n                while (scope && !ts.positionBelongsToNode(scope, position, sourceFile)) {\n                    scope = scope.parent;\n                }\n                return scope;\n            }\n            function isCompletionListBlocker(contextToken) {\n                var start = ts.timestamp();\n                var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) ||\n                    isSolelyIdentifierDefinitionLocation(contextToken) ||\n                    isDotOfNumericLiteral(contextToken) ||\n                    isInJsxText(contextToken);\n                log(\"getCompletionsAtPosition: isCompletionListBlocker: \" + (ts.timestamp() - start));\n                return result;\n            }\n            function isInJsxText(contextToken) {\n                if (contextToken.kind === 10 /* JsxText */) {\n                    return true;\n                }\n                if (contextToken.kind === 28 /* GreaterThanToken */ && contextToken.parent) {\n                    if (contextToken.parent.kind === 248 /* JsxOpeningElement */) {\n                        return true;\n                    }\n                    if (contextToken.parent.kind === 249 /* JsxClosingElement */ || contextToken.parent.kind === 247 /* JsxSelfClosingElement */) {\n                        return contextToken.parent.parent && contextToken.parent.parent.kind === 246 /* JsxElement */;\n                    }\n                }\n                return false;\n            }\n            function isNewIdentifierDefinitionLocation(previousToken) {\n                if (previousToken) {\n                    var containingNodeKind = previousToken.parent.kind;\n                    switch (previousToken.kind) {\n                        case 25 /* CommaToken */:\n                            return containingNodeKind === 179 /* CallExpression */ // func( a, |\n                                || containingNodeKind === 150 /* Constructor */ // constructor( a, |   /* public, protected, private keywords are allowed here, so show completion */\n                                || containingNodeKind === 180 /* NewExpression */ // new C(a, |\n                                || containingNodeKind === 175 /* ArrayLiteralExpression */ // [a, |\n                                || containingNodeKind === 192 /* BinaryExpression */ // const x = (a, |\n                                || containingNodeKind === 158 /* FunctionType */; // var x: (s: string, list|\n                        case 18 /* OpenParenToken */:\n                            return containingNodeKind === 179 /* CallExpression */ // func( |\n                                || containingNodeKind === 150 /* Constructor */ // constructor( |\n                                || containingNodeKind === 180 /* NewExpression */ // new C(a|\n                                || containingNodeKind === 183 /* ParenthesizedExpression */ // const x = (a|\n                                || containingNodeKind === 166 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */\n                        case 20 /* OpenBracketToken */:\n                            return containingNodeKind === 175 /* ArrayLiteralExpression */ // [ |\n                                || containingNodeKind === 155 /* IndexSignature */ // [ | : string ]\n                                || containingNodeKind === 142 /* ComputedPropertyName */; // [ |    /* this can become an index signature */\n                        case 127 /* ModuleKeyword */: // module |\n                        case 128 /* NamespaceKeyword */:\n                            return true;\n                        case 22 /* DotToken */:\n                            return containingNodeKind === 230 /* ModuleDeclaration */; // module A.|\n                        case 16 /* OpenBraceToken */:\n                            return containingNodeKind === 226 /* ClassDeclaration */; // class A{ |\n                        case 57 /* EqualsToken */:\n                            return containingNodeKind === 223 /* VariableDeclaration */ // const x = a|\n                                || containingNodeKind === 192 /* BinaryExpression */; // x = a|\n                        case 13 /* TemplateHead */:\n                            return containingNodeKind === 194 /* TemplateExpression */; // `aa ${|\n                        case 14 /* TemplateMiddle */:\n                            return containingNodeKind === 202 /* TemplateSpan */; // `aa ${10} dd ${|\n                        case 113 /* PublicKeyword */:\n                        case 111 /* PrivateKeyword */:\n                        case 112 /* ProtectedKeyword */:\n                            return containingNodeKind === 147 /* PropertyDeclaration */; // class A{ public |\n                    }\n                    // Previous token may have been a keyword that was converted to an identifier.\n                    switch (previousToken.getText()) {\n                        case \"public\":\n                        case \"protected\":\n                        case \"private\":\n                            return true;\n                    }\n                }\n                return false;\n            }\n            function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) {\n                if (contextToken.kind === 9 /* StringLiteral */\n                    || contextToken.kind === 11 /* RegularExpressionLiteral */\n                    || ts.isTemplateLiteralKind(contextToken.kind)) {\n                    var start_3 = contextToken.getStart();\n                    var end = contextToken.getEnd();\n                    // To be \"in\" one of these literals, the position has to be:\n                    //   1. entirely within the token text.\n                    //   2. at the end position of an unterminated token.\n                    //   3. at the end of a regular expression (due to trailing flags like '/foo/g').\n                    if (start_3 < position && position < end) {\n                        return true;\n                    }\n                    if (position === end) {\n                        return !!contextToken.isUnterminated\n                            || contextToken.kind === 11 /* RegularExpressionLiteral */;\n                    }\n                }\n                return false;\n            }\n            /**\n             * Aggregates relevant symbols for completion in object literals and object binding patterns.\n             * Relevant symbols are stored in the captured 'symbols' variable.\n             *\n             * @returns true if 'symbols' was successfully populated; false otherwise.\n             */\n            function tryGetObjectLikeCompletionSymbols(objectLikeContainer) {\n                // We're looking up possible property names from contextual/inferred/declared type.\n                isMemberCompletion = true;\n                var typeForObject;\n                var existingMembers;\n                if (objectLikeContainer.kind === 176 /* ObjectLiteralExpression */) {\n                    // We are completing on contextual types, but may also include properties\n                    // other than those within the declared type.\n                    isNewIdentifierLocation = true;\n                    // If the object literal is being assigned to something of type 'null | { hello: string }',\n                    // it clearly isn't trying to satisfy the 'null' type. So we grab the non-nullable type if possible.\n                    typeForObject = typeChecker.getContextualType(objectLikeContainer);\n                    typeForObject = typeForObject && typeForObject.getNonNullableType();\n                    existingMembers = objectLikeContainer.properties;\n                }\n                else if (objectLikeContainer.kind === 172 /* ObjectBindingPattern */) {\n                    // We are *only* completing on properties from the type being destructured.\n                    isNewIdentifierLocation = false;\n                    var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent);\n                    if (ts.isVariableLike(rootDeclaration)) {\n                        // We don't want to complete using the type acquired by the shape\n                        // of the binding pattern; we are only interested in types acquired\n                        // through type declaration or inference.\n                        // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed -\n                        // type of parameter will flow in from the contextual type of the function\n                        var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type);\n                        if (!canGetType && rootDeclaration.kind === 144 /* Parameter */) {\n                            if (ts.isExpression(rootDeclaration.parent)) {\n                                canGetType = !!typeChecker.getContextualType(rootDeclaration.parent);\n                            }\n                            else if (rootDeclaration.parent.kind === 149 /* MethodDeclaration */ || rootDeclaration.parent.kind === 152 /* SetAccessor */) {\n                                canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent);\n                            }\n                        }\n                        if (canGetType) {\n                            typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer);\n                            existingMembers = objectLikeContainer.elements;\n                        }\n                    }\n                    else {\n                        ts.Debug.fail(\"Root declaration is not variable-like.\");\n                    }\n                }\n                else {\n                    ts.Debug.fail(\"Expected object literal or binding pattern, got \" + objectLikeContainer.kind);\n                }\n                if (!typeForObject) {\n                    return false;\n                }\n                var typeMembers = typeChecker.getPropertiesOfType(typeForObject);\n                if (typeMembers && typeMembers.length > 0) {\n                    // Add filtered items to the completion list\n                    symbols = filterObjectMembersList(typeMembers, existingMembers);\n                }\n                return true;\n            }\n            /**\n             * Aggregates relevant symbols for completion in import clauses and export clauses\n             * whose declarations have a module specifier; for instance, symbols will be aggregated for\n             *\n             *      import { | } from \"moduleName\";\n             *      export { a as foo, | } from \"moduleName\";\n             *\n             * but not for\n             *\n             *      export { | };\n             *\n             * Relevant symbols are stored in the captured 'symbols' variable.\n             *\n             * @returns true if 'symbols' was successfully populated; false otherwise.\n             */\n            function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) {\n                var declarationKind = namedImportsOrExports.kind === 238 /* NamedImports */ ?\n                    235 /* ImportDeclaration */ :\n                    241 /* ExportDeclaration */;\n                var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind);\n                var moduleSpecifier = importOrExportDeclaration.moduleSpecifier;\n                if (!moduleSpecifier) {\n                    return false;\n                }\n                isMemberCompletion = true;\n                isNewIdentifierLocation = false;\n                var exports;\n                var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier);\n                if (moduleSpecifierSymbol) {\n                    exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol);\n                }\n                symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : ts.emptyArray;\n                return true;\n            }\n            /**\n             * Returns the immediate owning object literal or binding pattern of a context token,\n             * on the condition that one exists and that the context implies completion should be given.\n             */\n            function tryGetObjectLikeCompletionContainer(contextToken) {\n                if (contextToken) {\n                    switch (contextToken.kind) {\n                        case 16 /* OpenBraceToken */: // const x = { |\n                        case 25 /* CommaToken */:\n                            var parent_15 = contextToken.parent;\n                            if (parent_15 && (parent_15.kind === 176 /* ObjectLiteralExpression */ || parent_15.kind === 172 /* ObjectBindingPattern */)) {\n                                return parent_15;\n                            }\n                            break;\n                    }\n                }\n                return undefined;\n            }\n            /**\n             * Returns the containing list of named imports or exports of a context token,\n             * on the condition that one exists and that the context implies completion should be given.\n             */\n            function tryGetNamedImportsOrExportsForCompletion(contextToken) {\n                if (contextToken) {\n                    switch (contextToken.kind) {\n                        case 16 /* OpenBraceToken */: // import { |\n                        case 25 /* CommaToken */:\n                            switch (contextToken.parent.kind) {\n                                case 238 /* NamedImports */:\n                                case 242 /* NamedExports */:\n                                    return contextToken.parent;\n                            }\n                    }\n                }\n                return undefined;\n            }\n            function tryGetContainingJsxElement(contextToken) {\n                if (contextToken) {\n                    var parent_16 = contextToken.parent;\n                    switch (contextToken.kind) {\n                        case 27 /* LessThanSlashToken */:\n                        case 40 /* SlashToken */:\n                        case 70 /* Identifier */:\n                        case 250 /* JsxAttribute */:\n                        case 251 /* JsxSpreadAttribute */:\n                            if (parent_16 && (parent_16.kind === 247 /* JsxSelfClosingElement */ || parent_16.kind === 248 /* JsxOpeningElement */)) {\n                                return parent_16;\n                            }\n                            else if (parent_16.kind === 250 /* JsxAttribute */) {\n                                return parent_16.parent;\n                            }\n                            break;\n                        // The context token is the closing } or \" of an attribute, which means\n                        // its parent is a JsxExpression, whose parent is a JsxAttribute,\n                        // whose parent is a JsxOpeningLikeElement\n                        case 9 /* StringLiteral */:\n                            if (parent_16 && ((parent_16.kind === 250 /* JsxAttribute */) || (parent_16.kind === 251 /* JsxSpreadAttribute */))) {\n                                return parent_16.parent;\n                            }\n                            break;\n                        case 17 /* CloseBraceToken */:\n                            if (parent_16 &&\n                                parent_16.kind === 252 /* JsxExpression */ &&\n                                parent_16.parent &&\n                                (parent_16.parent.kind === 250 /* JsxAttribute */)) {\n                                return parent_16.parent.parent;\n                            }\n                            if (parent_16 && parent_16.kind === 251 /* JsxSpreadAttribute */) {\n                                return parent_16.parent;\n                            }\n                            break;\n                    }\n                }\n                return undefined;\n            }\n            function isFunction(kind) {\n                switch (kind) {\n                    case 184 /* FunctionExpression */:\n                    case 185 /* ArrowFunction */:\n                    case 225 /* FunctionDeclaration */:\n                    case 149 /* MethodDeclaration */:\n                    case 148 /* MethodSignature */:\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                    case 153 /* CallSignature */:\n                    case 154 /* ConstructSignature */:\n                    case 155 /* IndexSignature */:\n                        return true;\n                }\n                return false;\n            }\n            /**\n             * @returns true if we are certain that the currently edited location must define a new location; false otherwise.\n             */\n            function isSolelyIdentifierDefinitionLocation(contextToken) {\n                var containingNodeKind = contextToken.parent.kind;\n                switch (contextToken.kind) {\n                    case 25 /* CommaToken */:\n                        return containingNodeKind === 223 /* VariableDeclaration */ ||\n                            containingNodeKind === 224 /* VariableDeclarationList */ ||\n                            containingNodeKind === 205 /* VariableStatement */ ||\n                            containingNodeKind === 229 /* EnumDeclaration */ ||\n                            isFunction(containingNodeKind) ||\n                            containingNodeKind === 226 /* ClassDeclaration */ ||\n                            containingNodeKind === 197 /* ClassExpression */ ||\n                            containingNodeKind === 227 /* InterfaceDeclaration */ ||\n                            containingNodeKind === 173 /* ArrayBindingPattern */ ||\n                            containingNodeKind === 228 /* TypeAliasDeclaration */; // type Map, K, |\n                    case 22 /* DotToken */:\n                        return containingNodeKind === 173 /* ArrayBindingPattern */; // var [.|\n                    case 55 /* ColonToken */:\n                        return containingNodeKind === 174 /* BindingElement */; // var {x :html|\n                    case 20 /* OpenBracketToken */:\n                        return containingNodeKind === 173 /* ArrayBindingPattern */; // var [x|\n                    case 18 /* OpenParenToken */:\n                        return containingNodeKind === 256 /* CatchClause */ ||\n                            isFunction(containingNodeKind);\n                    case 16 /* OpenBraceToken */:\n                        return containingNodeKind === 229 /* EnumDeclaration */ ||\n                            containingNodeKind === 227 /* InterfaceDeclaration */ ||\n                            containingNodeKind === 161 /* TypeLiteral */; // const x : { |\n                    case 24 /* SemicolonToken */:\n                        return containingNodeKind === 146 /* PropertySignature */ &&\n                            contextToken.parent && contextToken.parent.parent &&\n                            (contextToken.parent.parent.kind === 227 /* InterfaceDeclaration */ ||\n                                contextToken.parent.parent.kind === 161 /* TypeLiteral */); // const x : { a; |\n                    case 26 /* LessThanToken */:\n                        return containingNodeKind === 226 /* ClassDeclaration */ ||\n                            containingNodeKind === 197 /* ClassExpression */ ||\n                            containingNodeKind === 227 /* InterfaceDeclaration */ ||\n                            containingNodeKind === 228 /* TypeAliasDeclaration */ ||\n                            isFunction(containingNodeKind);\n                    case 114 /* StaticKeyword */:\n                        return containingNodeKind === 147 /* PropertyDeclaration */;\n                    case 23 /* DotDotDotToken */:\n                        return containingNodeKind === 144 /* Parameter */ ||\n                            (contextToken.parent && contextToken.parent.parent &&\n                                contextToken.parent.parent.kind === 173 /* ArrayBindingPattern */); // var [...z|\n                    case 113 /* PublicKeyword */:\n                    case 111 /* PrivateKeyword */:\n                    case 112 /* ProtectedKeyword */:\n                        return containingNodeKind === 144 /* Parameter */;\n                    case 117 /* AsKeyword */:\n                        return containingNodeKind === 239 /* ImportSpecifier */ ||\n                            containingNodeKind === 243 /* ExportSpecifier */ ||\n                            containingNodeKind === 237 /* NamespaceImport */;\n                    case 74 /* ClassKeyword */:\n                    case 82 /* EnumKeyword */:\n                    case 108 /* InterfaceKeyword */:\n                    case 88 /* FunctionKeyword */:\n                    case 103 /* VarKeyword */:\n                    case 124 /* GetKeyword */:\n                    case 133 /* SetKeyword */:\n                    case 90 /* ImportKeyword */:\n                    case 109 /* LetKeyword */:\n                    case 75 /* ConstKeyword */:\n                    case 115 /* YieldKeyword */:\n                    case 136 /* TypeKeyword */:\n                        return true;\n                }\n                // Previous token may have been a keyword that was converted to an identifier.\n                switch (contextToken.getText()) {\n                    case \"abstract\":\n                    case \"async\":\n                    case \"class\":\n                    case \"const\":\n                    case \"declare\":\n                    case \"enum\":\n                    case \"function\":\n                    case \"interface\":\n                    case \"let\":\n                    case \"private\":\n                    case \"protected\":\n                    case \"public\":\n                    case \"static\":\n                    case \"var\":\n                    case \"yield\":\n                        return true;\n                }\n                return false;\n            }\n            function isDotOfNumericLiteral(contextToken) {\n                if (contextToken.kind === 8 /* NumericLiteral */) {\n                    var text = contextToken.getFullText();\n                    return text.charAt(text.length - 1) === \".\";\n                }\n                return false;\n            }\n            /**\n             * Filters out completion suggestions for named imports or exports.\n             *\n             * @param exportsOfModule          The list of symbols which a module exposes.\n             * @param namedImportsOrExports    The list of existing import/export specifiers in the import/export clause.\n             *\n             * @returns Symbols to be suggested at an import/export clause, barring those whose named imports/exports\n             *          do not occur at the current position and have not otherwise been typed.\n             */\n            function filterNamedImportOrExportCompletionItems(exportsOfModule, namedImportsOrExports) {\n                var existingImportsOrExports = ts.createMap();\n                for (var _i = 0, namedImportsOrExports_1 = namedImportsOrExports; _i < namedImportsOrExports_1.length; _i++) {\n                    var element = namedImportsOrExports_1[_i];\n                    // If this is the current item we are editing right now, do not filter it out\n                    if (element.getStart() <= position && position <= element.getEnd()) {\n                        continue;\n                    }\n                    var name_45 = element.propertyName || element.name;\n                    existingImportsOrExports[name_45.text] = true;\n                }\n                if (!ts.someProperties(existingImportsOrExports)) {\n                    return ts.filter(exportsOfModule, function (e) { return e.name !== \"default\"; });\n                }\n                return ts.filter(exportsOfModule, function (e) { return e.name !== \"default\" && !existingImportsOrExports[e.name]; });\n            }\n            /**\n             * Filters out completion suggestions for named imports or exports.\n             *\n             * @returns Symbols to be suggested in an object binding pattern or object literal expression, barring those whose declarations\n             *          do not occur at the current position and have not otherwise been typed.\n             */\n            function filterObjectMembersList(contextualMemberSymbols, existingMembers) {\n                if (!existingMembers || existingMembers.length === 0) {\n                    return contextualMemberSymbols;\n                }\n                var existingMemberNames = ts.createMap();\n                for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) {\n                    var m = existingMembers_1[_i];\n                    // Ignore omitted expressions for missing members\n                    if (m.kind !== 257 /* PropertyAssignment */ &&\n                        m.kind !== 258 /* ShorthandPropertyAssignment */ &&\n                        m.kind !== 174 /* BindingElement */ &&\n                        m.kind !== 149 /* MethodDeclaration */ &&\n                        m.kind !== 151 /* GetAccessor */ &&\n                        m.kind !== 152 /* SetAccessor */) {\n                        continue;\n                    }\n                    // If this is the current item we are editing right now, do not filter it out\n                    if (m.getStart() <= position && position <= m.getEnd()) {\n                        continue;\n                    }\n                    var existingName = void 0;\n                    if (m.kind === 174 /* BindingElement */ && m.propertyName) {\n                        // include only identifiers in completion list\n                        if (m.propertyName.kind === 70 /* Identifier */) {\n                            existingName = m.propertyName.text;\n                        }\n                    }\n                    else {\n                        // TODO(jfreeman): Account for computed property name\n                        // NOTE: if one only performs this step when m.name is an identifier,\n                        // things like '__proto__' are not filtered out.\n                        existingName = m.name.text;\n                    }\n                    existingMemberNames[existingName] = true;\n                }\n                return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames[m.name]; });\n            }\n            /**\n             * Filters out completion suggestions from 'symbols' according to existing JSX attributes.\n             *\n             * @returns Symbols to be suggested in a JSX element, barring those whose attributes\n             *          do not occur at the current position and have not otherwise been typed.\n             */\n            function filterJsxAttributes(symbols, attributes) {\n                var seenNames = ts.createMap();\n                for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) {\n                    var attr = attributes_1[_i];\n                    // If this is the current item we are editing right now, do not filter it out\n                    if (attr.getStart() <= position && position <= attr.getEnd()) {\n                        continue;\n                    }\n                    if (attr.kind === 250 /* JsxAttribute */) {\n                        seenNames[attr.name.text] = true;\n                    }\n                }\n                return ts.filter(symbols, function (a) { return !seenNames[a.name]; });\n            }\n        }\n        /**\n         * Get the name to be display in completion from a given symbol.\n         *\n         * @return undefined if the name is of external module otherwise a name with striped of any quote\n         */\n        function getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, target, performCharacterChecks, location) {\n            var displayName = ts.getDeclaredName(typeChecker, symbol, location);\n            if (displayName) {\n                var firstCharCode = displayName.charCodeAt(0);\n                // First check of the displayName is not external module; if it is an external module, it is not valid entry\n                if ((symbol.flags & 1920 /* Namespace */) && (firstCharCode === 39 /* singleQuote */ || firstCharCode === 34 /* doubleQuote */)) {\n                    // If the symbol is external module, don't show it in the completion list\n                    // (i.e declare module \"http\" { const x; } | // <= request completion here, \"http\" should not be there)\n                    return undefined;\n                }\n            }\n            return getCompletionEntryDisplayName(displayName, target, performCharacterChecks);\n        }\n        /**\n         * Get a displayName from a given for completion list, performing any necessary quotes stripping\n         * and checking whether the name is valid identifier name.\n         */\n        function getCompletionEntryDisplayName(name, target, performCharacterChecks) {\n            if (!name) {\n                return undefined;\n            }\n            name = ts.stripQuotes(name);\n            if (!name) {\n                return undefined;\n            }\n            // If the user entered name for the symbol was quoted, removing the quotes is not enough, as the name could be an\n            // invalid identifier name. We need to check if whatever was inside the quotes is actually a valid identifier name.\n            // e.g \"b a\" is valid quoted name but when we strip off the quotes, it is invalid.\n            // We, thus, need to check if whatever was inside the quotes is actually a valid identifier name.\n            if (performCharacterChecks) {\n                if (!ts.isIdentifierText(name, target)) {\n                    return undefined;\n                }\n            }\n            return name;\n        }\n        // A cache of completion entries for keywords, these do not change between sessions\n        var keywordCompletions = [];\n        for (var i = 71 /* FirstKeyword */; i <= 140 /* LastKeyword */; i++) {\n            keywordCompletions.push({\n                name: ts.tokenToString(i),\n                kind: ts.ScriptElementKind.keyword,\n                kindModifiers: ts.ScriptElementKindModifier.none,\n                sortText: \"0\"\n            });\n        }\n        /**\n         * Matches a triple slash reference directive with an incomplete string literal for its path. Used\n         * to determine if the caret is currently within the string literal and capture the literal fragment\n         * for completions.\n         * For example, this matches\n         *\n         * /// <reference path=\"fragment\n         *\n         * but not\n         *\n         * /// <reference path=\"fragment\"\n         */\n        var tripleSlashDirectiveFragmentRegex = /^(\\/\\/\\/\\s*<reference\\s+(path|types)\\s*=\\s*(?:'|\"))([^\\3\"]*)$/;\n        var nodeModulesDependencyKeys = [\"dependencies\", \"devDependencies\", \"peerDependencies\", \"optionalDependencies\"];\n        function tryGetDirectories(host, directoryName) {\n            return tryIOAndConsumeErrors(host, host.getDirectories, directoryName);\n        }\n        function tryReadDirectory(host, path, extensions, exclude, include) {\n            return tryIOAndConsumeErrors(host, host.readDirectory, path, extensions, exclude, include);\n        }\n        function tryReadFile(host, path) {\n            return tryIOAndConsumeErrors(host, host.readFile, path);\n        }\n        function tryFileExists(host, path) {\n            return tryIOAndConsumeErrors(host, host.fileExists, path);\n        }\n        function tryDirectoryExists(host, path) {\n            try {\n                return ts.directoryProbablyExists(path, host);\n            }\n            catch (e) { }\n            return undefined;\n        }\n        function tryIOAndConsumeErrors(host, toApply) {\n            var args = [];\n            for (var _i = 2; _i < arguments.length; _i++) {\n                args[_i - 2] = arguments[_i];\n            }\n            try {\n                return toApply && toApply.apply(host, args);\n            }\n            catch (e) { }\n            return undefined;\n        }\n    })(Completions = ts.Completions || (ts.Completions = {}));\n})(ts || (ts = {}));\n/* @internal */\nvar ts;\n(function (ts) {\n    var DocumentHighlights;\n    (function (DocumentHighlights) {\n        function getDocumentHighlights(typeChecker, cancellationToken, sourceFile, position, sourceFilesToSearch) {\n            var node = ts.getTouchingWord(sourceFile, position);\n            if (!node) {\n                return undefined;\n            }\n            return getSemanticDocumentHighlights(node) || getSyntacticDocumentHighlights(node);\n            function getHighlightSpanForNode(node) {\n                var start = node.getStart();\n                var end = node.getEnd();\n                return {\n                    fileName: sourceFile.fileName,\n                    textSpan: ts.createTextSpanFromBounds(start, end),\n                    kind: ts.HighlightSpanKind.none\n                };\n            }\n            function getSemanticDocumentHighlights(node) {\n                if (node.kind === 70 /* Identifier */ ||\n                    node.kind === 98 /* ThisKeyword */ ||\n                    node.kind === 167 /* ThisType */ ||\n                    node.kind === 96 /* SuperKeyword */ ||\n                    node.kind === 9 /* StringLiteral */ ||\n                    ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) {\n                    var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFilesToSearch, /*findInStrings*/ false, /*findInComments*/ false, /*implementations*/ false);\n                    return convertReferencedSymbols(referencedSymbols);\n                }\n                return undefined;\n                function convertReferencedSymbols(referencedSymbols) {\n                    if (!referencedSymbols) {\n                        return undefined;\n                    }\n                    var fileNameToDocumentHighlights = ts.createMap();\n                    var result = [];\n                    for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) {\n                        var referencedSymbol = referencedSymbols_1[_i];\n                        for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {\n                            var referenceEntry = _b[_a];\n                            var fileName = referenceEntry.fileName;\n                            var documentHighlights = fileNameToDocumentHighlights[fileName];\n                            if (!documentHighlights) {\n                                documentHighlights = { fileName: fileName, highlightSpans: [] };\n                                fileNameToDocumentHighlights[fileName] = documentHighlights;\n                                result.push(documentHighlights);\n                            }\n                            documentHighlights.highlightSpans.push({\n                                textSpan: referenceEntry.textSpan,\n                                kind: referenceEntry.isWriteAccess ? ts.HighlightSpanKind.writtenReference : ts.HighlightSpanKind.reference\n                            });\n                        }\n                    }\n                    return result;\n                }\n            }\n            function getSyntacticDocumentHighlights(node) {\n                var fileName = sourceFile.fileName;\n                var highlightSpans = getHighlightSpans(node);\n                if (!highlightSpans || highlightSpans.length === 0) {\n                    return undefined;\n                }\n                return [{ fileName: fileName, highlightSpans: highlightSpans }];\n                // returns true if 'node' is defined and has a matching 'kind'.\n                function hasKind(node, kind) {\n                    return node !== undefined && node.kind === kind;\n                }\n                // Null-propagating 'parent' function.\n                function parent(node) {\n                    return node && node.parent;\n                }\n                function getHighlightSpans(node) {\n                    if (node) {\n                        switch (node.kind) {\n                            case 89 /* IfKeyword */:\n                            case 81 /* ElseKeyword */:\n                                if (hasKind(node.parent, 208 /* IfStatement */)) {\n                                    return getIfElseOccurrences(node.parent);\n                                }\n                                break;\n                            case 95 /* ReturnKeyword */:\n                                if (hasKind(node.parent, 216 /* ReturnStatement */)) {\n                                    return getReturnOccurrences(node.parent);\n                                }\n                                break;\n                            case 99 /* ThrowKeyword */:\n                                if (hasKind(node.parent, 220 /* ThrowStatement */)) {\n                                    return getThrowOccurrences(node.parent);\n                                }\n                                break;\n                            case 73 /* CatchKeyword */:\n                                if (hasKind(parent(parent(node)), 221 /* TryStatement */)) {\n                                    return getTryCatchFinallyOccurrences(node.parent.parent);\n                                }\n                                break;\n                            case 101 /* TryKeyword */:\n                            case 86 /* FinallyKeyword */:\n                                if (hasKind(parent(node), 221 /* TryStatement */)) {\n                                    return getTryCatchFinallyOccurrences(node.parent);\n                                }\n                                break;\n                            case 97 /* SwitchKeyword */:\n                                if (hasKind(node.parent, 218 /* SwitchStatement */)) {\n                                    return getSwitchCaseDefaultOccurrences(node.parent);\n                                }\n                                break;\n                            case 72 /* CaseKeyword */:\n                            case 78 /* DefaultKeyword */:\n                                if (hasKind(parent(parent(parent(node))), 218 /* SwitchStatement */)) {\n                                    return getSwitchCaseDefaultOccurrences(node.parent.parent.parent);\n                                }\n                                break;\n                            case 71 /* BreakKeyword */:\n                            case 76 /* ContinueKeyword */:\n                                if (hasKind(node.parent, 215 /* BreakStatement */) || hasKind(node.parent, 214 /* ContinueStatement */)) {\n                                    return getBreakOrContinueStatementOccurrences(node.parent);\n                                }\n                                break;\n                            case 87 /* ForKeyword */:\n                                if (hasKind(node.parent, 211 /* ForStatement */) ||\n                                    hasKind(node.parent, 212 /* ForInStatement */) ||\n                                    hasKind(node.parent, 213 /* ForOfStatement */)) {\n                                    return getLoopBreakContinueOccurrences(node.parent);\n                                }\n                                break;\n                            case 105 /* WhileKeyword */:\n                            case 80 /* DoKeyword */:\n                                if (hasKind(node.parent, 210 /* WhileStatement */) || hasKind(node.parent, 209 /* DoStatement */)) {\n                                    return getLoopBreakContinueOccurrences(node.parent);\n                                }\n                                break;\n                            case 122 /* ConstructorKeyword */:\n                                if (hasKind(node.parent, 150 /* Constructor */)) {\n                                    return getConstructorOccurrences(node.parent);\n                                }\n                                break;\n                            case 124 /* GetKeyword */:\n                            case 133 /* SetKeyword */:\n                                if (hasKind(node.parent, 151 /* GetAccessor */) || hasKind(node.parent, 152 /* SetAccessor */)) {\n                                    return getGetAndSetOccurrences(node.parent);\n                                }\n                                break;\n                            default:\n                                if (ts.isModifierKind(node.kind) && node.parent &&\n                                    (ts.isDeclaration(node.parent) || node.parent.kind === 205 /* VariableStatement */)) {\n                                    return getModifierOccurrences(node.kind, node.parent);\n                                }\n                        }\n                    }\n                    return undefined;\n                }\n                /**\n                 * Aggregates all throw-statements within this node *without* crossing\n                 * into function boundaries and try-blocks with catch-clauses.\n                 */\n                function aggregateOwnedThrowStatements(node) {\n                    var statementAccumulator = [];\n                    aggregate(node);\n                    return statementAccumulator;\n                    function aggregate(node) {\n                        if (node.kind === 220 /* ThrowStatement */) {\n                            statementAccumulator.push(node);\n                        }\n                        else if (node.kind === 221 /* TryStatement */) {\n                            var tryStatement = node;\n                            if (tryStatement.catchClause) {\n                                aggregate(tryStatement.catchClause);\n                            }\n                            else {\n                                // Exceptions thrown within a try block lacking a catch clause\n                                // are \"owned\" in the current context.\n                                aggregate(tryStatement.tryBlock);\n                            }\n                            if (tryStatement.finallyBlock) {\n                                aggregate(tryStatement.finallyBlock);\n                            }\n                        }\n                        else if (!ts.isFunctionLike(node)) {\n                            ts.forEachChild(node, aggregate);\n                        }\n                    }\n                }\n                /**\n                 * For lack of a better name, this function takes a throw statement and returns the\n                 * nearest ancestor that is a try-block (whose try statement has a catch clause),\n                 * function-block, or source file.\n                 */\n                function getThrowStatementOwner(throwStatement) {\n                    var child = throwStatement;\n                    while (child.parent) {\n                        var parent_17 = child.parent;\n                        if (ts.isFunctionBlock(parent_17) || parent_17.kind === 261 /* SourceFile */) {\n                            return parent_17;\n                        }\n                        // A throw-statement is only owned by a try-statement if the try-statement has\n                        // a catch clause, and if the throw-statement occurs within the try block.\n                        if (parent_17.kind === 221 /* TryStatement */) {\n                            var tryStatement = parent_17;\n                            if (tryStatement.tryBlock === child && tryStatement.catchClause) {\n                                return child;\n                            }\n                        }\n                        child = parent_17;\n                    }\n                    return undefined;\n                }\n                function aggregateAllBreakAndContinueStatements(node) {\n                    var statementAccumulator = [];\n                    aggregate(node);\n                    return statementAccumulator;\n                    function aggregate(node) {\n                        if (node.kind === 215 /* BreakStatement */ || node.kind === 214 /* ContinueStatement */) {\n                            statementAccumulator.push(node);\n                        }\n                        else if (!ts.isFunctionLike(node)) {\n                            ts.forEachChild(node, aggregate);\n                        }\n                    }\n                }\n                function ownsBreakOrContinueStatement(owner, statement) {\n                    var actualOwner = getBreakOrContinueOwner(statement);\n                    return actualOwner && actualOwner === owner;\n                }\n                function getBreakOrContinueOwner(statement) {\n                    for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) {\n                        switch (node_1.kind) {\n                            case 218 /* SwitchStatement */:\n                                if (statement.kind === 214 /* ContinueStatement */) {\n                                    continue;\n                                }\n                            // Fall through.\n                            case 211 /* ForStatement */:\n                            case 212 /* ForInStatement */:\n                            case 213 /* ForOfStatement */:\n                            case 210 /* WhileStatement */:\n                            case 209 /* DoStatement */:\n                                if (!statement.label || isLabeledBy(node_1, statement.label.text)) {\n                                    return node_1;\n                                }\n                                break;\n                            default:\n                                // Don't cross function boundaries.\n                                if (ts.isFunctionLike(node_1)) {\n                                    return undefined;\n                                }\n                                break;\n                        }\n                    }\n                    return undefined;\n                }\n                function getModifierOccurrences(modifier, declaration) {\n                    var container = declaration.parent;\n                    // Make sure we only highlight the keyword when it makes sense to do so.\n                    if (ts.isAccessibilityModifier(modifier)) {\n                        if (!(container.kind === 226 /* ClassDeclaration */ ||\n                            container.kind === 197 /* ClassExpression */ ||\n                            (declaration.kind === 144 /* Parameter */ && hasKind(container, 150 /* Constructor */)))) {\n                            return undefined;\n                        }\n                    }\n                    else if (modifier === 114 /* StaticKeyword */) {\n                        if (!(container.kind === 226 /* ClassDeclaration */ || container.kind === 197 /* ClassExpression */)) {\n                            return undefined;\n                        }\n                    }\n                    else if (modifier === 83 /* ExportKeyword */ || modifier === 123 /* DeclareKeyword */) {\n                        if (!(container.kind === 231 /* ModuleBlock */ || container.kind === 261 /* SourceFile */)) {\n                            return undefined;\n                        }\n                    }\n                    else if (modifier === 116 /* AbstractKeyword */) {\n                        if (!(container.kind === 226 /* ClassDeclaration */ || declaration.kind === 226 /* ClassDeclaration */)) {\n                            return undefined;\n                        }\n                    }\n                    else {\n                        // unsupported modifier\n                        return undefined;\n                    }\n                    var keywords = [];\n                    var modifierFlag = getFlagFromModifier(modifier);\n                    var nodes;\n                    switch (container.kind) {\n                        case 231 /* ModuleBlock */:\n                        case 261 /* SourceFile */:\n                            // Container is either a class declaration or the declaration is a classDeclaration\n                            if (modifierFlag & 128 /* Abstract */) {\n                                nodes = declaration.members.concat(declaration);\n                            }\n                            else {\n                                nodes = container.statements;\n                            }\n                            break;\n                        case 150 /* Constructor */:\n                            nodes = container.parameters.concat(container.parent.members);\n                            break;\n                        case 226 /* ClassDeclaration */:\n                        case 197 /* ClassExpression */:\n                            nodes = container.members;\n                            // If we're an accessibility modifier, we're in an instance member and should search\n                            // the constructor's parameter list for instance members as well.\n                            if (modifierFlag & 28 /* AccessibilityModifier */) {\n                                var constructor = ts.forEach(container.members, function (member) {\n                                    return member.kind === 150 /* Constructor */ && member;\n                                });\n                                if (constructor) {\n                                    nodes = nodes.concat(constructor.parameters);\n                                }\n                            }\n                            else if (modifierFlag & 128 /* Abstract */) {\n                                nodes = nodes.concat(container);\n                            }\n                            break;\n                        default:\n                            ts.Debug.fail(\"Invalid container kind.\");\n                    }\n                    ts.forEach(nodes, function (node) {\n                        if (ts.getModifierFlags(node) & modifierFlag) {\n                            ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); });\n                        }\n                    });\n                    return ts.map(keywords, getHighlightSpanForNode);\n                    function getFlagFromModifier(modifier) {\n                        switch (modifier) {\n                            case 113 /* PublicKeyword */:\n                                return 4 /* Public */;\n                            case 111 /* PrivateKeyword */:\n                                return 8 /* Private */;\n                            case 112 /* ProtectedKeyword */:\n                                return 16 /* Protected */;\n                            case 114 /* StaticKeyword */:\n                                return 32 /* Static */;\n                            case 83 /* ExportKeyword */:\n                                return 1 /* Export */;\n                            case 123 /* DeclareKeyword */:\n                                return 2 /* Ambient */;\n                            case 116 /* AbstractKeyword */:\n                                return 128 /* Abstract */;\n                            default:\n                                ts.Debug.fail();\n                        }\n                    }\n                }\n                function pushKeywordIf(keywordList, token) {\n                    var expected = [];\n                    for (var _i = 2; _i < arguments.length; _i++) {\n                        expected[_i - 2] = arguments[_i];\n                    }\n                    if (token && ts.contains(expected, token.kind)) {\n                        keywordList.push(token);\n                        return true;\n                    }\n                    return false;\n                }\n                function getGetAndSetOccurrences(accessorDeclaration) {\n                    var keywords = [];\n                    tryPushAccessorKeyword(accessorDeclaration.symbol, 151 /* GetAccessor */);\n                    tryPushAccessorKeyword(accessorDeclaration.symbol, 152 /* SetAccessor */);\n                    return ts.map(keywords, getHighlightSpanForNode);\n                    function tryPushAccessorKeyword(accessorSymbol, accessorKind) {\n                        var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind);\n                        if (accessor) {\n                            ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 124 /* GetKeyword */, 133 /* SetKeyword */); });\n                        }\n                    }\n                }\n                function getConstructorOccurrences(constructorDeclaration) {\n                    var declarations = constructorDeclaration.symbol.getDeclarations();\n                    var keywords = [];\n                    ts.forEach(declarations, function (declaration) {\n                        ts.forEach(declaration.getChildren(), function (token) {\n                            return pushKeywordIf(keywords, token, 122 /* ConstructorKeyword */);\n                        });\n                    });\n                    return ts.map(keywords, getHighlightSpanForNode);\n                }\n                function getLoopBreakContinueOccurrences(loopNode) {\n                    var keywords = [];\n                    if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87 /* ForKeyword */, 105 /* WhileKeyword */, 80 /* DoKeyword */)) {\n                        // If we succeeded and got a do-while loop, then start looking for a 'while' keyword.\n                        if (loopNode.kind === 209 /* DoStatement */) {\n                            var loopTokens = loopNode.getChildren();\n                            for (var i = loopTokens.length - 1; i >= 0; i--) {\n                                if (pushKeywordIf(keywords, loopTokens[i], 105 /* WhileKeyword */)) {\n                                    break;\n                                }\n                            }\n                        }\n                    }\n                    var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement);\n                    ts.forEach(breaksAndContinues, function (statement) {\n                        if (ownsBreakOrContinueStatement(loopNode, statement)) {\n                            pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */, 76 /* ContinueKeyword */);\n                        }\n                    });\n                    return ts.map(keywords, getHighlightSpanForNode);\n                }\n                function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) {\n                    var owner = getBreakOrContinueOwner(breakOrContinueStatement);\n                    if (owner) {\n                        switch (owner.kind) {\n                            case 211 /* ForStatement */:\n                            case 212 /* ForInStatement */:\n                            case 213 /* ForOfStatement */:\n                            case 209 /* DoStatement */:\n                            case 210 /* WhileStatement */:\n                                return getLoopBreakContinueOccurrences(owner);\n                            case 218 /* SwitchStatement */:\n                                return getSwitchCaseDefaultOccurrences(owner);\n                        }\n                    }\n                    return undefined;\n                }\n                function getSwitchCaseDefaultOccurrences(switchStatement) {\n                    var keywords = [];\n                    pushKeywordIf(keywords, switchStatement.getFirstToken(), 97 /* SwitchKeyword */);\n                    // Go through each clause in the switch statement, collecting the 'case'/'default' keywords.\n                    ts.forEach(switchStatement.caseBlock.clauses, function (clause) {\n                        pushKeywordIf(keywords, clause.getFirstToken(), 72 /* CaseKeyword */, 78 /* DefaultKeyword */);\n                        var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause);\n                        ts.forEach(breaksAndContinues, function (statement) {\n                            if (ownsBreakOrContinueStatement(switchStatement, statement)) {\n                                pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */);\n                            }\n                        });\n                    });\n                    return ts.map(keywords, getHighlightSpanForNode);\n                }\n                function getTryCatchFinallyOccurrences(tryStatement) {\n                    var keywords = [];\n                    pushKeywordIf(keywords, tryStatement.getFirstToken(), 101 /* TryKeyword */);\n                    if (tryStatement.catchClause) {\n                        pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73 /* CatchKeyword */);\n                    }\n                    if (tryStatement.finallyBlock) {\n                        var finallyKeyword = ts.findChildOfKind(tryStatement, 86 /* FinallyKeyword */, sourceFile);\n                        pushKeywordIf(keywords, finallyKeyword, 86 /* FinallyKeyword */);\n                    }\n                    return ts.map(keywords, getHighlightSpanForNode);\n                }\n                function getThrowOccurrences(throwStatement) {\n                    var owner = getThrowStatementOwner(throwStatement);\n                    if (!owner) {\n                        return undefined;\n                    }\n                    var keywords = [];\n                    ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) {\n                        pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* ThrowKeyword */);\n                    });\n                    // If the \"owner\" is a function, then we equate 'return' and 'throw' statements in their\n                    // ability to \"jump out\" of the function, and include occurrences for both.\n                    if (ts.isFunctionBlock(owner)) {\n                        ts.forEachReturnStatement(owner, function (returnStatement) {\n                            pushKeywordIf(keywords, returnStatement.getFirstToken(), 95 /* ReturnKeyword */);\n                        });\n                    }\n                    return ts.map(keywords, getHighlightSpanForNode);\n                }\n                function getReturnOccurrences(returnStatement) {\n                    var func = ts.getContainingFunction(returnStatement);\n                    // If we didn't find a containing function with a block body, bail out.\n                    if (!(func && hasKind(func.body, 204 /* Block */))) {\n                        return undefined;\n                    }\n                    var keywords = [];\n                    ts.forEachReturnStatement(func.body, function (returnStatement) {\n                        pushKeywordIf(keywords, returnStatement.getFirstToken(), 95 /* ReturnKeyword */);\n                    });\n                    // Include 'throw' statements that do not occur within a try block.\n                    ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) {\n                        pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* ThrowKeyword */);\n                    });\n                    return ts.map(keywords, getHighlightSpanForNode);\n                }\n                function getIfElseOccurrences(ifStatement) {\n                    var keywords = [];\n                    // Traverse upwards through all parent if-statements linked by their else-branches.\n                    while (hasKind(ifStatement.parent, 208 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) {\n                        ifStatement = ifStatement.parent;\n                    }\n                    // Now traverse back down through the else branches, aggregating if/else keywords of if-statements.\n                    while (ifStatement) {\n                        var children = ifStatement.getChildren();\n                        pushKeywordIf(keywords, children[0], 89 /* IfKeyword */);\n                        // Generally the 'else' keyword is second-to-last, so we traverse backwards.\n                        for (var i = children.length - 1; i >= 0; i--) {\n                            if (pushKeywordIf(keywords, children[i], 81 /* ElseKeyword */)) {\n                                break;\n                            }\n                        }\n                        if (!hasKind(ifStatement.elseStatement, 208 /* IfStatement */)) {\n                            break;\n                        }\n                        ifStatement = ifStatement.elseStatement;\n                    }\n                    var result = [];\n                    // We'd like to highlight else/ifs together if they are only separated by whitespace\n                    // (i.e. the keywords are separated by no comments, no newlines).\n                    for (var i = 0; i < keywords.length; i++) {\n                        if (keywords[i].kind === 81 /* ElseKeyword */ && i < keywords.length - 1) {\n                            var elseKeyword = keywords[i];\n                            var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword.\n                            var shouldCombindElseAndIf = true;\n                            // Avoid recalculating getStart() by iterating backwards.\n                            for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) {\n                                if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) {\n                                    shouldCombindElseAndIf = false;\n                                    break;\n                                }\n                            }\n                            if (shouldCombindElseAndIf) {\n                                result.push({\n                                    fileName: fileName,\n                                    textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end),\n                                    kind: ts.HighlightSpanKind.reference\n                                });\n                                i++; // skip the next keyword\n                                continue;\n                            }\n                        }\n                        // Ordinary case: just highlight the keyword.\n                        result.push(getHighlightSpanForNode(keywords[i]));\n                    }\n                    return result;\n                }\n            }\n        }\n        DocumentHighlights.getDocumentHighlights = getDocumentHighlights;\n        /**\n         * Whether or not a 'node' is preceded by a label of the given string.\n         * Note: 'node' cannot be a SourceFile.\n         */\n        function isLabeledBy(node, labelName) {\n            for (var owner = node.parent; owner.kind === 219 /* LabeledStatement */; owner = owner.parent) {\n                if (owner.label.text === labelName) {\n                    return true;\n                }\n            }\n            return false;\n        }\n    })(DocumentHighlights = ts.DocumentHighlights || (ts.DocumentHighlights = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) {\n        if (currentDirectory === void 0) { currentDirectory = \"\"; }\n        // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have\n        // for those settings.\n        var buckets = ts.createMap();\n        var getCanonicalFileName = ts.createGetCanonicalFileName(!!useCaseSensitiveFileNames);\n        function getKeyForCompilationSettings(settings) {\n            return \"_\" + settings.target + \"|\" + settings.module + \"|\" + settings.noResolve + \"|\" + settings.jsx + \"|\" + settings.allowJs + \"|\" + settings.baseUrl + \"|\" + JSON.stringify(settings.typeRoots) + \"|\" + JSON.stringify(settings.rootDirs) + \"|\" + JSON.stringify(settings.paths);\n        }\n        function getBucketForCompilationSettings(key, createIfMissing) {\n            var bucket = buckets[key];\n            if (!bucket && createIfMissing) {\n                buckets[key] = bucket = ts.createFileMap();\n            }\n            return bucket;\n        }\n        function reportStats() {\n            var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === \"_\"; }).map(function (name) {\n                var entries = buckets[name];\n                var sourceFiles = [];\n                entries.forEachValue(function (key, entry) {\n                    sourceFiles.push({\n                        name: key,\n                        refCount: entry.languageServiceRefCount,\n                        references: entry.owners.slice(0)\n                    });\n                });\n                sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; });\n                return {\n                    bucket: name,\n                    sourceFiles: sourceFiles\n                };\n            });\n            return JSON.stringify(bucketInfoArray, undefined, 2);\n        }\n        function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) {\n            var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);\n            var key = getKeyForCompilationSettings(compilationSettings);\n            return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind);\n        }\n        function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) {\n            return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ true, scriptKind);\n        }\n        function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) {\n            var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);\n            var key = getKeyForCompilationSettings(compilationSettings);\n            return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind);\n        }\n        function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) {\n            return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ false, scriptKind);\n        }\n        function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) {\n            var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ true);\n            var entry = bucket.get(path);\n            if (!entry) {\n                ts.Debug.assert(acquiring, \"How could we be trying to update a document that the registry doesn't have?\");\n                // Have never seen this file with these settings.  Create a new source file for it.\n                var sourceFile = ts.createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents*/ false, scriptKind);\n                entry = {\n                    sourceFile: sourceFile,\n                    languageServiceRefCount: 0,\n                    owners: []\n                };\n                bucket.set(path, entry);\n            }\n            else {\n                // We have an entry for this file.  However, it may be for a different version of\n                // the script snapshot.  If so, update it appropriately.  Otherwise, we can just\n                // return it as is.\n                if (entry.sourceFile.version !== version) {\n                    entry.sourceFile = ts.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot));\n                }\n            }\n            // If we're acquiring, then this is the first time this LS is asking for this document.\n            // Increase our ref count so we know there's another LS using the document.  If we're\n            // not acquiring, then that means the LS is 'updating' the file instead, and that means\n            // it has already acquired the document previously.  As such, we do not need to increase\n            // the ref count.\n            if (acquiring) {\n                entry.languageServiceRefCount++;\n            }\n            return entry.sourceFile;\n        }\n        function releaseDocument(fileName, compilationSettings) {\n            var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);\n            var key = getKeyForCompilationSettings(compilationSettings);\n            return releaseDocumentWithKey(path, key);\n        }\n        function releaseDocumentWithKey(path, key) {\n            var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ false);\n            ts.Debug.assert(bucket !== undefined);\n            var entry = bucket.get(path);\n            entry.languageServiceRefCount--;\n            ts.Debug.assert(entry.languageServiceRefCount >= 0);\n            if (entry.languageServiceRefCount === 0) {\n                bucket.remove(path);\n            }\n        }\n        return {\n            acquireDocument: acquireDocument,\n            acquireDocumentWithKey: acquireDocumentWithKey,\n            updateDocument: updateDocument,\n            updateDocumentWithKey: updateDocumentWithKey,\n            releaseDocument: releaseDocument,\n            releaseDocumentWithKey: releaseDocumentWithKey,\n            reportStats: reportStats,\n            getKeyForCompilationSettings: getKeyForCompilationSettings\n        };\n    }\n    ts.createDocumentRegistry = createDocumentRegistry;\n})(ts || (ts = {}));\n/* @internal */\nvar ts;\n(function (ts) {\n    var FindAllReferences;\n    (function (FindAllReferences) {\n        function findReferencedSymbols(typeChecker, cancellationToken, sourceFiles, sourceFile, position, findInStrings, findInComments) {\n            var node = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);\n            if (node === sourceFile) {\n                return undefined;\n            }\n            switch (node.kind) {\n                case 8 /* NumericLiteral */:\n                    if (!ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) {\n                        break;\n                    }\n                // Fallthrough\n                case 70 /* Identifier */:\n                case 98 /* ThisKeyword */:\n                // case SyntaxKind.SuperKeyword: TODO:GH#9268\n                case 122 /* ConstructorKeyword */:\n                case 9 /* StringLiteral */:\n                    return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, /*implementations*/ false);\n            }\n            return undefined;\n        }\n        FindAllReferences.findReferencedSymbols = findReferencedSymbols;\n        function getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, implementations) {\n            if (!implementations) {\n                // Labels\n                if (ts.isLabelName(node)) {\n                    if (ts.isJumpStatementTarget(node)) {\n                        var labelDefinition = ts.getTargetLabel(node.parent, node.text);\n                        // if we have a label definition, look within its statement for references, if not, then\n                        // the label is undefined and we have no results..\n                        return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : undefined;\n                    }\n                    else {\n                        // it is a label definition and not a target, search within the parent labeledStatement\n                        return getLabelReferencesInNode(node.parent, node);\n                    }\n                }\n                if (ts.isThis(node)) {\n                    return getReferencesForThisKeyword(node, sourceFiles);\n                }\n                if (node.kind === 96 /* SuperKeyword */) {\n                    return getReferencesForSuperKeyword(node);\n                }\n            }\n            // `getSymbolAtLocation` normally returns the symbol of the class when given the constructor keyword,\n            // so we have to specify that we want the constructor symbol.\n            var symbol = typeChecker.getSymbolAtLocation(node);\n            if (!implementations && !symbol && node.kind === 9 /* StringLiteral */) {\n                return getReferencesForStringLiteral(node, sourceFiles);\n            }\n            // Could not find a symbol e.g. unknown identifier\n            if (!symbol) {\n                // Can't have references to something that we have no symbol for.\n                return undefined;\n            }\n            var declarations = symbol.declarations;\n            // The symbol was an internal symbol and does not have a declaration e.g. undefined symbol\n            if (!declarations || !declarations.length) {\n                return undefined;\n            }\n            var result;\n            // Compute the meaning from the location and the symbol it references\n            var searchMeaning = getIntersectingMeaningFromDeclarations(ts.getMeaningFromLocation(node), declarations);\n            // Get the text to search for.\n            // Note: if this is an external module symbol, the name doesn't include quotes.\n            var declaredName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node));\n            // Try to get the smallest valid scope that we can limit our search to;\n            // otherwise we'll need to search globally (i.e. include each file).\n            var scope = getSymbolScope(symbol);\n            // Maps from a symbol ID to the ReferencedSymbol entry in 'result'.\n            var symbolToIndex = [];\n            if (scope) {\n                result = [];\n                getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex);\n            }\n            else {\n                var internedName = getInternedName(symbol, node);\n                for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) {\n                    var sourceFile = sourceFiles_8[_i];\n                    cancellationToken.throwIfCancellationRequested();\n                    var nameTable = ts.getNameTable(sourceFile);\n                    if (nameTable[internedName] !== undefined) {\n                        result = result || [];\n                        getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex);\n                    }\n                }\n            }\n            return result;\n            function getDefinition(symbol) {\n                var info = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), ts.getContainerNode(node), node);\n                var name = ts.map(info.displayParts, function (p) { return p.text; }).join(\"\");\n                var declarations = symbol.declarations;\n                if (!declarations || declarations.length === 0) {\n                    return undefined;\n                }\n                return {\n                    containerKind: \"\",\n                    containerName: \"\",\n                    name: name,\n                    kind: info.symbolKind,\n                    fileName: declarations[0].getSourceFile().fileName,\n                    textSpan: ts.createTextSpan(declarations[0].getStart(), 0),\n                    displayParts: info.displayParts\n                };\n            }\n            function getAliasSymbolForPropertyNameSymbol(symbol, location) {\n                if (symbol.flags & 8388608 /* Alias */) {\n                    // Default import get alias\n                    var defaultImport = ts.getDeclarationOfKind(symbol, 236 /* ImportClause */);\n                    if (defaultImport) {\n                        return typeChecker.getAliasedSymbol(symbol);\n                    }\n                    var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 239 /* ImportSpecifier */ ||\n                        declaration.kind === 243 /* ExportSpecifier */) ? declaration : undefined; });\n                    if (importOrExportSpecifier &&\n                        // export { a }\n                        (!importOrExportSpecifier.propertyName ||\n                            // export {a as class } where a is location\n                            importOrExportSpecifier.propertyName === location)) {\n                        // If Import specifier -> get alias\n                        // else Export specifier -> get local target\n                        return importOrExportSpecifier.kind === 239 /* ImportSpecifier */ ?\n                            typeChecker.getAliasedSymbol(symbol) :\n                            typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier);\n                    }\n                }\n                return undefined;\n            }\n            function followAliasIfNecessary(symbol, location) {\n                return getAliasSymbolForPropertyNameSymbol(symbol, location) || symbol;\n            }\n            function getPropertySymbolOfDestructuringAssignment(location) {\n                return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) &&\n                    typeChecker.getPropertySymbolOfDestructuringAssignment(location);\n            }\n            function isObjectBindingPatternElementWithoutPropertyName(symbol) {\n                var bindingElement = ts.getDeclarationOfKind(symbol, 174 /* BindingElement */);\n                return bindingElement &&\n                    bindingElement.parent.kind === 172 /* ObjectBindingPattern */ &&\n                    !bindingElement.propertyName;\n            }\n            function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) {\n                if (isObjectBindingPatternElementWithoutPropertyName(symbol)) {\n                    var bindingElement = ts.getDeclarationOfKind(symbol, 174 /* BindingElement */);\n                    var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent);\n                    return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text);\n                }\n                return undefined;\n            }\n            function getInternedName(symbol, location) {\n                // If this is an export or import specifier it could have been renamed using the 'as' syntax.\n                // If so we want to search for whatever under the cursor.\n                if (ts.isImportOrExportSpecifierName(location)) {\n                    return location.getText();\n                }\n                // Try to get the local symbol if we're dealing with an 'export default'\n                // since that symbol has the \"true\" name.\n                var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol);\n                symbol = localExportDefaultSymbol || symbol;\n                return ts.stripQuotes(symbol.name);\n            }\n            /**\n             * Determines the smallest scope in which a symbol may have named references.\n             * Note that not every construct has been accounted for. This function can\n             * probably be improved.\n             *\n             * @returns undefined if the scope cannot be determined, implying that\n             * a reference to a symbol can occur anywhere.\n             */\n            function getSymbolScope(symbol) {\n                // If this is the symbol of a named function expression or named class expression,\n                // then named references are limited to its own scope.\n                var valueDeclaration = symbol.valueDeclaration;\n                if (valueDeclaration && (valueDeclaration.kind === 184 /* FunctionExpression */ || valueDeclaration.kind === 197 /* ClassExpression */)) {\n                    return valueDeclaration;\n                }\n                // If this is private property or method, the scope is the containing class\n                if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) {\n                    var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8 /* Private */) ? d : undefined; });\n                    if (privateDeclaration) {\n                        return ts.getAncestor(privateDeclaration, 226 /* ClassDeclaration */);\n                    }\n                }\n                // If the symbol is an import we would like to find it if we are looking for what it imports.\n                // So consider it visible outside its declaration scope.\n                if (symbol.flags & 8388608 /* Alias */) {\n                    return undefined;\n                }\n                // If symbol is of object binding pattern element without property name we would want to\n                // look for property too and that could be anywhere\n                if (isObjectBindingPatternElementWithoutPropertyName(symbol)) {\n                    return undefined;\n                }\n                // if this symbol is visible from its parent container, e.g. exported, then bail out\n                // if symbol correspond to the union property - bail out\n                if (symbol.parent || (symbol.flags & 268435456 /* SyntheticProperty */)) {\n                    return undefined;\n                }\n                var scope;\n                var declarations = symbol.getDeclarations();\n                if (declarations) {\n                    for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {\n                        var declaration = declarations_7[_i];\n                        var container = ts.getContainerNode(declaration);\n                        if (!container) {\n                            return undefined;\n                        }\n                        if (scope && scope !== container) {\n                            // Different declarations have different containers, bail out\n                            return undefined;\n                        }\n                        if (container.kind === 261 /* SourceFile */ && !ts.isExternalModule(container)) {\n                            // This is a global variable and not an external module, any declaration defined\n                            // within this scope is visible outside the file\n                            return undefined;\n                        }\n                        // The search scope is the container node\n                        scope = container;\n                    }\n                }\n                return scope;\n            }\n            function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) {\n                var positions = [];\n                /// TODO: Cache symbol existence for files to save text search\n                // Also, need to make this work for unicode escapes.\n                // Be resilient in the face of a symbol with no name or zero length name\n                if (!symbolName || !symbolName.length) {\n                    return positions;\n                }\n                var text = sourceFile.text;\n                var sourceLength = text.length;\n                var symbolNameLength = symbolName.length;\n                var position = text.indexOf(symbolName, start);\n                while (position >= 0) {\n                    cancellationToken.throwIfCancellationRequested();\n                    // If we are past the end, stop looking\n                    if (position > end)\n                        break;\n                    // We found a match.  Make sure it's not part of a larger word (i.e. the char\n                    // before and after it have to be a non-identifier char).\n                    var endPosition = position + symbolNameLength;\n                    if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 5 /* Latest */)) &&\n                        (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 5 /* Latest */))) {\n                        // Found a real match.  Keep searching.\n                        positions.push(position);\n                    }\n                    position = text.indexOf(symbolName, position + symbolNameLength + 1);\n                }\n                return positions;\n            }\n            function getLabelReferencesInNode(container, targetLabel) {\n                var references = [];\n                var sourceFile = container.getSourceFile();\n                var labelName = targetLabel.text;\n                var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd());\n                ts.forEach(possiblePositions, function (position) {\n                    cancellationToken.throwIfCancellationRequested();\n                    var node = ts.getTouchingWord(sourceFile, position);\n                    if (!node || node.getWidth() !== labelName.length) {\n                        return;\n                    }\n                    // Only pick labels that are either the target label, or have a target that is the target label\n                    if (node === targetLabel ||\n                        (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel)) {\n                        references.push(getReferenceEntryFromNode(node));\n                    }\n                });\n                var definition = {\n                    containerKind: \"\",\n                    containerName: \"\",\n                    fileName: targetLabel.getSourceFile().fileName,\n                    kind: ts.ScriptElementKind.label,\n                    name: labelName,\n                    textSpan: ts.createTextSpanFromBounds(targetLabel.getStart(), targetLabel.getEnd()),\n                    displayParts: [ts.displayPart(labelName, ts.SymbolDisplayPartKind.text)]\n                };\n                return [{ definition: definition, references: references }];\n            }\n            function isValidReferencePosition(node, searchSymbolName) {\n                if (node) {\n                    // Compare the length so we filter out strict superstrings of the symbol we are looking for\n                    switch (node.kind) {\n                        case 70 /* Identifier */:\n                            return node.getWidth() === searchSymbolName.length;\n                        case 9 /* StringLiteral */:\n                            if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) ||\n                                isNameOfExternalModuleImportOrDeclaration(node)) {\n                                // For string literals we have two additional chars for the quotes\n                                return node.getWidth() === searchSymbolName.length + 2;\n                            }\n                            break;\n                        case 8 /* NumericLiteral */:\n                            if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) {\n                                return node.getWidth() === searchSymbolName.length;\n                            }\n                            break;\n                    }\n                }\n                return false;\n            }\n            /** Search within node \"container\" for references for a search value, where the search value is defined as a\n              * tuple of(searchSymbol, searchText, searchLocation, and searchMeaning).\n              * searchLocation: a node where the search value\n              */\n            function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex) {\n                var sourceFile = container.getSourceFile();\n                var start = findInComments ? container.getFullStart() : container.getStart();\n                var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd());\n                var parents = getParentSymbolsOfPropertyAccess();\n                var inheritsFromCache = ts.createMap();\n                if (possiblePositions.length) {\n                    // Build the set of symbols to search for, initially it has only the current symbol\n                    var searchSymbols_1 = populateSearchSymbolSet(searchSymbol, searchLocation);\n                    ts.forEach(possiblePositions, function (position) {\n                        cancellationToken.throwIfCancellationRequested();\n                        var referenceLocation = ts.getTouchingPropertyName(sourceFile, position);\n                        if (!isValidReferencePosition(referenceLocation, searchText)) {\n                            // This wasn't the start of a token.  Check to see if it might be a\n                            // match in a comment or string if that's what the caller is asking\n                            // for.\n                            if (!implementations && ((findInStrings && ts.isInString(sourceFile, position)) ||\n                                (findInComments && ts.isInNonReferenceComment(sourceFile, position)))) {\n                                // In the case where we're looking inside comments/strings, we don't have\n                                // an actual definition.  So just use 'undefined' here.  Features like\n                                // 'Rename' won't care (as they ignore the definitions), and features like\n                                // 'FindReferences' will just filter out these results.\n                                result.push({\n                                    definition: undefined,\n                                    references: [{\n                                            fileName: sourceFile.fileName,\n                                            textSpan: ts.createTextSpan(position, searchText.length),\n                                            isWriteAccess: false,\n                                            isDefinition: false\n                                        }]\n                                });\n                            }\n                            return;\n                        }\n                        if (!(ts.getMeaningFromLocation(referenceLocation) & searchMeaning)) {\n                            return;\n                        }\n                        var referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation);\n                        if (referenceSymbol) {\n                            var referenceSymbolDeclaration = referenceSymbol.valueDeclaration;\n                            var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration);\n                            var relatedSymbol = getRelatedSymbol(searchSymbols_1, referenceSymbol, referenceLocation, \n                            /*searchLocationIsConstructor*/ searchLocation.kind === 122 /* ConstructorKeyword */, parents, inheritsFromCache);\n                            if (relatedSymbol) {\n                                addReferenceToRelatedSymbol(referenceLocation, relatedSymbol);\n                            }\n                            else if (!(referenceSymbol.flags & 67108864 /* Transient */) && searchSymbols_1.indexOf(shorthandValueSymbol) >= 0) {\n                                addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol);\n                            }\n                            else if (searchLocation.kind === 122 /* ConstructorKeyword */) {\n                                findAdditionalConstructorReferences(referenceSymbol, referenceLocation);\n                            }\n                        }\n                    });\n                }\n                return;\n                /* If we are just looking for implementations and this is a property access expression, we need to get the\n                 * symbol of the local type of the symbol the property is being accessed on. This is because our search\n                 * symbol may have a different parent symbol if the local type's symbol does not declare the property\n                 * being accessed (i.e. it is declared in some parent class or interface)\n                 */\n                function getParentSymbolsOfPropertyAccess() {\n                    if (implementations) {\n                        var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation);\n                        if (propertyAccessExpression) {\n                            var localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression);\n                            if (localParentType) {\n                                if (localParentType.symbol && localParentType.symbol.flags & (32 /* Class */ | 64 /* Interface */) && localParentType.symbol !== searchSymbol.parent) {\n                                    return [localParentType.symbol];\n                                }\n                                else if (localParentType.flags & 196608 /* UnionOrIntersection */) {\n                                    return getSymbolsForClassAndInterfaceComponents(localParentType);\n                                }\n                            }\n                        }\n                    }\n                }\n                function getPropertyAccessExpressionFromRightHandSide(node) {\n                    return ts.isRightSideOfPropertyAccess(node) && node.parent;\n                }\n                /** Adds references when a constructor is used with `new this()` in its own class and `super()` calls in subclasses.  */\n                function findAdditionalConstructorReferences(referenceSymbol, referenceLocation) {\n                    ts.Debug.assert(ts.isClassLike(searchSymbol.valueDeclaration));\n                    var referenceClass = referenceLocation.parent;\n                    if (referenceSymbol === searchSymbol && ts.isClassLike(referenceClass)) {\n                        ts.Debug.assert(referenceClass.name === referenceLocation);\n                        // This is the class declaration containing the constructor.\n                        addReferences(findOwnConstructorCalls(searchSymbol));\n                    }\n                    else {\n                        // If this class appears in `extends C`, then the extending class' \"super\" calls are references.\n                        var classExtending = tryGetClassByExtendingIdentifier(referenceLocation);\n                        if (classExtending && ts.isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation) === searchSymbol) {\n                            addReferences(superConstructorAccesses(classExtending));\n                        }\n                    }\n                }\n                function addReferences(references) {\n                    if (references.length) {\n                        var referencedSymbol = getReferencedSymbol(searchSymbol);\n                        ts.addRange(referencedSymbol.references, ts.map(references, getReferenceEntryFromNode));\n                    }\n                }\n                /** `classSymbol` is the class where the constructor was defined.\n                 * Reference the constructor and all calls to `new this()`.\n                 */\n                function findOwnConstructorCalls(classSymbol) {\n                    var result = [];\n                    for (var _i = 0, _a = classSymbol.members[\"__constructor\"].declarations; _i < _a.length; _i++) {\n                        var decl = _a[_i];\n                        ts.Debug.assert(decl.kind === 150 /* Constructor */);\n                        var ctrKeyword = decl.getChildAt(0);\n                        ts.Debug.assert(ctrKeyword.kind === 122 /* ConstructorKeyword */);\n                        result.push(ctrKeyword);\n                    }\n                    ts.forEachProperty(classSymbol.exports, function (member) {\n                        var decl = member.valueDeclaration;\n                        if (decl && decl.kind === 149 /* MethodDeclaration */) {\n                            var body = decl.body;\n                            if (body) {\n                                forEachDescendantOfKind(body, 98 /* ThisKeyword */, function (thisKeyword) {\n                                    if (ts.isNewExpressionTarget(thisKeyword)) {\n                                        result.push(thisKeyword);\n                                    }\n                                });\n                            }\n                        }\n                    });\n                    return result;\n                }\n                /** Find references to `super` in the constructor of an extending class.  */\n                function superConstructorAccesses(cls) {\n                    var symbol = cls.symbol;\n                    var ctr = symbol.members[\"__constructor\"];\n                    if (!ctr) {\n                        return [];\n                    }\n                    var result = [];\n                    for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) {\n                        var decl = _a[_i];\n                        ts.Debug.assert(decl.kind === 150 /* Constructor */);\n                        var body = decl.body;\n                        if (body) {\n                            forEachDescendantOfKind(body, 96 /* SuperKeyword */, function (node) {\n                                if (ts.isCallExpressionTarget(node)) {\n                                    result.push(node);\n                                }\n                            });\n                        }\n                    }\n                    ;\n                    return result;\n                }\n                function getReferencedSymbol(symbol) {\n                    var symbolId = ts.getSymbolId(symbol);\n                    var index = symbolToIndex[symbolId];\n                    if (index === undefined) {\n                        index = result.length;\n                        symbolToIndex[symbolId] = index;\n                        result.push({\n                            definition: getDefinition(symbol),\n                            references: []\n                        });\n                    }\n                    return result[index];\n                }\n                function addReferenceToRelatedSymbol(node, relatedSymbol) {\n                    var references = getReferencedSymbol(relatedSymbol).references;\n                    if (implementations) {\n                        getImplementationReferenceEntryForNode(node, references);\n                    }\n                    else {\n                        references.push(getReferenceEntryFromNode(node));\n                    }\n                }\n            }\n            function getImplementationReferenceEntryForNode(refNode, result) {\n                // Check if we found a function/propertyAssignment/method with an implementation or initializer\n                if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) {\n                    result.push(getReferenceEntryFromNode(refNode.parent));\n                }\n                else if (refNode.kind === 70 /* Identifier */) {\n                    if (refNode.parent.kind === 258 /* ShorthandPropertyAssignment */) {\n                        // Go ahead and dereference the shorthand assignment by going to its definition\n                        getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result);\n                    }\n                    // Check if the node is within an extends or implements clause\n                    var containingClass = getContainingClassIfInHeritageClause(refNode);\n                    if (containingClass) {\n                        result.push(getReferenceEntryFromNode(containingClass));\n                        return;\n                    }\n                    // If we got a type reference, try and see if the reference applies to any expressions that can implement an interface\n                    var containingTypeReference = getContainingTypeReference(refNode);\n                    if (containingTypeReference) {\n                        var parent_18 = containingTypeReference.parent;\n                        if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) {\n                            maybeAdd(getReferenceEntryFromNode(parent_18.initializer));\n                        }\n                        else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) {\n                            if (parent_18.body.kind === 204 /* Block */) {\n                                ts.forEachReturnStatement(parent_18.body, function (returnStatement) {\n                                    if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) {\n                                        maybeAdd(getReferenceEntryFromNode(returnStatement.expression));\n                                    }\n                                });\n                            }\n                            else if (isImplementationExpression(parent_18.body)) {\n                                maybeAdd(getReferenceEntryFromNode(parent_18.body));\n                            }\n                        }\n                        else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) {\n                            maybeAdd(getReferenceEntryFromNode(parent_18.expression));\n                        }\n                    }\n                }\n                // Type nodes can contain multiple references to the same type. For example:\n                //      let x: Foo & (Foo & Bar) = ...\n                // Because we are returning the implementation locations and not the identifier locations,\n                // duplicate entries would be returned here as each of the type references is part of\n                // the same implementation. For that reason, check before we add a new entry\n                function maybeAdd(a) {\n                    if (!ts.forEach(result, function (b) { return a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length; })) {\n                        result.push(a);\n                    }\n                }\n            }\n            function getSymbolsForClassAndInterfaceComponents(type, result) {\n                if (result === void 0) { result = []; }\n                for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n                    var componentType = _a[_i];\n                    if (componentType.symbol && componentType.symbol.getFlags() & (32 /* Class */ | 64 /* Interface */)) {\n                        result.push(componentType.symbol);\n                    }\n                    if (componentType.getFlags() & 196608 /* UnionOrIntersection */) {\n                        getSymbolsForClassAndInterfaceComponents(componentType, result);\n                    }\n                }\n                return result;\n            }\n            function getContainingTypeReference(node) {\n                var topLevelTypeReference = undefined;\n                while (node) {\n                    if (ts.isTypeNode(node)) {\n                        topLevelTypeReference = node;\n                    }\n                    node = node.parent;\n                }\n                return topLevelTypeReference;\n            }\n            function getContainingClassIfInHeritageClause(node) {\n                if (node && node.parent) {\n                    if (node.kind === 199 /* ExpressionWithTypeArguments */\n                        && node.parent.kind === 255 /* HeritageClause */\n                        && ts.isClassLike(node.parent.parent)) {\n                        return node.parent.parent;\n                    }\n                    else if (node.kind === 70 /* Identifier */ || node.kind === 177 /* PropertyAccessExpression */) {\n                        return getContainingClassIfInHeritageClause(node.parent);\n                    }\n                }\n                return undefined;\n            }\n            /**\n             * Returns true if this is an expression that can be considered an implementation\n             */\n            function isImplementationExpression(node) {\n                // Unwrap parentheses\n                if (node.kind === 183 /* ParenthesizedExpression */) {\n                    return isImplementationExpression(node.expression);\n                }\n                return node.kind === 185 /* ArrowFunction */ ||\n                    node.kind === 184 /* FunctionExpression */ ||\n                    node.kind === 176 /* ObjectLiteralExpression */ ||\n                    node.kind === 197 /* ClassExpression */ ||\n                    node.kind === 175 /* ArrayLiteralExpression */;\n            }\n            /**\n             * Determines if the parent symbol occurs somewhere in the child's ancestry. If the parent symbol\n             * is an interface, determines if some ancestor of the child symbol extends or inherits from it.\n             * Also takes in a cache of previous results which makes this slightly more efficient and is\n             * necessary to avoid potential loops like so:\n             *     class A extends B { }\n             *     class B extends A { }\n             *\n             * We traverse the AST rather than using the type checker because users are typically only interested\n             * in explicit implementations of an interface/class when calling \"Go to Implementation\". Sibling\n             * implementations of types that share a common ancestor with the type whose implementation we are\n             * searching for need to be filtered out of the results. The type checker doesn't let us make the\n             * distinction between structurally compatible implementations and explicit implementations, so we\n             * must use the AST.\n             *\n             * @param child         A class or interface Symbol\n             * @param parent        Another class or interface Symbol\n             * @param cachedResults A map of symbol id pairs (i.e. \"child,parent\") to booleans indicating previous results\n             */\n            function explicitlyInheritsFrom(child, parent, cachedResults) {\n                var parentIsInterface = parent.getFlags() & 64 /* Interface */;\n                return searchHierarchy(child);\n                function searchHierarchy(symbol) {\n                    if (symbol === parent) {\n                        return true;\n                    }\n                    var key = ts.getSymbolId(symbol) + \",\" + ts.getSymbolId(parent);\n                    if (key in cachedResults) {\n                        return cachedResults[key];\n                    }\n                    // Set the key so that we don't infinitely recurse\n                    cachedResults[key] = false;\n                    var inherits = ts.forEach(symbol.getDeclarations(), function (declaration) {\n                        if (ts.isClassLike(declaration)) {\n                            if (parentIsInterface) {\n                                var interfaceReferences = ts.getClassImplementsHeritageClauseElements(declaration);\n                                if (interfaceReferences) {\n                                    for (var _i = 0, interfaceReferences_1 = interfaceReferences; _i < interfaceReferences_1.length; _i++) {\n                                        var typeReference = interfaceReferences_1[_i];\n                                        if (searchTypeReference(typeReference)) {\n                                            return true;\n                                        }\n                                    }\n                                }\n                            }\n                            return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration));\n                        }\n                        else if (declaration.kind === 227 /* InterfaceDeclaration */) {\n                            if (parentIsInterface) {\n                                return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference);\n                            }\n                        }\n                        return false;\n                    });\n                    cachedResults[key] = inherits;\n                    return inherits;\n                }\n                function searchTypeReference(typeReference) {\n                    if (typeReference) {\n                        var type = typeChecker.getTypeAtLocation(typeReference);\n                        if (type && type.symbol) {\n                            return searchHierarchy(type.symbol);\n                        }\n                    }\n                    return false;\n                }\n            }\n            function getReferencesForSuperKeyword(superKeyword) {\n                var searchSpaceNode = ts.getSuperContainer(superKeyword, /*stopOnFunctions*/ false);\n                if (!searchSpaceNode) {\n                    return undefined;\n                }\n                // Whether 'super' occurs in a static context within a class.\n                var staticFlag = 32 /* Static */;\n                switch (searchSpaceNode.kind) {\n                    case 147 /* PropertyDeclaration */:\n                    case 146 /* PropertySignature */:\n                    case 149 /* MethodDeclaration */:\n                    case 148 /* MethodSignature */:\n                    case 150 /* Constructor */:\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                        staticFlag &= ts.getModifierFlags(searchSpaceNode);\n                        searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class\n                        break;\n                    default:\n                        return undefined;\n                }\n                var references = [];\n                var sourceFile = searchSpaceNode.getSourceFile();\n                var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, \"super\", searchSpaceNode.getStart(), searchSpaceNode.getEnd());\n                ts.forEach(possiblePositions, function (position) {\n                    cancellationToken.throwIfCancellationRequested();\n                    var node = ts.getTouchingWord(sourceFile, position);\n                    if (!node || node.kind !== 96 /* SuperKeyword */) {\n                        return;\n                    }\n                    var container = ts.getSuperContainer(node, /*stopOnFunctions*/ false);\n                    // If we have a 'super' container, we must have an enclosing class.\n                    // Now make sure the owning class is the same as the search-space\n                    // and has the same static qualifier as the original 'super's owner.\n                    if (container && (32 /* Static */ & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) {\n                        references.push(getReferenceEntryFromNode(node));\n                    }\n                });\n                var definition = getDefinition(searchSpaceNode.symbol);\n                return [{ definition: definition, references: references }];\n            }\n            function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) {\n                var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false);\n                // Whether 'this' occurs in a static context within a class.\n                var staticFlag = 32 /* Static */;\n                switch (searchSpaceNode.kind) {\n                    case 149 /* MethodDeclaration */:\n                    case 148 /* MethodSignature */:\n                        if (ts.isObjectLiteralMethod(searchSpaceNode)) {\n                            break;\n                        }\n                    // fall through\n                    case 147 /* PropertyDeclaration */:\n                    case 146 /* PropertySignature */:\n                    case 150 /* Constructor */:\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                        staticFlag &= ts.getModifierFlags(searchSpaceNode);\n                        searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class\n                        break;\n                    case 261 /* SourceFile */:\n                        if (ts.isExternalModule(searchSpaceNode)) {\n                            return undefined;\n                        }\n                    // Fall through\n                    case 225 /* FunctionDeclaration */:\n                    case 184 /* FunctionExpression */:\n                        break;\n                    // Computed properties in classes are not handled here because references to this are illegal,\n                    // so there is no point finding references to them.\n                    default:\n                        return undefined;\n                }\n                var references = [];\n                var possiblePositions;\n                if (searchSpaceNode.kind === 261 /* SourceFile */) {\n                    ts.forEach(sourceFiles, function (sourceFile) {\n                        possiblePositions = getPossibleSymbolReferencePositions(sourceFile, \"this\", sourceFile.getStart(), sourceFile.getEnd());\n                        getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references);\n                    });\n                }\n                else {\n                    var sourceFile = searchSpaceNode.getSourceFile();\n                    possiblePositions = getPossibleSymbolReferencePositions(sourceFile, \"this\", searchSpaceNode.getStart(), searchSpaceNode.getEnd());\n                    getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references);\n                }\n                var thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword);\n                var displayParts = thisOrSuperSymbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), ts.getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts;\n                return [{\n                        definition: {\n                            containerKind: \"\",\n                            containerName: \"\",\n                            fileName: node.getSourceFile().fileName,\n                            kind: ts.ScriptElementKind.variableElement,\n                            name: \"this\",\n                            textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()),\n                            displayParts: displayParts\n                        },\n                        references: references\n                    }];\n                function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) {\n                    ts.forEach(possiblePositions, function (position) {\n                        cancellationToken.throwIfCancellationRequested();\n                        var node = ts.getTouchingWord(sourceFile, position);\n                        if (!node || !ts.isThis(node)) {\n                            return;\n                        }\n                        var container = ts.getThisContainer(node, /* includeArrowFunctions */ false);\n                        switch (searchSpaceNode.kind) {\n                            case 184 /* FunctionExpression */:\n                            case 225 /* FunctionDeclaration */:\n                                if (searchSpaceNode.symbol === container.symbol) {\n                                    result.push(getReferenceEntryFromNode(node));\n                                }\n                                break;\n                            case 149 /* MethodDeclaration */:\n                            case 148 /* MethodSignature */:\n                                if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) {\n                                    result.push(getReferenceEntryFromNode(node));\n                                }\n                                break;\n                            case 197 /* ClassExpression */:\n                            case 226 /* ClassDeclaration */:\n                                // Make sure the container belongs to the same class\n                                // and has the appropriate static modifier from the original container.\n                                if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag) {\n                                    result.push(getReferenceEntryFromNode(node));\n                                }\n                                break;\n                            case 261 /* SourceFile */:\n                                if (container.kind === 261 /* SourceFile */ && !ts.isExternalModule(container)) {\n                                    result.push(getReferenceEntryFromNode(node));\n                                }\n                                break;\n                        }\n                    });\n                }\n            }\n            function getReferencesForStringLiteral(node, sourceFiles) {\n                var type = ts.getStringLiteralTypeForNode(node, typeChecker);\n                if (!type) {\n                    // nothing to do here. moving on\n                    return undefined;\n                }\n                var references = [];\n                for (var _i = 0, sourceFiles_9 = sourceFiles; _i < sourceFiles_9.length; _i++) {\n                    var sourceFile = sourceFiles_9[_i];\n                    var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd());\n                    getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references);\n                }\n                return [{\n                        definition: {\n                            containerKind: \"\",\n                            containerName: \"\",\n                            fileName: node.getSourceFile().fileName,\n                            kind: ts.ScriptElementKind.variableElement,\n                            name: type.text,\n                            textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()),\n                            displayParts: [ts.displayPart(ts.getTextOfNode(node), ts.SymbolDisplayPartKind.stringLiteral)]\n                        },\n                        references: references\n                    }];\n                function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) {\n                    for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) {\n                        var position = possiblePositions_1[_i];\n                        cancellationToken.throwIfCancellationRequested();\n                        var node_2 = ts.getTouchingWord(sourceFile, position);\n                        if (!node_2 || node_2.kind !== 9 /* StringLiteral */) {\n                            return;\n                        }\n                        var type_1 = ts.getStringLiteralTypeForNode(node_2, typeChecker);\n                        if (type_1 === searchType) {\n                            references.push(getReferenceEntryFromNode(node_2));\n                        }\n                    }\n                }\n            }\n            function populateSearchSymbolSet(symbol, location) {\n                // The search set contains at least the current symbol\n                var result = [symbol];\n                // If the location is name of property symbol from object literal destructuring pattern\n                // Search the property symbol\n                //      for ( { property: p2 } of elems) { }\n                var containingObjectLiteralElement = getContainingObjectLiteralElement(location);\n                if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 258 /* ShorthandPropertyAssignment */) {\n                    var propertySymbol = getPropertySymbolOfDestructuringAssignment(location);\n                    if (propertySymbol) {\n                        result.push(propertySymbol);\n                    }\n                }\n                // If the symbol is an alias, add what it aliases to the list\n                //     import {a} from \"mod\";\n                //     export {a}\n                // If the symbol is an alias to default declaration, add what it aliases to the list\n                //     declare \"mod\" { export default class B { } }\n                //     import B from \"mod\";\n                //// For export specifiers, the exported name can be referring to a local symbol, e.g.:\n                ////     import {a} from \"mod\";\n                ////     export {a as somethingElse}\n                //// We want the *local* declaration of 'a' as declared in the import,\n                //// *not* as declared within \"mod\" (or farther)\n                var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location);\n                if (aliasSymbol) {\n                    result = result.concat(populateSearchSymbolSet(aliasSymbol, location));\n                }\n                // If the location is in a context sensitive location (i.e. in an object literal) try\n                // to get a contextual type for it, and add the property symbol from the contextual\n                // type to the search set\n                if (containingObjectLiteralElement) {\n                    ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) {\n                        ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol));\n                    });\n                    /* Because in short-hand property assignment, location has two meaning : property name and as value of the property\n                        * When we do findAllReference at the position of the short-hand property assignment, we would want to have references to position of\n                        * property name and variable declaration of the identifier.\n                        * Like in below example, when querying for all references for an identifier 'name', of the property assignment, the language service\n                        * should show both 'name' in 'obj' and 'name' in variable declaration\n                        *      const name = \"Foo\";\n                        *      const obj = { name };\n                        * In order to do that, we will populate the search set with the value symbol of the identifier as a value of the property assignment\n                        * so that when matching with potential reference symbol, both symbols from property declaration and variable declaration\n                        * will be included correctly.\n                        */\n                    var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent);\n                    if (shorthandValueSymbol) {\n                        result.push(shorthandValueSymbol);\n                    }\n                }\n                // If the symbol.valueDeclaration is a property parameter declaration,\n                // we should include both parameter declaration symbol and property declaration symbol\n                // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals.\n                // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members\n                if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 144 /* Parameter */ &&\n                    ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) {\n                    result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name));\n                }\n                // If this is symbol of binding element without propertyName declaration in Object binding pattern\n                // Include the property in the search\n                var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol);\n                if (bindingElementPropertySymbol) {\n                    result.push(bindingElementPropertySymbol);\n                }\n                // If this is a union property, add all the symbols from all its source symbols in all unioned types.\n                // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list\n                ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) {\n                    if (rootSymbol !== symbol) {\n                        result.push(rootSymbol);\n                    }\n                    // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions\n                    if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) {\n                        getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ ts.createMap());\n                    }\n                });\n                return result;\n            }\n            /**\n             * Find symbol of the given property-name and add the symbol to the given result array\n             * @param symbol a symbol to start searching for the given propertyName\n             * @param propertyName a name of property to search for\n             * @param result an array of symbol of found property symbols\n             * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol.\n             *                                The value of previousIterationSymbol is undefined when the function is first called.\n             */\n            function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) {\n                if (!symbol) {\n                    return;\n                }\n                // If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited\n                // This is particularly important for the following cases, so that we do not infinitely visit the same symbol.\n                // For example:\n                //      interface C extends C {\n                //          /*findRef*/propName: string;\n                //      }\n                // The first time getPropertySymbolsFromBaseTypes is called when finding-all-references at propName,\n                // the symbol argument will be the symbol of an interface \"C\" and previousIterationSymbol is undefined,\n                // the function will add any found symbol of the property-name, then its sub-routine will call\n                // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already\n                // visited symbol, interface \"C\", the sub-routine will pass the current symbol as previousIterationSymbol.\n                if (symbol.name in previousIterationSymbolsCache) {\n                    return;\n                }\n                if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) {\n                    ts.forEach(symbol.getDeclarations(), function (declaration) {\n                        if (ts.isClassLike(declaration)) {\n                            getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration));\n                            ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference);\n                        }\n                        else if (declaration.kind === 227 /* InterfaceDeclaration */) {\n                            ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference);\n                        }\n                    });\n                }\n                return;\n                function getPropertySymbolFromTypeReference(typeReference) {\n                    if (typeReference) {\n                        var type = typeChecker.getTypeAtLocation(typeReference);\n                        if (type) {\n                            var propertySymbol = typeChecker.getPropertyOfType(type, propertyName);\n                            if (propertySymbol) {\n                                result.push.apply(result, typeChecker.getRootSymbols(propertySymbol));\n                            }\n                            // Visit the typeReference as well to see if it directly or indirectly use that property\n                            previousIterationSymbolsCache[symbol.name] = symbol;\n                            getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache);\n                        }\n                    }\n                }\n            }\n            function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocationIsConstructor, parents, cache) {\n                if (ts.contains(searchSymbols, referenceSymbol)) {\n                    // If we are searching for constructor uses, they must be 'new' expressions.\n                    return (!searchLocationIsConstructor || ts.isNewExpressionTarget(referenceLocation)) && referenceSymbol;\n                }\n                // If the reference symbol is an alias, check if what it is aliasing is one of the search\n                // symbols but by looking up for related symbol of this alias so it can handle multiple level of indirectness.\n                var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation);\n                if (aliasSymbol) {\n                    return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache);\n                }\n                // If the reference location is in an object literal, try to get the contextual type for the\n                // object literal, lookup the property symbol in the contextual type, and use this symbol to\n                // compare to our searchSymbol\n                var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation);\n                if (containingObjectLiteralElement) {\n                    var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) {\n                        return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; });\n                    });\n                    if (contextualSymbol) {\n                        return contextualSymbol;\n                    }\n                    // If the reference location is the name of property from object literal destructuring pattern\n                    // Get the property symbol from the object literal's type and look if thats the search symbol\n                    // In below eg. get 'property' from type of elems iterating type\n                    //      for ( { property: p2 } of elems) { }\n                    var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation);\n                    if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) {\n                        return propertySymbol;\n                    }\n                }\n                // If the reference location is the binding element and doesn't have property name\n                // then include the binding element in the related symbols\n                //      let { a } : { a };\n                var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol);\n                if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) {\n                    return bindingElementPropertySymbol;\n                }\n                // Unwrap symbols to get to the root (e.g. transient symbols as a result of widening)\n                // Or a union property, use its underlying unioned symbols\n                return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) {\n                    // if it is in the list, then we are done\n                    if (searchSymbols.indexOf(rootSymbol) >= 0) {\n                        return rootSymbol;\n                    }\n                    // Finally, try all properties with the same name in any type the containing type extended or implemented, and\n                    // see if any is in the list. If we were passed a parent symbol, only include types that are subtypes of the\n                    // parent symbol\n                    if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) {\n                        // Parents will only be defined if implementations is true\n                        if (parents) {\n                            if (!ts.forEach(parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, cache); })) {\n                                return undefined;\n                            }\n                        }\n                        var result_4 = [];\n                        getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, /*previousIterationSymbolsCache*/ ts.createMap());\n                        return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; });\n                    }\n                    return undefined;\n                });\n            }\n            function getNameFromObjectLiteralElement(node) {\n                if (node.name.kind === 142 /* ComputedPropertyName */) {\n                    var nameExpression = node.name.expression;\n                    // treat computed property names where expression is string/numeric literal as just string/numeric literal\n                    if (ts.isStringOrNumericLiteral(nameExpression)) {\n                        return nameExpression.text;\n                    }\n                    return undefined;\n                }\n                return node.name.text;\n            }\n            function getPropertySymbolsFromContextualType(node) {\n                var objectLiteral = node.parent;\n                var contextualType = typeChecker.getContextualType(objectLiteral);\n                var name = getNameFromObjectLiteralElement(node);\n                if (name && contextualType) {\n                    var result_5 = [];\n                    var symbol_2 = contextualType.getProperty(name);\n                    if (symbol_2) {\n                        result_5.push(symbol_2);\n                    }\n                    if (contextualType.flags & 65536 /* Union */) {\n                        ts.forEach(contextualType.types, function (t) {\n                            var symbol = t.getProperty(name);\n                            if (symbol) {\n                                result_5.push(symbol);\n                            }\n                        });\n                    }\n                    return result_5;\n                }\n                return undefined;\n            }\n            /** Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations\n                 * of the corresponding symbol. e.g. if we are searching for \"Foo\" in value position, but \"Foo\" references a class\n                * then we need to widen the search to include type positions as well.\n                * On the contrary, if we are searching for \"Bar\" in type position and we trace bar to an interface, and an uninstantiated\n                * module, we want to keep the search limited to only types, as the two declarations (interface and uninstantiated module)\n                * do not intersect in any of the three spaces.\n                */\n            function getIntersectingMeaningFromDeclarations(meaning, declarations) {\n                if (declarations) {\n                    var lastIterationMeaning = void 0;\n                    do {\n                        // The result is order-sensitive, for instance if initialMeaning === Namespace, and declarations = [class, instantiated module]\n                        // we need to consider both as they initialMeaning intersects with the module in the namespace space, and the module\n                        // intersects with the class in the value space.\n                        // To achieve that we will keep iterating until the result stabilizes.\n                        // Remember the last meaning\n                        lastIterationMeaning = meaning;\n                        for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {\n                            var declaration = declarations_8[_i];\n                            var declarationMeaning = ts.getMeaningFromDeclaration(declaration);\n                            if (declarationMeaning & meaning) {\n                                meaning |= declarationMeaning;\n                            }\n                        }\n                    } while (meaning !== lastIterationMeaning);\n                }\n                return meaning;\n            }\n        }\n        FindAllReferences.getReferencedSymbolsForNode = getReferencedSymbolsForNode;\n        function convertReferences(referenceSymbols) {\n            if (!referenceSymbols) {\n                return undefined;\n            }\n            var referenceEntries = [];\n            for (var _i = 0, referenceSymbols_1 = referenceSymbols; _i < referenceSymbols_1.length; _i++) {\n                var referenceSymbol = referenceSymbols_1[_i];\n                ts.addRange(referenceEntries, referenceSymbol.references);\n            }\n            return referenceEntries;\n        }\n        FindAllReferences.convertReferences = convertReferences;\n        function isImplementation(node) {\n            if (!node) {\n                return false;\n            }\n            else if (ts.isVariableLike(node)) {\n                if (node.initializer) {\n                    return true;\n                }\n                else if (node.kind === 223 /* VariableDeclaration */) {\n                    var parentStatement = getParentStatementOfVariableDeclaration(node);\n                    return parentStatement && ts.hasModifier(parentStatement, 2 /* Ambient */);\n                }\n            }\n            else if (ts.isFunctionLike(node)) {\n                return !!node.body || ts.hasModifier(node, 2 /* Ambient */);\n            }\n            else {\n                switch (node.kind) {\n                    case 226 /* ClassDeclaration */:\n                    case 197 /* ClassExpression */:\n                    case 229 /* EnumDeclaration */:\n                    case 230 /* ModuleDeclaration */:\n                        return true;\n                }\n            }\n            return false;\n        }\n        function getParentStatementOfVariableDeclaration(node) {\n            if (node.parent && node.parent.parent && node.parent.parent.kind === 205 /* VariableStatement */) {\n                ts.Debug.assert(node.parent.kind === 224 /* VariableDeclarationList */);\n                return node.parent.parent;\n            }\n        }\n        function getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result) {\n            var refSymbol = typeChecker.getSymbolAtLocation(node);\n            var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(refSymbol.valueDeclaration);\n            if (shorthandSymbol) {\n                for (var _i = 0, _a = shorthandSymbol.getDeclarations(); _i < _a.length; _i++) {\n                    var declaration = _a[_i];\n                    if (ts.getMeaningFromDeclaration(declaration) & 1 /* Value */) {\n                        result.push(getReferenceEntryFromNode(declaration));\n                    }\n                }\n            }\n        }\n        FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment = getReferenceEntriesForShorthandPropertyAssignment;\n        function getReferenceEntryFromNode(node) {\n            var start = node.getStart();\n            var end = node.getEnd();\n            if (node.kind === 9 /* StringLiteral */) {\n                start += 1;\n                end -= 1;\n            }\n            return {\n                fileName: node.getSourceFile().fileName,\n                textSpan: ts.createTextSpanFromBounds(start, end),\n                isWriteAccess: isWriteAccess(node),\n                isDefinition: ts.isDeclarationName(node) || ts.isLiteralComputedPropertyDeclarationName(node)\n            };\n        }\n        FindAllReferences.getReferenceEntryFromNode = getReferenceEntryFromNode;\n        /** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */\n        function isWriteAccess(node) {\n            if (node.kind === 70 /* Identifier */ && ts.isDeclarationName(node)) {\n                return true;\n            }\n            var parent = node.parent;\n            if (parent) {\n                if (parent.kind === 191 /* PostfixUnaryExpression */ || parent.kind === 190 /* PrefixUnaryExpression */) {\n                    return true;\n                }\n                else if (parent.kind === 192 /* BinaryExpression */ && parent.left === node) {\n                    var operator = parent.operatorToken.kind;\n                    return 57 /* FirstAssignment */ <= operator && operator <= 69 /* LastAssignment */;\n                }\n            }\n            return false;\n        }\n        function forEachDescendantOfKind(node, kind, action) {\n            ts.forEachChild(node, function (child) {\n                if (child.kind === kind) {\n                    action(child);\n                }\n                forEachDescendantOfKind(child, kind, action);\n            });\n        }\n        /**\n         * Returns the containing object literal property declaration given a possible name node, e.g. \"a\" in x = { \"a\": 1 }\n         */\n        function getContainingObjectLiteralElement(node) {\n            switch (node.kind) {\n                case 9 /* StringLiteral */:\n                case 8 /* NumericLiteral */:\n                    if (node.parent.kind === 142 /* ComputedPropertyName */) {\n                        return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined;\n                    }\n                // intential fall through\n                case 70 /* Identifier */:\n                    return isObjectLiteralPropertyDeclaration(node.parent) && node.parent.name === node ? node.parent : undefined;\n            }\n            return undefined;\n        }\n        function isObjectLiteralPropertyDeclaration(node) {\n            switch (node.kind) {\n                case 257 /* PropertyAssignment */:\n                case 258 /* ShorthandPropertyAssignment */:\n                case 149 /* MethodDeclaration */:\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                    return true;\n            }\n            return false;\n        }\n        /** Get `C` given `N` if `N` is in the position `class C extends N` or `class C extends foo.N` where `N` is an identifier. */\n        function tryGetClassByExtendingIdentifier(node) {\n            return ts.tryGetClassExtendingExpressionWithTypeArguments(ts.climbPastPropertyAccess(node).parent);\n        }\n        function isNameOfExternalModuleImportOrDeclaration(node) {\n            if (node.kind === 9 /* StringLiteral */) {\n                return ts.isNameOfModuleDeclaration(node) || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node);\n            }\n            return false;\n        }\n    })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {}));\n})(ts || (ts = {}));\n/* @internal */\nvar ts;\n(function (ts) {\n    var GoToDefinition;\n    (function (GoToDefinition) {\n        function getDefinitionAtPosition(program, sourceFile, position) {\n            /// Triple slash reference comments\n            var comment = findReferenceInPosition(sourceFile.referencedFiles, position);\n            if (comment) {\n                var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment);\n                if (referenceFile) {\n                    return [getDefinitionInfoForFileReference(comment.fileName, referenceFile.fileName)];\n                }\n                return undefined;\n            }\n            // Type reference directives\n            var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position);\n            if (typeReferenceDirective) {\n                var referenceFile = program.getResolvedTypeReferenceDirectives()[typeReferenceDirective.fileName];\n                if (referenceFile && referenceFile.resolvedFileName) {\n                    return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)];\n                }\n                return undefined;\n            }\n            var node = ts.getTouchingPropertyName(sourceFile, position);\n            if (node === sourceFile) {\n                return undefined;\n            }\n            // Labels\n            if (ts.isJumpStatementTarget(node)) {\n                var labelName = node.text;\n                var label = ts.getTargetLabel(node.parent, node.text);\n                return label ? [createDefinitionInfo(label, ts.ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined;\n            }\n            var typeChecker = program.getTypeChecker();\n            var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node);\n            if (calledDeclaration) {\n                return [createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration)];\n            }\n            var symbol = typeChecker.getSymbolAtLocation(node);\n            // Could not find a symbol e.g. node is string or number keyword,\n            // or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol\n            if (!symbol) {\n                return undefined;\n            }\n            // If this is an alias, and the request came at the declaration location\n            // get the aliased symbol instead. This allows for goto def on an import e.g.\n            //   import {A, B} from \"mod\";\n            // to jump to the implementation directly.\n            if (symbol.flags & 8388608 /* Alias */) {\n                var declaration = symbol.declarations[0];\n                // Go to the original declaration for cases:\n                //\n                //   (1) when the aliased symbol was declared in the location(parent).\n                //   (2) when the aliased symbol is originating from a named import.\n                //\n                if (node.kind === 70 /* Identifier */ &&\n                    (node.parent === declaration ||\n                        (declaration.kind === 239 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 238 /* NamedImports */))) {\n                    symbol = typeChecker.getAliasedSymbol(symbol);\n                }\n            }\n            // Because name in short-hand property assignment has two different meanings: property name and property value,\n            // using go-to-definition at such position should go to the variable declaration of the property value rather than\n            // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition\n            // is performed at the location of property access, we would like to go to definition of the property in the short-hand\n            // assignment. This case and others are handled by the following code.\n            if (node.parent.kind === 258 /* ShorthandPropertyAssignment */) {\n                var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);\n                if (!shorthandSymbol) {\n                    return [];\n                }\n                var shorthandDeclarations = shorthandSymbol.getDeclarations();\n                var shorthandSymbolKind_1 = ts.SymbolDisplay.getSymbolKind(typeChecker, shorthandSymbol, node);\n                var shorthandSymbolName_1 = typeChecker.symbolToString(shorthandSymbol);\n                var shorthandContainerName_1 = typeChecker.symbolToString(symbol.parent, node);\n                return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind_1, shorthandSymbolName_1, shorthandContainerName_1); });\n            }\n            return getDefinitionFromSymbol(typeChecker, symbol, node);\n        }\n        GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition;\n        /// Goto type\n        function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) {\n            var node = ts.getTouchingPropertyName(sourceFile, position);\n            if (node === sourceFile) {\n                return undefined;\n            }\n            var symbol = typeChecker.getSymbolAtLocation(node);\n            if (!symbol) {\n                return undefined;\n            }\n            var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node);\n            if (!type) {\n                return undefined;\n            }\n            if (type.flags & 65536 /* Union */ && !(type.flags & 16 /* Enum */)) {\n                var result_6 = [];\n                ts.forEach(type.types, function (t) {\n                    if (t.symbol) {\n                        ts.addRange(/*to*/ result_6, /*from*/ getDefinitionFromSymbol(typeChecker, t.symbol, node));\n                    }\n                });\n                return result_6;\n            }\n            if (!type.symbol) {\n                return undefined;\n            }\n            return getDefinitionFromSymbol(typeChecker, type.symbol, node);\n        }\n        GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;\n        function getDefinitionFromSymbol(typeChecker, symbol, node) {\n            var result = [];\n            var declarations = symbol.getDeclarations();\n            var _a = getSymbolInfo(typeChecker, symbol, node), symbolName = _a.symbolName, symbolKind = _a.symbolKind, containerName = _a.containerName;\n            if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) &&\n                !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) {\n                // Just add all the declarations.\n                ts.forEach(declarations, function (declaration) {\n                    result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName));\n                });\n            }\n            return result;\n            function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) {\n                // Applicable only if we are in a new expression, or we are on a constructor declaration\n                // and in either case the symbol has a construct signature definition, i.e. class\n                if (ts.isNewExpressionTarget(location) || location.kind === 122 /* ConstructorKeyword */) {\n                    if (symbol.flags & 32 /* Class */) {\n                        // Find the first class-like declaration and try to get the construct signature.\n                        for (var _i = 0, _a = symbol.getDeclarations(); _i < _a.length; _i++) {\n                            var declaration = _a[_i];\n                            if (ts.isClassLike(declaration)) {\n                                return tryAddSignature(declaration.members, \n                                /*selectConstructors*/ true, symbolKind, symbolName, containerName, result);\n                            }\n                        }\n                        ts.Debug.fail(\"Expected declaration to have at least one class-like declaration\");\n                    }\n                }\n                return false;\n            }\n            function tryAddCallSignature(symbol, location, symbolKind, symbolName, containerName, result) {\n                if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location) || ts.isNameOfFunctionDeclaration(location)) {\n                    return tryAddSignature(symbol.declarations, /*selectConstructors*/ false, symbolKind, symbolName, containerName, result);\n                }\n                return false;\n            }\n            function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) {\n                var declarations = [];\n                var definition;\n                ts.forEach(signatureDeclarations, function (d) {\n                    if ((selectConstructors && d.kind === 150 /* Constructor */) ||\n                        (!selectConstructors && (d.kind === 225 /* FunctionDeclaration */ || d.kind === 149 /* MethodDeclaration */ || d.kind === 148 /* MethodSignature */))) {\n                        declarations.push(d);\n                        if (d.body)\n                            definition = d;\n                    }\n                });\n                if (definition) {\n                    result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName));\n                    return true;\n                }\n                else if (declarations.length) {\n                    result.push(createDefinitionInfo(ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName));\n                    return true;\n                }\n                return false;\n            }\n        }\n        function createDefinitionInfo(node, symbolKind, symbolName, containerName) {\n            return {\n                fileName: node.getSourceFile().fileName,\n                textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()),\n                kind: symbolKind,\n                name: symbolName,\n                containerKind: undefined,\n                containerName: containerName\n            };\n        }\n        function getSymbolInfo(typeChecker, symbol, node) {\n            return {\n                symbolName: typeChecker.symbolToString(symbol),\n                symbolKind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node),\n                containerName: symbol.parent ? typeChecker.symbolToString(symbol.parent, node) : \"\"\n            };\n        }\n        function createDefinitionFromSignatureDeclaration(typeChecker, decl) {\n            var _a = getSymbolInfo(typeChecker, decl.symbol, decl), symbolName = _a.symbolName, symbolKind = _a.symbolKind, containerName = _a.containerName;\n            return createDefinitionInfo(decl, symbolKind, symbolName, containerName);\n        }\n        function findReferenceInPosition(refs, pos) {\n            for (var _i = 0, refs_1 = refs; _i < refs_1.length; _i++) {\n                var ref = refs_1[_i];\n                if (ref.pos <= pos && pos < ref.end) {\n                    return ref;\n                }\n            }\n            return undefined;\n        }\n        function getDefinitionInfoForFileReference(name, targetFileName) {\n            return {\n                fileName: targetFileName,\n                textSpan: ts.createTextSpanFromBounds(0, 0),\n                kind: ts.ScriptElementKind.scriptElement,\n                name: name,\n                containerName: undefined,\n                containerKind: undefined\n            };\n        }\n        /** Returns a CallLikeExpression where `node` is the target being invoked. */\n        function getAncestorCallLikeExpression(node) {\n            var target = climbPastManyPropertyAccesses(node);\n            var callLike = target.parent;\n            return callLike && ts.isCallLikeExpression(callLike) && ts.getInvokedExpression(callLike) === target && callLike;\n        }\n        function climbPastManyPropertyAccesses(node) {\n            return ts.isRightSideOfPropertyAccess(node) ? climbPastManyPropertyAccesses(node.parent) : node;\n        }\n        function tryGetSignatureDeclaration(typeChecker, node) {\n            var callLike = getAncestorCallLikeExpression(node);\n            return callLike && typeChecker.getResolvedSignature(callLike).declaration;\n        }\n    })(GoToDefinition = ts.GoToDefinition || (ts.GoToDefinition = {}));\n})(ts || (ts = {}));\n/* @internal */\nvar ts;\n(function (ts) {\n    var GoToImplementation;\n    (function (GoToImplementation) {\n        function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) {\n            // If invoked directly on a shorthand property assignment, then return\n            // the declaration of the symbol being assigned (not the symbol being assigned to).\n            if (node.parent.kind === 258 /* ShorthandPropertyAssignment */) {\n                var result = [];\n                ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result);\n                return result.length > 0 ? result : undefined;\n            }\n            else if (node.kind === 96 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) {\n                // References to and accesses on the super keyword only have one possible implementation, so no\n                // need to \"Find all References\"\n                var symbol = typeChecker.getSymbolAtLocation(node);\n                return symbol.valueDeclaration && [ts.FindAllReferences.getReferenceEntryFromNode(symbol.valueDeclaration)];\n            }\n            else {\n                // Perform \"Find all References\" and retrieve only those that are implementations\n                var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, /*findInStrings*/ false, /*findInComments*/ false, /*implementations*/ true);\n                var result = ts.flatMap(referencedSymbols, function (symbol) {\n                    return ts.map(symbol.references, function (_a) {\n                        var textSpan = _a.textSpan, fileName = _a.fileName;\n                        return ({ textSpan: textSpan, fileName: fileName });\n                    });\n                });\n                return result && result.length > 0 ? result : undefined;\n            }\n        }\n        GoToImplementation.getImplementationAtPosition = getImplementationAtPosition;\n    })(GoToImplementation = ts.GoToImplementation || (ts.GoToImplementation = {}));\n})(ts || (ts = {}));\n/* @internal */\nvar ts;\n(function (ts) {\n    var JsDoc;\n    (function (JsDoc) {\n        var jsDocTagNames = [\n            \"augments\",\n            \"author\",\n            \"argument\",\n            \"borrows\",\n            \"class\",\n            \"constant\",\n            \"constructor\",\n            \"constructs\",\n            \"default\",\n            \"deprecated\",\n            \"description\",\n            \"event\",\n            \"example\",\n            \"extends\",\n            \"field\",\n            \"fileOverview\",\n            \"function\",\n            \"ignore\",\n            \"inner\",\n            \"lends\",\n            \"link\",\n            \"memberOf\",\n            \"name\",\n            \"namespace\",\n            \"param\",\n            \"private\",\n            \"property\",\n            \"public\",\n            \"requires\",\n            \"returns\",\n            \"see\",\n            \"since\",\n            \"static\",\n            \"throws\",\n            \"type\",\n            \"typedef\",\n            \"property\",\n            \"prop\",\n            \"version\"\n        ];\n        var jsDocCompletionEntries;\n        function getJsDocCommentsFromDeclarations(declarations) {\n            // Only collect doc comments from duplicate declarations once:\n            // In case of a union property there might be same declaration multiple times\n            // which only varies in type parameter\n            // Eg. const a: Array<string> | Array<number>; a.length\n            // The property length will have two declarations of property length coming\n            // from Array<T> - Array<string> and Array<number>\n            var documentationComment = [];\n            forEachUnique(declarations, function (declaration) {\n                var comments = ts.getCommentsFromJSDoc(declaration);\n                if (!comments) {\n                    return;\n                }\n                for (var _i = 0, comments_3 = comments; _i < comments_3.length; _i++) {\n                    var comment = comments_3[_i];\n                    if (comment) {\n                        if (documentationComment.length) {\n                            documentationComment.push(ts.lineBreakPart());\n                        }\n                        documentationComment.push(ts.textPart(comment));\n                    }\n                }\n            });\n            return documentationComment;\n        }\n        JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations;\n        /**\n         * Iterates through 'array' by index and performs the callback on each element of array until the callback\n         * returns a truthy value, then returns that value.\n         * If no such value is found, the callback is applied to each element of array and undefined is returned.\n         */\n        function forEachUnique(array, callback) {\n            if (array) {\n                for (var i = 0, len = array.length; i < len; i++) {\n                    if (ts.indexOf(array, array[i]) === i) {\n                        var result = callback(array[i], i);\n                        if (result) {\n                            return result;\n                        }\n                    }\n                }\n            }\n            return undefined;\n        }\n        function getAllJsDocCompletionEntries() {\n            return jsDocCompletionEntries || (jsDocCompletionEntries = ts.map(jsDocTagNames, function (tagName) {\n                return {\n                    name: tagName,\n                    kind: ts.ScriptElementKind.keyword,\n                    kindModifiers: \"\",\n                    sortText: \"0\",\n                };\n            }));\n        }\n        JsDoc.getAllJsDocCompletionEntries = getAllJsDocCompletionEntries;\n        /**\n         * Checks if position points to a valid position to add JSDoc comments, and if so,\n         * returns the appropriate template. Otherwise returns an empty string.\n         * Valid positions are\n         *      - outside of comments, statements, and expressions, and\n         *      - preceding a:\n         *          - function/constructor/method declaration\n         *          - class declarations\n         *          - variable statements\n         *          - namespace declarations\n         *\n         * Hosts should ideally check that:\n         * - The line is all whitespace up to 'position' before performing the insertion.\n         * - If the keystroke sequence \"/\\*\\*\" induced the call, we also check that the next\n         * non-whitespace character is '*', which (approximately) indicates whether we added\n         * the second '*' to complete an existing (JSDoc) comment.\n         * @param fileName The file in which to perform the check.\n         * @param position The (character-indexed) position in the file where the check should\n         * be performed.\n         */\n        function getDocCommentTemplateAtPosition(newLine, sourceFile, position) {\n            // Check if in a context where we don't want to perform any insertion\n            if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) {\n                return undefined;\n            }\n            var tokenAtPos = ts.getTokenAtPosition(sourceFile, position);\n            var tokenStart = tokenAtPos.getStart();\n            if (!tokenAtPos || tokenStart < position) {\n                return undefined;\n            }\n            // TODO: add support for:\n            // - enums/enum members\n            // - interfaces\n            // - property declarations\n            // - potentially property assignments\n            var commentOwner;\n            findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) {\n                switch (commentOwner.kind) {\n                    case 225 /* FunctionDeclaration */:\n                    case 149 /* MethodDeclaration */:\n                    case 150 /* Constructor */:\n                    case 226 /* ClassDeclaration */:\n                    case 205 /* VariableStatement */:\n                        break findOwner;\n                    case 261 /* SourceFile */:\n                        return undefined;\n                    case 230 /* ModuleDeclaration */:\n                        // If in walking up the tree, we hit a a nested namespace declaration,\n                        // then we must be somewhere within a dotted namespace name; however we don't\n                        // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'.\n                        if (commentOwner.parent.kind === 230 /* ModuleDeclaration */) {\n                            return undefined;\n                        }\n                        break findOwner;\n                }\n            }\n            if (!commentOwner || commentOwner.getStart() < position) {\n                return undefined;\n            }\n            var parameters = getParametersForJsDocOwningNode(commentOwner);\n            var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position);\n            var lineStart = sourceFile.getLineStarts()[posLineAndChar.line];\n            var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character);\n            var docParams = \"\";\n            for (var i = 0, numParams = parameters.length; i < numParams; i++) {\n                var currentName = parameters[i].name;\n                var paramName = currentName.kind === 70 /* Identifier */ ?\n                    currentName.text :\n                    \"param\" + i;\n                docParams += indentationStr + \" * @param \" + paramName + newLine;\n            }\n            // A doc comment consists of the following\n            // * The opening comment line\n            // * the first line (without a param) for the object's untagged info (this is also where the caret ends up)\n            // * the '@param'-tagged lines\n            // * TODO: other tags.\n            // * the closing comment line\n            // * if the caret was directly in front of the object, then we add an extra line and indentation.\n            var preamble = \"/**\" + newLine +\n                indentationStr + \" * \";\n            var result = preamble + newLine +\n                docParams +\n                indentationStr + \" */\" +\n                (tokenStart === position ? newLine + indentationStr : \"\");\n            return { newText: result, caretOffset: preamble.length };\n        }\n        JsDoc.getDocCommentTemplateAtPosition = getDocCommentTemplateAtPosition;\n        function getParametersForJsDocOwningNode(commentOwner) {\n            if (ts.isFunctionLike(commentOwner)) {\n                return commentOwner.parameters;\n            }\n            if (commentOwner.kind === 205 /* VariableStatement */) {\n                var varStatement = commentOwner;\n                var varDeclarations = varStatement.declarationList.declarations;\n                if (varDeclarations.length === 1 && varDeclarations[0].initializer) {\n                    return getParametersFromRightHandSideOfAssignment(varDeclarations[0].initializer);\n                }\n            }\n            return ts.emptyArray;\n        }\n        /**\n         * Digs into an an initializer or RHS operand of an assignment operation\n         * to get the parameters of an apt signature corresponding to a\n         * function expression or a class expression.\n         *\n         * @param rightHandSide the expression which may contain an appropriate set of parameters\n         * @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'.\n         */\n        function getParametersFromRightHandSideOfAssignment(rightHandSide) {\n            while (rightHandSide.kind === 183 /* ParenthesizedExpression */) {\n                rightHandSide = rightHandSide.expression;\n            }\n            switch (rightHandSide.kind) {\n                case 184 /* FunctionExpression */:\n                case 185 /* ArrowFunction */:\n                    return rightHandSide.parameters;\n                case 197 /* ClassExpression */:\n                    for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) {\n                        var member = _a[_i];\n                        if (member.kind === 150 /* Constructor */) {\n                            return member.parameters;\n                        }\n                    }\n                    break;\n            }\n            return ts.emptyArray;\n        }\n    })(JsDoc = ts.JsDoc || (ts.JsDoc = {}));\n})(ts || (ts = {}));\n// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0.\n// See LICENSE.txt in the project root for complete license information.\n/// <reference path='../compiler/types.ts' />\n/// <reference path='../compiler/core.ts' />\n/// <reference path='../compiler/commandLineParser.ts' />\n/* @internal */\nvar ts;\n(function (ts) {\n    var JsTyping;\n    (function (JsTyping) {\n        ;\n        ;\n        // A map of loose file names to library names\n        // that we are confident require typings\n        var safeList;\n        var EmptySafeList = ts.createMap();\n        /* @internal */\n        JsTyping.nodeCoreModuleList = [\n            \"buffer\", \"querystring\", \"events\", \"http\", \"cluster\",\n            \"zlib\", \"os\", \"https\", \"punycode\", \"repl\", \"readline\",\n            \"vm\", \"child_process\", \"url\", \"dns\", \"net\",\n            \"dgram\", \"fs\", \"path\", \"string_decoder\", \"tls\",\n            \"crypto\", \"stream\", \"util\", \"assert\", \"tty\", \"domain\",\n            \"constants\", \"process\", \"v8\", \"timers\", \"console\"\n        ];\n        var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; });\n        /**\n         * @param host is the object providing I/O related operations.\n         * @param fileNames are the file names that belong to the same project\n         * @param projectRootPath is the path to the project root directory\n         * @param safeListPath is the path used to retrieve the safe list\n         * @param packageNameToTypingLocation is the map of package names to their cached typing locations\n         * @param typeAcquisition is used to customize the typing acquisition process\n         * @param compilerOptions are used as a source for typing inference\n         */\n        function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) {\n            // A typing name to typing file path mapping\n            var inferredTypings = ts.createMap();\n            if (!typeAcquisition || !typeAcquisition.enable) {\n                return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] };\n            }\n            // Only infer typings for .js and .jsx files\n            fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) {\n                var kind = ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f));\n                return kind === 1 /* JS */ || kind === 2 /* JSX */;\n            });\n            if (!safeList) {\n                var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); });\n                safeList = result.config ? ts.createMap(result.config) : EmptySafeList;\n            }\n            var filesToWatch = [];\n            // Directories to search for package.json, bower.json and other typing information\n            var searchDirs = [];\n            var exclude = [];\n            mergeTypings(typeAcquisition.include);\n            exclude = typeAcquisition.exclude || [];\n            var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);\n            if (projectRootPath) {\n                possibleSearchDirs.push(projectRootPath);\n            }\n            searchDirs = ts.deduplicate(possibleSearchDirs);\n            for (var _i = 0, searchDirs_1 = searchDirs; _i < searchDirs_1.length; _i++) {\n                var searchDir = searchDirs_1[_i];\n                var packageJsonPath = ts.combinePaths(searchDir, \"package.json\");\n                getTypingNamesFromJson(packageJsonPath, filesToWatch);\n                var bowerJsonPath = ts.combinePaths(searchDir, \"bower.json\");\n                getTypingNamesFromJson(bowerJsonPath, filesToWatch);\n                var nodeModulesPath = ts.combinePaths(searchDir, \"node_modules\");\n                getTypingNamesFromNodeModuleFolder(nodeModulesPath);\n            }\n            getTypingNamesFromSourceFileNames(fileNames);\n            // add typings for unresolved imports\n            if (unresolvedImports) {\n                for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) {\n                    var moduleId = unresolvedImports_1[_a];\n                    var typingName = moduleId in nodeCoreModules ? \"node\" : moduleId;\n                    if (!(typingName in inferredTypings)) {\n                        inferredTypings[typingName] = undefined;\n                    }\n                }\n            }\n            // Add the cached typing locations for inferred typings that are already installed\n            for (var name_46 in packageNameToTypingLocation) {\n                if (name_46 in inferredTypings && !inferredTypings[name_46]) {\n                    inferredTypings[name_46] = packageNameToTypingLocation[name_46];\n                }\n            }\n            // Remove typings that the user has added to the exclude list\n            for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) {\n                var excludeTypingName = exclude_1[_b];\n                delete inferredTypings[excludeTypingName];\n            }\n            var newTypingNames = [];\n            var cachedTypingPaths = [];\n            for (var typing in inferredTypings) {\n                if (inferredTypings[typing] !== undefined) {\n                    cachedTypingPaths.push(inferredTypings[typing]);\n                }\n                else {\n                    newTypingNames.push(typing);\n                }\n            }\n            return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch };\n            /**\n             * Merge a given list of typingNames to the inferredTypings map\n             */\n            function mergeTypings(typingNames) {\n                if (!typingNames) {\n                    return;\n                }\n                for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) {\n                    var typing = typingNames_1[_i];\n                    if (!(typing in inferredTypings)) {\n                        inferredTypings[typing] = undefined;\n                    }\n                }\n            }\n            /**\n             * Get the typing info from common package manager json files like package.json or bower.json\n             */\n            function getTypingNamesFromJson(jsonPath, filesToWatch) {\n                if (host.fileExists(jsonPath)) {\n                    filesToWatch.push(jsonPath);\n                }\n                var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); });\n                if (result.config) {\n                    var jsonConfig = result.config;\n                    if (jsonConfig.dependencies) {\n                        mergeTypings(ts.getOwnKeys(jsonConfig.dependencies));\n                    }\n                    if (jsonConfig.devDependencies) {\n                        mergeTypings(ts.getOwnKeys(jsonConfig.devDependencies));\n                    }\n                    if (jsonConfig.optionalDependencies) {\n                        mergeTypings(ts.getOwnKeys(jsonConfig.optionalDependencies));\n                    }\n                    if (jsonConfig.peerDependencies) {\n                        mergeTypings(ts.getOwnKeys(jsonConfig.peerDependencies));\n                    }\n                }\n            }\n            /**\n             * Infer typing names from given file names. For example, the file name \"jquery-min.2.3.4.js\"\n             * should be inferred to the 'jquery' typing name; and \"angular-route.1.2.3.js\" should be inferred\n             * to the 'angular-route' typing name.\n             * @param fileNames are the names for source files in the project\n             */\n            function getTypingNamesFromSourceFileNames(fileNames) {\n                var jsFileNames = ts.filter(fileNames, ts.hasJavaScriptFileExtension);\n                var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); });\n                var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\\.|-)min(?=\\.|$))|((?:-|\\.)\\d+)/g, \"\"); });\n                if (safeList !== EmptySafeList) {\n                    mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; }));\n                }\n                var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2 /* JSX */; });\n                if (hasJsxFile) {\n                    mergeTypings([\"react\"]);\n                }\n            }\n            /**\n             * Infer typing names from node_module folder\n             * @param nodeModulesPath is the path to the \"node_modules\" folder\n             */\n            function getTypingNamesFromNodeModuleFolder(nodeModulesPath) {\n                // Todo: add support for ModuleResolutionHost too\n                if (!host.directoryExists(nodeModulesPath)) {\n                    return;\n                }\n                var typingNames = [];\n                var fileNames = host.readDirectory(nodeModulesPath, [\".json\"], /*excludes*/ undefined, /*includes*/ undefined, /*depth*/ 2);\n                for (var _i = 0, fileNames_2 = fileNames; _i < fileNames_2.length; _i++) {\n                    var fileName = fileNames_2[_i];\n                    var normalizedFileName = ts.normalizePath(fileName);\n                    if (ts.getBaseFileName(normalizedFileName) !== \"package.json\") {\n                        continue;\n                    }\n                    var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); });\n                    if (!result.config) {\n                        continue;\n                    }\n                    var packageJson = result.config;\n                    // npm 3's package.json contains a \"_requiredBy\" field\n                    // we should include all the top level module names for npm 2, and only module names whose\n                    // \"_requiredBy\" field starts with \"#\" or equals \"/\" for npm 3.\n                    if (packageJson._requiredBy &&\n                        ts.filter(packageJson._requiredBy, function (r) { return r[0] === \"#\" || r === \"/\"; }).length === 0) {\n                        continue;\n                    }\n                    // If the package has its own d.ts typings, those will take precedence. Otherwise the package name will be used\n                    // to download d.ts files from DefinitelyTyped\n                    if (!packageJson.name) {\n                        continue;\n                    }\n                    if (packageJson.typings) {\n                        var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName));\n                        inferredTypings[packageJson.name] = absolutePath;\n                    }\n                    else {\n                        typingNames.push(packageJson.name);\n                    }\n                }\n                mergeTypings(typingNames);\n            }\n        }\n        JsTyping.discoverTypings = discoverTypings;\n    })(JsTyping = ts.JsTyping || (ts.JsTyping = {}));\n})(ts || (ts = {}));\n/* @internal */\nvar ts;\n(function (ts) {\n    var NavigateTo;\n    (function (NavigateTo) {\n        function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) {\n            var patternMatcher = ts.createPatternMatcher(searchValue);\n            var rawItems = [];\n            // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]\n            ts.forEach(sourceFiles, function (sourceFile) {\n                cancellationToken.throwIfCancellationRequested();\n                if (excludeDtsFiles && ts.fileExtensionIs(sourceFile.fileName, \".d.ts\")) {\n                    return;\n                }\n                var nameToDeclarations = sourceFile.getNamedDeclarations();\n                for (var name_47 in nameToDeclarations) {\n                    var declarations = nameToDeclarations[name_47];\n                    if (declarations) {\n                        // First do a quick check to see if the name of the declaration matches the\n                        // last portion of the (possibly) dotted name they're searching for.\n                        var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_47);\n                        if (!matches) {\n                            continue;\n                        }\n                        for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {\n                            var declaration = declarations_9[_i];\n                            // It was a match!  If the pattern has dots in it, then also see if the\n                            // declaration container matches as well.\n                            if (patternMatcher.patternContainsDots) {\n                                var containers = getContainers(declaration);\n                                if (!containers) {\n                                    return undefined;\n                                }\n                                matches = patternMatcher.getMatches(containers, name_47);\n                                if (!matches) {\n                                    continue;\n                                }\n                            }\n                            var fileName = sourceFile.fileName;\n                            var matchKind = bestMatchKind(matches);\n                            rawItems.push({ name: name_47, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });\n                        }\n                    }\n                }\n            });\n            // Remove imports when the imported declaration is already in the list and has the same name.\n            rawItems = ts.filter(rawItems, function (item) {\n                var decl = item.declaration;\n                if (decl.kind === 236 /* ImportClause */ || decl.kind === 239 /* ImportSpecifier */ || decl.kind === 234 /* ImportEqualsDeclaration */) {\n                    var importer = checker.getSymbolAtLocation(decl.name);\n                    var imported = checker.getAliasedSymbol(importer);\n                    return importer.name !== imported.name;\n                }\n                else {\n                    return true;\n                }\n            });\n            rawItems.sort(compareNavigateToItems);\n            if (maxResultCount !== undefined) {\n                rawItems = rawItems.slice(0, maxResultCount);\n            }\n            var items = ts.map(rawItems, createNavigateToItem);\n            return items;\n            function allMatchesAreCaseSensitive(matches) {\n                ts.Debug.assert(matches.length > 0);\n                // This is a case sensitive match, only if all the submatches were case sensitive.\n                for (var _i = 0, matches_2 = matches; _i < matches_2.length; _i++) {\n                    var match = matches_2[_i];\n                    if (!match.isCaseSensitive) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            function getTextOfIdentifierOrLiteral(node) {\n                if (node) {\n                    if (node.kind === 70 /* Identifier */ ||\n                        node.kind === 9 /* StringLiteral */ ||\n                        node.kind === 8 /* NumericLiteral */) {\n                        return node.text;\n                    }\n                }\n                return undefined;\n            }\n            function tryAddSingleDeclarationName(declaration, containers) {\n                if (declaration && declaration.name) {\n                    var text = getTextOfIdentifierOrLiteral(declaration.name);\n                    if (text !== undefined) {\n                        containers.unshift(text);\n                    }\n                    else if (declaration.name.kind === 142 /* ComputedPropertyName */) {\n                        return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ true);\n                    }\n                    else {\n                        // Don't know how to add this.\n                        return false;\n                    }\n                }\n                return true;\n            }\n            // Only added the names of computed properties if they're simple dotted expressions, like:\n            //\n            //      [X.Y.Z]() { }\n            function tryAddComputedPropertyName(expression, containers, includeLastPortion) {\n                var text = getTextOfIdentifierOrLiteral(expression);\n                if (text !== undefined) {\n                    if (includeLastPortion) {\n                        containers.unshift(text);\n                    }\n                    return true;\n                }\n                if (expression.kind === 177 /* PropertyAccessExpression */) {\n                    var propertyAccess = expression;\n                    if (includeLastPortion) {\n                        containers.unshift(propertyAccess.name.text);\n                    }\n                    return tryAddComputedPropertyName(propertyAccess.expression, containers, /*includeLastPortion*/ true);\n                }\n                return false;\n            }\n            function getContainers(declaration) {\n                var containers = [];\n                // First, if we started with a computed property name, then add all but the last\n                // portion into the container array.\n                if (declaration.name.kind === 142 /* ComputedPropertyName */) {\n                    if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ false)) {\n                        return undefined;\n                    }\n                }\n                // Now, walk up our containers, adding all their names to the container array.\n                declaration = ts.getContainerNode(declaration);\n                while (declaration) {\n                    if (!tryAddSingleDeclarationName(declaration, containers)) {\n                        return undefined;\n                    }\n                    declaration = ts.getContainerNode(declaration);\n                }\n                return containers;\n            }\n            function bestMatchKind(matches) {\n                ts.Debug.assert(matches.length > 0);\n                var bestMatchKind = ts.PatternMatchKind.camelCase;\n                for (var _i = 0, matches_3 = matches; _i < matches_3.length; _i++) {\n                    var match = matches_3[_i];\n                    var kind = match.kind;\n                    if (kind < bestMatchKind) {\n                        bestMatchKind = kind;\n                    }\n                }\n                return bestMatchKind;\n            }\n            function compareNavigateToItems(i1, i2) {\n                // TODO(cyrusn): get the gamut of comparisons that VS already uses here.\n                // Right now we just sort by kind first, and then by name of the item.\n                // We first sort case insensitively.  So \"Aaa\" will come before \"bar\".\n                // Then we sort case sensitively, so \"aaa\" will come before \"Aaa\".\n                return i1.matchKind - i2.matchKind ||\n                    ts.compareStringsCaseInsensitive(i1.name, i2.name) ||\n                    ts.compareStrings(i1.name, i2.name);\n            }\n            function createNavigateToItem(rawItem) {\n                var declaration = rawItem.declaration;\n                var container = ts.getContainerNode(declaration);\n                return {\n                    name: rawItem.name,\n                    kind: ts.getNodeKind(declaration),\n                    kindModifiers: ts.getNodeModifiers(declaration),\n                    matchKind: ts.PatternMatchKind[rawItem.matchKind],\n                    isCaseSensitive: rawItem.isCaseSensitive,\n                    fileName: rawItem.fileName,\n                    textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()),\n                    // TODO(jfreeman): What should be the containerName when the container has a computed name?\n                    containerName: container && container.name ? container.name.text : \"\",\n                    containerKind: container && container.name ? ts.getNodeKind(container) : \"\"\n                };\n            }\n        }\n        NavigateTo.getNavigateToItems = getNavigateToItems;\n    })(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {}));\n})(ts || (ts = {}));\n/// <reference path='services.ts' />\n/* @internal */\nvar ts;\n(function (ts) {\n    var NavigationBar;\n    (function (NavigationBar) {\n        function getNavigationBarItems(sourceFile) {\n            curSourceFile = sourceFile;\n            var result = ts.map(topLevelItems(rootNavigationBarNode(sourceFile)), convertToTopLevelItem);\n            curSourceFile = undefined;\n            return result;\n        }\n        NavigationBar.getNavigationBarItems = getNavigationBarItems;\n        function getNavigationTree(sourceFile) {\n            curSourceFile = sourceFile;\n            var result = convertToTree(rootNavigationBarNode(sourceFile));\n            curSourceFile = undefined;\n            return result;\n        }\n        NavigationBar.getNavigationTree = getNavigationTree;\n        // Keep sourceFile handy so we don't have to search for it every time we need to call `getText`.\n        var curSourceFile;\n        function nodeText(node) {\n            return node.getText(curSourceFile);\n        }\n        function navigationBarNodeKind(n) {\n            return n.node.kind;\n        }\n        function pushChild(parent, child) {\n            if (parent.children) {\n                parent.children.push(child);\n            }\n            else {\n                parent.children = [child];\n            }\n        }\n        /*\n        For performance, we keep navigation bar parents on a stack rather than passing them through each recursion.\n        `parent` is the current parent and is *not* stored in parentsStack.\n        `startNode` sets a new parent and `endNode` returns to the previous parent.\n        */\n        var parentsStack = [];\n        var parent;\n        function rootNavigationBarNode(sourceFile) {\n            ts.Debug.assert(!parentsStack.length);\n            var root = { node: sourceFile, additionalNodes: undefined, parent: undefined, children: undefined, indent: 0 };\n            parent = root;\n            for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {\n                var statement = _a[_i];\n                addChildrenRecursively(statement);\n            }\n            endNode();\n            ts.Debug.assert(!parent && !parentsStack.length);\n            return root;\n        }\n        function addLeafNode(node) {\n            pushChild(parent, emptyNavigationBarNode(node));\n        }\n        function emptyNavigationBarNode(node) {\n            return {\n                node: node,\n                additionalNodes: undefined,\n                parent: parent,\n                children: undefined,\n                indent: parent.indent + 1\n            };\n        }\n        /**\n         * Add a new level of NavigationBarNodes.\n         * This pushes to the stack, so you must call `endNode` when you are done adding to this node.\n         */\n        function startNode(node) {\n            var navNode = emptyNavigationBarNode(node);\n            pushChild(parent, navNode);\n            // Save the old parent\n            parentsStack.push(parent);\n            parent = navNode;\n        }\n        /** Call after calling `startNode` and adding children to it. */\n        function endNode() {\n            if (parent.children) {\n                mergeChildren(parent.children);\n                sortChildren(parent.children);\n            }\n            parent = parentsStack.pop();\n        }\n        function addNodeWithRecursiveChild(node, child) {\n            startNode(node);\n            addChildrenRecursively(child);\n            endNode();\n        }\n        /** Look for navigation bar items in node's subtree, adding them to the current `parent`. */\n        function addChildrenRecursively(node) {\n            if (!node || ts.isToken(node)) {\n                return;\n            }\n            switch (node.kind) {\n                case 150 /* Constructor */:\n                    // Get parameter properties, and treat them as being on the *same* level as the constructor, not under it.\n                    var ctr = node;\n                    addNodeWithRecursiveChild(ctr, ctr.body);\n                    // Parameter properties are children of the class, not the constructor.\n                    for (var _i = 0, _a = ctr.parameters; _i < _a.length; _i++) {\n                        var param = _a[_i];\n                        if (ts.isParameterPropertyDeclaration(param)) {\n                            addLeafNode(param);\n                        }\n                    }\n                    break;\n                case 149 /* MethodDeclaration */:\n                case 151 /* GetAccessor */:\n                case 152 /* SetAccessor */:\n                case 148 /* MethodSignature */:\n                    if (!ts.hasDynamicName(node)) {\n                        addNodeWithRecursiveChild(node, node.body);\n                    }\n                    break;\n                case 147 /* PropertyDeclaration */:\n                case 146 /* PropertySignature */:\n                    if (!ts.hasDynamicName(node)) {\n                        addLeafNode(node);\n                    }\n                    break;\n                case 236 /* ImportClause */:\n                    var importClause = node;\n                    // Handle default import case e.g.:\n                    //    import d from \"mod\";\n                    if (importClause.name) {\n                        addLeafNode(importClause);\n                    }\n                    // Handle named bindings in imports e.g.:\n                    //    import * as NS from \"mod\";\n                    //    import {a, b as B} from \"mod\";\n                    var namedBindings = importClause.namedBindings;\n                    if (namedBindings) {\n                        if (namedBindings.kind === 237 /* NamespaceImport */) {\n                            addLeafNode(namedBindings);\n                        }\n                        else {\n                            for (var _b = 0, _c = namedBindings.elements; _b < _c.length; _b++) {\n                                var element = _c[_b];\n                                addLeafNode(element);\n                            }\n                        }\n                    }\n                    break;\n                case 174 /* BindingElement */:\n                case 223 /* VariableDeclaration */:\n                    var decl = node;\n                    var name_48 = decl.name;\n                    if (ts.isBindingPattern(name_48)) {\n                        addChildrenRecursively(name_48);\n                    }\n                    else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) {\n                        // For `const x = function() {}`, just use the function node, not the const.\n                        addChildrenRecursively(decl.initializer);\n                    }\n                    else {\n                        addNodeWithRecursiveChild(decl, decl.initializer);\n                    }\n                    break;\n                case 185 /* ArrowFunction */:\n                case 225 /* FunctionDeclaration */:\n                case 184 /* FunctionExpression */:\n                    addNodeWithRecursiveChild(node, node.body);\n                    break;\n                case 229 /* EnumDeclaration */:\n                    startNode(node);\n                    for (var _d = 0, _e = node.members; _d < _e.length; _d++) {\n                        var member = _e[_d];\n                        if (!isComputedProperty(member)) {\n                            addLeafNode(member);\n                        }\n                    }\n                    endNode();\n                    break;\n                case 226 /* ClassDeclaration */:\n                case 197 /* ClassExpression */:\n                case 227 /* InterfaceDeclaration */:\n                    startNode(node);\n                    for (var _f = 0, _g = node.members; _f < _g.length; _f++) {\n                        var member = _g[_f];\n                        addChildrenRecursively(member);\n                    }\n                    endNode();\n                    break;\n                case 230 /* ModuleDeclaration */:\n                    addNodeWithRecursiveChild(node, getInteriorModule(node).body);\n                    break;\n                case 243 /* ExportSpecifier */:\n                case 234 /* ImportEqualsDeclaration */:\n                case 155 /* IndexSignature */:\n                case 153 /* CallSignature */:\n                case 154 /* ConstructSignature */:\n                case 228 /* TypeAliasDeclaration */:\n                    addLeafNode(node);\n                    break;\n                default:\n                    ts.forEach(node.jsDoc, function (jsDoc) {\n                        ts.forEach(jsDoc.tags, function (tag) {\n                            if (tag.kind === 285 /* JSDocTypedefTag */) {\n                                addLeafNode(tag);\n                            }\n                        });\n                    });\n                    ts.forEachChild(node, addChildrenRecursively);\n            }\n        }\n        /** Merge declarations of the same kind. */\n        function mergeChildren(children) {\n            var nameToItems = ts.createMap();\n            ts.filterMutate(children, function (child) {\n                var decl = child.node;\n                var name = decl.name && nodeText(decl.name);\n                if (!name) {\n                    // Anonymous items are never merged.\n                    return true;\n                }\n                var itemsWithSameName = nameToItems[name];\n                if (!itemsWithSameName) {\n                    nameToItems[name] = child;\n                    return true;\n                }\n                if (itemsWithSameName instanceof Array) {\n                    for (var _i = 0, itemsWithSameName_1 = itemsWithSameName; _i < itemsWithSameName_1.length; _i++) {\n                        var itemWithSameName = itemsWithSameName_1[_i];\n                        if (tryMerge(itemWithSameName, child)) {\n                            return false;\n                        }\n                    }\n                    itemsWithSameName.push(child);\n                    return true;\n                }\n                else {\n                    var itemWithSameName = itemsWithSameName;\n                    if (tryMerge(itemWithSameName, child)) {\n                        return false;\n                    }\n                    nameToItems[name] = [itemWithSameName, child];\n                    return true;\n                }\n                function tryMerge(a, b) {\n                    if (shouldReallyMerge(a.node, b.node)) {\n                        merge(a, b);\n                        return true;\n                    }\n                    return false;\n                }\n            });\n            /** a and b have the same name, but they may not be mergeable. */\n            function shouldReallyMerge(a, b) {\n                return a.kind === b.kind && (a.kind !== 230 /* ModuleDeclaration */ || areSameModule(a, b));\n                // We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes.\n                // Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'!\n                function areSameModule(a, b) {\n                    if (a.body.kind !== b.body.kind) {\n                        return false;\n                    }\n                    if (a.body.kind !== 230 /* ModuleDeclaration */) {\n                        return true;\n                    }\n                    return areSameModule(a.body, b.body);\n                }\n            }\n            /** Merge source into target. Source should be thrown away after this is called. */\n            function merge(target, source) {\n                target.additionalNodes = target.additionalNodes || [];\n                target.additionalNodes.push(source.node);\n                if (source.additionalNodes) {\n                    (_a = target.additionalNodes).push.apply(_a, source.additionalNodes);\n                }\n                target.children = ts.concatenate(target.children, source.children);\n                if (target.children) {\n                    mergeChildren(target.children);\n                    sortChildren(target.children);\n                }\n                var _a;\n            }\n        }\n        /** Recursively ensure that each NavNode's children are in sorted order. */\n        function sortChildren(children) {\n            children.sort(compareChildren);\n        }\n        function compareChildren(child1, child2) {\n            var name1 = tryGetName(child1.node), name2 = tryGetName(child2.node);\n            if (name1 && name2) {\n                var cmp = localeCompareFix(name1, name2);\n                return cmp !== 0 ? cmp : navigationBarNodeKind(child1) - navigationBarNodeKind(child2);\n            }\n            else {\n                return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2);\n            }\n        }\n        // Intl is missing in Safari, and node 0.10 treats \"a\" as greater than \"B\".\n        var localeCompareIsCorrect = ts.collator && ts.collator.compare(\"a\", \"B\") < 0;\n        var localeCompareFix = localeCompareIsCorrect ? ts.collator.compare : function (a, b) {\n            // This isn't perfect, but it passes all of our tests.\n            for (var i = 0; i < Math.min(a.length, b.length); i++) {\n                var chA = a.charAt(i), chB = b.charAt(i);\n                if (chA === \"\\\"\" && chB === \"'\") {\n                    return 1;\n                }\n                if (chA === \"'\" && chB === \"\\\"\") {\n                    return -1;\n                }\n                var cmp = ts.compareStrings(chA.toLocaleLowerCase(), chB.toLocaleLowerCase());\n                if (cmp !== 0) {\n                    return cmp;\n                }\n            }\n            return a.length - b.length;\n        };\n        /**\n         * This differs from getItemName because this is just used for sorting.\n         * We only sort nodes by name that have a more-or-less \"direct\" name, as opposed to `new()` and the like.\n         * So `new()` can still come before an `aardvark` method.\n         */\n        function tryGetName(node) {\n            if (node.kind === 230 /* ModuleDeclaration */) {\n                return getModuleName(node);\n            }\n            var decl = node;\n            if (decl.name) {\n                return ts.getPropertyNameForPropertyNameNode(decl.name);\n            }\n            switch (node.kind) {\n                case 184 /* FunctionExpression */:\n                case 185 /* ArrowFunction */:\n                case 197 /* ClassExpression */:\n                    return getFunctionOrClassName(node);\n                case 285 /* JSDocTypedefTag */:\n                    return getJSDocTypedefTagName(node);\n                default:\n                    return undefined;\n            }\n        }\n        function getItemName(node) {\n            if (node.kind === 230 /* ModuleDeclaration */) {\n                return getModuleName(node);\n            }\n            var name = node.name;\n            if (name) {\n                var text = nodeText(name);\n                if (text.length > 0) {\n                    return text;\n                }\n            }\n            switch (node.kind) {\n                case 261 /* SourceFile */:\n                    var sourceFile = node;\n                    return ts.isExternalModule(sourceFile)\n                        ? \"\\\"\" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + \"\\\"\"\n                        : \"<global>\";\n                case 185 /* ArrowFunction */:\n                case 225 /* FunctionDeclaration */:\n                case 184 /* FunctionExpression */:\n                case 226 /* ClassDeclaration */:\n                case 197 /* ClassExpression */:\n                    if (ts.getModifierFlags(node) & 512 /* Default */) {\n                        return \"default\";\n                    }\n                    // We may get a string with newlines or other whitespace in the case of an object dereference\n                    // (eg: \"app\\n.onactivated\"), so we should remove the whitespace for readabiltiy in the\n                    // navigation bar.\n                    return getFunctionOrClassName(node);\n                case 150 /* Constructor */:\n                    return \"constructor\";\n                case 154 /* ConstructSignature */:\n                    return \"new()\";\n                case 153 /* CallSignature */:\n                    return \"()\";\n                case 155 /* IndexSignature */:\n                    return \"[]\";\n                case 285 /* JSDocTypedefTag */:\n                    return getJSDocTypedefTagName(node);\n                default:\n                    return \"<unknown>\";\n            }\n        }\n        function getJSDocTypedefTagName(node) {\n            if (node.name) {\n                return node.name.text;\n            }\n            else {\n                var parentNode = node.parent && node.parent.parent;\n                if (parentNode && parentNode.kind === 205 /* VariableStatement */) {\n                    if (parentNode.declarationList.declarations.length > 0) {\n                        var nameIdentifier = parentNode.declarationList.declarations[0].name;\n                        if (nameIdentifier.kind === 70 /* Identifier */) {\n                            return nameIdentifier.text;\n                        }\n                    }\n                }\n                return \"<typedef>\";\n            }\n        }\n        /** Flattens the NavNode tree to a list, keeping only the top-level items. */\n        function topLevelItems(root) {\n            var topLevel = [];\n            function recur(item) {\n                if (isTopLevel(item)) {\n                    topLevel.push(item);\n                    if (item.children) {\n                        for (var _i = 0, _a = item.children; _i < _a.length; _i++) {\n                            var child = _a[_i];\n                            recur(child);\n                        }\n                    }\n                }\n            }\n            recur(root);\n            return topLevel;\n            function isTopLevel(item) {\n                switch (navigationBarNodeKind(item)) {\n                    case 226 /* ClassDeclaration */:\n                    case 197 /* ClassExpression */:\n                    case 229 /* EnumDeclaration */:\n                    case 227 /* InterfaceDeclaration */:\n                    case 230 /* ModuleDeclaration */:\n                    case 261 /* SourceFile */:\n                    case 228 /* TypeAliasDeclaration */:\n                    case 285 /* JSDocTypedefTag */:\n                        return true;\n                    case 150 /* Constructor */:\n                    case 149 /* MethodDeclaration */:\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                    case 223 /* VariableDeclaration */:\n                        return hasSomeImportantChild(item);\n                    case 185 /* ArrowFunction */:\n                    case 225 /* FunctionDeclaration */:\n                    case 184 /* FunctionExpression */:\n                        return isTopLevelFunctionDeclaration(item);\n                    default:\n                        return false;\n                }\n                function isTopLevelFunctionDeclaration(item) {\n                    if (!item.node.body) {\n                        return false;\n                    }\n                    switch (navigationBarNodeKind(item.parent)) {\n                        case 231 /* ModuleBlock */:\n                        case 261 /* SourceFile */:\n                        case 149 /* MethodDeclaration */:\n                        case 150 /* Constructor */:\n                            return true;\n                        default:\n                            return hasSomeImportantChild(item);\n                    }\n                }\n                function hasSomeImportantChild(item) {\n                    return ts.forEach(item.children, function (child) {\n                        var childKind = navigationBarNodeKind(child);\n                        return childKind !== 223 /* VariableDeclaration */ && childKind !== 174 /* BindingElement */;\n                    });\n                }\n            }\n        }\n        // NavigationBarItem requires an array, but will not mutate it, so just give it this for performance.\n        var emptyChildItemArray = [];\n        function convertToTree(n) {\n            return {\n                text: getItemName(n.node),\n                kind: ts.getNodeKind(n.node),\n                kindModifiers: ts.getNodeModifiers(n.node),\n                spans: getSpans(n),\n                childItems: ts.map(n.children, convertToTree)\n            };\n        }\n        function convertToTopLevelItem(n) {\n            return {\n                text: getItemName(n.node),\n                kind: ts.getNodeKind(n.node),\n                kindModifiers: ts.getNodeModifiers(n.node),\n                spans: getSpans(n),\n                childItems: ts.map(n.children, convertToChildItem) || emptyChildItemArray,\n                indent: n.indent,\n                bolded: false,\n                grayed: false\n            };\n            function convertToChildItem(n) {\n                return {\n                    text: getItemName(n.node),\n                    kind: ts.getNodeKind(n.node),\n                    kindModifiers: ts.getNodeModifiers(n.node),\n                    spans: getSpans(n),\n                    childItems: emptyChildItemArray,\n                    indent: 0,\n                    bolded: false,\n                    grayed: false\n                };\n            }\n        }\n        function getSpans(n) {\n            var spans = [getNodeSpan(n.node)];\n            if (n.additionalNodes) {\n                for (var _i = 0, _a = n.additionalNodes; _i < _a.length; _i++) {\n                    var node = _a[_i];\n                    spans.push(getNodeSpan(node));\n                }\n            }\n            return spans;\n        }\n        function getModuleName(moduleDeclaration) {\n            // We want to maintain quotation marks.\n            if (ts.isAmbientModule(moduleDeclaration)) {\n                return ts.getTextOfNode(moduleDeclaration.name);\n            }\n            // Otherwise, we need to aggregate each identifier to build up the qualified name.\n            var result = [];\n            result.push(moduleDeclaration.name.text);\n            while (moduleDeclaration.body && moduleDeclaration.body.kind === 230 /* ModuleDeclaration */) {\n                moduleDeclaration = moduleDeclaration.body;\n                result.push(moduleDeclaration.name.text);\n            }\n            return result.join(\".\");\n        }\n        /**\n         * For 'module A.B.C', we want to get the node for 'C'.\n         * We store 'A' as associated with a NavNode, and use getModuleName to traverse down again.\n         */\n        function getInteriorModule(decl) {\n            return decl.body.kind === 230 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl;\n        }\n        function isComputedProperty(member) {\n            return !member.name || member.name.kind === 142 /* ComputedPropertyName */;\n        }\n        function getNodeSpan(node) {\n            return node.kind === 261 /* SourceFile */\n                ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd())\n                : ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd());\n        }\n        function getFunctionOrClassName(node) {\n            if (node.name && ts.getFullWidth(node.name) > 0) {\n                return ts.declarationNameToString(node.name);\n            }\n            else if (node.parent.kind === 223 /* VariableDeclaration */) {\n                return ts.declarationNameToString(node.parent.name);\n            }\n            else if (node.parent.kind === 192 /* BinaryExpression */ &&\n                node.parent.operatorToken.kind === 57 /* EqualsToken */) {\n                return nodeText(node.parent.left).replace(whiteSpaceRegex, \"\");\n            }\n            else if (node.parent.kind === 257 /* PropertyAssignment */ && node.parent.name) {\n                return nodeText(node.parent.name);\n            }\n            else if (ts.getModifierFlags(node) & 512 /* Default */) {\n                return \"default\";\n            }\n            else {\n                return ts.isClassLike(node) ? \"<class>\" : \"<function>\";\n            }\n        }\n        function isFunctionOrClassExpression(node) {\n            return node.kind === 184 /* FunctionExpression */ || node.kind === 185 /* ArrowFunction */ || node.kind === 197 /* ClassExpression */;\n        }\n        /**\n         * Matches all whitespace characters in a string. Eg:\n         *\n         * \"app.\n         *\n         * onactivated\"\n         *\n         * matches because of the newline, whereas\n         *\n         * \"app.onactivated\"\n         *\n         * does not match.\n         */\n        var whiteSpaceRegex = /\\s+/g;\n    })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {}));\n})(ts || (ts = {}));\n/* @internal */\nvar ts;\n(function (ts) {\n    var OutliningElementsCollector;\n    (function (OutliningElementsCollector) {\n        function collectElements(sourceFile) {\n            var elements = [];\n            var collapseText = \"...\";\n            function addOutliningSpan(hintSpanNode, startElement, endElement, autoCollapse) {\n                if (hintSpanNode && startElement && endElement) {\n                    var span_12 = {\n                        textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end),\n                        hintSpan: ts.createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end),\n                        bannerText: collapseText,\n                        autoCollapse: autoCollapse\n                    };\n                    elements.push(span_12);\n                }\n            }\n            function addOutliningSpanComments(commentSpan, autoCollapse) {\n                if (commentSpan) {\n                    var span_13 = {\n                        textSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end),\n                        hintSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end),\n                        bannerText: collapseText,\n                        autoCollapse: autoCollapse\n                    };\n                    elements.push(span_13);\n                }\n            }\n            function addOutliningForLeadingCommentsForNode(n) {\n                var comments = ts.getLeadingCommentRangesOfNode(n, sourceFile);\n                if (comments) {\n                    var firstSingleLineCommentStart = -1;\n                    var lastSingleLineCommentEnd = -1;\n                    var isFirstSingleLineComment = true;\n                    var singleLineCommentCount = 0;\n                    for (var _i = 0, comments_4 = comments; _i < comments_4.length; _i++) {\n                        var currentComment = comments_4[_i];\n                        // For single line comments, combine consecutive ones (2 or more) into\n                        // a single span from the start of the first till the end of the last\n                        if (currentComment.kind === 2 /* SingleLineCommentTrivia */) {\n                            if (isFirstSingleLineComment) {\n                                firstSingleLineCommentStart = currentComment.pos;\n                            }\n                            isFirstSingleLineComment = false;\n                            lastSingleLineCommentEnd = currentComment.end;\n                            singleLineCommentCount++;\n                        }\n                        else if (currentComment.kind === 3 /* MultiLineCommentTrivia */) {\n                            combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd);\n                            addOutliningSpanComments(currentComment, /*autoCollapse*/ false);\n                            singleLineCommentCount = 0;\n                            lastSingleLineCommentEnd = -1;\n                            isFirstSingleLineComment = true;\n                        }\n                    }\n                    combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd);\n                }\n            }\n            function combineAndAddMultipleSingleLineComments(count, start, end) {\n                // Only outline spans of two or more consecutive single line comments\n                if (count > 1) {\n                    var multipleSingleLineComments = {\n                        pos: start,\n                        end: end,\n                        kind: 2 /* SingleLineCommentTrivia */\n                    };\n                    addOutliningSpanComments(multipleSingleLineComments, /*autoCollapse*/ false);\n                }\n            }\n            function autoCollapse(node) {\n                return ts.isFunctionBlock(node) && node.parent.kind !== 185 /* ArrowFunction */;\n            }\n            var depth = 0;\n            var maxDepth = 20;\n            function walk(n) {\n                if (depth > maxDepth) {\n                    return;\n                }\n                if (ts.isDeclaration(n)) {\n                    addOutliningForLeadingCommentsForNode(n);\n                }\n                switch (n.kind) {\n                    case 204 /* Block */:\n                        if (!ts.isFunctionBlock(n)) {\n                            var parent_19 = n.parent;\n                            var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile);\n                            var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile);\n                            // Check if the block is standalone, or 'attached' to some parent statement.\n                            // If the latter, we want to collapse the block, but consider its hint span\n                            // to be the entire span of the parent.\n                            if (parent_19.kind === 209 /* DoStatement */ ||\n                                parent_19.kind === 212 /* ForInStatement */ ||\n                                parent_19.kind === 213 /* ForOfStatement */ ||\n                                parent_19.kind === 211 /* ForStatement */ ||\n                                parent_19.kind === 208 /* IfStatement */ ||\n                                parent_19.kind === 210 /* WhileStatement */ ||\n                                parent_19.kind === 217 /* WithStatement */ ||\n                                parent_19.kind === 256 /* CatchClause */) {\n                                addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n));\n                                break;\n                            }\n                            if (parent_19.kind === 221 /* TryStatement */) {\n                                // Could be the try-block, or the finally-block.\n                                var tryStatement = parent_19;\n                                if (tryStatement.tryBlock === n) {\n                                    addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n));\n                                    break;\n                                }\n                                else if (tryStatement.finallyBlock === n) {\n                                    var finallyKeyword = ts.findChildOfKind(tryStatement, 86 /* FinallyKeyword */, sourceFile);\n                                    if (finallyKeyword) {\n                                        addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n));\n                                        break;\n                                    }\n                                }\n                            }\n                            // Block was a standalone block.  In this case we want to only collapse\n                            // the span of the block, independent of any parent span.\n                            var span_14 = ts.createTextSpanFromBounds(n.getStart(), n.end);\n                            elements.push({\n                                textSpan: span_14,\n                                hintSpan: span_14,\n                                bannerText: collapseText,\n                                autoCollapse: autoCollapse(n)\n                            });\n                            break;\n                        }\n                    // Fallthrough.\n                    case 231 /* ModuleBlock */: {\n                        var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile);\n                        var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile);\n                        addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n));\n                        break;\n                    }\n                    case 226 /* ClassDeclaration */:\n                    case 227 /* InterfaceDeclaration */:\n                    case 229 /* EnumDeclaration */:\n                    case 176 /* ObjectLiteralExpression */:\n                    case 232 /* CaseBlock */: {\n                        var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile);\n                        var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile);\n                        addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n));\n                        break;\n                    }\n                    case 175 /* ArrayLiteralExpression */:\n                        var openBracket = ts.findChildOfKind(n, 20 /* OpenBracketToken */, sourceFile);\n                        var closeBracket = ts.findChildOfKind(n, 21 /* CloseBracketToken */, sourceFile);\n                        addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n));\n                        break;\n                }\n                depth++;\n                ts.forEachChild(n, walk);\n                depth--;\n            }\n            walk(sourceFile);\n            return elements;\n        }\n        OutliningElementsCollector.collectElements = collectElements;\n    })(OutliningElementsCollector = ts.OutliningElementsCollector || (ts.OutliningElementsCollector = {}));\n})(ts || (ts = {}));\n/* @internal */\nvar ts;\n(function (ts) {\n    // Note(cyrusn): this enum is ordered from strongest match type to weakest match type.\n    var PatternMatchKind;\n    (function (PatternMatchKind) {\n        PatternMatchKind[PatternMatchKind[\"exact\"] = 0] = \"exact\";\n        PatternMatchKind[PatternMatchKind[\"prefix\"] = 1] = \"prefix\";\n        PatternMatchKind[PatternMatchKind[\"substring\"] = 2] = \"substring\";\n        PatternMatchKind[PatternMatchKind[\"camelCase\"] = 3] = \"camelCase\";\n    })(PatternMatchKind = ts.PatternMatchKind || (ts.PatternMatchKind = {}));\n    function createPatternMatch(kind, punctuationStripped, isCaseSensitive, camelCaseWeight) {\n        return {\n            kind: kind,\n            punctuationStripped: punctuationStripped,\n            isCaseSensitive: isCaseSensitive,\n            camelCaseWeight: camelCaseWeight\n        };\n    }\n    function createPatternMatcher(pattern) {\n        // We'll often see the same candidate string many times when searching (For example, when\n        // we see the name of a module that is used everywhere, or the name of an overload).  As\n        // such, we cache the information we compute about the candidate for the life of this\n        // pattern matcher so we don't have to compute it multiple times.\n        var stringToWordSpans = ts.createMap();\n        pattern = pattern.trim();\n        var dotSeparatedSegments = pattern.split(\".\").map(function (p) { return createSegment(p.trim()); });\n        var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid);\n        return {\n            getMatches: getMatches,\n            getMatchesForLastSegmentOfPattern: getMatchesForLastSegmentOfPattern,\n            patternContainsDots: dotSeparatedSegments.length > 1\n        };\n        // Quick checks so we can bail out when asked to match a candidate.\n        function skipMatch(candidate) {\n            return invalidPattern || !candidate;\n        }\n        function getMatchesForLastSegmentOfPattern(candidate) {\n            if (skipMatch(candidate)) {\n                return undefined;\n            }\n            return matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments));\n        }\n        function getMatches(candidateContainers, candidate) {\n            if (skipMatch(candidate)) {\n                return undefined;\n            }\n            // First, check that the last part of the dot separated pattern matches the name of the\n            // candidate.  If not, then there's no point in proceeding and doing the more\n            // expensive work.\n            var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments));\n            if (!candidateMatch) {\n                return undefined;\n            }\n            candidateContainers = candidateContainers || [];\n            // -1 because the last part was checked against the name, and only the rest\n            // of the parts are checked against the container.\n            if (dotSeparatedSegments.length - 1 > candidateContainers.length) {\n                // There weren't enough container parts to match against the pattern parts.\n                // So this definitely doesn't match.\n                return undefined;\n            }\n            // So far so good.  Now break up the container for the candidate and check if all\n            // the dotted parts match up correctly.\n            var totalMatch = candidateMatch;\n            for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) {\n                var segment = dotSeparatedSegments[i];\n                var containerName = candidateContainers[j];\n                var containerMatch = matchSegment(containerName, segment);\n                if (!containerMatch) {\n                    // This container didn't match the pattern piece.  So there's no match at all.\n                    return undefined;\n                }\n                ts.addRange(totalMatch, containerMatch);\n            }\n            // Success, this symbol's full name matched against the dotted name the user was asking\n            // about.\n            return totalMatch;\n        }\n        function getWordSpans(word) {\n            if (!(word in stringToWordSpans)) {\n                stringToWordSpans[word] = breakIntoWordSpans(word);\n            }\n            return stringToWordSpans[word];\n        }\n        function matchTextChunk(candidate, chunk, punctuationStripped) {\n            var index = indexOfIgnoringCase(candidate, chunk.textLowerCase);\n            if (index === 0) {\n                if (chunk.text.length === candidate.length) {\n                    // a) Check if the part matches the candidate entirely, in an case insensitive or\n                    //    sensitive manner.  If it does, return that there was an exact match.\n                    return createPatternMatch(PatternMatchKind.exact, punctuationStripped, /*isCaseSensitive:*/ candidate === chunk.text);\n                }\n                else {\n                    // b) Check if the part is a prefix of the candidate, in a case insensitive or sensitive\n                    //    manner.  If it does, return that there was a prefix match.\n                    return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, /*isCaseSensitive:*/ ts.startsWith(candidate, chunk.text));\n                }\n            }\n            var isLowercase = chunk.isLowerCase;\n            if (isLowercase) {\n                if (index > 0) {\n                    // c) If the part is entirely lowercase, then check if it is contained anywhere in the\n                    //    candidate in a case insensitive manner.  If so, return that there was a substring\n                    //    match.\n                    //\n                    //    Note: We only have a substring match if the lowercase part is prefix match of some\n                    //    word part. That way we don't match something like 'Class' when the user types 'a'.\n                    //    But we would match 'FooAttribute' (since 'Attribute' starts with 'a').\n                    var wordSpans = getWordSpans(candidate);\n                    for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) {\n                        var span_15 = wordSpans_1[_i];\n                        if (partStartsWith(candidate, span_15, chunk.text, /*ignoreCase:*/ true)) {\n                            return createPatternMatch(PatternMatchKind.substring, punctuationStripped, \n                            /*isCaseSensitive:*/ partStartsWith(candidate, span_15, chunk.text, /*ignoreCase:*/ false));\n                        }\n                    }\n                }\n            }\n            else {\n                // d) If the part was not entirely lowercase, then check if it is contained in the\n                //    candidate in a case *sensitive* manner. If so, return that there was a substring\n                //    match.\n                if (candidate.indexOf(chunk.text) > 0) {\n                    return createPatternMatch(PatternMatchKind.substring, punctuationStripped, /*isCaseSensitive:*/ true);\n                }\n            }\n            if (!isLowercase) {\n                // e) If the part was not entirely lowercase, then attempt a camel cased match as well.\n                if (chunk.characterSpans.length > 0) {\n                    var candidateParts = getWordSpans(candidate);\n                    var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ false);\n                    if (camelCaseWeight !== undefined) {\n                        return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, /*isCaseSensitive:*/ true, /*camelCaseWeight:*/ camelCaseWeight);\n                    }\n                    camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ true);\n                    if (camelCaseWeight !== undefined) {\n                        return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, /*isCaseSensitive:*/ false, /*camelCaseWeight:*/ camelCaseWeight);\n                    }\n                }\n            }\n            if (isLowercase) {\n                // f) Is the pattern a substring of the candidate starting on one of the candidate's word boundaries?\n                // We could check every character boundary start of the candidate for the pattern. However, that's\n                // an m * n operation in the wost case. Instead, find the first instance of the pattern\n                // substring, and see if it starts on a capital letter. It seems unlikely that the user will try to\n                // filter the list based on a substring that starts on a capital letter and also with a lowercase one.\n                // (Pattern: fogbar, Candidate: quuxfogbarFogBar).\n                if (chunk.text.length < candidate.length) {\n                    if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) {\n                        return createPatternMatch(PatternMatchKind.substring, punctuationStripped, /*isCaseSensitive:*/ false);\n                    }\n                }\n            }\n            return undefined;\n        }\n        function containsSpaceOrAsterisk(text) {\n            for (var i = 0; i < text.length; i++) {\n                var ch = text.charCodeAt(i);\n                if (ch === 32 /* space */ || ch === 42 /* asterisk */) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        function matchSegment(candidate, segment) {\n            // First check if the segment matches as is.  This is also useful if the segment contains\n            // characters we would normally strip when splitting into parts that we also may want to\n            // match in the candidate.  For example if the segment is \"@int\" and the candidate is\n            // \"@int\", then that will show up as an exact match here.\n            //\n            // Note: if the segment contains a space or an asterisk then we must assume that it's a\n            // multi-word segment.\n            if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) {\n                var match = matchTextChunk(candidate, segment.totalTextChunk, /*punctuationStripped:*/ false);\n                if (match) {\n                    return [match];\n                }\n            }\n            // The logic for pattern matching is now as follows:\n            //\n            // 1) Break the segment passed in into words.  Breaking is rather simple and a\n            //    good way to think about it that if gives you all the individual alphanumeric words\n            //    of the pattern.\n            //\n            // 2) For each word try to match the word against the candidate value.\n            //\n            // 3) Matching is as follows:\n            //\n            //   a) Check if the word matches the candidate entirely, in an case insensitive or\n            //    sensitive manner.  If it does, return that there was an exact match.\n            //\n            //   b) Check if the word is a prefix of the candidate, in a case insensitive or\n            //      sensitive manner.  If it does, return that there was a prefix match.\n            //\n            //   c) If the word is entirely lowercase, then check if it is contained anywhere in the\n            //      candidate in a case insensitive manner.  If so, return that there was a substring\n            //      match.\n            //\n            //      Note: We only have a substring match if the lowercase part is prefix match of\n            //      some word part. That way we don't match something like 'Class' when the user\n            //      types 'a'. But we would match 'FooAttribute' (since 'Attribute' starts with\n            //      'a').\n            //\n            //   d) If the word was not entirely lowercase, then check if it is contained in the\n            //      candidate in a case *sensitive* manner. If so, return that there was a substring\n            //      match.\n            //\n            //   e) If the word was not entirely lowercase, then attempt a camel cased match as\n            //      well.\n            //\n            //   f) The word is all lower case. Is it a case insensitive substring of the candidate starting\n            //      on a part boundary of the candidate?\n            //\n            // Only if all words have some sort of match is the pattern considered matched.\n            var subWordTextChunks = segment.subWordTextChunks;\n            var matches = undefined;\n            for (var _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) {\n                var subWordTextChunk = subWordTextChunks_1[_i];\n                // Try to match the candidate with this word\n                var result = matchTextChunk(candidate, subWordTextChunk, /*punctuationStripped:*/ true);\n                if (!result) {\n                    return undefined;\n                }\n                matches = matches || [];\n                matches.push(result);\n            }\n            return matches;\n        }\n        function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) {\n            var patternPartStart = patternSpan ? patternSpan.start : 0;\n            var patternPartLength = patternSpan ? patternSpan.length : pattern.length;\n            if (patternPartLength > candidateSpan.length) {\n                // Pattern part is longer than the candidate part. There can never be a match.\n                return false;\n            }\n            if (ignoreCase) {\n                for (var i = 0; i < patternPartLength; i++) {\n                    var ch1 = pattern.charCodeAt(patternPartStart + i);\n                    var ch2 = candidate.charCodeAt(candidateSpan.start + i);\n                    if (toLowerCase(ch1) !== toLowerCase(ch2)) {\n                        return false;\n                    }\n                }\n            }\n            else {\n                for (var i = 0; i < patternPartLength; i++) {\n                    var ch1 = pattern.charCodeAt(patternPartStart + i);\n                    var ch2 = candidate.charCodeAt(candidateSpan.start + i);\n                    if (ch1 !== ch2) {\n                        return false;\n                    }\n                }\n            }\n            return true;\n        }\n        function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) {\n            var chunkCharacterSpans = chunk.characterSpans;\n            // Note: we may have more pattern parts than candidate parts.  This is because multiple\n            // pattern parts may match a candidate part.  For example \"SiUI\" against \"SimpleUI\".\n            // We'll have 3 pattern parts Si/U/I against two candidate parts Simple/UI.  However, U\n            // and I will both match in UI.\n            var currentCandidate = 0;\n            var currentChunkSpan = 0;\n            var firstMatch = undefined;\n            var contiguous = undefined;\n            while (true) {\n                // Let's consider our termination cases\n                if (currentChunkSpan === chunkCharacterSpans.length) {\n                    // We did match! We shall assign a weight to this\n                    var weight = 0;\n                    // Was this contiguous?\n                    if (contiguous) {\n                        weight += 1;\n                    }\n                    // Did we start at the beginning of the candidate?\n                    if (firstMatch === 0) {\n                        weight += 2;\n                    }\n                    return weight;\n                }\n                else if (currentCandidate === candidateParts.length) {\n                    // No match, since we still have more of the pattern to hit\n                    return undefined;\n                }\n                var candidatePart = candidateParts[currentCandidate];\n                var gotOneMatchThisCandidate = false;\n                // Consider the case of matching SiUI against SimpleUIElement. The candidate parts\n                // will be Simple/UI/Element, and the pattern parts will be Si/U/I.  We'll match 'Si'\n                // against 'Simple' first.  Then we'll match 'U' against 'UI'. However, we want to\n                // still keep matching pattern parts against that candidate part.\n                for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) {\n                    var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan];\n                    if (gotOneMatchThisCandidate) {\n                        // We've already gotten one pattern part match in this candidate.  We will\n                        // only continue trying to consumer pattern parts if the last part and this\n                        // part are both upper case.\n                        if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) ||\n                            !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) {\n                            break;\n                        }\n                    }\n                    if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) {\n                        break;\n                    }\n                    gotOneMatchThisCandidate = true;\n                    firstMatch = firstMatch === undefined ? currentCandidate : firstMatch;\n                    // If we were contiguous, then keep that value.  If we weren't, then keep that\n                    // value.  If we don't know, then set the value to 'true' as an initial match is\n                    // obviously contiguous.\n                    contiguous = contiguous === undefined ? true : contiguous;\n                    candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length);\n                }\n                // Check if we matched anything at all.  If we didn't, then we need to unset the\n                // contiguous bit if we currently had it set.\n                // If we haven't set the bit yet, then that means we haven't matched anything so\n                // far, and we don't want to change that.\n                if (!gotOneMatchThisCandidate && contiguous !== undefined) {\n                    contiguous = false;\n                }\n                // Move onto the next candidate.\n                currentCandidate++;\n            }\n        }\n    }\n    ts.createPatternMatcher = createPatternMatcher;\n    function createSegment(text) {\n        return {\n            totalTextChunk: createTextChunk(text),\n            subWordTextChunks: breakPatternIntoTextChunks(text)\n        };\n    }\n    // A segment is considered invalid if we couldn't find any words in it.\n    function segmentIsInvalid(segment) {\n        return segment.subWordTextChunks.length === 0;\n    }\n    function isUpperCaseLetter(ch) {\n        // Fast check for the ascii range.\n        if (ch >= 65 /* A */ && ch <= 90 /* Z */) {\n            return true;\n        }\n        if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 5 /* Latest */)) {\n            return false;\n        }\n        // TODO: find a way to determine this for any unicode characters in a\n        // non-allocating manner.\n        var str = String.fromCharCode(ch);\n        return str === str.toUpperCase();\n    }\n    function isLowerCaseLetter(ch) {\n        // Fast check for the ascii range.\n        if (ch >= 97 /* a */ && ch <= 122 /* z */) {\n            return true;\n        }\n        if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 5 /* Latest */)) {\n            return false;\n        }\n        // TODO: find a way to determine this for any unicode characters in a\n        // non-allocating manner.\n        var str = String.fromCharCode(ch);\n        return str === str.toLowerCase();\n    }\n    // Assumes 'value' is already lowercase.\n    function indexOfIgnoringCase(string, value) {\n        for (var i = 0, n = string.length - value.length; i <= n; i++) {\n            if (startsWithIgnoringCase(string, value, i)) {\n                return i;\n            }\n        }\n        return -1;\n    }\n    // Assumes 'value' is already lowercase.\n    function startsWithIgnoringCase(string, value, start) {\n        for (var i = 0, n = value.length; i < n; i++) {\n            var ch1 = toLowerCase(string.charCodeAt(i + start));\n            var ch2 = value.charCodeAt(i);\n            if (ch1 !== ch2) {\n                return false;\n            }\n        }\n        return true;\n    }\n    function toLowerCase(ch) {\n        // Fast convert for the ascii range.\n        if (ch >= 65 /* A */ && ch <= 90 /* Z */) {\n            return 97 /* a */ + (ch - 65 /* A */);\n        }\n        if (ch < 127 /* maxAsciiCharacter */) {\n            return ch;\n        }\n        // TODO: find a way to compute this for any unicode characters in a\n        // non-allocating manner.\n        return String.fromCharCode(ch).toLowerCase().charCodeAt(0);\n    }\n    function isDigit(ch) {\n        // TODO(cyrusn): Find a way to support this for unicode digits.\n        return ch >= 48 /* _0 */ && ch <= 57 /* _9 */;\n    }\n    function isWordChar(ch) {\n        return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit(ch) || ch === 95 /* _ */ || ch === 36 /* $ */;\n    }\n    function breakPatternIntoTextChunks(pattern) {\n        var result = [];\n        var wordStart = 0;\n        var wordLength = 0;\n        for (var i = 0; i < pattern.length; i++) {\n            var ch = pattern.charCodeAt(i);\n            if (isWordChar(ch)) {\n                if (wordLength === 0) {\n                    wordStart = i;\n                }\n                wordLength++;\n            }\n            else {\n                if (wordLength > 0) {\n                    result.push(createTextChunk(pattern.substr(wordStart, wordLength)));\n                    wordLength = 0;\n                }\n            }\n        }\n        if (wordLength > 0) {\n            result.push(createTextChunk(pattern.substr(wordStart, wordLength)));\n        }\n        return result;\n    }\n    function createTextChunk(text) {\n        var textLowerCase = text.toLowerCase();\n        return {\n            text: text,\n            textLowerCase: textLowerCase,\n            isLowerCase: text === textLowerCase,\n            characterSpans: breakIntoCharacterSpans(text)\n        };\n    }\n    /* @internal */ function breakIntoCharacterSpans(identifier) {\n        return breakIntoSpans(identifier, /*word:*/ false);\n    }\n    ts.breakIntoCharacterSpans = breakIntoCharacterSpans;\n    /* @internal */ function breakIntoWordSpans(identifier) {\n        return breakIntoSpans(identifier, /*word:*/ true);\n    }\n    ts.breakIntoWordSpans = breakIntoWordSpans;\n    function breakIntoSpans(identifier, word) {\n        var result = [];\n        var wordStart = 0;\n        for (var i = 1, n = identifier.length; i < n; i++) {\n            var lastIsDigit = isDigit(identifier.charCodeAt(i - 1));\n            var currentIsDigit = isDigit(identifier.charCodeAt(i));\n            var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i);\n            var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart);\n            if (charIsPunctuation(identifier.charCodeAt(i - 1)) ||\n                charIsPunctuation(identifier.charCodeAt(i)) ||\n                lastIsDigit !== currentIsDigit ||\n                hasTransitionFromLowerToUpper ||\n                hasTransitionFromUpperToLower) {\n                if (!isAllPunctuation(identifier, wordStart, i)) {\n                    result.push(ts.createTextSpan(wordStart, i - wordStart));\n                }\n                wordStart = i;\n            }\n        }\n        if (!isAllPunctuation(identifier, wordStart, identifier.length)) {\n            result.push(ts.createTextSpan(wordStart, identifier.length - wordStart));\n        }\n        return result;\n    }\n    function charIsPunctuation(ch) {\n        switch (ch) {\n            case 33 /* exclamation */:\n            case 34 /* doubleQuote */:\n            case 35 /* hash */:\n            case 37 /* percent */:\n            case 38 /* ampersand */:\n            case 39 /* singleQuote */:\n            case 40 /* openParen */:\n            case 41 /* closeParen */:\n            case 42 /* asterisk */:\n            case 44 /* comma */:\n            case 45 /* minus */:\n            case 46 /* dot */:\n            case 47 /* slash */:\n            case 58 /* colon */:\n            case 59 /* semicolon */:\n            case 63 /* question */:\n            case 64 /* at */:\n            case 91 /* openBracket */:\n            case 92 /* backslash */:\n            case 93 /* closeBracket */:\n            case 95 /* _ */:\n            case 123 /* openBrace */:\n            case 125 /* closeBrace */:\n                return true;\n        }\n        return false;\n    }\n    function isAllPunctuation(identifier, start, end) {\n        for (var i = start; i < end; i++) {\n            var ch = identifier.charCodeAt(i);\n            // We don't consider _ or $ as punctuation as there may be things with that name.\n            if (!charIsPunctuation(ch) || ch === 95 /* _ */ || ch === 36 /* $ */) {\n                return false;\n            }\n        }\n        return true;\n    }\n    function transitionFromUpperToLower(identifier, word, index, wordStart) {\n        if (word) {\n            // Cases this supports:\n            // 1) IDisposable -> I, Disposable\n            // 2) UIElement -> UI, Element\n            // 3) HTMLDocument -> HTML, Document\n            //\n            // etc.\n            if (index !== wordStart &&\n                index + 1 < identifier.length) {\n                var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index));\n                var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1));\n                if (currentIsUpper && nextIsLower) {\n                    // We have a transition from an upper to a lower letter here.  But we only\n                    // want to break if all the letters that preceded are uppercase.  i.e. if we\n                    // have \"Foo\" we don't want to break that into \"F, oo\".  But if we have\n                    // \"IFoo\" or \"UIFoo\", then we want to break that into \"I, Foo\" and \"UI,\n                    // Foo\".  i.e. the last uppercase letter belongs to the lowercase letters\n                    // that follows.  Note: this will make the following not split properly:\n                    // \"HELLOthere\".  However, these sorts of names do not show up in .Net\n                    // programs.\n                    for (var i = wordStart; i < index; i++) {\n                        if (!isUpperCaseLetter(identifier.charCodeAt(i))) {\n                            return false;\n                        }\n                    }\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n    function transitionFromLowerToUpper(identifier, word, index) {\n        var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1));\n        var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index));\n        // See if the casing indicates we're starting a new word. Note: if we're breaking on\n        // words, then just seeing an upper case character isn't enough.  Instead, it has to\n        // be uppercase and the previous character can't be uppercase.\n        //\n        // For example, breaking \"AddMetadata\" on words would make: Add Metadata\n        //\n        // on characters would be: A dd M etadata\n        //\n        // Break \"AM\" on words would be: AM\n        //\n        // on characters would be: A M\n        //\n        // We break the search string on characters.  But we break the symbol name on words.\n        var transition = word\n            ? (currentIsUpper && !lastIsUpper)\n            : currentIsUpper;\n        return transition;\n    }\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    function preProcessFile(sourceText, readImportFiles, detectJavaScriptImports) {\n        if (readImportFiles === void 0) { readImportFiles = true; }\n        if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; }\n        var referencedFiles = [];\n        var typeReferenceDirectives = [];\n        var importedFiles = [];\n        var ambientExternalModules;\n        var isNoDefaultLib = false;\n        var braceNesting = 0;\n        // assume that text represent an external module if it contains at least one top level import/export\n        // ambient modules that are found inside external modules are interpreted as module augmentations\n        var externalModule = false;\n        function nextToken() {\n            var token = ts.scanner.scan();\n            if (token === 16 /* OpenBraceToken */) {\n                braceNesting++;\n            }\n            else if (token === 17 /* CloseBraceToken */) {\n                braceNesting--;\n            }\n            return token;\n        }\n        function processTripleSlashDirectives() {\n            var commentRanges = ts.getLeadingCommentRanges(sourceText, 0);\n            ts.forEach(commentRanges, function (commentRange) {\n                var comment = sourceText.substring(commentRange.pos, commentRange.end);\n                var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, commentRange);\n                if (referencePathMatchResult) {\n                    isNoDefaultLib = referencePathMatchResult.isNoDefaultLib;\n                    var fileReference = referencePathMatchResult.fileReference;\n                    if (fileReference) {\n                        var collection = referencePathMatchResult.isTypeReferenceDirective\n                            ? typeReferenceDirectives\n                            : referencedFiles;\n                        collection.push(fileReference);\n                    }\n                }\n            });\n        }\n        function getFileReference() {\n            var file = ts.scanner.getTokenValue();\n            var pos = ts.scanner.getTokenPos();\n            return {\n                fileName: file,\n                pos: pos,\n                end: pos + file.length\n            };\n        }\n        function recordAmbientExternalModule() {\n            if (!ambientExternalModules) {\n                ambientExternalModules = [];\n            }\n            ambientExternalModules.push({ ref: getFileReference(), depth: braceNesting });\n        }\n        function recordModuleName() {\n            importedFiles.push(getFileReference());\n            markAsExternalModuleIfTopLevel();\n        }\n        function markAsExternalModuleIfTopLevel() {\n            if (braceNesting === 0) {\n                externalModule = true;\n            }\n        }\n        /**\n         * Returns true if at least one token was consumed from the stream\n         */\n        function tryConsumeDeclare() {\n            var token = ts.scanner.getToken();\n            if (token === 123 /* DeclareKeyword */) {\n                // declare module \"mod\"\n                token = nextToken();\n                if (token === 127 /* ModuleKeyword */) {\n                    token = nextToken();\n                    if (token === 9 /* StringLiteral */) {\n                        recordAmbientExternalModule();\n                    }\n                }\n                return true;\n            }\n            return false;\n        }\n        /**\n         * Returns true if at least one token was consumed from the stream\n         */\n        function tryConsumeImport() {\n            var token = ts.scanner.getToken();\n            if (token === 90 /* ImportKeyword */) {\n                token = nextToken();\n                if (token === 9 /* StringLiteral */) {\n                    // import \"mod\";\n                    recordModuleName();\n                    return true;\n                }\n                else {\n                    if (token === 70 /* Identifier */ || ts.isKeyword(token)) {\n                        token = nextToken();\n                        if (token === 138 /* FromKeyword */) {\n                            token = nextToken();\n                            if (token === 9 /* StringLiteral */) {\n                                // import d from \"mod\";\n                                recordModuleName();\n                                return true;\n                            }\n                        }\n                        else if (token === 57 /* EqualsToken */) {\n                            if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) {\n                                return true;\n                            }\n                        }\n                        else if (token === 25 /* CommaToken */) {\n                            // consume comma and keep going\n                            token = nextToken();\n                        }\n                        else {\n                            // unknown syntax\n                            return true;\n                        }\n                    }\n                    if (token === 16 /* OpenBraceToken */) {\n                        token = nextToken();\n                        // consume \"{ a as B, c, d as D}\" clauses\n                        // make sure that it stops on EOF\n                        while (token !== 17 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) {\n                            token = nextToken();\n                        }\n                        if (token === 17 /* CloseBraceToken */) {\n                            token = nextToken();\n                            if (token === 138 /* FromKeyword */) {\n                                token = nextToken();\n                                if (token === 9 /* StringLiteral */) {\n                                    // import {a as A} from \"mod\";\n                                    // import d, {a, b as B} from \"mod\"\n                                    recordModuleName();\n                                }\n                            }\n                        }\n                    }\n                    else if (token === 38 /* AsteriskToken */) {\n                        token = nextToken();\n                        if (token === 117 /* AsKeyword */) {\n                            token = nextToken();\n                            if (token === 70 /* Identifier */ || ts.isKeyword(token)) {\n                                token = nextToken();\n                                if (token === 138 /* FromKeyword */) {\n                                    token = nextToken();\n                                    if (token === 9 /* StringLiteral */) {\n                                        // import * as NS from \"mod\"\n                                        // import d, * as NS from \"mod\"\n                                        recordModuleName();\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }\n                return true;\n            }\n            return false;\n        }\n        function tryConsumeExport() {\n            var token = ts.scanner.getToken();\n            if (token === 83 /* ExportKeyword */) {\n                markAsExternalModuleIfTopLevel();\n                token = nextToken();\n                if (token === 16 /* OpenBraceToken */) {\n                    token = nextToken();\n                    // consume \"{ a as B, c, d as D}\" clauses\n                    // make sure it stops on EOF\n                    while (token !== 17 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) {\n                        token = nextToken();\n                    }\n                    if (token === 17 /* CloseBraceToken */) {\n                        token = nextToken();\n                        if (token === 138 /* FromKeyword */) {\n                            token = nextToken();\n                            if (token === 9 /* StringLiteral */) {\n                                // export {a as A} from \"mod\";\n                                // export {a, b as B} from \"mod\"\n                                recordModuleName();\n                            }\n                        }\n                    }\n                }\n                else if (token === 38 /* AsteriskToken */) {\n                    token = nextToken();\n                    if (token === 138 /* FromKeyword */) {\n                        token = nextToken();\n                        if (token === 9 /* StringLiteral */) {\n                            // export * from \"mod\"\n                            recordModuleName();\n                        }\n                    }\n                }\n                else if (token === 90 /* ImportKeyword */) {\n                    token = nextToken();\n                    if (token === 70 /* Identifier */ || ts.isKeyword(token)) {\n                        token = nextToken();\n                        if (token === 57 /* EqualsToken */) {\n                            if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) {\n                                return true;\n                            }\n                        }\n                    }\n                }\n                return true;\n            }\n            return false;\n        }\n        function tryConsumeRequireCall(skipCurrentToken) {\n            var token = skipCurrentToken ? nextToken() : ts.scanner.getToken();\n            if (token === 131 /* RequireKeyword */) {\n                token = nextToken();\n                if (token === 18 /* OpenParenToken */) {\n                    token = nextToken();\n                    if (token === 9 /* StringLiteral */) {\n                        //  require(\"mod\");\n                        recordModuleName();\n                    }\n                }\n                return true;\n            }\n            return false;\n        }\n        function tryConsumeDefine() {\n            var token = ts.scanner.getToken();\n            if (token === 70 /* Identifier */ && ts.scanner.getTokenValue() === \"define\") {\n                token = nextToken();\n                if (token !== 18 /* OpenParenToken */) {\n                    return true;\n                }\n                token = nextToken();\n                if (token === 9 /* StringLiteral */) {\n                    // looks like define (\"modname\", ... - skip string literal and comma\n                    token = nextToken();\n                    if (token === 25 /* CommaToken */) {\n                        token = nextToken();\n                    }\n                    else {\n                        // unexpected token\n                        return true;\n                    }\n                }\n                // should be start of dependency list\n                if (token !== 20 /* OpenBracketToken */) {\n                    return true;\n                }\n                // skip open bracket\n                token = nextToken();\n                var i = 0;\n                // scan until ']' or EOF\n                while (token !== 21 /* CloseBracketToken */ && token !== 1 /* EndOfFileToken */) {\n                    // record string literals as module names\n                    if (token === 9 /* StringLiteral */) {\n                        recordModuleName();\n                        i++;\n                    }\n                    token = nextToken();\n                }\n                return true;\n            }\n            return false;\n        }\n        function processImports() {\n            ts.scanner.setText(sourceText);\n            nextToken();\n            // Look for:\n            //    import \"mod\";\n            //    import d from \"mod\"\n            //    import {a as A } from \"mod\";\n            //    import * as NS  from \"mod\"\n            //    import d, {a, b as B} from \"mod\"\n            //    import i = require(\"mod\");\n            //\n            //    export * from \"mod\"\n            //    export {a as b} from \"mod\"\n            //    export import i = require(\"mod\")\n            //    (for JavaScript files) require(\"mod\")\n            while (true) {\n                if (ts.scanner.getToken() === 1 /* EndOfFileToken */) {\n                    break;\n                }\n                // check if at least one of alternative have moved scanner forward\n                if (tryConsumeDeclare() ||\n                    tryConsumeImport() ||\n                    tryConsumeExport() ||\n                    (detectJavaScriptImports && (tryConsumeRequireCall(/*skipCurrentToken*/ false) || tryConsumeDefine()))) {\n                    continue;\n                }\n                else {\n                    nextToken();\n                }\n            }\n            ts.scanner.setText(undefined);\n        }\n        if (readImportFiles) {\n            processImports();\n        }\n        processTripleSlashDirectives();\n        if (externalModule) {\n            // for external modules module all nested ambient modules are augmentations\n            if (ambientExternalModules) {\n                // move all detected ambient modules to imported files since they need to be resolved\n                for (var _i = 0, ambientExternalModules_1 = ambientExternalModules; _i < ambientExternalModules_1.length; _i++) {\n                    var decl = ambientExternalModules_1[_i];\n                    importedFiles.push(decl.ref);\n                }\n            }\n            return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: undefined };\n        }\n        else {\n            // for global scripts ambient modules still can have augmentations - look for ambient modules with depth > 0\n            var ambientModuleNames = void 0;\n            if (ambientExternalModules) {\n                for (var _a = 0, ambientExternalModules_2 = ambientExternalModules; _a < ambientExternalModules_2.length; _a++) {\n                    var decl = ambientExternalModules_2[_a];\n                    if (decl.depth === 0) {\n                        if (!ambientModuleNames) {\n                            ambientModuleNames = [];\n                        }\n                        ambientModuleNames.push(decl.ref.fileName);\n                    }\n                    else {\n                        importedFiles.push(decl.ref);\n                    }\n                }\n            }\n            return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientModuleNames };\n        }\n    }\n    ts.preProcessFile = preProcessFile;\n})(ts || (ts = {}));\n/* @internal */\nvar ts;\n(function (ts) {\n    var Rename;\n    (function (Rename) {\n        function getRenameInfo(typeChecker, defaultLibFileName, getCanonicalFileName, sourceFile, position) {\n            var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName));\n            var node = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ true);\n            if (node) {\n                if (node.kind === 70 /* Identifier */ ||\n                    node.kind === 9 /* StringLiteral */ ||\n                    ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) ||\n                    ts.isThis(node)) {\n                    var symbol = typeChecker.getSymbolAtLocation(node);\n                    // Only allow a symbol to be renamed if it actually has at least one declaration.\n                    if (symbol) {\n                        var declarations = symbol.getDeclarations();\n                        if (declarations && declarations.length > 0) {\n                            // Disallow rename for elements that are defined in the standard TypeScript library.\n                            if (ts.forEach(declarations, isDefinedInLibraryFile)) {\n                                return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library));\n                            }\n                            var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node));\n                            var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node);\n                            if (kind) {\n                                return {\n                                    canRename: true,\n                                    kind: kind,\n                                    displayName: displayName,\n                                    localizedErrorMessage: undefined,\n                                    fullDisplayName: typeChecker.getFullyQualifiedName(symbol),\n                                    kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),\n                                    triggerSpan: createTriggerSpanForNode(node, sourceFile)\n                                };\n                            }\n                        }\n                    }\n                    else if (node.kind === 9 /* StringLiteral */) {\n                        var type = ts.getStringLiteralTypeForNode(node, typeChecker);\n                        if (type) {\n                            if (isDefinedInLibraryFile(node)) {\n                                return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library));\n                            }\n                            else {\n                                var displayName = ts.stripQuotes(type.text);\n                                return {\n                                    canRename: true,\n                                    kind: ts.ScriptElementKind.variableElement,\n                                    displayName: displayName,\n                                    localizedErrorMessage: undefined,\n                                    fullDisplayName: displayName,\n                                    kindModifiers: ts.ScriptElementKindModifier.none,\n                                    triggerSpan: createTriggerSpanForNode(node, sourceFile)\n                                };\n                            }\n                        }\n                    }\n                }\n            }\n            return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element));\n            function getRenameInfoError(localizedErrorMessage) {\n                return {\n                    canRename: false,\n                    localizedErrorMessage: localizedErrorMessage,\n                    displayName: undefined,\n                    fullDisplayName: undefined,\n                    kind: undefined,\n                    kindModifiers: undefined,\n                    triggerSpan: undefined\n                };\n            }\n            function isDefinedInLibraryFile(declaration) {\n                if (defaultLibFileName) {\n                    var sourceFile_1 = declaration.getSourceFile();\n                    var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName));\n                    if (canonicalName === canonicalDefaultLibName) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n            function createTriggerSpanForNode(node, sourceFile) {\n                var start = node.getStart(sourceFile);\n                var width = node.getWidth(sourceFile);\n                if (node.kind === 9 /* StringLiteral */) {\n                    // Exclude the quotes\n                    start += 1;\n                    width -= 2;\n                }\n                return ts.createTextSpan(start, width);\n            }\n        }\n        Rename.getRenameInfo = getRenameInfo;\n    })(Rename = ts.Rename || (ts.Rename = {}));\n})(ts || (ts = {}));\n///<reference path='services.ts' />\n/* @internal */\nvar ts;\n(function (ts) {\n    var SignatureHelp;\n    (function (SignatureHelp) {\n        // A partially written generic type expression is not guaranteed to have the correct syntax tree. the expression could be parsed as less than/greater than expression or a comma expression\n        // or some other combination depending on what the user has typed so far. For the purposes of signature help we need to consider any location after \"<\" as a possible generic type reference.\n        // To do this, the method will back parse the expression starting at the position required. it will try to parse the current expression as a generic type expression, if it did succeed it\n        // will return the generic identifier that started the expression (e.g. \"foo\" in \"foo<any, |\"). It is then up to the caller to ensure that this is a valid generic expression through\n        // looking up the type. The method will also keep track of the parameter index inside the expression.\n        // public static isInPartiallyWrittenTypeArgumentList(syntaxTree: TypeScript.SyntaxTree, position: number): any {\n        //    let token = Syntax.findTokenOnLeft(syntaxTree.sourceUnit(), position, /*includeSkippedTokens*/ true);\n        //    if (token && TypeScript.Syntax.hasAncestorOfKind(token, TypeScript.SyntaxKind.TypeParameterList)) {\n        //        // We are in the wrong generic list. bail out\n        //        return null;\n        //    }\n        //    let stack = 0;\n        //    let argumentIndex = 0;\n        //    whileLoop:\n        //    while (token) {\n        //        switch (token.kind()) {\n        //            case TypeScript.SyntaxKind.LessThanToken:\n        //                if (stack === 0) {\n        //                    // Found the beginning of the generic argument expression\n        //                    let lessThanToken = token;\n        //                    token = previousToken(token, /*includeSkippedTokens*/ true);\n        //                    if (!token || token.kind() !== TypeScript.SyntaxKind.IdentifierName) {\n        //                        break whileLoop;\n        //                    }\n        //                    // Found the name, return the data\n        //                    return {\n        //                        genericIdentifer: token,\n        //                        lessThanToken: lessThanToken,\n        //                        argumentIndex: argumentIndex\n        //                    };\n        //                }\n        //                else if (stack < 0) {\n        //                    // Seen one too many less than tokens, bail out\n        //                    break whileLoop;\n        //                }\n        //                else {\n        //                    stack--;\n        //                }\n        //                break;\n        //            case TypeScript.SyntaxKind.GreaterThanGreaterThanGreaterThanToken:\n        //                stack++;\n        //            // Intentional fall through\n        //            case TypeScript.SyntaxKind.GreaterThanToken:\n        //                stack++;\n        //                break;\n        //            case TypeScript.SyntaxKind.CommaToken:\n        //                if (stack == 0) {\n        //                    argumentIndex++;\n        //                }\n        //                break;\n        //            case TypeScript.SyntaxKind.CloseBraceToken:\n        //                // This can be object type, skip untill we find the matching open brace token\n        //                let unmatchedOpenBraceTokens = 0;\n        //                // Skip untill the matching open brace token\n        //                token = SignatureInfoHelpers.moveBackUpTillMatchingTokenKind(token, TypeScript.SyntaxKind.CloseBraceToken, TypeScript.SyntaxKind.OpenBraceToken);\n        //                if (!token) {\n        //                    // No matching token was found. bail out\n        //                    break whileLoop;\n        //                }\n        //                break;\n        //            case TypeScript.SyntaxKind.EqualsGreaterThanToken:\n        //                // This can be a function type or a constructor type. In either case, we want to skip the function definition\n        //                token = previousToken(token, /*includeSkippedTokens*/ true);\n        //                if (token && token.kind() === TypeScript.SyntaxKind.CloseParenToken) {\n        //                    // Skip untill the matching open paren token\n        //                    token = SignatureInfoHelpers.moveBackUpTillMatchingTokenKind(token, TypeScript.SyntaxKind.CloseParenToken, TypeScript.SyntaxKind.OpenParenToken);\n        //                    if (token && token.kind() === TypeScript.SyntaxKind.GreaterThanToken) {\n        //                        // Another generic type argument list, skip it\\\n        //                        token = SignatureInfoHelpers.moveBackUpTillMatchingTokenKind(token, TypeScript.SyntaxKind.GreaterThanToken, TypeScript.SyntaxKind.LessThanToken);\n        //                    }\n        //                    if (token && token.kind() === TypeScript.SyntaxKind.NewKeyword) {\n        //                        // In case this was a constructor type, skip the new keyword\n        //                        token = previousToken(token, /*includeSkippedTokens*/ true);\n        //                    }\n        //                    if (!token) {\n        //                        // No matching token was found. bail out\n        //                        break whileLoop;\n        //                    }\n        //                }\n        //                else {\n        //                    // This is not a function type. exit the main loop\n        //                    break whileLoop;\n        //                }\n        //                break;\n        //            case TypeScript.SyntaxKind.IdentifierName:\n        //            case TypeScript.SyntaxKind.AnyKeyword:\n        //            case TypeScript.SyntaxKind.NumberKeyword:\n        //            case TypeScript.SyntaxKind.StringKeyword:\n        //            case TypeScript.SyntaxKind.VoidKeyword:\n        //            case TypeScript.SyntaxKind.BooleanKeyword:\n        //            case TypeScript.SyntaxKind.DotToken:\n        //            case TypeScript.SyntaxKind.OpenBracketToken:\n        //            case TypeScript.SyntaxKind.CloseBracketToken:\n        //                // Valid tokens in a type name. Skip.\n        //                break;\n        //            default:\n        //                break whileLoop;\n        //        }\n        //        token = previousToken(token, /*includeSkippedTokens*/ true);\n        //    }\n        //    return null;\n        // }\n        // private static moveBackUpTillMatchingTokenKind(token: TypeScript.ISyntaxToken, tokenKind: TypeScript.SyntaxKind, matchingTokenKind: TypeScript.SyntaxKind): TypeScript.ISyntaxToken {\n        //    if (!token || token.kind() !== tokenKind) {\n        //        throw TypeScript.Errors.invalidOperation();\n        //    }\n        //    // Skip the current token\n        //    token = previousToken(token, /*includeSkippedTokens*/ true);\n        //    let stack = 0;\n        //    while (token) {\n        //        if (token.kind() === matchingTokenKind) {\n        //            if (stack === 0) {\n        //                // Found the matching token, return\n        //                return token;\n        //            }\n        //            else if (stack < 0) {\n        //                // tokens overlapped.. bail out.\n        //                break;\n        //            }\n        //            else {\n        //                stack--;\n        //            }\n        //        }\n        //        else if (token.kind() === tokenKind) {\n        //            stack++;\n        //        }\n        //        // Move back\n        //        token = previousToken(token, /*includeSkippedTokens*/ true);\n        //    }\n        //    // Did not find matching token\n        //    return null;\n        // }\n        var emptyArray = [];\n        var ArgumentListKind;\n        (function (ArgumentListKind) {\n            ArgumentListKind[ArgumentListKind[\"TypeArguments\"] = 0] = \"TypeArguments\";\n            ArgumentListKind[ArgumentListKind[\"CallArguments\"] = 1] = \"CallArguments\";\n            ArgumentListKind[ArgumentListKind[\"TaggedTemplateArguments\"] = 2] = \"TaggedTemplateArguments\";\n        })(ArgumentListKind = SignatureHelp.ArgumentListKind || (SignatureHelp.ArgumentListKind = {}));\n        function getSignatureHelpItems(program, sourceFile, position, cancellationToken) {\n            var typeChecker = program.getTypeChecker();\n            // Decide whether to show signature help\n            var startingToken = ts.findTokenOnLeftOfPosition(sourceFile, position);\n            if (!startingToken) {\n                // We are at the beginning of the file\n                return undefined;\n            }\n            var argumentInfo = getContainingArgumentInfo(startingToken, position, sourceFile);\n            cancellationToken.throwIfCancellationRequested();\n            // Semantic filtering of signature help\n            if (!argumentInfo) {\n                return undefined;\n            }\n            var call = argumentInfo.invocation;\n            var candidates = [];\n            var resolvedSignature = typeChecker.getResolvedSignature(call, candidates);\n            cancellationToken.throwIfCancellationRequested();\n            if (!candidates.length) {\n                // We didn't have any sig help items produced by the TS compiler.  If this is a JS\n                // file, then see if we can figure out anything better.\n                if (ts.isSourceFileJavaScript(sourceFile)) {\n                    return createJavaScriptSignatureHelpItems(argumentInfo, program);\n                }\n                return undefined;\n            }\n            return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo, typeChecker);\n        }\n        SignatureHelp.getSignatureHelpItems = getSignatureHelpItems;\n        function createJavaScriptSignatureHelpItems(argumentInfo, program) {\n            if (argumentInfo.invocation.kind !== 179 /* CallExpression */) {\n                return undefined;\n            }\n            // See if we can find some symbol with the call expression name that has call signatures.\n            var callExpression = argumentInfo.invocation;\n            var expression = callExpression.expression;\n            var name = expression.kind === 70 /* Identifier */\n                ? expression\n                : expression.kind === 177 /* PropertyAccessExpression */\n                    ? expression.name\n                    : undefined;\n            if (!name || !name.text) {\n                return undefined;\n            }\n            var typeChecker = program.getTypeChecker();\n            for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {\n                var sourceFile = _a[_i];\n                var nameToDeclarations = sourceFile.getNamedDeclarations();\n                var declarations = nameToDeclarations[name.text];\n                if (declarations) {\n                    for (var _b = 0, declarations_10 = declarations; _b < declarations_10.length; _b++) {\n                        var declaration = declarations_10[_b];\n                        var symbol = declaration.symbol;\n                        if (symbol) {\n                            var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration);\n                            if (type) {\n                                var callSignatures = type.getCallSignatures();\n                                if (callSignatures && callSignatures.length) {\n                                    return createSignatureHelpItems(callSignatures, callSignatures[0], argumentInfo, typeChecker);\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        /**\n         * Returns relevant information for the argument list and the current argument if we are\n         * in the argument of an invocation; returns undefined otherwise.\n         */\n        function getImmediatelyContainingArgumentInfo(node, position, sourceFile) {\n            if (node.parent.kind === 179 /* CallExpression */ || node.parent.kind === 180 /* NewExpression */) {\n                var callExpression = node.parent;\n                // There are 3 cases to handle:\n                //   1. The token introduces a list, and should begin a sig help session\n                //   2. The token is either not associated with a list, or ends a list, so the session should end\n                //   3. The token is buried inside a list, and should give sig help\n                //\n                // The following are examples of each:\n                //\n                //    Case 1:\n                //          foo<#T, U>(#a, b)    -> The token introduces a list, and should begin a sig help session\n                //    Case 2:\n                //          fo#o<T, U>#(a, b)#   -> The token is either not associated with a list, or ends a list, so the session should end\n                //    Case 3:\n                //          foo<T#, U#>(a#, #b#) -> The token is buried inside a list, and should give sig help\n                // Find out if 'node' is an argument, a type argument, or neither\n                if (node.kind === 26 /* LessThanToken */ ||\n                    node.kind === 18 /* OpenParenToken */) {\n                    // Find the list that starts right *after* the < or ( token.\n                    // If the user has just opened a list, consider this item 0.\n                    var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile);\n                    var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos;\n                    ts.Debug.assert(list !== undefined);\n                    return {\n                        kind: isTypeArgList ? 0 /* TypeArguments */ : 1 /* CallArguments */,\n                        invocation: callExpression,\n                        argumentsSpan: getApplicableSpanForArguments(list, sourceFile),\n                        argumentIndex: 0,\n                        argumentCount: getArgumentCount(list)\n                    };\n                }\n                // findListItemInfo can return undefined if we are not in parent's argument list\n                // or type argument list. This includes cases where the cursor is:\n                //   - To the right of the closing paren, non-substitution template, or template tail.\n                //   - Between the type arguments and the arguments (greater than token)\n                //   - On the target of the call (parent.func)\n                //   - On the 'new' keyword in a 'new' expression\n                var listItemInfo = ts.findListItemInfo(node);\n                if (listItemInfo) {\n                    var list = listItemInfo.list;\n                    var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos;\n                    var argumentIndex = getArgumentIndex(list, node);\n                    var argumentCount = getArgumentCount(list);\n                    ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, \"argumentCount < argumentIndex, \" + argumentCount + \" < \" + argumentIndex);\n                    return {\n                        kind: isTypeArgList ? 0 /* TypeArguments */ : 1 /* CallArguments */,\n                        invocation: callExpression,\n                        argumentsSpan: getApplicableSpanForArguments(list, sourceFile),\n                        argumentIndex: argumentIndex,\n                        argumentCount: argumentCount\n                    };\n                }\n                return undefined;\n            }\n            else if (node.kind === 12 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 181 /* TaggedTemplateExpression */) {\n                // Check if we're actually inside the template;\n                // otherwise we'll fall out and return undefined.\n                if (ts.isInsideTemplateLiteral(node, position)) {\n                    return getArgumentListInfoForTemplate(node.parent, /*argumentIndex*/ 0, sourceFile);\n                }\n            }\n            else if (node.kind === 13 /* TemplateHead */ && node.parent.parent.kind === 181 /* TaggedTemplateExpression */) {\n                var templateExpression = node.parent;\n                var tagExpression = templateExpression.parent;\n                ts.Debug.assert(templateExpression.kind === 194 /* TemplateExpression */);\n                var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1;\n                return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile);\n            }\n            else if (node.parent.kind === 202 /* TemplateSpan */ && node.parent.parent.parent.kind === 181 /* TaggedTemplateExpression */) {\n                var templateSpan = node.parent;\n                var templateExpression = templateSpan.parent;\n                var tagExpression = templateExpression.parent;\n                ts.Debug.assert(templateExpression.kind === 194 /* TemplateExpression */);\n                // If we're just after a template tail, don't show signature help.\n                if (node.kind === 15 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) {\n                    return undefined;\n                }\n                var spanIndex = templateExpression.templateSpans.indexOf(templateSpan);\n                var argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node, position);\n                return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile);\n            }\n            return undefined;\n        }\n        function getArgumentIndex(argumentsList, node) {\n            // The list we got back can include commas.  In the presence of errors it may\n            // also just have nodes without commas.  For example \"Foo(a b c)\" will have 3\n            // args without commas.   We want to find what index we're at.  So we count\n            // forward until we hit ourselves, only incrementing the index if it isn't a\n            // comma.\n            //\n            // Note: the subtlety around trailing commas (in getArgumentCount) does not apply\n            // here.  That's because we're only walking forward until we hit the node we're\n            // on.  In that case, even if we're after the trailing comma, we'll still see\n            // that trailing comma in the list, and we'll have generated the appropriate\n            // arg index.\n            var argumentIndex = 0;\n            var listChildren = argumentsList.getChildren();\n            for (var _i = 0, listChildren_1 = listChildren; _i < listChildren_1.length; _i++) {\n                var child = listChildren_1[_i];\n                if (child === node) {\n                    break;\n                }\n                if (child.kind !== 25 /* CommaToken */) {\n                    argumentIndex++;\n                }\n            }\n            return argumentIndex;\n        }\n        function getArgumentCount(argumentsList) {\n            // The argument count for a list is normally the number of non-comma children it has.\n            // For example, if you have \"Foo(a,b)\" then there will be three children of the arg\n            // list 'a' '<comma>' 'b'.  So, in this case the arg count will be 2.  However, there\n            // is a small subtlety.  If you have  \"Foo(a,)\", then the child list will just have\n            // 'a' '<comma>'.  So, in the case where the last child is a comma, we increase the\n            // arg count by one to compensate.\n            //\n            // Note: this subtlety only applies to the last comma.  If you had \"Foo(a,,\"  then\n            // we'll have:  'a' '<comma>' '<missing>'\n            // That will give us 2 non-commas.  We then add one for the last comma, givin us an\n            // arg count of 3.\n            var listChildren = argumentsList.getChildren();\n            var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 25 /* CommaToken */; });\n            if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 25 /* CommaToken */) {\n                argumentCount++;\n            }\n            return argumentCount;\n        }\n        // spanIndex is either the index for a given template span.\n        // This does not give appropriate results for a NoSubstitutionTemplateLiteral\n        function getArgumentIndexForTemplatePiece(spanIndex, node, position) {\n            // Because the TemplateStringsArray is the first argument, we have to offset each substitution expression by 1.\n            // There are three cases we can encounter:\n            //      1. We are precisely in the template literal (argIndex = 0).\n            //      2. We are in or to the right of the substitution expression (argIndex = spanIndex + 1).\n            //      3. We are directly to the right of the template literal, but because we look for the token on the left,\n            //          not enough to put us in the substitution expression; we should consider ourselves part of\n            //          the *next* span's expression by offsetting the index (argIndex = (spanIndex + 1) + 1).\n            //\n            // Example: f  `# abcd $#{#  1 + 1#  }# efghi ${ #\"#hello\"#  }  #  `\n            //              ^       ^ ^       ^   ^          ^ ^      ^     ^\n            // Case:        1       1 3       2   1          3 2      2     1\n            ts.Debug.assert(position >= node.getStart(), \"Assumed 'position' could not occur before node.\");\n            if (ts.isTemplateLiteralKind(node.kind)) {\n                if (ts.isInsideTemplateLiteral(node, position)) {\n                    return 0;\n                }\n                return spanIndex + 2;\n            }\n            return spanIndex + 1;\n        }\n        function getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile) {\n            // argumentCount is either 1 or (numSpans + 1) to account for the template strings array argument.\n            var argumentCount = tagExpression.template.kind === 12 /* NoSubstitutionTemplateLiteral */\n                ? 1\n                : tagExpression.template.templateSpans.length + 1;\n            ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, \"argumentCount < argumentIndex, \" + argumentCount + \" < \" + argumentIndex);\n            return {\n                kind: 2 /* TaggedTemplateArguments */,\n                invocation: tagExpression,\n                argumentsSpan: getApplicableSpanForTaggedTemplate(tagExpression, sourceFile),\n                argumentIndex: argumentIndex,\n                argumentCount: argumentCount\n            };\n        }\n        function getApplicableSpanForArguments(argumentsList, sourceFile) {\n            // We use full start and skip trivia on the end because we want to include trivia on\n            // both sides. For example,\n            //\n            //    foo(   /*comment */     a, b, c      /*comment*/     )\n            //        |                                               |\n            //\n            // The applicable span is from the first bar to the second bar (inclusive,\n            // but not including parentheses)\n            var applicableSpanStart = argumentsList.getFullStart();\n            var applicableSpanEnd = ts.skipTrivia(sourceFile.text, argumentsList.getEnd(), /*stopAfterLineBreak*/ false);\n            return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);\n        }\n        function getApplicableSpanForTaggedTemplate(taggedTemplate, sourceFile) {\n            var template = taggedTemplate.template;\n            var applicableSpanStart = template.getStart();\n            var applicableSpanEnd = template.getEnd();\n            // We need to adjust the end position for the case where the template does not have a tail.\n            // Otherwise, we will not show signature help past the expression.\n            // For example,\n            //\n            //      `  ${ 1 + 1        foo(10)\n            //       |        |\n            //\n            // This is because a Missing node has no width. However, what we actually want is to include trivia\n            // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail.\n            if (template.kind === 194 /* TemplateExpression */) {\n                var lastSpan = ts.lastOrUndefined(template.templateSpans);\n                if (lastSpan.literal.getFullWidth() === 0) {\n                    applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false);\n                }\n            }\n            return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);\n        }\n        function getContainingArgumentInfo(node, position, sourceFile) {\n            for (var n = node; n.kind !== 261 /* SourceFile */; n = n.parent) {\n                if (ts.isFunctionBlock(n)) {\n                    return undefined;\n                }\n                // If the node is not a subspan of its parent, this is a big problem.\n                // There have been crashes that might be caused by this violation.\n                if (n.pos < n.parent.pos || n.end > n.parent.end) {\n                    ts.Debug.fail(\"Node of kind \" + n.kind + \" is not a subspan of its parent of kind \" + n.parent.kind);\n                }\n                var argumentInfo = getImmediatelyContainingArgumentInfo(n, position, sourceFile);\n                if (argumentInfo) {\n                    return argumentInfo;\n                }\n            }\n            return undefined;\n        }\n        SignatureHelp.getContainingArgumentInfo = getContainingArgumentInfo;\n        function getChildListThatStartsWithOpenerToken(parent, openerToken, sourceFile) {\n            var children = parent.getChildren(sourceFile);\n            var indexOfOpenerToken = children.indexOf(openerToken);\n            ts.Debug.assert(indexOfOpenerToken >= 0 && children.length > indexOfOpenerToken + 1);\n            return children[indexOfOpenerToken + 1];\n        }\n        /**\n         * The selectedItemIndex could be negative for several reasons.\n         *     1. There are too many arguments for all of the overloads\n         *     2. None of the overloads were type compatible\n         * The solution here is to try to pick the best overload by picking\n         * either the first one that has an appropriate number of parameters,\n         * or the one with the most parameters.\n         */\n        function selectBestInvalidOverloadIndex(candidates, argumentCount) {\n            var maxParamsSignatureIndex = -1;\n            var maxParams = -1;\n            for (var i = 0; i < candidates.length; i++) {\n                var candidate = candidates[i];\n                if (candidate.hasRestParameter || candidate.parameters.length >= argumentCount) {\n                    return i;\n                }\n                if (candidate.parameters.length > maxParams) {\n                    maxParams = candidate.parameters.length;\n                    maxParamsSignatureIndex = i;\n                }\n            }\n            return maxParamsSignatureIndex;\n        }\n        function createSignatureHelpItems(candidates, bestSignature, argumentListInfo, typeChecker) {\n            var applicableSpan = argumentListInfo.argumentsSpan;\n            var isTypeParameterList = argumentListInfo.kind === 0 /* TypeArguments */;\n            var invocation = argumentListInfo.invocation;\n            var callTarget = ts.getInvokedExpression(invocation);\n            var callTargetSymbol = typeChecker.getSymbolAtLocation(callTarget);\n            var callTargetDisplayParts = callTargetSymbol && ts.symbolToDisplayParts(typeChecker, callTargetSymbol, /*enclosingDeclaration*/ undefined, /*meaning*/ undefined);\n            var items = ts.map(candidates, function (candidateSignature) {\n                var signatureHelpParameters;\n                var prefixDisplayParts = [];\n                var suffixDisplayParts = [];\n                if (callTargetDisplayParts) {\n                    ts.addRange(prefixDisplayParts, callTargetDisplayParts);\n                }\n                var isVariadic;\n                if (isTypeParameterList) {\n                    isVariadic = false; // type parameter lists are not variadic\n                    prefixDisplayParts.push(ts.punctuationPart(26 /* LessThanToken */));\n                    var typeParameters = candidateSignature.typeParameters;\n                    signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray;\n                    suffixDisplayParts.push(ts.punctuationPart(28 /* GreaterThanToken */));\n                    var parameterParts = ts.mapToDisplayParts(function (writer) {\n                        return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.thisParameter, candidateSignature.parameters, writer, invocation);\n                    });\n                    ts.addRange(suffixDisplayParts, parameterParts);\n                }\n                else {\n                    isVariadic = candidateSignature.hasRestParameter;\n                    var typeParameterParts = ts.mapToDisplayParts(function (writer) {\n                        return typeChecker.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation);\n                    });\n                    ts.addRange(prefixDisplayParts, typeParameterParts);\n                    prefixDisplayParts.push(ts.punctuationPart(18 /* OpenParenToken */));\n                    var parameters = candidateSignature.parameters;\n                    signatureHelpParameters = parameters.length > 0 ? ts.map(parameters, createSignatureHelpParameterForParameter) : emptyArray;\n                    suffixDisplayParts.push(ts.punctuationPart(19 /* CloseParenToken */));\n                }\n                var returnTypeParts = ts.mapToDisplayParts(function (writer) {\n                    return typeChecker.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation);\n                });\n                ts.addRange(suffixDisplayParts, returnTypeParts);\n                return {\n                    isVariadic: isVariadic,\n                    prefixDisplayParts: prefixDisplayParts,\n                    suffixDisplayParts: suffixDisplayParts,\n                    separatorDisplayParts: [ts.punctuationPart(25 /* CommaToken */), ts.spacePart()],\n                    parameters: signatureHelpParameters,\n                    documentation: candidateSignature.getDocumentationComment()\n                };\n            });\n            var argumentIndex = argumentListInfo.argumentIndex;\n            // argumentCount is the *apparent* number of arguments.\n            var argumentCount = argumentListInfo.argumentCount;\n            var selectedItemIndex = candidates.indexOf(bestSignature);\n            if (selectedItemIndex < 0) {\n                selectedItemIndex = selectBestInvalidOverloadIndex(candidates, argumentCount);\n            }\n            ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, \"argumentCount < argumentIndex, \" + argumentCount + \" < \" + argumentIndex);\n            return {\n                items: items,\n                applicableSpan: applicableSpan,\n                selectedItemIndex: selectedItemIndex,\n                argumentIndex: argumentIndex,\n                argumentCount: argumentCount\n            };\n            function createSignatureHelpParameterForParameter(parameter) {\n                var displayParts = ts.mapToDisplayParts(function (writer) {\n                    return typeChecker.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation);\n                });\n                return {\n                    name: parameter.name,\n                    documentation: parameter.getDocumentationComment(),\n                    displayParts: displayParts,\n                    isOptional: typeChecker.isOptionalParameter(parameter.valueDeclaration)\n                };\n            }\n            function createSignatureHelpParameterForTypeParameter(typeParameter) {\n                var displayParts = ts.mapToDisplayParts(function (writer) {\n                    return typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, invocation);\n                });\n                return {\n                    name: typeParameter.symbol.name,\n                    documentation: emptyArray,\n                    displayParts: displayParts,\n                    isOptional: false\n                };\n            }\n        }\n    })(SignatureHelp = ts.SignatureHelp || (ts.SignatureHelp = {}));\n})(ts || (ts = {}));\n/* @internal */\nvar ts;\n(function (ts) {\n    var SymbolDisplay;\n    (function (SymbolDisplay) {\n        // TODO(drosen): use contextual SemanticMeaning.\n        function getSymbolKind(typeChecker, symbol, location) {\n            var flags = symbol.getFlags();\n            if (flags & 32 /* Class */)\n                return ts.getDeclarationOfKind(symbol, 197 /* ClassExpression */) ?\n                    ts.ScriptElementKind.localClassElement : ts.ScriptElementKind.classElement;\n            if (flags & 384 /* Enum */)\n                return ts.ScriptElementKind.enumElement;\n            if (flags & 524288 /* TypeAlias */)\n                return ts.ScriptElementKind.typeElement;\n            if (flags & 64 /* Interface */)\n                return ts.ScriptElementKind.interfaceElement;\n            if (flags & 262144 /* TypeParameter */)\n                return ts.ScriptElementKind.typeParameterElement;\n            var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location);\n            if (result === ts.ScriptElementKind.unknown) {\n                if (flags & 262144 /* TypeParameter */)\n                    return ts.ScriptElementKind.typeParameterElement;\n                if (flags & 8 /* EnumMember */)\n                    return ts.ScriptElementKind.variableElement;\n                if (flags & 8388608 /* Alias */)\n                    return ts.ScriptElementKind.alias;\n                if (flags & 1536 /* Module */)\n                    return ts.ScriptElementKind.moduleElement;\n            }\n            return result;\n        }\n        SymbolDisplay.getSymbolKind = getSymbolKind;\n        function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location) {\n            if (typeChecker.isUndefinedSymbol(symbol)) {\n                return ts.ScriptElementKind.variableElement;\n            }\n            if (typeChecker.isArgumentsSymbol(symbol)) {\n                return ts.ScriptElementKind.localVariableElement;\n            }\n            if (location.kind === 98 /* ThisKeyword */ && ts.isExpression(location)) {\n                return ts.ScriptElementKind.parameterElement;\n            }\n            if (flags & 3 /* Variable */) {\n                if (ts.isFirstDeclarationOfSymbolParameter(symbol)) {\n                    return ts.ScriptElementKind.parameterElement;\n                }\n                else if (symbol.valueDeclaration && ts.isConst(symbol.valueDeclaration)) {\n                    return ts.ScriptElementKind.constElement;\n                }\n                else if (ts.forEach(symbol.declarations, ts.isLet)) {\n                    return ts.ScriptElementKind.letElement;\n                }\n                return isLocalVariableOrFunction(symbol) ? ts.ScriptElementKind.localVariableElement : ts.ScriptElementKind.variableElement;\n            }\n            if (flags & 16 /* Function */)\n                return isLocalVariableOrFunction(symbol) ? ts.ScriptElementKind.localFunctionElement : ts.ScriptElementKind.functionElement;\n            if (flags & 32768 /* GetAccessor */)\n                return ts.ScriptElementKind.memberGetAccessorElement;\n            if (flags & 65536 /* SetAccessor */)\n                return ts.ScriptElementKind.memberSetAccessorElement;\n            if (flags & 8192 /* Method */)\n                return ts.ScriptElementKind.memberFunctionElement;\n            if (flags & 16384 /* Constructor */)\n                return ts.ScriptElementKind.constructorImplementationElement;\n            if (flags & 4 /* Property */) {\n                if (flags & 268435456 /* SyntheticProperty */) {\n                    // If union property is result of union of non method (property/accessors/variables), it is labeled as property\n                    var unionPropertyKind = ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) {\n                        var rootSymbolFlags = rootSymbol.getFlags();\n                        if (rootSymbolFlags & (98308 /* PropertyOrAccessor */ | 3 /* Variable */)) {\n                            return ts.ScriptElementKind.memberVariableElement;\n                        }\n                        ts.Debug.assert(!!(rootSymbolFlags & 8192 /* Method */));\n                    });\n                    if (!unionPropertyKind) {\n                        // If this was union of all methods,\n                        // make sure it has call signatures before we can label it as method\n                        var typeOfUnionProperty = typeChecker.getTypeOfSymbolAtLocation(symbol, location);\n                        if (typeOfUnionProperty.getCallSignatures().length) {\n                            return ts.ScriptElementKind.memberFunctionElement;\n                        }\n                        return ts.ScriptElementKind.memberVariableElement;\n                    }\n                    return unionPropertyKind;\n                }\n                return ts.ScriptElementKind.memberVariableElement;\n            }\n            return ts.ScriptElementKind.unknown;\n        }\n        function getSymbolModifiers(symbol) {\n            return symbol && symbol.declarations && symbol.declarations.length > 0\n                ? ts.getNodeModifiers(symbol.declarations[0])\n                : ts.ScriptElementKindModifier.none;\n        }\n        SymbolDisplay.getSymbolModifiers = getSymbolModifiers;\n        // TODO(drosen): Currently completion entry details passes the SemanticMeaning.All instead of using semanticMeaning of location\n        function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning) {\n            if (semanticMeaning === void 0) { semanticMeaning = ts.getMeaningFromLocation(location); }\n            var displayParts = [];\n            var documentation;\n            var symbolFlags = symbol.flags;\n            var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, symbolFlags, location);\n            var hasAddedSymbolInfo;\n            var isThisExpression = location.kind === 98 /* ThisKeyword */ && ts.isExpression(location);\n            var type;\n            // Class at constructor site need to be shown as constructor apart from property,method, vars\n            if (symbolKind !== ts.ScriptElementKind.unknown || symbolFlags & 32 /* Class */ || symbolFlags & 8388608 /* Alias */) {\n                // If it is accessor they are allowed only if location is at name of the accessor\n                if (symbolKind === ts.ScriptElementKind.memberGetAccessorElement || symbolKind === ts.ScriptElementKind.memberSetAccessorElement) {\n                    symbolKind = ts.ScriptElementKind.memberVariableElement;\n                }\n                var signature = void 0;\n                type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);\n                if (type) {\n                    if (location.parent && location.parent.kind === 177 /* PropertyAccessExpression */) {\n                        var right = location.parent.name;\n                        // Either the location is on the right of a property access, or on the left and the right is missing\n                        if (right === location || (right && right.getFullWidth() === 0)) {\n                            location = location.parent;\n                        }\n                    }\n                    // try get the call/construct signature from the type if it matches\n                    var callExpression = void 0;\n                    if (location.kind === 179 /* CallExpression */ || location.kind === 180 /* NewExpression */) {\n                        callExpression = location;\n                    }\n                    else if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location)) {\n                        callExpression = location.parent;\n                    }\n                    if (callExpression) {\n                        var candidateSignatures = [];\n                        signature = typeChecker.getResolvedSignature(callExpression, candidateSignatures);\n                        if (!signature && candidateSignatures.length) {\n                            // Use the first candidate:\n                            signature = candidateSignatures[0];\n                        }\n                        var useConstructSignatures = callExpression.kind === 180 /* NewExpression */ || callExpression.expression.kind === 96 /* SuperKeyword */;\n                        var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures();\n                        if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) {\n                            // Get the first signature if there is one -- allSignatures may contain\n                            // either the original signature or its target, so check for either\n                            signature = allSignatures.length ? allSignatures[0] : undefined;\n                        }\n                        if (signature) {\n                            if (useConstructSignatures && (symbolFlags & 32 /* Class */)) {\n                                // Constructor\n                                symbolKind = ts.ScriptElementKind.constructorImplementationElement;\n                                addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);\n                            }\n                            else if (symbolFlags & 8388608 /* Alias */) {\n                                symbolKind = ts.ScriptElementKind.alias;\n                                pushTypePart(symbolKind);\n                                displayParts.push(ts.spacePart());\n                                if (useConstructSignatures) {\n                                    displayParts.push(ts.keywordPart(93 /* NewKeyword */));\n                                    displayParts.push(ts.spacePart());\n                                }\n                                addFullSymbolName(symbol);\n                            }\n                            else {\n                                addPrefixForAnyFunctionOrVar(symbol, symbolKind);\n                            }\n                            switch (symbolKind) {\n                                case ts.ScriptElementKind.memberVariableElement:\n                                case ts.ScriptElementKind.variableElement:\n                                case ts.ScriptElementKind.constElement:\n                                case ts.ScriptElementKind.letElement:\n                                case ts.ScriptElementKind.parameterElement:\n                                case ts.ScriptElementKind.localVariableElement:\n                                    // If it is call or construct signature of lambda's write type name\n                                    displayParts.push(ts.punctuationPart(55 /* ColonToken */));\n                                    displayParts.push(ts.spacePart());\n                                    if (useConstructSignatures) {\n                                        displayParts.push(ts.keywordPart(93 /* NewKeyword */));\n                                        displayParts.push(ts.spacePart());\n                                    }\n                                    if (!(type.flags & 32768 /* Object */ && type.objectFlags & 16 /* Anonymous */) && type.symbol) {\n                                        ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, 1 /* WriteTypeParametersOrArguments */));\n                                    }\n                                    addSignatureDisplayParts(signature, allSignatures, 8 /* WriteArrowStyleSignature */);\n                                    break;\n                                default:\n                                    // Just signature\n                                    addSignatureDisplayParts(signature, allSignatures);\n                            }\n                            hasAddedSymbolInfo = true;\n                        }\n                    }\n                    else if ((ts.isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) ||\n                        (location.kind === 122 /* ConstructorKeyword */ && location.parent.kind === 150 /* Constructor */)) {\n                        // get the signature from the declaration and write it\n                        var functionDeclaration = location.parent;\n                        var allSignatures = functionDeclaration.kind === 150 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();\n                        if (!typeChecker.isImplementationOfOverload(functionDeclaration)) {\n                            signature = typeChecker.getSignatureFromDeclaration(functionDeclaration);\n                        }\n                        else {\n                            signature = allSignatures[0];\n                        }\n                        if (functionDeclaration.kind === 150 /* Constructor */) {\n                            // show (constructor) Type(...) signature\n                            symbolKind = ts.ScriptElementKind.constructorImplementationElement;\n                            addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);\n                        }\n                        else {\n                            // (function/method) symbol(..signature)\n                            addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 153 /* CallSignature */ &&\n                                !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind);\n                        }\n                        addSignatureDisplayParts(signature, allSignatures);\n                        hasAddedSymbolInfo = true;\n                    }\n                }\n            }\n            if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) {\n                if (ts.getDeclarationOfKind(symbol, 197 /* ClassExpression */)) {\n                    // Special case for class expressions because we would like to indicate that\n                    // the class name is local to the class body (similar to function expression)\n                    //      (local class) class <className>\n                    pushTypePart(ts.ScriptElementKind.localClassElement);\n                }\n                else {\n                    // Class declaration has name which is not local.\n                    displayParts.push(ts.keywordPart(74 /* ClassKeyword */));\n                }\n                displayParts.push(ts.spacePart());\n                addFullSymbolName(symbol);\n                writeTypeParametersOfSymbol(symbol, sourceFile);\n            }\n            if ((symbolFlags & 64 /* Interface */) && (semanticMeaning & 2 /* Type */)) {\n                addNewLineIfDisplayPartsExist();\n                displayParts.push(ts.keywordPart(108 /* InterfaceKeyword */));\n                displayParts.push(ts.spacePart());\n                addFullSymbolName(symbol);\n                writeTypeParametersOfSymbol(symbol, sourceFile);\n            }\n            if (symbolFlags & 524288 /* TypeAlias */) {\n                addNewLineIfDisplayPartsExist();\n                displayParts.push(ts.keywordPart(136 /* TypeKeyword */));\n                displayParts.push(ts.spacePart());\n                addFullSymbolName(symbol);\n                writeTypeParametersOfSymbol(symbol, sourceFile);\n                displayParts.push(ts.spacePart());\n                displayParts.push(ts.operatorPart(57 /* EqualsToken */));\n                displayParts.push(ts.spacePart());\n                ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 512 /* InTypeAlias */));\n            }\n            if (symbolFlags & 384 /* Enum */) {\n                addNewLineIfDisplayPartsExist();\n                if (ts.forEach(symbol.declarations, ts.isConstEnumDeclaration)) {\n                    displayParts.push(ts.keywordPart(75 /* ConstKeyword */));\n                    displayParts.push(ts.spacePart());\n                }\n                displayParts.push(ts.keywordPart(82 /* EnumKeyword */));\n                displayParts.push(ts.spacePart());\n                addFullSymbolName(symbol);\n            }\n            if (symbolFlags & 1536 /* Module */) {\n                addNewLineIfDisplayPartsExist();\n                var declaration = ts.getDeclarationOfKind(symbol, 230 /* ModuleDeclaration */);\n                var isNamespace = declaration && declaration.name && declaration.name.kind === 70 /* Identifier */;\n                displayParts.push(ts.keywordPart(isNamespace ? 128 /* NamespaceKeyword */ : 127 /* ModuleKeyword */));\n                displayParts.push(ts.spacePart());\n                addFullSymbolName(symbol);\n            }\n            if ((symbolFlags & 262144 /* TypeParameter */) && (semanticMeaning & 2 /* Type */)) {\n                addNewLineIfDisplayPartsExist();\n                displayParts.push(ts.punctuationPart(18 /* OpenParenToken */));\n                displayParts.push(ts.textPart(\"type parameter\"));\n                displayParts.push(ts.punctuationPart(19 /* CloseParenToken */));\n                displayParts.push(ts.spacePart());\n                addFullSymbolName(symbol);\n                if (symbol.parent) {\n                    // Class/Interface type parameter\n                    addInPrefix();\n                    addFullSymbolName(symbol.parent, enclosingDeclaration);\n                    writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration);\n                }\n                else {\n                    // Method/function type parameter\n                    var declaration = ts.getDeclarationOfKind(symbol, 143 /* TypeParameter */);\n                    ts.Debug.assert(declaration !== undefined);\n                    declaration = declaration.parent;\n                    if (declaration) {\n                        if (ts.isFunctionLikeKind(declaration.kind)) {\n                            addInPrefix();\n                            var signature = typeChecker.getSignatureFromDeclaration(declaration);\n                            if (declaration.kind === 154 /* ConstructSignature */) {\n                                displayParts.push(ts.keywordPart(93 /* NewKeyword */));\n                                displayParts.push(ts.spacePart());\n                            }\n                            else if (declaration.kind !== 153 /* CallSignature */ && declaration.name) {\n                                addFullSymbolName(declaration.symbol);\n                            }\n                            ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */));\n                        }\n                        else if (declaration.kind === 228 /* TypeAliasDeclaration */) {\n                            // Type alias type parameter\n                            // For example\n                            //      type list<T> = T[];  // Both T will go through same code path\n                            addInPrefix();\n                            displayParts.push(ts.keywordPart(136 /* TypeKeyword */));\n                            displayParts.push(ts.spacePart());\n                            addFullSymbolName(declaration.symbol);\n                            writeTypeParametersOfSymbol(declaration.symbol, sourceFile);\n                        }\n                    }\n                }\n            }\n            if (symbolFlags & 8 /* EnumMember */) {\n                addPrefixForAnyFunctionOrVar(symbol, \"enum member\");\n                var declaration = symbol.declarations[0];\n                if (declaration.kind === 260 /* EnumMember */) {\n                    var constantValue = typeChecker.getConstantValue(declaration);\n                    if (constantValue !== undefined) {\n                        displayParts.push(ts.spacePart());\n                        displayParts.push(ts.operatorPart(57 /* EqualsToken */));\n                        displayParts.push(ts.spacePart());\n                        displayParts.push(ts.displayPart(constantValue.toString(), ts.SymbolDisplayPartKind.numericLiteral));\n                    }\n                }\n            }\n            if (symbolFlags & 8388608 /* Alias */) {\n                addNewLineIfDisplayPartsExist();\n                if (symbol.declarations[0].kind === 233 /* NamespaceExportDeclaration */) {\n                    displayParts.push(ts.keywordPart(83 /* ExportKeyword */));\n                    displayParts.push(ts.spacePart());\n                    displayParts.push(ts.keywordPart(128 /* NamespaceKeyword */));\n                }\n                else {\n                    displayParts.push(ts.keywordPart(90 /* ImportKeyword */));\n                }\n                displayParts.push(ts.spacePart());\n                addFullSymbolName(symbol);\n                ts.forEach(symbol.declarations, function (declaration) {\n                    if (declaration.kind === 234 /* ImportEqualsDeclaration */) {\n                        var importEqualsDeclaration = declaration;\n                        if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) {\n                            displayParts.push(ts.spacePart());\n                            displayParts.push(ts.operatorPart(57 /* EqualsToken */));\n                            displayParts.push(ts.spacePart());\n                            displayParts.push(ts.keywordPart(131 /* RequireKeyword */));\n                            displayParts.push(ts.punctuationPart(18 /* OpenParenToken */));\n                            displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral));\n                            displayParts.push(ts.punctuationPart(19 /* CloseParenToken */));\n                        }\n                        else {\n                            var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference);\n                            if (internalAliasSymbol) {\n                                displayParts.push(ts.spacePart());\n                                displayParts.push(ts.operatorPart(57 /* EqualsToken */));\n                                displayParts.push(ts.spacePart());\n                                addFullSymbolName(internalAliasSymbol, enclosingDeclaration);\n                            }\n                        }\n                        return true;\n                    }\n                });\n            }\n            if (!hasAddedSymbolInfo) {\n                if (symbolKind !== ts.ScriptElementKind.unknown) {\n                    if (type) {\n                        if (isThisExpression) {\n                            addNewLineIfDisplayPartsExist();\n                            displayParts.push(ts.keywordPart(98 /* ThisKeyword */));\n                        }\n                        else {\n                            addPrefixForAnyFunctionOrVar(symbol, symbolKind);\n                        }\n                        // For properties, variables and local vars: show the type\n                        if (symbolKind === ts.ScriptElementKind.memberVariableElement ||\n                            symbolFlags & 3 /* Variable */ ||\n                            symbolKind === ts.ScriptElementKind.localVariableElement ||\n                            isThisExpression) {\n                            displayParts.push(ts.punctuationPart(55 /* ColonToken */));\n                            displayParts.push(ts.spacePart());\n                            // If the type is type parameter, format it specially\n                            if (type.symbol && type.symbol.flags & 262144 /* TypeParameter */) {\n                                var typeParameterParts = ts.mapToDisplayParts(function (writer) {\n                                    typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplay(type, writer, enclosingDeclaration);\n                                });\n                                ts.addRange(displayParts, typeParameterParts);\n                            }\n                            else {\n                                ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, type, enclosingDeclaration));\n                            }\n                        }\n                        else if (symbolFlags & 16 /* Function */ ||\n                            symbolFlags & 8192 /* Method */ ||\n                            symbolFlags & 16384 /* Constructor */ ||\n                            symbolFlags & 131072 /* Signature */ ||\n                            symbolFlags & 98304 /* Accessor */ ||\n                            symbolKind === ts.ScriptElementKind.memberFunctionElement) {\n                            var allSignatures = type.getNonNullableType().getCallSignatures();\n                            addSignatureDisplayParts(allSignatures[0], allSignatures);\n                        }\n                    }\n                }\n                else {\n                    symbolKind = getSymbolKind(typeChecker, symbol, location);\n                }\n            }\n            if (!documentation) {\n                documentation = symbol.getDocumentationComment();\n                if (documentation.length === 0 && symbol.flags & 4 /* Property */) {\n                    // For some special property access expressions like `experts.foo = foo` or `module.exports.foo = foo`\n                    // there documentation comments might be attached to the right hand side symbol of their declarations.\n                    // The pattern of such special property access is that the parent symbol is the symbol of the file.\n                    if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 261 /* SourceFile */; })) {\n                        for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {\n                            var declaration = _a[_i];\n                            if (!declaration.parent || declaration.parent.kind !== 192 /* BinaryExpression */) {\n                                continue;\n                            }\n                            var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right);\n                            if (!rhsSymbol) {\n                                continue;\n                            }\n                            documentation = rhsSymbol.getDocumentationComment();\n                            if (documentation.length > 0) {\n                                break;\n                            }\n                        }\n                    }\n                }\n            }\n            return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind };\n            function addNewLineIfDisplayPartsExist() {\n                if (displayParts.length) {\n                    displayParts.push(ts.lineBreakPart());\n                }\n            }\n            function addInPrefix() {\n                displayParts.push(ts.spacePart());\n                displayParts.push(ts.keywordPart(91 /* InKeyword */));\n                displayParts.push(ts.spacePart());\n            }\n            function addFullSymbolName(symbol, enclosingDeclaration) {\n                var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* WriteTypeParametersOrArguments */ | 2 /* UseOnlyExternalAliasing */);\n                ts.addRange(displayParts, fullSymbolDisplayParts);\n            }\n            function addPrefixForAnyFunctionOrVar(symbol, symbolKind) {\n                addNewLineIfDisplayPartsExist();\n                if (symbolKind) {\n                    pushTypePart(symbolKind);\n                    displayParts.push(ts.spacePart());\n                    addFullSymbolName(symbol);\n                }\n            }\n            function pushTypePart(symbolKind) {\n                switch (symbolKind) {\n                    case ts.ScriptElementKind.variableElement:\n                    case ts.ScriptElementKind.functionElement:\n                    case ts.ScriptElementKind.letElement:\n                    case ts.ScriptElementKind.constElement:\n                    case ts.ScriptElementKind.constructorImplementationElement:\n                        displayParts.push(ts.textOrKeywordPart(symbolKind));\n                        return;\n                    default:\n                        displayParts.push(ts.punctuationPart(18 /* OpenParenToken */));\n                        displayParts.push(ts.textOrKeywordPart(symbolKind));\n                        displayParts.push(ts.punctuationPart(19 /* CloseParenToken */));\n                        return;\n                }\n            }\n            function addSignatureDisplayParts(signature, allSignatures, flags) {\n                ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | 32 /* WriteTypeArgumentsOfSignature */));\n                if (allSignatures.length > 1) {\n                    displayParts.push(ts.spacePart());\n                    displayParts.push(ts.punctuationPart(18 /* OpenParenToken */));\n                    displayParts.push(ts.operatorPart(36 /* PlusToken */));\n                    displayParts.push(ts.displayPart((allSignatures.length - 1).toString(), ts.SymbolDisplayPartKind.numericLiteral));\n                    displayParts.push(ts.spacePart());\n                    displayParts.push(ts.textPart(allSignatures.length === 2 ? \"overload\" : \"overloads\"));\n                    displayParts.push(ts.punctuationPart(19 /* CloseParenToken */));\n                }\n                documentation = signature.getDocumentationComment();\n            }\n            function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) {\n                var typeParameterParts = ts.mapToDisplayParts(function (writer) {\n                    typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration);\n                });\n                ts.addRange(displayParts, typeParameterParts);\n            }\n        }\n        SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind;\n        function isLocalVariableOrFunction(symbol) {\n            if (symbol.parent) {\n                return false; // This is exported symbol\n            }\n            return ts.forEach(symbol.declarations, function (declaration) {\n                // Function expressions are local\n                if (declaration.kind === 184 /* FunctionExpression */) {\n                    return true;\n                }\n                if (declaration.kind !== 223 /* VariableDeclaration */ && declaration.kind !== 225 /* FunctionDeclaration */) {\n                    return false;\n                }\n                // If the parent is not sourceFile or module block it is local variable\n                for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) {\n                    // Reached source file or module block\n                    if (parent_20.kind === 261 /* SourceFile */ || parent_20.kind === 231 /* ModuleBlock */) {\n                        return false;\n                    }\n                }\n                // parent is in function block\n                return true;\n            });\n        }\n    })(SymbolDisplay = ts.SymbolDisplay || (ts.SymbolDisplay = {}));\n})(ts || (ts = {}));\nvar ts;\n(function (ts) {\n    /*\n     * This function will compile source text from 'input' argument using specified compiler options.\n     * If not options are provided - it will use a set of default compiler options.\n     * Extra compiler options that will unconditionally be used by this function are:\n     * - isolatedModules = true\n     * - allowNonTsExtensions = true\n     * - noLib = true\n     * - noResolve = true\n     */\n    function transpileModule(input, transpileOptions) {\n        var diagnostics = [];\n        var options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : ts.getDefaultCompilerOptions();\n        options.isolatedModules = true;\n        // transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths.\n        options.suppressOutputPathCheck = true;\n        // Filename can be non-ts file.\n        options.allowNonTsExtensions = true;\n        // We are not returning a sourceFile for lib file when asked by the program,\n        // so pass --noLib to avoid reporting a file not found error.\n        options.noLib = true;\n        // Clear out other settings that would not be used in transpiling this module\n        options.lib = undefined;\n        options.types = undefined;\n        options.noEmit = undefined;\n        options.noEmitOnError = undefined;\n        options.paths = undefined;\n        options.rootDirs = undefined;\n        options.declaration = undefined;\n        options.declarationDir = undefined;\n        options.out = undefined;\n        options.outFile = undefined;\n        // We are not doing a full typecheck, we are not resolving the whole context,\n        // so pass --noResolve to avoid reporting missing file errors.\n        options.noResolve = true;\n        // if jsx is specified then treat file as .tsx\n        var inputFileName = transpileOptions.fileName || (options.jsx ? \"module.tsx\" : \"module.ts\");\n        var sourceFile = ts.createSourceFile(inputFileName, input, options.target);\n        if (transpileOptions.moduleName) {\n            sourceFile.moduleName = transpileOptions.moduleName;\n        }\n        if (transpileOptions.renamedDependencies) {\n            sourceFile.renamedDependencies = ts.createMap(transpileOptions.renamedDependencies);\n        }\n        var newLine = ts.getNewLineCharacter(options);\n        // Output\n        var outputText;\n        var sourceMapText;\n        // Create a compilerHost object to allow the compiler to read and write files\n        var compilerHost = {\n            getSourceFile: function (fileName) { return fileName === ts.normalizePath(inputFileName) ? sourceFile : undefined; },\n            writeFile: function (name, text) {\n                if (ts.fileExtensionIs(name, \".map\")) {\n                    ts.Debug.assert(sourceMapText === undefined, \"Unexpected multiple source map outputs for the file '\" + name + \"'\");\n                    sourceMapText = text;\n                }\n                else {\n                    ts.Debug.assert(outputText === undefined, \"Unexpected multiple outputs for the file: '\" + name + \"'\");\n                    outputText = text;\n                }\n            },\n            getDefaultLibFileName: function () { return \"lib.d.ts\"; },\n            useCaseSensitiveFileNames: function () { return false; },\n            getCanonicalFileName: function (fileName) { return fileName; },\n            getCurrentDirectory: function () { return \"\"; },\n            getNewLine: function () { return newLine; },\n            fileExists: function (fileName) { return fileName === inputFileName; },\n            readFile: function () { return \"\"; },\n            directoryExists: function () { return true; },\n            getDirectories: function () { return []; }\n        };\n        var program = ts.createProgram([inputFileName], options, compilerHost);\n        if (transpileOptions.reportDiagnostics) {\n            ts.addRange(/*to*/ diagnostics, /*from*/ program.getSyntacticDiagnostics(sourceFile));\n            ts.addRange(/*to*/ diagnostics, /*from*/ program.getOptionsDiagnostics());\n        }\n        // Emit\n        program.emit();\n        ts.Debug.assert(outputText !== undefined, \"Output generation failed\");\n        return { outputText: outputText, diagnostics: diagnostics, sourceMapText: sourceMapText };\n    }\n    ts.transpileModule = transpileModule;\n    /*\n     * This is a shortcut function for transpileModule - it accepts transpileOptions as parameters and returns only outputText part of the result.\n     */\n    function transpile(input, compilerOptions, fileName, diagnostics, moduleName) {\n        var output = transpileModule(input, { compilerOptions: compilerOptions, fileName: fileName, reportDiagnostics: !!diagnostics, moduleName: moduleName });\n        // addRange correctly handles cases when wither 'from' or 'to' argument is missing\n        ts.addRange(diagnostics, output.diagnostics);\n        return output.outputText;\n    }\n    ts.transpile = transpile;\n    var commandLineOptionsStringToEnum;\n    /** JS users may pass in string values for enum compiler options (such as ModuleKind), so convert. */\n    function fixupCompilerOptions(options, diagnostics) {\n        // Lazily create this value to fix module loading errors.\n        commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) {\n            return typeof o.type === \"object\" && !ts.forEachProperty(o.type, function (v) { return typeof v !== \"number\"; });\n        });\n        options = ts.clone(options);\n        var _loop_3 = function (opt) {\n            if (!ts.hasProperty(options, opt.name)) {\n                return \"continue\";\n            }\n            var value = options[opt.name];\n            // Value should be a key of opt.type\n            if (typeof value === \"string\") {\n                // If value is not a string, this will fail\n                options[opt.name] = ts.parseCustomTypeOption(opt, value, diagnostics);\n            }\n            else {\n                if (!ts.forEachProperty(opt.type, function (v) { return v === value; })) {\n                    // Supplied value isn't a valid enum value.\n                    diagnostics.push(ts.createCompilerDiagnosticForInvalidCustomType(opt));\n                }\n            }\n        };\n        for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) {\n            var opt = commandLineOptionsStringToEnum_1[_i];\n            _loop_3(opt);\n        }\n        return options;\n    }\n})(ts || (ts = {}));\n/// <reference path=\"formatting.ts\"/>\n/// <reference path=\"..\\..\\compiler\\scanner.ts\"/>\n/* @internal */\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var standardScanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);\n        var jsxScanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);\n        /**\n         * Scanner that is currently used for formatting\n         */\n        var scanner;\n        var ScanAction;\n        (function (ScanAction) {\n            ScanAction[ScanAction[\"Scan\"] = 0] = \"Scan\";\n            ScanAction[ScanAction[\"RescanGreaterThanToken\"] = 1] = \"RescanGreaterThanToken\";\n            ScanAction[ScanAction[\"RescanSlashToken\"] = 2] = \"RescanSlashToken\";\n            ScanAction[ScanAction[\"RescanTemplateToken\"] = 3] = \"RescanTemplateToken\";\n            ScanAction[ScanAction[\"RescanJsxIdentifier\"] = 4] = \"RescanJsxIdentifier\";\n            ScanAction[ScanAction[\"RescanJsxText\"] = 5] = \"RescanJsxText\";\n        })(ScanAction || (ScanAction = {}));\n        function getFormattingScanner(sourceFile, startPos, endPos) {\n            ts.Debug.assert(scanner === undefined, \"Scanner should be undefined\");\n            scanner = sourceFile.languageVariant === 1 /* JSX */ ? jsxScanner : standardScanner;\n            scanner.setText(sourceFile.text);\n            scanner.setTextPos(startPos);\n            var wasNewLine = true;\n            var leadingTrivia;\n            var trailingTrivia;\n            var savedPos;\n            var lastScanAction;\n            var lastTokenInfo;\n            return {\n                advance: advance,\n                readTokenInfo: readTokenInfo,\n                isOnToken: isOnToken,\n                getCurrentLeadingTrivia: function () { return leadingTrivia; },\n                lastTrailingTriviaWasNewLine: function () { return wasNewLine; },\n                skipToEndOf: skipToEndOf,\n                close: function () {\n                    ts.Debug.assert(scanner !== undefined);\n                    lastTokenInfo = undefined;\n                    scanner.setText(undefined);\n                    scanner = undefined;\n                }\n            };\n            function advance() {\n                ts.Debug.assert(scanner !== undefined, \"Scanner should be present\");\n                lastTokenInfo = undefined;\n                var isStarted = scanner.getStartPos() !== startPos;\n                if (isStarted) {\n                    if (trailingTrivia) {\n                        ts.Debug.assert(trailingTrivia.length !== 0);\n                        wasNewLine = ts.lastOrUndefined(trailingTrivia).kind === 4 /* NewLineTrivia */;\n                    }\n                    else {\n                        wasNewLine = false;\n                    }\n                }\n                leadingTrivia = undefined;\n                trailingTrivia = undefined;\n                if (!isStarted) {\n                    scanner.scan();\n                }\n                var pos = scanner.getStartPos();\n                // Read leading trivia and token\n                while (pos < endPos) {\n                    var t = scanner.getToken();\n                    if (!ts.isTrivia(t)) {\n                        break;\n                    }\n                    // consume leading trivia\n                    scanner.scan();\n                    var item = {\n                        pos: pos,\n                        end: scanner.getStartPos(),\n                        kind: t\n                    };\n                    pos = scanner.getStartPos();\n                    if (!leadingTrivia) {\n                        leadingTrivia = [];\n                    }\n                    leadingTrivia.push(item);\n                }\n                savedPos = scanner.getStartPos();\n            }\n            function shouldRescanGreaterThanToken(node) {\n                if (node) {\n                    switch (node.kind) {\n                        case 30 /* GreaterThanEqualsToken */:\n                        case 65 /* GreaterThanGreaterThanEqualsToken */:\n                        case 66 /* GreaterThanGreaterThanGreaterThanEqualsToken */:\n                        case 46 /* GreaterThanGreaterThanGreaterThanToken */:\n                        case 45 /* GreaterThanGreaterThanToken */:\n                            return true;\n                    }\n                }\n                return false;\n            }\n            function shouldRescanJsxIdentifier(node) {\n                if (node.parent) {\n                    switch (node.parent.kind) {\n                        case 250 /* JsxAttribute */:\n                        case 248 /* JsxOpeningElement */:\n                        case 249 /* JsxClosingElement */:\n                        case 247 /* JsxSelfClosingElement */:\n                            return node.kind === 70 /* Identifier */;\n                    }\n                }\n                return false;\n            }\n            function shouldRescanJsxText(node) {\n                return node && node.kind === 10 /* JsxText */;\n            }\n            function shouldRescanSlashToken(container) {\n                return container.kind === 11 /* RegularExpressionLiteral */;\n            }\n            function shouldRescanTemplateToken(container) {\n                return container.kind === 14 /* TemplateMiddle */ ||\n                    container.kind === 15 /* TemplateTail */;\n            }\n            function startsWithSlashToken(t) {\n                return t === 40 /* SlashToken */ || t === 62 /* SlashEqualsToken */;\n            }\n            function readTokenInfo(n) {\n                ts.Debug.assert(scanner !== undefined);\n                if (!isOnToken()) {\n                    // scanner is not on the token (either advance was not called yet or scanner is already past the end position)\n                    return {\n                        leadingTrivia: leadingTrivia,\n                        trailingTrivia: undefined,\n                        token: undefined\n                    };\n                }\n                // normally scanner returns the smallest available token\n                // check the kind of context node to determine if scanner should have more greedy behavior and consume more text.\n                var expectedScanAction = shouldRescanGreaterThanToken(n)\n                    ? 1 /* RescanGreaterThanToken */\n                    : shouldRescanSlashToken(n)\n                        ? 2 /* RescanSlashToken */\n                        : shouldRescanTemplateToken(n)\n                            ? 3 /* RescanTemplateToken */\n                            : shouldRescanJsxIdentifier(n)\n                                ? 4 /* RescanJsxIdentifier */\n                                : shouldRescanJsxText(n)\n                                    ? 5 /* RescanJsxText */\n                                    : 0 /* Scan */;\n                if (lastTokenInfo && expectedScanAction === lastScanAction) {\n                    // readTokenInfo was called before with the same expected scan action.\n                    // No need to re-scan text, return existing 'lastTokenInfo'\n                    // it is ok to call fixTokenKind here since it does not affect\n                    // what portion of text is consumed. In contrast rescanning can change it,\n                    // i.e. for '>=' when originally scanner eats just one character\n                    // and rescanning forces it to consume more.\n                    return fixTokenKind(lastTokenInfo, n);\n                }\n                if (scanner.getStartPos() !== savedPos) {\n                    ts.Debug.assert(lastTokenInfo !== undefined);\n                    // readTokenInfo was called before but scan action differs - rescan text\n                    scanner.setTextPos(savedPos);\n                    scanner.scan();\n                }\n                var currentToken = scanner.getToken();\n                if (expectedScanAction === 1 /* RescanGreaterThanToken */ && currentToken === 28 /* GreaterThanToken */) {\n                    currentToken = scanner.reScanGreaterToken();\n                    ts.Debug.assert(n.kind === currentToken);\n                    lastScanAction = 1 /* RescanGreaterThanToken */;\n                }\n                else if (expectedScanAction === 2 /* RescanSlashToken */ && startsWithSlashToken(currentToken)) {\n                    currentToken = scanner.reScanSlashToken();\n                    ts.Debug.assert(n.kind === currentToken);\n                    lastScanAction = 2 /* RescanSlashToken */;\n                }\n                else if (expectedScanAction === 3 /* RescanTemplateToken */ && currentToken === 17 /* CloseBraceToken */) {\n                    currentToken = scanner.reScanTemplateToken();\n                    lastScanAction = 3 /* RescanTemplateToken */;\n                }\n                else if (expectedScanAction === 4 /* RescanJsxIdentifier */ && currentToken === 70 /* Identifier */) {\n                    currentToken = scanner.scanJsxIdentifier();\n                    lastScanAction = 4 /* RescanJsxIdentifier */;\n                }\n                else if (expectedScanAction === 5 /* RescanJsxText */) {\n                    currentToken = scanner.reScanJsxToken();\n                    lastScanAction = 5 /* RescanJsxText */;\n                }\n                else {\n                    lastScanAction = 0 /* Scan */;\n                }\n                var token = {\n                    pos: scanner.getStartPos(),\n                    end: scanner.getTextPos(),\n                    kind: currentToken\n                };\n                // consume trailing trivia\n                if (trailingTrivia) {\n                    trailingTrivia = undefined;\n                }\n                while (scanner.getStartPos() < endPos) {\n                    currentToken = scanner.scan();\n                    if (!ts.isTrivia(currentToken)) {\n                        break;\n                    }\n                    var trivia = {\n                        pos: scanner.getStartPos(),\n                        end: scanner.getTextPos(),\n                        kind: currentToken\n                    };\n                    if (!trailingTrivia) {\n                        trailingTrivia = [];\n                    }\n                    trailingTrivia.push(trivia);\n                    if (currentToken === 4 /* NewLineTrivia */) {\n                        // move past new line\n                        scanner.scan();\n                        break;\n                    }\n                }\n                lastTokenInfo = {\n                    leadingTrivia: leadingTrivia,\n                    trailingTrivia: trailingTrivia,\n                    token: token\n                };\n                return fixTokenKind(lastTokenInfo, n);\n            }\n            function isOnToken() {\n                ts.Debug.assert(scanner !== undefined);\n                var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken();\n                var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos();\n                return startPos < endPos && current !== 1 /* EndOfFileToken */ && !ts.isTrivia(current);\n            }\n            // when containing node in the tree is token\n            // but its kind differs from the kind that was returned by the scanner,\n            // then kind needs to be fixed. This might happen in cases\n            // when parser interprets token differently, i.e keyword treated as identifier\n            function fixTokenKind(tokenInfo, container) {\n                if (ts.isToken(container) && tokenInfo.token.kind !== container.kind) {\n                    tokenInfo.token.kind = container.kind;\n                }\n                return tokenInfo;\n            }\n            function skipToEndOf(node) {\n                scanner.setTextPos(node.end);\n                savedPos = scanner.getStartPos();\n                lastScanAction = undefined;\n                lastTokenInfo = undefined;\n                wasNewLine = false;\n                leadingTrivia = undefined;\n                trailingTrivia = undefined;\n            }\n        }\n        formatting.getFormattingScanner = getFormattingScanner;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\n/// <reference path=\"references.ts\"/>\n/* @internal */\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var FormattingContext = (function () {\n            function FormattingContext(sourceFile, formattingRequestKind) {\n                this.sourceFile = sourceFile;\n                this.formattingRequestKind = formattingRequestKind;\n            }\n            FormattingContext.prototype.updateContext = function (currentRange, currentTokenParent, nextRange, nextTokenParent, commonParent) {\n                ts.Debug.assert(currentRange !== undefined, \"currentTokenSpan is null\");\n                ts.Debug.assert(currentTokenParent !== undefined, \"currentTokenParent is null\");\n                ts.Debug.assert(nextRange !== undefined, \"nextTokenSpan is null\");\n                ts.Debug.assert(nextTokenParent !== undefined, \"nextTokenParent is null\");\n                ts.Debug.assert(commonParent !== undefined, \"commonParent is null\");\n                this.currentTokenSpan = currentRange;\n                this.currentTokenParent = currentTokenParent;\n                this.nextTokenSpan = nextRange;\n                this.nextTokenParent = nextTokenParent;\n                this.contextNode = commonParent;\n                // drop cached results\n                this.contextNodeAllOnSameLine = undefined;\n                this.nextNodeAllOnSameLine = undefined;\n                this.tokensAreOnSameLine = undefined;\n                this.contextNodeBlockIsOnOneLine = undefined;\n                this.nextNodeBlockIsOnOneLine = undefined;\n            };\n            FormattingContext.prototype.ContextNodeAllOnSameLine = function () {\n                if (this.contextNodeAllOnSameLine === undefined) {\n                    this.contextNodeAllOnSameLine = this.NodeIsOnOneLine(this.contextNode);\n                }\n                return this.contextNodeAllOnSameLine;\n            };\n            FormattingContext.prototype.NextNodeAllOnSameLine = function () {\n                if (this.nextNodeAllOnSameLine === undefined) {\n                    this.nextNodeAllOnSameLine = this.NodeIsOnOneLine(this.nextTokenParent);\n                }\n                return this.nextNodeAllOnSameLine;\n            };\n            FormattingContext.prototype.TokensAreOnSameLine = function () {\n                if (this.tokensAreOnSameLine === undefined) {\n                    var startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line;\n                    var endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line;\n                    this.tokensAreOnSameLine = (startLine === endLine);\n                }\n                return this.tokensAreOnSameLine;\n            };\n            FormattingContext.prototype.ContextNodeBlockIsOnOneLine = function () {\n                if (this.contextNodeBlockIsOnOneLine === undefined) {\n                    this.contextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.contextNode);\n                }\n                return this.contextNodeBlockIsOnOneLine;\n            };\n            FormattingContext.prototype.NextNodeBlockIsOnOneLine = function () {\n                if (this.nextNodeBlockIsOnOneLine === undefined) {\n                    this.nextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.nextTokenParent);\n                }\n                return this.nextNodeBlockIsOnOneLine;\n            };\n            FormattingContext.prototype.NodeIsOnOneLine = function (node) {\n                var startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line;\n                var endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line;\n                return startLine === endLine;\n            };\n            FormattingContext.prototype.BlockIsOnOneLine = function (node) {\n                var openBrace = ts.findChildOfKind(node, 16 /* OpenBraceToken */, this.sourceFile);\n                var closeBrace = ts.findChildOfKind(node, 17 /* CloseBraceToken */, this.sourceFile);\n                if (openBrace && closeBrace) {\n                    var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line;\n                    var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line;\n                    return startLine === endLine;\n                }\n                return false;\n            };\n            return FormattingContext;\n        }());\n        formatting.FormattingContext = FormattingContext;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\n/// <reference path=\"references.ts\"/>\n/* @internal */\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var FormattingRequestKind;\n        (function (FormattingRequestKind) {\n            FormattingRequestKind[FormattingRequestKind[\"FormatDocument\"] = 0] = \"FormatDocument\";\n            FormattingRequestKind[FormattingRequestKind[\"FormatSelection\"] = 1] = \"FormatSelection\";\n            FormattingRequestKind[FormattingRequestKind[\"FormatOnEnter\"] = 2] = \"FormatOnEnter\";\n            FormattingRequestKind[FormattingRequestKind[\"FormatOnSemicolon\"] = 3] = \"FormatOnSemicolon\";\n            FormattingRequestKind[FormattingRequestKind[\"FormatOnClosingCurlyBrace\"] = 4] = \"FormatOnClosingCurlyBrace\";\n        })(FormattingRequestKind = formatting.FormattingRequestKind || (formatting.FormattingRequestKind = {}));\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\n///<reference path='references.ts' />\n/* @internal */\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var Rule = (function () {\n            function Rule(Descriptor, Operation, Flag) {\n                if (Flag === void 0) { Flag = 0 /* None */; }\n                this.Descriptor = Descriptor;\n                this.Operation = Operation;\n                this.Flag = Flag;\n            }\n            Rule.prototype.toString = function () {\n                return \"[desc=\" + this.Descriptor + \",\" +\n                    \"operation=\" + this.Operation + \",\" +\n                    \"flag=\" + this.Flag + \"]\";\n            };\n            return Rule;\n        }());\n        formatting.Rule = Rule;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\n///<reference path='references.ts' />\n/* @internal */\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var RuleAction;\n        (function (RuleAction) {\n            RuleAction[RuleAction[\"Ignore\"] = 1] = \"Ignore\";\n            RuleAction[RuleAction[\"Space\"] = 2] = \"Space\";\n            RuleAction[RuleAction[\"NewLine\"] = 4] = \"NewLine\";\n            RuleAction[RuleAction[\"Delete\"] = 8] = \"Delete\";\n        })(RuleAction = formatting.RuleAction || (formatting.RuleAction = {}));\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\n///<reference path='references.ts' />\n/* @internal */\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var RuleDescriptor = (function () {\n            function RuleDescriptor(LeftTokenRange, RightTokenRange) {\n                this.LeftTokenRange = LeftTokenRange;\n                this.RightTokenRange = RightTokenRange;\n            }\n            RuleDescriptor.prototype.toString = function () {\n                return \"[leftRange=\" + this.LeftTokenRange + \",\" +\n                    \"rightRange=\" + this.RightTokenRange + \"]\";\n            };\n            RuleDescriptor.create1 = function (left, right) {\n                return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), formatting.Shared.TokenRange.FromToken(right));\n            };\n            RuleDescriptor.create2 = function (left, right) {\n                return RuleDescriptor.create4(left, formatting.Shared.TokenRange.FromToken(right));\n            };\n            RuleDescriptor.create3 = function (left, right) {\n                return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), right);\n            };\n            RuleDescriptor.create4 = function (left, right) {\n                return new RuleDescriptor(left, right);\n            };\n            return RuleDescriptor;\n        }());\n        formatting.RuleDescriptor = RuleDescriptor;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\n///<reference path='references.ts' />\n/* @internal */\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var RuleFlags;\n        (function (RuleFlags) {\n            RuleFlags[RuleFlags[\"None\"] = 0] = \"None\";\n            RuleFlags[RuleFlags[\"CanDeleteNewLines\"] = 1] = \"CanDeleteNewLines\";\n        })(RuleFlags = formatting.RuleFlags || (formatting.RuleFlags = {}));\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\n///<reference path='references.ts' />\n/* @internal */\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var RuleOperation = (function () {\n            function RuleOperation(Context, Action) {\n                this.Context = Context;\n                this.Action = Action;\n            }\n            RuleOperation.prototype.toString = function () {\n                return \"[context=\" + this.Context + \",\" +\n                    \"action=\" + this.Action + \"]\";\n            };\n            RuleOperation.create1 = function (action) {\n                return RuleOperation.create2(formatting.RuleOperationContext.Any, action);\n            };\n            RuleOperation.create2 = function (context, action) {\n                return new RuleOperation(context, action);\n            };\n            return RuleOperation;\n        }());\n        formatting.RuleOperation = RuleOperation;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\n///<reference path='references.ts' />\n/* @internal */\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var RuleOperationContext = (function () {\n            function RuleOperationContext() {\n                var funcs = [];\n                for (var _i = 0; _i < arguments.length; _i++) {\n                    funcs[_i] = arguments[_i];\n                }\n                this.customContextChecks = funcs;\n            }\n            RuleOperationContext.prototype.IsAny = function () {\n                return this === RuleOperationContext.Any;\n            };\n            RuleOperationContext.prototype.InContext = function (context) {\n                if (this.IsAny()) {\n                    return true;\n                }\n                for (var _i = 0, _a = this.customContextChecks; _i < _a.length; _i++) {\n                    var check = _a[_i];\n                    if (!check(context)) {\n                        return false;\n                    }\n                }\n                return true;\n            };\n            return RuleOperationContext;\n        }());\n        RuleOperationContext.Any = new RuleOperationContext();\n        formatting.RuleOperationContext = RuleOperationContext;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\n///<reference path='references.ts' />\n/* @internal */\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var Rules = (function () {\n            function Rules() {\n                ///\n                /// Common Rules\n                ///\n                // Leave comments alone\n                this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1 /* Ignore */));\n                this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2 /* SingleLineCommentTrivia */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1 /* Ignore */));\n                // Space after keyword but not before ; or : or ?\n                this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 55 /* ColonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */));\n                this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54 /* QuestionToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */));\n                this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(55 /* ColonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */));\n                this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), 2 /* Space */));\n                this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                // Space after }.\n                this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */));\n                // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied\n                this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* CloseBraceToken */, 81 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* CloseBraceToken */, 105 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([19 /* CloseParenToken */, 21 /* CloseBracketToken */, 25 /* CommaToken */, 24 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                // No space for dot\n                this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(22 /* DotToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                // No space before and after indexer\n                this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* OpenBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(21 /* CloseBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8 /* Delete */));\n                // Place a space before open brace in a function declaration\n                this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments;\n                this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */);\n                // Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc)\n                this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([70 /* Identifier */, 3 /* MultiLineCommentTrivia */, 74 /* ClassKeyword */, 83 /* ExportKeyword */, 90 /* ImportKeyword */]);\n                this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */);\n                // Place a space before open brace in a control flow construct\n                this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([19 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 80 /* DoKeyword */, 101 /* TryKeyword */, 86 /* FinallyKeyword */, 81 /* ElseKeyword */]);\n                this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */);\n                // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}.\n                this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */));\n                this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */));\n                this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8 /* Delete */));\n                this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8 /* Delete */));\n                this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* OpenBraceToken */, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8 /* Delete */));\n                // Insert new line after { and before } in multi-line contexts.\n                this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */));\n                // For functions and control block place } on a new line    [multi-line rule]\n                this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */));\n                // Special handling of unary operators.\n                // Prefix operators generally shouldn't have a space between\n                // them and their target unary expression.\n                this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */));\n                this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(42 /* PlusPlusToken */, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(43 /* MinusMinusToken */, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 42 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 43 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                // More unary operator special-casing.\n                // DevDiv 181814:  Be careful when removing leading whitespace\n                // around unary operators.  Examples:\n                //      1 - -2  --X-->  1--2\n                //      a + ++b --X-->  a+++b\n                this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(42 /* PlusPlusToken */, 36 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */));\n                this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* PlusToken */, 36 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */));\n                this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* PlusToken */, 42 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */));\n                this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(43 /* MinusMinusToken */, 37 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */));\n                this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(37 /* MinusToken */, 37 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */));\n                this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(37 /* MinusToken */, 43 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */));\n                this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 25 /* CommaToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([103 /* VarKeyword */, 99 /* ThrowKeyword */, 93 /* NewKeyword */, 79 /* DeleteKeyword */, 95 /* ReturnKeyword */, 102 /* TypeOfKeyword */, 120 /* AwaitKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([109 /* LetKeyword */, 75 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */));\n                this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */));\n                this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(88 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */));\n                this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */));\n                this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(104 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */));\n                this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(95 /* ReturnKeyword */, 24 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                // Add a space between statements. All keywords except (do,else,case) has open/close parens after them.\n                // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any]\n                this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([19 /* CloseParenToken */, 80 /* DoKeyword */, 81 /* ElseKeyword */, 72 /* CaseKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNotForContext), 2 /* Space */));\n                // This low-pri rule takes care of \"try {\" and \"finally {\" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter.\n                this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([101 /* TryKeyword */, 86 /* FinallyKeyword */]), 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                //      get x() {}\n                //      set x(val) {}\n                this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124 /* GetKeyword */, 133 /* SetKeyword */]), 70 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */));\n                // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options.\n                this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */));\n                this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */));\n                // TypeScript-specific higher priority rules\n                // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses\n                this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122 /* ConstructorKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                // Use of module as a function call. e.g.: import m2 = module(\"m2\");\n                this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([127 /* ModuleKeyword */, 131 /* RequireKeyword */]), 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                // Add a space around certain TypeScript keywords\n                this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 127 /* ModuleKeyword */, 128 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 133 /* SetKeyword */, 114 /* StaticKeyword */, 136 /* TypeKeyword */, 138 /* FromKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84 /* ExtendsKeyword */, 107 /* ImplementsKeyword */, 138 /* FromKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module \"m2\" {\n                this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */));\n                // Lambda expressions\n                this.SpaceBeforeArrow = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 35 /* EqualsGreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(35 /* EqualsGreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                // Optional parameters and let args\n                this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(23 /* DotDotDotToken */, 70 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* QuestionToken */, formatting.Shared.TokenRange.FromTokens([19 /* CloseParenToken */, 25 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */));\n                // generics and type assertions\n                this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 26 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */));\n                this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(19 /* CloseParenToken */, 26 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */));\n                this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(26 /* LessThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */));\n                this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 28 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */));\n                this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(28 /* GreaterThanToken */, formatting.Shared.TokenRange.FromTokens([18 /* OpenParenToken */, 20 /* OpenBracketToken */, 28 /* GreaterThanToken */, 25 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */));\n                // Remove spaces in empty interface literals. e.g.: x: {}\n                this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* OpenBraceToken */, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectTypeContext), 8 /* Delete */));\n                // decorators\n                this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 56 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(56 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 70 /* Identifier */, 83 /* ExportKeyword */, 78 /* DefaultKeyword */, 74 /* ClassKeyword */, 114 /* StaticKeyword */, 113 /* PublicKeyword */, 111 /* PrivateKeyword */, 112 /* ProtectedKeyword */, 124 /* GetKeyword */, 133 /* SetKeyword */, 20 /* OpenBracketToken */, 38 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */));\n                this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(88 /* FunctionKeyword */, 38 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */));\n                this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(38 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */));\n                this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(115 /* YieldKeyword */, 38 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */));\n                this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([115 /* YieldKeyword */, 38 /* AsteriskToken */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2 /* Space */));\n                // Async-await\n                this.SpaceBetweenAsyncAndOpenParen = new formatting.Rule(formatting.RuleDescriptor.create1(119 /* AsyncKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(119 /* AsyncKeyword */, 88 /* FunctionKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                // template string\n                this.NoSpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(70 /* Identifier */, formatting.Shared.TokenRange.FromTokens([12 /* NoSubstitutionTemplateLiteral */, 13 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                // jsx opening element\n                this.SpaceBeforeJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 70 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNextTokenParentJsxAttribute, Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                this.SpaceBeforeSlashInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 40 /* SlashToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create1(40 /* SlashToken */, 28 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.NoSpaceBeforeEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 57 /* EqualsToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.NoSpaceAfterEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create3(57 /* EqualsToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                // These rules are higher in priority than user-configurable rules.\n                this.HighPriorityCommonRules = [\n                    this.IgnoreBeforeComment, this.IgnoreAfterLineComment,\n                    this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator,\n                    this.NoSpaceAfterQuestionMark,\n                    this.NoSpaceBeforeDot, this.NoSpaceAfterDot,\n                    this.NoSpaceAfterUnaryPrefixOperator,\n                    this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator,\n                    this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator,\n                    this.SpaceAfterPostincrementWhenFollowedByAdd,\n                    this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement,\n                    this.SpaceAfterPostdecrementWhenFollowedBySubtract,\n                    this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement,\n                    this.NoSpaceAfterCloseBrace,\n                    this.NewLineBeforeCloseBraceInBlockContext,\n                    this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets,\n                    this.NoSpaceBetweenFunctionKeywordAndStar, this.SpaceAfterStarInGeneratorDeclaration,\n                    this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember,\n                    this.NoSpaceBetweenYieldKeywordAndStar, this.SpaceBetweenYieldOrYieldStarAndOperand,\n                    this.NoSpaceBetweenReturnAndSemicolon,\n                    this.SpaceAfterCertainKeywords,\n                    this.SpaceAfterLetConstInVariableDeclaration,\n                    this.NoSpaceBeforeOpenParenInFuncCall,\n                    this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator,\n                    this.SpaceAfterVoidOperator,\n                    this.SpaceBetweenAsyncAndOpenParen, this.SpaceBetweenAsyncAndFunctionKeyword,\n                    this.NoSpaceBetweenTagAndTemplateString,\n                    this.SpaceBeforeJsxAttribute, this.SpaceBeforeSlashInJsxOpeningElement, this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement,\n                    this.NoSpaceBeforeEqualInJsxAttribute, this.NoSpaceAfterEqualInJsxAttribute,\n                    // TypeScript-specific rules\n                    this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport,\n                    this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords,\n                    this.SpaceAfterModuleName,\n                    this.SpaceBeforeArrow, this.SpaceAfterArrow,\n                    this.NoSpaceAfterEllipsis,\n                    this.NoSpaceAfterOptionalParameters,\n                    this.NoSpaceBetweenEmptyInterfaceBraceBrackets,\n                    this.NoSpaceBeforeOpenAngularBracket,\n                    this.NoSpaceBetweenCloseParenAndAngularBracket,\n                    this.NoSpaceAfterOpenAngularBracket,\n                    this.NoSpaceBeforeCloseAngularBracket,\n                    this.NoSpaceAfterCloseAngularBracket,\n                    this.SpaceBeforeAt,\n                    this.NoSpaceAfterAt,\n                    this.SpaceAfterDecorator,\n                ];\n                // These rules are lower in priority than user-configurable rules.\n                this.LowPriorityCommonRules = [\n                    this.NoSpaceBeforeSemicolon,\n                    this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock,\n                    this.NoSpaceBeforeComma,\n                    this.NoSpaceBeforeOpenBracket,\n                    this.NoSpaceAfterCloseBracket,\n                    this.SpaceAfterSemicolon,\n                    this.NoSpaceBeforeOpenParenInFuncDecl,\n                    this.SpaceBetweenStatements, this.SpaceAfterTryFinally\n                ];\n                ///\n                /// Rules controlled by user options\n                ///\n                // Insert space after comma delimiter\n                this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(25 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNextTokenNotCloseBracket), 2 /* Space */));\n                this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(25 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext), 8 /* Delete */));\n                // Insert space before and after binary operators\n                this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */));\n                this.SpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */));\n                this.NoSpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8 /* Delete */));\n                this.NoSpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8 /* Delete */));\n                // Insert space after keywords in control flow statements\n                this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2 /* Space */));\n                this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8 /* Delete */));\n                // Open Brace braces after function\n                // TypeScript: Function can have return types, which can be made of tons of different token kinds\n                this.NewLineBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */);\n                // Open Brace braces after TypeScript module/class/interface\n                this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */);\n                // Open Brace braces after control block\n                this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */);\n                // Insert space after semicolon in for statement\n                this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 2 /* Space */));\n                this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 8 /* Delete */));\n                // Insert space after opening and before closing nonempty parenthesis\n                this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(18 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(18 /* OpenParenToken */, 19 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(18 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                // Insert space after opening and before closing nonempty brackets\n                this.SpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                this.SpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(20 /* OpenBracketToken */, 21 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                // Insert space after opening and before closing template string braces\n                this.NoSpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([13 /* TemplateHead */, 14 /* TemplateMiddle */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.SpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([13 /* TemplateHead */, 14 /* TemplateMiddle */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                this.NoSpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([14 /* TemplateMiddle */, 15 /* TemplateTail */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));\n                this.SpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([14 /* TemplateMiddle */, 15 /* TemplateTail */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));\n                // No space after { and before } in JSX expression\n                this.NoSpaceAfterOpenBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 8 /* Delete */));\n                this.SpaceAfterOpenBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 2 /* Space */));\n                this.NoSpaceBeforeCloseBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 8 /* Delete */));\n                this.SpaceBeforeCloseBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 2 /* Space */));\n                // Insert space after function keyword for anonymous functions\n                this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(88 /* FunctionKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */));\n                this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(88 /* FunctionKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8 /* Delete */));\n                // No space after type assertion\n                this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(28 /* GreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), 8 /* Delete */));\n                this.SpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(28 /* GreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), 2 /* Space */));\n            }\n            Rules.prototype.getRuleName = function (rule) {\n                var o = this;\n                for (var name_49 in o) {\n                    if (o[name_49] === rule) {\n                        return name_49;\n                    }\n                }\n                throw new Error(\"Unknown rule\");\n            };\n            ///\n            /// Contexts\n            ///\n            Rules.IsForContext = function (context) {\n                return context.contextNode.kind === 211 /* ForStatement */;\n            };\n            Rules.IsNotForContext = function (context) {\n                return !Rules.IsForContext(context);\n            };\n            Rules.IsBinaryOpContext = function (context) {\n                switch (context.contextNode.kind) {\n                    case 192 /* BinaryExpression */:\n                    case 193 /* ConditionalExpression */:\n                    case 200 /* AsExpression */:\n                    case 243 /* ExportSpecifier */:\n                    case 239 /* ImportSpecifier */:\n                    case 156 /* TypePredicate */:\n                    case 164 /* UnionType */:\n                    case 165 /* IntersectionType */:\n                        return true;\n                    // equals in binding elements: function foo([[x, y] = [1, 2]])\n                    case 174 /* BindingElement */:\n                    // equals in type X = ...\n                    case 228 /* TypeAliasDeclaration */:\n                    // equal in import a = module('a');\n                    case 234 /* ImportEqualsDeclaration */:\n                    // equal in let a = 0;\n                    case 223 /* VariableDeclaration */:\n                    // equal in p = 0;\n                    case 144 /* Parameter */:\n                    case 260 /* EnumMember */:\n                    case 147 /* PropertyDeclaration */:\n                    case 146 /* PropertySignature */:\n                        return context.currentTokenSpan.kind === 57 /* EqualsToken */ || context.nextTokenSpan.kind === 57 /* EqualsToken */;\n                    // \"in\" keyword in for (let x in []) { }\n                    case 212 /* ForInStatement */:\n                        return context.currentTokenSpan.kind === 91 /* InKeyword */ || context.nextTokenSpan.kind === 91 /* InKeyword */;\n                    // Technically, \"of\" is not a binary operator, but format it the same way as \"in\"\n                    case 213 /* ForOfStatement */:\n                        return context.currentTokenSpan.kind === 140 /* OfKeyword */ || context.nextTokenSpan.kind === 140 /* OfKeyword */;\n                }\n                return false;\n            };\n            Rules.IsNotBinaryOpContext = function (context) {\n                return !Rules.IsBinaryOpContext(context);\n            };\n            Rules.IsConditionalOperatorContext = function (context) {\n                return context.contextNode.kind === 193 /* ConditionalExpression */;\n            };\n            Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) {\n                //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction.\n                ////\n                //// Ex:\n                //// if (1)     { ....\n                ////      * ) and { are on the same line so apply the rule. Here we don't care whether it's same or multi block context\n                ////\n                //// Ex:\n                //// if (1)\n                //// { ... }\n                ////      * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we don't format.\n                ////\n                //// Ex:\n                //// if (1)\n                //// { ...\n                //// }\n                ////      * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we format.\n                return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context);\n            };\n            // This check is done before an open brace in a control construct, a function, or a typescript block declaration\n            Rules.IsBeforeMultilineBlockContext = function (context) {\n                return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine());\n            };\n            Rules.IsMultilineBlockContext = function (context) {\n                return Rules.IsBlockContext(context) && !(context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine());\n            };\n            Rules.IsSingleLineBlockContext = function (context) {\n                return Rules.IsBlockContext(context) && (context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine());\n            };\n            Rules.IsBlockContext = function (context) {\n                return Rules.NodeIsBlockContext(context.contextNode);\n            };\n            Rules.IsBeforeBlockContext = function (context) {\n                return Rules.NodeIsBlockContext(context.nextTokenParent);\n            };\n            // IMPORTANT!!! This method must return true ONLY for nodes with open and close braces as immediate children\n            Rules.NodeIsBlockContext = function (node) {\n                if (Rules.NodeIsTypeScriptDeclWithBlockContext(node)) {\n                    // This means we are in a context that looks like a block to the user, but in the grammar is actually not a node (it's a class, module, enum, object type literal, etc).\n                    return true;\n                }\n                switch (node.kind) {\n                    case 204 /* Block */:\n                    case 232 /* CaseBlock */:\n                    case 176 /* ObjectLiteralExpression */:\n                    case 231 /* ModuleBlock */:\n                        return true;\n                }\n                return false;\n            };\n            Rules.IsFunctionDeclContext = function (context) {\n                switch (context.contextNode.kind) {\n                    case 225 /* FunctionDeclaration */:\n                    case 149 /* MethodDeclaration */:\n                    case 148 /* MethodSignature */:\n                    // case SyntaxKind.MemberFunctionDeclaration:\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                    // case SyntaxKind.MethodSignature:\n                    case 153 /* CallSignature */:\n                    case 184 /* FunctionExpression */:\n                    case 150 /* Constructor */:\n                    case 185 /* ArrowFunction */:\n                    // case SyntaxKind.ConstructorDeclaration:\n                    // case SyntaxKind.SimpleArrowFunctionExpression:\n                    // case SyntaxKind.ParenthesizedArrowFunctionExpression:\n                    case 227 /* InterfaceDeclaration */:\n                        return true;\n                }\n                return false;\n            };\n            Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) {\n                return context.contextNode.kind === 225 /* FunctionDeclaration */ || context.contextNode.kind === 184 /* FunctionExpression */;\n            };\n            Rules.IsTypeScriptDeclWithBlockContext = function (context) {\n                return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode);\n            };\n            Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) {\n                switch (node.kind) {\n                    case 226 /* ClassDeclaration */:\n                    case 197 /* ClassExpression */:\n                    case 227 /* InterfaceDeclaration */:\n                    case 229 /* EnumDeclaration */:\n                    case 161 /* TypeLiteral */:\n                    case 230 /* ModuleDeclaration */:\n                    case 241 /* ExportDeclaration */:\n                    case 242 /* NamedExports */:\n                    case 235 /* ImportDeclaration */:\n                    case 238 /* NamedImports */:\n                        return true;\n                }\n                return false;\n            };\n            Rules.IsAfterCodeBlockContext = function (context) {\n                switch (context.currentTokenParent.kind) {\n                    case 226 /* ClassDeclaration */:\n                    case 230 /* ModuleDeclaration */:\n                    case 229 /* EnumDeclaration */:\n                    case 204 /* Block */:\n                    case 256 /* CatchClause */:\n                    case 231 /* ModuleBlock */:\n                    case 218 /* SwitchStatement */:\n                        return true;\n                }\n                return false;\n            };\n            Rules.IsControlDeclContext = function (context) {\n                switch (context.contextNode.kind) {\n                    case 208 /* IfStatement */:\n                    case 218 /* SwitchStatement */:\n                    case 211 /* ForStatement */:\n                    case 212 /* ForInStatement */:\n                    case 213 /* ForOfStatement */:\n                    case 210 /* WhileStatement */:\n                    case 221 /* TryStatement */:\n                    case 209 /* DoStatement */:\n                    case 217 /* WithStatement */:\n                    // TODO\n                    // case SyntaxKind.ElseClause:\n                    case 256 /* CatchClause */:\n                        return true;\n                    default:\n                        return false;\n                }\n            };\n            Rules.IsObjectContext = function (context) {\n                return context.contextNode.kind === 176 /* ObjectLiteralExpression */;\n            };\n            Rules.IsFunctionCallContext = function (context) {\n                return context.contextNode.kind === 179 /* CallExpression */;\n            };\n            Rules.IsNewContext = function (context) {\n                return context.contextNode.kind === 180 /* NewExpression */;\n            };\n            Rules.IsFunctionCallOrNewContext = function (context) {\n                return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context);\n            };\n            Rules.IsPreviousTokenNotComma = function (context) {\n                return context.currentTokenSpan.kind !== 25 /* CommaToken */;\n            };\n            Rules.IsNextTokenNotCloseBracket = function (context) {\n                return context.nextTokenSpan.kind !== 21 /* CloseBracketToken */;\n            };\n            Rules.IsArrowFunctionContext = function (context) {\n                return context.contextNode.kind === 185 /* ArrowFunction */;\n            };\n            Rules.IsNonJsxSameLineTokenContext = function (context) {\n                return context.TokensAreOnSameLine() && context.contextNode.kind !== 10 /* JsxText */;\n            };\n            Rules.IsNonJsxElementContext = function (context) {\n                return context.contextNode.kind !== 246 /* JsxElement */;\n            };\n            Rules.IsJsxExpressionContext = function (context) {\n                return context.contextNode.kind === 252 /* JsxExpression */;\n            };\n            Rules.IsNextTokenParentJsxAttribute = function (context) {\n                return context.nextTokenParent.kind === 250 /* JsxAttribute */;\n            };\n            Rules.IsJsxAttributeContext = function (context) {\n                return context.contextNode.kind === 250 /* JsxAttribute */;\n            };\n            Rules.IsJsxSelfClosingElementContext = function (context) {\n                return context.contextNode.kind === 247 /* JsxSelfClosingElement */;\n            };\n            Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) {\n                return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context);\n            };\n            Rules.IsEndOfDecoratorContextOnSameLine = function (context) {\n                return context.TokensAreOnSameLine() &&\n                    context.contextNode.decorators &&\n                    Rules.NodeIsInDecoratorContext(context.currentTokenParent) &&\n                    !Rules.NodeIsInDecoratorContext(context.nextTokenParent);\n            };\n            Rules.NodeIsInDecoratorContext = function (node) {\n                while (ts.isPartOfExpression(node)) {\n                    node = node.parent;\n                }\n                return node.kind === 145 /* Decorator */;\n            };\n            Rules.IsStartOfVariableDeclarationList = function (context) {\n                return context.currentTokenParent.kind === 224 /* VariableDeclarationList */ &&\n                    context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos;\n            };\n            Rules.IsNotFormatOnEnter = function (context) {\n                return context.formattingRequestKind !== 2 /* FormatOnEnter */;\n            };\n            Rules.IsModuleDeclContext = function (context) {\n                return context.contextNode.kind === 230 /* ModuleDeclaration */;\n            };\n            Rules.IsObjectTypeContext = function (context) {\n                return context.contextNode.kind === 161 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration;\n            };\n            Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) {\n                if (token.kind !== 26 /* LessThanToken */ && token.kind !== 28 /* GreaterThanToken */) {\n                    return false;\n                }\n                switch (parent.kind) {\n                    case 157 /* TypeReference */:\n                    case 182 /* TypeAssertionExpression */:\n                    case 226 /* ClassDeclaration */:\n                    case 197 /* ClassExpression */:\n                    case 227 /* InterfaceDeclaration */:\n                    case 225 /* FunctionDeclaration */:\n                    case 184 /* FunctionExpression */:\n                    case 185 /* ArrowFunction */:\n                    case 149 /* MethodDeclaration */:\n                    case 148 /* MethodSignature */:\n                    case 153 /* CallSignature */:\n                    case 154 /* ConstructSignature */:\n                    case 179 /* CallExpression */:\n                    case 180 /* NewExpression */:\n                    case 199 /* ExpressionWithTypeArguments */:\n                        return true;\n                    default:\n                        return false;\n                }\n            };\n            Rules.IsTypeArgumentOrParameterOrAssertionContext = function (context) {\n                return Rules.IsTypeArgumentOrParameterOrAssertion(context.currentTokenSpan, context.currentTokenParent) ||\n                    Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent);\n            };\n            Rules.IsTypeAssertionContext = function (context) {\n                return context.contextNode.kind === 182 /* TypeAssertionExpression */;\n            };\n            Rules.IsVoidOpContext = function (context) {\n                return context.currentTokenSpan.kind === 104 /* VoidKeyword */ && context.currentTokenParent.kind === 188 /* VoidExpression */;\n            };\n            Rules.IsYieldOrYieldStarWithOperand = function (context) {\n                return context.contextNode.kind === 195 /* YieldExpression */ && context.contextNode.expression !== undefined;\n            };\n            return Rules;\n        }());\n        formatting.Rules = Rules;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\n///<reference path='references.ts' />\n/* @internal */\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var RulesMap = (function () {\n            function RulesMap() {\n                this.map = [];\n                this.mapRowLength = 0;\n            }\n            RulesMap.create = function (rules) {\n                var result = new RulesMap();\n                result.Initialize(rules);\n                return result;\n            };\n            RulesMap.prototype.Initialize = function (rules) {\n                this.mapRowLength = 140 /* LastToken */ + 1;\n                this.map = new Array(this.mapRowLength * this.mapRowLength); // new Array<RulesBucket>(this.mapRowLength * this.mapRowLength);\n                // This array is used only during construction of the rulesbucket in the map\n                var rulesBucketConstructionStateList = new Array(this.map.length); // new Array<RulesBucketConstructionState>(this.map.length);\n                this.FillRules(rules, rulesBucketConstructionStateList);\n                return this.map;\n            };\n            RulesMap.prototype.FillRules = function (rules, rulesBucketConstructionStateList) {\n                var _this = this;\n                rules.forEach(function (rule) {\n                    _this.FillRule(rule, rulesBucketConstructionStateList);\n                });\n            };\n            RulesMap.prototype.GetRuleBucketIndex = function (row, column) {\n                ts.Debug.assert(row <= 140 /* LastKeyword */ && column <= 140 /* LastKeyword */, \"Must compute formatting context from tokens\");\n                var rulesBucketIndex = (row * this.mapRowLength) + column;\n                return rulesBucketIndex;\n            };\n            RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) {\n                var _this = this;\n                var specificRule = rule.Descriptor.LeftTokenRange !== formatting.Shared.TokenRange.Any &&\n                    rule.Descriptor.RightTokenRange !== formatting.Shared.TokenRange.Any;\n                rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) {\n                    rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) {\n                        var rulesBucketIndex = _this.GetRuleBucketIndex(left, right);\n                        var rulesBucket = _this.map[rulesBucketIndex];\n                        if (rulesBucket === undefined) {\n                            rulesBucket = _this.map[rulesBucketIndex] = new RulesBucket();\n                        }\n                        rulesBucket.AddRule(rule, specificRule, rulesBucketConstructionStateList, rulesBucketIndex);\n                    });\n                });\n            };\n            RulesMap.prototype.GetRule = function (context) {\n                var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind);\n                var bucket = this.map[bucketIndex];\n                if (bucket) {\n                    for (var _i = 0, _a = bucket.Rules(); _i < _a.length; _i++) {\n                        var rule = _a[_i];\n                        if (rule.Operation.Context.InContext(context)) {\n                            return rule;\n                        }\n                    }\n                }\n                return undefined;\n            };\n            return RulesMap;\n        }());\n        formatting.RulesMap = RulesMap;\n        var MaskBitSize = 5;\n        var Mask = 0x1f;\n        var RulesPosition;\n        (function (RulesPosition) {\n            RulesPosition[RulesPosition[\"IgnoreRulesSpecific\"] = 0] = \"IgnoreRulesSpecific\";\n            RulesPosition[RulesPosition[\"IgnoreRulesAny\"] = MaskBitSize * 1] = \"IgnoreRulesAny\";\n            RulesPosition[RulesPosition[\"ContextRulesSpecific\"] = MaskBitSize * 2] = \"ContextRulesSpecific\";\n            RulesPosition[RulesPosition[\"ContextRulesAny\"] = MaskBitSize * 3] = \"ContextRulesAny\";\n            RulesPosition[RulesPosition[\"NoContextRulesSpecific\"] = MaskBitSize * 4] = \"NoContextRulesSpecific\";\n            RulesPosition[RulesPosition[\"NoContextRulesAny\"] = MaskBitSize * 5] = \"NoContextRulesAny\";\n        })(RulesPosition = formatting.RulesPosition || (formatting.RulesPosition = {}));\n        var RulesBucketConstructionState = (function () {\n            function RulesBucketConstructionState() {\n                //// The Rules list contains all the inserted rules into a rulebucket in the following order:\n                ////    1- Ignore rules with specific token combination\n                ////    2- Ignore rules with any token combination\n                ////    3- Context rules with specific token combination\n                ////    4- Context rules with any token combination\n                ////    5- Non-context rules with specific token combination\n                ////    6- Non-context rules with any token combination\n                ////\n                //// The member rulesInsertionIndexBitmap is used to describe the number of rules\n                //// in each sub-bucket (above) hence can be used to know the index of where to insert\n                //// the next rule. It's a bitmap which contains 6 different sections each is given 5 bits.\n                ////\n                //// Example:\n                //// In order to insert a rule to the end of sub-bucket (3), we get the index by adding\n                //// the values in the bitmap segments 3rd, 2nd, and 1st.\n                this.rulesInsertionIndexBitmap = 0;\n            }\n            RulesBucketConstructionState.prototype.GetInsertionIndex = function (maskPosition) {\n                var index = 0;\n                var pos = 0;\n                var indexBitmap = this.rulesInsertionIndexBitmap;\n                while (pos <= maskPosition) {\n                    index += (indexBitmap & Mask);\n                    indexBitmap >>= MaskBitSize;\n                    pos += MaskBitSize;\n                }\n                return index;\n            };\n            RulesBucketConstructionState.prototype.IncreaseInsertionIndex = function (maskPosition) {\n                var value = (this.rulesInsertionIndexBitmap >> maskPosition) & Mask;\n                value++;\n                ts.Debug.assert((value & Mask) === value, \"Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules.\");\n                var temp = this.rulesInsertionIndexBitmap & ~(Mask << maskPosition);\n                temp |= value << maskPosition;\n                this.rulesInsertionIndexBitmap = temp;\n            };\n            return RulesBucketConstructionState;\n        }());\n        formatting.RulesBucketConstructionState = RulesBucketConstructionState;\n        var RulesBucket = (function () {\n            function RulesBucket() {\n                this.rules = [];\n            }\n            RulesBucket.prototype.Rules = function () {\n                return this.rules;\n            };\n            RulesBucket.prototype.AddRule = function (rule, specificTokens, constructionState, rulesBucketIndex) {\n                var position;\n                if (rule.Operation.Action === 1 /* Ignore */) {\n                    position = specificTokens ?\n                        RulesPosition.IgnoreRulesSpecific :\n                        RulesPosition.IgnoreRulesAny;\n                }\n                else if (!rule.Operation.Context.IsAny()) {\n                    position = specificTokens ?\n                        RulesPosition.ContextRulesSpecific :\n                        RulesPosition.ContextRulesAny;\n                }\n                else {\n                    position = specificTokens ?\n                        RulesPosition.NoContextRulesSpecific :\n                        RulesPosition.NoContextRulesAny;\n                }\n                var state = constructionState[rulesBucketIndex];\n                if (state === undefined) {\n                    state = constructionState[rulesBucketIndex] = new RulesBucketConstructionState();\n                }\n                var index = state.GetInsertionIndex(position);\n                this.rules.splice(index, 0, rule);\n                state.IncreaseInsertionIndex(position);\n            };\n            return RulesBucket;\n        }());\n        formatting.RulesBucket = RulesBucket;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\n///<reference path='references.ts' />\n/* @internal */\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var Shared;\n        (function (Shared) {\n            var TokenRangeAccess = (function () {\n                function TokenRangeAccess(from, to, except) {\n                    this.tokens = [];\n                    for (var token = from; token <= to; token++) {\n                        if (ts.indexOf(except, token) < 0) {\n                            this.tokens.push(token);\n                        }\n                    }\n                }\n                TokenRangeAccess.prototype.GetTokens = function () {\n                    return this.tokens;\n                };\n                TokenRangeAccess.prototype.Contains = function (token) {\n                    return this.tokens.indexOf(token) >= 0;\n                };\n                return TokenRangeAccess;\n            }());\n            Shared.TokenRangeAccess = TokenRangeAccess;\n            var TokenValuesAccess = (function () {\n                function TokenValuesAccess(tks) {\n                    this.tokens = tks && tks.length ? tks : [];\n                }\n                TokenValuesAccess.prototype.GetTokens = function () {\n                    return this.tokens;\n                };\n                TokenValuesAccess.prototype.Contains = function (token) {\n                    return this.tokens.indexOf(token) >= 0;\n                };\n                return TokenValuesAccess;\n            }());\n            Shared.TokenValuesAccess = TokenValuesAccess;\n            var TokenSingleValueAccess = (function () {\n                function TokenSingleValueAccess(token) {\n                    this.token = token;\n                }\n                TokenSingleValueAccess.prototype.GetTokens = function () {\n                    return [this.token];\n                };\n                TokenSingleValueAccess.prototype.Contains = function (tokenValue) {\n                    return tokenValue === this.token;\n                };\n                return TokenSingleValueAccess;\n            }());\n            Shared.TokenSingleValueAccess = TokenSingleValueAccess;\n            var TokenAllAccess = (function () {\n                function TokenAllAccess() {\n                }\n                TokenAllAccess.prototype.GetTokens = function () {\n                    var result = [];\n                    for (var token = 0 /* FirstToken */; token <= 140 /* LastToken */; token++) {\n                        result.push(token);\n                    }\n                    return result;\n                };\n                TokenAllAccess.prototype.Contains = function () {\n                    return true;\n                };\n                TokenAllAccess.prototype.toString = function () {\n                    return \"[allTokens]\";\n                };\n                return TokenAllAccess;\n            }());\n            Shared.TokenAllAccess = TokenAllAccess;\n            var TokenRange = (function () {\n                function TokenRange(tokenAccess) {\n                    this.tokenAccess = tokenAccess;\n                }\n                TokenRange.FromToken = function (token) {\n                    return new TokenRange(new TokenSingleValueAccess(token));\n                };\n                TokenRange.FromTokens = function (tokens) {\n                    return new TokenRange(new TokenValuesAccess(tokens));\n                };\n                TokenRange.FromRange = function (f, to, except) {\n                    if (except === void 0) { except = []; }\n                    return new TokenRange(new TokenRangeAccess(f, to, except));\n                };\n                TokenRange.AllTokens = function () {\n                    return new TokenRange(new TokenAllAccess());\n                };\n                TokenRange.prototype.GetTokens = function () {\n                    return this.tokenAccess.GetTokens();\n                };\n                TokenRange.prototype.Contains = function (token) {\n                    return this.tokenAccess.Contains(token);\n                };\n                TokenRange.prototype.toString = function () {\n                    return this.tokenAccess.toString();\n                };\n                return TokenRange;\n            }());\n            TokenRange.Any = TokenRange.AllTokens();\n            TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */]));\n            TokenRange.Keywords = TokenRange.FromRange(71 /* FirstKeyword */, 140 /* LastKeyword */);\n            TokenRange.BinaryOperators = TokenRange.FromRange(26 /* FirstBinaryOperator */, 69 /* LastBinaryOperator */);\n            TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91 /* InKeyword */, 92 /* InstanceOfKeyword */, 140 /* OfKeyword */, 117 /* AsKeyword */, 125 /* IsKeyword */]);\n            TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([42 /* PlusPlusToken */, 43 /* MinusMinusToken */, 51 /* TildeToken */, 50 /* ExclamationToken */]);\n            TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8 /* NumericLiteral */, 70 /* Identifier */, 18 /* OpenParenToken */, 20 /* OpenBracketToken */, 16 /* OpenBraceToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]);\n            TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]);\n            TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 19 /* CloseParenToken */, 21 /* CloseBracketToken */, 93 /* NewKeyword */]);\n            TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]);\n            TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 19 /* CloseParenToken */, 21 /* CloseBracketToken */, 93 /* NewKeyword */]);\n            TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]);\n            TokenRange.TypeNames = TokenRange.FromTokens([70 /* Identifier */, 132 /* NumberKeyword */, 134 /* StringKeyword */, 121 /* BooleanKeyword */, 135 /* SymbolKeyword */, 104 /* VoidKeyword */, 118 /* AnyKeyword */]);\n            Shared.TokenRange = TokenRange;\n        })(Shared = formatting.Shared || (formatting.Shared = {}));\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\n///<reference path='..\\services.ts' />\n///<reference path='formattingContext.ts' />\n///<reference path='formattingRequestKind.ts' />\n///<reference path='rule.ts' />\n///<reference path='ruleAction.ts' />\n///<reference path='ruleDescriptor.ts' />\n///<reference path='ruleFlag.ts' />\n///<reference path='ruleOperation.ts' />\n///<reference path='ruleOperationContext.ts' />\n///<reference path='rules.ts' />\n///<reference path='rulesMap.ts' />\n///<reference path='tokenRange.ts' /> \n/// <reference path=\"references.ts\"/>\n/* @internal */\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var RulesProvider = (function () {\n            function RulesProvider() {\n                this.globalRules = new formatting.Rules();\n            }\n            RulesProvider.prototype.getRuleName = function (rule) {\n                return this.globalRules.getRuleName(rule);\n            };\n            RulesProvider.prototype.getRuleByName = function (name) {\n                return this.globalRules[name];\n            };\n            RulesProvider.prototype.getRulesMap = function () {\n                return this.rulesMap;\n            };\n            RulesProvider.prototype.ensureUpToDate = function (options) {\n                if (!this.options || !ts.compareDataObjects(this.options, options)) {\n                    var activeRules = this.createActiveRules(options);\n                    var rulesMap = formatting.RulesMap.create(activeRules);\n                    this.activeRules = activeRules;\n                    this.rulesMap = rulesMap;\n                    this.options = ts.clone(options);\n                }\n            };\n            RulesProvider.prototype.createActiveRules = function (options) {\n                var rules = this.globalRules.HighPriorityCommonRules.slice(0);\n                if (options.insertSpaceAfterCommaDelimiter) {\n                    rules.push(this.globalRules.SpaceAfterComma);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterComma);\n                }\n                if (options.insertSpaceAfterFunctionKeywordForAnonymousFunctions) {\n                    rules.push(this.globalRules.SpaceAfterAnonymousFunctionKeyword);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterAnonymousFunctionKeyword);\n                }\n                if (options.insertSpaceAfterKeywordsInControlFlowStatements) {\n                    rules.push(this.globalRules.SpaceAfterKeywordInControl);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterKeywordInControl);\n                }\n                if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis) {\n                    rules.push(this.globalRules.SpaceAfterOpenParen);\n                    rules.push(this.globalRules.SpaceBeforeCloseParen);\n                    rules.push(this.globalRules.NoSpaceBetweenParens);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterOpenParen);\n                    rules.push(this.globalRules.NoSpaceBeforeCloseParen);\n                    rules.push(this.globalRules.NoSpaceBetweenParens);\n                }\n                if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets) {\n                    rules.push(this.globalRules.SpaceAfterOpenBracket);\n                    rules.push(this.globalRules.SpaceBeforeCloseBracket);\n                    rules.push(this.globalRules.NoSpaceBetweenBrackets);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterOpenBracket);\n                    rules.push(this.globalRules.NoSpaceBeforeCloseBracket);\n                    rules.push(this.globalRules.NoSpaceBetweenBrackets);\n                }\n                // The default value of InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces is true\n                // so if the option is undefined, we should treat it as true as well\n                if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces !== false) {\n                    rules.push(this.globalRules.SpaceAfterOpenBrace);\n                    rules.push(this.globalRules.SpaceBeforeCloseBrace);\n                    rules.push(this.globalRules.NoSpaceBetweenEmptyBraceBrackets);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterOpenBrace);\n                    rules.push(this.globalRules.NoSpaceBeforeCloseBrace);\n                    rules.push(this.globalRules.NoSpaceBetweenEmptyBraceBrackets);\n                }\n                if (options.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces) {\n                    rules.push(this.globalRules.SpaceAfterTemplateHeadAndMiddle);\n                    rules.push(this.globalRules.SpaceBeforeTemplateMiddleAndTail);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterTemplateHeadAndMiddle);\n                    rules.push(this.globalRules.NoSpaceBeforeTemplateMiddleAndTail);\n                }\n                if (options.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces) {\n                    rules.push(this.globalRules.SpaceAfterOpenBraceInJsxExpression);\n                    rules.push(this.globalRules.SpaceBeforeCloseBraceInJsxExpression);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterOpenBraceInJsxExpression);\n                    rules.push(this.globalRules.NoSpaceBeforeCloseBraceInJsxExpression);\n                }\n                if (options.insertSpaceAfterSemicolonInForStatements) {\n                    rules.push(this.globalRules.SpaceAfterSemicolonInFor);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterSemicolonInFor);\n                }\n                if (options.insertSpaceBeforeAndAfterBinaryOperators) {\n                    rules.push(this.globalRules.SpaceBeforeBinaryOperator);\n                    rules.push(this.globalRules.SpaceAfterBinaryOperator);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceBeforeBinaryOperator);\n                    rules.push(this.globalRules.NoSpaceAfterBinaryOperator);\n                }\n                if (options.placeOpenBraceOnNewLineForControlBlocks) {\n                    rules.push(this.globalRules.NewLineBeforeOpenBraceInControl);\n                }\n                if (options.placeOpenBraceOnNewLineForFunctions) {\n                    rules.push(this.globalRules.NewLineBeforeOpenBraceInFunction);\n                    rules.push(this.globalRules.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock);\n                }\n                if (options.insertSpaceAfterTypeAssertion) {\n                    rules.push(this.globalRules.SpaceAfterTypeAssertion);\n                }\n                else {\n                    rules.push(this.globalRules.NoSpaceAfterTypeAssertion);\n                }\n                rules = rules.concat(this.globalRules.LowPriorityCommonRules);\n                return rules;\n            };\n            return RulesProvider;\n        }());\n        formatting.RulesProvider = RulesProvider;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\n///<reference path='..\\services.ts' />\n///<reference path='formattingScanner.ts' />\n///<reference path='rulesProvider.ts' />\n///<reference path='references.ts' />\n/* @internal */\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var Constants;\n        (function (Constants) {\n            Constants[Constants[\"Unknown\"] = -1] = \"Unknown\";\n        })(Constants || (Constants = {}));\n        function formatOnEnter(position, sourceFile, rulesProvider, options) {\n            var line = sourceFile.getLineAndCharacterOfPosition(position).line;\n            if (line === 0) {\n                return [];\n            }\n            // After the enter key, the cursor is now at a new line. The new line may or may not contain non-whitespace characters.\n            // If the new line has only whitespaces, we won't want to format this line, because that would remove the indentation as\n            // trailing whitespaces. So the end of the formatting span should be the later one between:\n            //  1. the end of the previous line\n            //  2. the last non-whitespace character in the current line\n            var endOfFormatSpan = ts.getEndLinePosition(line, sourceFile);\n            while (ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(endOfFormatSpan))) {\n                endOfFormatSpan--;\n            }\n            // if the character at the end of the span is a line break, we shouldn't include it, because it indicates we don't want to\n            // touch the current line at all. Also, on some OSes the line break consists of two characters (\\r\\n), we should test if the\n            // previous character before the end of format span is line break character as well.\n            if (ts.isLineBreak(sourceFile.text.charCodeAt(endOfFormatSpan))) {\n                endOfFormatSpan--;\n            }\n            var span = {\n                // get start position for the previous line\n                pos: ts.getStartPositionOfLine(line - 1, sourceFile),\n                // end value is exclusive so add 1 to the result\n                end: endOfFormatSpan + 1\n            };\n            return formatSpan(span, sourceFile, options, rulesProvider, 2 /* FormatOnEnter */);\n        }\n        formatting.formatOnEnter = formatOnEnter;\n        function formatOnSemicolon(position, sourceFile, rulesProvider, options) {\n            return formatOutermostParent(position, 24 /* SemicolonToken */, sourceFile, options, rulesProvider, 3 /* FormatOnSemicolon */);\n        }\n        formatting.formatOnSemicolon = formatOnSemicolon;\n        function formatOnClosingCurly(position, sourceFile, rulesProvider, options) {\n            return formatOutermostParent(position, 17 /* CloseBraceToken */, sourceFile, options, rulesProvider, 4 /* FormatOnClosingCurlyBrace */);\n        }\n        formatting.formatOnClosingCurly = formatOnClosingCurly;\n        function formatDocument(sourceFile, rulesProvider, options) {\n            var span = {\n                pos: 0,\n                end: sourceFile.text.length\n            };\n            return formatSpan(span, sourceFile, options, rulesProvider, 0 /* FormatDocument */);\n        }\n        formatting.formatDocument = formatDocument;\n        function formatSelection(start, end, sourceFile, rulesProvider, options) {\n            // format from the beginning of the line\n            var span = {\n                pos: ts.getLineStartPositionForPosition(start, sourceFile),\n                end: end\n            };\n            return formatSpan(span, sourceFile, options, rulesProvider, 1 /* FormatSelection */);\n        }\n        formatting.formatSelection = formatSelection;\n        function formatOutermostParent(position, expectedLastToken, sourceFile, options, rulesProvider, requestKind) {\n            var parent = findOutermostParent(position, expectedLastToken, sourceFile);\n            if (!parent) {\n                return [];\n            }\n            var span = {\n                pos: ts.getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile),\n                end: parent.end\n            };\n            return formatSpan(span, sourceFile, options, rulesProvider, requestKind);\n        }\n        function findOutermostParent(position, expectedTokenKind, sourceFile) {\n            var precedingToken = ts.findPrecedingToken(position, sourceFile);\n            // when it is claimed that trigger character was typed at given position\n            // we verify that there is a token with a matching kind whose end is equal to position (because the character was just typed).\n            // If this condition is not hold - then trigger character was typed in some other context,\n            // i.e.in comment and thus should not trigger autoformatting\n            if (!precedingToken ||\n                precedingToken.kind !== expectedTokenKind ||\n                position !== precedingToken.getEnd()) {\n                return undefined;\n            }\n            // walk up and search for the parent node that ends at the same position with precedingToken.\n            // for cases like this\n            //\n            // let x = 1;\n            // while (true) {\n            // }\n            // after typing close curly in while statement we want to reformat just the while statement.\n            // However if we just walk upwards searching for the parent that has the same end value -\n            // we'll end up with the whole source file. isListElement allows to stop on the list element level\n            var current = precedingToken;\n            while (current &&\n                current.parent &&\n                current.parent.end === precedingToken.end &&\n                !isListElement(current.parent, current)) {\n                current = current.parent;\n            }\n            return current;\n        }\n        // Returns true if node is a element in some list in parent\n        // i.e. parent is class declaration with the list of members and node is one of members.\n        function isListElement(parent, node) {\n            switch (parent.kind) {\n                case 226 /* ClassDeclaration */:\n                case 227 /* InterfaceDeclaration */:\n                    return ts.rangeContainsRange(parent.members, node);\n                case 230 /* ModuleDeclaration */:\n                    var body = parent.body;\n                    return body && body.kind === 231 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node);\n                case 261 /* SourceFile */:\n                case 204 /* Block */:\n                case 231 /* ModuleBlock */:\n                    return ts.rangeContainsRange(parent.statements, node);\n                case 256 /* CatchClause */:\n                    return ts.rangeContainsRange(parent.block.statements, node);\n            }\n            return false;\n        }\n        /** find node that fully contains given text range */\n        function findEnclosingNode(range, sourceFile) {\n            return find(sourceFile);\n            function find(n) {\n                var candidate = ts.forEachChild(n, function (c) { return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; });\n                if (candidate) {\n                    var result = find(candidate);\n                    if (result) {\n                        return result;\n                    }\n                }\n                return n;\n            }\n        }\n        /** formatting is not applied to ranges that contain parse errors.\n          * This function will return a predicate that for a given text range will tell\n          * if there are any parse errors that overlap with the range.\n          */\n        function prepareRangeContainsErrorFunction(errors, originalRange) {\n            if (!errors.length) {\n                return rangeHasNoErrors;\n            }\n            // pick only errors that fall in range\n            var sorted = errors\n                .filter(function (d) { return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); })\n                .sort(function (e1, e2) { return e1.start - e2.start; });\n            if (!sorted.length) {\n                return rangeHasNoErrors;\n            }\n            var index = 0;\n            return function (r) {\n                // in current implementation sequence of arguments [r1, r2...] is monotonically increasing.\n                // 'index' tracks the index of the most recent error that was checked.\n                while (true) {\n                    if (index >= sorted.length) {\n                        // all errors in the range were already checked -> no error in specified range\n                        return false;\n                    }\n                    var error = sorted[index];\n                    if (r.end <= error.start) {\n                        // specified range ends before the error refered by 'index' - no error in range\n                        return false;\n                    }\n                    if (ts.startEndOverlapsWithStartEnd(r.pos, r.end, error.start, error.start + error.length)) {\n                        // specified range overlaps with error range\n                        return true;\n                    }\n                    index++;\n                }\n            };\n            function rangeHasNoErrors() {\n                return false;\n            }\n        }\n        /**\n          * Start of the original range might fall inside the comment - scanner will not yield appropriate results\n          * This function will look for token that is located before the start of target range\n          * and return its end as start position for the scanner.\n          */\n        function getScanStartPosition(enclosingNode, originalRange, sourceFile) {\n            var start = enclosingNode.getStart(sourceFile);\n            if (start === originalRange.pos && enclosingNode.end === originalRange.end) {\n                return start;\n            }\n            var precedingToken = ts.findPrecedingToken(originalRange.pos, sourceFile);\n            if (!precedingToken) {\n                // no preceding token found - start from the beginning of enclosing node\n                return enclosingNode.pos;\n            }\n            // preceding token ends after the start of original range (i.e when originalRange.pos falls in the middle of literal)\n            // start from the beginning of enclosingNode to handle the entire 'originalRange'\n            if (precedingToken.end >= originalRange.pos) {\n                return enclosingNode.pos;\n            }\n            return precedingToken.end;\n        }\n        /*\n         * For cases like\n         * if (a ||\n         *     b ||$\n         *     c) {...}\n         * If we hit Enter at $ we want line '    b ||' to be indented.\n         * Formatting will be applied to the last two lines.\n         * Node that fully encloses these lines is binary expression 'a ||...'.\n         * Initial indentation for this node will be 0.\n         * Binary expressions don't introduce new indentation scopes, however it is possible\n         * that some parent node on the same line does - like if statement in this case.\n         * Note that we are considering parents only from the same line with initial node -\n         * if parent is on the different line - its delta was already contributed\n         * to the initial indentation.\n         */\n        function getOwnOrInheritedDelta(n, options, sourceFile) {\n            var previousLine = -1 /* Unknown */;\n            var child;\n            while (n) {\n                var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line;\n                if (previousLine !== -1 /* Unknown */ && line !== previousLine) {\n                    break;\n                }\n                if (formatting.SmartIndenter.shouldIndentChildNode(n, child)) {\n                    return options.indentSize;\n                }\n                previousLine = line;\n                child = n;\n                n = n.parent;\n            }\n            return 0;\n        }\n        function formatSpan(originalRange, sourceFile, options, rulesProvider, requestKind) {\n            var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange);\n            // formatting context is used by rules provider\n            var formattingContext = new formatting.FormattingContext(sourceFile, requestKind);\n            // find the smallest node that fully wraps the range and compute the initial indentation for the node\n            var enclosingNode = findEnclosingNode(originalRange, sourceFile);\n            var formattingScanner = formatting.getFormattingScanner(sourceFile, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end);\n            var initialIndentation = formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options);\n            var previousRangeHasError;\n            var previousRange;\n            var previousParent;\n            var previousRangeStartLine;\n            var lastIndentedLine;\n            var indentationOnLastIndentedLine;\n            var edits = [];\n            formattingScanner.advance();\n            if (formattingScanner.isOnToken()) {\n                var startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line;\n                var undecoratedStartLine = startLine;\n                if (enclosingNode.decorators) {\n                    undecoratedStartLine = sourceFile.getLineAndCharacterOfPosition(ts.getNonDecoratorTokenPosOfNode(enclosingNode, sourceFile)).line;\n                }\n                var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile);\n                processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta);\n            }\n            if (!formattingScanner.isOnToken()) {\n                var leadingTrivia = formattingScanner.getCurrentLeadingTrivia();\n                if (leadingTrivia) {\n                    processTrivia(leadingTrivia, enclosingNode, enclosingNode, undefined);\n                    trimTrailingWhitespacesForRemainingRange();\n                }\n            }\n            formattingScanner.close();\n            return edits;\n            // local functions\n            /** Tries to compute the indentation for a list element.\n              * If list element is not in range then\n              * function will pick its actual indentation\n              * so it can be pushed downstream as inherited indentation.\n              * If list element is in the range - its indentation will be equal\n              * to inherited indentation from its predecessors.\n              */\n            function tryComputeIndentationForListItem(startPos, endPos, parentStartLine, range, inheritedIndentation) {\n                if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos) ||\n                    ts.rangeContainsStartEnd(range, startPos, endPos) /* Not to miss zero-range nodes e.g. JsxText */) {\n                    if (inheritedIndentation !== -1 /* Unknown */) {\n                        return inheritedIndentation;\n                    }\n                }\n                else {\n                    var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line;\n                    var startLinePosition = ts.getLineStartPositionForPosition(startPos, sourceFile);\n                    var column = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options);\n                    if (startLine !== parentStartLine || startPos === column) {\n                        // Use the base indent size if it is greater than\n                        // the indentation of the inherited predecessor.\n                        var baseIndentSize = formatting.SmartIndenter.getBaseIndentation(options);\n                        return baseIndentSize > column ? baseIndentSize : column;\n                    }\n                }\n                return -1 /* Unknown */;\n            }\n            function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) {\n                var indentation = inheritedIndentation;\n                var delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.indentSize : 0;\n                if (effectiveParentStartLine === startLine) {\n                    // if node is located on the same line with the parent\n                    // - inherit indentation from the parent\n                    // - push children if either parent of node itself has non-zero delta\n                    indentation = startLine === lastIndentedLine\n                        ? indentationOnLastIndentedLine\n                        : parentDynamicIndentation.getIndentation();\n                    delta = Math.min(options.indentSize, parentDynamicIndentation.getDelta(node) + delta);\n                }\n                else if (indentation === -1 /* Unknown */) {\n                    if (formatting.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) {\n                        indentation = parentDynamicIndentation.getIndentation();\n                    }\n                    else {\n                        indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(node);\n                    }\n                }\n                return {\n                    indentation: indentation,\n                    delta: delta\n                };\n            }\n            function getFirstNonDecoratorTokenOfNode(node) {\n                if (node.modifiers && node.modifiers.length) {\n                    return node.modifiers[0].kind;\n                }\n                switch (node.kind) {\n                    case 226 /* ClassDeclaration */: return 74 /* ClassKeyword */;\n                    case 227 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */;\n                    case 225 /* FunctionDeclaration */: return 88 /* FunctionKeyword */;\n                    case 229 /* EnumDeclaration */: return 229 /* EnumDeclaration */;\n                    case 151 /* GetAccessor */: return 124 /* GetKeyword */;\n                    case 152 /* SetAccessor */: return 133 /* SetKeyword */;\n                    case 149 /* MethodDeclaration */:\n                        if (node.asteriskToken) {\n                            return 38 /* AsteriskToken */;\n                        } /*\n                    fall-through\n                    */\n                    case 147 /* PropertyDeclaration */:\n                    case 144 /* Parameter */:\n                        return node.name.kind;\n                }\n            }\n            function getDynamicIndentation(node, nodeStartLine, indentation, delta) {\n                return {\n                    getIndentationForComment: function (kind, tokenIndentation, container) {\n                        switch (kind) {\n                            // preceding comment to the token that closes the indentation scope inherits the indentation from the scope\n                            // ..  {\n                            //     // comment\n                            // }\n                            case 17 /* CloseBraceToken */:\n                            case 21 /* CloseBracketToken */:\n                            case 19 /* CloseParenToken */:\n                                return indentation + getEffectiveDelta(delta, container);\n                        }\n                        return tokenIndentation !== -1 /* Unknown */ ? tokenIndentation : indentation;\n                    },\n                    getIndentationForToken: function (line, kind, container) {\n                        if (nodeStartLine !== line && node.decorators) {\n                            if (kind === getFirstNonDecoratorTokenOfNode(node)) {\n                                // if this token is the first token following the list of decorators, we do not need to indent\n                                return indentation;\n                            }\n                        }\n                        switch (kind) {\n                            // open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent\n                            case 16 /* OpenBraceToken */:\n                            case 17 /* CloseBraceToken */:\n                            case 20 /* OpenBracketToken */:\n                            case 21 /* CloseBracketToken */:\n                            case 18 /* OpenParenToken */:\n                            case 19 /* CloseParenToken */:\n                            case 81 /* ElseKeyword */:\n                            case 105 /* WhileKeyword */:\n                            case 56 /* AtToken */:\n                                return indentation;\n                            default:\n                                // if token line equals to the line of containing node (this is a first token in the node) - use node indentation\n                                return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation;\n                        }\n                    },\n                    getIndentation: function () { return indentation; },\n                    getDelta: function (child) { return getEffectiveDelta(delta, child); },\n                    recomputeIndentation: function (lineAdded) {\n                        if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent, node)) {\n                            if (lineAdded) {\n                                indentation += options.indentSize;\n                            }\n                            else {\n                                indentation -= options.indentSize;\n                            }\n                            if (formatting.SmartIndenter.shouldIndentChildNode(node)) {\n                                delta = options.indentSize;\n                            }\n                            else {\n                                delta = 0;\n                            }\n                        }\n                    }\n                };\n                function getEffectiveDelta(delta, child) {\n                    // Delta value should be zero when the node explicitly prevents indentation of the child node\n                    return formatting.SmartIndenter.nodeWillIndentChild(node, child, true) ? delta : 0;\n                }\n            }\n            function processNode(node, contextNode, nodeStartLine, undecoratedNodeStartLine, indentation, delta) {\n                if (!ts.rangeOverlapsWithStartEnd(originalRange, node.getStart(sourceFile), node.getEnd())) {\n                    return;\n                }\n                var nodeDynamicIndentation = getDynamicIndentation(node, nodeStartLine, indentation, delta);\n                // a useful observations when tracking context node\n                //        /\n                //      [a]\n                //   /   |   \\\n                //  [b] [c] [d]\n                // node 'a' is a context node for nodes 'b', 'c', 'd'\n                // except for the leftmost leaf token in [b] - in this case context node ('e') is located somewhere above 'a'\n                // this rule can be applied recursively to child nodes of 'a'.\n                //\n                // context node is set to parent node value after processing every child node\n                // context node is set to parent of the token after processing every token\n                var childContextNode = contextNode;\n                // if there are any tokens that logically belong to node and interleave child nodes\n                // such tokens will be consumed in processChildNode for for the child that follows them\n                ts.forEachChild(node, function (child) {\n                    processChildNode(child, /*inheritedIndentation*/ -1 /* Unknown */, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, /*isListItem*/ false);\n                }, function (nodes) {\n                    processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation);\n                });\n                // proceed any tokens in the node that are located after child nodes\n                while (formattingScanner.isOnToken()) {\n                    var tokenInfo = formattingScanner.readTokenInfo(node);\n                    if (tokenInfo.token.end > node.end) {\n                        break;\n                    }\n                    consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation);\n                }\n                function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {\n                    var childStartPos = child.getStart(sourceFile);\n                    var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line;\n                    var undecoratedChildStartLine = childStartLine;\n                    if (child.decorators) {\n                        undecoratedChildStartLine = sourceFile.getLineAndCharacterOfPosition(ts.getNonDecoratorTokenPosOfNode(child, sourceFile)).line;\n                    }\n                    // if child is a list item - try to get its indentation\n                    var childIndentationAmount = -1 /* Unknown */;\n                    if (isListItem) {\n                        childIndentationAmount = tryComputeIndentationForListItem(childStartPos, child.end, parentStartLine, originalRange, inheritedIndentation);\n                        if (childIndentationAmount !== -1 /* Unknown */) {\n                            inheritedIndentation = childIndentationAmount;\n                        }\n                    }\n                    // child node is outside the target range - do not dive inside\n                    if (!ts.rangeOverlapsWithStartEnd(originalRange, child.pos, child.end)) {\n                        if (child.end < originalRange.pos) {\n                            formattingScanner.skipToEndOf(child);\n                        }\n                        return inheritedIndentation;\n                    }\n                    if (child.getFullWidth() === 0) {\n                        return inheritedIndentation;\n                    }\n                    while (formattingScanner.isOnToken()) {\n                        // proceed any parent tokens that are located prior to child.getStart()\n                        var tokenInfo = formattingScanner.readTokenInfo(node);\n                        if (tokenInfo.token.end > childStartPos) {\n                            // stop when formatting scanner advances past the beginning of the child\n                            break;\n                        }\n                        consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation);\n                    }\n                    if (!formattingScanner.isOnToken()) {\n                        return inheritedIndentation;\n                    }\n                    // JSX text shouldn't affect indenting\n                    if (ts.isToken(child) && child.kind !== 10 /* JsxText */) {\n                        // if child node is a token, it does not impact indentation, proceed it using parent indentation scope rules\n                        var tokenInfo = formattingScanner.readTokenInfo(child);\n                        ts.Debug.assert(tokenInfo.token.end === child.end, \"Token end is child end\");\n                        consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child);\n                        return inheritedIndentation;\n                    }\n                    var effectiveParentStartLine = child.kind === 145 /* Decorator */ ? childStartLine : undecoratedParentStartLine;\n                    var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine);\n                    processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta);\n                    childContextNode = node;\n                    if (isFirstListItem && parent.kind === 175 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) {\n                        inheritedIndentation = childIndentation.indentation;\n                    }\n                    return inheritedIndentation;\n                }\n                function processChildNodes(nodes, parent, parentStartLine, parentDynamicIndentation) {\n                    var listStartToken = getOpenTokenForList(parent, nodes);\n                    var listEndToken = getCloseTokenForOpenToken(listStartToken);\n                    var listDynamicIndentation = parentDynamicIndentation;\n                    var startLine = parentStartLine;\n                    if (listStartToken !== 0 /* Unknown */) {\n                        // introduce a new indentation scope for lists (including list start and end tokens)\n                        while (formattingScanner.isOnToken()) {\n                            var tokenInfo = formattingScanner.readTokenInfo(parent);\n                            if (tokenInfo.token.end > nodes.pos) {\n                                // stop when formatting scanner moves past the beginning of node list\n                                break;\n                            }\n                            else if (tokenInfo.token.kind === listStartToken) {\n                                // consume list start token\n                                startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line;\n                                var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1 /* Unknown */, parent, parentDynamicIndentation, parentStartLine);\n                                listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_1.indentation, indentation_1.delta);\n                                consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation);\n                            }\n                            else {\n                                // consume any tokens that precede the list as child elements of 'node' using its indentation scope\n                                consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation);\n                            }\n                        }\n                    }\n                    var inheritedIndentation = -1 /* Unknown */;\n                    for (var i = 0; i < nodes.length; i++) {\n                        var child = nodes[i];\n                        inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListItem*/ true, /*isFirstListItem*/ i === 0);\n                    }\n                    if (listEndToken !== 0 /* Unknown */) {\n                        if (formattingScanner.isOnToken()) {\n                            var tokenInfo = formattingScanner.readTokenInfo(parent);\n                            // consume the list end token only if it is still belong to the parent\n                            // there might be the case when current token matches end token but does not considered as one\n                            // function (x: function) <--\n                            // without this check close paren will be interpreted as list end token for function expression which is wrong\n                            if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) {\n                                // consume list end token\n                                consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation);\n                            }\n                        }\n                    }\n                }\n                function consumeTokenAndAdvanceScanner(currentTokenInfo, parent, dynamicIndentation, container) {\n                    ts.Debug.assert(ts.rangeContainsRange(parent, currentTokenInfo.token));\n                    var lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine();\n                    var indentToken = false;\n                    if (currentTokenInfo.leadingTrivia) {\n                        processTrivia(currentTokenInfo.leadingTrivia, parent, childContextNode, dynamicIndentation);\n                    }\n                    var lineAdded;\n                    var isTokenInRange = ts.rangeContainsRange(originalRange, currentTokenInfo.token);\n                    var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos);\n                    if (isTokenInRange) {\n                        var rangeHasError = rangeContainsError(currentTokenInfo.token);\n                        // save previousRange since processRange will overwrite this value with current one\n                        var savePreviousRange = previousRange;\n                        lineAdded = processRange(currentTokenInfo.token, tokenStart, parent, childContextNode, dynamicIndentation);\n                        if (rangeHasError) {\n                            // do not indent comments\\token if token range overlaps with some error\n                            indentToken = false;\n                        }\n                        else {\n                            if (lineAdded !== undefined) {\n                                indentToken = lineAdded;\n                            }\n                            else {\n                                // indent token only if end line of previous range does not match start line of the token\n                                var prevEndLine = savePreviousRange && sourceFile.getLineAndCharacterOfPosition(savePreviousRange.end).line;\n                                indentToken = lastTriviaWasNewLine && tokenStart.line !== prevEndLine;\n                            }\n                        }\n                    }\n                    if (currentTokenInfo.trailingTrivia) {\n                        processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation);\n                    }\n                    if (indentToken) {\n                        var tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ?\n                            dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container) :\n                            -1 /* Unknown */;\n                        var indentNextTokenOrTrivia = true;\n                        if (currentTokenInfo.leadingTrivia) {\n                            var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container);\n                            for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) {\n                                var triviaItem = _a[_i];\n                                var triviaInRange = ts.rangeContainsRange(originalRange, triviaItem);\n                                switch (triviaItem.kind) {\n                                    case 3 /* MultiLineCommentTrivia */:\n                                        if (triviaInRange) {\n                                            indentMultilineComment(triviaItem, commentIndentation, /*firstLineIsIndented*/ !indentNextTokenOrTrivia);\n                                        }\n                                        indentNextTokenOrTrivia = false;\n                                        break;\n                                    case 2 /* SingleLineCommentTrivia */:\n                                        if (indentNextTokenOrTrivia && triviaInRange) {\n                                            insertIndentation(triviaItem.pos, commentIndentation, /*lineAdded*/ false);\n                                        }\n                                        indentNextTokenOrTrivia = false;\n                                        break;\n                                    case 4 /* NewLineTrivia */:\n                                        indentNextTokenOrTrivia = true;\n                                        break;\n                                }\n                            }\n                        }\n                        // indent token only if is it is in target range and does not overlap with any error ranges\n                        if (tokenIndentation !== -1 /* Unknown */ && indentNextTokenOrTrivia) {\n                            insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded);\n                            lastIndentedLine = tokenStart.line;\n                            indentationOnLastIndentedLine = tokenIndentation;\n                        }\n                    }\n                    formattingScanner.advance();\n                    childContextNode = parent;\n                }\n            }\n            function processTrivia(trivia, parent, contextNode, dynamicIndentation) {\n                for (var _i = 0, trivia_1 = trivia; _i < trivia_1.length; _i++) {\n                    var triviaItem = trivia_1[_i];\n                    if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) {\n                        var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos);\n                        processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation);\n                    }\n                }\n            }\n            function processRange(range, rangeStart, parent, contextNode, dynamicIndentation) {\n                var rangeHasError = rangeContainsError(range);\n                var lineAdded;\n                if (!rangeHasError && !previousRangeHasError) {\n                    if (!previousRange) {\n                        // trim whitespaces starting from the beginning of the span up to the current line\n                        var originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos);\n                        trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line);\n                    }\n                    else {\n                        lineAdded =\n                            processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation);\n                    }\n                }\n                previousRange = range;\n                previousParent = parent;\n                previousRangeStartLine = rangeStart.line;\n                previousRangeHasError = rangeHasError;\n                return lineAdded;\n            }\n            function processPair(currentItem, currentStartLine, currentParent, previousItem, previousStartLine, previousParent, contextNode, dynamicIndentation) {\n                formattingContext.updateContext(previousItem, previousParent, currentItem, currentParent, contextNode);\n                var rule = rulesProvider.getRulesMap().GetRule(formattingContext);\n                var trimTrailingWhitespaces;\n                var lineAdded;\n                if (rule) {\n                    applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine);\n                    if (rule.Operation.Action & (2 /* Space */ | 8 /* Delete */) && currentStartLine !== previousStartLine) {\n                        lineAdded = false;\n                        // Handle the case where the next line is moved to be the end of this line.\n                        // In this case we don't indent the next line in the next pass.\n                        if (currentParent.getStart(sourceFile) === currentItem.pos) {\n                            dynamicIndentation.recomputeIndentation(/*lineAddedByFormatting*/ false);\n                        }\n                    }\n                    else if (rule.Operation.Action & 4 /* NewLine */ && currentStartLine === previousStartLine) {\n                        lineAdded = true;\n                        // Handle the case where token2 is moved to the new line.\n                        // In this case we indent token2 in the next pass but we set\n                        // sameLineIndent flag to notify the indenter that the indentation is within the line.\n                        if (currentParent.getStart(sourceFile) === currentItem.pos) {\n                            dynamicIndentation.recomputeIndentation(/*lineAddedByFormatting*/ true);\n                        }\n                    }\n                    // We need to trim trailing whitespace between the tokens if they were on different lines, and no rule was applied to put them on the same line\n                    trimTrailingWhitespaces = !(rule.Operation.Action & 8 /* Delete */) && rule.Flag !== 1 /* CanDeleteNewLines */;\n                }\n                else {\n                    trimTrailingWhitespaces = true;\n                }\n                if (currentStartLine !== previousStartLine && trimTrailingWhitespaces) {\n                    // We need to trim trailing whitespace between the tokens if they were on different lines, and no rule was applied to put them on the same line\n                    trimTrailingWhitespacesForLines(previousStartLine, currentStartLine, previousItem);\n                }\n                return lineAdded;\n            }\n            function insertIndentation(pos, indentation, lineAdded) {\n                var indentationString = getIndentationString(indentation, options);\n                if (lineAdded) {\n                    // new line is added before the token by the formatting rules\n                    // insert indentation string at the very beginning of the token\n                    recordReplace(pos, 0, indentationString);\n                }\n                else {\n                    var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos);\n                    var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile);\n                    if (indentation !== characterToColumn(startLinePosition, tokenStart.character) || indentationIsDifferent(indentationString, startLinePosition)) {\n                        recordReplace(startLinePosition, tokenStart.character, indentationString);\n                    }\n                }\n            }\n            function characterToColumn(startLinePosition, characterInLine) {\n                var column = 0;\n                for (var i = 0; i < characterInLine; i++) {\n                    if (sourceFile.text.charCodeAt(startLinePosition + i) === 9 /* tab */) {\n                        column += options.tabSize - column % options.tabSize;\n                    }\n                    else {\n                        column++;\n                    }\n                }\n                return column;\n            }\n            function indentationIsDifferent(indentationString, startLinePosition) {\n                return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length);\n            }\n            function indentMultilineComment(commentRange, indentation, firstLineIsIndented) {\n                // split comment in lines\n                var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line;\n                var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line;\n                var parts;\n                if (startLine === endLine) {\n                    if (!firstLineIsIndented) {\n                        // treat as single line comment\n                        insertIndentation(commentRange.pos, indentation, /*lineAdded*/ false);\n                    }\n                    return;\n                }\n                else {\n                    parts = [];\n                    var startPos = commentRange.pos;\n                    for (var line = startLine; line < endLine; line++) {\n                        var endOfLine = ts.getEndLinePosition(line, sourceFile);\n                        parts.push({ pos: startPos, end: endOfLine });\n                        startPos = ts.getStartPositionOfLine(line + 1, sourceFile);\n                    }\n                    parts.push({ pos: startPos, end: commentRange.end });\n                }\n                var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile);\n                var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(startLinePos, parts[0].pos, sourceFile, options);\n                if (indentation === nonWhitespaceColumnInFirstPart.column) {\n                    return;\n                }\n                var startIndex = 0;\n                if (firstLineIsIndented) {\n                    startIndex = 1;\n                    startLine++;\n                }\n                // shift all parts on the delta size\n                var delta = indentation - nonWhitespaceColumnInFirstPart.column;\n                for (var i = startIndex, len = parts.length; i < len; i++, startLine++) {\n                    var startLinePos_1 = ts.getStartPositionOfLine(startLine, sourceFile);\n                    var nonWhitespaceCharacterAndColumn = i === 0\n                        ? nonWhitespaceColumnInFirstPart\n                        : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options);\n                    var newIndentation = nonWhitespaceCharacterAndColumn.column + delta;\n                    if (newIndentation > 0) {\n                        var indentationString = getIndentationString(newIndentation, options);\n                        recordReplace(startLinePos_1, nonWhitespaceCharacterAndColumn.character, indentationString);\n                    }\n                    else {\n                        recordDelete(startLinePos_1, nonWhitespaceCharacterAndColumn.character);\n                    }\n                }\n            }\n            function trimTrailingWhitespacesForLines(line1, line2, range) {\n                for (var line = line1; line < line2; line++) {\n                    var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile);\n                    var lineEndPosition = ts.getEndLinePosition(line, sourceFile);\n                    // do not trim whitespaces in comments or template expression\n                    if (range && (ts.isComment(range.kind) || ts.isStringOrRegularExpressionOrTemplateLiteral(range.kind)) && range.pos <= lineEndPosition && range.end > lineEndPosition) {\n                        continue;\n                    }\n                    var whitespaceStart = getTrailingWhitespaceStartPosition(lineStartPosition, lineEndPosition);\n                    if (whitespaceStart !== -1) {\n                        ts.Debug.assert(whitespaceStart === lineStartPosition || !ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(whitespaceStart - 1)));\n                        recordDelete(whitespaceStart, lineEndPosition + 1 - whitespaceStart);\n                    }\n                }\n            }\n            /**\n             * @param start The position of the first character in range\n             * @param end The position of the last character in range\n             */\n            function getTrailingWhitespaceStartPosition(start, end) {\n                var pos = end;\n                while (pos >= start && ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(pos))) {\n                    pos--;\n                }\n                if (pos !== end) {\n                    return pos + 1;\n                }\n                return -1;\n            }\n            /**\n             * Trimming will be done for lines after the previous range\n             */\n            function trimTrailingWhitespacesForRemainingRange() {\n                var startPosition = previousRange ? previousRange.end : originalRange.pos;\n                var startLine = sourceFile.getLineAndCharacterOfPosition(startPosition).line;\n                var endLine = sourceFile.getLineAndCharacterOfPosition(originalRange.end).line;\n                trimTrailingWhitespacesForLines(startLine, endLine + 1, previousRange);\n            }\n            function newTextChange(start, len, newText) {\n                return { span: ts.createTextSpan(start, len), newText: newText };\n            }\n            function recordDelete(start, len) {\n                if (len) {\n                    edits.push(newTextChange(start, len, \"\"));\n                }\n            }\n            function recordReplace(start, len, newText) {\n                if (len || newText) {\n                    edits.push(newTextChange(start, len, newText));\n                }\n            }\n            function applyRuleEdits(rule, previousRange, previousStartLine, currentRange, currentStartLine) {\n                switch (rule.Operation.Action) {\n                    case 1 /* Ignore */:\n                        // no action required\n                        return;\n                    case 8 /* Delete */:\n                        if (previousRange.end !== currentRange.pos) {\n                            // delete characters starting from t1.end up to t2.pos exclusive\n                            recordDelete(previousRange.end, currentRange.pos - previousRange.end);\n                        }\n                        break;\n                    case 4 /* NewLine */:\n                        // exit early if we on different lines and rule cannot change number of newlines\n                        // if line1 and line2 are on subsequent lines then no edits are required - ok to exit\n                        // if line1 and line2 are separated with more than one newline - ok to exit since we cannot delete extra new lines\n                        if (rule.Flag !== 1 /* CanDeleteNewLines */ && previousStartLine !== currentStartLine) {\n                            return;\n                        }\n                        // edit should not be applied only if we have one line feed between elements\n                        var lineDelta = currentStartLine - previousStartLine;\n                        if (lineDelta !== 1) {\n                            recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.newLineCharacter);\n                        }\n                        break;\n                    case 2 /* Space */:\n                        // exit early if we on different lines and rule cannot change number of newlines\n                        if (rule.Flag !== 1 /* CanDeleteNewLines */ && previousStartLine !== currentStartLine) {\n                            return;\n                        }\n                        var posDelta = currentRange.pos - previousRange.end;\n                        if (posDelta !== 1 || sourceFile.text.charCodeAt(previousRange.end) !== 32 /* space */) {\n                            recordReplace(previousRange.end, currentRange.pos - previousRange.end, \" \");\n                        }\n                        break;\n                }\n            }\n        }\n        function getOpenTokenForList(node, list) {\n            switch (node.kind) {\n                case 150 /* Constructor */:\n                case 225 /* FunctionDeclaration */:\n                case 184 /* FunctionExpression */:\n                case 149 /* MethodDeclaration */:\n                case 148 /* MethodSignature */:\n                case 185 /* ArrowFunction */:\n                    if (node.typeParameters === list) {\n                        return 26 /* LessThanToken */;\n                    }\n                    else if (node.parameters === list) {\n                        return 18 /* OpenParenToken */;\n                    }\n                    break;\n                case 179 /* CallExpression */:\n                case 180 /* NewExpression */:\n                    if (node.typeArguments === list) {\n                        return 26 /* LessThanToken */;\n                    }\n                    else if (node.arguments === list) {\n                        return 18 /* OpenParenToken */;\n                    }\n                    break;\n                case 157 /* TypeReference */:\n                    if (node.typeArguments === list) {\n                        return 26 /* LessThanToken */;\n                    }\n            }\n            return 0 /* Unknown */;\n        }\n        function getCloseTokenForOpenToken(kind) {\n            switch (kind) {\n                case 18 /* OpenParenToken */:\n                    return 19 /* CloseParenToken */;\n                case 26 /* LessThanToken */:\n                    return 28 /* GreaterThanToken */;\n            }\n            return 0 /* Unknown */;\n        }\n        var internedSizes;\n        var internedTabsIndentation;\n        var internedSpacesIndentation;\n        function getIndentationString(indentation, options) {\n            // reset interned strings if FormatCodeOptions were changed\n            var resetInternedStrings = !internedSizes || (internedSizes.tabSize !== options.tabSize || internedSizes.indentSize !== options.indentSize);\n            if (resetInternedStrings) {\n                internedSizes = { tabSize: options.tabSize, indentSize: options.indentSize };\n                internedTabsIndentation = internedSpacesIndentation = undefined;\n            }\n            if (!options.convertTabsToSpaces) {\n                var tabs = Math.floor(indentation / options.tabSize);\n                var spaces = indentation - tabs * options.tabSize;\n                var tabString = void 0;\n                if (!internedTabsIndentation) {\n                    internedTabsIndentation = [];\n                }\n                if (internedTabsIndentation[tabs] === undefined) {\n                    internedTabsIndentation[tabs] = tabString = repeat(\"\\t\", tabs);\n                }\n                else {\n                    tabString = internedTabsIndentation[tabs];\n                }\n                return spaces ? tabString + repeat(\" \", spaces) : tabString;\n            }\n            else {\n                var spacesString = void 0;\n                var quotient = Math.floor(indentation / options.indentSize);\n                var remainder = indentation % options.indentSize;\n                if (!internedSpacesIndentation) {\n                    internedSpacesIndentation = [];\n                }\n                if (internedSpacesIndentation[quotient] === undefined) {\n                    spacesString = repeat(\" \", options.indentSize * quotient);\n                    internedSpacesIndentation[quotient] = spacesString;\n                }\n                else {\n                    spacesString = internedSpacesIndentation[quotient];\n                }\n                return remainder ? spacesString + repeat(\" \", remainder) : spacesString;\n            }\n            function repeat(value, count) {\n                var s = \"\";\n                for (var i = 0; i < count; i++) {\n                    s += value;\n                }\n                return s;\n            }\n        }\n        formatting.getIndentationString = getIndentationString;\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\n///<reference path='..\\services.ts' />\n/* @internal */\nvar ts;\n(function (ts) {\n    var formatting;\n    (function (formatting) {\n        var SmartIndenter;\n        (function (SmartIndenter) {\n            var Value;\n            (function (Value) {\n                Value[Value[\"Unknown\"] = -1] = \"Unknown\";\n            })(Value || (Value = {}));\n            function getIndentation(position, sourceFile, options) {\n                if (position > sourceFile.text.length) {\n                    return getBaseIndentation(options); // past EOF\n                }\n                // no indentation when the indent style is set to none,\n                // so we can return fast\n                if (options.indentStyle === ts.IndentStyle.None) {\n                    return 0;\n                }\n                var precedingToken = ts.findPrecedingToken(position, sourceFile);\n                if (!precedingToken) {\n                    return getBaseIndentation(options);\n                }\n                // no indentation in string \\regex\\template literals\n                var precedingTokenIsLiteral = ts.isStringOrRegularExpressionOrTemplateLiteral(precedingToken.kind);\n                if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) {\n                    return 0;\n                }\n                var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line;\n                // indentation is first non-whitespace character in a previous line\n                // for block indentation, we should look for a line which contains something that's not\n                // whitespace.\n                if (options.indentStyle === ts.IndentStyle.Block) {\n                    // move backwards until we find a line with a non-whitespace character,\n                    // then find the first non-whitespace character for that line.\n                    var current_1 = position;\n                    while (current_1 > 0) {\n                        var char = sourceFile.text.charCodeAt(current_1);\n                        if (!ts.isWhiteSpace(char)) {\n                            break;\n                        }\n                        current_1--;\n                    }\n                    var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile);\n                    return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options);\n                }\n                if (precedingToken.kind === 25 /* CommaToken */ && precedingToken.parent.kind !== 192 /* BinaryExpression */) {\n                    // previous token is comma that separates items in list - find the previous item and try to derive indentation from it\n                    var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options);\n                    if (actualIndentation !== -1 /* Unknown */) {\n                        return actualIndentation;\n                    }\n                }\n                // try to find node that can contribute to indentation and includes 'position' starting from 'precedingToken'\n                // if such node is found - compute initial indentation for 'position' inside this node\n                var previous;\n                var current = precedingToken;\n                var currentStart;\n                var indentationDelta;\n                while (current) {\n                    if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous)) {\n                        currentStart = getStartLineAndCharacterForNode(current, sourceFile);\n                        if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) {\n                            indentationDelta = 0;\n                        }\n                        else {\n                            indentationDelta = lineAtPosition !== currentStart.line ? options.indentSize : 0;\n                        }\n                        break;\n                    }\n                    // check if current node is a list item - if yes, take indentation from it\n                    var actualIndentation = getActualIndentationForListItem(current, sourceFile, options);\n                    if (actualIndentation !== -1 /* Unknown */) {\n                        return actualIndentation;\n                    }\n                    actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options);\n                    if (actualIndentation !== -1 /* Unknown */) {\n                        return actualIndentation + options.indentSize;\n                    }\n                    previous = current;\n                    current = current.parent;\n                }\n                if (!current) {\n                    // no parent was found - return the base indentation of the SourceFile\n                    return getBaseIndentation(options);\n                }\n                return getIndentationForNodeWorker(current, currentStart, /*ignoreActualIndentationRange*/ undefined, indentationDelta, sourceFile, options);\n            }\n            SmartIndenter.getIndentation = getIndentation;\n            function getIndentationForNode(n, ignoreActualIndentationRange, sourceFile, options) {\n                var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile));\n                return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, /*indentationDelta*/ 0, sourceFile, options);\n            }\n            SmartIndenter.getIndentationForNode = getIndentationForNode;\n            function getBaseIndentation(options) {\n                return options.baseIndentSize || 0;\n            }\n            SmartIndenter.getBaseIndentation = getBaseIndentation;\n            function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) {\n                var parent = current.parent;\n                var parentStart;\n                // walk upwards and collect indentations for pairs of parent-child nodes\n                // indentation is not added if parent and child nodes start on the same line or if parent is IfStatement and child starts on the same line with 'else clause'\n                while (parent) {\n                    var useActualIndentation = true;\n                    if (ignoreActualIndentationRange) {\n                        var start = current.getStart(sourceFile);\n                        useActualIndentation = start < ignoreActualIndentationRange.pos || start > ignoreActualIndentationRange.end;\n                    }\n                    if (useActualIndentation) {\n                        // check if current node is a list item - if yes, take indentation from it\n                        var actualIndentation = getActualIndentationForListItem(current, sourceFile, options);\n                        if (actualIndentation !== -1 /* Unknown */) {\n                            return actualIndentation + indentationDelta;\n                        }\n                    }\n                    parentStart = getParentStart(parent, current, sourceFile);\n                    var parentAndChildShareLine = parentStart.line === currentStart.line ||\n                        childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile);\n                    if (useActualIndentation) {\n                        // try to fetch actual indentation for current node from source text\n                        var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options);\n                        if (actualIndentation !== -1 /* Unknown */) {\n                            return actualIndentation + indentationDelta;\n                        }\n                        actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options);\n                        if (actualIndentation !== -1 /* Unknown */) {\n                            return actualIndentation + indentationDelta;\n                        }\n                    }\n                    // increase indentation if parent node wants its content to be indented and parent and child nodes don't start on the same line\n                    if (shouldIndentChildNode(parent, current) && !parentAndChildShareLine) {\n                        indentationDelta += options.indentSize;\n                    }\n                    current = parent;\n                    currentStart = parentStart;\n                    parent = current.parent;\n                }\n                return indentationDelta + getBaseIndentation(options);\n            }\n            function getParentStart(parent, child, sourceFile) {\n                var containingList = getContainingList(child, sourceFile);\n                if (containingList) {\n                    return sourceFile.getLineAndCharacterOfPosition(containingList.pos);\n                }\n                return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile));\n            }\n            /*\n             * Function returns Value.Unknown if indentation cannot be determined\n             */\n            function getActualIndentationForListItemBeforeComma(commaToken, sourceFile, options) {\n                // previous token is comma that separates items in list - find the previous item and try to derive indentation from it\n                var commaItemInfo = ts.findListItemInfo(commaToken);\n                if (commaItemInfo && commaItemInfo.listItemIndex > 0) {\n                    return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options);\n                }\n                else {\n                    // handle broken code gracefully\n                    return -1 /* Unknown */;\n                }\n            }\n            /*\n             * Function returns Value.Unknown if actual indentation for node should not be used (i.e because node is nested expression)\n             */\n            function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) {\n                // actual indentation is used for statements\\declarations if one of cases below is true:\n                // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually\n                // - parent and child are not on the same line\n                var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) &&\n                    (parent.kind === 261 /* SourceFile */ || !parentAndChildShareLine);\n                if (!useActualIndentation) {\n                    return -1 /* Unknown */;\n                }\n                return findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options);\n            }\n            function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile) {\n                var nextToken = ts.findNextToken(precedingToken, current);\n                if (!nextToken) {\n                    return false;\n                }\n                if (nextToken.kind === 16 /* OpenBraceToken */) {\n                    // open braces are always indented at the parent level\n                    return true;\n                }\n                else if (nextToken.kind === 17 /* CloseBraceToken */) {\n                    // close braces are indented at the parent level if they are located on the same line with cursor\n                    // this means that if new line will be added at $ position, this case will be indented\n                    // class A {\n                    //    $\n                    // }\n                    /// and this one - not\n                    // class A {\n                    // $}\n                    var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line;\n                    return lineAtPosition === nextTokenStartLine;\n                }\n                return false;\n            }\n            function getStartLineAndCharacterForNode(n, sourceFile) {\n                return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile));\n            }\n            function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) {\n                if (parent.kind === 208 /* IfStatement */ && parent.elseStatement === child) {\n                    var elseKeyword = ts.findChildOfKind(parent, 81 /* ElseKeyword */, sourceFile);\n                    ts.Debug.assert(elseKeyword !== undefined);\n                    var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line;\n                    return elseKeywordStartLine === childStartLine;\n                }\n                return false;\n            }\n            SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement = childStartsOnTheSameLineWithElseInIfStatement;\n            function getContainingList(node, sourceFile) {\n                if (node.parent) {\n                    switch (node.parent.kind) {\n                        case 157 /* TypeReference */:\n                            if (node.parent.typeArguments &&\n                                ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) {\n                                return node.parent.typeArguments;\n                            }\n                            break;\n                        case 176 /* ObjectLiteralExpression */:\n                            return node.parent.properties;\n                        case 175 /* ArrayLiteralExpression */:\n                            return node.parent.elements;\n                        case 225 /* FunctionDeclaration */:\n                        case 184 /* FunctionExpression */:\n                        case 185 /* ArrowFunction */:\n                        case 149 /* MethodDeclaration */:\n                        case 148 /* MethodSignature */:\n                        case 153 /* CallSignature */:\n                        case 154 /* ConstructSignature */: {\n                            var start = node.getStart(sourceFile);\n                            if (node.parent.typeParameters &&\n                                ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) {\n                                return node.parent.typeParameters;\n                            }\n                            if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) {\n                                return node.parent.parameters;\n                            }\n                            break;\n                        }\n                        case 180 /* NewExpression */:\n                        case 179 /* CallExpression */: {\n                            var start = node.getStart(sourceFile);\n                            if (node.parent.typeArguments &&\n                                ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) {\n                                return node.parent.typeArguments;\n                            }\n                            if (node.parent.arguments &&\n                                ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) {\n                                return node.parent.arguments;\n                            }\n                            break;\n                        }\n                    }\n                }\n                return undefined;\n            }\n            function getActualIndentationForListItem(node, sourceFile, options) {\n                var containingList = getContainingList(node, sourceFile);\n                return containingList ? getActualIndentationFromList(containingList) : -1 /* Unknown */;\n                function getActualIndentationFromList(list) {\n                    var index = ts.indexOf(list, node);\n                    return index !== -1 ? deriveActualIndentationFromList(list, index, sourceFile, options) : -1 /* Unknown */;\n                }\n            }\n            function getLineIndentationWhenExpressionIsInMultiLine(node, sourceFile, options) {\n                // actual indentation should not be used when:\n                // - node is close parenthesis - this is the end of the expression\n                if (node.kind === 19 /* CloseParenToken */) {\n                    return -1 /* Unknown */;\n                }\n                if (node.parent && (node.parent.kind === 179 /* CallExpression */ ||\n                    node.parent.kind === 180 /* NewExpression */) &&\n                    node.parent.expression !== node) {\n                    var fullCallOrNewExpression = node.parent.expression;\n                    var startingExpression = getStartingExpression(fullCallOrNewExpression);\n                    if (fullCallOrNewExpression === startingExpression) {\n                        return -1 /* Unknown */;\n                    }\n                    var fullCallOrNewExpressionEnd = sourceFile.getLineAndCharacterOfPosition(fullCallOrNewExpression.end);\n                    var startingExpressionEnd = sourceFile.getLineAndCharacterOfPosition(startingExpression.end);\n                    if (fullCallOrNewExpressionEnd.line === startingExpressionEnd.line) {\n                        return -1 /* Unknown */;\n                    }\n                    return findColumnForFirstNonWhitespaceCharacterInLine(fullCallOrNewExpressionEnd, sourceFile, options);\n                }\n                return -1 /* Unknown */;\n                function getStartingExpression(node) {\n                    while (true) {\n                        switch (node.kind) {\n                            case 179 /* CallExpression */:\n                            case 180 /* NewExpression */:\n                            case 177 /* PropertyAccessExpression */:\n                            case 178 /* ElementAccessExpression */:\n                                node = node.expression;\n                                break;\n                            default:\n                                return node;\n                        }\n                    }\n                }\n            }\n            function deriveActualIndentationFromList(list, index, sourceFile, options) {\n                ts.Debug.assert(index >= 0 && index < list.length);\n                var node = list[index];\n                // walk toward the start of the list starting from current node and check if the line is the same for all items.\n                // if end line for item [i - 1] differs from the start line for item [i] - find column of the first non-whitespace character on the line of item [i]\n                var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile);\n                for (var i = index - 1; i >= 0; i--) {\n                    if (list[i].kind === 25 /* CommaToken */) {\n                        continue;\n                    }\n                    // skip list items that ends on the same line with the current list element\n                    var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line;\n                    if (prevEndLine !== lineAndCharacter.line) {\n                        return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options);\n                    }\n                    lineAndCharacter = getStartLineAndCharacterForNode(list[i], sourceFile);\n                }\n                return -1 /* Unknown */;\n            }\n            function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options) {\n                var lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0);\n                return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options);\n            }\n            /*\n                Character is the actual index of the character since the beginning of the line.\n                Column - position of the character after expanding tabs to spaces\n                \"0\\t2$\"\n                value of 'character' for '$' is 3\n                value of 'column' for '$' is 6 (assuming that tab size is 4)\n            */\n            function findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options) {\n                var character = 0;\n                var column = 0;\n                for (var pos = startPos; pos < endPos; pos++) {\n                    var ch = sourceFile.text.charCodeAt(pos);\n                    if (!ts.isWhiteSpaceSingleLine(ch)) {\n                        break;\n                    }\n                    if (ch === 9 /* tab */) {\n                        column += options.tabSize + (column % options.tabSize);\n                    }\n                    else {\n                        column++;\n                    }\n                    character++;\n                }\n                return { column: column, character: character };\n            }\n            SmartIndenter.findFirstNonWhitespaceCharacterAndColumn = findFirstNonWhitespaceCharacterAndColumn;\n            function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) {\n                return findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options).column;\n            }\n            SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn;\n            function nodeContentIsAlwaysIndented(kind) {\n                switch (kind) {\n                    case 207 /* ExpressionStatement */:\n                    case 226 /* ClassDeclaration */:\n                    case 197 /* ClassExpression */:\n                    case 227 /* InterfaceDeclaration */:\n                    case 229 /* EnumDeclaration */:\n                    case 228 /* TypeAliasDeclaration */:\n                    case 175 /* ArrayLiteralExpression */:\n                    case 204 /* Block */:\n                    case 231 /* ModuleBlock */:\n                    case 176 /* ObjectLiteralExpression */:\n                    case 161 /* TypeLiteral */:\n                    case 163 /* TupleType */:\n                    case 232 /* CaseBlock */:\n                    case 254 /* DefaultClause */:\n                    case 253 /* CaseClause */:\n                    case 183 /* ParenthesizedExpression */:\n                    case 177 /* PropertyAccessExpression */:\n                    case 179 /* CallExpression */:\n                    case 180 /* NewExpression */:\n                    case 205 /* VariableStatement */:\n                    case 223 /* VariableDeclaration */:\n                    case 240 /* ExportAssignment */:\n                    case 216 /* ReturnStatement */:\n                    case 193 /* ConditionalExpression */:\n                    case 173 /* ArrayBindingPattern */:\n                    case 172 /* ObjectBindingPattern */:\n                    case 248 /* JsxOpeningElement */:\n                    case 247 /* JsxSelfClosingElement */:\n                    case 252 /* JsxExpression */:\n                    case 148 /* MethodSignature */:\n                    case 153 /* CallSignature */:\n                    case 154 /* ConstructSignature */:\n                    case 144 /* Parameter */:\n                    case 158 /* FunctionType */:\n                    case 159 /* ConstructorType */:\n                    case 166 /* ParenthesizedType */:\n                    case 181 /* TaggedTemplateExpression */:\n                    case 189 /* AwaitExpression */:\n                    case 242 /* NamedExports */:\n                    case 238 /* NamedImports */:\n                    case 243 /* ExportSpecifier */:\n                    case 239 /* ImportSpecifier */:\n                        return true;\n                }\n                return false;\n            }\n            /* @internal */\n            function nodeWillIndentChild(parent, child, indentByDefault) {\n                var childKind = child ? child.kind : 0 /* Unknown */;\n                switch (parent.kind) {\n                    case 209 /* DoStatement */:\n                    case 210 /* WhileStatement */:\n                    case 212 /* ForInStatement */:\n                    case 213 /* ForOfStatement */:\n                    case 211 /* ForStatement */:\n                    case 208 /* IfStatement */:\n                    case 225 /* FunctionDeclaration */:\n                    case 184 /* FunctionExpression */:\n                    case 149 /* MethodDeclaration */:\n                    case 185 /* ArrowFunction */:\n                    case 150 /* Constructor */:\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                        return childKind !== 204 /* Block */;\n                    case 241 /* ExportDeclaration */:\n                        return childKind !== 242 /* NamedExports */;\n                    case 235 /* ImportDeclaration */:\n                        return childKind !== 236 /* ImportClause */ ||\n                            (child.namedBindings && child.namedBindings.kind !== 238 /* NamedImports */);\n                    case 246 /* JsxElement */:\n                        return childKind !== 249 /* JsxClosingElement */;\n                }\n                // No explicit rule for given nodes so the result will follow the default value argument\n                return indentByDefault;\n            }\n            SmartIndenter.nodeWillIndentChild = nodeWillIndentChild;\n            /*\n            Function returns true when the parent node should indent the given child by an explicit rule\n            */\n            function shouldIndentChildNode(parent, child) {\n                return nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(parent, child, /*indentByDefault*/ false);\n            }\n            SmartIndenter.shouldIndentChildNode = shouldIndentChildNode;\n        })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {}));\n    })(formatting = ts.formatting || (ts.formatting = {}));\n})(ts || (ts = {}));\n/* @internal */\nvar ts;\n(function (ts) {\n    var codefix;\n    (function (codefix) {\n        var codeFixes = ts.createMap();\n        function registerCodeFix(action) {\n            ts.forEach(action.errorCodes, function (error) {\n                var fixes = codeFixes[error];\n                if (!fixes) {\n                    fixes = [];\n                    codeFixes[error] = fixes;\n                }\n                fixes.push(action);\n            });\n        }\n        codefix.registerCodeFix = registerCodeFix;\n        function getSupportedErrorCodes() {\n            return Object.keys(codeFixes);\n        }\n        codefix.getSupportedErrorCodes = getSupportedErrorCodes;\n        function getFixes(context) {\n            var fixes = codeFixes[context.errorCode];\n            var allActions = [];\n            ts.forEach(fixes, function (f) {\n                var actions = f.getCodeActions(context);\n                if (actions && actions.length > 0) {\n                    allActions = allActions.concat(actions);\n                }\n            });\n            return allActions;\n        }\n        codefix.getFixes = getFixes;\n    })(codefix = ts.codefix || (ts.codefix = {}));\n})(ts || (ts = {}));\n/* @internal */\nvar ts;\n(function (ts) {\n    var codefix;\n    (function (codefix) {\n        function getOpenBraceEnd(constructor, sourceFile) {\n            // First token is the open curly, this is where we want to put the 'super' call.\n            return constructor.body.getFirstToken(sourceFile).getEnd();\n        }\n        codefix.registerCodeFix({\n            errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code],\n            getCodeActions: function (context) {\n                var sourceFile = context.sourceFile;\n                var token = ts.getTokenAtPosition(sourceFile, context.span.start);\n                if (token.kind !== 122 /* ConstructorKeyword */) {\n                    return undefined;\n                }\n                var newPosition = getOpenBraceEnd(token.parent, sourceFile);\n                return [{\n                        description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call),\n                        changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: \"super();\", span: { start: newPosition, length: 0 } }] }]\n                    }];\n            }\n        });\n        codefix.registerCodeFix({\n            errorCodes: [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code],\n            getCodeActions: function (context) {\n                var sourceFile = context.sourceFile;\n                var token = ts.getTokenAtPosition(sourceFile, context.span.start);\n                if (token.kind !== 98 /* ThisKeyword */) {\n                    return undefined;\n                }\n                var constructor = ts.getContainingFunction(token);\n                var superCall = findSuperCall(constructor.body);\n                if (!superCall) {\n                    return undefined;\n                }\n                // figure out if the this access is actuall inside the supercall\n                // i.e. super(this.a), since in that case we won't suggest a fix\n                if (superCall.expression && superCall.expression.kind == 179 /* CallExpression */) {\n                    var arguments_1 = superCall.expression.arguments;\n                    for (var i = 0; i < arguments_1.length; i++) {\n                        if (arguments_1[i].expression === token) {\n                            return undefined;\n                        }\n                    }\n                }\n                var newPosition = getOpenBraceEnd(constructor, sourceFile);\n                var changes = [{\n                        fileName: sourceFile.fileName, textChanges: [{\n                                newText: superCall.getText(sourceFile),\n                                span: { start: newPosition, length: 0 }\n                            },\n                            {\n                                newText: \"\",\n                                span: { start: superCall.getStart(sourceFile), length: superCall.getWidth(sourceFile) }\n                            }]\n                    }];\n                return [{\n                        description: ts.getLocaleSpecificMessage(ts.Diagnostics.Make_super_call_the_first_statement_in_the_constructor),\n                        changes: changes\n                    }];\n                function findSuperCall(n) {\n                    if (n.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) {\n                        return n;\n                    }\n                    if (ts.isFunctionLike(n)) {\n                        return undefined;\n                    }\n                    return ts.forEachChild(n, findSuperCall);\n                }\n            }\n        });\n    })(codefix = ts.codefix || (ts.codefix = {}));\n})(ts || (ts = {}));\n// /* @internal */\n// namespace ts.codefix {\n//     type ImportCodeActionKind = \"CodeChange\" | \"InsertingIntoExistingImport\" | \"NewImport\";\n//     interface ImportCodeAction extends CodeAction {\n//         kind: ImportCodeActionKind,\n//         moduleSpecifier?: string\n//     }\n//     enum ModuleSpecifierComparison {\n//         Better,\n//         Equal,\n//         Worse\n//     }\n//     class ImportCodeActionMap {\n//         private symbolIdToActionMap = createMap<ImportCodeAction[]>();\n//         addAction(symbolId: number, newAction: ImportCodeAction) {\n//             if (!newAction) {\n//                 return;\n//             }\n//             if (!this.symbolIdToActionMap[symbolId]) {\n//                 this.symbolIdToActionMap[symbolId] = [newAction];\n//                 return;\n//             }\n//             if (newAction.kind === \"CodeChange\") {\n//                 this.symbolIdToActionMap[symbolId].push(newAction);\n//                 return;\n//             }\n//             const updatedNewImports: ImportCodeAction[] = [];\n//             for (const existingAction of this.symbolIdToActionMap[symbolId]) {\n//                 if (existingAction.kind === \"CodeChange\") {\n//                     // only import actions should compare\n//                     updatedNewImports.push(existingAction);\n//                     continue;\n//                 }\n//                 switch (this.compareModuleSpecifiers(existingAction.moduleSpecifier, newAction.moduleSpecifier)) {\n//                     case ModuleSpecifierComparison.Better:\n//                         // the new one is not worth considering if it is a new improt.\n//                         // However if it is instead a insertion into existing import, the user might want to use\n//                         // the module specifier even it is worse by our standards. So keep it.\n//                         if (newAction.kind === \"NewImport\") {\n//                             return;\n//                         }\n//                     case ModuleSpecifierComparison.Equal:\n//                         // the current one is safe. But it is still possible that the new one is worse\n//                         // than another existing one. For example, you may have new imports from \"./foo/bar\"\n//                         // and \"bar\", when the new one is \"bar/bar2\" and the current one is \"./foo/bar\". The new\n//                         // one and the current one are not comparable (one relative path and one absolute path),\n//                         // but the new one is worse than the other one, so should not add to the list.\n//                         updatedNewImports.push(existingAction);\n//                         break;\n//                     case ModuleSpecifierComparison.Worse:\n//                         // the existing one is worse, remove from the list.\n//                         continue;\n//                 }\n//             }\n//             // if we reach here, it means the new one is better or equal to all of the existing ones.\n//             updatedNewImports.push(newAction);\n//             this.symbolIdToActionMap[symbolId] = updatedNewImports;\n//         }\n//         addActions(symbolId: number, newActions: ImportCodeAction[]) {\n//             for (const newAction of newActions) {\n//                 this.addAction(symbolId, newAction);\n//             }\n//         }\n//         getAllActions() {\n//             let result: ImportCodeAction[] = [];\n//             for (const symbolId in this.symbolIdToActionMap) {\n//                 result = concatenate(result, this.symbolIdToActionMap[symbolId]);\n//             }\n//             return result;\n//         }\n//         private compareModuleSpecifiers(moduleSpecifier1: string, moduleSpecifier2: string): ModuleSpecifierComparison {\n//             if (moduleSpecifier1 === moduleSpecifier2) {\n//                 return ModuleSpecifierComparison.Equal;\n//             }\n//             // if moduleSpecifier1 (ms1) is a substring of ms2, then it is better\n//             if (moduleSpecifier2.indexOf(moduleSpecifier1) === 0) {\n//                 return ModuleSpecifierComparison.Better;\n//             }\n//             if (moduleSpecifier1.indexOf(moduleSpecifier2) === 0) {\n//                 return ModuleSpecifierComparison.Worse;\n//             }\n//             // if both are relative paths, and ms1 has fewer levels, then it is better\n//             if (isExternalModuleNameRelative(moduleSpecifier1) && isExternalModuleNameRelative(moduleSpecifier2)) {\n//                 const regex = new RegExp(directorySeparator, \"g\");\n//                 const moduleSpecifier1LevelCount = (moduleSpecifier1.match(regex) || []).length;\n//                 const moduleSpecifier2LevelCount = (moduleSpecifier2.match(regex) || []).length;\n//                 return moduleSpecifier1LevelCount < moduleSpecifier2LevelCount\n//                     ? ModuleSpecifierComparison.Better\n//                     : moduleSpecifier1LevelCount === moduleSpecifier2LevelCount\n//                         ? ModuleSpecifierComparison.Equal\n//                         : ModuleSpecifierComparison.Worse;\n//             }\n//             // the equal cases include when the two specifiers are not comparable.\n//             return ModuleSpecifierComparison.Equal;\n//         }\n//     }\n//     registerCodeFix({\n//         errorCodes: [Diagnostics.Cannot_find_name_0.code],\n//         getCodeActions: (context: CodeFixContext) => {\n//             const sourceFile = context.sourceFile;\n//             const checker = context.program.getTypeChecker();\n//             const allSourceFiles = context.program.getSourceFiles();\n//             const useCaseSensitiveFileNames = context.host.useCaseSensitiveFileNames ? context.host.useCaseSensitiveFileNames() : false;\n//             const token = getTokenAtPosition(sourceFile, context.span.start);\n//             const name = token.getText();\n//             const symbolIdActionMap = new ImportCodeActionMap();\n//             // this is a module id -> module import declaration map\n//             const cachedImportDeclarations = createMap<(ImportDeclaration | ImportEqualsDeclaration)[]>();\n//             let cachedNewImportInsertPosition: number;\n//             const allPotentialModules = checker.getAmbientModules();\n//             for (const otherSourceFile of allSourceFiles) {\n//                 if (otherSourceFile !== sourceFile && isExternalOrCommonJsModule(otherSourceFile)) {\n//                     allPotentialModules.push(otherSourceFile.symbol);\n//                 }\n//             }\n//             const currentTokenMeaning = getMeaningFromLocation(token);\n//             for (const moduleSymbol of allPotentialModules) {\n//                 context.cancellationToken.throwIfCancellationRequested();\n//                 // check the default export\n//                 const defaultExport = checker.tryGetMemberInModuleExports(\"default\", moduleSymbol);\n//                 if (defaultExport) {\n//                     const localSymbol = getLocalSymbolForExportDefault(defaultExport);\n//                     if (localSymbol && localSymbol.name === name && checkSymbolHasMeaning(localSymbol, currentTokenMeaning)) {\n//                         // check if this symbol is already used\n//                         const symbolId = getUniqueSymbolId(localSymbol);\n//                         symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, /*isDefault*/ true));\n//                     }\n//                 }\n//                 // check exports with the same name\n//                 const exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExports(name, moduleSymbol);\n//                 if (exportSymbolWithIdenticalName && checkSymbolHasMeaning(exportSymbolWithIdenticalName, currentTokenMeaning)) {\n//                     const symbolId = getUniqueSymbolId(exportSymbolWithIdenticalName);\n//                     symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol));\n//                 }\n//             }\n//             return symbolIdActionMap.getAllActions();\n//             function getImportDeclarations(moduleSymbol: Symbol) {\n//                 const moduleSymbolId = getUniqueSymbolId(moduleSymbol);\n//                 if (cachedImportDeclarations[moduleSymbolId]) {\n//                     return cachedImportDeclarations[moduleSymbolId];\n//                 }\n//                 const existingDeclarations: (ImportDeclaration | ImportEqualsDeclaration)[] = [];\n//                 for (const importModuleSpecifier of sourceFile.imports) {\n//                     const importSymbol = checker.getSymbolAtLocation(importModuleSpecifier);\n//                     if (importSymbol === moduleSymbol) {\n//                         existingDeclarations.push(getImportDeclaration(importModuleSpecifier));\n//                     }\n//                 }\n//                 cachedImportDeclarations[moduleSymbolId] = existingDeclarations;\n//                 return existingDeclarations;\n//                 function getImportDeclaration(moduleSpecifier: LiteralExpression) {\n//                     let node: Node = moduleSpecifier;\n//                     while (node) {\n//                         if (node.kind === SyntaxKind.ImportDeclaration) {\n//                             return <ImportDeclaration>node;\n//                         }\n//                         if (node.kind === SyntaxKind.ImportEqualsDeclaration) {\n//                             return <ImportEqualsDeclaration>node;\n//                         }\n//                         node = node.parent;\n//                     }\n//                     return undefined;\n//                 }\n//             }\n//             function getUniqueSymbolId(symbol: Symbol) {\n//                 if (symbol.flags & SymbolFlags.Alias) {\n//                     return getSymbolId(checker.getAliasedSymbol(symbol));\n//                 }\n//                 return getSymbolId(symbol);\n//             }\n//             function checkSymbolHasMeaning(symbol: Symbol, meaning: SemanticMeaning) {\n//                 const declarations = symbol.getDeclarations();\n//                 return declarations ? some(symbol.declarations, decl => !!(getMeaningFromDeclaration(decl) & meaning)) : false;\n//             }\n//             function getCodeActionForImport(moduleSymbol: Symbol, isDefault?: boolean): ImportCodeAction[] {\n//                 const existingDeclarations = getImportDeclarations(moduleSymbol);\n//                 if (existingDeclarations.length > 0) {\n//                     // With an existing import statement, there are more than one actions the user can do.\n//                     return getCodeActionsForExistingImport(existingDeclarations);\n//                 }\n//                 else {\n//                     return [getCodeActionForNewImport()];\n//                 }\n//                 function getCodeActionsForExistingImport(declarations: (ImportDeclaration | ImportEqualsDeclaration)[]): ImportCodeAction[] {\n//                     const actions: ImportCodeAction[] = [];\n//                     // It is possible that multiple import statements with the same specifier exist in the file.\n//                     // e.g.\n//                     //\n//                     //     import * as ns from \"foo\";\n//                     //     import { member1, member2 } from \"foo\";\n//                     //\n//                     //     member3/**/ <-- cusor here\n//                     //\n//                     // in this case we should provie 2 actions:\n//                     //     1. change \"member3\" to \"ns.member3\"\n//                     //     2. add \"member3\" to the second import statement's import list\n//                     // and it is up to the user to decide which one fits best.\n//                     let namespaceImportDeclaration: ImportDeclaration | ImportEqualsDeclaration;\n//                     let namedImportDeclaration: ImportDeclaration;\n//                     let existingModuleSpecifier: string;\n//                     for (const declaration of declarations) {\n//                         if (declaration.kind === SyntaxKind.ImportDeclaration) {\n//                             const namedBindings = declaration.importClause && declaration.importClause.namedBindings;\n//                             if (namedBindings && namedBindings.kind === SyntaxKind.NamespaceImport) {\n//                                 // case:\n//                                 // import * as ns from \"foo\"\n//                                 namespaceImportDeclaration = declaration;\n//                             }\n//                             else {\n//                                 // cases:\n//                                 // import default from \"foo\"\n//                                 // import { bar } from \"foo\" or combination with the first one\n//                                 // import \"foo\"\n//                                 namedImportDeclaration = declaration;\n//                             }\n//                             existingModuleSpecifier = declaration.moduleSpecifier.getText();\n//                         }\n//                         else {\n//                             // case:\n//                             // import foo = require(\"foo\")\n//                             namespaceImportDeclaration = declaration;\n//                             existingModuleSpecifier = getModuleSpecifierFromImportEqualsDeclaration(declaration);\n//                         }\n//                     }\n//                     if (namespaceImportDeclaration) {\n//                         actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration));\n//                     }\n//                     if (namedImportDeclaration && namedImportDeclaration.importClause &&\n//                         (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) {\n//                         /**\n//                          * If the existing import declaration already has a named import list, just\n//                          * insert the identifier into that list.\n//                          */\n//                         const textChange = getTextChangeForImportClause(namedImportDeclaration.importClause);\n//                         const moduleSpecifierWithoutQuotes = stripQuotes(namedImportDeclaration.moduleSpecifier.getText());\n//                         actions.push(createCodeAction(\n//                             Diagnostics.Add_0_to_existing_import_declaration_from_1,\n//                             [name, moduleSpecifierWithoutQuotes],\n//                             textChange.newText,\n//                             textChange.span,\n//                             sourceFile.fileName,\n//                             \"InsertingIntoExistingImport\",\n//                             moduleSpecifierWithoutQuotes\n//                         ));\n//                     }\n//                     else {\n//                         // we need to create a new import statement, but the existing module specifier can be reused.\n//                         actions.push(getCodeActionForNewImport(existingModuleSpecifier));\n//                     }\n//                     return actions;\n//                     function getModuleSpecifierFromImportEqualsDeclaration(declaration: ImportEqualsDeclaration) {\n//                         if (declaration.moduleReference && declaration.moduleReference.kind === SyntaxKind.ExternalModuleReference) {\n//                             return declaration.moduleReference.expression.getText();\n//                         }\n//                         return declaration.moduleReference.getText();\n//                     }\n//                     function getTextChangeForImportClause(importClause: ImportClause): TextChange {\n//                         const newImportText = isDefault ? `default as ${name}` : name;\n//                         const importList = <NamedImports>importClause.namedBindings;\n//                         // case 1:\n//                         // original text: import default from \"module\"\n//                         // change to: import default, { name } from \"module\"\n//                         if (!importList && importClause.name) {\n//                             const start = importClause.name.getEnd();\n//                             return {\n//                                 newText: `, { ${newImportText} }`,\n//                                 span: { start, length: 0 }\n//                             };\n//                         }\n//                         // case 2:\n//                         // original text: import {} from \"module\"\n//                         // change to: import { name } from \"module\"\n//                         if (importList.elements.length === 0) {\n//                             const start = importList.getStart();\n//                             return {\n//                                 newText: `{ ${newImportText} }`,\n//                                 span: { start, length: importList.getEnd() - start }\n//                             };\n//                         }\n//                         // case 3:\n//                         // original text: import { foo, bar } from \"module\"\n//                         // change to: import { foo, bar, name } from \"module\"\n//                         const insertPoint = importList.elements[importList.elements.length - 1].getEnd();\n//                         /**\n//                          * If the import list has one import per line, preserve that. Otherwise, insert on same line as last element\n//                          *     import {\n//                          *         foo\n//                          *     } from \"./module\";\n//                          */\n//                         const startLine = getLineOfLocalPosition(sourceFile, importList.getStart());\n//                         const endLine = getLineOfLocalPosition(sourceFile, importList.getEnd());\n//                         const oneImportPerLine = endLine - startLine > importList.elements.length;\n//                         return {\n//                             newText: `,${oneImportPerLine ? context.newLineCharacter : \" \"}${newImportText}`,\n//                             span: { start: insertPoint, length: 0 }\n//                         };\n//                     }\n//                     function getCodeActionForNamespaceImport(declaration: ImportDeclaration | ImportEqualsDeclaration): ImportCodeAction {\n//                         let namespacePrefix: string;\n//                         if (declaration.kind === SyntaxKind.ImportDeclaration) {\n//                             namespacePrefix = (<NamespaceImport>declaration.importClause.namedBindings).name.getText();\n//                         }\n//                         else {\n//                             namespacePrefix = declaration.name.getText();\n//                         }\n//                         namespacePrefix = stripQuotes(namespacePrefix);\n//                         /**\n//                          * Cases:\n//                          *     import * as ns from \"mod\"\n//                          *     import default, * as ns from \"mod\"\n//                          *     import ns = require(\"mod\")\n//                          *\n//                          * Because there is no import list, we alter the reference to include the\n//                          * namespace instead of altering the import declaration. For example, \"foo\" would\n//                          * become \"ns.foo\"\n//                          */\n//                         return createCodeAction(\n//                             Diagnostics.Change_0_to_1,\n//                             [name, `${namespacePrefix}.${name}`],\n//                             `${namespacePrefix}.`,\n//                             { start: token.getStart(), length: 0 },\n//                             sourceFile.fileName,\n//                             \"CodeChange\"\n//                         );\n//                     }\n//                 }\n//                 function getCodeActionForNewImport(moduleSpecifier?: string): ImportCodeAction {\n//                     if (!cachedNewImportInsertPosition) {\n//                         // insert after any existing imports\n//                         let lastModuleSpecifierEnd = -1;\n//                         for (const moduleSpecifier of sourceFile.imports) {\n//                             const end = moduleSpecifier.getEnd();\n//                             if (!lastModuleSpecifierEnd || end > lastModuleSpecifierEnd) {\n//                                 lastModuleSpecifierEnd = end;\n//                             }\n//                         }\n//                         cachedNewImportInsertPosition = lastModuleSpecifierEnd > 0 ? sourceFile.getLineEndOfPosition(lastModuleSpecifierEnd) : sourceFile.getStart();\n//                     }\n//                     const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames);\n//                     const moduleSpecifierWithoutQuotes = stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport());\n//                     const importStatementText = isDefault\n//                         ? `import ${name} from \"${moduleSpecifierWithoutQuotes}\"`\n//                         : `import { ${name} } from \"${moduleSpecifierWithoutQuotes}\"`;\n//                     // if this file doesn't have any import statements, insert an import statement and then insert a new line\n//                     // between the only import statement and user code. Otherwise just insert the statement because chances\n//                     // are there are already a new line seperating code and import statements.\n//                     const newText = cachedNewImportInsertPosition === sourceFile.getStart()\n//                         ? `${importStatementText};${context.newLineCharacter}${context.newLineCharacter}`\n//                         : `${context.newLineCharacter}${importStatementText};`;\n//                     return createCodeAction(\n//                         Diagnostics.Import_0_from_1,\n//                         [name, `\"${moduleSpecifierWithoutQuotes}\"`],\n//                         newText,\n//                         { start: cachedNewImportInsertPosition, length: 0 },\n//                         sourceFile.fileName,\n//                         \"NewImport\",\n//                         moduleSpecifierWithoutQuotes\n//                     );\n//                     function getModuleSpecifierForNewImport() {\n//                         const fileName = sourceFile.path;\n//                         const moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().path;\n//                         const sourceDirectory = getDirectoryPath(fileName);\n//                         const options = context.program.getCompilerOptions();\n//                         return tryGetModuleNameFromAmbientModule() ||\n//                             tryGetModuleNameFromBaseUrl() ||\n//                             tryGetModuleNameFromRootDirs() ||\n//                             tryGetModuleNameFromTypeRoots() ||\n//                             tryGetModuleNameAsNodeModule() ||\n//                             removeFileExtension(getRelativePath(moduleFileName, sourceDirectory));\n//                         function tryGetModuleNameFromAmbientModule(): string {\n//                             if (moduleSymbol.valueDeclaration.kind !== SyntaxKind.SourceFile) {\n//                                 return moduleSymbol.name;\n//                             }\n//                         }\n//                         function tryGetModuleNameFromBaseUrl() {\n//                             if (!options.baseUrl) {\n//                                 return undefined;\n//                             }\n//                             const normalizedBaseUrl = toPath(options.baseUrl, getDirectoryPath(options.baseUrl), getCanonicalFileName);\n//                             let relativeName = tryRemoveParentDirectoryName(moduleFileName, normalizedBaseUrl);\n//                             if (!relativeName) {\n//                                 return undefined;\n//                             }\n//                             relativeName = removeExtensionAndIndexPostFix(relativeName);\n//                             if (options.paths) {\n//                                 for (const key in options.paths) {\n//                                     for (const pattern of options.paths[key]) {\n//                                         const indexOfStar = pattern.indexOf(\"*\");\n//                                         if (indexOfStar === 0 && pattern.length === 1) {\n//                                             continue;\n//                                         }\n//                                         else if (indexOfStar !== -1) {\n//                                             const prefix = pattern.substr(0, indexOfStar);\n//                                             const suffix = pattern.substr(indexOfStar + 1);\n//                                             if (relativeName.length >= prefix.length + suffix.length &&\n//                                                 startsWith(relativeName, prefix) &&\n//                                                 endsWith(relativeName, suffix)) {\n//                                                 const matchedStar = relativeName.substr(prefix.length, relativeName.length - suffix.length);\n//                                                 return key.replace(\"\\*\", matchedStar);\n//                                             }\n//                                         }\n//                                         else if (pattern === relativeName) {\n//                                             return key;\n//                                         }\n//                                     }\n//                                 }\n//                             }\n//                             return relativeName;\n//                         }\n//                         function tryGetModuleNameFromRootDirs() {\n//                             if (options.rootDirs) {\n//                                 const normalizedRootDirs = map(options.rootDirs, rootDir => toPath(rootDir, /*basePath*/ undefined, getCanonicalFileName));\n//                                 const normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, normalizedRootDirs);\n//                                 const normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, normalizedRootDirs);\n//                                 if (normalizedTargetPath !== undefined) {\n//                                     const relativePath = normalizedSourcePath !== undefined ? getRelativePath(normalizedTargetPath, normalizedSourcePath) : normalizedTargetPath;\n//                                     return removeFileExtension(relativePath);\n//                                 }\n//                             }\n//                             return undefined;\n//                         }\n//                         function tryGetModuleNameFromTypeRoots() {\n//                             const typeRoots = getEffectiveTypeRoots(options, context.host);\n//                             if (typeRoots) {\n//                                 const normalizedTypeRoots = map(typeRoots, typeRoot => toPath(typeRoot, /*basePath*/ undefined, getCanonicalFileName));\n//                                 for (const typeRoot of normalizedTypeRoots) {\n//                                     if (startsWith(moduleFileName, typeRoot)) {\n//                                         const relativeFileName = moduleFileName.substring(typeRoot.length + 1);\n//                                         return removeExtensionAndIndexPostFix(relativeFileName);\n//                                     }\n//                                 }\n//                             }\n//                         }\n//                         function tryGetModuleNameAsNodeModule() {\n//                             if (getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeJs) {\n//                                 // nothing to do here\n//                                 return undefined;\n//                             }\n//                             const indexOfNodeModules = moduleFileName.indexOf(\"node_modules\");\n//                             if (indexOfNodeModules < 0) {\n//                                 return undefined;\n//                             }\n//                             let relativeFileName: string;\n//                             if (sourceDirectory.indexOf(moduleFileName.substring(0, indexOfNodeModules - 1)) === 0) {\n//                                 // if node_modules folder is in this folder or any of its parent folder, no need to keep it.\n//                                 relativeFileName = moduleFileName.substring(indexOfNodeModules + 13 /* \"node_modules\\\".length */);\n//                             }\n//                             else {\n//                                 relativeFileName = getRelativePath(moduleFileName, sourceDirectory);\n//                             }\n//                             relativeFileName = removeFileExtension(relativeFileName);\n//                             if (endsWith(relativeFileName, \"/index\")) {\n//                                 relativeFileName = getDirectoryPath(relativeFileName);\n//                             }\n//                             else {\n//                                 try {\n//                                     const moduleDirectory = getDirectoryPath(moduleFileName);\n//                                     const packageJsonContent = JSON.parse(context.host.readFile(combinePaths(moduleDirectory, \"package.json\")));\n//                                     if (packageJsonContent) {\n//                                         const mainFile = packageJsonContent.main || packageJsonContent.typings;\n//                                         if (mainFile) {\n//                                             const mainExportFile = toPath(mainFile, moduleDirectory, getCanonicalFileName);\n//                                             if (removeFileExtension(mainExportFile) === removeFileExtension(moduleFileName)) {\n//                                                 relativeFileName = getDirectoryPath(relativeFileName);\n//                                             }\n//                                         }\n//                                     }\n//                                 }\n//                                 catch (e) { }\n//                             }\n//                             return relativeFileName;\n//                         }\n//                     }\n//                     function getPathRelativeToRootDirs(path: Path, rootDirs: Path[]) {\n//                         for (const rootDir of rootDirs) {\n//                             const relativeName = tryRemoveParentDirectoryName(path, rootDir);\n//                             if (relativeName !== undefined) {\n//                                 return relativeName;\n//                             }\n//                         }\n//                         return undefined;\n//                     }\n//                     function removeExtensionAndIndexPostFix(fileName: string) {\n//                         fileName = removeFileExtension(fileName);\n//                         if (endsWith(fileName, \"/index\")) {\n//                             fileName = fileName.substr(0, fileName.length - 6/* \"/index\".length */);\n//                         }\n//                         return fileName;\n//                     }\n//                     function getRelativePath(path: string, directoryPath: string) {\n//                         const relativePath = getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false);\n//                         return moduleHasNonRelativeName(relativePath) ? \"./\" + relativePath : relativePath;\n//                     }\n//                     function tryRemoveParentDirectoryName(path: Path, parentDirectory: Path) {\n//                         const index = path.indexOf(parentDirectory);\n//                         if (index === 0) {\n//                             return endsWith(parentDirectory, directorySeparator)\n//                                 ? path.substring(parentDirectory.length)\n//                                 : path.substring(parentDirectory.length + 1);\n//                         }\n//                         return undefined;\n//                     }\n//                 }\n//             }\n//             function createCodeAction(\n//                 description: DiagnosticMessage,\n//                 diagnosticArgs: string[],\n//                 newText: string,\n//                 span: TextSpan,\n//                 fileName: string,\n//                 kind: ImportCodeActionKind,\n//                 moduleSpecifier?: string): ImportCodeAction {\n//                 return {\n//                     description: formatMessage.apply(undefined, [undefined, description].concat(<any[]>diagnosticArgs)),\n//                     changes: [{ fileName, textChanges: [{ newText, span }] }],\n//                     kind,\n//                     moduleSpecifier\n//                 };\n//             }\n//         }\n//     });\n// } \n// /* @internal */\n// namespace ts.codefix {\n//     registerCodeFix({\n//         errorCodes: [\n//             Diagnostics._0_is_declared_but_never_used.code,\n//             Diagnostics.Property_0_is_declared_but_never_used.code\n//         ],\n//         getCodeActions: (context: CodeFixContext) => {\n//             const sourceFile = context.sourceFile;\n//             const start = context.span.start;\n//             let token = getTokenAtPosition(sourceFile, start);\n//             // this handles var [\"computed\"] = 12;\n//             if (token.kind === SyntaxKind.OpenBracketToken) {\n//                 token = getTokenAtPosition(sourceFile, start + 1);\n//             }\n//             switch (token.kind) {\n//                 case ts.SyntaxKind.Identifier:\n//                     switch (token.parent.kind) {\n//                         case ts.SyntaxKind.VariableDeclaration:\n//                             switch (token.parent.parent.parent.kind) {\n//                                 case SyntaxKind.ForStatement:\n//                                     const forStatement = <ForStatement>token.parent.parent.parent;\n//                                     const forInitializer = <VariableDeclarationList>forStatement.initializer;\n//                                     if (forInitializer.declarations.length === 1) {\n//                                         return createCodeFix(\"\", forInitializer.pos, forInitializer.end - forInitializer.pos);\n//                                     }\n//                                     else {\n//                                         return removeSingleItem(forInitializer.declarations, token);\n//                                     }\n//                                 case SyntaxKind.ForOfStatement:\n//                                     const forOfStatement = <ForOfStatement>token.parent.parent.parent;\n//                                     if (forOfStatement.initializer.kind === SyntaxKind.VariableDeclarationList) {\n//                                         const forOfInitializer = <VariableDeclarationList>forOfStatement.initializer;\n//                                         return createCodeFix(\"{}\", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos);\n//                                     }\n//                                     break;\n//                                 case SyntaxKind.ForInStatement:\n//                                     // There is no valid fix in the case of:\n//                                     //  for .. in\n//                                     return undefined;\n//                                 case SyntaxKind.CatchClause:\n//                                     const catchClause = <CatchClause>token.parent.parent;\n//                                     const parameter = catchClause.variableDeclaration.getChildren()[0];\n//                                     return createCodeFix(\"\", parameter.pos, parameter.end - parameter.pos);\n//                                 default:\n//                                     const variableStatement = <VariableStatement>token.parent.parent.parent;\n//                                     if (variableStatement.declarationList.declarations.length === 1) {\n//                                         return createCodeFix(\"\", variableStatement.pos, variableStatement.end - variableStatement.pos);\n//                                     }\n//                                     else {\n//                                         const declarations = variableStatement.declarationList.declarations;\n//                                         return removeSingleItem(declarations, token);\n//                                     }\n//                             }\n//                         case SyntaxKind.TypeParameter:\n//                             const typeParameters = (<DeclarationWithTypeParameters>token.parent.parent).typeParameters;\n//                             if (typeParameters.length === 1) {\n//                                 return createCodeFix(\"\", token.parent.pos - 1, token.parent.end - token.parent.pos + 2);\n//                             }\n//                             else {\n//                                 return removeSingleItem(typeParameters, token);\n//                             }\n//                         case ts.SyntaxKind.Parameter:\n//                             const functionDeclaration = <FunctionDeclaration>token.parent.parent;\n//                             if (functionDeclaration.parameters.length === 1) {\n//                                 return createCodeFix(\"\", token.parent.pos, token.parent.end - token.parent.pos);\n//                             }\n//                             else {\n//                                 return removeSingleItem(functionDeclaration.parameters, token);\n//                             }\n//                         // handle case where 'import a = A;'\n//                         case SyntaxKind.ImportEqualsDeclaration:\n//                             const importEquals = findImportDeclaration(token);\n//                             return createCodeFix(\"\", importEquals.pos, importEquals.end - importEquals.pos);\n//                         case SyntaxKind.ImportSpecifier:\n//                             const namedImports = <NamedImports>token.parent.parent;\n//                             if (namedImports.elements.length === 1) {\n//                                 // Only 1 import and it is unused. So the entire declaration should be removed.\n//                                 const importSpec = findImportDeclaration(token);\n//                                 return createCodeFix(\"\", importSpec.pos, importSpec.end - importSpec.pos);\n//                             }\n//                             else {\n//                                 return removeSingleItem(namedImports.elements, token);\n//                             }\n//                         // handle case where \"import d, * as ns from './file'\"\n//                         // or \"'import {a, b as ns} from './file'\"\n//                         case SyntaxKind.ImportClause: // this covers both 'import |d|' and 'import |d,| *'\n//                             const importClause = <ImportClause>token.parent;\n//                             if (!importClause.namedBindings) { // |import d from './file'| or |import * as ns from './file'|\n//                                 const importDecl = findImportDeclaration(importClause);\n//                                 return createCodeFix(\"\", importDecl.pos, importDecl.end - importDecl.pos);\n//                             }\n//                             else { // import |d,| * as ns from './file'\n//                                 return createCodeFix(\"\", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos);\n//                             }\n//                         case SyntaxKind.NamespaceImport:\n//                             const namespaceImport = <NamespaceImport>token.parent;\n//                             if (namespaceImport.name == token && !(<ImportClause>namespaceImport.parent).name) {\n//                                 const importDecl = findImportDeclaration(namespaceImport);\n//                                 return createCodeFix(\"\", importDecl.pos, importDecl.end - importDecl.pos);\n//                             }\n//                             else {\n//                                 const start = (<ImportClause>namespaceImport.parent).name.end;\n//                                 return createCodeFix(\"\", start, (<ImportClause>namespaceImport.parent).namedBindings.end - start);\n//                             }\n//                     }\n//                     break;\n//                 case SyntaxKind.PropertyDeclaration:\n//                     return createCodeFix(\"\", token.parent.pos, token.parent.end - token.parent.pos);\n//                 case SyntaxKind.NamespaceImport:\n//                     return createCodeFix(\"\", token.parent.pos, token.parent.end - token.parent.pos);\n//             }\n//             if (isDeclarationName(token)) {\n//                 return createCodeFix(\"\", token.parent.pos, token.parent.end - token.parent.pos);\n//             }\n//             else if (isLiteralComputedPropertyDeclarationName(token)) {\n//                 return createCodeFix(\"\", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos);\n//             }\n//             else {\n//                 return undefined;\n//             }\n//             function findImportDeclaration(token: Node): Node {\n//                 let importDecl = token;\n//                 while (importDecl.kind != SyntaxKind.ImportDeclaration && importDecl.parent) {\n//                     importDecl = importDecl.parent;\n//                 }\n//                 return importDecl;\n//             }\n//             function createCodeFix(newText: string, start: number, length: number): CodeAction[] {\n//                 return [{\n//                     description: getLocaleSpecificMessage(Diagnostics.Remove_unused_identifiers),\n//                     changes: [{\n//                         fileName: sourceFile.fileName,\n//                         textChanges: [{ newText, span: { start, length } }]\n//                     }]\n//                 }];\n//             }\n//             function removeSingleItem<T extends Node>(elements: NodeArray<T>, token: T): CodeAction[] {\n//                 if (elements[0] === token.parent) {\n//                     return createCodeFix(\"\", token.parent.pos, token.parent.end - token.parent.pos + 1);\n//                 }\n//                 else {\n//                     return createCodeFix(\"\", token.parent.pos - 1, token.parent.end - token.parent.pos + 1);\n//                 }\n//             }\n//         }\n//     });\n// } \n///<reference path='superFixes.ts' />\n///<reference path='importFixes.ts' />\n///<reference path='unusedIdentifierFixes.ts' />\n/// <reference path=\"..\\compiler\\program.ts\"/>\n/// <reference path=\"..\\compiler\\commandLineParser.ts\"/>\n/// <reference path='types.ts' />\n/// <reference path='utilities.ts' />\n/// <reference path='breakpoints.ts' />\n/// <reference path='classifier.ts' />\n/// <reference path='completions.ts' />\n/// <reference path='documentHighlights.ts' />\n/// <reference path='documentRegistry.ts' />\n/// <reference path='findAllReferences.ts' />\n/// <reference path='goToDefinition.ts' />\n/// <reference path='goToImplementation.ts' />\n/// <reference path='jsDoc.ts' />\n/// <reference path='jsTyping.ts' />\n/// <reference path='navigateTo.ts' />\n/// <reference path='navigationBar.ts' />\n/// <reference path='outliningElementsCollector.ts' />\n/// <reference path='patternMatcher.ts' />\n/// <reference path='preProcess.ts' />\n/// <reference path='rename.ts' />\n/// <reference path='signatureHelp.ts' />\n/// <reference path='symbolDisplay.ts' />\n/// <reference path='transpile.ts' />\n/// <reference path='formatting\\formatting.ts' />\n/// <reference path='formatting\\smartIndenter.ts' />\n/// <reference path='codefixes\\codeFixProvider.ts' />\n/// <reference path='codefixes\\fixes.ts' />\nvar ts;\n(function (ts) {\n    /** The version of the language service API */\n    ts.servicesVersion = \"0.5\";\n    function createNode(kind, pos, end, parent) {\n        var node = kind >= 141 /* FirstNode */ ? new NodeObject(kind, pos, end) :\n            kind === 70 /* Identifier */ ? new IdentifierObject(70 /* Identifier */, pos, end) :\n                new TokenObject(kind, pos, end);\n        node.parent = parent;\n        return node;\n    }\n    var NodeObject = (function () {\n        function NodeObject(kind, pos, end) {\n            this.pos = pos;\n            this.end = end;\n            this.flags = 0 /* None */;\n            this.transformFlags = undefined;\n            this.parent = undefined;\n            this.kind = kind;\n        }\n        NodeObject.prototype.getSourceFile = function () {\n            return ts.getSourceFileOfNode(this);\n        };\n        NodeObject.prototype.getStart = function (sourceFile, includeJsDocComment) {\n            return ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment);\n        };\n        NodeObject.prototype.getFullStart = function () {\n            return this.pos;\n        };\n        NodeObject.prototype.getEnd = function () {\n            return this.end;\n        };\n        NodeObject.prototype.getWidth = function (sourceFile) {\n            return this.getEnd() - this.getStart(sourceFile);\n        };\n        NodeObject.prototype.getFullWidth = function () {\n            return this.end - this.pos;\n        };\n        NodeObject.prototype.getLeadingTriviaWidth = function (sourceFile) {\n            return this.getStart(sourceFile) - this.pos;\n        };\n        NodeObject.prototype.getFullText = function (sourceFile) {\n            return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end);\n        };\n        NodeObject.prototype.getText = function (sourceFile) {\n            if (!sourceFile) {\n                sourceFile = this.getSourceFile();\n            }\n            return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd());\n        };\n        NodeObject.prototype.addSyntheticNodes = function (nodes, pos, end, useJSDocScanner) {\n            ts.scanner.setTextPos(pos);\n            while (pos < end) {\n                var token = useJSDocScanner ? ts.scanner.scanJSDocToken() : ts.scanner.scan();\n                var textPos = ts.scanner.getTextPos();\n                if (textPos <= end) {\n                    nodes.push(createNode(token, pos, textPos, this));\n                }\n                pos = textPos;\n            }\n            return pos;\n        };\n        NodeObject.prototype.createSyntaxList = function (nodes) {\n            var list = createNode(292 /* SyntaxList */, nodes.pos, nodes.end, this);\n            list._children = [];\n            var pos = nodes.pos;\n            for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) {\n                var node = nodes_7[_i];\n                if (pos < node.pos) {\n                    pos = this.addSyntheticNodes(list._children, pos, node.pos);\n                }\n                list._children.push(node);\n                pos = node.end;\n            }\n            if (pos < nodes.end) {\n                this.addSyntheticNodes(list._children, pos, nodes.end);\n            }\n            return list;\n        };\n        NodeObject.prototype.createChildren = function (sourceFile) {\n            var _this = this;\n            var children;\n            if (this.kind >= 141 /* FirstNode */) {\n                ts.scanner.setText((sourceFile || this.getSourceFile()).text);\n                children = [];\n                var pos_3 = this.pos;\n                var useJSDocScanner_1 = this.kind >= 278 /* FirstJSDocTagNode */ && this.kind <= 291 /* LastJSDocTagNode */;\n                var processNode = function (node) {\n                    var isJSDocTagNode = ts.isJSDocTag(node);\n                    if (!isJSDocTagNode && pos_3 < node.pos) {\n                        pos_3 = _this.addSyntheticNodes(children, pos_3, node.pos, useJSDocScanner_1);\n                    }\n                    children.push(node);\n                    if (!isJSDocTagNode) {\n                        pos_3 = node.end;\n                    }\n                };\n                var processNodes = function (nodes) {\n                    if (pos_3 < nodes.pos) {\n                        pos_3 = _this.addSyntheticNodes(children, pos_3, nodes.pos, useJSDocScanner_1);\n                    }\n                    children.push(_this.createSyntaxList(nodes));\n                    pos_3 = nodes.end;\n                };\n                // jsDocComments need to be the first children\n                if (this.jsDoc) {\n                    for (var _i = 0, _a = this.jsDoc; _i < _a.length; _i++) {\n                        var jsDocComment = _a[_i];\n                        processNode(jsDocComment);\n                    }\n                }\n                // For syntactic classifications, all trivia are classcified together, including jsdoc comments.\n                // For that to work, the jsdoc comments should still be the leading trivia of the first child.\n                // Restoring the scanner position ensures that.\n                pos_3 = this.pos;\n                ts.forEachChild(this, processNode, processNodes);\n                if (pos_3 < this.end) {\n                    this.addSyntheticNodes(children, pos_3, this.end);\n                }\n                ts.scanner.setText(undefined);\n            }\n            this._children = children || ts.emptyArray;\n        };\n        NodeObject.prototype.getChildCount = function (sourceFile) {\n            if (!this._children)\n                this.createChildren(sourceFile);\n            return this._children.length;\n        };\n        NodeObject.prototype.getChildAt = function (index, sourceFile) {\n            if (!this._children)\n                this.createChildren(sourceFile);\n            return this._children[index];\n        };\n        NodeObject.prototype.getChildren = function (sourceFile) {\n            if (!this._children)\n                this.createChildren(sourceFile);\n            return this._children;\n        };\n        NodeObject.prototype.getFirstToken = function (sourceFile) {\n            var children = this.getChildren(sourceFile);\n            if (!children.length) {\n                return undefined;\n            }\n            var child = children[0];\n            return child.kind < 141 /* FirstNode */ ? child : child.getFirstToken(sourceFile);\n        };\n        NodeObject.prototype.getLastToken = function (sourceFile) {\n            var children = this.getChildren(sourceFile);\n            var child = ts.lastOrUndefined(children);\n            if (!child) {\n                return undefined;\n            }\n            return child.kind < 141 /* FirstNode */ ? child : child.getLastToken(sourceFile);\n        };\n        return NodeObject;\n    }());\n    var TokenOrIdentifierObject = (function () {\n        function TokenOrIdentifierObject(pos, end) {\n            // Set properties in same order as NodeObject\n            this.pos = pos;\n            this.end = end;\n            this.flags = 0 /* None */;\n            this.parent = undefined;\n        }\n        TokenOrIdentifierObject.prototype.getSourceFile = function () {\n            return ts.getSourceFileOfNode(this);\n        };\n        TokenOrIdentifierObject.prototype.getStart = function (sourceFile, includeJsDocComment) {\n            return ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment);\n        };\n        TokenOrIdentifierObject.prototype.getFullStart = function () {\n            return this.pos;\n        };\n        TokenOrIdentifierObject.prototype.getEnd = function () {\n            return this.end;\n        };\n        TokenOrIdentifierObject.prototype.getWidth = function (sourceFile) {\n            return this.getEnd() - this.getStart(sourceFile);\n        };\n        TokenOrIdentifierObject.prototype.getFullWidth = function () {\n            return this.end - this.pos;\n        };\n        TokenOrIdentifierObject.prototype.getLeadingTriviaWidth = function (sourceFile) {\n            return this.getStart(sourceFile) - this.pos;\n        };\n        TokenOrIdentifierObject.prototype.getFullText = function (sourceFile) {\n            return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end);\n        };\n        TokenOrIdentifierObject.prototype.getText = function (sourceFile) {\n            return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd());\n        };\n        TokenOrIdentifierObject.prototype.getChildCount = function () {\n            return 0;\n        };\n        TokenOrIdentifierObject.prototype.getChildAt = function () {\n            return undefined;\n        };\n        TokenOrIdentifierObject.prototype.getChildren = function () {\n            return ts.emptyArray;\n        };\n        TokenOrIdentifierObject.prototype.getFirstToken = function () {\n            return undefined;\n        };\n        TokenOrIdentifierObject.prototype.getLastToken = function () {\n            return undefined;\n        };\n        return TokenOrIdentifierObject;\n    }());\n    var SymbolObject = (function () {\n        function SymbolObject(flags, name) {\n            this.flags = flags;\n            this.name = name;\n        }\n        SymbolObject.prototype.getFlags = function () {\n            return this.flags;\n        };\n        SymbolObject.prototype.getName = function () {\n            return this.name;\n        };\n        SymbolObject.prototype.getDeclarations = function () {\n            return this.declarations;\n        };\n        SymbolObject.prototype.getDocumentationComment = function () {\n            if (this.documentationComment === undefined) {\n                this.documentationComment = ts.JsDoc.getJsDocCommentsFromDeclarations(this.declarations);\n            }\n            return this.documentationComment;\n        };\n        return SymbolObject;\n    }());\n    var TokenObject = (function (_super) {\n        __extends(TokenObject, _super);\n        function TokenObject(kind, pos, end) {\n            var _this = _super.call(this, pos, end) || this;\n            _this.kind = kind;\n            return _this;\n        }\n        return TokenObject;\n    }(TokenOrIdentifierObject));\n    var IdentifierObject = (function (_super) {\n        __extends(IdentifierObject, _super);\n        function IdentifierObject(_kind, pos, end) {\n            return _super.call(this, pos, end) || this;\n        }\n        return IdentifierObject;\n    }(TokenOrIdentifierObject));\n    IdentifierObject.prototype.kind = 70 /* Identifier */;\n    var TypeObject = (function () {\n        function TypeObject(checker, flags) {\n            this.checker = checker;\n            this.flags = flags;\n        }\n        TypeObject.prototype.getFlags = function () {\n            return this.flags;\n        };\n        TypeObject.prototype.getSymbol = function () {\n            return this.symbol;\n        };\n        TypeObject.prototype.getProperties = function () {\n            return this.checker.getPropertiesOfType(this);\n        };\n        TypeObject.prototype.getProperty = function (propertyName) {\n            return this.checker.getPropertyOfType(this, propertyName);\n        };\n        TypeObject.prototype.getApparentProperties = function () {\n            return this.checker.getAugmentedPropertiesOfType(this);\n        };\n        TypeObject.prototype.getCallSignatures = function () {\n            return this.checker.getSignaturesOfType(this, 0 /* Call */);\n        };\n        TypeObject.prototype.getConstructSignatures = function () {\n            return this.checker.getSignaturesOfType(this, 1 /* Construct */);\n        };\n        TypeObject.prototype.getStringIndexType = function () {\n            return this.checker.getIndexTypeOfType(this, 0 /* String */);\n        };\n        TypeObject.prototype.getNumberIndexType = function () {\n            return this.checker.getIndexTypeOfType(this, 1 /* Number */);\n        };\n        TypeObject.prototype.getBaseTypes = function () {\n            return this.flags & 32768 /* Object */ && this.objectFlags & (1 /* Class */ | 2 /* Interface */)\n                ? this.checker.getBaseTypes(this)\n                : undefined;\n        };\n        TypeObject.prototype.getNonNullableType = function () {\n            return this.checker.getNonNullableType(this);\n        };\n        return TypeObject;\n    }());\n    var SignatureObject = (function () {\n        function SignatureObject(checker) {\n            this.checker = checker;\n        }\n        SignatureObject.prototype.getDeclaration = function () {\n            return this.declaration;\n        };\n        SignatureObject.prototype.getTypeParameters = function () {\n            return this.typeParameters;\n        };\n        SignatureObject.prototype.getParameters = function () {\n            return this.parameters;\n        };\n        SignatureObject.prototype.getReturnType = function () {\n            return this.checker.getReturnTypeOfSignature(this);\n        };\n        SignatureObject.prototype.getDocumentationComment = function () {\n            if (this.documentationComment === undefined) {\n                this.documentationComment = this.declaration ? ts.JsDoc.getJsDocCommentsFromDeclarations([this.declaration]) : [];\n            }\n            return this.documentationComment;\n        };\n        return SignatureObject;\n    }());\n    var SourceFileObject = (function (_super) {\n        __extends(SourceFileObject, _super);\n        function SourceFileObject(kind, pos, end) {\n            return _super.call(this, kind, pos, end) || this;\n        }\n        SourceFileObject.prototype.update = function (newText, textChangeRange) {\n            return ts.updateSourceFile(this, newText, textChangeRange);\n        };\n        SourceFileObject.prototype.getLineAndCharacterOfPosition = function (position) {\n            return ts.getLineAndCharacterOfPosition(this, position);\n        };\n        SourceFileObject.prototype.getLineStarts = function () {\n            return ts.getLineStarts(this);\n        };\n        SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) {\n            return ts.getPositionOfLineAndCharacter(this, line, character);\n        };\n        SourceFileObject.prototype.getLineEndOfPosition = function (pos) {\n            var line = this.getLineAndCharacterOfPosition(pos).line;\n            var lineStarts = this.getLineStarts();\n            var lastCharPos;\n            if (line + 1 >= lineStarts.length) {\n                lastCharPos = this.getEnd();\n            }\n            if (!lastCharPos) {\n                lastCharPos = lineStarts[line + 1] - 1;\n            }\n            var fullText = this.getFullText();\n            // if the new line is \"\\r\\n\", we should return the last non-new-line-character position\n            return fullText[lastCharPos] === \"\\n\" && fullText[lastCharPos - 1] === \"\\r\" ? lastCharPos - 1 : lastCharPos;\n        };\n        SourceFileObject.prototype.getNamedDeclarations = function () {\n            if (!this.namedDeclarations) {\n                this.namedDeclarations = this.computeNamedDeclarations();\n            }\n            return this.namedDeclarations;\n        };\n        SourceFileObject.prototype.computeNamedDeclarations = function () {\n            var result = ts.createMap();\n            ts.forEachChild(this, visit);\n            return result;\n            function addDeclaration(declaration) {\n                var name = getDeclarationName(declaration);\n                if (name) {\n                    ts.multiMapAdd(result, name, declaration);\n                }\n            }\n            function getDeclarations(name) {\n                return result[name] || (result[name] = []);\n            }\n            function getDeclarationName(declaration) {\n                if (declaration.name) {\n                    var result_7 = getTextOfIdentifierOrLiteral(declaration.name);\n                    if (result_7 !== undefined) {\n                        return result_7;\n                    }\n                    if (declaration.name.kind === 142 /* ComputedPropertyName */) {\n                        var expr = declaration.name.expression;\n                        if (expr.kind === 177 /* PropertyAccessExpression */) {\n                            return expr.name.text;\n                        }\n                        return getTextOfIdentifierOrLiteral(expr);\n                    }\n                }\n                return undefined;\n            }\n            function getTextOfIdentifierOrLiteral(node) {\n                if (node) {\n                    if (node.kind === 70 /* Identifier */ ||\n                        node.kind === 9 /* StringLiteral */ ||\n                        node.kind === 8 /* NumericLiteral */) {\n                        return node.text;\n                    }\n                }\n                return undefined;\n            }\n            function visit(node) {\n                switch (node.kind) {\n                    case 225 /* FunctionDeclaration */:\n                    case 184 /* FunctionExpression */:\n                    case 149 /* MethodDeclaration */:\n                    case 148 /* MethodSignature */:\n                        var functionDeclaration = node;\n                        var declarationName = getDeclarationName(functionDeclaration);\n                        if (declarationName) {\n                            var declarations = getDeclarations(declarationName);\n                            var lastDeclaration = ts.lastOrUndefined(declarations);\n                            // Check whether this declaration belongs to an \"overload group\".\n                            if (lastDeclaration && functionDeclaration.parent === lastDeclaration.parent && functionDeclaration.symbol === lastDeclaration.symbol) {\n                                // Overwrite the last declaration if it was an overload\n                                // and this one is an implementation.\n                                if (functionDeclaration.body && !lastDeclaration.body) {\n                                    declarations[declarations.length - 1] = functionDeclaration;\n                                }\n                            }\n                            else {\n                                declarations.push(functionDeclaration);\n                            }\n                            ts.forEachChild(node, visit);\n                        }\n                        break;\n                    case 226 /* ClassDeclaration */:\n                    case 197 /* ClassExpression */:\n                    case 227 /* InterfaceDeclaration */:\n                    case 228 /* TypeAliasDeclaration */:\n                    case 229 /* EnumDeclaration */:\n                    case 230 /* ModuleDeclaration */:\n                    case 234 /* ImportEqualsDeclaration */:\n                    case 243 /* ExportSpecifier */:\n                    case 239 /* ImportSpecifier */:\n                    case 234 /* ImportEqualsDeclaration */:\n                    case 236 /* ImportClause */:\n                    case 237 /* NamespaceImport */:\n                    case 151 /* GetAccessor */:\n                    case 152 /* SetAccessor */:\n                    case 161 /* TypeLiteral */:\n                        addDeclaration(node);\n                        ts.forEachChild(node, visit);\n                        break;\n                    case 144 /* Parameter */:\n                        // Only consider parameter properties\n                        if (!ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) {\n                            break;\n                        }\n                    // fall through\n                    case 223 /* VariableDeclaration */:\n                    case 174 /* BindingElement */: {\n                        var decl = node;\n                        if (ts.isBindingPattern(decl.name)) {\n                            ts.forEachChild(decl.name, visit);\n                            break;\n                        }\n                        if (decl.initializer)\n                            visit(decl.initializer);\n                    }\n                    case 260 /* EnumMember */:\n                    case 147 /* PropertyDeclaration */:\n                    case 146 /* PropertySignature */:\n                        addDeclaration(node);\n                        break;\n                    case 241 /* ExportDeclaration */:\n                        // Handle named exports case e.g.:\n                        //    export {a, b as B} from \"mod\";\n                        if (node.exportClause) {\n                            ts.forEach(node.exportClause.elements, visit);\n                        }\n                        break;\n                    case 235 /* ImportDeclaration */:\n                        var importClause = node.importClause;\n                        if (importClause) {\n                            // Handle default import case e.g.:\n                            //    import d from \"mod\";\n                            if (importClause.name) {\n                                addDeclaration(importClause);\n                            }\n                            // Handle named bindings in imports e.g.:\n                            //    import * as NS from \"mod\";\n                            //    import {a, b as B} from \"mod\";\n                            if (importClause.namedBindings) {\n                                if (importClause.namedBindings.kind === 237 /* NamespaceImport */) {\n                                    addDeclaration(importClause.namedBindings);\n                                }\n                                else {\n                                    ts.forEach(importClause.namedBindings.elements, visit);\n                                }\n                            }\n                        }\n                        break;\n                    default:\n                        ts.forEachChild(node, visit);\n                }\n            }\n        };\n        return SourceFileObject;\n    }(NodeObject));\n    function getServicesObjectAllocator() {\n        return {\n            getNodeConstructor: function () { return NodeObject; },\n            getTokenConstructor: function () { return TokenObject; },\n            getIdentifierConstructor: function () { return IdentifierObject; },\n            getSourceFileConstructor: function () { return SourceFileObject; },\n            getSymbolConstructor: function () { return SymbolObject; },\n            getTypeConstructor: function () { return TypeObject; },\n            getSignatureConstructor: function () { return SignatureObject; },\n        };\n    }\n    function toEditorSettings(optionsAsMap) {\n        var allPropertiesAreCamelCased = true;\n        for (var key in optionsAsMap) {\n            if (ts.hasProperty(optionsAsMap, key) && !isCamelCase(key)) {\n                allPropertiesAreCamelCased = false;\n                break;\n            }\n        }\n        if (allPropertiesAreCamelCased) {\n            return optionsAsMap;\n        }\n        var settings = {};\n        for (var key in optionsAsMap) {\n            if (ts.hasProperty(optionsAsMap, key)) {\n                var newKey = isCamelCase(key) ? key : key.charAt(0).toLowerCase() + key.substr(1);\n                settings[newKey] = optionsAsMap[key];\n            }\n        }\n        return settings;\n    }\n    ts.toEditorSettings = toEditorSettings;\n    function isCamelCase(s) {\n        return !s.length || s.charAt(0) === s.charAt(0).toLowerCase();\n    }\n    function displayPartsToString(displayParts) {\n        if (displayParts) {\n            return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join(\"\");\n        }\n        return \"\";\n    }\n    ts.displayPartsToString = displayPartsToString;\n    function getDefaultCompilerOptions() {\n        // Always default to \"ScriptTarget.ES5\" for the language service\n        return {\n            target: 1 /* ES5 */,\n            jsx: 1 /* Preserve */\n        };\n    }\n    ts.getDefaultCompilerOptions = getDefaultCompilerOptions;\n    function getSupportedCodeFixes() {\n        return ts.codefix.getSupportedErrorCodes();\n    }\n    ts.getSupportedCodeFixes = getSupportedCodeFixes;\n    // Cache host information about script Should be refreshed\n    // at each language service public entry point, since we don't know when\n    // the set of scripts handled by the host changes.\n    var HostCache = (function () {\n        function HostCache(host, getCanonicalFileName) {\n            this.host = host;\n            this.getCanonicalFileName = getCanonicalFileName;\n            // script id => script index\n            this.currentDirectory = host.getCurrentDirectory();\n            this.fileNameToEntry = ts.createFileMap();\n            // Initialize the list with the root file names\n            var rootFileNames = host.getScriptFileNames();\n            for (var _i = 0, rootFileNames_1 = rootFileNames; _i < rootFileNames_1.length; _i++) {\n                var fileName = rootFileNames_1[_i];\n                this.createEntry(fileName, ts.toPath(fileName, this.currentDirectory, getCanonicalFileName));\n            }\n            // store the compilation settings\n            this._compilationSettings = host.getCompilationSettings() || getDefaultCompilerOptions();\n        }\n        HostCache.prototype.compilationSettings = function () {\n            return this._compilationSettings;\n        };\n        HostCache.prototype.createEntry = function (fileName, path) {\n            var entry;\n            var scriptSnapshot = this.host.getScriptSnapshot(fileName);\n            if (scriptSnapshot) {\n                entry = {\n                    hostFileName: fileName,\n                    version: this.host.getScriptVersion(fileName),\n                    scriptSnapshot: scriptSnapshot,\n                    scriptKind: ts.getScriptKind(fileName, this.host)\n                };\n            }\n            this.fileNameToEntry.set(path, entry);\n            return entry;\n        };\n        HostCache.prototype.getEntry = function (path) {\n            return this.fileNameToEntry.get(path);\n        };\n        HostCache.prototype.contains = function (path) {\n            return this.fileNameToEntry.contains(path);\n        };\n        HostCache.prototype.getOrCreateEntry = function (fileName) {\n            var path = ts.toPath(fileName, this.currentDirectory, this.getCanonicalFileName);\n            return this.getOrCreateEntryByPath(fileName, path);\n        };\n        HostCache.prototype.getOrCreateEntryByPath = function (fileName, path) {\n            return this.contains(path)\n                ? this.getEntry(path)\n                : this.createEntry(fileName, path);\n        };\n        HostCache.prototype.getRootFileNames = function () {\n            var fileNames = [];\n            this.fileNameToEntry.forEachValue(function (_path, value) {\n                if (value) {\n                    fileNames.push(value.hostFileName);\n                }\n            });\n            return fileNames;\n        };\n        HostCache.prototype.getVersion = function (path) {\n            var file = this.getEntry(path);\n            return file && file.version;\n        };\n        HostCache.prototype.getScriptSnapshot = function (path) {\n            var file = this.getEntry(path);\n            return file && file.scriptSnapshot;\n        };\n        return HostCache;\n    }());\n    var SyntaxTreeCache = (function () {\n        function SyntaxTreeCache(host) {\n            this.host = host;\n        }\n        SyntaxTreeCache.prototype.getCurrentSourceFile = function (fileName) {\n            var scriptSnapshot = this.host.getScriptSnapshot(fileName);\n            if (!scriptSnapshot) {\n                // The host does not know about this file.\n                throw new Error(\"Could not find file: '\" + fileName + \"'.\");\n            }\n            var scriptKind = ts.getScriptKind(fileName, this.host);\n            var version = this.host.getScriptVersion(fileName);\n            var sourceFile;\n            if (this.currentFileName !== fileName) {\n                // This is a new file, just parse it\n                sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 5 /* Latest */, version, /*setNodeParents*/ true, scriptKind);\n            }\n            else if (this.currentFileVersion !== version) {\n                // This is the same file, just a newer version. Incrementally parse the file.\n                var editRange = scriptSnapshot.getChangeRange(this.currentFileScriptSnapshot);\n                sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, editRange);\n            }\n            if (sourceFile) {\n                // All done, ensure state is up to date\n                this.currentFileVersion = version;\n                this.currentFileName = fileName;\n                this.currentFileScriptSnapshot = scriptSnapshot;\n                this.currentSourceFile = sourceFile;\n            }\n            return this.currentSourceFile;\n        };\n        return SyntaxTreeCache;\n    }());\n    function setSourceFileFields(sourceFile, scriptSnapshot, version) {\n        sourceFile.version = version;\n        sourceFile.scriptSnapshot = scriptSnapshot;\n    }\n    function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents, scriptKind) {\n        var text = scriptSnapshot.getText(0, scriptSnapshot.getLength());\n        var sourceFile = ts.createSourceFile(fileName, text, scriptTarget, setNodeParents, scriptKind);\n        setSourceFileFields(sourceFile, scriptSnapshot, version);\n        return sourceFile;\n    }\n    ts.createLanguageServiceSourceFile = createLanguageServiceSourceFile;\n    ts.disableIncrementalParsing = false;\n    function updateLanguageServiceSourceFile(sourceFile, scriptSnapshot, version, textChangeRange, aggressiveChecks) {\n        // If we were given a text change range, and our version or open-ness changed, then\n        // incrementally parse this file.\n        if (textChangeRange) {\n            if (version !== sourceFile.version) {\n                // Once incremental parsing is ready, then just call into this function.\n                if (!ts.disableIncrementalParsing) {\n                    var newText = void 0;\n                    // grab the fragment from the beginning of the original text to the beginning of the span\n                    var prefix = textChangeRange.span.start !== 0\n                        ? sourceFile.text.substr(0, textChangeRange.span.start)\n                        : \"\";\n                    // grab the fragment from the end of the span till the end of the original text\n                    var suffix = ts.textSpanEnd(textChangeRange.span) !== sourceFile.text.length\n                        ? sourceFile.text.substr(ts.textSpanEnd(textChangeRange.span))\n                        : \"\";\n                    if (textChangeRange.newLength === 0) {\n                        // edit was a deletion - just combine prefix and suffix\n                        newText = prefix && suffix ? prefix + suffix : prefix || suffix;\n                    }\n                    else {\n                        // it was actual edit, fetch the fragment of new text that correspond to new span\n                        var changedText = scriptSnapshot.getText(textChangeRange.span.start, textChangeRange.span.start + textChangeRange.newLength);\n                        // combine prefix, changed text and suffix\n                        newText = prefix && suffix\n                            ? prefix + changedText + suffix\n                            : prefix\n                                ? (prefix + changedText)\n                                : (changedText + suffix);\n                    }\n                    var newSourceFile = ts.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);\n                    setSourceFileFields(newSourceFile, scriptSnapshot, version);\n                    // after incremental parsing nameTable might not be up-to-date\n                    // drop it so it can be lazily recreated later\n                    newSourceFile.nameTable = undefined;\n                    // dispose all resources held by old script snapshot\n                    if (sourceFile !== newSourceFile && sourceFile.scriptSnapshot) {\n                        if (sourceFile.scriptSnapshot.dispose) {\n                            sourceFile.scriptSnapshot.dispose();\n                        }\n                        sourceFile.scriptSnapshot = undefined;\n                    }\n                    return newSourceFile;\n                }\n            }\n        }\n        // Otherwise, just create a new source file.\n        return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents*/ true, sourceFile.scriptKind);\n    }\n    ts.updateLanguageServiceSourceFile = updateLanguageServiceSourceFile;\n    var CancellationTokenObject = (function () {\n        function CancellationTokenObject(cancellationToken) {\n            this.cancellationToken = cancellationToken;\n        }\n        CancellationTokenObject.prototype.isCancellationRequested = function () {\n            return this.cancellationToken && this.cancellationToken.isCancellationRequested();\n        };\n        CancellationTokenObject.prototype.throwIfCancellationRequested = function () {\n            if (this.isCancellationRequested()) {\n                throw new ts.OperationCanceledException();\n            }\n        };\n        return CancellationTokenObject;\n    }());\n    function createLanguageService(host, documentRegistry) {\n        if (documentRegistry === void 0) { documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); }\n        var syntaxTreeCache = new SyntaxTreeCache(host);\n        var ruleProvider;\n        var program;\n        var lastProjectVersion;\n        var lastTypesRootVersion = 0;\n        var useCaseSensitivefileNames = host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames();\n        var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken());\n        var currentDirectory = host.getCurrentDirectory();\n        // Check if the localized messages json is set, otherwise query the host for it\n        if (!ts.localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages) {\n            ts.localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages();\n        }\n        function log(message) {\n            if (host.log) {\n                host.log(message);\n            }\n        }\n        var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitivefileNames);\n        function getValidSourceFile(fileName) {\n            var sourceFile = program.getSourceFile(fileName);\n            if (!sourceFile) {\n                throw new Error(\"Could not find file: '\" + fileName + \"'.\");\n            }\n            return sourceFile;\n        }\n        function getRuleProvider(options) {\n            // Ensure rules are initialized and up to date wrt to formatting options\n            if (!ruleProvider) {\n                ruleProvider = new ts.formatting.RulesProvider();\n            }\n            ruleProvider.ensureUpToDate(options);\n            return ruleProvider;\n        }\n        function synchronizeHostData() {\n            // perform fast check if host supports it\n            if (host.getProjectVersion) {\n                var hostProjectVersion = host.getProjectVersion();\n                if (hostProjectVersion) {\n                    if (lastProjectVersion === hostProjectVersion) {\n                        return;\n                    }\n                    lastProjectVersion = hostProjectVersion;\n                }\n            }\n            var typeRootsVersion = host.getTypeRootsVersion ? host.getTypeRootsVersion() : 0;\n            if (lastTypesRootVersion !== typeRootsVersion) {\n                log(\"TypeRoots version has changed; provide new program\");\n                program = undefined;\n                lastTypesRootVersion = typeRootsVersion;\n            }\n            // Get a fresh cache of the host information\n            var hostCache = new HostCache(host, getCanonicalFileName);\n            // If the program is already up-to-date, we can reuse it\n            if (programUpToDate()) {\n                return;\n            }\n            // IMPORTANT - It is critical from this moment onward that we do not check\n            // cancellation tokens.  We are about to mutate source files from a previous program\n            // instance.  If we cancel midway through, we may end up in an inconsistent state where\n            // the program points to old source files that have been invalidated because of\n            // incremental parsing.\n            var oldSettings = program && program.getCompilerOptions();\n            var newSettings = hostCache.compilationSettings();\n            var shouldCreateNewSourceFiles = oldSettings &&\n                (oldSettings.target !== newSettings.target ||\n                    oldSettings.module !== newSettings.module ||\n                    oldSettings.moduleResolution !== newSettings.moduleResolution ||\n                    oldSettings.noResolve !== newSettings.noResolve ||\n                    oldSettings.jsx !== newSettings.jsx ||\n                    oldSettings.allowJs !== newSettings.allowJs ||\n                    oldSettings.disableSizeLimit !== oldSettings.disableSizeLimit ||\n                    oldSettings.baseUrl !== newSettings.baseUrl ||\n                    !ts.equalOwnProperties(oldSettings.paths, newSettings.paths));\n            // Now create a new compiler\n            var compilerHost = {\n                getSourceFile: getOrCreateSourceFile,\n                getSourceFileByPath: getOrCreateSourceFileByPath,\n                getCancellationToken: function () { return cancellationToken; },\n                getCanonicalFileName: getCanonicalFileName,\n                useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; },\n                getNewLine: function () { return ts.getNewLineOrDefaultFromHost(host); },\n                getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); },\n                writeFile: ts.noop,\n                getCurrentDirectory: function () { return currentDirectory; },\n                fileExists: function (fileName) {\n                    // stub missing host functionality\n                    return hostCache.getOrCreateEntry(fileName) !== undefined;\n                },\n                readFile: function (fileName) {\n                    // stub missing host functionality\n                    var entry = hostCache.getOrCreateEntry(fileName);\n                    return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength());\n                },\n                directoryExists: function (directoryName) {\n                    return ts.directoryProbablyExists(directoryName, host);\n                },\n                getDirectories: function (path) {\n                    return host.getDirectories ? host.getDirectories(path) : [];\n                }\n            };\n            if (host.trace) {\n                compilerHost.trace = function (message) { return host.trace(message); };\n            }\n            if (host.resolveModuleNames) {\n                compilerHost.resolveModuleNames = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); };\n            }\n            if (host.resolveTypeReferenceDirectives) {\n                compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile) {\n                    return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile);\n                };\n            }\n            var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);\n            var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program);\n            // Release any files we have acquired in the old program but are\n            // not part of the new program.\n            if (program) {\n                var oldSourceFiles = program.getSourceFiles();\n                var oldSettingsKey = documentRegistry.getKeyForCompilationSettings(oldSettings);\n                for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) {\n                    var oldSourceFile = oldSourceFiles_1[_i];\n                    if (!newProgram.getSourceFile(oldSourceFile.fileName) || shouldCreateNewSourceFiles) {\n                        documentRegistry.releaseDocumentWithKey(oldSourceFile.path, oldSettingsKey);\n                    }\n                }\n            }\n            // hostCache is captured in the closure for 'getOrCreateSourceFile' but it should not be used past this point.\n            // It needs to be cleared to allow all collected snapshots to be released\n            hostCache = undefined;\n            program = newProgram;\n            // Make sure all the nodes in the program are both bound, and have their parent\n            // pointers set property.\n            program.getTypeChecker();\n            return;\n            function getOrCreateSourceFile(fileName) {\n                return getOrCreateSourceFileByPath(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName));\n            }\n            function getOrCreateSourceFileByPath(fileName, path) {\n                ts.Debug.assert(hostCache !== undefined);\n                // The program is asking for this file, check first if the host can locate it.\n                // If the host can not locate the file, then it does not exist. return undefined\n                // to the program to allow reporting of errors for missing files.\n                var hostFileInformation = hostCache.getOrCreateEntryByPath(fileName, path);\n                if (!hostFileInformation) {\n                    return undefined;\n                }\n                // Check if the language version has changed since we last created a program; if they are the same,\n                // it is safe to reuse the sourceFiles; if not, then the shape of the AST can change, and the oldSourceFile\n                // can not be reused. we have to dump all syntax trees and create new ones.\n                if (!shouldCreateNewSourceFiles) {\n                    // Check if the old program had this file already\n                    var oldSourceFile = program && program.getSourceFileByPath(path);\n                    if (oldSourceFile) {\n                        // We already had a source file for this file name.  Go to the registry to\n                        // ensure that we get the right up to date version of it.  We need this to\n                        // address the following race-condition.  Specifically, say we have the following:\n                        //\n                        //      LS1\n                        //          \\\n                        //           DocumentRegistry\n                        //          /\n                        //      LS2\n                        //\n                        // Each LS has a reference to file 'foo.ts' at version 1.  LS2 then updates\n                        // it's version of 'foo.ts' to version 2.  This will cause LS2 and the\n                        // DocumentRegistry to have version 2 of the document.  HOwever, LS1 will\n                        // have version 1.  And *importantly* this source file will be *corrupt*.\n                        // The act of creating version 2 of the file irrevocably damages the version\n                        // 1 file.\n                        //\n                        // So, later when we call into LS1, we need to make sure that it doesn't use\n                        // it's source file any more, and instead defers to DocumentRegistry to get\n                        // either version 1, version 2 (or some other version) depending on what the\n                        // host says should be used.\n                        // We do not support the scenario where a host can modify a registered\n                        // file's script kind, i.e. in one project some file is treated as \".ts\"\n                        // and in another as \".js\"\n                        ts.Debug.assert(hostFileInformation.scriptKind === oldSourceFile.scriptKind, \"Registered script kind (\" + oldSourceFile.scriptKind + \") should match new script kind (\" + hostFileInformation.scriptKind + \") for file: \" + path);\n                        return documentRegistry.updateDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind);\n                    }\n                }\n                // Could not find this file in the old program, create a new SourceFile for it.\n                return documentRegistry.acquireDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind);\n            }\n            function sourceFileUpToDate(sourceFile) {\n                if (!sourceFile) {\n                    return false;\n                }\n                var path = sourceFile.path || ts.toPath(sourceFile.fileName, currentDirectory, getCanonicalFileName);\n                return sourceFile.version === hostCache.getVersion(path);\n            }\n            function programUpToDate() {\n                // If we haven't create a program yet, then it is not up-to-date\n                if (!program) {\n                    return false;\n                }\n                // If number of files in the program do not match, it is not up-to-date\n                var rootFileNames = hostCache.getRootFileNames();\n                if (program.getSourceFiles().length !== rootFileNames.length) {\n                    return false;\n                }\n                // If any file is not up-to-date, then the whole program is not up-to-date\n                for (var _i = 0, rootFileNames_2 = rootFileNames; _i < rootFileNames_2.length; _i++) {\n                    var fileName = rootFileNames_2[_i];\n                    if (!sourceFileUpToDate(program.getSourceFile(fileName))) {\n                        return false;\n                    }\n                }\n                // If the compilation settings do no match, then the program is not up-to-date\n                return ts.compareDataObjects(program.getCompilerOptions(), hostCache.compilationSettings());\n            }\n        }\n        function getProgram() {\n            synchronizeHostData();\n            return program;\n        }\n        function cleanupSemanticCache() {\n            program = undefined;\n        }\n        function dispose() {\n            if (program) {\n                ts.forEach(program.getSourceFiles(), function (f) {\n                    return documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions());\n                });\n            }\n        }\n        /// Diagnostics\n        function getSyntacticDiagnostics(fileName) {\n            synchronizeHostData();\n            return program.getSyntacticDiagnostics(getValidSourceFile(fileName), cancellationToken);\n        }\n        /**\n         * getSemanticDiagnostics return array of Diagnostics. If '-d' is not enabled, only report semantic errors\n         * If '-d' enabled, report both semantic and emitter errors\n         */\n        function getSemanticDiagnostics(fileName) {\n            synchronizeHostData();\n            var targetSourceFile = getValidSourceFile(fileName);\n            // Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file.\n            // Therefore only get diagnostics for given file.\n            var semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken);\n            if (!program.getCompilerOptions().declaration) {\n                return semanticDiagnostics;\n            }\n            // If '-d' is enabled, check for emitter error. One example of emitter error is export class implements non-export interface\n            var declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken);\n            return ts.concatenate(semanticDiagnostics, declarationDiagnostics);\n        }\n        function getCompilerOptionsDiagnostics() {\n            synchronizeHostData();\n            return program.getOptionsDiagnostics(cancellationToken).concat(program.getGlobalDiagnostics(cancellationToken));\n        }\n        function getCompletionsAtPosition(fileName, position) {\n            synchronizeHostData();\n            return ts.Completions.getCompletionsAtPosition(host, program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position);\n        }\n        function getCompletionEntryDetails(fileName, position, entryName) {\n            synchronizeHostData();\n            return ts.Completions.getCompletionEntryDetails(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, entryName);\n        }\n        function getCompletionEntrySymbol(fileName, position, entryName) {\n            synchronizeHostData();\n            return ts.Completions.getCompletionEntrySymbol(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, entryName);\n        }\n        function getQuickInfoAtPosition(fileName, position) {\n            synchronizeHostData();\n            var sourceFile = getValidSourceFile(fileName);\n            var node = ts.getTouchingPropertyName(sourceFile, position);\n            if (node === sourceFile) {\n                return undefined;\n            }\n            if (ts.isLabelName(node)) {\n                return undefined;\n            }\n            var typeChecker = program.getTypeChecker();\n            var symbol = typeChecker.getSymbolAtLocation(node);\n            if (!symbol || typeChecker.isUnknownSymbol(symbol)) {\n                // Try getting just type at this position and show\n                switch (node.kind) {\n                    case 70 /* Identifier */:\n                    case 177 /* PropertyAccessExpression */:\n                    case 141 /* QualifiedName */:\n                    case 98 /* ThisKeyword */:\n                    case 167 /* ThisType */:\n                    case 96 /* SuperKeyword */:\n                        // For the identifiers/this/super etc get the type at position\n                        var type = typeChecker.getTypeAtLocation(node);\n                        if (type) {\n                            return {\n                                kind: ts.ScriptElementKind.unknown,\n                                kindModifiers: ts.ScriptElementKindModifier.none,\n                                textSpan: ts.createTextSpan(node.getStart(), node.getWidth()),\n                                displayParts: ts.typeToDisplayParts(typeChecker, type, ts.getContainerNode(node)),\n                                documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined\n                            };\n                        }\n                }\n                return undefined;\n            }\n            var displayPartsDocumentationsAndKind = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(node), node);\n            return {\n                kind: displayPartsDocumentationsAndKind.symbolKind,\n                kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),\n                textSpan: ts.createTextSpan(node.getStart(), node.getWidth()),\n                displayParts: displayPartsDocumentationsAndKind.displayParts,\n                documentation: displayPartsDocumentationsAndKind.documentation\n            };\n        }\n        /// Goto definition\n        function getDefinitionAtPosition(fileName, position) {\n            synchronizeHostData();\n            return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position);\n        }\n        /// Goto implementation\n        function getImplementationAtPosition(fileName, position) {\n            synchronizeHostData();\n            return ts.GoToImplementation.getImplementationAtPosition(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), ts.getTouchingPropertyName(getValidSourceFile(fileName), position));\n        }\n        function getTypeDefinitionAtPosition(fileName, position) {\n            synchronizeHostData();\n            return ts.GoToDefinition.getTypeDefinitionAtPosition(program.getTypeChecker(), getValidSourceFile(fileName), position);\n        }\n        function getOccurrencesAtPosition(fileName, position) {\n            var results = getOccurrencesAtPositionCore(fileName, position);\n            if (results) {\n                var sourceFile_2 = getCanonicalFileName(ts.normalizeSlashes(fileName));\n                // Get occurrences only supports reporting occurrences for the file queried.  So\n                // filter down to that list.\n                results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_2; });\n            }\n            return results;\n        }\n        function getDocumentHighlights(fileName, position, filesToSearch) {\n            synchronizeHostData();\n            var sourceFilesToSearch = ts.map(filesToSearch, function (f) { return program.getSourceFile(f); });\n            var sourceFile = getValidSourceFile(fileName);\n            return ts.DocumentHighlights.getDocumentHighlights(program.getTypeChecker(), cancellationToken, sourceFile, position, sourceFilesToSearch);\n        }\n        /// References and Occurrences\n        function getOccurrencesAtPositionCore(fileName, position) {\n            synchronizeHostData();\n            return convertDocumentHighlights(getDocumentHighlights(fileName, position, [fileName]));\n            function convertDocumentHighlights(documentHighlights) {\n                if (!documentHighlights) {\n                    return undefined;\n                }\n                var result = [];\n                for (var _i = 0, documentHighlights_1 = documentHighlights; _i < documentHighlights_1.length; _i++) {\n                    var entry = documentHighlights_1[_i];\n                    for (var _a = 0, _b = entry.highlightSpans; _a < _b.length; _a++) {\n                        var highlightSpan = _b[_a];\n                        result.push({\n                            fileName: entry.fileName,\n                            textSpan: highlightSpan.textSpan,\n                            isWriteAccess: highlightSpan.kind === ts.HighlightSpanKind.writtenReference,\n                            isDefinition: false\n                        });\n                    }\n                }\n                return result;\n            }\n        }\n        function findRenameLocations(fileName, position, findInStrings, findInComments) {\n            var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments);\n            return ts.FindAllReferences.convertReferences(referencedSymbols);\n        }\n        function getReferencesAtPosition(fileName, position) {\n            var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false);\n            return ts.FindAllReferences.convertReferences(referencedSymbols);\n        }\n        function findReferences(fileName, position) {\n            var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false);\n            // Only include referenced symbols that have a valid definition.\n            return ts.filter(referencedSymbols, function (rs) { return !!rs.definition; });\n        }\n        function findReferencedSymbols(fileName, position, findInStrings, findInComments) {\n            synchronizeHostData();\n            return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, findInStrings, findInComments);\n        }\n        /// NavigateTo\n        function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) {\n            synchronizeHostData();\n            var sourceFiles = fileName ? [getValidSourceFile(fileName)] : program.getSourceFiles();\n            return ts.NavigateTo.getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles);\n        }\n        function getEmitOutput(fileName, emitOnlyDtsFiles) {\n            synchronizeHostData();\n            var sourceFile = getValidSourceFile(fileName);\n            var outputFiles = [];\n            function writeFile(fileName, data, writeByteOrderMark) {\n                outputFiles.push({\n                    name: fileName,\n                    writeByteOrderMark: writeByteOrderMark,\n                    text: data\n                });\n            }\n            var emitOutput = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles);\n            return {\n                outputFiles: outputFiles,\n                emitSkipped: emitOutput.emitSkipped\n            };\n        }\n        // Signature help\n        /**\n         * This is a semantic operation.\n         */\n        function getSignatureHelpItems(fileName, position) {\n            synchronizeHostData();\n            var sourceFile = getValidSourceFile(fileName);\n            return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, cancellationToken);\n        }\n        /// Syntactic features\n        function getNonBoundSourceFile(fileName) {\n            return syntaxTreeCache.getCurrentSourceFile(fileName);\n        }\n        function getSourceFile(fileName) {\n            return getNonBoundSourceFile(fileName);\n        }\n        function getNameOrDottedNameSpan(fileName, startPos, _endPos) {\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            // Get node at the location\n            var node = ts.getTouchingPropertyName(sourceFile, startPos);\n            if (node === sourceFile) {\n                return;\n            }\n            switch (node.kind) {\n                case 177 /* PropertyAccessExpression */:\n                case 141 /* QualifiedName */:\n                case 9 /* StringLiteral */:\n                case 85 /* FalseKeyword */:\n                case 100 /* TrueKeyword */:\n                case 94 /* NullKeyword */:\n                case 96 /* SuperKeyword */:\n                case 98 /* ThisKeyword */:\n                case 167 /* ThisType */:\n                case 70 /* Identifier */:\n                    break;\n                // Cant create the text span\n                default:\n                    return;\n            }\n            var nodeForStartPos = node;\n            while (true) {\n                if (ts.isRightSideOfPropertyAccess(nodeForStartPos) || ts.isRightSideOfQualifiedName(nodeForStartPos)) {\n                    // If on the span is in right side of the the property or qualified name, return the span from the qualified name pos to end of this node\n                    nodeForStartPos = nodeForStartPos.parent;\n                }\n                else if (ts.isNameOfModuleDeclaration(nodeForStartPos)) {\n                    // If this is name of a module declarations, check if this is right side of dotted module name\n                    // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of\n                    // Then this name is name from dotted module\n                    if (nodeForStartPos.parent.parent.kind === 230 /* ModuleDeclaration */ &&\n                        nodeForStartPos.parent.parent.body === nodeForStartPos.parent) {\n                        // Use parent module declarations name for start pos\n                        nodeForStartPos = nodeForStartPos.parent.parent.name;\n                    }\n                    else {\n                        // We have to use this name for start pos\n                        break;\n                    }\n                }\n                else {\n                    // Is not a member expression so we have found the node for start pos\n                    break;\n                }\n            }\n            return ts.createTextSpanFromBounds(nodeForStartPos.getStart(), node.getEnd());\n        }\n        function getBreakpointStatementAtPosition(fileName, position) {\n            // doesn't use compiler - no need to synchronize with host\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            return ts.BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position);\n        }\n        function getNavigationBarItems(fileName) {\n            return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName));\n        }\n        function getNavigationTree(fileName) {\n            return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName));\n        }\n        function isTsOrTsxFile(fileName) {\n            var kind = ts.getScriptKind(fileName, host);\n            return kind === 3 /* TS */ || kind === 4 /* TSX */;\n        }\n        function getSemanticClassifications(fileName, span) {\n            if (!isTsOrTsxFile(fileName)) {\n                // do not run semantic classification on non-ts-or-tsx files\n                return [];\n            }\n            synchronizeHostData();\n            return ts.getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);\n        }\n        function getEncodedSemanticClassifications(fileName, span) {\n            if (!isTsOrTsxFile(fileName)) {\n                // do not run semantic classification on non-ts-or-tsx files\n                return { spans: [], endOfLineState: 0 /* None */ };\n            }\n            synchronizeHostData();\n            return ts.getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);\n        }\n        function getSyntacticClassifications(fileName, span) {\n            // doesn't use compiler - no need to synchronize with host\n            return ts.getSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span);\n        }\n        function getEncodedSyntacticClassifications(fileName, span) {\n            // doesn't use compiler - no need to synchronize with host\n            return ts.getEncodedSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span);\n        }\n        function getOutliningSpans(fileName) {\n            // doesn't use compiler - no need to synchronize with host\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            return ts.OutliningElementsCollector.collectElements(sourceFile);\n        }\n        function getBraceMatchingAtPosition(fileName, position) {\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            var result = [];\n            var token = ts.getTouchingToken(sourceFile, position);\n            if (token.getStart(sourceFile) === position) {\n                var matchKind = getMatchingTokenKind(token);\n                // Ensure that there is a corresponding token to match ours.\n                if (matchKind) {\n                    var parentElement = token.parent;\n                    var childNodes = parentElement.getChildren(sourceFile);\n                    for (var _i = 0, childNodes_1 = childNodes; _i < childNodes_1.length; _i++) {\n                        var current = childNodes_1[_i];\n                        if (current.kind === matchKind) {\n                            var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile));\n                            var range2 = ts.createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile));\n                            // We want to order the braces when we return the result.\n                            if (range1.start < range2.start) {\n                                result.push(range1, range2);\n                            }\n                            else {\n                                result.push(range2, range1);\n                            }\n                            break;\n                        }\n                    }\n                }\n            }\n            return result;\n            function getMatchingTokenKind(token) {\n                switch (token.kind) {\n                    case 16 /* OpenBraceToken */: return 17 /* CloseBraceToken */;\n                    case 18 /* OpenParenToken */: return 19 /* CloseParenToken */;\n                    case 20 /* OpenBracketToken */: return 21 /* CloseBracketToken */;\n                    case 26 /* LessThanToken */: return 28 /* GreaterThanToken */;\n                    case 17 /* CloseBraceToken */: return 16 /* OpenBraceToken */;\n                    case 19 /* CloseParenToken */: return 18 /* OpenParenToken */;\n                    case 21 /* CloseBracketToken */: return 20 /* OpenBracketToken */;\n                    case 28 /* GreaterThanToken */: return 26 /* LessThanToken */;\n                }\n                return undefined;\n            }\n        }\n        function getIndentationAtPosition(fileName, position, editorOptions) {\n            var start = ts.timestamp();\n            var settings = toEditorSettings(editorOptions);\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            log(\"getIndentationAtPosition: getCurrentSourceFile: \" + (ts.timestamp() - start));\n            start = ts.timestamp();\n            var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, settings);\n            log(\"getIndentationAtPosition: computeIndentation  : \" + (ts.timestamp() - start));\n            return result;\n        }\n        function getFormattingEditsForRange(fileName, start, end, options) {\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            var settings = toEditorSettings(options);\n            return ts.formatting.formatSelection(start, end, sourceFile, getRuleProvider(settings), settings);\n        }\n        function getFormattingEditsForDocument(fileName, options) {\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            var settings = toEditorSettings(options);\n            return ts.formatting.formatDocument(sourceFile, getRuleProvider(settings), settings);\n        }\n        function getFormattingEditsAfterKeystroke(fileName, position, key, options) {\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            var settings = toEditorSettings(options);\n            if (key === \"}\") {\n                return ts.formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(settings), settings);\n            }\n            else if (key === \";\") {\n                return ts.formatting.formatOnSemicolon(position, sourceFile, getRuleProvider(settings), settings);\n            }\n            else if (key === \"\\n\") {\n                return ts.formatting.formatOnEnter(position, sourceFile, getRuleProvider(settings), settings);\n            }\n            return [];\n        }\n        function getCodeFixesAtPosition(fileName, start, end, errorCodes) {\n            synchronizeHostData();\n            var sourceFile = getValidSourceFile(fileName);\n            var span = { start: start, length: end - start };\n            var newLineChar = ts.getNewLineOrDefaultFromHost(host);\n            var allFixes = [];\n            ts.forEach(errorCodes, function (error) {\n                cancellationToken.throwIfCancellationRequested();\n                var context = {\n                    errorCode: error,\n                    sourceFile: sourceFile,\n                    span: span,\n                    program: program,\n                    newLineCharacter: newLineChar,\n                    host: host,\n                    cancellationToken: cancellationToken\n                };\n                var fixes = ts.codefix.getFixes(context);\n                if (fixes) {\n                    allFixes = allFixes.concat(fixes);\n                }\n            });\n            return allFixes;\n        }\n        function getDocCommentTemplateAtPosition(fileName, position) {\n            return ts.JsDoc.getDocCommentTemplateAtPosition(ts.getNewLineOrDefaultFromHost(host), syntaxTreeCache.getCurrentSourceFile(fileName), position);\n        }\n        function isValidBraceCompletionAtPosition(fileName, position, openingBrace) {\n            // '<' is currently not supported, figuring out if we're in a Generic Type vs. a comparison is too\n            // expensive to do during typing scenarios\n            // i.e. whether we're dealing with:\n            //      var x = new foo<| ( with class foo<T>{} )\n            // or\n            //      var y = 3 <|\n            if (openingBrace === 60 /* lessThan */) {\n                return false;\n            }\n            var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);\n            // Check if in a context where we don't want to perform any insertion\n            if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position)) {\n                return false;\n            }\n            if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) {\n                return openingBrace === 123 /* openBrace */;\n            }\n            if (ts.isInTemplateString(sourceFile, position)) {\n                return false;\n            }\n            return true;\n        }\n        function getTodoComments(fileName, descriptors) {\n            // Note: while getting todo comments seems like a syntactic operation, we actually\n            // treat it as a semantic operation here.  This is because we expect our host to call\n            // this on every single file.  If we treat this syntactically, then that will cause\n            // us to populate and throw away the tree in our syntax tree cache for each file.  By\n            // treating this as a semantic operation, we can access any tree without throwing\n            // anything away.\n            synchronizeHostData();\n            var sourceFile = getValidSourceFile(fileName);\n            cancellationToken.throwIfCancellationRequested();\n            var fileContents = sourceFile.text;\n            var result = [];\n            if (descriptors.length > 0) {\n                var regExp = getTodoCommentsRegExp();\n                var matchArray = void 0;\n                while (matchArray = regExp.exec(fileContents)) {\n                    cancellationToken.throwIfCancellationRequested();\n                    // If we got a match, here is what the match array will look like.  Say the source text is:\n                    //\n                    //      \"    // hack   1\"\n                    //\n                    // The result array with the regexp:    will be:\n                    //\n                    //      [\"// hack   1\", \"// \", \"hack   1\", undefined, \"hack\"]\n                    //\n                    // Here are the relevant capture groups:\n                    //  0) The full match for the entire regexp.\n                    //  1) The preamble to the message portion.\n                    //  2) The message portion.\n                    //  3...N) The descriptor that was matched - by index.  'undefined' for each\n                    //         descriptor that didn't match.  an actual value if it did match.\n                    //\n                    //  i.e. 'undefined' in position 3 above means TODO(jason) didn't match.\n                    //       \"hack\"      in position 4 means HACK did match.\n                    var firstDescriptorCaptureIndex = 3;\n                    ts.Debug.assert(matchArray.length === descriptors.length + firstDescriptorCaptureIndex);\n                    var preamble = matchArray[1];\n                    var matchPosition = matchArray.index + preamble.length;\n                    // OK, we have found a match in the file.  This is only an acceptable match if\n                    // it is contained within a comment.\n                    var token = ts.getTokenAtPosition(sourceFile, matchPosition);\n                    if (!ts.isInsideComment(sourceFile, token, matchPosition)) {\n                        continue;\n                    }\n                    var descriptor = undefined;\n                    for (var i = 0, n = descriptors.length; i < n; i++) {\n                        if (matchArray[i + firstDescriptorCaptureIndex]) {\n                            descriptor = descriptors[i];\n                        }\n                    }\n                    ts.Debug.assert(descriptor !== undefined);\n                    // We don't want to match something like 'TODOBY', so we make sure a non\n                    // letter/digit follows the match.\n                    if (isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor.text.length))) {\n                        continue;\n                    }\n                    var message = matchArray[2];\n                    result.push({\n                        descriptor: descriptor,\n                        message: message,\n                        position: matchPosition\n                    });\n                }\n            }\n            return result;\n            function escapeRegExp(str) {\n                return str.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\");\n            }\n            function getTodoCommentsRegExp() {\n                // NOTE: ?:  means 'non-capture group'.  It allows us to have groups without having to\n                // filter them out later in the final result array.\n                // TODO comments can appear in one of the following forms:\n                //\n                //  1)      // TODO     or  /////////// TODO\n                //\n                //  2)      /* TODO     or  /********** TODO\n                //\n                //  3)      /*\n                //           *   TODO\n                //           */\n                //\n                // The following three regexps are used to match the start of the text up to the TODO\n                // comment portion.\n                var singleLineCommentStart = /(?:\\/\\/+\\s*)/.source;\n                var multiLineCommentStart = /(?:\\/\\*+\\s*)/.source;\n                var anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\\s|\\*)*)/.source;\n                // Match any of the above three TODO comment start regexps.\n                // Note that the outermost group *is* a capture group.  We want to capture the preamble\n                // so that we can determine the starting position of the TODO comment match.\n                var preamble = \"(\" + anyNumberOfSpacesAndAsterisksAtStartOfLine + \"|\" + singleLineCommentStart + \"|\" + multiLineCommentStart + \")\";\n                // Takes the descriptors and forms a regexp that matches them as if they were literals.\n                // For example, if the descriptors are \"TODO(jason)\" and \"HACK\", then this will be:\n                //\n                //      (?:(TODO\\(jason\\))|(HACK))\n                //\n                // Note that the outermost group is *not* a capture group, but the innermost groups\n                // *are* capture groups.  By capturing the inner literals we can determine after\n                // matching which descriptor we are dealing with.\n                var literals = \"(?:\" + ts.map(descriptors, function (d) { return \"(\" + escapeRegExp(d.text) + \")\"; }).join(\"|\") + \")\";\n                // After matching a descriptor literal, the following regexp matches the rest of the\n                // text up to the end of the line (or */).\n                var endOfLineOrEndOfComment = /(?:$|\\*\\/)/.source;\n                var messageRemainder = /(?:.*?)/.source;\n                // This is the portion of the match we'll return as part of the TODO comment result. We\n                // match the literal portion up to the end of the line or end of comment.\n                var messagePortion = \"(\" + literals + messageRemainder + \")\";\n                var regExpString = preamble + messagePortion + endOfLineOrEndOfComment;\n                // The final regexp will look like this:\n                // /((?:\\/\\/+\\s*)|(?:\\/\\*+\\s*)|(?:^(?:\\s|\\*)*))((?:(TODO\\(jason\\))|(HACK))(?:.*?))(?:$|\\*\\/)/gim\n                // The flags of the regexp are important here.\n                //  'g' is so that we are doing a global search and can find matches several times\n                //  in the input.\n                //\n                //  'i' is for case insensitivity (We do this to match C# TODO comment code).\n                //\n                //  'm' is so we can find matches in a multi-line input.\n                return new RegExp(regExpString, \"gim\");\n            }\n            function isLetterOrDigit(char) {\n                return (char >= 97 /* a */ && char <= 122 /* z */) ||\n                    (char >= 65 /* A */ && char <= 90 /* Z */) ||\n                    (char >= 48 /* _0 */ && char <= 57 /* _9 */);\n            }\n        }\n        function getRenameInfo(fileName, position) {\n            synchronizeHostData();\n            var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings());\n            return ts.Rename.getRenameInfo(program.getTypeChecker(), defaultLibFileName, getCanonicalFileName, getValidSourceFile(fileName), position);\n        }\n        return {\n            dispose: dispose,\n            cleanupSemanticCache: cleanupSemanticCache,\n            getSyntacticDiagnostics: getSyntacticDiagnostics,\n            getSemanticDiagnostics: getSemanticDiagnostics,\n            getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics,\n            getSyntacticClassifications: getSyntacticClassifications,\n            getSemanticClassifications: getSemanticClassifications,\n            getEncodedSyntacticClassifications: getEncodedSyntacticClassifications,\n            getEncodedSemanticClassifications: getEncodedSemanticClassifications,\n            getCompletionsAtPosition: getCompletionsAtPosition,\n            getCompletionEntryDetails: getCompletionEntryDetails,\n            getCompletionEntrySymbol: getCompletionEntrySymbol,\n            getSignatureHelpItems: getSignatureHelpItems,\n            getQuickInfoAtPosition: getQuickInfoAtPosition,\n            getDefinitionAtPosition: getDefinitionAtPosition,\n            getImplementationAtPosition: getImplementationAtPosition,\n            getTypeDefinitionAtPosition: getTypeDefinitionAtPosition,\n            getReferencesAtPosition: getReferencesAtPosition,\n            findReferences: findReferences,\n            getOccurrencesAtPosition: getOccurrencesAtPosition,\n            getDocumentHighlights: getDocumentHighlights,\n            getNameOrDottedNameSpan: getNameOrDottedNameSpan,\n            getBreakpointStatementAtPosition: getBreakpointStatementAtPosition,\n            getNavigateToItems: getNavigateToItems,\n            getRenameInfo: getRenameInfo,\n            findRenameLocations: findRenameLocations,\n            getNavigationBarItems: getNavigationBarItems,\n            getNavigationTree: getNavigationTree,\n            getOutliningSpans: getOutliningSpans,\n            getTodoComments: getTodoComments,\n            getBraceMatchingAtPosition: getBraceMatchingAtPosition,\n            getIndentationAtPosition: getIndentationAtPosition,\n            getFormattingEditsForRange: getFormattingEditsForRange,\n            getFormattingEditsForDocument: getFormattingEditsForDocument,\n            getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke,\n            getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition,\n            isValidBraceCompletionAtPosition: isValidBraceCompletionAtPosition,\n            getCodeFixesAtPosition: getCodeFixesAtPosition,\n            getEmitOutput: getEmitOutput,\n            getNonBoundSourceFile: getNonBoundSourceFile,\n            getSourceFile: getSourceFile,\n            getProgram: getProgram\n        };\n    }\n    ts.createLanguageService = createLanguageService;\n    /* @internal */\n    function getNameTable(sourceFile) {\n        if (!sourceFile.nameTable) {\n            initializeNameTable(sourceFile);\n        }\n        return sourceFile.nameTable;\n    }\n    ts.getNameTable = getNameTable;\n    function initializeNameTable(sourceFile) {\n        var nameTable = ts.createMap();\n        walk(sourceFile);\n        sourceFile.nameTable = nameTable;\n        function walk(node) {\n            switch (node.kind) {\n                case 70 /* Identifier */:\n                    nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1;\n                    break;\n                case 9 /* StringLiteral */:\n                case 8 /* NumericLiteral */:\n                    // We want to store any numbers/strings if they were a name that could be\n                    // related to a declaration.  So, if we have 'import x = require(\"something\")'\n                    // then we want 'something' to be in the name table.  Similarly, if we have\n                    // \"a['propname']\" then we want to store \"propname\" in the name table.\n                    if (ts.isDeclarationName(node) ||\n                        node.parent.kind === 245 /* ExternalModuleReference */ ||\n                        isArgumentOfElementAccessExpression(node) ||\n                        ts.isLiteralComputedPropertyDeclarationName(node)) {\n                        nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1;\n                    }\n                    break;\n                default:\n                    ts.forEachChild(node, walk);\n                    if (node.jsDoc) {\n                        for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {\n                            var jsDoc = _a[_i];\n                            ts.forEachChild(jsDoc, walk);\n                        }\n                    }\n            }\n        }\n    }\n    function isArgumentOfElementAccessExpression(node) {\n        return node &&\n            node.parent &&\n            node.parent.kind === 178 /* ElementAccessExpression */ &&\n            node.parent.argumentExpression === node;\n    }\n    /**\n      * Get the path of the default library files (lib.d.ts) as distributed with the typescript\n      * node package.\n      * The functionality is not supported if the ts module is consumed outside of a node module.\n      */\n    function getDefaultLibFilePath(options) {\n        // Check __dirname is defined and that we are on a node.js system.\n        if (typeof __dirname !== \"undefined\") {\n            return __dirname + ts.directorySeparator + ts.getDefaultLibFileName(options);\n        }\n        throw new Error(\"getDefaultLibFilePath is only supported when consumed as a node module. \");\n    }\n    ts.getDefaultLibFilePath = getDefaultLibFilePath;\n    function initializeServices() {\n        ts.objectAllocator = getServicesObjectAllocator();\n    }\n    initializeServices();\n})(ts || (ts = {}));\n// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0.\n// See LICENSE.txt in the project root for complete license information.\n/// <reference path='services.ts' />\n/* @internal */\nvar ts;\n(function (ts) {\n    var BreakpointResolver;\n    (function (BreakpointResolver) {\n        /**\n         * Get the breakpoint span in given sourceFile\n         */\n        function spanInSourceFileAtLocation(sourceFile, position) {\n            // Cannot set breakpoint in dts file\n            if (sourceFile.isDeclarationFile) {\n                return undefined;\n            }\n            var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position);\n            var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line;\n            if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart(sourceFile)).line > lineOfPosition) {\n                // Get previous token if the token is returned starts on new line\n                // eg: let x =10; |--- cursor is here\n                //     let y = 10;\n                // token at position will return let keyword on second line as the token but we would like to use\n                // token on same line if trailing trivia (comments or white spaces on same line) part of the last token on that line\n                tokenAtLocation = ts.findPrecedingToken(tokenAtLocation.pos, sourceFile);\n                // It's a blank line\n                if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) {\n                    return undefined;\n                }\n            }\n            // Cannot set breakpoint in ambient declarations\n            if (ts.isInAmbientContext(tokenAtLocation)) {\n                return undefined;\n            }\n            // Get the span in the node based on its syntax\n            return spanInNode(tokenAtLocation);\n            function textSpan(startNode, endNode) {\n                var start = startNode.decorators ?\n                    ts.skipTrivia(sourceFile.text, startNode.decorators.end) :\n                    startNode.getStart(sourceFile);\n                return ts.createTextSpanFromBounds(start, (endNode || startNode).getEnd());\n            }\n            function textSpanEndingAtNextToken(startNode, previousTokenToFindNextEndToken) {\n                return textSpan(startNode, ts.findNextToken(previousTokenToFindNextEndToken, previousTokenToFindNextEndToken.parent));\n            }\n            function spanInNodeIfStartsOnSameLine(node, otherwiseOnNode) {\n                if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line) {\n                    return spanInNode(node);\n                }\n                return spanInNode(otherwiseOnNode);\n            }\n            function spanInNodeArray(nodeArray) {\n                return ts.createTextSpanFromBounds(ts.skipTrivia(sourceFile.text, nodeArray.pos), nodeArray.end);\n            }\n            function spanInPreviousNode(node) {\n                return spanInNode(ts.findPrecedingToken(node.pos, sourceFile));\n            }\n            function spanInNextNode(node) {\n                return spanInNode(ts.findNextToken(node, node.parent));\n            }\n            function spanInNode(node) {\n                if (node) {\n                    switch (node.kind) {\n                        case 205 /* VariableStatement */:\n                            // Span on first variable declaration\n                            return spanInVariableDeclaration(node.declarationList.declarations[0]);\n                        case 223 /* VariableDeclaration */:\n                        case 147 /* PropertyDeclaration */:\n                        case 146 /* PropertySignature */:\n                            return spanInVariableDeclaration(node);\n                        case 144 /* Parameter */:\n                            return spanInParameterDeclaration(node);\n                        case 225 /* FunctionDeclaration */:\n                        case 149 /* MethodDeclaration */:\n                        case 148 /* MethodSignature */:\n                        case 151 /* GetAccessor */:\n                        case 152 /* SetAccessor */:\n                        case 150 /* Constructor */:\n                        case 184 /* FunctionExpression */:\n                        case 185 /* ArrowFunction */:\n                            return spanInFunctionDeclaration(node);\n                        case 204 /* Block */:\n                            if (ts.isFunctionBlock(node)) {\n                                return spanInFunctionBlock(node);\n                            }\n                        // Fall through\n                        case 231 /* ModuleBlock */:\n                            return spanInBlock(node);\n                        case 256 /* CatchClause */:\n                            return spanInBlock(node.block);\n                        case 207 /* ExpressionStatement */:\n                            // span on the expression\n                            return textSpan(node.expression);\n                        case 216 /* ReturnStatement */:\n                            // span on return keyword and expression if present\n                            return textSpan(node.getChildAt(0), node.expression);\n                        case 210 /* WhileStatement */:\n                            // Span on while(...)\n                            return textSpanEndingAtNextToken(node, node.expression);\n                        case 209 /* DoStatement */:\n                            // span in statement of the do statement\n                            return spanInNode(node.statement);\n                        case 222 /* DebuggerStatement */:\n                            // span on debugger keyword\n                            return textSpan(node.getChildAt(0));\n                        case 208 /* IfStatement */:\n                            // set on if(..) span\n                            return textSpanEndingAtNextToken(node, node.expression);\n                        case 219 /* LabeledStatement */:\n                            // span in statement\n                            return spanInNode(node.statement);\n                        case 215 /* BreakStatement */:\n                        case 214 /* ContinueStatement */:\n                            // On break or continue keyword and label if present\n                            return textSpan(node.getChildAt(0), node.label);\n                        case 211 /* ForStatement */:\n                            return spanInForStatement(node);\n                        case 212 /* ForInStatement */:\n                            // span of for (a in ...)\n                            return textSpanEndingAtNextToken(node, node.expression);\n                        case 213 /* ForOfStatement */:\n                            // span in initializer\n                            return spanInInitializerOfForLike(node);\n                        case 218 /* SwitchStatement */:\n                            // span on switch(...)\n                            return textSpanEndingAtNextToken(node, node.expression);\n                        case 253 /* CaseClause */:\n                        case 254 /* DefaultClause */:\n                            // span in first statement of the clause\n                            return spanInNode(node.statements[0]);\n                        case 221 /* TryStatement */:\n                            // span in try block\n                            return spanInBlock(node.tryBlock);\n                        case 220 /* ThrowStatement */:\n                            // span in throw ...\n                            return textSpan(node, node.expression);\n                        case 240 /* ExportAssignment */:\n                            // span on export = id\n                            return textSpan(node, node.expression);\n                        case 234 /* ImportEqualsDeclaration */:\n                            // import statement without including semicolon\n                            return textSpan(node, node.moduleReference);\n                        case 235 /* ImportDeclaration */:\n                            // import statement without including semicolon\n                            return textSpan(node, node.moduleSpecifier);\n                        case 241 /* ExportDeclaration */:\n                            // import statement without including semicolon\n                            return textSpan(node, node.moduleSpecifier);\n                        case 230 /* ModuleDeclaration */:\n                            // span on complete module if it is instantiated\n                            if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) {\n                                return undefined;\n                            }\n                        case 226 /* ClassDeclaration */:\n                        case 229 /* EnumDeclaration */:\n                        case 260 /* EnumMember */:\n                        case 174 /* BindingElement */:\n                            // span on complete node\n                            return textSpan(node);\n                        case 217 /* WithStatement */:\n                            // span in statement\n                            return spanInNode(node.statement);\n                        case 145 /* Decorator */:\n                            return spanInNodeArray(node.parent.decorators);\n                        case 172 /* ObjectBindingPattern */:\n                        case 173 /* ArrayBindingPattern */:\n                            return spanInBindingPattern(node);\n                        // No breakpoint in interface, type alias\n                        case 227 /* InterfaceDeclaration */:\n                        case 228 /* TypeAliasDeclaration */:\n                            return undefined;\n                        // Tokens:\n                        case 24 /* SemicolonToken */:\n                        case 1 /* EndOfFileToken */:\n                            return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile));\n                        case 25 /* CommaToken */:\n                            return spanInPreviousNode(node);\n                        case 16 /* OpenBraceToken */:\n                            return spanInOpenBraceToken(node);\n                        case 17 /* CloseBraceToken */:\n                            return spanInCloseBraceToken(node);\n                        case 21 /* CloseBracketToken */:\n                            return spanInCloseBracketToken(node);\n                        case 18 /* OpenParenToken */:\n                            return spanInOpenParenToken(node);\n                        case 19 /* CloseParenToken */:\n                            return spanInCloseParenToken(node);\n                        case 55 /* ColonToken */:\n                            return spanInColonToken(node);\n                        case 28 /* GreaterThanToken */:\n                        case 26 /* LessThanToken */:\n                            return spanInGreaterThanOrLessThanToken(node);\n                        // Keywords:\n                        case 105 /* WhileKeyword */:\n                            return spanInWhileKeyword(node);\n                        case 81 /* ElseKeyword */:\n                        case 73 /* CatchKeyword */:\n                        case 86 /* FinallyKeyword */:\n                            return spanInNextNode(node);\n                        case 140 /* OfKeyword */:\n                            return spanInOfKeyword(node);\n                        default:\n                            // Destructuring pattern in destructuring assignment\n                            // [a, b, c] of\n                            // [a, b, c] = expression\n                            if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node)) {\n                                return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node);\n                            }\n                            // Set breakpoint on identifier element of destructuring pattern\n                            // a or ...c  or d: x from\n                            // [a, b, ...c] or { a, b } or { d: x } from destructuring pattern\n                            if ((node.kind === 70 /* Identifier */ ||\n                                node.kind == 196 /* SpreadElement */ ||\n                                node.kind === 257 /* PropertyAssignment */ ||\n                                node.kind === 258 /* ShorthandPropertyAssignment */) &&\n                                ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {\n                                return textSpan(node);\n                            }\n                            if (node.kind === 192 /* BinaryExpression */) {\n                                var binaryExpression = node;\n                                // Set breakpoint in destructuring pattern if its destructuring assignment\n                                // [a, b, c] or {a, b, c} of\n                                // [a, b, c] = expression or\n                                // {a, b, c} = expression\n                                if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left)) {\n                                    return spanInArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left);\n                                }\n                                if (binaryExpression.operatorToken.kind === 57 /* EqualsToken */ &&\n                                    ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.parent)) {\n                                    // Set breakpoint on assignment expression element of destructuring pattern\n                                    // a = expression of\n                                    // [a = expression, b, c] = someExpression or\n                                    // { a = expression, b, c } = someExpression\n                                    return textSpan(node);\n                                }\n                                if (binaryExpression.operatorToken.kind === 25 /* CommaToken */) {\n                                    return spanInNode(binaryExpression.left);\n                                }\n                            }\n                            if (ts.isPartOfExpression(node)) {\n                                switch (node.parent.kind) {\n                                    case 209 /* DoStatement */:\n                                        // Set span as if on while keyword\n                                        return spanInPreviousNode(node);\n                                    case 145 /* Decorator */:\n                                        // Set breakpoint on the decorator emit\n                                        return spanInNode(node.parent);\n                                    case 211 /* ForStatement */:\n                                    case 213 /* ForOfStatement */:\n                                        return textSpan(node);\n                                    case 192 /* BinaryExpression */:\n                                        if (node.parent.operatorToken.kind === 25 /* CommaToken */) {\n                                            // If this is a comma expression, the breakpoint is possible in this expression\n                                            return textSpan(node);\n                                        }\n                                        break;\n                                    case 185 /* ArrowFunction */:\n                                        if (node.parent.body === node) {\n                                            // If this is body of arrow function, it is allowed to have the breakpoint\n                                            return textSpan(node);\n                                        }\n                                        break;\n                                }\n                            }\n                            // If this is name of property assignment, set breakpoint in the initializer\n                            if (node.parent.kind === 257 /* PropertyAssignment */ &&\n                                node.parent.name === node &&\n                                !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) {\n                                return spanInNode(node.parent.initializer);\n                            }\n                            // Breakpoint in type assertion goes to its operand\n                            if (node.parent.kind === 182 /* TypeAssertionExpression */ && node.parent.type === node) {\n                                return spanInNextNode(node.parent.type);\n                            }\n                            // return type of function go to previous token\n                            if (ts.isFunctionLike(node.parent) && node.parent.type === node) {\n                                return spanInPreviousNode(node);\n                            }\n                            // initializer of variable/parameter declaration go to previous node\n                            if ((node.parent.kind === 223 /* VariableDeclaration */ ||\n                                node.parent.kind === 144 /* Parameter */)) {\n                                var paramOrVarDecl = node.parent;\n                                if (paramOrVarDecl.initializer === node ||\n                                    paramOrVarDecl.type === node ||\n                                    ts.isAssignmentOperator(node.kind)) {\n                                    return spanInPreviousNode(node);\n                                }\n                            }\n                            if (node.parent.kind === 192 /* BinaryExpression */) {\n                                var binaryExpression = node.parent;\n                                if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) &&\n                                    (binaryExpression.right === node ||\n                                        binaryExpression.operatorToken === node)) {\n                                    // If initializer of destructuring assignment move to previous token\n                                    return spanInPreviousNode(node);\n                                }\n                            }\n                            // Default go to parent to set the breakpoint\n                            return spanInNode(node.parent);\n                    }\n                }\n                function textSpanFromVariableDeclaration(variableDeclaration) {\n                    var declarations = variableDeclaration.parent.declarations;\n                    if (declarations && declarations[0] === variableDeclaration) {\n                        // First declaration - include let keyword\n                        return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration);\n                    }\n                    else {\n                        // Span only on this declaration\n                        return textSpan(variableDeclaration);\n                    }\n                }\n                function spanInVariableDeclaration(variableDeclaration) {\n                    // If declaration of for in statement, just set the span in parent\n                    if (variableDeclaration.parent.parent.kind === 212 /* ForInStatement */) {\n                        return spanInNode(variableDeclaration.parent.parent);\n                    }\n                    // If this is a destructuring pattern, set breakpoint in binding pattern\n                    if (ts.isBindingPattern(variableDeclaration.name)) {\n                        return spanInBindingPattern(variableDeclaration.name);\n                    }\n                    // Breakpoint is possible in variableDeclaration only if there is initialization\n                    // or its declaration from 'for of'\n                    if (variableDeclaration.initializer ||\n                        ts.hasModifier(variableDeclaration, 1 /* Export */) ||\n                        variableDeclaration.parent.parent.kind === 213 /* ForOfStatement */) {\n                        return textSpanFromVariableDeclaration(variableDeclaration);\n                    }\n                    var declarations = variableDeclaration.parent.declarations;\n                    if (declarations && declarations[0] !== variableDeclaration) {\n                        // If we cannot set breakpoint on this declaration, set it on previous one\n                        // Because the variable declaration may be binding pattern and\n                        // we would like to set breakpoint in last binding element if that's the case,\n                        // use preceding token instead\n                        return spanInNode(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent));\n                    }\n                }\n                function canHaveSpanInParameterDeclaration(parameter) {\n                    // Breakpoint is possible on parameter only if it has initializer, is a rest parameter, or has public or private modifier\n                    return !!parameter.initializer || parameter.dotDotDotToken !== undefined ||\n                        ts.hasModifier(parameter, 4 /* Public */ | 8 /* Private */);\n                }\n                function spanInParameterDeclaration(parameter) {\n                    if (ts.isBindingPattern(parameter.name)) {\n                        // Set breakpoint in binding pattern\n                        return spanInBindingPattern(parameter.name);\n                    }\n                    else if (canHaveSpanInParameterDeclaration(parameter)) {\n                        return textSpan(parameter);\n                    }\n                    else {\n                        var functionDeclaration = parameter.parent;\n                        var indexOfParameter = ts.indexOf(functionDeclaration.parameters, parameter);\n                        if (indexOfParameter) {\n                            // Not a first parameter, go to previous parameter\n                            return spanInParameterDeclaration(functionDeclaration.parameters[indexOfParameter - 1]);\n                        }\n                        else {\n                            // Set breakpoint in the function declaration body\n                            return spanInNode(functionDeclaration.body);\n                        }\n                    }\n                }\n                function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) {\n                    return ts.hasModifier(functionDeclaration, 1 /* Export */) ||\n                        (functionDeclaration.parent.kind === 226 /* ClassDeclaration */ && functionDeclaration.kind !== 150 /* Constructor */);\n                }\n                function spanInFunctionDeclaration(functionDeclaration) {\n                    // No breakpoints in the function signature\n                    if (!functionDeclaration.body) {\n                        return undefined;\n                    }\n                    if (canFunctionHaveSpanInWholeDeclaration(functionDeclaration)) {\n                        // Set the span on whole function declaration\n                        return textSpan(functionDeclaration);\n                    }\n                    // Set span in function body\n                    return spanInNode(functionDeclaration.body);\n                }\n                function spanInFunctionBlock(block) {\n                    var nodeForSpanInBlock = block.statements.length ? block.statements[0] : block.getLastToken();\n                    if (canFunctionHaveSpanInWholeDeclaration(block.parent)) {\n                        return spanInNodeIfStartsOnSameLine(block.parent, nodeForSpanInBlock);\n                    }\n                    return spanInNode(nodeForSpanInBlock);\n                }\n                function spanInBlock(block) {\n                    switch (block.parent.kind) {\n                        case 230 /* ModuleDeclaration */:\n                            if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) {\n                                return undefined;\n                            }\n                        // Set on parent if on same line otherwise on first statement\n                        case 210 /* WhileStatement */:\n                        case 208 /* IfStatement */:\n                        case 212 /* ForInStatement */:\n                            return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]);\n                        // Set span on previous token if it starts on same line otherwise on the first statement of the block\n                        case 211 /* ForStatement */:\n                        case 213 /* ForOfStatement */:\n                            return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]);\n                    }\n                    // Default action is to set on first statement\n                    return spanInNode(block.statements[0]);\n                }\n                function spanInInitializerOfForLike(forLikeStatement) {\n                    if (forLikeStatement.initializer.kind === 224 /* VariableDeclarationList */) {\n                        // Declaration list - set breakpoint in first declaration\n                        var variableDeclarationList = forLikeStatement.initializer;\n                        if (variableDeclarationList.declarations.length > 0) {\n                            return spanInNode(variableDeclarationList.declarations[0]);\n                        }\n                    }\n                    else {\n                        // Expression - set breakpoint in it\n                        return spanInNode(forLikeStatement.initializer);\n                    }\n                }\n                function spanInForStatement(forStatement) {\n                    if (forStatement.initializer) {\n                        return spanInInitializerOfForLike(forStatement);\n                    }\n                    if (forStatement.condition) {\n                        return textSpan(forStatement.condition);\n                    }\n                    if (forStatement.incrementor) {\n                        return textSpan(forStatement.incrementor);\n                    }\n                }\n                function spanInBindingPattern(bindingPattern) {\n                    // Set breakpoint in first binding element\n                    var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 198 /* OmittedExpression */ ? element : undefined; });\n                    if (firstBindingElement) {\n                        return spanInNode(firstBindingElement);\n                    }\n                    // Empty binding pattern of binding element, set breakpoint on binding element\n                    if (bindingPattern.parent.kind === 174 /* BindingElement */) {\n                        return textSpan(bindingPattern.parent);\n                    }\n                    // Variable declaration is used as the span\n                    return textSpanFromVariableDeclaration(bindingPattern.parent);\n                }\n                function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) {\n                    ts.Debug.assert(node.kind !== 173 /* ArrayBindingPattern */ && node.kind !== 172 /* ObjectBindingPattern */);\n                    var elements = node.kind === 175 /* ArrayLiteralExpression */ ?\n                        node.elements :\n                        node.properties;\n                    var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 198 /* OmittedExpression */ ? element : undefined; });\n                    if (firstBindingElement) {\n                        return spanInNode(firstBindingElement);\n                    }\n                    // Could be ArrayLiteral from destructuring assignment or\n                    // just nested element in another destructuring assignment\n                    // set breakpoint on assignment when parent is destructuring assignment\n                    // Otherwise set breakpoint for this element\n                    return textSpan(node.parent.kind === 192 /* BinaryExpression */ ? node.parent : node);\n                }\n                // Tokens:\n                function spanInOpenBraceToken(node) {\n                    switch (node.parent.kind) {\n                        case 229 /* EnumDeclaration */:\n                            var enumDeclaration = node.parent;\n                            return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile));\n                        case 226 /* ClassDeclaration */:\n                            var classDeclaration = node.parent;\n                            return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile));\n                        case 232 /* CaseBlock */:\n                            return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]);\n                    }\n                    // Default to parent node\n                    return spanInNode(node.parent);\n                }\n                function spanInCloseBraceToken(node) {\n                    switch (node.parent.kind) {\n                        case 231 /* ModuleBlock */:\n                            // If this is not an instantiated module block, no bp span\n                            if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) {\n                                return undefined;\n                            }\n                        case 229 /* EnumDeclaration */:\n                        case 226 /* ClassDeclaration */:\n                            // Span on close brace token\n                            return textSpan(node);\n                        case 204 /* Block */:\n                            if (ts.isFunctionBlock(node.parent)) {\n                                // Span on close brace token\n                                return textSpan(node);\n                            }\n                        // fall through\n                        case 256 /* CatchClause */:\n                            return spanInNode(ts.lastOrUndefined(node.parent.statements));\n                        case 232 /* CaseBlock */:\n                            // breakpoint in last statement of the last clause\n                            var caseBlock = node.parent;\n                            var lastClause = ts.lastOrUndefined(caseBlock.clauses);\n                            if (lastClause) {\n                                return spanInNode(ts.lastOrUndefined(lastClause.statements));\n                            }\n                            return undefined;\n                        case 172 /* ObjectBindingPattern */:\n                            // Breakpoint in last binding element or binding pattern if it contains no elements\n                            var bindingPattern = node.parent;\n                            return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);\n                        // Default to parent node\n                        default:\n                            if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {\n                                // Breakpoint in last binding element or binding pattern if it contains no elements\n                                var objectLiteral = node.parent;\n                                return textSpan(ts.lastOrUndefined(objectLiteral.properties) || objectLiteral);\n                            }\n                            return spanInNode(node.parent);\n                    }\n                }\n                function spanInCloseBracketToken(node) {\n                    switch (node.parent.kind) {\n                        case 173 /* ArrayBindingPattern */:\n                            // Breakpoint in last binding element or binding pattern if it contains no elements\n                            var bindingPattern = node.parent;\n                            return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);\n                        default:\n                            if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {\n                                // Breakpoint in last binding element or binding pattern if it contains no elements\n                                var arrayLiteral = node.parent;\n                                return textSpan(ts.lastOrUndefined(arrayLiteral.elements) || arrayLiteral);\n                            }\n                            // Default to parent node\n                            return spanInNode(node.parent);\n                    }\n                }\n                function spanInOpenParenToken(node) {\n                    if (node.parent.kind === 209 /* DoStatement */ ||\n                        node.parent.kind === 179 /* CallExpression */ ||\n                        node.parent.kind === 180 /* NewExpression */) {\n                        return spanInPreviousNode(node);\n                    }\n                    if (node.parent.kind === 183 /* ParenthesizedExpression */) {\n                        return spanInNextNode(node);\n                    }\n                    // Default to parent node\n                    return spanInNode(node.parent);\n                }\n                function spanInCloseParenToken(node) {\n                    // Is this close paren token of parameter list, set span in previous token\n                    switch (node.parent.kind) {\n                        case 184 /* FunctionExpression */:\n                        case 225 /* FunctionDeclaration */:\n                        case 185 /* ArrowFunction */:\n                        case 149 /* MethodDeclaration */:\n                        case 148 /* MethodSignature */:\n                        case 151 /* GetAccessor */:\n                        case 152 /* SetAccessor */:\n                        case 150 /* Constructor */:\n                        case 210 /* WhileStatement */:\n                        case 209 /* DoStatement */:\n                        case 211 /* ForStatement */:\n                        case 213 /* ForOfStatement */:\n                        case 179 /* CallExpression */:\n                        case 180 /* NewExpression */:\n                        case 183 /* ParenthesizedExpression */:\n                            return spanInPreviousNode(node);\n                        // Default to parent node\n                        default:\n                            return spanInNode(node.parent);\n                    }\n                }\n                function spanInColonToken(node) {\n                    // Is this : specifying return annotation of the function declaration\n                    if (ts.isFunctionLike(node.parent) ||\n                        node.parent.kind === 257 /* PropertyAssignment */ ||\n                        node.parent.kind === 144 /* Parameter */) {\n                        return spanInPreviousNode(node);\n                    }\n                    return spanInNode(node.parent);\n                }\n                function spanInGreaterThanOrLessThanToken(node) {\n                    if (node.parent.kind === 182 /* TypeAssertionExpression */) {\n                        return spanInNextNode(node);\n                    }\n                    return spanInNode(node.parent);\n                }\n                function spanInWhileKeyword(node) {\n                    if (node.parent.kind === 209 /* DoStatement */) {\n                        // Set span on while expression\n                        return textSpanEndingAtNextToken(node, node.parent.expression);\n                    }\n                    // Default to parent node\n                    return spanInNode(node.parent);\n                }\n                function spanInOfKeyword(node) {\n                    if (node.parent.kind === 213 /* ForOfStatement */) {\n                        // Set using next token\n                        return spanInNextNode(node);\n                    }\n                    // Default to parent node\n                    return spanInNode(node.parent);\n                }\n            }\n        }\n        BreakpointResolver.spanInSourceFileAtLocation = spanInSourceFileAtLocation;\n    })(BreakpointResolver = ts.BreakpointResolver || (ts.BreakpointResolver = {}));\n})(ts || (ts = {}));\n//\n// Copyright (c) Microsoft Corporation.  All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//   http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n/// <reference path='services.ts' />\n/* @internal */\nvar debugObjectHost = (function () { return this; })();\n// We need to use 'null' to interface with the managed side.\n/* tslint:disable:no-null-keyword */\n/* tslint:disable:no-in-operator */\n/* @internal */\nvar ts;\n(function (ts) {\n    function logInternalError(logger, err) {\n        if (logger) {\n            logger.log(\"*INTERNAL ERROR* - Exception in typescript services: \" + err.message);\n        }\n    }\n    var ScriptSnapshotShimAdapter = (function () {\n        function ScriptSnapshotShimAdapter(scriptSnapshotShim) {\n            this.scriptSnapshotShim = scriptSnapshotShim;\n        }\n        ScriptSnapshotShimAdapter.prototype.getText = function (start, end) {\n            return this.scriptSnapshotShim.getText(start, end);\n        };\n        ScriptSnapshotShimAdapter.prototype.getLength = function () {\n            return this.scriptSnapshotShim.getLength();\n        };\n        ScriptSnapshotShimAdapter.prototype.getChangeRange = function (oldSnapshot) {\n            var oldSnapshotShim = oldSnapshot;\n            var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim);\n            // TODO: should this be '==='?\n            if (encoded == null) {\n                return null;\n            }\n            var decoded = JSON.parse(encoded);\n            return ts.createTextChangeRange(ts.createTextSpan(decoded.span.start, decoded.span.length), decoded.newLength);\n        };\n        ScriptSnapshotShimAdapter.prototype.dispose = function () {\n            // if scriptSnapshotShim is a COM object then property check becomes method call with no arguments\n            // 'in' does not have this effect\n            if (\"dispose\" in this.scriptSnapshotShim) {\n                this.scriptSnapshotShim.dispose();\n            }\n        };\n        return ScriptSnapshotShimAdapter;\n    }());\n    var LanguageServiceShimHostAdapter = (function () {\n        function LanguageServiceShimHostAdapter(shimHost) {\n            var _this = this;\n            this.shimHost = shimHost;\n            this.loggingEnabled = false;\n            this.tracingEnabled = false;\n            // if shimHost is a COM object then property check will become method call with no arguments.\n            // 'in' does not have this effect.\n            if (\"getModuleResolutionsForFile\" in this.shimHost) {\n                this.resolveModuleNames = function (moduleNames, containingFile) {\n                    var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile));\n                    return ts.map(moduleNames, function (name) {\n                        var result = ts.getProperty(resolutionsInFile, name);\n                        return result ? { resolvedFileName: result, extension: ts.extensionFromPath(result), isExternalLibraryImport: false } : undefined;\n                    });\n                };\n            }\n            if (\"directoryExists\" in this.shimHost) {\n                this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); };\n            }\n            if (\"getTypeReferenceDirectiveResolutionsForFile\" in this.shimHost) {\n                this.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) {\n                    var typeDirectivesForFile = JSON.parse(_this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile));\n                    return ts.map(typeDirectiveNames, function (name) { return ts.getProperty(typeDirectivesForFile, name); });\n                };\n            }\n        }\n        LanguageServiceShimHostAdapter.prototype.log = function (s) {\n            if (this.loggingEnabled) {\n                this.shimHost.log(s);\n            }\n        };\n        LanguageServiceShimHostAdapter.prototype.trace = function (s) {\n            if (this.tracingEnabled) {\n                this.shimHost.trace(s);\n            }\n        };\n        LanguageServiceShimHostAdapter.prototype.error = function (s) {\n            this.shimHost.error(s);\n        };\n        LanguageServiceShimHostAdapter.prototype.getProjectVersion = function () {\n            if (!this.shimHost.getProjectVersion) {\n                // shimmed host does not support getProjectVersion\n                return undefined;\n            }\n            return this.shimHost.getProjectVersion();\n        };\n        LanguageServiceShimHostAdapter.prototype.getTypeRootsVersion = function () {\n            if (!this.shimHost.getTypeRootsVersion) {\n                return 0;\n            }\n            return this.shimHost.getTypeRootsVersion();\n        };\n        LanguageServiceShimHostAdapter.prototype.useCaseSensitiveFileNames = function () {\n            return this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false;\n        };\n        LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () {\n            var settingsJson = this.shimHost.getCompilationSettings();\n            // TODO: should this be '==='?\n            if (settingsJson == null || settingsJson == \"\") {\n                throw Error(\"LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings\");\n            }\n            return JSON.parse(settingsJson);\n        };\n        LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () {\n            var encoded = this.shimHost.getScriptFileNames();\n            return this.files = JSON.parse(encoded);\n        };\n        LanguageServiceShimHostAdapter.prototype.getScriptSnapshot = function (fileName) {\n            var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName);\n            return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot);\n        };\n        LanguageServiceShimHostAdapter.prototype.getScriptKind = function (fileName) {\n            if (\"getScriptKind\" in this.shimHost) {\n                return this.shimHost.getScriptKind(fileName);\n            }\n            else {\n                return 0 /* Unknown */;\n            }\n        };\n        LanguageServiceShimHostAdapter.prototype.getScriptVersion = function (fileName) {\n            return this.shimHost.getScriptVersion(fileName);\n        };\n        LanguageServiceShimHostAdapter.prototype.getLocalizedDiagnosticMessages = function () {\n            var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages();\n            if (diagnosticMessagesJson == null || diagnosticMessagesJson == \"\") {\n                return null;\n            }\n            try {\n                return JSON.parse(diagnosticMessagesJson);\n            }\n            catch (e) {\n                this.log(e.description || \"diagnosticMessages.generated.json has invalid JSON format\");\n                return null;\n            }\n        };\n        LanguageServiceShimHostAdapter.prototype.getCancellationToken = function () {\n            var hostCancellationToken = this.shimHost.getCancellationToken();\n            return new ThrottledCancellationToken(hostCancellationToken);\n        };\n        LanguageServiceShimHostAdapter.prototype.getCurrentDirectory = function () {\n            return this.shimHost.getCurrentDirectory();\n        };\n        LanguageServiceShimHostAdapter.prototype.getDirectories = function (path) {\n            return JSON.parse(this.shimHost.getDirectories(path));\n        };\n        LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) {\n            return this.shimHost.getDefaultLibFileName(JSON.stringify(options));\n        };\n        LanguageServiceShimHostAdapter.prototype.readDirectory = function (path, extensions, exclude, include, depth) {\n            var pattern = ts.getFileMatcherPatterns(path, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory());\n            return JSON.parse(this.shimHost.readDirectory(path, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth));\n        };\n        LanguageServiceShimHostAdapter.prototype.readFile = function (path, encoding) {\n            return this.shimHost.readFile(path, encoding);\n        };\n        LanguageServiceShimHostAdapter.prototype.fileExists = function (path) {\n            return this.shimHost.fileExists(path);\n        };\n        return LanguageServiceShimHostAdapter;\n    }());\n    ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter;\n    /** A cancellation that throttles calls to the host */\n    var ThrottledCancellationToken = (function () {\n        function ThrottledCancellationToken(hostCancellationToken) {\n            this.hostCancellationToken = hostCancellationToken;\n            // Store when we last tried to cancel.  Checking cancellation can be expensive (as we have\n            // to marshall over to the host layer).  So we only bother actually checking once enough\n            // time has passed.\n            this.lastCancellationCheckTime = 0;\n        }\n        ThrottledCancellationToken.prototype.isCancellationRequested = function () {\n            var time = ts.timestamp();\n            var duration = Math.abs(time - this.lastCancellationCheckTime);\n            if (duration > 10) {\n                // Check no more than once every 10 ms.\n                this.lastCancellationCheckTime = time;\n                return this.hostCancellationToken.isCancellationRequested();\n            }\n            return false;\n        };\n        return ThrottledCancellationToken;\n    }());\n    var CoreServicesShimHostAdapter = (function () {\n        function CoreServicesShimHostAdapter(shimHost) {\n            var _this = this;\n            this.shimHost = shimHost;\n            this.useCaseSensitiveFileNames = this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false;\n            if (\"directoryExists\" in this.shimHost) {\n                this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); };\n            }\n            if (\"realpath\" in this.shimHost) {\n                this.realpath = function (path) { return _this.shimHost.realpath(path); };\n            }\n        }\n        CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extensions, exclude, include, depth) {\n            // Wrap the API changes for 2.0 release. This try/catch\n            // should be removed once TypeScript 2.0 has shipped.\n            try {\n                var pattern = ts.getFileMatcherPatterns(rootDir, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory());\n                return JSON.parse(this.shimHost.readDirectory(rootDir, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth));\n            }\n            catch (e) {\n                var results = [];\n                for (var _i = 0, extensions_2 = extensions; _i < extensions_2.length; _i++) {\n                    var extension = extensions_2[_i];\n                    for (var _a = 0, _b = this.readDirectoryFallback(rootDir, extension, exclude); _a < _b.length; _a++) {\n                        var file = _b[_a];\n                        if (!ts.contains(results, file)) {\n                            results.push(file);\n                        }\n                    }\n                }\n                return results;\n            }\n        };\n        CoreServicesShimHostAdapter.prototype.fileExists = function (fileName) {\n            return this.shimHost.fileExists(fileName);\n        };\n        CoreServicesShimHostAdapter.prototype.readFile = function (fileName) {\n            return this.shimHost.readFile(fileName);\n        };\n        CoreServicesShimHostAdapter.prototype.readDirectoryFallback = function (rootDir, extension, exclude) {\n            return JSON.parse(this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)));\n        };\n        CoreServicesShimHostAdapter.prototype.getDirectories = function (path) {\n            return JSON.parse(this.shimHost.getDirectories(path));\n        };\n        return CoreServicesShimHostAdapter;\n    }());\n    ts.CoreServicesShimHostAdapter = CoreServicesShimHostAdapter;\n    function simpleForwardCall(logger, actionDescription, action, logPerformance) {\n        var start;\n        if (logPerformance) {\n            logger.log(actionDescription);\n            start = ts.timestamp();\n        }\n        var result = action();\n        if (logPerformance) {\n            var end = ts.timestamp();\n            logger.log(actionDescription + \" completed in \" + (end - start) + \" msec\");\n            if (typeof result === \"string\") {\n                var str = result;\n                if (str.length > 128) {\n                    str = str.substring(0, 128) + \"...\";\n                }\n                logger.log(\"  result.length=\" + str.length + \", result='\" + JSON.stringify(str) + \"'\");\n            }\n        }\n        return result;\n    }\n    function forwardJSONCall(logger, actionDescription, action, logPerformance) {\n        return forwardCall(logger, actionDescription, /*returnJson*/ true, action, logPerformance);\n    }\n    function forwardCall(logger, actionDescription, returnJson, action, logPerformance) {\n        try {\n            var result = simpleForwardCall(logger, actionDescription, action, logPerformance);\n            return returnJson ? JSON.stringify({ result: result }) : result;\n        }\n        catch (err) {\n            if (err instanceof ts.OperationCanceledException) {\n                return JSON.stringify({ canceled: true });\n            }\n            logInternalError(logger, err);\n            err.description = actionDescription;\n            return JSON.stringify({ error: err });\n        }\n    }\n    var ShimBase = (function () {\n        function ShimBase(factory) {\n            this.factory = factory;\n            factory.registerShim(this);\n        }\n        ShimBase.prototype.dispose = function (_dummy) {\n            this.factory.unregisterShim(this);\n        };\n        return ShimBase;\n    }());\n    function realizeDiagnostics(diagnostics, newLine) {\n        return diagnostics.map(function (d) { return realizeDiagnostic(d, newLine); });\n    }\n    ts.realizeDiagnostics = realizeDiagnostics;\n    function realizeDiagnostic(diagnostic, newLine) {\n        return {\n            message: ts.flattenDiagnosticMessageText(diagnostic.messageText, newLine),\n            start: diagnostic.start,\n            length: diagnostic.length,\n            /// TODO: no need for the tolowerCase call\n            category: ts.DiagnosticCategory[diagnostic.category].toLowerCase(),\n            code: diagnostic.code\n        };\n    }\n    var LanguageServiceShimObject = (function (_super) {\n        __extends(LanguageServiceShimObject, _super);\n        function LanguageServiceShimObject(factory, host, languageService) {\n            var _this = _super.call(this, factory) || this;\n            _this.host = host;\n            _this.languageService = languageService;\n            _this.logPerformance = false;\n            _this.logger = _this.host;\n            return _this;\n        }\n        LanguageServiceShimObject.prototype.forwardJSONCall = function (actionDescription, action) {\n            return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance);\n        };\n        /// DISPOSE\n        /**\n         * Ensure (almost) deterministic release of internal Javascript resources when\n         * some external native objects holds onto us (e.g. Com/Interop).\n         */\n        LanguageServiceShimObject.prototype.dispose = function (dummy) {\n            this.logger.log(\"dispose()\");\n            this.languageService.dispose();\n            this.languageService = null;\n            // force a GC\n            if (debugObjectHost && debugObjectHost.CollectGarbage) {\n                debugObjectHost.CollectGarbage();\n                this.logger.log(\"CollectGarbage()\");\n            }\n            this.logger = null;\n            _super.prototype.dispose.call(this, dummy);\n        };\n        /// REFRESH\n        /**\n         * Update the list of scripts known to the compiler\n         */\n        LanguageServiceShimObject.prototype.refresh = function (throwOnError) {\n            this.forwardJSONCall(\"refresh(\" + throwOnError + \")\", function () { return null; });\n        };\n        LanguageServiceShimObject.prototype.cleanupSemanticCache = function () {\n            var _this = this;\n            this.forwardJSONCall(\"cleanupSemanticCache()\", function () {\n                _this.languageService.cleanupSemanticCache();\n                return null;\n            });\n        };\n        LanguageServiceShimObject.prototype.realizeDiagnostics = function (diagnostics) {\n            var newLine = ts.getNewLineOrDefaultFromHost(this.host);\n            return ts.realizeDiagnostics(diagnostics, newLine);\n        };\n        LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) {\n            var _this = this;\n            return this.forwardJSONCall(\"getSyntacticClassifications('\" + fileName + \"', \" + start + \", \" + length + \")\", function () { return _this.languageService.getSyntacticClassifications(fileName, ts.createTextSpan(start, length)); });\n        };\n        LanguageServiceShimObject.prototype.getSemanticClassifications = function (fileName, start, length) {\n            var _this = this;\n            return this.forwardJSONCall(\"getSemanticClassifications('\" + fileName + \"', \" + start + \", \" + length + \")\", function () { return _this.languageService.getSemanticClassifications(fileName, ts.createTextSpan(start, length)); });\n        };\n        LanguageServiceShimObject.prototype.getEncodedSyntacticClassifications = function (fileName, start, length) {\n            var _this = this;\n            return this.forwardJSONCall(\"getEncodedSyntacticClassifications('\" + fileName + \"', \" + start + \", \" + length + \")\", \n            // directly serialize the spans out to a string.  This is much faster to decode\n            // on the managed side versus a full JSON array.\n            function () { return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); });\n        };\n        LanguageServiceShimObject.prototype.getEncodedSemanticClassifications = function (fileName, start, length) {\n            var _this = this;\n            return this.forwardJSONCall(\"getEncodedSemanticClassifications('\" + fileName + \"', \" + start + \", \" + length + \")\", \n            // directly serialize the spans out to a string.  This is much faster to decode\n            // on the managed side versus a full JSON array.\n            function () { return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); });\n        };\n        LanguageServiceShimObject.prototype.getSyntacticDiagnostics = function (fileName) {\n            var _this = this;\n            return this.forwardJSONCall(\"getSyntacticDiagnostics('\" + fileName + \"')\", function () {\n                var diagnostics = _this.languageService.getSyntacticDiagnostics(fileName);\n                return _this.realizeDiagnostics(diagnostics);\n            });\n        };\n        LanguageServiceShimObject.prototype.getSemanticDiagnostics = function (fileName) {\n            var _this = this;\n            return this.forwardJSONCall(\"getSemanticDiagnostics('\" + fileName + \"')\", function () {\n                var diagnostics = _this.languageService.getSemanticDiagnostics(fileName);\n                return _this.realizeDiagnostics(diagnostics);\n            });\n        };\n        LanguageServiceShimObject.prototype.getCompilerOptionsDiagnostics = function () {\n            var _this = this;\n            return this.forwardJSONCall(\"getCompilerOptionsDiagnostics()\", function () {\n                var diagnostics = _this.languageService.getCompilerOptionsDiagnostics();\n                return _this.realizeDiagnostics(diagnostics);\n            });\n        };\n        /// QUICKINFO\n        /**\n         * Computes a string representation of the type at the requested position\n         * in the active file.\n         */\n        LanguageServiceShimObject.prototype.getQuickInfoAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getQuickInfoAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getQuickInfoAtPosition(fileName, position); });\n        };\n        /// NAMEORDOTTEDNAMESPAN\n        /**\n         * Computes span information of the name or dotted name at the requested position\n         * in the active file.\n         */\n        LanguageServiceShimObject.prototype.getNameOrDottedNameSpan = function (fileName, startPos, endPos) {\n            var _this = this;\n            return this.forwardJSONCall(\"getNameOrDottedNameSpan('\" + fileName + \"', \" + startPos + \", \" + endPos + \")\", function () { return _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); });\n        };\n        /**\n         * STATEMENTSPAN\n         * Computes span information of statement at the requested position in the active file.\n         */\n        LanguageServiceShimObject.prototype.getBreakpointStatementAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getBreakpointStatementAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getBreakpointStatementAtPosition(fileName, position); });\n        };\n        /// SIGNATUREHELP\n        LanguageServiceShimObject.prototype.getSignatureHelpItems = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getSignatureHelpItems('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getSignatureHelpItems(fileName, position); });\n        };\n        /// GOTO DEFINITION\n        /**\n         * Computes the definition location and file for the symbol\n         * at the requested position.\n         */\n        LanguageServiceShimObject.prototype.getDefinitionAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getDefinitionAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getDefinitionAtPosition(fileName, position); });\n        };\n        /// GOTO Type\n        /**\n         * Computes the definition location of the type of the symbol\n         * at the requested position.\n         */\n        LanguageServiceShimObject.prototype.getTypeDefinitionAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getTypeDefinitionAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getTypeDefinitionAtPosition(fileName, position); });\n        };\n        /// GOTO Implementation\n        /**\n         * Computes the implementation location of the symbol\n         * at the requested position.\n         */\n        LanguageServiceShimObject.prototype.getImplementationAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getImplementationAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getImplementationAtPosition(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.getRenameInfo = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getRenameInfo('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getRenameInfo(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments) {\n            var _this = this;\n            return this.forwardJSONCall(\"findRenameLocations('\" + fileName + \"', \" + position + \", \" + findInStrings + \", \" + findInComments + \")\", function () { return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); });\n        };\n        /// GET BRACE MATCHING\n        LanguageServiceShimObject.prototype.getBraceMatchingAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getBraceMatchingAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getBraceMatchingAtPosition(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.isValidBraceCompletionAtPosition = function (fileName, position, openingBrace) {\n            var _this = this;\n            return this.forwardJSONCall(\"isValidBraceCompletionAtPosition('\" + fileName + \"', \" + position + \", \" + openingBrace + \")\", function () { return _this.languageService.isValidBraceCompletionAtPosition(fileName, position, openingBrace); });\n        };\n        /// GET SMART INDENT\n        LanguageServiceShimObject.prototype.getIndentationAtPosition = function (fileName, position, options /*Services.EditorOptions*/) {\n            var _this = this;\n            return this.forwardJSONCall(\"getIndentationAtPosition('\" + fileName + \"', \" + position + \")\", function () {\n                var localOptions = JSON.parse(options);\n                return _this.languageService.getIndentationAtPosition(fileName, position, localOptions);\n            });\n        };\n        /// GET REFERENCES\n        LanguageServiceShimObject.prototype.getReferencesAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getReferencesAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getReferencesAtPosition(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.findReferences = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"findReferences('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.findReferences(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.getOccurrencesAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getOccurrencesAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getOccurrencesAtPosition(fileName, position); });\n        };\n        LanguageServiceShimObject.prototype.getDocumentHighlights = function (fileName, position, filesToSearch) {\n            var _this = this;\n            return this.forwardJSONCall(\"getDocumentHighlights('\" + fileName + \"', \" + position + \")\", function () {\n                var results = _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch));\n                // workaround for VS document highlighting issue - keep only items from the initial file\n                var normalizedName = ts.normalizeSlashes(fileName).toLowerCase();\n                return ts.filter(results, function (r) { return ts.normalizeSlashes(r.fileName).toLowerCase() === normalizedName; });\n            });\n        };\n        /// COMPLETION LISTS\n        /**\n         * Get a string based representation of the completions\n         * to provide at the given source position and providing a member completion\n         * list if requested.\n         */\n        LanguageServiceShimObject.prototype.getCompletionsAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getCompletionsAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getCompletionsAtPosition(fileName, position); });\n        };\n        /** Get a string based representation of a completion list entry details */\n        LanguageServiceShimObject.prototype.getCompletionEntryDetails = function (fileName, position, entryName) {\n            var _this = this;\n            return this.forwardJSONCall(\"getCompletionEntryDetails('\" + fileName + \"', \" + position + \", '\" + entryName + \"')\", function () { return _this.languageService.getCompletionEntryDetails(fileName, position, entryName); });\n        };\n        LanguageServiceShimObject.prototype.getFormattingEditsForRange = function (fileName, start, end, options /*Services.FormatCodeOptions*/) {\n            var _this = this;\n            return this.forwardJSONCall(\"getFormattingEditsForRange('\" + fileName + \"', \" + start + \", \" + end + \")\", function () {\n                var localOptions = JSON.parse(options);\n                return _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions);\n            });\n        };\n        LanguageServiceShimObject.prototype.getFormattingEditsForDocument = function (fileName, options /*Services.FormatCodeOptions*/) {\n            var _this = this;\n            return this.forwardJSONCall(\"getFormattingEditsForDocument('\" + fileName + \"')\", function () {\n                var localOptions = JSON.parse(options);\n                return _this.languageService.getFormattingEditsForDocument(fileName, localOptions);\n            });\n        };\n        LanguageServiceShimObject.prototype.getFormattingEditsAfterKeystroke = function (fileName, position, key, options /*Services.FormatCodeOptions*/) {\n            var _this = this;\n            return this.forwardJSONCall(\"getFormattingEditsAfterKeystroke('\" + fileName + \"', \" + position + \", '\" + key + \"')\", function () {\n                var localOptions = JSON.parse(options);\n                return _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions);\n            });\n        };\n        LanguageServiceShimObject.prototype.getDocCommentTemplateAtPosition = function (fileName, position) {\n            var _this = this;\n            return this.forwardJSONCall(\"getDocCommentTemplateAtPosition('\" + fileName + \"', \" + position + \")\", function () { return _this.languageService.getDocCommentTemplateAtPosition(fileName, position); });\n        };\n        /// NAVIGATE TO\n        /** Return a list of symbols that are interesting to navigate to */\n        LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount, fileName) {\n            var _this = this;\n            return this.forwardJSONCall(\"getNavigateToItems('\" + searchValue + \"', \" + maxResultCount + \", \" + fileName + \")\", function () { return _this.languageService.getNavigateToItems(searchValue, maxResultCount, fileName); });\n        };\n        LanguageServiceShimObject.prototype.getNavigationBarItems = function (fileName) {\n            var _this = this;\n            return this.forwardJSONCall(\"getNavigationBarItems('\" + fileName + \"')\", function () { return _this.languageService.getNavigationBarItems(fileName); });\n        };\n        LanguageServiceShimObject.prototype.getNavigationTree = function (fileName) {\n            var _this = this;\n            return this.forwardJSONCall(\"getNavigationTree('\" + fileName + \"')\", function () { return _this.languageService.getNavigationTree(fileName); });\n        };\n        LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) {\n            var _this = this;\n            return this.forwardJSONCall(\"getOutliningSpans('\" + fileName + \"')\", function () { return _this.languageService.getOutliningSpans(fileName); });\n        };\n        LanguageServiceShimObject.prototype.getTodoComments = function (fileName, descriptors) {\n            var _this = this;\n            return this.forwardJSONCall(\"getTodoComments('\" + fileName + \"')\", function () { return _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); });\n        };\n        /// Emit\n        LanguageServiceShimObject.prototype.getEmitOutput = function (fileName) {\n            var _this = this;\n            return this.forwardJSONCall(\"getEmitOutput('\" + fileName + \"')\", function () { return _this.languageService.getEmitOutput(fileName); });\n        };\n        LanguageServiceShimObject.prototype.getEmitOutputObject = function (fileName) {\n            var _this = this;\n            return forwardCall(this.logger, \"getEmitOutput('\" + fileName + \"')\", \n            /*returnJson*/ false, function () { return _this.languageService.getEmitOutput(fileName); }, this.logPerformance);\n        };\n        return LanguageServiceShimObject;\n    }(ShimBase));\n    function convertClassifications(classifications) {\n        return { spans: classifications.spans.join(\",\"), endOfLineState: classifications.endOfLineState };\n    }\n    var ClassifierShimObject = (function (_super) {\n        __extends(ClassifierShimObject, _super);\n        function ClassifierShimObject(factory, logger) {\n            var _this = _super.call(this, factory) || this;\n            _this.logger = logger;\n            _this.logPerformance = false;\n            _this.classifier = ts.createClassifier();\n            return _this;\n        }\n        ClassifierShimObject.prototype.getEncodedLexicalClassifications = function (text, lexState, syntacticClassifierAbsent) {\n            var _this = this;\n            return forwardJSONCall(this.logger, \"getEncodedLexicalClassifications\", function () { return convertClassifications(_this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)); }, this.logPerformance);\n        };\n        /// COLORIZATION\n        ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) {\n            var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics);\n            var result = \"\";\n            for (var _i = 0, _a = classification.entries; _i < _a.length; _i++) {\n                var item = _a[_i];\n                result += item.length + \"\\n\";\n                result += item.classification + \"\\n\";\n            }\n            result += classification.finalLexState;\n            return result;\n        };\n        return ClassifierShimObject;\n    }(ShimBase));\n    var CoreServicesShimObject = (function (_super) {\n        __extends(CoreServicesShimObject, _super);\n        function CoreServicesShimObject(factory, logger, host) {\n            var _this = _super.call(this, factory) || this;\n            _this.logger = logger;\n            _this.host = host;\n            _this.logPerformance = false;\n            return _this;\n        }\n        CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) {\n            return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance);\n        };\n        CoreServicesShimObject.prototype.resolveModuleName = function (fileName, moduleName, compilerOptionsJson) {\n            var _this = this;\n            return this.forwardJSONCall(\"resolveModuleName('\" + fileName + \"')\", function () {\n                var compilerOptions = JSON.parse(compilerOptionsJson);\n                var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host);\n                var resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined;\n                if (resolvedFileName && !compilerOptions.allowJs && ts.fileExtensionIs(resolvedFileName, \".js\")) {\n                    return {\n                        resolvedFileName: undefined,\n                        failedLookupLocations: []\n                    };\n                }\n                return {\n                    resolvedFileName: resolvedFileName,\n                    failedLookupLocations: result.failedLookupLocations\n                };\n            });\n        };\n        CoreServicesShimObject.prototype.resolveTypeReferenceDirective = function (fileName, typeReferenceDirective, compilerOptionsJson) {\n            var _this = this;\n            return this.forwardJSONCall(\"resolveTypeReferenceDirective(\" + fileName + \")\", function () {\n                var compilerOptions = JSON.parse(compilerOptionsJson);\n                var result = ts.resolveTypeReferenceDirective(typeReferenceDirective, ts.normalizeSlashes(fileName), compilerOptions, _this.host);\n                return {\n                    resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : undefined,\n                    primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true,\n                    failedLookupLocations: result.failedLookupLocations\n                };\n            });\n        };\n        CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) {\n            var _this = this;\n            return this.forwardJSONCall(\"getPreProcessedFileInfo('\" + fileName + \"')\", function () {\n                // for now treat files as JavaScript\n                var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), /* readImportFiles */ true, /* detectJavaScriptImports */ true);\n                return {\n                    referencedFiles: _this.convertFileReferences(result.referencedFiles),\n                    importedFiles: _this.convertFileReferences(result.importedFiles),\n                    ambientExternalModules: result.ambientExternalModules,\n                    isLibFile: result.isLibFile,\n                    typeReferenceDirectives: _this.convertFileReferences(result.typeReferenceDirectives)\n                };\n            });\n        };\n        CoreServicesShimObject.prototype.getAutomaticTypeDirectiveNames = function (compilerOptionsJson) {\n            var _this = this;\n            return this.forwardJSONCall(\"getAutomaticTypeDirectiveNames('\" + compilerOptionsJson + \"')\", function () {\n                var compilerOptions = JSON.parse(compilerOptionsJson);\n                return ts.getAutomaticTypeDirectiveNames(compilerOptions, _this.host);\n            });\n        };\n        CoreServicesShimObject.prototype.convertFileReferences = function (refs) {\n            if (!refs) {\n                return undefined;\n            }\n            var result = [];\n            for (var _i = 0, refs_2 = refs; _i < refs_2.length; _i++) {\n                var ref = refs_2[_i];\n                result.push({\n                    path: ts.normalizeSlashes(ref.fileName),\n                    position: ref.pos,\n                    length: ref.end - ref.pos\n                });\n            }\n            return result;\n        };\n        CoreServicesShimObject.prototype.getTSConfigFileInfo = function (fileName, sourceTextSnapshot) {\n            var _this = this;\n            return this.forwardJSONCall(\"getTSConfigFileInfo('\" + fileName + \"')\", function () {\n                var text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength());\n                var result = ts.parseConfigFileTextToJson(fileName, text);\n                if (result.error) {\n                    return {\n                        options: {},\n                        typeAcquisition: {},\n                        files: [],\n                        raw: {},\n                        errors: [realizeDiagnostic(result.error, \"\\r\\n\")]\n                    };\n                }\n                var normalizedFileName = ts.normalizeSlashes(fileName);\n                var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), /*existingOptions*/ {}, normalizedFileName);\n                return {\n                    options: configFile.options,\n                    typeAcquisition: configFile.typeAcquisition,\n                    files: configFile.fileNames,\n                    raw: configFile.raw,\n                    errors: realizeDiagnostics(configFile.errors, \"\\r\\n\")\n                };\n            });\n        };\n        CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () {\n            return this.forwardJSONCall(\"getDefaultCompilationSettings()\", function () { return ts.getDefaultCompilerOptions(); });\n        };\n        CoreServicesShimObject.prototype.discoverTypings = function (discoverTypingsJson) {\n            var _this = this;\n            var getCanonicalFileName = ts.createGetCanonicalFileName(/*useCaseSensitivefileNames:*/ false);\n            return this.forwardJSONCall(\"discoverTypings()\", function () {\n                var info = JSON.parse(discoverTypingsJson);\n                return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typeAcquisition, info.unresolvedImports);\n            });\n        };\n        return CoreServicesShimObject;\n    }(ShimBase));\n    var TypeScriptServicesFactory = (function () {\n        function TypeScriptServicesFactory() {\n            this._shims = [];\n        }\n        /*\n         * Returns script API version.\n         */\n        TypeScriptServicesFactory.prototype.getServicesVersion = function () {\n            return ts.servicesVersion;\n        };\n        TypeScriptServicesFactory.prototype.createLanguageServiceShim = function (host) {\n            try {\n                if (this.documentRegistry === undefined) {\n                    this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory());\n                }\n                var hostAdapter = new LanguageServiceShimHostAdapter(host);\n                var languageService = ts.createLanguageService(hostAdapter, this.documentRegistry);\n                return new LanguageServiceShimObject(this, host, languageService);\n            }\n            catch (err) {\n                logInternalError(host, err);\n                throw err;\n            }\n        };\n        TypeScriptServicesFactory.prototype.createClassifierShim = function (logger) {\n            try {\n                return new ClassifierShimObject(this, logger);\n            }\n            catch (err) {\n                logInternalError(logger, err);\n                throw err;\n            }\n        };\n        TypeScriptServicesFactory.prototype.createCoreServicesShim = function (host) {\n            try {\n                var adapter = new CoreServicesShimHostAdapter(host);\n                return new CoreServicesShimObject(this, host, adapter);\n            }\n            catch (err) {\n                logInternalError(host, err);\n                throw err;\n            }\n        };\n        TypeScriptServicesFactory.prototype.close = function () {\n            // Forget all the registered shims\n            this._shims = [];\n            this.documentRegistry = undefined;\n        };\n        TypeScriptServicesFactory.prototype.registerShim = function (shim) {\n            this._shims.push(shim);\n        };\n        TypeScriptServicesFactory.prototype.unregisterShim = function (shim) {\n            for (var i = 0, n = this._shims.length; i < n; i++) {\n                if (this._shims[i] === shim) {\n                    delete this._shims[i];\n                    return;\n                }\n            }\n            throw new Error(\"Invalid operation\");\n        };\n        return TypeScriptServicesFactory;\n    }());\n    ts.TypeScriptServicesFactory = TypeScriptServicesFactory;\n    if (typeof module !== \"undefined\" && module.exports) {\n        module.exports = ts;\n    }\n})(ts || (ts = {}));\n/* tslint:enable:no-in-operator */\n/* tslint:enable:no-null */\n/// TODO: this is used by VS, clean this up on both sides of the interface\n/* @internal */\nvar TypeScript;\n(function (TypeScript) {\n    var Services;\n    (function (Services) {\n        Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory;\n    })(Services = TypeScript.Services || (TypeScript.Services = {}));\n})(TypeScript || (TypeScript = {}));\n// 'toolsVersion' gets consumed by the managed side, so it's not unused.\n// TODO: it should be moved into a namespace though.\n/* @internal */\nvar toolsVersion = \"2.1\";\n"
  },
  {
    "path": "dist/android-ui.d.ts",
    "content": "declare module java.util {\n    interface List<T> {\n        size(): number;\n        isEmpty(): boolean;\n        contains(o: T): any;\n        indexOf(o: T): any;\n        lastIndexOf(o: T): any;\n        clone(): List<T>;\n        toArray(a: Array<T>): Array<T>;\n        getArray(): Array<T>;\n        get(index: number): T;\n        set(index: number, element: T): T;\n        add(t: T): any;\n        add(index: number, t: T): any;\n        remove(o: number | T): any;\n        clear(): any;\n        addAll(list: List<T>): any;\n        addAll(index: number, list: List<T>): any;\n        removeAll(list: List<T>): boolean;\n        subList(fromIndex: number, toIndex: number): List<T>;\n        sort(compareFn?: (a: T, b: T) => number): any;\n    }\n}\ndeclare module java.util {\n    class ArrayList<T> implements List<T> {\n        array: Array<T>;\n        constructor(initialCapacity?: number);\n        size(): number;\n        isEmpty(): boolean;\n        contains(o: T): boolean;\n        indexOf(o: T): number;\n        lastIndexOf(o: T): number;\n        clone(): ArrayList<T>;\n        toArray(a?: T[]): Array<T>;\n        getArray(): Array<T>;\n        get(index: number): T;\n        set(index: number, element: T): T;\n        add(t: T): any;\n        add(index: number, t: T): any;\n        remove(o: number | T): T;\n        clear(): void;\n        addAll(list: ArrayList<T>): any;\n        addAll(index: number, list: ArrayList<T>): any;\n        removeAll(list: ArrayList<T>): boolean;\n        [Symbol.iterator](): () => IterableIterator<T>;\n        subList(fromIndex: number, toIndex: number): ArrayList<T>;\n        toString(): string;\n        sort(compareFn?: (a: T, b: T) => number): void;\n    }\n}\ndeclare module android.os {\n    class Bundle {\n        constructor(copy?: Bundle);\n        get(key: string, defaultValue: any): any;\n        put(key: string, value: any): void;\n        containsKey(key: string): boolean;\n    }\n}\ndeclare module java.lang {\n    class StringBuilder {\n        array: Array<string>;\n        constructor();\n        constructor(capacity: number);\n        constructor(str: string);\n        length(): number;\n        append(a: any): StringBuilder;\n        deleteCharAt(index: number): StringBuilder;\n        replace(start: number, end: number, str: string): StringBuilder;\n        setLength(length: number): void;\n        toString(): string;\n    }\n}\ndeclare module android.graphics {\n    import StringBuilder = java.lang.StringBuilder;\n    class Rect {\n        left: number;\n        top: number;\n        right: number;\n        bottom: number;\n        constructor();\n        constructor(r: Rect);\n        constructor(left: number, top: number, right: number, bottom: number);\n        equals(r: Rect): boolean;\n        toString(): string;\n        toShortString(sb?: StringBuilder): string;\n        flattenToString(): string;\n        static unflattenFromString(str: string): Rect;\n        isEmpty(): boolean;\n        width(): number;\n        height(): number;\n        centerX(): number;\n        centerY(): number;\n        exactCenterX(): number;\n        exactCenterY(): number;\n        setEmpty(): void;\n        set(src: Rect): any;\n        set(left: any, top: any, right: any, bottom: any): any;\n        offset(dx: any, dy: any): void;\n        offsetTo(newLeft: any, newTop: any): void;\n        inset(dx: any, dy: any): void;\n        contains(x: number, y: number): boolean;\n        contains(left: number, top: number, right: number, bottom: number): boolean;\n        contains(r: Rect): boolean;\n        intersect(r: Rect): boolean;\n        intersect(left: number, top: number, right: number, bottom: number): boolean;\n        setIntersect(a: Rect, b: Rect): boolean;\n        intersects(rect: Rect): boolean;\n        intersects(left: number, top: number, right: number, bottom: number): boolean;\n        static intersects(a: Rect, b: Rect): boolean;\n        union(r: Rect): any;\n        union(x: number, y: number): any;\n        union(left: number, top: number, right: number, bottom: number): any;\n        sort(): void;\n        scale(scale: number): void;\n    }\n}\ndeclare module android.view {\n    import Rect = android.graphics.Rect;\n    class Gravity {\n        static NO_GRAVITY: number;\n        static AXIS_SPECIFIED: number;\n        static AXIS_PULL_BEFORE: number;\n        static AXIS_PULL_AFTER: number;\n        static AXIS_CLIP: number;\n        static AXIS_X_SHIFT: number;\n        static AXIS_Y_SHIFT: number;\n        static TOP: number;\n        static BOTTOM: number;\n        static LEFT: number;\n        static RIGHT: number;\n        static START: number;\n        static END: number;\n        static CENTER_VERTICAL: number;\n        static FILL_VERTICAL: number;\n        static CENTER_HORIZONTAL: number;\n        static FILL_HORIZONTAL: number;\n        static CENTER: number;\n        static FILL: number;\n        static CLIP_VERTICAL: number;\n        static CLIP_HORIZONTAL: number;\n        static HORIZONTAL_GRAVITY_MASK: number;\n        static VERTICAL_GRAVITY_MASK: number;\n        static RELATIVE_HORIZONTAL_GRAVITY_MASK: number;\n        static DISPLAY_CLIP_VERTICAL: number;\n        static DISPLAY_CLIP_HORIZONTAL: number;\n        static apply(gravity: number, w: number, h: number, container: Rect, outRect: Rect, layoutDirection?: number): void;\n        static getAbsoluteGravity(gravity: number, layoutDirection?: number): number;\n        static parseGravity(gravityStr: string, defaultGravity?: number): number;\n    }\n}\ndeclare module android.util {\n    class SparseMap<K, T> {\n        map: Map<K, T>;\n        constructor(initialCapacity?: number);\n        clone(): SparseMap<K, T>;\n        get(key: K, valueIfKeyNotFound?: T): T;\n        delete(key: K): void;\n        remove(key: K): void;\n        removeAt(index: number): void;\n        removeAtRange(index: number, size?: number): void;\n        put(key: K, value: T): void;\n        size(): number;\n        keyAt(index: number): K;\n        valueAt(index: number): T;\n        setValueAt(index: number, value: T): void;\n        indexOfKey(key: K): number;\n        indexOfValue(value: T): number;\n        clear(): void;\n        append(key: any, value: any): void;\n    }\n}\ndeclare module android.util {\n    class SparseArray<T> extends SparseMap<number, T> {\n    }\n}\ndeclare module android.util {\n    class Log {\n        static View_DBG: boolean;\n        static VelocityTracker_DBG: boolean;\n        static DBG_DrawableContainer: boolean;\n        static DBG_StateListDrawable: boolean;\n        static VERBOSE: number;\n        static DEBUG: number;\n        static INFO: number;\n        static WARN: number;\n        static ERROR: number;\n        static ASSERT: number;\n        static PriorityString: string[];\n        static getPriorityString(priority: number): string;\n        static v(tag: string, msg: string, tr?: Error): void;\n        static d(tag: string, msg: string): void;\n        static i(tag: string, msg: string, tr?: Error): void;\n        static w(tag: string, msg: string, tr?: Error): void;\n        static e(tag: string, msg: string, tr?: Error): void;\n        private static getLogMsg(priority, tag, msg);\n    }\n}\ndeclare module android.graphics {\n    class PixelFormat {\n        static UNKNOWN: number;\n        static TRANSLUCENT: number;\n        static TRANSPARENT: number;\n        static OPAQUE: number;\n        static RGBA_8888: number;\n        static RGBX_8888: number;\n        static RGB_888: number;\n        static RGB_565: number;\n    }\n}\ndeclare module java.lang.ref {\n    class WeakReference<T> {\n        weakMap: WeakMap<any, T>;\n        constructor(referent: T);\n        get(): T;\n        set(value: T): void;\n        clear(): void;\n    }\n}\ndeclare module java.lang {\n    interface Runnable {\n        run(): any;\n    }\n    module Runnable {\n        function of(func: () => any): Runnable;\n    }\n}\ndeclare module java.lang {\n    class System {\n        static out: {\n            println(any?: any): void;\n            print(any: any): void;\n        };\n        static currentTimeMillis(): number;\n        static arraycopy(src: any[], srcPos: number, dest: any[], destPos: number, length: number): void;\n    }\n}\ndeclare module androidui.util {\n    class ArrayCreator {\n        static newNumberArray(size: number): Array<number>;\n        static newBooleanArray(size: number): Array<boolean>;\n        static fillArray(array: Array<any>, value: any): void;\n    }\n}\ndeclare module android.util {\n    class StateSet {\n        static WILD_CARD: Array<number>;\n        static NOTHING: Array<number>;\n        static isWildCard(stateSetOrSpec: Array<number>): boolean;\n        static stateSetMatches(stateSpec: Array<number>, stateSetOrState: Array<number> | number): boolean;\n        private static _stateSetMatches_single(stateSpec, state);\n        static trimStateSet(states: Array<number>, newSize: number): Array<number>;\n    }\n}\ndeclare module android.util {\n    class Pools {\n        a: Pools.SimplePool<string>;\n    }\n    module Pools {\n        interface Pool<T> {\n            acquire(): T;\n            release(instance: T): boolean;\n        }\n        class SimplePool<T> implements Pools.Pool<T> {\n            mPool: Array<T>;\n            mPoolSize: number;\n            constructor(maxPoolSize: number);\n            acquire(): T;\n            release(instance: T): boolean;\n            private isInPool(instance);\n        }\n        class SynchronizedPool<T> extends SimplePool<T> {\n        }\n    }\n}\ndeclare module android.graphics {\n    class Color {\n        static BLACK: number;\n        static DKGRAY: number;\n        static GRAY: number;\n        static LTGRAY: number;\n        static WHITE: number;\n        static RED: number;\n        static GREEN: number;\n        static BLUE: number;\n        static YELLOW: number;\n        static CYAN: number;\n        static MAGENTA: number;\n        static TRANSPARENT: number;\n        static alpha(color: number): number;\n        static red(color: number): number;\n        static green(color: number): number;\n        static blue(color: number): number;\n        static rgb(red: number, green: number, blue: number): number;\n        static argb(alpha: number, red: number, green: number, blue: number): number;\n        static rgba(red: number, green: number, blue: number, alpha: number): number;\n        static parseColor(colorString: string, defaultColor?: number): number;\n        static toARGBHex(color: number): string;\n        static toRGBAFunc(color: number): string;\n        static getHtmlColor(color: string): number;\n        static sColorNameMap: Map<String, number>;\n    }\n}\ndeclare module android.graphics {\n    class Paint {\n        private static FontMetrics_Size_Ascent;\n        private static FontMetrics_Size_Bottom;\n        private static FontMetrics_Size_Descent;\n        private static FontMetrics_Size_Leading;\n        private static FontMetrics_Size_Top;\n        static DIRECTION_LTR: number;\n        static DIRECTION_RTL: number;\n        static CURSOR_AFTER: number;\n        static CURSOR_AT_OR_AFTER: number;\n        static CURSOR_BEFORE: number;\n        static CURSOR_AT_OR_BEFORE: number;\n        static CURSOR_AT: number;\n        private static CURSOR_OPT_MAX_VALUE;\n        static ANTI_ALIAS_FLAG: number;\n        static FILTER_BITMAP_FLAG: number;\n        static DITHER_FLAG: number;\n        static UNDERLINE_TEXT_FLAG: number;\n        static STRIKE_THRU_TEXT_FLAG: number;\n        static FAKE_BOLD_TEXT_FLAG: number;\n        static LINEAR_TEXT_FLAG: number;\n        static SUBPIXEL_TEXT_FLAG: number;\n        static DEV_KERN_TEXT_FLAG: number;\n        static LCD_RENDER_TEXT_FLAG: number;\n        static EMBEDDED_BITMAP_TEXT_FLAG: number;\n        static AUTO_HINTING_TEXT_FLAG: number;\n        static VERTICAL_TEXT_FLAG: number;\n        static DEFAULT_PAINT_FLAGS: number;\n        private mTextStyle;\n        private mColor;\n        private mStrokeWidth;\n        private align;\n        private mStrokeCap;\n        private mStrokeJoin;\n        private textSize;\n        private textScaleX;\n        private mFlag;\n        hasShadow: boolean;\n        shadowDx: number;\n        shadowDy: number;\n        shadowRadius: number;\n        shadowColor: number;\n        drawableState: number[];\n        constructor(flag?: number);\n        set(src: Paint): void;\n        private setClassVariablesFrom(paint);\n        getStyle(): Paint.Style;\n        setStyle(style: Paint.Style): void;\n        getFlags(): number;\n        setFlags(flags: number): void;\n        getTextScaleX(): number;\n        setTextScaleX(scaleX: number): void;\n        getColor(): number;\n        setColor(color: number): void;\n        setARGB(a: number, r: number, g: number, b: number): void;\n        getAlpha(): number;\n        setAlpha(alpha: number): void;\n        getStrokeWidth(): number;\n        setStrokeWidth(width: number): void;\n        getStrokeCap(): Paint.Cap;\n        setStrokeCap(cap: Paint.Cap): void;\n        getStrokeJoin(): Paint.Join;\n        setStrokeJoin(join: Paint.Join): void;\n        setAntiAlias(enable: boolean): void;\n        isAntiAlias(): boolean;\n        setShadowLayer(radius: number, dx: number, dy: number, color: number): void;\n        clearShadowLayer(): void;\n        getTextAlign(): Paint.Align;\n        setTextAlign(align: Paint.Align): void;\n        getTextSize(): number;\n        setTextSize(textSize: number): void;\n        ascent(): number;\n        descent(): number;\n        getFontMetricsInt(fmi: Paint.FontMetricsInt): number;\n        getFontMetrics(metrics: Paint.FontMetrics): number;\n        measureText(text: string, index?: number, count?: number): number;\n        getTextWidths_count(text: string, index: number, count: number, widths: number[]): number;\n        getTextWidths_end(text: string, start: number, end: number, widths: number[]): number;\n        getTextWidths_2(text: string, widths: number[]): number;\n        getTextRunAdvances_count(chars: string, index: number, count: number, contextIndex: number, contextCount: number, flags: number, advances: number[], advancesIndex: number): number;\n        getTextRunAdvances_end(text: string, start: number, end: number, contextStart: number, contextEnd: number, flags: number, advances: number[], advancesIndex: number): number;\n        getTextRunCursor_len(text: string, contextStart: number, contextLength: number, flags: number, offset: number, cursorOpt: number): number;\n        getTextRunCursor_end(text: string, contextStart: number, contextEnd: number, flags: number, offset: number, cursorOpt: number): number;\n        isEmpty(): boolean;\n        applyToCanvas(canvas: Canvas): void;\n    }\n    module Paint {\n        enum Align {\n            LEFT = 0,\n            CENTER = 1,\n            RIGHT = 2,\n        }\n        class FontMetrics {\n            top: number;\n            ascent: number;\n            descent: number;\n            bottom: number;\n            leading: number;\n        }\n        class FontMetricsInt {\n            top: number;\n            ascent: number;\n            descent: number;\n            bottom: number;\n            leading: number;\n            toString(): string;\n        }\n        enum Style {\n            FILL = 0,\n            STROKE = 1,\n            FILL_AND_STROKE = 2,\n        }\n        enum Cap {\n            BUTT = 0,\n            ROUND = 1,\n            SQUARE = 2,\n        }\n        enum Join {\n            MITER = 0,\n            ROUND = 1,\n            BEVEL = 2,\n        }\n    }\n}\ndeclare module android.graphics {\n    class Path {\n        reset(): void;\n    }\n}\ndeclare module android.graphics {\n    class Point {\n        x: number;\n        y: number;\n        constructor();\n        constructor(x: number, y: number);\n        constructor(src: Point);\n        set(x: number, y: number): void;\n        negate(): void;\n        offset(dx: number, dy: number): void;\n        equals(x: number, y: number): boolean;\n        equals(o: any): boolean;\n        toString(): String;\n    }\n}\ndeclare module android.graphics {\n    class RectF extends Rect {\n    }\n}\ndeclare module android.graphics {\n    import StringBuilder = java.lang.StringBuilder;\n    import RectF = android.graphics.RectF;\n    class Matrix {\n        static MSCALE_X: number;\n        static MSKEW_X: number;\n        static MTRANS_X: number;\n        static MSKEW_Y: number;\n        static MSCALE_Y: number;\n        static MTRANS_Y: number;\n        static MPERSP_0: number;\n        static MPERSP_1: number;\n        static MPERSP_2: number;\n        private static MATRIX_SIZE;\n        private mValues;\n        static IDENTITY_MATRIX: Matrix;\n        constructor();\n        constructor(src: Matrix);\n        constructor(values: number[]);\n        isIdentity(): boolean;\n        hasPerspective(): boolean;\n        rectStaysRect(): boolean;\n        set(src: Matrix): void;\n        equals(obj: any): boolean;\n        hashCode(): number;\n        reset(): void;\n        setTranslate(dx: number, dy: number): void;\n        setScale(sx: number, sy: number, px?: number, py?: number): void;\n        setRotate(degrees: number, px?: number, py?: number): void;\n        setSinCos(sinValue: number, cosValue: number, px?: number, py?: number): void;\n        setSkew(kx: number, ky: number, px?: number, py?: number): void;\n        setConcat(a: Matrix, b: Matrix): boolean;\n        preTranslate(dx: number, dy: number): boolean;\n        preScale(sx: number, sy: number, px?: number, py?: number): boolean;\n        preRotate(degrees: number, px?: number, py?: number): boolean;\n        preSkew(kx: number, ky: number, px?: number, py?: number): boolean;\n        preConcat(other: Matrix): boolean;\n        postTranslate(dx: number, dy: number): boolean;\n        postScale(sx: number, sy: number, px?: number, py?: number): boolean;\n        postRotate(degrees: number, px?: number, py?: number): boolean;\n        postSkew(kx: number, ky: number, px?: number, py?: number): boolean;\n        postConcat(other: Matrix): boolean;\n        setRectToRect(src: RectF, dst: RectF, stf: Matrix.ScaleToFit): boolean;\n        private static checkPointArrays(src, srcIndex, dst, dstIndex, pointCount);\n        mapPoints(dst: number[], dstIndex?: number, src?: number[], srcIndex?: number, pointCount?: number): void;\n        mapVectors(dst: number[], dstIndex?: number, src?: number[], srcIndex?: number, ptCount?: number): void;\n        mapRect(dst: RectF, src?: RectF): boolean;\n        mapRadius(radius: number): number;\n        getValues(values: number[]): void;\n        setValues(values: number[]): void;\n        toString(): string;\n        toShortString(sb: StringBuilder): void;\n        private postTransform(matrix);\n        private preTransform(matrix);\n        private static getPointLength(src, index);\n        static multiply(dest: number[], a: number[], b: number[]): void;\n        static getTranslate(dx: number, dy: number): number[];\n        static setTranslate(dest: number[], dx: number, dy: number): number[];\n        static getScale(sx: number, sy: number, px?: number, py?: number): number[];\n        static getRotate_1(degrees: number): number[];\n        static getRotate_2(sin: number, cos: number): number[];\n        static setRotate_1(dest: number[], degrees: number): number[];\n        static setRotate_2(dest: number[], sin: number, cos: number): number[];\n        static getRotate_3(degrees: number, px: number, py: number): number[];\n        static getSkew(kx: number, ky: number, px?: number, py?: number): number[];\n        private static reset(mtx);\n        private static kIdentity_Mask;\n        private static kTranslate_Mask;\n        private static kScale_Mask;\n        private static kAffine_Mask;\n        private static kPerspective_Mask;\n        private static kRectStaysRect_Mask;\n        private static kUnknown_Mask;\n        private static kAllMasks;\n        private static kTranslate_Shift;\n        private static kScale_Shift;\n        private static kAffine_Shift;\n        private static kPerspective_Shift;\n        private static kRectStaysRect_Shift;\n        private computeTypeMask();\n    }\n    module Matrix {\n        enum ScaleToFit {\n            FILL = 0,\n            START = 1,\n            CENTER = 2,\n            END = 3,\n        }\n    }\n}\ndeclare module androidui.image {\n    import Rect = android.graphics.Rect;\n    class NetImage {\n        private browserImage;\n        private mSrc;\n        private mImageWidth;\n        private mImageHeight;\n        private mOnLoads;\n        private mOnErrors;\n        private mImageLoaded;\n        private mOverrideImageRatio;\n        constructor(src: string, overrideImageRatio?: number);\n        protected init(src: string): void;\n        protected createImage(): void;\n        protected loadImage(): void;\n        src: string;\n        readonly width: number;\n        readonly height: number;\n        getImageRatio(): number;\n        isImageLoaded(): boolean;\n        private fireOnLoad();\n        private fireOnError();\n        addLoadListener(onload: () => void, onerror?: () => void): void;\n        removeLoadListener(onload?: () => void, onerror?: () => void): void;\n        recycle(): void;\n        getBorderPixels(callBack: (leftBorder: number[], topBorder: number[], rightBorder: number[], bottomBorder: number[]) => void): void;\n        getPixels(bound: Rect, callBack: (data: number[]) => void): void;\n    }\n}\ndeclare module android.graphics {\n    import Rect = android.graphics.Rect;\n    import NetImage = androidui.image.NetImage;\n    class Canvas {\n        protected mCanvasElement: HTMLCanvasElement;\n        private mWidth;\n        private mHeight;\n        private _mCanvasContent;\n        private _saveCount;\n        protected mCurrentClip: Rect;\n        private mClipStateMap;\n        protected static TempMatrixValue: number[];\n        static DIRECTION_LTR: number;\n        static DIRECTION_RTL: number;\n        private static sRectPool;\n        private static obtainRect(copy?);\n        private static recycleRect(rect);\n        constructor(width: number, height: number);\n        protected initCanvasImpl(): void;\n        recycle(): void;\n        protected recycleImpl(): void;\n        getHeight(): number;\n        getWidth(): number;\n        isNativeAccelerated(): boolean;\n        translate(dx: number, dy: number): void;\n        protected translateImpl(dx: number, dy: number): void;\n        scale(sx: number, sy: number, px?: number, py?: number): void;\n        protected scaleImpl(sx: number, sy: number): void;\n        rotate(degrees: number, px?: number, py?: number): void;\n        protected rotateImpl(degrees: number): void;\n        concat(m: android.graphics.Matrix): void;\n        protected concatImpl(MSCALE_X: number, MSKEW_X: number, MTRANS_X: number, MSKEW_Y: number, MSCALE_Y: number, MTRANS_Y: number, MPERSP_0: number, MPERSP_1: number, MPERSP_2: number): void;\n        drawRGB(r: number, g: number, b: number): void;\n        drawARGB(a: number, r: number, g: number, b: number): void;\n        drawColor(color: number): void;\n        protected drawARGBImpl(a: number, r: number, g: number, b: number): void;\n        clearColor(): void;\n        protected clearColorImpl(): void;\n        save(): number;\n        protected saveImpl(): void;\n        restore(): void;\n        protected restoreImpl(): void;\n        restoreToCount(saveCount: number): void;\n        getSaveCount(): number;\n        clipRect(rect: Rect): boolean;\n        clipRect(left: number, top: number, right: number, bottom: number): boolean;\n        clipRect(left: number, top: number, right: number, bottom: number, radiusTopLeft: number, radiusTopRight: number, radiusBottomRight: number, radiusBottomLeft: number): boolean;\n        protected clipRectImpl(left: number, top: number, width: number, height: number): void;\n        clipRoundRect(r: Rect, radiusTopLeft: number, radiusTopRight: number, radiusBottomRight: number, radiusBottomLeft: number): boolean;\n        protected clipRoundRectImpl(left: number, top: number, width: number, height: number, radiusTopLeft: number, radiusTopRight: number, radiusBottomRight: number, radiusBottomLeft: number): void;\n        private doRoundRectPath(left, top, width, height, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft);\n        getClipBounds(bounds?: Rect): Rect;\n        quickReject(rect: Rect): boolean;\n        quickReject(left: number, top: number, right: number, bottom: number): boolean;\n        drawCanvas(canvas: Canvas, offsetX?: number, offsetY?: number): void;\n        protected drawCanvasImpl(canvas: Canvas, offsetX: number, offsetY: number): void;\n        drawImage(image: NetImage, srcRect?: Rect, dstRect?: Rect, paint?: Paint): void;\n        protected drawImageImpl(image: NetImage, srcRect?: Rect, dstRect?: Rect): void;\n        drawRect(rect: Rect, paint: Paint): any;\n        drawRect(left: number, top: number, right: number, bottom: number, paint: Paint): any;\n        protected drawRectImpl(left: number, top: number, width: number, height: number, style: Paint.Style): void;\n        private applyFillOrStrokeToContent(style);\n        drawOval(oval: RectF, paint: Paint): void;\n        protected drawOvalImpl(oval: RectF, style: Paint.Style): void;\n        drawCircle(cx: number, cy: number, radius: number, paint: Paint): void;\n        protected drawCircleImpl(cx: number, cy: number, radius: number, style: Paint.Style): void;\n        drawArc(oval: RectF, startAngle: number, sweepAngle: number, useCenter: boolean, paint: Paint): void;\n        protected drawArcImpl(oval: RectF, startAngle: number, sweepAngle: number, useCenter: boolean, style: Paint.Style): void;\n        drawRoundRect(rect: RectF, radiusTopLeft: number, radiusTopRight: number, radiusBottomRight: number, radiusBottomLeft: number, paint: Paint): void;\n        protected drawRoundRectImpl(rect: RectF, radiusTopLeft: number, radiusTopRight: number, radiusBottomRight: number, radiusBottomLeft: number, style: Paint.Style): void;\n        drawPath(path: Path, paint: Paint): void;\n        drawText_count(text: string, index: number, count: number, x: number, y: number, paint: Paint): void;\n        drawText_end(text: string, start: number, end: number, x: number, y: number, paint: Paint): void;\n        drawText(text: string, x: number, y: number, paint: Paint): void;\n        protected drawTextImpl(text: string, x: number, y: number, style: Paint.Style): void;\n        drawTextRun_count(text: string, index: number, count: number, contextIndex: number, contextCount: number, x: number, y: number, dir: number, paint: Paint): void;\n        drawTextRun_end(text: string, start: number, end: number, contextStart: number, contextEnd: number, x: number, y: number, dir: number, paint: Paint): void;\n        static measureText(text: string, textSize: number): number;\n        private static _measureTextContext;\n        private static _measureCacheTextSize;\n        private static _static;\n        private static _measureCacheMap;\n        protected static measureTextImpl(text: string, textSize: number): number;\n        protected static getMeasureTextFontFamily(): string;\n        setColor(color: number, style?: Paint.Style): void;\n        protected setColorImpl(color: number, style?: Paint.Style): void;\n        multiplyGlobalAlpha(alpha: number): void;\n        protected multiplyGlobalAlphaImpl(alpha: number): void;\n        setGlobalAlpha(alpha: number): void;\n        protected setGlobalAlphaImpl(alpha: number): void;\n        setTextAlign(align: string): void;\n        protected setTextAlignImpl(align: string): void;\n        setLineWidth(width: number): void;\n        protected setLineWidthImpl(width: number): void;\n        setLineCap(lineCap: string): void;\n        protected setLineCapImpl(lineCap: string): void;\n        setLineJoin(lineJoin: string): void;\n        protected setLineJoinImpl(lineJoin: string): void;\n        setShadow(radius: number, dx: number, dy: number, color: number): void;\n        protected setShadowImpl(radius: number, dx: number, dy: number, color: number): void;\n        setFontSize(size: number): void;\n        protected setFontSizeImpl(size: number): void;\n        setFont(fontName: string): void;\n        protected setFontImpl(fontName: string): void;\n        isImageSmoothingEnabled(): boolean;\n        protected isImageSmoothingEnabledImpl(): boolean;\n        setImageSmoothingEnabled(enable: boolean): void;\n        protected setImageSmoothingEnabledImpl(enable: boolean): void;\n    }\n}\ndeclare module android.graphics.drawable {\n    import Rect = android.graphics.Rect;\n    import WeakReference = java.lang.ref.WeakReference;\n    import Runnable = java.lang.Runnable;\n    import Canvas = android.graphics.Canvas;\n    import Resources = android.content.res.Resources;\n    abstract class Drawable {\n        private static ZERO_BOUNDS_RECT;\n        mBounds: Rect;\n        mStateSet: number[];\n        mLevel: number;\n        mVisible: boolean;\n        mCallback: WeakReference<Drawable.Callback>;\n        private mIgnoreNotifySizeChange;\n        constructor();\n        abstract draw(canvas: Canvas): any;\n        setBounds(rect: Rect): any;\n        setBounds(left: any, top: any, right: any, bottom: any): any;\n        copyBounds(bounds?: Rect): Rect;\n        getBounds(): Rect;\n        setDither(dither: boolean): void;\n        setCallback(cb: Drawable.Callback): void;\n        getCallback(): Drawable.Callback;\n        setIgnoreNotifySizeChange(isIgnore: boolean): void;\n        notifySizeChangeSelf(): void;\n        invalidateSelf(): void;\n        scheduleSelf(what: any, when: any): void;\n        unscheduleSelf(what: any): void;\n        abstract setAlpha(alpha: number): void;\n        getAlpha(): number;\n        isStateful(): boolean;\n        setState(stateSet: Array<number>): boolean;\n        getState(): Array<number>;\n        jumpToCurrentState(): void;\n        getCurrent(): Drawable;\n        setLevel(level: number): boolean;\n        getLevel(): number;\n        setVisible(visible: boolean, restart: boolean): boolean;\n        isVisible(): boolean;\n        setAutoMirrored(mirrored: boolean): void;\n        isAutoMirrored(): boolean;\n        getOpacity(): number;\n        static resolveOpacity(op1: number, op2: number): number;\n        protected onStateChange(state: Array<number>): boolean;\n        protected onLevelChange(level: number): boolean;\n        protected onBoundsChange(bounds: Rect): void;\n        getIntrinsicWidth(): number;\n        getIntrinsicHeight(): number;\n        getMinimumWidth(): number;\n        getMinimumHeight(): number;\n        getPadding(padding: Rect): boolean;\n        mutate(): Drawable;\n        getConstantState(): Drawable.ConstantState;\n        static createFromXml(r: Resources, parser: HTMLElement): Drawable;\n        inflate(r: Resources, parser: HTMLElement): void;\n    }\n    module Drawable {\n        interface Callback {\n            invalidateDrawable(who: Drawable): void;\n            drawableSizeChange?(who: Drawable): void;\n            scheduleDrawable(who: Drawable, what: Runnable, when: number): void;\n            unscheduleDrawable(who: Drawable, what: Runnable): void;\n        }\n        interface ConstantState {\n            newDrawable(): Drawable;\n        }\n    }\n}\ndeclare module android.graphics.drawable {\n    class ColorDrawable extends Drawable {\n        private mState;\n        private mMutated;\n        private mPaint;\n        constructor(color?: number);\n        _setStateCopyFrom(state: any): void;\n        mutate(): Drawable;\n        draw(canvas: Canvas): void;\n        getColor(): number;\n        setColor(color: number): void;\n        getAlpha(): number;\n        setAlpha(alpha: number): void;\n        getOpacity(): number;\n        inflate(r: android.content.res.Resources, parser: HTMLElement): void;\n        getConstantState(): Drawable.ConstantState;\n    }\n}\ndeclare module android.graphics.drawable {\n    import Drawable = android.graphics.drawable.Drawable;\n    import Canvas = android.graphics.Canvas;\n    class ScrollBarDrawable extends Drawable {\n        private mVerticalTrack;\n        private mHorizontalTrack;\n        private mVerticalThumb;\n        private mHorizontalThumb;\n        private mRange;\n        private mOffset;\n        private mExtent;\n        private mVertical;\n        private mChanged;\n        private mRangeChanged;\n        private mTempBounds;\n        private mAlwaysDrawHorizontalTrack;\n        private mAlwaysDrawVerticalTrack;\n        setAlwaysDrawHorizontalTrack(alwaysDrawTrack: boolean): void;\n        setAlwaysDrawVerticalTrack(alwaysDrawTrack: boolean): void;\n        getAlwaysDrawVerticalTrack(): boolean;\n        getAlwaysDrawHorizontalTrack(): boolean;\n        setParameters(range: number, offset: number, extent: number, vertical: boolean): void;\n        draw(canvas: any): void;\n        protected onBoundsChange(bounds: android.graphics.Rect): void;\n        drawTrack(canvas: Canvas, bounds: Rect, vertical: boolean): void;\n        drawThumb(canvas: Canvas, bounds: Rect, offset: number, length: number, vertical: boolean): void;\n        setVerticalThumbDrawable(thumb: Drawable): void;\n        setVerticalTrackDrawable(track: Drawable): void;\n        setHorizontalThumbDrawable(thumb: Drawable): void;\n        setHorizontalTrackDrawable(track: Drawable): void;\n        getSize(vertical: boolean): number;\n        setAlpha(alpha: number): void;\n        getAlpha(): number;\n        getOpacity(): number;\n        toString(): string;\n    }\n}\ndeclare module android.graphics.drawable {\n    import Canvas = android.graphics.Canvas;\n    class InsetDrawable extends Drawable implements Drawable.Callback {\n        private mInsetState;\n        private mTmpRect;\n        private mMutated;\n        constructor(drawable: Drawable, insetLeft: number, insetTop?: number, insetRight?: number, insetBottom?: number);\n        inflate(r: android.content.res.Resources, parser: HTMLElement): void;\n        drawableSizeChange(who: android.graphics.drawable.Drawable): any;\n        invalidateDrawable(who: android.graphics.drawable.Drawable): void;\n        scheduleDrawable(who: android.graphics.drawable.Drawable, what: java.lang.Runnable, when: number): void;\n        unscheduleDrawable(who: android.graphics.drawable.Drawable, what: java.lang.Runnable): void;\n        draw(canvas: Canvas): void;\n        getPadding(padding: android.graphics.Rect): boolean;\n        setVisible(visible: boolean, restart: boolean): boolean;\n        setAlpha(alpha: number): void;\n        getAlpha(): number;\n        getOpacity(): number;\n        isStateful(): boolean;\n        protected onStateChange(state: Array<number>): boolean;\n        protected onBoundsChange(bounds: android.graphics.Rect): void;\n        getIntrinsicWidth(): number;\n        getIntrinsicHeight(): number;\n        getConstantState(): Drawable.ConstantState;\n        mutate(): Drawable;\n        getDrawable(): Drawable;\n    }\n}\ndeclare module android.graphics.drawable {\n    class ShadowDrawable extends Drawable {\n        private mState;\n        private mMutated;\n        constructor(drawable: Drawable, radius: number, dx: number, dy: number, color: number);\n        setShadow(radius: number, dx: number, dy: number, color: number): void;\n        drawableSizeChange(who: android.graphics.drawable.Drawable): any;\n        invalidateDrawable(who: android.graphics.drawable.Drawable): void;\n        scheduleDrawable(who: android.graphics.drawable.Drawable, what: java.lang.Runnable, when: number): void;\n        unscheduleDrawable(who: android.graphics.drawable.Drawable, what: java.lang.Runnable): void;\n        draw(canvas: Canvas): void;\n        getPadding(padding: Rect): boolean;\n        setVisible(visible: boolean, restart: boolean): boolean;\n        setAlpha(alpha: number): void;\n        getAlpha(): number;\n        getOpacity(): number;\n        isStateful(): boolean;\n        protected onStateChange(state: Array<number>): boolean;\n        protected onBoundsChange(bounds: android.graphics.Rect): void;\n        getIntrinsicWidth(): number;\n        getIntrinsicHeight(): number;\n        getConstantState(): Drawable.ConstantState;\n        mutate(): Drawable;\n        getDrawable(): Drawable;\n    }\n}\ndeclare module android.graphics.drawable {\n    class RoundRectDrawable extends Drawable {\n        private mState;\n        private mMutated;\n        private mPaint;\n        constructor(color: number, radiusTopLeft: number, radiusTopRight?: number, radiusBottomRight?: number, radiusBottomLeft?: number);\n        mutate(): Drawable;\n        draw(canvas: Canvas): void;\n        getColor(): number;\n        setColor(color: number): void;\n        getAlpha(): number;\n        setAlpha(alpha: number): void;\n        getOpacity(): number;\n        getConstantState(): Drawable.ConstantState;\n    }\n}\ndeclare module java.lang {\n    class JavaObject {\n        static readonly class: Class;\n        private hash;\n        hashCode(): number;\n        getClass(): Class;\n        equals(o: any): boolean;\n    }\n    class Class {\n        private static classCache;\n        private static getClass(clazz);\n        clazz: Function;\n        constructor(clazz: Function);\n        getName(): string;\n        getSimpleName(): string;\n    }\n}\ndeclare module java.lang.util.concurrent {\n    class CopyOnWriteArrayList<T> {\n        private mData;\n        private isDataNew;\n        iterator(): T[];\n        [Symbol.iterator](): IterableIterator<T>;\n        private checkNewData();\n        size(): number;\n        add(...items: T[]): void;\n        addAll(array: CopyOnWriteArrayList<T>): void;\n        remove(item: T): void;\n    }\n}\ndeclare module android.util {\n    class CopyOnWriteArray<T> {\n        private mData;\n        private mDataCopy;\n        private mAccess;\n        private mStart;\n        private getArray();\n        start(): Array<T>;\n        end(): void;\n        size(): number;\n        add(...items: T[]): void;\n        addAll(array: CopyOnWriteArray<T>): void;\n        remove(item: T): void;\n    }\n}\ndeclare module android.view {\n    class ViewTreeObserver {\n        private mOnTouchModeChangeListeners;\n        private mOnGlobalLayoutListeners;\n        private mOnScrollChangedListeners;\n        private mOnPreDrawListeners;\n        private mOnDrawListeners;\n        private mAlive;\n        addOnGlobalLayoutListener(listener: ViewTreeObserver.OnGlobalLayoutListener): void;\n        removeGlobalOnLayoutListener(victim: ViewTreeObserver.OnGlobalLayoutListener): void;\n        removeOnGlobalLayoutListener(victim: ViewTreeObserver.OnGlobalLayoutListener): void;\n        dispatchOnGlobalLayout(): void;\n        addOnPreDrawListener(listener: ViewTreeObserver.OnPreDrawListener): void;\n        removeOnPreDrawListener(victim: ViewTreeObserver.OnPreDrawListener): void;\n        dispatchOnPreDraw(): boolean;\n        addOnTouchModeChangeListener(listener: ViewTreeObserver.OnTouchModeChangeListener): void;\n        removeOnTouchModeChangeListener(victim: ViewTreeObserver.OnTouchModeChangeListener): void;\n        dispatchOnTouchModeChanged(inTouchMode: boolean): void;\n        addOnScrollChangedListener(listener: ViewTreeObserver.OnScrollChangedListener): void;\n        removeOnScrollChangedListener(victim: ViewTreeObserver.OnScrollChangedListener): void;\n        dispatchOnScrollChanged(): void;\n        addOnDrawListener(listener: ViewTreeObserver.OnDrawListener): void;\n        removeOnDrawListener(victim: ViewTreeObserver.OnDrawListener): void;\n        dispatchOnDraw(): void;\n        merge(observer: ViewTreeObserver): void;\n        private checkIsAlive();\n        isAlive(): boolean;\n        private kill();\n    }\n    module ViewTreeObserver {\n        interface OnGlobalFocusChangeListener {\n            onGlobalFocusChanged(oldFocus: android.view.View, newFocus: android.view.View): any;\n        }\n        interface OnGlobalLayoutListener {\n            onGlobalLayout(): any;\n        }\n        interface OnPreDrawListener {\n            onPreDraw(): boolean;\n        }\n        interface OnDrawListener {\n            onDraw(): any;\n        }\n        interface OnScrollChangedListener {\n            onScrollChanged(): any;\n        }\n        interface OnTouchModeChangeListener {\n            onTouchModeChanged(isInTouchMode: boolean): any;\n        }\n    }\n}\ndeclare module android.util {\n    class DisplayMetrics {\n        static DENSITY_LOW: number;\n        static DENSITY_MEDIUM: number;\n        static DENSITY_HIGH: number;\n        static DENSITY_XHIGH: number;\n        static DENSITY_XXHIGH: number;\n        static DENSITY_XXXHIGH: number;\n        static DENSITY_DEFAULT: number;\n        widthPixels: number;\n        heightPixels: number;\n        density: number;\n        densityDpi: number;\n        scaledDensity: number;\n        xdpi: number;\n        ydpi: number;\n    }\n}\ndeclare module android.content {\n    import Bundle = android.os.Bundle;\n    class Intent {\n        private mExtras;\n        private mRequestCode;\n        private mFlags;\n        private activityName;\n        static FLAG_ACTIVITY_CLEAR_TOP: number;\n        constructor(activityName?: string);\n        getBooleanExtra(name: string, defaultValue: boolean): boolean;\n        getIntExtra(name: string, defaultValue: number): number;\n        getLongExtra(name: string, defaultValue: number): number;\n        getFloatExtra(name: string, defaultValue: number): number;\n        getDoubleExtra(name: string, defaultValue: number): number;\n        getStringExtra(name: string, defaultValue?: string): string;\n        getStringArrayExtra(name: string, defaultValue?: string[]): string[];\n        getIntegerArrayExtra(name: string, defaultValue?: number[]): number[];\n        getLongArrayExtra(name: string, defaultValue?: number[]): number[];\n        getFloatArrayExtra(name: string, defaultValue?: number[]): number[];\n        getDoubleArrayExtra(name: string, defaultValue?: number[]): number[];\n        getBooleanArrayExtra(name: string, defaultValue?: boolean[]): boolean[];\n        hasExtra(name: string): boolean;\n        putExtra(name: string, value: any): Intent;\n        getExtras(): Bundle;\n        getFlags(): number;\n        setFlags(flags: number): Intent;\n        addFlags(flags: number): Intent;\n    }\n}\ndeclare module androidui.util {\n    class ClassFinder {\n        static findClass(classFullName: string, findInRoot?: any): any;\n        static _findViewClassCache: {};\n        static findViewClass(className: string): any;\n    }\n}\ndeclare module androidui.widget {\n    import ViewGroup = android.view.ViewGroup;\n    import Context = android.content.Context;\n    interface HtmlDataAdapter {\n        onInflateAdapter(bindElement: HTMLElement, context?: Context, parent?: ViewGroup): void;\n    }\n}\ndeclare module android.view {\n    import Context = android.content.Context;\n    class LayoutInflater {\n        protected mContext: Context;\n        static from(context: Context): LayoutInflater;\n        constructor(context: Context);\n        getContext(): Context;\n        inflate(layout: HTMLElement | string, viewParent?: ViewGroup, attachToRoot?: boolean): View;\n    }\n}\ndeclare module android.content {\n    import LayoutInflater = android.view.LayoutInflater;\n    abstract class Context {\n        androidUI: androidui.AndroidUI;\n        private mLayoutInflater;\n        private mResources;\n        constructor(androidUI: androidui.AndroidUI);\n        abstract getWindowManager(): android.view.WindowManager;\n        getApplicationContext(): android.app.Application;\n        getResources(): android.content.res.Resources;\n        getLayoutInflater(): LayoutInflater;\n        obtainStyledAttributes(attrs: HTMLElement, defStyleAttr?: Map<string, string>): res.TypedArray;\n    }\n}\ndeclare module android.R {\n    class layout {\n        static getLayoutData(layoutName: string): HTMLElement;\n        static action_bar: string;\n        static alert_dialog: string;\n        static alert_dialog_progress: string;\n        static popup_menu_item_layout: string;\n        static select_dialog: string;\n        static select_dialog_item: string;\n        static select_dialog_multichoice: string;\n        static select_dialog_singlechoice: string;\n        static simple_spinner_dropdown_item: string;\n        static simple_spinner_item: string;\n        static transient_notification: string;\n    }\n}\ndeclare module androidui.attr {\n    class AttrValueParser {\n        static parseString(r: android.content.res.Resources, value: string, defValue?: string): string;\n        static parseBoolean(r: android.content.res.Resources, value: string, defValue: boolean): boolean;\n        static parseInt(r: android.content.res.Resources, value: string, defValue: number): number;\n        static parseFloat(r: android.content.res.Resources, value: string, defValue: number): number;\n        static parseColor(r: android.content.res.Resources, value: string, defValue: number): number;\n        static parseColorStateList(r: android.content.res.Resources, value: string): android.content.res.ColorStateList;\n        static parseDimension(r: android.content.res.Resources, value: string, defValue: number, baseValue?: number): number;\n        static parseDimensionPixelOffset(r: android.content.res.Resources, value: string, defValue: number, baseValue?: number): number;\n        static parseDimensionPixelSize(r: android.content.res.Resources, value: string, defValue: number, baseValue?: number): number;\n        static parseDrawable(r: android.content.res.Resources, value: string): android.graphics.drawable.Drawable;\n        static parseTextArray(r: android.content.res.Resources, value: string): string[];\n    }\n}\ndeclare module android.content.res {\n    import Drawable = android.graphics.drawable.Drawable;\n    class TypedArray {\n        static obtain(res: android.content.res.Resources, xml: HTMLElement, defStyleAttr?: Map<string, string>): TypedArray;\n        private mResources;\n        private attrMap;\n        private attrMapKeysCache;\n        private mRecycled;\n        constructor(res: android.content.res.Resources, attrMap: Map<string, string>);\n        private checkRecycled();\n        length(): number;\n        getIndex(keyIndex: number): string;\n        getLowerCaseNoNamespaceAttrNames(): Array<string>;\n        getResources(): android.content.res.Resources;\n        getAttrValue(attrName: string): string;\n        getResourceId(attrName: string, defaultResourceId: string): string;\n        getText(attrName: string): string;\n        getString(attrName: string): string;\n        getBoolean(attrName: string, defValue: boolean): boolean;\n        getInt(attrName: string, defValue: number): number;\n        getFloat(attrName: string, defValue: number): number;\n        getColor(attrName: string, defValue: number): number;\n        getColorStateList(attrName: string): android.content.res.ColorStateList;\n        getInteger(attrName: string, defValue: number): number;\n        getLayoutDimension(attrName: string, defValue: number): number;\n        getDimension(attrName: string, defValue: number): number;\n        getDimensionPixelOffset(attrName: string, defValue: number): number;\n        getDimensionPixelSize(attrName: string, defValue: number): number;\n        getDrawable(attrName: string): Drawable;\n        getTextArray(attrName: string): string[];\n        hasValue(attrName: string): boolean;\n        hasValueOrEmpty(attrName: string): boolean;\n        recycle(): void;\n    }\n}\ndeclare module android.content.res {\n    import DisplayMetrics = android.util.DisplayMetrics;\n    import Drawable = android.graphics.drawable.Drawable;\n    import SynchronizedPool = android.util.Pools.SynchronizedPool;\n    class Resources {\n        private static instance;\n        mTypedArrayPool: SynchronizedPool<TypedArray>;\n        private displayMetrics;\n        private context;\n        static _AppBuildImageFileFinder: (refString: string) => Drawable;\n        static _AppBuildXmlFinder: (refString: string) => HTMLElement;\n        static _AppBuildValueFinder: (refString: string) => HTMLElement;\n        constructor(context?: Context);\n        static getSystem(): Resources;\n        private static from(context);\n        static getDisplayMetrics(): DisplayMetrics;\n        getDisplayMetrics(): DisplayMetrics;\n        private fillDisplayMetrics(displayMetrics);\n        getDefStyle(refString: string): any;\n        getDrawable(refString: string): Drawable;\n        getColor(refString: string): number;\n        getColorStateList(refString: string): ColorStateList;\n        getDimension(refString: string, baseValue?: number): number;\n        getDimensionPixelOffset(refString: string, baseValue?: number): number;\n        getDimensionPixelSize(refString: string, baseValue?: number): number;\n        getBoolean(refString: string): boolean;\n        getInteger(refString: string): number;\n        getIntArray(refString: string): number[];\n        getFloat(refString: string): number;\n        getString(refString: string): string;\n        getStringArray(refString: string): string[];\n        getLayout(refString: string): HTMLElement;\n        getAnimation(refString: string): android.view.animation.Animation;\n        private getStyleAsMap(refString);\n        getXml(refString: string): HTMLElement;\n        getValue(refString: string, resolveRefs?: boolean): HTMLElement;\n        obtainAttributes(attrs: HTMLElement): TypedArray;\n        obtainStyledAttributes(attrs: HTMLElement, defStyleAttr: Map<string, string>): TypedArray;\n    }\n}\ndeclare module android.view {\n    class ViewConfiguration {\n        private static SCROLL_BAR_SIZE;\n        private static SCROLL_BAR_FADE_DURATION;\n        private static SCROLL_BAR_DEFAULT_DELAY;\n        private static FADING_EDGE_LENGTH;\n        private static PRESSED_STATE_DURATION;\n        private static DEFAULT_LONG_PRESS_TIMEOUT;\n        private static KEY_REPEAT_DELAY;\n        private static GLOBAL_ACTIONS_KEY_TIMEOUT;\n        private static TAP_TIMEOUT;\n        private static JUMP_TAP_TIMEOUT;\n        private static DOUBLE_TAP_TIMEOUT;\n        private static DOUBLE_TAP_MIN_TIME;\n        private static HOVER_TAP_TIMEOUT;\n        private static HOVER_TAP_SLOP;\n        private static ZOOM_CONTROLS_TIMEOUT;\n        static EDGE_SLOP: number;\n        private static TOUCH_SLOP;\n        private static DOUBLE_TAP_TOUCH_SLOP;\n        private static PAGING_TOUCH_SLOP;\n        private static DOUBLE_TAP_SLOP;\n        private static WINDOW_TOUCH_SLOP;\n        private static MINIMUM_FLING_VELOCITY;\n        private static MAXIMUM_FLING_VELOCITY;\n        private static SCROLL_FRICTION;\n        private static OVERSCROLL_DISTANCE;\n        private static OVERFLING_DISTANCE;\n        static instance: ViewConfiguration;\n        static get(arg?: any): ViewConfiguration;\n        private density;\n        private sizeAndDensity;\n        mEdgeSlop: number;\n        mFadingEdgeLength: number;\n        mMinimumFlingVelocity: number;\n        mMaximumFlingVelocity: number;\n        mScrollbarSize: number;\n        mTouchSlop: number;\n        mDoubleTapTouchSlop: number;\n        mPagingTouchSlop: number;\n        mDoubleTapSlop: number;\n        mWindowTouchSlop: number;\n        mOverscrollDistance: number;\n        mOverflingDistance: number;\n        mMaximumDrawingCacheSize: number;\n        getScaledScrollBarSize(): number;\n        static getScrollBarFadeDuration(): number;\n        static getScrollDefaultDelay(): number;\n        getScaledFadingEdgeLength(): number;\n        static getPressedStateDuration(): number;\n        static getLongPressTimeout(): number;\n        static getKeyRepeatDelay(): number;\n        static getTapTimeout(): number;\n        static getJumpTapTimeout(): number;\n        static getDoubleTapTimeout(): number;\n        static getDoubleTapMinTime(): number;\n        getScaledEdgeSlop(): number;\n        getScaledTouchSlop(): number;\n        getScaledDoubleTapTouchSlop(): number;\n        getScaledPagingTouchSlop(): number;\n        getScaledDoubleTapSlop(): number;\n        getScaledWindowTouchSlop(): number;\n        getScaledMinimumFlingVelocity(): number;\n        getScaledMaximumFlingVelocity(): number;\n        getScaledMaximumDrawingCacheSize(): number;\n        getScaledOverscrollDistance(): number;\n        getScaledOverflingDistance(): number;\n        static getScrollFriction(): number;\n    }\n}\ndeclare module android.os {\n    class SystemClock {\n        static uptimeMillis(): number;\n    }\n}\ndeclare module android.view {\n    import Rect = android.graphics.Rect;\n    class MotionEvent {\n        static INVALID_POINTER_ID: number;\n        static ACTION_MASK: number;\n        static ACTION_DOWN: number;\n        static ACTION_UP: number;\n        static ACTION_MOVE: number;\n        static ACTION_CANCEL: number;\n        static ACTION_OUTSIDE: number;\n        static ACTION_POINTER_DOWN: number;\n        static ACTION_POINTER_UP: number;\n        static ACTION_HOVER_MOVE: number;\n        static ACTION_SCROLL: number;\n        static ACTION_HOVER_ENTER: number;\n        static ACTION_HOVER_EXIT: number;\n        static EDGE_TOP: number;\n        static EDGE_BOTTOM: number;\n        static EDGE_LEFT: number;\n        static EDGE_RIGHT: number;\n        static ACTION_POINTER_INDEX_MASK: number;\n        static ACTION_POINTER_INDEX_SHIFT: number;\n        static AXIS_VSCROLL: number;\n        static AXIS_HSCROLL: number;\n        static HistoryMaxSize: number;\n        private static TouchMoveRecord;\n        mAction: number;\n        mEdgeFlags: number;\n        mDownTime: number;\n        mEventTime: number;\n        mActivePointerId: number;\n        private mTouchingPointers;\n        mXOffset: number;\n        mYOffset: number;\n        _activeTouch: any;\n        private _axisValues;\n        static obtainWithTouchEvent(e: any, action: number): MotionEvent;\n        static obtain(event: MotionEvent): MotionEvent;\n        static obtainWithAction(downTime: number, eventTime: number, action: number, x: number, y: number, metaState?: number): MotionEvent;\n        private static IdIndexCache;\n        initWithTouch(event: any, baseAction: number, windowBound?: Rect): void;\n        initWithMouseWheel(e: WheelEvent): void;\n        recycle(): void;\n        getAction(): number;\n        getActionMasked(): number;\n        getActionIndex(): number;\n        getDownTime(): number;\n        getEventTime(): number;\n        getX(pointerIndex?: number): number;\n        getY(pointerIndex?: number): number;\n        getPointerCount(): number;\n        getPointerId(pointerIndex: number): number;\n        findPointerIndex(pointerId: number): number;\n        getRawX(): number;\n        getRawY(): number;\n        getHistorySize(id?: number): number;\n        getHistoricalX(pointerIndex: number, pos: number): number;\n        getHistoricalY(pointerIndex: number, pos: number): number;\n        getHistoricalEventTime(pos: number): number;\n        getHistoricalEventTime(pointerIndex: number, pos: number): number;\n        getTouchMajor(pointerIndex?: number): number;\n        getHistoricalTouchMajor(pointerIndex?: number, pos?: number): number;\n        getEdgeFlags(): number;\n        setEdgeFlags(flags: number): void;\n        setAction(action: number): void;\n        isTouchEvent(): boolean;\n        isPointerEvent(): boolean;\n        offsetLocation(deltaX: number, deltaY: number): void;\n        setLocation(x: number, y: number): void;\n        getPointerIdBits(): number;\n        split(idBits: number): MotionEvent;\n        getAxisValue(axis: number): number;\n        toString(): string;\n    }\n}\ndeclare module android.view {\n    import Rect = android.graphics.Rect;\n    class TouchDelegate {\n        private mDelegateView;\n        private mBounds;\n        private mSlopBounds;\n        private mDelegateTargeted;\n        private mSlop;\n        constructor(bounds: Rect, delegateView: View);\n        onTouchEvent(event: MotionEvent): boolean;\n    }\n}\ndeclare module android.os {\n    import Runnable = java.lang.Runnable;\n    class Message {\n        protected static Type_Normal: number;\n        protected static Type_Traversal: number;\n        private mType;\n        what: number;\n        arg1: number;\n        arg2: number;\n        obj: any;\n        protected when: number;\n        protected target: Handler;\n        protected callback: Runnable;\n        private static sPool;\n        static obtain(): Message;\n        static obtain(orig: Message): Message;\n        static obtain(h: Handler): Message;\n        static obtain(h: Handler, callback: Runnable): Message;\n        static obtain(h: Handler, what: number): Message;\n        static obtain(h: Handler, what: number, obj: any): Message;\n        static obtain(h: Handler, what: number, arg1: number, arg2: number): Message;\n        static obtain(h: Handler, what: number, arg1: number, arg2: number, obj: any): Message;\n        recycle(): void;\n        copyFrom(o: Message): void;\n        setTarget(target: Handler): void;\n        getTarget(): Handler;\n        sendToTarget(): void;\n        protected clearForRecycle(): void;\n        toString(now?: number): string;\n    }\n}\ndeclare module android.os {\n    import Runnable = java.lang.Runnable;\n    class MessageQueue {\n        static messages: Set<Message>;\n        static getMessages(h: Handler, r: Runnable, object: any): Array<Message>;\n        static getMessages(h: Handler, what: number, object: any): Array<Message>;\n        static hasMessages(h: Handler, r: Runnable, object: any): boolean;\n        static hasMessages(h: Handler, what: number, object: any): boolean;\n        static enqueueMessage(msg: Message, when: number): boolean;\n        static recycleMessage(handler: Handler, message: Message): void;\n        static removeMessages(h: Handler, what: number, object: any): any;\n        static removeMessages(h: Handler, r: Runnable, object: any): any;\n        static removeCallbacksAndMessages(h: Handler, object: any): void;\n        private static _loopActive;\n        private static checkLoop();\n        private static requestNextLoop();\n        private static loop();\n        private static dispatchMessage(msg);\n    }\n}\ndeclare module android.os {\n    import Runnable = java.lang.Runnable;\n    class Handler {\n        mCallback: Handler.Callback;\n        constructor(callback?: Handler.Callback);\n        handleMessage(msg: Message): void;\n        dispatchMessage(msg: Message): void;\n        obtainMessage(): Message;\n        obtainMessage(what: number): Message;\n        obtainMessage(what: number, obj: any): Message;\n        obtainMessage(what: number, arg1: number, arg2: number): Message;\n        obtainMessage(what: number, arg1: number, arg2: number, obj: any): Message;\n        post(r: Runnable): boolean;\n        protected postAsTraversal(r: Runnable): boolean;\n        postAtTime(r: Runnable, uptimeMillis: number): boolean;\n        postAtTime(r: Runnable, token: any, uptimeMillis: number): boolean;\n        postDelayed(r: Runnable, delayMillis: number): boolean;\n        postAtFrontOfQueue(r: Runnable): boolean;\n        removeCallbacks(r: Runnable, token?: any): void;\n        sendMessage(msg: Message): boolean;\n        sendEmptyMessage(what: number): boolean;\n        sendEmptyMessageDelayed(what: number, delayMillis: number): boolean;\n        sendEmptyMessageAtTime(what: number, uptimeMillis: number): boolean;\n        sendMessageDelayed(msg: Message, delayMillis: number): boolean;\n        sendMessageAtTime(msg: Message, uptimeMillis: number): boolean;\n        sendMessageAtFrontOfQueue(msg: Message): boolean;\n        removeMessages(what: number, object?: any): void;\n        removeCallbacksAndMessages(token?: any): void;\n        hasMessages(what: number, object?: any): boolean;\n        private static getPostMessage(r, token?);\n    }\n    module Handler {\n        interface Callback {\n            handleMessage(msg: Message): boolean;\n        }\n    }\n}\ndeclare module android.content.res {\n    class ColorStateList {\n        mStateSpecs: Array<Array<number>>;\n        mColors: Array<number>;\n        mDefaultColor: number;\n        private static EMPTY;\n        private static sCache;\n        constructor(states: Array<Array<number>>, colors: Array<number>);\n        static valueOf(color: number): ColorStateList;\n        static createFromXml(r: Resources, parser: HTMLElement): ColorStateList;\n        withAlpha(alpha: number): ColorStateList;\n        isStateful(): boolean;\n        getColorForState(stateSet: Array<number>, defaultColor: number): number;\n        getDefaultColor(): number;\n        toString(): string;\n    }\n}\ndeclare module android.util {\n    class TypedValue {\n        static COMPLEX_UNIT_PX: string;\n        static COMPLEX_UNIT_DP: string;\n        static COMPLEX_UNIT_DIP: string;\n        static COMPLEX_UNIT_SP: string;\n        static COMPLEX_UNIT_PT: string;\n        static COMPLEX_UNIT_IN: string;\n        static COMPLEX_UNIT_MM: string;\n        static COMPLEX_UNIT_EM: string;\n        static COMPLEX_UNIT_REM: string;\n        static COMPLEX_UNIT_VH: string;\n        static COMPLEX_UNIT_VW: string;\n        static COMPLEX_UNIT_FRACTION: string;\n        private static UNIT_SCALE_MAP;\n        private static initUnit();\n        static applyDimension(unit: string, size: number, dm: DisplayMetrics): number;\n        static isDynamicUnitValue(valueWithUnit: string): boolean;\n        static complexToDimension(valueWithUnit: string, baseValue?: number, metrics?: DisplayMetrics): number;\n        static complexToDimensionPixelOffset(valueWithUnit: string, baseValue?: number, metrics?: DisplayMetrics): number;\n        static complexToDimensionPixelSize(valueWithUnit: string, baseValue?: number, metrics?: DisplayMetrics): number;\n    }\n}\ndeclare module android.view.animation {\n    interface Interpolator {\n        getInterpolation(input: number): number;\n    }\n}\ndeclare module android.view.animation {\n    class LinearInterpolator implements Interpolator {\n        getInterpolation(input: number): number;\n    }\n}\ndeclare module android.view.animation {\n    class AnimationUtils {\n        static currentAnimationTimeMillis(): number;\n        static loadAnimation(context: android.content.Context, id: string): Animation;\n    }\n}\ndeclare module android.util {\n    class LayoutDirection {\n        static LTR: number;\n        static RTL: number;\n        static INHERIT: number;\n        static LOCALE: number;\n    }\n}\ndeclare module java.util {\n    class Arrays {\n        static sort(a: number[], fromIndex: number, toIndex: number): void;\n        private static rangeCheck(arrayLength, fromIndex, toIndex);\n        static asList<T>(array: T[]): List<T>;\n        static equals(a: any[], a2: any[]): boolean;\n    }\n}\ndeclare module androidui.attr {\n    class StateAttr {\n        private stateSpec;\n        private attributes;\n        constructor(state: number[]);\n        clone(): StateAttr;\n        setAttr(name: string, value: string): void;\n        hasAttr(name: string): boolean;\n        getAttrMap(): Map<string, string>;\n        putAll(stateAttr: StateAttr): void;\n        isDefaultState(): boolean;\n        isStateEquals(state: number[]): boolean;\n        isStateMatch(state: number[]): boolean;\n        createDiffKeyAsNullValueAttrMap(another: StateAttr): Map<string, string>;\n    }\n}\ndeclare let STATE_MAP: Map<string, number>;\ndeclare module androidui.attr {\n    import View = android.view.View;\n    class StateAttrList {\n        private originStateAttrList;\n        private matchedStateAttrList;\n        private mView;\n        constructor(view: View);\n        static getViewStateValue(attrName: string): number;\n        addStatedAttr(attrName: string, attrValue: string): void;\n        private addStatedAttrImpl(attrName, attrValue, inParseState);\n        private getStateAttr(state);\n        private getOrCreateStateAttr(state);\n        getMatchedStateAttr(state: number[]): StateAttr;\n        removeAttrAllState(attrName: string): void;\n    }\n}\ndeclare function fixDefaultNamespaceAndLowerCase(key: any): any;\ndeclare module androidui.attr {\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import Drawable = android.graphics.drawable.Drawable;\n    import ColorStateList = android.content.res.ColorStateList;\n    import Context = android.content.Context;\n    class AttrBinder {\n        private host;\n        private attrChangeMap;\n        private attrStashMap;\n        private classAttrBindMap;\n        private objectRefs;\n        private mContext;\n        constructor(host: View | ViewGroup.LayoutParams);\n        setClassAttrBind(classAttrBind: AttrBinder.ClassBinderMap): void;\n        addAttr(attrName: string, onAttrChange: (newValue: any) => void, stashAttrValueWhenStateChange?: () => any): void;\n        onAttrChange(attrName: string, attrValue: any, context: Context): void;\n        getAttrValue(attrName: string): string;\n        private getRefObject(ref);\n        private setRefObject(obj);\n        parsePaddingMarginTRBL(value: any): number[];\n        parseEnum(value: any, enumMap: Map<string, number>, defaultValue: number): number;\n        parseBoolean(value: any, defaultValue?: boolean): boolean;\n        parseGravity(s: string, defaultValue?: number): number;\n        parseDrawable(s: string): Drawable;\n        parseColor(value: string, defaultValue?: number): number;\n        parseColorList(value: string): ColorStateList;\n        parseInt(value: any, defaultValue?: number): number;\n        parseFloat(value: any, defaultValue?: number): number;\n        parseDimension(value: any, defaultValue?: number, baseValue?: number): number;\n        parseNumberPixelOffset(value: any, defaultValue?: number, baseValue?: number): number;\n        parseNumberPixelSize(value: any, defaultValue?: number, baseValue?: number): number;\n        parseString(value: any, defaultValue?: string): string;\n        parseStringArray(value: any): string[];\n    }\n    module AttrBinder {\n        class ClassBinderMap {\n            binderMap: Map<string, ClassBinderValue>;\n            constructor(copyBinderMap?: Map<string, androidui.attr.AttrBinder.ClassBinderValue>);\n            set(key: string, value?: androidui.attr.AttrBinder.ClassBinderValue): ClassBinderMap;\n            get(key: string): androidui.attr.AttrBinder.ClassBinderValue;\n            private callSetter(attrName, host, attrValue, attrBinder);\n            private callGetter(attrName, host);\n        }\n        interface ClassBinderValue {\n            setter: (host: android.view.View | android.view.ViewGroup.LayoutParams, attrValue: any, attrBinder: AttrBinder) => void;\n            getter?: (host: android.view.View | android.view.ViewGroup.LayoutParams) => any;\n        }\n    }\n}\ndeclare module androidui.util {\n    class PerformanceAdjuster {\n        static noCanvasMode(): void;\n    }\n}\ndeclare module androidui.image {\n    import Paint = android.graphics.Paint;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Canvas = android.graphics.Canvas;\n    class NetDrawable extends Drawable {\n        private mState;\n        private mLoadListener;\n        protected mImageWidth: number;\n        protected mImageHeight: number;\n        private mTileModeX;\n        private mTileModeY;\n        private mTmpTileBound;\n        constructor(src: string | NetImage, paint?: Paint, overrideImageRatio?: number);\n        protected initBoundWithLoadedImage(image: NetImage): void;\n        setURL(url: string, hiddenWhenLoading?: boolean): void;\n        draw(canvas: Canvas): void;\n        private drawTile(canvas);\n        setAlpha(alpha: number): void;\n        getAlpha(): number;\n        getIntrinsicWidth(): number;\n        getIntrinsicHeight(): number;\n        protected onLoad(): void;\n        protected onError(): void;\n        isImageSizeEmpty(): boolean;\n        getImage(): NetImage;\n        setLoadListener(loadListener: NetDrawable.LoadListener): void;\n        setTileMode(tileX: NetDrawable.TileMode, tileY: NetDrawable.TileMode): void;\n        getConstantState(): Drawable.ConstantState;\n    }\n    module NetDrawable {\n        interface LoadListener {\n            onLoad(drawable: NetDrawable): any;\n            onError(drawable: NetDrawable): any;\n        }\n        enum TileMode {\n            DEFAULT = 0,\n            REPEAT = 1,\n        }\n    }\n}\ndeclare module androidui.util {\n    class Platform {\n        static isIOS: boolean;\n        static isAndroid: boolean;\n        static isWeChat: boolean;\n    }\n}\ndeclare module android.view {\n    class KeyEvent {\n        static KEYCODE_DPAD_UP: number;\n        static KEYCODE_DPAD_DOWN: number;\n        static KEYCODE_DPAD_LEFT: number;\n        static KEYCODE_DPAD_RIGHT: number;\n        static KEYCODE_DPAD_CENTER: number;\n        static KEYCODE_ENTER: number;\n        static KEYCODE_TAB: number;\n        static KEYCODE_SPACE: number;\n        static KEYCODE_ESCAPE: number;\n        static KEYCODE_Backspace: number;\n        static KEYCODE_PAGE_UP: number;\n        static KEYCODE_PAGE_DOWN: number;\n        static KEYCODE_MOVE_HOME: number;\n        static KEYCODE_MOVE_END: number;\n        static KEYCODE_Digit0: number;\n        static KEYCODE_Digit1: number;\n        static KEYCODE_Digit2: number;\n        static KEYCODE_Digit3: number;\n        static KEYCODE_Digit4: number;\n        static KEYCODE_Digit5: number;\n        static KEYCODE_Digit6: number;\n        static KEYCODE_Digit7: number;\n        static KEYCODE_Digit8: number;\n        static KEYCODE_Digit9: number;\n        static KEYCODE_Key_a: number;\n        static KEYCODE_Key_b: number;\n        static KEYCODE_Key_c: number;\n        static KEYCODE_Key_d: number;\n        static KEYCODE_Key_e: number;\n        static KEYCODE_Key_f: number;\n        static KEYCODE_Key_g: number;\n        static KEYCODE_Key_h: number;\n        static KEYCODE_Key_i: number;\n        static KEYCODE_Key_j: number;\n        static KEYCODE_Key_k: number;\n        static KEYCODE_Key_l: number;\n        static KEYCODE_Key_m: number;\n        static KEYCODE_Key_n: number;\n        static KEYCODE_Key_o: number;\n        static KEYCODE_Key_p: number;\n        static KEYCODE_Key_q: number;\n        static KEYCODE_Key_r: number;\n        static KEYCODE_Key_s: number;\n        static KEYCODE_Key_t: number;\n        static KEYCODE_Key_u: number;\n        static KEYCODE_Key_v: number;\n        static KEYCODE_Key_w: number;\n        static KEYCODE_Key_x: number;\n        static KEYCODE_Key_y: number;\n        static KEYCODE_Key_z: number;\n        static KEYCODE_KeyA: number;\n        static KEYCODE_KeyB: number;\n        static KEYCODE_KeyC: number;\n        static KEYCODE_KeyD: number;\n        static KEYCODE_KeyE: number;\n        static KEYCODE_KeyF: number;\n        static KEYCODE_KeyG: number;\n        static KEYCODE_KeyH: number;\n        static KEYCODE_KeyI: number;\n        static KEYCODE_KeyJ: number;\n        static KEYCODE_KeyK: number;\n        static KEYCODE_KeyL: number;\n        static KEYCODE_KeyM: number;\n        static KEYCODE_KeyN: number;\n        static KEYCODE_KeyO: number;\n        static KEYCODE_KeyP: number;\n        static KEYCODE_KeyQ: number;\n        static KEYCODE_KeyR: number;\n        static KEYCODE_KeyS: number;\n        static KEYCODE_KeyT: number;\n        static KEYCODE_KeyU: number;\n        static KEYCODE_KeyV: number;\n        static KEYCODE_KeyW: number;\n        static KEYCODE_KeyX: number;\n        static KEYCODE_KeyY: number;\n        static KEYCODE_KeyZ: number;\n        static KEYCODE_Semicolon: number;\n        static KEYCODE_LessThan: number;\n        static KEYCODE_Equal: number;\n        static KEYCODE_MoreThan: number;\n        static KEYCODE_Question: number;\n        static KEYCODE_Comma: number;\n        static KEYCODE_Period: number;\n        static KEYCODE_Slash: number;\n        static KEYCODE_Quotation: number;\n        static KEYCODE_LeftBracket: number;\n        static KEYCODE_Backslash: number;\n        static KEYCODE_RightBracket: number;\n        static KEYCODE_Minus: number;\n        static KEYCODE_Colon: number;\n        static KEYCODE_Double_Quotation: number;\n        static KEYCODE_Backquote: number;\n        static KEYCODE_Tilde: number;\n        static KEYCODE_Left_Brace: number;\n        static KEYCODE_Or: number;\n        static KEYCODE_Right_Brace: number;\n        static KEYCODE_Del: number;\n        static KEYCODE_Exclamation: number;\n        static KEYCODE_Right_Parenthesis: number;\n        static KEYCODE_AT: number;\n        static KEYCODE_Sharp: number;\n        static KEYCODE_Dollar: number;\n        static KEYCODE_Percent: number;\n        static KEYCODE_Power: number;\n        static KEYCODE_And: number;\n        static KEYCODE_Asterisk: number;\n        static KEYCODE_Left_Parenthesis: number;\n        static KEYCODE_Underline: number;\n        static KEYCODE_Add: number;\n        static KEYCODE_BACK: number;\n        static KEYCODE_MENU: number;\n        static KEYCODE_CHANGE_ANDROID_CHROME: {\n            noMeta: {\n                186: number;\n                187: number;\n                188: number;\n                189: number;\n                190: number;\n                191: number;\n                192: number;\n                219: number;\n                220: number;\n                221: number;\n            };\n            shift: {\n                186: number;\n                187: number;\n                188: number;\n                189: number;\n                190: number;\n                191: number;\n                192: number;\n                219: number;\n                220: number;\n                221: number;\n            };\n            ctrl: {};\n            alt: {};\n        };\n        private static FIX_MAP_KEYCODE;\n        static ACTION_DOWN: number;\n        static ACTION_UP: number;\n        static META_MASK_SHIFT: number;\n        static META_ALT_ON: number;\n        static META_SHIFT_ON: number;\n        static META_CTRL_ON: number;\n        static META_META_ON: number;\n        static FLAG_CANCELED: number;\n        static FLAG_CANCELED_LONG_PRESS: number;\n        private static FLAG_LONG_PRESS;\n        static FLAG_TRACKING: number;\n        private static FLAG_START_TRACKING;\n        mFlags: number;\n        private mAction;\n        private mKeyCode;\n        private mDownTime;\n        private mEventTime;\n        private mAltKey;\n        private mShiftKey;\n        private mCtrlKey;\n        private mMetaKey;\n        protected mIsTypingKey: boolean;\n        private _downingKeyEventMap;\n        static obtain(action: number, code: number): KeyEvent;\n        initKeyEvent(keyEvent: KeyboardEvent, action: number): void;\n        static isConfirmKey(keyCode: number): boolean;\n        isAltPressed(): boolean;\n        isShiftPressed(): boolean;\n        isCtrlPressed(): boolean;\n        isMetaPressed(): boolean;\n        getAction(): number;\n        startTracking(): void;\n        isTracking(): boolean;\n        isLongPress(): boolean;\n        getKeyCode(): number;\n        getRepeatCount(): number;\n        getDownTime(): number;\n        getEventTime(): number;\n        dispatch(receiver: KeyEvent.Callback, state?: KeyEvent.DispatcherState, target?: any): boolean;\n        hasNoModifiers(): boolean;\n        hasModifiers(modifiers: number): boolean;\n        getMetaState(): number;\n        toString(): string;\n        isCanceled(): boolean;\n        static actionToString(action: number): string;\n        static keyCodeToString(keyCode: number): string;\n    }\n    module KeyEvent {\n        interface Callback {\n            onKeyDown(keyCode: number, event: KeyEvent): boolean;\n            onKeyLongPress(keyCode: number, event: KeyEvent): boolean;\n            onKeyUp(keyCode: number, event: KeyEvent): boolean;\n        }\n        class DispatcherState {\n            mDownKeyCode: number;\n            mDownTarget: any;\n            mActiveLongPresses: util.SparseArray<number>;\n            reset(target: any): void;\n            startTracking(event: KeyEvent, target: any): void;\n            isTracking(event: KeyEvent): boolean;\n            performedLongPress(event: KeyEvent): void;\n            handleUpEvent(event: KeyEvent): void;\n        }\n    }\n}\ndeclare module android.graphics.drawable {\n    import Resources = android.content.res.Resources;\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n    import Runnable = java.lang.Runnable;\n    import Drawable = android.graphics.drawable.Drawable;\n    class LayerDrawable extends Drawable implements Drawable.Callback {\n        mLayerState: LayerDrawable.LayerState;\n        private mOpacityOverride;\n        private mPaddingL;\n        private mPaddingT;\n        private mPaddingR;\n        private mPaddingB;\n        private mTmpRect;\n        private mMutated;\n        constructor(layers: Drawable[], state?: LayerDrawable.LayerState);\n        createConstantState(state: LayerDrawable.LayerState): LayerDrawable.LayerState;\n        inflate(r: Resources, parser: HTMLElement): void;\n        private addLayer(layer, id, left?, top?, right?, bottom?);\n        findDrawableByLayerId(id: string): Drawable;\n        setId(index: number, id: string): void;\n        getNumberOfLayers(): number;\n        getDrawable(index: number): Drawable;\n        getId(index: number): string;\n        setDrawableByLayerId(id: string, drawable: Drawable): boolean;\n        setLayerInset(index: number, l: number, t: number, r: number, b: number): void;\n        drawableSizeChange(who: android.graphics.drawable.Drawable): void;\n        invalidateDrawable(who: Drawable): void;\n        scheduleDrawable(who: Drawable, what: Runnable, when: number): void;\n        unscheduleDrawable(who: Drawable, what: Runnable): void;\n        draw(canvas: Canvas): void;\n        getPadding(padding: Rect): boolean;\n        setVisible(visible: boolean, restart: boolean): boolean;\n        setDither(dither: boolean): void;\n        setAlpha(alpha: number): void;\n        getAlpha(): number;\n        setOpacity(opacity: number): void;\n        getOpacity(): number;\n        setAutoMirrored(mirrored: boolean): void;\n        isAutoMirrored(): boolean;\n        isStateful(): boolean;\n        protected onStateChange(state: number[]): boolean;\n        protected onLevelChange(level: number): boolean;\n        protected onBoundsChange(bounds: Rect): void;\n        getIntrinsicWidth(): number;\n        getIntrinsicHeight(): number;\n        private reapplyPadding(i, r);\n        private ensurePadding();\n        getConstantState(): Drawable.ConstantState;\n        mutate(): Drawable;\n    }\n    module LayerDrawable {\n        class ChildDrawable {\n            mDrawable: Drawable;\n            mInsetL: number;\n            mInsetT: number;\n            mInsetR: number;\n            mInsetB: number;\n            mId: string;\n        }\n        class LayerState implements Drawable.ConstantState {\n            mNum: number;\n            mChildren: LayerDrawable.ChildDrawable[];\n            private mHaveOpacity;\n            private mOpacity;\n            private mHaveStateful;\n            private mStateful;\n            private mCheckedConstantState;\n            private mCanConstantState;\n            private mAutoMirrored;\n            constructor(orig: LayerState, owner: LayerDrawable);\n            newDrawable(): Drawable;\n            getOpacity(): number;\n            isStateful(): boolean;\n            canConstantState(): boolean;\n        }\n    }\n}\ndeclare module android.graphics.drawable {\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n    import Resources = android.content.res.Resources;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Runnable = java.lang.Runnable;\n    class RotateDrawable extends Drawable implements Drawable.Callback {\n        private static MAX_LEVEL;\n        private mState;\n        private mMutated;\n        constructor(rotateState?: RotateDrawable.RotateState);\n        draw(canvas: Canvas): void;\n        getDrawable(): Drawable;\n        setAlpha(alpha: number): void;\n        getAlpha(): number;\n        getOpacity(): number;\n        drawableSizeChange(who: android.graphics.drawable.Drawable): void;\n        invalidateDrawable(who: Drawable): void;\n        scheduleDrawable(who: Drawable, what: Runnable, when: number): void;\n        unscheduleDrawable(who: Drawable, what: Runnable): void;\n        getPadding(padding: Rect): boolean;\n        setVisible(visible: boolean, restart: boolean): boolean;\n        isStateful(): boolean;\n        protected onStateChange(state: number[]): boolean;\n        protected onLevelChange(level: number): boolean;\n        protected onBoundsChange(bounds: Rect): void;\n        getIntrinsicWidth(): number;\n        getIntrinsicHeight(): number;\n        getConstantState(): Drawable.ConstantState;\n        inflate(r: Resources, parser: HTMLElement): void;\n        mutate(): Drawable;\n    }\n    module RotateDrawable {\n        class RotateState implements Drawable.ConstantState {\n            mDrawable: Drawable;\n            mPivotXRel: boolean;\n            mPivotX: number;\n            mPivotYRel: boolean;\n            mPivotY: number;\n            mFromDegrees: number;\n            mToDegrees: number;\n            mCurrentDegrees: number;\n            private mCanConstantState;\n            private mCheckedConstantState;\n            constructor(source: RotateState, owner: RotateDrawable);\n            newDrawable(): Drawable;\n            canConstantState(): boolean;\n        }\n    }\n}\ndeclare module java.lang {\n    class Float {\n        static MIN_VALUE: number;\n        static MAX_VALUE: number;\n        static parseFloat(value: string): number;\n    }\n}\ndeclare module android.graphics.drawable {\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n    import Resources = android.content.res.Resources;\n    import Runnable = java.lang.Runnable;\n    import Drawable = android.graphics.drawable.Drawable;\n    class ScaleDrawable extends Drawable implements Drawable.Callback {\n        private mScaleState;\n        private mMutated;\n        private mTmpRect;\n        constructor(drawable: Drawable, gravity: number, scaleWidth: number, scaleHeight: number);\n        constructor(state?: ScaleDrawable.ScaleState);\n        getDrawable(): Drawable;\n        inflate(r: Resources, parser: HTMLElement): void;\n        drawableSizeChange(who: android.graphics.drawable.Drawable): void;\n        invalidateDrawable(who: Drawable): void;\n        scheduleDrawable(who: Drawable, what: Runnable, when: number): void;\n        unscheduleDrawable(who: Drawable, what: Runnable): void;\n        draw(canvas: Canvas): void;\n        getPadding(padding: Rect): boolean;\n        setVisible(visible: boolean, restart: boolean): boolean;\n        setAlpha(alpha: number): void;\n        getAlpha(): number;\n        getOpacity(): number;\n        isStateful(): boolean;\n        protected onStateChange(state: number[]): boolean;\n        protected onLevelChange(level: number): boolean;\n        protected onBoundsChange(bounds: Rect): void;\n        getIntrinsicWidth(): number;\n        getIntrinsicHeight(): number;\n        getConstantState(): Drawable.ConstantState;\n        mutate(): Drawable;\n    }\n    module ScaleDrawable {\n        class ScaleState implements Drawable.ConstantState {\n            mDrawable: Drawable;\n            mScaleWidth: number;\n            mScaleHeight: number;\n            mGravity: number;\n            mUseIntrinsicSizeAsMin: boolean;\n            private mCheckedConstantState;\n            private mCanConstantState;\n            constructor(orig: ScaleState, owner: ScaleDrawable);\n            newDrawable(): Drawable;\n            canConstantState(): boolean;\n        }\n    }\n}\ndeclare module android.graphics.drawable {\n    interface Animatable {\n        start(): void;\n        stop(): void;\n        isRunning(): boolean;\n    }\n    module Animatable {\n        function isImpl(obj: any): any;\n    }\n}\ndeclare module android.graphics.drawable {\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n    class DrawableContainer extends Drawable implements Drawable.Callback {\n        private static DEBUG;\n        private static TAG;\n        static DEFAULT_DITHER: boolean;\n        private mDrawableContainerState;\n        private mCurrDrawable;\n        private mAlpha;\n        private mCurIndex;\n        mMutated: boolean;\n        private mAnimationRunnable;\n        private mEnterAnimationEnd;\n        private mExitAnimationEnd;\n        private mLastDrawable;\n        draw(canvas: Canvas): void;\n        private needsMirroring();\n        getPadding(padding: android.graphics.Rect): boolean;\n        setAlpha(alpha: number): void;\n        getAlpha(): number;\n        setDither(dither: boolean): void;\n        setEnterFadeDuration(ms: number): void;\n        setExitFadeDuration(ms: number): void;\n        protected onBoundsChange(bounds: android.graphics.Rect): void;\n        isStateful(): boolean;\n        setAutoMirrored(mirrored: boolean): void;\n        isAutoMirrored(): boolean;\n        jumpToCurrentState(): void;\n        protected onStateChange(state: Array<number>): boolean;\n        protected onLevelChange(level: number): boolean;\n        getIntrinsicWidth(): number;\n        getIntrinsicHeight(): number;\n        getMinimumWidth(): number;\n        getMinimumHeight(): number;\n        drawableSizeChange(who: android.graphics.drawable.Drawable): void;\n        invalidateDrawable(who: android.graphics.drawable.Drawable): void;\n        scheduleDrawable(who: android.graphics.drawable.Drawable, what: java.lang.Runnable, when: number): void;\n        unscheduleDrawable(who: android.graphics.drawable.Drawable, what: java.lang.Runnable): void;\n        setVisible(visible: boolean, restart: boolean): boolean;\n        getOpacity(): number;\n        selectDrawable(idx: number): boolean;\n        animate(schedule: boolean): void;\n        getCurrent(): Drawable;\n        getConstantState(): Drawable.ConstantState;\n        mutate(): Drawable;\n        setConstantState(state: DrawableContainer.DrawableContainerState): void;\n    }\n    module DrawableContainer {\n        class DrawableContainerState implements Drawable.ConstantState {\n            mOwner: DrawableContainer;\n            private mDrawableFutures;\n            mDrawables: Array<Drawable>;\n            readonly mNumChildren: number;\n            mVariablePadding: boolean;\n            mPaddingChecked: boolean;\n            mConstantPadding: Rect;\n            mConstantSize: boolean;\n            mComputedConstantSize: boolean;\n            mConstantWidth: number;\n            mConstantHeight: number;\n            mConstantMinimumWidth: number;\n            mConstantMinimumHeight: number;\n            mCheckedOpacity: boolean;\n            mOpacity: number;\n            mCheckedStateful: boolean;\n            mStateful: boolean;\n            mCheckedConstantState: boolean;\n            mCanConstantState: boolean;\n            mDither: boolean;\n            mMutated: boolean;\n            mEnterFadeDuration: number;\n            mExitFadeDuration: number;\n            mAutoMirrored: boolean;\n            constructor(orig: DrawableContainerState, owner: DrawableContainer);\n            addChild(dr: Drawable): number;\n            getCapacity(): number;\n            private createAllFutures();\n            getChildCount(): number;\n            getChildren(): Array<Drawable>;\n            getChild(index: number): Drawable;\n            mutate(): void;\n            setVariablePadding(variable: boolean): void;\n            getConstantPadding(): Rect;\n            setConstantSize(constant: boolean): void;\n            isConstantSize(): boolean;\n            getConstantWidth(): number;\n            getConstantHeight(): number;\n            getConstantMinimumWidth(): number;\n            getConstantMinimumHeight(): number;\n            computeConstantSize(): void;\n            setEnterFadeDuration(duration: number): void;\n            getEnterFadeDuration(): number;\n            setExitFadeDuration(duration: number): void;\n            getExitFadeDuration(): number;\n            getOpacity(): number;\n            isStateful(): boolean;\n            canConstantState(): boolean;\n            newDrawable(): android.graphics.drawable.Drawable;\n        }\n    }\n}\ndeclare module android.graphics.drawable {\n    import Resources = android.content.res.Resources;\n    import Runnable = java.lang.Runnable;\n    import Animatable = android.graphics.drawable.Animatable;\n    import Drawable = android.graphics.drawable.Drawable;\n    import DrawableContainer = android.graphics.drawable.DrawableContainer;\n    class AnimationDrawable extends DrawableContainer implements Runnable, Animatable {\n        private mAnimationState;\n        private mCurFrame;\n        constructor(state?: AnimationDrawable.AnimationState);\n        setVisible(visible: boolean, restart: boolean): boolean;\n        start(): void;\n        stop(): void;\n        isRunning(): boolean;\n        run(): void;\n        unscheduleSelf(what: Runnable): void;\n        getNumberOfFrames(): number;\n        getFrame(index: number): Drawable;\n        getDuration(i: number): number;\n        isOneShot(): boolean;\n        setOneShot(oneShot: boolean): void;\n        addFrame(frame: Drawable, duration: number): void;\n        private nextFrame(unschedule);\n        private setFrame(frame, unschedule, animate);\n        inflate(r: Resources, parser: HTMLElement): void;\n        mutate(): Drawable;\n    }\n    module AnimationDrawable {\n        class AnimationState extends DrawableContainer.DrawableContainerState {\n            private mDurations;\n            private mOneShot;\n            constructor(orig: AnimationState, owner: AnimationDrawable);\n            newDrawable(): Drawable;\n            addFrame(dr: Drawable, dur: number): void;\n        }\n    }\n}\ndeclare module android.graphics.drawable {\n    class StateListDrawable extends DrawableContainer {\n        private mStateListState;\n        constructor();\n        private initWithState(state);\n        addState(stateSet: Array<number>, drawable: Drawable): void;\n        isStateful(): boolean;\n        protected onStateChange(stateSet: Array<number>): boolean;\n        inflate(r: android.content.res.Resources, parser: HTMLElement): void;\n        private getStateListState();\n        getStateCount(): number;\n        getStateSet(index: number): Array<number>;\n        getStateDrawable(index: number): Drawable;\n        getStateDrawableIndex(stateSet: Array<number>): number;\n        mutate(): Drawable;\n    }\n}\ndeclare module android.R {\n    const id: {\n        \"content\": string;\n        \"background\": string;\n        \"secondaryProgress\": string;\n        \"progress\": string;\n        \"contentPanel\": string;\n        \"topPanel\": string;\n        \"buttonPanel\": string;\n        \"customPanel\": string;\n        \"custom\": string;\n        \"titleDivider\": string;\n        \"titleDividerTop\": string;\n        \"title_template\": string;\n        \"icon\": string;\n        \"alertTitle\": string;\n        \"scrollView\": string;\n        \"message\": string;\n        \"button1\": string;\n        \"button2\": string;\n        \"button3\": string;\n        \"leftSpacer\": string;\n        \"rightSpacer\": string;\n        \"text1\": string;\n        \"action_bar_center_layout\": string;\n        \"action_bar_title\": string;\n        \"action_bar_sub_title\": string;\n        \"action_bar_left\": string;\n        \"action_bar_right\": string;\n        \"parentPanel\": string;\n        \"progress_percent\": string;\n        \"progress_number\": string;\n        \"title\": string;\n        \"shortcut\": string;\n        \"select_dialog_listview\": string;\n    };\n}\ndeclare module android.R {\n    import Drawable = android.graphics.drawable.Drawable;\n    import InsetDrawable = android.graphics.drawable.InsetDrawable;\n    import StateListDrawable = android.graphics.drawable.StateListDrawable;\n    class drawable {\n        static readonly btn_default: Drawable;\n        static readonly editbox_background: Drawable;\n        static readonly btn_check: Drawable;\n        static readonly btn_radio: Drawable;\n        static readonly progress_small_holo: Drawable;\n        static readonly progress_medium_holo: Drawable;\n        static readonly progress_large_holo: Drawable;\n        static readonly progress_horizontal_holo: Drawable;\n        static readonly progress_indeterminate_horizontal_holo: Drawable;\n        static readonly ratingbar_full_empty_holo_light: Drawable;\n        static readonly ratingbar_full_filled_holo_light: Drawable;\n        static readonly ratingbar_full_holo_light: Drawable;\n        static readonly ratingbar_holo_light: Drawable;\n        static readonly ratingbar_small_holo_light: Drawable;\n        static readonly scrubber_control_selector_holo: Drawable;\n        static readonly scrubber_progress_horizontal_holo_light: Drawable;\n        static readonly scrubber_primary_holo: Drawable;\n        static readonly scrubber_secondary_holo: Drawable;\n        static readonly scrubber_track_holo_light: Drawable;\n        static readonly list_selector_background: Drawable;\n        static readonly list_divider: Drawable;\n        static readonly divider_vertical: Drawable;\n        static readonly divider_horizontal: Drawable;\n        static readonly item_background: StateListDrawable;\n        static readonly toast_frame: InsetDrawable;\n    }\n}\ndeclare module androidui.image {\n    import Canvas = android.graphics.Canvas;\n    class NinePatchDrawable extends NetDrawable {\n        private static GlobalBorderInfoCache;\n        private mTmpRect;\n        private mTmpRect2;\n        private mNinePatchBorderInfo;\n        private mNinePatchDrawCache;\n        protected initBoundWithLoadedImage(image: NetImage): void;\n        private initNinePatchBorderInfo(image);\n        protected onLoad(): void;\n        draw(canvas: Canvas): void;\n        private getNinePatchCache();\n        private drawNinePatch(canvas);\n        getPadding(padding: android.graphics.Rect): boolean;\n    }\n}\ndeclare module androidui.image {\n    import Drawable = android.graphics.drawable.Drawable;\n    import Canvas = android.graphics.Canvas;\n    class ChangeImageSizeDrawable extends Drawable implements Drawable.Callback {\n        private mState;\n        private mTmpRect;\n        private mMutated;\n        constructor(drawable: Drawable, overrideWidth: number, overrideHeight?: number);\n        drawableSizeChange(who: android.graphics.drawable.Drawable): any;\n        invalidateDrawable(who: android.graphics.drawable.Drawable): void;\n        scheduleDrawable(who: android.graphics.drawable.Drawable, what: java.lang.Runnable, when: number): void;\n        unscheduleDrawable(who: android.graphics.drawable.Drawable, what: java.lang.Runnable): void;\n        draw(canvas: Canvas): void;\n        getPadding(padding: android.graphics.Rect): boolean;\n        setVisible(visible: boolean, restart: boolean): boolean;\n        setAlpha(alpha: number): void;\n        getAlpha(): number;\n        getOpacity(): number;\n        isStateful(): boolean;\n        protected onStateChange(state: Array<number>): boolean;\n        protected onBoundsChange(r: android.graphics.Rect): void;\n        getIntrinsicWidth(): number;\n        getIntrinsicHeight(): number;\n        getConstantState(): Drawable.ConstantState;\n        mutate(): Drawable;\n        getDrawable(): Drawable;\n    }\n}\ndeclare module android.R {\n    class image_base64 {\n        static readonly actionbar_ic_back_white: any;\n        static readonly btn_check_off_disabled_focused_holo_light: any;\n        static readonly btn_check_off_disabled_holo_light: any;\n        static readonly btn_check_off_focused_holo_light: any;\n        static readonly btn_check_off_holo_light: any;\n        static readonly btn_check_off_pressed_holo_light: any;\n        static readonly btn_check_on_disabled_focused_holo_light: any;\n        static readonly btn_check_on_disabled_holo_light: any;\n        static readonly btn_check_on_focused_holo_light: any;\n        static readonly btn_check_on_holo_light: any;\n        static readonly btn_check_on_pressed_holo_light: any;\n        static readonly btn_default_disabled_focused_holo_light: any;\n        static readonly btn_default_disabled_holo_light: any;\n        static readonly btn_default_focused_holo_light: any;\n        static readonly btn_default_normal_holo_light: any;\n        static readonly btn_default_pressed_holo_light: any;\n        static readonly btn_radio_off_disabled_focused_holo_light: any;\n        static readonly btn_radio_off_disabled_holo_light: any;\n        static readonly btn_radio_off_focused_holo_light: any;\n        static readonly btn_radio_off_holo_light: any;\n        static readonly btn_radio_off_pressed_holo_light: any;\n        static readonly btn_radio_on_disabled_focused_holo_light: any;\n        static readonly btn_radio_on_disabled_holo_light: any;\n        static readonly btn_radio_on_focused_holo_light: any;\n        static readonly btn_radio_on_holo_light: any;\n        static readonly btn_radio_on_pressed_holo_light: any;\n        static readonly btn_rating_star_off_normal_holo_light: any;\n        static readonly btn_rating_star_off_pressed_holo_light: any;\n        static readonly btn_rating_star_on_normal_holo_light: any;\n        static readonly btn_rating_star_on_pressed_holo_light: any;\n        static readonly dropdown_background_dark: any;\n        static readonly editbox_background_focus_yellow: any;\n        static readonly editbox_background_normal: any;\n        static readonly ic_menu_moreoverflow_normal_holo_dark: any;\n        static readonly menu_panel_holo_dark: any;\n        static readonly menu_panel_holo_light: any;\n        static readonly popup_bottom_bright: any;\n        static readonly popup_center_bright: any;\n        static readonly popup_full_bright: any;\n        static readonly popup_top_bright: any;\n        static readonly progressbar_indeterminate_holo1: any;\n        static readonly progressbar_indeterminate_holo2: any;\n        static readonly progressbar_indeterminate_holo3: any;\n        static readonly progressbar_indeterminate_holo4: any;\n        static readonly progressbar_indeterminate_holo5: any;\n        static readonly progressbar_indeterminate_holo6: any;\n        static readonly progressbar_indeterminate_holo7: any;\n        static readonly progressbar_indeterminate_holo8: any;\n        static readonly rate_star_big_half_holo_light: any;\n        static readonly rate_star_big_off_holo_light: any;\n        static readonly rate_star_big_on_holo_light: any;\n        static readonly scrubber_control_disabled_holo: any;\n        static readonly scrubber_control_focused_holo: any;\n        static readonly scrubber_control_normal_holo: any;\n        static readonly scrubber_control_pressed_holo: any;\n        static readonly spinner_76_inner_holo: any;\n        static readonly spinner_76_outer_holo: any;\n    }\n}\ndeclare module android.R {\n    import NetDrawable = androidui.image.NetDrawable;\n    import ChangeImageSizeDrawable = androidui.image.ChangeImageSizeDrawable;\n    import NinePatchDrawable = androidui.image.NinePatchDrawable;\n    class image {\n        static readonly actionbar_ic_back_white: NetDrawable;\n        static readonly btn_check_off_disabled_focused_holo_light: NetDrawable;\n        static readonly btn_check_off_disabled_holo_light: NetDrawable;\n        static readonly btn_check_off_focused_holo_light: NetDrawable;\n        static readonly btn_check_off_holo_light: NetDrawable;\n        static readonly btn_check_off_pressed_holo_light: NetDrawable;\n        static readonly btn_check_on_disabled_focused_holo_light: NetDrawable;\n        static readonly btn_check_on_disabled_holo_light: NetDrawable;\n        static readonly btn_check_on_focused_holo_light: NetDrawable;\n        static readonly btn_check_on_holo_light: NetDrawable;\n        static readonly btn_check_on_pressed_holo_light: NetDrawable;\n        static readonly btn_default_disabled_focused_holo_light: NinePatchDrawable;\n        static readonly btn_default_disabled_holo_light: NinePatchDrawable;\n        static readonly btn_default_focused_holo_light: NinePatchDrawable;\n        static readonly btn_default_normal_holo_light: NinePatchDrawable;\n        static readonly btn_default_pressed_holo_light: NinePatchDrawable;\n        static readonly btn_radio_off_disabled_focused_holo_light: NetDrawable;\n        static readonly btn_radio_off_disabled_holo_light: NetDrawable;\n        static readonly btn_radio_off_focused_holo_light: NetDrawable;\n        static readonly btn_radio_off_holo_light: NetDrawable;\n        static readonly btn_radio_off_pressed_holo_light: NetDrawable;\n        static readonly btn_radio_on_disabled_focused_holo_light: NetDrawable;\n        static readonly btn_radio_on_disabled_holo_light: NetDrawable;\n        static readonly btn_radio_on_focused_holo_light: NetDrawable;\n        static readonly btn_radio_on_holo_light: NetDrawable;\n        static readonly btn_radio_on_pressed_holo_light: NetDrawable;\n        static readonly btn_rating_star_off_normal_holo_light: NetDrawable;\n        static readonly btn_rating_star_off_pressed_holo_light: NetDrawable;\n        static readonly btn_rating_star_on_normal_holo_light: NetDrawable;\n        static readonly btn_rating_star_on_pressed_holo_light: NetDrawable;\n        static readonly dropdown_background_dark: NinePatchDrawable;\n        static readonly editbox_background_focus_yellow: NinePatchDrawable;\n        static readonly editbox_background_normal: NinePatchDrawable;\n        static readonly ic_menu_moreoverflow_normal_holo_dark: NetDrawable;\n        static readonly menu_panel_holo_dark: NinePatchDrawable;\n        static readonly menu_panel_holo_light: NinePatchDrawable;\n        static readonly popup_bottom_bright: NinePatchDrawable;\n        static readonly popup_center_bright: NinePatchDrawable;\n        static readonly popup_full_bright: NinePatchDrawable;\n        static readonly popup_top_bright: NinePatchDrawable;\n        static readonly progressbar_indeterminate_holo1: NetDrawable;\n        static readonly progressbar_indeterminate_holo2: NetDrawable;\n        static readonly progressbar_indeterminate_holo3: NetDrawable;\n        static readonly progressbar_indeterminate_holo4: NetDrawable;\n        static readonly progressbar_indeterminate_holo5: NetDrawable;\n        static readonly progressbar_indeterminate_holo6: NetDrawable;\n        static readonly progressbar_indeterminate_holo7: NetDrawable;\n        static readonly progressbar_indeterminate_holo8: NetDrawable;\n        static readonly rate_star_big_half_holo_light: NetDrawable;\n        static readonly rate_star_big_off_holo_light: NetDrawable;\n        static readonly rate_star_big_on_holo_light: NetDrawable;\n        static readonly scrubber_control_disabled_holo: NetDrawable;\n        static readonly scrubber_control_focused_holo: NetDrawable;\n        static readonly scrubber_control_normal_holo: NetDrawable;\n        static readonly scrubber_control_pressed_holo: NetDrawable;\n        static readonly spinner_76_inner_holo: NetDrawable;\n        static readonly spinner_76_outer_holo: NetDrawable;\n        static readonly spinner_48_outer_holo: ChangeImageSizeDrawable;\n        static readonly spinner_48_inner_holo: ChangeImageSizeDrawable;\n        static readonly spinner_16_outer_holo: ChangeImageSizeDrawable;\n        static readonly spinner_16_inner_holo: ChangeImageSizeDrawable;\n        static readonly rate_star_small_off_holo_light: ChangeImageSizeDrawable;\n        static readonly rate_star_small_half_holo_light: ChangeImageSizeDrawable;\n        static readonly rate_star_small_on_holo_light: ChangeImageSizeDrawable;\n    }\n}\ndeclare module android.R {\n    import ColorStateList = android.content.res.ColorStateList;\n    class color {\n        static readonly textView_textColor: ColorStateList;\n        static readonly primary_text_light_disable_only: ColorStateList;\n        static readonly primary_text_dark_disable_only: ColorStateList;\n        static white: number;\n        static black: number;\n        static transparent: number;\n    }\n}\ndeclare module goog.math {\n    class Long {\n        private static IntCache_;\n        private static TWO_PWR_16_DBL_;\n        private static TWO_PWR_24_DBL_;\n        private static TWO_PWR_32_DBL_;\n        private static TWO_PWR_31_DBL_;\n        private static TWO_PWR_48_DBL_;\n        private static TWO_PWR_64_DBL_;\n        private static TWO_PWR_63_DBL_;\n        private static TWO_PWR_24_;\n        static ZERO: Long;\n        static ONE: Long;\n        static NEG_ONE: Long;\n        static MAX_VALUE: Long;\n        static MIN_VALUE: Long;\n        private low_;\n        private high_;\n        constructor(low: number, high: number);\n        toInt(): number;\n        toNumber(): number;\n        toString(opt_radix: number): string;\n        getHighBits(): number;\n        getLowBits(): number;\n        getLowBitsUnsigned(): number;\n        getNumBitsAbs(): number;\n        isZero(): boolean;\n        isNegative(): boolean;\n        isOdd(): boolean;\n        equals(other: Long): boolean;\n        notEquals(other: Long): boolean;\n        lessThan(other: Long): boolean;\n        lessThanOrEqual(other: Long): boolean;\n        greaterThan(other: Long): boolean;\n        greaterThanOrEqual(other: Long): boolean;\n        compare(other: Long): number;\n        negate(): Long;\n        add(other: Long): Long;\n        subtract(other: Long): Long;\n        multiply(other: Long): Long;\n        div(other: Long): Long;\n        modulo(other: Long): Long;\n        not(): Long;\n        and(other: Long): Long;\n        or(other: Long): Long;\n        xor(other: Long): Long;\n        shiftLeft(numBits: number): Long;\n        shiftRight(numBits: number): Long;\n        shiftRightUnsigned(numBits: number): Long;\n        static fromInt(value: number): Long;\n        static fromNumber(value: number): Long;\n        static fromBits(lowBits: number, highBits: number): Long;\n        static fromString(str: string, opt_radix: number): Long;\n    }\n}\ndeclare module java.lang {\n    class Long {\n        static MIN_VALUE: number;\n        static MAX_VALUE: number;\n    }\n}\ndeclare module android.view.animation {\n    class AccelerateDecelerateInterpolator implements Interpolator {\n        getInterpolation(input: number): number;\n    }\n}\ndeclare module android.view.animation {\n    class DecelerateInterpolator implements Interpolator {\n        private mFactor;\n        constructor(factor?: number);\n        getInterpolation(input: number): number;\n    }\n}\ndeclare module android.view.animation {\n    import Matrix = android.graphics.Matrix;\n    import StringBuilder = java.lang.StringBuilder;\n    class Transformation {\n        static TYPE_IDENTITY: number;\n        static TYPE_ALPHA: number;\n        static TYPE_MATRIX: number;\n        static TYPE_BOTH: number;\n        protected mMatrix: Matrix;\n        protected mAlpha: number;\n        protected mTransformationType: number;\n        constructor();\n        clear(): void;\n        getTransformationType(): number;\n        setTransformationType(transformationType: number): void;\n        set(t: Transformation): void;\n        compose(t: Transformation): void;\n        postCompose(t: Transformation): void;\n        getMatrix(): Matrix;\n        setAlpha(alpha: number): void;\n        getAlpha(): number;\n        toString(): string;\n        toShortString(sb?: StringBuilder): void;\n    }\n}\ndeclare module android.view.animation {\n    import RectF = android.graphics.RectF;\n    import Handler = android.os.Handler;\n    import Interpolator = android.view.animation.Interpolator;\n    import Transformation = android.view.animation.Transformation;\n    abstract class Animation {\n        static INFINITE: number;\n        static RESTART: number;\n        static REVERSE: number;\n        static START_ON_FIRST_FRAME: number;\n        static ABSOLUTE: number;\n        static RELATIVE_TO_SELF: number;\n        static RELATIVE_TO_PARENT: number;\n        static ZORDER_NORMAL: number;\n        static ZORDER_TOP: number;\n        static ZORDER_BOTTOM: number;\n        private static USE_CLOSEGUARD;\n        mEnded: boolean;\n        mStarted: boolean;\n        mCycleFlip: boolean;\n        mInitialized: boolean;\n        mFillBefore: boolean;\n        mFillAfter: boolean;\n        mFillEnabled: boolean;\n        mStartTime: number;\n        mStartOffset: number;\n        mDuration: number;\n        mRepeatCount: number;\n        mRepeated: number;\n        mRepeatMode: number;\n        mInterpolator: Interpolator;\n        mListener: Animation.AnimationListener;\n        private mZAdjustment;\n        private mBackgroundColor;\n        private mScaleFactor;\n        private mDetachWallpaper;\n        private mMore;\n        private mOneMoreTime;\n        mPreviousRegion: RectF;\n        mRegion: RectF;\n        mTransformation: Transformation;\n        mPreviousTransformation: Transformation;\n        private mListenerHandler;\n        private mOnStart;\n        private mOnRepeat;\n        private mOnEnd;\n        constructor();\n        reset(): void;\n        cancel(): void;\n        detach(): void;\n        isInitialized(): boolean;\n        initialize(width: number, height: number, parentWidth: number, parentHeight: number): void;\n        setListenerHandler(handler: Handler): void;\n        setInterpolator(i: Interpolator): void;\n        setStartOffset(startOffset: number): void;\n        setDuration(durationMillis: number): void;\n        restrictDuration(durationMillis: number): void;\n        scaleCurrentDuration(scale: number): void;\n        setStartTime(startTimeMillis: number): void;\n        start(): void;\n        startNow(): void;\n        setRepeatMode(repeatMode: number): void;\n        setRepeatCount(repeatCount: number): void;\n        isFillEnabled(): boolean;\n        setFillEnabled(fillEnabled: boolean): void;\n        setFillBefore(fillBefore: boolean): void;\n        setFillAfter(fillAfter: boolean): void;\n        setZAdjustment(zAdjustment: number): void;\n        setBackgroundColor(bg: number): void;\n        protected getScaleFactor(): number;\n        setDetachWallpaper(detachWallpaper: boolean): void;\n        getInterpolator(): Interpolator;\n        getStartTime(): number;\n        getDuration(): number;\n        getStartOffset(): number;\n        getRepeatMode(): number;\n        getRepeatCount(): number;\n        getFillBefore(): boolean;\n        getFillAfter(): boolean;\n        getZAdjustment(): number;\n        getBackgroundColor(): number;\n        getDetachWallpaper(): boolean;\n        willChangeTransformationMatrix(): boolean;\n        willChangeBounds(): boolean;\n        setAnimationListener(listener: Animation.AnimationListener): void;\n        protected ensureInterpolator(): void;\n        computeDurationHint(): number;\n        getTransformation(currentTime: number, outTransformation: Transformation, scale?: number): boolean;\n        private fireAnimationStart();\n        private fireAnimationRepeat();\n        private fireAnimationEnd();\n        hasStarted(): boolean;\n        hasEnded(): boolean;\n        protected applyTransformation(interpolatedTime: number, t: Transformation): void;\n        protected resolveSize(type: number, value: number, size: number, parentSize: number): number;\n        getInvalidateRegion(left: number, top: number, right: number, bottom: number, invalidate: RectF, transformation: Transformation): void;\n        initializeInvalidateRegion(left: number, top: number, right: number, bottom: number): void;\n        hasAlpha(): boolean;\n    }\n    module Animation {\n        class Description {\n            type: number;\n            value: number;\n            static parseValue(value: string): Description;\n        }\n        interface AnimationListener {\n            onAnimationStart(animation: Animation): void;\n            onAnimationEnd(animation: Animation): void;\n            onAnimationRepeat(animation: Animation): void;\n        }\n    }\n}\ndeclare module android.R {\n    class attr {\n        static textViewStyle: Map<string, string>;\n        static buttonStyle: Map<string, string>;\n        static editTextStyle: Map<string, string>;\n        static imageButtonStyle: Map<string, string>;\n        static checkboxStyle: Map<string, string>;\n        static radiobuttonStyle: Map<string, string>;\n        static checkedTextViewStyle: Map<string, string>;\n        static progressBarStyle: Map<string, string>;\n        static progressBarStyleHorizontal: Map<string, string>;\n        static progressBarStyleSmall: Map<string, string>;\n        static progressBarStyleLarge: Map<string, string>;\n        static seekBarStyle: Map<string, string>;\n        static ratingBarStyle: Map<string, string>;\n        static ratingBarStyleIndicator: Map<string, string>;\n        static ratingBarStyleSmall: Map<string, string>;\n        static absListViewStyle: Map<string, string>;\n        static gridViewStyle: Map<string, string>;\n        static listViewStyle: Map<string, string>;\n        static expandableListViewStyle: Map<string, string>;\n        static numberPickerStyle: Map<string, string>;\n        static popupWindowStyle: Map<string, string>;\n        static listPopupWindowStyle: Map<string, string>;\n        static popupMenuStyle: Map<string, string>;\n        static dropDownListViewStyle: Map<string, string>;\n        static spinnerStyle: Map<string, string>;\n        static actionBarStyle: Map<string, string>;\n        static scrollViewStyle: Map<string, string>;\n    }\n}\ndeclare module android.view {\n    import Drawable = android.graphics.drawable.Drawable;\n    import Matrix = android.graphics.Matrix;\n    import Runnable = java.lang.Runnable;\n    import JavaObject = java.lang.JavaObject;\n    import ViewParent = android.view.ViewParent;\n    import Handler = android.os.Handler;\n    import Rect = android.graphics.Rect;\n    import Point = android.graphics.Point;\n    import Canvas = android.graphics.Canvas;\n    import CopyOnWriteArrayList = java.lang.util.concurrent.CopyOnWriteArrayList;\n    import ArrayList = java.util.ArrayList;\n    import Context = android.content.Context;\n    import Resources = android.content.res.Resources;\n    import AttrBinder = androidui.attr.AttrBinder;\n    import KeyEvent = android.view.KeyEvent;\n    import Animation = android.view.animation.Animation;\n    import Transformation = android.view.animation.Transformation;\n    import TypedArray = android.content.res.TypedArray;\n    class View extends JavaObject implements Drawable.Callback, KeyEvent.Callback {\n        static DBG: boolean;\n        static VIEW_LOG_TAG: string;\n        static PFLAG_WANTS_FOCUS: number;\n        static PFLAG_FOCUSED: number;\n        static PFLAG_SELECTED: number;\n        static PFLAG_IS_ROOT_NAMESPACE: number;\n        static PFLAG_HAS_BOUNDS: number;\n        static PFLAG_DRAWN: number;\n        static PFLAG_DRAW_ANIMATION: number;\n        static PFLAG_SKIP_DRAW: number;\n        static PFLAG_ONLY_DRAWS_BACKGROUND: number;\n        static PFLAG_REQUEST_TRANSPARENT_REGIONS: number;\n        static PFLAG_DRAWABLE_STATE_DIRTY: number;\n        static PFLAG_MEASURED_DIMENSION_SET: number;\n        static PFLAG_FORCE_LAYOUT: number;\n        static PFLAG_LAYOUT_REQUIRED: number;\n        static PFLAG_PRESSED: number;\n        static PFLAG_DRAWING_CACHE_VALID: number;\n        static PFLAG_ANIMATION_STARTED: number;\n        static PFLAG_ALPHA_SET: number;\n        static PFLAG_SCROLL_CONTAINER: number;\n        static PFLAG_SCROLL_CONTAINER_ADDED: number;\n        static PFLAG_DIRTY: number;\n        static PFLAG_DIRTY_OPAQUE: number;\n        static PFLAG_DIRTY_MASK: number;\n        static PFLAG_OPAQUE_BACKGROUND: number;\n        static PFLAG_OPAQUE_SCROLLBARS: number;\n        static PFLAG_OPAQUE_MASK: number;\n        static PFLAG_PREPRESSED: number;\n        static PFLAG_CANCEL_NEXT_UP_EVENT: number;\n        static PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH: number;\n        static PFLAG_HOVERED: number;\n        static PFLAG_PIVOT_EXPLICITLY_SET: number;\n        static PFLAG_ACTIVATED: number;\n        static PFLAG_INVALIDATED: number;\n        static PFLAG2_VIEW_QUICK_REJECTED: number;\n        static PFLAG2_HAS_TRANSIENT_STATE: number;\n        static PFLAG3_VIEW_IS_ANIMATING_TRANSFORM: number;\n        static PFLAG3_VIEW_IS_ANIMATING_ALPHA: number;\n        static PFLAG3_IS_LAID_OUT: number;\n        static PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT: number;\n        static PFLAG3_CALLED_SUPER: number;\n        private static NOT_FOCUSABLE;\n        private static FOCUSABLE;\n        private static FOCUSABLE_MASK;\n        static NO_ID: any;\n        static OVER_SCROLL_ALWAYS: number;\n        static OVER_SCROLL_IF_CONTENT_SCROLLS: number;\n        static OVER_SCROLL_NEVER: number;\n        static MEASURED_SIZE_MASK: number;\n        static MEASURED_STATE_MASK: number;\n        static MEASURED_HEIGHT_STATE_SHIFT: number;\n        static MEASURED_STATE_TOO_SMALL: number;\n        static VISIBILITY_MASK: number;\n        static VISIBLE: number;\n        static INVISIBLE: number;\n        static GONE: number;\n        static ENABLED: number;\n        static DISABLED: number;\n        static ENABLED_MASK: number;\n        static WILL_NOT_DRAW: number;\n        static DRAW_MASK: number;\n        static SCROLLBARS_NONE: number;\n        static SCROLLBARS_HORIZONTAL: number;\n        static SCROLLBARS_VERTICAL: number;\n        static SCROLLBARS_MASK: number;\n        static FOCUSABLES_ALL: number;\n        static FOCUSABLES_TOUCH_MODE: number;\n        static FOCUS_BACKWARD: number;\n        static FOCUS_FORWARD: number;\n        static FOCUS_LEFT: number;\n        static FOCUS_UP: number;\n        static FOCUS_RIGHT: number;\n        static FOCUS_DOWN: number;\n        static EMPTY_STATE_SET: number[];\n        static ENABLED_STATE_SET: number[];\n        static FOCUSED_STATE_SET: number[];\n        static SELECTED_STATE_SET: number[];\n        static PRESSED_STATE_SET: number[];\n        static WINDOW_FOCUSED_STATE_SET: number[];\n        static ENABLED_FOCUSED_STATE_SET: number[];\n        static ENABLED_SELECTED_STATE_SET: number[];\n        static ENABLED_WINDOW_FOCUSED_STATE_SET: number[];\n        static FOCUSED_SELECTED_STATE_SET: number[];\n        static FOCUSED_WINDOW_FOCUSED_STATE_SET: number[];\n        static SELECTED_WINDOW_FOCUSED_STATE_SET: number[];\n        static ENABLED_FOCUSED_SELECTED_STATE_SET: number[];\n        static ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET: number[];\n        static ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET: number[];\n        static FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET: number[];\n        static ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET: number[];\n        static PRESSED_WINDOW_FOCUSED_STATE_SET: number[];\n        static PRESSED_SELECTED_STATE_SET: number[];\n        static PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET: number[];\n        static PRESSED_FOCUSED_STATE_SET: number[];\n        static PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET: number[];\n        static PRESSED_FOCUSED_SELECTED_STATE_SET: number[];\n        static PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET: number[];\n        static PRESSED_ENABLED_STATE_SET: number[];\n        static PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET: number[];\n        static PRESSED_ENABLED_SELECTED_STATE_SET: number[];\n        static PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET: number[];\n        static PRESSED_ENABLED_FOCUSED_STATE_SET: number[];\n        static PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET: number[];\n        static PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET: number[];\n        static PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET: number[];\n        static VIEW_STATE_SETS: Array<Array<number>>;\n        static VIEW_STATE_WINDOW_FOCUSED: number;\n        static VIEW_STATE_SELECTED: number;\n        static VIEW_STATE_FOCUSED: number;\n        static VIEW_STATE_ENABLED: number;\n        static VIEW_STATE_PRESSED: number;\n        static VIEW_STATE_ACTIVATED: number;\n        static VIEW_STATE_HOVERED: number;\n        static VIEW_STATE_CHECKED: number;\n        static VIEW_STATE_MULTILINE: number;\n        static VIEW_STATE_EXPANDED: number;\n        static VIEW_STATE_EMPTY: number;\n        static VIEW_STATE_LAST: number;\n        static VIEW_STATE_IDS: number[];\n        private static _static;\n        static CLICKABLE: number;\n        static DRAWING_CACHE_ENABLED: number;\n        static WILL_NOT_CACHE_DRAWING: number;\n        private static FOCUSABLE_IN_TOUCH_MODE;\n        static LONG_CLICKABLE: number;\n        static DUPLICATE_PARENT_STATE: number;\n        static LAYER_TYPE_NONE: number;\n        static LAYER_TYPE_SOFTWARE: number;\n        static LAYOUT_DIRECTION_LTR: number;\n        static LAYOUT_DIRECTION_RTL: number;\n        static LAYOUT_DIRECTION_INHERIT: number;\n        static LAYOUT_DIRECTION_LOCALE: number;\n        static TEXT_DIRECTION_INHERIT: number;\n        static TEXT_DIRECTION_FIRST_STRONG: number;\n        static TEXT_DIRECTION_ANY_RTL: number;\n        static TEXT_DIRECTION_LTR: number;\n        static TEXT_DIRECTION_RTL: number;\n        static TEXT_DIRECTION_LOCALE: number;\n        private static TEXT_DIRECTION_DEFAULT;\n        static TEXT_DIRECTION_RESOLVED_DEFAULT: number;\n        static TEXT_ALIGNMENT_INHERIT: number;\n        static TEXT_ALIGNMENT_GRAVITY: number;\n        static TEXT_ALIGNMENT_TEXT_START: number;\n        static TEXT_ALIGNMENT_TEXT_END: number;\n        static TEXT_ALIGNMENT_CENTER: number;\n        static TEXT_ALIGNMENT_VIEW_START: number;\n        static TEXT_ALIGNMENT_VIEW_END: number;\n        private static TEXT_ALIGNMENT_DEFAULT;\n        static TEXT_ALIGNMENT_RESOLVED_DEFAULT: number;\n        protected mID: string;\n        protected mTag: any;\n        protected mPrivateFlags: number;\n        private mPrivateFlags2;\n        private mPrivateFlags3;\n        protected mContext: Context;\n        protected mCurrentAnimation: Animation;\n        private mOldWidthMeasureSpec;\n        private mOldHeightMeasureSpec;\n        private mMeasuredWidth;\n        private mMeasuredHeight;\n        private mBackground;\n        private mBackgroundSizeChanged;\n        private mBackgroundWidth;\n        private mBackgroundHeight;\n        private mScrollCache;\n        private mDrawableState;\n        private mNextFocusLeftId;\n        private mNextFocusRightId;\n        private mNextFocusUpId;\n        private mNextFocusDownId;\n        mNextFocusForwardId: string;\n        private mPendingCheckForLongPress;\n        private mPendingCheckForTap;\n        private mPerformClick;\n        private mPerformClickAfterPressDraw;\n        private mUnsetPressedState;\n        private mHasPerformedLongPress;\n        mMinWidth: number;\n        mMinHeight: number;\n        private mTouchDelegate;\n        private mFloatingTreeObserver;\n        private mDrawingCacheBackgroundColor;\n        private mUnscaledDrawingCache;\n        mTouchSlop: number;\n        private mVerticalScrollFactor;\n        private mOverScrollMode;\n        mParent: ViewParent;\n        private mMeasureCache;\n        mAttachInfo: View.AttachInfo;\n        mLayoutParams: ViewGroup.LayoutParams;\n        mTransformationInfo: View.TransformationInfo;\n        mViewFlags: number;\n        mLayerType: number;\n        mLocalDirtyRect: Rect;\n        mCachingFailed: boolean;\n        private mOverlay;\n        private mWindowAttachCount;\n        private mTransientStateCount;\n        private mListenerInfo;\n        private mClipBounds;\n        private mLastIsOpaque;\n        private mMatchIdPredicate;\n        private _mLeft;\n        private _mRight;\n        private _mTop;\n        private _mBottom;\n        mLeft: number;\n        mRight: number;\n        mTop: number;\n        mBottom: number;\n        private _mScrollX;\n        private _mScrollY;\n        mScrollX: number;\n        mScrollY: number;\n        protected mPaddingLeft: number;\n        protected mPaddingRight: number;\n        protected mPaddingTop: number;\n        protected mPaddingBottom: number;\n        private mCornerRadiusTopLeft;\n        private mCornerRadiusTopRight;\n        private mCornerRadiusBottomRight;\n        private mCornerRadiusBottomLeft;\n        private mShadowPaint;\n        private mShadowDrawable;\n        constructor(context: Context, bindElement?: HTMLElement, defStyleAttr?: Map<string, string>);\n        getContext(): Context;\n        getWidth(): number;\n        getHeight(): number;\n        getPaddingLeft(): number;\n        getPaddingTop(): number;\n        getPaddingRight(): number;\n        getPaddingBottom(): number;\n        setPaddingLeft(left: number): void;\n        setPaddingTop(top: number): void;\n        setPaddingRight(right: number): void;\n        setPaddingBottom(bottom: number): void;\n        setPadding(left: number, top: number, right: number, bottom: number): void;\n        resolvePadding(): void;\n        setScrollX(value: number): void;\n        setScrollY(value: number): void;\n        getScrollX(): number;\n        getScrollY(): number;\n        offsetTopAndBottom(offset: number): void;\n        offsetLeftAndRight(offset: number): void;\n        getMatrix(): Matrix;\n        hasIdentityMatrix(): boolean;\n        ensureTransformationInfo(): void;\n        private updateMatrix();\n        getRotation(): number;\n        setRotation(rotation: number): void;\n        getRotationY(): number;\n        setRotationY(rotationY: number): void;\n        getRotationX(): number;\n        setRotationX(rotationX: number): void;\n        getScaleX(): number;\n        setScaleX(scaleX: number): void;\n        getScaleY(): number;\n        setScaleY(scaleY: number): void;\n        getPivotX(): number;\n        setPivotX(pivotX: number): void;\n        getPivotY(): number;\n        setPivotY(pivotY: number): void;\n        getAlpha(): number;\n        hasOverlappingRendering(): boolean;\n        setAlpha(alpha: number): void;\n        setAlphaNoInvalidation(alpha: number): boolean;\n        setTransitionAlpha(alpha: number): void;\n        private getFinalAlpha();\n        getTransitionAlpha(): number;\n        getTop(): number;\n        setTop(top: number): void;\n        getBottom(): number;\n        isDirty(): boolean;\n        setBottom(bottom: number): void;\n        getLeft(): number;\n        setLeft(left: number): void;\n        getRight(): number;\n        setRight(right: number): void;\n        getX(): number;\n        setX(x: number): void;\n        getY(): number;\n        setY(y: number): void;\n        getTranslationX(): number;\n        setTranslationX(translationX: number): void;\n        getTranslationY(): number;\n        setTranslationY(translationY: number): void;\n        transformRect(rect: Rect): void;\n        pointInView(localX: number, localY: number, slop?: number): boolean;\n        getHandler(): Handler;\n        getViewRootImpl(): ViewRootImpl;\n        post(action: Runnable): boolean;\n        postDelayed(action: Runnable, delayMillis: number): boolean;\n        postOnAnimation(action: Runnable): boolean;\n        postOnAnimationDelayed(action: Runnable, delayMillis: number): boolean;\n        removeCallbacks(action: Runnable): boolean;\n        getParent(): ViewParent;\n        setFlags(flags: number, mask: number): void;\n        bringToFront(): void;\n        onScrollChanged(l: number, t: number, oldl: number, oldt: number): void;\n        protected onSizeChanged(w: number, h: number, oldw: number, oldh: number): void;\n        getTouchables(): ArrayList<View>;\n        addTouchables(views: ArrayList<View>): void;\n        requestRectangleOnScreen(rectangle: Rect, immediate?: boolean): boolean;\n        onFocusLost(): void;\n        resetPressedState(): void;\n        isFocused(): boolean;\n        findFocus(): View;\n        getNextFocusLeftId(): string;\n        setNextFocusLeftId(nextFocusLeftId: string): void;\n        getNextFocusRightId(): string;\n        setNextFocusRightId(nextFocusRightId: string): void;\n        getNextFocusUpId(): string;\n        setNextFocusUpId(nextFocusUpId: string): void;\n        getNextFocusDownId(): string;\n        setNextFocusDownId(nextFocusDownId: string): void;\n        getNextFocusForwardId(): string;\n        setNextFocusForwardId(nextFocusForwardId: string): void;\n        setFocusable(focusable: boolean): void;\n        isFocusable(): boolean;\n        setFocusableInTouchMode(focusableInTouchMode: boolean): void;\n        isFocusableInTouchMode(): boolean;\n        hasFocusable(): boolean;\n        clearFocus(): void;\n        clearFocusInternal(propagate: boolean, refocus: boolean): void;\n        notifyGlobalFocusCleared(oldFocus: View): void;\n        rootViewRequestFocus(): boolean;\n        unFocus(): void;\n        hasFocus(): boolean;\n        protected onFocusChanged(gainFocus: boolean, direction: number, previouslyFocusedRect: Rect): void;\n        focusSearch(direction: number): View;\n        dispatchUnhandledMove(focused: View, direction: number): boolean;\n        findUserSetNextFocus(root: View, direction: number): View;\n        private findViewInsideOutShouldExist(root, id);\n        getFocusables(direction: number): ArrayList<View>;\n        addFocusables(views: ArrayList<View>, direction: number, focusableMode?: number): void;\n        setOnFocusChangeListener(l: View.OnFocusChangeListener | ((v: View, hasFocus: boolean) => void)): void;\n        getOnFocusChangeListener(): View.OnFocusChangeListener;\n        requestFocus(direction?: number, previouslyFocusedRect?: any): boolean;\n        private requestFocusNoSearch(direction, previouslyFocusedRect);\n        requestFocusFromTouch(): boolean;\n        private hasAncestorThatBlocksDescendantFocus();\n        handleFocusGainInternal(direction: number, previouslyFocusedRect: Rect): void;\n        hasTransientState(): boolean;\n        setHasTransientState(hasTransientState: boolean): void;\n        isScrollContainer(): boolean;\n        setScrollContainer(isScrollContainer: boolean): void;\n        isInTouchMode(): boolean;\n        isShown(): boolean;\n        getVisibility(): number;\n        setVisibility(visibility: number): void;\n        dispatchVisibilityChanged(changedView: View, visibility: number): void;\n        protected onVisibilityChanged(changedView: View, visibility: number): void;\n        dispatchDisplayHint(hint: number): void;\n        onDisplayHint(hint: number): void;\n        dispatchWindowVisibilityChanged(visibility: number): void;\n        onWindowVisibilityChanged(visibility: number): void;\n        getWindowVisibility(): number;\n        isEnabled(): boolean;\n        setEnabled(enabled: boolean): void;\n        dispatchGenericMotionEvent(event: MotionEvent): boolean;\n        private dispatchGenericMotionEventInternal(event);\n        onGenericMotionEvent(event: MotionEvent): boolean;\n        dispatchGenericPointerEvent(event: MotionEvent): boolean;\n        dispatchKeyEvent(event: KeyEvent): boolean;\n        setOnKeyListener(l: View.OnKeyListener | ((v: View, keyCode: number, event: KeyEvent) => void)): void;\n        getKeyDispatcherState(): KeyEvent.DispatcherState;\n        onKeyDown(keyCode: number, event: android.view.KeyEvent): boolean;\n        onKeyLongPress(keyCode: number, event: android.view.KeyEvent): boolean;\n        onKeyUp(keyCode: number, event: android.view.KeyEvent): boolean;\n        dispatchTouchEvent(event: MotionEvent): boolean;\n        onFilterTouchEventForSecurity(event: MotionEvent): boolean;\n        onTouchEvent(event: MotionEvent): boolean;\n        isInScrollingContainer(): boolean;\n        cancelPendingInputEvents(): void;\n        dispatchCancelPendingInputEvents(): void;\n        onCancelPendingInputEvents(): void;\n        private removeLongPressCallback();\n        private removePerformClickCallback();\n        private removeUnsetPressCallback();\n        private removeTapCallback();\n        cancelLongPress(): void;\n        setTouchDelegate(delegate: TouchDelegate): void;\n        getTouchDelegate(): TouchDelegate;\n        getListenerInfo(): View.ListenerInfo;\n        addOnLayoutChangeListener(listener: View.OnLayoutChangeListener): void;\n        removeOnLayoutChangeListener(listener: View.OnLayoutChangeListener): void;\n        addOnAttachStateChangeListener(listener: View.OnAttachStateChangeListener): void;\n        removeOnAttachStateChangeListener(listener: View.OnAttachStateChangeListener): void;\n        private setOnClickListenerByAttrValueString(onClickAttrString);\n        setOnClickListener(l: View.OnClickListener | ((v: View) => void)): void;\n        hasOnClickListeners(): boolean;\n        setOnLongClickListener(l: View.OnLongClickListener | ((v: View) => boolean)): void;\n        playSoundEffect(soundConstant: number): void;\n        performHapticFeedback(feedbackConstant: number): boolean;\n        performClick(event?: MotionEvent): boolean;\n        callOnClick(): boolean;\n        performLongClick(): boolean;\n        performButtonActionOnTouchDown(event: MotionEvent): boolean;\n        private checkForLongClick(delayOffset?);\n        setOnTouchListener(l: View.OnTouchListener | ((v: View, event: MotionEvent) => void)): void;\n        isClickable(): boolean;\n        setClickable(clickable: boolean): void;\n        isLongClickable(): boolean;\n        setLongClickable(longClickable: boolean): void;\n        setPressed(pressed: boolean): void;\n        dispatchSetPressed(pressed: boolean): void;\n        isPressed(): boolean;\n        setSelected(selected: boolean): void;\n        dispatchSetSelected(selected: boolean): void;\n        isSelected(): boolean;\n        setActivated(activated: boolean): void;\n        dispatchSetActivated(activated: boolean): void;\n        isActivated(): boolean;\n        getViewTreeObserver(): ViewTreeObserver;\n        setLayoutDirection(layoutDirection: number): void;\n        getLayoutDirection(): number;\n        isLayoutRtl(): boolean;\n        getTextDirection(): number;\n        setTextDirection(textDirection: number): void;\n        getTextAlignment(): number;\n        setTextAlignment(textAlignment: number): void;\n        getBaseline(): number;\n        isLayoutRequested(): boolean;\n        getLayoutParams(): ViewGroup.LayoutParams;\n        setLayoutParams(params: ViewGroup.LayoutParams): void;\n        isInLayout(): boolean;\n        requestLayout(): void;\n        forceLayout(): void;\n        isLaidOut(): boolean;\n        layout(l: number, t: number, r: number, b: number): void;\n        protected onLayout(changed: boolean, left: number, top: number, right: number, bottom: number): void;\n        protected setFrame(left: number, top: number, right: number, bottom: number): boolean;\n        private sizeChange(newWidth, newHeight, oldWidth, oldHeight);\n        getHitRect(outRect: Rect): void;\n        getFocusedRect(r: Rect): void;\n        getDrawingRect(outRect: Rect): void;\n        getGlobalVisibleRect(r: Rect, globalOffset?: Point): boolean;\n        getLocationOnScreen(location: number[]): void;\n        getLocationInWindow(location: number[]): void;\n        getWindowVisibleDisplayFrame(outRect: Rect): void;\n        protected isVisibleToUser(boundInView?: Rect): boolean;\n        getMeasuredWidth(): number;\n        getMeasuredWidthAndState(): number;\n        getMeasuredHeight(): number;\n        getMeasuredHeightAndState(): number;\n        getMeasuredState(): number;\n        measure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        setMeasuredDimension(measuredWidth: any, measuredHeight: any): void;\n        static combineMeasuredStates(curState: any, newState: any): number;\n        static resolveSize(size: any, measureSpec: any): number;\n        static resolveSizeAndState(size: any, measureSpec: any, childMeasuredState: any): number;\n        static getDefaultSize(size: any, measureSpec: any): any;\n        getSuggestedMinimumHeight(): number;\n        getSuggestedMinimumWidth(): number;\n        getMinimumHeight(): number;\n        setMinimumHeight(minHeight: any): void;\n        getMinimumWidth(): number;\n        setMinimumWidth(minWidth: any): void;\n        getAnimation(): Animation;\n        startAnimation(animation: Animation): void;\n        clearAnimation(): void;\n        setAnimation(animation: Animation): void;\n        protected onAnimationStart(): void;\n        protected onAnimationEnd(): void;\n        protected onSetAlpha(alpha: number): boolean;\n        private _invalidateRect(l, t, r, b);\n        private _invalidateCache(invalidateCache?);\n        invalidate(): any;\n        invalidate(invalidateCache: boolean): any;\n        invalidate(dirty: Rect): any;\n        invalidate(l: number, t: number, r: number, b: number): any;\n        invalidateViewProperty(invalidateParent: boolean, forceRedraw: boolean): void;\n        invalidateParentCaches(): void;\n        invalidateParentIfNeeded(): void;\n        postInvalidate(l?: number, t?: number, r?: number, b?: number): void;\n        postInvalidateDelayed(delayMilliseconds: number, left?: number, top?: number, right?: number, bottom?: number): void;\n        postInvalidateOnAnimation(left?: number, top?: number, right?: number, bottom?: number): void;\n        private skipInvalidate();\n        isOpaque(): boolean;\n        private computeOpaqueFlags();\n        setLayerType(layerType: number): void;\n        getLayerType(): number;\n        setClipBounds(clipBounds: Rect): void;\n        getClipBounds(): Rect;\n        setCornerRadius(radiusTopLeft: number, radiusTopRight?: number, radiusBottomRight?: number, radiusBottomLeft?: number): void;\n        setCornerRadiusTopLeft(value: number): void;\n        getCornerRadiusTopLeft(): number;\n        setCornerRadiusTopRight(value: number): void;\n        getCornerRadiusTopRight(): number;\n        setCornerRadiusBottomRight(value: number): void;\n        getCornerRadiusBottomRight(): number;\n        setCornerRadiusBottomLeft(value: number): void;\n        getCornerRadiusBottomLeft(): number;\n        setShadowView(radius: number, dx: number, dy: number, color: number): void;\n        getDrawingTime(): number;\n        protected drawFromParent(canvas: Canvas, parent: ViewGroup, drawingTime: number): boolean;\n        private drawShadow(canvas);\n        draw(canvas: Canvas): void;\n        protected onDraw(canvas: Canvas): void;\n        protected dispatchDraw(canvas: Canvas): void;\n        private drawAnimation(parent, drawingTime, a, scalingRequired?);\n        onDrawScrollBars(canvas: Canvas): void;\n        isVerticalScrollBarHidden(): boolean;\n        onDrawHorizontalScrollBar(canvas: Canvas, scrollBar: Drawable, l: number, t: number, r: number, b: number): void;\n        onDrawVerticalScrollBar(canvas: Canvas, scrollBar: Drawable, l: number, t: number, r: number, b: number): void;\n        isHardwareAccelerated(): boolean;\n        setDrawingCacheEnabled(enabled: boolean): void;\n        isDrawingCacheEnabled(): boolean;\n        getDrawingCache(autoScale?: boolean): Canvas;\n        setDrawingCacheBackgroundColor(color: number): void;\n        getDrawingCacheBackgroundColor(): number;\n        destroyDrawingCache(): void;\n        buildDrawingCache(autoScale?: boolean): void;\n        setWillNotDraw(willNotDraw: boolean): void;\n        willNotDraw(): boolean;\n        setWillNotCacheDrawing(willNotCacheDrawing: boolean): void;\n        willNotCacheDrawing(): boolean;\n        drawableSizeChange(who: Drawable): void;\n        invalidateDrawable(drawable: Drawable): void;\n        scheduleDrawable(who: Drawable, what: Runnable, when: number): void;\n        unscheduleDrawable(who: Drawable, what?: Runnable): void;\n        protected verifyDrawable(who: Drawable): boolean;\n        protected drawableStateChanged(): void;\n        resolveDrawables(): void;\n        refreshDrawableState(): void;\n        getDrawableState(): Array<number>;\n        protected onCreateDrawableState(extraSpace: number): Array<number>;\n        static mergeDrawableStates(baseState: Array<number>, additionalState: Array<number>): number[];\n        jumpDrawablesToCurrentState(): void;\n        setBackgroundColor(color: number): void;\n        setBackground(background: Drawable): void;\n        getBackground(): Drawable;\n        setBackgroundDrawable(background: Drawable): void;\n        protected computeHorizontalScrollRange(): number;\n        protected computeHorizontalScrollOffset(): number;\n        protected computeHorizontalScrollExtent(): number;\n        protected computeVerticalScrollRange(): number;\n        protected computeVerticalScrollOffset(): number;\n        protected computeVerticalScrollExtent(): number;\n        canScrollHorizontally(direction: number): boolean;\n        canScrollVertically(direction: number): boolean;\n        protected overScrollBy(deltaX: number, deltaY: number, scrollX: number, scrollY: number, scrollRangeX: number, scrollRangeY: number, maxOverScrollX: number, maxOverScrollY: number, isTouchEvent: boolean): boolean;\n        protected onOverScrolled(scrollX: number, scrollY: number, clampedX: boolean, clampedY: boolean): void;\n        getOverScrollMode(): number;\n        setOverScrollMode(overScrollMode: number): void;\n        getVerticalScrollFactor(): number;\n        getHorizontalScrollFactor(): number;\n        computeScroll(): void;\n        scrollTo(x: number, y: number): void;\n        scrollBy(x: number, y: number): void;\n        private initialAwakenScrollBars();\n        awakenScrollBars(startDelay?: number, invalidate?: boolean): boolean;\n        getVerticalFadingEdgeLength(): number;\n        setVerticalFadingEdgeEnabled(enable: boolean): void;\n        setHorizontalFadingEdgeEnabled(enable: boolean): void;\n        setFadingEdgeLength(length: number): void;\n        getHorizontalFadingEdgeLength(): number;\n        getVerticalScrollbarWidth(): number;\n        getHorizontalScrollbarHeight(): number;\n        initializeScrollbars(a?: TypedArray): void;\n        initScrollCache(): void;\n        private getScrollCache();\n        isHorizontalScrollBarEnabled(): boolean;\n        setHorizontalScrollBarEnabled(horizontalScrollBarEnabled: boolean): void;\n        isVerticalScrollBarEnabled(): boolean;\n        setVerticalScrollBarEnabled(verticalScrollBarEnabled: boolean): void;\n        setScrollbarFadingEnabled(fadeScrollbars: boolean): void;\n        setVerticalScrollbarPosition(position: number): void;\n        setHorizontalScrollbarPosition(position: number): void;\n        setScrollBarStyle(position: number): void;\n        protected getTopFadingEdgeStrength(): number;\n        protected getBottomFadingEdgeStrength(): number;\n        protected getLeftFadingEdgeStrength(): number;\n        protected getRightFadingEdgeStrength(): number;\n        isScrollbarFadingEnabled(): boolean;\n        getScrollBarDefaultDelayBeforeFade(): number;\n        setScrollBarDefaultDelayBeforeFade(scrollBarDefaultDelayBeforeFade: number): void;\n        getScrollBarFadeDuration(): number;\n        setScrollBarFadeDuration(scrollBarFadeDuration: number): void;\n        getScrollBarSize(): number;\n        setScrollBarSize(scrollBarSize: number): void;\n        hasOpaqueScrollbars(): boolean;\n        assignParent(parent: ViewParent): void;\n        protected onFinishInflate(): void;\n        dispatchStartTemporaryDetach(): void;\n        onStartTemporaryDetach(): void;\n        dispatchFinishTemporaryDetach(): void;\n        onFinishTemporaryDetach(): void;\n        dispatchWindowFocusChanged(hasFocus: boolean): void;\n        onWindowFocusChanged(hasWindowFocus: boolean): void;\n        hasWindowFocus(): boolean;\n        getWindowAttachCount(): number;\n        isAttachedToWindow(): boolean;\n        dispatchAttachedToWindow(info: View.AttachInfo, visibility: number): void;\n        protected onAttachedToWindow(): void;\n        dispatchDetachedFromWindow(): void;\n        protected onDetachedFromWindow(): void;\n        cleanupDraw(): void;\n        isInEditMode(): boolean;\n        debug(depth?: number): void;\n        toString(): String;\n        getRootView(): View;\n        findViewById(id: string): View;\n        findViewWithTag(tag: any): View;\n        protected findViewTraversal(id: string): View;\n        protected findViewWithTagTraversal(tag: any): View;\n        findViewByPredicate(predicate: View.Predicate<View>): View;\n        protected findViewByPredicateTraversal(predicate: View.Predicate<View>, childToSkip: View): View;\n        findViewByPredicateInsideOut(start: View, predicate: View.Predicate<View>): View;\n        setId(id: string): void;\n        getId(): string;\n        getTag(): any;\n        setTag(tag: any): void;\n        setIsRootNamespace(isRoot: boolean): void;\n        isRootNamespace(): boolean;\n        getResources(): Resources;\n        static inflate(context: Context, xml: HTMLElement | string, root?: ViewGroup): View;\n        bindElement: HTMLElement;\n        private _AttrObserver;\n        private _stateAttrList;\n        private _attrBinder;\n        private static ViewClassAttrBinderClazzMap;\n        static AndroidViewProperty: string;\n        private static _AttrObserverCallBack(arr, observer);\n        protected initBindElement(bindElement?: HTMLElement): void;\n        protected initBindAttr(): void;\n        protected createClassAttrBinder(): AttrBinder.ClassBinderMap;\n        private _syncToElementLock;\n        private _syncToElementImmediatelyLock;\n        private _syncToElementRun;\n        requestSyncBoundToElement(immediately?: boolean): void;\n        private _lastSyncLeft;\n        private _lastSyncTop;\n        private _lastSyncWidth;\n        private _lastSyncHeight;\n        private _lastSyncScrollX;\n        private _lastSyncScrollY;\n        protected _syncBoundAndScrollToElement(): void;\n        private static TempMatrixValue;\n        private _lastSyncTransform;\n        protected _syncMatrixToElement(): void;\n        syncVisibleToElement(): void;\n        protected dependOnDebugLayout(): boolean;\n        private _initAttrObserver();\n        private _fireStateChangeToAttribute(oldState, newState);\n        private _getBinderAttrValue(key);\n        private onBindElementAttributeChanged(attributeName, oldVal, newVal);\n        tagName(): string;\n    }\n    module View {\n        class TransformationInfo {\n            mMatrix: Matrix;\n            private mInverseMatrix;\n            mMatrixDirty: boolean;\n            mInverseMatrixDirty: boolean;\n            mMatrixIsIdentity: boolean;\n            mPrevWidth: number;\n            mPrevHeight: number;\n            mRotation: number;\n            mTranslationX: number;\n            mTranslationY: number;\n            mScaleX: number;\n            mScaleY: number;\n            mPivotX: number;\n            mPivotY: number;\n            mAlpha: number;\n            mTransitionAlpha: number;\n        }\n        class MeasureSpec {\n            static MODE_SHIFT: number;\n            static MODE_MASK: number;\n            static UNSPECIFIED: number;\n            static EXACTLY: number;\n            static AT_MOST: number;\n            static makeMeasureSpec(size: any, mode: any): number;\n            static getMode(measureSpec: any): number;\n            static getSize(measureSpec: any): number;\n            static adjust(measureSpec: any, delta: any): number;\n            static toString(measureSpec: any): string;\n        }\n        class AttachInfo {\n            mRootView: View;\n            mKeyDispatchState: KeyEvent.DispatcherState;\n            mViewRootImpl: ViewRootImpl;\n            mHandler: Handler;\n            mTmpInvalRect: Rect;\n            mTmpTransformRect: Rect;\n            mPoint: Point;\n            mTmpMatrix: Matrix;\n            mTmpTransformation: Transformation;\n            mTmpTransformLocation: number[];\n            mScrollContainers: Set<View>;\n            mViewRequestingLayout: View;\n            mInvalidateChildLocation: number[];\n            mHasWindowFocus: boolean;\n            mWindowVisibility: number;\n            constructor(mViewRootImpl: ViewRootImpl, mHandler: Handler);\n        }\n        class ListenerInfo {\n            mOnFocusChangeListener: OnFocusChangeListener;\n            mOnAttachStateChangeListeners: CopyOnWriteArrayList<OnAttachStateChangeListener>;\n            mOnLayoutChangeListeners: ArrayList<OnLayoutChangeListener>;\n            mOnClickListener: OnClickListener;\n            mOnLongClickListener: OnLongClickListener;\n            mOnTouchListener: OnTouchListener;\n            mOnKeyListener: OnKeyListener;\n            mOnGenericMotionListener: OnGenericMotionListener;\n        }\n        interface OnAttachStateChangeListener {\n            onViewAttachedToWindow(v: View): any;\n            onViewDetachedFromWindow(v: View): any;\n        }\n        interface OnLayoutChangeListener {\n            onLayoutChange(v: View, left: number, top: number, right: number, bottom: number, oldLeft: number, oldTop: number, oldRight: number, oldBottom: number): void;\n        }\n        interface OnClickListener {\n            onClick(v: View): void;\n        }\n        module OnClickListener {\n            function fromFunction(func: (v: View) => void): OnClickListener;\n        }\n        interface OnLongClickListener {\n            onLongClick(v: View): boolean;\n        }\n        module OnLongClickListener {\n            function fromFunction(func: (v: View) => boolean): OnLongClickListener;\n        }\n        interface OnFocusChangeListener {\n            onFocusChange(v: View, hasFocus: boolean): void;\n        }\n        module OnFocusChangeListener {\n            function fromFunction(func: (v: View, hasFocus: boolean) => void): OnFocusChangeListener;\n        }\n        interface OnTouchListener {\n            onTouch(v: View, event: MotionEvent): void;\n        }\n        module OnTouchListener {\n            function fromFunction(func: (v: View, event: MotionEvent) => void): OnTouchListener;\n        }\n        interface OnKeyListener {\n            onKey(v: View, keyCode: number, event: KeyEvent): void;\n        }\n        module OnKeyListener {\n            function fromFunction(func: (v: View, keyCode: number, event: KeyEvent) => void): OnKeyListener;\n        }\n        interface OnGenericMotionListener {\n            onGenericMotion(v: View, event: MotionEvent): any;\n        }\n        module OnGenericMotionListener {\n            function fromFunction(func: (v: View, event: MotionEvent) => void): OnGenericMotionListener;\n        }\n        interface Predicate<T> {\n            apply(t: T): boolean;\n        }\n    }\n    module View.AttachInfo {\n        class InvalidateInfo {\n            private static POOL_LIMIT;\n            private static sPool;\n            target: View;\n            left: number;\n            top: number;\n            right: number;\n            bottom: number;\n            static obtain(): InvalidateInfo;\n            recycle(): void;\n        }\n    }\n}\ndeclare module android.view {\n    import View = android.view.View;\n    import Rect = android.graphics.Rect;\n    import Point = android.graphics.Point;\n    interface ViewParent {\n        requestLayout(): any;\n        isLayoutRequested(): boolean;\n        invalidateChild(child: View, r: Rect): any;\n        invalidateChildInParent(location: Array<number>, r: Rect): ViewParent;\n        getParent(): ViewParent;\n        requestChildFocus(child: View, focused: View): any;\n        clearChildFocus(child: View): any;\n        getChildVisibleRect(child: View, r: Rect, offset: Point): boolean;\n        focusSearch(v: View, direction: number): View;\n        bringChildToFront(child: View): any;\n        focusableViewAvailable(v: View): any;\n        childDrawableStateChanged(child: View): any;\n        requestDisallowInterceptTouchEvent(disallowIntercept: boolean): any;\n        requestChildRectangleOnScreen(child: View, rectangle: Rect, immediate: boolean): boolean;\n        childHasTransientStateChanged(child: View, hasTransientState: boolean): any;\n    }\n}\ndeclare module android.view {\n    import Rect = android.graphics.Rect;\n    import Canvas = android.graphics.Canvas;\n    import ViewRootImpl = android.view.ViewRootImpl;\n    class Surface {\n        static DrawToCacheFirstMode: boolean;\n        private mCanvasElement;\n        private _showFPSNode;\n        private viewRoot;\n        private mLockedRect;\n        protected mCanvasBound: Rect;\n        protected mSupportDirtyDraw: boolean;\n        private mLockSaveCount;\n        constructor(canvasElement: HTMLCanvasElement, viewRoot: ViewRootImpl);\n        protected initImpl(): void;\n        isValid(): boolean;\n        notifyBoundChange(): void;\n        protected initCanvasBound(): void;\n        lockCanvas(dirty: Rect): Canvas;\n        protected lockCanvasImpl(left: number, top: number, width: number, height: number): Canvas;\n        unlockCanvasAndPost(canvas: Canvas): void;\n        showFps(fps: number): void;\n    }\n}\ndeclare module android.view {\n    import ViewParent = android.view.ViewParent;\n    import View = android.view.View;\n    import Rect = android.graphics.Rect;\n    import Point = android.graphics.Point;\n    import Handler = android.os.Handler;\n    import Runnable = java.lang.Runnable;\n    class ViewRootImpl implements ViewParent {\n        static TAG: string;\n        private static DBG;\n        static LOCAL_LOGV: boolean;\n        static DEBUG_DRAW: boolean;\n        static DEBUG_LAYOUT: boolean;\n        static DEBUG_INPUT_RESIZE: boolean;\n        static DEBUG_ORIENTATION: boolean;\n        static DEBUG_CONFIGURATION: boolean;\n        static DEBUG_FPS: boolean;\n        static ContinueEventToDom: symbol;\n        private mView;\n        private mViewVisibility;\n        private mStopped;\n        private mWidth;\n        private mHeight;\n        private mDirty;\n        private mIsAnimating;\n        private mTempRect;\n        private mVisRect;\n        private mTraversalScheduled;\n        private mWillDrawSoon;\n        private mIsInTraversal;\n        private mLayoutRequested;\n        private mFirst;\n        private mFullRedrawNeeded;\n        private mIsDrawing;\n        private mAdded;\n        private mAddedTouchMode;\n        private mInTouchMode;\n        private mWinFrame;\n        private mInLayout;\n        private mLayoutRequesters;\n        private mHandlingLayoutInLayoutRequest;\n        private mRemoved;\n        private mHandler;\n        private mViewScrollChanged;\n        private mTreeObserver;\n        private mIgnoreDirtyState;\n        private mSetIgnoreDirtyState;\n        private mDrawingTime;\n        private mFirstInputStage;\n        private mFpsStartTime;\n        private mFpsPrevTime;\n        private mFpsNumFrames;\n        private mSurface;\n        constructor();\n        initSurface(canvasElement: HTMLCanvasElement): void;\n        notifyResized(frame: Rect): void;\n        setView(view: View): void;\n        getView(): View;\n        getHostVisibility(): number;\n        private mTraversalRunnable;\n        private scheduleTraversals();\n        private unscheduleTraversals();\n        doTraversal(): void;\n        private measureHierarchy(host, lp, desiredWindowWidth, desiredWindowHeight);\n        private static getRootMeasureSpec(windowSize, rootDimension);\n        private performTraversals();\n        private performLayout(lp, desiredWindowWidth, desiredWindowHeight);\n        private getValidLayoutRequesters(layoutRequesters, secondLayoutRequests);\n        private performMeasure(childWidthMeasureSpec, childHeightMeasureSpec);\n        isInLayout(): boolean;\n        requestLayoutDuringLayout(view: View): boolean;\n        trackFPS(): void;\n        private performDraw();\n        private draw(fullRedrawNeeded);\n        private drawSoftware();\n        private _continueTraversalesCount;\n        private checkContinueTraversalsNextFrame();\n        isLayoutRequested(): boolean;\n        private mInvalidateOnAnimationRunnable;\n        dispatchInvalidateDelayed(view: View, delayMilliseconds: number): void;\n        dispatchInvalidateRectDelayed(info: View.AttachInfo.InvalidateInfo, delayMilliseconds: number): void;\n        dispatchInvalidateOnAnimation(view: View): void;\n        dispatchInvalidateRectOnAnimation(info: View.AttachInfo.InvalidateInfo): void;\n        cancelInvalidate(view: View): void;\n        getParent(): ViewParent;\n        requestLayout(): void;\n        invalidate(): void;\n        invalidateWorld(view: View): void;\n        invalidateChild(child: View, dirty: Rect): void;\n        invalidateChildInParent(location: Array<number>, dirty: Rect): ViewParent;\n        requestChildFocus(child: View, focused: View): void;\n        clearChildFocus(focused: View): void;\n        getChildVisibleRect(child: View, r: Rect, offset: Point): boolean;\n        focusSearch(focused: View, direction: number): View;\n        bringChildToFront(child: View): void;\n        focusableViewAvailable(v: View): void;\n        static isViewDescendantOf(child: View, parent: View): any;\n        childDrawableStateChanged(child: View): void;\n        requestDisallowInterceptTouchEvent(disallowIntercept: boolean): void;\n        requestChildRectangleOnScreen(child: View, rectangle: Rect, immediate: boolean): boolean;\n        childHasTransientStateChanged(child: View, hasTransientState: boolean): void;\n        dispatchInputEvent(event: MotionEvent | KeyEvent | Event): boolean;\n        private deliverInputEvent(event);\n        private finishInputEvent(event);\n        private checkForLeavingTouchModeAndConsume(event);\n        private static isNavigationKey(keyEvent);\n        private static isTypingKey(keyEvent);\n        ensureTouchMode(inTouchMode: boolean): boolean;\n        ensureTouchModeLocally(inTouchMode: boolean): boolean;\n        private enterTouchMode();\n        private static findAncestorToTakeFocusInTouchMode(focused);\n        private leaveTouchMode();\n        private static RunQueueInstance;\n        private mRunQueue;\n        static getRunQueue(viewRoot?: ViewRootImpl): ViewRootImpl.RunQueue;\n    }\n    module ViewRootImpl {\n        class RunQueue {\n            private mActions;\n            post(action: Runnable): void;\n            postDelayed(action: Runnable, delayMillis: number): void;\n            removeCallbacks(action: Runnable): void;\n            executeActions(handler: Handler): void;\n        }\n    }\n}\ndeclare module android.view {\n    import View = android.view.View;\n    import Rect = android.graphics.Rect;\n    class FocusFinder {\n        private static sFocusFinder;\n        static getInstance(): FocusFinder;\n        mFocusedRect: Rect;\n        mOtherRect: Rect;\n        mBestCandidateRect: Rect;\n        private mSequentialFocusComparator;\n        private mTempList;\n        findNextFocus(root: ViewGroup, focused: View, direction: number): View;\n        findNextFocusFromRect(root: ViewGroup, focusedRect: Rect, direction: number): View;\n        private _findNextFocus(root, focused, focusedRect, direction);\n        private findNextUserSpecifiedFocus(root, focused, direction);\n        private __findNextFocus(root, focused, focusedRect, direction, focusables);\n        private findNextFocusInRelativeDirection(focusables, root, focused, focusedRect, direction);\n        private setFocusBottomRight(root, focusedRect);\n        private setFocusTopLeft(root, focusedRect);\n        private findNextFocusInAbsoluteDirection(focusables, root, focused, focusedRect, direction);\n        private static getNextFocusable(focused, focusables, count);\n        private static getPreviousFocusable(focused, focusables, count);\n        isBetterCandidate(direction: number, source: Rect, rect1: Rect, rect2: Rect): boolean;\n        beamBeats(direction: number, source: Rect, rect1: Rect, rect2: Rect): boolean;\n        getWeightedDistanceFor(majorAxisDistance: number, minorAxisDistance: number): number;\n        isCandidate(srcRect: Rect, destRect: Rect, direction: number): boolean;\n        beamsOverlap(direction: number, rect1: Rect, rect2: Rect): boolean;\n        isToDirectionOf(direction: number, src: Rect, dest: Rect): boolean;\n        static majorAxisDistance(direction: number, source: Rect, dest: Rect): number;\n        static majorAxisDistanceRaw(direction: number, source: Rect, dest: Rect): number;\n        static majorAxisDistanceToFarEdge(direction: number, source: Rect, dest: Rect): number;\n        static majorAxisDistanceToFarEdgeRaw(direction: number, source: Rect, dest: Rect): number;\n        static minorAxisDistance(direction: number, source: Rect, dest: Rect): number;\n        findNearestTouchable(root: ViewGroup, x: number, y: number, direction: number, deltas: number[]): View;\n        private isTouchCandidate(x, y, destRect, direction);\n    }\n}\ndeclare module java.lang {\n    class Integer {\n        static MIN_VALUE: number;\n        static MAX_VALUE: number;\n        static parseInt(value: string): number;\n        static toHexString(n: number): string;\n    }\n}\ndeclare module android.view {\n    import Canvas = android.graphics.Canvas;\n    import Point = android.graphics.Point;\n    import Rect = android.graphics.Rect;\n    import RectF = android.graphics.RectF;\n    import Context = android.content.Context;\n    import ArrayList = java.util.ArrayList;\n    import Animation = android.view.animation.Animation;\n    import Transformation = android.view.animation.Transformation;\n    import AttrBinder = androidui.attr.AttrBinder;\n    abstract class ViewGroup extends View implements ViewParent {\n        static FLAG_CLIP_CHILDREN: number;\n        static FLAG_CLIP_TO_PADDING: number;\n        static FLAG_INVALIDATE_REQUIRED: number;\n        static FLAG_RUN_ANIMATION: number;\n        static FLAG_ANIMATION_DONE: number;\n        static FLAG_PADDING_NOT_NULL: number;\n        static FLAG_ANIMATION_CACHE: number;\n        static FLAG_OPTIMIZE_INVALIDATE: number;\n        static FLAG_CLEAR_TRANSFORMATION: number;\n        static FLAG_NOTIFY_ANIMATION_LISTENER: number;\n        static FLAG_USE_CHILD_DRAWING_ORDER: number;\n        static FLAG_SUPPORT_STATIC_TRANSFORMATIONS: number;\n        static FLAG_ALPHA_LOWER_THAN_ONE: number;\n        static FLAG_ADD_STATES_FROM_CHILDREN: number;\n        static FLAG_ALWAYS_DRAWN_WITH_CACHE: number;\n        static FLAG_CHILDREN_DRAWN_WITH_CACHE: number;\n        static FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE: number;\n        static FLAG_MASK_FOCUSABILITY: number;\n        static FOCUS_BEFORE_DESCENDANTS: number;\n        static FOCUS_AFTER_DESCENDANTS: number;\n        static FOCUS_BLOCK_DESCENDANTS: number;\n        static FLAG_DISALLOW_INTERCEPT: number;\n        static FLAG_SPLIT_MOTION_EVENTS: number;\n        static FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW: number;\n        static FLAG_LAYOUT_MODE_WAS_EXPLICITLY_SET: number;\n        mPersistentDrawingCache: number;\n        static PERSISTENT_NO_CACHE: number;\n        static PERSISTENT_ANIMATION_CACHE: number;\n        static PERSISTENT_SCROLLING_CACHE: number;\n        static PERSISTENT_ALL_CACHES: number;\n        static LAYOUT_MODE_UNDEFINED: number;\n        static LAYOUT_MODE_CLIP_BOUNDS: number;\n        static LAYOUT_MODE_DEFAULT: number;\n        static CLIP_TO_PADDING_MASK: number;\n        protected mDisappearingChildren: ArrayList<View>;\n        mOnHierarchyChangeListener: ViewGroup.OnHierarchyChangeListener;\n        private mFocused;\n        private mFirstTouchTarget;\n        private mChildTransformation;\n        protected mInvalidateRegion: RectF;\n        private mLastTouchDownTime;\n        private mLastTouchDownIndex;\n        private mLastTouchDownX;\n        private mLastTouchDownY;\n        mGroupFlags: number;\n        mLayoutMode: number;\n        mChildren: Array<View>;\n        readonly mChildrenCount: number;\n        mSuppressLayout: boolean;\n        private mLayoutCalledWhileSuppressed;\n        private mChildCountWithTransientState;\n        private static ViewGroupClassAttrBind;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        private initViewGroup();\n        private initFromAttributes(context, attrs, defStyle?);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        getDescendantFocusability(): number;\n        setDescendantFocusability(focusability: number): void;\n        handleFocusGainInternal(direction: number, previouslyFocusedRect: Rect): void;\n        requestChildFocus(child: View, focused: View): void;\n        focusableViewAvailable(v: View): void;\n        focusSearch(direction: number): View;\n        focusSearch(focused: View, direction: number): View;\n        requestChildRectangleOnScreen(child: View, rectangle: Rect, immediate: boolean): boolean;\n        childHasTransientStateChanged(child: View, childHasTransientState: boolean): void;\n        hasTransientState(): boolean;\n        dispatchUnhandledMove(focused: android.view.View, direction: number): boolean;\n        clearChildFocus(child: View): void;\n        clearFocus(): void;\n        unFocus(): void;\n        getFocusedChild(): View;\n        hasFocus(): boolean;\n        findFocus(): View;\n        hasFocusable(): boolean;\n        addFocusables(views: ArrayList<View>, direction: number, focusableMode?: number): void;\n        requestFocus(direction?: number, previouslyFocusedRect?: any): boolean;\n        protected onRequestFocusInDescendants(direction: number, previouslyFocusedRect: Rect): boolean;\n        addView(view: View): any;\n        addView(view: View, index: number): any;\n        addView(view: View, params: ViewGroup.LayoutParams): any;\n        addView(view: View, index: number, params: ViewGroup.LayoutParams): any;\n        addView(view: View, width: number, height: number): any;\n        addView(...args: any[]): any;\n        protected checkLayoutParams(p: ViewGroup.LayoutParams): boolean;\n        setOnHierarchyChangeListener(listener: ViewGroup.OnHierarchyChangeListener): void;\n        protected onViewAdded(child: View): void;\n        protected onViewRemoved(child: View): void;\n        clearCachedLayoutMode(): void;\n        addViewInLayout(child: View, index: number, params: ViewGroup.LayoutParams, preventRequestLayout?: boolean): boolean;\n        cleanupLayoutState(child: View): void;\n        addViewInner(child: View, index: number, params: ViewGroup.LayoutParams, preventRequestLayout: boolean): void;\n        private addInArray(child, index);\n        private addToBindElement(childElement, insertBeforeElement);\n        private removeChildElement(childElement);\n        private removeFromArray(index, count?);\n        removeView(view: View): void;\n        removeViewInLayout(view: View): void;\n        removeViewsInLayout(start: number, count: number): void;\n        removeViewAt(index: number): void;\n        removeViews(start: number, count: number): void;\n        private removeViewInternal(view);\n        private removeViewsInternal(start, count);\n        removeAllViews(): void;\n        removeAllViewsInLayout(): void;\n        detachViewFromParent(child: View | number): void;\n        removeDetachedView(child: View, animate: boolean): void;\n        attachViewToParent(child: View, index: number, params: ViewGroup.LayoutParams): void;\n        detachViewsFromParent(start: number, count?: number): void;\n        detachAllViewsFromParent(): void;\n        indexOfChild(child: View): number;\n        getChildCount(): number;\n        getChildAt(index: number): View;\n        bringChildToFront(child: View): void;\n        hasBooleanFlag(flag: number): boolean;\n        setBooleanFlag(flag: number, value: boolean): void;\n        dispatchGenericPointerEvent(event: MotionEvent): boolean;\n        private dispatchTransformedGenericPointerEvent(event, child);\n        dispatchKeyEvent(event: android.view.KeyEvent): boolean;\n        dispatchWindowFocusChanged(hasFocus: boolean): void;\n        addTouchables(views: java.util.ArrayList<android.view.View>): void;\n        onInterceptTouchEvent(ev: MotionEvent): boolean;\n        dispatchTouchEvent(ev: MotionEvent): boolean;\n        private resetTouchState();\n        private static resetCancelNextUpFlag(view);\n        private clearTouchTargets();\n        private cancelAndClearTouchTargets(event);\n        private getTouchTarget(child);\n        private addTouchTarget(child, pointerIdBits);\n        private removePointersFromTouchTargets(pointerIdBits);\n        private cancelTouchTarget(view);\n        private static canViewReceivePointerEvents(child);\n        protected isTransformedTouchPointInView(x: number, y: number, child: View, outLocalPoint: Point): boolean;\n        private dispatchTransformedTouchEvent(event, cancel, child, desiredPointerIdBits);\n        setMotionEventSplittingEnabled(split: boolean): void;\n        isMotionEventSplittingEnabled(): boolean;\n        isAnimationCacheEnabled(): boolean;\n        setAnimationCacheEnabled(enabled: boolean): void;\n        isAlwaysDrawnWithCacheEnabled(): boolean;\n        setAlwaysDrawnWithCacheEnabled(always: boolean): void;\n        isChildrenDrawnWithCacheEnabled(): boolean;\n        setChildrenDrawnWithCacheEnabled(enabled: boolean): void;\n        setChildrenDrawingCacheEnabled(enabled: boolean): void;\n        protected onAnimationStart(): void;\n        protected onAnimationEnd(): void;\n        getPersistentDrawingCache(): number;\n        setPersistentDrawingCache(drawingCacheToKeep: number): void;\n        isChildrenDrawingOrderEnabled(): boolean;\n        setChildrenDrawingOrderEnabled(enabled: boolean): void;\n        getChildDrawingOrder(childCount: number, i: number): number;\n        generateLayoutParamsFromAttr(attrs: HTMLElement): ViewGroup.LayoutParams;\n        protected generateLayoutParams(p: ViewGroup.LayoutParams): ViewGroup.LayoutParams;\n        protected generateDefaultLayoutParams(): ViewGroup.LayoutParams;\n        measureChildren(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        protected measureChild(child: View, parentWidthMeasureSpec: number, parentHeightMeasureSpec: number): void;\n        protected measureChildWithMargins(child: View, parentWidthMeasureSpec: number, widthUsed: number, parentHeightMeasureSpec: number, heightUsed: number): void;\n        static getChildMeasureSpec(spec: number, padding: number, childDimension: number): number;\n        clearDisappearingChildren(): void;\n        private addDisappearingView(v);\n        finishAnimatingView(view: View, animation: Animation): void;\n        dispatchAttachedToWindow(info: View.AttachInfo, visibility: number): void;\n        protected onAttachedToWindow(): void;\n        protected onDetachedFromWindow(): void;\n        dispatchDetachedFromWindow(): void;\n        dispatchDisplayHint(hint: number): void;\n        onChildVisibilityChanged(child: View, oldVisibility: number, newVisibility: number): void;\n        dispatchVisibilityChanged(changedView: View, visibility: number): void;\n        dispatchSetSelected(selected: boolean): void;\n        dispatchSetActivated(activated: boolean): void;\n        dispatchSetPressed(pressed: boolean): void;\n        dispatchCancelPendingInputEvents(): void;\n        offsetDescendantRectToMyCoords(descendant: View, rect: Rect): void;\n        offsetRectIntoDescendantCoords(descendant: View, rect: Rect): void;\n        offsetRectBetweenParentAndChild(descendant: View, rect: Rect, offsetFromChildToParent: boolean, clipToBounds: boolean): void;\n        offsetChildrenTopAndBottom(offset: number): void;\n        suppressLayout(suppress: boolean): void;\n        isLayoutSuppressed(): boolean;\n        layout(l: number, t: number, r: number, b: number): void;\n        canAnimate(): boolean;\n        protected abstract onLayout(changed: boolean, l: number, t: number, r: number, b: number): void;\n        getChildVisibleRect(child: View, r: Rect, offset: Point): boolean;\n        protected dispatchDraw(canvas: Canvas): void;\n        protected drawChild(canvas: Canvas, child: View, drawingTime: number): boolean;\n        protected drawableStateChanged(): void;\n        jumpDrawablesToCurrentState(): void;\n        protected onCreateDrawableState(extraSpace: number): Array<number>;\n        setAddStatesFromChildren(addsStates: boolean): void;\n        addStatesFromChildren(): boolean;\n        childDrawableStateChanged(child: android.view.View): void;\n        getClipChildren(): boolean;\n        setClipChildren(clipChildren: boolean): void;\n        setClipToPadding(clipToPadding: boolean): void;\n        isClipToPadding(): boolean;\n        invalidateChild(child: View, dirty: Rect): void;\n        invalidateChildInParent(location: Array<number>, dirty: Rect): ViewParent;\n        invalidateChildFast(child: View, dirty: Rect): void;\n        invalidateChildInParentFast(left: number, top: number, dirty: Rect): ViewParent;\n        protected getChildStaticTransformation(child: View, t: Transformation): boolean;\n        getChildTransformation(): Transformation;\n        protected findViewTraversal(id: string): View;\n        protected findViewWithTagTraversal(tag: any): View;\n        protected findViewByPredicateTraversal(predicate: View.Predicate<View>, childToSkip: View): View;\n        requestDisallowInterceptTouchEvent(disallowIntercept: boolean): void;\n        shouldDelayChildPressedState(): boolean;\n        onSetLayoutParams(child: View, layoutParams: ViewGroup.LayoutParams): void;\n    }\n    module ViewGroup {\n        class LayoutParams extends java.lang.JavaObject {\n            private static ClassAttrBinderClazzMap;\n            static FILL_PARENT: number;\n            static MATCH_PARENT: number;\n            static WRAP_CONTENT: number;\n            width: number;\n            height: number;\n            private _attrBinder;\n            constructor(context: Context, attrs: HTMLElement);\n            constructor(width: number, height: number);\n            constructor(src: LayoutParams);\n            constructor(...args: any[]);\n            protected setBaseAttributes(a: android.content.res.TypedArray, widthAttr: string, heightAttr: string): void;\n            getAttrBinder(): AttrBinder;\n            private initBindAttr();\n            protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        }\n        class MarginLayoutParams extends LayoutParams {\n            static DEFAULT_MARGIN_RELATIVE: number;\n            static DEFAULT_MARGIN_RESOLVED: number;\n            static UNDEFINED_MARGIN: number;\n            leftMargin: number;\n            topMargin: number;\n            rightMargin: number;\n            bottomMargin: number;\n            constructor(context: Context, attrs: HTMLElement);\n            constructor(src: MarginLayoutParams);\n            constructor(src: LayoutParams);\n            constructor(width: number, height: number);\n            constructor(...args: any[]);\n            protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n            setMargins(left: number, top: number, right: number, bottom: number): void;\n            setLayoutDirection(layoutDirection: number): void;\n            getLayoutDirection(): number;\n            isLayoutRtl(): boolean;\n            resolveLayoutDirection(layoutDirection: number): void;\n        }\n        interface OnHierarchyChangeListener {\n            onChildViewAdded(parent: View, child: View): any;\n            onChildViewRemoved(parent: View, child: View): any;\n        }\n    }\n}\ndeclare module android.view {\n    import Drawable = android.graphics.drawable.Drawable;\n    class ViewOverlay {\n        mOverlayViewGroup: ViewOverlay.OverlayViewGroup;\n        constructor(hostView: View);\n        getOverlayView(): ViewGroup;\n        add(drawable: Drawable): void;\n        remove(drawable: Drawable): void;\n        clear(): void;\n        isEmpty(): boolean;\n    }\n    module ViewOverlay {\n        class OverlayViewGroup extends ViewGroup {\n            mHostView: View;\n            mDrawables: Set<Drawable>;\n            constructor(hostView: View);\n            private addDrawable(drawable);\n            addView(child: View): void;\n            add(drawable: Drawable): any;\n            add(child: View): any;\n            clear(): void;\n            isEmpty(): boolean;\n            protected onLayout(changed: boolean, l: number, t: number, r: number, b: number): void;\n        }\n    }\n}\ndeclare module android.widget {\n    import ViewGroup = android.view.ViewGroup;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Canvas = android.graphics.Canvas;\n    import Context = android.content.Context;\n    class FrameLayout extends ViewGroup {\n        static DEFAULT_CHILD_GRAVITY: number;\n        mMeasureAllChildren: boolean;\n        mForeground: Drawable;\n        private mForegroundPaddingLeft;\n        private mForegroundPaddingTop;\n        private mForegroundPaddingRight;\n        private mForegroundPaddingBottom;\n        private mSelfBounds;\n        private mOverlayBounds;\n        private mForegroundGravity;\n        mForegroundInPadding: boolean;\n        mForegroundBoundsChanged: boolean;\n        private mMatchParentChildren;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        getForegroundGravity(): number;\n        setForegroundGravity(foregroundGravity: number): void;\n        protected verifyDrawable(who: Drawable): boolean;\n        jumpDrawablesToCurrentState(): void;\n        protected drawableStateChanged(): void;\n        protected generateDefaultLayoutParams(): FrameLayout.LayoutParams;\n        setForeground(drawable: Drawable): void;\n        getForeground(): Drawable;\n        getPaddingLeftWithForeground(): number;\n        getPaddingRightWithForeground(): number;\n        getPaddingTopWithForeground(): number;\n        getPaddingBottomWithForeground(): number;\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        protected onLayout(changed: boolean, left: number, top: number, right: number, bottom: number): void;\n        layoutChildren(left: number, top: number, right: number, bottom: number, forceLeftGravity: boolean): void;\n        protected onSizeChanged(w: number, h: number, oldw: number, oldh: number): void;\n        draw(canvas: Canvas): void;\n        setMeasureAllChildren(measureAll: boolean): void;\n        getMeasureAllChildren(): boolean;\n        generateLayoutParamsFromAttr(attrs: HTMLElement): android.view.ViewGroup.LayoutParams;\n        shouldDelayChildPressedState(): boolean;\n        protected checkLayoutParams(p: ViewGroup.LayoutParams): boolean;\n        protected generateLayoutParams(p: ViewGroup.LayoutParams): FrameLayout.LayoutParams;\n    }\n    module FrameLayout {\n        class LayoutParams extends ViewGroup.MarginLayoutParams {\n            gravity: number;\n            constructor(context: Context, attrs: HTMLElement);\n            constructor();\n            constructor(source: ViewGroup.LayoutParams);\n            constructor(width: number, height: number, gravity?: number);\n            protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        }\n    }\n}\ndeclare module android.text {\n    interface Spanned extends String {\n        getSpans<T>(start: number, end: number, type: any): T[];\n        getSpanStart(tag: any): number;\n        getSpanEnd(tag: any): number;\n        getSpanFlags(tag: any): number;\n        nextSpanTransition(start: number, limit: number, type: any): number;\n    }\n    module Spanned {\n        function isImplements(obj: any): any;\n        var SPAN_POINT_MARK_MASK: number;\n        var SPAN_MARK_MARK: number;\n        var SPAN_MARK_POINT: number;\n        var SPAN_POINT_MARK: number;\n        var SPAN_POINT_POINT: number;\n        var SPAN_PARAGRAPH: number;\n        var SPAN_INCLUSIVE_EXCLUSIVE: number;\n        var SPAN_INCLUSIVE_INCLUSIVE: number;\n        var SPAN_EXCLUSIVE_EXCLUSIVE: number;\n        var SPAN_EXCLUSIVE_INCLUSIVE: number;\n        var SPAN_COMPOSING: number;\n        var SPAN_INTERMEDIATE: number;\n        var SPAN_USER_SHIFT: number;\n        var SPAN_USER: number;\n        var SPAN_PRIORITY_SHIFT: number;\n        var SPAN_PRIORITY: number;\n    }\n}\ndeclare module android.text {\n    class TextPaint extends android.graphics.Paint {\n        baselineShift: number;\n        bgColor: number;\n        linkColor: number;\n        underlineColor: number;\n        underlineThickness: number;\n        set(tp: TextPaint): void;\n        setUnderlineText(color: number, thickness: number): void;\n    }\n}\ndeclare module android.text.style {\n    import UpdateAppearance = android.text.style.UpdateAppearance;\n    interface UpdateLayout extends UpdateAppearance {\n    }\n}\ndeclare module android.text.style {\n    interface UpdateAppearance {\n    }\n}\ndeclare module android.text.style {\n    import TextPaint = android.text.TextPaint;\n    abstract class CharacterStyle {\n        static type: symbol;\n        mType: symbol;\n        abstract updateDrawState(tp: TextPaint): void;\n        static wrap(cs: CharacterStyle): CharacterStyle;\n        getUnderlying(): CharacterStyle;\n    }\n    module CharacterStyle {\n        class Passthrough_CharacterStyle extends CharacterStyle {\n            private mStyle;\n            constructor(cs: CharacterStyle);\n            updateDrawState(tp: TextPaint): void;\n            getUnderlying(): CharacterStyle;\n        }\n    }\n}\ndeclare module android.text.style {\n    import TextPaint = android.text.TextPaint;\n    import CharacterStyle = android.text.style.CharacterStyle;\n    import UpdateLayout = android.text.style.UpdateLayout;\n    abstract class MetricAffectingSpan extends CharacterStyle implements UpdateLayout {\n        static type: symbol;\n        mType: symbol;\n        abstract updateMeasureState(p: TextPaint): void;\n        getUnderlying(): MetricAffectingSpan;\n    }\n    module MetricAffectingSpan {\n        class Passthrough_MetricAffectingSpan extends MetricAffectingSpan {\n            private mStyle;\n            constructor(cs: MetricAffectingSpan);\n            updateDrawState(tp: TextPaint): void;\n            updateMeasureState(tp: TextPaint): void;\n            getUnderlying(): MetricAffectingSpan;\n        }\n    }\n}\ndeclare module android.text.style {\n    import Paint = android.graphics.Paint;\n    import Canvas = android.graphics.Canvas;\n    import TextPaint = android.text.TextPaint;\n    import MetricAffectingSpan = android.text.style.MetricAffectingSpan;\n    abstract class ReplacementSpan extends MetricAffectingSpan {\n        static type: symbol;\n        mType: symbol;\n        abstract getSize(paint: Paint, text: String, start: number, end: number, fm: Paint.FontMetricsInt): number;\n        abstract draw(canvas: Canvas, text: String, start: number, end: number, x: number, top: number, y: number, bottom: number, paint: Paint): void;\n        updateMeasureState(p: TextPaint): void;\n        updateDrawState(ds: TextPaint): void;\n    }\n}\ndeclare module android.text.style {\n    interface ParagraphStyle {\n    }\n    module ParagraphStyle {\n        var type: symbol;\n    }\n}\ndeclare module android.text.style {\n    import ParagraphStyle = android.text.style.ParagraphStyle;\n    interface WrapTogetherSpan extends ParagraphStyle {\n    }\n}\ndeclare module android.text.style {\n    import Paint = android.graphics.Paint;\n    import Canvas = android.graphics.Canvas;\n    import Layout = android.text.Layout;\n    import ParagraphStyle = android.text.style.ParagraphStyle;\n    import WrapTogetherSpan = android.text.style.WrapTogetherSpan;\n    interface LeadingMarginSpan extends ParagraphStyle {\n        getLeadingMargin(first: boolean): number;\n        drawLeadingMargin(c: Canvas, p: Paint, x: number, dir: number, top: number, baseline: number, bottom: number, text: String, start: number, end: number, first: boolean, layout: Layout): void;\n    }\n    module LeadingMarginSpan {\n        function isImpl(obj: any): boolean;\n        var type: symbol;\n        interface LeadingMarginSpan2 extends LeadingMarginSpan, WrapTogetherSpan {\n            getLeadingMarginLineCount(): number;\n        }\n        module LeadingMarginSpan2 {\n            function isImpl(obj: any): boolean;\n        }\n        class Standard implements LeadingMarginSpan {\n            private mFirst;\n            private mRest;\n            constructor(first: number, rest?: number);\n            getSpanTypeId(): number;\n            describeContents(): number;\n            getLeadingMargin(first: boolean): number;\n            drawLeadingMargin(c: Canvas, p: Paint, x: number, dir: number, top: number, baseline: number, bottom: number, text: String, start: number, end: number, first: boolean, layout: Layout): void;\n        }\n    }\n}\ndeclare module android.text.style {\n    import Paint = android.graphics.Paint;\n    import Canvas = android.graphics.Canvas;\n    import ParagraphStyle = android.text.style.ParagraphStyle;\n    interface LineBackgroundSpan extends ParagraphStyle {\n        drawBackground(c: Canvas, p: Paint, left: number, right: number, top: number, baseline: number, bottom: number, text: String, start: number, end: number, lnum: number): void;\n    }\n    module LineBackgroundSpan {\n        var type: symbol;\n    }\n}\ndeclare module android.text.style {\n    import ParagraphStyle = android.text.style.ParagraphStyle;\n    interface TabStopSpan extends ParagraphStyle {\n        getTabStop(): number;\n    }\n    module TabStopSpan {\n        var type: symbol;\n        function isImpl(obj: any): boolean;\n        class Standard implements TabStopSpan {\n            constructor(where: number);\n            getTabStop(): number;\n            private mTab;\n        }\n    }\n}\ndeclare module android.text {\n    import Spanned = android.text.Spanned;\n    class SpanSet<E> {\n        private classType;\n        numberOfSpans: number;\n        spans: E[];\n        spanStarts: number[];\n        spanEnds: number[];\n        spanFlags: number[];\n        constructor(type: any);\n        init(spanned: Spanned, start: number, limit: number): void;\n        hasSpansIntersecting(start: number, end: number): boolean;\n        getNextTransition(start: number, limit: number): number;\n        recycle(): void;\n    }\n}\ndeclare module android.text {\n    interface TextDirectionHeuristic {\n        isRtl(cs: string, start: number, count: number): boolean;\n    }\n}\ndeclare module android.text {\n    import TextDirectionHeuristic = android.text.TextDirectionHeuristic;\n    class TextDirectionHeuristics {\n        static LTR: TextDirectionHeuristic;\n        static RTL: TextDirectionHeuristic;\n        static FIRSTSTRONG_LTR: TextDirectionHeuristic;\n        static FIRSTSTRONG_RTL: TextDirectionHeuristic;\n        static ANYRTL_LTR: TextDirectionHeuristic;\n        static LOCALE: TextDirectionHeuristic;\n        private static STATE_TRUE;\n        private static STATE_FALSE;\n        private static STATE_UNKNOWN;\n        private static isRtlText(directionality);\n        private static isRtlTextOrFormat(directionality);\n    }\n    module TextDirectionHeuristics {\n        abstract class TextDirectionHeuristicImpl implements TextDirectionHeuristic {\n            private mAlgorithm;\n            constructor(algorithm: TextDirectionHeuristics.TextDirectionAlgorithm);\n            protected abstract defaultIsRtl(): boolean;\n            isRtl(cs: string, start: number, count: number): boolean;\n            private doCheck(cs, start, count);\n        }\n        class TextDirectionHeuristicInternal extends TextDirectionHeuristics.TextDirectionHeuristicImpl {\n            private mDefaultIsRtl;\n            constructor(algorithm: TextDirectionHeuristics.TextDirectionAlgorithm, defaultIsRtl: boolean);\n            protected defaultIsRtl(): boolean;\n        }\n        interface TextDirectionAlgorithm {\n            checkRtl(cs: string, start: number, count: number): number;\n        }\n        class FirstStrong implements TextDirectionHeuristics.TextDirectionAlgorithm {\n            checkRtl(cs: string, start: number, count: number): number;\n            constructor();\n            static INSTANCE: FirstStrong;\n        }\n        class AnyStrong implements TextDirectionHeuristics.TextDirectionAlgorithm {\n            private mLookForRtl;\n            checkRtl(cs: string, start: number, count: number): number;\n            constructor(lookForRtl: boolean);\n            static INSTANCE_RTL: AnyStrong;\n            static INSTANCE_LTR: AnyStrong;\n        }\n        class TextDirectionHeuristicLocale extends TextDirectionHeuristics.TextDirectionHeuristicImpl {\n            constructor();\n            protected defaultIsRtl(): boolean;\n            static INSTANCE: TextDirectionHeuristicLocale;\n        }\n    }\n}\ndeclare module android.text {\n    import Canvas = android.graphics.Canvas;\n    import FontMetricsInt = android.graphics.Paint.FontMetricsInt;\n    import TextPaint = android.text.TextPaint;\n    import Layout = android.text.Layout;\n    class TextLine {\n        private static DEBUG;\n        private mPaint;\n        private mText;\n        private mStart;\n        private mLen;\n        private mDir;\n        private mDirections;\n        private mHasTabs;\n        private mTabs;\n        private mChars;\n        private mCharsValid;\n        private mSpanned;\n        private mWorkPaint;\n        private mMetricAffectingSpanSpanSet;\n        private mCharacterStyleSpanSet;\n        private mReplacementSpanSpanSet;\n        private static sCached;\n        static obtain(): TextLine;\n        static recycle(tl: TextLine): TextLine;\n        set(paint: TextPaint, text: String, start: number, limit: number, dir: number, directions: Layout.Directions, hasTabs: boolean, tabStops: Layout.TabStops): void;\n        draw(c: Canvas, x: number, top: number, y: number, bottom: number): void;\n        metrics(fmi: FontMetricsInt): number;\n        measure(offset: number, trailing: boolean, fmi: FontMetricsInt): number;\n        private drawRun(c, start, limit, runIsRtl, x, top, y, bottom, needWidth);\n        private measureRun(start, offset, limit, runIsRtl, fmi);\n        getOffsetToLeftRightOf(cursor: number, toLeft: boolean): number;\n        private getOffsetBeforeAfter(runIndex, runStart, runLimit, runIsRtl, offset, after);\n        private static expandMetricsFromPaint(fmi, wp);\n        static updateMetrics(fmi: FontMetricsInt, previousTop: number, previousAscent: number, previousDescent: number, previousBottom: number, previousLeading: number): void;\n        private handleText(wp, start, end, contextStart, contextEnd, runIsRtl, c, x, top, y, bottom, fmi, needWidth);\n        private handleReplacement(replacement, wp, start, limit, runIsRtl, c, x, top, y, bottom, fmi, needWidth);\n        private handleRun(start, measureLimit, limit, runIsRtl, c, x, top, y, bottom, fmi, needWidth);\n        private drawTextRun(c, wp, start, end, contextStart, contextEnd, runIsRtl, x, y);\n        ascent(pos: number): number;\n        nextTab(h: number): number;\n        private static TAB_INCREMENT;\n    }\n}\ndeclare module android.text {\n    interface TextWatcher {\n        beforeTextChanged(s: String, start: number, count: number, after: number): void;\n        onTextChanged(s: String, start: number, before: number, count: number): void;\n        afterTextChanged(s: String): void;\n    }\n}\ndeclare module android.text {\n    import Canvas = android.graphics.Canvas;\n    import Paint = android.graphics.Paint;\n    import Rect = android.graphics.Rect;\n    import Path = android.graphics.Path;\n    import Spanned = android.text.Spanned;\n    import TextDirectionHeuristic = android.text.TextDirectionHeuristic;\n    import TextPaint = android.text.TextPaint;\n    import TextUtils = android.text.TextUtils;\n    abstract class Layout {\n        private static NO_PARA_SPANS;\n        static getDesiredWidth(source: String, paint: TextPaint): number;\n        static getDesiredWidth(source: String, start: number, end: number, paint: TextPaint): number;\n        private static getDesiredWidth_2(source, paint);\n        private static getDesiredWidth_4(source, start, end, paint);\n        constructor(text: String, paint: TextPaint, width: number, align: Layout.Alignment, textDir?: TextDirectionHeuristic, spacingMult?: number, spacingAdd?: number);\n        replaceWith(text: String, paint: TextPaint, width: number, align: Layout.Alignment, spacingmult: number, spacingadd: number): void;\n        draw(canvas: Canvas, highlight?: Path, highlightPaint?: Paint, cursorOffsetVertical?: number): void;\n        drawText(canvas: Canvas, firstLine: number, lastLine: number): void;\n        drawBackground(canvas: Canvas, highlight: Path, highlightPaint: Paint, cursorOffsetVertical: number, firstLine: number, lastLine: number): void;\n        getLineRangeForDraw(canvas: Canvas): number[];\n        private getLineStartPos(line, left, right);\n        getText(): String;\n        getPaint(): TextPaint;\n        getWidth(): number;\n        getEllipsizedWidth(): number;\n        increaseWidthTo(wid: number): void;\n        getHeight(): number;\n        getAlignment(): Layout.Alignment;\n        getSpacingMultiplier(): number;\n        getSpacingAdd(): number;\n        getTextDirectionHeuristic(): TextDirectionHeuristic;\n        abstract getLineCount(): number;\n        getLineBounds(line: number, bounds: Rect): number;\n        abstract getLineTop(line: number): number;\n        abstract getLineDescent(line: number): number;\n        abstract getLineStart(line: number): number;\n        abstract getParagraphDirection(line: number): number;\n        abstract getLineContainsTab(line: number): boolean;\n        abstract getLineDirections(line: number): Layout.Directions;\n        abstract getTopPadding(): number;\n        abstract getBottomPadding(): number;\n        isLevelBoundary(offset: number): boolean;\n        isRtlCharAt(offset: number): boolean;\n        private primaryIsTrailingPrevious(offset);\n        getPrimaryHorizontal(offset: number, clamped?: boolean): number;\n        getSecondaryHorizontal(offset: number, clamped?: boolean): number;\n        private getHorizontal(offset, trailing, clamped);\n        private getHorizontal_4(offset, trailing, line, clamped);\n        getLineLeft(line: number): number;\n        getLineRight(line: number): number;\n        getLineMax(line: number): number;\n        getLineWidth(line: number): number;\n        private getLineExtent(line, full);\n        private getLineExtent(line, tabStops, full);\n        private getLineExtent_2(line, full);\n        private getLineExtent_3(line, tabStops, full);\n        getLineForVertical(vertical: number): number;\n        getLineForOffset(offset: number): number;\n        getOffsetForHorizontal(line: number, horiz: number): number;\n        getLineEnd(line: number): number;\n        private getLineVisibleEnd(line, start?, end?);\n        getLineBottom(line: number): number;\n        getLineBaseline(line: number): number;\n        getLineAscent(line: number): number;\n        getOffsetToLeftOf(offset: number): number;\n        getOffsetToRightOf(offset: number): number;\n        private getOffsetToLeftRightOf(caret, toLeft);\n        private getOffsetAtStartOf(offset);\n        shouldClampCursor(line: number): boolean;\n        getCursorPath(point: number, dest: Path, editingBuffer: String): void;\n        private addSelection(line, start, end, top, bottom, dest);\n        getSelectionPath(start: number, end: number, dest: Path): void;\n        getParagraphAlignment(line: number): Layout.Alignment;\n        getParagraphLeft(line: number): number;\n        getParagraphRight(line: number): number;\n        private getParagraphLeadingMargin(line);\n        static measurePara(paint: TextPaint, text: String, start: number, end: number): number;\n        static nextTab(text: String, start: number, end: number, h: number, tabs: any[]): number;\n        protected isSpanned(): boolean;\n        static getParagraphSpans<T>(text: Spanned, start: number, end: number, type: any): T[];\n        private getEllipsisChar(method);\n        private ellipsize(start, end, line, dest, destoff, method);\n        abstract getEllipsisStart(line: number): number;\n        abstract getEllipsisCount(line: number): number;\n        private mText;\n        private mPaint;\n        mWorkPaint: TextPaint;\n        private mWidth;\n        private mAlignment;\n        private mSpacingMult;\n        private mSpacingAdd;\n        private static sTempRect;\n        private mSpannedText;\n        private mTextDir;\n        private mLineBackgroundSpans;\n        static DIR_LEFT_TO_RIGHT: number;\n        static DIR_RIGHT_TO_LEFT: number;\n        static DIR_REQUEST_LTR: number;\n        static DIR_REQUEST_RTL: number;\n        static DIR_REQUEST_DEFAULT_LTR: number;\n        static DIR_REQUEST_DEFAULT_RTL: number;\n        static RUN_LENGTH_MASK: number;\n        static RUN_LEVEL_SHIFT: number;\n        static RUN_LEVEL_MASK: number;\n        static RUN_RTL_FLAG: number;\n        private static TAB_INCREMENT;\n        static DIRS_ALL_LEFT_TO_RIGHT: Layout.Directions;\n        static DIRS_ALL_RIGHT_TO_LEFT: Layout.Directions;\n        static ELLIPSIS_NORMAL: string[];\n        static ELLIPSIS_TWO_DOTS: string[];\n    }\n    module Layout {\n        class TabStops {\n            private mStops;\n            private mNumStops;\n            private mIncrement;\n            constructor(increment: number, spans: any[]);\n            reset(increment: number, spans: any[]): void;\n            nextTab(h: number): number;\n            static nextDefaultStop(h: number, inc: number): number;\n        }\n        class Directions {\n            mDirections: number[];\n            constructor(dirs: number[]);\n        }\n        class Ellipsizer extends String {\n            mText: String;\n            mLayout: Layout;\n            mWidth: number;\n            mMethod: TextUtils.TruncateAt;\n            constructor(s: String);\n            toString(): string;\n        }\n        class SpannedEllipsizer extends Layout.Ellipsizer implements Spanned {\n            private mSpanned;\n            constructor(display: String);\n            getSpans<T>(start: number, end: number, type: any): T[];\n            getSpanStart(tag: any): number;\n            getSpanEnd(tag: any): number;\n            getSpanFlags(tag: any): number;\n            nextSpanTransition(start: number, limit: number, type: any): number;\n        }\n        enum Alignment {\n            ALIGN_NORMAL = 0,\n            ALIGN_OPPOSITE = 1,\n            ALIGN_CENTER = 2,\n            ALIGN_LEFT = 3,\n            ALIGN_RIGHT = 4,\n        }\n    }\n}\ndeclare module android.text {\n    import Paint = android.graphics.Paint;\n    import MetricAffectingSpan = android.text.style.MetricAffectingSpan;\n    import TextDirectionHeuristic = android.text.TextDirectionHeuristic;\n    import TextPaint = android.text.TextPaint;\n    class MeasuredText {\n        private static localLOGV;\n        mText: String;\n        mTextStart: number;\n        mWidths: number[];\n        mChars: string;\n        mLevels: number[];\n        mDir: number;\n        mEasy: boolean;\n        mLen: number;\n        private mPos;\n        private mWorkPaint;\n        constructor();\n        private static sLock;\n        private static sCached;\n        static obtain(): MeasuredText;\n        static recycle(mt: MeasuredText): MeasuredText;\n        setPos(pos: number): void;\n        setPara(text: String, start: number, end: number, textDir: TextDirectionHeuristic): void;\n        addStyleRun(paint: TextPaint, len: number, fm: Paint.FontMetricsInt): number;\n        addStyleRun(paint: TextPaint, spans: MetricAffectingSpan[], len: number, fm: Paint.FontMetricsInt): number;\n        private addStyleRun_3(paint, len, fm);\n        private addStyleRun_4(paint, spans, len, fm);\n        breakText(limit: number, forwards: boolean, width: number): number;\n        measure(start: number, limit: number): number;\n    }\n}\ndeclare module android.text {\n    import Spanned = android.text.Spanned;\n    import TextDirectionHeuristic = android.text.TextDirectionHeuristic;\n    import TextPaint = android.text.TextPaint;\n    class TextUtils {\n        static isEmpty(str: string | String): boolean;\n        static ALIGNMENT_SPAN: number;\n        static FIRST_SPAN: number;\n        static FOREGROUND_COLOR_SPAN: number;\n        static RELATIVE_SIZE_SPAN: number;\n        static SCALE_X_SPAN: number;\n        static STRIKETHROUGH_SPAN: number;\n        static UNDERLINE_SPAN: number;\n        static STYLE_SPAN: number;\n        static BULLET_SPAN: number;\n        static QUOTE_SPAN: number;\n        static LEADING_MARGIN_SPAN: number;\n        static URL_SPAN: number;\n        static BACKGROUND_COLOR_SPAN: number;\n        static TYPEFACE_SPAN: number;\n        static SUPERSCRIPT_SPAN: number;\n        static SUBSCRIPT_SPAN: number;\n        static ABSOLUTE_SIZE_SPAN: number;\n        static TEXT_APPEARANCE_SPAN: number;\n        static ANNOTATION: number;\n        static SUGGESTION_SPAN: number;\n        static SPELL_CHECK_SPAN: number;\n        static SUGGESTION_RANGE_SPAN: number;\n        static EASY_EDIT_SPAN: number;\n        static LOCALE_SPAN: number;\n        static LAST_SPAN: number;\n        private static EMPTY_STRING_ARRAY;\n        private static ZWNBS_CHAR;\n        private static ARAB_SCRIPT_SUBTAG;\n        private static HEBR_SCRIPT_SUBTAG;\n        static getOffsetBefore(text: String, offset: number): number;\n        static getOffsetAfter(text: String, offset: number): number;\n        static ellipsize(text: String, paint: TextPaint, avail: number, where: TextUtils.TruncateAt, preserveLength?: boolean, callback?: TextUtils.EllipsizeCallback, textDir?: TextDirectionHeuristic, ellipsis?: any): String;\n        private static setPara(mt, paint, text, start, end, textDir);\n        static removeEmptySpans<T>(spans: T[], spanned: Spanned, klass: any): T[];\n        static packRangeInLong(start: number, end: number): number[];\n        static unpackRangeStartFromLong(range: number[]): number;\n        static unpackRangeEndFromLong(range: number[]): number;\n    }\n    module TextUtils {\n        enum TruncateAt {\n            START = 0,\n            MIDDLE = 1,\n            END = 2,\n            MARQUEE = 3,\n            END_SMALL = 4,\n        }\n        interface EllipsizeCallback {\n            ellipsized(start: number, end: number): void;\n        }\n    }\n}\ndeclare module android.view {\n    import ViewGroup = android.view.ViewGroup;\n    import Window = android.view.Window;\n    import Context = android.content.Context;\n    import Animation = android.view.animation.Animation;\n    class WindowManager {\n        private mWindowsLayout;\n        protected mActiveWindow: Window;\n        private static FocusViewRemember;\n        constructor(context: Context);\n        getWindowsLayout(): ViewGroup;\n        addWindow(window: Window): void;\n        updateWindowLayout(window: Window, params: ViewGroup.LayoutParams): void;\n        removeWindow(window: Window): void;\n    }\n    module WindowManager {\n        class Layout extends android.widget.FrameLayout {\n            private mWindowManager;\n            constructor(context: android.content.Context, windowManager: WindowManager);\n            getTopFocusableWindowView(findParent?: boolean): ViewGroup;\n            dispatchKeyEvent(event: android.view.KeyEvent): boolean;\n            protected isTransformedTouchPointInView(x: number, y: number, child: android.view.View, outLocalPoint: android.graphics.Point): boolean;\n            onChildVisibilityChanged(child: android.view.View, oldVisibility: number, newVisibility: number): void;\n            protected onLayout(changed: boolean, left: number, top: number, right: number, bottom: number): void;\n            layoutChildren(left: number, top: number, right: number, bottom: number, forceLeftGravity: boolean): void;\n            tagName(): string;\n        }\n        class LayoutParams extends android.widget.FrameLayout.LayoutParams {\n            x: number;\n            y: number;\n            type: number;\n            static FIRST_APPLICATION_WINDOW: number;\n            static TYPE_BASE_APPLICATION: number;\n            static TYPE_APPLICATION: number;\n            static TYPE_APPLICATION_STARTING: number;\n            static LAST_APPLICATION_WINDOW: number;\n            static FIRST_SUB_WINDOW: number;\n            static TYPE_APPLICATION_PANEL: number;\n            static TYPE_APPLICATION_MEDIA: number;\n            static TYPE_APPLICATION_SUB_PANEL: number;\n            static TYPE_APPLICATION_ATTACHED_DIALOG: number;\n            static TYPE_APPLICATION_MEDIA_OVERLAY: number;\n            static LAST_SUB_WINDOW: number;\n            static FIRST_SYSTEM_WINDOW: number;\n            static TYPE_STATUS_BAR: number;\n            static TYPE_SEARCH_BAR: number;\n            static TYPE_PHONE: number;\n            static TYPE_SYSTEM_ALERT: number;\n            static TYPE_KEYGUARD: number;\n            static TYPE_TOAST: number;\n            static TYPE_SYSTEM_OVERLAY: number;\n            static TYPE_PRIORITY_PHONE: number;\n            static TYPE_SYSTEM_DIALOG: number;\n            static LAST_SYSTEM_WINDOW: number;\n            static FLAG_NOT_FOCUSABLE: number;\n            static FLAG_NOT_TOUCHABLE: number;\n            static FLAG_NOT_TOUCH_MODAL: number;\n            static FLAG_WATCH_OUTSIDE_TOUCH: number;\n            static FLAG_SPLIT_TOUCH: number;\n            static FLAG_FLOATING: number;\n            flags: number;\n            exitAnimation: Animation;\n            enterAnimation: Animation;\n            resumeAnimation: Animation;\n            hideAnimation: Animation;\n            dimAmount: number;\n            constructor(_type?: number);\n            setTitle(title: string): void;\n            getTitle(): string;\n            static LAYOUT_CHANGED: number;\n            static TYPE_CHANGED: number;\n            static FLAGS_CHANGED: number;\n            static FORMAT_CHANGED: number;\n            static ANIMATION_CHANGED: number;\n            static DIM_AMOUNT_CHANGED: number;\n            static TITLE_CHANGED: number;\n            static ALPHA_CHANGED: number;\n            copyFrom(o: LayoutParams): number;\n            private mTitle;\n            private isFocusable();\n            private isTouchable();\n            private isTouchModal();\n            private isFloating();\n            private isSplitTouch();\n            private isWatchTouchOutside();\n        }\n    }\n}\ndeclare module android.view.animation {\n    import Animation = android.view.animation.Animation;\n    import Transformation = android.view.animation.Transformation;\n    class TranslateAnimation extends Animation {\n        private mFromXType;\n        private mToXType;\n        private mFromYType;\n        private mToYType;\n        private mFromXValue;\n        private mToXValue;\n        private mFromYValue;\n        private mToYValue;\n        private mFromXDelta;\n        private mToXDelta;\n        private mFromYDelta;\n        private mToYDelta;\n        constructor(fromXDelta: number, toXDelta: number, fromYDelta: number, toYDelta: number);\n        constructor(fromXType: number, fromXValue: number, toXType: number, toXValue: number, fromYType: number, fromYValue: number, toYType: number, toYValue: number);\n        protected applyTransformation(interpolatedTime: number, t: Transformation): void;\n        initialize(width: number, height: number, parentWidth: number, parentHeight: number): void;\n    }\n}\ndeclare module android.view.animation {\n    import Animation = android.view.animation.Animation;\n    import Transformation = android.view.animation.Transformation;\n    class AlphaAnimation extends Animation {\n        private mFromAlpha;\n        private mToAlpha;\n        constructor(fromAlpha: number, toAlpha: number);\n        protected applyTransformation(interpolatedTime: number, t: Transformation): void;\n        willChangeTransformationMatrix(): boolean;\n        willChangeBounds(): boolean;\n        hasAlpha(): boolean;\n    }\n}\ndeclare module android.view.animation {\n    import Animation = android.view.animation.Animation;\n    import Transformation = android.view.animation.Transformation;\n    class ScaleAnimation extends Animation {\n        private mResources;\n        private mFromX;\n        private mToX;\n        private mFromY;\n        private mToY;\n        private mFromXData;\n        private mToXData;\n        private mFromYData;\n        private mToYData;\n        private mPivotXType;\n        private mPivotYType;\n        private mPivotXValue;\n        private mPivotYValue;\n        private mPivotX;\n        private mPivotY;\n        constructor(fromX: number, toX: number, fromY: number, toY: number, pivotXType?: number, pivotXValue?: number, pivotYType?: number, pivotYValue?: number);\n        private initializePivotPoint();\n        protected applyTransformation(interpolatedTime: number, t: Transformation): void;\n        initialize(width: number, height: number, parentWidth: number, parentHeight: number): void;\n    }\n}\ndeclare module android.view.animation {\n    import List = java.util.List;\n    import Animation = android.view.animation.Animation;\n    import Transformation = android.view.animation.Transformation;\n    class AnimationSet extends Animation {\n        private static PROPERTY_FILL_AFTER_MASK;\n        private static PROPERTY_FILL_BEFORE_MASK;\n        private static PROPERTY_REPEAT_MODE_MASK;\n        private static PROPERTY_START_OFFSET_MASK;\n        private static PROPERTY_SHARE_INTERPOLATOR_MASK;\n        private static PROPERTY_DURATION_MASK;\n        private static PROPERTY_MORPH_MATRIX_MASK;\n        private static PROPERTY_CHANGE_BOUNDS_MASK;\n        private mFlags;\n        private mDirty;\n        private mHasAlpha;\n        private mAnimations;\n        private mTempTransformation;\n        private mLastEnd;\n        private mStoredOffsets;\n        constructor(shareInterpolator?: boolean);\n        private setFlag(mask, value);\n        private init();\n        setFillAfter(fillAfter: boolean): void;\n        setFillBefore(fillBefore: boolean): void;\n        setRepeatMode(repeatMode: number): void;\n        setStartOffset(startOffset: number): void;\n        hasAlpha(): boolean;\n        setDuration(durationMillis: number): void;\n        addAnimation(a: Animation): void;\n        setStartTime(startTimeMillis: number): void;\n        getStartTime(): number;\n        restrictDuration(durationMillis: number): void;\n        getDuration(): number;\n        computeDurationHint(): number;\n        initializeInvalidateRegion(left: number, top: number, right: number, bottom: number): void;\n        getTransformation(currentTime: number, t: Transformation): boolean;\n        scaleCurrentDuration(scale: number): void;\n        initialize(width: number, height: number, parentWidth: number, parentHeight: number): void;\n        reset(): void;\n        restoreChildrenStartOffset(): void;\n        getAnimations(): List<Animation>;\n        willChangeTransformationMatrix(): boolean;\n        willChangeBounds(): boolean;\n    }\n}\ndeclare module android.view.animation {\n    class AccelerateInterpolator implements Interpolator {\n        private mFactor;\n        private mDoubleFactor;\n        constructor(factor?: number);\n        getInterpolation(input: number): number;\n    }\n}\ndeclare module android.view.animation {\n    class AnticipateInterpolator implements Interpolator {\n        private mTension;\n        constructor(tension?: number);\n        getInterpolation(t: number): number;\n    }\n}\ndeclare module android.view.animation {\n    class AnticipateOvershootInterpolator implements Interpolator {\n        private mTension;\n        constructor(tension?: number, extraTension?: number);\n        private static a(t, s);\n        private static o(t, s);\n        getInterpolation(t: number): number;\n    }\n}\ndeclare module android.view.animation {\n    class BounceInterpolator implements Interpolator {\n        private static bounce(t);\n        getInterpolation(t: number): number;\n    }\n}\ndeclare module android.view.animation {\n    class CycleInterpolator implements Interpolator {\n        private mCycles;\n        constructor(mCycles: number);\n        getInterpolation(input: number): number;\n    }\n}\ndeclare module android.view.animation {\n    class OvershootInterpolator implements Interpolator {\n        private mTension;\n        constructor(tension?: number);\n        getInterpolation(t: number): number;\n    }\n}\ndeclare module android.R {\n    import AccelerateDecelerateInterpolator = android.view.animation.AccelerateDecelerateInterpolator;\n    import AccelerateInterpolator = android.view.animation.AccelerateInterpolator;\n    import AnticipateInterpolator = android.view.animation.AnticipateInterpolator;\n    import AnticipateOvershootInterpolator = android.view.animation.AnticipateOvershootInterpolator;\n    import BounceInterpolator = android.view.animation.BounceInterpolator;\n    import CycleInterpolator = android.view.animation.CycleInterpolator;\n    import DecelerateInterpolator = android.view.animation.DecelerateInterpolator;\n    import LinearInterpolator = android.view.animation.LinearInterpolator;\n    import OvershootInterpolator = android.view.animation.OvershootInterpolator;\n    class interpolator {\n        static accelerate_cubic: AccelerateInterpolator;\n        static accelerate_decelerate: AccelerateDecelerateInterpolator;\n        static accelerate_quad: AccelerateInterpolator;\n        static accelerate_quint: AccelerateInterpolator;\n        static anticipate_overshoot: AnticipateOvershootInterpolator;\n        static anticipate: AnticipateInterpolator;\n        static bounce: BounceInterpolator;\n        static cycle: CycleInterpolator;\n        static decelerate_cubic: DecelerateInterpolator;\n        static decelerate_quad: DecelerateInterpolator;\n        static decelerate_quint: DecelerateInterpolator;\n        static linear: LinearInterpolator;\n        static overshoot: OvershootInterpolator;\n    }\n}\ndeclare module android.R {\n    import Animation = android.view.animation.Animation;\n    class anim {\n        static readonly activity_close_enter: Animation;\n        static readonly activity_close_exit: Animation;\n        static readonly activity_open_enter: Animation;\n        static readonly activity_open_exit: Animation;\n        static readonly activity_close_enter_ios: Animation;\n        static readonly activity_close_exit_ios: Animation;\n        static readonly activity_open_enter_ios: Animation;\n        static readonly activity_open_exit_ios: Animation;\n        static readonly dialog_enter: Animation;\n        static readonly dialog_exit: Animation;\n        static readonly fade_in: Animation;\n        static readonly fade_out: Animation;\n        static readonly toast_enter: Animation;\n        static readonly toast_exit: Animation;\n        static readonly grow_fade_in: Animation;\n        static readonly grow_fade_in_center: Animation;\n        static readonly grow_fade_in_from_bottom: Animation;\n        static readonly shrink_fade_out: Animation;\n        static readonly shrink_fade_out_center: Animation;\n        static readonly shrink_fade_out_from_bottom: Animation;\n    }\n}\ndeclare module android.view {\n    import Drawable = android.graphics.drawable.Drawable;\n    import KeyEvent = android.view.KeyEvent;\n    import LayoutInflater = android.view.LayoutInflater;\n    import MotionEvent = android.view.MotionEvent;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import WindowManager = android.view.WindowManager;\n    import Animation = android.view.animation.Animation;\n    import Context = android.content.Context;\n    class Window {\n        private mContext;\n        private mCallback;\n        private mChildWindowManager;\n        private mContainer;\n        private mIsActive;\n        private mCloseOnTouchOutside;\n        private mSetCloseOnTouchOutside;\n        private mDestroyed;\n        private mWindowAttributes;\n        private mAttachInfo;\n        private mDecor;\n        private mContentParent;\n        constructor(context: Context);\n        private initDecorView();\n        private initAttachInfo();\n        getContext(): Context;\n        setContainer(container: WindowManager): void;\n        getContainer(): WindowManager;\n        destroy(): void;\n        isDestroyed(): boolean;\n        setChildWindowManager(wm: WindowManager): void;\n        getChildWindowManager(): WindowManager;\n        setCallback(callback: Window.Callback): void;\n        getCallback(): Window.Callback;\n        setFloating(isFloating: boolean): void;\n        isFloating(): boolean;\n        setLayout(width: number, height: number): void;\n        setGravity(gravity: number): void;\n        setType(type: number): void;\n        setWindowAnimations(enterAnimation: Animation, exitAnimation: Animation, resumeAnimation?: Animation, hideAnimation?: Animation): void;\n        addFlags(flags: number): void;\n        clearFlags(flags: number): void;\n        setFlags(flags: number, mask: number): void;\n        setDimAmount(amount: number): void;\n        setAttributes(a: WindowManager.LayoutParams): void;\n        getAttributes(): WindowManager.LayoutParams;\n        setCloseOnTouchOutside(close: boolean): void;\n        setCloseOnTouchOutsideIfNotSet(close: boolean): void;\n        shouldCloseOnTouch(context: Context, event: MotionEvent): boolean;\n        private isOutOfBounds(context, event);\n        makeActive(): void;\n        isActive(): boolean;\n        findViewById(id: string): View;\n        setContentView(view: View, params?: ViewGroup.LayoutParams): void;\n        addContentView(view: View, params: ViewGroup.LayoutParams): void;\n        getContentParent(): ViewGroup;\n        getCurrentFocus(): View;\n        getLayoutInflater(): LayoutInflater;\n        setTitle(title: string): void;\n        setBackgroundDrawable(drawable: Drawable): void;\n        setBackgroundColor(color: number): void;\n        takeKeyEvents(_get: boolean): void;\n        superDispatchKeyEvent(event: KeyEvent): boolean;\n        superDispatchTouchEvent(event: MotionEvent): boolean;\n        superDispatchGenericMotionEvent(event: MotionEvent): boolean;\n        getDecorView(): View;\n        peekDecorView(): View;\n        protected onActive(): void;\n    }\n    module Window {\n        interface Callback {\n            dispatchKeyEvent(event: KeyEvent): boolean;\n            dispatchTouchEvent(event: MotionEvent): boolean;\n            dispatchGenericMotionEvent(event: MotionEvent): boolean;\n            onWindowAttributesChanged(attrs: WindowManager.LayoutParams): void;\n            onContentChanged(): void;\n            onWindowFocusChanged(hasFocus: boolean): void;\n            onAttachedToWindow(): void;\n            onDetachedFromWindow(): void;\n        }\n    }\n}\ndeclare module PageStack {\n    var DEBUG: boolean;\n    var currentStack: StateStack;\n    var backListener: () => boolean;\n    var pageOpenHandler: (pageId: string, pageExtra?: any, isRestore?: boolean) => any;\n    var pagePushHandler: (pageId: string, pageExtra?: any) => any;\n    var pageCloseHandler: (pageId: string, pageExtra?: any) => any;\n    function init(): void;\n    function go(delta: number, pageAlreadyClose?: boolean): void;\n    function back(pageAlreadyClose?: boolean): void;\n    function openPage(pageId: string, extra?: any): any;\n    function backToPage(pageId: string): void;\n    function historyGo(delta: number, ensureFaked?: boolean): void;\n    function notifyPageClosed(pageId: string): void;\n    function notifyNewPageOpened(pageId: string, extra?: any): void;\n    function getPageExtra(pageId?: string): any;\n    function setPageExtra(extra: any, pageId?: string): void;\n    function preClosePageHasIFrame(historyLengthWhenInitIFrame: number): void;\n    interface StateStack {\n        pageId: string;\n        isRoot?: boolean;\n        stack: StateSaved[];\n    }\n    interface StateSaved {\n        pageId: string;\n        extra?: any;\n    }\n}\ndeclare module android.app {\n    import Intent = android.content.Intent;\n    import Animation = android.view.animation.Animation;\n    class ActivityThread {\n        androidUI: androidui.AndroidUI;\n        mLaunchedActivities: Set<Activity>;\n        overrideExitAnimation: Animation;\n        overrideEnterAnimation: Animation;\n        overrideResumeAnimation: Animation;\n        overrideHideAnimation: Animation;\n        constructor(androidUI: androidui.AndroidUI);\n        private initWithPageStack();\n        overrideNextWindowAnimation(enterAnimation: Animation, exitAnimation: Animation, resumeAnimation: Animation, hideAnimation: Animation): void;\n        getOverrideEnterAnimation(): Animation;\n        getOverrideExitAnimation(): Animation;\n        getOverrideResumeAnimation(): Animation;\n        getOverrideHideAnimation(): Animation;\n        private scheduleApplicationHideTimeout;\n        scheduleApplicationHide(): void;\n        scheduleApplicationShow(): void;\n        execStartActivity(callActivity: Activity, intent: Intent, options?: android.os.Bundle): void;\n        private activityResumeTimeout;\n        scheduleActivityResume(): void;\n        scheduleLaunchActivity(callActivity: Activity, intent: Intent, options?: android.os.Bundle): void;\n        scheduleDestroyActivityByRequestCode(requestCode: number): void;\n        scheduleDestroyActivity(activity: Activity, finishing?: boolean): void;\n        scheduleBackTo(intent: Intent): boolean;\n        canBackTo(intent: Intent): boolean;\n        scheduleBackToRoot(): void;\n        private handlePauseActivity(activity);\n        private performPauseActivity(activity);\n        private handleStopActivity(activity, show?);\n        private performStopActivity(activity, saveState);\n        private handleResumeActivity(a, launching);\n        private performResumeActivity(a, launching);\n        private handleLaunchActivity(intent);\n        private performLaunchActivity(intent);\n        private handleDestroyActivity(activity, finishing);\n        private performDestroyActivity(activity, finishing);\n        private updateVisibility(activity, show);\n        private getVisibleToUserActivities();\n        private isRootActivity(activity);\n        private static getActivityName(activity);\n    }\n}\ndeclare module android.R {\n    class string_ {\n        static ok: string;\n        static cancel: string;\n        static close: string;\n        static back: string;\n        static crash_catch_alert: string;\n        static prll_header_state_normal: string;\n        static prll_header_state_ready: string;\n        static prll_header_state_loading: string;\n        static prll_header_state_fail: string;\n        static prll_footer_state_normal: string;\n        static prll_footer_state_loading: string;\n        static prll_footer_state_ready: string;\n        static prll_footer_state_fail: string;\n        static prll_footer_state_no_more: string;\n        private static zh();\n    }\n}\ndeclare module androidui {\n    class AndroidUIElement extends HTMLDivElement {\n        AndroidUI: AndroidUI;\n        createdCallback(): void;\n        attachedCallback(): void;\n        detachedCallback(): void;\n        attributeChangedCallback(attributeName: string, oldVal: string, newVal: string): void;\n    }\n}\ndeclare module androidui {\n    import View = android.view.View;\n    import UIClient = androidui.AndroidUI.UIClient;\n    class AndroidUI {\n        static BindToElementName: string;\n        androidUIElement: AndroidUIElement;\n        private _canvas;\n        readonly windowManager: android.view.WindowManager;\n        private mActivityThread;\n        private _viewRootImpl;\n        private mApplication;\n        appName: string;\n        private uiClient;\n        private viewsDependOnDebugLayout;\n        private showDebugLayoutDefault;\n        private _windowBound;\n        private tempRect;\n        readonly windowBound: android.graphics.Rect;\n        private touchEvent;\n        private ketEvent;\n        constructor(androidUIElement: AndroidUIElement);\n        private init();\n        private initApplication();\n        private initLaunchActivity();\n        private initGlobalCrashHandle();\n        private refreshWindowBound();\n        private initAndroidUIElement();\n        private initEvent();\n        private initTouchEvent();\n        private initMouseEvent();\n        private initKeyEvent();\n        private initGenericEvent();\n        private initRootSizeChange();\n        private initBrowserVisibleChange();\n        private notifyRootSizeChange();\n        viewAttachedDependOnDebugLayout(view: View): void;\n        viewDetachedDependOnDebugLayout(view: View): void;\n        setDebugEnable(enable?: boolean): void;\n        setShowDebugLayout(showDebugLayoutDefault?: boolean): void;\n        private showDebugLayout();\n        private hideDebugLayout();\n        setUIClient(uiClient: UIClient): void;\n        showAppClosed(): void;\n        private static showAppClosed(androidUI);\n    }\n    module AndroidUI {\n        interface UIClient {\n            shouldShowAppClosed?(androidUI: AndroidUI): any;\n        }\n    }\n}\ndeclare module android.app {\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import KeyEvent = android.view.KeyEvent;\n    import Animation = android.view.animation.Animation;\n    import MotionEvent = android.view.MotionEvent;\n    import Window = android.view.Window;\n    import WindowManager = android.view.WindowManager;\n    import Bundle = android.os.Bundle;\n    import Context = android.content.Context;\n    import Intent = android.content.Intent;\n    import Runnable = java.lang.Runnable;\n    class Activity extends Context implements Window.Callback, KeyEvent.Callback {\n        private static TAG;\n        private static DEBUG_LIFECYCLE;\n        static RESULT_CANCELED: number;\n        static RESULT_OK: number;\n        static RESULT_FIRST_USER: number;\n        private mCallActivity;\n        private mIntent;\n        private mCalled;\n        private mResumed;\n        private mStopped;\n        private mFinished;\n        private mStartedActivity;\n        private mDestroyed;\n        private mWindow;\n        private mWindowAdded;\n        private mVisibleFromClient;\n        private mResultCode;\n        private mResultData;\n        private mMenu;\n        private mMenuPopuoHelper;\n        getIntent(): Intent;\n        setIntent(newIntent: Intent): void;\n        getApplication(): android.app.Application;\n        getWindowManager(): android.view.WindowManager;\n        getGlobalWindowManager(): android.view.WindowManager;\n        getWindow(): Window;\n        getCurrentFocus(): View;\n        protected onCreate(savedInstanceState?: Bundle): void;\n        performRestoreInstanceState(savedInstanceState: Bundle): void;\n        protected onRestoreInstanceState(savedInstanceState: Bundle): void;\n        protected onPostCreate(savedInstanceState: Bundle): void;\n        protected onStart(): void;\n        protected onRestart(): void;\n        protected onResume(): void;\n        protected onPostResume(): void;\n        protected onNewIntent(intent: Intent): void;\n        performSaveInstanceState(outState: Bundle): void;\n        protected onSaveInstanceState(outState: Bundle): void;\n        protected onPause(): void;\n        protected onUserLeaveHint(): void;\n        protected onStop(): void;\n        protected onDestroy(): void;\n        findViewById(id: string): View;\n        setContentView(view: View | HTMLElement | string, params?: ViewGroup.LayoutParams): void;\n        addContentView(view: View, params: ViewGroup.LayoutParams): void;\n        setFinishOnTouchOutside(finish: boolean): void;\n        onKeyDown(keyCode: number, event: KeyEvent): boolean;\n        onKeyLongPress(keyCode: number, event: KeyEvent): boolean;\n        onKeyUp(keyCode: number, event: KeyEvent): boolean;\n        onBackPressed(): void;\n        onTouchEvent(event: MotionEvent): boolean;\n        onGenericMotionEvent(event: MotionEvent): boolean;\n        onUserInteraction(): void;\n        onWindowAttributesChanged(params: WindowManager.LayoutParams): void;\n        onContentChanged(): void;\n        onWindowFocusChanged(hasFocus: boolean): void;\n        onAttachedToWindow(): void;\n        onDetachedFromWindow(): void;\n        hasWindowFocus(): boolean;\n        dispatchKeyEvent(event: KeyEvent): boolean;\n        dispatchTouchEvent(ev: MotionEvent): boolean;\n        dispatchGenericMotionEvent(ev: MotionEvent): boolean;\n        takeKeyEvents(_get: boolean): void;\n        private invalidateOptionsMenu();\n        protected invalidateOptionsMenuPopupHelper(menu: android.view.Menu): android.view.menu.MenuPopupHelper;\n        onCreateOptionsMenu(menu: android.view.Menu): boolean;\n        onPrepareOptionsMenu(menu: android.view.Menu): boolean;\n        onOptionsItemSelected(item: android.view.MenuItem): boolean;\n        onOptionsMenuClosed(menu: android.view.Menu): void;\n        openOptionsMenu(): void;\n        closeOptionsMenu(): void;\n        startActivityForResult(intent: Intent | string, requestCode: number, options?: Bundle): void;\n        startActivities(intents: Intent[], options?: Bundle): void;\n        startActivity(intent: Intent | string, options?: Bundle): void;\n        startActivityIfNeeded(intent: Intent, requestCode: number, options?: Bundle): boolean;\n        overrideNextTransition(enterAnimation: Animation, exitAnimation: Animation, resumeAnimation: Animation, hideAnimation: Animation): void;\n        setResult(resultCode: number, data?: Intent): void;\n        getCallingActivity(): string;\n        setVisible(visible: boolean): void;\n        makeVisible(): void;\n        isFinishing(): boolean;\n        isDestroyed(): boolean;\n        finish(): void;\n        finishActivity(requestCode: number): void;\n        protected onActivityResult(requestCode: number, resultCode: number, data: Intent): void;\n        setTitle(title: string): void;\n        getTitle(): string;\n        protected onTitleChanged(title: string, color?: number): void;\n        runOnUiThread(action: Runnable): void;\n        navigateUpTo(upIntent: Intent, upToRootIfNotFound?: boolean): boolean;\n        constructor(androidUI: androidui.AndroidUI);\n        private performCreate(icicle);\n        private performStart();\n        private performRestart();\n        private performResume();\n        private performPause();\n        private performUserLeaving();\n        private performStop();\n        private performDestroy();\n        isResumed(): boolean;\n        dispatchActivityResult(who: string, requestCode: number, resultCode: number, data: Intent): void;\n    }\n}\ndeclare module android.app {\n    import Bundle = android.os.Bundle;\n    import Context = android.content.Context;\n    import Activity = android.app.Activity;\n    class Application extends Context {\n        private mActivityLifecycleCallbacks;\n        private mWindowManager;\n        onCreate(): void;\n        getWindowManager(): android.view.WindowManager;\n        registerActivityLifecycleCallbacks(callback: Application.ActivityLifecycleCallbacks): void;\n        unregisterActivityLifecycleCallbacks(callback: Application.ActivityLifecycleCallbacks): void;\n        dispatchActivityCreated(activity: Activity, savedInstanceState: Bundle): void;\n        dispatchActivityStarted(activity: Activity): void;\n        dispatchActivityResumed(activity: Activity): void;\n        dispatchActivityPaused(activity: Activity): void;\n        dispatchActivityStopped(activity: Activity): void;\n        dispatchActivitySaveInstanceState(activity: Activity, outState: Bundle): void;\n        dispatchActivityDestroyed(activity: Activity): void;\n        private collectActivityLifecycleCallbacks();\n    }\n    module Application {\n        interface ActivityLifecycleCallbacks {\n            onActivityCreated(activity: Activity, savedInstanceState: Bundle): void;\n            onActivityStarted(activity: Activity): void;\n            onActivityResumed(activity: Activity): void;\n            onActivityPaused(activity: Activity): void;\n            onActivityStopped(activity: Activity): void;\n            onActivitySaveInstanceState(activity: Activity, outState: Bundle): void;\n            onActivityDestroyed(activity: Activity): void;\n        }\n    }\n}\ndeclare module android.view {\n    import MotionEvent = android.view.MotionEvent;\n    class VelocityTracker {\n        private static TAG;\n        private static DEBUG;\n        private static localLOGV;\n        private static NUM_PAST;\n        private static MAX_AGE_MILLISECONDS;\n        private static POINTER_POOL_CAPACITY;\n        private static sPool;\n        private static sRecycledPointerListHead;\n        private static sRecycledPointerCount;\n        private mPointerListHead;\n        private mLastTouchIndex;\n        private mGeneration;\n        private mNext;\n        static obtain(): VelocityTracker;\n        recycle(): void;\n        setNextPoolable(element: VelocityTracker): void;\n        getNextPoolable(): VelocityTracker;\n        constructor();\n        clear(): void;\n        addMovement(ev: MotionEvent): void;\n        computeCurrentVelocity(units: number, maxVelocity?: number): void;\n        getXVelocity(id?: number): number;\n        getYVelocity(id?: number): number;\n        private getPointer(id);\n        private static obtainPointer();\n        private static releasePointer(pointer);\n        private static releasePointerList(pointer);\n    }\n}\ndeclare module android.view {\n    import MotionEvent = android.view.MotionEvent;\n    class ScaleGestureDetector {\n        private static TAG;\n        private mListener;\n        private mFocusX;\n        private mFocusY;\n        private mQuickScaleEnabled;\n        private mCurrSpan;\n        private mPrevSpan;\n        private mInitialSpan;\n        private mCurrSpanX;\n        private mCurrSpanY;\n        private mPrevSpanX;\n        private mPrevSpanY;\n        private mCurrTime;\n        private mPrevTime;\n        private mInProgress;\n        private mSpanSlop;\n        private mMinSpan;\n        private mTouchUpper;\n        private mTouchLower;\n        private mTouchHistoryLastAccepted;\n        private mTouchHistoryDirection;\n        private mTouchHistoryLastAcceptedTime;\n        private mTouchMinMajor;\n        private mDoubleTapEvent;\n        private mDoubleTapMode;\n        private mHandler;\n        private static TOUCH_STABILIZE_TIME;\n        private static DOUBLE_TAP_MODE_NONE;\n        private static DOUBLE_TAP_MODE_IN_PROGRESS;\n        private static SCALE_FACTOR;\n        private mGestureDetector;\n        private mEventBeforeOrAboveStartingGestureEvent;\n        constructor(listener: ScaleGestureDetector.OnScaleGestureListener, handler?: any);\n        private addTouchHistory(ev);\n        private clearTouchHistory();\n        onTouchEvent(event: MotionEvent): boolean;\n        private inDoubleTapMode();\n        setQuickScaleEnabled(scales: boolean): void;\n        isQuickScaleEnabled(): boolean;\n        isInProgress(): boolean;\n        getFocusX(): number;\n        getFocusY(): number;\n        getCurrentSpan(): number;\n        getCurrentSpanX(): number;\n        getCurrentSpanY(): number;\n        getPreviousSpan(): number;\n        getPreviousSpanX(): number;\n        getPreviousSpanY(): number;\n        getScaleFactor(): number;\n        getTimeDelta(): number;\n        getEventTime(): number;\n    }\n    module ScaleGestureDetector {\n        interface OnScaleGestureListener {\n            onScale(detector: ScaleGestureDetector): boolean;\n            onScaleBegin(detector: ScaleGestureDetector): boolean;\n            onScaleEnd(detector: ScaleGestureDetector): void;\n        }\n        class SimpleOnScaleGestureListener implements ScaleGestureDetector.OnScaleGestureListener {\n            onScale(detector: ScaleGestureDetector): boolean;\n            onScaleBegin(detector: ScaleGestureDetector): boolean;\n            onScaleEnd(detector: ScaleGestureDetector): void;\n        }\n    }\n}\ndeclare module android.view {\n    import Handler = android.os.Handler;\n    import Message = android.os.Message;\n    import MotionEvent = android.view.MotionEvent;\n    class GestureDetector {\n        private mTouchSlopSquare;\n        private mDoubleTapTouchSlopSquare;\n        private mDoubleTapSlopSquare;\n        private mMinimumFlingVelocity;\n        private mMaximumFlingVelocity;\n        private static LONGPRESS_TIMEOUT;\n        private static TAP_TIMEOUT;\n        private static DOUBLE_TAP_TIMEOUT;\n        private static DOUBLE_TAP_MIN_TIME;\n        private static SHOW_PRESS;\n        private static LONG_PRESS;\n        private static TAP;\n        private mHandler;\n        private mListener;\n        private mDoubleTapListener;\n        private mStillDown;\n        private mDeferConfirmSingleTap;\n        private mInLongPress;\n        private mAlwaysInTapRegion;\n        private mAlwaysInBiggerTapRegion;\n        private mCurrentDownEvent;\n        private mPreviousUpEvent;\n        private mIsDoubleTapping;\n        private mLastFocusX;\n        private mLastFocusY;\n        private mDownFocusX;\n        private mDownFocusY;\n        private mIsLongpressEnabled;\n        private mVelocityTracker;\n        constructor(listener: GestureDetector.OnGestureListener, handler?: any);\n        private init();\n        setOnDoubleTapListener(onDoubleTapListener: GestureDetector.OnDoubleTapListener): void;\n        setIsLongpressEnabled(isLongpressEnabled: boolean): void;\n        isLongpressEnabled(): boolean;\n        onTouchEvent(ev: MotionEvent): boolean;\n        private cancel();\n        private cancelTaps();\n        private isConsideredDoubleTap(firstDown, firstUp, secondDown);\n        private dispatchLongPress();\n    }\n    module GestureDetector {\n        interface OnGestureListener {\n            onDown(e: MotionEvent): boolean;\n            onShowPress(e: MotionEvent): void;\n            onSingleTapUp(e: MotionEvent): boolean;\n            onScroll(e1: MotionEvent, e2: MotionEvent, distanceX: number, distanceY: number): boolean;\n            onLongPress(e: MotionEvent): void;\n            onFling(e1: MotionEvent, e2: MotionEvent, velocityX: number, velocityY: number): boolean;\n        }\n        interface OnDoubleTapListener {\n            onSingleTapConfirmed(e: MotionEvent): boolean;\n            onDoubleTap(e: MotionEvent): boolean;\n            onDoubleTapEvent(e: MotionEvent): boolean;\n        }\n        class SimpleOnGestureListener implements GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener {\n            onSingleTapUp(e: MotionEvent): boolean;\n            onLongPress(e: MotionEvent): void;\n            onScroll(e1: MotionEvent, e2: MotionEvent, distanceX: number, distanceY: number): boolean;\n            onFling(e1: MotionEvent, e2: MotionEvent, velocityX: number, velocityY: number): boolean;\n            onShowPress(e: MotionEvent): void;\n            onDown(e: MotionEvent): boolean;\n            onDoubleTap(e: MotionEvent): boolean;\n            onDoubleTapEvent(e: MotionEvent): boolean;\n            onSingleTapConfirmed(e: MotionEvent): boolean;\n        }\n        class GestureHandler extends Handler {\n            _GestureDetector_this: GestureDetector;\n            constructor(arg: GestureDetector);\n            handleMessage(msg: Message): void;\n        }\n    }\n}\ndeclare module android.widget {\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Canvas = android.graphics.Canvas;\n    import Context = android.content.Context;\n    class LinearLayout extends ViewGroup {\n        static HORIZONTAL: number;\n        static VERTICAL: number;\n        static SHOW_DIVIDER_NONE: number;\n        static SHOW_DIVIDER_BEGINNING: number;\n        static SHOW_DIVIDER_MIDDLE: number;\n        static SHOW_DIVIDER_END: number;\n        private mBaselineAligned;\n        private mBaselineAlignedChildIndex;\n        private mBaselineChildTop;\n        private mOrientation;\n        private mGravity;\n        private mTotalLength;\n        private mWeightSum;\n        private mUseLargestChild;\n        private mMaxAscent;\n        private mMaxDescent;\n        private static VERTICAL_GRAVITY_COUNT;\n        private static INDEX_CENTER_VERTICAL;\n        private static INDEX_TOP;\n        private static INDEX_BOTTOM;\n        private static INDEX_FILL;\n        private mDivider;\n        private mDividerWidth;\n        private mDividerHeight;\n        private mShowDividers;\n        private mDividerPadding;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        setShowDividers(showDividers: number): void;\n        shouldDelayChildPressedState(): boolean;\n        getShowDividers(): number;\n        getDividerDrawable(): Drawable;\n        setDividerDrawable(divider: Drawable): void;\n        setDividerPadding(padding: number): void;\n        getDividerPadding(): number;\n        getDividerWidth(): number;\n        protected onDraw(canvas: Canvas): void;\n        drawDividersVertical(canvas: Canvas): void;\n        drawDividersHorizontal(canvas: Canvas): void;\n        drawHorizontalDivider(canvas: Canvas, top: number): void;\n        drawVerticalDivider(canvas: Canvas, left: number): void;\n        isBaselineAligned(): boolean;\n        setBaselineAligned(baselineAligned: boolean): void;\n        isMeasureWithLargestChildEnabled(): boolean;\n        setMeasureWithLargestChildEnabled(enabled: boolean): void;\n        getBaseline(): number;\n        getBaselineAlignedChildIndex(): number;\n        setBaselineAlignedChildIndex(i: number): void;\n        getVirtualChildAt(index: number): View;\n        getVirtualChildCount(): number;\n        getWeightSum(): number;\n        setWeightSum(weightSum: number): void;\n        protected onMeasure(widthMeasureSpec: any, heightMeasureSpec: any): void;\n        hasDividerBeforeChildAt(childIndex: number): boolean;\n        measureVertical(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        forceUniformWidth(count: number, heightMeasureSpec: number): void;\n        measureHorizontal(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        private forceUniformHeight(count, widthMeasureSpec);\n        getChildrenSkipCount(child: View, index: number): number;\n        measureNullChild(childIndex: number): number;\n        measureChildBeforeLayout(child: View, childIndex: number, widthMeasureSpec: number, totalWidth: number, heightMeasureSpec: number, totalHeight: number): void;\n        getLocationOffset(child: View): number;\n        getNextLocationOffset(child: View): number;\n        protected onLayout(changed: boolean, l: number, t: number, r: number, b: number): void;\n        layoutVertical(left: number, top: number, right: number, bottom: number): void;\n        layoutHorizontal(left: number, top: number, right: number, bottom: number): void;\n        private setChildFrame(child, left, top, width, height);\n        setOrientation(orientation: number): void;\n        getOrientation(): number;\n        setGravity(gravity: number): void;\n        setHorizontalGravity(horizontalGravity: number): void;\n        setVerticalGravity(verticalGravity: number): void;\n        generateLayoutParamsFromAttr(attrs: HTMLElement): android.view.ViewGroup.LayoutParams;\n        protected generateDefaultLayoutParams(): android.view.ViewGroup.LayoutParams;\n        protected generateLayoutParams(p: android.view.ViewGroup.LayoutParams): android.view.ViewGroup.LayoutParams;\n        protected checkLayoutParams(p: android.view.ViewGroup.LayoutParams): boolean;\n    }\n    module LinearLayout {\n        class LayoutParams extends android.view.ViewGroup.MarginLayoutParams {\n            weight: number;\n            gravity: number;\n            constructor(context: Context, attrs: HTMLElement);\n            constructor(width: number, height: number);\n            constructor(source: ViewGroup.LayoutParams);\n            constructor(width: number, height: number, weight?: number);\n            protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        }\n    }\n}\ndeclare module android.util {\n    class MathUtils {\n        private static DEG_TO_RAD;\n        private static RAD_TO_DEG;\n        constructor();\n        static abs(v: number): number;\n        static constrain(amount: number, low: number, high: number): number;\n        static log(a: number): number;\n        static exp(a: number): number;\n        static pow(a: number, b: number): number;\n        static max(a: number, b: number, c?: number): number;\n        static min(a: number, b: number, c?: number): number;\n        static dist(x1: number, y1: number, x2: number, y2: number): number;\n        static dist3(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): number;\n        static mag(a: number, b: number, c?: number): number;\n        static sq(v: number): number;\n        static radians(degrees: number): number;\n        static degrees(radians: number): number;\n        static acos(value: number): number;\n        static asin(value: number): number;\n        static atan(value: number): number;\n        static atan2(a: number, b: number): number;\n        static tan(angle: number): number;\n        static lerp(start: number, stop: number, amount: number): number;\n        static norm(start: number, stop: number, value: number): number;\n        static map(minStart: number, minStop: number, maxStart: number, maxStop: number, value: number): number;\n        static random(howbig: number): number;\n        static random(howsmall: number, howbig: number): number;\n    }\n}\ndeclare module android.util {\n    class SparseBooleanArray extends SparseArray<boolean> {\n    }\n}\ndeclare module android.view {\n    class SoundEffectConstants {\n        static CLICK: number;\n        static NAVIGATION_LEFT: number;\n        static NAVIGATION_UP: number;\n        static NAVIGATION_RIGHT: number;\n        static NAVIGATION_DOWN: number;\n        static getContantForFocusDirection(direction: number): number;\n    }\n}\ndeclare module android.os {\n    class Trace {\n        private static TAG;\n        static TRACE_TAG_NEVER: number;\n        static TRACE_TAG_ALWAYS: number;\n        static TRACE_TAG_GRAPHICS: number;\n        static TRACE_TAG_INPUT: number;\n        static TRACE_TAG_VIEW: number;\n        static TRACE_TAG_WEBVIEW: number;\n        static TRACE_TAG_WINDOW_MANAGER: number;\n        static TRACE_TAG_ACTIVITY_MANAGER: number;\n        static TRACE_TAG_SYNC_MANAGER: number;\n        static TRACE_TAG_AUDIO: number;\n        static TRACE_TAG_VIDEO: number;\n        static TRACE_TAG_CAMERA: number;\n        static TRACE_TAG_HAL: number;\n        static TRACE_TAG_APP: number;\n        static TRACE_TAG_RESOURCES: number;\n        static TRACE_TAG_DALVIK: number;\n        static TRACE_TAG_RS: number;\n        private static TRACE_TAG_NOT_READY;\n        private static MAX_SECTION_NAME_LEN;\n        private static sEnabledTags;\n        private static nativeGetEnabledTags();\n        private static nativeTraceCounter(tag, name, value);\n        private static nativeTraceBegin(tag, name);\n        private static nativeTraceEnd(tag);\n        private static nativeAsyncTraceBegin(tag, name, cookie);\n        private static nativeAsyncTraceEnd(tag, name, cookie);\n        private static nativeSetAppTracingAllowed(allowed);\n        private static nativeSetTracingEnabled(allowed);\n        private static cacheEnabledTags();\n        static isTagEnabled(traceTag: number): boolean;\n        static traceCounter(traceTag: number, counterName: string, counterValue: number): void;\n        static setAppTracingAllowed(allowed: boolean): void;\n        static setTracingEnabled(enabled: boolean): void;\n        static traceBegin(traceTag: number, methodName: string): void;\n        static traceEnd(traceTag: number): void;\n        static asyncTraceBegin(traceTag: number, methodName: string, cookie: number): void;\n        static asyncTraceEnd(traceTag: number, methodName: string, cookie: number): void;\n        static beginSection(sectionName: string): void;\n        static endSection(): void;\n    }\n}\ndeclare module android.text {\n    class InputType {\n        static TYPE_MASK_CLASS: number;\n        static TYPE_MASK_VARIATION: number;\n        static TYPE_MASK_FLAGS: number;\n        static TYPE_NULL: number;\n        static TYPE_CLASS_TEXT: number;\n        static TYPE_TEXT_FLAG_CAP_CHARACTERS: number;\n        static TYPE_TEXT_FLAG_CAP_WORDS: number;\n        static TYPE_TEXT_FLAG_CAP_SENTENCES: number;\n        static TYPE_TEXT_FLAG_AUTO_CORRECT: number;\n        static TYPE_TEXT_FLAG_AUTO_COMPLETE: number;\n        static TYPE_TEXT_FLAG_MULTI_LINE: number;\n        static TYPE_TEXT_FLAG_IME_MULTI_LINE: number;\n        static TYPE_TEXT_FLAG_NO_SUGGESTIONS: number;\n        static TYPE_TEXT_VARIATION_NORMAL: number;\n        static TYPE_TEXT_VARIATION_URI: number;\n        static TYPE_TEXT_VARIATION_EMAIL_ADDRESS: number;\n        static TYPE_TEXT_VARIATION_EMAIL_SUBJECT: number;\n        static TYPE_TEXT_VARIATION_SHORT_MESSAGE: number;\n        static TYPE_TEXT_VARIATION_LONG_MESSAGE: number;\n        static TYPE_TEXT_VARIATION_PERSON_NAME: number;\n        static TYPE_TEXT_VARIATION_POSTAL_ADDRESS: number;\n        static TYPE_TEXT_VARIATION_PASSWORD: number;\n        static TYPE_TEXT_VARIATION_VISIBLE_PASSWORD: number;\n        static TYPE_TEXT_VARIATION_WEB_EDIT_TEXT: number;\n        static TYPE_TEXT_VARIATION_FILTER: number;\n        static TYPE_TEXT_VARIATION_PHONETIC: number;\n        static TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS: number;\n        static TYPE_TEXT_VARIATION_WEB_PASSWORD: number;\n        static TYPE_CLASS_NUMBER: number;\n        static TYPE_NUMBER_FLAG_SIGNED: number;\n        static TYPE_NUMBER_FLAG_DECIMAL: number;\n        static TYPE_NUMBER_VARIATION_NORMAL: number;\n        static TYPE_NUMBER_VARIATION_PASSWORD: number;\n        static TYPE_CLASS_PHONE: number;\n        static TYPE_CLASS_DATETIME: number;\n        static TYPE_DATETIME_VARIATION_NORMAL: number;\n        static TYPE_DATETIME_VARIATION_DATE: number;\n        static TYPE_DATETIME_VARIATION_TIME: number;\n    }\n    module InputType {\n        class LimitCode {\n            static TYPE_CLASS_NUMBER: number[];\n            static TYPE_CLASS_PHONE: number[];\n        }\n    }\n}\ndeclare module android.util {\n    class LongSparseArray<T> extends SparseArray<T> {\n    }\n}\ndeclare module android.view {\n    class HapticFeedbackConstants {\n        static LONG_PRESS: number;\n        static VIRTUAL_KEY: number;\n        static KEYBOARD_TAP: number;\n        static SAFE_MODE_DISABLED: number;\n        static SAFE_MODE_ENABLED: number;\n        static FLAG_IGNORE_VIEW_SETTING: number;\n        static FLAG_IGNORE_GLOBAL_SETTING: number;\n    }\n}\ndeclare module android.database {\n    class DataSetObserver {\n        onChanged(): void;\n        onInvalidated(): void;\n    }\n}\ndeclare module android.widget {\n    import DataSetObserver = android.database.DataSetObserver;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    abstract class AdapterView<T extends Adapter> extends ViewGroup {\n        static ITEM_VIEW_TYPE_IGNORE: number;\n        static ITEM_VIEW_TYPE_HEADER_OR_FOOTER: number;\n        mFirstPosition: number;\n        mSpecificTop: number;\n        mSyncPosition: number;\n        mSyncRowId: number;\n        mSyncHeight: number;\n        mNeedSync: boolean;\n        mSyncMode: number;\n        private mLayoutHeight;\n        static SYNC_SELECTED_POSITION: number;\n        static SYNC_FIRST_POSITION: number;\n        static SYNC_MAX_DURATION_MILLIS: number;\n        mInLayout: boolean;\n        private mOnItemSelectedListener;\n        private mOnItemClickListener;\n        mOnItemLongClickListener: AdapterView.OnItemLongClickListener;\n        mDataChanged: boolean;\n        mNextSelectedPosition: number;\n        mNextSelectedRowId: number;\n        mSelectedPosition: number;\n        mSelectedRowId: number;\n        private mEmptyView;\n        mItemCount: number;\n        mOldItemCount: number;\n        static INVALID_POSITION: number;\n        static INVALID_ROW_ID: number;\n        mOldSelectedPosition: number;\n        mOldSelectedRowId: number;\n        private mDesiredFocusableState;\n        private mDesiredFocusableInTouchModeState;\n        private mSelectionNotifier;\n        mBlockLayoutRequests: boolean;\n        setOnItemClickListener(listener: AdapterView.OnItemClickListener): void;\n        getOnItemClickListener(): AdapterView.OnItemClickListener;\n        performItemClick(view: View, position: number, id: number): boolean;\n        setOnItemLongClickListener(listener: AdapterView.OnItemLongClickListener): void;\n        getOnItemLongClickListener(): AdapterView.OnItemLongClickListener;\n        setOnItemSelectedListener(listener: AdapterView.OnItemSelectedListener): void;\n        getOnItemSelectedListener(): AdapterView.OnItemSelectedListener;\n        abstract getAdapter(): T;\n        abstract setAdapter(adapter: T): void;\n        addView(...args: any[]): void;\n        removeView(child: View): void;\n        removeViewAt(index: number): void;\n        removeAllViews(): void;\n        protected onLayout(changed: boolean, left: number, top: number, right: number, bottom: number): void;\n        getSelectedItemPosition(): number;\n        getSelectedItemId(): number;\n        abstract getSelectedView(): View;\n        getSelectedItem(): any;\n        getCount(): number;\n        getPositionForView(view: View): number;\n        getFirstVisiblePosition(): number;\n        getLastVisiblePosition(): number;\n        abstract setSelection(position: number): void;\n        setEmptyView(emptyView: View): void;\n        getEmptyView(): View;\n        isInFilterMode(): boolean;\n        setFocusable(focusable: boolean): void;\n        setFocusableInTouchMode(focusable: boolean): void;\n        checkFocus(): void;\n        private updateEmptyStatus(empty);\n        getItemAtPosition(position: number): any;\n        getItemIdAtPosition(position: number): number;\n        setOnClickListener(l: View.OnClickListener): void;\n        protected onDetachedFromWindow(): void;\n        private selectionChanged();\n        private fireOnSelected();\n        private performAccessibilityActionsOnSelected();\n        private isScrollableForAccessibility();\n        canAnimate(): boolean;\n        handleDataChanged(): void;\n        checkSelectionChanged(): void;\n        findSyncPosition(): number;\n        lookForSelectablePosition(position: number, lookDown: boolean): number;\n        setSelectedPositionInt(position: number): void;\n        setNextSelectedPositionInt(position: number): void;\n        rememberSyncState(): void;\n    }\n    module AdapterView {\n        interface OnItemClickListener {\n            onItemClick(parent: AdapterView<any>, view: View, position: number, id: number): void;\n        }\n        interface OnItemLongClickListener {\n            onItemLongClick(parent: AdapterView<any>, view: View, position: number, id: number): boolean;\n        }\n        interface OnItemSelectedListener {\n            onItemSelected(parent: AdapterView<any>, view: View, position: number, id: number): void;\n            onNothingSelected(parent: AdapterView<any>): void;\n        }\n        class AdapterDataSetObserver extends DataSetObserver {\n            AdapterView_this: AdapterView<any>;\n            constructor(AdapterView_this: AdapterView<any>);\n            onChanged(): void;\n            onInvalidated(): void;\n            clearSavedState(): void;\n        }\n    }\n}\ndeclare module android.widget {\n    import DataSetObserver = android.database.DataSetObserver;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    interface Adapter {\n        registerDataSetObserver(observer: DataSetObserver): void;\n        unregisterDataSetObserver(observer: DataSetObserver): void;\n        getCount(): number;\n        getItem(position: number): any;\n        getItemId(position: number): number;\n        hasStableIds(): boolean;\n        getView(position: number, convertView: View, parent: ViewGroup): View;\n        getItemViewType(position: number): number;\n        getViewTypeCount(): number;\n        isEmpty(): boolean;\n    }\n    module Adapter {\n        var IGNORE_ITEM_VIEW_TYPE: number;\n        var NO_SELECTION: number;\n    }\n}\ndeclare module android.text {\n    import Canvas = android.graphics.Canvas;\n    import Paint = android.graphics.Paint;\n    import Path = android.graphics.Path;\n    import Layout = android.text.Layout;\n    import TextDirectionHeuristic = android.text.TextDirectionHeuristic;\n    import TextPaint = android.text.TextPaint;\n    import TextUtils = android.text.TextUtils;\n    class BoringLayout extends Layout implements TextUtils.EllipsizeCallback {\n        static make(source: String, paint: TextPaint, outerwidth: number, align: Layout.Alignment, spacingmult: number, spacingadd: number, metrics: BoringLayout.Metrics, includepad: boolean, ellipsize?: TextUtils.TruncateAt, ellipsizedWidth?: number): BoringLayout;\n        replaceOrMake(source: String, paint: TextPaint, outerwidth: number, align: Layout.Alignment, spacingmult: number, spacingadd: number, metrics: BoringLayout.Metrics, includepad: boolean, ellipsize?: TextUtils.TruncateAt, ellipsizedWidth?: number): BoringLayout;\n        constructor(source: String, paint: TextPaint, outerwidth: number, align: Layout.Alignment, spacingmult: number, spacingadd: number, metrics: BoringLayout.Metrics, includepad: boolean, ellipsize?: TextUtils.TruncateAt, ellipsizedWidth?: number);\n        init(source: String, paint: TextPaint, outerwidth: number, align: Layout.Alignment, spacingmult: number, spacingadd: number, metrics: BoringLayout.Metrics, includepad: boolean, trustWidth: boolean): void;\n        static isBoring(text: String, paint: TextPaint, textDir?: TextDirectionHeuristic, metrics?: BoringLayout.Metrics): BoringLayout.Metrics;\n        getHeight(): number;\n        getLineCount(): number;\n        getLineTop(line: number): number;\n        getLineDescent(line: number): number;\n        getLineStart(line: number): number;\n        getParagraphDirection(line: number): number;\n        getLineContainsTab(line: number): boolean;\n        getLineMax(line: number): number;\n        getLineDirections(line: number): Layout.Directions;\n        getTopPadding(): number;\n        getBottomPadding(): number;\n        getEllipsisCount(line: number): number;\n        getEllipsisStart(line: number): number;\n        getEllipsizedWidth(): number;\n        draw(c: Canvas, highlight: Path, highlightpaint: Paint, cursorOffset: number): void;\n        ellipsized(start: number, end: number): void;\n        private static FIRST_RIGHT_TO_LEFT;\n        private mDirect;\n        mBottom: number;\n        mDesc: number;\n        private mTopPadding;\n        private mBottomPadding;\n        private mMax;\n        private mEllipsizedWidth;\n        private mEllipsizedStart;\n        private mEllipsizedCount;\n        private static sTemp;\n    }\n    module BoringLayout {\n        class Metrics extends Paint.FontMetricsInt {\n            width: number;\n            toString(): string;\n        }\n    }\n}\ndeclare module android.text {\n    class PackedIntVector {\n        private mColumns;\n        private mRows;\n        private mRowGapStart;\n        private mRowGapLength;\n        private mValues;\n        private mValueGap;\n        constructor(columns: number);\n        getValue(row: number, column: number): number;\n        setValue(row: number, column: number, value: number): void;\n        private setValueInternal(row, column, value);\n        adjustValuesBelow(startRow: number, column: number, delta: number): void;\n        insertAt(row: number, values: number[]): void;\n        deleteAt(row: number, count: number): void;\n        size(): number;\n        width(): number;\n        private growBuffer();\n        private moveValueGapTo(column, where);\n        private moveRowGapTo(where);\n    }\n}\ndeclare module android.text {\n    class PackedObjectVector<E> {\n        private mColumns;\n        private mRows;\n        private mRowGapStart;\n        private mRowGapLength;\n        private mValues;\n        constructor(columns: number);\n        getValue(row: number, column: number): E;\n        setValue(row: number, column: number, value: E): void;\n        insertAt(row: number, values: E[]): void;\n        deleteAt(row: number, count: number): void;\n        size(): number;\n        width(): number;\n        private growBuffer();\n        private moveRowGapTo(where);\n        dump(): void;\n    }\n}\ndeclare module android.text {\n    import Spanned = android.text.Spanned;\n    interface Spannable extends Spanned {\n        setSpan(what: any, start: number, end: number, flags: number): void;\n        removeSpan(what: any): void;\n    }\n    module Spannable {\n        function isImpl(obj: any): boolean;\n        class Factory {\n            private static sInstance;\n            static getInstance(): Spannable.Factory;\n            newSpannable(source: String): Spannable;\n        }\n    }\n}\ndeclare module android.text.style {\n    import Paint = android.graphics.Paint;\n    import TextPaint = android.text.TextPaint;\n    import ParagraphStyle = android.text.style.ParagraphStyle;\n    import WrapTogetherSpan = android.text.style.WrapTogetherSpan;\n    interface LineHeightSpan extends ParagraphStyle, WrapTogetherSpan {\n        chooseHeight(text: String, start: number, end: number, spanstartv: number, v: number, fm: Paint.FontMetricsInt): void;\n    }\n    module LineHeightSpan {\n        var type: symbol;\n        interface WithDensity extends LineHeightSpan {\n            chooseHeight(text: String, start: number, end: number, spanstartv: number, v: number, fm: Paint.FontMetricsInt, paint?: TextPaint): void;\n        }\n    }\n}\ndeclare module android.text {\n    import Layout = android.text.Layout;\n    import TextDirectionHeuristic = android.text.TextDirectionHeuristic;\n    import TextPaint = android.text.TextPaint;\n    import TextUtils = android.text.TextUtils;\n    class StaticLayout extends Layout {\n        static TAG: string;\n        constructor(source: String, bufstart: number, bufend: number, paint: TextPaint, outerwidth: number, align: Layout.Alignment, textDir: TextDirectionHeuristic, spacingmult: number, spacingadd: number, includepad: boolean, ellipsize?: TextUtils.TruncateAt, ellipsizedWidth?: number, maxLines?: number);\n        generate(source: String, bufStart: number, bufEnd: number, paint: TextPaint, outerWidth: number, textDir: TextDirectionHeuristic, spacingmult: number, spacingadd: number, includepad: boolean, trackpad: boolean, ellipsizedWidth: number, ellipsize: TextUtils.TruncateAt): void;\n        private static isIdeographic(c, includeNonStarters);\n        private out(text, start, end, above, below, top, bottom, v, spacingmult, spacingadd, chooseHt, chooseHtv, fm, hasTabOrEmoji, needMultiply, chdirs, dir, easy, bufEnd, includePad, trackPad, chs, widths, widthStart, ellipsize, ellipsisWidth, textWidth, paint, moreChars);\n        private calculateEllipsis(lineStart, lineEnd, widths, widthStart, avail, where, line, textWidth, paint, forceEllipsis);\n        getLineForVertical(vertical: number): number;\n        getLineCount(): number;\n        getLineTop(line: number): number;\n        getLineDescent(line: number): number;\n        getLineStart(line: number): number;\n        getParagraphDirection(line: number): number;\n        getLineContainsTab(line: number): boolean;\n        getLineDirections(line: number): Layout.Directions;\n        getTopPadding(): number;\n        getBottomPadding(): number;\n        getEllipsisCount(line: number): number;\n        getEllipsisStart(line: number): number;\n        getEllipsizedWidth(): number;\n        prepare(): void;\n        finish(): void;\n        private mLineCount;\n        private mTopPadding;\n        private mBottomPadding;\n        private mColumns;\n        private mEllipsizedWidth;\n        private static COLUMNS_NORMAL;\n        private static COLUMNS_ELLIPSIZE;\n        private static START;\n        private static DIR;\n        private static TAB;\n        private static TOP;\n        private static DESCENT;\n        private static ELLIPSIS_START;\n        private static ELLIPSIS_COUNT;\n        private mLines;\n        private mLineDirections;\n        private mMaximumVisibleLineCount;\n        private static START_MASK;\n        private static DIR_SHIFT;\n        private static TAB_MASK;\n        private static CHAR_FIRST_CJK;\n        private static CHAR_NEW_LINE;\n        private static CHAR_TAB;\n        private static CHAR_SPACE;\n        private static CHAR_SLASH;\n        private static CHAR_HYPHEN;\n        private static CHAR_ZWSP;\n        private static EXTRA_ROUNDING;\n        private static CHAR_FIRST_HIGH_SURROGATE;\n        private static CHAR_LAST_LOW_SURROGATE;\n        private mMeasured;\n        private mFontMetricsInt;\n    }\n}\ndeclare module android.text {\n    import Layout = android.text.Layout;\n    import TextDirectionHeuristic = android.text.TextDirectionHeuristic;\n    import TextPaint = android.text.TextPaint;\n    import TextUtils = android.text.TextUtils;\n    class DynamicLayout extends Layout {\n        private static PRIORITY;\n        private static BLOCK_MINIMUM_CHARACTER_LENGTH;\n        constructor(base: String, display: String, paint: TextPaint, width: number, align: Layout.Alignment, textDir: TextDirectionHeuristic, spacingmult: number, spacingadd: number, includepad: boolean, ellipsize?: TextUtils.TruncateAt, ellipsizedWidth?: number);\n        private reflow(s, where, before, after);\n        private createBlocks();\n        private addBlockAtOffset(offset);\n        updateBlocks(startLine: number, endLine: number, newLineCount: number): void;\n        setBlocksDataForTest(blockEndLines: number[], blockIndices: number[], numberOfBlocks: number): void;\n        getBlockEndLines(): number[];\n        getBlockIndices(): number[];\n        getNumberOfBlocks(): number;\n        getIndexFirstChangedBlock(): number;\n        setIndexFirstChangedBlock(i: number): void;\n        getLineCount(): number;\n        getLineTop(line: number): number;\n        getLineDescent(line: number): number;\n        getLineStart(line: number): number;\n        getLineContainsTab(line: number): boolean;\n        getParagraphDirection(line: number): number;\n        getLineDirections(line: number): Layout.Directions;\n        getTopPadding(): number;\n        getBottomPadding(): number;\n        getEllipsizedWidth(): number;\n        getEllipsisStart(line: number): number;\n        getEllipsisCount(line: number): number;\n        private mBase;\n        private mDisplay;\n        private mWatcher;\n        private mIncludePad;\n        private mEllipsize;\n        private mEllipsizedWidth;\n        private mEllipsizeAt;\n        private mInts;\n        private mObjects;\n        static INVALID_BLOCK_INDEX: number;\n        private mBlockEndLines;\n        private mBlockIndices;\n        private mNumberOfBlocks;\n        private mIndexFirstChangedBlock;\n        private mTopPadding;\n        private mBottomPadding;\n        private static sStaticLayout;\n        private static sLock;\n        private static START;\n        private static DIR;\n        private static TAB;\n        private static TOP;\n        private static DESCENT;\n        private static COLUMNS_NORMAL;\n        private static ELLIPSIS_START;\n        private static ELLIPSIS_COUNT;\n        private static COLUMNS_ELLIPSIZE;\n        private static START_MASK;\n        private static DIR_SHIFT;\n        private static TAB_MASK;\n        private static ELLIPSIS_UNDEFINED;\n    }\n    module DynamicLayout {\n    }\n}\ndeclare module android.text {\n    import Spannable = android.text.Spannable;\n    interface SpanWatcher {\n        onSpanAdded(text: Spannable, what: any, start: number, end: number): void;\n        onSpanRemoved(text: Spannable, what: any, start: number, end: number): void;\n        onSpanChanged(text: Spannable, what: any, ostart: number, oend: number, nstart: number, nend: number): void;\n    }\n}\ndeclare module android.text.method {\n    import Rect = android.graphics.Rect;\n    import View = android.view.View;\n    interface TransformationMethod {\n        getTransformation(source: String, view: View): String;\n        onFocusChanged(view: View, sourceText: String, focused: boolean, direction: number, previouslyFocusedRect: Rect): void;\n    }\n    module TransformationMethod {\n        function isImpl(obj: any): boolean;\n    }\n}\ndeclare module android.text.method {\n    import TransformationMethod = android.text.method.TransformationMethod;\n    interface TransformationMethod2 extends TransformationMethod {\n        setLengthChangesAllowed(allowLengthChanges: boolean): void;\n    }\n    module TransformationMethod2 {\n        function isImpl(obj: any): boolean;\n    }\n}\ndeclare module android.text.method {\n    import Rect = android.graphics.Rect;\n    import View = android.view.View;\n    import TransformationMethod2 = android.text.method.TransformationMethod2;\n    class AllCapsTransformationMethod implements TransformationMethod2 {\n        private static TAG;\n        private mEnabled;\n        constructor(context?: any);\n        getTransformation(source: String, view: View): String;\n        onFocusChanged(view: View, sourceText: String, focused: boolean, direction: number, previouslyFocusedRect: Rect): void;\n        setLengthChangesAllowed(allowLengthChanges: boolean): void;\n    }\n}\ndeclare module android.text.method {\n    import TextView = android.widget.TextView;\n    import KeyEvent = android.view.KeyEvent;\n    import MotionEvent = android.view.MotionEvent;\n    import Spannable = android.text.Spannable;\n    interface MovementMethod {\n        initialize(widget: TextView, text: Spannable): void;\n        onKeyDown(widget: TextView, text: Spannable, keyCode: number, event: KeyEvent): boolean;\n        onKeyUp(widget: TextView, text: Spannable, keyCode: number, event: KeyEvent): boolean;\n        onKeyOther(view: TextView, text: Spannable, event: KeyEvent): boolean;\n        onTakeFocus(widget: TextView, text: Spannable, direction: number): void;\n        onTrackballEvent(widget: TextView, text: Spannable, event: MotionEvent): boolean;\n        onTouchEvent(widget: TextView, text: Spannable, event: MotionEvent): boolean;\n        onGenericMotionEvent(widget: TextView, text: Spannable, event: MotionEvent): boolean;\n        canSelectArbitrarily(): boolean;\n    }\n}\ndeclare module android.text.method {\n    import Rect = android.graphics.Rect;\n    import View = android.view.View;\n    import TransformationMethod = android.text.method.TransformationMethod;\n    abstract class ReplacementTransformationMethod implements TransformationMethod {\n        protected abstract getOriginal(): string[];\n        protected abstract getReplacement(): string[];\n        getTransformation(source: String, v: View): String;\n        onFocusChanged(view: View, sourceText: String, focused: boolean, direction: number, previouslyFocusedRect: Rect): void;\n    }\n    module ReplacementTransformationMethod {\n        class ReplacementCharSequence extends String {\n            private mOriginal;\n            private mReplacement;\n            constructor(source: String, original: string[], replacement: string[]);\n            charAt(i: number): string;\n            toString(): string;\n            substr(from: number, length: number): string;\n            substring(start: number, end: number): string;\n            startReplace(start: number, end: number): string;\n            private mSource;\n        }\n    }\n}\ndeclare module android.text.method {\n    import ReplacementTransformationMethod = android.text.method.ReplacementTransformationMethod;\n    class SingleLineTransformationMethod extends ReplacementTransformationMethod {\n        private static ORIGINAL;\n        private static REPLACEMENT;\n        protected getOriginal(): string[];\n        protected getReplacement(): string[];\n        static getInstance(): SingleLineTransformationMethod;\n        private static sInstance;\n    }\n}\ndeclare module androidui.util {\n    class NumberChecker {\n        static warnNotNumber(...n: number[]): boolean;\n        static assetNotNumber(...ns: number[]): void;\n        static checkIsNumber(...ns: number[]): boolean;\n    }\n}\ndeclare module android.widget {\n    import Interpolator = android.view.animation.Interpolator;\n    class OverScroller {\n        private mMode;\n        private mScrollerX;\n        private mScrollerY;\n        private mInterpolator;\n        private mFlywheel;\n        static DEFAULT_DURATION: number;\n        static SCROLL_MODE: number;\n        static FLING_MODE: number;\n        constructor(interpolator?: Interpolator, flywheel?: boolean);\n        setInterpolator(interpolator: Interpolator): void;\n        setFriction(friction: number): void;\n        isFinished(): boolean;\n        forceFinished(finished: boolean): void;\n        getCurrX(): number;\n        getCurrY(): number;\n        getCurrVelocity(): number;\n        getStartX(): number;\n        getStartY(): number;\n        getFinalX(): number;\n        getFinalY(): number;\n        getDuration(): number;\n        computeScrollOffset(): boolean;\n        startScroll(startX: number, startY: number, dx: number, dy: number, duration?: number): void;\n        springBack(startX: number, startY: number, minX: number, maxX: number, minY: number, maxY: number): boolean;\n        fling(startX: number, startY: number, velocityX: number, velocityY: number, minX: number, maxX: number, minY: number, maxY: number, overX?: number, overY?: number): void;\n        notifyHorizontalEdgeReached(startX: number, finalX: number, overX: number): void;\n        notifyVerticalEdgeReached(startY: number, finalY: number, overY: number): void;\n        isOverScrolled(): boolean;\n        abortAnimation(): void;\n        timePassed(): number;\n        isScrollingInDirection(xvel: number, yvel: number): boolean;\n    }\n}\ndeclare module android.widget {\n    import ColorStateList = android.content.res.ColorStateList;\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Handler = android.os.Handler;\n    import Message = android.os.Message;\n    import BoringLayout = android.text.BoringLayout;\n    import Layout = android.text.Layout;\n    import SpanWatcher = android.text.SpanWatcher;\n    import Spannable = android.text.Spannable;\n    import Spanned = android.text.Spanned;\n    import TextDirectionHeuristic = android.text.TextDirectionHeuristic;\n    import TextPaint = android.text.TextPaint;\n    import TextUtils = android.text.TextUtils;\n    import TextWatcher = android.text.TextWatcher;\n    import MovementMethod = android.text.method.MovementMethod;\n    import TransformationMethod = android.text.method.TransformationMethod;\n    import KeyEvent = android.view.KeyEvent;\n    import MotionEvent = android.view.MotionEvent;\n    import View = android.view.View;\n    import ViewTreeObserver = android.view.ViewTreeObserver;\n    import OverScroller = android.widget.OverScroller;\n    class TextView extends View implements ViewTreeObserver.OnPreDrawListener {\n        static LOG_TAG: string;\n        static DEBUG_EXTRACT: boolean;\n        private static SANS;\n        private static SERIF;\n        private static MONOSPACE;\n        private static SIGNED;\n        private static DECIMAL;\n        private static MARQUEE_FADE_NORMAL;\n        private static MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS;\n        private static MARQUEE_FADE_SWITCH_SHOW_FADE;\n        private static LINES;\n        private static EMS;\n        private static PIXELS;\n        private static TEMP_RECTF;\n        private static VERY_WIDE;\n        private static ANIMATED_SCROLL_GAP;\n        private static NO_FILTERS;\n        private static CHANGE_WATCHER_PRIORITY;\n        private static MULTILINE_STATE_SET;\n        static LAST_CUT_OR_COPY_TIME: number;\n        private mTextColor;\n        private mHintTextColor;\n        private mLinkTextColor;\n        private mCurTextColor;\n        private mCurHintTextColor;\n        private mFreezesText;\n        private mTemporaryDetach;\n        private mDispatchTemporaryDetach;\n        private mSpannableFactory;\n        private mShadowRadius;\n        private mShadowDx;\n        private mShadowDy;\n        private mPreDrawRegistered;\n        private mPreventDefaultMovement;\n        private mEllipsize;\n        mDrawables: TextView.Drawables;\n        private mMarquee;\n        private mRestartMarquee;\n        private mMarqueeRepeatLimit;\n        private mLastLayoutDirection;\n        private mMarqueeFadeMode;\n        private mSavedMarqueeModeLayout;\n        private mText;\n        private mTransformed;\n        private mBufferType;\n        private mHint;\n        private mHintLayout;\n        private mMovement;\n        private mTransformation;\n        private mAllowTransformationLengthChange;\n        private mChangeWatcher;\n        private mListeners;\n        private mTextPaint;\n        private mUserSetTextScaleX;\n        private mLayout;\n        private mGravity;\n        private mHorizontallyScrolling;\n        private mAutoLinkMask;\n        private mLinksClickable;\n        private mSpacingMult;\n        private mSpacingAdd;\n        private mMaximum;\n        private mMaxMode;\n        private mMinimum;\n        private mMinMode;\n        private mOldMaximum;\n        private mOldMaxMode;\n        private mMaxWidthValue;\n        private mMaxWidthMode;\n        private mMinWidthValue;\n        private mMinWidthMode;\n        private mSingleLine;\n        private mDesiredHeightAtMeasure;\n        private mIncludePad;\n        private mDeferScroll;\n        private mTempRect;\n        private mLastScroll;\n        private mScroller;\n        private mBoring;\n        private mHintBoring;\n        private mSavedLayout;\n        private mSavedHintLayout;\n        private mTextDir;\n        private mFilters;\n        mHighlightColor: number;\n        private mHighlightPath;\n        private mHighlightPaint;\n        private mHighlightPathBogus;\n        mCursorDrawableRes: number;\n        mTextSelectHandleLeftRes: number;\n        mTextSelectHandleRightRes: number;\n        mTextSelectHandleRes: number;\n        mTextEditSuggestionItemLayout: number;\n        private mEditor;\n        protected mSkipDrawText: boolean;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        private setTypefaceFromAttrs(familyName, typefaceIndex, styleIndex);\n        private setRelativeDrawablesIfNeeded(start, end);\n        setEnabled(enabled: boolean): void;\n        setTypeface(tf: any, style: number): void;\n        protected getDefaultEditable(): boolean;\n        protected getDefaultMovementMethod(): MovementMethod;\n        getText(): String;\n        length(): number;\n        getEditableText(): any;\n        getLineHeight(): number;\n        getLayout(): Layout;\n        getHintLayout(): Layout;\n        getUndoManager(): any;\n        setUndoManager(undoManager: any, tag: string): void;\n        getKeyListener(): any;\n        setKeyListener(input: any): void;\n        private setKeyListenerOnly(input);\n        getMovementMethod(): MovementMethod;\n        setMovementMethod(movement: MovementMethod): void;\n        private fixFocusableAndClickableSettings();\n        getTransformationMethod(): TransformationMethod;\n        setTransformationMethod(method: TransformationMethod): void;\n        getCompoundPaddingTop(): number;\n        getCompoundPaddingBottom(): number;\n        getCompoundPaddingLeft(): number;\n        getCompoundPaddingRight(): number;\n        getCompoundPaddingStart(): number;\n        getCompoundPaddingEnd(): number;\n        getExtendedPaddingTop(): number;\n        getExtendedPaddingBottom(): number;\n        getTotalPaddingLeft(): number;\n        getTotalPaddingRight(): number;\n        getTotalPaddingStart(): number;\n        getTotalPaddingEnd(): number;\n        getTotalPaddingTop(): number;\n        getTotalPaddingBottom(): number;\n        setCompoundDrawables(left: Drawable, top: Drawable, right: Drawable, bottom: Drawable): void;\n        setCompoundDrawablesWithIntrinsicBounds(left: Drawable, top: Drawable, right: Drawable, bottom: Drawable): void;\n        setCompoundDrawablesRelative(start: Drawable, top: Drawable, end: Drawable, bottom: Drawable): void;\n        setCompoundDrawablesRelativeWithIntrinsicBounds(start: Drawable, top: Drawable, end: Drawable, bottom: Drawable): void;\n        getCompoundDrawables(): Drawable[];\n        getCompoundDrawablesRelative(): Drawable[];\n        setCompoundDrawablePadding(pad: number): void;\n        getCompoundDrawablePadding(): number;\n        setPadding(left: number, top: number, right: number, bottom: number): void;\n        getAutoLinkMask(): number;\n        getTextLocale(): any;\n        setTextLocale(locale: any): void;\n        getTextSize(): number;\n        setTextSize(size: number): void;\n        setTextSize(unit: string, size: number): void;\n        protected setRawTextSize(size: number): void;\n        getTextScaleX(): number;\n        setTextScaleX(size: number): void;\n        getTypeface(): any;\n        setTextColor(colors: ColorStateList | number): void;\n        getTextColors(): ColorStateList;\n        getCurrentTextColor(): number;\n        setHighlightColor(color: number): void;\n        getHighlightColor(): number;\n        setShowSoftInputOnFocus(show: boolean): void;\n        getShowSoftInputOnFocus(): boolean;\n        setShadowLayer(radius: number, dx: number, dy: number, color: number): void;\n        getShadowRadius(): number;\n        getShadowDx(): number;\n        getShadowDy(): number;\n        getShadowColor(): number;\n        getPaint(): TextPaint;\n        setAutoLinkMask(mask: number): void;\n        setLinksClickable(whether: boolean): void;\n        getLinksClickable(): boolean;\n        getUrls(): any[];\n        setHintTextColor(colors: ColorStateList | number): void;\n        getHintTextColors(): ColorStateList;\n        getCurrentHintTextColor(): number;\n        setLinkTextColor(colors: number | ColorStateList): void;\n        getLinkTextColors(): ColorStateList;\n        setGravity(gravity: number): void;\n        getGravity(): number;\n        getPaintFlags(): number;\n        setPaintFlags(flags: number): void;\n        setHorizontallyScrolling(whether: boolean): void;\n        getHorizontallyScrolling(): boolean;\n        setMinLines(minlines: number): void;\n        getMinLines(): number;\n        setMinHeight(minHeight: number): void;\n        getMinHeight(): number;\n        setMaxLines(maxlines: number): void;\n        getMaxLines(): number;\n        setMaxHeight(maxHeight: number): void;\n        getMaxHeight(): number;\n        setLines(lines: number): void;\n        setHeight(pixels: number): void;\n        setMinEms(minems: number): void;\n        getMinEms(): number;\n        setMinWidth(minpixels: number): void;\n        getMinWidth(): number;\n        setMaxEms(maxems: number): void;\n        getMaxEms(): number;\n        setMaxWidth(maxpixels: number): void;\n        getMaxWidth(): number;\n        setEms(ems: number): void;\n        setWidth(pixels: number): void;\n        setLineSpacing(add: number, mult: number): void;\n        getLineSpacingMultiplier(): number;\n        getLineSpacingExtra(): number;\n        protected updateTextColors(): void;\n        protected drawableStateChanged(): void;\n        removeMisspelledSpans(spannable: Spannable): void;\n        setFreezesText(freezesText: boolean): void;\n        getFreezesText(): boolean;\n        setSpannableFactory(factory: Spannable.Factory): void;\n        setText(text: String, type?: TextView.BufferType, notifyBefore?: boolean, oldlen?: number): void;\n        setHint(hint: String): void;\n        getHint(): String;\n        isSingleLine(): boolean;\n        private static isMultilineInputType(type);\n        removeSuggestionSpans(text: String): String;\n        private hasPasswordTransformationMethod();\n        private static isPasswordInputType(inputType);\n        private static isVisiblePasswordInputType(inputType);\n        setRawInputType(type: number): void;\n        setInputType(type: number, direct?: boolean): void;\n        getInputType(): number;\n        setImeOptions(imeOptions: number): void;\n        getImeOptions(): number;\n        setImeActionLabel(label: String, actionId: number): void;\n        getImeActionLabel(): String;\n        getImeActionId(): number;\n        setOnEditorActionListener(l: TextView.OnEditorActionListener): void;\n        protected setFrame(l: number, t: number, r: number, b: number): boolean;\n        private restartMarqueeIfNeeded();\n        setFilters(filters: any[]): void;\n        setFilters(e: any, filters: any[]): void;\n        getFilters(): any[];\n        private getBoxHeight(l);\n        getVerticalOffset(forceNormal: boolean): number;\n        private getBottomVerticalOffset(forceNormal);\n        invalidateRegion(start: number, end: number, invalidateCursor: boolean): void;\n        private registerForPreDraw();\n        onPreDraw(): boolean;\n        protected onAttachedToWindow(): void;\n        protected onDetachedFromWindow(): void;\n        protected isPaddingOffsetRequired(): boolean;\n        protected getLeftPaddingOffset(): number;\n        protected getTopPaddingOffset(): number;\n        protected getBottomPaddingOffset(): number;\n        protected getRightPaddingOffset(): number;\n        protected verifyDrawable(who: Drawable): boolean;\n        jumpDrawablesToCurrentState(): void;\n        drawableSizeChange(d: android.graphics.drawable.Drawable): void;\n        invalidateDrawable(drawable: Drawable): void;\n        isTextSelectable(): boolean;\n        setTextIsSelectable(selectable: boolean): void;\n        protected onCreateDrawableState(extraSpace: number): number[];\n        private getUpdatedHighlightPath();\n        getHorizontalOffsetForDrawables(): number;\n        protected onDraw(canvas: Canvas): void;\n        getFocusedRect(r: Rect): void;\n        getLineCount(): number;\n        getLineBounds(line: number, bounds: Rect): number;\n        getBaseline(): number;\n        protected getFadeTop(offsetRequired: boolean): number;\n        protected getFadeHeight(offsetRequired: boolean): number;\n        onKeyDown(keyCode: number, event: KeyEvent): boolean;\n        private shouldAdvanceFocusOnEnter();\n        private shouldAdvanceFocusOnTab();\n        private doKeyDown(keyCode, event, otherEvent);\n        resetErrorChangedFlag(): void;\n        hideErrorIfUnchanged(): void;\n        onKeyUp(keyCode: number, event: KeyEvent): boolean;\n        onCheckIsTextEditor(): boolean;\n        private nullLayouts();\n        private assumeLayout();\n        private getLayoutAlignment();\n        protected makeNewLayout(wantWidth: number, hintWidth: number, boring: BoringLayout.Metrics, hintBoring: BoringLayout.Metrics, ellipsisWidth: number, bringIntoView: boolean): void;\n        private makeSingleLayout(wantWidth, boring, ellipsisWidth, alignment, shouldEllipsize, effectiveEllipsize, useSaved);\n        private compressText(width);\n        private static desired(layout);\n        setIncludeFontPadding(includepad: boolean): void;\n        getIncludeFontPadding(): boolean;\n        private static UNKNOWN_BORING;\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        private getDesiredHeight(layout?, cap?);\n        private checkForResize();\n        private checkForRelayout();\n        protected onLayout(changed: boolean, left: number, top: number, right: number, bottom: number): void;\n        private isShowingHint();\n        private bringTextIntoView();\n        bringPointIntoView(offset: number): boolean;\n        moveCursorToVisibleOffset(): boolean;\n        computeScroll(): void;\n        private getInterestingRect(r, line);\n        private convertFromViewportToContentCoordinates(r);\n        viewportToContentHorizontalOffset(): number;\n        viewportToContentVerticalOffset(): number;\n        getSelectionStart(): number;\n        getSelectionEnd(): number;\n        hasSelection(): boolean;\n        setAllCaps(allCaps: boolean): void;\n        setSingleLine(singleLine?: boolean): void;\n        private setInputTypeSingleLine(singleLine);\n        private applySingleLine(singleLine, applyTransformation, changeMaxLines);\n        setEllipsize(where: TextUtils.TruncateAt): void;\n        setMarqueeRepeatLimit(marqueeLimit: number): void;\n        getMarqueeRepeatLimit(): number;\n        getEllipsize(): TextUtils.TruncateAt;\n        setSelectAllOnFocus(selectAllOnFocus: boolean): void;\n        setCursorVisible(visible: boolean): void;\n        isCursorVisible(): boolean;\n        private canMarquee();\n        private startMarquee();\n        private stopMarquee();\n        private startStopMarquee(start);\n        protected onTextChanged(text: String, start: number, lengthBefore: number, lengthAfter: number): void;\n        protected onSelectionChanged(selStart: number, selEnd: number): void;\n        addTextChangedListener(watcher: TextWatcher): void;\n        removeTextChangedListener(watcher: TextWatcher): void;\n        private sendBeforeTextChanged(text, start, before, after);\n        removeAdjacentSuggestionSpans(pos: number): void;\n        sendOnTextChanged(text: String, start: number, before: number, after: number): void;\n        sendAfterTextChanged(text: any): void;\n        updateAfterEdit(): void;\n        handleTextChanged(buffer: String, start: number, before: number, after: number): void;\n        spanChange(buf: Spanned, what: any, oldStart: number, newStart: number, oldEnd: number, newEnd: number): void;\n        dispatchFinishTemporaryDetach(): void;\n        onStartTemporaryDetach(): void;\n        onFinishTemporaryDetach(): void;\n        protected onFocusChanged(focused: boolean, direction: number, previouslyFocusedRect: Rect): void;\n        onWindowFocusChanged(hasWindowFocus: boolean): void;\n        protected onVisibilityChanged(changedView: View, visibility: number): void;\n        clearComposingText(): void;\n        setSelected(selected: boolean): void;\n        onTouchEvent(event: MotionEvent): boolean;\n        onGenericMotionEvent(event: MotionEvent): boolean;\n        isTextEditable(): boolean;\n        didTouchFocusSelect(): boolean;\n        cancelLongPress(): void;\n        setScroller(s: OverScroller): void;\n        protected getLeftFadingEdgeStrength(): number;\n        protected getRightFadingEdgeStrength(): number;\n        protected computeHorizontalScrollRange(): number;\n        protected computeVerticalScrollRange(): number;\n        protected computeVerticalScrollExtent(): number;\n        static getTextColors(): ColorStateList;\n        static getTextColor(def: number): number;\n        private canSelectText();\n        textCanBeSelected(): boolean;\n        getTransformedText(start: number, end: number): String;\n        performLongClick(): boolean;\n        isSuggestionsEnabled(): boolean;\n        setCustomSelectionActionModeCallback(actionModeCallback: any): void;\n        getCustomSelectionActionModeCallback(): any;\n        protected stopSelectionActionMode(): void;\n        canCut(): boolean;\n        canCopy(): boolean;\n        canPaste(): boolean;\n        selectAllText(): boolean;\n        getOffsetForPosition(x: number, y: number): number;\n        convertToLocalHorizontalCoordinate(x: number): number;\n        getLineAtCoordinate(y: number): number;\n        private getOffsetAtCoordinate(line, x);\n        isInBatchEditMode(): boolean;\n        getTextDirectionHeuristic(): TextDirectionHeuristic;\n        onResolveDrawables(layoutDirection: number): void;\n        protected resetResolvedDrawables(): void;\n        protected deleteText_internal(start: number, end: number): void;\n        protected replaceText_internal(start: number, end: number, text: String): void;\n        protected setSpan_internal(span: any, start: number, end: number, flags: number): void;\n        protected setCursorPosition_internal(start: number, end: number): void;\n        private createEditorIfNeeded();\n    }\n    module TextView {\n        class Drawables {\n            static DRAWABLE_NONE: number;\n            static DRAWABLE_RIGHT: number;\n            static DRAWABLE_LEFT: number;\n            mCompoundRect: Rect;\n            mDrawableTop: Drawable;\n            mDrawableBottom: Drawable;\n            mDrawableLeft: Drawable;\n            mDrawableRight: Drawable;\n            mDrawableStart: Drawable;\n            mDrawableEnd: Drawable;\n            mDrawableError: Drawable;\n            mDrawableTemp: Drawable;\n            mDrawableLeftInitial: Drawable;\n            mDrawableRightInitial: Drawable;\n            mIsRtlCompatibilityMode: boolean;\n            mOverride: boolean;\n            mDrawableSizeTop: number;\n            mDrawableSizeBottom: number;\n            mDrawableSizeLeft: number;\n            mDrawableSizeRight: number;\n            mDrawableSizeStart: number;\n            mDrawableSizeEnd: number;\n            mDrawableSizeError: number;\n            mDrawableSizeTemp: number;\n            mDrawableWidthTop: number;\n            mDrawableWidthBottom: number;\n            mDrawableHeightLeft: number;\n            mDrawableHeightRight: number;\n            mDrawableHeightStart: number;\n            mDrawableHeightEnd: number;\n            mDrawableHeightError: number;\n            mDrawableHeightTemp: number;\n            mDrawablePadding: number;\n            mDrawableSaved: number;\n            constructor(context?: any);\n            resolveWithLayoutDirection(layoutDirection: number): void;\n            private updateDrawablesLayoutDirection(layoutDirection);\n            setErrorDrawable(dr: Drawable, tv: TextView): void;\n            private applyErrorDrawableIfNeeded(layoutDirection);\n        }\n        interface OnEditorActionListener {\n            onEditorAction(v: TextView, actionId: number, event: KeyEvent): boolean;\n        }\n        class Marquee extends Handler {\n            private static MARQUEE_DELTA_MAX;\n            private static MARQUEE_DELAY;\n            private static MARQUEE_RESTART_DELAY;\n            private static MARQUEE_RESOLUTION;\n            private static MARQUEE_PIXELS_PER_SECOND;\n            private static MARQUEE_STOPPED;\n            private static MARQUEE_STARTING;\n            private static MARQUEE_RUNNING;\n            private static MESSAGE_START;\n            private static MESSAGE_TICK;\n            private static MESSAGE_RESTART;\n            private mView;\n            private mStatus;\n            private mScrollUnit;\n            private mMaxScroll;\n            private mMaxFadeScroll;\n            private mGhostStart;\n            private mGhostOffset;\n            private mFadeStop;\n            private mRepeatLimit;\n            private mScroll;\n            constructor(v: TextView);\n            handleMessage(msg: Message): void;\n            tick(): void;\n            stop(): void;\n            private resetScroll();\n            start(repeatLimit: number): void;\n            getGhostOffset(): number;\n            getScroll(): number;\n            getMaxFadeScroll(): number;\n            shouldDrawLeftFade(): boolean;\n            shouldDrawGhost(): boolean;\n            isRunning(): boolean;\n            isStopped(): boolean;\n        }\n        class ChangeWatcher implements TextWatcher, SpanWatcher {\n            _TextView_this: TextView;\n            constructor(arg: TextView);\n            private mBeforeText;\n            beforeTextChanged(buffer: String, start: number, before: number, after: number): void;\n            onTextChanged(buffer: String, start: number, before: number, after: number): void;\n            afterTextChanged(buffer: String): void;\n            onSpanChanged(buf: Spannable, what: any, s: number, e: number, st: number, en: number): void;\n            onSpanAdded(buf: Spannable, what: any, s: number, e: number): void;\n            onSpanRemoved(buf: Spannable, what: any, s: number, e: number): void;\n        }\n        enum BufferType {\n            NORMAL = 0,\n            SPANNABLE = 1,\n            EDITABLE = 2,\n        }\n    }\n}\ndeclare module android.widget {\n    class Button extends TextView {\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n    }\n}\ndeclare module android.widget {\n    interface Checkable {\n        setChecked(checked: boolean): void;\n        isChecked(): boolean;\n        toggle(): void;\n    }\n}\ndeclare module android.widget {\n    import Adapter = android.widget.Adapter;\n    interface ListAdapter extends Adapter {\n        areAllItemsEnabled(): boolean;\n        isEnabled(position: number): boolean;\n    }\n    module ListAdapter {\n        function isImpl(obj: any): any;\n    }\n}\ndeclare module android.widget {\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n    import Drawable = android.graphics.drawable.Drawable;\n    import SparseBooleanArray = android.util.SparseBooleanArray;\n    import KeyEvent = android.view.KeyEvent;\n    import MotionEvent = android.view.MotionEvent;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import ViewTreeObserver = android.view.ViewTreeObserver;\n    import Interpolator = android.view.animation.Interpolator;\n    import ArrayList = java.util.ArrayList;\n    import List = java.util.List;\n    import Runnable = java.lang.Runnable;\n    import AdapterView = android.widget.AdapterView;\n    import ListAdapter = android.widget.ListAdapter;\n    import OverScroller = android.widget.OverScroller;\n    abstract class AbsListView extends AdapterView<ListAdapter> implements ViewTreeObserver.OnGlobalLayoutListener, ViewTreeObserver.OnTouchModeChangeListener {\n        static TAG_AbsListView: string;\n        static TRANSCRIPT_MODE_DISABLED: number;\n        static TRANSCRIPT_MODE_NORMAL: number;\n        static TRANSCRIPT_MODE_ALWAYS_SCROLL: number;\n        static TOUCH_MODE_REST: number;\n        static TOUCH_MODE_DOWN: number;\n        static TOUCH_MODE_TAP: number;\n        static TOUCH_MODE_DONE_WAITING: number;\n        static TOUCH_MODE_SCROLL: number;\n        static TOUCH_MODE_FLING: number;\n        private static TOUCH_MODE_OVERSCROLL;\n        static TOUCH_MODE_OVERFLING: number;\n        static LAYOUT_NORMAL: number;\n        static LAYOUT_FORCE_TOP: number;\n        static LAYOUT_SET_SELECTION: number;\n        static LAYOUT_FORCE_BOTTOM: number;\n        static LAYOUT_SPECIFIC: number;\n        static LAYOUT_SYNC: number;\n        static LAYOUT_MOVE_SELECTION: number;\n        static CHOICE_MODE_NONE: number;\n        static CHOICE_MODE_SINGLE: number;\n        static CHOICE_MODE_MULTIPLE: number;\n        static CHOICE_MODE_MULTIPLE_MODAL: number;\n        mChoiceMode: number;\n        private mChoiceActionMode;\n        private mCheckedItemCount;\n        mCheckStates: SparseBooleanArray;\n        private mCheckedIdStates;\n        mDataSetObserver: AbsListView.AdapterDataSetObserver;\n        mAdapter: ListAdapter;\n        private mAdapterHasStableIds;\n        private mDeferNotifyDataSetChanged;\n        private mDrawSelectorOnTop;\n        private mSelector;\n        private mSelectorPosition;\n        mSelectorRect: Rect;\n        mRecycler: AbsListView.RecycleBin;\n        private mSelectionLeftPadding;\n        private mSelectionTopPadding;\n        private mSelectionRightPadding;\n        private mSelectionBottomPadding;\n        mListPadding: Rect;\n        mWidthMeasureSpec: number;\n        private mScrollUp;\n        private mScrollDown;\n        mCachingStarted: boolean;\n        mCachingActive: boolean;\n        mMotionPosition: number;\n        private mMotionViewOriginalTop;\n        private mMotionViewNewTop;\n        private mMotionX;\n        private mMotionY;\n        mTouchMode: number;\n        private mLastY;\n        private mMotionCorrection;\n        private mVelocityTracker;\n        mFlingRunnable: AbsListView.FlingRunnable;\n        mPositionScroller: AbsListView.PositionScroller;\n        mSelectedTop: number;\n        mStackFromBottom: boolean;\n        private mScrollingCacheEnabled;\n        private mFastScrollEnabled;\n        private mFastScrollAlwaysVisible;\n        private mOnScrollListener;\n        private mSmoothScrollbarEnabled;\n        private mTextFilterEnabled;\n        private mFiltered;\n        private mTouchFrame;\n        mResurrectToPosition: number;\n        private mOverscrollMax;\n        private static OVERSCROLL_LIMIT_DIVISOR;\n        private static CHECK_POSITION_SEARCH_DISTANCE;\n        private static TOUCH_MODE_UNKNOWN;\n        private static TOUCH_MODE_ON;\n        private static TOUCH_MODE_OFF;\n        private mLastTouchMode;\n        private static PROFILE_SCROLLING;\n        private mScrollProfilingStarted;\n        static PROFILE_FLINGING: boolean;\n        private mFlingProfilingStarted;\n        private mPendingCheckForLongPress_List;\n        private mPendingCheckForTap_;\n        private mPendingCheckForKeyLongPress;\n        private mPerformClick_;\n        mTouchModeReset: Runnable;\n        private mTranscriptMode;\n        private mCacheColorHint;\n        private mIsChildViewEnabled;\n        private mLastScrollState;\n        private mGlobalLayoutListenerAddedFilter;\n        private mDensityScale;\n        private mClearScrollingCache;\n        mPositionScrollAfterLayout: Runnable;\n        private mMinimumVelocity;\n        private mMaximumVelocity;\n        private mVelocityScale;\n        mIsScrap: boolean[];\n        private mPopupHidden;\n        private mActivePointerId;\n        static INVALID_POINTER: number;\n        private mOverscrollDistance;\n        private _mOverflingDistance;\n        private mOverflingDistance;\n        private mFirstPositionDistanceGuess;\n        private mLastPositionDistanceGuess;\n        private mDirection;\n        private mForceTranscriptScroll;\n        private mGlowPaddingLeft;\n        private mGlowPaddingRight;\n        private mLastHandledItemCount;\n        static sLinearInterpolator: Interpolator;\n        private mPendingSync;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        private initAbsListView();\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        setOverScrollMode(mode: number): void;\n        setAdapter(adapter: ListAdapter): void;\n        getCheckedItemCount(): number;\n        isItemChecked(position: number): boolean;\n        getCheckedItemPosition(): number;\n        getCheckedItemPositions(): SparseBooleanArray;\n        getCheckedItemIds(): number[];\n        clearChoices(): void;\n        setItemChecked(position: number, value: boolean): void;\n        performItemClick(view: View, position: number, id: number): boolean;\n        private updateOnScreenCheckedViews();\n        getChoiceMode(): number;\n        setChoiceMode(choiceMode: number): void;\n        private contentFits();\n        setFastScrollEnabled(enabled: boolean): void;\n        private setFastScrollerEnabledUiThread(enabled);\n        setFastScrollAlwaysVisible(alwaysShow: boolean): void;\n        private setFastScrollerAlwaysVisibleUiThread(alwaysShow);\n        private isOwnerThread();\n        isFastScrollAlwaysVisible(): boolean;\n        getVerticalScrollbarWidth(): number;\n        isFastScrollEnabled(): boolean;\n        setVerticalScrollbarPosition(position: number): void;\n        setScrollBarStyle(style: number): void;\n        isVerticalScrollBarHidden(): boolean;\n        setSmoothScrollbarEnabled(enabled: boolean): void;\n        isSmoothScrollbarEnabled(): boolean;\n        setOnScrollListener(l: AbsListView.OnScrollListener): void;\n        invokeOnItemScrollListener(): void;\n        isScrollingCacheEnabled(): boolean;\n        setScrollingCacheEnabled(enabled: boolean): void;\n        setTextFilterEnabled(textFilterEnabled: boolean): void;\n        isTextFilterEnabled(): boolean;\n        getFocusedRect(r: Rect): void;\n        private useDefaultSelector();\n        isStackFromBottom(): boolean;\n        setStackFromBottom(stackFromBottom: boolean): void;\n        private requestLayoutIfNecessary();\n        protected onFocusChanged(gainFocus: boolean, direction: number, previouslyFocusedRect: Rect): void;\n        requestLayout(): void;\n        resetList(): void;\n        protected computeVerticalScrollExtent(): number;\n        protected computeVerticalScrollOffset(): number;\n        protected computeVerticalScrollRange(): number;\n        protected getTopFadingEdgeStrength(): number;\n        protected getBottomFadingEdgeStrength(): number;\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        protected onLayout(changed: boolean, l: number, t: number, r: number, b: number): void;\n        protected setFrame(left: number, top: number, right: number, bottom: number): boolean;\n        protected layoutChildren(): void;\n        updateScrollIndicators(): void;\n        getSelectedView(): View;\n        getListPaddingTop(): number;\n        getListPaddingBottom(): number;\n        getListPaddingLeft(): number;\n        getListPaddingRight(): number;\n        obtainView(position: number, isScrap: boolean[]): View;\n        positionSelector(l: number, t: number, r: number, b: number): void;\n        positionSelector(position: number, sel: View): void;\n        protected dispatchDraw(canvas: Canvas): void;\n        isPaddingOffsetRequired(): boolean;\n        getLeftPaddingOffset(): number;\n        getTopPaddingOffset(): number;\n        getRightPaddingOffset(): number;\n        getBottomPaddingOffset(): number;\n        protected onSizeChanged(w: number, h: number, oldw: number, oldh: number): void;\n        touchModeDrawsInPressedState(): boolean;\n        shouldShowSelector(): boolean;\n        private drawSelector(canvas);\n        setDrawSelectorOnTop(onTop: boolean): void;\n        setSelector(sel: Drawable): void;\n        getSelector(): Drawable;\n        keyPressed(): void;\n        setScrollIndicators(up: View, down: View): void;\n        private updateSelectorState();\n        protected drawableStateChanged(): void;\n        protected onCreateDrawableState(extraSpace: number): number[];\n        protected verifyDrawable(dr: Drawable): boolean;\n        jumpDrawablesToCurrentState(): void;\n        protected onAttachedToWindow(): void;\n        protected onDetachedFromWindow(): void;\n        onWindowFocusChanged(hasWindowFocus: boolean): void;\n        onCancelPendingInputEvents(): void;\n        private performLongPress(child, longPressPosition, longPressId);\n        onKeyDown(keyCode: number, event: KeyEvent): boolean;\n        onKeyUp(keyCode: number, event: KeyEvent): boolean;\n        dispatchSetPressed(pressed: boolean): void;\n        pointToPosition(x: number, y: number): number;\n        pointToRowId(x: number, y: number): number;\n        protected checkOverScrollStartScrollIfNeeded(): boolean;\n        private startScrollIfNeeded(y);\n        private scrollIfNeeded(y);\n        onTouchModeChanged(isInTouchMode: boolean): void;\n        onTouchEvent(ev: MotionEvent): boolean;\n        private onTouchDown(ev);\n        private onTouchMove(ev);\n        private onTouchUp(ev);\n        private onTouchCancel();\n        protected onOverScrolled(scrollX: number, scrollY: number, clampedX: boolean, clampedY: boolean): void;\n        onGenericMotionEvent(event: MotionEvent): boolean;\n        draw(canvas: Canvas): void;\n        setOverScrollEffectPadding(leftPadding: number, rightPadding: number): void;\n        private initOrResetVelocityTracker();\n        private initVelocityTrackerIfNotExists();\n        private recycleVelocityTracker();\n        requestDisallowInterceptTouchEvent(disallowIntercept: boolean): void;\n        onInterceptTouchEvent(ev: MotionEvent): boolean;\n        private onSecondaryPointerUp(ev);\n        addTouchables(views: ArrayList<View>): void;\n        private reportScrollStateChange(newState);\n        setFriction(friction: number): void;\n        setVelocityScale(scale: number): void;\n        smoothScrollToPositionFromTop(position: number, offset: number, duration?: number): void;\n        smoothScrollToPosition(position: number, boundPosition?: number): void;\n        smoothScrollBy(distance: number, duration: number, linear?: boolean): void;\n        smoothScrollByOffset(position: number): void;\n        private createScrollingCache();\n        private clearScrollingCache();\n        scrollListBy(y: number): void;\n        canScrollList(direction: number): boolean;\n        private trackMotionScroll(deltaY, incrementalDeltaY);\n        getHeaderViewsCount(): number;\n        getFooterViewsCount(): number;\n        abstract fillGap(down: boolean): void;\n        hideSelector(): void;\n        reconcileSelectedPosition(): number;\n        abstract findMotionRow(y: number): number;\n        private findClosestMotionRow(y);\n        invalidateViews(): void;\n        resurrectSelectionIfNeeded(): boolean;\n        abstract setSelectionInt(position: number): void;\n        private resurrectSelection();\n        private confirmCheckedPositionsById();\n        handleDataChanged(): void;\n        onDisplayHint(hint: number): void;\n        private dismissPopup();\n        private showPopup();\n        private positionPopup();\n        static getDistance(source: Rect, dest: Rect, direction: number): number;\n        isInFilterMode(): boolean;\n        hasTextFilter(): boolean;\n        onGlobalLayout(): void;\n        protected generateDefaultLayoutParams(): ViewGroup.LayoutParams;\n        protected generateLayoutParams(p: ViewGroup.LayoutParams): ViewGroup.LayoutParams;\n        generateLayoutParamsFromAttr(attrs: HTMLElement): ViewGroup.LayoutParams;\n        protected checkLayoutParams(p: ViewGroup.LayoutParams): boolean;\n        setTranscriptMode(mode: number): void;\n        getTranscriptMode(): number;\n        getSolidColor(): number;\n        setCacheColorHint(color: number): void;\n        getCacheColorHint(): number;\n        reclaimViews(views: List<View>): void;\n        private finishGlows();\n        setVisibleRangeHint(start: number, end: number): void;\n        setRecyclerListener(listener: AbsListView.RecyclerListener): void;\n        static retrieveFromScrap(scrapViews: ArrayList<View>, position: number): View;\n    }\n    module AbsListView {\n        interface OnScrollListener {\n            onScrollStateChanged(view: AbsListView, scrollState: number): void;\n            onScroll(view: AbsListView, firstVisibleItem: number, visibleItemCount: number, totalItemCount: number): void;\n        }\n        module OnScrollListener {\n            var SCROLL_STATE_IDLE: number;\n            var SCROLL_STATE_TOUCH_SCROLL: number;\n            var SCROLL_STATE_FLING: number;\n        }\n        interface SelectionBoundsAdjuster {\n            adjustListItemSelectionBounds(bounds: Rect): void;\n        }\n        class WindowRunnnable {\n            _AbsListView_this: AbsListView;\n            constructor(arg: AbsListView);\n            private mOriginalAttachCount;\n            rememberWindowAttachCount(): void;\n            sameWindow(): boolean;\n        }\n        class PerformClick extends AbsListView.WindowRunnnable implements Runnable {\n            _AbsListView_this: AbsListView;\n            constructor(arg: AbsListView);\n            mClickMotionPosition: number;\n            run(): void;\n        }\n        class CheckForLongPress extends AbsListView.WindowRunnnable implements Runnable {\n            _AbsListView_this: AbsListView;\n            constructor(arg: AbsListView);\n            run(): void;\n        }\n        class CheckForKeyLongPress extends AbsListView.WindowRunnnable implements Runnable {\n            _AbsListView_this: AbsListView;\n            constructor(arg: AbsListView);\n            run(): void;\n        }\n        class CheckForTap implements Runnable {\n            _AbsListView_this: AbsListView;\n            constructor(arg: AbsListView);\n            run(): void;\n        }\n        class FlingRunnable implements Runnable {\n            _AbsListView_this: AbsListView;\n            constructor(arg: AbsListView);\n            mScroller: OverScroller;\n            private mLastFlingY;\n            private mCheckFlywheel;\n            static FLYWHEEL_TIMEOUT: number;\n            start(initialVelocity: number): void;\n            startSpringback(): void;\n            startOverfling(initialVelocity: number): void;\n            private edgeReached(delta);\n            startScroll(distance: number, duration: number, linear: boolean): void;\n            endFling(): void;\n            flywheelTouch(): void;\n            run(): void;\n        }\n        class PositionScroller implements Runnable {\n            _AbsListView_this: AbsListView;\n            constructor(arg: AbsListView);\n            private static SCROLL_DURATION;\n            private static MOVE_DOWN_POS;\n            private static MOVE_UP_POS;\n            private static MOVE_DOWN_BOUND;\n            private static MOVE_UP_BOUND;\n            private static MOVE_OFFSET;\n            private mMode;\n            private mTargetPos;\n            private mBoundPos;\n            private mLastSeenPos;\n            private mScrollDuration;\n            private mExtraScroll;\n            private mOffsetFromTop;\n            start(position: number, boundPosition?: number): void;\n            private _start_1(position);\n            private _start_2(position, boundPosition);\n            startWithOffset(position: number, offset: number, duration?: number): void;\n            private scrollToVisible(targetPos, boundPos, duration);\n            stop(): void;\n            run(): void;\n        }\n        class AdapterDataSetObserver extends AdapterView.AdapterDataSetObserver {\n            _AbsListView_this: AbsListView;\n            constructor(arg: any);\n            onChanged(): void;\n            onInvalidated(): void;\n        }\n        class LayoutParams extends ViewGroup.LayoutParams {\n            viewType: number;\n            recycledHeaderFooter: boolean;\n            forceAdd: boolean;\n            scrappedFromPosition: number;\n            itemId: number;\n            constructor(context: android.content.Context, attrs: HTMLElement);\n            constructor(w: number, h: number);\n            constructor(w: number, h: number, viewType: number);\n            constructor(source: ViewGroup.LayoutParams);\n        }\n        interface RecyclerListener {\n            onMovedToScrapHeap(view: View): void;\n        }\n        class RecycleBin {\n            _AbsListView_this: AbsListView;\n            constructor(arg: AbsListView);\n            mRecyclerListener: AbsListView.RecyclerListener;\n            private mFirstActivePosition;\n            mActiveViews: View[];\n            private mScrapViews;\n            private mViewTypeCount;\n            private mCurrentScrap;\n            private mSkippedScrap;\n            private mTransientStateViews;\n            private mTransientStateViewsById;\n            setViewTypeCount(viewTypeCount: number): void;\n            markChildrenDirty(): void;\n            shouldRecycleViewType(viewType: number): boolean;\n            clear(): void;\n            fillActiveViews(childCount: number, firstActivePosition: number): void;\n            getActiveView(position: number): View;\n            getTransientStateView(position: number): View;\n            clearTransientStateViews(): void;\n            getScrapView(position: number): View;\n            addScrapView(scrap: View, position: number): void;\n            removeSkippedScrap(): void;\n            scrapActiveViews(): void;\n            private pruneScrapViews();\n            reclaimScrapViews(views: List<View>): void;\n            setCacheColorHint(color: number): void;\n        }\n    }\n}\ndeclare module android.widget {\n    import ListAdapter = android.widget.ListAdapter;\n    interface WrapperListAdapter extends ListAdapter {\n        getWrappedAdapter(): ListAdapter;\n    }\n}\ndeclare module android.widget {\n    import DataSetObserver = android.database.DataSetObserver;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import ArrayList = java.util.ArrayList;\n    import ListAdapter = android.widget.ListAdapter;\n    import ListView = android.widget.ListView;\n    import WrapperListAdapter = android.widget.WrapperListAdapter;\n    class HeaderViewListAdapter implements WrapperListAdapter {\n        private mAdapter;\n        mHeaderViewInfos: ArrayList<ListView.FixedViewInfo>;\n        mFooterViewInfos: ArrayList<ListView.FixedViewInfo>;\n        static EMPTY_INFO_LIST: ArrayList<ListView.FixedViewInfo>;\n        mAreAllFixedViewsSelectable: boolean;\n        private mIsFilterable;\n        constructor(headerViewInfos: ArrayList<ListView.FixedViewInfo>, footerViewInfos: ArrayList<ListView.FixedViewInfo>, adapter: ListAdapter);\n        getHeadersCount(): number;\n        getFootersCount(): number;\n        isEmpty(): boolean;\n        private areAllListInfosSelectable(infos);\n        removeHeader(v: View): boolean;\n        removeFooter(v: View): boolean;\n        getCount(): number;\n        areAllItemsEnabled(): boolean;\n        isEnabled(position: number): boolean;\n        getItem(position: number): any;\n        getItemId(position: number): number;\n        hasStableIds(): boolean;\n        getView(position: number, convertView: View, parent: ViewGroup): View;\n        getItemViewType(position: number): number;\n        getViewTypeCount(): number;\n        registerDataSetObserver(observer: DataSetObserver): void;\n        unregisterDataSetObserver(observer: DataSetObserver): void;\n        getFilter(): any;\n        getWrappedAdapter(): ListAdapter;\n    }\n}\ndeclare module android.database {\n    import ArrayList = java.util.ArrayList;\n    abstract class Observable<T> {\n        protected mObservers: ArrayList<T>;\n        registerObserver(observer: T): void;\n        unregisterObserver(observer: T): void;\n        unregisterAll(): void;\n    }\n}\ndeclare module android.database {\n    import Observable = android.database.Observable;\n    import DataSetObserver = android.database.DataSetObserver;\n    class DataSetObservable extends Observable<DataSetObserver> {\n        notifyChanged(): void;\n        notifyInvalidated(): void;\n    }\n}\ndeclare module android.widget {\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import Adapter = android.widget.Adapter;\n    interface SpinnerAdapter extends Adapter {\n        getDropDownView(position: number, convertView: View, parent: ViewGroup): View;\n    }\n}\ndeclare module android.widget {\n    import DataSetObserver = android.database.DataSetObserver;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import ListAdapter = android.widget.ListAdapter;\n    import SpinnerAdapter = android.widget.SpinnerAdapter;\n    abstract class BaseAdapter implements ListAdapter, SpinnerAdapter {\n        private mDataSetObservable;\n        hasStableIds(): boolean;\n        registerDataSetObserver(observer: DataSetObserver): void;\n        unregisterDataSetObserver(observer: DataSetObserver): void;\n        notifyDataSetChanged(): void;\n        notifyDataSetInvalidated(): void;\n        areAllItemsEnabled(): boolean;\n        isEnabled(position: number): boolean;\n        getDropDownView(position: number, convertView: View, parent: ViewGroup): View;\n        getItemViewType(position: number): number;\n        getViewTypeCount(): number;\n        isEmpty(): boolean;\n        abstract getView(position: number, convertView: View, parent: ViewGroup): View;\n        abstract getCount(): number;\n        abstract getItem(position: number): any;\n        abstract getItemId(position: number): number;\n    }\n}\ndeclare module android.widget {\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n    import Drawable = android.graphics.drawable.Drawable;\n    import KeyEvent = android.view.KeyEvent;\n    import View = android.view.View;\n    import ArrayList = java.util.ArrayList;\n    import Runnable = java.lang.Runnable;\n    import AbsListView = android.widget.AbsListView;\n    import ListAdapter = android.widget.ListAdapter;\n    class ListView extends AbsListView {\n        static NO_POSITION: number;\n        private static MAX_SCROLL_FACTOR;\n        private static MIN_SCROLL_PREVIEW_PIXELS;\n        private mHeaderViewInfos;\n        private mFooterViewInfos;\n        mDivider: Drawable;\n        mDividerHeight: number;\n        mOverScrollHeader: Drawable;\n        mOverScrollFooter: Drawable;\n        private mIsCacheColorOpaque;\n        private mDividerIsOpaque;\n        private mHeaderDividersEnabled;\n        private mFooterDividersEnabled;\n        private mAreAllItemsSelectable;\n        private mItemsCanFocus;\n        private mTempRect;\n        private mDividerPaint;\n        private mArrowScrollFocusResult;\n        private mFocusSelector;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        getMaxScrollAmount(): number;\n        private adjustViewsUpOrDown();\n        addHeaderView(v: View, data?: any, isSelectable?: boolean): void;\n        getHeaderViewsCount(): number;\n        removeHeaderView(v: View): boolean;\n        private removeFixedViewInfo(v, where);\n        addFooterView(v: View, data?: any, isSelectable?: boolean): void;\n        getFooterViewsCount(): number;\n        removeFooterView(v: View): boolean;\n        getAdapter(): ListAdapter;\n        setAdapter(adapter: ListAdapter): void;\n        resetList(): void;\n        private clearRecycledState(infos);\n        private showingTopFadingEdge();\n        private showingBottomFadingEdge();\n        requestChildRectangleOnScreen(child: View, rect: Rect, immediate: boolean): boolean;\n        fillGap(down: boolean): void;\n        private fillDown(pos, nextTop);\n        private fillUp(pos, nextBottom);\n        private fillFromTop(nextTop);\n        private fillFromMiddle(childrenTop, childrenBottom);\n        private fillAboveAndBelow(sel, position);\n        private fillFromSelection(selectedTop, childrenTop, childrenBottom);\n        private getBottomSelectionPixel(childrenBottom, fadingEdgeLength, selectedPosition);\n        private getTopSelectionPixel(childrenTop, fadingEdgeLength, selectedPosition);\n        smoothScrollToPosition(position: number, boundPosition?: number): void;\n        smoothScrollByOffset(offset: number): void;\n        private moveSelection(oldSel, newSel, delta, childrenTop, childrenBottom);\n        protected onSizeChanged(w: number, h: number, oldw: number, oldh: number): void;\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        private measureScrapChild(child, position, widthMeasureSpec);\n        protected recycleOnMeasure(): boolean;\n        measureHeightOfChildren(widthMeasureSpec: number, startPosition: number, endPosition: number, maxHeight: number, disallowPartialChildPosition: number): number;\n        findMotionRow(y: number): number;\n        private fillSpecific(position, top);\n        private correctTooHigh(childCount);\n        private correctTooLow(childCount);\n        layoutChildren(): void;\n        private makeAndAddView(position, y, flow, childrenLeft, selected);\n        private setupChild(child, position, y, flowDown, childrenLeft, selected, recycled);\n        canAnimate(): boolean;\n        setSelection(position: number): void;\n        setSelectionFromTop(position: number, y: number): void;\n        setSelectionInt(position: number): void;\n        lookForSelectablePosition(position: number, lookDown: boolean): number;\n        lookForSelectablePositionAfter(current: number, position: number, lookDown: boolean): number;\n        setSelectionAfterHeaderView(): void;\n        dispatchKeyEvent(event: KeyEvent): boolean;\n        onKeyDown(keyCode: number, event: KeyEvent): boolean;\n        onKeyMultiple(keyCode: number, repeatCount: number, event: KeyEvent): boolean;\n        onKeyUp(keyCode: number, event: KeyEvent): boolean;\n        private commonKey(keyCode, count, event);\n        pageScroll(direction: number): boolean;\n        fullScroll(direction: number): boolean;\n        private handleHorizontalFocusWithinListItem(direction);\n        arrowScroll(direction: number): boolean;\n        private nextSelectedPositionForDirection(selectedView, selectedPos, direction);\n        private arrowScrollImpl(direction);\n        private handleNewSelectionChange(selectedView, direction, newSelectedPosition, newFocusAssigned);\n        private measureAndAdjustDown(child, childIndex, numChildren);\n        private measureItem(child);\n        private relayoutMeasuredItem(child);\n        private getArrowScrollPreviewLength();\n        private amountToScroll(direction, nextSelectedPosition);\n        private lookForSelectablePositionOnScreen(direction);\n        private arrowScrollFocused(direction);\n        private positionOfNewFocus(newFocus);\n        private isViewAncestorOf(child, parent);\n        private amountToScrollToNewFocus(direction, newFocus, positionOfNewFocus);\n        private distanceToView(descendant);\n        private scrollListItemsBy(amount);\n        private addViewAbove(theView, position);\n        private addViewBelow(theView, position);\n        setItemsCanFocus(itemsCanFocus: boolean): void;\n        getItemsCanFocus(): boolean;\n        isOpaque(): boolean;\n        setCacheColorHint(color: number): void;\n        drawOverscrollHeader(canvas: Canvas, drawable: Drawable, bounds: Rect): void;\n        drawOverscrollFooter(canvas: Canvas, drawable: Drawable, bounds: Rect): void;\n        protected dispatchDraw(canvas: Canvas): void;\n        protected drawChild(canvas: Canvas, child: View, drawingTime: number): boolean;\n        drawDivider(canvas: Canvas, bounds: Rect, childIndex: number): void;\n        getDivider(): Drawable;\n        setDivider(divider: Drawable): void;\n        getDividerHeight(): number;\n        setDividerHeight(height: number): void;\n        setHeaderDividersEnabled(headerDividersEnabled: boolean): void;\n        areHeaderDividersEnabled(): boolean;\n        setFooterDividersEnabled(footerDividersEnabled: boolean): void;\n        areFooterDividersEnabled(): boolean;\n        setOverscrollHeader(header: Drawable): void;\n        getOverscrollHeader(): Drawable;\n        setOverscrollFooter(footer: Drawable): void;\n        getOverscrollFooter(): Drawable;\n        onFocusChanged(gainFocus: boolean, direction: number, previouslyFocusedRect: Rect): void;\n        protected onFinishInflate(): void;\n        protected findViewTraversal(id: string): View;\n        findViewInHeadersOrFooters(where: ArrayList<ListView.FixedViewInfo>, id: string): View;\n        protected findViewByPredicateTraversal(predicate: View.Predicate<View>, childToSkip: View): View;\n        findViewByPredicateInHeadersOrFooters(where: ArrayList<ListView.FixedViewInfo>, predicate: View.Predicate<View>, childToSkip: View): View;\n        getCheckItemIds(): number[];\n    }\n    module ListView {\n        class FixedViewInfo {\n            _ListView_this: ListView;\n            constructor(arg: ListView);\n            view: View;\n            data: any;\n            isSelectable: boolean;\n        }\n        class FocusSelector implements Runnable {\n            _ListView_this: ListView;\n            constructor(arg: ListView);\n            private mPosition;\n            private mPositionTop;\n            setup(position: number, top: number): ListView.FocusSelector;\n            run(): void;\n        }\n        class ArrowScrollFocusResult {\n            private mSelectedPosition;\n            private mAmountToScroll;\n            populate(selectedPosition: number, amountToScroll: number): void;\n            getSelectedPosition(): number;\n            getAmountToScroll(): number;\n        }\n    }\n}\ndeclare module android.widget {\n    class Scroller extends OverScroller {\n    }\n}\ndeclare module android.widget {\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n    import KeyEvent = android.view.KeyEvent;\n    import MotionEvent = android.view.MotionEvent;\n    import View = android.view.View;\n    import FrameLayout = android.widget.FrameLayout;\n    class ScrollView extends FrameLayout {\n        static ANIMATED_SCROLL_GAP: number;\n        static MAX_SCROLL_FACTOR: number;\n        private static TAG;\n        private mLastScroll;\n        private mTempRect;\n        private mScroller;\n        private mLastMotionY;\n        private mIsLayoutDirty;\n        private mChildToScrollTo;\n        private mIsBeingDragged;\n        private mVelocityTracker;\n        private mFillViewport;\n        private mSmoothScrollingEnabled;\n        private mMinimumVelocity;\n        private mMaximumVelocity;\n        private mOverscrollDistance;\n        private mOverflingDistance;\n        private mActivePointerId;\n        private static INVALID_POINTER;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        shouldDelayChildPressedState(): boolean;\n        protected getTopFadingEdgeStrength(): number;\n        protected getBottomFadingEdgeStrength(): number;\n        getMaxScrollAmount(): number;\n        private initScrollView();\n        addView(...args: any[]): void;\n        private canScroll();\n        isFillViewport(): boolean;\n        setFillViewport(fillViewport: boolean): void;\n        isSmoothScrollingEnabled(): boolean;\n        setSmoothScrollingEnabled(smoothScrollingEnabled: boolean): void;\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        dispatchKeyEvent(event: KeyEvent): boolean;\n        executeKeyEvent(event: KeyEvent): boolean;\n        private inChild(x, y);\n        private initOrResetVelocityTracker();\n        private initVelocityTrackerIfNotExists();\n        private recycleVelocityTracker();\n        requestDisallowInterceptTouchEvent(disallowIntercept: boolean): void;\n        onInterceptTouchEvent(ev: MotionEvent): boolean;\n        onTouchEvent(ev: MotionEvent): boolean;\n        private onSecondaryPointerUp(ev);\n        onGenericMotionEvent(event: MotionEvent): boolean;\n        protected onOverScrolled(scrollX: number, scrollY: number, clampedX: boolean, clampedY: boolean): void;\n        private getScrollRange();\n        private findFocusableViewInBounds(topFocus, top, bottom);\n        pageScroll(direction: number): boolean;\n        fullScroll(direction: number): boolean;\n        private scrollAndFocus(direction, top, bottom);\n        arrowScroll(direction: number): boolean;\n        private isOffScreen(descendant);\n        private isWithinDeltaOfScreen(descendant, delta, height);\n        private doScrollY(delta);\n        smoothScrollBy(dx: number, dy: number): void;\n        smoothScrollTo(x: number, y: number): void;\n        protected computeVerticalScrollRange(): number;\n        protected computeVerticalScrollOffset(): number;\n        protected measureChild(child: View, parentWidthMeasureSpec: number, parentHeightMeasureSpec: number): void;\n        protected measureChildWithMargins(child: View, parentWidthMeasureSpec: number, widthUsed: number, parentHeightMeasureSpec: number, heightUsed: number): void;\n        computeScroll(): void;\n        private scrollToChild(child);\n        private scrollToChildRect(rect, immediate);\n        protected computeScrollDeltaToGetChildRectOnScreen(rect: Rect): number;\n        requestChildFocus(child: View, focused: View): void;\n        protected onRequestFocusInDescendants(direction: number, previouslyFocusedRect: Rect): boolean;\n        requestChildRectangleOnScreen(child: View, rectangle: Rect, immediate: boolean): boolean;\n        requestLayout(): void;\n        protected onLayout(changed: boolean, l: number, t: number, r: number, b: number): void;\n        protected onSizeChanged(w: number, h: number, oldw: number, oldh: number): void;\n        private static isViewDescendantOf(child, parent);\n        fling(velocityY: number): void;\n        private endDrag();\n        scrollTo(x: number, y: number): void;\n        draw(canvas: Canvas): void;\n        private static clamp(n, my, child);\n    }\n}\ndeclare module android.util {\n    class ArrayMap<K, V> {\n        private map;\n        constructor(capacity?: number);\n        clear(): void;\n        erase(): void;\n        ensureCapacity(minimumCapacity: number): void;\n        containsKey(key: K): boolean;\n        indexOfValue(value: V): number;\n        containsValue(value: V): boolean;\n        get(key: K): V;\n        keyAt(index: number): K;\n        valueAt(index: number): V;\n        setValueAt(index: number, value: V): V;\n        isEmpty(): boolean;\n        put(key: K, value: V): V;\n        append(key: K, value: V): void;\n        remove(key: K): V;\n        removeAt(index: number): V;\n        keySet(): Set<K>;\n        size(): number;\n    }\n}\ndeclare module java.util {\n    class ArrayDeque<E> extends ArrayList<E> {\n        addFirst(e: E): void;\n        addLast(e: E): void;\n        offerFirst(e: E): boolean;\n        offerLast(e: E): boolean;\n        removeFirst(): E;\n        removeLast(): E;\n        pollFirst(): E;\n        pollLast(): E;\n        getFirst(): E;\n        getLast(): E;\n        peekFirst(): E;\n        peekLast(): E;\n        removeFirstOccurrence(o: any): boolean;\n        removeLastOccurrence(o: any): boolean;\n        offer(e: E): boolean;\n        remove(): E;\n        poll(): E;\n        element(): E;\n        peek(): E;\n        push(e: E): void;\n        pop(): E;\n        private delete(i);\n    }\n}\ndeclare module android.widget {\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n    import KeyEvent = android.view.KeyEvent;\n    import MotionEvent = android.view.MotionEvent;\n    import View = android.view.View;\n    import FrameLayout = android.widget.FrameLayout;\n    class HorizontalScrollView extends FrameLayout {\n        private static ANIMATED_SCROLL_GAP;\n        private static MAX_SCROLL_FACTOR;\n        private static TAG;\n        private mLastScroll;\n        private mTempRect;\n        private mScroller;\n        private mLastMotionX;\n        private mIsLayoutDirty;\n        private mChildToScrollTo;\n        private mIsBeingDragged;\n        private mVelocityTracker;\n        private mFillViewport;\n        private mSmoothScrollingEnabled;\n        private mMinimumVelocity;\n        private mMaximumVelocity;\n        private mOverscrollDistance;\n        private _mOverflingDistance;\n        private mOverflingDistance;\n        private mActivePointerId;\n        private static INVALID_POINTER;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        protected getLeftFadingEdgeStrength(): number;\n        protected getRightFadingEdgeStrength(): number;\n        getMaxScrollAmount(): number;\n        private initScrollView();\n        addView(...args: any[]): any;\n        private canScroll();\n        isFillViewport(): boolean;\n        setFillViewport(fillViewport: boolean): void;\n        isSmoothScrollingEnabled(): boolean;\n        setSmoothScrollingEnabled(smoothScrollingEnabled: boolean): void;\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        dispatchKeyEvent(event: KeyEvent): boolean;\n        executeKeyEvent(event: KeyEvent): boolean;\n        private inChild(x, y);\n        private initOrResetVelocityTracker();\n        private initVelocityTrackerIfNotExists();\n        private recycleVelocityTracker();\n        requestDisallowInterceptTouchEvent(disallowIntercept: boolean): void;\n        onInterceptTouchEvent(ev: MotionEvent): boolean;\n        onTouchEvent(ev: MotionEvent): boolean;\n        private onSecondaryPointerUp(ev);\n        onGenericMotionEvent(event: MotionEvent): boolean;\n        shouldDelayChildPressedState(): boolean;\n        protected onOverScrolled(scrollX: number, scrollY: number, clampedX: boolean, clampedY: boolean): void;\n        private getScrollRange();\n        private findFocusableViewInMyBounds(leftFocus, left, preferredFocusable);\n        private findFocusableViewInBounds(leftFocus, left, right);\n        pageScroll(direction: number): boolean;\n        fullScroll(direction: number): boolean;\n        private scrollAndFocus(direction, left, right);\n        arrowScroll(direction: number): boolean;\n        private isOffScreen(descendant);\n        private isWithinDeltaOfScreen(descendant, delta);\n        private doScrollX(delta);\n        smoothScrollBy(dx: number, dy: number): void;\n        smoothScrollTo(x: number, y: number): void;\n        protected computeHorizontalScrollRange(): number;\n        protected computeHorizontalScrollOffset(): number;\n        protected measureChild(child: View, parentWidthMeasureSpec: number, parentHeightMeasureSpec: number): void;\n        protected measureChildWithMargins(child: View, parentWidthMeasureSpec: number, widthUsed: number, parentHeightMeasureSpec: number, heightUsed: number): void;\n        computeScroll(): void;\n        private scrollToChild(child);\n        private scrollToChildRect(rect, immediate);\n        protected computeScrollDeltaToGetChildRectOnScreen(rect: Rect): number;\n        requestChildFocus(child: View, focused: View): void;\n        protected onRequestFocusInDescendants(direction: number, previouslyFocusedRect: Rect): boolean;\n        requestChildRectangleOnScreen(child: View, rectangle: Rect, immediate: boolean): boolean;\n        requestLayout(): void;\n        protected onLayout(changed: boolean, l: number, t: number, r: number, b: number): void;\n        protected onSizeChanged(w: number, h: number, oldw: number, oldh: number): void;\n        private static isViewDescendantOf(child, parent);\n        fling(velocityX: number): void;\n        scrollTo(x: number, y: number): void;\n        setOverScrollMode(mode: number): void;\n        draw(canvas: Canvas): void;\n        private static clamp(n, my, child);\n    }\n}\ndeclare module android.widget {\n    import ArrayMap = android.util.ArrayMap;\n    import SparseMap = android.util.SparseMap;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import Context = android.content.Context;\n    class RelativeLayout extends ViewGroup {\n        static TRUE: string;\n        static LEFT_OF: number;\n        static RIGHT_OF: number;\n        static ABOVE: number;\n        static BELOW: number;\n        static ALIGN_BASELINE: number;\n        static ALIGN_LEFT: number;\n        static ALIGN_TOP: number;\n        static ALIGN_RIGHT: number;\n        static ALIGN_BOTTOM: number;\n        static ALIGN_PARENT_LEFT: number;\n        static ALIGN_PARENT_TOP: number;\n        static ALIGN_PARENT_RIGHT: number;\n        static ALIGN_PARENT_BOTTOM: number;\n        static CENTER_IN_PARENT: number;\n        static CENTER_HORIZONTAL: number;\n        static CENTER_VERTICAL: number;\n        static START_OF: number;\n        static END_OF: number;\n        static ALIGN_START: number;\n        static ALIGN_END: number;\n        static ALIGN_PARENT_START: number;\n        static ALIGN_PARENT_END: number;\n        static VERB_COUNT: number;\n        private static RULES_VERTICAL;\n        private static RULES_HORIZONTAL;\n        private mBaselineView;\n        private mHasBaselineAlignedChild;\n        private mGravity;\n        private mContentBounds;\n        private mSelfBounds;\n        private mIgnoreGravity;\n        private mDirtyHierarchy;\n        private mSortedHorizontalChildren;\n        private mSortedVerticalChildren;\n        private mGraph;\n        private mAllowBrokenMeasureSpecs;\n        private mMeasureVerticalWithPaddingMargin;\n        private static DEFAULT_WIDTH;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        private queryCompatibilityModes();\n        shouldDelayChildPressedState(): boolean;\n        setIgnoreGravity(viewId: string): void;\n        getGravity(): number;\n        setGravity(gravity: number): void;\n        setHorizontalGravity(horizontalGravity: number): void;\n        setVerticalGravity(verticalGravity: number): void;\n        getBaseline(): number;\n        requestLayout(): void;\n        private sortChildren();\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        private alignBaseline(child, params);\n        private _measureChild(child, params, myWidth, myHeight);\n        private measureChildHorizontal(child, params, myWidth, myHeight);\n        private getChildMeasureSpec(childStart, childEnd, childSize, startMargin, endMargin, startPadding, endPadding, mySize);\n        private positionChildHorizontal(child, params, myWidth, wrapContent);\n        private positionChildVertical(child, params, myHeight, wrapContent);\n        private applyHorizontalSizeRules(childParams, myWidth, rules);\n        private applyVerticalSizeRules(childParams, myHeight);\n        private getRelatedView(rules, relation);\n        private getRelatedViewParams(rules, relation);\n        private getRelatedViewBaseline(rules, relation);\n        private static centerHorizontal(child, params, myWidth);\n        private static centerVertical(child, params, myHeight);\n        protected onLayout(changed: boolean, l: number, t: number, r: number, b: number): void;\n        generateLayoutParamsFromAttr(attrs: HTMLElement): android.view.ViewGroup.LayoutParams;\n        protected generateDefaultLayoutParams(): ViewGroup.LayoutParams;\n        protected checkLayoutParams(p: ViewGroup.LayoutParams): boolean;\n        protected generateLayoutParams(p: ViewGroup.LayoutParams): ViewGroup.LayoutParams;\n    }\n    module RelativeLayout {\n        class LayoutParams extends ViewGroup.MarginLayoutParams {\n            private mRules;\n            private mInitialRules;\n            mLeft: number;\n            mTop: number;\n            mRight: number;\n            mBottom: number;\n            private mStart;\n            private mEnd;\n            private mRulesChanged;\n            private mIsRtlCompatibilityMode;\n            alignWithParent: boolean;\n            constructor(context: Context, attrs: HTMLElement);\n            constructor(w: number, h: number);\n            constructor(source: RelativeLayout.LayoutParams);\n            constructor(source: ViewGroup.LayoutParams);\n            constructor(source: ViewGroup.MarginLayoutParams);\n            protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n            addRule(verb: number, anchor?: string): void;\n            removeRule(verb: number): void;\n            private hasRelativeRules();\n            private resolveRules(layoutDirection);\n            getRules(layoutDirection?: number): string[];\n            resolveLayoutDirection(layoutDirection: number): void;\n        }\n        class DependencyGraph {\n            private mNodes;\n            mKeyNodes: SparseMap<string, DependencyGraph.Node>;\n            private mRoots;\n            clear(): void;\n            add(view: View): void;\n            getSortedViews(sorted: View[], rules: number[]): void;\n            private findRoots(rulesFilter);\n        }\n        module DependencyGraph {\n            class Node {\n                view: View;\n                dependents: ArrayMap<Node, RelativeLayout.DependencyGraph>;\n                dependencies: SparseMap<string, Node>;\n                private static POOL_LIMIT;\n                private static sPool;\n                static acquire(view: View): Node;\n                release(): void;\n            }\n        }\n    }\n}\ndeclare module android.text.method {\n    class PasswordTransformationMethod extends SingleLineTransformationMethod {\n        private static instance;\n        getTransformation(source: String, v: android.view.View): String;\n        static getInstance(): PasswordTransformationMethod;\n    }\n}\ndeclare module android.widget {\n    import TextUtils = android.text.TextUtils;\n    import TextView = android.widget.TextView;\n    import Context = android.content.Context;\n    class EditText extends TextView {\n        private inputElement;\n        private mSingleLineInputElement;\n        private mMultiLineInputElement;\n        private mInputType;\n        private mForceDisableDraw;\n        private mMaxLength;\n        constructor(context: Context, bindElement?: HTMLElement, defStyle?: any);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        protected initBindElement(bindElement: HTMLElement): void;\n        protected onInputValueChange(e: any): void;\n        private onDomTextInput(e);\n        private switchToInputElement(inputElement);\n        private switchToSingleLineInputElement();\n        protected switchToMultiLineInputElement(): void;\n        protected tryShowInputElement(): void;\n        protected tryDismissInputElement(): void;\n        protected onInputElementFocusChanged(focused: boolean): void;\n        isInputElementShowed(): boolean;\n        performClick(event: android.view.MotionEvent): boolean;\n        protected onFocusChanged(focused: boolean, direction: number, previouslyFocusedRect: android.graphics.Rect): void;\n        protected setForceDisableDrawText(disable: boolean): void;\n        protected updateTextColors(): void;\n        onTouchEvent(event: android.view.MotionEvent): boolean;\n        private filterKeyEvent(event);\n        protected filterKeyCodeByInputType(keyCode: number): boolean;\n        protected filterKeyCodeOnInput(keyCode: number): boolean;\n        private checkFilterKeyEventToDom(event);\n        onKeyDown(keyCode: number, event: android.view.KeyEvent): boolean;\n        onKeyUp(keyCode: number, event: android.view.KeyEvent): boolean;\n        requestSyncBoundToElement(immediately?: boolean): void;\n        protected setRawTextSize(size: number): void;\n        protected onTextChanged(text: String, start: number, lengthBefore: number, lengthAfter: number): void;\n        protected onLayout(changed: boolean, left: number, top: number, right: number, bottom: number): void;\n        setGravity(gravity: number): void;\n        setSingleLine(singleLine?: boolean): void;\n        _setInputType(value: string): void;\n        setInputType(type: number): void;\n        getInputType(): number;\n        private syncTextBoundInfoToInputElement();\n        protected dependOnDebugLayout(): boolean;\n        setEllipsize(ellipsis: TextUtils.TruncateAt): void;\n    }\n}\ndeclare module android.widget {\n    import Canvas = android.graphics.Canvas;\n    import Matrix = android.graphics.Matrix;\n    import Drawable = android.graphics.drawable.Drawable;\n    import View = android.view.View;\n    class ImageView extends View {\n        private mUri;\n        private mMatrix;\n        private mScaleType;\n        private mHaveFrame;\n        private mAdjustViewBounds;\n        private mMaxWidth;\n        private mMaxHeight;\n        private mAlpha;\n        private mViewAlphaScale;\n        private mColorMod;\n        private mDrawable;\n        private mState;\n        private mMergeState;\n        private mLevel;\n        private mDrawableWidth;\n        private mDrawableHeight;\n        private mDrawMatrix;\n        private mTempSrc;\n        private mTempDst;\n        private mCropToPadding;\n        private mBaseline;\n        private mBaselineAlignBottom;\n        private mAdjustViewBoundsCompat;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        private initImageView();\n        protected verifyDrawable(dr: Drawable): boolean;\n        jumpDrawablesToCurrentState(): void;\n        invalidateDrawable(dr: Drawable): void;\n        drawableSizeChange(who: Drawable): void;\n        hasOverlappingRendering(): boolean;\n        getAdjustViewBounds(): boolean;\n        setAdjustViewBounds(adjustViewBounds: boolean): void;\n        getMaxWidth(): number;\n        setMaxWidth(maxWidth: number): void;\n        getMaxHeight(): number;\n        setMaxHeight(maxHeight: number): void;\n        getDrawable(): Drawable;\n        setImageURI(uri: string): void;\n        setImageDrawable(drawable: Drawable): void;\n        setImageState(state: number[], merge: boolean): void;\n        setSelected(selected: boolean): void;\n        setImageLevel(level: number): void;\n        setScaleType(scaleType: ImageView.ScaleType): void;\n        getScaleType(): ImageView.ScaleType;\n        getImageMatrix(): Matrix;\n        setImageMatrix(matrix: Matrix): void;\n        getCropToPadding(): boolean;\n        setCropToPadding(cropToPadding: boolean): void;\n        private resolveUri();\n        onCreateDrawableState(extraSpace: number): number[];\n        private updateDrawable(d);\n        protected resizeFromDrawable(): boolean;\n        private static sS2FArray;\n        private static scaleTypeToScaleToFit(st);\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        private resolveAdjustedSize(desiredSize, maxSize, measureSpec);\n        protected setFrame(l: number, t: number, r: number, b: number): boolean;\n        private configureBounds();\n        protected drawableStateChanged(): void;\n        protected onDraw(canvas: Canvas): void;\n        getBaseline(): number;\n        setBaseline(baseline: number): void;\n        setBaselineAlignBottom(aligned: boolean): void;\n        getBaselineAlignBottom(): boolean;\n        getImageAlpha(): number;\n        setImageAlpha(alpha: number): void;\n        private applyColorMod();\n        setVisibility(visibility: number): void;\n        protected onAttachedToWindow(): void;\n        protected onDetachedFromWindow(): void;\n        static parseScaleType(s: string, defaultType: ImageView.ScaleType): ImageView.ScaleType;\n    }\n    module ImageView {\n        enum ScaleType {\n            MATRIX = 0,\n            FIT_XY = 1,\n            FIT_START = 2,\n            FIT_CENTER = 3,\n            FIT_END = 4,\n            CENTER = 5,\n            CENTER_CROP = 6,\n            CENTER_INSIDE = 7,\n        }\n    }\n}\ndeclare module android.widget {\n    class ImageButton extends ImageView {\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n    }\n}\ndeclare module android.widget {\n    import Rect = android.graphics.Rect;\n    import KeyEvent = android.view.KeyEvent;\n    import AbsListView = android.widget.AbsListView;\n    import ListAdapter = android.widget.ListAdapter;\n    class GridView extends AbsListView {\n        static NO_STRETCH: number;\n        static STRETCH_SPACING: number;\n        static STRETCH_COLUMN_WIDTH: number;\n        static STRETCH_SPACING_UNIFORM: number;\n        static AUTO_FIT: number;\n        private mNumColumns;\n        private mHorizontalSpacing;\n        private mRequestedHorizontalSpacing;\n        private mVerticalSpacing;\n        private mStretchMode;\n        private mColumnWidth;\n        private mRequestedColumnWidth;\n        private mRequestedNumColumns;\n        private mReferenceView;\n        private mReferenceViewInSelectedRow;\n        private mGravity;\n        private mTempRect;\n        constructor(context: android.content.Context, attrs: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        getAdapter(): ListAdapter;\n        setAdapter(adapter: ListAdapter): void;\n        lookForSelectablePosition(position: number, lookDown: boolean): number;\n        fillGap(down: boolean): void;\n        private fillDown(pos, nextTop);\n        private makeRow(startPos, y, flow);\n        private fillUp(pos, nextBottom);\n        private fillFromTop(nextTop);\n        private fillFromBottom(lastPosition, nextBottom);\n        private fillSelection(childrenTop, childrenBottom);\n        private pinToTop(childrenTop);\n        private pinToBottom(childrenBottom);\n        findMotionRow(y: number): number;\n        private fillSpecific(position, top);\n        private correctTooHigh(numColumns, verticalSpacing, childCount);\n        private correctTooLow(numColumns, verticalSpacing, childCount);\n        private fillFromSelection(selectedTop, childrenTop, childrenBottom);\n        private getBottomSelectionPixel(childrenBottom, fadingEdgeLength, numColumns, rowStart);\n        private getTopSelectionPixel(childrenTop, fadingEdgeLength, rowStart);\n        private adjustForBottomFadingEdge(childInSelectedRow, topSelectionPixel, bottomSelectionPixel);\n        private adjustForTopFadingEdge(childInSelectedRow, topSelectionPixel, bottomSelectionPixel);\n        smoothScrollToPosition(position: number): void;\n        smoothScrollByOffset(offset: number): void;\n        private moveSelection(delta, childrenTop, childrenBottom);\n        private determineColumns(availableSpace);\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        protected layoutChildren(): void;\n        private makeAndAddView(position, y, flow, childrenLeft, selected, where);\n        private setupChild(child, position, y, flow, childrenLeft, selected, recycled, where);\n        setSelection(position: number): void;\n        setSelectionInt(position: number): void;\n        onKeyDown(keyCode: number, event: KeyEvent): boolean;\n        onKeyMultiple(keyCode: number, repeatCount: number, event: KeyEvent): boolean;\n        onKeyUp(keyCode: number, event: KeyEvent): boolean;\n        private commonKey(keyCode, count, event);\n        pageScroll(direction: number): boolean;\n        fullScroll(direction: number): boolean;\n        arrowScroll(direction: number): boolean;\n        sequenceScroll(direction: number): boolean;\n        protected onFocusChanged(gainFocus: boolean, direction: number, previouslyFocusedRect: Rect): void;\n        private isCandidateSelection(childIndex, direction);\n        setGravity(gravity: number): void;\n        getGravity(): number;\n        setHorizontalSpacing(horizontalSpacing: number): void;\n        getHorizontalSpacing(): number;\n        getRequestedHorizontalSpacing(): number;\n        setVerticalSpacing(verticalSpacing: number): void;\n        getVerticalSpacing(): number;\n        setStretchMode(stretchMode: number): void;\n        getStretchMode(): number;\n        setColumnWidth(columnWidth: number): void;\n        getColumnWidth(): number;\n        getRequestedColumnWidth(): number;\n        setNumColumns(numColumns: number): void;\n        getNumColumns(): number;\n        private adjustViewsUpOrDown();\n        protected computeVerticalScrollExtent(): number;\n        protected computeVerticalScrollOffset(): number;\n        protected computeVerticalScrollRange(): number;\n    }\n}\ndeclare module java.util {\n    interface Comparator<T> {\n        compare(o1: T, o2: T): number;\n    }\n}\ndeclare module java.lang {\n    interface Comparable<T> {\n        compareTo(o: T): number;\n    }\n    module Comparable {\n        function isImpl(obj: any): any;\n    }\n}\ndeclare module java.util {\n    class Collections {\n        private static EMPTY_LIST;\n        static emptyList(): List<any>;\n        static sort<T>(list: List<T>, c?: Comparator<T>): void;\n    }\n}\ndeclare module android.widget {\n    import Canvas = android.graphics.Canvas;\n    import KeyEvent = android.view.KeyEvent;\n    import MotionEvent = android.view.MotionEvent;\n    import Runnable = java.lang.Runnable;\n    import LinearLayout = android.widget.LinearLayout;\n    class NumberPicker extends LinearLayout {\n        private SELECTOR_WHEEL_ITEM_COUNT;\n        private static DEFAULT_LONG_PRESS_UPDATE_INTERVAL;\n        private SELECTOR_MIDDLE_ITEM_INDEX;\n        private static SELECTOR_MAX_FLING_VELOCITY_ADJUSTMENT;\n        private static SELECTOR_ADJUSTMENT_DURATION_MILLIS;\n        private static SNAP_SCROLL_DURATION;\n        private static TOP_AND_BOTTOM_FADING_EDGE_STRENGTH;\n        private static UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT;\n        private static UNSCALED_DEFAULT_SELECTION_DIVIDERS_DISTANCE;\n        private static SIZE_UNSPECIFIED;\n        private static sTwoDigitFormatter;\n        static getTwoDigitFormatter(): NumberPicker.Formatter;\n        private mSelectionDividersDistance;\n        private mMinHeight_;\n        private mMaxHeight;\n        private mMinWidth_;\n        private mMaxWidth;\n        private mComputeMaxWidth;\n        private mTextSize;\n        private mSelectorTextGapHeight;\n        private mDisplayedValues;\n        private mMinValue;\n        private mMaxValue;\n        private mValue;\n        private mOnValueChangeListener;\n        private mOnScrollListener;\n        private mFormatter;\n        private mLongPressUpdateInterval;\n        private mSelectorIndexToStringCache;\n        private mSelectorIndices;\n        private mSelectorWheelPaint;\n        private mVirtualButtonPressedDrawable;\n        private mSelectorElementHeight;\n        private mInitialScrollOffset;\n        private mCurrentScrollOffset;\n        private mFlingScroller;\n        private mAdjustScroller;\n        private mPreviousScrollerY;\n        private mSetSelectionCommand;\n        private mChangeCurrentByOneFromLongPressCommand;\n        private mBeginSoftInputOnLongPressCommand;\n        private mLastDownEventY;\n        private mLastDownEventTime;\n        private mLastDownOrMoveEventY;\n        private mVelocityTracker;\n        private mMinimumFlingVelocity;\n        private mMaximumFlingVelocity;\n        private mWrapSelectorWheel;\n        private mSolidColor;\n        private mHasSelectorWheel;\n        private mSelectionDivider;\n        private mSelectionDividerHeight;\n        private mScrollState;\n        private mIngonreMoveEvents;\n        private mShowSoftInputOnTap;\n        private mTopSelectionDividerTop;\n        private mBottomSelectionDividerBottom;\n        private mLastHoveredChildVirtualViewId;\n        private mIncrementVirtualButtonPressed;\n        private mDecrementVirtualButtonPressed;\n        private mPressedStateHelper;\n        private mLastHandledDownDpadKeyCode;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        protected onLayout(changed: boolean, left: number, top: number, right: number, bottom: number): void;\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        private moveToFinalScrollerPosition(scroller);\n        onInterceptTouchEvent(event: MotionEvent): boolean;\n        onTouchEvent(event: MotionEvent): boolean;\n        dispatchTouchEvent(event: MotionEvent): boolean;\n        dispatchKeyEvent(event: KeyEvent): boolean;\n        computeScroll(): void;\n        setEnabled(enabled: boolean): void;\n        scrollBy(x: number, y: number): void;\n        protected computeVerticalScrollOffset(): number;\n        protected computeVerticalScrollRange(): number;\n        protected computeVerticalScrollExtent(): number;\n        getSolidColor(): number;\n        setOnValueChangedListener(onValueChangedListener: NumberPicker.OnValueChangeListener): void;\n        setOnScrollListener(onScrollListener: NumberPicker.OnScrollListener): void;\n        setFormatter(formatter: NumberPicker.Formatter): void;\n        setValue(value: number): void;\n        private showSoftInput();\n        private hideSoftInput();\n        private tryComputeMaxWidth();\n        getWrapSelectorWheel(): boolean;\n        setWrapSelectorWheel(wrapSelectorWheel: boolean): void;\n        setOnLongPressUpdateInterval(intervalMillis: number): void;\n        getValue(): number;\n        getMinValue(): number;\n        setMinValue(minValue: number): void;\n        getMaxValue(): number;\n        setMaxValue(maxValue: number): void;\n        getDisplayedValues(): string[];\n        setDisplayedValues(displayedValues: string[]): void;\n        protected getTopFadingEdgeStrength(): number;\n        protected getBottomFadingEdgeStrength(): number;\n        protected onDetachedFromWindow(): void;\n        protected onDraw(canvas: Canvas): void;\n        private makeMeasureSpec(measureSpec, maxSize);\n        private resolveSizeAndStateRespectingMinSize(minSize, measuredSize, measureSpec);\n        private initializeSelectorWheelIndices();\n        private setValueInternal(current, notifyChange);\n        private changeValueByOne(increment);\n        private initializeSelectorWheel();\n        private initializeFadingEdges();\n        private onScrollerFinished(scroller);\n        private onScrollStateChange(scrollState);\n        private fling(velocityY);\n        private getWrappedSelectorIndex(selectorIndex);\n        private incrementSelectorIndices(selectorIndices);\n        private decrementSelectorIndices(selectorIndices);\n        private ensureCachedScrollSelectorValue(selectorIndex);\n        private formatNumber(value);\n        private validateInputTextView(v);\n        private updateInputTextView();\n        private notifyChange(previous, current);\n        private postChangeCurrentByOneFromLongPress(increment, delayMillis);\n        private removeChangeCurrentByOneFromLongPress();\n        private postBeginSoftInputOnLongPressCommand();\n        private removeBeginSoftInputCommand();\n        private removeAllCallbacks();\n        private getSelectedPos(value);\n        private postSetSelectionCommand(selectionStart, selectionEnd);\n        private ensureScrollWheelAdjusted();\n        private static formatNumberWithLocale(value);\n    }\n    module NumberPicker {\n        class TwoDigitFormatter implements NumberPicker.Formatter {\n            format(value: number): string;\n        }\n        interface OnValueChangeListener {\n            onValueChange(picker: NumberPicker, oldVal: number, newVal: number): void;\n        }\n        interface OnScrollListener {\n            onScrollStateChange(view: NumberPicker, scrollState: number): void;\n        }\n        module OnScrollListener {\n            var SCROLL_STATE_IDLE: number;\n            var SCROLL_STATE_TOUCH_SCROLL: number;\n            var SCROLL_STATE_FLING: number;\n        }\n        interface Formatter {\n            format(value: number): string;\n        }\n        class PressedStateHelper implements Runnable {\n            _NumberPicker_this: NumberPicker;\n            constructor(arg: NumberPicker);\n            static BUTTON_INCREMENT: number;\n            static BUTTON_DECREMENT: number;\n            private MODE_PRESS;\n            private MODE_TAPPED;\n            private mManagedButton;\n            private mMode;\n            cancel(): void;\n            buttonPressDelayed(button: number): void;\n            buttonTapped(button: number): void;\n            run(): void;\n        }\n        class SetSelectionCommand implements Runnable {\n            _NumberPicker_this: NumberPicker;\n            constructor(arg: NumberPicker);\n            private mSelectionStart;\n            private mSelectionEnd;\n            run(): void;\n        }\n        class ChangeCurrentByOneFromLongPressCommand implements Runnable {\n            _NumberPicker_this: NumberPicker;\n            constructor(arg: NumberPicker);\n            private mIncrement;\n            setStep(increment: boolean): void;\n            run(): void;\n        }\n        class BeginSoftInputOnLongPressCommand implements Runnable {\n            _NumberPicker_this: NumberPicker;\n            constructor(arg: NumberPicker);\n            run(): void;\n        }\n    }\n}\ndeclare module android.graphics.drawable {\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n    import Resources = android.content.res.Resources;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Runnable = java.lang.Runnable;\n    class ClipDrawable extends Drawable implements Drawable.Callback {\n        private mClipState;\n        private mTmpRect;\n        static HORIZONTAL: number;\n        static VERTICAL: number;\n        constructor(state?: ClipDrawable.ClipState);\n        constructor(drawable: Drawable, gravity: number, orientation: number);\n        inflate(r: Resources, parser: HTMLElement): void;\n        drawableSizeChange(who: android.graphics.drawable.Drawable): void;\n        invalidateDrawable(who: Drawable): void;\n        scheduleDrawable(who: Drawable, what: Runnable, when: number): void;\n        unscheduleDrawable(who: Drawable, what: Runnable): void;\n        getPadding(padding: Rect): boolean;\n        setVisible(visible: boolean, restart: boolean): boolean;\n        setAlpha(alpha: number): void;\n        getAlpha(): number;\n        getOpacity(): number;\n        isStateful(): boolean;\n        protected onStateChange(state: number[]): boolean;\n        protected onLevelChange(level: number): boolean;\n        protected onBoundsChange(bounds: Rect): void;\n        draw(canvas: Canvas): void;\n        getIntrinsicWidth(): number;\n        getIntrinsicHeight(): number;\n        getConstantState(): Drawable.ConstantState;\n    }\n    module ClipDrawable {\n        class ClipState implements Drawable.ConstantState {\n            mDrawable: Drawable;\n            mOrientation: number;\n            mGravity: number;\n            private mCheckedConstantState;\n            private mCanConstantState;\n            constructor(orig: ClipState, owner: ClipDrawable);\n            newDrawable(): Drawable;\n            canConstantState(): boolean;\n        }\n    }\n}\ndeclare module android.widget {\n    import Canvas = android.graphics.Canvas;\n    import Drawable = android.graphics.drawable.Drawable;\n    import View = android.view.View;\n    import Interpolator = android.view.animation.Interpolator;\n    import NetDrawable = androidui.image.NetDrawable;\n    class ProgressBar extends View {\n        private static MAX_LEVEL;\n        private static TIMEOUT_SEND_ACCESSIBILITY_EVENT;\n        mMinWidth: number;\n        mMaxWidth: number;\n        mMinHeight: number;\n        mMaxHeight: number;\n        private mProgress;\n        private mSecondaryProgress;\n        private mMax;\n        private mBehavior;\n        private mDuration;\n        private mIndeterminate;\n        private mOnlyIndeterminate;\n        private mTransformation;\n        private mAnimation;\n        private mHasAnimation;\n        private mIndeterminateDrawable;\n        private mProgressDrawable;\n        private mCurrentDrawable;\n        protected mSampleTile: NetDrawable;\n        private mNoInvalidate;\n        private mInterpolator;\n        private mShouldStartAnimationDrawable;\n        private mInDrawing;\n        private mAttached;\n        private mRefreshIsPosted;\n        mMirrorForRtl: boolean;\n        private mRefreshData;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        private tileify(drawable, clip);\n        private tileifyIndeterminate(drawable);\n        private initProgressBar();\n        isIndeterminate(): boolean;\n        setIndeterminate(indeterminate: boolean): void;\n        getIndeterminateDrawable(): Drawable;\n        setIndeterminateDrawable(d: Drawable): void;\n        getProgressDrawable(): Drawable;\n        setProgressDrawable(d: Drawable): void;\n        getCurrentDrawable(): Drawable;\n        protected verifyDrawable(who: Drawable): boolean;\n        jumpDrawablesToCurrentState(): void;\n        postInvalidate(): void;\n        private doRefreshProgress(id, progress, fromUser, callBackToApp);\n        onProgressRefresh(scale: number, fromUser: boolean): void;\n        private refreshProgress(id, progress, fromUser);\n        setProgress(progress: number, fromUser?: boolean): void;\n        setSecondaryProgress(secondaryProgress: number): void;\n        getProgress(): number;\n        getSecondaryProgress(): number;\n        getMax(): number;\n        setMax(max: number): void;\n        incrementProgressBy(diff: number): void;\n        incrementSecondaryProgressBy(diff: number): void;\n        startAnimation(): void;\n        stopAnimation(): void;\n        setInterpolator(interpolator: Interpolator): void;\n        getInterpolator(): Interpolator;\n        setVisibility(v: number): void;\n        protected onVisibilityChanged(changedView: View, visibility: number): void;\n        invalidateDrawable(dr: Drawable): void;\n        protected onSizeChanged(w: number, h: number, oldw: number, oldh: number): void;\n        private updateDrawableBounds(w, h);\n        protected onDraw(canvas: Canvas): void;\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        protected drawableStateChanged(): void;\n        private updateDrawableState();\n        protected onAttachedToWindow(): void;\n        protected onDetachedFromWindow(): void;\n    }\n    module ProgressBar {\n        class RefreshData {\n            private static POOL_MAX;\n            private static sPool;\n            id: string;\n            progress: number;\n            fromUser: boolean;\n            static obtain(id: string, progress: number, fromUser: boolean): RefreshData;\n            recycle(): void;\n        }\n    }\n}\ndeclare module android.widget {\n    import Canvas = android.graphics.Canvas;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Button = android.widget.Button;\n    import Checkable = android.widget.Checkable;\n    abstract class CompoundButton extends Button implements Checkable {\n        private mChecked;\n        private mButtonResource;\n        private mBroadcasting;\n        private mButtonDrawable;\n        private mOnCheckedChangeListener;\n        private mOnCheckedChangeWidgetListener;\n        private static CHECKED_STATE_SET;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        toggle(): void;\n        performClick(): boolean;\n        isChecked(): boolean;\n        setChecked(checked: boolean): void;\n        setOnCheckedChangeListener(listener: CompoundButton.OnCheckedChangeListener): void;\n        setOnCheckedChangeWidgetListener(listener: CompoundButton.OnCheckedChangeListener): void;\n        setButtonDrawable(d: Drawable): void;\n        getCompoundPaddingLeft(): number;\n        getCompoundPaddingRight(): number;\n        getHorizontalOffsetForDrawables(): number;\n        protected onDraw(canvas: Canvas): void;\n        protected onCreateDrawableState(extraSpace: number): number[];\n        protected drawableStateChanged(): void;\n        drawableSizeChange(d: android.graphics.drawable.Drawable): void;\n        protected verifyDrawable(who: Drawable): boolean;\n        jumpDrawablesToCurrentState(): void;\n    }\n    module CompoundButton {\n        interface OnCheckedChangeListener {\n            onCheckedChanged(buttonView: CompoundButton, isChecked: boolean): void;\n        }\n    }\n}\ndeclare module android.widget {\n    import CompoundButton = android.widget.CompoundButton;\n    class CheckBox extends CompoundButton {\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n    }\n}\ndeclare module android.widget {\n    import CompoundButton = android.widget.CompoundButton;\n    class RadioButton extends CompoundButton {\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        toggle(): void;\n    }\n}\ndeclare module android.widget {\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import CompoundButton = android.widget.CompoundButton;\n    import LinearLayout = android.widget.LinearLayout;\n    class RadioGroup extends LinearLayout {\n        private mCheckedId;\n        private mChildOnCheckedChangeListener;\n        private mProtectFromCheckedChange;\n        private mOnCheckedChangeListener;\n        private mPassThroughListener;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        private init();\n        setOnHierarchyChangeListener(listener: ViewGroup.OnHierarchyChangeListener): void;\n        protected onFinishInflate(): void;\n        addView(...args: any[]): void;\n        check(id: string): void;\n        private setCheckedId(id);\n        private setCheckedStateForView(viewId, checked);\n        getCheckedRadioButtonId(): string;\n        clearCheck(): void;\n        setOnCheckedChangeListener(listener: RadioGroup.OnCheckedChangeListener): void;\n        generateLayoutParamsFromAttr(attrs: HTMLElement): android.view.ViewGroup.LayoutParams;\n        protected checkLayoutParams(p: ViewGroup.LayoutParams): boolean;\n        protected generateDefaultLayoutParams(): LinearLayout.LayoutParams;\n    }\n    module RadioGroup {\n        class LayoutParams extends LinearLayout.LayoutParams {\n            protected setBaseAttributes(a: android.content.res.TypedArray, widthAttr: string, heightAttr: string): void;\n        }\n        interface OnCheckedChangeListener {\n            onCheckedChanged(group: RadioGroup, checkedId: string): void;\n        }\n        class CheckedStateTracker implements CompoundButton.OnCheckedChangeListener {\n            _RadioGroup_this: RadioGroup;\n            constructor(arg: RadioGroup);\n            onCheckedChanged(buttonView: CompoundButton, isChecked: boolean): void;\n        }\n        class PassThroughHierarchyChangeListener implements ViewGroup.OnHierarchyChangeListener {\n            _RadioGroup_this: RadioGroup;\n            constructor(arg: RadioGroup);\n            private mOnHierarchyChangeListener;\n            onChildViewAdded(parent: View, child: View): void;\n            onChildViewRemoved(parent: View, child: View): void;\n        }\n    }\n}\ndeclare module android.widget {\n    import Canvas = android.graphics.Canvas;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Checkable = android.widget.Checkable;\n    import TextView = android.widget.TextView;\n    import Context = android.content.Context;\n    class CheckedTextView extends TextView implements Checkable {\n        private mChecked;\n        private mCheckMarkResource;\n        private mCheckMarkDrawable;\n        private mBasePadding;\n        private mCheckMarkWidth;\n        private mNeedRequestlayout;\n        private static CHECKED_STATE_SET;\n        constructor(context: Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        toggle(): void;\n        isChecked(): boolean;\n        setChecked(checked: boolean): void;\n        setCheckMarkDrawable(d: Drawable): void;\n        getCheckMarkDrawable(): Drawable;\n        setPadding(left: number, top: number, right: number, bottom: number): void;\n        private updatePadding();\n        private setBasePadding(isLayoutRtl);\n        protected onDraw(canvas: Canvas): void;\n        protected onCreateDrawableState(extraSpace: number): number[];\n        protected drawableStateChanged(): void;\n    }\n}\ndeclare module android.widget {\n    import Canvas = android.graphics.Canvas;\n    import Drawable = android.graphics.drawable.Drawable;\n    import KeyEvent = android.view.KeyEvent;\n    import MotionEvent = android.view.MotionEvent;\n    import ProgressBar = android.widget.ProgressBar;\n    abstract class AbsSeekBar extends ProgressBar {\n        private mThumb;\n        private mThumbOffset;\n        mTouchProgressOffset: number;\n        mIsUserSeekable: boolean;\n        private mKeyProgressIncrement;\n        private static NO_ALPHA;\n        private mDisabledAlpha;\n        private mTouchDownX;\n        private mIsDragging;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        setThumb(thumb: Drawable): void;\n        getThumb(): Drawable;\n        getThumbOffset(): number;\n        setThumbOffset(thumbOffset: number): void;\n        setKeyProgressIncrement(increment: number): void;\n        getKeyProgressIncrement(): number;\n        setMax(max: number): void;\n        protected verifyDrawable(who: Drawable): boolean;\n        jumpDrawablesToCurrentState(): void;\n        protected drawableStateChanged(): void;\n        onProgressRefresh(scale: number, fromUser: boolean): void;\n        protected onSizeChanged(w: number, h: number, oldw: number, oldh: number): void;\n        private updateThumbPos(w, h);\n        private setThumbPos(w, thumb, scale, gap);\n        protected onDraw(canvas: Canvas): void;\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        onTouchEvent(event: MotionEvent): boolean;\n        private trackTouchEvent(event);\n        private attemptClaimDrag();\n        onStartTrackingTouch(): void;\n        onStopTrackingTouch(): void;\n        onKeyChange(): void;\n        onKeyDown(keyCode: number, event: KeyEvent): boolean;\n    }\n}\ndeclare module android.widget {\n    import AbsSeekBar = android.widget.AbsSeekBar;\n    class SeekBar extends AbsSeekBar {\n        private mOnSeekBarChangeListener;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        onProgressRefresh(scale: number, fromUser: boolean): void;\n        setOnSeekBarChangeListener(l: SeekBar.OnSeekBarChangeListener): void;\n        onStartTrackingTouch(): void;\n        onStopTrackingTouch(): void;\n    }\n    module SeekBar {\n        interface OnSeekBarChangeListener {\n            onProgressChanged(seekBar: SeekBar, progress: number, fromUser: boolean): void;\n            onStartTrackingTouch(seekBar: SeekBar): void;\n            onStopTrackingTouch(seekBar: SeekBar): void;\n        }\n    }\n}\ndeclare module android.widget {\n    import AbsSeekBar = android.widget.AbsSeekBar;\n    class RatingBar extends AbsSeekBar {\n        private mNumStars;\n        private mProgressOnStartTracking;\n        private mOnRatingBarChangeListener;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        setOnRatingBarChangeListener(listener: RatingBar.OnRatingBarChangeListener): void;\n        getOnRatingBarChangeListener(): RatingBar.OnRatingBarChangeListener;\n        setIsIndicator(isIndicator: boolean): void;\n        isIndicator(): boolean;\n        setNumStars(numStars: number): void;\n        getNumStars(): number;\n        setRating(rating: number): void;\n        getRating(): number;\n        setStepSize(stepSize: number): void;\n        getStepSize(): number;\n        private getProgressPerStar();\n        onProgressRefresh(scale: number, fromUser: boolean): void;\n        private updateSecondaryProgress(progress);\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        onStartTrackingTouch(): void;\n        onStopTrackingTouch(): void;\n        onKeyChange(): void;\n        dispatchRatingChange(fromUser: boolean): void;\n        setMax(max: number): void;\n    }\n    module RatingBar {\n        interface OnRatingBarChangeListener {\n            onRatingChanged(ratingBar: RatingBar, rating: number, fromUser: boolean): void;\n        }\n    }\n}\ndeclare module android.widget {\n    import DataSetObserver = android.database.DataSetObserver;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    interface ExpandableListAdapter {\n        registerDataSetObserver(observer: DataSetObserver): void;\n        unregisterDataSetObserver(observer: DataSetObserver): void;\n        getGroupCount(): number;\n        getChildrenCount(groupPosition: number): number;\n        getGroup(groupPosition: number): any;\n        getChild(groupPosition: number, childPosition: number): any;\n        getGroupId(groupPosition: number): number;\n        getChildId(groupPosition: number, childPosition: number): number;\n        hasStableIds(): boolean;\n        getGroupView(groupPosition: number, isExpanded: boolean, convertView: View, parent: ViewGroup): View;\n        getChildView(groupPosition: number, childPosition: number, isLastChild: boolean, convertView: View, parent: ViewGroup): View;\n        isChildSelectable(groupPosition: number, childPosition: number): boolean;\n        areAllItemsEnabled(): boolean;\n        isEmpty(): boolean;\n        onGroupExpanded(groupPosition: number): void;\n        onGroupCollapsed(groupPosition: number): void;\n        getCombinedChildId(groupId: number, childId: number): number;\n        getCombinedGroupId(groupId: number): number;\n    }\n}\ndeclare module android.widget {\n    class ExpandableListPosition {\n        private static MAX_POOL_SIZE;\n        private static sPool;\n        static CHILD: number;\n        static GROUP: number;\n        groupPos: number;\n        childPos: number;\n        flatListPos: number;\n        type: number;\n        private resetState();\n        constructor();\n        getPackedPosition(): number;\n        static obtainGroupPosition(groupPosition: number): ExpandableListPosition;\n        static obtainChildPosition(groupPosition: number, childPosition: number): ExpandableListPosition;\n        static obtainPosition(packedPosition: number): ExpandableListPosition;\n        static obtain(type: number, groupPos: number, childPos: number, flatListPos: number): ExpandableListPosition;\n        private static getRecycledOrCreate();\n        recycle(): void;\n    }\n}\ndeclare module android.widget {\n    interface HeterogeneousExpandableList {\n        getGroupType(groupPosition: number): number;\n        getChildType(groupPosition: number, childPosition: number): number;\n        getGroupTypeCount(): number;\n        getChildTypeCount(): number;\n    }\n    module HeterogeneousExpandableList {\n        function isImpl(obj: any): boolean;\n    }\n}\ndeclare module android.widget {\n    import DataSetObserver = android.database.DataSetObserver;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import ArrayList = java.util.ArrayList;\n    import Comparable = java.lang.Comparable;\n    import BaseAdapter = android.widget.BaseAdapter;\n    import ExpandableListAdapter = android.widget.ExpandableListAdapter;\n    import ExpandableListPosition = android.widget.ExpandableListPosition;\n    class ExpandableListConnector extends BaseAdapter {\n        private mExpandableListAdapter;\n        private mExpGroupMetadataList;\n        private mTotalExpChildrenCount;\n        private mMaxExpGroupCount;\n        private mDataSetObserver;\n        constructor(expandableListAdapter: ExpandableListAdapter);\n        setExpandableListAdapter(expandableListAdapter: ExpandableListAdapter): void;\n        getUnflattenedPos(flPos: number): ExpandableListConnector.PositionMetadata;\n        getFlattenedPos(pos: ExpandableListPosition): ExpandableListConnector.PositionMetadata;\n        areAllItemsEnabled(): boolean;\n        isEnabled(flatListPos: number): boolean;\n        getCount(): number;\n        getItem(flatListPos: number): any;\n        getItemId(flatListPos: number): number;\n        getView(flatListPos: number, convertView: View, parent: ViewGroup): View;\n        getItemViewType(flatListPos: number): number;\n        getViewTypeCount(): number;\n        hasStableIds(): boolean;\n        private refreshExpGroupMetadataList(forceChildrenCountRefresh, syncGroupPositions);\n        collapseGroup(groupPos: number): boolean;\n        collapseGroupWithMeta(posMetadata: ExpandableListConnector.PositionMetadata): boolean;\n        expandGroup(groupPos: number): boolean;\n        expandGroupWithMeta(posMetadata: ExpandableListConnector.PositionMetadata): boolean;\n        isGroupExpanded(groupPosition: number): boolean;\n        setMaxExpGroupCount(maxExpGroupCount: number): void;\n        getAdapter(): ExpandableListAdapter;\n        getExpandedGroupMetadataList(): ArrayList<ExpandableListConnector.GroupMetadata>;\n        setExpandedGroupMetadataList(expandedGroupMetadataList: ArrayList<ExpandableListConnector.GroupMetadata>): void;\n        isEmpty(): boolean;\n        findGroupPosition(groupIdToMatch: number, seedGroupPosition: number): number;\n    }\n    module ExpandableListConnector {\n        class MyDataSetObserver extends DataSetObserver {\n            _ExpandableListConnector_this: ExpandableListConnector;\n            constructor(arg: ExpandableListConnector);\n            onChanged(): void;\n            onInvalidated(): void;\n        }\n        class GroupMetadata implements Comparable<GroupMetadata> {\n            static REFRESH: number;\n            flPos: number;\n            lastChildFlPos: number;\n            gPos: number;\n            gId: number;\n            constructor();\n            static obtain(flPos: number, lastChildFlPos: number, gPos: number, gId: number): GroupMetadata;\n            compareTo(another: GroupMetadata): number;\n        }\n        class PositionMetadata {\n            private static MAX_POOL_SIZE;\n            private static sPool;\n            position: ExpandableListPosition;\n            groupMetadata: ExpandableListConnector.GroupMetadata;\n            groupInsertIndex: number;\n            private resetState();\n            constructor();\n            static obtain(flatListPos: number, type: number, groupPos: number, childPos: number, groupMetadata: ExpandableListConnector.GroupMetadata, groupInsertIndex: number): PositionMetadata;\n            private static getRecycledOrCreate();\n            recycle(): void;\n            isExpanded(): boolean;\n        }\n    }\n}\ndeclare module android.widget {\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n    import Drawable = android.graphics.drawable.Drawable;\n    import View = android.view.View;\n    import AdapterView = android.widget.AdapterView;\n    import ExpandableListAdapter = android.widget.ExpandableListAdapter;\n    import ListAdapter = android.widget.ListAdapter;\n    import ListView = android.widget.ListView;\n    class ExpandableListView extends ListView {\n        static PACKED_POSITION_TYPE_GROUP: number;\n        static PACKED_POSITION_TYPE_CHILD: number;\n        static PACKED_POSITION_TYPE_NULL: number;\n        static PACKED_POSITION_VALUE_NULL: number;\n        private static PACKED_POSITION_MASK_CHILD;\n        private static PACKED_POSITION_MASK_GROUP;\n        private static PACKED_POSITION_MASK_TYPE;\n        private static PACKED_POSITION_SHIFT_GROUP;\n        private static PACKED_POSITION_SHIFT_TYPE;\n        private static PACKED_POSITION_INT_MASK_CHILD;\n        private static PACKED_POSITION_INT_MASK_GROUP;\n        private mConnector;\n        private mExpandAdapter;\n        private mIndicatorLeft;\n        private mIndicatorRight;\n        private mIndicatorStart;\n        private mIndicatorEnd;\n        private mChildIndicatorLeft;\n        private mChildIndicatorRight;\n        private mChildIndicatorStart;\n        private mChildIndicatorEnd;\n        static CHILD_INDICATOR_INHERIT: number;\n        private static INDICATOR_UNDEFINED;\n        private mGroupIndicator;\n        private mChildIndicator;\n        private static GROUP_EXPANDED_STATE_SET;\n        private static GROUP_EMPTY_STATE_SET;\n        private static GROUP_EXPANDED_EMPTY_STATE_SET;\n        private static GROUP_STATE_SETS;\n        private static CHILD_LAST_STATE_SET;\n        private mChildDivider;\n        private mIndicatorRect;\n        constructor(context: android.content.Context, attrs?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        private isRtlCompatibilityMode();\n        private hasRtlSupport();\n        onRtlPropertiesChanged(layoutDirection: number): void;\n        private resolveIndicator();\n        private resolveChildIndicator();\n        protected dispatchDraw(canvas: Canvas): void;\n        private getIndicator(pos);\n        setChildDivider(childDivider: Drawable): void;\n        drawDivider(canvas: Canvas, bounds: Rect, childIndex: number): void;\n        setAdapter(adapter: ListAdapter): void;\n        getAdapter(): ListAdapter;\n        setOnItemClickListener(l: AdapterView.OnItemClickListener): void;\n        setExpandableAdapter(adapter: ExpandableListAdapter): void;\n        getExpandableListAdapter(): ExpandableListAdapter;\n        private isHeaderOrFooterPosition(position);\n        private getFlatPositionForConnector(flatListPosition);\n        private getAbsoluteFlatPosition(flatListPosition);\n        performItemClick(v: View, position: number, id: number): boolean;\n        handleItemClick(v: View, position: number, id: number): boolean;\n        expandGroup(groupPos: number, animate?: boolean): boolean;\n        collapseGroup(groupPos: number): boolean;\n        private mOnGroupCollapseListener;\n        setOnGroupCollapseListener(onGroupCollapseListener: ExpandableListView.OnGroupCollapseListener): void;\n        private mOnGroupExpandListener;\n        setOnGroupExpandListener(onGroupExpandListener: ExpandableListView.OnGroupExpandListener): void;\n        private mOnGroupClickListener;\n        setOnGroupClickListener(onGroupClickListener: ExpandableListView.OnGroupClickListener): void;\n        private mOnChildClickListener;\n        setOnChildClickListener(onChildClickListener: ExpandableListView.OnChildClickListener): void;\n        getExpandableListPosition(flatListPosition: number): number;\n        getFlatListPosition(packedPosition: number): number;\n        getSelectedPosition(): number;\n        getSelectedId(): number;\n        setSelectedGroup(groupPosition: number): void;\n        setSelectedChild(groupPosition: number, childPosition: number, shouldExpandGroup: boolean): boolean;\n        isGroupExpanded(groupPosition: number): boolean;\n        static getPackedPositionType(packedPosition: number): number;\n        static getPackedPositionGroup(packedPosition: number): number;\n        static getPackedPositionChild(packedPosition: number): number;\n        static getPackedPositionForChild(groupPosition: number, childPosition: number): number;\n        static getPackedPositionForGroup(groupPosition: number): number;\n        private getChildOrGroupId(position);\n        setChildIndicator(childIndicator: Drawable): void;\n        setChildIndicatorBounds(left: number, right: number): void;\n        setChildIndicatorBoundsRelative(start: number, end: number): void;\n        setGroupIndicator(groupIndicator: Drawable): void;\n        setIndicatorBounds(left: number, right: number): void;\n        setIndicatorBoundsRelative(start: number, end: number): void;\n    }\n    module ExpandableListView {\n        interface OnGroupCollapseListener {\n            onGroupCollapse(groupPosition: number): void;\n        }\n        interface OnGroupExpandListener {\n            onGroupExpand(groupPosition: number): void;\n        }\n        interface OnGroupClickListener {\n            onGroupClick(parent: ExpandableListView, v: View, groupPosition: number, id: number): boolean;\n        }\n        interface OnChildClickListener {\n            onChildClick(parent: ExpandableListView, v: View, groupPosition: number, childPosition: number, id: number): boolean;\n        }\n    }\n}\ndeclare module android.widget {\n    import DataSetObserver = android.database.DataSetObserver;\n    import ExpandableListAdapter = android.widget.ExpandableListAdapter;\n    import HeterogeneousExpandableList = android.widget.HeterogeneousExpandableList;\n    abstract class BaseExpandableListAdapter implements ExpandableListAdapter, HeterogeneousExpandableList {\n        private mDataSetObservable;\n        registerDataSetObserver(observer: DataSetObserver): void;\n        unregisterDataSetObserver(observer: DataSetObserver): void;\n        notifyDataSetInvalidated(): void;\n        notifyDataSetChanged(): void;\n        areAllItemsEnabled(): boolean;\n        onGroupCollapsed(groupPosition: number): void;\n        onGroupExpanded(groupPosition: number): void;\n        getCombinedChildId(groupId: number, childId: number): number;\n        getCombinedGroupId(groupId: number): number;\n        isEmpty(): boolean;\n        getChildType(groupPosition: number, childPosition: number): number;\n        getChildTypeCount(): number;\n        getGroupType(groupPosition: number): number;\n        getGroupTypeCount(): number;\n        abstract getGroupCount(): number;\n        abstract getChildrenCount(groupPosition: number): number;\n        abstract getGroup(groupPosition: number): any;\n        abstract getChild(groupPosition: number, childPosition: number): any;\n        abstract getGroupId(groupPosition: number): number;\n        abstract getChildId(groupPosition: number, childPosition: number): number;\n        abstract hasStableIds(): boolean;\n        abstract getGroupView(groupPosition: number, isExpanded: boolean, convertView: android.view.View, parent: android.view.ViewGroup): android.view.View;\n        abstract getChildView(groupPosition: number, childPosition: number, isLastChild: boolean, convertView: android.view.View, parent: android.view.ViewGroup): android.view.View;\n        abstract isChildSelectable(groupPosition: number, childPosition: number): boolean;\n    }\n}\ndeclare module android.widget {\n    import Context = android.content.Context;\n    import Handler = android.os.Handler;\n    import View = android.view.View;\n    import WindowManager = android.view.WindowManager;\n    import Window = android.view.Window;\n    import Runnable = java.lang.Runnable;\n    class Toast {\n        static TAG: string;\n        static localLOGV: boolean;\n        static LENGTH_SHORT: number;\n        static LENGTH_LONG: number;\n        mContext: Context;\n        mTN: Toast.TN;\n        mDuration: number;\n        mNextView: View;\n        private mHandler;\n        private mDelayHide;\n        constructor(context: Context);\n        show(): void;\n        cancel(): void;\n        setView(view: View): void;\n        getView(): View;\n        setDuration(duration: number): void;\n        getDuration(): number;\n        setGravity(gravity: number, xOffset: number, yOffset: number): void;\n        getGravity(): number;\n        getXOffset(): number;\n        getYOffset(): number;\n        static makeText(context: Context, text: string, duration: number): Toast;\n        setText(s: string): void;\n    }\n    module Toast {\n        class TN {\n            mShow: Runnable;\n            mHide: Runnable;\n            mHandler: Handler;\n            mGravity: number;\n            mX: number;\n            mY: number;\n            mView: View;\n            mWindow: Window;\n            mNextView: View;\n            mWM: WindowManager;\n            show(): void;\n            hide(): void;\n            handleShow(): void;\n            handleHide(): void;\n        }\n    }\n}\ndeclare module android.content {\n    import KeyEvent = android.view.KeyEvent;\n    interface DialogInterface {\n        cancel(): void;\n        dismiss(): void;\n    }\n    module DialogInterface {\n        interface OnCancelListener {\n            onCancel(dialog: DialogInterface): void;\n        }\n        interface OnDismissListener {\n            onDismiss(dialog: DialogInterface): void;\n        }\n        interface OnShowListener {\n            onShow(dialog: DialogInterface): void;\n        }\n        interface OnClickListener {\n            onClick(dialog: DialogInterface, which: number): void;\n        }\n        interface OnMultiChoiceClickListener {\n            onClick(dialog: DialogInterface, which: number, isChecked: boolean): void;\n        }\n        interface OnKeyListener {\n            onKey(dialog: DialogInterface, keyCode: number, event: KeyEvent): boolean;\n        }\n        var BUTTON_POSITIVE: number;\n        var BUTTON_NEGATIVE: number;\n        var BUTTON_NEUTRAL: number;\n        var BUTTON1: number;\n        var BUTTON2: number;\n        var BUTTON3: number;\n    }\n}\ndeclare module android.app {\n    import DialogInterface = android.content.DialogInterface;\n    import Bundle = android.os.Bundle;\n    import Handler = android.os.Handler;\n    import Message = android.os.Message;\n    import KeyEvent = android.view.KeyEvent;\n    import LayoutInflater = android.view.LayoutInflater;\n    import MotionEvent = android.view.MotionEvent;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import Window = android.view.Window;\n    import WindowManager = android.view.WindowManager;\n    import Context = android.content.Context;\n    class Dialog implements DialogInterface, Window.Callback, KeyEvent.Callback {\n        private static TAG;\n        mContext: Context;\n        mWindowManager: WindowManager;\n        mWindow: Window;\n        mDecor: View;\n        protected mCancelable: boolean;\n        private mCancelAndDismissTaken;\n        private mCancelMessage;\n        private mDismissMessage;\n        private mShowMessage;\n        private mOnKeyListener;\n        private mCreated;\n        private mShowing;\n        private mCanceled;\n        private mHandler;\n        private static DISMISS;\n        private static CANCEL;\n        private static SHOW;\n        private mListenersHandler;\n        private mDismissAction;\n        constructor(context: Context, cancelable?: boolean, cancelListener?: DialogInterface.OnCancelListener);\n        getContext(): Context;\n        isShowing(): boolean;\n        show(): void;\n        hide(): void;\n        dismiss(): void;\n        dismissDialog(): void;\n        private sendDismissMessage();\n        private sendShowMessage();\n        dispatchOnCreate(savedInstanceState: Bundle): void;\n        protected onCreate(savedInstanceState: Bundle): void;\n        protected onStart(): void;\n        protected onStop(): void;\n        private static DIALOG_SHOWING_TAG;\n        private static DIALOG_HIERARCHY_TAG;\n        getWindow(): Window;\n        getCurrentFocus(): View;\n        findViewById(id: string): View;\n        setContentView(view: View, params?: ViewGroup.LayoutParams): void;\n        addContentView(view: View, params: ViewGroup.LayoutParams): void;\n        setTitle(title: string): void;\n        onKeyDown(keyCode: number, event: KeyEvent): boolean;\n        onKeyLongPress(keyCode: number, event: KeyEvent): boolean;\n        onKeyUp(keyCode: number, event: KeyEvent): boolean;\n        onKeyMultiple(keyCode: number, repeatCount: number, event: KeyEvent): boolean;\n        onBackPressed(): void;\n        onTouchEvent(event: MotionEvent): boolean;\n        onTrackballEvent(event: MotionEvent): boolean;\n        onGenericMotionEvent(event: MotionEvent): boolean;\n        onWindowAttributesChanged(params: WindowManager.LayoutParams): void;\n        onContentChanged(): void;\n        onWindowFocusChanged(hasFocus: boolean): void;\n        onAttachedToWindow(): void;\n        onDetachedFromWindow(): void;\n        dispatchKeyEvent(event: KeyEvent): boolean;\n        dispatchTouchEvent(ev: MotionEvent): boolean;\n        dispatchGenericMotionEvent(ev: MotionEvent): boolean;\n        takeKeyEvents(get: boolean): void;\n        getLayoutInflater(): LayoutInflater;\n        setCancelable(flag: boolean): void;\n        setCanceledOnTouchOutside(cancel: boolean): void;\n        cancel(): void;\n        setOnCancelListener(listener: DialogInterface.OnCancelListener): void;\n        setCancelMessage(msg: Message): void;\n        setOnDismissListener(listener: DialogInterface.OnDismissListener): void;\n        setOnShowListener(listener: DialogInterface.OnShowListener): void;\n        setDismissMessage(msg: Message): void;\n        takeCancelAndDismissListeners(msg: string, cancel: DialogInterface.OnCancelListener, dismiss: DialogInterface.OnDismissListener): boolean;\n        setOnKeyListener(onKeyListener: DialogInterface.OnKeyListener): void;\n    }\n    module Dialog {\n        class ListenersHandler extends Handler {\n            private mDialog;\n            constructor(dialog: Dialog);\n            handleMessage(msg: Message): void;\n        }\n    }\n}\ndeclare module android.widget {\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import Comparator = java.util.Comparator;\n    import List = java.util.List;\n    import BaseAdapter = android.widget.BaseAdapter;\n    import Context = android.content.Context;\n    class ArrayAdapter<T> extends BaseAdapter {\n        private mObjects;\n        private mResource;\n        private mDropDownResource;\n        private mFieldId;\n        private mNotifyOnChange;\n        private mContext;\n        private mInflater;\n        constructor(context: Context, resource: string);\n        constructor(context: Context, resource: string, textViewResourceId: string);\n        constructor(context: Context, resource: string, objects: T[]);\n        constructor(context: Context, resource: string, textViewResourceId: string, objects: T[] | List<T>);\n        add(object: T): void;\n        addAll(collection: List<T>): void;\n        insert(object: T, index: number): void;\n        remove(object: T): void;\n        clear(): void;\n        sort(comparator: Comparator<T>): void;\n        notifyDataSetChanged(): void;\n        setNotifyOnChange(notifyOnChange: boolean): void;\n        private init(context, resource, textViewResourceId, objects);\n        getContext(): Context;\n        getCount(): number;\n        getItem(position: number): T;\n        getPosition(item: T): number;\n        getItemId(position: number): number;\n        getView(position: number, convertView: View, parent: ViewGroup): View;\n        private createViewFromResource(position, convertView, parent, resource);\n        setDropDownViewResource(resource: string): void;\n        getDropDownView(position: number, convertView: View, parent: ViewGroup): View;\n    }\n    module ArrayAdapter {\n    }\n}\ndeclare module android.app {\n    import DialogInterface = android.content.DialogInterface;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Handler = android.os.Handler;\n    import Message = android.os.Message;\n    import KeyEvent = android.view.KeyEvent;\n    import LayoutInflater = android.view.LayoutInflater;\n    import View = android.view.View;\n    import Window = android.view.Window;\n    import AdapterView = android.widget.AdapterView;\n    import Button = android.widget.Button;\n    import ListAdapter = android.widget.ListAdapter;\n    import ListView = android.widget.ListView;\n    import Context = android.content.Context;\n    class AlertController {\n        private mContext;\n        private mDialogInterface;\n        private mWindow;\n        private mTitle;\n        private mMessage;\n        private mListView;\n        private mView;\n        private mViewSpacingLeft;\n        private mViewSpacingTop;\n        private mViewSpacingRight;\n        private mViewSpacingBottom;\n        private mViewSpacingSpecified;\n        private mButtonPositive;\n        private mButtonPositiveText;\n        private mButtonPositiveMessage;\n        private mButtonNegative;\n        private mButtonNegativeText;\n        private mButtonNegativeMessage;\n        private mButtonNeutral;\n        private mButtonNeutralText;\n        private mButtonNeutralMessage;\n        private mScrollView;\n        private mIcon;\n        private mIconView;\n        private mTitleView;\n        private mMessageView;\n        private mCustomTitleView;\n        private mForceInverseBackground;\n        private mAdapter;\n        private mCheckedItem;\n        private mAlertDialogLayout;\n        private mListLayout;\n        private mMultiChoiceItemLayout;\n        private mSingleChoiceItemLayout;\n        private mListItemLayout;\n        private mHandler;\n        mButtonHandler: View.OnClickListener;\n        private static shouldCenterSingleButton(context);\n        constructor(context: Context, di: DialogInterface, window: Window);\n        installContent(): void;\n        setTitle(title: string): void;\n        setCustomTitle(customTitleView: View): void;\n        setMessage(message: string): void;\n        setView(view: View, viewSpacingLeft?: number, viewSpacingTop?: number, viewSpacingRight?: number, viewSpacingBottom?: number): void;\n        setButton(whichButton: number, text: string, listener: DialogInterface.OnClickListener, msg: Message): void;\n        setIcon(icon: Drawable): void;\n        setInverseBackgroundForced(forceInverseBackground: boolean): void;\n        getListView(): ListView;\n        getButton(whichButton: number): Button;\n        onKeyDown(keyCode: number, event: KeyEvent): boolean;\n        onKeyUp(keyCode: number, event: KeyEvent): boolean;\n        private setupView();\n        private setupTitle(topPanel);\n        private setupContent(contentPanel);\n        private setupButtons();\n        private centerButton(button);\n        private setBackground(topPanel, contentPanel, customPanel, hasButtons, hasTitle, buttonPanel);\n    }\n    module AlertController {\n        class ButtonHandler extends Handler {\n            private static MSG_DISMISS_DIALOG;\n            private mDialog;\n            constructor(dialog: DialogInterface);\n            handleMessage(msg: Message): void;\n        }\n        class RecycleListView extends ListView {\n            mRecycleOnMeasure: boolean;\n            constructor(context: Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n            protected recycleOnMeasure(): boolean;\n        }\n        class AlertParams {\n            mContext: Context;\n            mInflater: LayoutInflater;\n            mIconId: number;\n            mIcon: Drawable;\n            mTitle: string;\n            mCustomTitleView: View;\n            mMessage: string;\n            mPositiveButtonText: string;\n            mPositiveButtonListener: DialogInterface.OnClickListener;\n            mNegativeButtonText: string;\n            mNegativeButtonListener: DialogInterface.OnClickListener;\n            mNeutralButtonText: string;\n            mNeutralButtonListener: DialogInterface.OnClickListener;\n            mCancelable: boolean;\n            mOnCancelListener: DialogInterface.OnCancelListener;\n            mOnDismissListener: DialogInterface.OnDismissListener;\n            mOnKeyListener: DialogInterface.OnKeyListener;\n            mItems: string[];\n            mAdapter: ListAdapter;\n            mOnClickListener: DialogInterface.OnClickListener;\n            mView: View;\n            mViewSpacingLeft: number;\n            mViewSpacingTop: number;\n            mViewSpacingRight: number;\n            mViewSpacingBottom: number;\n            mViewSpacingSpecified: boolean;\n            mCheckedItems: boolean[];\n            mIsMultiChoice: boolean;\n            mIsSingleChoice: boolean;\n            mCheckedItem: number;\n            mOnCheckboxClickListener: DialogInterface.OnMultiChoiceClickListener;\n            mLabelColumn: string;\n            mIsCheckedColumn: string;\n            mForceInverseBackground: boolean;\n            mOnItemSelectedListener: AdapterView.OnItemSelectedListener;\n            mOnPrepareListViewListener: AlertParams.OnPrepareListViewListener;\n            mRecycleOnMeasure: boolean;\n            constructor(context: Context);\n            apply(dialog: AlertController): void;\n            private createListView(dialog);\n        }\n        module AlertParams {\n            interface OnPrepareListViewListener {\n                onPrepareListView(listView: ListView): void;\n            }\n        }\n    }\n}\ndeclare module android.app {\n    import DialogInterface = android.content.DialogInterface;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Bundle = android.os.Bundle;\n    import KeyEvent = android.view.KeyEvent;\n    import View = android.view.View;\n    import AdapterView = android.widget.AdapterView;\n    import Button = android.widget.Button;\n    import ListAdapter = android.widget.ListAdapter;\n    import ListView = android.widget.ListView;\n    import Dialog = android.app.Dialog;\n    import Context = android.content.Context;\n    class AlertDialog extends Dialog implements DialogInterface {\n        private mAlert;\n        static THEME_TRADITIONAL: number;\n        static THEME_HOLO_DARK: number;\n        static THEME_HOLO_LIGHT: number;\n        static THEME_DEVICE_DEFAULT_DARK: number;\n        static THEME_DEVICE_DEFAULT_LIGHT: number;\n        constructor(context: Context, cancelable?: boolean, cancelListener?: DialogInterface.OnCancelListener);\n        getButton(whichButton: number): Button;\n        getListView(): ListView;\n        setTitle(title: string): void;\n        setCustomTitle(customTitleView: View): void;\n        setMessage(message: string): void;\n        setView(view: View, viewSpacingLeft?: number, viewSpacingTop?: number, viewSpacingRight?: number, viewSpacingBottom?: number): void;\n        setButton(whichButton: number, text: string, listener: DialogInterface.OnClickListener): void;\n        setIcon(icon: Drawable): void;\n        protected onCreate(savedInstanceState: Bundle): void;\n        onKeyDown(keyCode: number, event: KeyEvent): boolean;\n        onKeyUp(keyCode: number, event: KeyEvent): boolean;\n    }\n    module AlertDialog {\n        class Builder {\n            private P;\n            constructor(context: Context);\n            getContext(): Context;\n            setTitle(title: string): Builder;\n            setCustomTitle(customTitleView: View): Builder;\n            setMessage(message: string): Builder;\n            setIcon(icon: Drawable): Builder;\n            setPositiveButton(text: string, listener: DialogInterface.OnClickListener): Builder;\n            setNegativeButton(text: string, listener: DialogInterface.OnClickListener): Builder;\n            setNeutralButton(text: string, listener: DialogInterface.OnClickListener): Builder;\n            setCancelable(cancelable: boolean): Builder;\n            setOnCancelListener(onCancelListener: DialogInterface.OnCancelListener): Builder;\n            setOnDismissListener(onDismissListener: DialogInterface.OnDismissListener): Builder;\n            setOnKeyListener(onKeyListener: DialogInterface.OnKeyListener): Builder;\n            setItems(items: string[], listener: DialogInterface.OnClickListener): Builder;\n            setAdapter(adapter: ListAdapter, listener: DialogInterface.OnClickListener): Builder;\n            setMultiChoiceItems(items: string[], checkedItems: boolean[], listener: DialogInterface.OnMultiChoiceClickListener): Builder;\n            setSingleChoiceItems(items: string[], checkedItem: number, listener: DialogInterface.OnClickListener): Builder;\n            setSingleChoiceItemsWithAdapter(adapter: ListAdapter, checkedItem: number, listener: DialogInterface.OnClickListener): Builder;\n            setOnItemSelectedListener(listener: AdapterView.OnItemSelectedListener): Builder;\n            setView(view: View, viewSpacingLeft?: number, viewSpacingTop?: number, viewSpacingRight?: number, viewSpacingBottom?: number): Builder;\n            setInverseBackgroundForced(useInverseBackground: boolean): Builder;\n            setRecycleOnMeasureEnabled(enabled: boolean): Builder;\n            create(): AlertDialog;\n            show(): AlertDialog;\n        }\n    }\n}\ndeclare module android.widget {\n    import Rect = android.graphics.Rect;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import AdapterView = android.widget.AdapterView;\n    import SpinnerAdapter = android.widget.SpinnerAdapter;\n    import Context = android.content.Context;\n    abstract class AbsSpinner extends AdapterView<SpinnerAdapter> {\n        mAdapter: SpinnerAdapter;\n        mHeightMeasureSpec: number;\n        mWidthMeasureSpec: number;\n        mSelectionLeftPadding: number;\n        mSelectionTopPadding: number;\n        mSelectionRightPadding: number;\n        mSelectionBottomPadding: number;\n        mSpinnerPadding: Rect;\n        mRecycler: AbsSpinner.RecycleBin;\n        private mDataSetObserver;\n        private mTouchFrame;\n        constructor(context: Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        private initAbsSpinner();\n        setAdapter(adapter: SpinnerAdapter): void;\n        resetList(): void;\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        getChildHeight(child: View): number;\n        getChildWidth(child: View): number;\n        protected generateDefaultLayoutParams(): ViewGroup.LayoutParams;\n        recycleAllViews(): void;\n        setSelection(position: number, animate?: boolean): void;\n        setSelectionInt(position: number, animate: boolean): void;\n        abstract layoutSpinner(delta: number, animate: boolean): void;\n        getSelectedView(): View;\n        requestLayout(): void;\n        getAdapter(): SpinnerAdapter;\n        getCount(): number;\n        pointToPosition(x: number, y: number): number;\n    }\n    module AbsSpinner {\n        class RecycleBin {\n            _AbsSpinner_this: AbsSpinner;\n            constructor(arg: AbsSpinner);\n            private mScrapHeap;\n            put(position: number, v: View): void;\n            get(position: number): View;\n            clear(): void;\n        }\n    }\n}\ndeclare module android.widget {\n    import Context = android.content.Context;\n    import Drawable = android.graphics.drawable.Drawable;\n    import KeyEvent = android.view.KeyEvent;\n    import MotionEvent = android.view.MotionEvent;\n    import View = android.view.View;\n    import OnTouchListener = android.view.View.OnTouchListener;\n    import WindowManager = android.view.WindowManager;\n    import Window = android.view.Window;\n    import Animation = android.view.animation.Animation;\n    class PopupWindow implements Window.Callback {\n        static INPUT_METHOD_FROM_FOCUSABLE: number;\n        static INPUT_METHOD_NEEDED: number;\n        static INPUT_METHOD_NOT_NEEDED: number;\n        private static DEFAULT_ANCHORED_GRAVITY;\n        private mContext;\n        private mWindowManager;\n        private mIsShowing;\n        private mIsDropdown;\n        private mContentView;\n        private mPopupView;\n        private mPopupWindow;\n        private mFocusable;\n        private mInputMethodMode;\n        private mTouchable;\n        private mOutsideTouchable;\n        private mSplitTouchEnabled;\n        private mClipToScreen;\n        private mAllowScrollingAnchorParent;\n        private mNotTouchModal;\n        private mTouchInterceptor;\n        private mWidthMode;\n        private mWidth;\n        private mLastWidth;\n        private mHeightMode;\n        private mHeight;\n        private mLastHeight;\n        private mPopupWidth;\n        private mPopupHeight;\n        private mDrawingLocation;\n        private mScreenLocation;\n        private mTempRect;\n        private mBackground;\n        private mAboveAnchorBackgroundDrawable;\n        private mBelowAnchorBackgroundDrawable;\n        private mAboveAnchor;\n        private mWindowLayoutType;\n        private mOnDismissListener;\n        private mDefaultDropdownAboveEnterAnimation;\n        private mDefaultDropdownBelowEnterAnimation;\n        private mDefaultDropdownAboveExitAnimation;\n        private mDefaultDropdownBelowExitAnimation;\n        private mEnterAnimation;\n        private mExitAnimation;\n        private mAnchor;\n        private mOnScrollChangedListener;\n        private mAnchorXoff;\n        private mAnchorYoff;\n        private mAnchoredGravity;\n        private mPopupViewInitialLayoutDirectionInherited;\n        constructor(contentView: View, width?: number, height?: number, focusable?: boolean);\n        constructor(context: Context, styleAttr?: Map<string, string>);\n        getBackground(): Drawable;\n        setBackgroundDrawable(background: Drawable): void;\n        getEnterAnimation(): Animation;\n        getExitAnimation(): Animation;\n        setWindowAnimation(enterAnimation: Animation, exitAnimation: Animation): void;\n        getContentView(): View;\n        setContentView(contentView: View): void;\n        setTouchInterceptor(l: OnTouchListener): void;\n        isFocusable(): boolean;\n        setFocusable(focusable: boolean): void;\n        getInputMethodMode(): number;\n        setInputMethodMode(mode: number): void;\n        isTouchable(): boolean;\n        setTouchable(touchable: boolean): void;\n        isOutsideTouchable(): boolean;\n        setOutsideTouchable(touchable: boolean): void;\n        setClipToScreenEnabled(enabled: boolean): void;\n        private setAllowScrollingAnchorParent(enabled);\n        isSplitTouchEnabled(): boolean;\n        setSplitTouchEnabled(enabled: boolean): void;\n        setWindowLayoutType(layoutType: number): void;\n        getWindowLayoutType(): number;\n        setTouchModal(touchModal: boolean): void;\n        setWindowLayoutMode(widthSpec: number, heightSpec: number): void;\n        getHeight(): number;\n        setHeight(height: number): void;\n        getWidth(): number;\n        setWidth(width: number): void;\n        isShowing(): boolean;\n        showAtLocation(parent: View, gravity: number, x: number, y: number): void;\n        showAsDropDown(anchor: View, xoff?: number, yoff?: number, gravity?: number): void;\n        private updateAboveAnchor(aboveAnchor);\n        isAboveAnchor(): boolean;\n        private preparePopup(p);\n        private invokePopup(p);\n        private setLayoutDirectionFromAnchor();\n        private createPopupLayout();\n        private computeFlags(curFlags);\n        private computeWindowEnterAnimation();\n        private computeWindowExitAnimation();\n        private findDropDownPosition(anchor, p, xoff, yoff, gravity);\n        getMaxAvailableHeight(anchor: View, yOffset?: number, ignoreBottomDecorations?: boolean): number;\n        dismiss(): void;\n        setOnDismissListener(onDismissListener: PopupWindow.OnDismissListener): void;\n        update(): void;\n        update(width: number, height: number): void;\n        update(anchor: View, width: number, height: number): void;\n        update(x: number, y: number, width: number, height: number, force?: boolean): void;\n        update(anchor: View, xoff: number, yoff: number, width: number, height: number): void;\n        private _update();\n        private _update_w_h(width, height);\n        private _update_x_y_w_h_f(x, y, width, height, force?);\n        private _update_a_w_h(anchor, width, height);\n        private _update_a_x_y_w_h(anchor, xoff, yoff, width, height);\n        private _update_all_args(anchor, updateLocation, xoff, yoff, updateDimension, width, height, gravity);\n        private unregisterForScrollChanged();\n        private registerForScrollChanged(anchor, xoff, yoff, gravity);\n        onTouchEvent(event: MotionEvent): boolean;\n        onGenericMotionEvent(event: MotionEvent): boolean;\n        onWindowAttributesChanged(params: WindowManager.LayoutParams): void;\n        onContentChanged(): void;\n        onWindowFocusChanged(hasFocus: boolean): void;\n        onAttachedToWindow(): void;\n        onDetachedFromWindow(): void;\n        dispatchKeyEvent(event: KeyEvent): boolean;\n        dispatchTouchEvent(ev: MotionEvent): boolean;\n        dispatchGenericMotionEvent(ev: MotionEvent): boolean;\n    }\n    module PopupWindow {\n        interface OnDismissListener {\n            onDismiss(): void;\n        }\n    }\n}\ndeclare module android.widget {\n    import DataSetObserver = android.database.DataSetObserver;\n    import Drawable = android.graphics.drawable.Drawable;\n    import KeyEvent = android.view.KeyEvent;\n    import MotionEvent = android.view.MotionEvent;\n    import View = android.view.View;\n    import OnTouchListener = android.view.View.OnTouchListener;\n    import Runnable = java.lang.Runnable;\n    import AbsListView = android.widget.AbsListView;\n    import AdapterView = android.widget.AdapterView;\n    import ListAdapter = android.widget.ListAdapter;\n    import ListView = android.widget.ListView;\n    import PopupWindow = android.widget.PopupWindow;\n    import Context = android.content.Context;\n    import Animation = android.view.animation.Animation;\n    class ListPopupWindow {\n        private static TAG;\n        private static DEBUG;\n        private static EXPAND_LIST_TIMEOUT;\n        private mContext;\n        private mPopup;\n        private mAdapter;\n        private mDropDownList;\n        private mDropDownHeight;\n        private mDropDownWidth;\n        private mDropDownHorizontalOffset;\n        private mDropDownVerticalOffset;\n        private mDropDownVerticalOffsetSet;\n        private mDropDownGravity;\n        private mDropDownAlwaysVisible;\n        private mForceIgnoreOutsideTouch;\n        mListItemExpandMaximum: number;\n        private mPromptView;\n        private mPromptPosition;\n        private mObserver;\n        private mDropDownAnchorView;\n        private mDropDownListHighlight;\n        private mItemClickListener;\n        private mItemSelectedListener;\n        private mResizePopupRunnable;\n        private mTouchInterceptor;\n        private mScrollListener;\n        private mHideSelector;\n        private mShowDropDownRunnable;\n        private mHandler;\n        private mTempRect;\n        private mModal;\n        private mLayoutDirection;\n        static POSITION_PROMPT_ABOVE: number;\n        static POSITION_PROMPT_BELOW: number;\n        static MATCH_PARENT: number;\n        static WRAP_CONTENT: number;\n        static INPUT_METHOD_FROM_FOCUSABLE: number;\n        static INPUT_METHOD_NEEDED: number;\n        static INPUT_METHOD_NOT_NEEDED: number;\n        constructor(context: Context, styleAttr?: Map<string, string>);\n        setAdapter(adapter: ListAdapter): void;\n        setPromptPosition(position: number): void;\n        getPromptPosition(): number;\n        setModal(modal: boolean): void;\n        isModal(): boolean;\n        setForceIgnoreOutsideTouch(forceIgnoreOutsideTouch: boolean): void;\n        setDropDownAlwaysVisible(dropDownAlwaysVisible: boolean): void;\n        isDropDownAlwaysVisible(): boolean;\n        getBackground(): Drawable;\n        setBackgroundDrawable(d: Drawable): void;\n        setWindowAnimation(enterAnimation: Animation, exitAnimation: Animation): void;\n        getEnterAnimation(): Animation;\n        getExitAnimation(): Animation;\n        getAnchorView(): View;\n        setAnchorView(anchor: View): void;\n        getHorizontalOffset(): number;\n        setHorizontalOffset(offset: number): void;\n        getVerticalOffset(): number;\n        setVerticalOffset(offset: number): void;\n        setDropDownGravity(gravity: number): void;\n        getWidth(): number;\n        setWidth(width: number): void;\n        setContentWidth(width: number): void;\n        getHeight(): number;\n        setHeight(height: number): void;\n        setOnItemClickListener(clickListener: AdapterView.OnItemClickListener): void;\n        setOnItemSelectedListener(selectedListener: AdapterView.OnItemSelectedListener): void;\n        setPromptView(prompt: View): void;\n        postShow(): void;\n        show(): void;\n        dismiss(): void;\n        setOnDismissListener(listener: PopupWindow.OnDismissListener): void;\n        private removePromptView();\n        setInputMethodMode(mode: number): void;\n        getInputMethodMode(): number;\n        setSelection(position: number): void;\n        clearListSelection(): void;\n        isShowing(): boolean;\n        isInputMethodNotNeeded(): boolean;\n        performItemClick(position: number): boolean;\n        getSelectedItem(): any;\n        getSelectedItemPosition(): number;\n        getSelectedItemId(): number;\n        getSelectedView(): View;\n        getListView(): ListView;\n        setListItemExpandMax(max: number): void;\n        onKeyDown(keyCode: number, event: KeyEvent): boolean;\n        onKeyUp(keyCode: number, event: KeyEvent): boolean;\n        onKeyPreIme(keyCode: number, event: KeyEvent): boolean;\n        createDragToOpenListener(src: View): OnTouchListener;\n        private buildDropDown();\n    }\n    module ListPopupWindow {\n        abstract class ForwardingListener implements View.OnTouchListener, View.OnAttachStateChangeListener {\n            private mScaledTouchSlop;\n            private mTapTimeout;\n            private mSrc;\n            private mDisallowIntercept;\n            private mForwarding;\n            private mActivePointerId;\n            constructor(src: View);\n            abstract getPopup(): ListPopupWindow;\n            onTouch(v: View, event: MotionEvent): boolean;\n            onViewAttachedToWindow(v: View): void;\n            onViewDetachedFromWindow(v: View): void;\n            protected onForwardingStarted(): boolean;\n            protected onForwardingStopped(): boolean;\n            private onTouchObserved(srcEvent);\n            private onTouchForwarded(srcEvent);\n        }\n        module ForwardingListener {\n            class DisallowIntercept implements Runnable {\n                _ForwardingListener_this: ForwardingListener;\n                constructor(arg: ForwardingListener);\n                run(): void;\n            }\n        }\n        class DropDownListView extends ListView {\n            private static CLICK_ANIM_DURATION;\n            private static CLICK_ANIM_ALPHA;\n            private mListSelectionHidden;\n            private mHijackFocus;\n            private mDrawsInPressedState;\n            constructor(context: Context, hijackFocus: boolean);\n            onForwardedEvent(event: MotionEvent, activePointerId: number): boolean;\n            private clickPressedItem(child, position);\n            private clearPressedItem();\n            private setPressedItem(child, position);\n            touchModeDrawsInPressedState(): boolean;\n            obtainView(position: number, isScrap: boolean[]): View;\n            isInTouchMode(): boolean;\n            hasWindowFocus(): boolean;\n            isFocused(): boolean;\n            hasFocus(): boolean;\n        }\n        class PopupDataSetObserver extends DataSetObserver {\n            _ListPopupWindow_this: ListPopupWindow;\n            constructor(arg: ListPopupWindow);\n            onChanged(): void;\n            onInvalidated(): void;\n        }\n        class ListSelectorHider implements Runnable {\n            _ListPopupWindow_this: ListPopupWindow;\n            constructor(arg: ListPopupWindow);\n            run(): void;\n        }\n        class ResizePopupRunnable implements Runnable {\n            _ListPopupWindow_this: ListPopupWindow;\n            constructor(arg: ListPopupWindow);\n            run(): void;\n        }\n        class PopupTouchInterceptor implements OnTouchListener {\n            _ListPopupWindow_this: ListPopupWindow;\n            constructor(arg: ListPopupWindow);\n            onTouch(v: View, event: MotionEvent): boolean;\n        }\n        class PopupScrollListener implements AbsListView.OnScrollListener {\n            _ListPopupWindow_this: ListPopupWindow;\n            constructor(arg: ListPopupWindow);\n            onScroll(view: AbsListView, firstVisibleItem: number, visibleItemCount: number, totalItemCount: number): void;\n            onScrollStateChanged(view: AbsListView, scrollState: number): void;\n        }\n    }\n}\ndeclare module android.widget {\n    import DialogInterface = android.content.DialogInterface;\n    import OnClickListener = android.content.DialogInterface.OnClickListener;\n    import DataSetObserver = android.database.DataSetObserver;\n    import Drawable = android.graphics.drawable.Drawable;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import AbsSpinner = android.widget.AbsSpinner;\n    import AdapterView = android.widget.AdapterView;\n    import ListAdapter = android.widget.ListAdapter;\n    import ListPopupWindow = android.widget.ListPopupWindow;\n    import SpinnerAdapter = android.widget.SpinnerAdapter;\n    import Context = android.content.Context;\n    class Spinner extends AbsSpinner implements OnClickListener {\n        static TAG: string;\n        private static MAX_ITEMS_MEASURED;\n        static MODE_DIALOG: number;\n        static MODE_DROPDOWN: number;\n        private static MODE_THEME;\n        private mPopup;\n        private mTempAdapter;\n        mDropDownWidth: number;\n        private mGravity;\n        private mDisableChildrenWhenDisabled;\n        private mTempRect;\n        constructor(context: Context, bindElement?: HTMLElement, defStyle?: Map<string, string>, mode?: number);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        setPopupBackgroundDrawable(background: Drawable): void;\n        getPopupBackground(): Drawable;\n        setDropDownVerticalOffset(pixels: number): void;\n        getDropDownVerticalOffset(): number;\n        setDropDownHorizontalOffset(pixels: number): void;\n        getDropDownHorizontalOffset(): number;\n        setDropDownWidth(pixels: number): void;\n        getDropDownWidth(): number;\n        setEnabled(enabled: boolean): void;\n        setGravity(gravity: number): void;\n        getGravity(): number;\n        setAdapter(adapter: SpinnerAdapter): void;\n        getBaseline(): number;\n        protected onDetachedFromWindow(): void;\n        setOnItemClickListener(l: AdapterView.OnItemClickListener): void;\n        setOnItemClickListenerInt(l: AdapterView.OnItemClickListener): void;\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        protected onLayout(changed: boolean, l: number, t: number, r: number, b: number): void;\n        layoutSpinner(delta: number, animate: boolean): void;\n        private makeView(position, addChild);\n        private setUpChild(child, addChild);\n        performClick(): boolean;\n        onClick(dialog: DialogInterface, which: number): void;\n        setPrompt(prompt: string): void;\n        getPrompt(): string;\n        measureContentWidth(adapter: SpinnerAdapter, background: Drawable): number;\n    }\n    module Spinner {\n        class DropDownAdapter implements ListAdapter, SpinnerAdapter {\n            private mAdapter;\n            private mListAdapter;\n            constructor(adapter: SpinnerAdapter);\n            getCount(): number;\n            getItem(position: number): any;\n            getItemId(position: number): number;\n            getView(position: number, convertView: View, parent: ViewGroup): View;\n            getDropDownView(position: number, convertView: View, parent: ViewGroup): View;\n            hasStableIds(): boolean;\n            registerDataSetObserver(observer: DataSetObserver): void;\n            unregisterDataSetObserver(observer: DataSetObserver): void;\n            areAllItemsEnabled(): boolean;\n            isEnabled(position: number): boolean;\n            getItemViewType(position: number): number;\n            getViewTypeCount(): number;\n            isEmpty(): boolean;\n        }\n        interface SpinnerPopup {\n            setAdapter(adapter: ListAdapter): void;\n            showPopup(textDirection: number, textAlignment: number): void;\n            dismiss(): void;\n            isShowing(): boolean;\n            setPromptText(hintText: string): void;\n            getHintText(): string;\n            setBackgroundDrawable(bg: Drawable): void;\n            setVerticalOffset(px: number): void;\n            setHorizontalOffset(px: number): void;\n            getBackground(): Drawable;\n            getVerticalOffset(): number;\n            getHorizontalOffset(): number;\n        }\n        class DialogPopup implements Spinner.SpinnerPopup, DialogInterface.OnClickListener {\n            _Spinner_this: Spinner;\n            constructor(arg: Spinner);\n            private mPopup;\n            private mListAdapter;\n            private mPrompt;\n            dismiss(): void;\n            isShowing(): boolean;\n            setAdapter(adapter: ListAdapter): void;\n            setPromptText(hintText: string): void;\n            getHintText(): string;\n            showPopup(textDirection: number, textAlignment: number): void;\n            onClick(dialog: DialogInterface, which: number): void;\n            setBackgroundDrawable(bg: Drawable): void;\n            setVerticalOffset(px: number): void;\n            setHorizontalOffset(px: number): void;\n            getBackground(): Drawable;\n            getVerticalOffset(): number;\n            getHorizontalOffset(): number;\n        }\n        class DropdownPopup extends ListPopupWindow implements Spinner.SpinnerPopup {\n            _Spinner_this: Spinner;\n            private mHintText;\n            constructor(context: Context, defStyleRes: Map<string, string>, arg: Spinner);\n            setAdapter(adapter: ListAdapter): void;\n            getHintText(): string;\n            setPromptText(hintText: string): void;\n            computeContentWidth(): void;\n            showPopup(textDirection: number, textAlignment: number): void;\n        }\n    }\n}\ndeclare module androidui.widget {\n    import View = android.view.View;\n    class HtmlBaseView extends View {\n        private mHtmlTouchAble;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        onTouchEvent(event: android.view.MotionEvent): boolean;\n        setHtmlTouchAble(enable: boolean): void;\n        isHtmlTouchAble(): boolean;\n        protected dependOnDebugLayout(): boolean;\n    }\n}\ndeclare module android.webkit {\n    class WebViewClient {\n        onPageFinished(view: WebView, url: string): void;\n        onReceivedTitle(view: WebView, title: string): void;\n    }\n}\ndeclare module android.webkit {\n    import HtmlBaseView = androidui.widget.HtmlBaseView;\n    class WebView extends HtmlBaseView {\n        private iFrameElement;\n        protected mClient: WebViewClient;\n        private initIFrameHistoryLength;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        private initIFrameElement(url);\n        private checkActivityResume();\n        goBack(): void;\n        canGoBack(): boolean;\n        loadUrl(url: string): void;\n        reload(): void;\n        getUrl(): string;\n        getTitle(): string;\n        setWebViewClient(client: WebViewClient): void;\n    }\n}\ndeclare module android.view.animation {\n    import Animation = android.view.animation.Animation;\n    import Transformation = android.view.animation.Transformation;\n    class RotateAnimation extends Animation {\n        private mFromDegrees;\n        private mToDegrees;\n        private mPivotXType;\n        private mPivotYType;\n        private mPivotXValue;\n        private mPivotYValue;\n        private mPivotX;\n        private mPivotY;\n        constructor(fromDegrees: number, toDegrees: number, pivotXType?: number, pivotXValue?: number, pivotYType?: number, pivotYValue?: number);\n        private initializePivotPoint();\n        protected applyTransformation(interpolatedTime: number, t: Transformation): void;\n        initialize(width: number, height: number, parentWidth: number, parentHeight: number): void;\n    }\n}\ndeclare module android.view {\n    import Intent = android.content.Intent;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Menu = android.view.Menu;\n    import View = android.view.View;\n    class MenuItem {\n        private mId;\n        private mGroup;\n        private mCategoryOrder;\n        private mOrdering;\n        private mTitle;\n        private mIntent;\n        private mIconDrawable;\n        private mVisible;\n        private mEnable;\n        private mClickListener;\n        private mActionView;\n        private mMenu;\n        constructor(menu: Menu, group: number, id: number, categoryOrder: number, ordering: number, title: string);\n        getItemId(): number;\n        getGroupId(): number;\n        getOrder(): number;\n        setTitle(title: string): MenuItem;\n        getTitle(): string;\n        setIcon(icon: Drawable): MenuItem;\n        getIcon(): Drawable;\n        setIntent(intent: Intent): MenuItem;\n        getIntent(): Intent;\n        setVisible(visible: boolean): MenuItem;\n        isVisible(): boolean;\n        setEnabled(enabled: boolean): MenuItem;\n        isEnabled(): boolean;\n        setOnMenuItemClickListener(menuItemClickListener: MenuItem.OnMenuItemClickListener): MenuItem;\n        setActionView(view: View): MenuItem;\n        getActionView(): View;\n        invoke(): boolean;\n    }\n    module MenuItem {\n        interface OnMenuItemClickListener {\n            onMenuItemClick(item: MenuItem): boolean;\n        }\n    }\n}\ndeclare module android.view {\n    import MenuItem = android.view.MenuItem;\n    import ArrayList = java.util.ArrayList;\n    import Context = android.content.Context;\n    class Menu {\n        private mItems;\n        private mVisibleItems;\n        private mCallback;\n        private mContext;\n        constructor(context: Context);\n        getContext(): Context;\n        add(title: string): MenuItem;\n        add(groupId: number, itemId: number, order: number, title: string): MenuItem;\n        private addInternal(group, id, categoryOrder, title);\n        removeItem(id: number): void;\n        removeGroup(groupId: number): void;\n        private removeItemAtInt(index, updateChildrenOnMenuViews);\n        clear(): void;\n        setGroupVisible(group: number, visible: boolean): void;\n        setGroupEnabled(group: number, enabled: boolean): void;\n        hasVisibleItems(): boolean;\n        findItem(id: number): MenuItem;\n        findItemIndex(id: number): number;\n        findGroupIndex(group: number, start?: number): number;\n        size(): number;\n        getItem(index: number): MenuItem;\n        onItemsChanged(structureChanged: boolean): void;\n        getRootMenu(): Menu;\n        setCallback(cb: Menu.Callback): void;\n        dispatchMenuItemSelected(menu: Menu, item: MenuItem): boolean;\n        getVisibleItems(): ArrayList<MenuItem>;\n    }\n    module Menu {\n        var USER_MASK: number;\n        var USER_SHIFT: number;\n        var CATEGORY_MASK: number;\n        var CATEGORY_SHIFT: number;\n        var NONE: number;\n        var FIRST: number;\n        var CATEGORY_CONTAINER: number;\n        var CATEGORY_SYSTEM: number;\n        var CATEGORY_SECONDARY: number;\n        var CATEGORY_ALTERNATIVE: number;\n        var FLAG_APPEND_TO_GROUP: number;\n        var FLAG_PERFORM_NO_CLOSE: number;\n        var FLAG_ALWAYS_PERFORM_CLOSE: number;\n        interface Callback {\n            onMenuItemSelected(menu: Menu, item: MenuItem): boolean;\n        }\n    }\n}\ndeclare module android.view.menu {\n    import KeyEvent = android.view.KeyEvent;\n    import MenuItem = android.view.MenuItem;\n    import Menu = android.view.Menu;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import Context = android.content.Context;\n    import ViewTreeObserver = android.view.ViewTreeObserver;\n    import AdapterView = android.widget.AdapterView;\n    import BaseAdapter = android.widget.BaseAdapter;\n    import PopupWindow = android.widget.PopupWindow;\n    class MenuPopupHelper implements AdapterView.OnItemClickListener, View.OnKeyListener, ViewTreeObserver.OnGlobalLayoutListener, PopupWindow.OnDismissListener {\n        private static TAG;\n        static ITEM_LAYOUT: string;\n        private mContext;\n        private mInflater;\n        private mPopup;\n        private mMenu;\n        private mPopupMaxWidth;\n        private mAnchorView;\n        private mTreeObserver;\n        private mAdapter;\n        private mMeasureParent;\n        constructor(context: Context, menu: Menu, anchorView?: View);\n        setAnchorView(anchor: View): void;\n        show(): void;\n        tryShow(): boolean;\n        dismiss(): void;\n        onDismiss(): void;\n        isShowing(): boolean;\n        onItemClick(parent: AdapterView<any>, view: View, position: number, id: number): void;\n        onKey(v: View, keyCode: number, event: KeyEvent): boolean;\n        private measureContentWidth(adapter);\n        onGlobalLayout(): void;\n    }\n    module MenuPopupHelper {\n        class MenuAdapter extends BaseAdapter {\n            _MenuPopupHelper_this: MenuPopupHelper;\n            private mAdapterMenu;\n            constructor(menu: Menu, arg: MenuPopupHelper);\n            getCount(): number;\n            getItem(position: number): MenuItem;\n            getItemId(position: number): number;\n            getView(position: number, convertView: View, parent: ViewGroup): View;\n            notifyDataSetChanged(): void;\n        }\n    }\n}\ndeclare module android.support.v4.view {\n    import DataSetObserver = android.database.DataSetObserver;\n    import ViewGroup = android.view.ViewGroup;\n    import View = android.view.View;\n    abstract class PagerAdapter {\n        private mObservable;\n        static POSITION_UNCHANGED: number;\n        static POSITION_NONE: number;\n        abstract getCount(): number;\n        startUpdate(container: ViewGroup): void;\n        instantiateItem(container: ViewGroup, position: number): any;\n        destroyItem(container: ViewGroup, position: number, object: any): void;\n        setPrimaryItem(container: ViewGroup, position: number, object: any): void;\n        finishUpdate(container: ViewGroup): void;\n        abstract isViewFromObject(view: View, object: any): boolean;\n        getItemPosition(object: any): number;\n        notifyDataSetChanged(): void;\n        registerDataSetObserver(observer: DataSetObserver): void;\n        unregisterDataSetObserver(observer: DataSetObserver): void;\n        getPageTitle(position: number): string;\n        getPageWidth(position: number): number;\n    }\n}\ndeclare module android.support.v4.view {\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import ArrayList = java.util.ArrayList;\n    import Rect = android.graphics.Rect;\n    import PagerAdapter = android.support.v4.view.PagerAdapter;\n    import Drawable = android.graphics.drawable.Drawable;\n    import MotionEvent = android.view.MotionEvent;\n    import KeyEvent = android.view.KeyEvent;\n    class ViewPager extends ViewGroup {\n        private mExpectedAdapterCount;\n        private static COMPARATOR;\n        private static USE_CACHE;\n        private static DEFAULT_OFFSCREEN_PAGES;\n        private static MAX_SETTLE_DURATION;\n        private static MIN_DISTANCE_FOR_FLING;\n        private static DEFAULT_GUTTER_SIZE;\n        private static MIN_FLING_VELOCITY;\n        private static sInterpolator;\n        private mItems;\n        private mTempItem;\n        private mTempRect;\n        private mAdapter;\n        private mCurItem;\n        private mRestoredCurItem;\n        private mScroller;\n        private mObserver;\n        private mPageMargin;\n        private mMarginDrawable;\n        private mTopPageBounds;\n        private mBottomPageBounds;\n        private mFirstOffset;\n        private mLastOffset;\n        private mChildWidthMeasureSpec;\n        private mChildHeightMeasureSpec;\n        private mInLayout;\n        private mScrollingCacheEnabled;\n        private mPopulatePending;\n        private mOffscreenPageLimit;\n        private mIsBeingDragged;\n        private mIsUnableToDrag;\n        private mDefaultGutterSize;\n        private mGutterSize;\n        private mLastMotionX;\n        private mLastMotionY;\n        private mInitialMotionX;\n        private mInitialMotionY;\n        private static INVALID_POINTER;\n        private mActivePointerId;\n        private mVelocityTracker;\n        private mMinimumVelocity;\n        private mMaximumVelocity;\n        private mFlingDistance;\n        private mCloseEnough;\n        private static CLOSE_ENOUGH;\n        private mFakeDragging;\n        private mFakeDragBeginTime;\n        private mFirstLayout;\n        private mNeedCalculatePageOffsets;\n        private mCalledSuper;\n        private mDecorChildCount;\n        private mOnPageChangeListeners;\n        private mOnPageChangeListener;\n        private mInternalPageChangeListener;\n        private mAdapterChangeListener;\n        private mPageTransformer;\n        private static DRAW_ORDER_DEFAULT;\n        private static DRAW_ORDER_FORWARD;\n        private static DRAW_ORDER_REVERSE;\n        private mDrawingOrder;\n        private mDrawingOrderedChildren;\n        private static sPositionComparator;\n        static SCROLL_STATE_IDLE: number;\n        static SCROLL_STATE_DRAGGING: number;\n        static SCROLL_STATE_SETTLING: number;\n        private mEndScrollRunnable;\n        private mScrollState;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: any);\n        private initViewPager();\n        protected onDetachedFromWindow(): void;\n        private setScrollState(newState);\n        setAdapter(adapter: PagerAdapter): void;\n        private removeNonDecorViews();\n        getAdapter(): PagerAdapter;\n        setOnAdapterChangeListener(listener: ViewPager.OnAdapterChangeListener): void;\n        private getClientWidth();\n        setCurrentItem(item: number, smoothScroll?: boolean): void;\n        getCurrentItem(): number;\n        setCurrentItemInternal(item: number, smoothScroll: boolean, always: boolean, velocity?: number): void;\n        private scrollToItem(item, smoothScroll, velocity, dispatchSelected);\n        setOnPageChangeListener(listener: ViewPager.OnPageChangeListener): void;\n        addOnPageChangeListener(listener: ViewPager.OnPageChangeListener): void;\n        removeOnPageChangeListener(listener: ViewPager.OnPageChangeListener): void;\n        clearOnPageChangeListeners(): void;\n        setPageTransformer(reverseDrawingOrder: boolean, transformer: ViewPager.PageTransformer): void;\n        setChildrenDrawingOrderEnabledCompat(enable?: boolean): void;\n        getChildDrawingOrder(childCount: number, i: number): number;\n        setInternalPageChangeListener(listener: ViewPager.OnPageChangeListener): ViewPager.OnPageChangeListener;\n        getOffscreenPageLimit(): number;\n        setOffscreenPageLimit(limit: number): void;\n        setPageMargin(marginPixels: number): void;\n        getPageMargin(): number;\n        setPageMarginDrawable(d: Drawable): void;\n        protected verifyDrawable(who: Drawable): boolean;\n        protected drawableStateChanged(): void;\n        distanceInfluenceForSnapDuration(f: number): number;\n        smoothScrollTo(x: number, y: number, velocity?: number): void;\n        private addNewItem(position, index);\n        dataSetChanged(): void;\n        populate(newCurrentItem?: number): void;\n        private sortChildDrawingOrder();\n        private calculatePageOffsets(curItem, curIndex, oldCurInfo);\n        addView(view: View): any;\n        addView(view: View, index: number): any;\n        addView(view: View, params: ViewGroup.LayoutParams): any;\n        addView(view: View, index: number, params: ViewGroup.LayoutParams): any;\n        addView(view: View, width: number, height: number): any;\n        private _addViewOverride(child, index, params);\n        removeView(view: android.view.View): void;\n        private infoForChild(child);\n        private infoForAnyChild(child);\n        private infoForPosition(position);\n        protected onAttachedToWindow(): void;\n        protected onMeasure(widthMeasureSpec: any, heightMeasureSpec: any): void;\n        protected onSizeChanged(w: number, h: number, oldw: number, oldh: number): void;\n        private recomputeScrollPosition(width, oldWidth, margin, oldMargin);\n        protected onLayout(changed: boolean, l: number, t: number, r: number, b: number): void;\n        computeScroll(): void;\n        private pageScrolled(xpos);\n        onPageScrolled(position: number, offset: number, offsetPixels: number): void;\n        private dispatchOnPageScrolled(position, offset, offsetPixels);\n        private dispatchOnPageSelected(position);\n        private dispatchOnScrollStateChanged(state);\n        private completeScroll(postEvents);\n        private isGutterDrag(x, dx);\n        private enableLayers(enable);\n        onInterceptTouchEvent(ev: MotionEvent): boolean;\n        onTouchEvent(ev: android.view.MotionEvent): boolean;\n        private resetTouch();\n        private requestParentDisallowInterceptTouchEvent(disallowIntercept);\n        private performDrag(x);\n        private infoForCurrentScrollPosition();\n        private determineTargetPage(currentPage, pageOffset, velocity, deltaX);\n        draw(canvas: android.graphics.Canvas): void;\n        protected onDraw(canvas: android.graphics.Canvas): void;\n        beginFakeDrag(): boolean;\n        endFakeDrag(): void;\n        fakeDragBy(xOffset: number): void;\n        isFakeDragging(): boolean;\n        private onSecondaryPointerUp(ev);\n        private endDrag();\n        private setScrollingCacheEnabled(enabled);\n        canScrollHorizontally(direction: number): boolean;\n        canScroll(v: View, checkV: boolean, dx: number, x: number, y: number): boolean;\n        dispatchKeyEvent(event: android.view.KeyEvent): boolean;\n        executeKeyEvent(event: KeyEvent): boolean;\n        arrowScroll(direction: number): boolean;\n        private getChildRectInPagerCoordinates(outRect, child);\n        pageLeft(): boolean;\n        pageRight(): boolean;\n        addFocusables(views: ArrayList<View>, direction: number, focusableMode: number): void;\n        addTouchables(views: java.util.ArrayList<android.view.View>): void;\n        protected onRequestFocusInDescendants(direction: number, previouslyFocusedRect: Rect): boolean;\n        protected generateDefaultLayoutParams(): android.view.ViewGroup.LayoutParams;\n        protected generateLayoutParams(p: android.view.ViewGroup.LayoutParams): android.view.ViewGroup.LayoutParams;\n        protected checkLayoutParams(p: android.view.ViewGroup.LayoutParams): boolean;\n        generateLayoutParamsFromAttr(attrs: HTMLElement): android.view.ViewGroup.LayoutParams;\n        private static isImplDecor(view);\n        static setClassImplDecor(clazz: Function): void;\n    }\n    module ViewPager {\n        interface OnPageChangeListener {\n            onPageScrolled(position: number, positionOffset: number, positionOffsetPixels: number): void;\n            onPageSelected(position: number): void;\n            onPageScrollStateChanged(state: number): void;\n        }\n        class SimpleOnPageChangeListener implements OnPageChangeListener {\n            onPageScrolled(position: number, positionOffset: number, positionOffsetPixels: number): void;\n            onPageSelected(position: number): void;\n            onPageScrollStateChanged(state: number): void;\n        }\n        interface PageTransformer {\n            transformPage(page: View, position: number): void;\n        }\n        interface OnAdapterChangeListener {\n            onAdapterChanged(oldAdapter: PagerAdapter, newAdapter: PagerAdapter): void;\n        }\n        class LayoutParams extends ViewGroup.LayoutParams {\n            isDecor: boolean;\n            gravity: number;\n            widthFactor: number;\n            needsMeasure: boolean;\n            position: number;\n            childIndex: number;\n            constructor();\n            constructor(context: android.content.Context, attrs: HTMLElement);\n            protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        }\n    }\n}\ndeclare module android.support.v4.widget {\n    import MotionEvent = android.view.MotionEvent;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    class ViewDragHelper {\n        private static TAG;\n        static INVALID_POINTER: number;\n        static STATE_IDLE: number;\n        static STATE_DRAGGING: number;\n        static STATE_SETTLING: number;\n        static EDGE_LEFT: number;\n        static EDGE_RIGHT: number;\n        static EDGE_TOP: number;\n        static EDGE_BOTTOM: number;\n        static EDGE_ALL: number;\n        static DIRECTION_HORIZONTAL: number;\n        static DIRECTION_VERTICAL: number;\n        static DIRECTION_ALL: number;\n        private static EDGE_SIZE;\n        private static BASE_SETTLE_DURATION;\n        private static MAX_SETTLE_DURATION;\n        private mDragState;\n        private mTouchSlop;\n        private mActivePointerId;\n        private mInitialMotionX;\n        private mInitialMotionY;\n        private mLastMotionX;\n        private mLastMotionY;\n        private mInitialEdgesTouched;\n        private mEdgeDragsInProgress;\n        private mEdgeDragsLocked;\n        private mPointersDown;\n        private mVelocityTracker;\n        private mMaxVelocity;\n        private mMinVelocity;\n        private mEdgeSize;\n        private mTrackingEdges;\n        private mScroller;\n        private mCallback;\n        private mCapturedView;\n        private mReleaseInProgress;\n        private mParentView;\n        private static sInterpolator;\n        private mSetIdleRunnable;\n        static create(forParent: ViewGroup, cb: ViewDragHelper.Callback): ViewDragHelper;\n        static create(forParent: ViewGroup, sensitivity: number, cb: ViewDragHelper.Callback): ViewDragHelper;\n        constructor(forParent: ViewGroup, cb: ViewDragHelper.Callback);\n        setMinVelocity(minVel: number): void;\n        getMinVelocity(): number;\n        getViewDragState(): number;\n        setEdgeTrackingEnabled(edgeFlags: number): void;\n        getEdgeSize(): number;\n        captureChildView(childView: View, activePointerId: number): void;\n        getCapturedView(): View;\n        getActivePointerId(): number;\n        getTouchSlop(): number;\n        cancel(): void;\n        abort(): void;\n        smoothSlideViewTo(child: View, finalLeft: number, finalTop: number): boolean;\n        settleCapturedViewAt(finalLeft: number, finalTop: number): boolean;\n        private forceSettleCapturedViewAt(finalLeft, finalTop, xvel, yvel);\n        private computeSettleDuration(child, dx, dy, xvel, yvel);\n        private computeAxisDuration(delta, velocity, motionRange);\n        private clampMag(value, absMin, absMax);\n        private distanceInfluenceForSnapDuration(f);\n        flingCapturedView(minLeft: number, minTop: number, maxLeft: number, maxTop: number): void;\n        continueSettling(deferCallbacks: boolean): boolean;\n        private dispatchViewReleased(xvel, yvel);\n        private clearMotionHistory(pointerId?);\n        private ensureMotionHistorySizeForId(pointerId);\n        private saveInitialMotion(x, y, pointerId);\n        private saveLastMotion(ev);\n        isPointerDown(pointerId: number): boolean;\n        setDragState(state: number): void;\n        tryCaptureViewForDrag(toCapture: View, pointerId: number): boolean;\n        protected canScroll(v: View, checkV: boolean, dx: number, dy: number, x: number, y: number): boolean;\n        shouldInterceptTouchEvent(ev: MotionEvent): boolean;\n        processTouchEvent(ev: MotionEvent): void;\n        private reportNewEdgeDrags(dx, dy, pointerId);\n        private checkNewEdgeDrag(delta, odelta, pointerId, edge);\n        checkTouchSlop(child: View, dx: number, dy: number): boolean;\n        checkTouchSlop(directions: number): boolean;\n        checkTouchSlop(directions: number, pointerId: number): boolean;\n        private _checkTouchSlop_3(child, dx, dy);\n        private _checkTouchSlop_1(directions);\n        private _checkTouchSlop_2(directions, pointerId);\n        isEdgeTouched(edges: number, pointerId?: number): boolean;\n        private releaseViewForPointerUp();\n        private dragTo(left, top, dx, dy);\n        isCapturedViewUnder(x: number, y: number): boolean;\n        isViewUnder(view: View, x: number, y: number): boolean;\n        findTopChildUnder(x: number, y: number): View;\n        private getEdgesTouched(x, y);\n    }\n    module ViewDragHelper {\n        abstract class Callback {\n            onViewDragStateChanged(state: number): void;\n            onViewPositionChanged(changedView: View, left: number, top: number, dx: number, dy: number): void;\n            onViewCaptured(capturedChild: View, activePointerId: number): void;\n            onViewReleased(releasedChild: View, xvel: number, yvel: number): void;\n            onEdgeTouched(edgeFlags: number, pointerId: number): void;\n            onEdgeLock(edgeFlags: number): boolean;\n            onEdgeDragStarted(edgeFlags: number, pointerId: number): void;\n            getOrderedChildIndex(index: number): number;\n            getViewHorizontalDragRange(child: View): number;\n            getViewVerticalDragRange(child: View): number;\n            abstract tryCaptureView(child: View, pointerId: number): boolean;\n            clampViewPositionHorizontal(child: View, left: number, dx: number): number;\n            clampViewPositionVertical(child: View, top: number, dy: number): number;\n        }\n    }\n}\ndeclare module android.support.v4.widget {\n    import Canvas = android.graphics.Canvas;\n    import Drawable = android.graphics.drawable.Drawable;\n    import KeyEvent = android.view.KeyEvent;\n    import MotionEvent = android.view.MotionEvent;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import ViewDragHelper = android.support.v4.widget.ViewDragHelper;\n    import Context = android.content.Context;\n    class DrawerLayout extends ViewGroup {\n        private static TAG;\n        static STATE_IDLE: number;\n        static STATE_DRAGGING: number;\n        static STATE_SETTLING: number;\n        static LOCK_MODE_UNLOCKED: number;\n        static LOCK_MODE_LOCKED_CLOSED: number;\n        static LOCK_MODE_LOCKED_OPEN: number;\n        private static MIN_DRAWER_MARGIN;\n        private static DEFAULT_SCRIM_COLOR;\n        static PEEK_DELAY: number;\n        private static MIN_FLING_VELOCITY;\n        static ALLOW_EDGE_LOCK: boolean;\n        private static CHILDREN_DISALLOW_INTERCEPT;\n        private static TOUCH_SLOP_SENSITIVITY;\n        private mMinDrawerMargin;\n        private mScrimColor;\n        private mScrimOpacity;\n        private mScrimPaint;\n        private mLeftDragger;\n        private mRightDragger;\n        private mLeftCallback;\n        private mRightCallback;\n        private mDrawerState;\n        private mInLayout;\n        private mFirstLayout;\n        private mLockModeLeft;\n        private mLockModeRight;\n        private mDisallowInterceptRequested;\n        private mChildrenCanceledTouch;\n        private mListener;\n        private mInitialMotionX;\n        private mInitialMotionY;\n        private mShadowLeft;\n        private mShadowRight;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        setDrawerShadow(shadowDrawable: Drawable, gravity: number): void;\n        setScrimColor(color: number): void;\n        setDrawerListener(listener: DrawerLayout.DrawerListener): void;\n        setDrawerLockMode(lockMode: number, edgeGravityOrView?: number | View): void;\n        getDrawerLockMode(edgeGravityOrView: number | View): number;\n        updateDrawerState(forGravity: number, activeState: number, activeDrawer: View): void;\n        dispatchOnDrawerClosed(drawerView: View): void;\n        dispatchOnDrawerOpened(drawerView: View): void;\n        dispatchOnDrawerSlide(drawerView: View, slideOffset: number): void;\n        setDrawerViewOffset(drawerView: View, slideOffset: number): void;\n        getDrawerViewOffset(drawerView: View): number;\n        getDrawerViewAbsoluteGravity(drawerView: View): number;\n        checkDrawerViewAbsoluteGravity(drawerView: View, checkFor: number): boolean;\n        findOpenDrawer(): View;\n        moveDrawerToOffset(drawerView: View, slideOffset: number): void;\n        findDrawerWithGravity(gravity: number): View;\n        static gravityToString(gravity: number): string;\n        protected onDetachedFromWindow(): void;\n        protected onAttachedToWindow(): void;\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;\n        protected onLayout(changed: boolean, l: number, t: number, r: number, b: number): void;\n        requestLayout(): void;\n        computeScroll(): void;\n        private static hasOpaqueBackground(v);\n        protected drawChild(canvas: Canvas, child: View, drawingTime: number): boolean;\n        isContentView(child: View): boolean;\n        isDrawerView(child: View): boolean;\n        onInterceptTouchEvent(ev: MotionEvent): boolean;\n        onTouchEvent(ev: MotionEvent): boolean;\n        requestDisallowInterceptTouchEvent(disallowIntercept: boolean): void;\n        closeDrawers(peekingOnly?: boolean): void;\n        openDrawer(drawerView: View): void;\n        openDrawer(gravity: number): void;\n        private _openDrawer_view(drawerView);\n        private _openDrawer_gravity(gravity);\n        closeDrawer(drawerView: View): void;\n        closeDrawer(gravity: number): void;\n        private _closeDrawer_view(drawerView);\n        private _closeDrawer_gravity(gravity);\n        isDrawerOpen(drawer: View): boolean;\n        isDrawerOpen(drawerGravity: number): boolean;\n        private _isDrawerOpen_view(drawer);\n        private _isDrawerOpen_gravity(drawerGravity);\n        isDrawerVisible(drawer: View): boolean;\n        isDrawerVisible(drawerGravity: number): boolean;\n        private _isDrawerVisible_view(drawer);\n        private _isDrawerVisible_gravity(drawerGravity);\n        private hasPeekingDrawer();\n        protected generateDefaultLayoutParams(): ViewGroup.LayoutParams;\n        protected generateLayoutParams(p: ViewGroup.LayoutParams): ViewGroup.LayoutParams;\n        protected checkLayoutParams(p: ViewGroup.LayoutParams): boolean;\n        generateLayoutParamsFromAttr(attrs: HTMLElement): android.view.ViewGroup.LayoutParams;\n        private hasVisibleDrawer();\n        private findVisibleDrawer();\n        cancelChildViewTouch(): void;\n        onKeyDown(keyCode: number, event: KeyEvent): boolean;\n        onKeyUp(keyCode: number, event: KeyEvent): boolean;\n    }\n    module DrawerLayout {\n        interface DrawerListener {\n            onDrawerSlide(drawerView: View, slideOffset: number): void;\n            onDrawerOpened(drawerView: View): void;\n            onDrawerClosed(drawerView: View): void;\n            onDrawerStateChanged(newState: number): void;\n        }\n        class SimpleDrawerListener implements DrawerLayout.DrawerListener {\n            onDrawerSlide(drawerView: View, slideOffset: number): void;\n            onDrawerOpened(drawerView: View): void;\n            onDrawerClosed(drawerView: View): void;\n            onDrawerStateChanged(newState: number): void;\n        }\n        class ViewDragCallback extends ViewDragHelper.Callback {\n            _DrawerLayout_this: DrawerLayout;\n            constructor(arg: DrawerLayout, gravity: number);\n            private mAbsGravity;\n            private mDragger;\n            private mPeekRunnable;\n            setDragger(dragger: ViewDragHelper): void;\n            removeCallbacks(): void;\n            tryCaptureView(child: View, pointerId: number): boolean;\n            onViewDragStateChanged(state: number): void;\n            onViewPositionChanged(changedView: View, left: number, top: number, dx: number, dy: number): void;\n            onViewCaptured(capturedChild: View, activePointerId: number): void;\n            private closeOtherDrawer();\n            onViewReleased(releasedChild: View, xvel: number, yvel: number): void;\n            onEdgeTouched(edgeFlags: number, pointerId: number): void;\n            private peekDrawer();\n            onEdgeLock(edgeFlags: number): boolean;\n            onEdgeDragStarted(edgeFlags: number, pointerId: number): void;\n            getViewHorizontalDragRange(child: View): number;\n            clampViewPositionHorizontal(child: View, left: number, dx: number): number;\n            clampViewPositionVertical(child: View, top: number, dy: number): number;\n        }\n        class LayoutParams extends ViewGroup.MarginLayoutParams {\n            gravity: number;\n            onScreen: number;\n            isPeeking: boolean;\n            knownOpen: boolean;\n            constructor(context: Context, attrs: HTMLElement);\n            constructor(width: number, height: number);\n            constructor(width: number, height: number, gravity: number);\n            constructor(source: ViewGroup.LayoutParams);\n            constructor(source: ViewGroup.MarginLayoutParams);\n            constructor(source: LayoutParams);\n            protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        }\n    }\n}\ndeclare module com.jakewharton.salvage {\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import PagerAdapter = android.support.v4.view.PagerAdapter;\n    abstract class RecyclingPagerAdapter extends PagerAdapter {\n        static IGNORE_ITEM_VIEW_TYPE: number;\n        private recycleBin;\n        constructor();\n        notifyDataSetChanged(): void;\n        instantiateItem(container: android.view.ViewGroup, position: number): any;\n        destroyItem(container: android.view.ViewGroup, position: number, object: any): void;\n        isViewFromObject(view: android.view.View, object: any): boolean;\n        getViewTypeCount(): number;\n        getItemViewType(position: number): number;\n        abstract getView(position: number, convertView: View, parent: ViewGroup): View;\n    }\n}\ndeclare module uk.co.senab.photoview {\n    import MotionEvent = android.view.MotionEvent;\n    import ScaleGestureDetector = android.view.ScaleGestureDetector;\n    class GestureDetector {\n        protected mListener: GestureDetector.OnGestureListener;\n        private static LOG_TAG;\n        private static INVALID_POINTER_ID;\n        private mActivePointerId;\n        private mActivePointerIndex;\n        mLastTouchX: number;\n        mLastTouchY: number;\n        mTouchSlop: number;\n        mMinimumVelocity: number;\n        protected mScaleDetector: ScaleGestureDetector;\n        setOnGestureListener(listener: GestureDetector.OnGestureListener): void;\n        constructor();\n        private mVelocityTracker;\n        private mIsDragging;\n        getActiveX(ev: MotionEvent): number;\n        getActiveY(ev: MotionEvent): number;\n        isScaling(): boolean;\n        isDragging(): boolean;\n        onTouchEvent(ev: MotionEvent): boolean;\n    }\n    module GestureDetector {\n        interface OnGestureListener {\n            onDrag(dx: number, dy: number): void;\n            onFling(startX: number, startY: number, velocityX: number, velocityY: number): void;\n            onScale(scaleFactor: number, focusX: number, focusY: number): void;\n        }\n    }\n}\ndeclare module uk.co.senab.photoview {\n    import Matrix = android.graphics.Matrix;\n    import Canvas = android.graphics.Canvas;\n    import RectF = android.graphics.RectF;\n    import GestureDetector = android.view.GestureDetector;\n    import View = android.view.View;\n    import ImageView = android.widget.ImageView;\n    import PhotoViewAttacher = uk.co.senab.photoview.PhotoViewAttacher;\n    interface IPhotoView {\n        canZoom(): boolean;\n        getDisplayRect(): RectF;\n        setDisplayMatrix(finalMatrix: Matrix): boolean;\n        getDisplayMatrix(): Matrix;\n        getMinScale(): number;\n        getMinimumScale(): number;\n        getMidScale(): number;\n        getMediumScale(): number;\n        getMaxScale(): number;\n        getMaximumScale(): number;\n        getScale(): number;\n        getScaleType(): ImageView.ScaleType;\n        setAllowParentInterceptOnEdge(allow: boolean): void;\n        setMinScale(minScale: number): void;\n        setMinimumScale(minimumScale: number): void;\n        setMidScale(midScale: number): void;\n        setMediumScale(mediumScale: number): void;\n        setMaxScale(maxScale: number): void;\n        setMaximumScale(maximumScale: number): void;\n        setScaleLevels(minimumScale: number, mediumScale: number, maximumScale: number): void;\n        setOnLongClickListener(listener: View.OnLongClickListener): void;\n        setOnMatrixChangeListener(listener: PhotoViewAttacher.OnMatrixChangedListener): void;\n        setOnPhotoTapListener(listener: PhotoViewAttacher.OnPhotoTapListener): void;\n        getOnPhotoTapListener(): PhotoViewAttacher.OnPhotoTapListener;\n        setOnViewTapListener(listener: PhotoViewAttacher.OnViewTapListener): void;\n        setRotationTo(rotationDegree: number): void;\n        setRotationBy(rotationDegree: number): void;\n        getOnViewTapListener(): PhotoViewAttacher.OnViewTapListener;\n        setScale(scale: number): void;\n        setScale(scale: number, animate: boolean): void;\n        setScale(scale: number, focalX: number, focalY: number, animate: boolean): void;\n        setScaleType(scaleType: ImageView.ScaleType): void;\n        setZoomable(zoomable: boolean): void;\n        setPhotoViewRotation(rotationDegree: number): void;\n        getVisibleRectangleBitmap(): Canvas;\n        setZoomTransitionDuration(milliseconds: number): void;\n        getIPhotoViewImplementation(): IPhotoView;\n        setOnDoubleTapListener(newOnDoubleTapListener: GestureDetector.OnDoubleTapListener): void;\n        setOnScaleChangeListener(onScaleChangeListener: PhotoViewAttacher.OnScaleChangeListener): void;\n    }\n    module IPhotoView {\n        var DEFAULT_MAX_SCALE: number;\n        var DEFAULT_MID_SCALE: number;\n        var DEFAULT_MIN_SCALE: number;\n        var DEFAULT_ZOOM_DURATION: number;\n        function isImpl(obj: any): boolean;\n    }\n}\ndeclare module uk.co.senab.photoview {\n    import Canvas = android.graphics.Canvas;\n    import Matrix = android.graphics.Matrix;\n    import RectF = android.graphics.RectF;\n    import View = android.view.View;\n    import OnLongClickListener = android.view.View.OnLongClickListener;\n    import ViewTreeObserver = android.view.ViewTreeObserver;\n    import Interpolator = android.view.animation.Interpolator;\n    import ImageView = android.widget.ImageView;\n    import ScaleType = android.widget.ImageView.ScaleType;\n    import MotionEvent = android.view.MotionEvent;\n    import Runnable = java.lang.Runnable;\n    import GestureDetector = uk.co.senab.photoview.GestureDetector;\n    import IPhotoView = uk.co.senab.photoview.IPhotoView;\n    class PhotoViewAttacher implements IPhotoView, View.OnTouchListener, GestureDetector.OnGestureListener, ViewTreeObserver.OnGlobalLayoutListener {\n        private static LOG_TAG;\n        private static DEBUG;\n        static sInterpolator: Interpolator;\n        ZOOM_DURATION: number;\n        static EDGE_NONE: number;\n        static EDGE_LEFT: number;\n        static EDGE_RIGHT: number;\n        static EDGE_BOTH: number;\n        private mMinScale;\n        private mMidScale;\n        private mMaxScale;\n        private mAllowParentInterceptOnEdge;\n        private mBlockParentIntercept;\n        private static checkZoomLevels(minZoom, midZoom, maxZoom);\n        private static hasDrawable(imageView);\n        private static isSupportedScaleType(scaleType);\n        private static setImageViewScaleTypeMatrix(imageView);\n        private mImageView;\n        private mGestureDetector;\n        private mScaleDragDetector;\n        private mBaseMatrix;\n        private mDrawMatrix;\n        private mSuppMatrix;\n        private mDisplayRect;\n        private mMatrixValues;\n        private mMatrixChangeListener;\n        private mPhotoTapListener;\n        private mViewTapListener;\n        private mLongClickListener;\n        private mScaleChangeListener;\n        private mIvTop;\n        private mIvRight;\n        private mIvBottom;\n        private mIvLeft;\n        private mCurrentFlingRunnable;\n        private mScrollEdge;\n        private mZoomEnabled;\n        private mScaleType;\n        constructor(imageView: ImageView, zoomable?: boolean);\n        setOnDoubleTapListener(newOnDoubleTapListener: android.view.GestureDetector.OnDoubleTapListener): void;\n        setOnScaleChangeListener(onScaleChangeListener: PhotoViewAttacher.OnScaleChangeListener): void;\n        canZoom(): boolean;\n        cleanup(): void;\n        getDisplayRect(): RectF;\n        setDisplayMatrix(finalMatrix: Matrix): boolean;\n        setPhotoViewRotation(degrees: number): void;\n        setRotationTo(degrees: number): void;\n        setRotationBy(degrees: number): void;\n        getImageView(): ImageView;\n        getMinScale(): number;\n        getMinimumScale(): number;\n        getMidScale(): number;\n        getMediumScale(): number;\n        getMaxScale(): number;\n        getMaximumScale(): number;\n        getScale(): number;\n        getScaleType(): ScaleType;\n        onDrag(dx: number, dy: number): void;\n        onFling(startX: number, startY: number, velocityX: number, velocityY: number): void;\n        onGlobalLayout(): void;\n        onScale(scaleFactor: number, focusX: number, focusY: number): void;\n        onTouch(v: View, ev: MotionEvent): boolean;\n        setAllowParentInterceptOnEdge(allow: boolean): void;\n        setMinScale(minScale: number): void;\n        setMinimumScale(minimumScale: number): void;\n        setMidScale(midScale: number): void;\n        setMediumScale(mediumScale: number): void;\n        setMaxScale(maxScale: number): void;\n        setMaximumScale(maximumScale: number): void;\n        setScaleLevels(minimumScale: number, mediumScale: number, maximumScale: number): void;\n        setOnLongClickListener(listener: OnLongClickListener): void;\n        setOnMatrixChangeListener(listener: PhotoViewAttacher.OnMatrixChangedListener): void;\n        setOnPhotoTapListener(listener: PhotoViewAttacher.OnPhotoTapListener): void;\n        getOnPhotoTapListener(): PhotoViewAttacher.OnPhotoTapListener;\n        setOnViewTapListener(listener: PhotoViewAttacher.OnViewTapListener): void;\n        getOnViewTapListener(): PhotoViewAttacher.OnViewTapListener;\n        setScale(scale: number, animate?: boolean): void;\n        setScale(scale: number, focalX: number, focalY: number, animate?: boolean): void;\n        private setScale_2(scale, animate?);\n        private setScale_4(scale, focalX, focalY, animate?);\n        setScaleType(scaleType: ScaleType): void;\n        setZoomable(zoomable: boolean): void;\n        update(): void;\n        getDisplayMatrix(): Matrix;\n        getDrawMatrix(): Matrix;\n        private cancelFling();\n        private checkAndDisplayMatrix();\n        private checkImageViewScaleType();\n        private checkMatrixBounds();\n        private _getDisplayRect(matrix);\n        getVisibleRectangleBitmap(): Canvas;\n        setZoomTransitionDuration(milliseconds: number): void;\n        getIPhotoViewImplementation(): IPhotoView;\n        private getValue(matrix, whichValue);\n        private resetMatrix();\n        private setImageViewMatrix(matrix);\n        private updateBaseMatrix(d);\n        private getImageViewWidth(imageView);\n        private getImageViewHeight(imageView);\n    }\n    module PhotoViewAttacher {\n        interface OnMatrixChangedListener {\n            onMatrixChanged(rect: RectF): void;\n        }\n        interface OnScaleChangeListener {\n            onScaleChange(scaleFactor: number, focusX: number, focusY: number): void;\n        }\n        interface OnPhotoTapListener {\n            onPhotoTap(view: View, x: number, y: number): void;\n        }\n        interface OnViewTapListener {\n            onViewTap(view: View, x: number, y: number): void;\n        }\n        class AnimatedZoomRunnable implements Runnable {\n            _PhotoViewAttacher_this: PhotoViewAttacher;\n            private mFocalX;\n            private mFocalY;\n            private mStartTime;\n            private mZoomStart;\n            private mZoomEnd;\n            constructor(arg: PhotoViewAttacher, currentZoom: number, targetZoom: number, focalX: number, focalY: number);\n            run(): void;\n            private interpolate();\n        }\n        class FlingRunnable implements Runnable {\n            _PhotoViewAttacher_this: PhotoViewAttacher;\n            constructor(arg: PhotoViewAttacher);\n            private mScroller;\n            private mCurrentX;\n            private mCurrentY;\n            cancelFling(): void;\n            fling(viewWidth: number, viewHeight: number, velocityX: number, velocityY: number): void;\n            run(): void;\n        }\n        class DefaultOnDoubleTapListener implements android.view.GestureDetector.OnDoubleTapListener {\n            private photoViewAttacher;\n            constructor(photoViewAttacher: PhotoViewAttacher);\n            setPhotoViewAttacher(newPhotoViewAttacher: PhotoViewAttacher): void;\n            onSingleTapConfirmed(e: MotionEvent): boolean;\n            onDoubleTap(ev: MotionEvent): boolean;\n            onDoubleTapEvent(e: MotionEvent): boolean;\n        }\n    }\n}\ndeclare module uk.co.senab.photoview {\n    import Canvas = android.graphics.Canvas;\n    import Matrix = android.graphics.Matrix;\n    import RectF = android.graphics.RectF;\n    import Drawable = android.graphics.drawable.Drawable;\n    import GestureDetector = android.view.GestureDetector;\n    import View = android.view.View;\n    import ImageView = android.widget.ImageView;\n    import OnMatrixChangedListener = uk.co.senab.photoview.PhotoViewAttacher.OnMatrixChangedListener;\n    import OnPhotoTapListener = uk.co.senab.photoview.PhotoViewAttacher.OnPhotoTapListener;\n    import OnViewTapListener = uk.co.senab.photoview.PhotoViewAttacher.OnViewTapListener;\n    import PhotoViewAttacher = uk.co.senab.photoview.PhotoViewAttacher;\n    import IPhotoView = uk.co.senab.photoview.IPhotoView;\n    import ScaleType = ImageView.ScaleType;\n    class PhotoView extends ImageView implements IPhotoView {\n        private mAttacher;\n        private mPendingScaleType;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected init(): void;\n        setPhotoViewRotation(rotationDegree: number): void;\n        setRotationTo(rotationDegree: number): void;\n        setRotationBy(rotationDegree: number): void;\n        canZoom(): boolean;\n        getDisplayRect(): RectF;\n        getDisplayMatrix(): Matrix;\n        setDisplayMatrix(finalRectangle: Matrix): boolean;\n        getMinScale(): number;\n        getMinimumScale(): number;\n        getMidScale(): number;\n        getMediumScale(): number;\n        getMaxScale(): number;\n        getMaximumScale(): number;\n        getScale(): number;\n        getScaleType(): ScaleType;\n        setAllowParentInterceptOnEdge(allow: boolean): void;\n        setMinScale(minScale: number): void;\n        setMinimumScale(minimumScale: number): void;\n        setMidScale(midScale: number): void;\n        setMediumScale(mediumScale: number): void;\n        setMaxScale(maxScale: number): void;\n        setMaximumScale(maximumScale: number): void;\n        setScaleLevels(minimumScale: number, mediumScale: number, maximumScale: number): void;\n        setImageDrawable(drawable: Drawable): void;\n        setImageURI(uri: string): void;\n        protected resizeFromDrawable(): boolean;\n        setOnMatrixChangeListener(listener: OnMatrixChangedListener): void;\n        setOnLongClickListener(l: View.OnLongClickListener): void;\n        setOnPhotoTapListener(listener: OnPhotoTapListener): void;\n        getOnPhotoTapListener(): OnPhotoTapListener;\n        setOnViewTapListener(listener: OnViewTapListener): void;\n        getOnViewTapListener(): OnViewTapListener;\n        setScale(scale: number, animate?: boolean): void;\n        setScale(scale: number, focalX: number, focalY: number, animate?: boolean): void;\n        setScaleType(scaleType: ScaleType): void;\n        setZoomable(zoomable: boolean): void;\n        getVisibleRectangleBitmap(): Canvas;\n        setZoomTransitionDuration(milliseconds: number): void;\n        getIPhotoViewImplementation(): IPhotoView;\n        setOnDoubleTapListener(newOnDoubleTapListener: GestureDetector.OnDoubleTapListener): void;\n        setOnScaleChangeListener(onScaleChangeListener: PhotoViewAttacher.OnScaleChangeListener): void;\n        protected onDetachedFromWindow(): void;\n        protected onAttachedToWindow(): void;\n    }\n}\ndeclare module android.app {\n    import Drawable = android.graphics.drawable.Drawable;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import FrameLayout = android.widget.FrameLayout;\n    class ActionBar extends FrameLayout {\n        private mCenterLayout;\n        private mCustomView;\n        private mTitleView;\n        private mSubTitleView;\n        private mActionLeft;\n        private mActionRight;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: any);\n        setCustomView(view: View, layoutParams?: ViewGroup.MarginLayoutParams): void;\n        setIcon(icon: Drawable): void;\n        setLogo(logo: Drawable): void;\n        setTitle(title: string): void;\n        setSubtitle(subtitle: string): void;\n        getCustomView(): View;\n        getTitle(): string;\n        getSubtitle(): string;\n        show(): void;\n        hide(): void;\n        isShowing(): boolean;\n        setActionLeft(name: string, icon: Drawable, listener: View.OnClickListener): void;\n        hideActionLeft(): void;\n        setActionRight(name: string, icon: Drawable, listener: View.OnClickListener): void;\n        hideActionRight(): void;\n    }\n    module ActionBar {\n    }\n}\ndeclare module android.app {\n    class ActionBarActivity extends Activity {\n        private mActionBar;\n        protected onCreate(savedInstanceState?: android.os.Bundle): void;\n        private initActionBar();\n        private initDefaultBackFinish();\n        setActionBar(actionBar: ActionBar): void;\n        protected invalidateOptionsMenuPopupHelper(menu: android.view.Menu): android.view.menu.MenuPopupHelper;\n        getActionBar(): ActionBar;\n        protected onTitleChanged(title: string, color: number): void;\n    }\n}\ndeclare module androidui.widget {\n    class HtmlView extends HtmlBaseView {\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected onMeasure(widthMeasureSpec: any, heightMeasureSpec: any): void;\n        setHtml(html: string): void;\n        getHtml(): string;\n    }\n}\ndeclare module androidui.widget {\n    class HtmlImageView extends HtmlBaseView {\n        private mScaleType;\n        private mHaveFrame;\n        private mAdjustViewBounds;\n        private mMaxWidth;\n        private mMaxHeight;\n        private mAlpha;\n        private mDrawableWidth;\n        private mDrawableHeight;\n        private mAdjustViewBoundsCompat;\n        private mImgElement;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap;\n        private initImageView();\n        getAdjustViewBounds(): boolean;\n        setAdjustViewBounds(adjustViewBounds: boolean): void;\n        getMaxWidth(): number;\n        setMaxWidth(maxWidth: number): void;\n        getMaxHeight(): number;\n        setMaxHeight(maxHeight: number): void;\n        setImageURI(uri: string): void;\n        setScaleType(scaleType: android.widget.ImageView.ScaleType): void;\n        getScaleType(): android.widget.ImageView.ScaleType;\n        protected onMeasure(widthMeasureSpec: any, heightMeasureSpec: any): void;\n        private resolveAdjustedSize(desiredSize, maxSize, measureSpec);\n        protected setFrame(left: number, top: number, right: number, bottom: number): boolean;\n        private configureBounds();\n        getImageAlpha(): number;\n        setImageAlpha(alpha: number): void;\n    }\n}\ndeclare module androidui.widget {\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import BaseAdapter = android.widget.BaseAdapter;\n    import Context = android.content.Context;\n    class HtmlDataListAdapter extends BaseAdapter implements HtmlDataAdapter {\n        static RefElementTag: string;\n        static RefElementProperty: string;\n        static BindAdapterProperty: string;\n        bindElementData: HTMLElement;\n        mContext: Context;\n        onInflateAdapter(bindElement: HTMLElement, context?: Context, parent?: android.view.ViewGroup): void;\n        private registerHtmlDataObserver();\n        getItemViewType(position: number): number;\n        getView(position: number, convertView: View, parent: ViewGroup): View;\n        getCount(): number;\n        getItem(position: number): Element;\n        private checkReplaceWithRef(element);\n        private removeElementRefAndRestoreToAdapter(childElement);\n        notifyDataSizeWillChange(): void;\n        getItemId(position: number): number;\n    }\n}\ndeclare module androidui.widget {\n    import PagerAdapter = android.support.v4.view.PagerAdapter;\n    import Context = android.content.Context;\n    class HtmlDataPagerAdapter extends PagerAdapter implements HtmlDataAdapter {\n        static RefElementTag: string;\n        static RefElementProperty: string;\n        static BindAdapterProperty: string;\n        bindElementData: HTMLElement;\n        mContext: Context;\n        onInflateAdapter(bindElement: HTMLElement, context?: Context, parent?: android.view.ViewGroup): void;\n        private registerHtmlDataObserver();\n        getCount(): number;\n        instantiateItem(container: android.view.ViewGroup, position: number): any;\n        getItem(position: number): Element;\n        private checkReplaceWithRef(element);\n        private removeElementRefAndRestoreToAdapter(childElement);\n        notifyDataSizeWillChange(): void;\n        destroyItem(container: android.view.ViewGroup, position: number, object: any): void;\n        isViewFromObject(view: android.view.View, object: any): boolean;\n        getItemPosition(object: any): number;\n    }\n}\ndeclare module androidui.widget {\n    import Context = android.content.Context;\n    class HtmlDataPickerAdapter implements HtmlDataAdapter {\n        bindElementData: HTMLElement;\n        onInflateAdapter(bindElement: HTMLElement, context?: Context, parent?: android.view.ViewGroup): void;\n    }\n}\ndeclare module androidui.widget {\n    import View = android.view.View;\n    interface OverScrollLocker {\n        lockOverScrollTop(lockTop: number): void;\n        lockOverScrollBottom(lockBottom: number): void;\n        getScrollContentBottom(): number;\n    }\n    module OverScrollLocker {\n        function getFrom(view: View): OverScrollLocker;\n    }\n}\ndeclare module androidui.widget {\n    import View = android.view.View;\n    import FrameLayout = android.widget.FrameLayout;\n    import TextView = android.widget.TextView;\n    import ProgressBar = android.widget.ProgressBar;\n    class PullRefreshLoadLayout extends FrameLayout {\n        static State_Disable: number;\n        static State_Header_Normal: number;\n        static State_Header_Refreshing: number;\n        static State_Header_ReadyToRefresh: number;\n        static State_Header_RefreshFail: number;\n        static State_Footer_Normal: number;\n        static State_Footer_Loading: number;\n        static State_Footer_ReadyToLoad: number;\n        static State_Footer_LoadFail: number;\n        static State_Footer_NoMoreToLoad: number;\n        static StateChangeLimit: {\n            [x: number]: number[];\n        };\n        private autoLoadScrollAtBottom;\n        private headerView;\n        private footerView;\n        private footerViewReadyDistance;\n        private contentView;\n        private contentOverY;\n        private overScrollLocker;\n        private refreshLoadListener;\n        constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n        protected onViewAdded(child: View): void;\n        private configHeaderView();\n        private configFooterView();\n        private configContentView();\n        private onContentOverScroll(scrollRangeY, maxOverScrollY, isTouchEvent);\n        setHeaderView(headerView: PullRefreshLoadLayout.HeaderView): void;\n        setFooterView(footerView: PullRefreshLoadLayout.FooterView): void;\n        setContentView(contentView: View): void;\n        setHeaderState(newState: number): void;\n        getHeaderState(): number;\n        setFooterState(newState: number): void;\n        getFooterState(): number;\n        private checkLockOverScroll();\n        private checkHeaderFooterPosition();\n        private setHeaderViewAppearDistance(distance);\n        private setFooterViewAppearDistance(distance);\n        protected onLayout(changed: boolean, left: number, top: number, right: number, bottom: number): void;\n        setAutoLoadMoreWhenScrollBottom(autoLoad: boolean): void;\n        setRefreshEnable(enable: boolean): void;\n        setLoadEnable(enable: boolean): void;\n        setRefreshLoadListener(refreshLoadListener: PullRefreshLoadLayout.RefreshLoadListener): void;\n        startRefresh(): void;\n        startLoadMore(): void;\n    }\n    module PullRefreshLoadLayout {\n        interface RefreshLoadListener {\n            onRefresh(prll: PullRefreshLoadLayout): void;\n            onLoadMore(prll: PullRefreshLoadLayout): void;\n        }\n        abstract class HeaderView extends FrameLayout {\n            private state;\n            private stateBeforeReady;\n            protected setStateInner(prll: PullRefreshLoadLayout, state: number): void;\n            abstract onStateChange(newState: number, oldState: number): void;\n        }\n        abstract class FooterView extends FrameLayout {\n            private state;\n            private stateBeforeReady;\n            protected setStateInner(prll: PullRefreshLoadLayout, state: number): void;\n            abstract onStateChange(newState: number, oldState: number): void;\n        }\n        class DefaultHeaderView extends HeaderView {\n            textView: TextView;\n            progressBar: ProgressBar;\n            constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n            onStateChange(newState: number, oldState: number): void;\n        }\n        class DefaultFooterView extends FooterView {\n            textView: TextView;\n            progressBar: ProgressBar;\n            constructor(context: android.content.Context, bindElement?: HTMLElement, defStyle?: Map<string, string>);\n            onStateChange(newState: number, oldState: number): void;\n        }\n    }\n}\ndeclare module androidui.native {\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n    class NativeCanvas extends Canvas {\n        private canvasId;\n        protected initCanvasImpl(): void;\n        protected createCanvasImpl(): void;\n        protected recycleImpl(): void;\n        isNativeAccelerated(): boolean;\n        protected translateImpl(dx: number, dy: number): void;\n        protected scaleImpl(sx: number, sy: number): void;\n        protected rotateImpl(degrees: number): void;\n        protected concatImpl(MSCALE_X: number, MSKEW_X: number, MTRANS_X: number, MSKEW_Y: number, MSCALE_Y: number, MTRANS_Y: number, MPERSP_0: number, MPERSP_1: number, MPERSP_2: number): void;\n        protected drawARGBImpl(a: number, r: number, g: number, b: number): void;\n        protected clearColorImpl(): void;\n        protected saveImpl(): void;\n        protected restoreImpl(): void;\n        protected clipRectImpl(left: number, top: number, width: number, height: number): void;\n        protected clipRoundRectImpl(left: number, top: number, width: number, height: number, radiusTopLeft: number, radiusTopRight: number, radiusBottomRight: number, radiusBottomLeft: number): void;\n        protected drawCanvasImpl(canvas: android.graphics.Canvas, offsetX: number, offsetY: number): void;\n        protected drawImageImpl(image: androidui.image.NetImage, srcRect?: Rect, dstRect?: Rect): void;\n        protected drawRectImpl(left: number, top: number, width: number, height: number, style: android.graphics.Paint.Style): void;\n        protected drawOvalImpl(oval: android.graphics.RectF, style: android.graphics.Paint.Style): void;\n        protected drawCircleImpl(cx: number, cy: number, radius: number, style: android.graphics.Paint.Style): void;\n        protected drawArcImpl(oval: android.graphics.RectF, startAngle: number, sweepAngle: number, useCenter: boolean, style: android.graphics.Paint.Style): void;\n        protected drawRoundRectImpl(rect: android.graphics.RectF, radiusTopLeft: number, radiusTopRight: number, radiusBottomRight: number, radiusBottomLeft: number, style: android.graphics.Paint.Style): void;\n        protected drawTextImpl(text: string, x: number, y: number, style: android.graphics.Paint.Style): void;\n        protected setColorImpl(color: number, style?: android.graphics.Paint.Style): void;\n        protected multiplyGlobalAlphaImpl(alpha: number): void;\n        protected setGlobalAlphaImpl(alpha: number): void;\n        protected setTextAlignImpl(align: string): void;\n        protected setLineWidthImpl(width: number): void;\n        protected setLineCapImpl(lineCap: string): void;\n        protected setLineJoinImpl(lineJoin: string): void;\n        protected setShadowImpl(radius: number, dx: number, dy: number, color: number): void;\n        protected setFontSizeImpl(size: number): void;\n        protected setFontImpl(fontName: string): void;\n        protected isImageSmoothingEnabledImpl(): boolean;\n        protected setImageSmoothingEnabledImpl(enable: boolean): void;\n        private static applyTextMeasure(cacheMeasureTextSize, defaultWidth, widths);\n    }\n}\ndeclare module androidui.native {\n    import Surface = android.view.Surface;\n    class NativeSurface extends Surface {\n        private surfaceId;\n        private lockedCanvas;\n        protected initImpl(): void;\n        notifyBoundChange(): void;\n        protected lockCanvasImpl(left: number, top: number, width: number, height: number): android.graphics.Canvas;\n        unlockCanvasAndPost(canvas: android.graphics.Canvas): void;\n        showFps(fps: number): void;\n        private static notifySurfaceReady(surfaceId);\n        private static notifySurfaceSupportDirtyDraw(surfaceId, dirtyDrawSupport);\n    }\n}\ndeclare module androidui.native {\n    import NetImage = androidui.image.NetImage;\n    import Rect = android.graphics.Rect;\n    class NativeImage extends NetImage {\n        imageId: number;\n        leftBorder: number[];\n        topBorder: number[];\n        rightBorder: number[];\n        bottomBorder: number[];\n        private getPixelsCallbacks;\n        protected createImage(): void;\n        protected loadImage(): void;\n        recycle(): void;\n        getPixels(bound: Rect, callBack: (data: number[]) => void): void;\n        getBorderPixels(callBack: (leftBorder: number[], topBorder: number[], rightBorder: number[], bottomBorder: number[]) => void): void;\n        private static notifyLoadFinish(imageId, width, height, leftBorder, topBorder, rightBorder, bottomBorder);\n        private static notifyLoadError(imageId);\n        private static notifyGetPixels(imageId, callBackIndex, data);\n    }\n}\ndeclare module androidui.native {\n    class NativeEditText extends android.widget.EditText {\n        private mRectTmp;\n        private computeTextArea();\n        protected onInputElementFocusChanged(focused: boolean): any;\n        protected tryShowInputElement(): any;\n        protected tryDismissInputElement(): any;\n        protected _syncBoundAndScrollToElement(): void;\n        protected onDetachedFromWindow(): void;\n    }\n}\ndeclare module androidui.native {\n    import WebView = android.webkit.WebView;\n    class NativeWebView extends WebView {\n        private mBoundRect;\n        private mRectTmp;\n        private mLocationTmp;\n        private mUrl;\n        private mTitle;\n        private mCanGoBack;\n        constructor(context: android.content.Context, bindElement: HTMLElement, defStyle: any);\n        goBack(): void;\n        canGoBack(): boolean;\n        loadUrl(url: string): void;\n        reload(): void;\n        getUrl(): string;\n        getTitle(): string;\n        setWebViewClient(client: android.webkit.WebViewClient): void;\n        protected dependOnDebugLayout(): boolean;\n        protected _syncBoundAndScrollToElement(): void;\n        private static notifyLoadFinish(viewHash, url, title);\n        private static notifyWebViewHistoryChange(viewHash, currentHistoryIndex, historySize);\n    }\n}\ndeclare module androidui.native {\n    import HtmlView = androidui.widget.HtmlView;\n    class NativeHtmlView extends HtmlView {\n        private mRectDrawHTMLBoundTmp;\n        protected _syncBoundAndScrollToElement(): void;\n        protected onDetachedFromWindow(): void;\n    }\n}\ndeclare module androidui.native {\n    class NativeApi {\n        static surface: NativeApi.SurfaceApi;\n        static canvas: NativeApi.CanvasApi;\n        static image: NativeApi.ImageApi;\n        static drawHTML: NativeApi.DrawHTMLBoundApi;\n        static webView: NativeApi.WebViewApi;\n    }\n    module NativeApi {\n        class SurfaceApi {\n            createSurface(surfaceId: number, left: number, top: number, right: number, bottom: number): void;\n            onSurfaceBoundChange(surfaceId: number, left: number, top: number, right: number, bottom: number): void;\n            lockCanvas(surfaceId: number, canvasId: number, left: number, top: number, right: number, bottom: number): void;\n            unlockCanvasAndPost(surfaceId: number, canvasId: number): void;\n            showFps(fps: number): void;\n        }\n        class CanvasApi {\n            createCanvas(canvasId: number, width: number, height: number): void;\n            recycleCanvas(canvasId: number): void;\n            translate(canvasId: number, dx: number, dy: number): void;\n            scale(canvasId: number, sx: number, sy: number): void;\n            rotate(canvasId: number, degrees: number): void;\n            concat(canvasId: number, MSCALE_X: number, MSKEW_X: number, MTRANS_X: number, MSKEW_Y: number, MSCALE_Y: number, MTRANS_Y: number): void;\n            drawColor(canvasId: number, color: number): void;\n            clearColor(canvasId: number): void;\n            drawRect(canvasId: number, left: number, top: number, width: number, height: number, style: android.graphics.Paint.Style): void;\n            clipRect(canvasId: number, left: number, top: number, width: number, height: number): void;\n            save(canvasId: number): void;\n            restore(canvasId: number): void;\n            drawCanvas(canvasId: number, drawCanvasId: number, offsetX: number, offsetY: number): void;\n            drawText(canvasId: number, text: string, x: number, y: number, fillStyle: android.graphics.Paint.Style): void;\n            setFillColor(canvasId: number, color: number, style: android.graphics.Paint.Style): void;\n            multiplyGlobalAlpha(canvasId: number, alpha: number): void;\n            setGlobalAlpha(canvasId: number, alpha: number): void;\n            setTextAlign(canvasId: number, align: string): void;\n            setLineWidth(canvasId: number, width: number): void;\n            setLineCap(canvasId: number, lineCap: string): void;\n            setLineJoin(canvasId: number, lineJoin: string): void;\n            setShadow(canvasId: number, radius: number, dx: number, dy: number, color: number): void;\n            setFontSize(canvasId: number, size: number): void;\n            setFont(canvasId: number, fontName: string): void;\n            drawOval(canvasId: number, left: number, top: number, right: number, bottom: number, style: android.graphics.Paint.Style): void;\n            drawCircle(canvasId: number, cx: number, cy: number, radius: number, style: android.graphics.Paint.Style): void;\n            drawArc(canvasId: number, left: number, top: number, right: number, bottom: number, startAngle: number, sweepAngle: number, useCenter: boolean, style: android.graphics.Paint.Style): void;\n            drawRoundRectImpl(canvasId: number, left: number, top: number, width: number, height: number, radiusTopLeft: number, radiusTopRight: number, radiusBottomRight: number, radiusBottomLeft: number, style: android.graphics.Paint.Style): void;\n            clipRoundRectImpl(canvasId: number, left: number, top: number, width: number, height: number, radiusTopLeft: number, radiusTopRight: number, radiusBottomRight: number, radiusBottomLeft: number): void;\n            drawImage2args(canvasId: number, drawImageId: number, left: number, top: number): void;\n            drawImage4args(canvasId: number, drawImageId: number, dstLeft: number, dstTop: number, dstRight: number, dstBottom: number): void;\n            drawImage8args(canvasId: number, drawImageId: number, srcLeft: number, srcTop: number, srcRight: number, srcBottom: number, dstLeft: number, dstTop: number, dstRight: number, dstBottom: number): void;\n        }\n        interface ImageApi {\n            createImage(imageId: number): void;\n            loadImage(imageId: number, src: string): void;\n            recycleImage(imageId: number): void;\n            getPixels(imageId: number, callbackIndex: number, left: number, top: number, right: number, bottom: number): void;\n        }\n        interface DrawHTMLBoundApi {\n            showDrawHTMLBound(viewHash: number, left: number, top: number, right: number, bottom: number): void;\n            hideDrawHTMLBound(viewHash: number): void;\n        }\n        interface WebViewApi {\n            createWebView(viewHash: number): void;\n            destroyWebView(viewHash: number): void;\n            webViewBoundChange(viewHash: number, left: number, top: number, right: number, bottom: number): void;\n            webViewLoadUrl(viewHash: number, url: string): void;\n            webViewGoBack(viewHash: number): void;\n            webViewReload(viewHash: number): void;\n        }\n    }\n}\n"
  },
  {
    "path": "dist/android-ui.es5.js",
    "content": "'use strict';var _typeof=typeof Symbol===\"function\"&&typeof Symbol.iterator===\"symbol\"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol===\"function\"&&obj.constructor===Symbol&&obj!==Symbol.prototype?\"symbol\":typeof obj;};var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i[\"return\"])_i[\"return\"]();}finally{if(_d)throw _e;}}return _arr;}return function(arr,i){if(Array.isArray(arr)){return arr;}else if(Symbol.iterator in Object(arr)){return sliceIterator(arr,i);}else{throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");}};}();var _get2=function get(object,property,receiver){if(object===null)object=Function.prototype;var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===undefined){var parent=Object.getPrototypeOf(object);if(parent===null){return undefined;}else{return get(parent,property,receiver);}}else if(\"value\"in desc){return desc.value;}else{var getter=desc.get;if(getter===undefined){return undefined;}return getter.call(receiver);}};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if(\"value\"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");}return call&&(typeof call===\"object\"||typeof call===\"function\")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!==\"function\"&&superClass!==null){throw new TypeError(\"Super expression must either be null or a function, not \"+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++){arr2[i]=arr[i];}return arr2;}else{return Array.from(arr);}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError(\"Cannot call a class as a function\");}}/**\n * AndroidUIX v0.7.0\n * https://github.com/linfaxin/AndroidUIX\n */var java;(function(java){var util;(function(util){var ArrayList=function(){function ArrayList(){var initialCapacity=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;_classCallCheck(this,ArrayList);this.array=[];}_createClass(ArrayList,[{key:'size',value:function size(){return this.array.length;}},{key:'isEmpty',value:function isEmpty(){return this.size()<=0;}},{key:'contains',value:function contains(o){return this.indexOf(o)>=0;}},{key:'indexOf',value:function indexOf(o){return this.array.indexOf(o);}},{key:'lastIndexOf',value:function lastIndexOf(o){return this.array.lastIndexOf(o);}},{key:'clone',value:function clone(){var _arrayList$array;var arrayList=new ArrayList();(_arrayList$array=arrayList.array).push.apply(_arrayList$array,_toConsumableArray(this.array));return arrayList;}},{key:'toArray',value:function toArray(){var a=arguments.length>0&&arguments[0]!==undefined?arguments[0]:new Array(this.size());var size=this.size();for(var i=0;i<size;i++){a[i]=this.array[i];}return a;}},{key:'getArray',value:function getArray(){return this.array;}},{key:'get',value:function get(index){index=Math.floor(index);return this.array[index];}},{key:'set',value:function set(index,element){index=Math.floor(index);var old=this.array[index];this.array[index]=element;return old;}},{key:'add',value:function add(){var index=void 0,t=void 0;if(arguments.length===1)t=arguments.length<=0?undefined:arguments[0];else if(arguments.length===2){index=Math.floor(arguments.length<=0?undefined:arguments[0]);t=arguments.length<=1?undefined:arguments[1];}if(index===undefined)this.array.push(t);else this.array.splice(index,0,t);}},{key:'remove',value:function remove(o){var index=void 0;if(Number.isInteger(o)){index=o;}else{index=this.array.indexOf(o);}var old=this.array[index];this.array.splice(index,1);return old;}},{key:'clear',value:function clear(){this.array=[];}},{key:'addAll',value:function addAll(){var index=void 0,list=void 0;if(arguments.length===1){list=arguments.length<=0?undefined:arguments[0];}else if(arguments.length===2){index=Math.floor(arguments.length<=0?undefined:arguments[0]);list=arguments.length<=1?undefined:arguments[1];}if(index===undefined){var _array;(_array=this.array).push.apply(_array,_toConsumableArray(list.array));}else{var _array2;(_array2=this.array).splice.apply(_array2,[index,0].concat(_toConsumableArray(list.array)));}}},{key:'removeAll',value:function removeAll(list){var _this=this;var oldSize=this.size();list.array.forEach(function(item){var index=_this.array.indexOf(item);_this.array.splice(index,1);});return this.size()===oldSize;}},{key:Symbol.iterator,value:function value(){return this.array[Symbol.iterator];}},{key:'subList',value:function subList(fromIndex,toIndex){var list=new ArrayList();fromIndex=Math.floor(fromIndex);toIndex=Math.floor(toIndex);for(var i=fromIndex;i<toIndex;i++){list.array.push(this.array[i]);}return list;}},{key:'toString',value:function toString(){return this.array.toString();}},{key:'sort',value:function sort(compareFn){this.array.sort(compareFn);}}]);return ArrayList;}();util.ArrayList=ArrayList;})(util=java.util||(java.util={}));})(java||(java={}));var android;(function(android){var os;(function(os){var Bundle=function(){function Bundle(copy){_classCallCheck(this,Bundle);if(copy)Object.assign(this,copy);}_createClass(Bundle,[{key:'get',value:function get(key,defaultValue){if(this.containsKey(key)){return this[key];}return defaultValue;}},{key:'put',value:function put(key,value){this[key]=value;}},{key:'containsKey',value:function containsKey(key){return key in this;}}]);return Bundle;}();os.Bundle=Bundle;})(os=android.os||(android.os={}));})(android||(android={}));var java;(function(java){var lang;(function(lang){var StringBuilder=function(){function StringBuilder(arg){_classCallCheck(this,StringBuilder);this.array=[];if(!Number.isInteger(arg)&&arg){this.append(arg);}}_createClass(StringBuilder,[{key:'length',value:function length(){return this.array.length;}},{key:'append',value:function append(a){var _array3;var str=a+'';(_array3=this.array).push.apply(_array3,_toConsumableArray(str.split('')));return this;}},{key:'deleteCharAt',value:function deleteCharAt(index){this.array.splice(index,1);return this;}},{key:'replace',value:function replace(start,end,str){var _array4;(_array4=this.array).splice.apply(_array4,[start,end-start].concat(_toConsumableArray(str.split(''))));return this;}},{key:'setLength',value:function setLength(length){var arrayLength=this.array.length;if(length===arrayLength)return;if(length<arrayLength){this.array=this.array.splice(length,arrayLength-length);}else{for(var i=0;i<arrayLength-length;i++){this.array.push('\\0');}}}},{key:'toString',value:function toString(){return this.array.join('');}}]);return StringBuilder;}();lang.StringBuilder=StringBuilder;})(lang=java.lang||(java.lang={}));})(java||(java={}));var android;(function(android){var graphics;(function(graphics){var StringBuilder=java.lang.StringBuilder;var Rect=function(){function Rect(){_classCallCheck(this,Rect);this.left=0;this.top=0;this.right=0;this.bottom=0;for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}if(args.length===1){var rect=args[0];this.left=rect.left;this.top=rect.top;this.right=rect.right;this.bottom=rect.bottom;}else if(args.length===4||args.length===0){var _args$=args[0],left=_args$===undefined?0:_args$,_args$2=args[1],t=_args$2===undefined?0:_args$2,_args$3=args[2],right=_args$3===undefined?0:_args$3,_args$4=args[3],bottom=_args$4===undefined?0:_args$4;this.left=left||0;this.top=t||0;this.right=right||0;this.bottom=bottom||0;}}_createClass(Rect,[{key:'equals',value:function equals(r){if(this===r)return true;if(!r||!(r instanceof Rect))return false;return this.left===r.left&&this.top===r.top&&this.right===r.right&&this.bottom===r.bottom;}},{key:'toString',value:function toString(){var sb=new StringBuilder();sb.append(\"Rect(\");sb.append(this.left);sb.append(\", \");sb.append(this.top);sb.append(\" - \");sb.append(this.right);sb.append(\", \");sb.append(this.bottom);sb.append(\")\");return sb.toString();}},{key:'toShortString',value:function toShortString(){var sb=arguments.length>0&&arguments[0]!==undefined?arguments[0]:new StringBuilder();sb.setLength(0);sb.append('[');sb.append(this.left);sb.append(',');sb.append(this.top);sb.append(\"][\");sb.append(this.right);sb.append(',');sb.append(this.bottom);sb.append(']');return sb.toString();}},{key:'flattenToString',value:function flattenToString(){var sb=new StringBuilder(32);sb.append(this.left);sb.append(' ');sb.append(this.top);sb.append(' ');sb.append(this.right);sb.append(' ');sb.append(this.bottom);return sb.toString();}},{key:'isEmpty',value:function isEmpty(){return this.left>=this.right||this.top>=this.bottom;}},{key:'width',value:function width(){return this.right-this.left;}},{key:'height',value:function height(){return this.bottom-this.top;}},{key:'centerX',value:function centerX(){return this.left+this.right>>1;}},{key:'centerY',value:function centerY(){return this.top+this.bottom>>1;}},{key:'exactCenterX',value:function exactCenterX(){return(this.left+this.right)*0.5;}},{key:'exactCenterY',value:function exactCenterY(){return(this.top+this.bottom)*0.5;}},{key:'setEmpty',value:function setEmpty(){this.left=this.right=this.top=this.bottom=0;}},{key:'set',value:function set(){for(var _len2=arguments.length,args=Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}if(args.length===1){var rect=args[0];var _ref=[rect.left,rect.top,rect.right,rect.bottom];this.left=_ref[0];this.top=_ref[1];this.right=_ref[2];this.bottom=_ref[3];}else{var _args$5=args[0],left=_args$5===undefined?0:_args$5,_args$6=args[1],t=_args$6===undefined?0:_args$6,_args$7=args[2],right=_args$7===undefined?0:_args$7,_args$8=args[3],bottom=_args$8===undefined?0:_args$8;this.left=left||0;this.top=t||0;this.right=right||0;this.bottom=bottom||0;}}},{key:'offset',value:function offset(dx,dy){this.left+=dx;this.top+=dy;this.right+=dx;this.bottom+=dy;}},{key:'offsetTo',value:function offsetTo(newLeft,newTop){this.right+=newLeft-this.left;this.bottom+=newTop-this.top;this.left=newLeft;this.top=newTop;}},{key:'inset',value:function inset(dx,dy){this.left+=dx;this.top+=dy;this.right-=dx;this.bottom-=dy;}},{key:'contains',value:function contains(){for(var _len3=arguments.length,args=Array(_len3),_key3=0;_key3<_len3;_key3++){args[_key3]=arguments[_key3];}if(args.length===1){var r=args[0];return this.left<this.right&&this.top<this.bottom&&this.left<=r.left&&this.top<=r.top&&this.right>=r.right&&this.bottom>=r.bottom;}else if(args.length===2){var x=args[0],y=args[1];return this.left<this.right&&this.top<this.bottom&&x>=this.left&&x<this.right&&y>=this.top&&y<this.bottom;}else{var _args$9=args[0],left=_args$9===undefined?0:_args$9,_args$10=args[1],t=_args$10===undefined?0:_args$10,_args$11=args[2],right=_args$11===undefined?0:_args$11,_args$12=args[3],bottom=_args$12===undefined?0:_args$12;return this.left<this.right&&this.top<this.bottom&&this.left<=left&&this.top<=t&&this.right>=right&&this.bottom>=bottom;}}},{key:'intersect',value:function intersect(){for(var _len4=arguments.length,args=Array(_len4),_key4=0;_key4<_len4;_key4++){args[_key4]=arguments[_key4];}if(args.length===1){var rect=args[0];return this.intersect(rect.left,rect.top,rect.right,rect.bottom);}else{var _args$13=args[0],left=_args$13===undefined?0:_args$13,_args$14=args[1],t=_args$14===undefined?0:_args$14,_args$15=args[2],right=_args$15===undefined?0:_args$15,_args$16=args[3],bottom=_args$16===undefined?0:_args$16;if(this.left<right&&left<this.right&&this.top<bottom&&t<this.bottom){if(this.left<left)this.left=left;if(this.top<t)this.top=t;if(this.right>right)this.right=right;if(this.bottom>bottom)this.bottom=bottom;return true;}return false;}}},{key:'setIntersect',value:function setIntersect(a,b){if(a.left<b.right&&b.left<a.right&&a.top<b.bottom&&b.top<a.bottom){this.left=Math.max(a.left,b.left);this.top=Math.max(a.top,b.top);this.right=Math.min(a.right,b.right);this.bottom=Math.min(a.bottom,b.bottom);return true;}return false;}},{key:'intersects',value:function intersects(){for(var _len5=arguments.length,args=Array(_len5),_key5=0;_key5<_len5;_key5++){args[_key5]=arguments[_key5];}if(args.length===1){var rect=args[0];return this.intersects(rect.left,rect.top,rect.right,rect.bottom);}else{var _args$17=args[0],left=_args$17===undefined?0:_args$17,_args$18=args[1],t=_args$18===undefined?0:_args$18,_args$19=args[2],right=_args$19===undefined?0:_args$19,_args$20=args[3],bottom=_args$20===undefined?0:_args$20;return this.left<right&&left<this.right&&this.top<bottom&&t<this.bottom;}}},{key:'union',value:function union(){for(var _len6=arguments.length,args=Array(_len6),_key6=0;_key6<_len6;_key6++){args[_key6]=arguments[_key6];}if(arguments.length===1){var rect=args[0];this.union(rect.left,rect.top,rect.right,rect.bottom);}else if(arguments.length===2){var _args$21=args[0],x=_args$21===undefined?0:_args$21,_args$22=args[1],y=_args$22===undefined?0:_args$22;if(x<this.left){this.left=x;}else if(x>this.right){this.right=x;}if(y<this.top){this.top=y;}else if(y>this.bottom){this.bottom=y;}}else{var left=args[0];var top=args[1];var right=args[2];var bottom=args[3];if(left<right&&top<bottom){if(this.left<this.right&&this.top<this.bottom){if(this.left>left)this.left=left;if(this.top>top)this.top=top;if(this.right<right)this.right=right;if(this.bottom<bottom)this.bottom=bottom;}else{this.left=left;this.top=top;this.right=right;this.bottom=bottom;}}}}},{key:'sort',value:function sort(){if(this.left>this.right){var _ref2=[this.right,this.left];this.left=_ref2[0];this.right=_ref2[1];}if(this.top>this.bottom){var _ref3=[this.bottom,this.top];this.top=_ref3[0];this.bottom=_ref3[1];}}},{key:'scale',value:function scale(_scale){if(_scale!=1){this.left=this.left*_scale;this.top=this.top*_scale;this.right=this.right*_scale;this.bottom=this.bottom*_scale;}}}],[{key:'unflattenFromString',value:function unflattenFromString(str){var parts=str.split(\" \");return new Rect(Number.parseInt(parts[0]),Number.parseInt(parts[1]),Number.parseInt(parts[2]),Number.parseInt(parts[3]));}},{key:'intersects',value:function intersects(a,b){return a.left<b.right&&b.left<a.right&&a.top<b.bottom&&b.top<a.bottom;}}]);return Rect;}();graphics.Rect=Rect;})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var view;(function(view){var Gravity=function(){function Gravity(){_classCallCheck(this,Gravity);}_createClass(Gravity,null,[{key:'apply',value:function apply(gravity,w,h,container,outRect,layoutDirection){var xAdj=0,yAdj=0;if(layoutDirection!=null)gravity=Gravity.getAbsoluteGravity(gravity,layoutDirection);switch(gravity&(Gravity.AXIS_PULL_BEFORE|Gravity.AXIS_PULL_AFTER)<<Gravity.AXIS_X_SHIFT){case 0:outRect.left=container.left+(container.right-container.left-w)/2+xAdj;outRect.right=outRect.left+w;if((gravity&Gravity.AXIS_CLIP<<Gravity.AXIS_X_SHIFT)==Gravity.AXIS_CLIP<<Gravity.AXIS_X_SHIFT){if(outRect.left<container.left){outRect.left=container.left;}if(outRect.right>container.right){outRect.right=container.right;}}break;case Gravity.AXIS_PULL_BEFORE<<Gravity.AXIS_X_SHIFT:outRect.left=container.left+xAdj;outRect.right=outRect.left+w;if((gravity&Gravity.AXIS_CLIP<<Gravity.AXIS_X_SHIFT)==Gravity.AXIS_CLIP<<Gravity.AXIS_X_SHIFT){if(outRect.right>container.right){outRect.right=container.right;}}break;case Gravity.AXIS_PULL_AFTER<<Gravity.AXIS_X_SHIFT:outRect.right=container.right-xAdj;outRect.left=outRect.right-w;if((gravity&Gravity.AXIS_CLIP<<Gravity.AXIS_X_SHIFT)==Gravity.AXIS_CLIP<<Gravity.AXIS_X_SHIFT){if(outRect.left<container.left){outRect.left=container.left;}}break;default:outRect.left=container.left+xAdj;outRect.right=container.right+xAdj;break;}switch(gravity&(Gravity.AXIS_PULL_BEFORE|Gravity.AXIS_PULL_AFTER)<<Gravity.AXIS_Y_SHIFT){case 0:outRect.top=container.top+(container.bottom-container.top-h)/2+yAdj;outRect.bottom=outRect.top+h;if((gravity&Gravity.AXIS_CLIP<<Gravity.AXIS_Y_SHIFT)==Gravity.AXIS_CLIP<<Gravity.AXIS_Y_SHIFT){if(outRect.top<container.top){outRect.top=container.top;}if(outRect.bottom>container.bottom){outRect.bottom=container.bottom;}}break;case Gravity.AXIS_PULL_BEFORE<<Gravity.AXIS_Y_SHIFT:outRect.top=container.top+yAdj;outRect.bottom=outRect.top+h;if((gravity&Gravity.AXIS_CLIP<<Gravity.AXIS_Y_SHIFT)==Gravity.AXIS_CLIP<<Gravity.AXIS_Y_SHIFT){if(outRect.bottom>container.bottom){outRect.bottom=container.bottom;}}break;case Gravity.AXIS_PULL_AFTER<<Gravity.AXIS_Y_SHIFT:outRect.bottom=container.bottom-yAdj;outRect.top=outRect.bottom-h;if((gravity&Gravity.AXIS_CLIP<<Gravity.AXIS_Y_SHIFT)==Gravity.AXIS_CLIP<<Gravity.AXIS_Y_SHIFT){if(outRect.top<container.top){outRect.top=container.top;}}break;default:outRect.top=container.top+yAdj;outRect.bottom=container.bottom+yAdj;break;}}},{key:'getAbsoluteGravity',value:function getAbsoluteGravity(gravity,layoutDirection){return gravity;}},{key:'parseGravity',value:function parseGravity(gravityStr){var defaultGravity=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Gravity.NO_GRAVITY;if(!gravityStr)return defaultGravity;var gravity=null;try{var parts=gravityStr.split(\"|\");var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=parts[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var part=_step.value;var g=Gravity[part.toUpperCase()];if(Number.isInteger(g))gravity|=g;}}catch(err){_didIteratorError=true;_iteratorError=err;}finally{try{if(!_iteratorNormalCompletion&&_iterator.return){_iterator.return();}}finally{if(_didIteratorError){throw _iteratorError;}}}}catch(e){console.error(e);}if(Number.isNaN(gravity))return defaultGravity;return gravity;}}]);return Gravity;}();Gravity.NO_GRAVITY=0x0000;Gravity.AXIS_SPECIFIED=0x0001;Gravity.AXIS_PULL_BEFORE=0x0002;Gravity.AXIS_PULL_AFTER=0x0004;Gravity.AXIS_CLIP=0x0008;Gravity.AXIS_X_SHIFT=0;Gravity.AXIS_Y_SHIFT=4;Gravity.TOP=(Gravity.AXIS_PULL_BEFORE|Gravity.AXIS_SPECIFIED)<<Gravity.AXIS_Y_SHIFT;Gravity.BOTTOM=(Gravity.AXIS_PULL_AFTER|Gravity.AXIS_SPECIFIED)<<Gravity.AXIS_Y_SHIFT;Gravity.LEFT=(Gravity.AXIS_PULL_BEFORE|Gravity.AXIS_SPECIFIED)<<Gravity.AXIS_X_SHIFT;Gravity.RIGHT=(Gravity.AXIS_PULL_AFTER|Gravity.AXIS_SPECIFIED)<<Gravity.AXIS_X_SHIFT;Gravity.START=Gravity.LEFT;Gravity.END=Gravity.RIGHT;Gravity.CENTER_VERTICAL=Gravity.AXIS_SPECIFIED<<Gravity.AXIS_Y_SHIFT;Gravity.FILL_VERTICAL=Gravity.TOP|Gravity.BOTTOM;Gravity.CENTER_HORIZONTAL=Gravity.AXIS_SPECIFIED<<Gravity.AXIS_X_SHIFT;Gravity.FILL_HORIZONTAL=Gravity.LEFT|Gravity.RIGHT;Gravity.CENTER=Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL;Gravity.FILL=Gravity.FILL_VERTICAL|Gravity.FILL_HORIZONTAL;Gravity.CLIP_VERTICAL=Gravity.AXIS_CLIP<<Gravity.AXIS_Y_SHIFT;Gravity.CLIP_HORIZONTAL=Gravity.AXIS_CLIP<<Gravity.AXIS_X_SHIFT;Gravity.HORIZONTAL_GRAVITY_MASK=(Gravity.AXIS_SPECIFIED|Gravity.AXIS_PULL_BEFORE|Gravity.AXIS_PULL_AFTER)<<Gravity.AXIS_X_SHIFT;Gravity.VERTICAL_GRAVITY_MASK=(Gravity.AXIS_SPECIFIED|Gravity.AXIS_PULL_BEFORE|Gravity.AXIS_PULL_AFTER)<<Gravity.AXIS_Y_SHIFT;Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK=Gravity.HORIZONTAL_GRAVITY_MASK;Gravity.DISPLAY_CLIP_VERTICAL=0x10000000;Gravity.DISPLAY_CLIP_HORIZONTAL=0x01000000;view.Gravity=Gravity;})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var util;(function(util){var SparseMap=function(){function SparseMap(initialCapacity){_classCallCheck(this,SparseMap);this.map=new Map();}_createClass(SparseMap,[{key:'clone',value:function clone(){var clone=new SparseMap();clone.map=new Map(this.map);return clone;}},{key:'get',value:function get(key){var valueIfKeyNotFound=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var value=this.map.get(key);if(value===undefined)return valueIfKeyNotFound;return value;}},{key:'delete',value:function _delete(key){this.map.delete(key);}},{key:'remove',value:function remove(key){this.delete(key);}},{key:'removeAt',value:function removeAt(index){this.removeAtRange(index);}},{key:'removeAtRange',value:function removeAtRange(index){var size=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var keys=[].concat(_toConsumableArray(this.map.keys()));var end=Math.min(this.map.size,index+size);for(var i=index;i<end;i++){this.map.delete(keys[i]);}}},{key:'put',value:function put(key,value){this.map.set(key,value);}},{key:'size',value:function size(){return this.map.size;}},{key:'keyAt',value:function keyAt(index){return[].concat(_toConsumableArray(this.map.keys()))[index];}},{key:'valueAt',value:function valueAt(index){return[].concat(_toConsumableArray(this.map.values()))[index];}},{key:'setValueAt',value:function setValueAt(index,value){var key=this.keyAt(index);this.map.set(key,value);}},{key:'indexOfKey',value:function indexOfKey(key){return[].concat(_toConsumableArray(this.map.keys())).indexOf(key);}},{key:'indexOfValue',value:function indexOfValue(value){return[].concat(_toConsumableArray(this.map.values())).indexOf(value);}},{key:'clear',value:function clear(){this.map.clear();}},{key:'append',value:function append(key,value){this.put(key,value);}}]);return SparseMap;}();util.SparseMap=SparseMap;})(util=android.util||(android.util={}));})(android||(android={}));var android;(function(android){var util;(function(util){var SparseArray=function(_util$SparseMap){_inherits(SparseArray,_util$SparseMap);function SparseArray(){_classCallCheck(this,SparseArray);return _possibleConstructorReturn(this,(SparseArray.__proto__||Object.getPrototypeOf(SparseArray)).apply(this,arguments));}return SparseArray;}(util.SparseMap);util.SparseArray=SparseArray;})(util=android.util||(android.util={}));})(android||(android={}));var android;(function(android){var util;(function(util){var Log=function(){function Log(){_classCallCheck(this,Log);}_createClass(Log,null,[{key:'getPriorityString',value:function getPriorityString(priority){if(priority>Log.PriorityString.length)return\"\";return Log.PriorityString[priority-2];}},{key:'v',value:function v(tag,msg,tr){console.log(Log.getLogMsg(Log.VERBOSE,tag,msg));if(tr)console.log(tr);}},{key:'d',value:function d(tag,msg){console.debug(Log.getLogMsg(Log.DEBUG,tag,msg));}},{key:'i',value:function i(tag,msg,tr){console.info(Log.getLogMsg(Log.INFO,tag,msg));if(tr)console.info(tr);}},{key:'w',value:function w(tag,msg,tr){console.warn(Log.getLogMsg(Log.WARN,tag,msg));if(tr)console.warn(tr);}},{key:'e',value:function e(tag,msg,tr){console.error(Log.getLogMsg(Log.ERROR,tag,msg));if(tr)console.error(tr);}},{key:'getLogMsg',value:function getLogMsg(priority,tag,msg){var d=new Date();var dateFormat=d.toLocaleTimeString()+'.'+d.getUTCMilliseconds();return\"[\"+Log.getPriorityString(priority)+\"] \"+dateFormat+\" \\t \"+tag+\" \\t \"+msg;}}]);return Log;}();Log.View_DBG=false;Log.VelocityTracker_DBG=false;Log.DBG_DrawableContainer=false;Log.DBG_StateListDrawable=false;Log.VERBOSE=2;Log.DEBUG=3;Log.INFO=4;Log.WARN=5;Log.ERROR=6;Log.ASSERT=7;Log.PriorityString=[\"VERBOSE\",\"DEBUG\",\"INFO\",\"WARN\",\"ERROR\",\"ASSERT\"];util.Log=Log;})(util=android.util||(android.util={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var PixelFormat=function PixelFormat(){_classCallCheck(this,PixelFormat);};PixelFormat.UNKNOWN=0;PixelFormat.TRANSLUCENT=-3;PixelFormat.TRANSPARENT=-2;PixelFormat.OPAQUE=-1;PixelFormat.RGBA_8888=1;PixelFormat.RGBX_8888=2;PixelFormat.RGB_888=3;PixelFormat.RGB_565=4;graphics.PixelFormat=PixelFormat;})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var java;(function(java){var lang;(function(lang){var ref;(function(ref){var WeakReference=function(){function WeakReference(referent){_classCallCheck(this,WeakReference);this.weakMap=new WeakMap();this.weakMap.set(this,referent);}_createClass(WeakReference,[{key:'get',value:function get(){return this.weakMap.get(this);}},{key:'set',value:function set(value){this.weakMap.set(this,value);}},{key:'clear',value:function clear(){this.weakMap.delete(this);}}]);return WeakReference;}();ref.WeakReference=WeakReference;})(ref=lang.ref||(lang.ref={}));})(lang=java.lang||(java.lang={}));})(java||(java={}));var java;(function(java){var lang;(function(lang){var Runnable;(function(Runnable){function of(func){return{run:func};}Runnable.of=of;})(Runnable=lang.Runnable||(lang.Runnable={}));})(lang=java.lang||(java.lang={}));})(java||(java={}));var java;(function(java){var lang;(function(lang){var System=function(){function System(){_classCallCheck(this,System);}_createClass(System,null,[{key:'currentTimeMillis',value:function currentTimeMillis(){return new Date().getTime();}},{key:'arraycopy',value:function arraycopy(src,srcPos,dest,destPos,length){var srcLength=src.length;var destLength=dest.length;for(var i=0;i<length;i++){var srcIndex=i+srcPos;if(srcIndex>=srcLength)return;var destIndex=i+destPos;if(destIndex>=destLength)return;dest[destIndex]=src[srcIndex];}}}]);return System;}();System.out={println:function println(any){console.log('\\n');console.log(any);},print:function print(any){console.log(any);}};lang.System=System;})(lang=java.lang||(java.lang={}));})(java||(java={}));var androidui;(function(androidui){var util;(function(util){var ArrayCreator=function(){function ArrayCreator(){_classCallCheck(this,ArrayCreator);}_createClass(ArrayCreator,null,[{key:'newNumberArray',value:function newNumberArray(size){var array=new Array(size);if(size>0)ArrayCreator.fillArray(array,0);return array;}},{key:'newBooleanArray',value:function newBooleanArray(size){var array=new Array(size);ArrayCreator.fillArray(array,false);return array;}},{key:'fillArray',value:function fillArray(array,value){for(var i=0,length=array.length;i<length;i++){array[i]=value;}}}]);return ArrayCreator;}();util.ArrayCreator=ArrayCreator;})(util=androidui.util||(androidui.util={}));})(androidui||(androidui={}));var android;(function(android){var util;(function(util){var System=java.lang.System;var StateSet=function(){function StateSet(){_classCallCheck(this,StateSet);}_createClass(StateSet,null,[{key:'isWildCard',value:function isWildCard(stateSetOrSpec){return stateSetOrSpec.length==0||stateSetOrSpec[0]==0;}},{key:'stateSetMatches',value:function stateSetMatches(stateSpec,stateSetOrState){if(Number.isInteger(stateSetOrState)){return StateSet._stateSetMatches_single(stateSpec,stateSetOrState);}var stateSet=stateSetOrState;if(stateSet==null){return stateSpec==null||this.isWildCard(stateSpec);}var stateSpecSize=stateSpec.length;var stateSetSize=stateSet.length;for(var i=0;i<stateSpecSize;i++){var stateSpecState=stateSpec[i];if(stateSpecState==0){return true;}var mustMatch=void 0;if(stateSpecState>0){mustMatch=true;}else{mustMatch=false;stateSpecState=-stateSpecState;}var found=false;for(var j=0;j<stateSetSize;j++){var state=stateSet[j];if(state==0){if(mustMatch){return false;}else{break;}}if(state==stateSpecState){if(mustMatch){found=true;break;}else{return false;}}}if(mustMatch&&!found){return false;}}return true;}},{key:'_stateSetMatches_single',value:function _stateSetMatches_single(stateSpec,state){var stateSpecSize=stateSpec.length;for(var i=0;i<stateSpecSize;i++){var stateSpecState=stateSpec[i];if(stateSpecState==0){return true;}if(stateSpecState>0){if(state!=stateSpecState){return false;}}else{if(state==-stateSpecState){return false;}}}return true;}},{key:'trimStateSet',value:function trimStateSet(states,newSize){if(states.length==newSize){return states;}var trimmedStates=androidui.util.ArrayCreator.newNumberArray(newSize);System.arraycopy(states,0,trimmedStates,0,newSize);return trimmedStates;}}]);return StateSet;}();StateSet.WILD_CARD=[];StateSet.NOTHING=[0];util.StateSet=StateSet;})(util=android.util||(android.util={}));})(android||(android={}));var android;(function(android){var util;(function(util){var Pools=function Pools(){_classCallCheck(this,Pools);};util.Pools=Pools;(function(Pools){var SimplePool=function(){function SimplePool(maxPoolSize){_classCallCheck(this,SimplePool);this.mPoolSize=0;if(maxPoolSize<=0){throw new Error(\"The max pool size must be > 0\");}this.mPool=new Array(maxPoolSize);}_createClass(SimplePool,[{key:'acquire',value:function acquire(){if(this.mPoolSize>0){var lastPooledIndex=this.mPoolSize-1;var instance=this.mPool[lastPooledIndex];this.mPool[lastPooledIndex]=null;this.mPoolSize--;return instance;}return null;}},{key:'release',value:function release(instance){if(this.isInPool(instance)){throw new Error(\"Already in the pool!\");}if(this.mPoolSize<this.mPool.length){this.mPool[this.mPoolSize]=instance;this.mPoolSize++;return true;}return false;}},{key:'isInPool',value:function isInPool(instance){for(var i=0;i<this.mPoolSize;i++){if(this.mPool[i]==instance){return true;}}return false;}}]);return SimplePool;}();Pools.SimplePool=SimplePool;var SynchronizedPool=function(_SimplePool){_inherits(SynchronizedPool,_SimplePool);function SynchronizedPool(){_classCallCheck(this,SynchronizedPool);return _possibleConstructorReturn(this,(SynchronizedPool.__proto__||Object.getPrototypeOf(SynchronizedPool)).apply(this,arguments));}return SynchronizedPool;}(SimplePool);Pools.SynchronizedPool=SynchronizedPool;})(Pools=util.Pools||(util.Pools={}));})(util=android.util||(android.util={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var Color=function(){function Color(){_classCallCheck(this,Color);}_createClass(Color,null,[{key:'alpha',value:function alpha(color){return color>>>24;}},{key:'red',value:function red(color){return color>>16&0xFF;}},{key:'green',value:function green(color){return color>>8&0xFF;}},{key:'blue',value:function blue(color){return color&0xFF;}},{key:'rgb',value:function rgb(red,green,blue){return 0xFF<<24|red<<16|green<<8|blue;}},{key:'argb',value:function argb(alpha,red,green,blue){return alpha<<24|red<<16|green<<8|blue;}},{key:'rgba',value:function rgba(red,green,blue,alpha){return alpha<<24|red<<16|green<<8|blue;}},{key:'parseColor',value:function parseColor(colorString,defaultColor){if(colorString.charAt(0)=='#'){if(colorString.length===4){colorString='#'+colorString[1]+colorString[1]+colorString[2]+colorString[2]+colorString[3]+colorString[3];}var color=parseInt(colorString.substring(1),16);if(colorString.length==7){color|=0x00000000ff000000;}else if(colorString.length!=9){if(defaultColor!=null)return defaultColor;throw new Error(\"Unknown color : \"+colorString);}return color;}else if(colorString.startsWith('rgb(')){colorString=colorString.substring(colorString.indexOf('(')+1,colorString.lastIndexOf(')'));var parts=colorString.split(',');return Color.rgb(Number.parseInt(parts[0]),Number.parseInt(parts[1]),Number.parseInt(parts[2]));}else if(colorString.startsWith('rgba(')){colorString=colorString.substring(colorString.indexOf('(')+1,colorString.lastIndexOf(')'));var _parts=colorString.split(',');return Color.rgba(Number.parseInt(_parts[0]),Number.parseInt(_parts[1]),Number.parseInt(_parts[2]),Number.parseFloat(_parts[3])*255);}else{var _color=Color.sColorNameMap.get(colorString.toLowerCase());if(_color!=null){return _color;}}if(defaultColor!=null)return defaultColor;throw new Error(\"Unknown color : \"+colorString);}},{key:'toARGBHex',value:function toARGBHex(color){var r=Color.red(color);var g=Color.green(color);var b=Color.blue(color);var a=Color.alpha(color);var hR=r<16?'0'+r.toString(16):r.toString(16);var hG=g<16?'0'+g.toString(16):g.toString(16);var hB=b<16?'0'+b.toString(16):b.toString(16);var hA=a<16?'0'+a.toString(16):a.toString(16);return\"#\"+hA+hR+hG+hB;}},{key:'toRGBAFunc',value:function toRGBAFunc(color){var r=Color.red(color);var g=Color.green(color);var b=Color.blue(color);var a=Color.alpha(color);return'rgba('+r+','+g+','+b+','+a/255+')';}},{key:'getHtmlColor',value:function getHtmlColor(color){var i=Color.sColorNameMap.get(color.toLowerCase());return i;}}]);return Color;}();Color.BLACK=0xFF000000;Color.DKGRAY=0xFF444444;Color.GRAY=0xFF888888;Color.LTGRAY=0xFFCCCCCC;Color.WHITE=0xFFFFFFFF;Color.RED=0xFFFF0000;Color.GREEN=0xFF00FF00;Color.BLUE=0xFF0000FF;Color.YELLOW=0xFFFFFF00;Color.CYAN=0xFF00FFFF;Color.MAGENTA=0xFFFF00FF;Color.TRANSPARENT=0;Color.sColorNameMap=new Map();graphics.Color=Color;Color.sColorNameMap=new Map();Color.sColorNameMap.set(\"black\",Color.BLACK);Color.sColorNameMap.set(\"darkgray\",Color.DKGRAY);Color.sColorNameMap.set(\"gray\",Color.GRAY);Color.sColorNameMap.set(\"lightgray\",Color.LTGRAY);Color.sColorNameMap.set(\"white\",Color.WHITE);Color.sColorNameMap.set(\"red\",Color.RED);Color.sColorNameMap.set(\"green\",Color.GREEN);Color.sColorNameMap.set(\"blue\",Color.BLUE);Color.sColorNameMap.set(\"yellow\",Color.YELLOW);Color.sColorNameMap.set(\"cyan\",Color.CYAN);Color.sColorNameMap.set(\"magenta\",Color.MAGENTA);Color.sColorNameMap.set(\"aqua\",0xFF00FFFF);Color.sColorNameMap.set(\"fuchsia\",0xFFFF00FF);Color.sColorNameMap.set(\"darkgrey\",Color.DKGRAY);Color.sColorNameMap.set(\"grey\",Color.GRAY);Color.sColorNameMap.set(\"lightgrey\",Color.LTGRAY);Color.sColorNameMap.set(\"lime\",0xFF00FF00);Color.sColorNameMap.set(\"maroon\",0xFF800000);Color.sColorNameMap.set(\"navy\",0xFF000080);Color.sColorNameMap.set(\"olive\",0xFF808000);Color.sColorNameMap.set(\"purple\",0xFF800080);Color.sColorNameMap.set(\"silver\",0xFFC0C0C0);Color.sColorNameMap.set(\"teal\",0xFF008080);Color.sColorNameMap.set(\"transparent\",Color.TRANSPARENT);})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var Paint=function(){function Paint(){var flag=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;_classCallCheck(this,Paint);this.mTextStyle=Paint.Style.FILL;this.textScaleX=1;this.mFlag=0;this.shadowDx=0;this.shadowDy=0;this.shadowRadius=0;this.shadowColor=0;this.mFlag=flag;}_createClass(Paint,[{key:'set',value:function set(src){if(this!=src){this.setClassVariablesFrom(src);}}},{key:'setClassVariablesFrom',value:function setClassVariablesFrom(paint){this.mTextStyle=paint.mTextStyle;this.mColor=paint.mColor;this.mStrokeWidth=paint.mStrokeWidth;this.align=paint.align;this.mStrokeCap=paint.mStrokeCap;this.mStrokeJoin=paint.mStrokeJoin;this.textSize=paint.textSize;this.textScaleX=paint.textScaleX;this.mFlag=paint.mFlag;this.hasShadow=paint.hasShadow;this.shadowDx=paint.shadowDx;this.shadowDy=paint.shadowDy;this.shadowRadius=paint.shadowRadius;this.shadowColor=paint.shadowColor;this.drawableState=paint.drawableState;}},{key:'getStyle',value:function getStyle(){return this.mTextStyle;}},{key:'setStyle',value:function setStyle(style){this.mTextStyle=style;}},{key:'getFlags',value:function getFlags(){return this.mFlag;}},{key:'setFlags',value:function setFlags(flags){this.mFlag=flags;}},{key:'getTextScaleX',value:function getTextScaleX(){return this.textScaleX;}},{key:'setTextScaleX',value:function setTextScaleX(scaleX){this.textScaleX=scaleX;}},{key:'getColor',value:function getColor(){return this.mColor;}},{key:'setColor',value:function setColor(color){this.mColor=color;}},{key:'setARGB',value:function setARGB(a,r,g,b){this.setColor(a<<24|r<<16|g<<8|b);}},{key:'getAlpha',value:function getAlpha(){return graphics.Color.alpha(this.mColor);}},{key:'setAlpha',value:function setAlpha(alpha){this.setColor(graphics.Color.argb(alpha,graphics.Color.red(this.mColor),graphics.Color.green(this.mColor),graphics.Color.blue(this.mColor)));}},{key:'getStrokeWidth',value:function getStrokeWidth(){return this.mStrokeWidth;}},{key:'setStrokeWidth',value:function setStrokeWidth(width){this.mStrokeWidth=width;}},{key:'getStrokeCap',value:function getStrokeCap(){return this.mStrokeCap;}},{key:'setStrokeCap',value:function setStrokeCap(cap){this.mStrokeCap=cap;}},{key:'getStrokeJoin',value:function getStrokeJoin(){return this.mStrokeJoin;}},{key:'setStrokeJoin',value:function setStrokeJoin(join){this.mStrokeJoin=join;}},{key:'setAntiAlias',value:function setAntiAlias(enable){}},{key:'isAntiAlias',value:function isAntiAlias(){return true;}},{key:'setShadowLayer',value:function setShadowLayer(radius,dx,dy,color){this.hasShadow=radius>0.0;this.shadowRadius=radius;this.shadowDx=dx;this.shadowDy=dy;this.shadowColor=color;}},{key:'clearShadowLayer',value:function clearShadowLayer(){this.hasShadow=false;}},{key:'getTextAlign',value:function getTextAlign(){return this.align;}},{key:'setTextAlign',value:function setTextAlign(align){this.align=align;}},{key:'getTextSize',value:function getTextSize(){return this.textSize;}},{key:'setTextSize',value:function setTextSize(textSize){this.textSize=textSize;}},{key:'ascent',value:function ascent(){return this.textSize*Paint.FontMetrics_Size_Ascent;}},{key:'descent',value:function descent(){return this.textSize*Paint.FontMetrics_Size_Descent;}},{key:'getFontMetricsInt',value:function getFontMetricsInt(fmi){if(this.textSize==null){console.warn('call Paint.getFontMetricsInt but textSize not init');return 0;}if(fmi==null){return Math.floor((Paint.FontMetrics_Size_Descent-Paint.FontMetrics_Size_Ascent)*this.textSize);}fmi.ascent=Math.floor(Paint.FontMetrics_Size_Ascent*this.textSize);fmi.bottom=Math.floor(Paint.FontMetrics_Size_Bottom*this.textSize);fmi.descent=Math.floor(Paint.FontMetrics_Size_Descent*this.textSize);fmi.leading=Math.floor(Paint.FontMetrics_Size_Leading*this.textSize);fmi.top=Math.floor(Paint.FontMetrics_Size_Top*this.textSize);return fmi.descent-fmi.ascent;}},{key:'getFontMetrics',value:function getFontMetrics(metrics){if(this.textSize==null){console.warn('call Paint.getFontMetrics but textSize not init');return 0;}if(metrics==null){return(Paint.FontMetrics_Size_Descent-Paint.FontMetrics_Size_Ascent)*this.textSize;}metrics.ascent=Paint.FontMetrics_Size_Ascent*this.textSize;metrics.bottom=Paint.FontMetrics_Size_Bottom*this.textSize;metrics.descent=Paint.FontMetrics_Size_Descent*this.textSize;metrics.leading=Paint.FontMetrics_Size_Leading*this.textSize;metrics.top=Paint.FontMetrics_Size_Top*this.textSize;return metrics.descent-metrics.ascent;}},{key:'measureText',value:function measureText(text){var index=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var count=arguments.length>2&&arguments[2]!==undefined?arguments[2]:text.length;return graphics.Canvas.measureText(text.substr(index,count),this.textSize)*this.textScaleX;}},{key:'getTextWidths_count',value:function getTextWidths_count(text,index,count,widths){return this.getTextWidths_end(text,index,index+count,widths);}},{key:'getTextWidths_end',value:function getTextWidths_end(text,start,end,widths){if(text==null){throw Error('new IllegalArgumentException(\"text cannot be null\")');}if((start|end|end-start|text.length-end)<0){throw Error('new IndexOutOfBoundsException()');}if(end-start>widths.length){throw Error('new ArrayIndexOutOfBoundsException()');}if(text.length==0||start==end){return 0;}for(var i=start;i<end;i++){widths[i-start]=this.measureText(text[i]);}return end-start;}},{key:'getTextWidths_2',value:function getTextWidths_2(text,widths){return this.getTextWidths_end(text,0,text.length,widths);}},{key:'getTextRunAdvances_count',value:function getTextRunAdvances_count(chars,index,count,contextIndex,contextCount,flags,advances,advancesIndex){return this.getTextRunAdvances_end(chars,index,index+count,contextIndex,contextCount,flags,advances,advancesIndex);}},{key:'getTextRunAdvances_end',value:function getTextRunAdvances_end(text,start,end,contextStart,contextEnd,flags,advances,advancesIndex){if(text==null){throw Error('new IllegalArgumentException(\"text cannot be null\")');}if(flags!=Paint.DIRECTION_LTR&&flags!=Paint.DIRECTION_RTL){throw Error('new IllegalArgumentException(\"unknown flags value: \" + flags)');}if((start|end|contextStart|contextEnd|advancesIndex|end-start|start-contextStart|contextEnd-end|text.length-contextEnd|(advances==null?0:advances.length-advancesIndex-(end-start)))<0){throw Error('new IndexOutOfBoundsException()');}if(text.length==0||start==end){return 0;}var totalAdvance=0;for(var i=start;i<end;i++){var width=this.measureText(text[i]);if(advances)advances[i-start+advancesIndex]=width;totalAdvance+=width;}return totalAdvance;}},{key:'getTextRunCursor_len',value:function getTextRunCursor_len(text,contextStart,contextLength,flags,offset,cursorOpt){var contextEnd=contextStart+contextLength;if((contextStart|contextEnd|offset|contextEnd-contextStart|offset-contextStart|contextEnd-offset|text.length-contextEnd|cursorOpt)<0||cursorOpt>Paint.CURSOR_OPT_MAX_VALUE){throw Error('new IndexOutOfBoundsException()');}var scalarArray=androidui.util.ArrayCreator.newNumberArray(contextLength);this.getTextRunAdvances_count(text,contextStart,contextLength,contextStart,contextLength,flags,scalarArray,0);var pos=offset-contextStart;switch(cursorOpt){case Paint.CURSOR_AFTER:if(pos<contextLength){pos+=1;}case Paint.CURSOR_AT_OR_AFTER:while(pos<contextLength&&scalarArray[pos]==0){++pos;}break;case Paint.CURSOR_BEFORE:if(pos>0){--pos;}case Paint.CURSOR_AT_OR_BEFORE:while(pos>0&&scalarArray[pos]==0){--pos;}break;case Paint.CURSOR_AT:default:if(scalarArray[pos]==0){pos=-1;}break;}if(pos!=-1){pos+=contextStart;}return pos;}},{key:'getTextRunCursor_end',value:function getTextRunCursor_end(text,contextStart,contextEnd,flags,offset,cursorOpt){if((contextStart|contextEnd|offset|contextEnd-contextStart|offset-contextStart|contextEnd-offset|text.length-contextEnd|cursorOpt)<0||cursorOpt>Paint.CURSOR_OPT_MAX_VALUE){throw Error('new IndexOutOfBoundsException()');}var contextLen=contextEnd-contextStart;return this.getTextRunCursor_len(text,0,contextLen,flags,offset-contextStart,cursorOpt);}},{key:'isEmpty',value:function isEmpty(){return this.mColor==null&&this.align==null&&this.mStrokeWidth==null&&this.mStrokeCap==null&&this.mStrokeJoin==null&&!this.hasShadow&&this.textSize==null;}},{key:'applyToCanvas',value:function applyToCanvas(canvas){if(this.mColor!=null){canvas.setColor(this.mColor,this.getStyle());}if(this.align!=null){canvas.setTextAlign(Paint.Align[this.align].toLowerCase());}if(this.mStrokeWidth!=null){canvas.setLineWidth(this.mStrokeWidth);}if(this.mStrokeCap!=null){canvas.setLineCap(Paint.Cap[this.mStrokeCap].toLowerCase());}if(this.mStrokeJoin!=null){canvas.setLineJoin(Paint.Join[this.mStrokeJoin].toLowerCase());}if(this.hasShadow){canvas.setShadow(this.shadowRadius,this.shadowDx,this.shadowDy,this.shadowColor);}if(this.textSize!=null){canvas.setFontSize(this.textSize);}if(this.textScaleX!=1){canvas.scale(this.textScaleX,1);}}}]);return Paint;}();Paint.FontMetrics_Size_Ascent=-0.9277344;Paint.FontMetrics_Size_Bottom=0.2709961;Paint.FontMetrics_Size_Descent=0.24414062;Paint.FontMetrics_Size_Leading=0;Paint.FontMetrics_Size_Top=-1.05615234;Paint.DIRECTION_LTR=0;Paint.DIRECTION_RTL=1;Paint.CURSOR_AFTER=0;Paint.CURSOR_AT_OR_AFTER=1;Paint.CURSOR_BEFORE=2;Paint.CURSOR_AT_OR_BEFORE=3;Paint.CURSOR_AT=4;Paint.CURSOR_OPT_MAX_VALUE=Paint.CURSOR_AT;Paint.ANTI_ALIAS_FLAG=0x01;Paint.FILTER_BITMAP_FLAG=0x02;Paint.DITHER_FLAG=0x04;Paint.UNDERLINE_TEXT_FLAG=0x08;Paint.STRIKE_THRU_TEXT_FLAG=0x10;Paint.FAKE_BOLD_TEXT_FLAG=0x20;Paint.LINEAR_TEXT_FLAG=0x40;Paint.SUBPIXEL_TEXT_FLAG=0x80;Paint.DEV_KERN_TEXT_FLAG=0x100;Paint.LCD_RENDER_TEXT_FLAG=0x200;Paint.EMBEDDED_BITMAP_TEXT_FLAG=0x400;Paint.AUTO_HINTING_TEXT_FLAG=0x800;Paint.VERTICAL_TEXT_FLAG=0x1000;Paint.DEFAULT_PAINT_FLAGS=Paint.DEV_KERN_TEXT_FLAG|Paint.EMBEDDED_BITMAP_TEXT_FLAG;graphics.Paint=Paint;(function(Paint){var Align;(function(Align){Align[Align[\"LEFT\"]=0]=\"LEFT\";Align[Align[\"CENTER\"]=1]=\"CENTER\";Align[Align[\"RIGHT\"]=2]=\"RIGHT\";})(Align=Paint.Align||(Paint.Align={}));var FontMetrics=function FontMetrics(){_classCallCheck(this,FontMetrics);this.top=0;this.ascent=0;this.descent=0;this.bottom=0;this.leading=0;};Paint.FontMetrics=FontMetrics;var FontMetricsInt=function(){function FontMetricsInt(){_classCallCheck(this,FontMetricsInt);this.top=0;this.ascent=0;this.descent=0;this.bottom=0;this.leading=0;}_createClass(FontMetricsInt,[{key:'toString',value:function toString(){return\"FontMetricsInt: top=\"+this.top+\" ascent=\"+this.ascent+\" descent=\"+this.descent+\" bottom=\"+this.bottom+\" leading=\"+this.leading;}}]);return FontMetricsInt;}();Paint.FontMetricsInt=FontMetricsInt;var Style;(function(Style){Style[Style[\"FILL\"]=0]=\"FILL\";Style[Style[\"STROKE\"]=1]=\"STROKE\";Style[Style[\"FILL_AND_STROKE\"]=2]=\"FILL_AND_STROKE\";})(Style=Paint.Style||(Paint.Style={}));var Cap;(function(Cap){Cap[Cap[\"BUTT\"]=0]=\"BUTT\";Cap[Cap[\"ROUND\"]=1]=\"ROUND\";Cap[Cap[\"SQUARE\"]=2]=\"SQUARE\";})(Cap=Paint.Cap||(Paint.Cap={}));var Join;(function(Join){Join[Join[\"MITER\"]=0]=\"MITER\";Join[Join[\"ROUND\"]=1]=\"ROUND\";Join[Join[\"BEVEL\"]=2]=\"BEVEL\";})(Join=Paint.Join||(Paint.Join={}));})(Paint=graphics.Paint||(graphics.Paint={}));})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var Path=function(){function Path(){_classCallCheck(this,Path);}_createClass(Path,[{key:'reset',value:function reset(){}}]);return Path;}();graphics.Path=Path;})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var Point=function(){function Point(){_classCallCheck(this,Point);this.x=0;this.y=0;for(var _len7=arguments.length,args=Array(_len7),_key7=0;_key7<_len7;_key7++){args[_key7]=arguments[_key7];}if(args.length===1){var src=args[0];this.x=src.x;this.y=src.y;}else{var _args$23=args[0],x=_args$23===undefined?0:_args$23,_args$24=args[1],y=_args$24===undefined?0:_args$24;this.x=x;this.y=y;}}_createClass(Point,[{key:'set',value:function set(x,y){this.x=x;this.y=y;}},{key:'negate',value:function negate(){this.x=-this.x;this.y=-this.y;}},{key:'offset',value:function offset(dx,dy){this.x+=dx;this.y+=dy;}},{key:'equals',value:function equals(){for(var _len8=arguments.length,args=Array(_len8),_key8=0;_key8<_len8;_key8++){args[_key8]=arguments[_key8];}if(args.length===2){var _args$25=args[0],x=_args$25===undefined?0:_args$25,_args$26=args[1],y=_args$26===undefined?0:_args$26;return this.x==x&&this.y==y;}else{var o=args[0];if(this===o)return true;if(!o||!(o instanceof Point))return false;var point=o;if(this.x!=point.x)return false;if(this.y!=point.y)return false;return true;}}},{key:'toString',value:function toString(){return\"Point(\"+this.x+\", \"+this.y+\")\";}}]);return Point;}();graphics.Point=Point;})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var RectF=function(_graphics$Rect){_inherits(RectF,_graphics$Rect);function RectF(){_classCallCheck(this,RectF);return _possibleConstructorReturn(this,(RectF.__proto__||Object.getPrototypeOf(RectF)).apply(this,arguments));}return RectF;}(graphics.Rect);graphics.RectF=RectF;})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var System=java.lang.System;var StringBuilder=java.lang.StringBuilder;var Matrix=function(){function Matrix(values){_classCallCheck(this,Matrix);this.mValues=androidui.util.ArrayCreator.newNumberArray(Matrix.MATRIX_SIZE);if(values instanceof Matrix)this.set(values);else if(values instanceof Array){System.arraycopy(values,0,this.mValues,0,Matrix.MATRIX_SIZE);}else{Matrix.reset(this.mValues);}}_createClass(Matrix,[{key:'isIdentity',value:function isIdentity(){for(var i=0,k=0;i<3;i++){for(var j=0;j<3;j++,k++){if(this.mValues[k]!=(i==j?1:0)){return false;}}}return true;}},{key:'hasPerspective',value:function hasPerspective(){return this.mValues[6]!=0||this.mValues[7]!=0||this.mValues[8]!=1;}},{key:'rectStaysRect',value:function rectStaysRect(){return(this.computeTypeMask()&Matrix.kRectStaysRect_Mask)!=0;}},{key:'set',value:function set(src){if(src==null){this.reset();}else{System.arraycopy(src.mValues,0,this.mValues,0,Matrix.MATRIX_SIZE);}}},{key:'equals',value:function equals(obj){if(!(obj instanceof Matrix))return false;var another=obj;for(var i=0;i<Matrix.MATRIX_SIZE;i++){if(this.mValues[i]!=another.mValues[i]){return false;}}return true;}},{key:'hashCode',value:function hashCode(){return 44;}},{key:'reset',value:function reset(){Matrix.reset(this.mValues);}},{key:'setTranslate',value:function setTranslate(dx,dy){Matrix.setTranslate(this.mValues,dx,dy);}},{key:'setScale',value:function setScale(sx,sy,px,py){if(px==null||py==null){this.mValues[0]=sx;this.mValues[1]=0;this.mValues[2]=0;this.mValues[3]=0;this.mValues[4]=sy;this.mValues[5]=0;this.mValues[6]=0;this.mValues[7]=0;this.mValues[8]=1;}else{this.mValues=Matrix.getScale(sx,sy,px,py);}}},{key:'setRotate',value:function setRotate(degrees,px,py){if(px==null||py==null){Matrix.setRotate_1(this.mValues,degrees);}else{this.mValues=Matrix.getRotate_3(degrees,px,py);}}},{key:'setSinCos',value:function setSinCos(sinValue,cosValue,px,py){if(px==null||py==null){Matrix.setRotate_2(this.mValues,sinValue,cosValue);}else{Matrix.setTranslate(this.mValues,-px,-py);this.postTransform(Matrix.getRotate_2(sinValue,cosValue));this.postTransform(Matrix.getTranslate(px,py));}}},{key:'setSkew',value:function setSkew(kx,ky,px,py){if(px==null||py==null){this.mValues[0]=1;this.mValues[1]=kx;this.mValues[2]=-0;this.mValues[3]=ky;this.mValues[4]=1;this.mValues[5]=0;this.mValues[6]=0;this.mValues[7]=0;this.mValues[8]=1;}else{this.mValues=Matrix.getSkew(kx,ky,px,py);}}},{key:'setConcat',value:function setConcat(a,b){Matrix.multiply(this.mValues,a.mValues,b.mValues);return true;}},{key:'preTranslate',value:function preTranslate(dx,dy){this.preTransform(Matrix.getTranslate(dx,dy));return true;}},{key:'preScale',value:function preScale(sx,sy,px,py){this.preTransform(Matrix.getScale(sx,sy,px,py));return true;}},{key:'preRotate',value:function preRotate(degrees,px,py){if(px==null||py==null){var rad=Math_toRadians(degrees);var sin=Math.sin(rad);var cos=Math.cos(rad);this.preTransform(Matrix.getRotate_2(sin,cos));return true;}this.preTransform(Matrix.getRotate_3(degrees,px,py));return true;}},{key:'preSkew',value:function preSkew(kx,ky,px,py){this.preTransform(Matrix.getSkew(kx,ky,px,py));return true;}},{key:'preConcat',value:function preConcat(other){this.preTransform(other.mValues);return true;}},{key:'postTranslate',value:function postTranslate(dx,dy){this.postTransform(Matrix.getTranslate(dx,dy));return true;}},{key:'postScale',value:function postScale(sx,sy,px,py){this.postTransform(Matrix.getScale(sx,sy,px,py));return true;}},{key:'postRotate',value:function postRotate(degrees,px,py){this.postTransform(Matrix.getRotate_3(degrees,px,py));return true;}},{key:'postSkew',value:function postSkew(kx,ky,px,py){this.postTransform(Matrix.getSkew(kx,ky,px,py));return true;}},{key:'postConcat',value:function postConcat(other){this.postTransform(other.mValues);return true;}},{key:'setRectToRect',value:function setRectToRect(src,dst,stf){if(dst==null||src==null){throw Error('new NullPointerException()');}var d=this;if(src.isEmpty()){Matrix.reset(d.mValues);return false;}if(dst.isEmpty()){d.mValues[0]=d.mValues[1]=d.mValues[2]=d.mValues[3]=d.mValues[4]=d.mValues[5]=d.mValues[6]=d.mValues[7]=0;d.mValues[8]=1;}else{var tx=void 0,sx=dst.width()/src.width();var ty=void 0,sy=dst.height()/src.height();var xLarger=false;if(stf!=Matrix.ScaleToFit.FILL){if(sx>sy){xLarger=true;sx=sy;}else{sy=sx;}}tx=dst.left-src.left*sx;ty=dst.top-src.top*sy;if(stf==Matrix.ScaleToFit.CENTER||stf==Matrix.ScaleToFit.END){var diff=void 0;if(xLarger){diff=dst.width()-src.width()*sy;}else{diff=dst.height()-src.height()*sy;}if(stf==Matrix.ScaleToFit.CENTER){diff=diff/2;}if(xLarger){tx+=diff;}else{ty+=diff;}}d.mValues[0]=sx;d.mValues[4]=sy;d.mValues[2]=tx;d.mValues[5]=ty;d.mValues[1]=d.mValues[3]=d.mValues[6]=d.mValues[7]=0;}d.mValues[8]=1;return true;}},{key:'mapPoints',value:function mapPoints(dst){var dstIndex=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var src=arguments.length>2&&arguments[2]!==undefined?arguments[2]:dst;var srcIndex=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var pointCount=arguments.length>4&&arguments[4]!==undefined?arguments[4]:dst.length>>1;Matrix.checkPointArrays(src,srcIndex,dst,dstIndex,pointCount);var count=pointCount*2;var tmpDest=dst;var inPlace=dst==src;if(inPlace){tmpDest=androidui.util.ArrayCreator.newNumberArray(dstIndex+count);}for(var i=0;i<count;i+=2){var x=this.mValues[0]*src[i+srcIndex]+this.mValues[1]*src[i+srcIndex+1]+this.mValues[2];var y=this.mValues[3]*src[i+srcIndex]+this.mValues[4]*src[i+srcIndex+1]+this.mValues[5];tmpDest[i+dstIndex]=x;tmpDest[i+dstIndex+1]=y;}if(inPlace){System.arraycopy(tmpDest,dstIndex,dst,dstIndex,count);}}},{key:'mapVectors',value:function mapVectors(dst){var dstIndex=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var src=arguments.length>2&&arguments[2]!==undefined?arguments[2]:dst;var srcIndex=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var ptCount=arguments.length>4&&arguments[4]!==undefined?arguments[4]:dst.length>>1;Matrix.checkPointArrays(src,srcIndex,dst,dstIndex,ptCount);if(this.hasPerspective()){var origin=[0.,0.];this.mapPoints(origin);this.mapPoints(dst,dstIndex,src,srcIndex,ptCount);var count=ptCount*2;for(var i=0;i<count;i+=2){dst[dstIndex+i]=dst[dstIndex+i]-origin[0];dst[dstIndex+i+1]=dst[dstIndex+i+1]-origin[1];}}else{var copy=new Matrix(this.mValues);Matrix.setTranslate(copy.mValues,0,0);copy.mapPoints(dst,dstIndex,src,srcIndex,ptCount);}}},{key:'mapRect',value:function mapRect(dst){var src=arguments.length>1&&arguments[1]!==undefined?arguments[1]:dst;if(dst==null||src==null){throw Error('new NullPointerException()');}var corners=[src.left,src.top,src.right,src.top,src.right,src.bottom,src.left,src.bottom];this.mapPoints(corners);dst.left=Math.min(Math.min(corners[0],corners[2]),Math.min(corners[4],corners[6]));dst.right=Math.max(Math.max(corners[0],corners[2]),Math.max(corners[4],corners[6]));dst.top=Math.min(Math.min(corners[1],corners[3]),Math.min(corners[5],corners[7]));dst.bottom=Math.max(Math.max(corners[1],corners[3]),Math.max(corners[5],corners[7]));return(this.computeTypeMask()&Matrix.kRectStaysRect_Mask)!=0;}},{key:'mapRadius',value:function mapRadius(radius){var src=[radius,0.,0.,radius];this.mapVectors(src,0,src,0,2);var l1=Matrix.getPointLength(src,0);var l2=Matrix.getPointLength(src,2);return Math.sqrt(l1*l2);}},{key:'getValues',value:function getValues(values){if(values.length<9){throw Error('new ArrayIndexOutOfBoundsException()');}System.arraycopy(this.mValues,0,values,0,Matrix.MATRIX_SIZE);}},{key:'setValues',value:function setValues(values){if(values.length<9){throw Error('new ArrayIndexOutOfBoundsException()');}System.arraycopy(values,0,this.mValues,0,Matrix.MATRIX_SIZE);}},{key:'toString',value:function toString(){var sb=new StringBuilder(64);sb.append(\"Matrix{\");this.toShortString(sb);sb.append('}');return sb.toString();}},{key:'toShortString',value:function toShortString(sb){var values=androidui.util.ArrayCreator.newNumberArray(9);this.getValues(values);sb.append('[');sb.append(values[0]);sb.append(\", \");sb.append(values[1]);sb.append(\", \");sb.append(values[2]);sb.append(\"][\");sb.append(values[3]);sb.append(\", \");sb.append(values[4]);sb.append(\", \");sb.append(values[5]);sb.append(\"][\");sb.append(values[6]);sb.append(\", \");sb.append(values[7]);sb.append(\", \");sb.append(values[8]);sb.append(']');}},{key:'postTransform',value:function postTransform(matrix){var tmp=androidui.util.ArrayCreator.newNumberArray(9);Matrix.multiply(tmp,this.mValues,matrix);this.mValues=tmp;}},{key:'preTransform',value:function preTransform(matrix){var tmp=androidui.util.ArrayCreator.newNumberArray(9);Matrix.multiply(tmp,matrix,this.mValues);this.mValues=tmp;}},{key:'computeTypeMask',value:function computeTypeMask(){var mask=0;if(this.mValues[6]!=0.||this.mValues[7]!=0.||this.mValues[8]!=1.){mask|=Matrix.kPerspective_Mask;}if(this.mValues[2]!=0.||this.mValues[5]!=0.){mask|=Matrix.kTranslate_Mask;}var m00=this.mValues[0];var m01=this.mValues[1];var m10=this.mValues[3];var m11=this.mValues[4];if(m01!=0.||m10!=0.){mask|=Matrix.kAffine_Mask;}if(m00!=1.||m11!=1.){mask|=Matrix.kScale_Mask;}if((mask&Matrix.kPerspective_Mask)==0){var im00=m00!=0?1:0;var im01=m01!=0?1:0;var im10=m10!=0?1:0;var im11=m11!=0?1:0;var dp0=(im00|im11)^1;var dp1=im00&im11;var ds0=(im01|im10)^1;var ds1=im01&im10;mask|=(dp0&ds1|dp1&ds0)<<Matrix.kRectStaysRect_Shift;}return mask;}}],[{key:'checkPointArrays',value:function checkPointArrays(src,srcIndex,dst,dstIndex,pointCount){var srcStop=srcIndex+(pointCount<<1);var dstStop=dstIndex+(pointCount<<1);if((pointCount|srcIndex|dstIndex|srcStop|dstStop)<0||srcStop>src.length||dstStop>dst.length){throw Error('new ArrayIndexOutOfBoundsException()');}}},{key:'getPointLength',value:function getPointLength(src,index){return Math.sqrt(src[index]*src[index]+src[index+1]*src[index+1]);}},{key:'multiply',value:function multiply(dest,a,b){dest[0]=b[0]*a[0]+b[1]*a[3]+b[2]*a[6];dest[1]=b[0]*a[1]+b[1]*a[4]+b[2]*a[7];dest[2]=b[0]*a[2]+b[1]*a[5]+b[2]*a[8];dest[3]=b[3]*a[0]+b[4]*a[3]+b[5]*a[6];dest[4]=b[3]*a[1]+b[4]*a[4]+b[5]*a[7];dest[5]=b[3]*a[2]+b[4]*a[5]+b[5]*a[8];dest[6]=b[6]*a[0]+b[7]*a[3]+b[8]*a[6];dest[7]=b[6]*a[1]+b[7]*a[4]+b[8]*a[7];dest[8]=b[6]*a[2]+b[7]*a[5]+b[8]*a[8];}},{key:'getTranslate',value:function getTranslate(dx,dy){return this.setTranslate(androidui.util.ArrayCreator.newNumberArray(9),dx,dy);}},{key:'setTranslate',value:function setTranslate(dest,dx,dy){dest[0]=1;dest[1]=0;dest[2]=dx;dest[3]=0;dest[4]=1;dest[5]=dy;dest[6]=0;dest[7]=0;dest[8]=1;return dest;}},{key:'getScale',value:function getScale(sx,sy,px,py){if(px==null||py==null){return[sx,0,0,0,sy,0,0,0,1];}var tmp=androidui.util.ArrayCreator.newNumberArray(9);var tmp2=androidui.util.ArrayCreator.newNumberArray(9);this.setTranslate(tmp,-px,-py);Matrix.multiply(tmp2,tmp,Matrix.getScale(sx,sy));Matrix.multiply(tmp,tmp2,Matrix.getTranslate(px,py));return tmp;}},{key:'getRotate_1',value:function getRotate_1(degrees){var rad=Math_toRadians(degrees);var sin=Math.sin(rad);var cos=Math.cos(rad);return Matrix.getRotate_2(sin,cos);}},{key:'getRotate_2',value:function getRotate_2(sin,cos){return this.setRotate_2(androidui.util.ArrayCreator.newNumberArray(9),sin,cos);}},{key:'setRotate_1',value:function setRotate_1(dest,degrees){var rad=Math_toRadians(degrees);var sin=Math.sin(rad);var cos=Math.cos(rad);return Matrix.setRotate_2(dest,sin,cos);}},{key:'setRotate_2',value:function setRotate_2(dest,sin,cos){dest[0]=cos;dest[1]=-sin;dest[2]=0;dest[3]=sin;dest[4]=cos;dest[5]=0;dest[6]=0;dest[7]=0;dest[8]=1;return dest;}},{key:'getRotate_3',value:function getRotate_3(degrees,px,py){var tmp=androidui.util.ArrayCreator.newNumberArray(9);var tmp2=androidui.util.ArrayCreator.newNumberArray(9);this.setTranslate(tmp,-px,-py);var rad=Math_toRadians(degrees);var cos=Math.cos(rad);var sin=Math.sin(rad);Matrix.multiply(tmp2,tmp,Matrix.getRotate_2(sin,cos));Matrix.multiply(tmp,tmp2,Matrix.getTranslate(px,py));return tmp;}},{key:'getSkew',value:function getSkew(kx,ky,px,py){if(px==null||py==null){return[1,kx,0,ky,1,0,0,0,1];}var tmp=androidui.util.ArrayCreator.newNumberArray(9);var tmp2=androidui.util.ArrayCreator.newNumberArray(9);this.setTranslate(tmp,-px,-py);Matrix.multiply(tmp2,tmp,[1,kx,0,ky,1,0,0,0,1]);Matrix.multiply(tmp,tmp2,Matrix.getTranslate(px,py));return tmp;}},{key:'reset',value:function reset(mtx){mtx[0]=1;mtx[1]=0;mtx[2]=0;mtx[3]=0;mtx[4]=1;mtx[5]=0;mtx[6]=0;mtx[7]=0;mtx[8]=1;}}]);return Matrix;}();Matrix.MSCALE_X=0;Matrix.MSKEW_X=1;Matrix.MTRANS_X=2;Matrix.MSKEW_Y=3;Matrix.MSCALE_Y=4;Matrix.MTRANS_Y=5;Matrix.MPERSP_0=6;Matrix.MPERSP_1=7;Matrix.MPERSP_2=8;Matrix.MATRIX_SIZE=9;Matrix.IDENTITY_MATRIX=function(){var _Inner=function(_Matrix){_inherits(_Inner,_Matrix);function _Inner(){_classCallCheck(this,_Inner);return _possibleConstructorReturn(this,(_Inner.__proto__||Object.getPrototypeOf(_Inner)).apply(this,arguments));}_createClass(_Inner,[{key:'oops',value:function oops(){throw Error('new IllegalStateException(\"Matrix can not be modified\")');}},{key:'set',value:function set(src){this.oops();}},{key:'reset',value:function reset(){this.oops();}},{key:'setTranslate',value:function setTranslate(dx,dy){this.oops();}},{key:'setScale',value:function setScale(sx,sy,px,py){this.oops();}},{key:'setRotate',value:function setRotate(degrees,px,py){this.oops();}},{key:'setSinCos',value:function setSinCos(sinValue,cosValue,px,py){this.oops();}},{key:'setSkew',value:function setSkew(kx,ky,px,py){this.oops();}},{key:'setConcat',value:function setConcat(a,b){this.oops();return false;}},{key:'preTranslate',value:function preTranslate(dx,dy){this.oops();return false;}},{key:'preScale',value:function preScale(sx,sy,px,py){this.oops();return false;}},{key:'preRotate',value:function preRotate(degrees,px,py){this.oops();return false;}},{key:'preSkew',value:function preSkew(kx,ky,px,py){this.oops();return false;}},{key:'preConcat',value:function preConcat(other){this.oops();return false;}},{key:'postTranslate',value:function postTranslate(dx,dy){this.oops();return false;}},{key:'postScale',value:function postScale(sx,sy,px,py){this.oops();return false;}},{key:'postRotate',value:function postRotate(degrees,px,py){this.oops();return false;}},{key:'postSkew',value:function postSkew(kx,ky,px,py){this.oops();return false;}},{key:'postConcat',value:function postConcat(other){this.oops();return false;}},{key:'setRectToRect',value:function setRectToRect(src,dst,stf){this.oops();return false;}},{key:'setPolyToPoly',value:function setPolyToPoly(src,srcIndex,dst,dstIndex,pointCount){this.oops();return false;}},{key:'setValues',value:function setValues(values){this.oops();}}]);return _Inner;}(Matrix);return new _Inner();}();Matrix.kIdentity_Mask=0;Matrix.kTranslate_Mask=0x01;Matrix.kScale_Mask=0x02;Matrix.kAffine_Mask=0x04;Matrix.kPerspective_Mask=0x08;Matrix.kRectStaysRect_Mask=0x10;Matrix.kUnknown_Mask=0x80;Matrix.kAllMasks=Matrix.kTranslate_Mask|Matrix.kScale_Mask|Matrix.kAffine_Mask|Matrix.kPerspective_Mask|Matrix.kRectStaysRect_Mask;Matrix.kTranslate_Shift=0;Matrix.kScale_Shift=1;Matrix.kAffine_Shift=2;Matrix.kPerspective_Shift=3;Matrix.kRectStaysRect_Shift=4;graphics.Matrix=Matrix;(function(Matrix){var ScaleToFit;(function(ScaleToFit){ScaleToFit[ScaleToFit[\"FILL\"]=0]=\"FILL\";ScaleToFit[ScaleToFit[\"START\"]=1]=\"START\";ScaleToFit[ScaleToFit[\"CENTER\"]=2]=\"CENTER\";ScaleToFit[ScaleToFit[\"END\"]=3]=\"END\";})(ScaleToFit=Matrix.ScaleToFit||(Matrix.ScaleToFit={}));})(Matrix=graphics.Matrix||(graphics.Matrix={}));function Math_toRadians(angdeg){return angdeg/180.0*Math.PI;}})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var androidui;(function(androidui){var image;(function(image){var Rect=android.graphics.Rect;var Color=android.graphics.Color;var NetImage=function(){function NetImage(src,overrideImageRatio){_classCallCheck(this,NetImage);this.mImageWidth=0;this.mImageHeight=0;this.mOnLoads=new Set();this.mOnErrors=new Set();this.mImageLoaded=false;this.init(src);this.mOverrideImageRatio=overrideImageRatio;}_createClass(NetImage,[{key:'init',value:function init(src){this.createImage();this.src=src;}},{key:'createImage',value:function createImage(){this.browserImage=new Image();}},{key:'loadImage',value:function loadImage(){var _this6=this;this.browserImage.src=this.mSrc;this.browserImage.onload=function(){_this6.mImageWidth=_this6.browserImage.width;_this6.mImageHeight=_this6.browserImage.height;_this6.fireOnLoad();};this.browserImage.onerror=function(){_this6.mImageWidth=_this6.mImageHeight=0;_this6.fireOnError();};}},{key:'getImageRatio',value:function getImageRatio(){if(this.mOverrideImageRatio)return this.mOverrideImageRatio;var url=this.src;if(!url)return 1;if(url.startsWith('data:'))return 1;var match=url.match(/@(\\d)x(\\.9)?\\.\\w*$/);if(match){return parseInt(match[1]);}return 1;}},{key:'isImageLoaded',value:function isImageLoaded(){return this.mImageLoaded;}},{key:'fireOnLoad',value:function fireOnLoad(){this.mImageLoaded=true;var _arr=[].concat(_toConsumableArray(this.mOnLoads));for(var _i=0;_i<_arr.length;_i++){var load=_arr[_i];load();}}},{key:'fireOnError',value:function fireOnError(){this.mImageLoaded=false;var _arr2=[].concat(_toConsumableArray(this.mOnErrors));for(var _i2=0;_i2<_arr2.length;_i2++){var error=_arr2[_i2];error();}}},{key:'addLoadListener',value:function addLoadListener(onload,onerror){if(onload){this.mOnLoads.add(onload);}if(onerror){this.mOnErrors.add(onerror);}}},{key:'removeLoadListener',value:function removeLoadListener(onload,onerror){if(onload){this.mOnLoads.delete(onload);}if(onerror){this.mOnErrors.delete(onerror);}}},{key:'recycle',value:function recycle(){}},{key:'getBorderPixels',value:function getBorderPixels(callBack){var _this7=this;if(!callBack)return;var mTmpRect=new Rect();mTmpRect.set(0,1,1,this.height-1);this.getPixels(mTmpRect,function(leftBorder){mTmpRect.set(1,0,_this7.width-1,1);_this7.getPixels(mTmpRect,function(topBorder){mTmpRect.set(_this7.width-1,1,_this7.width,_this7.height-1);_this7.getPixels(mTmpRect,function(rightBorder){mTmpRect.set(1,_this7.height-1,_this7.width-1,_this7.height);_this7.getPixels(mTmpRect,function(bottomBorder){callBack(leftBorder,topBorder,rightBorder,bottomBorder);});});});});}},{key:'getPixels',value:function getPixels(bound,callBack){if(!callBack)return;var canvasEle=document.createElement('canvas');if(!bound)bound=new Rect(0,0,this.width,this.height);if(bound.isEmpty()){callBack([]);return;}var w=bound.width();var h=bound.height();canvasEle.width=w;canvasEle.height=h;var canvas=canvasEle.getContext('2d');canvas.drawImage(this.browserImage,bound.left,bound.top,w,h,0,0,w,h);var data=canvas.getImageData(0,0,w,h).data;var colorData=[];for(var i=0;i<data.length;i+=4){colorData.push(Color.rgba(data[i],data[i+1],data[i+2],data[i+3]));}callBack(colorData);canvasEle.width=0;canvasEle.height=0;}},{key:'src',get:function get(){return this.mSrc;},set:function set(value){value=convertToAbsUrl(value);if(value!==this.mSrc){this.mSrc=value;this.loadImage();}}},{key:'width',get:function get(){return this.mImageWidth;}},{key:'height',get:function get(){return this.mImageHeight;}}]);return NetImage;}();image.NetImage=NetImage;var convertA=document.createElement('a');function convertToAbsUrl(url){convertA.href=url;return convertA.href;}})(image=androidui.image||(androidui.image={}));})(androidui||(androidui={}));var android;(function(android){var graphics;(function(graphics){var Pools=android.util.Pools;var Rect=android.graphics.Rect;var Color=android.graphics.Color;var Canvas=function(){function Canvas(width,height){_classCallCheck(this,Canvas);this.mWidth=0;this.mHeight=0;this._saveCount=0;this.mClipStateMap=new Map();this.mWidth=width;this.mHeight=height;this.mCurrentClip=Canvas.obtainRect();this.mCurrentClip.set(0,0,this.mWidth,this.mHeight);this.initCanvasImpl();}_createClass(Canvas,[{key:'initCanvasImpl',value:function initCanvasImpl(){this.mCanvasElement=document.createElement(\"canvas\");this.mCanvasElement.width=this.mWidth;this.mCanvasElement.height=this.mHeight;this._mCanvasContent=this.mCanvasElement.getContext(\"2d\");this.save();}},{key:'recycle',value:function recycle(){Canvas.recycleRect(this.mCurrentClip);var _iteratorNormalCompletion2=true;var _didIteratorError2=false;var _iteratorError2=undefined;try{for(var _iterator2=this.mClipStateMap.values()[Symbol.iterator](),_step2;!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){var rect=_step2.value;Canvas.recycleRect(rect);}}catch(err){_didIteratorError2=true;_iteratorError2=err;}finally{try{if(!_iteratorNormalCompletion2&&_iterator2.return){_iterator2.return();}}finally{if(_didIteratorError2){throw _iteratorError2;}}}this.recycleImpl();}},{key:'recycleImpl',value:function recycleImpl(){if(this.mCanvasElement)this.mCanvasElement.width=this.mCanvasElement.height=0;}},{key:'getHeight',value:function getHeight(){return this.mHeight;}},{key:'getWidth',value:function getWidth(){return this.mWidth;}},{key:'isNativeAccelerated',value:function isNativeAccelerated(){return false;}},{key:'translate',value:function translate(dx,dy){if(dx==0&&dy==0)return;if(this.mCurrentClip)this.mCurrentClip.offset(-dx,-dy);this.translateImpl(dx,dy);}},{key:'translateImpl',value:function translateImpl(dx,dy){this._mCanvasContent.translate(dx,dy);}},{key:'scale',value:function scale(sx,sy,px,py){if(px||py)this.translate(px,py);this.scaleImpl(sx,sy);if(px||py)this.translate(-px,-py);}},{key:'scaleImpl',value:function scaleImpl(sx,sy){this._mCanvasContent.scale(sx,sy);}},{key:'rotate',value:function rotate(degrees,px,py){if(px||py)this.translate(px,py);this.rotateImpl(degrees);if(px||py)this.translate(-px,-py);}},{key:'rotateImpl',value:function rotateImpl(degrees){this._mCanvasContent.rotate(degrees*Math.PI/180);}},{key:'concat',value:function concat(m){var v=Canvas.TempMatrixValue;m.getValues(v);this.concatImpl(v[graphics.Matrix.MSCALE_X],v[graphics.Matrix.MSKEW_X],v[graphics.Matrix.MTRANS_X],v[graphics.Matrix.MSKEW_Y],v[graphics.Matrix.MSCALE_Y],v[graphics.Matrix.MTRANS_Y],v[graphics.Matrix.MPERSP_0],v[graphics.Matrix.MPERSP_1],v[graphics.Matrix.MPERSP_2]);}},{key:'concatImpl',value:function concatImpl(MSCALE_X,MSKEW_X,MTRANS_X,MSKEW_Y,MSCALE_Y,MTRANS_Y,MPERSP_0,MPERSP_1,MPERSP_2){this._mCanvasContent.transform(MSCALE_X,-MSKEW_X,-MSKEW_Y,MSCALE_Y,MTRANS_X,MTRANS_Y);}},{key:'drawRGB',value:function drawRGB(r,g,b){this.drawARGB(255,r,g,b);}},{key:'drawARGB',value:function drawARGB(a,r,g,b){this.drawARGBImpl(a,r,g,b);}},{key:'drawColor',value:function drawColor(color){this.drawARGB(Color.alpha(color),Color.red(color),Color.green(color),Color.blue(color));}},{key:'drawARGBImpl',value:function drawARGBImpl(a,r,g,b){var preStyle=this._mCanvasContent.fillStyle;this._mCanvasContent.fillStyle='rgba('+r+','+g+','+b+','+a/255+')';this._mCanvasContent.fillRect(this.mCurrentClip.left,this.mCurrentClip.top,this.mCurrentClip.width(),this.mCurrentClip.height());this._mCanvasContent.fillStyle=preStyle;}},{key:'clearColor',value:function clearColor(){this.clearColorImpl();}},{key:'clearColorImpl',value:function clearColorImpl(){this._mCanvasContent.clearRect(this.mCurrentClip.left,this.mCurrentClip.top,this.mCurrentClip.width(),this.mCurrentClip.height());}},{key:'save',value:function save(){this.saveImpl();if(this.mCurrentClip)this.mClipStateMap.set(this._saveCount,Canvas.obtainRect(this.mCurrentClip));this._saveCount++;return this._saveCount;}},{key:'saveImpl',value:function saveImpl(){this._mCanvasContent.save();}},{key:'restore',value:function restore(){this._saveCount--;this.restoreImpl();var savedClip=this.mClipStateMap.get(this._saveCount);if(savedClip){this.mClipStateMap.delete(this._saveCount);this.mCurrentClip.set(savedClip);Canvas.recycleRect(savedClip);}}},{key:'restoreImpl',value:function restoreImpl(){this._mCanvasContent.restore();}},{key:'restoreToCount',value:function restoreToCount(saveCount){if(saveCount<=0)throw Error('saveCount can\\'t <= 0');while(saveCount<=this._saveCount){this.restore();}}},{key:'getSaveCount',value:function getSaveCount(){return this._saveCount;}},{key:'clipRect',value:function clipRect(){var rect=Canvas.obtainRect();for(var _len9=arguments.length,args=Array(_len9),_key9=0;_key9<_len9;_key9++){args[_key9]=arguments[_key9];}if(args.length===1){rect.set(args[0]);}else{var _args$27=args[0],left=_args$27===undefined?0:_args$27,_args$28=args[1],t=_args$28===undefined?0:_args$28,_args$29=args[2],right=_args$29===undefined?0:_args$29,_args$30=args[3],bottom=_args$30===undefined?0:_args$30;rect.set(left,t,right,bottom);}if(args.length===4||!args[4]&&!args[5]&&!args[6]&&!args[7]){this.clipRectImpl(Math.floor(rect.left),Math.floor(rect.top),Math.ceil(rect.width()),Math.ceil(rect.height()));}else if(args.length===8&&(args[4]!=0||args[5]!=0||args[6]!=0||args[7]!=0)){this.clipRoundRectImpl(Math.floor(rect.left),Math.floor(rect.top),Math.ceil(rect.width()),Math.ceil(rect.height()),args[4],args[5],args[6],args[7]);}this.mCurrentClip.intersect(rect);var r=rect.isEmpty();Canvas.recycleRect(rect);return r;}},{key:'clipRectImpl',value:function clipRectImpl(left,top,width,height){this._mCanvasContent.beginPath();this._mCanvasContent.rect(left,top,width,height);this._mCanvasContent.clip();}},{key:'clipRoundRect',value:function clipRoundRect(r,radiusTopLeft,radiusTopRight,radiusBottomRight,radiusBottomLeft){var rect=Canvas.obtainRect(r);this.clipRoundRectImpl(Math.floor(rect.left),Math.floor(rect.top),Math.ceil(rect.width()),Math.ceil(rect.height()),radiusTopLeft,radiusTopRight,radiusBottomRight,radiusBottomLeft);this.mCurrentClip.intersect(rect);var empty=rect.isEmpty();Canvas.recycleRect(rect);return empty;}},{key:'clipRoundRectImpl',value:function clipRoundRectImpl(left,top,width,height,radiusTopLeft,radiusTopRight,radiusBottomRight,radiusBottomLeft){this.doRoundRectPath(left,top,width,height,radiusTopLeft,radiusTopRight,radiusBottomRight,radiusBottomLeft);this._mCanvasContent.clip();}},{key:'doRoundRectPath',value:function doRoundRectPath(left,top,width,height,radiusTopLeft,radiusTopRight,radiusBottomRight,radiusBottomLeft){var scale1=height/(radiusTopLeft+radiusBottomLeft);var scale2=height/(radiusTopRight+radiusBottomRight);var scale3=width/(radiusTopLeft+radiusTopRight);var scale4=width/(radiusBottomLeft+radiusBottomRight);var scale=Math.min(scale1,scale2,scale3,scale4);if(scale<1){radiusTopLeft*=scale;radiusTopRight*=scale;radiusBottomRight*=scale;radiusBottomLeft*=scale;}var ctx=this._mCanvasContent;ctx.beginPath();ctx.moveTo(left+radiusTopLeft,top);ctx.arcTo(left+width,top,left+width,top+radiusTopRight,radiusTopRight);ctx.arcTo(left+width,top+height,left+width-radiusBottomRight,top+height,radiusBottomRight);ctx.arcTo(left,top+height,left,top+height-radiusBottomLeft,radiusBottomLeft);ctx.arcTo(left,top,left+radiusTopLeft,top,radiusTopLeft);ctx.closePath();}},{key:'getClipBounds',value:function getClipBounds(bounds){if(!this.mCurrentClip)this.mCurrentClip=Canvas.obtainRect();var rect=bounds||Canvas.obtainRect();rect.set(this.mCurrentClip);return rect;}},{key:'quickReject',value:function quickReject(){if(!this.mCurrentClip)return false;for(var _len10=arguments.length,args=Array(_len10),_key10=0;_key10<_len10;_key10++){args[_key10]=arguments[_key10];}if(args.length==1){return!this.mCurrentClip.intersects(args[0]);}else{var _args$31=args[0],left=_args$31===undefined?0:_args$31,_args$32=args[1],t=_args$32===undefined?0:_args$32,_args$33=args[2],right=_args$33===undefined?0:_args$33,_args$34=args[3],bottom=_args$34===undefined?0:_args$34;return!this.mCurrentClip.intersects(left,t,right,bottom);}}},{key:'drawCanvas',value:function drawCanvas(canvas){var offsetX=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var offsetY=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;this.drawCanvasImpl(canvas,offsetX,offsetY);}},{key:'drawCanvasImpl',value:function drawCanvasImpl(canvas,offsetX,offsetY){this._mCanvasContent.drawImage(canvas.mCanvasElement,offsetX,offsetY);}},{key:'drawImage',value:function drawImage(image,srcRect,dstRect,paint){var paintEmpty=!paint||paint.isEmpty();if(!paintEmpty){this.saveImpl();paint.applyToCanvas(this);}this.drawImageImpl(image,srcRect,dstRect);if(!paintEmpty)this.restoreImpl();}},{key:'drawImageImpl',value:function drawImageImpl(image,srcRect,dstRect){if(!dstRect){if(!srcRect){this._mCanvasContent.drawImage(image.browserImage,0,0);}else{this._mCanvasContent.drawImage(image.browserImage,srcRect.left,srcRect.top,srcRect.width(),srcRect.height(),0,0,srcRect.width(),srcRect.height());}}else{if(dstRect.isEmpty())return;if(!srcRect){this._mCanvasContent.drawImage(image.browserImage,dstRect.left,dstRect.top,dstRect.width(),dstRect.height());}else{this._mCanvasContent.drawImage(image.browserImage,srcRect.left,srcRect.top,srcRect.width(),srcRect.height(),dstRect.left,dstRect.top,dstRect.width(),dstRect.height());}}}},{key:'drawRect',value:function drawRect(){for(var _len11=arguments.length,args=Array(_len11),_key11=0;_key11<_len11;_key11++){args[_key11]=arguments[_key11];}if(args.length==2){var rect=args[0];this.drawRect(rect.left,rect.top,rect.right,rect.bottom,args[1]);}else{var left=args[0],top=args[1],right=args[2],bottom=args[3],paint=args[4];var paintEmpty=!paint||paint.isEmpty();if(!paintEmpty){this.saveImpl();paint.applyToCanvas(this);}var style=paint?paint.getStyle():graphics.Paint.Style.FILL;this.drawRectImpl(left,top,right-left,bottom-top,style);if(!paintEmpty)this.restoreImpl();}}},{key:'drawRectImpl',value:function drawRectImpl(left,top,width,height,style){switch(style){case graphics.Paint.Style.STROKE:this._mCanvasContent.strokeRect(left,top,width,height);break;case graphics.Paint.Style.FILL_AND_STROKE:this._mCanvasContent.fillRect(left,top,width,height);this._mCanvasContent.strokeRect(left,top,width,height);break;case graphics.Paint.Style.FILL:default:this._mCanvasContent.fillRect(left,top,width,height);break;}}},{key:'applyFillOrStrokeToContent',value:function applyFillOrStrokeToContent(style){switch(style){case graphics.Paint.Style.STROKE:this._mCanvasContent.stroke();break;case graphics.Paint.Style.FILL_AND_STROKE:this._mCanvasContent.fill();this._mCanvasContent.stroke();break;case graphics.Paint.Style.FILL:default:this._mCanvasContent.fill();break;}}},{key:'drawOval',value:function drawOval(oval,paint){if(oval==null){throw Error('new NullPointerException()');}var paintEmpty=!paint||paint.isEmpty();if(!paintEmpty){this.saveImpl();paint.applyToCanvas(this);}var style=paint?paint.getStyle():graphics.Paint.Style.FILL;this.drawOvalImpl(oval,style);if(!paintEmpty)this.restoreImpl();}},{key:'drawOvalImpl',value:function drawOvalImpl(oval,style){var ctx=this._mCanvasContent;ctx.beginPath();var cx=oval.centerX();var cy=oval.centerY();var rx=oval.width()/2;var ry=oval.height()/2;ctx.save();ctx.translate(cx-rx,cy-ry);ctx.scale(rx,ry);ctx.arc(1,1,1,0,2*Math.PI,false);ctx.restore();this.applyFillOrStrokeToContent(style);}},{key:'drawCircle',value:function drawCircle(cx,cy,radius,paint){var paintEmpty=!paint||paint.isEmpty();if(!paintEmpty){this.saveImpl();paint.applyToCanvas(this);}var style=paint?paint.getStyle():graphics.Paint.Style.FILL;this.drawCircleImpl(cx,cy,radius,style);if(!paintEmpty)this.restoreImpl();}},{key:'drawCircleImpl',value:function drawCircleImpl(cx,cy,radius,style){var ctx=this._mCanvasContent;ctx.beginPath();ctx.arc(cx,cy,radius,0,2*Math.PI,false);this.applyFillOrStrokeToContent(style);}},{key:'drawArc',value:function drawArc(oval,startAngle,sweepAngle,useCenter,paint){if(oval==null){throw Error('new NullPointerException()');}var paintEmpty=!paint||paint.isEmpty();if(!paintEmpty){this.saveImpl();paint.applyToCanvas(this);}var style=paint?paint.getStyle():graphics.Paint.Style.FILL;this.drawArcImpl(oval,startAngle,sweepAngle,useCenter,style);if(!paintEmpty)this.restoreImpl();}},{key:'drawArcImpl',value:function drawArcImpl(oval,startAngle,sweepAngle,useCenter,style){var ctx=this._mCanvasContent;ctx.save();ctx.beginPath();var cx=oval.centerX();var cy=oval.centerY();var rx=oval.width()/2;var ry=oval.height()/2;ctx.translate(cx-rx,cy-ry);ctx.scale(rx,ry);ctx.arc(1,1,1,startAngle/180*Math.PI,(sweepAngle+startAngle)/180*Math.PI,false);if(useCenter){ctx.lineTo(1,1);ctx.closePath();}ctx.restore();this.applyFillOrStrokeToContent(style);}},{key:'drawRoundRect',value:function drawRoundRect(rect,radiusTopLeft,radiusTopRight,radiusBottomRight,radiusBottomLeft,paint){if(rect==null){throw Error('new NullPointerException()');}var paintEmpty=!paint||paint.isEmpty();if(!paintEmpty){this.saveImpl();paint.applyToCanvas(this);}var style=paint?paint.getStyle():graphics.Paint.Style.FILL;this.drawRoundRectImpl(rect,radiusTopLeft,radiusTopRight,radiusBottomRight,radiusBottomLeft,style);if(!paintEmpty)this.restoreImpl();}},{key:'drawRoundRectImpl',value:function drawRoundRectImpl(rect,radiusTopLeft,radiusTopRight,radiusBottomRight,radiusBottomLeft,style){this.doRoundRectPath(rect.left,rect.top,rect.width(),rect.height(),radiusTopLeft,radiusTopRight,radiusBottomRight,radiusBottomLeft);this.applyFillOrStrokeToContent(style);}},{key:'drawPath',value:function drawPath(path,paint){}},{key:'drawText_count',value:function drawText_count(text,index,count,x,y,paint){if((index|count|index+count|text.length-index-count)<0){throw Error('new IndexOutOfBoundsException()');}this.drawText(text.substr(index,count),x,y,paint);}},{key:'drawText_end',value:function drawText_end(text,start,end,x,y,paint){if((start|end|end-start|text.length-end)<0){throw Error('new IndexOutOfBoundsException()');}this.drawText(text.substring(start,end),x,y,paint);}},{key:'drawText',value:function drawText(text,x,y,paint){var paintEmpty=!paint||paint.isEmpty();if(!paintEmpty){this.saveImpl();paint.applyToCanvas(this);}this.drawTextImpl(text,x,y,paint?paint.getStyle():null);if(!paintEmpty)this.restoreImpl();}},{key:'drawTextImpl',value:function drawTextImpl(text,x,y,style){switch(style){case graphics.Paint.Style.STROKE:this._mCanvasContent.strokeText(text,x,y);break;case graphics.Paint.Style.FILL_AND_STROKE:this._mCanvasContent.strokeText(text,x,y);this._mCanvasContent.fillText(text,x,y);break;case graphics.Paint.Style.FILL:default:this._mCanvasContent.fillText(text,x,y);break;}}},{key:'drawTextRun_count',value:function drawTextRun_count(text,index,count,contextIndex,contextCount,x,y,dir,paint){this.drawText_count(text,index,count,x,y,paint);}},{key:'drawTextRun_end',value:function drawTextRun_end(text,start,end,contextStart,contextEnd,x,y,dir,paint){this.drawText_end(text,start,end,x,y,paint);}},{key:'setColor',value:function setColor(color,style){if(color!=null){this.setColorImpl(color,style);}}},{key:'setColorImpl',value:function setColorImpl(color,style){var colorS=Color.toRGBAFunc(color);switch(style){case graphics.Paint.Style.STROKE:if(Color.parseColor(this._mCanvasContent.strokeStyle+'',0)!=color){this._mCanvasContent.strokeStyle=colorS;}break;case graphics.Paint.Style.FILL:if(Color.parseColor(this._mCanvasContent.fillStyle+'',0)!=color){this._mCanvasContent.fillStyle=colorS;}break;default:case graphics.Paint.Style.FILL_AND_STROKE:if(Color.parseColor(this._mCanvasContent.fillStyle+'',0)!=color){this._mCanvasContent.fillStyle=colorS;}if(Color.parseColor(this._mCanvasContent.strokeStyle+'',0)!=color){this._mCanvasContent.strokeStyle=colorS;}break;}}},{key:'multiplyGlobalAlpha',value:function multiplyGlobalAlpha(alpha){if(typeof alpha==='number'&&alpha<1){this.multiplyGlobalAlphaImpl(alpha);}}},{key:'multiplyGlobalAlphaImpl',value:function multiplyGlobalAlphaImpl(alpha){this._mCanvasContent.globalAlpha*=alpha;}},{key:'setGlobalAlpha',value:function setGlobalAlpha(alpha){if(typeof alpha==='number'){this.setGlobalAlphaImpl(alpha);}}},{key:'setGlobalAlphaImpl',value:function setGlobalAlphaImpl(alpha){this._mCanvasContent.globalAlpha=alpha;}},{key:'setTextAlign',value:function setTextAlign(align){if(align!=null)this.setTextAlignImpl(align);}},{key:'setTextAlignImpl',value:function setTextAlignImpl(align){this._mCanvasContent.textAlign=align;}},{key:'setLineWidth',value:function setLineWidth(width){if(width!=null)this.setLineWidthImpl(width);}},{key:'setLineWidthImpl',value:function setLineWidthImpl(width){this._mCanvasContent.lineWidth=width;}},{key:'setLineCap',value:function setLineCap(lineCap){if(lineCap!=null)this.setLineCapImpl(lineCap);}},{key:'setLineCapImpl',value:function setLineCapImpl(lineCap){this._mCanvasContent.lineCap=lineCap;}},{key:'setLineJoin',value:function setLineJoin(lineJoin){if(lineJoin!=null)this.setLineJoinImpl(lineJoin);}},{key:'setLineJoinImpl',value:function setLineJoinImpl(lineJoin){this._mCanvasContent.lineJoin=lineJoin;}},{key:'setShadow',value:function setShadow(radius,dx,dy,color){if(radius>0){this.setShadowImpl(radius,dx,dy,color);}}},{key:'setShadowImpl',value:function setShadowImpl(radius,dx,dy,color){this._mCanvasContent.shadowBlur=radius;this._mCanvasContent.shadowOffsetX=dx;this._mCanvasContent.shadowOffsetY=dy;this._mCanvasContent.shadowColor=Color.toRGBAFunc(color);}},{key:'setFontSize',value:function setFontSize(size){if(size!=null){this.setFontSizeImpl(size);}}},{key:'setFontSizeImpl',value:function setFontSizeImpl(size){var cFont=this._mCanvasContent.font;var fontParts=cFont.split(' ');if(Number.parseFloat(fontParts[fontParts.length-2])==size)return;fontParts[fontParts.length-2]=size+'px';this._mCanvasContent.font=fontParts.join(' ');}},{key:'setFont',value:function setFont(fontName){if(fontName!=null){this.setFontImpl(fontName);}}},{key:'setFontImpl',value:function setFontImpl(fontName){var cFont=this._mCanvasContent.font;var fontParts=cFont.split(' ');fontParts[fontParts.length-1]=fontName;var font=fontParts.join(' ');if(font!=cFont)this._mCanvasContent.font=font;}},{key:'isImageSmoothingEnabled',value:function isImageSmoothingEnabled(){return this.isImageSmoothingEnabledImpl();}},{key:'isImageSmoothingEnabledImpl',value:function isImageSmoothingEnabledImpl(){return this._mCanvasContent['imageSmoothingEnabled']||this._mCanvasContent['webkitImageSmoothingEnabled'];}},{key:'setImageSmoothingEnabled',value:function setImageSmoothingEnabled(enable){this.setImageSmoothingEnabledImpl(enable);}},{key:'setImageSmoothingEnabledImpl',value:function setImageSmoothingEnabledImpl(enable){if('imageSmoothingEnabled'in this._mCanvasContent){this._mCanvasContent['imageSmoothingEnabled']=enable;}else if('webkitImageSmoothingEnabled'in this._mCanvasContent){this._mCanvasContent['webkitImageSmoothingEnabled']=enable;}}}],[{key:'obtainRect',value:function obtainRect(copy){var rect=Canvas.sRectPool.acquire();if(!rect)rect=new Rect();if(copy)rect.set(copy);return rect;}},{key:'recycleRect',value:function recycleRect(rect){rect.setEmpty();Canvas.sRectPool.release(rect);}},{key:'measureText',value:function measureText(text,textSize){if(textSize==null||textSize===0)return 0;return Canvas.measureTextImpl(text,textSize);}},{key:'measureTextImpl',value:function measureTextImpl(text,textSize){var width=0;for(var i=0,length=text.length;i<length;i++){var c=text.charCodeAt(i);var cWidth=Canvas._measureCacheMap.get(c);if(cWidth==null){cWidth=Canvas._measureTextContext.measureText(text[i]).width;Canvas._measureCacheMap.set(c,cWidth);}width+=cWidth*textSize/Canvas._measureCacheTextSize;}return width;}},{key:'getMeasureTextFontFamily',value:function getMeasureTextFontFamily(){var fontParts=Canvas._measureTextContext.font.split(' ');return fontParts[fontParts.length-1];}}]);return Canvas;}();Canvas.TempMatrixValue=androidui.util.ArrayCreator.newNumberArray(9);Canvas.DIRECTION_LTR=0;Canvas.DIRECTION_RTL=1;Canvas.sRectPool=new Pools.SynchronizedPool(20);Canvas._measureTextContext=document.createElement('canvas').getContext('2d');Canvas._measureCacheTextSize=1000;Canvas._static=function(){Canvas._measureTextContext.font=Canvas._measureCacheTextSize+'px '+Canvas.getMeasureTextFontFamily();}();Canvas._measureCacheMap=new Map();graphics.Canvas=Canvas;})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var drawable;(function(drawable_1){var Rect=android.graphics.Rect;var PixelFormat=android.graphics.PixelFormat;var WeakReference=java.lang.ref.WeakReference;var StateSet=android.util.StateSet;var Drawable=function(){function Drawable(){_classCallCheck(this,Drawable);this.mBounds=Drawable.ZERO_BOUNDS_RECT;this.mStateSet=StateSet.WILD_CARD;this.mLevel=0;this.mVisible=true;this.mIgnoreNotifySizeChange=false;}_createClass(Drawable,[{key:'setBounds',value:function setBounds(){for(var _len12=arguments.length,args=Array(_len12),_key12=0;_key12<_len12;_key12++){args[_key12]=arguments[_key12];}if(args.length===1){var rect=args[0];return this.setBounds(rect.left,rect.top,rect.right,rect.bottom);}else{var _args$35=args[0],left=_args$35===undefined?0:_args$35,_args$36=args[1],top=_args$36===undefined?0:_args$36,_args$37=args[2],right=_args$37===undefined?0:_args$37,_args$38=args[3],bottom=_args$38===undefined?0:_args$38;var oldBounds=this.mBounds;if(oldBounds==Drawable.ZERO_BOUNDS_RECT){oldBounds=this.mBounds=new Rect();}if(oldBounds.left!=left||oldBounds.top!=top||oldBounds.right!=right||oldBounds.bottom!=bottom){if(!oldBounds.isEmpty()){this.invalidateSelf();}this.mBounds.set(left,top,right,bottom);this.onBoundsChange(this.mBounds);}}}},{key:'copyBounds',value:function copyBounds(){var bounds=arguments.length>0&&arguments[0]!==undefined?arguments[0]:new Rect();bounds.set(this.mBounds);return bounds;}},{key:'getBounds',value:function getBounds(){if(this.mBounds==Drawable.ZERO_BOUNDS_RECT){this.mBounds=new Rect();}return this.mBounds;}},{key:'setDither',value:function setDither(dither){}},{key:'setCallback',value:function setCallback(cb){this.mCallback=new WeakReference(cb);}},{key:'getCallback',value:function getCallback(){if(this.mCallback!=null){return this.mCallback.get();}return null;}},{key:'setIgnoreNotifySizeChange',value:function setIgnoreNotifySizeChange(isIgnore){this.mIgnoreNotifySizeChange=isIgnore;}},{key:'notifySizeChangeSelf',value:function notifySizeChangeSelf(){if(this.mIgnoreNotifySizeChange)return;var callback=this.getCallback();if(callback!=null&&callback.drawableSizeChange){callback.drawableSizeChange(this);}}},{key:'invalidateSelf',value:function invalidateSelf(){var callback=this.getCallback();if(callback!=null){callback.invalidateDrawable(this);}}},{key:'scheduleSelf',value:function scheduleSelf(what,when){var callback=this.getCallback();if(callback!=null){callback.scheduleDrawable(this,what,when);}}},{key:'unscheduleSelf',value:function unscheduleSelf(what){var callback=this.getCallback();if(callback!=null){callback.unscheduleDrawable(this,what);}}},{key:'getAlpha',value:function getAlpha(){return 0xFF;}},{key:'isStateful',value:function isStateful(){return false;}},{key:'setState',value:function setState(stateSet){if(this.mStateSet+''!==stateSet+''){this.mStateSet=stateSet;return this.onStateChange(stateSet);}return false;}},{key:'getState',value:function getState(){return this.mStateSet;}},{key:'jumpToCurrentState',value:function jumpToCurrentState(){}},{key:'getCurrent',value:function getCurrent(){return this;}},{key:'setLevel',value:function setLevel(level){if(this.mLevel!=level){this.mLevel=level;return this.onLevelChange(level);}return false;}},{key:'getLevel',value:function getLevel(){return this.mLevel;}},{key:'setVisible',value:function setVisible(visible,restart){var changed=this.mVisible!=visible;if(changed){this.mVisible=visible;this.invalidateSelf();}return changed;}},{key:'isVisible',value:function isVisible(){return this.mVisible;}},{key:'setAutoMirrored',value:function setAutoMirrored(mirrored){}},{key:'isAutoMirrored',value:function isAutoMirrored(){return false;}},{key:'getOpacity',value:function getOpacity(){return PixelFormat.TRANSLUCENT;}},{key:'onStateChange',value:function onStateChange(state){return false;}},{key:'onLevelChange',value:function onLevelChange(level){return false;}},{key:'onBoundsChange',value:function onBoundsChange(bounds){}},{key:'getIntrinsicWidth',value:function getIntrinsicWidth(){return-1;}},{key:'getIntrinsicHeight',value:function getIntrinsicHeight(){return-1;}},{key:'getMinimumWidth',value:function getMinimumWidth(){var intrinsicWidth=this.getIntrinsicWidth();return intrinsicWidth>0?intrinsicWidth:0;}},{key:'getMinimumHeight',value:function getMinimumHeight(){var intrinsicHeight=this.getIntrinsicHeight();return intrinsicHeight>0?intrinsicHeight:0;}},{key:'getPadding',value:function getPadding(padding){padding.set(0,0,0,0);return false;}},{key:'mutate',value:function mutate(){return this;}},{key:'getConstantState',value:function getConstantState(){return null;}},{key:'inflate',value:function inflate(r,parser){this.mVisible=parser.getAttribute('android:visible')!=='false';}}],[{key:'resolveOpacity',value:function resolveOpacity(op1,op2){if(op1==op2){return op1;}if(op1==PixelFormat.UNKNOWN||op2==PixelFormat.UNKNOWN){return PixelFormat.UNKNOWN;}if(op1==PixelFormat.TRANSLUCENT||op2==PixelFormat.TRANSLUCENT){return PixelFormat.TRANSLUCENT;}if(op1==PixelFormat.TRANSPARENT||op2==PixelFormat.TRANSPARENT){return PixelFormat.TRANSPARENT;}return PixelFormat.OPAQUE;}},{key:'createFromXml',value:function createFromXml(r,parser){var drawable=void 0;var name=parser.tagName.toLowerCase();switch(name){case\"selector\":drawable=new drawable_1.StateListDrawable();break;case\"layer-list\":drawable=new drawable_1.LayerDrawable(null);break;case\"color\":drawable=new drawable_1.ColorDrawable();break;case\"scale\":drawable=new drawable_1.ScaleDrawable();break;case\"clip\":drawable=new drawable_1.ClipDrawable();break;case\"rotate\":drawable=new drawable_1.RotateDrawable();break;case\"animation-list\":drawable=new drawable_1.AnimationDrawable();break;case\"inset\":drawable=new drawable_1.InsetDrawable(null,0);break;case\"bitmap\":var srcAttr=parser.getAttribute('src');if(!srcAttr)throw Error(\"XmlPullParserException: bitmap tag must have 'src' attribute\");drawable=r.getDrawable(srcAttr);break;default:throw Error(\"XmlPullParserException: invalid drawable tag \"+name);}drawable.inflate(r,parser);return drawable;}}]);return Drawable;}();Drawable.ZERO_BOUNDS_RECT=new Rect();drawable_1.Drawable=Drawable;})(drawable=graphics.drawable||(graphics.drawable={}));})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var drawable;(function(drawable){var ColorDrawable=function(_drawable$Drawable){_inherits(ColorDrawable,_drawable$Drawable);function ColorDrawable(color){_classCallCheck(this,ColorDrawable);var _this8=_possibleConstructorReturn(this,(ColorDrawable.__proto__||Object.getPrototypeOf(ColorDrawable)).call(this));_this8.mMutated=false;_this8.mPaint=new graphics.Paint();_this8.mState=new ColorState();if(color!==undefined){_this8.setColor(color);}return _this8;}_createClass(ColorDrawable,[{key:'_setStateCopyFrom',value:function _setStateCopyFrom(state){this.mState=new ColorState(state);}},{key:'mutate',value:function mutate(){if(!this.mMutated&&_get2(ColorDrawable.prototype.__proto__||Object.getPrototypeOf(ColorDrawable.prototype),'mutate',this).call(this)==this){this.mState=new ColorState(this.mState);this.mMutated=true;}return this;}},{key:'draw',value:function draw(canvas){if(this.mState.mUseColor>>>24!=0){this.mPaint.setColor(this.mState.mUseColor);canvas.drawRect(this.getBounds(),this.mPaint);}}},{key:'getColor',value:function getColor(){return this.mState.mUseColor;}},{key:'setColor',value:function setColor(color){if(this.mState.mBaseColor!=color||this.mState.mUseColor!=color){this.invalidateSelf();this.mState.mBaseColor=this.mState.mUseColor=color;}}},{key:'getAlpha',value:function getAlpha(){return this.mState.mUseColor>>>24;}},{key:'setAlpha',value:function setAlpha(alpha){alpha+=alpha>>7;var baseAlpha=this.mState.mBaseColor>>>24;var useAlpha=baseAlpha*alpha>>8;var oldUseColor=this.mState.mUseColor;this.mState.mUseColor=this.mState.mBaseColor<<8>>>8|useAlpha<<24;if(oldUseColor!=this.mState.mUseColor){this.invalidateSelf();}}},{key:'getOpacity',value:function getOpacity(){switch(this.mState.mUseColor>>>24){case 255:return graphics.PixelFormat.OPAQUE;case 0:return graphics.PixelFormat.TRANSPARENT;}return graphics.PixelFormat.TRANSLUCENT;}},{key:'inflate',value:function inflate(r,parser){_get2(ColorDrawable.prototype.__proto__||Object.getPrototypeOf(ColorDrawable.prototype),'inflate',this).call(this,r,parser);var state=this.mState;state.mBaseColor=androidui.attr.AttrValueParser.parseColor(r,parser.innerText,state.mBaseColor);state.mUseColor=state.mBaseColor;}},{key:'getConstantState',value:function getConstantState(){return this.mState;}}]);return ColorDrawable;}(drawable.Drawable);drawable.ColorDrawable=ColorDrawable;var ColorState=function(){function ColorState(state){_classCallCheck(this,ColorState);this.mBaseColor=0;this.mUseColor=0;if(state!=null){this.mBaseColor=state.mBaseColor;this.mUseColor=state.mUseColor;}}_createClass(ColorState,[{key:'newDrawable',value:function newDrawable(){var c=new ColorDrawable();c._setStateCopyFrom(this);return c;}}]);return ColorState;}();})(drawable=graphics.drawable||(graphics.drawable={}));})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var drawable;(function(drawable){var Drawable=android.graphics.drawable.Drawable;var ScrollBarDrawable=function(_Drawable){_inherits(ScrollBarDrawable,_Drawable);function ScrollBarDrawable(){_classCallCheck(this,ScrollBarDrawable);var _this9=_possibleConstructorReturn(this,(ScrollBarDrawable.__proto__||Object.getPrototypeOf(ScrollBarDrawable)).apply(this,arguments));_this9.mRange=0;_this9.mOffset=0;_this9.mExtent=0;_this9.mVertical=false;_this9.mChanged=false;_this9.mRangeChanged=false;_this9.mTempBounds=new graphics.Rect();_this9.mAlwaysDrawHorizontalTrack=false;_this9.mAlwaysDrawVerticalTrack=false;return _this9;}_createClass(ScrollBarDrawable,[{key:'setAlwaysDrawHorizontalTrack',value:function setAlwaysDrawHorizontalTrack(alwaysDrawTrack){this.mAlwaysDrawHorizontalTrack=alwaysDrawTrack;}},{key:'setAlwaysDrawVerticalTrack',value:function setAlwaysDrawVerticalTrack(alwaysDrawTrack){this.mAlwaysDrawVerticalTrack=alwaysDrawTrack;}},{key:'getAlwaysDrawVerticalTrack',value:function getAlwaysDrawVerticalTrack(){return this.mAlwaysDrawVerticalTrack;}},{key:'getAlwaysDrawHorizontalTrack',value:function getAlwaysDrawHorizontalTrack(){return this.mAlwaysDrawHorizontalTrack;}},{key:'setParameters',value:function setParameters(range,offset,extent,vertical){if(this.mVertical!=vertical){this.mChanged=true;}if(this.mRange!=range||this.mOffset!=offset||this.mExtent!=extent){this.mRangeChanged=true;}this.mRange=range;this.mOffset=offset;this.mExtent=extent;this.mVertical=vertical;}},{key:'draw',value:function draw(canvas){var vertical=this.mVertical;var extent=this.mExtent;var range=this.mRange;var drawTrack=true;var drawThumb=true;if(extent<=0||range<=extent){drawTrack=vertical?this.mAlwaysDrawVerticalTrack:this.mAlwaysDrawHorizontalTrack;drawThumb=false;}var r=this.getBounds();if(drawTrack){this.drawTrack(canvas,r,vertical);}if(drawThumb){var size=vertical?r.height():r.width();var thickness=vertical?r.width():r.height();var length=Math.round(size*extent/range);var offset=Math.round((size-length)*this.mOffset/(range-extent));var minLength=thickness*2;if(length<minLength){length=minLength;}if(offset+length>size){offset=size-length;}this.drawThumb(canvas,r,offset,length,vertical);}}},{key:'onBoundsChange',value:function onBoundsChange(bounds){_get2(ScrollBarDrawable.prototype.__proto__||Object.getPrototypeOf(ScrollBarDrawable.prototype),'onBoundsChange',this).call(this,bounds);this.mChanged=true;}},{key:'drawTrack',value:function drawTrack(canvas,bounds,vertical){var track=void 0;if(vertical){track=this.mVerticalTrack;}else{track=this.mHorizontalTrack;}if(track!=null){if(this.mChanged){track.setBounds(bounds);}track.draw(canvas);}}},{key:'drawThumb',value:function drawThumb(canvas,bounds,offset,length,vertical){var thumbRect=this.mTempBounds;var changed=this.mRangeChanged||this.mChanged;if(changed){if(vertical){thumbRect.set(bounds.left,bounds.top+offset,bounds.right,bounds.top+offset+length);}else{thumbRect.set(bounds.left+offset,bounds.top,bounds.left+offset+length,bounds.bottom);}}if(vertical){var thumb=this.mVerticalThumb;if(changed)thumb.setBounds(thumbRect);thumb.draw(canvas);}else{var _thumb=this.mHorizontalThumb;if(changed)_thumb.setBounds(thumbRect);_thumb.draw(canvas);}}},{key:'setVerticalThumbDrawable',value:function setVerticalThumbDrawable(thumb){if(thumb!=null){this.mVerticalThumb=thumb;}}},{key:'setVerticalTrackDrawable',value:function setVerticalTrackDrawable(track){this.mVerticalTrack=track;}},{key:'setHorizontalThumbDrawable',value:function setHorizontalThumbDrawable(thumb){if(thumb!=null){this.mHorizontalThumb=thumb;}}},{key:'setHorizontalTrackDrawable',value:function setHorizontalTrackDrawable(track){this.mHorizontalTrack=track;}},{key:'getSize',value:function getSize(vertical){if(vertical){return(this.mVerticalTrack!=null?this.mVerticalTrack:this.mVerticalThumb).getIntrinsicWidth();}else{return(this.mHorizontalTrack!=null?this.mHorizontalTrack:this.mHorizontalThumb).getIntrinsicHeight();}}},{key:'setAlpha',value:function setAlpha(alpha){if(this.mVerticalTrack!=null){this.mVerticalTrack.setAlpha(alpha);}this.mVerticalThumb.setAlpha(alpha);if(this.mHorizontalTrack!=null){this.mHorizontalTrack.setAlpha(alpha);}this.mHorizontalThumb.setAlpha(alpha);}},{key:'getAlpha',value:function getAlpha(){return this.mVerticalThumb.getAlpha();}},{key:'getOpacity',value:function getOpacity(){return graphics.PixelFormat.TRANSLUCENT;}},{key:'toString',value:function toString(){return\"ScrollBarDrawable: range=\"+this.mRange+\" offset=\"+this.mOffset+\" extent=\"+this.mExtent+(this.mVertical?\" V\":\" H\");}}]);return ScrollBarDrawable;}(Drawable);drawable.ScrollBarDrawable=ScrollBarDrawable;})(drawable=graphics.drawable||(graphics.drawable={}));})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var drawable;(function(drawable_2){var Integer=java.lang.Integer;var InsetDrawable=function(_drawable_2$Drawable){_inherits(InsetDrawable,_drawable_2$Drawable);function InsetDrawable(drawable,insetLeft){var insetTop=arguments.length>2&&arguments[2]!==undefined?arguments[2]:insetLeft;var insetRight=arguments.length>3&&arguments[3]!==undefined?arguments[3]:insetTop;var insetBottom=arguments.length>4&&arguments[4]!==undefined?arguments[4]:insetRight;_classCallCheck(this,InsetDrawable);var _this10=_possibleConstructorReturn(this,(InsetDrawable.__proto__||Object.getPrototypeOf(InsetDrawable)).call(this));_this10.mTmpRect=new graphics.Rect();_this10.mMutated=false;_this10.mInsetState=new InsetState(null,_this10);_this10.mInsetState.mDrawable=drawable;_this10.mInsetState.mInsetLeft=insetLeft;_this10.mInsetState.mInsetTop=insetTop;_this10.mInsetState.mInsetRight=insetRight;_this10.mInsetState.mInsetBottom=insetBottom;if(drawable!=null){drawable.setCallback(_this10);}return _this10;}_createClass(InsetDrawable,[{key:'inflate',value:function inflate(r,parser){_get2(InsetDrawable.prototype.__proto__||Object.getPrototypeOf(InsetDrawable.prototype),'inflate',this).call(this,r,parser);this.mInsetState.mDrawable=null;var state=this.mInsetState;var a=r.obtainAttributes(parser);var dr=a.getDrawable(\"android:drawable\");if(!dr&&parser.children[0]instanceof HTMLElement){dr=drawable_2.Drawable.createFromXml(r,parser.children[0]);}if(!dr){throw Error(\"<inset> tag requires a 'drawable' attribute or child tag defining a drawable\");}var inset=a.getDimensionPixelOffset(\"android:inset\",Integer.MIN_VALUE);if(inset!=Integer.MIN_VALUE){state.mInsetLeft=inset;state.mInsetTop=inset;state.mInsetRight=inset;state.mInsetBottom=inset;}state.mInsetLeft=a.getDimensionPixelOffset(\"android:insetLeft\",state.mInsetLeft);state.mInsetTop=a.getDimensionPixelOffset(\"android:insetTop\",state.mInsetTop);state.mInsetRight=a.getDimensionPixelOffset(\"android:insetRight\",state.mInsetRight);state.mInsetBottom=a.getDimensionPixelOffset(\"android:insetBottom\",state.mInsetBottom);}},{key:'drawableSizeChange',value:function drawableSizeChange(who){var callback=this.getCallback();if(callback!=null&&callback.drawableSizeChange){callback.drawableSizeChange(this);}}},{key:'invalidateDrawable',value:function invalidateDrawable(who){var callback=this.getCallback();if(callback!=null){callback.invalidateDrawable(this);}}},{key:'scheduleDrawable',value:function scheduleDrawable(who,what,when){var callback=this.getCallback();if(callback!=null){callback.scheduleDrawable(this,what,when);}}},{key:'unscheduleDrawable',value:function unscheduleDrawable(who,what){var callback=this.getCallback();if(callback!=null){callback.unscheduleDrawable(this,what);}}},{key:'draw',value:function draw(canvas){this.mInsetState.mDrawable.draw(canvas);}},{key:'getPadding',value:function getPadding(padding){var pad=this.mInsetState.mDrawable.getPadding(padding);padding.left+=this.mInsetState.mInsetLeft;padding.right+=this.mInsetState.mInsetRight;padding.top+=this.mInsetState.mInsetTop;padding.bottom+=this.mInsetState.mInsetBottom;if(pad||(this.mInsetState.mInsetLeft|this.mInsetState.mInsetRight|this.mInsetState.mInsetTop|this.mInsetState.mInsetBottom)!=0){return true;}else{return false;}}},{key:'setVisible',value:function setVisible(visible,restart){this.mInsetState.mDrawable.setVisible(visible,restart);return _get2(InsetDrawable.prototype.__proto__||Object.getPrototypeOf(InsetDrawable.prototype),'setVisible',this).call(this,visible,restart);}},{key:'setAlpha',value:function setAlpha(alpha){this.mInsetState.mDrawable.setAlpha(alpha);}},{key:'getAlpha',value:function getAlpha(){return this.mInsetState.mDrawable.getAlpha();}},{key:'getOpacity',value:function getOpacity(){return this.mInsetState.mDrawable.getOpacity();}},{key:'isStateful',value:function isStateful(){return this.mInsetState.mDrawable.isStateful();}},{key:'onStateChange',value:function onStateChange(state){var changed=this.mInsetState.mDrawable.setState(state);this.onBoundsChange(this.getBounds());return changed;}},{key:'onBoundsChange',value:function onBoundsChange(bounds){var r=this.mTmpRect;r.set(bounds);r.left+=this.mInsetState.mInsetLeft;r.top+=this.mInsetState.mInsetTop;r.right-=this.mInsetState.mInsetRight;r.bottom-=this.mInsetState.mInsetBottom;this.mInsetState.mDrawable.setBounds(r.left,r.top,r.right,r.bottom);}},{key:'getIntrinsicWidth',value:function getIntrinsicWidth(){return this.mInsetState.mDrawable.getIntrinsicWidth();}},{key:'getIntrinsicHeight',value:function getIntrinsicHeight(){return this.mInsetState.mDrawable.getIntrinsicHeight();}},{key:'getConstantState',value:function getConstantState(){if(this.mInsetState.canConstantState()){return this.mInsetState;}return null;}},{key:'mutate',value:function mutate(){if(!this.mMutated&&_get2(InsetDrawable.prototype.__proto__||Object.getPrototypeOf(InsetDrawable.prototype),'mutate',this).call(this)==this){this.mInsetState.mDrawable.mutate();this.mMutated=true;}return this;}},{key:'getDrawable',value:function getDrawable(){return this.mInsetState.mDrawable;}}]);return InsetDrawable;}(drawable_2.Drawable);drawable_2.InsetDrawable=InsetDrawable;var InsetState=function(){function InsetState(orig,owner){_classCallCheck(this,InsetState);this.mInsetLeft=0;this.mInsetTop=0;this.mInsetRight=0;this.mInsetBottom=0;if(orig!=null){this.mDrawable=orig.mDrawable.getConstantState().newDrawable();this.mDrawable.setCallback(owner);this.mInsetLeft=orig.mInsetLeft;this.mInsetTop=orig.mInsetTop;this.mInsetRight=orig.mInsetRight;this.mInsetBottom=orig.mInsetBottom;this.mCheckedConstantState=this.mCanConstantState=true;}}_createClass(InsetState,[{key:'newDrawable',value:function newDrawable(){var drawable=new InsetDrawable(null,0);drawable.mInsetState=new InsetState(this,drawable);return drawable;}},{key:'canConstantState',value:function canConstantState(){if(!this.mCheckedConstantState){this.mCanConstantState=this.mDrawable.getConstantState()!=null;this.mCheckedConstantState=true;}return this.mCanConstantState;}}]);return InsetState;}();})(drawable=graphics.drawable||(graphics.drawable={}));})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var drawable;(function(drawable_3){var ShadowDrawable=function(_drawable_3$Drawable){_inherits(ShadowDrawable,_drawable_3$Drawable);function ShadowDrawable(drawable,radius,dx,dy,color){_classCallCheck(this,ShadowDrawable);var _this11=_possibleConstructorReturn(this,(ShadowDrawable.__proto__||Object.getPrototypeOf(ShadowDrawable)).call(this));_this11.mMutated=false;_this11.mState=new DrawableState(null,_this11);_this11.mState.mDrawable=drawable;_this11.mState.shadowDx=dx;_this11.mState.shadowDy=dy;_this11.mState.shadowRadius=radius;_this11.mState.shadowColor=color;if(drawable!=null){drawable.setCallback(_this11);}return _this11;}_createClass(ShadowDrawable,[{key:'setShadow',value:function setShadow(radius,dx,dy,color){this.mState.shadowDx=dx;this.mState.shadowDy=dy;this.mState.shadowRadius=radius;this.mState.shadowColor=color;}},{key:'drawableSizeChange',value:function drawableSizeChange(who){var callback=this.getCallback();if(callback!=null&&callback.drawableSizeChange){callback.drawableSizeChange(this);}}},{key:'invalidateDrawable',value:function invalidateDrawable(who){var callback=this.getCallback();if(callback!=null){callback.invalidateDrawable(this);}}},{key:'scheduleDrawable',value:function scheduleDrawable(who,what,when){var callback=this.getCallback();if(callback!=null){callback.scheduleDrawable(this,what,when);}}},{key:'unscheduleDrawable',value:function unscheduleDrawable(who,what){var callback=this.getCallback();if(callback!=null){callback.unscheduleDrawable(this,what);}}},{key:'draw',value:function draw(canvas){if(!this.mState.shadowRadius||graphics.Color.alpha(this.mState.shadowColor)===0){this.mState.mDrawable.draw(canvas);return;}var saveCount=canvas.save();canvas.setShadow(this.mState.shadowRadius,this.mState.shadowDx,this.mState.shadowDy,this.mState.shadowColor);this.mState.mDrawable.draw(canvas);canvas.restoreToCount(saveCount);}},{key:'getPadding',value:function getPadding(padding){return this.mState.mDrawable.getPadding(padding);}},{key:'setVisible',value:function setVisible(visible,restart){this.mState.mDrawable.setVisible(visible,restart);return _get2(ShadowDrawable.prototype.__proto__||Object.getPrototypeOf(ShadowDrawable.prototype),'setVisible',this).call(this,visible,restart);}},{key:'setAlpha',value:function setAlpha(alpha){this.mState.mDrawable.setAlpha(alpha);}},{key:'getAlpha',value:function getAlpha(){return this.mState.mDrawable.getAlpha();}},{key:'getOpacity',value:function getOpacity(){return graphics.PixelFormat.TRANSPARENT;}},{key:'isStateful',value:function isStateful(){return this.mState.mDrawable.isStateful();}},{key:'onStateChange',value:function onStateChange(state){var changed=this.mState.mDrawable.setState(state);this.onBoundsChange(this.getBounds());return changed;}},{key:'onBoundsChange',value:function onBoundsChange(bounds){this.mState.mDrawable.setBounds(bounds.left,bounds.top,bounds.right,bounds.bottom);}},{key:'getIntrinsicWidth',value:function getIntrinsicWidth(){return this.mState.mDrawable.getIntrinsicWidth();}},{key:'getIntrinsicHeight',value:function getIntrinsicHeight(){return this.mState.mDrawable.getIntrinsicHeight();}},{key:'getConstantState',value:function getConstantState(){if(this.mState.canConstantState()){return this.mState;}return null;}},{key:'mutate',value:function mutate(){if(!this.mMutated&&_get2(ShadowDrawable.prototype.__proto__||Object.getPrototypeOf(ShadowDrawable.prototype),'mutate',this).call(this)==this){this.mState.mDrawable.mutate();this.mMutated=true;}return this;}},{key:'getDrawable',value:function getDrawable(){return this.mState.mDrawable;}}]);return ShadowDrawable;}(drawable_3.Drawable);drawable_3.ShadowDrawable=ShadowDrawable;var DrawableState=function(){function DrawableState(orig,owner){_classCallCheck(this,DrawableState);this.shadowDx=0;this.shadowDy=0;this.shadowRadius=0;this.shadowColor=0;if(orig!=null){this.mDrawable=orig.mDrawable.getConstantState().newDrawable();this.mDrawable.setCallback(owner);this.shadowDx=orig.shadowDx;this.shadowDy=orig.shadowDy;this.shadowRadius=orig.shadowRadius;this.shadowColor=orig.shadowColor;}}_createClass(DrawableState,[{key:'newDrawable',value:function newDrawable(){var drawable=new ShadowDrawable(null,0,0,0,0);drawable.mState=new DrawableState(this,drawable);return drawable;}},{key:'canConstantState',value:function canConstantState(){if(!this.mCheckedConstantState){this.mCanConstantState=this.mDrawable.getConstantState()!=null;this.mCheckedConstantState=true;}return this.mCanConstantState;}}]);return DrawableState;}();})(drawable=graphics.drawable||(graphics.drawable={}));})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var drawable;(function(drawable){var RoundRectDrawable=function(_drawable$Drawable2){_inherits(RoundRectDrawable,_drawable$Drawable2);function RoundRectDrawable(color,radiusTopLeft){var radiusTopRight=arguments.length>2&&arguments[2]!==undefined?arguments[2]:radiusTopLeft;var radiusBottomRight=arguments.length>3&&arguments[3]!==undefined?arguments[3]:radiusTopRight;var radiusBottomLeft=arguments.length>4&&arguments[4]!==undefined?arguments[4]:radiusBottomRight;_classCallCheck(this,RoundRectDrawable);var _this12=_possibleConstructorReturn(this,(RoundRectDrawable.__proto__||Object.getPrototypeOf(RoundRectDrawable)).call(this));_this12.mMutated=false;_this12.mPaint=new graphics.Paint();_this12.mState=new State();_this12.setColor(color);_this12.mState.mRadiusTopLeft=radiusTopLeft;_this12.mState.mRadiusTopRight=radiusTopRight;_this12.mState.mRadiusBottomRight=radiusBottomRight;_this12.mState.mRadiusBottomLeft=radiusBottomLeft;return _this12;}_createClass(RoundRectDrawable,[{key:'mutate',value:function mutate(){if(!this.mMutated&&_get2(RoundRectDrawable.prototype.__proto__||Object.getPrototypeOf(RoundRectDrawable.prototype),'mutate',this).call(this)==this){this.mState=new State(this.mState);this.mMutated=true;}return this;}},{key:'draw',value:function draw(canvas){if(this.mState.mUseColor>>>24!=0){this.mPaint.setColor(this.mState.mUseColor);canvas.drawRoundRect(this.getBounds(),this.mState.mRadiusTopLeft,this.mState.mRadiusTopRight,this.mState.mRadiusBottomRight,this.mState.mRadiusBottomLeft,this.mPaint);}}},{key:'getColor',value:function getColor(){return this.mState.mUseColor;}},{key:'setColor',value:function setColor(color){if(this.mState.mBaseColor!=color||this.mState.mUseColor!=color){this.invalidateSelf();this.mState.mBaseColor=this.mState.mUseColor=color;}}},{key:'getAlpha',value:function getAlpha(){return this.mState.mUseColor>>>24;}},{key:'setAlpha',value:function setAlpha(alpha){alpha+=alpha>>7;var baseAlpha=this.mState.mBaseColor>>>24;var useAlpha=baseAlpha*alpha>>8;var oldUseColor=this.mState.mUseColor;this.mState.mUseColor=this.mState.mBaseColor<<8>>>8|useAlpha<<24;if(oldUseColor!=this.mState.mUseColor){this.invalidateSelf();}}},{key:'getOpacity',value:function getOpacity(){switch(this.mState.mUseColor>>>24){case 255:return graphics.PixelFormat.OPAQUE;case 0:return graphics.PixelFormat.TRANSPARENT;}return graphics.PixelFormat.TRANSLUCENT;}},{key:'getConstantState',value:function getConstantState(){return this.mState;}}]);return RoundRectDrawable;}(drawable.Drawable);drawable.RoundRectDrawable=RoundRectDrawable;var State=function(){function State(state){_classCallCheck(this,State);this.mBaseColor=0;this.mUseColor=0;this.mRadiusTopLeft=0;this.mRadiusTopRight=0;this.mRadiusBottomRight=0;this.mRadiusBottomLeft=0;if(state!=null){this.mBaseColor=state.mBaseColor;this.mUseColor=state.mUseColor;this.mRadiusTopLeft=state.mRadiusTopLeft;this.mRadiusTopRight=state.mRadiusTopRight;this.mRadiusBottomRight=state.mRadiusBottomRight;this.mRadiusBottomLeft=state.mRadiusBottomLeft;}}_createClass(State,[{key:'newDrawable',value:function newDrawable(){var c=new RoundRectDrawable(0,0,0,0,0);c.mState=new State(this);return c;}}]);return State;}();})(drawable=graphics.drawable||(graphics.drawable={}));})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var java;(function(java){var lang;(function(lang){var hashCodeGenerator=0;var JavaObject=function(){function JavaObject(){_classCallCheck(this,JavaObject);this.hash=hashCodeGenerator++;}_createClass(JavaObject,[{key:'hashCode',value:function hashCode(){return this.hash;}},{key:'getClass',value:function getClass(){return Class.getClass(this.constructor);}},{key:'equals',value:function equals(o){return this===o;}}],[{key:'class',get:function get(){return Class.getClass(this);}}]);return JavaObject;}();lang.JavaObject=JavaObject;var Class=function(){function Class(clazz){_classCallCheck(this,Class);this.clazz=clazz;}_createClass(Class,[{key:'getName',value:function getName(){return this.clazz.name;}},{key:'getSimpleName',value:function getSimpleName(){return this.clazz.name;}}],[{key:'getClass',value:function getClass(clazz){var c=Class.classCache.get(clazz);if(!c){c=new Class(clazz);Class.classCache.set(clazz,c);}return c;}}]);return Class;}();Class.classCache=new Map();lang.Class=Class;})(lang=java.lang||(java.lang={}));})(java||(java={}));var java;(function(java){var lang;(function(lang){var util;(function(util){var concurrent;(function(concurrent){var CopyOnWriteArrayList=function(){function CopyOnWriteArrayList(){_classCallCheck(this,CopyOnWriteArrayList);this.mData=[];this.isDataNew=true;}_createClass(CopyOnWriteArrayList,[{key:'iterator',value:function iterator(){this.isDataNew=false;return this.mData;}},{key:Symbol.iterator,value:function value(){this.isDataNew=false;return this.mData[Symbol.iterator]();}},{key:'checkNewData',value:function checkNewData(){if(!this.isDataNew){this.isDataNew=true;this.mData=[].concat(_toConsumableArray(this.mData));}}},{key:'size',value:function size(){return this.mData.length;}},{key:'add',value:function add(){var _mData;this.checkNewData();(_mData=this.mData).push.apply(_mData,arguments);}},{key:'addAll',value:function addAll(array){var _mData2;this.checkNewData();(_mData2=this.mData).push.apply(_mData2,_toConsumableArray(array.mData));}},{key:'remove',value:function remove(item){this.checkNewData();this.mData.splice(this.mData.indexOf(item),1);}}]);return CopyOnWriteArrayList;}();concurrent.CopyOnWriteArrayList=CopyOnWriteArrayList;})(concurrent=util.concurrent||(util.concurrent={}));})(util=lang.util||(lang.util={}));})(lang=java.lang||(java.lang={}));})(java||(java={}));var android;(function(android){var util;(function(util){var Access=function(){function Access(){_classCallCheck(this,Access);}_createClass(Access,[{key:'get',value:function get(index){return this.mData[index];}},{key:'size',value:function size(){return this.mSize;}}]);return Access;}();var CopyOnWriteArray=function(){function CopyOnWriteArray(){_classCallCheck(this,CopyOnWriteArray);this.mData=[];this.mAccess=new Access();}_createClass(CopyOnWriteArray,[{key:'getArray',value:function getArray(){if(this.mStart){if(this.mDataCopy==null)this.mDataCopy=[].concat(_toConsumableArray(this.mData));return this.mDataCopy;}return this.mData;}},{key:'start',value:function start(){if(this.mStart)throw new Error(\"Iteration already started\");this.mStart=true;this.mDataCopy=null;this.mAccess.mData=this.mData;this.mAccess.mSize=this.mData.length;return this.mAccess.mData;}},{key:'end',value:function end(){if(!this.mStart)throw new Error(\"Iteration not started\");this.mStart=false;if(this.mDataCopy!=null){this.mData=this.mDataCopy;this.mAccess.mData=[];this.mAccess.mSize=0;}this.mDataCopy=null;}},{key:'size',value:function size(){return this.getArray().length;}},{key:'add',value:function add(){var _getArray;(_getArray=this.getArray()).push.apply(_getArray,arguments);}},{key:'addAll',value:function addAll(array){var _getArray2;(_getArray2=this.getArray()).push.apply(_getArray2,_toConsumableArray(array.mData));}},{key:'remove',value:function remove(item){this.getArray().splice(this.getArray().indexOf(item),1);}}]);return CopyOnWriteArray;}();util.CopyOnWriteArray=CopyOnWriteArray;})(util=android.util||(android.util={}));})(android||(android={}));var android;(function(android){var view;(function(view){var CopyOnWriteArrayList=java.lang.util.concurrent.CopyOnWriteArrayList;var CopyOnWriteArray=android.util.CopyOnWriteArray;var ViewTreeObserver=function(){function ViewTreeObserver(){_classCallCheck(this,ViewTreeObserver);this.mAlive=true;}_createClass(ViewTreeObserver,[{key:'addOnGlobalLayoutListener',value:function addOnGlobalLayoutListener(listener){this.checkIsAlive();if(this.mOnGlobalLayoutListeners==null){this.mOnGlobalLayoutListeners=new CopyOnWriteArray();}this.mOnGlobalLayoutListeners.add(listener);}},{key:'removeGlobalOnLayoutListener',value:function removeGlobalOnLayoutListener(victim){this.removeOnGlobalLayoutListener(victim);}},{key:'removeOnGlobalLayoutListener',value:function removeOnGlobalLayoutListener(victim){this.checkIsAlive();if(this.mOnGlobalLayoutListeners==null){return;}this.mOnGlobalLayoutListeners.remove(victim);}},{key:'dispatchOnGlobalLayout',value:function dispatchOnGlobalLayout(){var listeners=this.mOnGlobalLayoutListeners;if(listeners!=null&&listeners.size()>0){var access=listeners.start();try{var count=access.length;for(var i=0;i<count;i++){access[i].onGlobalLayout();}}finally{listeners.end();}}}},{key:'addOnPreDrawListener',value:function addOnPreDrawListener(listener){this.checkIsAlive();if(this.mOnPreDrawListeners==null){this.mOnPreDrawListeners=new CopyOnWriteArray();}this.mOnPreDrawListeners.add(listener);}},{key:'removeOnPreDrawListener',value:function removeOnPreDrawListener(victim){this.checkIsAlive();if(this.mOnPreDrawListeners==null){return;}this.mOnPreDrawListeners.remove(victim);}},{key:'dispatchOnPreDraw',value:function dispatchOnPreDraw(){var cancelDraw=false;var listeners=this.mOnPreDrawListeners;if(listeners!=null&&listeners.size()>0){var access=listeners.start();try{var count=access.length;for(var i=0;i<count;i++){cancelDraw=cancelDraw||!access[i].onPreDraw();}}finally{listeners.end();}}return cancelDraw;}},{key:'addOnTouchModeChangeListener',value:function addOnTouchModeChangeListener(listener){this.checkIsAlive();if(this.mOnTouchModeChangeListeners==null){this.mOnTouchModeChangeListeners=new CopyOnWriteArrayList();}this.mOnTouchModeChangeListeners.add(listener);}},{key:'removeOnTouchModeChangeListener',value:function removeOnTouchModeChangeListener(victim){this.checkIsAlive();if(this.mOnTouchModeChangeListeners==null){return;}this.mOnTouchModeChangeListeners.remove(victim);}},{key:'dispatchOnTouchModeChanged',value:function dispatchOnTouchModeChanged(inTouchMode){var listeners=this.mOnTouchModeChangeListeners;if(listeners!=null&&listeners.size()>0){var _iteratorNormalCompletion3=true;var _didIteratorError3=false;var _iteratorError3=undefined;try{for(var _iterator3=listeners[Symbol.iterator](),_step3;!(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done);_iteratorNormalCompletion3=true){var listener=_step3.value;listener.onTouchModeChanged(inTouchMode);}}catch(err){_didIteratorError3=true;_iteratorError3=err;}finally{try{if(!_iteratorNormalCompletion3&&_iterator3.return){_iterator3.return();}}finally{if(_didIteratorError3){throw _iteratorError3;}}}}}},{key:'addOnScrollChangedListener',value:function addOnScrollChangedListener(listener){this.checkIsAlive();if(this.mOnScrollChangedListeners==null){this.mOnScrollChangedListeners=new CopyOnWriteArray();}this.mOnScrollChangedListeners.add(listener);}},{key:'removeOnScrollChangedListener',value:function removeOnScrollChangedListener(victim){this.checkIsAlive();if(this.mOnScrollChangedListeners==null){return;}this.mOnScrollChangedListeners.remove(victim);}},{key:'dispatchOnScrollChanged',value:function dispatchOnScrollChanged(){var listeners=this.mOnScrollChangedListeners;if(listeners!=null&&listeners.size()>0){var access=listeners.start();try{var count=access.length;for(var i=0;i<count;i++){access[i].onScrollChanged();}}finally{listeners.end();}}}},{key:'addOnDrawListener',value:function addOnDrawListener(listener){this.checkIsAlive();if(this.mOnDrawListeners==null){this.mOnDrawListeners=new CopyOnWriteArrayList();}this.mOnDrawListeners.add(listener);}},{key:'removeOnDrawListener',value:function removeOnDrawListener(victim){this.checkIsAlive();if(this.mOnDrawListeners==null){return;}this.mOnDrawListeners.remove(victim);}},{key:'dispatchOnDraw',value:function dispatchOnDraw(){if(this.mOnDrawListeners!=null){var _iteratorNormalCompletion4=true;var _didIteratorError4=false;var _iteratorError4=undefined;try{for(var _iterator4=this.mOnDrawListeners[Symbol.iterator](),_step4;!(_iteratorNormalCompletion4=(_step4=_iterator4.next()).done);_iteratorNormalCompletion4=true){var listener=_step4.value;listener.onDraw();}}catch(err){_didIteratorError4=true;_iteratorError4=err;}finally{try{if(!_iteratorNormalCompletion4&&_iterator4.return){_iterator4.return();}}finally{if(_didIteratorError4){throw _iteratorError4;}}}}}},{key:'merge',value:function merge(observer){if(observer.mOnGlobalLayoutListeners!=null){if(this.mOnGlobalLayoutListeners!=null){this.mOnGlobalLayoutListeners.addAll(observer.mOnGlobalLayoutListeners);}else{this.mOnGlobalLayoutListeners=observer.mOnGlobalLayoutListeners;}}if(observer.mOnPreDrawListeners!=null){if(this.mOnPreDrawListeners!=null){this.mOnPreDrawListeners.addAll(observer.mOnPreDrawListeners);}else{this.mOnPreDrawListeners=observer.mOnPreDrawListeners;}}if(observer.mOnScrollChangedListeners!=null){if(this.mOnScrollChangedListeners!=null){this.mOnScrollChangedListeners.addAll(observer.mOnScrollChangedListeners);}else{this.mOnScrollChangedListeners=observer.mOnScrollChangedListeners;}}observer.kill();}},{key:'checkIsAlive',value:function checkIsAlive(){if(!this.mAlive){throw new Error(\"This ViewTreeObserver is not alive, call \"+\"getViewTreeObserver() again\");}}},{key:'isAlive',value:function isAlive(){return this.mAlive;}},{key:'kill',value:function kill(){this.mAlive=false;}}]);return ViewTreeObserver;}();view.ViewTreeObserver=ViewTreeObserver;})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var util;(function(util){var DisplayMetrics=function DisplayMetrics(){_classCallCheck(this,DisplayMetrics);};DisplayMetrics.DENSITY_LOW=120;DisplayMetrics.DENSITY_MEDIUM=160;DisplayMetrics.DENSITY_HIGH=240;DisplayMetrics.DENSITY_XHIGH=320;DisplayMetrics.DENSITY_XXHIGH=480;DisplayMetrics.DENSITY_XXXHIGH=640;DisplayMetrics.DENSITY_DEFAULT=DisplayMetrics.DENSITY_MEDIUM;util.DisplayMetrics=DisplayMetrics;})(util=android.util||(android.util={}));})(android||(android={}));var android;(function(android){var content;(function(content){var Bundle=android.os.Bundle;var Intent=function(){function Intent(activityName){_classCallCheck(this,Intent);this.mRequestCode=-1;this.mFlags=0;this.activityName=activityName;}_createClass(Intent,[{key:'getBooleanExtra',value:function getBooleanExtra(name,defaultValue){return this.mExtras==null?defaultValue:this.mExtras.get(name,defaultValue);}},{key:'getIntExtra',value:function getIntExtra(name,defaultValue){return this.mExtras==null?defaultValue:this.mExtras.get(name,defaultValue);}},{key:'getLongExtra',value:function getLongExtra(name,defaultValue){return this.mExtras==null?defaultValue:this.mExtras.get(name,defaultValue);}},{key:'getFloatExtra',value:function getFloatExtra(name,defaultValue){return this.mExtras==null?defaultValue:this.mExtras.get(name,defaultValue);}},{key:'getDoubleExtra',value:function getDoubleExtra(name,defaultValue){return this.mExtras==null?defaultValue:this.mExtras.get(name,defaultValue);}},{key:'getStringExtra',value:function getStringExtra(name,defaultValue){return this.mExtras==null?defaultValue:this.mExtras.get(name,defaultValue);}},{key:'getStringArrayExtra',value:function getStringArrayExtra(name,defaultValue){return this.mExtras==null?defaultValue:this.mExtras.get(name,defaultValue);}},{key:'getIntegerArrayExtra',value:function getIntegerArrayExtra(name,defaultValue){return this.mExtras==null?defaultValue:this.mExtras.get(name,defaultValue);}},{key:'getLongArrayExtra',value:function getLongArrayExtra(name,defaultValue){return this.mExtras==null?defaultValue:this.mExtras.get(name,defaultValue);}},{key:'getFloatArrayExtra',value:function getFloatArrayExtra(name,defaultValue){return this.mExtras==null?defaultValue:this.mExtras.get(name,defaultValue);}},{key:'getDoubleArrayExtra',value:function getDoubleArrayExtra(name,defaultValue){return this.mExtras==null?defaultValue:this.mExtras.get(name,defaultValue);}},{key:'getBooleanArrayExtra',value:function getBooleanArrayExtra(name,defaultValue){return this.mExtras==null?defaultValue:this.mExtras.get(name,defaultValue);}},{key:'hasExtra',value:function hasExtra(name){return this.mExtras!=null&&this.mExtras.containsKey(name);}},{key:'putExtra',value:function putExtra(name,value){if(this.mExtras==null){this.mExtras=new Bundle();}this.mExtras.put(name,value);return this;}},{key:'getExtras',value:function getExtras(){return this.mExtras!=null?new Bundle(this.mExtras):null;}},{key:'getFlags',value:function getFlags(){return this.mFlags;}},{key:'setFlags',value:function setFlags(flags){this.mFlags=flags;return this;}},{key:'addFlags',value:function addFlags(flags){this.mFlags|=flags;return this;}}]);return Intent;}();Intent.FLAG_ACTIVITY_CLEAR_TOP=0x04000000;content.Intent=Intent;})(content=android.content||(android.content={}));})(android||(android={}));var androidui;(function(androidui){var util;(function(util){var ClassFinder=function(){function ClassFinder(){_classCallCheck(this,ClassFinder);}_createClass(ClassFinder,null,[{key:'findClass',value:function findClass(classFullName){var findInRoot=arguments.length>1&&arguments[1]!==undefined?arguments[1]:window;var nameParts=classFullName.split('.');var finding=findInRoot;var _iteratorNormalCompletion5=true;var _didIteratorError5=false;var _iteratorError5=undefined;try{for(var _iterator5=nameParts[Symbol.iterator](),_step5;!(_iteratorNormalCompletion5=(_step5=_iterator5.next()).done);_iteratorNormalCompletion5=true){var part=_step5.value;var quickFind=finding[part.toLowerCase()];if(quickFind){finding=quickFind;continue;}var found=false;for(var key in finding){if(key.toUpperCase()===part.toUpperCase()){finding=finding[key];found=true;break;}}if(!found)return null;}}catch(err){_didIteratorError5=true;_iteratorError5=err;}finally{try{if(!_iteratorNormalCompletion5&&_iterator5.return){_iterator5.return();}}finally{if(_didIteratorError5){throw _iteratorError5;}}}if(finding===findInRoot){return null;}return finding;}},{key:'findViewClass',value:function findViewClass(className){var rootViewClass=ClassFinder._findViewClassCache[className];if(!rootViewClass)rootViewClass=ClassFinder.findClass(className,android.view);if(!rootViewClass)rootViewClass=ClassFinder.findClass(className,android['widget']);if(!rootViewClass)rootViewClass=ClassFinder.findClass(className,androidui['widget']);if(!rootViewClass)rootViewClass=ClassFinder.findClass(className);if(!rootViewClass){if(document.createElement(className)instanceof HTMLUnknownElement){console.warn('inflate: not find class '+className);}return null;}ClassFinder._findViewClassCache[className]=rootViewClass;return rootViewClass;}}]);return ClassFinder;}();ClassFinder._findViewClassCache={};util.ClassFinder=ClassFinder;})(util=androidui.util||(androidui.util={}));})(androidui||(androidui={}));var android;(function(android){var view;(function(view){var ClassFinder=androidui.util.ClassFinder;var LayoutInflater=function(){function LayoutInflater(context){_classCallCheck(this,LayoutInflater);this.mContext=context;}_createClass(LayoutInflater,[{key:'getContext',value:function getContext(){return this.mContext;}},{key:'inflate',value:function inflate(layout,viewParent){var _this13=this;var attachToRoot=arguments.length>2&&arguments[2]!==undefined?arguments[2]:viewParent!=null;var domtree=layout instanceof HTMLElement?layout:this.mContext.getResources().getLayout(layout);if(!domtree){console.error('not find layout: '+layout);return null;}var className=domtree.tagName;if(className.startsWith('ANDROID-')){className=className.substring('ANDROID-'.length);}if(className==='LAYOUT'){domtree=domtree.firstElementChild;}if(className==='INCLUDE'){var refLayoutId=domtree.getAttribute('layout');if(!refLayoutId)return null;var refEle=this.mContext.getResources().getLayout(refLayoutId);var _iteratorNormalCompletion6=true;var _didIteratorError6=false;var _iteratorError6=undefined;try{for(var _iterator6=Array.from(domtree.attributes)[Symbol.iterator](),_step6;!(_iteratorNormalCompletion6=(_step6=_iterator6.next()).done);_iteratorNormalCompletion6=true){var attr=_step6.value;var name=attr.name;if(name==='layout')continue;refEle.setAttribute(name,attr.value);}}catch(err){_didIteratorError6=true;_iteratorError6=err;}finally{try{if(!_iteratorNormalCompletion6&&_iterator6.return){_iterator6.return();}}finally{if(_didIteratorError6){throw _iteratorError6;}}}return this.inflate(refEle,viewParent);}else if(className==='MERGE'){if(!viewParent)throw Error('merge tag need ViewParent');Array.from(domtree.children).forEach(function(item){if(item instanceof HTMLElement){_this13.inflate(item,viewParent);}});return viewParent;}else if(className==='VIEW'){var overrideClass=domtree.className||domtree.getAttribute('android:class');if(overrideClass)className=overrideClass;}var rootViewClass=ClassFinder.findViewClass(className);if(!rootViewClass){return null;}var children=Array.from(domtree.children);var defStyle=void 0;var styleAttrValue=domtree.getAttribute('style');if(styleAttrValue){defStyle=this.mContext.getResources().getDefStyle(styleAttrValue);}var rootView=void 0;if(defStyle)rootView=new rootViewClass(this.mContext,domtree,defStyle);else rootView=new rootViewClass(this.mContext,domtree);if(rootView['onInflateAdapter']){rootView.onInflateAdapter(domtree,this.mContext,viewParent);domtree.parentNode.removeChild(domtree);}if(!(rootView instanceof view.View)){return rootView;}var params=void 0;if(viewParent){params=viewParent.generateLayoutParamsFromAttr(domtree);rootView.setLayoutParams(params);}if(rootView instanceof view.ViewGroup){(function(){var parent=rootView;children.forEach(function(item){if(item instanceof HTMLElement){_this13.inflate(item,parent);}});})();}rootView.onFinishInflate();if(attachToRoot&&viewParent){if(params){viewParent.addView(rootView,params);}else{viewParent.addView(rootView);}}return rootView;}}],[{key:'from',value:function from(context){return context.getLayoutInflater();}}]);return LayoutInflater;}();view.LayoutInflater=LayoutInflater;})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var content;(function(content){var LayoutInflater=android.view.LayoutInflater;var Context=function(){function Context(androidUI){_classCallCheck(this,Context);this.androidUI=androidUI;this.mLayoutInflater=new LayoutInflater(this);this.mResources=new android.content.res.Resources(this);}_createClass(Context,[{key:'getApplicationContext',value:function getApplicationContext(){return this.androidUI.mApplication;}},{key:'getResources',value:function getResources(){return this.mResources;}},{key:'getLayoutInflater',value:function getLayoutInflater(){return this.mLayoutInflater;}},{key:'obtainStyledAttributes',value:function obtainStyledAttributes(attrs,defStyleAttr){return content.res.TypedArray.obtain(this.mResources,attrs,defStyleAttr);}}]);return Context;}();content.Context=Context;})(content=android.content||(android.content={}));})(android||(android={}));var android;(function(android){var R;(function(R){var _layout_data={\"action_bar\":\"<merge>\\n    <linearlayout android:layout_height=\\\"wrap_content\\\" android:layout_width=\\\"match_parent\\\" android:layout_marginLeft=\\\"60dp\\\" android:layout_marginRight=\\\"60dp\\\" android:minHeight=\\\"48dp\\\" android:gravity=\\\"center\\\" android:orientation=\\\"vertical\\\" id=\\\"action_bar_center_layout\\\">\\n        <textview android:gravity=\\\"center\\\" android:drawablePadding=\\\"4dp\\\" android:singleLine=\\\"true\\\" android:ellipsize=\\\"end\\\" android:textColor=\\\"@android:color/white\\\" android:textSize=\\\"18sp\\\" id=\\\"action_bar_title\\\"></textview>\\n        <textview android:visibility=\\\"gone\\\" android:gravity=\\\"center\\\" android:layout_marginTop=\\\"4dp\\\" android:drawablePadding=\\\"4dp\\\" android:singleLine=\\\"true\\\" android:ellipsize=\\\"end\\\" android:textColor=\\\"@android:color/white\\\" android:textSize=\\\"12sp\\\" id=\\\"action_bar_sub_title\\\"></textview>\\n    </linearlayout>\\n    <button android:visibility=\\\"gone\\\" android:layout_gravity=\\\"left|center_vertical\\\" android:layout_width=\\\"wrap_content\\\" android:background=\\\"@android:drawable/item_background\\\" android:textColor=\\\"@android:color/white\\\" android:paddingLeft=\\\"6dp\\\" android:paddingRight=\\\"6dp\\\" android:drawablePadding=\\\"4dp\\\" android:minWidth=\\\"32dp\\\" android:textSize=\\\"17sp\\\" android:singleLine=\\\"true\\\" id=\\\"action_bar_left\\\"></button>\\n    <button android:visibility=\\\"gone\\\" android:layout_gravity=\\\"right|center_vertical\\\" android:layout_width=\\\"wrap_content\\\" android:background=\\\"@android:drawable/item_background\\\" android:textColor=\\\"@android:color/white\\\" android:paddingRight=\\\"6dp\\\" android:paddingLeft=\\\"6dp\\\" android:drawablePadding=\\\"4dp\\\" android:minWidth=\\\"32dp\\\" android:textSize=\\\"17sp\\\" android:singleLine=\\\"true\\\" id=\\\"action_bar_right\\\"></button>\\n</merge>\",\"alert_dialog\":\"<linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:layout_marginStart=\\\"8dip\\\" android:layout_marginEnd=\\\"8dip\\\" android:orientation=\\\"vertical\\\" id=\\\"parentPanel\\\">\\n\\n    <linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:orientation=\\\"vertical\\\" id=\\\"topPanel\\\">\\n        <view android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"1dip\\\" android:visibility=\\\"gone\\\" android:background=\\\"#aaa\\\" id=\\\"titleDividerTop\\\"></view>\\n        <linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:orientation=\\\"horizontal\\\" android:gravity=\\\"center_vertical|start\\\" android:minHeight=\\\"64dp\\\" android:layout_marginStart=\\\"16dip\\\" android:layout_marginEnd=\\\"16dip\\\" id=\\\"title_template\\\">\\n            <imageview android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:paddingEnd=\\\"8dip\\\" id=\\\"icon\\\"></imageview>\\n            <textview android:maxLines=\\\"1\\\" android:scrollHorizontally=\\\"true\\\" android:textSize=\\\"22sp\\\" android:textColor=\\\"#333\\\" android:singleLine=\\\"true\\\" android:ellipsize=\\\"end\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:textAlignment=\\\"viewStart\\\" id=\\\"alertTitle\\\"></textview>\\n        </linearlayout>\\n        <view android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"1dip\\\" android:visibility=\\\"gone\\\" android:background=\\\"#aaa\\\" id=\\\"titleDivider\\\"></view>\\n        <!-- If the client uses a customTitle, it will be added here. -->\\n    </linearlayout>\\n\\n    <linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:layout_weight=\\\"1\\\" android:orientation=\\\"vertical\\\" android:minHeight=\\\"64dp\\\" id=\\\"contentPanel\\\">\\n        <scrollview android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:clipToPadding=\\\"false\\\" id=\\\"scrollView\\\">\\n            <textview android:textSize=\\\"18sp\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:paddingStart=\\\"16dip\\\" android:paddingEnd=\\\"16dip\\\" android:paddingTop=\\\"8dip\\\" android:paddingBottom=\\\"8dip\\\" id=\\\"message\\\"></textview>\\n        </scrollview>\\n    </linearlayout>\\n\\n    <framelayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:layout_weight=\\\"1\\\" android:minHeight=\\\"64dp\\\" id=\\\"customPanel\\\">\\n        <framelayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" id=\\\"custom\\\"></framelayout>\\n    </framelayout>\\n\\n    <linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:minHeight=\\\"48dip\\\" android:orientation=\\\"vertical\\\" android:divider=\\\"@android:drawable/divider_horizontal\\\" android:showDividers=\\\"beginning\\\" android:dividerPadding=\\\"0dip\\\" id=\\\"buttonPanel\\\">\\n        <linearlayout android:divider=\\\"@android:drawable/divider_vertical\\\" android:showDividers=\\\"middle\\\" android:dividerPadding=\\\"0dp\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:orientation=\\\"horizontal\\\" android:layoutDirection=\\\"locale\\\" android:measureWithLargestChild=\\\"true\\\">\\n            <button android:layout_width=\\\"wrap_content\\\" android:layout_gravity=\\\"start\\\" android:layout_weight=\\\"1\\\" android:maxLines=\\\"2\\\" android:paddingStart=\\\"4dp\\\" android:paddingEnd=\\\"4dp\\\" android:background=\\\"@android:drawable/item_background\\\" android:textSize=\\\"14sp\\\" android:minHeight=\\\"48dp\\\" android:layout_height=\\\"wrap_content\\\" id=\\\"button2\\\"></button>\\n            <button android:layout_width=\\\"wrap_content\\\" android:layout_gravity=\\\"center_horizontal\\\" android:layout_weight=\\\"1\\\" android:maxLines=\\\"2\\\" android:paddingStart=\\\"4dp\\\" android:paddingEnd=\\\"4dp\\\" android:background=\\\"@android:drawable/item_background\\\" android:textSize=\\\"14sp\\\" android:minHeight=\\\"48dp\\\" android:layout_height=\\\"wrap_content\\\" id=\\\"button3\\\"></button>\\n            <button android:layout_width=\\\"wrap_content\\\" android:layout_gravity=\\\"end\\\" android:layout_weight=\\\"1\\\" android:maxLines=\\\"2\\\" android:paddingStart=\\\"4dp\\\" android:paddingEnd=\\\"4dp\\\" android:background=\\\"@android:drawable/item_background\\\" android:textSize=\\\"14sp\\\" android:minHeight=\\\"48dp\\\" android:layout_height=\\\"wrap_content\\\" id=\\\"button1\\\"></button>\\n        </linearlayout>\\n     </linearlayout>\\n</linearlayout>\",\"alert_dialog_progress\":\"<relativelayout android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"match_parent\\\">\\n    <progressbar style=\\\"@android:attr/progressBarStyleHorizontal\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:layout_marginTop=\\\"16dip\\\" android:layout_marginBottom=\\\"1dip\\\" android:layout_marginStart=\\\"16dip\\\" android:layout_marginEnd=\\\"16dip\\\" android:layout_centerHorizontal=\\\"true\\\" id=\\\"progress\\\"></progressbar>\\n    <textview android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:paddingBottom=\\\"16dip\\\" android:layout_marginStart=\\\"16dip\\\" android:layout_marginEnd=\\\"16dip\\\" android:layout_alignParentStart=\\\"true\\\" android:layout_below=\\\"progress\\\" id=\\\"progress_percent\\\"></textview>\\n    <textview android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:paddingBottom=\\\"16dip\\\" android:layout_marginStart=\\\"16dip\\\" android:layout_marginEnd=\\\"16dip\\\" android:layout_alignParentEnd=\\\"true\\\" android:layout_below=\\\"progress\\\" id=\\\"progress_number\\\"></textview>\\n</relativelayout>\",\"popup_menu_item_layout\":\"<linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"48dp\\\" android:minWidth=\\\"196dip\\\" android:paddingEnd=\\\"16dip\\\">\\n\\n    <imageview android:visibility=\\\"gone\\\" android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:layout_gravity=\\\"center_vertical\\\" android:layout_marginStart=\\\"8dip\\\" android:layout_marginEnd=\\\"-8dip\\\" android:layout_marginTop=\\\"8dip\\\" android:layout_marginBottom=\\\"8dip\\\" android:scaleType=\\\"centerInside\\\" android:duplicateParentState=\\\"true\\\" id=\\\"icon\\\"></imageview>\\n    \\n    <!-- The title and summary have some gap between them, and this 'group' should be centered vertically. -->\\n    <relativelayout android:layout_width=\\\"0dip\\\" android:layout_weight=\\\"1\\\" android:layout_height=\\\"wrap_content\\\" android:layout_gravity=\\\"center_vertical\\\" android:layout_marginStart=\\\"16dip\\\" android:duplicateParentState=\\\"true\\\">\\n\\n        <textview android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:layout_alignParentTop=\\\"true\\\" android:layout_alignParentStart=\\\"true\\\" android:textColor=\\\"@android:color/primary_text_dark_disable_only\\\" android:textSize=\\\"18sp\\\" android:singleLine=\\\"true\\\" android:duplicateParentState=\\\"true\\\" android:ellipsize=\\\"marquee\\\" android:fadingEdge=\\\"horizontal\\\" android:textAlignment=\\\"viewStart\\\" id=\\\"title\\\"></textview>\\n\\n        <textview android:visibility=\\\"gone\\\" android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:layout_below=\\\"title\\\" android:layout_alignParentStart=\\\"true\\\" android:textColor=\\\"@android:color/primary_text_dark_disable_only\\\" android:textSize=\\\"12sp\\\" android:singleLine=\\\"true\\\" android:duplicateParentState=\\\"true\\\" android:textAlignment=\\\"viewStart\\\" id=\\\"shortcut\\\"></textview>\\n\\n    </relativelayout>\\n\\n    <!-- Checkbox, and/or radio button will be inserted here. -->\\n    \\n</linearlayout>\",\"select_dialog\":\"<view class=\\\"android.app.AlertController.RecycleListView\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"match_parent\\\" android:cacheColorHint=\\\"@null\\\" android:divider=\\\"@android:drawable/list_divider\\\" android:scrollbars=\\\"vertical\\\" android:overScrollMode=\\\"ifContentScrolls\\\" android:textAlignment=\\\"viewStart\\\" id=\\\"select_dialog_listview\\\"></view>\",\"select_dialog_item\":\"<textview android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:minHeight=\\\"48dp\\\" android:textSize=\\\"18sp\\\" android:gravity=\\\"center_vertical\\\" android:paddingStart=\\\"16dip\\\" android:paddingEnd=\\\"16dip\\\" android:ellipsize=\\\"end\\\" id=\\\"text1\\\"></textview>\",\"select_dialog_multichoice\":\"<checkedtextview android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:minHeight=\\\"48dp\\\" android:textSize=\\\"18sp\\\" android:gravity=\\\"center_vertical\\\" android:paddingStart=\\\"16dip\\\" android:paddingEnd=\\\"16dip\\\" android:checkMark=\\\"@android:drawable/btn_check\\\" android:ellipsize=\\\"end\\\" id=\\\"text1\\\"></checkedtextview>\",\"select_dialog_singlechoice\":\"<checkedtextview android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:minHeight=\\\"48dp\\\" android:textSize=\\\"18sp\\\" android:gravity=\\\"center_vertical\\\" android:paddingStart=\\\"16dip\\\" android:paddingEnd=\\\"16dip\\\" android:checkMark=\\\"@android:drawable/btn_radio\\\" android:ellipsize=\\\"end\\\" id=\\\"text1\\\"></checkedtextview>\",\"simple_spinner_dropdown_item\":\"<checkedtextview android:paddingStart=\\\"8dp\\\" android:paddingEnd=\\\"8dp\\\" android:textColor=\\\"@android:color/primary_text_light_disable_only\\\" android:gravity=\\\"center_vertical\\\" android:singleLine=\\\"true\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"48dp\\\" android:ellipsize=\\\"end\\\" android:textAlignment=\\\"inherit\\\" id=\\\"text1\\\"></checkedtextview>\",\"simple_spinner_item\":\"<textview android:paddingStart=\\\"8dp\\\" android:paddingEnd=\\\"8dp\\\" android:textColor=\\\"@android:color/primary_text_light_disable_only\\\" android:gravity=\\\"center_vertical\\\" android:singleLine=\\\"true\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:ellipsize=\\\"end\\\" android:textAlignment=\\\"inherit\\\" id=\\\"text1\\\"></textview>\",\"transient_notification\":\"<linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"match_parent\\\" android:orientation=\\\"vertical\\\" android:background=\\\"@android:drawable/toast_frame\\\">\\n\\n    <textview android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:layout_weight=\\\"1\\\" android:layout_gravity=\\\"center_horizontal\\\" android:textColor=\\\"white\\\" android:shadowColor=\\\"#BB000000\\\" android:shadowRadius=\\\"2.75\\\" id=\\\"message\\\"></textview>\\n\\n</linearlayout>\"};var _tempDiv=document.createElement('div');var layout=function(){function layout(){_classCallCheck(this,layout);}_createClass(layout,null,[{key:'getLayoutData',value:function getLayoutData(layoutName){if(!layoutName)return null;if(!_layout_data[layoutName])return null;_tempDiv.innerHTML=_layout_data[layoutName];var data=_tempDiv.firstElementChild;_tempDiv.removeChild(data);return data;}}]);return layout;}();layout.action_bar='@android:layout/action_bar';layout.alert_dialog='@android:layout/alert_dialog';layout.alert_dialog_progress='@android:layout/alert_dialog_progress';layout.popup_menu_item_layout='@android:layout/popup_menu_item_layout';layout.select_dialog='@android:layout/select_dialog';layout.select_dialog_item='@android:layout/select_dialog_item';layout.select_dialog_multichoice='@android:layout/select_dialog_multichoice';layout.select_dialog_singlechoice='@android:layout/select_dialog_singlechoice';layout.simple_spinner_dropdown_item='@android:layout/simple_spinner_dropdown_item';layout.simple_spinner_item='@android:layout/simple_spinner_item';layout.transient_notification='@android:layout/transient_notification';R.layout=layout;})(R=android.R||(android.R={}));})(android||(android={}));var androidui;(function(androidui){var attr;(function(attr){var AttrValueParser=function(){function AttrValueParser(){_classCallCheck(this,AttrValueParser);}_createClass(AttrValueParser,null,[{key:'parseString',value:function parseString(r,value){var defValue=arguments.length>2&&arguments[2]!==undefined?arguments[2]:value;if(value==null)return defValue;if(value.startsWith('@')){try{return r.getString(value);}catch(e){console.warn(e);}}return defValue;}},{key:'parseBoolean',value:function parseBoolean(r,value,defValue){if(value==null)return defValue;if(value.startsWith('@')){try{return r.getBoolean(value);}catch(e){console.warn(e);}}if(value==='false'||value==='0')return false;else if(value==='true'||value==='1'||value==='')return true;return defValue;}},{key:'parseInt',value:function(_parseInt){function parseInt(_x30,_x31,_x32){return _parseInt.apply(this,arguments);}parseInt.toString=function(){return _parseInt.toString();};return parseInt;}(function(r,value,defValue){if(value==null)return defValue;if(value.startsWith('@')){try{return r.getInteger(value);}catch(e){console.warn(e);}}var v=parseInt(value);if(isNaN(v))return defValue;return v;})},{key:'parseFloat',value:function(_parseFloat){function parseFloat(_x33,_x34,_x35){return _parseFloat.apply(this,arguments);}parseFloat.toString=function(){return _parseFloat.toString();};return parseFloat;}(function(r,value,defValue){if(value==null)return defValue;if(value.startsWith('@')){try{return r.getFloat(value);}catch(e){console.warn(e);}}var v=parseFloat(value);if(isNaN(v))return defValue;if(value.endsWith('%'))v/=100;return v;})},{key:'parseColor',value:function parseColor(r,value,defValue){if(value==null)return defValue;try{if(value.startsWith('@')){return r.getColor(value);}else{return android.graphics.Color.parseColor(value);}}catch(e){console.warn(e);}return defValue;}},{key:'parseColorStateList',value:function parseColorStateList(r,value){if(value==null)return null;if(value.startsWith('@')){return r.getColorStateList(value);}else{try{var color=android.graphics.Color.parseColor(value);return android.content.res.ColorStateList.valueOf(color);}catch(e){console.warn(e);}}return null;}},{key:'parseDimension',value:function parseDimension(r,value,defValue){var baseValue=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;if(value==null)return defValue;if(value.startsWith('@')){try{return r.getDimension(value,baseValue);}catch(e){console.warn(e);return defValue;}}try{return android.util.TypedValue.complexToDimension(value,baseValue);}catch(e){console.warn(e);}return defValue;}},{key:'parseDimensionPixelOffset',value:function parseDimensionPixelOffset(r,value,defValue){var baseValue=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;if(value==null)return defValue;if(value.startsWith('@')){try{return r.getDimensionPixelOffset(value,baseValue);}catch(e){console.warn(e);return defValue;}}try{return android.util.TypedValue.complexToDimensionPixelOffset(value,baseValue);}catch(e){console.warn(e);}return defValue;}},{key:'parseDimensionPixelSize',value:function parseDimensionPixelSize(r,value,defValue){var baseValue=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;if(value==null)return defValue;if(value.startsWith('@')){try{return r.getDimensionPixelSize(value);}catch(e){console.warn(e);return defValue;}}try{return android.util.TypedValue.complexToDimensionPixelSize(value,baseValue);}catch(e){console.warn(e);}return defValue;}},{key:'parseDrawable',value:function parseDrawable(r,value){if(value==null)return null;if(value.startsWith('@')){try{return r.getDrawable(value);}catch(e){console.warn(e);}}else if(value.startsWith('url(')){value=value.substring('url('.length);if(value.endsWith(')'))value=value.substring(0,value.length-1);return new androidui.image.NetDrawable(value);}else{try{var color=android.graphics.Color.parseColor(value);return new android.graphics.drawable.ColorDrawable(color);}catch(e){}}return null;}},{key:'parseTextArray',value:function parseTextArray(r,value){if(value==null)return null;if(value.startsWith('@')){return r.getStringArray(value);}else{try{var json=JSON.parse(value);if(json instanceof Array)return json;}catch(e){}}return null;}}]);return AttrValueParser;}();attr.AttrValueParser=AttrValueParser;})(attr=androidui.attr||(androidui.attr={}));})(androidui||(androidui={}));var android;(function(android){var content;(function(content){var res;(function(res_1){var AttrValueParser=androidui.attr.AttrValueParser;var TypedArray=function(){function TypedArray(res,attrMap){_classCallCheck(this,TypedArray);this.mResources=res;this.attrMap=attrMap;}_createClass(TypedArray,[{key:'checkRecycled',value:function checkRecycled(){if(this.mRecycled){throw new Error(\"RuntimeException : Cannot make calls to a recycled instance!\");}}},{key:'length',value:function length(){this.checkRecycled();if(!this.attrMap)return 0;return this.attrMap.size;}},{key:'getIndex',value:function getIndex(keyIndex){if(!this.attrMapKeysCache){this.attrMapKeysCache=Array.from(this.attrMap.keys());}return this.attrMapKeysCache[keyIndex];}},{key:'getLowerCaseNoNamespaceAttrNames',value:function getLowerCaseNoNamespaceAttrNames(){var keys=[];var _iteratorNormalCompletion7=true;var _didIteratorError7=false;var _iteratorError7=undefined;try{for(var _iterator7=this.attrMap.keys()[Symbol.iterator](),_step7;!(_iteratorNormalCompletion7=(_step7=_iterator7.next()).done);_iteratorNormalCompletion7=true){var key=_step7.value;keys.push(key.split(':').pop());}}catch(err){_didIteratorError7=true;_iteratorError7=err;}finally{try{if(!_iteratorNormalCompletion7&&_iterator7.return){_iterator7.return();}}finally{if(_didIteratorError7){throw _iteratorError7;}}}return keys;}},{key:'getResources',value:function getResources(){return this.mResources;}},{key:'getAttrValue',value:function getAttrValue(attrName){var name=attrName.toLowerCase();return this.attrMap&&(this.attrMap.get(name)||this.attrMap.get('android:'+name));}},{key:'getResourceId',value:function getResourceId(attrName,defaultResourceId){if(this.hasValueOrEmpty(attrName)){return this.getAttrValue(attrName);}return defaultResourceId;}},{key:'getText',value:function getText(attrName){return this.getString(attrName);}},{key:'getString',value:function getString(attrName){this.checkRecycled();var value=this.getAttrValue(attrName);return AttrValueParser.parseString(this.mResources,value,value);}},{key:'getBoolean',value:function getBoolean(attrName,defValue){this.checkRecycled();var value=this.getAttrValue(attrName);return AttrValueParser.parseBoolean(this.mResources,value,defValue);}},{key:'getInt',value:function getInt(attrName,defValue){this.checkRecycled();var value=this.getAttrValue(attrName);return AttrValueParser.parseInt(this.mResources,value,defValue);}},{key:'getFloat',value:function getFloat(attrName,defValue){this.checkRecycled();var value=this.getAttrValue(attrName);return AttrValueParser.parseFloat(this.mResources,value,defValue);}},{key:'getColor',value:function getColor(attrName,defValue){this.checkRecycled();var value=this.getAttrValue(attrName);return AttrValueParser.parseColor(this.mResources,value,defValue);}},{key:'getColorStateList',value:function getColorStateList(attrName){this.checkRecycled();var value=this.getAttrValue(attrName);return AttrValueParser.parseColorStateList(this.mResources,value);}},{key:'getInteger',value:function getInteger(attrName,defValue){return this.getInt(attrName,defValue);}},{key:'getLayoutDimension',value:function getLayoutDimension(attrName,defValue){this.checkRecycled();var value=this.getAttrValue(attrName);if(value==='wrap_content')return-2;if(value==='fill_parent'||value==='match_parent')return-1;return AttrValueParser.parseDimension(this.mResources,value,defValue);}},{key:'getDimension',value:function getDimension(attrName,defValue){this.checkRecycled();var value=this.getAttrValue(attrName);return AttrValueParser.parseDimension(this.mResources,value,defValue);}},{key:'getDimensionPixelOffset',value:function getDimensionPixelOffset(attrName,defValue){this.checkRecycled();var value=this.getAttrValue(attrName);return AttrValueParser.parseDimensionPixelOffset(this.mResources,value,defValue);}},{key:'getDimensionPixelSize',value:function getDimensionPixelSize(attrName,defValue){this.checkRecycled();var value=this.getAttrValue(attrName);return AttrValueParser.parseDimensionPixelSize(this.mResources,value,defValue);}},{key:'getDrawable',value:function getDrawable(attrName){this.checkRecycled();var value=this.getAttrValue(attrName);return AttrValueParser.parseDrawable(this.mResources,value);}},{key:'getTextArray',value:function getTextArray(attrName){this.checkRecycled();var value=this.getAttrValue(attrName);return AttrValueParser.parseTextArray(this.mResources,value);}},{key:'hasValue',value:function hasValue(attrName){this.checkRecycled();return this.getAttrValue(attrName)!=null;}},{key:'hasValueOrEmpty',value:function hasValueOrEmpty(attrName){this.checkRecycled();var name=attrName.toLowerCase();return this.attrMap&&(this.attrMap.has(name)||this.attrMap.has('android:'+name));}},{key:'recycle',value:function recycle(){this.mRecycled=true;this.attrMap=null;this.attrMapKeysCache=null;this.mResources.mTypedArrayPool.release(this);}}],[{key:'obtain',value:function obtain(res,xml,defStyleAttr){var attrMap=new Map();if(defStyleAttr){var _iteratorNormalCompletion8=true;var _didIteratorError8=false;var _iteratorError8=undefined;try{for(var _iterator8=defStyleAttr.entries()[Symbol.iterator](),_step8;!(_iteratorNormalCompletion8=(_step8=_iterator8.next()).done);_iteratorNormalCompletion8=true){var _step8$value=_slicedToArray(_step8.value,2),key=_step8$value[0],value=_step8$value[1];attrMap.set(key.toLowerCase(),value);}}catch(err){_didIteratorError8=true;_iteratorError8=err;}finally{try{if(!_iteratorNormalCompletion8&&_iterator8.return){_iterator8.return();}}finally{if(_didIteratorError8){throw _iteratorError8;}}}}if(xml){var refStyleString=xml.getAttribute('android:style');if(refStyleString){var map=res.getStyleAsMap(refStyleString);if(map){var _iteratorNormalCompletion9=true;var _didIteratorError9=false;var _iteratorError9=undefined;try{for(var _iterator9=map.entries()[Symbol.iterator](),_step9;!(_iteratorNormalCompletion9=(_step9=_iterator9.next()).done);_iteratorNormalCompletion9=true){var _step9$value=_slicedToArray(_step9.value,2),key=_step9$value[0],value=_step9$value[1];attrMap.set(key.toLowerCase(),value);}}catch(err){_didIteratorError9=true;_iteratorError9=err;}finally{try{if(!_iteratorNormalCompletion9&&_iterator9.return){_iterator9.return();}}finally{if(_didIteratorError9){throw _iteratorError9;}}}}}var _iteratorNormalCompletion10=true;var _didIteratorError10=false;var _iteratorError10=undefined;try{for(var _iterator10=Array.from(xml.attributes)[Symbol.iterator](),_step10;!(_iteratorNormalCompletion10=(_step10=_iterator10.next()).done);_iteratorNormalCompletion10=true){var attr=_step10.value;var name=attr.name;if(name==='android:style'||name==='style')continue;attrMap.set(name,attr.value);}}catch(err){_didIteratorError10=true;_iteratorError10=err;}finally{try{if(!_iteratorNormalCompletion10&&_iterator10.return){_iterator10.return();}}finally{if(_didIteratorError10){throw _iteratorError10;}}}}var attrs=res.mTypedArrayPool.acquire();if(attrs!=null){attrs.mRecycled=false;attrs.attrMap=attrMap;attrs.attrMapKeysCache=[];return attrs;}return new TypedArray(res,attrMap);}}]);return TypedArray;}();res_1.TypedArray=TypedArray;})(res=content.res||(content.res={}));})(content=android.content||(android.content={}));})(android||(android={}));var android;(function(android){var content;(function(content){var res;(function(res){var DisplayMetrics=android.util.DisplayMetrics;var Drawable=android.graphics.drawable.Drawable;var Color=android.graphics.Color;var SynchronizedPool=android.util.Pools.SynchronizedPool;var ColorDrawable=android.graphics.drawable.ColorDrawable;var Resources=function(){function Resources(context){var _this14=this;_classCallCheck(this,Resources);this.mTypedArrayPool=new SynchronizedPool(5);this.context=context;window.addEventListener('resize',function(){if(_this14.displayMetrics){_this14.fillDisplayMetrics(_this14.displayMetrics);}});}_createClass(Resources,[{key:'getDisplayMetrics',value:function getDisplayMetrics(){if(this.displayMetrics)return this.displayMetrics;this.displayMetrics=new DisplayMetrics();this.fillDisplayMetrics(this.displayMetrics);return this.displayMetrics;}},{key:'fillDisplayMetrics',value:function fillDisplayMetrics(displayMetrics){var density=window.devicePixelRatio;displayMetrics.xdpi=window.screen.deviceXDPI||DisplayMetrics.DENSITY_DEFAULT;displayMetrics.ydpi=window.screen.deviceYDPI||DisplayMetrics.DENSITY_DEFAULT;displayMetrics.density=density;displayMetrics.densityDpi=density*DisplayMetrics.DENSITY_DEFAULT;displayMetrics.scaledDensity=density;var contentEle=this.context?this.context.androidUI.androidUIElement:document.documentElement;displayMetrics.widthPixels=contentEle.offsetWidth*density;displayMetrics.heightPixels=contentEle.offsetHeight*density;}},{key:'getDefStyle',value:function getDefStyle(refString){if(refString==='@null')return null;if(refString.startsWith('@android:attr/')){refString=refString.substring('@android:attr/'.length);return android.R.attr[refString];}}},{key:'getDrawable',value:function getDrawable(refString){if(refString==='@null')return null;if(refString.startsWith('@android:drawable/')){refString=refString.substring('@android:drawable/'.length);return android.R.drawable[refString]||android.R.image[refString];}if(refString.startsWith('@android:color/')){refString=refString.substring('@android:color/'.length);var color=android.R.color[refString];if(color instanceof res.ColorStateList){color=color.getDefaultColor();}return new ColorDrawable(color);}if(Resources._AppBuildImageFileFinder){var drawable=Resources._AppBuildImageFileFinder(refString);if(drawable)return drawable;}if(!refString.startsWith('@')){refString='@drawable/'+refString;}var ele=this.getXml(refString);if(ele){return Drawable.createFromXml(this,ele);}ele=this.getValue(refString);if(ele){var text=ele.innerText;if(text.startsWith('@android:drawable/')||text.startsWith('@drawable/')){return this.getDrawable(text);}if(text.startsWith('@android:color/')||text.startsWith('@color/')){var _color2=this.getColor(text);return new ColorDrawable(_color2);}return Drawable.createFromXml(this,ele);}throw new Error(\"NotFoundException: Resource \"+refString+\" is not found\");}},{key:'getColor',value:function getColor(refString){if(refString.startsWith('@android:color/')){refString=refString.substring('@android:color/'.length);var color=android.R.color[refString];if(color instanceof res.ColorStateList){color=color.getDefaultColor();}return color;}else{if(!refString.startsWith('@color/')){refString='@color/'+refString;}var ele=this.getValue(refString);if(ele){var text=ele.innerText;if(text.startsWith('@android:color/')||text.startsWith('@color/')){return this.getColor(text);}return Color.parseColor(text);}ele=this.getXml(refString);if(ele){var colorList=res.ColorStateList.createFromXml(this,ele);if(colorList)return colorList.getDefaultColor();}}throw new Error(\"NotFoundException: Resource \"+refString+\" is not found\");}},{key:'getColorStateList',value:function getColorStateList(refString){if(refString==='@null')return null;if(refString.startsWith('@android:color/')){refString=refString.substring('@android:color/'.length);var color=android.R.color[refString];if(typeof color===\"number\"){color=res.ColorStateList.valueOf(color);}return color;}else{if(!refString.startsWith('@color/')){refString='@color/'+refString;}var ele=this.getXml(refString);if(ele){return res.ColorStateList.createFromXml(this,ele);}ele=this.getValue(refString);if(ele){var text=ele.innerText;if(text.startsWith('@android:color/')||text.startsWith('@color/')){return this.getColorStateList(text);}return res.ColorStateList.valueOf(Color.parseColor(text));}}throw new Error(\"NotFoundException: Resource \"+refString+\" is not found\");}},{key:'getDimension',value:function getDimension(refString){var baseValue=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(!refString.startsWith('@dimen/'))refString='@dimen/'+refString;var ele=this.getValue(refString);if(ele){var text=ele.innerText;return android.util.TypedValue.complexToDimension(text,baseValue,this.getDisplayMetrics());}throw new Error(\"NotFoundException: Resource \"+refString+\" is not found\");}},{key:'getDimensionPixelOffset',value:function getDimensionPixelOffset(refString){var baseValue=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(!refString.startsWith('@dimen/'))refString='@dimen/'+refString;var ele=this.getValue(refString);if(ele){var text=ele.innerText;return android.util.TypedValue.complexToDimensionPixelOffset(text,baseValue,this.getDisplayMetrics());}throw new Error(\"NotFoundException: Resource \"+refString+\" is not found\");}},{key:'getDimensionPixelSize',value:function getDimensionPixelSize(refString){var baseValue=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(!refString.startsWith('@dimen/'))refString='@dimen/'+refString;var ele=this.getValue(refString);if(ele){var text=ele.innerText;return android.util.TypedValue.complexToDimensionPixelSize(text,baseValue,this.getDisplayMetrics());}throw new Error(\"NotFoundException: Resource \"+refString+\" is not found\");}},{key:'getBoolean',value:function getBoolean(refString){if(!refString.startsWith('@bool/'))refString='@bool/'+refString;var ele=this.getValue(refString);if(ele){var text=ele.innerText;return text=='true';}throw new Error(\"NotFoundException: Resource \"+refString+\" is not found\");}},{key:'getInteger',value:function getInteger(refString){if(!refString.startsWith('@integer/'))refString='@integer/'+refString;var ele=this.getValue(refString);if(ele){return parseInt(ele.innerText);}throw new Error(\"NotFoundException: Resource \"+refString+\" is not found\");}},{key:'getIntArray',value:function getIntArray(refString){if(!refString.startsWith('@array/'))refString='@array/'+refString;var ele=this.getValue(refString);if(ele){var intArray=[];var _iteratorNormalCompletion11=true;var _didIteratorError11=false;var _iteratorError11=undefined;try{for(var _iterator11=Array.from(ele.children)[Symbol.iterator](),_step11;!(_iteratorNormalCompletion11=(_step11=_iterator11.next()).done);_iteratorNormalCompletion11=true){var child=_step11.value;intArray.push(parseInt(child.innerText));}}catch(err){_didIteratorError11=true;_iteratorError11=err;}finally{try{if(!_iteratorNormalCompletion11&&_iterator11.return){_iterator11.return();}}finally{if(_didIteratorError11){throw _iteratorError11;}}}return intArray;}throw new Error(\"NotFoundException: Resource \"+refString+\" is not found\");}},{key:'getFloat',value:function getFloat(refString){return this.getDimension(refString);}},{key:'getString',value:function getString(refString){if(refString.startsWith('@android:string/')){refString=refString.substring('@android:string/'.length);return android.R.string_[refString];}if(!refString.startsWith('@string/'))refString='@string/'+refString;var ele=this.getValue(refString);if(ele){return ele.innerText;}throw new Error(\"NotFoundException: Resource \"+refString+\" is not found\");}},{key:'getStringArray',value:function getStringArray(refString){if(!refString.startsWith('@array/'))refString='@array/'+refString;var ele=this.getValue(refString);if(ele){var stringArray=[];var _iteratorNormalCompletion12=true;var _didIteratorError12=false;var _iteratorError12=undefined;try{for(var _iterator12=Array.from(ele.children)[Symbol.iterator](),_step12;!(_iteratorNormalCompletion12=(_step12=_iterator12.next()).done);_iteratorNormalCompletion12=true){var child=_step12.value;stringArray.push(child.innerText);}}catch(err){_didIteratorError12=true;_iteratorError12=err;}finally{try{if(!_iteratorNormalCompletion12&&_iterator12.return){_iterator12.return();}}finally{if(_didIteratorError12){throw _iteratorError12;}}}return stringArray;}throw new Error(\"NotFoundException: Resource \"+refString+\" is not found\");}},{key:'getLayout',value:function getLayout(refString){if(!refString||!refString.trim().startsWith('@'))return null;if(refString==='@null')return null;if(refString.startsWith('@android:layout/')){refString=refString.substring('@android:layout/'.length);return android.R.layout.getLayoutData(refString);}if(!refString.startsWith('@layout/'))refString='@layout/'+refString;var ele=this.getXml(refString);if(ele)return ele;throw new Error(\"NotFoundException: Resource \"+refString+\" is not found\");}},{key:'getAnimation',value:function getAnimation(refString){if(refString==='@null')return null;if(!refString||!refString.trim().startsWith('@'))return null;if(refString.startsWith('@android:anim/')){refString=refString.substring('@android:anim/'.length);return android.R.anim[refString];}}},{key:'getStyleAsMap',value:function getStyleAsMap(refString){var _this15=this;if(refString==='@null')return null;if(!refString.startsWith('@style/')){refString='@style/'+refString;}var styleMap=new Map();var parseStyle=function parseStyle(refString){var styleXml=_this15.getValue(refString);if(!styleXml)return;var parent=styleXml.getAttribute('parent');if(parent){if(!parent.startsWith('@style/')){parent='@style/'+parent;}parseStyle(parent);}var styleName=refString.substring('@style/'.length);if(styleName.includes('.')){var parts=styleName.split('.');parts.shift();var nameParent=parts.join('.');parseStyle('@style/'+nameParent);}var _iteratorNormalCompletion13=true;var _didIteratorError13=false;var _iteratorError13=undefined;try{for(var _iterator13=Array.from(styleXml.children)[Symbol.iterator](),_step13;!(_iteratorNormalCompletion13=(_step13=_iterator13.next()).done);_iteratorNormalCompletion13=true){var item=_step13.value;var name=item.getAttribute('name');if(name){styleMap.set(name,item.innerText);}}}catch(err){_didIteratorError13=true;_iteratorError13=err;}finally{try{if(!_iteratorNormalCompletion13&&_iterator13.return){_iterator13.return();}}finally{if(_didIteratorError13){throw _iteratorError13;}}}};parseStyle(refString);return styleMap;}},{key:'getXml',value:function getXml(refString){if(refString==='@null')return null;if(Resources._AppBuildXmlFinder)return Resources._AppBuildXmlFinder(refString);}},{key:'getValue',value:function getValue(refString){var resolveRefs=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;if(refString==='@null')return null;if(Resources._AppBuildValueFinder){var ele=Resources._AppBuildValueFinder(refString);if(!ele)return null;if(resolveRefs&&ele.children.length==0){var str=ele.innerText;if(str.startsWith('@')){return this.getValue(refString,true)||ele;}}return ele;}}},{key:'obtainAttributes',value:function obtainAttributes(attrs){return res.TypedArray.obtain(this,attrs);}},{key:'obtainStyledAttributes',value:function obtainStyledAttributes(attrs,defStyleAttr){return res.TypedArray.obtain(this,attrs,defStyleAttr);}}],[{key:'getSystem',value:function getSystem(){return Resources.instance;}},{key:'from',value:function from(context){return context.getResources();}},{key:'getDisplayMetrics',value:function getDisplayMetrics(){return Resources.instance.getDisplayMetrics();}}]);return Resources;}();Resources.instance=new Resources();Resources._AppBuildImageFileFinder=null;Resources._AppBuildXmlFinder=null;Resources._AppBuildValueFinder=null;res.Resources=Resources;})(res=content.res||(content.res={}));})(content=android.content||(android.content={}));})(android||(android={}));var android;(function(android){var view;(function(view){var ViewConfiguration=function(){function ViewConfiguration(){_classCallCheck(this,ViewConfiguration);this.density=android.content.res.Resources.getDisplayMetrics().density;this.sizeAndDensity=this.density;this.mEdgeSlop=this.sizeAndDensity*ViewConfiguration.EDGE_SLOP;this.mFadingEdgeLength=this.sizeAndDensity*ViewConfiguration.FADING_EDGE_LENGTH;this.mMinimumFlingVelocity=this.density*ViewConfiguration.MINIMUM_FLING_VELOCITY;this.mMaximumFlingVelocity=this.density*ViewConfiguration.MAXIMUM_FLING_VELOCITY;this.mScrollbarSize=this.density*ViewConfiguration.SCROLL_BAR_SIZE;this.mTouchSlop=this.density*ViewConfiguration.TOUCH_SLOP;this.mDoubleTapTouchSlop=this.sizeAndDensity*ViewConfiguration.DOUBLE_TAP_TOUCH_SLOP;this.mPagingTouchSlop=this.density*ViewConfiguration.PAGING_TOUCH_SLOP;this.mDoubleTapSlop=this.density*ViewConfiguration.DOUBLE_TAP_SLOP;this.mWindowTouchSlop=this.sizeAndDensity*ViewConfiguration.WINDOW_TOUCH_SLOP;this.mOverscrollDistance=this.sizeAndDensity*ViewConfiguration.OVERSCROLL_DISTANCE;this.mOverflingDistance=this.sizeAndDensity*ViewConfiguration.OVERFLING_DISTANCE;this.mMaximumDrawingCacheSize=android.content.res.Resources.getDisplayMetrics().widthPixels*android.content.res.Resources.getDisplayMetrics().heightPixels*4*2;}_createClass(ViewConfiguration,[{key:'getScaledScrollBarSize',value:function getScaledScrollBarSize(){return this.mScrollbarSize;}},{key:'getScaledFadingEdgeLength',value:function getScaledFadingEdgeLength(){return this.mFadingEdgeLength;}},{key:'getScaledEdgeSlop',value:function getScaledEdgeSlop(){return this.mEdgeSlop;}},{key:'getScaledTouchSlop',value:function getScaledTouchSlop(){return this.mTouchSlop;}},{key:'getScaledDoubleTapTouchSlop',value:function getScaledDoubleTapTouchSlop(){return this.mDoubleTapTouchSlop;}},{key:'getScaledPagingTouchSlop',value:function getScaledPagingTouchSlop(){return this.mPagingTouchSlop;}},{key:'getScaledDoubleTapSlop',value:function getScaledDoubleTapSlop(){return this.mDoubleTapSlop;}},{key:'getScaledWindowTouchSlop',value:function getScaledWindowTouchSlop(){return this.mWindowTouchSlop;}},{key:'getScaledMinimumFlingVelocity',value:function getScaledMinimumFlingVelocity(){return this.mMinimumFlingVelocity;}},{key:'getScaledMaximumFlingVelocity',value:function getScaledMaximumFlingVelocity(){return this.mMaximumFlingVelocity;}},{key:'getScaledMaximumDrawingCacheSize',value:function getScaledMaximumDrawingCacheSize(){return this.mMaximumDrawingCacheSize;}},{key:'getScaledOverscrollDistance',value:function getScaledOverscrollDistance(){return this.mOverscrollDistance;}},{key:'getScaledOverflingDistance',value:function getScaledOverflingDistance(){return this.mOverflingDistance;}}],[{key:'get',value:function get(arg){if(!ViewConfiguration.instance){ViewConfiguration.instance=new ViewConfiguration();}return ViewConfiguration.instance;}},{key:'getScrollBarFadeDuration',value:function getScrollBarFadeDuration(){return ViewConfiguration.SCROLL_BAR_FADE_DURATION;}},{key:'getScrollDefaultDelay',value:function getScrollDefaultDelay(){return ViewConfiguration.SCROLL_BAR_DEFAULT_DELAY;}},{key:'getPressedStateDuration',value:function getPressedStateDuration(){return ViewConfiguration.PRESSED_STATE_DURATION;}},{key:'getLongPressTimeout',value:function getLongPressTimeout(){return ViewConfiguration.DEFAULT_LONG_PRESS_TIMEOUT;}},{key:'getKeyRepeatDelay',value:function getKeyRepeatDelay(){return ViewConfiguration.KEY_REPEAT_DELAY;}},{key:'getTapTimeout',value:function getTapTimeout(){return ViewConfiguration.TAP_TIMEOUT;}},{key:'getJumpTapTimeout',value:function getJumpTapTimeout(){return ViewConfiguration.JUMP_TAP_TIMEOUT;}},{key:'getDoubleTapTimeout',value:function getDoubleTapTimeout(){return ViewConfiguration.DOUBLE_TAP_TIMEOUT;}},{key:'getDoubleTapMinTime',value:function getDoubleTapMinTime(){return ViewConfiguration.DOUBLE_TAP_MIN_TIME;}},{key:'getScrollFriction',value:function getScrollFriction(){return ViewConfiguration.SCROLL_FRICTION;}}]);return ViewConfiguration;}();ViewConfiguration.SCROLL_BAR_SIZE=8;ViewConfiguration.SCROLL_BAR_FADE_DURATION=250;ViewConfiguration.SCROLL_BAR_DEFAULT_DELAY=300;ViewConfiguration.FADING_EDGE_LENGTH=12;ViewConfiguration.PRESSED_STATE_DURATION=64;ViewConfiguration.DEFAULT_LONG_PRESS_TIMEOUT=500;ViewConfiguration.KEY_REPEAT_DELAY=50;ViewConfiguration.GLOBAL_ACTIONS_KEY_TIMEOUT=500;ViewConfiguration.TAP_TIMEOUT=180;ViewConfiguration.JUMP_TAP_TIMEOUT=500;ViewConfiguration.DOUBLE_TAP_TIMEOUT=300;ViewConfiguration.DOUBLE_TAP_MIN_TIME=40;ViewConfiguration.HOVER_TAP_TIMEOUT=150;ViewConfiguration.HOVER_TAP_SLOP=20;ViewConfiguration.ZOOM_CONTROLS_TIMEOUT=3000;ViewConfiguration.EDGE_SLOP=12;ViewConfiguration.TOUCH_SLOP=8;ViewConfiguration.DOUBLE_TAP_TOUCH_SLOP=ViewConfiguration.TOUCH_SLOP;ViewConfiguration.PAGING_TOUCH_SLOP=ViewConfiguration.TOUCH_SLOP*2;ViewConfiguration.DOUBLE_TAP_SLOP=100;ViewConfiguration.WINDOW_TOUCH_SLOP=16;ViewConfiguration.MINIMUM_FLING_VELOCITY=50;ViewConfiguration.MAXIMUM_FLING_VELOCITY=8000;ViewConfiguration.SCROLL_FRICTION=0.015;ViewConfiguration.OVERSCROLL_DISTANCE=800;ViewConfiguration.OVERFLING_DISTANCE=100;view.ViewConfiguration=ViewConfiguration;})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var os;(function(os){var SystemClock=function(){function SystemClock(){_classCallCheck(this,SystemClock);}_createClass(SystemClock,null,[{key:'uptimeMillis',value:function uptimeMillis(){return new Date().getTime();}}]);return SystemClock;}();os.SystemClock=SystemClock;})(os=android.os||(android.os={}));})(android||(android={}));var android;(function(android){var view;(function(view){var Rect=android.graphics.Rect;var ViewConfiguration=android.view.ViewConfiguration;var tempBound=new Rect();var ID_FixID_Cache=[];var tmpTouchEvent={touches:null,changedTouches:null,type:null};function fixEventId(e){for(var i=0,length=e.changedTouches.length;i<length;i++){fixTouchId(e.changedTouches[i]);}for(var _i3=0,_length=e.touches.length;_i3<_length;_i3++){fixTouchId(e.touches[_i3]);}if(e.type=='touchend'||e.type=='touchcancel'){ID_FixID_Cache[e.changedTouches[0].id_fix]=null;}tmpTouchEvent.type=e.type;tmpTouchEvent.changedTouches=Array.from(e.changedTouches).map(function(touch){return fixTouchId(touch);});tmpTouchEvent.touches=Array.from(e.touches).map(function(touch){return fixTouchId(touch);});return tmpTouchEvent;}function fixTouchId(touch){var originID=touch['identifier'];var fix_id=ID_FixID_Cache.indexOf(originID);if(fix_id<0){for(var i=0,length=ID_FixID_Cache.length+1;i<length;i++){if(ID_FixID_Cache[i]==null){ID_FixID_Cache[i]=originID;fix_id=i;break;}}}return{id_fix:fix_id,target:touch.target,screenX:touch.screenX,screenY:touch.screenY,clientX:touch.clientX,clientY:touch.clientY,pageX:touch.pageX,pageY:touch.pageY,mEventTime:touch.mEventTime};}var MotionEvent=function(){function MotionEvent(){_classCallCheck(this,MotionEvent);this.mAction=0;this.mEdgeFlags=0;this.mDownTime=0;this.mEventTime=0;this.mActivePointerId=0;this.mXOffset=0;this.mYOffset=0;this._axisValues=new Map();}_createClass(MotionEvent,[{key:'initWithTouch',value:function initWithTouch(event,baseAction){var windowBound=arguments.length>2&&arguments[2]!==undefined?arguments[2]:new Rect();var e=fixEventId(event);var now=android.os.SystemClock.uptimeMillis();var action=baseAction;var actionIndex=-1;var activeTouch=e.changedTouches[0];this._activeTouch=activeTouch;var activePointerId=activeTouch.id_fix;if(activePointerId==null)console.warn('activePointerId null, activeTouch.identifier: '+activeTouch['identifier']);for(var i=0,length=e.touches.length;i<length;i++){if(e.touches[i].id_fix===activePointerId){actionIndex=i;MotionEvent.IdIndexCache.set(activePointerId,i);break;}}if(actionIndex<0&&(baseAction===MotionEvent.ACTION_UP||baseAction===MotionEvent.ACTION_CANCEL)){actionIndex=MotionEvent.IdIndexCache.get(activePointerId);}if(actionIndex<0)throw Error('not find action index');switch(baseAction){case MotionEvent.ACTION_DOWN:case MotionEvent.ACTION_UP:MotionEvent.TouchMoveRecord.set(activePointerId,[]);break;case MotionEvent.ACTION_MOVE:var moveHistory=MotionEvent.TouchMoveRecord.get(activePointerId);if(moveHistory){activeTouch.mEventTime=now;moveHistory.push(activeTouch);if(moveHistory.length>MotionEvent.HistoryMaxSize)moveHistory.shift();}break;}this.mTouchingPointers=Array.from(e.touches);if(baseAction===MotionEvent.ACTION_UP||baseAction===MotionEvent.ACTION_CANCEL){this.mTouchingPointers.splice(actionIndex,0,activeTouch);}if(this.mTouchingPointers.length>1){switch(action){case MotionEvent.ACTION_DOWN:action=MotionEvent.ACTION_POINTER_DOWN;action=actionIndex<<MotionEvent.ACTION_POINTER_INDEX_SHIFT|action;break;case MotionEvent.ACTION_UP:action=MotionEvent.ACTION_POINTER_UP;action=actionIndex<<MotionEvent.ACTION_POINTER_INDEX_SHIFT|action;break;}}this.mAction=action;this.mActivePointerId=activePointerId;if(action==MotionEvent.ACTION_DOWN){this.mDownTime=now;}this.mEventTime=now;var density=android.content.res.Resources.getSystem().getDisplayMetrics().density;this.mXOffset=this.mYOffset=0;var edgeFlag=0;var unScaledX=activeTouch.pageX;var unScaledY=activeTouch.pageY;var edgeSlop=ViewConfiguration.EDGE_SLOP;tempBound.set(windowBound);tempBound.right=tempBound.left+edgeSlop;if(tempBound.contains(unScaledX,unScaledY)){edgeFlag|=MotionEvent.EDGE_LEFT;}tempBound.set(windowBound);tempBound.bottom=tempBound.top+edgeSlop;if(tempBound.contains(unScaledX,unScaledY)){edgeFlag|=MotionEvent.EDGE_TOP;}tempBound.set(windowBound);tempBound.left=tempBound.right-edgeSlop;if(tempBound.contains(unScaledX,unScaledY)){edgeFlag|=MotionEvent.EDGE_RIGHT;}tempBound.set(windowBound);tempBound.top=tempBound.bottom-edgeSlop;if(tempBound.contains(unScaledX,unScaledY)){edgeFlag|=MotionEvent.EDGE_BOTTOM;}this.mEdgeFlags=edgeFlag;}},{key:'initWithMouseWheel',value:function initWithMouseWheel(e){this.mAction=MotionEvent.ACTION_SCROLL;this.mActivePointerId=0;var touch={id_fix:0,target:null,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY};this.mTouchingPointers=[touch];this.mDownTime=this.mEventTime=android.os.SystemClock.uptimeMillis();this.mXOffset=this.mYOffset=0;this._axisValues.clear();this._axisValues.set(MotionEvent.AXIS_VSCROLL,-e.deltaY);this._axisValues.set(MotionEvent.AXIS_HSCROLL,-e.deltaX);}},{key:'recycle',value:function recycle(){}},{key:'getAction',value:function getAction(){return this.mAction;}},{key:'getActionMasked',value:function getActionMasked(){return this.mAction&MotionEvent.ACTION_MASK;}},{key:'getActionIndex',value:function getActionIndex(){return(this.mAction&MotionEvent.ACTION_POINTER_INDEX_MASK)>>MotionEvent.ACTION_POINTER_INDEX_SHIFT;}},{key:'getDownTime',value:function getDownTime(){return this.mDownTime;}},{key:'getEventTime',value:function getEventTime(){return this.mEventTime;}},{key:'getX',value:function getX(){var pointerIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var density=android.content.res.Resources.getDisplayMetrics().density;return this.mTouchingPointers[pointerIndex].pageX*density+this.mXOffset;}},{key:'getY',value:function getY(){var pointerIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var density=android.content.res.Resources.getDisplayMetrics().density;return this.mTouchingPointers[pointerIndex].pageY*density+this.mYOffset;}},{key:'getPointerCount',value:function getPointerCount(){return this.mTouchingPointers.length;}},{key:'getPointerId',value:function getPointerId(pointerIndex){return this.mTouchingPointers[pointerIndex].id_fix;}},{key:'findPointerIndex',value:function findPointerIndex(pointerId){for(var i=0,length=this.mTouchingPointers.length;i<length;i++){if(this.mTouchingPointers[i].id_fix===pointerId){return i;}}return-1;}},{key:'getRawX',value:function getRawX(){var density=android.content.res.Resources.getDisplayMetrics().density;return this.mTouchingPointers[0].pageX*density;}},{key:'getRawY',value:function getRawY(){var density=android.content.res.Resources.getDisplayMetrics().density;return this.mTouchingPointers[0].pageY*density;}},{key:'getHistorySize',value:function getHistorySize(){var id=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.mActivePointerId;var moveHistory=MotionEvent.TouchMoveRecord.get(id);return moveHistory?moveHistory.length:0;}},{key:'getHistoricalX',value:function getHistoricalX(pointerIndex,pos){var density=android.content.res.Resources.getDisplayMetrics().density;var moveHistory=MotionEvent.TouchMoveRecord.get(this.mTouchingPointers[pointerIndex].id_fix);return moveHistory[pos].pageX*density+this.mXOffset;}},{key:'getHistoricalY',value:function getHistoricalY(pointerIndex,pos){var density=android.content.res.Resources.getDisplayMetrics().density;var moveHistory=MotionEvent.TouchMoveRecord.get(this.mTouchingPointers[pointerIndex].id_fix);return moveHistory[pos].pageY*density+this.mYOffset;}},{key:'getHistoricalEventTime',value:function getHistoricalEventTime(){var pos=void 0,activePointerId=void 0;if(arguments.length===1){pos=arguments.length<=0?undefined:arguments[0];activePointerId=this.mActivePointerId;}else{pos=arguments.length<=1?undefined:arguments[1];activePointerId=this.getPointerId(arguments.length<=0?undefined:arguments[0]);}var moveHistory=MotionEvent.TouchMoveRecord.get(activePointerId);return moveHistory[pos].mEventTime;}},{key:'getTouchMajor',value:function getTouchMajor(pointerIndex){return Math.floor(android.content.res.Resources.getDisplayMetrics().density);}},{key:'getHistoricalTouchMajor',value:function getHistoricalTouchMajor(pointerIndex,pos){return Math.floor(android.content.res.Resources.getDisplayMetrics().density);}},{key:'getEdgeFlags',value:function getEdgeFlags(){return this.mEdgeFlags;}},{key:'setEdgeFlags',value:function setEdgeFlags(flags){this.mEdgeFlags=flags;}},{key:'setAction',value:function setAction(action){this.mAction=action;}},{key:'isTouchEvent',value:function isTouchEvent(){var action=this.getActionMasked();switch(action){case MotionEvent.ACTION_DOWN:case MotionEvent.ACTION_UP:case MotionEvent.ACTION_MOVE:case MotionEvent.ACTION_CANCEL:case MotionEvent.ACTION_OUTSIDE:case MotionEvent.ACTION_POINTER_DOWN:case MotionEvent.ACTION_POINTER_UP:return true;}return false;}},{key:'isPointerEvent',value:function isPointerEvent(){return true;}},{key:'offsetLocation',value:function offsetLocation(deltaX,deltaY){this.mXOffset+=deltaX;this.mYOffset+=deltaY;}},{key:'setLocation',value:function setLocation(x,y){this.mXOffset=x-this.getRawX();this.mYOffset=y-this.getRawY();}},{key:'getPointerIdBits',value:function getPointerIdBits(){var idBits=0;var pointerCount=this.getPointerCount();for(var i=0;i<pointerCount;i++){idBits|=1<<this.getPointerId(i);}return idBits;}},{key:'split',value:function split(idBits){var ev=MotionEvent.obtain(this);var oldPointerCount=this.getPointerCount();var oldAction=this.getAction();var oldActionMasked=oldAction&MotionEvent.ACTION_MASK;var newPointerIds=[];for(var i=0;i<oldPointerCount;i++){var pointerId=this.getPointerId(i);var idBit=1<<pointerId;if((idBit&idBits)!=0){newPointerIds.push(pointerId);}}var newActionPointerIndex=newPointerIds.indexOf(this.mActivePointerId);var newPointerCount=newPointerIds.length;var newAction=void 0;if(oldActionMasked==MotionEvent.ACTION_POINTER_DOWN||oldActionMasked==MotionEvent.ACTION_POINTER_UP){if(newActionPointerIndex<0){newAction=MotionEvent.ACTION_MOVE;}else if(newPointerCount==1){newAction=oldActionMasked==MotionEvent.ACTION_POINTER_DOWN?MotionEvent.ACTION_DOWN:MotionEvent.ACTION_UP;}else{newAction=oldActionMasked|newActionPointerIndex<<MotionEvent.ACTION_POINTER_INDEX_SHIFT;}}else{newAction=oldAction;}ev.mAction=newAction;ev.mTouchingPointers=this.mTouchingPointers.filter(function(item){return newPointerIds.indexOf(item.id_fix)>=0;});return ev;}},{key:'getAxisValue',value:function getAxisValue(axis){var value=this._axisValues.get(axis);return value?value:0;}},{key:'toString',value:function toString(){return\"MotionEvent{action=\"+this.getAction()+\" x=\"+this.getX()+\" y=\"+this.getY()+\"}\";}}],[{key:'obtainWithTouchEvent',value:function obtainWithTouchEvent(e,action){var event=new MotionEvent();event.initWithTouch(e,action);return event;}},{key:'obtain',value:function obtain(event){var newEv=new MotionEvent();Object.assign(newEv,event);return newEv;}},{key:'obtainWithAction',value:function obtainWithAction(downTime,eventTime,action,x,y){var metaState=arguments.length>5&&arguments[5]!==undefined?arguments[5]:0;var newEv=new MotionEvent();newEv.mAction=action;newEv.mDownTime=downTime;newEv.mEventTime=eventTime;var touch={id_fix:0,target:null,screenX:x,screenY:y,clientX:x,clientY:y,pageX:x,pageY:y};newEv.mTouchingPointers=[touch];return newEv;}}]);return MotionEvent;}();MotionEvent.INVALID_POINTER_ID=-1;MotionEvent.ACTION_MASK=0xff;MotionEvent.ACTION_DOWN=0;MotionEvent.ACTION_UP=1;MotionEvent.ACTION_MOVE=2;MotionEvent.ACTION_CANCEL=3;MotionEvent.ACTION_OUTSIDE=4;MotionEvent.ACTION_POINTER_DOWN=5;MotionEvent.ACTION_POINTER_UP=6;MotionEvent.ACTION_HOVER_MOVE=7;MotionEvent.ACTION_SCROLL=8;MotionEvent.ACTION_HOVER_ENTER=9;MotionEvent.ACTION_HOVER_EXIT=10;MotionEvent.EDGE_TOP=0x00000001;MotionEvent.EDGE_BOTTOM=0x00000002;MotionEvent.EDGE_LEFT=0x00000004;MotionEvent.EDGE_RIGHT=0x00000008;MotionEvent.ACTION_POINTER_INDEX_MASK=0xff00;MotionEvent.ACTION_POINTER_INDEX_SHIFT=8;MotionEvent.AXIS_VSCROLL=9;MotionEvent.AXIS_HSCROLL=10;MotionEvent.HistoryMaxSize=10;MotionEvent.TouchMoveRecord=new Map();MotionEvent.IdIndexCache=new Map();view.MotionEvent=MotionEvent;})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var Rect=android.graphics.Rect;var TouchDelegate=function(){function TouchDelegate(bounds,delegateView){_classCallCheck(this,TouchDelegate);this.mDelegateTargeted=false;this.mSlop=0;this.mBounds=bounds;this.mSlop=view.ViewConfiguration.get().getScaledTouchSlop();this.mSlopBounds=new Rect(bounds);this.mSlopBounds.inset(-this.mSlop,-this.mSlop);this.mDelegateView=delegateView;}_createClass(TouchDelegate,[{key:'onTouchEvent',value:function onTouchEvent(event){var x=event.getX();var y=event.getY();var sendToDelegate=false;var hit=true;var handled=false;switch(event.getAction()){case view.MotionEvent.ACTION_DOWN:var bounds=this.mBounds;if(bounds.contains(x,y)){this.mDelegateTargeted=true;sendToDelegate=true;}break;case view.MotionEvent.ACTION_UP:case view.MotionEvent.ACTION_MOVE:sendToDelegate=this.mDelegateTargeted;if(sendToDelegate){var slopBounds=this.mSlopBounds;if(!slopBounds.contains(x,y)){hit=false;}}break;case view.MotionEvent.ACTION_CANCEL:sendToDelegate=this.mDelegateTargeted;this.mDelegateTargeted=false;break;}if(sendToDelegate){var delegateView=this.mDelegateView;if(hit){event.setLocation(delegateView.getWidth()/2,delegateView.getHeight()/2);}else{var slop=this.mSlop;event.setLocation(-(slop*2),-(slop*2));}handled=delegateView.dispatchTouchEvent(event);}return handled;}}]);return TouchDelegate;}();view.TouchDelegate=TouchDelegate;})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var os;(function(os){var StringBuilder=java.lang.StringBuilder;var Pools=android.util.Pools;var Message=function(){function Message(){_classCallCheck(this,Message);this.mType=Message.Type_Normal;this.what=0;this.arg1=0;this.arg2=0;this.when=0;}_createClass(Message,[{key:'recycle',value:function recycle(){this.clearForRecycle();Message.sPool.release(this);}},{key:'copyFrom',value:function copyFrom(o){this.mType=o.mType;this.what=o.what;this.arg1=o.arg1;this.arg2=o.arg2;this.obj=o.obj;}},{key:'setTarget',value:function setTarget(target){this.target=target;}},{key:'getTarget',value:function getTarget(){return this.target;}},{key:'sendToTarget',value:function sendToTarget(){this.target.sendMessage(this);}},{key:'clearForRecycle',value:function clearForRecycle(){this.mType=Message.Type_Normal;this.what=0;this.arg1=0;this.arg2=0;this.obj=null;this.when=0;this.target=null;this.callback=null;}},{key:'toString',value:function toString(){var now=arguments.length>0&&arguments[0]!==undefined?arguments[0]:os.SystemClock.uptimeMillis();var b=new StringBuilder();b.append(\"{ what=\");b.append(this.what);b.append(\" when=\");b.append(this.when-now).append(\"ms\");if(this.arg1!=0){b.append(\" arg1=\");b.append(this.arg1);}if(this.arg2!=0){b.append(\" arg2=\");b.append(this.arg2);}if(this.obj!=null){b.append(\" obj=\");b.append(this.obj);}b.append(\" }\");return b.toString();}}],[{key:'obtain',value:function obtain(){var m=Message.sPool.acquire();m=m||new Message();for(var _len13=arguments.length,args=Array(_len13),_key13=0;_key13<_len13;_key13++){args[_key13]=arguments[_key13];}if(args.length===1){if(args[0]instanceof Message){var orig=args[0];var _ref4=[orig.target,orig.what,orig.arg1,orig.arg2,orig.obj,orig.callback];m.target=_ref4[0];m.what=_ref4[1];m.arg1=_ref4[2];m.arg2=_ref4[3];m.obj=_ref4[4];m.callback=_ref4[5];}else if(args[0]instanceof os.Handler){m.target=args[0];}else{throw new Error('unknown args');}}else if(args.length===2){m.target=args[0];if(typeof args[1]==='number')m.what=args[1];else m.callback=args[1];}else if(args.length===3){m.target=args[0];m.what=args[1];m.obj=args[2];}else if(args.length===4){m.target=args[0];m.what=args[1];m.arg1=args[2];m.arg2=args[3];}else{m.target=args[0];m.what=args[1];var _args$39=args[2];m.arg1=_args$39===undefined?0:_args$39;m.arg2=args[3];m.obj=args[4];m.callback=args[5];}return m;}}]);return Message;}();Message.Type_Normal=0;Message.Type_Traversal=1;Message.sPool=new Pools.SynchronizedPool(10);os.Message=Message;})(os=android.os||(android.os={}));})(android||(android={}));var android;(function(android){var os;(function(os){var requestAnimationFrame=window[\"requestAnimationFrame\"]||window[\"webkitRequestAnimationFrame\"]||window[\"mozRequestAnimationFrame\"]||window[\"oRequestAnimationFrame\"]||window[\"msRequestAnimationFrame\"];if(!requestAnimationFrame){requestAnimationFrame=function requestAnimationFrame(callback){return window.setTimeout(callback,1000/60);};}if(!window.requestAnimationFrame)window.requestAnimationFrame=requestAnimationFrame;var MessageQueue=function(){function MessageQueue(){_classCallCheck(this,MessageQueue);}_createClass(MessageQueue,null,[{key:'getMessages',value:function getMessages(h,args,object){var msgs=[];if(h==null){return msgs;}if(typeof args===\"number\"){var what=args;var _iteratorNormalCompletion14=true;var _didIteratorError14=false;var _iteratorError14=undefined;try{for(var _iterator14=MessageQueue.messages[Symbol.iterator](),_step14;!(_iteratorNormalCompletion14=(_step14=_iterator14.next()).done);_iteratorNormalCompletion14=true){var p=_step14.value;if(p.target==h&&p.what==what&&(object==null||p.obj==object)){msgs.push(p);}}}catch(err){_didIteratorError14=true;_iteratorError14=err;}finally{try{if(!_iteratorNormalCompletion14&&_iterator14.return){_iterator14.return();}}finally{if(_didIteratorError14){throw _iteratorError14;}}}}else{var r=args;var _iteratorNormalCompletion15=true;var _didIteratorError15=false;var _iteratorError15=undefined;try{for(var _iterator15=MessageQueue.messages[Symbol.iterator](),_step15;!(_iteratorNormalCompletion15=(_step15=_iterator15.next()).done);_iteratorNormalCompletion15=true){var _p=_step15.value;if(_p.target==h&&_p.callback==r&&(object==null||_p.obj==object)){msgs.push(_p);}}}catch(err){_didIteratorError15=true;_iteratorError15=err;}finally{try{if(!_iteratorNormalCompletion15&&_iterator15.return){_iterator15.return();}}finally{if(_didIteratorError15){throw _iteratorError15;}}}}return msgs;}},{key:'hasMessages',value:function hasMessages(h,args,object){return MessageQueue.getMessages(h,args,object).length>0;}},{key:'enqueueMessage',value:function enqueueMessage(msg,when){if(msg.target==null){throw new Error(\"Message must have a target.\");}msg.when=when;MessageQueue.messages.add(msg);MessageQueue.checkLoop();return true;}},{key:'recycleMessage',value:function recycleMessage(handler,message){message.recycle();MessageQueue.messages.delete(message);}},{key:'removeMessages',value:function removeMessages(h,args,object){var p=MessageQueue.getMessages(h,args,object);if(p&&p.length>0){var _iteratorNormalCompletion16=true;var _didIteratorError16=false;var _iteratorError16=undefined;try{for(var _iterator16=p[Symbol.iterator](),_step16;!(_iteratorNormalCompletion16=(_step16=_iterator16.next()).done);_iteratorNormalCompletion16=true){var item=_step16.value;MessageQueue.recycleMessage(h,item);}}catch(err){_didIteratorError16=true;_iteratorError16=err;}finally{try{if(!_iteratorNormalCompletion16&&_iterator16.return){_iterator16.return();}}finally{if(_didIteratorError16){throw _iteratorError16;}}}}}},{key:'removeCallbacksAndMessages',value:function removeCallbacksAndMessages(h,object){if(h==null){return;}var _iteratorNormalCompletion17=true;var _didIteratorError17=false;var _iteratorError17=undefined;try{for(var _iterator17=MessageQueue.messages[Symbol.iterator](),_step17;!(_iteratorNormalCompletion17=(_step17=_iterator17.next()).done);_iteratorNormalCompletion17=true){var p=_step17.value;if(p!=null&&p.target==h&&(object==null||p.obj==object)){MessageQueue.recycleMessage(h,p);}}}catch(err){_didIteratorError17=true;_iteratorError17=err;}finally{try{if(!_iteratorNormalCompletion17&&_iterator17.return){_iterator17.return();}}finally{if(_didIteratorError17){throw _iteratorError17;}}}}},{key:'checkLoop',value:function checkLoop(){if(!MessageQueue._loopActive){MessageQueue._loopActive=true;MessageQueue.requestNextLoop();}}},{key:'requestNextLoop',value:function requestNextLoop(){requestAnimationFrame(MessageQueue.loop);}},{key:'loop',value:function loop(){var normalMessages=[];var traversalMessages=[];var now=os.SystemClock.uptimeMillis();var _iteratorNormalCompletion18=true;var _didIteratorError18=false;var _iteratorError18=undefined;try{for(var _iterator18=MessageQueue.messages[Symbol.iterator](),_step18;!(_iteratorNormalCompletion18=(_step18=_iterator18.next()).done);_iteratorNormalCompletion18=true){var msg=_step18.value;if(msg.when<=now){if(msg.mType===os.Message.Type_Traversal)traversalMessages.push(msg);else normalMessages.push(msg);}}}catch(err){_didIteratorError18=true;_iteratorError18=err;}finally{try{if(!_iteratorNormalCompletion18&&_iterator18.return){_iterator18.return();}}finally{if(_didIteratorError18){throw _iteratorError18;}}}for(var i=0,length=normalMessages.length;i<length;i++){MessageQueue.dispatchMessage(normalMessages[i]);}for(var _i4=0,_length2=traversalMessages.length;_i4<_length2;_i4++){MessageQueue.dispatchMessage(traversalMessages[_i4]);}if(MessageQueue.messages.size>0)MessageQueue.requestNextLoop();else MessageQueue._loopActive=false;}},{key:'dispatchMessage',value:function dispatchMessage(msg){if(MessageQueue.messages.has(msg)){MessageQueue.messages.delete(msg);msg.target.dispatchMessage(msg);MessageQueue.recycleMessage(msg.target,msg);}}}]);return MessageQueue;}();MessageQueue.messages=new Set();MessageQueue._loopActive=false;os.MessageQueue=MessageQueue;})(os=android.os||(android.os={}));})(android||(android={}));var android;(function(android){var os;(function(os){var Handler=function(){function Handler(callback){_classCallCheck(this,Handler);this.mCallback=callback;}_createClass(Handler,[{key:'handleMessage',value:function handleMessage(msg){}},{key:'dispatchMessage',value:function dispatchMessage(msg){if(msg.callback!=null){msg.callback.run();}else{if(this.mCallback!=null){if(this.mCallback.handleMessage(msg)){return;}}this.handleMessage(msg);}}},{key:'obtainMessage',value:function obtainMessage(){for(var _len14=arguments.length,args=Array(_len14),_key14=0;_key14<_len14;_key14++){args[_key14]=arguments[_key14];}if(args.length===2){var what=args[0],obj=args[1];return os.Message.obtain(this,what,obj);}else{var _what=args[0],arg1=args[1],arg2=args[2],_obj=args[3];return os.Message.obtain(this,_what,arg1,arg2,_obj);}}},{key:'post',value:function post(r){return this.sendMessageDelayed(Handler.getPostMessage(r),0);}},{key:'postAsTraversal',value:function postAsTraversal(r){var msg=Handler.getPostMessage(r);msg.mType=os.Message.Type_Traversal;return this.sendMessageDelayed(msg,0);}},{key:'postAtTime',value:function postAtTime(){for(var _len15=arguments.length,args=Array(_len15),_key15=0;_key15<_len15;_key15++){args[_key15]=arguments[_key15];}if(args.length===2){var r=args[0],uptimeMillis=args[1];return this.sendMessageAtTime(Handler.getPostMessage(r),uptimeMillis);}else{var _r=args[0],token=args[1],_uptimeMillis=args[2];return this.sendMessageAtTime(Handler.getPostMessage(_r,token),_uptimeMillis);}}},{key:'postDelayed',value:function postDelayed(r,delayMillis){return this.sendMessageDelayed(Handler.getPostMessage(r),delayMillis);}},{key:'postAtFrontOfQueue',value:function postAtFrontOfQueue(r){return this.post(r);}},{key:'removeCallbacks',value:function removeCallbacks(r,token){os.MessageQueue.removeMessages(this,r,token);}},{key:'sendMessage',value:function sendMessage(msg){return this.sendMessageDelayed(msg,0);}},{key:'sendEmptyMessage',value:function sendEmptyMessage(what){return this.sendEmptyMessageDelayed(what,0);}},{key:'sendEmptyMessageDelayed',value:function sendEmptyMessageDelayed(what,delayMillis){var msg=os.Message.obtain();msg.what=what;return this.sendMessageDelayed(msg,delayMillis);}},{key:'sendEmptyMessageAtTime',value:function sendEmptyMessageAtTime(what,uptimeMillis){var msg=os.Message.obtain();msg.what=what;return this.sendMessageAtTime(msg,uptimeMillis);}},{key:'sendMessageDelayed',value:function sendMessageDelayed(msg,delayMillis){if(delayMillis<0){delayMillis=0;}return this.sendMessageAtTime(msg,os.SystemClock.uptimeMillis()+delayMillis);}},{key:'sendMessageAtTime',value:function sendMessageAtTime(msg,uptimeMillis){msg.target=this;return os.MessageQueue.enqueueMessage(msg,uptimeMillis);}},{key:'sendMessageAtFrontOfQueue',value:function sendMessageAtFrontOfQueue(msg){return this.sendMessage(msg);}},{key:'removeMessages',value:function removeMessages(what,object){os.MessageQueue.removeMessages(this,what,object);}},{key:'removeCallbacksAndMessages',value:function removeCallbacksAndMessages(token){os.MessageQueue.removeCallbacksAndMessages(this,token);}},{key:'hasMessages',value:function hasMessages(what,object){return os.MessageQueue.hasMessages(this,what,object);}}],[{key:'getPostMessage',value:function getPostMessage(r,token){var m=os.Message.obtain();m.obj=token;m.callback=r;return m;}}]);return Handler;}();os.Handler=Handler;})(os=android.os||(android.os={}));})(android||(android={}));var android;(function(android){var content;(function(content){var res;(function(res){var SparseArray=android.util.SparseArray;var StateSet=android.util.StateSet;var WeakReference=java.lang.ref.WeakReference;var Color=android.graphics.Color;var ColorStateList=function(){function ColorStateList(states,colors){_classCallCheck(this,ColorStateList);this.mDefaultColor=0xffff0000;this.mStateSpecs=states;this.mColors=colors;if(states&&states.length>0){this.mDefaultColor=colors[0];for(var i=0;i<states.length;i++){if(states[i].length==0){this.mDefaultColor=colors[i];}}}}_createClass(ColorStateList,[{key:'withAlpha',value:function withAlpha(alpha){var colors=androidui.util.ArrayCreator.newNumberArray(this.mColors.length);var len=colors.length;for(var i=0;i<len;i++){colors[i]=this.mColors[i]&0xFFFFFF|alpha<<24;}return new ColorStateList(this.mStateSpecs,colors);}},{key:'isStateful',value:function isStateful(){return this.mStateSpecs.length>1;}},{key:'getColorForState',value:function getColorForState(stateSet,defaultColor){var setLength=this.mStateSpecs.length;for(var i=0;i<setLength;i++){var stateSpec=this.mStateSpecs[i];if(StateSet.stateSetMatches(stateSpec,stateSet)){return this.mColors[i];}}return defaultColor;}},{key:'getDefaultColor',value:function getDefaultColor(){return this.mDefaultColor;}},{key:'toString',value:function toString(){return\"ColorStateList{\"+\"mStateSpecs=\"+JSON.stringify(this.mStateSpecs)+\"mColors=\"+JSON.stringify(this.mColors)+\"mDefaultColor=\"+this.mDefaultColor+'}';}}],[{key:'valueOf',value:function valueOf(color){var ref=ColorStateList.sCache.get(color);var csl=ref!=null?ref.get():null;if(csl!=null){return csl;}csl=new ColorStateList(ColorStateList.EMPTY,[color]);ColorStateList.sCache.put(color,new WeakReference(csl));return csl;}},{key:'createFromXml',value:function createFromXml(r,parser){var colorStateList=void 0;var name=parser.tagName.toLowerCase();if(name==\"selector\"){var stateSpecList=[];var colorList=[];var _iteratorNormalCompletion19=true;var _didIteratorError19=false;var _iteratorError19=undefined;try{for(var _iterator19=Array.from(parser.children)[Symbol.iterator](),_step19;!(_iteratorNormalCompletion19=(_step19=_iterator19.next()).done);_iteratorNormalCompletion19=true){var child=_step19.value;var item=child;if(item.tagName.toLowerCase()!=='item'){continue;}var alpha=1.0;var color=0xffff0000;var haveColor=false;var stateSpec=[];var typedArray=r.obtainAttributes(item);var _iteratorNormalCompletion20=true;var _didIteratorError20=false;var _iteratorError20=undefined;try{for(var _iterator20=Array.from(item.attributes)[Symbol.iterator](),_step20;!(_iteratorNormalCompletion20=(_step20=_iterator20.next()).done);_iteratorNormalCompletion20=true){var attr=_step20.value;var attrName=attr.name;if(attrName==='android:alpha'){alpha=typedArray.getFloat(attrName,alpha);}else if(attrName==='android:color'){color=typedArray.getColor(attrName,color);haveColor=true;}else if(attrName.startsWith('android:state_')){var state=attrName.substring('android:state_'.length);var stateValue=android.view.View['VIEW_STATE_'+state.toUpperCase()];if(typeof stateValue===\"number\"){stateSpec.push(typedArray.getBoolean(attrName,true)?stateValue:-stateValue);}}}}catch(err){_didIteratorError20=true;_iteratorError20=err;}finally{try{if(!_iteratorNormalCompletion20&&_iterator20.return){_iterator20.return();}}finally{if(_didIteratorError20){throw _iteratorError20;}}}if(!haveColor){throw new Error('<item> tag requires a \\'android:color\\' attribute.');}var alphaMod=Math.floor(Color.alpha(color)*alpha);alphaMod=Math.min(alphaMod,255);alphaMod=Math.max(alphaMod,0);color=color&0xFFFFFF|alphaMod<<24;colorList.push(color);stateSpecList.push(stateSpec);}}catch(err){_didIteratorError19=true;_iteratorError19=err;}finally{try{if(!_iteratorNormalCompletion19&&_iterator19.return){_iterator19.return();}}finally{if(_didIteratorError19){throw _iteratorError19;}}}colorStateList=new ColorStateList(stateSpecList,colorList);}else{throw new Error('XmlPullParserException(invalid drawable tag: '+name);}return colorStateList;}}]);return ColorStateList;}();ColorStateList.EMPTY=[[]];ColorStateList.sCache=new SparseArray();res.ColorStateList=ColorStateList;})(res=content.res||(content.res={}));})(content=android.content||(android.content={}));})(android||(android={}));var android;(function(android){var util;(function(util){var TypedValue=function(){function TypedValue(){_classCallCheck(this,TypedValue);}_createClass(TypedValue,null,[{key:'initUnit',value:function initUnit(){this.initUnit=null;var temp=document.createElement('div');document.body.appendChild(temp);temp.style.height=100+TypedValue.COMPLEX_UNIT_PT;TypedValue.UNIT_SCALE_MAP.set(TypedValue.COMPLEX_UNIT_PT,temp.offsetHeight/100);temp.style.height=1+TypedValue.COMPLEX_UNIT_IN;TypedValue.UNIT_SCALE_MAP.set(TypedValue.COMPLEX_UNIT_IN,temp.offsetHeight);temp.style.height=100+TypedValue.COMPLEX_UNIT_MM;TypedValue.UNIT_SCALE_MAP.set(TypedValue.COMPLEX_UNIT_MM,temp.offsetHeight/100);temp.style.height=10+TypedValue.COMPLEX_UNIT_EM;TypedValue.UNIT_SCALE_MAP.set(TypedValue.COMPLEX_UNIT_EM,temp.offsetHeight/10);temp.style.height=10+TypedValue.COMPLEX_UNIT_REM;TypedValue.UNIT_SCALE_MAP.set(TypedValue.COMPLEX_UNIT_REM,temp.offsetHeight/10);document.body.removeChild(temp);}},{key:'applyDimension',value:function applyDimension(unit,size,dm){var scale=1;if(unit===TypedValue.COMPLEX_UNIT_DP||unit===TypedValue.COMPLEX_UNIT_DIP||unit===TypedValue.COMPLEX_UNIT_SP){scale=dm.density;}else{scale=TypedValue.UNIT_SCALE_MAP.get(unit)||1;}return size*scale;}},{key:'isDynamicUnitValue',value:function isDynamicUnitValue(valueWithUnit){if(typeof valueWithUnit!=\"string\")return false;return valueWithUnit.match(TypedValue.COMPLEX_UNIT_VH+'$|'+TypedValue.COMPLEX_UNIT_VW+'$|'+TypedValue.COMPLEX_UNIT_FRACTION+'$')!=null;}},{key:'complexToDimension',value:function complexToDimension(valueWithUnit){var baseValue=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var metrics=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.content.res.Resources.getDisplayMetrics();if(this.initUnit)this.initUnit();if(valueWithUnit===undefined||valueWithUnit===null){throw Error('complexToDimensionPixelSize error: valueWithUnit is '+valueWithUnit);}if(valueWithUnit===''+Number.parseFloat(valueWithUnit))return Number.parseFloat(valueWithUnit);if(typeof valueWithUnit!=='string')valueWithUnit=valueWithUnit+\"\";var scale=1;if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_PX)){valueWithUnit=valueWithUnit.replace(TypedValue.COMPLEX_UNIT_PX,\"\");}else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_DP)){valueWithUnit=valueWithUnit.replace(TypedValue.COMPLEX_UNIT_DP,\"\");scale=metrics.density;}else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_DIP)){valueWithUnit=valueWithUnit.replace(TypedValue.COMPLEX_UNIT_DIP,\"\");scale=metrics.density;}else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_SP)){valueWithUnit=valueWithUnit.replace(TypedValue.COMPLEX_UNIT_SP,\"\");scale=metrics.density*(TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_SP)||1);}else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_PT)){valueWithUnit=valueWithUnit.replace(TypedValue.COMPLEX_UNIT_PT,\"\");scale=TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_PT)||1;}else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_IN)){valueWithUnit=valueWithUnit.replace(TypedValue.COMPLEX_UNIT_IN,\"\");scale=TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_IN)||1;}else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_MM)){valueWithUnit=valueWithUnit.replace(TypedValue.COMPLEX_UNIT_MM,\"\");scale=TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_MM)||1;}else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_EM)){valueWithUnit=valueWithUnit.replace(TypedValue.COMPLEX_UNIT_EM,\"\");scale=TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_EM)||1;}else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_REM)){valueWithUnit=valueWithUnit.replace(TypedValue.COMPLEX_UNIT_REM,\"\");scale=TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_REM)||1;}else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_VH)){valueWithUnit=valueWithUnit.replace(TypedValue.COMPLEX_UNIT_VH,\"\");scale=metrics.heightPixels/100;}else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_VW)){valueWithUnit=valueWithUnit.replace(TypedValue.COMPLEX_UNIT_VW,\"\");scale=metrics.widthPixels/100;}else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_FRACTION)){valueWithUnit=valueWithUnit.replace(TypedValue.COMPLEX_UNIT_FRACTION,\"\");scale=Number.parseFloat(valueWithUnit)/100;if(Number.isNaN(scale))return 0;valueWithUnit=baseValue;}var value=Number.parseFloat(valueWithUnit);if(Number.isNaN(value))throw Error('complexToDimensionPixelSize error: '+valueWithUnit);return value*scale;}},{key:'complexToDimensionPixelOffset',value:function complexToDimensionPixelOffset(valueWithUnit){var baseValue=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var metrics=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.content.res.Resources.getDisplayMetrics();var value=this.complexToDimension(valueWithUnit,baseValue,metrics);return Math.floor(value);}},{key:'complexToDimensionPixelSize',value:function complexToDimensionPixelSize(valueWithUnit){var baseValue=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var metrics=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.content.res.Resources.getDisplayMetrics();var value=this.complexToDimension(valueWithUnit,baseValue,metrics);var res=Math.ceil(value);if(res!=0)return res;if(value==0)return 0;if(value>0)return 1;return-1;}}]);return TypedValue;}();TypedValue.COMPLEX_UNIT_PX='px';TypedValue.COMPLEX_UNIT_DP='dp';TypedValue.COMPLEX_UNIT_DIP='dip';TypedValue.COMPLEX_UNIT_SP='sp';TypedValue.COMPLEX_UNIT_PT='pt';TypedValue.COMPLEX_UNIT_IN='in';TypedValue.COMPLEX_UNIT_MM='mm';TypedValue.COMPLEX_UNIT_EM='em';TypedValue.COMPLEX_UNIT_REM='rem';TypedValue.COMPLEX_UNIT_VH='vh';TypedValue.COMPLEX_UNIT_VW='vw';TypedValue.COMPLEX_UNIT_FRACTION='%';TypedValue.UNIT_SCALE_MAP=new Map();util.TypedValue=TypedValue;})(util=android.util||(android.util={}));})(android||(android={}));var android;(function(android){var view;(function(view){var animation;(function(animation){var LinearInterpolator=function(){function LinearInterpolator(){_classCallCheck(this,LinearInterpolator);}_createClass(LinearInterpolator,[{key:'getInterpolation',value:function getInterpolation(input){return input;}}]);return LinearInterpolator;}();animation.LinearInterpolator=LinearInterpolator;})(animation=view.animation||(view.animation={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var animation;(function(animation){var SystemClock=android.os.SystemClock;var AnimationUtils=function(){function AnimationUtils(){_classCallCheck(this,AnimationUtils);}_createClass(AnimationUtils,null,[{key:'currentAnimationTimeMillis',value:function currentAnimationTimeMillis(){return SystemClock.uptimeMillis();}},{key:'loadAnimation',value:function loadAnimation(context,id){return context.getResources().getAnimation(id);}}]);return AnimationUtils;}();animation.AnimationUtils=AnimationUtils;})(animation=view.animation||(view.animation={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var util;(function(util){var LayoutDirection=function LayoutDirection(){_classCallCheck(this,LayoutDirection);};LayoutDirection.LTR=0;LayoutDirection.RTL=1;LayoutDirection.INHERIT=2;LayoutDirection.LOCALE=3;util.LayoutDirection=LayoutDirection;})(util=android.util||(android.util={}));})(android||(android={}));var java;(function(java){var util;(function(util){var Arrays=function(){function Arrays(){_classCallCheck(this,Arrays);}_createClass(Arrays,null,[{key:'sort',value:function sort(a,fromIndex,toIndex){Arrays.rangeCheck(a.length,fromIndex,toIndex);var sort=androidui.util.ArrayCreator.newNumberArray(toIndex-fromIndex);for(var i=fromIndex;i<toIndex;i++){sort[i-fromIndex]=a[i];}sort.sort(function(a,b){return a>b?1:-1;});for(var _i5=fromIndex;_i5<toIndex;_i5++){a[_i5]=sort[_i5-fromIndex];}}},{key:'rangeCheck',value:function rangeCheck(arrayLength,fromIndex,toIndex){if(fromIndex>toIndex){throw new Error(\"ArrayIndexOutOfBoundsException:fromIndex(\"+fromIndex+\") > toIndex(\"+toIndex+\")\");}if(fromIndex<0){throw new Error('ArrayIndexOutOfBoundsException:'+fromIndex);}if(toIndex>arrayLength){throw new Error('ArrayIndexOutOfBoundsException:'+toIndex);}}},{key:'asList',value:function asList(array){var _list$array;var list=new util.ArrayList();(_list$array=list.array).push.apply(_list$array,_toConsumableArray(array));return list;}},{key:'equals',value:function equals(a,a2){if(a==a2)return true;if(a==null||a2==null)return false;var length=a.length;if(a2.length!=length)return false;for(var i=0;i<length;i++){if(a[i]!=a2[i])return false;}return true;}}]);return Arrays;}();util.Arrays=Arrays;})(util=java.util||(java.util={}));})(java||(java={}));var androidui;(function(androidui){var attr;(function(attr){var StateAttr=function(){function StateAttr(state){_classCallCheck(this,StateAttr);this.attributes=new Map();this.stateSpec=state.concat().sort();}_createClass(StateAttr,[{key:'clone',value:function clone(){var stateAttr=new StateAttr(this.stateSpec);stateAttr.attributes=new Map(this.attributes);return stateAttr;}},{key:'setAttr',value:function setAttr(name,value){this.attributes.set(name,value);}},{key:'hasAttr',value:function hasAttr(name){return this.attributes.has(name);}},{key:'getAttrMap',value:function getAttrMap(){return this.attributes;}},{key:'putAll',value:function putAll(stateAttr){var _iteratorNormalCompletion21=true;var _didIteratorError21=false;var _iteratorError21=undefined;try{for(var _iterator21=stateAttr.attributes.entries()[Symbol.iterator](),_step21;!(_iteratorNormalCompletion21=(_step21=_iterator21.next()).done);_iteratorNormalCompletion21=true){var _step21$value=_slicedToArray(_step21.value,2),key=_step21$value[0],value=_step21$value[1];this.attributes.set(key,value);}}catch(err){_didIteratorError21=true;_iteratorError21=err;}finally{try{if(!_iteratorNormalCompletion21&&_iterator21.return){_iterator21.return();}}finally{if(_didIteratorError21){throw _iteratorError21;}}}}},{key:'isDefaultState',value:function isDefaultState(){return this.stateSpec.length===0;}},{key:'isStateEquals',value:function isStateEquals(state){if(!state)return false;return java.util.Arrays.equals(this.stateSpec,state.concat().sort());}},{key:'isStateMatch',value:function isStateMatch(state){return android.util.StateSet.stateSetMatches(this.stateSpec,state);}},{key:'createDiffKeyAsNullValueAttrMap',value:function createDiffKeyAsNullValueAttrMap(another){if(!another)return this.attributes;var removed=new Map(another.attributes);var _iteratorNormalCompletion22=true;var _didIteratorError22=false;var _iteratorError22=undefined;try{for(var _iterator22=this.attributes.keys()[Symbol.iterator](),_step22;!(_iteratorNormalCompletion22=(_step22=_iterator22.next()).done);_iteratorNormalCompletion22=true){var key=_step22.value;removed.delete(key);}}catch(err){_didIteratorError22=true;_iteratorError22=err;}finally{try{if(!_iteratorNormalCompletion22&&_iterator22.return){_iterator22.return();}}finally{if(_didIteratorError22){throw _iteratorError22;}}}var merge=new Map(this.attributes);var _iteratorNormalCompletion23=true;var _didIteratorError23=false;var _iteratorError23=undefined;try{for(var _iterator23=removed.keys()[Symbol.iterator](),_step23;!(_iteratorNormalCompletion23=(_step23=_iterator23.next()).done);_iteratorNormalCompletion23=true){var _key16=_step23.value;merge.set(_key16,null);}}catch(err){_didIteratorError23=true;_iteratorError23=err;}finally{try{if(!_iteratorNormalCompletion23&&_iterator23.return){_iterator23.return();}}finally{if(_didIteratorError23){throw _iteratorError23;}}}return merge;}}]);return StateAttr;}();attr.StateAttr=StateAttr;})(attr=androidui.attr||(androidui.attr={}));})(androidui||(androidui={}));var STATE_MAP=void 0;var androidui;(function(androidui){var attr;(function(attr){var StateAttrList=function(){function StateAttrList(view){_classCallCheck(this,StateAttrList);this.originStateAttrList=[];this.matchedStateAttrList=[];this.mView=view;this.getOrCreateStateAttr([]);}_createClass(StateAttrList,[{key:'addStatedAttr',value:function addStatedAttr(attrName,attrValue){this.addStatedAttrImpl(attrName,attrValue,[]);}},{key:'addStatedAttrImpl',value:function addStatedAttrImpl(attrName,attrValue,inParseState){var stateValue=StateAttrList.getViewStateValue(attrName);if(stateValue!=null){var newInParseState=inParseState.concat(stateValue).sort();var _stateAttr=this.getOrCreateStateAttr(newInParseState);if(attrValue.startsWith('@')){var styleMap=this.mView.getResources().getStyleAsMap(attrValue);if(styleMap&&styleMap.size>0){var statedEntries=[];var _iteratorNormalCompletion24=true;var _didIteratorError24=false;var _iteratorError24=undefined;try{for(var _iterator24=styleMap.entries()[Symbol.iterator](),_step24;!(_iteratorNormalCompletion24=(_step24=_iterator24.next()).done);_iteratorNormalCompletion24=true){var entry=_step24.value;var _entry=_slicedToArray(entry,2),key=_entry[0],value=_entry[1];if(key.startsWith('android:state_')){statedEntries.push(entry);}else{_stateAttr.setAttr(key.toLowerCase(),value);}}}catch(err){_didIteratorError24=true;_iteratorError24=err;}finally{try{if(!_iteratorNormalCompletion24&&_iterator24.return){_iterator24.return();}}finally{if(_didIteratorError24){throw _iteratorError24;}}}var _iteratorNormalCompletion25=true;var _didIteratorError25=false;var _iteratorError25=undefined;try{for(var _iterator25=statedEntries[Symbol.iterator](),_step25;!(_iteratorNormalCompletion25=(_step25=_iterator25.next()).done);_iteratorNormalCompletion25=true){var _entry2=_step25.value;var _entry3=_slicedToArray(_entry2,2),key=_entry3[0],value=_entry3[1];this.addStatedAttrImpl(key,value,newInParseState);}}catch(err){_didIteratorError25=true;_iteratorError25=err;}finally{try{if(!_iteratorNormalCompletion25&&_iterator25.return){_iterator25.return();}}finally{if(_didIteratorError25){throw _iteratorError25;}}}}}else{var _iteratorNormalCompletion26=true;var _didIteratorError26=false;var _iteratorError26=undefined;try{for(var _iterator26=attrValue.split(';')[Symbol.iterator](),_step26;!(_iteratorNormalCompletion26=(_step26=_iterator26.next()).done);_iteratorNormalCompletion26=true){var part=_step26.value;var _part$split=part.split(':'),_part$split2=_slicedToArray(_part$split,2),name=_part$split2[0],value=_part$split2[1];name=name.trim();if(name){_stateAttr.setAttr('android:'+name.toLowerCase(),value.trim());}}}catch(err){_didIteratorError26=true;_iteratorError26=err;}finally{try{if(!_iteratorNormalCompletion26&&_iterator26.return){_iterator26.return();}}finally{if(_didIteratorError26){throw _iteratorError26;}}}}}}},{key:'getStateAttr',value:function getStateAttr(state){var _iteratorNormalCompletion27=true;var _didIteratorError27=false;var _iteratorError27=undefined;try{for(var _iterator27=this.originStateAttrList[Symbol.iterator](),_step27;!(_iteratorNormalCompletion27=(_step27=_iterator27.next()).done);_iteratorNormalCompletion27=true){var stateAttr=_step27.value;if(stateAttr.isStateEquals(state))return stateAttr;}}catch(err){_didIteratorError27=true;_iteratorError27=err;}finally{try{if(!_iteratorNormalCompletion27&&_iterator27.return){_iterator27.return();}}finally{if(_didIteratorError27){throw _iteratorError27;}}}}},{key:'getOrCreateStateAttr',value:function getOrCreateStateAttr(state){var stateAttr=this.getStateAttr(state);if(!stateAttr){stateAttr=new attr.StateAttr(state);this.originStateAttrList.push(stateAttr);}return stateAttr;}},{key:'getMatchedStateAttr',value:function getMatchedStateAttr(state){if(state==null)return null;var _iteratorNormalCompletion28=true;var _didIteratorError28=false;var _iteratorError28=undefined;try{for(var _iterator28=this.matchedStateAttrList[Symbol.iterator](),_step28;!(_iteratorNormalCompletion28=(_step28=_iterator28.next()).done);_iteratorNormalCompletion28=true){var stateAttr=_step28.value;if(stateAttr.isStateEquals(state))return stateAttr;}}catch(err){_didIteratorError28=true;_iteratorError28=err;}finally{try{if(!_iteratorNormalCompletion28&&_iterator28.return){_iterator28.return();}}finally{if(_didIteratorError28){throw _iteratorError28;}}}var matchedAttr=new attr.StateAttr(state);var _iteratorNormalCompletion29=true;var _didIteratorError29=false;var _iteratorError29=undefined;try{for(var _iterator29=this.originStateAttrList[Symbol.iterator](),_step29;!(_iteratorNormalCompletion29=(_step29=_iterator29.next()).done);_iteratorNormalCompletion29=true){var _stateAttr2=_step29.value;if(_stateAttr2.isDefaultState())continue;if(_stateAttr2.isStateMatch(state)){matchedAttr.putAll(_stateAttr2);}}}catch(err){_didIteratorError29=true;_iteratorError29=err;}finally{try{if(!_iteratorNormalCompletion29&&_iterator29.return){_iterator29.return();}}finally{if(_didIteratorError29){throw _iteratorError29;}}}this.matchedStateAttrList.push(matchedAttr);return matchedAttr;}},{key:'removeAttrAllState',value:function removeAttrAllState(attrName){var _iteratorNormalCompletion30=true;var _didIteratorError30=false;var _iteratorError30=undefined;try{for(var _iterator30=this.originStateAttrList[Symbol.iterator](),_step30;!(_iteratorNormalCompletion30=(_step30=_iterator30.next()).done);_iteratorNormalCompletion30=true){var stateAttr=_step30.value;stateAttr.getAttrMap().delete(attrName);}}catch(err){_didIteratorError30=true;_iteratorError30=err;}finally{try{if(!_iteratorNormalCompletion30&&_iterator30.return){_iterator30.return();}}finally{if(_didIteratorError30){throw _iteratorError30;}}}var _iteratorNormalCompletion31=true;var _didIteratorError31=false;var _iteratorError31=undefined;try{for(var _iterator31=this.matchedStateAttrList[Symbol.iterator](),_step31;!(_iteratorNormalCompletion31=(_step31=_iterator31.next()).done);_iteratorNormalCompletion31=true){var _stateAttr3=_step31.value;_stateAttr3.getAttrMap().delete(attrName);}}catch(err){_didIteratorError31=true;_iteratorError31=err;}finally{try{if(!_iteratorNormalCompletion31&&_iterator31.return){_iterator31.return();}}finally{if(_didIteratorError31){throw _iteratorError31;}}}}}],[{key:'getViewStateValue',value:function getViewStateValue(attrName){if(!STATE_MAP){STATE_MAP=new Map().set('state_window_focused',android.view.View.VIEW_STATE_WINDOW_FOCUSED).set('state_selected',android.view.View.VIEW_STATE_SELECTED).set('state_focused',android.view.View.VIEW_STATE_FOCUSED).set('state_enabled',android.view.View.VIEW_STATE_ENABLED).set('state_disabled',-android.view.View.VIEW_STATE_ENABLED).set('state_pressed',android.view.View.VIEW_STATE_PRESSED).set('state_activated',android.view.View.VIEW_STATE_ACTIVATED).set('state_hovered',android.view.View.VIEW_STATE_HOVERED).set('state_checked',android.view.View.VIEW_STATE_CHECKED);}return STATE_MAP.get(attrName.split(':').pop());}}]);return StateAttrList;}();attr.StateAttrList=StateAttrList;})(attr=androidui.attr||(androidui.attr={}));})(androidui||(androidui={}));function fixDefaultNamespaceAndLowerCase(key){key=key.toLowerCase();if(!key.includes(':'))key='android:'+key;return key;}var androidui;(function(androidui){var attr;(function(attr){var Gravity=android.view.Gravity;var Drawable=android.graphics.drawable.Drawable;var Color=android.graphics.Color;var ColorStateList=android.content.res.ColorStateList;var Resources=android.content.res.Resources;var AttrBinder=function(){function AttrBinder(host){_classCallCheck(this,AttrBinder);this.objectRefs=[];this.host=host;}_createClass(AttrBinder,[{key:'setClassAttrBind',value:function setClassAttrBind(classAttrBind){if(classAttrBind){this.classAttrBindMap=classAttrBind;}}},{key:'addAttr',value:function addAttr(attrName,onAttrChange,stashAttrValueWhenStateChange){if(!attrName)return;attrName=fixDefaultNamespaceAndLowerCase(attrName);if(onAttrChange){if(!this.attrChangeMap){this.attrChangeMap=new Map();}this.attrChangeMap.set(attrName,onAttrChange);}if(stashAttrValueWhenStateChange){this.attrStashMap=new Map();this.attrStashMap.set(attrName,stashAttrValueWhenStateChange);}}},{key:'onAttrChange',value:function onAttrChange(attrName,attrValue,context){this.mContext=context;if(!attrName)return;attrName=fixDefaultNamespaceAndLowerCase(attrName);var onAttrChangeCall=this.attrChangeMap&&this.attrChangeMap.get(attrName);if(onAttrChangeCall){onAttrChangeCall.call(this.host,attrValue,this.host);}if(this.classAttrBindMap){this.classAttrBindMap.callSetter(attrName,this.host,attrValue,this);}}},{key:'getAttrValue',value:function getAttrValue(attrName){if(!attrName)return undefined;attrName=fixDefaultNamespaceAndLowerCase(attrName);var getAttrCall=this.attrStashMap&&this.attrStashMap.get(attrName);var value=void 0;if(getAttrCall){value=getAttrCall.call(this.host);}else if(this.classAttrBindMap){value=this.classAttrBindMap.callGetter(attrName,this.host);}if(value==null)return null;if(typeof value===\"number\"||typeof value===\"boolean\"||typeof value===\"string\")return value+'';return this.setRefObject(value);}},{key:'getRefObject',value:function getRefObject(ref){if(ref&&ref.startsWith('@ref/')){ref=ref.substring('@ref/'.length);var index=Number.parseInt(ref);if(Number.isInteger(index)){return this.objectRefs[index];}}}},{key:'setRefObject',value:function setRefObject(obj){var index=this.objectRefs.indexOf(obj);if(index>=0)return'@ref/'+index;this.objectRefs.push(obj);return'@ref/'+(this.objectRefs.length-1);}},{key:'parsePaddingMarginTRBL',value:function parsePaddingMarginTRBL(value){var _this16=this;value=value+'';var parts=[];var _iteratorNormalCompletion32=true;var _didIteratorError32=false;var _iteratorError32=undefined;try{for(var _iterator32=value.split(' ')[Symbol.iterator](),_step32;!(_iteratorNormalCompletion32=(_step32=_iterator32.next()).done);_iteratorNormalCompletion32=true){var part=_step32.value;if(part)parts.push(part);}}catch(err){_didIteratorError32=true;_iteratorError32=err;}finally{try{if(!_iteratorNormalCompletion32&&_iterator32.return){_iterator32.return();}}finally{if(_didIteratorError32){throw _iteratorError32;}}}var trbl=void 0;switch(parts.length){case 1:trbl=[parts[0],parts[0],parts[0],parts[0]];break;case 2:trbl=[parts[0],parts[1],parts[0],parts[1]];break;case 3:trbl=[parts[0],parts[1],parts[2],parts[1]];break;case 4:trbl=[parts[0],parts[1],parts[2],parts[3]];break;}if(trbl){return trbl.map(function(v){return _this16.parseDimension(v);});}throw Error('not a padding or margin value : '+value);}},{key:'parseEnum',value:function parseEnum(value,enumMap,defaultValue){if(Number.isInteger(value)){return value;}if(enumMap.has(value)){return enumMap.get(value);}return defaultValue;}},{key:'parseBoolean',value:function parseBoolean(value){var defaultValue=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;if(value===false)return false;else if(value===true)return true;var res=this.mContext?this.mContext.getResources():Resources.getSystem();if(typeof value===\"string\"){return attr.AttrValueParser.parseBoolean(res,value,defaultValue);}return defaultValue;}},{key:'parseGravity',value:function parseGravity(s){var defaultValue=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Gravity.NO_GRAVITY;var gravity=Number.parseInt(s);if(Number.isInteger(gravity))return gravity;return Gravity.parseGravity(s,defaultValue);}},{key:'parseDrawable',value:function parseDrawable(s){if(!s)return null;if(s instanceof Drawable)return s;if(s.startsWith('@ref/')){var refObj=this.getRefObject(s);if(refObj)return refObj;}var res=this.mContext?this.mContext.getResources():Resources.getSystem();s=(s+'').trim();return attr.AttrValueParser.parseDrawable(res,s);}},{key:'parseColor',value:function parseColor(value,defaultValue){var color=Number.parseInt(value);if(Number.isInteger(color))return color;var res=this.mContext?this.mContext.getResources():Resources.getSystem();color=attr.AttrValueParser.parseColor(res,value,defaultValue);if(isNaN(color)){return Color.BLACK;}return color;}},{key:'parseColorList',value:function parseColorList(value){if(!value)return null;if(value instanceof ColorStateList)return value;if(typeof value=='number')return ColorStateList.valueOf(value);if(value.startsWith('@ref/')){var refObj=this.getRefObject(value);if(refObj)return refObj;}var res=this.mContext?this.mContext.getResources():Resources.getSystem();return attr.AttrValueParser.parseColorStateList(res,value);}},{key:'parseInt',value:function parseInt(value){var defaultValue=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(typeof value=='number')return value;var res=this.mContext?this.mContext.getResources():Resources.getSystem();return attr.AttrValueParser.parseInt(res,value,defaultValue);}},{key:'parseFloat',value:function parseFloat(value){var defaultValue=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(typeof value=='number')return value;var res=this.mContext?this.mContext.getResources():Resources.getSystem();return attr.AttrValueParser.parseFloat(res,value,defaultValue);}},{key:'parseDimension',value:function parseDimension(value){var defaultValue=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var baseValue=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;if(typeof value=='number')return value;var res=this.mContext?this.mContext.getResources():Resources.getSystem();return attr.AttrValueParser.parseDimension(res,value,defaultValue,baseValue);}},{key:'parseNumberPixelOffset',value:function parseNumberPixelOffset(value){var defaultValue=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var baseValue=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;if(typeof value=='number')return value;var res=this.mContext?this.mContext.getResources():Resources.getSystem();return attr.AttrValueParser.parseDimensionPixelOffset(res,value,defaultValue,baseValue);}},{key:'parseNumberPixelSize',value:function parseNumberPixelSize(value){var defaultValue=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var baseValue=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;if(typeof value=='number')return value;var res=this.mContext?this.mContext.getResources():Resources.getSystem();return attr.AttrValueParser.parseDimensionPixelSize(res,value,defaultValue,baseValue);}},{key:'parseString',value:function parseString(value,defaultValue){var res=this.mContext?this.mContext.getResources():Resources.getSystem();if(typeof value==='string'){return attr.AttrValueParser.parseString(res,value,defaultValue);}return defaultValue;}},{key:'parseStringArray',value:function parseStringArray(value){if(typeof value==='string'){if(value.startsWith('@ref/')){var refObj=this.getRefObject(value);if(refObj)return refObj;}var res=this.mContext?this.mContext.getResources():Resources.getSystem();return attr.AttrValueParser.parseTextArray(res,value);}return null;}}]);return AttrBinder;}();attr.AttrBinder=AttrBinder;(function(AttrBinder){var ClassBinderMap=function(){function ClassBinderMap(copyBinderMap){_classCallCheck(this,ClassBinderMap);this.binderMap=new Map(copyBinderMap);}_createClass(ClassBinderMap,[{key:'set',value:function set(key,value){key=fixDefaultNamespaceAndLowerCase(key);this.binderMap.set(key,value);return this;}},{key:'get',value:function get(key){key=fixDefaultNamespaceAndLowerCase(key);return this.binderMap.get(key);}},{key:'callSetter',value:function callSetter(attrName,host,attrValue,attrBinder){if(!attrName)return;var value=this.get(attrName);if(value){value.setter.call(host,host,attrValue,attrBinder);}}},{key:'callGetter',value:function callGetter(attrName,host){if(!attrName)return;var value=this.get(attrName);if(value){return value.getter.call(host,host);}}}]);return ClassBinderMap;}();AttrBinder.ClassBinderMap=ClassBinderMap;})(AttrBinder=attr.AttrBinder||(attr.AttrBinder={}));})(attr=androidui.attr||(androidui.attr={}));})(androidui||(androidui={}));var androidui;(function(androidui){var util;(function(util){var ColorDrawable=android.graphics.drawable.ColorDrawable;var Color=android.graphics.Color;var PerformanceAdjuster=function(){function PerformanceAdjuster(){_classCallCheck(this,PerformanceAdjuster);}_createClass(PerformanceAdjuster,null,[{key:'noCanvasMode',value:function noCanvasMode(){android.graphics.Canvas.prototype=HackCanvas.prototype;android.view.View.prototype.onDrawVerticalScrollBar=function(canvas,scrollBar,l,t,r,b){var scrollBarEl=this.bindElement['VerticalScrollBar'];if(!scrollBarEl){scrollBarEl=document.createElement('div');this.bindElement['VerticalScrollBar']=scrollBarEl;scrollBarEl.style.zIndex='9';scrollBarEl.style.position='absolute';scrollBarEl.style.background='black';scrollBarEl.style.left='0px';scrollBarEl.style.top='0px';this.bindElement.appendChild(scrollBarEl);}var height=b-t;var width=r-l;var size=height;var thickness=width;var extent=this.mScrollCache.scrollBar.mExtent;var range=this.mScrollCache.scrollBar.mRange;var length=Math.round(size*extent/range);var offset=Math.round((size-length)*this.mScrollCache.scrollBar.mOffset/(range-extent));if(t<0)t=0;if(offset<0)offset=0;scrollBarEl.style.transform=scrollBarEl.style.webkitTransform='translate('+l+'px, '+(t+offset)+'px)';scrollBarEl.style.width=(r-l)/2+'px';scrollBarEl.style.height=length+'px';scrollBarEl.style.opacity=this.mScrollCache.scrollBar.mVerticalThumb.getAlpha()/255+'';};var oldSetBackground=android.view.View.prototype.setBackground;android.view.View.prototype.setBackground=function(drawable){oldSetBackground.call(this,drawable);if(drawable instanceof ColorDrawable){this.bindElement.style.background=Color.toRGBAFunc(this.mBackground.getColor());}};}}]);return PerformanceAdjuster;}();util.PerformanceAdjuster=PerformanceAdjuster;var HackCanvas=function(_android$graphics$Can){_inherits(HackCanvas,_android$graphics$Can);function HackCanvas(){_classCallCheck(this,HackCanvas);return _possibleConstructorReturn(this,(HackCanvas.__proto__||Object.getPrototypeOf(HackCanvas)).apply(this,arguments));}_createClass(HackCanvas,[{key:'init',value:function init(){}},{key:'recycle',value:function recycle(){}},{key:'translate',value:function translate(dx,dy){}},{key:'scale',value:function scale(sx,sy,px,py){}},{key:'rotate',value:function rotate(degrees,px,py){}},{key:'drawRGB',value:function drawRGB(r,g,b){}},{key:'drawARGB',value:function drawARGB(a,r,g,b){}},{key:'drawColor',value:function drawColor(color){}},{key:'clearColor',value:function clearColor(){}},{key:'save',value:function save(){return 1;}},{key:'restore',value:function restore(){}},{key:'restoreToCount',value:function restoreToCount(saveCount){}},{key:'getSaveCount',value:function getSaveCount(){return 1;}},{key:'clipRect',value:function clipRect(){return false;}},{key:'getClipBounds',value:function getClipBounds(bounds){return null;}},{key:'quickReject',value:function quickReject(){return false;}},{key:'drawCanvas',value:function drawCanvas(canvas,offsetX,offsetY){}},{key:'drawRect',value:function drawRect(){}},{key:'drawText',value:function drawText(text,x,y,paint){}}]);return HackCanvas;}(android.graphics.Canvas);})(util=androidui.util||(androidui.util={}));})(androidui||(androidui={}));var androidui;(function(androidui){var image;(function(image_1){var Paint=android.graphics.Paint;var Rect=android.graphics.Rect;var Drawable=android.graphics.drawable.Drawable;var NetDrawable=function(_Drawable2){_inherits(NetDrawable,_Drawable2);function NetDrawable(src,paint,overrideImageRatio){_classCallCheck(this,NetDrawable);var _this18=_possibleConstructorReturn(this,(NetDrawable.__proto__||Object.getPrototypeOf(NetDrawable)).call(this));_this18.mImageWidth=0;_this18.mImageHeight=0;var image=void 0;if(src instanceof image_1.NetImage){image=src;if(overrideImageRatio)image.mOverrideImageRatio=overrideImageRatio;}else{image=new image_1.NetImage(src,overrideImageRatio);}image.addLoadListener(function(){return _this18.onLoad();},function(){return _this18.onError();});_this18.mState=new State(image,paint);if(image.isImageLoaded())_this18.initBoundWithLoadedImage(image);return _this18;}_createClass(NetDrawable,[{key:'initBoundWithLoadedImage',value:function initBoundWithLoadedImage(image){var imageRatio=image.getImageRatio();this.mImageWidth=Math.floor(image.width/imageRatio*android.content.res.Resources.getDisplayMetrics().density);this.mImageHeight=Math.floor(image.height/imageRatio*android.content.res.Resources.getDisplayMetrics().density);}},{key:'setURL',value:function setURL(url){var hiddenWhenLoading=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;if(hiddenWhenLoading){this.mImageWidth=this.mImageHeight=0;}this.mState.mImage.src=url;}},{key:'draw',value:function draw(canvas){if(!this.isImageSizeEmpty()){var emptyTileX=this.mTileModeX==null||this.mTileModeX==NetDrawable.TileMode.DEFAULT;var emptyTileY=this.mTileModeY==null||this.mTileModeY==NetDrawable.TileMode.DEFAULT;if(emptyTileX&&emptyTileY){canvas.drawImage(this.mState.mImage,null,this.getBounds(),this.mState.paint);}else{this.drawTile(canvas);}}}},{key:'drawTile',value:function drawTile(canvas){var imageWidth=this.mImageWidth;var imageHeight=this.mImageHeight;if(imageHeight<=0||imageWidth<=0)return;var tileX=this.mTileModeX;var tileY=this.mTileModeY;var bound=this.getBounds();if(this.mTmpTileBound==null)this.mTmpTileBound=new Rect();var tmpBound=this.mTmpTileBound;tmpBound.setEmpty();function drawColumn(){if(tileY===NetDrawable.TileMode.REPEAT){tmpBound.bottom=imageHeight;while(tmpBound.isEmpty()||tmpBound.intersects(bound)){canvas.drawImage(this.mState.mImage,null,tmpBound,this.mState.paint);tmpBound.offset(0,imageHeight);}}else{tmpBound.bottom=bound.height();canvas.drawImage(this.mState.mImage,null,tmpBound,this.mState.paint);}}if(tileX===NetDrawable.TileMode.REPEAT){tmpBound.right=imageWidth;while(tmpBound.isEmpty()||tmpBound.intersects(bound)){drawColumn.call(this);tmpBound.offset(imageWidth,-tmpBound.top);}}else{tmpBound.right=bound.width();drawColumn.call(this);}}},{key:'setAlpha',value:function setAlpha(alpha){this.mState.paint.setAlpha(alpha);}},{key:'getAlpha',value:function getAlpha(){return this.mState.paint.getAlpha();}},{key:'getIntrinsicWidth',value:function getIntrinsicWidth(){return this.mImageWidth;}},{key:'getIntrinsicHeight',value:function getIntrinsicHeight(){return this.mImageHeight;}},{key:'onLoad',value:function onLoad(){this.initBoundWithLoadedImage(this.mState.mImage);if(this.mLoadListener)this.mLoadListener.onLoad(this);this.invalidateSelf();this.notifySizeChangeSelf();}},{key:'onError',value:function onError(){this.mImageWidth=this.mImageHeight=0;if(this.mLoadListener)this.mLoadListener.onError(this);this.invalidateSelf();this.notifySizeChangeSelf();}},{key:'isImageSizeEmpty',value:function isImageSizeEmpty(){return this.mImageWidth<=0||this.mImageHeight<=0;}},{key:'getImage',value:function getImage(){return this.mState.mImage;}},{key:'setLoadListener',value:function setLoadListener(loadListener){this.mLoadListener=loadListener;}},{key:'setTileMode',value:function setTileMode(tileX,tileY){this.mTileModeX=tileX;this.mTileModeY=tileY;this.invalidateSelf();}},{key:'getConstantState',value:function getConstantState(){return this.mState;}}]);return NetDrawable;}(Drawable);image_1.NetDrawable=NetDrawable;(function(NetDrawable){var TileMode;(function(TileMode){TileMode[TileMode[\"DEFAULT\"]=0]=\"DEFAULT\";TileMode[TileMode[\"REPEAT\"]=1]=\"REPEAT\";})(TileMode=NetDrawable.TileMode||(NetDrawable.TileMode={}));})(NetDrawable=image_1.NetDrawable||(image_1.NetDrawable={}));var State=function(){function State(image){var paint=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new Paint();_classCallCheck(this,State);this.mImage=image;this.paint=new Paint();if(paint!=null)this.paint.set(paint);}_createClass(State,[{key:'newDrawable',value:function newDrawable(){return new NetDrawable(this.mImage.src,this.paint);}}]);return State;}();})(image=androidui.image||(androidui.image={}));})(androidui||(androidui={}));var androidui;(function(androidui){var util;(function(util){var Platform=function Platform(){_classCallCheck(this,Platform);};Platform.isIOS=navigator.userAgent.match(/(iPhone|iPad|iPod|ios)/i)?true:false;Platform.isAndroid=navigator.userAgent.match('Android')?true:false;Platform.isWeChat=navigator.userAgent.match(/MicroMessenger/i)?true:false;util.Platform=Platform;})(util=androidui.util||(androidui.util={}));})(androidui||(androidui={}));var android;(function(android){var view;(function(view){var SystemClock=android.os.SystemClock;var Log=android.util.Log;var Platform=androidui.util.Platform;var DEBUG=false;var TAG=\"KeyEvent\";var KeyEvent=function(){function KeyEvent(){_classCallCheck(this,KeyEvent);this._downingKeyEventMap=new Map();}_createClass(KeyEvent,[{key:'initKeyEvent',value:function initKeyEvent(keyEvent,action){this.mEventTime=SystemClock.uptimeMillis();this.mKeyCode=keyEvent.keyCode;this.mAltKey=keyEvent.altKey;this.mShiftKey=keyEvent.shiftKey;this.mCtrlKey=keyEvent.ctrlKey;this.mMetaKey=keyEvent.metaKey;var keyIdentifier=keyEvent['keyIdentifier']+'';if(keyIdentifier){this.mIsTypingKey=keyIdentifier.startsWith('U+');if(this.mIsTypingKey){this.mKeyCode=Number.parseInt(keyIdentifier.substr(2),16)||this.mKeyCode;}}if(this.mKeyCode>=KeyEvent.KEYCODE_Key_a&&this.mKeyCode<=KeyEvent.KEYCODE_Key_z&&this.mShiftKey&&!this.mCtrlKey&&!this.mAltKey&&!this.mMetaKey){this.mKeyCode-=32;}if(this.mKeyCode>=KeyEvent.KEYCODE_KeyA&&this.mKeyCode<=KeyEvent.KEYCODE_KeyZ&&!this.mShiftKey&&!this.mCtrlKey&&!this.mAltKey&&!this.mMetaKey){this.mKeyCode+=32;}if(Platform.isAndroid){if(!this.mShiftKey&&!this.mCtrlKey&&!this.mAltKey&&!this.mMetaKey){this.mKeyCode=KeyEvent.KEYCODE_CHANGE_ANDROID_CHROME.noMeta[this.mKeyCode]||this.mKeyCode;}else if(this.mShiftKey&&!this.mCtrlKey&&!this.mAltKey&&!this.mMetaKey){this.mKeyCode=KeyEvent.KEYCODE_CHANGE_ANDROID_CHROME.shift[this.mKeyCode]||this.mKeyCode;}else if(!this.mShiftKey&&this.mCtrlKey&&!this.mAltKey&&!this.mMetaKey){this.mKeyCode=KeyEvent.KEYCODE_CHANGE_ANDROID_CHROME.ctrl[this.mKeyCode]||this.mKeyCode;}else if(!this.mShiftKey&&!this.mCtrlKey&&this.mAltKey&&!this.mMetaKey){this.mKeyCode=KeyEvent.KEYCODE_CHANGE_ANDROID_CHROME.alt[this.mKeyCode]||this.mKeyCode;}}this.mKeyCode=KeyEvent.FIX_MAP_KEYCODE[this.mKeyCode]||this.mKeyCode;if(action===KeyEvent.ACTION_DOWN){this.mDownTime=SystemClock.uptimeMillis();var keyEvents=this._downingKeyEventMap.get(keyEvent.keyCode);if(keyEvents==null){keyEvents=[];this._downingKeyEventMap.set(keyEvent.keyCode,keyEvents);}keyEvents.push(keyEvent);}else if(action===KeyEvent.ACTION_UP){this._downingKeyEventMap.delete(keyEvent.keyCode);}this.mAction=action;}},{key:'isAltPressed',value:function isAltPressed(){return this.mAltKey;}},{key:'isShiftPressed',value:function isShiftPressed(){return this.mShiftKey;}},{key:'isCtrlPressed',value:function isCtrlPressed(){return this.mCtrlKey;}},{key:'isMetaPressed',value:function isMetaPressed(){return this.mMetaKey;}},{key:'getAction',value:function getAction(){return this.mAction;}},{key:'startTracking',value:function startTracking(){this.mFlags|=KeyEvent.FLAG_START_TRACKING;}},{key:'isTracking',value:function isTracking(){return(this.mFlags&KeyEvent.FLAG_TRACKING)!=0;}},{key:'isLongPress',value:function isLongPress(){return this.getRepeatCount()===1;}},{key:'getKeyCode',value:function getKeyCode(){return this.mKeyCode;}},{key:'getRepeatCount',value:function getRepeatCount(){var downArray=this._downingKeyEventMap.get(this.mKeyCode);return downArray?downArray.length-1:0;}},{key:'getDownTime',value:function getDownTime(){return this.mDownTime;}},{key:'getEventTime',value:function getEventTime(){return this.mEventTime;}},{key:'dispatch',value:function dispatch(receiver,state,target){switch(this.mAction){case KeyEvent.ACTION_DOWN:{this.mFlags&=~KeyEvent.FLAG_START_TRACKING;if(DEBUG)Log.v(TAG,\"Key down to \"+target+\" in \"+state+\": \"+this);var res=receiver.onKeyDown(this.getKeyCode(),this);if(state!=null){if(res&&this.getRepeatCount()==0&&(this.mFlags&KeyEvent.FLAG_START_TRACKING)!=0){if(DEBUG)Log.v(TAG,\"  Start tracking!\");state.startTracking(this,target);}else if(this.isLongPress()&&state.isTracking(this)){if(receiver.onKeyLongPress(this.getKeyCode(),this)){if(DEBUG)Log.v(TAG,\"  Clear from long press!\");state.performedLongPress(this);res=true;}}}return res;}case KeyEvent.ACTION_UP:if(DEBUG)Log.v(TAG,\"Key up to \"+target+\" in \"+state+\": \"+this);if(state!=null){state.handleUpEvent(this);}return receiver.onKeyUp(this.getKeyCode(),this);}return false;}},{key:'hasNoModifiers',value:function hasNoModifiers(){if(this.isAltPressed())return false;if(this.isShiftPressed())return false;if(this.isCtrlPressed())return false;if(this.isMetaPressed())return false;return true;}},{key:'hasModifiers',value:function hasModifiers(modifiers){if((modifiers&KeyEvent.META_ALT_ON)===KeyEvent.META_ALT_ON&&this.isAltPressed())return true;if((modifiers&KeyEvent.META_SHIFT_ON)===KeyEvent.META_SHIFT_ON&&this.isShiftPressed())return true;if((modifiers&KeyEvent.META_META_ON)===KeyEvent.META_META_ON&&this.isMetaPressed())return true;if((modifiers&KeyEvent.META_CTRL_ON)===KeyEvent.META_CTRL_ON&&this.isCtrlPressed())return true;}},{key:'getMetaState',value:function getMetaState(){var meta=0;if(this.isAltPressed())meta|=KeyEvent.META_ALT_ON;if(this.isShiftPressed())meta|=KeyEvent.META_SHIFT_ON;if(this.isCtrlPressed())meta|=KeyEvent.META_CTRL_ON;if(this.isMetaPressed())meta|=KeyEvent.META_META_ON;return meta;}},{key:'toString',value:function toString(){return JSON.stringify(this);}},{key:'isCanceled',value:function isCanceled(){return false;}}],[{key:'obtain',value:function obtain(action,code){var ev=new KeyEvent();ev.mDownTime=SystemClock.uptimeMillis();ev.mEventTime=SystemClock.uptimeMillis();ev.mAction=action;ev.mKeyCode=code;return ev;}},{key:'isConfirmKey',value:function isConfirmKey(keyCode){switch(keyCode){case KeyEvent.KEYCODE_DPAD_CENTER:case KeyEvent.KEYCODE_ENTER:return true;default:return false;}}},{key:'actionToString',value:function actionToString(action){switch(action){case KeyEvent.ACTION_DOWN:return\"ACTION_DOWN\";case KeyEvent.ACTION_UP:return\"ACTION_UP\";default:return''+action;}}},{key:'keyCodeToString',value:function keyCodeToString(keyCode){return String.fromCharCode(keyCode);}}]);return KeyEvent;}();KeyEvent.KEYCODE_DPAD_UP=38;KeyEvent.KEYCODE_DPAD_DOWN=40;KeyEvent.KEYCODE_DPAD_LEFT=37;KeyEvent.KEYCODE_DPAD_RIGHT=39;KeyEvent.KEYCODE_DPAD_CENTER=13;KeyEvent.KEYCODE_ENTER=13;KeyEvent.KEYCODE_TAB=9;KeyEvent.KEYCODE_SPACE=32;KeyEvent.KEYCODE_ESCAPE=27;KeyEvent.KEYCODE_Backspace=8;KeyEvent.KEYCODE_PAGE_UP=33;KeyEvent.KEYCODE_PAGE_DOWN=34;KeyEvent.KEYCODE_MOVE_HOME=36;KeyEvent.KEYCODE_MOVE_END=35;KeyEvent.KEYCODE_Digit0=48;KeyEvent.KEYCODE_Digit1=49;KeyEvent.KEYCODE_Digit2=50;KeyEvent.KEYCODE_Digit3=51;KeyEvent.KEYCODE_Digit4=52;KeyEvent.KEYCODE_Digit5=53;KeyEvent.KEYCODE_Digit6=54;KeyEvent.KEYCODE_Digit7=55;KeyEvent.KEYCODE_Digit8=56;KeyEvent.KEYCODE_Digit9=57;KeyEvent.KEYCODE_Key_a=65;KeyEvent.KEYCODE_Key_b=66;KeyEvent.KEYCODE_Key_c=67;KeyEvent.KEYCODE_Key_d=68;KeyEvent.KEYCODE_Key_e=69;KeyEvent.KEYCODE_Key_f=70;KeyEvent.KEYCODE_Key_g=71;KeyEvent.KEYCODE_Key_h=72;KeyEvent.KEYCODE_Key_i=73;KeyEvent.KEYCODE_Key_j=74;KeyEvent.KEYCODE_Key_k=75;KeyEvent.KEYCODE_Key_l=76;KeyEvent.KEYCODE_Key_m=77;KeyEvent.KEYCODE_Key_n=78;KeyEvent.KEYCODE_Key_o=79;KeyEvent.KEYCODE_Key_p=80;KeyEvent.KEYCODE_Key_q=81;KeyEvent.KEYCODE_Key_r=82;KeyEvent.KEYCODE_Key_s=83;KeyEvent.KEYCODE_Key_t=84;KeyEvent.KEYCODE_Key_u=85;KeyEvent.KEYCODE_Key_v=86;KeyEvent.KEYCODE_Key_w=87;KeyEvent.KEYCODE_Key_x=88;KeyEvent.KEYCODE_Key_y=89;KeyEvent.KEYCODE_Key_z=90;KeyEvent.KEYCODE_KeyA=0x41;KeyEvent.KEYCODE_KeyB=0x42;KeyEvent.KEYCODE_KeyC=0x43;KeyEvent.KEYCODE_KeyD=0x44;KeyEvent.KEYCODE_KeyE=0x45;KeyEvent.KEYCODE_KeyF=0x46;KeyEvent.KEYCODE_KeyG=0x47;KeyEvent.KEYCODE_KeyH=0x48;KeyEvent.KEYCODE_KeyI=0x49;KeyEvent.KEYCODE_KeyJ=0x4a;KeyEvent.KEYCODE_KeyK=0x4b;KeyEvent.KEYCODE_KeyL=0x4c;KeyEvent.KEYCODE_KeyM=0x4d;KeyEvent.KEYCODE_KeyN=0x4e;KeyEvent.KEYCODE_KeyO=0x4f;KeyEvent.KEYCODE_KeyP=0x50;KeyEvent.KEYCODE_KeyQ=0x51;KeyEvent.KEYCODE_KeyR=0x52;KeyEvent.KEYCODE_KeyS=0x53;KeyEvent.KEYCODE_KeyT=0x54;KeyEvent.KEYCODE_KeyU=0x55;KeyEvent.KEYCODE_KeyV=0x56;KeyEvent.KEYCODE_KeyW=0x57;KeyEvent.KEYCODE_KeyX=0x58;KeyEvent.KEYCODE_KeyY=0x59;KeyEvent.KEYCODE_KeyZ=0x5a;KeyEvent.KEYCODE_Semicolon=0x3b;KeyEvent.KEYCODE_LessThan=0x3c;KeyEvent.KEYCODE_Equal=0x3d;KeyEvent.KEYCODE_MoreThan=0x3e;KeyEvent.KEYCODE_Question=0x3f;KeyEvent.KEYCODE_Comma=0x2c;KeyEvent.KEYCODE_Period=0x2e;KeyEvent.KEYCODE_Slash=0x2f;KeyEvent.KEYCODE_Quotation=0x27;KeyEvent.KEYCODE_LeftBracket=0x5b;KeyEvent.KEYCODE_Backslash=0x5c;KeyEvent.KEYCODE_RightBracket=0x5d;KeyEvent.KEYCODE_Minus=0x2d;KeyEvent.KEYCODE_Colon=0x3a;KeyEvent.KEYCODE_Double_Quotation=0x22;KeyEvent.KEYCODE_Backquote=0x60;KeyEvent.KEYCODE_Tilde=0x7e;KeyEvent.KEYCODE_Left_Brace=0x7b;KeyEvent.KEYCODE_Or=0x7c;KeyEvent.KEYCODE_Right_Brace=0x7d;KeyEvent.KEYCODE_Del=0x7f;KeyEvent.KEYCODE_Exclamation=0x21;KeyEvent.KEYCODE_Right_Parenthesis=0x29;KeyEvent.KEYCODE_AT=0x40;KeyEvent.KEYCODE_Sharp=0x23;KeyEvent.KEYCODE_Dollar=0x24;KeyEvent.KEYCODE_Percent=0x25;KeyEvent.KEYCODE_Power=0x5e;KeyEvent.KEYCODE_And=0x26;KeyEvent.KEYCODE_Asterisk=0x2a;KeyEvent.KEYCODE_Left_Parenthesis=0x28;KeyEvent.KEYCODE_Underline=0x5f;KeyEvent.KEYCODE_Add=0x2b;KeyEvent.KEYCODE_BACK=-1;KeyEvent.KEYCODE_MENU=-2;KeyEvent.KEYCODE_CHANGE_ANDROID_CHROME={noMeta:{186:KeyEvent.KEYCODE_Semicolon,187:KeyEvent.KEYCODE_Equal,188:KeyEvent.KEYCODE_Comma,189:KeyEvent.KEYCODE_Minus,190:KeyEvent.KEYCODE_Period,191:KeyEvent.KEYCODE_Slash,192:KeyEvent.KEYCODE_Quotation,219:KeyEvent.KEYCODE_LeftBracket,220:KeyEvent.KEYCODE_Backslash,221:KeyEvent.KEYCODE_RightBracket},shift:{186:KeyEvent.KEYCODE_Colon,187:KeyEvent.KEYCODE_Add,188:KeyEvent.KEYCODE_LessThan,189:KeyEvent.KEYCODE_Underline,190:KeyEvent.KEYCODE_MoreThan,191:KeyEvent.KEYCODE_Question,192:KeyEvent.KEYCODE_Double_Quotation,219:KeyEvent.KEYCODE_Left_Brace,220:KeyEvent.KEYCODE_Or,221:KeyEvent.KEYCODE_Right_Brace},ctrl:{},alt:{}};KeyEvent.FIX_MAP_KEYCODE={186:KeyEvent.KEYCODE_Semicolon,187:KeyEvent.KEYCODE_Equal,188:KeyEvent.KEYCODE_Comma,189:KeyEvent.KEYCODE_Minus,190:KeyEvent.KEYCODE_Period,191:KeyEvent.KEYCODE_Slash,192:KeyEvent.KEYCODE_Backquote,219:KeyEvent.KEYCODE_LeftBracket,220:KeyEvent.KEYCODE_Backslash,221:KeyEvent.KEYCODE_RightBracket,222:KeyEvent.KEYCODE_Quotation,96:KeyEvent.KEYCODE_Digit0,97:KeyEvent.KEYCODE_Digit1,98:KeyEvent.KEYCODE_Digit2,99:KeyEvent.KEYCODE_Digit3,100:KeyEvent.KEYCODE_Digit4,101:KeyEvent.KEYCODE_Digit5,102:KeyEvent.KEYCODE_Digit6,103:KeyEvent.KEYCODE_Digit7,104:KeyEvent.KEYCODE_Digit8,105:KeyEvent.KEYCODE_Digit9};KeyEvent.ACTION_DOWN=0;KeyEvent.ACTION_UP=1;KeyEvent.META_MASK_SHIFT=16;KeyEvent.META_ALT_ON=0x02;KeyEvent.META_SHIFT_ON=0x1;KeyEvent.META_CTRL_ON=0x1000;KeyEvent.META_META_ON=0x10000;KeyEvent.FLAG_CANCELED=0x20;KeyEvent.FLAG_CANCELED_LONG_PRESS=0x100;KeyEvent.FLAG_LONG_PRESS=0x80;KeyEvent.FLAG_TRACKING=0x200;KeyEvent.FLAG_START_TRACKING=0x40000000;view.KeyEvent=KeyEvent;(function(KeyEvent){var DispatcherState=function(){function DispatcherState(){_classCallCheck(this,DispatcherState);this.mActiveLongPresses=new android.util.SparseArray();}_createClass(DispatcherState,[{key:'reset',value:function reset(target){if(target==null){if(DEBUG)Log.v(TAG,\"Reset: \"+this);this.mDownKeyCode=0;this.mDownTarget=null;this.mActiveLongPresses.clear();}else{if(this.mDownTarget==target){if(DEBUG)Log.v(TAG,\"Reset in \"+target+\": \"+this);this.mDownKeyCode=0;this.mDownTarget=null;}}}},{key:'startTracking',value:function startTracking(event,target){if(event.getAction()!=KeyEvent.ACTION_DOWN){throw new Error(\"Can only start tracking on a down event\");}if(DEBUG)Log.v(TAG,\"Start trackingt in \"+target+\": \"+this);this.mDownKeyCode=event.getKeyCode();this.mDownTarget=target;}},{key:'isTracking',value:function isTracking(event){return this.mDownKeyCode==event.getKeyCode();}},{key:'performedLongPress',value:function performedLongPress(event){this.mActiveLongPresses.put(event.getKeyCode(),1);}},{key:'handleUpEvent',value:function handleUpEvent(event){var keyCode=event.getKeyCode();if(DEBUG)Log.v(TAG,\"Handle key up \"+event+\": \"+this);var index=this.mActiveLongPresses.indexOfKey(keyCode);if(index>=0){if(DEBUG)Log.v(TAG,\"  Index: \"+index);event.mFlags|=KeyEvent.FLAG_CANCELED|KeyEvent.FLAG_CANCELED_LONG_PRESS;this.mActiveLongPresses.removeAt(index);}if(this.mDownKeyCode==keyCode){if(DEBUG)Log.v(TAG,\"  Tracking!\");event.mFlags|=KeyEvent.FLAG_TRACKING;this.mDownKeyCode=0;this.mDownTarget=null;}}}]);return DispatcherState;}();KeyEvent.DispatcherState=DispatcherState;})(KeyEvent=view.KeyEvent||(view.KeyEvent={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var drawable;(function(drawable_4){var PixelFormat=android.graphics.PixelFormat;var Rect=android.graphics.Rect;var System=java.lang.System;var Drawable=android.graphics.drawable.Drawable;var LayerDrawable=function(_Drawable3){_inherits(LayerDrawable,_Drawable3);function LayerDrawable(layers){var state=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;_classCallCheck(this,LayerDrawable);var _this19=_possibleConstructorReturn(this,(LayerDrawable.__proto__||Object.getPrototypeOf(LayerDrawable)).call(this));_this19.mOpacityOverride=PixelFormat.UNKNOWN;_this19.mTmpRect=new Rect();var _as=_this19.createConstantState(state);_this19.mLayerState=_as;if(_as.mNum>0){_this19.ensurePadding();}if(layers!=null){var length=layers.length;var r=new Array(length);for(var i=0;i<length;i++){r[i]=new LayerDrawable.ChildDrawable();r[i].mDrawable=layers[i];layers[i].setCallback(_this19);}_this19.mLayerState.mNum=length;_this19.mLayerState.mChildren=r;_this19.ensurePadding();}return _this19;}_createClass(LayerDrawable,[{key:'createConstantState',value:function createConstantState(state){return new LayerDrawable.LayerState(state,this);}},{key:'inflate',value:function inflate(r,parser){_get2(LayerDrawable.prototype.__proto__||Object.getPrototypeOf(LayerDrawable.prototype),'inflate',this).call(this,r,parser);var a=r.obtainAttributes(parser);this.mOpacityOverride=a.getInt(\"android:opacity\",PixelFormat.UNKNOWN);this.setAutoMirrored(a.getBoolean(\"android:autoMirrored\",false));a.recycle();var _iteratorNormalCompletion33=true;var _didIteratorError33=false;var _iteratorError33=undefined;try{for(var _iterator33=Array.from(parser.children)[Symbol.iterator](),_step33;!(_iteratorNormalCompletion33=(_step33=_iterator33.next()).done);_iteratorNormalCompletion33=true){var child=_step33.value;var item=child;if(item.tagName.toLowerCase()!=='item'){continue;}a=r.obtainAttributes(item);var left=a.getDimensionPixelOffset(\"android:left\",0);var top=a.getDimensionPixelOffset(\"android:top\",0);var right=a.getDimensionPixelOffset(\"android:right\",0);var bottom=a.getDimensionPixelOffset(\"android:bottom\",0);var dr=a.getDrawable(\"android:drawable\");var id=a.getString(\"android:id\");a.recycle();if(!dr&&item.children[0]instanceof HTMLElement){dr=Drawable.createFromXml(r,item.children[0]);}if(!dr){throw Error('new XmlPullParserException(<item> tag requires a \\'drawable\\' attribute or child tag defining a drawable)');}this.addLayer(dr,id,left,top,right,bottom);}}catch(err){_didIteratorError33=true;_iteratorError33=err;}finally{try{if(!_iteratorNormalCompletion33&&_iterator33.return){_iterator33.return();}}finally{if(_didIteratorError33){throw _iteratorError33;}}}this.ensurePadding();this.onStateChange(this.getState());}},{key:'addLayer',value:function addLayer(layer,id){var left=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var top=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var right=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var bottom=arguments.length>5&&arguments[5]!==undefined?arguments[5]:0;var st=this.mLayerState;var N=st.mChildren!=null?st.mChildren.length:0;var i=st.mNum;if(i>=N){var nu=new Array(N+10);if(i>0){System.arraycopy(st.mChildren,0,nu,0,i);}st.mChildren=nu;}var childDrawable=new LayerDrawable.ChildDrawable();st.mChildren[i]=childDrawable;childDrawable.mId=id;childDrawable.mDrawable=layer;childDrawable.mDrawable.setAutoMirrored(this.isAutoMirrored());childDrawable.mInsetL=left;childDrawable.mInsetT=top;childDrawable.mInsetR=right;childDrawable.mInsetB=bottom;st.mNum++;layer.setCallback(this);}},{key:'findDrawableByLayerId',value:function findDrawableByLayerId(id){var layers=this.mLayerState.mChildren;for(var i=this.mLayerState.mNum-1;i>=0;i--){if(layers[i].mId==id){return layers[i].mDrawable;}}return null;}},{key:'setId',value:function setId(index,id){this.mLayerState.mChildren[index].mId=id;}},{key:'getNumberOfLayers',value:function getNumberOfLayers(){return this.mLayerState.mNum;}},{key:'getDrawable',value:function getDrawable(index){return this.mLayerState.mChildren[index].mDrawable;}},{key:'getId',value:function getId(index){return this.mLayerState.mChildren[index].mId;}},{key:'setDrawableByLayerId',value:function setDrawableByLayerId(id,drawable){var layers=this.mLayerState.mChildren;for(var i=this.mLayerState.mNum-1;i>=0;i--){if(layers[i].mId==id){if(layers[i].mDrawable!=null){if(drawable!=null){var bounds=layers[i].mDrawable.getBounds();drawable.setBounds(bounds);}layers[i].mDrawable.setCallback(null);}if(drawable!=null){drawable.setCallback(this);}layers[i].mDrawable=drawable;return true;}}return false;}},{key:'setLayerInset',value:function setLayerInset(index,l,t,r,b){var childDrawable=this.mLayerState.mChildren[index];childDrawable.mInsetL=l;childDrawable.mInsetT=t;childDrawable.mInsetR=r;childDrawable.mInsetB=b;}},{key:'drawableSizeChange',value:function drawableSizeChange(who){var callback=this.getCallback();if(callback!=null&&callback.drawableSizeChange){callback.drawableSizeChange(this);}}},{key:'invalidateDrawable',value:function invalidateDrawable(who){var callback=this.getCallback();if(callback!=null){callback.invalidateDrawable(this);}}},{key:'scheduleDrawable',value:function scheduleDrawable(who,what,when){var callback=this.getCallback();if(callback!=null){callback.scheduleDrawable(this,what,when);}}},{key:'unscheduleDrawable',value:function unscheduleDrawable(who,what){var callback=this.getCallback();if(callback!=null){callback.unscheduleDrawable(this,what);}}},{key:'draw',value:function draw(canvas){var array=this.mLayerState.mChildren;var N=this.mLayerState.mNum;for(var i=0;i<N;i++){array[i].mDrawable.draw(canvas);}}},{key:'getPadding',value:function getPadding(padding){padding.left=0;padding.top=0;padding.right=0;padding.bottom=0;var array=this.mLayerState.mChildren;var N=this.mLayerState.mNum;for(var i=0;i<N;i++){this.reapplyPadding(i,array[i]);padding.left+=this.mPaddingL[i];padding.top+=this.mPaddingT[i];padding.right+=this.mPaddingR[i];padding.bottom+=this.mPaddingB[i];}return true;}},{key:'setVisible',value:function setVisible(visible,restart){var changed=_get2(LayerDrawable.prototype.__proto__||Object.getPrototypeOf(LayerDrawable.prototype),'setVisible',this).call(this,visible,restart);var array=this.mLayerState.mChildren;var N=this.mLayerState.mNum;for(var i=0;i<N;i++){array[i].mDrawable.setVisible(visible,restart);}return changed;}},{key:'setDither',value:function setDither(dither){var array=this.mLayerState.mChildren;var N=this.mLayerState.mNum;for(var i=0;i<N;i++){array[i].mDrawable.setDither(dither);}}},{key:'setAlpha',value:function setAlpha(alpha){var array=this.mLayerState.mChildren;var N=this.mLayerState.mNum;for(var i=0;i<N;i++){array[i].mDrawable.setAlpha(alpha);}}},{key:'getAlpha',value:function getAlpha(){var array=this.mLayerState.mChildren;if(this.mLayerState.mNum>0){return array[0].mDrawable.getAlpha();}else{return _get2(LayerDrawable.prototype.__proto__||Object.getPrototypeOf(LayerDrawable.prototype),'getAlpha',this).call(this);}}},{key:'setOpacity',value:function setOpacity(opacity){this.mOpacityOverride=opacity;}},{key:'getOpacity',value:function getOpacity(){if(this.mOpacityOverride!=PixelFormat.UNKNOWN){return this.mOpacityOverride;}return this.mLayerState.getOpacity();}},{key:'setAutoMirrored',value:function setAutoMirrored(mirrored){this.mLayerState.mAutoMirrored=mirrored;var array=this.mLayerState.mChildren;var N=this.mLayerState.mNum;for(var i=0;i<N;i++){array[i].mDrawable.setAutoMirrored(mirrored);}}},{key:'isAutoMirrored',value:function isAutoMirrored(){return this.mLayerState.mAutoMirrored;}},{key:'isStateful',value:function isStateful(){return this.mLayerState.isStateful();}},{key:'onStateChange',value:function onStateChange(state){var array=this.mLayerState.mChildren;var N=this.mLayerState.mNum;var paddingChanged=false;var changed=false;for(var i=0;i<N;i++){var r=array[i];if(r.mDrawable.setState(state)){changed=true;}if(this.reapplyPadding(i,r)){paddingChanged=true;}}if(paddingChanged){this.onBoundsChange(this.getBounds());}return changed;}},{key:'onLevelChange',value:function onLevelChange(level){var array=this.mLayerState.mChildren;var N=this.mLayerState.mNum;var paddingChanged=false;var changed=false;for(var i=0;i<N;i++){var r=array[i];if(r.mDrawable.setLevel(level)){changed=true;}if(this.reapplyPadding(i,r)){paddingChanged=true;}}if(paddingChanged){this.onBoundsChange(this.getBounds());}return changed;}},{key:'onBoundsChange',value:function onBoundsChange(bounds){var array=this.mLayerState.mChildren;var N=this.mLayerState.mNum;var padL=0,padT=0,padR=0,padB=0;for(var i=0;i<N;i++){var r=array[i];r.mDrawable.setBounds(bounds.left+r.mInsetL+padL,bounds.top+r.mInsetT+padT,bounds.right-r.mInsetR-padR,bounds.bottom-r.mInsetB-padB);padL+=this.mPaddingL[i];padR+=this.mPaddingR[i];padT+=this.mPaddingT[i];padB+=this.mPaddingB[i];}}},{key:'getIntrinsicWidth',value:function getIntrinsicWidth(){var width=-1;var array=this.mLayerState.mChildren;var N=this.mLayerState.mNum;var padL=0,padR=0;for(var i=0;i<N;i++){var r=array[i];var w=r.mDrawable.getIntrinsicWidth()+r.mInsetL+r.mInsetR+padL+padR;if(w>width){width=w;}padL+=this.mPaddingL[i];padR+=this.mPaddingR[i];}return width;}},{key:'getIntrinsicHeight',value:function getIntrinsicHeight(){var height=-1;var array=this.mLayerState.mChildren;var N=this.mLayerState.mNum;var padT=0,padB=0;for(var i=0;i<N;i++){var r=array[i];var h=r.mDrawable.getIntrinsicHeight()+r.mInsetT+r.mInsetB+padT+padB;if(h>height){height=h;}padT+=this.mPaddingT[i];padB+=this.mPaddingB[i];}return height;}},{key:'reapplyPadding',value:function reapplyPadding(i,r){var rect=this.mTmpRect;r.mDrawable.getPadding(rect);if(rect.left!=this.mPaddingL[i]||rect.top!=this.mPaddingT[i]||rect.right!=this.mPaddingR[i]||rect.bottom!=this.mPaddingB[i]){this.mPaddingL[i]=rect.left;this.mPaddingT[i]=rect.top;this.mPaddingR[i]=rect.right;this.mPaddingB[i]=rect.bottom;return true;}return false;}},{key:'ensurePadding',value:function ensurePadding(){var N=this.mLayerState.mNum;if(this.mPaddingL!=null&&this.mPaddingL.length>=N){return;}this.mPaddingL=androidui.util.ArrayCreator.newNumberArray(N);this.mPaddingT=androidui.util.ArrayCreator.newNumberArray(N);this.mPaddingR=androidui.util.ArrayCreator.newNumberArray(N);this.mPaddingB=androidui.util.ArrayCreator.newNumberArray(N);for(var i=0;i<N;i++){this.mPaddingL[i]=0;this.mPaddingT[i]=0;this.mPaddingR[i]=0;this.mPaddingB[i]=0;}}},{key:'getConstantState',value:function getConstantState(){if(this.mLayerState.canConstantState()){return this.mLayerState;}return null;}},{key:'mutate',value:function mutate(){if(!this.mMutated&&_get2(LayerDrawable.prototype.__proto__||Object.getPrototypeOf(LayerDrawable.prototype),'mutate',this).call(this)==this){this.mLayerState=this.createConstantState(this.mLayerState);var array=this.mLayerState.mChildren;var N=this.mLayerState.mNum;for(var i=0;i<N;i++){array[i].mDrawable.mutate();}this.mMutated=true;}return this;}}]);return LayerDrawable;}(Drawable);drawable_4.LayerDrawable=LayerDrawable;(function(LayerDrawable){var ChildDrawable=function ChildDrawable(){_classCallCheck(this,ChildDrawable);this.mInsetL=0;this.mInsetT=0;this.mInsetR=0;this.mInsetB=0;};LayerDrawable.ChildDrawable=ChildDrawable;var LayerState=function(){function LayerState(orig,owner){_classCallCheck(this,LayerState);this.mNum=0;this.mHaveOpacity=false;this.mOpacity=0;this.mHaveStateful=false;if(orig!=null){var origChildDrawable=orig.mChildren;var N=orig.mNum;this.mNum=N;this.mChildren=new Array(N);for(var i=0;i<N;i++){var r=this.mChildren[i]=new LayerDrawable.ChildDrawable();var or=origChildDrawable[i];r.mDrawable=or.mDrawable.getConstantState().newDrawable();r.mDrawable.setCallback(owner);r.mInsetL=or.mInsetL;r.mInsetT=or.mInsetT;r.mInsetR=or.mInsetR;r.mInsetB=or.mInsetB;r.mId=or.mId;}this.mHaveOpacity=orig.mHaveOpacity;this.mOpacity=orig.mOpacity;this.mHaveStateful=orig.mHaveStateful;this.mStateful=orig.mStateful;this.mCheckedConstantState=this.mCanConstantState=true;this.mAutoMirrored=orig.mAutoMirrored;}else{this.mNum=0;this.mChildren=null;}}_createClass(LayerState,[{key:'newDrawable',value:function newDrawable(){return new LayerDrawable(null,this);}},{key:'getOpacity',value:function getOpacity(){if(this.mHaveOpacity){return this.mOpacity;}var N=this.mNum;var op=N>0?this.mChildren[0].mDrawable.getOpacity():PixelFormat.TRANSPARENT;for(var i=1;i<N;i++){op=Drawable.resolveOpacity(op,this.mChildren[i].mDrawable.getOpacity());}this.mOpacity=op;this.mHaveOpacity=true;return op;}},{key:'isStateful',value:function isStateful(){if(this.mHaveStateful){return this.mStateful;}var stateful=false;var N=this.mNum;for(var i=0;i<N;i++){if(this.mChildren[i].mDrawable.isStateful()){stateful=true;break;}}this.mStateful=stateful;this.mHaveStateful=true;return stateful;}},{key:'canConstantState',value:function canConstantState(){if(!this.mCheckedConstantState&&this.mChildren!=null){this.mCanConstantState=true;var N=this.mNum;for(var i=0;i<N;i++){if(this.mChildren[i].mDrawable.getConstantState()==null){this.mCanConstantState=false;break;}}this.mCheckedConstantState=true;}return this.mCanConstantState;}}]);return LayerState;}();LayerDrawable.LayerState=LayerState;})(LayerDrawable=drawable_4.LayerDrawable||(drawable_4.LayerDrawable={}));})(drawable=graphics.drawable||(graphics.drawable={}));})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var drawable;(function(drawable_5){var Log=android.util.Log;var Drawable=android.graphics.drawable.Drawable;var RotateDrawable=function(_Drawable4){_inherits(RotateDrawable,_Drawable4);function RotateDrawable(rotateState){_classCallCheck(this,RotateDrawable);var _this20=_possibleConstructorReturn(this,(RotateDrawable.__proto__||Object.getPrototypeOf(RotateDrawable)).call(this));_this20.mState=new RotateDrawable.RotateState(rotateState,_this20);return _this20;}_createClass(RotateDrawable,[{key:'draw',value:function draw(canvas){var saveCount=canvas.save();var bounds=this.mState.mDrawable.getBounds();var w=bounds.right-bounds.left;var h=bounds.bottom-bounds.top;var st=this.mState;var px=st.mPivotXRel?w*st.mPivotX:st.mPivotX;var py=st.mPivotYRel?h*st.mPivotY:st.mPivotY;canvas.rotate(st.mCurrentDegrees,px+bounds.left,py+bounds.top);st.mDrawable.draw(canvas);canvas.restoreToCount(saveCount);}},{key:'getDrawable',value:function getDrawable(){return this.mState.mDrawable;}},{key:'setAlpha',value:function setAlpha(alpha){this.mState.mDrawable.setAlpha(alpha);}},{key:'getAlpha',value:function getAlpha(){return this.mState.mDrawable.getAlpha();}},{key:'getOpacity',value:function getOpacity(){return this.mState.mDrawable.getOpacity();}},{key:'drawableSizeChange',value:function drawableSizeChange(who){var callback=this.getCallback();if(callback!=null&&callback.drawableSizeChange){callback.drawableSizeChange(this);}}},{key:'invalidateDrawable',value:function invalidateDrawable(who){var callback=this.getCallback();if(callback!=null){callback.invalidateDrawable(this);}}},{key:'scheduleDrawable',value:function scheduleDrawable(who,what,when){var callback=this.getCallback();if(callback!=null){callback.scheduleDrawable(this,what,when);}}},{key:'unscheduleDrawable',value:function unscheduleDrawable(who,what){var callback=this.getCallback();if(callback!=null){callback.unscheduleDrawable(this,what);}}},{key:'getPadding',value:function getPadding(padding){return this.mState.mDrawable.getPadding(padding);}},{key:'setVisible',value:function setVisible(visible,restart){this.mState.mDrawable.setVisible(visible,restart);return _get2(RotateDrawable.prototype.__proto__||Object.getPrototypeOf(RotateDrawable.prototype),'setVisible',this).call(this,visible,restart);}},{key:'isStateful',value:function isStateful(){return this.mState.mDrawable.isStateful();}},{key:'onStateChange',value:function onStateChange(state){var changed=this.mState.mDrawable.setState(state);this.onBoundsChange(this.getBounds());return changed;}},{key:'onLevelChange',value:function onLevelChange(level){this.mState.mDrawable.setLevel(level);this.onBoundsChange(this.getBounds());this.mState.mCurrentDegrees=this.mState.mFromDegrees+(this.mState.mToDegrees-this.mState.mFromDegrees)*(level/RotateDrawable.MAX_LEVEL);this.invalidateSelf();return true;}},{key:'onBoundsChange',value:function onBoundsChange(bounds){this.mState.mDrawable.setBounds(bounds.left,bounds.top,bounds.right,bounds.bottom);}},{key:'getIntrinsicWidth',value:function getIntrinsicWidth(){return this.mState.mDrawable.getIntrinsicWidth();}},{key:'getIntrinsicHeight',value:function getIntrinsicHeight(){return this.mState.mDrawable.getIntrinsicHeight();}},{key:'getConstantState',value:function getConstantState(){if(this.mState.canConstantState()){return this.mState;}return null;}},{key:'inflate',value:function inflate(r,parser){_get2(RotateDrawable.prototype.__proto__||Object.getPrototypeOf(RotateDrawable.prototype),'inflate',this).call(this,r,parser);var a=r.obtainAttributes(parser);var tv=a.getString(\"android:pivotX\");var pivotXRel=void 0;var pivotX=void 0;if(tv==null){pivotXRel=true;pivotX=0.5;}else{pivotXRel=tv.endsWith('%');pivotX=a.getFloat('android:pivotX',0.5);}tv=a.getString(\"android:pivotY\");var pivotYRel=void 0;var pivotY=void 0;if(tv==null){pivotYRel=true;pivotY=0.5;}else{pivotYRel=tv.endsWith('%');pivotY=a.getFloat('android:pivotY',0.5);}var fromDegrees=a.getFloat(\"android:fromDegrees\",0.0);var toDegrees=a.getFloat(\"android:toDegrees\",360.0);var drawable=a.getDrawable(\"android:drawable\");a.recycle();if(!drawable&&parser.children[0]instanceof HTMLElement){drawable=Drawable.createFromXml(r,parser.children[0]);}if(drawable==null){Log.w(\"drawable\",\"No drawable specified for <rotate>\");}this.mState.mDrawable=drawable;this.mState.mPivotXRel=pivotXRel;this.mState.mPivotX=pivotX;this.mState.mPivotYRel=pivotYRel;this.mState.mPivotY=pivotY;this.mState.mFromDegrees=this.mState.mCurrentDegrees=fromDegrees;this.mState.mToDegrees=toDegrees;if(drawable!=null){drawable.setCallback(this);}}},{key:'mutate',value:function mutate(){if(!this.mMutated&&_get2(RotateDrawable.prototype.__proto__||Object.getPrototypeOf(RotateDrawable.prototype),'mutate',this).call(this)==this){this.mState.mDrawable.mutate();this.mMutated=true;}return this;}}]);return RotateDrawable;}(Drawable);RotateDrawable.MAX_LEVEL=10000.0;drawable_5.RotateDrawable=RotateDrawable;(function(RotateDrawable){var RotateState=function(){function RotateState(source,owner){_classCallCheck(this,RotateState);this.mPivotX=0;this.mPivotY=0;this.mFromDegrees=0;this.mToDegrees=0;this.mCurrentDegrees=0;if(source!=null){this.mDrawable=source.mDrawable.getConstantState().newDrawable();this.mDrawable.setCallback(owner);this.mPivotXRel=source.mPivotXRel;this.mPivotX=source.mPivotX;this.mPivotYRel=source.mPivotYRel;this.mPivotY=source.mPivotY;this.mFromDegrees=this.mCurrentDegrees=source.mFromDegrees;this.mToDegrees=source.mToDegrees;this.mCanConstantState=this.mCheckedConstantState=true;}}_createClass(RotateState,[{key:'newDrawable',value:function newDrawable(){return new RotateDrawable(this);}},{key:'canConstantState',value:function canConstantState(){if(!this.mCheckedConstantState){this.mCanConstantState=this.mDrawable.getConstantState()!=null;this.mCheckedConstantState=true;}return this.mCanConstantState;}}]);return RotateState;}();RotateDrawable.RotateState=RotateState;})(RotateDrawable=drawable_5.RotateDrawable||(drawable_5.RotateDrawable={}));})(drawable=graphics.drawable||(graphics.drawable={}));})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var java;(function(java){var lang;(function(lang){var Float=function(){function Float(){_classCallCheck(this,Float);}_createClass(Float,null,[{key:'parseFloat',value:function parseFloat(value){return Number.parseFloat(value);}}]);return Float;}();Float.MIN_VALUE=Number.MIN_VALUE;Float.MAX_VALUE=Number.MAX_VALUE;lang.Float=Float;})(lang=java.lang||(java.lang={}));})(java||(java={}));var android;(function(android){var graphics;(function(graphics){var drawable;(function(drawable_6){var Rect=android.graphics.Rect;var Gravity=android.view.Gravity;var Drawable=android.graphics.drawable.Drawable;var ScaleDrawable=function(_Drawable5){_inherits(ScaleDrawable,_Drawable5);function ScaleDrawable(){_classCallCheck(this,ScaleDrawable);var _this21=_possibleConstructorReturn(this,(ScaleDrawable.__proto__||Object.getPrototypeOf(ScaleDrawable)).call(this));_this21.mTmpRect=new Rect();if(arguments.length<=1){_this21.mScaleState=new ScaleDrawable.ScaleState(arguments.length<=0?undefined:arguments[0],_this21);return _possibleConstructorReturn(_this21);}var drawable=arguments.length<=0?undefined:arguments[0];var gravity=arguments.length<=1?undefined:arguments[1];var scaleWidth=arguments.length<=2?undefined:arguments[2];var scaleHeight=arguments.length<=3?undefined:arguments[3];_this21.mScaleState=new ScaleDrawable.ScaleState(null,_this21);_this21.mScaleState.mDrawable=drawable;_this21.mScaleState.mGravity=gravity;_this21.mScaleState.mScaleWidth=scaleWidth;_this21.mScaleState.mScaleHeight=scaleHeight;if(drawable!=null){drawable.setCallback(_this21);}return _this21;}_createClass(ScaleDrawable,[{key:'getDrawable',value:function getDrawable(){return this.mScaleState.mDrawable;}},{key:'inflate',value:function inflate(r,parser){_get2(ScaleDrawable.prototype.__proto__||Object.getPrototypeOf(ScaleDrawable.prototype),'inflate',this).call(this,r,parser);var a=r.obtainAttributes(parser);var sw=a.getFloat(\"android:scaleWidth\",1);var sh=a.getFloat(\"android:scaleHeight\",1);var gStr=a.getString(\"android:scaleGravity\");var g=Gravity.parseGravity(gStr,Gravity.LEFT);var min=a.getBoolean(\"android:useIntrinsicSizeAsMinimum\",false);var dr=a.getDrawable(\"android:drawable\");a.recycle();if(!dr&&parser.children[0]instanceof HTMLElement){dr=Drawable.createFromXml(r,parser.children[0]);}if(dr==null){throw Error('new IllegalArgumentException(\"No drawable specified for <scale>\")');}this.mScaleState.mDrawable=dr;this.mScaleState.mScaleWidth=sw;this.mScaleState.mScaleHeight=sh;this.mScaleState.mGravity=g;this.mScaleState.mUseIntrinsicSizeAsMin=min;if(dr!=null){dr.setCallback(this);}}},{key:'drawableSizeChange',value:function drawableSizeChange(who){var callback=this.getCallback();if(callback!=null&&callback.drawableSizeChange){callback.drawableSizeChange(this);}}},{key:'invalidateDrawable',value:function invalidateDrawable(who){if(this.getCallback()!=null){this.getCallback().invalidateDrawable(this);}}},{key:'scheduleDrawable',value:function scheduleDrawable(who,what,when){if(this.getCallback()!=null){this.getCallback().scheduleDrawable(this,what,when);}}},{key:'unscheduleDrawable',value:function unscheduleDrawable(who,what){if(this.getCallback()!=null){this.getCallback().unscheduleDrawable(this,what);}}},{key:'draw',value:function draw(canvas){if(this.mScaleState.mDrawable.getLevel()!=0)this.mScaleState.mDrawable.draw(canvas);}},{key:'getPadding',value:function getPadding(padding){return this.mScaleState.mDrawable.getPadding(padding);}},{key:'setVisible',value:function setVisible(visible,restart){this.mScaleState.mDrawable.setVisible(visible,restart);return _get2(ScaleDrawable.prototype.__proto__||Object.getPrototypeOf(ScaleDrawable.prototype),'setVisible',this).call(this,visible,restart);}},{key:'setAlpha',value:function setAlpha(alpha){this.mScaleState.mDrawable.setAlpha(alpha);}},{key:'getAlpha',value:function getAlpha(){return this.mScaleState.mDrawable.getAlpha();}},{key:'getOpacity',value:function getOpacity(){return this.mScaleState.mDrawable.getOpacity();}},{key:'isStateful',value:function isStateful(){return this.mScaleState.mDrawable.isStateful();}},{key:'onStateChange',value:function onStateChange(state){var changed=this.mScaleState.mDrawable.setState(state);this.onBoundsChange(this.getBounds());return changed;}},{key:'onLevelChange',value:function onLevelChange(level){this.mScaleState.mDrawable.setLevel(level);this.onBoundsChange(this.getBounds());this.invalidateSelf();return true;}},{key:'onBoundsChange',value:function onBoundsChange(bounds){var r=this.mTmpRect;var min=this.mScaleState.mUseIntrinsicSizeAsMin;var level=this.getLevel();var w=bounds.width();if(this.mScaleState.mScaleWidth>0){var iw=min?this.mScaleState.mDrawable.getIntrinsicWidth():0;w-=Math.floor((w-iw)*(10000-level)*this.mScaleState.mScaleWidth/10000);}var h=bounds.height();if(this.mScaleState.mScaleHeight>0){var ih=min?this.mScaleState.mDrawable.getIntrinsicHeight():0;h-=Math.floor((h-ih)*(10000-level)*this.mScaleState.mScaleHeight/10000);}Gravity.apply(this.mScaleState.mGravity,w,h,bounds,r);if(w>0&&h>0){this.mScaleState.mDrawable.setBounds(r.left,r.top,r.right,r.bottom);}}},{key:'getIntrinsicWidth',value:function getIntrinsicWidth(){return this.mScaleState.mDrawable.getIntrinsicWidth();}},{key:'getIntrinsicHeight',value:function getIntrinsicHeight(){return this.mScaleState.mDrawable.getIntrinsicHeight();}},{key:'getConstantState',value:function getConstantState(){if(this.mScaleState.canConstantState()){return this.mScaleState;}return null;}},{key:'mutate',value:function mutate(){if(!this.mMutated&&_get2(ScaleDrawable.prototype.__proto__||Object.getPrototypeOf(ScaleDrawable.prototype),'mutate',this).call(this)==this){this.mScaleState.mDrawable.mutate();this.mMutated=true;}return this;}}]);return ScaleDrawable;}(Drawable);drawable_6.ScaleDrawable=ScaleDrawable;(function(ScaleDrawable){var ScaleState=function(){function ScaleState(orig,owner){_classCallCheck(this,ScaleState);this.mScaleWidth=0;this.mScaleHeight=0;this.mGravity=0;if(orig!=null){this.mDrawable=orig.mDrawable.getConstantState().newDrawable();this.mDrawable.setCallback(owner);this.mScaleWidth=orig.mScaleWidth;this.mScaleHeight=orig.mScaleHeight;this.mGravity=orig.mGravity;this.mUseIntrinsicSizeAsMin=orig.mUseIntrinsicSizeAsMin;this.mCheckedConstantState=this.mCanConstantState=true;}}_createClass(ScaleState,[{key:'newDrawable',value:function newDrawable(){return new ScaleDrawable(this);}},{key:'canConstantState',value:function canConstantState(){if(!this.mCheckedConstantState){this.mCanConstantState=this.mDrawable.getConstantState()!=null;this.mCheckedConstantState=true;}return this.mCanConstantState;}}]);return ScaleState;}();ScaleDrawable.ScaleState=ScaleState;})(ScaleDrawable=drawable_6.ScaleDrawable||(drawable_6.ScaleDrawable={}));})(drawable=graphics.drawable||(graphics.drawable={}));})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var drawable;(function(drawable){var Animatable;(function(Animatable){function isImpl(obj){return obj&&obj['start']&&obj['stop']&&obj['isRunning'];}Animatable.isImpl=isImpl;})(Animatable=drawable.Animatable||(drawable.Animatable={}));})(drawable=graphics.drawable||(graphics.drawable={}));})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var drawable;(function(drawable){var Rect=android.graphics.Rect;var PixelFormat=android.graphics.PixelFormat;var Log=android.util.Log;var SparseArray=android.util.SparseArray;var SystemClock=android.os.SystemClock;var DrawableContainer=function(_drawable$Drawable3){_inherits(DrawableContainer,_drawable$Drawable3);function DrawableContainer(){_classCallCheck(this,DrawableContainer);var _this22=_possibleConstructorReturn(this,(DrawableContainer.__proto__||Object.getPrototypeOf(DrawableContainer)).apply(this,arguments));_this22.mAlpha=0xFF;_this22.mCurIndex=-1;_this22.mMutated=false;_this22.mEnterAnimationEnd=0;_this22.mExitAnimationEnd=0;return _this22;}_createClass(DrawableContainer,[{key:'draw',value:function draw(canvas){if(this.mCurrDrawable!=null){this.mCurrDrawable.draw(canvas);}if(this.mLastDrawable!=null){this.mLastDrawable.draw(canvas);}}},{key:'needsMirroring',value:function needsMirroring(){return false&&this.isAutoMirrored();}},{key:'getPadding',value:function getPadding(padding){var r=this.mDrawableContainerState.getConstantPadding();var result=void 0;if(r!=null){padding.set(r);result=(r.left|r.top|r.bottom|r.right)!=0;}else{if(this.mCurrDrawable!=null){result=this.mCurrDrawable.getPadding(padding);}else{result=_get2(DrawableContainer.prototype.__proto__||Object.getPrototypeOf(DrawableContainer.prototype),'getPadding',this).call(this,padding);}}if(this.needsMirroring()){var left=padding.left;var right=padding.right;padding.left=right;padding.right=left;}return result;}},{key:'setAlpha',value:function setAlpha(alpha){if(this.mAlpha!=alpha){this.mAlpha=alpha;if(this.mCurrDrawable!=null){if(this.mEnterAnimationEnd==0){this.mCurrDrawable.mutate().setAlpha(alpha);}else{this.animate(false);}}}}},{key:'getAlpha',value:function getAlpha(){return this.mAlpha;}},{key:'setDither',value:function setDither(dither){if(this.mDrawableContainerState.mDither!=dither){this.mDrawableContainerState.mDither=dither;if(this.mCurrDrawable!=null){this.mCurrDrawable.mutate().setDither(this.mDrawableContainerState.mDither);}}}},{key:'setEnterFadeDuration',value:function setEnterFadeDuration(ms){this.mDrawableContainerState.mEnterFadeDuration=ms;}},{key:'setExitFadeDuration',value:function setExitFadeDuration(ms){this.mDrawableContainerState.mExitFadeDuration=ms;}},{key:'onBoundsChange',value:function onBoundsChange(bounds){if(this.mLastDrawable!=null){this.mLastDrawable.setBounds(bounds);}if(this.mCurrDrawable!=null){this.mCurrDrawable.setBounds(bounds);}}},{key:'isStateful',value:function isStateful(){return this.mDrawableContainerState.isStateful();}},{key:'setAutoMirrored',value:function setAutoMirrored(mirrored){this.mDrawableContainerState.mAutoMirrored=mirrored;if(this.mCurrDrawable!=null){this.mCurrDrawable.mutate().setAutoMirrored(this.mDrawableContainerState.mAutoMirrored);}}},{key:'isAutoMirrored',value:function isAutoMirrored(){return this.mDrawableContainerState.mAutoMirrored;}},{key:'jumpToCurrentState',value:function jumpToCurrentState(){var changed=false;if(this.mLastDrawable!=null){this.mLastDrawable.jumpToCurrentState();this.mLastDrawable=null;changed=true;}if(this.mCurrDrawable!=null){this.mCurrDrawable.jumpToCurrentState();this.mCurrDrawable.mutate().setAlpha(this.mAlpha);}if(this.mExitAnimationEnd!=0){this.mExitAnimationEnd=0;changed=true;}if(this.mEnterAnimationEnd!=0){this.mEnterAnimationEnd=0;changed=true;}if(changed){this.invalidateSelf();}}},{key:'onStateChange',value:function onStateChange(state){if(this.mLastDrawable!=null){return this.mLastDrawable.setState(state);}if(this.mCurrDrawable!=null){return this.mCurrDrawable.setState(state);}return false;}},{key:'onLevelChange',value:function onLevelChange(level){if(this.mLastDrawable!=null){return this.mLastDrawable.setLevel(level);}if(this.mCurrDrawable!=null){return this.mCurrDrawable.setLevel(level);}return false;}},{key:'getIntrinsicWidth',value:function getIntrinsicWidth(){if(this.mDrawableContainerState.isConstantSize()){return this.mDrawableContainerState.getConstantWidth();}return this.mCurrDrawable!=null?this.mCurrDrawable.getIntrinsicWidth():-1;}},{key:'getIntrinsicHeight',value:function getIntrinsicHeight(){if(this.mDrawableContainerState.isConstantSize()){return this.mDrawableContainerState.getConstantHeight();}return this.mCurrDrawable!=null?this.mCurrDrawable.getIntrinsicHeight():-1;}},{key:'getMinimumWidth',value:function getMinimumWidth(){if(this.mDrawableContainerState.isConstantSize()){return this.mDrawableContainerState.getConstantMinimumWidth();}return this.mCurrDrawable!=null?this.mCurrDrawable.getMinimumWidth():0;}},{key:'getMinimumHeight',value:function getMinimumHeight(){if(this.mDrawableContainerState.isConstantSize()){return this.mDrawableContainerState.getConstantMinimumHeight();}return this.mCurrDrawable!=null?this.mCurrDrawable.getMinimumHeight():0;}},{key:'drawableSizeChange',value:function drawableSizeChange(who){var callback=this.getCallback();if(who==this.mCurrDrawable&&callback!=null&&callback.drawableSizeChange){callback.drawableSizeChange(this);}}},{key:'invalidateDrawable',value:function invalidateDrawable(who){if(who==this.mCurrDrawable&&this.getCallback()!=null){this.getCallback().invalidateDrawable(this);}}},{key:'scheduleDrawable',value:function scheduleDrawable(who,what,when){if(who==this.mCurrDrawable&&this.getCallback()!=null){this.getCallback().scheduleDrawable(this,what,when);}}},{key:'unscheduleDrawable',value:function unscheduleDrawable(who,what){if(who==this.mCurrDrawable&&this.getCallback()!=null){this.getCallback().unscheduleDrawable(this,what);}}},{key:'setVisible',value:function setVisible(visible,restart){var changed=_get2(DrawableContainer.prototype.__proto__||Object.getPrototypeOf(DrawableContainer.prototype),'setVisible',this).call(this,visible,restart);if(this.mLastDrawable!=null){this.mLastDrawable.setVisible(visible,restart);}if(this.mCurrDrawable!=null){this.mCurrDrawable.setVisible(visible,restart);}return changed;}},{key:'getOpacity',value:function getOpacity(){return this.mCurrDrawable==null||!this.mCurrDrawable.isVisible()?PixelFormat.TRANSPARENT:this.mDrawableContainerState.getOpacity();}},{key:'selectDrawable',value:function selectDrawable(idx){var _this23=this;if(idx==this.mCurIndex){return false;}var now=SystemClock.uptimeMillis();if(DrawableContainer.DEBUG)android.util.Log.i(DrawableContainer.TAG,toString()+\" from \"+this.mCurIndex+\" to \"+idx+\": exit=\"+this.mDrawableContainerState.mExitFadeDuration+\" enter=\"+this.mDrawableContainerState.mEnterFadeDuration);if(this.mDrawableContainerState.mExitFadeDuration>0){if(this.mLastDrawable!=null){this.mLastDrawable.setVisible(false,false);}if(this.mCurrDrawable!=null){this.mLastDrawable=this.mCurrDrawable;this.mExitAnimationEnd=now+this.mDrawableContainerState.mExitFadeDuration;}else{this.mLastDrawable=null;this.mExitAnimationEnd=0;}}else if(this.mCurrDrawable!=null){this.mCurrDrawable.setVisible(false,false);}if(idx>=0&&idx<this.mDrawableContainerState.mNumChildren){var d=this.mDrawableContainerState.getChild(idx);this.mCurrDrawable=d;this.mCurIndex=idx;if(d!=null){d.mutate();if(this.mDrawableContainerState.mEnterFadeDuration>0){this.mEnterAnimationEnd=now+this.mDrawableContainerState.mEnterFadeDuration;}else{d.setAlpha(this.mAlpha);}d.setVisible(this.isVisible(),true);d.setDither(this.mDrawableContainerState.mDither);d.setState(this.getState());d.setLevel(this.getLevel());d.setBounds(this.getBounds());d.setAutoMirrored(this.mDrawableContainerState.mAutoMirrored);}else{}}else{this.mCurrDrawable=null;this.mCurIndex=-1;}if(this.mEnterAnimationEnd!=0||this.mExitAnimationEnd!=0){if(this.mAnimationRunnable==null){(function(){var t=_this23;_this23.mAnimationRunnable={run:function run(){t.animate(true);t.invalidateSelf();}};})();}else{this.unscheduleSelf(this.mAnimationRunnable);}this.animate(true);}this.invalidateSelf();return true;}},{key:'animate',value:function animate(schedule){var now=SystemClock.uptimeMillis();var animating=false;if(this.mCurrDrawable!=null){if(this.mEnterAnimationEnd!=0){if(this.mEnterAnimationEnd<=now){this.mCurrDrawable.mutate().setAlpha(this.mAlpha);this.mEnterAnimationEnd=0;}else{var animAlpha=(this.mEnterAnimationEnd-now)*255/this.mDrawableContainerState.mEnterFadeDuration;if(DrawableContainer.DEBUG)android.util.Log.i(DrawableContainer.TAG,toString()+\" cur alpha \"+animAlpha);this.mCurrDrawable.mutate().setAlpha((255-animAlpha)*this.mAlpha/255);animating=true;}}}else{this.mEnterAnimationEnd=0;}if(this.mLastDrawable!=null){if(this.mExitAnimationEnd!=0){if(this.mExitAnimationEnd<=now){this.mLastDrawable.setVisible(false,false);this.mLastDrawable=null;this.mExitAnimationEnd=0;}else{var _animAlpha=(this.mExitAnimationEnd-now)*255/this.mDrawableContainerState.mExitFadeDuration;if(DrawableContainer.DEBUG)android.util.Log.i(DrawableContainer.TAG,toString()+\" last alpha \"+_animAlpha);this.mLastDrawable.mutate().setAlpha(_animAlpha*this.mAlpha/255);animating=true;}}}else{this.mExitAnimationEnd=0;}if(schedule&&animating){this.scheduleSelf(this.mAnimationRunnable,now+1000/60);}}},{key:'getCurrent',value:function getCurrent(){return this.mCurrDrawable;}},{key:'getConstantState',value:function getConstantState(){if(this.mDrawableContainerState.canConstantState()){return this.mDrawableContainerState;}return null;}},{key:'mutate',value:function mutate(){if(!this.mMutated&&_get2(DrawableContainer.prototype.__proto__||Object.getPrototypeOf(DrawableContainer.prototype),'mutate',this).call(this)==this){this.mDrawableContainerState.mutate();this.mMutated=true;}return this;}},{key:'setConstantState',value:function setConstantState(state){this.mDrawableContainerState=state;}}]);return DrawableContainer;}(drawable.Drawable);DrawableContainer.DEBUG=Log.DBG_DrawableContainer;DrawableContainer.TAG=\"DrawableContainer\";DrawableContainer.DEFAULT_DITHER=true;drawable.DrawableContainer=DrawableContainer;(function(DrawableContainer){var DrawableContainerState=function(){function DrawableContainerState(orig,owner){_classCallCheck(this,DrawableContainerState);this.mVariablePadding=false;this.mPaddingChecked=false;this.mConstantSize=false;this.mComputedConstantSize=false;this.mConstantWidth=0;this.mConstantHeight=0;this.mConstantMinimumWidth=0;this.mConstantMinimumHeight=0;this.mCheckedOpacity=false;this.mOpacity=0;this.mCheckedStateful=false;this.mStateful=false;this.mCheckedConstantState=false;this.mCanConstantState=false;this.mDither=DrawableContainer.DEFAULT_DITHER;this.mMutated=false;this.mEnterFadeDuration=0;this.mExitFadeDuration=0;this.mAutoMirrored=false;this.mOwner=owner;if(orig!=null){this.mCheckedConstantState=true;this.mCanConstantState=true;this.mVariablePadding=orig.mVariablePadding;this.mConstantSize=orig.mConstantSize;this.mDither=orig.mDither;this.mMutated=orig.mMutated;this.mEnterFadeDuration=orig.mEnterFadeDuration;this.mExitFadeDuration=orig.mExitFadeDuration;this.mAutoMirrored=orig.mAutoMirrored;this.mConstantPadding=orig.getConstantPadding();this.mPaddingChecked=true;this.mConstantWidth=orig.getConstantWidth();this.mConstantHeight=orig.getConstantHeight();this.mConstantMinimumWidth=orig.getConstantMinimumWidth();this.mConstantMinimumHeight=orig.getConstantMinimumHeight();this.mComputedConstantSize=true;this.mOpacity=orig.getOpacity();this.mCheckedOpacity=true;this.mStateful=orig.isStateful();this.mCheckedStateful=true;var origDr=orig.mDrawables;this.mDrawables=new Array(0);var origDf=orig.mDrawableFutures;if(origDf!=null){this.mDrawableFutures=origDf.clone();}else{this.mDrawableFutures=new SparseArray(this.mNumChildren);}var N=this.mNumChildren;for(var i=0;i<N;i++){if(origDr[i]!=null){this.mDrawableFutures.put(i,new ConstantStateFuture(origDr[i]));}}}else{this.mDrawables=new Array(0);}}_createClass(DrawableContainerState,[{key:'addChild',value:function addChild(dr){var pos=this.mNumChildren;dr.setVisible(false,true);dr.setCallback(this.mOwner);this.mDrawables.push(dr);this.mCheckedStateful=false;this.mCheckedOpacity=false;this.mConstantPadding=null;this.mPaddingChecked=false;this.mComputedConstantSize=false;return pos;}},{key:'getCapacity',value:function getCapacity(){return this.mDrawables.length;}},{key:'createAllFutures',value:function createAllFutures(){if(this.mDrawableFutures!=null){var futureCount=this.mDrawableFutures.size();for(var keyIndex=0;keyIndex<futureCount;keyIndex++){var index=this.mDrawableFutures.keyAt(keyIndex);this.mDrawables[index]=this.mDrawableFutures.valueAt(keyIndex).get(this);}this.mDrawableFutures=null;}}},{key:'getChildCount',value:function getChildCount(){return this.mNumChildren;}},{key:'getChildren',value:function getChildren(){this.createAllFutures();return this.mDrawables;}},{key:'getChild',value:function getChild(index){var result=this.mDrawables[index];if(result!=null){return result;}if(this.mDrawableFutures!=null){var keyIndex=this.mDrawableFutures.indexOfKey(index);if(keyIndex>=0){var prepared=this.mDrawableFutures.valueAt(keyIndex).get(this);this.mDrawables[index]=prepared;this.mDrawableFutures.removeAt(keyIndex);return prepared;}}return null;}},{key:'mutate',value:function mutate(){var N=this.mNumChildren;var drawables=this.mDrawables;for(var i=0;i<N;i++){if(drawables[i]!=null){drawables[i].mutate();}}this.mMutated=true;}},{key:'setVariablePadding',value:function setVariablePadding(variable){this.mVariablePadding=variable;}},{key:'getConstantPadding',value:function getConstantPadding(){if(this.mVariablePadding){return null;}if(this.mConstantPadding!=null||this.mPaddingChecked){return this.mConstantPadding;}this.createAllFutures();var r=null;var t=new Rect();var N=this.mNumChildren;var drawables=this.mDrawables;for(var i=0;i<N;i++){if(drawables[i].getPadding(t)){if(r==null)r=new Rect(0,0,0,0);if(t.left>r.left)r.left=t.left;if(t.top>r.top)r.top=t.top;if(t.right>r.right)r.right=t.right;if(t.bottom>r.bottom)r.bottom=t.bottom;}}this.mPaddingChecked=true;return this.mConstantPadding=r;}},{key:'setConstantSize',value:function setConstantSize(constant){this.mConstantSize=constant;}},{key:'isConstantSize',value:function isConstantSize(){return this.mConstantSize;}},{key:'getConstantWidth',value:function getConstantWidth(){if(!this.mComputedConstantSize){this.computeConstantSize();}return this.mConstantWidth;}},{key:'getConstantHeight',value:function getConstantHeight(){if(!this.mComputedConstantSize){this.computeConstantSize();}return this.mConstantHeight;}},{key:'getConstantMinimumWidth',value:function getConstantMinimumWidth(){if(!this.mComputedConstantSize){this.computeConstantSize();}return this.mConstantMinimumWidth;}},{key:'getConstantMinimumHeight',value:function getConstantMinimumHeight(){if(!this.mComputedConstantSize){this.computeConstantSize();}return this.mConstantMinimumHeight;}},{key:'computeConstantSize',value:function computeConstantSize(){this.mComputedConstantSize=true;this.createAllFutures();var N=this.mNumChildren;var drawables=this.mDrawables;this.mConstantWidth=this.mConstantHeight=-1;this.mConstantMinimumWidth=this.mConstantMinimumHeight=0;for(var i=0;i<N;i++){var dr=drawables[i];var s=dr.getIntrinsicWidth();if(s>this.mConstantWidth)this.mConstantWidth=s;s=dr.getIntrinsicHeight();if(s>this.mConstantHeight)this.mConstantHeight=s;s=dr.getMinimumWidth();if(s>this.mConstantMinimumWidth)this.mConstantMinimumWidth=s;s=dr.getMinimumHeight();if(s>this.mConstantMinimumHeight)this.mConstantMinimumHeight=s;}}},{key:'setEnterFadeDuration',value:function setEnterFadeDuration(duration){this.mEnterFadeDuration=duration;}},{key:'getEnterFadeDuration',value:function getEnterFadeDuration(){return this.mEnterFadeDuration;}},{key:'setExitFadeDuration',value:function setExitFadeDuration(duration){this.mExitFadeDuration=duration;}},{key:'getExitFadeDuration',value:function getExitFadeDuration(){return this.mExitFadeDuration;}},{key:'getOpacity',value:function getOpacity(){if(this.mCheckedOpacity){return this.mOpacity;}this.createAllFutures();this.mCheckedOpacity=true;var N=this.mNumChildren;var drawables=this.mDrawables;var op=N>0?drawables[0].getOpacity():PixelFormat.TRANSPARENT;for(var i=1;i<N;i++){op=drawable.Drawable.resolveOpacity(op,drawables[i].getOpacity());}this.mOpacity=op;return op;}},{key:'isStateful',value:function isStateful(){if(this.mCheckedStateful){return this.mStateful;}this.createAllFutures();this.mCheckedStateful=true;var N=this.mNumChildren;var drawables=this.mDrawables;for(var i=0;i<N;i++){if(drawables[i].isStateful()){this.mStateful=true;return true;}}this.mStateful=false;return false;}},{key:'canConstantState',value:function canConstantState(){if(this.mCheckedConstantState){return this.mCanConstantState;}this.createAllFutures();this.mCheckedConstantState=true;var N=this.mNumChildren;var drawables=this.mDrawables;for(var i=0;i<N;i++){if(drawables[i].getConstantState()==null){this.mCanConstantState=false;return false;}}this.mCanConstantState=true;return true;}},{key:'newDrawable',value:function newDrawable(){return undefined;}},{key:'mNumChildren',get:function get(){return this.mDrawables.length;}}]);return DrawableContainerState;}();DrawableContainer.DrawableContainerState=DrawableContainerState;var ConstantStateFuture=function(){function ConstantStateFuture(source){_classCallCheck(this,ConstantStateFuture);this.mConstantState=source.getConstantState();}_createClass(ConstantStateFuture,[{key:'get',value:function get(state){var result=this.mConstantState.newDrawable();result.setCallback(state.mOwner);if(state.mMutated){result.mutate();}return result;}}]);return ConstantStateFuture;}();})(DrawableContainer=drawable.DrawableContainer||(drawable.DrawableContainer={}));})(drawable=graphics.drawable||(graphics.drawable={}));})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var drawable;(function(drawable){var SystemClock=android.os.SystemClock;var Drawable=android.graphics.drawable.Drawable;var DrawableContainer=android.graphics.drawable.DrawableContainer;var AnimationDrawable=function(_DrawableContainer){_inherits(AnimationDrawable,_DrawableContainer);function AnimationDrawable(state){_classCallCheck(this,AnimationDrawable);var _this24=_possibleConstructorReturn(this,(AnimationDrawable.__proto__||Object.getPrototypeOf(AnimationDrawable)).call(this));_this24.mCurFrame=-1;var _as=new AnimationDrawable.AnimationState(state,_this24);_this24.mAnimationState=_as;_this24.setConstantState(_as);if(state!=null){_this24.setFrame(0,true,false);}return _this24;}_createClass(AnimationDrawable,[{key:'setVisible',value:function setVisible(visible,restart){var changed=_get2(AnimationDrawable.prototype.__proto__||Object.getPrototypeOf(AnimationDrawable.prototype),'setVisible',this).call(this,visible,restart);if(visible){if(changed||restart){this.setFrame(0,true,true);}}else{this.unscheduleSelf(this);}return changed;}},{key:'start',value:function start(){if(!this.isRunning()){this.run();}}},{key:'stop',value:function stop(){if(this.isRunning()){this.unscheduleSelf(this);}}},{key:'isRunning',value:function isRunning(){return this.mCurFrame>-1;}},{key:'run',value:function run(){this.nextFrame(false);}},{key:'unscheduleSelf',value:function unscheduleSelf(what){this.mCurFrame=-1;_get2(AnimationDrawable.prototype.__proto__||Object.getPrototypeOf(AnimationDrawable.prototype),'unscheduleSelf',this).call(this,what);}},{key:'getNumberOfFrames',value:function getNumberOfFrames(){return this.mAnimationState.getChildCount();}},{key:'getFrame',value:function getFrame(index){return this.mAnimationState.getChild(index);}},{key:'getDuration',value:function getDuration(i){return this.mAnimationState.mDurations[i];}},{key:'isOneShot',value:function isOneShot(){return this.mAnimationState.mOneShot;}},{key:'setOneShot',value:function setOneShot(oneShot){this.mAnimationState.mOneShot=oneShot;}},{key:'addFrame',value:function addFrame(frame,duration){this.mAnimationState.addFrame(frame,duration);if(this.mCurFrame<0){this.setFrame(0,true,false);}}},{key:'nextFrame',value:function nextFrame(unschedule){var next=this.mCurFrame+1;var N=this.mAnimationState.getChildCount();if(next>=N){next=0;}this.setFrame(next,unschedule,!this.mAnimationState.mOneShot||next<N-1);}},{key:'setFrame',value:function setFrame(frame,unschedule,animate){if(frame>=this.mAnimationState.getChildCount()){return;}this.mCurFrame=frame;this.selectDrawable(frame);if(unschedule){this.unscheduleSelf(this);}if(animate){this.mCurFrame=frame;this.scheduleSelf(this,SystemClock.uptimeMillis()+this.mAnimationState.mDurations[frame]);}}},{key:'inflate',value:function inflate(r,parser){_get2(AnimationDrawable.prototype.__proto__||Object.getPrototypeOf(AnimationDrawable.prototype),'inflate',this).call(this,r,parser);var a=r.obtainAttributes(parser);this.mAnimationState.setVariablePadding(a.getBoolean(\"android:variablePadding\",false));this.mAnimationState.mOneShot=a.getBoolean(\"android:oneshot\",false);a.recycle();var _iteratorNormalCompletion34=true;var _didIteratorError34=false;var _iteratorError34=undefined;try{for(var _iterator34=Array.from(parser.children)[Symbol.iterator](),_step34;!(_iteratorNormalCompletion34=(_step34=_iterator34.next()).done);_iteratorNormalCompletion34=true){var child=_step34.value;var item=child;if(item.tagName.toLowerCase()!=='item'){continue;}a=r.obtainAttributes(item);var duration=a.getInt(\"android:duration\",-1);if(duration<0){throw Error('new XmlPullParserException(parser.getPositionDescription() + \": <item> tag requires a \\'duration\\' attribute\")');}var dr=a.getDrawable(\"android:drawable\");a.recycle();if(!dr&&item.children[0]instanceof HTMLElement){dr=Drawable.createFromXml(r,item.children[0]);}if(!dr){throw Error('new XmlPullParserException(<item> tag requires a \\'drawable\\' attribute or child tag defining a drawable)');}this.mAnimationState.addFrame(dr,duration);if(dr!=null){dr.setCallback(this);}}}catch(err){_didIteratorError34=true;_iteratorError34=err;}finally{try{if(!_iteratorNormalCompletion34&&_iterator34.return){_iterator34.return();}}finally{if(_didIteratorError34){throw _iteratorError34;}}}this.setFrame(0,true,false);}},{key:'mutate',value:function mutate(){if(!this.mMutated&&_get2(AnimationDrawable.prototype.__proto__||Object.getPrototypeOf(AnimationDrawable.prototype),'mutate',this).call(this)==this){this.mAnimationState.mDurations=[].concat(_toConsumableArray(this.mAnimationState.mDurations));this.mMutated=true;}return this;}}]);return AnimationDrawable;}(DrawableContainer);drawable.AnimationDrawable=AnimationDrawable;(function(AnimationDrawable){var AnimationState=function(_DrawableContainer$Dr){_inherits(AnimationState,_DrawableContainer$Dr);function AnimationState(orig,owner){_classCallCheck(this,AnimationState);var _this25=_possibleConstructorReturn(this,(AnimationState.__proto__||Object.getPrototypeOf(AnimationState)).call(this,orig,owner));if(orig!=null){_this25.mDurations=orig.mDurations;_this25.mOneShot=orig.mOneShot;}else{_this25.mDurations=androidui.util.ArrayCreator.newNumberArray(_this25.getCapacity());_this25.mOneShot=true;}return _this25;}_createClass(AnimationState,[{key:'newDrawable',value:function newDrawable(){return new AnimationDrawable(this);}},{key:'addFrame',value:function addFrame(dr,dur){var pos=_get2(AnimationState.prototype.__proto__||Object.getPrototypeOf(AnimationState.prototype),'addChild',this).call(this,dr);this.mDurations[pos]=dur;}}]);return AnimationState;}(DrawableContainer.DrawableContainerState);AnimationDrawable.AnimationState=AnimationState;})(AnimationDrawable=drawable.AnimationDrawable||(drawable.AnimationDrawable={}));})(drawable=graphics.drawable||(graphics.drawable={}));})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var drawable;(function(drawable_7){var DEBUG=android.util.Log.DBG_StateListDrawable;var TAG=\"StateListDrawable\";var DEFAULT_DITHER=true;var StateListDrawable=function(_drawable_7$DrawableC){_inherits(StateListDrawable,_drawable_7$DrawableC);function StateListDrawable(){_classCallCheck(this,StateListDrawable);var _this26=_possibleConstructorReturn(this,(StateListDrawable.__proto__||Object.getPrototypeOf(StateListDrawable)).call(this));_this26.initWithState(null);return _this26;}_createClass(StateListDrawable,[{key:'initWithState',value:function initWithState(state){var _as=new StateListState(state,this);this.mStateListState=_as;this.setConstantState(_as);this.onStateChange(this.getState());}},{key:'addState',value:function addState(stateSet,drawable){if(drawable!=null){this.mStateListState.addStateSet(stateSet,drawable);this.onStateChange(this.getState());}}},{key:'isStateful',value:function isStateful(){return true;}},{key:'onStateChange',value:function onStateChange(stateSet){var idx=this.mStateListState.indexOfStateSet(stateSet);if(DEBUG)android.util.Log.i(TAG,\"onStateChange \"+this+\" states \"+stateSet+\" found \"+idx);if(idx<0){idx=this.mStateListState.indexOfStateSet(android.util.StateSet.WILD_CARD);}if(this.selectDrawable(idx)){return true;}return _get2(StateListDrawable.prototype.__proto__||Object.getPrototypeOf(StateListDrawable.prototype),'onStateChange',this).call(this,stateSet);}},{key:'inflate',value:function inflate(r,parser){_get2(StateListDrawable.prototype.__proto__||Object.getPrototypeOf(StateListDrawable.prototype),'inflate',this).call(this,r,parser);var a=r.obtainAttributes(parser);var state=this.mStateListState;state.mVariablePadding=a.getBoolean(\"android:variablePadding\",state.mVariablePadding);state.mConstantSize=a.getBoolean(\"android:constantSize\",state.mConstantSize);state.mEnterFadeDuration=a.getInt(\"android:enterFadeDuration\",state.mEnterFadeDuration);state.mExitFadeDuration=a.getInt(\"android:exitFadeDuration\",state.mExitFadeDuration);state.mDither=a.getBoolean(\"android:dither\",state.mDither);state.mAutoMirrored=a.getBoolean(\"android:autoMirrored\",state.mAutoMirrored);a.recycle();var _iteratorNormalCompletion35=true;var _didIteratorError35=false;var _iteratorError35=undefined;try{for(var _iterator35=Array.from(parser.children)[Symbol.iterator](),_step35;!(_iteratorNormalCompletion35=(_step35=_iterator35.next()).done);_iteratorNormalCompletion35=true){var child=_step35.value;var item=child;if(item.tagName.toLowerCase()!=='item'){continue;}var dr=void 0;var stateSpec=[];var typedArray=r.obtainAttributes(item);var _iteratorNormalCompletion36=true;var _didIteratorError36=false;var _iteratorError36=undefined;try{for(var _iterator36=typedArray.getLowerCaseNoNamespaceAttrNames()[Symbol.iterator](),_step36;!(_iteratorNormalCompletion36=(_step36=_iterator36.next()).done);_iteratorNormalCompletion36=true){var attrName=_step36.value;if(attrName==='drawable'){dr=typedArray.getDrawable(attrName);}else if(attrName.startsWith('state_')){var _state=attrName.substring('state_'.length);var stateValue=android.view.View['VIEW_STATE_'+_state.toUpperCase()];if(typeof stateValue===\"number\"){stateSpec.push(typedArray.getBoolean(attrName,true)?stateValue:-stateValue);}}}}catch(err){_didIteratorError36=true;_iteratorError36=err;}finally{try{if(!_iteratorNormalCompletion36&&_iterator36.return){_iterator36.return();}}finally{if(_didIteratorError36){throw _iteratorError36;}}}if(!dr&&item.children[0]instanceof HTMLElement){dr=drawable_7.Drawable.createFromXml(r,item.children[0]);}if(!dr){throw new Error(\": <item> tag requires a 'drawable' attribute or child tag defining a drawable\");}state.addStateSet(stateSpec,dr);}}catch(err){_didIteratorError35=true;_iteratorError35=err;}finally{try{if(!_iteratorNormalCompletion35&&_iterator35.return){_iterator35.return();}}finally{if(_didIteratorError35){throw _iteratorError35;}}}this.onStateChange(this.getState());}},{key:'getStateListState',value:function getStateListState(){return this.mStateListState;}},{key:'getStateCount',value:function getStateCount(){return this.mStateListState.getChildCount();}},{key:'getStateSet',value:function getStateSet(index){return this.mStateListState.mStateSets[index];}},{key:'getStateDrawable',value:function getStateDrawable(index){return this.mStateListState.getChild(index);}},{key:'getStateDrawableIndex',value:function getStateDrawableIndex(stateSet){return this.mStateListState.indexOfStateSet(stateSet);}},{key:'mutate',value:function mutate(){if(!this.mMutated&&_get2(StateListDrawable.prototype.__proto__||Object.getPrototypeOf(StateListDrawable.prototype),'mutate',this).call(this)==this){var sets=this.mStateListState.mStateSets;var count=sets.length;this.mStateListState.mStateSets=new Array(count);for(var i=0;i<count;i++){var _set=sets[i];if(_set!=null){this.mStateListState.mStateSets[i]=_set.concat();}}this.mMutated=true;}return this;}}]);return StateListDrawable;}(drawable_7.DrawableContainer);drawable_7.StateListDrawable=StateListDrawable;var StateListState=function(_drawable_7$DrawableC2){_inherits(StateListState,_drawable_7$DrawableC2);function StateListState(orig,owner){_classCallCheck(this,StateListState);var _this27=_possibleConstructorReturn(this,(StateListState.__proto__||Object.getPrototypeOf(StateListState)).call(this,orig,owner));if(orig!=null){_this27.mStateSets=orig.mStateSets.concat();}else{_this27.mStateSets=new Array(_this27.getCapacity());}return _this27;}_createClass(StateListState,[{key:'addStateSet',value:function addStateSet(stateSet,drawable){var pos=this.addChild(drawable);this.mStateSets[pos]=stateSet;return pos;}},{key:'indexOfStateSet',value:function indexOfStateSet(stateSet){var stateSets=this.mStateSets;var N=this.getChildCount();for(var i=0;i<N;i++){if(android.util.StateSet.stateSetMatches(stateSets[i],stateSet)){return i;}}return-1;}},{key:'newDrawable',value:function newDrawable(){var drawable=new StateListDrawable();drawable.initWithState(this);return drawable;}}]);return StateListState;}(drawable_7.DrawableContainer.DrawableContainerState);})(drawable=graphics.drawable||(graphics.drawable={}));})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var R;(function(R){R.id={\"content\":\"content\",\"background\":\"background\",\"secondaryProgress\":\"secondaryProgress\",\"progress\":\"progress\",\"contentPanel\":\"contentPanel\",\"topPanel\":\"topPanel\",\"buttonPanel\":\"buttonPanel\",\"customPanel\":\"customPanel\",\"custom\":\"custom\",\"titleDivider\":\"titleDivider\",\"titleDividerTop\":\"titleDividerTop\",\"title_template\":\"title_template\",\"icon\":\"icon\",\"alertTitle\":\"alertTitle\",\"scrollView\":\"scrollView\",\"message\":\"message\",\"button1\":\"button1\",\"button2\":\"button2\",\"button3\":\"button3\",\"leftSpacer\":\"leftSpacer\",\"rightSpacer\":\"rightSpacer\",\"text1\":\"text1\",\"action_bar_center_layout\":\"action_bar_center_layout\",\"action_bar_title\":\"action_bar_title\",\"action_bar_sub_title\":\"action_bar_sub_title\",\"action_bar_left\":\"action_bar_left\",\"action_bar_right\":\"action_bar_right\",\"parentPanel\":\"parentPanel\",\"progress_percent\":\"progress_percent\",\"progress_number\":\"progress_number\",\"title\":\"title\",\"shortcut\":\"shortcut\",\"select_dialog_listview\":\"select_dialog_listview\"};})(R=android.R||(android.R={}));})(android||(android={}));var android;(function(android){var R;(function(R){var Resources=android.content.res.Resources;var Color=android.graphics.Color;var InsetDrawable=android.graphics.drawable.InsetDrawable;var ColorDrawable=android.graphics.drawable.ColorDrawable;var LayerDrawable=android.graphics.drawable.LayerDrawable;var RotateDrawable=android.graphics.drawable.RotateDrawable;var ScaleDrawable=android.graphics.drawable.ScaleDrawable;var AnimationDrawable=android.graphics.drawable.AnimationDrawable;var StateListDrawable=android.graphics.drawable.StateListDrawable;var RoundRectDrawable=android.graphics.drawable.RoundRectDrawable;var ShadowDrawable=android.graphics.drawable.ShadowDrawable;var Gravity=android.view.Gravity;var density=Resources.getDisplayMetrics().density;var drawable=function(){function drawable(){_classCallCheck(this,drawable);}_createClass(drawable,null,[{key:'btn_default',get:function get(){var stateList=new StateListDrawable();stateList.addState([-android.view.View.VIEW_STATE_WINDOW_FOCUSED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_default_normal_holo_light);stateList.addState([-android.view.View.VIEW_STATE_WINDOW_FOCUSED,-android.view.View.VIEW_STATE_ENABLED],R.image.btn_default_disabled_holo_light);stateList.addState([android.view.View.VIEW_STATE_PRESSED],R.image.btn_default_pressed_holo_light);stateList.addState([android.view.View.VIEW_STATE_FOCUSED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_default_focused_holo_light);stateList.addState([android.view.View.VIEW_STATE_ENABLED],R.image.btn_default_normal_holo_light);stateList.addState([android.view.View.VIEW_STATE_FOCUSED],R.image.btn_default_disabled_focused_holo_light);stateList.addState([],R.image.btn_default_disabled_holo_light);return stateList;}},{key:'editbox_background',get:function get(){var stateList=new StateListDrawable();stateList.addState([android.view.View.VIEW_STATE_FOCUSED],R.image.editbox_background_focus_yellow);stateList.addState([],R.image.editbox_background_normal);return stateList;}},{key:'btn_check',get:function get(){var stateList=new StateListDrawable();stateList.addState([android.view.View.VIEW_STATE_CHECKED,-android.view.View.VIEW_STATE_WINDOW_FOCUSED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_check_on_holo_light);stateList.addState([-android.view.View.VIEW_STATE_CHECKED,-android.view.View.VIEW_STATE_WINDOW_FOCUSED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_check_off_holo_light);stateList.addState([android.view.View.VIEW_STATE_CHECKED,android.view.View.VIEW_STATE_PRESSED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_check_on_pressed_holo_light);stateList.addState([-android.view.View.VIEW_STATE_CHECKED,android.view.View.VIEW_STATE_PRESSED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_check_off_pressed_holo_light);stateList.addState([android.view.View.VIEW_STATE_CHECKED,android.view.View.VIEW_STATE_FOCUSED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_check_on_focused_holo_light);stateList.addState([-android.view.View.VIEW_STATE_CHECKED,android.view.View.VIEW_STATE_FOCUSED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_check_off_focused_holo_light);stateList.addState([android.view.View.VIEW_STATE_CHECKED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_check_on_holo_light);stateList.addState([-android.view.View.VIEW_STATE_CHECKED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_check_off_holo_light);stateList.addState([android.view.View.VIEW_STATE_CHECKED,-android.view.View.VIEW_STATE_WINDOW_FOCUSED],R.image.btn_check_on_disabled_holo_light);stateList.addState([-android.view.View.VIEW_STATE_CHECKED,-android.view.View.VIEW_STATE_WINDOW_FOCUSED],R.image.btn_check_off_disabled_holo_light);stateList.addState([android.view.View.VIEW_STATE_CHECKED,android.view.View.VIEW_STATE_FOCUSED],R.image.btn_check_on_disabled_focused_holo_light);stateList.addState([-android.view.View.VIEW_STATE_CHECKED,android.view.View.VIEW_STATE_FOCUSED],R.image.btn_check_off_disabled_focused_holo_light);stateList.addState([-android.view.View.VIEW_STATE_CHECKED],R.image.btn_check_off_disabled_holo_light);stateList.addState([android.view.View.VIEW_STATE_CHECKED],R.image.btn_check_on_disabled_holo_light);return stateList;}},{key:'btn_radio',get:function get(){var stateList=new StateListDrawable();stateList.addState([android.view.View.VIEW_STATE_CHECKED,-android.view.View.VIEW_STATE_WINDOW_FOCUSED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_radio_on_holo_light);stateList.addState([-android.view.View.VIEW_STATE_CHECKED,-android.view.View.VIEW_STATE_WINDOW_FOCUSED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_radio_off_holo_light);stateList.addState([android.view.View.VIEW_STATE_CHECKED,android.view.View.VIEW_STATE_PRESSED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_radio_on_pressed_holo_light);stateList.addState([-android.view.View.VIEW_STATE_CHECKED,android.view.View.VIEW_STATE_PRESSED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_radio_off_pressed_holo_light);stateList.addState([android.view.View.VIEW_STATE_CHECKED,android.view.View.VIEW_STATE_FOCUSED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_radio_on_focused_holo_light);stateList.addState([-android.view.View.VIEW_STATE_CHECKED,android.view.View.VIEW_STATE_FOCUSED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_radio_off_focused_holo_light);stateList.addState([android.view.View.VIEW_STATE_CHECKED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_radio_on_holo_light);stateList.addState([-android.view.View.VIEW_STATE_CHECKED,android.view.View.VIEW_STATE_ENABLED],R.image.btn_radio_off_holo_light);stateList.addState([android.view.View.VIEW_STATE_CHECKED,-android.view.View.VIEW_STATE_WINDOW_FOCUSED],R.image.btn_radio_on_disabled_holo_light);stateList.addState([-android.view.View.VIEW_STATE_CHECKED,-android.view.View.VIEW_STATE_WINDOW_FOCUSED],R.image.btn_radio_off_disabled_holo_light);stateList.addState([android.view.View.VIEW_STATE_CHECKED,android.view.View.VIEW_STATE_FOCUSED],R.image.btn_radio_on_disabled_focused_holo_light);stateList.addState([-android.view.View.VIEW_STATE_CHECKED,android.view.View.VIEW_STATE_FOCUSED],R.image.btn_radio_off_disabled_focused_holo_light);stateList.addState([-android.view.View.VIEW_STATE_CHECKED],R.image.btn_radio_off_disabled_holo_light);stateList.addState([android.view.View.VIEW_STATE_CHECKED],R.image.btn_radio_on_disabled_holo_light);return stateList;}},{key:'progress_small_holo',get:function get(){var rotate1=new RotateDrawable(null);rotate1.mState.mDrawable=R.image.spinner_16_outer_holo;rotate1.mState.mPivotXRel=true;rotate1.mState.mPivotX=0.5;rotate1.mState.mPivotYRel=true;rotate1.mState.mPivotY=0.5;rotate1.mState.mFromDegrees=0;rotate1.mState.mToDegrees=1080;var rotate2=new RotateDrawable(null);rotate2.mState.mDrawable=R.image.spinner_16_inner_holo;rotate2.mState.mPivotXRel=true;rotate2.mState.mPivotX=0.5;rotate2.mState.mPivotYRel=true;rotate2.mState.mPivotY=0.5;rotate2.mState.mFromDegrees=720;rotate2.mState.mToDegrees=0;return new LayerDrawable([rotate1,rotate2]);}},{key:'progress_medium_holo',get:function get(){var rotate1=new RotateDrawable(null);rotate1.mState.mDrawable=R.image.spinner_48_outer_holo;rotate1.mState.mPivotXRel=true;rotate1.mState.mPivotX=0.5;rotate1.mState.mPivotYRel=true;rotate1.mState.mPivotY=0.5;rotate1.mState.mFromDegrees=0;rotate1.mState.mToDegrees=1080;var rotate2=new RotateDrawable(null);rotate2.mState.mDrawable=R.image.spinner_48_inner_holo;rotate2.mState.mPivotXRel=true;rotate2.mState.mPivotX=0.5;rotate2.mState.mPivotYRel=true;rotate2.mState.mPivotY=0.5;rotate2.mState.mFromDegrees=720;rotate2.mState.mToDegrees=0;return new LayerDrawable([rotate1,rotate2]);}},{key:'progress_large_holo',get:function get(){var rotate1=new RotateDrawable(null);rotate1.mState.mDrawable=R.image.spinner_76_outer_holo;rotate1.mState.mPivotXRel=true;rotate1.mState.mPivotX=0.5;rotate1.mState.mPivotYRel=true;rotate1.mState.mPivotY=0.5;rotate1.mState.mFromDegrees=0;rotate1.mState.mToDegrees=1080;var rotate2=new RotateDrawable(null);rotate2.mState.mDrawable=R.image.spinner_76_inner_holo;rotate2.mState.mPivotXRel=true;rotate2.mState.mPivotX=0.5;rotate2.mState.mPivotYRel=true;rotate2.mState.mPivotY=0.5;rotate2.mState.mFromDegrees=720;rotate2.mState.mToDegrees=0;return new LayerDrawable([rotate1,rotate2]);}},{key:'progress_horizontal_holo',get:function get(){var layerDrawable=new LayerDrawable(null);var returnHeight=function returnHeight(){return 3*density;};var insetTopBottom=Math.floor(8*density);var bg=new ColorDrawable(0x4c000000);bg.getIntrinsicHeight=returnHeight;layerDrawable.addLayer(bg,R.id.background,0,insetTopBottom,0,insetTopBottom);var secondary=new ScaleDrawable(new ColorDrawable(0x4c33b5e5),Gravity.LEFT,1,-1);secondary.getIntrinsicHeight=returnHeight;layerDrawable.addLayer(secondary,R.id.secondaryProgress,0,insetTopBottom,0,insetTopBottom);var progress=new ScaleDrawable(new ColorDrawable(0xcc33b5e5),Gravity.LEFT,1,-1);progress.getIntrinsicHeight=returnHeight;layerDrawable.addLayer(progress,R.id.progress,0,insetTopBottom,0,insetTopBottom);layerDrawable.ensurePadding();layerDrawable.onStateChange(layerDrawable.getState());return layerDrawable;}},{key:'progress_indeterminate_horizontal_holo',get:function get(){var animDrawable=new AnimationDrawable();animDrawable.setOneShot(false);var frame=R.image.progressbar_indeterminate_holo1;frame.setCallback(animDrawable);animDrawable.addFrame(frame,50);frame=R.image.progressbar_indeterminate_holo2;frame.setCallback(animDrawable);animDrawable.addFrame(frame,50);frame=R.image.progressbar_indeterminate_holo3;frame.setCallback(animDrawable);animDrawable.addFrame(frame,50);frame=R.image.progressbar_indeterminate_holo4;frame.setCallback(animDrawable);animDrawable.addFrame(frame,50);frame=R.image.progressbar_indeterminate_holo5;frame.setCallback(animDrawable);animDrawable.addFrame(frame,50);frame=R.image.progressbar_indeterminate_holo6;frame.setCallback(animDrawable);animDrawable.addFrame(frame,50);frame=R.image.progressbar_indeterminate_holo7;frame.setCallback(animDrawable);animDrawable.addFrame(frame,50);frame=R.image.progressbar_indeterminate_holo8;frame.setCallback(animDrawable);animDrawable.addFrame(frame,50);return animDrawable;}},{key:'ratingbar_full_empty_holo_light',get:function get(){var stateList=new StateListDrawable();stateList.addState([android.view.View.VIEW_STATE_PRESSED,android.view.View.VIEW_STATE_WINDOW_FOCUSED],R.image.btn_rating_star_off_pressed_holo_light);stateList.addState([android.view.View.VIEW_STATE_FOCUSED,android.view.View.VIEW_STATE_WINDOW_FOCUSED],R.image.btn_rating_star_off_pressed_holo_light);stateList.addState([android.view.View.VIEW_STATE_SELECTED,android.view.View.VIEW_STATE_WINDOW_FOCUSED],R.image.btn_rating_star_off_pressed_holo_light);stateList.addState([],R.image.btn_rating_star_off_normal_holo_light);return stateList;}},{key:'ratingbar_full_filled_holo_light',get:function get(){var stateList=new StateListDrawable();stateList.addState([android.view.View.VIEW_STATE_PRESSED,android.view.View.VIEW_STATE_WINDOW_FOCUSED],R.image.btn_rating_star_on_pressed_holo_light);stateList.addState([android.view.View.VIEW_STATE_FOCUSED,android.view.View.VIEW_STATE_WINDOW_FOCUSED],R.image.btn_rating_star_on_pressed_holo_light);stateList.addState([android.view.View.VIEW_STATE_SELECTED,android.view.View.VIEW_STATE_WINDOW_FOCUSED],R.image.btn_rating_star_on_pressed_holo_light);stateList.addState([],R.image.btn_rating_star_on_normal_holo_light);return stateList;}},{key:'ratingbar_full_holo_light',get:function get(){var layerDrawable=new LayerDrawable(null);layerDrawable.addLayer(R.drawable.ratingbar_full_empty_holo_light,R.id.background);layerDrawable.addLayer(R.drawable.ratingbar_full_empty_holo_light,R.id.secondaryProgress);layerDrawable.addLayer(R.drawable.ratingbar_full_filled_holo_light,R.id.progress);layerDrawable.ensurePadding();layerDrawable.onStateChange(layerDrawable.getState());return layerDrawable;}},{key:'ratingbar_holo_light',get:function get(){var layerDrawable=new LayerDrawable(null);layerDrawable.addLayer(R.image.rate_star_big_off_holo_light,R.id.background);layerDrawable.addLayer(R.image.rate_star_big_half_holo_light,R.id.secondaryProgress);layerDrawable.addLayer(R.image.rate_star_big_on_holo_light,R.id.progress);layerDrawable.ensurePadding();layerDrawable.onStateChange(layerDrawable.getState());return layerDrawable;}},{key:'ratingbar_small_holo_light',get:function get(){var layerDrawable=new LayerDrawable(null);layerDrawable.addLayer(R.image.rate_star_small_off_holo_light,R.id.background);layerDrawable.addLayer(R.image.rate_star_small_half_holo_light,R.id.secondaryProgress);layerDrawable.addLayer(R.image.rate_star_small_on_holo_light,R.id.progress);layerDrawable.ensurePadding();layerDrawable.onStateChange(layerDrawable.getState());return layerDrawable;}},{key:'scrubber_control_selector_holo',get:function get(){var stateList=new StateListDrawable();stateList.addState([-android.view.View.VIEW_STATE_ENABLED],R.image.scrubber_control_disabled_holo);stateList.addState([android.view.View.VIEW_STATE_PRESSED],R.image.scrubber_control_pressed_holo);stateList.addState([android.view.View.VIEW_STATE_SELECTED],R.image.scrubber_control_focused_holo);stateList.addState([],R.image.scrubber_control_normal_holo);return stateList;}},{key:'scrubber_progress_horizontal_holo_light',get:function get(){var layerDrawable=new LayerDrawable(null);layerDrawable.addLayer(R.drawable.scrubber_track_holo_light,R.id.background);var secondary=new ScaleDrawable(R.drawable.scrubber_secondary_holo,Gravity.LEFT,1,-1);layerDrawable.addLayer(secondary,R.id.secondaryProgress);var progress=new ScaleDrawable(R.drawable.scrubber_primary_holo,Gravity.LEFT,1,-1);layerDrawable.addLayer(progress,R.id.progress);layerDrawable.ensurePadding();layerDrawable.onStateChange(layerDrawable.getState());return layerDrawable;}},{key:'scrubber_primary_holo',get:function get(){var line=new ColorDrawable(0xff33b5e5);line.getIntrinsicHeight=function(){return 3*density;};return new InsetDrawable(line,0,5*density,0,5*density);}},{key:'scrubber_secondary_holo',get:function get(){var line=new ColorDrawable(0x4c33b5e5);line.getIntrinsicHeight=function(){return 3*density;};return new InsetDrawable(line,0,5*density,0,5*density);}},{key:'scrubber_track_holo_light',get:function get(){var line=new ColorDrawable(0x66666666);line.getIntrinsicHeight=function(){return 1*density;};return new InsetDrawable(line,0,6*density,0,6*density);}},{key:'list_selector_background',get:function get(){return this.item_background;}},{key:'list_divider',get:function get(){var divider=new ColorDrawable(0xffcccccc);return divider;}},{key:'divider_vertical',get:function get(){return this.divider_horizontal;}},{key:'divider_horizontal',get:function get(){var divider=new ColorDrawable(0xffdddddd);divider.getIntrinsicWidth=function(){return 1;};divider.getIntrinsicHeight=function(){return 1;};return divider;}},{key:'item_background',get:function get(){var stateList=new StateListDrawable();stateList.addState([android.view.View.VIEW_STATE_FOCUSED,-android.view.View.VIEW_STATE_ENABLED],new ColorDrawable(0xffebebeb));stateList.addState([android.view.View.VIEW_STATE_FOCUSED,android.view.View.VIEW_STATE_PRESSED],new ColorDrawable(0x88888888));stateList.addState([-android.view.View.VIEW_STATE_FOCUSED,android.view.View.VIEW_STATE_PRESSED],new ColorDrawable(0x88888888));stateList.addState([android.view.View.VIEW_STATE_FOCUSED],new ColorDrawable(0xffaaaaaa));stateList.addState([],new ColorDrawable(Color.TRANSPARENT));return stateList;}},{key:'toast_frame',get:function get(){var bg=new RoundRectDrawable(0xff333333,2*density,2*density,2*density,2*density);bg.getIntrinsicHeight=function(){return 32*density;};bg.getPadding=function(rect){rect.set(12*density,6*density,12*density,6*density);return true;};var shadow=new ShadowDrawable(bg,5*density,0,2*density,0x44000000);return new InsetDrawable(shadow,7*density);}}]);return drawable;}();R.drawable=drawable;})(R=android.R||(android.R={}));})(android||(android={}));var androidui;(function(androidui){var image;(function(image_2){var Rect=android.graphics.Rect;var Color=android.graphics.Color;var Canvas=android.graphics.Canvas;var NinePatchDrawable=function(_image_2$NetDrawable){_inherits(NinePatchDrawable,_image_2$NetDrawable);function NinePatchDrawable(){_classCallCheck(this,NinePatchDrawable);var _this28=_possibleConstructorReturn(this,(NinePatchDrawable.__proto__||Object.getPrototypeOf(NinePatchDrawable)).apply(this,arguments));_this28.mTmpRect=new Rect();_this28.mTmpRect2=new Rect();return _this28;}_createClass(NinePatchDrawable,[{key:'initBoundWithLoadedImage',value:function initBoundWithLoadedImage(image){var imageRatio=image.getImageRatio();this.mImageWidth=Math.floor((image.width-2)/imageRatio*android.content.res.Resources.getDisplayMetrics().density);this.mImageHeight=Math.floor((image.height-2)/imageRatio*android.content.res.Resources.getDisplayMetrics().density);this.initNinePatchBorderInfo(image);}},{key:'initNinePatchBorderInfo',value:function initNinePatchBorderInfo(image){var _this29=this;this.mNinePatchBorderInfo=NinePatchDrawable.GlobalBorderInfoCache.get(image.src);if(!this.mNinePatchBorderInfo){image.getBorderPixels(function(leftBorder,topBorder,rightBorder,bottomBorder){_this29.mNinePatchBorderInfo=new NinePatchBorderInfo(leftBorder,topBorder,rightBorder,bottomBorder);NinePatchDrawable.GlobalBorderInfoCache.set(image.src,_this29.mNinePatchBorderInfo);});}}},{key:'onLoad',value:function onLoad(){var _this30=this;var image=this.getImage();var ninePatchBorderInfo=NinePatchDrawable.GlobalBorderInfoCache.get(image.src);if(ninePatchBorderInfo){this.mNinePatchBorderInfo=ninePatchBorderInfo;_get2(NinePatchDrawable.prototype.__proto__||Object.getPrototypeOf(NinePatchDrawable.prototype),'onLoad',this).call(this);return;}image.getBorderPixels(function(leftBorder,topBorder,rightBorder,bottomBorder){ninePatchBorderInfo=new NinePatchBorderInfo(leftBorder,topBorder,rightBorder,bottomBorder);NinePatchDrawable.GlobalBorderInfoCache.set(image.src,ninePatchBorderInfo);_get2(NinePatchDrawable.prototype.__proto__||Object.getPrototypeOf(NinePatchDrawable.prototype),'onLoad',_this30).call(_this30);});}},{key:'draw',value:function draw(canvas){if(!this.mNinePatchBorderInfo)return;if(!this.isImageSizeEmpty()){var cache=this.getNinePatchCache();if(cache){canvas.drawCanvas(cache);}else{this.drawNinePatch(canvas);}}}},{key:'getNinePatchCache',value:function getNinePatchCache(){var bound=this.getBounds();var width=bound.width();var height=bound.height();var cache=this.mNinePatchDrawCache;if(cache){if(cache.getWidth()===width&&cache.getHeight()===height){return cache;}cache.recycle();}var cachePixelSize=width*height*4;var drawingCacheSize=android.view.ViewConfiguration.get().getScaledMaximumDrawingCacheSize();if(cachePixelSize>drawingCacheSize)return null;cache=this.mNinePatchDrawCache=new Canvas(bound.width(),bound.height());this.drawNinePatch(cache);return cache;}},{key:'drawNinePatch',value:function drawNinePatch(canvas){var _this31=this;var smoothEnableBak=canvas.isImageSmoothingEnabled();canvas.setImageSmoothingEnabled(false);var imageWidth=this.mImageWidth;var imageHeight=this.mImageHeight;if(imageHeight<=0||imageWidth<=0)return;var image=this.getImage();var bound=this.getBounds();var staticRatioScale=android.content.res.Resources.getDisplayMetrics().density/image.getImageRatio();var staticWidthSum=this.mNinePatchBorderInfo.getHorizontalStaticLengthSum();var staticHeightSum=this.mNinePatchBorderInfo.getVerticalStaticLengthSum();var extraWidth=bound.width()-Math.floor(staticWidthSum*staticRatioScale);var extraHeight=bound.height()-Math.floor(staticHeightSum*staticRatioScale);var staticWidthPartScale=extraWidth>=0||staticWidthSum==0?1:bound.width()/staticWidthSum;var staticHeightPartScale=extraHeight>=0||staticHeightSum==0?1:bound.height()/staticHeightSum;staticWidthPartScale*=staticRatioScale;staticHeightPartScale*=staticRatioScale;var scaleHorizontalWeightSum=this.mNinePatchBorderInfo.getHorizontalScaleLengthSum();var scaleVerticalWeightSum=this.mNinePatchBorderInfo.getVerticalScaleLengthSum();var drawColumn=function drawColumn(srcFromX,srcToX,dstFromX,dstToX){var heightParts=_this31.mNinePatchBorderInfo.getVerticalTypedValues();var srcFromY=1;var dstFromY=0;for(var i=0,size=heightParts.length;i<size;i++){var typedValue=heightParts[i];var isScalePart=NinePatchBorderInfo.isScaleType(typedValue);var srcHeight=NinePatchBorderInfo.getValueUnpack(typedValue);if(srcHeight<=0)continue;var dstHeight=void 0;if(isScalePart){if(scaleVerticalWeightSum==0)continue;dstHeight=extraHeight*srcHeight/scaleVerticalWeightSum;if(dstHeight<=0)continue;}else{dstHeight=srcHeight*staticHeightPartScale;}var srcRect=_this31.mTmpRect;var dstRect=_this31.mTmpRect2;srcRect.set(srcFromX,srcFromY,srcToX,srcFromY+srcHeight);dstRect.set(dstFromX,dstFromY,dstToX,dstFromY+dstHeight);if(srcRect.bottom===image.height-1)srcRect.bottom-=0.5;if(srcRect.right===image.width-1)srcRect.right-=0.5;canvas.drawImage(image,srcRect,dstRect);srcFromY+=srcHeight;dstFromY+=dstHeight;}};var widthParts=this.mNinePatchBorderInfo.getHorizontalTypedValues();var srcFromX=1;var dstFromX=0;for(var i=0,size=widthParts.length;i<size;i++){var typedValue=widthParts[i];var isScalePart=NinePatchBorderInfo.isScaleType(typedValue);var srcWidth=NinePatchBorderInfo.getValueUnpack(typedValue);var dstWidth=void 0;if(isScalePart){dstWidth=extraWidth*srcWidth/scaleHorizontalWeightSum;}else{dstWidth=srcWidth*staticWidthPartScale;}if(dstWidth<=0)continue;drawColumn(srcFromX,srcFromX+srcWidth,dstFromX,dstFromX+dstWidth);srcFromX+=srcWidth;dstFromX+=dstWidth;}canvas.setImageSmoothingEnabled(smoothEnableBak);}},{key:'getPadding',value:function getPadding(padding){var info=this.mNinePatchBorderInfo;if(!info)return false;var imageRatio=this.getImage()&&this.getImage().getImageRatio()||1;var staticRatioScale=android.content.res.Resources.getDisplayMetrics().density/imageRatio;padding.set(Math.floor(info.getPaddingLeft()*staticRatioScale),Math.floor(info.getPaddingTop()*staticRatioScale),Math.floor(info.getPaddingRight()*staticRatioScale),Math.floor(info.getPaddingBottom()*staticRatioScale));return true;}}]);return NinePatchDrawable;}(image_2.NetDrawable);NinePatchDrawable.GlobalBorderInfoCache=new Map();image_2.NinePatchDrawable=NinePatchDrawable;var NinePatchBorderInfo=function(){function NinePatchBorderInfo(leftBorder,topBorder,rightBorder,bottomBorder){_classCallCheck(this,NinePatchBorderInfo);this.horizontalStaticLengthSum=0;this.horizontalScaleLengthSum=0;this.verticalStaticLengthSum=0;this.verticalScaleLengthSum=0;this.paddingLeft=0;this.paddingTop=0;this.paddingRight=0;this.paddingBottom=0;this.horizontalTypedValues=[];this.verticalTypedValues=[];var tmpLength=0;var currentStatic=true;var _iteratorNormalCompletion37=true;var _didIteratorError37=false;var _iteratorError37=undefined;try{for(var _iterator37=leftBorder[Symbol.iterator](),_step37;!(_iteratorNormalCompletion37=(_step37=_iterator37.next()).done);_iteratorNormalCompletion37=true){var color=_step37.value;var isScaleColor=NinePatchBorderInfo.isScaleColor(color);var typeChange=isScaleColor&&currentStatic||!isScaleColor&&!currentStatic;if(typeChange){var lengthValue=currentStatic?tmpLength:-tmpLength;if(currentStatic)this.verticalStaticLengthSum+=tmpLength;this.verticalTypedValues.push(lengthValue);tmpLength=1;}else{tmpLength++;}currentStatic=!isScaleColor;}}catch(err){_didIteratorError37=true;_iteratorError37=err;}finally{try{if(!_iteratorNormalCompletion37&&_iterator37.return){_iterator37.return();}}finally{if(_didIteratorError37){throw _iteratorError37;}}}if(currentStatic)this.verticalStaticLengthSum+=tmpLength;this.verticalScaleLengthSum=leftBorder.length-this.verticalStaticLengthSum;this.verticalTypedValues.push(currentStatic?tmpLength:-tmpLength);tmpLength=0;currentStatic=true;var _iteratorNormalCompletion38=true;var _didIteratorError38=false;var _iteratorError38=undefined;try{for(var _iterator38=topBorder[Symbol.iterator](),_step38;!(_iteratorNormalCompletion38=(_step38=_iterator38.next()).done);_iteratorNormalCompletion38=true){var _color3=_step38.value;var _isScaleColor=NinePatchBorderInfo.isScaleColor(_color3);var _typeChange=_isScaleColor&&currentStatic||!_isScaleColor&&!currentStatic;if(_typeChange){var _lengthValue=currentStatic?tmpLength:-tmpLength;if(currentStatic)this.horizontalStaticLengthSum+=tmpLength;this.horizontalTypedValues.push(_lengthValue);tmpLength=1;}else{tmpLength++;}currentStatic=!_isScaleColor;}}catch(err){_didIteratorError38=true;_iteratorError38=err;}finally{try{if(!_iteratorNormalCompletion38&&_iterator38.return){_iterator38.return();}}finally{if(_didIteratorError38){throw _iteratorError38;}}}if(currentStatic)this.horizontalStaticLengthSum+=tmpLength;this.horizontalScaleLengthSum=topBorder.length-this.horizontalStaticLengthSum;this.horizontalTypedValues.push(currentStatic?tmpLength:-tmpLength);if(this.horizontalTypedValues.length>=3){this.paddingLeft=Math.max(0,this.horizontalTypedValues[0]);this.paddingRight=Math.max(0,this.horizontalTypedValues[this.horizontalTypedValues.length-1]);}if(this.verticalTypedValues.length>=3){this.paddingTop=Math.max(0,this.verticalTypedValues[0]);this.paddingBottom=Math.max(0,this.verticalTypedValues[this.verticalTypedValues.length-1]);}for(var i=0,length=rightBorder.length;i<length;i++){if(NinePatchBorderInfo.isScaleColor(rightBorder[i])){this.paddingTop=i;break;}}for(var _i6=0,_length3=rightBorder.length;_i6<_length3;_i6++){if(NinePatchBorderInfo.isScaleColor(rightBorder[_length3-1-_i6])){this.paddingBottom=_i6;break;}}for(var _i7=0,_length4=bottomBorder.length;_i7<_length4;_i7++){if(NinePatchBorderInfo.isScaleColor(bottomBorder[_i7])){this.paddingLeft=_i7;break;}}for(var _i8=0,_length5=bottomBorder.length;_i8<_length5;_i8++){if(NinePatchBorderInfo.isScaleColor(bottomBorder[_length5-1-_i8])){this.paddingRight=_i8;break;}}}_createClass(NinePatchBorderInfo,[{key:'getHorizontalTypedValues',value:function getHorizontalTypedValues(){return this.horizontalTypedValues;}},{key:'getHorizontalStaticLengthSum',value:function getHorizontalStaticLengthSum(){return this.horizontalStaticLengthSum;}},{key:'getHorizontalScaleLengthSum',value:function getHorizontalScaleLengthSum(){return this.horizontalScaleLengthSum;}},{key:'getVerticalTypedValues',value:function getVerticalTypedValues(){return this.verticalTypedValues;}},{key:'getVerticalStaticLengthSum',value:function getVerticalStaticLengthSum(){return this.verticalStaticLengthSum;}},{key:'getVerticalScaleLengthSum',value:function getVerticalScaleLengthSum(){return this.verticalScaleLengthSum;}},{key:'getPaddingLeft',value:function getPaddingLeft(){return this.paddingLeft;}},{key:'getPaddingTop',value:function getPaddingTop(){return this.paddingTop;}},{key:'getPaddingRight',value:function getPaddingRight(){return this.paddingRight;}},{key:'getPaddingBottom',value:function getPaddingBottom(){return this.paddingBottom;}}],[{key:'isScaleColor',value:function isScaleColor(color){return Color.alpha(color)>200&&Color.red(color)<50&&Color.green(color)<50&&Color.blue(color)<50;}},{key:'isScaleType',value:function isScaleType(typedValue){return typedValue<0;}},{key:'getValueUnpack',value:function getValueUnpack(typedValue){return Math.abs(typedValue);}}]);return NinePatchBorderInfo;}();})(image=androidui.image||(androidui.image={}));})(androidui||(androidui={}));var androidui;(function(androidui){var image;(function(image){var Drawable=android.graphics.drawable.Drawable;var Rect=android.graphics.Rect;var ChangeImageSizeDrawable=function(_Drawable6){_inherits(ChangeImageSizeDrawable,_Drawable6);function ChangeImageSizeDrawable(drawable,overrideWidth){var overrideHeight=arguments.length>2&&arguments[2]!==undefined?arguments[2]:overrideWidth;_classCallCheck(this,ChangeImageSizeDrawable);var _this32=_possibleConstructorReturn(this,(ChangeImageSizeDrawable.__proto__||Object.getPrototypeOf(ChangeImageSizeDrawable)).call(this));_this32.mTmpRect=new Rect();_this32.mMutated=false;_this32.mState=new State(null,_this32);_this32.mState.mDrawable=drawable;_this32.mState.mOverrideWidth=overrideWidth;_this32.mState.mOverrideHeight=overrideHeight;if(drawable!=null){drawable.setCallback(_this32);}return _this32;}_createClass(ChangeImageSizeDrawable,[{key:'drawableSizeChange',value:function drawableSizeChange(who){var callback=this.getCallback();if(callback!=null&&callback.drawableSizeChange){callback.drawableSizeChange(this);}}},{key:'invalidateDrawable',value:function invalidateDrawable(who){var callback=this.getCallback();if(callback!=null){callback.invalidateDrawable(this);}}},{key:'scheduleDrawable',value:function scheduleDrawable(who,what,when){var callback=this.getCallback();if(callback!=null){callback.scheduleDrawable(this,what,when);}}},{key:'unscheduleDrawable',value:function unscheduleDrawable(who,what){var callback=this.getCallback();if(callback!=null){callback.unscheduleDrawable(this,what);}}},{key:'draw',value:function draw(canvas){this.mState.mDrawable.draw(canvas);}},{key:'getPadding',value:function getPadding(padding){return this.mState.mDrawable.getPadding(padding);}},{key:'setVisible',value:function setVisible(visible,restart){this.mState.mDrawable.setVisible(visible,restart);return _get2(ChangeImageSizeDrawable.prototype.__proto__||Object.getPrototypeOf(ChangeImageSizeDrawable.prototype),'setVisible',this).call(this,visible,restart);}},{key:'setAlpha',value:function setAlpha(alpha){this.mState.mDrawable.setAlpha(alpha);}},{key:'getAlpha',value:function getAlpha(){return this.mState.mDrawable.getAlpha();}},{key:'getOpacity',value:function getOpacity(){return this.mState.mDrawable.getOpacity();}},{key:'isStateful',value:function isStateful(){return this.mState.mDrawable.isStateful();}},{key:'onStateChange',value:function onStateChange(state){var changed=this.mState.mDrawable.setState(state);this.onBoundsChange(this.getBounds());return changed;}},{key:'onBoundsChange',value:function onBoundsChange(r){this.mState.mDrawable.setBounds(r.left,r.top,r.right,r.bottom);}},{key:'getIntrinsicWidth',value:function getIntrinsicWidth(){return this.mState.mOverrideWidth;}},{key:'getIntrinsicHeight',value:function getIntrinsicHeight(){return this.mState.mOverrideHeight;}},{key:'getConstantState',value:function getConstantState(){if(this.mState.canConstantState()){return this.mState;}return null;}},{key:'mutate',value:function mutate(){if(!this.mMutated&&_get2(ChangeImageSizeDrawable.prototype.__proto__||Object.getPrototypeOf(ChangeImageSizeDrawable.prototype),'mutate',this).call(this)==this){this.mState.mDrawable.mutate();this.mMutated=true;}return this;}},{key:'getDrawable',value:function getDrawable(){return this.mState.mDrawable;}}]);return ChangeImageSizeDrawable;}(Drawable);image.ChangeImageSizeDrawable=ChangeImageSizeDrawable;var State=function(){function State(orig,owner){_classCallCheck(this,State);this.mOverrideWidth=0;this.mOverrideHeight=0;if(orig!=null){this.mDrawable=orig.mDrawable.getConstantState().newDrawable();this.mDrawable.setCallback(owner);this.mOverrideWidth=orig.mOverrideWidth;this.mOverrideHeight=orig.mOverrideHeight;this.mCheckedConstantState=this.mCanConstantState=true;}}_createClass(State,[{key:'newDrawable',value:function newDrawable(){var drawable=new ChangeImageSizeDrawable(null,0);drawable.mState=new State(this,drawable);return drawable;}},{key:'canConstantState',value:function canConstantState(){if(!this.mCheckedConstantState){this.mCanConstantState=this.mDrawable.getConstantState()!=null;this.mCheckedConstantState=true;}return this.mCanConstantState;}}]);return State;}();})(image=androidui.image||(androidui.image={}));})(androidui||(androidui={}));var android;(function(android){var R;(function(R){var NetImage=androidui.image.NetImage;var data={\"actionbar_ic_back_white\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAzCAMAAABR9YM8AAAAclBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////9eWEHEAAAAJXRSTlMA+wjy9g/JaUDVsqZONr6IFePdmHhbJBzr6c4tVEm9o5OCcF0v6lgICQAAALZJREFUOMu11EcSgzAQRFEZRBbZJjtb97+iS1PFrpuV+Nu3UphRpFq3KSNr7cLJdpCu1pVweiNKhGpOL0S3i6Me0Sb0RGSECkR3oRxRqoUCShWiMqT0E4ojQOtEaRDKGkQtpVGoGxF1lJrMUTtQmhFFi6NpRRQ7ChGpQqhUKHkVo2DZfmh6+0t0gLFvTLVgcICVBwTf9oHRCOa+cdtHhQ9m4Ru/9gATwf4crBVfdlpxnBXpE87mD+wlJVcMMSJcAAAAAElFTkSuQmCC\"],\"btn_check_off_disabled_focused_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAFVBMVEUAAAAAmcwzMzMAmcwAmcwAmcwAmcySYuXAAAAAB3RSTlMAZk1gRhAMJ+/C7AAAAGhJREFUWMPt1rEJgFAMBuE02gedwA0EtRcXEFxAcP8dXCDvb14gzV3/9WdEVNJwebPtDsDnoiMApwJzAFYFpgC4WzP3JLA0SgQWBgAAAAAAANAJ8m+m5Mj0JGZs6KPAHoBRrfRrRFTRD3MwONmn2VynAAAAAElFTkSuQmCC\"],\"btn_check_off_disabled_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgAQMAAADYVuV7AAAABlBMVEUAAAAzMzPI8eYgAAAAAnRSTlMATX7+8BUAAAAhSURBVDjLYxgFZIP/YICNcwBEMI9yRjkkcPCkqlFALgAAVYo5bSUJskUAAAAASUVORK5CYII=\"],\"btn_check_off_focused_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAMFBMVEUAAAAAmcwAmcwAmcwxNTcAmcwAmcwAmcwAmcwAmcwAmcwvOT0AmcwAmcwAmcwAmczmhCwqAAAAEHRSTlMAmRIfzgUJGg4WJtCScyQtx2HoRgAAAORJREFUWMNjGAWjYEgC1lAcIACr8tDQNJwgNBSL8WEdSjhBR2oApgVN04uNcQDzSo1QDAsi9O8I4gRnP7ViaEj6I4gHnFcLQNfQeRGfBtkZ6BpC2w/i0yBTga6BTV1QcNVj7H62WyUoWJSApiFMWVBwcSX2QJ1uJSholIpFw/PdLljB7jocGiy3YNfgPRmHBiMX7GnMRXlUw6iGUQ2jGkY1jGoY1TCqgRINhBsnlDd/CDewKG3CsRJqJJLeDKW0ocsQpoWvKb0oFbOxnoSvsa4WSn53AKEDX4cjgNQuzSgYBUMRAABvBwmfTLNSCwAAAABJRU5ErkJggg==\"],\"btn_check_off_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgAQMAAADYVuV7AAAABlBMVEUAAAAzMzPI8eYgAAAAAnRSTlMAzORBQ6MAAAAhSURBVDjLYxgFZIP/YICNcwBEMI9yRjkkcPCkqlFALgAAVYo5bSUJskUAAAAASUVORK5CYII=\"],\"btn_check_off_pressed_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAGFBMVEVPT080NDQ0NDRHR0cAAABPT09PT09PT0+86ZyxAAAACHRSTlMm1MgyABYeBtShLDEAAAB4SURBVFjD7dixDYAwEATBSzAxLdACLbxzAkukLoGE/qEAXmIlZ9ym1uTvU8TV9bFyRCiqQO0BnYASqkI1nQzM2hmY1Bkocs4Nak1KwZKUg+21HCQvBgYGBgYGBv8A+HRI4uePc25M+IuPRwQ8U+AhhE4tfMzBc9ENzCYkZWqWtP8AAAAASUVORK5CYII=\"],\"btn_check_on_disabled_focused_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAMFBMVEUAAAAAmcw9PT09PT09PT09PT09PT0AmcwAmcwAmcw9PT09PT09PT09PT0Amcw9PT1vR1UqAAAAEHRSTlMAZoBNQTg7Xj8IR0pEMVYjBJa89wAAASlJREFUWMPt1rFJBEEYhuENVsE7DSbS+GfPyEC4BhYrGKxA7OBCQxsQM/MrQazgSrAKQ7ECXZnzRdmd7x84OIT50uWZN5mFaerq6vayo4cwuknwFArBfSlYlYLMp1lfCNbdBFiO7PIrYNYXgY1ZNwGasR2bkfCAzQAu/KC17727wZUNO/cVCNwIIAIAFdDgloALHBIQQAQAIqDANQEXOEgBBV5cAcDc+r+BEHLg2brfAQHm6fYTEGCdTiWQB7PtsSc/gWUWfGzPfbVhiyYLuJ4xBWIe8AMsCGQBiRRQgAQBCVpAlIAEAQlIRA1IEFCARHQAEgQEIBE9gEQKSEAiugAJAj7QRidgFfwjML4dgqntCKxCZqe+Zyg78z102Z3rKc3eHpu6urp97BNIunQiihmctwAAAABJRU5ErkJggg==\"],\"btn_check_on_disabled_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAG1BMVEUAAAA9PT09PT09PT09PT09PT09PT09PT09PT1gyl+KAAAACXRSTlMAgE05QT1HMyNi/YIlAAAA6ElEQVRYw+3TwQ2CQBRFUaOo6x/AtRILGDvADrQESrAD7VwxQ+4G/I/EhSb/bcmZGzKwiMVise9v084EXTXxoBnZ/hUwa2eBzqyaAONvYEZCAV0Pdjoo7L27DM7Wr9YKBC4yuBKQwJqAAghIgECSAIFyoYIVAQ2cCLjADwCOUgCwtFYJAA5WCwHAcrjYbQ54oBtu9pYDDtgM3w6B5iN45HMJOKDIBxNwQP7DSgIeyIkc8AAJAi4oAMkFJAi4gETyAQkCLuAuBECCgANIJAWQyAEXkEgSIEFAA0USAQvwR2Bi80EsFov98J52GzL3vLeyTQAAAABJRU5ErkJggg==\"],\"btn_check_on_focused_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAABfVBMVEUAAAAAmcwfqdodqNotsuIBms0AmcwyteU8Pj8yteUyteUyteU7QUMEm84yteU7QUQzteUyteUFnM8yteUyteUyteUyteUzteUyteUyteUyteUEm84yteUBms0zteUyteUyteUJntEAUWsMn9IFnM8NLjsIndAMLDczteUCms0tseIyteUAV3QwtOQEm848QkUto84yteUsqtgwtOQrcokEm84IHSYcqdoDms0KJjEXo9Qiq9s6Q0cJIiszteUVotI7REgPN0UzteUnqdcdaoYeqNkDm84mi7AIGyIys+Mql74niq8jfZ8wfJYFnM8pkrgpbIMmZnsATmgwqtc7Rkksan8sdo8kXnEAmcwAmcwAmcwAmcwAmcwysuElnstChJodcY48eY4lYXUKIy0vp9QwYHAAPlMAOEoMKjUOMkASQVIUR1oAmcwAl8oAksMCms0Al8k/stkAjbwPn88RoNAAjLsqqtUtq9U+stgoqdRavd5Ftdo3r9cAkcEmqNRtLj6xAAAAbHRSTlMAmQMIBR8SDM4VDhzOFBLPIRAhGRclHik9NCMlMZ04LkMZyBcLeg93LKA7Ns0rHNRLSEdBzaZsJKFzMC7Rb1Ur1IFOQTo1o0NpXEs5MtOqSMrGxUzWyNDCko6HbmdiPdPRzsNhVL+3s2RdRkIKm20RAAAGAUlEQVRo3u2Y+VsSQRjHTS6BOASWBXYTNkxQAxJKFCQ88ii7s/u+T8vSsvtv731nZnc22Jhln/qh5+H7PPqDwucz78zszOwMDTLIIP9Lho38SzbPX6e7TfmbDkbvyt8ycLrLFFuKYTsxgX1GzIoeeLdLlHGSCZIAkgMY3dHTgHj4prdnQph8Pq9pWj4fDo/qoQ5q+KMA8CGtXPb0TAyjYOoxLeFnQVWAGP5cwrB73KvcuXXATg5BJicn68lgPJGIw08CHFCFYbAuYEK52Q9+bq4NBhqQgGGUGFBgXUDotm0+4ufWmvVMlAZKwSJ6CLAA7UY//LW1E82SLEnSqY3HZ1EBhh4lgMBbxu/D6InGt91uNBqrkGapJMunZu8/3DibQQOOg1jg0UKW0xOD07PsidXr7SZEzUJOtc59/Xp8VjdACX8WeIhAW4gctE6EZAGyCNlaVNV0er117v337++JIRiHEoQCTygy0ivoqNCk09PrrWufv+ztfSIGLIH0UW+B9+CI/rfuFcjnGw3748GoJBfV9PTY+jzwd9+92yUGUgIdBLGgc3mjeM7Pqumx1AXKf/Pm3e6X/Qcb0SQR+ASC0MERjuVxIT/A+dNTqQuF44SP2d7eef4aBaN2BZzM4kO+PxFPIh+aXzsD/E+Uv73z9sPRDRwEmwKO5mt+AJufCJr57038w7PtTJKOgVjA+0SHAx3x0D0ZqaRa8VsNmQiEsygG05TjkYwJh/2IT0YzchH5uS7+ZlGKMoHbhoDhgYxoP9IJng1v7ljh4m/8+XtqSYric+CzIwA+wyM6EQd4MIl4bD7hH+nkp7NyBgRhG4J8ZAT5OKZAZ+wo0AGfJd3fxS+sjKlFWe8hGwLgUzzSgY1wuVRUAQ/Nn7ly5GoHf2pa0EMdAugfwkc8g2eBPg34GvIv/cY/cqxGBKQAmwJ8pPxkVGE32czq9FQuN0P4+3tmfq6WmkqXcJKy7UAsMJ4p3E1am9OEXgP6zPKTLv5MrrqystqUggmjALHA4ONuMr+eqtWw8cvLyyc7+IVjuVz1/PnzJ5r1II4AK0AgYGtaBvhkNymcmaH0kyeXuvi1WhX4JxogYB0kEGgowAKQD6sl7iaFY0CHnF561Nn/qdRKFfhrjXqcTiEsQCggBSCf7SYXjzwB+mkr/tTU1MoJIkgEKN+mIBndeLD/E2cjMSwB/u7SdRP/I+GPbW2hYG2uEfNzvkgwGoYeevVsZ3sbWNRwdemuJT9d2Vq9B/zJtsfLZ5AtQWbj6Ie3oDAMnfwq8rOVxcYq8CfbZe8454u7CARnZ7lhb//b1affLPhyZbG5CvxDijbh4nw7Y5CRN1smw6dvlnypsthuAJ8IkC8W5PVBlopmw+7e3q4FP1pZrDeAf0jJj/MJKhTgcwACdX2eGVi6+cHKQr19CBJDwZBNAaylIMjA5s4MnfwrBj8eWYihADaqcfeQbQEbhGJ67EKBG6z4/siCRwE+CobtC1gflWD/5QbePyZ+OBIpK8DvU2CUoI6lzjCDNT8wEtGUA/0KXHoJMArcQPmFas3M94EgRs9TLpuCEAhYCVF6yGK9hPzLhWoK9kfOB0GeCrz9CMBAlwupaBh2CH8Fmq8WOd/lSOB20U5CQymr4nvA0Y8/fny8PA/nB+RnDD4IQv0JPPRk52PbJnvVQAPwKV7CYzTju/sT8MMvN2RkPHDBqnG5tapmizI038R3jxwMefoWDIOAGWBni0oSHIw2X7xsFkvQevLSzd+InQl0w2hYP32BRIZfDB82+A4EXhBwAzu2J9mNAcEjn+3vKPD2LxhCA46DoYjzOw+KN/ZfZwJm0E/Z5BQP8QOd4XW+Q4HZQBwgwbCbLRfnOxUwA3+VYum4mnMuYAaM4HLRkUBwO4p45DsT4FLRVyKC50B8nRPpSMd/FzTFWiC+kAr1ivEhzUME5R4C8ZVazIinK4oiFvBLQce5oU0IBPRa03FuhwTnLn4x6yg3FVEB/GrZQW7dUbyiAsyX432mXNZCE+PCAvj1ft+ZADw/WYsUTsLxYoXDDA0yyCCDDPKP8guHrOe8HDBTsAAAAABJRU5ErkJggg==\"],\"btn_check_on_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAABPlBMVEUAAAAzteUzteU9PT0zteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteU9Pj4zteUzteUzteUzteUzteUzteUzteUMLTkzteUzteUzteUzteUzteUvp9QzteU9P0AIHCQ9QUMAT2kLKTQAV3QKIy0zteUAUWwzteUzteUzteUdaIQOM0Ays+MytOQpkrkzteUnjLErdIwpb4YmX3IPOEcjfZ8AU28oaH4zteUql74updIscokKIy0upNAnjLEnjbMufJYveZI9fJApa4ImZXoysuEsn8kdcY4uptETRFYiepormcIkgKJEh500gZsAWXc2bYAAPlMAOEoOMkAAmcwAmMoAksMAjbwOn88/stkQoNAqqtUsq9VBs9k+stgoqdRavd43r9cAj79HttoyrdYAibcmqNRAenSqAAAAV3RSTlMAAwbNDAgOEgohFBkXGx0fL84lNCMQOCoReDInQiw9Sj/Ra9THdc1wO8gpSFY5fVFNSEVEz8vCgzTJyFxLP81jRj401NHPycViTtFbREA6L9XVzce3s134HTq+AAAE2UlEQVRo3u2ZaXfSUBCGS1EhQoCEBAIxCIlIxbYuWDfUarXu+1qlVFqty///A85MhiZw0ZsCnqPn5P3c8zzcmZu5ye1CnDhx/pckDvI32GLmTxczX/xiKHM0hOFHOWHHXPgMT6ePYNJpdsxDEOAJfgxDElCwYXY+4RFumhbGRAcpyDAzn/GmlUodp6RS4JiLgfmEB3o2m6FkwWHBKoaGmfmMz6hqjqKCghaRZsHsfMLn8nmFkvcVUCVYAgpm5Vs+XjEMXV9ZX38BCjRYwRJm48PPV3OKYuh2u7zibm66LwwypKBILJiRn1Hh1wPdKTxr3fvy5ZZ7lQxYpLS0Rsk/RYM0MJ7nOYVqFfiDr18Hl9CQU2EJ0AWZICrfqxaLnda93b1+f2cbDbgEi2okE4gzefj4HjliprKZnKK3nUKxWOo0L+3u9T586JFByUGNogmILeLTB/xyoVos1YZ8MOx9f+xCF7LYBLlgFMw56m//rOrzS0v1C8zHbG1tvXuKAjOygNkMRzxtfzXv82v1G5Vbuzs9xn/cv+Ya0QQJX8BgJENoLFu4PYlf9PnbAf/TNXeDBNQDucCnE5hnvmn5T5dhE//EjcraCL+1YUcTJFDg45mMI98fnDgbbAf4dZH/3LGVPO+ihEzAeBr4OPER7o8e2j5L9ROPBH6hrOM2NWVPcgIFwXnCbBXoiG870F7i3w/zzzRvFgtlQ4EKRRMgn3pKPxzZNNgQj+29eFLgl6pYIW6BXBAa+FAXnMk4NhGPPx/410f5t5eKBxWS9Bj3Z1KD+iCfy27bZYAD3cefHedXbtdgAbyHqEJyAZ8ogF9x168CnOg1xJ89v3p9+3M/zK/zAnjURRBggYivr7gvN1t3iiWiE/7c6oNR/kngUwcywwXIBJqGRwrzX8Fp0urUmX7+nMg/ERSIOiB7ChZBwDMN6nN3G06TteYNpi8vT+QX2ka4QHIBdACeWuTDtITTZK3yiOjAvzyBzw1IBSe+VEBDH/l8mqytPlle7na7Vy4PBH5R4EcSQAfcx99/Ap8M91efdLsPJ/E9T+RLBSYKnr6FQwRhZLh+5eEY/5T/+z1P4EcUGO7r/Y+kYMNEfsHzRH60EhlX3dOfhob+529vLn+bwC97nsCPKrA3WiHDzmAwia97DYEvF+Bzllds507I0Ov3exP4SqMh4YtPMj8Hiu5U7zTZwBH5uUZDzhdHBXZZMeDw7bBB4NeZn2k05Hxx2HETnGrpwohB5B9vaCJfLuAawRKWLlTYMJmf0jSBLzPgeRAsocaGgD86HzRNzhePzNASSnU2MH98vmmayJcLeAm+ocZ9ID6eXyPzU0syP2pQQK/pXKTAgPzmTShP1WkH8yeZFPlywaJfJDTQizrt1n3kw/FYgPMrmD8kWDhMSBB8ien0utJpnf7x41TrJuLLupE/4JNg4bCCsW89VMDUONUivB3+3FvEv144ZJLJsa9VeuvaWH8P9Dbic2rwRQyChWkEbLBSw7cv3YboOuLxe3jIn1Lw+xsDvjIwmT+tIHynYqGCLz1UoPv4YP5MJxgacBGwCnyLp+DF0Oi90LQCNtAi0GGlIHTrxHjmTytgQ+hTiiNczU0vEO8WxcvFqQWS21HAE39qwaHyLwoi37H/J/8liBMnTpw4ceLEkeQXuf5HL4dNIhQAAAAASUVORK5CYII=\"],\"btn_check_on_pressed_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAANlBMVEVPT08+Pj4+Pj5KSkpAQEAAAAA/Pz9PT08/Pz9PT09PT08/Pz9AQEBAQEBPT09PT09CQkI9PT36oQq5AAAAEXRSTlMm1MgyiACTFp4eAZeNggYHXQY8LIYAAAExSURBVGje7drBbsJAFENRtx0YJlAg//+zTaRWruQNU+NFxfMa3SOxSBZ5OGy79oGnb/Tb3t6ApSO0vuzAMhDbWDagI7h+wBXR3dARXcdAdAO1Wq1We6mdjojutK6Twtuj++lTCABbn8LDwNT/I4IPaH/bOQGc11+7PxXQfoMBGH0DOErfBPw+gVCfgNv3gYv2fcDvE7D6PtCk7wCns99XQN8mfl8Bvk3svgLsU3D7CvBpf8H3Pu0+AfYpaJ+/ngfuUpO+AejzRvomoIL0PUAF6dsABe3bgAra9wEK2vcBCtr3ARG07wMUpO8DIrCfACg0JAAKDQmAQkMCoNCQACg0ZACugAJeC/iY2F+Auc0D75NDrVar1Wqz+0/fxEf8aCB+9pA+3IifnuSPZ5LnP9e9/QXc5ydUPu9cjgAAAABJRU5ErkJggg==\"],\"btn_default_disabled_focused_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABiCAMAAADwfaQ5AAAAM1BMVEUAAAAzteUAmcwAAAAAAAAAkMAAmcwAjbwAmMsAM0UAAAAAgq4AfqgAbpMAgawAAAD/AAA0FdE+AAAAD3RSTlMAHz4TD0I5PSkZCjIyDQj2gUbVAAAAn0lEQVRYw+3ZSw6DMAxFUZq2zodP2P9qKzGqGFjYqkoC9y7gjDLJ83CoujWc0QoICHgJcN+SJJiStGjeLMGczAqYgqOkgOIBRQGDq/+Dj8MBdgFWQEBAQEBAQD9YAW8Atv8OAQEBAQE3sPkPOGAvYMvrnPwaHD3eqIA52r2YFbDkKb5NxSkXbRh/OtKX9vIyVnq7BQAC+sD1K8/Beid8AI8uHiWs1BycAAAAAElFTkSuQmCC\"],\"btn_default_disabled_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABiCAMAAADwfaQ5AAAAbFBMVEUAAACZmZl5eXl0dHQAAAAAAACHh4dsbGyWlpZbW1uNjY1kZGQjIyOWlpZwcHAAAAAAAAB4eHhubm6Li4teXl5aWlqUlJSIiIhzc3NgYGBTU1N6enqMjIyXl5eIiIiXl5eMjIwAAAAAAAD/AADhocx4AAAAInRSTlMAJ4CAJh6AgICAgIAwJxUUAnp6eHh2dGNjX15cWjIxMDADER06CAAAAMlJREFUWMPt2TkOgzAQhWHALIltMPu+Be5/x0hUUYoRQxOjvP8An1y4mRnnVNuR84t2gAAB2gAmY/1gVY8J5SeFlCErKQtKHMJmcllNTTgQYOYtLrPFywhQeC47TwAEaBu4AQQIECBAgACvgxvAPwDt/4cAAQIECPAArR/AAd4BjLleTIK5WLngKnIC7KJ2jlnvm9uoI0BdKhWxUqrUBOjrvnqyqnrtE6DxL2SIxfgr4HtBSoBOagJmJr35cQEgwHPg/tGVg/WX8AZv3Su8QPHBAAAAAABJRU5ErkJggg==\"],\"btn_default_focused_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABiCAMAAADwfaQ5AAAAS1BMVEUAAAAzteUAmcwAAAAAiLUAAAAAmcwAHigAmcwAAAAAgasAhLEAk8QAksIAa44AcpgAmcwAAAAAAAAAAAAAAAAAmcwAmcwAAAD/AAAMZPkMAAAAF3RSTlMAZsyA5mbAiYgH3NvUy8S8tm5fSz8gFpzXpUMAAACoSURBVFjD7dk5DsMwDABBR0l0+L7l/780gKsgBWGxiGV49wFTsSFZHCruFWe0AQIC5gCuvjdJ9X6V/MWa5OwigN4o8gJoNaAVQKPq/+DjcID3BCMgICAgICCgHoyANwDzn0NAQEBAwB3MfgEH1IGXvs41Gq8RwE4DdgLoqjqVqysngJNry1dSZesmAQzDM7khSIfxMI/vpMY5XPwXAAh4Erh9pXlY/wgfdZAio63fx68AAAAASUVORK5CYII=\"],\"btn_default_normal_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABiCAMAAADwfaQ5AAAAflBMVEUAAACZmZkAAAB3d3eTk5MsLCzb29sAAABZWVnAwMAAAAAAAACYmJijo6OLi4sAAAAAAAA0NDRSUlLIyMhvb28WFhagoKAAAAAqKirY2NhISEjNzc0mJibDw8NfX1+5ubmzs7NBQUF+fn7R0dGRkZGioqIAAAAAAAAAAAD/AAAgdn43AAAAKHRSTlMAZhB2aLOnMIiEBAFnbWwOCqONino4FxOolZWTi4d+fXlzcW1kVSwjhumNDwAAAOlJREFUWMPt2ckOgjAUhWEFnFpoC4I4Mo/v/4ISVsakxIsaMJ5/3y9p0k3vXbxU07eYohYgQIAzAPkhP61JnfID19i9t7/sbztCt+7AgMjKOHGWpJwkLpkWVIXTeUTRKZQWlNlyRJnUgoZp0T3LNAACfA9sAAIECBAgQIDjwQbgH4Dzf4cAAQIECLAHZ/8BB/gF0P4s6AsyaAt/AIxMYVM9M9KDMvV8Qbm1bQnfS6UWVIHrnr0tIe/suoHSgiwMrscVqeM1CJkW5Cysqw2pqg4ZHxiMMyUNUlIx/tO7AIAApwLbh8YsrJ+EOyFWMqRTaWfwAAAAAElFTkSuQmCC\"],\"btn_default_pressed_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABiCAMAAADwfaQ5AAAAclBMVEUAAABmZmYAAABkZGRaWlo3NzcAAAC7u7tNTU2Xl5cAAAAAAABycnIAAAA8PDyioqJISEiJiYlXV1eGhoYAAABcXFy6urqnp6eamppPT08uLi6xsbE9PT0VFRUaGhoAAABiYmJiYmJ4eHh3d3cAAAD/AAABlB2hAAAAJHRSTlMAZg9nbowwmnd+BAFrCoSCe3ZwFxRskomAcXFoYzkyI2RjU1NCIACPAAAA10lEQVRYw+3ZyQ6DIBSF4Sp2AlFRtM520Pd/xRpXTROI1400Pf+eLyzYcO9hVePSYY8mgAABOgCKrCnOpIomE2ZeZPEtLq+EyvmAReQvpUKPVKjUkxtB+QhnjyiGd2kE/dzbUO5bQEb3WGABA4AAV4AjQIAAAQIECHA7OAL8A9D9dwgQIECAABfQ+Q84QPfBlDGyx1ILWAV0MKgsYJukjBHvl7RmUPZRlFxIJVHUSyPIdVcfidWd5kZQcD2ciA2aC8tgnEufmOTip3cBAAHuBU4fbVlYfwlvr34uoI6kYcYAAAAASUVORK5CYII=\"],\"btn_radio_off_disabled_focused_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAaVBMVEUAAAAzteU9PT0zteU9PT09PT0zteUzteUzteU9PT0zteUzteU9PT09PT0zteU9PT0zteUzteU9PT0zteU9PT0zteUzteU9PT09PT09PT09PT0zteUzteUzteU9PT0zteUzteUzteU9PT3dmb2uAAAAI3RSTlMAZkxgRwQ4EkgOBiARPFMuWyYXTTYyLEAgCioMFkMyGxg/J0SE03YAAAMlSURBVGje7VnXltsgEEUDqlbv1Wv7/z8yoS2J4zVgmc0+6D75mIEpd4YyQgcOHDhw4DuxVMGW557n4TzfumpBb8VpK707lNcTehPCK/YeAgch2o9L5D1BtO61Xi3fBH0Ysv/WPmiUij1sJIEMRlQld0NVJMe6183P+RL5KXmo/iTGmxedqDi3ZfVEpOROvJRQHZ/bI4FpLNoMAEjWFuMkvei4FT2yRsApFMGJZwJ/gcyxUMG56F5YXxlWU8uhHevYR8iP67GF38hqPtoLDfbxwR/c+gyAnGv/z3G/PhOAjHvxga2jdGLrh2ypAgBuanWlYwaAmQ2sTIMF0yH+XD8eAAr/sdhUAGTTpwa8GNcXy28Wn5TAEH8tmQ5A0k+XGyuCe8YuQOs/E/VboaG3IHqhshszEKDQCPtnAKYhMg9SQ8s3ofEndH0dzkAmGldKQ4QM8EEdqKhxA7SIQxOljIaxovNCEwckXQUMPjLRQODGJpq5cKGGrJyAFOnBJWPput6Fq3RggBkZooBMuhBoawCLEqiBqADpg5SKYsAaUUZVSX9kMCJj3Hg6YIMNYxNupswBCxdiUaFXjSgWFM+cAXMWbiJBSs02J8NIo2qBFAZJ4PNq7kUux0CQFQjQco60JARiyxrhjKzQwqimP4E0oaDyNrjBLBJ1eyqXi2LMoEZWqFmirtpTgd5zEhFSK8QwiJ0+12Yp58xHVphYViTaPPWEAgBkBx+ImI//rwJMOXATIkXyspNk52nqptBGVWgut4qOTne+2Zlu17GL7VodOIWjAwdFzo5M94e++2uLunhFOy5eDq+OF7Oro7rDFkAmwwDNaqLd9T3zLa/vq+0D5Gz+ACmFA3qETp9Q9o9A0D0C9z9jJXH5j3mIi3d1ucpWAtG0Ei68lWDfLKoQd0LTDKlkZ8a+nRPctXPYgnftHCnqrCHVqHbR7pZaNjDLM9VSQ71oqf3EpuCfbc0vck2OL7sbs2Vw+WdPDLAY7NAOhI0ngKOgEq3lsA8iLP+Pwr3N8cZRc1xh/bK9fw3Re5A8+kCxndBbEcpPLF6eb0G1oAMHDhw48I34BUmSKxG/3YRpAAAAAElFTkSuQmCC\"],\"btn_radio_off_disabled_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAMFBMVEUAAAA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1STLyxAAAAEHRSTlMATAUMRyoWMBA7P0MhNh49I5b3UAAAAXZJREFUWMNjGAWjYBSMAsoB8/NZgiJr6wyIVW/qKAgGIsHEqc8UFLyTwcDUdlZQcBox6u0F3ZMgLLUSwcmE1asKiirA2EyBggEE/btQXAHBYyqUIuTzFmkUFRwbPfCrZxO8hCqgK5iAV0OjOLpIoQReHzgWoAuxi+DzBZcsptjFBXg0BG7CFNMWxeMiwQZMQQ5B3G7iFMVq7QScGhKdsImqiOHUMPEANlEeSZxeEFHAJszkiMsTrKI4wg5XCuSWwBH9G3BoMHTALs4ijEPDwwLs4uxyuOL5AHZxHlFcoZqAI83L4tCw0QBHcEvj0OCogF2cSQSHBkEGXBKUaiDsJAo9TThYJSmNOMJJg9LERzh5U5qBCGdRcgsByosZfuwF2QfKi0qEYU5YXCSKr7iXUsAIo4ULSKtQeEUMyKqyKK8UEdVuA1q1S1nFTrjpEMRAEHQhN05WENv8SWZgMIM3fyhvYGH6/PgsQcGVNQYMo2AUjIJRQDEAAKdsRGG19ZMWAAAAAElFTkSuQmCC\"],\"btn_radio_off_focused_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAwFBMVEUAAAAzteU9PT0zteUzteUzteU9PT0zteUzteUzteUzteUzteUzteU9PT0zteUzteUzteUzteU9PT09PT09PT0zteUzteU9PT09PT09PT0zteU9PT0zteU9PT09PT0zteU9PT09PT0zteUzteU9PT09PT09PT09PT09PT09PT0zteUzteU9PT09PT09PT09PT09PT0zteU9PT09PT09PT0zteUzteU9PT0zteUzteU9PT09PT0zteU9PT09PT09PT2npJ6rAAAAQHRSTlMAmcwElCDAN48ValInxnBLPVclpJCHMQy1nnorizK6dGo6CYB9VhkKhHBkQz8eBwV5X6yYdR0PXSwaKRR3TCKGCl/ORQAAA8lJREFUaN7tWNl6qjAQxmErIIq74r4r7kvtqT3tef+3OkwCtLYWEii94r9Rv0xmnCWTyS9kyJAhQ4bfhKYajm1LuZxk205R1X5UuVh3arlPqB3q4g+plw8Pubt4KD0LyZEv5EKgy0kj/66+YFiyLLrxkmWr1H83oSWJvSFRLZKuXm6XLpburxVj50KzqQr7fjpH6piu/43phCrRclG/F7FqNNv1OPpXdO/K//eb6f5UMQGUymn/OvODuKIVZvHrL9EUjuiv8rIJN2gOyl4ydCJYjKVfWtEfwxYAmNXp8LoThO11OK2aANAaeq5KMSwUif48+X6tACiL9fbj+ny9UFwT1Is/EneUVNzRIYdoewYwB42vMo2lCbDckbNOEvGHoz4lTO8jSW0FYPJyX2w2AajMiAWygblaxXEQn64Cx/L3ku0m9NpBlPqsJ84IQjo0oToPE21UQekGRV3kCJBD/r8Jkwjh3QJM4oOOXl+YDGAjq40w/grqj8ICepiHESZaZ+rP6KyK9VOBKoP87gStnV95LN27gK0Zv5yh2RAY0GjCwPdcZ3RAxgoBaAtM6IJZ9ndG33EH34EKLAVG7OHku1CKPAOSdybX0JuzGmgogLVax+MvMjSJmkgceBKYMSAuiB13c9TV4LgyBsmAgg6wu7DBFhwdI/HBS/EZzgIHJjDw0lwLF3zEpoUR6vklxFpIRz+B4S3P8mq5DIrABQVm3hlSI/ocbVlT+MdnoAqvwfYw6F4d7LGGePAES68GD6FyeBPgRdOCIZ+BNelbMk5JoXJYyReS4w2fgTLJ8sXdPg6VwzIQSc7mfAZeoIk9O7JOcy7wE0DgQwMUb/9DmgZENBAZolHCEKWT5DeSZA2TnHqZMh20CUxjHzTGVrGI0yqKuD31Zsfarq987boZtGvWC2eZyoUj6EmvzEMql/5T+KWffGzp3YwtzIPXgH3wagWDF/vo2GUeHdsAHKOj0P8w/L5wD79c4/sRWluG8b3KOb6/P0DeFFiwP0A6xAEWPMd/QmlpPAJNrkcg/zNWaZPEode2yPcQJxW3OQLsOR/i/FSCMpjfic4goBLylErgJ0PUgAzpTW7JkO1HMsSiZEgcusigUV37dA5RWL6lc0RPNB4hVYgkpEYFfkKKoviVUmtVwIVLqU1DKDVuUnCshojEJQUptLFPa37DaPu0pxafmM1RdEr5z0v5UicZMUvxGHDIElLLhASTZcsoSAHjnJQgz/dzISjI6dL7VH1yiKrT+ay95tRF4SehWYZuk7KybcdQNSFDhgwZMvwi/gPvHkn+qOIQ7AAAAABJRU5ErkJggg==\"],\"btn_radio_off_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAaVBMVEUAAAA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1Pag0XAAAAI3RSTlMAzL8LJcV8OyqQpLpwhGsbtp0zFwcFsZd3VFovqkEfoWEPTH3CfAwAAAGvSURBVGje7ZjpboMwEIR3bHxwhisQyJ33f8hKVSo1akS8hkRU8veXEWgZH7tDgUAgEAgEAh9mM+g+UYBIen3b0MJEWYkHyiKi5TAVABUPxm6JWmvGWAGoDC2DTQCRm5Z+IY+5AKolqmh3gCok/UFmCsi2NJNTAuiGntJoIJlp916giyYed0jtLHcVYjklkDFETd7UCvqFZJtDeddwEtCvVTlSTx/aA2IH2bbH2W8t7dBJF921ROG1gADrqlQR8UmQudfaE5sjUumqvQrUHgWM7uILvwQLId3VUuBEPDJkHLlmL6QUlrXn0RGLCIJYCDQs/YCcWMS4sfQaI7G4IGPpKxhiYRAzPd5wTTswPZPEokHJ0gPEQ0Ks6wM+v2hdJvss03VttNHjqFjXYff245p27AtnbVcm+9J/b9uSovZpvAp3wyq/1nHv6hciv+a3bHjNL799P7cO7Xvs275TJJC7DSBrHaHchkBV0wzq6THWdhB25iB+4A/i/ChBPI0SiokogR2GpNq0D591CEMYHM/3OOf7hZEZ7nHO/wmkfiK1KgGApNfDhgKBQCAQCAQ+yxdkJhHOkHWlWgAAAABJRU5ErkJggg==\"],\"btn_radio_off_pressed_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAb1BMVEVPT08AAAA+Pj5PT09PT09PT09PT09PT09PT09KSkpPT09PT08+Pj5EREQ+Pj5GRkY+Pj5PT08+Pj5AQEBAQEBBQUE+Pj4+Pj4/Pz9FRUVMTExAQEBAQEA/Pz9DQ0M/Pz9HR0dDQ0NEREQ+Pj5DQ0Mt5iyXAAAAJXRSTlMmANQNAyQiHxswCRfIS8NBvhHMhYxtsayTRiuJdp9XpDxaULhc1kjPGwAAAu5JREFUaN7M1cmS4jAQRdFHavY8gDHGjF3//41NrWiilLJU9qLPmuDaSmUYuygya3NrtFaA0trYvM3kLkpEQIrcwMPkQq4PyNYiwAq5KiCswgJlxa8DrUYUE0og4e95WiQHhEYSkyUFpEUyK+MDQoGRfk7gHz9dHhWQBr9m5HIg01hBZ0sBobCKEuGAwFpKhAICGxB8QGALKuMCmcJGBX9AKmxES2/AYDPWF8ixofZnQGBT4h1gBrDNGN4BiyX1YX9rOqKuue0PNZbkn4EMYae+og9Nf0JY9hEwCHkciai4zNfaAa5+zON37nhFiPk30CKgHIiKvsSH8ly8EqfwnN8BDdZ0Jqpmhx/cXBH1E1j6HWjBqgei3sHLvdrDfeEVEH6BZ0FNCVbZUFGGp4Dgjl07ujgEuBt11+BFQmgHnh2NCJtG6srQLiCwxHVBeywaqeLmoOQrwI94GuiCCBcaJn7M4JdsT41DBNdQDz/7HZDwKz2Hy/2STuwZgb1DA/WItKcje0bgPjRfVDlEcgU9uHsEbssGOiDaTEdu1yC5cy0mRHMFN4UdMu5Yz0gwcgPL0MKrohIJntTASyCHT00VkhRUw6eFhc+BRiS5MHfCwjAjOCDJTGcmoOFzpCuSfNENPgYKPg3dkaSmP/DR7MwcktyZW6HgR4Q0jrr/K/C3WTNKQRgGgmg1oQlN8KPgRxUEzf3vqCD+yXR182gv0EDa7s7Mm35XhL9k/DPFfzR8VODDDh/X+MKhVya+9HHZ0kd4XYXwktJx8UtHWvxq+d46yfc4cAbEb6EGZaHyqgm8O03guo291WNbtI19CBtrMeLNYcTtUcL54ogS4DDEHuecPHEOH0gdii1Sq/Nc/4jU+FCQjzXFwHDClkGgFQdq+R6Oj0Q4zsf7AuA4ns8iFhoS0ZiLBnXbo8bXCQWFpZpWa9zLAusSf0PuqSty997TGPZYe7AWN8rkq56ErGshce/lmc8hUyg5pXf9J+VcgrX+8wRytCpX/RrehwAAAABJRU5ErkJggg==\"],\"btn_radio_on_disabled_focused_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAA8FBMVEUAAAAzteUzMzP///////89PT3////9/f3///8zteVAQEA+Pj5JSUkzteUzteU9PT0zteU7Ozs1NTU9PT1ZWVkzteUzteUaGho9PT09PT06Ojo9PT09PT0zteUzteUuLi4zteUzteU9PT09PT08PDw9PT0zteU+Pj5NTU1CQkJXV1cfHx8zteUXFxczteUzteUzteUzteU9PT1gYGAzteUzteU9PT1nZ2czteUzteUzteUtLS0UFBQhISEgICAjIyMlJSUsLCx3d3fBwcEzteUzteUnJycbGxs9PT2UlJSrq6tpaWk+Pj4kJCQfHx9HR0fv4rWhAAAAUHRSTlMAZoABBE0JDAZgKi4FFxMNNjWAPyQeXFJJF4BIIQRHeCkkEzsxDw0JgIB+ZDtWTjBSSUZ7VUNDIEwjCGVZSUdFQj0cEUAtbl9FFhOAeWBKbUEUQ9MAAAT3SURBVGje7VnneqJAFI1hZxMBC2Kj2HUtaOwlmr6mJ7vv/zY7FdAFFDT77Q/On0SBc+aWuXO5noQIESJEiH+JH5XkdDCIRCLRwWCarPw4KjmXmWYjW8iuM9yR6OPdaMQR0W78CPSxYcQDxdihq7foF8lyPM5Bf8Vj5eTCkjgkGoUkc0axsty8tCwX2bU+F3j5A0IxyBQc5S8n5PpFQCMqJLbZivst5SwxIhOEv0+efWQOSOhCTc4DkJclQW8yK/pkFWX//F0SwgJl51/ABmZ8ggaDxCIZjP+RfFBqkDIv6UoDfhAbii4hjZpCrj4GUehj95Akb8gAaHVFhBlKAVWUugYliBWZqG8vXWJ+vE9FAS6eF7m/IPIwIDzZjFjBR6TjUZM/AZcvNE3WbxAcQxNqy01TIbp3thZwfmP/VDUwSzBuBkulOgOjBvYS3g/77rik6VIlDyTRoj+nsCRECeSrZqT7e1Z+dO8Urz8PBMxD2L+bgBpMog7y2Ibi/k66QNu3gPyvWfyI/cwE0rAURigOSxSG4l71GRlQQfkjA4nRnyP6tzkvSJLAz9+QxDmTqAEZVxb03D4HxAKVZvSPAGYi4cf0c+H+Jpe7usrlbu6FOZKgCuIM8Mzy4p4GxFAAAGhQfkj/wN/2Pn+Px+/v4/Hvz94t/wAlqAK8M8Ge3G3CmhkgA56DwPw/03e51fh93Om0Wp0O/GeVu0v/xAochABqzITuzj0QpXtSASOR8b+lrz87406rraqplKq2W/DD53X6jSmIGqjSzRD12gssVFkOG6Bb6/+1gmtXU6cUKRXasfpl2cBjEziyOG9MaWFsAM00IH2zgqsn9EwCWrG6SZsm5HEUurt9xEVpiHnAM/6Hu+cW47crtJ7vHpiCAHga5uyOMsfcOKIpBBOUz30Q/m2FjxwPk5Um0owF0Hs3l2kuJ4B2Qg2Y367ahH9bob26nVMTTjSAtjNqci696xwtWTqoMwGh99FWTx2gtj96AhOQgGI+7oUizQOB5tD3s9d7AyankwBMWOP+9Yz4SAc8PajWngITuhlrQEECKIWun1T11BGq+nSNEgkJKECiUb7wFEB9zhLHOEE9xOdKyABnE0o5nvooAWRa6SeeAigNUBLlgUgF6r3TlLMA+r5XpwJN8ILSaGeeRiDQXwBYjKWrUw9cSVRABBp9PvqVAhwV8HZRYdtF7th20RK5yH+Q3fkdg+w/Td0FHNPU/0ZzF3DcaP5LRcnVQ/ZSobPH/Rc7w9UAx2IXoFyXXAzwX66tA0fYOHCcBXwdOAxFxyPTcHSQ7cjUzCNzHezQN/4+0Qzboa/bDv2Abctzacv/z/a2ZbRn28Iar6FT42WUbPSGa+Plq3WsbraOxlOpBMlLT8Zm69jw0TpCLJgJAnhpHr35pZ5k7bss2tv31zRp39OvG+27ZGvfY35fQOr7v4BkqQG7ET/gFer/eAn08RrbmAHN/hr7v7yI01FCNvZlowQ2LKqYw5CR1zCkHGRk1CUzGuJVRSbjnComTCi6lLfGOVz3kIHR0G0g9WIOpBaE/0gjNcQt16yRGvfIRmrBh4KTisctwYaCDPEJG2s6H6+XAzbWPHgwm03GttljbKLNMiGgEQtzEj5Eo2X8XbycHDL2yDB+6HAcSrhjGDvG/H39heN9NqV2+IFimuFOjgno+OkApxX9iSVEiBAhQvxD/AFA6Z2m0icYqQAAAABJRU5ErkJggg==\"],\"btn_radio_on_disabled_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAsVBMVEUAAAAzMzP///////89PT3///////89PT09PT09PT0+Pj49PT09PT1aWlo6OjoaGhogICA9PT09PT09PT04ODhFRUU9PT09PT1NTU09PT0uLi4dHR09PT1jY2NYWFg9PT08PDy6urpDQ0MxMTEmJiZoaGgUFBQYGBgjIyMlJSV3d3eYmJjr6+tfX19CQkJpaWlhYWEoKCgvLy8hISEWFhYrKysuLi5WVlZBQUEnJydHR0eJLZnuAAAAO3RSTlMAgAIFTQkMSSoDLw4WJDVSSCALPoAsOxGAf3hiQwV/RjIRgH1iH1lURUIcFQ54CICAbWdnVz48eHdubc5A5usAAAMCSURBVGje7VjZcuIwEIRkEskHMsY2+MQO933m/v8PWxGfIng3ltlUUqV+g3J1qzUjaWYaAgICAgICAgLfjI4udw0EgAwi651rsys4BAYhVq5Ir3YBABFdVaRGQ1JUnQBFV73W6g3KHqmU+yYBVVEjRCWu4ULClB4HN58QYCqBpdqhNQDkzc1FbGQAo2a4ewh8JWO8TZD9ofiAerWii4AELDurERBAaq31ywX2uwwFDbmGh07GH7PfZ6A/MoUIQs44SAaQnJ/SL8eWRYhljZcnicwEAYMvlzD4QU6/GsvPbU2bTDSt/SyPV/eZicAHzHW+AHoJP139wppNR+/r9Xa7Xr+PpjNrQV0kCj0AnhPXBRzvD+V/aM21w3q76/dtu9/fbdcHbd56yBQwdDkyFEIp52+PXnZ9e+CYzabpDOz+7mXUPinEAlIIKocBvchP1+40MzjUR1FBr25BASSlATjx2wOzWYA5sE8K6SZJqHIUMODUwGI+svPl5ybs0XyRWsCVE8mHXsx/t7K015SfVXjVrNVdrNADv+IhBtRIDIxnh0G6P+wuDQ6zcWKhgaDacdYhSgXkqZPzswrOVE4FItCrhSDOIcq/fPIcp3kRjuM9LalCnEe4YpKqiYFWe2+alwVMc99uJRZUIBVj3EkELM0tF3A1KxHoVIwyAikRiB6HDD+jMHyMEgEJUCUBgDTGZNL8CyYkjTLA/xWQAPi3qJw/36IAEH+QywWYIHOn6Vu5wFshTbv8B61cID5ot/FB478q3NIdYq4K/svuWCZwzC+7EDo1rmu3xEB+XSvg13lwvOHFHPWYB6fWk+ldjDD7ZNZ79D97GHrso1+3bPHO4uB6dcuWhnFWeB0LJobHs8LLuErp6O1d6sN19x5/6cgmUrj5SvG7CQHzlu9GwJTvLUsmRLZaTPke0M8k7gYk+ncDQgB1fmoLxTSBt2coNIE/uY39SiP+00cJ6TBEPh+GyJTeUK4+zvkQVHWCPsY5v2cglY/UgMLonkZqAgICAgICAgLfiz+OHkqDTzvSAwAAAABJRU5ErkJggg==\"],\"btn_radio_on_focused_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAB11BMVEUAAAAzteUzteU9Pj4zteUzteUzteUztOQzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUMLDgPN0YzteUzteUzteU2kLAbY30zteUgcZAzteU9Pj83gZ0KJS89P0AzteUzteU9Pj89QUM8Q0Y8S1ACgq09P0AzteUzteU9Pj88Q0Y8REY8QkQzteU8QkQzteU7TVQ8SU48S08zteUIRlw9P0AMKjU9Pj8RPk4UR1kXU2kaXnczteUhdpYjfqAmhqovptIxseA7T1Y4dIk9P0A9P0A9QEIzteU9QkQzteU7TlU6WmU5bH48TVQzteUAl8kBkcIBibcFaIkRPEw9Pj8plb08SE0snsg8SU08Q0U6X2w9P0AzteU8RkozteUGUGkZPUoINkc9Pj8ZWG8oUmI7VmKy4O57w9sBksNYtdOOw9QlmL+VwM93ssU9m7qQu8ljipdAZnQbWG4IQFMrSlYRO0saXHU7VmA4dYwzteUmVGQ8Q0YAmcwHnM4Nn88Zo9I5sNhavd9LuNwnqdQjp9MSoNBCs9qi2u2T1Ol/zOZvxuJsw+Ca1+uQ0+mM0ehVu90wrdY0q10GAAAAiHRSTlMAmQTOIRYcEz4uGTUoOCpJHlQmV05RM5VDj0BGO8O2i1oxGYxLgWrDHc2mkm+9lXQp9cF2ZbiLhX96enJFODAM3MnIx6ylmJB8fHdzYFweC7ShmYZvX0s3KCQJ/vv46bGoamdkYFUznoBAJODW1qyU2zv+/Pz7+Pj29fX06N/f2diykT8kENuNq6nwywAABu5JREFUaN7tWWVD21AUHXlpkzaVpKmtRgUodPiKdMBguAwZG7rhtg2Yu/twl9mP3bsJhZZ6y/ap52PSnPOuvXff7bk00kgjjTT+JyQWrdfnM2RkGHw+r1ZJnSk54fBmZpzC9T4ZcUb0rP18Rlic56VnQK/Jz4iCHDJVz5/QV3E0yxLYXyxJc1UnElQqvtcZRBZDjqU2+FWtJcf/LotIevmtIkWrPizFMHP0/mKSRjAXxHRRCsaEAJ5arovRliXDbxa/NRJH7EMzlb2eBoTcnt7Kma4jDcIsZJiBTpyfF0M4LNIXF5WhIJTdKBYlasU00CbFbzCK9HeuYcorhdPVA06Kcg5UTxdewQ+u3RElzIYkFNTwzQWVQH/Zg1Bpeb+TkkjkAiQSytlf7sYSohUyQYFOKL7wRSYJ/N2X8OKLcimJXCplWRKDZaVSuYTKLcJmFHWDAgmBMCQQackFCC8L/EPjCFV8AXqS1CgUKgyFQkOSIDFYgZCnS1AwwAdU3PXVCgsS/FNTinpmKYmUxewqmUOvZxi93iFTYQ1WKqEe9qCCy8deuhhvxenAQSbgv9OACp2weo1KpmeUFlqARcnoZSoNWJHbi9w1oCAktTpOB8FqvML6G1AFLB/TM0raZDSrszDUZqOJVjJYAhvhLEcNgg05kBVf4xK4CAEexgJDboGfVMj0Stqo1uo4nrfbeZ7TadVGWqmXKUjspnJU0IUFaiHQOfHwK8BYJebvHkeFIj9jwfScfarN5WpudrnapuwclrAwgoJzDnm6sYISvmPjEKiCrRkK7BLqyQV+h5I2a7nO9pYmm9Wal2e12ppa2js5rZlWOkAhtwzdgIK7GJ8Jd2EhdzH/ZYQGRH6TWsd3uMbqP7x5/eLRoxev33yoH3N18Dq1SVR4iK4UYwUVfBn7jOvzGzCOLlFyViED/qvZjda3z3Z3f+z9/Ln3Y3f32VtrY/ZVUJApWDlVieb8JvAxawBqTIb5q1GBUyLVyBharZvKti283Pu1f7i+sbOzsX64/2vv5YIte0qnphmZBjupFNVgBT1kR6xaUIo/IggPmqSkpEpvMeP12x483j/4vba1vbK8vLK9tfb7YP/xAxu2wUzrVdhJN1AvFiAyhcVFhxf/hsOGXEZup4TVyJRGLY/5Dw/W11aXl46wvLq2fnD4zZbNa41KmYaV57rRECFuwfYYHoJsJiGFIAKkCjuI62hceLq+sbkC/H6Flc2N9acLjR0cdpKKlFMVkEhCglyPLiCFTQs8VAApJBjQ6bK+2tjZWlkKwsrWzsYrq6sTmwBR+Ix6wEewB0Tf8mgxl4liVIoNUOixAe1j73bWNoE/WGFzbe3dWDs2Qa/AJpSiLuwjON2YqAIc/kUWFphB3yHEjElrb6l//mdzeykE25t/nte32LUmBoeZKkT9WEAbc8fLEfOAqESTood0E011q1s4viFYxo/rmiZ0oo8mUREhHlR9UQVui8VIXEPVElbhsJi5Ntvo9io4KAQrq9ujtjbObHEoWEk/KsQCJJwKUQUgk2uxQAEalLMQAt5lLVmGBAoFflxidfEQBFY+i+5hga/489tRBaCOod1xI6eQpFn8/bxbS8vhBODprbz7fJaQqIOoDH83DGUaVQDOStiIEBKqwJRlb867uRQRN/Oa7VkmEMhFbtiOIMujC2CkIECAQEwXDYe4KBJCXFQLLko8yJEFTgeZgiAnnqaRBSKnaexCmz4ptMgCiRcaJ9Y6MY3KT7aKkUj8I4FbxYx/q0h8s5uPJDAfdrNLYrsuiRDi8Nt1EgfO4q2wObqY+IEDUfYfmaUBR2bdzTBFVhf2yOxL9NCnhUO/7slp/id1AYf+ZMChn2Tbslhyyv+LgW1LgdC2OITFxdN45YuNV1FQ4zU/EpCf80k3XhAoMcw1CD0MbB0/1r8fLRnB5CWj7+s/BraOAwhB66iIo3UEVPlNuITKBgOb308nze+nZJtfgOq4fb+HPM7A9n2izdXS3NziapsQ2nf6qH3vDWjfyYQuIMVuVB7/BSQzLgMA0uSvUFQCl0A6/CXQZDp9CWyoAX5jvJdAAHH75BrrDr7GMhgB19iBHlQqrF8FVvuIxC7iUlAYuodQZYoX8dijBHeRM+ooQSGOEhIehhgs4jBkHKGCipBhSOnxMMQiDkOSGRdxhCBR7Tka58xSGLPB4xzCnuzACJAfeyBVlQw/QB06UpsbB27PXPBIDUD/o6Gg0j8UTG2s6XOELxe9/z2V9GCWM4gUmZzm9CsFfzQvN2hTGZJLj2fIF/J1FlbY7VmW5vJBWUC+PNXhOEhERD55LnWQfZHG+3b2rP6gYEL/oMj0Oogz/ouF8/qEtGn1eXUW6lwaaaSRRhr/EX8B2K81Wi5jkwYAAAAASUVORK5CYII=\"],\"btn_radio_on_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAABv1BMVEUAAAA9Pj4zteUzsN4zteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUMLDg9Pj8PN0YgcZAzteUzteUzteU9P0A9Pj89QUM3gp06XGgKJS89P0AbYnw9Pj89P0A8Q0Y8S1ACgq09P0A8Q0Y3haI1l7s8REY8QkQ8SU0BkcMIRlwMKjURPk4XU2kaXXYhdpYjfqAmhqovptIzteU8S1AzteU7UFczsuA4dIk9QkQ8Q0U8SU08TVMAl8kFaIkRPEw9Pj8cY30yseA7UFc7UVk9Pj89P0E9QUI8Rko7VmE5boIBi7mSwtIGUGknU2IINkcPNUMTRVcZWG88REYpk7orm8Qtn8k8SE08REc8SU2y4O57w9slmL8Ch7N3ssWQu8ljipcbWG4IQFMrSlYZPEgRO0sUSFsVSVwcYnwxr946ZnY4dYxYtdNYtNM+m7o9mrlBZ3U/ZXMXPUwdP0sAmcwNn88FnM0Zo9Javd9LuNwnqdQjp9MSoNAInM6i2u2T1OmO0ul/zOZsw+BDtNo8sdg3sNea1+twxuJuxeJVu90wrdau6X5DAAAAfnRSTlMAzgMFIRZIGzMeJz8ZE1gqOS8lQ1VRPTbDyLWBT0sxt8OVHDXNpo29oHQp9cGLHBeFemL83MismJF8d3NgTTAtHhILb1Q5I/7psaiKXE1HrZp+QD0m+ffg29a4p5SBa2djakU0/vz49/X06N/Z2NWypKOLXSwk+/v19N/f1tVUbkKTAAAEvklEQVRo3uyTWVPaYBRAe4UkBJIQIEAAlR3Egqite92trWvVdhyne+syLqMzznRfSNjd9x/c+1HHqdU+BH3oA+dNH87Jvd/lToUKFSpUqFChwp9UIboLyF+3a0f58ND0VNgF4AtPTQ/1YeTWGsReH/PCJbyD9aRxS/qZOlS6/M2TwWR/fzI42ezHSaBuhiRuQd8TBognJpI8RXElKIpvmEj4MHHjKdA/0ATgigV4imMYltUjLMswHMUHYjhGbAALN/IPjwI0fuQpBt1Wo9GMGI1WrDAU/6wRINx3gwKuZz4O3iDRo91sqTWUqLWYsUEST70Q7cE1lf39My7wN1Ac6s0Wg1MUHSbEIYpOg8WMCY4K+MH3EGco0//QBY3k84ke5TaarkFo2oYRksAhkglw9ZRXwP37Sn69sdcgor3bLgklJHs3NkRDr1GPa0pAFN+hHP/AKPhLfovTYaOrJeFNx1ikrS0y1vFGkKppm8NpIYXkFITxlsoINIE3QPy1ThPqxzvbN92yHArJsnuzvXMcEyZnLSkEvDCIAc3+eYBgyS+aaLvQFRlpWV9dmV1YmF1ZXW8ZiXQJdtoklgpPwVWPBa2BUWjiORb3g/4Hnlb5++zW1tH2zs720dbW7De51fMAC7glluNfQR0GNPrfQ7SBYq29xP/W495Y3t7Z3ctk9/ezmb3dne3ln27PW1LotbJUIA54qxoDYWjmGb3Z4CDf/3xucff49DBfUFRVKeQPT493F+eekxkcBjMuaRCmtAZ6wEcGsIi2asHjnts7yRymi6lziunDzMnenNsjVNtEi5XlAj4YrtJ6Qk2lAUy01NW68TmTzSlq6gJVyWUzn360dkm0iYzAN2o7JAxEIXg+wHhE/prdzyupSyj5/ewXOTL+ewQ8pCfaAvUQ5zm9EV9A6hxZOzjIof+vQu7gYG2kU8JXMOo5Pg59mgJDkCAbctq6hfaWpbNcIXWFQu5sqaVd6LY5yY78MKQloJuGZoohG7K/fnE/nU+rVwMq/vv+i9d2siOGegcxnZZAHUxSLP6IaanD/biQVlLXoKQLj90dEo0/Z5aaAL+mQBQ+cCx5AmFMvqsqxesCRUW9K48J5BFYLghPNAV80MCRI60RXobupYrqdQG1mLoXeinUkEPlnoFXp+VKAfrPA22hR6l/8ijUdh4IgE9X9f8EfrVj9ioIA0EQZvURrKyMSPAn8QeNIHYWoghioSGksNDGJpCQ9Hl2c0XIXpITMpWBmxfY425v95spX5FK8hXhj6wuID0y3qbqAnibPvlHUxeAP1pnzUeFmyrkSqMCH3aeqoAnDzt8XFuKJ+bjetDt4AvH39T2qA8sHLYybbYynVPNJ3OqKxNf+s6mcn6HLf0XW/ogtvhW6f59ji1jgS3NwWsqgZfnsv70cPDi6Hjn6Bhug7P1SdOPdQ62IUfHEZFARwR+HwX8JvtdlMNvtNsnKPxyfL+RuZTxPRb4HpfwfQjhu6gwM2gOGBDYQvUKC9UDLBRsAvvCBMI29mj8tLGjAdnMxkJG/Eb0bGDEsSjBmC4aRAnNw5AL0XglhyHL69yuhCF4ibeZxzmHTHKc8/+BFI/UJhfKZE7ySK09oaCWlpaWlpZW+/UFi9DSrrMntOUAAAAASUVORK5CYII=\"],\"btn_radio_on_pressed_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAkFBMVEVPT08AAAA+Pj5OTk5PT09PT09PT09PT09PT09PT09PT09GRkY+Pj5PT09KSkpPT08+Pj5FRUVAQEBAQEBDQ0M+Pj4+Pj5EREREREQ9PT0+Pj5PT08+Pj4+Pj4/Pz8+Pj4/Pz8/Pz9AQEBBQUFMTEw9PT1DQ0NBQUE9PT0/Pz9KSko+Pj5AQEBCQkJCQkI9PT27eu1wAAAAL3RSTlMmANQnDQMiHwkPGT/RATAVykWLhlrHvkpO9sMcsayQzp+ZeGor7Fdx4aQyuHxeYgwIBCAAAANrSURBVGjezJTJkuIwEESTkiUveGOxjcHsO9M9/v+/G0dMRMt0q4QBH/rdOKCnUmYZg05Iz08CVyk0KOUGie/JQSc6CKSTuDDgJo58XyD9BSwsfPmWwAnwkMB5VRD5Cp1w/cgq4I/vjOIUvMBReArXe0ogAzxNILsLHLyCchjBu9fXJFEXgXTxMq58LPAU3kB5jwQO3sSxC3ygZwOY+/dmQO/nAx4n8NATnlkg0RdKmgSRi95YRAZBgh5JtIAJuLcqgQmgpxi0IMAjhvvxNU+J0vw63g87PxK6NXQ0mdMd+WTUravo0CAxXRJRtj2fhjchbsPpeZsR0fIEG25b4MNCURFlk0LcOWfjtFFYp3C0IFJgOYxDmu9i/CDeZRRODmBR0ZfAt0RbNafEMBI37mr4YATYB5hllBdgmeWUFfYUYN2x05o2MSzcrrQ+WYsE2w7M1rQSsCJWtGZnCP4LJPv+qT7fZsjYHGQj4CM+VLQReIjYUHXgY24E3JKNKY/RgVtOE5hZNAL2hYowLL4t9DY9luUx3U7FfVRhOGLfCFyHRHV/L7G71F9cPsT9rEv2jcB1aErzGJpRWN9BI2jijKbcNxUDBSMV7aH5W9bfOH5Cs6Mlt2uQzApQdmiNU9Y/KPetEVJiUojgcRUatxbiWBsoWx1YcUXy4JsjnlOhf4S1ERKtgXMY8ZHAxIjmrReuGT70HVIamlPGAibOtNV/vnCCix5hQ3uYCODCxIrOOuGa5VNPyYSwgIKJJemP8JYXbFprc4UJF2by1pOmvGDdCu0PTCiYSUmv8ZEXHHWTaY5noFYFy5pHrxqlv0vwr1lzWUEYhoKoSmoUKihYtO1CwdciiP//dwpdBCEhtzecNtl1VUib3JkzA2wR9ZHx3xQ/aPhVgV929HVtRAPn0OoHjmxkvkNvkI1M9dBvb6Khr5ctJ6ls4YVX5R/jgtBLx8/jch0lHXnxG5fvLlu+b6cxIMses1BJE3jMNIFpG/vcr1zCxp7jNlZkxF2GEZejhNc9hBK6FEqgYYgK5ywGnNMJcA4OpFRIranrRoHUWCjIY02/SQyYjUcr+mV3QTi+BuA4hPfpgIKOWOiQiI656KBu/qgRDUt9Wq2Le8sJrH/LWEXkDpYGTIG1B3lxY4NWT0xVennmr/5jh/qP7UfUf77mb6LnjEYeBwAAAABJRU5ErkJggg==\"],\"btn_rating_star_off_normal_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACRCAMAAAAbxMEvAAAAw1BMVEUAAAAAAAAAAAAAAAAAAACioqI9PT0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACPj49paWkAAAAAAAAAAAAAAACfn5+Kioo5OTkAAAAAAACysrKsrKyhoaGbm5sjIyMAAAAAAAAAAAClpaWTk5OGhoZDQ0MAAAAAAAAAAAC2traYmJhycnIAAAB/f397e3tjY2MyMjKDg4Nubm4YGBgAAACwsLBTU1MsLCwPDw+WlpZ2dnYUFBSmpqZaWlpHR0e3t7fVgxBxAAAAQHRSTlMAgGUJTuaZe2oVcFUlBHoQ0rNfQzYr4s2YdRv58eTejjMgBunWy5xbSj3927pHxMGvlMe3iTD2ppGF2LyH66qfatopVQAABLFJREFUeNrt22dz2kAQgOF7gUiI3jHFNGO6jY17bCf7/39VpNgEGEoQ0VmaiZ7vaG72Vrurk1ChUCgUCoVCodB/KXplqUApUMuqACkBSRUc0Rq2ugqMItxCQQVFNANTIKUCoghncg0RFQzpGrSkEZws6sCtiMwCc6PFISciTSAQtSgF9+IYQFEFwBDm4qhAJqp8lwUe5bczKCnfFeFGPuQgrvzm3PMV+fQSgDu/7NzzSzOIKZ8VYCFL72D6nNZZYCJ/GL6n9VpKO3K+N7TEMqVXaW0pH6XgWdbdwZXyUcyp0uvOoab80zOhKRuefZ3THsCQTXNfh5ACVGVT069StF2EVqWoo3wyhoH8FpBSlICWbPFvcKxDW7bd+DY4xmAm21qQUH5wJqF32aENXeWD5SS05dWnqSgJC9nl3Zf2sWob2259aR9lMGS3a1/axxAuZbcmZNLqi3WBhmxZPaBpaWj1erfTGcdisULkk8nKQPbpsyYe+WRf56rTSdXrbtca7ZacFZgc9nYhez2xz2qVsXHqmBZjxWoc4+drUw7oP71xBHOYOuJsZcUwfubz82q12vr2aSKuvS9/a19nkc8/GcbGWqN/P33iZ95ZQUM0uvhWqc6cjU0e0zK5k6+QA+I9ddSK8qJf1VlP9MixgqdH0WwORI4sACOgfS46TX4cvR7HGNt30ef8Fkj21NFSGeBadJmC2znXSgA3osclkCm77R9DwNCSSHkgYSnXroCXqXjtmwEUouoEDyZQFW+17oFRWp2knvC8aucAs6ROFY14nEh3QK2rTpeOYet7VX3OgHhWrZyaSK+ebRextPpHVtyjbbvbqj4n6iWx9T3ZLkt98n3b+pvb5fu2zTa2y/dtW26XpzomcNfQe3e537bnirj1eANkHpS3VkXy0m3vai+3S4NyBmiJK89AMa00yUbgh9v8qaWUPlFouy3PJaVR6YQIDZVGQ8iJGw29rz6igMtSZEBZaVOGgfsnjKTSJum+Dj2CmVaapE14FJcMjWfEKTDErWsYKU1GpzxeX2h8F5OAC3GtreMLldX7Mfdm2t6fFWEm7lW0fVUUh4qc4E3TO88svMkpbjQ12NLagVEgGmzkUGPN5XOHGiwaGmwPmOybU2+Bl71LGmhpsKn9jXXOh8GeKrVYL9b6y3TlDKh14k6Q+i6Kta4yfYktGVXpIrZ8c0+xtpTHLGjvCc/yqavuBOn+++5jzrHy2Bjye8JTWJa99NWeIE01fKAyhOnu8JTUSjexM0gTDVOaCY294VnpjZZB0jyldcE4GJ7DQZpD0fMUej0YnpXejkyqeJ5Ekc0Uam2FZztI/fUk8rp7pDdS6HG+Hp69QTLON7pHSlsK9dtr4TkUJBaTtVG/6HEKzdZfnpDM/i2mYxN4XiZ3y+N/6iSXB4yTBbbEMeHPFtYabgMyHjeyptimz4B57AFUOYGtuvymyPL8WOhigK2wfeHDyX02/ZhjH5SXs9CTNK6x1crKDSuCLX/h1K2Rtzm9eME2cl1NOhls+SkMPR3O7rFFrFP2O8aHhJc3mSN+ammzkjgy3i4oXlans4aAqTzTSST/tfBbV/GA/PssFAqFQqFQKBQKfa1fDsPNndmUkFoAAAAASUVORK5CYII=\"],\"btn_rating_star_off_pressed_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACRCAMAAAAbxMEvAAABAlBMVEUAAAAzteUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUebIgzteUpkbgJIis7OzszteUzteUzteUzteVoaGgzteUEDhIzteUto84USFwzteUzteUgdJMGFhwzteUzteUmJiYFCgsrm8QzteUzteWXl5eJiYkysuEkgaMzteUzteWlpaUWT2QRPU4MKjYzteUzteUxrtwaX3kOMj+goKCGhoYnjbOtra2cnJyBgYEXFxeysrIyMjIvqdaioqJsbGyPj497e3tjY2M/Pz+SkpJDQ0MiepsYVGt0dHReXl4ZWG8TQ1WoqKhPT0+3t7doGm77AAAAVXRSTlMAgIAFCg4SGCY2MmYVQxwfIz+AToCAmFZ1XSqzboBKgIBHO4CAYlKPgYAuctrNgIB7aemAgIB5WoCAgOPKgPPfxYj5lIDmttLBr5vVnICAu6yAgO2jRlOc3AAACadJREFUeNrtnNd62kAQhbOzqiB6qMb0Djbghnu3k7jFKXr/VwmLnSy7KyFLMiIX/i9yh7/JnGkaDXz64IMPPnAPlhRVVRUJf/ofwLKqhRKlVCkR0lR59TZJaqjUzCFCrlnSYys2CStatY8ouVZIlT6tDmyEJohlnIiuziJs6GHEsxdZnUVyKIxE9hLqiuJI0rLIinFI/rQKcLSKrJnEVyEaVvQcsqG6CtEkLY/sKK5ANGxEkD2tWOAukgphZE9OD9hFooPKiCEbtIskjXVQHSqrdZGSQPN0OwB1NoqigboIx9kUOwSAxj6aox9soim1EZpjCIQDNE8pyFqEY2zTSAN8BVi/ZhpIIcByLYdynIM6pxmAbTRPxPgUFFgt8RH01RwAdBgX5ePBaCYWxc8AcGmaGS6KRgFlvpjzPwFuTZO4qLGJ5kgFlfk4PmFqNABsmVPaXC0q9gIKa5mdO34A3JmEY4DdwMNaDOnNdYAzcwYAnAQd1mJIPwJcmS98B6isIKyVBJ/zx+YLv0jmBxvWYpXuAoD5lwxAMvBqLfWKaI4ngG/mX74ApNE8CeXT0jEifEgfmf+4ADgJbk6jg4cY0jZh3Q8tXTNZ37MMaRrW+8GVIrEIlV/aGCUDUA+0FGF2lj4AeDDn2QA4ZB70l12KlBo/mQ1MBgAoL3twxC9IkiTL8Sw3eFyYLA/cEDIOKfL0k/gFHzZIsqwYhqpGo7G4Rij0QqGQnmJm6W0yeLAM+FI0qU0/1ysUtCnxWDSqqoahKPLUxDebohjRuNbTa4lItZRqZSf5ZnjKuNjP5UaIL0I3JoWWIoZcLlcch6c085NsK1WqRhI1PVSIR1VFxnixMbIR1UKJaisf7o+QI0NahJhStI0cGfXH+WwpoRdixtRZdvvdqKZHWuEceis7AOcmzxbA+iZ6I3vhbLVWiFmtuLEc01PhEXLBdQfg1BS4AnhEbhhnE5rBWyQZvVQOuSMJkDFFzgF2kEuatSjrJCmaGCO37AJ8MUVOAeAauWSvFJfxvD0Rl+6hk5DIHZmKXNPS5LllTyKHXHNAJyGWezLsuydFV6Vyb4zckybDPYVvH+6J/O0yOJpCrqFtQ+SZtA/3jHsyHUrd88S0DbF9eKCq0scI9zSY2VVoH13kFjo8OSl2/XnGMPnKQWXKDkDbtGMNYLcy5Sn5yuPnGYuspAMv1pqIp/y5ntyu7KTTabCHFiGxfdgz/ZuHlUoyeUKt4x5SpFCfsSVZ2V2HN/DdtOcY3kK6cnDCrQFfxnY0RwUELjIzfq+98nVjyv2puZCzjSnna688Z2a0QWD3mlndzgyqsR2c0M58Wzve+HJzc2O+N1s3N4ONjdu1uysgMCullPoiWW5esXWAzpkZBFt3ADBk8t6weJD4TAIoAIuIPXzTqyl0e8BZNDCXzU0G6DMcu3IzIki0aMNcLmcXgj1oEsfi1pnQbQBZ9C6TAVB7uBCimlHKpB4+m8vjHADWTyybK0HR+4hln2R/5sZcEmsk37vW4wcBq1WrZg6d5YT2DUmvQ2HKbc29y5biWcRT7wBZtbw/A/KHtzeFOb9ABKMzo9hgTxogDqn+OQawmrmLuoLZl/BhseUfAsDV0RLC50ScPGoqdr4r2dyGKffm+3F0RfppWbSH3osIFomB9N18L74ADR/RP+ItUBMJdNMk/99HtksiV6eOBIqsPTSOehMksP+TDof+OGqTmayLBMK6im3WH1oK2ci2Zvplg8rFkg8Z2PbgLl7ds5LNf7ZdfiPNYohEsgWFs4dbOhQtZNsGn/3/rE2yy0KuUUmT8eI9tN5EIo/rpEhe+pLryUKufiQmOd4p9bLIRra2t0Hy9NlOrqa+6MiQhnZphGyK5IZnucpW4dNT8JsuW2MkkASGRLbnS0+964eFXKMUDR8HJFXPI5HyLpHNpUVrdnIVEzEJv/3grZBCIps/XI+2W2T0sZIr7+5GFcuxiKVsAL/dCWaztU5pNHz8yHYC8OB2eH6ykCvCXBX7kG3bbe8/AmgslMunbA0Al5N/G+Czd7lE2cL8XrFtuuOW1ywXYbLLrWy1PXGv6FazNOufmOTrJX2f2wS7bvoX3I444vlVvrg7KtNNsCPijpjugHygMol24OX5esDt9Zua1wgS96G7nh5B6LsY9j21/6uBawAw3fMAUOd2HJ4xqsxwTcq0e46592eTmPesj024feixl/kMYH1f3JP5v8zZp2803XEFMHyfGx4lwXX6jNftVIW9u3qfpK8AnC8QZuFM1BAT33/SN8i5og33bWifXy5usP4TX9ZzDo2VrsQIVwP7BnvwHkdFRoQr07cLdhoN8s/3S/ti7f8QDEezXJkeWEbIA0w52Jw9S16d2RZr/8d7WAtzSX9p5540CZHrHbB7BnjgEr8mewuh0YKkp+6hT10zJ2XOnBO/angLIcekv++8uueVMnWSkPhc9/AdQmkx6U+/iQ+ldeokLvG7noOIhtDi2ez+grjnxGJ1KzpzjdsE67Lf0aMO8Gzhnm3aNTknHfGhv+M3iBQmhH5ynX5wwe6bRScd8x3fbyWKtri+8WvuoHONcY9AssNH0hXbPcIa9tfIukzf+NJh3SPSPeQK9y1A0ns7E18N1+feehxlRPeIJEkktQdzJzw7/h6GlARXhTZokaPJJcLVpIetf0HU8DcTqSXLKjRoA0DnYBO9gWGDBjepRGX27sTPOL0PADO1ZnPGYRc5QtfJr7r9Bhiyg7WfsngCcDd1+1eY0qi7uXrahSl306I0/eyBn9IohfpcTF+ed2adwjqYJ9VWDllRn+l2u+U3quUa9+WWrxcL1CpG4mpMz1vr9gSEW24LUjL8JNlPmJEeIkuyIVXCWNFK1k7qvn58nd05+DHocGbOI7Jzj4xn++2o3rQJpVkJ6PgxSK5xZWi3juzdQ9eSpZy9SQ32dslPoe4mu2ixewgzJ9WadoXyceg9qMXDNGf3UCf10QJoM3Pf7B0ZU/fMO0mfIGt8tXsl4vifbPUMyeaXLoqOro26NUgOOXg+X7PdxktqKDtCC0kovr61JVKsLtp+YzmeaC5UzMOUT294REYtUgodXkyUig6Hwf5/I8JZLQqe6taijwniZY57pHjL2t0RqpbDuxKbfMsXZG/rGM3ConG1YDBqLdQtXstbvbtz+g8tuCvoc96pFhYHj1gCEvkR96q14MEemr/0ux6jcCvBm+OMpMT1VDP3LzuzNP5cQ78Nkw/nWxG9EFUk7PUXk1L5cHNSqvViHtwjfl8orsWjhoyxn9+UimtazPfPSlGr8Hv8jdX/ntQHH6yCPxAVpRFrKWRlAAAAAElFTkSuQmCC\"],\"btn_rating_star_on_normal_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACPCAMAAAAiGKLEAAAAz1BMVEUAAAAAAAAAAAAAAAAQO0sdaIMAAAAAAAAAAAAAAAAAAAAAAAAqlb0miK0LJjEAAAAAAAAuo88AAAAAAAAoj7UAAAAAAAAAAAAAAAAtoMsAAAAAAAAsnMYAAAAea4gaX3gONUMHGyIEEBQAAAAAAAAAAAAAAAAAAAAAAAAkgKIcZH8TQlQAAAAysuIwqtglg6YjfZ4heJgSP1ANLjsAAAAAAAAsnsgrmcEmhakfcI4xrdsAAAAAAAAxr94uptIpkrkxr90lhagYVGsVTWEzteVy6FwbAAAARHRSTlMAgDMambN+cUl6EgLZzY92TehiQ9NmUiwF5moW4Qi2rZaKhlgiC149JsaxnCn88snDwJuTLw7j3cu59ToP+OzX9sqno0H7ekIAAATzSURBVHja7dqJWtpAEMDx/XMkGLlvEMsNUsAbW7WtPfb9n6lZJBVNYwluTL5++T3BfjOzM8MGEYvFYrFYLBaLvYuxiJaGURRRYh1AQ0TIEDCbIjJGKFMRGTW4gINjEREqQHc9yIiImMC5zEYnREfAdylTcC8ioQ4fpFQhMg9FBIwNKElbPiK9qAKXUjmDsgjfYQE+yTUgKUK3gCv56BYiMNEmcCYffYvCzbeApdxIQUKErAIfpaMKNREuVdI38o9B6GXtlHRkytop6a2ybooQrQynpJ/K+lqE6B7mclsOJiJEbcjKbUswvojQJKEvn5uHuspm1OLxXBbaIiyqCbXkC/0QW9GJakIv3Ya4Ww9hJl8qQSGkxfH4AE6lSw8WIhQJSEm3GQxFKMpQlW53YISyFVmA/JvLkLai6eMm5FYNadlvO8u9CxDC+DhyxoZbN5TxUdkaG5EYHyZ0pIcBHIngHCfXRomNadFWh7z0koZy0VZJbCySa5bY1zh5ncgU67VazcBTVXop4a1dqw2LxURi59OtEplygR1cSG8/2IFRK94nd1hxXPqptV/pjYucrXoqX9XJ2WbpjZ+ptTwu5X819frmDN30Wa7aarWkbqVWK5vLfUhfXqH880lpVYBBR76HUgqMkfiX5AEeLVj/eXYbeklV0lkZtFYPjOvdhoI6UU4Gq9Pf8TzKkbm+1UF6AIzG7n2xBnRlcGZAYSR21xwCqZYMSBowLd/DnEEwpd26BCa+t9xrdf3PpH7ZAZA5FL4lTdSSqpsac0Ziv5E/AXo3UquPgJkU+znMOFuGLjc9oDwWe2uoQrqVuuRwymdvR219afuqbvtBQ7xNs64rbZ0roGYJx9vSll5GIF0OqwZcdd6Wrq5K14nQo5nhjfO/k1e3yxLaLFTaPn6Ve/qMrfKULl1py++XtjuVroKOdLmb5Gfp36e+StdKaHdSALrfpU9nTrr0W5VV2nyeKO2sYkE4rADn0o8SMBmLwIzgl9+EZUSAkjD3uzxXRIAyfmf/DZgiQCa0pC/5QN+ukpCX/nwILmfOu6I/nUDfG9vge3oMAnwj/gID6Vc3wP853e/z+zob4Lt+GR6kb8F9izk2QPo3D+yPVw2Y77ed1UUg6vvtQ6dQaIoANNdfNPfQgxMRgBNIyX2cBzTxM6/uQq/ErhTQgDWhJD1U8+Rny/cdsEeQ934SU66y3gN2KrSbeg7WKjYT2+3yHZt12eM1vTQHjOnhoqCC9OndmrW69Euv8LRViRzXPT9azQO4+OrSe4XH+dW1DlKvE/jF9770D4PH8DjGQ2zn73Lx2+5Lf/rxMTyuxyR3kPJgCa2+uL/SP/RVeJLiudUQ28z99poQWjWg6w4PmabHi1vq5mXpD4US2KTPqvCYI/E3qwkvPwLcQUFoZcI3+cc3JzweEutK2u5JPc3Tw3o2N6oDJzxerAm2i69P00NzEV1vlVAr5QqPV5Dy2aci0rs2Fp/ePGc4l+t14zq2eWlzBzR3oprThbJ54GB6uFNzN7deAfsw1jjIDHjaMybWzs/Jxp+8/dQ6zpJwad/dC2xmw88SVcZ22ZLyAqZ6a3o5G6wnRdNnRzWxfSjpreoKnA+wDS3/6a4Y6yNBTWufVmojsQ+rjqKzVw+xtRf77+NDbAda21C58bZrUTd0NiIrYYm3Gi9GIhaLxWKxWCwW+w/9BhJXDgaJOiFiAAAAAElFTkSuQmCC\"],\"btn_rating_star_on_pressed_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACPCAMAAAAiGKLEAAABF1BMVEUAAAAzteUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUFExkCCgwebIgzteUzteUokLYzteURPU0zteUdZ4ILKDIzteUzteUzteUto84zteUWTmITR1ozteUzteUzteUzteUzteUzteUzteUzteUzteUmiK0sm8UgdJIRPE0IHygGFBouo88KJC4YVm0NMT0oj7UPNkUxrtwtoMslhKcqlLwzteUrm8Qjf6EieZkzteUMLDgvqdYxrt0snscplLsea4gqlr4bYn0ysuEbYXsysuIkgKITQlQwqtgjfZ4heJgyseAlhKgaXXcfcY8aXHUvp9MWT2QZV24zteUFHZYuAAAAXHRSTlMAgIACBQgNGCZTMgs2EGYVHB8SI4CAgF1OgEOaKrOAcks6gEeAgHZuYlhAPS55as2AgICAiOmOgIDTloDmyoB834CAf5KA9+PYttuvgID8xpzyw8CAgK26gO2jqAdlyAAAAAokSURBVHja7NrXetNAEAVg71n1Ysm9xiV2lLiGNEiCUyihhIQAobPv/xxYJmCt1oYIsMwF/7Uv5hvNzoxWTvz337+BUpr4Z1DJTKuqmjalfyEoKimqZnQbxUbX0FRl6TFRUzUaGx7xeRsNK7XckKhka606mfJ0Q5WXFxGVHaNDeMOuu7yIJMdKkrBBeWkRUdtIEtGgq0qJZaCm1iGzDA17KSmS3BaZrZNZxkOjaatO5mgt4aFRWSuQedYNJfYUUadM5tNTsafIrCbJfJ4Vc12LCVpdcopkjU/QFtZCKYq3imi6S4Lu5IAtPkVurCmSMvwR2weQvU8C6rEeNGo3T0jAO/guSVBDjTEgKaWToBpwDeTOuAFSlROxUQyuST8A8OQQaJOgrhNbiqjaCFfQG3YeTlEhE1tZy3xTPPYTxNhhqIpOYmuONN0jQWvAc8bYMyB7QQKKcZ18KdPhejSAPTZ2F3jIlXXfTMRCsTwScA+oMN8RUCNB5RjKWizpt1nglE0AKMVd1mJJPwQes28+gJ9oJ7EMNGr3wmf+iH3zKXzyi+6iAxK79B0AL9mNCpCPvVub/fVQSb9g3x0AOySol154iqhTDpf0U/bDLlCKYU8TFg+xpOeUdd1YeCtSrMGskg6U9f34WpHYhFaDJe07BLbia0XiLn0JvGJBm8A+CRhYSmKRqN0kQTvAMxb0EsDqghdHSiWfLJumomS4JlQCdhnvFfCRv3lIK6Ypy5Lvt69GxyGYim07jqq6biqj+ap9wzCsIrdLt/3Fg3cebkWFnmEY/WpVG8ukXFdVHSdtK6Ys0Vumw7QdN6P1rWa33GoUdb1T2EiODdfrnjcgQRdZYMQ4Yisijzyvvj5Mjm0UOrpebLTK3Z5lVDOumlZkSn8WjKw4rmb0WnohWR+QX3owbUJcK2qTXzqpDwt6o2tVU449J1dUUlzNKutJj9zWNnDFwvaA3FtyS4Nkp9WsptIypWI4KauYPCERnOWA10xw6C+OUQw7Pc2Rafg+tV/0SDR5oMJEV8A2iWij6ZqUi8ftDUlUNeCAiZ4AOCMRDRoZhQbjKXskqjsAGIfbiqLStWlEktPzSGQfp5sQ7wCokeiKP65KqdIfkuh2/OV+psn4iOxRWZW+3+8WSXTH3NjgvAcuSXTDvsItpRHd48eGOD6ia90MYv82LDpudxXHxzGJgF+e6K+e2Flp4l3+xse1sW3gLptnBdj3f3Qvf+NhaeIOEYkLr6RtkLDV0la+vbZdq9Uw3wGbZw/z7dRq42Dz+VnR9exJCRl1LpZ8u5bDLVyz+Y5wG7W1y1LoGnCytjcfcSuOYLcy8XnlxvXm2MFr9lOn/o+uVm58qUw8hqB2xl3d+lVtN/kJ7rtbebFytHkwGo3Y37Y3Gp1vbj5fmUQXulIqqnTyyLzgE8sCuVMWh70KgAfcuXdmvEiUcgBiiMiPJzz0mpOipimdCBGds0UbHSJ8+7/el2d+RznOAthki3W6y8XDvVUqhjcjomu2SM8gxOOXEJ3e+HBWawDes8W5ApB7N2+4Ulv4enrfP/2VEVuQFQBZoVP768c3ktqaNcyxu5jSHlUA7Atbrj79lk3ljE7CtnIAjtjfd+6Xc/tC2POrwaVa6YsDtpSFv6T+bUcQ2o9v3UpLiSkpbSXFkb8P4PDpAsqnJG4ePZV7f6Uz/1dy0ea3jD/3tZ2rbWoaCMJzl0JTSitpCgm11qat9g0wgrZaR0tLLSpQCii+jP//d+hl1PWydxkv23H84PPBT8Is+zx7u7e7udORkE9DZY8QELIIYSqE9HFl9jziSD7YHrBoo6Mo5Y9WR9tC0LU9ZQjtANsjLCrtdRnCiwerou10JsqfkCEUwR4ZmYLtM6aO/3uL1dCl6It4G3d0vStr3W3uM4RQ0Daj0TY/E3RNGEauWlDYA5f8XltBW4sT8//xQEPXuA5XerVF2c0O00Tb2ZxE11BB1/2Kk8f2YGljhCL/D47T0XWro6uzieSMkVm362OG8B5oS0VXg2F090pYPhhW3lEJiU0EbbfzVLlreK6Qj28X0NxBKySPYTQi2uYpctcHhnHQQ/JJ2iit+icM4VwUSddmVwvIXTI8sx1Va92pKGnj/IspYS2GceLbcPpQaNvlfGlaPA8VyavnwOlDoq1lmvtPOS9T6QLacLRFww0jDDh/RaAL0VaMMzYwjPq3cc4eosPZhLZSsI/7iqacyf1G31mzKEP6+7FOsHHSfxLrEfdIo/yC1MxqoE4whr5HDD0gygzaj418b9Pc4mtSQrXTzqlxP7QGI18DwCwGzamJWwOvYdpigiW0OaDHkXbPoynvu/JluqvqoVR0OJn0mzldqR+a7q5/BesX0CdLhzVpCPICJppmGHE+Qe3xVCj0Y5l+9DUNrjlv4b0retC3Emuhq8SaqIwDnx70ZbGuqMHzGZ9dLpISLDnwYV8RBnYDfUtMYPZOn2AvqEtFuF18oU2sz6MRgfjn40I30KvJgZ/OoK1cbJfqnVIhS2HKp/OpMGl2rD2sqct7MHKAoF/o3HMkJPL6UDu0WsqBfxKsp5PQWA76u2r3wCU5ctLoWB345OwBEtIH/ZsnkXugPomcdK0PfBARWUJHOOivzsA90EwCJ8mBHxJEBBJCtRlyzy4DgJMu8f11hyQiKD0g098q3NOCrBlz0mlc+odUEZUqsTX3l8g9cGfH/W35v88535ZXUi2ihMqcf/5tofMeuEeFHaSkkZw9ivYaLZGFUt54Du7RIIycdDP/PXvsENIZTPNBQmeQuZB7dE4avNGJqFKi1UIPoHl2ySG4EFC4LZ/+KhvLpJoIlnDlU+jNQPQLL87ZH2BSBnGLk6hBWdq1pHL6Becc2HoWMj1wO3kW8faF8wmlsM5Ix+JulMjmN1GdMTXZeqrxH7PSG84/oaORpOnF5XaUKdRi7jZz6jW2xxFvb5/GVd0zUDXeUBlyfv0kga2Dipt1Nj01b0MemRTrgtTvEINMoKY5erqiI5Yp2HW1k8Lox+NhljU0qIdWZo404mlX3OgZAiu/FXQ0Uop+wTbJoCDmodpjluCen/2tqsZJbPcw5qF6liLqcCdkWvdAwzDJSawx/UAQNaSyZMSfaLDWvjvpPtOAkMwg2SfhoOfCIxbgJAg3BEK6h3JIh/3cHmxBx166aDMdYNuM9uUohhfAGx+onbyRGzMEQusT7fAgtJs2zLoU2/Ruv5PIWDVvYAve4cFsbWR13W8QN+INbeYQ34jAbOlhiTdccvsMgDZzTGHlXTVpxQpiS8ObE3RPlH8QbOaYDV9shUUHzSqKLf1Aye17qtldyZQw2CuI6ajYrGbRM0OJUrL73ljWnw+bA2ne8oFvPcbFXF9vjt4kN/A7vzJcuxuYz+7w1zBe0ctVNqtb8IWKiUkF8WKS7xU73Xp/zymZ6xl/L+Ta7tYd8WER4U0p17adbAEcTIElPg1bwe/4lx7e+o//+Hv4BrTtIsYUPbP9AAAAAElFTkSuQmCC\"],\"dropdown_background_dark\":[null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEcAAAA2CAMAAACiEHRJAAAAflBMVEVAQEAAAABBQUEAAAAAAAATExMlJSU+Pj5BQUEAAAAAAAA4ODggICAvLy8WFhYAAAAAAAAAAAAAAAAfHx8NDQ0AAAAvLy8kJCQgICAQEBAAAAA3NzcWFhYkJCQXFxcAAAASEhIAAAAjIyMAAAAwMDAjIyMAAAAAAAAAAAAAAACu+DqjAAAAKXRSTlPmCekADkqr4e4qFcCA2KhEYwUShjwb1K5/Nge9pZ2YXUxALSTIrGZVSewvjJ0AAAC8SURBVEjH7da3EsIwEEVRr5AjJig4Z5uk//9BJNFBw+zQMLO339Ns84Lde+abPq6cs6q6rnN0avWOAD10e3zdoEFYB/hcsQQfq2YO3gmjmAXYWByFHAw55JBDDjk/dgw5f/UvcsghhxyUEyQMm3f8nofweinL8oCtCsE5LTS5Gsf+iKxXDbTWETzb9OM+nXHdpjTjwjkgi7TRywnZUkhwjoeKLUXnGOs4iEuZoQPhHQeJFvBZxTk+g+8FPAE5Rz/0d6kkJAAAAABJRU5ErkJggg==\"],\"editbox_background_focus_yellow\":[null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGoAAAA3CAMAAADT7y+MAAACBFBMVEUAAAD/rgD/rgD/sAD/tgB1TABzSgD/rgD/rgD/rgD/rwCGWAB7TwD/tgD/sAD/rgD/rwD/rgD/rgD/rgD/rgD/rgD/rgD/rgD/rgD/sQD/rwD/rgD/rgD/sQD/sgD/rgD/rgD/sAD/sQD/sAD/rgBxSQD/tQD/rgClbwOvdQD/twD/tQD/sgD/rgBzTQF6TwDRjgDBgwD/rwD/twD/twD/twD5qgD/uAD/vQD/rwCDVQB9UQCLXADJigDblwD/uAD2pwD/ugD/rgCVZg+GWgN0TACtdAKOXgCSYQC2ewDnnQD/uQD/uQD/sAD/rgBrSAB4UAGrdASRYACocQDLigDdlgDVkgDhmQD6qgD///8AAAD//Pj/6cx/Yjb88eR1WS/sx53/9Ob03sT/3q//8+T/+/b/58mDYi92WSv90qL/6s3/2qr/+vT/8uH//v3/+O7/+fH+797/5ML+0Jr5zJX//fr/4Lv/2KjuxJOPZB7/6cqEXBv/7tr+6tP03sP03L7/3q381qn/1qLhrW3XpGapfEB0WCyFYCj/8uP+8OD/5L3sxpn3x47twY3OnWGAYDFzVCWBWRiRYw3/7dj87Nf75cr/47v727f51Kfnu4bIml+zhEZ3VydxUBx8Vhp4VBeJXhSaaA3/3rjz1rTz1bLuzKPty6HPomrAlFu9kFe7ikmjdz0LoYhyAAAAWXRSTlMAETRqtO3tMQ4CNu3rrmZsuQcJFgUPDR4LYkQlIl9ZLwNlW04r6qwc69Gld1RJ/ObMwrawnIqKfXg55+TevaugkIEU/vzm49/ezaaQjT8d+/rr2c/CsLCtkDTYHfEAAAMuSURBVFjD7ZhXW9pQAIYxtk1CK20ISdgoQ1DBUfceVevuHirdiK2CTJGhDFnuvbfd408WRPtg27seqBe8+QHvc3Jxzvd9tL/R96/QLgpoJgtjshGCINLAQBAIm4mxMtHfRSwmgvfwpDAMAQOGpTwKJ5jnZShG4jyIKxFzGOnAYHDESi7Ew0kMjTelUbCKk9dVn118CRjF2fWd5RwVTKVhaJyJXylsfJJT0yK7DBBZS03Oo0ZhZZyLhVCVgqdFihXXXij0Ahih0J5rRVHUIKikSNbpoZg4JGwozN//sbBtn519CYpZ+/aX4EF+YYMQxpmxY2USPFXjwzuub/OfP3o8bvdrILjdHs+HT/M7jvyichUPialYOJ3zWHH41b65vmaafg6MadPa+qZ950BRx4Hw2B9k8rnlD4527baJKYNuoB8YAzqDZsJmD97KyeP2YDEVT9JZc+jfUk/pRntBMjKq06i3Ake3SyV8ZvRqpZEiQW7VknVj3BAxgWXUMG6bD1eXiKVsWl/kI2BOdtWSxWwyjoBWjRhNZutgQa5ARJ6o0qD0m1ffTmr1ul7g6PRmy+C17CwYiano1yOqMWciVAMa7bvBaxlxqhsRlVozkCzVUAJVjHOq4ZQqpUqpUqqUKqVKqf7TKzymnkpGjElPWmKCGAnMgdr4HIgkL92SUnF99b7FtmoYjbnAZva5cEGJMJrZY02k6/6y3+fUG/uBukb6jXq1z+84bSJRFcWtyFn5bp2Z0BiMOnD16qRfzVh2o/1Kjp22RkhQd8+1YN1Qr5r0mldg0Gj00+NDM5bAsqJOADexYl0Y4anKa/MdC1bfe7PWqQaEU2u2+awBx92iCi6fRM8aPqwsK2xeDgbmJoe93jdA8HqHJ+f8QVdzYZlShJ8NFyySoovLaluPHeHFxWfgWAw7jltry4R0OTvz1xpDUHRlRUd7W7VMdgUYMllBW3tHhRKikPjlB5GLuOK80pLcjGJgE1NGbklpnpgrkkdM8RsdG+fD3RKhIIsBcDkTSrphPs7G0PPDI8ZukvOlIpB7oEjKlzeR2J/jIxpdOUkE3MqJkNGVE0VpF4TELNI/AVOh3l08hzvaAAAAAElFTkSuQmCC\"],\"editbox_background_normal\":[null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGoAAAA3CAMAAADT7y+MAAAA0lBMVEUAAAAAAACzs7Oenp7+/v6xsbGmpqYAAAAAAAAAAAAAAAAAAAD9/f36+vqvr6/+/v6Xl5fw8PBUVFTs7OypqampqamEhIQdHR3c3Nzz8/Pd3d3x8fHu7u7S0tLHx8fa2tqenp6+vr6ampqioqKgoKCBgYGSkpIAAAA3NzdSUlIAAAD39/fr6+v39/f09PTo6Ojb29vX19fk5OTf39+srKycnJympqaSkpKMjIyUlJSPj48sLCxoaGhqamoAAAD///8AAAD8/Pzz8/Pm5ub39/fl5eUurhQ7AAAAP3RSTlMAEX19/nZzGAIGCQ34/nT7avwk+GpiTCvn2tfTy7i1qX53cXBjRkMlJB8V+Ozi39/MzLezgXl4aV5ZSSgjIhntDpQOAAABGklEQVRYw+3Yx27CQBCAYTtskm3ujd5DgPTeszGB93+lHIwi2cvFYofT/C/waS4jzVi7+tk3C8PqR7mwDSc43QWxMPWfhg2DDRt+GjKqj/Tx0m9ufo22afbHmTYYO3++i4KV4YKo/ZixihT6t9HayQ3nrIP2OCyPxc96QU6U8Ui+6qW8RInXS0eB5NxMxRYpVqPtA0mKXLh2AW2p5SRXQDkV6vSEKKDy4yqloCJIIYUUUkghhRRSSNWkvg9HLScKKs8tU8JXUMl/qki8XREFknediMp9dS8VTA/vvETRr7gLYslO/Emrt/CoKz3TkCc7o4xpF/58OmhJw1JrEM851f8Wi1niHhnNTWaLYiYNM/+NYdTCsBpBfqT/AK7giup/9WGpAAAAAElFTkSuQmCC\"],\"ic_menu_moreoverflow_normal_holo_dark\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgAQMAAADYVuV7AAAABlBMVEUAAAD///+l2Z/dAAAAAnRSTlMAgJsrThgAAAAdSURBVDjLYxhhoP7/kOcgwGjoEB06o0EF44wsAABBWUMn9krmtgAAAABJRU5ErkJggg==\"],\"menu_panel_holo_dark\":[null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAABCCAMAAACsNf57AAAAw1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsLCwVFRU0NDQgICA1NTUfHx9OTk5DQ0NEREQ8PDwwMDAAAAAsLCw4ODj/AAAqKiogICAiIiIkJCRKSkpMTExHR0dFRUVOTk46OjoxMTEiZHnYAAAAMXRSTlMABA0CJBAIChgTGyAqNlAWSWc8X3aJfI8eLidAMkU5TFtWPW9Ug3nti2Dt29rj4srKKLM+WwAAA8dJREFUaN7t2dlW2zAQBuAsTqLIK06gtmRbjhPC2oUlFFoovP9TdUZGh0SmoaeVwBf5H0D6jmacyOPOq7m0lE47s+p8eHaEHWFHeJPQX0vXQNbX+xvClp0NWbYT1ObDOiNjGdZREI3QBKjdewajHE3ESgfg7rj3ADI2GFwPJehQiCZBCRCA24fPIf8VtQoyEKEMDYICjOrtQ0IpTTCugSQYWJCENWOkEE2CrMEzQG7uGIuEPCNkNV4joEACnJMv9w9a7vX8eC0/G/ml5/OJgwhpeCZcvgi6KBiE4cm3x8drY3ncyMPD15MwHKABS6EIqgzyDEJKz66fni5s5enxjNIQz0GWokGAMyA0ObImQML1UUIJnMM6QSL60Ai9HpxB4rCrC6u5Yk4C59DrQTs0CNAHics82wSPuQn0g0aoyzAm1GVpZpuQpcylZFyXYp2AvUigDJlvm+BnUAqCHblJGI6wE1wv9WPbhNhPPRe7YTRsEhIgFJVtQlUAIWkSsBmJ66RZldsm5FWWOi7Bhnwh9GsCNqPP7RO4jw1ZE/oaAZqxyCPbhCgvoCEbhCEQCHU8IAjbBAEEz6EECEOdkDDPj6PANiGIYt9jySuEMUVC9R6ECgl0rBFGAySkBRcL24SF4EWKhMGoXYSuJLgeEma2CTMkeK4kdJuEmAf2CQGPd4TWEvqKULwPAduxfQ9lKwgt+IH+0L8piPZnbdnQ/LPuaFcWcXRzYTFXR6JxZcFsXNyOz+9utufqn3Nzc368cXHrrBN69fWV5+Xx6e33t3K7NXd/zOlxmfP6+tp7IWiXeC6CcrI3ny4PDvf39z8ZCSx0eLCczvcmZSC4dolfqemCIsBjKWblXm04BIWJwEJSsFfOBDySitDdJNQ/TvBMQDcEi3ICiPl0ulweGMhyOZ3OATApFwF0AjwP9Q+TIsio11qHpVnFo2BWThABCiOZS8CknAURr7KUOeq1Vs2aXl7uiSxFwXMhFrMSGWaC25ezhRA5L2QZiHq51whyxMGgFDHPIxEgAhgGUpYICESU8xjKwOSIo0Hoq1ETnAMgiorneRQJIQIDgWWiKM95VQAAzkANm/qKoM+aoB9S348rDgpwGEgO4byKfT+FPtBnTSt97Ij94DAvTbPM94uiiA0ElvH9LEtTjznYB5uDx1Vz7kjRwDypAIeBZJnc32MooNrcUR8A4zkAAhQ4/GUgMRJYSA6BEwqA+gzaOYNGg0SoWXxICDUYQkI1h1eD+BZ+j1CfZWoFngVKjEV9HML9JaDfsm9TKy2XlqPv1/kNylczeSvTmjMAAAAASUVORK5CYII=\"],\"menu_panel_holo_light\":[null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAABCCAMAAACsNf57AAAA5FBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADd3d0AAADJycnMzMy6urrs7Ozu7u51dXV8fHwkJCRjY2PQ0NDb29vt7e3s7Oz39/fy8vLv7+8AAADx8fHk5OT/AAD39/f19fXm5ubr6+vo6OjHx8fKysrNzc3Pz8/R0dHT09Pz8/P5+flMDi8tAAAAOnRSTlMAAwkNFwYkEBMgHDsqNlBJGnaJfF+PZycwLUEzPk1HW1ZEb1JkgWCGaP1qY+ff3c6KiVsm+vf09OvngRpQJAAAA7pJREFUaN7t2Wl3mkAUBmBsCJEdY1qWYVUkLtnTVY1ZuqQ1////9F6QAKOx51Qm8YNvPod5zp0ZmLlyKzNhFG47M+PePDvCjrAj/JPQYJi1BHr8/ZpTKNYSirHfMUghoQg0oBh+r8YUjBKCJhTj49gHkGaNweehpFC8SMgB8F98rUHGAkERaAAOj6MbhgQRa4oEMQx0ICNH0IS8BBkgG16oLRkjQ+SFoAkoyADXo2/zu7W5/c88Pd1+HV0jAg05YVIqAgoOeH50Pp8yynx+dz7i+QM0PJdhUhU0YQrOpmOGmZ7BdDTLhkl5GrAGkvh5zDLTL6KEdSimYgJ/GQH2AtZAML+PmebBFLAOsC8oAk5DWgNTYU1QTKxDNhUFoYEEXAiiaRPWBGKbIi4HJDTKBFyLOA2WypqgWjgVsCKrhH0gNGEaFFuVWRNk1VZgKppA2F9FsGSXNcGVrZUEXIyGKNjEjVgTIpfYgmjggiwIjZwAK8HxWRN8B1ZDTmhQBMEkaqSzJuiRSkxhNUESFCL7HmuC58tEEaRVBEMyFVXWNdYETZdVxZSMZUITCLbqvgbBVW0gNKsEfDciQXa9LmtC13NlJOD7kSaIQHBeg+AAQVxNUCwghKwJIRAsZQ1BY0/QdoQdoULY1k35Bq+m7XpBlz9T9+PlsP1McfTH+hNTw8Ng+WPNVY4scqSfDMYMc3OiRzJ1ZMFUDm4Xp4+Dmw1z/0JuBqeXlYMbVybs5cfXq4vTH6vzcym/qDyW8ruUP4t8PLm8yo+vewWBPsTrWpAMO61Wr3d8eHj4vobAY457vVarM0wCTacP8TOKANvS98Ig7nda7TYgQLF5jgHQbrc6/TgIPR+2JE0o7pQG7glYDVo3OAIEVAIcdaQFFQDAUdDVYCXgfjCKOyUQMBmBxzslcR1dC4Mk7g87oKgl8KBhP06CUNMdl+Cdks8IXInQyC/3eKt0It3rhkGQJHH8oYbEcZIEQdj19MjBG2V+uW/khGqLw1QsVXYj39MAATmqIUGAAM3zI1dWLcXMWxw0AQxphwHqQADhRL6v656n1RDP03XfjxwAEKhB2l0AQUGge02CaVsqIpwIGODYND4MHzkIUC3bFOhe04xuO/IGIhTbsogKkJoCjyKWZSsIyGqQC5BA9x0zAyBQQYhaQwjB8QGQCqi+I9V9RUTW/k2bvyZIagk8KG0CSwjIO8Db2INODYjIe/HgWETaKMYifNGHBwAKtvD3CDQ8I1IHSmpL8eMQAjBb9tvUjMqEcejxuL9XNZodPDUZeAAAAABJRU5ErkJggg==\"],\"popup_bottom_bright\":[null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGcAAABOCAMAAAAKPPg1AAAAjVBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABNTU0BAQEAAAAAAAAAAAAAAABaWloAAAAYGBgAAAAAAAAAAAAAAAAAAAAAAAAaGhpoaGhQUFAeHh5ZWVlaWlr///8AAABqampXV1fx8fGbm5tSUlJgYGBRUVH5+fljY2MLHkH2AAAAJHRSTlMAAwYME1IpDwpBITgvThvHSx0WJDP1RW48Oi0ZPUlm4pBe9LzqzGhUAAACDklEQVRYw+3S3VLbMBCG4YQkwrJsodjGjSwrP6X8lAD3f3nd3dkwTIMSK+aEQe+xNc98kifR3WPxx/jIdHo1u57rXBRKmsXi5vHh6U98Tw+PN4uFkaoQuZ5fz66mU1aSk5zkJCc5yUlOcpKTnOQkJznJ+ZlOBo77QseBkwX2uKXolPQjHS9VJ5YudG8ZO70vRzml79nJwk7dNeCUI5wSnKarTzizeUVOO9Jpyanms1OOaKw0ZoRjjLSNOOfQD+f9CMd7+t3+dyh2Dg/UtuC8XuC8gtO2h+dhhzt2rJR3b/u/l7R/u5PSnnI+Xlwvt5v988vLc1R4YL/Zyv7DtbFzPEjnMEj15XZz+/s2Mjix2Za9gjm5PswJODgIb87sduv1+ldM8P1uZ/DWaE7YQaiCFxJFY63tZeuNKYdmjG9lD+eaQsDrVMh87vAgTZBayQscuVLEaJ5DzvEghvJadCDBIrAGBgasAaUTdQ5MaA4Pel+EUqOUxVbnsphSDSrva3jOscODCMprogrABlYUhNQ5MTgn5DCEixxISMVECCgO1xCDTmAQQyQtwQJsYDkYS1KYCczBEKI3QqlyTgM2OK2dq0DBOyOGlfDV4SSkAIsICERwzIlLY4gloNBCbVAkoIEIKcyEIZaQii9jhZkBEJXFRWfOMwwhxVpMLDDCzDlrVEFjvDpJpVKp79R9fJNg/wAgGweRXaclSwAAAABJRU5ErkJggg==\"],\"popup_center_bright\":[null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGcAAAALCAMAAABVqWPqAAAAS1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABZWVlEREQODg4AAAAAAAAAAAAAAAD///8AAABbW1vd3d2VlZVSUlKKX/cCAAAAE3RSTlMAUAcDQjkoIRoUDwvvsGdNSTEu3NAXBQAAAEtJREFUOMtjIBWIQAHJ+iAUMzMTNxcnBzubECuLACMjr6iomDAZQFyCh4+Rn4VVkI2dg5OLm4mJGWrLqD2j9ozaQ749+HIwyQCPaQAIoTUzantFuwAAAABJRU5ErkJggg==\"],\"popup_full_bright\":[null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGcAAABnCAMAAAAqn6zLAAAAq1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApKSk8PDw2NjYuLi4AAAA+Pj44ODgqKio5OTlEREQwMDBhYWE0NDQTExNra2tqamppaWlFRUVqampqamr///9cXFwAAABTU1NWVlbBwcHHx8fLy8u9vb1jY2PT09OioqKZmZkZwWr6AAAALHRSTlMABgoOTSMTTxY9Kx0ZETMvHydIRkA2ODqBn5WJRJqQe3iFgf1qUOrf2pTl5E4lyI0AAAMkSURBVGje7drbctMwEAbghDhO5Pgoy1YBA06bHji0TYEA7/9k7Frd2jOtHEnN9DT6M8MNcr/5Vd9kt5OxXFlm8vIzhY/ZqanbD586xgYk5J1lzCWq0hMzw/SYkaQQAhKrKM5A6rugEYbh0irwAFokjYWUBI04jlcWgeNgAbWv0pSYBBAg8nxulTwHDCiSxtugAkXAKIoisggcBwukMEQIC2nqEIMKEFmWpRaB42ApaTZWiJhOAaOqaymZYaSs6ypFak4QFtLWUQwikgnRNE1pFDgoBJN1ilAeLxMFPRBi4nweZWnNRFNyHgTBwihwkPOyEQwkbBQmmkJYB2+tYyopJUFmIUZKBdHNaeus8NKkON20x8fHRx8tcgQPtBsOjaIip0IPBBysU0SpZKfr77tLh+wuWi7rLFKFdH1mSVenYnL97WR77ZDtycVGSlUIL+6+MumuLV7NoY5gX3fbvzcO+bfdtUzU8BuKl3RxmmuDOo34dLn988MhN9eXX0QjU+3FTTtniU4teAPOLxfnNzhNw+DiVvHQuYKPinLUtQXlY5ySiyorco2Dr0GonCbgj3E4F/U+B99qVgb8vbtzxINGwosw5qjXoFwEj3GC4PZFeCIHX+wxR/DX4pRP4yyMnPoADvOOd7zjHe94xzve8Y53vOOdV+BUB3De1vfGwffgl/C9/mDO889dDjlHeqa52B1z6xxozqd1Dj+31PS5N4f96RDNHFY/Vz5znSufbyTTzZXJGc7Jz9zm5OctZzQn3zv3r6Q4bdefIR8sgufXLRdy39x/uMdgbnsMCQ8O9xij658CIWRAWRgnCGgvE82xDl6bfjuX3EIpSqLbMnGDwDG1aKqgDTDaOlSo35ul3UpLRbCR0H/KukqhzJCZji/oYoAKWgNWRlGLwAgUtZ6jOppCg4UjUl0yg9BmE3eoPTMdX6Aqida08LDJB4NIbLCnpYUwrZ1XmNwoeBIRUEYZyv01emyUfpHer7dNFvbKgoSGwbMzRKjMvpBEmFmIIGUf1NV1+asNMowUsvAfx9w9byTRMUuBAKtgf4cnfHx8fF58ruwz0eY/HRQD4ERyIRoAAAAASUVORK5CYII=\"],\"popup_top_bright\":[null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGcAAABOCAMAAAAKPPg1AAAAgVBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABNTU0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA2NjYAAAAAAAAAAAA5OTlpaWlYWFgjIyNWVlZFRUX///8AAABqampXV1fx8fFcXFxUVFTHx8e+vr5kZGQwQJg3AAAAIXRSTlMAA1IGChNMIRovKA9BOMcNF0g0JSw+HpUcOkWN9aVcv4I+EWOzAAAB1klEQVRYw+3YUU/CMBQFYJxattGpA1q3qqgIKPz/H+i5vUsmiYV2I8aHe567fDmnfdrkZNYpmSTnalzSmOshiYd64yY9vRWnsHGfGrYipE5hYzab3aYE59nqpBNMrzDxkBLGfkjnGChE5HneIDYmDYLzwFhi6AxDCgw7nU4X8cFpC4ukkxBN6stAAQKjLMtlfHB6QRRJvtIVEqrTMXa6AFEU85QUxXIJynZQqBDXIaYhBUZVta2JTdtWFSySGkAoFHT83TBTzKvWaO2cq+OCk1qbtpoXDM0YCtVhBmWggFBKZXHBSWCQUImhQCG6HVott2AwGEOQIlMzg/kA2ZyWu/6tUF+nRBu9entCHlNCH7ytNBqVXaGQQ3WwGkZbvTzvhuT5ZYXpsBwVIicwm69TGQPmc0gAGVNxIR4uMJulOlq/7g77r/TsD7tXramQDQwHhx517us4d7f5eB+Sj82dc75QjqcdcDCbd3Rdw9kOYLZw6lp7xw/XO+sjp6HZnFIjHKUcDdccOesjh6/HjHYMHHveqVU2wslUfdbpricb5WTdBQUdPDd7McfiwYWci/b5P44a6ShxxBFHHHHEEUccccQRRxxxxBFHHHHEEedv//OFs07PJJhvB2dQcPxwm8wAAAAASUVORK5CYII=\"],\"progressbar_indeterminate_holo1\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwBAMAAAAybmm2AAAAKlBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteWZdn3rAAAADXRSTlMABRAKFywhOfYnMR3v8BlJngAAAUFJREFUaN7s0D1qAlEUxfE7hBRJNc9ZgZk0IU3GZAXGzsZG0A1o4QIEewsFQURBtLHyoxURXIS9he7F8jRPEN6c7vzaPxwu10RERERERESe4R5ACYExmtgi+oXolvx6ZXGEEgBjLM4c+0L0zEofXmkcoQTAGEtmCftC9NQ+K17lnxeUABhjSa3EvhC9bNWW1yFLUAJgjKTz7/6O5AvR93aqey2LBZQAGCNp7t33jHwh+tTaXa9dsbDo5gBjJL2J+9qQL0Rf2/nmdRm/jW45wBjLwObsC9GvD/9Ve8VAAIyx9K1BvBBd/8r1X6t3DATAGMvQtsQL0fUv/evenh3bAACDMBDcf2tW4CUapLsRKBKwzevNvLz3/seDedlX277qHmr3kHu73dvynJbnyAtbXiiPbnm0vqP1Hfq02KcBAADAwgBwBEHj/3RdFwAAAABJRU5ErkJggg==\"],\"progressbar_indeterminate_holo2\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwBAMAAAAybmm2AAAALVBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUW/iK7AAAADnRSTlMABQoQITkYLCcz9hTw7fhFXIgAAAF4SURBVGje7dmxSgNBEAbgOUE03e5aWm0C9l7ExtJDlDRpUtgmcgg+QCS1KGqTQkHyAmIjKEF8Ct8iRQrvGcRrdCN7e4ObsBf+rzpuYJYZuGN3lgAAAAAAAADKkAUERdKnmdUCyy0ockdJ1e0kybpHWkTGaoHlliSdUU2Npp0m1fQoFpGxWmC5NSlnNKbd1C4WjbfUn55W5mpec6/spQzcas9i+o72aJzYvcqtxKOWVifJL4HlLq62m0dbdNq3Ot+XO1d9fy62Nw6NF0Hlzqt1RS/pqGN1fCvf7zv+PLxsXhsvgsqdV+uK3tFHZjelm8ynYS2bm+H6c8bArvYxj34W9mtCg8r0q73G6Re/2icaLLxf7dWf56r1a4p+saqdlOrXqDr9qv2/X6PiKPrF6xe+R873iP9X8P/7Zd9PYL/6Z7+K8xDvPITzNvO8PXbMMDw6mJm5BJa7W2aeg3khb16IeTRvHo37Dt59B+7TmPdpAAAAAAAAACV8AcebDMLiSs2oAAAAAElFTkSuQmCC\"],\"progressbar_indeterminate_holo3\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwCAMAAAD3noS3AAAAM1BMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteXQS9SJAAAAEHRSTlMABQIKDyEsGDkm9TMU8fft+mrRFgAAAchJREFUeNrs0ttuwyAQBNBZLsYY4vL/X1sbq/CKKky16pyHJJZWuyNnQERERERERERERERERP+BaT/mQ2UUgarIA2nXH+t9uj9E7m9jZLq2WRFdiVem7cfGBw3EWrkfxb5ABBCxiogARk3ilWl7TcYHBda56/l6ctO1zYroSrwybT82PmjhQnbWGOtymO/ZHBT5eRc6LEzbajI2KHXQIXsfrIgN/gX52axItmL0JF6aNtRjo4O55kOI0TsR5+M2Xdushq7EK9P2Y+ODMcCnFLNIjmmfrm1WQ1filWn7sfHB5PEp5YhAPMobEpCKKqm+Cy1Wpj23sWO1T/5TLl+1XhuwsV6PHdj01Gtl2jONHat9ikvqtQN7UYX1mlKvjfX68z9MV9pz/2W9EpBYr5Y4qarXsrTn6LEjsV7f7dsxCoAwEATAMlb+/7m2WlgYONjFmRccKCRcdhM+WNe0H34vh2PCcdM17Xm4e1V9sK5pA6/2FhMP1dPuLCasVa1VB9eqHoWKJy54FPKk3TtxwZP2aCBn1QVyVlUgZ8UHcsQJb8QJ32zGCYWhmyfOD0OrcqhyzFU5FNGaJ84voqnRqtGO1WgBAAAAAAD4gwuJzBUuUw2jkAAAAABJRU5ErkJggg==\"],\"progressbar_indeterminate_holo4\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwBAMAAAAybmm2AAAAMFBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteWkAkYNAAAAD3RSTlMAAwoGDyEsGDkmMxT39O9TQliZAAABzElEQVRo3u3ZP0sCcRgH8MehoCZ/6hvwDzSfNzZlRoOrIubiJAi1hHFEi6O01GJBEbgEBULQH6I3IOLSFjT5ElxFtOvH1XYafPGODvx+lpueh+89cMfvjxARERERES0tpVRYP0IK4dT5woniMecFF84hWliUaZqGEhU1EUrX+cOJ4jUjHFIL51C6iZJ0QjMkmgBgBQHonAyH0niOGU2SkspqSZXOArCCAHTOGNEUnmNGk4zsWpZ1klGpVwuhCyx/OFG8Vo9HchZg5kie49FcXV4K2qHaKEAegYIAdC7HI0dgiXskRd2kLMfVarWWVzsXVUAtbwIFWGfDh86t7Vhp4RytrVjpUvaazebptfl21wRgBf/f+f5p82rRHE6TWxna2qfc2JCxPNj+GOso3muvDWxM15Vjer4y/PqZ14ccBGVeIx3Fe41VdF59V45pZW3wO6+u7KNvdWb7YwREQeb1js7LlWNSWeW85ur9Na++dIIzr47tvcY6PC9Xjkmb88Lmxe9xvh7/Xx7877meANcTXK9i61Xuh7D9EPfb4H4bP89BCwLQuejZeQ7PC2eZf17I82jsPJr3Hdh9B+/TsPs03teC97VERERERERL6hv2rPU7MZ28hgAAAABJRU5ErkJggg==\"],\"progressbar_indeterminate_holo5\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwCAMAAAD3noS3AAAANlBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteV6AHYNAAAAEXRSTlMABQoQFyw5ITIm9R889PfwHc7yYP0AAAGqSURBVHja7NLbbsQgDARQc12T7KbL//9scfqQSyshdYWFpTmPEbFHMAQAAAAAAAAAAAAAAAAA8An3y/5VwbHMIBu5Tyn1Z5Nw/ka+O+cVHMvMsZH7lFJ/9k+/fLjx8p8PCo5l5tjIfUqpPlsONCHeBC+dizpaCNeWmSOXN3/ucSn7NZEDTVwfF2uUF29fFRzLjLGR+5RSf7YcIKJ3SRdlDc6FtSQFxzJjbOQembK8O7NlORE9OF9wkf8KZw1conOxLTNmzx1mzz0wZb8mcoCIvurNqxCVV1XCRFwN4v2SZjcw5ZY6s6VHf9RrSURpqUoyUa4G5f2SZjcw5cad2UtCvWZ8OBsp/10vJmK1m3sSPatBLTfPX6+BKbfcmb0w6jXjw9lIiXp9t2/HNgDDMAzA/v+6szcDHSIZ5AUCkqGN5aHn4DpSul5Dz8F1pFxcL5/2iR/NHSn9OQ49B9eRcnO9PKsGPlh2pNw8qxoK5Y1bOlJuhkJG2qdzJ4y0FXLO5k4o5KgTphX1OlIu6oTK0LdzB5ShrXLczR2wymER7XDu94toAAAAAAAAAD98BS4GIUUirlsAAAAASUVORK5CYII=\"],\"progressbar_indeterminate_holo6\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwCAMAAAD3noS3AAAAM1BMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteXQS9SJAAAAEHRSTlMABAoXECA5LAb1JjENTd7cUtpBCwAAAcdJREFUeNrt291ygyAQhuFdQCVgk9z/1ZbGtkfgTH/QVd+HQ2bYb8IeGEEBAAAAAAAAAAAAgL9Q1VgZqvXJ/uOrcjzcWIJbTt4h4LJmcyq6uo8sGl1P5iqfPfgSsMeazSkXqmanIurm0JG1ymcP3iHgsmZ0c3Uqisy+LjgRF/wOglMtlY+nBBfTwXsEDFHUhWYL+aHOO1Xnh57MVT578B4Bg1Odfauc+DTVpCGohiFNPRmrfPbgPQImP2ssazbKyTBW5RRiDCmPm8vJx+hL5aN5BQ+Gg/cImIegjd3KKajcnnW3JJLK5A6ySH4eUX79ZIZ1CPgIIm/NFmq31yQy7fNbjSLj84hK8Ml0e3UI+PDt9ppoL+O7Zz7g/ZftlUUy7fXT4Nl6e/13wPvQbq9MexnfPfMBaa82+7tnPiDt1WZ/98wHXG0vHu2NPzmbD3jnn2OT/d0zH3D9xQSvVW2/tTQfcP21KodCps9czAdcPxTiSPtCwXc40uZCzoWC9wjoVy/kcJ3Q9m098wHnteuEXIa+UPDtL0PzKceVgu/wKYe2SKE9Gax89uBSbLimvGhlfNPNxyc93LCffLHVkgAAAAAAAAAAALiGdyuD+5ssDOz3AAAAAElFTkSuQmCC\"],\"progressbar_indeterminate_holo7\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwBAMAAAAybmm2AAAAMFBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteWkAkYNAAAAD3RSTlMABQIKEBcsOSEm9jMd+vBmaXrxAAABc0lEQVRo3u2Zv0rDUBjFPzNEShZN4p7aJ4j6AkF9AFG3Dp0Et2wdfAFBBwe3OgtOydpdB1/A1UdwFy7xZvLDofY09HJpzm9qPw4/woGE+0cIIYQQQgghpLfsa9RgZTKRAIjjdnHq0in7c7iribPADmAAh0/21oWlMkkONXkW2EE38p0twIHbg8StS3cSy9GJ5jge2gEM4PDJ3rqwVC6nl5qLg5EdwAAOn+ytC0sVMr7VvOWJGuDgDtw+Gjt16dT9ubxfaZ6K1A5gAIdP9tYFpa5f5W6qmRfpbNqR+dke4MDt6cypS3dy8yhfjeb7YVA1HTF19AnEYfugcusyk9/Uy9++JmH3p6mjZo2UYeXWZepwvX2V2/rfRvX1zL7+xZQL+qoj7/uKKrcuo1If7Avri+/jEn3x++XV975P6wmuVxevV7kfwvZD3G9j+22e52DnOTwvhFIFz6OhVM77Duy+g/dpUCrjfS12X0sIIYQQQgghfeUH+E4C2CXdn30AAAAASUVORK5CYII=\"],\"progressbar_indeterminate_holo8\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwBAMAAAAybmm2AAAAMFBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteWkAkYNAAAAD3RSTlMABQMQFwksOSEy9h4L8O0G0W7OAAABgElEQVRo3u3ZsU7CUBQG4GMHlc0WuzG0TdxcDJCY6GJgKwuSvoFhwIWtcXZpZWGT8ABGpg4Y4kr0PXgMw2Jd1Jv0NjbXHG5K+L/xkvzDP9B7zyEAAAAAAICd5WU5RGR4HBy1IPV00pTz2wiRa0o88kwWlmO4Zo5ypRfniEYssgOJRW7Aonu0ZwfsRLph68kRjXSpV5csvVqdxaXlvuWdlyu9OEc00qRGW9L0em0WreuTRt55udKLc0QjLfKjrFHHfH+NOLwsa37ETqSf+npyRh3ru5E5LfqSuXnRZ3F7Vl3knZcrvThHNHJDcZh1d2+eP4YcJlfHcchOpFdjPTmikQmtUskzPaQ8xpV0g8aHiaacp59GPmmV9+sg5TE8SDdouJ9oypnRAH0p5Kz/7GtG0+3oq5JoyvmgKfpCX+hrK/rC/33WGt/Hf94ncF9Vu6/iPaT2HsJ7W+29jXmO2jwH80K1eSHm0WrzaOw71PYd2Kep7dOwr1Xb1wIAAAAAAOyqL3DZCqyBVRiEAAAAAElFTkSuQmCC\"],\"rate_star_big_half_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGgAAABoCAMAAAAqwkWTAAABEVBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAA+Pj4AAAAAAAAAAAAQPEwAAABoaGgAAAAAAAAAAAAAAAAAAAAGDRAAAAAAAAAAAAAAAAAdZ4IAAAAmh6sAAAAAAAChoaEqlLwjfZ4SQFJDQ0MAAAAAAAAAAAAAAAAwqtctocwhdZQ4ODgAAAAxsOCmpqafn58qlr6Xl5eJiYl3d3cKJC4hISEAAAAAAAAAAAAytOOysrKjo6MtoMormcKUlJSQkJCPj4+FhYVycnIfbYpeXl4OM0IxMTEMLDgGFhwxrtwsnMYpkrknjLGMjIx/f38YVWsAAAAuo8+bm5sieZofcI5vb28bYnsbXneqqqqnp6cea4gzteW3t7cki/zoAAAAWXRSTlMAgDIGGk5+mmF7N5lws1oWaGU8hXdTEguzD8x0beXYw5ycRCsmIvHmvZcd+eri29rMvY6NVklA/vnn5d3X09HJuraslZSSiPbh19DPw6cO6d7Aubivre/stqtpT24AAAQ9SURBVGje7ZnnUttAFEZ1ZEtxi7txsMEEHHoNoYReQ4AQ0ov8/g8SSTizlhCoLpnM+Pxnzvjq7nfvLsqQIUP+BSPlrvIklMmOKE9ADmgo8knVMUkr0qnCGWQU2aTa0AEWFMmo8M44foKvVIaW8RP0UUUq01AzjN4kTClSKcKcKVqGekqRyK0OM6aoNw+qIpEteGlYokOoKBIpwJ4t6tWkHtpXVm/fib6BpkhjAyb6oiXISmuHpg7v70Ry2yFnt0Jf9EFi4JXh6k5kAUgaSyUrFYToFLYUKWzC7wHRZxhTpNCG3QFR742kYTFtHaJB0bGko9SACYdoSU6yprIwI0QW5yBh8VIhbzhFR1BMXpSBa5foLejNpD2jOmy7RNagzSXoEPHjFh1IiKEKXDlENskvKSN2/AiRqF01Viunbbpqn00tA989RKtQ0LSc2idt49cfaVWtalqxUtHxZPeeyI4hT8YqFU2bMs0pd7w0yvjQMrxEq8LkTaGoDsiaOKnlbX686NNqXW4bDpFgaW3t+HmfZzZut+rMMfLfX8y1Wnuzs9uGHz0/lsbH19ZuTLNVxsHypTKIyDTii0Sv0C4pitv0NWHRIVAYcXd0EfiYqOi18DhMGpCfTU50CpRHH7g0crGXkGj8HNh4YC6qOnAdTyTa4LElaboNnCQgOgKy3cemTgV4ORtX9M1qA0dbe7dErRNLtGMd08xj0So+1EQM0T4mWoD1KF3wLZ/f6dFzwaZR0a98j3S1nW6lwAuCDnyJINrHcXoCli+/G1wkypZVww3zDUw6PqIYZRPkssBcMJEoWyPCMl4as8sXVHQsyhaWVAOTlUCiHVG2KKhZWA8kmhSHNBKlAswEEYGuxr2IfwoiegOxduNRuAhUutOY94oq/Agk2o95r8j4d534SLfxHn+2/UTiThbz9hVMdBDrPluE64Cit5BNxbnxLwaNoGfwKsaDYz5wqN6AFuOVaSKASLyjxHiq/RR8TJxHfoNaEInqZNF7vEZ+3Z/yHnydPPOHHqJlKEcO1Mt7mpkTLOaX75tqEYO16RWonQsgi8lRYsHavX8xe39yt4WqlurZeELh0ICW07OyDhSmrYeUDCYfXOEQscHrruG6ODe4VOfsH7XjMM1HavA0nA169t71f06fkYr9o+I3eNV5Jftyf2ur6q4ftRxp+hUHZ97lGdDuulcX+0cdOKZf+AQfSO7FCXt3b3r8bN3RfpMREnxBJPeV1Wz1rvc+Vh48UzcRPlL1b/7MvsSkePvQzNrSgfPVvx+pEuETdSxPC5PCIwXpn6nnvyKO2bb9P6kVqwn0KZ8/VttA7fBuzKZDb47rxsxXTDIl/5m/aQft595zyIWe4h/tXqurwY633RSTa6CF7oWanTjNwKtZHZtM2HXBIhOm4E1NtxsnnEgDKtNhH8cbhA7waluLsqWVtsYyypAhQ/57/gB4BXFFXDX4xQAAAABJRU5ErkJggg==\"],\"rate_star_big_off_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGgAAABoCAMAAAAqwkWTAAAAyVBMVEUAAAAAAAA8PDwAAAAAAAAAAAAAAABoaGhBQUEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACJiYkAAAAAAAAAAAA1NTUJCQkAAAAAAAAAAAChoaGPj48kJCQAAAAAAAAAAACmpqajo6Ofn5+WlpaUlJR1dXUVFRUAAACrq6uampqYmJhwcHBgYGAAAAAAAAAAAAC0tLSxsbF/f394eHgAAAAAAACMjIyFhYV9fX1tbW0sLCwAAAAAAACioqIAAACvr69YWFhUVFS3t7eP8DjqAAAAQnRSTlMAgJkyeRpOs5x+BQNzDmEWOsxaaAmVg29TLuTSjkQlHurn4tjXvIg18d3aua5kPhH7+MS+ZijPycK2klZJ5mz1qadtR87CAAAEB0lEQVRo3u2ZiVbaQBSG5wshhbCGTdZKVVQExIXW3bbz/g/VTMSGJUgWxp6ew/cA5Myd//73/oPYs2fPv2Ba/S4+g1wVcyo+gTOgKfRjm7ikhXbKUIei0E0uD8fAodBMCx7l4BNuqQqOPIdsQWjlEE6llBnoCa1U4Nb90BGYttBIIQvn0qUOKaGRS8hIRQdmQh9K20Pp0dDatF+Vtt8YgSW08QQ38o2+TjkoKfyUcwyNcigrKbzzQ6PhVeFE/gXQNJZKyhV8xnAptPAMD9JnCAdCB6qJ2nKBro5h4TeRz0BTKzXhXnrobaWaqfx0iTpoWLxSYMhl7qAidk4RfshlriFbE4od249cJQNnQqHHfnw6Gmxopuxnjd0vKVNoyHUyUE5kAmmPVmrOs1WEsVznGA4sq5yak/bYpg/3dy8tqzKbZQmkLQPoEsjrbGJZPffL9qq9NKts4U4GcdzlY/KVVG5BuyzTMDzGX+Y4zpHcRN9xRl/mZAzFKcu0ln0M93dvHWf48nIlE9N/aTvOjftl4GDxzuwiau/YNUNVu5IQq18ayd3SWf2Owq4Av+UuuVXfma73jgUY3+SuuPoFVAsb7IzTodwN7TrwZG9Ic1n8WZCMC/hoSTrMozad5NwB5kfTtzABMokvarQmt2BJNI5lEr6pNi1uHR+pLGrdic9JA7ByYivpg0TlU92TDTfga5X45Wsbyt1KoRcEVb7buGXzuydk+Yy2jMgAMKPFM/tJle8ketleSyIiZ2bE8p3g0rRj5K5o5RvNyxYDu4nLRbgm9csWh5QJXRkGZQaWnSC25lVWCQFkW0mDeF+GoAuFRBlCBfEwjKGcMEOMw2q7mCh9hVJd8lxRU+lrO8kz2Rlkwu9wlUQvqB0ZjuskbwG2CdcyJAZ8TfBWYsiw3CR4R3mOsvj3wczFf2Xqy9DUY79BHW5y1OAANYj9ut+DQVCaNDCCtHgE1diGup4ozx9QGAFZ8zSmsdaCDPX4FDCDw/M4pjm04NdqV3rHseyU6U/55ObQBGcli3SBAyWtaZH1hHMdT+C51YfAqwEL87ps+otzMoGnob6UsB+BvO8ypYl3qOQCLy+n9HtcmrXFI19mVw51FGv6VRZn3lFdHWce4VYO1VmafnacK7p+vx3vOE/+cVYO9eJPv+gOfug794kSm9kK3seqiz11A70YVzTwgyKVwqaT99ShHi/eL2kS44q8KOageuejgF0q4vKlr2oco5Py3n9SF0oE2Z69xUPyQKPzNmbTkTfHrjwf4VIsbbfFZ1zqQ/kQ2e6+w+97fBFsI+2JIuOAFVkLDVysWth2UJ6kKEZdFxSTdJRqW1mI/OeVBcyiNt+0qWotInGZt77GyVO914nYs2fPf88fm/2TZoiTETIAAAAASUVORK5CYII=\"],\"rate_star_big_on_holo_light\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGgAAABoCAMAAAAqwkWTAAAAvVBMVEUAAAAAAAAAAAAAAAARPEwdZ4ISQFIAAAAAAAAtoMsAAAAAAAAAAAAAAAAmia0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqlLwONEICCQwupNAsncYnjbMjfZ4hdZMKJC0AAAAqlr4GFRoAAAAAAAAvqtcebYobX3kAAAAAAAAAAAAysuErmcIpkrklhakfcY8AAAAMLDgAAAAxr94xrtwieZkYVWwQOUkkgqQAAAAzteXrvX7WAAAAPnRSTlMAgBkzmbOcfAXmA2FzTc14Og9uVC1pWiUUfmXYlYPq4tLDvY5E24g1C/G3rlA+CPve18u6HZJJ+PbAqJjHIJaA4UwAAAP2SURBVGje7dkHduIwEAZg/YaAwdh0FkyvIfSEtE2Z+x9rPQ5ZAzbgpuzb9/gOgKPRzEijiKurq3+hXq2In5CtIl0XP+AWQFnIp+ZhUYR0BaAFaEK2bA5oAngUklWAJ9r+wC5VAYPugEZRSPUJTIgoBYyEVDVgQERdIK8KiYoN4I4sLSAhJFoCKWI9wBTycG5vyNaWWrS/OLe/zABdSFMG+vSlIzMdpg3glXbeJaZDgVPhmyGx4VWBe/oLgKTuoHBXcMyBpZDiGZiRYwOUhAxcRBnaM3QOCxlF5NhKKiWniOSW0irN/fRAC5Bw8UoASTr0AdRE7DTAoEOvQGMlWMwnER1LAbeCyWk/jp6ENmRy+3GJ/5JSB9rklgIKkZqAYqskdp51DZiTWxMo6XohsaPYpuI863eXul4zzTQ8ZcjDEJ6qpqnrI+vL6nF7KVdxwQN5aQ5xXq6WyO4dnTjUTtrmNzsPRpdO6RjG9mYnlWQT7DvsHgsA1u8ODGOTyawpsk4mYxh968sASvs1rWoAPihuY45dXYjjL20pXj3nOw61BuCN4vTb/R2WtfcpQ3FZv3GaF0+0M0w2FI9uC0BZPTHNcakacaXBuUvSZw5804nuAUC+cu7UMQGkIm/UjNNAOd9OdW4MTYoiw2WqTS/eDXij+hResw1Az4qLlFKk8HH1pP0d8Kta+PBlktzdFN8XBA7fbwruvu2qnkvhC9UmBhy2YOOZWrbDJy9sjlsO3yBI2OAKm5TwbV1hCxY+jP0dqXbY6iIkLt4h+cHNYKFGuDfmeFbxAWhUog7iHfJhGHFEL/Ig7sccKEScIeZ+c1uLNn15Z13cc8WUpy9PMc9kt0DK/x2uFukFtUf+vADp0HWkpoEX8ikJ/IrwVpIkv/oR3lGeg1we+B0lG/6VqUO+tUK/QT2e6qjrU8frSIQy8j74mu9498rFLlAN3VDdE+XdDOy9Sy6TkI116tVQmxMAee/heR6yOVTcg9mrvRxdTeSdUz56cyi7/urxEEDpk48PDe4J5yVcgmfzR4frevC1nL07ZioTQ4IrQIv2bJ4A5JwuUzftRUVP8AIwO7q7o7zaX/LyeFFdQAvVuccHEykv55BiL6p3cPqpgbdor3Ov+/ZyXKOVa1GpEB380enc98PTE6lSheXD6eCjEFs0cAZF1IqnVj7iRT2NvzfJDLFFze/5GqVzAalrsNx0OMZAOmgl5YBXojEnQXqkXughOQDt3tcxqwS+OQ7pbguLVr88jD7D0trQTeB29wt468MzCc4kRcoA9MC50IZlsfJbDoU8bFrQ6wLTggR8qjeAwP+8WgAwgxZffcGxFoEsc4swtzRlVNLE1dXVf+8PiLJs5G2Z9ooAAAAASUVORK5CYII=\"],\"scrubber_control_disabled_holo\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAPFBMVEUAAACIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIg4st+Ci486sd5LqMtwlaJJqc0zteWzIZSAAAAAE3RSTlMATUg+Ihs3AywVCEUP4FHVmWCf15i9tgAAAYlJREFUaN7t2Itu6yAMBmD/NhBuabuT93/XI03TOm0qJXasdVK+B4iFTQyYTqfT6S/pIScRBlgk5dDpSDUkxjecQqVDLDHhgRQX++cDY4CDMURgPMGB9IpgghRtdjImZVWeqmCaVEV6GDvw7jRF7BQV33eMEAHXCAUq03WoDBWuNGURKMlCMzLUslMB7oo5QfYkBZiEpwtgmPBiWoB9CUuDUVssPcLeMRLMEg1UHKDqS2wvcwJ8c8Q4ANNDHYfoviUAgrpRX27XbbveLhjL2hq/rdu79U1bZcHIZd0+rOM1CD3SMHLbPv3DSFPu0us9wKrcpxjavsCQewD3FLkX2X2buv9ov9cqIg4R3du194HjfmS6H/ru1xbvi5f71dH98ut+ffd/gPg/ocYEBkLPdRj0V3iIG5IkLzIMIeqqCNydB0bllUZq96Gj39ixN+zQOu1WE6alShphvgEp9YQJ0kkvNjzRItlEwYBEsiuZH2zNXOgYS8ztR2pyXOhItYQsH3IolU6n0+kP+Q9bEx2UrsdzRwAAAABJRU5ErkJggg==\"],\"scrubber_control_focused_holo\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAllBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteVtyu1yzO1ryuxexetjx+tTwelvy+1yzO1yzO1xzO1syuxqyuxwzO1wy+1nyOxZw+pNv+hxy+1wy+wzteU1tuVOv+k9ueY4t+ZixutDu+dJvehVwelYwupSwelryuxGvOiB2w4OAAAAJXRSTlMATQYKEQ0XGh02RUkgQSwmMjvw1flze2To3M/j3IyrpYRsX62hrNdO2wAAAttJREFUaN7tWWlz2jAQrZb4Ej6wjc0dIC2+OfL//1xllxl1Wq9AVjQhGV6+BD68xx7aXa1+PPHEE5KA7k8LoMXoCmjxseSM1TCMlyvYv+yLjxJp2Rm1aZqWZXewLPaBybQa6uzQsVt24IQepYSBUi90AtvqNABAmd5k5B75Dx4TMdUkOnrLnVCCgE5cq5MYTm+6zpgIMHbcP1YM4mfO4fS4BHPUAIXOOz4ld4D6nZ+k+U03JHcidE1UAXdPQMndoAHiJpzf8okUfEtCoeWfEElMWoX7+R0iDQdRwH+/sg14/vhkEPx7cgnAMAMyEIFpANx2kEuHClCXO0kQgJAMRngrDAA8AEPDACA2wKYqAtTmJiAGOEQJDjcBifBYTWAsjDM3QM0EXQZwE3ADhDVi9mu5jqbr5XYvrBjMBPwMeARFuqhO54bhfKoWO4LCQ88CE8CLxNuyOtdFWWZZWRZ1XsUzvGAwAekQJ/NjXWaHK7KyPkaJdJhHBuqh/TQvGD1HVuTTBPWRMcJO8Rjxz5zzc4XoDckj5DTDCC1D8ZHzc4VjjBakEUgl6aaqOT9XqKuNVKKCgRXqRV4eelDmK6xoIwJIjJPOgF4TEiTKvQJopX49FYdeFMdXtGbLJNGy9VC/j2KJNAJ4sUkv5k3WL5A1EelFv8AIE5iiAu9TGQHQJ8BjoNVFoCHIymn6U5ym6gctxQ4aUouQUrFSLxXifrNDi52o46iX6/NCslzjDWcW9TacmaDhSLbMtKdlXlLBWCHd9NPon6Z/jlJB0x8wtsziKq+LMmPoxpaFeGwZMnjtVtUpb5r3Jj9V882NwWvY6LjfxuvLZR1vE9nRUf/wy6uF+vhuGZ95AeGZqmIA6L4Ear/G6r6I614laF+G6F7nfP5CSm2lpnspCA+y1hy8mNW8WoaHWo7Lr/cf74FC6onlUR+JdD1z4Q919hV/PdR9hafGG4+lX+e994knvjF+A/DCfuTfcOFvAAAAAElFTkSuQmCC\"],\"scrubber_control_normal_holo\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAhFBMVEUzteUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteVKvugzteUzteUzteUzteUzteUzteU/uuczteUzteVJvehJvegzteUzteVKvug7uOZHvOhHvOhDu+dDu+czteU5t+Y8ueZAuudFvOclVTOqAAAAJ3RSTlOZAAQJDxgTITo2HSomlX0uijJC6IZuYVFMSbJmgf74kHjvp8/MvLsvv+3mAAADbElEQVRo3syU23aiQBBFz4w0NA2t3AXvmqxE8P//bxqMFip0G4W1Zr8keTmbOlUd/BmZ/0fw945hBJQ9mUwsy7Ib1C/qT7K8J2jCVTJjQjg/CMGY8jQSo8CYrr6bCcf3ZqHLf3DDmec7gqlZyPGC4PztzPFnLs+zdBcEgQSk+rFLs5y7M99h5zl0An08Eyq9WE63eGA7XRbKIZheAU28+njPjZYJekmWkeupMTRFoTffquPnUwktcjqvFVbvEOiLt0UdjyeoFcLuU6Dv8/2woHiTogj9viHQma8+n6cSTyNTroYgg1bQtB/mAX5FkIfNJsyCph43k/glMnP9LgM68j2+wwvsuNdhwEO+8KIVXmIVeeLBgI78BC+SdBjw0E8U4GWC6KEl3NxnnZ/gDRKuNn1zrbi5f+bzFd5ipQz0Hu4EE9txd3iTnevYkzsBLTjM8DZZeLNo3Cwgl3gbmXvtNaBVkM8DDEDA/VZJaBeUYhBSKqktYF4hMQiy8BgJWhc0xUBMW5cEGmCOwZjTCKABVsCAI1y2gBEGoBFIYAnawDAjCIsEzRuIJAZERvVbIIHFZksMynLGrLbAcRMYOXzG8Xodx58HGElchwR1QwVMfO1PVVUqquq0/4KJou7oKjA3dIhP1fH43XA8lqf4YO6IBOYbWmwqlU4cq83CfEdXge3wrT5/XZ7zyVCu9YYtd+yLQK0g1/ezoXwybPQt5WoJjaBZQQYdMfXTbimGjqxewlWQau/nRPltw0l7SykJLBFqd7wvvzsp99oth8K6CrTPbEED3I+w0D41EuiP6KPqE1Qf+jO6CNSVSt2Ky+8eSt2apbrT5wSbfsHmaQE0rPsFa2jQTDC8YPyKtuMsmc40GO1Mx39o4/+rMP+z+1etGeMACEIx1BuQqJPRwUQG739BHYzFEMNHfBE5AAwov+2rv3vsfOKx0wHYc80PHH5k8kPfLlvWfNmSJbx8KLy8VXhJOhr837B08zTN3TLYpaPEb7kBjP8CXL7DBoS3UKAJHOVjcRvLG3E+SuDDED7O4QMpPlLjQ0E+1lQwW3TRfasLAKNlOhyn430aUNCI5XtIdGAu9wxz1QHqAtQ4mj6eEzXWA0vzca/2Nx2gIwzAWtu/gdybfZmQe35pwF1LAy4oDdRce0gVN/5SPYlXTe2cDUmLl89GXuGIAAAAAElFTkSuQmCC\"],\"scrubber_control_pressed_holo\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAA1VBMVEUzteUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteVsyu0zteVuy+0zteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteVdxOszteVpyexuy+1tyuwzteUzteVZw+pNv+huy+1xy+1lx+xgxuszteUzteVryuwzteUzteVSweluy+1uy+0zteUzteUzteUzteU1tuVOv+k8uOZVwuo4t+ZJvehCu+dgxutjx+tEu+dGvOfyQddBAAAAO3RSTlNmAHzex6Jq682mwiLmgYUv7m3hTPX14fmJNNmeY1HSvbCMmI47/e21tI+IeufcnZRyHf4Gn4DVv2BIOFolky4AAARISURBVGje5Zr9e5owEMdvIKiooCKgnS9Tu9p29r3dW0Sttv3//6Stu0BkJQlIfLY9+/5qnnzkcsld7gLvDqz/B1AbaJNSpRIQElQq1qTl1hQCbvrVOnmjerV/owJQ03TCla7VCgL6FSJRpV8AYJZJBpXNPQH9JsmoJuwBcI+Sc1RODdu2TQDTtrvGaJikH7k5AbVJws5VDd5IqybWp+TkAbgeidU2TODINNpsnOdmB2gklmWDULbFxmoZAU6JTd8AqRpWwkxyQC9e3foZZNJZvM/1nhzwPfZ9AzLLiPfEsQxwHERDu5BD3ehvBcdiQC8aWGpBLplW9Md6IoAT2f8D5NaHaB0cASDynyrsoWr08TwA8//3sJfeR/uBB3AT/7/AN7jpAMfj2D/3OnhOKqBETQgFZNE50gDfqJu1igBa1M2/pQCG+NMYCqlL48NbgCk8H3KfGuYbAEaoOhRWHSPg3W+AFoLPigPOcKbWbwBcHAsUyEJnSQK+IrahAtDAub4mABi/dVAiHTOFXUANobYagI2z1XYA+FVtUKQ22nsH0M60B85nF/7trX8xe8i0F9oMcEM3B4h0OX9ahY8/Fa6e5lcgEt20NzGgL1/iT/42fF6uFz+1Xj6H24tP8mXux4CqNAxMO6vNekGoFuvNqnMuDQzVGIC7WxPM/zFc4vQRYhl+FBA0PHcQEDlpU2CfDpufEToCKzXRUSlggBsDuPJXbH5GWF0AV7hxBxSAH3TK95/ths3PCM9bvi+dotEpwJCkEifhmqRoHfqSBMOgAEscyqb4ASmf8MRd5zEezhRwJHaiL6slSdVyNRO70RECaCy45i4xWijNRp+Bo2uMCRTgYQgCjjqPi3TA4vEEOMIA6VEADgeePr4QHqADPOEICgjwqDscoIlrcDgT6ehFh1vkIQagw7npSJwSXRXYaAWPirnsqCh22G3kh93Bj+usAechd8ApY8DJHDKv0kLmVB4yk0HfyBf0p9LEiAV9kF/OHvxtuInSlk249YVpC173AAEsNQWhLk9eE6+Xl9fE6+QShGLJaSJ1nIBY05k/v72d+7NzEGtCU0cG6KpNfvFw6+4Aeuz+oe4G0tu9gAzVX0CGiRsOKPwEjboMA7Bb7EgFYIQHQ/o1dgyFNU6/xt55qi7i6PLeHaeUcA8Fdc8rJdDITLpKiiF6SrXFJQp2m0lrtK6gIGWpL0hROYGqklrgpBcFB0WLggZBDXhlzbGasmbjjxRmUY6uqLQsL45bZk7/HBGU18tY3q/nK+/XZeV9RigTqvv8y0uaxxlaLHreFsu4zVosOZtEIw2k0kZ5mkSoRvY2V8NiYxs5GnVBxkadzsYFgzytRqckbzUapWSrsViztIzN0l9W+dUsTXaCdXePdq/pkYzyWns2rLEbIFPz+q5Ay30om37YL/pooCF6NGDXlDx7MNOfPZg19Q83XmemDzf+tacnfy/gB/s76qMkz3F7AAAAAElFTkSuQmCC\"],\"spinner_76_inner_holo\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOQAAADkCAMAAAC/iXi/AAACYVBMVEUAAABFRUVISEhVVVW9vb1NTU3BwcFSUlKysrK/v79ZWVleXl5KSkqkpKRmZmZjY2O6urqEhISbm5tpaWmSkpJubm53d3fDw8NPT0+2tra4uLi0tLStra2vr6+rq6upqamnp6dbW1tgYGChoaGfn5+dnZ1ra2t0dHSWlpaUlJSPj495eXmNjY2JiYmBgYF9fX17e3uLi4t/f39ycnJwcHCYmJiHh4eoqKiGhoaMjIxdXV2FhYW/v7+enp5WVlaGhoaxsbFdXV1HR0dISEiMjIyEhIS5ubmnp6fBwcG2trZvb29NTU1UVFRISEi0tLSoqKhSUlJwcHC8vLyZmZlwcHBbW1tNTU1OTk65ublSUlJpaWmqqqpUVFRQUFC/v79kZGRTU1NoaGitra1JSUlra2uioqKVlZWXl5dISEheXl67u7tLS0upqamurq7AwMB9fX10dHRdXV24uLigoKBVVVVJSUmQkJCqqqq3t7dwcHCurq6Li4uysrK/v7+KioplZWWEhIS9vb1nZ2dzc3N+fn5WVlaXl5eWlpZ8fHy9vb2Xl5dUVFRISEigoKCXl5ednZ21tbVra2uUlJReXl6+vr5JSUmioqJ7e3tHR0ednZ2RkZGmpqZkZGSZmZm5ubmQkJC+vr6qqqqTk5O0tLS+vr6fn59nZ2d0dHRgYGCMjIxLS0uenp5vb29MTEx1dXV4eHikpKRXV1eysrJ9fX1cXFyEhIRwcHC7u7uqqqpdXV2NjY21tbW9vb2kpKSQkJCMjIxqamrBwcF6enp0dHRTU1N0dHR7e3unp6ednZ1ISEhQUFB885iiAAAAy3RSTlMAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIADChkbBQUOCUMyGggyfEQzIhx5XlctFBMSDX17V1I6Mi4mGhkOeXNwXktCLi0dEnt5b29uV1ZUUEsmJSQde3h3c3FxXFtUUkJAQD03NTMrJxZ6enRzc25tbWxsaGhfXl5cW1hYUlFQR0A9Ozo6NzEsJiYhISAYend1dHNwZ2ZjY2NhX1NQRzd6dG5sZ1tHNWVKSrmNY9gAAAqQSURBVHja7NpNSxtBHMfxX22sD/XgrabGlr6MDZsQE0gTYmIImAcaRZqLTWqgwVARpXjwIHoQquBJLHooggdLwZb2UhBK+6o6jrWT/7r2YTK7O5b9vIMv/5l/ZkX4fD6fz+fz+Xw+n8/n8/l8Pp/P5/PWummaKSbOJBKJKv4nhllebW7f++XWLzvZWjwRxQ1npFdPv9zhSCSxuVs7NnBDmasrM7zPNpKa2621cdMUUiyQopFWPT09c9l4GDdGLLUywPxjJLd7QzrTn2cGLkhEsnkWj6G5yGGd1UlFCo2Szhu3sM+GKBXZQ2Vq09BTYS8QGJCPpIaKOmYW9gPMACERKcx90y0zsjoT4NRFDg3N1bS6m616gPur83p9I41kGkfQRaEZEGilfOTQhaweZ9Y4nAk4FclkShq8a83tAGUfud3cT6VMxgAM9qHVjsdr2R0SSRuFnQQ8djgc+EPkl+Zhax3XyB+Vspv2gxTmSvBSbIUGWitnmuVJ/FE+nt282ij09mbD8IxZH/5N5Jd9E3+t/W3zN5G9jTY8cjjMXFMZaLYM/BPjKDtn38iV4IXYyvC1kaepGCSE47sikjZ6c2QL26zQvnLFhLT2rv0gmZ1puGyyzvpsK5smupLI0kEKjTxcZS6yOrvKz+voWrVIGoXNBFyUTg7bRm6bUCKxIyI7ZY7hmlzy/rBN5UwKysQzl43ESAUuKd9nrlbuFaBQuHjZSLlUmWOJVyvrJhRrN3ptjBzBBa2kXeTnCJSLFm0aRzIJOC7NGy2VyTIcEc9YG5lMFQ5bX+SBtLK+DofkG7SRa0zDUYUtnkcr1R9VemRpIzMbhoMip8H7VypX4agabeTOonDOXjB4pTIFh8VHSCNXhGPKQYZWJnNwXGWENxJrcIiZDFork2m44Dhjbezra8MRsS0WSCsXTbgikaGJjFg+yi8kzUxKNCqo7OOKcEAu2Ik3tuCaI9LIVaBcYTForSzDRRXayGxMQ7W90aCl8gCuKpFERw5senTUUrkPl32njcwClDK2WCTJ/GTAZcYEayRmDah0wApJZT0G14Vn+yxKUGhykSeKzOQ6PFC1Rm7koc4yqyOVB/BEyVo5AWVaowS7kPDIhOhTvXtOR6nFAjwyvUESb98+gyLp/lGqDM+skURG1Sg/9feTzE/w0IRI5CZUDZITkZPwUP62aOSOocIybxSZq/BUTSSqG+UTHigy30XgqegsTxSqSgZJK8vw2JroUzXKyX5qy/N/qzFmLZV5dOtpP5WD5yqWyBfokvFOt0ECxhmNPImiOzn9Bnl1lBUVa0d4p8EgAeNE6eqJjdHIA2ihRCMHw+hGuZ+KQQvhDVq5hm4sj5FRzkMTUwrPa2zsnOhMQxMLCs9rbowRnUtarB2bB8FgBfLmxxjR+RTaGO8oZKa6eQmMEU+gjaoIPHdiQNYT2rgEjcyeFwpVyDqgkRqdVuDFILGm5EoyLWhkgUZOQdZSqLMxFIFGohsk8gSSJkPcZekytDIxSOQhJxdiROgbaGWcRr6FnDchQpvnju2lHIeceRqpyeP8UljN5lkijVr9Sp57TyLfQ0okRGjzBXJpapCISi5XQrO907F5HnF5yEjTSC3+utPp7XmdsAAZXx/8FOI0ep1fqD4i1iDj8QNCs+UKhGnkOGQ8JY0voZ1nJPIVZMyTyOfQzmsSOQUZH0jkB2jnI4n8CBnPSaR2P5PAFIl8DRlLJFKrL+YLLx7d7fAeMl5qH3m30zO5yIedHkM74woiH96syLt+5I/27falqTCM4/jvH2hSpq/DbFZaafbgNrYlbAh7U2PrzSKGMDeCYIYgiKCiokNQ0UDxCUFQE0UFU0pQQ8n6s7p3juvedTYdO4+3dT4vfP/luu5zdo7bfx35X5xJGvmPXl0/Xq/Ir1oiX8oWIJy3JPIz1Pj2Mp+In11J5HeosUAiRXwKqcnJRr6FGkckUsTnyZp8/VCjLdt25y/x3gzUEK1Q49cdQrx3PDRyDWp00cgOCOYLjYxBjdc0Urj3roM08g3U8NJI4W6UixUk0gdVPpJI4e4hnytkcmMc6izkN964IdQ/mgFfRb6aRajTluuTdUEosQqiFep0ZPs4wa48gzTyC9RJ3SBmIJR2GhmGSrskcleoQ+n7QBrjUGvhIk/EQ6k4kotQa5VGHkEgn2jkGtR6RyPHIZA4jQxBLdcurRToM3rI4XDkH0kXVDuikQK9sWt1MLyzH+p15CfevSvQvsYdOfwuqdIrXijZhCC2HPkqHG5oMMMLs4S5vvY7iHZo8Usq5AR5B+J2UGvQ4tVdahVCGHRQbmgyQyPHhfjRhCuudVupjvzE2tpaId70JBxUAtp4d3li1qQAo3RNVVbmN8Z90KgtP1GMUSYqs3hkK7R6zRMFGWV2kCQzDM3mLgqFGaU8SJ65CO3e1VLjXljKF5f6eGYIOpjJT7x3714bLDVYSbVDD5skkUnBQmFnJbUFXczwRMkcLNSu2yCpLpLIjMAyCeUgY9DJb6mRG/fDIu4fTifJPIBeurKJ3K1bli1su1NCBqmXOdLIrMISayyQVC5CPymSyETewQLbbFlJpjMMHa2SRmYyANO5p6qctHIQenJNkkRmzgWTudqrqlglVznlgq66aCNzDJMNskZaGYPOlkiiBRefIVZIM/uhN39EGfl8FCZKsDxa+eM9dNehbHwe6YJpYtEqZWUCBliiicxYEiYJSY0cX1adBSZpIzPhgSm2e55VUc4eNwyRjNBGZmwTJtiKPnumrAzBICPKxvv3I6MwXIw1KivXYJglZSMzAoOtN0uNpLITxvH+Jo2yFRhqSGqklQc+GMg/8Zw0Spa8MIyvs7m5oHLKDUO9HitofPBgOgWDhM9Yo7KyJwyDbUaUjczYCAyxHpUaaWV0G4YbjdBGmREr6+usq2suqIyGYBhaSRuZ29NJ6Cx0VscUVMZgipEijcxyADoKsDHySF65DpOMRgojme4R6GZ9p7quSGU0AdNsjikbZYce6GL7oLpajqQLG92CiZITpJFbTkGzcCdLLFbZE4KpUhO5Rhr58OGyR+MU09U5isieMEzmny7eyMwnoVpotl4OLBzlgR+mC8zzRhLJHAYDUCGwPltfzyNp5U83rLDCI2ljQ0NDd98GypRJ79RLaKRcWTcEiyQneCOJlPQel3E6Ped7jY2NPFJRafYlh65s0UZZU1NTb9+oHyX5M+lsoRRZvJKtqpVWLo1skj3q7TvZSOES4cxweu8Jc2XkECyWnL5skHKj5MWL/b6BYNDDgPEwweBAev8p80TSeHnlWQiWc610l47MamlpuXnhsYQVypFXjXJnyPIvDkn888UbaWQLj6SVV0b+9EMUG9OssXTkzVKRysrTDATiXekuGvlIU+SQD2LxL3eTxjIjCyvrO8XZVC61fOm2lhvJdIYhJv9xdwPd1pKRxfd151zEKeYETnp5YxmRpPJ0OADBJfu0Raa3cB0ETg7VRs6KP0TOfzKvbKSR9Mojmx0W+SQW5d047i0dmas8Pc8I9UPbMgQ2Bg57S0XuzQ5krtGSFufyBAf69otF7qcHgp7rOsBC/AErODzM/ngY2Gw2m81ms9lsNpvNZrPZbDabzSauP6UMJdVYd1vZAAAAAElFTkSuQmCC\"],\"spinner_76_outer_holo\":[null,null,null,\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOQAAADkCAMAAAC/iXi/AAAAsVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+3mHKcAAAAO3RSTlMABgoSH/3yGiQO7CkW9vouMkDkRTfJzjvf0+jESqBcV2Hbt66ldlLXv06yZWmBqZtxu49tl5OLfXqFiHO5Lf0AAAtLSURBVHja7NxrU9NAFMbxZzeRNk1qYmxLWyxQLhYsooKI+v0/mHshOXu8dDTNZXHyO4X3/zmbDcMwoNfr9Xq9Xq/X6/V6vV6v1+v1er2eH7bb7WmWZSn+Zy8KL6cXj8eZxPMnNJhxI6n05fzT4ys8X8KCsIXit5HGwbvLCZ4fYVCjQIEl6nmyPN8GeEaEFAqvLEOdRP1FxuPxu9Nn0imkIhgq/M0mqVFnjlaH8J2QmmCVsIOdmxzrz9hY3Hh945pEW+k2FscVPNImUqbZpbH8NoCnTCJtkkDs3iRVlg4eQniIEqmSNqnnj5ukNVLkwejOu20KGUleyTa5+3alTGpUn+VXr55NlagaI75IsnuTFFk0HujRZq/hDRkp1PhLJuzs2iQVUqW28uTMikj5tfLXh3LHJsdm3MhCfi/Qvaiw48BCwCGyLJtst9/PZ/znHdZImdMMHROBE0mZbiV2iK8/3uZ079BZpcbRwfIGnZJB4FTyREmFu4XHF8sxXyQzGt0G6IyIqJGfV9uIv3f4PWfXThloZzFBR2Sg8UyKxL96czHii3RCR6OP6ET0lEiVdF4FqohOP9kfBHif/X4RoX2BZit/PrCobnLOd2hDjaME7aJGXikV7Ce7OKBd6sCychaiVcJJ5JXYX/yhSKQDa2xStIEaEzeTEuuRHbG7tTQ/RGtEQonu3SNQm22uEmmPhfwaLZGJolfJlylRp+Dzbza5XC5P0AqZGAHvjARqNpkVbdQ4Wuav0QKRWO5jGQUS9ZMf2Fld2plnaBg18kyBRpzmJo8qtXWMJlEjP7ARmhJP2Vm1lbMEzUpcgSXRHPmZ7dE6CtCkYMArE2psymW5R8o8k6gfNSoJhVJjg06Xdo8kz+/QGDnQElYp0LjrXBdSZq4qj9EQoQopkxobdzhfsj2qysZeJEkZqccQaEW6Lgvt5Pk0QhOCAaHGdmRzp9J6QAOk22hXKdCa13l5UovMt6jfYBD+VCnRohO2R22ToG5ByCupsSX3epH209SBlWFoKqkzQsu+qT7uFeo1CEP9oW0GaN1t7piruRKoUxQqJrQ4rGhfMOWN8/kNaiRCzWbaUIEOxPMy0TTmmxD1SUKrXKVEJ7bOGvVnvqrz1mHosLbu1q7RJBqvarx1DFomupIszCZ1o/Wu5kUSic6cUGJe6yoH4ZA1JujQrXkgyS1qIVXi0O0U6FC4nnOTehY5HKpCqgzQqUuWuF6vUAOhEt3MAbolp07hWn2l2F+iC02nzYzQseOyUY3q/FDHIjXb6cMilatii2q0IfYVDJnQgz93e0tbNL5iX26gGg8WCZytmanEfqIh1/kTqb3VaXOqvN77/cH48Ze2YrpmVtjPMGaRnvyt/03Zt9Ffm2jfayd2O+GHYEOVm816c4J9hLEqLEP9uHa0B6dQfb/APmLFdppMD94f1iEVaosI1UW6UI3i02lVropCW/kG1Q1ixXSazATeuNwwX1CdbnM6vTmtQKp3SKaoTMaMHy9JOq+uFFUFMePRaQUeWePidJ8XCPHqtAKvyj7jDlXFHHwiZ0+FGzNXqEjEcarHx0cSWC2eCq0Q1USp7jOl3j2SwL1KtJ3Ga1STpJYJ9eyRBCYL5h7VhKrPjObZIwlIHvmAamxdUerRz3TWGYs8QzUp49m9A3xZMAJVSB7p2b0D3BR5MzPDipcr48Vvd1xvVBnN4hBVBDzSs8sViItFWieoYsAa/fvPMtHMetrlfdU3SKbH10gcPeVZ7ytGZs749ppUzmeuO1QxzEpp6t9rElixyBWqiDOXd69J4AuLPEcVqe+Rjyzy7P+M/Moir2qI9Ob3yuR+NpvSVIvM/I+kRtVbLfJHe3faoyYUhmH4BUnEQCInYPkwKMSFiOKOtvr/f1jPIr6cVlOLLKcNF07Tr3ce3GYcxiseCkamoxHtY1/c/7lkyvK+5f+UXbJIwQee06ho+fnpqmLkooLIoepL/pAiVxVEKviy7iZFbqEMS4pU8AV6JkXuoAxTilTwrdZ2NPq6H9SlgkgFr2d5GOWV7PYdyjA8xr8fngpXcZIMvqiR+KK5JyjDpoV4+Op9j4f3iRsVQxk9PuSDIh/hQe4Xop0+lKH7EuWeKKMviQGl+BLlnkM2cqQGpThSZOsXVvvVXGqcQTmWX0BUu7asvvxafqEblGNgIFHvkcehZUt+cGsop8f6RCGhFHvkiZbMo9SFcnTWyAN5qmIv7C5LXsf/pfpQkvcIpBS7U2pT2scTeekKyrKwkFHqTuktEd3yCmX1iUSpt5T7pSSEsgZEotQbka0caUFpPilwiUI/bDYPh8MSraA8q5Co1vm6PlDY+R3Ks/NC1ui6Cj2+zlkhPe6hLpSn5YHEpYirzOPr8MCJUHobwAccwohCSpnXA4sDopVH+ESfEB6YU+R7IINpIZFK4BMaYYlIkdev4ZRVogF8xHElavyxHW0+pbDxBp+x3YLAdZX44ZbLG7GTwIeI1Bgo8SySsUjMnGnwIbOYSCkwJZneHURnCp/SRSE72C1Q4F6ZTRHL7MPHHD6iSFRiSne6mhZt4HMDFxOZtp8r9fFqKmVaUAGPJyILWhWtqCk7hBtUoScakQ4t6s9oIsvM5xxCJbygIAkSD1p0XTGik7lANWwsZEeSGNAaVzSKTLalBxXx80T6xQQatKQ3X0mV0yNAxVMmOR9aspnNZlKmB5Xx8jM1Z0IrEtY4W6HvUB0dd2TiJBlAC4ztjMExZ32okCklxnHcxksCPROFOGYIlSJSI+VD437MEM/MNKiULTUyQ2jYZCbgmA5UzLkXIgsalWy329l2VrCAqumBGDIXxqEBDfJZ4rY45rYHlTOKQ4b0FoZ9aIwz34olsZNADbwkRiET96Ah5ngrYOUe6qC5uCMNbLLSyNiQ0pY7HWrRS7AxZ0MDrPF8zitxzK0FNTF5olxpQO082oiV4uEngNo4YsncJJxMJibUjNwb54UlU6gR4Y1YyTKHUKt4/rDN3TSokR6EYZwXsoPxoT7amu8ob3keQK0GSWHHXH3vSfq38Xg8L3QymQ01s2O8P94zo9rumP5uzMhbjg2oXR/P1lwURUQDVN2pKhqlLccWNMDARLFjxMQ2VMy8jh9wyrkDjTCxETOrHlOPdrvdeHefErck0BBDVGKhMLGgMuS4Y5ECJo59aIzNE+XKdbReJz2ohPGDFvIh5c7dEBrUi7EQGylSQaYdZdnuTrpbZiY0apDgkML6zrU/XDHKmMeUuOSxDw3Tg2dDpus0TQP7g8T0LBqz36a89qBxmssqBRwy5WJLgxJ0b38+i8i8Ebdc6NCGIS6JQwqn1DXgL1mTy5nL5EwhgZbY4fMhT9ya2PA2I9kcj0eeiOcrTnk0oTWaizvikKd75X6fBtbgnasbTVghj5Qr8y33A2jT8MmQeaOQBo7Zgxdsy598v1Ci8enputsF0DI7jqIXQzKL/YKLYuI4+V9xsul/PC+YnG4ULeSRLzOvKnyWeBitXwwpMoUfzHdmw12ZR+TxwhOfnK9ZoMYnM3X3yZB7VolTvo7EKeUlxZQnZT5HDEYoDcnJOy54IycaNxiJjTilaLwq8yliRnNeRGImRgrPlpSnPCdqnKlIJ0/OVjxZMXLzZEnm1ynPE3XOVDQgT0/X95Y8/jKlmomM7q/xsVVekpOXlCrlJS+xqomMNpwUh1zIlfKSL6fcEOV+3f9X/SCliY8p31/yLlLhuf/P9GH8a+O7S6bqXbPhNd1JTrxRvk/KjRgprFX6jbf3aCaJ3llSVC4SS7UnxXfpph+mIvP1kj/WrmpX5i7BtvwkerLkJg1dp/+vDvj6T687juN5Dn/Tpdw1nDudTqfT6XQ6nU6n0+l0Op1Op9Mp+AmSZeem89KYswAAAABJRU5ErkJggg==\"]};var imageCache={actionbar_ic_back_white:null,btn_check_off_disabled_focused_holo_light:null,btn_check_off_disabled_holo_light:null,btn_check_off_focused_holo_light:null,btn_check_off_holo_light:null,btn_check_off_pressed_holo_light:null,btn_check_on_disabled_focused_holo_light:null,btn_check_on_disabled_holo_light:null,btn_check_on_focused_holo_light:null,btn_check_on_holo_light:null,btn_check_on_pressed_holo_light:null,btn_default_disabled_focused_holo_light:null,btn_default_disabled_holo_light:null,btn_default_focused_holo_light:null,btn_default_normal_holo_light:null,btn_default_pressed_holo_light:null,btn_radio_off_disabled_focused_holo_light:null,btn_radio_off_disabled_holo_light:null,btn_radio_off_focused_holo_light:null,btn_radio_off_holo_light:null,btn_radio_off_pressed_holo_light:null,btn_radio_on_disabled_focused_holo_light:null,btn_radio_on_disabled_holo_light:null,btn_radio_on_focused_holo_light:null,btn_radio_on_holo_light:null,btn_radio_on_pressed_holo_light:null,btn_rating_star_off_normal_holo_light:null,btn_rating_star_off_pressed_holo_light:null,btn_rating_star_on_normal_holo_light:null,btn_rating_star_on_pressed_holo_light:null,dropdown_background_dark:null,editbox_background_focus_yellow:null,editbox_background_normal:null,ic_menu_moreoverflow_normal_holo_dark:null,menu_panel_holo_dark:null,menu_panel_holo_light:null,popup_bottom_bright:null,popup_center_bright:null,popup_full_bright:null,popup_top_bright:null,progressbar_indeterminate_holo1:null,progressbar_indeterminate_holo2:null,progressbar_indeterminate_holo3:null,progressbar_indeterminate_holo4:null,progressbar_indeterminate_holo5:null,progressbar_indeterminate_holo6:null,progressbar_indeterminate_holo7:null,progressbar_indeterminate_holo8:null,rate_star_big_half_holo_light:null,rate_star_big_off_holo_light:null,rate_star_big_on_holo_light:null,scrubber_control_disabled_holo:null,scrubber_control_focused_holo:null,scrubber_control_normal_holo:null,scrubber_control_pressed_holo:null,spinner_76_inner_holo:null,spinner_76_outer_holo:null};function findRatioImage(array){if(array[window.devicePixelRatio])return new NetImage(array[window.devicePixelRatio],window.devicePixelRatio);for(var i=array.length;i>=0;i--){if(array[i]){return new NetImage(array[i],i);}}throw Error('Not find radio image. May something error in build.');}var image_base64=function(){function image_base64(){_classCallCheck(this,image_base64);}_createClass(image_base64,null,[{key:'actionbar_ic_back_white',get:function get(){return imageCache.actionbar_ic_back_white||(imageCache.actionbar_ic_back_white=findRatioImage(data.actionbar_ic_back_white));}},{key:'btn_check_off_disabled_focused_holo_light',get:function get(){return imageCache.btn_check_off_disabled_focused_holo_light||(imageCache.btn_check_off_disabled_focused_holo_light=findRatioImage(data.btn_check_off_disabled_focused_holo_light));}},{key:'btn_check_off_disabled_holo_light',get:function get(){return imageCache.btn_check_off_disabled_holo_light||(imageCache.btn_check_off_disabled_holo_light=findRatioImage(data.btn_check_off_disabled_holo_light));}},{key:'btn_check_off_focused_holo_light',get:function get(){return imageCache.btn_check_off_focused_holo_light||(imageCache.btn_check_off_focused_holo_light=findRatioImage(data.btn_check_off_focused_holo_light));}},{key:'btn_check_off_holo_light',get:function get(){return imageCache.btn_check_off_holo_light||(imageCache.btn_check_off_holo_light=findRatioImage(data.btn_check_off_holo_light));}},{key:'btn_check_off_pressed_holo_light',get:function get(){return imageCache.btn_check_off_pressed_holo_light||(imageCache.btn_check_off_pressed_holo_light=findRatioImage(data.btn_check_off_pressed_holo_light));}},{key:'btn_check_on_disabled_focused_holo_light',get:function get(){return imageCache.btn_check_on_disabled_focused_holo_light||(imageCache.btn_check_on_disabled_focused_holo_light=findRatioImage(data.btn_check_on_disabled_focused_holo_light));}},{key:'btn_check_on_disabled_holo_light',get:function get(){return imageCache.btn_check_on_disabled_holo_light||(imageCache.btn_check_on_disabled_holo_light=findRatioImage(data.btn_check_on_disabled_holo_light));}},{key:'btn_check_on_focused_holo_light',get:function get(){return imageCache.btn_check_on_focused_holo_light||(imageCache.btn_check_on_focused_holo_light=findRatioImage(data.btn_check_on_focused_holo_light));}},{key:'btn_check_on_holo_light',get:function get(){return imageCache.btn_check_on_holo_light||(imageCache.btn_check_on_holo_light=findRatioImage(data.btn_check_on_holo_light));}},{key:'btn_check_on_pressed_holo_light',get:function get(){return imageCache.btn_check_on_pressed_holo_light||(imageCache.btn_check_on_pressed_holo_light=findRatioImage(data.btn_check_on_pressed_holo_light));}},{key:'btn_default_disabled_focused_holo_light',get:function get(){return imageCache.btn_default_disabled_focused_holo_light||(imageCache.btn_default_disabled_focused_holo_light=findRatioImage(data.btn_default_disabled_focused_holo_light));}},{key:'btn_default_disabled_holo_light',get:function get(){return imageCache.btn_default_disabled_holo_light||(imageCache.btn_default_disabled_holo_light=findRatioImage(data.btn_default_disabled_holo_light));}},{key:'btn_default_focused_holo_light',get:function get(){return imageCache.btn_default_focused_holo_light||(imageCache.btn_default_focused_holo_light=findRatioImage(data.btn_default_focused_holo_light));}},{key:'btn_default_normal_holo_light',get:function get(){return imageCache.btn_default_normal_holo_light||(imageCache.btn_default_normal_holo_light=findRatioImage(data.btn_default_normal_holo_light));}},{key:'btn_default_pressed_holo_light',get:function get(){return imageCache.btn_default_pressed_holo_light||(imageCache.btn_default_pressed_holo_light=findRatioImage(data.btn_default_pressed_holo_light));}},{key:'btn_radio_off_disabled_focused_holo_light',get:function get(){return imageCache.btn_radio_off_disabled_focused_holo_light||(imageCache.btn_radio_off_disabled_focused_holo_light=findRatioImage(data.btn_radio_off_disabled_focused_holo_light));}},{key:'btn_radio_off_disabled_holo_light',get:function get(){return imageCache.btn_radio_off_disabled_holo_light||(imageCache.btn_radio_off_disabled_holo_light=findRatioImage(data.btn_radio_off_disabled_holo_light));}},{key:'btn_radio_off_focused_holo_light',get:function get(){return imageCache.btn_radio_off_focused_holo_light||(imageCache.btn_radio_off_focused_holo_light=findRatioImage(data.btn_radio_off_focused_holo_light));}},{key:'btn_radio_off_holo_light',get:function get(){return imageCache.btn_radio_off_holo_light||(imageCache.btn_radio_off_holo_light=findRatioImage(data.btn_radio_off_holo_light));}},{key:'btn_radio_off_pressed_holo_light',get:function get(){return imageCache.btn_radio_off_pressed_holo_light||(imageCache.btn_radio_off_pressed_holo_light=findRatioImage(data.btn_radio_off_pressed_holo_light));}},{key:'btn_radio_on_disabled_focused_holo_light',get:function get(){return imageCache.btn_radio_on_disabled_focused_holo_light||(imageCache.btn_radio_on_disabled_focused_holo_light=findRatioImage(data.btn_radio_on_disabled_focused_holo_light));}},{key:'btn_radio_on_disabled_holo_light',get:function get(){return imageCache.btn_radio_on_disabled_holo_light||(imageCache.btn_radio_on_disabled_holo_light=findRatioImage(data.btn_radio_on_disabled_holo_light));}},{key:'btn_radio_on_focused_holo_light',get:function get(){return imageCache.btn_radio_on_focused_holo_light||(imageCache.btn_radio_on_focused_holo_light=findRatioImage(data.btn_radio_on_focused_holo_light));}},{key:'btn_radio_on_holo_light',get:function get(){return imageCache.btn_radio_on_holo_light||(imageCache.btn_radio_on_holo_light=findRatioImage(data.btn_radio_on_holo_light));}},{key:'btn_radio_on_pressed_holo_light',get:function get(){return imageCache.btn_radio_on_pressed_holo_light||(imageCache.btn_radio_on_pressed_holo_light=findRatioImage(data.btn_radio_on_pressed_holo_light));}},{key:'btn_rating_star_off_normal_holo_light',get:function get(){return imageCache.btn_rating_star_off_normal_holo_light||(imageCache.btn_rating_star_off_normal_holo_light=findRatioImage(data.btn_rating_star_off_normal_holo_light));}},{key:'btn_rating_star_off_pressed_holo_light',get:function get(){return imageCache.btn_rating_star_off_pressed_holo_light||(imageCache.btn_rating_star_off_pressed_holo_light=findRatioImage(data.btn_rating_star_off_pressed_holo_light));}},{key:'btn_rating_star_on_normal_holo_light',get:function get(){return imageCache.btn_rating_star_on_normal_holo_light||(imageCache.btn_rating_star_on_normal_holo_light=findRatioImage(data.btn_rating_star_on_normal_holo_light));}},{key:'btn_rating_star_on_pressed_holo_light',get:function get(){return imageCache.btn_rating_star_on_pressed_holo_light||(imageCache.btn_rating_star_on_pressed_holo_light=findRatioImage(data.btn_rating_star_on_pressed_holo_light));}},{key:'dropdown_background_dark',get:function get(){return imageCache.dropdown_background_dark||(imageCache.dropdown_background_dark=findRatioImage(data.dropdown_background_dark));}},{key:'editbox_background_focus_yellow',get:function get(){return imageCache.editbox_background_focus_yellow||(imageCache.editbox_background_focus_yellow=findRatioImage(data.editbox_background_focus_yellow));}},{key:'editbox_background_normal',get:function get(){return imageCache.editbox_background_normal||(imageCache.editbox_background_normal=findRatioImage(data.editbox_background_normal));}},{key:'ic_menu_moreoverflow_normal_holo_dark',get:function get(){return imageCache.ic_menu_moreoverflow_normal_holo_dark||(imageCache.ic_menu_moreoverflow_normal_holo_dark=findRatioImage(data.ic_menu_moreoverflow_normal_holo_dark));}},{key:'menu_panel_holo_dark',get:function get(){return imageCache.menu_panel_holo_dark||(imageCache.menu_panel_holo_dark=findRatioImage(data.menu_panel_holo_dark));}},{key:'menu_panel_holo_light',get:function get(){return imageCache.menu_panel_holo_light||(imageCache.menu_panel_holo_light=findRatioImage(data.menu_panel_holo_light));}},{key:'popup_bottom_bright',get:function get(){return imageCache.popup_bottom_bright||(imageCache.popup_bottom_bright=findRatioImage(data.popup_bottom_bright));}},{key:'popup_center_bright',get:function get(){return imageCache.popup_center_bright||(imageCache.popup_center_bright=findRatioImage(data.popup_center_bright));}},{key:'popup_full_bright',get:function get(){return imageCache.popup_full_bright||(imageCache.popup_full_bright=findRatioImage(data.popup_full_bright));}},{key:'popup_top_bright',get:function get(){return imageCache.popup_top_bright||(imageCache.popup_top_bright=findRatioImage(data.popup_top_bright));}},{key:'progressbar_indeterminate_holo1',get:function get(){return imageCache.progressbar_indeterminate_holo1||(imageCache.progressbar_indeterminate_holo1=findRatioImage(data.progressbar_indeterminate_holo1));}},{key:'progressbar_indeterminate_holo2',get:function get(){return imageCache.progressbar_indeterminate_holo2||(imageCache.progressbar_indeterminate_holo2=findRatioImage(data.progressbar_indeterminate_holo2));}},{key:'progressbar_indeterminate_holo3',get:function get(){return imageCache.progressbar_indeterminate_holo3||(imageCache.progressbar_indeterminate_holo3=findRatioImage(data.progressbar_indeterminate_holo3));}},{key:'progressbar_indeterminate_holo4',get:function get(){return imageCache.progressbar_indeterminate_holo4||(imageCache.progressbar_indeterminate_holo4=findRatioImage(data.progressbar_indeterminate_holo4));}},{key:'progressbar_indeterminate_holo5',get:function get(){return imageCache.progressbar_indeterminate_holo5||(imageCache.progressbar_indeterminate_holo5=findRatioImage(data.progressbar_indeterminate_holo5));}},{key:'progressbar_indeterminate_holo6',get:function get(){return imageCache.progressbar_indeterminate_holo6||(imageCache.progressbar_indeterminate_holo6=findRatioImage(data.progressbar_indeterminate_holo6));}},{key:'progressbar_indeterminate_holo7',get:function get(){return imageCache.progressbar_indeterminate_holo7||(imageCache.progressbar_indeterminate_holo7=findRatioImage(data.progressbar_indeterminate_holo7));}},{key:'progressbar_indeterminate_holo8',get:function get(){return imageCache.progressbar_indeterminate_holo8||(imageCache.progressbar_indeterminate_holo8=findRatioImage(data.progressbar_indeterminate_holo8));}},{key:'rate_star_big_half_holo_light',get:function get(){return imageCache.rate_star_big_half_holo_light||(imageCache.rate_star_big_half_holo_light=findRatioImage(data.rate_star_big_half_holo_light));}},{key:'rate_star_big_off_holo_light',get:function get(){return imageCache.rate_star_big_off_holo_light||(imageCache.rate_star_big_off_holo_light=findRatioImage(data.rate_star_big_off_holo_light));}},{key:'rate_star_big_on_holo_light',get:function get(){return imageCache.rate_star_big_on_holo_light||(imageCache.rate_star_big_on_holo_light=findRatioImage(data.rate_star_big_on_holo_light));}},{key:'scrubber_control_disabled_holo',get:function get(){return imageCache.scrubber_control_disabled_holo||(imageCache.scrubber_control_disabled_holo=findRatioImage(data.scrubber_control_disabled_holo));}},{key:'scrubber_control_focused_holo',get:function get(){return imageCache.scrubber_control_focused_holo||(imageCache.scrubber_control_focused_holo=findRatioImage(data.scrubber_control_focused_holo));}},{key:'scrubber_control_normal_holo',get:function get(){return imageCache.scrubber_control_normal_holo||(imageCache.scrubber_control_normal_holo=findRatioImage(data.scrubber_control_normal_holo));}},{key:'scrubber_control_pressed_holo',get:function get(){return imageCache.scrubber_control_pressed_holo||(imageCache.scrubber_control_pressed_holo=findRatioImage(data.scrubber_control_pressed_holo));}},{key:'spinner_76_inner_holo',get:function get(){return imageCache.spinner_76_inner_holo||(imageCache.spinner_76_inner_holo=findRatioImage(data.spinner_76_inner_holo));}},{key:'spinner_76_outer_holo',get:function get(){return imageCache.spinner_76_outer_holo||(imageCache.spinner_76_outer_holo=findRatioImage(data.spinner_76_outer_holo));}}]);return image_base64;}();R.image_base64=image_base64;})(R=android.R||(android.R={}));})(android||(android={}));var android;(function(android){var R;(function(R){var NetDrawable=androidui.image.NetDrawable;var ChangeImageSizeDrawable=androidui.image.ChangeImageSizeDrawable;var NinePatchDrawable=androidui.image.NinePatchDrawable;var density=android.content.res.Resources.getDisplayMetrics().density;var image=function(){function image(){_classCallCheck(this,image);}_createClass(image,null,[{key:'actionbar_ic_back_white',get:function get(){return new NetDrawable(R.image_base64.actionbar_ic_back_white);}},{key:'btn_check_off_disabled_focused_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_check_off_disabled_focused_holo_light);}},{key:'btn_check_off_disabled_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_check_off_disabled_holo_light);}},{key:'btn_check_off_focused_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_check_off_focused_holo_light);}},{key:'btn_check_off_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_check_off_holo_light);}},{key:'btn_check_off_pressed_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_check_off_pressed_holo_light);}},{key:'btn_check_on_disabled_focused_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_check_on_disabled_focused_holo_light);}},{key:'btn_check_on_disabled_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_check_on_disabled_holo_light);}},{key:'btn_check_on_focused_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_check_on_focused_holo_light);}},{key:'btn_check_on_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_check_on_holo_light);}},{key:'btn_check_on_pressed_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_check_on_pressed_holo_light);}},{key:'btn_default_disabled_focused_holo_light',get:function get(){return new NinePatchDrawable(R.image_base64.btn_default_disabled_focused_holo_light);}},{key:'btn_default_disabled_holo_light',get:function get(){return new NinePatchDrawable(R.image_base64.btn_default_disabled_holo_light);}},{key:'btn_default_focused_holo_light',get:function get(){return new NinePatchDrawable(R.image_base64.btn_default_focused_holo_light);}},{key:'btn_default_normal_holo_light',get:function get(){return new NinePatchDrawable(R.image_base64.btn_default_normal_holo_light);}},{key:'btn_default_pressed_holo_light',get:function get(){return new NinePatchDrawable(R.image_base64.btn_default_pressed_holo_light);}},{key:'btn_radio_off_disabled_focused_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_radio_off_disabled_focused_holo_light);}},{key:'btn_radio_off_disabled_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_radio_off_disabled_holo_light);}},{key:'btn_radio_off_focused_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_radio_off_focused_holo_light);}},{key:'btn_radio_off_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_radio_off_holo_light);}},{key:'btn_radio_off_pressed_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_radio_off_pressed_holo_light);}},{key:'btn_radio_on_disabled_focused_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_radio_on_disabled_focused_holo_light);}},{key:'btn_radio_on_disabled_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_radio_on_disabled_holo_light);}},{key:'btn_radio_on_focused_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_radio_on_focused_holo_light);}},{key:'btn_radio_on_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_radio_on_holo_light);}},{key:'btn_radio_on_pressed_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_radio_on_pressed_holo_light);}},{key:'btn_rating_star_off_normal_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_rating_star_off_normal_holo_light);}},{key:'btn_rating_star_off_pressed_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_rating_star_off_pressed_holo_light);}},{key:'btn_rating_star_on_normal_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_rating_star_on_normal_holo_light);}},{key:'btn_rating_star_on_pressed_holo_light',get:function get(){return new NetDrawable(R.image_base64.btn_rating_star_on_pressed_holo_light);}},{key:'dropdown_background_dark',get:function get(){return new NinePatchDrawable(R.image_base64.dropdown_background_dark);}},{key:'editbox_background_focus_yellow',get:function get(){return new NinePatchDrawable(R.image_base64.editbox_background_focus_yellow);}},{key:'editbox_background_normal',get:function get(){return new NinePatchDrawable(R.image_base64.editbox_background_normal);}},{key:'ic_menu_moreoverflow_normal_holo_dark',get:function get(){return new NetDrawable(R.image_base64.ic_menu_moreoverflow_normal_holo_dark);}},{key:'menu_panel_holo_dark',get:function get(){return new NinePatchDrawable(R.image_base64.menu_panel_holo_dark);}},{key:'menu_panel_holo_light',get:function get(){return new NinePatchDrawable(R.image_base64.menu_panel_holo_light);}},{key:'popup_bottom_bright',get:function get(){return new NinePatchDrawable(R.image_base64.popup_bottom_bright);}},{key:'popup_center_bright',get:function get(){return new NinePatchDrawable(R.image_base64.popup_center_bright);}},{key:'popup_full_bright',get:function get(){return new NinePatchDrawable(R.image_base64.popup_full_bright);}},{key:'popup_top_bright',get:function get(){return new NinePatchDrawable(R.image_base64.popup_top_bright);}},{key:'progressbar_indeterminate_holo1',get:function get(){return new NetDrawable(R.image_base64.progressbar_indeterminate_holo1);}},{key:'progressbar_indeterminate_holo2',get:function get(){return new NetDrawable(R.image_base64.progressbar_indeterminate_holo2);}},{key:'progressbar_indeterminate_holo3',get:function get(){return new NetDrawable(R.image_base64.progressbar_indeterminate_holo3);}},{key:'progressbar_indeterminate_holo4',get:function get(){return new NetDrawable(R.image_base64.progressbar_indeterminate_holo4);}},{key:'progressbar_indeterminate_holo5',get:function get(){return new NetDrawable(R.image_base64.progressbar_indeterminate_holo5);}},{key:'progressbar_indeterminate_holo6',get:function get(){return new NetDrawable(R.image_base64.progressbar_indeterminate_holo6);}},{key:'progressbar_indeterminate_holo7',get:function get(){return new NetDrawable(R.image_base64.progressbar_indeterminate_holo7);}},{key:'progressbar_indeterminate_holo8',get:function get(){return new NetDrawable(R.image_base64.progressbar_indeterminate_holo8);}},{key:'rate_star_big_half_holo_light',get:function get(){return new NetDrawable(R.image_base64.rate_star_big_half_holo_light);}},{key:'rate_star_big_off_holo_light',get:function get(){return new NetDrawable(R.image_base64.rate_star_big_off_holo_light);}},{key:'rate_star_big_on_holo_light',get:function get(){return new NetDrawable(R.image_base64.rate_star_big_on_holo_light);}},{key:'scrubber_control_disabled_holo',get:function get(){return new NetDrawable(R.image_base64.scrubber_control_disabled_holo);}},{key:'scrubber_control_focused_holo',get:function get(){return new NetDrawable(R.image_base64.scrubber_control_focused_holo);}},{key:'scrubber_control_normal_holo',get:function get(){return new NetDrawable(R.image_base64.scrubber_control_normal_holo);}},{key:'scrubber_control_pressed_holo',get:function get(){return new NetDrawable(R.image_base64.scrubber_control_pressed_holo);}},{key:'spinner_76_inner_holo',get:function get(){return new NetDrawable(R.image_base64.spinner_76_inner_holo);}},{key:'spinner_76_outer_holo',get:function get(){return new NetDrawable(R.image_base64.spinner_76_outer_holo);}},{key:'spinner_48_outer_holo',get:function get(){return new ChangeImageSizeDrawable(image.spinner_76_outer_holo,48*density,48*density);}},{key:'spinner_48_inner_holo',get:function get(){return new ChangeImageSizeDrawable(image.spinner_76_inner_holo,48*density,48*density);}},{key:'spinner_16_outer_holo',get:function get(){return new ChangeImageSizeDrawable(image.spinner_76_outer_holo,16*density,16*density);}},{key:'spinner_16_inner_holo',get:function get(){return new ChangeImageSizeDrawable(image.spinner_76_inner_holo,16*density,16*density);}},{key:'rate_star_small_off_holo_light',get:function get(){return new ChangeImageSizeDrawable(image.rate_star_big_half_holo_light,16*density,16*density);}},{key:'rate_star_small_half_holo_light',get:function get(){return new ChangeImageSizeDrawable(image.rate_star_big_off_holo_light,16*density,16*density);}},{key:'rate_star_small_on_holo_light',get:function get(){return new ChangeImageSizeDrawable(image.rate_star_big_on_holo_light,16*density,16*density);}}]);return image;}();R.image=image;R.image_base64.actionbar_ic_back_white;R.image_base64.btn_default_normal_holo_light;R.image_base64.dropdown_background_dark;R.image_base64.editbox_background_normal;R.image_base64.ic_menu_moreoverflow_normal_holo_dark;R.image_base64.menu_panel_holo_dark;R.image_base64.menu_panel_holo_light;R.image_base64.popup_bottom_bright;R.image_base64.popup_center_bright;R.image_base64.popup_full_bright;R.image_base64.popup_top_bright;})(R=android.R||(android.R={}));})(android||(android={}));var android;(function(android){var R;(function(R){var ColorStateList=android.content.res.ColorStateList;var Color=android.graphics.Color;var color=function(){function color(){_classCallCheck(this,color);}_createClass(color,null,[{key:'textView_textColor',get:function get(){var _defaultStates=[[-android.view.View.VIEW_STATE_ENABLED],[]];var _defaultColors=[0xffc0c0c0,0xff333333];var DefaultStyleTextColor=function(_ColorStateList){_inherits(DefaultStyleTextColor,_ColorStateList);function DefaultStyleTextColor(){_classCallCheck(this,DefaultStyleTextColor);return _possibleConstructorReturn(this,(DefaultStyleTextColor.__proto__||Object.getPrototypeOf(DefaultStyleTextColor)).call(this,_defaultStates,_defaultColors));}return DefaultStyleTextColor;}(ColorStateList);return new DefaultStyleTextColor();}},{key:'primary_text_light_disable_only',get:function get(){var _defaultStates=[[-android.view.View.VIEW_STATE_ENABLED],[]];var _defaultColors=[0x80000000,0xff000000];var DefaultStyleTextColor=function(_ColorStateList2){_inherits(DefaultStyleTextColor,_ColorStateList2);function DefaultStyleTextColor(){_classCallCheck(this,DefaultStyleTextColor);return _possibleConstructorReturn(this,(DefaultStyleTextColor.__proto__||Object.getPrototypeOf(DefaultStyleTextColor)).call(this,_defaultStates,_defaultColors));}return DefaultStyleTextColor;}(ColorStateList);return new DefaultStyleTextColor();}},{key:'primary_text_dark_disable_only',get:function get(){var _defaultStates=[[-android.view.View.VIEW_STATE_ENABLED],[]];var _defaultColors=[0x80000000,0xffffffff];var DefaultStyleTextColor=function(_ColorStateList3){_inherits(DefaultStyleTextColor,_ColorStateList3);function DefaultStyleTextColor(){_classCallCheck(this,DefaultStyleTextColor);return _possibleConstructorReturn(this,(DefaultStyleTextColor.__proto__||Object.getPrototypeOf(DefaultStyleTextColor)).call(this,_defaultStates,_defaultColors));}return DefaultStyleTextColor;}(ColorStateList);return new DefaultStyleTextColor();}}]);return color;}();color.white=Color.WHITE;color.black=Color.BLACK;color.transparent=Color.TRANSPARENT;R.color=color;})(R=android.R||(android.R={}));})(android||(android={}));var goog;(function(goog){var math;(function(math){var Long=function(){function Long(low,high){_classCallCheck(this,Long);this.low_=low|0;this.high_=high|0;}_createClass(Long,[{key:'toInt',value:function toInt(){return this.low_;}},{key:'toNumber',value:function toNumber(){return this.high_*Long.TWO_PWR_32_DBL_+this.getLowBitsUnsigned();}},{key:'toString',value:function toString(opt_radix){var radix=opt_radix||10;if(radix<2||36<radix){throw Error('radix out of range: '+radix);}if(this.isZero()){return'0';}if(this.isNegative()){if(this.equals(Long.MIN_VALUE)){var radixLong=Long.fromNumber(radix);var div=this.div(radixLong);var _rem=div.multiply(radixLong).subtract(this);return div.toString(radix)+_rem.toInt().toString(radix);}else{return'-'+this.negate().toString(radix);}}var radixToPower=Long.fromNumber(Math.pow(radix,6));var rem=this;var result='';while(true){var remDiv=rem.div(radixToPower);var intval=rem.subtract(remDiv.multiply(radixToPower)).toInt();var digits=intval.toString(radix);rem=remDiv;if(rem.isZero()){return digits+result;}else{while(digits.length<6){digits='0'+digits;}result=''+digits+result;}}}},{key:'getHighBits',value:function getHighBits(){return this.high_;}},{key:'getLowBits',value:function getLowBits(){return this.low_;}},{key:'getLowBitsUnsigned',value:function getLowBitsUnsigned(){return this.low_>=0?this.low_:Long.TWO_PWR_32_DBL_+this.low_;}},{key:'getNumBitsAbs',value:function getNumBitsAbs(){if(this.isNegative()){if(this.equals(Long.MIN_VALUE)){return 64;}else{return this.negate().getNumBitsAbs();}}else{var val=this.high_!=0?this.high_:this.low_;for(var bit=31;bit>0;bit--){if((val&1<<bit)!=0){break;}}return this.high_!=0?bit+33:bit+1;}}},{key:'isZero',value:function isZero(){return this.high_==0&&this.low_==0;}},{key:'isNegative',value:function isNegative(){return this.high_<0;}},{key:'isOdd',value:function isOdd(){return(this.low_&1)==1;}},{key:'equals',value:function equals(other){return this.high_==other.high_&&this.low_==other.low_;}},{key:'notEquals',value:function notEquals(other){return this.high_!=other.high_||this.low_!=other.low_;}},{key:'lessThan',value:function lessThan(other){return this.compare(other)<0;}},{key:'lessThanOrEqual',value:function lessThanOrEqual(other){return this.compare(other)<=0;}},{key:'greaterThan',value:function greaterThan(other){return this.compare(other)>0;}},{key:'greaterThanOrEqual',value:function greaterThanOrEqual(other){return this.compare(other)>=0;}},{key:'compare',value:function compare(other){if(this.equals(other)){return 0;}var thisNeg=this.isNegative();var otherNeg=other.isNegative();if(thisNeg&&!otherNeg){return-1;}if(!thisNeg&&otherNeg){return 1;}if(this.subtract(other).isNegative()){return-1;}else{return 1;}}},{key:'negate',value:function negate(){if(this.equals(Long.MIN_VALUE)){return Long.MIN_VALUE;}else{return this.not().add(Long.ONE);}}},{key:'add',value:function add(other){var a48=this.high_>>>16;var a32=this.high_&0xFFFF;var a16=this.low_>>>16;var a00=this.low_&0xFFFF;var b48=other.high_>>>16;var b32=other.high_&0xFFFF;var b16=other.low_>>>16;var b00=other.low_&0xFFFF;var c48=0,c32=0,c16=0,c00=0;c00+=a00+b00;c16+=c00>>>16;c00&=0xFFFF;c16+=a16+b16;c32+=c16>>>16;c16&=0xFFFF;c32+=a32+b32;c48+=c32>>>16;c32&=0xFFFF;c48+=a48+b48;c48&=0xFFFF;return Long.fromBits(c16<<16|c00,c48<<16|c32);}},{key:'subtract',value:function subtract(other){return this.add(other.negate());}},{key:'multiply',value:function multiply(other){if(this.isZero()){return Long.ZERO;}else if(other.isZero()){return Long.ZERO;}if(this.equals(Long.MIN_VALUE)){return other.isOdd()?Long.MIN_VALUE:Long.ZERO;}else if(other.equals(Long.MIN_VALUE)){return this.isOdd()?Long.MIN_VALUE:Long.ZERO;}if(this.isNegative()){if(other.isNegative()){return this.negate().multiply(other.negate());}else{return this.negate().multiply(other).negate();}}else if(other.isNegative()){return this.multiply(other.negate()).negate();}if(this.lessThan(Long.TWO_PWR_24_)&&other.lessThan(Long.TWO_PWR_24_)){return Long.fromNumber(this.toNumber()*other.toNumber());}var a48=this.high_>>>16;var a32=this.high_&0xFFFF;var a16=this.low_>>>16;var a00=this.low_&0xFFFF;var b48=other.high_>>>16;var b32=other.high_&0xFFFF;var b16=other.low_>>>16;var b00=other.low_&0xFFFF;var c48=0,c32=0,c16=0,c00=0;c00+=a00*b00;c16+=c00>>>16;c00&=0xFFFF;c16+=a16*b00;c32+=c16>>>16;c16&=0xFFFF;c16+=a00*b16;c32+=c16>>>16;c16&=0xFFFF;c32+=a32*b00;c48+=c32>>>16;c32&=0xFFFF;c32+=a16*b16;c48+=c32>>>16;c32&=0xFFFF;c32+=a00*b32;c48+=c32>>>16;c32&=0xFFFF;c48+=a48*b00+a32*b16+a16*b32+a00*b48;c48&=0xFFFF;return Long.fromBits(c16<<16|c00,c48<<16|c32);}},{key:'div',value:function div(other){if(other.isZero()){throw Error('division by zero');}else if(this.isZero()){return Long.ZERO;}if(this.equals(Long.MIN_VALUE)){if(other.equals(Long.ONE)||other.equals(Long.NEG_ONE)){return Long.MIN_VALUE;}else if(other.equals(Long.MIN_VALUE)){return Long.ONE;}else{var halfThis=this.shiftRight(1);var approx=halfThis.div(other).shiftLeft(1);if(approx.equals(Long.ZERO)){return other.isNegative()?Long.ONE:Long.NEG_ONE;}else{var _rem2=this.subtract(other.multiply(approx));var result=approx.add(_rem2.div(other));return result;}}}else if(other.equals(Long.MIN_VALUE)){return Long.ZERO;}if(this.isNegative()){if(other.isNegative()){return this.negate().div(other.negate());}else{return this.negate().div(other).negate();}}else if(other.isNegative()){return this.div(other.negate()).negate();}var res=Long.ZERO;var rem=this;while(rem.greaterThanOrEqual(other)){var _approx=Math.max(1,Math.floor(rem.toNumber()/other.toNumber()));var log2=Math.ceil(Math.log(_approx)/Math.LN2);var delta=log2<=48?1:Math.pow(2,log2-48);var approxRes=Long.fromNumber(_approx);var approxRem=approxRes.multiply(other);while(approxRem.isNegative()||approxRem.greaterThan(rem)){_approx-=delta;approxRes=Long.fromNumber(_approx);approxRem=approxRes.multiply(other);}if(approxRes.isZero()){approxRes=Long.ONE;}res=res.add(approxRes);rem=rem.subtract(approxRem);}return res;}},{key:'modulo',value:function modulo(other){return this.subtract(this.div(other).multiply(other));}},{key:'not',value:function not(){return Long.fromBits(~this.low_,~this.high_);}},{key:'and',value:function and(other){return Long.fromBits(this.low_&other.low_,this.high_&other.high_);}},{key:'or',value:function or(other){return Long.fromBits(this.low_|other.low_,this.high_|other.high_);}},{key:'xor',value:function xor(other){return Long.fromBits(this.low_^other.low_,this.high_^other.high_);}},{key:'shiftLeft',value:function shiftLeft(numBits){numBits&=63;if(numBits==0){return this;}else{var low=this.low_;if(numBits<32){var high=this.high_;return Long.fromBits(low<<numBits,high<<numBits|low>>>32-numBits);}else{return Long.fromBits(0,low<<numBits-32);}}}},{key:'shiftRight',value:function shiftRight(numBits){numBits&=63;if(numBits==0){return this;}else{var high=this.high_;if(numBits<32){var low=this.low_;return Long.fromBits(low>>>numBits|high<<32-numBits,high>>numBits);}else{return Long.fromBits(high>>numBits-32,high>=0?0:-1);}}}},{key:'shiftRightUnsigned',value:function shiftRightUnsigned(numBits){numBits&=63;if(numBits==0){return this;}else{var high=this.high_;if(numBits<32){var low=this.low_;return Long.fromBits(low>>>numBits|high<<32-numBits,high>>>numBits);}else if(numBits==32){return Long.fromBits(high,0);}else{return Long.fromBits(high>>>numBits-32,0);}}}}],[{key:'fromInt',value:function fromInt(value){if(-128<=value&&value<128){var cachedObj=Long.IntCache_[value];if(cachedObj){return cachedObj;}}var obj=new Long(value|0,value<0?-1:0);if(-128<=value&&value<128){Long.IntCache_[value]=obj;}return obj;}},{key:'fromNumber',value:function fromNumber(value){if(isNaN(value)||!isFinite(value)){return Long.ZERO;}else if(value<=-Long.TWO_PWR_63_DBL_){return Long.MIN_VALUE;}else if(value+1>=Long.TWO_PWR_63_DBL_){return Long.MAX_VALUE;}else if(value<0){return Long.fromNumber(-value).negate();}else{return new Long(value%Long.TWO_PWR_32_DBL_|0,value/Long.TWO_PWR_32_DBL_|0);}}},{key:'fromBits',value:function fromBits(lowBits,highBits){return new Long(lowBits,highBits);}},{key:'fromString',value:function fromString(str,opt_radix){if(str.length==0){throw Error('number format error: empty string');}var radix=opt_radix||10;if(radix<2||36<radix){throw Error('radix out of range: '+radix);}if(str.charAt(0)=='-'){return Long.fromString(str.substring(1),radix).negate();}else if(str.indexOf('-')>=0){throw Error('number format error: interior \"-\" character: '+str);}var radixToPower=Long.fromNumber(Math.pow(radix,8));var result=Long.ZERO;for(var i=0;i<str.length;i+=8){var size=Math.min(8,str.length-i);var value=parseInt(str.substring(i,i+size),radix);if(size<8){var power=Long.fromNumber(Math.pow(radix,size));result=result.multiply(power).add(Long.fromNumber(value));}else{result=result.multiply(radixToPower);result=result.add(Long.fromNumber(value));}}return result;}}]);return Long;}();Long.IntCache_={};Long.TWO_PWR_16_DBL_=1<<16;Long.TWO_PWR_24_DBL_=1<<24;Long.TWO_PWR_32_DBL_=Long.TWO_PWR_16_DBL_*Long.TWO_PWR_16_DBL_;Long.TWO_PWR_31_DBL_=Long.TWO_PWR_32_DBL_/2;Long.TWO_PWR_48_DBL_=Long.TWO_PWR_32_DBL_*Long.TWO_PWR_16_DBL_;Long.TWO_PWR_64_DBL_=Long.TWO_PWR_32_DBL_*Long.TWO_PWR_32_DBL_;Long.TWO_PWR_63_DBL_=Long.TWO_PWR_64_DBL_/2;Long.TWO_PWR_24_=Long.fromInt(1<<24);Long.ZERO=Long.fromInt(0);Long.ONE=Long.fromInt(1);Long.NEG_ONE=Long.fromInt(-1);Long.MAX_VALUE=Long.fromBits(0xFFFFFFFF|0,0x7FFFFFFF|0);Long.MIN_VALUE=Long.fromBits(0,0x80000000|0);math.Long=Long;})(math=goog.math||(goog.math={}));})(goog||(goog={}));var java;(function(java){var lang;(function(lang){var Long=function Long(){_classCallCheck(this,Long);};Long.MIN_VALUE=goog.math.Long.MIN_VALUE.toNumber();Long.MAX_VALUE=goog.math.Long.MAX_VALUE.toNumber();lang.Long=Long;})(lang=java.lang||(java.lang={}));})(java||(java={}));var android;(function(android){var view;(function(view){var animation;(function(animation){var AccelerateDecelerateInterpolator=function(){function AccelerateDecelerateInterpolator(){_classCallCheck(this,AccelerateDecelerateInterpolator);}_createClass(AccelerateDecelerateInterpolator,[{key:'getInterpolation',value:function getInterpolation(input){return Math.cos((input+1)*Math.PI)/2+0.5;}}]);return AccelerateDecelerateInterpolator;}();animation.AccelerateDecelerateInterpolator=AccelerateDecelerateInterpolator;})(animation=view.animation||(view.animation={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var animation;(function(animation){var DecelerateInterpolator=function(){function DecelerateInterpolator(){var factor=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;_classCallCheck(this,DecelerateInterpolator);this.mFactor=factor;}_createClass(DecelerateInterpolator,[{key:'getInterpolation',value:function getInterpolation(input){var result=void 0;if(this.mFactor==1.0){result=1.0-(1.0-input)*(1.0-input);}else{result=1.0-Math.pow(1.0-input,2*this.mFactor);}return result;}}]);return DecelerateInterpolator;}();animation.DecelerateInterpolator=DecelerateInterpolator;})(animation=view.animation||(view.animation={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var animation;(function(animation){var Matrix=android.graphics.Matrix;var StringBuilder=java.lang.StringBuilder;var Transformation=function(){function Transformation(){_classCallCheck(this,Transformation);this.mAlpha=0;this.mTransformationType=0;this.clear();}_createClass(Transformation,[{key:'clear',value:function clear(){if(this.mMatrix==null){this.mMatrix=new Matrix();}else{this.mMatrix.reset();}this.mAlpha=1.0;this.mTransformationType=Transformation.TYPE_BOTH;}},{key:'getTransformationType',value:function getTransformationType(){return this.mTransformationType;}},{key:'setTransformationType',value:function setTransformationType(transformationType){this.mTransformationType=transformationType;}},{key:'set',value:function set(t){this.mAlpha=t.getAlpha();this.mMatrix.set(t.getMatrix());this.mTransformationType=t.getTransformationType();}},{key:'compose',value:function compose(t){this.mAlpha*=t.getAlpha();this.mMatrix.preConcat(t.getMatrix());}},{key:'postCompose',value:function postCompose(t){this.mAlpha*=t.getAlpha();this.mMatrix.postConcat(t.getMatrix());}},{key:'getMatrix',value:function getMatrix(){return this.mMatrix;}},{key:'setAlpha',value:function setAlpha(alpha){this.mAlpha=alpha;}},{key:'getAlpha',value:function getAlpha(){return this.mAlpha;}},{key:'toString',value:function toString(){var sb=new StringBuilder(64);sb.append(\"Transformation\");this.toShortString(sb);return sb.toString();}},{key:'toShortString',value:function toShortString(sb){sb=sb||new StringBuilder(64);sb.append(\"{alpha=\");sb.append(this.mAlpha);sb.append(\" matrix=\");this.mMatrix.toShortString(sb);sb.append('}');}}]);return Transformation;}();Transformation.TYPE_IDENTITY=0x0;Transformation.TYPE_ALPHA=0x1;Transformation.TYPE_MATRIX=0x2;Transformation.TYPE_BOTH=Transformation.TYPE_ALPHA|Transformation.TYPE_MATRIX;animation.Transformation=Transformation;})(animation=view.animation||(view.animation={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var animation;(function(animation_1){var RectF=android.graphics.RectF;var TypedValue=android.util.TypedValue;var Long=java.lang.Long;var AccelerateDecelerateInterpolator=android.view.animation.AccelerateDecelerateInterpolator;var AnimationUtils=android.view.animation.AnimationUtils;var Transformation=android.view.animation.Transformation;var Animation=function(){function Animation(){_classCallCheck(this,Animation);this.mEnded=false;this.mStarted=false;this.mCycleFlip=false;this.mInitialized=false;this.mFillBefore=true;this.mFillAfter=false;this.mFillEnabled=false;this.mStartTime=-1;this.mStartOffset=0;this.mDuration=0;this.mRepeatCount=0;this.mRepeated=0;this.mRepeatMode=Animation.RESTART;this.mZAdjustment=0;this.mBackgroundColor=0;this.mScaleFactor=1;this.mDetachWallpaper=false;this.mMore=true;this.mOneMoreTime=true;this.mPreviousRegion=new RectF();this.mRegion=new RectF();this.mTransformation=new Transformation();this.mPreviousTransformation=new Transformation();this.ensureInterpolator();}_createClass(Animation,[{key:'reset',value:function reset(){this.mPreviousRegion.setEmpty();this.mPreviousTransformation.clear();this.mInitialized=false;this.mCycleFlip=false;this.mRepeated=0;this.mMore=true;this.mOneMoreTime=true;this.mListenerHandler=null;}},{key:'cancel',value:function cancel(){if(this.mStarted&&!this.mEnded){this.fireAnimationEnd();this.mEnded=true;}this.mStartTime=Long.MIN_VALUE;this.mMore=this.mOneMoreTime=false;}},{key:'detach',value:function detach(){if(this.mStarted&&!this.mEnded){this.mEnded=true;this.fireAnimationEnd();}}},{key:'isInitialized',value:function isInitialized(){return this.mInitialized;}},{key:'initialize',value:function initialize(width,height,parentWidth,parentHeight){this.reset();this.mInitialized=true;}},{key:'setListenerHandler',value:function setListenerHandler(handler){var _this36=this;if(this.mListenerHandler==null){(function(){var inner_this=_this36;_this36.mOnStart={run:function run(){if(inner_this.mListener!=null){inner_this.mListener.onAnimationStart(inner_this);}}};_this36.mOnRepeat={run:function run(){if(inner_this.mListener!=null){inner_this.mListener.onAnimationRepeat(inner_this);}}};_this36.mOnEnd={run:function run(){if(inner_this.mListener!=null){inner_this.mListener.onAnimationEnd(inner_this);}}};})();}this.mListenerHandler=handler;}},{key:'setInterpolator',value:function setInterpolator(i){this.mInterpolator=i;}},{key:'setStartOffset',value:function setStartOffset(startOffset){this.mStartOffset=startOffset;}},{key:'setDuration',value:function setDuration(durationMillis){if(durationMillis<0){throw Error('new IllegalArgumentException(\"Animation duration cannot be negative\")');}this.mDuration=durationMillis;}},{key:'restrictDuration',value:function restrictDuration(durationMillis){if(this.mStartOffset>durationMillis){this.mStartOffset=durationMillis;this.mDuration=0;this.mRepeatCount=0;return;}var dur=this.mDuration+this.mStartOffset;if(dur>durationMillis){this.mDuration=durationMillis-this.mStartOffset;dur=durationMillis;}if(this.mDuration<=0){this.mDuration=0;this.mRepeatCount=0;return;}if(this.mRepeatCount<0||this.mRepeatCount>durationMillis||dur*this.mRepeatCount>durationMillis){this.mRepeatCount=Math.floor(durationMillis/dur)-1;if(this.mRepeatCount<0){this.mRepeatCount=0;}}}},{key:'scaleCurrentDuration',value:function scaleCurrentDuration(scale){this.mDuration=Math.floor(this.mDuration*scale);this.mStartOffset=Math.floor(this.mStartOffset*scale);}},{key:'setStartTime',value:function setStartTime(startTimeMillis){this.mStartTime=startTimeMillis;this.mStarted=this.mEnded=false;this.mCycleFlip=false;this.mRepeated=0;this.mMore=true;}},{key:'start',value:function start(){this.setStartTime(-1);}},{key:'startNow',value:function startNow(){this.setStartTime(AnimationUtils.currentAnimationTimeMillis());}},{key:'setRepeatMode',value:function setRepeatMode(repeatMode){this.mRepeatMode=repeatMode;}},{key:'setRepeatCount',value:function setRepeatCount(repeatCount){if(repeatCount<0){repeatCount=Animation.INFINITE;}this.mRepeatCount=repeatCount;}},{key:'isFillEnabled',value:function isFillEnabled(){return this.mFillEnabled;}},{key:'setFillEnabled',value:function setFillEnabled(fillEnabled){this.mFillEnabled=fillEnabled;}},{key:'setFillBefore',value:function setFillBefore(fillBefore){this.mFillBefore=fillBefore;}},{key:'setFillAfter',value:function setFillAfter(fillAfter){this.mFillAfter=fillAfter;}},{key:'setZAdjustment',value:function setZAdjustment(zAdjustment){this.mZAdjustment=zAdjustment;}},{key:'setBackgroundColor',value:function setBackgroundColor(bg){this.mBackgroundColor=bg;}},{key:'getScaleFactor',value:function getScaleFactor(){return this.mScaleFactor;}},{key:'setDetachWallpaper',value:function setDetachWallpaper(detachWallpaper){this.mDetachWallpaper=detachWallpaper;}},{key:'getInterpolator',value:function getInterpolator(){return this.mInterpolator;}},{key:'getStartTime',value:function getStartTime(){return this.mStartTime;}},{key:'getDuration',value:function getDuration(){return this.mDuration;}},{key:'getStartOffset',value:function getStartOffset(){return this.mStartOffset;}},{key:'getRepeatMode',value:function getRepeatMode(){return this.mRepeatMode;}},{key:'getRepeatCount',value:function getRepeatCount(){return this.mRepeatCount;}},{key:'getFillBefore',value:function getFillBefore(){return this.mFillBefore;}},{key:'getFillAfter',value:function getFillAfter(){return this.mFillAfter;}},{key:'getZAdjustment',value:function getZAdjustment(){return this.mZAdjustment;}},{key:'getBackgroundColor',value:function getBackgroundColor(){return this.mBackgroundColor;}},{key:'getDetachWallpaper',value:function getDetachWallpaper(){return this.mDetachWallpaper;}},{key:'willChangeTransformationMatrix',value:function willChangeTransformationMatrix(){return true;}},{key:'willChangeBounds',value:function willChangeBounds(){return true;}},{key:'setAnimationListener',value:function setAnimationListener(listener){this.mListener=listener;}},{key:'ensureInterpolator',value:function ensureInterpolator(){if(this.mInterpolator==null){this.mInterpolator=new AccelerateDecelerateInterpolator();}}},{key:'computeDurationHint',value:function computeDurationHint(){return(this.getStartOffset()+this.getDuration())*(this.getRepeatCount()+1);}},{key:'getTransformation',value:function getTransformation(currentTime,outTransformation,scale){if(scale!=null)this.mScaleFactor=scale;if(this.mStartTime==-1){this.mStartTime=currentTime;}var startOffset=this.getStartOffset();var duration=this.mDuration;var normalizedTime=void 0;if(duration!=0){normalizedTime=(currentTime-(this.mStartTime+startOffset))/duration;}else{normalizedTime=currentTime<this.mStartTime?0.0:1.0;}var expired=normalizedTime>=1.0;this.mMore=!expired;if(!this.mFillEnabled)normalizedTime=Math.max(Math.min(normalizedTime,1.0),0.0);if((normalizedTime>=0.0||this.mFillBefore)&&(normalizedTime<=1.0||this.mFillAfter)){if(!this.mStarted){this.fireAnimationStart();this.mStarted=true;}if(this.mFillEnabled)normalizedTime=Math.max(Math.min(normalizedTime,1.0),0.0);if(this.mCycleFlip){normalizedTime=1.0-normalizedTime;}var interpolatedTime=this.mInterpolator.getInterpolation(normalizedTime);this.applyTransformation(interpolatedTime,outTransformation);}if(expired){if(this.mRepeatCount==this.mRepeated){if(!this.mEnded){this.mEnded=true;this.fireAnimationEnd();}}else{if(this.mRepeatCount>0){this.mRepeated++;}if(this.mRepeatMode==Animation.REVERSE){this.mCycleFlip=!this.mCycleFlip;}this.mStartTime=-1;this.mMore=true;this.fireAnimationRepeat();}}if(!this.mMore&&this.mOneMoreTime){this.mOneMoreTime=false;return true;}return this.mMore;}},{key:'fireAnimationStart',value:function fireAnimationStart(){if(this.mListener!=null){if(this.mListenerHandler==null)this.mListener.onAnimationStart(this);else this.mListenerHandler.postAtFrontOfQueue(this.mOnStart);}}},{key:'fireAnimationRepeat',value:function fireAnimationRepeat(){if(this.mListener!=null){if(this.mListenerHandler==null)this.mListener.onAnimationRepeat(this);else this.mListenerHandler.postAtFrontOfQueue(this.mOnRepeat);}}},{key:'fireAnimationEnd',value:function fireAnimationEnd(){if(this.mListener!=null){if(this.mListenerHandler==null)this.mListener.onAnimationEnd(this);else this.mListenerHandler.postAtFrontOfQueue(this.mOnEnd);}}},{key:'hasStarted',value:function hasStarted(){return this.mStarted;}},{key:'hasEnded',value:function hasEnded(){return this.mEnded;}},{key:'applyTransformation',value:function applyTransformation(interpolatedTime,t){}},{key:'resolveSize',value:function resolveSize(type,value,size,parentSize){switch(type){case Animation.ABSOLUTE:return value;case Animation.RELATIVE_TO_SELF:return size*value;case Animation.RELATIVE_TO_PARENT:return parentSize*value;default:return value;}}},{key:'getInvalidateRegion',value:function getInvalidateRegion(left,top,right,bottom,invalidate,transformation){var tempRegion=this.mRegion;var previousRegion=this.mPreviousRegion;invalidate.set(left,top,right,bottom);transformation.getMatrix().mapRect(invalidate);invalidate.inset(-1.0,-1.0);tempRegion.set(invalidate);invalidate.union(previousRegion);previousRegion.set(tempRegion);var tempTransformation=this.mTransformation;var previousTransformation=this.mPreviousTransformation;tempTransformation.set(transformation);transformation.set(previousTransformation);previousTransformation.set(tempTransformation);}},{key:'initializeInvalidateRegion',value:function initializeInvalidateRegion(left,top,right,bottom){var region=this.mPreviousRegion;region.set(left,top,right,bottom);region.inset(-1.0,-1.0);if(this.mFillBefore){var previousTransformation=this.mPreviousTransformation;this.applyTransformation(this.mInterpolator.getInterpolation(0.0),previousTransformation);}}},{key:'hasAlpha',value:function hasAlpha(){return false;}}]);return Animation;}();Animation.INFINITE=-1;Animation.RESTART=1;Animation.REVERSE=2;Animation.START_ON_FIRST_FRAME=-1;Animation.ABSOLUTE=0;Animation.RELATIVE_TO_SELF=1;Animation.RELATIVE_TO_PARENT=2;Animation.ZORDER_NORMAL=0;Animation.ZORDER_TOP=1;Animation.ZORDER_BOTTOM=-1;Animation.USE_CLOSEGUARD=false;animation_1.Animation=Animation;(function(Animation){var Description=function(){function Description(){_classCallCheck(this,Description);this.type=0;this.value=0;}_createClass(Description,null,[{key:'parseValue',value:function parseValue(value){var d=new Description();if(value==null){d.type=Animation.ABSOLUTE;d.value=0;}else{if(value.endsWith('%p')){d.type=Animation.RELATIVE_TO_PARENT;d.value=Number.parseFloat(value.substring(0,value.length-2));}else if(value.endsWith('%')){d.type=Animation.RELATIVE_TO_SELF;d.value=Number.parseFloat(value.substring(0,value.length-1));}else{d.type=Animation.ABSOLUTE;d.value=TypedValue.complexToDimensionPixelSize(value);}}d.type=Animation.ABSOLUTE;d.value=0.0;return d;}}]);return Description;}();Animation.Description=Description;})(Animation=animation_1.Animation||(animation_1.Animation={}));})(animation=view.animation||(view.animation={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var R;(function(R){var attr=function attr(){_classCallCheck(this,attr);};attr.textViewStyle=new Map().set('android:textSize','14sp').set('android:layerType','software').set('android:textColor','@android:color/textView_textColor').set('android:textColorHint','#ff808080');attr.buttonStyle=new Map(attr.textViewStyle).set('android:background','@android:drawable/btn_default').set('android:focusable','true').set('android:clickable','true').set('android:minHeight','48dp').set('android:minWidth','64dp').set('android:textSize','18sp').set('android:gravity','center');attr.editTextStyle=new Map(attr.textViewStyle).set('android:background','@android:drawable/editbox_background').set('android:focusable','true').set('android:focusableInTouchMode','true').set('android:clickable','true').set('android:textSize','18sp').set('android:gravity','center_vertical');attr.imageButtonStyle=new Map().set('android:background','@android:drawable/btn_default').set('android:focusable','true').set('android:clickable','true').set('android:gravity','center');attr.checkboxStyle=new Map(attr.buttonStyle).set('android:background','@null').set('android:button','@android:drawable/btn_check');attr.radiobuttonStyle=new Map(attr.buttonStyle).set('android:background','@null').set('android:button','@android:drawable/btn_radio');attr.checkedTextViewStyle=new Map().set('android:textAlignment','viewStart');attr.progressBarStyle=new Map().set('android:indeterminateOnly','true').set('android:indeterminateDrawable','@android:drawable/progress_medium_holo').set('android:indeterminateBehavior','repeat').set('android:indeterminateDuration','3500').set('android:minWidth','48dp').set('android:maxWidth','48dp').set('android:minHeight','48dp').set('android:maxHeight','48dp').set('android:mirrorForRtl','false');attr.progressBarStyleHorizontal=new Map().set('android:indeterminateOnly','false').set('android:progressDrawable','@android:drawable/progress_horizontal_holo').set('android:indeterminateDrawable','@android:drawable/progress_indeterminate_horizontal_holo').set('android:indeterminateBehavior','repeat').set('android:indeterminateDuration','3500').set('android:minHeight','20dp').set('android:maxHeight','20dp').set('android:mirrorForRtl','true');attr.progressBarStyleSmall=new Map(attr.progressBarStyle).set('android:indeterminateDrawable','@android:drawable/progress_small_holo').set('android:minWidth','16dp').set('android:maxWidth','16dp').set('android:minHeight','16dp').set('android:maxHeight','16dp');attr.progressBarStyleLarge=new Map(attr.progressBarStyle).set('android:indeterminateDrawable','@android:drawable/progress_large_holo').set('android:minWidth','76dp').set('android:maxWidth','76dp').set('android:minHeight','76dp').set('android:maxHeight','76dp');attr.seekBarStyle=new Map().set('android:indeterminateOnly','false').set('android:progressDrawable','@android:drawable/scrubber_progress_horizontal_holo_light').set('android:indeterminateDrawable','@android:drawable/scrubber_progress_horizontal_holo_light').set('android:minHeight','13dp').set('android:maxHeight','13dp').set('android:thumb','@android:drawable/scrubber_control_selector_holo').set('android:thumbOffset','16dp').set('android:focusable','true').set('android:paddingLeft','16dp').set('android:paddingRight','16dp').set('android:mirrorForRtl','true');attr.ratingBarStyle=new Map().set('android:indeterminateOnly','false').set('android:progressDrawable','@android:drawable/ratingbar_full_holo_light').set('android:indeterminateDrawable','@android:drawable/ratingbar_full_holo_light').set('android:minHeight','48dip').set('android:maxHeight','48dip').set('android:numStars','5').set('android:stepSize','0.5').set('android:thumb','@null').set('android:mirrorForRtl','true');attr.ratingBarStyleIndicator=new Map(attr.ratingBarStyle).set('android:indeterminateOnly','false').set('android:progressDrawable','@android:drawable/ratingbar_holo_light').set('android:indeterminateDrawable','@android:drawable/ratingbar_holo_light').set('android:minHeight','35dip').set('android:maxHeight','35dip').set('android:thumb','@null').set('android:isIndicator','true');attr.ratingBarStyleSmall=new Map(attr.ratingBarStyle).set('android:indeterminateOnly','false').set('android:progressDrawable','@android:drawable/ratingbar_small_holo_light').set('android:indeterminateDrawable','@android:drawable/ratingbar_small_holo_light').set('android:minHeight','16dip').set('android:maxHeight','16dip').set('android:thumb','@null').set('android:isIndicator','true');attr.absListViewStyle=new Map().set('android:scrollbars','vertical').set('android:fadingEdge','vertical');attr.gridViewStyle=new Map(attr.absListViewStyle).set('android:listSelector','@android:drawable/list_selector_background').set('android:numColumns','1');attr.listViewStyle=new Map(attr.absListViewStyle).set('android:divider','@android:drawable/list_divider').set('android:listSelector','@android:drawable/list_selector_background').set('android:dividerHeight','1');attr.expandableListViewStyle=new Map(attr.listViewStyle).set('android:childDivider','@android:drawable/list_divider');attr.numberPickerStyle=new Map().set('android:orientation','vertical').set('android:solidColor','transparent').set('android:selectionDivider','#cc33b5e5').set('android:selectionDividerHeight','2dp').set('android:selectionDividersDistance','48dp').set('android:internalMinWidth','64dp').set('android:internalMaxHeight','180dp').set('android:virtualButtonPressedDrawable','@android:drawable/item_background');attr.popupWindowStyle=new Map().set('android:popupBackground','@android:drawable/dropdown_background_dark').set('android:popupEnterAnimation','@android:anim/grow_fade_in_center').set('android:popupExitAnimation','@android:anim/shrink_fade_out_center');attr.listPopupWindowStyle=new Map().set('android:popupBackground','@android:drawable/menu_panel_holo_light').set('android:popupEnterAnimation','@android:anim/grow_fade_in_center').set('android:popupExitAnimation','@android:anim/shrink_fade_out_center');attr.popupMenuStyle=new Map().set('android:popupBackground','@android:drawable/menu_panel_holo_dark');attr.dropDownListViewStyle=new Map(attr.listViewStyle);attr.spinnerStyle=new Map().set('android:clickable','true').set('android:spinnerMode','dropdown').set('android:gravity','start|center_vertical').set('android:disableChildrenWhenDisabled','true').set('android:background','@android:drawable/btn_default').set('android:popupBackground','@android:drawable/menu_panel_holo_light').set('android:dropDownVerticalOffset','0dp').set('android:dropDownHorizontalOffset','0dp').set('android:dropDownWidth','wrap_content');attr.actionBarStyle=new Map().set('android:background','#ff333333');attr.scrollViewStyle=new Map().set('android:scrollbars','vertical').set('android:fadingEdge','vertical');R.attr=attr;})(R=android.R||(android.R={}));})(android||(android={}));var android;(function(android){var view;(function(view_1){var LayoutDirection=android.util.LayoutDirection;var ColorDrawable=android.graphics.drawable.ColorDrawable;var ScrollBarDrawable=android.graphics.drawable.ScrollBarDrawable;var InsetDrawable=android.graphics.drawable.InsetDrawable;var ShadowDrawable=android.graphics.drawable.ShadowDrawable;var RoundRectDrawable=android.graphics.drawable.RoundRectDrawable;var PixelFormat=android.graphics.PixelFormat;var Matrix=android.graphics.Matrix;var Paint=android.graphics.Paint;var StringBuilder=java.lang.StringBuilder;var JavaObject=java.lang.JavaObject;var System=java.lang.System;var SystemClock=android.os.SystemClock;var Log=android.util.Log;var Rect=android.graphics.Rect;var RectF=android.graphics.RectF;var Point=android.graphics.Point;var Canvas=android.graphics.Canvas;var CopyOnWriteArrayList=java.lang.util.concurrent.CopyOnWriteArrayList;var ArrayList=java.util.ArrayList;var Resources=android.content.res.Resources;var Pools=android.util.Pools;var LinearInterpolator=android.view.animation.LinearInterpolator;var AnimationUtils=android.view.animation.AnimationUtils;var AttrBinder=androidui.attr.AttrBinder;var KeyEvent=android.view.KeyEvent;var Animation=android.view.animation.Animation;var Transformation=android.view.animation.Transformation;var View=function(_JavaObject){_inherits(View,_JavaObject);function View(context,bindElement,defStyleAttr){_classCallCheck(this,View);var _this37=_possibleConstructorReturn(this,(View.__proto__||Object.getPrototypeOf(View)).call(this));_this37.mPrivateFlags=0;_this37.mPrivateFlags2=0;_this37.mPrivateFlags3=0;_this37.mCurrentAnimation=null;_this37.mOldWidthMeasureSpec=Number.MIN_SAFE_INTEGER;_this37.mOldHeightMeasureSpec=Number.MIN_SAFE_INTEGER;_this37.mMeasuredWidth=0;_this37.mMeasuredHeight=0;_this37.mBackgroundSizeChanged=false;_this37.mBackgroundWidth=0;_this37.mBackgroundHeight=0;_this37.mHasPerformedLongPress=false;_this37.mMinWidth=0;_this37.mMinHeight=0;_this37.mDrawingCacheBackgroundColor=0;_this37.mTouchSlop=0;_this37.mVerticalScrollFactor=0;_this37.mOverScrollMode=View.OVER_SCROLL_IF_CONTENT_SCROLLS;_this37.mViewFlags=0;_this37.mLayerType=View.LAYER_TYPE_NONE;_this37.mCachingFailed=false;_this37.mWindowAttachCount=0;_this37.mTransientStateCount=0;_this37.mLastIsOpaque=false;_this37._mLeft=0;_this37._mRight=0;_this37._mTop=0;_this37._mBottom=0;_this37._mScrollX=0;_this37._mScrollY=0;_this37.mPaddingLeft=0;_this37.mPaddingRight=0;_this37.mPaddingTop=0;_this37.mPaddingBottom=0;_this37.mCornerRadiusTopLeft=0;_this37.mCornerRadiusTopRight=0;_this37.mCornerRadiusBottomRight=0;_this37.mCornerRadiusBottomLeft=0;_this37._stateAttrList=new androidui.attr.StateAttrList(_this37);_this37._attrBinder=new AttrBinder(_this37);_this37.mContext=context;_this37.mTouchSlop=view_1.ViewConfiguration.get().getScaledTouchSlop();_this37.initBindAttr();_this37.initBindElement(bindElement);var a=context.obtainStyledAttributes(bindElement,defStyleAttr);var background=null;var leftPadding=-1;var topPadding=-1;var rightPadding=-1;var bottomPadding=-1;var padding=-1;var viewFlagValues=0;var viewFlagMasks=0;var setScrollContainer=false;var x=0;var y=0;var tx=0;var ty=0;var rotation=0;var rotationX=0;var rotationY=0;var sx=1;var sy=1;var transformSet=false;var overScrollMode=_this37.mOverScrollMode;var initializeScrollbars=false;var _iteratorNormalCompletion39=true;var _didIteratorError39=false;var _iteratorError39=undefined;try{for(var _iterator39=a.getLowerCaseNoNamespaceAttrNames()[Symbol.iterator](),_step39;!(_iteratorNormalCompletion39=(_step39=_iterator39.next()).done);_iteratorNormalCompletion39=true){var attr=_step39.value;switch(attr){case'background':background=a.getDrawable(attr);break;case'padding':padding=a.getDimensionPixelSize(attr,-1);break;case'paddingleft':leftPadding=a.getDimensionPixelSize(attr,-1);break;case'paddingtop':topPadding=a.getDimensionPixelSize(attr,-1);break;case'paddingright':rightPadding=a.getDimensionPixelSize(attr,-1);break;case'paddingbottom':bottomPadding=a.getDimensionPixelSize(attr,-1);break;case'paddingstart':leftPadding=a.getDimensionPixelSize(attr,-1);break;case'paddingend':rightPadding=a.getDimensionPixelSize(attr,-1);break;case'scrollx':x=a.getDimensionPixelOffset(attr,0);break;case'scrolly':y=a.getDimensionPixelOffset(attr,0);break;case'alpha':_this37.setAlpha(a.getFloat(attr,1));break;case'transformpivotx':_this37.setPivotX(a.getDimensionPixelOffset(attr,0));break;case'transformpivoty':_this37.setPivotY(a.getDimensionPixelOffset(attr,0));break;case'translationx':tx=a.getDimensionPixelOffset(attr,0);transformSet=true;break;case'translationy':ty=a.getDimensionPixelOffset(attr,0);transformSet=true;break;case'rotation':rotation=a.getFloat(attr,0);transformSet=true;break;case'rotationx':rotationX=a.getFloat(attr,0);transformSet=true;break;case'rotationy':rotationY=a.getFloat(attr,0);transformSet=true;break;case'scalex':sx=a.getFloat(attr,1);transformSet=true;break;case'scaley':sy=a.getFloat(attr,1);transformSet=true;break;case'id':_this37.mID=a.getString(attr);break;case'tag':_this37.mTag=a.getText(attr);break;case'fitssystemwindows':break;case'focusable':if(a.getBoolean(attr,false)){viewFlagValues|=View.FOCUSABLE;viewFlagMasks|=View.FOCUSABLE_MASK;}break;case'focusableintouchmode':if(a.getBoolean(attr,false)){viewFlagValues|=View.FOCUSABLE_IN_TOUCH_MODE|View.FOCUSABLE;viewFlagMasks|=View.FOCUSABLE_IN_TOUCH_MODE|View.FOCUSABLE_MASK;}break;case'clickable':if(a.getBoolean(attr,false)){viewFlagValues|=View.CLICKABLE;viewFlagMasks|=View.CLICKABLE;}break;case'longclickable':if(a.getBoolean(attr,false)){viewFlagValues|=View.LONG_CLICKABLE;viewFlagMasks|=View.LONG_CLICKABLE;}break;case'saveenabled':break;case'duplicateparentstate':if(a.getBoolean(attr,false)){viewFlagValues|=View.DUPLICATE_PARENT_STATE;viewFlagMasks|=View.DUPLICATE_PARENT_STATE;}break;case'visibility':var visibility=a.getAttrValue(attr);if(visibility==='gone'){viewFlagValues|=View.GONE;viewFlagMasks|=View.VISIBILITY_MASK;}else if(visibility==='invisible'){viewFlagValues|=View.INVISIBLE;viewFlagMasks|=View.VISIBILITY_MASK;}else if(visibility==='visible'){viewFlagValues|=View.VISIBLE;viewFlagMasks|=View.VISIBILITY_MASK;}break;case'layoutdirection':break;case'drawingcachequality':break;case'contentdescription':break;case'labelfor':break;case'soundeffectsenabled':break;case'hapticfeedbackenabled':break;case'scrollbars':var scrollbars=a.getAttrValue(attr);if(scrollbars==='horizontal'){viewFlagValues|=View.SCROLLBARS_HORIZONTAL;viewFlagMasks|=View.SCROLLBARS_MASK;initializeScrollbars=true;}else if(scrollbars==='vertical'){viewFlagValues|=View.SCROLLBARS_VERTICAL;viewFlagMasks|=View.SCROLLBARS_MASK;initializeScrollbars=true;}break;case'fadingedge':case'requiresfadingedge':break;case'scrollbarstyle':break;case'isscrollcontainer':setScrollContainer=true;if(a.getBoolean(attr,false)){_this37.setScrollContainer(true);}break;case'keepscreenon':break;case'filtertoucheswhenobscured':break;case'nextfocusleft':_this37.mNextFocusLeftId=a.getResourceId(attr,View.NO_ID);break;case'nextfocusright':_this37.mNextFocusRightId=a.getResourceId(attr,View.NO_ID);break;case'nextfocusup':_this37.mNextFocusUpId=a.getResourceId(attr,View.NO_ID);break;case'nextfocusdown':_this37.mNextFocusDownId=a.getResourceId(attr,View.NO_ID);break;case'nextfocusforward':_this37.mNextFocusForwardId=a.getResourceId(attr,View.NO_ID);break;case'minwidth':_this37.mMinWidth=a.getDimensionPixelSize(attr,0);break;case'minheight':_this37.mMinHeight=a.getDimensionPixelSize(attr,0);break;case'onclick':_this37.setOnClickListenerByAttrValueString(a.getString(attr));break;case'overscrollmode':var scrollMode=View[('OVER_SCROLL_'+a.getAttrValue(attr)).toUpperCase()];overScrollMode=scrollMode||View.OVER_SCROLL_IF_CONTENT_SCROLLS;break;case'verticalscrollbarposition':break;case'layertype':if((a.getAttrValue(attr)+'').toLowerCase()=='software'){_this37.setLayerType(View.LAYER_TYPE_SOFTWARE);}else{_this37.setLayerType(View.LAYER_TYPE_NONE);}break;case'textdirection':break;case'textalignment':break;case'importantforaccessibility':break;case'accessibilityliveregion':break;case'cornerradius':case'cornerradiustopleft':case'cornerradiustopright':case'cornerradiusbottomleft':case'cornerradiusbottomright':case'viewshadowcolor':case'viewshadowdx':case'viewshadowdy':case'viewshadowradius':_this37._attrBinder.onAttrChange(attr,a.getAttrValue(attr),_this37.getContext());break;default:if(attr&&attr.startsWith('state_')){_this37._stateAttrList.addStatedAttr(attr,a.getAttrValue(attr));}}}}catch(err){_didIteratorError39=true;_iteratorError39=err;}finally{try{if(!_iteratorNormalCompletion39&&_iterator39.return){_iterator39.return();}}finally{if(_didIteratorError39){throw _iteratorError39;}}}_this37.setOverScrollMode(overScrollMode);if(background!=null){_this37.setBackground(background);}if(padding>=0){leftPadding=padding;topPadding=padding;rightPadding=padding;bottomPadding=padding;}_this37.setPadding(leftPadding>=0?leftPadding:_this37.mPaddingLeft,topPadding>=0?topPadding:_this37.mPaddingTop,rightPadding>=0?rightPadding:_this37.mPaddingRight,bottomPadding>=0?bottomPadding:_this37.mPaddingBottom);if(viewFlagMasks!=0){_this37.setFlags(viewFlagValues,viewFlagMasks);}if(initializeScrollbars){_this37.initializeScrollbars(a);}a.recycle();if(x!=0||y!=0){scrollTo(x,y);}if(transformSet){_this37.setTranslationX(tx);_this37.setTranslationY(ty);_this37.setRotation(rotation);_this37.setRotationX(rotationX);_this37.setRotationY(rotationY);_this37.setScaleX(sx);_this37.setScaleY(sy);}if(!setScrollContainer&&(viewFlagValues&View.SCROLLBARS_VERTICAL)!=0){_this37.setScrollContainer(true);}_this37.computeOpaqueFlags();return _this37;}_createClass(View,[{key:'getContext',value:function getContext(){return this.mContext;}},{key:'getWidth',value:function getWidth(){return this.mRight-this.mLeft;}},{key:'getHeight',value:function getHeight(){return this.mBottom-this.mTop;}},{key:'getPaddingLeft',value:function getPaddingLeft(){return this.mPaddingLeft;}},{key:'getPaddingTop',value:function getPaddingTop(){return this.mPaddingTop;}},{key:'getPaddingRight',value:function getPaddingRight(){return this.mPaddingRight;}},{key:'getPaddingBottom',value:function getPaddingBottom(){return this.mPaddingBottom;}},{key:'setPaddingLeft',value:function setPaddingLeft(left){if(this.mPaddingLeft!=left){this.mPaddingLeft=left;this.requestLayout();}}},{key:'setPaddingTop',value:function setPaddingTop(top){if(this.mPaddingTop!=top){this.mPaddingTop=top;this.requestLayout();}}},{key:'setPaddingRight',value:function setPaddingRight(right){if(this.mPaddingRight!=right){this.mPaddingRight=right;this.requestLayout();}}},{key:'setPaddingBottom',value:function setPaddingBottom(bottom){if(this.mPaddingBottom!=bottom){this.mPaddingBottom=bottom;this.requestLayout();}}},{key:'setPadding',value:function setPadding(left,top,right,bottom){var changed=false;if(this.mPaddingLeft!=left){changed=true;this.mPaddingLeft=left;}if(this.mPaddingTop!=top){changed=true;this.mPaddingTop=top;}if(this.mPaddingRight!=right){changed=true;this.mPaddingRight=right;}if(this.mPaddingBottom!=bottom){changed=true;this.mPaddingBottom=bottom;}if(changed){this.requestLayout();}}},{key:'resolvePadding',value:function resolvePadding(){}},{key:'setScrollX',value:function setScrollX(value){this.scrollTo(value,this.mScrollY);}},{key:'setScrollY',value:function setScrollY(value){this.scrollTo(this.mScrollX,value);}},{key:'getScrollX',value:function getScrollX(){return this.mScrollX;}},{key:'getScrollY',value:function getScrollY(){return this.mScrollY;}},{key:'offsetTopAndBottom',value:function offsetTopAndBottom(offset){if(offset!=0){this.updateMatrix();var matrixIsIdentity=this.mTransformationInfo==null||this.mTransformationInfo.mMatrixIsIdentity;if(matrixIsIdentity){var p=this.mParent;if(p!=null&&this.mAttachInfo!=null){var r=this.mAttachInfo.mTmpInvalRect;var minTop=void 0;var maxBottom=void 0;var yLoc=void 0;if(offset<0){minTop=this.mTop+offset;maxBottom=this.mBottom;yLoc=offset;}else{minTop=this.mTop;maxBottom=this.mBottom+offset;yLoc=0;}r.set(0,yLoc,this.mRight-this.mLeft,maxBottom-minTop);p.invalidateChild(this,r);}}else{this.invalidateViewProperty(false,false);}this.mTop+=offset;this.mBottom+=offset;if(!matrixIsIdentity){this.invalidateViewProperty(false,true);}this.invalidateParentIfNeeded();}}},{key:'offsetLeftAndRight',value:function offsetLeftAndRight(offset){if(offset!=0){this.updateMatrix();var matrixIsIdentity=this.mTransformationInfo==null||this.mTransformationInfo.mMatrixIsIdentity;if(matrixIsIdentity){var p=this.mParent;if(p!=null&&this.mAttachInfo!=null){var r=this.mAttachInfo.mTmpInvalRect;var minLeft=void 0;var maxRight=void 0;if(offset<0){minLeft=this.mLeft+offset;maxRight=this.mRight;}else{minLeft=this.mLeft;maxRight=this.mRight+offset;}r.set(0,0,maxRight-minLeft,this.mBottom-this.mTop);p.invalidateChild(this,r);}}else{this.invalidateViewProperty(false,false);}this.mLeft+=offset;this.mRight+=offset;if(!matrixIsIdentity){this.invalidateViewProperty(false,true);}this.invalidateParentIfNeeded();}}},{key:'getMatrix',value:function getMatrix(){if(this.mTransformationInfo!=null){this.updateMatrix();return this.mTransformationInfo.mMatrix;}return Matrix.IDENTITY_MATRIX;}},{key:'hasIdentityMatrix',value:function hasIdentityMatrix(){if(this.mTransformationInfo!=null){this.updateMatrix();return this.mTransformationInfo.mMatrixIsIdentity;}return true;}},{key:'ensureTransformationInfo',value:function ensureTransformationInfo(){if(this.mTransformationInfo==null){this.mTransformationInfo=new View.TransformationInfo();}}},{key:'updateMatrix',value:function updateMatrix(){var info=this.mTransformationInfo;if(info==null){this._syncMatrixToElement();return;}if(info.mMatrixDirty){if((this.mPrivateFlags&View.PFLAG_PIVOT_EXPLICITLY_SET)==0){if(this.mRight-this.mLeft!=info.mPrevWidth||this.mBottom-this.mTop!=info.mPrevHeight){info.mPrevWidth=this.mRight-this.mLeft;info.mPrevHeight=this.mBottom-this.mTop;info.mPivotX=info.mPrevWidth/2;info.mPivotY=info.mPrevHeight/2;}}info.mMatrix.reset();info.mMatrix.setTranslate(info.mTranslationX,info.mTranslationY);info.mMatrix.preRotate(info.mRotation,info.mPivotX,info.mPivotY);info.mMatrix.preScale(info.mScaleX,info.mScaleY,info.mPivotX,info.mPivotY);info.mMatrixDirty=false;info.mMatrixIsIdentity=info.mMatrix.isIdentity();info.mInverseMatrixDirty=true;}this._syncMatrixToElement();}},{key:'getRotation',value:function getRotation(){return this.mTransformationInfo!=null?this.mTransformationInfo.mRotation:0;}},{key:'setRotation',value:function setRotation(rotation){this.ensureTransformationInfo();var info=this.mTransformationInfo;if(info.mRotation!=rotation){this.invalidateViewProperty(true,false);info.mRotation=rotation;info.mMatrixDirty=true;this.invalidateViewProperty(false,true);if((this.mPrivateFlags2&View.PFLAG2_VIEW_QUICK_REJECTED)==View.PFLAG2_VIEW_QUICK_REJECTED){this.invalidateParentIfNeeded();}}}},{key:'getRotationY',value:function getRotationY(){return 0;}},{key:'setRotationY',value:function setRotationY(rotationY){}},{key:'getRotationX',value:function getRotationX(){return 0;}},{key:'setRotationX',value:function setRotationX(rotationX){}},{key:'getScaleX',value:function getScaleX(){return this.mTransformationInfo!=null?this.mTransformationInfo.mScaleX:1;}},{key:'setScaleX',value:function setScaleX(scaleX){this.ensureTransformationInfo();var info=this.mTransformationInfo;if(info.mScaleX!=scaleX){this.invalidateViewProperty(true,false);info.mScaleX=scaleX;info.mMatrixDirty=true;this.invalidateViewProperty(false,true);if((this.mPrivateFlags2&View.PFLAG2_VIEW_QUICK_REJECTED)==View.PFLAG2_VIEW_QUICK_REJECTED){this.invalidateParentIfNeeded();}}}},{key:'getScaleY',value:function getScaleY(){return this.mTransformationInfo!=null?this.mTransformationInfo.mScaleY:1;}},{key:'setScaleY',value:function setScaleY(scaleY){this.ensureTransformationInfo();var info=this.mTransformationInfo;if(info.mScaleY!=scaleY){this.invalidateViewProperty(true,false);info.mScaleY=scaleY;info.mMatrixDirty=true;this.invalidateViewProperty(false,true);if((this.mPrivateFlags2&View.PFLAG2_VIEW_QUICK_REJECTED)==View.PFLAG2_VIEW_QUICK_REJECTED){this.invalidateParentIfNeeded();}}}},{key:'getPivotX',value:function getPivotX(){return this.mTransformationInfo!=null?this.mTransformationInfo.mPivotX:0;}},{key:'setPivotX',value:function setPivotX(pivotX){this.ensureTransformationInfo();var info=this.mTransformationInfo;var pivotSet=(this.mPrivateFlags&View.PFLAG_PIVOT_EXPLICITLY_SET)==View.PFLAG_PIVOT_EXPLICITLY_SET;if(info.mPivotX!=pivotX||!pivotSet){this.mPrivateFlags|=View.PFLAG_PIVOT_EXPLICITLY_SET;this.invalidateViewProperty(true,false);info.mPivotX=pivotX;info.mMatrixDirty=true;this.invalidateViewProperty(false,true);if((this.mPrivateFlags2&View.PFLAG2_VIEW_QUICK_REJECTED)==View.PFLAG2_VIEW_QUICK_REJECTED){this.invalidateParentIfNeeded();}}}},{key:'getPivotY',value:function getPivotY(){return this.mTransformationInfo!=null?this.mTransformationInfo.mPivotY:0;}},{key:'setPivotY',value:function setPivotY(pivotY){this.ensureTransformationInfo();var info=this.mTransformationInfo;var pivotSet=(this.mPrivateFlags&View.PFLAG_PIVOT_EXPLICITLY_SET)==View.PFLAG_PIVOT_EXPLICITLY_SET;if(info.mPivotY!=pivotY||!pivotSet){this.mPrivateFlags|=View.PFLAG_PIVOT_EXPLICITLY_SET;this.invalidateViewProperty(true,false);info.mPivotY=pivotY;info.mMatrixDirty=true;this.invalidateViewProperty(false,true);if((this.mPrivateFlags2&View.PFLAG2_VIEW_QUICK_REJECTED)==View.PFLAG2_VIEW_QUICK_REJECTED){this.invalidateParentIfNeeded();}}}},{key:'getAlpha',value:function getAlpha(){return this.mTransformationInfo!=null?this.mTransformationInfo.mAlpha:1;}},{key:'hasOverlappingRendering',value:function hasOverlappingRendering(){return true;}},{key:'setAlpha',value:function setAlpha(alpha){this.ensureTransformationInfo();if(this.mTransformationInfo.mAlpha!=alpha){this.mTransformationInfo.mAlpha=alpha;if(this.onSetAlpha(Math.floor(alpha*255))){this.mPrivateFlags|=View.PFLAG_ALPHA_SET;this.invalidateParentCaches();this.invalidate(true);}else{this.mPrivateFlags&=~View.PFLAG_ALPHA_SET;this.invalidateViewProperty(true,false);}}}},{key:'setAlphaNoInvalidation',value:function setAlphaNoInvalidation(alpha){this.ensureTransformationInfo();if(this.mTransformationInfo.mAlpha!=alpha){this.mTransformationInfo.mAlpha=alpha;var subclassHandlesAlpha=this.onSetAlpha(Math.floor(alpha*255));if(subclassHandlesAlpha){this.mPrivateFlags|=View.PFLAG_ALPHA_SET;return true;}else{this.mPrivateFlags&=~View.PFLAG_ALPHA_SET;}}return false;}},{key:'setTransitionAlpha',value:function setTransitionAlpha(alpha){this.ensureTransformationInfo();if(this.mTransformationInfo.mTransitionAlpha!=alpha){this.mTransformationInfo.mTransitionAlpha=alpha;this.mPrivateFlags&=~View.PFLAG_ALPHA_SET;this.invalidateViewProperty(true,false);}}},{key:'getFinalAlpha',value:function getFinalAlpha(){if(this.mTransformationInfo!=null){return this.mTransformationInfo.mAlpha*this.mTransformationInfo.mTransitionAlpha;}return 1;}},{key:'getTransitionAlpha',value:function getTransitionAlpha(){return this.mTransformationInfo!=null?this.mTransformationInfo.mTransitionAlpha:1;}},{key:'getTop',value:function getTop(){return this.mTop;}},{key:'setTop',value:function setTop(top){if(top!=this.mTop){this.updateMatrix();var matrixIsIdentity=this.mTransformationInfo==null||this.mTransformationInfo.mMatrixIsIdentity;if(matrixIsIdentity){if(this.mAttachInfo!=null){var minTop=void 0;var yLoc=void 0;if(top<this.mTop){minTop=top;yLoc=top-this.mTop;}else{minTop=this.mTop;yLoc=0;}this.invalidate(0,yLoc,this.mRight-this.mLeft,this.mBottom-minTop);}}else{this.invalidate(true);}var width=this.mRight-this.mLeft;var oldHeight=this.mBottom-this.mTop;this.mTop=top;this.sizeChange(width,this.mBottom-this.mTop,width,oldHeight);if(!matrixIsIdentity){if((this.mPrivateFlags&View.PFLAG_PIVOT_EXPLICITLY_SET)==0){this.mTransformationInfo.mMatrixDirty=true;}this.mPrivateFlags|=View.PFLAG_DRAWN;this.invalidate(true);}this.mBackgroundSizeChanged=true;this.invalidateParentIfNeeded();if((this.mPrivateFlags2&View.PFLAG2_VIEW_QUICK_REJECTED)==View.PFLAG2_VIEW_QUICK_REJECTED){this.invalidateParentIfNeeded();}}}},{key:'getBottom',value:function getBottom(){return this.mBottom;}},{key:'isDirty',value:function isDirty(){return(this.mPrivateFlags&View.PFLAG_DIRTY_MASK)!=0;}},{key:'setBottom',value:function setBottom(bottom){if(bottom!=this.mBottom){this.updateMatrix();var matrixIsIdentity=this.mTransformationInfo==null||this.mTransformationInfo.mMatrixIsIdentity;if(matrixIsIdentity){if(this.mAttachInfo!=null){var maxBottom=void 0;if(bottom<this.mBottom){maxBottom=this.mBottom;}else{maxBottom=bottom;}this.invalidate(0,0,this.mRight-this.mLeft,maxBottom-this.mTop);}}else{this.invalidate(true);}var width=this.mRight-this.mLeft;var oldHeight=this.mBottom-this.mTop;this.mBottom=bottom;this.sizeChange(width,this.mBottom-this.mTop,width,oldHeight);if(!matrixIsIdentity){if((this.mPrivateFlags&View.PFLAG_PIVOT_EXPLICITLY_SET)==0){this.mTransformationInfo.mMatrixDirty=true;}this.mPrivateFlags|=View.PFLAG_DRAWN;this.invalidate(true);}this.mBackgroundSizeChanged=true;this.invalidateParentIfNeeded();if((this.mPrivateFlags2&View.PFLAG2_VIEW_QUICK_REJECTED)==View.PFLAG2_VIEW_QUICK_REJECTED){this.invalidateParentIfNeeded();}}}},{key:'getLeft',value:function getLeft(){return this.mLeft;}},{key:'setLeft',value:function setLeft(left){if(left!=this.mLeft){this.updateMatrix();var matrixIsIdentity=this.mTransformationInfo==null||this.mTransformationInfo.mMatrixIsIdentity;if(matrixIsIdentity){if(this.mAttachInfo!=null){var minLeft=void 0;var xLoc=void 0;if(left<this.mLeft){minLeft=left;xLoc=left-this.mLeft;}else{minLeft=this.mLeft;xLoc=0;}this.invalidate(xLoc,0,this.mRight-minLeft,this.mBottom-this.mTop);}}else{this.invalidate(true);}var oldWidth=this.mRight-this.mLeft;var height=this.mBottom-this.mTop;this.mLeft=left;this.sizeChange(this.mRight-this.mLeft,height,oldWidth,height);if(!matrixIsIdentity){if((this.mPrivateFlags&View.PFLAG_PIVOT_EXPLICITLY_SET)==0){this.mTransformationInfo.mMatrixDirty=true;}this.mPrivateFlags|=View.PFLAG_DRAWN;this.invalidate(true);}this.mBackgroundSizeChanged=true;this.invalidateParentIfNeeded();if((this.mPrivateFlags2&View.PFLAG2_VIEW_QUICK_REJECTED)==View.PFLAG2_VIEW_QUICK_REJECTED){this.invalidateParentIfNeeded();}}}},{key:'getRight',value:function getRight(){return this.mRight;}},{key:'setRight',value:function setRight(right){if(right!=this.mRight){this.updateMatrix();var matrixIsIdentity=this.mTransformationInfo==null||this.mTransformationInfo.mMatrixIsIdentity;if(matrixIsIdentity){if(this.mAttachInfo!=null){var maxRight=void 0;if(right<this.mRight){maxRight=this.mRight;}else{maxRight=right;}this.invalidate(0,0,maxRight-this.mLeft,this.mBottom-this.mTop);}}else{this.invalidate(true);}var oldWidth=this.mRight-this.mLeft;var height=this.mBottom-this.mTop;this.mRight=right;this.sizeChange(this.mRight-this.mLeft,height,oldWidth,height);if(!matrixIsIdentity){if((this.mPrivateFlags&View.PFLAG_PIVOT_EXPLICITLY_SET)==0){this.mTransformationInfo.mMatrixDirty=true;}this.mPrivateFlags|=View.PFLAG_DRAWN;this.invalidate(true);}this.mBackgroundSizeChanged=true;this.invalidateParentIfNeeded();if((this.mPrivateFlags2&View.PFLAG2_VIEW_QUICK_REJECTED)==View.PFLAG2_VIEW_QUICK_REJECTED){this.invalidateParentIfNeeded();}}}},{key:'getX',value:function getX(){return this.mLeft+(this.mTransformationInfo!=null?this.mTransformationInfo.mTranslationX:0);}},{key:'setX',value:function setX(x){this.setTranslationX(x-this.mLeft);}},{key:'getY',value:function getY(){return this.mTop+(this.mTransformationInfo!=null?this.mTransformationInfo.mTranslationY:0);}},{key:'setY',value:function setY(y){this.setTranslationY(y-this.mTop);}},{key:'getTranslationX',value:function getTranslationX(){return this.mTransformationInfo!=null?this.mTransformationInfo.mTranslationX:0;}},{key:'setTranslationX',value:function setTranslationX(translationX){this.ensureTransformationInfo();var info=this.mTransformationInfo;if(info.mTranslationX!=translationX){this.invalidateViewProperty(true,false);info.mTranslationX=translationX;info.mMatrixDirty=true;this.invalidateViewProperty(false,true);if((this.mPrivateFlags2&View.PFLAG2_VIEW_QUICK_REJECTED)==View.PFLAG2_VIEW_QUICK_REJECTED){this.invalidateParentIfNeeded();}}}},{key:'getTranslationY',value:function getTranslationY(){return this.mTransformationInfo!=null?this.mTransformationInfo.mTranslationY:0;}},{key:'setTranslationY',value:function setTranslationY(translationY){this.ensureTransformationInfo();var info=this.mTransformationInfo;if(info.mTranslationY!=translationY){this.invalidateViewProperty(true,false);info.mTranslationY=translationY;info.mMatrixDirty=true;this.invalidateViewProperty(false,true);if((this.mPrivateFlags2&View.PFLAG2_VIEW_QUICK_REJECTED)==View.PFLAG2_VIEW_QUICK_REJECTED){this.invalidateParentIfNeeded();}}}},{key:'transformRect',value:function transformRect(rect){if(!this.getMatrix().isIdentity()){var boundingRect=this.mAttachInfo.mTmpTransformRect;boundingRect.set(rect);this.getMatrix().mapRect(boundingRect);rect.set(boundingRect);}}},{key:'pointInView',value:function pointInView(localX,localY){var slop=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;return localX>=-slop&&localY>=-slop&&localX<this.mRight-this.mLeft+slop&&localY<this.mBottom-this.mTop+slop;}},{key:'getHandler',value:function getHandler(){var attachInfo=this.mAttachInfo;if(attachInfo!=null){return attachInfo.mHandler;}return null;}},{key:'getViewRootImpl',value:function getViewRootImpl(){if(this.mAttachInfo!=null){return this.mAttachInfo.mViewRootImpl;}if(this.mContext!=null){return this.mContext.androidUI._viewRootImpl;}return null;}},{key:'post',value:function post(action){var attachInfo=this.mAttachInfo;if(attachInfo!=null){return attachInfo.mHandler.post(action);}view_1.ViewRootImpl.getRunQueue().post(action);return true;}},{key:'postDelayed',value:function postDelayed(action,delayMillis){var attachInfo=this.mAttachInfo;if(attachInfo!=null){return attachInfo.mHandler.postDelayed(action,delayMillis);}view_1.ViewRootImpl.getRunQueue().postDelayed(action,delayMillis);return true;}},{key:'postOnAnimation',value:function postOnAnimation(action){return this.post(action);}},{key:'postOnAnimationDelayed',value:function postOnAnimationDelayed(action,delayMillis){return this.postDelayed(action,delayMillis);}},{key:'removeCallbacks',value:function removeCallbacks(action){if(action!=null){var attachInfo=this.mAttachInfo;if(attachInfo!=null){attachInfo.mHandler.removeCallbacks(action);}else{view_1.ViewRootImpl.getRunQueue().removeCallbacks(action);}}return true;}},{key:'getParent',value:function getParent(){return this.mParent;}},{key:'setFlags',value:function setFlags(flags,mask){var old=this.mViewFlags;this.mViewFlags=this.mViewFlags&~mask|flags&mask;var changed=this.mViewFlags^old;if(changed==0){return;}var privateFlags=this.mPrivateFlags;if((changed&View.FOCUSABLE_MASK)!=0&&(privateFlags&View.PFLAG_HAS_BOUNDS)!=0){if((old&View.FOCUSABLE_MASK)==View.FOCUSABLE&&(privateFlags&View.PFLAG_FOCUSED)!=0){this.clearFocus();}else if((old&View.FOCUSABLE_MASK)==View.NOT_FOCUSABLE&&(privateFlags&View.PFLAG_FOCUSED)==0){if(this.mParent!=null)this.mParent.focusableViewAvailable(this);}}var newVisibility=flags&View.VISIBILITY_MASK;if(newVisibility==View.VISIBLE){if((changed&View.VISIBILITY_MASK)!=0){this.mPrivateFlags|=View.PFLAG_DRAWN;this.invalidate(true);if(this.mParent!=null&&this.mBottom>this.mTop&&this.mRight>this.mLeft){this.mParent.focusableViewAvailable(this);}}}if((changed&View.GONE)!=0){this.requestLayout();if((this.mViewFlags&View.VISIBILITY_MASK)==View.GONE){if(this.hasFocus())this.clearFocus();this.destroyDrawingCache();if(this.mParent instanceof View){this.mParent.invalidate(true);}this.mPrivateFlags|=View.PFLAG_DRAWN;}}if((changed&View.INVISIBLE)!=0){this.mPrivateFlags|=View.PFLAG_DRAWN;if((this.mViewFlags&View.VISIBILITY_MASK)==View.INVISIBLE){if(this.getRootView()!=this){if(this.hasFocus())this.clearFocus();}}}if((changed&View.VISIBILITY_MASK)!=0){if(newVisibility!=View.VISIBLE){this.cleanupDraw();}if(this.mParent instanceof view_1.ViewGroup){this.mParent.onChildVisibilityChanged(this,changed&View.VISIBILITY_MASK,newVisibility);this.mParent.invalidate(true);}else if(this.mParent!=null){this.mParent.invalidateChild(this,null);}this.dispatchVisibilityChanged(this,newVisibility);this.syncVisibleToElement();}if((changed&View.WILL_NOT_CACHE_DRAWING)!=0){this.destroyDrawingCache();}if((changed&View.DRAWING_CACHE_ENABLED)!=0){this.destroyDrawingCache();this.mPrivateFlags&=~View.PFLAG_DRAWING_CACHE_VALID;this.invalidateParentCaches();}if((changed&View.DRAW_MASK)!=0){if((this.mViewFlags&View.WILL_NOT_DRAW)!=0){if(this.mBackground!=null){this.mPrivateFlags&=~View.PFLAG_SKIP_DRAW;this.mPrivateFlags|=View.PFLAG_ONLY_DRAWS_BACKGROUND;}else{this.mPrivateFlags|=View.PFLAG_SKIP_DRAW;}}else{this.mPrivateFlags&=~View.PFLAG_SKIP_DRAW;}this.requestLayout();this.invalidate(true);}}},{key:'bringToFront',value:function bringToFront(){if(this.mParent!=null){this.mParent.bringChildToFront(this);}}},{key:'onScrollChanged',value:function onScrollChanged(l,t,oldl,oldt){this.mBackgroundSizeChanged=true;var rootImpl=this.getViewRootImpl();if(rootImpl!=null){rootImpl.mViewScrollChanged=true;}}},{key:'onSizeChanged',value:function onSizeChanged(w,h,oldw,oldh){}},{key:'getTouchables',value:function getTouchables(){var result=new ArrayList();this.addTouchables(result);return result;}},{key:'addTouchables',value:function addTouchables(views){var viewFlags=this.mViewFlags;if(((viewFlags&View.CLICKABLE)==View.CLICKABLE||(viewFlags&View.LONG_CLICKABLE)==View.LONG_CLICKABLE)&&(viewFlags&View.ENABLED_MASK)==View.ENABLED){views.add(this);}}},{key:'requestRectangleOnScreen',value:function requestRectangleOnScreen(rectangle){var immediate=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(this.mParent==null){return false;}var child=this;var position=this.mAttachInfo!=null?this.mAttachInfo.mTmpTransformRect:new RectF();position.set(rectangle);var parent=this.mParent;var scrolled=false;while(parent!=null){rectangle.set(Math.floor(position.left),Math.floor(position.top),Math.floor(position.right),Math.floor(position.bottom));scrolled=parent.requestChildRectangleOnScreen(child,rectangle,immediate)||scrolled;if(!child.hasIdentityMatrix()){child.getMatrix().mapRect(position);}position.offset(child.mLeft,child.mTop);if(!(parent instanceof View)){break;}var parentView=parent;position.offset(-parentView.getScrollX(),-parentView.getScrollY());child=parentView;parent=child.getParent();}return scrolled;}},{key:'onFocusLost',value:function onFocusLost(){this.resetPressedState();}},{key:'resetPressedState',value:function resetPressedState(){if((this.mViewFlags&View.ENABLED_MASK)==View.DISABLED){return;}if(this.isPressed()){this.setPressed(false);if(!this.mHasPerformedLongPress){this.removeLongPressCallback();}}}},{key:'isFocused',value:function isFocused(){return(this.mPrivateFlags&View.PFLAG_FOCUSED)!=0;}},{key:'findFocus',value:function findFocus(){return(this.mPrivateFlags&View.PFLAG_FOCUSED)!=0?this:null;}},{key:'getNextFocusLeftId',value:function getNextFocusLeftId(){return this.mNextFocusLeftId;}},{key:'setNextFocusLeftId',value:function setNextFocusLeftId(nextFocusLeftId){this.mNextFocusLeftId=nextFocusLeftId;}},{key:'getNextFocusRightId',value:function getNextFocusRightId(){return this.mNextFocusRightId;}},{key:'setNextFocusRightId',value:function setNextFocusRightId(nextFocusRightId){this.mNextFocusRightId=nextFocusRightId;}},{key:'getNextFocusUpId',value:function getNextFocusUpId(){return this.mNextFocusUpId;}},{key:'setNextFocusUpId',value:function setNextFocusUpId(nextFocusUpId){this.mNextFocusUpId=nextFocusUpId;}},{key:'getNextFocusDownId',value:function getNextFocusDownId(){return this.mNextFocusDownId;}},{key:'setNextFocusDownId',value:function setNextFocusDownId(nextFocusDownId){this.mNextFocusDownId=nextFocusDownId;}},{key:'getNextFocusForwardId',value:function getNextFocusForwardId(){return this.mNextFocusForwardId;}},{key:'setNextFocusForwardId',value:function setNextFocusForwardId(nextFocusForwardId){this.mNextFocusForwardId=nextFocusForwardId;}},{key:'setFocusable',value:function setFocusable(focusable){if(!focusable){this.setFlags(0,View.FOCUSABLE_IN_TOUCH_MODE);}this.setFlags(focusable?View.FOCUSABLE:View.NOT_FOCUSABLE,View.FOCUSABLE_MASK);}},{key:'isFocusable',value:function isFocusable(){return View.FOCUSABLE==(this.mViewFlags&View.FOCUSABLE_MASK);}},{key:'setFocusableInTouchMode',value:function setFocusableInTouchMode(focusableInTouchMode){this.setFlags(focusableInTouchMode?View.FOCUSABLE_IN_TOUCH_MODE:0,View.FOCUSABLE_IN_TOUCH_MODE);if(focusableInTouchMode){this.setFlags(View.FOCUSABLE,View.FOCUSABLE_MASK);}}},{key:'isFocusableInTouchMode',value:function isFocusableInTouchMode(){return View.FOCUSABLE_IN_TOUCH_MODE==(this.mViewFlags&View.FOCUSABLE_IN_TOUCH_MODE);}},{key:'hasFocusable',value:function hasFocusable(){return(this.mViewFlags&View.VISIBILITY_MASK)==View.VISIBLE&&this.isFocusable();}},{key:'clearFocus',value:function clearFocus(){if(View.DBG){System.out.println(this+\" clearFocus()\");}this.clearFocusInternal(true,true);}},{key:'clearFocusInternal',value:function clearFocusInternal(propagate,refocus){if((this.mPrivateFlags&View.PFLAG_FOCUSED)!=0){this.mPrivateFlags&=~View.PFLAG_FOCUSED;if(propagate&&this.mParent!=null){this.mParent.clearChildFocus(this);}this.onFocusChanged(false,0,null);this.refreshDrawableState();if(propagate&&(!refocus||!this.rootViewRequestFocus())){this.notifyGlobalFocusCleared(this);}}}},{key:'notifyGlobalFocusCleared',value:function notifyGlobalFocusCleared(oldFocus){}},{key:'rootViewRequestFocus',value:function rootViewRequestFocus(){var root=this.getRootView();return root!=null&&root.requestFocus();}},{key:'unFocus',value:function unFocus(){if(View.DBG){System.out.println(this+\" unFocus()\");}this.clearFocusInternal(false,false);}},{key:'hasFocus',value:function hasFocus(){return(this.mPrivateFlags&View.PFLAG_FOCUSED)!=0;}},{key:'onFocusChanged',value:function onFocusChanged(gainFocus,direction,previouslyFocusedRect){if(!gainFocus){if(this.isPressed()){this.setPressed(false);}this.onFocusLost();}this.invalidate(true);var li=this.mListenerInfo;if(li!=null&&li.mOnFocusChangeListener!=null){li.mOnFocusChangeListener.onFocusChange(this,gainFocus);}if(this.mAttachInfo!=null){this.mAttachInfo.mKeyDispatchState.reset(this);}}},{key:'focusSearch',value:function focusSearch(direction){if(this.mParent!=null){return this.mParent.focusSearch(this,direction);}else{return null;}}},{key:'dispatchUnhandledMove',value:function dispatchUnhandledMove(focused,direction){return false;}},{key:'findUserSetNextFocus',value:function findUserSetNextFocus(root,direction){var _this38=this;switch(direction){case View.FOCUS_LEFT:if(!this.mNextFocusLeftId)return null;return this.findViewInsideOutShouldExist(root,this.mNextFocusLeftId);case View.FOCUS_RIGHT:if(!this.mNextFocusRightId)return null;return this.findViewInsideOutShouldExist(root,this.mNextFocusRightId);case View.FOCUS_UP:if(!this.mNextFocusUpId)return null;return this.findViewInsideOutShouldExist(root,this.mNextFocusUpId);case View.FOCUS_DOWN:if(!this.mNextFocusDownId)return null;return this.findViewInsideOutShouldExist(root,this.mNextFocusDownId);case View.FOCUS_FORWARD:if(!this.mNextFocusForwardId)return null;return this.findViewInsideOutShouldExist(root,this.mNextFocusForwardId);case View.FOCUS_BACKWARD:{var _ret4=function(){if(!_this38.mID)return{v:null};var id=_this38.mID;return{v:root.findViewByPredicateInsideOut(_this38,{apply:function apply(t){return t.mNextFocusForwardId==id;}})};}();if((typeof _ret4==='undefined'?'undefined':_typeof(_ret4))===\"object\")return _ret4.v;}}return null;}},{key:'findViewInsideOutShouldExist',value:function findViewInsideOutShouldExist(root,id){if(this.mMatchIdPredicate==null){this.mMatchIdPredicate=new MatchIdPredicate();}this.mMatchIdPredicate.mId=id;var result=root.findViewByPredicateInsideOut(this,this.mMatchIdPredicate);if(result==null){Log.w(View.VIEW_LOG_TAG,\"couldn't find view with id \"+id);}return result;}},{key:'getFocusables',value:function getFocusables(direction){var result=new ArrayList(24);this.addFocusables(result,direction);return result;}},{key:'addFocusables',value:function addFocusables(views,direction){var focusableMode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:View.FOCUSABLES_TOUCH_MODE;if(views==null){return;}if(!this.isFocusable()){return;}if((focusableMode&View.FOCUSABLES_TOUCH_MODE)==View.FOCUSABLES_TOUCH_MODE&&this.isInTouchMode()&&!this.isFocusableInTouchMode()){return;}views.add(this);}},{key:'setOnFocusChangeListener',value:function setOnFocusChangeListener(l){if(typeof l==\"function\"){l=View.OnFocusChangeListener.fromFunction(l);}this.getListenerInfo().mOnFocusChangeListener=l;}},{key:'getOnFocusChangeListener',value:function getOnFocusChangeListener(){var li=this.mListenerInfo;return li!=null?li.mOnFocusChangeListener:null;}},{key:'requestFocus',value:function requestFocus(){var direction=arguments.length>0&&arguments[0]!==undefined?arguments[0]:View.FOCUS_DOWN;var previouslyFocusedRect=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;return this.requestFocusNoSearch(direction,previouslyFocusedRect);}},{key:'requestFocusNoSearch',value:function requestFocusNoSearch(direction,previouslyFocusedRect){if((this.mViewFlags&View.FOCUSABLE_MASK)!=View.FOCUSABLE||(this.mViewFlags&View.VISIBILITY_MASK)!=View.VISIBLE){return false;}if(this.isInTouchMode()&&View.FOCUSABLE_IN_TOUCH_MODE!=(this.mViewFlags&View.FOCUSABLE_IN_TOUCH_MODE)){return false;}if(this.hasAncestorThatBlocksDescendantFocus()){return false;}this.handleFocusGainInternal(direction,previouslyFocusedRect);return true;}},{key:'requestFocusFromTouch',value:function requestFocusFromTouch(){if(this.isInTouchMode()){var viewRoot=this.getViewRootImpl();if(viewRoot!=null){viewRoot.ensureTouchMode(false);}}return this.requestFocus(View.FOCUS_DOWN);}},{key:'hasAncestorThatBlocksDescendantFocus',value:function hasAncestorThatBlocksDescendantFocus(){var ancestor=this.mParent;while(ancestor instanceof view_1.ViewGroup){var vgAncestor=ancestor;if(vgAncestor.getDescendantFocusability()==view_1.ViewGroup.FOCUS_BLOCK_DESCENDANTS){return true;}else{ancestor=vgAncestor.getParent();}}return false;}},{key:'handleFocusGainInternal',value:function handleFocusGainInternal(direction,previouslyFocusedRect){if(View.DBG){System.out.println(this+\" requestFocus()\");}if((this.mPrivateFlags&View.PFLAG_FOCUSED)==0){this.mPrivateFlags|=View.PFLAG_FOCUSED;var oldFocus=this.mAttachInfo!=null?this.getRootView().findFocus():null;if(this.mParent!=null){this.mParent.requestChildFocus(this,this);}this.onFocusChanged(true,direction,previouslyFocusedRect);this.refreshDrawableState();}}},{key:'hasTransientState',value:function hasTransientState(){return(this.mPrivateFlags2&View.PFLAG2_HAS_TRANSIENT_STATE)==View.PFLAG2_HAS_TRANSIENT_STATE;}},{key:'setHasTransientState',value:function setHasTransientState(hasTransientState){this.mTransientStateCount=hasTransientState?this.mTransientStateCount+1:this.mTransientStateCount-1;if(this.mTransientStateCount<0){this.mTransientStateCount=0;Log.e(View.VIEW_LOG_TAG,\"hasTransientState decremented below 0: \"+\"unmatched pair of setHasTransientState calls\");}else if(hasTransientState&&this.mTransientStateCount==1||!hasTransientState&&this.mTransientStateCount==0){this.mPrivateFlags2=this.mPrivateFlags2&~View.PFLAG2_HAS_TRANSIENT_STATE|(hasTransientState?View.PFLAG2_HAS_TRANSIENT_STATE:0);if(this.mParent!=null){this.mParent.childHasTransientStateChanged(this,hasTransientState);}}}},{key:'isScrollContainer',value:function isScrollContainer(){return(this.mPrivateFlags&View.PFLAG_SCROLL_CONTAINER_ADDED)!=0;}},{key:'setScrollContainer',value:function setScrollContainer(isScrollContainer){if(isScrollContainer){if(this.mAttachInfo!=null&&(this.mPrivateFlags&View.PFLAG_SCROLL_CONTAINER_ADDED)==0){this.mAttachInfo.mScrollContainers.add(this);this.mPrivateFlags|=View.PFLAG_SCROLL_CONTAINER_ADDED;}this.mPrivateFlags|=View.PFLAG_SCROLL_CONTAINER;}else{if((this.mPrivateFlags&View.PFLAG_SCROLL_CONTAINER_ADDED)!=0){this.mAttachInfo.mScrollContainers.delete(this);}this.mPrivateFlags&=~(View.PFLAG_SCROLL_CONTAINER|View.PFLAG_SCROLL_CONTAINER_ADDED);}}},{key:'isInTouchMode',value:function isInTouchMode(){if(this.getViewRootImpl()!=null){return this.getViewRootImpl().mInTouchMode;}else{return false;}}},{key:'isShown',value:function isShown(){var current=this;do{if((current.mViewFlags&View.VISIBILITY_MASK)!=View.VISIBLE){return false;}var parent=current.mParent;if(parent==null){return false;}if(!(parent instanceof View)){return true;}current=parent;}while(current!=null);return false;}},{key:'getVisibility',value:function getVisibility(){return this.mViewFlags&View.VISIBILITY_MASK;}},{key:'setVisibility',value:function setVisibility(visibility){this.setFlags(visibility,View.VISIBILITY_MASK);if(this.mBackground!=null)this.mBackground.setVisible(visibility==View.VISIBLE,false);}},{key:'dispatchVisibilityChanged',value:function dispatchVisibilityChanged(changedView,visibility){this.onVisibilityChanged(changedView,visibility);}},{key:'onVisibilityChanged',value:function onVisibilityChanged(changedView,visibility){if(visibility==View.VISIBLE){if(this.mAttachInfo!=null){this.initialAwakenScrollBars();}else{this.mPrivateFlags|=View.PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH;}}}},{key:'dispatchDisplayHint',value:function dispatchDisplayHint(hint){this.onDisplayHint(hint);}},{key:'onDisplayHint',value:function onDisplayHint(hint){}},{key:'dispatchWindowVisibilityChanged',value:function dispatchWindowVisibilityChanged(visibility){this.onWindowVisibilityChanged(visibility);}},{key:'onWindowVisibilityChanged',value:function onWindowVisibilityChanged(visibility){if(visibility==View.VISIBLE){this.initialAwakenScrollBars();}}},{key:'getWindowVisibility',value:function getWindowVisibility(){return this.mAttachInfo!=null?this.mAttachInfo.mWindowVisibility:View.GONE;}},{key:'isEnabled',value:function isEnabled(){return(this.mViewFlags&View.ENABLED_MASK)==View.ENABLED;}},{key:'setEnabled',value:function setEnabled(enabled){if(enabled==this.isEnabled())return;this.setFlags(enabled?View.ENABLED:View.DISABLED,View.ENABLED_MASK);this.refreshDrawableState();this.invalidate(true);}},{key:'dispatchGenericMotionEvent',value:function dispatchGenericMotionEvent(event){if(event.isPointerEvent()){var action=event.getAction();if(action==view_1.MotionEvent.ACTION_HOVER_ENTER||action==view_1.MotionEvent.ACTION_HOVER_MOVE||action==view_1.MotionEvent.ACTION_HOVER_EXIT){}else if(this.dispatchGenericPointerEvent(event)){return true;}}if(this.dispatchGenericMotionEventInternal(event)){return true;}return false;}},{key:'dispatchGenericMotionEventInternal',value:function dispatchGenericMotionEventInternal(event){var li=this.mListenerInfo;if(li!=null&&li.mOnGenericMotionListener!=null&&(this.mViewFlags&View.ENABLED_MASK)==View.ENABLED&&li.mOnGenericMotionListener.onGenericMotion(this,event)){return true;}if(this.onGenericMotionEvent(event)){return true;}return false;}},{key:'onGenericMotionEvent',value:function onGenericMotionEvent(event){return false;}},{key:'dispatchGenericPointerEvent',value:function dispatchGenericPointerEvent(event){return false;}},{key:'dispatchKeyEvent',value:function dispatchKeyEvent(event){var li=this.mListenerInfo;if(li!=null&&li.mOnKeyListener!=null&&(this.mViewFlags&View.ENABLED_MASK)==View.ENABLED&&li.mOnKeyListener.onKey(this,event.getKeyCode(),event)){return true;}if(event.dispatch(this,this.mAttachInfo!=null?this.mAttachInfo.mKeyDispatchState:null,this)){return true;}return false;}},{key:'setOnKeyListener',value:function setOnKeyListener(l){if(typeof l==\"function\"){l=View.OnKeyListener.fromFunction(l);}this.getListenerInfo().mOnKeyListener=l;}},{key:'getKeyDispatcherState',value:function getKeyDispatcherState(){return this.mAttachInfo!=null?this.mAttachInfo.mKeyDispatchState:null;}},{key:'onKeyDown',value:function onKeyDown(keyCode,event){var result=false;if(KeyEvent.isConfirmKey(keyCode)){if((this.mViewFlags&View.ENABLED_MASK)==View.DISABLED){return true;}if(((this.mViewFlags&View.CLICKABLE)==View.CLICKABLE||(this.mViewFlags&View.LONG_CLICKABLE)==View.LONG_CLICKABLE)&&event.getRepeatCount()==0){this.setPressed(true);this.checkForLongClick(0);return true;}}return result;}},{key:'onKeyLongPress',value:function onKeyLongPress(keyCode,event){return false;}},{key:'onKeyUp',value:function onKeyUp(keyCode,event){if(KeyEvent.isConfirmKey(keyCode)){if((this.mViewFlags&View.ENABLED_MASK)==View.DISABLED){return true;}if((this.mViewFlags&View.CLICKABLE)==View.CLICKABLE&&this.isPressed()){this.setPressed(false);if(!this.mHasPerformedLongPress){this.removeLongPressCallback();return this.performClick();}}}return false;}},{key:'dispatchTouchEvent',value:function dispatchTouchEvent(event){if(this.onFilterTouchEventForSecurity(event)){var li=this.mListenerInfo;if(li!=null&&li.mOnTouchListener!=null&&(this.mViewFlags&View.ENABLED_MASK)==View.ENABLED&&li.mOnTouchListener.onTouch(this,event)){return true;}if(this.onTouchEvent(event)){return true;}}return false;}},{key:'onFilterTouchEventForSecurity',value:function onFilterTouchEventForSecurity(event){return true;}},{key:'onTouchEvent',value:function onTouchEvent(event){var viewFlags=this.mViewFlags;if((viewFlags&View.ENABLED_MASK)==View.DISABLED){if(event.getAction()==view_1.MotionEvent.ACTION_UP&&(this.mPrivateFlags&View.PFLAG_PRESSED)!=0){this.setPressed(false);}return(viewFlags&View.CLICKABLE)==View.CLICKABLE||(viewFlags&View.LONG_CLICKABLE)==View.LONG_CLICKABLE;}if(this.mTouchDelegate!=null){if(this.mTouchDelegate.onTouchEvent(event)){return true;}}if((viewFlags&View.CLICKABLE)==View.CLICKABLE||(viewFlags&View.LONG_CLICKABLE)==View.LONG_CLICKABLE){switch(event.getAction()){case view_1.MotionEvent.ACTION_UP:var prepressed=(this.mPrivateFlags&View.PFLAG_PREPRESSED)!=0;if((this.mPrivateFlags&View.PFLAG_PRESSED)!=0||prepressed){var focusTaken=false;if(this.isFocusable()&&this.isFocusableInTouchMode()&&!this.isFocused()){focusTaken=this.requestFocus();}if(prepressed){this.setPressed(true);}if(!this.mHasPerformedLongPress){this.removeLongPressCallback();if(!focusTaken){if(this.mPerformClick==null){this.mPerformClick=new PerformClick(this);}if(prepressed){if(this.mPerformClickAfterPressDraw==null){this.mPerformClickAfterPressDraw=new PerformClickAfterPressDraw(this);}this.post(this.mPerformClickAfterPressDraw);}else if(!this.post(this.mPerformClick)){this.performClick(event);}}}if(this.mUnsetPressedState==null){this.mUnsetPressedState=new UnsetPressedState(this);}if(prepressed){this.postDelayed(this.mUnsetPressedState,view_1.ViewConfiguration.getPressedStateDuration());}else if(!this.post(this.mUnsetPressedState)){this.mUnsetPressedState.run();}this.removeTapCallback();}break;case view_1.MotionEvent.ACTION_DOWN:this.mHasPerformedLongPress=false;var isInScrollingContainer=this.isInScrollingContainer();if(isInScrollingContainer){this.mPrivateFlags|=View.PFLAG_PREPRESSED;if(this.mPendingCheckForTap==null){this.mPendingCheckForTap=new CheckForTap(this);}this.postDelayed(this.mPendingCheckForTap,view_1.ViewConfiguration.getTapTimeout());}else{this.setPressed(true);this.checkForLongClick(0);}break;case view_1.MotionEvent.ACTION_CANCEL:this.setPressed(false);this.removeTapCallback();this.removeLongPressCallback();break;case view_1.MotionEvent.ACTION_MOVE:var _x80=event.getX();var _y=event.getY();if(!this.pointInView(_x80,_y,this.mTouchSlop)){this.removeTapCallback();if((this.mPrivateFlags&View.PFLAG_PRESSED)!=0){this.removeLongPressCallback();this.setPressed(false);}}break;}return true;}return false;}},{key:'isInScrollingContainer',value:function isInScrollingContainer(){var p=this.getParent();while(p!=null&&p instanceof view_1.ViewGroup){if(p.shouldDelayChildPressedState()){return true;}p=p.getParent();}return false;}},{key:'cancelPendingInputEvents',value:function cancelPendingInputEvents(){this.dispatchCancelPendingInputEvents();}},{key:'dispatchCancelPendingInputEvents',value:function dispatchCancelPendingInputEvents(){this.mPrivateFlags3&=~View.PFLAG3_CALLED_SUPER;this.onCancelPendingInputEvents();if((this.mPrivateFlags3&View.PFLAG3_CALLED_SUPER)!=View.PFLAG3_CALLED_SUPER){throw Error('new SuperNotCalledException(\"View \" + this.getClass().getSimpleName() + \" did not call through to super.onCancelPendingInputEvents()\")');}}},{key:'onCancelPendingInputEvents',value:function onCancelPendingInputEvents(){this.removePerformClickCallback();this.cancelLongPress();this.mPrivateFlags3|=View.PFLAG3_CALLED_SUPER;}},{key:'removeLongPressCallback',value:function removeLongPressCallback(){if(this.mPendingCheckForLongPress!=null){this.removeCallbacks(this.mPendingCheckForLongPress);}}},{key:'removePerformClickCallback',value:function removePerformClickCallback(){if(this.mPerformClick!=null){this.removeCallbacks(this.mPerformClick);}if(this.mPerformClickAfterPressDraw!=null){this.removeCallbacks(this.mPerformClickAfterPressDraw);}}},{key:'removeUnsetPressCallback',value:function removeUnsetPressCallback(){if((this.mPrivateFlags&View.PFLAG_PRESSED)!=0&&this.mUnsetPressedState!=null){this.setPressed(false);this.removeCallbacks(this.mUnsetPressedState);}}},{key:'removeTapCallback',value:function removeTapCallback(){if(this.mPendingCheckForTap!=null){this.mPrivateFlags&=~View.PFLAG_PREPRESSED;this.removeCallbacks(this.mPendingCheckForTap);}}},{key:'cancelLongPress',value:function cancelLongPress(){this.removeLongPressCallback();this.removeTapCallback();}},{key:'setTouchDelegate',value:function setTouchDelegate(delegate){this.mTouchDelegate=delegate;}},{key:'getTouchDelegate',value:function getTouchDelegate(){return this.mTouchDelegate;}},{key:'getListenerInfo',value:function getListenerInfo(){if(this.mListenerInfo!=null){return this.mListenerInfo;}this.mListenerInfo=new View.ListenerInfo();return this.mListenerInfo;}},{key:'addOnLayoutChangeListener',value:function addOnLayoutChangeListener(listener){var li=this.getListenerInfo();if(li.mOnLayoutChangeListeners==null){li.mOnLayoutChangeListeners=new ArrayList();}if(!li.mOnLayoutChangeListeners.contains(listener)){li.mOnLayoutChangeListeners.add(listener);}}},{key:'removeOnLayoutChangeListener',value:function removeOnLayoutChangeListener(listener){var li=this.mListenerInfo;if(li==null||li.mOnLayoutChangeListeners==null){return;}li.mOnLayoutChangeListeners.remove(listener);}},{key:'addOnAttachStateChangeListener',value:function addOnAttachStateChangeListener(listener){var li=this.getListenerInfo();if(li.mOnAttachStateChangeListeners==null){li.mOnAttachStateChangeListeners=new CopyOnWriteArrayList();}li.mOnAttachStateChangeListeners.add(listener);}},{key:'removeOnAttachStateChangeListener',value:function removeOnAttachStateChangeListener(listener){var li=this.mListenerInfo;if(li==null||li.mOnAttachStateChangeListeners==null){return;}li.mOnAttachStateChangeListeners.remove(listener);}},{key:'setOnClickListenerByAttrValueString',value:function setOnClickListenerByAttrValueString(onClickAttrString){this.setOnClickListener(function(view){if(!onClickAttrString)return;var activityClickMethod=view.getContext()[onClickAttrString];if(typeof activityClickMethod==='function'){try{activityClickMethod.call(view.getContext(),view);}catch(e){console.error(e);throw new Error('Could not execute method \\''+onClickAttrString+'\\' of the activity');}return;}else{try{new Function(onClickAttrString).call(view);}catch(e){console.error(e);throw new Error(\"Could not execute or find a method \"+onClickAttrString+\"(View) in the activity \"+view.getContext().constructor.name+\" for onClick handler\"+\" on view \"+view.getClass()+view.getId());}}});}},{key:'setOnClickListener',value:function setOnClickListener(l){if(!this.isClickable()){this.setClickable(true);}if(typeof l==\"function\"){l=View.OnClickListener.fromFunction(l);}this.getListenerInfo().mOnClickListener=l;}},{key:'hasOnClickListeners',value:function hasOnClickListeners(){var li=this.mListenerInfo;return li!=null&&li.mOnClickListener!=null;}},{key:'setOnLongClickListener',value:function setOnLongClickListener(l){if(!this.isLongClickable()){this.setLongClickable(true);}if(typeof l==\"function\"){l=View.OnLongClickListener.fromFunction(l);}this.getListenerInfo().mOnLongClickListener=l;}},{key:'playSoundEffect',value:function playSoundEffect(soundConstant){}},{key:'performHapticFeedback',value:function performHapticFeedback(feedbackConstant){return false;}},{key:'performClick',value:function performClick(event){var li=this.mListenerInfo;if(li!=null&&li.mOnClickListener!=null){li.mOnClickListener.onClick(this);return true;}return false;}},{key:'callOnClick',value:function callOnClick(){var li=this.mListenerInfo;if(li!=null&&li.mOnClickListener!=null){li.mOnClickListener.onClick(this);return true;}return false;}},{key:'performLongClick',value:function performLongClick(){var handled=false;var li=this.mListenerInfo;if(li!=null&&li.mOnLongClickListener!=null){handled=li.mOnLongClickListener.onLongClick(this);}return handled;}},{key:'performButtonActionOnTouchDown',value:function performButtonActionOnTouchDown(event){return false;}},{key:'checkForLongClick',value:function checkForLongClick(){var delayOffset=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;if((this.mViewFlags&View.LONG_CLICKABLE)==View.LONG_CLICKABLE){this.mHasPerformedLongPress=false;if(this.mPendingCheckForLongPress==null){this.mPendingCheckForLongPress=new CheckForLongPress(this);}this.mPendingCheckForLongPress.rememberWindowAttachCount();this.postDelayed(this.mPendingCheckForLongPress,view_1.ViewConfiguration.getLongPressTimeout()-delayOffset);}}},{key:'setOnTouchListener',value:function setOnTouchListener(l){if(typeof l==\"function\"){l=View.OnTouchListener.fromFunction(l);}this.getListenerInfo().mOnTouchListener=l;}},{key:'isClickable',value:function isClickable(){return(this.mViewFlags&View.CLICKABLE)==View.CLICKABLE;}},{key:'setClickable',value:function setClickable(clickable){this.setFlags(clickable?View.CLICKABLE:0,View.CLICKABLE);}},{key:'isLongClickable',value:function isLongClickable(){return(this.mViewFlags&View.LONG_CLICKABLE)==View.LONG_CLICKABLE;}},{key:'setLongClickable',value:function setLongClickable(longClickable){this.setFlags(longClickable?View.LONG_CLICKABLE:0,View.LONG_CLICKABLE);}},{key:'setPressed',value:function setPressed(pressed){var needsRefresh=pressed!=((this.mPrivateFlags&View.PFLAG_PRESSED)==View.PFLAG_PRESSED);if(pressed){this.mPrivateFlags|=View.PFLAG_PRESSED;}else{this.mPrivateFlags&=~View.PFLAG_PRESSED;}if(needsRefresh){this.refreshDrawableState();}this.dispatchSetPressed(pressed);}},{key:'dispatchSetPressed',value:function dispatchSetPressed(pressed){}},{key:'isPressed',value:function isPressed(){return(this.mPrivateFlags&View.PFLAG_PRESSED)==View.PFLAG_PRESSED;}},{key:'setSelected',value:function setSelected(selected){if((this.mPrivateFlags&View.PFLAG_SELECTED)!=0!=selected){this.mPrivateFlags=this.mPrivateFlags&~View.PFLAG_SELECTED|(selected?View.PFLAG_SELECTED:0);if(!selected)this.resetPressedState();this.invalidate(true);this.refreshDrawableState();this.dispatchSetSelected(selected);}}},{key:'dispatchSetSelected',value:function dispatchSetSelected(selected){}},{key:'isSelected',value:function isSelected(){return(this.mPrivateFlags&View.PFLAG_SELECTED)!=0;}},{key:'setActivated',value:function setActivated(activated){if((this.mPrivateFlags&View.PFLAG_ACTIVATED)!=0!=activated){this.mPrivateFlags=this.mPrivateFlags&~View.PFLAG_ACTIVATED|(activated?View.PFLAG_ACTIVATED:0);this.invalidate(true);this.refreshDrawableState();this.dispatchSetActivated(activated);}}},{key:'dispatchSetActivated',value:function dispatchSetActivated(activated){}},{key:'isActivated',value:function isActivated(){return(this.mPrivateFlags&View.PFLAG_ACTIVATED)!=0;}},{key:'getViewTreeObserver',value:function getViewTreeObserver(){if(this.mAttachInfo!=null){return this.mAttachInfo.mViewRootImpl.mTreeObserver;}if(this.mFloatingTreeObserver==null){this.mFloatingTreeObserver=new view_1.ViewTreeObserver();}return this.mFloatingTreeObserver;}},{key:'setLayoutDirection',value:function setLayoutDirection(layoutDirection){}},{key:'getLayoutDirection',value:function getLayoutDirection(){return View.LAYOUT_DIRECTION_LTR;}},{key:'isLayoutRtl',value:function isLayoutRtl(){return this.getLayoutDirection()==View.LAYOUT_DIRECTION_RTL;}},{key:'getTextDirection',value:function getTextDirection(){return View.TEXT_DIRECTION_LTR;}},{key:'setTextDirection',value:function setTextDirection(textDirection){}},{key:'getTextAlignment',value:function getTextAlignment(){return View.TEXT_ALIGNMENT_DEFAULT;}},{key:'setTextAlignment',value:function setTextAlignment(textAlignment){}},{key:'getBaseline',value:function getBaseline(){return-1;}},{key:'isLayoutRequested',value:function isLayoutRequested(){return(this.mPrivateFlags&View.PFLAG_FORCE_LAYOUT)==View.PFLAG_FORCE_LAYOUT;}},{key:'getLayoutParams',value:function getLayoutParams(){return this.mLayoutParams;}},{key:'setLayoutParams',value:function setLayoutParams(params){if(params==null){throw new Error(\"Layout parameters cannot be null\");}this.mLayoutParams=params;var p=this.mParent;if(p instanceof view_1.ViewGroup){p.onSetLayoutParams(this,params);}this.requestLayout();}},{key:'isInLayout',value:function isInLayout(){var viewRoot=this.getViewRootImpl();return viewRoot!=null&&viewRoot.isInLayout();}},{key:'requestLayout',value:function requestLayout(){if(this.mMeasureCache!=null)this.mMeasureCache.clear();if(this.mAttachInfo!=null&&this.mAttachInfo.mViewRequestingLayout==null){var viewRoot=this.getViewRootImpl();if(viewRoot!=null&&viewRoot.isInLayout()){if(!viewRoot.requestLayoutDuringLayout(this)){return;}}this.mAttachInfo.mViewRequestingLayout=this;}this.mPrivateFlags|=View.PFLAG_FORCE_LAYOUT;this.mPrivateFlags|=View.PFLAG_INVALIDATED;if(this.mParent!=null&&!this.mParent.isLayoutRequested()){this.mParent.requestLayout();}if(this.mAttachInfo!=null&&this.mAttachInfo.mViewRequestingLayout==this){this.mAttachInfo.mViewRequestingLayout=null;}}},{key:'forceLayout',value:function forceLayout(){if(this.mMeasureCache!=null)this.mMeasureCache.clear();this.mPrivateFlags|=View.PFLAG_FORCE_LAYOUT;this.mPrivateFlags|=View.PFLAG_INVALIDATED;}},{key:'isLaidOut',value:function isLaidOut(){return(this.mPrivateFlags3&View.PFLAG3_IS_LAID_OUT)==View.PFLAG3_IS_LAID_OUT;}},{key:'layout',value:function layout(l,t,r,b){if((this.mPrivateFlags3&View.PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT)!=0){this.onMeasure(this.mOldWidthMeasureSpec,this.mOldHeightMeasureSpec);this.mPrivateFlags3&=~View.PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT;}var oldL=this.mLeft;var oldT=this.mTop;var oldB=this.mBottom;var oldR=this.mRight;var changed=this.setFrame(l,t,r,b);if(changed||(this.mPrivateFlags&View.PFLAG_LAYOUT_REQUIRED)==View.PFLAG_LAYOUT_REQUIRED){this.onLayout(changed,l,t,r,b);this.mPrivateFlags&=~View.PFLAG_LAYOUT_REQUIRED;var li=this.mListenerInfo;if(li!=null&&li.mOnLayoutChangeListeners!=null){var listenersCopy=li.mOnLayoutChangeListeners.clone();var numListeners=listenersCopy.size();for(var i=0;i<numListeners;++i){listenersCopy.get(i).onLayoutChange(this,l,t,r,b,oldL,oldT,oldR,oldB);}}}this.mPrivateFlags&=~View.PFLAG_FORCE_LAYOUT;this.mPrivateFlags3|=View.PFLAG3_IS_LAID_OUT;}},{key:'onLayout',value:function onLayout(changed,left,top,right,bottom){}},{key:'setFrame',value:function setFrame(left,top,right,bottom){var changed=false;if(View.DBG){Log.i(\"View\",this+\" View.setFrame(\"+left+\",\"+top+\",\"+right+\",\"+bottom+\")\");}if(this.mLeft!=left||this.mRight!=right||this.mTop!=top||this.mBottom!=bottom){changed=true;var drawn=this.mPrivateFlags&View.PFLAG_DRAWN;var oldWidth=this.mRight-this.mLeft;var oldHeight=this.mBottom-this.mTop;var newWidth=right-left;var newHeight=bottom-top;var sizeChanged=newWidth!=oldWidth||newHeight!=oldHeight;this.invalidate(sizeChanged);this.mLeft=left;this.mTop=top;this.mRight=right;this.mBottom=bottom;this.mPrivateFlags|=View.PFLAG_HAS_BOUNDS;if(sizeChanged){if((this.mPrivateFlags&View.PFLAG_PIVOT_EXPLICITLY_SET)==0){if(this.mTransformationInfo!=null){this.mTransformationInfo.mMatrixDirty=true;}}this.sizeChange(newWidth,newHeight,oldWidth,oldHeight);}if((this.mViewFlags&View.VISIBILITY_MASK)==View.VISIBLE){this.mPrivateFlags|=View.PFLAG_DRAWN;this.invalidate(sizeChanged);}this.mPrivateFlags|=drawn;this.mBackgroundSizeChanged=true;}return changed;}},{key:'sizeChange',value:function sizeChange(newWidth,newHeight,oldWidth,oldHeight){this.onSizeChanged(newWidth,newHeight,oldWidth,oldHeight);if(this.mOverlay!=null){this.mOverlay.getOverlayView().setRight(newWidth);this.mOverlay.getOverlayView().setBottom(newHeight);}}},{key:'getHitRect',value:function getHitRect(outRect){this.updateMatrix();var info=this.mTransformationInfo;if(info==null||info.mMatrixIsIdentity||this.mAttachInfo==null){outRect.set(this.mLeft,this.mTop,this.mRight,this.mBottom);}else{var tmpRect=this.mAttachInfo.mTmpTransformRect;tmpRect.set(0,0,this.getWidth(),this.getHeight());info.mMatrix.mapRect(tmpRect);outRect.set(Math.floor(tmpRect.left)+this.mLeft,Math.floor(tmpRect.top)+this.mTop,Math.floor(tmpRect.right)+this.mLeft,Math.floor(tmpRect.bottom)+this.mTop);}}},{key:'getFocusedRect',value:function getFocusedRect(r){this.getDrawingRect(r);}},{key:'getDrawingRect',value:function getDrawingRect(outRect){outRect.left=this.mScrollX;outRect.top=this.mScrollY;outRect.right=this.mScrollX+(this.mRight-this.mLeft);outRect.bottom=this.mScrollY+(this.mBottom-this.mTop);}},{key:'getGlobalVisibleRect',value:function getGlobalVisibleRect(r){var globalOffset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var width=this.mRight-this.mLeft;var height=this.mBottom-this.mTop;if(width>0&&height>0){r.set(0,0,width,height);if(globalOffset!=null){globalOffset.set(-this.mScrollX,-this.mScrollY);}return this.mParent==null||this.mParent.getChildVisibleRect(this,r,globalOffset);}return false;}},{key:'getLocationOnScreen',value:function getLocationOnScreen(location){this.getLocationInWindow(location);var info=this.mAttachInfo;}},{key:'getLocationInWindow',value:function getLocationInWindow(location){if(location==null||location.length<2){throw Error('new IllegalArgumentException(\"location must be an array of two integers\")');}if(this.mAttachInfo==null){location[0]=location[1]=0;return;}var position=this.mAttachInfo.mTmpTransformLocation;position[0]=position[1]=0.0;if(!this.hasIdentityMatrix()){this.getMatrix().mapPoints(position);}position[0]+=this.mLeft;position[1]+=this.mTop;var viewParent=this.mParent;while(viewParent instanceof View){var _view=viewParent;position[0]-=_view.mScrollX;position[1]-=_view.mScrollY;if(!_view.hasIdentityMatrix()){_view.getMatrix().mapPoints(position);}position[0]+=_view.mLeft;position[1]+=_view.mTop;viewParent=_view.mParent;}location[0]=Math.floor(position[0]+0.5);location[1]=Math.floor(position[1]+0.5);}},{key:'getWindowVisibleDisplayFrame',value:function getWindowVisibleDisplayFrame(outRect){if(this.mAttachInfo!=null){var rootView=this.mAttachInfo.mRootView;var xy=[0,0];rootView.getLocationOnScreen(xy);outRect.set(xy[0],xy[1],rootView.getWidth()+xy[0],rootView.getHeight()+xy[1]);return;}var dm=Resources.getSystem().getDisplayMetrics();outRect.set(0,0,dm.widthPixels,dm.heightPixels);}},{key:'isVisibleToUser',value:function isVisibleToUser(){var boundInView=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;if(this.mAttachInfo!=null){if(this.mAttachInfo.mWindowVisibility!=View.VISIBLE){return false;}var current=this;while(current instanceof View){var _view2=current;if(_view2.getAlpha()<=0||_view2.getTransitionAlpha()<=0||_view2.getVisibility()!=View.VISIBLE){return false;}current=_view2.mParent;}var visibleRect=this.mAttachInfo.mTmpInvalRect;var offset=this.mAttachInfo.mPoint;if(!this.getGlobalVisibleRect(visibleRect,offset)){return false;}if(boundInView!=null){visibleRect.offset(-offset.x,-offset.y);return boundInView.intersect(visibleRect);}return true;}return false;}},{key:'getMeasuredWidth',value:function getMeasuredWidth(){return this.mMeasuredWidth&View.MEASURED_SIZE_MASK;}},{key:'getMeasuredWidthAndState',value:function getMeasuredWidthAndState(){return this.mMeasuredWidth;}},{key:'getMeasuredHeight',value:function getMeasuredHeight(){return this.mMeasuredHeight&View.MEASURED_SIZE_MASK;}},{key:'getMeasuredHeightAndState',value:function getMeasuredHeightAndState(){return this.mMeasuredHeight;}},{key:'getMeasuredState',value:function getMeasuredState(){return this.mMeasuredWidth&View.MEASURED_STATE_MASK|this.mMeasuredHeight>>View.MEASURED_HEIGHT_STATE_SHIFT&View.MEASURED_STATE_MASK>>View.MEASURED_HEIGHT_STATE_SHIFT;}},{key:'measure',value:function measure(widthMeasureSpec,heightMeasureSpec){var key=widthMeasureSpec+','+heightMeasureSpec;if(this.mMeasureCache==null)this.mMeasureCache=new Map();if((this.mPrivateFlags&View.PFLAG_FORCE_LAYOUT)==View.PFLAG_FORCE_LAYOUT||widthMeasureSpec!=this.mOldWidthMeasureSpec||heightMeasureSpec!=this.mOldHeightMeasureSpec){this.mPrivateFlags&=~View.PFLAG_MEASURED_DIMENSION_SET;var cacheValue=(this.mPrivateFlags&View.PFLAG_FORCE_LAYOUT)==View.PFLAG_FORCE_LAYOUT?null:this.mMeasureCache.get(key);if(cacheValue==null){this.onMeasure(widthMeasureSpec,heightMeasureSpec);this.mPrivateFlags3&=~View.PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT;}else{this.setMeasuredDimension(cacheValue[0],cacheValue[1]);this.mPrivateFlags3|=View.PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT;}if((this.mPrivateFlags&View.PFLAG_MEASURED_DIMENSION_SET)!=View.PFLAG_MEASURED_DIMENSION_SET){throw new Error(\"onMeasure() did not set the\"+\" measured dimension by calling\"+\" setMeasuredDimension()\");}this.mPrivateFlags|=View.PFLAG_LAYOUT_REQUIRED;}this.mOldWidthMeasureSpec=widthMeasureSpec;this.mOldHeightMeasureSpec=heightMeasureSpec;this.mMeasureCache.set(key,[this.mMeasuredWidth,this.mMeasuredHeight]);}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){this.setMeasuredDimension(View.getDefaultSize(this.getSuggestedMinimumWidth(),widthMeasureSpec),View.getDefaultSize(this.getSuggestedMinimumHeight(),heightMeasureSpec));}},{key:'setMeasuredDimension',value:function setMeasuredDimension(measuredWidth,measuredHeight){this.mMeasuredWidth=measuredWidth;this.mMeasuredHeight=measuredHeight;this.mPrivateFlags|=View.PFLAG_MEASURED_DIMENSION_SET;}},{key:'getSuggestedMinimumHeight',value:function getSuggestedMinimumHeight(){return this.mBackground==null?this.mMinHeight:Math.max(this.mMinHeight,this.mBackground.getMinimumHeight());}},{key:'getSuggestedMinimumWidth',value:function getSuggestedMinimumWidth(){return this.mBackground==null?this.mMinWidth:Math.max(this.mMinWidth,this.mBackground.getMinimumWidth());}},{key:'getMinimumHeight',value:function getMinimumHeight(){return this.mMinHeight;}},{key:'setMinimumHeight',value:function setMinimumHeight(minHeight){this.mMinHeight=minHeight;this.requestLayout();}},{key:'getMinimumWidth',value:function getMinimumWidth(){return this.mMinWidth;}},{key:'setMinimumWidth',value:function setMinimumWidth(minWidth){this.mMinWidth=minWidth;this.requestLayout();}},{key:'getAnimation',value:function getAnimation(){return this.mCurrentAnimation;}},{key:'startAnimation',value:function startAnimation(animation){animation.setStartTime(Animation.START_ON_FIRST_FRAME);this.setAnimation(animation);this.invalidateParentCaches();this.invalidate(true);}},{key:'clearAnimation',value:function clearAnimation(){if(this.mCurrentAnimation!=null){this.mCurrentAnimation.detach();}this.mCurrentAnimation=null;this.invalidateParentIfNeeded();}},{key:'setAnimation',value:function setAnimation(animation){this.mCurrentAnimation=animation;if(animation!=null){animation.reset();}}},{key:'onAnimationStart',value:function onAnimationStart(){this.mPrivateFlags|=View.PFLAG_ANIMATION_STARTED;}},{key:'onAnimationEnd',value:function onAnimationEnd(){this.mPrivateFlags&=~View.PFLAG_ANIMATION_STARTED;}},{key:'onSetAlpha',value:function onSetAlpha(alpha){return false;}},{key:'_invalidateRect',value:function _invalidateRect(l,t,r,b){if(this.skipInvalidate()){return;}if((this.mPrivateFlags&(View.PFLAG_DRAWN|View.PFLAG_HAS_BOUNDS))==(View.PFLAG_DRAWN|View.PFLAG_HAS_BOUNDS)||(this.mPrivateFlags&View.PFLAG_DRAWING_CACHE_VALID)==View.PFLAG_DRAWING_CACHE_VALID||(this.mPrivateFlags&View.PFLAG_INVALIDATED)!=View.PFLAG_INVALIDATED){this.mPrivateFlags&=~View.PFLAG_DRAWING_CACHE_VALID;this.mPrivateFlags|=View.PFLAG_INVALIDATED;this.mPrivateFlags|=View.PFLAG_DIRTY;var p=this.mParent;var ai=this.mAttachInfo;if(p!=null&&ai!=null&&l<r&&t<b){var scrollX=this.mScrollX;var scrollY=this.mScrollY;var tmpr=ai.mTmpInvalRect;tmpr.set(l-scrollX,t-scrollY,r-scrollX,b-scrollY);p.invalidateChild(this,tmpr);}}}},{key:'_invalidateCache',value:function _invalidateCache(){var invalidateCache=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(this.skipInvalidate()){return;}if((this.mPrivateFlags&(View.PFLAG_DRAWN|View.PFLAG_HAS_BOUNDS))==(View.PFLAG_DRAWN|View.PFLAG_HAS_BOUNDS)||invalidateCache&&(this.mPrivateFlags&View.PFLAG_DRAWING_CACHE_VALID)==View.PFLAG_DRAWING_CACHE_VALID||(this.mPrivateFlags&View.PFLAG_INVALIDATED)!=View.PFLAG_INVALIDATED||this.isOpaque()!=this.mLastIsOpaque){this.mLastIsOpaque=this.isOpaque();this.mPrivateFlags&=~View.PFLAG_DRAWN;this.mPrivateFlags|=View.PFLAG_DIRTY;if(invalidateCache){this.mPrivateFlags|=View.PFLAG_INVALIDATED;this.mPrivateFlags&=~View.PFLAG_DRAWING_CACHE_VALID;}var ai=this.mAttachInfo;var p=this.mParent;if(p!=null&&ai!=null){var r=ai.mTmpInvalRect;r.set(0,0,this.mRight-this.mLeft,this.mBottom-this.mTop);p.invalidateChild(this,r);}}}},{key:'invalidate',value:function invalidate(){if(arguments.length===0){this._invalidateCache(true);}else if(arguments.length===1&&(arguments.length<=0?undefined:arguments[0])instanceof Rect){var rect=arguments.length<=0?undefined:arguments[0];this._invalidateRect(rect.left,rect.top,rect.right,rect.bottom);}else if(arguments.length===1){this._invalidateCache(arguments.length<=0?undefined:arguments[0]);}else if(arguments.length===4){this._invalidateRect.apply(this,arguments);}}},{key:'invalidateViewProperty',value:function invalidateViewProperty(invalidateParent,forceRedraw){if((this.mPrivateFlags&View.PFLAG_DRAW_ANIMATION)==View.PFLAG_DRAW_ANIMATION){if(invalidateParent){this.invalidateParentCaches();}if(forceRedraw){this.mPrivateFlags|=View.PFLAG_DRAWN;}this.invalidate(false);}else{var ai=this.mAttachInfo;var p=this.mParent;if(p!=null&&ai!=null){var r=ai.mTmpInvalRect;r.set(0,0,this.mRight-this.mLeft,this.mBottom-this.mTop);if(this.mParent instanceof view_1.ViewGroup){this.mParent.invalidateChildFast(this,r);}else{this.mParent.invalidateChild(this,r);}}}}},{key:'invalidateParentCaches',value:function invalidateParentCaches(){if(this.mParent instanceof View){this.mParent.mPrivateFlags|=View.PFLAG_INVALIDATED;}}},{key:'invalidateParentIfNeeded',value:function invalidateParentIfNeeded(){}},{key:'postInvalidate',value:function postInvalidate(l,t,r,b){this.postInvalidateDelayed(0,l,t,r,b);}},{key:'postInvalidateDelayed',value:function postInvalidateDelayed(delayMilliseconds,left,top,right,bottom){var attachInfo=this.mAttachInfo;if(attachInfo!=null){if(!Number.isInteger(left)||!Number.isInteger(top)||!Number.isInteger(right)||!Number.isInteger(bottom)){attachInfo.mViewRootImpl.dispatchInvalidateDelayed(this,delayMilliseconds);}else{var info=View.AttachInfo.InvalidateInfo.obtain();info.target=this;info.left=left;info.top=top;info.right=right;info.bottom=bottom;attachInfo.mViewRootImpl.dispatchInvalidateRectDelayed(info,delayMilliseconds);}}}},{key:'postInvalidateOnAnimation',value:function postInvalidateOnAnimation(left,top,right,bottom){var attachInfo=this.mAttachInfo;if(attachInfo!=null){if(!Number.isInteger(left)||!Number.isInteger(top)||!Number.isInteger(right)||!Number.isInteger(bottom)){attachInfo.mViewRootImpl.dispatchInvalidateOnAnimation(this);}else{var info=View.AttachInfo.InvalidateInfo.obtain();info.target=this;info.left=left;info.top=top;info.right=right;info.bottom=bottom;attachInfo.mViewRootImpl.dispatchInvalidateRectOnAnimation(info);}}}},{key:'skipInvalidate',value:function skipInvalidate(){return(this.mViewFlags&View.VISIBILITY_MASK)!=View.VISIBLE&&this.mCurrentAnimation==null;}},{key:'isOpaque',value:function isOpaque(){return(this.mPrivateFlags&View.PFLAG_OPAQUE_MASK)==View.PFLAG_OPAQUE_MASK&&this.getFinalAlpha()>=1;}},{key:'computeOpaqueFlags',value:function computeOpaqueFlags(){if(this.mBackground!=null&&this.mBackground.getOpacity()==PixelFormat.OPAQUE){this.mPrivateFlags|=View.PFLAG_OPAQUE_BACKGROUND;}else{this.mPrivateFlags&=~View.PFLAG_OPAQUE_BACKGROUND;}var flags=this.mViewFlags;if((flags&View.SCROLLBARS_VERTICAL)==0&&(flags&View.SCROLLBARS_HORIZONTAL)==0){this.mPrivateFlags|=View.PFLAG_OPAQUE_SCROLLBARS;}else{this.mPrivateFlags&=~View.PFLAG_OPAQUE_SCROLLBARS;}}},{key:'setLayerType',value:function setLayerType(layerType){if(layerType<View.LAYER_TYPE_NONE||layerType>View.LAYER_TYPE_SOFTWARE){throw Error('new IllegalArgumentException(\"Layer type can only be one of: LAYER_TYPE_NONE, \" + \"LAYER_TYPE_SOFTWARE\")');}if(layerType==this.mLayerType){return;}switch(this.mLayerType){case View.LAYER_TYPE_SOFTWARE:this.destroyDrawingCache();break;default:break;}this.mLayerType=layerType;var layerDisabled=this.mLayerType==View.LAYER_TYPE_NONE;this.mLocalDirtyRect=layerDisabled?null:new Rect();this.invalidateParentCaches();this.invalidate(true);}},{key:'getLayerType',value:function getLayerType(){return this.mLayerType;}},{key:'setClipBounds',value:function setClipBounds(clipBounds){if(clipBounds!=null){if(clipBounds.equals(this.mClipBounds)){return;}if(this.mClipBounds==null){this.invalidate();this.mClipBounds=new Rect(clipBounds);}else{this.invalidate(Math.min(this.mClipBounds.left,clipBounds.left),Math.min(this.mClipBounds.top,clipBounds.top),Math.max(this.mClipBounds.right,clipBounds.right),Math.max(this.mClipBounds.bottom,clipBounds.bottom));this.mClipBounds.set(clipBounds);}}else{if(this.mClipBounds!=null){this.invalidate();this.mClipBounds=null;}}}},{key:'getClipBounds',value:function getClipBounds(){return this.mClipBounds!=null?new Rect(this.mClipBounds):null;}},{key:'setCornerRadius',value:function setCornerRadius(radiusTopLeft){var radiusTopRight=arguments.length>1&&arguments[1]!==undefined?arguments[1]:radiusTopLeft;var radiusBottomRight=arguments.length>2&&arguments[2]!==undefined?arguments[2]:radiusTopRight;var radiusBottomLeft=arguments.length>3&&arguments[3]!==undefined?arguments[3]:radiusBottomRight;this.setCornerRadiusTopLeft(radiusTopLeft);this.setCornerRadiusTopRight(radiusTopRight);this.setCornerRadiusBottomRight(radiusBottomRight);this.setCornerRadiusBottomLeft(radiusBottomLeft);}},{key:'setCornerRadiusTopLeft',value:function setCornerRadiusTopLeft(value){if(this.mCornerRadiusTopLeft!=value){this.mCornerRadiusTopLeft=value;this.mShadowDrawable=null;this.invalidate();}}},{key:'getCornerRadiusTopLeft',value:function getCornerRadiusTopLeft(){return this.mCornerRadiusTopLeft;}},{key:'setCornerRadiusTopRight',value:function setCornerRadiusTopRight(value){if(this.mCornerRadiusTopRight!=value){this.mCornerRadiusTopRight=value;this.mShadowDrawable=null;this.invalidate();}}},{key:'getCornerRadiusTopRight',value:function getCornerRadiusTopRight(){return this.mCornerRadiusTopRight;}},{key:'setCornerRadiusBottomRight',value:function setCornerRadiusBottomRight(value){if(this.mCornerRadiusBottomRight!=value){this.mCornerRadiusBottomRight=value;this.mShadowDrawable=null;this.invalidate();}}},{key:'getCornerRadiusBottomRight',value:function getCornerRadiusBottomRight(){return this.mCornerRadiusBottomRight;}},{key:'setCornerRadiusBottomLeft',value:function setCornerRadiusBottomLeft(value){if(this.mCornerRadiusBottomLeft!=value){this.mCornerRadiusBottomLeft=value;this.mShadowDrawable=null;this.invalidate();}}},{key:'getCornerRadiusBottomLeft',value:function getCornerRadiusBottomLeft(){return this.mCornerRadiusBottomLeft;}},{key:'setShadowView',value:function setShadowView(radius,dx,dy,color){if(!this.mShadowPaint)this.mShadowPaint=new Paint();this.mShadowPaint.setShadowLayer(radius,dx,dy,color);this.invalidate();}},{key:'getDrawingTime',value:function getDrawingTime(){return this.getViewRootImpl()!=null?this.getViewRootImpl().mDrawingTime:0;}},{key:'drawFromParent',value:function drawFromParent(canvas,parent,drawingTime){var useDisplayListProperties=false;var more=false;var childHasIdentityMatrix=this.hasIdentityMatrix();var flags=parent.mGroupFlags;if((flags&view_1.ViewGroup.FLAG_CLEAR_TRANSFORMATION)==view_1.ViewGroup.FLAG_CLEAR_TRANSFORMATION){parent.getChildTransformation().clear();parent.mGroupFlags&=~view_1.ViewGroup.FLAG_CLEAR_TRANSFORMATION;}var transformToApply=null;var concatMatrix=false;var scalingRequired=false;var caching=false;var layerType=this.getLayerType();var hardwareAccelerated=false;var nativeAccelerated=canvas.isNativeAccelerated();if((flags&view_1.ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE)!=0||(flags&view_1.ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE)!=0){caching=true;}else{caching=layerType!=View.LAYER_TYPE_NONE||hardwareAccelerated||nativeAccelerated;}var a=this.getAnimation();if(a!=null){more=this.drawAnimation(parent,drawingTime,a,scalingRequired);concatMatrix=a.willChangeTransformationMatrix();if(concatMatrix){this.mPrivateFlags3|=View.PFLAG3_VIEW_IS_ANIMATING_TRANSFORM;}transformToApply=parent.getChildTransformation();}else{if(!useDisplayListProperties&&(flags&view_1.ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS)!=0){var t=parent.getChildTransformation();var hasTransform=parent.getChildStaticTransformation(this,t);if(hasTransform){var transformType=t.getTransformationType();transformToApply=transformType!=Transformation.TYPE_IDENTITY?t:null;concatMatrix=(transformType&Transformation.TYPE_MATRIX)!=0;}}}concatMatrix=!childHasIdentityMatrix||concatMatrix;this.mPrivateFlags|=View.PFLAG_DRAWN;if(!concatMatrix&&(flags&(view_1.ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS|view_1.ViewGroup.FLAG_CLIP_CHILDREN))==view_1.ViewGroup.FLAG_CLIP_CHILDREN&&canvas.quickReject(this.mLeft,this.mTop,this.mRight,this.mBottom)&&(this.mPrivateFlags&View.PFLAG_DRAW_ANIMATION)==0){this.mPrivateFlags2|=View.PFLAG2_VIEW_QUICK_REJECTED;return more;}this.mPrivateFlags2&=~View.PFLAG2_VIEW_QUICK_REJECTED;var cache=null;if(caching){if(layerType!=View.LAYER_TYPE_NONE){layerType=View.LAYER_TYPE_SOFTWARE;this.buildDrawingCache(true);}cache=this.getDrawingCache(true);}this.computeScroll();var sx=this.mScrollX;var sy=this.mScrollY;this.requestSyncBoundToElement();var hasNoCache=cache==null;var offsetForScroll=cache==null;var restoreTo=canvas.save();if(offsetForScroll){canvas.translate(this.mLeft-sx,this.mTop-sy);}else{canvas.translate(this.mLeft,this.mTop);}var alpha=this.getAlpha()*this.getTransitionAlpha();if(transformToApply!=null||alpha<1||!this.hasIdentityMatrix()||(this.mPrivateFlags3&View.PFLAG3_VIEW_IS_ANIMATING_ALPHA)==View.PFLAG3_VIEW_IS_ANIMATING_ALPHA){if(transformToApply!=null||!childHasIdentityMatrix){var transX=0;var transY=0;if(offsetForScroll){transX=-sx;transY=-sy;}if(transformToApply!=null){if(concatMatrix){canvas.translate(-transX,-transY);canvas.concat(transformToApply.getMatrix());canvas.translate(transX,transY);parent.mGroupFlags|=view_1.ViewGroup.FLAG_CLEAR_TRANSFORMATION;}var transformAlpha=transformToApply.getAlpha();if(transformAlpha<1){alpha*=transformAlpha;parent.mGroupFlags|=view_1.ViewGroup.FLAG_CLEAR_TRANSFORMATION;}}if(!childHasIdentityMatrix&&!useDisplayListProperties){canvas.translate(-transX,-transY);canvas.concat(this.getMatrix());canvas.translate(transX,transY);}}if(alpha<1||(this.mPrivateFlags3&View.PFLAG3_VIEW_IS_ANIMATING_ALPHA)==View.PFLAG3_VIEW_IS_ANIMATING_ALPHA){if(alpha<1){this.mPrivateFlags3|=View.PFLAG3_VIEW_IS_ANIMATING_ALPHA;}else{this.mPrivateFlags3&=~View.PFLAG3_VIEW_IS_ANIMATING_ALPHA;}parent.mGroupFlags|=view_1.ViewGroup.FLAG_CLEAR_TRANSFORMATION;if(hasNoCache){var multipliedAlpha=Math.floor(255*alpha);if(!this.onSetAlpha(multipliedAlpha)){canvas.multiplyGlobalAlpha(alpha);}else{this.mPrivateFlags|=View.PFLAG_ALPHA_SET;}}}}else if((this.mPrivateFlags&View.PFLAG_ALPHA_SET)==View.PFLAG_ALPHA_SET){this.onSetAlpha(255);this.mPrivateFlags&=~View.PFLAG_ALPHA_SET;}if(this.mShadowPaint!=null)this.drawShadow(canvas);if((flags&view_1.ViewGroup.FLAG_CLIP_CHILDREN)==view_1.ViewGroup.FLAG_CLIP_CHILDREN&&!useDisplayListProperties&&cache==null){if(offsetForScroll){canvas.clipRect(sx,sy,sx+(this.mRight-this.mLeft),sy+(this.mBottom-this.mTop),this.mCornerRadiusTopLeft,this.mCornerRadiusTopRight,this.mCornerRadiusBottomRight,this.mCornerRadiusBottomLeft);}else{if(!scalingRequired||cache==null){canvas.clipRect(0,0,this.mRight-this.mLeft,this.mBottom-this.mTop,this.mCornerRadiusTopLeft,this.mCornerRadiusTopRight,this.mCornerRadiusBottomRight,this.mCornerRadiusBottomLeft);}else{canvas.clipRect(0,0,cache.getWidth(),cache.getHeight(),this.mCornerRadiusTopLeft,this.mCornerRadiusTopRight,this.mCornerRadiusBottomRight,this.mCornerRadiusBottomLeft);}}}if(hasNoCache){if((this.mPrivateFlags&View.PFLAG_SKIP_DRAW)==View.PFLAG_SKIP_DRAW){this.mPrivateFlags&=~View.PFLAG_DIRTY_MASK;this.dispatchDraw(canvas);}else{this.draw(canvas);}}else if(cache!=null){this.mPrivateFlags&=~View.PFLAG_DIRTY_MASK;canvas.multiplyGlobalAlpha(alpha);if(layerType==View.LAYER_TYPE_NONE){if(alpha<1){parent.mGroupFlags|=view_1.ViewGroup.FLAG_ALPHA_LOWER_THAN_ONE;}else if((flags&view_1.ViewGroup.FLAG_ALPHA_LOWER_THAN_ONE)!=0){parent.mGroupFlags&=~view_1.ViewGroup.FLAG_ALPHA_LOWER_THAN_ONE;}}canvas.clipRect(0,0,cache.getWidth(),cache.getHeight(),this.mCornerRadiusTopLeft,this.mCornerRadiusTopRight,this.mCornerRadiusBottomRight,this.mCornerRadiusBottomLeft);canvas.drawCanvas(cache,0,0);}if(restoreTo>=0){canvas.restoreToCount(restoreTo);}if(a!=null&&!more){if(!hardwareAccelerated&&!a.getFillAfter()){this.onSetAlpha(255);}parent.finishAnimatingView(this,a);}return more;}},{key:'drawShadow',value:function drawShadow(canvas){var shadowPaint=this.mShadowPaint;if(!shadowPaint||!shadowPaint.shadowRadius)return;var color=shadowPaint.shadowColor;if(!this.mShadowDrawable){var drawable=new RoundRectDrawable(shadowPaint.shadowColor,this.mCornerRadiusTopLeft,this.mCornerRadiusTopRight,this.mCornerRadiusBottomLeft,this.mCornerRadiusBottomRight);this.mShadowDrawable=new ShadowDrawable(drawable,shadowPaint.shadowRadius,shadowPaint.shadowDx,shadowPaint.shadowDy,shadowPaint.shadowColor);}this.mShadowDrawable.draw(canvas);}},{key:'draw',value:function draw(canvas){if(this.mClipBounds!=null){canvas.clipRect(this.mClipBounds);}var privateFlags=this.mPrivateFlags;var dirtyOpaque=(privateFlags&View.PFLAG_DIRTY_MASK)==View.PFLAG_DIRTY_OPAQUE&&(this.getViewRootImpl()==null||!this.getViewRootImpl().mIgnoreDirtyState);this.mPrivateFlags=privateFlags&~View.PFLAG_DIRTY_MASK|View.PFLAG_DRAWN;if(!dirtyOpaque){var _background=this.mBackground;if(_background!=null){var scrollX=this.mScrollX;var scrollY=this.mScrollY;if(this.mBackgroundSizeChanged){_background.setBounds(0,0,this.mRight-this.mLeft,this.mBottom-this.mTop);this.mBackgroundSizeChanged=false;}if((scrollX|scrollY)==0){_background.draw(canvas);}else{canvas.translate(scrollX,scrollY);_background.draw(canvas);canvas.translate(-scrollX,-scrollY);}}}if(!dirtyOpaque)this.onDraw(canvas);this.dispatchDraw(canvas);this.onDrawScrollBars(canvas);if(this.mOverlay!=null&&!this.mOverlay.isEmpty()){this.mOverlay.getOverlayView().dispatchDraw(canvas);}}},{key:'onDraw',value:function onDraw(canvas){}},{key:'dispatchDraw',value:function dispatchDraw(canvas){}},{key:'drawAnimation',value:function drawAnimation(parent,drawingTime,a,scalingRequired){var invalidationTransform=void 0;var flags=parent.mGroupFlags;var initialized=a.isInitialized();if(!initialized){a.initialize(this.mRight-this.mLeft,this.mBottom-this.mTop,parent.getWidth(),parent.getHeight());a.initializeInvalidateRegion(0,0,this.mRight-this.mLeft,this.mBottom-this.mTop);if(this.mAttachInfo!=null)a.setListenerHandler(this.mAttachInfo.mHandler);this.onAnimationStart();}var t=parent.getChildTransformation();var more=a.getTransformation(drawingTime,t,1);invalidationTransform=t;if(more){if(!a.willChangeBounds()){if((flags&(view_1.ViewGroup.FLAG_OPTIMIZE_INVALIDATE|view_1.ViewGroup.FLAG_ANIMATION_DONE))==view_1.ViewGroup.FLAG_OPTIMIZE_INVALIDATE){parent.mGroupFlags|=view_1.ViewGroup.FLAG_INVALIDATE_REQUIRED;}else if((flags&view_1.ViewGroup.FLAG_INVALIDATE_REQUIRED)==0){parent.mPrivateFlags|=View.PFLAG_DRAW_ANIMATION;parent.invalidate(this.mLeft,this.mTop,this.mRight,this.mBottom);}}else{if(parent.mInvalidateRegion==null){parent.mInvalidateRegion=new RectF();}var region=parent.mInvalidateRegion;a.getInvalidateRegion(0,0,this.mRight-this.mLeft,this.mBottom-this.mTop,region,invalidationTransform);parent.mPrivateFlags|=View.PFLAG_DRAW_ANIMATION;var left=this.mLeft+Math.floor(region.left);var top=this.mTop+Math.floor(region.top);parent.invalidate(left,top,left+Math.floor(region.width()+.5),top+Math.floor(region.height()+.5));}}return more;}},{key:'onDrawScrollBars',value:function onDrawScrollBars(canvas){var cache=this.mScrollCache;if(cache!=null){var state=cache.state;if(state==ScrollabilityCache.OFF){return;}var invalidate=false;if(state==ScrollabilityCache.FADING){cache._computeAlphaToScrollBar();invalidate=true;}else{cache.scrollBar.setAlpha(255);}var viewFlags=this.mViewFlags;var drawHorizontalScrollBar=(viewFlags&View.SCROLLBARS_HORIZONTAL)==View.SCROLLBARS_HORIZONTAL;var drawVerticalScrollBar=(viewFlags&View.SCROLLBARS_VERTICAL)==View.SCROLLBARS_VERTICAL&&!this.isVerticalScrollBarHidden();if(drawVerticalScrollBar||drawHorizontalScrollBar){var width=this.mRight-this.mLeft;var height=this.mBottom-this.mTop;var scrollBar=cache.scrollBar;var scrollX=this.mScrollX;var scrollY=this.mScrollY;var inside=true;var left=void 0;var top=void 0;var right=void 0;var bottom=void 0;if(drawHorizontalScrollBar){var size=scrollBar.getSize(false);if(size<=0){size=cache.scrollBarSize;}scrollBar.setParameters(this.computeHorizontalScrollRange(),this.computeHorizontalScrollOffset(),this.computeHorizontalScrollExtent(),false);var verticalScrollBarGap=drawVerticalScrollBar?this.getVerticalScrollbarWidth():0;top=scrollY+height-size;left=scrollX+this.mPaddingLeft;right=scrollX+width- -verticalScrollBarGap;bottom=top+size;this.onDrawHorizontalScrollBar(canvas,scrollBar,left,top,right,bottom);if(invalidate){this.invalidate(left,top,right,bottom);}}if(drawVerticalScrollBar){var _size=scrollBar.getSize(true);if(_size<=0){_size=cache.scrollBarSize;}scrollBar.setParameters(this.computeVerticalScrollRange(),this.computeVerticalScrollOffset(),this.computeVerticalScrollExtent(),true);left=scrollX+width-_size;top=scrollY+this.mPaddingTop;right=left+_size;bottom=scrollY+height;this.onDrawVerticalScrollBar(canvas,scrollBar,left,top,right,bottom);if(invalidate){this.invalidate(left,top,right,bottom);}}}}}},{key:'isVerticalScrollBarHidden',value:function isVerticalScrollBarHidden(){return false;}},{key:'onDrawHorizontalScrollBar',value:function onDrawHorizontalScrollBar(canvas,scrollBar,l,t,r,b){scrollBar.setBounds(l,t,r,b);scrollBar.draw(canvas);}},{key:'onDrawVerticalScrollBar',value:function onDrawVerticalScrollBar(canvas,scrollBar,l,t,r,b){scrollBar.setBounds(l,t,r,b);scrollBar.draw(canvas);}},{key:'isHardwareAccelerated',value:function isHardwareAccelerated(){return false;}},{key:'setDrawingCacheEnabled',value:function setDrawingCacheEnabled(enabled){this.mCachingFailed=false;this.setFlags(enabled?View.DRAWING_CACHE_ENABLED:0,View.DRAWING_CACHE_ENABLED);}},{key:'isDrawingCacheEnabled',value:function isDrawingCacheEnabled(){return(this.mViewFlags&View.DRAWING_CACHE_ENABLED)==View.DRAWING_CACHE_ENABLED;}},{key:'getDrawingCache',value:function getDrawingCache(){var autoScale=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if((this.mViewFlags&View.WILL_NOT_CACHE_DRAWING)==View.WILL_NOT_CACHE_DRAWING){return null;}if((this.mViewFlags&View.DRAWING_CACHE_ENABLED)==View.DRAWING_CACHE_ENABLED){this.buildDrawingCache(autoScale);}return this.mUnscaledDrawingCache;}},{key:'setDrawingCacheBackgroundColor',value:function setDrawingCacheBackgroundColor(color){if(color!=this.mDrawingCacheBackgroundColor){this.mDrawingCacheBackgroundColor=color;this.mPrivateFlags&=~View.PFLAG_DRAWING_CACHE_VALID;}}},{key:'getDrawingCacheBackgroundColor',value:function getDrawingCacheBackgroundColor(){return this.mDrawingCacheBackgroundColor;}},{key:'destroyDrawingCache',value:function destroyDrawingCache(){if(this.mUnscaledDrawingCache!=null){this.mUnscaledDrawingCache.recycle();this.mUnscaledDrawingCache=null;}}},{key:'buildDrawingCache',value:function buildDrawingCache(){var autoScale=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if((this.mPrivateFlags&View.PFLAG_DRAWING_CACHE_VALID)==0||this.mUnscaledDrawingCache==null){this.mCachingFailed=false;var width=this.mRight-this.mLeft;var height=this.mBottom-this.mTop;var attachInfo=this.mAttachInfo;var drawingCacheBackgroundColor=this.mDrawingCacheBackgroundColor;var opaque=drawingCacheBackgroundColor!=0||this.isOpaque();var projectedBitmapSize=width*height*4;var drawingCacheSize=view_1.ViewConfiguration.get().getScaledMaximumDrawingCacheSize();if(width<=0||height<=0||projectedBitmapSize>drawingCacheSize){if(width>0&&height>0){Log.w(View.VIEW_LOG_TAG,\"View too large to fit into drawing cache, needs \"+projectedBitmapSize+\" bytes, only \"+drawingCacheSize+\" available\");}this.destroyDrawingCache();this.mCachingFailed=true;return;}if(this.mUnscaledDrawingCache&&(this.mUnscaledDrawingCache.getWidth()!==width||this.mUnscaledDrawingCache.getHeight()!==height)){this.mUnscaledDrawingCache.recycle();this.mUnscaledDrawingCache=null;}if(this.mUnscaledDrawingCache){this.mUnscaledDrawingCache.clearColor();}else{this.mUnscaledDrawingCache=new Canvas(width,height);}var canvas=this.mUnscaledDrawingCache;this.computeScroll();var restoreCount=canvas.save();canvas.translate(-this.mScrollX,-this.mScrollY);this.mPrivateFlags|=View.PFLAG_DRAWN;if(this.mAttachInfo==null||this.mLayerType!=View.LAYER_TYPE_NONE){this.mPrivateFlags|=View.PFLAG_DRAWING_CACHE_VALID;}if((this.mPrivateFlags&View.PFLAG_SKIP_DRAW)==View.PFLAG_SKIP_DRAW){this.mPrivateFlags&=~View.PFLAG_DIRTY_MASK;this.dispatchDraw(canvas);if(this.mOverlay!=null&&!this.mOverlay.isEmpty()){this.mOverlay.getOverlayView().draw(canvas);}}else{this.draw(canvas);}canvas.restoreToCount(restoreCount);}}},{key:'setWillNotDraw',value:function setWillNotDraw(willNotDraw){this.setFlags(willNotDraw?View.WILL_NOT_DRAW:0,View.DRAW_MASK);}},{key:'willNotDraw',value:function willNotDraw(){return(this.mViewFlags&View.DRAW_MASK)==View.WILL_NOT_DRAW;}},{key:'setWillNotCacheDrawing',value:function setWillNotCacheDrawing(willNotCacheDrawing){this.setFlags(willNotCacheDrawing?View.WILL_NOT_CACHE_DRAWING:0,View.WILL_NOT_CACHE_DRAWING);}},{key:'willNotCacheDrawing',value:function willNotCacheDrawing(){return(this.mViewFlags&View.WILL_NOT_CACHE_DRAWING)==View.WILL_NOT_CACHE_DRAWING;}},{key:'drawableSizeChange',value:function drawableSizeChange(who){if(who===this.mBackground){var w=who.getIntrinsicWidth();if(w<0)w=this.mBackgroundWidth;var h=who.getIntrinsicHeight();if(h<0)h=this.mBackgroundHeight;if(w!=this.mBackgroundWidth||h!=this.mBackgroundHeight){var _padding=new Rect();if(who.getPadding(_padding)){this.setPadding(_padding.left,_padding.top,_padding.right,_padding.bottom);}this.mBackgroundWidth=w;this.mBackgroundHeight=h;this.requestLayout();}}else if(this.verifyDrawable(who)){this.requestLayout();}}},{key:'invalidateDrawable',value:function invalidateDrawable(drawable){if(this.verifyDrawable(drawable)){var dirty=drawable.getBounds();var scrollX=this.mScrollX;var scrollY=this.mScrollY;this.invalidate(dirty.left+scrollX,dirty.top+scrollY,dirty.right+scrollX,dirty.bottom+scrollY);}}},{key:'scheduleDrawable',value:function scheduleDrawable(who,what,when){if(this.verifyDrawable(who)&&what!=null){var delay=when-SystemClock.uptimeMillis();if(this.mAttachInfo!=null){this.mAttachInfo.mHandler.postAtTime(what,who,when);}else{view_1.ViewRootImpl.getRunQueue().postDelayed(what,delay);}}}},{key:'unscheduleDrawable',value:function unscheduleDrawable(who,what){if(this.verifyDrawable(who)&&what!=null){if(this.mAttachInfo!=null){this.mAttachInfo.mHandler.removeCallbacks(what,who);}else{view_1.ViewRootImpl.getRunQueue().removeCallbacks(what);}}else if(what===null){if(this.mAttachInfo!=null&&who!=null){this.mAttachInfo.mHandler.removeCallbacksAndMessages(who);}}}},{key:'verifyDrawable',value:function verifyDrawable(who){return who==this.mBackground;}},{key:'drawableStateChanged',value:function drawableStateChanged(){this.getDrawableState();var d=this.mBackground;if(d!=null&&d.isStateful()){d.setState(this.getDrawableState());}}},{key:'resolveDrawables',value:function resolveDrawables(){}},{key:'refreshDrawableState',value:function refreshDrawableState(){this.mPrivateFlags|=View.PFLAG_DRAWABLE_STATE_DIRTY;this.drawableStateChanged();var parent=this.mParent;if(parent!=null){parent.childDrawableStateChanged(this);}}},{key:'getDrawableState',value:function getDrawableState(){if(this.mDrawableState!=null&&(this.mPrivateFlags&View.PFLAG_DRAWABLE_STATE_DIRTY)==0){return this.mDrawableState;}else{var oldDrawableState=this.mDrawableState;this.mDrawableState=this.onCreateDrawableState(0);this.mPrivateFlags&=~View.PFLAG_DRAWABLE_STATE_DIRTY;this._fireStateChangeToAttribute(oldDrawableState,this.mDrawableState);return this.mDrawableState;}}},{key:'onCreateDrawableState',value:function onCreateDrawableState(extraSpace){if((this.mViewFlags&View.DUPLICATE_PARENT_STATE)==View.DUPLICATE_PARENT_STATE&&this.mParent instanceof View){return this.mParent.onCreateDrawableState(extraSpace);}var drawableState=void 0;var privateFlags=this.mPrivateFlags;var viewStateIndex=0;if((privateFlags&View.PFLAG_PRESSED)!=0)viewStateIndex|=View.VIEW_STATE_PRESSED;if((this.mViewFlags&View.ENABLED_MASK)==View.ENABLED)viewStateIndex|=View.VIEW_STATE_ENABLED;if(this.isFocused())viewStateIndex|=View.VIEW_STATE_FOCUSED;if((privateFlags&View.PFLAG_SELECTED)!=0)viewStateIndex|=View.VIEW_STATE_SELECTED;if(this.hasWindowFocus())viewStateIndex|=View.VIEW_STATE_WINDOW_FOCUSED;if((privateFlags&View.PFLAG_ACTIVATED)!=0)viewStateIndex|=View.VIEW_STATE_ACTIVATED;var privateFlags2=this.mPrivateFlags2;drawableState=View.VIEW_STATE_SETS[viewStateIndex];if(extraSpace==0){return drawableState;}var fullState=void 0;if(drawableState!=null){fullState=androidui.util.ArrayCreator.newNumberArray(drawableState.length+extraSpace);System.arraycopy(drawableState,0,fullState,0,drawableState.length);}else{fullState=androidui.util.ArrayCreator.newNumberArray(extraSpace);}return fullState;}},{key:'jumpDrawablesToCurrentState',value:function jumpDrawablesToCurrentState(){if(this.mBackground!=null){this.mBackground.jumpToCurrentState();}}},{key:'setBackgroundColor',value:function setBackgroundColor(color){if(this.mBackground instanceof ColorDrawable){this.mBackground.mutate().setColor(color);this.computeOpaqueFlags();}else{this.setBackground(new ColorDrawable(color));}}},{key:'setBackground',value:function setBackground(background){this.setBackgroundDrawable(background);}},{key:'getBackground',value:function getBackground(){return this.mBackground;}},{key:'setBackgroundDrawable',value:function setBackgroundDrawable(background){this.computeOpaqueFlags();if(background==this.mBackground){return;}var requestLayout=false;if(this.mBackground!=null){this.mBackground.setCallback(null);this.unscheduleDrawable(this.mBackground);}if(background!=null){var _padding2=new Rect();if(background.getPadding(_padding2)){this.setPadding(_padding2.left,_padding2.top,_padding2.right,_padding2.bottom);}if(this.mBackground==null||this.mBackground.getMinimumHeight()!=background.getMinimumHeight()||this.mBackground.getMinimumWidth()!=background.getMinimumWidth()){requestLayout=true;}background.setCallback(this);if(background.isStateful()){background.setState(this.getDrawableState());}background.setVisible(this.getVisibility()==View.VISIBLE,false);this.mBackground=background;this.mBackgroundWidth=background.getIntrinsicWidth();this.mBackgroundHeight=background.getIntrinsicHeight();if((this.mPrivateFlags&View.PFLAG_SKIP_DRAW)!=0){this.mPrivateFlags&=~View.PFLAG_SKIP_DRAW;this.mPrivateFlags|=View.PFLAG_ONLY_DRAWS_BACKGROUND;requestLayout=true;}}else{this.mBackground=null;this.mBackgroundWidth=this.mBackgroundHeight=-1;if((this.mPrivateFlags&View.PFLAG_ONLY_DRAWS_BACKGROUND)!=0){this.mPrivateFlags&=~View.PFLAG_ONLY_DRAWS_BACKGROUND;this.mPrivateFlags|=View.PFLAG_SKIP_DRAW;}requestLayout=true;}this.computeOpaqueFlags();if(requestLayout){this.requestLayout();}this.mBackgroundSizeChanged=true;this.mShadowDrawable=null;this.invalidate(true);}},{key:'computeHorizontalScrollRange',value:function computeHorizontalScrollRange(){return this.getWidth();}},{key:'computeHorizontalScrollOffset',value:function computeHorizontalScrollOffset(){return this.mScrollX;}},{key:'computeHorizontalScrollExtent',value:function computeHorizontalScrollExtent(){return this.getWidth();}},{key:'computeVerticalScrollRange',value:function computeVerticalScrollRange(){return this.getHeight();}},{key:'computeVerticalScrollOffset',value:function computeVerticalScrollOffset(){return this.mScrollY;}},{key:'computeVerticalScrollExtent',value:function computeVerticalScrollExtent(){return this.getHeight();}},{key:'canScrollHorizontally',value:function canScrollHorizontally(direction){var offset=this.computeHorizontalScrollOffset();var range=this.computeHorizontalScrollRange()-this.computeHorizontalScrollExtent();if(range==0)return false;if(direction<0){return offset>0;}else{return offset<range-1;}}},{key:'canScrollVertically',value:function canScrollVertically(direction){var offset=this.computeVerticalScrollOffset();var range=this.computeVerticalScrollRange()-this.computeVerticalScrollExtent();if(range==0)return false;if(direction<0){return offset>0;}else{return offset<range-1;}}},{key:'overScrollBy',value:function overScrollBy(deltaX,deltaY,scrollX,scrollY,scrollRangeX,scrollRangeY,maxOverScrollX,maxOverScrollY,isTouchEvent){var overScrollMode=this.mOverScrollMode;var canScrollHorizontal=this.computeHorizontalScrollRange()>this.computeHorizontalScrollExtent();var canScrollVertical=this.computeVerticalScrollRange()>this.computeVerticalScrollExtent();var overScrollHorizontal=overScrollMode==View.OVER_SCROLL_ALWAYS||overScrollMode==View.OVER_SCROLL_IF_CONTENT_SCROLLS&&canScrollHorizontal;var overScrollVertical=overScrollMode==View.OVER_SCROLL_ALWAYS||overScrollMode==View.OVER_SCROLL_IF_CONTENT_SCROLLS&&canScrollVertical;if(isTouchEvent){if(deltaX<0&&scrollX<=0||deltaX>0&&scrollX>=scrollRangeX){deltaX/=2;}if(deltaY<0&&scrollY<=0||deltaY>0&&scrollY>=scrollRangeY){deltaY/=2;}}var newScrollX=scrollX+deltaX;if(!overScrollHorizontal){maxOverScrollX=0;}var newScrollY=scrollY+deltaY;if(!overScrollVertical){maxOverScrollY=0;}var left=-maxOverScrollX;var right=maxOverScrollX+scrollRangeX;var top=-maxOverScrollY;var bottom=maxOverScrollY+scrollRangeY;var clampedX=false;if(newScrollX>right){newScrollX=right;clampedX=true;}else if(newScrollX<left){newScrollX=left;clampedX=true;}var clampedY=false;if(newScrollY>bottom){newScrollY=bottom;clampedY=true;}else if(newScrollY<top){newScrollY=top;clampedY=true;}this.onOverScrolled(newScrollX,newScrollY,clampedX,clampedY);return clampedX||clampedY;}},{key:'onOverScrolled',value:function onOverScrolled(scrollX,scrollY,clampedX,clampedY){}},{key:'getOverScrollMode',value:function getOverScrollMode(){return this.mOverScrollMode;}},{key:'setOverScrollMode',value:function setOverScrollMode(overScrollMode){if(overScrollMode!=View.OVER_SCROLL_ALWAYS&&overScrollMode!=View.OVER_SCROLL_IF_CONTENT_SCROLLS&&overScrollMode!=View.OVER_SCROLL_NEVER){throw new Error(\"Invalid overscroll mode \"+overScrollMode);}this.mOverScrollMode=overScrollMode;}},{key:'getVerticalScrollFactor',value:function getVerticalScrollFactor(){if(this.mVerticalScrollFactor==0){this.mVerticalScrollFactor=Resources.getDisplayMetrics().density*1;}return this.mVerticalScrollFactor;}},{key:'getHorizontalScrollFactor',value:function getHorizontalScrollFactor(){return this.getVerticalScrollFactor();}},{key:'computeScroll',value:function computeScroll(){}},{key:'scrollTo',value:function scrollTo(x,y){if(this.mScrollX!=x||this.mScrollY!=y){var oldX=this.mScrollX;var oldY=this.mScrollY;this.mScrollX=x;this.mScrollY=y;this.invalidateParentCaches();this.onScrollChanged(this.mScrollX,this.mScrollY,oldX,oldY);if(!this.awakenScrollBars()){this.postInvalidateOnAnimation();}}}},{key:'scrollBy',value:function scrollBy(x,y){this.scrollTo(this.mScrollX+x,this.mScrollY+y);}},{key:'initialAwakenScrollBars',value:function initialAwakenScrollBars(){return this.mScrollCache!=null&&this.awakenScrollBars(this.mScrollCache.scrollBarDefaultDelayBeforeFade*4,true);}},{key:'awakenScrollBars',value:function awakenScrollBars(startDelay){var invalidate=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var scrollCache=this.mScrollCache;if(scrollCache==null)return false;startDelay=startDelay||scrollCache.scrollBarDefaultDelayBeforeFade;if(scrollCache==null||!scrollCache.fadeScrollBars){return false;}if(scrollCache.scrollBar==null){scrollCache.scrollBar=new ScrollBarDrawable();}if(this.isHorizontalScrollBarEnabled()||this.isVerticalScrollBarEnabled()){if(invalidate){this.postInvalidateOnAnimation();}if(scrollCache.state==ScrollabilityCache.OFF){var KEY_REPEAT_FIRST_DELAY=750;startDelay=Math.max(KEY_REPEAT_FIRST_DELAY,startDelay);}var fadeStartTime=AnimationUtils.currentAnimationTimeMillis()+startDelay;scrollCache.fadeStartTime=fadeStartTime;scrollCache.state=ScrollabilityCache.ON;if(this.mAttachInfo!=null){this.mAttachInfo.mHandler.removeCallbacks(scrollCache);this.mAttachInfo.mHandler.postAtTime(scrollCache,fadeStartTime);}return true;}return false;}},{key:'getVerticalFadingEdgeLength',value:function getVerticalFadingEdgeLength(){return 0;}},{key:'setVerticalFadingEdgeEnabled',value:function setVerticalFadingEdgeEnabled(enable){}},{key:'setHorizontalFadingEdgeEnabled',value:function setHorizontalFadingEdgeEnabled(enable){}},{key:'setFadingEdgeLength',value:function setFadingEdgeLength(length){}},{key:'getHorizontalFadingEdgeLength',value:function getHorizontalFadingEdgeLength(){return 0;}},{key:'getVerticalScrollbarWidth',value:function getVerticalScrollbarWidth(){var cache=this.mScrollCache;if(cache!=null){var scrollBar=cache.scrollBar;if(scrollBar!=null){var size=scrollBar.getSize(true);if(size<=0){size=cache.scrollBarSize;}return size;}return 0;}return 0;}},{key:'getHorizontalScrollbarHeight',value:function getHorizontalScrollbarHeight(){var cache=this.mScrollCache;if(cache!=null){var scrollBar=cache.scrollBar;if(scrollBar!=null){var size=scrollBar.getSize(false);if(size<=0){size=cache.scrollBarSize;}return size;}return 0;}return 0;}},{key:'initializeScrollbars',value:function initializeScrollbars(a){this.initScrollCache();}},{key:'initScrollCache',value:function initScrollCache(){if(this.mScrollCache==null){this.mScrollCache=new ScrollabilityCache(this);}}},{key:'getScrollCache',value:function getScrollCache(){this.initScrollCache();return this.mScrollCache;}},{key:'isHorizontalScrollBarEnabled',value:function isHorizontalScrollBarEnabled(){return(this.mViewFlags&View.SCROLLBARS_HORIZONTAL)==View.SCROLLBARS_HORIZONTAL;}},{key:'setHorizontalScrollBarEnabled',value:function setHorizontalScrollBarEnabled(horizontalScrollBarEnabled){if(this.isHorizontalScrollBarEnabled()!=horizontalScrollBarEnabled){this.mViewFlags^=View.SCROLLBARS_HORIZONTAL;this.computeOpaqueFlags();}}},{key:'isVerticalScrollBarEnabled',value:function isVerticalScrollBarEnabled(){return(this.mViewFlags&View.SCROLLBARS_VERTICAL)==View.SCROLLBARS_VERTICAL;}},{key:'setVerticalScrollBarEnabled',value:function setVerticalScrollBarEnabled(verticalScrollBarEnabled){if(this.isVerticalScrollBarEnabled()!=verticalScrollBarEnabled){this.mViewFlags^=View.SCROLLBARS_VERTICAL;this.computeOpaqueFlags();}}},{key:'setScrollbarFadingEnabled',value:function setScrollbarFadingEnabled(fadeScrollbars){this.initScrollCache();var scrollabilityCache=this.mScrollCache;scrollabilityCache.fadeScrollBars=fadeScrollbars;if(fadeScrollbars){scrollabilityCache.state=ScrollabilityCache.OFF;}else{scrollabilityCache.state=ScrollabilityCache.ON;}}},{key:'setVerticalScrollbarPosition',value:function setVerticalScrollbarPosition(position){}},{key:'setHorizontalScrollbarPosition',value:function setHorizontalScrollbarPosition(position){}},{key:'setScrollBarStyle',value:function setScrollBarStyle(position){}},{key:'getTopFadingEdgeStrength',value:function getTopFadingEdgeStrength(){return 0;}},{key:'getBottomFadingEdgeStrength',value:function getBottomFadingEdgeStrength(){return 0;}},{key:'getLeftFadingEdgeStrength',value:function getLeftFadingEdgeStrength(){return 0;}},{key:'getRightFadingEdgeStrength',value:function getRightFadingEdgeStrength(){return 0;}},{key:'isScrollbarFadingEnabled',value:function isScrollbarFadingEnabled(){return this.mScrollCache!=null&&this.mScrollCache.fadeScrollBars;}},{key:'getScrollBarDefaultDelayBeforeFade',value:function getScrollBarDefaultDelayBeforeFade(){return this.mScrollCache==null?view_1.ViewConfiguration.getScrollDefaultDelay():this.mScrollCache.scrollBarDefaultDelayBeforeFade;}},{key:'setScrollBarDefaultDelayBeforeFade',value:function setScrollBarDefaultDelayBeforeFade(scrollBarDefaultDelayBeforeFade){this.getScrollCache().scrollBarDefaultDelayBeforeFade=scrollBarDefaultDelayBeforeFade;}},{key:'getScrollBarFadeDuration',value:function getScrollBarFadeDuration(){return this.mScrollCache==null?view_1.ViewConfiguration.getScrollBarFadeDuration():this.mScrollCache.scrollBarFadeDuration;}},{key:'setScrollBarFadeDuration',value:function setScrollBarFadeDuration(scrollBarFadeDuration){this.getScrollCache().scrollBarFadeDuration=scrollBarFadeDuration;}},{key:'getScrollBarSize',value:function getScrollBarSize(){return this.mScrollCache==null?view_1.ViewConfiguration.get().getScaledScrollBarSize():this.mScrollCache.scrollBarSize;}},{key:'setScrollBarSize',value:function setScrollBarSize(scrollBarSize){this.getScrollCache().scrollBarSize=scrollBarSize;}},{key:'hasOpaqueScrollbars',value:function hasOpaqueScrollbars(){return true;}},{key:'assignParent',value:function assignParent(parent){if(this.mParent==null){this.mParent=parent;}else if(parent==null){this.mParent=null;}else{throw new Error(\"view \"+this+\" being added, but\"+\" it already has a parent\");}}},{key:'onFinishInflate',value:function onFinishInflate(){}},{key:'dispatchStartTemporaryDetach',value:function dispatchStartTemporaryDetach(){this.onStartTemporaryDetach();}},{key:'onStartTemporaryDetach',value:function onStartTemporaryDetach(){this.removeUnsetPressCallback();this.mPrivateFlags|=View.PFLAG_CANCEL_NEXT_UP_EVENT;}},{key:'dispatchFinishTemporaryDetach',value:function dispatchFinishTemporaryDetach(){this.onFinishTemporaryDetach();}},{key:'onFinishTemporaryDetach',value:function onFinishTemporaryDetach(){}},{key:'dispatchWindowFocusChanged',value:function dispatchWindowFocusChanged(hasFocus){this.onWindowFocusChanged(hasFocus);}},{key:'onWindowFocusChanged',value:function onWindowFocusChanged(hasWindowFocus){if(!hasWindowFocus){if(this.isPressed()){this.setPressed(false);}this.removeLongPressCallback();this.removeTapCallback();this.onFocusLost();}this.refreshDrawableState();}},{key:'hasWindowFocus',value:function hasWindowFocus(){return this.mAttachInfo!=null&&this.mAttachInfo.mHasWindowFocus;}},{key:'getWindowAttachCount',value:function getWindowAttachCount(){return this.mWindowAttachCount;}},{key:'isAttachedToWindow',value:function isAttachedToWindow(){return this.mAttachInfo!=null;}},{key:'dispatchAttachedToWindow',value:function dispatchAttachedToWindow(info,visibility){this.mAttachInfo=info;if(this.mOverlay!=null){this.mOverlay.getOverlayView().dispatchAttachedToWindow(info,visibility);}this.mWindowAttachCount++;this.mPrivateFlags|=View.PFLAG_DRAWABLE_STATE_DIRTY;if(this.mFloatingTreeObserver!=null){info.mViewRootImpl.mTreeObserver.merge(this.mFloatingTreeObserver);this.mFloatingTreeObserver=null;}if((this.mPrivateFlags&View.PFLAG_SCROLL_CONTAINER)!=0){this.mAttachInfo.mScrollContainers.add(this);this.mPrivateFlags|=View.PFLAG_SCROLL_CONTAINER_ADDED;}this.onAttachedToWindow();if(this.dependOnDebugLayout()){this.getContext().androidUI.viewAttachedDependOnDebugLayout(this);}var li=this.mListenerInfo;var listeners=li!=null?li.mOnAttachStateChangeListeners:null;if(listeners!=null&&listeners.size()>0){var _iteratorNormalCompletion40=true;var _didIteratorError40=false;var _iteratorError40=undefined;try{for(var _iterator40=listeners[Symbol.iterator](),_step40;!(_iteratorNormalCompletion40=(_step40=_iterator40.next()).done);_iteratorNormalCompletion40=true){var listener=_step40.value;listener.onViewAttachedToWindow(this);}}catch(err){_didIteratorError40=true;_iteratorError40=err;}finally{try{if(!_iteratorNormalCompletion40&&_iterator40.return){_iterator40.return();}}finally{if(_didIteratorError40){throw _iteratorError40;}}}}var vis=info.mWindowVisibility;if(vis!=View.GONE){this.onWindowVisibilityChanged(vis);}if((this.mPrivateFlags&View.PFLAG_DRAWABLE_STATE_DIRTY)!=0){this.refreshDrawableState();}}},{key:'onAttachedToWindow',value:function onAttachedToWindow(){if((this.mPrivateFlags&View.PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH)!=0){this.initialAwakenScrollBars();this.mPrivateFlags&=~View.PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH;}this.mPrivateFlags3&=~View.PFLAG3_IS_LAID_OUT;this.jumpDrawablesToCurrentState();}},{key:'dispatchDetachedFromWindow',value:function dispatchDetachedFromWindow(){var info=this.mAttachInfo;if(info!=null){var vis=info.mWindowVisibility;if(vis!=View.GONE){this.onWindowVisibilityChanged(View.GONE);}}this.onDetachedFromWindow();if(this.dependOnDebugLayout()){this.getContext().androidUI.viewDetachedDependOnDebugLayout(this);}var li=this.mListenerInfo;var listeners=li!=null?li.mOnAttachStateChangeListeners:null;if(listeners!=null&&listeners.size()>0){var _iteratorNormalCompletion41=true;var _didIteratorError41=false;var _iteratorError41=undefined;try{for(var _iterator41=listeners[Symbol.iterator](),_step41;!(_iteratorNormalCompletion41=(_step41=_iterator41.next()).done);_iteratorNormalCompletion41=true){var listener=_step41.value;listener.onViewDetachedFromWindow(this);}}catch(err){_didIteratorError41=true;_iteratorError41=err;}finally{try{if(!_iteratorNormalCompletion41&&_iterator41.return){_iterator41.return();}}finally{if(_didIteratorError41){throw _iteratorError41;}}}}if((this.mPrivateFlags&View.PFLAG_SCROLL_CONTAINER_ADDED)!=0){this.mAttachInfo.mScrollContainers.delete(this);this.mPrivateFlags&=~View.PFLAG_SCROLL_CONTAINER_ADDED;}this.mAttachInfo=null;if(this.mOverlay!=null){this.mOverlay.getOverlayView().dispatchDetachedFromWindow();}}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){this.mPrivateFlags&=~View.PFLAG_CANCEL_NEXT_UP_EVENT;this.mPrivateFlags3&=~View.PFLAG3_IS_LAID_OUT;this.removeUnsetPressCallback();this.removeLongPressCallback();this.removePerformClickCallback();this.destroyDrawingCache();this.cleanupDraw();this.mCurrentAnimation=null;}},{key:'cleanupDraw',value:function cleanupDraw(){if(this.mAttachInfo!=null){this.mAttachInfo.mViewRootImpl.cancelInvalidate(this);}}},{key:'isInEditMode',value:function isInEditMode(){return false;}},{key:'debug',value:function debug(){var depth=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;console.dir(this.bindElement);}},{key:'toString',value:function toString(){return this.tagName();}},{key:'getRootView',value:function getRootView(){if(this.mAttachInfo!=null){var v=this.mAttachInfo.mRootView;if(v!=null){return v;}}var parent=this;while(parent.mParent!=null&&parent.mParent instanceof View){parent=parent.mParent;}return parent;}},{key:'findViewById',value:function findViewById(id){if(!id)return null;return this.findViewTraversal(id);}},{key:'findViewWithTag',value:function findViewWithTag(tag){if(!tag)return null;return this.findViewWithTagTraversal(tag);}},{key:'findViewTraversal',value:function findViewTraversal(id){if(id==this.mID){return this;}return null;}},{key:'findViewWithTagTraversal',value:function findViewWithTagTraversal(tag){if(tag!=null&&tag===this.mTag){return this;}return null;}},{key:'findViewByPredicate',value:function findViewByPredicate(predicate){return this.findViewByPredicateTraversal(predicate,null);}},{key:'findViewByPredicateTraversal',value:function findViewByPredicateTraversal(predicate,childToSkip){if(predicate.apply(this)){return this;}return null;}},{key:'findViewByPredicateInsideOut',value:function findViewByPredicateInsideOut(start,predicate){var childToSkip=null;for(;;){var _view3=start.findViewByPredicateTraversal(predicate,childToSkip);if(_view3!=null||start==this){return _view3;}var parent=start.getParent();if(parent==null||!(parent instanceof View)){return null;}childToSkip=start;start=parent;}}},{key:'setId',value:function setId(id){this.mID=id;}},{key:'getId',value:function getId(){return this.mID;}},{key:'getTag',value:function getTag(){return this.mTag;}},{key:'setTag',value:function setTag(tag){this.mTag=tag;}},{key:'setIsRootNamespace',value:function setIsRootNamespace(isRoot){if(isRoot){this.mPrivateFlags|=View.PFLAG_IS_ROOT_NAMESPACE;}else{this.mPrivateFlags&=~View.PFLAG_IS_ROOT_NAMESPACE;}}},{key:'isRootNamespace',value:function isRootNamespace(){return(this.mPrivateFlags&View.PFLAG_IS_ROOT_NAMESPACE)!=0;}},{key:'getResources',value:function getResources(){var context=this.getContext();if(context!=null){return context.getResources();}return Resources.getSystem();}},{key:'initBindElement',value:function initBindElement(bindElement){if(this.bindElement){this.bindElement[View.AndroidViewProperty]=null;}this.bindElement=bindElement||document.createElement(this.tagName());this.bindElement.style.position='absolute';var oldBindView=this.bindElement[View.AndroidViewProperty];if(oldBindView){if(oldBindView._AttrObserver)oldBindView._AttrObserver.disconnect();}this.bindElement[View.AndroidViewProperty]=this;this._initAttrObserver();}},{key:'initBindAttr',value:function initBindAttr(){var classAttrBinder=View.ViewClassAttrBinderClazzMap.get(this.getClass());if(!classAttrBinder){classAttrBinder=this.createClassAttrBinder();View.ViewClassAttrBinderClazzMap.set(this.getClass(),classAttrBinder);}this._attrBinder.setClassAttrBind(classAttrBinder);}},{key:'createClassAttrBinder',value:function createClassAttrBinder(){var classAttrBinder=new AttrBinder.ClassBinderMap().set('background',{setter:function setter(v,value,attrBinder){v.setBackground(attrBinder.parseDrawable(value));},getter:function getter(v){return v.mBackground;}}).set('padding',{setter:function setter(v,value,attrBinder){if(value==null)value=0;var _attrBinder$parsePadd=attrBinder.parsePaddingMarginTRBL(value),_attrBinder$parsePadd2=_slicedToArray(_attrBinder$parsePadd,4),top=_attrBinder$parsePadd2[0],right=_attrBinder$parsePadd2[1],bottom=_attrBinder$parsePadd2[2],left=_attrBinder$parsePadd2[3];v.setPadding(left,top,right,bottom);},getter:function getter(v){return v.mPaddingTop+' '+v.mPaddingRight+' '+v.mPaddingBottom+' '+v.mPaddingLeft;}}).set('paddingLeft',{setter:function setter(v,value,attrBinder){if(value==null)value=0;v.setPadding(attrBinder.parseDimension(value,0),v.mPaddingTop,v.mPaddingRight,v.mPaddingBottom);},getter:function getter(v){return v.mPaddingLeft;}}).set('paddingTop',{setter:function setter(v,value,attrBinder){if(value==null)value=0;v.setPadding(v.mPaddingLeft,attrBinder.parseDimension(value,0),v.mPaddingRight,v.mPaddingBottom);},getter:function getter(v){return v.mPaddingTop;}}).set('paddingRight',{setter:function setter(v,value,attrBinder){if(value==null)value=0;v.setPadding(v.mPaddingLeft,v.mPaddingTop,attrBinder.parseDimension(value,0),v.mPaddingBottom);},getter:function getter(v){return v.mPaddingRight;}}).set('paddingBottom',{setter:function setter(v,value,attrBinder){if(value==null)value=0;v.setPadding(v.mPaddingLeft,v.mPaddingTop,v.mPaddingRight,attrBinder.parseDimension(value,0));},getter:function getter(v){return v.mPaddingBottom;}}).set('scrollX',{setter:function setter(v,value,attrBinder){value=attrBinder.parseNumberPixelOffset(value);if(Number.isInteger(value))v.scrollTo(value,v.mScrollY);},getter:function getter(v){v.getScrollX();}}).set('scrollY',{setter:function setter(v,value,attrBinder){value=attrBinder.parseNumberPixelOffset(value);if(Number.isInteger(value))v.scrollTo(v.mScrollX,value);},getter:function getter(v){return v.getScrollY();}}).set('alpha',{setter:function setter(v,value,attrBinder){v.setAlpha(attrBinder.parseFloat(value,v.getAlpha()));},getter:function getter(v){return v.getAlpha();}}).set('transformPivotX',{setter:function setter(v,value,attrBinder){v.setPivotX(attrBinder.parseNumberPixelOffset(value,v.getPivotX()));},getter:function getter(v){return v.getPivotX();}}).set('transformPivotY',{setter:function setter(v,value,attrBinder){v.setPivotY(attrBinder.parseNumberPixelOffset(value,v.getPivotY()));},getter:function getter(v){return v.getPivotY();}}).set('translationX',{setter:function setter(v,value,attrBinder){v.setTranslationX(attrBinder.parseNumberPixelOffset(value,v.getTranslationX()));},getter:function getter(v){return v.getTranslationX();}}).set('translationY',{setter:function setter(v,value,attrBinder){v.setTranslationY(attrBinder.parseNumberPixelOffset(value,v.getTranslationY()));},getter:function getter(v){return v.getTranslationY();}}).set('rotation',{setter:function setter(v,value,attrBinder){v.setRotation(attrBinder.parseFloat(value,v.getRotation()));},getter:function getter(v){return v.getRotation();}}).set('scaleX',{setter:function setter(v,value,attrBinder){v.setScaleX(attrBinder.parseFloat(value,v.getScaleX()));},getter:function getter(v){return v.getScaleX();}}).set('scaleY',{setter:function setter(v,value,attrBinder){v.setScaleY(attrBinder.parseFloat(value,v.getScaleY()));},getter:function getter(v){return v.getScaleY();}}).set('tag',{setter:function setter(v,value,attrBinder){v.setTag(value);},getter:function getter(v){return v.getTag();}}).set('id',{setter:function setter(v,value,attrBinder){v.setId(value);},getter:function getter(v){return v.getId();}}).set('focusable',{setter:function setter(v,value,attrBinder){if(attrBinder.parseBoolean(value,false)){v.setFlags(View.FOCUSABLE,View.FOCUSABLE_MASK);}},getter:function getter(v){return v.isFocusable();}}).set('focusableInTouchMode',{setter:function setter(v,value,attrBinder){if(attrBinder.parseBoolean(value,false)){v.setFlags(View.FOCUSABLE_IN_TOUCH_MODE|View.FOCUSABLE,View.FOCUSABLE_IN_TOUCH_MODE|View.FOCUSABLE_MASK);}},getter:function getter(v){return v.isFocusableInTouchMode();}}).set('clickable',{setter:function setter(v,value,attrBinder){if(attrBinder.parseBoolean(value,false)){v.setFlags(View.CLICKABLE,View.CLICKABLE);}},getter:function getter(v){return v.isClickable();}}).set('longClickable',{setter:function setter(v,value,attrBinder){if(attrBinder.parseBoolean(value,false)){v.setFlags(View.LONG_CLICKABLE,View.LONG_CLICKABLE);}},getter:function getter(v){return v.isLongClickable();}}).set('duplicateParentState',{setter:function setter(v,value,attrBinder){if(attrBinder.parseBoolean(value,false)){v.setFlags(View.DUPLICATE_PARENT_STATE,View.DUPLICATE_PARENT_STATE);}},getter:function getter(v){return(v.mViewFlags&View.DUPLICATE_PARENT_STATE)==View.DUPLICATE_PARENT_STATE;}}).set('visibility',{setter:function setter(v,value,attrBinder){if(value==='gone')v.setVisibility(View.GONE);else if(value==='invisible')v.setVisibility(View.INVISIBLE);else if(value==='visible')v.setVisibility(View.VISIBLE);},getter:function getter(v){return v.getVisibility();}}).set('scrollbars',{setter:function setter(v,value,attrBinder){if(value==='none'){v.setHorizontalScrollBarEnabled(false);v.setVerticalScrollBarEnabled(false);}else if(value==='horizontal'){v.setHorizontalScrollBarEnabled(true);v.setVerticalScrollBarEnabled(false);}else if(value==='vertical'){v.setHorizontalScrollBarEnabled(false);v.setVerticalScrollBarEnabled(true);}}}).set('isScrollContainer',{setter:function setter(v,value,attrBinder){if(attrBinder.parseBoolean(value,false)){v.setScrollContainer(true);}},getter:function getter(v){return v.isScrollContainer();}}).set('minWidth',{setter:function setter(v,value,attrBinder){v.setMinimumWidth(attrBinder.parseNumberPixelSize(value,0));},getter:function getter(v){return v.mMinWidth;}}).set('minHeight',{setter:function setter(v,value,attrBinder){v.setMinimumHeight(attrBinder.parseNumberPixelSize(value,0));},getter:function getter(v){return v.mMinHeight;}}).set('onClick',{setter:function setter(v,value,attrBinder){if(value&&typeof value==='string'){v.setOnClickListenerByAttrValueString(value);}v.bindElement.removeAttribute('onclick');}}).set('overScrollMode',{setter:function setter(v,value,attrBinder){var scrollMode=View[('OVER_SCROLL_'+value).toUpperCase()];if(scrollMode===undefined)scrollMode=View.OVER_SCROLL_IF_CONTENT_SCROLLS;v.setOverScrollMode(scrollMode);}}).set('layerType',{setter:function setter(v,value,attrBinder){if((value+'').toLowerCase()=='software'){v.setLayerType(View.LAYER_TYPE_SOFTWARE);}else{v.setLayerType(View.LAYER_TYPE_NONE);}}}).set('cornerRadius',{setter:function setter(v,value,attrBinder){var _attrBinder$parsePadd3=attrBinder.parsePaddingMarginTRBL(value),_attrBinder$parsePadd4=_slicedToArray(_attrBinder$parsePadd3,4),topRight=_attrBinder$parsePadd4[0],rightBottom=_attrBinder$parsePadd4[1],bottomLeft=_attrBinder$parsePadd4[2],leftTop=_attrBinder$parsePadd4[3];v.setCornerRadius(leftTop,topRight,rightBottom,bottomLeft);},getter:function getter(v){return v.mCornerRadiusTopRight+' '+v.mCornerRadiusBottomRight+' '+v.mCornerRadiusBottomLeft+' '+v.mCornerRadiusTopLeft;}}).set('cornerRadiusTopLeft',{setter:function setter(v,value,attrBinder){v.setCornerRadiusTopLeft(attrBinder.parseNumberPixelSize(value,v.mCornerRadiusTopLeft));},getter:function getter(v){return v.mCornerRadiusTopLeft;}}).set('cornerRadiusTopRight',{setter:function setter(v,value,attrBinder){v.setCornerRadiusTopRight(attrBinder.parseNumberPixelSize(value,v.mCornerRadiusTopRight));},getter:function getter(v){return v.mCornerRadiusTopRight;}}).set('cornerRadiusBottomLeft',{setter:function setter(v,value,attrBinder){v.setCornerRadiusBottomLeft(attrBinder.parseNumberPixelSize(value,v.mCornerRadiusBottomLeft));},getter:function getter(v){return v.mCornerRadiusBottomLeft;}}).set('cornerRadiusBottomRight',{setter:function setter(v,value,attrBinder){v.setCornerRadiusBottomRight(attrBinder.parseNumberPixelSize(value,v.mCornerRadiusBottomRight));},getter:function getter(v){return v.mCornerRadiusBottomRight;}}).set('viewShadowColor',{setter:function setter(v,value,attrBinder){if(!v.mShadowPaint)v.mShadowPaint=new Paint();v.setShadowView(v.mShadowPaint.shadowRadius,v.mShadowPaint.shadowDx,v.mShadowPaint.shadowDy,attrBinder.parseColor(value,v.mShadowPaint.shadowColor));},getter:function getter(v){if(v.mShadowPaint)return v.mShadowPaint.shadowColor;}}).set('viewShadowDx',{setter:function setter(v,value,attrBinder){if(!v.mShadowPaint)v.mShadowPaint=new Paint();var dx=attrBinder.parseNumberPixelSize(value,v.mShadowPaint.shadowDx);v.setShadowView(v.mShadowPaint.shadowRadius,dx,v.mShadowPaint.shadowDy,v.mShadowPaint.shadowColor);},getter:function getter(v){if(v.mShadowPaint)return v.mShadowPaint.shadowDx;}}).set('viewShadowDy',{setter:function setter(v,value,attrBinder){if(!v.mShadowPaint)v.mShadowPaint=new Paint();var dy=attrBinder.parseNumberPixelSize(value,v.mShadowPaint.shadowDy);v.setShadowView(v.mShadowPaint.shadowRadius,v.mShadowPaint.shadowDx,dy,v.mShadowPaint.shadowColor);},getter:function getter(v){if(v.mShadowPaint)return v.mShadowPaint.shadowDy;}}).set('viewShadowRadius',{setter:function setter(v,value,attrBinder){if(!v.mShadowPaint)v.mShadowPaint=new Paint();var radius=attrBinder.parseNumberPixelSize(value,v.mShadowPaint.shadowRadius);v.setShadowView(radius,v.mShadowPaint.shadowDx,v.mShadowPaint.shadowDy,v.mShadowPaint.shadowColor);},getter:function getter(v){if(v.mShadowPaint)return v.mShadowPaint.shadowRadius;}});classAttrBinder.set('paddingStart',classAttrBinder.get('paddingLeft'));classAttrBinder.set('paddingEnd',classAttrBinder.get('paddingRight'));return classAttrBinder;}},{key:'requestSyncBoundToElement',value:function requestSyncBoundToElement(){var immediately=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.dependOnDebugLayout();var rootView=this.getRootView();if(!rootView)return;if(!rootView._syncToElementRun){rootView._syncToElementRun={run:function run(){rootView._syncToElementLock=false;rootView._syncToElementImmediatelyLock=false;rootView._syncBoundAndScrollToElement();}};}if(immediately){if(rootView._syncToElementImmediatelyLock)return;rootView._syncToElementImmediatelyLock=true;rootView._syncToElementLock=true;rootView.removeCallbacks(rootView._syncToElementRun);rootView.post(rootView._syncToElementRun);return;}if(rootView._syncToElementLock)return;rootView._syncToElementLock=true;rootView.postDelayed(rootView._syncToElementRun,1000);}},{key:'_syncBoundAndScrollToElement',value:function _syncBoundAndScrollToElement(){if(!this.isAttachedToWindow()){return;}var left=this.mLeft;var top=this.mTop;var width=this.getWidth();var height=this.getHeight();var parent=this.getParent();var pScrollX=parent instanceof View?parent.mScrollX:0;var pScrollY=parent instanceof View?parent.mScrollY:0;if(left!==this._lastSyncLeft||top!==this._lastSyncTop||width!==this._lastSyncWidth||height!==this._lastSyncHeight||pScrollX!==this._lastSyncScrollX||pScrollY!==this._lastSyncScrollY){this._lastSyncLeft=left;this._lastSyncTop=top;this._lastSyncWidth=width;this._lastSyncHeight=height;this._lastSyncScrollX=pScrollX;this._lastSyncScrollY=pScrollY;var density=this.getResources().getDisplayMetrics().density;var bind=this.bindElement;bind.style.width=width/density+'px';bind.style.height=height/density+'px';bind.style.left=(left-pScrollX)/density+'px';bind.style.top=(top-pScrollY)/density+'px';if(bind.parentElement){bind.parentElement.scrollTop=0;}this.getMatrix();}if(this instanceof view_1.ViewGroup){var group=this;for(var i=0,count=group.getChildCount();i<count;i++){group.getChildAt(i)._syncBoundAndScrollToElement();}}}},{key:'_syncMatrixToElement',value:function _syncMatrixToElement(){var matrix=this.mTransformationInfo==null?Matrix.IDENTITY_MATRIX:this.mTransformationInfo.mMatrix;matrix=matrix||Matrix.IDENTITY_MATRIX;var v=View.TempMatrixValue;matrix.getValues(v);var transfrom='matrix('+v[Matrix.MSCALE_X]+', '+-v[Matrix.MSKEW_X]+', '+-v[Matrix.MSKEW_Y]+', '+v[Matrix.MSCALE_Y]+', '+v[Matrix.MTRANS_X]+', '+v[Matrix.MTRANS_Y]+')';if(this._lastSyncTransform!=transfrom){this._lastSyncTransform=this.bindElement.style.transform=this.bindElement.style.webkitTransform=transfrom;}}},{key:'syncVisibleToElement',value:function syncVisibleToElement(){var visibility=this.getVisibility();if(visibility===View.VISIBLE){this.bindElement.style.display='';this.bindElement.style.visibility='';}else if(visibility===View.INVISIBLE){this.bindElement.style.display='';this.bindElement.style.visibility='hidden';}else{this.bindElement.style.display='none';this.bindElement.style.visibility='';}}},{key:'dependOnDebugLayout',value:function dependOnDebugLayout(){return false;}},{key:'_initAttrObserver',value:function _initAttrObserver(){if(!window['MutationObserver'])return;if(!this._AttrObserver)this._AttrObserver=new MutationObserver(View._AttrObserverCallBack);else this._AttrObserver.disconnect();this._AttrObserver.observe(this.bindElement,{attributes:true,attributeOldValue:true});}},{key:'_fireStateChangeToAttribute',value:function _fireStateChangeToAttribute(oldState,newState){if(!this._stateAttrList)return;if(java.util.Arrays.equals(oldState,newState))return;var oldMatchedAttr=this._stateAttrList.getMatchedStateAttr(oldState);var matchedAttr=this._stateAttrList.getMatchedStateAttr(newState);var _iteratorNormalCompletion42=true;var _didIteratorError42=false;var _iteratorError42=undefined;try{for(var _iterator42=matchedAttr.getAttrMap().entries()[Symbol.iterator](),_step42;!(_iteratorNormalCompletion42=(_step42=_iterator42.next()).done);_iteratorNormalCompletion42=true){var _step42$value=_slicedToArray(_step42.value,2),key=_step42$value[0],value=_step42$value[1];var attrValue=this._getBinderAttrValue(key);if(oldMatchedAttr){oldMatchedAttr.setAttr(key,attrValue);}if(value==attrValue)continue;this.onBindElementAttributeChanged(key,null,value);}}catch(err){_didIteratorError42=true;_iteratorError42=err;}finally{try{if(!_iteratorNormalCompletion42&&_iterator42.return){_iterator42.return();}}finally{if(_didIteratorError42){throw _iteratorError42;}}}}},{key:'_getBinderAttrValue',value:function _getBinderAttrValue(key){if(!key)return null;if(key.startsWith('layout_')||key.startsWith('android:layout_')){var params=this.getLayoutParams();if(params){return params.getAttrBinder().getAttrValue(key);}}else{return this._attrBinder.getAttrValue(key);}}},{key:'onBindElementAttributeChanged',value:function onBindElementAttributeChanged(attributeName,oldVal,newVal){var parts=attributeName.split(\":\");var attrName=parts[parts.length-1].toLowerCase();if(newVal==='true')newVal=true;else if(newVal==='false')newVal=false;if(attrName.startsWith('layout_')){var params=this.getLayoutParams();if(params){params.getAttrBinder().onAttrChange(attrName,newVal,this.getContext());this.requestLayout();}return;}this._attrBinder.onAttrChange(attrName,newVal,this.getContext());}},{key:'tagName',value:function tagName(){return this.constructor.name;}},{key:'mLeft',get:function get(){return this._mLeft;},set:function set(value){this._mLeft=Math.floor(value);this.requestSyncBoundToElement();}},{key:'mRight',get:function get(){return this._mRight;},set:function set(value){this._mRight=Math.floor(value);this.requestSyncBoundToElement();}},{key:'mTop',get:function get(){return this._mTop;},set:function set(value){if(Number.isNaN(value)){debugger;}this._mTop=Math.floor(value);this.requestSyncBoundToElement();}},{key:'mBottom',get:function get(){return this._mBottom;},set:function set(value){this._mBottom=Math.floor(value);this.requestSyncBoundToElement();}},{key:'mScrollX',get:function get(){return this._mScrollX;},set:function set(value){this._mScrollX=Math.floor(value);this.requestSyncBoundToElement();}},{key:'mScrollY',get:function get(){return this._mScrollY;},set:function set(value){this._mScrollY=Math.floor(value);this.requestSyncBoundToElement();}}],[{key:'combineMeasuredStates',value:function combineMeasuredStates(curState,newState){return curState|newState;}},{key:'resolveSize',value:function resolveSize(size,measureSpec){return View.resolveSizeAndState(size,measureSpec,0)&View.MEASURED_SIZE_MASK;}},{key:'resolveSizeAndState',value:function resolveSizeAndState(size,measureSpec,childMeasuredState){var MeasureSpec=View.MeasureSpec;var result=size;var specMode=MeasureSpec.getMode(measureSpec);var specSize=MeasureSpec.getSize(measureSpec);switch(specMode){case MeasureSpec.UNSPECIFIED:result=size;break;case MeasureSpec.AT_MOST:if(specSize<size){result=specSize|View.MEASURED_STATE_TOO_SMALL;}else{result=size;}break;case MeasureSpec.EXACTLY:result=specSize;break;}return result|childMeasuredState&View.MEASURED_STATE_MASK;}},{key:'getDefaultSize',value:function getDefaultSize(size,measureSpec){var MeasureSpec=View.MeasureSpec;var result=size;var specMode=MeasureSpec.getMode(measureSpec);var specSize=MeasureSpec.getSize(measureSpec);switch(specMode){case MeasureSpec.UNSPECIFIED:result=size;break;case MeasureSpec.AT_MOST:case MeasureSpec.EXACTLY:result=specSize;break;}return result;}},{key:'mergeDrawableStates',value:function mergeDrawableStates(baseState,additionalState){var N=baseState.length;var i=N-1;while(i>=0&&!baseState[i]){i--;}System.arraycopy(additionalState,0,baseState,i+1,additionalState.length);return baseState;}},{key:'inflate',value:function inflate(context,xml,root){return view_1.LayoutInflater.from(context).inflate(xml,root);}},{key:'_AttrObserverCallBack',value:function _AttrObserverCallBack(arr,observer){arr.forEach(function(record){var target=record.target;var androidView=target[View.AndroidViewProperty];if(!androidView)return;var attrName=record.attributeName;var newValue=target.getAttribute(attrName);var oldValue=record.oldValue;if(newValue===oldValue)return;androidView.onBindElementAttributeChanged(attrName,record.oldValue,newValue);});}}]);return View;}(JavaObject);View.DBG=Log.View_DBG;View.VIEW_LOG_TAG=\"View\";View.PFLAG_WANTS_FOCUS=0x00000001;View.PFLAG_FOCUSED=0x00000002;View.PFLAG_SELECTED=0x00000004;View.PFLAG_IS_ROOT_NAMESPACE=0x00000008;View.PFLAG_HAS_BOUNDS=0x00000010;View.PFLAG_DRAWN=0x00000020;View.PFLAG_DRAW_ANIMATION=0x00000040;View.PFLAG_SKIP_DRAW=0x00000080;View.PFLAG_ONLY_DRAWS_BACKGROUND=0x00000100;View.PFLAG_REQUEST_TRANSPARENT_REGIONS=0x00000200;View.PFLAG_DRAWABLE_STATE_DIRTY=0x00000400;View.PFLAG_MEASURED_DIMENSION_SET=0x00000800;View.PFLAG_FORCE_LAYOUT=0x00001000;View.PFLAG_LAYOUT_REQUIRED=0x00002000;View.PFLAG_PRESSED=0x00004000;View.PFLAG_DRAWING_CACHE_VALID=0x00008000;View.PFLAG_ANIMATION_STARTED=0x00010000;View.PFLAG_ALPHA_SET=0x00040000;View.PFLAG_SCROLL_CONTAINER=0x00080000;View.PFLAG_SCROLL_CONTAINER_ADDED=0x00100000;View.PFLAG_DIRTY=0x00200000;View.PFLAG_DIRTY_OPAQUE=0x00400000;View.PFLAG_DIRTY_MASK=0x00600000;View.PFLAG_OPAQUE_BACKGROUND=0x00800000;View.PFLAG_OPAQUE_SCROLLBARS=0x01000000;View.PFLAG_OPAQUE_MASK=0x01800000;View.PFLAG_PREPRESSED=0x02000000;View.PFLAG_CANCEL_NEXT_UP_EVENT=0x04000000;View.PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH=0x08000000;View.PFLAG_HOVERED=0x10000000;View.PFLAG_PIVOT_EXPLICITLY_SET=0x20000000;View.PFLAG_ACTIVATED=0x40000000;View.PFLAG_INVALIDATED=0x80000000;View.PFLAG2_VIEW_QUICK_REJECTED=0x10000000;View.PFLAG2_HAS_TRANSIENT_STATE=0x80000000;View.PFLAG3_VIEW_IS_ANIMATING_TRANSFORM=0x1;View.PFLAG3_VIEW_IS_ANIMATING_ALPHA=0x2;View.PFLAG3_IS_LAID_OUT=0x4;View.PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT=0x8;View.PFLAG3_CALLED_SUPER=0x10;View.NOT_FOCUSABLE=0x00000000;View.FOCUSABLE=0x00000001;View.FOCUSABLE_MASK=0x00000001;View.OVER_SCROLL_ALWAYS=0;View.OVER_SCROLL_IF_CONTENT_SCROLLS=1;View.OVER_SCROLL_NEVER=2;View.MEASURED_SIZE_MASK=0x00ffffff;View.MEASURED_STATE_MASK=0xff000000;View.MEASURED_HEIGHT_STATE_SHIFT=16;View.MEASURED_STATE_TOO_SMALL=0x01000000;View.VISIBILITY_MASK=0x0000000C;View.VISIBLE=0x00000000;View.INVISIBLE=0x00000004;View.GONE=0x00000008;View.ENABLED=0x00000000;View.DISABLED=0x00000020;View.ENABLED_MASK=0x00000020;View.WILL_NOT_DRAW=0x00000080;View.DRAW_MASK=0x00000080;View.SCROLLBARS_NONE=0x00000000;View.SCROLLBARS_HORIZONTAL=0x00000100;View.SCROLLBARS_VERTICAL=0x00000200;View.SCROLLBARS_MASK=0x00000300;View.FOCUSABLES_ALL=0x00000000;View.FOCUSABLES_TOUCH_MODE=0x00000001;View.FOCUS_BACKWARD=0x00000001;View.FOCUS_FORWARD=0x00000002;View.FOCUS_LEFT=0x00000011;View.FOCUS_UP=0x00000021;View.FOCUS_RIGHT=0x00000042;View.FOCUS_DOWN=0x00000082;View.VIEW_STATE_WINDOW_FOCUSED=1;View.VIEW_STATE_SELECTED=1<<1;View.VIEW_STATE_FOCUSED=1<<2;View.VIEW_STATE_ENABLED=1<<3;View.VIEW_STATE_PRESSED=1<<4;View.VIEW_STATE_ACTIVATED=1<<5;View.VIEW_STATE_HOVERED=1<<7;View.VIEW_STATE_CHECKED=1<<10;View.VIEW_STATE_MULTILINE=1<<11;View.VIEW_STATE_EXPANDED=1<<12;View.VIEW_STATE_EMPTY=1<<13;View.VIEW_STATE_LAST=1<<14;View.VIEW_STATE_IDS=[View.VIEW_STATE_WINDOW_FOCUSED,View.VIEW_STATE_WINDOW_FOCUSED,View.VIEW_STATE_SELECTED,View.VIEW_STATE_SELECTED,View.VIEW_STATE_FOCUSED,View.VIEW_STATE_FOCUSED,View.VIEW_STATE_ENABLED,View.VIEW_STATE_ENABLED,View.VIEW_STATE_PRESSED,View.VIEW_STATE_PRESSED,View.VIEW_STATE_ACTIVATED,View.VIEW_STATE_ACTIVATED,View.VIEW_STATE_HOVERED,View.VIEW_STATE_HOVERED];View._static=function(){function Integer_bitCount(i){i=i-(i>>>1&0x55555555);i=(i&0x33333333)+(i>>>2&0x33333333);i=i+(i>>>4)&0x0f0f0f0f;i=i+(i>>>8);i=i+(i>>>16);return i&0x3f;}var orderedIds=View.VIEW_STATE_IDS;var NUM_BITS=View.VIEW_STATE_IDS.length/2;View.VIEW_STATE_SETS=new Array(1<<NUM_BITS);for(var i=0;i<View.VIEW_STATE_SETS.length;i++){var numBits=Integer_bitCount(i);var stataSet=androidui.util.ArrayCreator.newNumberArray(numBits);var pos=0;for(var j=0;j<orderedIds.length;j+=2){if((i&orderedIds[j+1])!=0){stataSet[pos++]=orderedIds[j];}}View.VIEW_STATE_SETS[i]=stataSet;}View.EMPTY_STATE_SET=View.VIEW_STATE_SETS[0];View.WINDOW_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED];View.SELECTED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED];View.SELECTED_WINDOW_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED|View.VIEW_STATE_SELECTED];View.FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_FOCUSED];View.FOCUSED_WINDOW_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED|View.VIEW_STATE_FOCUSED];View.FOCUSED_SELECTED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED|View.VIEW_STATE_FOCUSED];View.FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED|View.VIEW_STATE_SELECTED|View.VIEW_STATE_FOCUSED];View.ENABLED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_ENABLED];View.ENABLED_WINDOW_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED|View.VIEW_STATE_ENABLED];View.ENABLED_SELECTED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED|View.VIEW_STATE_ENABLED];View.ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED|View.VIEW_STATE_SELECTED|View.VIEW_STATE_ENABLED];View.ENABLED_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_FOCUSED|View.VIEW_STATE_ENABLED];View.ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED|View.VIEW_STATE_FOCUSED|View.VIEW_STATE_ENABLED];View.ENABLED_FOCUSED_SELECTED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED|View.VIEW_STATE_FOCUSED|View.VIEW_STATE_ENABLED];View.ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED|View.VIEW_STATE_SELECTED|View.VIEW_STATE_FOCUSED|View.VIEW_STATE_ENABLED];View.PRESSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_PRESSED];View.PRESSED_WINDOW_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED|View.VIEW_STATE_PRESSED];View.PRESSED_SELECTED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED|View.VIEW_STATE_PRESSED];View.PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED|View.VIEW_STATE_SELECTED|View.VIEW_STATE_PRESSED];View.PRESSED_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_FOCUSED|View.VIEW_STATE_PRESSED];View.PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED|View.VIEW_STATE_FOCUSED|View.VIEW_STATE_PRESSED];View.PRESSED_FOCUSED_SELECTED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED|View.VIEW_STATE_FOCUSED|View.VIEW_STATE_PRESSED];View.PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED|View.VIEW_STATE_SELECTED|View.VIEW_STATE_FOCUSED|View.VIEW_STATE_PRESSED];View.PRESSED_ENABLED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_ENABLED|View.VIEW_STATE_PRESSED];View.PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED|View.VIEW_STATE_ENABLED|View.VIEW_STATE_PRESSED];View.PRESSED_ENABLED_SELECTED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED|View.VIEW_STATE_ENABLED|View.VIEW_STATE_PRESSED];View.PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED|View.VIEW_STATE_SELECTED|View.VIEW_STATE_ENABLED|View.VIEW_STATE_PRESSED];View.PRESSED_ENABLED_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_FOCUSED|View.VIEW_STATE_ENABLED|View.VIEW_STATE_PRESSED];View.PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED|View.VIEW_STATE_FOCUSED|View.VIEW_STATE_ENABLED|View.VIEW_STATE_PRESSED];View.PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED|View.VIEW_STATE_FOCUSED|View.VIEW_STATE_ENABLED|View.VIEW_STATE_PRESSED];View.PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET=View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED|View.VIEW_STATE_SELECTED|View.VIEW_STATE_FOCUSED|View.VIEW_STATE_ENABLED|View.VIEW_STATE_PRESSED];}();View.CLICKABLE=0x00004000;View.DRAWING_CACHE_ENABLED=0x00008000;View.WILL_NOT_CACHE_DRAWING=0x000020000;View.FOCUSABLE_IN_TOUCH_MODE=0x00040000;View.LONG_CLICKABLE=0x00200000;View.DUPLICATE_PARENT_STATE=0x00400000;View.LAYER_TYPE_NONE=0;View.LAYER_TYPE_SOFTWARE=1;View.LAYOUT_DIRECTION_LTR=LayoutDirection.LTR;View.LAYOUT_DIRECTION_RTL=LayoutDirection.RTL;View.LAYOUT_DIRECTION_INHERIT=LayoutDirection.INHERIT;View.LAYOUT_DIRECTION_LOCALE=LayoutDirection.LOCALE;View.TEXT_DIRECTION_INHERIT=0;View.TEXT_DIRECTION_FIRST_STRONG=1;View.TEXT_DIRECTION_ANY_RTL=2;View.TEXT_DIRECTION_LTR=3;View.TEXT_DIRECTION_RTL=4;View.TEXT_DIRECTION_LOCALE=5;View.TEXT_DIRECTION_DEFAULT=View.TEXT_DIRECTION_INHERIT;View.TEXT_DIRECTION_RESOLVED_DEFAULT=View.TEXT_DIRECTION_FIRST_STRONG;View.TEXT_ALIGNMENT_INHERIT=0;View.TEXT_ALIGNMENT_GRAVITY=1;View.TEXT_ALIGNMENT_TEXT_START=2;View.TEXT_ALIGNMENT_TEXT_END=3;View.TEXT_ALIGNMENT_CENTER=4;View.TEXT_ALIGNMENT_VIEW_START=5;View.TEXT_ALIGNMENT_VIEW_END=6;View.TEXT_ALIGNMENT_DEFAULT=View.TEXT_ALIGNMENT_GRAVITY;View.TEXT_ALIGNMENT_RESOLVED_DEFAULT=View.TEXT_ALIGNMENT_GRAVITY;View.ViewClassAttrBinderClazzMap=new Map();View.AndroidViewProperty='AndroidView';View.TempMatrixValue=androidui.util.ArrayCreator.newNumberArray(9);view_1.View=View;(function(View){var TransformationInfo=function TransformationInfo(){_classCallCheck(this,TransformationInfo);this.mMatrix=new Matrix();this.mMatrixDirty=false;this.mInverseMatrixDirty=true;this.mMatrixIsIdentity=true;this.mPrevWidth=-1;this.mPrevHeight=-1;this.mRotation=0;this.mTranslationX=0;this.mTranslationY=0;this.mScaleX=1;this.mScaleY=1;this.mPivotX=0;this.mPivotY=0;this.mAlpha=1;this.mTransitionAlpha=1;};View.TransformationInfo=TransformationInfo;var MeasureSpec=function(){function MeasureSpec(){_classCallCheck(this,MeasureSpec);}_createClass(MeasureSpec,null,[{key:'makeMeasureSpec',value:function makeMeasureSpec(size,mode){return size&~MeasureSpec.MODE_MASK|mode&MeasureSpec.MODE_MASK;}},{key:'getMode',value:function getMode(measureSpec){return measureSpec&MeasureSpec.MODE_MASK;}},{key:'getSize',value:function getSize(measureSpec){return measureSpec&~MeasureSpec.MODE_MASK;}},{key:'adjust',value:function adjust(measureSpec,delta){return MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(measureSpec+delta),MeasureSpec.getMode(measureSpec));}},{key:'toString',value:function toString(measureSpec){var mode=MeasureSpec.getMode(measureSpec);var size=MeasureSpec.getSize(measureSpec);var sb=new StringBuilder(\"MeasureSpec: \");if(mode==MeasureSpec.UNSPECIFIED)sb.append(\"UNSPECIFIED \");else if(mode==MeasureSpec.EXACTLY)sb.append(\"EXACTLY \");else if(mode==MeasureSpec.AT_MOST)sb.append(\"AT_MOST \");else sb.append(mode).append(\" \");sb.append(size);return sb.toString();}}]);return MeasureSpec;}();MeasureSpec.MODE_SHIFT=30;MeasureSpec.MODE_MASK=0x3<<MeasureSpec.MODE_SHIFT;MeasureSpec.UNSPECIFIED=0<<MeasureSpec.MODE_SHIFT;MeasureSpec.EXACTLY=1<<MeasureSpec.MODE_SHIFT;MeasureSpec.AT_MOST=2<<MeasureSpec.MODE_SHIFT;View.MeasureSpec=MeasureSpec;var AttachInfo=function AttachInfo(mViewRootImpl,mHandler){_classCallCheck(this,AttachInfo);this.mKeyDispatchState=new KeyEvent.DispatcherState();this.mTmpInvalRect=new Rect();this.mTmpTransformRect=new Rect();this.mPoint=new Point();this.mTmpMatrix=new Matrix();this.mTmpTransformation=new Transformation();this.mTmpTransformLocation=androidui.util.ArrayCreator.newNumberArray(2);this.mScrollContainers=new Set();this.mInvalidateChildLocation=androidui.util.ArrayCreator.newNumberArray(2);this.mHasWindowFocus=false;this.mWindowVisibility=0;this.mViewRootImpl=mViewRootImpl;this.mHandler=mHandler;};View.AttachInfo=AttachInfo;var ListenerInfo=function ListenerInfo(){_classCallCheck(this,ListenerInfo);};View.ListenerInfo=ListenerInfo;var OnClickListener;(function(OnClickListener){function fromFunction(func){return{onClick:func};}OnClickListener.fromFunction=fromFunction;})(OnClickListener=View.OnClickListener||(View.OnClickListener={}));var OnLongClickListener;(function(OnLongClickListener){function fromFunction(func){return{onLongClick:func};}OnLongClickListener.fromFunction=fromFunction;})(OnLongClickListener=View.OnLongClickListener||(View.OnLongClickListener={}));var OnFocusChangeListener;(function(OnFocusChangeListener){function fromFunction(func){return{onFocusChange:func};}OnFocusChangeListener.fromFunction=fromFunction;})(OnFocusChangeListener=View.OnFocusChangeListener||(View.OnFocusChangeListener={}));var OnTouchListener;(function(OnTouchListener){function fromFunction(func){return{onTouch:func};}OnTouchListener.fromFunction=fromFunction;})(OnTouchListener=View.OnTouchListener||(View.OnTouchListener={}));var OnKeyListener;(function(OnKeyListener){function fromFunction(func){return{onKey:func};}OnKeyListener.fromFunction=fromFunction;})(OnKeyListener=View.OnKeyListener||(View.OnKeyListener={}));var OnGenericMotionListener;(function(OnGenericMotionListener){function fromFunction(func){return{onGenericMotion:func};}OnGenericMotionListener.fromFunction=fromFunction;})(OnGenericMotionListener=View.OnGenericMotionListener||(View.OnGenericMotionListener={}));})(View=view_1.View||(view_1.View={}));(function(View){var AttachInfo;(function(AttachInfo){var InvalidateInfo=function(){function InvalidateInfo(){_classCallCheck(this,InvalidateInfo);this.left=0;this.top=0;this.right=0;this.bottom=0;}_createClass(InvalidateInfo,[{key:'recycle',value:function recycle(){this.target=null;InvalidateInfo.sPool.release(this);}}],[{key:'obtain',value:function obtain(){var instance=InvalidateInfo.sPool.acquire();return instance!=null?instance:new InvalidateInfo();}}]);return InvalidateInfo;}();InvalidateInfo.POOL_LIMIT=10;InvalidateInfo.sPool=new Pools.SynchronizedPool(InvalidateInfo.POOL_LIMIT);AttachInfo.InvalidateInfo=InvalidateInfo;})(AttachInfo=View.AttachInfo||(View.AttachInfo={}));})(View=view_1.View||(view_1.View={}));var CheckForLongPress=function(){function CheckForLongPress(View_this){_classCallCheck(this,CheckForLongPress);this.mOriginalWindowAttachCount=0;this.View_this=View_this;}_createClass(CheckForLongPress,[{key:'run',value:function run(){if(this.View_this.isPressed()&&this.View_this.mParent!=null&&this.mOriginalWindowAttachCount==this.View_this.mWindowAttachCount){if(this.View_this.performLongClick()){this.View_this.mHasPerformedLongPress=true;}}}},{key:'rememberWindowAttachCount',value:function rememberWindowAttachCount(){this.mOriginalWindowAttachCount=this.View_this.mWindowAttachCount;}}]);return CheckForLongPress;}();var CheckForTap=function(){function CheckForTap(View_this){_classCallCheck(this,CheckForTap);this.View_this=View_this;}_createClass(CheckForTap,[{key:'run',value:function run(){this.View_this.mPrivateFlags&=~View.PFLAG_PREPRESSED;this.View_this.setPressed(true);this.View_this.checkForLongClick(view_1.ViewConfiguration.getTapTimeout());}}]);return CheckForTap;}();var PerformClick=function(){function PerformClick(View_this){_classCallCheck(this,PerformClick);this.View_this=View_this;}_createClass(PerformClick,[{key:'run',value:function run(){this.View_this.performClick();}}]);return PerformClick;}();var PerformClickAfterPressDraw=function(){function PerformClickAfterPressDraw(View_this){_classCallCheck(this,PerformClickAfterPressDraw);this.View_this=View_this;}_createClass(PerformClickAfterPressDraw,[{key:'run',value:function run(){this.View_this.post(this.View_this.mPerformClick);}}]);return PerformClickAfterPressDraw;}();var UnsetPressedState=function(){function UnsetPressedState(View_this){_classCallCheck(this,UnsetPressedState);this.View_this=View_this;}_createClass(UnsetPressedState,[{key:'run',value:function run(){this.View_this.setPressed(false);}}]);return UnsetPressedState;}();var ScrollabilityCache=function(){function ScrollabilityCache(host){_classCallCheck(this,ScrollabilityCache);this.fadeScrollBars=true;this.fadingEdgeLength=view_1.ViewConfiguration.get().getScaledFadingEdgeLength();this.scrollBarDefaultDelayBeforeFade=view_1.ViewConfiguration.getScrollDefaultDelay();this.scrollBarFadeDuration=view_1.ViewConfiguration.getScrollBarFadeDuration();this.scrollBarSize=view_1.ViewConfiguration.get().getScaledScrollBarSize();this.interpolator=new LinearInterpolator();this.state=ScrollabilityCache.OFF;this.host=host;this.scrollBar=new ScrollBarDrawable();var thumbColor=new ColorDrawable(0x44000000);var density=Resources.getDisplayMetrics().density;var thumb=new InsetDrawable(thumbColor,0,2*density,view_1.ViewConfiguration.get().getScaledScrollBarSize()/2,2*density);this.scrollBar.setHorizontalThumbDrawable(thumb);this.scrollBar.setVerticalThumbDrawable(thumb);}_createClass(ScrollabilityCache,[{key:'run',value:function run(){var now=AnimationUtils.currentAnimationTimeMillis();if(now>=this.fadeStartTime){this.state=ScrollabilityCache.FADING;this.host.invalidate(true);}}},{key:'_computeAlphaToScrollBar',value:function _computeAlphaToScrollBar(){var now=AnimationUtils.currentAnimationTimeMillis();var factor=(now-this.fadeStartTime)/this.scrollBarFadeDuration;if(factor>=1){this.state=ScrollabilityCache.OFF;factor=1;}var alpha=1-this.interpolator.getInterpolation(factor);this.scrollBar.setAlpha(255*alpha);}}]);return ScrollabilityCache;}();ScrollabilityCache.OFF=0;ScrollabilityCache.ON=1;ScrollabilityCache.FADING=2;var MatchIdPredicate=function(){function MatchIdPredicate(){_classCallCheck(this,MatchIdPredicate);}_createClass(MatchIdPredicate,[{key:'apply',value:function apply(view){return view.mID===this.mId;}}]);return MatchIdPredicate;}();})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var Rect=android.graphics.Rect;var Canvas=android.graphics.Canvas;var Surface=function(){function Surface(canvasElement,viewRoot){_classCallCheck(this,Surface);this.mLockedRect=new Rect();this.mCanvasBound=new Rect();this.mSupportDirtyDraw=true;this.mLockSaveCount=1;this.mCanvasElement=canvasElement;this.viewRoot=viewRoot;this.initImpl();}_createClass(Surface,[{key:'initImpl',value:function initImpl(){this.initCanvasBound();}},{key:'isValid',value:function isValid(){return true;}},{key:'notifyBoundChange',value:function notifyBoundChange(){this.initCanvasBound();}},{key:'initCanvasBound',value:function initCanvasBound(){var density=android.content.res.Resources.getDisplayMetrics().density;var clientRect=this.mCanvasElement.getBoundingClientRect();this.mCanvasBound.set(clientRect.left*density,clientRect.top*density,clientRect.right*density,clientRect.bottom*density);}},{key:'lockCanvas',value:function lockCanvas(dirty){var fullWidth=this.mCanvasBound.width();var fullHeight=this.mCanvasBound.height();if(!this.mSupportDirtyDraw)dirty.set(0,0,fullWidth,fullHeight);var rect=this.mLockedRect;rect.set(Math.floor(dirty.left),Math.floor(dirty.top),Math.ceil(dirty.right),Math.ceil(dirty.bottom));if(dirty.isEmpty()){rect.set(0,0,fullWidth,fullHeight);}if(rect.isEmpty())return null;return this.lockCanvasImpl(rect.left,rect.top,rect.width(),rect.height());}},{key:'lockCanvasImpl',value:function lockCanvasImpl(left,top,width,height){var canvas=void 0;if(Surface.DrawToCacheFirstMode){canvas=new Canvas(width,height);if(left!=0||top!=0)canvas.translate(-left,-top);}else{canvas=new SurfaceLockCanvas(this.mCanvasBound.width(),this.mCanvasBound.height(),this.mCanvasElement);this.mLockSaveCount=canvas.save();canvas.clipRect(left,top,left+width,top+height);}return canvas;}},{key:'unlockCanvasAndPost',value:function unlockCanvasAndPost(canvas){if(Surface.DrawToCacheFirstMode){var mCanvasContent=this.mCanvasElement.getContext('2d');if(canvas.mCanvasElement)mCanvasContent.drawImage(canvas.mCanvasElement,this.mLockedRect.left,this.mLockedRect.top);canvas.recycle();}else{canvas.restoreToCount(this.mLockSaveCount);}}},{key:'showFps',value:function showFps(fps){if(!this._showFPSNode){this._showFPSNode=document.createElement('div');this._showFPSNode.style.position='absolute';this._showFPSNode.style.top='0';this._showFPSNode.style.left='0';this._showFPSNode.style.width='60px';this._showFPSNode.style.fontSize='14px';this._showFPSNode.style.background='black';this._showFPSNode.style.color='white';this._showFPSNode.style.opacity='0.7';this._showFPSNode.style.zIndex='1';this.mCanvasElement.parentNode.appendChild(this._showFPSNode);}this._showFPSNode.innerText='FPS:'+fps.toFixed(1);}}]);return Surface;}();Surface.DrawToCacheFirstMode=false;view.Surface=Surface;var SurfaceLockCanvas=function(_Canvas){_inherits(SurfaceLockCanvas,_Canvas);function SurfaceLockCanvas(width,height,canvasElement){_classCallCheck(this,SurfaceLockCanvas);var _this39=_possibleConstructorReturn(this,(SurfaceLockCanvas.__proto__||Object.getPrototypeOf(SurfaceLockCanvas)).call(this,width,height));_this39.mCanvasElement=canvasElement;_this39._mCanvasContent=_this39.mCanvasElement.getContext(\"2d\");return _this39;}_createClass(SurfaceLockCanvas,[{key:'initCanvasImpl',value:function initCanvasImpl(){}}]);return SurfaceLockCanvas;}(Canvas);})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view_2){var View=android.view.View;var Rect=android.graphics.Rect;var Handler=android.os.Handler;var SystemClock=android.os.SystemClock;var System=java.lang.System;var Log=android.util.Log;var Surface=android.view.Surface;var ViewRootImpl=function(){function ViewRootImpl(){_classCallCheck(this,ViewRootImpl);this.mViewVisibility=View.GONE;this.mStopped=false;this.mWidth=-1;this.mHeight=-1;this.mDirty=new Rect();this.mIsAnimating=false;this.mTempRect=new Rect();this.mVisRect=new Rect();this.mTraversalScheduled=false;this.mWillDrawSoon=false;this.mIsInTraversal=false;this.mLayoutRequested=false;this.mFirst=true;this.mFullRedrawNeeded=false;this.mIsDrawing=false;this.mAdded=false;this.mAddedTouchMode=false;this.mInTouchMode=false;this.mWinFrame=new Rect();this.mLayoutRequesters=[];this.mHandler=new ViewRootHandler();this.mViewScrollChanged=false;this.mTreeObserver=new view_2.ViewTreeObserver();this.mIgnoreDirtyState=false;this.mSetIgnoreDirtyState=false;this.mDrawingTime=0;this.mFpsStartTime=-1;this.mFpsPrevTime=-1;this.mFpsNumFrames=0;this.mTraversalRunnable=new TraversalRunnable(this);this._continueTraversalesCount=0;this.mInvalidateOnAnimationRunnable=new InvalidateOnAnimationRunnable(this.mHandler);}_createClass(ViewRootImpl,[{key:'initSurface',value:function initSurface(canvasElement){this.mSurface=new Surface(canvasElement,this);}},{key:'notifyResized',value:function notifyResized(frame){this.mWinFrame.set(frame.left,frame.top,frame.right,frame.bottom);this.requestLayout();if(this.mSurface)this.mSurface.notifyBoundChange();}},{key:'setView',value:function setView(view){if(this.mView==null){this.mView=view;this.mAdded=true;this.requestLayout();view.assignParent(this);this.mAddedTouchMode=true;var syntheticInputStage=new SyntheticInputStage(this);var viewPostImeStage=new ViewPostImeInputStage(this,syntheticInputStage);var earlyPostImeStage=new EarlyPostImeInputStage(this,viewPostImeStage);this.mFirstInputStage=earlyPostImeStage;}}},{key:'getView',value:function getView(){return this.mView;}},{key:'getHostVisibility',value:function getHostVisibility(){return this.mView.getVisibility();}},{key:'scheduleTraversals',value:function scheduleTraversals(){if(!this.mTraversalScheduled){this.mTraversalScheduled=true;this.mHandler.postAsTraversal(this.mTraversalRunnable);}}},{key:'unscheduleTraversals',value:function unscheduleTraversals(){if(this.mTraversalScheduled){this.mTraversalScheduled=false;this.mHandler.removeCallbacks(this.mTraversalRunnable);}}},{key:'doTraversal',value:function doTraversal(){if(this.mTraversalScheduled){this.mTraversalScheduled=false;this.performTraversals();}}},{key:'measureHierarchy',value:function measureHierarchy(host,lp,desiredWindowWidth,desiredWindowHeight){var windowSizeMayChange=false;if(ViewRootImpl.DEBUG_ORIENTATION||ViewRootImpl.DEBUG_LAYOUT)Log.v(ViewRootImpl.TAG,\"Measuring \"+host+\" in display \"+desiredWindowWidth+\"x\"+desiredWindowHeight+\"...\");var childWidthMeasureSpec=ViewRootImpl.getRootMeasureSpec(desiredWindowWidth,lp.width);var childHeightMeasureSpec=ViewRootImpl.getRootMeasureSpec(desiredWindowHeight,lp.height);this.performMeasure(childWidthMeasureSpec,childHeightMeasureSpec);if(this.mWidth!=host.getMeasuredWidth()||this.mHeight!=host.getMeasuredHeight()){windowSizeMayChange=true;}if(ViewRootImpl.DBG){System.out.println(\"======================================\");System.out.println(\"performTraversals -- after measure\");host.debug();}return windowSizeMayChange;}},{key:'performTraversals',value:function performTraversals(){var host=this.mView;if(ViewRootImpl.DBG){System.out.println(\"======================================\");System.out.println(\"performTraversals\");host.debug();}if(host==null||!this.mAdded)return;this.mIsInTraversal=true;this.mWillDrawSoon=true;var windowSizeMayChange=false;var newSurface=false;var surfaceChanged=false;var lp=new view_2.ViewGroup.LayoutParams(view_2.ViewGroup.LayoutParams.MATCH_PARENT,view_2.ViewGroup.LayoutParams.MATCH_PARENT);var desiredWindowWidth=void 0;var desiredWindowHeight=void 0;var viewVisibility=this.getHostVisibility();var viewVisibilityChanged=this.mViewVisibility!=viewVisibility;var params=null;var frame=this.mWinFrame;desiredWindowWidth=frame.width();desiredWindowHeight=frame.height();if(this.mFirst){this.mFullRedrawNeeded=true;this.mLayoutRequested=true;viewVisibilityChanged=false;}else{if(desiredWindowWidth!=this.mWidth||desiredWindowHeight!=this.mHeight){if(ViewRootImpl.DEBUG_ORIENTATION){Log.v(ViewRootImpl.TAG,\"View \"+host+\" resized to: \"+frame);}this.mFullRedrawNeeded=true;this.mLayoutRequested=true;windowSizeMayChange=true;}}if(viewVisibilityChanged){}ViewRootImpl.getRunQueue(this).executeActions(this.mHandler);var layoutRequested=this.mLayoutRequested;if(layoutRequested){if(this.mFirst){this.mInTouchMode=!this.mAddedTouchMode;this.ensureTouchModeLocally(this.mAddedTouchMode);}else{if(lp.width<0||lp.height<0){windowSizeMayChange=true;}}windowSizeMayChange=this.measureHierarchy(host,lp,desiredWindowWidth,desiredWindowHeight)||windowSizeMayChange;}if(layoutRequested){this.mLayoutRequested=false;}var windowShouldResize=layoutRequested&&windowSizeMayChange&&(this.mWidth!=host.getMeasuredWidth()||this.mHeight!=host.getMeasuredHeight()||lp.width<0&&frame.width()!==desiredWindowWidth&&frame.width()!==this.mWidth||lp.height<0&&frame.height()!==desiredWindowHeight&&frame.height()!==this.mHeight);if(this.mFirst||windowShouldResize||viewVisibilityChanged){if(ViewRootImpl.DEBUG_LAYOUT){Log.i(ViewRootImpl.TAG,\"host=w:\"+host.getMeasuredWidth()+\", h:\"+host.getMeasuredHeight()+\", params=\"+params);}if(ViewRootImpl.DEBUG_ORIENTATION)Log.v(ViewRootImpl.TAG,\"Relayout returned: frame=\"+frame);if(this.mWidth!=frame.width()||this.mHeight!=frame.height()){this.mWidth=frame.width();this.mHeight=frame.height();}if(this.mWidth!=host.getMeasuredWidth()||this.mHeight!=host.getMeasuredHeight()){var childWidthMeasureSpec=ViewRootImpl.getRootMeasureSpec(this.mWidth,lp.width);var childHeightMeasureSpec=ViewRootImpl.getRootMeasureSpec(this.mHeight,lp.height);if(ViewRootImpl.DEBUG_LAYOUT)Log.v(ViewRootImpl.TAG,\"Ooops, something changed!  mWidth=\"+this.mWidth+\" measuredWidth=\"+host.getMeasuredWidth()+\" mHeight=\"+this.mHeight+\" measuredHeight=\"+host.getMeasuredHeight());this.performMeasure(childWidthMeasureSpec,childHeightMeasureSpec);layoutRequested=true;}}else{}var didLayout=layoutRequested;var triggerGlobalLayoutListener=didLayout;if(didLayout){this.performLayout(lp,desiredWindowWidth,desiredWindowHeight);if(ViewRootImpl.DBG){System.out.println(\"======================================\");System.out.println(\"performTraversals -- after setFrame\");host.debug();}}if(triggerGlobalLayoutListener){this.mTreeObserver.dispatchOnGlobalLayout();}var skipDraw=false;if(this.mFirst){if(ViewRootImpl.DEBUG_INPUT_RESIZE)Log.v(ViewRootImpl.TAG,\"First: mView.hasFocus()=\"+this.mView.hasFocus());if(this.mView!=null){if(!this.mView.hasFocus()){this.mView.requestFocus(View.FOCUS_FORWARD);if(ViewRootImpl.DEBUG_INPUT_RESIZE)Log.v(ViewRootImpl.TAG,\"First: requested focused view=\"+this.mView.findFocus());}else{if(ViewRootImpl.DEBUG_INPUT_RESIZE)Log.v(ViewRootImpl.TAG,\"First: existing focused view=\"+this.mView.findFocus());}}}this.mFirst=false;this.mWillDrawSoon=false;this.mViewVisibility=viewVisibility;var cancelDraw=this.mTreeObserver.dispatchOnPreDraw()||viewVisibility!=View.VISIBLE;if(!cancelDraw){if(!skipDraw){this.performDraw();}}else{if(viewVisibility==View.VISIBLE){this.scheduleTraversals();}}this.mIsInTraversal=false;this.checkContinueTraversalsNextFrame();}},{key:'performLayout',value:function performLayout(lp,desiredWindowWidth,desiredWindowHeight){var _this40=this;this.mLayoutRequested=false;this.mInLayout=true;var host=this.mView;if(ViewRootImpl.DEBUG_ORIENTATION||ViewRootImpl.DEBUG_LAYOUT){Log.v(ViewRootImpl.TAG,\"Laying out \"+host+\" to (\"+host.getMeasuredWidth()+\", \"+host.getMeasuredHeight()+\")\");}host.layout(0,0,host.getMeasuredWidth(),host.getMeasuredHeight());this.mInLayout=false;var numViewsRequestingLayout=this.mLayoutRequesters.length;if(numViewsRequestingLayout>0){var validLayoutRequesters=this.getValidLayoutRequesters(this.mLayoutRequesters,false);if(validLayoutRequesters!=null){this.mHandlingLayoutInLayoutRequest=true;var numValidRequests=validLayoutRequesters.length;for(var i=0;i<numValidRequests;++i){var _view4=validLayoutRequesters[i];Log.w(\"View\",\"requestLayout() improperly called by \"+_view4+\" during layout: running second layout pass\");_view4.requestLayout();}this.measureHierarchy(host,lp,desiredWindowWidth,desiredWindowHeight);this.mInLayout=true;host.layout(0,0,host.getMeasuredWidth(),host.getMeasuredHeight());this.mHandlingLayoutInLayoutRequest=false;validLayoutRequesters=this.getValidLayoutRequesters(this.mLayoutRequesters,true);if(validLayoutRequesters!=null){(function(){var finalRequesters=validLayoutRequesters;ViewRootImpl.getRunQueue(_this40).post({run:function run(){var numValidRequests=finalRequesters.length;for(var _i9=0;_i9<numValidRequests;++_i9){var _view5=finalRequesters[_i9];Log.w(\"View\",\"requestLayout() improperly called by \"+_view5+\" during second layout pass: posting in next frame\");_view5.requestLayout();}}});})();}}}this.mInLayout=false;}},{key:'getValidLayoutRequesters',value:function getValidLayoutRequesters(layoutRequesters,secondLayoutRequests){var numViewsRequestingLayout=layoutRequesters.length;var validLayoutRequesters=null;for(var i=0;i<numViewsRequestingLayout;++i){var _view6=layoutRequesters[i];if(_view6!=null&&_view6.mAttachInfo!=null&&_view6.mParent!=null&&(secondLayoutRequests||(_view6.mPrivateFlags&View.PFLAG_FORCE_LAYOUT)==View.PFLAG_FORCE_LAYOUT)){var gone=false;var parent=_view6;while(parent!=null){if((parent.mViewFlags&View.VISIBILITY_MASK)==View.GONE){gone=true;break;}if(parent.mParent instanceof View){parent=parent.mParent;}else{parent=null;}}if(!gone){if(validLayoutRequesters==null){validLayoutRequesters=[];}validLayoutRequesters.push(_view6);}}}if(!secondLayoutRequests){for(var _i10=0;_i10<numViewsRequestingLayout;++_i10){var _view7=layoutRequesters[_i10];while(_view7!=null&&(_view7.mPrivateFlags&View.PFLAG_FORCE_LAYOUT)!=0){_view7.mPrivateFlags&=~View.PFLAG_FORCE_LAYOUT;if(_view7.mParent instanceof View){_view7=_view7.mParent;}else{_view7=null;}}}}layoutRequesters.splice(0,layoutRequesters.length);return validLayoutRequesters;}},{key:'performMeasure',value:function performMeasure(childWidthMeasureSpec,childHeightMeasureSpec){this.mView.measure(childWidthMeasureSpec,childHeightMeasureSpec);}},{key:'isInLayout',value:function isInLayout(){return this.mInLayout;}},{key:'requestLayoutDuringLayout',value:function requestLayoutDuringLayout(view){if(view.mParent==null||view.mAttachInfo==null){return true;}if(this.mLayoutRequesters.indexOf(view)===-1){this.mLayoutRequesters.push(view);}if(!this.mHandlingLayoutInLayoutRequest){return true;}else{return false;}}},{key:'trackFPS',value:function trackFPS(){var nowTime=System.currentTimeMillis();if(this.mFpsStartTime<0){this.mFpsStartTime=this.mFpsPrevTime=nowTime;this.mFpsNumFrames=0;}else{this.mFpsNumFrames++;var frameTime=nowTime-this.mFpsPrevTime;var totalTime=nowTime-this.mFpsStartTime;this.mFpsPrevTime=nowTime;if(totalTime>1000){var fps=this.mFpsNumFrames*1000/totalTime;Log.v(ViewRootImpl.TAG,\"FPS:\\t\"+fps);this.mSurface.showFps(fps);this.mFpsStartTime=nowTime;this.mFpsNumFrames=0;}}}},{key:'performDraw',value:function performDraw(){var fullRedrawNeeded=this.mFullRedrawNeeded;this.mFullRedrawNeeded=false;this.mIsDrawing=true;try{this.draw(fullRedrawNeeded);}finally{this.mIsDrawing=false;}}},{key:'draw',value:function draw(fullRedrawNeeded){var surface=this.mSurface;if(!surface.isValid()){return;}if(ViewRootImpl.DEBUG_FPS){this.trackFPS();}if(this.mViewScrollChanged){this.mViewScrollChanged=false;this.mTreeObserver.dispatchOnScrollChanged();}if(fullRedrawNeeded){this.mIgnoreDirtyState=true;this.mDirty.set(0,0,this.mWidth,this.mHeight);}if(ViewRootImpl.DEBUG_ORIENTATION||ViewRootImpl.DEBUG_DRAW){Log.v(ViewRootImpl.TAG,\"Draw \"+this.mView+\", width=\"+this.mWidth+\", height=\"+this.mHeight+\", dirty=\"+this.mDirty);}this.mTreeObserver.dispatchOnDraw();this.drawSoftware();}},{key:'drawSoftware',value:function drawSoftware(){var canvas=void 0;try{canvas=this.mSurface.lockCanvas(this.mDirty);if(!canvas)return;}catch(e){return;}this.mDirty.setEmpty();this.mIsAnimating=false;this.mDrawingTime=SystemClock.uptimeMillis();this.mView.mPrivateFlags|=View.PFLAG_DRAWN;this.mSetIgnoreDirtyState=false;if(!this.mSurface['lastRenderCanvas'])this.mView.draw(canvas);if(!this.mSetIgnoreDirtyState){this.mIgnoreDirtyState=false;}this.mSurface.unlockCanvasAndPost(this.mSurface['lastRenderCanvas']||canvas);if(ViewRootImpl.LOCAL_LOGV){Log.v(ViewRootImpl.TAG,\"Surface unlockCanvasAndPost\");}}},{key:'checkContinueTraversalsNextFrame',value:function checkContinueTraversalsNextFrame(){var continueFrame=ViewRootImpl.DEBUG_FPS?60:5;if(!this.mTraversalScheduled&&this._continueTraversalesCount<continueFrame){this._continueTraversalesCount++;this.scheduleTraversals();}else{this._continueTraversalesCount=0;}}},{key:'isLayoutRequested',value:function isLayoutRequested(){return this.mLayoutRequested;}},{key:'dispatchInvalidateDelayed',value:function dispatchInvalidateDelayed(view,delayMilliseconds){var msg=this.mHandler.obtainMessage(ViewRootHandler.MSG_INVALIDATE,view);this.mHandler.sendMessageDelayed(msg,delayMilliseconds);}},{key:'dispatchInvalidateRectDelayed',value:function dispatchInvalidateRectDelayed(info,delayMilliseconds){var msg=this.mHandler.obtainMessage(ViewRootHandler.MSG_INVALIDATE_RECT,info);this.mHandler.sendMessageDelayed(msg,delayMilliseconds);}},{key:'dispatchInvalidateOnAnimation',value:function dispatchInvalidateOnAnimation(view){this.mInvalidateOnAnimationRunnable.addView(view);}},{key:'dispatchInvalidateRectOnAnimation',value:function dispatchInvalidateRectOnAnimation(info){this.mInvalidateOnAnimationRunnable.addViewRect(info);}},{key:'cancelInvalidate',value:function cancelInvalidate(view){this.mHandler.removeMessages(ViewRootHandler.MSG_INVALIDATE,view);this.mHandler.removeMessages(ViewRootHandler.MSG_INVALIDATE_RECT,view);this.mInvalidateOnAnimationRunnable.removeView(view);}},{key:'getParent',value:function getParent(){return null;}},{key:'requestLayout',value:function requestLayout(){if(!this.mHandlingLayoutInLayoutRequest){this.mLayoutRequested=true;this.scheduleTraversals();}}},{key:'invalidate',value:function invalidate(){this.mDirty.set(0,0,this.mWidth,this.mHeight);this.scheduleTraversals();}},{key:'invalidateWorld',value:function invalidateWorld(view){view.invalidate();if(view instanceof view_2.ViewGroup){var parent=view;for(var i=0;i<parent.getChildCount();i++){this.invalidateWorld(parent.getChildAt(i));}}}},{key:'invalidateChild',value:function invalidateChild(child,dirty){this.invalidateChildInParent(null,dirty);}},{key:'invalidateChildInParent',value:function invalidateChildInParent(location,dirty){if(ViewRootImpl.DEBUG_DRAW)Log.v(ViewRootImpl.TAG,\"Invalidate child: \"+dirty);if(dirty==null){this.invalidate();return null;}else if(dirty.isEmpty()&&!this.mIsAnimating){return null;}var localDirty=this.mDirty;if(!localDirty.isEmpty()&&!localDirty.contains(dirty)){this.mSetIgnoreDirtyState=true;this.mIgnoreDirtyState=true;}localDirty.union(dirty.left,dirty.top,dirty.right,dirty.bottom);var intersected=localDirty.intersect(0,0,this.mWidth,this.mHeight);if(!intersected){localDirty.setEmpty();}if(!this.mWillDrawSoon&&(intersected||this.mIsAnimating)){this.scheduleTraversals();}return null;}},{key:'requestChildFocus',value:function requestChildFocus(child,focused){if(ViewRootImpl.DEBUG_INPUT_RESIZE){Log.v(ViewRootImpl.TAG,\"Request child focus: focus now \"+focused);}this.scheduleTraversals();}},{key:'clearChildFocus',value:function clearChildFocus(focused){if(ViewRootImpl.DEBUG_INPUT_RESIZE){Log.v(ViewRootImpl.TAG,\"Request child focus: focus now \"+focused);}this.scheduleTraversals();}},{key:'getChildVisibleRect',value:function getChildVisibleRect(child,r,offset){if(child!=this.mView){throw new Error(\"child is not mine, honest!\");}return r.intersect(0,0,this.mWidth,this.mHeight);}},{key:'focusSearch',value:function focusSearch(focused,direction){if(!(this.mView instanceof view_2.ViewGroup)){return null;}if(this.mView instanceof view_2.WindowManager.Layout){var topWindow=this.mView.getTopFocusableWindowView();if(topWindow)return view_2.FocusFinder.getInstance().findNextFocus(topWindow,focused,direction);}return view_2.FocusFinder.getInstance().findNextFocus(this.mView,focused,direction);}},{key:'bringChildToFront',value:function bringChildToFront(child){}},{key:'focusableViewAvailable',value:function focusableViewAvailable(v){if(this.mView!=null){if(!this.mView.hasFocus()){v.requestFocus();}else{var focused=this.mView.findFocus();if(focused instanceof view_2.ViewGroup){var group=focused;if(group.getDescendantFocusability()==view_2.ViewGroup.FOCUS_AFTER_DESCENDANTS&&ViewRootImpl.isViewDescendantOf(v,focused)){v.requestFocus();}}}}}},{key:'childDrawableStateChanged',value:function childDrawableStateChanged(child){}},{key:'requestDisallowInterceptTouchEvent',value:function requestDisallowInterceptTouchEvent(disallowIntercept){}},{key:'requestChildRectangleOnScreen',value:function requestChildRectangleOnScreen(child,rectangle,immediate){return false;}},{key:'childHasTransientStateChanged',value:function childHasTransientStateChanged(child,hasTransientState){}},{key:'dispatchInputEvent',value:function dispatchInputEvent(event){this.deliverInputEvent(event);var result=event[InputStage.FLAG_FINISHED_HANDLED];event[InputStage.FLAG_FINISHED]=false;event[InputStage.FLAG_FINISHED_HANDLED]=false;var continueToDom=event[ViewRootImpl.ContinueEventToDom];event[ViewRootImpl.ContinueEventToDom]=null;return result&&!continueToDom;}},{key:'deliverInputEvent',value:function deliverInputEvent(event){this.mFirstInputStage.deliver(event);}},{key:'finishInputEvent',value:function finishInputEvent(event){}},{key:'checkForLeavingTouchModeAndConsume',value:function checkForLeavingTouchModeAndConsume(event){if(!this.mInTouchMode){return false;}var action=event.getAction();if(action!=view_2.KeyEvent.ACTION_DOWN){return false;}if(ViewRootImpl.isNavigationKey(event)){return this.ensureTouchMode(false);}if(ViewRootImpl.isTypingKey(event)){this.ensureTouchMode(false);return false;}return false;}},{key:'ensureTouchMode',value:function ensureTouchMode(inTouchMode){if(ViewRootImpl.DBG)Log.d(\"touchmode\",\"ensureTouchMode(\"+inTouchMode+\"), current \"+\"touch mode is \"+this.mInTouchMode);if(this.mInTouchMode==inTouchMode)return false;return this.ensureTouchModeLocally(inTouchMode);}},{key:'ensureTouchModeLocally',value:function ensureTouchModeLocally(inTouchMode){if(ViewRootImpl.DBG)Log.d(\"touchmode\",\"ensureTouchModeLocally(\"+inTouchMode+\"), current \"+\"touch mode is \"+this.mInTouchMode);if(this.mInTouchMode==inTouchMode)return false;this.mInTouchMode=inTouchMode;this.mTreeObserver.dispatchOnTouchModeChanged(inTouchMode);return inTouchMode?this.enterTouchMode():this.leaveTouchMode();}},{key:'enterTouchMode',value:function enterTouchMode(){if(this.mView!=null&&this.mView.hasFocus()){var focused=this.mView.findFocus();if(focused!=null&&!focused.isFocusableInTouchMode()){var ancestorToTakeFocus=ViewRootImpl.findAncestorToTakeFocusInTouchMode(focused);if(ancestorToTakeFocus!=null){return ancestorToTakeFocus.requestFocus();}else{focused.clearFocusInternal(true,false);return true;}}}return false;}},{key:'leaveTouchMode',value:function leaveTouchMode(){if(this.mView!=null){if(this.mView.hasFocus()){var focusedView=this.mView.findFocus();if(!(focusedView instanceof view_2.ViewGroup)){return false;}else if(focusedView.getDescendantFocusability()!=view_2.ViewGroup.FOCUS_AFTER_DESCENDANTS){return false;}}var focused=this.focusSearch(null,View.FOCUS_DOWN);if(focused!=null){return focused.requestFocus(View.FOCUS_DOWN);}}return false;}}],[{key:'getRootMeasureSpec',value:function getRootMeasureSpec(windowSize,rootDimension){var MeasureSpec=View.MeasureSpec;var measureSpec=void 0;switch(rootDimension){case view_2.ViewGroup.LayoutParams.MATCH_PARENT:measureSpec=MeasureSpec.makeMeasureSpec(windowSize,MeasureSpec.EXACTLY);break;case view_2.ViewGroup.LayoutParams.WRAP_CONTENT:measureSpec=MeasureSpec.makeMeasureSpec(windowSize,MeasureSpec.AT_MOST);break;default:measureSpec=MeasureSpec.makeMeasureSpec(rootDimension,MeasureSpec.EXACTLY);break;}return measureSpec;}},{key:'isViewDescendantOf',value:function isViewDescendantOf(child,parent){if(child==parent){return true;}var theParent=child.getParent();return theParent instanceof view_2.ViewGroup&&ViewRootImpl.isViewDescendantOf(theParent,parent);}},{key:'isNavigationKey',value:function isNavigationKey(keyEvent){switch(keyEvent.getKeyCode()){case view_2.KeyEvent.KEYCODE_DPAD_LEFT:case view_2.KeyEvent.KEYCODE_DPAD_RIGHT:case view_2.KeyEvent.KEYCODE_DPAD_UP:case view_2.KeyEvent.KEYCODE_DPAD_DOWN:case view_2.KeyEvent.KEYCODE_DPAD_CENTER:case view_2.KeyEvent.KEYCODE_PAGE_UP:case view_2.KeyEvent.KEYCODE_PAGE_DOWN:case view_2.KeyEvent.KEYCODE_MOVE_HOME:case view_2.KeyEvent.KEYCODE_MOVE_END:case view_2.KeyEvent.KEYCODE_TAB:case view_2.KeyEvent.KEYCODE_SPACE:case view_2.KeyEvent.KEYCODE_ENTER:return true;}return false;}},{key:'isTypingKey',value:function isTypingKey(keyEvent){try{return keyEvent.mIsTypingKey;}catch(e){console.warn(e);}return true;}},{key:'findAncestorToTakeFocusInTouchMode',value:function findAncestorToTakeFocusInTouchMode(focused){var parent=focused.getParent();while(parent instanceof view_2.ViewGroup){var vgParent=parent;if(vgParent.getDescendantFocusability()==view_2.ViewGroup.FOCUS_AFTER_DESCENDANTS&&vgParent.isFocusableInTouchMode()){return vgParent;}if(vgParent.isRootNamespace()){return null;}else{parent=vgParent.getParent();}}return null;}},{key:'getRunQueue',value:function getRunQueue(viewRoot){if(viewRoot){if(!viewRoot.mRunQueue)viewRoot.mRunQueue=new ViewRootImpl.RunQueue();return viewRoot.mRunQueue;}else{if(!this.RunQueueInstance){this.RunQueueInstance=new RunQueueForNoViewRoot();}return this.RunQueueInstance;}}}]);return ViewRootImpl;}();ViewRootImpl.TAG=\"ViewRootImpl\";ViewRootImpl.DBG=Log.View_DBG;ViewRootImpl.LOCAL_LOGV=ViewRootImpl.DBG;ViewRootImpl.DEBUG_DRAW=false||ViewRootImpl.LOCAL_LOGV;ViewRootImpl.DEBUG_LAYOUT=false||ViewRootImpl.LOCAL_LOGV;ViewRootImpl.DEBUG_INPUT_RESIZE=false||ViewRootImpl.LOCAL_LOGV;ViewRootImpl.DEBUG_ORIENTATION=false||ViewRootImpl.LOCAL_LOGV;ViewRootImpl.DEBUG_CONFIGURATION=false||ViewRootImpl.LOCAL_LOGV;ViewRootImpl.DEBUG_FPS=false||ViewRootImpl.LOCAL_LOGV;ViewRootImpl.ContinueEventToDom=Symbol();view_2.ViewRootImpl=ViewRootImpl;(function(ViewRootImpl){var RunQueue=function(){function RunQueue(){_classCallCheck(this,RunQueue);this.mActions=[];}_createClass(RunQueue,[{key:'post',value:function post(action){this.postDelayed(action,0);}},{key:'postDelayed',value:function postDelayed(action,delayMillis){var handlerAction={action:action,delay:delayMillis};this.mActions.push(handlerAction);}},{key:'removeCallbacks',value:function removeCallbacks(action){this.mActions=this.mActions.filter(function(item){return item.action==action;});}},{key:'executeActions',value:function executeActions(handler){var _iteratorNormalCompletion43=true;var _didIteratorError43=false;var _iteratorError43=undefined;try{for(var _iterator43=this.mActions[Symbol.iterator](),_step43;!(_iteratorNormalCompletion43=(_step43=_iterator43.next()).done);_iteratorNormalCompletion43=true){var handlerAction=_step43.value;handler.postDelayed(handlerAction.action,handlerAction.delay);}}catch(err){_didIteratorError43=true;_iteratorError43=err;}finally{try{if(!_iteratorNormalCompletion43&&_iterator43.return){_iterator43.return();}}finally{if(_didIteratorError43){throw _iteratorError43;}}}this.mActions=[];}}]);return RunQueue;}();ViewRootImpl.RunQueue=RunQueue;})(ViewRootImpl=view_2.ViewRootImpl||(view_2.ViewRootImpl={}));var RunQueueForNoViewRoot=function(_ViewRootImpl$RunQueu){_inherits(RunQueueForNoViewRoot,_ViewRootImpl$RunQueu);function RunQueueForNoViewRoot(){_classCallCheck(this,RunQueueForNoViewRoot);return _possibleConstructorReturn(this,(RunQueueForNoViewRoot.__proto__||Object.getPrototypeOf(RunQueueForNoViewRoot)).apply(this,arguments));}_createClass(RunQueueForNoViewRoot,[{key:'postDelayed',value:function postDelayed(action,delayMillis){RunQueueForNoViewRoot.Handler.postDelayed(action,delayMillis);}},{key:'removeCallbacks',value:function removeCallbacks(action){RunQueueForNoViewRoot.Handler.removeCallbacks(action);}}]);return RunQueueForNoViewRoot;}(ViewRootImpl.RunQueue);RunQueueForNoViewRoot.Handler=new Handler();var TraversalRunnable=function(){function TraversalRunnable(impl){_classCallCheck(this,TraversalRunnable);this.ViewRootImpl_this=impl;}_createClass(TraversalRunnable,[{key:'run',value:function run(){this.ViewRootImpl_this.doTraversal();}}]);return TraversalRunnable;}();var InvalidateOnAnimationRunnable=function(){function InvalidateOnAnimationRunnable(handler){_classCallCheck(this,InvalidateOnAnimationRunnable);this.mPosted=false;this.mViews=new Set();this.mViewRects=new Map();this.mHandler=handler;}_createClass(InvalidateOnAnimationRunnable,[{key:'addView',value:function addView(view){this.mViews.add(view);this.postIfNeededLocked();}},{key:'addViewRect',value:function addViewRect(info){this.mViewRects.set(info.target,info);this.postIfNeededLocked();}},{key:'removeView',value:function removeView(view){this.mViews.delete(view);this.mViewRects.delete(view);if(this.mPosted&&this.mViews.size===0&&this.mViewRects.size===0){this.mHandler.removeCallbacks(this);this.mPosted=false;}}},{key:'run',value:function run(){this.mPosted=false;var _iteratorNormalCompletion44=true;var _didIteratorError44=false;var _iteratorError44=undefined;try{for(var _iterator44=this.mViews[Symbol.iterator](),_step44;!(_iteratorNormalCompletion44=(_step44=_iterator44.next()).done);_iteratorNormalCompletion44=true){var _view8=_step44.value;_view8.invalidate();}}catch(err){_didIteratorError44=true;_iteratorError44=err;}finally{try{if(!_iteratorNormalCompletion44&&_iterator44.return){_iterator44.return();}}finally{if(_didIteratorError44){throw _iteratorError44;}}}this.mViews.clear();var _iteratorNormalCompletion45=true;var _didIteratorError45=false;var _iteratorError45=undefined;try{for(var _iterator45=this.mViewRects.values()[Symbol.iterator](),_step45;!(_iteratorNormalCompletion45=(_step45=_iterator45.next()).done);_iteratorNormalCompletion45=true){var info=_step45.value;info.target.invalidate(info.left,info.top,info.right,info.bottom);info.recycle();}}catch(err){_didIteratorError45=true;_iteratorError45=err;}finally{try{if(!_iteratorNormalCompletion45&&_iterator45.return){_iterator45.return();}}finally{if(_didIteratorError45){throw _iteratorError45;}}}this.mViewRects.clear();}},{key:'postIfNeededLocked',value:function postIfNeededLocked(){if(!this.mPosted){this.mHandler.post(this);this.mPosted=true;}}}]);return InvalidateOnAnimationRunnable;}();var ViewRootHandler=function(_Handler){_inherits(ViewRootHandler,_Handler);function ViewRootHandler(){_classCallCheck(this,ViewRootHandler);return _possibleConstructorReturn(this,(ViewRootHandler.__proto__||Object.getPrototypeOf(ViewRootHandler)).apply(this,arguments));}_createClass(ViewRootHandler,[{key:'handleMessage',value:function handleMessage(msg){switch(msg.what){case ViewRootHandler.MSG_INVALIDATE:msg.obj.invalidate();break;case ViewRootHandler.MSG_INVALIDATE_RECT:var info=msg.obj;info.target.invalidate(info.left,info.top,info.right,info.bottom);info.recycle();break;}}}]);return ViewRootHandler;}(Handler);ViewRootHandler.MSG_INVALIDATE=1;ViewRootHandler.MSG_INVALIDATE_RECT=2;var InputStage=function(){function InputStage(impl,next){_classCallCheck(this,InputStage);this.ViewRootImpl_this=impl;this.mNext=next;}_createClass(InputStage,[{key:'deliver',value:function deliver(event){if(event[InputStage.FLAG_FINISHED]){this.forward(event);}else if(this.shouldDropInputEvent(event)){this.finish(event,false);}else{this.apply(event,this.onProcess(event));}}},{key:'finish',value:function finish(event,handled){event[InputStage.FLAG_FINISHED]=true;if(handled){event[InputStage.FLAG_FINISHED_HANDLED]=true;}this.forward(event);}},{key:'forward',value:function forward(event){this.onDeliverToNext(event);}},{key:'apply',value:function apply(event,result){if(result==InputStage.FORWARD){this.forward(event);}else if(result==InputStage.FINISH_HANDLED){this.finish(event,true);}else if(result==InputStage.FINISH_NOT_HANDLED){this.finish(event,false);}else{throw new Error(\"Invalid result: \"+result);}}},{key:'onDeliverToNext',value:function onDeliverToNext(event){if(this.mNext!=null){this.mNext.deliver(event);}else{this.ViewRootImpl_this.finishInputEvent(event);}}},{key:'onProcess',value:function onProcess(event){return InputStage.FORWARD;}},{key:'shouldDropInputEvent',value:function shouldDropInputEvent(event){if(this.ViewRootImpl_this.mView==null||!this.ViewRootImpl_this.mAdded){Log.w(ViewRootImpl.TAG,\"Dropping event due to root view being removed: \"+event);return true;}return false;}}]);return InputStage;}();InputStage.FLAG_FINISHED=Symbol();InputStage.FLAG_FINISHED_HANDLED=Symbol();InputStage.FORWARD=0;InputStage.FINISH_HANDLED=1;InputStage.FINISH_NOT_HANDLED=2;var EarlyPostImeInputStage=function(_InputStage){_inherits(EarlyPostImeInputStage,_InputStage);function EarlyPostImeInputStage(){_classCallCheck(this,EarlyPostImeInputStage);return _possibleConstructorReturn(this,(EarlyPostImeInputStage.__proto__||Object.getPrototypeOf(EarlyPostImeInputStage)).apply(this,arguments));}_createClass(EarlyPostImeInputStage,[{key:'onProcess',value:function onProcess(event){if(event instanceof view_2.MotionEvent){return this.processMotionEvent(event);}else if(event instanceof view_2.KeyEvent){return this.processKeyEvent(event);}return InputStage.FORWARD;}},{key:'processKeyEvent',value:function processKeyEvent(event){if(this.ViewRootImpl_this.checkForLeavingTouchModeAndConsume(event)){return InputStage.FINISH_HANDLED;}return InputStage.FORWARD;}},{key:'processMotionEvent',value:function processMotionEvent(event){var action=event.getAction();if(action==view_2.MotionEvent.ACTION_DOWN||action==view_2.MotionEvent.ACTION_SCROLL){this.ViewRootImpl_this.ensureTouchMode(true);}event.offsetLocation(-this.ViewRootImpl_this.mWinFrame.left,-this.ViewRootImpl_this.mWinFrame.top);return InputStage.FORWARD;}}]);return EarlyPostImeInputStage;}(InputStage);var ViewPostImeInputStage=function(_InputStage2){_inherits(ViewPostImeInputStage,_InputStage2);function ViewPostImeInputStage(){_classCallCheck(this,ViewPostImeInputStage);return _possibleConstructorReturn(this,(ViewPostImeInputStage.__proto__||Object.getPrototypeOf(ViewPostImeInputStage)).apply(this,arguments));}_createClass(ViewPostImeInputStage,[{key:'onProcess',value:function onProcess(event){if(event instanceof view_2.KeyEvent){return this.processKeyEvent(event);}else if(event instanceof view_2.MotionEvent){if(event.isTouchEvent()){return this.processTouchEvent(event);}else{return this.processGenericMotionEvent(event);}}return InputStage.FORWARD;}},{key:'processKeyEvent',value:function processKeyEvent(event){var mView=this.ViewRootImpl_this.mView;if(this.ViewRootImpl_this.mView.dispatchKeyEvent(event)){return InputStage.FINISH_HANDLED;}if(this.shouldDropInputEvent(event)){return InputStage.FINISH_NOT_HANDLED;}if(event.getAction()==view_2.KeyEvent.ACTION_DOWN&&event.isCtrlPressed()&&event.getRepeatCount()==0){if(this.shouldDropInputEvent(event)){return InputStage.FINISH_NOT_HANDLED;}}if(this.shouldDropInputEvent(event)){return InputStage.FINISH_NOT_HANDLED;}if(event.getAction()==view_2.KeyEvent.ACTION_DOWN){var direction=0;switch(event.getKeyCode()){case view_2.KeyEvent.KEYCODE_DPAD_LEFT:direction=View.FOCUS_LEFT;break;case view_2.KeyEvent.KEYCODE_DPAD_RIGHT:direction=View.FOCUS_RIGHT;break;case view_2.KeyEvent.KEYCODE_DPAD_UP:direction=View.FOCUS_UP;break;case view_2.KeyEvent.KEYCODE_DPAD_DOWN:direction=View.FOCUS_DOWN;break;case view_2.KeyEvent.KEYCODE_TAB:if(event.isShiftPressed()){direction=View.FOCUS_BACKWARD;}else{direction=View.FOCUS_FORWARD;}break;}if(direction!=0){var focused=mView.findFocus();if(focused!=null){var v=focused.focusSearch(direction);if(v!=null&&v!=focused){focused.getFocusedRect(this.ViewRootImpl_this.mTempRect);if(mView instanceof view_2.ViewGroup){mView.offsetDescendantRectToMyCoords(focused,this.ViewRootImpl_this.mTempRect);mView.offsetRectIntoDescendantCoords(v,this.ViewRootImpl_this.mTempRect);}if(v.requestFocus(direction,this.ViewRootImpl_this.mTempRect)){return InputStage.FINISH_HANDLED;}}if(mView.dispatchUnhandledMove(focused,direction)){return InputStage.FINISH_HANDLED;}}else{var _v=this.ViewRootImpl_this.focusSearch(null,direction);if(_v!=null&&_v.requestFocus(direction)){return InputStage.FINISH_HANDLED;}}}}return InputStage.FORWARD;}},{key:'processGenericMotionEvent',value:function processGenericMotionEvent(event){if(this.ViewRootImpl_this.mView.dispatchGenericMotionEvent(event)){return InputStage.FINISH_HANDLED;}return InputStage.FORWARD;}},{key:'processTouchEvent',value:function processTouchEvent(event){var handled=this.ViewRootImpl_this.mView.dispatchTouchEvent(event);return handled?InputStage.FINISH_HANDLED:InputStage.FORWARD;}}]);return ViewPostImeInputStage;}(InputStage);var SyntheticInputStage=function(_InputStage3){_inherits(SyntheticInputStage,_InputStage3);function SyntheticInputStage(){_classCallCheck(this,SyntheticInputStage);return _possibleConstructorReturn(this,(SyntheticInputStage.__proto__||Object.getPrototypeOf(SyntheticInputStage)).apply(this,arguments));}_createClass(SyntheticInputStage,[{key:'onProcess',value:function onProcess(event){return _get2(SyntheticInputStage.prototype.__proto__||Object.getPrototypeOf(SyntheticInputStage.prototype),'onProcess',this).call(this,event);}}]);return SyntheticInputStage;}(InputStage);})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view_3){var View=android.view.View;var Rect=android.graphics.Rect;var ArrayList=java.util.ArrayList;var FocusFinder=function(){function FocusFinder(){_classCallCheck(this,FocusFinder);this.mFocusedRect=new Rect();this.mOtherRect=new Rect();this.mBestCandidateRect=new Rect();this.mSequentialFocusComparator=new SequentialFocusComparator();this.mTempList=new ArrayList();}_createClass(FocusFinder,[{key:'findNextFocus',value:function findNextFocus(root,focused,direction){return this._findNextFocus(root,focused,null,direction);}},{key:'findNextFocusFromRect',value:function findNextFocusFromRect(root,focusedRect,direction){this.mFocusedRect.set(focusedRect);return this._findNextFocus(root,null,this.mFocusedRect,direction);}},{key:'_findNextFocus',value:function _findNextFocus(root,focused,focusedRect,direction){var next=null;if(focused!=null){next=this.findNextUserSpecifiedFocus(root,focused,direction);}if(next!=null){return next;}var focusables=this.mTempList;try{focusables.clear();root.addFocusables(focusables,direction);if(!focusables.isEmpty()){next=this.__findNextFocus(root,focused,focusedRect,direction,focusables);}}finally{focusables.clear();}return next;}},{key:'findNextUserSpecifiedFocus',value:function findNextUserSpecifiedFocus(root,focused,direction){var userSetNextFocus=focused.findUserSetNextFocus(root,direction);if(userSetNextFocus!=null&&userSetNextFocus.isFocusable()&&(!userSetNextFocus.isInTouchMode()||userSetNextFocus.isFocusableInTouchMode())){return userSetNextFocus;}return null;}},{key:'__findNextFocus',value:function __findNextFocus(root,focused,focusedRect,direction,focusables){if(focused!=null){if(focusedRect==null){focusedRect=this.mFocusedRect;}focused.getFocusedRect(focusedRect);root.offsetDescendantRectToMyCoords(focused,focusedRect);}else{if(focusedRect==null){focusedRect=this.mFocusedRect;switch(direction){case View.FOCUS_RIGHT:case View.FOCUS_DOWN:this.setFocusTopLeft(root,focusedRect);break;case View.FOCUS_FORWARD:this.setFocusTopLeft(root,focusedRect);break;case View.FOCUS_LEFT:case View.FOCUS_UP:this.setFocusBottomRight(root,focusedRect);break;case View.FOCUS_BACKWARD:this.setFocusBottomRight(root,focusedRect);}}}switch(direction){case View.FOCUS_FORWARD:case View.FOCUS_BACKWARD:return this.findNextFocusInRelativeDirection(focusables,root,focused,focusedRect,direction);case View.FOCUS_UP:case View.FOCUS_DOWN:case View.FOCUS_LEFT:case View.FOCUS_RIGHT:return this.findNextFocusInAbsoluteDirection(focusables,root,focused,focusedRect,direction);default:throw new Error(\"Unknown direction: \"+direction);}}},{key:'findNextFocusInRelativeDirection',value:function findNextFocusInRelativeDirection(focusables,root,focused,focusedRect,direction){try{this.mSequentialFocusComparator.setRoot(root);this.mSequentialFocusComparator.sort(focusables);}finally{this.mSequentialFocusComparator.recycle();}var count=focusables.size();switch(direction){case View.FOCUS_FORWARD:return FocusFinder.getNextFocusable(focused,focusables,count);case View.FOCUS_BACKWARD:return FocusFinder.getPreviousFocusable(focused,focusables,count);}return focusables.get(count-1);}},{key:'setFocusBottomRight',value:function setFocusBottomRight(root,focusedRect){var rootBottom=root.getScrollY()+root.getHeight();var rootRight=root.getScrollX()+root.getWidth();focusedRect.set(rootRight,rootBottom,rootRight,rootBottom);}},{key:'setFocusTopLeft',value:function setFocusTopLeft(root,focusedRect){var rootTop=root.getScrollY();var rootLeft=root.getScrollX();focusedRect.set(rootLeft,rootTop,rootLeft,rootTop);}},{key:'findNextFocusInAbsoluteDirection',value:function findNextFocusInAbsoluteDirection(focusables,root,focused,focusedRect,direction){this.mBestCandidateRect.set(focusedRect);switch(direction){case View.FOCUS_LEFT:this.mBestCandidateRect.offset(focusedRect.width()+1,0);break;case View.FOCUS_RIGHT:this.mBestCandidateRect.offset(-(focusedRect.width()+1),0);break;case View.FOCUS_UP:this.mBestCandidateRect.offset(0,focusedRect.height()+1);break;case View.FOCUS_DOWN:this.mBestCandidateRect.offset(0,-(focusedRect.height()+1));}var closest=null;var numFocusables=focusables.size();for(var i=0;i<numFocusables;i++){var focusable=focusables.get(i);if(focusable==focused||focusable==root)continue;focusable.getFocusedRect(this.mOtherRect);root.offsetDescendantRectToMyCoords(focusable,this.mOtherRect);if(this.isBetterCandidate(direction,focusedRect,this.mOtherRect,this.mBestCandidateRect)){this.mBestCandidateRect.set(this.mOtherRect);closest=focusable;}}return closest;}},{key:'isBetterCandidate',value:function isBetterCandidate(direction,source,rect1,rect2){if(!this.isCandidate(source,rect1,direction)){return false;}if(!this.isCandidate(source,rect2,direction)){return true;}if(this.beamBeats(direction,source,rect1,rect2)){return true;}if(this.beamBeats(direction,source,rect2,rect1)){return false;}return this.getWeightedDistanceFor(FocusFinder.majorAxisDistance(direction,source,rect1),FocusFinder.minorAxisDistance(direction,source,rect1))<this.getWeightedDistanceFor(FocusFinder.majorAxisDistance(direction,source,rect2),FocusFinder.minorAxisDistance(direction,source,rect2));}},{key:'beamBeats',value:function beamBeats(direction,source,rect1,rect2){var rect1InSrcBeam=this.beamsOverlap(direction,source,rect1);var rect2InSrcBeam=this.beamsOverlap(direction,source,rect2);if(rect2InSrcBeam||!rect1InSrcBeam){return false;}if(!this.isToDirectionOf(direction,source,rect2)){return true;}if(direction==View.FOCUS_LEFT||direction==View.FOCUS_RIGHT){return true;}return FocusFinder.majorAxisDistance(direction,source,rect1)<FocusFinder.majorAxisDistanceToFarEdge(direction,source,rect2);}},{key:'getWeightedDistanceFor',value:function getWeightedDistanceFor(majorAxisDistance,minorAxisDistance){return 13*majorAxisDistance*majorAxisDistance+minorAxisDistance*minorAxisDistance;}},{key:'isCandidate',value:function isCandidate(srcRect,destRect,direction){switch(direction){case View.FOCUS_LEFT:return(srcRect.right>destRect.right||srcRect.left>=destRect.right)&&srcRect.left>destRect.left;case View.FOCUS_RIGHT:return(srcRect.left<destRect.left||srcRect.right<=destRect.left)&&srcRect.right<destRect.right;case View.FOCUS_UP:return(srcRect.bottom>destRect.bottom||srcRect.top>=destRect.bottom)&&srcRect.top>destRect.top;case View.FOCUS_DOWN:return(srcRect.top<destRect.top||srcRect.bottom<=destRect.top)&&srcRect.bottom<destRect.bottom;}throw new Error(\"direction must be one of \"+\"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");}},{key:'beamsOverlap',value:function beamsOverlap(direction,rect1,rect2){switch(direction){case View.FOCUS_LEFT:case View.FOCUS_RIGHT:return rect2.bottom>=rect1.top&&rect2.top<=rect1.bottom;case View.FOCUS_UP:case View.FOCUS_DOWN:return rect2.right>=rect1.left&&rect2.left<=rect1.right;}throw new Error(\"direction must be one of \"+\"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");}},{key:'isToDirectionOf',value:function isToDirectionOf(direction,src,dest){switch(direction){case View.FOCUS_LEFT:return src.left>=dest.right;case View.FOCUS_RIGHT:return src.right<=dest.left;case View.FOCUS_UP:return src.top>=dest.bottom;case View.FOCUS_DOWN:return src.bottom<=dest.top;}throw new Error(\"direction must be one of \"+\"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");}},{key:'findNearestTouchable',value:function findNearestTouchable(root,x,y,direction,deltas){var touchables=root.getTouchables();var minDistance=Number.MAX_SAFE_INTEGER;var closest=null;var numTouchables=touchables.size();var edgeSlop=view_3.ViewConfiguration.get().getScaledEdgeSlop();var closestBounds=new Rect();var touchableBounds=this.mOtherRect;for(var i=0;i<numTouchables;i++){var touchable=touchables.get(i);touchable.getDrawingRect(touchableBounds);root.offsetRectBetweenParentAndChild(touchable,touchableBounds,true,true);if(!this.isTouchCandidate(x,y,touchableBounds,direction)){continue;}var distance=Number.MAX_SAFE_INTEGER;switch(direction){case View.FOCUS_LEFT:distance=x-touchableBounds.right+1;break;case View.FOCUS_RIGHT:distance=touchableBounds.left;break;case View.FOCUS_UP:distance=y-touchableBounds.bottom+1;break;case View.FOCUS_DOWN:distance=touchableBounds.top;break;}if(distance<edgeSlop){if(closest==null||closestBounds.contains(touchableBounds)||!touchableBounds.contains(closestBounds)&&distance<minDistance){minDistance=distance;closest=touchable;closestBounds.set(touchableBounds);switch(direction){case View.FOCUS_LEFT:deltas[0]=-distance;break;case View.FOCUS_RIGHT:deltas[0]=distance;break;case View.FOCUS_UP:deltas[1]=-distance;break;case View.FOCUS_DOWN:deltas[1]=distance;break;}}}}return closest;}},{key:'isTouchCandidate',value:function isTouchCandidate(x,y,destRect,direction){switch(direction){case View.FOCUS_LEFT:return destRect.left<=x&&destRect.top<=y&&y<=destRect.bottom;case View.FOCUS_RIGHT:return destRect.left>=x&&destRect.top<=y&&y<=destRect.bottom;case View.FOCUS_UP:return destRect.top<=y&&destRect.left<=x&&x<=destRect.right;case View.FOCUS_DOWN:return destRect.top>=y&&destRect.left<=x&&x<=destRect.right;}throw new Error(\"direction must be one of \"+\"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");}}],[{key:'getInstance',value:function getInstance(){if(!FocusFinder.sFocusFinder){FocusFinder.sFocusFinder=new FocusFinder();}return FocusFinder.sFocusFinder;}},{key:'getNextFocusable',value:function getNextFocusable(focused,focusables,count){if(focused!=null){var position=focusables.lastIndexOf(focused);if(position>=0&&position+1<count){return focusables.get(position+1);}}if(!focusables.isEmpty()){return focusables.get(0);}return null;}},{key:'getPreviousFocusable',value:function getPreviousFocusable(focused,focusables,count){if(focused!=null){var position=focusables.indexOf(focused);if(position>0){return focusables.get(position-1);}}if(!focusables.isEmpty()){return focusables.get(count-1);}return null;}},{key:'majorAxisDistance',value:function majorAxisDistance(direction,source,dest){return Math.max(0,FocusFinder.majorAxisDistanceRaw(direction,source,dest));}},{key:'majorAxisDistanceRaw',value:function majorAxisDistanceRaw(direction,source,dest){switch(direction){case View.FOCUS_LEFT:return source.left-dest.right;case View.FOCUS_RIGHT:return dest.left-source.right;case View.FOCUS_UP:return source.top-dest.bottom;case View.FOCUS_DOWN:return dest.top-source.bottom;}throw new Error(\"direction must be one of \"+\"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");}},{key:'majorAxisDistanceToFarEdge',value:function majorAxisDistanceToFarEdge(direction,source,dest){return Math.max(1,FocusFinder.majorAxisDistanceToFarEdgeRaw(direction,source,dest));}},{key:'majorAxisDistanceToFarEdgeRaw',value:function majorAxisDistanceToFarEdgeRaw(direction,source,dest){switch(direction){case View.FOCUS_LEFT:return source.left-dest.left;case View.FOCUS_RIGHT:return dest.right-source.right;case View.FOCUS_UP:return source.top-dest.top;case View.FOCUS_DOWN:return dest.bottom-source.bottom;}throw new Error(\"direction must be one of \"+\"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");}},{key:'minorAxisDistance',value:function minorAxisDistance(direction,source,dest){switch(direction){case View.FOCUS_LEFT:case View.FOCUS_RIGHT:return Math.abs(source.top+source.height()/2-(dest.top+dest.height()/2));case View.FOCUS_UP:case View.FOCUS_DOWN:return Math.abs(source.left+source.width()/2-(dest.left+dest.width()/2));}throw new Error(\"direction must be one of \"+\"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");}}]);return FocusFinder;}();view_3.FocusFinder=FocusFinder;var SequentialFocusComparator=function(){function SequentialFocusComparator(){var _this46=this;_classCallCheck(this,SequentialFocusComparator);this.mFirstRect=new Rect();this.mSecondRect=new Rect();this.mIsLayoutRtl=false;this.compareFn=function(first,second){if(first==second){return 0;}_this46.getRect(first,_this46.mFirstRect);_this46.getRect(second,_this46.mSecondRect);if(_this46.mFirstRect.top<_this46.mSecondRect.top){return-1;}else if(_this46.mFirstRect.top>_this46.mSecondRect.top){return 1;}else if(_this46.mFirstRect.left<_this46.mSecondRect.left){return _this46.mIsLayoutRtl?1:-1;}else if(_this46.mFirstRect.left>_this46.mSecondRect.left){return _this46.mIsLayoutRtl?-1:1;}else if(_this46.mFirstRect.bottom<_this46.mSecondRect.bottom){return-1;}else if(_this46.mFirstRect.bottom>_this46.mSecondRect.bottom){return 1;}else if(_this46.mFirstRect.right<_this46.mSecondRect.right){return _this46.mIsLayoutRtl?1:-1;}else if(_this46.mFirstRect.right>_this46.mSecondRect.right){return _this46.mIsLayoutRtl?-1:1;}else{return 0;}};}_createClass(SequentialFocusComparator,[{key:'recycle',value:function recycle(){this.mRoot=null;}},{key:'setRoot',value:function setRoot(root){this.mRoot=root;}},{key:'getRect',value:function getRect(view,rect){view.getDrawingRect(rect);this.mRoot.offsetDescendantRectToMyCoords(view,rect);}},{key:'sort',value:function sort(array){array.sort(this.compareFn);}}]);return SequentialFocusComparator;}();})(view=android.view||(android.view={}));})(android||(android={}));var java;(function(java){var lang;(function(lang){var Integer=function(){function Integer(){_classCallCheck(this,Integer);}_createClass(Integer,null,[{key:'parseInt',value:function parseInt(value){return Number.parseInt(value);}},{key:'toHexString',value:function toHexString(n){if(!n)return n+'';return n.toString(16);}}]);return Integer;}();Integer.MIN_VALUE=-0x80000000;Integer.MAX_VALUE=0x7fffffff;lang.Integer=Integer;})(lang=java.lang||(java.lang={}));})(java||(java={}));var android;(function(android){var view;(function(view_4){var Rect=android.graphics.Rect;var SystemClock=android.os.SystemClock;var Context=android.content.Context;var System=java.lang.System;var ArrayList=java.util.ArrayList;var Integer=java.lang.Integer;var Transformation=android.view.animation.Transformation;var AttrBinder=androidui.attr.AttrBinder;var ViewGroup=function(_view_4$View){_inherits(ViewGroup,_view_4$View);function ViewGroup(context,bindElement,defStyle){_classCallCheck(this,ViewGroup);var _this47=_possibleConstructorReturn(this,(ViewGroup.__proto__||Object.getPrototypeOf(ViewGroup)).call(this,context,bindElement,defStyle));_this47.mLastTouchDownTime=0;_this47.mLastTouchDownIndex=-1;_this47.mLastTouchDownX=0;_this47.mLastTouchDownY=0;_this47.mGroupFlags=0;_this47.mLayoutMode=ViewGroup.LAYOUT_MODE_UNDEFINED;_this47.mChildren=[];_this47.mSuppressLayout=false;_this47.mLayoutCalledWhileSuppressed=false;_this47.mChildCountWithTransientState=0;_this47.initViewGroup();if(bindElement||defStyle){_this47.initFromAttributes(context,bindElement,defStyle);}return _this47;}_createClass(ViewGroup,[{key:'initViewGroup',value:function initViewGroup(){this.setFlags(view_4.View.WILL_NOT_DRAW,view_4.View.DRAW_MASK);this.mGroupFlags|=ViewGroup.FLAG_CLIP_CHILDREN;this.mGroupFlags|=ViewGroup.FLAG_CLIP_TO_PADDING;this.mGroupFlags|=ViewGroup.FLAG_ANIMATION_DONE;this.mGroupFlags|=ViewGroup.FLAG_ANIMATION_CACHE;this.mGroupFlags|=ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE;this.mGroupFlags|=ViewGroup.FLAG_SPLIT_MOTION_EVENTS;this.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);this.mPersistentDrawingCache=ViewGroup.PERSISTENT_SCROLLING_CACHE;}},{key:'initFromAttributes',value:function initFromAttributes(context,attrs,defStyle){var a=context.obtainStyledAttributes(attrs,defStyle);var _iteratorNormalCompletion46=true;var _didIteratorError46=false;var _iteratorError46=undefined;try{for(var _iterator46=a.getLowerCaseNoNamespaceAttrNames()[Symbol.iterator](),_step46;!(_iteratorNormalCompletion46=(_step46=_iterator46.next()).done);_iteratorNormalCompletion46=true){var attr=_step46.value;switch(attr){case'clipchildren':this.setClipChildren(a.getBoolean(attr,true));break;case'cliptopadding':this.setClipToPadding(a.getBoolean(attr,true));break;case'animationcache':this.setAnimationCacheEnabled(a.getBoolean(attr,true));break;case'persistentdrawingcache':{var value=a.getAttrValue(attr);if(value==='none')this.setPersistentDrawingCache(ViewGroup.PERSISTENT_NO_CACHE);else if(value==='animation')this.setPersistentDrawingCache(ViewGroup.PERSISTENT_ANIMATION_CACHE);else if(value==='scrolling')this.setPersistentDrawingCache(ViewGroup.PERSISTENT_SCROLLING_CACHE);else if(value==='all')this.setPersistentDrawingCache(ViewGroup.PERSISTENT_ALL_CACHES);break;}case'addstatesfromchildren':this.setAddStatesFromChildren(a.getBoolean(attr,false));break;case'alwaysdrawnwithcache':this.setAlwaysDrawnWithCacheEnabled(a.getBoolean(attr,true));break;case'layoutanimation':break;case'descendantfocusability':{var _value=a.getAttrValue(attr);if(_value=='beforeDescendants')this.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);else if(_value=='afterDescendants')this.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);else if(_value=='blocksDescendants')this.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);break;}case'splitmotionevents':this.setMotionEventSplittingEnabled(a.getBoolean(attr,false));break;case'animatelayoutchanges':break;case'layoutmode':break;}}}catch(err){_didIteratorError46=true;_iteratorError46=err;}finally{try{if(!_iteratorNormalCompletion46&&_iterator46.return){_iterator46.return();}}finally{if(_didIteratorError46){throw _iteratorError46;}}}a.recycle();}},{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'createClassAttrBinder',this).call(this).set('clipChildren',{setter:function setter(v,value,attrBinder){v.setClipChildren(attrBinder.parseBoolean(value));},getter:function getter(v){return v.getClipChildren();}}).set('clipToPadding',{setter:function setter(v,value,attrBinder){v.setClipToPadding(attrBinder.parseBoolean(value));},getter:function getter(v){return v.isClipToPadding();}}).set('animationCache',{setter:function setter(v,value,attrBinder){v.setAnimationCacheEnabled(attrBinder.parseBoolean(value,true));}}).set('persistentDrawingCache',{setter:function setter(v,value,attrBinder){if(value==='none')v.setPersistentDrawingCache(ViewGroup.PERSISTENT_NO_CACHE);else if(value==='animation')v.setPersistentDrawingCache(ViewGroup.PERSISTENT_ANIMATION_CACHE);else if(value==='scrolling')v.setPersistentDrawingCache(ViewGroup.PERSISTENT_SCROLLING_CACHE);else if(value==='all')v.setPersistentDrawingCache(ViewGroup.PERSISTENT_ALL_CACHES);}}).set('addStatesFromChildren',{setter:function setter(v,value,attrBinder){v.setAddStatesFromChildren(attrBinder.parseBoolean(value,false));}}).set('alwaysDrawnWithCache',{setter:function setter(v,value,attrBinder){v.setAlwaysDrawnWithCacheEnabled(attrBinder.parseBoolean(value,true));}}).set('descendantFocusability',{setter:function setter(v,value,attrBinder){if(value=='beforeDescendants')this.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);else if(value=='afterDescendants')this.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);else if(value=='blocksDescendants')this.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);}}).set('splitMotionEvents',{setter:function setter(v,value,attrBinder){v.setMotionEventSplittingEnabled(attrBinder.parseBoolean(value,false));}});}},{key:'getDescendantFocusability',value:function getDescendantFocusability(){return this.mGroupFlags&ViewGroup.FLAG_MASK_FOCUSABILITY;}},{key:'setDescendantFocusability',value:function setDescendantFocusability(focusability){switch(focusability){case ViewGroup.FOCUS_BEFORE_DESCENDANTS:case ViewGroup.FOCUS_AFTER_DESCENDANTS:case ViewGroup.FOCUS_BLOCK_DESCENDANTS:break;default:throw new Error(\"must be one of FOCUS_BEFORE_DESCENDANTS, \"+\"FOCUS_AFTER_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS\");}this.mGroupFlags&=~ViewGroup.FLAG_MASK_FOCUSABILITY;this.mGroupFlags|=focusability&ViewGroup.FLAG_MASK_FOCUSABILITY;}},{key:'handleFocusGainInternal',value:function handleFocusGainInternal(direction,previouslyFocusedRect){if(this.mFocused!=null){this.mFocused.unFocus();this.mFocused=null;}_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'handleFocusGainInternal',this).call(this,direction,previouslyFocusedRect);}},{key:'requestChildFocus',value:function requestChildFocus(child,focused){if(view_4.View.DBG){System.out.println(this+\" requestChildFocus()\");}if(this.getDescendantFocusability()==ViewGroup.FOCUS_BLOCK_DESCENDANTS){return;}_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'unFocus',this).call(this);if(this.mFocused!=child){if(this.mFocused!=null){this.mFocused.unFocus();}this.mFocused=child;}if(this.mParent!=null){this.mParent.requestChildFocus(this,focused);}}},{key:'focusableViewAvailable',value:function focusableViewAvailable(v){if(this.mParent!=null&&this.getDescendantFocusability()!=ViewGroup.FOCUS_BLOCK_DESCENDANTS&&!(this.isFocused()&&this.getDescendantFocusability()!=ViewGroup.FOCUS_AFTER_DESCENDANTS)){this.mParent.focusableViewAvailable(v);}}},{key:'focusSearch',value:function focusSearch(){for(var _len16=arguments.length,args=Array(_len16),_key17=0;_key17<_len16;_key17++){args[_key17]=arguments[_key17];}if(arguments.length===1){return _get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'focusSearch',this).call(this,args[0]);}var focused=args[0];var direction=args[1];if(this.isRootNamespace()){return view_4.FocusFinder.getInstance().findNextFocus(this,focused,direction);}else if(this.mParent!=null){return this.mParent.focusSearch(focused,direction);}return null;}},{key:'requestChildRectangleOnScreen',value:function requestChildRectangleOnScreen(child,rectangle,immediate){return false;}},{key:'childHasTransientStateChanged',value:function childHasTransientStateChanged(child,childHasTransientState){var oldHasTransientState=this.hasTransientState();if(childHasTransientState){this.mChildCountWithTransientState++;}else{this.mChildCountWithTransientState--;}var newHasTransientState=this.hasTransientState();if(this.mParent!=null&&oldHasTransientState!=newHasTransientState){this.mParent.childHasTransientStateChanged(this,newHasTransientState);}}},{key:'hasTransientState',value:function hasTransientState(){return this.mChildCountWithTransientState>0||_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'hasTransientState',this).call(this);}},{key:'dispatchUnhandledMove',value:function dispatchUnhandledMove(focused,direction){return this.mFocused!=null&&this.mFocused.dispatchUnhandledMove(focused,direction);}},{key:'clearChildFocus',value:function clearChildFocus(child){if(view_4.View.DBG){System.out.println(this+\" clearChildFocus()\");}this.mFocused=null;if(this.mParent!=null){this.mParent.clearChildFocus(this);}}},{key:'clearFocus',value:function clearFocus(){if(view_4.View.DBG){System.out.println(this+\" clearFocus()\");}if(this.mFocused==null){_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'clearFocus',this).call(this);}else{var focused=this.mFocused;this.mFocused=null;focused.clearFocus();}}},{key:'unFocus',value:function unFocus(){if(view_4.View.DBG){System.out.println(this+\" unFocus()\");}if(this.mFocused==null){_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'unFocus',this).call(this);}else{this.mFocused.unFocus();this.mFocused=null;}}},{key:'getFocusedChild',value:function getFocusedChild(){return this.mFocused;}},{key:'hasFocus',value:function hasFocus(){return(this.mPrivateFlags&view_4.View.PFLAG_FOCUSED)!=0||this.mFocused!=null;}},{key:'findFocus',value:function findFocus(){if(ViewGroup.DBG){System.out.println(\"Find focus in \"+this+\": flags=\"+this.isFocused()+\", child=\"+this.mFocused);}if(this.isFocused()){return this;}if(this.mFocused!=null){return this.mFocused.findFocus();}return null;}},{key:'hasFocusable',value:function hasFocusable(){if((this.mViewFlags&view_4.View.VISIBILITY_MASK)!=view_4.View.VISIBLE){return false;}if(this.isFocusable()){return true;}var descendantFocusability=this.getDescendantFocusability();if(descendantFocusability!=ViewGroup.FOCUS_BLOCK_DESCENDANTS){var count=this.mChildrenCount;var children=this.mChildren;for(var i=0;i<count;i++){var child=children[i];if(child.hasFocusable()){return true;}}}return false;}},{key:'addFocusables',value:function addFocusables(views,direction){var focusableMode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:view_4.View.FOCUSABLES_TOUCH_MODE;var focusableCount=views.size();var descendantFocusability=this.getDescendantFocusability();if(descendantFocusability!=ViewGroup.FOCUS_BLOCK_DESCENDANTS){var count=this.mChildrenCount;var children=this.mChildren;for(var i=0;i<count;i++){var child=children[i];if((child.mViewFlags&view_4.View.VISIBILITY_MASK)==view_4.View.VISIBLE){child.addFocusables(views,direction,focusableMode);}}}if(descendantFocusability!=ViewGroup.FOCUS_AFTER_DESCENDANTS||focusableCount==views.size()){_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'addFocusables',this).call(this,views,direction,focusableMode);}}},{key:'requestFocus',value:function requestFocus(){var direction=arguments.length>0&&arguments[0]!==undefined?arguments[0]:view_4.View.FOCUS_DOWN;var previouslyFocusedRect=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;if(view_4.View.DBG){System.out.println(this+\" ViewGroup.requestFocus direction=\"+direction);}var descendantFocusability=this.getDescendantFocusability();switch(descendantFocusability){case ViewGroup.FOCUS_BLOCK_DESCENDANTS:return _get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'requestFocus',this).call(this,direction,previouslyFocusedRect);case ViewGroup.FOCUS_BEFORE_DESCENDANTS:{var took=_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'requestFocus',this).call(this,direction,previouslyFocusedRect);return took?took:this.onRequestFocusInDescendants(direction,previouslyFocusedRect);}case ViewGroup.FOCUS_AFTER_DESCENDANTS:{var _took=this.onRequestFocusInDescendants(direction,previouslyFocusedRect);return _took?_took:_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'requestFocus',this).call(this,direction,previouslyFocusedRect);}default:throw new Error(\"descendant focusability must be \"+\"one of FOCUS_BEFORE_DESCENDANTS, FOCUS_AFTER_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS \"+\"but is \"+descendantFocusability);}}},{key:'onRequestFocusInDescendants',value:function onRequestFocusInDescendants(direction,previouslyFocusedRect){var index=void 0;var increment=void 0;var end=void 0;var count=this.mChildrenCount;if((direction&view_4.View.FOCUS_FORWARD)!=0){index=0;increment=1;end=count;}else{index=count-1;increment=-1;end=-1;}var children=this.mChildren;for(var i=index;i!=end;i+=increment){var child=children[i];if((child.mViewFlags&view_4.View.VISIBILITY_MASK)==view_4.View.VISIBLE){if(child.requestFocus(direction,previouslyFocusedRect)){return true;}}}return false;}},{key:'addView',value:function addView(){var child=arguments.length<=0?undefined:arguments[0];var params=child.getLayoutParams();var index=-1;if(arguments.length==2){if((arguments.length<=1?undefined:arguments[1])instanceof ViewGroup.LayoutParams)params=arguments.length<=1?undefined:arguments[1];else if(typeof(arguments.length<=1?undefined:arguments[1])==='number')index=arguments.length<=1?undefined:arguments[1];}else if(arguments.length==3){if((arguments.length<=2?undefined:arguments[2])instanceof ViewGroup.LayoutParams){index=arguments.length<=1?undefined:arguments[1];params=arguments.length<=2?undefined:arguments[2];}else{params=this.generateDefaultLayoutParams();params.width=arguments.length<=1?undefined:arguments[1];params.height=arguments.length<=2?undefined:arguments[2];}}if(params==null){params=this.generateDefaultLayoutParams();if(params==null){throw new Error(\"generateDefaultLayoutParams() cannot return null\");}}this.requestLayout();this.invalidate(true);this.addViewInner(child,index,params,false);}},{key:'checkLayoutParams',value:function checkLayoutParams(p){return p!=null;}},{key:'setOnHierarchyChangeListener',value:function setOnHierarchyChangeListener(listener){this.mOnHierarchyChangeListener=listener;}},{key:'onViewAdded',value:function onViewAdded(child){if(this.mOnHierarchyChangeListener!=null){this.mOnHierarchyChangeListener.onChildViewAdded(this,child);}}},{key:'onViewRemoved',value:function onViewRemoved(child){if(this.mOnHierarchyChangeListener!=null){this.mOnHierarchyChangeListener.onChildViewRemoved(this,child);}}},{key:'clearCachedLayoutMode',value:function clearCachedLayoutMode(){if(!this.hasBooleanFlag(ViewGroup.FLAG_LAYOUT_MODE_WAS_EXPLICITLY_SET)){this.mLayoutMode=ViewGroup.LAYOUT_MODE_UNDEFINED;}}},{key:'addViewInLayout',value:function addViewInLayout(child,index,params){var preventRequestLayout=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;child.mParent=null;this.addViewInner(child,index,params,preventRequestLayout);child.mPrivateFlags=child.mPrivateFlags&~ViewGroup.PFLAG_DIRTY_MASK|ViewGroup.PFLAG_DRAWN;return true;}},{key:'cleanupLayoutState',value:function cleanupLayoutState(child){child.mPrivateFlags&=~view_4.View.PFLAG_FORCE_LAYOUT;}},{key:'addViewInner',value:function addViewInner(child,index,params,preventRequestLayout){if(child.getParent()!=null){throw new Error(\"The specified child already has a parent. \"+\"You must call removeView() on the child's parent first.\");}if(!this.checkLayoutParams(params)){params=this.generateLayoutParams(params);}if(preventRequestLayout){child.mLayoutParams=params;}else{child.setLayoutParams(params);}if(index<0){index=this.mChildrenCount;}if(this.mDisappearingChildren)this.mDisappearingChildren.remove(child);this.addInArray(child,index);if(preventRequestLayout){child.assignParent(this);}else{child.mParent=this;}if(child.hasFocus()){this.requestChildFocus(child,child.findFocus());}var ai=this.mAttachInfo;if(ai!=null&&(this.mGroupFlags&ViewGroup.FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW)==0){child.dispatchAttachedToWindow(this.mAttachInfo,this.mViewFlags&ViewGroup.VISIBILITY_MASK);}this.onViewAdded(child);if((child.mViewFlags&ViewGroup.DUPLICATE_PARENT_STATE)==ViewGroup.DUPLICATE_PARENT_STATE){this.mGroupFlags|=ViewGroup.FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE;}}},{key:'addInArray',value:function addInArray(child,index){var count=this.mChildrenCount;if(index==count){this.mChildren.push(child);this.addToBindElement(child.bindElement,null);}else if(index<count){var refChild=this.getChildAt(index);this.mChildren.splice(index,0,child);this.addToBindElement(child.bindElement,refChild.bindElement);}else{throw new Error(\"index=\"+index+\" count=\"+count);}}},{key:'addToBindElement',value:function addToBindElement(childElement,insertBeforeElement){if(childElement.parentElement){if(childElement.parentElement==this.bindElement)return;childElement.parentElement.removeChild(childElement);}if(insertBeforeElement){this.bindElement.insertBefore(childElement,insertBeforeElement);}else{this.bindElement.appendChild(childElement);}}},{key:'removeChildElement',value:function removeChildElement(childElement){try{this.bindElement.removeChild(childElement);}catch(e){}}},{key:'removeFromArray',value:function removeFromArray(index){var count=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var start=Math.max(0,index);var end=Math.min(this.mChildrenCount,start+count);if(start==end){return;}for(var i=start;i<end;i++){this.mChildren[i].mParent=null;this.removeChildElement(this.mChildren[i].bindElement);}this.mChildren.splice(index,end-start);}},{key:'removeView',value:function removeView(view){this.removeViewInternal(view);this.requestLayout();this.invalidate(true);}},{key:'removeViewInLayout',value:function removeViewInLayout(view){this.removeViewInternal(view);}},{key:'removeViewsInLayout',value:function removeViewsInLayout(start,count){this.removeViewsInternal(start,count);}},{key:'removeViewAt',value:function removeViewAt(index){this.removeViewsInternal(index,1);this.requestLayout();this.invalidate(true);}},{key:'removeViews',value:function removeViews(start,count){this.removeViewsInternal(start,count);this.requestLayout();this.invalidate(true);}},{key:'removeViewInternal',value:function removeViewInternal(view){var index=this.indexOfChild(view);if(index>=0){this.removeViewsInternal(index,1);}}},{key:'removeViewsInternal',value:function removeViewsInternal(start,count){var focused=this.mFocused;var clearChildFocus=false;var detach=this.mAttachInfo!=null;var children=this.mChildren;var end=start+count;for(var i=start;i<end;i++){var _view9=children[i];if(_view9==focused){_view9.unFocus();clearChildFocus=true;}this.cancelTouchTarget(_view9);if(_view9.getAnimation()!=null){this.addDisappearingView(_view9);}else if(detach){_view9.dispatchDetachedFromWindow();}this.onViewRemoved(_view9);}this.removeFromArray(start,count);if(clearChildFocus){this.clearChildFocus(focused);if(!this.rootViewRequestFocus()){this.notifyGlobalFocusCleared(focused);}}}},{key:'removeAllViews',value:function removeAllViews(){this.removeAllViewsInLayout();this.requestLayout();this.invalidate(true);}},{key:'removeAllViewsInLayout',value:function removeAllViewsInLayout(){var count=this.mChildrenCount;if(count<=0){return;}this.removeViewsInternal(0,count);}},{key:'detachViewFromParent',value:function detachViewFromParent(child){if(child instanceof view_4.View)child=this.indexOfChild(child);this.removeFromArray(child);}},{key:'removeDetachedView',value:function removeDetachedView(child,animate){if(child==this.mFocused){child.clearFocus();}this.cancelTouchTarget(child);if(animate&&child.getAnimation()!=null){this.addDisappearingView(child);}else if(child.mAttachInfo!=null){child.dispatchDetachedFromWindow();}if(child.hasTransientState()){this.childHasTransientStateChanged(child,false);}this.onViewRemoved(child);}},{key:'attachViewToParent',value:function attachViewToParent(child,index,params){child.mLayoutParams=params;if(index<0){index=this.mChildrenCount;}this.addInArray(child,index);child.mParent=this;child.mPrivateFlags=child.mPrivateFlags&~ViewGroup.PFLAG_DIRTY_MASK&~ViewGroup.PFLAG_DRAWING_CACHE_VALID|ViewGroup.PFLAG_DRAWN|ViewGroup.PFLAG_INVALIDATED;this.mPrivateFlags|=ViewGroup.PFLAG_INVALIDATED;if(child.hasFocus()){this.requestChildFocus(child,child.findFocus());}}},{key:'detachViewsFromParent',value:function detachViewsFromParent(start){var count=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;this.removeFromArray(start,count);}},{key:'detachAllViewsFromParent',value:function detachAllViewsFromParent(){var count=this.mChildrenCount;if(count<=0){return;}var children=this.mChildren;this.mChildren=[];for(var i=count-1;i>=0;i--){children[i].mParent=null;this.removeChildElement(children[i].bindElement);}}},{key:'indexOfChild',value:function indexOfChild(child){return this.mChildren.indexOf(child);}},{key:'getChildCount',value:function getChildCount(){return this.mChildrenCount;}},{key:'getChildAt',value:function getChildAt(index){if(index<0||index>=this.mChildrenCount){return null;}return this.mChildren[index];}},{key:'bringChildToFront',value:function bringChildToFront(child){var index=this.indexOfChild(child);if(index>=0){this.removeFromArray(index);this.addInArray(child,this.mChildrenCount);child.mParent=this;this.requestLayout();this.invalidate();}}},{key:'hasBooleanFlag',value:function hasBooleanFlag(flag){return(this.mGroupFlags&flag)==flag;}},{key:'setBooleanFlag',value:function setBooleanFlag(flag,value){if(value){this.mGroupFlags|=flag;}else{this.mGroupFlags&=~flag;}}},{key:'dispatchGenericPointerEvent',value:function dispatchGenericPointerEvent(event){var childrenCount=this.mChildrenCount;if(childrenCount!=0){var children=this.mChildren;var _x99=event.getX();var _y2=event.getY();var customOrder=this.isChildrenDrawingOrderEnabled();for(var i=childrenCount-1;i>=0;i--){var childIndex=customOrder?this.getChildDrawingOrder(childrenCount,i):i;var child=children[childIndex];if(!ViewGroup.canViewReceivePointerEvents(child)||!this.isTransformedTouchPointInView(_x99,_y2,child,null)){continue;}if(this.dispatchTransformedGenericPointerEvent(event,child)){return true;}}}return _get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'dispatchGenericPointerEvent',this).call(this,event);}},{key:'dispatchTransformedGenericPointerEvent',value:function dispatchTransformedGenericPointerEvent(event,child){var offsetX=this.mScrollX-child.mLeft;var offsetY=this.mScrollY-child.mTop;var handled=void 0;if(!child.hasIdentityMatrix()){}else{event.offsetLocation(offsetX,offsetY);handled=child.dispatchGenericMotionEvent(event);event.offsetLocation(-offsetX,-offsetY);}return handled;}},{key:'dispatchKeyEvent',value:function dispatchKeyEvent(event){if((this.mPrivateFlags&(view_4.View.PFLAG_FOCUSED|view_4.View.PFLAG_HAS_BOUNDS))==(view_4.View.PFLAG_FOCUSED|view_4.View.PFLAG_HAS_BOUNDS)){if(_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'dispatchKeyEvent',this).call(this,event)){return true;}}else if(this.mFocused!=null&&(this.mFocused.mPrivateFlags&view_4.View.PFLAG_HAS_BOUNDS)==view_4.View.PFLAG_HAS_BOUNDS){if(this.mFocused.dispatchKeyEvent(event)){return true;}}return false;}},{key:'dispatchWindowFocusChanged',value:function dispatchWindowFocusChanged(hasFocus){_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'dispatchWindowFocusChanged',this).call(this,hasFocus);var count=this.mChildrenCount;var children=this.mChildren;for(var i=0;i<count;i++){children[i].dispatchWindowFocusChanged(hasFocus);}}},{key:'addTouchables',value:function addTouchables(views){_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'addTouchables',this).call(this,views);var count=this.mChildrenCount;var children=this.mChildren;for(var i=0;i<count;i++){var child=children[i];if((child.mViewFlags&view_4.View.VISIBILITY_MASK)==view_4.View.VISIBLE){child.addTouchables(views);}}}},{key:'onInterceptTouchEvent',value:function onInterceptTouchEvent(ev){return false;}},{key:'dispatchTouchEvent',value:function dispatchTouchEvent(ev){var handled=false;if(this.onFilterTouchEventForSecurity(ev)){var action=ev.getAction();var actionMasked=action&view_4.MotionEvent.ACTION_MASK;if(actionMasked==view_4.MotionEvent.ACTION_DOWN){this.cancelAndClearTouchTargets(ev);this.resetTouchState();}var intercepted=void 0;if(actionMasked==view_4.MotionEvent.ACTION_DOWN||this.mFirstTouchTarget!=null){var disallowIntercept=(this.mGroupFlags&ViewGroup.FLAG_DISALLOW_INTERCEPT)!=0;if(!disallowIntercept){intercepted=this.onInterceptTouchEvent(ev);ev.setAction(action);}else{intercepted=false;}}else{intercepted=true;}var canceled=ViewGroup.resetCancelNextUpFlag(this)||actionMasked==view_4.MotionEvent.ACTION_CANCEL;var split=(this.mGroupFlags&ViewGroup.FLAG_SPLIT_MOTION_EVENTS)!=0;var newTouchTarget=null;var alreadyDispatchedToNewTouchTarget=false;if(!canceled&&!intercepted){if(actionMasked==view_4.MotionEvent.ACTION_DOWN||split&&actionMasked==view_4.MotionEvent.ACTION_POINTER_DOWN||actionMasked==view_4.MotionEvent.ACTION_HOVER_MOVE){var actionIndex=ev.getActionIndex();var idBitsToAssign=split?1<<ev.getPointerId(actionIndex):TouchTarget.ALL_POINTER_IDS;this.removePointersFromTouchTargets(idBitsToAssign);var childrenCount=this.mChildrenCount;if(newTouchTarget==null&&childrenCount!=0){var _x100=ev.getX(actionIndex);var _y3=ev.getY(actionIndex);var children=this.mChildren;var customOrder=this.isChildrenDrawingOrderEnabled();for(var i=childrenCount-1;i>=0;i--){var childIndex=customOrder?this.getChildDrawingOrder(childrenCount,i):i;var child=children[childIndex];if(!ViewGroup.canViewReceivePointerEvents(child)||!this.isTransformedTouchPointInView(_x100,_y3,child,null)){continue;}newTouchTarget=this.getTouchTarget(child);if(newTouchTarget!=null){newTouchTarget.pointerIdBits|=idBitsToAssign;break;}ViewGroup.resetCancelNextUpFlag(child);if(this.dispatchTransformedTouchEvent(ev,false,child,idBitsToAssign)){this.mLastTouchDownTime=ev.getDownTime();this.mLastTouchDownIndex=childIndex;this.mLastTouchDownX=ev.getX();this.mLastTouchDownY=ev.getY();newTouchTarget=this.addTouchTarget(child,idBitsToAssign);alreadyDispatchedToNewTouchTarget=true;break;}}}if(newTouchTarget==null&&this.mFirstTouchTarget!=null){newTouchTarget=this.mFirstTouchTarget;while(newTouchTarget.next!=null){newTouchTarget=newTouchTarget.next;}newTouchTarget.pointerIdBits|=idBitsToAssign;}}}if(this.mFirstTouchTarget==null){handled=this.dispatchTransformedTouchEvent(ev,canceled,null,TouchTarget.ALL_POINTER_IDS);}else{var predecessor=null;var target=this.mFirstTouchTarget;while(target!=null){var next=target.next;if(alreadyDispatchedToNewTouchTarget&&target==newTouchTarget){handled=true;}else{var cancelChild=ViewGroup.resetCancelNextUpFlag(target.child)||intercepted;if(this.dispatchTransformedTouchEvent(ev,cancelChild,target.child,target.pointerIdBits)){handled=true;}if(cancelChild){if(predecessor==null){this.mFirstTouchTarget=next;}else{predecessor.next=next;}target.recycle();target=next;continue;}}predecessor=target;target=next;}}if(canceled||actionMasked==view_4.MotionEvent.ACTION_UP||actionMasked==view_4.MotionEvent.ACTION_HOVER_MOVE){this.resetTouchState();}else if(split&&actionMasked==view_4.MotionEvent.ACTION_POINTER_UP){var _actionIndex=ev.getActionIndex();var idBitsToRemove=1<<ev.getPointerId(_actionIndex);this.removePointersFromTouchTargets(idBitsToRemove);}}return handled;}},{key:'resetTouchState',value:function resetTouchState(){this.clearTouchTargets();ViewGroup.resetCancelNextUpFlag(this);this.mGroupFlags&=~ViewGroup.FLAG_DISALLOW_INTERCEPT;}},{key:'clearTouchTargets',value:function clearTouchTargets(){var target=this.mFirstTouchTarget;if(target!=null){do{var next=target.next;target.recycle();target=next;}while(target!=null);this.mFirstTouchTarget=null;}}},{key:'cancelAndClearTouchTargets',value:function cancelAndClearTouchTargets(event){if(this.mFirstTouchTarget!=null){var syntheticEvent=false;if(event==null){var now=SystemClock.uptimeMillis();event=view_4.MotionEvent.obtainWithAction(now,now,view_4.MotionEvent.ACTION_CANCEL,0,0);syntheticEvent=true;}for(var target=this.mFirstTouchTarget;target!=null;target=target.next){ViewGroup.resetCancelNextUpFlag(target.child);this.dispatchTransformedTouchEvent(event,true,target.child,target.pointerIdBits);}this.clearTouchTargets();if(syntheticEvent){event.recycle();}}}},{key:'getTouchTarget',value:function getTouchTarget(child){for(var target=this.mFirstTouchTarget;target!=null;target=target.next){if(target.child==child){return target;}}return null;}},{key:'addTouchTarget',value:function addTouchTarget(child,pointerIdBits){var target=TouchTarget.obtain(child,pointerIdBits);target.next=this.mFirstTouchTarget;this.mFirstTouchTarget=target;return target;}},{key:'removePointersFromTouchTargets',value:function removePointersFromTouchTargets(pointerIdBits){var predecessor=null;var target=this.mFirstTouchTarget;while(target!=null){var next=target.next;if((target.pointerIdBits&pointerIdBits)!=0){target.pointerIdBits&=~pointerIdBits;if(target.pointerIdBits==0){if(predecessor==null){this.mFirstTouchTarget=next;}else{predecessor.next=next;}target.recycle();target=next;continue;}}predecessor=target;target=next;}}},{key:'cancelTouchTarget',value:function cancelTouchTarget(view){var predecessor=null;var target=this.mFirstTouchTarget;while(target!=null){var next=target.next;if(target.child==view){if(predecessor==null){this.mFirstTouchTarget=next;}else{predecessor.next=next;}target.recycle();var now=SystemClock.uptimeMillis();var event=view_4.MotionEvent.obtainWithAction(now,now,view_4.MotionEvent.ACTION_CANCEL,0,0);view.dispatchTouchEvent(event);event.recycle();return;}predecessor=target;target=next;}}},{key:'isTransformedTouchPointInView',value:function isTransformedTouchPointInView(x,y,child,outLocalPoint){var localX=x+this.mScrollX-child.mLeft;var localY=y+this.mScrollY-child.mTop;var isInView=child.pointInView(localX,localY);if(isInView&&outLocalPoint!=null){outLocalPoint.set(localX,localY);}return isInView;}},{key:'dispatchTransformedTouchEvent',value:function dispatchTransformedTouchEvent(event,cancel,child,desiredPointerIdBits){var handled=void 0;var oldAction=event.getAction();if(cancel||oldAction==view_4.MotionEvent.ACTION_CANCEL){event.setAction(view_4.MotionEvent.ACTION_CANCEL);if(child==null){handled=_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'dispatchTouchEvent',this).call(this,event);}else{handled=child.dispatchTouchEvent(event);}event.setAction(oldAction);return handled;}var oldPointerIdBits=event.getPointerIdBits();var newPointerIdBits=oldPointerIdBits&desiredPointerIdBits;if(newPointerIdBits==0){return false;}var transformedEvent=void 0;if(newPointerIdBits==oldPointerIdBits){if(child==null||child.hasIdentityMatrix()){if(child==null){handled=_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'dispatchTouchEvent',this).call(this,event);}else{var offsetX=this.mScrollX-child.mLeft;var offsetY=this.mScrollY-child.mTop;event.offsetLocation(offsetX,offsetY);handled=child.dispatchTouchEvent(event);event.offsetLocation(-offsetX,-offsetY);}return handled;}transformedEvent=view_4.MotionEvent.obtain(event);}else{transformedEvent=event.split(newPointerIdBits);}if(child==null){handled=_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'dispatchTouchEvent',this).call(this,transformedEvent);}else{var _offsetX=this.mScrollX-child.mLeft;var _offsetY=this.mScrollY-child.mTop;transformedEvent.offsetLocation(_offsetX,_offsetY);handled=child.dispatchTouchEvent(transformedEvent);}transformedEvent.recycle();return handled;}},{key:'setMotionEventSplittingEnabled',value:function setMotionEventSplittingEnabled(split){if(split){this.mGroupFlags|=ViewGroup.FLAG_SPLIT_MOTION_EVENTS;}else{this.mGroupFlags&=~ViewGroup.FLAG_SPLIT_MOTION_EVENTS;}}},{key:'isMotionEventSplittingEnabled',value:function isMotionEventSplittingEnabled(){return(this.mGroupFlags&ViewGroup.FLAG_SPLIT_MOTION_EVENTS)==ViewGroup.FLAG_SPLIT_MOTION_EVENTS;}},{key:'isAnimationCacheEnabled',value:function isAnimationCacheEnabled(){return(this.mGroupFlags&ViewGroup.FLAG_ANIMATION_CACHE)==ViewGroup.FLAG_ANIMATION_CACHE;}},{key:'setAnimationCacheEnabled',value:function setAnimationCacheEnabled(enabled){this.setBooleanFlag(ViewGroup.FLAG_ANIMATION_CACHE,enabled);}},{key:'isAlwaysDrawnWithCacheEnabled',value:function isAlwaysDrawnWithCacheEnabled(){return(this.mGroupFlags&ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE)==ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE;}},{key:'setAlwaysDrawnWithCacheEnabled',value:function setAlwaysDrawnWithCacheEnabled(always){this.setBooleanFlag(ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE,always);}},{key:'isChildrenDrawnWithCacheEnabled',value:function isChildrenDrawnWithCacheEnabled(){return(this.mGroupFlags&ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE)==ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE;}},{key:'setChildrenDrawnWithCacheEnabled',value:function setChildrenDrawnWithCacheEnabled(enabled){this.setBooleanFlag(ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE,enabled);}},{key:'setChildrenDrawingCacheEnabled',value:function setChildrenDrawingCacheEnabled(enabled){if(enabled||(this.mPersistentDrawingCache&ViewGroup.PERSISTENT_ALL_CACHES)!=ViewGroup.PERSISTENT_ALL_CACHES){var children=this.mChildren;var count=this.mChildrenCount;for(var i=0;i<count;i++){children[i].setDrawingCacheEnabled(enabled);}}}},{key:'onAnimationStart',value:function onAnimationStart(){_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'onAnimationStart',this).call(this);if((this.mGroupFlags&ViewGroup.FLAG_ANIMATION_CACHE)==ViewGroup.FLAG_ANIMATION_CACHE){var count=this.mChildrenCount;var children=this.mChildren;var buildCache=!this.isHardwareAccelerated();for(var i=0;i<count;i++){var child=children[i];if((child.mViewFlags&ViewGroup.VISIBILITY_MASK)==ViewGroup.VISIBLE){child.setDrawingCacheEnabled(true);if(buildCache){child.buildDrawingCache(true);}}}this.mGroupFlags|=ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE;}}},{key:'onAnimationEnd',value:function onAnimationEnd(){_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'onAnimationEnd',this).call(this);if((this.mGroupFlags&ViewGroup.FLAG_ANIMATION_CACHE)==ViewGroup.FLAG_ANIMATION_CACHE){this.mGroupFlags&=~ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE;if((this.mPersistentDrawingCache&ViewGroup.PERSISTENT_ANIMATION_CACHE)==0){this.setChildrenDrawingCacheEnabled(false);}}}},{key:'getPersistentDrawingCache',value:function getPersistentDrawingCache(){return this.mPersistentDrawingCache;}},{key:'setPersistentDrawingCache',value:function setPersistentDrawingCache(drawingCacheToKeep){this.mPersistentDrawingCache=drawingCacheToKeep&ViewGroup.PERSISTENT_ALL_CACHES;}},{key:'isChildrenDrawingOrderEnabled',value:function isChildrenDrawingOrderEnabled(){return(this.mGroupFlags&ViewGroup.FLAG_USE_CHILD_DRAWING_ORDER)==ViewGroup.FLAG_USE_CHILD_DRAWING_ORDER;}},{key:'setChildrenDrawingOrderEnabled',value:function setChildrenDrawingOrderEnabled(enabled){this.setBooleanFlag(ViewGroup.FLAG_USE_CHILD_DRAWING_ORDER,enabled);}},{key:'getChildDrawingOrder',value:function getChildDrawingOrder(childCount,i){return i;}},{key:'generateLayoutParamsFromAttr',value:function generateLayoutParamsFromAttr(attrs){return new ViewGroup.LayoutParams(this.getContext(),attrs);}},{key:'generateLayoutParams',value:function generateLayoutParams(p){return p;}},{key:'generateDefaultLayoutParams',value:function generateDefaultLayoutParams(){return new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);}},{key:'measureChildren',value:function measureChildren(widthMeasureSpec,heightMeasureSpec){var size=this.mChildren.length;for(var i=0;i<size;++i){var child=this.mChildren[i];if((child.mViewFlags&view_4.View.VISIBILITY_MASK)!=view_4.View.GONE){this.measureChild(child,widthMeasureSpec,heightMeasureSpec);}}}},{key:'measureChild',value:function measureChild(child,parentWidthMeasureSpec,parentHeightMeasureSpec){var lp=child.getLayoutParams();var childWidthMeasureSpec=ViewGroup.getChildMeasureSpec(parentWidthMeasureSpec,this.mPaddingLeft+this.mPaddingRight,lp.width);var childHeightMeasureSpec=ViewGroup.getChildMeasureSpec(parentHeightMeasureSpec,this.mPaddingTop+this.mPaddingBottom,lp.height);child.measure(childWidthMeasureSpec,childHeightMeasureSpec);}},{key:'measureChildWithMargins',value:function measureChildWithMargins(child,parentWidthMeasureSpec,widthUsed,parentHeightMeasureSpec,heightUsed){var lp=child.getLayoutParams();if(lp instanceof ViewGroup.MarginLayoutParams){var childWidthMeasureSpec=ViewGroup.getChildMeasureSpec(parentWidthMeasureSpec,this.mPaddingLeft+this.mPaddingRight+lp.leftMargin+lp.rightMargin+widthUsed,lp.width);var childHeightMeasureSpec=ViewGroup.getChildMeasureSpec(parentHeightMeasureSpec,this.mPaddingTop+this.mPaddingBottom+lp.topMargin+lp.bottomMargin+heightUsed,lp.height);child.measure(childWidthMeasureSpec,childHeightMeasureSpec);}}},{key:'clearDisappearingChildren',value:function clearDisappearingChildren(){if(this.mDisappearingChildren!=null){this.mDisappearingChildren.clear();this.invalidate();}}},{key:'addDisappearingView',value:function addDisappearingView(v){var disappearingChildren=this.mDisappearingChildren;if(disappearingChildren==null){disappearingChildren=this.mDisappearingChildren=new ArrayList();}disappearingChildren.add(v);}},{key:'finishAnimatingView',value:function finishAnimatingView(view,animation){var disappearingChildren=this.mDisappearingChildren;if(disappearingChildren!=null){if(disappearingChildren.contains(view)){disappearingChildren.remove(view);if(view.mAttachInfo!=null){view.dispatchDetachedFromWindow();}view.clearAnimation();this.mGroupFlags|=ViewGroup.FLAG_INVALIDATE_REQUIRED;}}if(animation!=null&&!animation.getFillAfter()){view.clearAnimation();}if((view.mPrivateFlags&ViewGroup.PFLAG_ANIMATION_STARTED)==ViewGroup.PFLAG_ANIMATION_STARTED){view.onAnimationEnd();view.mPrivateFlags&=~ViewGroup.PFLAG_ANIMATION_STARTED;this.mGroupFlags|=ViewGroup.FLAG_INVALIDATE_REQUIRED;}}},{key:'dispatchAttachedToWindow',value:function dispatchAttachedToWindow(info,visibility){this.mGroupFlags|=ViewGroup.FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW;_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'dispatchAttachedToWindow',this).call(this,info,visibility);this.mGroupFlags&=~ViewGroup.FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW;var count=this.mChildrenCount;var children=this.mChildren;for(var i=0;i<count;i++){var child=children[i];child.dispatchAttachedToWindow(info,visibility|child.mViewFlags&view_4.View.VISIBILITY_MASK);}}},{key:'onAttachedToWindow',value:function onAttachedToWindow(){_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'onAttachedToWindow',this).call(this);this.clearCachedLayoutMode();}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'onDetachedFromWindow',this).call(this);this.clearCachedLayoutMode();}},{key:'dispatchDetachedFromWindow',value:function dispatchDetachedFromWindow(){this.cancelAndClearTouchTargets(null);this.mLayoutCalledWhileSuppressed=false;this.mChildren.forEach(function(child){return child.dispatchDetachedFromWindow();});_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'dispatchDetachedFromWindow',this).call(this);}},{key:'dispatchDisplayHint',value:function dispatchDisplayHint(hint){_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'dispatchDisplayHint',this).call(this,hint);var count=this.mChildrenCount;var children=this.mChildren;for(var i=0;i<count;i++){children[i].dispatchDisplayHint(hint);}}},{key:'onChildVisibilityChanged',value:function onChildVisibilityChanged(child,oldVisibility,newVisibility){}},{key:'dispatchVisibilityChanged',value:function dispatchVisibilityChanged(changedView,visibility){_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'dispatchVisibilityChanged',this).call(this,changedView,visibility);var count=this.mChildrenCount;var children=this.mChildren;for(var i=0;i<count;i++){children[i].dispatchVisibilityChanged(changedView,visibility);}}},{key:'dispatchSetSelected',value:function dispatchSetSelected(selected){var children=this.mChildren;var count=this.mChildrenCount;for(var i=0;i<count;i++){children[i].setSelected(selected);}}},{key:'dispatchSetActivated',value:function dispatchSetActivated(activated){var children=this.mChildren;var count=this.mChildrenCount;for(var i=0;i<count;i++){children[i].setActivated(activated);}}},{key:'dispatchSetPressed',value:function dispatchSetPressed(pressed){var children=this.mChildren;var count=this.mChildrenCount;for(var i=0;i<count;i++){var child=children[i];if(!pressed||!child.isClickable()&&!child.isLongClickable()){child.setPressed(pressed);}}}},{key:'dispatchCancelPendingInputEvents',value:function dispatchCancelPendingInputEvents(){_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'dispatchCancelPendingInputEvents',this).call(this);var children=this.mChildren;var count=this.mChildrenCount;for(var i=0;i<count;i++){children[i].dispatchCancelPendingInputEvents();}}},{key:'offsetDescendantRectToMyCoords',value:function offsetDescendantRectToMyCoords(descendant,rect){this.offsetRectBetweenParentAndChild(descendant,rect,true,false);}},{key:'offsetRectIntoDescendantCoords',value:function offsetRectIntoDescendantCoords(descendant,rect){this.offsetRectBetweenParentAndChild(descendant,rect,false,false);}},{key:'offsetRectBetweenParentAndChild',value:function offsetRectBetweenParentAndChild(descendant,rect,offsetFromChildToParent,clipToBounds){if(descendant==this){return;}var theParent=descendant.mParent;while(theParent!=null&&theParent instanceof view_4.View&&theParent!=this){if(offsetFromChildToParent){rect.offset(descendant.mLeft-descendant.mScrollX,descendant.mTop-descendant.mScrollY);if(clipToBounds){var p=theParent;rect.intersect(0,0,p.mRight-p.mLeft,p.mBottom-p.mTop);}}else{if(clipToBounds){var _p2=theParent;rect.intersect(0,0,_p2.mRight-_p2.mLeft,_p2.mBottom-_p2.mTop);}rect.offset(descendant.mScrollX-descendant.mLeft,descendant.mScrollY-descendant.mTop);}descendant=theParent;theParent=descendant.mParent;}if(theParent==this){if(offsetFromChildToParent){rect.offset(descendant.mLeft-descendant.mScrollX,descendant.mTop-descendant.mScrollY);}else{rect.offset(descendant.mScrollX-descendant.mLeft,descendant.mScrollY-descendant.mTop);}}else{throw new Error(\"parameter must be a descendant of this view\");}}},{key:'offsetChildrenTopAndBottom',value:function offsetChildrenTopAndBottom(offset){var count=this.mChildrenCount;var children=this.mChildren;for(var i=0;i<count;i++){var v=children[i];v.mTop+=offset;v.mBottom+=offset;}this.invalidateViewProperty(false,false);}},{key:'suppressLayout',value:function suppressLayout(suppress){this.mSuppressLayout=suppress;if(!suppress){if(this.mLayoutCalledWhileSuppressed){this.requestLayout();this.mLayoutCalledWhileSuppressed=false;}}}},{key:'isLayoutSuppressed',value:function isLayoutSuppressed(){return this.mSuppressLayout;}},{key:'layout',value:function layout(l,t,r,b){if(!this.mSuppressLayout){_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'layout',this).call(this,l,t,r,b);}else{this.mLayoutCalledWhileSuppressed=true;}}},{key:'canAnimate',value:function canAnimate(){return false;}},{key:'getChildVisibleRect',value:function getChildVisibleRect(child,r,offset){var rect=this.mAttachInfo!=null?this.mAttachInfo.mTmpTransformRect:new Rect();rect.set(r);if(!child.hasIdentityMatrix()){child.getMatrix().mapRect(rect);}var dx=child.mLeft-this.mScrollX;var dy=child.mTop-this.mScrollY;rect.offset(dx,dy);if(offset!=null){if(!child.hasIdentityMatrix()){var position=this.mAttachInfo!=null?this.mAttachInfo.mTmpTransformLocation:androidui.util.ArrayCreator.newNumberArray(2);position[0]=offset.x;position[1]=offset.y;child.getMatrix().mapPoints(position);offset.x=Math.floor(position[0]+0.5);offset.y=Math.floor(position[1]+0.5);}offset.x+=dx;offset.y+=dy;}if(rect.intersect(0,0,this.mRight-this.mLeft,this.mBottom-this.mTop)){if(this.mParent==null)return true;r.set(rect);return this.mParent.getChildVisibleRect(this,r,offset);}return false;}},{key:'dispatchDraw',value:function dispatchDraw(canvas){var count=this.mChildrenCount;var children=this.mChildren;var flags=this.mGroupFlags;var saveCount=0;var clipToPadding=(flags&ViewGroup.CLIP_TO_PADDING_MASK)==ViewGroup.CLIP_TO_PADDING_MASK;if(clipToPadding){saveCount=canvas.save();canvas.clipRect(this.mScrollX+this.mPaddingLeft,this.mScrollY+this.mPaddingTop,this.mScrollX+this.mRight-this.mLeft-this.mPaddingRight,this.mScrollY+this.mBottom-this.mTop-this.mPaddingBottom);}this.mPrivateFlags&=~ViewGroup.PFLAG_DRAW_ANIMATION;this.mGroupFlags&=~ViewGroup.FLAG_INVALIDATE_REQUIRED;var more=false;var drawingTime=this.getDrawingTime();if((flags&ViewGroup.FLAG_USE_CHILD_DRAWING_ORDER)==0){for(var i=0;i<count;i++){var child=children[i];if((child.mViewFlags&ViewGroup.VISIBILITY_MASK)==ViewGroup.VISIBLE||child.getAnimation()!=null){more=this.drawChild(canvas,child,drawingTime)||more;}}}else{for(var _i11=0;_i11<count;_i11++){var _child=children[this.getChildDrawingOrder(count,_i11)];if((_child.mViewFlags&ViewGroup.VISIBILITY_MASK)==ViewGroup.VISIBLE||_child.getAnimation()!=null){more=this.drawChild(canvas,_child,drawingTime)||more;}}}if(this.mDisappearingChildren!=null){var disappearingChildren=this.mDisappearingChildren;var disappearingCount=disappearingChildren.size()-1;for(var _i12=disappearingCount;_i12>=0;_i12--){var _child2=disappearingChildren.get(_i12);more=this.drawChild(canvas,_child2,drawingTime)||more;}}if(clipToPadding){canvas.restoreToCount(saveCount);}flags=this.mGroupFlags;if((flags&ViewGroup.FLAG_INVALIDATE_REQUIRED)==ViewGroup.FLAG_INVALIDATE_REQUIRED){this.invalidate(true);}}},{key:'drawChild',value:function drawChild(canvas,child,drawingTime){return child.drawFromParent(canvas,this,drawingTime);}},{key:'drawableStateChanged',value:function drawableStateChanged(){_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'drawableStateChanged',this).call(this);if((this.mGroupFlags&ViewGroup.FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE)!=0){if((this.mGroupFlags&ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN)!=0){throw new Error(\"addStateFromChildren cannot be enabled if a\"+\" child has duplicateParentState set to true\");}var children=this.mChildren;var count=this.mChildrenCount;for(var i=0;i<count;i++){var child=children[i];if((child.mViewFlags&view_4.View.DUPLICATE_PARENT_STATE)!=0){child.refreshDrawableState();}}}}},{key:'jumpDrawablesToCurrentState',value:function jumpDrawablesToCurrentState(){_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'jumpDrawablesToCurrentState',this).call(this);var children=this.mChildren;var count=this.mChildrenCount;for(var i=0;i<count;i++){children[i].jumpDrawablesToCurrentState();}}},{key:'onCreateDrawableState',value:function onCreateDrawableState(extraSpace){if((this.mGroupFlags&ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN)==0){return _get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'onCreateDrawableState',this).call(this,extraSpace);}var need=0;var n=this.getChildCount();for(var i=0;i<n;i++){var childState=this.getChildAt(i).getDrawableState();if(childState!=null){need+=childState.length;}}var state=_get2(ViewGroup.prototype.__proto__||Object.getPrototypeOf(ViewGroup.prototype),'onCreateDrawableState',this).call(this,extraSpace+need);for(var _i13=0;_i13<n;_i13++){var _childState=this.getChildAt(_i13).getDrawableState();if(_childState!=null){state=view_4.View.mergeDrawableStates(state,_childState);}}return state;}},{key:'setAddStatesFromChildren',value:function setAddStatesFromChildren(addsStates){if(addsStates){this.mGroupFlags|=ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN;}else{this.mGroupFlags&=~ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN;}this.refreshDrawableState();}},{key:'addStatesFromChildren',value:function addStatesFromChildren(){return(this.mGroupFlags&ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN)!=0;}},{key:'childDrawableStateChanged',value:function childDrawableStateChanged(child){if((this.mGroupFlags&ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN)!=0){this.refreshDrawableState();}}},{key:'getClipChildren',value:function getClipChildren(){return(this.mGroupFlags&ViewGroup.FLAG_CLIP_CHILDREN)!=0;}},{key:'setClipChildren',value:function setClipChildren(clipChildren){var previousValue=(this.mGroupFlags&ViewGroup.FLAG_CLIP_CHILDREN)==ViewGroup.FLAG_CLIP_CHILDREN;if(clipChildren!=previousValue){this.setBooleanFlag(ViewGroup.FLAG_CLIP_CHILDREN,clipChildren);}}},{key:'setClipToPadding',value:function setClipToPadding(clipToPadding){this.setBooleanFlag(ViewGroup.FLAG_CLIP_TO_PADDING,clipToPadding);}},{key:'isClipToPadding',value:function isClipToPadding(){return(this.mGroupFlags&ViewGroup.FLAG_CLIP_TO_PADDING)==ViewGroup.FLAG_CLIP_TO_PADDING;}},{key:'invalidateChild',value:function invalidateChild(child,dirty){var parent=this;var attachInfo=this.mAttachInfo;if(attachInfo!=null){var drawAnimation=(child.mPrivateFlags&view_4.View.PFLAG_DRAW_ANIMATION)==view_4.View.PFLAG_DRAW_ANIMATION;var childMatrix=child.getMatrix();var isOpaque=child.isOpaque()&&!drawAnimation&&child.getAnimation()==null&&childMatrix.isIdentity();var opaqueFlag=isOpaque?view_4.View.PFLAG_DIRTY_OPAQUE:view_4.View.PFLAG_DIRTY;if(child.mLayerType!=view_4.View.LAYER_TYPE_NONE){this.mPrivateFlags|=view_4.View.PFLAG_INVALIDATED;this.mPrivateFlags&=~view_4.View.PFLAG_DRAWING_CACHE_VALID;child.mLocalDirtyRect.union(dirty);}var _location=attachInfo.mInvalidateChildLocation;_location[0]=child.mLeft;_location[1]=child.mTop;if(!childMatrix.isIdentity()||(this.mGroupFlags&ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS)!=0){var boundingRect=attachInfo.mTmpTransformRect;boundingRect.set(dirty);var transformMatrix=void 0;if((this.mGroupFlags&ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS)!=0){var t=attachInfo.mTmpTransformation;var transformed=this.getChildStaticTransformation(child,t);if(transformed){transformMatrix=attachInfo.mTmpMatrix;transformMatrix.set(t.getMatrix());if(!childMatrix.isIdentity()){transformMatrix.preConcat(childMatrix);}}else{transformMatrix=childMatrix;}}else{transformMatrix=childMatrix;}transformMatrix.mapRect(boundingRect);dirty.set(boundingRect);}do{var _view10=null;if(parent instanceof view_4.View){_view10=parent;}if(drawAnimation){if(_view10!=null){_view10.mPrivateFlags|=ViewGroup.PFLAG_DRAW_ANIMATION;}else if(parent instanceof view_4.ViewRootImpl){parent.mIsAnimating=true;}}if(_view10!=null){opaqueFlag=view_4.View.PFLAG_DIRTY;if((_view10.mPrivateFlags&view_4.View.PFLAG_DIRTY_MASK)!=view_4.View.PFLAG_DIRTY){_view10.mPrivateFlags=_view10.mPrivateFlags&~view_4.View.PFLAG_DIRTY_MASK|opaqueFlag;}}parent=parent.invalidateChildInParent(_location,dirty);if(_view10!=null){var m=_view10.getMatrix();if(!m.isIdentity()){var _boundingRect=attachInfo.mTmpTransformRect;_boundingRect.set(dirty);m.mapRect(_boundingRect);dirty.set(_boundingRect);}}}while(parent!=null);}}},{key:'invalidateChildInParent',value:function invalidateChildInParent(location,dirty){if((this.mPrivateFlags&view_4.View.PFLAG_DRAWN)==view_4.View.PFLAG_DRAWN||(this.mPrivateFlags&view_4.View.PFLAG_DRAWING_CACHE_VALID)==view_4.View.PFLAG_DRAWING_CACHE_VALID){if((this.mGroupFlags&(ViewGroup.FLAG_OPTIMIZE_INVALIDATE|ViewGroup.FLAG_ANIMATION_DONE))!=ViewGroup.FLAG_OPTIMIZE_INVALIDATE){dirty.offset(location[0]-this.mScrollX,location[1]-this.mScrollY);if((this.mGroupFlags&ViewGroup.FLAG_CLIP_CHILDREN)==0){dirty.union(0,0,this.mRight-this.mLeft,this.mBottom-this.mTop);}var left=this.mLeft;var top=this.mTop;if((this.mGroupFlags&ViewGroup.FLAG_CLIP_CHILDREN)==ViewGroup.FLAG_CLIP_CHILDREN){if(!dirty.intersect(0,0,this.mRight-left,this.mBottom-top)){dirty.setEmpty();}}this.mPrivateFlags&=~view_4.View.PFLAG_DRAWING_CACHE_VALID;location[0]=left;location[1]=top;if(this.mLayerType!=view_4.View.LAYER_TYPE_NONE){this.mPrivateFlags|=view_4.View.PFLAG_INVALIDATED;this.mLocalDirtyRect.union(dirty);}return this.mParent;}else{this.mPrivateFlags&=~view_4.View.PFLAG_DRAWN&~view_4.View.PFLAG_DRAWING_CACHE_VALID;location[0]=this.mLeft;location[1]=this.mTop;if((this.mGroupFlags&ViewGroup.FLAG_CLIP_CHILDREN)==ViewGroup.FLAG_CLIP_CHILDREN){dirty.set(0,0,this.mRight-this.mLeft,this.mBottom-this.mTop);}else{dirty.union(0,0,this.mRight-this.mLeft,this.mBottom-this.mTop);}if(this.mLayerType!=view_4.View.LAYER_TYPE_NONE){this.mPrivateFlags|=view_4.View.PFLAG_INVALIDATED;this.mLocalDirtyRect.union(dirty);}return this.mParent;}}return null;}},{key:'invalidateChildFast',value:function invalidateChildFast(child,dirty){var parent=this;var attachInfo=this.mAttachInfo;if(attachInfo!=null){if(child.mLayerType!=view_4.View.LAYER_TYPE_NONE){child.mLocalDirtyRect.union(dirty);}var left=child.mLeft;var top=child.mTop;if(!child.getMatrix().isIdentity()){child.transformRect(dirty);}do{if(parent instanceof ViewGroup){var parentVG=parent;if(parentVG.mLayerType!=view_4.View.LAYER_TYPE_NONE){parentVG.invalidate();parent=null;}else{parent=parentVG.invalidateChildInParentFast(left,top,dirty);left=parentVG.mLeft;top=parentVG.mTop;}}else{var _location2=attachInfo.mInvalidateChildLocation;_location2[0]=left;_location2[1]=top;parent=parent.invalidateChildInParent(_location2,dirty);}}while(parent!=null);}}},{key:'invalidateChildInParentFast',value:function invalidateChildInParentFast(left,top,dirty){if((this.mPrivateFlags&view_4.View.PFLAG_DRAWN)==view_4.View.PFLAG_DRAWN||(this.mPrivateFlags&view_4.View.PFLAG_DRAWING_CACHE_VALID)==view_4.View.PFLAG_DRAWING_CACHE_VALID){dirty.offset(left-this.mScrollX,top-this.mScrollY);if((this.mGroupFlags&ViewGroup.FLAG_CLIP_CHILDREN)==0){dirty.union(0,0,this.mRight-this.mLeft,this.mBottom-this.mTop);}if((this.mGroupFlags&ViewGroup.FLAG_CLIP_CHILDREN)==0||dirty.intersect(0,0,this.mRight-this.mLeft,this.mBottom-this.mTop)){if(this.mLayerType!=view_4.View.LAYER_TYPE_NONE){this.mLocalDirtyRect.union(dirty);}if(!this.getMatrix().isIdentity()){this.transformRect(dirty);}return this.mParent;}}return null;}},{key:'getChildStaticTransformation',value:function getChildStaticTransformation(child,t){return false;}},{key:'getChildTransformation',value:function getChildTransformation(){if(this.mChildTransformation==null){this.mChildTransformation=new Transformation();}return this.mChildTransformation;}},{key:'findViewTraversal',value:function findViewTraversal(id){if(id==this.mID){return this;}var where=this.mChildren;var len=this.mChildrenCount;for(var i=0;i<len;i++){var v=where[i];if((v.mPrivateFlags&view_4.View.PFLAG_IS_ROOT_NAMESPACE)==0){v=v.findViewById(id);if(v!=null){return v;}}}return null;}},{key:'findViewWithTagTraversal',value:function findViewWithTagTraversal(tag){if(tag!=null&&tag===this.mTag){return this;}var where=this.mChildren;var len=this.mChildrenCount;for(var i=0;i<len;i++){var v=where[i];if((v.mPrivateFlags&view_4.View.PFLAG_IS_ROOT_NAMESPACE)==0){v=v.findViewWithTag(tag);if(v!=null){return v;}}}return null;}},{key:'findViewByPredicateTraversal',value:function findViewByPredicateTraversal(predicate,childToSkip){if(predicate.apply(this)){return this;}var where=this.mChildren;var len=this.mChildrenCount;for(var i=0;i<len;i++){var v=where[i];if(v!=childToSkip&&(v.mPrivateFlags&view_4.View.PFLAG_IS_ROOT_NAMESPACE)==0){v=v.findViewByPredicate(predicate);if(v!=null){return v;}}}return null;}},{key:'requestDisallowInterceptTouchEvent',value:function requestDisallowInterceptTouchEvent(disallowIntercept){if(disallowIntercept==((this.mGroupFlags&ViewGroup.FLAG_DISALLOW_INTERCEPT)!=0)){return;}if(disallowIntercept){this.mGroupFlags|=ViewGroup.FLAG_DISALLOW_INTERCEPT;}else{this.mGroupFlags&=~ViewGroup.FLAG_DISALLOW_INTERCEPT;}if(this.mParent!=null){this.mParent.requestDisallowInterceptTouchEvent(disallowIntercept);}}},{key:'shouldDelayChildPressedState',value:function shouldDelayChildPressedState(){return true;}},{key:'onSetLayoutParams',value:function onSetLayoutParams(child,layoutParams){}},{key:'mChildrenCount',get:function get(){return this.mChildren.length;}}],[{key:'resetCancelNextUpFlag',value:function resetCancelNextUpFlag(view){if((view.mPrivateFlags&view_4.View.PFLAG_CANCEL_NEXT_UP_EVENT)!=0){view.mPrivateFlags&=~view_4.View.PFLAG_CANCEL_NEXT_UP_EVENT;return true;}return false;}},{key:'canViewReceivePointerEvents',value:function canViewReceivePointerEvents(child){return(child.mViewFlags&view_4.View.VISIBILITY_MASK)==view_4.View.VISIBLE||child.getAnimation()!=null;}},{key:'getChildMeasureSpec',value:function getChildMeasureSpec(spec,padding,childDimension){var MeasureSpec=view_4.View.MeasureSpec;var specMode=MeasureSpec.getMode(spec);var specSize=MeasureSpec.getSize(spec);var size=Math.max(0,specSize-padding);var resultSize=0;var resultMode=0;switch(specMode){case MeasureSpec.EXACTLY:if(childDimension>=0){resultSize=childDimension;resultMode=MeasureSpec.EXACTLY;}else if(childDimension==ViewGroup.LayoutParams.MATCH_PARENT){resultSize=size;resultMode=MeasureSpec.EXACTLY;}else if(childDimension==ViewGroup.LayoutParams.WRAP_CONTENT){resultSize=size;resultMode=MeasureSpec.AT_MOST;}break;case MeasureSpec.AT_MOST:if(childDimension>=0){resultSize=childDimension;resultMode=MeasureSpec.EXACTLY;}else if(childDimension==ViewGroup.LayoutParams.MATCH_PARENT){resultSize=size;resultMode=MeasureSpec.AT_MOST;}else if(childDimension==ViewGroup.LayoutParams.WRAP_CONTENT){resultSize=size;resultMode=MeasureSpec.AT_MOST;}break;case MeasureSpec.UNSPECIFIED:if(childDimension>=0){resultSize=childDimension;resultMode=MeasureSpec.EXACTLY;}else if(childDimension==ViewGroup.LayoutParams.MATCH_PARENT){resultSize=0;resultMode=MeasureSpec.UNSPECIFIED;}else if(childDimension==ViewGroup.LayoutParams.WRAP_CONTENT){resultSize=0;resultMode=MeasureSpec.UNSPECIFIED;}break;}return MeasureSpec.makeMeasureSpec(resultSize,resultMode);}}]);return ViewGroup;}(view_4.View);ViewGroup.FLAG_CLIP_CHILDREN=0x1;ViewGroup.FLAG_CLIP_TO_PADDING=0x2;ViewGroup.FLAG_INVALIDATE_REQUIRED=0x4;ViewGroup.FLAG_RUN_ANIMATION=0x8;ViewGroup.FLAG_ANIMATION_DONE=0x10;ViewGroup.FLAG_PADDING_NOT_NULL=0x20;ViewGroup.FLAG_ANIMATION_CACHE=0x40;ViewGroup.FLAG_OPTIMIZE_INVALIDATE=0x80;ViewGroup.FLAG_CLEAR_TRANSFORMATION=0x100;ViewGroup.FLAG_NOTIFY_ANIMATION_LISTENER=0x200;ViewGroup.FLAG_USE_CHILD_DRAWING_ORDER=0x400;ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS=0x800;ViewGroup.FLAG_ALPHA_LOWER_THAN_ONE=0x1000;ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN=0x2000;ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE=0x4000;ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE=0x8000;ViewGroup.FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE=0x10000;ViewGroup.FLAG_MASK_FOCUSABILITY=0x60000;ViewGroup.FOCUS_BEFORE_DESCENDANTS=0x20000;ViewGroup.FOCUS_AFTER_DESCENDANTS=0x40000;ViewGroup.FOCUS_BLOCK_DESCENDANTS=0x60000;ViewGroup.FLAG_DISALLOW_INTERCEPT=0x80000;ViewGroup.FLAG_SPLIT_MOTION_EVENTS=0x200000;ViewGroup.FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW=0x400000;ViewGroup.FLAG_LAYOUT_MODE_WAS_EXPLICITLY_SET=0x800000;ViewGroup.PERSISTENT_NO_CACHE=0x0;ViewGroup.PERSISTENT_ANIMATION_CACHE=0x1;ViewGroup.PERSISTENT_SCROLLING_CACHE=0x2;ViewGroup.PERSISTENT_ALL_CACHES=0x3;ViewGroup.LAYOUT_MODE_UNDEFINED=-1;ViewGroup.LAYOUT_MODE_CLIP_BOUNDS=0;ViewGroup.LAYOUT_MODE_DEFAULT=ViewGroup.LAYOUT_MODE_CLIP_BOUNDS;ViewGroup.CLIP_TO_PADDING_MASK=ViewGroup.FLAG_CLIP_TO_PADDING|ViewGroup.FLAG_PADDING_NOT_NULL;view_4.ViewGroup=ViewGroup;(function(ViewGroup){var LayoutParams=function(_java$lang$JavaObject){_inherits(LayoutParams,_java$lang$JavaObject);function LayoutParams(){_classCallCheck(this,LayoutParams);var _this48=_possibleConstructorReturn(this,(LayoutParams.__proto__||Object.getPrototypeOf(LayoutParams)).call(this));_this48.width=0;_this48.height=0;for(var _len17=arguments.length,args=Array(_len17),_key18=0;_key18<_len17;_key18++){args[_key18]=arguments[_key18];}if(args[0]instanceof Context&&args[1]instanceof HTMLElement){var _a=args[0].obtainStyledAttributes(args[1]);_this48.setBaseAttributes(_a,'layout_width','layout_height');_a.recycle();}else if(typeof args[0]==='number'&&typeof args[1]==='number'){_this48.width=args[0];_this48.height=args[1];}else if(args[0]instanceof LayoutParams){_this48.width=args[0].width;_this48.height=args[0].height;}else if(args.length===0){}return _this48;}_createClass(LayoutParams,[{key:'setBaseAttributes',value:function setBaseAttributes(a,widthAttr,heightAttr){this.width=a.getLayoutDimension(widthAttr,LayoutParams.WRAP_CONTENT);this.height=a.getLayoutDimension(heightAttr,LayoutParams.WRAP_CONTENT);}},{key:'getAttrBinder',value:function getAttrBinder(){if(!this._attrBinder){this._attrBinder=this.initBindAttr();}return this._attrBinder;}},{key:'initBindAttr',value:function initBindAttr(){var classAttrBinder=LayoutParams.ClassAttrBinderClazzMap.get(this.getClass());if(!classAttrBinder){classAttrBinder=this.createClassAttrBinder();LayoutParams.ClassAttrBinderClazzMap.set(this.getClass(),classAttrBinder);}var attrBinder=new AttrBinder(this);attrBinder.setClassAttrBind(classAttrBinder);return attrBinder;}},{key:'createClassAttrBinder',value:function createClassAttrBinder(){return new androidui.attr.AttrBinder.ClassBinderMap().set('layout_width',{setter:function setter(host,value,attrBinder){host.width=attrBinder.parseDimension(value,host.width);},getter:function getter(host){return host.width;}}).set('layout_height',{setter:function setter(host,value,attrBinder){host.height=attrBinder.parseDimension(value,host.height);},getter:function getter(host){return host.height;}});}}]);return LayoutParams;}(java.lang.JavaObject);LayoutParams.ClassAttrBinderClazzMap=new Map();LayoutParams.FILL_PARENT=-1;LayoutParams.MATCH_PARENT=-1;LayoutParams.WRAP_CONTENT=-2;ViewGroup.LayoutParams=LayoutParams;var MarginLayoutParams=function(_LayoutParams){_inherits(MarginLayoutParams,_LayoutParams);function MarginLayoutParams(){var _ref5;for(var _len18=arguments.length,args=Array(_len18),_key19=0;_key19<_len18;_key19++){args[_key19]=arguments[_key19];}_classCallCheck(this,MarginLayoutParams);var _this49=_possibleConstructorReturn(this,(_ref5=MarginLayoutParams.__proto__||Object.getPrototypeOf(MarginLayoutParams)).call.apply(_ref5,[this].concat(_toConsumableArray(function(){if(args[0]instanceof Context&&args[1]instanceof HTMLElement)return[0,0];else if(typeof args[0]==='number'&&typeof args[1]==='number')return[args[0],args[1]];else if(args[0]instanceof MarginLayoutParams)return[args[0]];else if(args[0]instanceof ViewGroup.LayoutParams)return[args[0]];}()))));_this49.leftMargin=0;_this49.topMargin=0;_this49.rightMargin=0;_this49.bottomMargin=0;if(args[0]instanceof Context&&args[1]instanceof HTMLElement){var _a2=args[0].obtainStyledAttributes(args[1]);_this49.setBaseAttributes(_a2,'layout_width','layout_height');var margin=_a2.getDimensionPixelSize('layout_margin',-1);if(margin>=0){_this49.leftMargin=margin;_this49.topMargin=margin;_this49.rightMargin=margin;_this49.bottomMargin=margin;}else{_this49.leftMargin=_a2.getDimensionPixelSize('layout_marginLeft',0);_this49.rightMargin=_a2.getDimensionPixelSize('layout_marginRight',0);_this49.topMargin=_a2.getDimensionPixelSize('layout_marginTop',0);_this49.bottomMargin=_a2.getDimensionPixelSize('layout_marginBottom',0);_this49.leftMargin=_a2.getDimensionPixelSize('layout_marginStart',_this49.leftMargin);_this49.rightMargin=_a2.getDimensionPixelSize('layout_marginEnd',_this49.rightMargin);}_a2.recycle();}else if(typeof args[0]==='number'&&typeof args[1]==='number'){}else if(args[0]instanceof MarginLayoutParams){var source=args[0];_this49.width=source.width;_this49.height=source.height;_this49.leftMargin=source.leftMargin;_this49.topMargin=source.topMargin;_this49.rightMargin=source.rightMargin;_this49.bottomMargin=source.bottomMargin;}else if(args[0]instanceof ViewGroup.LayoutParams){}return _this49;}_createClass(MarginLayoutParams,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(MarginLayoutParams.prototype.__proto__||Object.getPrototypeOf(MarginLayoutParams.prototype),'createClassAttrBinder',this).call(this).set('layout_marginLeft',{setter:function setter(host,value){if(value==null)value=0;host.leftMargin=value;},getter:function getter(host){return host.leftMargin;}}).set('layout_marginStart',{setter:function setter(host,value){if(value==null)value=0;host.leftMargin=value;},getter:function getter(host){return host.leftMargin;}}).set('layout_marginTop',{setter:function setter(host,value){if(value==null)value=0;host.topMargin=value;},getter:function getter(host){return host.topMargin;}}).set('layout_marginRight',{setter:function setter(host,value){if(value==null)value=0;host.rightMargin=value;},getter:function getter(host){return host.rightMargin;}}).set('layout_marginEnd',{setter:function setter(host,value){if(value==null)value=0;host.rightMargin=value;},getter:function getter(host){return host.rightMargin;}}).set('layout_marginBottom',{setter:function setter(host,value){if(value==null)value=0;host.bottomMargin=value;},getter:function getter(host){return host.bottomMargin;}}).set('layout_margin',{setter:function setter(host,value,attrBinder){if(value==null)value=0;var _attrBinder$parsePadd5=attrBinder.parsePaddingMarginTRBL(value),_attrBinder$parsePadd6=_slicedToArray(_attrBinder$parsePadd5,4),top=_attrBinder$parsePadd6[0],right=_attrBinder$parsePadd6[1],bottom=_attrBinder$parsePadd6[2],left=_attrBinder$parsePadd6[3];host.topMargin=top;host.rightMargin=right;host.bottomMargin=bottom;host.leftMargin=left;},getter:function getter(host){return host.topMargin+' '+host.rightMargin+' '+host.bottomMargin+' '+host.leftMargin;}});}},{key:'setMargins',value:function setMargins(left,top,right,bottom){this.leftMargin=left;this.topMargin=top;this.rightMargin=right;this.bottomMargin=bottom;}},{key:'setLayoutDirection',value:function setLayoutDirection(layoutDirection){}},{key:'getLayoutDirection',value:function getLayoutDirection(){return view_4.View.LAYOUT_DIRECTION_LTR;}},{key:'isLayoutRtl',value:function isLayoutRtl(){return this.getLayoutDirection()==view_4.View.LAYOUT_DIRECTION_RTL;}},{key:'resolveLayoutDirection',value:function resolveLayoutDirection(layoutDirection){}}]);return MarginLayoutParams;}(LayoutParams);MarginLayoutParams.DEFAULT_MARGIN_RELATIVE=Integer.MIN_VALUE;MarginLayoutParams.DEFAULT_MARGIN_RESOLVED=0;MarginLayoutParams.UNDEFINED_MARGIN=MarginLayoutParams.DEFAULT_MARGIN_RELATIVE;ViewGroup.MarginLayoutParams=MarginLayoutParams;})(ViewGroup=view_4.ViewGroup||(view_4.ViewGroup={}));var TouchTarget=function(){function TouchTarget(){_classCallCheck(this,TouchTarget);}_createClass(TouchTarget,[{key:'recycle',value:function recycle(){if(TouchTarget.sRecycledCount<TouchTarget.MAX_RECYCLED){this.next=TouchTarget.sRecycleBin;TouchTarget.sRecycleBin=this;TouchTarget.sRecycledCount+=1;}else{this.next=null;}this.child=null;}}],[{key:'obtain',value:function obtain(child,pointerIdBits){var target=void 0;if(TouchTarget.sRecycleBin==null){target=new TouchTarget();}else{target=TouchTarget.sRecycleBin;TouchTarget.sRecycleBin=target.next;TouchTarget.sRecycledCount--;target.next=null;}target.child=child;target.pointerIdBits=pointerIdBits;return target;}}]);return TouchTarget;}();TouchTarget.MAX_RECYCLED=32;TouchTarget.sRecycledCount=0;TouchTarget.ALL_POINTER_IDS=-1;})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var Drawable=android.graphics.drawable.Drawable;var ViewOverlay=function(){function ViewOverlay(hostView){_classCallCheck(this,ViewOverlay);this.mOverlayViewGroup=new ViewOverlay.OverlayViewGroup(hostView);}_createClass(ViewOverlay,[{key:'getOverlayView',value:function getOverlayView(){return this.mOverlayViewGroup;}},{key:'add',value:function add(drawable){this.mOverlayViewGroup.add(drawable);}},{key:'remove',value:function remove(drawable){}},{key:'clear',value:function clear(){this.mOverlayViewGroup.clear();}},{key:'isEmpty',value:function isEmpty(){return this.mOverlayViewGroup.isEmpty();}}]);return ViewOverlay;}();view.ViewOverlay=ViewOverlay;(function(ViewOverlay){var OverlayViewGroup=function(_view$ViewGroup){_inherits(OverlayViewGroup,_view$ViewGroup);function OverlayViewGroup(hostView){_classCallCheck(this,OverlayViewGroup);var _this50=_possibleConstructorReturn(this,(OverlayViewGroup.__proto__||Object.getPrototypeOf(OverlayViewGroup)).call(this,hostView.getContext()));_this50.mHostView=hostView;_this50.mAttachInfo=hostView.mAttachInfo;_this50.mRight=hostView.getWidth();_this50.mBottom=hostView.getHeight();return _this50;}_createClass(OverlayViewGroup,[{key:'addDrawable',value:function addDrawable(drawable){}},{key:'addView',value:function addView(child){}},{key:'add',value:function add(arg){if(arg instanceof Drawable)this.addDrawable(arg);else if(arg instanceof view.View)this.addView(arg);}},{key:'clear',value:function clear(){}},{key:'isEmpty',value:function isEmpty(){return true;}},{key:'onLayout',value:function onLayout(changed,l,t,r,b){}}]);return OverlayViewGroup;}(view.ViewGroup);ViewOverlay.OverlayViewGroup=OverlayViewGroup;})(ViewOverlay=view.ViewOverlay||(view.ViewOverlay={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var Gravity=android.view.Gravity;var View=android.view.View;var ViewGroup=android.view.ViewGroup;var Rect=android.graphics.Rect;var Context=android.content.Context;var FrameLayout=function(_ViewGroup){_inherits(FrameLayout,_ViewGroup);function FrameLayout(context,bindElement,defStyle){_classCallCheck(this,FrameLayout);var _this51=_possibleConstructorReturn(this,(FrameLayout.__proto__||Object.getPrototypeOf(FrameLayout)).call(this,context,bindElement,defStyle));_this51.mMeasureAllChildren=false;_this51.mForegroundPaddingLeft=0;_this51.mForegroundPaddingTop=0;_this51.mForegroundPaddingRight=0;_this51.mForegroundPaddingBottom=0;_this51.mSelfBounds=new Rect();_this51.mOverlayBounds=new Rect();_this51.mForegroundGravity=Gravity.FILL;_this51.mForegroundInPadding=true;_this51.mForegroundBoundsChanged=false;_this51.mMatchParentChildren=new Array(1);var a=context.obtainStyledAttributes(bindElement,defStyle);_this51.mForegroundGravity=Gravity.parseGravity(a.getAttrValue('foregroundGravity'),_this51.mForegroundGravity);var d=a.getDrawable('foreground');if(d!=null){_this51.setForeground(d);}if(a.getBoolean('measureAllChildren',false)){_this51.setMeasureAllChildren(true);}_this51.mForegroundInPadding=a.getBoolean('foregroundInsidePadding',true);a.recycle();return _this51;}_createClass(FrameLayout,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(FrameLayout.prototype.__proto__||Object.getPrototypeOf(FrameLayout.prototype),'createClassAttrBinder',this).call(this).set('foregroundGravity',{setter:function setter(v,value,attrBinder){v.mForegroundGravity=attrBinder.parseGravity(value,v.mForegroundGravity);},getter:function getter(v){return v.mForegroundGravity;}}).set('foreground',{setter:function setter(v,value,attrBinder){v.setForeground(attrBinder.parseDrawable(value));},getter:function getter(v){return v.getForeground();}}).set('measureAllChildren',{setter:function setter(v,value,attrBinder){if(attrBinder.parseBoolean(value)){v.setMeasureAllChildren(true);}},getter:function getter(v){return v.mMeasureAllChildren;}});}},{key:'getForegroundGravity',value:function getForegroundGravity(){return this.mForegroundGravity;}},{key:'setForegroundGravity',value:function setForegroundGravity(foregroundGravity){if(this.mForegroundGravity!=foregroundGravity){if((foregroundGravity&Gravity.HORIZONTAL_GRAVITY_MASK)==0){foregroundGravity|=Gravity.LEFT;}if((foregroundGravity&Gravity.VERTICAL_GRAVITY_MASK)==0){foregroundGravity|=Gravity.TOP;}this.mForegroundGravity=foregroundGravity;if(this.mForegroundGravity==Gravity.FILL&&this.mForeground!=null){var _padding3=new Rect();if(this.mForeground.getPadding(_padding3)){this.mForegroundPaddingLeft=_padding3.left;this.mForegroundPaddingTop=_padding3.top;this.mForegroundPaddingRight=_padding3.right;this.mForegroundPaddingBottom=_padding3.bottom;}}else{this.mForegroundPaddingLeft=0;this.mForegroundPaddingTop=0;this.mForegroundPaddingRight=0;this.mForegroundPaddingBottom=0;}this.requestLayout();}}},{key:'verifyDrawable',value:function verifyDrawable(who){return _get2(FrameLayout.prototype.__proto__||Object.getPrototypeOf(FrameLayout.prototype),'verifyDrawable',this).call(this,who)||who==this.mForeground;}},{key:'jumpDrawablesToCurrentState',value:function jumpDrawablesToCurrentState(){_get2(FrameLayout.prototype.__proto__||Object.getPrototypeOf(FrameLayout.prototype),'jumpDrawablesToCurrentState',this).call(this);if(this.mForeground!=null)this.mForeground.jumpToCurrentState();}},{key:'drawableStateChanged',value:function drawableStateChanged(){_get2(FrameLayout.prototype.__proto__||Object.getPrototypeOf(FrameLayout.prototype),'drawableStateChanged',this).call(this);if(this.mForeground!=null&&this.mForeground.isStateful()){this.mForeground.setState(this.getDrawableState());}}},{key:'generateDefaultLayoutParams',value:function generateDefaultLayoutParams(){return new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,FrameLayout.LayoutParams.MATCH_PARENT);}},{key:'setForeground',value:function setForeground(drawable){if(this.mForeground!=drawable){if(this.mForeground!=null){this.mForeground.setCallback(null);this.unscheduleDrawable(this.mForeground);}this.mForeground=drawable;this.mForegroundPaddingLeft=0;this.mForegroundPaddingTop=0;this.mForegroundPaddingRight=0;this.mForegroundPaddingBottom=0;if(drawable!=null){this.setWillNotDraw(false);drawable.setCallback(this);if(drawable.isStateful()){drawable.setState(this.getDrawableState());}if(this.mForegroundGravity==Gravity.FILL){var _padding4=new Rect();if(drawable.getPadding(_padding4)){this.mForegroundPaddingLeft=_padding4.left;this.mForegroundPaddingTop=_padding4.top;this.mForegroundPaddingRight=_padding4.right;this.mForegroundPaddingBottom=_padding4.bottom;}}}else{this.setWillNotDraw(true);}this.requestLayout();this.invalidate();}}},{key:'getForeground',value:function getForeground(){return this.mForeground;}},{key:'getPaddingLeftWithForeground',value:function getPaddingLeftWithForeground(){return this.mForegroundInPadding?Math.max(this.mPaddingLeft,this.mForegroundPaddingLeft):this.mPaddingLeft+this.mForegroundPaddingLeft;}},{key:'getPaddingRightWithForeground',value:function getPaddingRightWithForeground(){return this.mForegroundInPadding?Math.max(this.mPaddingRight,this.mForegroundPaddingRight):this.mPaddingRight+this.mForegroundPaddingRight;}},{key:'getPaddingTopWithForeground',value:function getPaddingTopWithForeground(){return this.mForegroundInPadding?Math.max(this.mPaddingTop,this.mForegroundPaddingTop):this.mPaddingTop+this.mForegroundPaddingTop;}},{key:'getPaddingBottomWithForeground',value:function getPaddingBottomWithForeground(){return this.mForegroundInPadding?Math.max(this.mPaddingBottom,this.mForegroundPaddingBottom):this.mPaddingBottom+this.mForegroundPaddingBottom;}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){var count=this.getChildCount();var measureMatchParentChildren=View.MeasureSpec.getMode(widthMeasureSpec)!=View.MeasureSpec.EXACTLY||View.MeasureSpec.getMode(heightMeasureSpec)!=View.MeasureSpec.EXACTLY;this.mMatchParentChildren=[];var maxHeight=0;var maxWidth=0;var childState=0;for(var i=0;i<count;i++){var child=this.getChildAt(i);if(this.mMeasureAllChildren||child.getVisibility()!=View.GONE){this.measureChildWithMargins(child,widthMeasureSpec,0,heightMeasureSpec,0);var lp=child.getLayoutParams();maxWidth=Math.max(maxWidth,child.getMeasuredWidth()+lp.leftMargin+lp.rightMargin);maxHeight=Math.max(maxHeight,child.getMeasuredHeight()+lp.topMargin+lp.bottomMargin);childState=View.combineMeasuredStates(childState,child.getMeasuredState());if(measureMatchParentChildren){if(lp.width==FrameLayout.LayoutParams.MATCH_PARENT||lp.height==FrameLayout.LayoutParams.MATCH_PARENT){this.mMatchParentChildren.push(child);}}}}maxWidth+=this.getPaddingLeftWithForeground()+this.getPaddingRightWithForeground();maxHeight+=this.getPaddingTopWithForeground()+this.getPaddingBottomWithForeground();maxHeight=Math.max(maxHeight,this.getSuggestedMinimumHeight());maxWidth=Math.max(maxWidth,this.getSuggestedMinimumWidth());var drawable=this.getForeground();if(drawable!=null){maxHeight=Math.max(maxHeight,drawable.getMinimumHeight());maxWidth=Math.max(maxWidth,drawable.getMinimumWidth());}this.setMeasuredDimension(View.resolveSizeAndState(maxWidth,widthMeasureSpec,childState),View.resolveSizeAndState(maxHeight,heightMeasureSpec,childState<<View.MEASURED_HEIGHT_STATE_SHIFT));count=this.mMatchParentChildren.length;if(count>1){for(var _i14=0;_i14<count;_i14++){var _child3=this.mMatchParentChildren[_i14];var _lp=_child3.getLayoutParams();var childWidthMeasureSpec=void 0;var childHeightMeasureSpec=void 0;if(_lp.width==FrameLayout.LayoutParams.MATCH_PARENT){childWidthMeasureSpec=View.MeasureSpec.makeMeasureSpec(this.getMeasuredWidth()-this.getPaddingLeftWithForeground()-this.getPaddingRightWithForeground()-_lp.leftMargin-_lp.rightMargin,View.MeasureSpec.EXACTLY);}else{childWidthMeasureSpec=ViewGroup.getChildMeasureSpec(widthMeasureSpec,this.getPaddingLeftWithForeground()+this.getPaddingRightWithForeground()+_lp.leftMargin+_lp.rightMargin,_lp.width);}if(_lp.height==FrameLayout.LayoutParams.MATCH_PARENT){childHeightMeasureSpec=View.MeasureSpec.makeMeasureSpec(this.getMeasuredHeight()-this.getPaddingTopWithForeground()-this.getPaddingBottomWithForeground()-_lp.topMargin-_lp.bottomMargin,View.MeasureSpec.EXACTLY);}else{childHeightMeasureSpec=ViewGroup.getChildMeasureSpec(heightMeasureSpec,this.getPaddingTopWithForeground()+this.getPaddingBottomWithForeground()+_lp.topMargin+_lp.bottomMargin,_lp.height);}_child3.measure(childWidthMeasureSpec,childHeightMeasureSpec);}}}},{key:'onLayout',value:function onLayout(changed,left,top,right,bottom){this.layoutChildren(left,top,right,bottom,false);}},{key:'layoutChildren',value:function layoutChildren(left,top,right,bottom,forceLeftGravity){var count=this.getChildCount();var parentLeft=this.getPaddingLeftWithForeground();var parentRight=right-left-this.getPaddingRightWithForeground();var parentTop=this.getPaddingTopWithForeground();var parentBottom=bottom-top-this.getPaddingBottomWithForeground();this.mForegroundBoundsChanged=true;for(var i=0;i<count;i++){var child=this.getChildAt(i);if(child.getVisibility()!=View.GONE){var lp=child.getLayoutParams();var width=child.getMeasuredWidth();var height=child.getMeasuredHeight();var childLeft=void 0;var childTop=void 0;var gravity=lp.gravity;if(gravity==-1){gravity=FrameLayout.DEFAULT_CHILD_GRAVITY;}var absoluteGravity=gravity;var verticalGravity=gravity&Gravity.VERTICAL_GRAVITY_MASK;switch(absoluteGravity&Gravity.HORIZONTAL_GRAVITY_MASK){case Gravity.CENTER_HORIZONTAL:childLeft=parentLeft+(parentRight-parentLeft-width)/2+lp.leftMargin-lp.rightMargin;break;case Gravity.RIGHT:if(!forceLeftGravity){childLeft=parentRight-width-lp.rightMargin;break;}case Gravity.LEFT:default:childLeft=parentLeft+lp.leftMargin;}switch(verticalGravity){case Gravity.TOP:childTop=parentTop+lp.topMargin;break;case Gravity.CENTER_VERTICAL:childTop=parentTop+(parentBottom-parentTop-height)/2+lp.topMargin-lp.bottomMargin;break;case Gravity.BOTTOM:childTop=parentBottom-height-lp.bottomMargin;break;default:childTop=parentTop+lp.topMargin;}child.layout(childLeft,childTop,childLeft+width,childTop+height);}}}},{key:'onSizeChanged',value:function onSizeChanged(w,h,oldw,oldh){_get2(FrameLayout.prototype.__proto__||Object.getPrototypeOf(FrameLayout.prototype),'onSizeChanged',this).call(this,w,h,oldw,oldh);this.mForegroundBoundsChanged=true;}},{key:'draw',value:function draw(canvas){_get2(FrameLayout.prototype.__proto__||Object.getPrototypeOf(FrameLayout.prototype),'draw',this).call(this,canvas);if(this.mForeground!=null){var foreground=this.mForeground;if(this.mForegroundBoundsChanged){this.mForegroundBoundsChanged=false;var selfBounds=this.mSelfBounds;var overlayBounds=this.mOverlayBounds;var w=this.mRight-this.mLeft;var h=this.mBottom-this.mTop;if(this.mForegroundInPadding){selfBounds.set(0,0,w,h);}else{selfBounds.set(this.mPaddingLeft,this.mPaddingTop,w-this.mPaddingRight,h-this.mPaddingBottom);}Gravity.apply(this.mForegroundGravity,foreground.getIntrinsicWidth(),foreground.getIntrinsicHeight(),selfBounds,overlayBounds);foreground.setBounds(overlayBounds);}foreground.draw(canvas);}}},{key:'setMeasureAllChildren',value:function setMeasureAllChildren(measureAll){this.mMeasureAllChildren=measureAll;}},{key:'getMeasureAllChildren',value:function getMeasureAllChildren(){return this.mMeasureAllChildren;}},{key:'generateLayoutParamsFromAttr',value:function generateLayoutParamsFromAttr(attrs){return new FrameLayout.LayoutParams(this.getContext(),attrs);}},{key:'shouldDelayChildPressedState',value:function shouldDelayChildPressedState(){return false;}},{key:'checkLayoutParams',value:function checkLayoutParams(p){return p instanceof FrameLayout.LayoutParams;}},{key:'generateLayoutParams',value:function generateLayoutParams(p){return new FrameLayout.LayoutParams(p);}}]);return FrameLayout;}(ViewGroup);FrameLayout.DEFAULT_CHILD_GRAVITY=Gravity.TOP|Gravity.LEFT;widget.FrameLayout=FrameLayout;(function(FrameLayout){var LayoutParams=function(_ViewGroup$MarginLayo){_inherits(LayoutParams,_ViewGroup$MarginLayo);function LayoutParams(){var _ref6;for(var _len19=arguments.length,args=Array(_len19),_key20=0;_key20<_len19;_key20++){args[_key20]=arguments[_key20];}_classCallCheck(this,LayoutParams);var _this52=_possibleConstructorReturn(this,(_ref6=LayoutParams.__proto__||Object.getPrototypeOf(LayoutParams)).call.apply(_ref6,[this].concat(_toConsumableArray(function(){if(args[0]instanceof android.content.Context&&args[1]instanceof HTMLElement)return[args[0],args[1]];else if(typeof args[0]==='number'&&typeof args[1]==='number'&&typeof args[2]==='number')return[args[0],args[1]];else if(typeof args[0]==='number'&&typeof args[1]==='number')return[args[0],args[1]];else if(args[0]instanceof ViewGroup.LayoutParams)return[args[0]];}()))));_this52.gravity=-1;if(args[0]instanceof Context&&args[1]instanceof HTMLElement){var c=args[0];var attrs=args[1];var _a3=c.obtainStyledAttributes(attrs);_this52.gravity=Gravity.parseGravity(_a3.getAttrValue('layout_gravity'),-1);_a3.recycle();}else if(typeof args[0]==='number'&&typeof args[1]==='number'&&typeof args[2]==='number'){_this52.gravity=args[2];}else if(typeof args[0]==='number'&&typeof args[1]==='number'){}else if(args[0]instanceof FrameLayout.LayoutParams){var source=args[0];_this52.gravity=source.gravity;}else if(args[0]instanceof ViewGroup.MarginLayoutParams){}else if(args[0]instanceof ViewGroup.LayoutParams){}return _this52;}_createClass(LayoutParams,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(LayoutParams.prototype.__proto__||Object.getPrototypeOf(LayoutParams.prototype),'createClassAttrBinder',this).call(this).set('layout_gravity',{setter:function setter(param,value,attrBinder){param.gravity=attrBinder.parseGravity(value,param.gravity);},getter:function getter(param){return param.gravity;}});}}]);return LayoutParams;}(ViewGroup.MarginLayoutParams);FrameLayout.LayoutParams=LayoutParams;})(FrameLayout=widget.FrameLayout||(widget.FrameLayout={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var text;(function(text){var Spanned;(function(Spanned){function isImplements(obj){return obj&&obj['getSpans']&&obj['getSpanStart']&&obj['getSpanEnd']&&obj['getSpanFlags']&&obj['nextSpanTransition'];}Spanned.isImplements=isImplements;Spanned.SPAN_POINT_MARK_MASK=0x33;Spanned.SPAN_MARK_MARK=0x11;Spanned.SPAN_MARK_POINT=0x12;Spanned.SPAN_POINT_MARK=0x21;Spanned.SPAN_POINT_POINT=0x22;Spanned.SPAN_PARAGRAPH=0x33;Spanned.SPAN_INCLUSIVE_EXCLUSIVE=Spanned.SPAN_MARK_MARK;Spanned.SPAN_INCLUSIVE_INCLUSIVE=Spanned.SPAN_MARK_POINT;Spanned.SPAN_EXCLUSIVE_EXCLUSIVE=Spanned.SPAN_POINT_MARK;Spanned.SPAN_EXCLUSIVE_INCLUSIVE=Spanned.SPAN_POINT_POINT;Spanned.SPAN_COMPOSING=0x100;Spanned.SPAN_INTERMEDIATE=0x200;Spanned.SPAN_USER_SHIFT=24;Spanned.SPAN_USER=0xFFFFFFFF<<Spanned.SPAN_USER_SHIFT;Spanned.SPAN_PRIORITY_SHIFT=16;Spanned.SPAN_PRIORITY=0xFF<<Spanned.SPAN_PRIORITY_SHIFT;})(Spanned=text.Spanned||(text.Spanned={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text){var TextPaint=function(_android$graphics$Pai){_inherits(TextPaint,_android$graphics$Pai);function TextPaint(){_classCallCheck(this,TextPaint);var _this53=_possibleConstructorReturn(this,(TextPaint.__proto__||Object.getPrototypeOf(TextPaint)).apply(this,arguments));_this53.baselineShift=0;_this53.bgColor=0;_this53.linkColor=0;_this53.underlineColor=0;_this53.underlineThickness=0;return _this53;}_createClass(TextPaint,[{key:'set',value:function set(tp){_get2(TextPaint.prototype.__proto__||Object.getPrototypeOf(TextPaint.prototype),'set',this).call(this,tp);this.bgColor=tp.bgColor;this.baselineShift=tp.baselineShift;this.linkColor=tp.linkColor;this.underlineColor=tp.underlineColor;this.underlineThickness=tp.underlineThickness;}},{key:'setUnderlineText',value:function setUnderlineText(color,thickness){this.underlineColor=color;this.underlineThickness=thickness;}}]);return TextPaint;}(android.graphics.Paint);text.TextPaint=TextPaint;})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text){var style;(function(style){var MetricAffectingSpan=android.text.style.MetricAffectingSpan;var CharacterStyle=function(){function CharacterStyle(){_classCallCheck(this,CharacterStyle);this.mType=CharacterStyle.type;}_createClass(CharacterStyle,[{key:'getUnderlying',value:function getUnderlying(){return this;}}],[{key:'wrap',value:function wrap(cs){if(cs instanceof MetricAffectingSpan){return new MetricAffectingSpan.Passthrough_MetricAffectingSpan(cs);}else{return new CharacterStyle.Passthrough_CharacterStyle(cs);}}}]);return CharacterStyle;}();CharacterStyle.type=Symbol();style.CharacterStyle=CharacterStyle;(function(CharacterStyle){var Passthrough_CharacterStyle=function(_CharacterStyle){_inherits(Passthrough_CharacterStyle,_CharacterStyle);function Passthrough_CharacterStyle(cs){_classCallCheck(this,Passthrough_CharacterStyle);var _this54=_possibleConstructorReturn(this,(Passthrough_CharacterStyle.__proto__||Object.getPrototypeOf(Passthrough_CharacterStyle)).call(this));_this54.mStyle=cs;return _this54;}_createClass(Passthrough_CharacterStyle,[{key:'updateDrawState',value:function updateDrawState(tp){this.mStyle.updateDrawState(tp);}},{key:'getUnderlying',value:function getUnderlying(){return this.mStyle.getUnderlying();}}]);return Passthrough_CharacterStyle;}(CharacterStyle);CharacterStyle.Passthrough_CharacterStyle=Passthrough_CharacterStyle;})(CharacterStyle=style.CharacterStyle||(style.CharacterStyle={}));})(style=text.style||(text.style={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text){var style;(function(style){var CharacterStyle=android.text.style.CharacterStyle;var MetricAffectingSpan=function(_CharacterStyle2){_inherits(MetricAffectingSpan,_CharacterStyle2);function MetricAffectingSpan(){_classCallCheck(this,MetricAffectingSpan);var _this55=_possibleConstructorReturn(this,(MetricAffectingSpan.__proto__||Object.getPrototypeOf(MetricAffectingSpan)).apply(this,arguments));_this55.mType=MetricAffectingSpan.type;return _this55;}_createClass(MetricAffectingSpan,[{key:'getUnderlying',value:function getUnderlying(){return this;}}]);return MetricAffectingSpan;}(CharacterStyle);MetricAffectingSpan.type=Symbol();style.MetricAffectingSpan=MetricAffectingSpan;(function(MetricAffectingSpan){var Passthrough_MetricAffectingSpan=function(_MetricAffectingSpan){_inherits(Passthrough_MetricAffectingSpan,_MetricAffectingSpan);function Passthrough_MetricAffectingSpan(cs){_classCallCheck(this,Passthrough_MetricAffectingSpan);var _this56=_possibleConstructorReturn(this,(Passthrough_MetricAffectingSpan.__proto__||Object.getPrototypeOf(Passthrough_MetricAffectingSpan)).call(this));_this56.mStyle=cs;return _this56;}_createClass(Passthrough_MetricAffectingSpan,[{key:'updateDrawState',value:function updateDrawState(tp){this.mStyle.updateDrawState(tp);}},{key:'updateMeasureState',value:function updateMeasureState(tp){this.mStyle.updateMeasureState(tp);}},{key:'getUnderlying',value:function getUnderlying(){return this.mStyle.getUnderlying();}}]);return Passthrough_MetricAffectingSpan;}(MetricAffectingSpan);MetricAffectingSpan.Passthrough_MetricAffectingSpan=Passthrough_MetricAffectingSpan;})(MetricAffectingSpan=style.MetricAffectingSpan||(style.MetricAffectingSpan={}));})(style=text.style||(text.style={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text_1){var style;(function(style){var MetricAffectingSpan=android.text.style.MetricAffectingSpan;var ReplacementSpan=function(_MetricAffectingSpan2){_inherits(ReplacementSpan,_MetricAffectingSpan2);function ReplacementSpan(){_classCallCheck(this,ReplacementSpan);var _this57=_possibleConstructorReturn(this,(ReplacementSpan.__proto__||Object.getPrototypeOf(ReplacementSpan)).apply(this,arguments));_this57.mType=ReplacementSpan.type;return _this57;}_createClass(ReplacementSpan,[{key:'updateMeasureState',value:function updateMeasureState(p){}},{key:'updateDrawState',value:function updateDrawState(ds){}}]);return ReplacementSpan;}(MetricAffectingSpan);ReplacementSpan.type=Symbol();style.ReplacementSpan=ReplacementSpan;})(style=text_1.style||(text_1.style={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text){var style;(function(style){var ParagraphStyle;(function(ParagraphStyle){ParagraphStyle.type=Symbol();})(ParagraphStyle=style.ParagraphStyle||(style.ParagraphStyle={}));})(style=text.style||(text.style={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text_2){var style;(function(style){var TextUtils=android.text.TextUtils;var LeadingMarginSpan;(function(LeadingMarginSpan){function isImpl(obj){return obj&&obj['getLeadingMargin']&&obj['drawLeadingMargin'];}LeadingMarginSpan.isImpl=isImpl;LeadingMarginSpan.type=Symbol();var LeadingMarginSpan2;(function(LeadingMarginSpan2){function isImpl(obj){return obj['getLeadingMarginLineCount'];}LeadingMarginSpan2.isImpl=isImpl;})(LeadingMarginSpan2=LeadingMarginSpan.LeadingMarginSpan2||(LeadingMarginSpan.LeadingMarginSpan2={}));var Standard=function(){function Standard(first){var rest=arguments.length>1&&arguments[1]!==undefined?arguments[1]:first;_classCallCheck(this,Standard);this.mFirst=0;this.mRest=0;this.mFirst=first;this.mRest=rest;}_createClass(Standard,[{key:'getSpanTypeId',value:function getSpanTypeId(){return TextUtils.LEADING_MARGIN_SPAN;}},{key:'describeContents',value:function describeContents(){return 0;}},{key:'getLeadingMargin',value:function getLeadingMargin(first){return first?this.mFirst:this.mRest;}},{key:'drawLeadingMargin',value:function drawLeadingMargin(c,p,x,dir,top,baseline,bottom,text,start,end,first,layout){;}}]);return Standard;}();LeadingMarginSpan.Standard=Standard;})(LeadingMarginSpan=style.LeadingMarginSpan||(style.LeadingMarginSpan={}));})(style=text_2.style||(text_2.style={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text_3){var style;(function(style){var LineBackgroundSpan;(function(LineBackgroundSpan){LineBackgroundSpan.type=Symbol();})(LineBackgroundSpan=style.LineBackgroundSpan||(style.LineBackgroundSpan={}));})(style=text_3.style||(text_3.style={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text){var style;(function(style){var TabStopSpan;(function(TabStopSpan){TabStopSpan.type=Symbol();function isImpl(obj){return obj&&obj['getTabStop'];}TabStopSpan.isImpl=isImpl;var Standard=function(){function Standard(where){_classCallCheck(this,Standard);this.mTab=0;this.mTab=where;}_createClass(Standard,[{key:'getTabStop',value:function getTabStop(){return this.mTab;}}]);return Standard;}();TabStopSpan.Standard=Standard;})(TabStopSpan=style.TabStopSpan||(style.TabStopSpan={}));})(style=text.style||(text.style={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text){var SpanSet=function(){function SpanSet(type){_classCallCheck(this,SpanSet);this.numberOfSpans=0;this.classType=type;this.numberOfSpans=0;}_createClass(SpanSet,[{key:'init',value:function init(spanned,start,limit){var allSpans=spanned.getSpans(start,limit,this.classType);var length=allSpans.length;if(length>0&&(this.spans==null||this.spans.length<length)){this.spans=new Array(length);this.spanStarts=androidui.util.ArrayCreator.newNumberArray(length);this.spanEnds=androidui.util.ArrayCreator.newNumberArray(length);this.spanFlags=androidui.util.ArrayCreator.newNumberArray(length);}this.numberOfSpans=0;for(var i=0;i<length;i++){var span=allSpans[i];var spanStart=spanned.getSpanStart(span);var spanEnd=spanned.getSpanEnd(span);if(spanStart==spanEnd)continue;var spanFlag=spanned.getSpanFlags(span);this.spans[this.numberOfSpans]=span;this.spanStarts[this.numberOfSpans]=spanStart;this.spanEnds[this.numberOfSpans]=spanEnd;this.spanFlags[this.numberOfSpans]=spanFlag;this.numberOfSpans++;}}},{key:'hasSpansIntersecting',value:function hasSpansIntersecting(start,end){for(var i=0;i<this.numberOfSpans;i++){if(this.spanStarts[i]>=end||this.spanEnds[i]<=start)continue;return true;}return false;}},{key:'getNextTransition',value:function getNextTransition(start,limit){for(var i=0;i<this.numberOfSpans;i++){var spanStart=this.spanStarts[i];var spanEnd=this.spanEnds[i];if(spanStart>start&&spanStart<limit)limit=spanStart;if(spanEnd>start&&spanEnd<limit)limit=spanEnd;}return limit;}},{key:'recycle',value:function recycle(){for(var i=0;i<this.numberOfSpans;i++){this.spans[i]=null;}}}]);return SpanSet;}();text.SpanSet=SpanSet;})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text){var TextDirectionHeuristics=function(){function TextDirectionHeuristics(){_classCallCheck(this,TextDirectionHeuristics);}_createClass(TextDirectionHeuristics,null,[{key:'isRtlText',value:function isRtlText(directionality){return TextDirectionHeuristics.STATE_FALSE;}},{key:'isRtlTextOrFormat',value:function isRtlTextOrFormat(directionality){return TextDirectionHeuristics.STATE_FALSE;}}]);return TextDirectionHeuristics;}();TextDirectionHeuristics.STATE_TRUE=0;TextDirectionHeuristics.STATE_FALSE=1;TextDirectionHeuristics.STATE_UNKNOWN=2;text.TextDirectionHeuristics=TextDirectionHeuristics;(function(TextDirectionHeuristics){var TextDirectionHeuristicImpl=function(){function TextDirectionHeuristicImpl(algorithm){_classCallCheck(this,TextDirectionHeuristicImpl);this.mAlgorithm=algorithm;}_createClass(TextDirectionHeuristicImpl,[{key:'isRtl',value:function isRtl(cs,start,count){if(cs==null||start<0||count<0||cs.length-count<start){throw Error('new IllegalArgumentException()');}if(this.mAlgorithm==null){return this.defaultIsRtl();}return this.doCheck(cs,start,count);}},{key:'doCheck',value:function doCheck(cs,start,count){switch(this.mAlgorithm.checkRtl(cs,start,count)){case TextDirectionHeuristics.STATE_TRUE:return true;case TextDirectionHeuristics.STATE_FALSE:return false;default:return this.defaultIsRtl();}}}]);return TextDirectionHeuristicImpl;}();TextDirectionHeuristics.TextDirectionHeuristicImpl=TextDirectionHeuristicImpl;var TextDirectionHeuristicInternal=function(_TextDirectionHeurist){_inherits(TextDirectionHeuristicInternal,_TextDirectionHeurist);function TextDirectionHeuristicInternal(algorithm,defaultIsRtl){_classCallCheck(this,TextDirectionHeuristicInternal);var _this58=_possibleConstructorReturn(this,(TextDirectionHeuristicInternal.__proto__||Object.getPrototypeOf(TextDirectionHeuristicInternal)).call(this,algorithm));_this58.mDefaultIsRtl=defaultIsRtl;return _this58;}_createClass(TextDirectionHeuristicInternal,[{key:'defaultIsRtl',value:function defaultIsRtl(){return this.mDefaultIsRtl;}}]);return TextDirectionHeuristicInternal;}(TextDirectionHeuristics.TextDirectionHeuristicImpl);TextDirectionHeuristics.TextDirectionHeuristicInternal=TextDirectionHeuristicInternal;var FirstStrong=function(){function FirstStrong(){_classCallCheck(this,FirstStrong);}_createClass(FirstStrong,[{key:'checkRtl',value:function checkRtl(cs,start,count){var result=TextDirectionHeuristics.STATE_UNKNOWN;for(var i=start,e=start+count;i<e&&result==TextDirectionHeuristics.STATE_UNKNOWN;++i){result=TextDirectionHeuristics.STATE_FALSE;}return result;}}]);return FirstStrong;}();FirstStrong.INSTANCE=new FirstStrong();TextDirectionHeuristics.FirstStrong=FirstStrong;var AnyStrong=function(){function AnyStrong(lookForRtl){_classCallCheck(this,AnyStrong);this.mLookForRtl=lookForRtl;}_createClass(AnyStrong,[{key:'checkRtl',value:function checkRtl(cs,start,count){var haveUnlookedFor=false;for(var i=start,e=start+count;i<e;++i){switch(TextDirectionHeuristics.isRtlText(0)){case TextDirectionHeuristics.STATE_TRUE:if(this.mLookForRtl){return TextDirectionHeuristics.STATE_TRUE;}haveUnlookedFor=true;break;case TextDirectionHeuristics.STATE_FALSE:if(!this.mLookForRtl){return TextDirectionHeuristics.STATE_FALSE;}haveUnlookedFor=true;break;default:break;}}if(haveUnlookedFor){return this.mLookForRtl?TextDirectionHeuristics.STATE_FALSE:TextDirectionHeuristics.STATE_TRUE;}return TextDirectionHeuristics.STATE_UNKNOWN;}}]);return AnyStrong;}();AnyStrong.INSTANCE_RTL=new AnyStrong(true);AnyStrong.INSTANCE_LTR=new AnyStrong(false);TextDirectionHeuristics.AnyStrong=AnyStrong;var TextDirectionHeuristicLocale=function(_TextDirectionHeurist2){_inherits(TextDirectionHeuristicLocale,_TextDirectionHeurist2);function TextDirectionHeuristicLocale(){_classCallCheck(this,TextDirectionHeuristicLocale);return _possibleConstructorReturn(this,(TextDirectionHeuristicLocale.__proto__||Object.getPrototypeOf(TextDirectionHeuristicLocale)).call(this,null));}_createClass(TextDirectionHeuristicLocale,[{key:'defaultIsRtl',value:function defaultIsRtl(){return false;}}]);return TextDirectionHeuristicLocale;}(TextDirectionHeuristics.TextDirectionHeuristicImpl);TextDirectionHeuristicLocale.INSTANCE=new TextDirectionHeuristicLocale();TextDirectionHeuristics.TextDirectionHeuristicLocale=TextDirectionHeuristicLocale;})(TextDirectionHeuristics=text.TextDirectionHeuristics||(text.TextDirectionHeuristics={}));TextDirectionHeuristics.LTR=new TextDirectionHeuristics.TextDirectionHeuristicInternal(null,false);TextDirectionHeuristics.RTL=new TextDirectionHeuristics.TextDirectionHeuristicInternal(null,true);TextDirectionHeuristics.FIRSTSTRONG_LTR=new TextDirectionHeuristics.TextDirectionHeuristicInternal(TextDirectionHeuristics.FirstStrong.INSTANCE,false);TextDirectionHeuristics.FIRSTSTRONG_RTL=new TextDirectionHeuristics.TextDirectionHeuristicInternal(TextDirectionHeuristics.FirstStrong.INSTANCE,true);TextDirectionHeuristics.ANYRTL_LTR=new TextDirectionHeuristics.TextDirectionHeuristicInternal(TextDirectionHeuristics.AnyStrong.INSTANCE_RTL,false);TextDirectionHeuristics.LOCALE=TextDirectionHeuristics.TextDirectionHeuristicLocale.INSTANCE;})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text_4){var Canvas=android.graphics.Canvas;var Paint=android.graphics.Paint;var CharacterStyle=android.text.style.CharacterStyle;var MetricAffectingSpan=android.text.style.MetricAffectingSpan;var ReplacementSpan=android.text.style.ReplacementSpan;var Log=android.util.Log;var Spanned=android.text.Spanned;var SpanSet=android.text.SpanSet;var TextPaint=android.text.TextPaint;var TextUtils=android.text.TextUtils;var Layout=android.text.Layout;window.addEventListener('AndroidUILoadFinish',function(){eval('Layout = android.text.Layout;');});var TextLine=function(){function TextLine(){_classCallCheck(this,TextLine);this.mStart=0;this.mLen=0;this.mDir=0;this.mWorkPaint=new TextPaint();this.mMetricAffectingSpanSpanSet=new SpanSet(MetricAffectingSpan.type);this.mCharacterStyleSpanSet=new SpanSet(CharacterStyle.type);this.mReplacementSpanSpanSet=new SpanSet(ReplacementSpan.type);}_createClass(TextLine,[{key:'set',value:function set(paint,text,start,limit,dir,directions,hasTabs,tabStops){this.mPaint=paint;this.mText=text;this.mStart=start;this.mLen=limit-start;this.mDir=dir;this.mDirections=directions;if(this.mDirections==null){throw Error('new IllegalArgumentException(\"Directions cannot be null\")');}this.mHasTabs=hasTabs;this.mSpanned=null;var hasReplacement=false;if(Spanned.isImplements(text)){this.mSpanned=text;this.mReplacementSpanSpanSet.init(this.mSpanned,start,limit);hasReplacement=this.mReplacementSpanSpanSet.numberOfSpans>0;}this.mCharsValid=hasReplacement||hasTabs||directions!=Layout.DIRS_ALL_LEFT_TO_RIGHT;if(this.mCharsValid){this.mChars=text;if(hasReplacement){var chars=this.mChars.split('');for(var i=start,inext;i<limit;i=inext){inext=this.mReplacementSpanSpanSet.getNextTransition(i,limit);if(this.mReplacementSpanSpanSet.hasSpansIntersecting(i,inext)){chars[i-start]='￼';for(var j=i-start+1,e=inext-start;j<e;++j){chars[j]='﻿';}}}this.mChars=chars.join('');}}this.mTabs=tabStops;}},{key:'draw',value:function draw(c,x,top,y,bottom){if(!this.mHasTabs){if(this.mDirections==Layout.DIRS_ALL_LEFT_TO_RIGHT){this.drawRun(c,0,this.mLen,false,x,top,y,bottom,false);return;}if(this.mDirections==Layout.DIRS_ALL_RIGHT_TO_LEFT){this.drawRun(c,0,this.mLen,true,x,top,y,bottom,false);return;}}var h=0;var runs=this.mDirections.mDirections;var emojiRect=null;var lastRunIndex=runs.length-2;for(var i=0;i<runs.length;i+=2){var runStart=runs[i];var runLimit=runStart+(runs[i+1]&Layout.RUN_LENGTH_MASK);if(runLimit>this.mLen){runLimit=this.mLen;}var runIsRtl=(runs[i+1]&Layout.RUN_RTL_FLAG)!=0;var segstart=runStart;for(var j=this.mHasTabs?runStart:runLimit;j<=runLimit;j++){var codept=0;if(this.mHasTabs&&j<runLimit){codept=this.mChars.codePointAt(j);if(codept>=0xd800&&codept<0xdc00&&j+1<runLimit){codept=this.mChars.codePointAt(j);if(codept>0xffff){++j;continue;}}}if(j==runLimit||codept=='\\t'.codePointAt(0)){h+=this.drawRun(c,segstart,j,runIsRtl,x+h,top,y,bottom,i!=lastRunIndex||j!=this.mLen);if(codept=='\\t'.codePointAt(0)){h=this.mDir*this.nextTab(h*this.mDir);}segstart=j+1;}}}}},{key:'metrics',value:function metrics(fmi){return this.measure(this.mLen,false,fmi);}},{key:'measure',value:function measure(offset,trailing,fmi){var target=trailing?offset-1:offset;if(target<0){return 0;}var h=0;if(!this.mHasTabs){if(this.mDirections==Layout.DIRS_ALL_LEFT_TO_RIGHT){return this.measureRun(0,offset,this.mLen,false,fmi);}if(this.mDirections==Layout.DIRS_ALL_RIGHT_TO_LEFT){return this.measureRun(0,offset,this.mLen,true,fmi);}}var chars=this.mChars;var runs=this.mDirections.mDirections;for(var i=0;i<runs.length;i+=2){var runStart=runs[i];var runLimit=runStart+(runs[i+1]&Layout.RUN_LENGTH_MASK);if(runLimit>this.mLen){runLimit=this.mLen;}var runIsRtl=(runs[i+1]&Layout.RUN_RTL_FLAG)!=0;var segstart=runStart;for(var j=this.mHasTabs?runStart:runLimit;j<=runLimit;j++){var codept=0;if(this.mHasTabs&&j<runLimit){codept=chars.codePointAt(j);if(codept>=0xd800&&codept<0xdc00&&j+1<runLimit){codept=chars.codePointAt(j);if(codept>0xffff){++j;continue;}}}if(j==runLimit||codept=='\\t'.codePointAt(0)){var inSegment=target>=segstart&&target<j;var advance=this.mDir==Layout.DIR_RIGHT_TO_LEFT==runIsRtl;if(inSegment&&advance){return h+=this.measureRun(segstart,offset,j,runIsRtl,fmi);}var w=this.measureRun(segstart,j,j,runIsRtl,fmi);h+=advance?w:-w;if(inSegment){return h+=this.measureRun(segstart,offset,j,runIsRtl,null);}if(codept=='\\t'.codePointAt(0)){if(offset==j){return h;}h=this.mDir*this.nextTab(h*this.mDir);if(target==j){return h;}}segstart=j+1;}}}return h;}},{key:'drawRun',value:function drawRun(c,start,limit,runIsRtl,x,top,y,bottom,needWidth){if(this.mDir==Layout.DIR_LEFT_TO_RIGHT==runIsRtl){var w=-this.measureRun(start,limit,limit,runIsRtl,null);this.handleRun(start,limit,limit,runIsRtl,c,x+w,top,y,bottom,null,false);return w;}return this.handleRun(start,limit,limit,runIsRtl,c,x,top,y,bottom,null,needWidth);}},{key:'measureRun',value:function measureRun(start,offset,limit,runIsRtl,fmi){return this.handleRun(start,offset,limit,runIsRtl,null,0,0,0,0,fmi,true);}},{key:'getOffsetToLeftRightOf',value:function getOffsetToLeftRightOf(cursor,toLeft){var lineStart=0;var lineEnd=this.mLen;var paraIsRtl=this.mDir==-1;var runs=this.mDirections.mDirections;var runIndex=void 0,runLevel=0,runStart=lineStart,runLimit=lineEnd,newCaret=-1;var trailing=false;if(cursor==lineStart){runIndex=-2;}else if(cursor==lineEnd){runIndex=runs.length;}else{for(runIndex=0;runIndex<runs.length;runIndex+=2){runStart=lineStart+runs[runIndex];if(cursor>=runStart){runLimit=runStart+(runs[runIndex+1]&Layout.RUN_LENGTH_MASK);if(runLimit>lineEnd){runLimit=lineEnd;}if(cursor<runLimit){runLevel=runs[runIndex+1]>>>Layout.RUN_LEVEL_SHIFT&Layout.RUN_LEVEL_MASK;if(cursor==runStart){var prevRunIndex=void 0,prevRunLevel=void 0,prevRunStart=void 0,prevRunLimit=void 0;var pos=cursor-1;for(prevRunIndex=0;prevRunIndex<runs.length;prevRunIndex+=2){prevRunStart=lineStart+runs[prevRunIndex];if(pos>=prevRunStart){prevRunLimit=prevRunStart+(runs[prevRunIndex+1]&Layout.RUN_LENGTH_MASK);if(prevRunLimit>lineEnd){prevRunLimit=lineEnd;}if(pos<prevRunLimit){prevRunLevel=runs[prevRunIndex+1]>>>Layout.RUN_LEVEL_SHIFT&Layout.RUN_LEVEL_MASK;if(prevRunLevel<runLevel){runIndex=prevRunIndex;runLevel=prevRunLevel;runStart=prevRunStart;runLimit=prevRunLimit;trailing=true;break;}}}}}break;}}}if(runIndex!=runs.length){var runIsRtl=(runLevel&0x1)!=0;var advance=toLeft==runIsRtl;if(cursor!=(advance?runLimit:runStart)||advance!=trailing){newCaret=this.getOffsetBeforeAfter(runIndex,runStart,runLimit,runIsRtl,cursor,advance);if(newCaret!=(advance?runLimit:runStart)){return newCaret;}}}}while(true){var _advance=toLeft==paraIsRtl;var otherRunIndex=runIndex+(_advance?2:-2);if(otherRunIndex>=0&&otherRunIndex<runs.length){var otherRunStart=lineStart+runs[otherRunIndex];var otherRunLimit=otherRunStart+(runs[otherRunIndex+1]&Layout.RUN_LENGTH_MASK);if(otherRunLimit>lineEnd){otherRunLimit=lineEnd;}var otherRunLevel=runs[otherRunIndex+1]>>>Layout.RUN_LEVEL_SHIFT&Layout.RUN_LEVEL_MASK;var otherRunIsRtl=(otherRunLevel&1)!=0;_advance=toLeft==otherRunIsRtl;if(newCaret==-1){newCaret=this.getOffsetBeforeAfter(otherRunIndex,otherRunStart,otherRunLimit,otherRunIsRtl,_advance?otherRunStart:otherRunLimit,_advance);if(newCaret==(_advance?otherRunLimit:otherRunStart)){runIndex=otherRunIndex;runLevel=otherRunLevel;continue;}break;}if(otherRunLevel<runLevel){newCaret=_advance?otherRunStart:otherRunLimit;}break;}if(newCaret==-1){newCaret=_advance?this.mLen+1:-1;break;}if(newCaret<=lineEnd){newCaret=_advance?lineEnd:lineStart;}break;}return newCaret;}},{key:'getOffsetBeforeAfter',value:function getOffsetBeforeAfter(runIndex,runStart,runLimit,runIsRtl,offset,after){if(runIndex<0||offset==(after?this.mLen:0)){if(after){return TextUtils.getOffsetAfter(this.mText,offset+this.mStart)-this.mStart;}return TextUtils.getOffsetBefore(this.mText,offset+this.mStart)-this.mStart;}var wp=this.mWorkPaint;wp.set(this.mPaint);var spanStart=runStart;var spanLimit=void 0;if(this.mSpanned==null){spanLimit=runLimit;}else{var target=after?offset+1:offset;var limit=this.mStart+runLimit;while(true){spanLimit=this.mSpanned.nextSpanTransition(this.mStart+spanStart,limit,MetricAffectingSpan.type)-this.mStart;if(spanLimit>=target){break;}spanStart=spanLimit;}var spans=this.mSpanned.getSpans(this.mStart+spanStart,this.mStart+spanLimit,MetricAffectingSpan.type);spans=TextUtils.removeEmptySpans(spans,this.mSpanned,MetricAffectingSpan.type);if(spans.length>0){var replacement=null;for(var j=0;j<spans.length;j++){var span=spans[j];if(span instanceof ReplacementSpan){replacement=span;}else{span.updateMeasureState(wp);}}if(replacement!=null){return after?spanLimit:spanStart;}}}var flags=runIsRtl?Paint.DIRECTION_RTL:Paint.DIRECTION_LTR;var cursorOpt=after?Paint.CURSOR_AFTER:Paint.CURSOR_BEFORE;if(this.mCharsValid){return wp.getTextRunCursor_len(this.mChars.toString(),spanStart,spanLimit-spanStart,flags,offset,cursorOpt);}else{return wp.getTextRunCursor_end(this.mText.toString(),this.mStart+spanStart,this.mStart+spanLimit,flags,this.mStart+offset,cursorOpt)-this.mStart;}}},{key:'handleText',value:function handleText(wp,start,end,contextStart,contextEnd,runIsRtl,c,x,top,y,bottom,fmi,needWidth){if(fmi!=null){TextLine.expandMetricsFromPaint(fmi,wp);}var runLen=end-start;if(runLen==0){return 0;}var ret=0;var contextLen=contextEnd-contextStart;if(needWidth||c!=null&&(wp.bgColor!=0||wp.underlineColor!=0||runIsRtl)){var flags=runIsRtl?Paint.DIRECTION_RTL:Paint.DIRECTION_LTR;if(this.mCharsValid){ret=wp.getTextRunAdvances_count(this.mChars.toString(),start,runLen,contextStart,contextLen,flags,null,0);}else{var delta=this.mStart;ret=wp.getTextRunAdvances_end(this.mText.toString(),delta+start,delta+end,delta+contextStart,delta+contextEnd,flags,null,0);}}if(c!=null){if(runIsRtl){x-=ret;}if(wp.bgColor!=0){var previousColor=wp.getColor();var previousStyle=wp.getStyle();wp.setColor(wp.bgColor);wp.setStyle(Paint.Style.FILL);c.drawRect(x,top,x+ret,bottom,wp);wp.setStyle(previousStyle);wp.setColor(previousColor);}if(wp.underlineColor!=0){var underlineTop=y+wp.baselineShift+1.0/9.0*wp.getTextSize();var _previousColor=wp.getColor();var _previousStyle=wp.getStyle();var previousAntiAlias=wp.isAntiAlias();wp.setStyle(Paint.Style.FILL);wp.setAntiAlias(true);wp.setColor(wp.underlineColor);c.drawRect(x,underlineTop,x+ret,underlineTop+wp.underlineThickness,wp);wp.setStyle(_previousStyle);wp.setColor(_previousColor);wp.setAntiAlias(previousAntiAlias);}this.drawTextRun(c,wp,start,end,contextStart,contextEnd,runIsRtl,x,y+wp.baselineShift);}return runIsRtl?-ret:ret;}},{key:'handleReplacement',value:function handleReplacement(replacement,wp,start,limit,runIsRtl,c,x,top,y,bottom,fmi,needWidth){var ret=0;var textStart=this.mStart+start;var textLimit=this.mStart+limit;if(needWidth||c!=null&&runIsRtl){var previousTop=0;var previousAscent=0;var previousDescent=0;var previousBottom=0;var previousLeading=0;var needUpdateMetrics=fmi!=null;if(needUpdateMetrics){previousTop=fmi.top;previousAscent=fmi.ascent;previousDescent=fmi.descent;previousBottom=fmi.bottom;previousLeading=fmi.leading;}ret=replacement.getSize(wp,this.mText,textStart,textLimit,fmi);if(needUpdateMetrics){TextLine.updateMetrics(fmi,previousTop,previousAscent,previousDescent,previousBottom,previousLeading);}}if(c!=null){if(runIsRtl){x-=ret;}replacement.draw(c,this.mText,textStart,textLimit,x,top,y,bottom,wp);}return runIsRtl?-ret:ret;}},{key:'handleRun',value:function handleRun(start,measureLimit,limit,runIsRtl,c,x,top,y,bottom,fmi,needWidth){if(start==measureLimit){var wp=this.mWorkPaint;wp.set(this.mPaint);if(fmi!=null){TextLine.expandMetricsFromPaint(fmi,wp);}return 0;}if(this.mSpanned==null){var _wp=this.mWorkPaint;_wp.set(this.mPaint);var mlimit=measureLimit;return this.handleText(_wp,start,mlimit,start,limit,runIsRtl,c,x,top,y,bottom,fmi,needWidth||mlimit<measureLimit);}this.mMetricAffectingSpanSpanSet.init(this.mSpanned,this.mStart+start,this.mStart+limit);this.mCharacterStyleSpanSet.init(this.mSpanned,this.mStart+start,this.mStart+limit);var originalX=x;for(var i=start,inext;i<measureLimit;i=inext){var _wp2=this.mWorkPaint;_wp2.set(this.mPaint);inext=this.mMetricAffectingSpanSpanSet.getNextTransition(this.mStart+i,this.mStart+limit)-this.mStart;var _mlimit=Math.min(inext,measureLimit);var replacement=null;for(var j=0;j<this.mMetricAffectingSpanSpanSet.numberOfSpans;j++){if(this.mMetricAffectingSpanSpanSet.spanStarts[j]>=this.mStart+_mlimit||this.mMetricAffectingSpanSpanSet.spanEnds[j]<=this.mStart+i)continue;var span=this.mMetricAffectingSpanSpanSet.spans[j];if(span instanceof ReplacementSpan){replacement=span;}else{span.updateDrawState(_wp2);}}if(replacement!=null){x+=this.handleReplacement(replacement,_wp2,i,_mlimit,runIsRtl,c,x,top,y,bottom,fmi,needWidth||_mlimit<measureLimit);continue;}for(var _j=i,jnext;_j<_mlimit;_j=jnext){jnext=this.mCharacterStyleSpanSet.getNextTransition(this.mStart+_j,this.mStart+_mlimit)-this.mStart;_wp2.set(this.mPaint);for(var k=0;k<this.mCharacterStyleSpanSet.numberOfSpans;k++){if(this.mCharacterStyleSpanSet.spanStarts[k]>=this.mStart+jnext||this.mCharacterStyleSpanSet.spanEnds[k]<=this.mStart+_j)continue;var _span=this.mCharacterStyleSpanSet.spans[k];_span.updateDrawState(_wp2);}x+=this.handleText(_wp2,_j,jnext,i,inext,runIsRtl,c,x,top,y,bottom,fmi,needWidth||jnext<measureLimit);}}return x-originalX;}},{key:'drawTextRun',value:function drawTextRun(c,wp,start,end,contextStart,contextEnd,runIsRtl,x,y){var flags=runIsRtl?Canvas.DIRECTION_RTL:Canvas.DIRECTION_LTR;if(this.mCharsValid){var count=end-start;var contextCount=contextEnd-contextStart;c.drawTextRun_count(this.mChars.toString(),start,count,contextStart,contextCount,x,y,flags,wp);}else{var delta=this.mStart;c.drawTextRun_end(this.mText.toString(),delta+start,delta+end,delta+contextStart,delta+contextEnd,x,y,flags,wp);}}},{key:'ascent',value:function ascent(pos){if(this.mSpanned==null){return this.mPaint.ascent();}pos+=this.mStart;var spans=this.mSpanned.getSpans(pos,pos+1,MetricAffectingSpan.type);if(spans.length==0){return this.mPaint.ascent();}var wp=this.mWorkPaint;wp.set(this.mPaint);var _iteratorNormalCompletion47=true;var _didIteratorError47=false;var _iteratorError47=undefined;try{for(var _iterator47=spans[Symbol.iterator](),_step47;!(_iteratorNormalCompletion47=(_step47=_iterator47.next()).done);_iteratorNormalCompletion47=true){var span=_step47.value;span.updateMeasureState(wp);}}catch(err){_didIteratorError47=true;_iteratorError47=err;}finally{try{if(!_iteratorNormalCompletion47&&_iterator47.return){_iterator47.return();}}finally{if(_didIteratorError47){throw _iteratorError47;}}}return wp.ascent();}},{key:'nextTab',value:function nextTab(h){if(this.mTabs!=null){return this.mTabs.nextTab(h);}return Layout.TabStops.nextDefaultStop(h,TextLine.TAB_INCREMENT);}}],[{key:'obtain',value:function obtain(){var tl=void 0;{for(var i=TextLine.sCached.length;--i>=0;){if(TextLine.sCached[i]!=null){tl=TextLine.sCached[i];TextLine.sCached[i]=null;return tl;}}}tl=new TextLine();if(TextLine.DEBUG){Log.v(\"TLINE\",\"new: \"+tl);}return tl;}},{key:'recycle',value:function recycle(tl){tl.mText=null;tl.mPaint=null;tl.mDirections=null;tl.mMetricAffectingSpanSpanSet.recycle();tl.mCharacterStyleSpanSet.recycle();tl.mReplacementSpanSpanSet.recycle();{for(var i=0;i<TextLine.sCached.length;++i){if(TextLine.sCached[i]==null){TextLine.sCached[i]=tl;break;}}}return null;}},{key:'expandMetricsFromPaint',value:function expandMetricsFromPaint(fmi,wp){var previousTop=fmi.top;var previousAscent=fmi.ascent;var previousDescent=fmi.descent;var previousBottom=fmi.bottom;var previousLeading=fmi.leading;wp.getFontMetricsInt(fmi);TextLine.updateMetrics(fmi,previousTop,previousAscent,previousDescent,previousBottom,previousLeading);}},{key:'updateMetrics',value:function updateMetrics(fmi,previousTop,previousAscent,previousDescent,previousBottom,previousLeading){fmi.top=Math.min(fmi.top,previousTop);fmi.ascent=Math.min(fmi.ascent,previousAscent);fmi.descent=Math.max(fmi.descent,previousDescent);fmi.bottom=Math.max(fmi.bottom,previousBottom);fmi.leading=Math.max(fmi.leading,previousLeading);}}]);return TextLine;}();TextLine.DEBUG=false;TextLine.sCached=new Array(3);TextLine.TAB_INCREMENT=20;text_4.TextLine=TextLine;})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text_5){var Rect=android.graphics.Rect;var LeadingMarginSpan=android.text.style.LeadingMarginSpan;var LeadingMarginSpan2=android.text.style.LeadingMarginSpan.LeadingMarginSpan2;var LineBackgroundSpan=android.text.style.LineBackgroundSpan;var ParagraphStyle=android.text.style.ParagraphStyle;var ReplacementSpan=android.text.style.ReplacementSpan;var TabStopSpan=android.text.style.TabStopSpan;var Arrays=java.util.Arrays;var Float=java.lang.Float;var System=java.lang.System;var MeasuredText=android.text.MeasuredText;var Spanned=android.text.Spanned;var SpanSet=android.text.SpanSet;var TextDirectionHeuristics=android.text.TextDirectionHeuristics;var TextLine=android.text.TextLine;var TextPaint=android.text.TextPaint;var TextUtils=android.text.TextUtils;window.addEventListener('AndroidUILoadFinish',function(){eval('TextUtils = android.text.TextUtils;\\n              MeasuredText = android.text.MeasuredText;\\n              ');});var Layout=function(){function Layout(text,paint,width,align){var textDir=arguments.length>4&&arguments[4]!==undefined?arguments[4]:TextDirectionHeuristics.FIRSTSTRONG_LTR;var spacingMult=arguments.length>5&&arguments[5]!==undefined?arguments[5]:1;var spacingAdd=arguments.length>6&&arguments[6]!==undefined?arguments[6]:0;_classCallCheck(this,Layout);this.mWidth=0;this.mAlignment=Layout.Alignment.ALIGN_NORMAL;this.mSpacingMult=0;this.mSpacingAdd=0;if(width<0)throw Error('new IllegalArgumentException(\"Layout: \" + width + \" < 0\")');if(paint!=null){paint.bgColor=0;paint.baselineShift=0;}this.mText=text;this.mPaint=paint;this.mWorkPaint=new TextPaint();this.mWidth=width;this.mAlignment=align;this.mSpacingMult=spacingMult;this.mSpacingAdd=spacingAdd;this.mSpannedText=Spanned.isImplements(text);this.mTextDir=textDir;}_createClass(Layout,[{key:'replaceWith',value:function replaceWith(text,paint,width,align,spacingmult,spacingadd){if(width<0){throw Error('new IllegalArgumentException(\"Layout: \" + width + \" < 0\")');}this.mText=text;this.mPaint=paint;this.mWidth=width;this.mAlignment=align;this.mSpacingMult=spacingmult;this.mSpacingAdd=spacingadd;this.mSpannedText=Spanned.isImplements(text);}},{key:'draw',value:function draw(canvas){var highlight=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var highlightPaint=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var cursorOffsetVertical=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var lineRange=this.getLineRangeForDraw(canvas);var firstLine=TextUtils.unpackRangeStartFromLong(lineRange);var lastLine=TextUtils.unpackRangeEndFromLong(lineRange);if(lastLine<0)return;this.drawBackground(canvas,highlight,highlightPaint,cursorOffsetVertical,firstLine,lastLine);this.drawText(canvas,firstLine,lastLine);}},{key:'drawText',value:function drawText(canvas,firstLine,lastLine){var previousLineBottom=this.getLineTop(firstLine);var previousLineEnd=this.getLineStart(firstLine);var spans=Layout.NO_PARA_SPANS;var spanEnd=0;var paint=this.mPaint;var buf=this.mText;var paraAlign=this.mAlignment;var tabStops=null;var tabStopsIsInitialized=false;var tl=TextLine.obtain();for(var i=firstLine;i<=lastLine;i++){var start=previousLineEnd;previousLineEnd=this.getLineStart(i+1);var end=this.getLineVisibleEnd(i,start,previousLineEnd);var ltop=previousLineBottom;var lbottom=this.getLineTop(i+1);previousLineBottom=lbottom;var lbaseline=lbottom-this.getLineDescent(i);var dir=this.getParagraphDirection(i);var left=0;var right=this.mWidth;if(this.mSpannedText){var sp=buf;var textLength=buf.length;var isFirstParaLine=start==0||buf.charAt(start-1)=='\\n';if(start>=spanEnd&&(i==firstLine||isFirstParaLine)){spanEnd=sp.nextSpanTransition(start,textLength,ParagraphStyle.type);spans=Layout.getParagraphSpans(sp,start,spanEnd,ParagraphStyle.type);paraAlign=this.mAlignment;tabStopsIsInitialized=false;}var length=spans.length;for(var n=0;n<length;n++){if(LeadingMarginSpan.isImpl(spans[n])){var margin=spans[n];var useFirstLineMargin=isFirstParaLine;if(LeadingMarginSpan2.isImpl(margin)){var count=margin.getLeadingMarginLineCount();var startLine=this.getLineForOffset(sp.getSpanStart(margin));useFirstLineMargin=i<startLine+count;}if(dir==Layout.DIR_RIGHT_TO_LEFT){margin.drawLeadingMargin(canvas,paint,right,dir,ltop,lbaseline,lbottom,buf,start,end,isFirstParaLine,this);right-=margin.getLeadingMargin(useFirstLineMargin);}else{margin.drawLeadingMargin(canvas,paint,left,dir,ltop,lbaseline,lbottom,buf,start,end,isFirstParaLine,this);left+=margin.getLeadingMargin(useFirstLineMargin);}}}}var hasTabOrEmoji=this.getLineContainsTab(i);if(hasTabOrEmoji&&!tabStopsIsInitialized){if(tabStops==null){tabStops=new Layout.TabStops(Layout.TAB_INCREMENT,spans);}else{tabStops.reset(Layout.TAB_INCREMENT,spans);}tabStopsIsInitialized=true;}var align=paraAlign;if(align==Layout.Alignment.ALIGN_LEFT){align=dir==Layout.DIR_LEFT_TO_RIGHT?Layout.Alignment.ALIGN_NORMAL:Layout.Alignment.ALIGN_OPPOSITE;}else if(align==Layout.Alignment.ALIGN_RIGHT){align=dir==Layout.DIR_LEFT_TO_RIGHT?Layout.Alignment.ALIGN_OPPOSITE:Layout.Alignment.ALIGN_NORMAL;}var _x108=void 0;if(align==Layout.Alignment.ALIGN_NORMAL){if(dir==Layout.DIR_LEFT_TO_RIGHT){_x108=left;}else{_x108=right;}}else{var max=Math.floor(this.getLineExtent(i,tabStops,false));if(align==Layout.Alignment.ALIGN_OPPOSITE){if(dir==Layout.DIR_LEFT_TO_RIGHT){_x108=right-max;}else{_x108=left-max;}}else{max=max&~1;_x108=right+left-max>>1;}}var directions=this.getLineDirections(i);if(directions==Layout.DIRS_ALL_LEFT_TO_RIGHT&&!this.mSpannedText&&!hasTabOrEmoji){canvas.drawText_end(buf.toString(),start,end,_x108,lbaseline,paint);}else{tl.set(paint,buf,start,end,dir,directions,hasTabOrEmoji,tabStops);tl.draw(canvas,_x108,ltop,lbaseline,lbottom);}}TextLine.recycle(tl);}},{key:'drawBackground',value:function drawBackground(canvas,highlight,highlightPaint,cursorOffsetVertical,firstLine,lastLine){if(this.mSpannedText){if(this.mLineBackgroundSpans==null){this.mLineBackgroundSpans=new SpanSet(LineBackgroundSpan.type);}var buffer=this.mText;var textLength=buffer.length;this.mLineBackgroundSpans.init(buffer,0,textLength);if(this.mLineBackgroundSpans.numberOfSpans>0){var previousLineBottom=this.getLineTop(firstLine);var previousLineEnd=this.getLineStart(firstLine);var spans=Layout.NO_PARA_SPANS;var spansLength=0;var paint=this.mPaint;var spanEnd=0;var width=this.mWidth;for(var i=firstLine;i<=lastLine;i++){var start=previousLineEnd;var end=this.getLineStart(i+1);previousLineEnd=end;var ltop=previousLineBottom;var lbottom=this.getLineTop(i+1);previousLineBottom=lbottom;var lbaseline=lbottom-this.getLineDescent(i);if(start>=spanEnd){spanEnd=this.mLineBackgroundSpans.getNextTransition(start,textLength);spansLength=0;if(start!=end||start==0){for(var j=0;j<this.mLineBackgroundSpans.numberOfSpans;j++){if(this.mLineBackgroundSpans.spanStarts[j]>=end||this.mLineBackgroundSpans.spanEnds[j]<=start)continue;if(spansLength==spans.length){var newSize=2*spansLength;var newSpans=new Array(newSize);System.arraycopy(spans,0,newSpans,0,spansLength);spans=newSpans;}spans[spansLength++]=this.mLineBackgroundSpans.spans[j];}}}for(var n=0;n<spansLength;n++){var lineBackgroundSpan=spans[n];lineBackgroundSpan.drawBackground(canvas,paint,0,width,ltop,lbaseline,lbottom,buffer,start,end,i);}}}this.mLineBackgroundSpans.recycle();}if(highlight!=null){if(cursorOffsetVertical!=0)canvas.translate(0,cursorOffsetVertical);canvas.drawPath(highlight,highlightPaint);if(cursorOffsetVertical!=0)canvas.translate(0,-cursorOffsetVertical);}}},{key:'getLineRangeForDraw',value:function getLineRangeForDraw(canvas){var dtop=void 0,dbottom=void 0;{if(!canvas.getClipBounds(Layout.sTempRect)){return TextUtils.packRangeInLong(0,-1);}dtop=Layout.sTempRect.top;dbottom=Layout.sTempRect.bottom;}var top=Math.max(dtop,0);var bottom=Math.min(this.getLineTop(this.getLineCount()),dbottom);if(top>=bottom)return TextUtils.packRangeInLong(0,-1);return TextUtils.packRangeInLong(this.getLineForVertical(top),this.getLineForVertical(bottom));}},{key:'getLineStartPos',value:function getLineStartPos(line,left,right){var align=this.getParagraphAlignment(line);var dir=this.getParagraphDirection(line);if(align==Layout.Alignment.ALIGN_LEFT){align=dir==Layout.DIR_LEFT_TO_RIGHT?Layout.Alignment.ALIGN_NORMAL:Layout.Alignment.ALIGN_OPPOSITE;}else if(align==Layout.Alignment.ALIGN_RIGHT){align=dir==Layout.DIR_LEFT_TO_RIGHT?Layout.Alignment.ALIGN_OPPOSITE:Layout.Alignment.ALIGN_NORMAL;}var x=void 0;if(align==Layout.Alignment.ALIGN_NORMAL){if(dir==Layout.DIR_LEFT_TO_RIGHT){x=left;}else{x=right;}}else{var tabStops=null;if(this.mSpannedText&&this.getLineContainsTab(line)){var spanned=this.mText;var start=this.getLineStart(line);var spanEnd=spanned.nextSpanTransition(start,spanned.length,TabStopSpan.type);var tabSpans=Layout.getParagraphSpans(spanned,start,spanEnd,TabStopSpan.type);if(tabSpans.length>0){tabStops=new Layout.TabStops(Layout.TAB_INCREMENT,tabSpans);}}var max=Math.floor(this.getLineExtent(line,tabStops,false));if(align==Layout.Alignment.ALIGN_OPPOSITE){if(dir==Layout.DIR_LEFT_TO_RIGHT){x=right-max;}else{x=left-max;}}else{max=max&~1;x=left+right-max>>1;}}return x;}},{key:'getText',value:function getText(){return this.mText;}},{key:'getPaint',value:function getPaint(){return this.mPaint;}},{key:'getWidth',value:function getWidth(){return this.mWidth;}},{key:'getEllipsizedWidth',value:function getEllipsizedWidth(){return this.mWidth;}},{key:'increaseWidthTo',value:function increaseWidthTo(wid){if(wid<this.mWidth){throw Error('new RuntimeException(\"attempted to reduce Layout width\")');}this.mWidth=wid;}},{key:'getHeight',value:function getHeight(){return this.getLineTop(this.getLineCount());}},{key:'getAlignment',value:function getAlignment(){return this.mAlignment;}},{key:'getSpacingMultiplier',value:function getSpacingMultiplier(){return this.mSpacingMult;}},{key:'getSpacingAdd',value:function getSpacingAdd(){return this.mSpacingAdd;}},{key:'getTextDirectionHeuristic',value:function getTextDirectionHeuristic(){return this.mTextDir;}},{key:'getLineBounds',value:function getLineBounds(line,bounds){if(bounds!=null){bounds.left=0;bounds.top=this.getLineTop(line);bounds.right=this.mWidth;bounds.bottom=this.getLineTop(line+1);}return this.getLineBaseline(line);}},{key:'isLevelBoundary',value:function isLevelBoundary(offset){var line=this.getLineForOffset(offset);var dirs=this.getLineDirections(line);if(dirs==Layout.DIRS_ALL_LEFT_TO_RIGHT||dirs==Layout.DIRS_ALL_RIGHT_TO_LEFT){return false;}var runs=dirs.mDirections;var lineStart=this.getLineStart(line);var lineEnd=this.getLineEnd(line);if(offset==lineStart||offset==lineEnd){var paraLevel=this.getParagraphDirection(line)==1?0:1;var runIndex=offset==lineStart?0:runs.length-2;return(runs[runIndex+1]>>>Layout.RUN_LEVEL_SHIFT&Layout.RUN_LEVEL_MASK)!=paraLevel;}offset-=lineStart;for(var i=0;i<runs.length;i+=2){if(offset==runs[i]){return true;}}return false;}},{key:'isRtlCharAt',value:function isRtlCharAt(offset){var line=this.getLineForOffset(offset);var dirs=this.getLineDirections(line);if(dirs==Layout.DIRS_ALL_LEFT_TO_RIGHT){return false;}if(dirs==Layout.DIRS_ALL_RIGHT_TO_LEFT){return true;}var runs=dirs.mDirections;var lineStart=this.getLineStart(line);for(var i=0;i<runs.length;i+=2){var start=lineStart+(runs[i]&Layout.RUN_LENGTH_MASK);if(offset>=start){var level=runs[i+1]>>>Layout.RUN_LEVEL_SHIFT&Layout.RUN_LEVEL_MASK;return(level&1)!=0;}}return false;}},{key:'primaryIsTrailingPrevious',value:function primaryIsTrailingPrevious(offset){var line=this.getLineForOffset(offset);var lineStart=this.getLineStart(line);var lineEnd=this.getLineEnd(line);var runs=this.getLineDirections(line).mDirections;var levelAt=-1;for(var i=0;i<runs.length;i+=2){var start=lineStart+runs[i];var limit=start+(runs[i+1]&Layout.RUN_LENGTH_MASK);if(limit>lineEnd){limit=lineEnd;}if(offset>=start&&offset<limit){if(offset>start){return false;}levelAt=runs[i+1]>>>Layout.RUN_LEVEL_SHIFT&Layout.RUN_LEVEL_MASK;break;}}if(levelAt==-1){levelAt=this.getParagraphDirection(line)==1?0:1;}var levelBefore=-1;if(offset==lineStart){levelBefore=this.getParagraphDirection(line)==1?0:1;}else{offset-=1;for(var _i15=0;_i15<runs.length;_i15+=2){var _start=lineStart+runs[_i15];var _limit=_start+(runs[_i15+1]&Layout.RUN_LENGTH_MASK);if(_limit>lineEnd){_limit=lineEnd;}if(offset>=_start&&offset<_limit){levelBefore=runs[_i15+1]>>>Layout.RUN_LEVEL_SHIFT&Layout.RUN_LEVEL_MASK;break;}}}return levelBefore<levelAt;}},{key:'getPrimaryHorizontal',value:function getPrimaryHorizontal(offset){var clamped=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var trailing=this.primaryIsTrailingPrevious(offset);return this.getHorizontal(offset,trailing,clamped);}},{key:'getSecondaryHorizontal',value:function getSecondaryHorizontal(offset){var clamped=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var trailing=this.primaryIsTrailingPrevious(offset);return this.getHorizontal(offset,!trailing,clamped);}},{key:'getHorizontal',value:function getHorizontal(offset,trailing,clamped){var line=this.getLineForOffset(offset);return this.getHorizontal_4(offset,trailing,line,clamped);}},{key:'getHorizontal_4',value:function getHorizontal_4(offset,trailing,line,clamped){var start=this.getLineStart(line);var end=this.getLineEnd(line);var dir=this.getParagraphDirection(line);var hasTabOrEmoji=this.getLineContainsTab(line);var directions=this.getLineDirections(line);var tabStops=null;if(hasTabOrEmoji&&Spanned.isImplements(this.mText)){var tabs=Layout.getParagraphSpans(this.mText,start,end,TabStopSpan.type);if(tabs.length>0){tabStops=new Layout.TabStops(Layout.TAB_INCREMENT,tabs);}}var tl=TextLine.obtain();tl.set(this.mPaint,this.mText,start,end,dir,directions,hasTabOrEmoji,tabStops);var wid=tl.measure(offset-start,trailing,null);TextLine.recycle(tl);if(clamped&&wid>this.mWidth){wid=this.mWidth;}var left=this.getParagraphLeft(line);var right=this.getParagraphRight(line);return this.getLineStartPos(line,left,right)+wid;}},{key:'getLineLeft',value:function getLineLeft(line){var dir=this.getParagraphDirection(line);var align=this.getParagraphAlignment(line);if(align==Layout.Alignment.ALIGN_LEFT){return 0;}else if(align==Layout.Alignment.ALIGN_NORMAL){if(dir==Layout.DIR_RIGHT_TO_LEFT)return this.getParagraphRight(line)-this.getLineMax(line);else return 0;}else if(align==Layout.Alignment.ALIGN_RIGHT){return this.mWidth-this.getLineMax(line);}else if(align==Layout.Alignment.ALIGN_OPPOSITE){if(dir==Layout.DIR_RIGHT_TO_LEFT)return 0;else return this.mWidth-this.getLineMax(line);}else{var left=this.getParagraphLeft(line);var right=this.getParagraphRight(line);var max=Math.floor(this.getLineMax(line))&~1;return left+(right-left-max)/2;}}},{key:'getLineRight',value:function getLineRight(line){var dir=this.getParagraphDirection(line);var align=this.getParagraphAlignment(line);if(align==Layout.Alignment.ALIGN_LEFT){return this.getParagraphLeft(line)+this.getLineMax(line);}else if(align==Layout.Alignment.ALIGN_NORMAL){if(dir==Layout.DIR_RIGHT_TO_LEFT)return this.mWidth;else return this.getParagraphLeft(line)+this.getLineMax(line);}else if(align==Layout.Alignment.ALIGN_RIGHT){return this.mWidth;}else if(align==Layout.Alignment.ALIGN_OPPOSITE){if(dir==Layout.DIR_RIGHT_TO_LEFT)return this.getLineMax(line);else return this.mWidth;}else{var left=this.getParagraphLeft(line);var right=this.getParagraphRight(line);var max=Math.floor(this.getLineMax(line))&~1;return right-(right-left-max)/2;}}},{key:'getLineMax',value:function getLineMax(line){var margin=this.getParagraphLeadingMargin(line);var signedExtent=this.getLineExtent(line,false);return margin+signedExtent>=0?signedExtent:-signedExtent;}},{key:'getLineWidth',value:function getLineWidth(line){var margin=this.getParagraphLeadingMargin(line);var signedExtent=this.getLineExtent(line,true);return margin+signedExtent>=0?signedExtent:-signedExtent;}},{key:'getLineExtent',value:function getLineExtent(){if(arguments.length===2)return this.getLineExtent_2.apply(this,arguments);if(arguments.length===3)return this.getLineExtent_3.apply(this,arguments);}},{key:'getLineExtent_2',value:function getLineExtent_2(line,full){var start=this.getLineStart(line);var end=full?this.getLineEnd(line):this.getLineVisibleEnd(line);var hasTabsOrEmoji=this.getLineContainsTab(line);var tabStops=null;if(hasTabsOrEmoji&&Spanned.isImplements(this.mText)){var tabs=Layout.getParagraphSpans(this.mText,start,end,TabStopSpan.type);if(tabs.length>0){tabStops=new Layout.TabStops(Layout.TAB_INCREMENT,tabs);}}var directions=this.getLineDirections(line);if(directions==null){return 0;}var dir=this.getParagraphDirection(line);var tl=TextLine.obtain();tl.set(this.mPaint,this.mText,start,end,dir,directions,hasTabsOrEmoji,tabStops);var width=tl.metrics(null);TextLine.recycle(tl);return width;}},{key:'getLineExtent_3',value:function getLineExtent_3(line,tabStops,full){var start=this.getLineStart(line);var end=full?this.getLineEnd(line):this.getLineVisibleEnd(line);var hasTabsOrEmoji=this.getLineContainsTab(line);var directions=this.getLineDirections(line);var dir=this.getParagraphDirection(line);var tl=TextLine.obtain();tl.set(this.mPaint,this.mText,start,end,dir,directions,hasTabsOrEmoji,tabStops);var width=tl.metrics(null);TextLine.recycle(tl);return width;}},{key:'getLineForVertical',value:function getLineForVertical(vertical){var high=this.getLineCount(),low=-1,guess=void 0;while(high-low>1){guess=Math.floor((high+low)/2);if(this.getLineTop(guess)>vertical)high=guess;else low=guess;}if(low<0)return 0;else return low;}},{key:'getLineForOffset',value:function getLineForOffset(offset){var high=this.getLineCount(),low=-1,guess=void 0;while(high-low>1){guess=Math.floor((high+low)/2);if(this.getLineStart(guess)>offset)high=guess;else low=guess;}if(low<0)return 0;else return low;}},{key:'getOffsetForHorizontal',value:function getOffsetForHorizontal(line,horiz){var max=this.getLineEnd(line)-1;var min=this.getLineStart(line);var dirs=this.getLineDirections(line);if(line==this.getLineCount()-1)max++;var best=min;var bestdist=Math.abs(this.getPrimaryHorizontal(best)-horiz);for(var i=0;i<dirs.mDirections.length;i+=2){var here=min+dirs.mDirections[i];var there=here+(dirs.mDirections[i+1]&Layout.RUN_LENGTH_MASK);var swap=(dirs.mDirections[i+1]&Layout.RUN_RTL_FLAG)!=0?-1:1;if(there>max)there=max;var high=there-1+1,low=here+1-1,guess=void 0;while(high-low>1){guess=Math.floor((high+low)/2);var adguess=this.getOffsetAtStartOf(guess);if(this.getPrimaryHorizontal(adguess)*swap>=horiz*swap)high=guess;else low=guess;}if(low<here+1)low=here+1;if(low<there){low=this.getOffsetAtStartOf(low);var _dist2=Math.abs(this.getPrimaryHorizontal(low)-horiz);var aft=TextUtils.getOffsetAfter(this.mText,low);if(aft<there){var other=Math.abs(this.getPrimaryHorizontal(aft)-horiz);if(other<_dist2){_dist2=other;low=aft;}}if(_dist2<bestdist){bestdist=_dist2;best=low;}}var _dist=Math.abs(this.getPrimaryHorizontal(here)-horiz);if(_dist<bestdist){bestdist=_dist;best=here;}}var dist=Math.abs(this.getPrimaryHorizontal(max)-horiz);if(dist<=bestdist){bestdist=dist;best=max;}return best;}},{key:'getLineEnd',value:function getLineEnd(line){return this.getLineStart(line+1);}},{key:'getLineVisibleEnd',value:function getLineVisibleEnd(line){var start=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.getLineStart(line);var end=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.getLineStart(line+1);var text=this.mText;var ch=void 0;if(line==this.getLineCount()-1){return end;}for(;end>start;end--){ch=text.charAt(end-1);if(ch=='\\n'){return end-1;}if(ch!=' '&&ch!='\\t'){break;}}return end;}},{key:'getLineBottom',value:function getLineBottom(line){return this.getLineTop(line+1);}},{key:'getLineBaseline',value:function getLineBaseline(line){return this.getLineTop(line+1)-this.getLineDescent(line);}},{key:'getLineAscent',value:function getLineAscent(line){return this.getLineTop(line)-(this.getLineTop(line+1)-this.getLineDescent(line));}},{key:'getOffsetToLeftOf',value:function getOffsetToLeftOf(offset){return this.getOffsetToLeftRightOf(offset,true);}},{key:'getOffsetToRightOf',value:function getOffsetToRightOf(offset){return this.getOffsetToLeftRightOf(offset,false);}},{key:'getOffsetToLeftRightOf',value:function getOffsetToLeftRightOf(caret,toLeft){var line=this.getLineForOffset(caret);var lineStart=this.getLineStart(line);var lineEnd=this.getLineEnd(line);var lineDir=this.getParagraphDirection(line);var lineChanged=false;var advance=toLeft==(lineDir==Layout.DIR_RIGHT_TO_LEFT);if(advance){if(caret==lineEnd){if(line<this.getLineCount()-1){lineChanged=true;++line;}else{return caret;}}}else{if(caret==lineStart){if(line>0){lineChanged=true;--line;}else{return caret;}}}if(lineChanged){lineStart=this.getLineStart(line);lineEnd=this.getLineEnd(line);var newDir=this.getParagraphDirection(line);if(newDir!=lineDir){toLeft=!toLeft;lineDir=newDir;}}var directions=this.getLineDirections(line);var tl=TextLine.obtain();tl.set(this.mPaint,this.mText,lineStart,lineEnd,lineDir,directions,false,null);caret=lineStart+tl.getOffsetToLeftRightOf(caret-lineStart,toLeft);tl=TextLine.recycle(tl);return caret;}},{key:'getOffsetAtStartOf',value:function getOffsetAtStartOf(offset){if(offset==0)return 0;var text=this.mText;var c=text.codePointAt(offset);var questionMark='?'.codePointAt(0);if(c>=questionMark&&c<=questionMark){var c1=text.codePointAt(offset-1);if(c1>=questionMark&&c1<=questionMark)offset-=1;}if(this.mSpannedText){var spans=text.getSpans(offset,offset,ReplacementSpan.type);for(var i=0;i<spans.length;i++){var start=text.getSpanStart(spans[i]);var end=text.getSpanEnd(spans[i]);if(start<offset&&end>offset)offset=start;}}return offset;}},{key:'shouldClampCursor',value:function shouldClampCursor(line){switch(this.getParagraphAlignment(line)){case Layout.Alignment.ALIGN_LEFT:return true;case Layout.Alignment.ALIGN_NORMAL:return this.getParagraphDirection(line)>0;default:return false;}}},{key:'getCursorPath',value:function getCursorPath(point,dest,editingBuffer){dest.reset();}},{key:'addSelection',value:function addSelection(line,start,end,top,bottom,dest){}},{key:'getSelectionPath',value:function getSelectionPath(start,end,dest){dest.reset();}},{key:'getParagraphAlignment',value:function getParagraphAlignment(line){var align=this.mAlignment;return align;}},{key:'getParagraphLeft',value:function getParagraphLeft(line){var left=0;var dir=this.getParagraphDirection(line);if(dir==Layout.DIR_RIGHT_TO_LEFT||!this.mSpannedText){return left;}return this.getParagraphLeadingMargin(line);}},{key:'getParagraphRight',value:function getParagraphRight(line){var right=this.mWidth;var dir=this.getParagraphDirection(line);if(dir==Layout.DIR_LEFT_TO_RIGHT||!this.mSpannedText){return right;}return right-this.getParagraphLeadingMargin(line);}},{key:'getParagraphLeadingMargin',value:function getParagraphLeadingMargin(line){if(!this.mSpannedText){return 0;}var spanned=this.mText;var lineStart=this.getLineStart(line);var lineEnd=this.getLineEnd(line);var spanEnd=spanned.nextSpanTransition(lineStart,lineEnd,LeadingMarginSpan.type);var spans=Layout.getParagraphSpans(spanned,lineStart,spanEnd,LeadingMarginSpan.type);if(spans.length==0){return 0;}var margin=0;var isFirstParaLine=lineStart==0||spanned.charAt(lineStart-1)=='\\n';for(var i=0;i<spans.length;i++){var span=spans[i];var useFirstLineMargin=isFirstParaLine;if(LeadingMarginSpan2.isImpl(span)){var spStart=spanned.getSpanStart(span);var spanLine=this.getLineForOffset(spStart);var count=span.getLeadingMarginLineCount();useFirstLineMargin=line<spanLine+count;}margin+=span.getLeadingMargin(useFirstLineMargin);}return margin;}},{key:'isSpanned',value:function isSpanned(){return this.mSpannedText;}},{key:'getEllipsisChar',value:function getEllipsisChar(method){return method==TextUtils.TruncateAt.END_SMALL?Layout.ELLIPSIS_TWO_DOTS[0]:Layout.ELLIPSIS_NORMAL[0];}},{key:'ellipsize',value:function ellipsize(start,end,line,dest,destoff,method){var ellipsisCount=this.getEllipsisCount(line);if(ellipsisCount==0){return;}var ellipsisStart=this.getEllipsisStart(line);var linestart=this.getLineStart(line);for(var i=ellipsisStart;i<ellipsisStart+ellipsisCount;i++){var c=void 0;if(i==ellipsisStart){c=this.getEllipsisChar(method);}else{c=String.fromCharCode(20);}var _a4=i+linestart;if(_a4>=start&&_a4<end){dest[destoff+_a4-start]=c;}}}}],[{key:'getDesiredWidth',value:function getDesiredWidth(){if(arguments.length==2)return Layout.getDesiredWidth_2.apply(Layout,arguments);if(arguments.length==4)return Layout.getDesiredWidth_4.apply(Layout,arguments);}},{key:'getDesiredWidth_2',value:function getDesiredWidth_2(source,paint){return Layout.getDesiredWidth(source,0,source.length,paint);}},{key:'getDesiredWidth_4',value:function getDesiredWidth_4(source,start,end,paint){var need=0;var next=void 0;for(var i=start;i<=end;i=next){next=source.substring(0,end).indexOf('\\n',i);if(next<0)next=end;var w=Layout.measurePara(paint,source,i,next);if(w>need)need=w;next++;}return need;}},{key:'measurePara',value:function measurePara(paint,text,start,end){var mt=MeasuredText.obtain();var tl=TextLine.obtain();try{mt.setPara(text,start,end,TextDirectionHeuristics.LTR);var directions=void 0;var dir=void 0;directions=Layout.DIRS_ALL_LEFT_TO_RIGHT;dir=Layout.DIR_LEFT_TO_RIGHT;var chars=mt.mChars;var len=mt.mLen;var hasTabs=false;var tabStops=null;for(var i=0;i<len;++i){if(chars[i]=='\\t'){hasTabs=true;if(Spanned.isImplements(text)){var spanned=text;var spanEnd=spanned.nextSpanTransition(start,end,TabStopSpan.type);var spans=Layout.getParagraphSpans(spanned,start,spanEnd,TabStopSpan.type);if(spans.length>0){tabStops=new Layout.TabStops(Layout.TAB_INCREMENT,spans);}}break;}}tl.set(paint,text,start,end,dir,directions,hasTabs,tabStops);return tl.metrics(null);}finally{TextLine.recycle(tl);MeasuredText.recycle(mt);}}},{key:'nextTab',value:function nextTab(text,start,end,h,tabs){var nh=Float.MAX_VALUE;var alltabs=false;if(Spanned.isImplements(text)){if(tabs==null){tabs=Layout.getParagraphSpans(text,start,end,TabStopSpan.type);alltabs=true;}for(var i=0;i<tabs.length;i++){if(!alltabs){if(!TabStopSpan.isImpl(tabs[i]))continue;}var where=tabs[i].getTabStop();if(where<nh&&where>h)nh=where;}if(nh!=Float.MAX_VALUE)return nh;}return Math.floor((h+Layout.TAB_INCREMENT)/Layout.TAB_INCREMENT)*Layout.TAB_INCREMENT;}},{key:'getParagraphSpans',value:function getParagraphSpans(text,start,end,type){if(start==end&&start>0){return[];}return text.getSpans(start,end,type);}}]);return Layout;}();Layout.NO_PARA_SPANS=[];Layout.sTempRect=new Rect();Layout.DIR_LEFT_TO_RIGHT=1;Layout.DIR_RIGHT_TO_LEFT=-1;Layout.DIR_REQUEST_LTR=1;Layout.DIR_REQUEST_RTL=-1;Layout.DIR_REQUEST_DEFAULT_LTR=2;Layout.DIR_REQUEST_DEFAULT_RTL=-2;Layout.RUN_LENGTH_MASK=0x03ffffff;Layout.RUN_LEVEL_SHIFT=26;Layout.RUN_LEVEL_MASK=0x3f;Layout.RUN_RTL_FLAG=1<<Layout.RUN_LEVEL_SHIFT;Layout.TAB_INCREMENT=20;Layout.ELLIPSIS_NORMAL=['…'];Layout.ELLIPSIS_TWO_DOTS=['‥'];text_5.Layout=Layout;(function(Layout){var TabStops=function(){function TabStops(increment,spans){_classCallCheck(this,TabStops);this.mNumStops=0;this.mIncrement=0;this.reset(increment,spans);}_createClass(TabStops,[{key:'reset',value:function reset(increment,spans){this.mIncrement=increment;var ns=0;if(spans!=null){var stops=this.mStops;var _iteratorNormalCompletion48=true;var _didIteratorError48=false;var _iteratorError48=undefined;try{for(var _iterator48=spans[Symbol.iterator](),_step48;!(_iteratorNormalCompletion48=(_step48=_iterator48.next()).done);_iteratorNormalCompletion48=true){var o=_step48.value;if(TabStopSpan.isImpl(o)){if(stops==null){stops=androidui.util.ArrayCreator.newNumberArray(10);}else if(ns==stops.length){var nstops=androidui.util.ArrayCreator.newNumberArray(ns*2);for(var i=0;i<ns;++i){nstops[i]=stops[i];}stops=nstops;}stops[ns++]=o.getTabStop();}}}catch(err){_didIteratorError48=true;_iteratorError48=err;}finally{try{if(!_iteratorNormalCompletion48&&_iterator48.return){_iterator48.return();}}finally{if(_didIteratorError48){throw _iteratorError48;}}}if(ns>1){Arrays.sort(stops,0,ns);}if(stops!=this.mStops){this.mStops=stops;}}this.mNumStops=ns;}},{key:'nextTab',value:function nextTab(h){var ns=this.mNumStops;if(ns>0){var stops=this.mStops;for(var i=0;i<ns;++i){var stop=stops[i];if(stop>h){return stop;}}}return TabStops.nextDefaultStop(h,this.mIncrement);}}],[{key:'nextDefaultStop',value:function nextDefaultStop(h,inc){return Math.floor((h+inc)/inc)*inc;}}]);return TabStops;}();Layout.TabStops=TabStops;var Directions=function Directions(dirs){_classCallCheck(this,Directions);this.mDirections=dirs;};Layout.Directions=Directions;var Ellipsizer=function(_String){_inherits(Ellipsizer,_String);function Ellipsizer(s){_classCallCheck(this,Ellipsizer);var _this60=_possibleConstructorReturn(this,(Ellipsizer.__proto__||Object.getPrototypeOf(Ellipsizer)).call(this,s));_this60.mWidth=0;_this60.mText=s;return _this60;}_createClass(Ellipsizer,[{key:'toString',value:function toString(){var line1=this.mLayout.getLineForOffset(0);var line2=this.mLayout.getLineForOffset(this.mText.length);var dest=this.mText.split('');for(var i=line1;i<=line2;i++){this.mLayout.ellipsize(0,this.mText.length,i,dest,0,this.mMethod);}return dest.join('');}}]);return Ellipsizer;}(String);Layout.Ellipsizer=Ellipsizer;var SpannedEllipsizer=function(_Layout$Ellipsizer){_inherits(SpannedEllipsizer,_Layout$Ellipsizer);function SpannedEllipsizer(display){_classCallCheck(this,SpannedEllipsizer);var _this61=_possibleConstructorReturn(this,(SpannedEllipsizer.__proto__||Object.getPrototypeOf(SpannedEllipsizer)).call(this,display));_this61.mSpanned=display;return _this61;}_createClass(SpannedEllipsizer,[{key:'getSpans',value:function getSpans(start,end,type){return this.mSpanned.getSpans(start,end,type);}},{key:'getSpanStart',value:function getSpanStart(tag){return this.mSpanned.getSpanStart(tag);}},{key:'getSpanEnd',value:function getSpanEnd(tag){return this.mSpanned.getSpanEnd(tag);}},{key:'getSpanFlags',value:function getSpanFlags(tag){return this.mSpanned.getSpanFlags(tag);}},{key:'nextSpanTransition',value:function nextSpanTransition(start,limit,type){return this.mSpanned.nextSpanTransition(start,limit,type);}}]);return SpannedEllipsizer;}(Layout.Ellipsizer);Layout.SpannedEllipsizer=SpannedEllipsizer;var Alignment;(function(Alignment){Alignment[Alignment[\"ALIGN_NORMAL\"]=0]=\"ALIGN_NORMAL\";Alignment[Alignment[\"ALIGN_OPPOSITE\"]=1]=\"ALIGN_OPPOSITE\";Alignment[Alignment[\"ALIGN_CENTER\"]=2]=\"ALIGN_CENTER\";Alignment[Alignment[\"ALIGN_LEFT\"]=3]=\"ALIGN_LEFT\";Alignment[Alignment[\"ALIGN_RIGHT\"]=4]=\"ALIGN_RIGHT\";})(Alignment=Layout.Alignment||(Layout.Alignment={}));})(Layout=text_5.Layout||(text_5.Layout={}));Layout.DIRS_ALL_LEFT_TO_RIGHT=new Layout.Directions([0,Layout.RUN_LENGTH_MASK]);Layout.DIRS_ALL_RIGHT_TO_LEFT=new Layout.Directions([0,Layout.RUN_LENGTH_MASK|Layout.RUN_RTL_FLAG]);})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text_6){var Canvas=android.graphics.Canvas;var ReplacementSpan=android.text.style.ReplacementSpan;var Log=android.util.Log;var Spanned=android.text.Spanned;var TextPaint=android.text.TextPaint;var MeasuredText=function(){function MeasuredText(){_classCallCheck(this,MeasuredText);this.mTextStart=0;this.mDir=0;this.mLen=0;this.mPos=0;this.mWorkPaint=new TextPaint();}_createClass(MeasuredText,[{key:'setPos',value:function setPos(pos){this.mPos=pos-this.mTextStart;}},{key:'setPara',value:function setPara(text,start,end,textDir){this.mText=text;this.mTextStart=start;var len=end-start;this.mLen=len;this.mPos=0;if(this.mWidths==null||this.mWidths.length<len){this.mWidths=androidui.util.ArrayCreator.newNumberArray(len);}this.mChars=text.toString().substring(start,end);if(Spanned.isImplements(text)){var spanned=text;var spans=spanned.getSpans(start,end,ReplacementSpan.type);for(var i=0;i<spans.length;i++){var startInPara=spanned.getSpanStart(spans[i])-start;var endInPara=spanned.getSpanEnd(spans[i])-start;if(startInPara<0)startInPara=0;if(endInPara>len)endInPara=len;for(var j=startInPara;j<endInPara;j++){this.mChars=this.mChars.substring(0,j)+' '+this.mChars.substring(j+1);}}}this.mDir=android.text.Layout.DIR_LEFT_TO_RIGHT;this.mEasy=true;}},{key:'addStyleRun',value:function addStyleRun(){if(arguments.length===3)return this.addStyleRun_3.apply(this,arguments);if(arguments.length===4)return this.addStyleRun_4.apply(this,arguments);}},{key:'addStyleRun_3',value:function addStyleRun_3(paint,len,fm){if(fm!=null){paint.getFontMetricsInt(fm);}var p=this.mPos;this.mPos=p+len;if(this.mEasy){var flags=this.mDir==android.text.Layout.DIR_LEFT_TO_RIGHT?Canvas.DIRECTION_LTR:Canvas.DIRECTION_RTL;return paint.getTextRunAdvances_count(this.mChars,p,len,p,len,flags,this.mWidths,p);}var totalAdvance=0;var level=this.mLevels[p];for(var q=p,i=p+1,e=p+len;;++i){if(i==e||this.mLevels[i]!=level){var _flags=(level&0x1)==0?Canvas.DIRECTION_LTR:Canvas.DIRECTION_RTL;totalAdvance+=paint.getTextRunAdvances_count(this.mChars,q,i-q,q,i-q,_flags,this.mWidths,q);if(i==e){break;}q=i;level=this.mLevels[i];}}return totalAdvance;}},{key:'addStyleRun_4',value:function addStyleRun_4(paint,spans,len,fm){var workPaint=this.mWorkPaint;workPaint.set(paint);workPaint.baselineShift=0;var replacement=null;for(var i=0;i<spans.length;i++){var span=spans[i];if(span instanceof ReplacementSpan){replacement=span;}else{span.updateMeasureState(workPaint);}}var wid=void 0;if(replacement==null){wid=this.addStyleRun(workPaint,len,fm);}else{wid=replacement.getSize(workPaint,this.mText,this.mTextStart+this.mPos,this.mTextStart+this.mPos+len,fm);var w=this.mWidths;w[this.mPos]=wid;for(var _i16=this.mPos+1,e=this.mPos+len;_i16<e;_i16++){w[_i16]=0;}this.mPos+=len;}if(fm!=null){if(workPaint.baselineShift<0){fm.ascent+=workPaint.baselineShift;fm.top+=workPaint.baselineShift;}else{fm.descent+=workPaint.baselineShift;fm.bottom+=workPaint.baselineShift;}}return wid;}},{key:'breakText',value:function breakText(limit,forwards,width){var w=this.mWidths;if(forwards){var i=0;while(i<limit){width-=w[i];if(width<0.0)break;i++;}while(i>0&&this.mChars[i-1]==' '){i--;}return i;}else{var _i17=limit-1;while(_i17>=0){width-=w[_i17];if(width<0.0)break;_i17--;}while(_i17<limit-1&&this.mChars[_i17+1]==' '){_i17++;}return limit-_i17-1;}}},{key:'measure',value:function measure(start,limit){var width=0;var w=this.mWidths;for(var i=start;i<limit;++i){width+=w[i];}return width;}}],[{key:'obtain',value:function obtain(){var mt=void 0;{for(var i=MeasuredText.sCached.length;--i>=0;){if(MeasuredText.sCached[i]!=null){mt=MeasuredText.sCached[i];MeasuredText.sCached[i]=null;return mt;}}}mt=new MeasuredText();if(MeasuredText.localLOGV){Log.v(\"MEAS\",\"new: \"+mt);}return mt;}},{key:'recycle',value:function recycle(mt){mt.mText=null;if(mt.mLen<1000){{for(var i=0;i<MeasuredText.sCached.length;++i){if(MeasuredText.sCached[i]==null){MeasuredText.sCached[i]=mt;mt.mText=null;break;}}}}return null;}}]);return MeasuredText;}();MeasuredText.localLOGV=false;MeasuredText.sLock=new Array(0);MeasuredText.sCached=new Array(3);text_6.MeasuredText=MeasuredText;})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text_7){var System=java.lang.System;var StringBuilder=java.lang.StringBuilder;var MeasuredText=android.text.MeasuredText;var Spanned=android.text.Spanned;var TextDirectionHeuristics=android.text.TextDirectionHeuristics;var TextUtils=function(){function TextUtils(){_classCallCheck(this,TextUtils);}_createClass(TextUtils,null,[{key:'isEmpty',value:function isEmpty(str){if(str==null||str.length==0)return true;else return false;}},{key:'getOffsetBefore',value:function getOffsetBefore(text,offset){if(offset==0)return 0;if(offset==1)return 0;var c=text.codePointAt(offset-1);if(c>='?'.codePointAt(0)&&c<='?'.codePointAt(0)){var c1=text.codePointAt(offset-2);if(c1>='?'.codePointAt(0)&&c1<='?'.codePointAt(0))offset-=2;else offset-=1;}else{offset-=1;}if(Spanned.isImplements(text)){var spans=text.getSpans(offset,offset,android.text.style.ReplacementSpan.type);for(var i=0;i<spans.length;i++){var start=text.getSpanStart(spans[i]);var end=text.getSpanEnd(spans[i]);if(start<offset&&end>offset)offset=start;}}return offset;}},{key:'getOffsetAfter',value:function getOffsetAfter(text,offset){var len=text.length;if(offset==len)return len;if(offset==len-1)return len;var c=text.codePointAt(offset);if(c>='?'.codePointAt(0)&&c<='?'.codePointAt(0)){var c1=text.codePointAt(offset+1);if(c1>='?'.codePointAt(0)&&c1<='?'.codePointAt(0))offset+=2;else offset+=1;}else{offset+=1;}if(Spanned.isImplements(text)){var spans=text.getSpans(offset,offset,android.text.style.ReplacementSpan.type);for(var i=0;i<spans.length;i++){var start=text.getSpanStart(spans[i]);var end=text.getSpanEnd(spans[i]);if(start<offset&&end>offset)offset=end;}}return offset;}},{key:'ellipsize',value:function ellipsize(text,paint,avail,where){var preserveLength=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;var callback=arguments.length>5&&arguments[5]!==undefined?arguments[5]:null;var textDir=arguments.length>6&&arguments[6]!==undefined?arguments[6]:TextDirectionHeuristics.FIRSTSTRONG_LTR;var ellipsis=arguments.length>7&&arguments[7]!==undefined?arguments[7]:undefined;ellipsis=ellipsis||(where==TextUtils.TruncateAt.END_SMALL?android.text.Layout.ELLIPSIS_TWO_DOTS[0]:android.text.Layout.ELLIPSIS_NORMAL[0]);var len=text.length;var mt=MeasuredText.obtain();try{var width=TextUtils.setPara(mt,paint,text,0,text.length,textDir);if(width<=avail){if(callback!=null){callback.ellipsized(0,0);}return text;}var ellipsiswid=paint.measureText(ellipsis);avail-=ellipsiswid;var left=0;var right=len;if(avail<0){}else if(where==TextUtils.TruncateAt.START){right=len-mt.breakText(len,false,avail);}else if(where==TextUtils.TruncateAt.END||where==TextUtils.TruncateAt.END_SMALL){left=mt.breakText(len,true,avail);}else{right=len-mt.breakText(len,false,avail/2);avail-=mt.measure(right,len);left=mt.breakText(right,true,avail);}if(callback!=null){callback.ellipsized(left,right);}var buf=mt.mChars.split('');var sp=Spanned.isImplements(text)?text:null;var remaining=len-(right-left);if(preserveLength){if(remaining>0){buf[left++]=ellipsis.charAt(0);}for(var i=left;i<right;i++){buf[i]=TextUtils.ZWNBS_CHAR;}var s=buf.join('');return s;}if(remaining==0){return\"\";}var sb=new StringBuilder(remaining+ellipsis.length());sb.append(buf.join('').substr(0,left));sb.append(ellipsis);sb.append(buf.join('').substr(right,len-right));return sb.toString();}finally{MeasuredText.recycle(mt);}}},{key:'setPara',value:function setPara(mt,paint,text,start,end,textDir){mt.setPara(text,start,end,textDir);var width=void 0;var sp=Spanned.isImplements(text)?text:null;var len=end-start;if(sp==null){width=mt.addStyleRun(paint,len,null);}else{width=0;var spanEnd=void 0;for(var spanStart=0;spanStart<len;spanStart=spanEnd){spanEnd=sp.nextSpanTransition(spanStart,len,android.text.style.MetricAffectingSpan.type);var spans=sp.getSpans(spanStart,spanEnd,android.text.style.MetricAffectingSpan.type);spans=TextUtils.removeEmptySpans(spans,sp,android.text.style.MetricAffectingSpan.type);width+=mt.addStyleRun(paint,spans,spanEnd-spanStart,null);}}return width;}},{key:'removeEmptySpans',value:function removeEmptySpans(spans,spanned,klass){var copy=null;var count=0;for(var i=0;i<spans.length;i++){var span=spans[i];var start=spanned.getSpanStart(span);var end=spanned.getSpanEnd(span);if(start==end){if(copy==null){copy=new Array(spans.length-1);System.arraycopy(spans,0,copy,0,i);count=i;}}else{if(copy!=null){copy[count]=span;count++;}}}if(copy!=null){var result=new Array(count);System.arraycopy(copy,0,result,0,count);return result;}else{return spans;}}},{key:'packRangeInLong',value:function packRangeInLong(start,end){return[start,end];}},{key:'unpackRangeStartFromLong',value:function unpackRangeStartFromLong(range){return range[0]||0;}},{key:'unpackRangeEndFromLong',value:function unpackRangeEndFromLong(range){return range[1]||0;}}]);return TextUtils;}();TextUtils.ALIGNMENT_SPAN=1;TextUtils.FIRST_SPAN=TextUtils.ALIGNMENT_SPAN;TextUtils.FOREGROUND_COLOR_SPAN=2;TextUtils.RELATIVE_SIZE_SPAN=3;TextUtils.SCALE_X_SPAN=4;TextUtils.STRIKETHROUGH_SPAN=5;TextUtils.UNDERLINE_SPAN=6;TextUtils.STYLE_SPAN=7;TextUtils.BULLET_SPAN=8;TextUtils.QUOTE_SPAN=9;TextUtils.LEADING_MARGIN_SPAN=10;TextUtils.URL_SPAN=11;TextUtils.BACKGROUND_COLOR_SPAN=12;TextUtils.TYPEFACE_SPAN=13;TextUtils.SUPERSCRIPT_SPAN=14;TextUtils.SUBSCRIPT_SPAN=15;TextUtils.ABSOLUTE_SIZE_SPAN=16;TextUtils.TEXT_APPEARANCE_SPAN=17;TextUtils.ANNOTATION=18;TextUtils.SUGGESTION_SPAN=19;TextUtils.SPELL_CHECK_SPAN=20;TextUtils.SUGGESTION_RANGE_SPAN=21;TextUtils.EASY_EDIT_SPAN=22;TextUtils.LOCALE_SPAN=23;TextUtils.LAST_SPAN=TextUtils.LOCALE_SPAN;TextUtils.EMPTY_STRING_ARRAY=[];TextUtils.ZWNBS_CHAR=String.fromCodePoint(20);TextUtils.ARAB_SCRIPT_SUBTAG=\"Arab\";TextUtils.HEBR_SCRIPT_SUBTAG=\"Hebr\";text_7.TextUtils=TextUtils;(function(TextUtils){var TruncateAt;(function(TruncateAt){TruncateAt[TruncateAt[\"START\"]=0]=\"START\";TruncateAt[TruncateAt[\"MIDDLE\"]=1]=\"MIDDLE\";TruncateAt[TruncateAt[\"END\"]=2]=\"END\";TruncateAt[TruncateAt[\"MARQUEE\"]=3]=\"MARQUEE\";TruncateAt[TruncateAt[\"END_SMALL\"]=4]=\"END_SMALL\";})(TruncateAt=TextUtils.TruncateAt||(TextUtils.TruncateAt={}));})(TextUtils=text_7.TextUtils||(text_7.TextUtils={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var view;(function(view){var Gravity=android.view.Gravity;var View=android.view.View;var ViewGroup=android.view.ViewGroup;var WindowManager=function(){function WindowManager(context){_classCallCheck(this,WindowManager);this.mWindowsLayout=new WindowManager.Layout(context,this);var viewRootImpl=context.androidUI._viewRootImpl;var fakeAttachInfo=new View.AttachInfo(viewRootImpl,viewRootImpl.mHandler);fakeAttachInfo.mRootView=this.mWindowsLayout;this.mWindowsLayout.dispatchAttachedToWindow(fakeAttachInfo,0);this.mWindowsLayout.mGroupFlags|=ViewGroup.FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW;this.mWindowsLayout.mGroupFlags|=ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE;}_createClass(WindowManager,[{key:'getWindowsLayout',value:function getWindowsLayout(){return this.mWindowsLayout;}},{key:'addWindow',value:function addWindow(window){var wparams=window.getAttributes();if(!wparams){wparams=new WindowManager.LayoutParams();}if(!(wparams instanceof WindowManager.LayoutParams)){throw Error('can\\'t addWindow, params must be WindowManager.LayoutParams : '+wparams);}window.setContainer(this);var decorView=window.getDecorView();var type=wparams.type;var lastFocusWindowView=this.mWindowsLayout.getTopFocusableWindowView();this.mWindowsLayout.addView(decorView,wparams);decorView.dispatchAttachedToWindow(window.mAttachInfo,0);if(wparams.isFocusable()){decorView.dispatchWindowFocusChanged(true);if(lastFocusWindowView&&lastFocusWindowView.hasFocus()){var focused=lastFocusWindowView.findFocus();lastFocusWindowView[WindowManager.FocusViewRemember]=focused;if(focused!=null){focused.clearFocusInternal(true,false);}lastFocusWindowView.dispatchWindowFocusChanged(false);decorView.addOnLayoutChangeListener({onLayoutChange:function onLayoutChange(v,left,top,right,bottom,oldLeft,oldTop,oldRight,oldBottom){decorView.removeOnLayoutChangeListener(this);var newWindowFocused=view.FocusFinder.getInstance().findNextFocus(decorView,null,View.FOCUS_DOWN);if(newWindowFocused!=null){newWindowFocused.requestFocus(View.FOCUS_DOWN);}}});}}if(decorView instanceof ViewGroup){decorView.setMotionEventSplittingEnabled(wparams.isSplitTouch());}var enterAnimation=window.getContext().androidUI.mActivityThread.getOverrideEnterAnimation();if(enterAnimation===undefined)enterAnimation=wparams.enterAnimation;if(enterAnimation){decorView.bindElement.style.visibility='hidden';enterAnimation.setAnimationListener({onAnimationStart:function onAnimationStart(animation){},onAnimationEnd:function onAnimationEnd(animation){decorView.bindElement.style.visibility='';},onAnimationRepeat:function onAnimationRepeat(animation){}});decorView.startAnimation(enterAnimation);}}},{key:'updateWindowLayout',value:function updateWindowLayout(window,params){if(!(params instanceof WindowManager.LayoutParams)){throw Error('can\\'t updateWindowLayout, params must be WindowManager.LayoutParams');}window.getDecorView().setLayoutParams(params);}},{key:'removeWindow',value:function removeWindow(window){var decor=window.getDecorView();if(decor.getParent()==null)return;if(decor.getParent()!==this.mWindowsLayout){console.error('removeWindow fail, don\\'t has the window, decor belong to ',decor.getParent());return;}var wparams=decor.getLayoutParams();var exitAnimation=window.getContext().androidUI.mActivityThread.getOverrideExitAnimation();if(exitAnimation===undefined)exitAnimation=wparams.exitAnimation;if(exitAnimation){var t=this;decor.startAnimation(exitAnimation);decor.drawAnimation(this.mWindowsLayout,android.os.SystemClock.uptimeMillis(),exitAnimation);this.mWindowsLayout.removeView(decor);}else{this.mWindowsLayout.removeView(decor);}if(wparams.isFocusable()){var resumeWindowView=this.mWindowsLayout.getTopFocusableWindowView();if(resumeWindowView){resumeWindowView.dispatchWindowFocusChanged(true);var resumeFocus=resumeWindowView[WindowManager.FocusViewRemember];if(resumeFocus){resumeFocus.requestFocus(View.FOCUS_DOWN);}}}}}]);return WindowManager;}();WindowManager.FocusViewRemember=Symbol();view.WindowManager=WindowManager;(function(WindowManager){var Layout=function(_android$widget$Frame){_inherits(Layout,_android$widget$Frame);function Layout(context,windowManager){_classCallCheck(this,Layout);var _this62=_possibleConstructorReturn(this,(Layout.__proto__||Object.getPrototypeOf(Layout)).call(this,context));_this62.mWindowManager=windowManager;return _this62;}_createClass(Layout,[{key:'getTopFocusableWindowView',value:function getTopFocusableWindowView(){var findParent=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;var count=this.getChildCount();for(var i=count-1;i>=0;i--){var child=this.getChildAt(i);var wparams=child.getLayoutParams();if(wparams.isFocusable()){return child;}}if(findParent){var decor=this.getParent();if(decor!=null){var windowLayout=decor.getParent();if(windowLayout instanceof Layout){return windowLayout.getTopFocusableWindowView();}}}}},{key:'dispatchKeyEvent',value:function dispatchKeyEvent(event){var topFocusView=this.getTopFocusableWindowView(false);if(topFocusView&&topFocusView.dispatchKeyEvent(event)){return true;}return _get2(Layout.prototype.__proto__||Object.getPrototypeOf(Layout.prototype),'dispatchKeyEvent',this).call(this,event);}},{key:'isTransformedTouchPointInView',value:function isTransformedTouchPointInView(x,y,child,outLocalPoint){var wparams=child.getLayoutParams();if(wparams.isFocusable()&&wparams.isTouchable()){return true;}return false;}},{key:'onChildVisibilityChanged',value:function onChildVisibilityChanged(child,oldVisibility,newVisibility){_get2(Layout.prototype.__proto__||Object.getPrototypeOf(Layout.prototype),'onChildVisibilityChanged',this).call(this,child,oldVisibility,newVisibility);var wparams=child.getLayoutParams();if(newVisibility===View.VISIBLE){var resumeAnimation=child.getContext().androidUI.mActivityThread.getOverrideResumeAnimation();if(resumeAnimation===undefined)resumeAnimation=wparams.resumeAnimation;if(resumeAnimation){child.startAnimation(resumeAnimation);}}else{var hideAnimation=child.getContext().androidUI.mActivityThread.getOverrideHideAnimation();if(hideAnimation===undefined)hideAnimation=wparams.hideAnimation;if(hideAnimation){child.startAnimation(hideAnimation);child.drawAnimation(this,android.os.SystemClock.uptimeMillis(),hideAnimation);}}}},{key:'onLayout',value:function onLayout(changed,left,top,right,bottom){this.layoutChildren(left,top,right,bottom,false);}},{key:'layoutChildren',value:function layoutChildren(left,top,right,bottom,forceLeftGravity){var count=this.getChildCount();var parentLeft=this.getPaddingLeftWithForeground();var parentRight=right-left-this.getPaddingRightWithForeground();var parentTop=this.getPaddingTopWithForeground();var parentBottom=bottom-top-this.getPaddingBottomWithForeground();this.mForegroundBoundsChanged=true;for(var i=0;i<count;i++){var child=this.getChildAt(i);if(child.getVisibility()!=View.GONE){var lp=child.getLayoutParams();var width=child.getMeasuredWidth();var height=child.getMeasuredHeight();var childLeft=void 0;var childTop=void 0;var gravity=lp.gravity;if(gravity==-1){gravity=Layout.DEFAULT_CHILD_GRAVITY;}var absoluteGravity=gravity;var verticalGravity=gravity&Gravity.VERTICAL_GRAVITY_MASK;switch(absoluteGravity&Gravity.HORIZONTAL_GRAVITY_MASK){case Gravity.CENTER_HORIZONTAL:childLeft=parentLeft+(parentRight-parentLeft-width)/2+lp.leftMargin-lp.rightMargin;break;case Gravity.RIGHT:if(!forceLeftGravity){childLeft=parentRight-width-lp.rightMargin-lp.x;break;}case Gravity.LEFT:default:childLeft=parentLeft+lp.leftMargin+lp.x;}switch(verticalGravity){case Gravity.TOP:childTop=parentTop+lp.topMargin+lp.y;break;case Gravity.CENTER_VERTICAL:childTop=parentTop+(parentBottom-parentTop-height)/2+lp.topMargin-lp.bottomMargin;break;case Gravity.BOTTOM:childTop=parentBottom-height-lp.bottomMargin-lp.y;break;default:childTop=parentTop+lp.topMargin;}child.layout(childLeft,childTop,childLeft+width,childTop+height);}}}},{key:'tagName',value:function tagName(){return'windowsGroup';}}]);return Layout;}(android.widget.FrameLayout);WindowManager.Layout=Layout;var LayoutParams=function(_android$widget$Frame2){_inherits(LayoutParams,_android$widget$Frame2);function LayoutParams(){var _type=arguments.length>0&&arguments[0]!==undefined?arguments[0]:LayoutParams.TYPE_APPLICATION;_classCallCheck(this,LayoutParams);var _this63=_possibleConstructorReturn(this,(LayoutParams.__proto__||Object.getPrototypeOf(LayoutParams)).call(this,WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.MATCH_PARENT));_this63.x=0;_this63.y=0;_this63.type=0;_this63.flags=0;_this63.exitAnimation=android.R.anim.activity_close_exit;_this63.enterAnimation=android.R.anim.activity_open_enter;_this63.resumeAnimation=android.R.anim.activity_close_enter;_this63.hideAnimation=android.R.anim.activity_open_exit;_this63.dimAmount=0;_this63.mTitle=\"\";_this63.type=_type;return _this63;}_createClass(LayoutParams,[{key:'setTitle',value:function setTitle(title){if(null==title)title=\"\";this.mTitle=title;}},{key:'getTitle',value:function getTitle(){return this.mTitle;}},{key:'copyFrom',value:function copyFrom(o){var changes=0;if(this.width!=o.width){this.width=o.width;changes|=LayoutParams.LAYOUT_CHANGED;}if(this.height!=o.height){this.height=o.height;changes|=LayoutParams.LAYOUT_CHANGED;}if(this.x!=o.x){this.x=o.x;changes|=LayoutParams.LAYOUT_CHANGED;}if(this.y!=o.y){this.y=o.y;changes|=LayoutParams.LAYOUT_CHANGED;}if(this.type!=o.type){this.type=o.type;changes|=LayoutParams.TYPE_CHANGED;}if(this.flags!=o.flags){var diff=this.flags^o.flags;this.flags=o.flags;changes|=LayoutParams.FLAGS_CHANGED;}if(this.gravity!=o.gravity){this.gravity=o.gravity;changes|=LayoutParams.LAYOUT_CHANGED;}if(this.mTitle!=o.mTitle){this.mTitle=o.mTitle;changes|=LayoutParams.TITLE_CHANGED;}if(this.dimAmount!=o.dimAmount){this.dimAmount=o.dimAmount;changes|=LayoutParams.DIM_AMOUNT_CHANGED;}return changes;}},{key:'isFocusable',value:function isFocusable(){return(this.flags&LayoutParams.FLAG_NOT_FOCUSABLE)==0;}},{key:'isTouchable',value:function isTouchable(){return(this.flags&LayoutParams.FLAG_NOT_TOUCHABLE)==0;}},{key:'isTouchModal',value:function isTouchModal(){return(this.flags&LayoutParams.FLAG_NOT_TOUCH_MODAL)==0;}},{key:'isFloating',value:function isFloating(){return(this.flags&LayoutParams.FLAG_FLOATING)!=0;}},{key:'isSplitTouch',value:function isSplitTouch(){return(this.flags&LayoutParams.FLAG_SPLIT_TOUCH)!=0;}},{key:'isWatchTouchOutside',value:function isWatchTouchOutside(){return(this.flags&LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH)!=0;}}]);return LayoutParams;}(android.widget.FrameLayout.LayoutParams);LayoutParams.FIRST_APPLICATION_WINDOW=1;LayoutParams.TYPE_BASE_APPLICATION=1;LayoutParams.TYPE_APPLICATION=2;LayoutParams.TYPE_APPLICATION_STARTING=3;LayoutParams.LAST_APPLICATION_WINDOW=99;LayoutParams.FIRST_SUB_WINDOW=1000;LayoutParams.TYPE_APPLICATION_PANEL=LayoutParams.FIRST_SUB_WINDOW;LayoutParams.TYPE_APPLICATION_MEDIA=LayoutParams.FIRST_SUB_WINDOW+1;LayoutParams.TYPE_APPLICATION_SUB_PANEL=LayoutParams.FIRST_SUB_WINDOW+2;LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG=LayoutParams.FIRST_SUB_WINDOW+3;LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY=LayoutParams.FIRST_SUB_WINDOW+4;LayoutParams.LAST_SUB_WINDOW=1999;LayoutParams.FIRST_SYSTEM_WINDOW=2000;LayoutParams.TYPE_STATUS_BAR=LayoutParams.FIRST_SYSTEM_WINDOW;LayoutParams.TYPE_SEARCH_BAR=LayoutParams.FIRST_SYSTEM_WINDOW+1;LayoutParams.TYPE_PHONE=LayoutParams.FIRST_SYSTEM_WINDOW+2;LayoutParams.TYPE_SYSTEM_ALERT=LayoutParams.FIRST_SYSTEM_WINDOW+3;LayoutParams.TYPE_KEYGUARD=LayoutParams.FIRST_SYSTEM_WINDOW+4;LayoutParams.TYPE_TOAST=LayoutParams.FIRST_SYSTEM_WINDOW+5;LayoutParams.TYPE_SYSTEM_OVERLAY=LayoutParams.FIRST_SYSTEM_WINDOW+6;LayoutParams.TYPE_PRIORITY_PHONE=LayoutParams.FIRST_SYSTEM_WINDOW+7;LayoutParams.TYPE_SYSTEM_DIALOG=LayoutParams.FIRST_SYSTEM_WINDOW+8;LayoutParams.LAST_SYSTEM_WINDOW=2999;LayoutParams.FLAG_NOT_FOCUSABLE=0x00000008;LayoutParams.FLAG_NOT_TOUCHABLE=0x00000010;LayoutParams.FLAG_NOT_TOUCH_MODAL=0x00000020;LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH=0x00040000;LayoutParams.FLAG_SPLIT_TOUCH=0x00800000;LayoutParams.FLAG_FLOATING=0x40000000;LayoutParams.LAYOUT_CHANGED=1<<0;LayoutParams.TYPE_CHANGED=1<<1;LayoutParams.FLAGS_CHANGED=1<<2;LayoutParams.FORMAT_CHANGED=1<<3;LayoutParams.ANIMATION_CHANGED=1<<4;LayoutParams.DIM_AMOUNT_CHANGED=1<<5;LayoutParams.TITLE_CHANGED=1<<6;LayoutParams.ALPHA_CHANGED=1<<7;WindowManager.LayoutParams=LayoutParams;})(WindowManager=view.WindowManager||(view.WindowManager={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var animation;(function(animation){var Animation=android.view.animation.Animation;var TranslateAnimation=function(_Animation){_inherits(TranslateAnimation,_Animation);function TranslateAnimation(){_classCallCheck(this,TranslateAnimation);var _this64=_possibleConstructorReturn(this,(TranslateAnimation.__proto__||Object.getPrototypeOf(TranslateAnimation)).call(this));_this64.mFromXType=TranslateAnimation.ABSOLUTE;_this64.mToXType=TranslateAnimation.ABSOLUTE;_this64.mFromYType=TranslateAnimation.ABSOLUTE;_this64.mToYType=TranslateAnimation.ABSOLUTE;_this64.mFromXValue=0.0;_this64.mToXValue=0.0;_this64.mFromYValue=0.0;_this64.mToYValue=0.0;_this64.mFromXDelta=0;_this64.mToXDelta=0;_this64.mFromYDelta=0;_this64.mToYDelta=0;if(arguments.length===4){_this64.mFromXValue=arguments.length<=0?undefined:arguments[0];_this64.mToXValue=arguments.length<=1?undefined:arguments[1];_this64.mFromYValue=arguments.length<=2?undefined:arguments[2];_this64.mToYValue=arguments.length<=3?undefined:arguments[3];_this64.mFromXType=TranslateAnimation.ABSOLUTE;_this64.mToXType=TranslateAnimation.ABSOLUTE;_this64.mFromYType=TranslateAnimation.ABSOLUTE;_this64.mToYType=TranslateAnimation.ABSOLUTE;}else{_this64.mFromXType=arguments.length<=0?undefined:arguments[0];_this64.mFromXValue=arguments.length<=1?undefined:arguments[1];_this64.mToXType=arguments.length<=2?undefined:arguments[2];_this64.mToXValue=arguments.length<=3?undefined:arguments[3];_this64.mFromYType=arguments.length<=4?undefined:arguments[4];_this64.mFromYValue=arguments.length<=5?undefined:arguments[5];_this64.mToYType=arguments.length<=6?undefined:arguments[6];_this64.mToYValue=arguments.length<=7?undefined:arguments[7];}return _this64;}_createClass(TranslateAnimation,[{key:'applyTransformation',value:function applyTransformation(interpolatedTime,t){var dx=this.mFromXDelta;var dy=this.mFromYDelta;if(this.mFromXDelta!=this.mToXDelta){dx=this.mFromXDelta+(this.mToXDelta-this.mFromXDelta)*interpolatedTime;}if(this.mFromYDelta!=this.mToYDelta){dy=this.mFromYDelta+(this.mToYDelta-this.mFromYDelta)*interpolatedTime;}t.getMatrix().setTranslate(dx,dy);}},{key:'initialize',value:function initialize(width,height,parentWidth,parentHeight){_get2(TranslateAnimation.prototype.__proto__||Object.getPrototypeOf(TranslateAnimation.prototype),'initialize',this).call(this,width,height,parentWidth,parentHeight);this.mFromXDelta=this.resolveSize(this.mFromXType,this.mFromXValue,width,parentWidth);this.mToXDelta=this.resolveSize(this.mToXType,this.mToXValue,width,parentWidth);this.mFromYDelta=this.resolveSize(this.mFromYType,this.mFromYValue,height,parentHeight);this.mToYDelta=this.resolveSize(this.mToYType,this.mToYValue,height,parentHeight);}}]);return TranslateAnimation;}(Animation);animation.TranslateAnimation=TranslateAnimation;})(animation=view.animation||(view.animation={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var animation;(function(animation){var Animation=android.view.animation.Animation;var AlphaAnimation=function(_Animation2){_inherits(AlphaAnimation,_Animation2);function AlphaAnimation(fromAlpha,toAlpha){_classCallCheck(this,AlphaAnimation);var _this65=_possibleConstructorReturn(this,(AlphaAnimation.__proto__||Object.getPrototypeOf(AlphaAnimation)).call(this));_this65.mFromAlpha=0;_this65.mToAlpha=0;_this65.mFromAlpha=fromAlpha;_this65.mToAlpha=toAlpha;return _this65;}_createClass(AlphaAnimation,[{key:'applyTransformation',value:function applyTransformation(interpolatedTime,t){var alpha=this.mFromAlpha;t.setAlpha(alpha+(this.mToAlpha-alpha)*interpolatedTime);}},{key:'willChangeTransformationMatrix',value:function willChangeTransformationMatrix(){return false;}},{key:'willChangeBounds',value:function willChangeBounds(){return false;}},{key:'hasAlpha',value:function hasAlpha(){return true;}}]);return AlphaAnimation;}(Animation);animation.AlphaAnimation=AlphaAnimation;})(animation=view.animation||(view.animation={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var animation;(function(animation){var Animation=android.view.animation.Animation;var ScaleAnimation=function(_Animation3){_inherits(ScaleAnimation,_Animation3);function ScaleAnimation(fromX,toX,fromY,toY){var pivotXType=arguments.length>4&&arguments[4]!==undefined?arguments[4]:ScaleAnimation.ABSOLUTE;var pivotXValue=arguments.length>5&&arguments[5]!==undefined?arguments[5]:0;var pivotYType=arguments.length>6&&arguments[6]!==undefined?arguments[6]:ScaleAnimation.ABSOLUTE;var pivotYValue=arguments.length>7&&arguments[7]!==undefined?arguments[7]:0;_classCallCheck(this,ScaleAnimation);var _this66=_possibleConstructorReturn(this,(ScaleAnimation.__proto__||Object.getPrototypeOf(ScaleAnimation)).call(this));_this66.mFromX=0;_this66.mToX=0;_this66.mFromY=0;_this66.mToY=0;_this66.mFromXData=0;_this66.mToXData=0;_this66.mFromYData=0;_this66.mToYData=0;_this66.mPivotXType=ScaleAnimation.ABSOLUTE;_this66.mPivotYType=ScaleAnimation.ABSOLUTE;_this66.mPivotXValue=0.0;_this66.mPivotYValue=0.0;_this66.mPivotX=0;_this66.mPivotY=0;_this66.mResources=null;_this66.mFromX=fromX;_this66.mToX=toX;_this66.mFromY=fromY;_this66.mToY=toY;_this66.mPivotXValue=pivotXValue;_this66.mPivotXType=pivotXType;_this66.mPivotYValue=pivotYValue;_this66.mPivotYType=pivotYType;_this66.initializePivotPoint();return _this66;}_createClass(ScaleAnimation,[{key:'initializePivotPoint',value:function initializePivotPoint(){if(this.mPivotXType==ScaleAnimation.ABSOLUTE){this.mPivotX=this.mPivotXValue;}if(this.mPivotYType==ScaleAnimation.ABSOLUTE){this.mPivotY=this.mPivotYValue;}}},{key:'applyTransformation',value:function applyTransformation(interpolatedTime,t){var sx=1.0;var sy=1.0;var scale=this.getScaleFactor();if(this.mFromX!=1.0||this.mToX!=1.0){sx=this.mFromX+(this.mToX-this.mFromX)*interpolatedTime;}if(this.mFromY!=1.0||this.mToY!=1.0){sy=this.mFromY+(this.mToY-this.mFromY)*interpolatedTime;}if(this.mPivotX==0&&this.mPivotY==0){t.getMatrix().setScale(sx,sy);}else{t.getMatrix().setScale(sx,sy,scale*this.mPivotX,scale*this.mPivotY);}}},{key:'initialize',value:function initialize(width,height,parentWidth,parentHeight){_get2(ScaleAnimation.prototype.__proto__||Object.getPrototypeOf(ScaleAnimation.prototype),'initialize',this).call(this,width,height,parentWidth,parentHeight);this.mPivotX=this.resolveSize(this.mPivotXType,this.mPivotXValue,width,parentWidth);this.mPivotY=this.resolveSize(this.mPivotYType,this.mPivotYValue,height,parentHeight);}}]);return ScaleAnimation;}(Animation);animation.ScaleAnimation=ScaleAnimation;})(animation=view.animation||(view.animation={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var animation;(function(animation){var ArrayList=java.util.ArrayList;var Long=java.lang.Long;var Animation=android.view.animation.Animation;var Transformation=android.view.animation.Transformation;var AnimationSet=function(_Animation4){_inherits(AnimationSet,_Animation4);function AnimationSet(){var shareInterpolator=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;_classCallCheck(this,AnimationSet);var _this67=_possibleConstructorReturn(this,(AnimationSet.__proto__||Object.getPrototypeOf(AnimationSet)).call(this));_this67.mFlags=0;_this67.mAnimations=new ArrayList();_this67.mTempTransformation=new Transformation();_this67.mLastEnd=0;_this67.setFlag(AnimationSet.PROPERTY_SHARE_INTERPOLATOR_MASK,shareInterpolator);_this67.init();return _this67;}_createClass(AnimationSet,[{key:'setFlag',value:function setFlag(mask,value){if(value){this.mFlags|=mask;}else{this.mFlags&=~mask;}}},{key:'init',value:function init(){this.mStartTime=0;}},{key:'setFillAfter',value:function setFillAfter(fillAfter){this.mFlags|=AnimationSet.PROPERTY_FILL_AFTER_MASK;_get2(AnimationSet.prototype.__proto__||Object.getPrototypeOf(AnimationSet.prototype),'setFillAfter',this).call(this,fillAfter);}},{key:'setFillBefore',value:function setFillBefore(fillBefore){this.mFlags|=AnimationSet.PROPERTY_FILL_BEFORE_MASK;_get2(AnimationSet.prototype.__proto__||Object.getPrototypeOf(AnimationSet.prototype),'setFillBefore',this).call(this,fillBefore);}},{key:'setRepeatMode',value:function setRepeatMode(repeatMode){this.mFlags|=AnimationSet.PROPERTY_REPEAT_MODE_MASK;_get2(AnimationSet.prototype.__proto__||Object.getPrototypeOf(AnimationSet.prototype),'setRepeatMode',this).call(this,repeatMode);}},{key:'setStartOffset',value:function setStartOffset(startOffset){this.mFlags|=AnimationSet.PROPERTY_START_OFFSET_MASK;_get2(AnimationSet.prototype.__proto__||Object.getPrototypeOf(AnimationSet.prototype),'setStartOffset',this).call(this,startOffset);}},{key:'hasAlpha',value:function hasAlpha(){if(this.mDirty){this.mDirty=this.mHasAlpha=false;var count=this.mAnimations.size();var animations=this.mAnimations;for(var i=0;i<count;i++){if(animations.get(i).hasAlpha()){this.mHasAlpha=true;break;}}}return this.mHasAlpha;}},{key:'setDuration',value:function setDuration(durationMillis){this.mFlags|=AnimationSet.PROPERTY_DURATION_MASK;_get2(AnimationSet.prototype.__proto__||Object.getPrototypeOf(AnimationSet.prototype),'setDuration',this).call(this,durationMillis);this.mLastEnd=this.mStartOffset+this.mDuration;}},{key:'addAnimation',value:function addAnimation(a){this.mAnimations.add(a);var noMatrix=(this.mFlags&AnimationSet.PROPERTY_MORPH_MATRIX_MASK)==0;if(noMatrix&&a.willChangeTransformationMatrix()){this.mFlags|=AnimationSet.PROPERTY_MORPH_MATRIX_MASK;}var changeBounds=(this.mFlags&AnimationSet.PROPERTY_CHANGE_BOUNDS_MASK)==0;if(changeBounds&&a.willChangeBounds()){this.mFlags|=AnimationSet.PROPERTY_CHANGE_BOUNDS_MASK;}if((this.mFlags&AnimationSet.PROPERTY_DURATION_MASK)==AnimationSet.PROPERTY_DURATION_MASK){this.mLastEnd=this.mStartOffset+this.mDuration;}else{if(this.mAnimations.size()==1){this.mDuration=a.getStartOffset()+a.getDuration();this.mLastEnd=this.mStartOffset+this.mDuration;}else{this.mLastEnd=Math.max(this.mLastEnd,a.getStartOffset()+a.getDuration());this.mDuration=this.mLastEnd-this.mStartOffset;}}this.mDirty=true;}},{key:'setStartTime',value:function setStartTime(startTimeMillis){_get2(AnimationSet.prototype.__proto__||Object.getPrototypeOf(AnimationSet.prototype),'setStartTime',this).call(this,startTimeMillis);var count=this.mAnimations.size();var animations=this.mAnimations;for(var i=0;i<count;i++){var _a5=animations.get(i);_a5.setStartTime(startTimeMillis);}}},{key:'getStartTime',value:function getStartTime(){var startTime=Long.MAX_VALUE;var count=this.mAnimations.size();var animations=this.mAnimations;for(var i=0;i<count;i++){var _a6=animations.get(i);startTime=Math.min(startTime,_a6.getStartTime());}return startTime;}},{key:'restrictDuration',value:function restrictDuration(durationMillis){_get2(AnimationSet.prototype.__proto__||Object.getPrototypeOf(AnimationSet.prototype),'restrictDuration',this).call(this,durationMillis);var animations=this.mAnimations;var count=animations.size();for(var i=0;i<count;i++){animations.get(i).restrictDuration(durationMillis);}}},{key:'getDuration',value:function getDuration(){var animations=this.mAnimations;var count=animations.size();var duration=0;var durationSet=(this.mFlags&AnimationSet.PROPERTY_DURATION_MASK)==AnimationSet.PROPERTY_DURATION_MASK;if(durationSet){duration=this.mDuration;}else{for(var i=0;i<count;i++){duration=Math.max(duration,animations.get(i).getDuration());}}return duration;}},{key:'computeDurationHint',value:function computeDurationHint(){var duration=0;var count=this.mAnimations.size();var animations=this.mAnimations;for(var i=count-1;i>=0;--i){var d=animations.get(i).computeDurationHint();if(d>duration)duration=d;}return duration;}},{key:'initializeInvalidateRegion',value:function initializeInvalidateRegion(left,top,right,bottom){var region=this.mPreviousRegion;region.set(left,top,right,bottom);region.inset(-1.0,-1.0);if(this.mFillBefore){var count=this.mAnimations.size();var animations=this.mAnimations;var temp=this.mTempTransformation;var previousTransformation=this.mPreviousTransformation;for(var i=count-1;i>=0;--i){var _a7=animations.get(i);if(!_a7.isFillEnabled()||_a7.getFillBefore()||_a7.getStartOffset()==0){temp.clear();var interpolator=_a7.mInterpolator;_a7.applyTransformation(interpolator!=null?interpolator.getInterpolation(0.0):0.0,temp);previousTransformation.compose(temp);}}}}},{key:'getTransformation',value:function getTransformation(currentTime,t){var count=this.mAnimations.size();var animations=this.mAnimations;var temp=this.mTempTransformation;var more=false;var started=false;var ended=true;t.clear();for(var i=count-1;i>=0;--i){var _a8=animations.get(i);temp.clear();more=_a8.getTransformation(currentTime,temp,this.getScaleFactor())||more;t.compose(temp);started=started||_a8.hasStarted();ended=_a8.hasEnded()&&ended;}if(started&&!this.mStarted){if(this.mListener!=null){this.mListener.onAnimationStart(this);}this.mStarted=true;}if(ended!=this.mEnded){if(this.mListener!=null){this.mListener.onAnimationEnd(this);}this.mEnded=ended;}return more;}},{key:'scaleCurrentDuration',value:function scaleCurrentDuration(scale){var animations=this.mAnimations;var count=animations.size();for(var i=0;i<count;i++){animations.get(i).scaleCurrentDuration(scale);}}},{key:'initialize',value:function initialize(width,height,parentWidth,parentHeight){_get2(AnimationSet.prototype.__proto__||Object.getPrototypeOf(AnimationSet.prototype),'initialize',this).call(this,width,height,parentWidth,parentHeight);var durationSet=(this.mFlags&AnimationSet.PROPERTY_DURATION_MASK)==AnimationSet.PROPERTY_DURATION_MASK;var fillAfterSet=(this.mFlags&AnimationSet.PROPERTY_FILL_AFTER_MASK)==AnimationSet.PROPERTY_FILL_AFTER_MASK;var fillBeforeSet=(this.mFlags&AnimationSet.PROPERTY_FILL_BEFORE_MASK)==AnimationSet.PROPERTY_FILL_BEFORE_MASK;var repeatModeSet=(this.mFlags&AnimationSet.PROPERTY_REPEAT_MODE_MASK)==AnimationSet.PROPERTY_REPEAT_MODE_MASK;var shareInterpolator=(this.mFlags&AnimationSet.PROPERTY_SHARE_INTERPOLATOR_MASK)==AnimationSet.PROPERTY_SHARE_INTERPOLATOR_MASK;var startOffsetSet=(this.mFlags&AnimationSet.PROPERTY_START_OFFSET_MASK)==AnimationSet.PROPERTY_START_OFFSET_MASK;if(shareInterpolator){this.ensureInterpolator();}var children=this.mAnimations;var count=children.size();var duration=this.mDuration;var fillAfter=this.mFillAfter;var fillBefore=this.mFillBefore;var repeatMode=this.mRepeatMode;var interpolator=this.mInterpolator;var startOffset=this.mStartOffset;var storedOffsets=this.mStoredOffsets;if(startOffsetSet){if(storedOffsets==null||storedOffsets.length!=count){storedOffsets=this.mStoredOffsets=androidui.util.ArrayCreator.newNumberArray(count);}}else if(storedOffsets!=null){storedOffsets=this.mStoredOffsets=null;}for(var i=0;i<count;i++){var _a9=children.get(i);if(durationSet){_a9.setDuration(duration);}if(fillAfterSet){_a9.setFillAfter(fillAfter);}if(fillBeforeSet){_a9.setFillBefore(fillBefore);}if(repeatModeSet){_a9.setRepeatMode(repeatMode);}if(shareInterpolator){_a9.setInterpolator(interpolator);}if(startOffsetSet){var offset=_a9.getStartOffset();_a9.setStartOffset(offset+startOffset);storedOffsets[i]=offset;}_a9.initialize(width,height,parentWidth,parentHeight);}}},{key:'reset',value:function reset(){_get2(AnimationSet.prototype.__proto__||Object.getPrototypeOf(AnimationSet.prototype),'reset',this).call(this);this.restoreChildrenStartOffset();}},{key:'restoreChildrenStartOffset',value:function restoreChildrenStartOffset(){var offsets=this.mStoredOffsets;if(offsets==null)return;var children=this.mAnimations;var count=children.size();for(var i=0;i<count;i++){children.get(i).setStartOffset(offsets[i]);}}},{key:'getAnimations',value:function getAnimations(){return this.mAnimations;}},{key:'willChangeTransformationMatrix',value:function willChangeTransformationMatrix(){return(this.mFlags&AnimationSet.PROPERTY_MORPH_MATRIX_MASK)==AnimationSet.PROPERTY_MORPH_MATRIX_MASK;}},{key:'willChangeBounds',value:function willChangeBounds(){return(this.mFlags&AnimationSet.PROPERTY_CHANGE_BOUNDS_MASK)==AnimationSet.PROPERTY_CHANGE_BOUNDS_MASK;}}]);return AnimationSet;}(Animation);AnimationSet.PROPERTY_FILL_AFTER_MASK=0x1;AnimationSet.PROPERTY_FILL_BEFORE_MASK=0x2;AnimationSet.PROPERTY_REPEAT_MODE_MASK=0x4;AnimationSet.PROPERTY_START_OFFSET_MASK=0x8;AnimationSet.PROPERTY_SHARE_INTERPOLATOR_MASK=0x10;AnimationSet.PROPERTY_DURATION_MASK=0x20;AnimationSet.PROPERTY_MORPH_MATRIX_MASK=0x40;AnimationSet.PROPERTY_CHANGE_BOUNDS_MASK=0x80;animation.AnimationSet=AnimationSet;})(animation=view.animation||(view.animation={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var animation;(function(animation){var AccelerateInterpolator=function(){function AccelerateInterpolator(){var factor=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;_classCallCheck(this,AccelerateInterpolator);this.mFactor=factor;this.mDoubleFactor=factor*2;}_createClass(AccelerateInterpolator,[{key:'getInterpolation',value:function getInterpolation(input){if(this.mFactor==1.0){return input*input;}else{return Math.pow(input,this.mDoubleFactor);}}}]);return AccelerateInterpolator;}();animation.AccelerateInterpolator=AccelerateInterpolator;})(animation=view.animation||(view.animation={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var animation;(function(animation){var AnticipateInterpolator=function(){function AnticipateInterpolator(){var tension=arguments.length>0&&arguments[0]!==undefined?arguments[0]:2;_classCallCheck(this,AnticipateInterpolator);this.mTension=tension;}_createClass(AnticipateInterpolator,[{key:'getInterpolation',value:function getInterpolation(t){return t*t*((this.mTension+1)*t-this.mTension);}}]);return AnticipateInterpolator;}();animation.AnticipateInterpolator=AnticipateInterpolator;})(animation=view.animation||(view.animation={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var animation;(function(animation){var AnticipateOvershootInterpolator=function(){function AnticipateOvershootInterpolator(){var tension=arguments.length>0&&arguments[0]!==undefined?arguments[0]:2;var extraTension=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1.5;_classCallCheck(this,AnticipateOvershootInterpolator);this.mTension=tension*extraTension;}_createClass(AnticipateOvershootInterpolator,[{key:'getInterpolation',value:function getInterpolation(t){if(t<0.5)return 0.5*AnticipateOvershootInterpolator.a(t*2.0,this.mTension);else return 0.5*(AnticipateOvershootInterpolator.o(t*2.0-2.0,this.mTension)+2.0);}}],[{key:'a',value:function a(t,s){return t*t*((s+1)*t-s);}},{key:'o',value:function o(t,s){return t*t*((s+1)*t+s);}}]);return AnticipateOvershootInterpolator;}();animation.AnticipateOvershootInterpolator=AnticipateOvershootInterpolator;})(animation=view.animation||(view.animation={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var animation;(function(animation){var BounceInterpolator=function(){function BounceInterpolator(){_classCallCheck(this,BounceInterpolator);}_createClass(BounceInterpolator,[{key:'getInterpolation',value:function getInterpolation(t){t*=1.1226;if(t<0.3535)return BounceInterpolator.bounce(t);else if(t<0.7408)return BounceInterpolator.bounce(t-0.54719)+0.7;else if(t<0.9644)return BounceInterpolator.bounce(t-0.8526)+0.9;else return BounceInterpolator.bounce(t-1.0435)+0.95;}}],[{key:'bounce',value:function bounce(t){return t*t*8.0;}}]);return BounceInterpolator;}();animation.BounceInterpolator=BounceInterpolator;})(animation=view.animation||(view.animation={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var animation;(function(animation){var CycleInterpolator=function(){function CycleInterpolator(mCycles){_classCallCheck(this,CycleInterpolator);this.mCycles=mCycles;}_createClass(CycleInterpolator,[{key:'getInterpolation',value:function getInterpolation(input){return Math.sin(2*this.mCycles*Math.PI*input);}}]);return CycleInterpolator;}();animation.CycleInterpolator=CycleInterpolator;})(animation=view.animation||(view.animation={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var animation;(function(animation){var OvershootInterpolator=function(){function OvershootInterpolator(){var tension=arguments.length>0&&arguments[0]!==undefined?arguments[0]:2;_classCallCheck(this,OvershootInterpolator);this.mTension=tension;}_createClass(OvershootInterpolator,[{key:'getInterpolation',value:function getInterpolation(t){t-=1.0;return t*t*((this.mTension+1)*t+this.mTension)+1.0;}}]);return OvershootInterpolator;}();animation.OvershootInterpolator=OvershootInterpolator;})(animation=view.animation||(view.animation={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var R;(function(R){var AccelerateDecelerateInterpolator=android.view.animation.AccelerateDecelerateInterpolator;var AccelerateInterpolator=android.view.animation.AccelerateInterpolator;var AnticipateInterpolator=android.view.animation.AnticipateInterpolator;var AnticipateOvershootInterpolator=android.view.animation.AnticipateOvershootInterpolator;var BounceInterpolator=android.view.animation.BounceInterpolator;var CycleInterpolator=android.view.animation.CycleInterpolator;var DecelerateInterpolator=android.view.animation.DecelerateInterpolator;var LinearInterpolator=android.view.animation.LinearInterpolator;var OvershootInterpolator=android.view.animation.OvershootInterpolator;var interpolator=function interpolator(){_classCallCheck(this,interpolator);};interpolator.accelerate_cubic=new AccelerateInterpolator(1.5);interpolator.accelerate_decelerate=new AccelerateDecelerateInterpolator();interpolator.accelerate_quad=new AccelerateInterpolator();interpolator.accelerate_quint=new AccelerateInterpolator(2.5);interpolator.anticipate_overshoot=new AnticipateOvershootInterpolator();interpolator.anticipate=new AnticipateInterpolator();interpolator.bounce=new BounceInterpolator();interpolator.cycle=new CycleInterpolator(1);interpolator.decelerate_cubic=new DecelerateInterpolator(1.5);interpolator.decelerate_quad=new DecelerateInterpolator();interpolator.decelerate_quint=new DecelerateInterpolator(2.5);interpolator.linear=new LinearInterpolator();interpolator.overshoot=new OvershootInterpolator();R.interpolator=interpolator;})(R=android.R||(android.R={}));})(android||(android={}));var android;(function(android){var R;(function(R){var Animation=android.view.animation.Animation;var AlphaAnimation=android.view.animation.AlphaAnimation;var TranslateAnimation=android.view.animation.TranslateAnimation;var ScaleAnimation=android.view.animation.ScaleAnimation;var AnimationSet=android.view.animation.AnimationSet;var anim=function(){function anim(){_classCallCheck(this,anim);}_createClass(anim,null,[{key:'activity_close_enter',get:function get(){var alpha=new AlphaAnimation(1,1);alpha.setDuration(300);alpha.setFillBefore(true);alpha.setFillEnabled(true);alpha.setFillAfter(true);return alpha;}},{key:'activity_close_exit',get:function get(){var animSet=new AnimationSet();var alpha=new AlphaAnimation(1,0);alpha.setDuration(300);alpha.setFillBefore(true);alpha.setFillEnabled(true);alpha.setFillAfter(true);alpha.setInterpolator(R.interpolator.decelerate_cubic);var scale=new ScaleAnimation(1,0.8,1,0.8,Animation.RELATIVE_TO_PARENT,0.5,Animation.RELATIVE_TO_PARENT,0.5);scale.setDuration(300);scale.setFillBefore(true);scale.setFillEnabled(true);scale.setFillAfter(true);scale.setInterpolator(R.interpolator.decelerate_cubic);animSet.addAnimation(alpha);animSet.addAnimation(scale);return animSet;}},{key:'activity_open_enter',get:function get(){var animSet=new AnimationSet();var alpha=new AlphaAnimation(0,1);alpha.setDuration(300);alpha.setFillBefore(false);alpha.setFillEnabled(true);alpha.setFillAfter(true);alpha.setInterpolator(R.interpolator.decelerate_cubic);var scale=new ScaleAnimation(0.8,1,0.8,1,Animation.RELATIVE_TO_PARENT,0.5,Animation.RELATIVE_TO_PARENT,0.5);scale.setDuration(300);scale.setFillBefore(false);scale.setFillEnabled(true);scale.setFillAfter(true);scale.setInterpolator(R.interpolator.decelerate_cubic);animSet.addAnimation(alpha);animSet.addAnimation(scale);return animSet;}},{key:'activity_open_exit',get:function get(){var alpha=new AlphaAnimation(1,0);alpha.setDuration(300);alpha.setFillBefore(false);alpha.setFillEnabled(true);alpha.setFillAfter(true);alpha.setInterpolator(R.interpolator.decelerate_quint);return alpha;}},{key:'activity_close_enter_ios',get:function get(){var anim=new TranslateAnimation(Animation.RELATIVE_TO_PARENT,-0.25,Animation.RELATIVE_TO_PARENT,0,0,0,0,0);anim.setDuration(300);return anim;}},{key:'activity_close_exit_ios',get:function get(){var anim=new TranslateAnimation(Animation.RELATIVE_TO_PARENT,0,Animation.RELATIVE_TO_PARENT,1,0,0,0,0);anim.setDuration(300);return anim;}},{key:'activity_open_enter_ios',get:function get(){var anim=new TranslateAnimation(Animation.RELATIVE_TO_PARENT,1,Animation.RELATIVE_TO_PARENT,0,0,0,0,0);anim.setDuration(300);return anim;}},{key:'activity_open_exit_ios',get:function get(){var anim=new TranslateAnimation(Animation.RELATIVE_TO_PARENT,0,Animation.RELATIVE_TO_PARENT,-0.25,0,0,0,0);anim.setDuration(300);return anim;}},{key:'dialog_enter',get:function get(){var animSet=new AnimationSet();var alpha=new AlphaAnimation(0,1);alpha.setDuration(150);alpha.setInterpolator(R.interpolator.decelerate_cubic);var scale=new ScaleAnimation(0.9,1,0.9,1,Animation.RELATIVE_TO_SELF,0.5,Animation.RELATIVE_TO_SELF,0.5);scale.setDuration(220);scale.setInterpolator(R.interpolator.decelerate_quint);animSet.addAnimation(scale);animSet.addAnimation(alpha);return animSet;}},{key:'dialog_exit',get:function get(){var animSet=new AnimationSet();var alpha=new AlphaAnimation(1,0);alpha.setDuration(150);alpha.setInterpolator(R.interpolator.decelerate_cubic);var scale=new ScaleAnimation(1,0.9,1,0.9,Animation.RELATIVE_TO_SELF,0.5,Animation.RELATIVE_TO_SELF,0.5);scale.setDuration(220);scale.setInterpolator(R.interpolator.decelerate_quint);animSet.addAnimation(scale);animSet.addAnimation(alpha);return animSet;}},{key:'fade_in',get:function get(){var alpha=new AlphaAnimation(0,1);alpha.setDuration(500);alpha.setInterpolator(R.interpolator.decelerate_quad);return alpha;}},{key:'fade_out',get:function get(){var alpha=new AlphaAnimation(1,0);alpha.setDuration(400);alpha.setInterpolator(R.interpolator.accelerate_quad);return alpha;}},{key:'toast_enter',get:function get(){var alpha=new AlphaAnimation(0,1);alpha.setDuration(500);alpha.setInterpolator(R.interpolator.decelerate_quad);return alpha;}},{key:'toast_exit',get:function get(){var alpha=new AlphaAnimation(1,0);alpha.setDuration(500);alpha.setInterpolator(R.interpolator.accelerate_quad);return alpha;}},{key:'grow_fade_in',get:function get(){var animSet=new AnimationSet();var alpha=new AlphaAnimation(0,1);alpha.setDuration(150);alpha.setInterpolator(R.interpolator.decelerate_cubic);var scale=new ScaleAnimation(0.9,1,0.9,1,Animation.RELATIVE_TO_SELF,0.5,Animation.RELATIVE_TO_SELF,0);scale.setDuration(220);scale.setInterpolator(R.interpolator.decelerate_quint);animSet.addAnimation(scale);animSet.addAnimation(alpha);return animSet;}},{key:'grow_fade_in_center',get:function get(){var animSet=new AnimationSet();var alpha=new AlphaAnimation(0,1);alpha.setDuration(150);alpha.setInterpolator(R.interpolator.decelerate_cubic);var scale=new ScaleAnimation(0.9,1,0.9,1,Animation.RELATIVE_TO_SELF,0.5,Animation.RELATIVE_TO_SELF,0.5);scale.setDuration(220);scale.setInterpolator(R.interpolator.decelerate_quint);animSet.addAnimation(scale);animSet.addAnimation(alpha);return animSet;}},{key:'grow_fade_in_from_bottom',get:function get(){var animSet=new AnimationSet();var alpha=new AlphaAnimation(0,1);alpha.setDuration(150);alpha.setInterpolator(R.interpolator.decelerate_cubic);var scale=new ScaleAnimation(0.9,1,0.9,1,Animation.RELATIVE_TO_SELF,0.5,Animation.RELATIVE_TO_SELF,1);scale.setDuration(220);scale.setInterpolator(R.interpolator.decelerate_quint);animSet.addAnimation(scale);animSet.addAnimation(alpha);return animSet;}},{key:'shrink_fade_out',get:function get(){var animSet=new AnimationSet();var alpha=new AlphaAnimation(1,0);alpha.setDuration(150);alpha.setInterpolator(R.interpolator.decelerate_cubic);var scale=new ScaleAnimation(1,0.9,1,0.9,Animation.RELATIVE_TO_SELF,0.5,Animation.RELATIVE_TO_SELF,0);scale.setDuration(220);scale.setInterpolator(R.interpolator.decelerate_quint);animSet.addAnimation(scale);animSet.addAnimation(alpha);return animSet;}},{key:'shrink_fade_out_center',get:function get(){var animSet=new AnimationSet();var alpha=new AlphaAnimation(1,0);alpha.setDuration(150);alpha.setInterpolator(R.interpolator.decelerate_cubic);var scale=new ScaleAnimation(1,0.9,1,0.9,Animation.RELATIVE_TO_SELF,0.5,Animation.RELATIVE_TO_SELF,0.5);scale.setDuration(220);scale.setInterpolator(R.interpolator.decelerate_quint);animSet.addAnimation(scale);animSet.addAnimation(alpha);return animSet;}},{key:'shrink_fade_out_from_bottom',get:function get(){var animSet=new AnimationSet();var alpha=new AlphaAnimation(1,0);alpha.setDuration(150);alpha.setInterpolator(R.interpolator.decelerate_cubic);var scale=new ScaleAnimation(1,0.9,1,0.9,Animation.RELATIVE_TO_SELF,0.5,Animation.RELATIVE_TO_SELF,1);scale.setDuration(220);scale.setInterpolator(R.interpolator.decelerate_quint);animSet.addAnimation(scale);animSet.addAnimation(alpha);return animSet;}}]);return anim;}();R.anim=anim;})(R=android.R||(android.R={}));})(android||(android={}));var android;(function(android){var view;(function(view_5){var MotionEvent=android.view.MotionEvent;var View=android.view.View;var ViewConfiguration=android.view.ViewConfiguration;var WindowManager=android.view.WindowManager;var FrameLayout=android.widget.FrameLayout;var Window=function(){function Window(context){_classCallCheck(this,Window);this.mIsActive=false;this.mCloseOnTouchOutside=false;this.mSetCloseOnTouchOutside=false;this.mWindowAttributes=new WindowManager.LayoutParams();this.mContext=context;this.initDecorView();this.initAttachInfo();this.getAttributes().setTitle(context.androidUI.appName);}_createClass(Window,[{key:'initDecorView',value:function initDecorView(){this.mDecor=new DecorView(this);this.mContentParent=new FrameLayout(this.mContext);this.mContentParent.setId(android.R.id.content);this.mDecor.addView(this.mContentParent,-1,-1);}},{key:'initAttachInfo',value:function initAttachInfo(){var viewRootImpl=this.mContext.androidUI._viewRootImpl;this.mAttachInfo=new View.AttachInfo(viewRootImpl,viewRootImpl.mHandler);this.mAttachInfo.mRootView=this.mDecor;this.mAttachInfo.mHasWindowFocus=true;}},{key:'getContext',value:function getContext(){return this.mContext;}},{key:'setContainer',value:function setContainer(container){this.mContainer=container;}},{key:'getContainer',value:function getContainer(){return this.mContainer;}},{key:'destroy',value:function destroy(){this.mDestroyed=true;}},{key:'isDestroyed',value:function isDestroyed(){return this.mDestroyed;}},{key:'setChildWindowManager',value:function setChildWindowManager(wm){if(this.mChildWindowManager){this.mDecor.removeView(this.mChildWindowManager.getWindowsLayout());}this.mChildWindowManager=wm;}},{key:'getChildWindowManager',value:function getChildWindowManager(){if(!this.mChildWindowManager){this.mChildWindowManager=new WindowManager(this.mContext);this.mDecor.addView(this.mChildWindowManager.getWindowsLayout(),-1,-1);}return this.mChildWindowManager;}},{key:'setCallback',value:function setCallback(callback){this.mCallback=callback;}},{key:'getCallback',value:function getCallback(){return this.mCallback;}},{key:'setFloating',value:function setFloating(isFloating){var attrs=this.getAttributes();if(isFloating===attrs.isFloating())return;if(isFloating)attrs.flags|=WindowManager.LayoutParams.FLAG_FLOATING;else attrs.flags&=~WindowManager.LayoutParams.FLAG_FLOATING;if(this.mCallback!=null){this.mCallback.onWindowAttributesChanged(attrs);}}},{key:'isFloating',value:function isFloating(){return this.mWindowAttributes.isFloating();}},{key:'setLayout',value:function setLayout(width,height){var attrs=this.getAttributes();attrs.width=width;attrs.height=height;if(this.mCallback!=null){this.mCallback.onWindowAttributesChanged(attrs);}}},{key:'setGravity',value:function setGravity(gravity){var attrs=this.getAttributes();attrs.gravity=gravity;if(this.mCallback!=null){this.mCallback.onWindowAttributesChanged(attrs);}}},{key:'setType',value:function setType(type){var attrs=this.getAttributes();attrs.type=type;if(this.mCallback!=null){this.mCallback.onWindowAttributesChanged(attrs);}}},{key:'setWindowAnimations',value:function setWindowAnimations(enterAnimation,exitAnimation){var resumeAnimation=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.mWindowAttributes.resumeAnimation;var hideAnimation=arguments.length>3&&arguments[3]!==undefined?arguments[3]:this.mWindowAttributes.hideAnimation;var attrs=this.getAttributes();attrs.enterAnimation=enterAnimation;attrs.exitAnimation=exitAnimation;attrs.resumeAnimation=resumeAnimation;attrs.hideAnimation=hideAnimation;if(this.mCallback!=null){this.mCallback.onWindowAttributesChanged(attrs);}}},{key:'addFlags',value:function addFlags(flags){this.setFlags(flags,flags);}},{key:'clearFlags',value:function clearFlags(flags){this.setFlags(0,flags);}},{key:'setFlags',value:function setFlags(flags,mask){var attrs=this.getAttributes();attrs.flags=attrs.flags&~mask|flags&mask;if(this.mCallback!=null){this.mCallback.onWindowAttributesChanged(attrs);}}},{key:'setDimAmount',value:function setDimAmount(amount){var attrs=this.getAttributes();attrs.dimAmount=amount;if(this.mCallback!=null){this.mCallback.onWindowAttributesChanged(attrs);}}},{key:'setAttributes',value:function setAttributes(a){this.mWindowAttributes.copyFrom(a);if(this.mCallback!=null){this.mCallback.onWindowAttributesChanged(this.mWindowAttributes);}}},{key:'getAttributes',value:function getAttributes(){return this.mWindowAttributes;}},{key:'setCloseOnTouchOutside',value:function setCloseOnTouchOutside(close){this.mCloseOnTouchOutside=close;this.mSetCloseOnTouchOutside=true;}},{key:'setCloseOnTouchOutsideIfNotSet',value:function setCloseOnTouchOutsideIfNotSet(close){if(!this.mSetCloseOnTouchOutside){this.mCloseOnTouchOutside=close;this.mSetCloseOnTouchOutside=true;}}},{key:'shouldCloseOnTouch',value:function shouldCloseOnTouch(context,event){if(this.mCloseOnTouchOutside&&event.getAction()==MotionEvent.ACTION_DOWN&&this.isOutOfBounds(context,event)&&this.peekDecorView()!=null){return true;}return false;}},{key:'isOutOfBounds',value:function isOutOfBounds(context,event){var x=Math.floor(event.getX());var y=Math.floor(event.getY());var slop=ViewConfiguration.get(context).getScaledWindowTouchSlop();var decorView=this.getDecorView();return x<-slop||y<-slop||x>decorView.getWidth()+slop||y>decorView.getHeight()+slop;}},{key:'makeActive',value:function makeActive(){if(this.mContainer!=null){if(this.mContainer.mActiveWindow!=null){this.mContainer.mActiveWindow.mIsActive=false;}this.mContainer.mActiveWindow=this;}this.mIsActive=true;this.onActive();}},{key:'isActive',value:function isActive(){return this.mIsActive;}},{key:'findViewById',value:function findViewById(id){return this.getDecorView().findViewById(id);}},{key:'setContentView',value:function setContentView(view,params){this.mContentParent.removeAllViews();this.addContentView(view,params);}},{key:'addContentView',value:function addContentView(view,params){if(params){this.mContentParent.addView(view,params);}else{this.mContentParent.addView(view);}var cb=this.getCallback();if(cb!=null&&!this.isDestroyed()){cb.onContentChanged();}}},{key:'getContentParent',value:function getContentParent(){return this.mContentParent;}},{key:'getCurrentFocus',value:function getCurrentFocus(){return this.mDecor!=null?this.mDecor.findFocus():null;}},{key:'getLayoutInflater',value:function getLayoutInflater(){return this.mContext.getLayoutInflater();}},{key:'setTitle',value:function setTitle(title){this.mDecor.bindElement.setAttribute('title',title);this.getAttributes().setTitle(title);}},{key:'setBackgroundDrawable',value:function setBackgroundDrawable(drawable){if(this.mDecor!=null){this.mDecor.setBackground(drawable);}}},{key:'setBackgroundColor',value:function setBackgroundColor(color){if(this.mDecor!=null){this.mDecor.setBackgroundColor(color);}}},{key:'takeKeyEvents',value:function takeKeyEvents(_get){this.mDecor.setFocusable(_get);}},{key:'superDispatchKeyEvent',value:function superDispatchKeyEvent(event){return this.mDecor.superDispatchKeyEvent(event);}},{key:'superDispatchTouchEvent',value:function superDispatchTouchEvent(event){return this.mDecor.superDispatchTouchEvent(event);}},{key:'superDispatchGenericMotionEvent',value:function superDispatchGenericMotionEvent(event){return this.mDecor.superDispatchGenericMotionEvent(event);}},{key:'getDecorView',value:function getDecorView(){return this.mDecor;}},{key:'peekDecorView',value:function peekDecorView(){return this.mDecor;}},{key:'onActive',value:function onActive(){}}]);return Window;}();view_5.Window=Window;var DecorView=function(_FrameLayout){_inherits(DecorView,_FrameLayout);function DecorView(window){_classCallCheck(this,DecorView);var _this68=_possibleConstructorReturn(this,(DecorView.__proto__||Object.getPrototypeOf(DecorView)).call(this,window.mContext));_this68._ignoreRequestLayoutInAnimation=true;_this68._pendingRequestLayoutOnAnimationEnd=false;_this68._ignoreInvalidateInAnimation=true;_this68._pendingInvalidateOnAnimationEnd=false;_this68.Window_this=window;_this68.bindElement.classList.add(window.mContext.constructor.name);_this68.setBackgroundColor(android.graphics.Color.WHITE);_this68.setIsRootNamespace(true);return _this68;}_createClass(DecorView,[{key:'invalidate',value:function invalidate(){var _get3;if(this._ignoreInvalidateInAnimation&&this.getAnimation()){this._pendingInvalidateOnAnimationEnd=true;return null;}for(var _len20=arguments.length,args=Array(_len20),_key21=0;_key21<_len20;_key21++){args[_key21]=arguments[_key21];}(_get3=_get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'invalidate',this)).call.apply(_get3,[this].concat(args));}},{key:'invalidateChild',value:function invalidateChild(child,dirty){if(this._ignoreInvalidateInAnimation&&this.getAnimation()){this._pendingInvalidateOnAnimationEnd=true;return null;}_get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'invalidateChild',this).call(this,child,dirty);}},{key:'invalidateChildFast',value:function invalidateChildFast(child,dirty){if(this._ignoreInvalidateInAnimation&&this.getAnimation()){this._pendingInvalidateOnAnimationEnd=true;return null;}_get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'invalidateChildFast',this).call(this,child,dirty);}},{key:'requestLayout',value:function requestLayout(){if(this._ignoreRequestLayoutInAnimation&&this.getAnimation()){this._pendingRequestLayoutOnAnimationEnd=true;return null;}_get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'requestLayout',this).call(this);}},{key:'onAnimationStart',value:function onAnimationStart(){_get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'onAnimationStart',this).call(this);this.setDrawingCacheEnabled(true);this.buildDrawingCache(true);}},{key:'onAnimationEnd',value:function onAnimationEnd(){_get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'onAnimationEnd',this).call(this);this.setDrawingCacheEnabled(false);if(this._pendingInvalidateOnAnimationEnd){this._pendingInvalidateOnAnimationEnd=false;this.invalidate();}if(this._pendingRequestLayoutOnAnimationEnd){this._pendingRequestLayoutOnAnimationEnd=false;this.requestLayout();}}},{key:'buildDrawingCache',value:function buildDrawingCache(){var autoScale=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(this.getAnimation()&&this.mUnscaledDrawingCache)return;_get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'buildDrawingCache',this).call(this,autoScale);}},{key:'drawFromParent',value:function drawFromParent(canvas,parent,drawingTime){var windowAnimation=this.getAnimation();var wparams=this.getLayoutParams();var shadowAlpha=wparams.dimAmount*255;if(windowAnimation!=null&&shadowAlpha){var duration=windowAnimation.getDuration();var startTime=windowAnimation.getStartTime();if(startTime<0)startTime=drawingTime;var startOffset=windowAnimation.getStartOffset();var normalizedTime=void 0;if(duration!=0){normalizedTime=(drawingTime-(startTime+startOffset))/duration;normalizedTime=Math.max(Math.min(normalizedTime,1.0),0.0);}else{normalizedTime=drawingTime<startTime?0.0:1.0;}var interpolatedTime=windowAnimation.getInterpolator().getInterpolation(normalizedTime);if(windowAnimation===wparams.exitAnimation){shadowAlpha=shadowAlpha*(1-interpolatedTime);if(!windowAnimation.hasEnded())parent.invalidate();}else if(windowAnimation===wparams.enterAnimation){shadowAlpha=shadowAlpha*interpolatedTime;if(!windowAnimation.hasEnded())parent.invalidate();}}if((windowAnimation!=null||wparams.isFloating())&&shadowAlpha){canvas.drawColor(android.graphics.Color.argb(shadowAlpha,0,0,0));}return _get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'drawFromParent',this).call(this,canvas,parent,drawingTime);}},{key:'tagName',value:function tagName(){return'Window';}},{key:'dispatchKeyEvent',value:function dispatchKeyEvent(event){var count=this.getChildCount();for(var i=count-1;i>=0;i--){var child=this.getChildAt(i);if(child instanceof WindowManager.Layout&&child.dispatchKeyEvent(event)){return true;}}var action=event.getAction();if(!this.Window_this.isDestroyed()){var cb=this.Window_this.getCallback();var handled=cb!=null?cb.dispatchKeyEvent(event):_get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'dispatchKeyEvent',this).call(this,event);if(handled){return true;}}return _get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'dispatchKeyEvent',this).call(this,event);}},{key:'dispatchTouchEvent',value:function dispatchTouchEvent(ev){var wparams=this.getLayoutParams();var cb=this.Window_this.getCallback();var outside=this.Window_this.isOutOfBounds(this.getContext(),ev);if(outside&&!wparams.isTouchModal()){if(wparams.isWatchTouchOutside()&&ev.getAction()==android.view.MotionEvent.ACTION_DOWN){var action=ev.getAction();ev.setAction(android.view.MotionEvent.ACTION_OUTSIDE);if(cb!=null&&!this.Window_this.isDestroyed()){cb.dispatchTouchEvent(ev);}else{_get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'dispatchTouchEvent',this).call(this,ev);}ev.setAction(action);}return false;}cb!=null&&!this.Window_this.isDestroyed()?cb.dispatchTouchEvent(ev):_get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'dispatchTouchEvent',this).call(this,ev);return true;}},{key:'dispatchGenericMotionEvent',value:function dispatchGenericMotionEvent(ev){var cb=this.Window_this.getCallback();return cb!=null&&!this.Window_this.isDestroyed()?cb.dispatchGenericMotionEvent(ev):_get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'dispatchGenericMotionEvent',this).call(this,ev);}},{key:'superDispatchKeyEvent',value:function superDispatchKeyEvent(event){return _get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'dispatchKeyEvent',this).call(this,event);}},{key:'superDispatchTouchEvent',value:function superDispatchTouchEvent(event){return _get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'dispatchTouchEvent',this).call(this,event);}},{key:'superDispatchGenericMotionEvent',value:function superDispatchGenericMotionEvent(event){return _get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'dispatchGenericMotionEvent',this).call(this,event);}},{key:'onTouchEvent',value:function onTouchEvent(event){return this.onInterceptTouchEvent(event);}},{key:'onVisibilityChanged',value:function onVisibilityChanged(changedView,visibility){this.Window_this.mAttachInfo.mWindowVisibility=visibility;this.dispatchWindowVisibilityChanged(visibility);_get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'onVisibilityChanged',this).call(this,changedView,visibility);}},{key:'onWindowFocusChanged',value:function onWindowFocusChanged(hasWindowFocus){this.Window_this.mAttachInfo.mHasWindowFocus=hasWindowFocus;_get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'onWindowFocusChanged',this).call(this,hasWindowFocus);var cb=this.Window_this.getCallback();if(cb!=null&&!this.Window_this.isDestroyed()){cb.onWindowFocusChanged(hasWindowFocus);}}},{key:'onAttachedToWindow',value:function onAttachedToWindow(){this.Window_this.mAttachInfo.mWindowVisibility=this.getVisibility();_get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'onAttachedToWindow',this).call(this);var cb=this.Window_this.getCallback();if(cb!=null&&!this.Window_this.isDestroyed()){cb.onAttachedToWindow();}}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){_get2(DecorView.prototype.__proto__||Object.getPrototypeOf(DecorView.prototype),'onDetachedFromWindow',this).call(this);var cb=this.Window_this.getCallback();if(cb!=null&&!this.Window_this.isDestroyed()){cb.onDetachedFromWindow();}}}]);return DecorView;}(FrameLayout);})(view=android.view||(android.view={}));})(android||(android={}));var PageStack;(function(PageStack){PageStack.DEBUG=false;var history_go=history.go;var iFrameHistoryLengthAsFake=0;var historyLocking=false;var windowLoadLocking=true;var pendingFuncLock=[];var initCalled=false;function init(){initCalled=true;_init();history.go=function(delta){PageStack.go(delta);};history.back=function(){var delta=arguments.length>0&&arguments[0]!==undefined?arguments[0]:-1;PageStack.go(delta);};history.forward=function(){var delta=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;PageStack.go(delta);};}PageStack.init=init;function checkInitCalled(){if(!initCalled)throw Error(\"PageStack.init() must be call first\");}function _init(){PageStack.currentStack=history.state;if(PageStack.currentStack&&!PageStack.currentStack.isRoot){console.log('already has history.state when _init PageState, restore page');restorePageFromStackIfNeed();}else{PageStack.currentStack=PageStack.currentStack||{pageId:'',isRoot:true,stack:[{pageId:null}]};var initOpenUrl=location.hash;if(initOpenUrl&&initOpenUrl.indexOf('#')===0)initOpenUrl=initOpenUrl.substring(1);removeLastHistoryIfFaked();ensureLockDo(function(){history.replaceState(PageStack.currentStack,null,'#');});if(initOpenUrl&&initOpenUrl.length>0){if(firePagePush(initOpenUrl,null)){notifyNewPageOpened(initOpenUrl);}}}ensureLastHistoryFaked();if(document.readyState==='complete'){windowLoadLocking=false;setTimeout(initOnpopstate,0);}else{window.addEventListener('load',function(){windowLoadLocking=false;window.removeEventListener('popstate',onpopstateListener);setTimeout(initOnpopstate,0);});}}var onpopstateListener=function onpopstateListener(ev){var stack=ev.state;if(historyLocking){PageStack.currentStack=stack;return;}if(PageStack.DEBUG)console.log('onpopstate',stack);if(!stack){var _pageId=location.hash;if(_pageId[0]==='#')_pageId=_pageId.substring(1);historyGo(-2,false);if(firePagePush(_pageId,null)){notifyNewPageOpened(_pageId);}else{ensureLastHistoryFaked();}}else if(PageStack.currentStack.stack.length!=stack.stack.length){var delta=stack.stack.length-PageStack.currentStack.stack.length;if(delta>=0){console.warn('something error! stack: ',stack,'last stack: ',PageStack.currentStack);return;}var stackList=PageStack.currentStack.stack;PageStack.currentStack=stack;tryClosePageAfterHistoryChanged(stackList,delta);}else{PageStack.currentStack=stack;if(fireBackPressed()){ensureLastHistoryFaked();}else{var stackList=PageStack.currentStack.stack;var pageId=stackList[stackList.length-1].pageId;if(firePageClose(pageId,stackList[stackList.length-1].extra)){historyGo(-1);}else{ensureLastHistoryFaked();}}}};function initOnpopstate(){window.removeEventListener('popstate',onpopstateListener);window.addEventListener('popstate',onpopstateListener);}function go(delta){var pageAlreadyClose=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;checkInitCalled();if(historyLocking){ensureLockDo(function(){go(delta);});return;}var stackList=PageStack.currentStack.stack;if(delta===-1&&!pageAlreadyClose){if(!firePageClose(stackList[stackList.length-1].pageId,stackList[stackList.length-1].extra)){return;}}removeLastHistoryIfFaked();historyGo(delta);if(delta<-1&&!pageAlreadyClose){ensureLockDo(function(){tryClosePageAfterHistoryChanged(stackList,delta);});}}PageStack.go=go;function tryClosePageAfterHistoryChanged(stateListBeforeHistoryChange,delta){var historyLength=stateListBeforeHistoryChange.length;for(var i=historyLength+delta;i<historyLength;i++){var state=stateListBeforeHistoryChange[i];if(!firePageClose(state.pageId,state.extra)){notifyNewPageOpened(state.pageId,state.extra);}}}function back(){var pageAlreadyClose=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;checkInitCalled();go(-1,pageAlreadyClose);}PageStack.back=back;function openPage(pageId,extra){checkInitCalled();pageId+='';var openResult=firePageOpen(pageId,extra);if(openResult){notifyNewPageOpened(pageId,extra);}return openResult;}PageStack.openPage=openPage;function backToPage(pageId){checkInitCalled();if(PageStack.DEBUG)console.log('backToPage',pageId);if(historyLocking){ensureLockDo(function(){backToPage(pageId);});}var stackList=PageStack.currentStack.stack;var historyLength=stackList.length;for(var i=historyLength-1;i>=0;i--){var state=stackList[i];if(state.pageId==pageId){var delta=i-historyLength;removeLastHistoryIfFaked();historyGo(delta);return;}}}PageStack.backToPage=backToPage;var releaseLockingTimeout=void 0;var requestHistoryGoWhenLocking=0;var ensureFakeAfterHistoryChange=false;function historyGo(delta){var ensureFaked=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;if(delta>=0)return;if(history.length===1)return;ensureFakeAfterHistoryChange=ensureFakeAfterHistoryChange||ensureFaked;if(historyLocking){requestHistoryGoWhenLocking+=delta;return;}if(PageStack.DEBUG)console.log('historyGo',delta);historyLocking=true;var state=history.state;if(releaseLockingTimeout)clearTimeout(releaseLockingTimeout);function checkRelease(){clearTimeout(releaseLockingTimeout);if(history.state===state){releaseLockingTimeout=setTimeout(checkRelease,0);}else{var continueGo=requestHistoryGoWhenLocking;if(continueGo!=0){requestHistoryGoWhenLocking=0;historyLocking=false;historyGo(continueGo,false);}else{if(ensureFakeAfterHistoryChange)ensureLastHistoryFakedImpl();ensureFakeAfterHistoryChange=false;releaseLockingTimeout=setTimeout(function(){historyLocking=false;},10);}}}releaseLockingTimeout=setTimeout(checkRelease,0);history_go.call(history,delta);}PageStack.historyGo=historyGo;function restorePageFromStackIfNeed(){if(PageStack.currentStack){var copy=PageStack.currentStack.stack.concat();copy.shift();var _iteratorNormalCompletion49=true;var _didIteratorError49=false;var _iteratorError49=undefined;try{for(var _iterator49=copy[Symbol.iterator](),_step49;!(_iteratorNormalCompletion49=(_step49=_iterator49.next()).done);_iteratorNormalCompletion49=true){var saveState=_step49.value;firePageOpen(saveState.pageId,saveState.extra,true);}}catch(err){_didIteratorError49=true;_iteratorError49=err;}finally{try{if(!_iteratorNormalCompletion49&&_iterator49.return){_iterator49.return();}}finally{if(_didIteratorError49){throw _iteratorError49;}}}}}function fireBackPressed(){if(PageStack.backListener){try{return PageStack.backListener();}catch(e){console.error(e);}}}function firePageOpen(pageId,pageExtra){var isRestore=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(PageStack.pageOpenHandler){try{return PageStack.pageOpenHandler(pageId,pageExtra,isRestore);}catch(e){console.error(e);}}}function firePagePush(pageId,pageExtra){if(PageStack.pagePushHandler){try{return PageStack.pagePushHandler(pageId,pageExtra);}catch(e){console.error(e);}}}function firePageClose(pageId,pageExtra){if(PageStack.pageCloseHandler){try{return PageStack.pageCloseHandler(pageId,pageExtra);}catch(e){console.error(e);}}}function notifyPageClosed(pageId){checkInitCalled();if(PageStack.DEBUG)console.log('notifyPageClosed',pageId);if(historyLocking){ensureLockDo(function(){notifyPageClosed(pageId);});return;}var stackList=PageStack.currentStack.stack;var historyLength=stackList.length;for(var i=historyLength-1;i>=0;i--){var state=stackList[i];if(state.pageId==pageId){if(i===historyLength-1){removeLastHistoryIfFaked();historyGo(-1);}else{var delta=i-historyLength;(function(delta){removeLastHistoryIfFaked();historyGo(delta);ensureLockDoAtFront(function(){var historyLength=stackList.length;var pageStartAddIndex=historyLength+delta+1;for(var j=pageStartAddIndex;j<historyLength;j++){notifyNewPageOpened(stackList[j].pageId,stackList[j].extra);}});})(delta);}return;}}}PageStack.notifyPageClosed=notifyPageClosed;function notifyNewPageOpened(pageId,extra){checkInitCalled();if(PageStack.DEBUG)console.log('notifyNewPageOpened',pageId);var state={pageId:pageId,extra:extra};ensureLockDo(function(){PageStack.currentStack.stack.push(state);PageStack.currentStack.pageId=pageId;PageStack.currentStack.isRoot=false;if(history.state.isFake){history.replaceState(PageStack.currentStack,null,'#'+pageId);}else{history.pushState(PageStack.currentStack,null,'#'+pageId);}ensureLastHistoryFakedImpl();});}PageStack.notifyNewPageOpened=notifyNewPageOpened;function getPageExtra(pageId){checkInitCalled();var stackList=PageStack.currentStack.stack;var historyLength=stackList.length;if(!pageId){return stackList[historyLength-1].extra;}else{for(var i=historyLength-1;i>=0;i--){var state=stackList[i];if(state.pageId==pageId){return state.extra;}}}}PageStack.getPageExtra=getPageExtra;function setPageExtra(extra,pageId){checkInitCalled();removeLastHistoryIfFaked();ensureLockDo(function(){var stackList=PageStack.currentStack.stack;var historyLength=stackList.length;if(!pageId){stackList[historyLength-1].extra=extra;history.replaceState(PageStack.currentStack,null,'');}else{for(var i=historyLength-1;i>=0;i--){var state=stackList[i];if(state.pageId==pageId){state.extra=extra;history.replaceState(PageStack.currentStack,null,'');break;}}}ensureLastHistoryFakedImpl();});}PageStack.setPageExtra=setPageExtra;function ensureLockDo(func){checkInitCalled();if(!historyLocking&&!windowLoadLocking){func();return;}pendingFuncLock.push(func);_queryLockDo();}function ensureLockDoAtFront(func){var runNowIfNotLock=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;checkInitCalled();if(!historyLocking&&!windowLoadLocking&&runNowIfNotLock){func();return;}pendingFuncLock.splice(0,0,func);_queryLockDo();}var execLockedTimeoutId=void 0;function _queryLockDo(){if(execLockedTimeoutId)clearTimeout(execLockedTimeoutId);function execLockedFunctions(){if(historyLocking||windowLoadLocking){clearTimeout(execLockedTimeoutId);execLockedTimeoutId=setTimeout(execLockedFunctions,0);}else{var f=void 0;while(f=pendingFuncLock.shift()){f();if(historyLocking||windowLoadLocking){clearTimeout(execLockedTimeoutId);execLockedTimeoutId=setTimeout(execLockedFunctions,0);break;}}}}execLockedTimeoutId=setTimeout(execLockedFunctions,0);}function preClosePageHasIFrame(historyLengthWhenInitIFrame){history.pushState({isFake:true},null,null);iFrameHistoryLengthAsFake=history.length-historyLengthWhenInitIFrame;}PageStack.preClosePageHasIFrame=preClosePageHasIFrame;function removeLastHistoryIfFaked(){ensureLockDo(removeLastHistoryIfFakedImpl);}function removeLastHistoryIfFakedImpl(){if(history.state&&history.state.isFake){if(PageStack.DEBUG)console.log('remove Fake History');history.replaceState(null,null,'');historyGo(-1-iFrameHistoryLengthAsFake,false);iFrameHistoryLengthAsFake=0;}}function ensureLastHistoryFaked(){ensureLockDo(ensureLastHistoryFakedImpl);}function ensureLastHistoryFakedImpl(){if(!history.state.isFake){if(PageStack.DEBUG)console.log('append Fake History');history.pushState({isFake:true,isRoot:PageStack.currentStack.isRoot,stack:PageStack.currentStack.stack},null,'');}}})(PageStack||(PageStack={}));var android;(function(android){var app;(function(app){var Bundle=android.os.Bundle;var Intent=android.content.Intent;var View=android.view.View;var ActivityThread=function(){function ActivityThread(androidUI){_classCallCheck(this,ActivityThread);this.mLaunchedActivities=new Set();this.androidUI=androidUI;}_createClass(ActivityThread,[{key:'initWithPageStack',value:function initWithPageStack(){var _this69=this;var backKeyDownEvent=android.view.KeyEvent.obtain(android.view.KeyEvent.ACTION_DOWN,android.view.KeyEvent.KEYCODE_BACK);var backKeyUpEvent=android.view.KeyEvent.obtain(android.view.KeyEvent.ACTION_UP,android.view.KeyEvent.KEYCODE_BACK);PageStack.backListener=function(){var handleDown=_this69.androidUI._viewRootImpl.dispatchInputEvent(backKeyDownEvent);var handleUp=_this69.androidUI._viewRootImpl.dispatchInputEvent(backKeyUpEvent);return handleDown||handleUp;};PageStack.pageOpenHandler=function(pageId,pageExtra,isRestore){var intent=new Intent(pageId);if(pageExtra)intent.mExtras=new Bundle(pageExtra.mExtras);if(isRestore)_this69.overrideNextWindowAnimation(null,null,null,null);var activity=_this69.handleLaunchActivity(intent);return activity&&!activity.mFinished;};PageStack.pageCloseHandler=function(pageId,pageExtra){if(_this69.mLaunchedActivities.size===1){var rootActivity=Array.from(_this69.mLaunchedActivities)[0];if(pageId==null||rootActivity.getIntent().activityName==pageId){_this69.handleDestroyActivity(rootActivity,true);return true;}return false;}var _iteratorNormalCompletion50=true;var _didIteratorError50=false;var _iteratorError50=undefined;try{for(var _iterator50=Array.from(_this69.mLaunchedActivities).reverse()[Symbol.iterator](),_step50;!(_iteratorNormalCompletion50=(_step50=_iterator50.next()).done);_iteratorNormalCompletion50=true){var activity=_step50.value;var intent=activity.getIntent();if(intent.activityName==pageId){_this69.handleDestroyActivity(activity,true);return true;}}}catch(err){_didIteratorError50=true;_iteratorError50=err;}finally{try{if(!_iteratorNormalCompletion50&&_iterator50.return){_iterator50.return();}}finally{if(_didIteratorError50){throw _iteratorError50;}}}};PageStack.init();}},{key:'overrideNextWindowAnimation',value:function overrideNextWindowAnimation(enterAnimation,exitAnimation,resumeAnimation,hideAnimation){this.overrideEnterAnimation=enterAnimation;this.overrideExitAnimation=exitAnimation;this.overrideResumeAnimation=resumeAnimation;this.overrideHideAnimation=hideAnimation;}},{key:'getOverrideEnterAnimation',value:function getOverrideEnterAnimation(){return this.overrideEnterAnimation;}},{key:'getOverrideExitAnimation',value:function getOverrideExitAnimation(){return this.overrideExitAnimation;}},{key:'getOverrideResumeAnimation',value:function getOverrideResumeAnimation(){return this.overrideResumeAnimation;}},{key:'getOverrideHideAnimation',value:function getOverrideHideAnimation(){return this.overrideHideAnimation;}},{key:'scheduleApplicationHide',value:function scheduleApplicationHide(){var _this70=this;if(this.scheduleApplicationHideTimeout)clearTimeout(this.scheduleApplicationHideTimeout);this.scheduleApplicationHideTimeout=setTimeout(function(){var visibleActivities=_this70.getVisibleToUserActivities();if(visibleActivities.length==0)return;_this70.handlePauseActivity(visibleActivities[visibleActivities.length-1]);var _iteratorNormalCompletion51=true;var _didIteratorError51=false;var _iteratorError51=undefined;try{for(var _iterator51=visibleActivities[Symbol.iterator](),_step51;!(_iteratorNormalCompletion51=(_step51=_iterator51.next()).done);_iteratorNormalCompletion51=true){var visibleActivity=_step51.value;_this70.handleStopActivity(visibleActivity,true);}}catch(err){_didIteratorError51=true;_iteratorError51=err;}finally{try{if(!_iteratorNormalCompletion51&&_iterator51.return){_iterator51.return();}}finally{if(_didIteratorError51){throw _iteratorError51;}}}},0);}},{key:'scheduleApplicationShow',value:function scheduleApplicationShow(){this.scheduleActivityResume();}},{key:'execStartActivity',value:function execStartActivity(callActivity,intent,options){if((intent.getFlags()&Intent.FLAG_ACTIVITY_CLEAR_TOP)!=0){if(this.scheduleBackTo(intent))return;}this.scheduleLaunchActivity(callActivity,intent,options);}},{key:'scheduleActivityResume',value:function scheduleActivityResume(){var _this71=this;if(this.activityResumeTimeout)clearTimeout(this.activityResumeTimeout);this.activityResumeTimeout=setTimeout(function(){var visibleActivities=_this71.getVisibleToUserActivities();if(visibleActivities.length==0)return;var _iteratorNormalCompletion52=true;var _didIteratorError52=false;var _iteratorError52=undefined;try{for(var _iterator52=visibleActivities[Symbol.iterator](),_step52;!(_iteratorNormalCompletion52=(_step52=_iterator52.next()).done);_iteratorNormalCompletion52=true){var _visibleActivity=_step52.value;_visibleActivity.performRestart();}}catch(err){_didIteratorError52=true;_iteratorError52=err;}finally{try{if(!_iteratorNormalCompletion52&&_iterator52.return){_iterator52.return();}}finally{if(_didIteratorError52){throw _iteratorError52;}}}var activity=visibleActivities.pop();_this71.handleResumeActivity(activity,false);if(activity.getWindow().isFloating()){var _iteratorNormalCompletion53=true;var _didIteratorError53=false;var _iteratorError53=undefined;try{for(var _iterator53=visibleActivities.reverse()[Symbol.iterator](),_step53;!(_iteratorNormalCompletion53=(_step53=_iterator53.next()).done);_iteratorNormalCompletion53=true){var visibleActivity=_step53.value;if(visibleActivity.mVisibleFromClient){visibleActivity.makeVisible();if(!visibleActivity.getWindow().isFloating()){break;}}}}catch(err){_didIteratorError53=true;_iteratorError53=err;}finally{try{if(!_iteratorNormalCompletion53&&_iterator53.return){_iterator53.return();}}finally{if(_didIteratorError53){throw _iteratorError53;}}}}},0);}},{key:'scheduleLaunchActivity',value:function scheduleLaunchActivity(callActivity,intent,options){var activity=this.handleLaunchActivity(intent);activity.mCallActivity=callActivity;if(activity&&!activity.mFinished){PageStack.notifyNewPageOpened(intent.activityName,intent);}}},{key:'scheduleDestroyActivityByRequestCode',value:function scheduleDestroyActivityByRequestCode(requestCode){var _iteratorNormalCompletion54=true;var _didIteratorError54=false;var _iteratorError54=undefined;try{for(var _iterator54=Array.from(this.mLaunchedActivities).reverse()[Symbol.iterator](),_step54;!(_iteratorNormalCompletion54=(_step54=_iterator54.next()).done);_iteratorNormalCompletion54=true){var activity=_step54.value;if(activity.getIntent()&&requestCode==activity.getIntent().mRequestCode){this.scheduleDestroyActivity(activity);}}}catch(err){_didIteratorError54=true;_iteratorError54=err;}finally{try{if(!_iteratorNormalCompletion54&&_iterator54.return){_iterator54.return();}}finally{if(_didIteratorError54){throw _iteratorError54;}}}}},{key:'scheduleDestroyActivity',value:function scheduleDestroyActivity(activity){var _this72=this;var finishing=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;setTimeout(function(){var isCreateSuc=_this72.mLaunchedActivities.has(activity);if(activity.mCallActivity&&activity.getIntent()&&activity.getIntent().mRequestCode>=0){activity.mCallActivity.dispatchActivityResult(null,activity.getIntent().mRequestCode,activity.mResultCode,activity.mResultData);}_this72.handleDestroyActivity(activity,finishing);if(!isCreateSuc)return;if(_this72.mLaunchedActivities.size==0){if(history.length<=2){_this72.androidUI.showAppClosed();}else{PageStack.back(true);}}else if(activity.getIntent()){PageStack.notifyPageClosed(activity.getIntent().activityName);}},0);}},{key:'scheduleBackTo',value:function scheduleBackTo(intent){var destroyList=[];var findActivity=false;var _iteratorNormalCompletion55=true;var _didIteratorError55=false;var _iteratorError55=undefined;try{for(var _iterator55=Array.from(this.mLaunchedActivities).reverse()[Symbol.iterator](),_step55;!(_iteratorNormalCompletion55=(_step55=_iterator55.next()).done);_iteratorNormalCompletion55=true){var _activity=_step55.value;if(_activity.getIntent()&&_activity.getIntent().activityName==intent.activityName){findActivity=true;break;}destroyList.push(_activity);}}catch(err){_didIteratorError55=true;_iteratorError55=err;}finally{try{if(!_iteratorNormalCompletion55&&_iterator55.return){_iterator55.return();}}finally{if(_didIteratorError55){throw _iteratorError55;}}}if(findActivity){var _iteratorNormalCompletion56=true;var _didIteratorError56=false;var _iteratorError56=undefined;try{for(var _iterator56=destroyList[Symbol.iterator](),_step56;!(_iteratorNormalCompletion56=(_step56=_iterator56.next()).done);_iteratorNormalCompletion56=true){var activity=_step56.value;this.scheduleDestroyActivity(activity);}}catch(err){_didIteratorError56=true;_iteratorError56=err;}finally{try{if(!_iteratorNormalCompletion56&&_iterator56.return){_iterator56.return();}}finally{if(_didIteratorError56){throw _iteratorError56;}}}return true;}return false;}},{key:'canBackTo',value:function canBackTo(intent){var _iteratorNormalCompletion57=true;var _didIteratorError57=false;var _iteratorError57=undefined;try{for(var _iterator57=this.mLaunchedActivities[Symbol.iterator](),_step57;!(_iteratorNormalCompletion57=(_step57=_iterator57.next()).done);_iteratorNormalCompletion57=true){var activity=_step57.value;if(activity.getIntent().activityName==intent.activityName){return true;}}}catch(err){_didIteratorError57=true;_iteratorError57=err;}finally{try{if(!_iteratorNormalCompletion57&&_iterator57.return){_iterator57.return();}}finally{if(_didIteratorError57){throw _iteratorError57;}}}return false;}},{key:'scheduleBackToRoot',value:function scheduleBackToRoot(){var destroyList=Array.from(this.mLaunchedActivities).reverse();destroyList.shift();var _iteratorNormalCompletion58=true;var _didIteratorError58=false;var _iteratorError58=undefined;try{for(var _iterator58=destroyList[Symbol.iterator](),_step58;!(_iteratorNormalCompletion58=(_step58=_iterator58.next()).done);_iteratorNormalCompletion58=true){var activity=_step58.value;this.scheduleDestroyActivity(activity);}}catch(err){_didIteratorError58=true;_iteratorError58=err;}finally{try{if(!_iteratorNormalCompletion58&&_iterator58.return){_iterator58.return();}}finally{if(_didIteratorError58){throw _iteratorError58;}}}}},{key:'handlePauseActivity',value:function handlePauseActivity(activity){this.performPauseActivity(activity);}},{key:'performPauseActivity',value:function performPauseActivity(activity){activity.performPause();}},{key:'handleStopActivity',value:function handleStopActivity(activity){var show=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.performStopActivity(activity,true);this.updateVisibility(activity,show);}},{key:'performStopActivity',value:function performStopActivity(activity,saveState){if(!activity.mFinished&&saveState){var state=new Bundle();activity.performSaveInstanceState(state);}activity.performStop();}},{key:'handleResumeActivity',value:function handleResumeActivity(a,launching){this.performResumeActivity(a,launching);var willBeVisible=!a.mStartedActivity&&!a.mFinished;if(willBeVisible&&a.mVisibleFromClient){a.makeVisible();this.overrideEnterAnimation=undefined;this.overrideExitAnimation=undefined;this.overrideResumeAnimation=undefined;this.overrideHideAnimation=undefined;}}},{key:'performResumeActivity',value:function performResumeActivity(a,launching){if(!launching){a.mStartedActivity=false;}a.performResume();}},{key:'handleLaunchActivity',value:function handleLaunchActivity(intent){var visibleActivities=this.getVisibleToUserActivities();var a=this.performLaunchActivity(intent);if(a){this.handleResumeActivity(a,true);if(!a.mFinished&&visibleActivities.length>0){this.handlePauseActivity(visibleActivities[visibleActivities.length-1]);if(!a.getWindow().getAttributes().isFloating()){var _iteratorNormalCompletion59=true;var _didIteratorError59=false;var _iteratorError59=undefined;try{for(var _iterator59=visibleActivities[Symbol.iterator](),_step59;!(_iteratorNormalCompletion59=(_step59=_iterator59.next()).done);_iteratorNormalCompletion59=true){var visibleActivity=_step59.value;this.handleStopActivity(visibleActivity);}}catch(err){_didIteratorError59=true;_iteratorError59=err;}finally{try{if(!_iteratorNormalCompletion59&&_iterator59.return){_iterator59.return();}}finally{if(_didIteratorError59){throw _iteratorError59;}}}}}}return a;}},{key:'performLaunchActivity',value:function performLaunchActivity(intent){var activity=void 0;var clazz=intent.activityName;try{if(typeof clazz==='string')clazz=eval(clazz);}catch(e){}if(typeof clazz==='function')activity=new clazz(this.androidUI);if(activity instanceof app.Activity){try{var savedInstanceState=null;activity.mIntent=intent;activity.mStartedActivity=false;activity.mCalled=false;activity.performCreate(savedInstanceState);if(!activity.mCalled){throw new Error(\"Activity \"+intent.activityName+\" did not call through to super.onCreate()\");}if(!activity.mFinished){activity.performStart();activity.performRestoreInstanceState(savedInstanceState);activity.mCalled=false;activity.onPostCreate(savedInstanceState);if(!activity.mCalled){throw new Error(\"Activity \"+intent.activityName+\" did not call through to super.onPostCreate()\");}}}catch(e){console.error(e);return null;}if(!activity.mFinished){this.mLaunchedActivities.add(activity);}return activity;}return null;}},{key:'handleDestroyActivity',value:function handleDestroyActivity(activity,finishing){var visibleActivities=this.getVisibleToUserActivities();var isTopVisibleActivity=activity==visibleActivities[visibleActivities.length-1];var isRootActivity=this.isRootActivity(activity);this.performDestroyActivity(activity,finishing);if(isRootActivity)activity.getWindow().setWindowAnimations(null,null);this.androidUI.windowManager.removeWindow(activity.getWindow());if(isTopVisibleActivity&&!isRootActivity){this.scheduleActivityResume();}}},{key:'performDestroyActivity',value:function performDestroyActivity(activity,finishing){if(finishing){activity.mFinished=true;}activity.performPause();activity.performStop();activity.mCalled=false;activity.performDestroy();if(!activity.mCalled){throw new Error(\"Activity \"+ActivityThread.getActivityName(activity)+\" did not call through to super.onDestroy()\");}this.mLaunchedActivities.delete(activity);}},{key:'updateVisibility',value:function updateVisibility(activity,show){if(show){if(activity.mVisibleFromClient){activity.makeVisible();}}else{activity.getWindow().getDecorView().setVisibility(View.INVISIBLE);}}},{key:'getVisibleToUserActivities',value:function getVisibleToUserActivities(){var list=[];var _iteratorNormalCompletion60=true;var _didIteratorError60=false;var _iteratorError60=undefined;try{for(var _iterator60=Array.from(this.mLaunchedActivities).reverse()[Symbol.iterator](),_step60;!(_iteratorNormalCompletion60=(_step60=_iterator60.next()).done);_iteratorNormalCompletion60=true){var activity=_step60.value;list.push(activity);if(!activity.getWindow().getAttributes().isFloating())break;}}catch(err){_didIteratorError60=true;_iteratorError60=err;}finally{try{if(!_iteratorNormalCompletion60&&_iterator60.return){_iterator60.return();}}finally{if(_didIteratorError60){throw _iteratorError60;}}}list.reverse();return list;}},{key:'isRootActivity',value:function isRootActivity(activity){return this.mLaunchedActivities.values().next().value==activity;}}],[{key:'getActivityName',value:function getActivityName(activity){if(activity.getIntent())return activity.getIntent().activityName;return activity.constructor.name;}}]);return ActivityThread;}();app.ActivityThread=ActivityThread;})(app=android.app||(android.app={}));})(android||(android={}));var android;(function(android){var R;(function(R){var string_=function(){function string_(){_classCallCheck(this,string_);}_createClass(string_,null,[{key:'zh',value:function zh(){this.ok='确定';this.cancel='取消';this.close='关闭';this.back='返回';this.crash_catch_alert='程序发生错误, 即将重载网页:';this.prll_header_state_normal='下拉以刷新';this.prll_header_state_ready='松开马上刷新';this.prll_header_state_loading='正在刷新...';this.prll_header_state_fail='刷新失败';this.prll_footer_state_normal='点击加载更多';this.prll_footer_state_loading='正在加载...';this.prll_footer_state_ready='松开加载更多';this.prll_footer_state_no_more='加载完毕';this.prll_footer_state_fail='加载失败,点击重试';}}]);return string_;}();string_.ok='OK';string_.cancel='Cancel';string_.close='Close';string_.back='Back';string_.crash_catch_alert='Some error happen, will refresh page:';string_.prll_header_state_normal='Pull to refresh';string_.prll_header_state_ready='Release to refresh';string_.prll_header_state_loading='Loading';string_.prll_header_state_fail='Refresh fail';string_.prll_footer_state_normal='Load more';string_.prll_footer_state_loading='Loading';string_.prll_footer_state_ready='Pull to load more';string_.prll_footer_state_fail='Click to reload';string_.prll_footer_state_no_more='Load Finish';R.string_=string_;var lang=navigator.language.split('-')[0].toLowerCase();if(typeof string_[lang]==='function')string_[lang].call(string_);})(R=android.R||(android.R={}));})(android||(android={}));var androidui;(function(androidui){if(typeof HTMLDivElement!=='function'){var _HTMLDivElement=function _HTMLDivElement(){};_HTMLDivElement.prototype=HTMLDivElement.prototype;HTMLDivElement=_HTMLDivElement;}var AndroidUIElement=function(_HTMLDivElement2){_inherits(AndroidUIElement,_HTMLDivElement2);function AndroidUIElement(){_classCallCheck(this,AndroidUIElement);return _possibleConstructorReturn(this,(AndroidUIElement.__proto__||Object.getPrototypeOf(AndroidUIElement)).apply(this,arguments));}_createClass(AndroidUIElement,[{key:'createdCallback',value:function createdCallback(){var _this74=this;$domReady(function(){return initElement(_this74);});}},{key:'attachedCallback',value:function attachedCallback(){}},{key:'detachedCallback',value:function detachedCallback(){}},{key:'attributeChangedCallback',value:function attributeChangedCallback(attributeName,oldVal,newVal){if(attributeName==='debug'&&newVal!=null&&newVal!='false'&&newVal!='0'){this.AndroidUI.setDebugEnable();}}}]);return AndroidUIElement;}(HTMLDivElement);androidui.AndroidUIElement=AndroidUIElement;function runFunction(func){if(typeof window[func]===\"function\"){window[func]();}else{try{eval(func);}catch(e){console.warn(e);}}}function $domReady(func){if(/^loaded|^complete|^interactive/.test(document.readyState)){setTimeout(func,0);}else{document.addEventListener('DOMContentLoaded',func);}}function initElement(ele){ele.AndroidUI=new androidui.AndroidUI(ele);var debugAttr=ele.getAttribute('debug');if(debugAttr!=null&&debugAttr!='0'&&debugAttr!='false')ele.AndroidUI.setDebugEnable();var onClose=ele.getAttribute('onclose');if(onClose){ele.AndroidUI.setUIClient({shouldShowAppClosed:function shouldShowAppClosed(androidUI){if(!onClose)return;runFunction(onClose);}});}var onLoad=ele.getAttribute('onload');if(onLoad){runFunction(onLoad);}}if(typeof document['registerElement']===\"function\"){document.registerElement(\"android-ui\",AndroidUIElement);}else{$domReady(function(){var eles=document.getElementsByTagName('android-ui');var _iteratorNormalCompletion61=true;var _didIteratorError61=false;var _iteratorError61=undefined;try{for(var _iterator61=Array.from(eles)[Symbol.iterator](),_step61;!(_iteratorNormalCompletion61=(_step61=_iterator61.next()).done);_iteratorNormalCompletion61=true){var ele=_step61.value;initElement(ele);}}catch(err){_didIteratorError61=true;_iteratorError61=err;}finally{try{if(!_iteratorNormalCompletion61&&_iterator61.return){_iterator61.return();}}finally{if(_didIteratorError61){throw _iteratorError61;}}}});}var styleElement=document.createElement('style');styleElement.innerHTML+='\\n        android-ui {\\n            position : relative;\\n            overflow : hidden;\\n            display : block;\\n            outline: none;\\n        }\\n        android-ui * {\\n            overflow : hidden;\\n            border : none;\\n            outline: none;\\n            pointer-events: auto;\\n        }\\n        android-ui resources {\\n            display: none;\\n        }\\n        android-ui Button {\\n            border: none;\\n            background: none;\\n        }\\n        android-ui windowsgroup {\\n            pointer-events: none;\\n        }\\n        android-ui > canvas {\\n            position: absolute;\\n            left: 0;\\n            top: 0;\\n        }\\n        ';document.head.appendChild(styleElement);})(androidui||(androidui={}));var androidui;(function(androidui){var MotionEvent=android.view.MotionEvent;var KeyEvent=android.view.KeyEvent;var Intent=android.content.Intent;var ActivityThread=android.app.ActivityThread;var ViewRootImpl=android.view.ViewRootImpl;var AndroidUI=function(){function AndroidUI(androidUIElement){_classCallCheck(this,AndroidUI);this._canvas=document.createElement(\"canvas\");this.viewsDependOnDebugLayout=new Set();this.showDebugLayoutDefault=false;this._windowBound=new android.graphics.Rect();this.tempRect=new android.graphics.Rect();this.touchEvent=new MotionEvent();this.ketEvent=new KeyEvent();this.androidUIElement=androidUIElement;if(androidUIElement[AndroidUI.BindToElementName]){throw Error('already init a AndroidUI with this element');}androidUIElement[AndroidUI.BindToElementName]=this;this.init();}_createClass(AndroidUI,[{key:'init',value:function init(){this.appName=document.title;this._viewRootImpl=new android.view.ViewRootImpl();this.initAndroidUIElement();this.initApplication();this.androidUIElement.appendChild(this._canvas);this.initEvent();this.initRootSizeChange();this._viewRootImpl.setView(this.windowManager.getWindowsLayout());this._viewRootImpl.initSurface(this._canvas);this.initBrowserVisibleChange();this.initLaunchActivity();this.initGlobalCrashHandle();}},{key:'initApplication',value:function initApplication(){var appName=this.androidUIElement.getAttribute('appName');var appClazz=void 0;if(appName){try{appClazz=eval(appName);}catch(e){}}appClazz=appClazz||android.app.Application;this.mApplication=new appClazz(this);this.mApplication.onCreate();}},{key:'initLaunchActivity',value:function initLaunchActivity(){this.mActivityThread=new ActivityThread(this);var _iteratorNormalCompletion62=true;var _didIteratorError62=false;var _iteratorError62=undefined;try{for(var _iterator62=Array.from(this.androidUIElement.children)[Symbol.iterator](),_step62;!(_iteratorNormalCompletion62=(_step62=_iterator62.next()).done);_iteratorNormalCompletion62=true){var ele=_step62.value;var tagName=ele.tagName;if(tagName!='ACTIVITY')continue;var activityName=ele.getAttribute('name')||ele.getAttribute('android:name')||'android.app.Activity';var intent=new Intent(activityName);this.mActivityThread.overrideNextWindowAnimation(null,null,null,null);var activity=this.mActivityThread.handleLaunchActivity(intent);if(activity){this.androidUIElement.removeChild(ele);var _iteratorNormalCompletion63=true;var _didIteratorError63=false;var _iteratorError63=undefined;try{for(var _iterator63=Array.from(ele.children)[Symbol.iterator](),_step63;!(_iteratorNormalCompletion63=(_step63=_iterator63.next()).done);_iteratorNormalCompletion63=true){var element=_step63.value;android.view.LayoutInflater.from(activity).inflate(element,activity.getWindow().mContentParent,true);}}catch(err){_didIteratorError63=true;_iteratorError63=err;}finally{try{if(!_iteratorNormalCompletion63&&_iterator63.return){_iterator63.return();}}finally{if(_didIteratorError63){throw _iteratorError63;}}}var onCreateFunc=ele.getAttribute('oncreate');if(onCreateFunc&&typeof window[onCreateFunc]===\"function\"){window[onCreateFunc].call(this,activity);}}}}catch(err){_didIteratorError62=true;_iteratorError62=err;}finally{try{if(!_iteratorNormalCompletion62&&_iterator62.return){_iterator62.return();}}finally{if(_didIteratorError62){throw _iteratorError62;}}}this.mActivityThread.initWithPageStack();}},{key:'initGlobalCrashHandle',value:function initGlobalCrashHandle(){window.onerror=function(sMsg,sUrl,sLine){if(window.confirm(android.R.string_.crash_catch_alert+'\\n'+sMsg)){window.location.reload();}};}},{key:'refreshWindowBound',value:function refreshWindowBound(){var boundLeft=this.androidUIElement.offsetLeft;var boundTop=this.androidUIElement.offsetTop;var parent=this.androidUIElement.parentElement;if(parent){boundLeft+=parent.offsetLeft;boundTop+=parent.offsetTop;parent=parent.parentElement;}var boundRight=boundLeft+this.androidUIElement.offsetWidth;var boundBottom=boundTop+this.androidUIElement.offsetHeight;if(this._windowBound&&this._windowBound.left==boundLeft&&this._windowBound.top==boundTop&&this._windowBound.right==boundRight&&this._windowBound.bottom==boundBottom){return false;}this._windowBound.set(boundLeft,boundTop,boundRight,boundBottom);return true;}},{key:'initAndroidUIElement',value:function initAndroidUIElement(){var _this75=this;if(this.androidUIElement.style.display==='none'){this.androidUIElement.style.display='';}this.androidUIElement.setAttribute('tabindex','0');this.androidUIElement.focus();this.androidUIElement.onblur=function(e){_this75._viewRootImpl.ensureTouchMode(true);};}},{key:'initEvent',value:function initEvent(){this.initTouchEvent();this.initMouseEvent();this.initKeyEvent();this.initGenericEvent();}},{key:'initTouchEvent',value:function initTouchEvent(){var _this76=this;this.androidUIElement.addEventListener('touchstart',function(e){_this76.refreshWindowBound();if(e.target!=document.activeElement||!_this76.androidUIElement.contains(document.activeElement)){_this76.androidUIElement.focus();}_this76.touchEvent.initWithTouch(e,MotionEvent.ACTION_DOWN,_this76._windowBound);if(_this76._viewRootImpl.dispatchInputEvent(_this76.touchEvent)){e.stopPropagation();e.preventDefault();return true;}},true);this.androidUIElement.addEventListener('touchmove',function(e){_this76.touchEvent.initWithTouch(e,MotionEvent.ACTION_MOVE,_this76._windowBound);if(_this76._viewRootImpl.dispatchInputEvent(_this76.touchEvent)){e.stopPropagation();e.preventDefault();return true;}},true);this.androidUIElement.addEventListener('touchend',function(e){_this76.touchEvent.initWithTouch(e,MotionEvent.ACTION_UP,_this76._windowBound);if(_this76._viewRootImpl.dispatchInputEvent(_this76.touchEvent)){e.stopPropagation();e.preventDefault();return true;}},true);this.androidUIElement.addEventListener('touchcancel',function(e){_this76.touchEvent.initWithTouch(e,MotionEvent.ACTION_CANCEL,_this76._windowBound);if(_this76._viewRootImpl.dispatchInputEvent(_this76.touchEvent)){e.stopPropagation();e.preventDefault();return true;}},true);}},{key:'initMouseEvent',value:function initMouseEvent(){var _this77=this;function mouseToTouchEvent(e){var touch={identifier:0,target:null,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY};return{changedTouches:[touch],targetTouches:[touch],touches:e.type==='mouseup'?[]:[touch],timeStamp:e.timeStamp};}var isMouseDown=false;this.androidUIElement.addEventListener('mousedown',function(e){isMouseDown=true;_this77.refreshWindowBound();if(e.target!=document.activeElement||!_this77.androidUIElement.contains(document.activeElement)){_this77.androidUIElement.focus();}_this77.touchEvent.initWithTouch(mouseToTouchEvent(e),MotionEvent.ACTION_DOWN,_this77._windowBound);if(_this77._viewRootImpl.dispatchInputEvent(_this77.touchEvent)){e.stopPropagation();e.preventDefault();return true;}},true);this.androidUIElement.addEventListener('mousemove',function(e){if(!isMouseDown)return;_this77.touchEvent.initWithTouch(mouseToTouchEvent(e),MotionEvent.ACTION_MOVE,_this77._windowBound);if(_this77._viewRootImpl.dispatchInputEvent(_this77.touchEvent)){e.stopPropagation();e.preventDefault();return true;}},true);this.androidUIElement.addEventListener('mouseup',function(e){isMouseDown=false;_this77.touchEvent.initWithTouch(mouseToTouchEvent(e),MotionEvent.ACTION_UP,_this77._windowBound);if(_this77._viewRootImpl.dispatchInputEvent(_this77.touchEvent)){e.stopPropagation();e.preventDefault();return true;}},true);this.androidUIElement.addEventListener('mouseleave',function(e){if(e.fromElement===_this77.androidUIElement){isMouseDown=false;_this77.touchEvent.initWithTouch(mouseToTouchEvent(e),MotionEvent.ACTION_CANCEL,_this77._windowBound);if(_this77._viewRootImpl.dispatchInputEvent(_this77.touchEvent)){e.stopPropagation();e.preventDefault();return true;}}},true);var scrollEvent=new MotionEvent();this.androidUIElement.addEventListener('mousewheel',function(e){scrollEvent.initWithMouseWheel(e);if(_this77._viewRootImpl.dispatchInputEvent(scrollEvent)){e.stopPropagation();e.preventDefault();return true;}},true);}},{key:'initKeyEvent',value:function initKeyEvent(){var _this78=this;this.androidUIElement.addEventListener('keydown',function(e){_this78.ketEvent.initKeyEvent(e,KeyEvent.ACTION_DOWN);if(_this78._viewRootImpl.dispatchInputEvent(_this78.ketEvent)){e.stopPropagation();e.preventDefault();return true;}},true);this.androidUIElement.addEventListener('keyup',function(e){_this78.ketEvent.initKeyEvent(e,KeyEvent.ACTION_UP);if(_this78._viewRootImpl.dispatchInputEvent(_this78.ketEvent)){e.stopPropagation();e.preventDefault();return true;}},true);}},{key:'initGenericEvent',value:function initGenericEvent(){}},{key:'initRootSizeChange',value:function initRootSizeChange(){var inner_this=this;window.addEventListener('resize',function(){inner_this.notifyRootSizeChange();});var lastWidth=this.androidUIElement.offsetWidth;var lastHeight=this.androidUIElement.offsetHeight;if(lastWidth>0&&lastHeight>0)this.notifyRootSizeChange();setInterval(function(){var width=inner_this.androidUIElement.offsetWidth;var height=inner_this.androidUIElement.offsetHeight;if(lastHeight!==height||lastWidth!==width){lastWidth=width;lastHeight=height;inner_this.notifyRootSizeChange();}},500);}},{key:'initBrowserVisibleChange',value:function initBrowserVisibleChange(){var _this79=this;var eventName='visibilitychange';if(document['webkitHidden']!=undefined){eventName='webkitvisibilitychange';}document.addEventListener(eventName,function(){if(document['hidden']||document['webkitHidden']){_this79.mActivityThread.scheduleApplicationHide();}else{_this79.mActivityThread.scheduleApplicationShow();_this79._viewRootImpl.invalidate();}},false);}},{key:'notifyRootSizeChange',value:function notifyRootSizeChange(){if(this.refreshWindowBound()){var density=android.content.res.Resources.getDisplayMetrics().density;this.tempRect.set(this._windowBound.left*density,this._windowBound.top*density,this._windowBound.right*density,this._windowBound.bottom*density);var width=this._windowBound.width();var height=this._windowBound.height();this._canvas.width=width*density;this._canvas.height=height*density;this._canvas.style.width=width+\"px\";this._canvas.style.height=height+\"px\";this._viewRootImpl.notifyResized(this.tempRect);}}},{key:'viewAttachedDependOnDebugLayout',value:function viewAttachedDependOnDebugLayout(view){this.viewsDependOnDebugLayout.add(view);this.showDebugLayout();}},{key:'viewDetachedDependOnDebugLayout',value:function viewDetachedDependOnDebugLayout(view){this.viewsDependOnDebugLayout.delete(view);if(this.viewsDependOnDebugLayout.size==0&&!this.showDebugLayoutDefault){this.hideDebugLayout();}}},{key:'setDebugEnable',value:function setDebugEnable(){var enable=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;ViewRootImpl.DEBUG_FPS=enable;this.setShowDebugLayout(enable);}},{key:'setShowDebugLayout',value:function setShowDebugLayout(){var showDebugLayoutDefault=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;this.showDebugLayoutDefault=showDebugLayoutDefault;if(showDebugLayoutDefault){this.showDebugLayout();}else{this.hideDebugLayout();}}},{key:'showDebugLayout',value:function showDebugLayout(){if(this.windowManager.getWindowsLayout().bindElement.parentNode===null){this.androidUIElement.appendChild(this.windowManager.getWindowsLayout().bindElement);}}},{key:'hideDebugLayout',value:function hideDebugLayout(){if(this.windowManager.getWindowsLayout().bindElement.parentNode===this.androidUIElement){this.androidUIElement.removeChild(this.windowManager.getWindowsLayout().bindElement);}}},{key:'setUIClient',value:function setUIClient(uiClient){this.uiClient=uiClient;}},{key:'showAppClosed',value:function showAppClosed(){AndroidUI.showAppClosed(this);}},{key:'windowManager',get:function get(){return this.mApplication.getWindowManager();}},{key:'windowBound',get:function get(){return this._windowBound;}}],[{key:'showAppClosed',value:function showAppClosed(androidUI){androidUI.androidUIElement.parentNode.removeChild(androidUI.androidUIElement);if(androidUI.uiClient&&androidUI.uiClient.shouldShowAppClosed){androidUI.uiClient.shouldShowAppClosed(androidUI);}}}]);return AndroidUI;}();AndroidUI.BindToElementName='AndroidUI';androidui.AndroidUI=AndroidUI;})(androidui||(androidui={}));var android;(function(android){var app;(function(app){var View=android.view.View;var KeyEvent=android.view.KeyEvent;var MotionEvent=android.view.MotionEvent;var Window=android.view.Window;var WindowManager=android.view.WindowManager;var Log=android.util.Log;var Context=android.content.Context;var Intent=android.content.Intent;var Activity=function(_Context){_inherits(Activity,_Context);function Activity(androidUI){_classCallCheck(this,Activity);var _this80=_possibleConstructorReturn(this,(Activity.__proto__||Object.getPrototypeOf(Activity)).call(this,androidUI));_this80.mWindowAdded=false;_this80.mVisibleFromClient=true;_this80.mResultCode=Activity.RESULT_CANCELED;_this80.mResultData=null;_this80.mWindow=new Window(_this80);_this80.mWindow.setWindowAnimations(android.R.anim.activity_open_enter_ios,android.R.anim.activity_close_exit_ios,android.R.anim.activity_close_enter_ios,android.R.anim.activity_open_exit_ios);_this80.mWindow.setDimAmount(0.7);_this80.mWindow.getAttributes().flags|=WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;_this80.mWindow.setCallback(_this80);return _this80;}_createClass(Activity,[{key:'getIntent',value:function getIntent(){return this.mIntent;}},{key:'setIntent',value:function setIntent(newIntent){this.mIntent=newIntent;}},{key:'getApplication',value:function getApplication(){return this.getApplicationContext();}},{key:'getWindowManager',value:function getWindowManager(){return this.mWindow.getChildWindowManager();}},{key:'getGlobalWindowManager',value:function getGlobalWindowManager(){return this.getApplicationContext().getWindowManager();}},{key:'getWindow',value:function getWindow(){return this.mWindow;}},{key:'getCurrentFocus',value:function getCurrentFocus(){return this.mWindow!=null?this.mWindow.getCurrentFocus():null;}},{key:'onCreate',value:function onCreate(savedInstanceState){if(Activity.DEBUG_LIFECYCLE)Log.v(Activity.TAG,\"onCreate \"+this+\": \"+savedInstanceState);this.getApplication().dispatchActivityCreated(this,savedInstanceState);this.mCalled=true;}},{key:'performRestoreInstanceState',value:function performRestoreInstanceState(savedInstanceState){this.onRestoreInstanceState(savedInstanceState);}},{key:'onRestoreInstanceState',value:function onRestoreInstanceState(savedInstanceState){}},{key:'onPostCreate',value:function onPostCreate(savedInstanceState){this.onTitleChanged(this.getTitle());this.mCalled=true;}},{key:'onStart',value:function onStart(){if(Activity.DEBUG_LIFECYCLE)Log.v(Activity.TAG,\"onStart \"+this);this.mCalled=true;this.getApplication().dispatchActivityStarted(this);}},{key:'onRestart',value:function onRestart(){this.mCalled=true;}},{key:'onResume',value:function onResume(){if(Activity.DEBUG_LIFECYCLE)Log.v(Activity.TAG,\"onResume \"+this);this.getApplication().dispatchActivityResumed(this);this.mCalled=true;}},{key:'onPostResume',value:function onPostResume(){var win=this.getWindow();if(win!=null)win.makeActive();this.mCalled=true;}},{key:'onNewIntent',value:function onNewIntent(intent){}},{key:'performSaveInstanceState',value:function performSaveInstanceState(outState){this.onSaveInstanceState(outState);if(Activity.DEBUG_LIFECYCLE)Log.v(Activity.TAG,\"onSaveInstanceState \"+this+\": \"+outState);}},{key:'onSaveInstanceState',value:function onSaveInstanceState(outState){this.getApplication().dispatchActivitySaveInstanceState(this,outState);}},{key:'onPause',value:function onPause(){if(Activity.DEBUG_LIFECYCLE)Log.v(Activity.TAG,\"onPause \"+this);this.getApplication().dispatchActivityPaused(this);this.mCalled=true;}},{key:'onUserLeaveHint',value:function onUserLeaveHint(){}},{key:'onStop',value:function onStop(){if(Activity.DEBUG_LIFECYCLE)Log.v(Activity.TAG,\"onStop \"+this);this.getApplication().dispatchActivityStopped(this);this.mCalled=true;}},{key:'onDestroy',value:function onDestroy(){if(Activity.DEBUG_LIFECYCLE)Log.v(Activity.TAG,\"onDestroy \"+this);this.mCalled=true;this.getApplication().dispatchActivityDestroyed(this);}},{key:'findViewById',value:function findViewById(id){return this.getWindow().findViewById(id);}},{key:'setContentView',value:function setContentView(view,params){if(!(view instanceof View)){view=this.getLayoutInflater().inflate(view);}this.getWindow().setContentView(view,params);}},{key:'addContentView',value:function addContentView(view,params){this.mWindow.addContentView(view,params);}},{key:'setFinishOnTouchOutside',value:function setFinishOnTouchOutside(finish){this.mWindow.setCloseOnTouchOutside(finish);}},{key:'onKeyDown',value:function onKeyDown(keyCode,event){if(keyCode==KeyEvent.KEYCODE_BACK){event.startTracking();return true;}return false;}},{key:'onKeyLongPress',value:function onKeyLongPress(keyCode,event){return false;}},{key:'onKeyUp',value:function onKeyUp(keyCode,event){if(keyCode==KeyEvent.KEYCODE_BACK&&event.isTracking()&&!event.isCanceled()){this.onBackPressed();return true;}return false;}},{key:'onBackPressed',value:function onBackPressed(){this.finish();}},{key:'onTouchEvent',value:function onTouchEvent(event){if(this.mWindow.shouldCloseOnTouch(this,event)){this.finish();return true;}return false;}},{key:'onGenericMotionEvent',value:function onGenericMotionEvent(event){return false;}},{key:'onUserInteraction',value:function onUserInteraction(){}},{key:'onWindowAttributesChanged',value:function onWindowAttributesChanged(params){var decor=this.getWindow().getDecorView();if(decor!=null&&decor.getParent()!=null){this.getWindowManager().updateWindowLayout(this.getWindow(),params);}}},{key:'onContentChanged',value:function onContentChanged(){}},{key:'onWindowFocusChanged',value:function onWindowFocusChanged(hasFocus){}},{key:'onAttachedToWindow',value:function onAttachedToWindow(){}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){}},{key:'hasWindowFocus',value:function hasWindowFocus(){var w=this.getWindow();if(w!=null){var d=w.getDecorView();if(d!=null){return d.hasWindowFocus();}}return false;}},{key:'dispatchKeyEvent',value:function dispatchKeyEvent(event){this.onUserInteraction();var win=this.getWindow();if(win.superDispatchKeyEvent(event)){return true;}var decor=win.getDecorView();return event.dispatch(this,decor!=null?decor.getKeyDispatcherState():null,this);}},{key:'dispatchTouchEvent',value:function dispatchTouchEvent(ev){if(ev.getAction()==MotionEvent.ACTION_DOWN){this.onUserInteraction();}if(this.getWindow().superDispatchTouchEvent(ev)){return true;}return this.onTouchEvent(ev);}},{key:'dispatchGenericMotionEvent',value:function dispatchGenericMotionEvent(ev){this.onUserInteraction();if(this.getWindow().superDispatchGenericMotionEvent(ev)){return true;}return this.onGenericMotionEvent(ev);}},{key:'takeKeyEvents',value:function takeKeyEvents(_get){this.getWindow().takeKeyEvents(_get);}},{key:'invalidateOptionsMenu',value:function invalidateOptionsMenu(){var _this81=this;var menu=new android.view.Menu(this);if(this.onCreateOptionsMenu(menu)){menu.setCallback({onMenuItemSelected:function onMenuItemSelected(menu,item){var handle=_this81.onOptionsItemSelected(item);_this81.onOptionsMenuClosed(menu);return handle;}});this.mMenu=menu;this.mMenuPopuoHelper=this.invalidateOptionsMenuPopupHelper(menu);}}},{key:'invalidateOptionsMenuPopupHelper',value:function invalidateOptionsMenuPopupHelper(menu){return null;}},{key:'onCreateOptionsMenu',value:function onCreateOptionsMenu(menu){return true;}},{key:'onPrepareOptionsMenu',value:function onPrepareOptionsMenu(menu){return true;}},{key:'onOptionsItemSelected',value:function onOptionsItemSelected(item){return false;}},{key:'onOptionsMenuClosed',value:function onOptionsMenuClosed(menu){}},{key:'openOptionsMenu',value:function openOptionsMenu(){if(this.mMenuPopuoHelper)this.mMenuPopuoHelper.show();}},{key:'closeOptionsMenu',value:function closeOptionsMenu(){if(this.mMenuPopuoHelper)this.mMenuPopuoHelper.dismiss();}},{key:'startActivityForResult',value:function startActivityForResult(intent,requestCode,options){if(typeof intent==='string')intent=new Intent(intent);if(requestCode>=0)intent.mRequestCode=requestCode;this.androidUI.mActivityThread.execStartActivity(this,intent,options);if(requestCode>=0){this.mStartedActivity=true;}var decor=this.mWindow!=null?this.mWindow.peekDecorView():null;if(decor!=null){decor.cancelPendingInputEvents();}}},{key:'startActivities',value:function startActivities(intents,options){var _iteratorNormalCompletion64=true;var _didIteratorError64=false;var _iteratorError64=undefined;try{for(var _iterator64=intents[Symbol.iterator](),_step64;!(_iteratorNormalCompletion64=(_step64=_iterator64.next()).done);_iteratorNormalCompletion64=true){var intent=_step64.value;this.startActivity(intent,options);}}catch(err){_didIteratorError64=true;_iteratorError64=err;}finally{try{if(!_iteratorNormalCompletion64&&_iterator64.return){_iterator64.return();}}finally{if(_didIteratorError64){throw _iteratorError64;}}}}},{key:'startActivity',value:function startActivity(intent,options){if(options!=null){this.startActivityForResult(intent,-1,options);}else{this.startActivityForResult(intent,-1);}}},{key:'startActivityIfNeeded',value:function startActivityIfNeeded(intent,requestCode,options){if(this.androidUI.mActivityThread.canBackTo(intent)){return false;}this.startActivityForResult(intent,requestCode,options);return true;}},{key:'overrideNextTransition',value:function overrideNextTransition(enterAnimation,exitAnimation,resumeAnimation,hideAnimation){this.androidUI.mActivityThread.overrideNextWindowAnimation(enterAnimation,exitAnimation,resumeAnimation,hideAnimation);}},{key:'setResult',value:function setResult(resultCode,data){{this.mResultCode=resultCode;this.mResultData=data;}}},{key:'getCallingActivity',value:function getCallingActivity(){return null;}},{key:'setVisible',value:function setVisible(visible){if(this.mVisibleFromClient!=visible){this.mVisibleFromClient=visible;}}},{key:'makeVisible',value:function makeVisible(){if(!this.mWindowAdded){var wm=this.getGlobalWindowManager();wm.addWindow(this.getWindow());this.mWindowAdded=true;}this.getWindow().getDecorView().setVisibility(View.VISIBLE);}},{key:'isFinishing',value:function isFinishing(){return this.mFinished;}},{key:'isDestroyed',value:function isDestroyed(){return this.mDestroyed;}},{key:'finish',value:function finish(){var resultCode=this.mResultCode;var resultData=this.mResultData;try{this.androidUI.mActivityThread.scheduleDestroyActivity(this);}catch(e){}}},{key:'finishActivity',value:function finishActivity(requestCode){this.androidUI.mActivityThread.scheduleDestroyActivityByRequestCode(requestCode);}},{key:'onActivityResult',value:function onActivityResult(requestCode,resultCode,data){}},{key:'setTitle',value:function setTitle(title){this.getWindow().setTitle(title);this.onTitleChanged(title);}},{key:'getTitle',value:function getTitle(){return this.getWindow().getAttributes().getTitle();}},{key:'onTitleChanged',value:function onTitleChanged(title,color){var win=this.getWindow();if(win!=null){win.setTitle(title);}}},{key:'runOnUiThread',value:function runOnUiThread(action){action.run();}},{key:'navigateUpTo',value:function navigateUpTo(upIntent){var upToRootIfNotFound=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;if(this.androidUI.mActivityThread.scheduleBackTo(upIntent)){return true;}if(upToRootIfNotFound)this.androidUI.mActivityThread.scheduleBackToRoot();return false;}},{key:'performCreate',value:function performCreate(icicle){this.onCreate(icicle);this.invalidateOptionsMenu();}},{key:'performStart',value:function performStart(){this.mCalled=false;this.onStart();if(!this.mCalled){throw Error('new SuperNotCalledException(\"Activity \" + this.mComponent.toShortString() + \" did not call through to super.onStart()\")');}}},{key:'performRestart',value:function performRestart(){if(this.mStopped){this.mStopped=false;this.mCalled=false;this.onRestart();if(!this.mCalled){throw Error('new SuperNotCalledException(\"Activity \" + this.mComponent.toShortString() + \" did not call through to super.onRestart()\")');}this.performStart();}}},{key:'performResume',value:function performResume(){this.performRestart();this.mCalled=false;this.mResumed=true;this.onResume();if(!this.mCalled){throw Error('new SuperNotCalledException(\"Activity \" + this.mComponent.toShortString() + \" did not call through to super.onResume()\")');}this.mCalled=false;this.onPostResume();if(!this.mCalled){throw Error('new SuperNotCalledException(\"Activity \" + this.mComponent.toShortString() + \" did not call through to super.onPostResume()\")');}}},{key:'performPause',value:function performPause(){if(this.mResumed){this.mCalled=false;this.onPause();this.mResumed=false;if(!this.mCalled){throw Error('new SuperNotCalledException(\"Activity '+this.constructor.name+' did not call through to super.onPause()\")');}this.mResumed=false;}}},{key:'performUserLeaving',value:function performUserLeaving(){this.onUserInteraction();this.onUserLeaveHint();}},{key:'performStop',value:function performStop(){if(!this.mStopped){this.mCalled=false;this.onStop();if(!this.mCalled){throw Error('new SuperNotCalledException(\"Activity \" + this.mComponent.toShortString() + \" did not call through to super.onStop()\")');}this.mStopped=true;}this.mResumed=false;}},{key:'performDestroy',value:function performDestroy(){this.mDestroyed=true;this.mWindow.destroy();this.onDestroy();}},{key:'isResumed',value:function isResumed(){return this.mResumed;}},{key:'dispatchActivityResult',value:function dispatchActivityResult(who,requestCode,resultCode,data){this.onActivityResult(requestCode,resultCode,data);}}]);return Activity;}(Context);Activity.TAG=\"Activity\";Activity.DEBUG_LIFECYCLE=false;Activity.RESULT_CANCELED=0;Activity.RESULT_OK=-1;Activity.RESULT_FIRST_USER=1;app.Activity=Activity;})(app=android.app||(android.app={}));})(android||(android={}));var android;(function(android){var app;(function(app){var ArrayList=java.util.ArrayList;var Context=android.content.Context;var Application=function(_Context2){_inherits(Application,_Context2);function Application(){_classCallCheck(this,Application);var _this82=_possibleConstructorReturn(this,(Application.__proto__||Object.getPrototypeOf(Application)).apply(this,arguments));_this82.mActivityLifecycleCallbacks=new ArrayList();return _this82;}_createClass(Application,[{key:'onCreate',value:function onCreate(){}},{key:'getWindowManager',value:function getWindowManager(){if(!this.mWindowManager)this.mWindowManager=new android.view.WindowManager(this);return this.mWindowManager;}},{key:'registerActivityLifecycleCallbacks',value:function registerActivityLifecycleCallbacks(callback){{this.mActivityLifecycleCallbacks.add(callback);}}},{key:'unregisterActivityLifecycleCallbacks',value:function unregisterActivityLifecycleCallbacks(callback){{this.mActivityLifecycleCallbacks.remove(callback);}}},{key:'dispatchActivityCreated',value:function dispatchActivityCreated(activity,savedInstanceState){var callbacks=this.collectActivityLifecycleCallbacks();if(callbacks!=null){for(var i=0;i<callbacks.length;i++){callbacks[i].onActivityCreated(activity,savedInstanceState);}}}},{key:'dispatchActivityStarted',value:function dispatchActivityStarted(activity){var callbacks=this.collectActivityLifecycleCallbacks();if(callbacks!=null){for(var i=0;i<callbacks.length;i++){callbacks[i].onActivityStarted(activity);}}}},{key:'dispatchActivityResumed',value:function dispatchActivityResumed(activity){var callbacks=this.collectActivityLifecycleCallbacks();if(callbacks!=null){for(var i=0;i<callbacks.length;i++){callbacks[i].onActivityResumed(activity);}}}},{key:'dispatchActivityPaused',value:function dispatchActivityPaused(activity){var callbacks=this.collectActivityLifecycleCallbacks();if(callbacks!=null){for(var i=0;i<callbacks.length;i++){callbacks[i].onActivityPaused(activity);}}}},{key:'dispatchActivityStopped',value:function dispatchActivityStopped(activity){var callbacks=this.collectActivityLifecycleCallbacks();if(callbacks!=null){for(var i=0;i<callbacks.length;i++){callbacks[i].onActivityStopped(activity);}}}},{key:'dispatchActivitySaveInstanceState',value:function dispatchActivitySaveInstanceState(activity,outState){var callbacks=this.collectActivityLifecycleCallbacks();if(callbacks!=null){for(var i=0;i<callbacks.length;i++){callbacks[i].onActivitySaveInstanceState(activity,outState);}}}},{key:'dispatchActivityDestroyed',value:function dispatchActivityDestroyed(activity){var callbacks=this.collectActivityLifecycleCallbacks();if(callbacks!=null){for(var i=0;i<callbacks.length;i++){callbacks[i].onActivityDestroyed(activity);}}}},{key:'collectActivityLifecycleCallbacks',value:function collectActivityLifecycleCallbacks(){var callbacks=null;{if(this.mActivityLifecycleCallbacks.size()>0){callbacks=this.mActivityLifecycleCallbacks.toArray();}}return callbacks;}}]);return Application;}(Context);app.Application=Application;})(app=android.app||(android.app={}));})(android||(android={}));var android;(function(android){var view;(function(view){var Log=android.util.Log;var Pools=android.util.Pools;var VelocityTracker=function(){function VelocityTracker(){_classCallCheck(this,VelocityTracker);this.mLastTouchIndex=0;this.mGeneration=0;this.clear();}_createClass(VelocityTracker,[{key:'recycle',value:function recycle(){this.clear();VelocityTracker.sPool.release(this);}},{key:'setNextPoolable',value:function setNextPoolable(element){this.mNext=element;}},{key:'getNextPoolable',value:function getNextPoolable(){return this.mNext;}},{key:'clear',value:function clear(){VelocityTracker.releasePointerList(this.mPointerListHead);this.mPointerListHead=null;this.mLastTouchIndex=0;}},{key:'addMovement',value:function addMovement(ev){var historySize=ev.getHistorySize();var pointerCount=ev.getPointerCount();var lastTouchIndex=this.mLastTouchIndex;var nextTouchIndex=(lastTouchIndex+1)%VelocityTracker.NUM_PAST;var finalTouchIndex=(nextTouchIndex+historySize)%VelocityTracker.NUM_PAST;var generation=this.mGeneration++;this.mLastTouchIndex=finalTouchIndex;var previousPointer=null;for(var i=0;i<pointerCount;i++){var pointerId=ev.getPointerId(i);var nextPointer=void 0;if(previousPointer==null||pointerId<previousPointer.id){previousPointer=null;nextPointer=this.mPointerListHead;}else{nextPointer=previousPointer.next;}var pointer=void 0;for(;;){if(nextPointer!=null){var nextPointerId=nextPointer.id;if(nextPointerId==pointerId){pointer=nextPointer;break;}if(nextPointerId<pointerId){nextPointer=nextPointer.next;continue;}}pointer=VelocityTracker.obtainPointer();pointer.id=pointerId;pointer.pastTime[lastTouchIndex]=Number.MIN_VALUE;pointer.next=nextPointer;if(previousPointer==null){this.mPointerListHead=pointer;}else{previousPointer.next=pointer;}break;}pointer.generation=generation;previousPointer=pointer;var pastX=pointer.pastX;var pastY=pointer.pastY;var pastTime=pointer.pastTime;historySize=ev.getHistorySize(pointerId);for(var j=0;j<historySize;j++){var touchIndex=(nextTouchIndex+j)%VelocityTracker.NUM_PAST;pastX[touchIndex]=ev.getHistoricalX(i,j);pastY[touchIndex]=ev.getHistoricalY(i,j);pastTime[touchIndex]=ev.getHistoricalEventTime(i,j);}pastX[finalTouchIndex]=ev.getX(i);pastY[finalTouchIndex]=ev.getY(i);pastTime[finalTouchIndex]=ev.getEventTime();}previousPointer=null;for(var _pointer=this.mPointerListHead;_pointer!=null;){var _nextPointer=_pointer.next;if(_pointer.generation!=generation){if(previousPointer==null){this.mPointerListHead=_nextPointer;}else{previousPointer.next=_nextPointer;}VelocityTracker.releasePointer(_pointer);}else{previousPointer=_pointer;}_pointer=_nextPointer;}}},{key:'computeCurrentVelocity',value:function computeCurrentVelocity(units){var maxVelocity=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Number.MAX_SAFE_INTEGER;var lastTouchIndex=this.mLastTouchIndex;for(var pointer=this.mPointerListHead;pointer!=null;pointer=pointer.next){var pastTime=pointer.pastTime;var oldestTouchIndex=lastTouchIndex;var numTouches=1;var minTime=pastTime[lastTouchIndex]-VelocityTracker.MAX_AGE_MILLISECONDS;while(numTouches<VelocityTracker.NUM_PAST){var nextOldestTouchIndex=(oldestTouchIndex+VelocityTracker.NUM_PAST-1)%VelocityTracker.NUM_PAST;var nextOldestTime=pastTime[nextOldestTouchIndex];if(nextOldestTime<minTime){break;}oldestTouchIndex=nextOldestTouchIndex;numTouches+=1;}if(numTouches>3){numTouches-=1;}var pastX=pointer.pastX;var pastY=pointer.pastY;var oldestX=pastX[oldestTouchIndex];var oldestY=pastY[oldestTouchIndex];var oldestTime=pastTime[oldestTouchIndex];var accumX=0;var accumY=0;for(var i=1;i<numTouches;i++){var touchIndex=(oldestTouchIndex+i)%VelocityTracker.NUM_PAST;var duration=pastTime[touchIndex]-oldestTime;if(duration==0)continue;var delta=pastX[touchIndex]-oldestX;var velocity=delta/duration*units;accumX=accumX==0?velocity:(accumX+velocity)*.5;delta=pastY[touchIndex]-oldestY;velocity=delta/duration*units;accumY=accumY==0?velocity:(accumY+velocity)*.5;}if(accumX<-maxVelocity){accumX=-maxVelocity;}else if(accumX>maxVelocity){accumX=maxVelocity;}if(accumY<-maxVelocity){accumY=-maxVelocity;}else if(accumY>maxVelocity){accumY=maxVelocity;}pointer.xVelocity=accumX;pointer.yVelocity=accumY;if(VelocityTracker.localLOGV){Log.v(VelocityTracker.TAG,\"Pointer \"+pointer.id+\": Y velocity=\"+accumX+\" X velocity=\"+accumY+\" N=\"+numTouches);}}}},{key:'getXVelocity',value:function getXVelocity(){var id=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var pointer=this.getPointer(id);return pointer!=null?pointer.xVelocity:0;}},{key:'getYVelocity',value:function getYVelocity(){var id=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var pointer=this.getPointer(id);return pointer!=null?pointer.yVelocity:0;}},{key:'getPointer',value:function getPointer(id){for(var pointer=this.mPointerListHead;pointer!=null;pointer=pointer.next){if(pointer.id==id){return pointer;}}return null;}}],[{key:'obtain',value:function obtain(){var instance=VelocityTracker.sPool.acquire();return instance!=null?instance:new VelocityTracker();}},{key:'obtainPointer',value:function obtainPointer(){if(VelocityTracker.sRecycledPointerCount!=0){var element=VelocityTracker.sRecycledPointerListHead;VelocityTracker.sRecycledPointerCount-=1;VelocityTracker.sRecycledPointerListHead=element.next;element.next=null;return element;}return new Pointer();}},{key:'releasePointer',value:function releasePointer(pointer){if(VelocityTracker.sRecycledPointerCount<VelocityTracker.POINTER_POOL_CAPACITY){pointer.next=VelocityTracker.sRecycledPointerListHead;VelocityTracker.sRecycledPointerCount+=1;VelocityTracker.sRecycledPointerListHead=pointer;}}},{key:'releasePointerList',value:function releasePointerList(pointer){if(pointer!=null){var count=VelocityTracker.sRecycledPointerCount;if(count>=VelocityTracker.POINTER_POOL_CAPACITY){return;}var tail=pointer;for(;;){count+=1;if(count>=VelocityTracker.POINTER_POOL_CAPACITY){break;}var next=tail.next;if(next==null){break;}tail=next;}tail.next=VelocityTracker.sRecycledPointerListHead;VelocityTracker.sRecycledPointerCount=count;VelocityTracker.sRecycledPointerListHead=pointer;}}}]);return VelocityTracker;}();VelocityTracker.TAG=\"VelocityTracker\";VelocityTracker.DEBUG=Log.VelocityTracker_DBG;VelocityTracker.localLOGV=VelocityTracker.DEBUG;VelocityTracker.NUM_PAST=10;VelocityTracker.MAX_AGE_MILLISECONDS=200;VelocityTracker.POINTER_POOL_CAPACITY=20;VelocityTracker.sPool=new Pools.SynchronizedPool(2);VelocityTracker.sRecycledPointerCount=0;view.VelocityTracker=VelocityTracker;var Pointer=function Pointer(){_classCallCheck(this,Pointer);this.id=0;this.xVelocity=0;this.yVelocity=0;this.pastX=androidui.util.ArrayCreator.newNumberArray(VelocityTracker.NUM_PAST);this.pastY=androidui.util.ArrayCreator.newNumberArray(VelocityTracker.NUM_PAST);this.pastTime=androidui.util.ArrayCreator.newNumberArray(VelocityTracker.NUM_PAST);this.generation=0;};})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var SystemClock=android.os.SystemClock;var MotionEvent=android.view.MotionEvent;var ViewConfiguration=android.view.ViewConfiguration;var TypedValue=android.util.TypedValue;var ScaleGestureDetector=function(){function ScaleGestureDetector(listener,handler){_classCallCheck(this,ScaleGestureDetector);this.mFocusX=0;this.mFocusY=0;this.mCurrSpan=0;this.mPrevSpan=0;this.mInitialSpan=0;this.mCurrSpanX=0;this.mCurrSpanY=0;this.mPrevSpanX=0;this.mPrevSpanY=0;this.mCurrTime=0;this.mPrevTime=0;this.mSpanSlop=0;this.mMinSpan=0;this.mTouchUpper=0;this.mTouchLower=0;this.mTouchHistoryLastAccepted=0;this.mTouchHistoryDirection=0;this.mTouchHistoryLastAcceptedTime=0;this.mTouchMinMajor=0;this.mDoubleTapMode=ScaleGestureDetector.DOUBLE_TAP_MODE_NONE;this.mListener=listener;this.mSpanSlop=ViewConfiguration.get().getScaledTouchSlop()*2;this.mTouchMinMajor=TypedValue.complexToDimensionPixelSize('48dp');this.mMinSpan=TypedValue.complexToDimensionPixelSize('27mm');this.mHandler=handler;this.setQuickScaleEnabled(true);}_createClass(ScaleGestureDetector,[{key:'addTouchHistory',value:function addTouchHistory(ev){var currentTime=SystemClock.uptimeMillis();var count=ev.getPointerCount();var accept=currentTime-this.mTouchHistoryLastAcceptedTime>=ScaleGestureDetector.TOUCH_STABILIZE_TIME;var total=0;var sampleCount=0;for(var i=0;i<count;i++){var hasLastAccepted=!Number.isNaN(this.mTouchHistoryLastAccepted);var historySize=ev.getHistorySize();var pointerSampleCount=historySize+1;for(var h=0;h<pointerSampleCount;h++){var major=void 0;if(h<historySize){major=ev.getHistoricalTouchMajor(i,h);}else{major=ev.getTouchMajor(i);}if(major<this.mTouchMinMajor)major=this.mTouchMinMajor;total+=major;if(Number.isNaN(this.mTouchUpper)||major>this.mTouchUpper){this.mTouchUpper=major;}if(Number.isNaN(this.mTouchLower)||major<this.mTouchLower){this.mTouchLower=major;}if(hasLastAccepted){var Math_signum=function Math_signum(value){if(value===0||Number.isNaN(value))return value;return Math.abs(value)===value?1:-1;};var directionSig=Math.floor(Math_signum(major-this.mTouchHistoryLastAccepted));if(directionSig!=this.mTouchHistoryDirection||directionSig==0&&this.mTouchHistoryDirection==0){this.mTouchHistoryDirection=directionSig;var time=h<historySize?ev.getHistoricalEventTime(h):ev.getEventTime();this.mTouchHistoryLastAcceptedTime=time;accept=false;}}}sampleCount+=pointerSampleCount;}var avg=total/sampleCount;if(accept){var newAccepted=(this.mTouchUpper+this.mTouchLower+avg)/3;this.mTouchUpper=(this.mTouchUpper+newAccepted)/2;this.mTouchLower=(this.mTouchLower+newAccepted)/2;this.mTouchHistoryLastAccepted=newAccepted;this.mTouchHistoryDirection=0;this.mTouchHistoryLastAcceptedTime=ev.getEventTime();}}},{key:'clearTouchHistory',value:function clearTouchHistory(){this.mTouchUpper=Number.NaN;this.mTouchLower=Number.NaN;this.mTouchHistoryLastAccepted=Number.NaN;this.mTouchHistoryDirection=0;this.mTouchHistoryLastAcceptedTime=0;}},{key:'onTouchEvent',value:function onTouchEvent(event){this.mCurrTime=event.getEventTime();var action=event.getActionMasked();if(this.mQuickScaleEnabled){this.mGestureDetector.onTouchEvent(event);}var streamComplete=action==MotionEvent.ACTION_UP||action==MotionEvent.ACTION_CANCEL;if(action==MotionEvent.ACTION_DOWN||streamComplete){if(this.mInProgress){this.mListener.onScaleEnd(this);this.mInProgress=false;this.mInitialSpan=0;this.mDoubleTapMode=ScaleGestureDetector.DOUBLE_TAP_MODE_NONE;}else if(this.mDoubleTapMode==ScaleGestureDetector.DOUBLE_TAP_MODE_IN_PROGRESS&&streamComplete){this.mInProgress=false;this.mInitialSpan=0;this.mDoubleTapMode=ScaleGestureDetector.DOUBLE_TAP_MODE_NONE;}if(streamComplete){this.clearTouchHistory();return true;}}var configChanged=action==MotionEvent.ACTION_DOWN||action==MotionEvent.ACTION_POINTER_UP||action==MotionEvent.ACTION_POINTER_DOWN;var pointerUp=action==MotionEvent.ACTION_POINTER_UP;var skipIndex=pointerUp?event.getActionIndex():-1;var sumX=0,sumY=0;var count=event.getPointerCount();var div=pointerUp?count-1:count;var focusX=void 0;var focusY=void 0;if(this.mDoubleTapMode==ScaleGestureDetector.DOUBLE_TAP_MODE_IN_PROGRESS){focusX=this.mDoubleTapEvent.getX();focusY=this.mDoubleTapEvent.getY();if(event.getY()<focusY){this.mEventBeforeOrAboveStartingGestureEvent=true;}else{this.mEventBeforeOrAboveStartingGestureEvent=false;}}else{for(var i=0;i<count;i++){if(skipIndex==i)continue;sumX+=event.getX(i);sumY+=event.getY(i);}focusX=sumX/div;focusY=sumY/div;}this.addTouchHistory(event);var devSumX=0,devSumY=0;for(var _i18=0;_i18<count;_i18++){if(skipIndex==_i18)continue;var touchSize=this.mTouchHistoryLastAccepted/2;devSumX+=Math.abs(event.getX(_i18)-focusX)+touchSize;devSumY+=Math.abs(event.getY(_i18)-focusY)+touchSize;}var devX=devSumX/div;var devY=devSumY/div;var spanX=devX*2;var spanY=devY*2;var span=void 0;if(this.inDoubleTapMode()){span=spanY;}else{span=Math.sqrt(spanX*spanX+spanY*spanY);}var wasInProgress=this.mInProgress;this.mFocusX=focusX;this.mFocusY=focusY;if(!this.inDoubleTapMode()&&this.mInProgress&&(span<this.mMinSpan||configChanged)){this.mListener.onScaleEnd(this);this.mInProgress=false;this.mInitialSpan=span;this.mDoubleTapMode=ScaleGestureDetector.DOUBLE_TAP_MODE_NONE;}if(configChanged){this.mPrevSpanX=this.mCurrSpanX=spanX;this.mPrevSpanY=this.mCurrSpanY=spanY;this.mInitialSpan=this.mPrevSpan=this.mCurrSpan=span;}var minSpan=this.inDoubleTapMode()?this.mSpanSlop:this.mMinSpan;if(!this.mInProgress&&span>=minSpan&&(wasInProgress||Math.abs(span-this.mInitialSpan)>this.mSpanSlop)){this.mPrevSpanX=this.mCurrSpanX=spanX;this.mPrevSpanY=this.mCurrSpanY=spanY;this.mPrevSpan=this.mCurrSpan=span;this.mPrevTime=this.mCurrTime;this.mInProgress=this.mListener.onScaleBegin(this);}if(action==MotionEvent.ACTION_MOVE){this.mCurrSpanX=spanX;this.mCurrSpanY=spanY;this.mCurrSpan=span;var updatePrev=true;if(this.mInProgress){updatePrev=this.mListener.onScale(this);}if(updatePrev){this.mPrevSpanX=this.mCurrSpanX;this.mPrevSpanY=this.mCurrSpanY;this.mPrevSpan=this.mCurrSpan;this.mPrevTime=this.mCurrTime;}}return true;}},{key:'inDoubleTapMode',value:function inDoubleTapMode(){return this.mDoubleTapMode==ScaleGestureDetector.DOUBLE_TAP_MODE_IN_PROGRESS;}},{key:'setQuickScaleEnabled',value:function setQuickScaleEnabled(scales){var _this83=this;this.mQuickScaleEnabled=scales;if(this.mQuickScaleEnabled&&this.mGestureDetector==null){var gestureListener=function(){var inner_this=_this83;var _Inner=function(_view$GestureDetector){_inherits(_Inner,_view$GestureDetector);function _Inner(){_classCallCheck(this,_Inner);return _possibleConstructorReturn(this,(_Inner.__proto__||Object.getPrototypeOf(_Inner)).apply(this,arguments));}_createClass(_Inner,[{key:'onDoubleTap',value:function onDoubleTap(e){inner_this.mDoubleTapEvent=e;inner_this.mDoubleTapMode=ScaleGestureDetector.DOUBLE_TAP_MODE_IN_PROGRESS;return true;}}]);return _Inner;}(view.GestureDetector.SimpleOnGestureListener);return new _Inner();}();this.mGestureDetector=new view.GestureDetector(gestureListener,this.mHandler);}}},{key:'isQuickScaleEnabled',value:function isQuickScaleEnabled(){return this.mQuickScaleEnabled;}},{key:'isInProgress',value:function isInProgress(){return this.mInProgress;}},{key:'getFocusX',value:function getFocusX(){return this.mFocusX;}},{key:'getFocusY',value:function getFocusY(){return this.mFocusY;}},{key:'getCurrentSpan',value:function getCurrentSpan(){return this.mCurrSpan;}},{key:'getCurrentSpanX',value:function getCurrentSpanX(){return this.mCurrSpanX;}},{key:'getCurrentSpanY',value:function getCurrentSpanY(){return this.mCurrSpanY;}},{key:'getPreviousSpan',value:function getPreviousSpan(){return this.mPrevSpan;}},{key:'getPreviousSpanX',value:function getPreviousSpanX(){return this.mPrevSpanX;}},{key:'getPreviousSpanY',value:function getPreviousSpanY(){return this.mPrevSpanY;}},{key:'getScaleFactor',value:function getScaleFactor(){if(this.inDoubleTapMode()){var scaleUp=this.mEventBeforeOrAboveStartingGestureEvent&&this.mCurrSpan<this.mPrevSpan||!this.mEventBeforeOrAboveStartingGestureEvent&&this.mCurrSpan>this.mPrevSpan;var spanDiff=Math.abs(1-this.mCurrSpan/this.mPrevSpan)*ScaleGestureDetector.SCALE_FACTOR;return this.mPrevSpan<=0?1:scaleUp?1+spanDiff:1-spanDiff;}return this.mPrevSpan>0?this.mCurrSpan/this.mPrevSpan:1;}},{key:'getTimeDelta',value:function getTimeDelta(){return this.mCurrTime-this.mPrevTime;}},{key:'getEventTime',value:function getEventTime(){return this.mCurrTime;}}]);return ScaleGestureDetector;}();ScaleGestureDetector.TAG=\"ScaleGestureDetector\";ScaleGestureDetector.TOUCH_STABILIZE_TIME=128;ScaleGestureDetector.DOUBLE_TAP_MODE_NONE=0;ScaleGestureDetector.DOUBLE_TAP_MODE_IN_PROGRESS=1;ScaleGestureDetector.SCALE_FACTOR=.5;view.ScaleGestureDetector=ScaleGestureDetector;(function(ScaleGestureDetector){var SimpleOnScaleGestureListener=function(){function SimpleOnScaleGestureListener(){_classCallCheck(this,SimpleOnScaleGestureListener);}_createClass(SimpleOnScaleGestureListener,[{key:'onScale',value:function onScale(detector){return false;}},{key:'onScaleBegin',value:function onScaleBegin(detector){return true;}},{key:'onScaleEnd',value:function onScaleEnd(detector){}}]);return SimpleOnScaleGestureListener;}();ScaleGestureDetector.SimpleOnScaleGestureListener=SimpleOnScaleGestureListener;})(ScaleGestureDetector=view.ScaleGestureDetector||(view.ScaleGestureDetector={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var Handler=android.os.Handler;var MotionEvent=android.view.MotionEvent;var VelocityTracker=android.view.VelocityTracker;var ViewConfiguration=android.view.ViewConfiguration;var GestureDetector=function(){function GestureDetector(listener,handler){_classCallCheck(this,GestureDetector);this.mTouchSlopSquare=0;this.mDoubleTapTouchSlopSquare=0;this.mDoubleTapSlopSquare=0;this.mMinimumFlingVelocity=0;this.mMaximumFlingVelocity=0;this.mLastFocusX=0;this.mLastFocusY=0;this.mDownFocusX=0;this.mDownFocusY=0;this.mHandler=new GestureDetector.GestureHandler(this);this.mListener=listener;if(listener['setOnDoubleTapListener']){this.setOnDoubleTapListener(listener);}this.init();}_createClass(GestureDetector,[{key:'init',value:function init(){if(this.mListener==null){throw Error('new NullPointerException(\"OnGestureListener must not be null\")');}this.mIsLongpressEnabled=true;var touchSlop=void 0,doubleTapSlop=void 0,doubleTapTouchSlop=void 0;var configuration=ViewConfiguration.get();touchSlop=configuration.getScaledTouchSlop();doubleTapTouchSlop=configuration.getScaledDoubleTapTouchSlop();doubleTapSlop=configuration.getScaledDoubleTapSlop();this.mMinimumFlingVelocity=configuration.getScaledMinimumFlingVelocity();this.mMaximumFlingVelocity=configuration.getScaledMaximumFlingVelocity();this.mTouchSlopSquare=touchSlop*touchSlop;this.mDoubleTapTouchSlopSquare=doubleTapTouchSlop*doubleTapTouchSlop;this.mDoubleTapSlopSquare=doubleTapSlop*doubleTapSlop;}},{key:'setOnDoubleTapListener',value:function setOnDoubleTapListener(onDoubleTapListener){this.mDoubleTapListener=onDoubleTapListener;}},{key:'setIsLongpressEnabled',value:function setIsLongpressEnabled(isLongpressEnabled){this.mIsLongpressEnabled=isLongpressEnabled;}},{key:'isLongpressEnabled',value:function isLongpressEnabled(){return this.mIsLongpressEnabled;}},{key:'onTouchEvent',value:function onTouchEvent(ev){var action=ev.getAction();if(this.mVelocityTracker==null){this.mVelocityTracker=VelocityTracker.obtain();}this.mVelocityTracker.addMovement(ev);var pointerUp=(action&MotionEvent.ACTION_MASK)==MotionEvent.ACTION_POINTER_UP;var skipIndex=pointerUp?ev.getActionIndex():-1;var sumX=0,sumY=0;var count=ev.getPointerCount();for(var i=0;i<count;i++){if(skipIndex==i)continue;sumX+=ev.getX(i);sumY+=ev.getY(i);}var div=pointerUp?count-1:count;var focusX=sumX/div;var focusY=sumY/div;var handled=false;switch(action&MotionEvent.ACTION_MASK){case MotionEvent.ACTION_POINTER_DOWN:this.mDownFocusX=this.mLastFocusX=focusX;this.mDownFocusY=this.mLastFocusY=focusY;this.cancelTaps();break;case MotionEvent.ACTION_POINTER_UP:this.mDownFocusX=this.mLastFocusX=focusX;this.mDownFocusY=this.mLastFocusY=focusY;this.mVelocityTracker.computeCurrentVelocity(1000,this.mMaximumFlingVelocity);var upIndex=ev.getActionIndex();var id1=ev.getPointerId(upIndex);var x1=this.mVelocityTracker.getXVelocity(id1);var y1=this.mVelocityTracker.getYVelocity(id1);for(var _i19=0;_i19<count;_i19++){if(_i19==upIndex)continue;var id2=ev.getPointerId(_i19);var _x147=x1*this.mVelocityTracker.getXVelocity(id2);var _y4=y1*this.mVelocityTracker.getYVelocity(id2);var dot=_x147+_y4;if(dot<0){this.mVelocityTracker.clear();break;}}break;case MotionEvent.ACTION_DOWN:if(this.mDoubleTapListener!=null){var hadTapMessage=this.mHandler.hasMessages(GestureDetector.TAP);if(hadTapMessage)this.mHandler.removeMessages(GestureDetector.TAP);if(this.mCurrentDownEvent!=null&&this.mPreviousUpEvent!=null&&hadTapMessage&&this.isConsideredDoubleTap(this.mCurrentDownEvent,this.mPreviousUpEvent,ev)){this.mIsDoubleTapping=true;handled=this.mDoubleTapListener.onDoubleTap(this.mCurrentDownEvent)||handled;handled=this.mDoubleTapListener.onDoubleTapEvent(ev)||handled;}else{this.mHandler.sendEmptyMessageDelayed(GestureDetector.TAP,GestureDetector.DOUBLE_TAP_TIMEOUT);}}this.mDownFocusX=this.mLastFocusX=focusX;this.mDownFocusY=this.mLastFocusY=focusY;if(this.mCurrentDownEvent!=null){this.mCurrentDownEvent.recycle();}this.mCurrentDownEvent=MotionEvent.obtain(ev);this.mAlwaysInTapRegion=true;this.mAlwaysInBiggerTapRegion=true;this.mStillDown=true;this.mInLongPress=false;this.mDeferConfirmSingleTap=false;if(this.mIsLongpressEnabled){this.mHandler.removeMessages(GestureDetector.LONG_PRESS);this.mHandler.sendEmptyMessageAtTime(GestureDetector.LONG_PRESS,this.mCurrentDownEvent.getDownTime()+GestureDetector.TAP_TIMEOUT+GestureDetector.LONGPRESS_TIMEOUT);}this.mHandler.sendEmptyMessageAtTime(GestureDetector.SHOW_PRESS,this.mCurrentDownEvent.getDownTime()+GestureDetector.TAP_TIMEOUT);handled=this.mListener.onDown(ev)||handled;break;case MotionEvent.ACTION_MOVE:if(this.mInLongPress){break;}var scrollX=this.mLastFocusX-focusX;var scrollY=this.mLastFocusY-focusY;if(this.mIsDoubleTapping){handled=this.mDoubleTapListener.onDoubleTapEvent(ev)||handled;}else if(this.mAlwaysInTapRegion){var deltaX=Math.floor(focusX-this.mDownFocusX);var deltaY=Math.floor(focusY-this.mDownFocusY);var distance=deltaX*deltaX+deltaY*deltaY;if(distance>this.mTouchSlopSquare){handled=this.mListener.onScroll(this.mCurrentDownEvent,ev,scrollX,scrollY);this.mLastFocusX=focusX;this.mLastFocusY=focusY;this.mAlwaysInTapRegion=false;this.mHandler.removeMessages(GestureDetector.TAP);this.mHandler.removeMessages(GestureDetector.SHOW_PRESS);this.mHandler.removeMessages(GestureDetector.LONG_PRESS);}if(distance>this.mDoubleTapTouchSlopSquare){this.mAlwaysInBiggerTapRegion=false;}}else if(Math.abs(scrollX)>=1||Math.abs(scrollY)>=1){handled=this.mListener.onScroll(this.mCurrentDownEvent,ev,scrollX,scrollY);this.mLastFocusX=focusX;this.mLastFocusY=focusY;}break;case MotionEvent.ACTION_UP:this.mStillDown=false;var currentUpEvent=MotionEvent.obtain(ev);if(this.mIsDoubleTapping){handled=this.mDoubleTapListener.onDoubleTapEvent(ev)||handled;}else if(this.mInLongPress){this.mHandler.removeMessages(GestureDetector.TAP);this.mInLongPress=false;}else if(this.mAlwaysInTapRegion){handled=this.mListener.onSingleTapUp(ev);if(this.mDeferConfirmSingleTap&&this.mDoubleTapListener!=null){this.mDoubleTapListener.onSingleTapConfirmed(ev);}}else{var velocityTracker=this.mVelocityTracker;var pointerId=ev.getPointerId(0);velocityTracker.computeCurrentVelocity(1000,this.mMaximumFlingVelocity);var velocityY=velocityTracker.getYVelocity(pointerId);var velocityX=velocityTracker.getXVelocity(pointerId);if(Math.abs(velocityY)>this.mMinimumFlingVelocity||Math.abs(velocityX)>this.mMinimumFlingVelocity){handled=this.mListener.onFling(this.mCurrentDownEvent,ev,velocityX,velocityY);}}if(this.mPreviousUpEvent!=null){this.mPreviousUpEvent.recycle();}this.mPreviousUpEvent=currentUpEvent;if(this.mVelocityTracker!=null){this.mVelocityTracker.recycle();this.mVelocityTracker=null;}this.mIsDoubleTapping=false;this.mDeferConfirmSingleTap=false;this.mHandler.removeMessages(GestureDetector.SHOW_PRESS);this.mHandler.removeMessages(GestureDetector.LONG_PRESS);break;case MotionEvent.ACTION_CANCEL:this.cancel();break;}return handled;}},{key:'cancel',value:function cancel(){this.mHandler.removeMessages(GestureDetector.SHOW_PRESS);this.mHandler.removeMessages(GestureDetector.LONG_PRESS);this.mHandler.removeMessages(GestureDetector.TAP);this.mVelocityTracker.recycle();this.mVelocityTracker=null;this.mIsDoubleTapping=false;this.mStillDown=false;this.mAlwaysInTapRegion=false;this.mAlwaysInBiggerTapRegion=false;this.mDeferConfirmSingleTap=false;if(this.mInLongPress){this.mInLongPress=false;}}},{key:'cancelTaps',value:function cancelTaps(){this.mHandler.removeMessages(GestureDetector.SHOW_PRESS);this.mHandler.removeMessages(GestureDetector.LONG_PRESS);this.mHandler.removeMessages(GestureDetector.TAP);this.mIsDoubleTapping=false;this.mAlwaysInTapRegion=false;this.mAlwaysInBiggerTapRegion=false;this.mDeferConfirmSingleTap=false;if(this.mInLongPress){this.mInLongPress=false;}}},{key:'isConsideredDoubleTap',value:function isConsideredDoubleTap(firstDown,firstUp,secondDown){if(!this.mAlwaysInBiggerTapRegion){return false;}var deltaTime=secondDown.getEventTime()-firstUp.getEventTime();if(deltaTime>GestureDetector.DOUBLE_TAP_TIMEOUT||deltaTime<GestureDetector.DOUBLE_TAP_MIN_TIME){return false;}var deltaX=Math.floor(firstDown.getX())-Math.floor(secondDown.getX());var deltaY=Math.floor(firstDown.getY())-Math.floor(secondDown.getY());return deltaX*deltaX+deltaY*deltaY<this.mDoubleTapSlopSquare;}},{key:'dispatchLongPress',value:function dispatchLongPress(){this.mHandler.removeMessages(GestureDetector.TAP);this.mDeferConfirmSingleTap=false;this.mInLongPress=true;this.mListener.onLongPress(this.mCurrentDownEvent);}}]);return GestureDetector;}();GestureDetector.LONGPRESS_TIMEOUT=ViewConfiguration.getLongPressTimeout();GestureDetector.TAP_TIMEOUT=ViewConfiguration.getTapTimeout();GestureDetector.DOUBLE_TAP_TIMEOUT=ViewConfiguration.getDoubleTapTimeout();GestureDetector.DOUBLE_TAP_MIN_TIME=ViewConfiguration.getDoubleTapMinTime();GestureDetector.SHOW_PRESS=1;GestureDetector.LONG_PRESS=2;GestureDetector.TAP=3;view.GestureDetector=GestureDetector;(function(GestureDetector){var SimpleOnGestureListener=function(){function SimpleOnGestureListener(){_classCallCheck(this,SimpleOnGestureListener);}_createClass(SimpleOnGestureListener,[{key:'onSingleTapUp',value:function onSingleTapUp(e){return false;}},{key:'onLongPress',value:function onLongPress(e){}},{key:'onScroll',value:function onScroll(e1,e2,distanceX,distanceY){return false;}},{key:'onFling',value:function onFling(e1,e2,velocityX,velocityY){return false;}},{key:'onShowPress',value:function onShowPress(e){}},{key:'onDown',value:function onDown(e){return false;}},{key:'onDoubleTap',value:function onDoubleTap(e){return false;}},{key:'onDoubleTapEvent',value:function onDoubleTapEvent(e){return false;}},{key:'onSingleTapConfirmed',value:function onSingleTapConfirmed(e){return false;}}]);return SimpleOnGestureListener;}();GestureDetector.SimpleOnGestureListener=SimpleOnGestureListener;var GestureHandler=function(_Handler2){_inherits(GestureHandler,_Handler2);function GestureHandler(arg){_classCallCheck(this,GestureHandler);var _this85=_possibleConstructorReturn(this,(GestureHandler.__proto__||Object.getPrototypeOf(GestureHandler)).call(this));_this85._GestureDetector_this=arg;return _this85;}_createClass(GestureHandler,[{key:'handleMessage',value:function handleMessage(msg){switch(msg.what){case GestureDetector.SHOW_PRESS:this._GestureDetector_this.mListener.onShowPress(this._GestureDetector_this.mCurrentDownEvent);break;case GestureDetector.LONG_PRESS:this._GestureDetector_this.dispatchLongPress();break;case GestureDetector.TAP:if(this._GestureDetector_this.mDoubleTapListener!=null){if(!this._GestureDetector_this.mStillDown){this._GestureDetector_this.mDoubleTapListener.onSingleTapConfirmed(this._GestureDetector_this.mCurrentDownEvent);}else{this._GestureDetector_this.mDeferConfirmSingleTap=true;}}break;default:throw Error('new RuntimeException(\"Unknown message \" + msg)');}}}]);return GestureHandler;}(Handler);GestureDetector.GestureHandler=GestureHandler;})(GestureDetector=view.GestureDetector||(view.GestureDetector={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var Gravity=android.view.Gravity;var View=android.view.View;var MeasureSpec=View.MeasureSpec;var ViewGroup=android.view.ViewGroup;var Context=android.content.Context;var LinearLayout=function(_ViewGroup2){_inherits(LinearLayout,_ViewGroup2);function LinearLayout(context,bindElement,defStyle){_classCallCheck(this,LinearLayout);var _this86=_possibleConstructorReturn(this,(LinearLayout.__proto__||Object.getPrototypeOf(LinearLayout)).call(this,context,bindElement,defStyle));_this86.mBaselineAligned=true;_this86.mBaselineAlignedChildIndex=-1;_this86.mBaselineChildTop=0;_this86.mOrientation=0;_this86.mGravity=Gravity.LEFT|Gravity.TOP;_this86.mTotalLength=0;_this86.mWeightSum=-1;_this86.mUseLargestChild=false;_this86.mDividerWidth=0;_this86.mDividerHeight=0;_this86.mShowDividers=LinearLayout.SHOW_DIVIDER_NONE;_this86.mDividerPadding=0;var a=context.obtainStyledAttributes(bindElement,defStyle);var orientationS=a.getAttrValue('orientation');if(orientationS){var orientation=LinearLayout[orientationS.toUpperCase()];if(Number.isInteger(orientation)){_this86.setOrientation(orientation);}}var gravityS=a.getAttrValue('gravity');if(gravityS){_this86.setGravity(Gravity.parseGravity(gravityS));}var baselineAligned=a.getBoolean('baselineAligned',true);if(!baselineAligned){_this86.setBaselineAligned(baselineAligned);}_this86.mWeightSum=a.getFloat('weightSum',-1.0);_this86.mBaselineAlignedChildIndex=a.getInt('baselineAlignedChildIndex',-1);_this86.mUseLargestChild=a.getBoolean('measureWithLargestChild',false);_this86.setDividerDrawable(a.getDrawable('divider'));var fieldName=('SHOW_DIVIDER_'+a.getAttrValue('showDividers')).toUpperCase();if(Number.isInteger(LinearLayout[fieldName])){_this86.mShowDividers=LinearLayout[fieldName];}_this86.mDividerPadding=a.getDimensionPixelSize('dividerPadding',0);a.recycle();return _this86;}_createClass(LinearLayout,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(LinearLayout.prototype.__proto__||Object.getPrototypeOf(LinearLayout.prototype),'createClassAttrBinder',this).call(this).set('orientation',{setter:function setter(v,value,attrBinder){if((value+\"\").toUpperCase()==='VERTICAL'||LinearLayout.VERTICAL==value){v.setOrientation(LinearLayout.VERTICAL);}else if((value+\"\").toUpperCase()==='HORIZONTAL'||LinearLayout.HORIZONTAL==value){v.setOrientation(LinearLayout.HORIZONTAL);}},getter:function getter(v){return v.mOrientation;}}).set('gravity',{setter:function setter(v,value,attrBinder){v.setGravity(attrBinder.parseGravity(value,v.mGravity));},getter:function getter(v){return v.mGravity;}}).set('baselineAligned',{setter:function setter(v,value,attrBinder){if(!attrBinder.parseBoolean(value))v.setBaselineAligned(false);},getter:function getter(v){return v.mBaselineAligned;}}).set('weightSum',{setter:function setter(v,value,attrBinder){v.setWeightSum(attrBinder.parseFloat(value,v.mWeightSum));},getter:function getter(v){return v.mWeightSum;}}).set('baselineAlignedChildIndex',{setter:function setter(v,value,attrBinder){v.setBaselineAlignedChildIndex(attrBinder.parseInt(value,v.mBaselineAlignedChildIndex));},getter:function getter(v){return v.mBaselineAlignedChildIndex;}}).set('measureWithLargestChild',{setter:function setter(v,value,attrBinder){v.setMeasureWithLargestChildEnabled(attrBinder.parseBoolean(value,v.mUseLargestChild));},getter:function getter(v){return v.mUseLargestChild;}}).set('divider',{setter:function setter(v,value,attrBinder){v.setDividerDrawable(attrBinder.parseDrawable(value));},getter:function getter(v){return v.mDivider;}}).set('showDividers',{setter:function setter(v,value,attrBinder){if(Number.isInteger(parseInt(value))){this.setShowDividers(parseInt(value));}else{var fieldName=('SHOW_DIVIDER_'+value).toUpperCase();if(Number.isInteger(LinearLayout[fieldName])){this.setShowDividers(LinearLayout[fieldName]);}}},getter:function getter(v){return v.getShowDividers();}}).set('dividerPadding',{setter:function setter(v,value,attrBinder){v.setDividerPadding(attrBinder.parseInt(value,v.mDividerPadding));},getter:function getter(v){return v.getDividerPadding();}});}},{key:'setShowDividers',value:function setShowDividers(showDividers){if(showDividers!=this.mShowDividers){this.requestLayout();}this.mShowDividers=showDividers;}},{key:'shouldDelayChildPressedState',value:function shouldDelayChildPressedState(){return false;}},{key:'getShowDividers',value:function getShowDividers(){return this.mShowDividers;}},{key:'getDividerDrawable',value:function getDividerDrawable(){return this.mDivider;}},{key:'setDividerDrawable',value:function setDividerDrawable(divider){if(divider==this.mDivider){return;}this.mDivider=divider;if(divider!=null){this.mDividerWidth=divider.getIntrinsicWidth();this.mDividerHeight=divider.getIntrinsicHeight();}else{this.mDividerWidth=0;this.mDividerHeight=0;}this.setWillNotDraw(divider==null);this.requestLayout();}},{key:'setDividerPadding',value:function setDividerPadding(padding){this.mDividerPadding=padding;}},{key:'getDividerPadding',value:function getDividerPadding(){return this.mDividerPadding;}},{key:'getDividerWidth',value:function getDividerWidth(){return this.mDividerWidth;}},{key:'onDraw',value:function onDraw(canvas){if(this.mDivider==null){return;}if(this.mOrientation==LinearLayout.VERTICAL){this.drawDividersVertical(canvas);}else{this.drawDividersHorizontal(canvas);}}},{key:'drawDividersVertical',value:function drawDividersVertical(canvas){var count=this.getVirtualChildCount();for(var i=0;i<count;i++){var child=this.getVirtualChildAt(i);if(child!=null&&child.getVisibility()!=View.GONE){if(this.hasDividerBeforeChildAt(i)){var lp=child.getLayoutParams();var top=child.getTop()-lp.topMargin-this.mDividerHeight;this.drawHorizontalDivider(canvas,top);}}}if(this.hasDividerBeforeChildAt(count)){var _child4=this.getVirtualChildAt(count-1);var bottom=0;if(_child4==null){bottom=this.getHeight()-this.getPaddingBottom()-this.mDividerHeight;}else{var _lp2=_child4.getLayoutParams();bottom=_child4.getBottom()+_lp2.bottomMargin;}this.drawHorizontalDivider(canvas,bottom);}}},{key:'drawDividersHorizontal',value:function drawDividersHorizontal(canvas){var count=this.getVirtualChildCount();var isLayoutRtl=this.isLayoutRtl();for(var i=0;i<count;i++){var child=this.getVirtualChildAt(i);if(child!=null&&child.getVisibility()!=View.GONE){if(this.hasDividerBeforeChildAt(i)){var lp=child.getLayoutParams();var position=void 0;if(isLayoutRtl){position=child.getRight()+lp.rightMargin;}else{position=child.getLeft()-lp.leftMargin-this.mDividerWidth;}this.drawVerticalDivider(canvas,position);}}}if(this.hasDividerBeforeChildAt(count)){var _child5=this.getVirtualChildAt(count-1);var _position=void 0;if(_child5==null){if(isLayoutRtl){_position=this.getPaddingLeft();}else{_position=this.getWidth()-this.getPaddingRight()-this.mDividerWidth;}}else{var _lp3=_child5.getLayoutParams();if(isLayoutRtl){_position=_child5.getLeft()-_lp3.leftMargin-this.mDividerWidth;}else{_position=_child5.getRight()+_lp3.rightMargin;}}this.drawVerticalDivider(canvas,_position);}}},{key:'drawHorizontalDivider',value:function drawHorizontalDivider(canvas,top){this.mDivider.setBounds(this.getPaddingLeft()+this.mDividerPadding,top,this.getWidth()-this.getPaddingRight()-this.mDividerPadding,top+this.mDividerHeight);this.mDivider.draw(canvas);}},{key:'drawVerticalDivider',value:function drawVerticalDivider(canvas,left){this.mDivider.setBounds(left,this.getPaddingTop()+this.mDividerPadding,left+this.mDividerWidth,this.getHeight()-this.getPaddingBottom()-this.mDividerPadding);this.mDivider.draw(canvas);}},{key:'isBaselineAligned',value:function isBaselineAligned(){return this.mBaselineAligned;}},{key:'setBaselineAligned',value:function setBaselineAligned(baselineAligned){this.mBaselineAligned=baselineAligned;}},{key:'isMeasureWithLargestChildEnabled',value:function isMeasureWithLargestChildEnabled(){return this.mUseLargestChild;}},{key:'setMeasureWithLargestChildEnabled',value:function setMeasureWithLargestChildEnabled(enabled){this.mUseLargestChild=enabled;}},{key:'getBaseline',value:function getBaseline(){if(this.mBaselineAlignedChildIndex<0){return _get2(LinearLayout.prototype.__proto__||Object.getPrototypeOf(LinearLayout.prototype),'getBaseline',this).call(this);}if(this.getChildCount()<=this.mBaselineAlignedChildIndex){throw new Error(\"mBaselineAlignedChildIndex of LinearLayout \"+\"set to an index that is out of bounds.\");}var child=this.getChildAt(this.mBaselineAlignedChildIndex);var childBaseline=child.getBaseline();if(childBaseline==-1){if(this.mBaselineAlignedChildIndex==0){return-1;}throw new Error(\"mBaselineAlignedChildIndex of LinearLayout \"+\"points to a View that doesn't know how to get its baseline.\");}var childTop=this.mBaselineChildTop;if(this.mOrientation==LinearLayout.VERTICAL){var majorGravity=this.mGravity&Gravity.VERTICAL_GRAVITY_MASK;if(majorGravity!=Gravity.TOP){switch(majorGravity){case Gravity.BOTTOM:childTop=this.mBottom-this.mTop-this.mPaddingBottom-this.mTotalLength;break;case Gravity.CENTER_VERTICAL:childTop+=(this.mBottom-this.mTop-this.mPaddingTop-this.mPaddingBottom-this.mTotalLength)/2;break;}}}var lp=child.getLayoutParams();return childTop+lp.topMargin+childBaseline;}},{key:'getBaselineAlignedChildIndex',value:function getBaselineAlignedChildIndex(){return this.mBaselineAlignedChildIndex;}},{key:'setBaselineAlignedChildIndex',value:function setBaselineAlignedChildIndex(i){if(i<0||i>=this.getChildCount()){throw new Error(\"base aligned child index out \"+\"of range (0, \"+this.getChildCount()+\")\");}this.mBaselineAlignedChildIndex=i;}},{key:'getVirtualChildAt',value:function getVirtualChildAt(index){return this.getChildAt(index);}},{key:'getVirtualChildCount',value:function getVirtualChildCount(){return this.getChildCount();}},{key:'getWeightSum',value:function getWeightSum(){return this.mWeightSum;}},{key:'setWeightSum',value:function setWeightSum(weightSum){this.mWeightSum=Math.max(0,weightSum);}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){if(this.mOrientation==LinearLayout.VERTICAL){this.measureVertical(widthMeasureSpec,heightMeasureSpec);}else{this.measureHorizontal(widthMeasureSpec,heightMeasureSpec);}}},{key:'hasDividerBeforeChildAt',value:function hasDividerBeforeChildAt(childIndex){if(childIndex==0){return(this.mShowDividers&LinearLayout.SHOW_DIVIDER_BEGINNING)!=0;}else if(childIndex==this.getChildCount()){return(this.mShowDividers&LinearLayout.SHOW_DIVIDER_END)!=0;}else if((this.mShowDividers&LinearLayout.SHOW_DIVIDER_MIDDLE)!=0){var hasVisibleViewBefore=false;for(var i=childIndex-1;i>=0;i--){if(this.getChildAt(i).getVisibility()!=LinearLayout.GONE){hasVisibleViewBefore=true;break;}}return hasVisibleViewBefore;}return false;}},{key:'measureVertical',value:function measureVertical(widthMeasureSpec,heightMeasureSpec){this.mTotalLength=0;var maxWidth=0;var childState=0;var alternativeMaxWidth=0;var weightedMaxWidth=0;var allFillParent=true;var totalWeight=0;var count=this.getVirtualChildCount();var widthMode=MeasureSpec.getMode(widthMeasureSpec);var heightMode=MeasureSpec.getMode(heightMeasureSpec);var matchWidth=false;var baselineChildIndex=this.mBaselineAlignedChildIndex;var useLargestChild=this.mUseLargestChild;var largestChildHeight=Number.MIN_SAFE_INTEGER;for(var i=0;i<count;++i){var child=this.getVirtualChildAt(i);if(child==null){this.mTotalLength+=this.measureNullChild(i);continue;}if(child.getVisibility()==View.GONE){i+=this.getChildrenSkipCount(child,i);continue;}if(this.hasDividerBeforeChildAt(i)){this.mTotalLength+=this.mDividerHeight;}var lp=child.getLayoutParams();totalWeight+=lp.weight;if(heightMode==MeasureSpec.EXACTLY&&lp.height==0&&lp.weight>0){var totalLength=this.mTotalLength;this.mTotalLength=Math.max(totalLength,totalLength+lp.topMargin+lp.bottomMargin);}else{var oldHeight=Number.MIN_SAFE_INTEGER;if(lp.height==0&&lp.weight>0){oldHeight=0;lp.height=LinearLayout.LayoutParams.WRAP_CONTENT;}this.measureChildBeforeLayout(child,i,widthMeasureSpec,0,heightMeasureSpec,totalWeight==0?this.mTotalLength:0);if(oldHeight!=Number.MIN_SAFE_INTEGER){lp.height=oldHeight;}var childHeight=child.getMeasuredHeight();var _totalLength=this.mTotalLength;this.mTotalLength=Math.max(_totalLength,_totalLength+childHeight+lp.topMargin+lp.bottomMargin+this.getNextLocationOffset(child));if(useLargestChild){largestChildHeight=Math.max(childHeight,largestChildHeight);}}if(baselineChildIndex>=0&&baselineChildIndex==i+1){this.mBaselineChildTop=this.mTotalLength;}if(i<baselineChildIndex&&lp.weight>0){throw new Error(\"A child of LinearLayout with index \"+\"less than mBaselineAlignedChildIndex has weight > 0, which \"+\"won't work.  Either remove the weight, or don't set \"+\"mBaselineAlignedChildIndex.\");}var matchWidthLocally=false;if(widthMode!=MeasureSpec.EXACTLY&&lp.width==LinearLayout.LayoutParams.MATCH_PARENT){matchWidth=true;matchWidthLocally=true;}var margin=lp.leftMargin+lp.rightMargin;var measuredWidth=child.getMeasuredWidth()+margin;maxWidth=Math.max(maxWidth,measuredWidth);childState=LinearLayout.combineMeasuredStates(childState,child.getMeasuredState());allFillParent=allFillParent&&lp.width==LinearLayout.LayoutParams.MATCH_PARENT;if(lp.weight>0){weightedMaxWidth=Math.max(weightedMaxWidth,matchWidthLocally?margin:measuredWidth);}else{alternativeMaxWidth=Math.max(alternativeMaxWidth,matchWidthLocally?margin:measuredWidth);}i+=this.getChildrenSkipCount(child,i);}if(this.mTotalLength>0&&this.hasDividerBeforeChildAt(count)){this.mTotalLength+=this.mDividerHeight;}if(useLargestChild&&(heightMode==MeasureSpec.AT_MOST||heightMode==MeasureSpec.UNSPECIFIED)){this.mTotalLength=0;for(var _i20=0;_i20<count;++_i20){var _child6=this.getVirtualChildAt(_i20);if(_child6==null){this.mTotalLength+=this.measureNullChild(_i20);continue;}if(_child6.getVisibility()==View.GONE){_i20+=this.getChildrenSkipCount(_child6,_i20);continue;}var _lp4=_child6.getLayoutParams();var _totalLength2=this.mTotalLength;this.mTotalLength=Math.max(_totalLength2,_totalLength2+largestChildHeight+_lp4.topMargin+_lp4.bottomMargin+this.getNextLocationOffset(_child6));}}this.mTotalLength+=this.mPaddingTop+this.mPaddingBottom;var heightSize=this.mTotalLength;heightSize=Math.max(heightSize,this.getSuggestedMinimumHeight());var heightSizeAndState=LinearLayout.resolveSizeAndState(heightSize,heightMeasureSpec,0);heightSize=heightSizeAndState&View.MEASURED_SIZE_MASK;var delta=heightSize-this.mTotalLength;if(delta!=0&&totalWeight>0){var weightSum=this.mWeightSum>0?this.mWeightSum:totalWeight;this.mTotalLength=0;for(var _i21=0;_i21<count;++_i21){var _child7=this.getVirtualChildAt(_i21);if(_child7.getVisibility()==View.GONE){continue;}var _lp5=_child7.getLayoutParams();var childExtra=_lp5.weight;if(childExtra>0){var share=childExtra*delta/weightSum;weightSum-=childExtra;delta-=share;var childWidthMeasureSpec=LinearLayout.getChildMeasureSpec(widthMeasureSpec,this.mPaddingLeft+this.mPaddingRight+_lp5.leftMargin+_lp5.rightMargin,_lp5.width);if(_lp5.height!=0||heightMode!=MeasureSpec.EXACTLY){var _childHeight=_child7.getMeasuredHeight()+share;if(_childHeight<0){_childHeight=0;}_child7.measure(childWidthMeasureSpec,MeasureSpec.makeMeasureSpec(_childHeight,MeasureSpec.EXACTLY));}else{_child7.measure(childWidthMeasureSpec,MeasureSpec.makeMeasureSpec(share>0?share:0,MeasureSpec.EXACTLY));}childState=LinearLayout.combineMeasuredStates(childState,_child7.getMeasuredState()&View.MEASURED_STATE_MASK>>View.MEASURED_HEIGHT_STATE_SHIFT);}var _margin=_lp5.leftMargin+_lp5.rightMargin;var _measuredWidth=_child7.getMeasuredWidth()+_margin;maxWidth=Math.max(maxWidth,_measuredWidth);var _matchWidthLocally=widthMode!=MeasureSpec.EXACTLY&&_lp5.width==LinearLayout.LayoutParams.MATCH_PARENT;alternativeMaxWidth=Math.max(alternativeMaxWidth,_matchWidthLocally?_margin:_measuredWidth);allFillParent=allFillParent&&_lp5.width==LinearLayout.LayoutParams.MATCH_PARENT;var _totalLength3=this.mTotalLength;this.mTotalLength=Math.max(_totalLength3,_totalLength3+_child7.getMeasuredHeight()+_lp5.topMargin+_lp5.bottomMargin+this.getNextLocationOffset(_child7));}this.mTotalLength+=this.mPaddingTop+this.mPaddingBottom;}else{alternativeMaxWidth=Math.max(alternativeMaxWidth,weightedMaxWidth);if(useLargestChild&&heightMode!=MeasureSpec.EXACTLY){for(var _i22=0;_i22<count;_i22++){var _child8=this.getVirtualChildAt(_i22);if(_child8==null||_child8.getVisibility()==View.GONE){continue;}var _lp6=_child8.getLayoutParams();var _childExtra=_lp6.weight;if(_childExtra>0){_child8.measure(MeasureSpec.makeMeasureSpec(_child8.getMeasuredWidth(),MeasureSpec.EXACTLY),MeasureSpec.makeMeasureSpec(largestChildHeight,MeasureSpec.EXACTLY));}}}}if(!allFillParent&&widthMode!=MeasureSpec.EXACTLY){maxWidth=alternativeMaxWidth;}maxWidth+=this.mPaddingLeft+this.mPaddingRight;maxWidth=Math.max(maxWidth,this.getSuggestedMinimumWidth());this.setMeasuredDimension(LinearLayout.resolveSizeAndState(maxWidth,widthMeasureSpec,childState),heightSizeAndState);if(matchWidth){this.forceUniformWidth(count,heightMeasureSpec);}}},{key:'forceUniformWidth',value:function forceUniformWidth(count,heightMeasureSpec){var uniformMeasureSpec=MeasureSpec.makeMeasureSpec(this.getMeasuredWidth(),MeasureSpec.EXACTLY);for(var i=0;i<count;++i){var child=this.getVirtualChildAt(i);if(child.getVisibility()!=View.GONE){var lp=child.getLayoutParams();if(lp.width==LinearLayout.LayoutParams.MATCH_PARENT){var oldHeight=lp.height;lp.height=child.getMeasuredHeight();this.measureChildWithMargins(child,uniformMeasureSpec,0,heightMeasureSpec,0);lp.height=oldHeight;}}}}},{key:'measureHorizontal',value:function measureHorizontal(widthMeasureSpec,heightMeasureSpec){this.mTotalLength=0;var maxHeight=0;var childState=0;var alternativeMaxHeight=0;var weightedMaxHeight=0;var allFillParent=true;var totalWeight=0;var count=this.getVirtualChildCount();var widthMode=MeasureSpec.getMode(widthMeasureSpec);var heightMode=MeasureSpec.getMode(heightMeasureSpec);var matchHeight=false;if(this.mMaxAscent==null||this.mMaxDescent==null){this.mMaxAscent=androidui.util.ArrayCreator.newNumberArray(LinearLayout.VERTICAL_GRAVITY_COUNT);this.mMaxDescent=androidui.util.ArrayCreator.newNumberArray(LinearLayout.VERTICAL_GRAVITY_COUNT);}var maxAscent=this.mMaxAscent;var maxDescent=this.mMaxDescent;maxAscent[0]=maxAscent[1]=maxAscent[2]=maxAscent[3]=-1;maxDescent[0]=maxDescent[1]=maxDescent[2]=maxDescent[3]=-1;var baselineAligned=this.mBaselineAligned;var useLargestChild=this.mUseLargestChild;var isExactly=widthMode==MeasureSpec.EXACTLY;var largestChildWidth=Number.MAX_SAFE_INTEGER;for(var i=0;i<count;++i){var child=this.getVirtualChildAt(i);if(child==null){this.mTotalLength+=this.measureNullChild(i);continue;}if(child.getVisibility()==View.GONE){i+=this.getChildrenSkipCount(child,i);continue;}if(this.hasDividerBeforeChildAt(i)){this.mTotalLength+=this.mDividerWidth;}var lp=child.getLayoutParams();totalWeight+=lp.weight;if(widthMode==MeasureSpec.EXACTLY&&lp.width==0&&lp.weight>0){if(isExactly){this.mTotalLength+=lp.leftMargin+lp.rightMargin;}else{var totalLength=this.mTotalLength;this.mTotalLength=Math.max(totalLength,totalLength+lp.leftMargin+lp.rightMargin);}if(baselineAligned){var freeSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);child.measure(freeSpec,freeSpec);}}else{var oldWidth=Number.MIN_SAFE_INTEGER;if(lp.width==0&&lp.weight>0){oldWidth=0;lp.width=LinearLayout.LayoutParams.WRAP_CONTENT;}this.measureChildBeforeLayout(child,i,widthMeasureSpec,totalWeight==0?this.mTotalLength:0,heightMeasureSpec,0);if(oldWidth!=Number.MIN_SAFE_INTEGER){lp.width=oldWidth;}var childWidth=child.getMeasuredWidth();if(isExactly){this.mTotalLength+=childWidth+lp.leftMargin+lp.rightMargin+this.getNextLocationOffset(child);}else{var _totalLength4=this.mTotalLength;this.mTotalLength=Math.max(_totalLength4,_totalLength4+childWidth+lp.leftMargin+lp.rightMargin+this.getNextLocationOffset(child));}if(useLargestChild){largestChildWidth=Math.max(childWidth,largestChildWidth);}}var matchHeightLocally=false;if(heightMode!=MeasureSpec.EXACTLY&&lp.height==LinearLayout.LayoutParams.MATCH_PARENT){matchHeight=true;matchHeightLocally=true;}var margin=lp.topMargin+lp.bottomMargin;var childHeight=child.getMeasuredHeight()+margin;childState=LinearLayout.combineMeasuredStates(childState,child.getMeasuredState());if(baselineAligned){var childBaseline=child.getBaseline();if(childBaseline!=-1){var gravity=(lp.gravity<0?this.mGravity:lp.gravity)&Gravity.VERTICAL_GRAVITY_MASK;var index=(gravity>>Gravity.AXIS_Y_SHIFT&~Gravity.AXIS_SPECIFIED)>>1;maxAscent[index]=Math.max(maxAscent[index],childBaseline);maxDescent[index]=Math.max(maxDescent[index],childHeight-childBaseline);}}maxHeight=Math.max(maxHeight,childHeight);allFillParent=allFillParent&&lp.height==LinearLayout.LayoutParams.MATCH_PARENT;if(lp.weight>0){weightedMaxHeight=Math.max(weightedMaxHeight,matchHeightLocally?margin:childHeight);}else{alternativeMaxHeight=Math.max(alternativeMaxHeight,matchHeightLocally?margin:childHeight);}i+=this.getChildrenSkipCount(child,i);}if(this.mTotalLength>0&&this.hasDividerBeforeChildAt(count)){this.mTotalLength+=this.mDividerWidth;}if(maxAscent[LinearLayout.INDEX_TOP]!=-1||maxAscent[LinearLayout.INDEX_CENTER_VERTICAL]!=-1||maxAscent[LinearLayout.INDEX_BOTTOM]!=-1||maxAscent[LinearLayout.INDEX_FILL]!=-1){var ascent=Math.max(maxAscent[LinearLayout.INDEX_FILL],Math.max(maxAscent[LinearLayout.INDEX_CENTER_VERTICAL],Math.max(maxAscent[LinearLayout.INDEX_TOP],maxAscent[LinearLayout.INDEX_BOTTOM])));var descent=Math.max(maxDescent[LinearLayout.INDEX_FILL],Math.max(maxDescent[LinearLayout.INDEX_CENTER_VERTICAL],Math.max(maxDescent[LinearLayout.INDEX_TOP],maxDescent[LinearLayout.INDEX_BOTTOM])));maxHeight=Math.max(maxHeight,ascent+descent);}if(useLargestChild&&(widthMode==MeasureSpec.AT_MOST||widthMode==MeasureSpec.UNSPECIFIED)){this.mTotalLength=0;for(var _i23=0;_i23<count;++_i23){var _child9=this.getVirtualChildAt(_i23);if(_child9==null){this.mTotalLength+=this.measureNullChild(_i23);continue;}if(_child9.getVisibility()==View.GONE){_i23+=this.getChildrenSkipCount(_child9,_i23);continue;}var _lp7=_child9.getLayoutParams();if(isExactly){this.mTotalLength+=largestChildWidth+_lp7.leftMargin+_lp7.rightMargin+this.getNextLocationOffset(_child9);}else{var _totalLength5=this.mTotalLength;this.mTotalLength=Math.max(_totalLength5,_totalLength5+largestChildWidth+_lp7.leftMargin+_lp7.rightMargin+this.getNextLocationOffset(_child9));}}}this.mTotalLength+=this.mPaddingLeft+this.mPaddingRight;var widthSize=this.mTotalLength;widthSize=Math.max(widthSize,this.getSuggestedMinimumWidth());var widthSizeAndState=LinearLayout.resolveSizeAndState(widthSize,widthMeasureSpec,0);widthSize=widthSizeAndState&View.MEASURED_SIZE_MASK;var delta=widthSize-this.mTotalLength;if(delta!=0&&totalWeight>0){var weightSum=this.mWeightSum>0?this.mWeightSum:totalWeight;maxAscent[0]=maxAscent[1]=maxAscent[2]=maxAscent[3]=-1;maxDescent[0]=maxDescent[1]=maxDescent[2]=maxDescent[3]=-1;maxHeight=-1;this.mTotalLength=0;for(var _i24=0;_i24<count;++_i24){var _child10=this.getVirtualChildAt(_i24);if(_child10==null||_child10.getVisibility()==View.GONE){continue;}var _lp8=_child10.getLayoutParams();var childExtra=_lp8.weight;if(childExtra>0){var share=childExtra*delta/weightSum;weightSum-=childExtra;delta-=share;var childHeightMeasureSpec=LinearLayout.getChildMeasureSpec(heightMeasureSpec,this.mPaddingTop+this.mPaddingBottom+_lp8.topMargin+_lp8.bottomMargin,_lp8.height);if(_lp8.width!=0||widthMode!=MeasureSpec.EXACTLY){var _childWidth=_child10.getMeasuredWidth()+share;if(_childWidth<0){_childWidth=0;}_child10.measure(MeasureSpec.makeMeasureSpec(_childWidth,MeasureSpec.EXACTLY),childHeightMeasureSpec);}else{_child10.measure(MeasureSpec.makeMeasureSpec(share>0?share:0,MeasureSpec.EXACTLY),childHeightMeasureSpec);}childState=LinearLayout.combineMeasuredStates(childState,_child10.getMeasuredState()&View.MEASURED_STATE_MASK);}if(isExactly){this.mTotalLength+=_child10.getMeasuredWidth()+_lp8.leftMargin+_lp8.rightMargin+this.getNextLocationOffset(_child10);}else{var _totalLength6=this.mTotalLength;this.mTotalLength=Math.max(_totalLength6,_totalLength6+_child10.getMeasuredWidth()+_lp8.leftMargin+_lp8.rightMargin+this.getNextLocationOffset(_child10));}var _matchHeightLocally=heightMode!=MeasureSpec.EXACTLY&&_lp8.height==LinearLayout.LayoutParams.MATCH_PARENT;var _margin2=_lp8.topMargin+_lp8.bottomMargin;var _childHeight2=_child10.getMeasuredHeight()+_margin2;maxHeight=Math.max(maxHeight,_childHeight2);alternativeMaxHeight=Math.max(alternativeMaxHeight,_matchHeightLocally?_margin2:_childHeight2);allFillParent=allFillParent&&_lp8.height==LinearLayout.LayoutParams.MATCH_PARENT;if(baselineAligned){var _childBaseline=_child10.getBaseline();if(_childBaseline!=-1){var _gravity=(_lp8.gravity<0?this.mGravity:_lp8.gravity)&Gravity.VERTICAL_GRAVITY_MASK;var _index=(_gravity>>Gravity.AXIS_Y_SHIFT&~Gravity.AXIS_SPECIFIED)>>1;maxAscent[_index]=Math.max(maxAscent[_index],_childBaseline);maxDescent[_index]=Math.max(maxDescent[_index],_childHeight2-_childBaseline);}}}this.mTotalLength+=this.mPaddingLeft+this.mPaddingRight;if(maxAscent[LinearLayout.INDEX_TOP]!=-1||maxAscent[LinearLayout.INDEX_CENTER_VERTICAL]!=-1||maxAscent[LinearLayout.INDEX_BOTTOM]!=-1||maxAscent[LinearLayout.INDEX_FILL]!=-1){var _ascent=Math.max(maxAscent[LinearLayout.INDEX_FILL],Math.max(maxAscent[LinearLayout.INDEX_CENTER_VERTICAL],Math.max(maxAscent[LinearLayout.INDEX_TOP],maxAscent[LinearLayout.INDEX_BOTTOM])));var _descent=Math.max(maxDescent[LinearLayout.INDEX_FILL],Math.max(maxDescent[LinearLayout.INDEX_CENTER_VERTICAL],Math.max(maxDescent[LinearLayout.INDEX_TOP],maxDescent[LinearLayout.INDEX_BOTTOM])));maxHeight=Math.max(maxHeight,_ascent+_descent);}}else{alternativeMaxHeight=Math.max(alternativeMaxHeight,weightedMaxHeight);if(useLargestChild&&widthMode!=MeasureSpec.EXACTLY){for(var _i25=0;_i25<count;_i25++){var _child11=this.getVirtualChildAt(_i25);if(_child11==null||_child11.getVisibility()==View.GONE){continue;}var _lp9=_child11.getLayoutParams();var _childExtra2=_lp9.weight;if(_childExtra2>0){_child11.measure(MeasureSpec.makeMeasureSpec(largestChildWidth,MeasureSpec.EXACTLY),MeasureSpec.makeMeasureSpec(_child11.getMeasuredHeight(),MeasureSpec.EXACTLY));}}}}if(!allFillParent&&heightMode!=MeasureSpec.EXACTLY){maxHeight=alternativeMaxHeight;}maxHeight+=this.mPaddingTop+this.mPaddingBottom;maxHeight=Math.max(maxHeight,this.getSuggestedMinimumHeight());this.setMeasuredDimension(widthSizeAndState|childState&View.MEASURED_STATE_MASK,LinearLayout.resolveSizeAndState(maxHeight,heightMeasureSpec,childState<<View.MEASURED_HEIGHT_STATE_SHIFT));if(matchHeight){this.forceUniformHeight(count,widthMeasureSpec);}}},{key:'forceUniformHeight',value:function forceUniformHeight(count,widthMeasureSpec){var uniformMeasureSpec=MeasureSpec.makeMeasureSpec(this.getMeasuredHeight(),MeasureSpec.EXACTLY);for(var i=0;i<count;++i){var child=this.getVirtualChildAt(i);if(child.getVisibility()!=View.GONE){var lp=child.getLayoutParams();if(lp.height==LinearLayout.LayoutParams.MATCH_PARENT){var oldWidth=lp.width;lp.width=child.getMeasuredWidth();this.measureChildWithMargins(child,widthMeasureSpec,0,uniformMeasureSpec,0);lp.width=oldWidth;}}}}},{key:'getChildrenSkipCount',value:function getChildrenSkipCount(child,index){return 0;}},{key:'measureNullChild',value:function measureNullChild(childIndex){return 0;}},{key:'measureChildBeforeLayout',value:function measureChildBeforeLayout(child,childIndex,widthMeasureSpec,totalWidth,heightMeasureSpec,totalHeight){this.measureChildWithMargins(child,widthMeasureSpec,totalWidth,heightMeasureSpec,totalHeight);}},{key:'getLocationOffset',value:function getLocationOffset(child){return 0;}},{key:'getNextLocationOffset',value:function getNextLocationOffset(child){return 0;}},{key:'onLayout',value:function onLayout(changed,l,t,r,b){if(this.mOrientation==LinearLayout.VERTICAL){this.layoutVertical(l,t,r,b);}else{this.layoutHorizontal(l,t,r,b);}}},{key:'layoutVertical',value:function layoutVertical(left,top,right,bottom){var paddingLeft=this.mPaddingLeft;var childTop=void 0;var childLeft=void 0;var width=right-left;var childRight=width-this.mPaddingRight;var childSpace=width-paddingLeft-this.mPaddingRight;var count=this.getVirtualChildCount();var majorGravity=this.mGravity&Gravity.VERTICAL_GRAVITY_MASK;var minorGravity=this.mGravity&Gravity.HORIZONTAL_GRAVITY_MASK;switch(majorGravity){case Gravity.BOTTOM:childTop=this.mPaddingTop+bottom-top-this.mTotalLength;break;case Gravity.CENTER_VERTICAL:childTop=this.mPaddingTop+(bottom-top-this.mTotalLength)/2;break;case Gravity.TOP:default:childTop=this.mPaddingTop;break;}for(var i=0;i<count;i++){var child=this.getVirtualChildAt(i);if(child==null){childTop+=this.measureNullChild(i);}else if(child.getVisibility()!=View.GONE){var childWidth=child.getMeasuredWidth();var childHeight=child.getMeasuredHeight();var lp=child.getLayoutParams();var gravity=lp.gravity;if(gravity<0){gravity=minorGravity;}var absoluteGravity=gravity;switch(absoluteGravity&Gravity.HORIZONTAL_GRAVITY_MASK){case Gravity.CENTER_HORIZONTAL:childLeft=paddingLeft+(childSpace-childWidth)/2+lp.leftMargin-lp.rightMargin;break;case Gravity.RIGHT:childLeft=childRight-childWidth-lp.rightMargin;break;case Gravity.LEFT:default:childLeft=paddingLeft+lp.leftMargin;break;}if(this.hasDividerBeforeChildAt(i)){childTop+=this.mDividerHeight;}childTop+=lp.topMargin;this.setChildFrame(child,childLeft,childTop+this.getLocationOffset(child),childWidth,childHeight);childTop+=childHeight+lp.bottomMargin+this.getNextLocationOffset(child);i+=this.getChildrenSkipCount(child,i);}}}},{key:'layoutHorizontal',value:function layoutHorizontal(left,top,right,bottom){var isLayoutRtl=this.isLayoutRtl();var paddingTop=this.mPaddingTop;var childTop=void 0;var childLeft=void 0;var height=bottom-top;var childBottom=height-this.mPaddingBottom;var childSpace=height-paddingTop-this.mPaddingBottom;var count=this.getVirtualChildCount();var majorGravity=this.mGravity&Gravity.HORIZONTAL_GRAVITY_MASK;var minorGravity=this.mGravity&Gravity.VERTICAL_GRAVITY_MASK;var baselineAligned=this.mBaselineAligned;var maxAscent=this.mMaxAscent;var maxDescent=this.mMaxDescent;var absoluteGravity=majorGravity;switch(absoluteGravity){case Gravity.RIGHT:childLeft=this.mPaddingLeft+right-left-this.mTotalLength;break;case Gravity.CENTER_HORIZONTAL:childLeft=this.mPaddingLeft+(right-left-this.mTotalLength)/2;break;case Gravity.LEFT:default:childLeft=this.mPaddingLeft;break;}var start=0;var dir=1;if(isLayoutRtl){start=count-1;dir=-1;}for(var i=0;i<count;i++){var childIndex=start+dir*i;var child=this.getVirtualChildAt(childIndex);if(child==null){childLeft+=this.measureNullChild(childIndex);}else if(child.getVisibility()!=View.GONE){var childWidth=child.getMeasuredWidth();var childHeight=child.getMeasuredHeight();var childBaseline=-1;var lp=child.getLayoutParams();if(baselineAligned&&lp.height!=LinearLayout.LayoutParams.MATCH_PARENT){childBaseline=child.getBaseline();}var gravity=lp.gravity;if(gravity<0){gravity=minorGravity;}switch(gravity&Gravity.VERTICAL_GRAVITY_MASK){case Gravity.TOP:childTop=paddingTop+lp.topMargin;if(childBaseline!=-1){childTop+=maxAscent[LinearLayout.INDEX_TOP]-childBaseline;}break;case Gravity.CENTER_VERTICAL:childTop=paddingTop+(childSpace-childHeight)/2+lp.topMargin-lp.bottomMargin;break;case Gravity.BOTTOM:childTop=childBottom-childHeight-lp.bottomMargin;if(childBaseline!=-1){var descent=child.getMeasuredHeight()-childBaseline;childTop-=maxDescent[LinearLayout.INDEX_BOTTOM]-descent;}break;default:childTop=paddingTop;break;}if(this.hasDividerBeforeChildAt(childIndex)){childLeft+=this.mDividerWidth;}childLeft+=lp.leftMargin;this.setChildFrame(child,childLeft+this.getLocationOffset(child),childTop,childWidth,childHeight);childLeft+=childWidth+lp.rightMargin+this.getNextLocationOffset(child);i+=this.getChildrenSkipCount(child,childIndex);}}}},{key:'setChildFrame',value:function setChildFrame(child,left,top,width,height){child.layout(left,top,left+width,top+height);}},{key:'setOrientation',value:function setOrientation(orientation){if(typeof orientation==='string'){if('VERTICAL'===(orientation+'').toUpperCase())orientation=LinearLayout.VERTICAL;else if('HORIZONTAL'===(orientation+'').toUpperCase())orientation=LinearLayout.HORIZONTAL;}if(this.mOrientation!=orientation){this.mOrientation=orientation;this.requestLayout();}}},{key:'getOrientation',value:function getOrientation(){return this.mOrientation;}},{key:'setGravity',value:function setGravity(gravity){if(this.mGravity!=gravity){if((gravity&Gravity.HORIZONTAL_GRAVITY_MASK)==0){gravity|=Gravity.LEFT;}if((gravity&Gravity.VERTICAL_GRAVITY_MASK)==0){gravity|=Gravity.TOP;}this.mGravity=gravity;this.requestLayout();}}},{key:'setHorizontalGravity',value:function setHorizontalGravity(horizontalGravity){var gravity=horizontalGravity&Gravity.HORIZONTAL_GRAVITY_MASK;if((this.mGravity&Gravity.HORIZONTAL_GRAVITY_MASK)!=gravity){this.mGravity=this.mGravity&~Gravity.HORIZONTAL_GRAVITY_MASK|gravity;this.requestLayout();}}},{key:'setVerticalGravity',value:function setVerticalGravity(verticalGravity){var gravity=verticalGravity&Gravity.VERTICAL_GRAVITY_MASK;if((this.mGravity&Gravity.VERTICAL_GRAVITY_MASK)!=gravity){this.mGravity=this.mGravity&~Gravity.VERTICAL_GRAVITY_MASK|gravity;this.requestLayout();}}},{key:'generateLayoutParamsFromAttr',value:function generateLayoutParamsFromAttr(attrs){return new LinearLayout.LayoutParams(this.getContext(),attrs);}},{key:'generateDefaultLayoutParams',value:function generateDefaultLayoutParams(){var LayoutParams=LinearLayout.LayoutParams;if(this.mOrientation==LinearLayout.HORIZONTAL){return new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);}else if(this.mOrientation==LinearLayout.VERTICAL){return new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);}return _get2(LinearLayout.prototype.__proto__||Object.getPrototypeOf(LinearLayout.prototype),'generateDefaultLayoutParams',this).call(this);}},{key:'generateLayoutParams',value:function generateLayoutParams(p){return new LinearLayout.LayoutParams(p);}},{key:'checkLayoutParams',value:function checkLayoutParams(p){return p instanceof LinearLayout.LayoutParams;}}]);return LinearLayout;}(ViewGroup);LinearLayout.HORIZONTAL=0;LinearLayout.VERTICAL=1;LinearLayout.SHOW_DIVIDER_NONE=0;LinearLayout.SHOW_DIVIDER_BEGINNING=1;LinearLayout.SHOW_DIVIDER_MIDDLE=2;LinearLayout.SHOW_DIVIDER_END=4;LinearLayout.VERTICAL_GRAVITY_COUNT=4;LinearLayout.INDEX_CENTER_VERTICAL=0;LinearLayout.INDEX_TOP=1;LinearLayout.INDEX_BOTTOM=2;LinearLayout.INDEX_FILL=3;widget.LinearLayout=LinearLayout;(function(LinearLayout){var LayoutParams=function(_android$view$ViewGro){_inherits(LayoutParams,_android$view$ViewGro);function LayoutParams(){var _ref7;for(var _len21=arguments.length,args=Array(_len21),_key22=0;_key22<_len21;_key22++){args[_key22]=arguments[_key22];}_classCallCheck(this,LayoutParams);var _this87=_possibleConstructorReturn(this,(_ref7=LayoutParams.__proto__||Object.getPrototypeOf(LayoutParams)).call.apply(_ref7,[this].concat(_toConsumableArray(function(){if(args[0]instanceof Context&&args[1]instanceof HTMLElement)return[args[0],args[1]];else if(typeof args[0]==='number'&&typeof args[1]==='number'&&typeof args[2]==='number')return[args[0],args[1]];else if(typeof args[0]==='number'&&typeof args[1]==='number')return[args[0],args[1]];else if(args[0]instanceof LinearLayout.LayoutParams)return[args[0]];else if(args[0]instanceof ViewGroup.MarginLayoutParams)return[args[0]];else if(args[0]instanceof ViewGroup.LayoutParams)return[args[0]];}()))));_this87.weight=0;_this87.gravity=-1;if(args[0]instanceof Context&&args[1]instanceof HTMLElement){var c=args[0];var attrs=args[1];var _a10=c.obtainStyledAttributes(attrs);_this87.weight=_a10.getFloat('layout_weight',0);_this87.gravity=Gravity.parseGravity(_a10.getAttrValue('layout_gravity'),-1);_a10.recycle();}else if(typeof args[0]==='number'&&typeof args[1]==='number'&&typeof args[2]=='number'){_this87.weight=args[2];}else if(typeof args[0]==='number'&&typeof args[1]==='number'){_this87.weight=0;}else if(args[0]instanceof LinearLayout.LayoutParams){var source=args[0];_this87.weight=source.weight;_this87.gravity=source.gravity;}else if(args[0]instanceof ViewGroup.MarginLayoutParams){}else if(args[0]instanceof ViewGroup.LayoutParams){}return _this87;}_createClass(LayoutParams,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(LayoutParams.prototype.__proto__||Object.getPrototypeOf(LayoutParams.prototype),'createClassAttrBinder',this).call(this).set('layout_gravity',{setter:function setter(param,value,attrBinder){param.gravity=attrBinder.parseGravity(value,param.gravity);},getter:function getter(param){return param.gravity;}}).set('layout_weight',{setter:function setter(param,value,attrBinder){param.weight=attrBinder.parseFloat(value,param.weight);},getter:function getter(param){return param.weight;}});}}]);return LayoutParams;}(android.view.ViewGroup.MarginLayoutParams);LinearLayout.LayoutParams=LayoutParams;})(LinearLayout=widget.LinearLayout||(widget.LinearLayout={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var util;(function(util){var MathUtils=function(){function MathUtils(){_classCallCheck(this,MathUtils);}_createClass(MathUtils,null,[{key:'abs',value:function abs(v){return v>0?v:-v;}},{key:'constrain',value:function constrain(amount,low,high){return amount<low?low:amount>high?high:amount;}},{key:'log',value:function log(a){return Math.log(a);}},{key:'exp',value:function exp(a){return Math.exp(a);}},{key:'pow',value:function pow(a,b){return Math.pow(a,b);}},{key:'max',value:function max(a,b,c){if(c==null)return a>b?a:b;return a>b?a>c?a:c:b>c?b:c;}},{key:'min',value:function min(a,b,c){if(c==null)return a<b?a:b;return a<b?a<c?a:c:b<c?b:c;}},{key:'dist',value:function dist(x1,y1,x2,y2){var x=x2-x1;var y=y2-y1;return Math.sqrt(x*x+y*y);}},{key:'dist3',value:function dist3(x1,y1,z1,x2,y2,z2){var x=x2-x1;var y=y2-y1;var z=z2-z1;return Math.sqrt(x*x+y*y+z*z);}},{key:'mag',value:function mag(a,b,c){if(c==null)return Math.sqrt(a*a+b*b);return Math.sqrt(a*a+b*b+c*c);}},{key:'sq',value:function sq(v){return v*v;}},{key:'radians',value:function radians(degrees){return degrees*MathUtils.DEG_TO_RAD;}},{key:'degrees',value:function degrees(radians){return radians*MathUtils.RAD_TO_DEG;}},{key:'acos',value:function acos(value){return Math.acos(value);}},{key:'asin',value:function asin(value){return Math.asin(value);}},{key:'atan',value:function atan(value){return Math.atan(value);}},{key:'atan2',value:function atan2(a,b){return Math.atan2(a,b);}},{key:'tan',value:function tan(angle){return Math.tan(angle);}},{key:'lerp',value:function lerp(start,stop,amount){return start+(stop-start)*amount;}},{key:'norm',value:function norm(start,stop,value){return(value-start)/(stop-start);}},{key:'map',value:function map(minStart,minStop,maxStart,maxStop,value){return maxStart+(maxStart-maxStop)*((value-minStart)/(minStop-minStart));}},{key:'random',value:function random(){for(var _len22=arguments.length,args=Array(_len22),_key23=0;_key23<_len22;_key23++){args[_key23]=arguments[_key23];}if(args.length==1)return Math.random()*args[0];var howsmall=args[0],howbig=args[1];if(howsmall>=howbig)return howsmall;return Math.random()*(howbig-howsmall)+howsmall;}}]);return MathUtils;}();MathUtils.DEG_TO_RAD=3.1415926/180.0;MathUtils.RAD_TO_DEG=180.0/3.1415926;util.MathUtils=MathUtils;})(util=android.util||(android.util={}));})(android||(android={}));var android;(function(android){var util;(function(util){var SparseBooleanArray=function(_util$SparseArray){_inherits(SparseBooleanArray,_util$SparseArray);function SparseBooleanArray(){_classCallCheck(this,SparseBooleanArray);return _possibleConstructorReturn(this,(SparseBooleanArray.__proto__||Object.getPrototypeOf(SparseBooleanArray)).apply(this,arguments));}return SparseBooleanArray;}(util.SparseArray);util.SparseBooleanArray=SparseBooleanArray;})(util=android.util||(android.util={}));})(android||(android={}));var android;(function(android){var view;(function(view){var SoundEffectConstants=function(){function SoundEffectConstants(){_classCallCheck(this,SoundEffectConstants);}_createClass(SoundEffectConstants,null,[{key:'getContantForFocusDirection',value:function getContantForFocusDirection(direction){switch(direction){case view.View.FOCUS_RIGHT:return SoundEffectConstants.NAVIGATION_RIGHT;case view.View.FOCUS_FORWARD:case view.View.FOCUS_DOWN:return SoundEffectConstants.NAVIGATION_DOWN;case view.View.FOCUS_LEFT:return SoundEffectConstants.NAVIGATION_LEFT;case view.View.FOCUS_BACKWARD:case view.View.FOCUS_UP:return SoundEffectConstants.NAVIGATION_UP;}throw Error('new IllegalArgumentException(\"direction must be one of \" + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_FORWARD, FOCUS_BACKWARD}.\")');}}]);return SoundEffectConstants;}();SoundEffectConstants.CLICK=0;SoundEffectConstants.NAVIGATION_LEFT=1;SoundEffectConstants.NAVIGATION_UP=2;SoundEffectConstants.NAVIGATION_RIGHT=3;SoundEffectConstants.NAVIGATION_DOWN=4;view.SoundEffectConstants=SoundEffectConstants;})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var os;(function(os){var Trace=function(){function Trace(){_classCallCheck(this,Trace);}_createClass(Trace,null,[{key:'nativeGetEnabledTags',value:function nativeGetEnabledTags(){return Trace.TRACE_TAG_ALWAYS;}},{key:'nativeTraceCounter',value:function nativeTraceCounter(tag,name,value){}},{key:'nativeTraceBegin',value:function nativeTraceBegin(tag,name){}},{key:'nativeTraceEnd',value:function nativeTraceEnd(tag){}},{key:'nativeAsyncTraceBegin',value:function nativeAsyncTraceBegin(tag,name,cookie){}},{key:'nativeAsyncTraceEnd',value:function nativeAsyncTraceEnd(tag,name,cookie){}},{key:'nativeSetAppTracingAllowed',value:function nativeSetAppTracingAllowed(allowed){}},{key:'nativeSetTracingEnabled',value:function nativeSetTracingEnabled(allowed){}},{key:'cacheEnabledTags',value:function cacheEnabledTags(){var tags=Trace.nativeGetEnabledTags();Trace.sEnabledTags=tags;return tags;}},{key:'isTagEnabled',value:function isTagEnabled(traceTag){var tags=Trace.sEnabledTags;if(tags==Trace.TRACE_TAG_NOT_READY){tags=Trace.cacheEnabledTags();}return(tags&traceTag)!=0;}},{key:'traceCounter',value:function traceCounter(traceTag,counterName,counterValue){if(Trace.isTagEnabled(traceTag)){Trace.nativeTraceCounter(traceTag,counterName,counterValue);}}},{key:'setAppTracingAllowed',value:function setAppTracingAllowed(allowed){Trace.nativeSetAppTracingAllowed(allowed);Trace.cacheEnabledTags();}},{key:'setTracingEnabled',value:function setTracingEnabled(enabled){Trace.nativeSetTracingEnabled(enabled);Trace.cacheEnabledTags();}},{key:'traceBegin',value:function traceBegin(traceTag,methodName){if(Trace.isTagEnabled(traceTag)){Trace.nativeTraceBegin(traceTag,methodName);}}},{key:'traceEnd',value:function traceEnd(traceTag){if(Trace.isTagEnabled(traceTag)){Trace.nativeTraceEnd(traceTag);}}},{key:'asyncTraceBegin',value:function asyncTraceBegin(traceTag,methodName,cookie){if(Trace.isTagEnabled(traceTag)){Trace.nativeAsyncTraceBegin(traceTag,methodName,cookie);}}},{key:'asyncTraceEnd',value:function asyncTraceEnd(traceTag,methodName,cookie){if(Trace.isTagEnabled(traceTag)){Trace.nativeAsyncTraceEnd(traceTag,methodName,cookie);}}},{key:'beginSection',value:function beginSection(sectionName){if(Trace.isTagEnabled(Trace.TRACE_TAG_APP)){if(sectionName.length>Trace.MAX_SECTION_NAME_LEN){throw Error('new IllegalArgumentException(\"sectionName is too long\")');}Trace.nativeTraceBegin(Trace.TRACE_TAG_APP,sectionName);}}},{key:'endSection',value:function endSection(){if(Trace.isTagEnabled(Trace.TRACE_TAG_APP)){Trace.nativeTraceEnd(Trace.TRACE_TAG_APP);}}}]);return Trace;}();Trace.TAG=\"Trace\";Trace.TRACE_TAG_NEVER=0;Trace.TRACE_TAG_ALWAYS=1<<0;Trace.TRACE_TAG_GRAPHICS=1<<1;Trace.TRACE_TAG_INPUT=1<<2;Trace.TRACE_TAG_VIEW=1<<3;Trace.TRACE_TAG_WEBVIEW=1<<4;Trace.TRACE_TAG_WINDOW_MANAGER=1<<5;Trace.TRACE_TAG_ACTIVITY_MANAGER=1<<6;Trace.TRACE_TAG_SYNC_MANAGER=1<<7;Trace.TRACE_TAG_AUDIO=1<<8;Trace.TRACE_TAG_VIDEO=1<<9;Trace.TRACE_TAG_CAMERA=1<<10;Trace.TRACE_TAG_HAL=1<<11;Trace.TRACE_TAG_APP=1<<12;Trace.TRACE_TAG_RESOURCES=1<<13;Trace.TRACE_TAG_DALVIK=1<<14;Trace.TRACE_TAG_RS=1<<15;Trace.TRACE_TAG_NOT_READY=1<<63;Trace.MAX_SECTION_NAME_LEN=127;Trace.sEnabledTags=Trace.TRACE_TAG_NOT_READY;os.Trace=Trace;})(os=android.os||(android.os={}));})(android||(android={}));var android;(function(android){var text;(function(text){var KeyEvent=android.view.KeyEvent;var InputType=function InputType(){_classCallCheck(this,InputType);};InputType.TYPE_MASK_CLASS=0x0000000f;InputType.TYPE_MASK_VARIATION=0x00000ff0;InputType.TYPE_MASK_FLAGS=0x00fff000;InputType.TYPE_NULL=0x00000000;InputType.TYPE_CLASS_TEXT=0x00000001;InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS=0x00001000;InputType.TYPE_TEXT_FLAG_CAP_WORDS=0x00002000;InputType.TYPE_TEXT_FLAG_CAP_SENTENCES=0x00004000;InputType.TYPE_TEXT_FLAG_AUTO_CORRECT=0x00008000;InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE=0x00010000;InputType.TYPE_TEXT_FLAG_MULTI_LINE=0x00020000;InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE=0x00040000;InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS=0x00080000;InputType.TYPE_TEXT_VARIATION_NORMAL=0x00000000;InputType.TYPE_TEXT_VARIATION_URI=0x00000010;InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS=0x00000020;InputType.TYPE_TEXT_VARIATION_EMAIL_SUBJECT=0x00000030;InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE=0x00000040;InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE=0x00000050;InputType.TYPE_TEXT_VARIATION_PERSON_NAME=0x00000060;InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS=0x00000070;InputType.TYPE_TEXT_VARIATION_PASSWORD=0x00000080;InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD=0x00000090;InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT=0x000000a0;InputType.TYPE_TEXT_VARIATION_FILTER=0x000000b0;InputType.TYPE_TEXT_VARIATION_PHONETIC=0x000000c0;InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS=0x000000d0;InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD=0x000000e0;InputType.TYPE_CLASS_NUMBER=0x00000002;InputType.TYPE_NUMBER_FLAG_SIGNED=0x00001000;InputType.TYPE_NUMBER_FLAG_DECIMAL=0x00002000;InputType.TYPE_NUMBER_VARIATION_NORMAL=0x00000000;InputType.TYPE_NUMBER_VARIATION_PASSWORD=0x00000010;InputType.TYPE_CLASS_PHONE=0x00000003;InputType.TYPE_CLASS_DATETIME=0x00000004;InputType.TYPE_DATETIME_VARIATION_NORMAL=0x00000000;InputType.TYPE_DATETIME_VARIATION_DATE=0x00000010;InputType.TYPE_DATETIME_VARIATION_TIME=0x00000020;text.InputType=InputType;(function(InputType){var LimitCode=function LimitCode(){_classCallCheck(this,LimitCode);};LimitCode.TYPE_CLASS_NUMBER=[KeyEvent.KEYCODE_Digit0,KeyEvent.KEYCODE_Digit1,KeyEvent.KEYCODE_Digit2,KeyEvent.KEYCODE_Digit3,KeyEvent.KEYCODE_Digit4,KeyEvent.KEYCODE_Digit5,KeyEvent.KEYCODE_Digit6,KeyEvent.KEYCODE_Digit7,KeyEvent.KEYCODE_Digit8,KeyEvent.KEYCODE_Digit9];LimitCode.TYPE_CLASS_PHONE=[KeyEvent.KEYCODE_Comma,KeyEvent.KEYCODE_Sharp,KeyEvent.KEYCODE_Semicolon,KeyEvent.KEYCODE_Asterisk,KeyEvent.KEYCODE_Left_Parenthesis,KeyEvent.KEYCODE_Right_Parenthesis,KeyEvent.KEYCODE_Slash,KeyEvent.KEYCODE_KeyN,KeyEvent.KEYCODE_Period,KeyEvent.KEYCODE_SPACE,KeyEvent.KEYCODE_Add,KeyEvent.KEYCODE_Minus,KeyEvent.KEYCODE_Period,KeyEvent.KEYCODE_Digit0,KeyEvent.KEYCODE_Digit1,KeyEvent.KEYCODE_Digit2,KeyEvent.KEYCODE_Digit3,KeyEvent.KEYCODE_Digit4,KeyEvent.KEYCODE_Digit5,KeyEvent.KEYCODE_Digit6,KeyEvent.KEYCODE_Digit7,KeyEvent.KEYCODE_Digit8,KeyEvent.KEYCODE_Digit9];InputType.LimitCode=LimitCode;})(InputType=text.InputType||(text.InputType={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var util;(function(util){var LongSparseArray=function(_util$SparseArray2){_inherits(LongSparseArray,_util$SparseArray2);function LongSparseArray(){_classCallCheck(this,LongSparseArray);return _possibleConstructorReturn(this,(LongSparseArray.__proto__||Object.getPrototypeOf(LongSparseArray)).apply(this,arguments));}return LongSparseArray;}(util.SparseArray);util.LongSparseArray=LongSparseArray;})(util=android.util||(android.util={}));})(android||(android={}));var android;(function(android){var view;(function(view){var HapticFeedbackConstants=function HapticFeedbackConstants(){_classCallCheck(this,HapticFeedbackConstants);};HapticFeedbackConstants.LONG_PRESS=0;HapticFeedbackConstants.VIRTUAL_KEY=1;HapticFeedbackConstants.KEYBOARD_TAP=3;HapticFeedbackConstants.SAFE_MODE_DISABLED=10000;HapticFeedbackConstants.SAFE_MODE_ENABLED=10001;HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING=0x0001;HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING=0x0002;view.HapticFeedbackConstants=HapticFeedbackConstants;})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var database;(function(database){var DataSetObserver=function(){function DataSetObserver(){_classCallCheck(this,DataSetObserver);}_createClass(DataSetObserver,[{key:'onChanged',value:function onChanged(){}},{key:'onInvalidated',value:function onInvalidated(){}}]);return DataSetObserver;}();database.DataSetObserver=DataSetObserver;})(database=android.database||(android.database={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var DataSetObserver=android.database.DataSetObserver;var SystemClock=android.os.SystemClock;var SoundEffectConstants=android.view.SoundEffectConstants;var View=android.view.View;var ViewGroup=android.view.ViewGroup;var Long=java.lang.Long;var AdapterView=function(_ViewGroup3){_inherits(AdapterView,_ViewGroup3);function AdapterView(){_classCallCheck(this,AdapterView);var _this90=_possibleConstructorReturn(this,(AdapterView.__proto__||Object.getPrototypeOf(AdapterView)).apply(this,arguments));_this90.mFirstPosition=0;_this90.mSpecificTop=0;_this90.mSyncPosition=0;_this90.mSyncRowId=AdapterView.INVALID_ROW_ID;_this90.mSyncHeight=0;_this90.mNeedSync=false;_this90.mSyncMode=0;_this90.mLayoutHeight=0;_this90.mInLayout=false;_this90.mNextSelectedPosition=AdapterView.INVALID_POSITION;_this90.mNextSelectedRowId=AdapterView.INVALID_ROW_ID;_this90.mSelectedPosition=AdapterView.INVALID_POSITION;_this90.mSelectedRowId=AdapterView.INVALID_ROW_ID;_this90.mItemCount=0;_this90.mOldItemCount=0;_this90.mOldSelectedPosition=AdapterView.INVALID_POSITION;_this90.mOldSelectedRowId=AdapterView.INVALID_ROW_ID;_this90.mBlockLayoutRequests=false;return _this90;}_createClass(AdapterView,[{key:'setOnItemClickListener',value:function setOnItemClickListener(listener){this.mOnItemClickListener=listener;}},{key:'getOnItemClickListener',value:function getOnItemClickListener(){return this.mOnItemClickListener;}},{key:'performItemClick',value:function performItemClick(view,position,id){if(this.mOnItemClickListener!=null){this.playSoundEffect(SoundEffectConstants.CLICK);this.mOnItemClickListener.onItemClick(this,view,position,id);return true;}return false;}},{key:'setOnItemLongClickListener',value:function setOnItemLongClickListener(listener){if(!this.isLongClickable()){this.setLongClickable(true);}this.mOnItemLongClickListener=listener;}},{key:'getOnItemLongClickListener',value:function getOnItemLongClickListener(){return this.mOnItemLongClickListener;}},{key:'setOnItemSelectedListener',value:function setOnItemSelectedListener(listener){this.mOnItemSelectedListener=listener;}},{key:'getOnItemSelectedListener',value:function getOnItemSelectedListener(){return this.mOnItemSelectedListener;}},{key:'addView',value:function addView(){throw Error('new UnsupportedOperationException(\"addView() is not supported in AdapterView\")');}},{key:'removeView',value:function removeView(child){throw Error('new UnsupportedOperationException(\"removeView(View) is not supported in AdapterView\")');}},{key:'removeViewAt',value:function removeViewAt(index){throw Error('new UnsupportedOperationException(\"removeViewAt(int) is not supported in AdapterView\")');}},{key:'removeAllViews',value:function removeAllViews(){throw Error('new UnsupportedOperationException(\"removeAllViews() is not supported in AdapterView\")');}},{key:'onLayout',value:function onLayout(changed,left,top,right,bottom){this.mLayoutHeight=this.getHeight();}},{key:'getSelectedItemPosition',value:function getSelectedItemPosition(){return this.mNextSelectedPosition;}},{key:'getSelectedItemId',value:function getSelectedItemId(){return this.mNextSelectedRowId;}},{key:'getSelectedItem',value:function getSelectedItem(){var adapter=this.getAdapter();var selection=this.getSelectedItemPosition();if(adapter!=null&&adapter.getCount()>0&&selection>=0){return adapter.getItem(selection);}else{return null;}}},{key:'getCount',value:function getCount(){return this.mItemCount;}},{key:'getPositionForView',value:function getPositionForView(view){var listItem=view;try{var v=void 0;while(!((v=listItem.getParent())==this)){listItem=v;}}catch(e){return AdapterView.INVALID_POSITION;}var childCount=this.getChildCount();for(var i=0;i<childCount;i++){if(this.getChildAt(i)==listItem){return this.mFirstPosition+i;}}return AdapterView.INVALID_POSITION;}},{key:'getFirstVisiblePosition',value:function getFirstVisiblePosition(){return this.mFirstPosition;}},{key:'getLastVisiblePosition',value:function getLastVisiblePosition(){return this.mFirstPosition+this.getChildCount()-1;}},{key:'setEmptyView',value:function setEmptyView(emptyView){this.mEmptyView=emptyView;var adapter=this.getAdapter();var empty=adapter==null||adapter.isEmpty();this.updateEmptyStatus(empty);}},{key:'getEmptyView',value:function getEmptyView(){return this.mEmptyView;}},{key:'isInFilterMode',value:function isInFilterMode(){return false;}},{key:'setFocusable',value:function setFocusable(focusable){var adapter=this.getAdapter();var empty=adapter==null||adapter.getCount()==0;this.mDesiredFocusableState=focusable;if(!focusable){this.mDesiredFocusableInTouchModeState=false;}_get2(AdapterView.prototype.__proto__||Object.getPrototypeOf(AdapterView.prototype),'setFocusable',this).call(this,focusable&&(!empty||this.isInFilterMode()));}},{key:'setFocusableInTouchMode',value:function setFocusableInTouchMode(focusable){var adapter=this.getAdapter();var empty=adapter==null||adapter.getCount()==0;this.mDesiredFocusableInTouchModeState=focusable;if(focusable){this.mDesiredFocusableState=true;}_get2(AdapterView.prototype.__proto__||Object.getPrototypeOf(AdapterView.prototype),'setFocusableInTouchMode',this).call(this,focusable&&(!empty||this.isInFilterMode()));}},{key:'checkFocus',value:function checkFocus(){var adapter=this.getAdapter();var empty=adapter==null||adapter.getCount()==0;var focusable=!empty||this.isInFilterMode();_get2(AdapterView.prototype.__proto__||Object.getPrototypeOf(AdapterView.prototype),'setFocusableInTouchMode',this).call(this,focusable&&this.mDesiredFocusableInTouchModeState);_get2(AdapterView.prototype.__proto__||Object.getPrototypeOf(AdapterView.prototype),'setFocusable',this).call(this,focusable&&this.mDesiredFocusableState);if(this.mEmptyView!=null){this.updateEmptyStatus(adapter==null||adapter.isEmpty());}}},{key:'updateEmptyStatus',value:function updateEmptyStatus(empty){if(this.isInFilterMode()){empty=false;}if(empty){if(this.mEmptyView!=null){this.mEmptyView.setVisibility(View.VISIBLE);this.setVisibility(View.GONE);}else{this.setVisibility(View.VISIBLE);}if(this.mDataChanged){this.onLayout(false,this.mLeft,this.mTop,this.mRight,this.mBottom);}}else{if(this.mEmptyView!=null)this.mEmptyView.setVisibility(View.GONE);this.setVisibility(View.VISIBLE);}}},{key:'getItemAtPosition',value:function getItemAtPosition(position){var adapter=this.getAdapter();return adapter==null||position<0?null:adapter.getItem(position);}},{key:'getItemIdAtPosition',value:function getItemIdAtPosition(position){var adapter=this.getAdapter();return adapter==null||position<0?AdapterView.INVALID_ROW_ID:adapter.getItemId(position);}},{key:'setOnClickListener',value:function setOnClickListener(l){throw Error('new RuntimeException(\"Don\\'t call setOnClickListener for an AdapterView. \" + \"You probably want setOnItemClickListener instead\")');}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){_get2(AdapterView.prototype.__proto__||Object.getPrototypeOf(AdapterView.prototype),'onDetachedFromWindow',this).call(this);this.removeCallbacks(this.mSelectionNotifier);}},{key:'selectionChanged',value:function selectionChanged(){if(this.mOnItemSelectedListener!=null){if(this.mInLayout||this.mBlockLayoutRequests){if(this.mSelectionNotifier==null){this.mSelectionNotifier=new SelectionNotifier(this);}this.post(this.mSelectionNotifier);}else{this.fireOnSelected();this.performAccessibilityActionsOnSelected();}}}},{key:'fireOnSelected',value:function fireOnSelected(){if(this.mOnItemSelectedListener==null){return;}var selection=this.getSelectedItemPosition();if(selection>=0){var v=this.getSelectedView();this.mOnItemSelectedListener.onItemSelected(this,v,selection,this.getAdapter().getItemId(selection));}else{this.mOnItemSelectedListener.onNothingSelected(this);}}},{key:'performAccessibilityActionsOnSelected',value:function performAccessibilityActionsOnSelected(){}},{key:'isScrollableForAccessibility',value:function isScrollableForAccessibility(){var adapter=this.getAdapter();if(adapter!=null){var itemCount=adapter.getCount();return itemCount>0&&(this.getFirstVisiblePosition()>0||this.getLastVisiblePosition()<itemCount-1);}return false;}},{key:'canAnimate',value:function canAnimate(){return _get2(AdapterView.prototype.__proto__||Object.getPrototypeOf(AdapterView.prototype),'canAnimate',this).call(this)&&this.mItemCount>0;}},{key:'handleDataChanged',value:function handleDataChanged(){var count=this.mItemCount;var found=false;if(count>0){var newPos=void 0;if(this.mNeedSync){this.mNeedSync=false;newPos=this.findSyncPosition();if(newPos>=0){var selectablePos=this.lookForSelectablePosition(newPos,true);if(selectablePos==newPos){this.setNextSelectedPositionInt(newPos);found=true;}}}if(!found){newPos=this.getSelectedItemPosition();if(newPos>=count){newPos=count-1;}if(newPos<0){newPos=0;}var _selectablePos=this.lookForSelectablePosition(newPos,true);if(_selectablePos<0){_selectablePos=this.lookForSelectablePosition(newPos,false);}if(_selectablePos>=0){this.setNextSelectedPositionInt(_selectablePos);this.checkSelectionChanged();found=true;}}}if(!found){this.mSelectedPosition=AdapterView.INVALID_POSITION;this.mSelectedRowId=AdapterView.INVALID_ROW_ID;this.mNextSelectedPosition=AdapterView.INVALID_POSITION;this.mNextSelectedRowId=AdapterView.INVALID_ROW_ID;this.mNeedSync=false;this.checkSelectionChanged();}}},{key:'checkSelectionChanged',value:function checkSelectionChanged(){if(this.mSelectedPosition!=this.mOldSelectedPosition||this.mSelectedRowId!=this.mOldSelectedRowId){this.selectionChanged();this.mOldSelectedPosition=this.mSelectedPosition;this.mOldSelectedRowId=this.mSelectedRowId;}}},{key:'findSyncPosition',value:function findSyncPosition(){var count=this.mItemCount;if(count==0){return AdapterView.INVALID_POSITION;}var idToMatch=this.mSyncRowId;var seed=this.mSyncPosition;if(idToMatch==AdapterView.INVALID_ROW_ID){return AdapterView.INVALID_POSITION;}seed=Math.max(0,seed);seed=Math.min(count-1,seed);var endTime=SystemClock.uptimeMillis()+AdapterView.SYNC_MAX_DURATION_MILLIS;var rowId=void 0;var first=seed;var last=seed;var next=false;var hitFirst=void 0;var hitLast=void 0;var adapter=this.getAdapter();if(adapter==null){return AdapterView.INVALID_POSITION;}while(SystemClock.uptimeMillis()<=endTime){rowId=adapter.getItemId(seed);if(rowId==idToMatch){return seed;}hitLast=last==count-1;hitFirst=first==0;if(hitLast&&hitFirst){break;}if(hitFirst||next&&!hitLast){last++;seed=last;next=false;}else if(hitLast||!next&&!hitFirst){first--;seed=first;next=true;}}return AdapterView.INVALID_POSITION;}},{key:'lookForSelectablePosition',value:function lookForSelectablePosition(position,lookDown){return position;}},{key:'setSelectedPositionInt',value:function setSelectedPositionInt(position){this.mSelectedPosition=position;this.mSelectedRowId=this.getItemIdAtPosition(position);}},{key:'setNextSelectedPositionInt',value:function setNextSelectedPositionInt(position){this.mNextSelectedPosition=position;this.mNextSelectedRowId=this.getItemIdAtPosition(position);if(this.mNeedSync&&this.mSyncMode==AdapterView.SYNC_SELECTED_POSITION&&position>=0){this.mSyncPosition=position;this.mSyncRowId=this.mNextSelectedRowId;}}},{key:'rememberSyncState',value:function rememberSyncState(){if(this.getChildCount()>0){this.mNeedSync=true;this.mSyncHeight=this.mLayoutHeight;if(this.mSelectedPosition>=0){var v=this.getChildAt(this.mSelectedPosition-this.mFirstPosition);this.mSyncRowId=this.mNextSelectedRowId;this.mSyncPosition=this.mNextSelectedPosition;if(v!=null){this.mSpecificTop=v.getTop();}this.mSyncMode=AdapterView.SYNC_SELECTED_POSITION;}else{var _v2=this.getChildAt(0);var adapter=this.getAdapter();if(this.mFirstPosition>=0&&this.mFirstPosition<adapter.getCount()){this.mSyncRowId=adapter.getItemId(this.mFirstPosition);}else{this.mSyncRowId=AdapterView.NO_ID;}this.mSyncPosition=this.mFirstPosition;if(_v2!=null){this.mSpecificTop=_v2.getTop();}this.mSyncMode=AdapterView.SYNC_FIRST_POSITION;}}}}]);return AdapterView;}(ViewGroup);AdapterView.ITEM_VIEW_TYPE_IGNORE=-1;AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER=-2;AdapterView.SYNC_SELECTED_POSITION=0;AdapterView.SYNC_FIRST_POSITION=1;AdapterView.SYNC_MAX_DURATION_MILLIS=100;AdapterView.INVALID_POSITION=-1;AdapterView.INVALID_ROW_ID=Long.MIN_VALUE;widget.AdapterView=AdapterView;(function(AdapterView){var AdapterDataSetObserver=function(_DataSetObserver){_inherits(AdapterDataSetObserver,_DataSetObserver);function AdapterDataSetObserver(AdapterView_this){_classCallCheck(this,AdapterDataSetObserver);var _this91=_possibleConstructorReturn(this,(AdapterDataSetObserver.__proto__||Object.getPrototypeOf(AdapterDataSetObserver)).call(this));_this91.AdapterView_this=AdapterView_this;return _this91;}_createClass(AdapterDataSetObserver,[{key:'onChanged',value:function onChanged(){this.AdapterView_this.mDataChanged=true;this.AdapterView_this.mOldItemCount=this.AdapterView_this.mItemCount;this.AdapterView_this.mItemCount=this.AdapterView_this.getAdapter().getCount();this.AdapterView_this.rememberSyncState();this.AdapterView_this.checkFocus();this.AdapterView_this.requestLayout();}},{key:'onInvalidated',value:function onInvalidated(){this.AdapterView_this.mDataChanged=true;this.AdapterView_this.mOldItemCount=this.AdapterView_this.mItemCount;this.AdapterView_this.mItemCount=0;this.AdapterView_this.mSelectedPosition=AdapterView.INVALID_POSITION;this.AdapterView_this.mSelectedRowId=AdapterView.INVALID_ROW_ID;this.AdapterView_this.mNextSelectedPosition=AdapterView.INVALID_POSITION;this.AdapterView_this.mNextSelectedRowId=AdapterView.INVALID_ROW_ID;this.AdapterView_this.mNeedSync=false;this.AdapterView_this.checkFocus();this.AdapterView_this.requestLayout();}},{key:'clearSavedState',value:function clearSavedState(){}}]);return AdapterDataSetObserver;}(DataSetObserver);AdapterView.AdapterDataSetObserver=AdapterDataSetObserver;})(AdapterView=widget.AdapterView||(widget.AdapterView={}));var SelectionNotifier=function(){function SelectionNotifier(AdapterView_this){_classCallCheck(this,SelectionNotifier);this.AdapterView_this=AdapterView_this;}_createClass(SelectionNotifier,[{key:'run',value:function run(){if(this.AdapterView_this.mDataChanged){if(this.AdapterView_this.getAdapter()!=null){this.AdapterView_this.post(this);}}else{this.AdapterView_this.fireOnSelected();this.AdapterView_this.performAccessibilityActionsOnSelected();}}}]);return SelectionNotifier;}();})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var Integer=java.lang.Integer;var Adapter;(function(Adapter){Adapter.IGNORE_ITEM_VIEW_TYPE=widget.AdapterView.ITEM_VIEW_TYPE_IGNORE;Adapter.NO_SELECTION=Integer.MIN_VALUE;})(Adapter=widget.Adapter||(widget.Adapter={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var text;(function(text_8){var Paint=android.graphics.Paint;var ParagraphStyle=android.text.style.ParagraphStyle;var Layout=android.text.Layout;var Spanned=android.text.Spanned;var TextDirectionHeuristics=android.text.TextDirectionHeuristics;var TextLine=android.text.TextLine;var TextPaint=android.text.TextPaint;var TextUtils=android.text.TextUtils;var BoringLayout=function(_Layout){_inherits(BoringLayout,_Layout);function BoringLayout(source,paint,outerwidth,align,spacingmult,spacingadd,metrics,includepad){var ellipsize=arguments.length>8&&arguments[8]!==undefined?arguments[8]:null;var ellipsizedWidth=arguments.length>9&&arguments[9]!==undefined?arguments[9]:outerwidth;_classCallCheck(this,BoringLayout);var _this92=_possibleConstructorReturn(this,(BoringLayout.__proto__||Object.getPrototypeOf(BoringLayout)).call(this,source,paint,outerwidth,align,TextDirectionHeuristics.FIRSTSTRONG_LTR,spacingmult,spacingadd));_this92.mBottom=0;_this92.mDesc=0;_this92.mTopPadding=0;_this92.mBottomPadding=0;_this92.mMax=0;_this92.mEllipsizedWidth=0;_this92.mEllipsizedStart=0;_this92.mEllipsizedCount=0;var trust=void 0;if(ellipsize==null||ellipsize==TextUtils.TruncateAt.MARQUEE){_this92.mEllipsizedWidth=outerwidth;_this92.mEllipsizedStart=0;_this92.mEllipsizedCount=0;trust=true;}else{_this92.replaceWith(TextUtils.ellipsize(source,paint,ellipsizedWidth,ellipsize,true,_this92),paint,outerwidth,align,spacingmult,spacingadd);_this92.mEllipsizedWidth=ellipsizedWidth;trust=false;}_this92.init(_this92.getText(),paint,outerwidth,align,spacingmult,spacingadd,metrics,includepad,trust);return _this92;}_createClass(BoringLayout,[{key:'replaceOrMake',value:function replaceOrMake(source,paint,outerwidth,align,spacingmult,spacingadd,metrics,includepad){var ellipsize=arguments.length>8&&arguments[8]!==undefined?arguments[8]:null;var ellipsizedWidth=arguments.length>9&&arguments[9]!==undefined?arguments[9]:outerwidth;var trust=void 0;if(ellipsize==null||ellipsize==TextUtils.TruncateAt.MARQUEE){this.replaceWith(source,paint,outerwidth,align,spacingmult,spacingadd);this.mEllipsizedWidth=outerwidth;this.mEllipsizedStart=0;this.mEllipsizedCount=0;trust=true;}else{this.replaceWith(TextUtils.ellipsize(source,paint,ellipsizedWidth,ellipsize,true,this),paint,outerwidth,align,spacingmult,spacingadd);this.mEllipsizedWidth=ellipsizedWidth;trust=false;}this.init(this.getText(),paint,outerwidth,align,spacingmult,spacingadd,metrics,includepad,trust);return this;}},{key:'init',value:function init(source,paint,outerwidth,align,spacingmult,spacingadd,metrics,includepad,trustWidth){var spacing=void 0;if(Object.getPrototypeOf(source)===String.prototype&&align==Layout.Alignment.ALIGN_NORMAL){this.mDirect=source.toString();}else{this.mDirect=null;}this.mPaint=paint;if(includepad){spacing=metrics.bottom-metrics.top;}else{spacing=metrics.descent-metrics.ascent;}if(spacingmult!=1||spacingadd!=0){spacing=Math.floor(spacing*spacingmult+spacingadd+0.5);}this.mBottom=spacing;if(includepad){this.mDesc=spacing+metrics.top;}else{this.mDesc=spacing+metrics.ascent;}if(trustWidth){this.mMax=metrics.width;}else{var line=TextLine.obtain();line.set(paint,source,0,source.length,Layout.DIR_LEFT_TO_RIGHT,Layout.DIRS_ALL_LEFT_TO_RIGHT,false,null);this.mMax=Math.floor(Math.ceil(line.metrics(null)));TextLine.recycle(line);}if(includepad){this.mTopPadding=metrics.top-metrics.ascent;this.mBottomPadding=metrics.bottom-metrics.descent;}}},{key:'getHeight',value:function getHeight(){return this.mBottom;}},{key:'getLineCount',value:function getLineCount(){return 1;}},{key:'getLineTop',value:function getLineTop(line){if(line==0)return 0;else return this.mBottom;}},{key:'getLineDescent',value:function getLineDescent(line){return this.mDesc;}},{key:'getLineStart',value:function getLineStart(line){if(line==0)return 0;else return this.getText().length;}},{key:'getParagraphDirection',value:function getParagraphDirection(line){return BoringLayout.DIR_LEFT_TO_RIGHT;}},{key:'getLineContainsTab',value:function getLineContainsTab(line){return false;}},{key:'getLineMax',value:function getLineMax(line){return this.mMax;}},{key:'getLineDirections',value:function getLineDirections(line){return Layout.DIRS_ALL_LEFT_TO_RIGHT;}},{key:'getTopPadding',value:function getTopPadding(){return this.mTopPadding;}},{key:'getBottomPadding',value:function getBottomPadding(){return this.mBottomPadding;}},{key:'getEllipsisCount',value:function getEllipsisCount(line){return this.mEllipsizedCount;}},{key:'getEllipsisStart',value:function getEllipsisStart(line){return this.mEllipsizedStart;}},{key:'getEllipsizedWidth',value:function getEllipsizedWidth(){return this.mEllipsizedWidth;}},{key:'draw',value:function draw(c,highlight,highlightpaint,cursorOffset){if(this.mDirect!=null&&highlight==null){c.drawText(this.mDirect,0,this.mBottom-this.mDesc,this.mPaint);}else{_get2(BoringLayout.prototype.__proto__||Object.getPrototypeOf(BoringLayout.prototype),'draw',this).call(this,c,highlight,highlightpaint,cursorOffset);}}},{key:'ellipsized',value:function ellipsized(start,end){this.mEllipsizedStart=start;this.mEllipsizedCount=end-start;}}],[{key:'make',value:function make(source,paint,outerwidth,align,spacingmult,spacingadd,metrics,includepad){var ellipsize=arguments.length>8&&arguments[8]!==undefined?arguments[8]:null;var ellipsizedWidth=arguments.length>9&&arguments[9]!==undefined?arguments[9]:outerwidth;return new BoringLayout(source,paint,outerwidth,align,spacingmult,spacingadd,metrics,includepad,ellipsize,ellipsizedWidth);}},{key:'isBoring',value:function isBoring(text,paint){var textDir=arguments.length>2&&arguments[2]!==undefined?arguments[2]:TextDirectionHeuristics.FIRSTSTRONG_LTR;var metrics=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;var temp=void 0;var length=text.length;var boring=true;outer:for(var i=0;i<length;i+=500){var j=i+500;if(j>length)j=length;temp=text.substring(i,j);var n=j-i;for(var _a11=0;_a11<n;_a11++){var c=temp[_a11];if(c=='\\n'||c=='\\t'){boring=false;break outer;}}if(textDir!=null&&textDir.isRtl(temp,0,n)){boring=false;break outer;}}if(boring&&Spanned.isImplements(text)){var sp=text;var styles=sp.getSpans(0,length,ParagraphStyle.type);if(styles.length>0){boring=false;}}if(boring){var fm=metrics;if(fm==null){fm=new BoringLayout.Metrics();}var line=TextLine.obtain();line.set(paint,text,0,length,Layout.DIR_LEFT_TO_RIGHT,Layout.DIRS_ALL_LEFT_TO_RIGHT,false,null);fm.width=Math.floor(Math.ceil(line.metrics(fm)));TextLine.recycle(line);return fm;}else{return null;}}}]);return BoringLayout;}(Layout);BoringLayout.FIRST_RIGHT_TO_LEFT='֐'.codePointAt(0);BoringLayout.sTemp=new TextPaint();text_8.BoringLayout=BoringLayout;(function(BoringLayout){var Metrics=function(_Paint$FontMetricsInt){_inherits(Metrics,_Paint$FontMetricsInt);function Metrics(){_classCallCheck(this,Metrics);var _this93=_possibleConstructorReturn(this,(Metrics.__proto__||Object.getPrototypeOf(Metrics)).apply(this,arguments));_this93.width=0;return _this93;}_createClass(Metrics,[{key:'toString',value:function toString(){return _get2(Metrics.prototype.__proto__||Object.getPrototypeOf(Metrics.prototype),'toString',this).call(this)+\" width=\"+this.width;}}]);return Metrics;}(Paint.FontMetricsInt);BoringLayout.Metrics=Metrics;})(BoringLayout=text_8.BoringLayout||(text_8.BoringLayout={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text){var System=java.lang.System;var PackedIntVector=function(){function PackedIntVector(columns){_classCallCheck(this,PackedIntVector);this.mColumns=0;this.mRows=0;this.mRowGapStart=0;this.mRowGapLength=0;this.mColumns=columns;this.mRows=0;this.mRowGapStart=0;this.mRowGapLength=this.mRows;this.mValues=null;this.mValueGap=androidui.util.ArrayCreator.newNumberArray(2*columns);}_createClass(PackedIntVector,[{key:'getValue',value:function getValue(row,column){var columns=this.mColumns;if((row|column)<0||row>=this.size()||column>=columns){throw Error('new IndexOutOfBoundsException(row + \", \" + column)');}if(row>=this.mRowGapStart){row+=this.mRowGapLength;}var value=this.mValues[row*columns+column];var valuegap=this.mValueGap;if(row>=valuegap[column]){value+=valuegap[column+columns];}return value;}},{key:'setValue',value:function setValue(row,column,value){if((row|column)<0||row>=this.size()||column>=this.mColumns){throw Error('new IndexOutOfBoundsException(row + \", \" + column)');}if(row>=this.mRowGapStart){row+=this.mRowGapLength;}var valuegap=this.mValueGap;if(row>=valuegap[column]){value-=valuegap[column+this.mColumns];}this.mValues[row*this.mColumns+column]=value;}},{key:'setValueInternal',value:function setValueInternal(row,column,value){if(row>=this.mRowGapStart){row+=this.mRowGapLength;}var valuegap=this.mValueGap;if(row>=valuegap[column]){value-=valuegap[column+this.mColumns];}this.mValues[row*this.mColumns+column]=value;}},{key:'adjustValuesBelow',value:function adjustValuesBelow(startRow,column,delta){if((startRow|column)<0||startRow>this.size()||column>=this.width()){throw Error('new IndexOutOfBoundsException(startRow + \", \" + column)');}if(startRow>=this.mRowGapStart){startRow+=this.mRowGapLength;}this.moveValueGapTo(column,startRow);this.mValueGap[column+this.mColumns]+=delta;}},{key:'insertAt',value:function insertAt(row,values){if(row<0||row>this.size()){throw Error('new IndexOutOfBoundsException(\"row \" + row)');}if(values!=null&&values.length<this.width()){throw Error('new IndexOutOfBoundsException(\"value count \" + values.length)');}this.moveRowGapTo(row);if(this.mRowGapLength==0){this.growBuffer();}this.mRowGapStart++;this.mRowGapLength--;if(values==null){for(var i=this.mColumns-1;i>=0;i--){this.setValueInternal(row,i,0);}}else{for(var _i26=this.mColumns-1;_i26>=0;_i26--){this.setValueInternal(row,_i26,values[_i26]);}}}},{key:'deleteAt',value:function deleteAt(row,count){if((row|count)<0||row+count>this.size()){throw Error('new IndexOutOfBoundsException(row + \", \" + count)');}this.moveRowGapTo(row+count);this.mRowGapStart-=count;this.mRowGapLength+=count;}},{key:'size',value:function size(){return this.mRows-this.mRowGapLength;}},{key:'width',value:function width(){return this.mColumns;}},{key:'growBuffer',value:function growBuffer(){var columns=this.mColumns;var newsize=this.size()+1;newsize=newsize*columns/columns;var newvalues=androidui.util.ArrayCreator.newNumberArray(newsize*columns);var valuegap=this.mValueGap;var rowgapstart=this.mRowGapStart;var after=this.mRows-(rowgapstart+this.mRowGapLength);if(this.mValues!=null){System.arraycopy(this.mValues,0,newvalues,0,columns*rowgapstart);System.arraycopy(this.mValues,(this.mRows-after)*columns,newvalues,(newsize-after)*columns,after*columns);}for(var i=0;i<columns;i++){if(valuegap[i]>=rowgapstart){valuegap[i]+=newsize-this.mRows;if(valuegap[i]<rowgapstart){valuegap[i]=rowgapstart;}}}this.mRowGapLength+=newsize-this.mRows;this.mRows=newsize;this.mValues=newvalues;}},{key:'moveValueGapTo',value:function moveValueGapTo(column,where){var valuegap=this.mValueGap;var values=this.mValues;var columns=this.mColumns;if(where==valuegap[column]){return;}else if(where>valuegap[column]){for(var i=valuegap[column];i<where;i++){values[i*columns+column]+=valuegap[column+columns];}}else{for(var _i27=where;_i27<valuegap[column];_i27++){values[_i27*columns+column]-=valuegap[column+columns];}}valuegap[column]=where;}},{key:'moveRowGapTo',value:function moveRowGapTo(where){if(where==this.mRowGapStart){return;}else if(where>this.mRowGapStart){var moving=where+this.mRowGapLength-(this.mRowGapStart+this.mRowGapLength);var columns=this.mColumns;var valuegap=this.mValueGap;var values=this.mValues;var gapend=this.mRowGapStart+this.mRowGapLength;for(var i=gapend;i<gapend+moving;i++){var destrow=i-gapend+this.mRowGapStart;for(var j=0;j<columns;j++){var val=values[i*columns+j];if(i>=valuegap[j]){val+=valuegap[j+columns];}if(destrow>=valuegap[j]){val-=valuegap[j+columns];}values[destrow*columns+j]=val;}}}else{var _moving=this.mRowGapStart-where;var _columns=this.mColumns;var _valuegap=this.mValueGap;var _values=this.mValues;var _gapend=this.mRowGapStart+this.mRowGapLength;for(var _i28=where+_moving-1;_i28>=where;_i28--){var _destrow=_i28-where+_gapend-_moving;for(var _j2=0;_j2<_columns;_j2++){var _val=_values[_i28*_columns+_j2];if(_i28>=_valuegap[_j2]){_val+=_valuegap[_j2+_columns];}if(_destrow>=_valuegap[_j2]){_val-=_valuegap[_j2+_columns];}_values[_destrow*_columns+_j2]=_val;}}}this.mRowGapStart=where;}}]);return PackedIntVector;}();text.PackedIntVector=PackedIntVector;})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text){var System=java.lang.System;var PackedObjectVector=function(){function PackedObjectVector(columns){_classCallCheck(this,PackedObjectVector);this.mColumns=0;this.mRows=0;this.mRowGapStart=0;this.mRowGapLength=0;this.mColumns=columns;this.mRows=1;this.mRowGapStart=0;this.mRowGapLength=this.mRows;this.mValues=new Array(this.mRows*this.mColumns);}_createClass(PackedObjectVector,[{key:'getValue',value:function getValue(row,column){if(row>=this.mRowGapStart)row+=this.mRowGapLength;var value=this.mValues[row*this.mColumns+column];return value;}},{key:'setValue',value:function setValue(row,column,value){if(row>=this.mRowGapStart)row+=this.mRowGapLength;this.mValues[row*this.mColumns+column]=value;}},{key:'insertAt',value:function insertAt(row,values){this.moveRowGapTo(row);if(this.mRowGapLength==0)this.growBuffer();this.mRowGapStart++;this.mRowGapLength--;if(values==null)for(var i=0;i<this.mColumns;i++){this.setValue(row,i,null);}else for(var _i29=0;_i29<this.mColumns;_i29++){this.setValue(row,_i29,values[_i29]);}}},{key:'deleteAt',value:function deleteAt(row,count){this.moveRowGapTo(row+count);this.mRowGapStart-=count;this.mRowGapLength+=count;if(this.mRowGapLength>this.size()*2){}}},{key:'size',value:function size(){return this.mRows-this.mRowGapLength;}},{key:'width',value:function width(){return this.mColumns;}},{key:'growBuffer',value:function growBuffer(){var newsize=this.size()+1;newsize=newsize*this.mColumns/this.mColumns;var newvalues=new Array(newsize*this.mColumns);var after=this.mRows-(this.mRowGapStart+this.mRowGapLength);System.arraycopy(this.mValues,0,newvalues,0,this.mColumns*this.mRowGapStart);System.arraycopy(this.mValues,(this.mRows-after)*this.mColumns,newvalues,(newsize-after)*this.mColumns,after*this.mColumns);this.mRowGapLength+=newsize-this.mRows;this.mRows=newsize;this.mValues=newvalues;}},{key:'moveRowGapTo',value:function moveRowGapTo(where){if(where==this.mRowGapStart)return;if(where>this.mRowGapStart){var moving=where+this.mRowGapLength-(this.mRowGapStart+this.mRowGapLength);for(var i=this.mRowGapStart+this.mRowGapLength;i<this.mRowGapStart+this.mRowGapLength+moving;i++){var destrow=i-(this.mRowGapStart+this.mRowGapLength)+this.mRowGapStart;for(var j=0;j<this.mColumns;j++){var val=this.mValues[i*this.mColumns+j];this.mValues[destrow*this.mColumns+j]=val;}}}else{var _moving2=this.mRowGapStart-where;for(var _i30=where+_moving2-1;_i30>=where;_i30--){var _destrow2=_i30-where+this.mRowGapStart+this.mRowGapLength-_moving2;for(var _j3=0;_j3<this.mColumns;_j3++){var _val2=this.mValues[_i30*this.mColumns+_j3];this.mValues[_destrow2*this.mColumns+_j3]=_val2;}}}this.mRowGapStart=where;}},{key:'dump',value:function dump(){for(var i=0;i<this.mRows;i++){for(var j=0;j<this.mColumns;j++){var val=this.mValues[i*this.mColumns+j];if(i<this.mRowGapStart||i>=this.mRowGapStart+this.mRowGapLength)System.out.print(val+\" \");else System.out.print(\"(\"+val+\") \");}System.out.print(\" << \\n\");}System.out.print(\"-----\\n\\n\");}}]);return PackedObjectVector;}();text.PackedObjectVector=PackedObjectVector;})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text){var Spannable;(function(Spannable){function isImpl(obj){return obj&&obj['setSpan']&&obj['removeSpan'];}Spannable.isImpl=isImpl;var Factory=function(){function Factory(){_classCallCheck(this,Factory);}_createClass(Factory,[{key:'newSpannable',value:function newSpannable(source){return source;}}],[{key:'getInstance',value:function getInstance(){return Factory.sInstance;}}]);return Factory;}();Factory.sInstance=new Factory();Spannable.Factory=Factory;})(Spannable=text.Spannable||(text.Spannable={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text_9){var style;(function(style){var LineHeightSpan;(function(LineHeightSpan){LineHeightSpan.type=Symbol();})(LineHeightSpan=style.LineHeightSpan||(style.LineHeightSpan={}));})(style=text_9.style||(text_9.style={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text_10){var Paint=android.graphics.Paint;var LeadingMarginSpan=android.text.style.LeadingMarginSpan;var LeadingMarginSpan2=android.text.style.LeadingMarginSpan.LeadingMarginSpan2;var LineHeightSpan=android.text.style.LineHeightSpan;var MetricAffectingSpan=android.text.style.MetricAffectingSpan;var TabStopSpan=android.text.style.TabStopSpan;var Integer=java.lang.Integer;var System=java.lang.System;var Layout=android.text.Layout;var MeasuredText=android.text.MeasuredText;var Spanned=android.text.Spanned;var TextUtils=android.text.TextUtils;var StaticLayout=function(_Layout2){_inherits(StaticLayout,_Layout2);function StaticLayout(source,bufstart,bufend,paint,outerwidth,align,textDir,spacingmult,spacingadd,includepad){var ellipsize=arguments.length>10&&arguments[10]!==undefined?arguments[10]:null;var ellipsizedWidth=arguments.length>11&&arguments[11]!==undefined?arguments[11]:0;var maxLines=arguments.length>12&&arguments[12]!==undefined?arguments[12]:Integer.MAX_VALUE;_classCallCheck(this,StaticLayout);var _this94=_possibleConstructorReturn(this,(StaticLayout.__proto__||Object.getPrototypeOf(StaticLayout)).call(this,ellipsize==null?source:Spanned.isImplements(source)?new Layout.SpannedEllipsizer(source):new Layout.Ellipsizer(source),paint,outerwidth,align,textDir,spacingmult,spacingadd));_this94.mLineCount=0;_this94.mTopPadding=0;_this94.mBottomPadding=0;_this94.mColumns=0;_this94.mEllipsizedWidth=0;_this94.mMaximumVisibleLineCount=Integer.MAX_VALUE;_this94.mFontMetricsInt=new Paint.FontMetricsInt();if(source==null){_this94.mColumns=StaticLayout.COLUMNS_ELLIPSIZE;_this94.mLines=androidui.util.ArrayCreator.newNumberArray(2*_this94.mColumns);_this94.mLineDirections=new Array(2*_this94.mColumns);_this94.mMeasured=MeasuredText.obtain();return _possibleConstructorReturn(_this94);}if(ellipsize!=null){var e=_this94.getText();e.mLayout=_this94;e.mWidth=ellipsizedWidth;e.mMethod=ellipsize;_this94.mEllipsizedWidth=ellipsizedWidth;_this94.mColumns=StaticLayout.COLUMNS_ELLIPSIZE;}else{_this94.mColumns=StaticLayout.COLUMNS_NORMAL;_this94.mEllipsizedWidth=outerwidth;}_this94.mLines=androidui.util.ArrayCreator.newNumberArray(2*_this94.mColumns);_this94.mLineDirections=new Array(2*_this94.mColumns);_this94.mMaximumVisibleLineCount=maxLines;_this94.mMeasured=MeasuredText.obtain();_this94.generate(source,bufstart,bufend,paint,outerwidth,textDir,spacingmult,spacingadd,includepad,includepad,ellipsizedWidth,ellipsize);_this94.mMeasured=MeasuredText.recycle(_this94.mMeasured);_this94.mFontMetricsInt=null;return _this94;}_createClass(StaticLayout,[{key:'generate',value:function generate(source,bufStart,bufEnd,paint,outerWidth,textDir,spacingmult,spacingadd,includepad,trackpad,ellipsizedWidth,ellipsize){this.mLineCount=0;var v=0;var needMultiply=spacingmult!=1||spacingadd!=0;var fm=this.mFontMetricsInt;var chooseHtv=null;var measured=this.mMeasured;var spanned=null;if(Spanned.isImplements(source))spanned=source;var DEFAULT_DIR=StaticLayout.DIR_LEFT_TO_RIGHT;var paraEnd=void 0;for(var paraStart=bufStart;paraStart<=bufEnd;paraStart=paraEnd){paraEnd=source.substring(0,bufEnd).indexOf(StaticLayout.CHAR_NEW_LINE,paraStart);if(paraEnd<0)paraEnd=bufEnd;else paraEnd++;var firstWidthLineLimit=this.mLineCount+1;var firstWidth=outerWidth;var restWidth=outerWidth;var chooseHt=null;if(spanned!=null){var sp=StaticLayout.getParagraphSpans(spanned,paraStart,paraEnd,LeadingMarginSpan.type);for(var i=0;i<sp.length;i++){var lms=sp[i];firstWidth-=sp[i].getLeadingMargin(true);restWidth-=sp[i].getLeadingMargin(false);if(LeadingMarginSpan2.isImpl(lms)){var lms2=lms;var lmsFirstLine=this.getLineForOffset(spanned.getSpanStart(lms2));firstWidthLineLimit=lmsFirstLine+lms2.getLeadingMarginLineCount();}}chooseHt=StaticLayout.getParagraphSpans(spanned,paraStart,paraEnd,LineHeightSpan.type);if(chooseHt.length!=0){if(chooseHtv==null||chooseHtv.length<chooseHt.length){chooseHtv=androidui.util.ArrayCreator.newNumberArray(chooseHt.length);}for(var _i31=0;_i31<chooseHt.length;_i31++){var o=spanned.getSpanStart(chooseHt[_i31]);if(o<paraStart){chooseHtv[_i31]=this.getLineTop(this.getLineForOffset(o));}else{chooseHtv[_i31]=v;}}}}measured.setPara(source,paraStart,paraEnd,textDir);var chs=measured.mChars;var widths=measured.mWidths;var chdirs=measured.mLevels;var dir=measured.mDir;var easy=measured.mEasy;var width=firstWidth;var w=0;var here=paraStart;var ok=paraStart;var okWidth=w;var okAscent=0,okDescent=0,okTop=0,okBottom=0;var fit=paraStart;var fitWidth=w;var fitAscent=0,fitDescent=0,fitTop=0,fitBottom=0;var hasTabOrEmoji=false;var hasTab=false;var tabStops=null;for(var spanStart=paraStart,spanEnd;spanStart<paraEnd;spanStart=spanEnd){if(spanned==null){spanEnd=paraEnd;var spanLen=spanEnd-spanStart;measured.addStyleRun(paint,spanLen,fm);}else{spanEnd=spanned.nextSpanTransition(spanStart,paraEnd,MetricAffectingSpan.type);var _spanLen=spanEnd-spanStart;var spans=spanned.getSpans(spanStart,spanEnd,MetricAffectingSpan.type);spans=TextUtils.removeEmptySpans(spans,spanned,MetricAffectingSpan.type);measured.addStyleRun(paint,spans,_spanLen,fm);}var fmTop=fm.top;var fmBottom=fm.bottom;var fmAscent=fm.ascent;var fmDescent=fm.descent;for(var j=spanStart;j<spanEnd;j++){var c=chs[j-paraStart];if(c==StaticLayout.CHAR_NEW_LINE){}else if(c==StaticLayout.CHAR_TAB){if(hasTab==false){hasTab=true;hasTabOrEmoji=true;if(spanned!=null){var _spans=StaticLayout.getParagraphSpans(spanned,paraStart,paraEnd,TabStopSpan.type);if(_spans.length>0){tabStops=new Layout.TabStops(StaticLayout.TAB_INCREMENT,_spans);}}}if(tabStops!=null){w=tabStops.nextTab(w);}else{w=StaticLayout.TabStops.nextDefaultStop(w,StaticLayout.TAB_INCREMENT);}}else if(c.codePointAt(0)>=StaticLayout.CHAR_FIRST_HIGH_SURROGATE&&c.codePointAt(0)<=StaticLayout.CHAR_LAST_LOW_SURROGATE&&j+1<spanEnd){var emoji=chs.codePointAt(j-paraStart);w+=widths[j-paraStart];}else{w+=widths[j-paraStart];}var isSpaceOrTab=c==StaticLayout.CHAR_SPACE||c==StaticLayout.CHAR_TAB||c==StaticLayout.CHAR_ZWSP;if(w<=width||isSpaceOrTab){fitWidth=w;fit=j+1;if(fmTop<fitTop)fitTop=fmTop;if(fmAscent<fitAscent)fitAscent=fmAscent;if(fmDescent>fitDescent)fitDescent=fmDescent;if(fmBottom>fitBottom)fitBottom=fmBottom;var isLineBreak=isSpaceOrTab||(c==StaticLayout.CHAR_SLASH||c==StaticLayout.CHAR_HYPHEN)&&(j+1>=spanEnd||!Number.isInteger(Number.parseInt(chs[j+1-paraStart])))||c.codePointAt(0)>=StaticLayout.CHAR_FIRST_CJK.codePointAt(0)&&StaticLayout.isIdeographic(c,true)&&j+1<spanEnd&&StaticLayout.isIdeographic(chs[j+1-paraStart],false);if(isLineBreak){okWidth=w;ok=j+1;if(fitTop<okTop)okTop=fitTop;if(fitAscent<okAscent)okAscent=fitAscent;if(fitDescent>okDescent)okDescent=fitDescent;if(fitBottom>okBottom)okBottom=fitBottom;}}else{var moreChars=j+1<spanEnd;var endPos=void 0;var above=void 0,below=void 0,top=void 0,bottom=void 0;var currentTextWidth=void 0;if(ok!=here){endPos=ok;above=okAscent;below=okDescent;top=okTop;bottom=okBottom;currentTextWidth=okWidth;}else if(fit!=here){endPos=fit;above=fitAscent;below=fitDescent;top=fitTop;bottom=fitBottom;currentTextWidth=fitWidth;}else{endPos=here+1;above=fm.ascent;below=fm.descent;top=fm.top;bottom=fm.bottom;currentTextWidth=widths[here-paraStart];}v=this.out(source,here,endPos,above,below,top,bottom,v,spacingmult,spacingadd,chooseHt,chooseHtv,fm,hasTabOrEmoji,needMultiply,chdirs,dir,easy,bufEnd,includepad,trackpad,chs,widths,paraStart,ellipsize,ellipsizedWidth,currentTextWidth,paint,moreChars);here=endPos;j=here-1;ok=fit=here;w=0;fitAscent=fitDescent=fitTop=fitBottom=0;okAscent=okDescent=okTop=okBottom=0;if(--firstWidthLineLimit<=0){width=restWidth;}if(here<spanStart){measured.setPos(here);spanEnd=here;break;}if(this.mLineCount>=this.mMaximumVisibleLineCount){break;}}}}if(paraEnd!=here&&this.mLineCount<this.mMaximumVisibleLineCount){if((fitTop|fitBottom|fitDescent|fitAscent)==0){paint.getFontMetricsInt(fm);fitTop=fm.top;fitBottom=fm.bottom;fitAscent=fm.ascent;fitDescent=fm.descent;}v=this.out(source,here,paraEnd,fitAscent,fitDescent,fitTop,fitBottom,v,spacingmult,spacingadd,chooseHt,chooseHtv,fm,hasTabOrEmoji,needMultiply,chdirs,dir,easy,bufEnd,includepad,trackpad,chs,widths,paraStart,ellipsize,ellipsizedWidth,w,paint,paraEnd!=bufEnd);}paraStart=paraEnd;if(paraEnd==bufEnd)break;}if((bufEnd==bufStart||source.charAt(bufEnd-1)==StaticLayout.CHAR_NEW_LINE)&&this.mLineCount<this.mMaximumVisibleLineCount){measured.setPara(source,bufStart,bufEnd,textDir);paint.getFontMetricsInt(fm);v=this.out(source,bufEnd,bufEnd,fm.ascent,fm.descent,fm.top,fm.bottom,v,spacingmult,spacingadd,null,null,fm,false,needMultiply,measured.mLevels,measured.mDir,measured.mEasy,bufEnd,includepad,trackpad,null,null,bufStart,ellipsize,ellipsizedWidth,0,paint,false);}}},{key:'out',value:function out(text,start,end,above,below,top,bottom,v,spacingmult,spacingadd,chooseHt,chooseHtv,fm,hasTabOrEmoji,needMultiply,chdirs,dir,easy,bufEnd,includePad,trackPad,chs,widths,widthStart,ellipsize,ellipsisWidth,textWidth,paint,moreChars){var j=this.mLineCount;var off=j*this.mColumns;var want=off+this.mColumns+StaticLayout.TOP;var lines=this.mLines;if(want>=lines.length){var nlen=want+1;var grow=androidui.util.ArrayCreator.newNumberArray(nlen);System.arraycopy(lines,0,grow,0,lines.length);this.mLines=grow;lines=grow;var grow2=new Array(nlen);System.arraycopy(this.mLineDirections,0,grow2,0,this.mLineDirections.length);this.mLineDirections=grow2;}if(chooseHt!=null){fm.ascent=above;fm.descent=below;fm.top=top;fm.bottom=bottom;for(var i=0;i<chooseHt.length;i++){chooseHt[i].chooseHeight(text,start,end,chooseHtv[i],v,fm,paint);}above=fm.ascent;below=fm.descent;top=fm.top;bottom=fm.bottom;}if(j==0){if(trackPad){this.mTopPadding=top-above;}if(includePad){above=top;}}if(end==bufEnd){if(trackPad){this.mBottomPadding=bottom-below;}if(includePad){below=bottom;}}var extra=void 0;if(needMultiply){var ex=(below-above)*(spacingmult-1)+spacingadd;if(ex>=0){extra=Math.floor(ex+StaticLayout.EXTRA_ROUNDING);}else{extra=-Math.floor(-ex+StaticLayout.EXTRA_ROUNDING);}}else{extra=0;}lines[off+StaticLayout.START]=start;lines[off+StaticLayout.TOP]=v;lines[off+StaticLayout.DESCENT]=below+extra;v+=below-above+extra;lines[off+this.mColumns+StaticLayout.START]=end;lines[off+this.mColumns+StaticLayout.TOP]=v;if(hasTabOrEmoji)lines[off+StaticLayout.TAB]|=StaticLayout.TAB_MASK;lines[off+StaticLayout.DIR]|=dir<<StaticLayout.DIR_SHIFT;var linedirs=StaticLayout.DIRS_ALL_LEFT_TO_RIGHT;this.mLineDirections[j]=linedirs;if(ellipsize!=null){var firstLine=j==0;var currentLineIsTheLastVisibleOne=j+1==this.mMaximumVisibleLineCount;var forceEllipsis=moreChars&&this.mLineCount+1==this.mMaximumVisibleLineCount;var doEllipsis=(this.mMaximumVisibleLineCount==1&&moreChars||firstLine&&!moreChars)&&ellipsize!=TextUtils.TruncateAt.MARQUEE||!firstLine&&(currentLineIsTheLastVisibleOne||!moreChars)&&ellipsize==TextUtils.TruncateAt.END;if(doEllipsis){this.calculateEllipsis(start,end,widths,widthStart,ellipsisWidth,ellipsize,j,textWidth,paint,forceEllipsis);}}this.mLineCount++;return v;}},{key:'calculateEllipsis',value:function calculateEllipsis(lineStart,lineEnd,widths,widthStart,avail,where,line,textWidth,paint,forceEllipsis){if(textWidth<=avail&&!forceEllipsis){this.mLines[this.mColumns*line+StaticLayout.ELLIPSIS_START]=0;this.mLines[this.mColumns*line+StaticLayout.ELLIPSIS_COUNT]=0;return;}var ellipsisWidth=paint.measureText(where==TextUtils.TruncateAt.END_SMALL?StaticLayout.ELLIPSIS_TWO_DOTS[0]:StaticLayout.ELLIPSIS_NORMAL[0],0,1);var ellipsisStart=0;var ellipsisCount=0;var len=lineEnd-lineStart;if(where==TextUtils.TruncateAt.START){if(this.mMaximumVisibleLineCount==1){var sum=0;var i=void 0;for(i=len;i>=0;i--){var w=widths[i-1+lineStart-widthStart];if(w+sum+ellipsisWidth>avail){break;}sum+=w;}ellipsisStart=0;ellipsisCount=i;}else{}}else if(where==TextUtils.TruncateAt.END||where==TextUtils.TruncateAt.MARQUEE||where==TextUtils.TruncateAt.END_SMALL){var _sum=0;var _i32=void 0;for(_i32=0;_i32<len;_i32++){var _w=widths[_i32+lineStart-widthStart];if(_w+_sum+ellipsisWidth>avail){break;}_sum+=_w;}ellipsisStart=_i32;ellipsisCount=len-_i32;if(forceEllipsis&&ellipsisCount==0&&len>0){ellipsisStart=len-1;ellipsisCount=1;}}else{if(this.mMaximumVisibleLineCount==1){var lsum=0,rsum=0;var left=0,right=len;var ravail=(avail-ellipsisWidth)/2;for(right=len;right>=0;right--){var _w2=widths[right-1+lineStart-widthStart];if(_w2+rsum>ravail){break;}rsum+=_w2;}var lavail=avail-ellipsisWidth-rsum;for(left=0;left<right;left++){var _w3=widths[left+lineStart-widthStart];if(_w3+lsum>lavail){break;}lsum+=_w3;}ellipsisStart=left;ellipsisCount=right-left;}else{}}this.mLines[this.mColumns*line+StaticLayout.ELLIPSIS_START]=ellipsisStart;this.mLines[this.mColumns*line+StaticLayout.ELLIPSIS_COUNT]=ellipsisCount;}},{key:'getLineForVertical',value:function getLineForVertical(vertical){var high=this.mLineCount;var low=-1;var guess=void 0;var lines=this.mLines;while(high-low>1){guess=high+low>>1;if(lines[this.mColumns*guess+StaticLayout.TOP]>vertical){high=guess;}else{low=guess;}}if(low<0){return 0;}else{return low;}}},{key:'getLineCount',value:function getLineCount(){return this.mLineCount;}},{key:'getLineTop',value:function getLineTop(line){var top=this.mLines[this.mColumns*line+StaticLayout.TOP];if(this.mMaximumVisibleLineCount>0&&line>=this.mMaximumVisibleLineCount&&line!=this.mLineCount){top+=this.getBottomPadding();}return top;}},{key:'getLineDescent',value:function getLineDescent(line){var descent=this.mLines[this.mColumns*line+StaticLayout.DESCENT];if(this.mMaximumVisibleLineCount>0&&line>=this.mMaximumVisibleLineCount-1&&line!=this.mLineCount){descent+=this.getBottomPadding();}return descent;}},{key:'getLineStart',value:function getLineStart(line){return this.mLines[this.mColumns*line+StaticLayout.START]&StaticLayout.START_MASK;}},{key:'getParagraphDirection',value:function getParagraphDirection(line){return this.mLines[this.mColumns*line+StaticLayout.DIR]>>StaticLayout.DIR_SHIFT;}},{key:'getLineContainsTab',value:function getLineContainsTab(line){return(this.mLines[this.mColumns*line+StaticLayout.TAB]&StaticLayout.TAB_MASK)!=0;}},{key:'getLineDirections',value:function getLineDirections(line){return this.mLineDirections[line];}},{key:'getTopPadding',value:function getTopPadding(){return this.mTopPadding;}},{key:'getBottomPadding',value:function getBottomPadding(){return this.mBottomPadding;}},{key:'getEllipsisCount',value:function getEllipsisCount(line){if(this.mColumns<StaticLayout.COLUMNS_ELLIPSIZE){return 0;}return this.mLines[this.mColumns*line+StaticLayout.ELLIPSIS_COUNT];}},{key:'getEllipsisStart',value:function getEllipsisStart(line){if(this.mColumns<StaticLayout.COLUMNS_ELLIPSIZE){return 0;}return this.mLines[this.mColumns*line+StaticLayout.ELLIPSIS_START];}},{key:'getEllipsizedWidth',value:function getEllipsizedWidth(){return this.mEllipsizedWidth;}},{key:'prepare',value:function prepare(){this.mMeasured=MeasuredText.obtain();}},{key:'finish',value:function finish(){this.mMeasured=MeasuredText.recycle(this.mMeasured);}}],[{key:'isIdeographic',value:function isIdeographic(c,includeNonStarters){var code=c.codePointAt(0);if(code>='⺀'.codePointAt(0)&&code<='⿿'.codePointAt(0)){return true;}if(c=='　'){return true;}if(code>='぀'.codePointAt(0)&&code<='ゟ'.codePointAt(0)){if(!includeNonStarters){switch(c){case'ぁ':case'ぃ':case'ぅ':case'ぇ':case'ぉ':case'っ':case'ゃ':case'ゅ':case'ょ':case'ゎ':case'ゕ':case'ゖ':case'゛':case'゜':case'ゝ':case'ゞ':return false;}}return true;}if(code>='゠'.codePointAt(0)&&code<='ヿ'.codePointAt(0)){if(!includeNonStarters){switch(c){case'゠':case'ァ':case'ィ':case'ゥ':case'ェ':case'ォ':case'ッ':case'ャ':case'ュ':case'ョ':case'ヮ':case'ヵ':case'ヶ':case'・':case'ー':case'ヽ':case'ヾ':return false;}}return true;}if(code>='㐀'.codePointAt(0)&&code<='䶵'.codePointAt(0)){return true;}if(code>='一'.codePointAt(0)&&code<='龻'.codePointAt(0)){return true;}if(code>='豈'.codePointAt(0)&&code<='龎'.codePointAt(0)){return true;}if(code>='ꀀ'.codePointAt(0)&&code<='꒏'.codePointAt(0)){return true;}if(code>='꒐'.codePointAt(0)&&code<='꓏'.codePointAt(0)){return true;}if(code>='﹢'.codePointAt(0)&&code<='﹦'.codePointAt(0)){return true;}if(code>='０'.codePointAt(0)&&code<='９'.codePointAt(0)){return true;}return false;}}]);return StaticLayout;}(Layout);StaticLayout.TAG=\"StaticLayout\";StaticLayout.COLUMNS_NORMAL=3;StaticLayout.COLUMNS_ELLIPSIZE=5;StaticLayout.START=0;StaticLayout.DIR=StaticLayout.START;StaticLayout.TAB=StaticLayout.START;StaticLayout.TOP=1;StaticLayout.DESCENT=2;StaticLayout.ELLIPSIS_START=3;StaticLayout.ELLIPSIS_COUNT=4;StaticLayout.START_MASK=0x1FFFFFFF;StaticLayout.DIR_SHIFT=30;StaticLayout.TAB_MASK=0x20000000;StaticLayout.CHAR_FIRST_CJK='⺀';StaticLayout.CHAR_NEW_LINE='\\n';StaticLayout.CHAR_TAB='\\t';StaticLayout.CHAR_SPACE=' ';StaticLayout.CHAR_SLASH='/';StaticLayout.CHAR_HYPHEN='-';StaticLayout.CHAR_ZWSP='​';StaticLayout.EXTRA_ROUNDING=0.5;StaticLayout.CHAR_FIRST_HIGH_SURROGATE=0xD800;StaticLayout.CHAR_LAST_LOW_SURROGATE=0xDFFF;text_10.StaticLayout=StaticLayout;})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text_11){var Paint=android.graphics.Paint;var System=java.lang.System;var Layout=android.text.Layout;var PackedIntVector=android.text.PackedIntVector;var PackedObjectVector=android.text.PackedObjectVector;var Spanned=android.text.Spanned;var StaticLayout=android.text.StaticLayout;var DynamicLayout=function(_Layout3){_inherits(DynamicLayout,_Layout3);function DynamicLayout(base,display,paint,width,align,textDir,spacingmult,spacingadd,includepad){var ellipsize=arguments.length>9&&arguments[9]!==undefined?arguments[9]:null;var ellipsizedWidth=arguments.length>10&&arguments[10]!==undefined?arguments[10]:0;_classCallCheck(this,DynamicLayout);var _this95=_possibleConstructorReturn(this,(DynamicLayout.__proto__||Object.getPrototypeOf(DynamicLayout)).call(this,ellipsize==null?display:Spanned.isImplements(display)?new Layout.SpannedEllipsizer(display):new Layout.Ellipsizer(display),paint,width,align,textDir,spacingmult,spacingadd));_this95.mEllipsizedWidth=0;_this95.mNumberOfBlocks=0;_this95.mIndexFirstChangedBlock=0;_this95.mTopPadding=0;_this95.mBottomPadding=0;_this95.mBase=base;_this95.mDisplay=display;if(ellipsize!=null){_this95.mInts=new PackedIntVector(DynamicLayout.COLUMNS_ELLIPSIZE);_this95.mEllipsizedWidth=ellipsizedWidth;_this95.mEllipsizeAt=ellipsize;}else{_this95.mInts=new PackedIntVector(DynamicLayout.COLUMNS_NORMAL);_this95.mEllipsizedWidth=width;_this95.mEllipsizeAt=null;}_this95.mObjects=new PackedObjectVector(1);_this95.mIncludePad=includepad;if(ellipsize!=null){var e=_this95.getText();e.mLayout=_this95;e.mWidth=ellipsizedWidth;e.mMethod=ellipsize;_this95.mEllipsize=true;}var start=void 0;if(ellipsize!=null){start=androidui.util.ArrayCreator.newNumberArray(DynamicLayout.COLUMNS_ELLIPSIZE);start[DynamicLayout.ELLIPSIS_START]=DynamicLayout.ELLIPSIS_UNDEFINED;}else{start=androidui.util.ArrayCreator.newNumberArray(DynamicLayout.COLUMNS_NORMAL);}var dirs=[DynamicLayout.DIRS_ALL_LEFT_TO_RIGHT];var fm=new Paint.FontMetricsInt();paint.getFontMetricsInt(fm);var asc=fm.ascent;var desc=fm.descent;start[DynamicLayout.DIR]=DynamicLayout.DIR_LEFT_TO_RIGHT<<DynamicLayout.DIR_SHIFT;start[DynamicLayout.TOP]=0;start[DynamicLayout.DESCENT]=desc;_this95.mInts.insertAt(0,start);start[DynamicLayout.TOP]=desc-asc;_this95.mInts.insertAt(1,start);_this95.mObjects.insertAt(0,dirs);_this95.reflow(base,0,0,base.length);return _this95;}_createClass(DynamicLayout,[{key:'reflow',value:function reflow(s,where,before,after){if(s!=this.mBase)return;var text=this.mDisplay;var len=text.length;var find=text.lastIndexOf('\\n',where-1);if(find<0)find=0;else find=find+1;{var diff=where-find;before+=diff;after+=diff;where-=diff;}var look=text.indexOf('\\n',where+after);if(look<0)look=len;else look++;var change=look-(where+after);before+=change;after+=change;var startline=this.getLineForOffset(where);var startv=this.getLineTop(startline);var endline=this.getLineForOffset(where+before);if(where+after==len)endline=this.getLineCount();var endv=this.getLineTop(endline);var islast=endline==this.getLineCount();var reflowed=void 0;{reflowed=DynamicLayout.sStaticLayout;DynamicLayout.sStaticLayout=null;}if(reflowed==null){reflowed=new StaticLayout(null,0,0,null,0,null,null,0,1,true);}else{reflowed.prepare();}reflowed.generate(text,where,where+after,this.getPaint(),this.getWidth(),this.getTextDirectionHeuristic(),this.getSpacingMultiplier(),this.getSpacingAdd(),false,true,this.mEllipsizedWidth,this.mEllipsizeAt);var n=reflowed.getLineCount();if(where+after!=len&&reflowed.getLineStart(n-1)==where+after)n--;this.mInts.deleteAt(startline,endline-startline);this.mObjects.deleteAt(startline,endline-startline);var ht=reflowed.getLineTop(n);var toppad=0,botpad=0;if(this.mIncludePad&&startline==0){toppad=reflowed.getTopPadding();this.mTopPadding=toppad;ht-=toppad;}if(this.mIncludePad&&islast){botpad=reflowed.getBottomPadding();this.mBottomPadding=botpad;ht+=botpad;}this.mInts.adjustValuesBelow(startline,DynamicLayout.START,after-before);this.mInts.adjustValuesBelow(startline,DynamicLayout.TOP,startv-endv+ht);var ints=void 0;if(this.mEllipsize){ints=androidui.util.ArrayCreator.newNumberArray(DynamicLayout.COLUMNS_ELLIPSIZE);ints[DynamicLayout.ELLIPSIS_START]=DynamicLayout.ELLIPSIS_UNDEFINED;}else{ints=androidui.util.ArrayCreator.newNumberArray(DynamicLayout.COLUMNS_NORMAL);}var objects=new Array(1);for(var i=0;i<n;i++){ints[DynamicLayout.START]=reflowed.getLineStart(i)|reflowed.getParagraphDirection(i)<<DynamicLayout.DIR_SHIFT|(reflowed.getLineContainsTab(i)?DynamicLayout.TAB_MASK:0);var top=reflowed.getLineTop(i)+startv;if(i>0)top-=toppad;ints[DynamicLayout.TOP]=top;var desc=reflowed.getLineDescent(i);if(i==n-1)desc+=botpad;ints[DynamicLayout.DESCENT]=desc;objects[0]=reflowed.getLineDirections(i);if(this.mEllipsize){ints[DynamicLayout.ELLIPSIS_START]=reflowed.getEllipsisStart(i);ints[DynamicLayout.ELLIPSIS_COUNT]=reflowed.getEllipsisCount(i);}this.mInts.insertAt(startline+i,ints);this.mObjects.insertAt(startline+i,objects);}this.updateBlocks(startline,endline-1,n);{DynamicLayout.sStaticLayout=reflowed;reflowed.finish();}}},{key:'createBlocks',value:function createBlocks(){var offset=DynamicLayout.BLOCK_MINIMUM_CHARACTER_LENGTH;this.mNumberOfBlocks=0;var text=this.mDisplay;while(true){offset=text.indexOf('\\n',offset);if(offset<0){this.addBlockAtOffset(text.length);break;}else{this.addBlockAtOffset(offset);offset+=DynamicLayout.BLOCK_MINIMUM_CHARACTER_LENGTH;}}this.mBlockIndices=androidui.util.ArrayCreator.newNumberArray(this.mBlockEndLines.length);for(var i=0;i<this.mBlockEndLines.length;i++){this.mBlockIndices[i]=DynamicLayout.INVALID_BLOCK_INDEX;}}},{key:'addBlockAtOffset',value:function addBlockAtOffset(offset){var line=this.getLineForOffset(offset);if(this.mBlockEndLines==null){this.mBlockEndLines=androidui.util.ArrayCreator.newNumberArray(1);this.mBlockEndLines[this.mNumberOfBlocks]=line;this.mNumberOfBlocks++;return;}var previousBlockEndLine=this.mBlockEndLines[this.mNumberOfBlocks-1];if(line>previousBlockEndLine){if(this.mNumberOfBlocks==this.mBlockEndLines.length){var blockEndLines=androidui.util.ArrayCreator.newNumberArray(this.mNumberOfBlocks+1);System.arraycopy(this.mBlockEndLines,0,blockEndLines,0,this.mNumberOfBlocks);this.mBlockEndLines=blockEndLines;}this.mBlockEndLines[this.mNumberOfBlocks]=line;this.mNumberOfBlocks++;}}},{key:'updateBlocks',value:function updateBlocks(startLine,endLine,newLineCount){if(this.mBlockEndLines==null){this.createBlocks();return;}var firstBlock=-1;var lastBlock=-1;for(var i=0;i<this.mNumberOfBlocks;i++){if(this.mBlockEndLines[i]>=startLine){firstBlock=i;break;}}for(var _i33=firstBlock;_i33<this.mNumberOfBlocks;_i33++){if(this.mBlockEndLines[_i33]>=endLine){lastBlock=_i33;break;}}var lastBlockEndLine=this.mBlockEndLines[lastBlock];var createBlockBefore=startLine>(firstBlock==0?0:this.mBlockEndLines[firstBlock-1]+1);var createBlock=newLineCount>0;var createBlockAfter=endLine<this.mBlockEndLines[lastBlock];var numAddedBlocks=0;if(createBlockBefore)numAddedBlocks++;if(createBlock)numAddedBlocks++;if(createBlockAfter)numAddedBlocks++;var numRemovedBlocks=lastBlock-firstBlock+1;var newNumberOfBlocks=this.mNumberOfBlocks+numAddedBlocks-numRemovedBlocks;if(newNumberOfBlocks==0){this.mBlockEndLines[0]=0;this.mBlockIndices[0]=DynamicLayout.INVALID_BLOCK_INDEX;this.mNumberOfBlocks=1;return;}if(newNumberOfBlocks>this.mBlockEndLines.length){var newSize=newNumberOfBlocks;var blockEndLines=androidui.util.ArrayCreator.newNumberArray(newSize);var blockIndices=androidui.util.ArrayCreator.newNumberArray(newSize);System.arraycopy(this.mBlockEndLines,0,blockEndLines,0,firstBlock);System.arraycopy(this.mBlockIndices,0,blockIndices,0,firstBlock);System.arraycopy(this.mBlockEndLines,lastBlock+1,blockEndLines,firstBlock+numAddedBlocks,this.mNumberOfBlocks-lastBlock-1);System.arraycopy(this.mBlockIndices,lastBlock+1,blockIndices,firstBlock+numAddedBlocks,this.mNumberOfBlocks-lastBlock-1);this.mBlockEndLines=blockEndLines;this.mBlockIndices=blockIndices;}else{System.arraycopy(this.mBlockEndLines,lastBlock+1,this.mBlockEndLines,firstBlock+numAddedBlocks,this.mNumberOfBlocks-lastBlock-1);System.arraycopy(this.mBlockIndices,lastBlock+1,this.mBlockIndices,firstBlock+numAddedBlocks,this.mNumberOfBlocks-lastBlock-1);}this.mNumberOfBlocks=newNumberOfBlocks;var newFirstChangedBlock=void 0;var deltaLines=newLineCount-(endLine-startLine+1);if(deltaLines!=0){newFirstChangedBlock=firstBlock+numAddedBlocks;for(var _i34=newFirstChangedBlock;_i34<this.mNumberOfBlocks;_i34++){this.mBlockEndLines[_i34]+=deltaLines;}}else{newFirstChangedBlock=this.mNumberOfBlocks;}this.mIndexFirstChangedBlock=Math.min(this.mIndexFirstChangedBlock,newFirstChangedBlock);var blockIndex=firstBlock;if(createBlockBefore){this.mBlockEndLines[blockIndex]=startLine-1;this.mBlockIndices[blockIndex]=DynamicLayout.INVALID_BLOCK_INDEX;blockIndex++;}if(createBlock){this.mBlockEndLines[blockIndex]=startLine+newLineCount-1;this.mBlockIndices[blockIndex]=DynamicLayout.INVALID_BLOCK_INDEX;blockIndex++;}if(createBlockAfter){this.mBlockEndLines[blockIndex]=lastBlockEndLine+deltaLines;this.mBlockIndices[blockIndex]=DynamicLayout.INVALID_BLOCK_INDEX;}}},{key:'setBlocksDataForTest',value:function setBlocksDataForTest(blockEndLines,blockIndices,numberOfBlocks){this.mBlockEndLines=androidui.util.ArrayCreator.newNumberArray(blockEndLines.length);this.mBlockIndices=androidui.util.ArrayCreator.newNumberArray(blockIndices.length);System.arraycopy(blockEndLines,0,this.mBlockEndLines,0,blockEndLines.length);System.arraycopy(blockIndices,0,this.mBlockIndices,0,blockIndices.length);this.mNumberOfBlocks=numberOfBlocks;}},{key:'getBlockEndLines',value:function getBlockEndLines(){return this.mBlockEndLines;}},{key:'getBlockIndices',value:function getBlockIndices(){return this.mBlockIndices;}},{key:'getNumberOfBlocks',value:function getNumberOfBlocks(){return this.mNumberOfBlocks;}},{key:'getIndexFirstChangedBlock',value:function getIndexFirstChangedBlock(){return this.mIndexFirstChangedBlock;}},{key:'setIndexFirstChangedBlock',value:function setIndexFirstChangedBlock(i){this.mIndexFirstChangedBlock=i;}},{key:'getLineCount',value:function getLineCount(){return this.mInts.size()-1;}},{key:'getLineTop',value:function getLineTop(line){return this.mInts.getValue(line,DynamicLayout.TOP);}},{key:'getLineDescent',value:function getLineDescent(line){return this.mInts.getValue(line,DynamicLayout.DESCENT);}},{key:'getLineStart',value:function getLineStart(line){return this.mInts.getValue(line,DynamicLayout.START)&DynamicLayout.START_MASK;}},{key:'getLineContainsTab',value:function getLineContainsTab(line){return(this.mInts.getValue(line,DynamicLayout.TAB)&DynamicLayout.TAB_MASK)!=0;}},{key:'getParagraphDirection',value:function getParagraphDirection(line){return this.mInts.getValue(line,DynamicLayout.DIR)>>DynamicLayout.DIR_SHIFT;}},{key:'getLineDirections',value:function getLineDirections(line){return this.mObjects.getValue(line,0);}},{key:'getTopPadding',value:function getTopPadding(){return this.mTopPadding;}},{key:'getBottomPadding',value:function getBottomPadding(){return this.mBottomPadding;}},{key:'getEllipsizedWidth',value:function getEllipsizedWidth(){return this.mEllipsizedWidth;}},{key:'getEllipsisStart',value:function getEllipsisStart(line){if(this.mEllipsizeAt==null){return 0;}return this.mInts.getValue(line,DynamicLayout.ELLIPSIS_START);}},{key:'getEllipsisCount',value:function getEllipsisCount(line){if(this.mEllipsizeAt==null){return 0;}return this.mInts.getValue(line,DynamicLayout.ELLIPSIS_COUNT);}}]);return DynamicLayout;}(Layout);DynamicLayout.PRIORITY=128;DynamicLayout.BLOCK_MINIMUM_CHARACTER_LENGTH=400;DynamicLayout.INVALID_BLOCK_INDEX=-1;DynamicLayout.sStaticLayout=new StaticLayout(null,0,0,null,0,null,null,1,0,true);DynamicLayout.sLock=new Array(0);DynamicLayout.START=0;DynamicLayout.DIR=DynamicLayout.START;DynamicLayout.TAB=DynamicLayout.START;DynamicLayout.TOP=1;DynamicLayout.DESCENT=2;DynamicLayout.COLUMNS_NORMAL=3;DynamicLayout.ELLIPSIS_START=3;DynamicLayout.ELLIPSIS_COUNT=4;DynamicLayout.COLUMNS_ELLIPSIZE=5;DynamicLayout.START_MASK=0x1FFFFFFF;DynamicLayout.DIR_SHIFT=30;DynamicLayout.TAB_MASK=0x20000000;DynamicLayout.ELLIPSIS_UNDEFINED=0x80000000;text_11.DynamicLayout=DynamicLayout;})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text){var method;(function(method){var TransformationMethod;(function(TransformationMethod){function isImpl(obj){return obj&&obj['getTransformation']&&obj['onFocusChanged'];}TransformationMethod.isImpl=isImpl;})(TransformationMethod=method.TransformationMethod||(method.TransformationMethod={}));})(method=text.method||(text.method={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text){var method;(function(method){var TransformationMethod=android.text.method.TransformationMethod;var TransformationMethod2;(function(TransformationMethod2){function isImpl(obj){return TransformationMethod.isImpl(obj)&&obj['setLengthChangesAllowed'];}TransformationMethod2.isImpl=isImpl;})(TransformationMethod2=method.TransformationMethod2||(method.TransformationMethod2={}));})(method=text.method||(text.method={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text){var method;(function(method){var Log=android.util.Log;var AllCapsTransformationMethod=function(){function AllCapsTransformationMethod(context){_classCallCheck(this,AllCapsTransformationMethod);}_createClass(AllCapsTransformationMethod,[{key:'getTransformation',value:function getTransformation(source,view){if(this.mEnabled){return source!=null?source.toLocaleUpperCase():null;}Log.w(AllCapsTransformationMethod.TAG,\"Caller did not enable length changes; not transforming text\");return source;}},{key:'onFocusChanged',value:function onFocusChanged(view,sourceText,focused,direction,previouslyFocusedRect){}},{key:'setLengthChangesAllowed',value:function setLengthChangesAllowed(allowLengthChanges){this.mEnabled=allowLengthChanges;}}]);return AllCapsTransformationMethod;}();AllCapsTransformationMethod.TAG=\"AllCapsTransformationMethod\";method.AllCapsTransformationMethod=AllCapsTransformationMethod;})(method=text.method||(text.method={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text){var method;(function(method){var ReplacementTransformationMethod=function(){function ReplacementTransformationMethod(){_classCallCheck(this,ReplacementTransformationMethod);}_createClass(ReplacementTransformationMethod,[{key:'getTransformation',value:function getTransformation(source,v){var original=this.getOriginal();var replacement=this.getReplacement();var doNothing=true;var n=original.length;for(var i=0;i<n;i++){if(source.indexOf(original[i])>=0){doNothing=false;break;}}if(doNothing){return source;}return new ReplacementTransformationMethod.ReplacementCharSequence(source,original,replacement).toString();}},{key:'onFocusChanged',value:function onFocusChanged(view,sourceText,focused,direction,previouslyFocusedRect){}}]);return ReplacementTransformationMethod;}();method.ReplacementTransformationMethod=ReplacementTransformationMethod;(function(ReplacementTransformationMethod){var ReplacementCharSequence=function(_String2){_inherits(ReplacementCharSequence,_String2);function ReplacementCharSequence(source,original,replacement){_classCallCheck(this,ReplacementCharSequence);var _this96=_possibleConstructorReturn(this,(ReplacementCharSequence.__proto__||Object.getPrototypeOf(ReplacementCharSequence)).call(this,source));_this96.mSource=source;_this96.mOriginal=original;_this96.mReplacement=replacement;return _this96;}_createClass(ReplacementCharSequence,[{key:'charAt',value:function charAt(i){var c=this.mSource.charAt(i);var n=this.mOriginal.length;for(var j=0;j<n;j++){if(c==this.mOriginal[j]){c=this.mReplacement[j];}}return c;}},{key:'toString',value:function toString(){return this.startReplace(0,this.length);}},{key:'substr',value:function substr(from,length){return this.startReplace(from,from+length);}},{key:'substring',value:function substring(start,end){return this.startReplace(start,end);}},{key:'startReplace',value:function startReplace(start,end){var dest=this.mSource.substring(start,end).split('');var offend=end-start;var n=this.mOriginal.length;for(var i=0;i<offend;i++){var c=dest[i];for(var j=0;j<n;j++){if(c==this.mOriginal[j]){dest[i]=this.mReplacement[j];}}}return dest.join('');}}]);return ReplacementCharSequence;}(String);ReplacementTransformationMethod.ReplacementCharSequence=ReplacementCharSequence;})(ReplacementTransformationMethod=method.ReplacementTransformationMethod||(method.ReplacementTransformationMethod={}));})(method=text.method||(text.method={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var text;(function(text){var method;(function(method){var ReplacementTransformationMethod=android.text.method.ReplacementTransformationMethod;var SingleLineTransformationMethod=function(_ReplacementTransform){_inherits(SingleLineTransformationMethod,_ReplacementTransform);function SingleLineTransformationMethod(){_classCallCheck(this,SingleLineTransformationMethod);return _possibleConstructorReturn(this,(SingleLineTransformationMethod.__proto__||Object.getPrototypeOf(SingleLineTransformationMethod)).apply(this,arguments));}_createClass(SingleLineTransformationMethod,[{key:'getOriginal',value:function getOriginal(){return SingleLineTransformationMethod.ORIGINAL;}},{key:'getReplacement',value:function getReplacement(){return SingleLineTransformationMethod.REPLACEMENT;}}],[{key:'getInstance',value:function getInstance(){if(SingleLineTransformationMethod.sInstance!=null)return SingleLineTransformationMethod.sInstance;SingleLineTransformationMethod.sInstance=new SingleLineTransformationMethod();return SingleLineTransformationMethod.sInstance;}}]);return SingleLineTransformationMethod;}(ReplacementTransformationMethod);SingleLineTransformationMethod.ORIGINAL=['\\n','\\r'];SingleLineTransformationMethod.REPLACEMENT=[' ','﻿'];method.SingleLineTransformationMethod=SingleLineTransformationMethod;})(method=text.method||(text.method={}));})(text=android.text||(android.text={}));})(android||(android={}));var androidui;(function(androidui){var util;(function(util){var NumberChecker=function(){function NumberChecker(){_classCallCheck(this,NumberChecker);}_createClass(NumberChecker,null,[{key:'warnNotNumber',value:function warnNotNumber(){try{this.assetNotNumber.apply(this,arguments);}catch(e){console.error(e);return true;}return false;}},{key:'assetNotNumber',value:function assetNotNumber(){if(!this.checkIsNumber()){for(var _len23=arguments.length,ns=Array(_len23),_key24=0;_key24<_len23;_key24++){ns[_key24]=arguments[_key24];}throw Error('assetNotNumber : '+ns);}}},{key:'checkIsNumber',value:function checkIsNumber(){for(var _len24=arguments.length,ns=Array(_len24),_key25=0;_key25<_len24;_key25++){ns[_key25]=arguments[_key25];}if(ns==null)return false;var _iteratorNormalCompletion65=true;var _didIteratorError65=false;var _iteratorError65=undefined;try{for(var _iterator65=ns[Symbol.iterator](),_step65;!(_iteratorNormalCompletion65=(_step65=_iterator65.next()).done);_iteratorNormalCompletion65=true){var n=_step65.value;if(n==null||Number.isNaN(n))return false;}}catch(err){_didIteratorError65=true;_iteratorError65=err;}finally{try{if(!_iteratorNormalCompletion65&&_iterator65.return){_iterator65.return();}}finally{if(_didIteratorError65){throw _iteratorError65;}}}return true;}}]);return NumberChecker;}();util.NumberChecker=NumberChecker;})(util=androidui.util||(androidui.util={}));})(androidui||(androidui={}));var android;(function(android){var widget;(function(widget){var ViewConfiguration=android.view.ViewConfiguration;var Resources=android.content.res.Resources;var SystemClock=android.os.SystemClock;var Log=android.util.Log;var NumberChecker=androidui.util.NumberChecker;var OverScroller=function(){function OverScroller(interpolator){var flywheel=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;_classCallCheck(this,OverScroller);this.mMode=0;this.mFlywheel=true;this.mInterpolator=interpolator;this.mFlywheel=flywheel;this.mScrollerX=new SplineOverScroller();this.mScrollerY=new SplineOverScroller();}_createClass(OverScroller,[{key:'setInterpolator',value:function setInterpolator(interpolator){this.mInterpolator=interpolator;}},{key:'setFriction',value:function setFriction(friction){NumberChecker.warnNotNumber(friction);this.mScrollerX.setFriction(friction);this.mScrollerY.setFriction(friction);}},{key:'isFinished',value:function isFinished(){return this.mScrollerX.mFinished&&this.mScrollerY.mFinished;}},{key:'forceFinished',value:function forceFinished(finished){this.mScrollerX.mFinished=this.mScrollerY.mFinished=finished;}},{key:'getCurrX',value:function getCurrX(){return this.mScrollerX.mCurrentPosition;}},{key:'getCurrY',value:function getCurrY(){return this.mScrollerY.mCurrentPosition;}},{key:'getCurrVelocity',value:function getCurrVelocity(){var squaredNorm=this.mScrollerX.mCurrVelocity*this.mScrollerX.mCurrVelocity;squaredNorm+=this.mScrollerY.mCurrVelocity*this.mScrollerY.mCurrVelocity;return Math.sqrt(squaredNorm);}},{key:'getStartX',value:function getStartX(){return this.mScrollerX.mStart;}},{key:'getStartY',value:function getStartY(){return this.mScrollerY.mStart;}},{key:'getFinalX',value:function getFinalX(){return this.mScrollerX.mFinal;}},{key:'getFinalY',value:function getFinalY(){return this.mScrollerY.mFinal;}},{key:'getDuration',value:function getDuration(){return Math.max(this.mScrollerX.mDuration,this.mScrollerY.mDuration);}},{key:'computeScrollOffset',value:function computeScrollOffset(){if(this.isFinished()){return false;}switch(this.mMode){case OverScroller.SCROLL_MODE:var time=SystemClock.uptimeMillis();var elapsedTime=time-this.mScrollerX.mStartTime;var duration=this.mScrollerX.mDuration;if(elapsedTime<duration){var q=elapsedTime/duration;if(this.mInterpolator==null){q=Scroller_viscousFluid(q);}else{q=this.mInterpolator.getInterpolation(q);}this.mScrollerX.updateScroll(q);this.mScrollerY.updateScroll(q);}else{this.abortAnimation();}break;case OverScroller.FLING_MODE:if(!this.mScrollerX.mFinished){if(!this.mScrollerX.update()){if(!this.mScrollerX.continueWhenFinished()){this.mScrollerX.finish();}}}if(!this.mScrollerY.mFinished){if(!this.mScrollerY.update()){if(!this.mScrollerY.continueWhenFinished()){this.mScrollerY.finish();}}}break;}return true;}},{key:'startScroll',value:function startScroll(startX,startY,dx,dy){var duration=arguments.length>4&&arguments[4]!==undefined?arguments[4]:OverScroller.DEFAULT_DURATION;NumberChecker.warnNotNumber(startX,startY,dx,dy,duration);this.mMode=OverScroller.SCROLL_MODE;this.mScrollerX.startScroll(startX,dx,duration);this.mScrollerY.startScroll(startY,dy,duration);}},{key:'springBack',value:function springBack(startX,startY,minX,maxX,minY,maxY){NumberChecker.warnNotNumber(startX,startY,minX,maxX,minY,maxY);this.mMode=OverScroller.FLING_MODE;var spingbackX=this.mScrollerX.springback(startX,minX,maxX);var spingbackY=this.mScrollerY.springback(startY,minY,maxY);return spingbackX||spingbackY;}},{key:'fling',value:function fling(startX,startY,velocityX,velocityY,minX,maxX,minY,maxY){var overX=arguments.length>8&&arguments[8]!==undefined?arguments[8]:0;var overY=arguments.length>9&&arguments[9]!==undefined?arguments[9]:0;NumberChecker.warnNotNumber(startX,startY,velocityX,velocityY,minX,maxX,minY,maxY,overX,overY);if(this.mFlywheel&&!this.isFinished()){var oldVelocityX=this.mScrollerX.mCurrVelocity;var oldVelocityY=this.mScrollerY.mCurrVelocity;if(Math_signum(velocityX)==Math_signum(oldVelocityX)&&Math_signum(velocityY)==Math_signum(oldVelocityY)){velocityX+=oldVelocityX;velocityY+=oldVelocityY;}}this.mMode=OverScroller.FLING_MODE;this.mScrollerX.fling(startX,velocityX,minX,maxX,overX);this.mScrollerY.fling(startY,velocityY,minY,maxY,overY);}},{key:'notifyHorizontalEdgeReached',value:function notifyHorizontalEdgeReached(startX,finalX,overX){NumberChecker.warnNotNumber(startX,finalX,overX);this.mScrollerX.notifyEdgeReached(startX,finalX,overX);}},{key:'notifyVerticalEdgeReached',value:function notifyVerticalEdgeReached(startY,finalY,overY){NumberChecker.warnNotNumber(startY,finalY,overY);this.mScrollerY.notifyEdgeReached(startY,finalY,overY);}},{key:'isOverScrolled',value:function isOverScrolled(){return!this.mScrollerX.mFinished&&this.mScrollerX.mState!=SplineOverScroller.SPLINE||!this.mScrollerY.mFinished&&this.mScrollerY.mState!=SplineOverScroller.SPLINE;}},{key:'abortAnimation',value:function abortAnimation(){this.mScrollerX.finish();this.mScrollerY.finish();}},{key:'timePassed',value:function timePassed(){var time=SystemClock.uptimeMillis();var startTime=Math.min(this.mScrollerX.mStartTime,this.mScrollerY.mStartTime);return time-startTime;}},{key:'isScrollingInDirection',value:function isScrollingInDirection(xvel,yvel){var dx=this.mScrollerX.mFinal-this.mScrollerX.mStart;var dy=this.mScrollerY.mFinal-this.mScrollerY.mStart;return!this.isFinished()&&Math_signum(xvel)==Math_signum(dx)&&Math_signum(yvel)==Math_signum(dy);}}]);return OverScroller;}();OverScroller.DEFAULT_DURATION=250;OverScroller.SCROLL_MODE=0;OverScroller.FLING_MODE=1;widget.OverScroller=OverScroller;var SplineOverScroller=function(){function SplineOverScroller(){_classCallCheck(this,SplineOverScroller);this.mStart=0;this.mCurrentPosition=0;this.mFinal=0;this.mVelocity=0;this._mCurrVelocity=0;this.mDeceleration=0;this.mStartTime=0;this.mDuration=0;this.mSplineDuration=0;this.mSplineDistance=0;this.mFinished=false;this.mOver=0;this.mFlingFriction=ViewConfiguration.getScrollFriction();this.mState=SplineOverScroller.SPLINE;this.mPhysicalCoeff=0;this.mFinished=true;var ppi=Resources.getDisplayMetrics().density*160;this.mPhysicalCoeff=9.80665*39.37*ppi*0.84;}_createClass(SplineOverScroller,[{key:'setFriction',value:function setFriction(friction){this.mFlingFriction=friction;}},{key:'updateScroll',value:function updateScroll(q){this.mCurrentPosition=this.mStart+Math.round(q*(this.mFinal-this.mStart));}},{key:'adjustDuration',value:function adjustDuration(start,oldFinal,newFinal){var oldDistance=oldFinal-start;var newDistance=newFinal-start;var x=Math.abs(newDistance/oldDistance);var index=Math.floor(SplineOverScroller.NB_SAMPLES*x);if(index<SplineOverScroller.NB_SAMPLES){var x_inf=index/SplineOverScroller.NB_SAMPLES;var x_sup=(index+1)/SplineOverScroller.NB_SAMPLES;var t_inf=SplineOverScroller.SPLINE_TIME[index];var t_sup=SplineOverScroller.SPLINE_TIME[index+1];var timeCoef=t_inf+(x-x_inf)/(x_sup-x_inf)*(t_sup-t_inf);this.mDuration*=timeCoef;}}},{key:'startScroll',value:function startScroll(start,distance,duration){this.mFinished=false;this.mStart=start;this.mFinal=start+distance;this.mStartTime=SystemClock.uptimeMillis();this.mDuration=duration;this.mDeceleration=0;this.mVelocity=0;}},{key:'finish',value:function finish(){this.mCurrentPosition=this.mFinal;this.mFinished=true;}},{key:'setFinalPosition',value:function setFinalPosition(position){this.mFinal=position;this.mFinished=false;}},{key:'extendDuration',value:function extendDuration(extend){var time=SystemClock.uptimeMillis();var elapsedTime=time-this.mStartTime;this.mDuration=elapsedTime+extend;this.mFinished=false;}},{key:'springback',value:function springback(start,min,max){this.mFinished=true;this.mStart=this.mFinal=start;this.mVelocity=0;this.mStartTime=SystemClock.uptimeMillis();this.mDuration=0;if(start<min){this.startSpringback(start,min,0);}else if(start>max){this.startSpringback(start,max,0);}return!this.mFinished;}},{key:'startSpringback',value:function startSpringback(start,end,velocity){this.mFinished=false;this.mState=SplineOverScroller.CUBIC;this.mStart=start;this.mFinal=end;var delta=start-end;this.mDeceleration=SplineOverScroller.getDeceleration(delta);this.mVelocity=-delta;this.mOver=Math.abs(delta);var density=android.content.res.Resources.getDisplayMetrics().density;this.mDuration=Math.floor(1000.0*Math.sqrt(-2.0*(delta/density)/this.mDeceleration));}},{key:'fling',value:function fling(start,velocity,min,max,over){this.mOver=over;this.mFinished=false;this.mCurrVelocity=this.mVelocity=velocity;this.mDuration=this.mSplineDuration=0;this.mStartTime=SystemClock.uptimeMillis();this.mCurrentPosition=this.mStart=start;if(start>max||start<min){this.startAfterEdge(start,min,max,velocity);return;}this.mState=SplineOverScroller.SPLINE;var totalDistance=0.0;if(velocity!=0){this.mDuration=this.mSplineDuration=this.getSplineFlingDuration(velocity);totalDistance=this.getSplineFlingDistance(velocity);}this.mSplineDistance=totalDistance*Math_signum(velocity);this.mFinal=start+this.mSplineDistance;if(this.mFinal<min){this.adjustDuration(this.mStart,this.mFinal,min);this.mFinal=min;}if(this.mFinal>max){this.adjustDuration(this.mStart,this.mFinal,max);this.mFinal=max;}}},{key:'getSplineDeceleration',value:function getSplineDeceleration(velocity){return Math.log(SplineOverScroller.INFLEXION*Math.abs(velocity)/(this.mFlingFriction*this.mPhysicalCoeff));}},{key:'getSplineFlingDistance',value:function getSplineFlingDistance(velocity){var l=this.getSplineDeceleration(velocity);var decelMinusOne=SplineOverScroller.DECELERATION_RATE-1.0;return this.mFlingFriction*this.mPhysicalCoeff*Math.exp(SplineOverScroller.DECELERATION_RATE/decelMinusOne*l);}},{key:'getSplineFlingDuration',value:function getSplineFlingDuration(velocity){var l=this.getSplineDeceleration(velocity);var decelMinusOne=SplineOverScroller.DECELERATION_RATE-1.0;return 1000.0*Math.exp(l/decelMinusOne);}},{key:'fitOnBounceCurve',value:function fitOnBounceCurve(start,end,velocity){var durationToApex=-velocity/this.mDeceleration;var distanceToApex=velocity*velocity/2.0/Math.abs(this.mDeceleration);var distanceToEdge=Math.abs(end-start);var totalDuration=Math.sqrt(2.0*(distanceToApex+distanceToEdge)/Math.abs(this.mDeceleration));this.mStartTime-=1000*(totalDuration-durationToApex);this.mStart=end;this.mVelocity=-this.mDeceleration*totalDuration;}},{key:'startBounceAfterEdge',value:function startBounceAfterEdge(start,end,velocity){this.mDeceleration=SplineOverScroller.getDeceleration(velocity==0?start-end:velocity);this.fitOnBounceCurve(start,end,velocity);this.onEdgeReached();}},{key:'startAfterEdge',value:function startAfterEdge(start,min,max,velocity){if(start>min&&start<max){Log.e(\"OverScroller\",\"startAfterEdge called from a valid position\");this.mFinished=true;return;}var positive=start>max;var edge=positive?max:min;var overDistance=start-edge;var keepIncreasing=overDistance*velocity>=0;if(keepIncreasing){this.startBounceAfterEdge(start,edge,velocity);}else{var totalDistance=this.getSplineFlingDistance(velocity);if(totalDistance>Math.abs(overDistance)){this.fling(start,velocity,positive?min:start,positive?start:max,this.mOver);}else{this.startSpringback(start,edge,velocity);}}}},{key:'notifyEdgeReached',value:function notifyEdgeReached(start,end,over){if(this.mState==SplineOverScroller.SPLINE){this.mOver=over;this.mStartTime=SystemClock.uptimeMillis();this.startAfterEdge(start,end,end,this.mCurrVelocity);}}},{key:'onEdgeReached',value:function onEdgeReached(){var distance=this.mVelocity*this.mVelocity/(2*Math.abs(this.mDeceleration));var sign=Math_signum(this.mVelocity);if(distance>this.mOver){this.mDeceleration=-sign*this.mVelocity*this.mVelocity/(2.0*this.mOver);distance=this.mOver;}this.mOver=distance;this.mState=SplineOverScroller.BALLISTIC;this.mFinal=this.mStart+(this.mVelocity>0?distance:-distance);this.mDuration=-(1000*this.mVelocity/this.mDeceleration);}},{key:'continueWhenFinished',value:function continueWhenFinished(){switch(this.mState){case SplineOverScroller.SPLINE:if(this.mDuration<this.mSplineDuration){this.mStart=this.mFinal;this.mVelocity=this.mCurrVelocity;this.mDeceleration=SplineOverScroller.getDeceleration(this.mVelocity);this.mStartTime+=this.mDuration;this.onEdgeReached();}else{return false;}break;case SplineOverScroller.BALLISTIC:this.mStartTime+=this.mDuration;this.startSpringback(this.mFinal,this.mStart,0);break;case SplineOverScroller.CUBIC:return false;}this.update();return true;}},{key:'update',value:function update(){var time=SystemClock.uptimeMillis();var currentTime=time-this.mStartTime;if(currentTime>this.mDuration){return false;}var distance=0;switch(this.mState){case SplineOverScroller.SPLINE:{var t=currentTime/this.mSplineDuration;var index=Math.floor(SplineOverScroller.NB_SAMPLES*t);var distanceCoef=1;var velocityCoef=0;if(index<SplineOverScroller.NB_SAMPLES){var t_inf=index/SplineOverScroller.NB_SAMPLES;var t_sup=(index+1)/SplineOverScroller.NB_SAMPLES;var d_inf=SplineOverScroller.SPLINE_POSITION[index];var d_sup=SplineOverScroller.SPLINE_POSITION[index+1];velocityCoef=(d_sup-d_inf)/(t_sup-t_inf);distanceCoef=d_inf+(t-t_inf)*velocityCoef;}distance=distanceCoef*this.mSplineDistance;this.mCurrVelocity=velocityCoef*this.mSplineDistance/this.mSplineDuration*1000;break;}case SplineOverScroller.BALLISTIC:{var _t=currentTime/1000;this.mCurrVelocity=this.mVelocity+this.mDeceleration*_t;distance=this.mVelocity*_t+this.mDeceleration*_t*_t/2;break;}case SplineOverScroller.CUBIC:{var _t2=currentTime/this.mDuration;var t2=_t2*_t2;var sign=Math_signum(this.mVelocity);distance=sign*this.mOver*(3*t2-2*_t2*t2);this.mCurrVelocity=sign*this.mOver*6*(-_t2+t2);break;}}this.mCurrentPosition=this.mStart+Math.round(distance);return true;}},{key:'mCurrVelocity',get:function get(){return this._mCurrVelocity;},set:function set(value){if(!NumberChecker.checkIsNumber(value)){value=0;}this._mCurrVelocity=value;}}],[{key:'getDeceleration',value:function getDeceleration(velocity){return velocity>0?-SplineOverScroller.GRAVITY:SplineOverScroller.GRAVITY;}}]);return SplineOverScroller;}();SplineOverScroller.DECELERATION_RATE=Math.log(0.78)/Math.log(0.9);SplineOverScroller.INFLEXION=0.35;SplineOverScroller.START_TENSION=0.5;SplineOverScroller.END_TENSION=1.0;SplineOverScroller.P1=SplineOverScroller.START_TENSION*SplineOverScroller.INFLEXION;SplineOverScroller.P2=1.0-SplineOverScroller.END_TENSION*(1-SplineOverScroller.INFLEXION);SplineOverScroller.NB_SAMPLES=100;SplineOverScroller.SPLINE_POSITION=androidui.util.ArrayCreator.newNumberArray(SplineOverScroller.NB_SAMPLES+1);SplineOverScroller.SPLINE_TIME=androidui.util.ArrayCreator.newNumberArray(SplineOverScroller.NB_SAMPLES+1);SplineOverScroller.SPLINE=0;SplineOverScroller.CUBIC=1;SplineOverScroller.BALLISTIC=2;SplineOverScroller.GRAVITY=2000;SplineOverScroller._staticFunc=function(){var x_min=0.0;var y_min=0.0;for(var i=0;i<SplineOverScroller.NB_SAMPLES;i++){var alpha=i/SplineOverScroller.NB_SAMPLES;var x_max=1.0;var _x165=void 0,_tx=void 0,coef=void 0;while(true){_x165=x_min+(x_max-x_min)/2.0;coef=3.0*_x165*(1.0-_x165);_tx=coef*((1.0-_x165)*SplineOverScroller.P1+_x165*SplineOverScroller.P2)+_x165*_x165*_x165;if(Math.abs(_tx-alpha)<1E-5)break;if(_tx>alpha)x_max=_x165;else x_min=_x165;}SplineOverScroller.SPLINE_POSITION[i]=coef*((1.0-_x165)*SplineOverScroller.START_TENSION+_x165)+_x165*_x165*_x165;var y_max=1.0;var _y5=void 0,dy=void 0;while(true){_y5=y_min+(y_max-y_min)/2.0;coef=3.0*_y5*(1.0-_y5);dy=coef*((1.0-_y5)*SplineOverScroller.START_TENSION+_y5)+_y5*_y5*_y5;if(Math.abs(dy-alpha)<1E-5)break;if(dy>alpha)y_max=_y5;else y_min=_y5;}SplineOverScroller.SPLINE_TIME[i]=coef*((1.0-_y5)*SplineOverScroller.P1+_y5*SplineOverScroller.P2)+_y5*_y5*_y5;}SplineOverScroller.SPLINE_POSITION[SplineOverScroller.NB_SAMPLES]=SplineOverScroller.SPLINE_TIME[SplineOverScroller.NB_SAMPLES]=1.0;}();function Math_signum(value){if(value===0||Number.isNaN(value))return value;return Math.abs(value)===value?1:-1;}var sViscousFluidScale=8;var sViscousFluidNormalize=1;function Scroller_viscousFluid(x){x*=sViscousFluidScale;if(x<1){x-=1-Math.exp(-x);}else{var start=0.36787944117;x=1-Math.exp(1-x);x=start+x*(1-start);}x*=sViscousFluidNormalize;return x;}sViscousFluidNormalize=1/Scroller_viscousFluid(1);})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var ColorStateList=android.content.res.ColorStateList;var Paint=android.graphics.Paint;var Path=android.graphics.Path;var Rect=android.graphics.Rect;var Color=android.graphics.Color;var RectF=android.graphics.RectF;var Handler=android.os.Handler;var BoringLayout=android.text.BoringLayout;var DynamicLayout=android.text.DynamicLayout;var Layout=android.text.Layout;var Spannable=android.text.Spannable;var Spanned=android.text.Spanned;var StaticLayout=android.text.StaticLayout;var TextDirectionHeuristics=android.text.TextDirectionHeuristics;var TextPaint=android.text.TextPaint;var TextUtils=android.text.TextUtils;var TruncateAt=android.text.TextUtils.TruncateAt;var AllCapsTransformationMethod=android.text.method.AllCapsTransformationMethod;var SingleLineTransformationMethod=android.text.method.SingleLineTransformationMethod;var TransformationMethod2=android.text.method.TransformationMethod2;var Log=android.util.Log;var TypedValue=android.util.TypedValue;var Gravity=android.view.Gravity;var HapticFeedbackConstants=android.view.HapticFeedbackConstants;var MotionEvent=android.view.MotionEvent;var View=android.view.View;var LayoutParams=android.view.ViewGroup.LayoutParams;var AnimationUtils=android.view.animation.AnimationUtils;var WeakReference=java.lang.ref.WeakReference;var ArrayList=java.util.ArrayList;var Integer=java.lang.Integer;var System=java.lang.System;var TextView=function(_View){_inherits(TextView,_View);function TextView(context,bindElement){var defStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.R.attr.textViewStyle;_classCallCheck(this,TextView);var _this98=_possibleConstructorReturn(this,(TextView.__proto__||Object.getPrototypeOf(TextView)).call(this,context,bindElement,defStyle));_this98.mTextColor=ColorStateList.valueOf(Color.BLACK);_this98.mCurTextColor=0;_this98.mCurHintTextColor=0;_this98.mSpannableFactory=Spannable.Factory.getInstance();_this98.mShadowRadius=0;_this98.mShadowDx=0;_this98.mShadowDy=0;_this98.mMarqueeRepeatLimit=3;_this98.mLastLayoutDirection=-1;_this98.mMarqueeFadeMode=TextView.MARQUEE_FADE_NORMAL;_this98.mBufferType=TextView.BufferType.NORMAL;_this98.mGravity=Gravity.TOP|Gravity.LEFT;_this98.mAutoLinkMask=0;_this98.mLinksClickable=true;_this98.mSpacingMult=1.0;_this98.mSpacingAdd=0.0;_this98.mMaximum=Integer.MAX_VALUE;_this98.mMaxMode=TextView.LINES;_this98.mMinimum=0;_this98.mMinMode=TextView.LINES;_this98.mOldMaximum=_this98.mMaximum;_this98.mOldMaxMode=_this98.mMaxMode;_this98.mMaxWidthValue=Integer.MAX_VALUE;_this98.mMaxWidthMode=TextView.PIXELS;_this98.mMinWidthValue=0;_this98.mMinWidthMode=TextView.PIXELS;_this98.mDesiredHeightAtMeasure=-1;_this98.mIncludePad=true;_this98.mDeferScroll=-1;_this98.mLastScroll=0;_this98.mFilters=TextView.NO_FILTERS;_this98.mHighlightColor=0x6633B5E5;_this98.mHighlightPathBogus=true;_this98.mCursorDrawableRes=0;_this98.mTextSelectHandleLeftRes=0;_this98.mTextSelectHandleRightRes=0;_this98.mTextSelectHandleRes=0;_this98.mTextEditSuggestionItemLayout=0;_this98.mSkipDrawText=false;_this98.mText=\"\";_this98.mTextPaint=new TextPaint(Paint.ANTI_ALIAS_FLAG);_this98.mHighlightPaint=new Paint(Paint.ANTI_ALIAS_FLAG);_this98.mMovement=_this98.getDefaultMovementMethod();_this98.mTransformation=null;var textColorHighlight=0;var textColor=null;var textColorHint=null;var textColorLink=null;var textSize=14*_this98.getResources().getDisplayMetrics().density;var allCaps=false;var shadowcolor=0;var dx=0,dy=0,r=0;var editable=_this98.getDefaultEditable();var numeric=0;var digits=null;var drawableLeft=null,drawableTop=null,drawableRight=null,drawableBottom=null,drawableStart=null,drawableEnd=null;var drawablePadding=0;var ellipsize=void 0;var singleLine=false;var maxlength=-1;var text=\"\";var hint=null;var a=context.obtainStyledAttributes(bindElement,defStyle);var _iteratorNormalCompletion66=true;var _didIteratorError66=false;var _iteratorError66=undefined;try{for(var _iterator66=a.getLowerCaseNoNamespaceAttrNames()[Symbol.iterator](),_step66;!(_iteratorNormalCompletion66=(_step66=_iterator66.next()).done);_iteratorNormalCompletion66=true){var attr=_step66.value;switch(attr){case'editable':editable=a.getBoolean(attr,editable);break;case'inputmethod':break;case'numeric':numeric=a.getInt(attr,numeric);break;case'digits':digits=a.getText(attr);break;case'phonenumber':break;case'autotext':break;case'capitalize':break;case'buffertype':break;case'selectallonfocus':break;case'autolink':_this98.mAutoLinkMask=a.getInt(attr,0);break;case'linksclickable':_this98.mLinksClickable=a.getBoolean(attr,true);break;case'drawableleft':drawableLeft=a.getDrawable(attr);break;case'drawabletop':drawableTop=a.getDrawable(attr);break;case'drawableright':drawableRight=a.getDrawable(attr);break;case'drawablebottom':drawableBottom=a.getDrawable(attr);break;case'drawablestart':drawableStart=a.getDrawable(attr);break;case'drawableend':drawableEnd=a.getDrawable(attr);break;case'drawablepadding':drawablePadding=a.getDimensionPixelSize(attr,drawablePadding);break;case'maxlines':_this98.setMaxLines(a.getInt(attr,-1));break;case'maxheight':_this98.setMaxHeight(a.getDimensionPixelSize(attr,-1));break;case'lines':_this98.setLines(a.getInt(attr,-1));break;case'height':_this98.setHeight(a.getDimensionPixelSize(attr,-1));break;case'minlines':_this98.setMinLines(a.getInt(attr,-1));break;case'minheight':_this98.setMinHeight(a.getDimensionPixelSize(attr,-1));break;case'maxems':_this98.setMaxEms(a.getInt(attr,-1));break;case'maxwidth':_this98.setMaxWidth(a.getDimensionPixelSize(attr,-1));break;case'ems':_this98.setEms(a.getInt(attr,-1));break;case'width':_this98.setWidth(a.getDimensionPixelSize(attr,-1));break;case'minems':_this98.setMinEms(a.getInt(attr,-1));break;case'minwidth':_this98.setMinWidth(a.getDimensionPixelSize(attr,-1));break;case'gravity':_this98.setGravity(Gravity.parseGravity(a.getAttrValue(attr),-1));break;case'hint':hint=a.getText(attr);break;case'text':text=a.getText(attr);break;case'scrollhorizontally':if(a.getBoolean(attr,false)){_this98.setHorizontallyScrolling(true);}break;case'singleline':singleLine=a.getBoolean(attr,singleLine);break;case'ellipsize':ellipsize=TextUtils.TruncateAt[(a.getAttrValue(attr)+'').toUpperCase()];break;case'marqueerepeatlimit':_this98.setMarqueeRepeatLimit(a.getInt(attr,_this98.mMarqueeRepeatLimit));break;case'includefontpadding':if(!a.getBoolean(attr,true)){_this98.setIncludeFontPadding(false);}break;case'cursorvisible':if(!a.getBoolean(attr,true)){_this98.setCursorVisible(false);}break;case'maxlength':maxlength=a.getInt(attr,-1);break;case'textscalex':_this98.setTextScaleX(a.getFloat(attr,1.0));break;case'freezestext':_this98.mFreezesText=a.getBoolean(attr,false);break;case'shadowcolor':shadowcolor=a.getInt(attr,0);break;case'shadowdx':dx=a.getFloat(attr,0);break;case'shadowdy':dy=a.getFloat(attr,0);break;case'shadowradius':r=a.getFloat(attr,0);break;case'enabled':_this98.setEnabled(a.getBoolean(attr,_this98.isEnabled()));break;case'textcolorhighlight':textColorHighlight=a.getColor(attr,textColorHighlight);break;case'textcolor':textColor=a.getColorStateList(attr);break;case'textcolorhint':textColorHint=a.getColorStateList(attr);break;case'textcolorlink':textColorLink=a.getColorStateList(attr);break;case'textsize':textSize=a.getDimensionPixelSize(attr,textSize);break;case'typeface':break;case'textstyle':break;case'fontfamily':break;case'password':break;case'linespacingextra':_this98.mSpacingAdd=a.getDimensionPixelSize(attr,Math.floor(_this98.mSpacingAdd));break;case'linespacingmultiplier':_this98.mSpacingMult=a.getFloat(attr,_this98.mSpacingMult);break;case'inputtype':break;case'imeoptions':break;case'imeactionlabel':break;case'imeactionid':break;case'privateimeoptions':break;case'editorextras':break;case'textcursordrawable':break;case'textselecthandleleft':break;case'textselecthandleright':break;case'textselecthandle':break;case'texteditsuggestionitemlayout':break;case'textisselectable':_this98.setTextIsSelectable(a.getBoolean(attr,false));break;case'textallcaps':allCaps=a.getBoolean(attr,false);break;}}}catch(err){_didIteratorError66=true;_iteratorError66=err;}finally{try{if(!_iteratorNormalCompletion66&&_iterator66.return){_iterator66.return();}}finally{if(_didIteratorError66){throw _iteratorError66;}}}a.recycle();var bufferType=_this98.mBufferType;_this98.setCompoundDrawablesWithIntrinsicBounds(drawableLeft,drawableTop,drawableRight,drawableBottom);_this98.setRelativeDrawablesIfNeeded(drawableStart,drawableEnd);_this98.setCompoundDrawablePadding(drawablePadding);_this98.setInputTypeSingleLine(singleLine);_this98.applySingleLine(singleLine,singleLine,singleLine);if(singleLine&&_this98.getKeyListener()==null&&ellipsize==null){ellipsize=TextUtils.TruncateAt.END;}switch(ellipsize){case TextUtils.TruncateAt.START:_this98.setEllipsize(TextUtils.TruncateAt.START);break;case TextUtils.TruncateAt.MIDDLE:_this98.setEllipsize(TextUtils.TruncateAt.MIDDLE);break;case TextUtils.TruncateAt.END:_this98.setEllipsize(TextUtils.TruncateAt.END);break;case TextUtils.TruncateAt.MARQUEE:_this98.setHorizontalFadingEdgeEnabled(false);_this98.mMarqueeFadeMode=TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS;_this98.setEllipsize(TextUtils.TruncateAt.MARQUEE);break;}_this98.setTextColor(textColor!=null?textColor:ColorStateList.valueOf(0xFF000000));_this98.setHintTextColor(textColorHint);_this98.setLinkTextColor(textColorLink);if(textColorHighlight!=0){_this98.setHighlightColor(textColorHighlight);}_this98.setRawTextSize(textSize);if(allCaps){_this98.setTransformationMethod(new AllCapsTransformationMethod(_this98.getContext()));}if(shadowcolor!=0){_this98.setShadowLayer(r,dx,dy,shadowcolor);}_this98.setText(text,bufferType);if(hint!=null)_this98.setHint(hint);return _this98;}_createClass(TextView,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'createClassAttrBinder',this).call(this).set('textColorHighlight',{setter:function setter(v,value,attrBinder){v.setHighlightColor(attrBinder.parseColor(value,v.mHighlightColor));},getter:function getter(v){return v.getHighlightColor();}}).set('textColor',{setter:function setter(v,value,attrBinder){var color=attrBinder.parseColorList(value);if(color)v.setTextColor(color);},getter:function getter(v){return v.mTextColor;}}).set('textColorHint',{setter:function setter(v,value,attrBinder){var color=attrBinder.parseColorList(value);if(color)v.setHintTextColor(color);},getter:function getter(v){return v.mHintTextColor;}}).set('textSize',{setter:function setter(v,value,attrBinder){var size=attrBinder.parseNumberPixelSize(value,v.mTextPaint.getTextSize());v.setTextSize(TypedValue.COMPLEX_UNIT_PX,size);},getter:function getter(v){return v.mTextPaint.getTextSize();}}).set('textAllCaps',{setter:function setter(v,value,attrBinder){v.setAllCaps(attrBinder.parseBoolean(value,true));}}).set('shadowColor',{setter:function setter(v,value,attrBinder){v.setShadowLayer(v.mShadowRadius,v.mShadowDx,v.mShadowDy,attrBinder.parseColor(value,v.mTextPaint.shadowColor));},getter:function getter(v){return v.getShadowColor();}}).set('shadowDx',{setter:function setter(v,value,attrBinder){var dx=attrBinder.parseNumberPixelSize(value,v.mShadowDx);v.setShadowLayer(v.mShadowRadius,dx,v.mShadowDy,v.mTextPaint.shadowColor);},getter:function getter(v){return v.getShadowDx();}}).set('shadowDy',{setter:function setter(v,value,attrBinder){var dy=attrBinder.parseNumberPixelSize(value,v.mShadowDy);v.setShadowLayer(v.mShadowRadius,v.mShadowDx,dy,v.mTextPaint.shadowColor);},getter:function getter(v){return v.getShadowDy();}}).set('shadowRadius',{setter:function setter(v,value,attrBinder){var radius=attrBinder.parseNumberPixelSize(value,v.mShadowRadius);v.setShadowLayer(radius,v.mShadowDx,v.mShadowDy,v.mTextPaint.shadowColor);},getter:function getter(v){return v.getShadowRadius();}}).set('drawableLeft',{setter:function setter(v,value,attrBinder){var dr=v.mDrawables||{};var drawable=attrBinder.parseDrawable(value);v.setCompoundDrawablesWithIntrinsicBounds(drawable,dr.mDrawableTop,dr.mDrawableRight,dr.mDrawableBottom);},getter:function getter(v){return v.getCompoundDrawables()[0];}}).set('drawableStart',{setter:function setter(v,value,attrBinder){var dr=v.mDrawables||{};var drawable=attrBinder.parseDrawable(value);v.setCompoundDrawablesWithIntrinsicBounds(drawable,dr.mDrawableTop,dr.mDrawableRight,dr.mDrawableBottom);},getter:function getter(v){return v.getCompoundDrawables()[0];}}).set('drawableTop',{setter:function setter(v,value,attrBinder){var dr=v.mDrawables||{};var drawable=attrBinder.parseDrawable(value);v.setCompoundDrawablesWithIntrinsicBounds(dr.mDrawableLeft,drawable,dr.mDrawableRight,dr.mDrawableBottom);},getter:function getter(v){return v.getCompoundDrawables()[1];}}).set('drawableRight',{setter:function setter(v,value,attrBinder){var dr=v.mDrawables||{};var drawable=attrBinder.parseDrawable(value);v.setCompoundDrawablesWithIntrinsicBounds(dr.mDrawableLeft,dr.mDrawableTop,drawable,dr.mDrawableBottom);},getter:function getter(v){return v.getCompoundDrawables()[2];}}).set('drawableEnd',{setter:function setter(v,value,attrBinder){var dr=v.mDrawables||{};var drawable=attrBinder.parseDrawable(value);v.setCompoundDrawablesWithIntrinsicBounds(dr.mDrawableLeft,dr.mDrawableTop,drawable,dr.mDrawableBottom);},getter:function getter(v){return v.getCompoundDrawables()[2];}}).set('drawableBottom',{setter:function setter(v,value,attrBinder){var dr=v.mDrawables||{};var drawable=attrBinder.parseDrawable(value);v.setCompoundDrawablesWithIntrinsicBounds(dr.mDrawableLeft,dr.mDrawableTop,dr.mDrawableRight,drawable);},getter:function getter(v){return v.getCompoundDrawables()[3];}}).set('drawablePadding',{setter:function setter(v,value,attrBinder){v.setCompoundDrawablePadding(attrBinder.parseNumberPixelSize(value));},getter:function getter(v){return v.getCompoundDrawablePadding();}}).set('maxLines',{setter:function setter(v,value,attrBinder){value=Number.parseInt(value);if(Number.isInteger(value))v.setMaxLines(value);},getter:function getter(v){return v.getMaxLines();}}).set('maxHeight',{setter:function setter(v,value,attrBinder){v.setMaxHeight(attrBinder.parseNumberPixelSize(value,v.getMaxHeight()));},getter:function getter(v){return v.getMaxHeight();}}).set('lines',{setter:function setter(v,value,attrBinder){value=Number.parseInt(value);if(Number.isInteger(value))v.setLines(value);},getter:function getter(v){if(v.getMaxLines()===v.getMinLines())return v.getMaxLines();return null;}}).set('height',{setter:function setter(v,value,attrBinder){value=attrBinder.parseNumberPixelSize(value,-1);if(value>=0)v.setHeight(value);},getter:function getter(v){if(v.getMaxHeight()===v.getMinimumHeight())return v.getMaxHeight();return null;}}).set('minLines',{setter:function setter(v,value,attrBinder){v.setMinLines(attrBinder.parseInt(value,v.getMinLines()));},getter:function getter(v){return v.getMinLines();}}).set('minHeight',{setter:function setter(v,value,attrBinder){v.setMinHeight(attrBinder.parseNumberPixelSize(value,v.getMinHeight()));},getter:function getter(v){return v.getMinHeight();}}).set('maxEms',{setter:function setter(v,value,attrBinder){v.setMaxEms(attrBinder.parseInt(value,v.getMaxEms()));},getter:function getter(v){return v.getMaxEms();}}).set('maxWidth',{setter:function setter(v,value,attrBinder){v.setMaxWidth(attrBinder.parseNumberPixelSize(value,v.getMaxWidth()));},getter:function getter(v){return v.getMaxWidth();}}).set('ems',{setter:function setter(v,value,attrBinder){var ems=attrBinder.parseInt(value,null);if(ems!=null)v.setEms(ems);},getter:function getter(v){if(v.getMinEms()===v.getMaxEms())return v.getMaxEms();return null;}}).set('width',{setter:function setter(v,value,attrBinder){value=attrBinder.parseNumberPixelSize(value,-1);if(value>=0)v.setWidth(value);},getter:function getter(v){if(v.getMinWidth()===v.getMaxWidth())return v.getMinWidth();return null;}}).set('minEms',{setter:function setter(v,value,attrBinder){v.setMinEms(attrBinder.parseInt(value,v.getMinEms()));},getter:function getter(v){return v.getMinEms();}}).set('minWidth',{setter:function setter(v,value,attrBinder){v.setMinWidth(attrBinder.parseNumberPixelSize(value,v.getMinWidth()));},getter:function getter(v){return v.getMinWidth();}}).set('gravity',{setter:function setter(v,value,attrBinder){v.setGravity(attrBinder.parseGravity(value,v.mGravity));},getter:function getter(v){return v.mGravity;}}).set('hint',{setter:function setter(v,value,attrBinder){v.setHint(attrBinder.parseString(value));},getter:function getter(v){return v.getHint();}}).set('text',{setter:function setter(v,value,attrBinder){v.setText(attrBinder.parseString(value));},getter:function getter(v){return v.getText();}}).set('scrollHorizontally',{setter:function setter(v,value,attrBinder){v.setHorizontallyScrolling(attrBinder.parseBoolean(value,false));}}).set('singleLine',{setter:function setter(v,value,attrBinder){v.setSingleLine(attrBinder.parseBoolean(value,false));}}).set('ellipsize',{setter:function setter(v,value,attrBinder){var ellipsize=TextUtils.TruncateAt[(value+'').toUpperCase()];if(ellipsize)v.setEllipsize(ellipsize);}}).set('marqueeRepeatLimit',{setter:function setter(v,value,attrBinder){var marqueeRepeatLimit=attrBinder.parseInt(value,-1);if(marqueeRepeatLimit>=0)v.setMarqueeRepeatLimit(marqueeRepeatLimit);}}).set('includeFontPadding',{setter:function setter(v,value,attrBinder){v.setIncludeFontPadding(attrBinder.parseBoolean(value,false));}}).set('enabled',{setter:function setter(v,value,attrBinder){v.setEnabled(attrBinder.parseBoolean(value,v.isEnabled()));},getter:function getter(v){return v.isEnabled();}}).set('lineSpacingExtra',{setter:function setter(v,value,attrBinder){v.setLineSpacing(attrBinder.parseNumberPixelSize(value,v.mSpacingAdd),v.mSpacingMult);},getter:function getter(v){return v.mSpacingAdd;}}).set('lineSpacingMultiplier',{setter:function setter(v,value,attrBinder){v.setLineSpacing(v.mSpacingAdd,attrBinder.parseFloat(value,v.mSpacingMult));},getter:function getter(v){return v.mSpacingMult;}});}},{key:'setTypefaceFromAttrs',value:function setTypefaceFromAttrs(familyName,typefaceIndex,styleIndex){}},{key:'setRelativeDrawablesIfNeeded',value:function setRelativeDrawablesIfNeeded(start,end){var hasRelativeDrawables=start!=null||end!=null;if(hasRelativeDrawables){var dr=this.mDrawables;if(dr==null){this.mDrawables=dr=new TextView.Drawables();}this.mDrawables.mOverride=true;var compoundRect=dr.mCompoundRect;var state=this.getDrawableState();if(start!=null){start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());start.setState(state);start.copyBounds(compoundRect);start.setCallback(this);dr.mDrawableStart=start;dr.mDrawableSizeStart=compoundRect.width();dr.mDrawableHeightStart=compoundRect.height();}else{dr.mDrawableSizeStart=dr.mDrawableHeightStart=0;}if(end!=null){end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());end.setState(state);end.copyBounds(compoundRect);end.setCallback(this);dr.mDrawableEnd=end;dr.mDrawableSizeEnd=compoundRect.width();dr.mDrawableHeightEnd=compoundRect.height();}else{dr.mDrawableSizeEnd=dr.mDrawableHeightEnd=0;}this.resetResolvedDrawables();this.resolveDrawables();}}},{key:'setEnabled',value:function setEnabled(enabled){if(enabled==this.isEnabled()){return;}_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'setEnabled',this).call(this,enabled);}},{key:'setTypeface',value:function setTypeface(tf,style){}},{key:'getDefaultEditable',value:function getDefaultEditable(){return false;}},{key:'getDefaultMovementMethod',value:function getDefaultMovementMethod(){return null;}},{key:'getText',value:function getText(){return this.mText;}},{key:'length',value:function length(){return this.mText.length;}},{key:'getEditableText',value:function getEditableText(){return null;}},{key:'getLineHeight',value:function getLineHeight(){return Math.round(this.mTextPaint.getFontMetricsInt(null)*this.mSpacingMult+this.mSpacingAdd);}},{key:'getLayout',value:function getLayout(){return this.mLayout;}},{key:'getHintLayout',value:function getHintLayout(){return this.mHintLayout;}},{key:'getUndoManager',value:function getUndoManager(){return null;}},{key:'setUndoManager',value:function setUndoManager(undoManager,tag){}},{key:'getKeyListener',value:function getKeyListener(){return null;}},{key:'setKeyListener',value:function setKeyListener(input){}},{key:'setKeyListenerOnly',value:function setKeyListenerOnly(input){}},{key:'getMovementMethod',value:function getMovementMethod(){return this.mMovement;}},{key:'setMovementMethod',value:function setMovementMethod(movement){if(this.mMovement!=movement){this.mMovement=movement;if(movement!=null&&!Spannable.isImpl(this.mText)){this.setText(this.mText);}this.fixFocusableAndClickableSettings();}}},{key:'fixFocusableAndClickableSettings',value:function fixFocusableAndClickableSettings(){if(this.mMovement!=null){this.setFocusable(true);this.setClickable(true);this.setLongClickable(true);}else{this.setFocusable(false);this.setClickable(false);this.setLongClickable(false);}}},{key:'getTransformationMethod',value:function getTransformationMethod(){return this.mTransformation;}},{key:'setTransformationMethod',value:function setTransformationMethod(method){if(method==this.mTransformation){return;}if(this.mTransformation!=null){if(Spannable.isImpl(this.mText)){this.mText.removeSpan(this.mTransformation);}}this.mTransformation=method;if(TransformationMethod2.isImpl(method)){var method2=method;this.mAllowTransformationLengthChange=!this.isTextSelectable();method2.setLengthChangesAllowed(this.mAllowTransformationLengthChange);}else{this.mAllowTransformationLengthChange=false;}this.setText(this.mText);}},{key:'getCompoundPaddingTop',value:function getCompoundPaddingTop(){var dr=this.mDrawables;if(dr==null||dr.mDrawableTop==null){return this.mPaddingTop;}else{return this.mPaddingTop+dr.mDrawablePadding+dr.mDrawableSizeTop;}}},{key:'getCompoundPaddingBottom',value:function getCompoundPaddingBottom(){var dr=this.mDrawables;if(dr==null||dr.mDrawableBottom==null){return this.mPaddingBottom;}else{return this.mPaddingBottom+dr.mDrawablePadding+dr.mDrawableSizeBottom;}}},{key:'getCompoundPaddingLeft',value:function getCompoundPaddingLeft(){var dr=this.mDrawables;if(dr==null||dr.mDrawableLeft==null){return this.mPaddingLeft;}else{return this.mPaddingLeft+dr.mDrawablePadding+dr.mDrawableSizeLeft;}}},{key:'getCompoundPaddingRight',value:function getCompoundPaddingRight(){var dr=this.mDrawables;if(dr==null||dr.mDrawableRight==null){return this.mPaddingRight;}else{return this.mPaddingRight+dr.mDrawablePadding+dr.mDrawableSizeRight;}}},{key:'getCompoundPaddingStart',value:function getCompoundPaddingStart(){this.resolveDrawables();return this.getCompoundPaddingLeft();}},{key:'getCompoundPaddingEnd',value:function getCompoundPaddingEnd(){this.resolveDrawables();return this.getCompoundPaddingRight();}},{key:'getExtendedPaddingTop',value:function getExtendedPaddingTop(){if(this.mMaxMode!=TextView.LINES){return this.getCompoundPaddingTop();}if(this.mLayout.getLineCount()<=this.mMaximum){return this.getCompoundPaddingTop();}var top=this.getCompoundPaddingTop();var bottom=this.getCompoundPaddingBottom();var viewht=this.getHeight()-top-bottom;var layoutht=this.mLayout.getLineTop(this.mMaximum);if(layoutht>=viewht){return top;}var gravity=this.mGravity&Gravity.VERTICAL_GRAVITY_MASK;if(gravity==Gravity.TOP){return top;}else if(gravity==Gravity.BOTTOM){return top+viewht-layoutht;}else{return top+(viewht-layoutht)/2;}}},{key:'getExtendedPaddingBottom',value:function getExtendedPaddingBottom(){if(this.mMaxMode!=TextView.LINES){return this.getCompoundPaddingBottom();}if(this.mLayout.getLineCount()<=this.mMaximum){return this.getCompoundPaddingBottom();}var top=this.getCompoundPaddingTop();var bottom=this.getCompoundPaddingBottom();var viewht=this.getHeight()-top-bottom;var layoutht=this.mLayout.getLineTop(this.mMaximum);if(layoutht>=viewht){return bottom;}var gravity=this.mGravity&Gravity.VERTICAL_GRAVITY_MASK;if(gravity==Gravity.TOP){return bottom+viewht-layoutht;}else if(gravity==Gravity.BOTTOM){return bottom;}else{return bottom+(viewht-layoutht)/2;}}},{key:'getTotalPaddingLeft',value:function getTotalPaddingLeft(){return this.getCompoundPaddingLeft();}},{key:'getTotalPaddingRight',value:function getTotalPaddingRight(){return this.getCompoundPaddingRight();}},{key:'getTotalPaddingStart',value:function getTotalPaddingStart(){return this.getCompoundPaddingStart();}},{key:'getTotalPaddingEnd',value:function getTotalPaddingEnd(){return this.getCompoundPaddingEnd();}},{key:'getTotalPaddingTop',value:function getTotalPaddingTop(){return this.getExtendedPaddingTop()+this.getVerticalOffset(true);}},{key:'getTotalPaddingBottom',value:function getTotalPaddingBottom(){return this.getExtendedPaddingBottom()+this.getBottomVerticalOffset(true);}},{key:'setCompoundDrawables',value:function setCompoundDrawables(left,top,right,bottom){var dr=this.mDrawables;var drawables=left!=null||top!=null||right!=null||bottom!=null;if(!drawables){if(dr!=null){if(dr.mDrawablePadding==0){this.mDrawables=null;}else{if(dr.mDrawableLeft!=null){dr.mDrawableLeft.setCallback(null);}dr.mDrawableLeft=null;if(dr.mDrawableTop!=null){dr.mDrawableTop.setCallback(null);}dr.mDrawableTop=null;if(dr.mDrawableRight!=null){dr.mDrawableRight.setCallback(null);}dr.mDrawableRight=null;if(dr.mDrawableBottom!=null){dr.mDrawableBottom.setCallback(null);}dr.mDrawableBottom=null;dr.mDrawableSizeLeft=dr.mDrawableHeightLeft=0;dr.mDrawableSizeRight=dr.mDrawableHeightRight=0;dr.mDrawableSizeTop=dr.mDrawableWidthTop=0;dr.mDrawableSizeBottom=dr.mDrawableWidthBottom=0;}}}else{if(dr==null){this.mDrawables=dr=new TextView.Drawables();}this.mDrawables.mOverride=false;if(dr.mDrawableLeft!=left&&dr.mDrawableLeft!=null){dr.mDrawableLeft.setCallback(null);}dr.mDrawableLeft=left;if(dr.mDrawableTop!=top&&dr.mDrawableTop!=null){dr.mDrawableTop.setCallback(null);}dr.mDrawableTop=top;if(dr.mDrawableRight!=right&&dr.mDrawableRight!=null){dr.mDrawableRight.setCallback(null);}dr.mDrawableRight=right;if(dr.mDrawableBottom!=bottom&&dr.mDrawableBottom!=null){dr.mDrawableBottom.setCallback(null);}dr.mDrawableBottom=bottom;var compoundRect=dr.mCompoundRect;var state=void 0;state=this.getDrawableState();if(left!=null){left.setState(state);left.copyBounds(compoundRect);left.setCallback(this);dr.mDrawableSizeLeft=compoundRect.width();dr.mDrawableHeightLeft=compoundRect.height();}else{dr.mDrawableSizeLeft=dr.mDrawableHeightLeft=0;}if(right!=null){right.setState(state);right.copyBounds(compoundRect);right.setCallback(this);dr.mDrawableSizeRight=compoundRect.width();dr.mDrawableHeightRight=compoundRect.height();}else{dr.mDrawableSizeRight=dr.mDrawableHeightRight=0;}if(top!=null){top.setState(state);top.copyBounds(compoundRect);top.setCallback(this);dr.mDrawableSizeTop=compoundRect.height();dr.mDrawableWidthTop=compoundRect.width();}else{dr.mDrawableSizeTop=dr.mDrawableWidthTop=0;}if(bottom!=null){bottom.setState(state);bottom.copyBounds(compoundRect);bottom.setCallback(this);dr.mDrawableSizeBottom=compoundRect.height();dr.mDrawableWidthBottom=compoundRect.width();}else{dr.mDrawableSizeBottom=dr.mDrawableWidthBottom=0;}}if(dr!=null){dr.mDrawableLeftInitial=left;dr.mDrawableRightInitial=right;}this.resetResolvedDrawables();this.resolveDrawables();this.invalidate();this.requestLayout();}},{key:'setCompoundDrawablesWithIntrinsicBounds',value:function setCompoundDrawablesWithIntrinsicBounds(left,top,right,bottom){if(left!=null){left.setBounds(0,0,left.getIntrinsicWidth(),left.getIntrinsicHeight());}if(right!=null){right.setBounds(0,0,right.getIntrinsicWidth(),right.getIntrinsicHeight());}if(top!=null){top.setBounds(0,0,top.getIntrinsicWidth(),top.getIntrinsicHeight());}if(bottom!=null){bottom.setBounds(0,0,bottom.getIntrinsicWidth(),bottom.getIntrinsicHeight());}this.setCompoundDrawables(left,top,right,bottom);}},{key:'setCompoundDrawablesRelative',value:function setCompoundDrawablesRelative(start,top,end,bottom){var dr=this.mDrawables;var drawables=start!=null||top!=null||end!=null||bottom!=null;if(!drawables){if(dr!=null){if(dr.mDrawablePadding==0){this.mDrawables=null;}else{if(dr.mDrawableStart!=null){dr.mDrawableStart.setCallback(null);}dr.mDrawableStart=null;if(dr.mDrawableTop!=null){dr.mDrawableTop.setCallback(null);}dr.mDrawableTop=null;if(dr.mDrawableEnd!=null){dr.mDrawableEnd.setCallback(null);}dr.mDrawableEnd=null;if(dr.mDrawableBottom!=null){dr.mDrawableBottom.setCallback(null);}dr.mDrawableBottom=null;dr.mDrawableSizeStart=dr.mDrawableHeightStart=0;dr.mDrawableSizeEnd=dr.mDrawableHeightEnd=0;dr.mDrawableSizeTop=dr.mDrawableWidthTop=0;dr.mDrawableSizeBottom=dr.mDrawableWidthBottom=0;}}}else{if(dr==null){this.mDrawables=dr=new TextView.Drawables();}this.mDrawables.mOverride=true;if(dr.mDrawableStart!=start&&dr.mDrawableStart!=null){dr.mDrawableStart.setCallback(null);}dr.mDrawableStart=start;if(dr.mDrawableTop!=top&&dr.mDrawableTop!=null){dr.mDrawableTop.setCallback(null);}dr.mDrawableTop=top;if(dr.mDrawableEnd!=end&&dr.mDrawableEnd!=null){dr.mDrawableEnd.setCallback(null);}dr.mDrawableEnd=end;if(dr.mDrawableBottom!=bottom&&dr.mDrawableBottom!=null){dr.mDrawableBottom.setCallback(null);}dr.mDrawableBottom=bottom;var compoundRect=dr.mCompoundRect;var state=void 0;state=this.getDrawableState();if(start!=null){start.setState(state);start.copyBounds(compoundRect);start.setCallback(this);dr.mDrawableSizeStart=compoundRect.width();dr.mDrawableHeightStart=compoundRect.height();}else{dr.mDrawableSizeStart=dr.mDrawableHeightStart=0;}if(end!=null){end.setState(state);end.copyBounds(compoundRect);end.setCallback(this);dr.mDrawableSizeEnd=compoundRect.width();dr.mDrawableHeightEnd=compoundRect.height();}else{dr.mDrawableSizeEnd=dr.mDrawableHeightEnd=0;}if(top!=null){top.setState(state);top.copyBounds(compoundRect);top.setCallback(this);dr.mDrawableSizeTop=compoundRect.height();dr.mDrawableWidthTop=compoundRect.width();}else{dr.mDrawableSizeTop=dr.mDrawableWidthTop=0;}if(bottom!=null){bottom.setState(state);bottom.copyBounds(compoundRect);bottom.setCallback(this);dr.mDrawableSizeBottom=compoundRect.height();dr.mDrawableWidthBottom=compoundRect.width();}else{dr.mDrawableSizeBottom=dr.mDrawableWidthBottom=0;}}this.resetResolvedDrawables();this.resolveDrawables();this.invalidate();this.requestLayout();}},{key:'setCompoundDrawablesRelativeWithIntrinsicBounds',value:function setCompoundDrawablesRelativeWithIntrinsicBounds(start,top,end,bottom){if(start!=null){start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());}if(end!=null){end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());}if(top!=null){top.setBounds(0,0,top.getIntrinsicWidth(),top.getIntrinsicHeight());}if(bottom!=null){bottom.setBounds(0,0,bottom.getIntrinsicWidth(),bottom.getIntrinsicHeight());}this.setCompoundDrawablesRelative(start,top,end,bottom);}},{key:'getCompoundDrawables',value:function getCompoundDrawables(){var dr=this.mDrawables;if(dr!=null){return[dr.mDrawableLeft,dr.mDrawableTop,dr.mDrawableRight,dr.mDrawableBottom];}else{return[null,null,null,null];}}},{key:'getCompoundDrawablesRelative',value:function getCompoundDrawablesRelative(){var dr=this.mDrawables;if(dr!=null){return[dr.mDrawableStart,dr.mDrawableTop,dr.mDrawableEnd,dr.mDrawableBottom];}else{return[null,null,null,null];}}},{key:'setCompoundDrawablePadding',value:function setCompoundDrawablePadding(pad){var dr=this.mDrawables;if(pad==0){if(dr!=null){dr.mDrawablePadding=pad;}}else{if(dr==null){this.mDrawables=dr=new TextView.Drawables();}dr.mDrawablePadding=pad;}this.invalidate();this.requestLayout();}},{key:'getCompoundDrawablePadding',value:function getCompoundDrawablePadding(){var dr=this.mDrawables;return dr!=null?dr.mDrawablePadding:0;}},{key:'setPadding',value:function setPadding(left,top,right,bottom){if(left!=this.mPaddingLeft||right!=this.mPaddingRight||top!=this.mPaddingTop||bottom!=this.mPaddingBottom){this.nullLayouts();}_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'setPadding',this).call(this,left,top,right,bottom);this.invalidate();}},{key:'getAutoLinkMask',value:function getAutoLinkMask(){return this.mAutoLinkMask;}},{key:'getTextLocale',value:function getTextLocale(){return null;}},{key:'setTextLocale',value:function setTextLocale(locale){}},{key:'getTextSize',value:function getTextSize(){return this.mTextPaint.getTextSize();}},{key:'setTextSize',value:function setTextSize(){for(var _len25=arguments.length,args=Array(_len25),_key26=0;_key26<_len25;_key26++){args[_key26]=arguments[_key26];}if(args.length==1){this.setTextSize(TypedValue.COMPLEX_UNIT_SP,args[0]);return;}var unit=args[0],size=args[1];this.setRawTextSize(TypedValue.applyDimension(unit,size,this.getResources().getDisplayMetrics()));}},{key:'setRawTextSize',value:function setRawTextSize(size){if(size!=this.mTextPaint.getTextSize()){this.mTextPaint.setTextSize(size);if(this.mLayout!=null){this.nullLayouts();this.requestLayout();this.invalidate();}}}},{key:'getTextScaleX',value:function getTextScaleX(){return 1;}},{key:'setTextScaleX',value:function setTextScaleX(size){}},{key:'getTypeface',value:function getTypeface(){return null;}},{key:'setTextColor',value:function setTextColor(colors){if(typeof colors==='number'){colors=ColorStateList.valueOf(colors);}if(colors==null){throw Error('new NullPointerException()');}this.mTextColor=colors;this.updateTextColors();}},{key:'getTextColors',value:function getTextColors(){return this.mTextColor;}},{key:'getCurrentTextColor',value:function getCurrentTextColor(){return this.mCurTextColor;}},{key:'setHighlightColor',value:function setHighlightColor(color){if(this.mHighlightColor!=color){this.mHighlightColor=color;this.invalidate();}}},{key:'getHighlightColor',value:function getHighlightColor(){return this.mHighlightColor;}},{key:'setShowSoftInputOnFocus',value:function setShowSoftInputOnFocus(show){this.createEditorIfNeeded();}},{key:'getShowSoftInputOnFocus',value:function getShowSoftInputOnFocus(){return false;}},{key:'setShadowLayer',value:function setShadowLayer(radius,dx,dy,color){this.mTextPaint.setShadowLayer(radius,dx,dy,color);this.mShadowRadius=radius;this.mShadowDx=dx;this.mShadowDy=dy;this.invalidate();}},{key:'getShadowRadius',value:function getShadowRadius(){return this.mShadowRadius;}},{key:'getShadowDx',value:function getShadowDx(){return this.mShadowDx;}},{key:'getShadowDy',value:function getShadowDy(){return this.mShadowDy;}},{key:'getShadowColor',value:function getShadowColor(){return this.mTextPaint.shadowColor;}},{key:'getPaint',value:function getPaint(){return this.mTextPaint;}},{key:'setAutoLinkMask',value:function setAutoLinkMask(mask){this.mAutoLinkMask=mask;}},{key:'setLinksClickable',value:function setLinksClickable(whether){this.mLinksClickable=whether;}},{key:'getLinksClickable',value:function getLinksClickable(){return this.mLinksClickable;}},{key:'getUrls',value:function getUrls(){return new Array(0);}},{key:'setHintTextColor',value:function setHintTextColor(colors){if(typeof colors==='number'){colors=ColorStateList.valueOf(colors);}this.mHintTextColor=colors;this.updateTextColors();}},{key:'getHintTextColors',value:function getHintTextColors(){return this.mHintTextColor;}},{key:'getCurrentHintTextColor',value:function getCurrentHintTextColor(){return this.mHintTextColor!=null?this.mCurHintTextColor:this.mCurTextColor;}},{key:'setLinkTextColor',value:function setLinkTextColor(colors){if(typeof colors==='number'){colors=ColorStateList.valueOf(colors);}this.mLinkTextColor=colors;this.updateTextColors();}},{key:'getLinkTextColors',value:function getLinkTextColors(){return this.mLinkTextColor;}},{key:'setGravity',value:function setGravity(gravity){if((gravity&Gravity.HORIZONTAL_GRAVITY_MASK)==0){gravity|=Gravity.LEFT;}if((gravity&Gravity.VERTICAL_GRAVITY_MASK)==0){gravity|=Gravity.TOP;}var newLayout=false;if((gravity&Gravity.HORIZONTAL_GRAVITY_MASK)!=(this.mGravity&Gravity.HORIZONTAL_GRAVITY_MASK)){newLayout=true;}if(gravity!=this.mGravity){this.invalidate();}this.mGravity=gravity;if(this.mLayout!=null&&newLayout){var want=this.mLayout.getWidth();var hintWant=this.mHintLayout==null?0:this.mHintLayout.getWidth();this.makeNewLayout(want,hintWant,TextView.UNKNOWN_BORING,TextView.UNKNOWN_BORING,this.mRight-this.mLeft-this.getCompoundPaddingLeft()-this.getCompoundPaddingRight(),true);}}},{key:'getGravity',value:function getGravity(){return this.mGravity;}},{key:'getPaintFlags',value:function getPaintFlags(){return this.mTextPaint.getFlags();}},{key:'setPaintFlags',value:function setPaintFlags(flags){if(this.mTextPaint.getFlags()!=flags){this.mTextPaint.setFlags(flags);if(this.mLayout!=null){this.nullLayouts();this.requestLayout();this.invalidate();}}}},{key:'setHorizontallyScrolling',value:function setHorizontallyScrolling(whether){if(this.mHorizontallyScrolling!=whether){this.mHorizontallyScrolling=whether;if(this.mLayout!=null){this.nullLayouts();this.requestLayout();this.invalidate();}}}},{key:'getHorizontallyScrolling',value:function getHorizontallyScrolling(){return this.mHorizontallyScrolling;}},{key:'setMinLines',value:function setMinLines(minlines){this.mMinimum=minlines;this.mMinMode=TextView.LINES;this.requestLayout();this.invalidate();}},{key:'getMinLines',value:function getMinLines(){return this.mMinMode==TextView.LINES?this.mMinimum:-1;}},{key:'setMinHeight',value:function setMinHeight(minHeight){this.mMinimum=minHeight;this.mMinMode=TextView.PIXELS;this.requestLayout();this.invalidate();}},{key:'getMinHeight',value:function getMinHeight(){return this.mMinMode==TextView.PIXELS?this.mMinimum:-1;}},{key:'setMaxLines',value:function setMaxLines(maxlines){this.mMaximum=maxlines;this.mMaxMode=TextView.LINES;this.requestLayout();this.invalidate();}},{key:'getMaxLines',value:function getMaxLines(){return this.mMaxMode==TextView.LINES?this.mMaximum:-1;}},{key:'setMaxHeight',value:function setMaxHeight(maxHeight){this.mMaximum=maxHeight;this.mMaxMode=TextView.PIXELS;this.requestLayout();this.invalidate();}},{key:'getMaxHeight',value:function getMaxHeight(){return this.mMaxMode==TextView.PIXELS?this.mMaximum:-1;}},{key:'setLines',value:function setLines(lines){this.mMaximum=this.mMinimum=lines;this.mMaxMode=this.mMinMode=TextView.LINES;this.requestLayout();this.invalidate();}},{key:'setHeight',value:function setHeight(pixels){this.mMaximum=this.mMinimum=pixels;this.mMaxMode=this.mMinMode=TextView.PIXELS;this.requestLayout();this.invalidate();}},{key:'setMinEms',value:function setMinEms(minems){this.mMinWidthValue=minems;this.mMinWidthMode=TextView.EMS;this.requestLayout();this.invalidate();}},{key:'getMinEms',value:function getMinEms(){return this.mMinWidthMode==TextView.EMS?this.mMinWidthValue:-1;}},{key:'setMinWidth',value:function setMinWidth(minpixels){this.mMinWidthValue=minpixels;this.mMinWidthMode=TextView.PIXELS;this.requestLayout();this.invalidate();}},{key:'getMinWidth',value:function getMinWidth(){return this.mMinWidthMode==TextView.PIXELS?this.mMinWidthValue:-1;}},{key:'setMaxEms',value:function setMaxEms(maxems){this.mMaxWidthValue=maxems;this.mMaxWidthMode=TextView.EMS;this.requestLayout();this.invalidate();}},{key:'getMaxEms',value:function getMaxEms(){return this.mMaxWidthMode==TextView.EMS?this.mMaxWidthValue:-1;}},{key:'setMaxWidth',value:function setMaxWidth(maxpixels){this.mMaxWidthValue=maxpixels;this.mMaxWidthMode=TextView.PIXELS;this.requestLayout();this.invalidate();}},{key:'getMaxWidth',value:function getMaxWidth(){return this.mMaxWidthMode==TextView.PIXELS?this.mMaxWidthValue:-1;}},{key:'setEms',value:function setEms(ems){this.mMaxWidthValue=this.mMinWidthValue=ems;this.mMaxWidthMode=this.mMinWidthMode=TextView.EMS;this.requestLayout();this.invalidate();}},{key:'setWidth',value:function setWidth(pixels){this.mMaxWidthValue=this.mMinWidthValue=pixels;this.mMaxWidthMode=this.mMinWidthMode=TextView.PIXELS;this.requestLayout();this.invalidate();}},{key:'setLineSpacing',value:function setLineSpacing(add,mult){if(this.mSpacingAdd!=add||this.mSpacingMult!=mult){this.mSpacingAdd=add;this.mSpacingMult=mult;if(this.mLayout!=null){this.nullLayouts();this.requestLayout();this.invalidate();}}}},{key:'getLineSpacingMultiplier',value:function getLineSpacingMultiplier(){return this.mSpacingMult;}},{key:'getLineSpacingExtra',value:function getLineSpacingExtra(){return this.mSpacingAdd;}},{key:'updateTextColors',value:function updateTextColors(){var inval=false;var color=this.mTextColor.getColorForState(this.getDrawableState(),0);if(color!=this.mCurTextColor){this.mCurTextColor=color;inval=true;}if(this.mLinkTextColor!=null){color=this.mLinkTextColor.getColorForState(this.getDrawableState(),0);if(color!=this.mTextPaint.linkColor){this.mTextPaint.linkColor=color;inval=true;}}if(this.mHintTextColor!=null){color=this.mHintTextColor.getColorForState(this.getDrawableState(),0);if(color!=this.mCurHintTextColor&&this.mText.length==0){this.mCurHintTextColor=color;inval=true;}}if(inval){this.invalidate();}}},{key:'drawableStateChanged',value:function drawableStateChanged(){_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'drawableStateChanged',this).call(this);if(this.mTextColor!=null&&this.mTextColor.isStateful()||this.mHintTextColor!=null&&this.mHintTextColor.isStateful()||this.mLinkTextColor!=null&&this.mLinkTextColor.isStateful()){this.updateTextColors();}var dr=this.mDrawables;if(dr!=null){var state=this.getDrawableState();if(dr.mDrawableTop!=null&&dr.mDrawableTop.isStateful()){dr.mDrawableTop.setState(state);}if(dr.mDrawableBottom!=null&&dr.mDrawableBottom.isStateful()){dr.mDrawableBottom.setState(state);}if(dr.mDrawableLeft!=null&&dr.mDrawableLeft.isStateful()){dr.mDrawableLeft.setState(state);}if(dr.mDrawableRight!=null&&dr.mDrawableRight.isStateful()){dr.mDrawableRight.setState(state);}if(dr.mDrawableStart!=null&&dr.mDrawableStart.isStateful()){dr.mDrawableStart.setState(state);}if(dr.mDrawableEnd!=null&&dr.mDrawableEnd.isStateful()){dr.mDrawableEnd.setState(state);}}}},{key:'removeMisspelledSpans',value:function removeMisspelledSpans(spannable){}},{key:'setFreezesText',value:function setFreezesText(freezesText){this.mFreezesText=freezesText;}},{key:'getFreezesText',value:function getFreezesText(){return this.mFreezesText;}},{key:'setSpannableFactory',value:function setSpannableFactory(factory){this.mSpannableFactory=factory;this.setText(this.mText);}},{key:'setText',value:function setText(text){var type=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.mBufferType;var notifyBefore=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var oldlen=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;if(text==null){text=\"\";}if(!this.isSuggestionsEnabled()){text=this.removeSuggestionSpans(text);}if(Spanned.isImplements(text)&&text.getSpanStart(TextUtils.TruncateAt.MARQUEE)>=0){this.setHorizontalFadingEdgeEnabled(true);this.mMarqueeFadeMode=TextView.MARQUEE_FADE_NORMAL;this.setEllipsize(TextUtils.TruncateAt.MARQUEE);}if(notifyBefore){if(this.mText!=null){oldlen=this.mText.length;this.sendBeforeTextChanged(this.mText,0,oldlen,text.length);}else{this.sendBeforeTextChanged(\"\",0,0,text.length);}}var needEditableForNotification=false;if(this.mListeners!=null&&this.mListeners.size()!=0){needEditableForNotification=true;}if(type==TextView.BufferType.SPANNABLE||this.mMovement!=null){text=this.mSpannableFactory.newSpannable(text);}this.mBufferType=type;this.mText=text;if(this.mTransformation==null){this.mTransformed=text;}else{this.mTransformed=this.mTransformation.getTransformation(text,this);}var textLength=text.length;if(this.mLayout!=null){this.checkForRelayout();}this.sendOnTextChanged(text,0,oldlen,textLength);this.onTextChanged(text,0,oldlen,textLength);}},{key:'setHint',value:function setHint(hint){this.mHint=hint;if(this.mLayout!=null){this.checkForRelayout();}if(this.mText.length==0){this.invalidate();}}},{key:'getHint',value:function getHint(){return this.mHint;}},{key:'isSingleLine',value:function isSingleLine(){return this.mSingleLine;}},{key:'removeSuggestionSpans',value:function removeSuggestionSpans(text){return text;}},{key:'hasPasswordTransformationMethod',value:function hasPasswordTransformationMethod(){return false;}},{key:'setRawInputType',value:function setRawInputType(type){}},{key:'setInputType',value:function setInputType(type){var direct=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;}},{key:'getInputType',value:function getInputType(){return 0;}},{key:'setImeOptions',value:function setImeOptions(imeOptions){}},{key:'getImeOptions',value:function getImeOptions(){return-1;}},{key:'setImeActionLabel',value:function setImeActionLabel(label,actionId){this.createEditorIfNeeded();}},{key:'getImeActionLabel',value:function getImeActionLabel(){return'';}},{key:'getImeActionId',value:function getImeActionId(){return 0;}},{key:'setOnEditorActionListener',value:function setOnEditorActionListener(l){this.createEditorIfNeeded();}},{key:'setFrame',value:function setFrame(l,t,r,b){var result=_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'setFrame',this).call(this,l,t,r,b);this.restartMarqueeIfNeeded();return result;}},{key:'restartMarqueeIfNeeded',value:function restartMarqueeIfNeeded(){if(this.mRestartMarquee&&this.mEllipsize==TextUtils.TruncateAt.MARQUEE){this.mRestartMarquee=false;this.startMarquee();}}},{key:'setFilters',value:function setFilters(){}},{key:'getFilters',value:function getFilters(){return this.mFilters;}},{key:'getBoxHeight',value:function getBoxHeight(l){var padding=l==this.mHintLayout?this.getCompoundPaddingTop()+this.getCompoundPaddingBottom():this.getExtendedPaddingTop()+this.getExtendedPaddingBottom();return this.getMeasuredHeight()-padding;}},{key:'getVerticalOffset',value:function getVerticalOffset(forceNormal){var voffset=0;var gravity=this.mGravity&Gravity.VERTICAL_GRAVITY_MASK;var l=this.mLayout;if(!forceNormal&&this.mText.length==0&&this.mHintLayout!=null){l=this.mHintLayout;}if(gravity!=Gravity.TOP){var boxht=this.getBoxHeight(l);var textht=l.getHeight();if(textht<boxht){if(gravity==Gravity.BOTTOM)voffset=boxht-textht;else voffset=boxht-textht>>1;}}return voffset;}},{key:'getBottomVerticalOffset',value:function getBottomVerticalOffset(forceNormal){var voffset=0;var gravity=this.mGravity&Gravity.VERTICAL_GRAVITY_MASK;var l=this.mLayout;if(!forceNormal&&this.mText.length==0&&this.mHintLayout!=null){l=this.mHintLayout;}if(gravity!=Gravity.BOTTOM){var boxht=this.getBoxHeight(l);var textht=l.getHeight();if(textht<boxht){if(gravity==Gravity.TOP)voffset=boxht-textht;else voffset=boxht-textht>>1;}}return voffset;}},{key:'invalidateRegion',value:function invalidateRegion(start,end,invalidateCursor){if(this.mLayout==null){this.invalidate();}else{var lineStart=this.mLayout.getLineForOffset(start);var top=this.mLayout.getLineTop(lineStart);if(lineStart>0){top-=this.mLayout.getLineDescent(lineStart-1);}var lineEnd=void 0;if(start==end)lineEnd=lineStart;else lineEnd=this.mLayout.getLineForOffset(end);var bottom=this.mLayout.getLineBottom(lineEnd);var compoundPaddingLeft=this.getCompoundPaddingLeft();var verticalPadding=this.getExtendedPaddingTop()+this.getVerticalOffset(true);var left=void 0,right=void 0;if(lineStart==lineEnd&&!invalidateCursor){left=Math.floor(this.mLayout.getPrimaryHorizontal(start));right=Math.floor(this.mLayout.getPrimaryHorizontal(end)+1.0);left+=compoundPaddingLeft;right+=compoundPaddingLeft;}else{left=compoundPaddingLeft;right=this.getWidth()-this.getCompoundPaddingRight();}this.invalidate(this.mScrollX+left,verticalPadding+top,this.mScrollX+right,verticalPadding+bottom);}}},{key:'registerForPreDraw',value:function registerForPreDraw(){if(!this.mPreDrawRegistered){this.getViewTreeObserver().addOnPreDrawListener(this);this.mPreDrawRegistered=true;}}},{key:'onPreDraw',value:function onPreDraw(){if(this.mLayout==null){this.assumeLayout();}if(this.mMovement!=null){var curs=this.getSelectionEnd();if(curs<0&&(this.mGravity&Gravity.VERTICAL_GRAVITY_MASK)==Gravity.BOTTOM){curs=this.mText.length;}if(curs>=0){this.bringPointIntoView(curs);}}else{this.bringTextIntoView();}this.getViewTreeObserver().removeOnPreDrawListener(this);this.mPreDrawRegistered=false;return true;}},{key:'onAttachedToWindow',value:function onAttachedToWindow(){_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'onAttachedToWindow',this).call(this);this.mTemporaryDetach=false;}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'onDetachedFromWindow',this).call(this);if(this.mPreDrawRegistered){this.getViewTreeObserver().removeOnPreDrawListener(this);this.mPreDrawRegistered=false;}this.resetResolvedDrawables();}},{key:'isPaddingOffsetRequired',value:function isPaddingOffsetRequired(){return this.mShadowRadius!=0||this.mDrawables!=null;}},{key:'getLeftPaddingOffset',value:function getLeftPaddingOffset(){return this.getCompoundPaddingLeft()-this.mPaddingLeft+Math.floor(Math.min(0,this.mShadowDx-this.mShadowRadius));}},{key:'getTopPaddingOffset',value:function getTopPaddingOffset(){return Math.floor(Math.min(0,this.mShadowDy-this.mShadowRadius));}},{key:'getBottomPaddingOffset',value:function getBottomPaddingOffset(){return Math.floor(Math.max(0,this.mShadowDy+this.mShadowRadius));}},{key:'getRightPaddingOffset',value:function getRightPaddingOffset(){return-(this.getCompoundPaddingRight()-this.mPaddingRight)+Math.floor(Math.max(0,this.mShadowDx+this.mShadowRadius));}},{key:'verifyDrawable',value:function verifyDrawable(who){var verified=_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'verifyDrawable',this).call(this,who);if(!verified&&this.mDrawables!=null){return who==this.mDrawables.mDrawableLeft||who==this.mDrawables.mDrawableTop||who==this.mDrawables.mDrawableRight||who==this.mDrawables.mDrawableBottom||who==this.mDrawables.mDrawableStart||who==this.mDrawables.mDrawableEnd;}return verified;}},{key:'jumpDrawablesToCurrentState',value:function jumpDrawablesToCurrentState(){_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'jumpDrawablesToCurrentState',this).call(this);if(this.mDrawables!=null){if(this.mDrawables.mDrawableLeft!=null){this.mDrawables.mDrawableLeft.jumpToCurrentState();}if(this.mDrawables.mDrawableTop!=null){this.mDrawables.mDrawableTop.jumpToCurrentState();}if(this.mDrawables.mDrawableRight!=null){this.mDrawables.mDrawableRight.jumpToCurrentState();}if(this.mDrawables.mDrawableBottom!=null){this.mDrawables.mDrawableBottom.jumpToCurrentState();}if(this.mDrawables.mDrawableStart!=null){this.mDrawables.mDrawableStart.jumpToCurrentState();}if(this.mDrawables.mDrawableEnd!=null){this.mDrawables.mDrawableEnd.jumpToCurrentState();}}}},{key:'drawableSizeChange',value:function drawableSizeChange(d){var drawables=this.mDrawables;var isCompoundDrawable=drawables!=null&&(d==drawables.mDrawableLeft||d==drawables.mDrawableTop||d==drawables.mDrawableRight||d==drawables.mDrawableBottom||d==drawables.mDrawableStart||d==drawables.mDrawableEnd);if(isCompoundDrawable){d.setBounds(0,0,d.getIntrinsicWidth(),d.getIntrinsicHeight());this.setCompoundDrawables(drawables.mDrawableLeft,drawables.mDrawableTop,drawables.mDrawableRight,drawables.mDrawableBottom);}else{_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'drawableSizeChange',this).call(this,d);}}},{key:'invalidateDrawable',value:function invalidateDrawable(drawable){if(this.verifyDrawable(drawable)){var dirty=drawable.getBounds();var scrollX=this.mScrollX;var scrollY=this.mScrollY;var drawables=this.mDrawables;if(drawables!=null){if(drawable==drawables.mDrawableLeft){var compoundPaddingTop=this.getCompoundPaddingTop();var compoundPaddingBottom=this.getCompoundPaddingBottom();var vspace=this.mBottom-this.mTop-compoundPaddingBottom-compoundPaddingTop;scrollX+=this.mPaddingLeft;scrollY+=compoundPaddingTop+(vspace-drawables.mDrawableHeightLeft)/2;}else if(drawable==drawables.mDrawableRight){var _compoundPaddingTop=this.getCompoundPaddingTop();var _compoundPaddingBottom=this.getCompoundPaddingBottom();var _vspace=this.mBottom-this.mTop-_compoundPaddingBottom-_compoundPaddingTop;scrollX+=this.mRight-this.mLeft-this.mPaddingRight-drawables.mDrawableSizeRight;scrollY+=_compoundPaddingTop+(_vspace-drawables.mDrawableHeightRight)/2;}else if(drawable==drawables.mDrawableTop){var compoundPaddingLeft=this.getCompoundPaddingLeft();var compoundPaddingRight=this.getCompoundPaddingRight();var hspace=this.mRight-this.mLeft-compoundPaddingRight-compoundPaddingLeft;scrollX+=compoundPaddingLeft+(hspace-drawables.mDrawableWidthTop)/2;scrollY+=this.mPaddingTop;}else if(drawable==drawables.mDrawableBottom){var _compoundPaddingLeft=this.getCompoundPaddingLeft();var _compoundPaddingRight=this.getCompoundPaddingRight();var _hspace=this.mRight-this.mLeft-_compoundPaddingRight-_compoundPaddingLeft;scrollX+=_compoundPaddingLeft+(_hspace-drawables.mDrawableWidthBottom)/2;scrollY+=this.mBottom-this.mTop-this.mPaddingBottom-drawables.mDrawableSizeBottom;}}this.invalidate(dirty.left+scrollX,dirty.top+scrollY,dirty.right+scrollX,dirty.bottom+scrollY);}}},{key:'isTextSelectable',value:function isTextSelectable(){return false;}},{key:'setTextIsSelectable',value:function setTextIsSelectable(selectable){}},{key:'onCreateDrawableState',value:function onCreateDrawableState(extraSpace){var drawableState=void 0;if(this.mSingleLine){drawableState=_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'onCreateDrawableState',this).call(this,extraSpace);}else{drawableState=_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'onCreateDrawableState',this).call(this,extraSpace+1);TextView.mergeDrawableStates(drawableState,TextView.MULTILINE_STATE_SET);}if(this.isTextSelectable()){var length=drawableState.length;for(var i=0;i<length;i++){if(drawableState[i]==View.VIEW_STATE_PRESSED){var nonPressedState=androidui.util.ArrayCreator.newNumberArray(length-1);System.arraycopy(drawableState,0,nonPressedState,0,i);System.arraycopy(drawableState,i+1,nonPressedState,i,length-i-1);return nonPressedState;}}}return drawableState;}},{key:'getUpdatedHighlightPath',value:function getUpdatedHighlightPath(){var highlight=null;var highlightPaint=this.mHighlightPaint;var selStart=this.getSelectionStart();var selEnd=this.getSelectionEnd();if(this.mMovement!=null&&(this.isFocused()||this.isPressed())&&selStart>=0){if(selStart==selEnd){}else{if(this.mHighlightPathBogus){if(this.mHighlightPath==null)this.mHighlightPath=new Path();this.mHighlightPath.reset();this.mLayout.getSelectionPath(selStart,selEnd,this.mHighlightPath);this.mHighlightPathBogus=false;}highlightPaint.setColor(this.mHighlightColor);highlightPaint.setStyle(Paint.Style.FILL);highlight=this.mHighlightPath;}}return highlight;}},{key:'getHorizontalOffsetForDrawables',value:function getHorizontalOffsetForDrawables(){return 0;}},{key:'onDraw',value:function onDraw(canvas){this.restartMarqueeIfNeeded();_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'onDraw',this).call(this,canvas);var compoundPaddingLeft=this.getCompoundPaddingLeft();var compoundPaddingTop=this.getCompoundPaddingTop();var compoundPaddingRight=this.getCompoundPaddingRight();var compoundPaddingBottom=this.getCompoundPaddingBottom();var scrollX=this.mScrollX;var scrollY=this.mScrollY;var right=this.mRight;var left=this.mLeft;var bottom=this.mBottom;var top=this.mTop;var isLayoutRtl=this.isLayoutRtl();var offset=this.getHorizontalOffsetForDrawables();var leftOffset=isLayoutRtl?0:offset;var rightOffset=isLayoutRtl?offset:0;var dr=this.mDrawables;if(dr!=null){var _vspace2=bottom-top-compoundPaddingBottom-compoundPaddingTop;var hspace=right-left-compoundPaddingRight-compoundPaddingLeft;if(dr.mDrawableLeft!=null){canvas.save();canvas.translate(scrollX+this.mPaddingLeft+leftOffset,scrollY+compoundPaddingTop+(_vspace2-dr.mDrawableHeightLeft)/2);dr.mDrawableLeft.draw(canvas);canvas.restore();}if(dr.mDrawableRight!=null){canvas.save();canvas.translate(scrollX+right-left-this.mPaddingRight-dr.mDrawableSizeRight-rightOffset,scrollY+compoundPaddingTop+(_vspace2-dr.mDrawableHeightRight)/2);dr.mDrawableRight.draw(canvas);canvas.restore();}if(dr.mDrawableTop!=null){canvas.save();canvas.translate(scrollX+compoundPaddingLeft+(hspace-dr.mDrawableWidthTop)/2,scrollY+this.mPaddingTop);dr.mDrawableTop.draw(canvas);canvas.restore();}if(dr.mDrawableBottom!=null){canvas.save();canvas.translate(scrollX+compoundPaddingLeft+(hspace-dr.mDrawableWidthBottom)/2,scrollY+bottom-top-this.mPaddingBottom-dr.mDrawableSizeBottom);dr.mDrawableBottom.draw(canvas);canvas.restore();}}var color=this.mCurTextColor;if(this.mLayout==null){this.assumeLayout();}var layout=this.mLayout;if(this.mHint!=null&&this.mText.length==0){if(this.mHintTextColor!=null){color=this.mCurHintTextColor;}layout=this.mHintLayout;}this.mTextPaint.setColor(color);this.mTextPaint.drawableState=this.getDrawableState();if(this.mSkipDrawText)return;canvas.save();var extendedPaddingTop=this.getExtendedPaddingTop();var extendedPaddingBottom=this.getExtendedPaddingBottom();var vspace=this.mBottom-this.mTop-compoundPaddingBottom-compoundPaddingTop;var maxScrollY=this.mLayout.getHeight()-vspace;var clipLeft=compoundPaddingLeft+scrollX;var clipTop=scrollY==0?0:extendedPaddingTop+scrollY;var clipRight=right-left-compoundPaddingRight+scrollX;var clipBottom=bottom-top+scrollY-(scrollY==maxScrollY?0:extendedPaddingBottom);if(this.mShadowRadius!=0){clipLeft+=Math.min(0,this.mShadowDx-this.mShadowRadius);clipRight+=Math.max(0,this.mShadowDx+this.mShadowRadius);clipTop+=Math.min(0,this.mShadowDy-this.mShadowRadius);clipBottom+=Math.max(0,this.mShadowDy+this.mShadowRadius);}canvas.clipRect(clipLeft,clipTop,clipRight,clipBottom);var voffsetText=0;var voffsetCursor=0;if((this.mGravity&Gravity.VERTICAL_GRAVITY_MASK)!=Gravity.TOP){voffsetText=this.getVerticalOffset(false);voffsetCursor=this.getVerticalOffset(true);}canvas.translate(compoundPaddingLeft,extendedPaddingTop+voffsetText);var absoluteGravity=this.mGravity;if(this.mEllipsize==TextUtils.TruncateAt.MARQUEE&&this.mMarqueeFadeMode!=TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS){if(!this.mSingleLine&&this.getLineCount()==1&&this.canMarquee()&&(absoluteGravity&Gravity.HORIZONTAL_GRAVITY_MASK)!=Gravity.LEFT){var width=this.mRight-this.mLeft;var _padding5=this.getCompoundPaddingLeft()+this.getCompoundPaddingRight();var _dx=this.mLayout.getLineRight(0)-(width-_padding5);canvas.translate(isLayoutRtl?-_dx:+_dx,0.0);}if(this.mMarquee!=null&&this.mMarquee.isRunning()){var _dx2=-this.mMarquee.getScroll();canvas.translate(isLayoutRtl?-_dx2:+_dx2,0.0);}}var cursorOffsetVertical=voffsetCursor-voffsetText;var highlight=this.getUpdatedHighlightPath();layout.draw(canvas,highlight,this.mHighlightPaint,cursorOffsetVertical);if(this.mMarquee!=null&&this.mMarquee.shouldDrawGhost()){var _dx3=Math.floor(this.mMarquee.getGhostOffset());canvas.translate(isLayoutRtl?-_dx3:_dx3,0.0);layout.draw(canvas,highlight,this.mHighlightPaint,cursorOffsetVertical);}canvas.restore();}},{key:'getFocusedRect',value:function getFocusedRect(r){if(this.mLayout==null){_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'getFocusedRect',this).call(this,r);return;}var selEnd=this.getSelectionEnd();if(selEnd<0){_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'getFocusedRect',this).call(this,r);return;}}},{key:'getLineCount',value:function getLineCount(){return this.mLayout!=null?this.mLayout.getLineCount():0;}},{key:'getLineBounds',value:function getLineBounds(line,bounds){if(this.mLayout==null){if(bounds!=null){bounds.set(0,0,0,0);}return 0;}else{var baseline=this.mLayout.getLineBounds(line,bounds);var voffset=this.getExtendedPaddingTop();if((this.mGravity&Gravity.VERTICAL_GRAVITY_MASK)!=Gravity.TOP){voffset+=this.getVerticalOffset(true);}if(bounds!=null){bounds.offset(this.getCompoundPaddingLeft(),voffset);}return baseline+voffset;}}},{key:'getBaseline',value:function getBaseline(){if(this.mLayout==null){return _get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'getBaseline',this).call(this);}var voffset=0;if((this.mGravity&Gravity.VERTICAL_GRAVITY_MASK)!=Gravity.TOP){voffset=this.getVerticalOffset(true);}return this.getExtendedPaddingTop()+voffset+this.mLayout.getLineBaseline(0);}},{key:'getFadeTop',value:function getFadeTop(offsetRequired){if(this.mLayout==null)return 0;var voffset=0;if((this.mGravity&Gravity.VERTICAL_GRAVITY_MASK)!=Gravity.TOP){voffset=this.getVerticalOffset(true);}if(offsetRequired)voffset+=this.getTopPaddingOffset();return this.getExtendedPaddingTop()+voffset;}},{key:'getFadeHeight',value:function getFadeHeight(offsetRequired){return this.mLayout!=null?this.mLayout.getHeight():0;}},{key:'onKeyDown',value:function onKeyDown(keyCode,event){var which=this.doKeyDown(keyCode,event,null);if(which==0){return _get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'onKeyDown',this).call(this,keyCode,event);}return true;}},{key:'shouldAdvanceFocusOnEnter',value:function shouldAdvanceFocusOnEnter(){if(this.getKeyListener()==null){return false;}if(this.mSingleLine){return true;}return false;}},{key:'shouldAdvanceFocusOnTab',value:function shouldAdvanceFocusOnTab(){return true;}},{key:'doKeyDown',value:function doKeyDown(keyCode,event,otherEvent){return 0;}},{key:'resetErrorChangedFlag',value:function resetErrorChangedFlag(){}},{key:'hideErrorIfUnchanged',value:function hideErrorIfUnchanged(){}},{key:'onKeyUp',value:function onKeyUp(keyCode,event){return _get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'onKeyUp',this).call(this,keyCode,event);}},{key:'onCheckIsTextEditor',value:function onCheckIsTextEditor(){return false;}},{key:'nullLayouts',value:function nullLayouts(){if(this.mLayout instanceof BoringLayout&&this.mSavedLayout==null){this.mSavedLayout=this.mLayout;}if(this.mHintLayout instanceof BoringLayout&&this.mSavedHintLayout==null){this.mSavedHintLayout=this.mHintLayout;}this.mSavedMarqueeModeLayout=this.mLayout=this.mHintLayout=null;this.mBoring=this.mHintBoring=null;}},{key:'assumeLayout',value:function assumeLayout(){var width=this.mRight-this.mLeft-this.getCompoundPaddingLeft()-this.getCompoundPaddingRight();if(width<1){width=0;}var physicalWidth=width;if(this.mHorizontallyScrolling){width=TextView.VERY_WIDE;}this.makeNewLayout(width,physicalWidth,TextView.UNKNOWN_BORING,TextView.UNKNOWN_BORING,physicalWidth,false);}},{key:'getLayoutAlignment',value:function getLayoutAlignment(){var alignment=void 0;switch(this.mGravity&Gravity.HORIZONTAL_GRAVITY_MASK){case Gravity.LEFT:alignment=Layout.Alignment.ALIGN_LEFT;break;case Gravity.RIGHT:alignment=Layout.Alignment.ALIGN_RIGHT;break;case Gravity.CENTER_HORIZONTAL:alignment=Layout.Alignment.ALIGN_CENTER;break;default:alignment=Layout.Alignment.ALIGN_NORMAL;break;}return alignment;}},{key:'makeNewLayout',value:function makeNewLayout(wantWidth,hintWidth,boring,hintBoring,ellipsisWidth,bringIntoView){this.stopMarquee();this.mOldMaximum=this.mMaximum;this.mOldMaxMode=this.mMaxMode;this.mHighlightPathBogus=true;if(wantWidth<0){wantWidth=0;}if(hintWidth<0){hintWidth=0;}var alignment=this.getLayoutAlignment();var testDirChange=this.mSingleLine&&this.mLayout!=null&&(alignment==Layout.Alignment.ALIGN_NORMAL||alignment==Layout.Alignment.ALIGN_OPPOSITE);var oldDir=0;if(testDirChange)oldDir=this.mLayout.getParagraphDirection(0);var shouldEllipsize=this.mEllipsize!=null&&this.getKeyListener()==null;var switchEllipsize=this.mEllipsize==TruncateAt.MARQUEE&&this.mMarqueeFadeMode!=TextView.MARQUEE_FADE_NORMAL;var effectiveEllipsize=this.mEllipsize;if(this.mEllipsize==TruncateAt.MARQUEE&&this.mMarqueeFadeMode==TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS){effectiveEllipsize=TruncateAt.END_SMALL;}if(this.mTextDir==null){this.mTextDir=this.getTextDirectionHeuristic();}this.mLayout=this.makeSingleLayout(wantWidth,boring,ellipsisWidth,alignment,shouldEllipsize,effectiveEllipsize,effectiveEllipsize==this.mEllipsize);if(switchEllipsize){var oppositeEllipsize=effectiveEllipsize==TruncateAt.MARQUEE?TruncateAt.END:TruncateAt.MARQUEE;this.mSavedMarqueeModeLayout=this.makeSingleLayout(wantWidth,boring,ellipsisWidth,alignment,shouldEllipsize,oppositeEllipsize,effectiveEllipsize!=this.mEllipsize);}shouldEllipsize=this.mEllipsize!=null;this.mHintLayout=null;if(this.mHint!=null){if(shouldEllipsize)hintWidth=wantWidth;if(hintBoring==TextView.UNKNOWN_BORING){hintBoring=BoringLayout.isBoring(this.mHint,this.mTextPaint,this.mTextDir,this.mHintBoring);if(hintBoring!=null){this.mHintBoring=hintBoring;}}if(hintBoring!=null){if(hintBoring.width<=hintWidth&&(!shouldEllipsize||hintBoring.width<=ellipsisWidth)){if(this.mSavedHintLayout!=null){this.mHintLayout=this.mSavedHintLayout.replaceOrMake(this.mHint,this.mTextPaint,hintWidth,alignment,this.mSpacingMult,this.mSpacingAdd,hintBoring,this.mIncludePad);}else{this.mHintLayout=BoringLayout.make(this.mHint,this.mTextPaint,hintWidth,alignment,this.mSpacingMult,this.mSpacingAdd,hintBoring,this.mIncludePad);}this.mSavedHintLayout=this.mHintLayout;}else if(shouldEllipsize&&hintBoring.width<=hintWidth){if(this.mSavedHintLayout!=null){this.mHintLayout=this.mSavedHintLayout.replaceOrMake(this.mHint,this.mTextPaint,hintWidth,alignment,this.mSpacingMult,this.mSpacingAdd,hintBoring,this.mIncludePad,this.mEllipsize,ellipsisWidth);}else{this.mHintLayout=BoringLayout.make(this.mHint,this.mTextPaint,hintWidth,alignment,this.mSpacingMult,this.mSpacingAdd,hintBoring,this.mIncludePad,this.mEllipsize,ellipsisWidth);}}else if(shouldEllipsize){this.mHintLayout=new StaticLayout(this.mHint,0,this.mHint.length,this.mTextPaint,hintWidth,alignment,this.mTextDir,this.mSpacingMult,this.mSpacingAdd,this.mIncludePad,this.mEllipsize,ellipsisWidth,this.mMaxMode==TextView.LINES?this.mMaximum:Integer.MAX_VALUE);}else{this.mHintLayout=new StaticLayout(this.mHint,0,this.mHint.length,this.mTextPaint,hintWidth,alignment,this.mTextDir,this.mSpacingMult,this.mSpacingAdd,this.mIncludePad);}}else if(shouldEllipsize){this.mHintLayout=new StaticLayout(this.mHint,0,this.mHint.length,this.mTextPaint,hintWidth,alignment,this.mTextDir,this.mSpacingMult,this.mSpacingAdd,this.mIncludePad,this.mEllipsize,ellipsisWidth,this.mMaxMode==TextView.LINES?this.mMaximum:Integer.MAX_VALUE);}else{this.mHintLayout=new StaticLayout(this.mHint,0,this.mHint.length,this.mTextPaint,hintWidth,alignment,this.mTextDir,this.mSpacingMult,this.mSpacingAdd,this.mIncludePad);}}if(bringIntoView||testDirChange&&oldDir!=this.mLayout.getParagraphDirection(0)){this.registerForPreDraw();}if(this.mEllipsize==TextUtils.TruncateAt.MARQUEE){if(!this.compressText(ellipsisWidth)){var height=this.mLayoutParams.height;if(height!=LayoutParams.WRAP_CONTENT&&height!=LayoutParams.MATCH_PARENT){this.startMarquee();}else{this.mRestartMarquee=true;}}}}},{key:'makeSingleLayout',value:function makeSingleLayout(wantWidth,boring,ellipsisWidth,alignment,shouldEllipsize,effectiveEllipsize,useSaved){var result=null;if(Spannable.isImpl(this.mText)){result=new DynamicLayout(this.mText,this.mTransformed,this.mTextPaint,wantWidth,alignment,this.mTextDir,this.mSpacingMult,this.mSpacingAdd,this.mIncludePad,this.getKeyListener()==null?effectiveEllipsize:null,ellipsisWidth);}else{if(boring==TextView.UNKNOWN_BORING){boring=BoringLayout.isBoring(this.mTransformed,this.mTextPaint,this.mTextDir,this.mBoring);if(boring!=null){this.mBoring=boring;}}if(boring!=null){if(boring.width<=wantWidth&&(effectiveEllipsize==null||boring.width<=ellipsisWidth)){if(useSaved&&this.mSavedLayout!=null){result=this.mSavedLayout.replaceOrMake(this.mTransformed,this.mTextPaint,wantWidth,alignment,this.mSpacingMult,this.mSpacingAdd,boring,this.mIncludePad);}else{result=BoringLayout.make(this.mTransformed,this.mTextPaint,wantWidth,alignment,this.mSpacingMult,this.mSpacingAdd,boring,this.mIncludePad);}if(useSaved){this.mSavedLayout=result;}}else if(shouldEllipsize&&boring.width<=wantWidth){if(useSaved&&this.mSavedLayout!=null){result=this.mSavedLayout.replaceOrMake(this.mTransformed,this.mTextPaint,wantWidth,alignment,this.mSpacingMult,this.mSpacingAdd,boring,this.mIncludePad,effectiveEllipsize,ellipsisWidth);}else{result=BoringLayout.make(this.mTransformed,this.mTextPaint,wantWidth,alignment,this.mSpacingMult,this.mSpacingAdd,boring,this.mIncludePad,effectiveEllipsize,ellipsisWidth);}}else if(shouldEllipsize){result=new StaticLayout(this.mTransformed,0,this.mTransformed.length,this.mTextPaint,wantWidth,alignment,this.mTextDir,this.mSpacingMult,this.mSpacingAdd,this.mIncludePad,effectiveEllipsize,ellipsisWidth,this.mMaxMode==TextView.LINES?this.mMaximum:Integer.MAX_VALUE);}else{result=new StaticLayout(this.mTransformed,0,this.mTransformed.length,this.mTextPaint,wantWidth,alignment,this.mTextDir,this.mSpacingMult,this.mSpacingAdd,this.mIncludePad);}}else if(shouldEllipsize){result=new StaticLayout(this.mTransformed,0,this.mTransformed.length,this.mTextPaint,wantWidth,alignment,this.mTextDir,this.mSpacingMult,this.mSpacingAdd,this.mIncludePad,effectiveEllipsize,ellipsisWidth,this.mMaxMode==TextView.LINES?this.mMaximum:Integer.MAX_VALUE);}else{result=new StaticLayout(this.mTransformed,0,this.mTransformed.length,this.mTextPaint,wantWidth,alignment,this.mTextDir,this.mSpacingMult,this.mSpacingAdd,this.mIncludePad);}}return result;}},{key:'compressText',value:function compressText(width){var _this99=this;if(this.isHardwareAccelerated())return false;if(width>0.0&&this.mLayout!=null&&this.getLineCount()==1&&!this.mUserSetTextScaleX&&this.mTextPaint.getTextScaleX()==1.0){var textWidth=this.mLayout.getLineWidth(0);var overflow=(textWidth+1.0-width)/width;if(overflow>0.0&&overflow<=TextView.Marquee.MARQUEE_DELTA_MAX){this.mTextPaint.setTextScaleX(1.0-overflow-0.005);this.post(function(){var inner_this=_this99;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'run',value:function run(){inner_this.requestLayout();}}]);return _Inner;}();return new _Inner();}());return true;}}return false;}},{key:'setIncludeFontPadding',value:function setIncludeFontPadding(includepad){if(this.mIncludePad!=includepad){this.mIncludePad=includepad;if(this.mLayout!=null){this.nullLayouts();this.requestLayout();this.invalidate();}}}},{key:'getIncludeFontPadding',value:function getIncludeFontPadding(){return this.mIncludePad;}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){var widthMode=View.MeasureSpec.getMode(widthMeasureSpec);var heightMode=View.MeasureSpec.getMode(heightMeasureSpec);var widthSize=View.MeasureSpec.getSize(widthMeasureSpec);var heightSize=View.MeasureSpec.getSize(heightMeasureSpec);var width=void 0;var height=void 0;var boring=TextView.UNKNOWN_BORING;var hintBoring=TextView.UNKNOWN_BORING;if(this.mTextDir==null){this.mTextDir=this.getTextDirectionHeuristic();}var des=-1;var fromexisting=false;if(widthMode==View.MeasureSpec.EXACTLY){width=widthSize;}else{if(this.mLayout!=null&&this.mEllipsize==null){des=TextView.desired(this.mLayout);}if(des<0){boring=BoringLayout.isBoring(this.mTransformed,this.mTextPaint,this.mTextDir,this.mBoring);if(boring!=null){this.mBoring=boring;}}else{fromexisting=true;}if(boring==null||boring==TextView.UNKNOWN_BORING){if(des<0){des=Math.floor(Math.ceil(Layout.getDesiredWidth(this.mTransformed,this.mTextPaint)));}width=des;}else{width=boring.width;}var dr=this.mDrawables;if(dr!=null){width=Math.max(width,dr.mDrawableWidthTop);width=Math.max(width,dr.mDrawableWidthBottom);}if(this.mHint!=null){var hintDes=-1;var _hintWidth=void 0;if(this.mHintLayout!=null&&this.mEllipsize==null){hintDes=TextView.desired(this.mHintLayout);}if(hintDes<0){hintBoring=BoringLayout.isBoring(this.mHint,this.mTextPaint,this.mTextDir,this.mHintBoring);if(hintBoring!=null){this.mHintBoring=hintBoring;}}if(hintBoring==null||hintBoring==TextView.UNKNOWN_BORING){if(hintDes<0){hintDes=Math.floor(Math.ceil(Layout.getDesiredWidth(this.mHint,this.mTextPaint)));}_hintWidth=hintDes;}else{_hintWidth=hintBoring.width;}if(_hintWidth>width){width=_hintWidth;}}width+=this.getCompoundPaddingLeft()+this.getCompoundPaddingRight();if(this.mMaxWidthMode==TextView.EMS){width=Math.min(width,this.mMaxWidthValue*this.getLineHeight());}else{width=Math.min(width,this.mMaxWidthValue);}if(this.mMinWidthMode==TextView.EMS){width=Math.max(width,this.mMinWidthValue*this.getLineHeight());}else{width=Math.max(width,this.mMinWidthValue);}width=Math.max(width,this.getSuggestedMinimumWidth());if(widthMode==View.MeasureSpec.AT_MOST){width=Math.min(widthSize,width);}}var want=width-this.getCompoundPaddingLeft()-this.getCompoundPaddingRight();var unpaddedWidth=want;if(this.mHorizontallyScrolling)want=TextView.VERY_WIDE;var hintWant=want;var hintWidth=this.mHintLayout==null?hintWant:this.mHintLayout.getWidth();if(this.mLayout==null){this.makeNewLayout(want,hintWant,boring,hintBoring,width-this.getCompoundPaddingLeft()-this.getCompoundPaddingRight(),false);}else{var layoutChanged=this.mLayout.getWidth()!=want||hintWidth!=hintWant||this.mLayout.getEllipsizedWidth()!=width-this.getCompoundPaddingLeft()-this.getCompoundPaddingRight();var widthChanged=this.mHint==null&&this.mEllipsize==null&&want>this.mLayout.getWidth()&&(this.mLayout instanceof BoringLayout||fromexisting&&des>=0&&des<=want);var maximumChanged=this.mMaxMode!=this.mOldMaxMode||this.mMaximum!=this.mOldMaximum;if(layoutChanged||maximumChanged){if(!maximumChanged&&widthChanged){this.mLayout.increaseWidthTo(want);}else{this.makeNewLayout(want,hintWant,boring,hintBoring,width-this.getCompoundPaddingLeft()-this.getCompoundPaddingRight(),false);}}else{}}if(heightMode==View.MeasureSpec.EXACTLY){height=heightSize;this.mDesiredHeightAtMeasure=-1;}else{var desired=this.getDesiredHeight();height=desired;this.mDesiredHeightAtMeasure=desired;if(heightMode==View.MeasureSpec.AT_MOST){height=Math.min(desired,heightSize);}}var unpaddedHeight=height-this.getCompoundPaddingTop()-this.getCompoundPaddingBottom();if(this.mMaxMode==TextView.LINES&&this.mLayout.getLineCount()>this.mMaximum){unpaddedHeight=Math.min(unpaddedHeight,this.mLayout.getLineTop(this.mMaximum));}if(this.mMovement!=null||this.mLayout.getWidth()>unpaddedWidth||this.mLayout.getHeight()>unpaddedHeight){this.registerForPreDraw();}else{this.scrollTo(0,0);}this.setMeasuredDimension(width,height);}},{key:'getDesiredHeight',value:function getDesiredHeight(layout){var cap=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;if(arguments.length===0){return Math.max(this.getDesiredHeight(this.mLayout,true),this.getDesiredHeight(this.mHintLayout,this.mEllipsize!=null));}if(layout==null){return 0;}var linecount=layout.getLineCount();var pad=this.getCompoundPaddingTop()+this.getCompoundPaddingBottom();var desired=layout.getLineTop(linecount);var dr=this.mDrawables;if(dr!=null){desired=Math.max(desired,dr.mDrawableHeightLeft);desired=Math.max(desired,dr.mDrawableHeightRight);}desired+=pad;if(this.mMaxMode==TextView.LINES){if(cap){if(linecount>this.mMaximum){desired=layout.getLineTop(this.mMaximum);if(dr!=null){desired=Math.max(desired,dr.mDrawableHeightLeft);desired=Math.max(desired,dr.mDrawableHeightRight);}desired+=pad;linecount=this.mMaximum;}}}else{desired=Math.min(desired,this.mMaximum);}if(this.mMinMode==TextView.LINES){if(linecount<this.mMinimum){desired+=this.getLineHeight()*(this.mMinimum-linecount);}}else{desired=Math.max(desired,this.mMinimum);}desired=Math.max(desired,this.getSuggestedMinimumHeight());return desired;}},{key:'checkForResize',value:function checkForResize(){var sizeChanged=false;if(this.mLayout!=null){if(this.mLayoutParams.width==LayoutParams.WRAP_CONTENT){sizeChanged=true;this.invalidate();}if(this.mLayoutParams.height==LayoutParams.WRAP_CONTENT){var desiredHeight=this.getDesiredHeight();if(desiredHeight!=this.getHeight()){sizeChanged=true;}}else if(this.mLayoutParams.height==LayoutParams.MATCH_PARENT){if(this.mDesiredHeightAtMeasure>=0){var _desiredHeight=this.getDesiredHeight();if(_desiredHeight!=this.mDesiredHeightAtMeasure){sizeChanged=true;}}}}if(sizeChanged){this.requestLayout();}}},{key:'checkForRelayout',value:function checkForRelayout(){if((this.mLayoutParams.width!=LayoutParams.WRAP_CONTENT||this.mMaxWidthMode==this.mMinWidthMode&&this.mMaxWidthValue==this.mMinWidthValue)&&(this.mHint==null||this.mHintLayout!=null)&&this.mRight-this.mLeft-this.getCompoundPaddingLeft()-this.getCompoundPaddingRight()>0){var oldht=this.mLayout.getHeight();var want=this.mLayout.getWidth();var hintWant=this.mHintLayout==null?0:this.mHintLayout.getWidth();this.makeNewLayout(want,hintWant,TextView.UNKNOWN_BORING,TextView.UNKNOWN_BORING,this.mRight-this.mLeft-this.getCompoundPaddingLeft()-this.getCompoundPaddingRight(),false);if(this.mEllipsize!=TextUtils.TruncateAt.MARQUEE){if(this.mLayoutParams.height!=LayoutParams.WRAP_CONTENT&&this.mLayoutParams.height!=LayoutParams.MATCH_PARENT){this.invalidate();return;}if(this.mLayout.getHeight()==oldht&&(this.mHintLayout==null||this.mHintLayout.getHeight()==oldht)){this.invalidate();return;}}this.requestLayout();this.invalidate();}else{this.nullLayouts();this.requestLayout();this.invalidate();}}},{key:'onLayout',value:function onLayout(changed,left,top,right,bottom){_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'onLayout',this).call(this,changed,left,top,right,bottom);if(this.mDeferScroll>=0){var curs=this.mDeferScroll;this.mDeferScroll=-1;this.bringPointIntoView(Math.min(curs,this.mText.length));}}},{key:'isShowingHint',value:function isShowingHint(){return TextUtils.isEmpty(this.mText)&&!TextUtils.isEmpty(this.mHint);}},{key:'bringTextIntoView',value:function bringTextIntoView(){var layout=this.isShowingHint()?this.mHintLayout:this.mLayout;var line=0;if((this.mGravity&Gravity.VERTICAL_GRAVITY_MASK)==Gravity.BOTTOM){line=layout.getLineCount()-1;}var a=layout.getParagraphAlignment(line);var dir=layout.getParagraphDirection(line);var hspace=this.mRight-this.mLeft-this.getCompoundPaddingLeft()-this.getCompoundPaddingRight();var vspace=this.mBottom-this.mTop-this.getExtendedPaddingTop()-this.getExtendedPaddingBottom();var ht=layout.getHeight();var scrollx=void 0,scrolly=void 0;if(a==Layout.Alignment.ALIGN_NORMAL){a=dir==Layout.DIR_LEFT_TO_RIGHT?Layout.Alignment.ALIGN_LEFT:Layout.Alignment.ALIGN_RIGHT;}else if(a==Layout.Alignment.ALIGN_OPPOSITE){a=dir==Layout.DIR_LEFT_TO_RIGHT?Layout.Alignment.ALIGN_RIGHT:Layout.Alignment.ALIGN_LEFT;}if(a==Layout.Alignment.ALIGN_CENTER){var left=Math.floor(Math.floor(layout.getLineLeft(line)));var right=Math.floor(Math.ceil(layout.getLineRight(line)));if(right-left<hspace){scrollx=(right+left)/2-hspace/2;}else{if(dir<0){scrollx=right-hspace;}else{scrollx=left;}}}else if(a==Layout.Alignment.ALIGN_RIGHT){var _right=Math.floor(Math.ceil(layout.getLineRight(line)));scrollx=_right-hspace;}else{scrollx=Math.floor(Math.floor(layout.getLineLeft(line)));}if(ht<vspace){scrolly=0;}else{if((this.mGravity&Gravity.VERTICAL_GRAVITY_MASK)==Gravity.BOTTOM){scrolly=ht-vspace;}else{scrolly=0;}}if(scrollx!=this.mScrollX||scrolly!=this.mScrollY){this.scrollTo(scrollx,scrolly);return true;}else{return false;}}},{key:'bringPointIntoView',value:function bringPointIntoView(offset){if(this.isLayoutRequested()){this.mDeferScroll=offset;return false;}var changed=false;var layout=this.isShowingHint()?this.mHintLayout:this.mLayout;if(layout==null)return changed;var line=layout.getLineForOffset(offset);var grav=void 0;switch(layout.getParagraphAlignment(line)){case Layout.Alignment.ALIGN_LEFT:grav=1;break;case Layout.Alignment.ALIGN_RIGHT:grav=-1;break;case Layout.Alignment.ALIGN_NORMAL:grav=layout.getParagraphDirection(line);break;case Layout.Alignment.ALIGN_OPPOSITE:grav=-layout.getParagraphDirection(line);break;case Layout.Alignment.ALIGN_CENTER:default:grav=0;break;}var clamped=grav>0;var x=Math.floor(layout.getPrimaryHorizontal(offset,clamped));var top=layout.getLineTop(line);var bottom=layout.getLineTop(line+1);var left=Math.floor(Math.floor(layout.getLineLeft(line)));var right=Math.floor(Math.ceil(layout.getLineRight(line)));var ht=layout.getHeight();var hspace=this.mRight-this.mLeft-this.getCompoundPaddingLeft()-this.getCompoundPaddingRight();var vspace=this.mBottom-this.mTop-this.getExtendedPaddingTop()-this.getExtendedPaddingBottom();if(!this.mHorizontallyScrolling&&right-left>hspace&&right>x){right=Math.max(x,left+hspace);}var hslack=(bottom-top)/2;var vslack=hslack;if(vslack>vspace/4)vslack=vspace/4;if(hslack>hspace/4)hslack=hspace/4;var hs=this.mScrollX;var vs=this.mScrollY;if(top-vs<vslack)vs=top-vslack;if(bottom-vs>vspace-vslack)vs=bottom-(vspace-vslack);if(ht-vs<vspace)vs=ht-vspace;if(0-vs>0)vs=0;if(grav!=0){if(x-hs<hslack){hs=x-hslack;}if(x-hs>hspace-hslack){hs=x-(hspace-hslack);}}if(grav<0){if(left-hs>0)hs=left;if(right-hs<hspace)hs=right-hspace;}else if(grav>0){if(right-hs<hspace)hs=right-hspace;if(left-hs>0)hs=left;}else{if(right-left<=hspace){hs=left-(hspace-(right-left))/2;}else if(x>right-hslack){hs=right-hspace;}else if(x<left+hslack){hs=left;}else if(left>hs){hs=left;}else if(right<hs+hspace){hs=right-hspace;}else{if(x-hs<hslack){hs=x-hslack;}if(x-hs>hspace-hslack){hs=x-(hspace-hslack);}}}if(hs!=this.mScrollX||vs!=this.mScrollY){if(this.mScroller==null){this.scrollTo(hs,vs);}else{var duration=AnimationUtils.currentAnimationTimeMillis()-this.mLastScroll;var _dx4=hs-this.mScrollX;var _dy=vs-this.mScrollY;if(duration>TextView.ANIMATED_SCROLL_GAP){this.mScroller.startScroll(this.mScrollX,this.mScrollY,_dx4,_dy);this.awakenScrollBars(this.mScroller.getDuration());this.invalidate();}else{if(!this.mScroller.isFinished()){this.mScroller.abortAnimation();}this.scrollBy(_dx4,_dy);}this.mLastScroll=AnimationUtils.currentAnimationTimeMillis();}changed=true;}if(this.isFocused()){if(this.mTempRect==null)this.mTempRect=new Rect();this.mTempRect.set(x-2,top,x+2,bottom);this.getInterestingRect(this.mTempRect,line);this.mTempRect.offset(this.mScrollX,this.mScrollY);}return changed;}},{key:'moveCursorToVisibleOffset',value:function moveCursorToVisibleOffset(){return false;}},{key:'computeScroll',value:function computeScroll(){if(this.mScroller!=null){if(this.mScroller.computeScrollOffset()){this.mScrollX=this.mScroller.getCurrX();this.mScrollY=this.mScroller.getCurrY();this.invalidateParentCaches();this.postInvalidate();}}}},{key:'getInterestingRect',value:function getInterestingRect(r,line){this.convertFromViewportToContentCoordinates(r);if(line==0)r.top-=this.getExtendedPaddingTop();if(line==this.mLayout.getLineCount()-1)r.bottom+=this.getExtendedPaddingBottom();}},{key:'convertFromViewportToContentCoordinates',value:function convertFromViewportToContentCoordinates(r){var horizontalOffset=this.viewportToContentHorizontalOffset();r.left+=horizontalOffset;r.right+=horizontalOffset;var verticalOffset=this.viewportToContentVerticalOffset();r.top+=verticalOffset;r.bottom+=verticalOffset;}},{key:'viewportToContentHorizontalOffset',value:function viewportToContentHorizontalOffset(){return this.getCompoundPaddingLeft()-this.mScrollX;}},{key:'viewportToContentVerticalOffset',value:function viewportToContentVerticalOffset(){var offset=this.getExtendedPaddingTop()-this.mScrollY;if((this.mGravity&Gravity.VERTICAL_GRAVITY_MASK)!=Gravity.TOP){offset+=this.getVerticalOffset(false);}return offset;}},{key:'getSelectionStart',value:function getSelectionStart(){return-1;}},{key:'getSelectionEnd',value:function getSelectionEnd(){return-1;}},{key:'hasSelection',value:function hasSelection(){var selectionStart=this.getSelectionStart();var selectionEnd=this.getSelectionEnd();return selectionStart>=0&&selectionStart!=selectionEnd;}},{key:'setAllCaps',value:function setAllCaps(allCaps){if(allCaps){this.setTransformationMethod(new AllCapsTransformationMethod());}else{this.setTransformationMethod(null);}}},{key:'setSingleLine',value:function setSingleLine(){var singleLine=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(this.mSingleLine==singleLine)return;this.setInputTypeSingleLine(singleLine);this.applySingleLine(singleLine,true,true);}},{key:'setInputTypeSingleLine',value:function setInputTypeSingleLine(singleLine){}},{key:'applySingleLine',value:function applySingleLine(singleLine,applyTransformation,changeMaxLines){this.mSingleLine=singleLine;if(singleLine){this.setLines(1);this.setHorizontallyScrolling(true);if(applyTransformation){this.setTransformationMethod(SingleLineTransformationMethod.getInstance());}}else{if(changeMaxLines){this.setMaxLines(Integer.MAX_VALUE);}this.setHorizontallyScrolling(false);if(applyTransformation){this.setTransformationMethod(null);}}}},{key:'setEllipsize',value:function setEllipsize(where){if(this.mEllipsize!=where){this.mEllipsize=where;if(this.mLayout!=null){this.nullLayouts();this.requestLayout();this.invalidate();}}}},{key:'setMarqueeRepeatLimit',value:function setMarqueeRepeatLimit(marqueeLimit){this.mMarqueeRepeatLimit=marqueeLimit;}},{key:'getMarqueeRepeatLimit',value:function getMarqueeRepeatLimit(){return this.mMarqueeRepeatLimit;}},{key:'getEllipsize',value:function getEllipsize(){return this.mEllipsize;}},{key:'setSelectAllOnFocus',value:function setSelectAllOnFocus(selectAllOnFocus){this.createEditorIfNeeded();this.mEditor.mSelectAllOnFocus=selectAllOnFocus;if(selectAllOnFocus&&!Spannable.isImpl(this.mText)){this.setText(this.mText,TextView.BufferType.SPANNABLE);}}},{key:'setCursorVisible',value:function setCursorVisible(visible){}},{key:'isCursorVisible',value:function isCursorVisible(){return null;}},{key:'canMarquee',value:function canMarquee(){var width=this.mRight-this.mLeft-this.getCompoundPaddingLeft()-this.getCompoundPaddingRight();return width>0&&(this.mLayout.getLineWidth(0)>width||this.mMarqueeFadeMode!=TextView.MARQUEE_FADE_NORMAL&&this.mSavedMarqueeModeLayout!=null&&this.mSavedMarqueeModeLayout.getLineWidth(0)>width);}},{key:'startMarquee',value:function startMarquee(){if(this.getKeyListener()!=null)return;if(this.compressText(this.getWidth()-this.getCompoundPaddingLeft()-this.getCompoundPaddingRight())){return;}if((this.mMarquee==null||this.mMarquee.isStopped())&&(this.isFocused()||this.isSelected())&&this.getLineCount()==1&&this.canMarquee()){if(this.mMarqueeFadeMode==TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS){this.mMarqueeFadeMode=TextView.MARQUEE_FADE_SWITCH_SHOW_FADE;var tmp=this.mLayout;this.mLayout=this.mSavedMarqueeModeLayout;this.mSavedMarqueeModeLayout=tmp;this.setHorizontalFadingEdgeEnabled(true);this.requestLayout();this.invalidate();}if(this.mMarquee==null)this.mMarquee=new TextView.Marquee(this);this.mMarquee.start(this.mMarqueeRepeatLimit);}}},{key:'stopMarquee',value:function stopMarquee(){if(this.mMarquee!=null&&!this.mMarquee.isStopped()){this.mMarquee.stop();}if(this.mMarqueeFadeMode==TextView.MARQUEE_FADE_SWITCH_SHOW_FADE){this.mMarqueeFadeMode=TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS;var tmp=this.mSavedMarqueeModeLayout;this.mSavedMarqueeModeLayout=this.mLayout;this.mLayout=tmp;this.setHorizontalFadingEdgeEnabled(false);this.requestLayout();this.invalidate();}}},{key:'startStopMarquee',value:function startStopMarquee(start){if(this.mEllipsize==TextUtils.TruncateAt.MARQUEE){if(start){this.startMarquee();}else{this.stopMarquee();}}}},{key:'onTextChanged',value:function onTextChanged(text,start,lengthBefore,lengthAfter){}},{key:'onSelectionChanged',value:function onSelectionChanged(selStart,selEnd){}},{key:'addTextChangedListener',value:function addTextChangedListener(watcher){if(this.mListeners==null){this.mListeners=new ArrayList();}this.mListeners.add(watcher);}},{key:'removeTextChangedListener',value:function removeTextChangedListener(watcher){if(this.mListeners!=null){var i=this.mListeners.indexOf(watcher);if(i>=0){this.mListeners.remove(i);}}}},{key:'sendBeforeTextChanged',value:function sendBeforeTextChanged(text,start,before,after){if(this.mListeners!=null){var list=this.mListeners;var count=list.size();for(var i=0;i<count;i++){list.get(i).beforeTextChanged(text,start,before,after);}}}},{key:'removeAdjacentSuggestionSpans',value:function removeAdjacentSuggestionSpans(pos){}},{key:'sendOnTextChanged',value:function sendOnTextChanged(text,start,before,after){if(this.mListeners!=null){var list=this.mListeners;var count=list.size();for(var i=0;i<count;i++){list.get(i).onTextChanged(text,start,before,after);}}}},{key:'sendAfterTextChanged',value:function sendAfterTextChanged(text){if(this.mListeners!=null){var list=this.mListeners;var count=list.size();for(var i=0;i<count;i++){list.get(i).afterTextChanged(text+'');}}}},{key:'updateAfterEdit',value:function updateAfterEdit(){this.invalidate();var curs=this.getSelectionStart();if(curs>=0||(this.mGravity&Gravity.VERTICAL_GRAVITY_MASK)==Gravity.BOTTOM){this.registerForPreDraw();}this.checkForResize();if(curs>=0){this.mHighlightPathBogus=true;this.bringPointIntoView(curs);}}},{key:'handleTextChanged',value:function handleTextChanged(buffer,start,before,after){this.updateAfterEdit();this.sendOnTextChanged(buffer,start,before,after);this.onTextChanged(buffer,start,before,after);}},{key:'spanChange',value:function spanChange(buf,what,oldStart,newStart,oldEnd,newEnd){var selChanged=false;var newSelStart=-1,newSelEnd=-1;this.invalidate();this.mHighlightPathBogus=true;this.checkForResize();}},{key:'dispatchFinishTemporaryDetach',value:function dispatchFinishTemporaryDetach(){this.mDispatchTemporaryDetach=true;_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'dispatchFinishTemporaryDetach',this).call(this);this.mDispatchTemporaryDetach=false;}},{key:'onStartTemporaryDetach',value:function onStartTemporaryDetach(){_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'onStartTemporaryDetach',this).call(this);if(!this.mDispatchTemporaryDetach)this.mTemporaryDetach=true;}},{key:'onFinishTemporaryDetach',value:function onFinishTemporaryDetach(){_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'onFinishTemporaryDetach',this).call(this);if(!this.mDispatchTemporaryDetach)this.mTemporaryDetach=false;}},{key:'onFocusChanged',value:function onFocusChanged(focused,direction,previouslyFocusedRect){if(this.mTemporaryDetach){_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'onFocusChanged',this).call(this,focused,direction,previouslyFocusedRect);return;}this.startStopMarquee(focused);if(this.mTransformation!=null){this.mTransformation.onFocusChanged(this,this.mText,focused,direction,previouslyFocusedRect);}_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'onFocusChanged',this).call(this,focused,direction,previouslyFocusedRect);}},{key:'onWindowFocusChanged',value:function onWindowFocusChanged(hasWindowFocus){_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'onWindowFocusChanged',this).call(this,hasWindowFocus);this.startStopMarquee(hasWindowFocus);}},{key:'onVisibilityChanged',value:function onVisibilityChanged(changedView,visibility){_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'onVisibilityChanged',this).call(this,changedView,visibility);}},{key:'clearComposingText',value:function clearComposingText(){}},{key:'setSelected',value:function setSelected(selected){var wasSelected=this.isSelected();_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'setSelected',this).call(this,selected);if(selected!=wasSelected&&this.mEllipsize==TextUtils.TruncateAt.MARQUEE){if(selected){this.startMarquee();}else{this.stopMarquee();}}}},{key:'onTouchEvent',value:function onTouchEvent(event){var action=event.getActionMasked();var superResult=_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'onTouchEvent',this).call(this,event);var touchIsFinished=action==MotionEvent.ACTION_UP&&this.isFocused();if((this.mMovement!=null||this.onCheckIsTextEditor())&&this.isEnabled()&&Spannable.isImpl(this.mText)&&this.mLayout!=null){var handled=false;if(this.mMovement!=null){handled=this.mMovement.onTouchEvent(this,this.mText,event)||handled;}if(handled){return true;}}return superResult;}},{key:'onGenericMotionEvent',value:function onGenericMotionEvent(event){if(this.mMovement!=null&&Spannable.isImpl(this.mText)&&this.mLayout!=null){try{if(this.mMovement.onGenericMotionEvent(this,this.mText,event)){return true;}}catch(e){}}return _get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'onGenericMotionEvent',this).call(this,event);}},{key:'isTextEditable',value:function isTextEditable(){return false;}},{key:'didTouchFocusSelect',value:function didTouchFocusSelect(){return false;}},{key:'cancelLongPress',value:function cancelLongPress(){_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'cancelLongPress',this).call(this);}},{key:'setScroller',value:function setScroller(s){this.mScroller=s;}},{key:'getLeftFadingEdgeStrength',value:function getLeftFadingEdgeStrength(){if(this.mEllipsize==TextUtils.TruncateAt.MARQUEE&&this.mMarqueeFadeMode!=TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS){if(this.mMarquee!=null&&!this.mMarquee.isStopped()){var marquee=this.mMarquee;if(marquee.shouldDrawLeftFade()){var scroll=marquee.getScroll();return scroll/this.getHorizontalFadingEdgeLength();}else{return 0.0;}}else if(this.getLineCount()==1){var absoluteGravity=this.mGravity;switch(absoluteGravity&Gravity.HORIZONTAL_GRAVITY_MASK){case Gravity.LEFT:return 0.0;case Gravity.RIGHT:return(this.mLayout.getLineRight(0)-(this.mRight-this.mLeft)-this.getCompoundPaddingLeft()-this.getCompoundPaddingRight()-this.mLayout.getLineLeft(0))/this.getHorizontalFadingEdgeLength();case Gravity.CENTER_HORIZONTAL:case Gravity.FILL_HORIZONTAL:var textDirection=this.mLayout.getParagraphDirection(0);if(textDirection==Layout.DIR_LEFT_TO_RIGHT){return 0.0;}else{return(this.mLayout.getLineRight(0)-(this.mRight-this.mLeft)-this.getCompoundPaddingLeft()-this.getCompoundPaddingRight()-this.mLayout.getLineLeft(0))/this.getHorizontalFadingEdgeLength();}}}}return _get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'getLeftFadingEdgeStrength',this).call(this);}},{key:'getRightFadingEdgeStrength',value:function getRightFadingEdgeStrength(){if(this.mEllipsize==TextUtils.TruncateAt.MARQUEE&&this.mMarqueeFadeMode!=TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS){if(this.mMarquee!=null&&!this.mMarquee.isStopped()){var marquee=this.mMarquee;var maxFadeScroll=marquee.getMaxFadeScroll();var scroll=marquee.getScroll();return(maxFadeScroll-scroll)/this.getHorizontalFadingEdgeLength();}else if(this.getLineCount()==1){var absoluteGravity=this.mGravity;switch(absoluteGravity&Gravity.HORIZONTAL_GRAVITY_MASK){case Gravity.LEFT:var textWidth=this.mRight-this.mLeft-this.getCompoundPaddingLeft()-this.getCompoundPaddingRight();var lineWidth=this.mLayout.getLineWidth(0);return(lineWidth-textWidth)/this.getHorizontalFadingEdgeLength();case Gravity.RIGHT:return 0.0;case Gravity.CENTER_HORIZONTAL:case Gravity.FILL_HORIZONTAL:var textDirection=this.mLayout.getParagraphDirection(0);if(textDirection==Layout.DIR_RIGHT_TO_LEFT){return 0.0;}else{return(this.mLayout.getLineWidth(0)-(this.mRight-this.mLeft-this.getCompoundPaddingLeft()-this.getCompoundPaddingRight()))/this.getHorizontalFadingEdgeLength();}}}}return _get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'getRightFadingEdgeStrength',this).call(this);}},{key:'computeHorizontalScrollRange',value:function computeHorizontalScrollRange(){if(this.mLayout!=null){return this.mSingleLine&&(this.mGravity&Gravity.HORIZONTAL_GRAVITY_MASK)==Gravity.LEFT?Math.floor(this.mLayout.getLineWidth(0)):this.mLayout.getWidth();}return _get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'computeHorizontalScrollRange',this).call(this);}},{key:'computeVerticalScrollRange',value:function computeVerticalScrollRange(){if(this.mLayout!=null)return this.mLayout.getHeight();return _get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'computeVerticalScrollRange',this).call(this);}},{key:'computeVerticalScrollExtent',value:function computeVerticalScrollExtent(){return this.getHeight()-this.getCompoundPaddingTop()-this.getCompoundPaddingBottom();}},{key:'canSelectText',value:function canSelectText(){return false;}},{key:'textCanBeSelected',value:function textCanBeSelected(){return false;}},{key:'getTransformedText',value:function getTransformedText(start,end){return this.removeSuggestionSpans(this.mTransformed.substring(start,end));}},{key:'performLongClick',value:function performLongClick(){var handled=false;if(_get2(TextView.prototype.__proto__||Object.getPrototypeOf(TextView.prototype),'performLongClick',this).call(this)){handled=true;}if(handled){this.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);}return handled;}},{key:'isSuggestionsEnabled',value:function isSuggestionsEnabled(){return false;}},{key:'setCustomSelectionActionModeCallback',value:function setCustomSelectionActionModeCallback(actionModeCallback){this.createEditorIfNeeded();}},{key:'getCustomSelectionActionModeCallback',value:function getCustomSelectionActionModeCallback(){return null;}},{key:'stopSelectionActionMode',value:function stopSelectionActionMode(){}},{key:'canCut',value:function canCut(){return false;}},{key:'canCopy',value:function canCopy(){return true;}},{key:'canPaste',value:function canPaste(){return false;}},{key:'selectAllText',value:function selectAllText(){return false;}},{key:'getOffsetForPosition',value:function getOffsetForPosition(x,y){if(this.getLayout()==null)return-1;var line=this.getLineAtCoordinate(y);var offset=this.getOffsetAtCoordinate(line,x);return offset;}},{key:'convertToLocalHorizontalCoordinate',value:function convertToLocalHorizontalCoordinate(x){x-=this.getTotalPaddingLeft();x=Math.max(0.0,x);x=Math.min(this.getWidth()-this.getTotalPaddingRight()-1,x);x+=this.getScrollX();return x;}},{key:'getLineAtCoordinate',value:function getLineAtCoordinate(y){y-=this.getTotalPaddingTop();y=Math.max(0.0,y);y=Math.min(this.getHeight()-this.getTotalPaddingBottom()-1,y);y+=this.getScrollY();return this.getLayout().getLineForVertical(Math.floor(y));}},{key:'getOffsetAtCoordinate',value:function getOffsetAtCoordinate(line,x){x=this.convertToLocalHorizontalCoordinate(x);return this.getLayout().getOffsetForHorizontal(line,x);}},{key:'isInBatchEditMode',value:function isInBatchEditMode(){return false;}},{key:'getTextDirectionHeuristic',value:function getTextDirectionHeuristic(){return TextDirectionHeuristics.LTR;}},{key:'onResolveDrawables',value:function onResolveDrawables(layoutDirection){if(this.mLastLayoutDirection==layoutDirection){return;}this.mLastLayoutDirection=layoutDirection;if(this.mDrawables!=null){this.mDrawables.resolveWithLayoutDirection(layoutDirection);}}},{key:'resetResolvedDrawables',value:function resetResolvedDrawables(){this.mLastLayoutDirection=-1;}},{key:'deleteText_internal',value:function deleteText_internal(start,end){}},{key:'replaceText_internal',value:function replaceText_internal(start,end,text){}},{key:'setSpan_internal',value:function setSpan_internal(span,start,end,flags){}},{key:'setCursorPosition_internal',value:function setCursorPosition_internal(start,end){}},{key:'createEditorIfNeeded',value:function createEditorIfNeeded(){}}],[{key:'isMultilineInputType',value:function isMultilineInputType(type){return true;}},{key:'isPasswordInputType',value:function isPasswordInputType(inputType){return false;}},{key:'isVisiblePasswordInputType',value:function isVisiblePasswordInputType(inputType){return true;}},{key:'desired',value:function desired(layout){var n=layout.getLineCount();var text=layout.getText();var max=0;for(var i=0;i<n-1;i++){if(text.charAt(layout.getLineEnd(i)-1)!='\\n')return-1;}for(var _i35=0;_i35<n;_i35++){max=Math.max(max,layout.getLineWidth(_i35));}return Math.floor(Math.ceil(max));}},{key:'getTextColors',value:function getTextColors(){return android.R.color.textView_textColor;}},{key:'getTextColor',value:function getTextColor(def){var colors=this.getTextColors();if(colors==null){return def;}else{return colors.getDefaultColor();}}}]);return TextView;}(View);TextView.LOG_TAG=\"TextView\";TextView.DEBUG_EXTRACT=false;TextView.SANS=1;TextView.SERIF=2;TextView.MONOSPACE=3;TextView.SIGNED=2;TextView.DECIMAL=4;TextView.MARQUEE_FADE_NORMAL=0;TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS=1;TextView.MARQUEE_FADE_SWITCH_SHOW_FADE=2;TextView.LINES=1;TextView.EMS=TextView.LINES;TextView.PIXELS=2;TextView.TEMP_RECTF=new RectF();TextView.VERY_WIDE=1024*1024;TextView.ANIMATED_SCROLL_GAP=250;TextView.NO_FILTERS=new Array(0);TextView.CHANGE_WATCHER_PRIORITY=100;TextView.MULTILINE_STATE_SET=[View.VIEW_STATE_MULTILINE];TextView.LAST_CUT_OR_COPY_TIME=0;TextView.UNKNOWN_BORING=new BoringLayout.Metrics();widget.TextView=TextView;(function(TextView){var Drawables=function(){function Drawables(context){_classCallCheck(this,Drawables);this.mCompoundRect=new Rect();this.mDrawableSizeTop=0;this.mDrawableSizeBottom=0;this.mDrawableSizeLeft=0;this.mDrawableSizeRight=0;this.mDrawableSizeStart=0;this.mDrawableSizeEnd=0;this.mDrawableSizeError=0;this.mDrawableSizeTemp=0;this.mDrawableWidthTop=0;this.mDrawableWidthBottom=0;this.mDrawableHeightLeft=0;this.mDrawableHeightRight=0;this.mDrawableHeightStart=0;this.mDrawableHeightEnd=0;this.mDrawableHeightError=0;this.mDrawableHeightTemp=0;this.mDrawablePadding=0;this.mDrawableSaved=Drawables.DRAWABLE_NONE;this.mIsRtlCompatibilityMode=false;this.mOverride=false;}_createClass(Drawables,[{key:'resolveWithLayoutDirection',value:function resolveWithLayoutDirection(layoutDirection){this.mDrawableLeft=this.mDrawableLeftInitial;this.mDrawableRight=this.mDrawableRightInitial;if(this.mOverride){this.mDrawableLeft=this.mDrawableStart;this.mDrawableSizeLeft=this.mDrawableSizeStart;this.mDrawableHeightLeft=this.mDrawableHeightStart;this.mDrawableRight=this.mDrawableEnd;this.mDrawableSizeRight=this.mDrawableSizeEnd;this.mDrawableHeightRight=this.mDrawableHeightEnd;}this.applyErrorDrawableIfNeeded(layoutDirection);this.updateDrawablesLayoutDirection(layoutDirection);}},{key:'updateDrawablesLayoutDirection',value:function updateDrawablesLayoutDirection(layoutDirection){}},{key:'setErrorDrawable',value:function setErrorDrawable(dr,tv){if(this.mDrawableError!=dr&&this.mDrawableError!=null){this.mDrawableError.setCallback(null);}this.mDrawableError=dr;var compoundRect=this.mCompoundRect;var state=tv.getDrawableState();if(this.mDrawableError!=null){this.mDrawableError.setState(state);this.mDrawableError.copyBounds(compoundRect);this.mDrawableError.setCallback(tv);this.mDrawableSizeError=compoundRect.width();this.mDrawableHeightError=compoundRect.height();}else{this.mDrawableSizeError=this.mDrawableHeightError=0;}}},{key:'applyErrorDrawableIfNeeded',value:function applyErrorDrawableIfNeeded(layoutDirection){switch(this.mDrawableSaved){case Drawables.DRAWABLE_LEFT:this.mDrawableLeft=this.mDrawableTemp;this.mDrawableSizeLeft=this.mDrawableSizeTemp;this.mDrawableHeightLeft=this.mDrawableHeightTemp;break;case Drawables.DRAWABLE_RIGHT:this.mDrawableRight=this.mDrawableTemp;this.mDrawableSizeRight=this.mDrawableSizeTemp;this.mDrawableHeightRight=this.mDrawableHeightTemp;break;case Drawables.DRAWABLE_NONE:default:}this.mDrawableSaved=Drawables.DRAWABLE_RIGHT;this.mDrawableTemp=this.mDrawableRight;this.mDrawableSizeTemp=this.mDrawableSizeRight;this.mDrawableHeightTemp=this.mDrawableHeightRight;this.mDrawableRight=this.mDrawableError;this.mDrawableSizeRight=this.mDrawableSizeError;this.mDrawableHeightRight=this.mDrawableHeightError;}}]);return Drawables;}();Drawables.DRAWABLE_NONE=-1;Drawables.DRAWABLE_RIGHT=0;Drawables.DRAWABLE_LEFT=1;TextView.Drawables=Drawables;var Marquee=function(_Handler3){_inherits(Marquee,_Handler3);function Marquee(v){_classCallCheck(this,Marquee);var _this100=_possibleConstructorReturn(this,(Marquee.__proto__||Object.getPrototypeOf(Marquee)).call(this));_this100.mStatus=Marquee.MARQUEE_STOPPED;_this100.mScrollUnit=0;_this100.mMaxScroll=0;_this100.mMaxFadeScroll=0;_this100.mGhostStart=0;_this100.mGhostOffset=0;_this100.mFadeStop=0;_this100.mRepeatLimit=0;_this100.mScroll=0;var density=v.getResources().getDisplayMetrics().density;_this100.mScrollUnit=Marquee.MARQUEE_PIXELS_PER_SECOND*density/Marquee.MARQUEE_RESOLUTION;_this100.mView=new WeakReference(v);return _this100;}_createClass(Marquee,[{key:'handleMessage',value:function handleMessage(msg){switch(msg.what){case Marquee.MESSAGE_START:this.mStatus=Marquee.MARQUEE_RUNNING;this.tick();break;case Marquee.MESSAGE_TICK:this.tick();break;case Marquee.MESSAGE_RESTART:if(this.mStatus==Marquee.MARQUEE_RUNNING){if(this.mRepeatLimit>=0){this.mRepeatLimit--;}this.start(this.mRepeatLimit);}break;}}},{key:'tick',value:function tick(){if(this.mStatus!=Marquee.MARQUEE_RUNNING){return;}this.removeMessages(Marquee.MESSAGE_TICK);var textView=this.mView.get();if(textView!=null&&(textView.isFocused()||textView.isSelected())){this.mScroll+=this.mScrollUnit;if(this.mScroll>this.mMaxScroll){this.mScroll=this.mMaxScroll;this.sendEmptyMessageDelayed(Marquee.MESSAGE_RESTART,Marquee.MARQUEE_RESTART_DELAY);}else{this.sendEmptyMessageDelayed(Marquee.MESSAGE_TICK,Marquee.MARQUEE_RESOLUTION);}textView.invalidate();}}},{key:'stop',value:function stop(){this.mStatus=Marquee.MARQUEE_STOPPED;this.removeMessages(Marquee.MESSAGE_START);this.removeMessages(Marquee.MESSAGE_RESTART);this.removeMessages(Marquee.MESSAGE_TICK);this.resetScroll();}},{key:'resetScroll',value:function resetScroll(){this.mScroll=0.0;var textView=this.mView.get();if(textView!=null)textView.invalidate();}},{key:'start',value:function start(repeatLimit){if(repeatLimit==0){this.stop();return;}this.mRepeatLimit=repeatLimit;var textView=this.mView.get();if(textView!=null&&textView.mLayout!=null){this.mStatus=Marquee.MARQUEE_STARTING;this.mScroll=0.0;var textWidth=textView.getWidth()-textView.getCompoundPaddingLeft()-textView.getCompoundPaddingRight();var lineWidth=textView.mLayout.getLineWidth(0);var gap=textWidth/3.0;this.mGhostStart=lineWidth-textWidth+gap;this.mMaxScroll=this.mGhostStart+textWidth;this.mGhostOffset=lineWidth+gap;this.mFadeStop=lineWidth+textWidth/6.0;this.mMaxFadeScroll=this.mGhostStart+lineWidth+lineWidth;textView.invalidate();this.sendEmptyMessageDelayed(Marquee.MESSAGE_START,Marquee.MARQUEE_DELAY);}}},{key:'getGhostOffset',value:function getGhostOffset(){return this.mGhostOffset;}},{key:'getScroll',value:function getScroll(){return this.mScroll;}},{key:'getMaxFadeScroll',value:function getMaxFadeScroll(){return this.mMaxFadeScroll;}},{key:'shouldDrawLeftFade',value:function shouldDrawLeftFade(){return this.mScroll<=this.mFadeStop;}},{key:'shouldDrawGhost',value:function shouldDrawGhost(){return this.mStatus==Marquee.MARQUEE_RUNNING&&this.mScroll>this.mGhostStart;}},{key:'isRunning',value:function isRunning(){return this.mStatus==Marquee.MARQUEE_RUNNING;}},{key:'isStopped',value:function isStopped(){return this.mStatus==Marquee.MARQUEE_STOPPED;}}]);return Marquee;}(Handler);Marquee.MARQUEE_DELTA_MAX=0.07;Marquee.MARQUEE_DELAY=1200;Marquee.MARQUEE_RESTART_DELAY=1200;Marquee.MARQUEE_RESOLUTION=1000/30;Marquee.MARQUEE_PIXELS_PER_SECOND=30;Marquee.MARQUEE_STOPPED=0x0;Marquee.MARQUEE_STARTING=0x1;Marquee.MARQUEE_RUNNING=0x2;Marquee.MESSAGE_START=0x1;Marquee.MESSAGE_TICK=0x2;Marquee.MESSAGE_RESTART=0x3;TextView.Marquee=Marquee;var ChangeWatcher=function(){function ChangeWatcher(arg){_classCallCheck(this,ChangeWatcher);this._TextView_this=arg;}_createClass(ChangeWatcher,[{key:'beforeTextChanged',value:function beforeTextChanged(buffer,start,before,after){if(TextView.DEBUG_EXTRACT)Log.v(TextView.LOG_TAG,\"beforeTextChanged start=\"+start+\" before=\"+before+\" after=\"+after+\": \"+buffer);this._TextView_this.sendBeforeTextChanged(buffer,start,before,after);}},{key:'onTextChanged',value:function onTextChanged(buffer,start,before,after){if(TextView.DEBUG_EXTRACT)Log.v(TextView.LOG_TAG,\"onTextChanged start=\"+start+\" before=\"+before+\" after=\"+after+\": \"+buffer);this._TextView_this.handleTextChanged(buffer,start,before,after);}},{key:'afterTextChanged',value:function afterTextChanged(buffer){if(TextView.DEBUG_EXTRACT)Log.v(TextView.LOG_TAG,\"afterTextChanged: \"+buffer);this._TextView_this.sendAfterTextChanged(buffer);}},{key:'onSpanChanged',value:function onSpanChanged(buf,what,s,e,st,en){if(TextView.DEBUG_EXTRACT)Log.v(TextView.LOG_TAG,\"onSpanChanged s=\"+s+\" e=\"+e+\" st=\"+st+\" en=\"+en+\" what=\"+what+\": \"+buf);this._TextView_this.spanChange(buf,what,s,st,e,en);}},{key:'onSpanAdded',value:function onSpanAdded(buf,what,s,e){if(TextView.DEBUG_EXTRACT)Log.v(TextView.LOG_TAG,\"onSpanAdded s=\"+s+\" e=\"+e+\" what=\"+what+\": \"+buf);this._TextView_this.spanChange(buf,what,-1,s,-1,e);}},{key:'onSpanRemoved',value:function onSpanRemoved(buf,what,s,e){if(TextView.DEBUG_EXTRACT)Log.v(TextView.LOG_TAG,\"onSpanRemoved s=\"+s+\" e=\"+e+\" what=\"+what+\": \"+buf);this._TextView_this.spanChange(buf,what,s,-1,e,-1);}}]);return ChangeWatcher;}();TextView.ChangeWatcher=ChangeWatcher;var BufferType;(function(BufferType){BufferType[BufferType[\"NORMAL\"]=0]=\"NORMAL\";BufferType[BufferType[\"SPANNABLE\"]=1]=\"SPANNABLE\";BufferType[BufferType[\"EDITABLE\"]=2]=\"EDITABLE\";})(BufferType=TextView.BufferType||(TextView.BufferType={}));})(TextView=widget.TextView||(widget.TextView={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var Button=function(_widget$TextView){_inherits(Button,_widget$TextView);function Button(context,bindElement){var defStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.R.attr.buttonStyle;_classCallCheck(this,Button);return _possibleConstructorReturn(this,(Button.__proto__||Object.getPrototypeOf(Button)).call(this,context,bindElement,defStyle));}return Button;}(widget.TextView);widget.Button=Button;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var ListAdapter;(function(ListAdapter){function isImpl(obj){return obj&&obj['areAllItemsEnabled']&&obj['isEnabled'];}ListAdapter.isImpl=isImpl;})(ListAdapter=widget.ListAdapter||(widget.ListAdapter={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var Rect=android.graphics.Rect;var Log=android.util.Log;var LongSparseArray=android.util.LongSparseArray;var SparseArray=android.util.SparseArray;var SparseBooleanArray=android.util.SparseBooleanArray;var StateSet=android.util.StateSet;var HapticFeedbackConstants=android.view.HapticFeedbackConstants;var KeyEvent=android.view.KeyEvent;var MotionEvent=android.view.MotionEvent;var VelocityTracker=android.view.VelocityTracker;var View=android.view.View;var ViewConfiguration=android.view.ViewConfiguration;var ViewGroup=android.view.ViewGroup;var LinearInterpolator=android.view.animation.LinearInterpolator;var ArrayList=java.util.ArrayList;var Integer=java.lang.Integer;var System=java.lang.System;var AdapterView=android.widget.AdapterView;var OverScroller=android.widget.OverScroller;var AbsListView=function(_AdapterView){_inherits(AbsListView,_AdapterView);function AbsListView(context,bindElement,defStyle){_classCallCheck(this,AbsListView);var _this102=_possibleConstructorReturn(this,(AbsListView.__proto__||Object.getPrototypeOf(AbsListView)).call(this,context,bindElement,defStyle));_this102.mChoiceMode=AbsListView.CHOICE_MODE_NONE;_this102.mCheckedItemCount=0;_this102.mDeferNotifyDataSetChanged=false;_this102.mDrawSelectorOnTop=false;_this102.mSelectorPosition=AbsListView.INVALID_POSITION;_this102.mSelectorRect=new Rect();_this102.mRecycler=new AbsListView.RecycleBin(_this102);_this102.mSelectionLeftPadding=0;_this102.mSelectionTopPadding=0;_this102.mSelectionRightPadding=0;_this102.mSelectionBottomPadding=0;_this102.mListPadding=new Rect();_this102.mWidthMeasureSpec=0;_this102.mMotionPosition=0;_this102.mMotionViewOriginalTop=0;_this102.mMotionViewNewTop=0;_this102.mMotionX=0;_this102.mMotionY=0;_this102.mTouchMode=AbsListView.TOUCH_MODE_REST;_this102.mLastY=0;_this102.mMotionCorrection=0;_this102.mSelectedTop=0;_this102.mSmoothScrollbarEnabled=true;_this102.mResurrectToPosition=AbsListView.INVALID_POSITION;_this102.mOverscrollMax=0;_this102.mLastTouchMode=AbsListView.TOUCH_MODE_UNKNOWN;_this102.mScrollProfilingStarted=false;_this102.mFlingProfilingStarted=false;_this102.mTranscriptMode=0;_this102.mCacheColorHint=0;_this102.mLastScrollState=AbsListView.OnScrollListener.SCROLL_STATE_IDLE;_this102.mDensityScale=0;_this102.mMinimumVelocity=0;_this102.mMaximumVelocity=0;_this102.mVelocityScale=1.0;_this102.mIsScrap=new Array(1);_this102.mActivePointerId=AbsListView.INVALID_POINTER;_this102.mOverscrollDistance=0;_this102._mOverflingDistance=0;_this102.mFirstPositionDistanceGuess=0;_this102.mLastPositionDistanceGuess=0;_this102.mDirection=0;_this102.mGlowPaddingLeft=0;_this102.mGlowPaddingRight=0;_this102.mLastHandledItemCount=0;_this102.initAbsListView();var a=context.obtainStyledAttributes(bindElement,defStyle);var d=a.getDrawable('listSelector');if(d!=null){_this102.setSelector(d);}_this102.mDrawSelectorOnTop=a.getBoolean('drawSelectorOnTop',false);var stackFromBottom=a.getBoolean('stackFromBottom',false);_this102.setStackFromBottom(stackFromBottom);var scrollingCacheEnabled=a.getBoolean('scrollingCache',true);_this102.setScrollingCacheEnabled(scrollingCacheEnabled);var useTextFilter=a.getBoolean('textFilterEnabled',false);_this102.setTextFilterEnabled(useTextFilter);var transcriptModeValue=a.getAttrValue('transcriptMode');var transcriptMode=AbsListView.TRANSCRIPT_MODE_DISABLED;if(transcriptModeValue===\"disabled\")transcriptMode=AbsListView.TRANSCRIPT_MODE_DISABLED;else if(transcriptModeValue===\"normal\")transcriptMode=AbsListView.TRANSCRIPT_MODE_NORMAL;else if(transcriptModeValue===\"alwaysScroll\")transcriptMode=AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL;_this102.setTranscriptMode(transcriptMode);var color=a.getColor('cacheColorHint',0);_this102.setCacheColorHint(color);var enableFastScroll=a.getBoolean('fastScrollEnabled',false);_this102.setFastScrollEnabled(enableFastScroll);var smoothScrollbar=a.getBoolean('smoothScrollbar',true);_this102.setSmoothScrollbarEnabled(smoothScrollbar);var choiceModeValue=a.getAttrValue('choiceMode');var choiceMode=AbsListView.CHOICE_MODE_NONE;if(choiceModeValue===\"none\")choiceMode=AbsListView.CHOICE_MODE_NONE;else if(choiceModeValue===\"singleChoice\")choiceMode=AbsListView.CHOICE_MODE_SINGLE;else if(choiceModeValue===\"multipleChoice\")choiceMode=AbsListView.CHOICE_MODE_MULTIPLE;_this102.setChoiceMode(choiceMode);_this102.setFastScrollAlwaysVisible(a.getBoolean('fastScrollAlwaysVisible',false));a.recycle();return _this102;}_createClass(AbsListView,[{key:'initAbsListView',value:function initAbsListView(){this.setClickable(true);this.setFocusableInTouchMode(true);this.setWillNotDraw(false);this.setAlwaysDrawnWithCacheEnabled(false);this.setScrollingCacheEnabled(true);var configuration=ViewConfiguration.get();this.mTouchSlop=configuration.getScaledTouchSlop();this.mMinimumVelocity=configuration.getScaledMinimumFlingVelocity();this.mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();this.mOverscrollDistance=configuration.getScaledOverscrollDistance();this.mOverflingDistance=configuration.getScaledOverflingDistance();this.mDensityScale=android.content.res.Resources.getDisplayMetrics().density;this.mLayoutMode=AbsListView.LAYOUT_NORMAL;}},{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'createClassAttrBinder',this).call(this).set('listSelector',{setter:function setter(v,value,attrBinder){var d=attrBinder.parseDrawable(value);if(d)v.setSelector(d);},getter:function getter(v){return v.getSelector();}}).set('drawSelectorOnTop',{setter:function setter(v,value,attrBinder){v.setDrawSelectorOnTop(attrBinder.parseBoolean(value,false));},getter:function getter(v){return v.mDrawSelectorOnTop;}}).set('stackFromBottom',{setter:function setter(v,value,attrBinder){v.setStackFromBottom(attrBinder.parseBoolean(value,false));},getter:function getter(v){return v.isStackFromBottom();}}).set('scrollingCache',{setter:function setter(v,value,attrBinder){v.setScrollingCacheEnabled(attrBinder.parseBoolean(value,true));},getter:function getter(v){return v.isScrollingCacheEnabled();}}).set('transcriptMode',{setter:function setter(v,value,attrBinder){v.setTranscriptMode(attrBinder.parseEnum(value,new Map().set(\"disabled\",AbsListView.TRANSCRIPT_MODE_DISABLED).set(\"normal\",AbsListView.TRANSCRIPT_MODE_NORMAL).set(\"alwaysScroll\",AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL),AbsListView.TRANSCRIPT_MODE_DISABLED));},getter:function getter(v){return v.getTranscriptMode();}}).set('cacheColorHint',{setter:function setter(v,value,attrBinder){var color=attrBinder.parseColor(value,0);v.setCacheColorHint(color);},getter:function getter(v){return v.getCacheColorHint();}}).set('fastScrollEnabled',{setter:function setter(v,value,attrBinder){var enableFastScroll=attrBinder.parseBoolean(value,false);v.setFastScrollEnabled(enableFastScroll);},getter:function getter(v){return v.isFastScrollEnabled();}}).set('fastScrollAlwaysVisible',{setter:function setter(v,value,attrBinder){var fastScrollAlwaysVisible=attrBinder.parseBoolean(value,false);v.setFastScrollAlwaysVisible(fastScrollAlwaysVisible);},getter:function getter(v){return v.isFastScrollAlwaysVisible();}}).set('smoothScrollbar',{setter:function setter(v,value,attrBinder){var smoothScrollbar=attrBinder.parseBoolean(value,true);v.setSmoothScrollbarEnabled(smoothScrollbar);},getter:function getter(v){return v.isSmoothScrollbarEnabled();}}).set('choiceMode',{setter:function setter(v,value,attrBinder){v.setChoiceMode(attrBinder.parseEnum(value,new Map().set(\"none\",AbsListView.CHOICE_MODE_NONE).set(\"singleChoice\",AbsListView.CHOICE_MODE_SINGLE).set(\"multipleChoice\",AbsListView.CHOICE_MODE_MULTIPLE),AbsListView.CHOICE_MODE_NONE));},getter:function getter(v){return v.getChoiceMode();}});}},{key:'setOverScrollMode',value:function setOverScrollMode(mode){if(mode!=AbsListView.OVER_SCROLL_NEVER){}else{}_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'setOverScrollMode',this).call(this,mode);}},{key:'setAdapter',value:function setAdapter(adapter){if(adapter!=null){this.mAdapterHasStableIds=this.mAdapter.hasStableIds();if(this.mChoiceMode!=AbsListView.CHOICE_MODE_NONE&&this.mAdapterHasStableIds&&this.mCheckedIdStates==null){this.mCheckedIdStates=new LongSparseArray();}}if(this.mCheckStates!=null){this.mCheckStates.clear();}if(this.mCheckedIdStates!=null){this.mCheckedIdStates.clear();}}},{key:'getCheckedItemCount',value:function getCheckedItemCount(){return this.mCheckedItemCount;}},{key:'isItemChecked',value:function isItemChecked(position){if(this.mChoiceMode!=AbsListView.CHOICE_MODE_NONE&&this.mCheckStates!=null){return this.mCheckStates.get(position);}return false;}},{key:'getCheckedItemPosition',value:function getCheckedItemPosition(){if(this.mChoiceMode==AbsListView.CHOICE_MODE_SINGLE&&this.mCheckStates!=null&&this.mCheckStates.size()==1){return this.mCheckStates.keyAt(0);}return AbsListView.INVALID_POSITION;}},{key:'getCheckedItemPositions',value:function getCheckedItemPositions(){if(this.mChoiceMode!=AbsListView.CHOICE_MODE_NONE){return this.mCheckStates;}return null;}},{key:'getCheckedItemIds',value:function getCheckedItemIds(){if(this.mChoiceMode==AbsListView.CHOICE_MODE_NONE||this.mCheckedIdStates==null||this.mAdapter==null){return[0];}var idStates=this.mCheckedIdStates;var count=idStates.size();var ids=[count];for(var i=0;i<count;i++){ids[i]=idStates.keyAt(i);}return ids;}},{key:'clearChoices',value:function clearChoices(){if(this.mCheckStates!=null){this.mCheckStates.clear();}if(this.mCheckedIdStates!=null){this.mCheckedIdStates.clear();}this.mCheckedItemCount=0;}},{key:'setItemChecked',value:function setItemChecked(position,value){if(this.mChoiceMode==AbsListView.CHOICE_MODE_NONE){return;}if(this.mChoiceMode==AbsListView.CHOICE_MODE_MULTIPLE||this.mChoiceMode==AbsListView.CHOICE_MODE_MULTIPLE_MODAL){var oldValue=this.mCheckStates.get(position);this.mCheckStates.put(position,value);if(this.mCheckedIdStates!=null&&this.mAdapter.hasStableIds()){if(value){this.mCheckedIdStates.put(this.mAdapter.getItemId(position),position);}else{this.mCheckedIdStates.delete(this.mAdapter.getItemId(position));}}if(oldValue!=value){if(value){this.mCheckedItemCount++;}else{this.mCheckedItemCount--;}}}else{var updateIds=this.mCheckedIdStates!=null&&this.mAdapter.hasStableIds();if(value||this.isItemChecked(position)){this.mCheckStates.clear();if(updateIds){this.mCheckedIdStates.clear();}}if(value){this.mCheckStates.put(position,true);if(updateIds){this.mCheckedIdStates.put(this.mAdapter.getItemId(position),position);}this.mCheckedItemCount=1;}else if(this.mCheckStates.size()==0||!this.mCheckStates.valueAt(0)){this.mCheckedItemCount=0;}}if(!this.mInLayout&&!this.mBlockLayoutRequests){this.mDataChanged=true;this.rememberSyncState();this.requestLayout();}}},{key:'performItemClick',value:function performItemClick(view,position,id){var handled=false;var dispatchItemClick=true;if(this.mChoiceMode!=AbsListView.CHOICE_MODE_NONE){handled=true;var checkedStateChanged=false;if(this.mChoiceMode==AbsListView.CHOICE_MODE_MULTIPLE||this.mChoiceMode==AbsListView.CHOICE_MODE_MULTIPLE_MODAL&&this.mChoiceActionMode!=null){var checked=!this.mCheckStates.get(position,false);this.mCheckStates.put(position,checked);if(this.mCheckedIdStates!=null&&this.mAdapter.hasStableIds()){if(checked){this.mCheckedIdStates.put(this.mAdapter.getItemId(position),position);}else{this.mCheckedIdStates.delete(this.mAdapter.getItemId(position));}}if(checked){this.mCheckedItemCount++;}else{this.mCheckedItemCount--;}checkedStateChanged=true;}else if(this.mChoiceMode==AbsListView.CHOICE_MODE_SINGLE){var _checked=!this.mCheckStates.get(position,false);if(_checked){this.mCheckStates.clear();this.mCheckStates.put(position,true);if(this.mCheckedIdStates!=null&&this.mAdapter.hasStableIds()){this.mCheckedIdStates.clear();this.mCheckedIdStates.put(this.mAdapter.getItemId(position),position);}this.mCheckedItemCount=1;}else if(this.mCheckStates.size()==0||!this.mCheckStates.valueAt(0)){this.mCheckedItemCount=0;}checkedStateChanged=true;}if(checkedStateChanged){this.updateOnScreenCheckedViews();}}if(dispatchItemClick){handled=_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'performItemClick',this).call(this,view,position,id)||handled;}return handled;}},{key:'updateOnScreenCheckedViews',value:function updateOnScreenCheckedViews(){var firstPos=this.mFirstPosition;var count=this.getChildCount();var useActivated=true;for(var i=0;i<count;i++){var child=this.getChildAt(i);var position=firstPos+i;if(child['setChecked']){child.setChecked(this.mCheckStates.get(position));}else if(useActivated){child.setActivated(this.mCheckStates.get(position));}}}},{key:'getChoiceMode',value:function getChoiceMode(){return this.mChoiceMode;}},{key:'setChoiceMode',value:function setChoiceMode(choiceMode){this.mChoiceMode=choiceMode;if(this.mChoiceActionMode!=null){this.mChoiceActionMode.finish();this.mChoiceActionMode=null;}if(this.mChoiceMode!=AbsListView.CHOICE_MODE_NONE){if(this.mCheckStates==null){this.mCheckStates=new SparseBooleanArray(0);}if(this.mCheckedIdStates==null&&this.mAdapter!=null&&this.mAdapter.hasStableIds()){this.mCheckedIdStates=new LongSparseArray(0);}if(this.mChoiceMode==AbsListView.CHOICE_MODE_MULTIPLE_MODAL){this.clearChoices();this.setLongClickable(true);}}}},{key:'contentFits',value:function contentFits(){var childCount=this.getChildCount();if(childCount==0)return true;if(childCount!=this.mItemCount)return false;return this.getChildAt(0).getTop()>=this.mListPadding.top&&this.getChildAt(childCount-1).getBottom()<=this.getHeight()-this.mListPadding.bottom;}},{key:'setFastScrollEnabled',value:function setFastScrollEnabled(enabled){if(this.mFastScrollEnabled!=enabled){this.mFastScrollEnabled=enabled;this.setFastScrollerEnabledUiThread(enabled);}}},{key:'setFastScrollerEnabledUiThread',value:function setFastScrollerEnabledUiThread(enabled){}},{key:'setFastScrollAlwaysVisible',value:function setFastScrollAlwaysVisible(alwaysShow){if(this.mFastScrollAlwaysVisible!=alwaysShow){if(alwaysShow&&!this.mFastScrollEnabled){this.setFastScrollEnabled(true);}this.mFastScrollAlwaysVisible=alwaysShow;this.setFastScrollerAlwaysVisibleUiThread(alwaysShow);}}},{key:'setFastScrollerAlwaysVisibleUiThread',value:function setFastScrollerAlwaysVisibleUiThread(alwaysShow){}},{key:'isOwnerThread',value:function isOwnerThread(){return true;}},{key:'isFastScrollAlwaysVisible',value:function isFastScrollAlwaysVisible(){return false;}},{key:'getVerticalScrollbarWidth',value:function getVerticalScrollbarWidth(){return _get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'getVerticalScrollbarWidth',this).call(this);}},{key:'isFastScrollEnabled',value:function isFastScrollEnabled(){return false;}},{key:'setVerticalScrollbarPosition',value:function setVerticalScrollbarPosition(position){_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'setVerticalScrollbarPosition',this).call(this,position);}},{key:'setScrollBarStyle',value:function setScrollBarStyle(style){_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'setScrollBarStyle',this).call(this,style);}},{key:'isVerticalScrollBarHidden',value:function isVerticalScrollBarHidden(){return this.isFastScrollEnabled();}},{key:'setSmoothScrollbarEnabled',value:function setSmoothScrollbarEnabled(enabled){this.mSmoothScrollbarEnabled=enabled;}},{key:'isSmoothScrollbarEnabled',value:function isSmoothScrollbarEnabled(){return this.mSmoothScrollbarEnabled;}},{key:'setOnScrollListener',value:function setOnScrollListener(l){this.mOnScrollListener=l;this.invokeOnItemScrollListener();}},{key:'invokeOnItemScrollListener',value:function invokeOnItemScrollListener(){if(this.mOnScrollListener!=null){this.mOnScrollListener.onScroll(this,this.mFirstPosition,this.getChildCount(),this.mItemCount);}this.onScrollChanged(0,0,0,0);}},{key:'isScrollingCacheEnabled',value:function isScrollingCacheEnabled(){return this.mScrollingCacheEnabled;}},{key:'setScrollingCacheEnabled',value:function setScrollingCacheEnabled(enabled){if(this.mScrollingCacheEnabled&&!enabled){this.clearScrollingCache();}this.mScrollingCacheEnabled=enabled;}},{key:'setTextFilterEnabled',value:function setTextFilterEnabled(textFilterEnabled){this.mTextFilterEnabled=textFilterEnabled;}},{key:'isTextFilterEnabled',value:function isTextFilterEnabled(){return this.mTextFilterEnabled;}},{key:'getFocusedRect',value:function getFocusedRect(r){var view=this.getSelectedView();if(view!=null&&view.getParent()==this){view.getFocusedRect(r);this.offsetDescendantRectToMyCoords(view,r);}else{_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'getFocusedRect',this).call(this,r);}}},{key:'useDefaultSelector',value:function useDefaultSelector(){this.setSelector(android.R.drawable.list_selector_background);}},{key:'isStackFromBottom',value:function isStackFromBottom(){return this.mStackFromBottom;}},{key:'setStackFromBottom',value:function setStackFromBottom(stackFromBottom){if(this.mStackFromBottom!=stackFromBottom){this.mStackFromBottom=stackFromBottom;this.requestLayoutIfNecessary();}}},{key:'requestLayoutIfNecessary',value:function requestLayoutIfNecessary(){if(this.getChildCount()>0){this.resetList();this.requestLayout();this.invalidate();}}},{key:'onFocusChanged',value:function onFocusChanged(gainFocus,direction,previouslyFocusedRect){_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'onFocusChanged',this).call(this,gainFocus,direction,previouslyFocusedRect);if(gainFocus&&this.mSelectedPosition<0&&!this.isInTouchMode()){if(!this.isAttachedToWindow()&&this.mAdapter!=null){this.mDataChanged=true;this.mOldItemCount=this.mItemCount;this.mItemCount=this.mAdapter.getCount();}this.resurrectSelection();}}},{key:'requestLayout',value:function requestLayout(){if(!this.mBlockLayoutRequests&&!this.mInLayout){_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'requestLayout',this).call(this);}}},{key:'resetList',value:function resetList(){this.removeAllViewsInLayout();this.mFirstPosition=0;this.mDataChanged=false;this.mPositionScrollAfterLayout=null;this.mNeedSync=false;this.mPendingSync=null;this.mOldSelectedPosition=AbsListView.INVALID_POSITION;this.mOldSelectedRowId=AbsListView.INVALID_ROW_ID;this.setSelectedPositionInt(AbsListView.INVALID_POSITION);this.setNextSelectedPositionInt(AbsListView.INVALID_POSITION);this.mSelectedTop=0;this.mSelectorPosition=AbsListView.INVALID_POSITION;this.mSelectorRect.setEmpty();this.invalidate();}},{key:'computeVerticalScrollExtent',value:function computeVerticalScrollExtent(){var count=this.getChildCount();if(count>0){if(this.mSmoothScrollbarEnabled){var extent=count*100;var view=this.getChildAt(0);var top=view.getTop();var height=view.getHeight();if(height>0){extent+=top*100/height;}view=this.getChildAt(count-1);var bottom=view.getBottom();height=view.getHeight();if(height>0){extent-=(bottom-this.getHeight())*100/height;}return extent;}else{return 1;}}return 0;}},{key:'computeVerticalScrollOffset',value:function computeVerticalScrollOffset(){var firstPosition=this.mFirstPosition;var childCount=this.getChildCount();if(firstPosition>=0&&childCount>0){if(this.mSmoothScrollbarEnabled){var view=this.getChildAt(0);var top=view.getTop();var height=view.getHeight();if(height>0){return Math.max(firstPosition*100-top*100/height+Math.floor(this.mScrollY/this.getHeight()*this.mItemCount*100),0);}}else{var index=void 0;var count=this.mItemCount;if(firstPosition==0){index=0;}else if(firstPosition+childCount==count){index=count;}else{index=firstPosition+childCount/2;}return Math.floor(firstPosition+childCount*(index/count));}}return 0;}},{key:'computeVerticalScrollRange',value:function computeVerticalScrollRange(){var result=void 0;if(this.mSmoothScrollbarEnabled){result=Math.max(this.mItemCount*100,0);if(this.mScrollY!=0){result+=Math.abs(Math.floor(this.mScrollY/this.getHeight()*this.mItemCount*100));}}else{result=this.mItemCount;}return result;}},{key:'getTopFadingEdgeStrength',value:function getTopFadingEdgeStrength(){var count=this.getChildCount();var fadeEdge=_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'getTopFadingEdgeStrength',this).call(this);if(count==0){return fadeEdge;}else{if(this.mFirstPosition>0){return 1.0;}var top=this.getChildAt(0).getTop();var fadeLength=this.getVerticalFadingEdgeLength();return top<this.mPaddingTop?-(top-this.mPaddingTop)/fadeLength:fadeEdge;}}},{key:'getBottomFadingEdgeStrength',value:function getBottomFadingEdgeStrength(){var count=this.getChildCount();var fadeEdge=_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'getBottomFadingEdgeStrength',this).call(this);if(count==0){return fadeEdge;}else{if(this.mFirstPosition+count-1<this.mItemCount-1){return 1.0;}var bottom=this.getChildAt(count-1).getBottom();var height=this.getHeight();var fadeLength=this.getVerticalFadingEdgeLength();return bottom>height-this.mPaddingBottom?(bottom-height+this.mPaddingBottom)/fadeLength:fadeEdge;}}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){if(this.mSelector==null){this.useDefaultSelector();}var listPadding=this.mListPadding;listPadding.left=this.mSelectionLeftPadding+this.mPaddingLeft;listPadding.top=this.mSelectionTopPadding+this.mPaddingTop;listPadding.right=this.mSelectionRightPadding+this.mPaddingRight;listPadding.bottom=this.mSelectionBottomPadding+this.mPaddingBottom;if(this.mTranscriptMode==AbsListView.TRANSCRIPT_MODE_NORMAL){var childCount=this.getChildCount();var listBottom=this.getHeight()-this.getPaddingBottom();var lastChild=this.getChildAt(childCount-1);var lastBottom=lastChild!=null?lastChild.getBottom():listBottom;this.mForceTranscriptScroll=this.mFirstPosition+childCount>=this.mLastHandledItemCount&&lastBottom<=listBottom;}}},{key:'onLayout',value:function onLayout(changed,l,t,r,b){_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'onLayout',this).call(this,changed,l,t,r,b);this.mInLayout=true;if(changed){var childCount=this.getChildCount();for(var i=0;i<childCount;i++){this.getChildAt(i).forceLayout();}this.mRecycler.markChildrenDirty();}this.layoutChildren();this.mInLayout=false;this.mOverscrollMax=(b-t)/AbsListView.OVERSCROLL_LIMIT_DIVISOR;}},{key:'setFrame',value:function setFrame(left,top,right,bottom){var changed=_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'setFrame',this).call(this,left,top,right,bottom);if(changed){var visible=this.getWindowVisibility()==View.VISIBLE;}return changed;}},{key:'layoutChildren',value:function layoutChildren(){}},{key:'updateScrollIndicators',value:function updateScrollIndicators(){if(this.mScrollUp!=null){var canScrollUp=void 0;canScrollUp=this.mFirstPosition>0;if(!canScrollUp){if(this.getChildCount()>0){var child=this.getChildAt(0);canScrollUp=child.getTop()<this.mListPadding.top;}}this.mScrollUp.setVisibility(canScrollUp?View.VISIBLE:View.INVISIBLE);}if(this.mScrollDown!=null){var canScrollDown=void 0;var count=this.getChildCount();canScrollDown=this.mFirstPosition+count<this.mItemCount;if(!canScrollDown&&count>0){var _child12=this.getChildAt(count-1);canScrollDown=_child12.getBottom()>this.mBottom-this.mListPadding.bottom;}this.mScrollDown.setVisibility(canScrollDown?View.VISIBLE:View.INVISIBLE);}}},{key:'getSelectedView',value:function getSelectedView(){if(this.mItemCount>0&&this.mSelectedPosition>=0){return this.getChildAt(this.mSelectedPosition-this.mFirstPosition);}else{return null;}}},{key:'getListPaddingTop',value:function getListPaddingTop(){return this.mListPadding.top;}},{key:'getListPaddingBottom',value:function getListPaddingBottom(){return this.mListPadding.bottom;}},{key:'getListPaddingLeft',value:function getListPaddingLeft(){return this.mListPadding.left;}},{key:'getListPaddingRight',value:function getListPaddingRight(){return this.mListPadding.right;}},{key:'obtainView',value:function obtainView(position,isScrap){isScrap[0]=false;var scrapView=void 0;scrapView=this.mRecycler.getTransientStateView(position);if(scrapView==null){scrapView=this.mRecycler.getScrapView(position);}var child=void 0;if(scrapView!=null){child=this.mAdapter.getView(position,scrapView,this);if(child!=scrapView){this.mRecycler.addScrapView(scrapView,position);if(this.mCacheColorHint!=0){child.setDrawingCacheBackgroundColor(this.mCacheColorHint);}}else{isScrap[0]=true;child.dispatchFinishTemporaryDetach();}}else{child=this.mAdapter.getView(position,null,this);if(this.mCacheColorHint!=0){child.setDrawingCacheBackgroundColor(this.mCacheColorHint);}}if(this.mAdapterHasStableIds){var vlp=child.getLayoutParams();var lp=void 0;if(vlp==null){lp=this.generateDefaultLayoutParams();}else if(!this.checkLayoutParams(vlp)){lp=this.generateLayoutParams(vlp);}else{lp=vlp;}lp.itemId=this.mAdapter.getItemId(position);child.setLayoutParams(lp);}return child;}},{key:'positionSelector',value:function positionSelector(){for(var _len26=arguments.length,args=Array(_len26),_key27=0;_key27<_len26;_key27++){args[_key27]=arguments[_key27];}if(args.length===4){var l=args[0],t=args[1],_r2=args[2],b=args[3];this.mSelectorRect.set(l-this.mSelectionLeftPadding,t-this.mSelectionTopPadding,_r2+this.mSelectionRightPadding,b+this.mSelectionBottomPadding);}else{var position=args[0];var sel=args[1];if(position!=AbsListView.INVALID_POSITION){this.mSelectorPosition=position;}var selectorRect=this.mSelectorRect;selectorRect.set(sel.getLeft(),sel.getTop(),sel.getRight(),sel.getBottom());if(sel['adjustListItemSelectionBounds']){sel.adjustListItemSelectionBounds(selectorRect);}this.positionSelector(selectorRect.left,selectorRect.top,selectorRect.right,selectorRect.bottom);var isChildViewEnabled=this.mIsChildViewEnabled;if(sel.isEnabled()!=isChildViewEnabled){this.mIsChildViewEnabled=!isChildViewEnabled;if(this.getSelectedItemPosition()!=AbsListView.INVALID_POSITION){this.refreshDrawableState();}}}}},{key:'dispatchDraw',value:function dispatchDraw(canvas){var saveCount=0;var clipToPadding=(this.mGroupFlags&AbsListView.CLIP_TO_PADDING_MASK)==AbsListView.CLIP_TO_PADDING_MASK;if(clipToPadding){saveCount=canvas.save();var scrollX=this.mScrollX;var scrollY=this.mScrollY;canvas.clipRect(scrollX+this.mPaddingLeft,scrollY+this.mPaddingTop,scrollX+this.mRight-this.mLeft-this.mPaddingRight,scrollY+this.mBottom-this.mTop-this.mPaddingBottom);this.mGroupFlags&=~AbsListView.CLIP_TO_PADDING_MASK;}var drawSelectorOnTop=this.mDrawSelectorOnTop;if(!drawSelectorOnTop){this.drawSelector(canvas);}_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'dispatchDraw',this).call(this,canvas);if(drawSelectorOnTop){this.drawSelector(canvas);}if(clipToPadding){canvas.restoreToCount(saveCount);this.mGroupFlags|=AbsListView.CLIP_TO_PADDING_MASK;}}},{key:'isPaddingOffsetRequired',value:function isPaddingOffsetRequired(){return(this.mGroupFlags&AbsListView.CLIP_TO_PADDING_MASK)!=AbsListView.CLIP_TO_PADDING_MASK;}},{key:'getLeftPaddingOffset',value:function getLeftPaddingOffset(){return(this.mGroupFlags&AbsListView.CLIP_TO_PADDING_MASK)==AbsListView.CLIP_TO_PADDING_MASK?0:-this.mPaddingLeft;}},{key:'getTopPaddingOffset',value:function getTopPaddingOffset(){return(this.mGroupFlags&AbsListView.CLIP_TO_PADDING_MASK)==AbsListView.CLIP_TO_PADDING_MASK?0:-this.mPaddingTop;}},{key:'getRightPaddingOffset',value:function getRightPaddingOffset(){return(this.mGroupFlags&AbsListView.CLIP_TO_PADDING_MASK)==AbsListView.CLIP_TO_PADDING_MASK?0:this.mPaddingRight;}},{key:'getBottomPaddingOffset',value:function getBottomPaddingOffset(){return(this.mGroupFlags&AbsListView.CLIP_TO_PADDING_MASK)==AbsListView.CLIP_TO_PADDING_MASK?0:this.mPaddingBottom;}},{key:'onSizeChanged',value:function onSizeChanged(w,h,oldw,oldh){if(this.getChildCount()>0){this.mDataChanged=true;this.rememberSyncState();}}},{key:'touchModeDrawsInPressedState',value:function touchModeDrawsInPressedState(){switch(this.mTouchMode){case AbsListView.TOUCH_MODE_TAP:case AbsListView.TOUCH_MODE_DONE_WAITING:return true;default:return false;}}},{key:'shouldShowSelector',value:function shouldShowSelector(){return!this.isInTouchMode()||this.touchModeDrawsInPressedState()&&this.isPressed();}},{key:'drawSelector',value:function drawSelector(canvas){if(!this.mSelectorRect.isEmpty()){var selector=this.mSelector;selector.setBounds(this.mSelectorRect);selector.draw(canvas);}}},{key:'setDrawSelectorOnTop',value:function setDrawSelectorOnTop(onTop){this.mDrawSelectorOnTop=onTop;}},{key:'setSelector',value:function setSelector(sel){if(this.mSelector!=null){this.mSelector.setCallback(null);this.unscheduleDrawable(this.mSelector);}this.mSelector=sel;var padding=new Rect();sel.getPadding(padding);this.mSelectionLeftPadding=padding.left;this.mSelectionTopPadding=padding.top;this.mSelectionRightPadding=padding.right;this.mSelectionBottomPadding=padding.bottom;sel.setCallback(this);this.updateSelectorState();}},{key:'getSelector',value:function getSelector(){return this.mSelector;}},{key:'keyPressed',value:function keyPressed(){if(!this.isEnabled()||!this.isClickable()){return;}var selector=this.mSelector;var selectorRect=this.mSelectorRect;if(selector!=null&&(this.isFocused()||this.touchModeDrawsInPressedState())&&!selectorRect.isEmpty()){var v=this.getChildAt(this.mSelectedPosition-this.mFirstPosition);if(v!=null){if(v.hasFocusable())return;v.setPressed(true);}this.setPressed(true);var longClickable=this.isLongClickable();var d=selector.getCurrent();if(longClickable&&!this.mDataChanged){if(this.mPendingCheckForKeyLongPress==null){this.mPendingCheckForKeyLongPress=new AbsListView.CheckForKeyLongPress(this);}this.mPendingCheckForKeyLongPress.rememberWindowAttachCount();this.postDelayed(this.mPendingCheckForKeyLongPress,ViewConfiguration.getLongPressTimeout());}}}},{key:'setScrollIndicators',value:function setScrollIndicators(up,down){this.mScrollUp=up;this.mScrollDown=down;}},{key:'updateSelectorState',value:function updateSelectorState(){if(this.mSelector!=null){if(this.shouldShowSelector()){this.mSelector.setState(this.getDrawableState());}else{this.mSelector.setState(StateSet.NOTHING);}}}},{key:'drawableStateChanged',value:function drawableStateChanged(){_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'drawableStateChanged',this).call(this);this.updateSelectorState();}},{key:'onCreateDrawableState',value:function onCreateDrawableState(extraSpace){if(this.mIsChildViewEnabled){return _get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'onCreateDrawableState',this).call(this,extraSpace);}var enabledState=AbsListView.ENABLED_STATE_SET[0];var state=_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'onCreateDrawableState',this).call(this,extraSpace+1);var enabledPos=-1;for(var i=state.length-1;i>=0;i--){if(state[i]==enabledState){enabledPos=i;break;}}if(enabledPos>=0){System.arraycopy(state,enabledPos+1,state,enabledPos,state.length-enabledPos-1);}return state;}},{key:'verifyDrawable',value:function verifyDrawable(dr){return this.mSelector==dr||_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'verifyDrawable',this).call(this,dr);}},{key:'jumpDrawablesToCurrentState',value:function jumpDrawablesToCurrentState(){_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'jumpDrawablesToCurrentState',this).call(this);if(this.mSelector!=null)this.mSelector.jumpToCurrentState();}},{key:'onAttachedToWindow',value:function onAttachedToWindow(){_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'onAttachedToWindow',this).call(this);var treeObserver=this.getViewTreeObserver();treeObserver.addOnTouchModeChangeListener(this);if(this.mAdapter!=null&&this.mDataSetObserver==null){this.mDataSetObserver=new AbsListView.AdapterDataSetObserver(this);this.mAdapter.registerDataSetObserver(this.mDataSetObserver);this.mDataChanged=true;this.mOldItemCount=this.mItemCount;this.mItemCount=this.mAdapter.getCount();}}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'onDetachedFromWindow',this).call(this);this.dismissPopup();this.mRecycler.clear();var treeObserver=this.getViewTreeObserver();treeObserver.removeOnTouchModeChangeListener(this);if(this.mAdapter!=null&&this.mDataSetObserver!=null){this.mAdapter.unregisterDataSetObserver(this.mDataSetObserver);this.mDataSetObserver=null;}if(this.mFlingRunnable!=null){this.removeCallbacks(this.mFlingRunnable);}if(this.mPositionScroller!=null){this.mPositionScroller.stop();}if(this.mClearScrollingCache!=null){this.removeCallbacks(this.mClearScrollingCache);}if(this.mPerformClick_!=null){this.removeCallbacks(this.mPerformClick_);}if(this.mTouchModeReset!=null){this.removeCallbacks(this.mTouchModeReset);this.mTouchModeReset.run();}}},{key:'onWindowFocusChanged',value:function onWindowFocusChanged(hasWindowFocus){_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'onWindowFocusChanged',this).call(this,hasWindowFocus);var touchMode=this.isInTouchMode()?AbsListView.TOUCH_MODE_ON:AbsListView.TOUCH_MODE_OFF;if(!hasWindowFocus){this.setChildrenDrawingCacheEnabled(false);if(this.mFlingRunnable!=null){this.removeCallbacks(this.mFlingRunnable);this.mFlingRunnable.endFling();if(this.mPositionScroller!=null){this.mPositionScroller.stop();}if(this.mScrollY!=0){this.mScrollY=0;this.invalidateParentCaches();this.finishGlows();this.invalidate();}}this.dismissPopup();if(touchMode==AbsListView.TOUCH_MODE_OFF){this.mResurrectToPosition=this.mSelectedPosition;}}else{if(this.mFiltered&&!this.mPopupHidden){this.showPopup();}if(touchMode!=this.mLastTouchMode&&this.mLastTouchMode!=AbsListView.TOUCH_MODE_UNKNOWN){if(touchMode==AbsListView.TOUCH_MODE_OFF){this.resurrectSelection();}else{this.hideSelector();this.mLayoutMode=AbsListView.LAYOUT_NORMAL;this.layoutChildren();}}}this.mLastTouchMode=touchMode;}},{key:'onCancelPendingInputEvents',value:function onCancelPendingInputEvents(){_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'onCancelPendingInputEvents',this).call(this);if(this.mPerformClick_!=null){this.removeCallbacks(this.mPerformClick_);}if(this.mPendingCheckForTap_!=null){this.removeCallbacks(this.mPendingCheckForTap_);}if(this.mPendingCheckForLongPress_List!=null){this.removeCallbacks(this.mPendingCheckForLongPress_List);}if(this.mPendingCheckForKeyLongPress!=null){this.removeCallbacks(this.mPendingCheckForKeyLongPress);}}},{key:'performLongPress',value:function performLongPress(child,longPressPosition,longPressId){var handled=false;if(this.mOnItemLongClickListener!=null){handled=this.mOnItemLongClickListener.onItemLongClick(this,child,longPressPosition,longPressId);}if(handled){this.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);}return handled;}},{key:'onKeyDown',value:function onKeyDown(keyCode,event){return false;}},{key:'onKeyUp',value:function onKeyUp(keyCode,event){if(KeyEvent.isConfirmKey(keyCode)){if(!this.isEnabled()){return true;}if(this.isClickable()&&this.isPressed()&&this.mSelectedPosition>=0&&this.mAdapter!=null&&this.mSelectedPosition<this.mAdapter.getCount()){var view=this.getChildAt(this.mSelectedPosition-this.mFirstPosition);if(view!=null){this.performItemClick(view,this.mSelectedPosition,this.mSelectedRowId);view.setPressed(false);}this.setPressed(false);return true;}}return _get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'onKeyUp',this).call(this,keyCode,event);}},{key:'dispatchSetPressed',value:function dispatchSetPressed(pressed){}},{key:'pointToPosition',value:function pointToPosition(x,y){var frame=this.mTouchFrame;if(frame==null){this.mTouchFrame=new Rect();frame=this.mTouchFrame;}var count=this.getChildCount();for(var i=count-1;i>=0;i--){var child=this.getChildAt(i);if(child.getVisibility()==View.VISIBLE){child.getHitRect(frame);if(frame.contains(x,y)){return this.mFirstPosition+i;}}}return AbsListView.INVALID_POSITION;}},{key:'pointToRowId',value:function pointToRowId(x,y){var position=this.pointToPosition(x,y);if(position>=0){return this.mAdapter.getItemId(position);}return AbsListView.INVALID_ROW_ID;}},{key:'checkOverScrollStartScrollIfNeeded',value:function checkOverScrollStartScrollIfNeeded(){return this.mScrollY!=0;}},{key:'startScrollIfNeeded',value:function startScrollIfNeeded(y){var deltaY=y-this.mMotionY;var distance=Math.abs(deltaY);var overscroll=this.checkOverScrollStartScrollIfNeeded();if(overscroll||distance>this.mTouchSlop){this.createScrollingCache();if(this.mScrollY!=0){this.mTouchMode=AbsListView.TOUCH_MODE_OVERSCROLL;this.mMotionCorrection=0;}else{this.mTouchMode=AbsListView.TOUCH_MODE_SCROLL;this.mMotionCorrection=deltaY>0?this.mTouchSlop:-this.mTouchSlop;}this.removeCallbacks(this.mPendingCheckForLongPress_List);this.setPressed(false);var motionView=this.getChildAt(this.mMotionPosition-this.mFirstPosition);if(motionView!=null){motionView.setPressed(false);}this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);var parent=this.getParent();if(parent!=null){parent.requestDisallowInterceptTouchEvent(true);}this.scrollIfNeeded(y);return true;}return false;}},{key:'scrollIfNeeded',value:function scrollIfNeeded(y){var rawDeltaY=y-this.mMotionY;var deltaY=rawDeltaY-this.mMotionCorrection;var incrementalDeltaY=this.mLastY!=Integer.MIN_VALUE?y-this.mLastY:deltaY;if(this.mTouchMode==AbsListView.TOUCH_MODE_SCROLL){if(AbsListView.PROFILE_SCROLLING){if(!this.mScrollProfilingStarted){this.mScrollProfilingStarted=true;}}if(y!=this.mLastY){if((this.mGroupFlags&AbsListView.FLAG_DISALLOW_INTERCEPT)==0&&Math.abs(rawDeltaY)>this.mTouchSlop){var parent=this.getParent();if(parent!=null){parent.requestDisallowInterceptTouchEvent(true);}}var motionIndex=void 0;if(this.mMotionPosition>=0){motionIndex=this.mMotionPosition-this.mFirstPosition;}else{motionIndex=this.getChildCount()/2;}var motionViewPrevTop=0;var motionView=this.getChildAt(motionIndex);if(motionView!=null){motionViewPrevTop=motionView.getTop();}var atEdge=false;if(incrementalDeltaY!=0){atEdge=this.trackMotionScroll(deltaY,incrementalDeltaY);}motionView=this.getChildAt(motionIndex);if(motionView!=null){var motionViewRealTop=motionView.getTop();if(atEdge){var overscroll=-incrementalDeltaY-(motionViewRealTop-motionViewPrevTop);this.overScrollBy(0,overscroll,0,this.mScrollY,0,0,0,this.mOverscrollDistance,true);if(Math.abs(this.mOverscrollDistance)==Math.abs(this.mScrollY)){if(this.mVelocityTracker!=null){this.mVelocityTracker.clear();}}var overscrollMode=this.getOverScrollMode();if(overscrollMode==AbsListView.OVER_SCROLL_ALWAYS||overscrollMode==AbsListView.OVER_SCROLL_IF_CONTENT_SCROLLS&&!this.contentFits()){this.mDirection=0;this.mTouchMode=AbsListView.TOUCH_MODE_OVERSCROLL;if(rawDeltaY>0){}else if(rawDeltaY<0){}}}this.mMotionY=y;}this.mLastY=y;}}else if(this.mTouchMode==AbsListView.TOUCH_MODE_OVERSCROLL){if(y!=this.mLastY){var oldScroll=this.mScrollY;var newScroll=oldScroll-incrementalDeltaY;var newDirection=y>this.mLastY?1:-1;if(this.mDirection==0){this.mDirection=newDirection;}var overScrollDistance=-incrementalDeltaY;if(newScroll<0&&oldScroll>=0||newScroll>0&&oldScroll<=0){overScrollDistance=-oldScroll;incrementalDeltaY+=overScrollDistance;}else{incrementalDeltaY=0;}if(overScrollDistance!=0){this.overScrollBy(0,overScrollDistance,0,this.mScrollY,0,0,0,this.mOverscrollDistance,true);}if(incrementalDeltaY!=0){if(this.mScrollY!=0){this.mScrollY=0;this.invalidateParentIfNeeded();}this.trackMotionScroll(incrementalDeltaY,incrementalDeltaY);this.mTouchMode=AbsListView.TOUCH_MODE_SCROLL;var motionPosition=this.findClosestMotionRow(y);this.mMotionCorrection=0;var _motionView=this.getChildAt(motionPosition-this.mFirstPosition);this.mMotionViewOriginalTop=_motionView!=null?_motionView.getTop():0;this.mMotionY=y;this.mMotionPosition=motionPosition;}this.mLastY=y;this.mDirection=newDirection;}}}},{key:'onTouchModeChanged',value:function onTouchModeChanged(isInTouchMode){if(isInTouchMode){this.hideSelector();if(this.getHeight()>0&&this.getChildCount()>0){this.layoutChildren();}this.updateSelectorState();}else{var touchMode=this.mTouchMode;if(touchMode==AbsListView.TOUCH_MODE_OVERSCROLL||touchMode==AbsListView.TOUCH_MODE_OVERFLING){if(this.mFlingRunnable!=null){this.mFlingRunnable.endFling();}if(this.mPositionScroller!=null){this.mPositionScroller.stop();}if(this.mScrollY!=0){this.mScrollY=0;this.invalidateParentCaches();this.finishGlows();this.invalidate();}}}}},{key:'onTouchEvent',value:function onTouchEvent(ev){if(!this.isEnabled()){return this.isClickable()||this.isLongClickable();}if(this.mPositionScroller!=null){this.mPositionScroller.stop();}if(!this.isAttachedToWindow()){return false;}this.initVelocityTrackerIfNotExists();this.mVelocityTracker.addMovement(ev);var actionMasked=ev.getActionMasked();switch(actionMasked){case MotionEvent.ACTION_DOWN:{this.onTouchDown(ev);break;}case MotionEvent.ACTION_MOVE:{this.onTouchMove(ev);break;}case MotionEvent.ACTION_UP:{this.onTouchUp(ev);break;}case MotionEvent.ACTION_CANCEL:{this.onTouchCancel();break;}case MotionEvent.ACTION_POINTER_UP:{this.onSecondaryPointerUp(ev);var _x174=this.mMotionX;var _y6=this.mMotionY;var motionPosition=this.pointToPosition(_x174,_y6);if(motionPosition>=0){var child=this.getChildAt(motionPosition-this.mFirstPosition);this.mMotionViewOriginalTop=child.getTop();this.mMotionPosition=motionPosition;}this.mLastY=_y6;break;}case MotionEvent.ACTION_POINTER_DOWN:{var index=ev.getActionIndex();var id=ev.getPointerId(index);var _x175=Math.floor(ev.getX(index));var _y7=Math.floor(ev.getY(index));this.mMotionCorrection=0;this.mActivePointerId=id;this.mMotionX=_x175;this.mMotionY=_y7;var _motionPosition=this.pointToPosition(_x175,_y7);if(_motionPosition>=0){var _child13=this.getChildAt(_motionPosition-this.mFirstPosition);this.mMotionViewOriginalTop=_child13.getTop();this.mMotionPosition=_motionPosition;}this.mLastY=_y7;break;}}return true;}},{key:'onTouchDown',value:function onTouchDown(ev){this.mActivePointerId=ev.getPointerId(0);if(this.mTouchMode==AbsListView.TOUCH_MODE_OVERFLING){this.mFlingRunnable.endFling();if(this.mPositionScroller!=null){this.mPositionScroller.stop();}this.mTouchMode=AbsListView.TOUCH_MODE_OVERSCROLL;this.mMotionX=Math.floor(ev.getX());this.mMotionY=Math.floor(ev.getY());this.mLastY=this.mMotionY;this.mMotionCorrection=0;this.mDirection=0;}else{var _x176=Math.floor(ev.getX());var _y8=Math.floor(ev.getY());var motionPosition=this.pointToPosition(_x176,_y8);if(!this.mDataChanged){if(this.mTouchMode==AbsListView.TOUCH_MODE_FLING){this.createScrollingCache();this.mTouchMode=AbsListView.TOUCH_MODE_SCROLL;this.mMotionCorrection=0;motionPosition=this.findMotionRow(_y8);this.mFlingRunnable.flywheelTouch();}else if(motionPosition>=0&&this.getAdapter().isEnabled(motionPosition)){this.mTouchMode=AbsListView.TOUCH_MODE_DOWN;if(this.mPendingCheckForTap_==null){this.mPendingCheckForTap_=new AbsListView.CheckForTap(this);}this.postDelayed(this.mPendingCheckForTap_,ViewConfiguration.getTapTimeout());}else if(motionPosition<0){this.mTouchMode=AbsListView.TOUCH_MODE_DOWN;}}if(motionPosition>=0){var v=this.getChildAt(motionPosition-this.mFirstPosition);this.mMotionViewOriginalTop=v.getTop();}this.mMotionX=_x176;this.mMotionY=_y8;this.mMotionPosition=motionPosition;this.mLastY=Integer.MIN_VALUE;}if(this.mTouchMode==AbsListView.TOUCH_MODE_DOWN&&this.mMotionPosition!=AbsListView.INVALID_POSITION&&this.performButtonActionOnTouchDown(ev)){this.removeCallbacks(this.mPendingCheckForTap_);}}},{key:'onTouchMove',value:function onTouchMove(ev){var pointerIndex=ev.findPointerIndex(this.mActivePointerId);if(pointerIndex==-1){pointerIndex=0;this.mActivePointerId=ev.getPointerId(pointerIndex);}if(this.mDataChanged){this.layoutChildren();}var y=Math.floor(ev.getY(pointerIndex));switch(this.mTouchMode){case AbsListView.TOUCH_MODE_DOWN:case AbsListView.TOUCH_MODE_TAP:case AbsListView.TOUCH_MODE_DONE_WAITING:if(this.startScrollIfNeeded(y)){break;}var _x177=ev.getX(pointerIndex);if(!this.pointInView(_x177,y,this.mTouchSlop)){this.setPressed(false);var motionView=this.getChildAt(this.mMotionPosition-this.mFirstPosition);if(motionView!=null){motionView.setPressed(false);}this.removeCallbacks(this.mTouchMode==AbsListView.TOUCH_MODE_DOWN?this.mPendingCheckForTap_:this.mPendingCheckForLongPress_List);this.mTouchMode=AbsListView.TOUCH_MODE_DONE_WAITING;this.updateSelectorState();}break;case AbsListView.TOUCH_MODE_SCROLL:case AbsListView.TOUCH_MODE_OVERSCROLL:this.scrollIfNeeded(y);break;}}},{key:'onTouchUp',value:function onTouchUp(ev){var _this103=this;var _ret6=function(){switch(_this103.mTouchMode){case AbsListView.TOUCH_MODE_DOWN:case AbsListView.TOUCH_MODE_TAP:case AbsListView.TOUCH_MODE_DONE_WAITING:var motionPosition=_this103.mMotionPosition;var child=_this103.getChildAt(motionPosition-_this103.mFirstPosition);if(child!=null){if(_this103.mTouchMode!=AbsListView.TOUCH_MODE_DOWN){child.setPressed(false);}var _x178=ev.getX();var inList=_x178>_this103.mListPadding.left&&_x178<_this103.getWidth()-_this103.mListPadding.right;if(inList&&!child.hasFocusable()){var _ret7=function(){if(_this103.mPerformClick_==null){_this103.mPerformClick_=new AbsListView.PerformClick(_this103);}var performClick=_this103.mPerformClick_;performClick.mClickMotionPosition=motionPosition;performClick.rememberWindowAttachCount();_this103.mResurrectToPosition=motionPosition;if(_this103.mTouchMode==AbsListView.TOUCH_MODE_DOWN||_this103.mTouchMode==AbsListView.TOUCH_MODE_TAP){_this103.removeCallbacks(_this103.mTouchMode==AbsListView.TOUCH_MODE_DOWN?_this103.mPendingCheckForTap_:_this103.mPendingCheckForLongPress_List);_this103.mLayoutMode=AbsListView.LAYOUT_NORMAL;if(!_this103.mDataChanged&&_this103.mAdapter.isEnabled(motionPosition)){_this103.mTouchMode=AbsListView.TOUCH_MODE_TAP;_this103.setSelectedPositionInt(_this103.mMotionPosition);_this103.layoutChildren();child.setPressed(true);_this103.positionSelector(_this103.mMotionPosition,child);_this103.setPressed(true);if(_this103.mSelector!=null){var d=_this103.mSelector.getCurrent();}if(_this103.mTouchModeReset!=null){_this103.removeCallbacks(_this103.mTouchModeReset);}_this103.mTouchModeReset=function(){var inner_this=_this103;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'run',value:function run(){inner_this.mTouchModeReset=null;inner_this.mTouchMode=AbsListView.TOUCH_MODE_REST;child.setPressed(false);inner_this.setPressed(false);if(!inner_this.mDataChanged&&inner_this.isAttachedToWindow()){performClick.run();}}}]);return _Inner;}();return new _Inner();}();_this103.postDelayed(_this103.mTouchModeReset,ViewConfiguration.getPressedStateDuration());}else{_this103.mTouchMode=AbsListView.TOUCH_MODE_REST;_this103.updateSelectorState();}return{v:{v:void 0}};}else if(!_this103.mDataChanged&&_this103.mAdapter.isEnabled(motionPosition)){performClick.run();}}();if((typeof _ret7==='undefined'?'undefined':_typeof(_ret7))===\"object\")return _ret7.v;}}_this103.mTouchMode=AbsListView.TOUCH_MODE_REST;_this103.updateSelectorState();break;case AbsListView.TOUCH_MODE_SCROLL:var childCount=_this103.getChildCount();if(childCount>0){var firstChildTop=_this103.getChildAt(0).getTop();var lastChildBottom=_this103.getChildAt(childCount-1).getBottom();var contentTop=_this103.mListPadding.top;var contentBottom=_this103.getHeight()-_this103.mListPadding.bottom;if(_this103.mFirstPosition==0&&firstChildTop>=contentTop&&_this103.mFirstPosition+childCount<_this103.mItemCount&&lastChildBottom<=_this103.getHeight()-contentBottom){_this103.mTouchMode=AbsListView.TOUCH_MODE_REST;_this103.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_IDLE);}else{var _velocityTracker=_this103.mVelocityTracker;_velocityTracker.computeCurrentVelocity(1000,_this103.mMaximumVelocity);var _initialVelocity=Math.floor(_velocityTracker.getYVelocity(_this103.mActivePointerId)*_this103.mVelocityScale);if(Math.abs(_initialVelocity)>_this103.mMinimumVelocity&&!(_this103.mFirstPosition==0&&firstChildTop==contentTop-_this103.mOverscrollDistance||_this103.mFirstPosition+childCount==_this103.mItemCount&&lastChildBottom==contentBottom+_this103.mOverscrollDistance)){if(_this103.mFlingRunnable==null){_this103.mFlingRunnable=new AbsListView.FlingRunnable(_this103);}_this103.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_FLING);_this103.mFlingRunnable.start(-_initialVelocity);}else{_this103.mTouchMode=AbsListView.TOUCH_MODE_REST;_this103.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_IDLE);if(_this103.mFlingRunnable!=null){_this103.mFlingRunnable.endFling();}if(_this103.mPositionScroller!=null){_this103.mPositionScroller.stop();}}}}else{_this103.mTouchMode=AbsListView.TOUCH_MODE_REST;_this103.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_IDLE);}break;case AbsListView.TOUCH_MODE_OVERSCROLL:if(_this103.mFlingRunnable==null){_this103.mFlingRunnable=new AbsListView.FlingRunnable(_this103);}var velocityTracker=_this103.mVelocityTracker;velocityTracker.computeCurrentVelocity(1000,_this103.mMaximumVelocity);var initialVelocity=Math.floor(velocityTracker.getYVelocity(_this103.mActivePointerId));_this103.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_FLING);if(Math.abs(initialVelocity)>_this103.mMinimumVelocity){_this103.mFlingRunnable.startOverfling(-initialVelocity);}else{_this103.mFlingRunnable.startSpringback();}break;}}();if((typeof _ret6==='undefined'?'undefined':_typeof(_ret6))===\"object\")return _ret6.v;this.setPressed(false);this.invalidate();this.removeCallbacks(this.mPendingCheckForLongPress_List);this.recycleVelocityTracker();this.mActivePointerId=AbsListView.INVALID_POINTER;if(AbsListView.PROFILE_SCROLLING){if(this.mScrollProfilingStarted){this.mScrollProfilingStarted=false;}}}},{key:'onTouchCancel',value:function onTouchCancel(){switch(this.mTouchMode){case AbsListView.TOUCH_MODE_OVERSCROLL:if(this.mFlingRunnable==null){this.mFlingRunnable=new AbsListView.FlingRunnable(this);}this.mFlingRunnable.startSpringback();break;case AbsListView.TOUCH_MODE_OVERFLING:break;default:this.mTouchMode=AbsListView.TOUCH_MODE_REST;this.setPressed(false);var motionView=this.getChildAt(this.mMotionPosition-this.mFirstPosition);if(motionView!=null){motionView.setPressed(false);}this.clearScrollingCache();this.removeCallbacks(this.mPendingCheckForLongPress_List);this.recycleVelocityTracker();}this.mActivePointerId=AbsListView.INVALID_POINTER;}},{key:'onOverScrolled',value:function onOverScrolled(scrollX,scrollY,clampedX,clampedY){if(this.mScrollY!=scrollY){this.onScrollChanged(this.mScrollX,scrollY,this.mScrollX,this.mScrollY);this.mScrollY=scrollY;this.invalidateParentIfNeeded();this.awakenScrollBars();}}},{key:'onGenericMotionEvent',value:function onGenericMotionEvent(event){if(event.isPointerEvent()){switch(event.getAction()){case MotionEvent.ACTION_SCROLL:{if(this.mTouchMode==AbsListView.TOUCH_MODE_REST){var vscroll=event.getAxisValue(MotionEvent.AXIS_VSCROLL);if(vscroll!=0){var delta=Math.floor(vscroll*this.getVerticalScrollFactor());if(!this.trackMotionScroll(delta,delta)){return true;}}}}}}return _get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'onGenericMotionEvent',this).call(this,event);}},{key:'draw',value:function draw(canvas){_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'draw',this).call(this,canvas);}},{key:'setOverScrollEffectPadding',value:function setOverScrollEffectPadding(leftPadding,rightPadding){this.mGlowPaddingLeft=leftPadding;this.mGlowPaddingRight=rightPadding;}},{key:'initOrResetVelocityTracker',value:function initOrResetVelocityTracker(){if(this.mVelocityTracker==null){this.mVelocityTracker=VelocityTracker.obtain();}else{this.mVelocityTracker.clear();}}},{key:'initVelocityTrackerIfNotExists',value:function initVelocityTrackerIfNotExists(){if(this.mVelocityTracker==null){this.mVelocityTracker=VelocityTracker.obtain();}}},{key:'recycleVelocityTracker',value:function recycleVelocityTracker(){if(this.mVelocityTracker!=null){this.mVelocityTracker.recycle();this.mVelocityTracker=null;}}},{key:'requestDisallowInterceptTouchEvent',value:function requestDisallowInterceptTouchEvent(disallowIntercept){if(disallowIntercept){this.recycleVelocityTracker();}_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'requestDisallowInterceptTouchEvent',this).call(this,disallowIntercept);}},{key:'onInterceptTouchEvent',value:function onInterceptTouchEvent(ev){var action=ev.getAction();var v=void 0;if(this.mPositionScroller!=null){this.mPositionScroller.stop();}if(!this.isAttachedToWindow()){return false;}switch(action&MotionEvent.ACTION_MASK){case MotionEvent.ACTION_DOWN:{var touchMode=this.mTouchMode;if(touchMode==AbsListView.TOUCH_MODE_OVERFLING||touchMode==AbsListView.TOUCH_MODE_OVERSCROLL){this.mMotionCorrection=0;return true;}var _x179=Math.floor(ev.getX());var _y9=Math.floor(ev.getY());this.mActivePointerId=ev.getPointerId(0);var motionPosition=this.findMotionRow(_y9);if(touchMode!=AbsListView.TOUCH_MODE_FLING&&motionPosition>=0){v=this.getChildAt(motionPosition-this.mFirstPosition);this.mMotionViewOriginalTop=v.getTop();this.mMotionX=_x179;this.mMotionY=_y9;this.mMotionPosition=motionPosition;this.mTouchMode=AbsListView.TOUCH_MODE_DOWN;this.clearScrollingCache();}this.mLastY=Integer.MIN_VALUE;this.initOrResetVelocityTracker();this.mVelocityTracker.addMovement(ev);if(touchMode==AbsListView.TOUCH_MODE_FLING){return true;}break;}case MotionEvent.ACTION_MOVE:{switch(this.mTouchMode){case AbsListView.TOUCH_MODE_DOWN:var pointerIndex=ev.findPointerIndex(this.mActivePointerId);if(pointerIndex==-1){pointerIndex=0;this.mActivePointerId=ev.getPointerId(pointerIndex);}var _y10=Math.floor(ev.getY(pointerIndex));this.initVelocityTrackerIfNotExists();this.mVelocityTracker.addMovement(ev);if(this.startScrollIfNeeded(_y10)){return true;}break;}break;}case MotionEvent.ACTION_CANCEL:case MotionEvent.ACTION_UP:{this.mTouchMode=AbsListView.TOUCH_MODE_REST;this.mActivePointerId=AbsListView.INVALID_POINTER;this.recycleVelocityTracker();this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_IDLE);break;}case MotionEvent.ACTION_POINTER_UP:{this.onSecondaryPointerUp(ev);break;}}return false;}},{key:'onSecondaryPointerUp',value:function onSecondaryPointerUp(ev){var pointerIndex=(ev.getAction()&MotionEvent.ACTION_POINTER_INDEX_MASK)>>MotionEvent.ACTION_POINTER_INDEX_SHIFT;var pointerId=ev.getPointerId(pointerIndex);if(pointerId==this.mActivePointerId){var newPointerIndex=pointerIndex==0?1:0;this.mMotionX=Math.floor(ev.getX(newPointerIndex));this.mMotionY=Math.floor(ev.getY(newPointerIndex));this.mMotionCorrection=0;this.mActivePointerId=ev.getPointerId(newPointerIndex);}}},{key:'addTouchables',value:function addTouchables(views){var count=this.getChildCount();var firstPosition=this.mFirstPosition;var adapter=this.mAdapter;if(adapter==null){return;}for(var i=0;i<count;i++){var child=this.getChildAt(i);if(adapter.isEnabled(firstPosition+i)){views.add(child);}child.addTouchables(views);}}},{key:'reportScrollStateChange',value:function reportScrollStateChange(newState){if(newState!=this.mLastScrollState){if(this.mOnScrollListener!=null){this.mLastScrollState=newState;this.mOnScrollListener.onScrollStateChanged(this,newState);}}}},{key:'setFriction',value:function setFriction(friction){if(this.mFlingRunnable==null){this.mFlingRunnable=new AbsListView.FlingRunnable(this);}this.mFlingRunnable.mScroller.setFriction(friction);}},{key:'setVelocityScale',value:function setVelocityScale(scale){this.mVelocityScale=scale;}},{key:'smoothScrollToPositionFromTop',value:function smoothScrollToPositionFromTop(position,offset,duration){if(this.mPositionScroller==null){this.mPositionScroller=new AbsListView.PositionScroller(this);}this.mPositionScroller.startWithOffset(position,offset,duration);}},{key:'smoothScrollToPosition',value:function smoothScrollToPosition(position,boundPosition){if(this.mPositionScroller==null){this.mPositionScroller=new AbsListView.PositionScroller(this);}this.mPositionScroller.start(position,boundPosition);}},{key:'smoothScrollBy',value:function smoothScrollBy(distance,duration){var linear=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(this.mFlingRunnable==null){this.mFlingRunnable=new AbsListView.FlingRunnable(this);}var firstPos=this.mFirstPosition;var childCount=this.getChildCount();var lastPos=firstPos+childCount;var topLimit=this.getPaddingTop();var bottomLimit=this.getHeight()-this.getPaddingBottom();if(distance==0||this.mItemCount==0||childCount==0||firstPos==0&&this.getChildAt(0).getTop()==topLimit&&distance<0||lastPos==this.mItemCount&&this.getChildAt(childCount-1).getBottom()==bottomLimit&&distance>0){this.mFlingRunnable.endFling();if(this.mPositionScroller!=null){this.mPositionScroller.stop();}}else{this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_FLING);this.mFlingRunnable.startScroll(distance,duration,linear);}}},{key:'smoothScrollByOffset',value:function smoothScrollByOffset(position){var index=-1;if(position<0){index=this.getFirstVisiblePosition();}else if(position>0){index=this.getLastVisiblePosition();}if(index>-1){var child=this.getChildAt(index-this.getFirstVisiblePosition());if(child!=null){var visibleRect=new Rect();if(child.getGlobalVisibleRect(visibleRect)){var childRectArea=child.getWidth()*child.getHeight();var visibleRectArea=visibleRect.width()*visibleRect.height();var visibleArea=visibleRectArea/childRectArea;var visibleThreshold=0.75;if(position<0&&visibleArea<visibleThreshold){++index;}else if(position>0&&visibleArea<visibleThreshold){--index;}}this.smoothScrollToPosition(Math.max(0,Math.min(this.getCount(),index+position)));}}}},{key:'createScrollingCache',value:function createScrollingCache(){if(this.mScrollingCacheEnabled&&!this.mCachingStarted&&!this.isHardwareAccelerated()){this.setChildrenDrawnWithCacheEnabled(true);this.setChildrenDrawingCacheEnabled(true);this.mCachingStarted=this.mCachingActive=true;}}},{key:'clearScrollingCache',value:function clearScrollingCache(){var _this104=this;if(!this.isHardwareAccelerated()){if(this.mClearScrollingCache==null){this.mClearScrollingCache=function(){var inner_this=_this104;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'run',value:function run(){if(inner_this.mCachingStarted){inner_this.mCachingStarted=inner_this.mCachingActive=false;inner_this.setChildrenDrawnWithCacheEnabled(false);if((inner_this.mPersistentDrawingCache&AbsListView.PERSISTENT_SCROLLING_CACHE)==0){inner_this.setChildrenDrawingCacheEnabled(false);}if(!inner_this.isAlwaysDrawnWithCacheEnabled()){inner_this.invalidate();}}}}]);return _Inner;}();return new _Inner();}();}this.post(this.mClearScrollingCache);}}},{key:'scrollListBy',value:function scrollListBy(y){this.trackMotionScroll(-y,-y);}},{key:'canScrollList',value:function canScrollList(direction){var childCount=this.getChildCount();if(childCount==0){return false;}var firstPosition=this.mFirstPosition;var listPadding=this.mListPadding;if(direction>0){var lastBottom=this.getChildAt(childCount-1).getBottom();var lastPosition=firstPosition+childCount;return lastPosition<this.mItemCount||lastBottom>this.getHeight()-listPadding.bottom;}else{var firstTop=this.getChildAt(0).getTop();return firstPosition>0||firstTop<listPadding.top;}}},{key:'trackMotionScroll',value:function trackMotionScroll(deltaY,incrementalDeltaY){var childCount=this.getChildCount();if(childCount==0){return true;}var firstTop=this.getChildAt(0).getTop();var lastBottom=this.getChildAt(childCount-1).getBottom();var listPadding=this.mListPadding;var effectivePaddingTop=0;var effectivePaddingBottom=0;if((this.mGroupFlags&AbsListView.CLIP_TO_PADDING_MASK)==AbsListView.CLIP_TO_PADDING_MASK){effectivePaddingTop=listPadding.top;effectivePaddingBottom=listPadding.bottom;}var spaceAbove=effectivePaddingTop-firstTop;var end=this.getHeight()-effectivePaddingBottom;var spaceBelow=lastBottom-end;var height=this.getHeight()-this.mPaddingBottom-this.mPaddingTop;if(deltaY<0){deltaY=Math.max(-(height-1),deltaY);}else{deltaY=Math.min(height-1,deltaY);}if(incrementalDeltaY<0){incrementalDeltaY=Math.max(-(height-1),incrementalDeltaY);}else{incrementalDeltaY=Math.min(height-1,incrementalDeltaY);}var firstPosition=this.mFirstPosition;if(firstPosition==0){this.mFirstPositionDistanceGuess=firstTop-listPadding.top;}else{this.mFirstPositionDistanceGuess+=incrementalDeltaY;}if(firstPosition+childCount==this.mItemCount){this.mLastPositionDistanceGuess=lastBottom+listPadding.bottom;}else{this.mLastPositionDistanceGuess+=incrementalDeltaY;}var cannotScrollDown=firstPosition==0&&firstTop>=listPadding.top&&incrementalDeltaY>=0;var cannotScrollUp=firstPosition+childCount==this.mItemCount&&lastBottom<=this.getHeight()-listPadding.bottom&&incrementalDeltaY<=0;if(cannotScrollDown||cannotScrollUp){return incrementalDeltaY!=0;}var down=incrementalDeltaY<0;var inTouchMode=this.isInTouchMode();if(inTouchMode){this.hideSelector();}var headerViewsCount=this.getHeaderViewsCount();var footerViewsStart=this.mItemCount-this.getFooterViewsCount();var start=0;var count=0;if(down){var top=-incrementalDeltaY;if((this.mGroupFlags&AbsListView.CLIP_TO_PADDING_MASK)==AbsListView.CLIP_TO_PADDING_MASK){top+=listPadding.top;}for(var i=0;i<childCount;i++){var child=this.getChildAt(i);if(child.getBottom()>=top){break;}else{count++;var position=firstPosition+i;if(position>=headerViewsCount&&position<footerViewsStart){this.mRecycler.addScrapView(child,position);}}}}else{var bottom=this.getHeight()-incrementalDeltaY;if((this.mGroupFlags&AbsListView.CLIP_TO_PADDING_MASK)==AbsListView.CLIP_TO_PADDING_MASK){bottom-=listPadding.bottom;}for(var _i36=childCount-1;_i36>=0;_i36--){var _child14=this.getChildAt(_i36);if(_child14.getTop()<=bottom){break;}else{start=_i36;count++;var _position2=firstPosition+_i36;if(_position2>=headerViewsCount&&_position2<footerViewsStart){this.mRecycler.addScrapView(_child14,_position2);}}}}this.mMotionViewNewTop=this.mMotionViewOriginalTop+deltaY;this.mBlockLayoutRequests=true;if(count>0){this.detachViewsFromParent(start,count);this.mRecycler.removeSkippedScrap();}if(!this.awakenScrollBars()){this.invalidate();}this.offsetChildrenTopAndBottom(incrementalDeltaY);if(down){this.mFirstPosition+=count;}var absIncrementalDeltaY=Math.abs(incrementalDeltaY);if(spaceAbove<absIncrementalDeltaY||spaceBelow<absIncrementalDeltaY){this.fillGap(down);}if(!inTouchMode&&this.mSelectedPosition!=AbsListView.INVALID_POSITION){var childIndex=this.mSelectedPosition-this.mFirstPosition;if(childIndex>=0&&childIndex<this.getChildCount()){this.positionSelector(this.mSelectedPosition,this.getChildAt(childIndex));}}else if(this.mSelectorPosition!=AbsListView.INVALID_POSITION){var _childIndex=this.mSelectorPosition-this.mFirstPosition;if(_childIndex>=0&&_childIndex<this.getChildCount()){this.positionSelector(AbsListView.INVALID_POSITION,this.getChildAt(_childIndex));}}else{this.mSelectorRect.setEmpty();}this.mBlockLayoutRequests=false;this.invokeOnItemScrollListener();return false;}},{key:'getHeaderViewsCount',value:function getHeaderViewsCount(){return 0;}},{key:'getFooterViewsCount',value:function getFooterViewsCount(){return 0;}},{key:'hideSelector',value:function hideSelector(){if(this.mSelectedPosition!=AbsListView.INVALID_POSITION){if(this.mLayoutMode!=AbsListView.LAYOUT_SPECIFIC){this.mResurrectToPosition=this.mSelectedPosition;}if(this.mNextSelectedPosition>=0&&this.mNextSelectedPosition!=this.mSelectedPosition){this.mResurrectToPosition=this.mNextSelectedPosition;}this.setSelectedPositionInt(AbsListView.INVALID_POSITION);this.setNextSelectedPositionInt(AbsListView.INVALID_POSITION);this.mSelectedTop=0;}}},{key:'reconcileSelectedPosition',value:function reconcileSelectedPosition(){var position=this.mSelectedPosition;if(position<0){position=this.mResurrectToPosition;}position=Math.max(0,position);position=Math.min(position,this.mItemCount-1);return position;}},{key:'findClosestMotionRow',value:function findClosestMotionRow(y){var childCount=this.getChildCount();if(childCount==0){return AbsListView.INVALID_POSITION;}var motionRow=this.findMotionRow(y);return motionRow!=AbsListView.INVALID_POSITION?motionRow:this.mFirstPosition+childCount-1;}},{key:'invalidateViews',value:function invalidateViews(){this.mDataChanged=true;this.rememberSyncState();this.requestLayout();this.invalidate();}},{key:'resurrectSelectionIfNeeded',value:function resurrectSelectionIfNeeded(){if(this.mSelectedPosition<0&&this.resurrectSelection()){this.updateSelectorState();return true;}return false;}},{key:'resurrectSelection',value:function resurrectSelection(){var childCount=this.getChildCount();if(childCount<=0){return false;}var selectedTop=0;var selectedPos=void 0;var childrenTop=this.mListPadding.top;var childrenBottom=this.mBottom-this.mTop-this.mListPadding.bottom;var firstPosition=this.mFirstPosition;var toPosition=this.mResurrectToPosition;var down=true;if(toPosition>=firstPosition&&toPosition<firstPosition+childCount){selectedPos=toPosition;var selected=this.getChildAt(selectedPos-this.mFirstPosition);selectedTop=selected.getTop();var selectedBottom=selected.getBottom();if(selectedTop<childrenTop){selectedTop=childrenTop+this.getVerticalFadingEdgeLength();}else if(selectedBottom>childrenBottom){selectedTop=childrenBottom-selected.getMeasuredHeight()-this.getVerticalFadingEdgeLength();}}else{if(toPosition<firstPosition){selectedPos=firstPosition;for(var i=0;i<childCount;i++){var v=this.getChildAt(i);var top=v.getTop();if(i==0){selectedTop=top;if(firstPosition>0||top<childrenTop){childrenTop+=this.getVerticalFadingEdgeLength();}}if(top>=childrenTop){selectedPos=firstPosition+i;selectedTop=top;break;}}}else{var itemCount=this.mItemCount;down=false;selectedPos=firstPosition+childCount-1;for(var _i37=childCount-1;_i37>=0;_i37--){var _v3=this.getChildAt(_i37);var _top=_v3.getTop();var bottom=_v3.getBottom();if(_i37==childCount-1){selectedTop=_top;if(firstPosition+childCount<itemCount||bottom>childrenBottom){childrenBottom-=this.getVerticalFadingEdgeLength();}}if(bottom<=childrenBottom){selectedPos=firstPosition+_i37;selectedTop=_top;break;}}}}this.mResurrectToPosition=AbsListView.INVALID_POSITION;this.removeCallbacks(this.mFlingRunnable);if(this.mPositionScroller!=null){this.mPositionScroller.stop();}this.mTouchMode=AbsListView.TOUCH_MODE_REST;this.clearScrollingCache();this.mSpecificTop=selectedTop;selectedPos=this.lookForSelectablePosition(selectedPos,down);if(selectedPos>=firstPosition&&selectedPos<=this.getLastVisiblePosition()){this.mLayoutMode=AbsListView.LAYOUT_SPECIFIC;this.updateSelectorState();this.setSelectionInt(selectedPos);this.invokeOnItemScrollListener();}else{selectedPos=AbsListView.INVALID_POSITION;}this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_IDLE);return selectedPos>=0;}},{key:'confirmCheckedPositionsById',value:function confirmCheckedPositionsById(){this.mCheckStates.clear();var checkedCountChanged=false;for(var checkedIndex=0;checkedIndex<this.mCheckedIdStates.size();checkedIndex++){var id=this.mCheckedIdStates.keyAt(checkedIndex);var lastPos=this.mCheckedIdStates.valueAt(checkedIndex);var lastPosId=this.mAdapter.getItemId(lastPos);if(id!=lastPosId){var start=Math.max(0,lastPos-AbsListView.CHECK_POSITION_SEARCH_DISTANCE);var end=Math.min(lastPos+AbsListView.CHECK_POSITION_SEARCH_DISTANCE,this.mItemCount);var found=false;for(var searchPos=start;searchPos<end;searchPos++){var searchId=this.mAdapter.getItemId(searchPos);if(id==searchId){found=true;this.mCheckStates.put(searchPos,true);this.mCheckedIdStates.setValueAt(checkedIndex,searchPos);break;}}if(!found){this.mCheckedIdStates.delete(id);checkedIndex--;this.mCheckedItemCount--;checkedCountChanged=true;}}else{this.mCheckStates.put(lastPos,true);}}if(checkedCountChanged&&this.mChoiceActionMode!=null){this.mChoiceActionMode.invalidate();}}},{key:'handleDataChanged',value:function handleDataChanged(){var count=this.mItemCount;var lastHandledItemCount=this.mLastHandledItemCount;this.mLastHandledItemCount=this.mItemCount;if(this.mChoiceMode!=AbsListView.CHOICE_MODE_NONE&&this.mAdapter!=null&&this.mAdapter.hasStableIds()){this.confirmCheckedPositionsById();}this.mRecycler.clearTransientStateViews();if(count>0){var newPos=void 0;var selectablePos=void 0;if(this.mNeedSync){this.mNeedSync=false;this.mPendingSync=null;if(this.mTranscriptMode==AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL){this.mLayoutMode=AbsListView.LAYOUT_FORCE_BOTTOM;return;}else if(this.mTranscriptMode==AbsListView.TRANSCRIPT_MODE_NORMAL){if(this.mForceTranscriptScroll){this.mForceTranscriptScroll=false;this.mLayoutMode=AbsListView.LAYOUT_FORCE_BOTTOM;return;}var childCount=this.getChildCount();var listBottom=this.getHeight()-this.getPaddingBottom();var lastChild=this.getChildAt(childCount-1);var lastBottom=lastChild!=null?lastChild.getBottom():listBottom;if(this.mFirstPosition+childCount>=lastHandledItemCount&&lastBottom<=listBottom){this.mLayoutMode=AbsListView.LAYOUT_FORCE_BOTTOM;return;}this.awakenScrollBars();}switch(this.mSyncMode){case AbsListView.SYNC_SELECTED_POSITION:if(this.isInTouchMode()){this.mLayoutMode=AbsListView.LAYOUT_SYNC;this.mSyncPosition=Math.min(Math.max(0,this.mSyncPosition),count-1);return;}else{newPos=this.findSyncPosition();if(newPos>=0){selectablePos=this.lookForSelectablePosition(newPos,true);if(selectablePos==newPos){this.mSyncPosition=newPos;if(this.mSyncHeight==this.getHeight()){this.mLayoutMode=AbsListView.LAYOUT_SYNC;}else{this.mLayoutMode=AbsListView.LAYOUT_SET_SELECTION;}this.setNextSelectedPositionInt(newPos);return;}}}break;case AbsListView.SYNC_FIRST_POSITION:this.mLayoutMode=AbsListView.LAYOUT_SYNC;this.mSyncPosition=Math.min(Math.max(0,this.mSyncPosition),count-1);return;}}if(!this.isInTouchMode()){newPos=this.getSelectedItemPosition();if(newPos>=count){newPos=count-1;}if(newPos<0){newPos=0;}selectablePos=this.lookForSelectablePosition(newPos,true);if(selectablePos>=0){this.setNextSelectedPositionInt(selectablePos);return;}else{selectablePos=this.lookForSelectablePosition(newPos,false);if(selectablePos>=0){this.setNextSelectedPositionInt(selectablePos);return;}}}else{if(this.mResurrectToPosition>=0){return;}}}this.mLayoutMode=this.mStackFromBottom?AbsListView.LAYOUT_FORCE_BOTTOM:AbsListView.LAYOUT_FORCE_TOP;this.mSelectedPosition=AbsListView.INVALID_POSITION;this.mSelectedRowId=AbsListView.INVALID_ROW_ID;this.mNextSelectedPosition=AbsListView.INVALID_POSITION;this.mNextSelectedRowId=AbsListView.INVALID_ROW_ID;this.mNeedSync=false;this.mPendingSync=null;this.mSelectorPosition=AbsListView.INVALID_POSITION;this.checkSelectionChanged();}},{key:'onDisplayHint',value:function onDisplayHint(hint){_get2(AbsListView.prototype.__proto__||Object.getPrototypeOf(AbsListView.prototype),'onDisplayHint',this).call(this,hint);this.mPopupHidden=hint==AbsListView.INVISIBLE;}},{key:'dismissPopup',value:function dismissPopup(){}},{key:'showPopup',value:function showPopup(){}},{key:'positionPopup',value:function positionPopup(){}},{key:'isInFilterMode',value:function isInFilterMode(){return this.mFiltered;}},{key:'hasTextFilter',value:function hasTextFilter(){return this.mFiltered;}},{key:'onGlobalLayout',value:function onGlobalLayout(){if(this.isShown()){}else{}}},{key:'generateDefaultLayoutParams',value:function generateDefaultLayoutParams(){return new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT,0);}},{key:'generateLayoutParams',value:function generateLayoutParams(p){return new AbsListView.LayoutParams(p);}},{key:'generateLayoutParamsFromAttr',value:function generateLayoutParamsFromAttr(attrs){return new AbsListView.LayoutParams(this.getContext(),attrs);}},{key:'checkLayoutParams',value:function checkLayoutParams(p){return p instanceof AbsListView.LayoutParams;}},{key:'setTranscriptMode',value:function setTranscriptMode(mode){this.mTranscriptMode=mode;}},{key:'getTranscriptMode',value:function getTranscriptMode(){return this.mTranscriptMode;}},{key:'getSolidColor',value:function getSolidColor(){return this.mCacheColorHint;}},{key:'setCacheColorHint',value:function setCacheColorHint(color){if(color!=this.mCacheColorHint){this.mCacheColorHint=color;var count=this.getChildCount();for(var i=0;i<count;i++){this.getChildAt(i).setDrawingCacheBackgroundColor(color);}this.mRecycler.setCacheColorHint(color);}}},{key:'getCacheColorHint',value:function getCacheColorHint(){return this.mCacheColorHint;}},{key:'reclaimViews',value:function reclaimViews(views){var childCount=this.getChildCount();var listener=this.mRecycler.mRecyclerListener;for(var i=0;i<childCount;i++){var child=this.getChildAt(i);var lp=child.getLayoutParams();if(lp!=null&&this.mRecycler.shouldRecycleViewType(lp.viewType)){views.add(child);if(listener!=null){listener.onMovedToScrapHeap(child);}}}this.mRecycler.reclaimScrapViews(views);this.removeAllViewsInLayout();}},{key:'finishGlows',value:function finishGlows(){}},{key:'setVisibleRangeHint',value:function setVisibleRangeHint(start,end){}},{key:'setRecyclerListener',value:function setRecyclerListener(listener){this.mRecycler.mRecyclerListener=listener;}},{key:'mOverflingDistance',get:function get(){if(this.mScrollY<=0){if(this.mScrollY<-this._mOverflingDistance)return-this.mScrollY;return this._mOverflingDistance;}var overDistance=this.mScrollY;if(overDistance>this._mOverflingDistance)return overDistance;return this._mOverflingDistance;},set:function set(value){this._mOverflingDistance=value;}}],[{key:'getDistance',value:function getDistance(source,dest,direction){var sX=void 0,sY=void 0;var dX=void 0,dY=void 0;switch(direction){case View.FOCUS_RIGHT:sX=source.right;sY=source.top+source.height()/2;dX=dest.left;dY=dest.top+dest.height()/2;break;case View.FOCUS_DOWN:sX=source.left+source.width()/2;sY=source.bottom;dX=dest.left+dest.width()/2;dY=dest.top;break;case View.FOCUS_LEFT:sX=source.left;sY=source.top+source.height()/2;dX=dest.right;dY=dest.top+dest.height()/2;break;case View.FOCUS_UP:sX=source.left+source.width()/2;sY=source.top;dX=dest.left+dest.width()/2;dY=dest.bottom;break;case View.FOCUS_FORWARD:case View.FOCUS_BACKWARD:sX=source.right+source.width()/2;sY=source.top+source.height()/2;dX=dest.left+dest.width()/2;dY=dest.top+dest.height()/2;break;default:throw Error('new IllegalArgumentException(\"direction must be one of \" + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, \" + \"FOCUS_FORWARD, FOCUS_BACKWARD}.\")');}var deltaX=dX-sX;var deltaY=dY-sY;return deltaY*deltaY+deltaX*deltaX;}},{key:'retrieveFromScrap',value:function retrieveFromScrap(scrapViews,position){var size=scrapViews.size();if(size>0){for(var i=0;i<size;i++){var view=scrapViews.get(i);if(view.getLayoutParams().scrappedFromPosition==position){scrapViews.remove(i);return view;}}return scrapViews.remove(size-1);}else{return null;}}}]);return AbsListView;}(AdapterView);AbsListView.TAG_AbsListView=\"AbsListView\";AbsListView.TRANSCRIPT_MODE_DISABLED=0;AbsListView.TRANSCRIPT_MODE_NORMAL=1;AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL=2;AbsListView.TOUCH_MODE_REST=-1;AbsListView.TOUCH_MODE_DOWN=0;AbsListView.TOUCH_MODE_TAP=1;AbsListView.TOUCH_MODE_DONE_WAITING=2;AbsListView.TOUCH_MODE_SCROLL=3;AbsListView.TOUCH_MODE_FLING=4;AbsListView.TOUCH_MODE_OVERSCROLL=5;AbsListView.TOUCH_MODE_OVERFLING=6;AbsListView.LAYOUT_NORMAL=0;AbsListView.LAYOUT_FORCE_TOP=1;AbsListView.LAYOUT_SET_SELECTION=2;AbsListView.LAYOUT_FORCE_BOTTOM=3;AbsListView.LAYOUT_SPECIFIC=4;AbsListView.LAYOUT_SYNC=5;AbsListView.LAYOUT_MOVE_SELECTION=6;AbsListView.CHOICE_MODE_NONE=0;AbsListView.CHOICE_MODE_SINGLE=1;AbsListView.CHOICE_MODE_MULTIPLE=2;AbsListView.CHOICE_MODE_MULTIPLE_MODAL=3;AbsListView.OVERSCROLL_LIMIT_DIVISOR=3;AbsListView.CHECK_POSITION_SEARCH_DISTANCE=20;AbsListView.TOUCH_MODE_UNKNOWN=-1;AbsListView.TOUCH_MODE_ON=0;AbsListView.TOUCH_MODE_OFF=1;AbsListView.PROFILE_SCROLLING=false;AbsListView.PROFILE_FLINGING=false;AbsListView.INVALID_POINTER=-1;AbsListView.sLinearInterpolator=new LinearInterpolator();widget.AbsListView=AbsListView;(function(AbsListView){var OnScrollListener;(function(OnScrollListener){OnScrollListener.SCROLL_STATE_IDLE=0;OnScrollListener.SCROLL_STATE_TOUCH_SCROLL=1;OnScrollListener.SCROLL_STATE_FLING=2;})(OnScrollListener=AbsListView.OnScrollListener||(AbsListView.OnScrollListener={}));var WindowRunnnable=function(){function WindowRunnnable(arg){_classCallCheck(this,WindowRunnnable);this._AbsListView_this=arg;}_createClass(WindowRunnnable,[{key:'rememberWindowAttachCount',value:function rememberWindowAttachCount(){this.mOriginalAttachCount=this._AbsListView_this.getWindowAttachCount();}},{key:'sameWindow',value:function sameWindow(){return this._AbsListView_this.getWindowAttachCount()==this.mOriginalAttachCount;}}]);return WindowRunnnable;}();AbsListView.WindowRunnnable=WindowRunnnable;var PerformClick=function(_AbsListView$WindowRu){_inherits(PerformClick,_AbsListView$WindowRu);function PerformClick(arg){_classCallCheck(this,PerformClick);var _this105=_possibleConstructorReturn(this,(PerformClick.__proto__||Object.getPrototypeOf(PerformClick)).call(this,arg));_this105.mClickMotionPosition=0;_this105._AbsListView_this=arg;return _this105;}_createClass(PerformClick,[{key:'run',value:function run(){if(this._AbsListView_this.mDataChanged)return;var adapter=this._AbsListView_this.mAdapter;var motionPosition=this.mClickMotionPosition;if(adapter!=null&&this._AbsListView_this.mItemCount>0&&motionPosition!=AbsListView.INVALID_POSITION&&motionPosition<adapter.getCount()&&this.sameWindow()){var view=this._AbsListView_this.getChildAt(motionPosition-this._AbsListView_this.mFirstPosition);if(view!=null){this._AbsListView_this.performItemClick(view,motionPosition,adapter.getItemId(motionPosition));}}}}]);return PerformClick;}(AbsListView.WindowRunnnable);AbsListView.PerformClick=PerformClick;var CheckForLongPress=function(_AbsListView$WindowRu2){_inherits(CheckForLongPress,_AbsListView$WindowRu2);function CheckForLongPress(arg){_classCallCheck(this,CheckForLongPress);var _this106=_possibleConstructorReturn(this,(CheckForLongPress.__proto__||Object.getPrototypeOf(CheckForLongPress)).call(this,arg));_this106._AbsListView_this=arg;return _this106;}_createClass(CheckForLongPress,[{key:'run',value:function run(){var motionPosition=this._AbsListView_this.mMotionPosition;var child=this._AbsListView_this.getChildAt(motionPosition-this._AbsListView_this.mFirstPosition);if(child!=null){var longPressPosition=this._AbsListView_this.mMotionPosition;var longPressId=this._AbsListView_this.mAdapter.getItemId(this._AbsListView_this.mMotionPosition);var handled=false;if(this.sameWindow()&&!this._AbsListView_this.mDataChanged){handled=this._AbsListView_this.performLongPress(child,longPressPosition,longPressId);}if(handled){this._AbsListView_this.mTouchMode=AbsListView.TOUCH_MODE_REST;this._AbsListView_this.setPressed(false);child.setPressed(false);}else{this._AbsListView_this.mTouchMode=AbsListView.TOUCH_MODE_DONE_WAITING;}}}}]);return CheckForLongPress;}(AbsListView.WindowRunnnable);AbsListView.CheckForLongPress=CheckForLongPress;var CheckForKeyLongPress=function(_AbsListView$WindowRu3){_inherits(CheckForKeyLongPress,_AbsListView$WindowRu3);function CheckForKeyLongPress(arg){_classCallCheck(this,CheckForKeyLongPress);var _this107=_possibleConstructorReturn(this,(CheckForKeyLongPress.__proto__||Object.getPrototypeOf(CheckForKeyLongPress)).call(this,arg));_this107._AbsListView_this=arg;return _this107;}_createClass(CheckForKeyLongPress,[{key:'run',value:function run(){if(this._AbsListView_this.isPressed()&&this._AbsListView_this.mSelectedPosition>=0){var index=this._AbsListView_this.mSelectedPosition-this._AbsListView_this.mFirstPosition;var v=this._AbsListView_this.getChildAt(index);if(!this._AbsListView_this.mDataChanged){var handled=false;if(this.sameWindow()){handled=this._AbsListView_this.performLongPress(v,this._AbsListView_this.mSelectedPosition,this._AbsListView_this.mSelectedRowId);}if(handled){this._AbsListView_this.setPressed(false);v.setPressed(false);}}else{this._AbsListView_this.setPressed(false);if(v!=null)v.setPressed(false);}}}}]);return CheckForKeyLongPress;}(AbsListView.WindowRunnnable);AbsListView.CheckForKeyLongPress=CheckForKeyLongPress;var CheckForTap=function(){function CheckForTap(arg){_classCallCheck(this,CheckForTap);this._AbsListView_this=arg;}_createClass(CheckForTap,[{key:'run',value:function run(){if(this._AbsListView_this.mTouchMode==AbsListView.TOUCH_MODE_DOWN){this._AbsListView_this.mTouchMode=AbsListView.TOUCH_MODE_TAP;var child=this._AbsListView_this.getChildAt(this._AbsListView_this.mMotionPosition-this._AbsListView_this.mFirstPosition);if(child!=null&&!child.hasFocusable()){this._AbsListView_this.mLayoutMode=AbsListView.LAYOUT_NORMAL;if(!this._AbsListView_this.mDataChanged){child.setPressed(true);this._AbsListView_this.setPressed(true);this._AbsListView_this.layoutChildren();this._AbsListView_this.positionSelector(this._AbsListView_this.mMotionPosition,child);this._AbsListView_this.refreshDrawableState();var longPressTimeout=ViewConfiguration.getLongPressTimeout();var longClickable=this._AbsListView_this.isLongClickable();if(this._AbsListView_this.mSelector!=null){var d=this._AbsListView_this.mSelector.getCurrent();}if(longClickable){if(this._AbsListView_this.mPendingCheckForLongPress_List==null){this._AbsListView_this.mPendingCheckForLongPress_List=new AbsListView.CheckForLongPress(this._AbsListView_this);}this._AbsListView_this.mPendingCheckForLongPress_List.rememberWindowAttachCount();this._AbsListView_this.postDelayed(this._AbsListView_this.mPendingCheckForLongPress_List,longPressTimeout);}else{this._AbsListView_this.mTouchMode=AbsListView.TOUCH_MODE_DONE_WAITING;}}else{this._AbsListView_this.mTouchMode=AbsListView.TOUCH_MODE_DONE_WAITING;}}}}}]);return CheckForTap;}();AbsListView.CheckForTap=CheckForTap;var FlingRunnable=function(){function FlingRunnable(arg){var _this108=this;_classCallCheck(this,FlingRunnable);this.mLastFlingY=0;this.mCheckFlywheel=function(){var inner_this=_this108;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'run',value:function run(){var activeId=inner_this._AbsListView_this.mActivePointerId;var vt=inner_this._AbsListView_this.mVelocityTracker;var scroller=inner_this.mScroller;if(vt==null||activeId==AbsListView.INVALID_POINTER){return;}vt.computeCurrentVelocity(1000,inner_this._AbsListView_this.mMaximumVelocity);var yvel=-vt.getYVelocity(activeId);if(Math.abs(yvel)>=inner_this._AbsListView_this.mMinimumVelocity&&scroller.isScrollingInDirection(0,yvel)){inner_this._AbsListView_this.postDelayed(inner_this,FlingRunnable.FLYWHEEL_TIMEOUT);}else{inner_this.endFling();inner_this._AbsListView_this.mTouchMode=AbsListView.TOUCH_MODE_SCROLL;inner_this._AbsListView_this.reportScrollStateChange(OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);}}}]);return _Inner;}();return new _Inner();}();this._AbsListView_this=arg;this.mScroller=new OverScroller();}_createClass(FlingRunnable,[{key:'start',value:function start(initialVelocity){var initialY=initialVelocity<0?Integer.MAX_VALUE:0;this.mLastFlingY=initialY;this.mScroller.setInterpolator(null);this.mScroller.fling(0,initialY,0,initialVelocity,0,Integer.MAX_VALUE,0,Integer.MAX_VALUE);this._AbsListView_this.mTouchMode=AbsListView.TOUCH_MODE_FLING;this._AbsListView_this.postOnAnimation(this);if(AbsListView.PROFILE_FLINGING){if(!this._AbsListView_this.mFlingProfilingStarted){this._AbsListView_this.mFlingProfilingStarted=true;}}}},{key:'startSpringback',value:function startSpringback(){if(this.mScroller.springBack(0,this._AbsListView_this.mScrollY,0,0,0,0)){this._AbsListView_this.mTouchMode=AbsListView.TOUCH_MODE_OVERFLING;this._AbsListView_this.invalidate();this._AbsListView_this.postOnAnimation(this);}else{this._AbsListView_this.mTouchMode=AbsListView.TOUCH_MODE_REST;this._AbsListView_this.reportScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);}}},{key:'startOverfling',value:function startOverfling(initialVelocity){this.mScroller.setInterpolator(null);var minY=Integer.MIN_VALUE,maxY=Integer.MAX_VALUE;if(this._AbsListView_this.mScrollY<0)minY=0;else if(this._AbsListView_this.mScrollY>0)maxY=0;this.mScroller.fling(0,this._AbsListView_this.mScrollY,0,initialVelocity,0,0,minY,maxY,0,this._AbsListView_this.getHeight());this._AbsListView_this.mTouchMode=AbsListView.TOUCH_MODE_OVERFLING;this._AbsListView_this.invalidate();this._AbsListView_this.postOnAnimation(this);}},{key:'edgeReached',value:function edgeReached(delta){this.mScroller.notifyVerticalEdgeReached(this._AbsListView_this.mScrollY,0,this._AbsListView_this.mOverflingDistance);var overscrollMode=this._AbsListView_this.getOverScrollMode();if(overscrollMode==AbsListView.OVER_SCROLL_ALWAYS||overscrollMode==AbsListView.OVER_SCROLL_IF_CONTENT_SCROLLS&&!this._AbsListView_this.contentFits()){this._AbsListView_this.mTouchMode=AbsListView.TOUCH_MODE_OVERFLING;}else{this._AbsListView_this.mTouchMode=AbsListView.TOUCH_MODE_REST;if(this._AbsListView_this.mPositionScroller!=null){this._AbsListView_this.mPositionScroller.stop();}}this._AbsListView_this.invalidate();this._AbsListView_this.postOnAnimation(this);}},{key:'startScroll',value:function startScroll(distance,duration,linear){var initialY=distance<0?Integer.MAX_VALUE:0;this.mLastFlingY=initialY;this.mScroller.setInterpolator(linear?AbsListView.sLinearInterpolator:null);this.mScroller.startScroll(0,initialY,0,distance,duration);this._AbsListView_this.mTouchMode=AbsListView.TOUCH_MODE_FLING;this._AbsListView_this.postOnAnimation(this);}},{key:'endFling',value:function endFling(){this._AbsListView_this.mTouchMode=AbsListView.TOUCH_MODE_REST;this._AbsListView_this.removeCallbacks(this);this._AbsListView_this.removeCallbacks(this.mCheckFlywheel);this._AbsListView_this.reportScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);this._AbsListView_this.clearScrollingCache();this.mScroller.abortAnimation();}},{key:'flywheelTouch',value:function flywheelTouch(){this._AbsListView_this.postDelayed(this.mCheckFlywheel,FlingRunnable.FLYWHEEL_TIMEOUT);}},{key:'run',value:function run(){switch(this._AbsListView_this.mTouchMode){default:this.endFling();return;case AbsListView.TOUCH_MODE_SCROLL:if(this.mScroller.isFinished()){return;}case AbsListView.TOUCH_MODE_FLING:{if(this._AbsListView_this.mDataChanged){this._AbsListView_this.layoutChildren();}if(this._AbsListView_this.mItemCount==0||this._AbsListView_this.getChildCount()==0){this.endFling();return;}var scroller=this.mScroller;var more=scroller.computeScrollOffset();var _y11=scroller.getCurrY();var delta=this.mLastFlingY-_y11;if(delta>0){this._AbsListView_this.mMotionPosition=this._AbsListView_this.mFirstPosition;var firstView=this._AbsListView_this.getChildAt(0);this._AbsListView_this.mMotionViewOriginalTop=firstView.getTop();delta=Math.min(this._AbsListView_this.getHeight()-this._AbsListView_this.mPaddingBottom-this._AbsListView_this.mPaddingTop-1,delta);}else{var offsetToLast=this._AbsListView_this.getChildCount()-1;this._AbsListView_this.mMotionPosition=this._AbsListView_this.mFirstPosition+offsetToLast;var lastView=this._AbsListView_this.getChildAt(offsetToLast);this._AbsListView_this.mMotionViewOriginalTop=lastView.getTop();delta=Math.max(-(this._AbsListView_this.getHeight()-this._AbsListView_this.mPaddingBottom-this._AbsListView_this.mPaddingTop-1),delta);}var motionView=this._AbsListView_this.getChildAt(this._AbsListView_this.mMotionPosition-this._AbsListView_this.mFirstPosition);var oldTop=0;if(motionView!=null){oldTop=motionView.getTop();}var atEdge=this._AbsListView_this.trackMotionScroll(delta,delta);var atEnd=atEdge&&delta!=0;if(atEnd){if(motionView!=null){var overshoot=-(delta-(motionView.getTop()-oldTop));this._AbsListView_this.overScrollBy(0,overshoot,0,this._AbsListView_this.mScrollY,0,0,0,this._AbsListView_this.mOverflingDistance,false);}if(more){this.edgeReached(delta);}break;}if(more&&!atEnd){if(atEdge)this._AbsListView_this.invalidate();this.mLastFlingY=_y11;this._AbsListView_this.postOnAnimation(this);}else{this.endFling();if(AbsListView.PROFILE_FLINGING){if(this._AbsListView_this.mFlingProfilingStarted){this._AbsListView_this.mFlingProfilingStarted=false;}}}break;}case AbsListView.TOUCH_MODE_OVERFLING:{var _scroller=this.mScroller;if(_scroller.computeScrollOffset()){var scrollY=this._AbsListView_this.mScrollY;var currY=_scroller.getCurrY();var deltaY=currY-scrollY;var crossDown=scrollY<=0&&currY>0;var crossUp=scrollY>=0&&currY<0;if(crossDown||crossUp){var velocity=Math.floor(_scroller.getCurrVelocity());if(crossUp)velocity=-velocity;_scroller.abortAnimation();this.start(velocity);deltaY=-scrollY;}if(this._AbsListView_this.overScrollBy(0,deltaY,0,scrollY,0,0,0,this._AbsListView_this.mOverflingDistance,false)){this.startSpringback();}else{this._AbsListView_this.invalidate();this._AbsListView_this.postOnAnimation(this);}}else{this.endFling();}break;}}}}]);return FlingRunnable;}();FlingRunnable.FLYWHEEL_TIMEOUT=40;AbsListView.FlingRunnable=FlingRunnable;var PositionScroller=function(){function PositionScroller(arg){_classCallCheck(this,PositionScroller);this.mMode=0;this.mTargetPos=0;this.mBoundPos=0;this.mLastSeenPos=0;this.mScrollDuration=0;this.mExtraScroll=0;this.mOffsetFromTop=0;this._AbsListView_this=arg;this.mExtraScroll=ViewConfiguration.get().getScaledFadingEdgeLength();}_createClass(PositionScroller,[{key:'start',value:function start(position,boundPosition){if(boundPosition==null)this._start_1(position);else this._start_2(position,boundPosition);}},{key:'_start_1',value:function _start_1(position){var _this109=this;this.stop();if(this._AbsListView_this.mDataChanged){this._AbsListView_this.mPositionScrollAfterLayout=function(){var inner_this=_this109;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'run',value:function run(){inner_this.start(position);}}]);return _Inner;}();return new _Inner();}();return;}var childCount=this._AbsListView_this.getChildCount();if(childCount==0){return;}var firstPos=this._AbsListView_this.mFirstPosition;var lastPos=firstPos+childCount-1;var viewTravelCount=void 0;var clampedPosition=Math.max(0,Math.min(this._AbsListView_this.getCount()-1,position));if(clampedPosition<firstPos){viewTravelCount=firstPos-clampedPosition+1;this.mMode=PositionScroller.MOVE_UP_POS;}else if(clampedPosition>lastPos){viewTravelCount=clampedPosition-lastPos+1;this.mMode=PositionScroller.MOVE_DOWN_POS;}else{this.scrollToVisible(clampedPosition,AbsListView.INVALID_POSITION,PositionScroller.SCROLL_DURATION);return;}if(viewTravelCount>0){this.mScrollDuration=PositionScroller.SCROLL_DURATION/viewTravelCount;}else{this.mScrollDuration=PositionScroller.SCROLL_DURATION;}this.mTargetPos=clampedPosition;this.mBoundPos=AbsListView.INVALID_POSITION;this.mLastSeenPos=AbsListView.INVALID_POSITION;this._AbsListView_this.postOnAnimation(this);}},{key:'_start_2',value:function _start_2(position,boundPosition){var _this110=this;this.stop();if(boundPosition==AbsListView.INVALID_POSITION){this.start(position);return;}if(this._AbsListView_this.mDataChanged){this._AbsListView_this.mPositionScrollAfterLayout=function(){var inner_this=_this110;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'run',value:function run(){inner_this.start(position,boundPosition);}}]);return _Inner;}();return new _Inner();}();return;}var childCount=this._AbsListView_this.getChildCount();if(childCount==0){return;}var firstPos=this._AbsListView_this.mFirstPosition;var lastPos=firstPos+childCount-1;var viewTravelCount=void 0;var clampedPosition=Math.max(0,Math.min(this._AbsListView_this.getCount()-1,position));if(clampedPosition<firstPos){var boundPosFromLast=lastPos-boundPosition;if(boundPosFromLast<1){return;}var posTravel=firstPos-clampedPosition+1;var boundTravel=boundPosFromLast-1;if(boundTravel<posTravel){viewTravelCount=boundTravel;this.mMode=PositionScroller.MOVE_UP_BOUND;}else{viewTravelCount=posTravel;this.mMode=PositionScroller.MOVE_UP_POS;}}else if(clampedPosition>lastPos){var boundPosFromFirst=boundPosition-firstPos;if(boundPosFromFirst<1){return;}var _posTravel=clampedPosition-lastPos+1;var _boundTravel=boundPosFromFirst-1;if(_boundTravel<_posTravel){viewTravelCount=_boundTravel;this.mMode=PositionScroller.MOVE_DOWN_BOUND;}else{viewTravelCount=_posTravel;this.mMode=PositionScroller.MOVE_DOWN_POS;}}else{this.scrollToVisible(clampedPosition,boundPosition,PositionScroller.SCROLL_DURATION);return;}if(viewTravelCount>0){this.mScrollDuration=PositionScroller.SCROLL_DURATION/viewTravelCount;}else{this.mScrollDuration=PositionScroller.SCROLL_DURATION;}this.mTargetPos=clampedPosition;this.mBoundPos=boundPosition;this.mLastSeenPos=AbsListView.INVALID_POSITION;this._AbsListView_this.postOnAnimation(this);}},{key:'startWithOffset',value:function startWithOffset(position,offset){var _this111=this;var duration=arguments.length>2&&arguments[2]!==undefined?arguments[2]:PositionScroller.SCROLL_DURATION;this.stop();if(this._AbsListView_this.mDataChanged){var _ret8=function(){var postOffset=offset;_this111._AbsListView_this.mPositionScrollAfterLayout=function(){var inner_this=_this111;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'run',value:function run(){inner_this.startWithOffset(position,postOffset,duration);}}]);return _Inner;}();return new _Inner();}();return{v:void 0};}();if((typeof _ret8==='undefined'?'undefined':_typeof(_ret8))===\"object\")return _ret8.v;}var childCount=this._AbsListView_this.getChildCount();if(childCount==0){return;}offset+=this._AbsListView_this.getPaddingTop();this.mTargetPos=Math.max(0,Math.min(this._AbsListView_this.getCount()-1,position));this.mOffsetFromTop=offset;this.mBoundPos=AbsListView.INVALID_POSITION;this.mLastSeenPos=AbsListView.INVALID_POSITION;this.mMode=PositionScroller.MOVE_OFFSET;var firstPos=this._AbsListView_this.mFirstPosition;var lastPos=firstPos+childCount-1;var viewTravelCount=void 0;if(this.mTargetPos<firstPos){viewTravelCount=firstPos-this.mTargetPos;}else if(this.mTargetPos>lastPos){viewTravelCount=this.mTargetPos-lastPos;}else{var targetTop=this._AbsListView_this.getChildAt(this.mTargetPos-firstPos).getTop();this._AbsListView_this.smoothScrollBy(targetTop-offset,duration,true);return;}var screenTravelCount=viewTravelCount/childCount;this.mScrollDuration=screenTravelCount<1?duration:Math.floor(duration/screenTravelCount);this.mLastSeenPos=AbsListView.INVALID_POSITION;this._AbsListView_this.postOnAnimation(this);}},{key:'scrollToVisible',value:function scrollToVisible(targetPos,boundPos,duration){var firstPos=this._AbsListView_this.mFirstPosition;var childCount=this._AbsListView_this.getChildCount();var lastPos=firstPos+childCount-1;var paddedTop=this._AbsListView_this.mListPadding.top;var paddedBottom=this._AbsListView_this.getHeight()-this._AbsListView_this.mListPadding.bottom;if(targetPos<firstPos||targetPos>lastPos){Log.w(AbsListView.TAG_AbsListView,\"scrollToVisible called with targetPos \"+targetPos+\" not visible [\"+firstPos+\", \"+lastPos+\"]\");}if(boundPos<firstPos||boundPos>lastPos){boundPos=AbsListView.INVALID_POSITION;}var targetChild=this._AbsListView_this.getChildAt(targetPos-firstPos);var targetTop=targetChild.getTop();var targetBottom=targetChild.getBottom();var scrollBy=0;if(targetBottom>paddedBottom){scrollBy=targetBottom-paddedBottom;}if(targetTop<paddedTop){scrollBy=targetTop-paddedTop;}if(scrollBy==0){return;}if(boundPos>=0){var boundChild=this._AbsListView_this.getChildAt(boundPos-firstPos);var boundTop=boundChild.getTop();var boundBottom=boundChild.getBottom();var absScroll=Math.abs(scrollBy);if(scrollBy<0&&boundBottom+absScroll>paddedBottom){scrollBy=Math.max(0,boundBottom-paddedBottom);}else if(scrollBy>0&&boundTop-absScroll<paddedTop){scrollBy=Math.min(0,boundTop-paddedTop);}}this._AbsListView_this.smoothScrollBy(scrollBy,duration);}},{key:'stop',value:function stop(){this._AbsListView_this.removeCallbacks(this);}},{key:'run',value:function run(){var listHeight=this._AbsListView_this.getHeight();var firstPos=this._AbsListView_this.mFirstPosition;switch(this.mMode){case PositionScroller.MOVE_DOWN_POS:{var lastViewIndex=this._AbsListView_this.getChildCount()-1;var lastPos=firstPos+lastViewIndex;if(lastViewIndex<0){return;}if(lastPos==this.mLastSeenPos){this._AbsListView_this.postOnAnimation(this);return;}var lastView=this._AbsListView_this.getChildAt(lastViewIndex);var lastViewHeight=lastView.getHeight();var lastViewTop=lastView.getTop();var lastViewPixelsShowing=listHeight-lastViewTop;var extraScroll=lastPos<this._AbsListView_this.mItemCount-1?Math.max(this._AbsListView_this.mListPadding.bottom,this.mExtraScroll):this._AbsListView_this.mListPadding.bottom;var scrollBy=lastViewHeight-lastViewPixelsShowing+extraScroll;this._AbsListView_this.smoothScrollBy(scrollBy,this.mScrollDuration,true);this.mLastSeenPos=lastPos;if(lastPos<this.mTargetPos){this._AbsListView_this.postOnAnimation(this);}break;}case PositionScroller.MOVE_DOWN_BOUND:{var nextViewIndex=1;var childCount=this._AbsListView_this.getChildCount();if(firstPos==this.mBoundPos||childCount<=nextViewIndex||firstPos+childCount>=this._AbsListView_this.mItemCount){return;}var nextPos=firstPos+nextViewIndex;if(nextPos==this.mLastSeenPos){this._AbsListView_this.postOnAnimation(this);return;}var nextView=this._AbsListView_this.getChildAt(nextViewIndex);var nextViewHeight=nextView.getHeight();var nextViewTop=nextView.getTop();var _extraScroll=Math.max(this._AbsListView_this.mListPadding.bottom,this.mExtraScroll);if(nextPos<this.mBoundPos){this._AbsListView_this.smoothScrollBy(Math.max(0,nextViewHeight+nextViewTop-_extraScroll),this.mScrollDuration,true);this.mLastSeenPos=nextPos;this._AbsListView_this.postOnAnimation(this);}else{if(nextViewTop>_extraScroll){this._AbsListView_this.smoothScrollBy(nextViewTop-_extraScroll,this.mScrollDuration,true);}}break;}case PositionScroller.MOVE_UP_POS:{if(firstPos==this.mLastSeenPos){this._AbsListView_this.postOnAnimation(this);return;}var firstView=this._AbsListView_this.getChildAt(0);if(firstView==null){return;}var firstViewTop=firstView.getTop();var _extraScroll2=firstPos>0?Math.max(this.mExtraScroll,this._AbsListView_this.mListPadding.top):this._AbsListView_this.mListPadding.top;this._AbsListView_this.smoothScrollBy(firstViewTop-_extraScroll2,this.mScrollDuration,true);this.mLastSeenPos=firstPos;if(firstPos>this.mTargetPos){this._AbsListView_this.postOnAnimation(this);}break;}case PositionScroller.MOVE_UP_BOUND:{var _lastViewIndex=this._AbsListView_this.getChildCount()-2;if(_lastViewIndex<0){return;}var _lastPos=firstPos+_lastViewIndex;if(_lastPos==this.mLastSeenPos){this._AbsListView_this.postOnAnimation(this);return;}var _lastView=this._AbsListView_this.getChildAt(_lastViewIndex);var _lastViewHeight=_lastView.getHeight();var _lastViewTop=_lastView.getTop();var _lastViewPixelsShowing=listHeight-_lastViewTop;var _extraScroll3=Math.max(this._AbsListView_this.mListPadding.top,this.mExtraScroll);this.mLastSeenPos=_lastPos;if(_lastPos>this.mBoundPos){this._AbsListView_this.smoothScrollBy(-(_lastViewPixelsShowing-_extraScroll3),this.mScrollDuration,true);this._AbsListView_this.postOnAnimation(this);}else{var bottom=listHeight-_extraScroll3;var lastViewBottom=_lastViewTop+_lastViewHeight;if(bottom>lastViewBottom){this._AbsListView_this.smoothScrollBy(-(bottom-lastViewBottom),this.mScrollDuration,true);}}break;}case PositionScroller.MOVE_OFFSET:{if(this.mLastSeenPos==firstPos){this._AbsListView_this.postOnAnimation(this);return;}this.mLastSeenPos=firstPos;var _childCount=this._AbsListView_this.getChildCount();var position=this.mTargetPos;var _lastPos2=firstPos+_childCount-1;var viewTravelCount=0;if(position<firstPos){viewTravelCount=firstPos-position+1;}else if(position>_lastPos2){viewTravelCount=position-_lastPos2;}var screenTravelCount=viewTravelCount/_childCount;var modifier=Math.min(Math.abs(screenTravelCount),1.);if(position<firstPos){var distance=Math.floor(-this._AbsListView_this.getHeight()*modifier);var duration=Math.floor(this.mScrollDuration*modifier);this._AbsListView_this.smoothScrollBy(distance,duration,true);this._AbsListView_this.postOnAnimation(this);}else if(position>_lastPos2){var _distance=Math.floor(this._AbsListView_this.getHeight()*modifier);var _duration=Math.floor(this.mScrollDuration*modifier);this._AbsListView_this.smoothScrollBy(_distance,_duration,true);this._AbsListView_this.postOnAnimation(this);}else{var targetTop=this._AbsListView_this.getChildAt(position-firstPos).getTop();var _distance2=targetTop-this.mOffsetFromTop;var _duration2=Math.floor(this.mScrollDuration*(Math.abs(_distance2)/this._AbsListView_this.getHeight()));this._AbsListView_this.smoothScrollBy(_distance2,_duration2,true);}break;}default:break;}}}]);return PositionScroller;}();PositionScroller.SCROLL_DURATION=200;PositionScroller.MOVE_DOWN_POS=1;PositionScroller.MOVE_UP_POS=2;PositionScroller.MOVE_DOWN_BOUND=3;PositionScroller.MOVE_UP_BOUND=4;PositionScroller.MOVE_OFFSET=5;AbsListView.PositionScroller=PositionScroller;var AdapterDataSetObserver=function(_AdapterView$AdapterD){_inherits(AdapterDataSetObserver,_AdapterView$AdapterD);function AdapterDataSetObserver(arg){_classCallCheck(this,AdapterDataSetObserver);var _this112=_possibleConstructorReturn(this,(AdapterDataSetObserver.__proto__||Object.getPrototypeOf(AdapterDataSetObserver)).call(this,arg));_this112._AbsListView_this=arg;return _this112;}_createClass(AdapterDataSetObserver,[{key:'onChanged',value:function onChanged(){_get2(AdapterDataSetObserver.prototype.__proto__||Object.getPrototypeOf(AdapterDataSetObserver.prototype),'onChanged',this).call(this);}},{key:'onInvalidated',value:function onInvalidated(){_get2(AdapterDataSetObserver.prototype.__proto__||Object.getPrototypeOf(AdapterDataSetObserver.prototype),'onInvalidated',this).call(this);}}]);return AdapterDataSetObserver;}(AdapterView.AdapterDataSetObserver);AbsListView.AdapterDataSetObserver=AdapterDataSetObserver;var LayoutParams=function(_ViewGroup$LayoutPara){_inherits(LayoutParams,_ViewGroup$LayoutPara);function LayoutParams(){var _ref8;for(var _len27=arguments.length,args=Array(_len27),_key28=0;_key28<_len27;_key28++){args[_key28]=arguments[_key28];}_classCallCheck(this,LayoutParams);var _this113=_possibleConstructorReturn(this,(_ref8=LayoutParams.__proto__||Object.getPrototypeOf(LayoutParams)).call.apply(_ref8,[this].concat(_toConsumableArray(function(){if(args[0]instanceof android.content.Context&&args[1]instanceof HTMLElement)return[args[0],args[1]];else if(typeof args[0]==='number'&&typeof args[1]==='number'&&typeof args[2]==='number')return[args[0],args[1]];else if(typeof args[0]==='number'&&typeof args[1]==='number')return[args[0],args[1]];else if(args[0]instanceof ViewGroup.LayoutParams)return[args[0]];}()))));_this113.viewType=0;_this113.scrappedFromPosition=0;_this113.itemId=-1;if(args[0]instanceof android.content.Context&&args[1]instanceof HTMLElement){}else if(typeof args[0]==='number'&&typeof args[1]==='number'&&typeof args[2]=='number'){_this113.viewType=args[2];}else if(typeof args[0]==='number'&&typeof args[1]==='number'){}else if(args[0]instanceof ViewGroup.LayoutParams){}return _this113;}return LayoutParams;}(ViewGroup.LayoutParams);AbsListView.LayoutParams=LayoutParams;var RecycleBin=function(){function RecycleBin(arg){_classCallCheck(this,RecycleBin);this.mFirstActivePosition=0;this.mActiveViews=[];this.mViewTypeCount=0;this._AbsListView_this=arg;}_createClass(RecycleBin,[{key:'setViewTypeCount',value:function setViewTypeCount(viewTypeCount){if(viewTypeCount<1){throw Error('new IllegalArgumentException(\"Can\\'t have a viewTypeCount < 1\")');}var scrapViews=new Array(viewTypeCount);for(var i=0;i<viewTypeCount;i++){scrapViews[i]=new ArrayList();}this.mViewTypeCount=viewTypeCount;this.mCurrentScrap=scrapViews[0];this.mScrapViews=scrapViews;}},{key:'markChildrenDirty',value:function markChildrenDirty(){if(this.mViewTypeCount==1){var scrap=this.mCurrentScrap;var scrapCount=scrap.size();for(var i=0;i<scrapCount;i++){scrap.get(i).forceLayout();}}else{var typeCount=this.mViewTypeCount;for(var _i38=0;_i38<typeCount;_i38++){var _scrap=this.mScrapViews[_i38];var _scrapCount=_scrap.size();for(var j=0;j<_scrapCount;j++){_scrap.get(j).forceLayout();}}}if(this.mTransientStateViews!=null){var count=this.mTransientStateViews.size();for(var _i39=0;_i39<count;_i39++){this.mTransientStateViews.valueAt(_i39).forceLayout();}}if(this.mTransientStateViewsById!=null){var _count=this.mTransientStateViewsById.size();for(var _i40=0;_i40<_count;_i40++){this.mTransientStateViewsById.valueAt(_i40).forceLayout();}}}},{key:'shouldRecycleViewType',value:function shouldRecycleViewType(viewType){return viewType>=0;}},{key:'clear',value:function clear(){if(this.mViewTypeCount==1){var scrap=this.mCurrentScrap;var scrapCount=scrap.size();for(var i=0;i<scrapCount;i++){this._AbsListView_this.removeDetachedView(scrap.remove(scrapCount-1-i),false);}}else{var typeCount=this.mViewTypeCount;for(var _i41=0;_i41<typeCount;_i41++){var _scrap2=this.mScrapViews[_i41];var _scrapCount2=_scrap2.size();for(var j=0;j<_scrapCount2;j++){this._AbsListView_this.removeDetachedView(_scrap2.remove(_scrapCount2-1-j),false);}}}if(this.mTransientStateViews!=null){this.mTransientStateViews.clear();}if(this.mTransientStateViewsById!=null){this.mTransientStateViewsById.clear();}}},{key:'fillActiveViews',value:function fillActiveViews(childCount,firstActivePosition){if(this.mActiveViews.length<childCount){this.mActiveViews=new Array(childCount);}this.mFirstActivePosition=firstActivePosition;var activeViews=this.mActiveViews;for(var i=0;i<childCount;i++){var child=this._AbsListView_this.getChildAt(i);var lp=child.getLayoutParams();if(lp!=null&&lp.viewType!=AbsListView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER){activeViews[i]=child;}}}},{key:'getActiveView',value:function getActiveView(position){var index=position-this.mFirstActivePosition;var activeViews=this.mActiveViews;if(index>=0&&index<activeViews.length){var match=activeViews[index];activeViews[index]=null;return match;}return null;}},{key:'getTransientStateView',value:function getTransientStateView(position){if(this._AbsListView_this.mAdapter!=null&&this._AbsListView_this.mAdapterHasStableIds&&this.mTransientStateViewsById!=null){var id=this._AbsListView_this.mAdapter.getItemId(position);var result=this.mTransientStateViewsById.get(id);this.mTransientStateViewsById.remove(id);return result;}if(this.mTransientStateViews!=null){var index=this.mTransientStateViews.indexOfKey(position);if(index>=0){var _result=this.mTransientStateViews.valueAt(index);this.mTransientStateViews.removeAt(index);return _result;}}return null;}},{key:'clearTransientStateViews',value:function clearTransientStateViews(){if(this.mTransientStateViews!=null){this.mTransientStateViews.clear();}if(this.mTransientStateViewsById!=null){this.mTransientStateViewsById.clear();}}},{key:'getScrapView',value:function getScrapView(position){if(this.mViewTypeCount==1){return AbsListView.retrieveFromScrap(this.mCurrentScrap,position);}else{var whichScrap=this._AbsListView_this.mAdapter.getItemViewType(position);if(whichScrap>=0&&whichScrap<this.mScrapViews.length){return AbsListView.retrieveFromScrap(this.mScrapViews[whichScrap],position);}}return null;}},{key:'addScrapView',value:function addScrapView(scrap,position){var lp=scrap.getLayoutParams();if(lp==null){return;}lp.scrappedFromPosition=position;var viewType=lp.viewType;if(!this.shouldRecycleViewType(viewType)){return;}scrap.dispatchStartTemporaryDetach();var scrapHasTransientState=scrap.hasTransientState();if(scrapHasTransientState){if(this._AbsListView_this.mAdapter!=null&&this._AbsListView_this.mAdapterHasStableIds){if(this.mTransientStateViewsById==null){this.mTransientStateViewsById=new LongSparseArray();}this.mTransientStateViewsById.put(lp.itemId,scrap);}else if(!this._AbsListView_this.mDataChanged){if(this.mTransientStateViews==null){this.mTransientStateViews=new SparseArray();}this.mTransientStateViews.put(position,scrap);}else{if(this.mSkippedScrap==null){this.mSkippedScrap=new ArrayList();}this.mSkippedScrap.add(scrap);}}else{if(this.mViewTypeCount==1){this.mCurrentScrap.add(scrap);}else{this.mScrapViews[viewType].add(scrap);}if(this.mRecyclerListener!=null){this.mRecyclerListener.onMovedToScrapHeap(scrap);}}}},{key:'removeSkippedScrap',value:function removeSkippedScrap(){if(this.mSkippedScrap==null){return;}var count=this.mSkippedScrap.size();for(var i=0;i<count;i++){this._AbsListView_this.removeDetachedView(this.mSkippedScrap.get(i),false);}this.mSkippedScrap.clear();}},{key:'scrapActiveViews',value:function scrapActiveViews(){var activeViews=this.mActiveViews;var hasListener=this.mRecyclerListener!=null;var multipleScraps=this.mViewTypeCount>1;var scrapViews=this.mCurrentScrap;var count=activeViews.length;for(var i=count-1;i>=0;i--){var victim=activeViews[i];if(victim!=null){var lp=victim.getLayoutParams();var whichScrap=lp.viewType;activeViews[i]=null;var scrapHasTransientState=victim.hasTransientState();if(!this.shouldRecycleViewType(whichScrap)||scrapHasTransientState){if(whichScrap!=AbsListView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER&&scrapHasTransientState){this._AbsListView_this.removeDetachedView(victim,false);}if(scrapHasTransientState){if(this._AbsListView_this.mAdapter!=null&&this._AbsListView_this.mAdapterHasStableIds){if(this.mTransientStateViewsById==null){this.mTransientStateViewsById=new LongSparseArray();}var id=this._AbsListView_this.mAdapter.getItemId(this.mFirstActivePosition+i);this.mTransientStateViewsById.put(id,victim);}else{if(this.mTransientStateViews==null){this.mTransientStateViews=new SparseArray();}this.mTransientStateViews.put(this.mFirstActivePosition+i,victim);}}continue;}if(multipleScraps){scrapViews=this.mScrapViews[whichScrap];}victim.dispatchStartTemporaryDetach();lp.scrappedFromPosition=this.mFirstActivePosition+i;scrapViews.add(victim);if(hasListener){this.mRecyclerListener.onMovedToScrapHeap(victim);}}}this.pruneScrapViews();}},{key:'pruneScrapViews',value:function pruneScrapViews(){var maxViews=this.mActiveViews.length;var viewTypeCount=this.mViewTypeCount;var scrapViews=this.mScrapViews;for(var i=0;i<viewTypeCount;++i){var scrapPile=scrapViews[i];var size=scrapPile.size();var extras=size-maxViews;size--;for(var j=0;j<extras;j++){this._AbsListView_this.removeDetachedView(scrapPile.remove(size--),false);}}if(this.mTransientStateViews!=null){for(var _i42=0;_i42<this.mTransientStateViews.size();_i42++){var v=this.mTransientStateViews.valueAt(_i42);if(!v.hasTransientState()){this.mTransientStateViews.removeAt(_i42);_i42--;}}}if(this.mTransientStateViewsById!=null){for(var _i43=0;_i43<this.mTransientStateViewsById.size();_i43++){var _v4=this.mTransientStateViewsById.valueAt(_i43);if(!_v4.hasTransientState()){this.mTransientStateViewsById.removeAt(_i43);_i43--;}}}}},{key:'reclaimScrapViews',value:function reclaimScrapViews(views){if(this.mViewTypeCount==1){views.addAll(this.mCurrentScrap);}else{var viewTypeCount=this.mViewTypeCount;var scrapViews=this.mScrapViews;for(var i=0;i<viewTypeCount;++i){var scrapPile=scrapViews[i];views.addAll(scrapPile);}}}},{key:'setCacheColorHint',value:function setCacheColorHint(color){if(this.mViewTypeCount==1){var scrap=this.mCurrentScrap;var scrapCount=scrap.size();for(var i=0;i<scrapCount;i++){scrap.get(i).setDrawingCacheBackgroundColor(color);}}else{var typeCount=this.mViewTypeCount;for(var _i44=0;_i44<typeCount;_i44++){var _scrap3=this.mScrapViews[_i44];var _scrapCount3=_scrap3.size();for(var j=0;j<_scrapCount3;j++){_scrap3.get(j).setDrawingCacheBackgroundColor(color);}}}var activeViews=this.mActiveViews;var count=activeViews.length;for(var _i45=0;_i45<count;++_i45){var victim=activeViews[_i45];if(victim!=null){victim.setDrawingCacheBackgroundColor(color);}}}}]);return RecycleBin;}();AbsListView.RecycleBin=RecycleBin;})(AbsListView=widget.AbsListView||(widget.AbsListView={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var ArrayList=java.util.ArrayList;var AdapterView=android.widget.AdapterView;var HeaderViewListAdapter=function(){function HeaderViewListAdapter(headerViewInfos,footerViewInfos,adapter){_classCallCheck(this,HeaderViewListAdapter);this.mAdapter=adapter;this.mIsFilterable=false;if(headerViewInfos==null){this.mHeaderViewInfos=HeaderViewListAdapter.EMPTY_INFO_LIST;}else{this.mHeaderViewInfos=headerViewInfos;}if(footerViewInfos==null){this.mFooterViewInfos=HeaderViewListAdapter.EMPTY_INFO_LIST;}else{this.mFooterViewInfos=footerViewInfos;}this.mAreAllFixedViewsSelectable=this.areAllListInfosSelectable(this.mHeaderViewInfos)&&this.areAllListInfosSelectable(this.mFooterViewInfos);}_createClass(HeaderViewListAdapter,[{key:'getHeadersCount',value:function getHeadersCount(){return this.mHeaderViewInfos.size();}},{key:'getFootersCount',value:function getFootersCount(){return this.mFooterViewInfos.size();}},{key:'isEmpty',value:function isEmpty(){return this.mAdapter==null||this.mAdapter.isEmpty();}},{key:'areAllListInfosSelectable',value:function areAllListInfosSelectable(infos){if(infos!=null){var _iteratorNormalCompletion67=true;var _didIteratorError67=false;var _iteratorError67=undefined;try{for(var _iterator67=infos.array[Symbol.iterator](),_step67;!(_iteratorNormalCompletion67=(_step67=_iterator67.next()).done);_iteratorNormalCompletion67=true){var info=_step67.value;if(!info.isSelectable){return false;}}}catch(err){_didIteratorError67=true;_iteratorError67=err;}finally{try{if(!_iteratorNormalCompletion67&&_iterator67.return){_iterator67.return();}}finally{if(_didIteratorError67){throw _iteratorError67;}}}}return true;}},{key:'removeHeader',value:function removeHeader(v){for(var i=0;i<this.mHeaderViewInfos.size();i++){var info=this.mHeaderViewInfos.get(i);if(info.view==v){this.mHeaderViewInfos.remove(i);this.mAreAllFixedViewsSelectable=this.areAllListInfosSelectable(this.mHeaderViewInfos)&&this.areAllListInfosSelectable(this.mFooterViewInfos);return true;}}return false;}},{key:'removeFooter',value:function removeFooter(v){for(var i=0;i<this.mFooterViewInfos.size();i++){var info=this.mFooterViewInfos.get(i);if(info.view==v){this.mFooterViewInfos.remove(i);this.mAreAllFixedViewsSelectable=this.areAllListInfosSelectable(this.mHeaderViewInfos)&&this.areAllListInfosSelectable(this.mFooterViewInfos);return true;}}return false;}},{key:'getCount',value:function getCount(){if(this.mAdapter!=null){return this.getFootersCount()+this.getHeadersCount()+this.mAdapter.getCount();}else{return this.getFootersCount()+this.getHeadersCount();}}},{key:'areAllItemsEnabled',value:function areAllItemsEnabled(){if(this.mAdapter!=null){return this.mAreAllFixedViewsSelectable&&this.mAdapter.areAllItemsEnabled();}else{return true;}}},{key:'isEnabled',value:function isEnabled(position){var numHeaders=this.getHeadersCount();if(position<numHeaders){return this.mHeaderViewInfos.get(position).isSelectable;}var adjPosition=position-numHeaders;var adapterCount=0;if(this.mAdapter!=null){adapterCount=this.mAdapter.getCount();if(adjPosition<adapterCount){return this.mAdapter.isEnabled(adjPosition);}}return this.mFooterViewInfos.get(adjPosition-adapterCount).isSelectable;}},{key:'getItem',value:function getItem(position){var numHeaders=this.getHeadersCount();if(position<numHeaders){return this.mHeaderViewInfos.get(position).data;}var adjPosition=position-numHeaders;var adapterCount=0;if(this.mAdapter!=null){adapterCount=this.mAdapter.getCount();if(adjPosition<adapterCount){return this.mAdapter.getItem(adjPosition);}}return this.mFooterViewInfos.get(adjPosition-adapterCount).data;}},{key:'getItemId',value:function getItemId(position){var numHeaders=this.getHeadersCount();if(this.mAdapter!=null&&position>=numHeaders){var adjPosition=position-numHeaders;var adapterCount=this.mAdapter.getCount();if(adjPosition<adapterCount){return this.mAdapter.getItemId(adjPosition);}}return-1;}},{key:'hasStableIds',value:function hasStableIds(){if(this.mAdapter!=null){return this.mAdapter.hasStableIds();}return false;}},{key:'getView',value:function getView(position,convertView,parent){var numHeaders=this.getHeadersCount();if(position<numHeaders){return this.mHeaderViewInfos.get(position).view;}var adjPosition=position-numHeaders;var adapterCount=0;if(this.mAdapter!=null){adapterCount=this.mAdapter.getCount();if(adjPosition<adapterCount){return this.mAdapter.getView(adjPosition,convertView,parent);}}return this.mFooterViewInfos.get(adjPosition-adapterCount).view;}},{key:'getItemViewType',value:function getItemViewType(position){var numHeaders=this.getHeadersCount();if(this.mAdapter!=null&&position>=numHeaders){var adjPosition=position-numHeaders;var adapterCount=this.mAdapter.getCount();if(adjPosition<adapterCount){return this.mAdapter.getItemViewType(adjPosition);}}return AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER;}},{key:'getViewTypeCount',value:function getViewTypeCount(){if(this.mAdapter!=null){return this.mAdapter.getViewTypeCount();}return 1;}},{key:'registerDataSetObserver',value:function registerDataSetObserver(observer){if(this.mAdapter!=null){this.mAdapter.registerDataSetObserver(observer);}}},{key:'unregisterDataSetObserver',value:function unregisterDataSetObserver(observer){if(this.mAdapter!=null){this.mAdapter.unregisterDataSetObserver(observer);}}},{key:'getFilter',value:function getFilter(){return null;}},{key:'getWrappedAdapter',value:function getWrappedAdapter(){return this.mAdapter;}}]);return HeaderViewListAdapter;}();HeaderViewListAdapter.EMPTY_INFO_LIST=new ArrayList();widget.HeaderViewListAdapter=HeaderViewListAdapter;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var database;(function(database){var ArrayList=java.util.ArrayList;var Observable=function(){function Observable(){_classCallCheck(this,Observable);this.mObservers=new ArrayList();}_createClass(Observable,[{key:'registerObserver',value:function registerObserver(observer){if(observer==null){throw new Error(\"The observer is null.\");}if(this.mObservers.contains(observer)){throw new Error(\"Observer \"+observer+\" is already registered.\");}this.mObservers.add(observer);}},{key:'unregisterObserver',value:function unregisterObserver(observer){if(observer==null){throw new Error(\"The observer is null.\");}var index=this.mObservers.indexOf(observer);if(index==-1){throw new Error(\"Observer \"+observer+\" was not registered.\");}this.mObservers.remove(index);}},{key:'unregisterAll',value:function unregisterAll(){this.mObservers.clear();}}]);return Observable;}();database.Observable=Observable;})(database=android.database||(android.database={}));})(android||(android={}));var android;(function(android){var database;(function(database){var Observable=android.database.Observable;var DataSetObservable=function(_Observable){_inherits(DataSetObservable,_Observable);function DataSetObservable(){_classCallCheck(this,DataSetObservable);return _possibleConstructorReturn(this,(DataSetObservable.__proto__||Object.getPrototypeOf(DataSetObservable)).apply(this,arguments));}_createClass(DataSetObservable,[{key:'notifyChanged',value:function notifyChanged(){for(var i=this.mObservers.size()-1;i>=0;i--){this.mObservers.get(i).onChanged();}}},{key:'notifyInvalidated',value:function notifyInvalidated(){for(var i=this.mObservers.size()-1;i>=0;i--){this.mObservers.get(i).onInvalidated();}}}]);return DataSetObservable;}(Observable);database.DataSetObservable=DataSetObservable;})(database=android.database||(android.database={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var DataSetObservable=android.database.DataSetObservable;var BaseAdapter=function(){function BaseAdapter(){_classCallCheck(this,BaseAdapter);this.mDataSetObservable=new DataSetObservable();}_createClass(BaseAdapter,[{key:'hasStableIds',value:function hasStableIds(){return false;}},{key:'registerDataSetObserver',value:function registerDataSetObserver(observer){this.mDataSetObservable.registerObserver(observer);}},{key:'unregisterDataSetObserver',value:function unregisterDataSetObserver(observer){this.mDataSetObservable.unregisterObserver(observer);}},{key:'notifyDataSetChanged',value:function notifyDataSetChanged(){this.mDataSetObservable.notifyChanged();}},{key:'notifyDataSetInvalidated',value:function notifyDataSetInvalidated(){this.mDataSetObservable.notifyInvalidated();}},{key:'areAllItemsEnabled',value:function areAllItemsEnabled(){return true;}},{key:'isEnabled',value:function isEnabled(position){return true;}},{key:'getDropDownView',value:function getDropDownView(position,convertView,parent){return this.getView(position,convertView,parent);}},{key:'getItemViewType',value:function getItemViewType(position){return 0;}},{key:'getViewTypeCount',value:function getViewTypeCount(){return 1;}},{key:'isEmpty',value:function isEmpty(){return this.getCount()==0;}}]);return BaseAdapter;}();widget.BaseAdapter=BaseAdapter;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var Paint=android.graphics.Paint;var PixelFormat=android.graphics.PixelFormat;var Rect=android.graphics.Rect;var MathUtils=android.util.MathUtils;var FocusFinder=android.view.FocusFinder;var KeyEvent=android.view.KeyEvent;var SoundEffectConstants=android.view.SoundEffectConstants;var View=android.view.View;var ViewGroup=android.view.ViewGroup;var Trace=android.os.Trace;var ArrayList=java.util.ArrayList;var Integer=java.lang.Integer;var System=java.lang.System;var AbsListView=android.widget.AbsListView;var AdapterView=android.widget.AdapterView;var HeaderViewListAdapter=android.widget.HeaderViewListAdapter;var ListView=function(_AbsListView){_inherits(ListView,_AbsListView);function ListView(context,bindElement){var defStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.R.attr.listViewStyle;_classCallCheck(this,ListView);var _this115=_possibleConstructorReturn(this,(ListView.__proto__||Object.getPrototypeOf(ListView)).call(this,context,bindElement,defStyle));_this115.mHeaderViewInfos=new ArrayList();_this115.mFooterViewInfos=new ArrayList();_this115.mDividerHeight=0;_this115.mIsCacheColorOpaque=false;_this115.mDividerIsOpaque=false;_this115.mHeaderDividersEnabled=true;_this115.mFooterDividersEnabled=true;_this115.mAreAllItemsSelectable=true;_this115.mItemsCanFocus=false;_this115.mTempRect=new Rect();_this115.mArrowScrollFocusResult=new ListView.ArrowScrollFocusResult();var a=context.obtainStyledAttributes(bindElement,defStyle);var d=a.getDrawable('divider');if(d!=null){_this115.setDivider(d);}var osHeader=a.getDrawable('overScrollHeader');if(osHeader!=null){_this115.setOverscrollHeader(osHeader);}var osFooter=a.getDrawable('overScrollFooter');if(osFooter!=null){_this115.setOverscrollFooter(osFooter);}var dividerHeight=a.getDimensionPixelSize('dividerHeight',0);if(dividerHeight!=0){_this115.setDividerHeight(dividerHeight);}_this115.mHeaderDividersEnabled=a.getBoolean('headerDividersEnabled',true);_this115.mFooterDividersEnabled=a.getBoolean('footerDividersEnabled',true);a.recycle();return _this115;}_createClass(ListView,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'createClassAttrBinder',this).call(this).set('divider',{setter:function setter(v,value,attrBinder){var divider=attrBinder.parseDrawable(value);if(divider)v.setDivider(divider);},getter:function getter(v){return v.mDivider;}}).set('overScrollHeader',{setter:function setter(v,value,attrBinder){var header=attrBinder.parseDrawable(value);if(header)v.setOverscrollHeader(header);},getter:function getter(v){return v.getOverscrollHeader();}}).set('overScrollFooter',{setter:function setter(v,value,attrBinder){var footer=attrBinder.parseDrawable(value);if(footer)v.setOverscrollFooter(footer);},getter:function getter(v){return v.getOverscrollFooter();}}).set('dividerHeight',{setter:function setter(v,value,attrBinder){v.setDividerHeight(attrBinder.parseNumberPixelSize(value,v.getDividerHeight()));},getter:function getter(v){return v.getDividerHeight();}}).set('headerDividersEnabled',{setter:function setter(v,value,attrBinder){v.setHeaderDividersEnabled(attrBinder.parseBoolean(value,v.mHeaderDividersEnabled));},getter:function getter(v){return v.mHeaderDividersEnabled;}}).set('dividerHeight',{setter:function setter(v,value,attrBinder){v.setFooterDividersEnabled(attrBinder.parseBoolean(value,v.mFooterDividersEnabled));},getter:function getter(v){return v.mFooterDividersEnabled;}});}},{key:'getMaxScrollAmount',value:function getMaxScrollAmount(){return Math.floor(ListView.MAX_SCROLL_FACTOR*(this.mBottom-this.mTop));}},{key:'adjustViewsUpOrDown',value:function adjustViewsUpOrDown(){var childCount=this.getChildCount();var delta=void 0;if(childCount>0){var child=void 0;if(!this.mStackFromBottom){child=this.getChildAt(0);delta=child.getTop()-this.mListPadding.top;if(this.mFirstPosition!=0){delta-=this.mDividerHeight;}if(delta<0){delta=0;}}else{child=this.getChildAt(childCount-1);delta=child.getBottom()-(this.getHeight()-this.mListPadding.bottom);if(this.mFirstPosition+childCount<this.mItemCount){delta+=this.mDividerHeight;}if(delta>0){delta=0;}}if(delta!=0){this.offsetChildrenTopAndBottom(-delta);}}}},{key:'addHeaderView',value:function addHeaderView(v){var data=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var isSelectable=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var info=new ListView.FixedViewInfo(this);info.view=v;info.data=data;info.isSelectable=isSelectable;this.mHeaderViewInfos.add(info);if(this.mAdapter!=null){if(!(this.mAdapter instanceof HeaderViewListAdapter)){this.mAdapter=new HeaderViewListAdapter(this.mHeaderViewInfos,this.mFooterViewInfos,this.mAdapter);}if(this.mDataSetObserver!=null){this.mDataSetObserver.onChanged();}}}},{key:'getHeaderViewsCount',value:function getHeaderViewsCount(){return this.mHeaderViewInfos.size();}},{key:'removeHeaderView',value:function removeHeaderView(v){if(this.mHeaderViewInfos.size()>0){var result=false;if(this.mAdapter!=null&&this.mAdapter.removeHeader(v)){if(this.mDataSetObserver!=null){this.mDataSetObserver.onChanged();}result=true;}this.removeFixedViewInfo(v,this.mHeaderViewInfos);return result;}return false;}},{key:'removeFixedViewInfo',value:function removeFixedViewInfo(v,where){var len=where.size();for(var i=0;i<len;++i){var info=where.get(i);if(info.view==v){where.remove(i);break;}}}},{key:'addFooterView',value:function addFooterView(v){var data=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var isSelectable=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var info=new ListView.FixedViewInfo(this);info.view=v;info.data=data;info.isSelectable=isSelectable;this.mFooterViewInfos.add(info);if(this.mAdapter!=null){if(!(this.mAdapter instanceof HeaderViewListAdapter)){this.mAdapter=new HeaderViewListAdapter(this.mHeaderViewInfos,this.mFooterViewInfos,this.mAdapter);}if(this.mDataSetObserver!=null){this.mDataSetObserver.onChanged();}}}},{key:'getFooterViewsCount',value:function getFooterViewsCount(){return this.mFooterViewInfos.size();}},{key:'removeFooterView',value:function removeFooterView(v){if(this.mFooterViewInfos.size()>0){var result=false;if(this.mAdapter!=null&&this.mAdapter.removeFooter(v)){if(this.mDataSetObserver!=null){this.mDataSetObserver.onChanged();}result=true;}this.removeFixedViewInfo(v,this.mFooterViewInfos);return result;}return false;}},{key:'getAdapter',value:function getAdapter(){return this.mAdapter;}},{key:'setAdapter',value:function setAdapter(adapter){if(this.mAdapter!=null&&this.mDataSetObserver!=null){this.mAdapter.unregisterDataSetObserver(this.mDataSetObserver);}this.resetList();this.mRecycler.clear();if(this.mHeaderViewInfos.size()>0||this.mFooterViewInfos.size()>0){this.mAdapter=new HeaderViewListAdapter(this.mHeaderViewInfos,this.mFooterViewInfos,adapter);}else{this.mAdapter=adapter;}this.mOldSelectedPosition=ListView.INVALID_POSITION;this.mOldSelectedRowId=ListView.INVALID_ROW_ID;_get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'setAdapter',this).call(this,adapter);if(this.mAdapter!=null){this.mAreAllItemsSelectable=this.mAdapter.areAllItemsEnabled();this.mOldItemCount=this.mItemCount;this.mItemCount=this.mAdapter.getCount();this.checkFocus();this.mDataSetObserver=new AbsListView.AdapterDataSetObserver(this);this.mAdapter.registerDataSetObserver(this.mDataSetObserver);this.mRecycler.setViewTypeCount(this.mAdapter.getViewTypeCount());var position=void 0;if(this.mStackFromBottom){position=this.lookForSelectablePosition(this.mItemCount-1,false);}else{position=this.lookForSelectablePosition(0,true);}this.setSelectedPositionInt(position);this.setNextSelectedPositionInt(position);if(this.mItemCount==0){this.checkSelectionChanged();}}else{this.mAreAllItemsSelectable=true;this.checkFocus();this.checkSelectionChanged();}this.requestLayout();}},{key:'resetList',value:function resetList(){this.clearRecycledState(this.mHeaderViewInfos);this.clearRecycledState(this.mFooterViewInfos);_get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'resetList',this).call(this);this.mLayoutMode=ListView.LAYOUT_NORMAL;}},{key:'clearRecycledState',value:function clearRecycledState(infos){if(infos!=null){var count=infos.size();for(var i=0;i<count;i++){var child=infos.get(i).view;var p=child.getLayoutParams();if(p!=null){p.recycledHeaderFooter=false;}}}}},{key:'showingTopFadingEdge',value:function showingTopFadingEdge(){var listTop=this.mScrollY+this.mListPadding.top;return this.mFirstPosition>0||this.getChildAt(0).getTop()>listTop;}},{key:'showingBottomFadingEdge',value:function showingBottomFadingEdge(){var childCount=this.getChildCount();var bottomOfBottomChild=this.getChildAt(childCount-1).getBottom();var lastVisiblePosition=this.mFirstPosition+childCount-1;var listBottom=this.mScrollY+this.getHeight()-this.mListPadding.bottom;return lastVisiblePosition<this.mItemCount-1||bottomOfBottomChild<listBottom;}},{key:'requestChildRectangleOnScreen',value:function requestChildRectangleOnScreen(child,rect,immediate){var rectTopWithinChild=rect.top;rect.offset(child.getLeft(),child.getTop());rect.offset(-child.getScrollX(),-child.getScrollY());var height=this.getHeight();var listUnfadedTop=this.getScrollY();var listUnfadedBottom=listUnfadedTop+height;var fadingEdge=this.getVerticalFadingEdgeLength();if(this.showingTopFadingEdge()){if(this.mSelectedPosition>0||rectTopWithinChild>fadingEdge){listUnfadedTop+=fadingEdge;}}var childCount=this.getChildCount();var bottomOfBottomChild=this.getChildAt(childCount-1).getBottom();if(this.showingBottomFadingEdge()){if(this.mSelectedPosition<this.mItemCount-1||rect.bottom<bottomOfBottomChild-fadingEdge){listUnfadedBottom-=fadingEdge;}}var scrollYDelta=0;if(rect.bottom>listUnfadedBottom&&rect.top>listUnfadedTop){if(rect.height()>height){scrollYDelta+=rect.top-listUnfadedTop;}else{scrollYDelta+=rect.bottom-listUnfadedBottom;}var distanceToBottom=bottomOfBottomChild-listUnfadedBottom;scrollYDelta=Math.min(scrollYDelta,distanceToBottom);}else if(rect.top<listUnfadedTop&&rect.bottom<listUnfadedBottom){if(rect.height()>height){scrollYDelta-=listUnfadedBottom-rect.bottom;}else{scrollYDelta-=listUnfadedTop-rect.top;}var top=this.getChildAt(0).getTop();var deltaToTop=top-listUnfadedTop;scrollYDelta=Math.max(scrollYDelta,deltaToTop);}var scroll=scrollYDelta!=0;if(scroll){this.scrollListItemsBy(-scrollYDelta);this.positionSelector(ListView.INVALID_POSITION,child);this.mSelectedTop=child.getTop();this.invalidate();}return scroll;}},{key:'fillGap',value:function fillGap(down){var count=this.getChildCount();if(down){var paddingTop=0;if((this.mGroupFlags&ListView.CLIP_TO_PADDING_MASK)==ListView.CLIP_TO_PADDING_MASK){paddingTop=this.getListPaddingTop();}var startOffset=count>0?this.getChildAt(count-1).getBottom()+this.mDividerHeight:paddingTop;this.fillDown(this.mFirstPosition+count,startOffset);this.correctTooHigh(this.getChildCount());}else{var paddingBottom=0;if((this.mGroupFlags&ListView.CLIP_TO_PADDING_MASK)==ListView.CLIP_TO_PADDING_MASK){paddingBottom=this.getListPaddingBottom();}var _startOffset=count>0?this.getChildAt(0).getTop()-this.mDividerHeight:this.getHeight()-paddingBottom;this.fillUp(this.mFirstPosition-1,_startOffset);this.correctTooLow(this.getChildCount());}}},{key:'fillDown',value:function fillDown(pos,nextTop){var selectedView=null;var end=this.mBottom-this.mTop;if((this.mGroupFlags&ListView.CLIP_TO_PADDING_MASK)==ListView.CLIP_TO_PADDING_MASK){end-=this.mListPadding.bottom;}while(nextTop<end&&pos<this.mItemCount){var selected=pos==this.mSelectedPosition;var child=this.makeAndAddView(pos,nextTop,true,this.mListPadding.left,selected);nextTop=child.getBottom()+this.mDividerHeight;if(selected){selectedView=child;}pos++;}this.setVisibleRangeHint(this.mFirstPosition,this.mFirstPosition+this.getChildCount()-1);return selectedView;}},{key:'fillUp',value:function fillUp(pos,nextBottom){var selectedView=null;var end=0;if((this.mGroupFlags&ListView.CLIP_TO_PADDING_MASK)==ListView.CLIP_TO_PADDING_MASK){end=this.mListPadding.top;}while(nextBottom>end&&pos>=0){var selected=pos==this.mSelectedPosition;var child=this.makeAndAddView(pos,nextBottom,false,this.mListPadding.left,selected);nextBottom=child.getTop()-this.mDividerHeight;if(selected){selectedView=child;}pos--;}this.mFirstPosition=pos+1;this.setVisibleRangeHint(this.mFirstPosition,this.mFirstPosition+this.getChildCount()-1);return selectedView;}},{key:'fillFromTop',value:function fillFromTop(nextTop){this.mFirstPosition=Math.min(this.mFirstPosition,this.mSelectedPosition);this.mFirstPosition=Math.min(this.mFirstPosition,this.mItemCount-1);if(this.mFirstPosition<0){this.mFirstPosition=0;}return this.fillDown(this.mFirstPosition,nextTop);}},{key:'fillFromMiddle',value:function fillFromMiddle(childrenTop,childrenBottom){var height=childrenBottom-childrenTop;var position=this.reconcileSelectedPosition();var sel=this.makeAndAddView(position,childrenTop,true,this.mListPadding.left,true);this.mFirstPosition=position;var selHeight=sel.getMeasuredHeight();if(selHeight<=height){sel.offsetTopAndBottom((height-selHeight)/2);}this.fillAboveAndBelow(sel,position);if(!this.mStackFromBottom){this.correctTooHigh(this.getChildCount());}else{this.correctTooLow(this.getChildCount());}return sel;}},{key:'fillAboveAndBelow',value:function fillAboveAndBelow(sel,position){var dividerHeight=this.mDividerHeight;if(!this.mStackFromBottom){this.fillUp(position-1,sel.getTop()-dividerHeight);this.adjustViewsUpOrDown();this.fillDown(position+1,sel.getBottom()+dividerHeight);}else{this.fillDown(position+1,sel.getBottom()+dividerHeight);this.adjustViewsUpOrDown();this.fillUp(position-1,sel.getTop()-dividerHeight);}}},{key:'fillFromSelection',value:function fillFromSelection(selectedTop,childrenTop,childrenBottom){var fadingEdgeLength=this.getVerticalFadingEdgeLength();var selectedPosition=this.mSelectedPosition;var sel=void 0;var topSelectionPixel=this.getTopSelectionPixel(childrenTop,fadingEdgeLength,selectedPosition);var bottomSelectionPixel=this.getBottomSelectionPixel(childrenBottom,fadingEdgeLength,selectedPosition);sel=this.makeAndAddView(selectedPosition,selectedTop,true,this.mListPadding.left,true);if(sel.getBottom()>bottomSelectionPixel){var spaceAbove=sel.getTop()-topSelectionPixel;var spaceBelow=sel.getBottom()-bottomSelectionPixel;var offset=Math.min(spaceAbove,spaceBelow);sel.offsetTopAndBottom(-offset);}else if(sel.getTop()<topSelectionPixel){var _spaceAbove=topSelectionPixel-sel.getTop();var _spaceBelow=bottomSelectionPixel-sel.getBottom();var _offset=Math.min(_spaceAbove,_spaceBelow);sel.offsetTopAndBottom(_offset);}this.fillAboveAndBelow(sel,selectedPosition);if(!this.mStackFromBottom){this.correctTooHigh(this.getChildCount());}else{this.correctTooLow(this.getChildCount());}return sel;}},{key:'getBottomSelectionPixel',value:function getBottomSelectionPixel(childrenBottom,fadingEdgeLength,selectedPosition){var bottomSelectionPixel=childrenBottom;if(selectedPosition!=this.mItemCount-1){bottomSelectionPixel-=fadingEdgeLength;}return bottomSelectionPixel;}},{key:'getTopSelectionPixel',value:function getTopSelectionPixel(childrenTop,fadingEdgeLength,selectedPosition){var topSelectionPixel=childrenTop;if(selectedPosition>0){topSelectionPixel+=fadingEdgeLength;}return topSelectionPixel;}},{key:'smoothScrollToPosition',value:function smoothScrollToPosition(position,boundPosition){_get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'smoothScrollToPosition',this).call(this,position,boundPosition);}},{key:'smoothScrollByOffset',value:function smoothScrollByOffset(offset){_get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'smoothScrollByOffset',this).call(this,offset);}},{key:'moveSelection',value:function moveSelection(oldSel,newSel,delta,childrenTop,childrenBottom){var fadingEdgeLength=this.getVerticalFadingEdgeLength();var selectedPosition=this.mSelectedPosition;var sel=void 0;var topSelectionPixel=this.getTopSelectionPixel(childrenTop,fadingEdgeLength,selectedPosition);var bottomSelectionPixel=this.getBottomSelectionPixel(childrenTop,fadingEdgeLength,selectedPosition);if(delta>0){oldSel=this.makeAndAddView(selectedPosition-1,oldSel.getTop(),true,this.mListPadding.left,false);var dividerHeight=this.mDividerHeight;sel=this.makeAndAddView(selectedPosition,oldSel.getBottom()+dividerHeight,true,this.mListPadding.left,true);if(sel.getBottom()>bottomSelectionPixel){var spaceAbove=sel.getTop()-topSelectionPixel;var spaceBelow=sel.getBottom()-bottomSelectionPixel;var halfVerticalSpace=(childrenBottom-childrenTop)/2;var offset=Math.min(spaceAbove,spaceBelow);offset=Math.min(offset,halfVerticalSpace);oldSel.offsetTopAndBottom(-offset);sel.offsetTopAndBottom(-offset);}if(!this.mStackFromBottom){this.fillUp(this.mSelectedPosition-2,sel.getTop()-dividerHeight);this.adjustViewsUpOrDown();this.fillDown(this.mSelectedPosition+1,sel.getBottom()+dividerHeight);}else{this.fillDown(this.mSelectedPosition+1,sel.getBottom()+dividerHeight);this.adjustViewsUpOrDown();this.fillUp(this.mSelectedPosition-2,sel.getTop()-dividerHeight);}}else if(delta<0){if(newSel!=null){sel=this.makeAndAddView(selectedPosition,newSel.getTop(),true,this.mListPadding.left,true);}else{sel=this.makeAndAddView(selectedPosition,oldSel.getTop(),false,this.mListPadding.left,true);}if(sel.getTop()<topSelectionPixel){var _spaceAbove2=topSelectionPixel-sel.getTop();var _spaceBelow2=bottomSelectionPixel-sel.getBottom();var _halfVerticalSpace=(childrenBottom-childrenTop)/2;var _offset2=Math.min(_spaceAbove2,_spaceBelow2);_offset2=Math.min(_offset2,_halfVerticalSpace);sel.offsetTopAndBottom(_offset2);}this.fillAboveAndBelow(sel,selectedPosition);}else{var oldTop=oldSel.getTop();sel=this.makeAndAddView(selectedPosition,oldTop,true,this.mListPadding.left,true);if(oldTop<childrenTop){var newBottom=sel.getBottom();if(newBottom<childrenTop+20){sel.offsetTopAndBottom(childrenTop-sel.getTop());}}this.fillAboveAndBelow(sel,selectedPosition);}return sel;}},{key:'onSizeChanged',value:function onSizeChanged(w,h,oldw,oldh){if(this.getChildCount()>0){var focusedChild=this.getFocusedChild();if(focusedChild!=null){var childPosition=this.mFirstPosition+this.indexOfChild(focusedChild);var childBottom=focusedChild.getBottom();var offset=Math.max(0,childBottom-(h-this.mPaddingTop));var top=focusedChild.getTop()-offset;if(this.mFocusSelector==null){this.mFocusSelector=new ListView.FocusSelector(this);}this.post(this.mFocusSelector.setup(childPosition,top));}}_get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'onSizeChanged',this).call(this,w,h,oldw,oldh);}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){_get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'onMeasure',this).call(this,widthMeasureSpec,heightMeasureSpec);var widthMode=View.MeasureSpec.getMode(widthMeasureSpec);var heightMode=View.MeasureSpec.getMode(heightMeasureSpec);var widthSize=View.MeasureSpec.getSize(widthMeasureSpec);var heightSize=View.MeasureSpec.getSize(heightMeasureSpec);var childWidth=0;var childHeight=0;var childState=0;this.mItemCount=this.mAdapter==null?0:this.mAdapter.getCount();if(this.mItemCount>0&&(widthMode==View.MeasureSpec.UNSPECIFIED||heightMode==View.MeasureSpec.UNSPECIFIED)){var child=this.obtainView(0,this.mIsScrap);this.measureScrapChild(child,0,widthMeasureSpec);childWidth=child.getMeasuredWidth();childHeight=child.getMeasuredHeight();childState=ListView.combineMeasuredStates(childState,child.getMeasuredState());if(this.recycleOnMeasure()&&this.mRecycler.shouldRecycleViewType(child.getLayoutParams().viewType)){this.mRecycler.addScrapView(child,-1);}}if(widthMode==View.MeasureSpec.UNSPECIFIED){widthSize=this.mListPadding.left+this.mListPadding.right+childWidth+this.getVerticalScrollbarWidth();}else{widthSize|=childState&ListView.MEASURED_STATE_MASK;}if(heightMode==View.MeasureSpec.UNSPECIFIED){heightSize=this.mListPadding.top+this.mListPadding.bottom+childHeight+this.getVerticalFadingEdgeLength()*2;}if(heightMode==View.MeasureSpec.AT_MOST){heightSize=this.measureHeightOfChildren(widthMeasureSpec,0,ListView.NO_POSITION,heightSize,-1);}this.setMeasuredDimension(widthSize,heightSize);this.mWidthMeasureSpec=widthMeasureSpec;}},{key:'measureScrapChild',value:function measureScrapChild(child,position,widthMeasureSpec){var p=child.getLayoutParams();if(p==null){p=this.generateDefaultLayoutParams();child.setLayoutParams(p);}p.viewType=this.mAdapter.getItemViewType(position);p.forceAdd=true;var childWidthSpec=ViewGroup.getChildMeasureSpec(widthMeasureSpec,this.mListPadding.left+this.mListPadding.right,p.width);var lpHeight=p.height;var childHeightSpec=void 0;if(lpHeight>0){childHeightSpec=View.MeasureSpec.makeMeasureSpec(lpHeight,View.MeasureSpec.EXACTLY);}else{childHeightSpec=View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);}child.measure(childWidthSpec,childHeightSpec);}},{key:'recycleOnMeasure',value:function recycleOnMeasure(){return true;}},{key:'measureHeightOfChildren',value:function measureHeightOfChildren(widthMeasureSpec,startPosition,endPosition,maxHeight,disallowPartialChildPosition){var adapter=this.mAdapter;if(adapter==null){return this.mListPadding.top+this.mListPadding.bottom;}var returnedHeight=this.mListPadding.top+this.mListPadding.bottom;var dividerHeight=this.mDividerHeight>0&&this.mDivider!=null?this.mDividerHeight:0;var prevHeightWithoutPartialChild=0;var i=void 0;var child=void 0;endPosition=endPosition==ListView.NO_POSITION?adapter.getCount()-1:endPosition;var recycleBin=this.mRecycler;var recyle=this.recycleOnMeasure();var isScrap=this.mIsScrap;for(i=startPosition;i<=endPosition;++i){child=this.obtainView(i,isScrap);this.measureScrapChild(child,i,widthMeasureSpec);if(i>0){returnedHeight+=dividerHeight;}if(recyle&&recycleBin.shouldRecycleViewType(child.getLayoutParams().viewType)){recycleBin.addScrapView(child,-1);}returnedHeight+=child.getMeasuredHeight();if(returnedHeight>=maxHeight){return disallowPartialChildPosition>=0&&i>disallowPartialChildPosition&&prevHeightWithoutPartialChild>0&&returnedHeight!=maxHeight?prevHeightWithoutPartialChild:maxHeight;}if(disallowPartialChildPosition>=0&&i>=disallowPartialChildPosition){prevHeightWithoutPartialChild=returnedHeight;}}return returnedHeight;}},{key:'findMotionRow',value:function findMotionRow(y){var childCount=this.getChildCount();if(childCount>0){if(!this.mStackFromBottom){for(var i=0;i<childCount;i++){var v=this.getChildAt(i);if(y<=v.getBottom()){return this.mFirstPosition+i;}}}else{for(var _i46=childCount-1;_i46>=0;_i46--){var _v5=this.getChildAt(_i46);if(y>=_v5.getTop()){return this.mFirstPosition+_i46;}}}}return ListView.INVALID_POSITION;}},{key:'fillSpecific',value:function fillSpecific(position,top){var tempIsSelected=position==this.mSelectedPosition;var temp=this.makeAndAddView(position,top,true,this.mListPadding.left,tempIsSelected);this.mFirstPosition=position;var above=void 0;var below=void 0;var dividerHeight=this.mDividerHeight;if(!this.mStackFromBottom){above=this.fillUp(position-1,temp.getTop()-dividerHeight);this.adjustViewsUpOrDown();below=this.fillDown(position+1,temp.getBottom()+dividerHeight);var childCount=this.getChildCount();if(childCount>0){this.correctTooHigh(childCount);}}else{below=this.fillDown(position+1,temp.getBottom()+dividerHeight);this.adjustViewsUpOrDown();above=this.fillUp(position-1,temp.getTop()-dividerHeight);var _childCount2=this.getChildCount();if(_childCount2>0){this.correctTooLow(_childCount2);}}if(tempIsSelected){return temp;}else if(above!=null){return above;}else{return below;}}},{key:'correctTooHigh',value:function correctTooHigh(childCount){var lastPosition=this.mFirstPosition+childCount-1;if(lastPosition==this.mItemCount-1&&childCount>0){var lastChild=this.getChildAt(childCount-1);var lastBottom=lastChild.getBottom();var end=this.mBottom-this.mTop-this.mListPadding.bottom;var bottomOffset=end-lastBottom;var firstChild=this.getChildAt(0);var firstTop=firstChild.getTop();if(bottomOffset>0&&(this.mFirstPosition>0||firstTop<this.mListPadding.top)){if(this.mFirstPosition==0){bottomOffset=Math.min(bottomOffset,this.mListPadding.top-firstTop);}this.offsetChildrenTopAndBottom(bottomOffset);if(this.mFirstPosition>0){this.fillUp(this.mFirstPosition-1,firstChild.getTop()-this.mDividerHeight);this.adjustViewsUpOrDown();}}}}},{key:'correctTooLow',value:function correctTooLow(childCount){if(this.mFirstPosition==0&&childCount>0){var firstChild=this.getChildAt(0);var firstTop=firstChild.getTop();var start=this.mListPadding.top;var end=this.mBottom-this.mTop-this.mListPadding.bottom;var topOffset=firstTop-start;var lastChild=this.getChildAt(childCount-1);var lastBottom=lastChild.getBottom();var lastPosition=this.mFirstPosition+childCount-1;if(topOffset>0){if(lastPosition<this.mItemCount-1||lastBottom>end){if(lastPosition==this.mItemCount-1){topOffset=Math.min(topOffset,lastBottom-end);}this.offsetChildrenTopAndBottom(-topOffset);if(lastPosition<this.mItemCount-1){this.fillDown(lastPosition+1,lastChild.getBottom()+this.mDividerHeight);this.adjustViewsUpOrDown();}}else if(lastPosition==this.mItemCount-1){this.adjustViewsUpOrDown();}}}}},{key:'layoutChildren',value:function layoutChildren(){var blockLayoutRequests=this.mBlockLayoutRequests;if(blockLayoutRequests){return;}this.mBlockLayoutRequests=true;try{_get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'layoutChildren',this).call(this);this.invalidate();if(this.mAdapter==null){this.resetList();this.invokeOnItemScrollListener();return;}var childrenTop=this.mListPadding.top;var childrenBottom=this.mBottom-this.mTop-this.mListPadding.bottom;var childCount=this.getChildCount();var index=0;var delta=0;var sel=void 0;var oldSel=null;var oldFirst=null;var newSel=null;switch(this.mLayoutMode){case ListView.LAYOUT_SET_SELECTION:index=this.mNextSelectedPosition-this.mFirstPosition;if(index>=0&&index<childCount){newSel=this.getChildAt(index);}break;case ListView.LAYOUT_FORCE_TOP:case ListView.LAYOUT_FORCE_BOTTOM:case ListView.LAYOUT_SPECIFIC:case ListView.LAYOUT_SYNC:break;case ListView.LAYOUT_MOVE_SELECTION:default:index=this.mSelectedPosition-this.mFirstPosition;if(index>=0&&index<childCount){oldSel=this.getChildAt(index);}oldFirst=this.getChildAt(0);if(this.mNextSelectedPosition>=0){delta=this.mNextSelectedPosition-this.mSelectedPosition;}newSel=this.getChildAt(index+delta);}var dataChanged=this.mDataChanged;if(dataChanged){this.handleDataChanged();}if(this.mItemCount==0){this.resetList();this.invokeOnItemScrollListener();return;}else if(this.mItemCount!=this.mAdapter.getCount()){throw Error('IllegalStateException(\"The content of the adapter has changed but\\n                ListView did not receive a notification. Make sure the content of\\n                your adapter is not modified from a background thread, but only from\\n                the UI thread. Make sure your adapter calls notifyDataSetChanged()\\n                when its content changes. [in ListView('+this.getId()+','+this.constructor.name+')\\n                with Adapter('+this.mAdapter.constructor.name+')]\")');}this.setSelectedPositionInt(this.mNextSelectedPosition);var accessFocusedChild=null;var focusedChild=this.getFocusedChild();if(focusedChild!=null){focusedChild.setHasTransientState(true);}var firstPosition=this.mFirstPosition;var recycleBin=this.mRecycler;if(dataChanged){for(var i=0;i<childCount;i++){recycleBin.addScrapView(this.getChildAt(i),firstPosition+i);}}else{recycleBin.fillActiveViews(childCount,firstPosition);}this.detachAllViewsFromParent();recycleBin.removeSkippedScrap();switch(this.mLayoutMode){case ListView.LAYOUT_SET_SELECTION:if(newSel!=null){sel=this.fillFromSelection(newSel.getTop(),childrenTop,childrenBottom);}else{sel=this.fillFromMiddle(childrenTop,childrenBottom);}break;case ListView.LAYOUT_SYNC:sel=this.fillSpecific(this.mSyncPosition,this.mSpecificTop);break;case ListView.LAYOUT_FORCE_BOTTOM:sel=this.fillUp(this.mItemCount-1,childrenBottom);this.adjustViewsUpOrDown();break;case ListView.LAYOUT_FORCE_TOP:this.mFirstPosition=0;sel=this.fillFromTop(childrenTop);this.adjustViewsUpOrDown();break;case ListView.LAYOUT_SPECIFIC:sel=this.fillSpecific(this.reconcileSelectedPosition(),this.mSpecificTop);break;case ListView.LAYOUT_MOVE_SELECTION:sel=this.moveSelection(oldSel,newSel,delta,childrenTop,childrenBottom);break;default:if(childCount==0){if(!this.mStackFromBottom){var position=this.lookForSelectablePosition(0,true);this.setSelectedPositionInt(position);sel=this.fillFromTop(childrenTop);}else{var _position3=this.lookForSelectablePosition(this.mItemCount-1,false);this.setSelectedPositionInt(_position3);sel=this.fillUp(this.mItemCount-1,childrenBottom);}}else{if(this.mSelectedPosition>=0&&this.mSelectedPosition<this.mItemCount){sel=this.fillSpecific(this.mSelectedPosition,oldSel==null?childrenTop:oldSel.getTop());}else if(this.mFirstPosition<this.mItemCount){sel=this.fillSpecific(this.mFirstPosition,oldFirst==null?childrenTop:oldFirst.getTop());}else{sel=this.fillSpecific(0,childrenTop);}}break;}recycleBin.scrapActiveViews();if(sel!=null){var shouldPlaceFocus=this.mItemsCanFocus&&this.hasFocus();var maintainedFocus=focusedChild!=null&&focusedChild.hasFocus();if(shouldPlaceFocus&&!maintainedFocus&&!sel.hasFocus()){if(sel.requestFocus()){sel.setSelected(false);this.mSelectorRect.setEmpty();}else{var focused=this.getFocusedChild();if(focused!=null){focused.clearFocus();}this.positionSelector(ListView.INVALID_POSITION,sel);}}else{this.positionSelector(ListView.INVALID_POSITION,sel);}this.mSelectedTop=sel.getTop();}else{if(this.mTouchMode==ListView.TOUCH_MODE_TAP||this.mTouchMode==ListView.TOUCH_MODE_DONE_WAITING){var child=this.getChildAt(this.mMotionPosition-this.mFirstPosition);if(child!=null){this.positionSelector(this.mMotionPosition,child);}}else{this.mSelectedTop=0;this.mSelectorRect.setEmpty();}}if(accessFocusedChild!=null){accessFocusedChild.setHasTransientState(false);}if(focusedChild!=null){focusedChild.setHasTransientState(false);}this.mLayoutMode=ListView.LAYOUT_NORMAL;this.mDataChanged=false;if(this.mPositionScrollAfterLayout!=null){this.post(this.mPositionScrollAfterLayout);this.mPositionScrollAfterLayout=null;}this.mNeedSync=false;this.setNextSelectedPositionInt(this.mSelectedPosition);this.updateScrollIndicators();if(this.mItemCount>0){this.checkSelectionChanged();}this.invokeOnItemScrollListener();}finally{if(!blockLayoutRequests){this.mBlockLayoutRequests=false;}}}},{key:'makeAndAddView',value:function makeAndAddView(position,y,flow,childrenLeft,selected){var child=void 0;if(!this.mDataChanged){child=this.mRecycler.getActiveView(position);if(child!=null){this.setupChild(child,position,y,flow,childrenLeft,selected,true);return child;}}child=this.obtainView(position,this.mIsScrap);this.setupChild(child,position,y,flow,childrenLeft,selected,this.mIsScrap[0]);return child;}},{key:'setupChild',value:function setupChild(child,position,y,flowDown,childrenLeft,selected,recycled){Trace.traceBegin(Trace.TRACE_TAG_VIEW,\"setupListItem\");var isSelected=selected&&this.shouldShowSelector();var updateChildSelected=isSelected!=child.isSelected();var mode=this.mTouchMode;var isPressed=mode>ListView.TOUCH_MODE_DOWN&&mode<ListView.TOUCH_MODE_SCROLL&&this.mMotionPosition==position;var updateChildPressed=isPressed!=child.isPressed();var needToMeasure=!recycled||updateChildSelected||child.isLayoutRequested();var p=child.getLayoutParams();if(p==null){p=this.generateDefaultLayoutParams();}if(!(p instanceof AbsListView.LayoutParams)){var name=p instanceof Function?p.constructor.name:p+'';throw Error('ClassCaseException('+name+' can\\'t case to AbsListView.LayoutParams)');}p.viewType=this.mAdapter.getItemViewType(position);if(recycled&&!p.forceAdd||p.recycledHeaderFooter&&p.viewType==AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER){this.attachViewToParent(child,flowDown?-1:0,p);}else{p.forceAdd=false;if(p.viewType==AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER){p.recycledHeaderFooter=true;}this.addViewInLayout(child,flowDown?-1:0,p,true);}if(updateChildSelected){child.setSelected(isSelected);}if(updateChildPressed){child.setPressed(isPressed);}if(this.mChoiceMode!=ListView.CHOICE_MODE_NONE&&this.mCheckStates!=null){if(child['setChecked']){child.setChecked(this.mCheckStates.get(position));}else{child.setActivated(this.mCheckStates.get(position));}}if(needToMeasure){var childWidthSpec=ViewGroup.getChildMeasureSpec(this.mWidthMeasureSpec,this.mListPadding.left+this.mListPadding.right,p.width);var lpHeight=p.height;var childHeightSpec=void 0;if(lpHeight>0){childHeightSpec=View.MeasureSpec.makeMeasureSpec(lpHeight,View.MeasureSpec.EXACTLY);}else{childHeightSpec=View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);}child.measure(childWidthSpec,childHeightSpec);}else{this.cleanupLayoutState(child);}var w=child.getMeasuredWidth();var h=child.getMeasuredHeight();var childTop=flowDown?y:y-h;if(needToMeasure){var childRight=childrenLeft+w;var childBottom=childTop+h;child.layout(childrenLeft,childTop,childRight,childBottom);}else{child.offsetLeftAndRight(childrenLeft-child.getLeft());child.offsetTopAndBottom(childTop-child.getTop());}if(this.mCachingStarted&&!child.isDrawingCacheEnabled()){child.setDrawingCacheEnabled(true);}if(recycled&&child.getLayoutParams().scrappedFromPosition!=position){child.jumpDrawablesToCurrentState();}Trace.traceEnd(Trace.TRACE_TAG_VIEW);}},{key:'canAnimate',value:function canAnimate(){return _get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'canAnimate',this).call(this)&&this.mItemCount>0;}},{key:'setSelection',value:function setSelection(position){this.setSelectionFromTop(position,0);}},{key:'setSelectionFromTop',value:function setSelectionFromTop(position,y){if(this.mAdapter==null){return;}if(!this.isInTouchMode()){position=this.lookForSelectablePosition(position,true);if(position>=0){this.setNextSelectedPositionInt(position);}}else{this.mResurrectToPosition=position;}if(position>=0){this.mLayoutMode=ListView.LAYOUT_SPECIFIC;this.mSpecificTop=this.mListPadding.top+y;if(this.mNeedSync){this.mSyncPosition=position;this.mSyncRowId=this.mAdapter.getItemId(position);}if(this.mPositionScroller!=null){this.mPositionScroller.stop();}this.requestLayout();}}},{key:'setSelectionInt',value:function setSelectionInt(position){this.setNextSelectedPositionInt(position);var awakeScrollbars=false;var selectedPosition=this.mSelectedPosition;if(selectedPosition>=0){if(position==selectedPosition-1){awakeScrollbars=true;}else if(position==selectedPosition+1){awakeScrollbars=true;}}if(this.mPositionScroller!=null){this.mPositionScroller.stop();}this.layoutChildren();if(awakeScrollbars){this.awakenScrollBars();}}},{key:'lookForSelectablePosition',value:function lookForSelectablePosition(position,lookDown){var adapter=this.mAdapter;if(adapter==null||this.isInTouchMode()){return ListView.INVALID_POSITION;}var count=adapter.getCount();if(!this.mAreAllItemsSelectable){if(lookDown){position=Math.max(0,position);while(position<count&&!adapter.isEnabled(position)){position++;}}else{position=Math.min(position,count-1);while(position>=0&&!adapter.isEnabled(position)){position--;}}}if(position<0||position>=count){return ListView.INVALID_POSITION;}return position;}},{key:'lookForSelectablePositionAfter',value:function lookForSelectablePositionAfter(current,position,lookDown){var adapter=this.mAdapter;if(adapter==null||this.isInTouchMode()){return ListView.INVALID_POSITION;}var after=this.lookForSelectablePosition(position,lookDown);if(after!=ListView.INVALID_POSITION){return after;}var count=adapter.getCount();current=MathUtils.constrain(current,-1,count-1);if(lookDown){position=Math.min(position-1,count-1);while(position>current&&!adapter.isEnabled(position)){position--;}if(position<=current){return ListView.INVALID_POSITION;}}else{position=Math.max(0,position+1);while(position<current&&!adapter.isEnabled(position)){position++;}if(position>=current){return ListView.INVALID_POSITION;}}return position;}},{key:'setSelectionAfterHeaderView',value:function setSelectionAfterHeaderView(){var count=this.mHeaderViewInfos.size();if(count>0){this.mNextSelectedPosition=0;return;}if(this.mAdapter!=null){this.setSelection(count);}else{this.mNextSelectedPosition=count;this.mLayoutMode=ListView.LAYOUT_SET_SELECTION;}}},{key:'dispatchKeyEvent',value:function dispatchKeyEvent(event){var handled=_get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'dispatchKeyEvent',this).call(this,event);if(!handled){var focused=this.getFocusedChild();if(focused!=null&&event.getAction()==KeyEvent.ACTION_DOWN){handled=this.onKeyDown(event.getKeyCode(),event);}}return handled;}},{key:'onKeyDown',value:function onKeyDown(keyCode,event){return this.commonKey(keyCode,1,event);}},{key:'onKeyMultiple',value:function onKeyMultiple(keyCode,repeatCount,event){return this.commonKey(keyCode,repeatCount,event);}},{key:'onKeyUp',value:function onKeyUp(keyCode,event){return this.commonKey(keyCode,1,event);}},{key:'commonKey',value:function commonKey(keyCode,count,event){if(this.mAdapter==null||!this.isAttachedToWindow()){return false;}if(this.mDataChanged){this.layoutChildren();}var handled=false;var action=event.getAction();if(action!=KeyEvent.ACTION_UP){switch(keyCode){case KeyEvent.KEYCODE_DPAD_UP:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded();if(!handled){while(count-->0){if(this.arrowScroll(ListView.FOCUS_UP)){handled=true;}else{break;}}}}else if(event.hasModifiers(KeyEvent.META_ALT_ON)){handled=this.resurrectSelectionIfNeeded()||this.fullScroll(ListView.FOCUS_UP);}break;case KeyEvent.KEYCODE_DPAD_DOWN:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded();if(!handled){while(count-->0){if(this.arrowScroll(ListView.FOCUS_DOWN)){handled=true;}else{break;}}}}else if(event.hasModifiers(KeyEvent.META_ALT_ON)){handled=this.resurrectSelectionIfNeeded()||this.fullScroll(ListView.FOCUS_DOWN);}break;case KeyEvent.KEYCODE_DPAD_LEFT:if(event.hasNoModifiers()){handled=this.handleHorizontalFocusWithinListItem(View.FOCUS_LEFT);}break;case KeyEvent.KEYCODE_DPAD_RIGHT:if(event.hasNoModifiers()){handled=this.handleHorizontalFocusWithinListItem(View.FOCUS_RIGHT);}break;case KeyEvent.KEYCODE_DPAD_CENTER:case KeyEvent.KEYCODE_ENTER:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded();if(!handled&&event.getRepeatCount()==0&&this.getChildCount()>0){this.keyPressed();handled=true;}}break;case KeyEvent.KEYCODE_SPACE:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded()||this.pageScroll(ListView.FOCUS_DOWN);}else if(event.hasModifiers(KeyEvent.META_SHIFT_ON)){handled=this.resurrectSelectionIfNeeded()||this.pageScroll(ListView.FOCUS_UP);}handled=true;break;case KeyEvent.KEYCODE_PAGE_UP:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded()||this.pageScroll(ListView.FOCUS_UP);}else if(event.hasModifiers(KeyEvent.META_ALT_ON)){handled=this.resurrectSelectionIfNeeded()||this.fullScroll(ListView.FOCUS_UP);}break;case KeyEvent.KEYCODE_PAGE_DOWN:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded()||this.pageScroll(ListView.FOCUS_DOWN);}else if(event.hasModifiers(KeyEvent.META_ALT_ON)){handled=this.resurrectSelectionIfNeeded()||this.fullScroll(ListView.FOCUS_DOWN);}break;case KeyEvent.KEYCODE_MOVE_HOME:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded()||this.fullScroll(ListView.FOCUS_UP);}break;case KeyEvent.KEYCODE_MOVE_END:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded()||this.fullScroll(ListView.FOCUS_DOWN);}break;case KeyEvent.KEYCODE_TAB:break;}}if(handled){return true;}switch(action){case KeyEvent.ACTION_DOWN:return _get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'onKeyDown',this).call(this,keyCode,event);case KeyEvent.ACTION_UP:return _get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'onKeyUp',this).call(this,keyCode,event);default:return false;}}},{key:'pageScroll',value:function pageScroll(direction){var nextPage=void 0;var down=void 0;if(direction==ListView.FOCUS_UP){nextPage=Math.max(0,this.mSelectedPosition-this.getChildCount()-1);down=false;}else if(direction==ListView.FOCUS_DOWN){nextPage=Math.min(this.mItemCount-1,this.mSelectedPosition+this.getChildCount()-1);down=true;}else{return false;}if(nextPage>=0){var position=this.lookForSelectablePositionAfter(this.mSelectedPosition,nextPage,down);if(position>=0){this.mLayoutMode=ListView.LAYOUT_SPECIFIC;this.mSpecificTop=this.mPaddingTop+this.getVerticalFadingEdgeLength();if(down&&position>this.mItemCount-this.getChildCount()){this.mLayoutMode=ListView.LAYOUT_FORCE_BOTTOM;}if(!down&&position<this.getChildCount()){this.mLayoutMode=ListView.LAYOUT_FORCE_TOP;}this.setSelectionInt(position);this.invokeOnItemScrollListener();if(!this.awakenScrollBars()){this.invalidate();}return true;}}return false;}},{key:'fullScroll',value:function fullScroll(direction){var moved=false;if(direction==ListView.FOCUS_UP){if(this.mSelectedPosition!=0){var position=this.lookForSelectablePositionAfter(this.mSelectedPosition,0,true);if(position>=0){this.mLayoutMode=ListView.LAYOUT_FORCE_TOP;this.setSelectionInt(position);this.invokeOnItemScrollListener();}moved=true;}}else if(direction==ListView.FOCUS_DOWN){var lastItem=this.mItemCount-1;if(this.mSelectedPosition<lastItem){var _position4=this.lookForSelectablePositionAfter(this.mSelectedPosition,lastItem,false);if(_position4>=0){this.mLayoutMode=ListView.LAYOUT_FORCE_BOTTOM;this.setSelectionInt(_position4);this.invokeOnItemScrollListener();}moved=true;}}if(moved&&!this.awakenScrollBars()){this.awakenScrollBars();this.invalidate();}return moved;}},{key:'handleHorizontalFocusWithinListItem',value:function handleHorizontalFocusWithinListItem(direction){if(direction!=View.FOCUS_LEFT&&direction!=View.FOCUS_RIGHT){throw Error('new IllegalArgumentException(\"direction must be one of\" + \" {View.FOCUS_LEFT, View.FOCUS_RIGHT}\")');}var numChildren=this.getChildCount();if(this.mItemsCanFocus&&numChildren>0&&this.mSelectedPosition!=ListView.INVALID_POSITION){var selectedView=this.getSelectedView();if(selectedView!=null&&selectedView.hasFocus()&&selectedView instanceof ViewGroup){var currentFocus=selectedView.findFocus();var nextFocus=FocusFinder.getInstance().findNextFocus(selectedView,currentFocus,direction);if(nextFocus!=null){currentFocus.getFocusedRect(this.mTempRect);this.offsetDescendantRectToMyCoords(currentFocus,this.mTempRect);this.offsetRectIntoDescendantCoords(nextFocus,this.mTempRect);if(nextFocus.requestFocus(direction,this.mTempRect)){return true;}}var globalNextFocus=FocusFinder.getInstance().findNextFocus(this.getRootView(),currentFocus,direction);if(globalNextFocus!=null){return this.isViewAncestorOf(globalNextFocus,this);}}}return false;}},{key:'arrowScroll',value:function arrowScroll(direction){try{this.mInLayout=true;var handled=this.arrowScrollImpl(direction);if(handled){this.playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));}return handled;}finally{this.mInLayout=false;}}},{key:'nextSelectedPositionForDirection',value:function nextSelectedPositionForDirection(selectedView,selectedPos,direction){var nextSelected=void 0;if(direction==View.FOCUS_DOWN){var listBottom=this.getHeight()-this.mListPadding.bottom;if(selectedView!=null&&selectedView.getBottom()<=listBottom){nextSelected=selectedPos!=ListView.INVALID_POSITION&&selectedPos>=this.mFirstPosition?selectedPos+1:this.mFirstPosition;}else{return ListView.INVALID_POSITION;}}else{var listTop=this.mListPadding.top;if(selectedView!=null&&selectedView.getTop()>=listTop){var lastPos=this.mFirstPosition+this.getChildCount()-1;nextSelected=selectedPos!=ListView.INVALID_POSITION&&selectedPos<=lastPos?selectedPos-1:lastPos;}else{return ListView.INVALID_POSITION;}}if(nextSelected<0||nextSelected>=this.mAdapter.getCount()){return ListView.INVALID_POSITION;}return this.lookForSelectablePosition(nextSelected,direction==View.FOCUS_DOWN);}},{key:'arrowScrollImpl',value:function arrowScrollImpl(direction){if(this.getChildCount()<=0){return false;}var selectedView=this.getSelectedView();var selectedPos=this.mSelectedPosition;var nextSelectedPosition=this.nextSelectedPositionForDirection(selectedView,selectedPos,direction);var amountToScroll=this.amountToScroll(direction,nextSelectedPosition);var focusResult=this.mItemsCanFocus?this.arrowScrollFocused(direction):null;if(focusResult!=null){nextSelectedPosition=focusResult.getSelectedPosition();amountToScroll=focusResult.getAmountToScroll();}var needToRedraw=focusResult!=null;if(nextSelectedPosition!=ListView.INVALID_POSITION){this.handleNewSelectionChange(selectedView,direction,nextSelectedPosition,focusResult!=null);this.setSelectedPositionInt(nextSelectedPosition);this.setNextSelectedPositionInt(nextSelectedPosition);selectedView=this.getSelectedView();selectedPos=nextSelectedPosition;if(this.mItemsCanFocus&&focusResult==null){var focused=this.getFocusedChild();if(focused!=null){focused.clearFocus();}}needToRedraw=true;this.checkSelectionChanged();}if(amountToScroll>0){this.scrollListItemsBy(direction==View.FOCUS_UP?amountToScroll:-amountToScroll);needToRedraw=true;}if(this.mItemsCanFocus&&focusResult==null&&selectedView!=null&&selectedView.hasFocus()){var _focused=selectedView.findFocus();if(!this.isViewAncestorOf(_focused,this)||this.distanceToView(_focused)>0){_focused.clearFocus();}}if(nextSelectedPosition==ListView.INVALID_POSITION&&selectedView!=null&&!this.isViewAncestorOf(selectedView,this)){selectedView=null;this.hideSelector();this.mResurrectToPosition=ListView.INVALID_POSITION;}if(needToRedraw){if(selectedView!=null){this.positionSelector(selectedPos,selectedView);this.mSelectedTop=selectedView.getTop();}if(!this.awakenScrollBars()){this.invalidate();}this.invokeOnItemScrollListener();return true;}return false;}},{key:'handleNewSelectionChange',value:function handleNewSelectionChange(selectedView,direction,newSelectedPosition,newFocusAssigned){if(newSelectedPosition==ListView.INVALID_POSITION){throw Error('new IllegalArgumentException(\"newSelectedPosition needs to be valid\")');}var topView=void 0;var bottomView=void 0;var topViewIndex=void 0,bottomViewIndex=void 0;var topSelected=false;var selectedIndex=this.mSelectedPosition-this.mFirstPosition;var nextSelectedIndex=newSelectedPosition-this.mFirstPosition;if(direction==View.FOCUS_UP){topViewIndex=nextSelectedIndex;bottomViewIndex=selectedIndex;topView=this.getChildAt(topViewIndex);bottomView=selectedView;topSelected=true;}else{topViewIndex=selectedIndex;bottomViewIndex=nextSelectedIndex;topView=selectedView;bottomView=this.getChildAt(bottomViewIndex);}var numChildren=this.getChildCount();if(topView!=null){topView.setSelected(!newFocusAssigned&&topSelected);this.measureAndAdjustDown(topView,topViewIndex,numChildren);}if(bottomView!=null){bottomView.setSelected(!newFocusAssigned&&!topSelected);this.measureAndAdjustDown(bottomView,bottomViewIndex,numChildren);}}},{key:'measureAndAdjustDown',value:function measureAndAdjustDown(child,childIndex,numChildren){var oldHeight=child.getHeight();this.measureItem(child);if(child.getMeasuredHeight()!=oldHeight){this.relayoutMeasuredItem(child);var heightDelta=child.getMeasuredHeight()-oldHeight;for(var i=childIndex+1;i<numChildren;i++){this.getChildAt(i).offsetTopAndBottom(heightDelta);}}}},{key:'measureItem',value:function measureItem(child){var p=child.getLayoutParams();if(p==null){p=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);}var childWidthSpec=ViewGroup.getChildMeasureSpec(this.mWidthMeasureSpec,this.mListPadding.left+this.mListPadding.right,p.width);var lpHeight=p.height;var childHeightSpec=void 0;if(lpHeight>0){childHeightSpec=View.MeasureSpec.makeMeasureSpec(lpHeight,View.MeasureSpec.EXACTLY);}else{childHeightSpec=View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);}child.measure(childWidthSpec,childHeightSpec);}},{key:'relayoutMeasuredItem',value:function relayoutMeasuredItem(child){var w=child.getMeasuredWidth();var h=child.getMeasuredHeight();var childLeft=this.mListPadding.left;var childRight=childLeft+w;var childTop=child.getTop();var childBottom=childTop+h;child.layout(childLeft,childTop,childRight,childBottom);}},{key:'getArrowScrollPreviewLength',value:function getArrowScrollPreviewLength(){return Math.max(ListView.MIN_SCROLL_PREVIEW_PIXELS,this.getVerticalFadingEdgeLength());}},{key:'amountToScroll',value:function amountToScroll(direction,nextSelectedPosition){var listBottom=this.getHeight()-this.mListPadding.bottom;var listTop=this.mListPadding.top;var numChildren=this.getChildCount();if(direction==View.FOCUS_DOWN){var indexToMakeVisible=numChildren-1;if(nextSelectedPosition!=ListView.INVALID_POSITION){indexToMakeVisible=nextSelectedPosition-this.mFirstPosition;}while(numChildren<=indexToMakeVisible){this.addViewBelow(this.getChildAt(numChildren-1),this.mFirstPosition+numChildren-1);numChildren++;}var positionToMakeVisible=this.mFirstPosition+indexToMakeVisible;var viewToMakeVisible=this.getChildAt(indexToMakeVisible);var goalBottom=listBottom;if(positionToMakeVisible<this.mItemCount-1){goalBottom-=this.getArrowScrollPreviewLength();}if(viewToMakeVisible.getBottom()<=goalBottom){return 0;}if(nextSelectedPosition!=ListView.INVALID_POSITION&&goalBottom-viewToMakeVisible.getTop()>=this.getMaxScrollAmount()){return 0;}var amountToScroll=viewToMakeVisible.getBottom()-goalBottom;if(this.mFirstPosition+numChildren==this.mItemCount){var max=this.getChildAt(numChildren-1).getBottom()-listBottom;amountToScroll=Math.min(amountToScroll,max);}return Math.min(amountToScroll,this.getMaxScrollAmount());}else{var _indexToMakeVisible=0;if(nextSelectedPosition!=ListView.INVALID_POSITION){_indexToMakeVisible=nextSelectedPosition-this.mFirstPosition;}while(_indexToMakeVisible<0){this.addViewAbove(this.getChildAt(0),this.mFirstPosition);this.mFirstPosition--;_indexToMakeVisible=nextSelectedPosition-this.mFirstPosition;}var _positionToMakeVisible=this.mFirstPosition+_indexToMakeVisible;var _viewToMakeVisible=this.getChildAt(_indexToMakeVisible);var goalTop=listTop;if(_positionToMakeVisible>0){goalTop+=this.getArrowScrollPreviewLength();}if(_viewToMakeVisible.getTop()>=goalTop){return 0;}if(nextSelectedPosition!=ListView.INVALID_POSITION&&_viewToMakeVisible.getBottom()-goalTop>=this.getMaxScrollAmount()){return 0;}var _amountToScroll=goalTop-_viewToMakeVisible.getTop();if(this.mFirstPosition==0){var _max=listTop-this.getChildAt(0).getTop();_amountToScroll=Math.min(_amountToScroll,_max);}return Math.min(_amountToScroll,this.getMaxScrollAmount());}}},{key:'lookForSelectablePositionOnScreen',value:function lookForSelectablePositionOnScreen(direction){var firstPosition=this.mFirstPosition;if(direction==View.FOCUS_DOWN){var startPos=this.mSelectedPosition!=ListView.INVALID_POSITION?this.mSelectedPosition+1:firstPosition;if(startPos>=this.mAdapter.getCount()){return ListView.INVALID_POSITION;}if(startPos<firstPosition){startPos=firstPosition;}var lastVisiblePos=this.getLastVisiblePosition();var adapter=this.getAdapter();for(var pos=startPos;pos<=lastVisiblePos;pos++){if(adapter.isEnabled(pos)&&this.getChildAt(pos-firstPosition).getVisibility()==View.VISIBLE){return pos;}}}else{var last=firstPosition+this.getChildCount()-1;var _startPos=this.mSelectedPosition!=ListView.INVALID_POSITION?this.mSelectedPosition-1:firstPosition+this.getChildCount()-1;if(_startPos<0||_startPos>=this.mAdapter.getCount()){return ListView.INVALID_POSITION;}if(_startPos>last){_startPos=last;}var _adapter=this.getAdapter();for(var _pos=_startPos;_pos>=firstPosition;_pos--){if(_adapter.isEnabled(_pos)&&this.getChildAt(_pos-firstPosition).getVisibility()==View.VISIBLE){return _pos;}}}return ListView.INVALID_POSITION;}},{key:'arrowScrollFocused',value:function arrowScrollFocused(direction){var selectedView=this.getSelectedView();var newFocus=void 0;if(selectedView!=null&&selectedView.hasFocus()){var oldFocus=selectedView.findFocus();newFocus=FocusFinder.getInstance().findNextFocus(this,oldFocus,direction);}else{if(direction==View.FOCUS_DOWN){var topFadingEdgeShowing=this.mFirstPosition>0;var listTop=this.mListPadding.top+(topFadingEdgeShowing?this.getArrowScrollPreviewLength():0);var ySearchPoint=selectedView!=null&&selectedView.getTop()>listTop?selectedView.getTop():listTop;this.mTempRect.set(0,ySearchPoint,0,ySearchPoint);}else{var bottomFadingEdgeShowing=this.mFirstPosition+this.getChildCount()-1<this.mItemCount;var listBottom=this.getHeight()-this.mListPadding.bottom-(bottomFadingEdgeShowing?this.getArrowScrollPreviewLength():0);var _ySearchPoint=selectedView!=null&&selectedView.getBottom()<listBottom?selectedView.getBottom():listBottom;this.mTempRect.set(0,_ySearchPoint,0,_ySearchPoint);}newFocus=FocusFinder.getInstance().findNextFocusFromRect(this,this.mTempRect,direction);}if(newFocus!=null){var positionOfNewFocus=this.positionOfNewFocus(newFocus);if(this.mSelectedPosition!=ListView.INVALID_POSITION&&positionOfNewFocus!=this.mSelectedPosition){var selectablePosition=this.lookForSelectablePositionOnScreen(direction);if(selectablePosition!=ListView.INVALID_POSITION&&(direction==View.FOCUS_DOWN&&selectablePosition<positionOfNewFocus||direction==View.FOCUS_UP&&selectablePosition>positionOfNewFocus)){return null;}}var focusScroll=this.amountToScrollToNewFocus(direction,newFocus,positionOfNewFocus);var maxScrollAmount=this.getMaxScrollAmount();if(focusScroll<maxScrollAmount){newFocus.requestFocus(direction);this.mArrowScrollFocusResult.populate(positionOfNewFocus,focusScroll);return this.mArrowScrollFocusResult;}else if(this.distanceToView(newFocus)<maxScrollAmount){newFocus.requestFocus(direction);this.mArrowScrollFocusResult.populate(positionOfNewFocus,maxScrollAmount);return this.mArrowScrollFocusResult;}}return null;}},{key:'positionOfNewFocus',value:function positionOfNewFocus(newFocus){var numChildren=this.getChildCount();for(var i=0;i<numChildren;i++){var child=this.getChildAt(i);if(this.isViewAncestorOf(newFocus,child)){return this.mFirstPosition+i;}}throw Error('new IllegalArgumentException(\"newFocus is not a child of any of the\" + \" children of the list!\")');}},{key:'isViewAncestorOf',value:function isViewAncestorOf(child,parent){if(child==parent){return true;}var theParent=child.getParent();return theParent instanceof ViewGroup&&this.isViewAncestorOf(theParent,parent);}},{key:'amountToScrollToNewFocus',value:function amountToScrollToNewFocus(direction,newFocus,positionOfNewFocus){var amountToScroll=0;newFocus.getDrawingRect(this.mTempRect);this.offsetDescendantRectToMyCoords(newFocus,this.mTempRect);if(direction==View.FOCUS_UP){if(this.mTempRect.top<this.mListPadding.top){amountToScroll=this.mListPadding.top-this.mTempRect.top;if(positionOfNewFocus>0){amountToScroll+=this.getArrowScrollPreviewLength();}}}else{var listBottom=this.getHeight()-this.mListPadding.bottom;if(this.mTempRect.bottom>listBottom){amountToScroll=this.mTempRect.bottom-listBottom;if(positionOfNewFocus<this.mItemCount-1){amountToScroll+=this.getArrowScrollPreviewLength();}}}return amountToScroll;}},{key:'distanceToView',value:function distanceToView(descendant){var distance=0;descendant.getDrawingRect(this.mTempRect);this.offsetDescendantRectToMyCoords(descendant,this.mTempRect);var listBottom=this.mBottom-this.mTop-this.mListPadding.bottom;if(this.mTempRect.bottom<this.mListPadding.top){distance=this.mListPadding.top-this.mTempRect.bottom;}else if(this.mTempRect.top>listBottom){distance=this.mTempRect.top-listBottom;}return distance;}},{key:'scrollListItemsBy',value:function scrollListItemsBy(amount){this.offsetChildrenTopAndBottom(amount);var listBottom=this.getHeight()-this.mListPadding.bottom;var listTop=this.mListPadding.top;var recycleBin=this.mRecycler;if(amount<0){var numChildren=this.getChildCount();var last=this.getChildAt(numChildren-1);while(last.getBottom()<listBottom){var lastVisiblePosition=this.mFirstPosition+numChildren-1;if(lastVisiblePosition<this.mItemCount-1){last=this.addViewBelow(last,lastVisiblePosition);numChildren++;}else{break;}}if(last.getBottom()<listBottom){this.offsetChildrenTopAndBottom(listBottom-last.getBottom());}var first=this.getChildAt(0);while(first.getBottom()<listTop){var layoutParams=first.getLayoutParams();if(recycleBin.shouldRecycleViewType(layoutParams.viewType)){recycleBin.addScrapView(first,this.mFirstPosition);}this.detachViewFromParent(first);first=this.getChildAt(0);this.mFirstPosition++;}}else{var _first=this.getChildAt(0);while(_first.getTop()>listTop&&this.mFirstPosition>0){_first=this.addViewAbove(_first,this.mFirstPosition);this.mFirstPosition--;}if(_first.getTop()>listTop){this.offsetChildrenTopAndBottom(listTop-_first.getTop());}var lastIndex=this.getChildCount()-1;var _last=this.getChildAt(lastIndex);while(_last.getTop()>listBottom){var _layoutParams=_last.getLayoutParams();if(recycleBin.shouldRecycleViewType(_layoutParams.viewType)){recycleBin.addScrapView(_last,this.mFirstPosition+lastIndex);}this.detachViewFromParent(_last);_last=this.getChildAt(--lastIndex);}}}},{key:'addViewAbove',value:function addViewAbove(theView,position){var abovePosition=position-1;var view=this.obtainView(abovePosition,this.mIsScrap);var edgeOfNewChild=theView.getTop()-this.mDividerHeight;this.setupChild(view,abovePosition,edgeOfNewChild,false,this.mListPadding.left,false,this.mIsScrap[0]);return view;}},{key:'addViewBelow',value:function addViewBelow(theView,position){var belowPosition=position+1;var view=this.obtainView(belowPosition,this.mIsScrap);var edgeOfNewChild=theView.getBottom()+this.mDividerHeight;this.setupChild(view,belowPosition,edgeOfNewChild,true,this.mListPadding.left,false,this.mIsScrap[0]);return view;}},{key:'setItemsCanFocus',value:function setItemsCanFocus(itemsCanFocus){this.mItemsCanFocus=itemsCanFocus;if(!itemsCanFocus){this.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);}}},{key:'getItemsCanFocus',value:function getItemsCanFocus(){return this.mItemsCanFocus;}},{key:'isOpaque',value:function isOpaque(){var retValue=this.mCachingActive&&this.mIsCacheColorOpaque&&this.mDividerIsOpaque&&this.hasOpaqueScrollbars()||_get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'isOpaque',this).call(this);if(retValue){var listTop=this.mListPadding!=null?this.mListPadding.top:this.mPaddingTop;var first=this.getChildAt(0);if(first==null||first.getTop()>listTop){return false;}var listBottom=this.getHeight()-(this.mListPadding!=null?this.mListPadding.bottom:this.mPaddingBottom);var last=this.getChildAt(this.getChildCount()-1);if(last==null||last.getBottom()<listBottom){return false;}}return retValue;}},{key:'setCacheColorHint',value:function setCacheColorHint(color){var opaque=color>>>24==0xFF;this.mIsCacheColorOpaque=opaque;if(opaque){if(this.mDividerPaint==null){this.mDividerPaint=new Paint();}this.mDividerPaint.setColor(color);}_get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'setCacheColorHint',this).call(this,color);}},{key:'drawOverscrollHeader',value:function drawOverscrollHeader(canvas,drawable,bounds){var height=drawable.getMinimumHeight();canvas.save();canvas.clipRect(bounds);var span=bounds.bottom-bounds.top;if(span<height){bounds.top=bounds.bottom-height;}drawable.setBounds(bounds);drawable.draw(canvas);canvas.restore();}},{key:'drawOverscrollFooter',value:function drawOverscrollFooter(canvas,drawable,bounds){var height=drawable.getMinimumHeight();canvas.save();canvas.clipRect(bounds);var span=bounds.bottom-bounds.top;if(span<height){bounds.bottom=bounds.top+height;}drawable.setBounds(bounds);drawable.draw(canvas);canvas.restore();}},{key:'dispatchDraw',value:function dispatchDraw(canvas){if(this.mCachingStarted){this.mCachingActive=true;}var dividerHeight=this.mDividerHeight;var overscrollHeader=this.mOverScrollHeader;var overscrollFooter=this.mOverScrollFooter;var drawOverscrollHeader=overscrollHeader!=null;var drawOverscrollFooter=overscrollFooter!=null;var drawDividers=dividerHeight>0&&this.mDivider!=null;if(drawDividers||drawOverscrollHeader||drawOverscrollFooter){var bounds=this.mTempRect;bounds.left=this.mPaddingLeft;bounds.right=this.mRight-this.mLeft-this.mPaddingRight;var count=this.getChildCount();var headerCount=this.mHeaderViewInfos.size();var itemCount=this.mItemCount;var footerLimit=itemCount-this.mFooterViewInfos.size();var headerDividers=this.mHeaderDividersEnabled;var footerDividers=this.mFooterDividersEnabled;var first=this.mFirstPosition;var areAllItemsSelectable=this.mAreAllItemsSelectable;var adapter=this.mAdapter;var fillForMissingDividers=this.isOpaque()&&!_get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'isOpaque',this).call(this);if(fillForMissingDividers&&this.mDividerPaint==null&&this.mIsCacheColorOpaque){this.mDividerPaint=new Paint();this.mDividerPaint.setColor(this.getCacheColorHint());}var paint=this.mDividerPaint;var effectivePaddingTop=0;var effectivePaddingBottom=0;if((this.mGroupFlags&ListView.CLIP_TO_PADDING_MASK)==ListView.CLIP_TO_PADDING_MASK){effectivePaddingTop=this.mListPadding.top;effectivePaddingBottom=this.mListPadding.bottom;}var listBottom=this.mBottom-this.mTop-effectivePaddingBottom+this.mScrollY;if(!this.mStackFromBottom){var bottom=0;var scrollY=this.mScrollY;if(count>0&&scrollY<0){if(drawOverscrollHeader){bounds.bottom=0;bounds.top=scrollY;this.drawOverscrollHeader(canvas,overscrollHeader,bounds);}else if(drawDividers){bounds.bottom=0;bounds.top=-dividerHeight;this.drawDivider(canvas,bounds,-1);}}for(var i=0;i<count;i++){var itemIndex=first+i;var isHeader=itemIndex<headerCount;var isFooter=itemIndex>=footerLimit;if((headerDividers||!isHeader)&&(footerDividers||!isFooter)){var child=this.getChildAt(i);bottom=child.getBottom();var isLastItem=i==count-1;if(drawDividers&&bottom<listBottom&&!(drawOverscrollFooter&&isLastItem)){var nextIndex=itemIndex+1;if(areAllItemsSelectable||(adapter.isEnabled(itemIndex)||headerDividers&&isHeader||footerDividers&&isFooter)&&(isLastItem||adapter.isEnabled(nextIndex)||headerDividers&&nextIndex<headerCount||footerDividers&&nextIndex>=footerLimit)){bounds.top=bottom;bounds.bottom=bottom+dividerHeight;this.drawDivider(canvas,bounds,i);}else if(fillForMissingDividers){bounds.top=bottom;bounds.bottom=bottom+dividerHeight;canvas.drawRect(bounds,paint);}}}}var overFooterBottom=this.mBottom+this.mScrollY;if(drawOverscrollFooter&&first+count==itemCount&&overFooterBottom>bottom){bounds.top=bottom;bounds.bottom=overFooterBottom;this.drawOverscrollFooter(canvas,overscrollFooter,bounds);}}else{var top=void 0;var _scrollY=this.mScrollY;if(count>0&&drawOverscrollHeader){bounds.top=_scrollY;bounds.bottom=this.getChildAt(0).getTop();this.drawOverscrollHeader(canvas,overscrollHeader,bounds);}var start=drawOverscrollHeader?1:0;for(var _i47=start;_i47<count;_i47++){var _itemIndex=first+_i47;var _isHeader=_itemIndex<headerCount;var _isFooter=_itemIndex>=footerLimit;if((headerDividers||!_isHeader)&&(footerDividers||!_isFooter)){var _child15=this.getChildAt(_i47);top=_child15.getTop();if(drawDividers&&top>effectivePaddingTop){var isFirstItem=_i47==start;var previousIndex=_itemIndex-1;if(areAllItemsSelectable||(adapter.isEnabled(_itemIndex)||headerDividers&&_isHeader||footerDividers&&_isFooter)&&(isFirstItem||adapter.isEnabled(previousIndex)||headerDividers&&previousIndex<headerCount||footerDividers&&previousIndex>=footerLimit)){bounds.top=top-dividerHeight;bounds.bottom=top;this.drawDivider(canvas,bounds,_i47-1);}else if(fillForMissingDividers){bounds.top=top-dividerHeight;bounds.bottom=top;canvas.drawRect(bounds,paint);}}}}if(count>0&&_scrollY>0){if(drawOverscrollFooter){var absListBottom=this.mBottom;bounds.top=absListBottom;bounds.bottom=absListBottom+_scrollY;this.drawOverscrollFooter(canvas,overscrollFooter,bounds);}else if(drawDividers){bounds.top=listBottom;bounds.bottom=listBottom+dividerHeight;this.drawDivider(canvas,bounds,-1);}}}}_get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'dispatchDraw',this).call(this,canvas);}},{key:'drawChild',value:function drawChild(canvas,child,drawingTime){var more=_get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'drawChild',this).call(this,canvas,child,drawingTime);if(this.mCachingActive&&child.mCachingFailed){this.mCachingActive=false;}return more;}},{key:'drawDivider',value:function drawDivider(canvas,bounds,childIndex){var divider=this.mDivider;divider.setBounds(bounds);divider.draw(canvas);}},{key:'getDivider',value:function getDivider(){return this.mDivider;}},{key:'setDivider',value:function setDivider(divider){if(divider!=null){this.mDividerHeight=divider.getIntrinsicHeight();}else{this.mDividerHeight=0;}this.mDivider=divider;this.mDividerIsOpaque=divider==null||divider.getOpacity()==PixelFormat.OPAQUE;this.requestLayout();this.invalidate();}},{key:'getDividerHeight',value:function getDividerHeight(){return this.mDividerHeight;}},{key:'setDividerHeight',value:function setDividerHeight(height){this.mDividerHeight=height;this.requestLayout();this.invalidate();}},{key:'setHeaderDividersEnabled',value:function setHeaderDividersEnabled(headerDividersEnabled){this.mHeaderDividersEnabled=headerDividersEnabled;this.invalidate();}},{key:'areHeaderDividersEnabled',value:function areHeaderDividersEnabled(){return this.mHeaderDividersEnabled;}},{key:'setFooterDividersEnabled',value:function setFooterDividersEnabled(footerDividersEnabled){this.mFooterDividersEnabled=footerDividersEnabled;this.invalidate();}},{key:'areFooterDividersEnabled',value:function areFooterDividersEnabled(){return this.mFooterDividersEnabled;}},{key:'setOverscrollHeader',value:function setOverscrollHeader(header){this.mOverScrollHeader=header;if(this.mScrollY<0){this.invalidate();}}},{key:'getOverscrollHeader',value:function getOverscrollHeader(){return this.mOverScrollHeader;}},{key:'setOverscrollFooter',value:function setOverscrollFooter(footer){this.mOverScrollFooter=footer;this.invalidate();}},{key:'getOverscrollFooter',value:function getOverscrollFooter(){return this.mOverScrollFooter;}},{key:'onFocusChanged',value:function onFocusChanged(gainFocus,direction,previouslyFocusedRect){_get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'onFocusChanged',this).call(this,gainFocus,direction,previouslyFocusedRect);var adapter=this.mAdapter;var closetChildIndex=-1;var closestChildTop=0;if(adapter!=null&&gainFocus&&previouslyFocusedRect!=null){previouslyFocusedRect.offset(this.mScrollX,this.mScrollY);if(adapter.getCount()<this.getChildCount()+this.mFirstPosition){this.mLayoutMode=ListView.LAYOUT_NORMAL;this.layoutChildren();}var otherRect=this.mTempRect;var minDistance=Integer.MAX_VALUE;var childCount=this.getChildCount();var firstPosition=this.mFirstPosition;for(var i=0;i<childCount;i++){if(!adapter.isEnabled(firstPosition+i)){continue;}var other=this.getChildAt(i);other.getDrawingRect(otherRect);this.offsetDescendantRectToMyCoords(other,otherRect);var distance=ListView.getDistance(previouslyFocusedRect,otherRect,direction);if(distance<minDistance){minDistance=distance;closetChildIndex=i;closestChildTop=other.getTop();}}}if(closetChildIndex>=0){this.setSelectionFromTop(closetChildIndex+this.mFirstPosition,closestChildTop);}else{this.requestLayout();}}},{key:'onFinishInflate',value:function onFinishInflate(){_get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'onFinishInflate',this).call(this);var count=this.getChildCount();if(count>0){for(var i=0;i<count;++i){this.addHeaderView(this.getChildAt(i));}this.removeAllViews();}}},{key:'findViewTraversal',value:function findViewTraversal(id){var v=void 0;v=_get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'findViewTraversal',this).call(this,id);if(v==null){v=this.findViewInHeadersOrFooters(this.mHeaderViewInfos,id);if(v!=null){return v;}v=this.findViewInHeadersOrFooters(this.mFooterViewInfos,id);if(v!=null){return v;}}return v;}},{key:'findViewInHeadersOrFooters',value:function findViewInHeadersOrFooters(where,id){if(where!=null){var len=where.size();var v=void 0;for(var i=0;i<len;i++){v=where.get(i).view;if(!v.isRootNamespace()){v=v.findViewById(id);if(v!=null){return v;}}}}return null;}},{key:'findViewByPredicateTraversal',value:function findViewByPredicateTraversal(predicate,childToSkip){var v=void 0;v=_get2(ListView.prototype.__proto__||Object.getPrototypeOf(ListView.prototype),'findViewByPredicateTraversal',this).call(this,predicate,childToSkip);if(v==null){v=this.findViewByPredicateInHeadersOrFooters(this.mHeaderViewInfos,predicate,childToSkip);if(v!=null){return v;}v=this.findViewByPredicateInHeadersOrFooters(this.mFooterViewInfos,predicate,childToSkip);if(v!=null){return v;}}return v;}},{key:'findViewByPredicateInHeadersOrFooters',value:function findViewByPredicateInHeadersOrFooters(where,predicate,childToSkip){if(where!=null){var len=where.size();var v=void 0;for(var i=0;i<len;i++){v=where.get(i).view;if(v!=childToSkip&&!v.isRootNamespace()){v=v.findViewByPredicate(predicate);if(v!=null){return v;}}}}return null;}},{key:'getCheckItemIds',value:function getCheckItemIds(){if(this.mAdapter!=null&&this.mAdapter.hasStableIds()){return this.getCheckedItemIds();}if(this.mChoiceMode!=ListView.CHOICE_MODE_NONE&&this.mCheckStates!=null&&this.mAdapter!=null){var states=this.mCheckStates;var count=states.size();var ids=androidui.util.ArrayCreator.newNumberArray(count);var adapter=this.mAdapter;var checkedCount=0;for(var i=0;i<count;i++){if(states.valueAt(i)){ids[checkedCount++]=adapter.getItemId(states.keyAt(i));}}if(checkedCount==count){return ids;}else{var result=androidui.util.ArrayCreator.newNumberArray(checkedCount);System.arraycopy(ids,0,result,0,checkedCount);return result;}}return androidui.util.ArrayCreator.newNumberArray(0);}}]);return ListView;}(AbsListView);ListView.NO_POSITION=-1;ListView.MAX_SCROLL_FACTOR=0.33;ListView.MIN_SCROLL_PREVIEW_PIXELS=2;widget.ListView=ListView;(function(ListView){var FixedViewInfo=function FixedViewInfo(arg){_classCallCheck(this,FixedViewInfo);this._ListView_this=arg;};ListView.FixedViewInfo=FixedViewInfo;var FocusSelector=function(){function FocusSelector(arg){_classCallCheck(this,FocusSelector);this.mPosition=0;this.mPositionTop=0;this._ListView_this=arg;}_createClass(FocusSelector,[{key:'setup',value:function setup(position,top){this.mPosition=position;this.mPositionTop=top;return this;}},{key:'run',value:function run(){this._ListView_this.setSelectionFromTop(this.mPosition,this.mPositionTop);}}]);return FocusSelector;}();ListView.FocusSelector=FocusSelector;var ArrowScrollFocusResult=function(){function ArrowScrollFocusResult(){_classCallCheck(this,ArrowScrollFocusResult);this.mSelectedPosition=0;this.mAmountToScroll=0;}_createClass(ArrowScrollFocusResult,[{key:'populate',value:function populate(selectedPosition,amountToScroll){this.mSelectedPosition=selectedPosition;this.mAmountToScroll=amountToScroll;}},{key:'getSelectedPosition',value:function getSelectedPosition(){return this.mSelectedPosition;}},{key:'getAmountToScroll',value:function getAmountToScroll(){return this.mAmountToScroll;}}]);return ArrowScrollFocusResult;}();ListView.ArrowScrollFocusResult=ArrowScrollFocusResult;})(ListView=widget.ListView||(widget.ListView={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var Scroller=function(_widget$OverScroller){_inherits(Scroller,_widget$OverScroller);function Scroller(){_classCallCheck(this,Scroller);return _possibleConstructorReturn(this,(Scroller.__proto__||Object.getPrototypeOf(Scroller)).apply(this,arguments));}return Scroller;}(widget.OverScroller);widget.Scroller=Scroller;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var Rect=android.graphics.Rect;var Log=android.util.Log;var FocusFinder=android.view.FocusFinder;var KeyEvent=android.view.KeyEvent;var MotionEvent=android.view.MotionEvent;var VelocityTracker=android.view.VelocityTracker;var View=android.view.View;var ViewConfiguration=android.view.ViewConfiguration;var ViewGroup=android.view.ViewGroup;var AnimationUtils=android.view.animation.AnimationUtils;var FrameLayout=android.widget.FrameLayout;var OverScroller=android.widget.OverScroller;var ScrollView=function(_FrameLayout2){_inherits(ScrollView,_FrameLayout2);function ScrollView(context,bindElement){var defStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.R.attr.scrollViewStyle;_classCallCheck(this,ScrollView);var _this117=_possibleConstructorReturn(this,(ScrollView.__proto__||Object.getPrototypeOf(ScrollView)).call(this,context,bindElement,defStyle));_this117.mLastScroll=0;_this117.mTempRect=new Rect();_this117.mLastMotionY=0;_this117.mIsLayoutDirty=true;_this117.mChildToScrollTo=null;_this117.mIsBeingDragged=false;_this117.mSmoothScrollingEnabled=true;_this117.mMinimumVelocity=0;_this117.mMaximumVelocity=0;_this117.mOverscrollDistance=0;_this117.mOverflingDistance=0;_this117.mActivePointerId=ScrollView.INVALID_POINTER;_this117.initScrollView();var a=context.obtainStyledAttributes(bindElement,defStyle);_this117.setFillViewport(a.getBoolean('fillViewport',false));a.recycle();return _this117;}_createClass(ScrollView,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(ScrollView.prototype.__proto__||Object.getPrototypeOf(ScrollView.prototype),'createClassAttrBinder',this).call(this).set('fillViewport',{setter:function setter(v,value,attrBinder){v.setFillViewport(attrBinder.parseBoolean(value));},getter:function getter(v){return v.isFillViewport();}});}},{key:'shouldDelayChildPressedState',value:function shouldDelayChildPressedState(){return true;}},{key:'getTopFadingEdgeStrength',value:function getTopFadingEdgeStrength(){if(this.getChildCount()==0){return 0.0;}var length=this.getVerticalFadingEdgeLength();if(this.mScrollY<length){return this.mScrollY/length;}return 1.0;}},{key:'getBottomFadingEdgeStrength',value:function getBottomFadingEdgeStrength(){if(this.getChildCount()==0){return 0.0;}var length=this.getVerticalFadingEdgeLength();var bottomEdge=this.getHeight()-this.mPaddingBottom;var span=this.getChildAt(0).getBottom()-this.mScrollY-bottomEdge;if(span<length){return span/length;}return 1.0;}},{key:'getMaxScrollAmount',value:function getMaxScrollAmount(){return Math.floor(ScrollView.MAX_SCROLL_FACTOR*(this.mBottom-this.mTop));}},{key:'initScrollView',value:function initScrollView(){this.mScroller=new OverScroller();this.setFocusable(true);this.setDescendantFocusability(ScrollView.FOCUS_AFTER_DESCENDANTS);this.setWillNotDraw(false);var configuration=ViewConfiguration.get(this.mContext);this.mTouchSlop=configuration.getScaledTouchSlop();this.mMinimumVelocity=configuration.getScaledMinimumFlingVelocity();this.mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();this.mOverscrollDistance=configuration.getScaledOverscrollDistance();this.mOverflingDistance=configuration.getScaledOverflingDistance();}},{key:'addView',value:function addView(){var _get4;if(this.getChildCount()>0){throw new Error(\"ScrollView can host only one direct child\");}for(var _len28=arguments.length,args=Array(_len28),_key29=0;_key29<_len28;_key29++){args[_key29]=arguments[_key29];}return(_get4=_get2(ScrollView.prototype.__proto__||Object.getPrototypeOf(ScrollView.prototype),'addView',this)).call.apply(_get4,[this].concat(args));}},{key:'canScroll',value:function canScroll(){var child=this.getChildAt(0);if(child!=null){var childHeight=child.getHeight();return this.getHeight()<childHeight+this.mPaddingTop+this.mPaddingBottom;}return false;}},{key:'isFillViewport',value:function isFillViewport(){return this.mFillViewport;}},{key:'setFillViewport',value:function setFillViewport(fillViewport){if(fillViewport!=this.mFillViewport){this.mFillViewport=fillViewport;this.requestLayout();}}},{key:'isSmoothScrollingEnabled',value:function isSmoothScrollingEnabled(){return this.mSmoothScrollingEnabled;}},{key:'setSmoothScrollingEnabled',value:function setSmoothScrollingEnabled(smoothScrollingEnabled){this.mSmoothScrollingEnabled=smoothScrollingEnabled;}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){_get2(ScrollView.prototype.__proto__||Object.getPrototypeOf(ScrollView.prototype),'onMeasure',this).call(this,widthMeasureSpec,heightMeasureSpec);if(!this.mFillViewport){return;}var heightMode=View.MeasureSpec.getMode(heightMeasureSpec);if(heightMode==View.MeasureSpec.UNSPECIFIED){return;}if(this.getChildCount()>0){var child=this.getChildAt(0);var height=this.getMeasuredHeight();if(child.getMeasuredHeight()<height){var lp=child.getLayoutParams();var childWidthMeasureSpec=ScrollView.getChildMeasureSpec(widthMeasureSpec,this.mPaddingLeft+this.mPaddingRight,lp.width);height-=this.mPaddingTop;height-=this.mPaddingBottom;var childHeightMeasureSpec=View.MeasureSpec.makeMeasureSpec(height,View.MeasureSpec.EXACTLY);child.measure(childWidthMeasureSpec,childHeightMeasureSpec);}}}},{key:'dispatchKeyEvent',value:function dispatchKeyEvent(event){return _get2(ScrollView.prototype.__proto__||Object.getPrototypeOf(ScrollView.prototype),'dispatchKeyEvent',this).call(this,event)||this.executeKeyEvent(event);}},{key:'executeKeyEvent',value:function executeKeyEvent(event){this.mTempRect.setEmpty();if(!this.canScroll()){if(this.isFocused()&&event.getKeyCode()!=KeyEvent.KEYCODE_BACK){var currentFocused=this.findFocus();if(currentFocused==this)currentFocused=null;var nextFocused=FocusFinder.getInstance().findNextFocus(this,currentFocused,View.FOCUS_DOWN);return nextFocused!=null&&nextFocused!=this&&nextFocused.requestFocus(View.FOCUS_DOWN);}return false;}var handled=false;if(event.getAction()==KeyEvent.ACTION_DOWN){switch(event.getKeyCode()){case KeyEvent.KEYCODE_DPAD_UP:if(!event.isAltPressed()){handled=this.arrowScroll(View.FOCUS_UP);}else{handled=this.fullScroll(View.FOCUS_UP);}break;case KeyEvent.KEYCODE_DPAD_DOWN:if(!event.isAltPressed()){handled=this.arrowScroll(View.FOCUS_DOWN);}else{handled=this.fullScroll(View.FOCUS_DOWN);}break;case KeyEvent.KEYCODE_SPACE:this.pageScroll(event.isShiftPressed()?View.FOCUS_UP:View.FOCUS_DOWN);break;}}return handled;}},{key:'inChild',value:function inChild(x,y){if(this.getChildCount()>0){var scrollY=this.mScrollY;var child=this.getChildAt(0);return!(y<child.getTop()-scrollY||y>=child.getBottom()-scrollY||x<child.getLeft()||x>=child.getRight());}return false;}},{key:'initOrResetVelocityTracker',value:function initOrResetVelocityTracker(){if(this.mVelocityTracker==null){this.mVelocityTracker=VelocityTracker.obtain();}else{this.mVelocityTracker.clear();}}},{key:'initVelocityTrackerIfNotExists',value:function initVelocityTrackerIfNotExists(){if(this.mVelocityTracker==null){this.mVelocityTracker=VelocityTracker.obtain();}}},{key:'recycleVelocityTracker',value:function recycleVelocityTracker(){if(this.mVelocityTracker!=null){this.mVelocityTracker.recycle();this.mVelocityTracker=null;}}},{key:'requestDisallowInterceptTouchEvent',value:function requestDisallowInterceptTouchEvent(disallowIntercept){if(disallowIntercept){this.recycleVelocityTracker();}_get2(ScrollView.prototype.__proto__||Object.getPrototypeOf(ScrollView.prototype),'requestDisallowInterceptTouchEvent',this).call(this,disallowIntercept);}},{key:'onInterceptTouchEvent',value:function onInterceptTouchEvent(ev){var action=ev.getAction();if(action==MotionEvent.ACTION_MOVE&&this.mIsBeingDragged){return true;}if(this.getScrollY()==0&&!this.canScrollVertically(1)){return false;}switch(action&MotionEvent.ACTION_MASK){case MotionEvent.ACTION_MOVE:{var activePointerId=this.mActivePointerId;if(activePointerId==ScrollView.INVALID_POINTER){break;}var pointerIndex=ev.findPointerIndex(activePointerId);if(pointerIndex==-1){Log.e(ScrollView.TAG,\"Invalid pointerId=\"+activePointerId+\" in onInterceptTouchEvent\");break;}var _y12=Math.floor(ev.getY(pointerIndex));var yDiff=Math.abs(_y12-this.mLastMotionY);if(yDiff>this.mTouchSlop){this.mIsBeingDragged=true;this.mLastMotionY=_y12;this.initVelocityTrackerIfNotExists();this.mVelocityTracker.addMovement(ev);var parent=this.getParent();if(parent!=null){parent.requestDisallowInterceptTouchEvent(true);}}break;}case MotionEvent.ACTION_DOWN:{var _y13=Math.floor(ev.getY());if(!this.inChild(Math.floor(ev.getX()),Math.floor(_y13))){this.mIsBeingDragged=false;this.recycleVelocityTracker();break;}this.mLastMotionY=_y13;this.mActivePointerId=ev.getPointerId(0);this.initOrResetVelocityTracker();this.mVelocityTracker.addMovement(ev);this.mIsBeingDragged=!this.mScroller.isFinished();break;}case MotionEvent.ACTION_CANCEL:case MotionEvent.ACTION_UP:this.mIsBeingDragged=false;this.mActivePointerId=ScrollView.INVALID_POINTER;this.recycleVelocityTracker();if(this.mScroller.springBack(this.mScrollX,this.mScrollY,0,0,0,this.getScrollRange())){this.postInvalidateOnAnimation();}break;case MotionEvent.ACTION_POINTER_UP:this.onSecondaryPointerUp(ev);break;}return this.mIsBeingDragged;}},{key:'onTouchEvent',value:function onTouchEvent(ev){this.initVelocityTrackerIfNotExists();this.mVelocityTracker.addMovement(ev);var action=ev.getAction();switch(action&MotionEvent.ACTION_MASK){case MotionEvent.ACTION_DOWN:{if(this.getChildCount()==0){return false;}if(this.mIsBeingDragged=!this.mScroller.isFinished()){var parent=this.getParent();if(parent!=null){parent.requestDisallowInterceptTouchEvent(true);}}if(!this.mScroller.isFinished()){this.mScroller.abortAnimation();}this.mLastMotionY=Math.floor(ev.getY());this.mActivePointerId=ev.getPointerId(0);break;}case MotionEvent.ACTION_MOVE:var activePointerIndex=ev.findPointerIndex(this.mActivePointerId);if(activePointerIndex==-1){Log.e(ScrollView.TAG,\"Invalid pointerId=\"+this.mActivePointerId+\" in onTouchEvent\");break;}var _y14=Math.floor(ev.getY(activePointerIndex));var deltaY=this.mLastMotionY-_y14;if(!this.mIsBeingDragged&&Math.abs(deltaY)>this.mTouchSlop){var _parent=this.getParent();if(_parent!=null){_parent.requestDisallowInterceptTouchEvent(true);}this.mIsBeingDragged=true;if(deltaY>0){deltaY-=this.mTouchSlop;}else{deltaY+=this.mTouchSlop;}}if(this.mIsBeingDragged){this.mLastMotionY=_y14;var oldX=this.mScrollX;var oldY=this.mScrollY;var range=this.getScrollRange();var overscrollMode=this.getOverScrollMode();var canOverscroll=overscrollMode==ScrollView.OVER_SCROLL_ALWAYS||overscrollMode==ScrollView.OVER_SCROLL_IF_CONTENT_SCROLLS&&range>0;if(this.overScrollBy(0,deltaY,0,this.mScrollY,0,range,0,this.mOverscrollDistance,true)){this.mVelocityTracker.clear();}}break;case MotionEvent.ACTION_UP:if(this.mIsBeingDragged){var velocityTracker=this.mVelocityTracker;velocityTracker.computeCurrentVelocity(1000,this.mMaximumVelocity);var initialVelocity=Math.floor(velocityTracker.getYVelocity(this.mActivePointerId));if(this.getChildCount()>0){var springBack=this.mScrollY<-this.mOverflingDistance||this.mScrollY-this.getScrollRange()>this.mOverflingDistance;if(!springBack&&Math.abs(initialVelocity)>this.mMinimumVelocity){this.fling(-initialVelocity);}else{if(this.mScroller.springBack(this.mScrollX,this.mScrollY,0,0,0,this.getScrollRange())){this.postInvalidateOnAnimation();}}}this.mActivePointerId=ScrollView.INVALID_POINTER;this.endDrag();}break;case MotionEvent.ACTION_CANCEL:if(this.mIsBeingDragged&&this.getChildCount()>0){if(this.mScroller.springBack(this.mScrollX,this.mScrollY,0,0,0,this.getScrollRange())){this.postInvalidateOnAnimation();}this.mActivePointerId=ScrollView.INVALID_POINTER;this.endDrag();}break;case MotionEvent.ACTION_POINTER_DOWN:{var index=ev.getActionIndex();this.mLastMotionY=Math.floor(ev.getY(index));this.mActivePointerId=ev.getPointerId(index);break;}case MotionEvent.ACTION_POINTER_UP:this.onSecondaryPointerUp(ev);this.mLastMotionY=Math.floor(ev.getY(ev.findPointerIndex(this.mActivePointerId)));break;}return true;}},{key:'onSecondaryPointerUp',value:function onSecondaryPointerUp(ev){var pointerIndex=(ev.getAction()&MotionEvent.ACTION_POINTER_INDEX_MASK)>>MotionEvent.ACTION_POINTER_INDEX_SHIFT;var pointerId=ev.getPointerId(pointerIndex);if(pointerId==this.mActivePointerId){var newPointerIndex=pointerIndex==0?1:0;this.mLastMotionY=Math.floor(ev.getY(newPointerIndex));this.mActivePointerId=ev.getPointerId(newPointerIndex);if(this.mVelocityTracker!=null){this.mVelocityTracker.clear();}}}},{key:'onGenericMotionEvent',value:function onGenericMotionEvent(event){if(event.isPointerEvent()){switch(event.getAction()){case MotionEvent.ACTION_SCROLL:{if(!this.mIsBeingDragged){var vscroll=event.getAxisValue(MotionEvent.AXIS_VSCROLL);if(vscroll!=0){var delta=Math.floor(vscroll*this.getVerticalScrollFactor());var range=this.getScrollRange();var oldScrollY=this.mScrollY;var newScrollY=oldScrollY-delta;if(newScrollY<0){newScrollY=0;}else if(newScrollY>range){newScrollY=range;}if(newScrollY!=oldScrollY){_get2(ScrollView.prototype.__proto__||Object.getPrototypeOf(ScrollView.prototype),'scrollTo',this).call(this,this.mScrollX,newScrollY);return true;}}}}}}return _get2(ScrollView.prototype.__proto__||Object.getPrototypeOf(ScrollView.prototype),'onGenericMotionEvent',this).call(this,event);}},{key:'onOverScrolled',value:function onOverScrolled(scrollX,scrollY,clampedX,clampedY){if(!this.mScroller.isFinished()){var oldX=this.mScrollX;var oldY=this.mScrollY;this.mScrollX=scrollX;this.mScrollY=scrollY;this.invalidateParentIfNeeded();this.onScrollChanged(this.mScrollX,this.mScrollY,oldX,oldY);if(clampedY){this.mScroller.springBack(this.mScrollX,this.mScrollY,0,0,0,this.getScrollRange());}}else{_get2(ScrollView.prototype.__proto__||Object.getPrototypeOf(ScrollView.prototype),'scrollTo',this).call(this,scrollX,scrollY);}this.awakenScrollBars();}},{key:'getScrollRange',value:function getScrollRange(){var scrollRange=0;if(this.getChildCount()>0){var child=this.getChildAt(0);scrollRange=Math.max(0,child.getHeight()-(this.getHeight()-this.mPaddingBottom-this.mPaddingTop));}return scrollRange;}},{key:'findFocusableViewInBounds',value:function findFocusableViewInBounds(topFocus,top,bottom){var focusables=this.getFocusables(View.FOCUS_FORWARD);var focusCandidate=null;var foundFullyContainedFocusable=false;var count=focusables.size();for(var i=0;i<count;i++){var view=focusables.get(i);var viewTop=view.getTop();var viewBottom=view.getBottom();if(top<viewBottom&&viewTop<bottom){var viewIsFullyContained=top<viewTop&&viewBottom<bottom;if(focusCandidate==null){focusCandidate=view;foundFullyContainedFocusable=viewIsFullyContained;}else{var viewIsCloserToBoundary=topFocus&&viewTop<focusCandidate.getTop()||!topFocus&&viewBottom>focusCandidate.getBottom();if(foundFullyContainedFocusable){if(viewIsFullyContained&&viewIsCloserToBoundary){focusCandidate=view;}}else{if(viewIsFullyContained){focusCandidate=view;foundFullyContainedFocusable=true;}else if(viewIsCloserToBoundary){focusCandidate=view;}}}}}return focusCandidate;}},{key:'pageScroll',value:function pageScroll(direction){var down=direction==View.FOCUS_DOWN;var height=this.getHeight();if(down){this.mTempRect.top=this.getScrollY()+height;var count=this.getChildCount();if(count>0){var view=this.getChildAt(count-1);if(this.mTempRect.top+height>view.getBottom()){this.mTempRect.top=view.getBottom()-height;}}}else{this.mTempRect.top=this.getScrollY()-height;if(this.mTempRect.top<0){this.mTempRect.top=0;}}this.mTempRect.bottom=this.mTempRect.top+height;return this.scrollAndFocus(direction,this.mTempRect.top,this.mTempRect.bottom);}},{key:'fullScroll',value:function fullScroll(direction){var down=direction==View.FOCUS_DOWN;var height=this.getHeight();this.mTempRect.top=0;this.mTempRect.bottom=height;if(down){var count=this.getChildCount();if(count>0){var view=this.getChildAt(count-1);this.mTempRect.bottom=view.getBottom()+this.mPaddingBottom;this.mTempRect.top=this.mTempRect.bottom-height;}}return this.scrollAndFocus(direction,this.mTempRect.top,this.mTempRect.bottom);}},{key:'scrollAndFocus',value:function scrollAndFocus(direction,top,bottom){var handled=true;var height=this.getHeight();var containerTop=this.getScrollY();var containerBottom=containerTop+height;var up=direction==View.FOCUS_UP;var newFocused=this.findFocusableViewInBounds(up,top,bottom);if(newFocused==null){newFocused=this;}if(top>=containerTop&&bottom<=containerBottom){handled=false;}else{var delta=up?top-containerTop:bottom-containerBottom;this.doScrollY(delta);}if(newFocused!=this.findFocus())newFocused.requestFocus(direction);return handled;}},{key:'arrowScroll',value:function arrowScroll(direction){var currentFocused=this.findFocus();if(currentFocused==this)currentFocused=null;var nextFocused=FocusFinder.getInstance().findNextFocus(this,currentFocused,direction);var maxJump=this.getMaxScrollAmount();if(nextFocused!=null&&this.isWithinDeltaOfScreen(nextFocused,maxJump,this.getHeight())){nextFocused.getDrawingRect(this.mTempRect);this.offsetDescendantRectToMyCoords(nextFocused,this.mTempRect);var scrollDelta=this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);this.doScrollY(scrollDelta);nextFocused.requestFocus(direction);}else{var _scrollDelta=maxJump;if(direction==View.FOCUS_UP&&this.getScrollY()<_scrollDelta){_scrollDelta=this.getScrollY();}else if(direction==View.FOCUS_DOWN){if(this.getChildCount()>0){var daBottom=this.getChildAt(0).getBottom();var screenBottom=this.getScrollY()+this.getHeight()-this.mPaddingBottom;if(daBottom-screenBottom<maxJump){_scrollDelta=daBottom-screenBottom;}}}if(_scrollDelta==0){return false;}this.doScrollY(direction==View.FOCUS_DOWN?_scrollDelta:-_scrollDelta);}if(currentFocused!=null&&currentFocused.isFocused()&&this.isOffScreen(currentFocused)){var descendantFocusability=this.getDescendantFocusability();this.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);this.requestFocus();this.setDescendantFocusability(descendantFocusability);}return true;}},{key:'isOffScreen',value:function isOffScreen(descendant){return!this.isWithinDeltaOfScreen(descendant,0,this.getHeight());}},{key:'isWithinDeltaOfScreen',value:function isWithinDeltaOfScreen(descendant,delta,height){descendant.getDrawingRect(this.mTempRect);this.offsetDescendantRectToMyCoords(descendant,this.mTempRect);return this.mTempRect.bottom+delta>=this.getScrollY()&&this.mTempRect.top-delta<=this.getScrollY()+height;}},{key:'doScrollY',value:function doScrollY(delta){if(delta!=0){if(this.mSmoothScrollingEnabled){this.smoothScrollBy(0,delta);}else{this.scrollBy(0,delta);}}}},{key:'smoothScrollBy',value:function smoothScrollBy(dx,dy){if(this.getChildCount()==0){return;}var duration=AnimationUtils.currentAnimationTimeMillis()-this.mLastScroll;if(duration>ScrollView.ANIMATED_SCROLL_GAP){var height=this.getHeight()-this.mPaddingBottom-this.mPaddingTop;var bottom=this.getChildAt(0).getHeight();var maxY=Math.max(0,bottom-height);var scrollY=this.mScrollY;dy=Math.max(0,Math.min(scrollY+dy,maxY))-scrollY;this.mScroller.startScroll(this.mScrollX,scrollY,0,dy);this.postInvalidateOnAnimation();}else{if(!this.mScroller.isFinished()){this.mScroller.abortAnimation();}this.scrollBy(dx,dy);}this.mLastScroll=AnimationUtils.currentAnimationTimeMillis();}},{key:'smoothScrollTo',value:function smoothScrollTo(x,y){this.smoothScrollBy(x-this.mScrollX,y-this.mScrollY);}},{key:'computeVerticalScrollRange',value:function computeVerticalScrollRange(){var count=this.getChildCount();var contentHeight=this.getHeight()-this.mPaddingBottom-this.mPaddingTop;if(count==0){return contentHeight;}var scrollRange=this.getChildAt(0).getBottom();var scrollY=this.mScrollY;var overscrollBottom=Math.max(0,scrollRange-contentHeight);if(scrollY<0){scrollRange-=scrollY;}else if(scrollY>overscrollBottom){scrollRange+=scrollY-overscrollBottom;}return scrollRange;}},{key:'computeVerticalScrollOffset',value:function computeVerticalScrollOffset(){return Math.max(0,_get2(ScrollView.prototype.__proto__||Object.getPrototypeOf(ScrollView.prototype),'computeVerticalScrollOffset',this).call(this));}},{key:'measureChild',value:function measureChild(child,parentWidthMeasureSpec,parentHeightMeasureSpec){var lp=child.getLayoutParams();var childWidthMeasureSpec=void 0;var childHeightMeasureSpec=void 0;childWidthMeasureSpec=ScrollView.getChildMeasureSpec(parentWidthMeasureSpec,this.mPaddingLeft+this.mPaddingRight,lp.width);childHeightMeasureSpec=View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);child.measure(childWidthMeasureSpec,childHeightMeasureSpec);}},{key:'measureChildWithMargins',value:function measureChildWithMargins(child,parentWidthMeasureSpec,widthUsed,parentHeightMeasureSpec,heightUsed){var lp=child.getLayoutParams();var childWidthMeasureSpec=ScrollView.getChildMeasureSpec(parentWidthMeasureSpec,this.mPaddingLeft+this.mPaddingRight+lp.leftMargin+lp.rightMargin+widthUsed,lp.width);var childHeightMeasureSpec=View.MeasureSpec.makeMeasureSpec(lp.topMargin+lp.bottomMargin,View.MeasureSpec.UNSPECIFIED);child.measure(childWidthMeasureSpec,childHeightMeasureSpec);}},{key:'computeScroll',value:function computeScroll(){if(this.mScroller.computeScrollOffset()){var oldX=this.mScrollX;var oldY=this.mScrollY;var _x188=this.mScroller.getCurrX();var _y15=this.mScroller.getCurrY();if(oldX!=_x188||oldY!=_y15){var range=this.getScrollRange();var overscrollMode=this.getOverScrollMode();var canOverscroll=overscrollMode==ScrollView.OVER_SCROLL_ALWAYS||overscrollMode==ScrollView.OVER_SCROLL_IF_CONTENT_SCROLLS&&range>0;this.overScrollBy(_x188-oldX,_y15-oldY,oldX,oldY,0,range,0,this.getHeight()/2,false);this.onScrollChanged(this.mScrollX,this.mScrollY,oldX,oldY);}if(!this.awakenScrollBars()){this.postInvalidateOnAnimation();}}else{}}},{key:'scrollToChild',value:function scrollToChild(child){child.getDrawingRect(this.mTempRect);this.offsetDescendantRectToMyCoords(child,this.mTempRect);var scrollDelta=this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);if(scrollDelta!=0){this.scrollBy(0,scrollDelta);}}},{key:'scrollToChildRect',value:function scrollToChildRect(rect,immediate){var delta=this.computeScrollDeltaToGetChildRectOnScreen(rect);var scroll=delta!=0;if(scroll){if(immediate){this.scrollBy(0,delta);}else{this.smoothScrollBy(0,delta);}}return scroll;}},{key:'computeScrollDeltaToGetChildRectOnScreen',value:function computeScrollDeltaToGetChildRectOnScreen(rect){if(this.getChildCount()==0)return 0;var height=this.getHeight();var screenTop=this.getScrollY();var screenBottom=screenTop+height;var fadingEdge=this.getVerticalFadingEdgeLength();if(rect.top>0){screenTop+=fadingEdge;}if(rect.bottom<this.getChildAt(0).getHeight()){screenBottom-=fadingEdge;}var scrollYDelta=0;if(rect.bottom>screenBottom&&rect.top>screenTop){if(rect.height()>height){scrollYDelta+=rect.top-screenTop;}else{scrollYDelta+=rect.bottom-screenBottom;}var bottom=this.getChildAt(0).getBottom();var distanceToBottom=bottom-screenBottom;scrollYDelta=Math.min(scrollYDelta,distanceToBottom);}else if(rect.top<screenTop&&rect.bottom<screenBottom){if(rect.height()>height){scrollYDelta-=screenBottom-rect.bottom;}else{scrollYDelta-=screenTop-rect.top;}scrollYDelta=Math.max(scrollYDelta,-this.getScrollY());}return scrollYDelta;}},{key:'requestChildFocus',value:function requestChildFocus(child,focused){if(!this.mIsLayoutDirty){this.scrollToChild(focused);}else{this.mChildToScrollTo=focused;}_get2(ScrollView.prototype.__proto__||Object.getPrototypeOf(ScrollView.prototype),'requestChildFocus',this).call(this,child,focused);}},{key:'onRequestFocusInDescendants',value:function onRequestFocusInDescendants(direction,previouslyFocusedRect){if(direction==View.FOCUS_FORWARD){direction=View.FOCUS_DOWN;}else if(direction==View.FOCUS_BACKWARD){direction=View.FOCUS_UP;}var nextFocus=previouslyFocusedRect==null?FocusFinder.getInstance().findNextFocus(this,null,direction):FocusFinder.getInstance().findNextFocusFromRect(this,previouslyFocusedRect,direction);if(nextFocus==null){return false;}if(this.isOffScreen(nextFocus)){return false;}return nextFocus.requestFocus(direction,previouslyFocusedRect);}},{key:'requestChildRectangleOnScreen',value:function requestChildRectangleOnScreen(child,rectangle,immediate){rectangle.offset(child.getLeft()-child.getScrollX(),child.getTop()-child.getScrollY());return this.scrollToChildRect(rectangle,immediate);}},{key:'requestLayout',value:function requestLayout(){this.mIsLayoutDirty=true;_get2(ScrollView.prototype.__proto__||Object.getPrototypeOf(ScrollView.prototype),'requestLayout',this).call(this);}},{key:'onLayout',value:function onLayout(changed,l,t,r,b){_get2(ScrollView.prototype.__proto__||Object.getPrototypeOf(ScrollView.prototype),'onLayout',this).call(this,changed,l,t,r,b);this.mIsLayoutDirty=false;if(this.mChildToScrollTo!=null&&ScrollView.isViewDescendantOf(this.mChildToScrollTo,this)){this.scrollToChild(this.mChildToScrollTo);}this.mChildToScrollTo=null;if(!this.isLaidOut()){var childHeight=this.getChildCount()>0?this.getChildAt(0).getMeasuredHeight():0;var scrollRange=Math.max(0,childHeight-(b-t-this.mPaddingBottom-this.mPaddingTop));if(this.mScrollY>scrollRange){this.mScrollY=scrollRange;}else if(this.mScrollY<0){this.mScrollY=0;}}this.scrollTo(this.mScrollX,this.mScrollY);}},{key:'onSizeChanged',value:function onSizeChanged(w,h,oldw,oldh){_get2(ScrollView.prototype.__proto__||Object.getPrototypeOf(ScrollView.prototype),'onSizeChanged',this).call(this,w,h,oldw,oldh);var currentFocused=this.findFocus();if(null==currentFocused||this==currentFocused)return;if(this.isWithinDeltaOfScreen(currentFocused,0,oldh)){currentFocused.getDrawingRect(this.mTempRect);this.offsetDescendantRectToMyCoords(currentFocused,this.mTempRect);var scrollDelta=this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);this.doScrollY(scrollDelta);}}},{key:'fling',value:function fling(velocityY){if(this.getChildCount()>0){var height=this.getHeight()-this.mPaddingBottom-this.mPaddingTop;var bottom=this.getChildAt(0).getHeight();this.mScroller.fling(this.mScrollX,this.mScrollY,0,velocityY,0,0,0,Math.max(0,bottom-height),0,this.mOverflingDistance);this.postInvalidateOnAnimation();}}},{key:'endDrag',value:function endDrag(){this.mIsBeingDragged=false;this.recycleVelocityTracker();}},{key:'scrollTo',value:function scrollTo(x,y){if(this.getChildCount()>0){var child=this.getChildAt(0);x=ScrollView.clamp(x,this.getWidth()-this.mPaddingRight-this.mPaddingLeft,child.getWidth());y=ScrollView.clamp(y,this.getHeight()-this.mPaddingBottom-this.mPaddingTop,child.getHeight());if(x!=this.mScrollX||y!=this.mScrollY){_get2(ScrollView.prototype.__proto__||Object.getPrototypeOf(ScrollView.prototype),'scrollTo',this).call(this,x,y);}}}},{key:'draw',value:function draw(canvas){_get2(ScrollView.prototype.__proto__||Object.getPrototypeOf(ScrollView.prototype),'draw',this).call(this,canvas);}}],[{key:'isViewDescendantOf',value:function isViewDescendantOf(child,parent){if(child==parent){return true;}var theParent=child.getParent();return theParent instanceof ViewGroup&&ScrollView.isViewDescendantOf(theParent,parent);}},{key:'clamp',value:function clamp(n,my,child){if(my>=child||n<0){return 0;}if(my+n>child){return child-my;}return n;}}]);return ScrollView;}(FrameLayout);ScrollView.ANIMATED_SCROLL_GAP=250;ScrollView.MAX_SCROLL_FACTOR=0.5;ScrollView.TAG=\"ScrollView\";ScrollView.INVALID_POINTER=-1;widget.ScrollView=ScrollView;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var util;(function(util){var ArrayMap=function(){function ArrayMap(capacity){_classCallCheck(this,ArrayMap);this.map=new Map();}_createClass(ArrayMap,[{key:'clear',value:function clear(){this.map.clear();}},{key:'erase',value:function erase(){this.map.clear();}},{key:'ensureCapacity',value:function ensureCapacity(minimumCapacity){}},{key:'containsKey',value:function containsKey(key){return this.map.has(key);}},{key:'indexOfValue',value:function indexOfValue(value){return[].concat(_toConsumableArray(this.map.values())).indexOf(value);}},{key:'containsValue',value:function containsValue(value){return this.indexOfValue(value)>=0;}},{key:'get',value:function get(key){return this.map.get(key);}},{key:'keyAt',value:function keyAt(index){return[].concat(_toConsumableArray(this.map.keys()))[index];}},{key:'valueAt',value:function valueAt(index){return[].concat(_toConsumableArray(this.map.values()))[index];}},{key:'setValueAt',value:function setValueAt(index,value){var key=this.keyAt(index);if(key==null)throw Error('index error');var oldV=this.get(key);this.map.set(key,value);return oldV;}},{key:'isEmpty',value:function isEmpty(){return this.map.size<=0;}},{key:'put',value:function put(key,value){var oldV=this.get(key);this.map.set(key,value);return oldV;}},{key:'append',value:function append(key,value){this.map.set(key,value);}},{key:'remove',value:function remove(key){var oldV=this.get(key);this.map.delete(key);return oldV;}},{key:'removeAt',value:function removeAt(index){var key=this.keyAt(index);if(key==null)throw Error('index error');var oldV=this.get(key);this.map.delete(key);return oldV;}},{key:'keySet',value:function keySet(){return new Set(this.map.keys());}},{key:'size',value:function size(){return this.map.size;}}]);return ArrayMap;}();util.ArrayMap=ArrayMap;})(util=android.util||(android.util={}));})(android||(android={}));var java;(function(java){var util;(function(util){var ArrayDeque=function(_util$ArrayList){_inherits(ArrayDeque,_util$ArrayList);function ArrayDeque(){_classCallCheck(this,ArrayDeque);return _possibleConstructorReturn(this,(ArrayDeque.__proto__||Object.getPrototypeOf(ArrayDeque)).apply(this,arguments));}_createClass(ArrayDeque,[{key:'addFirst',value:function addFirst(e){this.add(0,e);}},{key:'addLast',value:function addLast(e){this.add(e);}},{key:'offerFirst',value:function offerFirst(e){this.addFirst(e);return true;}},{key:'offerLast',value:function offerLast(e){this.addLast(e);return true;}},{key:'removeFirst',value:function removeFirst(){var x=this.pollFirst();if(x==null)throw Error('NoSuchElementException');return x;}},{key:'removeLast',value:function removeLast(){var x=this.pollLast();if(x==null)throw Error('NoSuchElementException');return x;}},{key:'pollFirst',value:function pollFirst(){return this.array.shift();}},{key:'pollLast',value:function pollLast(){return this.array.splice(this.array.length-1)[0];}},{key:'getFirst',value:function getFirst(){var x=this.peekFirst();if(x==null)throw Error('NoSuchElementException');return x;}},{key:'getLast',value:function getLast(){var x=this.peekLast();if(x==null)throw Error('NoSuchElementException');return x;}},{key:'peekFirst',value:function peekFirst(){return this.array[0];}},{key:'peekLast',value:function peekLast(){return this.array[this.array.length-1];}},{key:'removeFirstOccurrence',value:function removeFirstOccurrence(o){if(o==null)return false;for(var i=0,count=this.size();i<count;i++){if(this.array[i]==o){this.delete(i);return true;}}return false;}},{key:'removeLastOccurrence',value:function removeLastOccurrence(o){if(o==null)return false;for(var i=this.size();i>=0;i--){if(this.array[i]==o){this.delete(i);return true;}}return false;}},{key:'offer',value:function offer(e){return this.offerLast(e);}},{key:'remove',value:function remove(){return this.removeFirst();}},{key:'poll',value:function poll(){return this.pollFirst();}},{key:'element',value:function element(){return this.getFirst();}},{key:'peek',value:function peek(){return this.peekFirst();}},{key:'push',value:function push(e){this.addFirst(e);}},{key:'pop',value:function pop(){return this.removeFirst();}},{key:'delete',value:function _delete(i){if(i>=this.array.length)return false;this.array.splice(i,1);return true;}}]);return ArrayDeque;}(util.ArrayList);util.ArrayDeque=ArrayDeque;})(util=java.util||(java.util={}));})(java||(java={}));var android;(function(android){var widget;(function(widget){var Rect=android.graphics.Rect;var Log=android.util.Log;var FocusFinder=android.view.FocusFinder;var KeyEvent=android.view.KeyEvent;var MotionEvent=android.view.MotionEvent;var VelocityTracker=android.view.VelocityTracker;var View=android.view.View;var ViewConfiguration=android.view.ViewConfiguration;var ViewGroup=android.view.ViewGroup;var AnimationUtils=android.view.animation.AnimationUtils;var FrameLayout=android.widget.FrameLayout;var OverScroller=android.widget.OverScroller;var ScrollView=android.widget.ScrollView;var HorizontalScrollView=function(_FrameLayout3){_inherits(HorizontalScrollView,_FrameLayout3);function HorizontalScrollView(context,bindElement,defStyle){_classCallCheck(this,HorizontalScrollView);var _this119=_possibleConstructorReturn(this,(HorizontalScrollView.__proto__||Object.getPrototypeOf(HorizontalScrollView)).call(this,context,bindElement,defStyle));_this119.mLastScroll=0;_this119.mTempRect=new Rect();_this119.mLastMotionX=0;_this119.mIsLayoutDirty=true;_this119.mChildToScrollTo=null;_this119.mIsBeingDragged=false;_this119.mSmoothScrollingEnabled=true;_this119.mMinimumVelocity=0;_this119.mMaximumVelocity=0;_this119.mOverscrollDistance=0;_this119._mOverflingDistance=0;_this119.mActivePointerId=HorizontalScrollView.INVALID_POINTER;_this119.initScrollView();var a=context.obtainStyledAttributes(bindElement,defStyle);_this119.setFillViewport(a.getBoolean('fillViewport',false));a.recycle();return _this119;}_createClass(HorizontalScrollView,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(HorizontalScrollView.prototype.__proto__||Object.getPrototypeOf(HorizontalScrollView.prototype),'createClassAttrBinder',this).call(this).set('',{setter:function setter(v,value,attrBinder){v.setFillViewport(attrBinder.parseBoolean(value));},getter:function getter(v){return v.isFillViewport();}});}},{key:'getLeftFadingEdgeStrength',value:function getLeftFadingEdgeStrength(){if(this.getChildCount()==0){return 0.0;}var length=this.getHorizontalFadingEdgeLength();if(this.mScrollX<length){return this.mScrollX/length;}return 1.0;}},{key:'getRightFadingEdgeStrength',value:function getRightFadingEdgeStrength(){if(this.getChildCount()==0){return 0.0;}var length=this.getHorizontalFadingEdgeLength();var rightEdge=this.getWidth()-this.mPaddingRight;var span=this.getChildAt(0).getRight()-this.mScrollX-rightEdge;if(span<length){return span/length;}return 1.0;}},{key:'getMaxScrollAmount',value:function getMaxScrollAmount(){return Math.floor(HorizontalScrollView.MAX_SCROLL_FACTOR*(this.mRight-this.mLeft));}},{key:'initScrollView',value:function initScrollView(){this.mScroller=new OverScroller();this.setFocusable(true);this.setDescendantFocusability(HorizontalScrollView.FOCUS_AFTER_DESCENDANTS);this.setWillNotDraw(false);var configuration=ViewConfiguration.get();this.mTouchSlop=configuration.getScaledTouchSlop();this.mMinimumVelocity=configuration.getScaledMinimumFlingVelocity();this.mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();this.mOverscrollDistance=configuration.getScaledOverscrollDistance();this._mOverflingDistance=configuration.getScaledOverflingDistance();this.initScrollCache();this.setHorizontalScrollBarEnabled(true);}},{key:'addView',value:function addView(){var _get5;if(this.getChildCount()>0){throw new Error(\"ScrollView can host only one direct child\");}for(var _len29=arguments.length,args=Array(_len29),_key30=0;_key30<_len29;_key30++){args[_key30]=arguments[_key30];}return(_get5=_get2(HorizontalScrollView.prototype.__proto__||Object.getPrototypeOf(HorizontalScrollView.prototype),'addView',this)).call.apply(_get5,[this].concat(args));}},{key:'canScroll',value:function canScroll(){var child=this.getChildAt(0);if(child!=null){var childWidth=child.getWidth();return this.getWidth()<childWidth+this.mPaddingLeft+this.mPaddingRight;}return false;}},{key:'isFillViewport',value:function isFillViewport(){return this.mFillViewport;}},{key:'setFillViewport',value:function setFillViewport(fillViewport){if(fillViewport!=this.mFillViewport){this.mFillViewport=fillViewport;this.requestLayout();}}},{key:'isSmoothScrollingEnabled',value:function isSmoothScrollingEnabled(){return this.mSmoothScrollingEnabled;}},{key:'setSmoothScrollingEnabled',value:function setSmoothScrollingEnabled(smoothScrollingEnabled){this.mSmoothScrollingEnabled=smoothScrollingEnabled;}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){_get2(HorizontalScrollView.prototype.__proto__||Object.getPrototypeOf(HorizontalScrollView.prototype),'onMeasure',this).call(this,widthMeasureSpec,heightMeasureSpec);if(!this.mFillViewport){return;}var widthMode=View.MeasureSpec.getMode(widthMeasureSpec);if(widthMode==View.MeasureSpec.UNSPECIFIED){return;}if(this.getChildCount()>0){var child=this.getChildAt(0);var width=this.getMeasuredWidth();if(child.getMeasuredWidth()<width){var lp=child.getLayoutParams();var childHeightMeasureSpec=HorizontalScrollView.getChildMeasureSpec(heightMeasureSpec,this.mPaddingTop+this.mPaddingBottom,lp.height);width-=this.mPaddingLeft;width-=this.mPaddingRight;var childWidthMeasureSpec=View.MeasureSpec.makeMeasureSpec(width,View.MeasureSpec.EXACTLY);child.measure(childWidthMeasureSpec,childHeightMeasureSpec);}}}},{key:'dispatchKeyEvent',value:function dispatchKeyEvent(event){return _get2(HorizontalScrollView.prototype.__proto__||Object.getPrototypeOf(HorizontalScrollView.prototype),'dispatchKeyEvent',this).call(this,event)||this.executeKeyEvent(event);}},{key:'executeKeyEvent',value:function executeKeyEvent(event){this.mTempRect.setEmpty();if(!this.canScroll()){if(this.isFocused()){var currentFocused=this.findFocus();if(currentFocused==this)currentFocused=null;var nextFocused=FocusFinder.getInstance().findNextFocus(this,currentFocused,View.FOCUS_RIGHT);return nextFocused!=null&&nextFocused!=this&&nextFocused.requestFocus(View.FOCUS_RIGHT);}return false;}var handled=false;if(event.getAction()==KeyEvent.ACTION_DOWN){switch(event.getKeyCode()){case KeyEvent.KEYCODE_DPAD_LEFT:if(!event.isAltPressed()){handled=this.arrowScroll(View.FOCUS_LEFT);}else{handled=this.fullScroll(View.FOCUS_LEFT);}break;case KeyEvent.KEYCODE_DPAD_RIGHT:if(!event.isAltPressed()){handled=this.arrowScroll(View.FOCUS_RIGHT);}else{handled=this.fullScroll(View.FOCUS_RIGHT);}break;case KeyEvent.KEYCODE_SPACE:this.pageScroll(event.isShiftPressed()?View.FOCUS_LEFT:View.FOCUS_RIGHT);break;}}return handled;}},{key:'inChild',value:function inChild(x,y){if(this.getChildCount()>0){var scrollX=this.mScrollX;var child=this.getChildAt(0);return!(y<child.getTop()||y>=child.getBottom()||x<child.getLeft()-scrollX||x>=child.getRight()-scrollX);}return false;}},{key:'initOrResetVelocityTracker',value:function initOrResetVelocityTracker(){if(this.mVelocityTracker==null){this.mVelocityTracker=VelocityTracker.obtain();}else{this.mVelocityTracker.clear();}}},{key:'initVelocityTrackerIfNotExists',value:function initVelocityTrackerIfNotExists(){if(this.mVelocityTracker==null){this.mVelocityTracker=VelocityTracker.obtain();}}},{key:'recycleVelocityTracker',value:function recycleVelocityTracker(){if(this.mVelocityTracker!=null){this.mVelocityTracker.recycle();this.mVelocityTracker=null;}}},{key:'requestDisallowInterceptTouchEvent',value:function requestDisallowInterceptTouchEvent(disallowIntercept){if(disallowIntercept){this.recycleVelocityTracker();}_get2(HorizontalScrollView.prototype.__proto__||Object.getPrototypeOf(HorizontalScrollView.prototype),'requestDisallowInterceptTouchEvent',this).call(this,disallowIntercept);}},{key:'onInterceptTouchEvent',value:function onInterceptTouchEvent(ev){var action=ev.getAction();if(action==MotionEvent.ACTION_MOVE&&this.mIsBeingDragged){return true;}switch(action&MotionEvent.ACTION_MASK){case MotionEvent.ACTION_MOVE:{var activePointerId=this.mActivePointerId;if(activePointerId==HorizontalScrollView.INVALID_POINTER){break;}var pointerIndex=ev.findPointerIndex(activePointerId);if(pointerIndex==-1){Log.e(HorizontalScrollView.TAG,\"Invalid pointerId=\"+activePointerId+\" in onInterceptTouchEvent\");break;}var _x189=Math.floor(ev.getX(pointerIndex));var xDiff=Math.floor(Math.abs(_x189-this.mLastMotionX));if(xDiff>this.mTouchSlop){this.mIsBeingDragged=true;this.mLastMotionX=_x189;this.initVelocityTrackerIfNotExists();this.mVelocityTracker.addMovement(ev);if(this.mParent!=null)this.mParent.requestDisallowInterceptTouchEvent(true);}break;}case MotionEvent.ACTION_DOWN:{var _x190=Math.floor(ev.getX());if(!this.inChild(Math.floor(_x190),Math.floor(ev.getY()))){this.mIsBeingDragged=false;this.recycleVelocityTracker();break;}this.mLastMotionX=_x190;this.mActivePointerId=ev.getPointerId(0);this.initOrResetVelocityTracker();this.mVelocityTracker.addMovement(ev);this.mIsBeingDragged=!this.mScroller.isFinished();break;}case MotionEvent.ACTION_CANCEL:case MotionEvent.ACTION_UP:this.mIsBeingDragged=false;this.mActivePointerId=HorizontalScrollView.INVALID_POINTER;if(this.mScroller.springBack(this.mScrollX,this.mScrollY,0,this.getScrollRange(),0,0)){this.postInvalidateOnAnimation();}break;case MotionEvent.ACTION_POINTER_DOWN:{var index=ev.getActionIndex();this.mLastMotionX=Math.floor(ev.getX(index));this.mActivePointerId=ev.getPointerId(index);break;}case MotionEvent.ACTION_POINTER_UP:this.onSecondaryPointerUp(ev);this.mLastMotionX=Math.floor(ev.getX(ev.findPointerIndex(this.mActivePointerId)));break;}return this.mIsBeingDragged;}},{key:'onTouchEvent',value:function onTouchEvent(ev){this.initVelocityTrackerIfNotExists();this.mVelocityTracker.addMovement(ev);var action=ev.getAction();switch(action&MotionEvent.ACTION_MASK){case MotionEvent.ACTION_DOWN:{if(this.getChildCount()==0){return false;}if(this.mIsBeingDragged=!this.mScroller.isFinished()){var parent=this.getParent();if(parent!=null){parent.requestDisallowInterceptTouchEvent(true);}}if(!this.mScroller.isFinished()){this.mScroller.abortAnimation();}this.mLastMotionX=Math.floor(ev.getX());this.mActivePointerId=ev.getPointerId(0);break;}case MotionEvent.ACTION_MOVE:var activePointerIndex=ev.findPointerIndex(this.mActivePointerId);if(activePointerIndex==-1){Log.e(HorizontalScrollView.TAG,\"Invalid pointerId=\"+this.mActivePointerId+\" in onTouchEvent\");break;}var _x191=Math.floor(ev.getX(activePointerIndex));var deltaX=this.mLastMotionX-_x191;if(!this.mIsBeingDragged&&Math.abs(deltaX)>this.mTouchSlop){var _parent2=this.getParent();if(_parent2!=null){_parent2.requestDisallowInterceptTouchEvent(true);}this.mIsBeingDragged=true;if(deltaX>0){deltaX-=this.mTouchSlop;}else{deltaX+=this.mTouchSlop;}}if(this.mIsBeingDragged){this.mLastMotionX=_x191;var oldX=this.mScrollX;var oldY=this.mScrollY;var range=this.getScrollRange();var overscrollMode=this.getOverScrollMode();var canOverscroll=overscrollMode==HorizontalScrollView.OVER_SCROLL_ALWAYS||overscrollMode==HorizontalScrollView.OVER_SCROLL_IF_CONTENT_SCROLLS&&range>0;if(this.overScrollBy(deltaX,0,this.mScrollX,0,range,0,this.mOverscrollDistance,0,true)){this.mVelocityTracker.clear();}if(canOverscroll){}}break;case MotionEvent.ACTION_UP:if(this.mIsBeingDragged){var velocityTracker=this.mVelocityTracker;velocityTracker.computeCurrentVelocity(1000,this.mMaximumVelocity);var initialVelocity=Math.floor(velocityTracker.getXVelocity(this.mActivePointerId));if(this.getChildCount()>0){var isOverDrag=this.mScrollX<0||this.mScrollX>this.getScrollRange();if(!isOverDrag&&Math.abs(initialVelocity)>this.mMinimumVelocity){this.fling(-initialVelocity);}else{if(this.mScroller.springBack(this.mScrollX,this.mScrollY,0,this.getScrollRange(),0,0)){this.postInvalidateOnAnimation();}}}this.mActivePointerId=HorizontalScrollView.INVALID_POINTER;this.mIsBeingDragged=false;this.recycleVelocityTracker();}break;case MotionEvent.ACTION_CANCEL:if(this.mIsBeingDragged&&this.getChildCount()>0){if(this.mScroller.springBack(this.mScrollX,this.mScrollY,0,this.getScrollRange(),0,0)){this.postInvalidateOnAnimation();}this.mActivePointerId=HorizontalScrollView.INVALID_POINTER;this.mIsBeingDragged=false;this.recycleVelocityTracker();}break;case MotionEvent.ACTION_POINTER_UP:this.onSecondaryPointerUp(ev);break;}return true;}},{key:'onSecondaryPointerUp',value:function onSecondaryPointerUp(ev){var pointerIndex=(ev.getAction()&MotionEvent.ACTION_POINTER_INDEX_MASK)>>MotionEvent.ACTION_POINTER_INDEX_SHIFT;var pointerId=ev.getPointerId(pointerIndex);if(pointerId==this.mActivePointerId){var newPointerIndex=pointerIndex==0?1:0;this.mLastMotionX=Math.floor(ev.getX(newPointerIndex));this.mActivePointerId=ev.getPointerId(newPointerIndex);if(this.mVelocityTracker!=null){this.mVelocityTracker.clear();}}}},{key:'onGenericMotionEvent',value:function onGenericMotionEvent(event){if(event.isPointerEvent()){switch(event.getAction()){case MotionEvent.ACTION_SCROLL:{if(!this.mIsBeingDragged){var hscroll=void 0;hscroll=-event.getAxisValue(MotionEvent.AXIS_VSCROLL);if(hscroll!=0){var delta=Math.floor(hscroll*this.getHorizontalScrollFactor());var range=this.getScrollRange();var oldScrollX=this.mScrollX;var newScrollX=oldScrollX+delta;if(newScrollX<0){newScrollX=0;}else if(newScrollX>range){newScrollX=range;}if(newScrollX!=oldScrollX){_get2(HorizontalScrollView.prototype.__proto__||Object.getPrototypeOf(HorizontalScrollView.prototype),'scrollTo',this).call(this,newScrollX,this.mScrollY);return true;}}}}}}return _get2(HorizontalScrollView.prototype.__proto__||Object.getPrototypeOf(HorizontalScrollView.prototype),'onGenericMotionEvent',this).call(this,event);}},{key:'shouldDelayChildPressedState',value:function shouldDelayChildPressedState(){return true;}},{key:'onOverScrolled',value:function onOverScrolled(scrollX,scrollY,clampedX,clampedY){if(!this.mScroller.isFinished()){var oldX=this.mScrollX;var oldY=this.mScrollY;this.mScrollX=scrollX;this.mScrollY=scrollY;this.invalidateParentIfNeeded();this.onScrollChanged(this.mScrollX,this.mScrollY,oldX,oldY);if(clampedX){this.mScroller.springBack(this.mScrollX,this.mScrollY,0,this.getScrollRange(),0,0);}}else{_get2(HorizontalScrollView.prototype.__proto__||Object.getPrototypeOf(HorizontalScrollView.prototype),'scrollTo',this).call(this,scrollX,scrollY);}this.awakenScrollBars();}},{key:'getScrollRange',value:function getScrollRange(){var scrollRange=0;if(this.getChildCount()>0){var child=this.getChildAt(0);scrollRange=Math.max(0,child.getWidth()-(this.getWidth()-this.mPaddingLeft-this.mPaddingRight));}return scrollRange;}},{key:'findFocusableViewInMyBounds',value:function findFocusableViewInMyBounds(leftFocus,left,preferredFocusable){var fadingEdgeLength=this.getHorizontalFadingEdgeLength()/2;var leftWithoutFadingEdge=left+fadingEdgeLength;var rightWithoutFadingEdge=left+this.getWidth()-fadingEdgeLength;if(preferredFocusable!=null&&preferredFocusable.getLeft()<rightWithoutFadingEdge&&preferredFocusable.getRight()>leftWithoutFadingEdge){return preferredFocusable;}return this.findFocusableViewInBounds(leftFocus,leftWithoutFadingEdge,rightWithoutFadingEdge);}},{key:'findFocusableViewInBounds',value:function findFocusableViewInBounds(leftFocus,left,right){var focusables=this.getFocusables(View.FOCUS_FORWARD);var focusCandidate=null;var foundFullyContainedFocusable=false;var count=focusables.size();for(var i=0;i<count;i++){var view=focusables.get(i);var viewLeft=view.getLeft();var viewRight=view.getRight();if(left<viewRight&&viewLeft<right){var viewIsFullyContained=left<viewLeft&&viewRight<right;if(focusCandidate==null){focusCandidate=view;foundFullyContainedFocusable=viewIsFullyContained;}else{var viewIsCloserToBoundary=leftFocus&&viewLeft<focusCandidate.getLeft()||!leftFocus&&viewRight>focusCandidate.getRight();if(foundFullyContainedFocusable){if(viewIsFullyContained&&viewIsCloserToBoundary){focusCandidate=view;}}else{if(viewIsFullyContained){focusCandidate=view;foundFullyContainedFocusable=true;}else if(viewIsCloserToBoundary){focusCandidate=view;}}}}}return focusCandidate;}},{key:'pageScroll',value:function pageScroll(direction){var right=direction==View.FOCUS_RIGHT;var width=this.getWidth();if(right){this.mTempRect.left=this.getScrollX()+width;var count=this.getChildCount();if(count>0){var view=this.getChildAt(0);if(this.mTempRect.left+width>view.getRight()){this.mTempRect.left=view.getRight()-width;}}}else{this.mTempRect.left=this.getScrollX()-width;if(this.mTempRect.left<0){this.mTempRect.left=0;}}this.mTempRect.right=this.mTempRect.left+width;return this.scrollAndFocus(direction,this.mTempRect.left,this.mTempRect.right);}},{key:'fullScroll',value:function fullScroll(direction){var right=direction==View.FOCUS_RIGHT;var width=this.getWidth();this.mTempRect.left=0;this.mTempRect.right=width;if(right){var count=this.getChildCount();if(count>0){var view=this.getChildAt(0);this.mTempRect.right=view.getRight();this.mTempRect.left=this.mTempRect.right-width;}}return this.scrollAndFocus(direction,this.mTempRect.left,this.mTempRect.right);}},{key:'scrollAndFocus',value:function scrollAndFocus(direction,left,right){var handled=true;var width=this.getWidth();var containerLeft=this.getScrollX();var containerRight=containerLeft+width;var goLeft=direction==View.FOCUS_LEFT;var newFocused=this.findFocusableViewInBounds(goLeft,left,right);if(newFocused==null){newFocused=this;}if(left>=containerLeft&&right<=containerRight){handled=false;}else{var delta=goLeft?left-containerLeft:right-containerRight;this.doScrollX(delta);}if(newFocused!=this.findFocus())newFocused.requestFocus(direction);return handled;}},{key:'arrowScroll',value:function arrowScroll(direction){var currentFocused=this.findFocus();if(currentFocused==this)currentFocused=null;var nextFocused=FocusFinder.getInstance().findNextFocus(this,currentFocused,direction);var maxJump=this.getMaxScrollAmount();if(nextFocused!=null&&this.isWithinDeltaOfScreen(nextFocused,maxJump)){nextFocused.getDrawingRect(this.mTempRect);this.offsetDescendantRectToMyCoords(nextFocused,this.mTempRect);var scrollDelta=this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);this.doScrollX(scrollDelta);nextFocused.requestFocus(direction);}else{var _scrollDelta2=maxJump;if(direction==View.FOCUS_LEFT&&this.getScrollX()<_scrollDelta2){_scrollDelta2=this.getScrollX();}else if(direction==View.FOCUS_RIGHT&&this.getChildCount()>0){var daRight=this.getChildAt(0).getRight();var screenRight=this.getScrollX()+this.getWidth();if(daRight-screenRight<maxJump){_scrollDelta2=daRight-screenRight;}}if(_scrollDelta2==0){return false;}this.doScrollX(direction==View.FOCUS_RIGHT?_scrollDelta2:-_scrollDelta2);}if(currentFocused!=null&&currentFocused.isFocused()&&this.isOffScreen(currentFocused)){var descendantFocusability=this.getDescendantFocusability();this.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);this.requestFocus();this.setDescendantFocusability(descendantFocusability);}return true;}},{key:'isOffScreen',value:function isOffScreen(descendant){return!this.isWithinDeltaOfScreen(descendant,0);}},{key:'isWithinDeltaOfScreen',value:function isWithinDeltaOfScreen(descendant,delta){descendant.getDrawingRect(this.mTempRect);this.offsetDescendantRectToMyCoords(descendant,this.mTempRect);return this.mTempRect.right+delta>=this.getScrollX()&&this.mTempRect.left-delta<=this.getScrollX()+this.getWidth();}},{key:'doScrollX',value:function doScrollX(delta){if(delta!=0){if(this.mSmoothScrollingEnabled){this.smoothScrollBy(delta,0);}else{this.scrollBy(delta,0);}}}},{key:'smoothScrollBy',value:function smoothScrollBy(dx,dy){if(this.getChildCount()==0){return;}var duration=AnimationUtils.currentAnimationTimeMillis()-this.mLastScroll;if(duration>HorizontalScrollView.ANIMATED_SCROLL_GAP){var width=this.getWidth()-this.mPaddingRight-this.mPaddingLeft;var right=this.getChildAt(0).getWidth();var maxX=Math.max(0,right-width);var scrollX=this.mScrollX;dx=Math.max(0,Math.min(scrollX+dx,maxX))-scrollX;this.mScroller.startScroll(scrollX,this.mScrollY,dx,0);this.postInvalidateOnAnimation();}else{if(!this.mScroller.isFinished()){this.mScroller.abortAnimation();}this.scrollBy(dx,dy);}this.mLastScroll=AnimationUtils.currentAnimationTimeMillis();}},{key:'smoothScrollTo',value:function smoothScrollTo(x,y){this.smoothScrollBy(x-this.mScrollX,y-this.mScrollY);}},{key:'computeHorizontalScrollRange',value:function computeHorizontalScrollRange(){var count=this.getChildCount();var contentWidth=this.getWidth()-this.mPaddingLeft-this.mPaddingRight;if(count==0){return contentWidth;}var scrollRange=this.getChildAt(0).getRight();var scrollX=this.mScrollX;var overscrollRight=Math.max(0,scrollRange-contentWidth);if(scrollX<0){scrollRange-=scrollX;}else if(scrollX>overscrollRight){scrollRange+=scrollX-overscrollRight;}return scrollRange;}},{key:'computeHorizontalScrollOffset',value:function computeHorizontalScrollOffset(){return Math.max(0,_get2(HorizontalScrollView.prototype.__proto__||Object.getPrototypeOf(HorizontalScrollView.prototype),'computeHorizontalScrollOffset',this).call(this));}},{key:'measureChild',value:function measureChild(child,parentWidthMeasureSpec,parentHeightMeasureSpec){var lp=child.getLayoutParams();var childWidthMeasureSpec=void 0;var childHeightMeasureSpec=void 0;childHeightMeasureSpec=HorizontalScrollView.getChildMeasureSpec(parentHeightMeasureSpec,this.mPaddingTop+this.mPaddingBottom,lp.height);childWidthMeasureSpec=View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);child.measure(childWidthMeasureSpec,childHeightMeasureSpec);}},{key:'measureChildWithMargins',value:function measureChildWithMargins(child,parentWidthMeasureSpec,widthUsed,parentHeightMeasureSpec,heightUsed){var lp=child.getLayoutParams();var childHeightMeasureSpec=HorizontalScrollView.getChildMeasureSpec(parentHeightMeasureSpec,this.mPaddingTop+this.mPaddingBottom+lp.topMargin+lp.bottomMargin+heightUsed,lp.height);var childWidthMeasureSpec=View.MeasureSpec.makeMeasureSpec(lp.leftMargin+lp.rightMargin,View.MeasureSpec.UNSPECIFIED);child.measure(childWidthMeasureSpec,childHeightMeasureSpec);}},{key:'computeScroll',value:function computeScroll(){if(this.mScroller.computeScrollOffset()){var oldX=this.mScrollX;var oldY=this.mScrollY;var _x192=this.mScroller.getCurrX();var _y16=this.mScroller.getCurrY();if(oldX!=_x192||oldY!=_y16){var range=this.getScrollRange();var overscrollMode=this.getOverScrollMode();var canOverscroll=overscrollMode==HorizontalScrollView.OVER_SCROLL_ALWAYS||overscrollMode==HorizontalScrollView.OVER_SCROLL_IF_CONTENT_SCROLLS&&range>0;this.overScrollBy(_x192-oldX,_y16-oldY,oldX,oldY,range,0,this.mOverflingDistance,0,false);this.onScrollChanged(this.mScrollX,this.mScrollY,oldX,oldY);if(canOverscroll){}}if(!this.awakenScrollBars()){this.postInvalidateOnAnimation();}}}},{key:'scrollToChild',value:function scrollToChild(child){child.getDrawingRect(this.mTempRect);this.offsetDescendantRectToMyCoords(child,this.mTempRect);var scrollDelta=this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);if(scrollDelta!=0){this.scrollBy(scrollDelta,0);}}},{key:'scrollToChildRect',value:function scrollToChildRect(rect,immediate){var delta=this.computeScrollDeltaToGetChildRectOnScreen(rect);var scroll=delta!=0;if(scroll){if(immediate){this.scrollBy(delta,0);}else{this.smoothScrollBy(delta,0);}}return scroll;}},{key:'computeScrollDeltaToGetChildRectOnScreen',value:function computeScrollDeltaToGetChildRectOnScreen(rect){if(this.getChildCount()==0)return 0;var width=this.getWidth();var screenLeft=this.getScrollX();var screenRight=screenLeft+width;var fadingEdge=this.getHorizontalFadingEdgeLength();if(rect.left>0){screenLeft+=fadingEdge;}if(rect.right<this.getChildAt(0).getWidth()){screenRight-=fadingEdge;}var scrollXDelta=0;if(rect.right>screenRight&&rect.left>screenLeft){if(rect.width()>width){scrollXDelta+=rect.left-screenLeft;}else{scrollXDelta+=rect.right-screenRight;}var right=this.getChildAt(0).getRight();var distanceToRight=right-screenRight;scrollXDelta=Math.min(scrollXDelta,distanceToRight);}else if(rect.left<screenLeft&&rect.right<screenRight){if(rect.width()>width){scrollXDelta-=screenRight-rect.right;}else{scrollXDelta-=screenLeft-rect.left;}scrollXDelta=Math.max(scrollXDelta,-this.getScrollX());}return scrollXDelta;}},{key:'requestChildFocus',value:function requestChildFocus(child,focused){if(!this.mIsLayoutDirty){this.scrollToChild(focused);}else{this.mChildToScrollTo=focused;}_get2(HorizontalScrollView.prototype.__proto__||Object.getPrototypeOf(HorizontalScrollView.prototype),'requestChildFocus',this).call(this,child,focused);}},{key:'onRequestFocusInDescendants',value:function onRequestFocusInDescendants(direction,previouslyFocusedRect){if(direction==View.FOCUS_FORWARD){direction=View.FOCUS_RIGHT;}else if(direction==View.FOCUS_BACKWARD){direction=View.FOCUS_LEFT;}var nextFocus=previouslyFocusedRect==null?FocusFinder.getInstance().findNextFocus(this,null,direction):FocusFinder.getInstance().findNextFocusFromRect(this,previouslyFocusedRect,direction);if(nextFocus==null){return false;}if(this.isOffScreen(nextFocus)){return false;}return nextFocus.requestFocus(direction,previouslyFocusedRect);}},{key:'requestChildRectangleOnScreen',value:function requestChildRectangleOnScreen(child,rectangle,immediate){rectangle.offset(child.getLeft()-child.getScrollX(),child.getTop()-child.getScrollY());return this.scrollToChildRect(rectangle,immediate);}},{key:'requestLayout',value:function requestLayout(){this.mIsLayoutDirty=true;_get2(HorizontalScrollView.prototype.__proto__||Object.getPrototypeOf(HorizontalScrollView.prototype),'requestLayout',this).call(this);}},{key:'onLayout',value:function onLayout(changed,l,t,r,b){var childWidth=0;var childMargins=0;if(this.getChildCount()>0){childWidth=this.getChildAt(0).getMeasuredWidth();var childParams=this.getChildAt(0).getLayoutParams();childMargins=childParams.leftMargin+childParams.rightMargin;}var available=r-l-this.getPaddingLeftWithForeground()-this.getPaddingRightWithForeground()-childMargins;var forceLeftGravity=childWidth>available;this.layoutChildren(l,t,r,b,forceLeftGravity);this.mIsLayoutDirty=false;if(this.mChildToScrollTo!=null&&HorizontalScrollView.isViewDescendantOf(this.mChildToScrollTo,this)){this.scrollToChild(this.mChildToScrollTo);}this.mChildToScrollTo=null;if(!this.isLaidOut()){var scrollRange=Math.max(0,childWidth-(r-l-this.mPaddingLeft-this.mPaddingRight));{if(this.isLayoutRtl()){this.mScrollX=scrollRange-this.mScrollX;}}if(this.mScrollX>scrollRange){this.mScrollX=scrollRange;}else if(this.mScrollX<0){this.mScrollX=0;}}this.scrollTo(this.mScrollX,this.mScrollY);}},{key:'onSizeChanged',value:function onSizeChanged(w,h,oldw,oldh){_get2(HorizontalScrollView.prototype.__proto__||Object.getPrototypeOf(HorizontalScrollView.prototype),'onSizeChanged',this).call(this,w,h,oldw,oldh);var currentFocused=this.findFocus();if(null==currentFocused||this==currentFocused)return;var maxJump=this.mRight-this.mLeft;if(this.isWithinDeltaOfScreen(currentFocused,maxJump)){currentFocused.getDrawingRect(this.mTempRect);this.offsetDescendantRectToMyCoords(currentFocused,this.mTempRect);var scrollDelta=this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);this.doScrollX(scrollDelta);}}},{key:'fling',value:function fling(velocityX){if(this.getChildCount()>0){var width=this.getWidth()-this.mPaddingRight-this.mPaddingLeft;var right=this.getChildAt(0).getWidth();this.mScroller.fling(this.mScrollX,this.mScrollY,velocityX,0,0,Math.max(0,right-width),0,0,width/2,0);var movingRight=velocityX>0;var currentFocused=this.findFocus();var newFocused=this.findFocusableViewInMyBounds(movingRight,this.mScroller.getFinalX(),currentFocused);if(newFocused==null){newFocused=this;}if(newFocused!=currentFocused){newFocused.requestFocus(movingRight?View.FOCUS_RIGHT:View.FOCUS_LEFT);}this.postInvalidateOnAnimation();}}},{key:'scrollTo',value:function scrollTo(x,y){if(this.getChildCount()>0){var child=this.getChildAt(0);x=HorizontalScrollView.clamp(x,this.getWidth()-this.mPaddingRight-this.mPaddingLeft,child.getWidth());y=HorizontalScrollView.clamp(y,this.getHeight()-this.mPaddingBottom-this.mPaddingTop,child.getHeight());if(x!=this.mScrollX||y!=this.mScrollY){_get2(HorizontalScrollView.prototype.__proto__||Object.getPrototypeOf(HorizontalScrollView.prototype),'scrollTo',this).call(this,x,y);}}}},{key:'setOverScrollMode',value:function setOverScrollMode(mode){_get2(HorizontalScrollView.prototype.__proto__||Object.getPrototypeOf(HorizontalScrollView.prototype),'setOverScrollMode',this).call(this,mode);}},{key:'draw',value:function draw(canvas){_get2(HorizontalScrollView.prototype.__proto__||Object.getPrototypeOf(HorizontalScrollView.prototype),'draw',this).call(this,canvas);}},{key:'mOverflingDistance',get:function get(){if(this.mScrollX<-this._mOverflingDistance)return-this.mScrollX;var overDistance=this.mScrollX-this.getScrollRange();if(overDistance>this._mOverflingDistance)return overDistance;return this._mOverflingDistance;},set:function set(value){this._mOverflingDistance=value;}}],[{key:'isViewDescendantOf',value:function isViewDescendantOf(child,parent){if(child==parent){return true;}var theParent=child.getParent();return theParent instanceof ViewGroup&&HorizontalScrollView.isViewDescendantOf(theParent,parent);}},{key:'clamp',value:function clamp(n,my,child){if(my>=child||n<0){return 0;}if(my+n>child){return child-my;}return n;}}]);return HorizontalScrollView;}(FrameLayout);HorizontalScrollView.ANIMATED_SCROLL_GAP=ScrollView.ANIMATED_SCROLL_GAP;HorizontalScrollView.MAX_SCROLL_FACTOR=ScrollView.MAX_SCROLL_FACTOR;HorizontalScrollView.TAG=\"HorizontalScrollView\";HorizontalScrollView.INVALID_POINTER=-1;widget.HorizontalScrollView=HorizontalScrollView;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var ArrayMap=android.util.ArrayMap;var ArrayDeque=java.util.ArrayDeque;var ArrayList=java.util.ArrayList;var Rect=android.graphics.Rect;var SynchronizedPool=android.util.Pools.SynchronizedPool;var SparseMap=android.util.SparseMap;var Gravity=android.view.Gravity;var View=android.view.View;var ViewGroup=android.view.ViewGroup;var Integer=java.lang.Integer;var System=java.lang.System;var Context=android.content.Context;var RelativeLayout=function(_ViewGroup4){_inherits(RelativeLayout,_ViewGroup4);function RelativeLayout(context,bindElement,defStyle){_classCallCheck(this,RelativeLayout);var _this120=_possibleConstructorReturn(this,(RelativeLayout.__proto__||Object.getPrototypeOf(RelativeLayout)).call(this,context,bindElement,defStyle));_this120.mBaselineView=null;_this120.mGravity=Gravity.START|Gravity.TOP;_this120.mContentBounds=new Rect();_this120.mSelfBounds=new Rect();_this120.mIgnoreGravity=View.NO_ID;_this120.mGraph=new RelativeLayout.DependencyGraph();_this120.mAllowBrokenMeasureSpecs=false;_this120.mMeasureVerticalWithPaddingMargin=false;if(bindElement||defStyle){var _a12=context.obtainStyledAttributes(bindElement,defStyle);_this120.mIgnoreGravity=_a12.getResourceId('ignoreGravity',View.NO_ID);_this120.mGravity=Gravity.parseGravity(_a12.getAttrValue('gravity'),_this120.mGravity);_a12.recycle();}_this120.queryCompatibilityModes();return _this120;}_createClass(RelativeLayout,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(RelativeLayout.prototype.__proto__||Object.getPrototypeOf(RelativeLayout.prototype),'createClassAttrBinder',this).call(this).set('ignoreGravity',{setter:function setter(v,value,a){v.setIgnoreGravity(value+'');},getter:function getter(v){return v.mIgnoreGravity;}}).set('gravity',{setter:function setter(v,value,a){v.setGravity(a.parseGravity(value,v.mGravity));},getter:function getter(v){return v.mGravity;}});}},{key:'queryCompatibilityModes',value:function queryCompatibilityModes(){this.mAllowBrokenMeasureSpecs=false;this.mMeasureVerticalWithPaddingMargin=true;}},{key:'shouldDelayChildPressedState',value:function shouldDelayChildPressedState(){return false;}},{key:'setIgnoreGravity',value:function setIgnoreGravity(viewId){this.mIgnoreGravity=viewId;}},{key:'getGravity',value:function getGravity(){return this.mGravity;}},{key:'setGravity',value:function setGravity(gravity){if(this.mGravity!=gravity){if((gravity&Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK)==0){gravity|=Gravity.START;}if((gravity&Gravity.VERTICAL_GRAVITY_MASK)==0){gravity|=Gravity.TOP;}this.mGravity=gravity;this.requestLayout();}}},{key:'setHorizontalGravity',value:function setHorizontalGravity(horizontalGravity){var gravity=horizontalGravity&Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK;if((this.mGravity&Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK)!=gravity){this.mGravity=this.mGravity&~Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK|gravity;this.requestLayout();}}},{key:'setVerticalGravity',value:function setVerticalGravity(verticalGravity){var gravity=verticalGravity&Gravity.VERTICAL_GRAVITY_MASK;if((this.mGravity&Gravity.VERTICAL_GRAVITY_MASK)!=gravity){this.mGravity=this.mGravity&~Gravity.VERTICAL_GRAVITY_MASK|gravity;this.requestLayout();}}},{key:'getBaseline',value:function getBaseline(){return this.mBaselineView!=null?this.mBaselineView.getBaseline():_get2(RelativeLayout.prototype.__proto__||Object.getPrototypeOf(RelativeLayout.prototype),'getBaseline',this).call(this);}},{key:'requestLayout',value:function requestLayout(){_get2(RelativeLayout.prototype.__proto__||Object.getPrototypeOf(RelativeLayout.prototype),'requestLayout',this).call(this);this.mDirtyHierarchy=true;}},{key:'sortChildren',value:function sortChildren(){var count=this.getChildCount();if(this.mSortedVerticalChildren==null||this.mSortedVerticalChildren.length!=count){this.mSortedVerticalChildren=new Array(count);}if(this.mSortedHorizontalChildren==null||this.mSortedHorizontalChildren.length!=count){this.mSortedHorizontalChildren=new Array(count);}var graph=this.mGraph;graph.clear();for(var i=0;i<count;i++){graph.add(this.getChildAt(i));}graph.getSortedViews(this.mSortedVerticalChildren,RelativeLayout.RULES_VERTICAL);graph.getSortedViews(this.mSortedHorizontalChildren,RelativeLayout.RULES_HORIZONTAL);}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){if(this.mDirtyHierarchy){this.mDirtyHierarchy=false;this.sortChildren();}var myWidth=-1;var myHeight=-1;var width=0;var height=0;var widthMode=View.MeasureSpec.getMode(widthMeasureSpec);var heightMode=View.MeasureSpec.getMode(heightMeasureSpec);var widthSize=View.MeasureSpec.getSize(widthMeasureSpec);var heightSize=View.MeasureSpec.getSize(heightMeasureSpec);if(widthMode!=View.MeasureSpec.UNSPECIFIED){myWidth=widthSize;}if(heightMode!=View.MeasureSpec.UNSPECIFIED){myHeight=heightSize;}if(widthMode==View.MeasureSpec.EXACTLY){width=myWidth;}if(heightMode==View.MeasureSpec.EXACTLY){height=myHeight;}this.mHasBaselineAlignedChild=false;var ignore=null;var gravity=this.mGravity&Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK;var horizontalGravity=gravity!=Gravity.START&&gravity!=0;gravity=this.mGravity&Gravity.VERTICAL_GRAVITY_MASK;var verticalGravity=gravity!=Gravity.TOP&&gravity!=0;var left=Integer.MAX_VALUE;var top=Integer.MAX_VALUE;var right=Integer.MIN_VALUE;var bottom=Integer.MIN_VALUE;var offsetHorizontalAxis=false;var offsetVerticalAxis=false;if((horizontalGravity||verticalGravity)&&this.mIgnoreGravity!=View.NO_ID){ignore=this.findViewById(this.mIgnoreGravity);}var isWrapContentWidth=widthMode!=View.MeasureSpec.EXACTLY;var isWrapContentHeight=heightMode!=View.MeasureSpec.EXACTLY;var layoutDirection=this.getLayoutDirection();if(this.isLayoutRtl()&&myWidth==-1){myWidth=RelativeLayout.DEFAULT_WIDTH;}var views=this.mSortedHorizontalChildren;var count=views.length;for(var i=0;i<count;i++){var child=views[i];if(child.getVisibility()!=RelativeLayout.GONE){var params=child.getLayoutParams();var rules=params.getRules(layoutDirection);this.applyHorizontalSizeRules(params,myWidth,rules);this.measureChildHorizontal(child,params,myWidth,myHeight);if(this.positionChildHorizontal(child,params,myWidth,isWrapContentWidth)){offsetHorizontalAxis=true;}}}views=this.mSortedVerticalChildren;count=views.length;for(var _i48=0;_i48<count;_i48++){var _child16=views[_i48];if(_child16.getVisibility()!=RelativeLayout.GONE){var _params=_child16.getLayoutParams();this.applyVerticalSizeRules(_params,myHeight);this._measureChild(_child16,_params,myWidth,myHeight);if(this.positionChildVertical(_child16,_params,myHeight,isWrapContentHeight)){offsetVerticalAxis=true;}if(isWrapContentWidth){if(this.isLayoutRtl()){width=Math.max(width,myWidth-_params.mLeft-_params.leftMargin);}else{width=Math.max(width,_params.mRight+_params.rightMargin);}}if(isWrapContentHeight){height=Math.max(height,_params.mBottom+_params.bottomMargin);}if(_child16!=ignore||verticalGravity){left=Math.min(left,_params.mLeft-_params.leftMargin);top=Math.min(top,_params.mTop-_params.topMargin);}if(_child16!=ignore||horizontalGravity){right=Math.max(right,_params.mRight+_params.rightMargin);bottom=Math.max(bottom,_params.mBottom+_params.bottomMargin);}}}if(this.mHasBaselineAlignedChild){for(var _i49=0;_i49<count;_i49++){var _child17=this.getChildAt(_i49);if(_child17.getVisibility()!=RelativeLayout.GONE){var _params2=_child17.getLayoutParams();this.alignBaseline(_child17,_params2);if(_child17!=ignore||verticalGravity){left=Math.min(left,_params2.mLeft-_params2.leftMargin);top=Math.min(top,_params2.mTop-_params2.topMargin);}if(_child17!=ignore||horizontalGravity){right=Math.max(right,_params2.mRight+_params2.rightMargin);bottom=Math.max(bottom,_params2.mBottom+_params2.bottomMargin);}}}}if(isWrapContentWidth){width+=this.mPaddingRight;if(this.mLayoutParams!=null&&this.mLayoutParams.width>=0){width=Math.max(width,this.mLayoutParams.width);}width=Math.max(width,this.getSuggestedMinimumWidth());width=RelativeLayout.resolveSize(width,widthMeasureSpec);if(offsetHorizontalAxis){for(var _i50=0;_i50<count;_i50++){var _child18=this.getChildAt(_i50);if(_child18.getVisibility()!=RelativeLayout.GONE){var _params3=_child18.getLayoutParams();var _rules=_params3.getRules(layoutDirection);if(_rules[RelativeLayout.CENTER_IN_PARENT]!=null||_rules[RelativeLayout.CENTER_HORIZONTAL]!=null){RelativeLayout.centerHorizontal(_child18,_params3,width);}else if(_rules[RelativeLayout.ALIGN_PARENT_RIGHT]!=null){var childWidth=_child18.getMeasuredWidth();_params3.mLeft=width-this.mPaddingRight-childWidth;_params3.mRight=_params3.mLeft+childWidth;}}}}}if(isWrapContentHeight){height+=this.mPaddingBottom;if(this.mLayoutParams!=null&&this.mLayoutParams.height>=0){height=Math.max(height,this.mLayoutParams.height);}height=Math.max(height,this.getSuggestedMinimumHeight());height=RelativeLayout.resolveSize(height,heightMeasureSpec);if(offsetVerticalAxis){for(var _i51=0;_i51<count;_i51++){var _child19=this.getChildAt(_i51);if(_child19.getVisibility()!=RelativeLayout.GONE){var _params4=_child19.getLayoutParams();var _rules2=_params4.getRules(layoutDirection);if(_rules2[RelativeLayout.CENTER_IN_PARENT]!=null||_rules2[RelativeLayout.CENTER_VERTICAL]!=null){RelativeLayout.centerVertical(_child19,_params4,height);}else if(_rules2[RelativeLayout.ALIGN_PARENT_BOTTOM]!=null){var childHeight=_child19.getMeasuredHeight();_params4.mTop=height-this.mPaddingBottom-childHeight;_params4.mBottom=_params4.mTop+childHeight;}}}}}if(horizontalGravity||verticalGravity){var selfBounds=this.mSelfBounds;selfBounds.set(this.mPaddingLeft,this.mPaddingTop,width-this.mPaddingRight,height-this.mPaddingBottom);var contentBounds=this.mContentBounds;Gravity.apply(this.mGravity,right-left,bottom-top,selfBounds,contentBounds,layoutDirection);var horizontalOffset=contentBounds.left-left;var verticalOffset=contentBounds.top-top;if(horizontalOffset!=0||verticalOffset!=0){for(var _i52=0;_i52<count;_i52++){var _child20=this.getChildAt(_i52);if(_child20.getVisibility()!=RelativeLayout.GONE&&_child20!=ignore){var _params5=_child20.getLayoutParams();if(horizontalGravity){_params5.mLeft+=horizontalOffset;_params5.mRight+=horizontalOffset;}if(verticalGravity){_params5.mTop+=verticalOffset;_params5.mBottom+=verticalOffset;}}}}}if(this.isLayoutRtl()){var offsetWidth=myWidth-width;for(var _i53=0;_i53<count;_i53++){var _child21=this.getChildAt(_i53);if(_child21.getVisibility()!=RelativeLayout.GONE){var _params6=_child21.getLayoutParams();_params6.mLeft-=offsetWidth;_params6.mRight-=offsetWidth;}}}this.setMeasuredDimension(width,height);}},{key:'alignBaseline',value:function alignBaseline(child,params){var layoutDirection=this.getLayoutDirection();var rules=params.getRules(layoutDirection);var anchorBaseline=this.getRelatedViewBaseline(rules,RelativeLayout.ALIGN_BASELINE);if(anchorBaseline!=-1){var anchorParams=this.getRelatedViewParams(rules,RelativeLayout.ALIGN_BASELINE);if(anchorParams!=null){var offset=anchorParams.mTop+anchorBaseline;var baseline=child.getBaseline();if(baseline!=-1){offset-=baseline;}var height=params.mBottom-params.mTop;params.mTop=offset;params.mBottom=params.mTop+height;}}if(this.mBaselineView==null){this.mBaselineView=child;}else{var lp=this.mBaselineView.getLayoutParams();if(params.mTop<lp.mTop||params.mTop==lp.mTop&&params.mLeft<lp.mLeft){this.mBaselineView=child;}}}},{key:'_measureChild',value:function _measureChild(child,params,myWidth,myHeight){var childWidthMeasureSpec=this.getChildMeasureSpec(params.mLeft,params.mRight,params.width,params.leftMargin,params.rightMargin,this.mPaddingLeft,this.mPaddingRight,myWidth);var childHeightMeasureSpec=this.getChildMeasureSpec(params.mTop,params.mBottom,params.height,params.topMargin,params.bottomMargin,this.mPaddingTop,this.mPaddingBottom,myHeight);child.measure(childWidthMeasureSpec,childHeightMeasureSpec);}},{key:'measureChildHorizontal',value:function measureChildHorizontal(child,params,myWidth,myHeight){var childWidthMeasureSpec=this.getChildMeasureSpec(params.mLeft,params.mRight,params.width,params.leftMargin,params.rightMargin,this.mPaddingLeft,this.mPaddingRight,myWidth);var maxHeight=myHeight;if(this.mMeasureVerticalWithPaddingMargin){maxHeight=Math.max(0,myHeight-this.mPaddingTop-this.mPaddingBottom-params.topMargin-params.bottomMargin);}var childHeightMeasureSpec=void 0;if(myHeight<0&&!this.mAllowBrokenMeasureSpecs){if(params.height>=0){childHeightMeasureSpec=View.MeasureSpec.makeMeasureSpec(params.height,View.MeasureSpec.EXACTLY);}else{childHeightMeasureSpec=View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);}}else if(params.width==RelativeLayout.LayoutParams.MATCH_PARENT){childHeightMeasureSpec=View.MeasureSpec.makeMeasureSpec(maxHeight,View.MeasureSpec.EXACTLY);}else{childHeightMeasureSpec=View.MeasureSpec.makeMeasureSpec(maxHeight,View.MeasureSpec.AT_MOST);}child.measure(childWidthMeasureSpec,childHeightMeasureSpec);}},{key:'getChildMeasureSpec',value:function getChildMeasureSpec(childStart,childEnd,childSize,startMargin,endMargin,startPadding,endPadding,mySize){if(mySize<0&&!this.mAllowBrokenMeasureSpecs){if(childSize>=0){return View.MeasureSpec.makeMeasureSpec(childSize,View.MeasureSpec.EXACTLY);}return View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);}var childSpecMode=0;var childSpecSize=0;var tempStart=childStart;var tempEnd=childEnd;if(tempStart<0){tempStart=startPadding+startMargin;}if(tempEnd<0){tempEnd=mySize-endPadding-endMargin;}var maxAvailable=tempEnd-tempStart;if(childStart>=0&&childEnd>=0){childSpecMode=View.MeasureSpec.EXACTLY;childSpecSize=maxAvailable;}else{if(childSize>=0){childSpecMode=View.MeasureSpec.EXACTLY;if(maxAvailable>=0){childSpecSize=Math.min(maxAvailable,childSize);}else{childSpecSize=childSize;}}else if(childSize==RelativeLayout.LayoutParams.MATCH_PARENT){childSpecMode=View.MeasureSpec.EXACTLY;childSpecSize=maxAvailable;}else if(childSize==RelativeLayout.LayoutParams.WRAP_CONTENT){if(maxAvailable>=0){childSpecMode=View.MeasureSpec.AT_MOST;childSpecSize=maxAvailable;}else{childSpecMode=View.MeasureSpec.UNSPECIFIED;childSpecSize=0;}}}return View.MeasureSpec.makeMeasureSpec(childSpecSize,childSpecMode);}},{key:'positionChildHorizontal',value:function positionChildHorizontal(child,params,myWidth,wrapContent){var layoutDirection=this.getLayoutDirection();var rules=params.getRules(layoutDirection);if(params.mLeft<0&&params.mRight>=0){params.mLeft=params.mRight-child.getMeasuredWidth();}else if(params.mLeft>=0&&params.mRight<0){params.mRight=params.mLeft+child.getMeasuredWidth();}else if(params.mLeft<0&&params.mRight<0){if(rules[RelativeLayout.CENTER_IN_PARENT]!=null||rules[RelativeLayout.CENTER_HORIZONTAL]!=null){if(!wrapContent){RelativeLayout.centerHorizontal(child,params,myWidth);}else{params.mLeft=this.mPaddingLeft+params.leftMargin;params.mRight=params.mLeft+child.getMeasuredWidth();}return true;}else{if(this.isLayoutRtl()){params.mRight=myWidth-this.mPaddingRight-params.rightMargin;params.mLeft=params.mRight-child.getMeasuredWidth();}else{params.mLeft=this.mPaddingLeft+params.leftMargin;params.mRight=params.mLeft+child.getMeasuredWidth();}}}return rules[RelativeLayout.ALIGN_PARENT_END]!=null;}},{key:'positionChildVertical',value:function positionChildVertical(child,params,myHeight,wrapContent){var rules=params.getRules();if(params.mTop<0&&params.mBottom>=0){params.mTop=params.mBottom-child.getMeasuredHeight();}else if(params.mTop>=0&&params.mBottom<0){params.mBottom=params.mTop+child.getMeasuredHeight();}else if(params.mTop<0&&params.mBottom<0){if(rules[RelativeLayout.CENTER_IN_PARENT]!=null||rules[RelativeLayout.CENTER_VERTICAL]!=null){if(!wrapContent){RelativeLayout.centerVertical(child,params,myHeight);}else{params.mTop=this.mPaddingTop+params.topMargin;params.mBottom=params.mTop+child.getMeasuredHeight();}return true;}else{params.mTop=this.mPaddingTop+params.topMargin;params.mBottom=params.mTop+child.getMeasuredHeight();}}return rules[RelativeLayout.ALIGN_PARENT_BOTTOM]!=null;}},{key:'applyHorizontalSizeRules',value:function applyHorizontalSizeRules(childParams,myWidth,rules){var anchorParams=void 0;childParams.mLeft=-1;childParams.mRight=-1;anchorParams=this.getRelatedViewParams(rules,RelativeLayout.LEFT_OF);if(anchorParams!=null){childParams.mRight=anchorParams.mLeft-(anchorParams.leftMargin+childParams.rightMargin);}else if(childParams.alignWithParent&&rules[RelativeLayout.LEFT_OF]!=null){if(myWidth>=0){childParams.mRight=myWidth-this.mPaddingRight-childParams.rightMargin;}}anchorParams=this.getRelatedViewParams(rules,RelativeLayout.RIGHT_OF);if(anchorParams!=null){childParams.mLeft=anchorParams.mRight+(anchorParams.rightMargin+childParams.leftMargin);}else if(childParams.alignWithParent&&rules[RelativeLayout.RIGHT_OF]!=null){childParams.mLeft=this.mPaddingLeft+childParams.leftMargin;}anchorParams=this.getRelatedViewParams(rules,RelativeLayout.ALIGN_LEFT);if(anchorParams!=null){childParams.mLeft=anchorParams.mLeft+childParams.leftMargin;}else if(childParams.alignWithParent&&rules[RelativeLayout.ALIGN_LEFT]!=null){childParams.mLeft=this.mPaddingLeft+childParams.leftMargin;}anchorParams=this.getRelatedViewParams(rules,RelativeLayout.ALIGN_RIGHT);if(anchorParams!=null){childParams.mRight=anchorParams.mRight-childParams.rightMargin;}else if(childParams.alignWithParent&&rules[RelativeLayout.ALIGN_RIGHT]!=null){if(myWidth>=0){childParams.mRight=myWidth-this.mPaddingRight-childParams.rightMargin;}}if(null!=rules[RelativeLayout.ALIGN_PARENT_LEFT]){childParams.mLeft=this.mPaddingLeft+childParams.leftMargin;}if(null!=rules[RelativeLayout.ALIGN_PARENT_RIGHT]){if(myWidth>=0){childParams.mRight=myWidth-this.mPaddingRight-childParams.rightMargin;}}}},{key:'applyVerticalSizeRules',value:function applyVerticalSizeRules(childParams,myHeight){var rules=childParams.getRules();var anchorParams=void 0;childParams.mTop=-1;childParams.mBottom=-1;anchorParams=this.getRelatedViewParams(rules,RelativeLayout.ABOVE);if(anchorParams!=null){childParams.mBottom=anchorParams.mTop-(anchorParams.topMargin+childParams.bottomMargin);}else if(childParams.alignWithParent&&rules[RelativeLayout.ABOVE]!=null){if(myHeight>=0){childParams.mBottom=myHeight-this.mPaddingBottom-childParams.bottomMargin;}}anchorParams=this.getRelatedViewParams(rules,RelativeLayout.BELOW);if(anchorParams!=null){childParams.mTop=anchorParams.mBottom+(anchorParams.bottomMargin+childParams.topMargin);}else if(childParams.alignWithParent&&rules[RelativeLayout.BELOW]!=null){childParams.mTop=this.mPaddingTop+childParams.topMargin;}anchorParams=this.getRelatedViewParams(rules,RelativeLayout.ALIGN_TOP);if(anchorParams!=null){childParams.mTop=anchorParams.mTop+childParams.topMargin;}else if(childParams.alignWithParent&&rules[RelativeLayout.ALIGN_TOP]!=null){childParams.mTop=this.mPaddingTop+childParams.topMargin;}anchorParams=this.getRelatedViewParams(rules,RelativeLayout.ALIGN_BOTTOM);if(anchorParams!=null){childParams.mBottom=anchorParams.mBottom-childParams.bottomMargin;}else if(childParams.alignWithParent&&rules[RelativeLayout.ALIGN_BOTTOM]!=null){if(myHeight>=0){childParams.mBottom=myHeight-this.mPaddingBottom-childParams.bottomMargin;}}if(null!=rules[RelativeLayout.ALIGN_PARENT_TOP]){childParams.mTop=this.mPaddingTop+childParams.topMargin;}if(null!=rules[RelativeLayout.ALIGN_PARENT_BOTTOM]){if(myHeight>=0){childParams.mBottom=myHeight-this.mPaddingBottom-childParams.bottomMargin;}}if(rules[RelativeLayout.ALIGN_BASELINE]!=null){this.mHasBaselineAlignedChild=true;}}},{key:'getRelatedView',value:function getRelatedView(rules,relation){var id=rules[relation];if(id!=null){var node=this.mGraph.mKeyNodes.get(id);if(node==null)return null;var v=node.view;while(v.getVisibility()==View.GONE){rules=v.getLayoutParams().getRules(v.getLayoutDirection());node=this.mGraph.mKeyNodes.get(rules[relation]);if(node==null)return null;v=node.view;}return v;}return null;}},{key:'getRelatedViewParams',value:function getRelatedViewParams(rules,relation){var v=this.getRelatedView(rules,relation);if(v!=null){var params=v.getLayoutParams();if(params instanceof RelativeLayout.LayoutParams){return v.getLayoutParams();}}return null;}},{key:'getRelatedViewBaseline',value:function getRelatedViewBaseline(rules,relation){var v=this.getRelatedView(rules,relation);if(v!=null){return v.getBaseline();}return-1;}},{key:'onLayout',value:function onLayout(changed,l,t,r,b){var count=this.getChildCount();for(var i=0;i<count;i++){var child=this.getChildAt(i);if(child.getVisibility()!=RelativeLayout.GONE){var st=child.getLayoutParams();child.layout(st.mLeft,st.mTop,st.mRight,st.mBottom);}}}},{key:'generateLayoutParamsFromAttr',value:function generateLayoutParamsFromAttr(attrs){return new RelativeLayout.LayoutParams(this.getContext(),attrs);}},{key:'generateDefaultLayoutParams',value:function generateDefaultLayoutParams(){return new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);}},{key:'checkLayoutParams',value:function checkLayoutParams(p){return p instanceof RelativeLayout.LayoutParams;}},{key:'generateLayoutParams',value:function generateLayoutParams(p){return new RelativeLayout.LayoutParams(p);}}],[{key:'centerHorizontal',value:function centerHorizontal(child,params,myWidth){var childWidth=child.getMeasuredWidth();var left=(myWidth-childWidth)/2;params.mLeft=left;params.mRight=left+childWidth;}},{key:'centerVertical',value:function centerVertical(child,params,myHeight){var childHeight=child.getMeasuredHeight();var top=(myHeight-childHeight)/2;params.mTop=top;params.mBottom=top+childHeight;}}]);return RelativeLayout;}(ViewGroup);RelativeLayout.TRUE=\"\";RelativeLayout.LEFT_OF=0;RelativeLayout.RIGHT_OF=1;RelativeLayout.ABOVE=2;RelativeLayout.BELOW=3;RelativeLayout.ALIGN_BASELINE=4;RelativeLayout.ALIGN_LEFT=5;RelativeLayout.ALIGN_TOP=6;RelativeLayout.ALIGN_RIGHT=7;RelativeLayout.ALIGN_BOTTOM=8;RelativeLayout.ALIGN_PARENT_LEFT=9;RelativeLayout.ALIGN_PARENT_TOP=10;RelativeLayout.ALIGN_PARENT_RIGHT=11;RelativeLayout.ALIGN_PARENT_BOTTOM=12;RelativeLayout.CENTER_IN_PARENT=13;RelativeLayout.CENTER_HORIZONTAL=14;RelativeLayout.CENTER_VERTICAL=15;RelativeLayout.START_OF=16;RelativeLayout.END_OF=17;RelativeLayout.ALIGN_START=18;RelativeLayout.ALIGN_END=19;RelativeLayout.ALIGN_PARENT_START=20;RelativeLayout.ALIGN_PARENT_END=21;RelativeLayout.VERB_COUNT=22;RelativeLayout.RULES_VERTICAL=[RelativeLayout.ABOVE,RelativeLayout.BELOW,RelativeLayout.ALIGN_BASELINE,RelativeLayout.ALIGN_TOP,RelativeLayout.ALIGN_BOTTOM];RelativeLayout.RULES_HORIZONTAL=[RelativeLayout.LEFT_OF,RelativeLayout.RIGHT_OF,RelativeLayout.ALIGN_LEFT,RelativeLayout.ALIGN_RIGHT,RelativeLayout.START_OF,RelativeLayout.END_OF,RelativeLayout.ALIGN_START,RelativeLayout.ALIGN_END];RelativeLayout.DEFAULT_WIDTH=0x00010000;widget.RelativeLayout=RelativeLayout;(function(RelativeLayout){var LayoutParams=function(_ViewGroup$MarginLayo2){_inherits(LayoutParams,_ViewGroup$MarginLayo2);function LayoutParams(){var _ref9;for(var _len30=arguments.length,args=Array(_len30),_key31=0;_key31<_len30;_key31++){args[_key31]=arguments[_key31];}_classCallCheck(this,LayoutParams);var _this121=_possibleConstructorReturn(this,(_ref9=LayoutParams.__proto__||Object.getPrototypeOf(LayoutParams)).call.apply(_ref9,[this].concat(_toConsumableArray(function(){if(args[0]instanceof android.content.Context&&args[1]instanceof HTMLElement)return[args[0],args[1]];else if(typeof args[0]==='number'&&typeof args[1]==='number')return[args[0],args[1]];else if(args[0]instanceof RelativeLayout.LayoutParams)return[args[0]];else if(args[0]instanceof ViewGroup.MarginLayoutParams)return[args[0]];else if(args[0]instanceof ViewGroup.LayoutParams)return[args[0]];}()))));_this121.mRules=new Array(RelativeLayout.VERB_COUNT);_this121.mInitialRules=new Array(RelativeLayout.VERB_COUNT);_this121.mLeft=0;_this121.mTop=0;_this121.mRight=0;_this121.mBottom=0;_this121.mStart=LayoutParams.DEFAULT_MARGIN_RELATIVE;_this121.mEnd=LayoutParams.DEFAULT_MARGIN_RELATIVE;_this121.mRulesChanged=false;_this121.mIsRtlCompatibilityMode=false;if(args[0]instanceof Context&&args[1]instanceof HTMLElement){var c=args[0];var attrs=args[1];var _a13=c.obtainStyledAttributes(attrs);_this121.mIsRtlCompatibilityMode=false;var rules=_this121.mRules;var initialRules=_this121.mInitialRules;var _iteratorNormalCompletion68=true;var _didIteratorError68=false;var _iteratorError68=undefined;try{for(var _iterator68=_a13.getLowerCaseNoNamespaceAttrNames()[Symbol.iterator](),_step68;!(_iteratorNormalCompletion68=(_step68=_iterator68.next()).done);_iteratorNormalCompletion68=true){var attr=_step68.value;switch(attr){case'layout_alignwithparentifmissing':_this121.alignWithParent=_a13.getBoolean(attr,false);break;case'layout_toleftof':rules[RelativeLayout.LEFT_OF]=_a13.getResourceId(attr,null);break;case'layout_torightof':rules[RelativeLayout.RIGHT_OF]=_a13.getResourceId(attr,null);break;case'layout_above':rules[RelativeLayout.ABOVE]=_a13.getResourceId(attr,null);break;case'layout_below':rules[RelativeLayout.BELOW]=_a13.getResourceId(attr,null);break;case'layout_alignbaseline':rules[RelativeLayout.ALIGN_BASELINE]=_a13.getResourceId(attr,null);break;case'layout_alignleft':rules[RelativeLayout.ALIGN_LEFT]=_a13.getResourceId(attr,null);break;case'layout_aligntop':rules[RelativeLayout.ALIGN_TOP]=_a13.getResourceId(attr,null);break;case'layout_alignright':rules[RelativeLayout.ALIGN_RIGHT]=_a13.getResourceId(attr,null);break;case'layout_alignbottom':rules[RelativeLayout.ALIGN_BOTTOM]=_a13.getResourceId(attr,null);break;case'layout_alignparentleft':rules[RelativeLayout.ALIGN_PARENT_LEFT]=_a13.getBoolean(attr,false)?RelativeLayout.TRUE:null;break;case'layout_alignparenttop':rules[RelativeLayout.ALIGN_PARENT_TOP]=_a13.getBoolean(attr,false)?RelativeLayout.TRUE:null;break;case'layout_alignparentright':rules[RelativeLayout.ALIGN_PARENT_RIGHT]=_a13.getBoolean(attr,false)?RelativeLayout.TRUE:null;break;case'layout_alignparentbottom':rules[RelativeLayout.ALIGN_PARENT_BOTTOM]=_a13.getBoolean(attr,false)?RelativeLayout.TRUE:null;break;case'layout_centerinparent':rules[RelativeLayout.CENTER_IN_PARENT]=_a13.getBoolean(attr,false)?RelativeLayout.TRUE:null;break;case'layout_centerhorizontal':rules[RelativeLayout.CENTER_HORIZONTAL]=_a13.getBoolean(attr,false)?RelativeLayout.TRUE:null;break;case'layout_centervertical':rules[RelativeLayout.CENTER_VERTICAL]=_a13.getBoolean(attr,false)?RelativeLayout.TRUE:null;break;case'layout_tostartof':rules[RelativeLayout.START_OF]=_a13.getResourceId(attr,null);break;case'layout_toendof':rules[RelativeLayout.END_OF]=_a13.getResourceId(attr,null);break;case'layout_alignstart':rules[RelativeLayout.ALIGN_START]=_a13.getResourceId(attr,null);break;case'layout_alignend':rules[RelativeLayout.ALIGN_END]=_a13.getResourceId(attr,null);break;case'layout_alignparentstart':rules[RelativeLayout.ALIGN_PARENT_START]=_a13.getBoolean(attr,false)?RelativeLayout.TRUE:null;break;case'layout_alignparentend':rules[RelativeLayout.ALIGN_PARENT_END]=_a13.getBoolean(attr,false)?RelativeLayout.TRUE:null;break;}}}catch(err){_didIteratorError68=true;_iteratorError68=err;}finally{try{if(!_iteratorNormalCompletion68&&_iterator68.return){_iterator68.return();}}finally{if(_didIteratorError68){throw _iteratorError68;}}}_this121.mRulesChanged=true;System.arraycopy(rules,RelativeLayout.LEFT_OF,initialRules,RelativeLayout.LEFT_OF,RelativeLayout.VERB_COUNT);_a13.recycle();}else if(typeof args[0]==='number'&&typeof args[1]==='number'){var _this121=_possibleConstructorReturn(this,(LayoutParams.__proto__||Object.getPrototypeOf(LayoutParams)).call(this,args[0],args[1]));}else if(args[0]instanceof RelativeLayout.LayoutParams){var source=args[0];_this121.mIsRtlCompatibilityMode=source.mIsRtlCompatibilityMode;_this121.mRulesChanged=source.mRulesChanged;_this121.alignWithParent=source.alignWithParent;System.arraycopy(source.mRules,RelativeLayout.LEFT_OF,_this121.mRules,RelativeLayout.LEFT_OF,RelativeLayout.VERB_COUNT);System.arraycopy(source.mInitialRules,RelativeLayout.LEFT_OF,_this121.mInitialRules,RelativeLayout.LEFT_OF,RelativeLayout.VERB_COUNT);}else if(args[0]instanceof ViewGroup.MarginLayoutParams){}else if(args[0]instanceof ViewGroup.LayoutParams){}return _possibleConstructorReturn(_this121);}_createClass(LayoutParams,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(LayoutParams.prototype.__proto__||Object.getPrototypeOf(LayoutParams.prototype),'createClassAttrBinder',this).call(this).set('layout_alignWithParentIfMissing',{setter:function setter(param,value,attrBinder){param.alignWithParent=attrBinder.parseBoolean(value,false);},getter:function getter(param){return param.alignWithParent;}}).set('layout_toLeftOf',{setter:function setter(param,value,attrBinder){this.addRule(RelativeLayout.LEFT_OF,value+'');},getter:function getter(param){return param.mRules[RelativeLayout.LEFT_OF];}}).set('layout_toRightOf',{setter:function setter(param,value,attrBinder){this.addRule(RelativeLayout.RIGHT_OF,value+'');},getter:function getter(param){return param.mRules[RelativeLayout.RIGHT_OF];}}).set('layout_above',{setter:function setter(param,value,attrBinder){this.addRule(RelativeLayout.ABOVE,value+'');},getter:function getter(param){return param.mRules[RelativeLayout.ABOVE];}}).set('layout_below',{setter:function setter(param,value,attrBinder){this.addRule(RelativeLayout.BELOW,value+'');},getter:function getter(param){return param.mRules[RelativeLayout.BELOW];}}).set('layout_alignBaseline',{setter:function setter(param,value,attrBinder){this.addRule(RelativeLayout.ALIGN_BASELINE,value+'');},getter:function getter(param){return param.mRules[RelativeLayout.ALIGN_BASELINE];}}).set('layout_alignLeft',{setter:function setter(param,value,attrBinder){this.addRule(RelativeLayout.ALIGN_LEFT,value+'');},getter:function getter(param){return param.mRules[RelativeLayout.ALIGN_LEFT];}}).set('layout_alignTop',{setter:function setter(param,value,attrBinder){this.addRule(RelativeLayout.ALIGN_TOP,value+'');},getter:function getter(param){return param.mRules[RelativeLayout.ALIGN_TOP];}}).set('layout_alignRight',{setter:function setter(param,value,attrBinder){this.addRule(RelativeLayout.ALIGN_RIGHT,value+'');},getter:function getter(param){return param.mRules[RelativeLayout.ALIGN_RIGHT];}}).set('layout_alignBottom',{setter:function setter(param,value,attrBinder){this.addRule(RelativeLayout.ALIGN_BOTTOM,value+'');},getter:function getter(param){return param.mRules[RelativeLayout.ALIGN_BOTTOM];}}).set('layout_alignParentLeft',{setter:function setter(param,value,attrBinder){var anchor=attrBinder.parseBoolean(value,false)?RelativeLayout.TRUE:null;this.addRule(RelativeLayout.ALIGN_PARENT_LEFT,anchor);},getter:function getter(param){return param.mRules[RelativeLayout.ALIGN_PARENT_LEFT];}}).set('layout_alignParentTop',{setter:function setter(param,value,attrBinder){var anchor=attrBinder.parseBoolean(value,false)?RelativeLayout.TRUE:null;this.addRule(RelativeLayout.ALIGN_PARENT_TOP,anchor);},getter:function getter(param){return param.mRules[RelativeLayout.ALIGN_PARENT_TOP];}}).set('layout_alignParentRight',{setter:function setter(param,value,attrBinder){var anchor=attrBinder.parseBoolean(value,false)?RelativeLayout.TRUE:null;this.addRule(RelativeLayout.ALIGN_PARENT_RIGHT,anchor);},getter:function getter(param){return param.mRules[RelativeLayout.ALIGN_PARENT_RIGHT];}}).set('layout_alignParentBottom',{setter:function setter(param,value,attrBinder){var anchor=attrBinder.parseBoolean(value,false)?RelativeLayout.TRUE:null;this.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM,anchor);},getter:function getter(param){return param.mRules[RelativeLayout.ALIGN_PARENT_BOTTOM];}}).set('layout_centerInParent',{setter:function setter(param,value,attrBinder){var anchor=attrBinder.parseBoolean(value,false)?RelativeLayout.TRUE:null;this.addRule(RelativeLayout.CENTER_IN_PARENT,anchor);},getter:function getter(param){return param.mRules[RelativeLayout.CENTER_IN_PARENT];}}).set('layout_centerHorizontal',{setter:function setter(param,value,attrBinder){var anchor=attrBinder.parseBoolean(value,false)?RelativeLayout.TRUE:null;this.addRule(RelativeLayout.CENTER_HORIZONTAL,anchor);},getter:function getter(param){return param.mRules[RelativeLayout.CENTER_HORIZONTAL];}}).set('layout_centerVertical',{setter:function setter(param,value,attrBinder){var anchor=attrBinder.parseBoolean(value,false)?RelativeLayout.TRUE:null;this.addRule(RelativeLayout.CENTER_VERTICAL,anchor);},getter:function getter(param){return param.mRules[RelativeLayout.CENTER_VERTICAL];}}).set('layout_toStartOf',{setter:function setter(param,value,attrBinder){this.addRule(RelativeLayout.LEFT_OF,value+'');},getter:function getter(param){return param.mRules[RelativeLayout.LEFT_OF];}}).set('layout_toEndOf',{setter:function setter(param,value,attrBinder){this.addRule(RelativeLayout.RIGHT_OF,value+'');},getter:function getter(param){return param.mRules[RelativeLayout.RIGHT_OF];}}).set('layout_alignStart',{setter:function setter(param,value,attrBinder){this.addRule(RelativeLayout.ALIGN_LEFT,value+'');},getter:function getter(param){return param.mRules[RelativeLayout.ALIGN_LEFT];}}).set('layout_alignEnd',{setter:function setter(param,value,attrBinder){this.addRule(RelativeLayout.ALIGN_RIGHT,value+'');},getter:function getter(param){return param.mRules[RelativeLayout.ALIGN_RIGHT];}}).set('layout_alignParentStart',{setter:function setter(param,value,attrBinder){var anchor=attrBinder.parseBoolean(value,false)?RelativeLayout.TRUE:null;this.addRule(RelativeLayout.ALIGN_PARENT_LEFT,anchor);},getter:function getter(param){return param.mRules[RelativeLayout.ALIGN_PARENT_LEFT];}}).set('layout_alignParentEnd',{setter:function setter(param,value,attrBinder){var anchor=attrBinder.parseBoolean(value,false)?RelativeLayout.TRUE:null;this.addRule(RelativeLayout.ALIGN_PARENT_RIGHT,anchor);},getter:function getter(param){return param.mRules[RelativeLayout.ALIGN_PARENT_RIGHT];}});}},{key:'addRule',value:function addRule(verb){var anchor=arguments.length>1&&arguments[1]!==undefined?arguments[1]:RelativeLayout.TRUE;this.mRules[verb]=anchor;this.mInitialRules[verb]=anchor;this.mRulesChanged=true;}},{key:'removeRule',value:function removeRule(verb){this.mRules[verb]=null;this.mInitialRules[verb]=null;this.mRulesChanged=true;}},{key:'hasRelativeRules',value:function hasRelativeRules(){return this.mInitialRules[RelativeLayout.START_OF]!=null||this.mInitialRules[RelativeLayout.END_OF]!=null||this.mInitialRules[RelativeLayout.ALIGN_START]!=null||this.mInitialRules[RelativeLayout.ALIGN_END]!=null||this.mInitialRules[RelativeLayout.ALIGN_PARENT_START]!=null||this.mInitialRules[RelativeLayout.ALIGN_PARENT_END]!=null;}},{key:'resolveRules',value:function resolveRules(layoutDirection){var isLayoutRtl=layoutDirection==View.LAYOUT_DIRECTION_RTL;System.arraycopy(this.mInitialRules,RelativeLayout.LEFT_OF,this.mRules,RelativeLayout.LEFT_OF,RelativeLayout.VERB_COUNT);if(this.mIsRtlCompatibilityMode){if(this.mRules[RelativeLayout.ALIGN_START]!=null){if(this.mRules[RelativeLayout.ALIGN_LEFT]==null){this.mRules[RelativeLayout.ALIGN_LEFT]=this.mRules[RelativeLayout.ALIGN_START];}this.mRules[RelativeLayout.ALIGN_START]=null;}if(this.mRules[RelativeLayout.ALIGN_END]!=null){if(this.mRules[RelativeLayout.ALIGN_RIGHT]==null){this.mRules[RelativeLayout.ALIGN_RIGHT]=this.mRules[RelativeLayout.ALIGN_END];}this.mRules[RelativeLayout.ALIGN_END]=null;}if(this.mRules[RelativeLayout.START_OF]!=null){if(this.mRules[RelativeLayout.LEFT_OF]==null){this.mRules[RelativeLayout.LEFT_OF]=this.mRules[RelativeLayout.START_OF];}this.mRules[RelativeLayout.START_OF]=null;}if(this.mRules[RelativeLayout.END_OF]!=null){if(this.mRules[RelativeLayout.RIGHT_OF]==null){this.mRules[RelativeLayout.RIGHT_OF]=this.mRules[RelativeLayout.END_OF];}this.mRules[RelativeLayout.END_OF]=null;}if(this.mRules[RelativeLayout.ALIGN_PARENT_START]!=null){if(this.mRules[RelativeLayout.ALIGN_PARENT_LEFT]==null){this.mRules[RelativeLayout.ALIGN_PARENT_LEFT]=this.mRules[RelativeLayout.ALIGN_PARENT_START];}this.mRules[RelativeLayout.ALIGN_PARENT_START]=null;}if(this.mRules[RelativeLayout.ALIGN_PARENT_RIGHT]==null){if(this.mRules[RelativeLayout.ALIGN_PARENT_RIGHT]==null){this.mRules[RelativeLayout.ALIGN_PARENT_RIGHT]=this.mRules[RelativeLayout.ALIGN_PARENT_END];}this.mRules[RelativeLayout.ALIGN_PARENT_END]=null;}}else{if((this.mRules[RelativeLayout.ALIGN_START]!=null||this.mRules[RelativeLayout.ALIGN_END]!=null)&&(this.mRules[RelativeLayout.ALIGN_LEFT]!=null||this.mRules[RelativeLayout.ALIGN_RIGHT]!=null)){this.mRules[RelativeLayout.ALIGN_LEFT]=null;this.mRules[RelativeLayout.ALIGN_RIGHT]=null;}if(this.mRules[RelativeLayout.ALIGN_START]!=null){this.mRules[isLayoutRtl?RelativeLayout.ALIGN_RIGHT:RelativeLayout.ALIGN_LEFT]=this.mRules[RelativeLayout.ALIGN_START];this.mRules[RelativeLayout.ALIGN_START]=null;}if(this.mRules[RelativeLayout.ALIGN_END]!=null){this.mRules[isLayoutRtl?RelativeLayout.ALIGN_LEFT:RelativeLayout.ALIGN_RIGHT]=this.mRules[RelativeLayout.ALIGN_END];this.mRules[RelativeLayout.ALIGN_END]=null;}if((this.mRules[RelativeLayout.START_OF]!=null||this.mRules[RelativeLayout.END_OF]!=null)&&(this.mRules[RelativeLayout.LEFT_OF]!=null||this.mRules[RelativeLayout.RIGHT_OF]!=null)){this.mRules[RelativeLayout.LEFT_OF]=null;this.mRules[RelativeLayout.RIGHT_OF]=null;}if(this.mRules[RelativeLayout.START_OF]!=null){this.mRules[isLayoutRtl?RelativeLayout.RIGHT_OF:RelativeLayout.LEFT_OF]=this.mRules[RelativeLayout.START_OF];this.mRules[RelativeLayout.START_OF]=null;}if(this.mRules[RelativeLayout.END_OF]!=null){this.mRules[isLayoutRtl?RelativeLayout.LEFT_OF:RelativeLayout.RIGHT_OF]=this.mRules[RelativeLayout.END_OF];this.mRules[RelativeLayout.END_OF]=null;}if((this.mRules[RelativeLayout.ALIGN_PARENT_START]!=null||this.mRules[RelativeLayout.ALIGN_PARENT_END]!=null)&&(this.mRules[RelativeLayout.ALIGN_PARENT_LEFT]!=null||this.mRules[RelativeLayout.ALIGN_PARENT_RIGHT]!=null)){this.mRules[RelativeLayout.ALIGN_PARENT_LEFT]=null;this.mRules[RelativeLayout.ALIGN_PARENT_RIGHT]=null;}if(this.mRules[RelativeLayout.ALIGN_PARENT_START]!=null){this.mRules[isLayoutRtl?RelativeLayout.ALIGN_PARENT_RIGHT:RelativeLayout.ALIGN_PARENT_LEFT]=this.mRules[RelativeLayout.ALIGN_PARENT_START];this.mRules[RelativeLayout.ALIGN_PARENT_START]=null;}if(this.mRules[RelativeLayout.ALIGN_PARENT_END]!=null){this.mRules[isLayoutRtl?RelativeLayout.ALIGN_PARENT_LEFT:RelativeLayout.ALIGN_PARENT_RIGHT]=this.mRules[RelativeLayout.ALIGN_PARENT_END];this.mRules[RelativeLayout.ALIGN_PARENT_END]=null;}}this.mRulesChanged=false;}},{key:'getRules',value:function getRules(layoutDirection){if(layoutDirection!=null){if(this.hasRelativeRules()&&(this.mRulesChanged||layoutDirection!=this.getLayoutDirection())){this.resolveRules(layoutDirection);if(layoutDirection!=this.getLayoutDirection()){this.setLayoutDirection(layoutDirection);}}}return this.mRules;}},{key:'resolveLayoutDirection',value:function resolveLayoutDirection(layoutDirection){var isLayoutRtl=this.isLayoutRtl();if(isLayoutRtl){if(this.mStart!=LayoutParams.DEFAULT_MARGIN_RELATIVE)this.mRight=this.mStart;if(this.mEnd!=LayoutParams.DEFAULT_MARGIN_RELATIVE)this.mLeft=this.mEnd;}else{if(this.mStart!=LayoutParams.DEFAULT_MARGIN_RELATIVE)this.mLeft=this.mStart;if(this.mEnd!=LayoutParams.DEFAULT_MARGIN_RELATIVE)this.mRight=this.mEnd;}if(this.hasRelativeRules()&&layoutDirection!=this.getLayoutDirection()){this.resolveRules(layoutDirection);}_get2(LayoutParams.prototype.__proto__||Object.getPrototypeOf(LayoutParams.prototype),'resolveLayoutDirection',this).call(this,layoutDirection);}}]);return LayoutParams;}(ViewGroup.MarginLayoutParams);RelativeLayout.LayoutParams=LayoutParams;var DependencyGraph=function(){function DependencyGraph(){_classCallCheck(this,DependencyGraph);this.mNodes=new ArrayList();this.mKeyNodes=new SparseMap();this.mRoots=new ArrayDeque();}_createClass(DependencyGraph,[{key:'clear',value:function clear(){var nodes=this.mNodes;var count=nodes.size();for(var i=0;i<count;i++){nodes.get(i).release();}nodes.clear();this.mKeyNodes.clear();this.mRoots.clear();}},{key:'add',value:function add(view){var id=view.getId();var node=DependencyGraph.Node.acquire(view);if(id!=View.NO_ID){this.mKeyNodes.put(id,node);}this.mNodes.add(node);}},{key:'getSortedViews',value:function getSortedViews(sorted,rules){var roots=this.findRoots(rules);var index=0;var node=void 0;while((node=roots.pollLast())!=null){var view=node.view;var key=view.getId();sorted[index++]=view;var dependents=node.dependents;var count=dependents.size();for(var i=0;i<count;i++){var dependent=dependents.keyAt(i);var dependencies=dependent.dependencies;dependencies.remove(key);if(dependencies.size()==0){roots.add(dependent);}}}if(index<sorted.length){throw Error('new IllegalStateException(\"Circular dependencies cannot exist\" + \" in RelativeLayout\")');}}},{key:'findRoots',value:function findRoots(rulesFilter){var keyNodes=this.mKeyNodes;var nodes=this.mNodes;var count=nodes.size();for(var i=0;i<count;i++){var node=nodes.get(i);node.dependents.clear();node.dependencies.clear();}for(var _i54=0;_i54<count;_i54++){var _node=nodes.get(_i54);var layoutParams=_node.view.getLayoutParams();var rules=layoutParams.mRules;var rulesCount=rulesFilter.length;for(var j=0;j<rulesCount;j++){var rule=rules[rulesFilter[j]];if(rule!=null){var dependency=keyNodes.get(rule);if(dependency==null||dependency==_node){continue;}dependency.dependents.put(_node,this);_node.dependencies.put(rule,dependency);}}}var roots=this.mRoots;roots.clear();for(var _i55=0;_i55<count;_i55++){var _node2=nodes.get(_i55);if(_node2.dependencies.size()==0)roots.addLast(_node2);}return roots;}}]);return DependencyGraph;}();RelativeLayout.DependencyGraph=DependencyGraph;(function(DependencyGraph){var Node=function(){function Node(){_classCallCheck(this,Node);this.dependents=new ArrayMap();this.dependencies=new SparseMap();}_createClass(Node,[{key:'release',value:function release(){this.view=null;this.dependents.clear();this.dependencies.clear();Node.sPool.release(this);}}],[{key:'acquire',value:function acquire(view){var node=Node.sPool.acquire();if(node==null){node=new Node();}node.view=view;return node;}}]);return Node;}();Node.POOL_LIMIT=100;Node.sPool=new SynchronizedPool(Node.POOL_LIMIT);DependencyGraph.Node=Node;})(DependencyGraph=RelativeLayout.DependencyGraph||(RelativeLayout.DependencyGraph={}));})(RelativeLayout=widget.RelativeLayout||(widget.RelativeLayout={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var text;(function(text){var method;(function(method){var PasswordTransformationMethod=function(_method$SingleLineTra){_inherits(PasswordTransformationMethod,_method$SingleLineTra);function PasswordTransformationMethod(){_classCallCheck(this,PasswordTransformationMethod);return _possibleConstructorReturn(this,(PasswordTransformationMethod.__proto__||Object.getPrototypeOf(PasswordTransformationMethod)).apply(this,arguments));}_createClass(PasswordTransformationMethod,[{key:'getTransformation',value:function getTransformation(source,v){var transform=_get2(PasswordTransformationMethod.prototype.__proto__||Object.getPrototypeOf(PasswordTransformationMethod.prototype),'getTransformation',this).call(this,source,v);if(transform)transform=new Array(transform.length+1).join('•');return transform;}}],[{key:'getInstance',value:function getInstance(){if(PasswordTransformationMethod.instance!=null)return PasswordTransformationMethod.instance;PasswordTransformationMethod.instance=new PasswordTransformationMethod();return PasswordTransformationMethod.instance;}}]);return PasswordTransformationMethod;}(method.SingleLineTransformationMethod);method.PasswordTransformationMethod=PasswordTransformationMethod;})(method=text.method||(text.method={}));})(text=android.text||(android.text={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var TextUtils=android.text.TextUtils;var TextView=android.widget.TextView;var Gravity=android.view.Gravity;var Color=android.graphics.Color;var Canvas=android.graphics.Canvas;var Integer=java.lang.Integer;var InputType=android.text.InputType;var PasswordTransformationMethod=android.text.method.PasswordTransformationMethod;var Platform=androidui.util.Platform;var EditText=function(_TextView){_inherits(EditText,_TextView);function EditText(context,bindElement){var defStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.R.attr.editTextStyle;_classCallCheck(this,EditText);var _this123=_possibleConstructorReturn(this,(EditText.__proto__||Object.getPrototypeOf(EditText)).call(this,context,bindElement,defStyle));_this123.mInputType=InputType.TYPE_NULL;_this123.mForceDisableDraw=false;_this123.mMaxLength=Integer.MAX_VALUE;var a=context.obtainStyledAttributes(bindElement,defStyle);var inputTypeS=a.getAttrValue(\"inputType\");if(inputTypeS){_this123._setInputType(inputTypeS);}_this123.mMaxLength=a.getInteger('maxLength',_this123.mMaxLength);return _this123;}_createClass(EditText,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(EditText.prototype.__proto__||Object.getPrototypeOf(EditText.prototype),'createClassAttrBinder',this).call(this).set('inputType',{setter:function setter(v,value,attrBinder){if(Number.isInteger(Number.parseInt(value))){v.setInputType(Number.parseInt(value));}else{v._setInputType(value+'');}},getter:function getter(v){return v.getInputType();}}).set('maxLength',{setter:function setter(v,value,attrBinder){v.mMaxLength=attrBinder.parseInt(value,v.mMaxLength);},getter:function getter(v){return v.mMaxLength;}});}},{key:'initBindElement',value:function initBindElement(bindElement){_get2(EditText.prototype.__proto__||Object.getPrototypeOf(EditText.prototype),'initBindElement',this).call(this,bindElement);this.switchToMultiLineInputElement();}},{key:'onInputValueChange',value:function onInputValueChange(e){var text=this.inputElement.value;var filterText='';for(var i=0,length=text.length;i<length;i++){var c=text.codePointAt(i);if(!this.filterKeyCodeByInputType(c)&&filterText.length<this.mMaxLength){filterText+=text[i];}}if(text!=filterText){text=filterText;this.inputElement.value=text;}if(!text||text.length===0){this.setForceDisableDrawText(false);}else{this.setForceDisableDrawText(true);}this.setText(text);}},{key:'onDomTextInput',value:function onDomTextInput(e){var text=e['data'];for(var i=0,length=text.length;i<length;i++){var c=text.codePointAt(i);if(!this.filterKeyCodeOnInput(c)){return;}}e.preventDefault();e.stopPropagation();}},{key:'switchToInputElement',value:function switchToInputElement(inputElement){var _this124=this;if(this.inputElement===inputElement)return;inputElement.onblur=function(){inputElement.style.opacity='0';_this124.setForceDisableDrawText(false);_this124.onInputElementFocusChanged(false);};inputElement.onfocus=function(){inputElement.style.opacity='1';if(_this124.getText().length>0){_this124.setForceDisableDrawText(true);}_this124.onInputElementFocusChanged(true);};inputElement.oninput=function(e){return _this124.onInputValueChange(e);};inputElement.removeEventListener('textInput',function(e){return _this124.onDomTextInput(e);});inputElement.addEventListener('textInput',function(e){return _this124.onDomTextInput(e);});if(this.inputElement&&this.inputElement.parentElement){this.bindElement.removeChild(this.inputElement);this.bindElement.appendChild(inputElement);}this.inputElement=inputElement;}},{key:'switchToSingleLineInputElement',value:function switchToSingleLineInputElement(){if(!this.mSingleLineInputElement){this.mSingleLineInputElement=document.createElement('input');this.mSingleLineInputElement.style.position='absolute';this.mSingleLineInputElement.style['webkitAppearance']='none';this.mSingleLineInputElement.style.borderRadius='0';this.mSingleLineInputElement.style.overflow='auto';this.mSingleLineInputElement.style.background='transparent';this.mSingleLineInputElement.style.fontFamily=Canvas.getMeasureTextFontFamily();}this.switchToInputElement(this.mSingleLineInputElement);}},{key:'switchToMultiLineInputElement',value:function switchToMultiLineInputElement(){if(!this.mMultiLineInputElement){this.mMultiLineInputElement=document.createElement('textarea');this.mMultiLineInputElement.style.position='absolute';this.mMultiLineInputElement.style['webkitAppearance']='none';this.mMultiLineInputElement.style['resize']='none';this.mMultiLineInputElement.style.borderRadius='0';this.mMultiLineInputElement.style.overflow='auto';this.mMultiLineInputElement.style.background='transparent';this.mMultiLineInputElement.style.boxSizing='border-box';this.mMultiLineInputElement.style.fontFamily=Canvas.getMeasureTextFontFamily();}this.switchToInputElement(this.mMultiLineInputElement);}},{key:'tryShowInputElement',value:function tryShowInputElement(){if(!this.isInputElementShowed()){this.inputElement.value=this.getText().toString();this.bindElement.appendChild(this.inputElement);this.inputElement.focus();if(this.getText().length>0){this.setForceDisableDrawText(true);}this.syncTextBoundInfoToInputElement();}}},{key:'tryDismissInputElement',value:function tryDismissInputElement(){try{if(this.inputElement.parentNode)this.bindElement.removeChild(this.inputElement);}catch(e){}this.setForceDisableDrawText(false);}},{key:'onInputElementFocusChanged',value:function onInputElementFocusChanged(focused){}},{key:'isInputElementShowed',value:function isInputElementShowed(){return this.inputElement.parentElement!=null&&this.inputElement.style.opacity!='0';}},{key:'performClick',value:function performClick(event){this.tryShowInputElement();return _get2(EditText.prototype.__proto__||Object.getPrototypeOf(EditText.prototype),'performClick',this).call(this,event);}},{key:'onFocusChanged',value:function onFocusChanged(focused,direction,previouslyFocusedRect){_get2(EditText.prototype.__proto__||Object.getPrototypeOf(EditText.prototype),'onFocusChanged',this).call(this,focused,direction,previouslyFocusedRect);if(focused){this.tryShowInputElement();}else{this.tryDismissInputElement();}}},{key:'setForceDisableDrawText',value:function setForceDisableDrawText(disable){if(this.mForceDisableDraw==disable)return;this.mForceDisableDraw=disable;if(disable){this.mSkipDrawText=true;}else{this.mSkipDrawText=false;}this.invalidate();}},{key:'updateTextColors',value:function updateTextColors(){_get2(EditText.prototype.__proto__||Object.getPrototypeOf(EditText.prototype),'updateTextColors',this).call(this);if(this.isInputElementShowed()){this.syncTextBoundInfoToInputElement();}}},{key:'onTouchEvent',value:function onTouchEvent(event){var superResult=_get2(EditText.prototype.__proto__||Object.getPrototypeOf(EditText.prototype),'onTouchEvent',this).call(this,event);if(this.isInputElementShowed()){event[android.view.ViewRootImpl.ContinueEventToDom]=true;if(this.inputElement.scrollHeight>this.inputElement.offsetHeight||this.inputElement.scrollWidth>this.inputElement.offsetWidth){this.getParent().requestDisallowInterceptTouchEvent(true);}return true;}return superResult;}},{key:'filterKeyEvent',value:function filterKeyEvent(event){var keyCode=event.getKeyCode();if(keyCode==android.view.KeyEvent.KEYCODE_Backspace||keyCode==android.view.KeyEvent.KEYCODE_Del||event.isCtrlPressed()||event.isAltPressed()||event.isMetaPressed()){return false;}if(keyCode==android.view.KeyEvent.KEYCODE_ENTER&&this.isSingleLine()){return true;}if(event.mIsTypingKey){if(this.getText().length>=this.mMaxLength){return true;}return this.filterKeyCodeOnInput(keyCode);}return false;}},{key:'filterKeyCodeByInputType',value:function filterKeyCodeByInputType(keyCode){var filter=false;var inputType=this.mInputType;var typeClass=inputType&InputType.TYPE_MASK_CLASS;if(typeClass===InputType.TYPE_CLASS_NUMBER){filter=InputType.LimitCode.TYPE_CLASS_NUMBER.indexOf(keyCode)===-1;if((inputType&InputType.TYPE_NUMBER_FLAG_SIGNED)===InputType.TYPE_NUMBER_FLAG_SIGNED){filter=filter&&keyCode!==android.view.KeyEvent.KEYCODE_Minus;}if((inputType&InputType.TYPE_NUMBER_FLAG_DECIMAL)===InputType.TYPE_NUMBER_FLAG_DECIMAL){filter=filter&&keyCode!==android.view.KeyEvent.KEYCODE_Period;}}else if(typeClass===InputType.TYPE_CLASS_PHONE){filter=InputType.LimitCode.TYPE_CLASS_PHONE.indexOf(keyCode)===-1;}return filter;}},{key:'filterKeyCodeOnInput',value:function filterKeyCodeOnInput(keyCode){var filter=false;var inputType=this.mInputType;var typeClass=inputType&InputType.TYPE_MASK_CLASS;if(typeClass===InputType.TYPE_CLASS_NUMBER){if((inputType&InputType.TYPE_NUMBER_FLAG_SIGNED)===InputType.TYPE_NUMBER_FLAG_SIGNED){if(keyCode===android.view.KeyEvent.KEYCODE_Minus&&this.getText().length>0){filter=true;}}if((inputType&InputType.TYPE_NUMBER_FLAG_DECIMAL)===InputType.TYPE_NUMBER_FLAG_DECIMAL){if(keyCode===android.view.KeyEvent.KEYCODE_Period&&(this.getText().includes('.')||this.getText().length===0)){filter=true;}}}return filter||this.filterKeyCodeByInputType(keyCode);}},{key:'checkFilterKeyEventToDom',value:function checkFilterKeyEventToDom(event){if(this.isInputElementShowed()){if(this.filterKeyEvent(event)){event[android.view.ViewRootImpl.ContinueEventToDom]=false;}else{event[android.view.ViewRootImpl.ContinueEventToDom]=true;}return true;}return false;}},{key:'onKeyDown',value:function onKeyDown(keyCode,event){var filter=this.checkFilterKeyEventToDom(event);return _get2(EditText.prototype.__proto__||Object.getPrototypeOf(EditText.prototype),'onKeyDown',this).call(this,keyCode,event)||filter;}},{key:'onKeyUp',value:function onKeyUp(keyCode,event){var filter=this.checkFilterKeyEventToDom(event);return _get2(EditText.prototype.__proto__||Object.getPrototypeOf(EditText.prototype),'onKeyUp',this).call(this,keyCode,event)||filter;}},{key:'requestSyncBoundToElement',value:function requestSyncBoundToElement(){var immediately=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(this.isInputElementShowed()){immediately=true;}_get2(EditText.prototype.__proto__||Object.getPrototypeOf(EditText.prototype),'requestSyncBoundToElement',this).call(this,immediately);}},{key:'setRawTextSize',value:function setRawTextSize(size){_get2(EditText.prototype.__proto__||Object.getPrototypeOf(EditText.prototype),'setRawTextSize',this).call(this,size);if(this.isInputElementShowed()){this.syncTextBoundInfoToInputElement();}}},{key:'onTextChanged',value:function onTextChanged(text,start,lengthBefore,lengthAfter){if(this.isInputElementShowed()){this.syncTextBoundInfoToInputElement();}}},{key:'onLayout',value:function onLayout(changed,left,top,right,bottom){_get2(EditText.prototype.__proto__||Object.getPrototypeOf(EditText.prototype),'onLayout',this).call(this,changed,left,top,right,bottom);if(this.isInputElementShowed()){this.syncTextBoundInfoToInputElement();}}},{key:'setGravity',value:function setGravity(gravity){_get2(EditText.prototype.__proto__||Object.getPrototypeOf(EditText.prototype),'setGravity',this).call(this,gravity);if(this.isInputElementShowed()){this.syncTextBoundInfoToInputElement();}}},{key:'setSingleLine',value:function setSingleLine(){var singleLine=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(singleLine){this.switchToSingleLineInputElement();}else{this.switchToMultiLineInputElement();}_get2(EditText.prototype.__proto__||Object.getPrototypeOf(EditText.prototype),'setSingleLine',this).call(this,singleLine);}},{key:'_setInputType',value:function _setInputType(value){switch(value+''){case'none':this.setInputType(InputType.TYPE_NULL);break;case'text':this.setInputType(InputType.TYPE_CLASS_TEXT);break;case'textUri':this.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_URI);break;case'textEmailAddress':this.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);break;case'textPassword':this.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_PASSWORD);break;case'textVisiblePassword':this.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_PASSWORD);break;case'number':this.setInputType(InputType.TYPE_CLASS_NUMBER);break;case'numberSigned':this.setInputType(InputType.TYPE_CLASS_NUMBER|InputType.TYPE_NUMBER_FLAG_SIGNED);break;case'numberDecimal':this.setInputType(InputType.TYPE_CLASS_NUMBER|InputType.TYPE_NUMBER_FLAG_DECIMAL);break;case'numberPassword':this.setInputType(InputType.TYPE_CLASS_NUMBER|InputType.TYPE_NUMBER_VARIATION_PASSWORD);break;case'phone':this.setInputType(InputType.TYPE_CLASS_PHONE);break;case'datetime':this.setInputType(InputType.TYPE_CLASS_DATETIME);break;case'date':this.setInputType(InputType.TYPE_CLASS_DATETIME|InputType.TYPE_DATETIME_VARIATION_DATE);break;case'time':this.setInputType(InputType.TYPE_CLASS_DATETIME|InputType.TYPE_DATETIME_VARIATION_TIME);break;}}},{key:'setInputType',value:function setInputType(type){this.mInputType=type;var typeClass=type&InputType.TYPE_MASK_CLASS;this.inputElement.style['webkitTextSecurity']='';this.setTransformationMethod(null);switch(typeClass){case InputType.TYPE_NULL:this.setSingleLine(false);this.inputElement.removeAttribute('type');break;case InputType.TYPE_CLASS_TEXT:if((type&InputType.TYPE_TEXT_VARIATION_URI)===InputType.TYPE_TEXT_VARIATION_URI){this.setSingleLine(true);this.inputElement.setAttribute('type','url');}else if((type&InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS)===InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS){this.setSingleLine(true);this.inputElement.setAttribute('type','email');}else if((type&InputType.TYPE_TEXT_VARIATION_PASSWORD)===InputType.TYPE_TEXT_VARIATION_PASSWORD){this.setSingleLine(true);this.inputElement.setAttribute('type','password');this.setTransformationMethod(PasswordTransformationMethod.getInstance());}else if((type&InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD)===InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD){this.setSingleLine(true);this.inputElement.setAttribute('type','email');}else{this.setSingleLine(false);this.inputElement.removeAttribute('type');}break;case InputType.TYPE_CLASS_NUMBER:this.setSingleLine(true);this.inputElement.setAttribute('type','number');if((type&InputType.TYPE_NUMBER_VARIATION_PASSWORD)===InputType.TYPE_NUMBER_VARIATION_PASSWORD){this.inputElement.style['webkitTextSecurity']='disc';this.setTransformationMethod(PasswordTransformationMethod.getInstance());}break;case InputType.TYPE_CLASS_PHONE:this.setSingleLine(true);this.inputElement.setAttribute('type','tel');break;case InputType.TYPE_CLASS_DATETIME:this.setSingleLine(true);if((type&InputType.TYPE_DATETIME_VARIATION_DATE)===InputType.TYPE_DATETIME_VARIATION_DATE){this.inputElement.setAttribute('type','date');}else if((type&InputType.TYPE_DATETIME_VARIATION_TIME)===InputType.TYPE_DATETIME_VARIATION_TIME){this.inputElement.setAttribute('type','time');}else{this.inputElement.setAttribute('type','datetime');}break;}}},{key:'getInputType',value:function getInputType(){return this.mInputType;}},{key:'syncTextBoundInfoToInputElement',value:function syncTextBoundInfoToInputElement(){var left=this.getLeft();var top=this.getTop();var right=this.getRight();var bottom=this.getBottom();var density=this.getResources().getDisplayMetrics().density;var maxHeight=this.getMaxHeight();if(maxHeight<=0||maxHeight>=Integer.MAX_VALUE){var maxLine=this.getMaxLines();if(maxLine>0&&maxLine<Integer.MAX_VALUE){maxHeight=maxLine*this.getLineHeight();}}var textHeight=bottom-top-this.getCompoundPaddingTop()-this.getCompoundPaddingBottom();if(maxHeight<=0||maxHeight>textHeight){maxHeight=textHeight;}var layout=this.mLayout;if(this.mHint!=null&&this.mText.length==0){layout=this.mHintLayout;}var height=layout?Math.min(layout.getLineTop(layout.getLineCount()),maxHeight):maxHeight;this.inputElement.style.height=height/density+1+'px';this.inputElement.style.top='';this.inputElement.style.bottom='';this.inputElement.style.transform=this.inputElement.style.webkitTransform='';var gravity=this.getGravity();switch(gravity&Gravity.VERTICAL_GRAVITY_MASK){case Gravity.TOP:this.inputElement.style.top=this.getCompoundPaddingTop()/density+'px';break;case Gravity.BOTTOM:this.inputElement.style.bottom=this.getCompoundPaddingBottom()/density+'px';break;default:this.inputElement.style.top='50%';this.inputElement.style.transform=this.inputElement.style.webkitTransform='translate(0, -50%)';break;}switch(gravity&Gravity.HORIZONTAL_GRAVITY_MASK){case Gravity.LEFT:this.inputElement.style.textAlign='left';break;case Gravity.RIGHT:this.inputElement.style.textAlign='right';break;default:this.inputElement.style.textAlign='center';break;}var isIOS=Platform.isIOS;this.inputElement.style.left=this.getCompoundPaddingLeft()/density-(isIOS?3:0)+'px';this.inputElement.style.width=(right-left-this.getCompoundPaddingRight()-this.getCompoundPaddingLeft())/density+(isIOS?6:1)+'px';this.inputElement.style.lineHeight=this.getLineHeight()/density+'px';if(this.getLineCount()==1){this.inputElement.style.whiteSpace='nowrap';}else{this.inputElement.style.whiteSpace='';}var text=this.getText().toString();if(text!=this.inputElement.value)this.inputElement.value=text;this.inputElement.style.fontSize=this.getTextSize()/density+'px';this.inputElement.style.color=Color.toRGBAFunc(this.getCurrentTextColor());if(this.inputElement==this.mMultiLineInputElement){this.inputElement.style.padding=(this.getTextSize()/density/5).toFixed(1)+'px 0px 0px 0px';}else{this.inputElement.style.padding='0px';}}},{key:'dependOnDebugLayout',value:function dependOnDebugLayout(){return true;}},{key:'setEllipsize',value:function setEllipsize(ellipsis){if(ellipsis==TextUtils.TruncateAt.MARQUEE){throw Error('new IllegalArgumentException(\"EditText cannot use the ellipsize mode \" + \"TextUtils.TruncateAt.MARQUEE\")');}_get2(EditText.prototype.__proto__||Object.getPrototypeOf(EditText.prototype),'setEllipsize',this).call(this,ellipsis);}}]);return EditText;}(TextView);widget.EditText=EditText;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var Matrix=android.graphics.Matrix;var RectF=android.graphics.RectF;var View=android.view.View;var Integer=java.lang.Integer;var NetDrawable=androidui.image.NetDrawable;var LayoutParams=android.view.ViewGroup.LayoutParams;var ImageView=function(_View2){_inherits(ImageView,_View2);function ImageView(context,bindElement,defStyle){_classCallCheck(this,ImageView);var _this125=_possibleConstructorReturn(this,(ImageView.__proto__||Object.getPrototypeOf(ImageView)).call(this,context,bindElement,defStyle));_this125.mHaveFrame=false;_this125.mAdjustViewBounds=false;_this125.mMaxWidth=Integer.MAX_VALUE;_this125.mMaxHeight=Integer.MAX_VALUE;_this125.mAlpha=255;_this125.mViewAlphaScale=256;_this125.mColorMod=false;_this125.mDrawable=null;_this125.mState=null;_this125.mMergeState=false;_this125.mLevel=0;_this125.mDrawableWidth=0;_this125.mDrawableHeight=0;_this125.mDrawMatrix=null;_this125.mTempSrc=new RectF();_this125.mTempDst=new RectF();_this125.mBaseline=-1;_this125.mBaselineAlignBottom=false;_this125.mAdjustViewBoundsCompat=false;_this125.initImageView();var a=context.obtainStyledAttributes(bindElement,defStyle);var d=a.getDrawable('src');if(d!=null){_this125.setImageDrawable(d);}_this125.mBaselineAlignBottom=a.getBoolean('baselineAlignBottom',false);_this125.mBaseline=a.getDimensionPixelSize('baseline',-1);_this125.setAdjustViewBounds(a.getBoolean('adjustViewBounds',false));_this125.setMaxWidth(a.getDimensionPixelSize('maxWidth',Integer.MAX_VALUE));_this125.setMaxHeight(a.getDimensionPixelSize('maxHeight',Integer.MAX_VALUE));var scaleType=ImageView.parseScaleType(a.getString('scaleType'),null);if(scaleType!=null){_this125.setScaleType(scaleType);}var alpha=a.getInt('drawableAlpha',255);if(alpha!=255){_this125.setAlpha(alpha);}_this125.mCropToPadding=a.getBoolean('cropToPadding',false);a.recycle();return _this125;}_createClass(ImageView,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(ImageView.prototype.__proto__||Object.getPrototypeOf(ImageView.prototype),'createClassAttrBinder',this).call(this).set('src',{setter:function setter(v,value,attrBinder){var d=attrBinder.parseDrawable(value);if(d)v.setImageDrawable(d);else v.setImageURI(value);},getter:function getter(v){return v.mDrawable;}}).set('baselineAlignBottom',{setter:function setter(v,value,attrBinder){v.setBaselineAlignBottom(attrBinder.parseBoolean(value,v.mBaselineAlignBottom));},getter:function getter(v){return v.getBaselineAlignBottom();}}).set('baseline',{setter:function setter(v,value,attrBinder){v.setBaseline(attrBinder.parseNumberPixelSize(value,v.mBaseline));},getter:function getter(v){return v.mBaseline;}}).set('adjustViewBounds',{setter:function setter(v,value,attrBinder){v.setAdjustViewBounds(attrBinder.parseBoolean(value,false));},getter:function getter(v){return v.getAdjustViewBounds();}}).set('maxWidth',{setter:function setter(v,value,attrBinder){var baseValue=v.getParent()instanceof View?v.getParent().getWidth():0;v.setMaxWidth(attrBinder.parseNumberPixelSize(value,v.mMaxWidth,baseValue));},getter:function getter(v){return v.mMaxWidth;}}).set('maxHeight',{setter:function setter(v,value,attrBinder){var baseValue=v.getParent()instanceof View?v.getParent().getHeight():0;v.setMaxHeight(attrBinder.parseNumberPixelSize(value,v.mMaxHeight,baseValue));},getter:function getter(v){return v.mMaxHeight;}}).set('scaleType',{setter:function setter(v,value,attrBinder){if(typeof value==='number'){v.setScaleType(value);}else{v.setScaleType(ImageView.parseScaleType(value,v.mScaleType));}},getter:function getter(v){return v.mScaleType;}}).set('drawableAlpha',{setter:function setter(v,value,attrBinder){v.setImageAlpha(attrBinder.parseInt(value,v.mAlpha));},getter:function getter(v){return v.mAlpha;}}).set('cropToPadding',{setter:function setter(v,value,attrBinder){v.setCropToPadding(attrBinder.parseBoolean(value,false));},getter:function getter(v){return v.getCropToPadding();}});}},{key:'initImageView',value:function initImageView(){this.mMatrix=new Matrix();this.mScaleType=ImageView.ScaleType.FIT_CENTER;}},{key:'verifyDrawable',value:function verifyDrawable(dr){return this.mDrawable==dr||_get2(ImageView.prototype.__proto__||Object.getPrototypeOf(ImageView.prototype),'verifyDrawable',this).call(this,dr);}},{key:'jumpDrawablesToCurrentState',value:function jumpDrawablesToCurrentState(){_get2(ImageView.prototype.__proto__||Object.getPrototypeOf(ImageView.prototype),'jumpDrawablesToCurrentState',this).call(this);if(this.mDrawable!=null)this.mDrawable.jumpToCurrentState();}},{key:'invalidateDrawable',value:function invalidateDrawable(dr){if(dr==this.mDrawable){this.invalidate();}else{_get2(ImageView.prototype.__proto__||Object.getPrototypeOf(ImageView.prototype),'invalidateDrawable',this).call(this,dr);}}},{key:'drawableSizeChange',value:function drawableSizeChange(who){if(who==this.mDrawable){this.resizeFromDrawable();}else{_get2(ImageView.prototype.__proto__||Object.getPrototypeOf(ImageView.prototype),'drawableSizeChange',this).call(this,who);}}},{key:'hasOverlappingRendering',value:function hasOverlappingRendering(){return this.getBackground()!=null&&this.getBackground().getCurrent()!=null;}},{key:'getAdjustViewBounds',value:function getAdjustViewBounds(){return this.mAdjustViewBounds;}},{key:'setAdjustViewBounds',value:function setAdjustViewBounds(adjustViewBounds){this.mAdjustViewBounds=adjustViewBounds;if(adjustViewBounds){this.setScaleType(ImageView.ScaleType.FIT_CENTER);}}},{key:'getMaxWidth',value:function getMaxWidth(){return this.mMaxWidth;}},{key:'setMaxWidth',value:function setMaxWidth(maxWidth){this.mMaxWidth=maxWidth;}},{key:'getMaxHeight',value:function getMaxHeight(){return this.mMaxHeight;}},{key:'setMaxHeight',value:function setMaxHeight(maxHeight){this.mMaxHeight=maxHeight;}},{key:'getDrawable',value:function getDrawable(){return this.mDrawable;}},{key:'setImageURI',value:function setImageURI(uri){if(this.mUri!=uri){if(this.mDrawable instanceof NetDrawable){this.mUri=uri;this.mDrawable.setURL(uri);this.invalidate();}else{this.updateDrawable(null);this.mUri=uri;var oldWidth=this.mDrawableWidth;var oldHeight=this.mDrawableHeight;this.resolveUri();if(oldWidth!=this.mDrawableWidth||oldHeight!=this.mDrawableHeight){this.requestLayout();}this.invalidate();}}}},{key:'setImageDrawable',value:function setImageDrawable(drawable){if(this.mDrawable!=drawable){this.mUri=null;var oldWidth=this.mDrawableWidth;var oldHeight=this.mDrawableHeight;this.updateDrawable(drawable);if(oldWidth!=this.mDrawableWidth||oldHeight!=this.mDrawableHeight){this.requestLayout();}this.invalidate();}}},{key:'setImageState',value:function setImageState(state,merge){this.mState=state;this.mMergeState=merge;if(this.mDrawable!=null){this.refreshDrawableState();this.resizeFromDrawable();}}},{key:'setSelected',value:function setSelected(selected){_get2(ImageView.prototype.__proto__||Object.getPrototypeOf(ImageView.prototype),'setSelected',this).call(this,selected);this.resizeFromDrawable();}},{key:'setImageLevel',value:function setImageLevel(level){this.mLevel=level;if(this.mDrawable!=null){this.mDrawable.setLevel(level);this.resizeFromDrawable();}}},{key:'setScaleType',value:function setScaleType(scaleType){if(scaleType==null){throw Error('new NullPointerException()');}if(this.mScaleType!=scaleType){this.mScaleType=scaleType;this.setWillNotCacheDrawing(this.mScaleType==ImageView.ScaleType.CENTER);this.requestLayout();this.invalidate();}}},{key:'getScaleType',value:function getScaleType(){return this.mScaleType;}},{key:'getImageMatrix',value:function getImageMatrix(){if(this.mDrawMatrix==null){return new Matrix(Matrix.IDENTITY_MATRIX);}return this.mDrawMatrix;}},{key:'setImageMatrix',value:function setImageMatrix(matrix){if(matrix!=null&&matrix.isIdentity()){matrix=null;}if(matrix==null&&!this.mMatrix.isIdentity()||matrix!=null&&!this.mMatrix.equals(matrix)){this.mMatrix.set(matrix);this.configureBounds();this.invalidate();}}},{key:'getCropToPadding',value:function getCropToPadding(){return this.mCropToPadding;}},{key:'setCropToPadding',value:function setCropToPadding(cropToPadding){if(this.mCropToPadding!=cropToPadding){this.mCropToPadding=cropToPadding;this.requestLayout();this.invalidate();}}},{key:'resolveUri',value:function resolveUri(){if(this.mDrawable!=null){return;}var d=null;if(this.mUri!=null){d=new androidui.image.NetDrawable(this.mUri);}else{return;}this.updateDrawable(d);}},{key:'onCreateDrawableState',value:function onCreateDrawableState(extraSpace){if(this.mState==null){return _get2(ImageView.prototype.__proto__||Object.getPrototypeOf(ImageView.prototype),'onCreateDrawableState',this).call(this,extraSpace);}else if(!this.mMergeState){return this.mState;}else{return ImageView.mergeDrawableStates(_get2(ImageView.prototype.__proto__||Object.getPrototypeOf(ImageView.prototype),'onCreateDrawableState',this).call(this,extraSpace+this.mState.length),this.mState);}}},{key:'updateDrawable',value:function updateDrawable(d){if(this.mDrawable!=null){this.mDrawable.setCallback(null);this.unscheduleDrawable(this.mDrawable);}this.mDrawable=d;if(d!=null){d.setCallback(this);if(d.isStateful()){d.setState(this.getDrawableState());}d.setLevel(this.mLevel);d.setVisible(this.getVisibility()==ImageView.VISIBLE,true);this.mDrawableWidth=d.getIntrinsicWidth();this.mDrawableHeight=d.getIntrinsicHeight();this.applyColorMod();this.configureBounds();}else{this.mDrawableWidth=this.mDrawableHeight=-1;}}},{key:'resizeFromDrawable',value:function resizeFromDrawable(){var d=this.mDrawable;if(d!=null){var w=d.getIntrinsicWidth();if(w<0)w=this.mDrawableWidth;var h=d.getIntrinsicHeight();if(h<0)h=this.mDrawableHeight;if(w!=this.mDrawableWidth||h!=this.mDrawableHeight){this.mDrawableWidth=w;this.mDrawableHeight=h;if(this.mLayoutParams!=null&&this.mLayoutParams.width!=LayoutParams.WRAP_CONTENT&&this.mLayoutParams.width!=LayoutParams.MATCH_PARENT&&this.mLayoutParams.height!=LayoutParams.WRAP_CONTENT&&this.mLayoutParams.height!=LayoutParams.MATCH_PARENT){this.configureBounds();}else{this.requestLayout();}this.invalidate();return true;}}return false;}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){this.resolveUri();var w=void 0;var h=void 0;var desiredAspect=0.0;var resizeWidth=false;var resizeHeight=false;var widthSpecMode=View.MeasureSpec.getMode(widthMeasureSpec);var heightSpecMode=View.MeasureSpec.getMode(heightMeasureSpec);if(this.mDrawable==null){this.mDrawableWidth=-1;this.mDrawableHeight=-1;w=h=0;}else{w=this.mDrawableWidth;h=this.mDrawableHeight;if(w<=0)w=1;if(h<=0)h=1;if(this.mAdjustViewBounds){resizeWidth=widthSpecMode!=View.MeasureSpec.EXACTLY;resizeHeight=heightSpecMode!=View.MeasureSpec.EXACTLY;desiredAspect=w/h;}}var pleft=this.mPaddingLeft;var pright=this.mPaddingRight;var ptop=this.mPaddingTop;var pbottom=this.mPaddingBottom;var widthSize=void 0;var heightSize=void 0;if(resizeWidth||resizeHeight){widthSize=this.resolveAdjustedSize(w+pleft+pright,this.mMaxWidth,widthMeasureSpec);heightSize=this.resolveAdjustedSize(h+ptop+pbottom,this.mMaxHeight,heightMeasureSpec);if(desiredAspect!=0.0){var actualAspect=(widthSize-pleft-pright)/(heightSize-ptop-pbottom);if(Math.abs(actualAspect-desiredAspect)>0.0000001){var done=false;if(resizeWidth){var newWidth=Math.floor(desiredAspect*(heightSize-ptop-pbottom))+pleft+pright;if(!resizeHeight&&!this.mAdjustViewBoundsCompat){widthSize=this.resolveAdjustedSize(newWidth,this.mMaxWidth,widthMeasureSpec);}if(newWidth<=widthSize){widthSize=newWidth;done=true;}}if(!done&&resizeHeight){var newHeight=Math.floor((widthSize-pleft-pright)/desiredAspect)+ptop+pbottom;if(!resizeWidth&&!this.mAdjustViewBoundsCompat){heightSize=this.resolveAdjustedSize(newHeight,this.mMaxHeight,heightMeasureSpec);}if(newHeight<=heightSize){heightSize=newHeight;}}}}}else{w+=pleft+pright;h+=ptop+pbottom;w=Math.max(w,this.getSuggestedMinimumWidth());h=Math.max(h,this.getSuggestedMinimumHeight());widthSize=ImageView.resolveSizeAndState(w,widthMeasureSpec,0);heightSize=ImageView.resolveSizeAndState(h,heightMeasureSpec,0);}this.setMeasuredDimension(widthSize,heightSize);}},{key:'resolveAdjustedSize',value:function resolveAdjustedSize(desiredSize,maxSize,measureSpec){var result=desiredSize;var specMode=View.MeasureSpec.getMode(measureSpec);var specSize=View.MeasureSpec.getSize(measureSpec);switch(specMode){case View.MeasureSpec.UNSPECIFIED:result=Math.min(desiredSize,maxSize);break;case View.MeasureSpec.AT_MOST:result=Math.min(Math.min(desiredSize,specSize),maxSize);break;case View.MeasureSpec.EXACTLY:result=specSize;break;}return result;}},{key:'setFrame',value:function setFrame(l,t,r,b){var changed=_get2(ImageView.prototype.__proto__||Object.getPrototypeOf(ImageView.prototype),'setFrame',this).call(this,l,t,r,b);this.mHaveFrame=true;this.configureBounds();return changed;}},{key:'configureBounds',value:function configureBounds(){if(this.mDrawable==null||!this.mHaveFrame){return;}var dwidth=this.mDrawableWidth;var dheight=this.mDrawableHeight;var vwidth=this.getWidth()-this.mPaddingLeft-this.mPaddingRight;var vheight=this.getHeight()-this.mPaddingTop-this.mPaddingBottom;var fits=(dwidth<0||vwidth==dwidth)&&(dheight<0||vheight==dheight);if(dwidth<=0||dheight<=0||ImageView.ScaleType.FIT_XY==this.mScaleType){this.mDrawable.setBounds(0,0,vwidth,vheight);this.mDrawMatrix=null;}else{this.mDrawable.setBounds(0,0,dwidth,dheight);if(ImageView.ScaleType.MATRIX==this.mScaleType){if(this.mMatrix.isIdentity()){this.mDrawMatrix=null;}else{this.mDrawMatrix=this.mMatrix;}}else if(fits){this.mDrawMatrix=null;}else if(ImageView.ScaleType.CENTER==this.mScaleType){this.mDrawMatrix=this.mMatrix;this.mDrawMatrix.setTranslate(Math.floor((vwidth-dwidth)*0.5+0.5),Math.floor((vheight-dheight)*0.5+0.5));}else if(ImageView.ScaleType.CENTER_CROP==this.mScaleType){this.mDrawMatrix=this.mMatrix;var scale=void 0;var _dx5=0,_dy2=0;if(dwidth*vheight>vwidth*dheight){scale=vheight/dheight;_dx5=(vwidth-dwidth*scale)*0.5;}else{scale=vwidth/dwidth;_dy2=(vheight-dheight*scale)*0.5;}this.mDrawMatrix.setScale(scale,scale);this.mDrawMatrix.postTranslate(Math.floor(_dx5+0.5),Math.floor(_dy2+0.5));}else if(ImageView.ScaleType.CENTER_INSIDE==this.mScaleType){this.mDrawMatrix=this.mMatrix;var _scale2=void 0;var _dx6=void 0;var _dy3=void 0;if(dwidth<=vwidth&&dheight<=vheight){_scale2=1.0;}else{_scale2=Math.min(vwidth/dwidth,vheight/dheight);}_dx6=Math.floor((vwidth-dwidth*_scale2)*0.5+0.5);_dy3=Math.floor((vheight-dheight*_scale2)*0.5+0.5);this.mDrawMatrix.setScale(_scale2,_scale2);this.mDrawMatrix.postTranslate(_dx6,_dy3);}else{this.mTempSrc.set(0,0,dwidth,dheight);this.mTempDst.set(0,0,vwidth,vheight);this.mDrawMatrix=this.mMatrix;this.mDrawMatrix.setRectToRect(this.mTempSrc,this.mTempDst,ImageView.scaleTypeToScaleToFit(this.mScaleType));}}}},{key:'drawableStateChanged',value:function drawableStateChanged(){_get2(ImageView.prototype.__proto__||Object.getPrototypeOf(ImageView.prototype),'drawableStateChanged',this).call(this);var d=this.mDrawable;if(d!=null&&d.isStateful()){d.setState(this.getDrawableState());}}},{key:'onDraw',value:function onDraw(canvas){_get2(ImageView.prototype.__proto__||Object.getPrototypeOf(ImageView.prototype),'onDraw',this).call(this,canvas);if(this.mDrawable==null){return;}if(this.mDrawableWidth==0||this.mDrawableHeight==0){return;}if(this.mDrawMatrix==null&&this.mPaddingTop==0&&this.mPaddingLeft==0){this.mDrawable.draw(canvas);}else{var saveCount=canvas.getSaveCount();canvas.save();if(this.mCropToPadding){var scrollX=this.mScrollX;var scrollY=this.mScrollY;canvas.clipRect(scrollX+this.mPaddingLeft,scrollY+this.mPaddingTop,scrollX+this.mRight-this.mLeft-this.mPaddingRight,scrollY+this.mBottom-this.mTop-this.mPaddingBottom);}canvas.translate(this.mPaddingLeft,this.mPaddingTop);if(this.mDrawMatrix!=null){canvas.concat(this.mDrawMatrix);}this.mDrawable.draw(canvas);canvas.restoreToCount(saveCount);}}},{key:'getBaseline',value:function getBaseline(){if(this.mBaselineAlignBottom){return this.getMeasuredHeight();}else{return this.mBaseline;}}},{key:'setBaseline',value:function setBaseline(baseline){if(this.mBaseline!=baseline){this.mBaseline=baseline;this.requestLayout();}}},{key:'setBaselineAlignBottom',value:function setBaselineAlignBottom(aligned){if(this.mBaselineAlignBottom!=aligned){this.mBaselineAlignBottom=aligned;this.requestLayout();}}},{key:'getBaselineAlignBottom',value:function getBaselineAlignBottom(){return this.mBaselineAlignBottom;}},{key:'getImageAlpha',value:function getImageAlpha(){return this.mAlpha;}},{key:'setImageAlpha',value:function setImageAlpha(alpha){alpha&=0xFF;if(this.mAlpha!=alpha){this.mAlpha=alpha;this.mColorMod=true;this.applyColorMod();this.invalidate();}}},{key:'applyColorMod',value:function applyColorMod(){if(this.mDrawable!=null&&this.mColorMod){this.mDrawable=this.mDrawable.mutate();this.mDrawable.setAlpha(this.mAlpha*this.mViewAlphaScale>>8);}}},{key:'setVisibility',value:function setVisibility(visibility){_get2(ImageView.prototype.__proto__||Object.getPrototypeOf(ImageView.prototype),'setVisibility',this).call(this,visibility);if(this.mDrawable!=null){this.mDrawable.setVisible(visibility==ImageView.VISIBLE,false);}}},{key:'onAttachedToWindow',value:function onAttachedToWindow(){_get2(ImageView.prototype.__proto__||Object.getPrototypeOf(ImageView.prototype),'onAttachedToWindow',this).call(this);if(this.mDrawable!=null){this.mDrawable.setVisible(this.getVisibility()==ImageView.VISIBLE,false);}}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){_get2(ImageView.prototype.__proto__||Object.getPrototypeOf(ImageView.prototype),'onDetachedFromWindow',this).call(this);if(this.mDrawable!=null){this.mDrawable.setVisible(false,false);}}}],[{key:'scaleTypeToScaleToFit',value:function scaleTypeToScaleToFit(st){return ImageView.sS2FArray[st-1];}},{key:'parseScaleType',value:function parseScaleType(s,defaultType){if(s==null)return defaultType;s=s.toLowerCase();if(s==='matrix'.toLowerCase())return ImageView.ScaleType.MATRIX;if(s==='fitXY'.toLowerCase())return ImageView.ScaleType.FIT_XY;if(s==='fitStart'.toLowerCase())return ImageView.ScaleType.FIT_START;if(s==='fitCenter'.toLowerCase())return ImageView.ScaleType.FIT_CENTER;if(s==='fitEnd'.toLowerCase())return ImageView.ScaleType.FIT_END;if(s==='center'.toLowerCase())return ImageView.ScaleType.CENTER;if(s==='centerCrop'.toLowerCase())return ImageView.ScaleType.CENTER_CROP;if(s==='centerInside'.toLowerCase())return ImageView.ScaleType.CENTER_INSIDE;return defaultType;}}]);return ImageView;}(View);ImageView.sS2FArray=[Matrix.ScaleToFit.FILL,Matrix.ScaleToFit.START,Matrix.ScaleToFit.CENTER,Matrix.ScaleToFit.END];widget.ImageView=ImageView;(function(ImageView){var ScaleType;(function(ScaleType){ScaleType[ScaleType[\"MATRIX\"]=0]=\"MATRIX\";ScaleType[ScaleType[\"FIT_XY\"]=1]=\"FIT_XY\";ScaleType[ScaleType[\"FIT_START\"]=2]=\"FIT_START\";ScaleType[ScaleType[\"FIT_CENTER\"]=3]=\"FIT_CENTER\";ScaleType[ScaleType[\"FIT_END\"]=4]=\"FIT_END\";ScaleType[ScaleType[\"CENTER\"]=5]=\"CENTER\";ScaleType[ScaleType[\"CENTER_CROP\"]=6]=\"CENTER_CROP\";ScaleType[ScaleType[\"CENTER_INSIDE\"]=7]=\"CENTER_INSIDE\";})(ScaleType=ImageView.ScaleType||(ImageView.ScaleType={}));})(ImageView=widget.ImageView||(widget.ImageView={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var ImageButton=function(_widget$ImageView){_inherits(ImageButton,_widget$ImageView);function ImageButton(context,bindElement){var defStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.R.attr.imageButtonStyle;_classCallCheck(this,ImageButton);return _possibleConstructorReturn(this,(ImageButton.__proto__||Object.getPrototypeOf(ImageButton)).call(this,context,bindElement,defStyle));}return ImageButton;}(widget.ImageView);widget.ImageButton=ImageButton;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var Rect=android.graphics.Rect;var Trace=android.os.Trace;var Gravity=android.view.Gravity;var KeyEvent=android.view.KeyEvent;var SoundEffectConstants=android.view.SoundEffectConstants;var View=android.view.View;var ViewGroup=android.view.ViewGroup;var Integer=java.lang.Integer;var AbsListView=android.widget.AbsListView;var GridView=function(_AbsListView2){_inherits(GridView,_AbsListView2);function GridView(context,attrs){var defStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.R.attr.gridViewStyle;_classCallCheck(this,GridView);var _this127=_possibleConstructorReturn(this,(GridView.__proto__||Object.getPrototypeOf(GridView)).call(this,context,attrs,defStyle));_this127.mNumColumns=GridView.AUTO_FIT;_this127.mHorizontalSpacing=0;_this127.mRequestedHorizontalSpacing=0;_this127.mVerticalSpacing=0;_this127.mStretchMode=GridView.STRETCH_COLUMN_WIDTH;_this127.mColumnWidth=0;_this127.mRequestedColumnWidth=0;_this127.mRequestedNumColumns=0;_this127.mReferenceView=null;_this127.mReferenceViewInSelectedRow=null;_this127.mGravity=Gravity.LEFT;_this127.mTempRect=new Rect();var a=context.obtainStyledAttributes(attrs,defStyle);var hSpacing=a.getDimensionPixelOffset('horizontalSpacing',0);_this127.setHorizontalSpacing(hSpacing);var vSpacing=a.getDimensionPixelOffset('verticalSpacing',0);_this127.setVerticalSpacing(vSpacing);var stretchModeS=a.getAttrValue('stretchMode');if(stretchModeS){switch(stretchModeS){case\"none\":_this127.setStretchMode(GridView.NO_STRETCH);break;case\"spacingWidth\":_this127.setStretchMode(GridView.STRETCH_SPACING);break;case\"columnWidth\":_this127.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);break;case\"spacingWidthUniform\":_this127.setStretchMode(GridView.STRETCH_SPACING_UNIFORM);break;}}var columnWidth=a.getDimensionPixelOffset('columnWidth',-1);if(columnWidth>0){_this127.setColumnWidth(columnWidth);}var numColumns=a.getInt('numColumns',1);_this127.setNumColumns(numColumns);var gravityS=a.getAttrValue('gravity');if(gravityS){_this127.setGravity(Gravity.parseGravity(gravityS,_this127.mGravity));}a.recycle();return _this127;}_createClass(GridView,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(GridView.prototype.__proto__||Object.getPrototypeOf(GridView.prototype),'createClassAttrBinder',this).call(this).set('horizontalSpacing',{setter:function setter(v,value,attrBinder){v.setHorizontalSpacing(attrBinder.parseNumberPixelOffset(value,0));},getter:function getter(v){return v.getHorizontalSpacing();}}).set('verticalSpacing',{setter:function setter(v,value,attrBinder){v.setVerticalSpacing(attrBinder.parseNumberPixelOffset(value,0));},getter:function getter(v){return v.getVerticalSpacing();}}).set('stretchMode',{setter:function setter(v,value,attrBinder){v.setStretchMode(attrBinder.parseEnum(value,new Map().set(\"none\",GridView.NO_STRETCH).set(\"spacingWidth\",GridView.STRETCH_SPACING).set(\"columnWidth\",GridView.STRETCH_COLUMN_WIDTH).set(\"spacingWidthUniform\",GridView.STRETCH_SPACING_UNIFORM),GridView.STRETCH_COLUMN_WIDTH));},getter:function getter(v){return v.getStretchMode();}}).set('columnWidth',{setter:function setter(v,value,attrBinder){var columnWidth=attrBinder.parseNumberPixelOffset(value,-1);if(columnWidth>0){this.setColumnWidth(columnWidth);}},getter:function getter(v){return v.getColumnWidth();}}).set('numColumns',{setter:function setter(v,value,attrBinder){v.setNumColumns(attrBinder.parseInt(value,1));},getter:function getter(v){return v.getNumColumns();}}).set('gravity',{setter:function setter(v,value,attrBinder){v.setGravity(attrBinder.parseGravity(value,v.getGravity()));},getter:function getter(v){return v.getGravity();}});}},{key:'getAdapter',value:function getAdapter(){return this.mAdapter;}},{key:'setAdapter',value:function setAdapter(adapter){if(this.mAdapter!=null&&this.mDataSetObserver!=null){this.mAdapter.unregisterDataSetObserver(this.mDataSetObserver);}this.resetList();this.mRecycler.clear();this.mAdapter=adapter;this.mOldSelectedPosition=GridView.INVALID_POSITION;this.mOldSelectedRowId=GridView.INVALID_ROW_ID;_get2(GridView.prototype.__proto__||Object.getPrototypeOf(GridView.prototype),'setAdapter',this).call(this,adapter);if(this.mAdapter!=null){this.mOldItemCount=this.mItemCount;this.mItemCount=this.mAdapter.getCount();this.mDataChanged=true;this.checkFocus();this.mDataSetObserver=new AbsListView.AdapterDataSetObserver(this);this.mAdapter.registerDataSetObserver(this.mDataSetObserver);this.mRecycler.setViewTypeCount(this.mAdapter.getViewTypeCount());var position=void 0;if(this.mStackFromBottom){position=this.lookForSelectablePosition(this.mItemCount-1,false);}else{position=this.lookForSelectablePosition(0,true);}this.setSelectedPositionInt(position);this.setNextSelectedPositionInt(position);this.checkSelectionChanged();}else{this.checkFocus();this.checkSelectionChanged();}this.requestLayout();}},{key:'lookForSelectablePosition',value:function lookForSelectablePosition(position,lookDown){var adapter=this.mAdapter;if(adapter==null||this.isInTouchMode()){return GridView.INVALID_POSITION;}if(position<0||position>=this.mItemCount){return GridView.INVALID_POSITION;}return position;}},{key:'fillGap',value:function fillGap(down){var numColumns=this.mNumColumns;var verticalSpacing=this.mVerticalSpacing;var count=this.getChildCount();if(down){var paddingTop=0;if((this.mGroupFlags&GridView.CLIP_TO_PADDING_MASK)==GridView.CLIP_TO_PADDING_MASK){paddingTop=this.getListPaddingTop();}var startOffset=count>0?this.getChildAt(count-1).getBottom()+verticalSpacing:paddingTop;var position=this.mFirstPosition+count;if(this.mStackFromBottom){position+=numColumns-1;}this.fillDown(position,startOffset);this.correctTooHigh(numColumns,verticalSpacing,this.getChildCount());}else{var paddingBottom=0;if((this.mGroupFlags&GridView.CLIP_TO_PADDING_MASK)==GridView.CLIP_TO_PADDING_MASK){paddingBottom=this.getListPaddingBottom();}var _startOffset2=count>0?this.getChildAt(0).getTop()-verticalSpacing:this.getHeight()-paddingBottom;var _position5=this.mFirstPosition;if(!this.mStackFromBottom){_position5-=numColumns;}else{_position5--;}this.fillUp(_position5,_startOffset2);this.correctTooLow(numColumns,verticalSpacing,this.getChildCount());}}},{key:'fillDown',value:function fillDown(pos,nextTop){var selectedView=null;var end=this.mBottom-this.mTop;if((this.mGroupFlags&GridView.CLIP_TO_PADDING_MASK)==GridView.CLIP_TO_PADDING_MASK){end-=this.mListPadding.bottom;}while(nextTop<end&&pos<this.mItemCount){var temp=this.makeRow(pos,nextTop,true);if(temp!=null){selectedView=temp;}nextTop=this.mReferenceView.getBottom()+this.mVerticalSpacing;pos+=this.mNumColumns;}this.setVisibleRangeHint(this.mFirstPosition,this.mFirstPosition+this.getChildCount()-1);return selectedView;}},{key:'makeRow',value:function makeRow(startPos,y,flow){var columnWidth=this.mColumnWidth;var horizontalSpacing=this.mHorizontalSpacing;var isLayoutRtl=this.isLayoutRtl();var last=void 0;var nextLeft=void 0;if(isLayoutRtl){nextLeft=this.getWidth()-this.mListPadding.right-columnWidth-(this.mStretchMode==GridView.STRETCH_SPACING_UNIFORM?horizontalSpacing:0);}else{nextLeft=this.mListPadding.left+(this.mStretchMode==GridView.STRETCH_SPACING_UNIFORM?horizontalSpacing:0);}if(!this.mStackFromBottom){last=Math.min(startPos+this.mNumColumns,this.mItemCount);}else{last=startPos+1;startPos=Math.max(0,startPos-this.mNumColumns+1);if(last-startPos<this.mNumColumns){var deltaLeft=(this.mNumColumns-(last-startPos))*(columnWidth+horizontalSpacing);nextLeft+=(isLayoutRtl?-1:+1)*deltaLeft;}}var selectedView=null;var hasFocus=this.shouldShowSelector();var inClick=this.touchModeDrawsInPressedState();var selectedPosition=this.mSelectedPosition;var child=null;for(var pos=startPos;pos<last;pos++){var selected=pos==selectedPosition;var where=flow?-1:pos-startPos;child=this.makeAndAddView(pos,y,flow,nextLeft,selected,where);nextLeft+=(isLayoutRtl?-1:+1)*columnWidth;if(pos<last-1){nextLeft+=horizontalSpacing;}if(selected&&(hasFocus||inClick)){selectedView=child;}}this.mReferenceView=child;if(selectedView!=null){this.mReferenceViewInSelectedRow=this.mReferenceView;}return selectedView;}},{key:'fillUp',value:function fillUp(pos,nextBottom){var selectedView=null;var end=0;if((this.mGroupFlags&GridView.CLIP_TO_PADDING_MASK)==GridView.CLIP_TO_PADDING_MASK){end=this.mListPadding.top;}while(nextBottom>end&&pos>=0){var temp=this.makeRow(pos,nextBottom,false);if(temp!=null){selectedView=temp;}nextBottom=this.mReferenceView.getTop()-this.mVerticalSpacing;this.mFirstPosition=pos;pos-=this.mNumColumns;}if(this.mStackFromBottom){this.mFirstPosition=Math.max(0,pos+1);}this.setVisibleRangeHint(this.mFirstPosition,this.mFirstPosition+this.getChildCount()-1);return selectedView;}},{key:'fillFromTop',value:function fillFromTop(nextTop){this.mFirstPosition=Math.min(this.mFirstPosition,this.mSelectedPosition);this.mFirstPosition=Math.min(this.mFirstPosition,this.mItemCount-1);if(this.mFirstPosition<0){this.mFirstPosition=0;}this.mFirstPosition-=this.mFirstPosition%this.mNumColumns;return this.fillDown(this.mFirstPosition,nextTop);}},{key:'fillFromBottom',value:function fillFromBottom(lastPosition,nextBottom){lastPosition=Math.max(lastPosition,this.mSelectedPosition);lastPosition=Math.min(lastPosition,this.mItemCount-1);var invertedPosition=this.mItemCount-1-lastPosition;lastPosition=this.mItemCount-1-(invertedPosition-invertedPosition%this.mNumColumns);return this.fillUp(lastPosition,nextBottom);}},{key:'fillSelection',value:function fillSelection(childrenTop,childrenBottom){var selectedPosition=this.reconcileSelectedPosition();var numColumns=this.mNumColumns;var verticalSpacing=this.mVerticalSpacing;var rowStart=void 0;var rowEnd=-1;if(!this.mStackFromBottom){rowStart=selectedPosition-selectedPosition%numColumns;}else{var invertedSelection=this.mItemCount-1-selectedPosition;rowEnd=this.mItemCount-1-(invertedSelection-invertedSelection%numColumns);rowStart=Math.max(0,rowEnd-numColumns+1);}var fadingEdgeLength=this.getVerticalFadingEdgeLength();var topSelectionPixel=this.getTopSelectionPixel(childrenTop,fadingEdgeLength,rowStart);var sel=this.makeRow(this.mStackFromBottom?rowEnd:rowStart,topSelectionPixel,true);this.mFirstPosition=rowStart;var referenceView=this.mReferenceView;if(!this.mStackFromBottom){this.fillDown(rowStart+numColumns,referenceView.getBottom()+verticalSpacing);this.pinToBottom(childrenBottom);this.fillUp(rowStart-numColumns,referenceView.getTop()-verticalSpacing);this.adjustViewsUpOrDown();}else{var bottomSelectionPixel=this.getBottomSelectionPixel(childrenBottom,fadingEdgeLength,numColumns,rowStart);var offset=bottomSelectionPixel-referenceView.getBottom();this.offsetChildrenTopAndBottom(offset);this.fillUp(rowStart-1,referenceView.getTop()-verticalSpacing);this.pinToTop(childrenTop);this.fillDown(rowEnd+numColumns,referenceView.getBottom()+verticalSpacing);this.adjustViewsUpOrDown();}return sel;}},{key:'pinToTop',value:function pinToTop(childrenTop){if(this.mFirstPosition==0){var top=this.getChildAt(0).getTop();var offset=childrenTop-top;if(offset<0){this.offsetChildrenTopAndBottom(offset);}}}},{key:'pinToBottom',value:function pinToBottom(childrenBottom){var count=this.getChildCount();if(this.mFirstPosition+count==this.mItemCount){var bottom=this.getChildAt(count-1).getBottom();var offset=childrenBottom-bottom;if(offset>0){this.offsetChildrenTopAndBottom(offset);}}}},{key:'findMotionRow',value:function findMotionRow(y){var childCount=this.getChildCount();if(childCount>0){var numColumns=this.mNumColumns;if(!this.mStackFromBottom){for(var i=0;i<childCount;i+=numColumns){if(y<=this.getChildAt(i).getBottom()){return this.mFirstPosition+i;}}}else{for(var _i56=childCount-1;_i56>=0;_i56-=numColumns){if(y>=this.getChildAt(_i56).getTop()){return this.mFirstPosition+_i56;}}}}return GridView.INVALID_POSITION;}},{key:'fillSpecific',value:function fillSpecific(position,top){var numColumns=this.mNumColumns;var motionRowStart=void 0;var motionRowEnd=-1;if(!this.mStackFromBottom){motionRowStart=position-position%numColumns;}else{var invertedSelection=this.mItemCount-1-position;motionRowEnd=this.mItemCount-1-(invertedSelection-invertedSelection%numColumns);motionRowStart=Math.max(0,motionRowEnd-numColumns+1);}var temp=this.makeRow(this.mStackFromBottom?motionRowEnd:motionRowStart,top,true);this.mFirstPosition=motionRowStart;var referenceView=this.mReferenceView;if(referenceView==null){return null;}var verticalSpacing=this.mVerticalSpacing;var above=void 0;var below=void 0;if(!this.mStackFromBottom){above=this.fillUp(motionRowStart-numColumns,referenceView.getTop()-verticalSpacing);this.adjustViewsUpOrDown();below=this.fillDown(motionRowStart+numColumns,referenceView.getBottom()+verticalSpacing);var childCount=this.getChildCount();if(childCount>0){this.correctTooHigh(numColumns,verticalSpacing,childCount);}}else{below=this.fillDown(motionRowEnd+numColumns,referenceView.getBottom()+verticalSpacing);this.adjustViewsUpOrDown();above=this.fillUp(motionRowStart-1,referenceView.getTop()-verticalSpacing);var _childCount3=this.getChildCount();if(_childCount3>0){this.correctTooLow(numColumns,verticalSpacing,_childCount3);}}if(temp!=null){return temp;}else if(above!=null){return above;}else{return below;}}},{key:'correctTooHigh',value:function correctTooHigh(numColumns,verticalSpacing,childCount){var lastPosition=this.mFirstPosition+childCount-1;if(lastPosition==this.mItemCount-1&&childCount>0){var lastChild=this.getChildAt(childCount-1);var lastBottom=lastChild.getBottom();var end=this.mBottom-this.mTop-this.mListPadding.bottom;var bottomOffset=end-lastBottom;var firstChild=this.getChildAt(0);var firstTop=firstChild.getTop();if(bottomOffset>0&&(this.mFirstPosition>0||firstTop<this.mListPadding.top)){if(this.mFirstPosition==0){bottomOffset=Math.min(bottomOffset,this.mListPadding.top-firstTop);}this.offsetChildrenTopAndBottom(bottomOffset);if(this.mFirstPosition>0){this.fillUp(this.mFirstPosition-(this.mStackFromBottom?1:numColumns),firstChild.getTop()-verticalSpacing);this.adjustViewsUpOrDown();}}}}},{key:'correctTooLow',value:function correctTooLow(numColumns,verticalSpacing,childCount){if(this.mFirstPosition==0&&childCount>0){var firstChild=this.getChildAt(0);var firstTop=firstChild.getTop();var start=this.mListPadding.top;var end=this.mBottom-this.mTop-this.mListPadding.bottom;var topOffset=firstTop-start;var lastChild=this.getChildAt(childCount-1);var lastBottom=lastChild.getBottom();var lastPosition=this.mFirstPosition+childCount-1;if(topOffset>0&&(lastPosition<this.mItemCount-1||lastBottom>end)){if(lastPosition==this.mItemCount-1){topOffset=Math.min(topOffset,lastBottom-end);}this.offsetChildrenTopAndBottom(-topOffset);if(lastPosition<this.mItemCount-1){this.fillDown(lastPosition+(!this.mStackFromBottom?1:numColumns),lastChild.getBottom()+verticalSpacing);this.adjustViewsUpOrDown();}}}}},{key:'fillFromSelection',value:function fillFromSelection(selectedTop,childrenTop,childrenBottom){var fadingEdgeLength=this.getVerticalFadingEdgeLength();var selectedPosition=this.mSelectedPosition;var numColumns=this.mNumColumns;var verticalSpacing=this.mVerticalSpacing;var rowStart=void 0;var rowEnd=-1;if(!this.mStackFromBottom){rowStart=selectedPosition-selectedPosition%numColumns;}else{var invertedSelection=this.mItemCount-1-selectedPosition;rowEnd=this.mItemCount-1-(invertedSelection-invertedSelection%numColumns);rowStart=Math.max(0,rowEnd-numColumns+1);}var sel=void 0;var referenceView=void 0;var topSelectionPixel=this.getTopSelectionPixel(childrenTop,fadingEdgeLength,rowStart);var bottomSelectionPixel=this.getBottomSelectionPixel(childrenBottom,fadingEdgeLength,numColumns,rowStart);sel=this.makeRow(this.mStackFromBottom?rowEnd:rowStart,selectedTop,true);this.mFirstPosition=rowStart;referenceView=this.mReferenceView;this.adjustForTopFadingEdge(referenceView,topSelectionPixel,bottomSelectionPixel);this.adjustForBottomFadingEdge(referenceView,topSelectionPixel,bottomSelectionPixel);if(!this.mStackFromBottom){this.fillUp(rowStart-numColumns,referenceView.getTop()-verticalSpacing);this.adjustViewsUpOrDown();this.fillDown(rowStart+numColumns,referenceView.getBottom()+verticalSpacing);}else{this.fillDown(rowEnd+numColumns,referenceView.getBottom()+verticalSpacing);this.adjustViewsUpOrDown();this.fillUp(rowStart-1,referenceView.getTop()-verticalSpacing);}return sel;}},{key:'getBottomSelectionPixel',value:function getBottomSelectionPixel(childrenBottom,fadingEdgeLength,numColumns,rowStart){var bottomSelectionPixel=childrenBottom;if(rowStart+numColumns-1<this.mItemCount-1){bottomSelectionPixel-=fadingEdgeLength;}return bottomSelectionPixel;}},{key:'getTopSelectionPixel',value:function getTopSelectionPixel(childrenTop,fadingEdgeLength,rowStart){var topSelectionPixel=childrenTop;if(rowStart>0){topSelectionPixel+=fadingEdgeLength;}return topSelectionPixel;}},{key:'adjustForBottomFadingEdge',value:function adjustForBottomFadingEdge(childInSelectedRow,topSelectionPixel,bottomSelectionPixel){if(childInSelectedRow.getBottom()>bottomSelectionPixel){var spaceAbove=childInSelectedRow.getTop()-topSelectionPixel;var spaceBelow=childInSelectedRow.getBottom()-bottomSelectionPixel;var offset=Math.min(spaceAbove,spaceBelow);this.offsetChildrenTopAndBottom(-offset);}}},{key:'adjustForTopFadingEdge',value:function adjustForTopFadingEdge(childInSelectedRow,topSelectionPixel,bottomSelectionPixel){if(childInSelectedRow.getTop()<topSelectionPixel){var spaceAbove=topSelectionPixel-childInSelectedRow.getTop();var spaceBelow=bottomSelectionPixel-childInSelectedRow.getBottom();var offset=Math.min(spaceAbove,spaceBelow);this.offsetChildrenTopAndBottom(offset);}}},{key:'smoothScrollToPosition',value:function smoothScrollToPosition(position){_get2(GridView.prototype.__proto__||Object.getPrototypeOf(GridView.prototype),'smoothScrollToPosition',this).call(this,position);}},{key:'smoothScrollByOffset',value:function smoothScrollByOffset(offset){_get2(GridView.prototype.__proto__||Object.getPrototypeOf(GridView.prototype),'smoothScrollByOffset',this).call(this,offset);}},{key:'moveSelection',value:function moveSelection(delta,childrenTop,childrenBottom){var fadingEdgeLength=this.getVerticalFadingEdgeLength();var selectedPosition=this.mSelectedPosition;var numColumns=this.mNumColumns;var verticalSpacing=this.mVerticalSpacing;var oldRowStart=void 0;var rowStart=void 0;var rowEnd=-1;if(!this.mStackFromBottom){oldRowStart=selectedPosition-delta-(selectedPosition-delta)%numColumns;rowStart=selectedPosition-selectedPosition%numColumns;}else{var invertedSelection=this.mItemCount-1-selectedPosition;rowEnd=this.mItemCount-1-(invertedSelection-invertedSelection%numColumns);rowStart=Math.max(0,rowEnd-numColumns+1);invertedSelection=this.mItemCount-1-(selectedPosition-delta);oldRowStart=this.mItemCount-1-(invertedSelection-invertedSelection%numColumns);oldRowStart=Math.max(0,oldRowStart-numColumns+1);}var rowDelta=rowStart-oldRowStart;var topSelectionPixel=this.getTopSelectionPixel(childrenTop,fadingEdgeLength,rowStart);var bottomSelectionPixel=this.getBottomSelectionPixel(childrenBottom,fadingEdgeLength,numColumns,rowStart);this.mFirstPosition=rowStart;var sel=void 0;var referenceView=void 0;if(rowDelta>0){var oldBottom=this.mReferenceViewInSelectedRow==null?0:this.mReferenceViewInSelectedRow.getBottom();sel=this.makeRow(this.mStackFromBottom?rowEnd:rowStart,oldBottom+verticalSpacing,true);referenceView=this.mReferenceView;this.adjustForBottomFadingEdge(referenceView,topSelectionPixel,bottomSelectionPixel);}else if(rowDelta<0){var oldTop=this.mReferenceViewInSelectedRow==null?0:this.mReferenceViewInSelectedRow.getTop();sel=this.makeRow(this.mStackFromBottom?rowEnd:rowStart,oldTop-verticalSpacing,false);referenceView=this.mReferenceView;this.adjustForTopFadingEdge(referenceView,topSelectionPixel,bottomSelectionPixel);}else{var _oldTop=this.mReferenceViewInSelectedRow==null?0:this.mReferenceViewInSelectedRow.getTop();sel=this.makeRow(this.mStackFromBottom?rowEnd:rowStart,_oldTop,true);referenceView=this.mReferenceView;}if(!this.mStackFromBottom){this.fillUp(rowStart-numColumns,referenceView.getTop()-verticalSpacing);this.adjustViewsUpOrDown();this.fillDown(rowStart+numColumns,referenceView.getBottom()+verticalSpacing);}else{this.fillDown(rowEnd+numColumns,referenceView.getBottom()+verticalSpacing);this.adjustViewsUpOrDown();this.fillUp(rowStart-1,referenceView.getTop()-verticalSpacing);}return sel;}},{key:'determineColumns',value:function determineColumns(availableSpace){var requestedHorizontalSpacing=this.mRequestedHorizontalSpacing;var stretchMode=this.mStretchMode;var requestedColumnWidth=this.mRequestedColumnWidth;var didNotInitiallyFit=false;if(this.mRequestedNumColumns==GridView.AUTO_FIT){if(requestedColumnWidth>0){this.mNumColumns=(availableSpace+requestedHorizontalSpacing)/(requestedColumnWidth+requestedHorizontalSpacing);}else{this.mNumColumns=2;}}else{this.mNumColumns=this.mRequestedNumColumns;}if(this.mNumColumns<=0){this.mNumColumns=1;}switch(stretchMode){case GridView.NO_STRETCH:this.mColumnWidth=requestedColumnWidth;this.mHorizontalSpacing=requestedHorizontalSpacing;break;default:var spaceLeftOver=availableSpace-this.mNumColumns*requestedColumnWidth-(this.mNumColumns-1)*requestedHorizontalSpacing;if(spaceLeftOver<0){didNotInitiallyFit=true;}switch(stretchMode){case GridView.STRETCH_COLUMN_WIDTH:this.mColumnWidth=requestedColumnWidth+spaceLeftOver/this.mNumColumns;this.mHorizontalSpacing=requestedHorizontalSpacing;break;case GridView.STRETCH_SPACING:this.mColumnWidth=requestedColumnWidth;if(this.mNumColumns>1){this.mHorizontalSpacing=requestedHorizontalSpacing+spaceLeftOver/(this.mNumColumns-1);}else{this.mHorizontalSpacing=requestedHorizontalSpacing+spaceLeftOver;}break;case GridView.STRETCH_SPACING_UNIFORM:this.mColumnWidth=requestedColumnWidth;if(this.mNumColumns>1){this.mHorizontalSpacing=requestedHorizontalSpacing+spaceLeftOver/(this.mNumColumns+1);}else{this.mHorizontalSpacing=requestedHorizontalSpacing+spaceLeftOver;}break;}break;}return didNotInitiallyFit;}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){_get2(GridView.prototype.__proto__||Object.getPrototypeOf(GridView.prototype),'onMeasure',this).call(this,widthMeasureSpec,heightMeasureSpec);var widthMode=View.MeasureSpec.getMode(widthMeasureSpec);var heightMode=View.MeasureSpec.getMode(heightMeasureSpec);var widthSize=View.MeasureSpec.getSize(widthMeasureSpec);var heightSize=View.MeasureSpec.getSize(heightMeasureSpec);if(widthMode==View.MeasureSpec.UNSPECIFIED){if(this.mColumnWidth>0){widthSize=this.mColumnWidth+this.mListPadding.left+this.mListPadding.right;}else{widthSize=this.mListPadding.left+this.mListPadding.right;}widthSize+=this.getVerticalScrollbarWidth();}var childWidth=widthSize-this.mListPadding.left-this.mListPadding.right;var didNotInitiallyFit=this.determineColumns(childWidth);var childHeight=0;var childState=0;this.mItemCount=this.mAdapter==null?0:this.mAdapter.getCount();var count=this.mItemCount;if(count>0){var child=this.obtainView(0,this.mIsScrap);var p=child.getLayoutParams();if(p==null){p=this.generateDefaultLayoutParams();child.setLayoutParams(p);}p.viewType=this.mAdapter.getItemViewType(0);p.forceAdd=true;var childHeightSpec=GridView.getChildMeasureSpec(View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED),0,p.height);var childWidthSpec=GridView.getChildMeasureSpec(View.MeasureSpec.makeMeasureSpec(this.mColumnWidth,View.MeasureSpec.EXACTLY),0,p.width);child.measure(childWidthSpec,childHeightSpec);childHeight=child.getMeasuredHeight();childState=GridView.combineMeasuredStates(childState,child.getMeasuredState());if(this.mRecycler.shouldRecycleViewType(p.viewType)){this.mRecycler.addScrapView(child,-1);}}if(heightMode==View.MeasureSpec.UNSPECIFIED){heightSize=this.mListPadding.top+this.mListPadding.bottom+childHeight+this.getVerticalFadingEdgeLength()*2;}if(heightMode==View.MeasureSpec.AT_MOST){var ourSize=this.mListPadding.top+this.mListPadding.bottom;var numColumns=this.mNumColumns;for(var i=0;i<count;i+=numColumns){ourSize+=childHeight;if(i+numColumns<count){ourSize+=this.mVerticalSpacing;}if(ourSize>=heightSize){ourSize=heightSize;break;}}heightSize=ourSize;}if(widthMode==View.MeasureSpec.AT_MOST&&this.mRequestedNumColumns!=GridView.AUTO_FIT){var _ourSize=this.mRequestedNumColumns*this.mColumnWidth+(this.mRequestedNumColumns-1)*this.mHorizontalSpacing+this.mListPadding.left+this.mListPadding.right;if(_ourSize>widthSize||didNotInitiallyFit){widthSize|=GridView.MEASURED_STATE_TOO_SMALL;}}this.setMeasuredDimension(widthSize,heightSize);this.mWidthMeasureSpec=widthMeasureSpec;}},{key:'layoutChildren',value:function layoutChildren(){var blockLayoutRequests=this.mBlockLayoutRequests;if(!blockLayoutRequests){this.mBlockLayoutRequests=true;}try{_get2(GridView.prototype.__proto__||Object.getPrototypeOf(GridView.prototype),'layoutChildren',this).call(this);this.invalidate();if(this.mAdapter==null){this.resetList();this.invokeOnItemScrollListener();return;}var childrenTop=this.mListPadding.top;var childrenBottom=this.mBottom-this.mTop-this.mListPadding.bottom;var childCount=this.getChildCount();var index=void 0;var delta=0;var sel=void 0;var oldSel=null;var oldFirst=null;var newSel=null;switch(this.mLayoutMode){case GridView.LAYOUT_SET_SELECTION:index=this.mNextSelectedPosition-this.mFirstPosition;if(index>=0&&index<childCount){newSel=this.getChildAt(index);}break;case GridView.LAYOUT_FORCE_TOP:case GridView.LAYOUT_FORCE_BOTTOM:case GridView.LAYOUT_SPECIFIC:case GridView.LAYOUT_SYNC:break;case GridView.LAYOUT_MOVE_SELECTION:if(this.mNextSelectedPosition>=0){delta=this.mNextSelectedPosition-this.mSelectedPosition;}break;default:index=this.mSelectedPosition-this.mFirstPosition;if(index>=0&&index<childCount){oldSel=this.getChildAt(index);}oldFirst=this.getChildAt(0);}var dataChanged=this.mDataChanged;if(dataChanged){this.handleDataChanged();}if(this.mItemCount==0){this.resetList();this.invokeOnItemScrollListener();return;}this.setSelectedPositionInt(this.mNextSelectedPosition);var firstPosition=this.mFirstPosition;var recycleBin=this.mRecycler;if(dataChanged){for(var i=0;i<childCount;i++){recycleBin.addScrapView(this.getChildAt(i),firstPosition+i);}}else{recycleBin.fillActiveViews(childCount,firstPosition);}this.detachAllViewsFromParent();recycleBin.removeSkippedScrap();switch(this.mLayoutMode){case GridView.LAYOUT_SET_SELECTION:if(newSel!=null){sel=this.fillFromSelection(newSel.getTop(),childrenTop,childrenBottom);}else{sel=this.fillSelection(childrenTop,childrenBottom);}break;case GridView.LAYOUT_FORCE_TOP:this.mFirstPosition=0;sel=this.fillFromTop(childrenTop);this.adjustViewsUpOrDown();break;case GridView.LAYOUT_FORCE_BOTTOM:sel=this.fillUp(this.mItemCount-1,childrenBottom);this.adjustViewsUpOrDown();break;case GridView.LAYOUT_SPECIFIC:sel=this.fillSpecific(this.mSelectedPosition,this.mSpecificTop);break;case GridView.LAYOUT_SYNC:sel=this.fillSpecific(this.mSyncPosition,this.mSpecificTop);break;case GridView.LAYOUT_MOVE_SELECTION:sel=this.moveSelection(delta,childrenTop,childrenBottom);break;default:if(childCount==0){if(!this.mStackFromBottom){this.setSelectedPositionInt(this.mAdapter==null||this.isInTouchMode()?GridView.INVALID_POSITION:0);sel=this.fillFromTop(childrenTop);}else{var last=this.mItemCount-1;this.setSelectedPositionInt(this.mAdapter==null||this.isInTouchMode()?GridView.INVALID_POSITION:last);sel=this.fillFromBottom(last,childrenBottom);}}else{if(this.mSelectedPosition>=0&&this.mSelectedPosition<this.mItemCount){sel=this.fillSpecific(this.mSelectedPosition,oldSel==null?childrenTop:oldSel.getTop());}else if(this.mFirstPosition<this.mItemCount){sel=this.fillSpecific(this.mFirstPosition,oldFirst==null?childrenTop:oldFirst.getTop());}else{sel=this.fillSpecific(0,childrenTop);}}break;}recycleBin.scrapActiveViews();if(sel!=null){this.positionSelector(GridView.INVALID_POSITION,sel);this.mSelectedTop=sel.getTop();}else if(this.mTouchMode>GridView.TOUCH_MODE_DOWN&&this.mTouchMode<GridView.TOUCH_MODE_SCROLL){var child=this.getChildAt(this.mMotionPosition-this.mFirstPosition);if(child!=null)this.positionSelector(this.mMotionPosition,child);}else{this.mSelectedTop=0;this.mSelectorRect.setEmpty();}this.mLayoutMode=GridView.LAYOUT_NORMAL;this.mDataChanged=false;if(this.mPositionScrollAfterLayout!=null){this.post(this.mPositionScrollAfterLayout);this.mPositionScrollAfterLayout=null;}this.mNeedSync=false;this.setNextSelectedPositionInt(this.mSelectedPosition);this.updateScrollIndicators();if(this.mItemCount>0){this.checkSelectionChanged();}this.invokeOnItemScrollListener();}finally{if(!blockLayoutRequests){this.mBlockLayoutRequests=false;}}}},{key:'makeAndAddView',value:function makeAndAddView(position,y,flow,childrenLeft,selected,where){var child=void 0;if(!this.mDataChanged){child=this.mRecycler.getActiveView(position);if(child!=null){this.setupChild(child,position,y,flow,childrenLeft,selected,true,where);return child;}}child=this.obtainView(position,this.mIsScrap);this.setupChild(child,position,y,flow,childrenLeft,selected,this.mIsScrap[0],where);return child;}},{key:'setupChild',value:function setupChild(child,position,y,flow,childrenLeft,selected,recycled,where){Trace.traceBegin(Trace.TRACE_TAG_VIEW,\"setupGridItem\");var isSelected=selected&&this.shouldShowSelector();var updateChildSelected=isSelected!=child.isSelected();var mode=this.mTouchMode;var isPressed=mode>GridView.TOUCH_MODE_DOWN&&mode<GridView.TOUCH_MODE_SCROLL&&this.mMotionPosition==position;var updateChildPressed=isPressed!=child.isPressed();var needToMeasure=!recycled||updateChildSelected||child.isLayoutRequested();var p=child.getLayoutParams();if(p==null){p=this.generateDefaultLayoutParams();}p.viewType=this.mAdapter.getItemViewType(position);if(recycled&&!p.forceAdd){this.attachViewToParent(child,where,p);}else{p.forceAdd=false;this.addViewInLayout(child,where,p,true);}if(updateChildSelected){child.setSelected(isSelected);if(isSelected){this.requestFocus();}}if(updateChildPressed){child.setPressed(isPressed);}if(this.mChoiceMode!=GridView.CHOICE_MODE_NONE&&this.mCheckStates!=null){if(child['setChecked']){child.setChecked(this.mCheckStates.get(position));}else{child.setActivated(this.mCheckStates.get(position));}}if(needToMeasure){var childHeightSpec=ViewGroup.getChildMeasureSpec(View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED),0,p.height);var childWidthSpec=ViewGroup.getChildMeasureSpec(View.MeasureSpec.makeMeasureSpec(this.mColumnWidth,View.MeasureSpec.EXACTLY),0,p.width);child.measure(childWidthSpec,childHeightSpec);}else{this.cleanupLayoutState(child);}var w=child.getMeasuredWidth();var h=child.getMeasuredHeight();var childLeft=void 0;var childTop=flow?y:y-h;var absoluteGravity=this.mGravity;switch(absoluteGravity&Gravity.HORIZONTAL_GRAVITY_MASK){case Gravity.LEFT:childLeft=childrenLeft;break;case Gravity.CENTER_HORIZONTAL:childLeft=childrenLeft+(this.mColumnWidth-w)/2;break;case Gravity.RIGHT:childLeft=childrenLeft+this.mColumnWidth-w;break;default:childLeft=childrenLeft;break;}if(needToMeasure){var childRight=childLeft+w;var childBottom=childTop+h;child.layout(childLeft,childTop,childRight,childBottom);}else{child.offsetLeftAndRight(childLeft-child.getLeft());child.offsetTopAndBottom(childTop-child.getTop());}if(this.mCachingStarted){child.setDrawingCacheEnabled(true);}if(recycled&&child.getLayoutParams().scrappedFromPosition!=position){child.jumpDrawablesToCurrentState();}Trace.traceEnd(Trace.TRACE_TAG_VIEW);}},{key:'setSelection',value:function setSelection(position){if(!this.isInTouchMode()){this.setNextSelectedPositionInt(position);}else{this.mResurrectToPosition=position;}this.mLayoutMode=GridView.LAYOUT_SET_SELECTION;if(this.mPositionScroller!=null){this.mPositionScroller.stop();}this.requestLayout();}},{key:'setSelectionInt',value:function setSelectionInt(position){var previousSelectedPosition=this.mNextSelectedPosition;if(this.mPositionScroller!=null){this.mPositionScroller.stop();}this.setNextSelectedPositionInt(position);this.layoutChildren();var next=this.mStackFromBottom?this.mItemCount-1-this.mNextSelectedPosition:this.mNextSelectedPosition;var previous=this.mStackFromBottom?this.mItemCount-1-previousSelectedPosition:previousSelectedPosition;var nextRow=next/this.mNumColumns;var previousRow=previous/this.mNumColumns;if(nextRow!=previousRow){this.awakenScrollBars();}}},{key:'onKeyDown',value:function onKeyDown(keyCode,event){return this.commonKey(keyCode,1,event);}},{key:'onKeyMultiple',value:function onKeyMultiple(keyCode,repeatCount,event){return this.commonKey(keyCode,repeatCount,event);}},{key:'onKeyUp',value:function onKeyUp(keyCode,event){return this.commonKey(keyCode,1,event);}},{key:'commonKey',value:function commonKey(keyCode,count,event){if(this.mAdapter==null){return false;}if(this.mDataChanged){this.layoutChildren();}var handled=false;var action=event.getAction();if(action!=KeyEvent.ACTION_UP){switch(keyCode){case KeyEvent.KEYCODE_DPAD_LEFT:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded()||this.arrowScroll(GridView.FOCUS_LEFT);}break;case KeyEvent.KEYCODE_DPAD_RIGHT:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded()||this.arrowScroll(GridView.FOCUS_RIGHT);}break;case KeyEvent.KEYCODE_DPAD_UP:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded()||this.arrowScroll(GridView.FOCUS_UP);}else if(event.hasModifiers(KeyEvent.META_ALT_ON)){handled=this.resurrectSelectionIfNeeded()||this.fullScroll(GridView.FOCUS_UP);}break;case KeyEvent.KEYCODE_DPAD_DOWN:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded()||this.arrowScroll(GridView.FOCUS_DOWN);}else if(event.hasModifiers(KeyEvent.META_ALT_ON)){handled=this.resurrectSelectionIfNeeded()||this.fullScroll(GridView.FOCUS_DOWN);}break;case KeyEvent.KEYCODE_DPAD_CENTER:case KeyEvent.KEYCODE_ENTER:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded();if(!handled&&event.getRepeatCount()==0&&this.getChildCount()>0){this.keyPressed();handled=true;}}break;case KeyEvent.KEYCODE_SPACE:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded()||this.pageScroll(GridView.FOCUS_DOWN);}else if(event.hasModifiers(KeyEvent.META_SHIFT_ON)){handled=this.resurrectSelectionIfNeeded()||this.pageScroll(GridView.FOCUS_UP);}break;case KeyEvent.KEYCODE_PAGE_UP:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded()||this.pageScroll(GridView.FOCUS_UP);}else if(event.hasModifiers(KeyEvent.META_ALT_ON)){handled=this.resurrectSelectionIfNeeded()||this.fullScroll(GridView.FOCUS_UP);}break;case KeyEvent.KEYCODE_PAGE_DOWN:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded()||this.pageScroll(GridView.FOCUS_DOWN);}else if(event.hasModifiers(KeyEvent.META_ALT_ON)){handled=this.resurrectSelectionIfNeeded()||this.fullScroll(GridView.FOCUS_DOWN);}break;case KeyEvent.KEYCODE_MOVE_HOME:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded()||this.fullScroll(GridView.FOCUS_UP);}break;case KeyEvent.KEYCODE_MOVE_END:if(event.hasNoModifiers()){handled=this.resurrectSelectionIfNeeded()||this.fullScroll(GridView.FOCUS_DOWN);}break;case KeyEvent.KEYCODE_TAB:break;}}if(handled){return true;}switch(action){case KeyEvent.ACTION_DOWN:return _get2(GridView.prototype.__proto__||Object.getPrototypeOf(GridView.prototype),'onKeyDown',this).call(this,keyCode,event);case KeyEvent.ACTION_UP:return _get2(GridView.prototype.__proto__||Object.getPrototypeOf(GridView.prototype),'onKeyUp',this).call(this,keyCode,event);default:return false;}}},{key:'pageScroll',value:function pageScroll(direction){var nextPage=-1;if(direction==GridView.FOCUS_UP){nextPage=Math.max(0,this.mSelectedPosition-this.getChildCount());}else if(direction==GridView.FOCUS_DOWN){nextPage=Math.min(this.mItemCount-1,this.mSelectedPosition+this.getChildCount());}if(nextPage>=0){this.setSelectionInt(nextPage);this.invokeOnItemScrollListener();this.awakenScrollBars();return true;}return false;}},{key:'fullScroll',value:function fullScroll(direction){var moved=false;if(direction==GridView.FOCUS_UP){this.mLayoutMode=GridView.LAYOUT_SET_SELECTION;this.setSelectionInt(0);this.invokeOnItemScrollListener();moved=true;}else if(direction==GridView.FOCUS_DOWN){this.mLayoutMode=GridView.LAYOUT_SET_SELECTION;this.setSelectionInt(this.mItemCount-1);this.invokeOnItemScrollListener();moved=true;}if(moved){this.awakenScrollBars();}return moved;}},{key:'arrowScroll',value:function arrowScroll(direction){var selectedPosition=this.mSelectedPosition;var numColumns=this.mNumColumns;var startOfRowPos=void 0;var endOfRowPos=void 0;var moved=false;if(!this.mStackFromBottom){startOfRowPos=Math.floor(selectedPosition/numColumns)*numColumns;endOfRowPos=Math.min(startOfRowPos+numColumns-1,this.mItemCount-1);}else{var invertedSelection=this.mItemCount-1-selectedPosition;endOfRowPos=this.mItemCount-1-invertedSelection/numColumns*numColumns;startOfRowPos=Math.max(0,endOfRowPos-numColumns+1);}switch(direction){case GridView.FOCUS_UP:if(startOfRowPos>0){this.mLayoutMode=GridView.LAYOUT_MOVE_SELECTION;this.setSelectionInt(Math.max(0,selectedPosition-numColumns));moved=true;}break;case GridView.FOCUS_DOWN:if(endOfRowPos<this.mItemCount-1){this.mLayoutMode=GridView.LAYOUT_MOVE_SELECTION;this.setSelectionInt(Math.min(selectedPosition+numColumns,this.mItemCount-1));moved=true;}break;case GridView.FOCUS_LEFT:if(selectedPosition>startOfRowPos){this.mLayoutMode=GridView.LAYOUT_MOVE_SELECTION;this.setSelectionInt(Math.max(0,selectedPosition-1));moved=true;}break;case GridView.FOCUS_RIGHT:if(selectedPosition<endOfRowPos){this.mLayoutMode=GridView.LAYOUT_MOVE_SELECTION;this.setSelectionInt(Math.min(selectedPosition+1,this.mItemCount-1));moved=true;}break;}if(moved){this.playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));this.invokeOnItemScrollListener();}if(moved){this.awakenScrollBars();}return moved;}},{key:'sequenceScroll',value:function sequenceScroll(direction){var selectedPosition=this.mSelectedPosition;var numColumns=this.mNumColumns;var count=this.mItemCount;var startOfRow=void 0;var endOfRow=void 0;if(!this.mStackFromBottom){startOfRow=selectedPosition/numColumns*numColumns;endOfRow=Math.min(startOfRow+numColumns-1,count-1);}else{var invertedSelection=count-1-selectedPosition;endOfRow=count-1-invertedSelection/numColumns*numColumns;startOfRow=Math.max(0,endOfRow-numColumns+1);}var moved=false;var showScroll=false;switch(direction){case GridView.FOCUS_FORWARD:if(selectedPosition<count-1){this.mLayoutMode=GridView.LAYOUT_MOVE_SELECTION;this.setSelectionInt(selectedPosition+1);moved=true;showScroll=selectedPosition==endOfRow;}break;case GridView.FOCUS_BACKWARD:if(selectedPosition>0){this.mLayoutMode=GridView.LAYOUT_MOVE_SELECTION;this.setSelectionInt(selectedPosition-1);moved=true;showScroll=selectedPosition==startOfRow;}break;}if(moved){this.playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));this.invokeOnItemScrollListener();}if(showScroll){this.awakenScrollBars();}return moved;}},{key:'onFocusChanged',value:function onFocusChanged(gainFocus,direction,previouslyFocusedRect){_get2(GridView.prototype.__proto__||Object.getPrototypeOf(GridView.prototype),'onFocusChanged',this).call(this,gainFocus,direction,previouslyFocusedRect);var closestChildIndex=-1;if(gainFocus&&previouslyFocusedRect!=null){previouslyFocusedRect.offset(this.mScrollX,this.mScrollY);var otherRect=this.mTempRect;var minDistance=Integer.MAX_VALUE;var childCount=this.getChildCount();for(var i=0;i<childCount;i++){if(!this.isCandidateSelection(i,direction)){continue;}var other=this.getChildAt(i);other.getDrawingRect(otherRect);this.offsetDescendantRectToMyCoords(other,otherRect);var distance=GridView.getDistance(previouslyFocusedRect,otherRect,direction);if(distance<minDistance){minDistance=distance;closestChildIndex=i;}}}if(closestChildIndex>=0){this.setSelection(closestChildIndex+this.mFirstPosition);}else{this.requestLayout();}}},{key:'isCandidateSelection',value:function isCandidateSelection(childIndex,direction){var count=this.getChildCount();var invertedIndex=count-1-childIndex;var rowStart=void 0;var rowEnd=void 0;if(!this.mStackFromBottom){rowStart=childIndex-childIndex%this.mNumColumns;rowEnd=Math.max(rowStart+this.mNumColumns-1,count);}else{rowEnd=count-1-(invertedIndex-invertedIndex%this.mNumColumns);rowStart=Math.max(0,rowEnd-this.mNumColumns+1);}switch(direction){case View.FOCUS_RIGHT:return childIndex==rowStart;case View.FOCUS_DOWN:return rowStart==0;case View.FOCUS_LEFT:return childIndex==rowEnd;case View.FOCUS_UP:return rowEnd==count-1;case View.FOCUS_FORWARD:return childIndex==rowStart&&rowStart==0;case View.FOCUS_BACKWARD:return childIndex==rowEnd&&rowEnd==count-1;default:throw Error('new IllegalArgumentException(\"direction must be one of \" + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, \" + \"FOCUS_FORWARD, FOCUS_BACKWARD}.\")');}}},{key:'setGravity',value:function setGravity(gravity){if(this.mGravity!=gravity){this.mGravity=gravity;this.requestLayoutIfNecessary();}}},{key:'getGravity',value:function getGravity(){return this.mGravity;}},{key:'setHorizontalSpacing',value:function setHorizontalSpacing(horizontalSpacing){if(horizontalSpacing!=this.mRequestedHorizontalSpacing){this.mRequestedHorizontalSpacing=horizontalSpacing;this.requestLayoutIfNecessary();}}},{key:'getHorizontalSpacing',value:function getHorizontalSpacing(){return this.mHorizontalSpacing;}},{key:'getRequestedHorizontalSpacing',value:function getRequestedHorizontalSpacing(){return this.mRequestedHorizontalSpacing;}},{key:'setVerticalSpacing',value:function setVerticalSpacing(verticalSpacing){if(verticalSpacing!=this.mVerticalSpacing){this.mVerticalSpacing=verticalSpacing;this.requestLayoutIfNecessary();}}},{key:'getVerticalSpacing',value:function getVerticalSpacing(){return this.mVerticalSpacing;}},{key:'setStretchMode',value:function setStretchMode(stretchMode){if(stretchMode!=this.mStretchMode){this.mStretchMode=stretchMode;this.requestLayoutIfNecessary();}}},{key:'getStretchMode',value:function getStretchMode(){return this.mStretchMode;}},{key:'setColumnWidth',value:function setColumnWidth(columnWidth){if(columnWidth!=this.mRequestedColumnWidth){this.mRequestedColumnWidth=columnWidth;this.requestLayoutIfNecessary();}}},{key:'getColumnWidth',value:function getColumnWidth(){return this.mColumnWidth;}},{key:'getRequestedColumnWidth',value:function getRequestedColumnWidth(){return this.mRequestedColumnWidth;}},{key:'setNumColumns',value:function setNumColumns(numColumns){if(numColumns!=this.mRequestedNumColumns){this.mRequestedNumColumns=numColumns;this.requestLayoutIfNecessary();}}},{key:'getNumColumns',value:function getNumColumns(){return this.mNumColumns;}},{key:'adjustViewsUpOrDown',value:function adjustViewsUpOrDown(){var childCount=this.getChildCount();if(childCount>0){var delta=void 0;var child=void 0;if(!this.mStackFromBottom){child=this.getChildAt(0);delta=child.getTop()-this.mListPadding.top;if(this.mFirstPosition!=0){delta-=this.mVerticalSpacing;}if(delta<0){delta=0;}}else{child=this.getChildAt(childCount-1);delta=child.getBottom()-(this.getHeight()-this.mListPadding.bottom);if(this.mFirstPosition+childCount<this.mItemCount){delta+=this.mVerticalSpacing;}if(delta>0){delta=0;}}if(delta!=0){this.offsetChildrenTopAndBottom(-delta);}}}},{key:'computeVerticalScrollExtent',value:function computeVerticalScrollExtent(){var count=this.getChildCount();if(count>0){var numColumns=this.mNumColumns;var rowCount=(count+numColumns-1)/numColumns;var extent=rowCount*100;var view=this.getChildAt(0);var top=view.getTop();var height=view.getHeight();if(height>0){extent+=top*100/height;}view=this.getChildAt(count-1);var bottom=view.getBottom();height=view.getHeight();if(height>0){extent-=(bottom-this.getHeight())*100/height;}return extent;}return 0;}},{key:'computeVerticalScrollOffset',value:function computeVerticalScrollOffset(){if(this.mFirstPosition>=0&&this.getChildCount()>0){var view=this.getChildAt(0);var top=view.getTop();var height=view.getHeight();if(height>0){var numColumns=this.mNumColumns;var rowCount=(this.mItemCount+numColumns-1)/numColumns;var oddItemsOnFirstRow=this.isStackFromBottom()?rowCount*numColumns-this.mItemCount:0;var whichRow=(this.mFirstPosition+oddItemsOnFirstRow)/numColumns;return Math.max(whichRow*100-top*100/height+Math.floor(this.mScrollY/this.getHeight()*rowCount*100),0);}}return 0;}},{key:'computeVerticalScrollRange',value:function computeVerticalScrollRange(){var numColumns=this.mNumColumns;var rowCount=(this.mItemCount+numColumns-1)/numColumns;var result=Math.max(rowCount*100,0);if(this.mScrollY!=0){result+=Math.abs(Math.floor(this.mScrollY/this.getHeight()*rowCount*100));}return result;}}]);return GridView;}(AbsListView);GridView.NO_STRETCH=0;GridView.STRETCH_SPACING=1;GridView.STRETCH_COLUMN_WIDTH=2;GridView.STRETCH_SPACING_UNIFORM=3;GridView.AUTO_FIT=-1;widget.GridView=GridView;})(widget=android.widget||(android.widget={}));})(android||(android={}));var java;(function(java){var lang;(function(lang){var Comparable;(function(Comparable){function isImpl(obj){return obj&&obj['compareTo'];}Comparable.isImpl=isImpl;})(Comparable=lang.Comparable||(lang.Comparable={}));})(lang=java.lang||(java.lang={}));})(java||(java={}));var java;(function(java){var util;(function(util){var Comparable=java.lang.Comparable;var Collections=function(){function Collections(){_classCallCheck(this,Collections);}_createClass(Collections,null,[{key:'emptyList',value:function emptyList(){return Collections.EMPTY_LIST;}},{key:'sort',value:function sort(list,c){if(c){list.sort(function(t1,t2){return c.compare(t1,t2);});}else{list.sort(function(t1,t2){if(Comparable.isImpl(t1)&&Comparable.isImpl(t2)){return t1.compareTo(t2);}return 0;});}}}]);return Collections;}();Collections.EMPTY_LIST=new util.ArrayList();util.Collections=Collections;})(util=java.util||(java.util={}));})(java||(java={}));var android;(function(android){var widget;(function(widget){var Color=android.graphics.Color;var Paint=android.graphics.Paint;var Align=android.graphics.Paint.Align;var SparseArray=android.util.SparseArray;var TypedValue=android.util.TypedValue;var KeyEvent=android.view.KeyEvent;var MotionEvent=android.view.MotionEvent;var VelocityTracker=android.view.VelocityTracker;var View=android.view.View;var ViewConfiguration=android.view.ViewConfiguration;var DecelerateInterpolator=android.view.animation.DecelerateInterpolator;var Integer=java.lang.Integer;var LinearLayout=android.widget.LinearLayout;var OverScroller=android.widget.OverScroller;var NumberPicker=function(_LinearLayout){_inherits(NumberPicker,_LinearLayout);function NumberPicker(context,bindElement){var defStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.R.attr.numberPickerStyle;_classCallCheck(this,NumberPicker);var _this128=_possibleConstructorReturn(this,(NumberPicker.__proto__||Object.getPrototypeOf(NumberPicker)).call(this,context,bindElement,defStyle));_this128.SELECTOR_WHEEL_ITEM_COUNT=3;_this128.SELECTOR_MIDDLE_ITEM_INDEX=Math.floor(_this128.SELECTOR_WHEEL_ITEM_COUNT/2);_this128.mSelectionDividersDistance=0;_this128.mMinHeight_=NumberPicker.SIZE_UNSPECIFIED;_this128.mMaxHeight=NumberPicker.SIZE_UNSPECIFIED;_this128.mMinWidth_=NumberPicker.SIZE_UNSPECIFIED;_this128.mMaxWidth=NumberPicker.SIZE_UNSPECIFIED;_this128.mTextSize=0;_this128.mSelectorTextGapHeight=0;_this128.mMinValue=0;_this128.mMaxValue=0;_this128.mValue=0;_this128.mLongPressUpdateInterval=NumberPicker.DEFAULT_LONG_PRESS_UPDATE_INTERVAL;_this128.mSelectorIndexToStringCache=new SparseArray();_this128.mSelectorElementHeight=0;_this128.mInitialScrollOffset=Integer.MIN_VALUE;_this128.mCurrentScrollOffset=0;_this128.mPreviousScrollerY=0;_this128.mLastDownEventY=0;_this128.mLastDownEventTime=0;_this128.mLastDownOrMoveEventY=0;_this128.mMinimumFlingVelocity=0;_this128.mMaximumFlingVelocity=0;_this128.mSolidColor=0;_this128.mSelectionDividerHeight=0;_this128.mScrollState=NumberPicker.OnScrollListener.SCROLL_STATE_IDLE;_this128.mTopSelectionDividerTop=0;_this128.mBottomSelectionDividerBottom=0;_this128.mLastHoveredChildVirtualViewId=0;_this128.mLastHandledDownDpadKeyCode=-1;var attributesArray=context.obtainStyledAttributes(bindElement,defStyle);_this128.mHasSelectorWheel=true;_this128.mSolidColor=attributesArray.getColor('solidColor',0);_this128.mSelectionDivider=attributesArray.getDrawable('selectionDivider');var defSelectionDividerHeight=Math.floor(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,NumberPicker.UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT,_this128.getResources().getDisplayMetrics()));_this128.mSelectionDividerHeight=attributesArray.getDimensionPixelSize('selectionDividerHeight',defSelectionDividerHeight);var defSelectionDividerDistance=Math.floor(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,NumberPicker.UNSCALED_DEFAULT_SELECTION_DIVIDERS_DISTANCE,_this128.getResources().getDisplayMetrics()));_this128.mSelectionDividersDistance=attributesArray.getDimensionPixelSize('selectionDividersDistance',defSelectionDividerDistance);_this128.mMinHeight=attributesArray.getDimensionPixelSize('internalMinHeight',NumberPicker.SIZE_UNSPECIFIED);_this128.mMaxHeight=attributesArray.getDimensionPixelSize('internalMaxHeight',NumberPicker.SIZE_UNSPECIFIED);if(_this128.mMinHeight!=NumberPicker.SIZE_UNSPECIFIED&&_this128.mMaxHeight!=NumberPicker.SIZE_UNSPECIFIED&&_this128.mMinHeight>_this128.mMaxHeight){throw Error('new IllegalArgumentException(\"minHeight > maxHeight\")');}_this128.mMinWidth=attributesArray.getDimensionPixelSize('internalMinWidth',NumberPicker.SIZE_UNSPECIFIED);_this128.mMaxWidth=attributesArray.getDimensionPixelSize('internalMaxWidth',NumberPicker.SIZE_UNSPECIFIED);if(_this128.mMinWidth!=NumberPicker.SIZE_UNSPECIFIED&&_this128.mMaxWidth!=NumberPicker.SIZE_UNSPECIFIED&&_this128.mMinWidth>_this128.mMaxWidth){throw Error('new IllegalArgumentException(\"minWidth > maxWidth\")');}_this128.mComputeMaxWidth=_this128.mMaxWidth==NumberPicker.SIZE_UNSPECIFIED;_this128.mVirtualButtonPressedDrawable=attributesArray.getDrawable('virtualButtonPressedDrawable');_this128.mTextSize=attributesArray.getDimensionPixelSize('textSize',Math.floor(16*_this128.getResources().getDisplayMetrics().density));var paint=new Paint();paint.setAntiAlias(true);paint.setTextAlign(Align.CENTER);paint.setTextSize(_this128.mTextSize);paint.setColor(attributesArray.getColor('textColor',Color.DKGRAY));_this128.mSelectorWheelPaint=paint;_this128.SELECTOR_WHEEL_ITEM_COUNT=attributesArray.getInt('itemCount',_this128.SELECTOR_WHEEL_ITEM_COUNT);_this128.SELECTOR_MIDDLE_ITEM_INDEX=Math.floor(_this128.SELECTOR_WHEEL_ITEM_COUNT/2);_this128.mSelectorIndices=androidui.util.ArrayCreator.newNumberArray(_this128.SELECTOR_WHEEL_ITEM_COUNT);if(_this128.mMinHeight_!=NumberPicker.SIZE_UNSPECIFIED&&_this128.mMaxHeight!=NumberPicker.SIZE_UNSPECIFIED&&_this128.mMinHeight_>_this128.mMaxHeight){throw Error('new IllegalArgumentException(\"minHeight > maxHeight\")');}if(_this128.mMinWidth_!=NumberPicker.SIZE_UNSPECIFIED&&_this128.mMaxWidth!=NumberPicker.SIZE_UNSPECIFIED&&_this128.mMinWidth_>_this128.mMaxWidth){throw Error('new IllegalArgumentException(\"minWidth > maxWidth\")');}_this128.mComputeMaxWidth=_this128.mMaxWidth==NumberPicker.SIZE_UNSPECIFIED;_this128.setMinValue(attributesArray.getInt('minValue',_this128.mMinValue));_this128.setMaxValue(attributesArray.getInt('maxValue',_this128.mMaxValue));attributesArray.recycle();_this128.mPressedStateHelper=new NumberPicker.PressedStateHelper(_this128);_this128.setWillNotDraw(!_this128.mHasSelectorWheel);var configuration=ViewConfiguration.get();_this128.mMinimumFlingVelocity=configuration.getScaledMinimumFlingVelocity();_this128.mMaximumFlingVelocity=configuration.getScaledMaximumFlingVelocity()/NumberPicker.SELECTOR_MAX_FLING_VELOCITY_ADJUSTMENT;_this128.mFlingScroller=new OverScroller(null,true);_this128.mAdjustScroller=new OverScroller(new DecelerateInterpolator(2.5));_this128.updateInputTextView();return _this128;}_createClass(NumberPicker,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(NumberPicker.prototype.__proto__||Object.getPrototypeOf(NumberPicker.prototype),'createClassAttrBinder',this).call(this).set('solidColor',{setter:function setter(v,value,attrBinder){v.mSolidColor=attrBinder.parseColor(value,v.mSolidColor);v.invalidate();},getter:function getter(v){return v.mSolidColor;}}).set('selectionDivider',{setter:function setter(v,value,attrBinder){v.mSelectionDivider=attrBinder.parseDrawable(value);v.invalidate();},getter:function getter(v){return v.mSelectionDivider;}}).set('selectionDividerHeight',{setter:function setter(v,value,attrBinder){v.mSelectionDividerHeight=attrBinder.parseNumberPixelSize(value,v.mSelectionDividerHeight);v.invalidate();},getter:function getter(v){return v.mSelectionDividerHeight;}}).set('selectionDividersDistance',{setter:function setter(v,value,attrBinder){v.mSelectionDividersDistance=attrBinder.parseNumberPixelSize(value,v.mSelectionDividersDistance);v.invalidate();},getter:function getter(v){return v.mSelectionDividersDistance;}}).set('internalMinHeight',{setter:function setter(v,value,attrBinder){v.mMinHeight_=attrBinder.parseNumberPixelSize(value,v.mMinHeight_);v.invalidate();},getter:function getter(v){return v.mMinHeight_;}}).set('internalMaxHeight',{setter:function setter(v,value,attrBinder){v.mMaxHeight=attrBinder.parseNumberPixelSize(value,v.mMaxHeight);v.invalidate();},getter:function getter(v){return v.mMaxHeight;}}).set('internalMinWidth',{setter:function setter(v,value,attrBinder){v.mMinWidth_=attrBinder.parseNumberPixelSize(value,v.mMinWidth_);v.invalidate();},getter:function getter(v){return v.mMinWidth_;}}).set('internalMaxWidth',{setter:function setter(v,value,attrBinder){v.mMaxWidth=attrBinder.parseNumberPixelSize(value,v.mMaxWidth);v.invalidate();},getter:function getter(v){return v.mMaxWidth;}}).set('virtualButtonPressedDrawable',{setter:function setter(v,value,attrBinder){v.mVirtualButtonPressedDrawable=attrBinder.parseDrawable(value);v.invalidate();},getter:function getter(v){return v.mVirtualButtonPressedDrawable;}});}},{key:'onLayout',value:function onLayout(changed,left,top,right,bottom){if(!this.mHasSelectorWheel){_get2(NumberPicker.prototype.__proto__||Object.getPrototypeOf(NumberPicker.prototype),'onLayout',this).call(this,changed,left,top,right,bottom);return;}var msrdWdth=this.getMeasuredWidth();var msrdHght=this.getMeasuredHeight();if(changed){this.initializeSelectorWheel();this.initializeFadingEdges();this.mTopSelectionDividerTop=(this.getHeight()-this.mSelectionDividersDistance)/2-this.mSelectionDividerHeight;this.mBottomSelectionDividerBottom=this.mTopSelectionDividerTop+2*this.mSelectionDividerHeight+this.mSelectionDividersDistance;}}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){if(!this.mHasSelectorWheel){_get2(NumberPicker.prototype.__proto__||Object.getPrototypeOf(NumberPicker.prototype),'onMeasure',this).call(this,widthMeasureSpec,heightMeasureSpec);return;}var newWidthMeasureSpec=this.makeMeasureSpec(widthMeasureSpec,this.mMaxWidth);var newHeightMeasureSpec=this.makeMeasureSpec(heightMeasureSpec,this.mMaxHeight);_get2(NumberPicker.prototype.__proto__||Object.getPrototypeOf(NumberPicker.prototype),'onMeasure',this).call(this,newWidthMeasureSpec,newHeightMeasureSpec);var widthSize=this.resolveSizeAndStateRespectingMinSize(this.mMinWidth_,this.getMeasuredWidth(),widthMeasureSpec);var heightSize=this.resolveSizeAndStateRespectingMinSize(this.mMinHeight_,this.getMeasuredHeight(),heightMeasureSpec);this.setMeasuredDimension(widthSize,heightSize);}},{key:'moveToFinalScrollerPosition',value:function moveToFinalScrollerPosition(scroller){scroller.forceFinished(true);var amountToScroll=scroller.getFinalY()-scroller.getCurrY();var futureScrollOffset=(this.mCurrentScrollOffset+amountToScroll)%this.mSelectorElementHeight;var overshootAdjustment=this.mInitialScrollOffset-futureScrollOffset;if(overshootAdjustment!=0){if(Math.abs(overshootAdjustment)>this.mSelectorElementHeight/2){if(overshootAdjustment>0){overshootAdjustment-=this.mSelectorElementHeight;}else{overshootAdjustment+=this.mSelectorElementHeight;}}amountToScroll+=overshootAdjustment;this.scrollBy(0,amountToScroll);return true;}return false;}},{key:'onInterceptTouchEvent',value:function onInterceptTouchEvent(event){if(!this.mHasSelectorWheel||!this.isEnabled()){return false;}var action=event.getActionMasked();switch(action){case MotionEvent.ACTION_DOWN:{this.removeAllCallbacks();this.mLastDownOrMoveEventY=this.mLastDownEventY=event.getY();this.mLastDownEventTime=event.getEventTime();this.mIngonreMoveEvents=false;this.mShowSoftInputOnTap=false;if(this.mLastDownEventY<this.mTopSelectionDividerTop){if(this.mScrollState==NumberPicker.OnScrollListener.SCROLL_STATE_IDLE){this.mPressedStateHelper.buttonPressDelayed(NumberPicker.PressedStateHelper.BUTTON_DECREMENT);}}else if(this.mLastDownEventY>this.mBottomSelectionDividerBottom){if(this.mScrollState==NumberPicker.OnScrollListener.SCROLL_STATE_IDLE){this.mPressedStateHelper.buttonPressDelayed(NumberPicker.PressedStateHelper.BUTTON_INCREMENT);}}this.getParent().requestDisallowInterceptTouchEvent(true);if(!this.mFlingScroller.isFinished()){this.mFlingScroller.forceFinished(true);this.mAdjustScroller.forceFinished(true);this.onScrollStateChange(NumberPicker.OnScrollListener.SCROLL_STATE_IDLE);}else if(!this.mAdjustScroller.isFinished()){this.mFlingScroller.forceFinished(true);this.mAdjustScroller.forceFinished(true);}else if(this.mLastDownEventY<this.mTopSelectionDividerTop){this.hideSoftInput();this.postChangeCurrentByOneFromLongPress(false,ViewConfiguration.getLongPressTimeout());}else if(this.mLastDownEventY>this.mBottomSelectionDividerBottom){this.hideSoftInput();this.postChangeCurrentByOneFromLongPress(true,ViewConfiguration.getLongPressTimeout());}else{this.mShowSoftInputOnTap=true;this.postBeginSoftInputOnLongPressCommand();}return true;}}return false;}},{key:'onTouchEvent',value:function onTouchEvent(event){if(!this.isEnabled()||!this.mHasSelectorWheel){return false;}if(this.mVelocityTracker==null){this.mVelocityTracker=VelocityTracker.obtain();}this.mVelocityTracker.addMovement(event);var action=event.getActionMasked();switch(action){case MotionEvent.ACTION_MOVE:{if(this.mIngonreMoveEvents){break;}var currentMoveY=event.getY();if(this.mScrollState!=NumberPicker.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL){var deltaDownY=Math.floor(Math.abs(currentMoveY-this.mLastDownEventY));if(deltaDownY>this.mTouchSlop){this.removeAllCallbacks();this.onScrollStateChange(NumberPicker.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);}}else{var deltaMoveY=Math.floor(currentMoveY-this.mLastDownOrMoveEventY);this.scrollBy(0,deltaMoveY);this.invalidate();}this.mLastDownOrMoveEventY=currentMoveY;}break;case MotionEvent.ACTION_UP:{this.removeBeginSoftInputCommand();this.removeChangeCurrentByOneFromLongPress();this.mPressedStateHelper.cancel();var velocityTracker=this.mVelocityTracker;velocityTracker.computeCurrentVelocity(1000,this.mMaximumFlingVelocity);var initialVelocity=Math.floor(velocityTracker.getYVelocity());if(Math.abs(initialVelocity)>this.mMinimumFlingVelocity){this.fling(initialVelocity);this.onScrollStateChange(NumberPicker.OnScrollListener.SCROLL_STATE_FLING);}else{var eventY=Math.floor(event.getY());var _deltaMoveY=Math.floor(Math.abs(eventY-this.mLastDownEventY));var deltaTime=event.getEventTime()-this.mLastDownEventTime;if(_deltaMoveY<=this.mTouchSlop&&deltaTime<ViewConfiguration.getTapTimeout()){if(this.mShowSoftInputOnTap){this.mShowSoftInputOnTap=false;this.showSoftInput();}else{var selectorIndexOffset=eventY/this.mSelectorElementHeight-this.SELECTOR_MIDDLE_ITEM_INDEX;if(selectorIndexOffset>0){this.changeValueByOne(true);this.mPressedStateHelper.buttonTapped(NumberPicker.PressedStateHelper.BUTTON_INCREMENT);}else if(selectorIndexOffset<0){this.changeValueByOne(false);this.mPressedStateHelper.buttonTapped(NumberPicker.PressedStateHelper.BUTTON_DECREMENT);}}}else{this.ensureScrollWheelAdjusted();}this.onScrollStateChange(NumberPicker.OnScrollListener.SCROLL_STATE_IDLE);}this.mVelocityTracker.recycle();this.mVelocityTracker=null;}break;}return true;}},{key:'dispatchTouchEvent',value:function dispatchTouchEvent(event){var action=event.getActionMasked();switch(action){case MotionEvent.ACTION_CANCEL:case MotionEvent.ACTION_UP:this.removeAllCallbacks();break;}return _get2(NumberPicker.prototype.__proto__||Object.getPrototypeOf(NumberPicker.prototype),'dispatchTouchEvent',this).call(this,event);}},{key:'dispatchKeyEvent',value:function dispatchKeyEvent(event){var keyCode=event.getKeyCode();switch(keyCode){case KeyEvent.KEYCODE_DPAD_CENTER:case KeyEvent.KEYCODE_ENTER:this.removeAllCallbacks();break;case KeyEvent.KEYCODE_DPAD_DOWN:case KeyEvent.KEYCODE_DPAD_UP:if(!this.mHasSelectorWheel){break;}switch(event.getAction()){case KeyEvent.ACTION_DOWN:if(this.mWrapSelectorWheel||keyCode==KeyEvent.KEYCODE_DPAD_DOWN?this.getValue()<this.getMaxValue():this.getValue()>this.getMinValue()){this.requestFocus();this.mLastHandledDownDpadKeyCode=keyCode;this.removeAllCallbacks();if(this.mFlingScroller.isFinished()){this.changeValueByOne(keyCode==KeyEvent.KEYCODE_DPAD_DOWN);}return true;}break;case KeyEvent.ACTION_UP:if(this.mLastHandledDownDpadKeyCode==keyCode){this.mLastHandledDownDpadKeyCode=-1;return true;}break;}}return _get2(NumberPicker.prototype.__proto__||Object.getPrototypeOf(NumberPicker.prototype),'dispatchKeyEvent',this).call(this,event);}},{key:'computeScroll',value:function computeScroll(){var scroller=this.mFlingScroller;if(scroller.isFinished()){scroller=this.mAdjustScroller;if(scroller.isFinished()){return;}}scroller.computeScrollOffset();var currentScrollerY=scroller.getCurrY();if(this.mPreviousScrollerY==0){this.mPreviousScrollerY=scroller.getStartY();}this.scrollBy(0,currentScrollerY-this.mPreviousScrollerY);this.mPreviousScrollerY=currentScrollerY;if(scroller.isFinished()){this.onScrollerFinished(scroller);}else{this.invalidate();}}},{key:'setEnabled',value:function setEnabled(enabled){_get2(NumberPicker.prototype.__proto__||Object.getPrototypeOf(NumberPicker.prototype),'setEnabled',this).call(this,enabled);if(!this.mHasSelectorWheel){}if(!this.mHasSelectorWheel){}}},{key:'scrollBy',value:function scrollBy(x,y){var selectorIndices=this.mSelectorIndices;if(!this.mWrapSelectorWheel&&y>0&&selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX]<=this.mMinValue){this.mCurrentScrollOffset=this.mInitialScrollOffset;return;}if(!this.mWrapSelectorWheel&&y<0&&selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX]>=this.mMaxValue){this.mCurrentScrollOffset=this.mInitialScrollOffset;return;}this.mCurrentScrollOffset+=y;while(this.mCurrentScrollOffset-this.mInitialScrollOffset>this.mSelectorTextGapHeight){this.mCurrentScrollOffset-=this.mSelectorElementHeight;this.decrementSelectorIndices(selectorIndices);this.setValueInternal(selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX],true);if(!this.mWrapSelectorWheel&&selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX]<=this.mMinValue){this.mCurrentScrollOffset=this.mInitialScrollOffset;}}while(this.mCurrentScrollOffset-this.mInitialScrollOffset<-this.mSelectorTextGapHeight){this.mCurrentScrollOffset+=this.mSelectorElementHeight;this.incrementSelectorIndices(selectorIndices);this.setValueInternal(selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX],true);if(!this.mWrapSelectorWheel&&selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX]>=this.mMaxValue){this.mCurrentScrollOffset=this.mInitialScrollOffset;}}}},{key:'computeVerticalScrollOffset',value:function computeVerticalScrollOffset(){return this.mCurrentScrollOffset;}},{key:'computeVerticalScrollRange',value:function computeVerticalScrollRange(){return(this.mMaxValue-this.mMinValue+1)*this.mSelectorElementHeight;}},{key:'computeVerticalScrollExtent',value:function computeVerticalScrollExtent(){return this.getHeight();}},{key:'getSolidColor',value:function getSolidColor(){return this.mSolidColor;}},{key:'setOnValueChangedListener',value:function setOnValueChangedListener(onValueChangedListener){this.mOnValueChangeListener=onValueChangedListener;}},{key:'setOnScrollListener',value:function setOnScrollListener(onScrollListener){this.mOnScrollListener=onScrollListener;}},{key:'setFormatter',value:function setFormatter(formatter){if(formatter==this.mFormatter){return;}this.mFormatter=formatter;this.initializeSelectorWheelIndices();this.updateInputTextView();}},{key:'setValue',value:function setValue(value){this.setValueInternal(value,false);}},{key:'showSoftInput',value:function showSoftInput(){}},{key:'hideSoftInput',value:function hideSoftInput(){}},{key:'tryComputeMaxWidth',value:function tryComputeMaxWidth(){if(!this.mComputeMaxWidth){return;}var maxTextWidth=0;if(this.mDisplayedValues==null){var maxDigitWidth=0;for(var i=0;i<=9;i++){var digitWidth=this.mSelectorWheelPaint.measureText(NumberPicker.formatNumberWithLocale(i));if(digitWidth>maxDigitWidth){maxDigitWidth=digitWidth;}}var numberOfDigits=0;var current=this.mMaxValue;while(current>0){numberOfDigits++;current=current/10;}maxTextWidth=Math.floor(numberOfDigits*maxDigitWidth);}else{var valueCount=this.mDisplayedValues.length;for(var _i57=0;_i57<valueCount;_i57++){var textWidth=this.mSelectorWheelPaint.measureText(this.mDisplayedValues[_i57]);if(textWidth>maxTextWidth){maxTextWidth=Math.floor(textWidth);}}}if(this.mMaxWidth!=maxTextWidth){if(maxTextWidth>this.mMinWidth_){this.mMaxWidth=maxTextWidth;}else{this.mMaxWidth=this.mMinWidth_;}this.invalidate();}}},{key:'getWrapSelectorWheel',value:function getWrapSelectorWheel(){return this.mWrapSelectorWheel;}},{key:'setWrapSelectorWheel',value:function setWrapSelectorWheel(wrapSelectorWheel){var wrappingAllowed=this.mMaxValue-this.mMinValue>=this.mSelectorIndices.length;if((!wrapSelectorWheel||wrappingAllowed)&&wrapSelectorWheel!=this.mWrapSelectorWheel){this.mWrapSelectorWheel=wrapSelectorWheel;}}},{key:'setOnLongPressUpdateInterval',value:function setOnLongPressUpdateInterval(intervalMillis){this.mLongPressUpdateInterval=intervalMillis;}},{key:'getValue',value:function getValue(){return this.mValue;}},{key:'getMinValue',value:function getMinValue(){return this.mMinValue;}},{key:'setMinValue',value:function setMinValue(minValue){if(this.mMinValue==minValue){return;}if(minValue<0){throw Error('new IllegalArgumentException(\"minValue must be >= 0\")');}this.mMinValue=minValue;if(this.mMinValue>this.mValue){this.mValue=this.mMinValue;}var wrapSelectorWheel=this.mMaxValue-this.mMinValue>this.mSelectorIndices.length;this.setWrapSelectorWheel(wrapSelectorWheel);this.initializeSelectorWheelIndices();this.updateInputTextView();this.tryComputeMaxWidth();this.invalidate();}},{key:'getMaxValue',value:function getMaxValue(){return this.mMaxValue;}},{key:'setMaxValue',value:function setMaxValue(maxValue){if(this.mMaxValue==maxValue){return;}if(maxValue<0){throw Error('new IllegalArgumentException(\"maxValue must be >= 0\")');}this.mMaxValue=maxValue;if(this.mMaxValue<this.mValue){this.mValue=this.mMaxValue;}var wrapSelectorWheel=this.mMaxValue-this.mMinValue>this.mSelectorIndices.length;this.setWrapSelectorWheel(wrapSelectorWheel);this.initializeSelectorWheelIndices();this.updateInputTextView();this.tryComputeMaxWidth();this.invalidate();}},{key:'getDisplayedValues',value:function getDisplayedValues(){return this.mDisplayedValues;}},{key:'setDisplayedValues',value:function setDisplayedValues(displayedValues){if(this.mDisplayedValues==displayedValues){return;}this.mDisplayedValues=displayedValues;if(this.mDisplayedValues!=null){}else{}this.updateInputTextView();this.initializeSelectorWheelIndices();this.tryComputeMaxWidth();}},{key:'getTopFadingEdgeStrength',value:function getTopFadingEdgeStrength(){return NumberPicker.TOP_AND_BOTTOM_FADING_EDGE_STRENGTH;}},{key:'getBottomFadingEdgeStrength',value:function getBottomFadingEdgeStrength(){return NumberPicker.TOP_AND_BOTTOM_FADING_EDGE_STRENGTH;}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){_get2(NumberPicker.prototype.__proto__||Object.getPrototypeOf(NumberPicker.prototype),'onDetachedFromWindow',this).call(this);this.removeAllCallbacks();}},{key:'onDraw',value:function onDraw(canvas){if(!this.mHasSelectorWheel){_get2(NumberPicker.prototype.__proto__||Object.getPrototypeOf(NumberPicker.prototype),'onDraw',this).call(this,canvas);return;}var x=(this.mRight-this.mLeft)/2;var y=this.mCurrentScrollOffset;if(this.mVirtualButtonPressedDrawable!=null&&this.mScrollState==NumberPicker.OnScrollListener.SCROLL_STATE_IDLE){if(this.mDecrementVirtualButtonPressed){this.mVirtualButtonPressedDrawable.setState(NumberPicker.PRESSED_STATE_SET);this.mVirtualButtonPressedDrawable.setBounds(0,0,this.mRight,this.mTopSelectionDividerTop);this.mVirtualButtonPressedDrawable.draw(canvas);}if(this.mIncrementVirtualButtonPressed){this.mVirtualButtonPressedDrawable.setState(NumberPicker.PRESSED_STATE_SET);this.mVirtualButtonPressedDrawable.setBounds(0,this.mBottomSelectionDividerBottom,this.mRight,this.mBottom);this.mVirtualButtonPressedDrawable.draw(canvas);}}var selectorIndices=this.mSelectorIndices;for(var i=0;i<selectorIndices.length;i++){var selectorIndex=selectorIndices[i];var scrollSelectorValue=this.mSelectorIndexToStringCache.get(selectorIndex);canvas.drawText(scrollSelectorValue,x,y,this.mSelectorWheelPaint);y+=this.mSelectorElementHeight;}if(this.mSelectionDivider!=null){var topOfTopDivider=this.mTopSelectionDividerTop;var bottomOfTopDivider=topOfTopDivider+this.mSelectionDividerHeight;this.mSelectionDivider.setBounds(0,topOfTopDivider,this.mRight,bottomOfTopDivider);this.mSelectionDivider.draw(canvas);var bottomOfBottomDivider=this.mBottomSelectionDividerBottom;var topOfBottomDivider=bottomOfBottomDivider-this.mSelectionDividerHeight;this.mSelectionDivider.setBounds(0,topOfBottomDivider,this.mRight,bottomOfBottomDivider);this.mSelectionDivider.draw(canvas);}}},{key:'makeMeasureSpec',value:function makeMeasureSpec(measureSpec,maxSize){if(maxSize==NumberPicker.SIZE_UNSPECIFIED){return measureSpec;}var size=View.MeasureSpec.getSize(measureSpec);var mode=View.MeasureSpec.getMode(measureSpec);switch(mode){case View.MeasureSpec.EXACTLY:return measureSpec;case View.MeasureSpec.AT_MOST:return View.MeasureSpec.makeMeasureSpec(Math.min(size,maxSize),View.MeasureSpec.EXACTLY);case View.MeasureSpec.UNSPECIFIED:return View.MeasureSpec.makeMeasureSpec(maxSize,View.MeasureSpec.EXACTLY);default:throw Error('new IllegalArgumentException(\"Unknown measure mode: \" + mode)');}}},{key:'resolveSizeAndStateRespectingMinSize',value:function resolveSizeAndStateRespectingMinSize(minSize,measuredSize,measureSpec){if(minSize!=NumberPicker.SIZE_UNSPECIFIED){var desiredWidth=Math.max(minSize,measuredSize);return NumberPicker.resolveSizeAndState(desiredWidth,measureSpec,0);}else{return measuredSize;}}},{key:'initializeSelectorWheelIndices',value:function initializeSelectorWheelIndices(){this.mSelectorIndexToStringCache.clear();var selectorIndices=this.mSelectorIndices;var current=this.getValue();for(var i=0;i<this.mSelectorIndices.length;i++){var selectorIndex=Math.floor(current+(i-this.SELECTOR_MIDDLE_ITEM_INDEX));if(this.mWrapSelectorWheel){selectorIndex=this.getWrappedSelectorIndex(selectorIndex);}selectorIndices[i]=selectorIndex;this.ensureCachedScrollSelectorValue(selectorIndices[i]);}}},{key:'setValueInternal',value:function setValueInternal(current,notifyChange){if(this.mValue==current){return;}if(this.mWrapSelectorWheel){current=this.getWrappedSelectorIndex(current);}else{current=Math.max(current,this.mMinValue);current=Math.min(current,this.mMaxValue);}var previous=this.mValue;this.mValue=current;this.updateInputTextView();if(notifyChange){this.notifyChange(previous,current);}this.initializeSelectorWheelIndices();this.invalidate();}},{key:'changeValueByOne',value:function changeValueByOne(increment){if(this.mHasSelectorWheel){if(!this.moveToFinalScrollerPosition(this.mFlingScroller)){this.moveToFinalScrollerPosition(this.mAdjustScroller);}this.mPreviousScrollerY=0;if(increment){this.mFlingScroller.startScroll(0,0,0,-this.mSelectorElementHeight,NumberPicker.SNAP_SCROLL_DURATION);}else{this.mFlingScroller.startScroll(0,0,0,this.mSelectorElementHeight,NumberPicker.SNAP_SCROLL_DURATION);}this.invalidate();}else{if(increment){this.setValueInternal(this.mValue+1,true);}else{this.setValueInternal(this.mValue-1,true);}}}},{key:'initializeSelectorWheel',value:function initializeSelectorWheel(){this.initializeSelectorWheelIndices();var selectorIndices=this.mSelectorIndices;var totalTextHeight=selectorIndices.length*this.mTextSize;var totalTextGapHeight=this.mBottom-this.mTop-totalTextHeight;var textGapCount=selectorIndices.length;this.mSelectorTextGapHeight=Math.floor(totalTextGapHeight/textGapCount+0.5);this.mSelectorElementHeight=this.mTextSize+this.mSelectorTextGapHeight;var editTextTextPosition=this.getHeight()/2+this.mTextSize/2;this.mInitialScrollOffset=editTextTextPosition-this.mSelectorElementHeight*this.SELECTOR_MIDDLE_ITEM_INDEX;this.mCurrentScrollOffset=this.mInitialScrollOffset;this.updateInputTextView();}},{key:'initializeFadingEdges',value:function initializeFadingEdges(){this.setVerticalFadingEdgeEnabled(true);this.setFadingEdgeLength((this.mBottom-this.mTop-this.mTextSize)/2);}},{key:'onScrollerFinished',value:function onScrollerFinished(scroller){if(scroller==this.mFlingScroller){if(!this.ensureScrollWheelAdjusted()){this.updateInputTextView();}this.onScrollStateChange(NumberPicker.OnScrollListener.SCROLL_STATE_IDLE);}else{if(this.mScrollState!=NumberPicker.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL){this.updateInputTextView();}}}},{key:'onScrollStateChange',value:function onScrollStateChange(scrollState){if(this.mScrollState==scrollState){return;}this.mScrollState=scrollState;if(this.mOnScrollListener!=null){this.mOnScrollListener.onScrollStateChange(this,scrollState);}}},{key:'fling',value:function fling(velocityY){this.mPreviousScrollerY=0;if(velocityY>0){this.mFlingScroller.fling(0,0,0,velocityY,0,0,0,Integer.MAX_VALUE);}else{this.mFlingScroller.fling(0,Integer.MAX_VALUE,0,velocityY,0,0,0,Integer.MAX_VALUE);}this.invalidate();}},{key:'getWrappedSelectorIndex',value:function getWrappedSelectorIndex(selectorIndex){if(selectorIndex>this.mMaxValue){return this.mMinValue+(selectorIndex-this.mMaxValue)%(this.mMaxValue-this.mMinValue)-1;}else if(selectorIndex<this.mMinValue){return this.mMaxValue-(this.mMinValue-selectorIndex)%(this.mMaxValue-this.mMinValue)+1;}return selectorIndex;}},{key:'incrementSelectorIndices',value:function incrementSelectorIndices(selectorIndices){for(var i=0;i<selectorIndices.length-1;i++){selectorIndices[i]=selectorIndices[i+1];}var nextScrollSelectorIndex=selectorIndices[selectorIndices.length-2]+1;if(this.mWrapSelectorWheel&&nextScrollSelectorIndex>this.mMaxValue){nextScrollSelectorIndex=this.mMinValue;}selectorIndices[selectorIndices.length-1]=nextScrollSelectorIndex;this.ensureCachedScrollSelectorValue(nextScrollSelectorIndex);}},{key:'decrementSelectorIndices',value:function decrementSelectorIndices(selectorIndices){for(var i=selectorIndices.length-1;i>0;i--){selectorIndices[i]=selectorIndices[i-1];}var nextScrollSelectorIndex=selectorIndices[1]-1;if(this.mWrapSelectorWheel&&nextScrollSelectorIndex<this.mMinValue){nextScrollSelectorIndex=this.mMaxValue;}selectorIndices[0]=nextScrollSelectorIndex;this.ensureCachedScrollSelectorValue(nextScrollSelectorIndex);}},{key:'ensureCachedScrollSelectorValue',value:function ensureCachedScrollSelectorValue(selectorIndex){var cache=this.mSelectorIndexToStringCache;var scrollSelectorValue=cache.get(selectorIndex);if(scrollSelectorValue!=null){return;}if(selectorIndex<this.mMinValue||selectorIndex>this.mMaxValue){scrollSelectorValue=\"\";}else{if(this.mDisplayedValues!=null){var displayedValueIndex=selectorIndex-this.mMinValue;scrollSelectorValue=this.mDisplayedValues[displayedValueIndex];}else{scrollSelectorValue=this.formatNumber(selectorIndex);}}cache.put(selectorIndex,scrollSelectorValue);}},{key:'formatNumber',value:function formatNumber(value){return this.mFormatter!=null?this.mFormatter.format(value):NumberPicker.formatNumberWithLocale(value);}},{key:'validateInputTextView',value:function validateInputTextView(v){}},{key:'updateInputTextView',value:function updateInputTextView(){return false;}},{key:'notifyChange',value:function notifyChange(previous,current){if(this.mOnValueChangeListener!=null){this.mOnValueChangeListener.onValueChange(this,previous,this.mValue);}}},{key:'postChangeCurrentByOneFromLongPress',value:function postChangeCurrentByOneFromLongPress(increment,delayMillis){if(this.mChangeCurrentByOneFromLongPressCommand==null){this.mChangeCurrentByOneFromLongPressCommand=new NumberPicker.ChangeCurrentByOneFromLongPressCommand(this);}else{this.removeCallbacks(this.mChangeCurrentByOneFromLongPressCommand);}this.mChangeCurrentByOneFromLongPressCommand.setStep(increment);this.postDelayed(this.mChangeCurrentByOneFromLongPressCommand,delayMillis);}},{key:'removeChangeCurrentByOneFromLongPress',value:function removeChangeCurrentByOneFromLongPress(){if(this.mChangeCurrentByOneFromLongPressCommand!=null){this.removeCallbacks(this.mChangeCurrentByOneFromLongPressCommand);}}},{key:'postBeginSoftInputOnLongPressCommand',value:function postBeginSoftInputOnLongPressCommand(){if(this.mBeginSoftInputOnLongPressCommand==null){this.mBeginSoftInputOnLongPressCommand=new NumberPicker.BeginSoftInputOnLongPressCommand(this);}else{this.removeCallbacks(this.mBeginSoftInputOnLongPressCommand);}this.postDelayed(this.mBeginSoftInputOnLongPressCommand,ViewConfiguration.getLongPressTimeout());}},{key:'removeBeginSoftInputCommand',value:function removeBeginSoftInputCommand(){if(this.mBeginSoftInputOnLongPressCommand!=null){this.removeCallbacks(this.mBeginSoftInputOnLongPressCommand);}}},{key:'removeAllCallbacks',value:function removeAllCallbacks(){if(this.mChangeCurrentByOneFromLongPressCommand!=null){this.removeCallbacks(this.mChangeCurrentByOneFromLongPressCommand);}if(this.mSetSelectionCommand!=null){this.removeCallbacks(this.mSetSelectionCommand);}if(this.mBeginSoftInputOnLongPressCommand!=null){this.removeCallbacks(this.mBeginSoftInputOnLongPressCommand);}this.mPressedStateHelper.cancel();}},{key:'getSelectedPos',value:function getSelectedPos(value){if(this.mDisplayedValues==null){try{return Integer.parseInt(value);}catch(e){}}else{for(var i=0;i<this.mDisplayedValues.length;i++){value=value.toLowerCase();if(this.mDisplayedValues[i].toLowerCase().startsWith(value)){return this.mMinValue+i;}}try{return Integer.parseInt(value);}catch(e){}}return this.mMinValue;}},{key:'postSetSelectionCommand',value:function postSetSelectionCommand(selectionStart,selectionEnd){if(this.mSetSelectionCommand==null){this.mSetSelectionCommand=new NumberPicker.SetSelectionCommand(this);}else{this.removeCallbacks(this.mSetSelectionCommand);}this.mSetSelectionCommand.mSelectionStart=selectionStart;this.mSetSelectionCommand.mSelectionEnd=selectionEnd;this.post(this.mSetSelectionCommand);}},{key:'ensureScrollWheelAdjusted',value:function ensureScrollWheelAdjusted(){var deltaY=this.mInitialScrollOffset-this.mCurrentScrollOffset;if(deltaY!=0){this.mPreviousScrollerY=0;if(Math.abs(deltaY)>this.mSelectorElementHeight/2){deltaY+=deltaY>0?-this.mSelectorElementHeight:this.mSelectorElementHeight;}this.mAdjustScroller.startScroll(0,0,0,deltaY,NumberPicker.SELECTOR_ADJUSTMENT_DURATION_MILLIS);this.invalidate();return true;}return false;}}],[{key:'getTwoDigitFormatter',value:function getTwoDigitFormatter(){if(!NumberPicker.sTwoDigitFormatter){NumberPicker.sTwoDigitFormatter=new NumberPicker.TwoDigitFormatter();}return NumberPicker.sTwoDigitFormatter;}},{key:'formatNumberWithLocale',value:function formatNumberWithLocale(value){return value+'';}}]);return NumberPicker;}(LinearLayout);NumberPicker.DEFAULT_LONG_PRESS_UPDATE_INTERVAL=300;NumberPicker.SELECTOR_MAX_FLING_VELOCITY_ADJUSTMENT=8;NumberPicker.SELECTOR_ADJUSTMENT_DURATION_MILLIS=800;NumberPicker.SNAP_SCROLL_DURATION=300;NumberPicker.TOP_AND_BOTTOM_FADING_EDGE_STRENGTH=0.9;NumberPicker.UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT=2;NumberPicker.UNSCALED_DEFAULT_SELECTION_DIVIDERS_DISTANCE=48;NumberPicker.SIZE_UNSPECIFIED=-1;widget.NumberPicker=NumberPicker;(function(NumberPicker){var TwoDigitFormatter=function(){function TwoDigitFormatter(){_classCallCheck(this,TwoDigitFormatter);}_createClass(TwoDigitFormatter,[{key:'format',value:function format(value){var s=value+'';if(s.length===1)s='0'+s;return s;}}]);return TwoDigitFormatter;}();NumberPicker.TwoDigitFormatter=TwoDigitFormatter;var OnScrollListener;(function(OnScrollListener){OnScrollListener.SCROLL_STATE_IDLE=0;OnScrollListener.SCROLL_STATE_TOUCH_SCROLL=1;OnScrollListener.SCROLL_STATE_FLING=2;})(OnScrollListener=NumberPicker.OnScrollListener||(NumberPicker.OnScrollListener={}));var PressedStateHelper=function(){function PressedStateHelper(arg){_classCallCheck(this,PressedStateHelper);this.MODE_PRESS=1;this.MODE_TAPPED=2;this.mManagedButton=0;this.mMode=0;this._NumberPicker_this=arg;}_createClass(PressedStateHelper,[{key:'cancel',value:function cancel(){this.mMode=0;this.mManagedButton=0;this._NumberPicker_this.removeCallbacks(this);if(this._NumberPicker_this.mIncrementVirtualButtonPressed){this._NumberPicker_this.mIncrementVirtualButtonPressed=false;this._NumberPicker_this.invalidate(0,this._NumberPicker_this.mBottomSelectionDividerBottom,this._NumberPicker_this.mRight,this._NumberPicker_this.mBottom);}if(this._NumberPicker_this.mDecrementVirtualButtonPressed){this._NumberPicker_this.mDecrementVirtualButtonPressed=false;this._NumberPicker_this.invalidate(0,0,this._NumberPicker_this.mRight,this._NumberPicker_this.mTopSelectionDividerTop);}}},{key:'buttonPressDelayed',value:function buttonPressDelayed(button){this.cancel();this.mMode=this.MODE_PRESS;this.mManagedButton=button;this._NumberPicker_this.postDelayed(this,ViewConfiguration.getTapTimeout());}},{key:'buttonTapped',value:function buttonTapped(button){this.cancel();this.mMode=this.MODE_TAPPED;this.mManagedButton=button;this._NumberPicker_this.post(this);}},{key:'run',value:function run(){switch(this.mMode){case this.MODE_PRESS:{switch(this.mManagedButton){case PressedStateHelper.BUTTON_INCREMENT:{this._NumberPicker_this.mIncrementVirtualButtonPressed=true;this._NumberPicker_this.invalidate(0,this._NumberPicker_this.mBottomSelectionDividerBottom,this._NumberPicker_this.mRight,this._NumberPicker_this.mBottom);}break;case PressedStateHelper.BUTTON_DECREMENT:{this._NumberPicker_this.mDecrementVirtualButtonPressed=true;this._NumberPicker_this.invalidate(0,0,this._NumberPicker_this.mRight,this._NumberPicker_this.mTopSelectionDividerTop);}}}break;case this.MODE_TAPPED:{switch(this.mManagedButton){case PressedStateHelper.BUTTON_INCREMENT:{if(!this._NumberPicker_this.mIncrementVirtualButtonPressed){this._NumberPicker_this.postDelayed(this,ViewConfiguration.getPressedStateDuration());}this._NumberPicker_this.mIncrementVirtualButtonPressed=!this._NumberPicker_this.mIncrementVirtualButtonPressed;this._NumberPicker_this.invalidate(0,this._NumberPicker_this.mBottomSelectionDividerBottom,this._NumberPicker_this.mRight,this._NumberPicker_this.mBottom);}break;case PressedStateHelper.BUTTON_DECREMENT:{if(!this._NumberPicker_this.mDecrementVirtualButtonPressed){this._NumberPicker_this.postDelayed(this,ViewConfiguration.getPressedStateDuration());}this._NumberPicker_this.mDecrementVirtualButtonPressed=!this._NumberPicker_this.mDecrementVirtualButtonPressed;this._NumberPicker_this.invalidate(0,0,this._NumberPicker_this.mRight,this._NumberPicker_this.mTopSelectionDividerTop);}}}break;}}}]);return PressedStateHelper;}();PressedStateHelper.BUTTON_INCREMENT=1;PressedStateHelper.BUTTON_DECREMENT=2;NumberPicker.PressedStateHelper=PressedStateHelper;var SetSelectionCommand=function(){function SetSelectionCommand(arg){_classCallCheck(this,SetSelectionCommand);this.mSelectionStart=0;this.mSelectionEnd=0;this._NumberPicker_this=arg;}_createClass(SetSelectionCommand,[{key:'run',value:function run(){}}]);return SetSelectionCommand;}();NumberPicker.SetSelectionCommand=SetSelectionCommand;var ChangeCurrentByOneFromLongPressCommand=function(){function ChangeCurrentByOneFromLongPressCommand(arg){_classCallCheck(this,ChangeCurrentByOneFromLongPressCommand);this._NumberPicker_this=arg;}_createClass(ChangeCurrentByOneFromLongPressCommand,[{key:'setStep',value:function setStep(increment){this.mIncrement=increment;}},{key:'run',value:function run(){this._NumberPicker_this.changeValueByOne(this.mIncrement);this._NumberPicker_this.postDelayed(this,this._NumberPicker_this.mLongPressUpdateInterval);}}]);return ChangeCurrentByOneFromLongPressCommand;}();NumberPicker.ChangeCurrentByOneFromLongPressCommand=ChangeCurrentByOneFromLongPressCommand;var BeginSoftInputOnLongPressCommand=function(){function BeginSoftInputOnLongPressCommand(arg){_classCallCheck(this,BeginSoftInputOnLongPressCommand);this._NumberPicker_this=arg;}_createClass(BeginSoftInputOnLongPressCommand,[{key:'run',value:function run(){this._NumberPicker_this.showSoftInput();this._NumberPicker_this.mIngonreMoveEvents=true;}}]);return BeginSoftInputOnLongPressCommand;}();NumberPicker.BeginSoftInputOnLongPressCommand=BeginSoftInputOnLongPressCommand;})(NumberPicker=widget.NumberPicker||(widget.NumberPicker={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var graphics;(function(graphics){var drawable;(function(drawable_8){var Rect=android.graphics.Rect;var Gravity=android.view.Gravity;var Drawable=android.graphics.drawable.Drawable;var ClipDrawable=function(_Drawable7){_inherits(ClipDrawable,_Drawable7);function ClipDrawable(){_classCallCheck(this,ClipDrawable);var _this129=_possibleConstructorReturn(this,(ClipDrawable.__proto__||Object.getPrototypeOf(ClipDrawable)).call(this));_this129.mTmpRect=new Rect();if(arguments.length<=1){_this129.mClipState=new ClipDrawable.ClipState(arguments.length<=0?undefined:arguments[0],_this129);}else{_this129.mClipState=new ClipDrawable.ClipState(null,_this129);var _drawable=arguments.length<=0?undefined:arguments[0];var gravity=arguments.length<=1?undefined:arguments[1];var orientation=arguments.length<=2?undefined:arguments[2];_this129.mClipState.mDrawable=_drawable;_this129.mClipState.mGravity=gravity;_this129.mClipState.mOrientation=orientation;if(_drawable!=null){_drawable.setCallback(_this129);}}return _this129;}_createClass(ClipDrawable,[{key:'inflate',value:function inflate(r,parser){_get2(ClipDrawable.prototype.__proto__||Object.getPrototypeOf(ClipDrawable.prototype),'inflate',this).call(this,r,parser);var a=r.obtainAttributes(parser);var orientation=a.getInt(\"android:clipOrientation\",ClipDrawable.HORIZONTAL);var gStr=a.getString(\"android:gravity\");var g=Gravity.parseGravity(gStr,Gravity.LEFT);var dr=a.getDrawable(\"android:drawable\");a.recycle();if(!dr&&parser.children[0]instanceof HTMLElement){dr=Drawable.createFromXml(r,parser.children[0]);}if(dr==null){throw Error('new IllegalArgumentException(\"No drawable specified for <clip>\")');}this.mClipState.mDrawable=dr;this.mClipState.mOrientation=orientation;this.mClipState.mGravity=g;dr.setCallback(this);}},{key:'drawableSizeChange',value:function drawableSizeChange(who){var callback=this.getCallback();if(callback!=null&&callback.drawableSizeChange){callback.drawableSizeChange(this);}}},{key:'invalidateDrawable',value:function invalidateDrawable(who){var callback=this.getCallback();if(callback!=null){callback.invalidateDrawable(this);}}},{key:'scheduleDrawable',value:function scheduleDrawable(who,what,when){var callback=this.getCallback();if(callback!=null){callback.scheduleDrawable(this,what,when);}}},{key:'unscheduleDrawable',value:function unscheduleDrawable(who,what){var callback=this.getCallback();if(callback!=null){callback.unscheduleDrawable(this,what);}}},{key:'getPadding',value:function getPadding(padding){return this.mClipState.mDrawable.getPadding(padding);}},{key:'setVisible',value:function setVisible(visible,restart){this.mClipState.mDrawable.setVisible(visible,restart);return _get2(ClipDrawable.prototype.__proto__||Object.getPrototypeOf(ClipDrawable.prototype),'setVisible',this).call(this,visible,restart);}},{key:'setAlpha',value:function setAlpha(alpha){this.mClipState.mDrawable.setAlpha(alpha);}},{key:'getAlpha',value:function getAlpha(){return this.mClipState.mDrawable.getAlpha();}},{key:'getOpacity',value:function getOpacity(){return this.mClipState.mDrawable.getOpacity();}},{key:'isStateful',value:function isStateful(){return this.mClipState.mDrawable.isStateful();}},{key:'onStateChange',value:function onStateChange(state){return this.mClipState.mDrawable.setState(state);}},{key:'onLevelChange',value:function onLevelChange(level){this.mClipState.mDrawable.setLevel(level);this.invalidateSelf();return true;}},{key:'onBoundsChange',value:function onBoundsChange(bounds){this.mClipState.mDrawable.setBounds(bounds);}},{key:'draw',value:function draw(canvas){if(this.mClipState.mDrawable.getLevel()==0){return;}var r=this.mTmpRect;var bounds=this.getBounds();var level=this.getLevel();var w=bounds.width();var iw=0;if((this.mClipState.mOrientation&ClipDrawable.HORIZONTAL)!=0){w-=(w-iw)*(10000-level)/10000;}var h=bounds.height();var ih=0;if((this.mClipState.mOrientation&ClipDrawable.VERTICAL)!=0){h-=(h-ih)*(10000-level)/10000;}Gravity.apply(this.mClipState.mGravity,w,h,bounds,r);if(w>0&&h>0){canvas.save();canvas.clipRect(r);this.mClipState.mDrawable.draw(canvas);canvas.restore();}}},{key:'getIntrinsicWidth',value:function getIntrinsicWidth(){return this.mClipState.mDrawable.getIntrinsicWidth();}},{key:'getIntrinsicHeight',value:function getIntrinsicHeight(){return this.mClipState.mDrawable.getIntrinsicHeight();}},{key:'getConstantState',value:function getConstantState(){if(this.mClipState.canConstantState()){return this.mClipState;}return null;}}]);return ClipDrawable;}(Drawable);ClipDrawable.HORIZONTAL=1;ClipDrawable.VERTICAL=2;drawable_8.ClipDrawable=ClipDrawable;(function(ClipDrawable){var ClipState=function(){function ClipState(orig,owner){_classCallCheck(this,ClipState);this.mOrientation=0;this.mGravity=0;if(orig!=null){this.mDrawable=orig.mDrawable.getConstantState().newDrawable();this.mDrawable.setCallback(owner);this.mOrientation=orig.mOrientation;this.mGravity=orig.mGravity;this.mCheckedConstantState=this.mCanConstantState=true;}}_createClass(ClipState,[{key:'newDrawable',value:function newDrawable(){return new ClipDrawable(this);}},{key:'canConstantState',value:function canConstantState(){if(!this.mCheckedConstantState){this.mCanConstantState=this.mDrawable.getConstantState()!=null;this.mCheckedConstantState=true;}return this.mCanConstantState;}}]);return ClipState;}();ClipDrawable.ClipState=ClipState;})(ClipDrawable=drawable_8.ClipDrawable||(drawable_8.ClipDrawable={}));})(drawable=graphics.drawable||(graphics.drawable={}));})(graphics=android.graphics||(android.graphics={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var Animatable=android.graphics.drawable.Animatable;var AnimationDrawable=android.graphics.drawable.AnimationDrawable;var LayerDrawable=android.graphics.drawable.LayerDrawable;var StateListDrawable=android.graphics.drawable.StateListDrawable;var ClipDrawable=android.graphics.drawable.ClipDrawable;var SynchronizedPool=android.util.Pools.SynchronizedPool;var Gravity=android.view.Gravity;var View=android.view.View;var AlphaAnimation=android.view.animation.AlphaAnimation;var Animation=android.view.animation.Animation;var LinearInterpolator=android.view.animation.LinearInterpolator;var Transformation=android.view.animation.Transformation;var ArrayList=java.util.ArrayList;var R=android.R;var NetDrawable=androidui.image.NetDrawable;var ProgressBar=function(_View3){_inherits(ProgressBar,_View3);function ProgressBar(context,bindElement){var defStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.R.attr.progressBarStyle;_classCallCheck(this,ProgressBar);var _this130=_possibleConstructorReturn(this,(ProgressBar.__proto__||Object.getPrototypeOf(ProgressBar)).call(this,context,bindElement,defStyle));_this130.mMinWidth=0;_this130.mMaxWidth=0;_this130.mMinHeight=0;_this130.mMaxHeight=0;_this130.mProgress=0;_this130.mSecondaryProgress=0;_this130.mMax=0;_this130.mBehavior=0;_this130.mDuration=0;_this130.mMirrorForRtl=false;_this130.mRefreshData=new ArrayList();_this130.initProgressBar();var a=context.obtainStyledAttributes(bindElement,defStyle);_this130.mNoInvalidate=true;var drawable=a.getDrawable('progressDrawable');if(drawable!=null){drawable=_this130.tileify(drawable,false);_this130.setProgressDrawable(drawable);}_this130.mDuration=a.getInt('indeterminateDuration',_this130.mDuration);_this130.mMinWidth=a.getDimensionPixelSize('minWidth',_this130.mMinWidth);_this130.mMaxWidth=a.getDimensionPixelSize('maxWidth',_this130.mMaxWidth);_this130.mMinHeight=a.getDimensionPixelSize('minHeight',_this130.mMinHeight);_this130.mMaxHeight=a.getDimensionPixelSize('maxHeight',_this130.mMaxHeight);if(a.getAttrValue('indeterminateBehavior')=='cycle'){_this130.mBehavior=Animation.REVERSE;}else{_this130.mBehavior=Animation.RESTART;}_this130.setMax(a.getInt('max',_this130.mMax));_this130.setProgress(a.getInt('progress',_this130.mProgress));_this130.setSecondaryProgress(a.getInt('secondaryProgress',_this130.mSecondaryProgress));drawable=a.getDrawable('indeterminateDrawable');if(drawable!=null){drawable=_this130.tileifyIndeterminate(drawable);_this130.setIndeterminateDrawable(drawable);}_this130.mOnlyIndeterminate=a.getBoolean('indeterminateOnly',_this130.mOnlyIndeterminate);_this130.mNoInvalidate=false;_this130.setIndeterminate(_this130.mOnlyIndeterminate||a.getBoolean('indeterminate',_this130.mIndeterminate));_this130.mMirrorForRtl=a.getBoolean('mirrorForRtl',_this130.mMirrorForRtl);a.recycle();return _this130;}_createClass(ProgressBar,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(ProgressBar.prototype.__proto__||Object.getPrototypeOf(ProgressBar.prototype),'createClassAttrBinder',this).call(this).set('progressDrawable',{setter:function setter(v,value,a){var drawable=a.parseDrawable(value);if(drawable!=null){drawable=v.tileify(drawable,false);v.setProgressDrawable(drawable);}},getter:function getter(v){return v.getProgressDrawable();}}).set('indeterminateDuration',{setter:function setter(v,value,a){v.mDuration=Math.floor(a.parseInt(value,v.mDuration));},getter:function getter(v){return v.mDuration;}}).set('minWidth',{setter:function setter(v,value,a){v.mMinWidth=Math.floor(a.parseNumberPixelSize(value,v.mMinWidth));},getter:function getter(v){return v.mMinWidth;}}).set('maxWidth',{setter:function setter(v,value,a){v.mMaxWidth=Math.floor(a.parseNumberPixelSize(value,v.mMaxWidth));},getter:function getter(v){return v.mMaxWidth;}}).set('minHeight',{setter:function setter(v,value,a){v.mMinHeight=Math.floor(a.parseNumberPixelSize(value,v.mMinHeight));},getter:function getter(v){return v.mMinHeight;}}).set('maxHeight',{setter:function setter(v,value,a){v.mMaxHeight=Math.floor(a.parseNumberPixelSize(value,v.mMaxHeight));},getter:function getter(v){return v.mMaxHeight;}}).set('indeterminateBehavior',{setter:function setter(v,value,a){if(Number.isInteger(Number.parseInt(value))){v.mBehavior=Number.parseInt(value);}else{if(value+''.toLowerCase()=='cycle'){v.mBehavior=Animation.REVERSE;}else{v.mBehavior=Animation.RESTART;}}},getter:function getter(v){return v.mBehavior;}}).set('interpolator',{setter:function setter(v,value,a){},getter:function getter(v){}}).set('max',{setter:function setter(v,value,a){v.setMax(a.parseInt(value,v.mMax));},getter:function getter(v){return v.mMax;}}).set('progress',{setter:function setter(v,value,a){v.setProgress(a.parseInt(value,v.mProgress));},getter:function getter(v){return v.mProgress;}}).set('secondaryProgress',{setter:function setter(v,value,a){v.setSecondaryProgress(a.parseInt(value,v.mSecondaryProgress));},getter:function getter(v){return v.mSecondaryProgress;}}).set('indeterminateDrawable',{setter:function setter(v,value,a){var drawable=a.parseDrawable(value);if(drawable!=null){drawable=v.tileifyIndeterminate(drawable);v.setIndeterminateDrawable(drawable);}},getter:function getter(v){return v.mIndeterminateDrawable;}}).set('indeterminateOnly',{setter:function setter(v,value,a){v.mOnlyIndeterminate=a.parseBoolean(value,v.mOnlyIndeterminate);v.setIndeterminate(v.mOnlyIndeterminate||v.mIndeterminate);},getter:function getter(v){return v.mOnlyIndeterminate;}}).set('indeterminate',{setter:function setter(v,value,a){v.setIndeterminate(v.mOnlyIndeterminate||a.parseBoolean(value,v.mIndeterminate));},getter:function getter(v){return v.mIndeterminate;}});}},{key:'tileify',value:function tileify(drawable,clip){if(drawable instanceof LayerDrawable){var _background2=drawable;var N=_background2.getNumberOfLayers();var outDrawables=new Array(N);var drawableChange=false;for(var i=0;i<N;i++){var id=_background2.getId(i);var orig=_background2.getDrawable(i);outDrawables[i]=this.tileify(orig,id==R.id.progress||id==R.id.secondaryProgress);drawableChange=drawableChange||outDrawables[i]!==orig;}if(!drawableChange)return _background2;var newBg=new LayerDrawable(outDrawables);for(var _i58=0;_i58<N;_i58++){newBg.setId(_i58,_background2.getId(_i58));}return newBg;}else if(drawable instanceof StateListDrawable){var _in=drawable;var out=new StateListDrawable();var numStates=_in.getStateCount();for(var _i59=0;_i59<numStates;_i59++){out.addState(_in.getStateSet(_i59),this.tileify(_in.getStateDrawable(_i59),clip));}return out;}else if(drawable instanceof NetDrawable){var netDrawable=drawable;if(this.mSampleTile==null){this.mSampleTile=netDrawable;}netDrawable.setTileMode(NetDrawable.TileMode.REPEAT,null);return clip?new ClipDrawable(netDrawable,Gravity.LEFT,ClipDrawable.HORIZONTAL):netDrawable;}return drawable;}},{key:'tileifyIndeterminate',value:function tileifyIndeterminate(drawable){if(drawable instanceof AnimationDrawable){var _background3=drawable;var N=_background3.getNumberOfFrames();var newBg=new AnimationDrawable();newBg.setOneShot(_background3.isOneShot());for(var i=0;i<N;i++){var frame=this.tileify(_background3.getFrame(i),true);frame.setLevel(10000);newBg.addFrame(frame,_background3.getDuration(i));}newBg.setLevel(10000);drawable=newBg;}return drawable;}},{key:'initProgressBar',value:function initProgressBar(){this.mMax=100;this.mProgress=0;this.mSecondaryProgress=0;this.mIndeterminate=false;this.mOnlyIndeterminate=false;this.mDuration=4000;this.mBehavior=AlphaAnimation.RESTART;this.mMinWidth=24;this.mMaxWidth=48;this.mMinHeight=24;this.mMaxHeight=48;}},{key:'isIndeterminate',value:function isIndeterminate(){return this.mIndeterminate;}},{key:'setIndeterminate',value:function setIndeterminate(indeterminate){if((!this.mOnlyIndeterminate||!this.mIndeterminate)&&indeterminate!=this.mIndeterminate){this.mIndeterminate=indeterminate;if(indeterminate){this.mCurrentDrawable=this.mIndeterminateDrawable;this.startAnimation();}else{this.mCurrentDrawable=this.mProgressDrawable;this.stopAnimation();}}}},{key:'getIndeterminateDrawable',value:function getIndeterminateDrawable(){return this.mIndeterminateDrawable;}},{key:'setIndeterminateDrawable',value:function setIndeterminateDrawable(d){if(d!=null){d.setCallback(this);}this.mIndeterminateDrawable=d;if(this.mIndeterminate){this.mCurrentDrawable=d;this.postInvalidate();}}},{key:'getProgressDrawable',value:function getProgressDrawable(){return this.mProgressDrawable;}},{key:'setProgressDrawable',value:function setProgressDrawable(d){var needUpdate=void 0;if(this.mProgressDrawable!=null&&d!=this.mProgressDrawable){this.mProgressDrawable.setCallback(null);needUpdate=true;}else{needUpdate=false;}if(d!=null){d.setCallback(this);var drawableHeight=d.getMinimumHeight();if(this.mMaxHeight<drawableHeight){this.mMaxHeight=drawableHeight;this.requestLayout();}}this.mProgressDrawable=d;if(!this.mIndeterminate){this.mCurrentDrawable=d;this.postInvalidate();}if(needUpdate){this.updateDrawableBounds(this.getWidth(),this.getHeight());this.updateDrawableState();this.doRefreshProgress(R.id.progress,this.mProgress,false,false);this.doRefreshProgress(R.id.secondaryProgress,this.mSecondaryProgress,false,false);}}},{key:'getCurrentDrawable',value:function getCurrentDrawable(){return this.mCurrentDrawable;}},{key:'verifyDrawable',value:function verifyDrawable(who){return who==this.mProgressDrawable||who==this.mIndeterminateDrawable||_get2(ProgressBar.prototype.__proto__||Object.getPrototypeOf(ProgressBar.prototype),'verifyDrawable',this).call(this,who);}},{key:'jumpDrawablesToCurrentState',value:function jumpDrawablesToCurrentState(){_get2(ProgressBar.prototype.__proto__||Object.getPrototypeOf(ProgressBar.prototype),'jumpDrawablesToCurrentState',this).call(this);if(this.mProgressDrawable!=null)this.mProgressDrawable.jumpToCurrentState();if(this.mIndeterminateDrawable!=null)this.mIndeterminateDrawable.jumpToCurrentState();}},{key:'postInvalidate',value:function postInvalidate(){if(!this.mNoInvalidate){_get2(ProgressBar.prototype.__proto__||Object.getPrototypeOf(ProgressBar.prototype),'postInvalidate',this).call(this);}}},{key:'doRefreshProgress',value:function doRefreshProgress(id,progress,fromUser,callBackToApp){var scale=this.mMax>0?progress/this.mMax:0;var d=this.mCurrentDrawable;if(d!=null){var progressDrawable=null;if(d instanceof LayerDrawable){progressDrawable=d.findDrawableByLayerId(id);}var level=Math.floor(scale*ProgressBar.MAX_LEVEL);(progressDrawable!=null?progressDrawable:d).setLevel(level);}else{this.invalidate();}if(callBackToApp&&id==R.id.progress){this.onProgressRefresh(scale,fromUser);}}},{key:'onProgressRefresh',value:function onProgressRefresh(scale,fromUser){}},{key:'refreshProgress',value:function refreshProgress(id,progress,fromUser){this.doRefreshProgress(id,progress,fromUser,true);}},{key:'setProgress',value:function setProgress(progress){var fromUser=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(this.mIndeterminate){return;}if(progress<0){progress=0;}if(progress>this.mMax){progress=this.mMax;}if(progress!=this.mProgress){this.mProgress=progress;this.refreshProgress(R.id.progress,this.mProgress,fromUser);}}},{key:'setSecondaryProgress',value:function setSecondaryProgress(secondaryProgress){if(this.mIndeterminate){return;}if(secondaryProgress<0){secondaryProgress=0;}if(secondaryProgress>this.mMax){secondaryProgress=this.mMax;}if(secondaryProgress!=this.mSecondaryProgress){this.mSecondaryProgress=secondaryProgress;this.refreshProgress(R.id.secondaryProgress,this.mSecondaryProgress,false);}}},{key:'getProgress',value:function getProgress(){return this.mIndeterminate?0:this.mProgress;}},{key:'getSecondaryProgress',value:function getSecondaryProgress(){return this.mIndeterminate?0:this.mSecondaryProgress;}},{key:'getMax',value:function getMax(){return this.mMax;}},{key:'setMax',value:function setMax(max){if(max<0){max=0;}if(max!=this.mMax){this.mMax=max;this.postInvalidate();if(this.mProgress>max){this.mProgress=max;}this.refreshProgress(R.id.progress,this.mProgress,false);}}},{key:'incrementProgressBy',value:function incrementProgressBy(diff){this.setProgress(this.mProgress+diff);}},{key:'incrementSecondaryProgressBy',value:function incrementSecondaryProgressBy(diff){this.setSecondaryProgress(this.mSecondaryProgress+diff);}},{key:'startAnimation',value:function startAnimation(){if(this.getVisibility()!=ProgressBar.VISIBLE){return;}if(Animatable.isImpl(this.mIndeterminateDrawable)){this.mShouldStartAnimationDrawable=true;this.mHasAnimation=false;}else{this.mHasAnimation=true;if(this.mInterpolator==null){this.mInterpolator=new LinearInterpolator();}if(this.mTransformation==null){this.mTransformation=new Transformation();}else{this.mTransformation.clear();}if(this.mAnimation==null){this.mAnimation=new AlphaAnimation(0.0,1.0);}else{this.mAnimation.reset();}this.mAnimation.setRepeatMode(this.mBehavior);this.mAnimation.setRepeatCount(Animation.INFINITE);this.mAnimation.setDuration(this.mDuration);this.mAnimation.setInterpolator(this.mInterpolator);this.mAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);}this.postInvalidate();}},{key:'stopAnimation',value:function stopAnimation(){this.mHasAnimation=false;if(Animatable.isImpl(this.mIndeterminateDrawable)){this.mIndeterminateDrawable.stop();this.mShouldStartAnimationDrawable=false;}this.postInvalidate();}},{key:'setInterpolator',value:function setInterpolator(interpolator){this.mInterpolator=interpolator;}},{key:'getInterpolator',value:function getInterpolator(){return this.mInterpolator;}},{key:'setVisibility',value:function setVisibility(v){if(this.getVisibility()!=v){_get2(ProgressBar.prototype.__proto__||Object.getPrototypeOf(ProgressBar.prototype),'setVisibility',this).call(this,v);if(this.mIndeterminate){if(v==ProgressBar.GONE||v==ProgressBar.INVISIBLE){this.stopAnimation();}else{this.startAnimation();}}}}},{key:'onVisibilityChanged',value:function onVisibilityChanged(changedView,visibility){_get2(ProgressBar.prototype.__proto__||Object.getPrototypeOf(ProgressBar.prototype),'onVisibilityChanged',this).call(this,changedView,visibility);if(this.mIndeterminate){if(visibility==ProgressBar.GONE||visibility==ProgressBar.INVISIBLE){this.stopAnimation();}else{this.startAnimation();}}}},{key:'invalidateDrawable',value:function invalidateDrawable(dr){if(!this.mInDrawing){if(this.verifyDrawable(dr)){var dirty=dr.getBounds();var scrollX=this.mScrollX+this.mPaddingLeft;var scrollY=this.mScrollY+this.mPaddingTop;this.invalidate(dirty.left+scrollX,dirty.top+scrollY,dirty.right+scrollX,dirty.bottom+scrollY);}else{_get2(ProgressBar.prototype.__proto__||Object.getPrototypeOf(ProgressBar.prototype),'invalidateDrawable',this).call(this,dr);}}}},{key:'onSizeChanged',value:function onSizeChanged(w,h,oldw,oldh){this.updateDrawableBounds(w,h);}},{key:'updateDrawableBounds',value:function updateDrawableBounds(w,h){w-=this.mPaddingRight+this.mPaddingLeft;h-=this.mPaddingTop+this.mPaddingBottom;var right=w;var bottom=h;var top=0;var left=0;if(this.mIndeterminateDrawable!=null){if(this.mOnlyIndeterminate&&!(this.mIndeterminateDrawable instanceof AnimationDrawable)){var intrinsicWidth=this.mIndeterminateDrawable.getIntrinsicWidth();var intrinsicHeight=this.mIndeterminateDrawable.getIntrinsicHeight();var intrinsicAspect=intrinsicWidth/intrinsicHeight;var boundAspect=w/h;if(intrinsicAspect!=boundAspect){if(boundAspect>intrinsicAspect){var width=Math.floor(h*intrinsicAspect);left=(w-width)/2;right=left+width;}else{var height=Math.floor(w*(1/intrinsicAspect));top=(h-height)/2;bottom=top+height;}}}if(this.isLayoutRtl()&&this.mMirrorForRtl){var tempLeft=left;left=w-right;right=w-tempLeft;}this.mIndeterminateDrawable.setBounds(left,top,right,bottom);}if(this.mProgressDrawable!=null){this.mProgressDrawable.setBounds(0,0,right,bottom);}}},{key:'onDraw',value:function onDraw(canvas){_get2(ProgressBar.prototype.__proto__||Object.getPrototypeOf(ProgressBar.prototype),'onDraw',this).call(this,canvas);var d=this.mCurrentDrawable;if(d!=null){canvas.save();if(this.isLayoutRtl()&&this.mMirrorForRtl){canvas.translate(this.getWidth()-this.mPaddingRight,this.mPaddingTop);canvas.scale(-1.0,1.0);}else{canvas.translate(this.mPaddingLeft,this.mPaddingTop);}var time=this.getDrawingTime();if(this.mHasAnimation){this.mAnimation.getTransformation(time,this.mTransformation);var scale=this.mTransformation.getAlpha();try{this.mInDrawing=true;d.setLevel(Math.floor(scale*ProgressBar.MAX_LEVEL));}finally{this.mInDrawing=false;}this.postInvalidateOnAnimation();}d.draw(canvas);canvas.restore();if(this.mShouldStartAnimationDrawable&&Animatable.isImpl(d)){d.start();this.mShouldStartAnimationDrawable=false;}}}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){var d=this.mCurrentDrawable;var dw=0;var dh=0;if(d!=null){dw=Math.max(this.mMinWidth,Math.min(this.mMaxWidth,d.getIntrinsicWidth()));dh=Math.max(this.mMinHeight,Math.min(this.mMaxHeight,d.getIntrinsicHeight()));}this.updateDrawableState();dw+=this.mPaddingLeft+this.mPaddingRight;dh+=this.mPaddingTop+this.mPaddingBottom;this.setMeasuredDimension(ProgressBar.resolveSizeAndState(dw,widthMeasureSpec,0),ProgressBar.resolveSizeAndState(dh,heightMeasureSpec,0));}},{key:'drawableStateChanged',value:function drawableStateChanged(){_get2(ProgressBar.prototype.__proto__||Object.getPrototypeOf(ProgressBar.prototype),'drawableStateChanged',this).call(this);this.updateDrawableState();}},{key:'updateDrawableState',value:function updateDrawableState(){var state=this.getDrawableState();if(this.mProgressDrawable!=null&&this.mProgressDrawable.isStateful()){this.mProgressDrawable.setState(state);}if(this.mIndeterminateDrawable!=null&&this.mIndeterminateDrawable.isStateful()){this.mIndeterminateDrawable.setState(state);}}},{key:'onAttachedToWindow',value:function onAttachedToWindow(){_get2(ProgressBar.prototype.__proto__||Object.getPrototypeOf(ProgressBar.prototype),'onAttachedToWindow',this).call(this);if(this.mIndeterminate){this.startAnimation();}if(this.mRefreshData!=null){{var count=this.mRefreshData.size();for(var i=0;i<count;i++){var rd=this.mRefreshData.get(i);this.doRefreshProgress(rd.id,rd.progress,rd.fromUser,true);rd.recycle();}this.mRefreshData.clear();}}this.mAttached=true;}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){if(this.mIndeterminate){this.stopAnimation();}_get2(ProgressBar.prototype.__proto__||Object.getPrototypeOf(ProgressBar.prototype),'onDetachedFromWindow',this).call(this);this.mAttached=false;}}]);return ProgressBar;}(View);ProgressBar.MAX_LEVEL=10000;ProgressBar.TIMEOUT_SEND_ACCESSIBILITY_EVENT=200;widget.ProgressBar=ProgressBar;(function(ProgressBar){var RefreshData=function(){function RefreshData(){_classCallCheck(this,RefreshData);this.progress=0;}_createClass(RefreshData,[{key:'recycle',value:function recycle(){RefreshData.sPool.release(this);}}],[{key:'obtain',value:function obtain(id,progress,fromUser){var rd=RefreshData.sPool.acquire();if(rd==null){rd=new RefreshData();}rd.id=id;rd.progress=progress;rd.fromUser=fromUser;return rd;}}]);return RefreshData;}();RefreshData.POOL_MAX=24;RefreshData.sPool=new SynchronizedPool(RefreshData.POOL_MAX);ProgressBar.RefreshData=RefreshData;})(ProgressBar=widget.ProgressBar||(widget.ProgressBar={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var Gravity=android.view.Gravity;var View=android.view.View;var Button=android.widget.Button;var CompoundButton=function(_Button){_inherits(CompoundButton,_Button);function CompoundButton(context,bindElement,defStyle){_classCallCheck(this,CompoundButton);var _this131=_possibleConstructorReturn(this,(CompoundButton.__proto__||Object.getPrototypeOf(CompoundButton)).call(this,context,bindElement,defStyle));_this131.mButtonResource=0;var a=context.obtainStyledAttributes(bindElement,defStyle);var d=a.getDrawable('button');if(d!=null){_this131.setButtonDrawable(d);}var checked=a.getBoolean('checked',false);_this131.setChecked(checked);a.recycle();return _this131;}_createClass(CompoundButton,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(CompoundButton.prototype.__proto__||Object.getPrototypeOf(CompoundButton.prototype),'createClassAttrBinder',this).call(this).set('button',{setter:function setter(v,value,attrBinder){v.setButtonDrawable(attrBinder.parseDrawable(value));},getter:function getter(v){return v.mButtonDrawable;}}).set('checked',{setter:function setter(v,value,attrBinder){v.setChecked(attrBinder.parseBoolean(value,v.isChecked()));},getter:function getter(v){return v.isChecked();}});}},{key:'toggle',value:function toggle(){this.setChecked(!this.mChecked);}},{key:'performClick',value:function performClick(){this.toggle();return _get2(CompoundButton.prototype.__proto__||Object.getPrototypeOf(CompoundButton.prototype),'performClick',this).call(this);}},{key:'isChecked',value:function isChecked(){return this.mChecked;}},{key:'setChecked',value:function setChecked(checked){if(this.mChecked!=checked){this.mChecked=checked;this.refreshDrawableState();if(this.mBroadcasting){return;}this.mBroadcasting=true;if(this.mOnCheckedChangeListener!=null){this.mOnCheckedChangeListener.onCheckedChanged(this,this.mChecked);}if(this.mOnCheckedChangeWidgetListener!=null){this.mOnCheckedChangeWidgetListener.onCheckedChanged(this,this.mChecked);}this.mBroadcasting=false;}}},{key:'setOnCheckedChangeListener',value:function setOnCheckedChangeListener(listener){this.mOnCheckedChangeListener=listener;}},{key:'setOnCheckedChangeWidgetListener',value:function setOnCheckedChangeWidgetListener(listener){this.mOnCheckedChangeWidgetListener=listener;}},{key:'setButtonDrawable',value:function setButtonDrawable(d){if(d!=null){if(this.mButtonDrawable!=null){this.mButtonDrawable.setCallback(null);this.unscheduleDrawable(this.mButtonDrawable);}d.setCallback(this);d.setVisible(this.getVisibility()==CompoundButton.VISIBLE,false);this.mButtonDrawable=d;this.setMinHeight(this.mButtonDrawable.getIntrinsicHeight());}this.refreshDrawableState();}},{key:'getCompoundPaddingLeft',value:function getCompoundPaddingLeft(){var padding=_get2(CompoundButton.prototype.__proto__||Object.getPrototypeOf(CompoundButton.prototype),'getCompoundPaddingLeft',this).call(this);if(!this.isLayoutRtl()){var buttonDrawable=this.mButtonDrawable;if(buttonDrawable!=null){padding+=buttonDrawable.getIntrinsicWidth();}}return padding;}},{key:'getCompoundPaddingRight',value:function getCompoundPaddingRight(){var padding=_get2(CompoundButton.prototype.__proto__||Object.getPrototypeOf(CompoundButton.prototype),'getCompoundPaddingRight',this).call(this);if(this.isLayoutRtl()){var buttonDrawable=this.mButtonDrawable;if(buttonDrawable!=null){padding+=buttonDrawable.getIntrinsicWidth();}}return padding;}},{key:'getHorizontalOffsetForDrawables',value:function getHorizontalOffsetForDrawables(){var buttonDrawable=this.mButtonDrawable;return buttonDrawable!=null?buttonDrawable.getIntrinsicWidth():0;}},{key:'onDraw',value:function onDraw(canvas){_get2(CompoundButton.prototype.__proto__||Object.getPrototypeOf(CompoundButton.prototype),'onDraw',this).call(this,canvas);var buttonDrawable=this.mButtonDrawable;if(buttonDrawable!=null){var verticalGravity=this.getGravity()&Gravity.VERTICAL_GRAVITY_MASK;var drawableHeight=buttonDrawable.getIntrinsicHeight();var drawableWidth=buttonDrawable.getIntrinsicWidth();var top=0;switch(verticalGravity){case Gravity.BOTTOM:top=this.getHeight()-drawableHeight;break;case Gravity.CENTER_VERTICAL:top=(this.getHeight()-drawableHeight)/2;break;}var bottom=top+drawableHeight;var left=this.isLayoutRtl()?this.getWidth()-drawableWidth:0;var right=this.isLayoutRtl()?this.getWidth():drawableWidth;buttonDrawable.setBounds(left,top,right,bottom);buttonDrawable.draw(canvas);}}},{key:'onCreateDrawableState',value:function onCreateDrawableState(extraSpace){var drawableState=_get2(CompoundButton.prototype.__proto__||Object.getPrototypeOf(CompoundButton.prototype),'onCreateDrawableState',this).call(this,extraSpace+1);if(this.isChecked()){CompoundButton.mergeDrawableStates(drawableState,CompoundButton.CHECKED_STATE_SET);}return drawableState;}},{key:'drawableStateChanged',value:function drawableStateChanged(){_get2(CompoundButton.prototype.__proto__||Object.getPrototypeOf(CompoundButton.prototype),'drawableStateChanged',this).call(this);if(this.mButtonDrawable!=null){var myDrawableState=this.getDrawableState();this.mButtonDrawable.setState(myDrawableState);this.invalidate();}}},{key:'drawableSizeChange',value:function drawableSizeChange(d){if(d==this.mButtonDrawable){this.setButtonDrawable(d);this.requestLayout();}else{_get2(CompoundButton.prototype.__proto__||Object.getPrototypeOf(CompoundButton.prototype),'drawableSizeChange',this).call(this,d);}}},{key:'verifyDrawable',value:function verifyDrawable(who){return _get2(CompoundButton.prototype.__proto__||Object.getPrototypeOf(CompoundButton.prototype),'verifyDrawable',this).call(this,who)||who==this.mButtonDrawable;}},{key:'jumpDrawablesToCurrentState',value:function jumpDrawablesToCurrentState(){_get2(CompoundButton.prototype.__proto__||Object.getPrototypeOf(CompoundButton.prototype),'jumpDrawablesToCurrentState',this).call(this);if(this.mButtonDrawable!=null)this.mButtonDrawable.jumpToCurrentState();}}]);return CompoundButton;}(Button);CompoundButton.CHECKED_STATE_SET=[View.VIEW_STATE_CHECKED];widget.CompoundButton=CompoundButton;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var CompoundButton=android.widget.CompoundButton;var CheckBox=function(_CompoundButton){_inherits(CheckBox,_CompoundButton);function CheckBox(context,bindElement){var defStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.R.attr.checkboxStyle;_classCallCheck(this,CheckBox);return _possibleConstructorReturn(this,(CheckBox.__proto__||Object.getPrototypeOf(CheckBox)).call(this,context,bindElement,defStyle));}return CheckBox;}(CompoundButton);widget.CheckBox=CheckBox;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var CompoundButton=android.widget.CompoundButton;var RadioButton=function(_CompoundButton2){_inherits(RadioButton,_CompoundButton2);function RadioButton(context,bindElement){var defStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.R.attr.radiobuttonStyle;_classCallCheck(this,RadioButton);return _possibleConstructorReturn(this,(RadioButton.__proto__||Object.getPrototypeOf(RadioButton)).call(this,context,bindElement,defStyle));}_createClass(RadioButton,[{key:'toggle',value:function toggle(){if(!this.isChecked()){_get2(RadioButton.prototype.__proto__||Object.getPrototypeOf(RadioButton.prototype),'toggle',this).call(this);}}}]);return RadioButton;}(CompoundButton);widget.RadioButton=RadioButton;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var View=android.view.View;var LinearLayout=android.widget.LinearLayout;var RadioButton=android.widget.RadioButton;var RadioGroup=function(_LinearLayout2){_inherits(RadioGroup,_LinearLayout2);function RadioGroup(context,bindElement,defStyle){_classCallCheck(this,RadioGroup);var _this134=_possibleConstructorReturn(this,(RadioGroup.__proto__||Object.getPrototypeOf(RadioGroup)).call(this,context,bindElement,defStyle));_this134.mCheckedId=View.NO_ID;_this134.mProtectFromCheckedChange=false;var attributes=context.obtainStyledAttributes(bindElement,defStyle);var value=attributes.getString('checkedButton');if(value){_this134.mCheckedId=value;}var orientation=attributes.getString('orientation');if(orientation==='horizontal'){_this134.setOrientation(RadioGroup.HORIZONTAL);}else{_this134.setOrientation(RadioGroup.VERTICAL);}attributes.recycle();_this134.init();return _this134;}_createClass(RadioGroup,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(RadioGroup.prototype.__proto__||Object.getPrototypeOf(RadioGroup.prototype),'createClassAttrBinder',this).call(this).set('checkedButton',{setter:function setter(v,value){if(typeof value==='string'||value==null){v.setCheckedId(value);}}});}},{key:'init',value:function init(){this.mChildOnCheckedChangeListener=new RadioGroup.CheckedStateTracker(this);this.mPassThroughListener=new RadioGroup.PassThroughHierarchyChangeListener(this);_get2(RadioGroup.prototype.__proto__||Object.getPrototypeOf(RadioGroup.prototype),'setOnHierarchyChangeListener',this).call(this,this.mPassThroughListener);}},{key:'setOnHierarchyChangeListener',value:function setOnHierarchyChangeListener(listener){this.mPassThroughListener.mOnHierarchyChangeListener=listener;}},{key:'onFinishInflate',value:function onFinishInflate(){_get2(RadioGroup.prototype.__proto__||Object.getPrototypeOf(RadioGroup.prototype),'onFinishInflate',this).call(this);if(this.mCheckedId!=null){this.mProtectFromCheckedChange=true;this.setCheckedStateForView(this.mCheckedId,true);this.mProtectFromCheckedChange=false;this.setCheckedId(this.mCheckedId);}}},{key:'addView',value:function addView(){var _get6;for(var _len31=arguments.length,args=Array(_len31),_key32=0;_key32<_len31;_key32++){args[_key32]=arguments[_key32];}var child=args[0];if(child instanceof RadioButton){var button=child;if(button.isChecked()){this.mProtectFromCheckedChange=true;if(this.mCheckedId!=null){this.setCheckedStateForView(this.mCheckedId,false);}this.mProtectFromCheckedChange=false;this.setCheckedId(button.getId());}}(_get6=_get2(RadioGroup.prototype.__proto__||Object.getPrototypeOf(RadioGroup.prototype),'addView',this)).call.apply(_get6,[this].concat(args));}},{key:'check',value:function check(id){if(id!=null&&id==this.mCheckedId){return;}if(this.mCheckedId!=null){this.setCheckedStateForView(this.mCheckedId,false);}if(id!=null){this.setCheckedStateForView(id,true);}this.setCheckedId(id);}},{key:'setCheckedId',value:function setCheckedId(id){this.mCheckedId=id;if(this.mOnCheckedChangeListener!=null){this.mOnCheckedChangeListener.onCheckedChanged(this,this.mCheckedId);}}},{key:'setCheckedStateForView',value:function setCheckedStateForView(viewId,checked){var checkedView=this.findViewById(viewId);if(checkedView!=null&&checkedView instanceof RadioButton){checkedView.setChecked(checked);}}},{key:'getCheckedRadioButtonId',value:function getCheckedRadioButtonId(){return this.mCheckedId;}},{key:'clearCheck',value:function clearCheck(){this.check(null);}},{key:'setOnCheckedChangeListener',value:function setOnCheckedChangeListener(listener){this.mOnCheckedChangeListener=listener;}},{key:'generateLayoutParamsFromAttr',value:function generateLayoutParamsFromAttr(attrs){return new RadioGroup.LayoutParams(this.getContext(),attrs);}},{key:'checkLayoutParams',value:function checkLayoutParams(p){return p instanceof RadioGroup.LayoutParams;}},{key:'generateDefaultLayoutParams',value:function generateDefaultLayoutParams(){return new RadioGroup.LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT,RadioGroup.LayoutParams.WRAP_CONTENT);}}]);return RadioGroup;}(LinearLayout);widget.RadioGroup=RadioGroup;(function(RadioGroup){var LayoutParams=function(_LinearLayout$LayoutP){_inherits(LayoutParams,_LinearLayout$LayoutP);function LayoutParams(){_classCallCheck(this,LayoutParams);return _possibleConstructorReturn(this,(LayoutParams.__proto__||Object.getPrototypeOf(LayoutParams)).apply(this,arguments));}_createClass(LayoutParams,[{key:'setBaseAttributes',value:function setBaseAttributes(a,widthAttr,heightAttr){if(a.hasValue(widthAttr)){this.width=a.getLayoutDimension(widthAttr,LayoutParams.WRAP_CONTENT);}else{this.width=LayoutParams.WRAP_CONTENT;}if(a.hasValue(heightAttr)){this.height=a.getLayoutDimension(heightAttr,LayoutParams.WRAP_CONTENT);}else{this.height=LayoutParams.WRAP_CONTENT;}}}]);return LayoutParams;}(LinearLayout.LayoutParams);RadioGroup.LayoutParams=LayoutParams;var CheckedStateTracker=function(){function CheckedStateTracker(arg){_classCallCheck(this,CheckedStateTracker);this._RadioGroup_this=arg;}_createClass(CheckedStateTracker,[{key:'onCheckedChanged',value:function onCheckedChanged(buttonView,isChecked){if(this._RadioGroup_this.mProtectFromCheckedChange){return;}this._RadioGroup_this.mProtectFromCheckedChange=true;if(this._RadioGroup_this.mCheckedId!=null){this._RadioGroup_this.setCheckedStateForView(this._RadioGroup_this.mCheckedId,false);}this._RadioGroup_this.mProtectFromCheckedChange=false;var id=buttonView.getId();this._RadioGroup_this.setCheckedId(id);}}]);return CheckedStateTracker;}();RadioGroup.CheckedStateTracker=CheckedStateTracker;var PassThroughHierarchyChangeListener=function(){function PassThroughHierarchyChangeListener(arg){_classCallCheck(this,PassThroughHierarchyChangeListener);this._RadioGroup_this=arg;}_createClass(PassThroughHierarchyChangeListener,[{key:'onChildViewAdded',value:function onChildViewAdded(parent,child){if(parent==this._RadioGroup_this&&child instanceof RadioButton){var id=child.getId();if(id==View.NO_ID){id='hash'+child.hashCode();child.setId(id);}child.setOnCheckedChangeWidgetListener(this._RadioGroup_this.mChildOnCheckedChangeListener);}if(this.mOnHierarchyChangeListener!=null){this.mOnHierarchyChangeListener.onChildViewAdded(parent,child);}}},{key:'onChildViewRemoved',value:function onChildViewRemoved(parent,child){if(parent==this._RadioGroup_this&&child instanceof RadioButton){child.setOnCheckedChangeWidgetListener(null);}if(this.mOnHierarchyChangeListener!=null){this.mOnHierarchyChangeListener.onChildViewRemoved(parent,child);}}}]);return PassThroughHierarchyChangeListener;}();RadioGroup.PassThroughHierarchyChangeListener=PassThroughHierarchyChangeListener;})(RadioGroup=widget.RadioGroup||(widget.RadioGroup={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var Gravity=android.view.Gravity;var TextView=android.widget.TextView;var View=android.view.View;var CheckedTextView=function(_TextView2){_inherits(CheckedTextView,_TextView2);function CheckedTextView(context,bindElement){var defStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.R.attr.checkedTextViewStyle;_classCallCheck(this,CheckedTextView);var _this136=_possibleConstructorReturn(this,(CheckedTextView.__proto__||Object.getPrototypeOf(CheckedTextView)).call(this,context,bindElement,defStyle));_this136.mCheckMarkResource=0;_this136.mBasePadding=0;_this136.mCheckMarkWidth=0;var a=context.obtainStyledAttributes(bindElement,defStyle);var d=a.getDrawable('checkMark');if(d!=null){_this136.setCheckMarkDrawable(d);}var checked=a.getBoolean('checked',false);_this136.setChecked(checked);a.recycle();return _this136;}_createClass(CheckedTextView,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(CheckedTextView.prototype.__proto__||Object.getPrototypeOf(CheckedTextView.prototype),'createClassAttrBinder',this).call(this).set('checkMark',{setter:function setter(v,value,attrBinder){v.setCheckMarkDrawable(attrBinder.parseDrawable(value));},getter:function getter(v){return v.getCheckMarkDrawable();}}).set('checked',{setter:function setter(v,value,attrBinder){v.setChecked(attrBinder.parseBoolean(value,false));},getter:function getter(v){return v.isChecked();}});}},{key:'toggle',value:function toggle(){this.setChecked(!this.mChecked);}},{key:'isChecked',value:function isChecked(){return this.mChecked;}},{key:'setChecked',value:function setChecked(checked){if(this.mChecked!=checked){this.mChecked=checked;this.refreshDrawableState();}}},{key:'setCheckMarkDrawable',value:function setCheckMarkDrawable(d){if(this.mCheckMarkDrawable!=null){this.mCheckMarkDrawable.setCallback(null);this.unscheduleDrawable(this.mCheckMarkDrawable);}this.mNeedRequestlayout=d!=this.mCheckMarkDrawable;if(d!=null){d.setCallback(this);d.setVisible(this.getVisibility()==CheckedTextView.VISIBLE,false);d.setState(CheckedTextView.CHECKED_STATE_SET);this.setMinHeight(d.getIntrinsicHeight());this.mCheckMarkWidth=d.getIntrinsicWidth();d.setState(this.getDrawableState());}else{this.mCheckMarkWidth=0;}this.mCheckMarkDrawable=d;this.resolvePadding();}},{key:'getCheckMarkDrawable',value:function getCheckMarkDrawable(){return this.mCheckMarkDrawable;}},{key:'setPadding',value:function setPadding(left,top,right,bottom){_get2(CheckedTextView.prototype.__proto__||Object.getPrototypeOf(CheckedTextView.prototype),'setPadding',this).call(this,left,top,right,bottom);this.setBasePadding(this.isLayoutRtl());}},{key:'updatePadding',value:function updatePadding(){var newPadding=this.mCheckMarkDrawable!=null?this.mCheckMarkWidth+this.mBasePadding:this.mBasePadding;if(this.isLayoutRtl()){this.mNeedRequestlayout=this.mPaddingLeft!=newPadding||this.mNeedRequestlayout;this.mPaddingLeft=newPadding;}else{this.mNeedRequestlayout=this.mPaddingRight!=newPadding||this.mNeedRequestlayout;this.mPaddingRight=newPadding;}if(this.mNeedRequestlayout){this.requestLayout();this.mNeedRequestlayout=false;}}},{key:'setBasePadding',value:function setBasePadding(isLayoutRtl){if(isLayoutRtl){this.mBasePadding=this.mPaddingLeft;}else{this.mBasePadding=this.mPaddingRight;}}},{key:'onDraw',value:function onDraw(canvas){_get2(CheckedTextView.prototype.__proto__||Object.getPrototypeOf(CheckedTextView.prototype),'onDraw',this).call(this,canvas);var checkMarkDrawable=this.mCheckMarkDrawable;if(checkMarkDrawable!=null){var verticalGravity=this.getGravity()&Gravity.VERTICAL_GRAVITY_MASK;var height=checkMarkDrawable.getIntrinsicHeight();var _y17=0;switch(verticalGravity){case Gravity.BOTTOM:_y17=this.getHeight()-height;break;case Gravity.CENTER_VERTICAL:_y17=(this.getHeight()-height)/2;break;}var isLayoutRtl=this.isLayoutRtl();var width=this.getWidth();var top=_y17;var bottom=top+height;var left=void 0;var right=void 0;if(isLayoutRtl){left=this.mBasePadding;right=left+this.mCheckMarkWidth;}else{right=width-this.mBasePadding;left=right-this.mCheckMarkWidth;}checkMarkDrawable.setBounds(this.mScrollX+left,top,this.mScrollX+right,bottom);checkMarkDrawable.draw(canvas);}}},{key:'onCreateDrawableState',value:function onCreateDrawableState(extraSpace){var drawableState=_get2(CheckedTextView.prototype.__proto__||Object.getPrototypeOf(CheckedTextView.prototype),'onCreateDrawableState',this).call(this,extraSpace+1);if(this.isChecked()){CheckedTextView.mergeDrawableStates(drawableState,CheckedTextView.CHECKED_STATE_SET);}return drawableState;}},{key:'drawableStateChanged',value:function drawableStateChanged(){_get2(CheckedTextView.prototype.__proto__||Object.getPrototypeOf(CheckedTextView.prototype),'drawableStateChanged',this).call(this);if(this.mCheckMarkDrawable!=null){var myDrawableState=this.getDrawableState();this.mCheckMarkDrawable.setState(myDrawableState);this.invalidate();}}}]);return CheckedTextView;}(TextView);CheckedTextView.CHECKED_STATE_SET=[View.VIEW_STATE_CHECKED];widget.CheckedTextView=CheckedTextView;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var KeyEvent=android.view.KeyEvent;var MotionEvent=android.view.MotionEvent;var Integer=java.lang.Integer;var ProgressBar=android.widget.ProgressBar;var AbsSeekBar=function(_ProgressBar){_inherits(AbsSeekBar,_ProgressBar);function AbsSeekBar(context,bindElement,defStyle){_classCallCheck(this,AbsSeekBar);var _this137=_possibleConstructorReturn(this,(AbsSeekBar.__proto__||Object.getPrototypeOf(AbsSeekBar)).call(this,context,bindElement,defStyle));_this137.mThumbOffset=0;_this137.mTouchProgressOffset=0;_this137.mIsUserSeekable=true;_this137.mKeyProgressIncrement=1;_this137.mDisabledAlpha=0;_this137.mTouchDownX=0;var a=context.obtainStyledAttributes(bindElement,defStyle);var thumb=a.getDrawable('thumb');_this137.setThumb(thumb);var thumbOffset=a.getDimensionPixelOffset('thumbOffset',_this137.getThumbOffset());_this137.setThumbOffset(thumbOffset);a.recycle();a=context.obtainStyledAttributes(bindElement,defStyle);_this137.mDisabledAlpha=a.getFloat('disabledAlpha',0.5);a.recycle();return _this137;}_createClass(AbsSeekBar,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(AbsSeekBar.prototype.__proto__||Object.getPrototypeOf(AbsSeekBar.prototype),'createClassAttrBinder',this).call(this).set('thumb',{setter:function setter(v,value,attrBinder){v.setThumb(attrBinder.parseDrawable(value));},getter:function getter(v){return v.mThumb;}}).set('thumbOffset',{setter:function setter(v,value,attrBinder){v.setThumbOffset(attrBinder.parseNumberPixelOffset(value));},getter:function getter(v){return v.mThumbOffset;}}).set('disabledAlpha',{setter:function setter(v,value,attrBinder){v.mDisabledAlpha=attrBinder.parseFloat(value,0.5);},getter:function getter(v){return v.mDisabledAlpha;}});}},{key:'setThumb',value:function setThumb(thumb){var needUpdate=void 0;if(this.mThumb!=null&&thumb!=this.mThumb){this.mThumb.setCallback(null);needUpdate=true;}else{needUpdate=false;}if(thumb!=null){thumb.setCallback(this);this.mThumbOffset=thumb.getIntrinsicWidth()/2;if(needUpdate&&(thumb.getIntrinsicWidth()!=this.mThumb.getIntrinsicWidth()||thumb.getIntrinsicHeight()!=this.mThumb.getIntrinsicHeight())){this.requestLayout();}}this.mThumb=thumb;this.invalidate();if(needUpdate){this.updateThumbPos(this.getWidth(),this.getHeight());if(thumb!=null&&thumb.isStateful()){var state=this.getDrawableState();thumb.setState(state);}}}},{key:'getThumb',value:function getThumb(){return this.mThumb;}},{key:'getThumbOffset',value:function getThumbOffset(){return this.mThumbOffset;}},{key:'setThumbOffset',value:function setThumbOffset(thumbOffset){this.mThumbOffset=thumbOffset;this.invalidate();}},{key:'setKeyProgressIncrement',value:function setKeyProgressIncrement(increment){this.mKeyProgressIncrement=increment<0?-increment:increment;}},{key:'getKeyProgressIncrement',value:function getKeyProgressIncrement(){return this.mKeyProgressIncrement;}},{key:'setMax',value:function setMax(max){_get2(AbsSeekBar.prototype.__proto__||Object.getPrototypeOf(AbsSeekBar.prototype),'setMax',this).call(this,max);if(this.mKeyProgressIncrement==0||this.getMax()/this.mKeyProgressIncrement>20){this.setKeyProgressIncrement(Math.max(1,Math.round(this.getMax()/20)));}}},{key:'verifyDrawable',value:function verifyDrawable(who){return who==this.mThumb||_get2(AbsSeekBar.prototype.__proto__||Object.getPrototypeOf(AbsSeekBar.prototype),'verifyDrawable',this).call(this,who);}},{key:'jumpDrawablesToCurrentState',value:function jumpDrawablesToCurrentState(){_get2(AbsSeekBar.prototype.__proto__||Object.getPrototypeOf(AbsSeekBar.prototype),'jumpDrawablesToCurrentState',this).call(this);if(this.mThumb!=null)this.mThumb.jumpToCurrentState();}},{key:'drawableStateChanged',value:function drawableStateChanged(){_get2(AbsSeekBar.prototype.__proto__||Object.getPrototypeOf(AbsSeekBar.prototype),'drawableStateChanged',this).call(this);var progressDrawable=this.getProgressDrawable();if(progressDrawable!=null){progressDrawable.setAlpha(this.isEnabled()?AbsSeekBar.NO_ALPHA:Math.floor(AbsSeekBar.NO_ALPHA*this.mDisabledAlpha));}if(this.mThumb!=null&&this.mThumb.isStateful()){var state=this.getDrawableState();this.mThumb.setState(state);}}},{key:'onProgressRefresh',value:function onProgressRefresh(scale,fromUser){_get2(AbsSeekBar.prototype.__proto__||Object.getPrototypeOf(AbsSeekBar.prototype),'onProgressRefresh',this).call(this,scale,fromUser);var thumb=this.mThumb;if(thumb!=null){this.setThumbPos(this.getWidth(),thumb,scale,Integer.MIN_VALUE);this.invalidate();}}},{key:'onSizeChanged',value:function onSizeChanged(w,h,oldw,oldh){_get2(AbsSeekBar.prototype.__proto__||Object.getPrototypeOf(AbsSeekBar.prototype),'onSizeChanged',this).call(this,w,h,oldw,oldh);this.updateThumbPos(w,h);}},{key:'updateThumbPos',value:function updateThumbPos(w,h){var d=this.getCurrentDrawable();var thumb=this.mThumb;var thumbHeight=thumb==null?0:thumb.getIntrinsicHeight();var trackHeight=Math.min(this.mMaxHeight,h-this.mPaddingTop-this.mPaddingBottom);var max=this.getMax();var scale=max>0?this.getProgress()/max:0;if(thumbHeight>trackHeight){if(thumb!=null){this.setThumbPos(w,thumb,scale,0);}var gapForCenteringTrack=(thumbHeight-trackHeight)/2;if(d!=null){d.setBounds(0,gapForCenteringTrack,w-this.mPaddingRight-this.mPaddingLeft,h-this.mPaddingBottom-gapForCenteringTrack-this.mPaddingTop);}}else{if(d!=null){d.setBounds(0,0,w-this.mPaddingRight-this.mPaddingLeft,h-this.mPaddingBottom-this.mPaddingTop);}var gap=(trackHeight-thumbHeight)/2;if(thumb!=null){this.setThumbPos(w,thumb,scale,gap);}}}},{key:'setThumbPos',value:function setThumbPos(w,thumb,scale,gap){var available=w-this.mPaddingLeft-this.mPaddingRight;var thumbWidth=thumb.getIntrinsicWidth();var thumbHeight=thumb.getIntrinsicHeight();available-=thumbWidth;available+=this.mThumbOffset*2;var thumbPos=Math.floor(scale*available);var topBound=void 0,bottomBound=void 0;if(gap==Integer.MIN_VALUE){var oldBounds=thumb.getBounds();topBound=oldBounds.top;bottomBound=oldBounds.bottom;}else{topBound=gap;bottomBound=gap+thumbHeight;}var left=this.isLayoutRtl()&&this.mMirrorForRtl?available-thumbPos:thumbPos;thumb.setBounds(left,topBound,left+thumbWidth,bottomBound);}},{key:'onDraw',value:function onDraw(canvas){_get2(AbsSeekBar.prototype.__proto__||Object.getPrototypeOf(AbsSeekBar.prototype),'onDraw',this).call(this,canvas);if(this.mThumb!=null){canvas.save();canvas.translate(this.mPaddingLeft-this.mThumbOffset,this.mPaddingTop);this.mThumb.draw(canvas);canvas.restore();}}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){var d=this.getCurrentDrawable();var thumbHeight=this.mThumb==null?0:this.mThumb.getIntrinsicHeight();var dw=0;var dh=0;if(d!=null){dw=Math.max(this.mMinWidth,Math.min(this.mMaxWidth,d.getIntrinsicWidth()));dh=Math.max(this.mMinHeight,Math.min(this.mMaxHeight,d.getIntrinsicHeight()));dh=Math.max(thumbHeight,dh);}dw+=this.mPaddingLeft+this.mPaddingRight;dh+=this.mPaddingTop+this.mPaddingBottom;this.setMeasuredDimension(AbsSeekBar.resolveSizeAndState(dw,widthMeasureSpec,0),AbsSeekBar.resolveSizeAndState(dh,heightMeasureSpec,0));}},{key:'onTouchEvent',value:function onTouchEvent(event){if(!this.mIsUserSeekable||!this.isEnabled()){return false;}switch(event.getAction()){case MotionEvent.ACTION_DOWN:if(this.isInScrollingContainer()){this.mTouchDownX=event.getX();}else{this.setPressed(true);if(this.mThumb!=null){this.invalidate(this.mThumb.getBounds());}this.onStartTrackingTouch();this.trackTouchEvent(event);this.attemptClaimDrag();}break;case MotionEvent.ACTION_MOVE:if(this.mIsDragging){this.trackTouchEvent(event);}else{var _x205=event.getX();if(Math.abs(_x205-this.mTouchDownX)>this.mTouchSlop){this.setPressed(true);if(this.mThumb!=null){this.invalidate(this.mThumb.getBounds());}this.onStartTrackingTouch();this.trackTouchEvent(event);this.attemptClaimDrag();}}break;case MotionEvent.ACTION_UP:if(this.mIsDragging){this.trackTouchEvent(event);this.onStopTrackingTouch();this.setPressed(false);}else{this.onStartTrackingTouch();this.trackTouchEvent(event);this.onStopTrackingTouch();}this.invalidate();break;case MotionEvent.ACTION_CANCEL:if(this.mIsDragging){this.onStopTrackingTouch();this.setPressed(false);}this.invalidate();break;}return true;}},{key:'trackTouchEvent',value:function trackTouchEvent(event){var width=this.getWidth();var available=width-this.mPaddingLeft-this.mPaddingRight;var x=Math.floor(event.getX());var scale=void 0;var progress=0;if(this.isLayoutRtl()&&this.mMirrorForRtl){if(x>width-this.mPaddingRight){scale=0.0;}else if(x<this.mPaddingLeft){scale=1.0;}else{scale=(available-x+this.mPaddingLeft)/available;progress=this.mTouchProgressOffset;}}else{if(x<this.mPaddingLeft){scale=0.0;}else if(x>width-this.mPaddingRight){scale=1.0;}else{scale=(x-this.mPaddingLeft)/available;progress=this.mTouchProgressOffset;}}var max=this.getMax();progress+=scale*max;this.setProgress(Math.floor(progress),true);}},{key:'attemptClaimDrag',value:function attemptClaimDrag(){if(this.mParent!=null){this.mParent.requestDisallowInterceptTouchEvent(true);}}},{key:'onStartTrackingTouch',value:function onStartTrackingTouch(){this.mIsDragging=true;}},{key:'onStopTrackingTouch',value:function onStopTrackingTouch(){this.mIsDragging=false;}},{key:'onKeyChange',value:function onKeyChange(){}},{key:'onKeyDown',value:function onKeyDown(keyCode,event){if(this.isEnabled()){var progress=this.getProgress();switch(keyCode){case KeyEvent.KEYCODE_DPAD_LEFT:if(progress<=0)break;this.setProgress(progress-this.mKeyProgressIncrement,true);this.onKeyChange();return true;case KeyEvent.KEYCODE_DPAD_RIGHT:if(progress>=this.getMax())break;this.setProgress(progress+this.mKeyProgressIncrement,true);this.onKeyChange();return true;}}return _get2(AbsSeekBar.prototype.__proto__||Object.getPrototypeOf(AbsSeekBar.prototype),'onKeyDown',this).call(this,keyCode,event);}}]);return AbsSeekBar;}(ProgressBar);AbsSeekBar.NO_ALPHA=0xFF;widget.AbsSeekBar=AbsSeekBar;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var AbsSeekBar=android.widget.AbsSeekBar;var SeekBar=function(_AbsSeekBar){_inherits(SeekBar,_AbsSeekBar);function SeekBar(context,bindElement){var defStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.R.attr.seekBarStyle;_classCallCheck(this,SeekBar);return _possibleConstructorReturn(this,(SeekBar.__proto__||Object.getPrototypeOf(SeekBar)).call(this,context,bindElement,defStyle));}_createClass(SeekBar,[{key:'onProgressRefresh',value:function onProgressRefresh(scale,fromUser){_get2(SeekBar.prototype.__proto__||Object.getPrototypeOf(SeekBar.prototype),'onProgressRefresh',this).call(this,scale,fromUser);if(this.mOnSeekBarChangeListener!=null){this.mOnSeekBarChangeListener.onProgressChanged(this,this.getProgress(),fromUser);}}},{key:'setOnSeekBarChangeListener',value:function setOnSeekBarChangeListener(l){this.mOnSeekBarChangeListener=l;}},{key:'onStartTrackingTouch',value:function onStartTrackingTouch(){_get2(SeekBar.prototype.__proto__||Object.getPrototypeOf(SeekBar.prototype),'onStartTrackingTouch',this).call(this);if(this.mOnSeekBarChangeListener!=null){this.mOnSeekBarChangeListener.onStartTrackingTouch(this);}}},{key:'onStopTrackingTouch',value:function onStopTrackingTouch(){_get2(SeekBar.prototype.__proto__||Object.getPrototypeOf(SeekBar.prototype),'onStopTrackingTouch',this).call(this);if(this.mOnSeekBarChangeListener!=null){this.mOnSeekBarChangeListener.onStopTrackingTouch(this);}}}]);return SeekBar;}(AbsSeekBar);widget.SeekBar=SeekBar;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var AbsSeekBar=android.widget.AbsSeekBar;var RatingBar=function(_AbsSeekBar2){_inherits(RatingBar,_AbsSeekBar2);function RatingBar(context,bindElement){var defStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.R.attr.ratingBarStyle;_classCallCheck(this,RatingBar);var _this139=_possibleConstructorReturn(this,(RatingBar.__proto__||Object.getPrototypeOf(RatingBar)).call(this,context,bindElement,defStyle));_this139.mNumStars=5;_this139.mProgressOnStartTracking=0;var a=context.obtainStyledAttributes(bindElement,defStyle);var numStars=a.getInt('numStars',_this139.mNumStars);_this139.setIsIndicator(a.getBoolean('isIndicator',!_this139.mIsUserSeekable));var rating=a.getFloat('rating',-1);var stepSize=a.getFloat('stepSize',-1);a.recycle();if(numStars>0&&numStars!=_this139.mNumStars){_this139.setNumStars(numStars);}if(stepSize>=0){_this139.setStepSize(stepSize);}else{_this139.setStepSize(0.5);}if(rating>=0){_this139.setRating(rating);}_this139.mTouchProgressOffset=1.1;return _this139;}_createClass(RatingBar,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(RatingBar.prototype.__proto__||Object.getPrototypeOf(RatingBar.prototype),'createClassAttrBinder',this).call(this).set('numStars',{setter:function setter(v,value,a){v.setNumStars(a.parseInt(value,v.mNumStars));},getter:function getter(v){return v.mNumStars;}}).set('isIndicator',{setter:function setter(v,value,a){v.setIsIndicator(a.parseBoolean(value,!v.mIsUserSeekable));},getter:function getter(v){return v.isIndicator();}}).set('stepSize',{setter:function setter(v,value,a){v.setStepSize(a.parseFloat(value,0.5));},getter:function getter(v){return v.getStepSize();}}).set('rating',{setter:function setter(v,value,a){v.setRating(a.parseFloat(value,v.getRating()));},getter:function getter(v){return v.getRating();}});}},{key:'setOnRatingBarChangeListener',value:function setOnRatingBarChangeListener(listener){this.mOnRatingBarChangeListener=listener;}},{key:'getOnRatingBarChangeListener',value:function getOnRatingBarChangeListener(){return this.mOnRatingBarChangeListener;}},{key:'setIsIndicator',value:function setIsIndicator(isIndicator){this.mIsUserSeekable=!isIndicator;this.setFocusable(!isIndicator);}},{key:'isIndicator',value:function isIndicator(){return!this.mIsUserSeekable;}},{key:'setNumStars',value:function setNumStars(numStars){if(numStars<=0){return;}var step=this.getStepSize();this.mNumStars=numStars;this.setStepSize(step);this.requestLayout();}},{key:'getNumStars',value:function getNumStars(){return this.mNumStars;}},{key:'setRating',value:function setRating(rating){this.setProgress(Math.round(rating*this.getProgressPerStar()));}},{key:'getRating',value:function getRating(){return this.getProgress()/this.getProgressPerStar();}},{key:'setStepSize',value:function setStepSize(stepSize){if(Number.isNaN(stepSize)||!Number.isFinite(stepSize)||stepSize<=0){return;}var newMax=this.mNumStars/stepSize;var newProgress=Math.floor(newMax/this.getMax()*this.getProgress());if(Number.isNaN(newProgress))newProgress=0;this.setMax(Math.floor(newMax));this.setProgress(newProgress);}},{key:'getStepSize',value:function getStepSize(){return this.getNumStars()/this.getMax();}},{key:'getProgressPerStar',value:function getProgressPerStar(){if(this.mNumStars>0){return 1*this.getMax()/this.mNumStars;}else{return 1;}}},{key:'onProgressRefresh',value:function onProgressRefresh(scale,fromUser){_get2(RatingBar.prototype.__proto__||Object.getPrototypeOf(RatingBar.prototype),'onProgressRefresh',this).call(this,scale,fromUser);this.updateSecondaryProgress(this.getProgress());if(!fromUser){this.dispatchRatingChange(false);}}},{key:'updateSecondaryProgress',value:function updateSecondaryProgress(progress){var ratio=this.getProgressPerStar();if(ratio>0){var progressInStars=progress/ratio;var secondaryProgress=Math.floor(Math.ceil(progressInStars)*ratio);this.setSecondaryProgress(secondaryProgress);}}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){_get2(RatingBar.prototype.__proto__||Object.getPrototypeOf(RatingBar.prototype),'onMeasure',this).call(this,widthMeasureSpec,heightMeasureSpec);if(this.mSampleTile!=null){var width=this.mSampleTile.getIntrinsicWidth()*this.mNumStars;this.setMeasuredDimension(RatingBar.resolveSizeAndState(width,widthMeasureSpec,0),this.getMeasuredHeight());}}},{key:'onStartTrackingTouch',value:function onStartTrackingTouch(){this.mProgressOnStartTracking=this.getProgress();_get2(RatingBar.prototype.__proto__||Object.getPrototypeOf(RatingBar.prototype),'onStartTrackingTouch',this).call(this);}},{key:'onStopTrackingTouch',value:function onStopTrackingTouch(){_get2(RatingBar.prototype.__proto__||Object.getPrototypeOf(RatingBar.prototype),'onStopTrackingTouch',this).call(this);if(this.getProgress()!=this.mProgressOnStartTracking){this.dispatchRatingChange(true);}}},{key:'onKeyChange',value:function onKeyChange(){_get2(RatingBar.prototype.__proto__||Object.getPrototypeOf(RatingBar.prototype),'onKeyChange',this).call(this);this.dispatchRatingChange(true);}},{key:'dispatchRatingChange',value:function dispatchRatingChange(fromUser){if(this.mOnRatingBarChangeListener!=null){this.mOnRatingBarChangeListener.onRatingChanged(this,this.getRating(),fromUser);}}},{key:'setMax',value:function setMax(max){if(max<=0){return;}_get2(RatingBar.prototype.__proto__||Object.getPrototypeOf(RatingBar.prototype),'setMax',this).call(this,max);}}]);return RatingBar;}(AbsSeekBar);widget.RatingBar=RatingBar;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var ArrayList=java.util.ArrayList;var ExpandableListView=android.widget.ExpandableListView;var ExpandableListPosition=function(){function ExpandableListPosition(){_classCallCheck(this,ExpandableListPosition);this.groupPos=0;this.childPos=0;this.flatListPos=0;this.type=0;}_createClass(ExpandableListPosition,[{key:'resetState',value:function resetState(){this.groupPos=0;this.childPos=0;this.flatListPos=0;this.type=0;}},{key:'getPackedPosition',value:function getPackedPosition(){if(this.type==ExpandableListPosition.CHILD)return ExpandableListView.getPackedPositionForChild(this.groupPos,this.childPos);else return ExpandableListView.getPackedPositionForGroup(this.groupPos);}},{key:'recycle',value:function recycle(){{if(ExpandableListPosition.sPool.size()<ExpandableListPosition.MAX_POOL_SIZE){ExpandableListPosition.sPool.add(this);}}}}],[{key:'obtainGroupPosition',value:function obtainGroupPosition(groupPosition){return ExpandableListPosition.obtain(ExpandableListPosition.GROUP,groupPosition,0,0);}},{key:'obtainChildPosition',value:function obtainChildPosition(groupPosition,childPosition){return ExpandableListPosition.obtain(ExpandableListPosition.CHILD,groupPosition,childPosition,0);}},{key:'obtainPosition',value:function obtainPosition(packedPosition){if(packedPosition==ExpandableListView.PACKED_POSITION_VALUE_NULL){return null;}var elp=ExpandableListPosition.getRecycledOrCreate();elp.groupPos=ExpandableListView.getPackedPositionGroup(packedPosition);if(ExpandableListView.getPackedPositionType(packedPosition)==ExpandableListView.PACKED_POSITION_TYPE_CHILD){elp.type=ExpandableListPosition.CHILD;elp.childPos=ExpandableListView.getPackedPositionChild(packedPosition);}else{elp.type=ExpandableListPosition.GROUP;}return elp;}},{key:'obtain',value:function obtain(type,groupPos,childPos,flatListPos){var elp=ExpandableListPosition.getRecycledOrCreate();elp.type=type;elp.groupPos=groupPos;elp.childPos=childPos;elp.flatListPos=flatListPos;return elp;}},{key:'getRecycledOrCreate',value:function getRecycledOrCreate(){var elp=void 0;{if(ExpandableListPosition.sPool.size()>0){elp=ExpandableListPosition.sPool.remove(0);}else{return new ExpandableListPosition();}}elp.resetState();return elp;}}]);return ExpandableListPosition;}();ExpandableListPosition.MAX_POOL_SIZE=5;ExpandableListPosition.sPool=new ArrayList(ExpandableListPosition.MAX_POOL_SIZE);ExpandableListPosition.CHILD=1;ExpandableListPosition.GROUP=2;widget.ExpandableListPosition=ExpandableListPosition;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var HeterogeneousExpandableList;(function(HeterogeneousExpandableList){function isImpl(obj){return obj&&obj['getGroupType']&&obj['getChildType']&&obj['getGroupTypeCount']&&obj['getChildTypeCount'];}HeterogeneousExpandableList.isImpl=isImpl;})(HeterogeneousExpandableList=widget.HeterogeneousExpandableList||(widget.HeterogeneousExpandableList={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var DataSetObserver=android.database.DataSetObserver;var SystemClock=android.os.SystemClock;var ArrayList=java.util.ArrayList;var Collections=java.util.Collections;var Integer=java.lang.Integer;var AdapterView=android.widget.AdapterView;var BaseAdapter=android.widget.BaseAdapter;var ExpandableListPosition=android.widget.ExpandableListPosition;var HeterogeneousExpandableList=android.widget.HeterogeneousExpandableList;var ExpandableListConnector=function(_BaseAdapter){_inherits(ExpandableListConnector,_BaseAdapter);function ExpandableListConnector(expandableListAdapter){_classCallCheck(this,ExpandableListConnector);var _this140=_possibleConstructorReturn(this,(ExpandableListConnector.__proto__||Object.getPrototypeOf(ExpandableListConnector)).call(this));_this140.mTotalExpChildrenCount=0;_this140.mMaxExpGroupCount=Integer.MAX_VALUE;_this140.mDataSetObserver=new ExpandableListConnector.MyDataSetObserver(_this140);_this140.mExpGroupMetadataList=new ArrayList();_this140.setExpandableListAdapter(expandableListAdapter);return _this140;}_createClass(ExpandableListConnector,[{key:'setExpandableListAdapter',value:function setExpandableListAdapter(expandableListAdapter){if(this.mExpandableListAdapter!=null){this.mExpandableListAdapter.unregisterDataSetObserver(this.mDataSetObserver);}this.mExpandableListAdapter=expandableListAdapter;expandableListAdapter.registerDataSetObserver(this.mDataSetObserver);}},{key:'getUnflattenedPos',value:function getUnflattenedPos(flPos){var egml=this.mExpGroupMetadataList;var numExpGroups=egml.size();var leftExpGroupIndex=0;var rightExpGroupIndex=numExpGroups-1;var midExpGroupIndex=0;var midExpGm=void 0;if(numExpGroups==0){return ExpandableListConnector.PositionMetadata.obtain(flPos,ExpandableListPosition.GROUP,flPos,-1,null,0);}while(leftExpGroupIndex<=rightExpGroupIndex){midExpGroupIndex=Math.floor((rightExpGroupIndex-leftExpGroupIndex)/2+leftExpGroupIndex);midExpGm=egml.get(midExpGroupIndex);if(flPos>midExpGm.lastChildFlPos){leftExpGroupIndex=midExpGroupIndex+1;}else if(flPos<midExpGm.flPos){rightExpGroupIndex=midExpGroupIndex-1;}else if(flPos==midExpGm.flPos){return ExpandableListConnector.PositionMetadata.obtain(flPos,ExpandableListPosition.GROUP,midExpGm.gPos,-1,midExpGm,midExpGroupIndex);}else if(flPos<=midExpGm.lastChildFlPos){var childPos=flPos-(midExpGm.flPos+1);return ExpandableListConnector.PositionMetadata.obtain(flPos,ExpandableListPosition.CHILD,midExpGm.gPos,childPos,midExpGm,midExpGroupIndex);}}var insertPosition=0;var groupPos=0;if(leftExpGroupIndex>midExpGroupIndex){var leftExpGm=egml.get(leftExpGroupIndex-1);insertPosition=leftExpGroupIndex;groupPos=flPos-leftExpGm.lastChildFlPos+leftExpGm.gPos;}else if(rightExpGroupIndex<midExpGroupIndex){var rightExpGm=egml.get(++rightExpGroupIndex);insertPosition=rightExpGroupIndex;groupPos=rightExpGm.gPos-(rightExpGm.flPos-flPos);}else{throw Error('new RuntimeException(\"Unknown state\")');}return ExpandableListConnector.PositionMetadata.obtain(flPos,ExpandableListPosition.GROUP,groupPos,-1,null,insertPosition);}},{key:'getFlattenedPos',value:function getFlattenedPos(pos){var egml=this.mExpGroupMetadataList;var numExpGroups=egml.size();var leftExpGroupIndex=0;var rightExpGroupIndex=numExpGroups-1;var midExpGroupIndex=0;var midExpGm=void 0;if(numExpGroups==0){return ExpandableListConnector.PositionMetadata.obtain(pos.groupPos,pos.type,pos.groupPos,pos.childPos,null,0);}while(leftExpGroupIndex<=rightExpGroupIndex){midExpGroupIndex=Math.floor((rightExpGroupIndex-leftExpGroupIndex)/2+leftExpGroupIndex);midExpGm=egml.get(midExpGroupIndex);if(pos.groupPos>midExpGm.gPos){leftExpGroupIndex=midExpGroupIndex+1;}else if(pos.groupPos<midExpGm.gPos){rightExpGroupIndex=midExpGroupIndex-1;}else if(pos.groupPos==midExpGm.gPos){if(pos.type==ExpandableListPosition.GROUP){return ExpandableListConnector.PositionMetadata.obtain(midExpGm.flPos,pos.type,pos.groupPos,pos.childPos,midExpGm,midExpGroupIndex);}else if(pos.type==ExpandableListPosition.CHILD){return ExpandableListConnector.PositionMetadata.obtain(midExpGm.flPos+pos.childPos+1,pos.type,pos.groupPos,pos.childPos,midExpGm,midExpGroupIndex);}else{return null;}}}if(pos.type!=ExpandableListPosition.GROUP){return null;}if(leftExpGroupIndex>midExpGroupIndex){var leftExpGm=egml.get(leftExpGroupIndex-1);var flPos=leftExpGm.lastChildFlPos+(pos.groupPos-leftExpGm.gPos);return ExpandableListConnector.PositionMetadata.obtain(flPos,pos.type,pos.groupPos,pos.childPos,null,leftExpGroupIndex);}else if(rightExpGroupIndex<midExpGroupIndex){var rightExpGm=egml.get(++rightExpGroupIndex);var _flPos=rightExpGm.flPos-(rightExpGm.gPos-pos.groupPos);return ExpandableListConnector.PositionMetadata.obtain(_flPos,pos.type,pos.groupPos,pos.childPos,null,rightExpGroupIndex);}else{return null;}}},{key:'areAllItemsEnabled',value:function areAllItemsEnabled(){return this.mExpandableListAdapter.areAllItemsEnabled();}},{key:'isEnabled',value:function isEnabled(flatListPos){var metadata=this.getUnflattenedPos(flatListPos);var pos=metadata.position;var retValue=void 0;if(pos.type==ExpandableListPosition.CHILD){retValue=this.mExpandableListAdapter.isChildSelectable(pos.groupPos,pos.childPos);}else{retValue=true;}metadata.recycle();return retValue;}},{key:'getCount',value:function getCount(){return this.mExpandableListAdapter.getGroupCount()+this.mTotalExpChildrenCount;}},{key:'getItem',value:function getItem(flatListPos){var posMetadata=this.getUnflattenedPos(flatListPos);var retValue=void 0;if(posMetadata.position.type==ExpandableListPosition.GROUP){retValue=this.mExpandableListAdapter.getGroup(posMetadata.position.groupPos);}else if(posMetadata.position.type==ExpandableListPosition.CHILD){retValue=this.mExpandableListAdapter.getChild(posMetadata.position.groupPos,posMetadata.position.childPos);}else{throw Error('new RuntimeException(\"Flat list position is of unknown type\")');}posMetadata.recycle();return retValue;}},{key:'getItemId',value:function getItemId(flatListPos){var posMetadata=this.getUnflattenedPos(flatListPos);var groupId=this.mExpandableListAdapter.getGroupId(posMetadata.position.groupPos);var retValue=void 0;if(posMetadata.position.type==ExpandableListPosition.GROUP){retValue=this.mExpandableListAdapter.getCombinedGroupId(groupId);}else if(posMetadata.position.type==ExpandableListPosition.CHILD){var childId=this.mExpandableListAdapter.getChildId(posMetadata.position.groupPos,posMetadata.position.childPos);retValue=this.mExpandableListAdapter.getCombinedChildId(groupId,childId);}else{throw Error('new RuntimeException(\"Flat list position is of unknown type\")');}posMetadata.recycle();return retValue;}},{key:'getView',value:function getView(flatListPos,convertView,parent){var posMetadata=this.getUnflattenedPos(flatListPos);var retValue=void 0;if(posMetadata.position.type==ExpandableListPosition.GROUP){retValue=this.mExpandableListAdapter.getGroupView(posMetadata.position.groupPos,posMetadata.isExpanded(),convertView,parent);}else if(posMetadata.position.type==ExpandableListPosition.CHILD){var isLastChild=posMetadata.groupMetadata.lastChildFlPos==flatListPos;retValue=this.mExpandableListAdapter.getChildView(posMetadata.position.groupPos,posMetadata.position.childPos,isLastChild,convertView,parent);}else{throw Error('new RuntimeException(\"Flat list position is of unknown type\")');}posMetadata.recycle();return retValue;}},{key:'getItemViewType',value:function getItemViewType(flatListPos){var metadata=this.getUnflattenedPos(flatListPos);var pos=metadata.position;var retValue=void 0;if(HeterogeneousExpandableList.isImpl(this.mExpandableListAdapter)){var adapter=this.mExpandableListAdapter;if(pos.type==ExpandableListPosition.GROUP){retValue=adapter.getGroupType(pos.groupPos);}else{var childType=adapter.getChildType(pos.groupPos,pos.childPos);retValue=adapter.getGroupTypeCount()+childType;}}else{if(pos.type==ExpandableListPosition.GROUP){retValue=0;}else{retValue=1;}}metadata.recycle();return retValue;}},{key:'getViewTypeCount',value:function getViewTypeCount(){if(HeterogeneousExpandableList.isImpl(this.mExpandableListAdapter)){var adapter=this.mExpandableListAdapter;return adapter.getGroupTypeCount()+adapter.getChildTypeCount();}else{return 2;}}},{key:'hasStableIds',value:function hasStableIds(){return this.mExpandableListAdapter.hasStableIds();}},{key:'refreshExpGroupMetadataList',value:function refreshExpGroupMetadataList(forceChildrenCountRefresh,syncGroupPositions){var egml=this.mExpGroupMetadataList;var egmlSize=egml.size();var curFlPos=0;this.mTotalExpChildrenCount=0;if(syncGroupPositions){var positionsChanged=false;for(var i=egmlSize-1;i>=0;i--){var curGm=egml.get(i);var newGPos=this.findGroupPosition(curGm.gId,curGm.gPos);if(newGPos!=curGm.gPos){if(newGPos==AdapterView.INVALID_POSITION){egml.remove(i);egmlSize--;}curGm.gPos=newGPos;if(!positionsChanged)positionsChanged=true;}}if(positionsChanged){Collections.sort(egml);}}var gChildrenCount=void 0;var lastGPos=0;for(var _i60=0;_i60<egmlSize;_i60++){var _curGm=egml.get(_i60);if(_curGm.lastChildFlPos==ExpandableListConnector.GroupMetadata.REFRESH||forceChildrenCountRefresh){gChildrenCount=this.mExpandableListAdapter.getChildrenCount(_curGm.gPos);}else{gChildrenCount=_curGm.lastChildFlPos-_curGm.flPos;}this.mTotalExpChildrenCount+=gChildrenCount;curFlPos+=_curGm.gPos-lastGPos;lastGPos=_curGm.gPos;_curGm.flPos=curFlPos;curFlPos+=gChildrenCount;_curGm.lastChildFlPos=curFlPos;}}},{key:'collapseGroup',value:function collapseGroup(groupPos){var elGroupPos=ExpandableListPosition.obtain(ExpandableListPosition.GROUP,groupPos,-1,-1);var pm=this.getFlattenedPos(elGroupPos);elGroupPos.recycle();if(pm==null)return false;var retValue=this.collapseGroupWithMeta(pm);pm.recycle();return retValue;}},{key:'collapseGroupWithMeta',value:function collapseGroupWithMeta(posMetadata){if(posMetadata.groupMetadata==null)return false;this.mExpGroupMetadataList.remove(posMetadata.groupMetadata);this.refreshExpGroupMetadataList(false,false);this.notifyDataSetChanged();this.mExpandableListAdapter.onGroupCollapsed(posMetadata.groupMetadata.gPos);return true;}},{key:'expandGroup',value:function expandGroup(groupPos){var elGroupPos=ExpandableListPosition.obtain(ExpandableListPosition.GROUP,groupPos,-1,-1);var pm=this.getFlattenedPos(elGroupPos);elGroupPos.recycle();var retValue=this.expandGroupWithMeta(pm);pm.recycle();return retValue;}},{key:'expandGroupWithMeta',value:function expandGroupWithMeta(posMetadata){if(posMetadata.position.groupPos<0){throw Error('new RuntimeException(\"Need group\")');}if(this.mMaxExpGroupCount==0)return false;if(posMetadata.groupMetadata!=null)return false;if(this.mExpGroupMetadataList.size()>=this.mMaxExpGroupCount){var collapsedGm=this.mExpGroupMetadataList.get(0);var collapsedIndex=this.mExpGroupMetadataList.indexOf(collapsedGm);this.collapseGroup(collapsedGm.gPos);if(posMetadata.groupInsertIndex>collapsedIndex){posMetadata.groupInsertIndex--;}}var expandedGm=ExpandableListConnector.GroupMetadata.obtain(ExpandableListConnector.GroupMetadata.REFRESH,ExpandableListConnector.GroupMetadata.REFRESH,posMetadata.position.groupPos,this.mExpandableListAdapter.getGroupId(posMetadata.position.groupPos));this.mExpGroupMetadataList.add(posMetadata.groupInsertIndex,expandedGm);this.refreshExpGroupMetadataList(false,false);this.notifyDataSetChanged();this.mExpandableListAdapter.onGroupExpanded(expandedGm.gPos);return true;}},{key:'isGroupExpanded',value:function isGroupExpanded(groupPosition){var groupMetadata=void 0;for(var i=this.mExpGroupMetadataList.size()-1;i>=0;i--){groupMetadata=this.mExpGroupMetadataList.get(i);if(groupMetadata.gPos==groupPosition){return true;}}return false;}},{key:'setMaxExpGroupCount',value:function setMaxExpGroupCount(maxExpGroupCount){this.mMaxExpGroupCount=maxExpGroupCount;}},{key:'getAdapter',value:function getAdapter(){return this.mExpandableListAdapter;}},{key:'getExpandedGroupMetadataList',value:function getExpandedGroupMetadataList(){return this.mExpGroupMetadataList;}},{key:'setExpandedGroupMetadataList',value:function setExpandedGroupMetadataList(expandedGroupMetadataList){if(expandedGroupMetadataList==null||this.mExpandableListAdapter==null){return;}var numGroups=this.mExpandableListAdapter.getGroupCount();for(var i=expandedGroupMetadataList.size()-1;i>=0;i--){if(expandedGroupMetadataList.get(i).gPos>=numGroups){return;}}this.mExpGroupMetadataList=expandedGroupMetadataList;this.refreshExpGroupMetadataList(true,false);}},{key:'isEmpty',value:function isEmpty(){var adapter=this.getAdapter();return adapter!=null?adapter.isEmpty():true;}},{key:'findGroupPosition',value:function findGroupPosition(groupIdToMatch,seedGroupPosition){var count=this.mExpandableListAdapter.getGroupCount();if(count==0){return AdapterView.INVALID_POSITION;}if(groupIdToMatch==AdapterView.INVALID_ROW_ID){return AdapterView.INVALID_POSITION;}seedGroupPosition=Math.max(0,seedGroupPosition);seedGroupPosition=Math.min(count-1,seedGroupPosition);var endTime=SystemClock.uptimeMillis()+AdapterView.SYNC_MAX_DURATION_MILLIS;var rowId=void 0;var first=seedGroupPosition;var last=seedGroupPosition;var next=false;var hitFirst=void 0;var hitLast=void 0;var adapter=this.getAdapter();if(adapter==null){return AdapterView.INVALID_POSITION;}while(SystemClock.uptimeMillis()<=endTime){rowId=adapter.getGroupId(seedGroupPosition);if(rowId==groupIdToMatch){return seedGroupPosition;}hitLast=last==count-1;hitFirst=first==0;if(hitLast&&hitFirst){break;}if(hitFirst||next&&!hitLast){last++;seedGroupPosition=last;next=false;}else if(hitLast||!next&&!hitFirst){first--;seedGroupPosition=first;next=true;}}return AdapterView.INVALID_POSITION;}}]);return ExpandableListConnector;}(BaseAdapter);widget.ExpandableListConnector=ExpandableListConnector;(function(ExpandableListConnector){var MyDataSetObserver=function(_DataSetObserver2){_inherits(MyDataSetObserver,_DataSetObserver2);function MyDataSetObserver(arg){_classCallCheck(this,MyDataSetObserver);var _this141=_possibleConstructorReturn(this,(MyDataSetObserver.__proto__||Object.getPrototypeOf(MyDataSetObserver)).call(this));_this141._ExpandableListConnector_this=arg;return _this141;}_createClass(MyDataSetObserver,[{key:'onChanged',value:function onChanged(){this._ExpandableListConnector_this.refreshExpGroupMetadataList(true,true);this._ExpandableListConnector_this.notifyDataSetChanged();}},{key:'onInvalidated',value:function onInvalidated(){this._ExpandableListConnector_this.refreshExpGroupMetadataList(true,true);this._ExpandableListConnector_this.notifyDataSetInvalidated();}}]);return MyDataSetObserver;}(DataSetObserver);ExpandableListConnector.MyDataSetObserver=MyDataSetObserver;var GroupMetadata=function(){function GroupMetadata(){_classCallCheck(this,GroupMetadata);this.flPos=0;this.lastChildFlPos=0;this.gPos=0;this.gId=0;}_createClass(GroupMetadata,[{key:'compareTo',value:function compareTo(another){if(another==null){throw Error('new IllegalArgumentException()');}return this.gPos-another.gPos;}}],[{key:'obtain',value:function obtain(flPos,lastChildFlPos,gPos,gId){var gm=new GroupMetadata();gm.flPos=flPos;gm.lastChildFlPos=lastChildFlPos;gm.gPos=gPos;gm.gId=gId;return gm;}}]);return GroupMetadata;}();GroupMetadata.REFRESH=-1;ExpandableListConnector.GroupMetadata=GroupMetadata;var PositionMetadata=function(){function PositionMetadata(){_classCallCheck(this,PositionMetadata);this.groupInsertIndex=0;}_createClass(PositionMetadata,[{key:'resetState',value:function resetState(){if(this.position!=null){this.position.recycle();this.position=null;}this.groupMetadata=null;this.groupInsertIndex=0;}},{key:'recycle',value:function recycle(){this.resetState();{if(PositionMetadata.sPool.size()<PositionMetadata.MAX_POOL_SIZE){PositionMetadata.sPool.add(this);}}}},{key:'isExpanded',value:function isExpanded(){return this.groupMetadata!=null;}}],[{key:'obtain',value:function obtain(flatListPos,type,groupPos,childPos,groupMetadata,groupInsertIndex){var pm=PositionMetadata.getRecycledOrCreate();pm.position=ExpandableListPosition.obtain(type,groupPos,childPos,flatListPos);pm.groupMetadata=groupMetadata;pm.groupInsertIndex=groupInsertIndex;return pm;}},{key:'getRecycledOrCreate',value:function getRecycledOrCreate(){var pm=void 0;{if(PositionMetadata.sPool.size()>0){pm=PositionMetadata.sPool.remove(0);}else{return new PositionMetadata();}}pm.resetState();return pm;}}]);return PositionMetadata;}();PositionMetadata.MAX_POOL_SIZE=5;PositionMetadata.sPool=new ArrayList(PositionMetadata.MAX_POOL_SIZE);ExpandableListConnector.PositionMetadata=PositionMetadata;})(ExpandableListConnector=widget.ExpandableListConnector||(widget.ExpandableListConnector={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var Rect=android.graphics.Rect;var SoundEffectConstants=android.view.SoundEffectConstants;var View=android.view.View;var ExpandableListConnector=android.widget.ExpandableListConnector;var ExpandableListPosition=android.widget.ExpandableListPosition;var ListView=android.widget.ListView;var Long=goog.math.Long;var ExpandableListView=function(_ListView){_inherits(ExpandableListView,_ListView);function ExpandableListView(context,attrs){var defStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.R.attr.expandableListViewStyle;_classCallCheck(this,ExpandableListView);var _this142=_possibleConstructorReturn(this,(ExpandableListView.__proto__||Object.getPrototypeOf(ExpandableListView)).call(this,context,attrs,defStyle));_this142.mIndicatorLeft=0;_this142.mIndicatorRight=0;_this142.mIndicatorStart=0;_this142.mIndicatorEnd=0;_this142.mChildIndicatorLeft=0;_this142.mChildIndicatorRight=0;_this142.mChildIndicatorStart=0;_this142.mChildIndicatorEnd=0;_this142.mIndicatorRect=new Rect();var a=context.obtainStyledAttributes(attrs,defStyle);_this142.mGroupIndicator=a.getDrawable('groupIndicator');_this142.mChildIndicator=a.getDrawable('childIndicator');_this142.mIndicatorLeft=a.getDimensionPixelSize('indicatorLeft',0);_this142.mIndicatorRight=a.getDimensionPixelSize('indicatorRight',0);if(_this142.mIndicatorRight==0&&_this142.mGroupIndicator!=null){_this142.mIndicatorRight=_this142.mIndicatorLeft+_this142.mGroupIndicator.getIntrinsicWidth();}_this142.mChildIndicatorLeft=a.getDimensionPixelSize('childIndicatorLeft',ExpandableListView.CHILD_INDICATOR_INHERIT);_this142.mChildIndicatorRight=a.getDimensionPixelSize('childIndicatorRight',ExpandableListView.CHILD_INDICATOR_INHERIT);_this142.mChildDivider=a.getDrawable('childDivider');if(!_this142.isRtlCompatibilityMode()){_this142.mIndicatorStart=a.getDimensionPixelSize('indicatorStart',ExpandableListView.INDICATOR_UNDEFINED);_this142.mIndicatorEnd=a.getDimensionPixelSize('indicatorEnd',ExpandableListView.INDICATOR_UNDEFINED);_this142.mChildIndicatorStart=a.getDimensionPixelSize('childIndicatorStart',ExpandableListView.CHILD_INDICATOR_INHERIT);_this142.mChildIndicatorEnd=a.getDimensionPixelSize('childIndicatorEnd',ExpandableListView.CHILD_INDICATOR_INHERIT);}a.recycle();return _this142;}_createClass(ExpandableListView,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(ExpandableListView.prototype.__proto__||Object.getPrototypeOf(ExpandableListView.prototype),'createClassAttrBinder',this).call(this).set('groupIndicator',{setter:function setter(v,value,attrBinder){v.setGroupIndicator(attrBinder.parseDrawable(value));},getter:function getter(v){return v.mGroupIndicator;}}).set('childIndicator',{setter:function setter(v,value,attrBinder){v.setChildIndicator(attrBinder.parseDrawable(value));},getter:function getter(v){return v.mChildIndicator;}}).set('indicatorLeft',{setter:function setter(v,value,attrBinder){v.setIndicatorBounds(attrBinder.parseNumberPixelOffset(value,0),v.mIndicatorRight);},getter:function getter(v){return v.mIndicatorLeft;}}).set('indicatorRight',{setter:function setter(v,value,attrBinder){var num=attrBinder.parseNumberPixelOffset(value,0);if(num==0&&v.mGroupIndicator!=null){num=v.mIndicatorLeft+v.mGroupIndicator.getIntrinsicWidth();}this.setIndicatorBounds(v.mIndicatorLeft,num);},getter:function getter(v){return v.mIndicatorRight;}}).set('childIndicatorLeft',{setter:function setter(v,value,attrBinder){v.setChildIndicatorBounds(attrBinder.parseNumberPixelOffset(value,ExpandableListView.CHILD_INDICATOR_INHERIT),v.mChildIndicatorRight);},getter:function getter(v){return v.mChildIndicatorLeft;}}).set('childIndicatorRight',{setter:function setter(v,value,attrBinder){var num=attrBinder.parseNumberPixelOffset(value,ExpandableListView.CHILD_INDICATOR_INHERIT);if(num==0&&v.mChildIndicator!=null){num=v.mChildIndicatorLeft+v.mChildIndicator.getIntrinsicWidth();}v.setIndicatorBounds(v.mChildIndicatorLeft,num);},getter:function getter(v){return v.mChildIndicatorRight;}}).set('childDivider',{setter:function setter(v,value,attrBinder){v.setChildDivider(attrBinder.parseDrawable(value));},getter:function getter(v){return v.mChildDivider;}});}},{key:'isRtlCompatibilityMode',value:function isRtlCompatibilityMode(){return!this.hasRtlSupport();}},{key:'hasRtlSupport',value:function hasRtlSupport(){return false;}},{key:'onRtlPropertiesChanged',value:function onRtlPropertiesChanged(layoutDirection){this.resolveIndicator();this.resolveChildIndicator();}},{key:'resolveIndicator',value:function resolveIndicator(){var isLayoutRtl=this.isLayoutRtl();if(isLayoutRtl){if(this.mIndicatorStart>=0){this.mIndicatorRight=this.mIndicatorStart;}if(this.mIndicatorEnd>=0){this.mIndicatorLeft=this.mIndicatorEnd;}}else{if(this.mIndicatorStart>=0){this.mIndicatorLeft=this.mIndicatorStart;}if(this.mIndicatorEnd>=0){this.mIndicatorRight=this.mIndicatorEnd;}}if(this.mIndicatorRight==0&&this.mGroupIndicator!=null){this.mIndicatorRight=this.mIndicatorLeft+this.mGroupIndicator.getIntrinsicWidth();}}},{key:'resolveChildIndicator',value:function resolveChildIndicator(){var isLayoutRtl=this.isLayoutRtl();if(isLayoutRtl){if(this.mChildIndicatorStart>=ExpandableListView.CHILD_INDICATOR_INHERIT){this.mChildIndicatorRight=this.mChildIndicatorStart;}if(this.mChildIndicatorEnd>=ExpandableListView.CHILD_INDICATOR_INHERIT){this.mChildIndicatorLeft=this.mChildIndicatorEnd;}}else{if(this.mChildIndicatorStart>=ExpandableListView.CHILD_INDICATOR_INHERIT){this.mChildIndicatorLeft=this.mChildIndicatorStart;}if(this.mChildIndicatorEnd>=ExpandableListView.CHILD_INDICATOR_INHERIT){this.mChildIndicatorRight=this.mChildIndicatorEnd;}}}},{key:'dispatchDraw',value:function dispatchDraw(canvas){_get2(ExpandableListView.prototype.__proto__||Object.getPrototypeOf(ExpandableListView.prototype),'dispatchDraw',this).call(this,canvas);if(this.mChildIndicator==null&&this.mGroupIndicator==null){return;}var saveCount=0;var clipToPadding=(this.mGroupFlags&ExpandableListView.CLIP_TO_PADDING_MASK)==ExpandableListView.CLIP_TO_PADDING_MASK;if(clipToPadding){saveCount=canvas.save();var scrollX=this.mScrollX;var scrollY=this.mScrollY;canvas.clipRect(scrollX+this.mPaddingLeft,scrollY+this.mPaddingTop,scrollX+this.mRight-this.mLeft-this.mPaddingRight,scrollY+this.mBottom-this.mTop-this.mPaddingBottom);}var headerViewsCount=this.getHeaderViewsCount();var lastChildFlPos=this.mItemCount-this.getFooterViewsCount()-headerViewsCount-1;var myB=this.mBottom;var pos=void 0;var item=void 0;var indicator=void 0;var t=void 0,b=void 0;var lastItemType=~(ExpandableListPosition.CHILD|ExpandableListPosition.GROUP);var indicatorRect=this.mIndicatorRect;var childCount=this.getChildCount();for(var i=0,childFlPos=this.mFirstPosition-headerViewsCount;i<childCount;i++,childFlPos++){if(childFlPos<0){continue;}else if(childFlPos>lastChildFlPos){break;}item=this.getChildAt(i);t=item.getTop();b=item.getBottom();if(b<0||t>myB)continue;pos=this.mConnector.getUnflattenedPos(childFlPos);var isLayoutRtl=this.isLayoutRtl();var width=this.getWidth();if(pos.position.type!=lastItemType){if(pos.position.type==ExpandableListPosition.CHILD){indicatorRect.left=this.mChildIndicatorLeft==ExpandableListView.CHILD_INDICATOR_INHERIT?this.mIndicatorLeft:this.mChildIndicatorLeft;indicatorRect.right=this.mChildIndicatorRight==ExpandableListView.CHILD_INDICATOR_INHERIT?this.mIndicatorRight:this.mChildIndicatorRight;}else{indicatorRect.left=this.mIndicatorLeft;indicatorRect.right=this.mIndicatorRight;}if(isLayoutRtl){var temp=indicatorRect.left;indicatorRect.left=width-indicatorRect.right;indicatorRect.right=width-temp;indicatorRect.left-=this.mPaddingRight;indicatorRect.right-=this.mPaddingRight;}else{indicatorRect.left+=this.mPaddingLeft;indicatorRect.right+=this.mPaddingLeft;}lastItemType=pos.position.type;}if(indicatorRect.left!=indicatorRect.right){if(this.mStackFromBottom){indicatorRect.top=t;indicatorRect.bottom=b;}else{indicatorRect.top=t;indicatorRect.bottom=b;}indicator=this.getIndicator(pos);if(indicator!=null){indicator.setBounds(indicatorRect);indicator.draw(canvas);}}pos.recycle();}if(clipToPadding){canvas.restoreToCount(saveCount);}}},{key:'getIndicator',value:function getIndicator(pos){var indicator=void 0;if(pos.position.type==ExpandableListPosition.GROUP){indicator=this.mGroupIndicator;if(indicator!=null&&indicator.isStateful()){var isEmpty=pos.groupMetadata==null||pos.groupMetadata.lastChildFlPos==pos.groupMetadata.flPos;var stateSetIndex=(pos.isExpanded()?1:0)|(isEmpty?2:0);indicator.setState(ExpandableListView.GROUP_STATE_SETS[stateSetIndex]);}}else{indicator=this.mChildIndicator;if(indicator!=null&&indicator.isStateful()){var stateSet=pos.position.flatListPos==pos.groupMetadata.lastChildFlPos?ExpandableListView.CHILD_LAST_STATE_SET:ExpandableListView.EMPTY_STATE_SET;indicator.setState(stateSet);}}return indicator;}},{key:'setChildDivider',value:function setChildDivider(childDivider){this.mChildDivider=childDivider;}},{key:'drawDivider',value:function drawDivider(canvas,bounds,childIndex){var flatListPosition=childIndex+this.mFirstPosition;if(flatListPosition>=0){var adjustedPosition=this.getFlatPositionForConnector(flatListPosition);var pos=this.mConnector.getUnflattenedPos(adjustedPosition);if(pos.position.type==ExpandableListPosition.CHILD||pos.isExpanded()&&pos.groupMetadata.lastChildFlPos!=pos.groupMetadata.flPos){var divider=this.mChildDivider;divider.setBounds(bounds);divider.draw(canvas);pos.recycle();return;}pos.recycle();}_get2(ExpandableListView.prototype.__proto__||Object.getPrototypeOf(ExpandableListView.prototype),'drawDivider',this).call(this,canvas,bounds,flatListPosition);}},{key:'setAdapter',value:function setAdapter(adapter){throw Error('new RuntimeException(\"For ExpandableListView, use setAdapter(ExpandableListAdapter) instead of \" + \"setAdapter(ListAdapter)\")');}},{key:'getAdapter',value:function getAdapter(){return _get2(ExpandableListView.prototype.__proto__||Object.getPrototypeOf(ExpandableListView.prototype),'getAdapter',this).call(this);}},{key:'setOnItemClickListener',value:function setOnItemClickListener(l){_get2(ExpandableListView.prototype.__proto__||Object.getPrototypeOf(ExpandableListView.prototype),'setOnItemClickListener',this).call(this,l);}},{key:'setExpandableAdapter',value:function setExpandableAdapter(adapter){this.mExpandAdapter=adapter;if(adapter!=null){this.mConnector=new ExpandableListConnector(adapter);}else{this.mConnector=null;}_get2(ExpandableListView.prototype.__proto__||Object.getPrototypeOf(ExpandableListView.prototype),'setAdapter',this).call(this,this.mConnector);}},{key:'getExpandableListAdapter',value:function getExpandableListAdapter(){return this.mExpandAdapter;}},{key:'isHeaderOrFooterPosition',value:function isHeaderOrFooterPosition(position){var footerViewsStart=this.mItemCount-this.getFooterViewsCount();return position<this.getHeaderViewsCount()||position>=footerViewsStart;}},{key:'getFlatPositionForConnector',value:function getFlatPositionForConnector(flatListPosition){return flatListPosition-this.getHeaderViewsCount();}},{key:'getAbsoluteFlatPosition',value:function getAbsoluteFlatPosition(flatListPosition){return flatListPosition+this.getHeaderViewsCount();}},{key:'performItemClick',value:function performItemClick(v,position,id){if(this.isHeaderOrFooterPosition(position)){return _get2(ExpandableListView.prototype.__proto__||Object.getPrototypeOf(ExpandableListView.prototype),'performItemClick',this).call(this,v,position,id);}var adjustedPosition=this.getFlatPositionForConnector(position);return this.handleItemClick(v,adjustedPosition,id);}},{key:'handleItemClick',value:function handleItemClick(v,position,id){var posMetadata=this.mConnector.getUnflattenedPos(position);id=this.getChildOrGroupId(posMetadata.position);var returnValue=void 0;if(posMetadata.position.type==ExpandableListPosition.GROUP){if(this.mOnGroupClickListener!=null){if(this.mOnGroupClickListener.onGroupClick(this,v,posMetadata.position.groupPos,id)){posMetadata.recycle();return true;}}if(posMetadata.isExpanded()){this.mConnector.collapseGroupWithMeta(posMetadata);this.playSoundEffect(SoundEffectConstants.CLICK);if(this.mOnGroupCollapseListener!=null){this.mOnGroupCollapseListener.onGroupCollapse(posMetadata.position.groupPos);}}else{this.mConnector.expandGroupWithMeta(posMetadata);this.playSoundEffect(SoundEffectConstants.CLICK);if(this.mOnGroupExpandListener!=null){this.mOnGroupExpandListener.onGroupExpand(posMetadata.position.groupPos);}var groupPos=posMetadata.position.groupPos;var groupFlatPos=posMetadata.position.flatListPos;var shiftedGroupPosition=groupFlatPos+this.getHeaderViewsCount();this.smoothScrollToPosition(shiftedGroupPosition+this.mExpandAdapter.getChildrenCount(groupPos),shiftedGroupPosition);}returnValue=true;}else{if(this.mOnChildClickListener!=null){this.playSoundEffect(SoundEffectConstants.CLICK);return this.mOnChildClickListener.onChildClick(this,v,posMetadata.position.groupPos,posMetadata.position.childPos,id);}returnValue=false;}posMetadata.recycle();return returnValue;}},{key:'expandGroup',value:function expandGroup(groupPos){var animate=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var elGroupPos=ExpandableListPosition.obtain(ExpandableListPosition.GROUP,groupPos,-1,-1);var pm=this.mConnector.getFlattenedPos(elGroupPos);elGroupPos.recycle();var retValue=this.mConnector.expandGroupWithMeta(pm);if(this.mOnGroupExpandListener!=null){this.mOnGroupExpandListener.onGroupExpand(groupPos);}if(animate){var groupFlatPos=pm.position.flatListPos;var shiftedGroupPosition=groupFlatPos+this.getHeaderViewsCount();this.smoothScrollToPosition(shiftedGroupPosition+this.mExpandAdapter.getChildrenCount(groupPos),shiftedGroupPosition);}pm.recycle();return retValue;}},{key:'collapseGroup',value:function collapseGroup(groupPos){var retValue=this.mConnector.collapseGroup(groupPos);if(this.mOnGroupCollapseListener!=null){this.mOnGroupCollapseListener.onGroupCollapse(groupPos);}return retValue;}},{key:'setOnGroupCollapseListener',value:function setOnGroupCollapseListener(onGroupCollapseListener){this.mOnGroupCollapseListener=onGroupCollapseListener;}},{key:'setOnGroupExpandListener',value:function setOnGroupExpandListener(onGroupExpandListener){this.mOnGroupExpandListener=onGroupExpandListener;}},{key:'setOnGroupClickListener',value:function setOnGroupClickListener(onGroupClickListener){this.mOnGroupClickListener=onGroupClickListener;}},{key:'setOnChildClickListener',value:function setOnChildClickListener(onChildClickListener){this.mOnChildClickListener=onChildClickListener;}},{key:'getExpandableListPosition',value:function getExpandableListPosition(flatListPosition){if(this.isHeaderOrFooterPosition(flatListPosition)){return ExpandableListView.PACKED_POSITION_VALUE_NULL;}var adjustedPosition=this.getFlatPositionForConnector(flatListPosition);var pm=this.mConnector.getUnflattenedPos(adjustedPosition);var packedPos=pm.position.getPackedPosition();pm.recycle();return packedPos;}},{key:'getFlatListPosition',value:function getFlatListPosition(packedPosition){var elPackedPos=ExpandableListPosition.obtainPosition(packedPosition);var pm=this.mConnector.getFlattenedPos(elPackedPos);elPackedPos.recycle();var flatListPosition=pm.position.flatListPos;pm.recycle();return this.getAbsoluteFlatPosition(flatListPosition);}},{key:'getSelectedPosition',value:function getSelectedPosition(){var selectedPos=this.getSelectedItemPosition();return this.getExpandableListPosition(selectedPos);}},{key:'getSelectedId',value:function getSelectedId(){var packedPos=this.getSelectedPosition();if(packedPos==ExpandableListView.PACKED_POSITION_VALUE_NULL)return-1;var groupPos=ExpandableListView.getPackedPositionGroup(packedPos);if(ExpandableListView.getPackedPositionType(packedPos)==ExpandableListView.PACKED_POSITION_TYPE_GROUP){return this.mExpandAdapter.getGroupId(groupPos);}else{return this.mExpandAdapter.getChildId(groupPos,ExpandableListView.getPackedPositionChild(packedPos));}}},{key:'setSelectedGroup',value:function setSelectedGroup(groupPosition){var elGroupPos=ExpandableListPosition.obtainGroupPosition(groupPosition);var pm=this.mConnector.getFlattenedPos(elGroupPos);elGroupPos.recycle();var absoluteFlatPosition=this.getAbsoluteFlatPosition(pm.position.flatListPos);_get2(ExpandableListView.prototype.__proto__||Object.getPrototypeOf(ExpandableListView.prototype),'setSelection',this).call(this,absoluteFlatPosition);pm.recycle();}},{key:'setSelectedChild',value:function setSelectedChild(groupPosition,childPosition,shouldExpandGroup){var elChildPos=ExpandableListPosition.obtainChildPosition(groupPosition,childPosition);var flatChildPos=this.mConnector.getFlattenedPos(elChildPos);if(flatChildPos==null){if(!shouldExpandGroup)return false;this.expandGroup(groupPosition);flatChildPos=this.mConnector.getFlattenedPos(elChildPos);if(flatChildPos==null){throw Error('new IllegalStateException(\"Could not find child\")');}}var absoluteFlatPosition=this.getAbsoluteFlatPosition(flatChildPos.position.flatListPos);_get2(ExpandableListView.prototype.__proto__||Object.getPrototypeOf(ExpandableListView.prototype),'setSelection',this).call(this,absoluteFlatPosition);elChildPos.recycle();flatChildPos.recycle();return true;}},{key:'isGroupExpanded',value:function isGroupExpanded(groupPosition){return this.mConnector.isGroupExpanded(groupPosition);}},{key:'getChildOrGroupId',value:function getChildOrGroupId(position){if(position.type==ExpandableListPosition.CHILD){return this.mExpandAdapter.getChildId(position.groupPos,position.childPos);}else{return this.mExpandAdapter.getGroupId(position.groupPos);}}},{key:'setChildIndicator',value:function setChildIndicator(childIndicator){this.mChildIndicator=childIndicator;}},{key:'setChildIndicatorBounds',value:function setChildIndicatorBounds(left,right){this.mChildIndicatorLeft=left;this.mChildIndicatorRight=right;this.resolveChildIndicator();}},{key:'setChildIndicatorBoundsRelative',value:function setChildIndicatorBoundsRelative(start,end){this.mChildIndicatorStart=start;this.mChildIndicatorEnd=end;this.resolveChildIndicator();}},{key:'setGroupIndicator',value:function setGroupIndicator(groupIndicator){this.mGroupIndicator=groupIndicator;if(this.mIndicatorRight==0&&this.mGroupIndicator!=null){this.mIndicatorRight=this.mIndicatorLeft+this.mGroupIndicator.getIntrinsicWidth();}}},{key:'setIndicatorBounds',value:function setIndicatorBounds(left,right){this.mIndicatorLeft=left;this.mIndicatorRight=right;this.resolveIndicator();}},{key:'setIndicatorBoundsRelative',value:function setIndicatorBoundsRelative(start,end){this.mIndicatorStart=start;this.mIndicatorEnd=end;this.resolveIndicator();}}],[{key:'getPackedPositionType',value:function getPackedPositionType(packedPosition){if(packedPosition==ExpandableListView.PACKED_POSITION_VALUE_NULL){return ExpandableListView.PACKED_POSITION_TYPE_NULL;}return Long.fromNumber(packedPosition).and(ExpandableListView.PACKED_POSITION_MASK_TYPE).equals(ExpandableListView.PACKED_POSITION_MASK_TYPE)?ExpandableListView.PACKED_POSITION_TYPE_CHILD:ExpandableListView.PACKED_POSITION_TYPE_GROUP;}},{key:'getPackedPositionGroup',value:function getPackedPositionGroup(packedPosition){if(packedPosition==ExpandableListView.PACKED_POSITION_VALUE_NULL)return-1;return Long.fromNumber(packedPosition).and(ExpandableListView.PACKED_POSITION_MASK_GROUP).shiftRight(ExpandableListView.PACKED_POSITION_SHIFT_GROUP).toNumber();}},{key:'getPackedPositionChild',value:function getPackedPositionChild(packedPosition){if(packedPosition==ExpandableListView.PACKED_POSITION_VALUE_NULL)return-1;if(Long.fromNumber(packedPosition).and(ExpandableListView.PACKED_POSITION_MASK_TYPE).notEquals(ExpandableListView.PACKED_POSITION_MASK_TYPE))return-1;return Long.fromNumber(packedPosition).and(ExpandableListView.PACKED_POSITION_MASK_CHILD).toNumber();}},{key:'getPackedPositionForChild',value:function getPackedPositionForChild(groupPosition,childPosition){return Long.fromInt(ExpandableListView.PACKED_POSITION_TYPE_CHILD).shiftLeft(ExpandableListView.PACKED_POSITION_SHIFT_TYPE).or(Long.fromNumber(groupPosition).and(ExpandableListView.PACKED_POSITION_INT_MASK_GROUP).shiftLeft(ExpandableListView.PACKED_POSITION_SHIFT_GROUP)).or(Long.fromNumber(childPosition).and(ExpandableListView.PACKED_POSITION_INT_MASK_CHILD)).toNumber();}},{key:'getPackedPositionForGroup',value:function getPackedPositionForGroup(groupPosition){return Long.fromInt(groupPosition).and(ExpandableListView.PACKED_POSITION_INT_MASK_GROUP).shiftLeft(ExpandableListView.PACKED_POSITION_SHIFT_GROUP).toNumber();}}]);return ExpandableListView;}(ListView);ExpandableListView.PACKED_POSITION_TYPE_GROUP=0;ExpandableListView.PACKED_POSITION_TYPE_CHILD=1;ExpandableListView.PACKED_POSITION_TYPE_NULL=2;ExpandableListView.PACKED_POSITION_VALUE_NULL=0x00000000FFFFFFFF;ExpandableListView.PACKED_POSITION_MASK_CHILD=Long.fromNumber(0x00000000FFFFFFFF);ExpandableListView.PACKED_POSITION_MASK_GROUP=Long.fromNumber(0x7FFFFFFF00000000);ExpandableListView.PACKED_POSITION_MASK_TYPE=Long.fromNumber(0x8000000000000000);ExpandableListView.PACKED_POSITION_SHIFT_GROUP=32;ExpandableListView.PACKED_POSITION_SHIFT_TYPE=63;ExpandableListView.PACKED_POSITION_INT_MASK_CHILD=Long.fromNumber(0xFFFFFFFF);ExpandableListView.PACKED_POSITION_INT_MASK_GROUP=Long.fromNumber(0x7FFFFFFF);ExpandableListView.CHILD_INDICATOR_INHERIT=-1;ExpandableListView.INDICATOR_UNDEFINED=-2;ExpandableListView.GROUP_EXPANDED_STATE_SET=[View.VIEW_STATE_EXPANDED];ExpandableListView.GROUP_EMPTY_STATE_SET=[View.VIEW_STATE_EMPTY];ExpandableListView.GROUP_EXPANDED_EMPTY_STATE_SET=[View.VIEW_STATE_EXPANDED,View.VIEW_STATE_EMPTY];ExpandableListView.GROUP_STATE_SETS=[ExpandableListView.EMPTY_STATE_SET,ExpandableListView.GROUP_EXPANDED_STATE_SET,ExpandableListView.GROUP_EMPTY_STATE_SET,ExpandableListView.GROUP_EXPANDED_EMPTY_STATE_SET];ExpandableListView.CHILD_LAST_STATE_SET=[View.VIEW_STATE_LAST];widget.ExpandableListView=ExpandableListView;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var DataSetObservable=android.database.DataSetObservable;var Long=goog.math.Long;var _0x8000000000000000=Long.fromNumber(0x8000000000000000);var _0x7FFFFFFF=Long.fromNumber(0x7FFFFFFF);var _0xFFFFFFFF=Long.fromNumber(0xFFFFFFFF);var BaseExpandableListAdapter=function(){function BaseExpandableListAdapter(){_classCallCheck(this,BaseExpandableListAdapter);this.mDataSetObservable=new DataSetObservable();}_createClass(BaseExpandableListAdapter,[{key:'registerDataSetObserver',value:function registerDataSetObserver(observer){this.mDataSetObservable.registerObserver(observer);}},{key:'unregisterDataSetObserver',value:function unregisterDataSetObserver(observer){this.mDataSetObservable.unregisterObserver(observer);}},{key:'notifyDataSetInvalidated',value:function notifyDataSetInvalidated(){this.mDataSetObservable.notifyInvalidated();}},{key:'notifyDataSetChanged',value:function notifyDataSetChanged(){this.mDataSetObservable.notifyChanged();}},{key:'areAllItemsEnabled',value:function areAllItemsEnabled(){return true;}},{key:'onGroupCollapsed',value:function onGroupCollapsed(groupPosition){}},{key:'onGroupExpanded',value:function onGroupExpanded(groupPosition){}},{key:'getCombinedChildId',value:function getCombinedChildId(groupId,childId){var _groupId=Long.fromNumber(groupId);var _childId=Long.fromNumber(childId);return _0x8000000000000000.or(_groupId.and(_0x7FFFFFFF).shiftLeft(32)).or(_childId.and(_0xFFFFFFFF)).toNumber();}},{key:'getCombinedGroupId',value:function getCombinedGroupId(groupId){var _groupId=Long.fromNumber(groupId);return _groupId.add(_0x7FFFFFFF).shiftLeft(32).toNumber();}},{key:'isEmpty',value:function isEmpty(){return this.getGroupCount()==0;}},{key:'getChildType',value:function getChildType(groupPosition,childPosition){return 0;}},{key:'getChildTypeCount',value:function getChildTypeCount(){return 1;}},{key:'getGroupType',value:function getGroupType(groupPosition){return 0;}},{key:'getGroupTypeCount',value:function getGroupTypeCount(){return 1;}}]);return BaseExpandableListAdapter;}();widget.BaseExpandableListAdapter=BaseExpandableListAdapter;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var Handler=android.os.Handler;var Log=android.util.Log;var Gravity=android.view.Gravity;var WindowManager=android.view.WindowManager;var Window=android.view.Window;var Toast=function(){function Toast(context){var _this143=this;_classCallCheck(this,Toast);this.mDuration=0;this.mHandler=new Handler();this.mDelayHide=function(){var inner_this=_this143;return{run:function run(){inner_this.mTN.hide();}};}();this.mContext=context;this.mTN=new Toast.TN();this.mTN.mY=context.getResources().getDisplayMetrics().density*64;this.mTN.mGravity=Gravity.CENTER_HORIZONTAL|Gravity.BOTTOM;}_createClass(Toast,[{key:'show',value:function show(){if(this.mNextView==null){throw Error('new RuntimeException(\"setView must have been called\")');}var tn=this.mTN;tn.mNextView=this.mNextView;tn.show();this.mHandler.removeCallbacks(this.mDelayHide);var showDuration=this.mDuration===Toast.LENGTH_LONG?3500:this.mDuration===Toast.LENGTH_SHORT?2000:this.mDuration;this.mHandler.postDelayed(this.mDelayHide,showDuration);}},{key:'cancel',value:function cancel(){this.mTN.hide();}},{key:'setView',value:function setView(view){this.mNextView=view;}},{key:'getView',value:function getView(){return this.mNextView;}},{key:'setDuration',value:function setDuration(duration){this.mDuration=duration;}},{key:'getDuration',value:function getDuration(){return this.mDuration;}},{key:'setGravity',value:function setGravity(gravity,xOffset,yOffset){this.mTN.mGravity=gravity;this.mTN.mX=xOffset;this.mTN.mY=yOffset;}},{key:'getGravity',value:function getGravity(){return this.mTN.mGravity;}},{key:'getXOffset',value:function getXOffset(){return this.mTN.mX;}},{key:'getYOffset',value:function getYOffset(){return this.mTN.mY;}},{key:'setText',value:function setText(s){if(this.mNextView==null){throw Error('new RuntimeException(\"This Toast was not created with Toast.makeText()\")');}var tv=this.mNextView.findViewById(android.R.id.message);if(tv==null){throw Error('new RuntimeException(\"This Toast was not created with Toast.makeText()\")');}tv.setText(s);}}],[{key:'makeText',value:function makeText(context,text,duration){var result=new Toast(context);var inflate=context.getLayoutInflater();var v=inflate.inflate(android.R.layout.transient_notification,null);var tv=v.findViewById(android.R.id.message);tv.setMaxWidth(260*context.getResources().getDisplayMetrics().density);tv.setText(text);result.mNextView=v;result.mDuration=duration;return result;}}]);return Toast;}();Toast.TAG=\"Toast\";Toast.localLOGV=false;Toast.LENGTH_SHORT=0;Toast.LENGTH_LONG=1;widget.Toast=Toast;(function(Toast){var TN=function(){function TN(){var _this144=this;_classCallCheck(this,TN);this.mShow=function(){var inner_this=_this144;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'run',value:function run(){inner_this.handleShow();}}]);return _Inner;}();return new _Inner();}();this.mHide=function(){var inner_this=_this144;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'run',value:function run(){inner_this.handleHide();inner_this.mNextView=null;}}]);return _Inner;}();return new _Inner();}();this.mHandler=new Handler();this.mGravity=0;this.mX=0;this.mY=0;}_createClass(TN,[{key:'show',value:function show(){if(Toast.localLOGV)Log.v(Toast.TAG,\"SHOW: \"+this);this.mHandler.post(this.mShow);}},{key:'hide',value:function hide(){if(Toast.localLOGV)Log.v(Toast.TAG,\"HIDE: \"+this);this.mHandler.post(this.mHide);}},{key:'handleShow',value:function handleShow(){if(Toast.localLOGV)Log.v(Toast.TAG,\"HANDLE SHOW: \"+this+\" mView=\"+this.mView+\" mNextView=\"+this.mNextView);if(this.mView!=this.mNextView){this.handleHide();this.mView=this.mNextView;if(!this.mWindow){this.mWindow=new Window(this.mView.getContext().getApplicationContext());var _params7=this.mWindow.getAttributes();_params7.height=WindowManager.LayoutParams.WRAP_CONTENT;_params7.width=WindowManager.LayoutParams.WRAP_CONTENT;_params7.dimAmount=0;_params7.type=WindowManager.LayoutParams.TYPE_TOAST;_params7.setTitle(\"Toast\");_params7.leftMargin=_params7.rightMargin=36*this.mView.getContext().getResources().getDisplayMetrics().density;_params7.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;this.mWindow.setFloating(true);this.mWindow.setBackgroundColor(android.graphics.Color.TRANSPARENT);this.mWindow.setWindowAnimations(android.R.anim.toast_enter,android.R.anim.toast_exit,null,null);}var params=this.mWindow.getAttributes();this.mWindow.setContentView(this.mView);var context=this.mView.getContext().getApplicationContext();this.mWM=context.getWindowManager();var gravity=Gravity.getAbsoluteGravity(this.mGravity);params.gravity=gravity;params.x=this.mX;params.y=this.mY;if(this.mWindow.getDecorView().getParent()!=null){if(Toast.localLOGV)Log.v(Toast.TAG,\"REMOVE! \"+this.mView+\" in \"+this);this.mWM.removeWindow(this.mWindow);}if(Toast.localLOGV)Log.v(Toast.TAG,\"ADD! \"+this.mView+\" in \"+this);this.mWM.addWindow(this.mWindow);}}},{key:'handleHide',value:function handleHide(){if(Toast.localLOGV)Log.v(Toast.TAG,\"HANDLE HIDE: \"+this+\" mView=\"+this.mView);if(this.mView!=null){if(this.mView.getParent()!=null){if(Toast.localLOGV)Log.v(Toast.TAG,\"REMOVE! \"+this.mView+\" in \"+this);this.mWM.removeWindow(this.mWindow);}this.mView=null;}}}]);return TN;}();Toast.TN=TN;})(Toast=widget.Toast||(widget.Toast={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var content;(function(content){var DialogInterface;(function(DialogInterface){DialogInterface.BUTTON_POSITIVE=-1;DialogInterface.BUTTON_NEGATIVE=-2;DialogInterface.BUTTON_NEUTRAL=-3;DialogInterface.BUTTON1=DialogInterface.BUTTON_POSITIVE;DialogInterface.BUTTON2=DialogInterface.BUTTON_NEGATIVE;DialogInterface.BUTTON3=DialogInterface.BUTTON_NEUTRAL;})(DialogInterface=content.DialogInterface||(content.DialogInterface={}));})(content=android.content||(android.content={}));})(android||(android={}));var android;(function(android){var app;(function(app){var Handler=android.os.Handler;var Message=android.os.Message;var Log=android.util.Log;var Gravity=android.view.Gravity;var KeyEvent=android.view.KeyEvent;var View=android.view.View;var ViewGroup=android.view.ViewGroup;var Window=android.view.Window;var WindowManager=android.view.WindowManager;var WeakReference=java.lang.ref.WeakReference;var Dialog=function(){function Dialog(context,cancelable,cancelListener){var _this145=this;_classCallCheck(this,Dialog);this.mCancelable=true;this.mCreated=false;this.mShowing=false;this.mCanceled=false;this.mHandler=new Handler();this.mDismissAction=function(){var inner_this=_this145;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'run',value:function run(){inner_this.dismissDialog();}}]);return _Inner;}();return new _Inner();}();this.mContext=context;this.mWindowManager=context.getWindowManager();var w=new Window(context);w.setFloating(true);w.setDimAmount(0.7);w.setBackgroundColor(android.graphics.Color.TRANSPARENT);this.mWindow=w;var dm=context.getResources().getDisplayMetrics();var decor=w.getDecorView();decor.setMinimumWidth(dm.density*280);decor.setMinimumHeight(dm.density*20);var onMeasure=decor.onMeasure;decor.onMeasure=function(widthMeasureSpec,heightMeasureSpec){onMeasure.call(decor,widthMeasureSpec,heightMeasureSpec);var width=decor.getMeasuredWidth();if(width>360*dm.density){var widthSpec=View.MeasureSpec.makeMeasureSpec(360*dm.density,View.MeasureSpec.EXACTLY);onMeasure.call(decor,widthSpec,heightMeasureSpec);}};var wp=w.getAttributes();wp.flags|=WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;wp.height=wp.width=ViewGroup.LayoutParams.WRAP_CONTENT;wp.leftMargin=wp.rightMargin=wp.topMargin=wp.bottomMargin=dm.density*16;w.setWindowAnimations(android.R.anim.dialog_enter,android.R.anim.dialog_exit,null,null);w.setChildWindowManager(this.mWindowManager);w.setGravity(Gravity.CENTER);w.setCallback(this);this.mListenersHandler=new Dialog.ListenersHandler(this);this.mCancelable=cancelable;this.setOnCancelListener(cancelListener);}_createClass(Dialog,[{key:'getContext',value:function getContext(){return this.mContext;}},{key:'isShowing',value:function isShowing(){return this.mShowing;}},{key:'show',value:function show(){if(this.mShowing){if(this.mDecor!=null){this.mDecor.setVisibility(View.VISIBLE);}return;}this.mCanceled=false;if(!this.mCreated){this.dispatchOnCreate(null);}this.onStart();this.mDecor=this.mWindow.getDecorView();try{this.mWindowManager.addWindow(this.mWindow);this.mShowing=true;this.sendShowMessage();}finally{}}},{key:'hide',value:function hide(){if(this.mDecor!=null){this.mDecor.setVisibility(View.GONE);}}},{key:'dismiss',value:function dismiss(){this.dismissDialog();}},{key:'dismissDialog',value:function dismissDialog(){if(this.mDecor==null||!this.mShowing){return;}if(this.mWindow.isDestroyed()){Log.e(Dialog.TAG,\"Tried to dismissDialog() but the Dialog's window was already destroyed!\");return;}try{this.mWindowManager.removeWindow(this.mWindow);}finally{this.mDecor=null;this.onStop();this.mShowing=false;this.sendDismissMessage();}}},{key:'sendDismissMessage',value:function sendDismissMessage(){if(this.mDismissMessage!=null){Message.obtain(this.mDismissMessage).sendToTarget();}}},{key:'sendShowMessage',value:function sendShowMessage(){if(this.mShowMessage!=null){Message.obtain(this.mShowMessage).sendToTarget();}}},{key:'dispatchOnCreate',value:function dispatchOnCreate(savedInstanceState){if(!this.mCreated){this.onCreate(savedInstanceState);this.mCreated=true;}}},{key:'onCreate',value:function onCreate(savedInstanceState){}},{key:'onStart',value:function onStart(){}},{key:'onStop',value:function onStop(){}},{key:'getWindow',value:function getWindow(){return this.mWindow;}},{key:'getCurrentFocus',value:function getCurrentFocus(){return this.mWindow!=null?this.mWindow.getCurrentFocus():null;}},{key:'findViewById',value:function findViewById(id){return this.mWindow.findViewById(id);}},{key:'setContentView',value:function setContentView(view,params){this.mWindow.setContentView(view,params);}},{key:'addContentView',value:function addContentView(view,params){this.mWindow.addContentView(view,params);}},{key:'setTitle',value:function setTitle(title){this.mWindow.setTitle(title);this.mWindow.getAttributes().setTitle(title);}},{key:'onKeyDown',value:function onKeyDown(keyCode,event){if(keyCode==KeyEvent.KEYCODE_BACK){event.startTracking();return true;}return false;}},{key:'onKeyLongPress',value:function onKeyLongPress(keyCode,event){return false;}},{key:'onKeyUp',value:function onKeyUp(keyCode,event){if(keyCode==KeyEvent.KEYCODE_BACK&&event.isTracking()&&!event.isCanceled()){this.onBackPressed();return true;}return false;}},{key:'onKeyMultiple',value:function onKeyMultiple(keyCode,repeatCount,event){return false;}},{key:'onBackPressed',value:function onBackPressed(){if(this.mCancelable){this.cancel();}}},{key:'onTouchEvent',value:function onTouchEvent(event){if(this.mCancelable&&this.mShowing&&this.mWindow.shouldCloseOnTouch(this.mContext,event)){this.cancel();return true;}return false;}},{key:'onTrackballEvent',value:function onTrackballEvent(event){return false;}},{key:'onGenericMotionEvent',value:function onGenericMotionEvent(event){return false;}},{key:'onWindowAttributesChanged',value:function onWindowAttributesChanged(params){if(this.mDecor!=null){this.mWindowManager.updateWindowLayout(this.mWindow,params);}}},{key:'onContentChanged',value:function onContentChanged(){}},{key:'onWindowFocusChanged',value:function onWindowFocusChanged(hasFocus){}},{key:'onAttachedToWindow',value:function onAttachedToWindow(){}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){}},{key:'dispatchKeyEvent',value:function dispatchKeyEvent(event){if(this.mOnKeyListener!=null&&this.mOnKeyListener.onKey(this,event.getKeyCode(),event)){return true;}if(this.mWindow.superDispatchKeyEvent(event)){return true;}return event.dispatch(this,this.mDecor!=null?this.mDecor.getKeyDispatcherState():null,this);}},{key:'dispatchTouchEvent',value:function dispatchTouchEvent(ev){if(this.mWindow.superDispatchTouchEvent(ev)){return true;}return this.onTouchEvent(ev);}},{key:'dispatchGenericMotionEvent',value:function dispatchGenericMotionEvent(ev){if(this.mWindow.superDispatchGenericMotionEvent(ev)){return true;}return this.onGenericMotionEvent(ev);}},{key:'takeKeyEvents',value:function takeKeyEvents(get){this.mWindow.takeKeyEvents(get);}},{key:'getLayoutInflater',value:function getLayoutInflater(){return this.getWindow().getLayoutInflater();}},{key:'setCancelable',value:function setCancelable(flag){this.mCancelable=flag;}},{key:'setCanceledOnTouchOutside',value:function setCanceledOnTouchOutside(cancel){if(cancel&&!this.mCancelable){this.mCancelable=true;}this.mWindow.setCloseOnTouchOutside(cancel);}},{key:'cancel',value:function cancel(){if(!this.mCanceled&&this.mCancelMessage!=null){this.mCanceled=true;Message.obtain(this.mCancelMessage).sendToTarget();}this.dismiss();}},{key:'setOnCancelListener',value:function setOnCancelListener(listener){if(this.mCancelAndDismissTaken!=null){throw Error('new IllegalStateException(\"OnCancelListener is already taken by \" + this.mCancelAndDismissTaken + \" and can not be replaced.\")');}if(listener!=null){this.mCancelMessage=this.mListenersHandler.obtainMessage(Dialog.CANCEL,listener);}else{this.mCancelMessage=null;}}},{key:'setCancelMessage',value:function setCancelMessage(msg){this.mCancelMessage=msg;}},{key:'setOnDismissListener',value:function setOnDismissListener(listener){if(this.mCancelAndDismissTaken!=null){throw Error('new IllegalStateException(\"OnDismissListener is already taken by \" + this.mCancelAndDismissTaken + \" and can not be replaced.\")');}if(listener!=null){this.mDismissMessage=this.mListenersHandler.obtainMessage(Dialog.DISMISS,listener);}else{this.mDismissMessage=null;}}},{key:'setOnShowListener',value:function setOnShowListener(listener){if(listener!=null){this.mShowMessage=this.mListenersHandler.obtainMessage(Dialog.SHOW,listener);}else{this.mShowMessage=null;}}},{key:'setDismissMessage',value:function setDismissMessage(msg){this.mDismissMessage=msg;}},{key:'takeCancelAndDismissListeners',value:function takeCancelAndDismissListeners(msg,cancel,dismiss){if(this.mCancelAndDismissTaken!=null){this.mCancelAndDismissTaken=null;}else if(this.mCancelMessage!=null||this.mDismissMessage!=null){return false;}this.setOnCancelListener(cancel);this.setOnDismissListener(dismiss);this.mCancelAndDismissTaken=msg;return true;}},{key:'setOnKeyListener',value:function setOnKeyListener(onKeyListener){this.mOnKeyListener=onKeyListener;}}]);return Dialog;}();Dialog.TAG=\"Dialog\";Dialog.DISMISS=0x43;Dialog.CANCEL=0x44;Dialog.SHOW=0x45;Dialog.DIALOG_SHOWING_TAG=\"android:dialogShowing\";Dialog.DIALOG_HIERARCHY_TAG=\"android:dialogHierarchy\";app.Dialog=Dialog;(function(Dialog){var ListenersHandler=function(_Handler4){_inherits(ListenersHandler,_Handler4);function ListenersHandler(dialog){_classCallCheck(this,ListenersHandler);var _this146=_possibleConstructorReturn(this,(ListenersHandler.__proto__||Object.getPrototypeOf(ListenersHandler)).call(this));_this146.mDialog=new WeakReference(dialog);return _this146;}_createClass(ListenersHandler,[{key:'handleMessage',value:function handleMessage(msg){switch(msg.what){case Dialog.DISMISS:msg.obj.onDismiss(this.mDialog.get());break;case Dialog.CANCEL:msg.obj.onCancel(this.mDialog.get());break;case Dialog.SHOW:msg.obj.onShow(this.mDialog.get());break;}}}]);return ListenersHandler;}(Handler);Dialog.ListenersHandler=ListenersHandler;})(Dialog=app.Dialog||(app.Dialog={}));})(app=android.app||(android.app={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var Log=android.util.Log;var ArrayList=java.util.ArrayList;var Arrays=java.util.Arrays;var Collections=java.util.Collections;var BaseAdapter=android.widget.BaseAdapter;var ArrayAdapter=function(_BaseAdapter2){_inherits(ArrayAdapter,_BaseAdapter2);function ArrayAdapter(){_classCallCheck(this,ArrayAdapter);var _this147=_possibleConstructorReturn(this,(ArrayAdapter.__proto__||Object.getPrototypeOf(ArrayAdapter)).call(this));_this147.mNotifyOnChange=true;if(arguments.length===2){_this147.init(arguments.length<=0?undefined:arguments[0],arguments.length<=1?undefined:arguments[1],null,new ArrayList());}else if(arguments.length===3){if((arguments.length<=2?undefined:arguments[2])instanceof Array){_this147.init(arguments.length<=0?undefined:arguments[0],arguments.length<=1?undefined:arguments[1],null,Arrays.asList(arguments.length<=2?undefined:arguments[2]));}else{_this147.init(arguments.length<=0?undefined:arguments[0],arguments.length<=1?undefined:arguments[1],arguments.length<=2?undefined:arguments[2],new ArrayList());}}else if(arguments.length===4){_this147.init(arguments.length<=0?undefined:arguments[0],arguments.length<=1?undefined:arguments[1],arguments.length<=2?undefined:arguments[2],arguments.length<=3?undefined:arguments[3]);}return _this147;}_createClass(ArrayAdapter,[{key:'add',value:function add(object){{this.mObjects.add(object);}if(this.mNotifyOnChange)this.notifyDataSetChanged();}},{key:'addAll',value:function addAll(collection){{this.mObjects.addAll(collection);}if(this.mNotifyOnChange)this.notifyDataSetChanged();}},{key:'insert',value:function insert(object,index){{this.mObjects.add(index,object);}if(this.mNotifyOnChange)this.notifyDataSetChanged();}},{key:'remove',value:function remove(object){{this.mObjects.remove(object);}if(this.mNotifyOnChange)this.notifyDataSetChanged();}},{key:'clear',value:function clear(){{this.mObjects.clear();}if(this.mNotifyOnChange)this.notifyDataSetChanged();}},{key:'sort',value:function sort(comparator){{Collections.sort(this.mObjects,comparator);}if(this.mNotifyOnChange)this.notifyDataSetChanged();}},{key:'notifyDataSetChanged',value:function notifyDataSetChanged(){_get2(ArrayAdapter.prototype.__proto__||Object.getPrototypeOf(ArrayAdapter.prototype),'notifyDataSetChanged',this).call(this);this.mNotifyOnChange=true;}},{key:'setNotifyOnChange',value:function setNotifyOnChange(notifyOnChange){this.mNotifyOnChange=notifyOnChange;}},{key:'init',value:function init(context,resource,textViewResourceId,objects){this.mContext=context;this.mInflater=context.getLayoutInflater();this.mResource=this.mDropDownResource=resource;if(objects instanceof Array)objects=Arrays.asList(objects);this.mObjects=objects;this.mFieldId=textViewResourceId;}},{key:'getContext',value:function getContext(){return this.mContext;}},{key:'getCount',value:function getCount(){return this.mObjects.size();}},{key:'getItem',value:function getItem(position){return this.mObjects.get(position);}},{key:'getPosition',value:function getPosition(item){return this.mObjects.indexOf(item);}},{key:'getItemId',value:function getItemId(position){return position;}},{key:'getView',value:function getView(position,convertView,parent){return this.createViewFromResource(position,convertView,parent,this.mResource);}},{key:'createViewFromResource',value:function createViewFromResource(position,convertView,parent,resource){var view=void 0;var text=void 0;if(convertView==null){view=this.mInflater.inflate(this.mContext.getResources().getLayout(resource),parent,false);}else{view=convertView;}try{if(this.mFieldId==null){text=view;}else{text=view.findViewById(this.mFieldId);}}catch(e){Log.e(\"ArrayAdapter\",\"You must supply a resource ID for a TextView\");throw Error('new IllegalStateException(\"ArrayAdapter requires the resource ID to be a TextView\", e)');}var item=this.getItem(position);if(typeof item==='string'){text.setText(item);}else{text.setText(item.toString());}return view;}},{key:'setDropDownViewResource',value:function setDropDownViewResource(resource){this.mDropDownResource=resource;}},{key:'getDropDownView',value:function getDropDownView(position,convertView,parent){return this.createViewFromResource(position,convertView,parent,this.mDropDownResource);}}]);return ArrayAdapter;}(BaseAdapter);widget.ArrayAdapter=ArrayAdapter;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var app;(function(app){var MATCH_PARENT=android.view.ViewGroup.LayoutParams.MATCH_PARENT;var R=android.R;var DialogInterface=android.content.DialogInterface;var Handler=android.os.Handler;var Message=android.os.Message;var TextUtils=android.text.TextUtils;var Gravity=android.view.Gravity;var View=android.view.View;var LayoutParams=android.view.ViewGroup.LayoutParams;var ArrayAdapter=android.widget.ArrayAdapter;var LinearLayout=android.widget.LinearLayout;var ListView=android.widget.ListView;var WeakReference=java.lang.ref.WeakReference;var AlertController=function(){function AlertController(context,di,window){var _this148=this;_classCallCheck(this,AlertController);this.mViewSpacingLeft=0;this.mViewSpacingTop=0;this.mViewSpacingRight=0;this.mViewSpacingBottom=0;this.mViewSpacingSpecified=false;this.mCheckedItem=-1;this.mButtonHandler=function(){var inner_this=_this148;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'onClick',value:function onClick(v){var m=null;if(v==inner_this.mButtonPositive&&inner_this.mButtonPositiveMessage!=null){m=Message.obtain(inner_this.mButtonPositiveMessage);}else if(v==inner_this.mButtonNegative&&inner_this.mButtonNegativeMessage!=null){m=Message.obtain(inner_this.mButtonNegativeMessage);}else if(v==inner_this.mButtonNeutral&&inner_this.mButtonNeutralMessage!=null){m=Message.obtain(inner_this.mButtonNeutralMessage);}if(m!=null){m.sendToTarget();}inner_this.mHandler.obtainMessage(AlertController.ButtonHandler.MSG_DISMISS_DIALOG,inner_this.mDialogInterface).sendToTarget();}}]);return _Inner;}();return new _Inner();}();this.mContext=context;this.mDialogInterface=di;this.mWindow=window;this.mHandler=new AlertController.ButtonHandler(di);this.mAlertDialogLayout=R.layout.alert_dialog;this.mListLayout=R.layout.select_dialog;this.mMultiChoiceItemLayout=R.layout.select_dialog_multichoice;this.mSingleChoiceItemLayout=R.layout.select_dialog_singlechoice;this.mListItemLayout=R.layout.select_dialog_item;}_createClass(AlertController,[{key:'installContent',value:function installContent(){var layout=this.mContext.getLayoutInflater().inflate(this.mAlertDialogLayout,this.mWindow.getContentParent(),false);this.mWindow.setContentView(layout);this.setupView();}},{key:'setTitle',value:function setTitle(title){this.mTitle=title;if(this.mTitleView!=null){this.mTitleView.setText(title);}}},{key:'setCustomTitle',value:function setCustomTitle(customTitleView){this.mCustomTitleView=customTitleView;}},{key:'setMessage',value:function setMessage(message){this.mMessage=message;if(this.mMessageView!=null){this.mMessageView.setText(message);}}},{key:'setView',value:function setView(view){var viewSpacingLeft=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var viewSpacingTop=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var viewSpacingRight=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var viewSpacingBottom=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;this.mView=view;if(!viewSpacingLeft&&!viewSpacingTop&&!viewSpacingRight&&!viewSpacingBottom){this.mViewSpacingSpecified=false;}else{this.mViewSpacingSpecified=true;this.mViewSpacingLeft=viewSpacingLeft;this.mViewSpacingTop=viewSpacingTop;this.mViewSpacingRight=viewSpacingRight;this.mViewSpacingBottom=viewSpacingBottom;}}},{key:'setButton',value:function setButton(whichButton,text,listener,msg){if(msg==null&&listener!=null){msg=this.mHandler.obtainMessage(whichButton,listener);}switch(whichButton){case DialogInterface.BUTTON_POSITIVE:this.mButtonPositiveText=text;this.mButtonPositiveMessage=msg;break;case DialogInterface.BUTTON_NEGATIVE:this.mButtonNegativeText=text;this.mButtonNegativeMessage=msg;break;case DialogInterface.BUTTON_NEUTRAL:this.mButtonNeutralText=text;this.mButtonNeutralMessage=msg;break;default:throw Error('new IllegalArgumentException(\"Button does not exist\")');}}},{key:'setIcon',value:function setIcon(icon){this.mIcon=icon;if(this.mIconView!=null&&this.mIcon!=null){this.mIconView.setImageDrawable(icon);}}},{key:'setInverseBackgroundForced',value:function setInverseBackgroundForced(forceInverseBackground){this.mForceInverseBackground=forceInverseBackground;}},{key:'getListView',value:function getListView(){return this.mListView;}},{key:'getButton',value:function getButton(whichButton){switch(whichButton){case DialogInterface.BUTTON_POSITIVE:return this.mButtonPositive;case DialogInterface.BUTTON_NEGATIVE:return this.mButtonNegative;case DialogInterface.BUTTON_NEUTRAL:return this.mButtonNeutral;default:return null;}}},{key:'onKeyDown',value:function onKeyDown(keyCode,event){return this.mScrollView!=null&&this.mScrollView.executeKeyEvent(event);}},{key:'onKeyUp',value:function onKeyUp(keyCode,event){return this.mScrollView!=null&&this.mScrollView.executeKeyEvent(event);}},{key:'setupView',value:function setupView(){var contentPanel=this.mWindow.findViewById(R.id.contentPanel);this.setupContent(contentPanel);var hasButtons=this.setupButtons();var topPanel=this.mWindow.findViewById(R.id.topPanel);var hasTitle=this.setupTitle(topPanel);var buttonPanel=this.mWindow.findViewById(R.id.buttonPanel);if(!hasButtons){buttonPanel.setVisibility(View.GONE);this.mWindow.setCloseOnTouchOutsideIfNotSet(true);}var customPanel=null;if(this.mView!=null){customPanel=this.mWindow.findViewById(R.id.customPanel);var custom=this.mWindow.findViewById(R.id.custom);custom.addView(this.mView,new LayoutParams(MATCH_PARENT,MATCH_PARENT));if(this.mViewSpacingSpecified){custom.setPadding(this.mViewSpacingLeft,this.mViewSpacingTop,this.mViewSpacingRight,this.mViewSpacingBottom);}if(this.mListView!=null){customPanel.getLayoutParams().weight=0;}}else{this.mWindow.findViewById(R.id.customPanel).setVisibility(View.GONE);}if(hasTitle){var divider=null;if(this.mMessage!=null||this.mView!=null||this.mListView!=null){divider=this.mWindow.findViewById(R.id.titleDivider);}else{divider=this.mWindow.findViewById(R.id.titleDividerTop);}if(divider!=null){divider.setVisibility(View.VISIBLE);}}this.setBackground(topPanel,contentPanel,customPanel,hasButtons,hasTitle,buttonPanel);}},{key:'setupTitle',value:function setupTitle(topPanel){var hasTitle=true;if(this.mCustomTitleView!=null){var lp=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);topPanel.addView(this.mCustomTitleView,0,lp);var titleTemplate=this.mWindow.findViewById(R.id.title_template);titleTemplate.setVisibility(View.GONE);}else{var hasTextTitle=!TextUtils.isEmpty(this.mTitle);this.mIconView=this.mWindow.findViewById(R.id.icon);if(hasTextTitle){this.mTitleView=this.mWindow.findViewById(R.id.alertTitle);this.mTitleView.setText(this.mTitle);if(this.mIcon!=null){this.mIconView.setImageDrawable(this.mIcon);}else{this.mTitleView.setPadding(this.mIconView.getPaddingLeft(),this.mIconView.getPaddingTop(),this.mIconView.getPaddingRight(),this.mIconView.getPaddingBottom());this.mIconView.setVisibility(View.GONE);}}else{var _titleTemplate=this.mWindow.findViewById(R.id.title_template);_titleTemplate.setVisibility(View.GONE);this.mIconView.setVisibility(View.GONE);topPanel.setVisibility(View.GONE);hasTitle=false;}}return hasTitle;}},{key:'setupContent',value:function setupContent(contentPanel){this.mScrollView=this.mWindow.findViewById(R.id.scrollView);this.mScrollView.setFocusable(false);this.mMessageView=this.mWindow.findViewById(R.id.message);if(this.mMessageView==null){return;}if(this.mMessage!=null){this.mMessageView.setText(this.mMessage);}else{this.mMessageView.setVisibility(View.GONE);this.mScrollView.removeView(this.mMessageView);if(this.mListView!=null){contentPanel.removeView(this.mWindow.findViewById(R.id.scrollView));contentPanel.addView(this.mListView,new LinearLayout.LayoutParams(MATCH_PARENT,MATCH_PARENT));contentPanel.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT,0,1.0));}else{contentPanel.setVisibility(View.GONE);}}}},{key:'setupButtons',value:function setupButtons(){var BIT_BUTTON_POSITIVE=1;var BIT_BUTTON_NEGATIVE=2;var BIT_BUTTON_NEUTRAL=4;var whichButtons=0;this.mButtonPositive=this.mWindow.findViewById(R.id.button1);this.mButtonPositive.setOnClickListener(this.mButtonHandler);if(TextUtils.isEmpty(this.mButtonPositiveText)){this.mButtonPositive.setVisibility(View.GONE);}else{this.mButtonPositive.setText(this.mButtonPositiveText);this.mButtonPositive.setVisibility(View.VISIBLE);whichButtons=whichButtons|BIT_BUTTON_POSITIVE;}this.mButtonNegative=this.mWindow.findViewById(R.id.button2);this.mButtonNegative.setOnClickListener(this.mButtonHandler);if(TextUtils.isEmpty(this.mButtonNegativeText)){this.mButtonNegative.setVisibility(View.GONE);}else{this.mButtonNegative.setText(this.mButtonNegativeText);this.mButtonNegative.setVisibility(View.VISIBLE);whichButtons=whichButtons|BIT_BUTTON_NEGATIVE;}this.mButtonNeutral=this.mWindow.findViewById(R.id.button3);this.mButtonNeutral.setOnClickListener(this.mButtonHandler);if(TextUtils.isEmpty(this.mButtonNeutralText)){this.mButtonNeutral.setVisibility(View.GONE);}else{this.mButtonNeutral.setText(this.mButtonNeutralText);this.mButtonNeutral.setVisibility(View.VISIBLE);whichButtons=whichButtons|BIT_BUTTON_NEUTRAL;}if(AlertController.shouldCenterSingleButton(this.mContext)){if(whichButtons==BIT_BUTTON_POSITIVE){this.centerButton(this.mButtonPositive);}else if(whichButtons==BIT_BUTTON_NEGATIVE){this.centerButton(this.mButtonNegative);}else if(whichButtons==BIT_BUTTON_NEUTRAL){this.centerButton(this.mButtonNeutral);}}return whichButtons!=0;}},{key:'centerButton',value:function centerButton(button){var params=button.getLayoutParams();params.gravity=Gravity.CENTER_HORIZONTAL;params.weight=0.5;button.setLayoutParams(params);var leftSpacer=this.mWindow.findViewById(R.id.leftSpacer);if(leftSpacer!=null){leftSpacer.setVisibility(View.VISIBLE);}var rightSpacer=this.mWindow.findViewById(R.id.rightSpacer);if(rightSpacer!=null){rightSpacer.setVisibility(View.VISIBLE);}}},{key:'setBackground',value:function setBackground(topPanel,contentPanel,customPanel,hasButtons,hasTitle,buttonPanel){var fullDark=R.image.popup_full_bright;var topDark=R.image.popup_top_bright;var centerDark=R.image.popup_center_bright;var bottomDark=R.image.popup_bottom_bright;var fullBright=R.image.popup_full_bright;var topBright=R.image.popup_top_bright;var centerBright=R.image.popup_center_bright;var bottomBright=R.image.popup_bottom_bright;var bottomMedium=R.image.popup_bottom_bright;var views=new Array(4);var light=new Array(4);var lastView=null;var lastLight=false;var pos=0;if(hasTitle){views[pos]=topPanel;light[pos]=false;pos++;}views[pos]=contentPanel.getVisibility()==View.GONE?null:contentPanel;light[pos]=this.mListView!=null;pos++;if(customPanel!=null){views[pos]=customPanel;light[pos]=this.mForceInverseBackground;pos++;}if(hasButtons){views[pos]=buttonPanel;light[pos]=true;}var setView=false;for(pos=0;pos<views.length;pos++){var v=views[pos];if(v==null){continue;}if(lastView!=null){if(!setView){lastView.setBackground(lastLight?topBright:topDark);}else{lastView.setBackground(lastLight?centerBright:centerDark);}setView=true;}lastView=v;lastLight=light[pos];}if(lastView!=null){if(setView){lastView.setBackground(lastLight?hasButtons?bottomMedium:bottomBright:bottomDark);}else{lastView.setBackground(lastLight?fullBright:fullDark);}}if(this.mListView!=null&&this.mAdapter!=null){this.mListView.setAdapter(this.mAdapter);if(this.mCheckedItem>-1){this.mListView.setItemChecked(this.mCheckedItem,true);this.mListView.setSelection(this.mCheckedItem);}}}}],[{key:'shouldCenterSingleButton',value:function shouldCenterSingleButton(context){return true;}}]);return AlertController;}();app.AlertController=AlertController;(function(AlertController){var ButtonHandler=function(_Handler5){_inherits(ButtonHandler,_Handler5);function ButtonHandler(dialog){_classCallCheck(this,ButtonHandler);var _this149=_possibleConstructorReturn(this,(ButtonHandler.__proto__||Object.getPrototypeOf(ButtonHandler)).call(this));_this149.mDialog=new WeakReference(dialog);return _this149;}_createClass(ButtonHandler,[{key:'handleMessage',value:function handleMessage(msg){switch(msg.what){case DialogInterface.BUTTON_POSITIVE:case DialogInterface.BUTTON_NEGATIVE:case DialogInterface.BUTTON_NEUTRAL:msg.obj.onClick(this.mDialog.get(),msg.what);break;case ButtonHandler.MSG_DISMISS_DIALOG:msg.obj.dismiss();}}}]);return ButtonHandler;}(Handler);ButtonHandler.MSG_DISMISS_DIALOG=1;AlertController.ButtonHandler=ButtonHandler;var RecycleListView=function(_ListView2){_inherits(RecycleListView,_ListView2);function RecycleListView(context,bindElement,defStyle){_classCallCheck(this,RecycleListView);var _this150=_possibleConstructorReturn(this,(RecycleListView.__proto__||Object.getPrototypeOf(RecycleListView)).call(this,context,bindElement,defStyle));_this150.mRecycleOnMeasure=true;return _this150;}_createClass(RecycleListView,[{key:'recycleOnMeasure',value:function recycleOnMeasure(){return this.mRecycleOnMeasure;}}]);return RecycleListView;}(ListView);AlertController.RecycleListView=RecycleListView;var AlertParams=function(){function AlertParams(context){_classCallCheck(this,AlertParams);this.mIconId=0;this.mViewSpacingLeft=0;this.mViewSpacingTop=0;this.mViewSpacingRight=0;this.mViewSpacingBottom=0;this.mViewSpacingSpecified=false;this.mCheckedItem=-1;this.mRecycleOnMeasure=true;this.mContext=context;this.mCancelable=true;this.mInflater=context.getLayoutInflater();}_createClass(AlertParams,[{key:'apply',value:function apply(dialog){if(this.mCustomTitleView!=null){dialog.setCustomTitle(this.mCustomTitleView);}else{if(this.mTitle!=null){dialog.setTitle(this.mTitle);}if(this.mIcon!=null){dialog.setIcon(this.mIcon);}}if(this.mMessage!=null){dialog.setMessage(this.mMessage);}if(this.mPositiveButtonText!=null){dialog.setButton(DialogInterface.BUTTON_POSITIVE,this.mPositiveButtonText,this.mPositiveButtonListener,null);}if(this.mNegativeButtonText!=null){dialog.setButton(DialogInterface.BUTTON_NEGATIVE,this.mNegativeButtonText,this.mNegativeButtonListener,null);}if(this.mNeutralButtonText!=null){dialog.setButton(DialogInterface.BUTTON_NEUTRAL,this.mNeutralButtonText,this.mNeutralButtonListener,null);}if(this.mForceInverseBackground){dialog.setInverseBackgroundForced(true);}if(this.mItems!=null||this.mAdapter!=null){this.createListView(dialog);}if(this.mView!=null){if(this.mViewSpacingSpecified){dialog.setView(this.mView,this.mViewSpacingLeft,this.mViewSpacingTop,this.mViewSpacingRight,this.mViewSpacingBottom);}else{dialog.setView(this.mView);}}}},{key:'createListView',value:function createListView(dialog){var _this151=this;var listView=this.mInflater.inflate(dialog.mListLayout,null);var adapter=void 0;if(this.mIsMultiChoice){adapter=function(){var inner_this=_this151;var _Inner=function(_ArrayAdapter){_inherits(_Inner,_ArrayAdapter);function _Inner(){_classCallCheck(this,_Inner);return _possibleConstructorReturn(this,(_Inner.__proto__||Object.getPrototypeOf(_Inner)).apply(this,arguments));}_createClass(_Inner,[{key:'getView',value:function getView(position,convertView,parent){var view=_get2(_Inner.prototype.__proto__||Object.getPrototypeOf(_Inner.prototype),'getView',this).call(this,position,convertView,parent);if(inner_this.mCheckedItems!=null){var isItemChecked=inner_this.mCheckedItems[position];if(isItemChecked){listView.setItemChecked(position,true);}}return view;}}]);return _Inner;}(ArrayAdapter);return new _Inner(_this151.mContext,dialog.mMultiChoiceItemLayout,R.id.text1,_this151.mItems);}();}else{var layout=this.mIsSingleChoice?dialog.mSingleChoiceItemLayout:dialog.mListItemLayout;adapter=this.mAdapter!=null?this.mAdapter:new ArrayAdapter(this.mContext,layout,R.id.text1,this.mItems);}if(this.mOnPrepareListViewListener!=null){this.mOnPrepareListViewListener.onPrepareListView(listView);}dialog.mAdapter=adapter;dialog.mCheckedItem=this.mCheckedItem;var inner_this=this;if(this.mOnClickListener!=null){listView.setOnItemClickListener({onItemClick:function onItemClick(parent,v,position,id){inner_this.mOnClickListener.onClick(dialog.mDialogInterface,position);if(!inner_this.mIsSingleChoice){dialog.mDialogInterface.dismiss();}}});}else if(this.mOnCheckboxClickListener!=null){listView.setOnItemClickListener({onItemClick:function onItemClick(parent,v,position,id){if(inner_this.mCheckedItems!=null){inner_this.mCheckedItems[position]=listView.isItemChecked(position);}inner_this.mOnCheckboxClickListener.onClick(dialog.mDialogInterface,position,listView.isItemChecked(position));}});}if(this.mOnItemSelectedListener!=null){listView.setOnItemSelectedListener(this.mOnItemSelectedListener);}if(this.mIsSingleChoice){listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);}else if(this.mIsMultiChoice){listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);}listView.mRecycleOnMeasure=this.mRecycleOnMeasure;dialog.mListView=listView;}}]);return AlertParams;}();AlertController.AlertParams=AlertParams;})(AlertController=app.AlertController||(app.AlertController={}));})(app=android.app||(android.app={}));})(android||(android={}));var android;(function(android){var app;(function(app){var Dialog=android.app.Dialog;var AlertDialog=function(_Dialog){_inherits(AlertDialog,_Dialog);function AlertDialog(context,cancelable,cancelListener){_classCallCheck(this,AlertDialog);var _this153=_possibleConstructorReturn(this,(AlertDialog.__proto__||Object.getPrototypeOf(AlertDialog)).call(this,context));_this153.setCancelable(cancelable);_this153.setOnCancelListener(cancelListener);_this153.mAlert=new app.AlertController(context,_this153,_this153.getWindow());return _this153;}_createClass(AlertDialog,[{key:'getButton',value:function getButton(whichButton){return this.mAlert.getButton(whichButton);}},{key:'getListView',value:function getListView(){return this.mAlert.getListView();}},{key:'setTitle',value:function setTitle(title){_get2(AlertDialog.prototype.__proto__||Object.getPrototypeOf(AlertDialog.prototype),'setTitle',this).call(this,title);this.mAlert.setTitle(title);}},{key:'setCustomTitle',value:function setCustomTitle(customTitleView){this.mAlert.setCustomTitle(customTitleView);}},{key:'setMessage',value:function setMessage(message){this.mAlert.setMessage(message);}},{key:'setView',value:function setView(view){var viewSpacingLeft=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var viewSpacingTop=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var viewSpacingRight=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var viewSpacingBottom=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;this.mAlert.setView(view,viewSpacingLeft,viewSpacingTop,viewSpacingRight,viewSpacingBottom);}},{key:'setButton',value:function setButton(whichButton,text,listener){this.mAlert.setButton(whichButton,text,listener,null);}},{key:'setIcon',value:function setIcon(icon){this.mAlert.setIcon(icon);}},{key:'onCreate',value:function onCreate(savedInstanceState){_get2(AlertDialog.prototype.__proto__||Object.getPrototypeOf(AlertDialog.prototype),'onCreate',this).call(this,savedInstanceState);this.mAlert.installContent();}},{key:'onKeyDown',value:function onKeyDown(keyCode,event){if(this.mAlert.onKeyDown(keyCode,event))return true;return _get2(AlertDialog.prototype.__proto__||Object.getPrototypeOf(AlertDialog.prototype),'onKeyDown',this).call(this,keyCode,event);}},{key:'onKeyUp',value:function onKeyUp(keyCode,event){if(this.mAlert.onKeyUp(keyCode,event))return true;return _get2(AlertDialog.prototype.__proto__||Object.getPrototypeOf(AlertDialog.prototype),'onKeyUp',this).call(this,keyCode,event);}}]);return AlertDialog;}(Dialog);AlertDialog.THEME_TRADITIONAL=1;AlertDialog.THEME_HOLO_DARK=2;AlertDialog.THEME_HOLO_LIGHT=3;AlertDialog.THEME_DEVICE_DEFAULT_DARK=4;AlertDialog.THEME_DEVICE_DEFAULT_LIGHT=5;app.AlertDialog=AlertDialog;(function(AlertDialog){var Builder=function(){function Builder(context){_classCallCheck(this,Builder);this.P=new app.AlertController.AlertParams(context);}_createClass(Builder,[{key:'getContext',value:function getContext(){return this.P.mContext;}},{key:'setTitle',value:function setTitle(title){this.P.mTitle=title;return this;}},{key:'setCustomTitle',value:function setCustomTitle(customTitleView){this.P.mCustomTitleView=customTitleView;return this;}},{key:'setMessage',value:function setMessage(message){this.P.mMessage=message;return this;}},{key:'setIcon',value:function setIcon(icon){this.P.mIcon=icon;return this;}},{key:'setPositiveButton',value:function setPositiveButton(text,listener){this.P.mPositiveButtonText=text;this.P.mPositiveButtonListener=listener;return this;}},{key:'setNegativeButton',value:function setNegativeButton(text,listener){this.P.mNegativeButtonText=text;this.P.mNegativeButtonListener=listener;return this;}},{key:'setNeutralButton',value:function setNeutralButton(text,listener){this.P.mNeutralButtonText=text;this.P.mNeutralButtonListener=listener;return this;}},{key:'setCancelable',value:function setCancelable(cancelable){this.P.mCancelable=cancelable;return this;}},{key:'setOnCancelListener',value:function setOnCancelListener(onCancelListener){this.P.mOnCancelListener=onCancelListener;return this;}},{key:'setOnDismissListener',value:function setOnDismissListener(onDismissListener){this.P.mOnDismissListener=onDismissListener;return this;}},{key:'setOnKeyListener',value:function setOnKeyListener(onKeyListener){this.P.mOnKeyListener=onKeyListener;return this;}},{key:'setItems',value:function setItems(items,listener){this.P.mItems=items;this.P.mOnClickListener=listener;return this;}},{key:'setAdapter',value:function setAdapter(adapter,listener){this.P.mAdapter=adapter;this.P.mOnClickListener=listener;return this;}},{key:'setMultiChoiceItems',value:function setMultiChoiceItems(items,checkedItems,listener){this.P.mItems=items;this.P.mOnCheckboxClickListener=listener;this.P.mCheckedItems=checkedItems;this.P.mIsMultiChoice=true;return this;}},{key:'setSingleChoiceItems',value:function setSingleChoiceItems(items,checkedItem,listener){this.P.mItems=items;this.P.mOnClickListener=listener;this.P.mCheckedItem=checkedItem;this.P.mIsSingleChoice=true;return this;}},{key:'setSingleChoiceItemsWithAdapter',value:function setSingleChoiceItemsWithAdapter(adapter,checkedItem,listener){this.P.mAdapter=adapter;this.P.mOnClickListener=listener;this.P.mCheckedItem=checkedItem;this.P.mIsSingleChoice=true;return this;}},{key:'setOnItemSelectedListener',value:function setOnItemSelectedListener(listener){this.P.mOnItemSelectedListener=listener;return this;}},{key:'setView',value:function setView(view){var viewSpacingLeft=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var viewSpacingTop=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var viewSpacingRight=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var viewSpacingBottom=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;this.P.mView=view;if(!viewSpacingLeft&&!viewSpacingTop&&!viewSpacingRight&&!viewSpacingBottom){this.P.mViewSpacingSpecified=false;}else{this.P.mViewSpacingSpecified=true;this.P.mViewSpacingLeft=viewSpacingLeft;this.P.mViewSpacingTop=viewSpacingTop;this.P.mViewSpacingRight=viewSpacingRight;this.P.mViewSpacingBottom=viewSpacingBottom;}return this;}},{key:'setInverseBackgroundForced',value:function setInverseBackgroundForced(useInverseBackground){this.P.mForceInverseBackground=useInverseBackground;return this;}},{key:'setRecycleOnMeasureEnabled',value:function setRecycleOnMeasureEnabled(enabled){this.P.mRecycleOnMeasure=enabled;return this;}},{key:'create',value:function create(){var dialog=new AlertDialog(this.P.mContext);this.P.apply(dialog.mAlert);dialog.setCancelable(this.P.mCancelable);if(this.P.mCancelable){dialog.setCanceledOnTouchOutside(true);}dialog.setOnCancelListener(this.P.mOnCancelListener);dialog.setOnDismissListener(this.P.mOnDismissListener);if(this.P.mOnKeyListener!=null){dialog.setOnKeyListener(this.P.mOnKeyListener);}return dialog;}},{key:'show',value:function show(){var dialog=this.create();dialog.show();return dialog;}}]);return Builder;}();AlertDialog.Builder=Builder;})(AlertDialog=app.AlertDialog||(app.AlertDialog={}));})(app=android.app||(android.app={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var Rect=android.graphics.Rect;var SparseArray=android.util.SparseArray;var View=android.view.View;var ViewGroup=android.view.ViewGroup;var AdapterView=android.widget.AdapterView;var ArrayAdapter=android.widget.ArrayAdapter;var AbsSpinner=function(_AdapterView2){_inherits(AbsSpinner,_AdapterView2);function AbsSpinner(context,bindElement,defStyle){_classCallCheck(this,AbsSpinner);var _this154=_possibleConstructorReturn(this,(AbsSpinner.__proto__||Object.getPrototypeOf(AbsSpinner)).call(this,context,bindElement,defStyle));_this154.mHeightMeasureSpec=0;_this154.mWidthMeasureSpec=0;_this154.mSelectionLeftPadding=0;_this154.mSelectionTopPadding=0;_this154.mSelectionRightPadding=0;_this154.mSelectionBottomPadding=0;_this154.mSpinnerPadding=new Rect();_this154.mRecycler=new AbsSpinner.RecycleBin(_this154);_this154.initAbsSpinner();var a=context.obtainStyledAttributes(bindElement,defStyle);var entries=a.getTextArray('entries');if(entries!=null){var adapter=new ArrayAdapter(context,android.R.layout.simple_spinner_item,entries);adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);_this154.setAdapter(adapter);}a.recycle();return _this154;}_createClass(AbsSpinner,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(AbsSpinner.prototype.__proto__||Object.getPrototypeOf(AbsSpinner.prototype),'createClassAttrBinder',this).call(this).set('entries',{setter:function setter(v,value,attrBinder){var entries=attrBinder.parseStringArray(value);if(entries!=null){var adapter=new ArrayAdapter(v.getContext(),android.R.layout.simple_spinner_item,entries);adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);v.setAdapter(adapter);}}});}},{key:'initAbsSpinner',value:function initAbsSpinner(){this.setFocusable(true);this.setWillNotDraw(false);}},{key:'setAdapter',value:function setAdapter(adapter){if(null!=this.mAdapter){this.mAdapter.unregisterDataSetObserver(this.mDataSetObserver);this.resetList();}this.mAdapter=adapter;this.mOldSelectedPosition=AbsSpinner.INVALID_POSITION;this.mOldSelectedRowId=AbsSpinner.INVALID_ROW_ID;if(this.mAdapter!=null){this.mOldItemCount=this.mItemCount;this.mItemCount=this.mAdapter.getCount();this.checkFocus();this.mDataSetObserver=new AdapterView.AdapterDataSetObserver(this);this.mAdapter.registerDataSetObserver(this.mDataSetObserver);var position=this.mItemCount>0?0:AbsSpinner.INVALID_POSITION;this.setSelectedPositionInt(position);this.setNextSelectedPositionInt(position);if(this.mItemCount==0){this.checkSelectionChanged();}}else{this.checkFocus();this.resetList();this.checkSelectionChanged();}this.requestLayout();}},{key:'resetList',value:function resetList(){this.mDataChanged=false;this.mNeedSync=false;this.removeAllViewsInLayout();this.mOldSelectedPosition=AbsSpinner.INVALID_POSITION;this.mOldSelectedRowId=AbsSpinner.INVALID_ROW_ID;this.setSelectedPositionInt(AbsSpinner.INVALID_POSITION);this.setNextSelectedPositionInt(AbsSpinner.INVALID_POSITION);this.invalidate();}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){var widthMode=View.MeasureSpec.getMode(widthMeasureSpec);var widthSize=void 0;var heightSize=void 0;this.mSpinnerPadding.left=this.mPaddingLeft>this.mSelectionLeftPadding?this.mPaddingLeft:this.mSelectionLeftPadding;this.mSpinnerPadding.top=this.mPaddingTop>this.mSelectionTopPadding?this.mPaddingTop:this.mSelectionTopPadding;this.mSpinnerPadding.right=this.mPaddingRight>this.mSelectionRightPadding?this.mPaddingRight:this.mSelectionRightPadding;this.mSpinnerPadding.bottom=this.mPaddingBottom>this.mSelectionBottomPadding?this.mPaddingBottom:this.mSelectionBottomPadding;if(this.mDataChanged){this.handleDataChanged();}var preferredHeight=0;var preferredWidth=0;var needsMeasuring=true;var selectedPosition=this.getSelectedItemPosition();if(selectedPosition>=0&&this.mAdapter!=null&&selectedPosition<this.mAdapter.getCount()){var view=this.mRecycler.get(selectedPosition);if(view==null){view=this.mAdapter.getView(selectedPosition,null,this);}if(view!=null){this.mRecycler.put(selectedPosition,view);if(view.getLayoutParams()==null){this.mBlockLayoutRequests=true;view.setLayoutParams(this.generateDefaultLayoutParams());this.mBlockLayoutRequests=false;}this.measureChild(view,widthMeasureSpec,heightMeasureSpec);preferredHeight=this.getChildHeight(view)+this.mSpinnerPadding.top+this.mSpinnerPadding.bottom;preferredWidth=this.getChildWidth(view)+this.mSpinnerPadding.left+this.mSpinnerPadding.right;needsMeasuring=false;}}if(needsMeasuring){preferredHeight=this.mSpinnerPadding.top+this.mSpinnerPadding.bottom;if(widthMode==View.MeasureSpec.UNSPECIFIED){preferredWidth=this.mSpinnerPadding.left+this.mSpinnerPadding.right;}}preferredHeight=Math.max(preferredHeight,this.getSuggestedMinimumHeight());preferredWidth=Math.max(preferredWidth,this.getSuggestedMinimumWidth());heightSize=AbsSpinner.resolveSizeAndState(preferredHeight,heightMeasureSpec,0);widthSize=AbsSpinner.resolveSizeAndState(preferredWidth,widthMeasureSpec,0);this.setMeasuredDimension(widthSize,heightSize);this.mHeightMeasureSpec=heightMeasureSpec;this.mWidthMeasureSpec=widthMeasureSpec;}},{key:'getChildHeight',value:function getChildHeight(child){return child.getMeasuredHeight();}},{key:'getChildWidth',value:function getChildWidth(child){return child.getMeasuredWidth();}},{key:'generateDefaultLayoutParams',value:function generateDefaultLayoutParams(){return new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);}},{key:'recycleAllViews',value:function recycleAllViews(){var childCount=this.getChildCount();var recycleBin=this.mRecycler;var position=this.mFirstPosition;for(var i=0;i<childCount;i++){var v=this.getChildAt(i);var index=position+i;recycleBin.put(index,v);}}},{key:'setSelection',value:function setSelection(position,animate){if(arguments.length===1){this.setNextSelectedPositionInt(position);this.requestLayout();this.invalidate();}else{var shouldAnimate=animate&&this.mFirstPosition<=position&&position<=this.mFirstPosition+this.getChildCount()-1;this.setSelectionInt(position,shouldAnimate);}}},{key:'setSelectionInt',value:function setSelectionInt(position,animate){if(position!=this.mOldSelectedPosition){this.mBlockLayoutRequests=true;var delta=position-this.mSelectedPosition;this.setNextSelectedPositionInt(position);this.layoutSpinner(delta,animate);this.mBlockLayoutRequests=false;}}},{key:'getSelectedView',value:function getSelectedView(){if(this.mItemCount>0&&this.mSelectedPosition>=0){return this.getChildAt(this.mSelectedPosition-this.mFirstPosition);}else{return null;}}},{key:'requestLayout',value:function requestLayout(){if(!this.mBlockLayoutRequests){_get2(AbsSpinner.prototype.__proto__||Object.getPrototypeOf(AbsSpinner.prototype),'requestLayout',this).call(this);}}},{key:'getAdapter',value:function getAdapter(){return this.mAdapter;}},{key:'getCount',value:function getCount(){return this.mItemCount;}},{key:'pointToPosition',value:function pointToPosition(x,y){var frame=this.mTouchFrame;if(frame==null){this.mTouchFrame=new Rect();frame=this.mTouchFrame;}var count=this.getChildCount();for(var i=count-1;i>=0;i--){var child=this.getChildAt(i);if(child.getVisibility()==View.VISIBLE){child.getHitRect(frame);if(frame.contains(x,y)){return this.mFirstPosition+i;}}}return AbsSpinner.INVALID_POSITION;}}]);return AbsSpinner;}(AdapterView);widget.AbsSpinner=AbsSpinner;(function(AbsSpinner){var RecycleBin=function(){function RecycleBin(arg){_classCallCheck(this,RecycleBin);this.mScrapHeap=new SparseArray();this._AbsSpinner_this=arg;}_createClass(RecycleBin,[{key:'put',value:function put(position,v){this.mScrapHeap.put(position,v);}},{key:'get',value:function get(position){var result=this.mScrapHeap.get(position);if(result!=null){this.mScrapHeap.delete(position);}else{}return result;}},{key:'clear',value:function clear(){var scrapHeap=this.mScrapHeap;var count=scrapHeap.size();for(var i=0;i<count;i++){var view=scrapHeap.valueAt(i);if(view!=null){this._AbsSpinner_this.removeDetachedView(view,true);}}scrapHeap.clear();}}]);return RecycleBin;}();AbsSpinner.RecycleBin=RecycleBin;})(AbsSpinner=widget.AbsSpinner||(widget.AbsSpinner={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var R=android.R;var Context=android.content.Context;var Rect=android.graphics.Rect;var Gravity=android.view.Gravity;var KeyEvent=android.view.KeyEvent;var MotionEvent=android.view.MotionEvent;var View=android.view.View;var ViewGroup=android.view.ViewGroup;var WindowManager=android.view.WindowManager;var Window=android.view.Window;var WeakReference=java.lang.ref.WeakReference;var AnimationUtils=android.view.animation.AnimationUtils;var PopupWindow=function(){function PopupWindow(){var _this155=this;_classCallCheck(this,PopupWindow);this.mInputMethodMode=PopupWindow.INPUT_METHOD_FROM_FOCUSABLE;this.mTouchable=true;this.mOutsideTouchable=false;this.mSplitTouchEnabled=-1;this.mAllowScrollingAnchorParent=true;this.mDrawingLocation=[0,0];this.mScreenLocation=[0,0];this.mTempRect=new Rect();this.mWindowLayoutType=WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;this.mDefaultDropdownAboveEnterAnimation=R.anim.grow_fade_in_from_bottom;this.mDefaultDropdownBelowEnterAnimation=R.anim.grow_fade_in;this.mDefaultDropdownAboveExitAnimation=R.anim.shrink_fade_out_from_bottom;this.mDefaultDropdownBelowExitAnimation=R.anim.shrink_fade_out;this.mOnScrollChangedListener=function(){var inner_this=_this155;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'onScrollChanged',value:function onScrollChanged(){var anchor=inner_this.mAnchor!=null?inner_this.mAnchor.get():null;if(anchor!=null&&inner_this.mPopupView!=null){var p=inner_this.mPopupView.getLayoutParams();inner_this.updateAboveAnchor(inner_this.findDropDownPosition(anchor,p,inner_this.mAnchorXoff,inner_this.mAnchorYoff,inner_this.mAnchoredGravity));inner_this.update(p.x,p.y,-1,-1,true);}}}]);return _Inner;}();return new _Inner();}();for(var _len32=arguments.length,args=Array(_len32),_key33=0;_key33<_len32;_key33++){args[_key33]=arguments[_key33];}if(args[0]instanceof Context){var context=args[0];var styleAttr=args.length==1?R.attr.popupWindowStyle:args[1];this.mContext=context;this.mWindowManager=context.getWindowManager();this.mPopupWindow=new Window(context);this.mPopupWindow.setCallback(this);var _a14=context.obtainStyledAttributes(null,styleAttr);this.mBackground=_a14.getDrawable('popupBackground');this.mEnterAnimation=AnimationUtils.loadAnimation(context,_a14.getAttrValue('popupEnterAnimation'));this.mExitAnimation=AnimationUtils.loadAnimation(context,_a14.getAttrValue('popupExitAnimation'));}else{var _args$40=args[0],contentView=_args$40===undefined?null:_args$40,_args$41=args[1],width=_args$41===undefined?0:_args$41,_args$42=args[2],height=_args$42===undefined?0:_args$42,_args$43=args[3],focusable=_args$43===undefined?false:_args$43;if(contentView!=null){this.mContext=contentView.getContext();this.mWindowManager=this.mContext.getWindowManager();this.mPopupWindow=new Window(this.mContext);this.mPopupWindow.setCallback(this);}this.setContentView(contentView);this.setWidth(width);this.setHeight(height);this.setFocusable(focusable);}}_createClass(PopupWindow,[{key:'getBackground',value:function getBackground(){return this.mBackground;}},{key:'setBackgroundDrawable',value:function setBackgroundDrawable(background){this.mBackground=background;}},{key:'getEnterAnimation',value:function getEnterAnimation(){return this.mEnterAnimation;}},{key:'getExitAnimation',value:function getExitAnimation(){return this.mExitAnimation;}},{key:'setWindowAnimation',value:function setWindowAnimation(enterAnimation,exitAnimation){this.mEnterAnimation=enterAnimation;this.mExitAnimation=exitAnimation;}},{key:'getContentView',value:function getContentView(){return this.mContentView;}},{key:'setContentView',value:function setContentView(contentView){if(this.isShowing()){return;}this.mContentView=contentView;if(this.mContext==null&&this.mContentView!=null){this.mContext=this.mContentView.getContext();}if(this.mWindowManager==null&&this.mContentView!=null){this.mWindowManager=this.mContext.getWindowManager();}if(this.mPopupWindow==null&&this.mContext!=null){this.mPopupWindow=new Window(this.mContext);this.mPopupWindow.setCallback(this);}}},{key:'setTouchInterceptor',value:function setTouchInterceptor(l){this.mTouchInterceptor=l;}},{key:'isFocusable',value:function isFocusable(){return this.mFocusable;}},{key:'setFocusable',value:function setFocusable(focusable){this.mFocusable=focusable;}},{key:'getInputMethodMode',value:function getInputMethodMode(){return this.mInputMethodMode;}},{key:'setInputMethodMode',value:function setInputMethodMode(mode){this.mInputMethodMode=mode;}},{key:'isTouchable',value:function isTouchable(){return this.mTouchable;}},{key:'setTouchable',value:function setTouchable(touchable){this.mTouchable=touchable;}},{key:'isOutsideTouchable',value:function isOutsideTouchable(){return this.mOutsideTouchable;}},{key:'setOutsideTouchable',value:function setOutsideTouchable(touchable){this.mOutsideTouchable=touchable;}},{key:'setClipToScreenEnabled',value:function setClipToScreenEnabled(enabled){this.mClipToScreen=enabled;}},{key:'setAllowScrollingAnchorParent',value:function setAllowScrollingAnchorParent(enabled){this.mAllowScrollingAnchorParent=enabled;}},{key:'isSplitTouchEnabled',value:function isSplitTouchEnabled(){if(this.mSplitTouchEnabled<0&&this.mContext!=null){return true;}return this.mSplitTouchEnabled==1;}},{key:'setSplitTouchEnabled',value:function setSplitTouchEnabled(enabled){this.mSplitTouchEnabled=enabled?1:0;}},{key:'setWindowLayoutType',value:function setWindowLayoutType(layoutType){this.mWindowLayoutType=layoutType;}},{key:'getWindowLayoutType',value:function getWindowLayoutType(){return this.mWindowLayoutType;}},{key:'setTouchModal',value:function setTouchModal(touchModal){this.mNotTouchModal=!touchModal;}},{key:'setWindowLayoutMode',value:function setWindowLayoutMode(widthSpec,heightSpec){this.mWidthMode=widthSpec;this.mHeightMode=heightSpec;}},{key:'getHeight',value:function getHeight(){return this.mHeight;}},{key:'setHeight',value:function setHeight(height){this.mHeight=height;}},{key:'getWidth',value:function getWidth(){return this.mWidth;}},{key:'setWidth',value:function setWidth(width){this.mWidth=width;}},{key:'isShowing',value:function isShowing(){return this.mIsShowing;}},{key:'showAtLocation',value:function showAtLocation(parent,gravity,x,y){if(this.isShowing()||this.mContentView==null){return;}this.unregisterForScrollChanged();this.mIsShowing=true;this.mIsDropdown=false;var p=this.createPopupLayout();p.enterAnimation=this.computeWindowEnterAnimation();p.exitAnimation=this.computeWindowExitAnimation();this.preparePopup(p);if(gravity==Gravity.NO_GRAVITY){gravity=Gravity.TOP|Gravity.START;}p.gravity=gravity;p.x=x;p.y=y;if(this.mHeightMode<0)p.height=this.mLastHeight=this.mHeightMode;if(this.mWidthMode<0)p.width=this.mLastWidth=this.mWidthMode;this.invokePopup(p);}},{key:'showAsDropDown',value:function showAsDropDown(anchor){var xoff=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var yoff=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var gravity=arguments.length>3&&arguments[3]!==undefined?arguments[3]:PopupWindow.DEFAULT_ANCHORED_GRAVITY;if(this.isShowing()||this.mContentView==null){return;}this.registerForScrollChanged(anchor,xoff,yoff,gravity);this.mIsShowing=true;this.mIsDropdown=true;var p=this.createPopupLayout();this.preparePopup(p);this.updateAboveAnchor(this.findDropDownPosition(anchor,p,xoff,yoff,gravity));if(this.mHeightMode<0)p.height=this.mLastHeight=this.mHeightMode;if(this.mWidthMode<0)p.width=this.mLastWidth=this.mWidthMode;p.enterAnimation=this.computeWindowEnterAnimation();p.exitAnimation=this.computeWindowExitAnimation();this.invokePopup(p);}},{key:'updateAboveAnchor',value:function updateAboveAnchor(aboveAnchor){if(aboveAnchor!=this.mAboveAnchor){this.mAboveAnchor=aboveAnchor;if(this.mBackground!=null){if(this.mAboveAnchorBackgroundDrawable!=null){if(this.mAboveAnchor){this.mPopupView.setBackgroundDrawable(this.mAboveAnchorBackgroundDrawable);}else{this.mPopupView.setBackgroundDrawable(this.mBelowAnchorBackgroundDrawable);}}else{this.mPopupView.refreshDrawableState();}}}}},{key:'isAboveAnchor',value:function isAboveAnchor(){return this.mAboveAnchor;}},{key:'preparePopup',value:function preparePopup(p){if(this.mContentView==null||this.mContext==null||this.mWindowManager==null){throw Error('new IllegalStateException(\"You must specify a valid content view by \" + \"calling setContentView() before attempting to show the popup.\")');}this.mPopupWindow.setContentView(this.mContentView);this.mPopupWindow.setFloating(true);this.mPopupWindow.setBackgroundColor(android.graphics.Color.TRANSPARENT);this.mPopupWindow.setDimAmount(0);this.mPopupView=this.mPopupWindow.getDecorView();if(this.mBackground!=null){this.mPopupView.setBackground(this.mBackground);}this.mPopupViewInitialLayoutDirectionInherited=false;this.mPopupWidth=p.width;this.mPopupHeight=p.height;}},{key:'invokePopup',value:function invokePopup(p){this.setLayoutDirectionFromAnchor();this.mWindowManager.addWindow(this.mPopupWindow);}},{key:'setLayoutDirectionFromAnchor',value:function setLayoutDirectionFromAnchor(){if(this.mAnchor!=null){var anchor=this.mAnchor.get();if(anchor!=null&&this.mPopupViewInitialLayoutDirectionInherited){this.mPopupView.setLayoutDirection(anchor.getLayoutDirection());}}}},{key:'createPopupLayout',value:function createPopupLayout(){var p=this.mPopupWindow.getAttributes();p.gravity=Gravity.START|Gravity.TOP;p.width=this.mLastWidth=this.mWidth;p.height=this.mLastHeight=this.mHeight;p.flags=this.computeFlags(p.flags);p.type=this.mWindowLayoutType;p.setTitle(\"PopupWindow\");return p;}},{key:'computeFlags',value:function computeFlags(curFlags){curFlags&=~(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE|WindowManager.LayoutParams.FLAG_SPLIT_TOUCH);if(!this.mFocusable){curFlags|=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;}if(!this.mTouchable){curFlags|=WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;}if(this.mOutsideTouchable){curFlags|=WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;}if(this.isSplitTouchEnabled()){curFlags|=WindowManager.LayoutParams.FLAG_SPLIT_TOUCH;}if(this.mNotTouchModal){curFlags|=WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;}return curFlags;}},{key:'computeWindowEnterAnimation',value:function computeWindowEnterAnimation(){if(this.mEnterAnimation==null){if(this.mIsDropdown){return this.mAboveAnchor?this.mDefaultDropdownAboveEnterAnimation:this.mDefaultDropdownBelowEnterAnimation;}return null;}return this.mEnterAnimation;}},{key:'computeWindowExitAnimation',value:function computeWindowExitAnimation(){if(this.mExitAnimation==null){if(this.mIsDropdown){return this.mAboveAnchor?this.mDefaultDropdownAboveExitAnimation:this.mDefaultDropdownBelowExitAnimation;}return null;}return this.mExitAnimation;}},{key:'findDropDownPosition',value:function findDropDownPosition(anchor,p,xoff,yoff,gravity){var anchorHeight=anchor.getHeight();anchor.getLocationInWindow(this.mDrawingLocation);p.x=this.mDrawingLocation[0]+xoff;p.y=this.mDrawingLocation[1]+anchorHeight+yoff;var hgrav=Gravity.getAbsoluteGravity(gravity,anchor.getLayoutDirection())&Gravity.HORIZONTAL_GRAVITY_MASK;if(hgrav==Gravity.RIGHT){p.x-=this.mPopupWidth-anchor.getWidth();}var onTop=false;p.gravity=Gravity.LEFT|Gravity.TOP;anchor.getLocationOnScreen(this.mScreenLocation);var displayFrame=new Rect();anchor.getWindowVisibleDisplayFrame(displayFrame);var screenY=this.mScreenLocation[1]+anchorHeight+yoff;var root=anchor.getRootView();if(screenY+this.mPopupHeight>displayFrame.bottom||p.x+this.mPopupWidth-root.getWidth()>0){if(this.mAllowScrollingAnchorParent){var scrollX=anchor.getScrollX();var scrollY=anchor.getScrollY();var _r3=new Rect(scrollX,scrollY,scrollX+this.mPopupWidth+xoff,scrollY+this.mPopupHeight+anchor.getHeight()+yoff);anchor.requestRectangleOnScreen(_r3,true);}anchor.getLocationInWindow(this.mDrawingLocation);p.x=this.mDrawingLocation[0]+xoff;p.y=this.mDrawingLocation[1]+anchor.getHeight()+yoff;if(hgrav==Gravity.RIGHT){p.x-=this.mPopupWidth-anchor.getWidth();}anchor.getLocationOnScreen(this.mScreenLocation);onTop=displayFrame.bottom-this.mScreenLocation[1]-anchor.getHeight()-yoff<this.mScreenLocation[1]-yoff-displayFrame.top;if(onTop){p.gravity=Gravity.LEFT|Gravity.BOTTOM;p.y=root.getHeight()-this.mDrawingLocation[1]+yoff;}else{p.y=this.mDrawingLocation[1]+anchor.getHeight()+yoff;}}if(this.mClipToScreen){var displayFrameWidth=displayFrame.right-displayFrame.left;var right=p.x+p.width;if(right>displayFrameWidth){p.x-=right-displayFrameWidth;}if(p.x<displayFrame.left){p.x=displayFrame.left;p.width=Math.min(p.width,displayFrameWidth);}if(onTop){var popupTop=this.mScreenLocation[1]+yoff-this.mPopupHeight;if(popupTop<0){p.y+=popupTop;}}else{p.y=Math.max(p.y,displayFrame.top);}}p.gravity|=Gravity.DISPLAY_CLIP_VERTICAL;return onTop;}},{key:'getMaxAvailableHeight',value:function getMaxAvailableHeight(anchor){var yOffset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var ignoreBottomDecorations=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var displayFrame=new Rect();anchor.getWindowVisibleDisplayFrame(displayFrame);var anchorPos=this.mDrawingLocation;anchor.getLocationOnScreen(anchorPos);var bottomEdge=displayFrame.bottom;if(ignoreBottomDecorations){var res=anchor.getContext().getResources();bottomEdge=res.getDisplayMetrics().heightPixels;}var distanceToBottom=bottomEdge-(anchorPos[1]+anchor.getHeight())-yOffset;var distanceToTop=anchorPos[1]-displayFrame.top+yOffset;var returnedHeight=Math.max(distanceToBottom,distanceToTop);if(this.mBackground!=null){this.mBackground.getPadding(this.mTempRect);returnedHeight-=this.mTempRect.top+this.mTempRect.bottom;}return returnedHeight;}},{key:'dismiss',value:function dismiss(){if(this.isShowing()&&this.mPopupView!=null){this.mIsShowing=false;this.unregisterForScrollChanged();try{this.mWindowManager.removeWindow(this.mPopupWindow);}finally{if(this.mPopupView!=this.mContentView&&this.mPopupView instanceof ViewGroup){this.mPopupView.removeView(this.mContentView);}this.mPopupView=null;if(this.mOnDismissListener!=null){this.mOnDismissListener.onDismiss();}}}}},{key:'setOnDismissListener',value:function setOnDismissListener(onDismissListener){this.mOnDismissListener=onDismissListener;}},{key:'update',value:function update(){if(arguments.length==0){this._update();}else if(arguments.length==2){this._update_w_h(arguments.length<=0?undefined:arguments[0],arguments.length<=1?undefined:arguments[1]);}else if(arguments.length==3){this._update_a_w_h(arguments.length<=0?undefined:arguments[0],arguments.length<=1?undefined:arguments[1],arguments.length<=2?undefined:arguments[2]);}else if(arguments.length==4){this._update_x_y_w_h_f(arguments.length<=0?undefined:arguments[0],arguments.length<=1?undefined:arguments[1],arguments.length<=2?undefined:arguments[2],arguments.length<=3?undefined:arguments[3]);}else if(arguments.length==5){if((arguments.length<=0?undefined:arguments[0])instanceof View)this._update_a_x_y_w_h(arguments.length<=0?undefined:arguments[0],arguments.length<=1?undefined:arguments[1],arguments.length<=2?undefined:arguments[2],arguments.length<=3?undefined:arguments[3],arguments.length<=4?undefined:arguments[4]);else this._update_x_y_w_h_f(arguments.length<=0?undefined:arguments[0],arguments.length<=1?undefined:arguments[1],arguments.length<=2?undefined:arguments[2],arguments.length<=3?undefined:arguments[3],arguments.length<=4?undefined:arguments[4]);}}},{key:'_update',value:function _update(){if(!this.isShowing()||this.mContentView==null){return;}var p=this.mPopupView.getLayoutParams();var update=false;var enterAnim=this.computeWindowEnterAnimation();var exitAnim=this.computeWindowExitAnimation();if(enterAnim!=p.enterAnimation){p.enterAnimation=enterAnim;update=true;}if(exitAnim!=p.exitAnimation){p.exitAnimation=exitAnim;update=true;}var newFlags=this.computeFlags(p.flags);if(newFlags!=p.flags){p.flags=newFlags;update=true;}if(update){this.setLayoutDirectionFromAnchor();this.mWindowManager.updateWindowLayout(this.mPopupWindow,p);}}},{key:'_update_w_h',value:function _update_w_h(width,height){var p=this.mPopupView.getLayoutParams();this.update(p.x,p.y,width,height,false);}},{key:'_update_x_y_w_h_f',value:function _update_x_y_w_h_f(x,y,width,height){var force=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;if(width!=-1){this.mLastWidth=width;this.setWidth(width);}if(height!=-1){this.mLastHeight=height;this.setHeight(height);}if(!this.isShowing()||this.mContentView==null){return;}var p=this.mPopupView.getLayoutParams();var update=force;var finalWidth=this.mWidthMode<0?this.mWidthMode:this.mLastWidth;if(width!=-1&&p.width!=finalWidth){p.width=this.mLastWidth=finalWidth;update=true;}var finalHeight=this.mHeightMode<0?this.mHeightMode:this.mLastHeight;if(height!=-1&&p.height!=finalHeight){p.height=this.mLastHeight=finalHeight;update=true;}if(p.x!=x){p.x=x;update=true;}if(p.y!=y){p.y=y;update=true;}var enterAnim=this.computeWindowEnterAnimation();var exitAnim=this.computeWindowExitAnimation();if(enterAnim!=p.enterAnimation){p.enterAnimation=enterAnim;update=true;}if(exitAnim!=p.exitAnimation){p.exitAnimation=exitAnim;update=true;}var newFlags=this.computeFlags(p.flags);if(newFlags!=p.flags){p.flags=newFlags;update=true;}if(update){this.setLayoutDirectionFromAnchor();this.mWindowManager.updateWindowLayout(this.mPopupWindow,p);}}},{key:'_update_a_w_h',value:function _update_a_w_h(anchor,width,height){this._update_all_args(anchor,false,0,0,true,width,height,this.mAnchoredGravity);}},{key:'_update_a_x_y_w_h',value:function _update_a_x_y_w_h(anchor,xoff,yoff,width,height){this._update_all_args(anchor,true,xoff,yoff,true,width,height,this.mAnchoredGravity);}},{key:'_update_all_args',value:function _update_all_args(anchor,updateLocation,xoff,yoff,updateDimension,width,height,gravity){if(!this.isShowing()||this.mContentView==null){return;}var oldAnchor=this.mAnchor;var needsUpdate=updateLocation&&(this.mAnchorXoff!=xoff||this.mAnchorYoff!=yoff);if(oldAnchor==null||oldAnchor.get()!=anchor||needsUpdate&&!this.mIsDropdown){this.registerForScrollChanged(anchor,xoff,yoff,gravity);}else if(needsUpdate){this.mAnchorXoff=xoff;this.mAnchorYoff=yoff;this.mAnchoredGravity=gravity;}var p=this.mPopupView.getLayoutParams();if(updateDimension){if(width==-1){width=this.mPopupWidth;}else{this.mPopupWidth=width;}if(height==-1){height=this.mPopupHeight;}else{this.mPopupHeight=height;}}var x=p.x;var y=p.y;if(updateLocation){this.updateAboveAnchor(this.findDropDownPosition(anchor,p,xoff,yoff,gravity));}else{this.updateAboveAnchor(this.findDropDownPosition(anchor,p,this.mAnchorXoff,this.mAnchorYoff,this.mAnchoredGravity));}this.update(p.x,p.y,width,height,x!=p.x||y!=p.y);}},{key:'unregisterForScrollChanged',value:function unregisterForScrollChanged(){var anchorRef=this.mAnchor;var anchor=null;if(anchorRef!=null){anchor=anchorRef.get();}if(anchor!=null){var vto=anchor.getViewTreeObserver();vto.removeOnScrollChangedListener(this.mOnScrollChangedListener);}this.mAnchor=null;}},{key:'registerForScrollChanged',value:function registerForScrollChanged(anchor,xoff,yoff,gravity){this.unregisterForScrollChanged();this.mAnchor=new WeakReference(anchor);var vto=anchor.getViewTreeObserver();if(vto!=null){vto.addOnScrollChangedListener(this.mOnScrollChangedListener);}this.mAnchorXoff=xoff;this.mAnchorYoff=yoff;this.mAnchoredGravity=gravity;}},{key:'onTouchEvent',value:function onTouchEvent(event){var x=Math.floor(event.getX());var y=Math.floor(event.getY());if(event.getAction()==MotionEvent.ACTION_DOWN&&(x<0||x>=this.mPopupView.getWidth()||y<0||y>=this.mPopupView.getHeight())){this.dismiss();return true;}else if(event.getAction()==MotionEvent.ACTION_OUTSIDE){this.dismiss();return true;}else if(this.mPopupView){return this.mPopupView.onTouchEvent(event);}return false;}},{key:'onGenericMotionEvent',value:function onGenericMotionEvent(event){return false;}},{key:'onWindowAttributesChanged',value:function onWindowAttributesChanged(params){if(this.mPopupWindow!=null){this.mWindowManager.updateWindowLayout(this.mPopupWindow,params);}}},{key:'onContentChanged',value:function onContentChanged(){}},{key:'onWindowFocusChanged',value:function onWindowFocusChanged(hasFocus){}},{key:'onAttachedToWindow',value:function onAttachedToWindow(){}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){}},{key:'dispatchKeyEvent',value:function dispatchKeyEvent(event){if(event.getKeyCode()==KeyEvent.KEYCODE_BACK){if(this.mPopupView.getKeyDispatcherState()==null){return this.mPopupWindow.superDispatchKeyEvent(event);}if(event.getAction()==KeyEvent.ACTION_DOWN&&event.getRepeatCount()==0){var state=this.mPopupView.getKeyDispatcherState();if(state!=null){state.startTracking(event,this);}return true;}else if(event.getAction()==KeyEvent.ACTION_UP){var _state2=this.mPopupView.getKeyDispatcherState();if(_state2!=null&&_state2.isTracking(event)&&!event.isCanceled()){this.dismiss();return true;}}return this.mPopupWindow.superDispatchKeyEvent(event);}else{return this.mPopupWindow.superDispatchKeyEvent(event);}}},{key:'dispatchTouchEvent',value:function dispatchTouchEvent(ev){if(this.mTouchInterceptor!=null&&this.mTouchInterceptor.onTouch(this.mPopupView,ev)){return true;}if(this.mPopupWindow.superDispatchTouchEvent(ev)){return true;}return this.onTouchEvent(ev);}},{key:'dispatchGenericMotionEvent',value:function dispatchGenericMotionEvent(ev){if(this.mPopupWindow.superDispatchGenericMotionEvent(ev)){return true;}return this.onGenericMotionEvent(ev);}}]);return PopupWindow;}();PopupWindow.INPUT_METHOD_FROM_FOCUSABLE=0;PopupWindow.INPUT_METHOD_NEEDED=1;PopupWindow.INPUT_METHOD_NOT_NEEDED=2;PopupWindow.DEFAULT_ANCHORED_GRAVITY=Gravity.TOP|Gravity.START;widget.PopupWindow=PopupWindow;})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var DataSetObserver=android.database.DataSetObserver;var Rect=android.graphics.Rect;var Handler=android.os.Handler;var Log=android.util.Log;var Gravity=android.view.Gravity;var KeyEvent=android.view.KeyEvent;var MotionEvent=android.view.MotionEvent;var View=android.view.View;var MeasureSpec=android.view.View.MeasureSpec;var ViewConfiguration=android.view.ViewConfiguration;var ViewGroup=android.view.ViewGroup;var Integer=java.lang.Integer;var AbsListView=android.widget.AbsListView;var LinearLayout=android.widget.LinearLayout;var ListView=android.widget.ListView;var PopupWindow=android.widget.PopupWindow;var TextView=android.widget.TextView;var ListPopupWindow=function(){function ListPopupWindow(context){var styleAttr=arguments.length>1&&arguments[1]!==undefined?arguments[1]:android.R.attr.listPopupWindowStyle;_classCallCheck(this,ListPopupWindow);this.mDropDownHeight=ViewGroup.LayoutParams.WRAP_CONTENT;this.mDropDownWidth=ViewGroup.LayoutParams.WRAP_CONTENT;this.mDropDownHorizontalOffset=0;this.mDropDownVerticalOffset=0;this.mDropDownGravity=Gravity.NO_GRAVITY;this.mDropDownAlwaysVisible=false;this.mForceIgnoreOutsideTouch=false;this.mListItemExpandMaximum=Integer.MAX_VALUE;this.mPromptPosition=ListPopupWindow.POSITION_PROMPT_ABOVE;this.mResizePopupRunnable=new ListPopupWindow.ResizePopupRunnable(this);this.mTouchInterceptor=new ListPopupWindow.PopupTouchInterceptor(this);this.mScrollListener=new ListPopupWindow.PopupScrollListener(this);this.mHideSelector=new ListPopupWindow.ListSelectorHider(this);this.mHandler=new Handler();this.mTempRect=new Rect();this.mLayoutDirection=0;this.mContext=context;this.mPopup=new PopupWindow(context,styleAttr);this.mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);this.mLayoutDirection=View.LAYOUT_DIRECTION_LTR;}_createClass(ListPopupWindow,[{key:'setAdapter',value:function setAdapter(adapter){if(this.mObserver==null){this.mObserver=new ListPopupWindow.PopupDataSetObserver(this);}else if(this.mAdapter!=null){this.mAdapter.unregisterDataSetObserver(this.mObserver);}this.mAdapter=adapter;if(this.mAdapter!=null){adapter.registerDataSetObserver(this.mObserver);}if(this.mDropDownList!=null){this.mDropDownList.setAdapter(this.mAdapter);}}},{key:'setPromptPosition',value:function setPromptPosition(position){this.mPromptPosition=position;}},{key:'getPromptPosition',value:function getPromptPosition(){return this.mPromptPosition;}},{key:'setModal',value:function setModal(modal){this.mModal=true;this.mPopup.setFocusable(modal);}},{key:'isModal',value:function isModal(){return this.mModal;}},{key:'setForceIgnoreOutsideTouch',value:function setForceIgnoreOutsideTouch(forceIgnoreOutsideTouch){this.mForceIgnoreOutsideTouch=forceIgnoreOutsideTouch;}},{key:'setDropDownAlwaysVisible',value:function setDropDownAlwaysVisible(dropDownAlwaysVisible){this.mDropDownAlwaysVisible=dropDownAlwaysVisible;}},{key:'isDropDownAlwaysVisible',value:function isDropDownAlwaysVisible(){return this.mDropDownAlwaysVisible;}},{key:'getBackground',value:function getBackground(){return this.mPopup.getBackground();}},{key:'setBackgroundDrawable',value:function setBackgroundDrawable(d){this.mPopup.setBackgroundDrawable(d);}},{key:'setWindowAnimation',value:function setWindowAnimation(enterAnimation,exitAnimation){this.mPopup.setWindowAnimation(enterAnimation,exitAnimation);}},{key:'getEnterAnimation',value:function getEnterAnimation(){return this.mPopup.mEnterAnimation;}},{key:'getExitAnimation',value:function getExitAnimation(){return this.mPopup.mExitAnimation;}},{key:'getAnchorView',value:function getAnchorView(){return this.mDropDownAnchorView;}},{key:'setAnchorView',value:function setAnchorView(anchor){this.mDropDownAnchorView=anchor;}},{key:'getHorizontalOffset',value:function getHorizontalOffset(){return this.mDropDownHorizontalOffset;}},{key:'setHorizontalOffset',value:function setHorizontalOffset(offset){this.mDropDownHorizontalOffset=offset;}},{key:'getVerticalOffset',value:function getVerticalOffset(){if(!this.mDropDownVerticalOffsetSet){return 0;}return this.mDropDownVerticalOffset;}},{key:'setVerticalOffset',value:function setVerticalOffset(offset){this.mDropDownVerticalOffset=offset;this.mDropDownVerticalOffsetSet=true;}},{key:'setDropDownGravity',value:function setDropDownGravity(gravity){this.mDropDownGravity=gravity;}},{key:'getWidth',value:function getWidth(){return this.mDropDownWidth;}},{key:'setWidth',value:function setWidth(width){this.mDropDownWidth=width;}},{key:'setContentWidth',value:function setContentWidth(width){var popupBackground=this.mPopup.getBackground();if(popupBackground!=null){popupBackground.getPadding(this.mTempRect);this.mDropDownWidth=this.mTempRect.left+this.mTempRect.right+width;}else{this.setWidth(width);}}},{key:'getHeight',value:function getHeight(){return this.mDropDownHeight;}},{key:'setHeight',value:function setHeight(height){this.mDropDownHeight=height;}},{key:'setOnItemClickListener',value:function setOnItemClickListener(clickListener){this.mItemClickListener=clickListener;}},{key:'setOnItemSelectedListener',value:function setOnItemSelectedListener(selectedListener){this.mItemSelectedListener=selectedListener;}},{key:'setPromptView',value:function setPromptView(prompt){var showing=this.isShowing();if(showing){this.removePromptView();}this.mPromptView=prompt;if(showing){this.show();}}},{key:'postShow',value:function postShow(){this.mHandler.post(this.mShowDropDownRunnable);}},{key:'show',value:function show(){var height=this.buildDropDown();var widthSpec=0;var heightSpec=0;var noInputMethod=this.isInputMethodNotNeeded();this.mPopup.setAllowScrollingAnchorParent(!noInputMethod);if(this.mPopup.isShowing()){if(this.mDropDownWidth==ViewGroup.LayoutParams.MATCH_PARENT){widthSpec=-1;}else if(this.mDropDownWidth==ViewGroup.LayoutParams.WRAP_CONTENT){widthSpec=this.getAnchorView().getWidth();}else{widthSpec=this.mDropDownWidth;}if(this.mDropDownHeight==ViewGroup.LayoutParams.MATCH_PARENT){heightSpec=noInputMethod?height:ViewGroup.LayoutParams.MATCH_PARENT;if(noInputMethod){this.mPopup.setWindowLayoutMode(this.mDropDownWidth==ViewGroup.LayoutParams.MATCH_PARENT?ViewGroup.LayoutParams.MATCH_PARENT:0,0);}else{this.mPopup.setWindowLayoutMode(this.mDropDownWidth==ViewGroup.LayoutParams.MATCH_PARENT?ViewGroup.LayoutParams.MATCH_PARENT:0,ViewGroup.LayoutParams.MATCH_PARENT);}}else if(this.mDropDownHeight==ViewGroup.LayoutParams.WRAP_CONTENT){heightSpec=height;}else{heightSpec=this.mDropDownHeight;}this.mPopup.setOutsideTouchable(!this.mForceIgnoreOutsideTouch&&!this.mDropDownAlwaysVisible);this.mPopup.update(this.getAnchorView(),this.mDropDownHorizontalOffset,this.mDropDownVerticalOffset,widthSpec,heightSpec);}else{if(this.mDropDownWidth==ViewGroup.LayoutParams.MATCH_PARENT){widthSpec=ViewGroup.LayoutParams.MATCH_PARENT;}else{if(this.mDropDownWidth==ViewGroup.LayoutParams.WRAP_CONTENT){this.mPopup.setWidth(this.getAnchorView().getWidth());}else{this.mPopup.setWidth(this.mDropDownWidth);}}if(this.mDropDownHeight==ViewGroup.LayoutParams.MATCH_PARENT){heightSpec=ViewGroup.LayoutParams.MATCH_PARENT;}else{if(this.mDropDownHeight==ViewGroup.LayoutParams.WRAP_CONTENT){this.mPopup.setHeight(height);}else{this.mPopup.setHeight(this.mDropDownHeight);}}this.mPopup.setWindowLayoutMode(widthSpec,heightSpec);this.mPopup.setClipToScreenEnabled(true);this.mPopup.setOutsideTouchable(!this.mForceIgnoreOutsideTouch&&!this.mDropDownAlwaysVisible);this.mPopup.setTouchInterceptor(this.mTouchInterceptor);this.mPopup.showAsDropDown(this.getAnchorView(),this.mDropDownHorizontalOffset,this.mDropDownVerticalOffset,this.mDropDownGravity);this.mDropDownList.setSelection(ListView.INVALID_POSITION);if(!this.mModal||this.mDropDownList.isInTouchMode()){this.clearListSelection();}if(!this.mModal){this.mHandler.post(this.mHideSelector);}}}},{key:'dismiss',value:function dismiss(){this.mPopup.dismiss();this.removePromptView();this.mPopup.setContentView(null);this.mDropDownList=null;this.mHandler.removeCallbacks(this.mResizePopupRunnable);}},{key:'setOnDismissListener',value:function setOnDismissListener(listener){this.mPopup.setOnDismissListener(listener);}},{key:'removePromptView',value:function removePromptView(){if(this.mPromptView!=null){var parent=this.mPromptView.getParent();if(parent instanceof ViewGroup){var group=parent;group.removeView(this.mPromptView);}}}},{key:'setInputMethodMode',value:function setInputMethodMode(mode){this.mPopup.setInputMethodMode(mode);}},{key:'getInputMethodMode',value:function getInputMethodMode(){return this.mPopup.getInputMethodMode();}},{key:'setSelection',value:function setSelection(position){var list=this.mDropDownList;if(this.isShowing()&&list!=null){list.mListSelectionHidden=false;list.setSelection(position);if(list.getChoiceMode()!=ListView.CHOICE_MODE_NONE){list.setItemChecked(position,true);}}}},{key:'clearListSelection',value:function clearListSelection(){var list=this.mDropDownList;if(list!=null){list.mListSelectionHidden=true;list.hideSelector();list.requestLayout();}}},{key:'isShowing',value:function isShowing(){return this.mPopup.isShowing();}},{key:'isInputMethodNotNeeded',value:function isInputMethodNotNeeded(){return this.mPopup.getInputMethodMode()==ListPopupWindow.INPUT_METHOD_NOT_NEEDED;}},{key:'performItemClick',value:function performItemClick(position){if(this.isShowing()){if(this.mItemClickListener!=null){var list=this.mDropDownList;var child=list.getChildAt(position-list.getFirstVisiblePosition());var adapter=list.getAdapter();this.mItemClickListener.onItemClick(list,child,position,adapter.getItemId(position));}return true;}return false;}},{key:'getSelectedItem',value:function getSelectedItem(){if(!this.isShowing()){return null;}return this.mDropDownList.getSelectedItem();}},{key:'getSelectedItemPosition',value:function getSelectedItemPosition(){if(!this.isShowing()){return ListView.INVALID_POSITION;}return this.mDropDownList.getSelectedItemPosition();}},{key:'getSelectedItemId',value:function getSelectedItemId(){if(!this.isShowing()){return ListView.INVALID_ROW_ID;}return this.mDropDownList.getSelectedItemId();}},{key:'getSelectedView',value:function getSelectedView(){if(!this.isShowing()){return null;}return this.mDropDownList.getSelectedView();}},{key:'getListView',value:function getListView(){return this.mDropDownList;}},{key:'setListItemExpandMax',value:function setListItemExpandMax(max){this.mListItemExpandMaximum=max;}},{key:'onKeyDown',value:function onKeyDown(keyCode,event){if(this.isShowing()){if(keyCode!=KeyEvent.KEYCODE_SPACE&&(this.mDropDownList.getSelectedItemPosition()>=0||!KeyEvent.isConfirmKey(keyCode))){var curIndex=this.mDropDownList.getSelectedItemPosition();var consumed=void 0;var below=!this.mPopup.isAboveAnchor();var adapter=this.mAdapter;var allEnabled=void 0;var firstItem=Integer.MAX_VALUE;var lastItem=Integer.MIN_VALUE;if(adapter!=null){allEnabled=adapter.areAllItemsEnabled();firstItem=allEnabled?0:this.mDropDownList.lookForSelectablePosition(0,true);lastItem=allEnabled?adapter.getCount()-1:this.mDropDownList.lookForSelectablePosition(adapter.getCount()-1,false);}if(below&&keyCode==KeyEvent.KEYCODE_DPAD_UP&&curIndex<=firstItem||!below&&keyCode==KeyEvent.KEYCODE_DPAD_DOWN&&curIndex>=lastItem){this.clearListSelection();this.mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);this.show();return true;}else{this.mDropDownList.mListSelectionHidden=false;}consumed=this.mDropDownList.onKeyDown(keyCode,event);if(ListPopupWindow.DEBUG)Log.v(ListPopupWindow.TAG,\"Key down: code=\"+keyCode+\" list consumed=\"+consumed);if(consumed){this.mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);this.mDropDownList.requestFocusFromTouch();this.show();switch(keyCode){case KeyEvent.KEYCODE_ENTER:case KeyEvent.KEYCODE_DPAD_CENTER:case KeyEvent.KEYCODE_DPAD_DOWN:case KeyEvent.KEYCODE_DPAD_UP:return true;}}else{if(below&&keyCode==KeyEvent.KEYCODE_DPAD_DOWN){if(curIndex==lastItem){return true;}}else if(!below&&keyCode==KeyEvent.KEYCODE_DPAD_UP&&curIndex==firstItem){return true;}}}}return false;}},{key:'onKeyUp',value:function onKeyUp(keyCode,event){if(this.isShowing()&&this.mDropDownList.getSelectedItemPosition()>=0){var consumed=this.mDropDownList.onKeyUp(keyCode,event);if(consumed&&KeyEvent.isConfirmKey(keyCode)){this.dismiss();}return consumed;}return false;}},{key:'onKeyPreIme',value:function onKeyPreIme(keyCode,event){if(keyCode==KeyEvent.KEYCODE_BACK&&this.isShowing()){var anchorView=this.mDropDownAnchorView;if(event.getAction()==KeyEvent.ACTION_DOWN&&event.getRepeatCount()==0){var state=anchorView.getKeyDispatcherState();if(state!=null){state.startTracking(event,this);}return true;}else if(event.getAction()==KeyEvent.ACTION_UP){var _state3=anchorView.getKeyDispatcherState();if(_state3!=null){_state3.handleUpEvent(event);}if(event.isTracking()&&!event.isCanceled()){this.dismiss();return true;}}}return false;}},{key:'createDragToOpenListener',value:function createDragToOpenListener(src){var _this156=this;return function(){var inner_this=_this156;var _Inner=function(_ListPopupWindow$Forw){_inherits(_Inner,_ListPopupWindow$Forw);function _Inner(){_classCallCheck(this,_Inner);return _possibleConstructorReturn(this,(_Inner.__proto__||Object.getPrototypeOf(_Inner)).apply(this,arguments));}_createClass(_Inner,[{key:'getPopup',value:function getPopup(){return inner_this;}}]);return _Inner;}(ListPopupWindow.ForwardingListener);return new _Inner(src);}();}},{key:'buildDropDown',value:function buildDropDown(){var _this158=this;var dropDownView=void 0;var otherHeights=0;if(this.mDropDownList==null){var context=this.mContext;this.mShowDropDownRunnable=function(){var inner_this=_this158;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'run',value:function run(){var view=inner_this.getAnchorView();if(view!=null&&view.isAttachedToWindow()){inner_this.show();}}}]);return _Inner;}();return new _Inner();}();this.mDropDownList=new ListPopupWindow.DropDownListView(context,!this.mModal);if(this.mDropDownListHighlight!=null){this.mDropDownList.setSelector(this.mDropDownListHighlight);}this.mDropDownList.setAdapter(this.mAdapter);this.mDropDownList.setOnItemClickListener(this.mItemClickListener);this.mDropDownList.setFocusable(true);this.mDropDownList.setFocusableInTouchMode(true);this.mDropDownList.setOnItemSelectedListener(function(){var inner_this=_this158;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'onItemSelected',value:function onItemSelected(parent,view,position,id){if(position!=-1){var dropDownList=inner_this.mDropDownList;if(dropDownList!=null){dropDownList.mListSelectionHidden=false;}}}},{key:'onNothingSelected',value:function onNothingSelected(parent){}}]);return _Inner;}();return new _Inner();}());this.mDropDownList.setOnScrollListener(this.mScrollListener);if(this.mItemSelectedListener!=null){this.mDropDownList.setOnItemSelectedListener(this.mItemSelectedListener);}dropDownView=this.mDropDownList;var hintView=this.mPromptView;if(hintView!=null){var hintContainer=new LinearLayout(context);hintContainer.setOrientation(LinearLayout.VERTICAL);var hintParams=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,0,1.0);switch(this.mPromptPosition){case ListPopupWindow.POSITION_PROMPT_BELOW:hintContainer.addView(dropDownView,hintParams);hintContainer.addView(hintView);break;case ListPopupWindow.POSITION_PROMPT_ABOVE:hintContainer.addView(hintView);hintContainer.addView(dropDownView,hintParams);break;default:Log.e(ListPopupWindow.TAG,\"Invalid hint position \"+this.mPromptPosition);break;}var widthSpec=MeasureSpec.makeMeasureSpec(this.mDropDownWidth,MeasureSpec.AT_MOST);var heightSpec=MeasureSpec.UNSPECIFIED;hintView.measure(widthSpec,heightSpec);hintParams=hintView.getLayoutParams();otherHeights=hintView.getMeasuredHeight()+hintParams.topMargin+hintParams.bottomMargin;dropDownView=hintContainer;}this.mPopup.setContentView(dropDownView);}else{dropDownView=this.mPopup.getContentView();var view=this.mPromptView;if(view!=null){var _hintParams=view.getLayoutParams();otherHeights=view.getMeasuredHeight()+_hintParams.topMargin+_hintParams.bottomMargin;}}var padding=0;var background=this.mPopup.getBackground();if(background!=null){background.getPadding(this.mTempRect);padding=this.mTempRect.top+this.mTempRect.bottom;if(!this.mDropDownVerticalOffsetSet){this.mDropDownVerticalOffset=-this.mTempRect.top;}}else{this.mTempRect.setEmpty();}var ignoreBottomDecorations=this.mPopup.getInputMethodMode()==PopupWindow.INPUT_METHOD_NOT_NEEDED;var maxHeight=this.mPopup.getMaxAvailableHeight(this.getAnchorView(),this.mDropDownVerticalOffset,ignoreBottomDecorations);if(this.mDropDownAlwaysVisible||this.mDropDownHeight==ViewGroup.LayoutParams.MATCH_PARENT){return maxHeight+padding;}var childWidthSpec=void 0;switch(this.mDropDownWidth){case ViewGroup.LayoutParams.WRAP_CONTENT:childWidthSpec=MeasureSpec.makeMeasureSpec(this.mContext.getResources().getDisplayMetrics().widthPixels-(this.mTempRect.left+this.mTempRect.right),MeasureSpec.AT_MOST);break;case ViewGroup.LayoutParams.MATCH_PARENT:childWidthSpec=MeasureSpec.makeMeasureSpec(this.mContext.getResources().getDisplayMetrics().widthPixels-(this.mTempRect.left+this.mTempRect.right),MeasureSpec.EXACTLY);break;default:childWidthSpec=MeasureSpec.makeMeasureSpec(this.mDropDownWidth,MeasureSpec.EXACTLY);break;}var listContent=this.mDropDownList.measureHeightOfChildren(childWidthSpec,0,ListView.NO_POSITION,maxHeight-otherHeights,-1);if(listContent>0)otherHeights+=padding;return listContent+otherHeights;}}]);return ListPopupWindow;}();ListPopupWindow.TAG=\"ListPopupWindow\";ListPopupWindow.DEBUG=false;ListPopupWindow.EXPAND_LIST_TIMEOUT=250;ListPopupWindow.POSITION_PROMPT_ABOVE=0;ListPopupWindow.POSITION_PROMPT_BELOW=1;ListPopupWindow.MATCH_PARENT=ViewGroup.LayoutParams.MATCH_PARENT;ListPopupWindow.WRAP_CONTENT=ViewGroup.LayoutParams.WRAP_CONTENT;ListPopupWindow.INPUT_METHOD_FROM_FOCUSABLE=PopupWindow.INPUT_METHOD_FROM_FOCUSABLE;ListPopupWindow.INPUT_METHOD_NEEDED=PopupWindow.INPUT_METHOD_NEEDED;ListPopupWindow.INPUT_METHOD_NOT_NEEDED=PopupWindow.INPUT_METHOD_NOT_NEEDED;widget.ListPopupWindow=ListPopupWindow;(function(ListPopupWindow){var ForwardingListener=function(){function ForwardingListener(src){_classCallCheck(this,ForwardingListener);this.mScaledTouchSlop=0;this.mTapTimeout=0;this.mActivePointerId=0;this.mSrc=src;this.mScaledTouchSlop=ViewConfiguration.get(src.getContext()).getScaledTouchSlop();this.mTapTimeout=ViewConfiguration.getTapTimeout();src.addOnAttachStateChangeListener(this);}_createClass(ForwardingListener,[{key:'onTouch',value:function onTouch(v,event){var wasForwarding=this.mForwarding;var forwarding=void 0;if(wasForwarding){forwarding=this.onTouchForwarded(event)||!this.onForwardingStopped();}else{forwarding=this.onTouchObserved(event)&&this.onForwardingStarted();}this.mForwarding=forwarding;return forwarding||wasForwarding;}},{key:'onViewAttachedToWindow',value:function onViewAttachedToWindow(v){}},{key:'onViewDetachedFromWindow',value:function onViewDetachedFromWindow(v){this.mForwarding=false;this.mActivePointerId=MotionEvent.INVALID_POINTER_ID;if(this.mDisallowIntercept!=null){this.mSrc.removeCallbacks(this.mDisallowIntercept);}}},{key:'onForwardingStarted',value:function onForwardingStarted(){var popup=this.getPopup();if(popup!=null&&!popup.isShowing()){popup.show();}return true;}},{key:'onForwardingStopped',value:function onForwardingStopped(){var popup=this.getPopup();if(popup!=null&&popup.isShowing()){popup.dismiss();}return true;}},{key:'onTouchObserved',value:function onTouchObserved(srcEvent){var src=this.mSrc;if(!src.isEnabled()){return false;}var actionMasked=srcEvent.getActionMasked();switch(actionMasked){case MotionEvent.ACTION_DOWN:this.mActivePointerId=srcEvent.getPointerId(0);if(this.mDisallowIntercept==null){this.mDisallowIntercept=new ForwardingListener.DisallowIntercept(this);}src.postDelayed(this.mDisallowIntercept,this.mTapTimeout);break;case MotionEvent.ACTION_MOVE:var activePointerIndex=srcEvent.findPointerIndex(this.mActivePointerId);if(activePointerIndex>=0){var _x229=srcEvent.getX(activePointerIndex);var _y18=srcEvent.getY(activePointerIndex);if(!src.pointInView(_x229,_y18,this.mScaledTouchSlop)){if(this.mDisallowIntercept!=null){src.removeCallbacks(this.mDisallowIntercept);}src.getParent().requestDisallowInterceptTouchEvent(true);return true;}}break;case MotionEvent.ACTION_CANCEL:case MotionEvent.ACTION_UP:if(this.mDisallowIntercept!=null){src.removeCallbacks(this.mDisallowIntercept);}break;}return false;}},{key:'onTouchForwarded',value:function onTouchForwarded(srcEvent){return false;}}]);return ForwardingListener;}();ListPopupWindow.ForwardingListener=ForwardingListener;(function(ForwardingListener){var DisallowIntercept=function(){function DisallowIntercept(arg){_classCallCheck(this,DisallowIntercept);this._ForwardingListener_this=arg;}_createClass(DisallowIntercept,[{key:'run',value:function run(){var parent=this._ForwardingListener_this.mSrc.getParent();parent.requestDisallowInterceptTouchEvent(true);}}]);return DisallowIntercept;}();ForwardingListener.DisallowIntercept=DisallowIntercept;})(ForwardingListener=ListPopupWindow.ForwardingListener||(ListPopupWindow.ForwardingListener={}));var DropDownListView=function(_ListView3){_inherits(DropDownListView,_ListView3);function DropDownListView(context,hijackFocus){_classCallCheck(this,DropDownListView);var _this159=_possibleConstructorReturn(this,(DropDownListView.__proto__||Object.getPrototypeOf(DropDownListView)).call(this,context,null,android.R.attr.dropDownListViewStyle));_this159.mHijackFocus=hijackFocus;_this159.setCacheColorHint(0);return _this159;}_createClass(DropDownListView,[{key:'onForwardedEvent',value:function onForwardedEvent(event,activePointerId){var handledEvent=true;var clearPressedItem=false;var actionMasked=event.getActionMasked();switch(actionMasked){case MotionEvent.ACTION_CANCEL:handledEvent=false;break;case MotionEvent.ACTION_UP:handledEvent=false;case MotionEvent.ACTION_MOVE:var activeIndex=event.findPointerIndex(activePointerId);if(activeIndex<0){handledEvent=false;break;}var _x230=Math.floor(event.getX(activeIndex));var _y19=Math.floor(event.getY(activeIndex));var position=this.pointToPosition(_x230,_y19);if(position==DropDownListView.INVALID_POSITION){clearPressedItem=true;break;}var child=this.getChildAt(position-this.getFirstVisiblePosition());this.setPressedItem(child,position);handledEvent=true;if(actionMasked==MotionEvent.ACTION_UP){this.clickPressedItem(child,position);}break;}if(!handledEvent||clearPressedItem){this.clearPressedItem();}return handledEvent;}},{key:'clickPressedItem',value:function clickPressedItem(child,position){var id=this.getItemIdAtPosition(position);this.performItemClick(child,position,id);}},{key:'clearPressedItem',value:function clearPressedItem(){this.mDrawsInPressedState=false;this.setPressed(false);this.updateSelectorState();}},{key:'setPressedItem',value:function setPressedItem(child,position){this.mDrawsInPressedState=true;this.setPressed(true);this.layoutChildren();this.setSelectedPositionInt(position);this.positionSelector(position,child);this.refreshDrawableState();}},{key:'touchModeDrawsInPressedState',value:function touchModeDrawsInPressedState(){return this.mDrawsInPressedState||_get2(DropDownListView.prototype.__proto__||Object.getPrototypeOf(DropDownListView.prototype),'touchModeDrawsInPressedState',this).call(this);}},{key:'obtainView',value:function obtainView(position,isScrap){var view=_get2(DropDownListView.prototype.__proto__||Object.getPrototypeOf(DropDownListView.prototype),'obtainView',this).call(this,position,isScrap);if(view instanceof TextView){view.setHorizontallyScrolling(true);}return view;}},{key:'isInTouchMode',value:function isInTouchMode(){return this.mHijackFocus&&this.mListSelectionHidden||_get2(DropDownListView.prototype.__proto__||Object.getPrototypeOf(DropDownListView.prototype),'isInTouchMode',this).call(this);}},{key:'hasWindowFocus',value:function hasWindowFocus(){return this.mHijackFocus||_get2(DropDownListView.prototype.__proto__||Object.getPrototypeOf(DropDownListView.prototype),'hasWindowFocus',this).call(this);}},{key:'isFocused',value:function isFocused(){return this.mHijackFocus||_get2(DropDownListView.prototype.__proto__||Object.getPrototypeOf(DropDownListView.prototype),'isFocused',this).call(this);}},{key:'hasFocus',value:function hasFocus(){return this.mHijackFocus||_get2(DropDownListView.prototype.__proto__||Object.getPrototypeOf(DropDownListView.prototype),'hasFocus',this).call(this);}}]);return DropDownListView;}(ListView);DropDownListView.CLICK_ANIM_DURATION=150;DropDownListView.CLICK_ANIM_ALPHA=0x80;ListPopupWindow.DropDownListView=DropDownListView;var PopupDataSetObserver=function(_DataSetObserver3){_inherits(PopupDataSetObserver,_DataSetObserver3);function PopupDataSetObserver(arg){_classCallCheck(this,PopupDataSetObserver);var _this160=_possibleConstructorReturn(this,(PopupDataSetObserver.__proto__||Object.getPrototypeOf(PopupDataSetObserver)).call(this));_this160._ListPopupWindow_this=arg;return _this160;}_createClass(PopupDataSetObserver,[{key:'onChanged',value:function onChanged(){if(this._ListPopupWindow_this.isShowing()){this._ListPopupWindow_this.show();}}},{key:'onInvalidated',value:function onInvalidated(){this._ListPopupWindow_this.dismiss();}}]);return PopupDataSetObserver;}(DataSetObserver);ListPopupWindow.PopupDataSetObserver=PopupDataSetObserver;var ListSelectorHider=function(){function ListSelectorHider(arg){_classCallCheck(this,ListSelectorHider);this._ListPopupWindow_this=arg;}_createClass(ListSelectorHider,[{key:'run',value:function run(){this._ListPopupWindow_this.clearListSelection();}}]);return ListSelectorHider;}();ListPopupWindow.ListSelectorHider=ListSelectorHider;var ResizePopupRunnable=function(){function ResizePopupRunnable(arg){_classCallCheck(this,ResizePopupRunnable);this._ListPopupWindow_this=arg;}_createClass(ResizePopupRunnable,[{key:'run',value:function run(){if(this._ListPopupWindow_this.mDropDownList!=null&&this._ListPopupWindow_this.mDropDownList.getCount()>this._ListPopupWindow_this.mDropDownList.getChildCount()&&this._ListPopupWindow_this.mDropDownList.getChildCount()<=this._ListPopupWindow_this.mListItemExpandMaximum){this._ListPopupWindow_this.mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);this._ListPopupWindow_this.show();}}}]);return ResizePopupRunnable;}();ListPopupWindow.ResizePopupRunnable=ResizePopupRunnable;var PopupTouchInterceptor=function(){function PopupTouchInterceptor(arg){_classCallCheck(this,PopupTouchInterceptor);this._ListPopupWindow_this=arg;}_createClass(PopupTouchInterceptor,[{key:'onTouch',value:function onTouch(v,event){var action=event.getAction();var x=Math.floor(event.getX());var y=Math.floor(event.getY());if(action==MotionEvent.ACTION_DOWN&&this._ListPopupWindow_this.mPopup!=null&&this._ListPopupWindow_this.mPopup.isShowing()&&x>=0&&x<this._ListPopupWindow_this.mPopup.getWidth()&&y>=0&&y<this._ListPopupWindow_this.mPopup.getHeight()){this._ListPopupWindow_this.mHandler.postDelayed(this._ListPopupWindow_this.mResizePopupRunnable,ListPopupWindow.EXPAND_LIST_TIMEOUT);}else if(action==MotionEvent.ACTION_UP){this._ListPopupWindow_this.mHandler.removeCallbacks(this._ListPopupWindow_this.mResizePopupRunnable);}return false;}}]);return PopupTouchInterceptor;}();ListPopupWindow.PopupTouchInterceptor=PopupTouchInterceptor;var PopupScrollListener=function(){function PopupScrollListener(arg){_classCallCheck(this,PopupScrollListener);this._ListPopupWindow_this=arg;}_createClass(PopupScrollListener,[{key:'onScroll',value:function onScroll(view,firstVisibleItem,visibleItemCount,totalItemCount){}},{key:'onScrollStateChanged',value:function onScrollStateChanged(view,scrollState){if(scrollState==AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL&&!this._ListPopupWindow_this.isInputMethodNotNeeded()&&this._ListPopupWindow_this.mPopup.getContentView()!=null){this._ListPopupWindow_this.mHandler.removeCallbacks(this._ListPopupWindow_this.mResizePopupRunnable);this._ListPopupWindow_this.mResizePopupRunnable.run();}}}]);return PopupScrollListener;}();ListPopupWindow.PopupScrollListener=PopupScrollListener;})(ListPopupWindow=widget.ListPopupWindow||(widget.ListPopupWindow={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var android;(function(android){var widget;(function(widget){var AlertDialog=android.app.AlertDialog;var Rect=android.graphics.Rect;var Log=android.util.Log;var Gravity=android.view.Gravity;var View=android.view.View;var ViewGroup=android.view.ViewGroup;var AbsSpinner=android.widget.AbsSpinner;var ListAdapter=android.widget.ListAdapter;var ListPopupWindow=android.widget.ListPopupWindow;var ListView=android.widget.ListView;var R=android.R;var Spinner=function(_AbsSpinner){_inherits(Spinner,_AbsSpinner);function Spinner(context,bindElement){var defStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:R.attr.spinnerStyle;var mode=arguments.length>3&&arguments[3]!==undefined?arguments[3]:Spinner.MODE_THEME;_classCallCheck(this,Spinner);var _this161=_possibleConstructorReturn(this,(Spinner.__proto__||Object.getPrototypeOf(Spinner)).call(this,context,bindElement,defStyle));_this161.mDropDownWidth=0;_this161.mGravity=0;_this161.mTempRect=new Rect();var a=context.obtainStyledAttributes(bindElement,defStyle);if(mode==Spinner.MODE_THEME){if('dialog'===a.getAttrValue('spinnerMode')){mode=Spinner.MODE_DIALOG;}else{mode=Spinner.MODE_DROPDOWN;}}switch(mode){case Spinner.MODE_DIALOG:{_this161.mPopup=new Spinner.DialogPopup(_this161);break;}case Spinner.MODE_DROPDOWN:{var popup=new Spinner.DropdownPopup(context,defStyle,_this161);_this161.mDropDownWidth=a.getLayoutDimension('dropDownWidth',ViewGroup.LayoutParams.WRAP_CONTENT);popup.setBackgroundDrawable(a.getDrawable('popupBackground'));var verticalOffset=a.getDimensionPixelOffset('dropDownVerticalOffset',0);if(verticalOffset!=0){popup.setVerticalOffset(verticalOffset);}var horizontalOffset=a.getDimensionPixelOffset('dropDownHorizontalOffset',0);if(horizontalOffset!=0){popup.setHorizontalOffset(horizontalOffset);}_this161.mPopup=popup;break;}}_this161.mGravity=Gravity.parseGravity(a.getAttrValue('gravity'),Gravity.CENTER);_this161.mPopup.setPromptText(a.getString('prompt'));_this161.mDisableChildrenWhenDisabled=a.getBoolean('disableChildrenWhenDisabled',false);a.recycle();if(_this161.mTempAdapter!=null){_this161.mPopup.setAdapter(_this161.mTempAdapter);_this161.mTempAdapter=null;}return _this161;}_createClass(Spinner,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(Spinner.prototype.__proto__||Object.getPrototypeOf(Spinner.prototype),'createClassAttrBinder',this).call(this).set('dropDownWidth',{setter:function setter(v,value,a){v.mDropDownWidth=a.parseNumberPixelSize(value,v.mDropDownWidth);},getter:function getter(v){return v.mDropDownWidth;}}).set('popupBackground',{setter:function setter(v,value,a){v.mPopup.setBackgroundDrawable(a.parseDrawable(value));},getter:function getter(v){return v.mPopup.getBackground();}}).set('dropDownVerticalOffset',{setter:function setter(v,value,a){var verticalOffset=a.parseNumberPixelSize(value,0);if(verticalOffset!=0){v.mPopup.setVerticalOffset(verticalOffset);}},getter:function getter(v){return v.mPopup.getVerticalOffset();}}).set('dropDownHorizontalOffset',{setter:function setter(v,value,a){var horizontalOffset=a.parseNumberPixelSize(value,0);if(horizontalOffset!=0){v.mPopup.setHorizontalOffset(horizontalOffset);}},getter:function getter(v){return v.mPopup.getHorizontalOffset();}}).set('gravity',{setter:function setter(v,value,a){v.mGravity=a.parseGravity(value,Gravity.CENTER);},getter:function getter(v){return v.mGravity;}}).set('prompt',{setter:function setter(v,value,a){v.mPopup.setPromptText(a.parseString(value));},getter:function getter(v){return v.mPopup.getHintText();}}).set('disableChildrenWhenDisabled',{setter:function setter(v,value,a){v.mDisableChildrenWhenDisabled=a.parseBoolean(value,false);},getter:function getter(v){return v.mDisableChildrenWhenDisabled;}});}},{key:'setPopupBackgroundDrawable',value:function setPopupBackgroundDrawable(background){if(!(this.mPopup instanceof Spinner.DropdownPopup)){Log.e(Spinner.TAG,\"setPopupBackgroundDrawable: incompatible spinner mode; ignoring...\");return;}this.mPopup.setBackgroundDrawable(background);}},{key:'getPopupBackground',value:function getPopupBackground(){return this.mPopup.getBackground();}},{key:'setDropDownVerticalOffset',value:function setDropDownVerticalOffset(pixels){this.mPopup.setVerticalOffset(pixels);}},{key:'getDropDownVerticalOffset',value:function getDropDownVerticalOffset(){return this.mPopup.getVerticalOffset();}},{key:'setDropDownHorizontalOffset',value:function setDropDownHorizontalOffset(pixels){this.mPopup.setHorizontalOffset(pixels);}},{key:'getDropDownHorizontalOffset',value:function getDropDownHorizontalOffset(){return this.mPopup.getHorizontalOffset();}},{key:'setDropDownWidth',value:function setDropDownWidth(pixels){if(!(this.mPopup instanceof Spinner.DropdownPopup)){Log.e(Spinner.TAG,\"Cannot set dropdown width for MODE_DIALOG, ignoring\");return;}this.mDropDownWidth=pixels;}},{key:'getDropDownWidth',value:function getDropDownWidth(){return this.mDropDownWidth;}},{key:'setEnabled',value:function setEnabled(enabled){_get2(Spinner.prototype.__proto__||Object.getPrototypeOf(Spinner.prototype),'setEnabled',this).call(this,enabled);if(this.mDisableChildrenWhenDisabled){var count=this.getChildCount();for(var i=0;i<count;i++){this.getChildAt(i).setEnabled(enabled);}}}},{key:'setGravity',value:function setGravity(gravity){if(this.mGravity!=gravity){if((gravity&Gravity.HORIZONTAL_GRAVITY_MASK)==0){gravity|=Gravity.START;}this.mGravity=gravity;this.requestLayout();}}},{key:'getGravity',value:function getGravity(){return this.mGravity;}},{key:'setAdapter',value:function setAdapter(adapter){_get2(Spinner.prototype.__proto__||Object.getPrototypeOf(Spinner.prototype),'setAdapter',this).call(this,adapter);this.mRecycler.clear();if(this.mPopup!=null){this.mPopup.setAdapter(new Spinner.DropDownAdapter(adapter));}else{this.mTempAdapter=new Spinner.DropDownAdapter(adapter);}}},{key:'getBaseline',value:function getBaseline(){var child=null;if(this.getChildCount()>0){child=this.getChildAt(0);}else if(this.mAdapter!=null&&this.mAdapter.getCount()>0){child=this.makeView(0,false);this.mRecycler.put(0,child);}if(child!=null){var childBaseline=child.getBaseline();return childBaseline>=0?child.getTop()+childBaseline:-1;}else{return-1;}}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){_get2(Spinner.prototype.__proto__||Object.getPrototypeOf(Spinner.prototype),'onDetachedFromWindow',this).call(this);if(this.mPopup!=null&&this.mPopup.isShowing()){this.mPopup.dismiss();}}},{key:'setOnItemClickListener',value:function setOnItemClickListener(l){throw Error('new RuntimeException(\"setOnItemClickListener cannot be used with a spinner.\")');}},{key:'setOnItemClickListenerInt',value:function setOnItemClickListenerInt(l){_get2(Spinner.prototype.__proto__||Object.getPrototypeOf(Spinner.prototype),'setOnItemClickListener',this).call(this,l);}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){_get2(Spinner.prototype.__proto__||Object.getPrototypeOf(Spinner.prototype),'onMeasure',this).call(this,widthMeasureSpec,heightMeasureSpec);if(this.mPopup!=null&&View.MeasureSpec.getMode(widthMeasureSpec)==View.MeasureSpec.AT_MOST){var measuredWidth=this.getMeasuredWidth();this.setMeasuredDimension(Math.min(Math.max(measuredWidth,this.measureContentWidth(this.getAdapter(),this.getBackground())),View.MeasureSpec.getSize(widthMeasureSpec)),this.getMeasuredHeight());}}},{key:'onLayout',value:function onLayout(changed,l,t,r,b){_get2(Spinner.prototype.__proto__||Object.getPrototypeOf(Spinner.prototype),'onLayout',this).call(this,changed,l,t,r,b);this.mInLayout=true;this.layoutSpinner(0,false);this.mInLayout=false;}},{key:'layoutSpinner',value:function layoutSpinner(delta,animate){var childrenLeft=this.mSpinnerPadding.left;var childrenWidth=this.mRight-this.mLeft-this.mSpinnerPadding.left-this.mSpinnerPadding.right;if(this.mDataChanged){this.handleDataChanged();}if(this.mItemCount==0){this.resetList();return;}if(this.mNextSelectedPosition>=0){this.setSelectedPositionInt(this.mNextSelectedPosition);}this.recycleAllViews();this.removeAllViewsInLayout();this.mFirstPosition=this.mSelectedPosition;if(this.mAdapter!=null){var sel=this.makeView(this.mSelectedPosition,true);var width=sel.getMeasuredWidth();var selectedOffset=childrenLeft;var layoutDirection=this.getLayoutDirection();var absoluteGravity=Gravity.getAbsoluteGravity(this.mGravity,layoutDirection);switch(absoluteGravity&Gravity.HORIZONTAL_GRAVITY_MASK){case Gravity.CENTER_HORIZONTAL:selectedOffset=childrenLeft+childrenWidth/2-width/2;break;case Gravity.RIGHT:selectedOffset=childrenLeft+childrenWidth-width;break;}sel.offsetLeftAndRight(selectedOffset);}this.mRecycler.clear();this.invalidate();this.checkSelectionChanged();this.mDataChanged=false;this.mNeedSync=false;this.setNextSelectedPositionInt(this.mSelectedPosition);}},{key:'makeView',value:function makeView(position,addChild){var child=void 0;if(!this.mDataChanged){child=this.mRecycler.get(position);if(child!=null){this.setUpChild(child,addChild);return child;}}child=this.mAdapter.getView(position,null,this);this.setUpChild(child,addChild);return child;}},{key:'setUpChild',value:function setUpChild(child,addChild){var lp=child.getLayoutParams();if(lp==null){lp=this.generateDefaultLayoutParams();}if(addChild){this.addViewInLayout(child,0,lp);}child.setSelected(this.hasFocus());if(this.mDisableChildrenWhenDisabled){child.setEnabled(this.isEnabled());}var childHeightSpec=ViewGroup.getChildMeasureSpec(this.mHeightMeasureSpec,this.mSpinnerPadding.top+this.mSpinnerPadding.bottom,lp.height);var childWidthSpec=ViewGroup.getChildMeasureSpec(this.mWidthMeasureSpec,this.mSpinnerPadding.left+this.mSpinnerPadding.right,lp.width);child.measure(childWidthSpec,childHeightSpec);var childLeft=void 0;var childRight=void 0;var childTop=this.mSpinnerPadding.top+(this.getMeasuredHeight()-this.mSpinnerPadding.bottom-this.mSpinnerPadding.top-child.getMeasuredHeight())/2;var childBottom=childTop+child.getMeasuredHeight();var width=child.getMeasuredWidth();childLeft=0;childRight=childLeft+width;child.layout(childLeft,childTop,childRight,childBottom);}},{key:'performClick',value:function performClick(){var handled=_get2(Spinner.prototype.__proto__||Object.getPrototypeOf(Spinner.prototype),'performClick',this).call(this);if(!handled){handled=true;if(!this.mPopup.isShowing()){this.mPopup.showPopup(this.getTextDirection(),this.getTextAlignment());}}return handled;}},{key:'onClick',value:function onClick(dialog,which){this.setSelection(which);dialog.dismiss();}},{key:'setPrompt',value:function setPrompt(prompt){this.mPopup.setPromptText(prompt);}},{key:'getPrompt',value:function getPrompt(){return this.mPopup.getHintText();}},{key:'measureContentWidth',value:function measureContentWidth(adapter,background){if(adapter==null){return 0;}var width=0;var itemView=null;var itemType=0;var widthMeasureSpec=View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);var heightMeasureSpec=View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);var start=Math.max(0,this.getSelectedItemPosition());var end=Math.min(adapter.getCount(),start+Spinner.MAX_ITEMS_MEASURED);var count=end-start;start=Math.max(0,start-(Spinner.MAX_ITEMS_MEASURED-count));for(var i=start;i<end;i++){var positionType=adapter.getItemViewType(i);if(positionType!=itemType){itemType=positionType;itemView=null;}itemView=adapter.getView(i,itemView,this);if(itemView.getLayoutParams()==null){itemView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT));}itemView.measure(widthMeasureSpec,heightMeasureSpec);width=Math.max(width,itemView.getMeasuredWidth());}if(background!=null){background.getPadding(this.mTempRect);width+=this.mTempRect.left+this.mTempRect.right;}return width;}}]);return Spinner;}(AbsSpinner);Spinner.TAG=\"Spinner\";Spinner.MAX_ITEMS_MEASURED=15;Spinner.MODE_DIALOG=0;Spinner.MODE_DROPDOWN=1;Spinner.MODE_THEME=-1;widget.Spinner=Spinner;(function(Spinner){var DropDownAdapter=function(){function DropDownAdapter(adapter){_classCallCheck(this,DropDownAdapter);this.mAdapter=adapter;if(ListAdapter.isImpl(adapter)){this.mListAdapter=adapter;}}_createClass(DropDownAdapter,[{key:'getCount',value:function getCount(){return this.mAdapter==null?0:this.mAdapter.getCount();}},{key:'getItem',value:function getItem(position){return this.mAdapter==null?null:this.mAdapter.getItem(position);}},{key:'getItemId',value:function getItemId(position){return this.mAdapter==null?-1:this.mAdapter.getItemId(position);}},{key:'getView',value:function getView(position,convertView,parent){return this.getDropDownView(position,convertView,parent);}},{key:'getDropDownView',value:function getDropDownView(position,convertView,parent){return this.mAdapter==null?null:this.mAdapter.getDropDownView(position,convertView,parent);}},{key:'hasStableIds',value:function hasStableIds(){return this.mAdapter!=null&&this.mAdapter.hasStableIds();}},{key:'registerDataSetObserver',value:function registerDataSetObserver(observer){if(this.mAdapter!=null){this.mAdapter.registerDataSetObserver(observer);}}},{key:'unregisterDataSetObserver',value:function unregisterDataSetObserver(observer){if(this.mAdapter!=null){this.mAdapter.unregisterDataSetObserver(observer);}}},{key:'areAllItemsEnabled',value:function areAllItemsEnabled(){var adapter=this.mListAdapter;if(adapter!=null){return adapter.areAllItemsEnabled();}else{return true;}}},{key:'isEnabled',value:function isEnabled(position){var adapter=this.mListAdapter;if(adapter!=null){return adapter.isEnabled(position);}else{return true;}}},{key:'getItemViewType',value:function getItemViewType(position){return 0;}},{key:'getViewTypeCount',value:function getViewTypeCount(){return 1;}},{key:'isEmpty',value:function isEmpty(){return this.getCount()==0;}}]);return DropDownAdapter;}();Spinner.DropDownAdapter=DropDownAdapter;var DialogPopup=function(){function DialogPopup(arg){_classCallCheck(this,DialogPopup);this._Spinner_this=arg;}_createClass(DialogPopup,[{key:'dismiss',value:function dismiss(){this.mPopup.dismiss();this.mPopup=null;}},{key:'isShowing',value:function isShowing(){return this.mPopup!=null?this.mPopup.isShowing():false;}},{key:'setAdapter',value:function setAdapter(adapter){this.mListAdapter=adapter;}},{key:'setPromptText',value:function setPromptText(hintText){this.mPrompt=hintText;}},{key:'getHintText',value:function getHintText(){return this.mPrompt;}},{key:'showPopup',value:function showPopup(textDirection,textAlignment){if(this.mListAdapter==null){return;}var builder=new AlertDialog.Builder(this._Spinner_this.getContext());if(this.mPrompt!=null){builder.setTitle(this.mPrompt);}this.mPopup=builder.setSingleChoiceItemsWithAdapter(this.mListAdapter,this._Spinner_this.getSelectedItemPosition(),this).create();var listView=this.mPopup.getListView();listView.setTextDirection(textDirection);listView.setTextAlignment(textAlignment);this.mPopup.show();}},{key:'onClick',value:function onClick(dialog,which){this._Spinner_this.setSelection(which);if(this._Spinner_this.mOnItemClickListener!=null){this._Spinner_this.performItemClick(null,which,this.mListAdapter.getItemId(which));}this.dismiss();}},{key:'setBackgroundDrawable',value:function setBackgroundDrawable(bg){Log.e(Spinner.TAG,\"Cannot set popup background for MODE_DIALOG, ignoring\");}},{key:'setVerticalOffset',value:function setVerticalOffset(px){Log.e(Spinner.TAG,\"Cannot set vertical offset for MODE_DIALOG, ignoring\");}},{key:'setHorizontalOffset',value:function setHorizontalOffset(px){Log.e(Spinner.TAG,\"Cannot set horizontal offset for MODE_DIALOG, ignoring\");}},{key:'getBackground',value:function getBackground(){return null;}},{key:'getVerticalOffset',value:function getVerticalOffset(){return 0;}},{key:'getHorizontalOffset',value:function getHorizontalOffset(){return 0;}}]);return DialogPopup;}();Spinner.DialogPopup=DialogPopup;var DropdownPopup=function(_ListPopupWindow){_inherits(DropdownPopup,_ListPopupWindow);function DropdownPopup(context,defStyleRes,arg){_classCallCheck(this,DropdownPopup);var _this162=_possibleConstructorReturn(this,(DropdownPopup.__proto__||Object.getPrototypeOf(DropdownPopup)).call(this,context,defStyleRes));_this162._Spinner_this=arg;_this162.setAnchorView(_this162._Spinner_this);_this162.setModal(true);_this162.setPromptPosition(DropdownPopup.POSITION_PROMPT_ABOVE);_this162.setOnItemClickListener(function(){var inner_this=_this162;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'onItemClick',value:function onItemClick(parent,v,position,id){inner_this._Spinner_this.setSelection(position);if(inner_this._Spinner_this.mOnItemClickListener!=null){inner_this._Spinner_this.performItemClick(v,position,inner_this.mAdapter.getItemId(position));}inner_this.dismiss();}}]);return _Inner;}();return new _Inner();}());return _this162;}_createClass(DropdownPopup,[{key:'setAdapter',value:function setAdapter(adapter){_get2(DropdownPopup.prototype.__proto__||Object.getPrototypeOf(DropdownPopup.prototype),'setAdapter',this).call(this,adapter);}},{key:'getHintText',value:function getHintText(){return this.mHintText;}},{key:'setPromptText',value:function setPromptText(hintText){this.mHintText=hintText;}},{key:'computeContentWidth',value:function computeContentWidth(){var background=this.getBackground();var hOffset=0;if(background!=null){background.getPadding(this._Spinner_this.mTempRect);hOffset=this._Spinner_this.isLayoutRtl()?this._Spinner_this.mTempRect.right:-this._Spinner_this.mTempRect.left;}else{this._Spinner_this.mTempRect.left=this._Spinner_this.mTempRect.right=0;}var spinnerPaddingLeft=this._Spinner_this.getPaddingLeft();var spinnerPaddingRight=this._Spinner_this.getPaddingRight();var spinnerWidth=this._Spinner_this.getWidth();if(this._Spinner_this.mDropDownWidth==DropdownPopup.WRAP_CONTENT){var contentWidth=this._Spinner_this.measureContentWidth(this.mAdapter,this.getBackground());var contentWidthLimit=this._Spinner_this.mContext.getResources().getDisplayMetrics().widthPixels-this._Spinner_this.mTempRect.left-this._Spinner_this.mTempRect.right;if(contentWidth>contentWidthLimit){contentWidth=contentWidthLimit;}this.setContentWidth(Math.max(contentWidth,spinnerWidth-spinnerPaddingLeft-spinnerPaddingRight));}else if(this._Spinner_this.mDropDownWidth==DropdownPopup.MATCH_PARENT){this.setContentWidth(spinnerWidth-spinnerPaddingLeft-spinnerPaddingRight);}else{this.setContentWidth(this._Spinner_this.mDropDownWidth);}if(this._Spinner_this.isLayoutRtl()){hOffset+=spinnerWidth-spinnerPaddingRight-this.getWidth();}else{hOffset+=spinnerPaddingLeft;}this.setHorizontalOffset(hOffset);}},{key:'showPopup',value:function showPopup(textDirection,textAlignment){var _this163=this;var wasShowing=this.isShowing();this.computeContentWidth();this.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NOT_NEEDED);_get2(DropdownPopup.prototype.__proto__||Object.getPrototypeOf(DropdownPopup.prototype),'show',this).call(this);var listView=this.getListView();listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);listView.setTextDirection(textDirection);listView.setTextAlignment(textAlignment);this.setSelection(this._Spinner_this.getSelectedItemPosition());if(wasShowing){return;}var vto=this._Spinner_this.getViewTreeObserver();if(vto!=null){(function(){var layoutListener=function(){var inner_this=_this163;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'onGlobalLayout',value:function onGlobalLayout(){if(!inner_this._Spinner_this.isVisibleToUser()){inner_this.dismiss();}else{inner_this.computeContentWidth();inner_this.show();}}}]);return _Inner;}();return new _Inner();}();vto.addOnGlobalLayoutListener(layoutListener);_this163.setOnDismissListener(function(){var inner_this=_this163;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'onDismiss',value:function onDismiss(){var vto=inner_this._Spinner_this.getViewTreeObserver();if(vto!=null){vto.removeOnGlobalLayoutListener(layoutListener);}}}]);return _Inner;}();return new _Inner();}());})();}}}]);return DropdownPopup;}(ListPopupWindow);Spinner.DropdownPopup=DropdownPopup;})(Spinner=widget.Spinner||(widget.Spinner={}));})(widget=android.widget||(android.widget={}));})(android||(android={}));var androidui;(function(androidui){var widget;(function(widget){var View=android.view.View;var HtmlBaseView=function(_View4){_inherits(HtmlBaseView,_View4);function HtmlBaseView(context,bindElement,defStyle){_classCallCheck(this,HtmlBaseView);var _this164=_possibleConstructorReturn(this,(HtmlBaseView.__proto__||Object.getPrototypeOf(HtmlBaseView)).call(this,context,bindElement,defStyle));_this164.mHtmlTouchAble=false;return _this164;}_createClass(HtmlBaseView,[{key:'onTouchEvent',value:function onTouchEvent(event){if(this.mHtmlTouchAble){event[android.view.ViewRootImpl.ContinueEventToDom]=true;}return _get2(HtmlBaseView.prototype.__proto__||Object.getPrototypeOf(HtmlBaseView.prototype),'onTouchEvent',this).call(this,event)||this.mHtmlTouchAble;}},{key:'setHtmlTouchAble',value:function setHtmlTouchAble(enable){this.mHtmlTouchAble=enable;}},{key:'isHtmlTouchAble',value:function isHtmlTouchAble(){return this.mHtmlTouchAble;}},{key:'dependOnDebugLayout',value:function dependOnDebugLayout(){return true;}}]);return HtmlBaseView;}(View);widget.HtmlBaseView=HtmlBaseView;})(widget=androidui.widget||(androidui.widget={}));})(androidui||(androidui={}));var android;(function(android){var webkit;(function(webkit){var WebViewClient=function(){function WebViewClient(){_classCallCheck(this,WebViewClient);}_createClass(WebViewClient,[{key:'onPageFinished',value:function onPageFinished(view,url){}},{key:'onReceivedTitle',value:function onReceivedTitle(view,title){}}]);return WebViewClient;}();webkit.WebViewClient=WebViewClient;})(webkit=android.webkit||(android.webkit={}));})(android||(android={}));var android;(function(android){var webkit;(function(webkit){var HtmlBaseView=androidui.widget.HtmlBaseView;var WebView=function(_HtmlBaseView){_inherits(WebView,_HtmlBaseView);function WebView(context,bindElement,defStyle){_classCallCheck(this,WebView);var _this165=_possibleConstructorReturn(this,(WebView.__proto__||Object.getPrototypeOf(WebView)).call(this,context,bindElement,defStyle));_this165.initIFrameHistoryLength=-1;var density=_this165.getResources().getDisplayMetrics().density;_this165.setMinimumWidth(300*density);_this165.setMinimumHeight(150*density);return _this165;}_createClass(WebView,[{key:'initIFrameElement',value:function initIFrameElement(url){var _this166=this;this.iFrameElement=document.createElement('iframe');this.iFrameElement.style.border='none';this.iFrameElement.style.height='100%';this.iFrameElement.style.width='100%';this.iFrameElement.onload=function(){_this166.checkActivityResume();if(_this166.initIFrameHistoryLength<0)_this166.initIFrameHistoryLength=history.length;if(_this166.mClient){_this166.mClient.onReceivedTitle(_this166,_this166.getTitle());_this166.mClient.onPageFinished(_this166,_this166.getUrl());}};this.bindElement.style['webkitOverflowScrolling']=this.bindElement.style['overflowScrolling']='touch';this.bindElement.style.overflowY='auto';if(url)this.iFrameElement.src=url;this.bindElement.appendChild(this.iFrameElement);var activity=this.getContext();var onDestroy=activity.onDestroy;activity.onDestroy=function(){onDestroy.call(activity);PageStack.preClosePageHasIFrame(_this166.initIFrameHistoryLength);};}},{key:'checkActivityResume',value:function checkActivityResume(){if(!this.getContext().mResumed){console.error('can\\'t call any webview\\'s methods when host activity was pause');}}},{key:'goBack',value:function goBack(){this.checkActivityResume();if(this.canGoBack()){history.back();}}},{key:'canGoBack',value:function canGoBack(){this.checkActivityResume();if(this.initIFrameHistoryLength<0)return false;return history.length>this.initIFrameHistoryLength;}},{key:'loadUrl',value:function loadUrl(url){if(this.initIFrameHistoryLength>0){this.checkActivityResume();}if(!this.iFrameElement){this.initIFrameElement(url);}this.iFrameElement.src=url;}},{key:'reload',value:function reload(){if(!this.iFrameElement)return;try{this.iFrameElement.contentWindow.location.reload();}catch(e){this.iFrameElement.src=this.iFrameElement.src;}}},{key:'getUrl',value:function getUrl(){if(!this.iFrameElement)return'';try{return this.iFrameElement.contentWindow.document.URL;}catch(e){return this.iFrameElement.src;}}},{key:'getTitle',value:function getTitle(){try{return this.iFrameElement.contentWindow.document.title;}catch(e){console.warn(e);return'';}}},{key:'setWebViewClient',value:function setWebViewClient(client){this.mClient=client;}}]);return WebView;}(HtmlBaseView);webkit.WebView=WebView;})(webkit=android.webkit||(android.webkit={}));})(android||(android={}));var android;(function(android){var view;(function(view){var animation;(function(animation){var Animation=android.view.animation.Animation;var RotateAnimation=function(_Animation5){_inherits(RotateAnimation,_Animation5);function RotateAnimation(fromDegrees,toDegrees){var pivotXType=arguments.length>2&&arguments[2]!==undefined?arguments[2]:RotateAnimation.ABSOLUTE;var pivotXValue=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var pivotYType=arguments.length>4&&arguments[4]!==undefined?arguments[4]:RotateAnimation.ABSOLUTE;var pivotYValue=arguments.length>5&&arguments[5]!==undefined?arguments[5]:0;_classCallCheck(this,RotateAnimation);var _this167=_possibleConstructorReturn(this,(RotateAnimation.__proto__||Object.getPrototypeOf(RotateAnimation)).call(this));_this167.mFromDegrees=0;_this167.mToDegrees=0;_this167.mPivotXType=RotateAnimation.ABSOLUTE;_this167.mPivotYType=RotateAnimation.ABSOLUTE;_this167.mPivotXValue=0.0;_this167.mPivotYValue=0.0;_this167.mPivotX=0;_this167.mPivotY=0;_this167.mFromDegrees=fromDegrees;_this167.mToDegrees=toDegrees;_this167.mPivotXValue=pivotXValue;_this167.mPivotXType=pivotXType;_this167.mPivotYValue=pivotYValue;_this167.mPivotYType=pivotYType;_this167.initializePivotPoint();return _this167;}_createClass(RotateAnimation,[{key:'initializePivotPoint',value:function initializePivotPoint(){if(this.mPivotXType==RotateAnimation.ABSOLUTE){this.mPivotX=this.mPivotXValue;}if(this.mPivotYType==RotateAnimation.ABSOLUTE){this.mPivotY=this.mPivotYValue;}}},{key:'applyTransformation',value:function applyTransformation(interpolatedTime,t){var degrees=this.mFromDegrees+(this.mToDegrees-this.mFromDegrees)*interpolatedTime;var scale=this.getScaleFactor();if(this.mPivotX==0.0&&this.mPivotY==0.0){t.getMatrix().setRotate(degrees);}else{t.getMatrix().setRotate(degrees,this.mPivotX*scale,this.mPivotY*scale);}}},{key:'initialize',value:function initialize(width,height,parentWidth,parentHeight){_get2(RotateAnimation.prototype.__proto__||Object.getPrototypeOf(RotateAnimation.prototype),'initialize',this).call(this,width,height,parentWidth,parentHeight);this.mPivotX=this.resolveSize(this.mPivotXType,this.mPivotXValue,width,parentWidth);this.mPivotY=this.resolveSize(this.mPivotYType,this.mPivotYValue,height,parentHeight);}}]);return RotateAnimation;}(Animation);animation.RotateAnimation=RotateAnimation;})(animation=view.animation||(view.animation={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view_6){var MenuItem=function(){function MenuItem(menu,group,id,categoryOrder,ordering,title){_classCallCheck(this,MenuItem);this.mId=0;this.mGroup=0;this.mCategoryOrder=0;this.mOrdering=0;this.mVisible=true;this.mEnable=true;this.mMenu=menu;this.mId=id;this.mGroup=group;this.mCategoryOrder=categoryOrder;this.mOrdering=ordering;this.mTitle=title;}_createClass(MenuItem,[{key:'getItemId',value:function getItemId(){return this.mId;}},{key:'getGroupId',value:function getGroupId(){return this.mGroup;}},{key:'getOrder',value:function getOrder(){return this.mOrdering;}},{key:'setTitle',value:function setTitle(title){this.mTitle=title;return this;}},{key:'getTitle',value:function getTitle(){return this.mTitle;}},{key:'setIcon',value:function setIcon(icon){this.mIconDrawable=icon;return this;}},{key:'getIcon',value:function getIcon(){return this.mIconDrawable;}},{key:'setIntent',value:function setIntent(intent){this.mIntent=intent;return this;}},{key:'getIntent',value:function getIntent(){return this.mIntent;}},{key:'setVisible',value:function setVisible(visible){this.mVisible=visible;return this;}},{key:'isVisible',value:function isVisible(){return this.mVisible;}},{key:'setEnabled',value:function setEnabled(enabled){this.mEnable=enabled;return this;}},{key:'isEnabled',value:function isEnabled(){return this.mEnable;}},{key:'setOnMenuItemClickListener',value:function setOnMenuItemClickListener(menuItemClickListener){this.mClickListener=menuItemClickListener;return this;}},{key:'setActionView',value:function setActionView(view){this.mActionView=view;return this;}},{key:'getActionView',value:function getActionView(){return this.mActionView;}},{key:'invoke',value:function invoke(){if(this.mClickListener!=null&&this.mClickListener.onMenuItemClick(this)){return true;}if(this.mMenu.dispatchMenuItemSelected(this.mMenu.getRootMenu(),this)){return true;}if(this.mIntent!=null){try{this.mMenu.getContext().startActivity(this.mIntent);return true;}catch(e){android.util.Log.e(\"MenuItem\",\"Can't find activity to handle intent; ignoring\",e);}}return false;}}]);return MenuItem;}();view_6.MenuItem=MenuItem;})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view){var MenuItem=android.view.MenuItem;var ArrayList=java.util.ArrayList;var Menu=function(){function Menu(context){_classCallCheck(this,Menu);this.mItems=new ArrayList();this.mVisibleItems=new ArrayList();this.mContext=context;}_createClass(Menu,[{key:'getContext',value:function getContext(){return this.mContext;}},{key:'add',value:function add(){if(arguments.length==1)return this.addInternal(0,0,0,arguments.length<=0?undefined:arguments[0]);return this.addInternal(arguments.length<=0?undefined:arguments[0],arguments.length<=1?undefined:arguments[1],arguments.length<=2?undefined:arguments[2],arguments.length<=3?undefined:arguments[3]);}},{key:'addInternal',value:function addInternal(group,id,categoryOrder,title){var ordering=0;var item=new MenuItem(this,group,id,categoryOrder,ordering,title);this.mItems.add(item);this.onItemsChanged(true);return item;}},{key:'removeItem',value:function removeItem(id){this.removeItemAtInt(this.findItemIndex(id),true);}},{key:'removeGroup',value:function removeGroup(groupId){var i=this.findGroupIndex(groupId);if(i>=0){var maxRemovable=this.mItems.size()-i;var numRemoved=0;while(numRemoved++<maxRemovable&&this.mItems.get(i).getGroupId()==groupId){this.removeItemAtInt(i,false);}this.onItemsChanged(true);}}},{key:'removeItemAtInt',value:function removeItemAtInt(index,updateChildrenOnMenuViews){if(index<0||index>=this.mItems.size()){return;}this.mItems.remove(index);if(updateChildrenOnMenuViews){this.onItemsChanged(true);}}},{key:'clear',value:function clear(){this.mItems.clear();this.onItemsChanged(true);}},{key:'setGroupVisible',value:function setGroupVisible(group,visible){var N=this.mItems.size();var changedAtLeastOneItem=false;for(var i=0;i<N;i++){var item=this.mItems.get(i);if(item.getGroupId()==group){if(item.setVisible(visible)){changedAtLeastOneItem=true;}}}if(changedAtLeastOneItem){this.onItemsChanged(true);}}},{key:'setGroupEnabled',value:function setGroupEnabled(group,enabled){var N=this.mItems.size();for(var i=0;i<N;i++){var item=this.mItems.get(i);if(item.getGroupId()==group){item.setEnabled(enabled);}}}},{key:'hasVisibleItems',value:function hasVisibleItems(){var size=this.size();for(var i=0;i<size;i++){var item=this.mItems.get(i);if(item.isVisible()){return true;}}return false;}},{key:'findItem',value:function findItem(id){var size=this.size();for(var i=0;i<size;i++){var item=this.mItems.get(i);if(item.getItemId()==id){return item;}}return null;}},{key:'findItemIndex',value:function findItemIndex(id){var size=this.size();for(var i=0;i<size;i++){var item=this.mItems.get(i);if(item.getItemId()==id){return i;}}return-1;}},{key:'findGroupIndex',value:function findGroupIndex(group){var start=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var size=this.size();if(start<0){start=0;}for(var i=start;i<size;i++){var item=this.mItems.get(i);if(item.getGroupId()==group){return i;}}return-1;}},{key:'size',value:function size(){return this.mItems.size();}},{key:'getItem',value:function getItem(index){return this.mItems.get(index);}},{key:'onItemsChanged',value:function onItemsChanged(structureChanged){}},{key:'getRootMenu',value:function getRootMenu(){return this;}},{key:'setCallback',value:function setCallback(cb){this.mCallback=cb;}},{key:'dispatchMenuItemSelected',value:function dispatchMenuItemSelected(menu,item){return this.mCallback!=null&&this.mCallback.onMenuItemSelected(menu,item);}},{key:'getVisibleItems',value:function getVisibleItems(){this.mVisibleItems.clear();var itemsSize=this.mItems.size();var item=void 0;for(var i=0;i<itemsSize;i++){item=this.mItems.get(i);if(item.isVisible()){this.mVisibleItems.add(item);}}return this.mVisibleItems;}}]);return Menu;}();view.Menu=Menu;(function(Menu){Menu.USER_MASK=0x0000ffff;Menu.USER_SHIFT=0;Menu.CATEGORY_MASK=0xffff0000;Menu.CATEGORY_SHIFT=16;Menu.NONE=0;Menu.FIRST=1;Menu.CATEGORY_CONTAINER=0x00010000;Menu.CATEGORY_SYSTEM=0x00020000;Menu.CATEGORY_SECONDARY=0x00030000;Menu.CATEGORY_ALTERNATIVE=0x00040000;Menu.FLAG_APPEND_TO_GROUP=0x0001;Menu.FLAG_PERFORM_NO_CLOSE=0x0001;Menu.FLAG_ALWAYS_PERFORM_CLOSE=0x0002;})(Menu=view.Menu||(view.Menu={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var view;(function(view_7){var menu;(function(menu_1){var R=android.R;var ListPopupWindow=android.widget.ListPopupWindow;var KeyEvent=android.view.KeyEvent;var LayoutInflater=android.view.LayoutInflater;var View=android.view.View;var MeasureSpec=android.view.View.MeasureSpec;var BaseAdapter=android.widget.BaseAdapter;var FrameLayout=android.widget.FrameLayout;var PopupWindow=android.widget.PopupWindow;var MenuPopupHelper=function(){function MenuPopupHelper(context,menu){var anchorView=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;_classCallCheck(this,MenuPopupHelper);this.mPopupMaxWidth=0;this.mContext=context;this.mInflater=LayoutInflater.from(context);this.mMenu=menu;var res=context.getResources();this.mPopupMaxWidth=Math.max(res.getDisplayMetrics().widthPixels/2,res.getDisplayMetrics().density*320);this.mAnchorView=anchorView;}_createClass(MenuPopupHelper,[{key:'setAnchorView',value:function setAnchorView(anchor){this.mAnchorView=anchor;}},{key:'show',value:function show(){if(!this.tryShow()){throw Error('new IllegalStateException(\"MenuPopupHelper cannot be used without an anchor\")');}}},{key:'tryShow',value:function tryShow(){this.mPopup=new ListPopupWindow(this.mContext,R.attr.popupMenuStyle);this.mPopup.setOnDismissListener(this);this.mPopup.setOnItemClickListener(this);this.mAdapter=new MenuPopupHelper.MenuAdapter(this.mMenu,this);this.mPopup.setAdapter(this.mAdapter);this.mPopup.setModal(true);var anchor=this.mAnchorView;if(anchor!=null){var addGlobalListener=this.mTreeObserver==null;this.mTreeObserver=anchor.getViewTreeObserver();if(addGlobalListener){this.mTreeObserver.addOnGlobalLayoutListener(this);}this.mPopup.setAnchorView(anchor);}else{return false;}this.mPopup.setContentWidth(Math.min(this.measureContentWidth(this.mAdapter),this.mPopupMaxWidth));this.mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);this.mPopup.show();this.mPopup.getListView().setOnKeyListener(this);return true;}},{key:'dismiss',value:function dismiss(){if(this.isShowing()){this.mPopup.dismiss();}}},{key:'onDismiss',value:function onDismiss(){this.mPopup=null;if(this.mTreeObserver!=null){if(!this.mTreeObserver.isAlive()){this.mTreeObserver=this.mAnchorView.getViewTreeObserver();}this.mTreeObserver.removeGlobalOnLayoutListener(this);this.mTreeObserver=null;}}},{key:'isShowing',value:function isShowing(){return this.mPopup!=null&&this.mPopup.isShowing();}},{key:'onItemClick',value:function onItemClick(parent,view,position,id){var adapter=this.mAdapter;var invoked=adapter.getItem(position).invoke();if(invoked)this.mPopup.dismiss();}},{key:'onKey',value:function onKey(v,keyCode,event){if(event.getAction()==KeyEvent.ACTION_UP&&keyCode==KeyEvent.KEYCODE_MENU){this.dismiss();return true;}return false;}},{key:'measureContentWidth',value:function measureContentWidth(adapter){var width=0;var itemView=null;var itemType=0;var widthMeasureSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);var heightMeasureSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);var count=adapter.getCount();for(var i=0;i<count;i++){var positionType=adapter.getItemViewType(i);if(positionType!=itemType){itemType=positionType;itemView=null;}if(this.mMeasureParent==null){this.mMeasureParent=new FrameLayout(this.mContext);}itemView=adapter.getView(i,itemView,this.mMeasureParent);itemView.measure(widthMeasureSpec,heightMeasureSpec);width=Math.max(width,itemView.getMeasuredWidth());}return width;}},{key:'onGlobalLayout',value:function onGlobalLayout(){if(this.isShowing()){var anchor=this.mAnchorView;if(anchor==null||!anchor.isShown()){this.dismiss();}else if(this.isShowing()){try{this.mPopup.setContentWidth(Math.min(this.measureContentWidth(this.mAdapter),this.mPopupMaxWidth));}catch(e){}this.mPopup.show();}}}}]);return MenuPopupHelper;}();MenuPopupHelper.TAG=\"MenuPopupHelper\";MenuPopupHelper.ITEM_LAYOUT=R.layout.popup_menu_item_layout;menu_1.MenuPopupHelper=MenuPopupHelper;(function(MenuPopupHelper){var MenuAdapter=function(_BaseAdapter3){_inherits(MenuAdapter,_BaseAdapter3);function MenuAdapter(menu,arg){_classCallCheck(this,MenuAdapter);var _this168=_possibleConstructorReturn(this,(MenuAdapter.__proto__||Object.getPrototypeOf(MenuAdapter)).call(this));_this168._MenuPopupHelper_this=arg;_this168.mAdapterMenu=menu;return _this168;}_createClass(MenuAdapter,[{key:'getCount',value:function getCount(){var items=this.mAdapterMenu.getVisibleItems();return items.size();}},{key:'getItem',value:function getItem(position){var items=this.mAdapterMenu.getVisibleItems();return items.get(position);}},{key:'getItemId',value:function getItemId(position){return position;}},{key:'getView',value:function getView(position,convertView,parent){if(convertView==null){convertView=this._MenuPopupHelper_this.mInflater.inflate(MenuPopupHelper.ITEM_LAYOUT,parent,false);}var itemData=this.getItem(position);convertView.setVisibility(itemData.isVisible()?View.VISIBLE:View.GONE);var titleView=convertView.findViewById('title');titleView.setText(itemData.getTitle());var iconView=convertView.findViewById('icon');var icon=itemData.getIcon();iconView.setImageDrawable(icon);if(icon!=null){iconView.setImageDrawable(icon);iconView.setVisibility(View.VISIBLE);}else{iconView.setVisibility(View.GONE);}convertView.setEnabled(itemData.isEnabled());return convertView;}},{key:'notifyDataSetChanged',value:function notifyDataSetChanged(){_get2(MenuAdapter.prototype.__proto__||Object.getPrototypeOf(MenuAdapter.prototype),'notifyDataSetChanged',this).call(this);}}]);return MenuAdapter;}(BaseAdapter);MenuPopupHelper.MenuAdapter=MenuAdapter;})(MenuPopupHelper=menu_1.MenuPopupHelper||(menu_1.MenuPopupHelper={}));})(menu=view_7.menu||(view_7.menu={}));})(view=android.view||(android.view={}));})(android||(android={}));var android;(function(android){var support;(function(support){var v4;(function(v4){var view;(function(view_8){var DataSetObservable=android.database.DataSetObservable;var PagerAdapter=function(){function PagerAdapter(){_classCallCheck(this,PagerAdapter);this.mObservable=new DataSetObservable();}_createClass(PagerAdapter,[{key:'startUpdate',value:function startUpdate(container){}},{key:'instantiateItem',value:function instantiateItem(container,position){throw new Error(\"Required method instantiateItem was not overridden\");}},{key:'destroyItem',value:function destroyItem(container,position,object){throw new Error(\"Required method destroyItem was not overridden\");}},{key:'setPrimaryItem',value:function setPrimaryItem(container,position,object){}},{key:'finishUpdate',value:function finishUpdate(container){}},{key:'getItemPosition',value:function getItemPosition(object){return PagerAdapter.POSITION_UNCHANGED;}},{key:'notifyDataSetChanged',value:function notifyDataSetChanged(){this.mObservable.notifyChanged();}},{key:'registerDataSetObserver',value:function registerDataSetObserver(observer){this.mObservable.registerObserver(observer);}},{key:'unregisterDataSetObserver',value:function unregisterDataSetObserver(observer){this.mObservable.unregisterObserver(observer);}},{key:'getPageTitle',value:function getPageTitle(position){return null;}},{key:'getPageWidth',value:function getPageWidth(position){return 1;}}]);return PagerAdapter;}();PagerAdapter.POSITION_UNCHANGED=-1;PagerAdapter.POSITION_NONE=-2;view_8.PagerAdapter=PagerAdapter;})(view=v4.view||(v4.view={}));})(v4=support.v4||(support.v4={}));})(support=android.support||(android.support={}));})(android||(android={}));var android;(function(android){var support;(function(support){var v4;(function(v4){var view;(function(view_9){var View=android.view.View;var Gravity=android.view.Gravity;var MeasureSpec=View.MeasureSpec;var OverScroller=android.widget.OverScroller;var ViewGroup=android.view.ViewGroup;var ArrayList=java.util.ArrayList;var Rect=android.graphics.Rect;var PagerAdapter=android.support.v4.view.PagerAdapter;var DataSetObserver=android.database.DataSetObserver;var VelocityTracker=android.view.VelocityTracker;var ViewConfiguration=android.view.ViewConfiguration;var Resources=android.content.res.Resources;var Log=android.util.Log;var MotionEvent=android.view.MotionEvent;var KeyEvent=android.view.KeyEvent;var TAG=\"ViewPager\";var DEBUG=false;var SymbolDecor=Symbol();var ViewPager=function(_ViewGroup5){_inherits(ViewPager,_ViewGroup5);function ViewPager(context,bindElement,defStyle){_classCallCheck(this,ViewPager);var _this169=_possibleConstructorReturn(this,(ViewPager.__proto__||Object.getPrototypeOf(ViewPager)).call(this,context,bindElement,defStyle));_this169.mExpectedAdapterCount=0;_this169.mItems=new ArrayList();_this169.mTempItem=new ItemInfo();_this169.mTempRect=new Rect();_this169.mCurItem=0;_this169.mRestoredCurItem=-1;_this169.mPageMargin=0;_this169.mTopPageBounds=0;_this169.mBottomPageBounds=0;_this169.mFirstOffset=-Number.MAX_VALUE;_this169.mLastOffset=Number.MAX_VALUE;_this169.mChildWidthMeasureSpec=0;_this169.mChildHeightMeasureSpec=0;_this169.mInLayout=false;_this169.mScrollingCacheEnabled=false;_this169.mPopulatePending=false;_this169.mOffscreenPageLimit=ViewPager.DEFAULT_OFFSCREEN_PAGES;_this169.mIsBeingDragged=false;_this169.mIsUnableToDrag=false;_this169.mDefaultGutterSize=0;_this169.mGutterSize=0;_this169.mLastMotionX=0;_this169.mLastMotionY=0;_this169.mInitialMotionX=0;_this169.mInitialMotionY=0;_this169.mActivePointerId=ViewPager.INVALID_POINTER;_this169.mMinimumVelocity=0;_this169.mMaximumVelocity=0;_this169.mFlingDistance=0;_this169.mCloseEnough=0;_this169.mFakeDragging=false;_this169.mFakeDragBeginTime=0;_this169.mFirstLayout=true;_this169.mNeedCalculatePageOffsets=false;_this169.mCalledSuper=false;_this169.mDecorChildCount=0;_this169.mDrawingOrder=0;_this169.mEndScrollRunnable=function(){var ViewPager_this=_this169;var InnerClass=function(){function InnerClass(){_classCallCheck(this,InnerClass);}_createClass(InnerClass,[{key:'run',value:function run(){ViewPager_this.setScrollState(ViewPager.SCROLL_STATE_IDLE);ViewPager_this.populate();}}]);return InnerClass;}();return new InnerClass();}();_this169.mScrollState=ViewPager.SCROLL_STATE_IDLE;_this169.initViewPager();return _this169;}_createClass(ViewPager,[{key:'initViewPager',value:function initViewPager(){this.setWillNotDraw(false);this.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);this.setFocusable(true);this.mScroller=new OverScroller(ViewPager.sInterpolator);var density=Resources.getDisplayMetrics().density;this.mTouchSlop=ViewConfiguration.get().getScaledPagingTouchSlop();this.mMinimumVelocity=Math.floor(ViewPager.MIN_FLING_VELOCITY*density);this.mMaximumVelocity=ViewConfiguration.get().getScaledMaximumFlingVelocity();this.mFlingDistance=Math.floor(ViewPager.MIN_DISTANCE_FOR_FLING*density);this.mCloseEnough=Math.floor(ViewPager.CLOSE_ENOUGH*density);this.mDefaultGutterSize=Math.floor(ViewPager.DEFAULT_GUTTER_SIZE*density);}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){this.removeCallbacks(this.mEndScrollRunnable);_get2(ViewPager.prototype.__proto__||Object.getPrototypeOf(ViewPager.prototype),'onDetachedFromWindow',this).call(this);}},{key:'setScrollState',value:function setScrollState(newState){if(this.mScrollState==newState){return;}this.mScrollState=newState;if(this.mPageTransformer!=null){this.enableLayers(newState!=ViewPager.SCROLL_STATE_IDLE);}this.dispatchOnScrollStateChanged(newState);}},{key:'setAdapter',value:function setAdapter(adapter){if(this.mAdapter!=null){this.mAdapter.unregisterDataSetObserver(this.mObserver);this.mAdapter.startUpdate(this);for(var i=0;i<this.mItems.size();i++){var ii=this.mItems.get(i);this.mAdapter.destroyItem(this,ii.position,ii.object);}this.mAdapter.finishUpdate(this);this.mItems.clear();this.removeNonDecorViews();this.mCurItem=0;this.scrollTo(0,0);}var oldAdapter=this.mAdapter;this.mAdapter=adapter;this.mExpectedAdapterCount=0;if(this.mAdapter!=null){if(this.mObserver==null){this.mObserver=new PagerObserver(this);}this.mAdapter.registerDataSetObserver(this.mObserver);this.mPopulatePending=false;var wasFirstLayout=this.mFirstLayout;this.mFirstLayout=true;this.mExpectedAdapterCount=this.mAdapter.getCount();if(this.mRestoredCurItem>=0){this.setCurrentItemInternal(this.mRestoredCurItem,false,true);this.mRestoredCurItem=-1;}else if(!wasFirstLayout){this.populate();}else{this.requestLayout();}}if(this.mAdapterChangeListener!=null&&oldAdapter!=adapter){this.mAdapterChangeListener.onAdapterChanged(oldAdapter,adapter);}}},{key:'removeNonDecorViews',value:function removeNonDecorViews(){for(var i=0;i<this.getChildCount();i++){var child=this.getChildAt(i);var lp=child.getLayoutParams();if(!lp.isDecor){this.removeViewAt(i);i--;}}}},{key:'getAdapter',value:function getAdapter(){return this.mAdapter;}},{key:'setOnAdapterChangeListener',value:function setOnAdapterChangeListener(listener){this.mAdapterChangeListener=listener;}},{key:'getClientWidth',value:function getClientWidth(){return this.getMeasuredWidth()-this.getPaddingLeft()-this.getPaddingRight();}},{key:'setCurrentItem',value:function setCurrentItem(item){var smoothScroll=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!this.mFirstLayout;this.mPopulatePending=false;this.setCurrentItemInternal(item,smoothScroll,false);}},{key:'getCurrentItem',value:function getCurrentItem(){return this.mCurItem;}},{key:'setCurrentItemInternal',value:function setCurrentItemInternal(item,smoothScroll,always){var velocity=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;if(this.mAdapter==null||this.mAdapter.getCount()<=0){this.setScrollingCacheEnabled(false);return;}if(!always&&this.mCurItem==item&&this.mItems.size()!=0){this.setScrollingCacheEnabled(false);return;}if(item<0){item=0;}else if(item>=this.mAdapter.getCount()){item=this.mAdapter.getCount()-1;}var pageLimit=this.mOffscreenPageLimit;if(item>this.mCurItem+pageLimit||item<this.mCurItem-pageLimit){for(var i=0;i<this.mItems.size();i++){this.mItems.get(i).scrolling=true;}}var dispatchSelected=this.mCurItem!=item;if(this.mFirstLayout){this.mCurItem=item;if(dispatchSelected){this.dispatchOnPageSelected(item);}this.requestLayout();}else{this.populate(item);this.scrollToItem(item,smoothScroll,velocity,dispatchSelected);}}},{key:'scrollToItem',value:function scrollToItem(item,smoothScroll,velocity,dispatchSelected){var curInfo=this.infoForPosition(item);var destX=0;if(curInfo!=null){var width=this.getClientWidth();destX=Math.floor(width*Math.max(this.mFirstOffset,Math.min(curInfo.offset,this.mLastOffset)));}if(smoothScroll){this.smoothScrollTo(destX,0,velocity);if(dispatchSelected){this.dispatchOnPageSelected(item);}}else{if(dispatchSelected){this.dispatchOnPageSelected(item);}this.completeScroll(false);this.scrollTo(destX,0);this.pageScrolled(destX);}}},{key:'setOnPageChangeListener',value:function setOnPageChangeListener(listener){this.mOnPageChangeListener=listener;}},{key:'addOnPageChangeListener',value:function addOnPageChangeListener(listener){if(this.mOnPageChangeListeners==null){this.mOnPageChangeListeners=new ArrayList();}this.mOnPageChangeListeners.add(listener);}},{key:'removeOnPageChangeListener',value:function removeOnPageChangeListener(listener){if(this.mOnPageChangeListeners!=null){this.mOnPageChangeListeners.remove(listener);}}},{key:'clearOnPageChangeListeners',value:function clearOnPageChangeListeners(){if(this.mOnPageChangeListeners!=null){this.mOnPageChangeListeners.clear();}}},{key:'setPageTransformer',value:function setPageTransformer(reverseDrawingOrder,transformer){var hasTransformer=transformer!=null;var needsPopulate=hasTransformer!=(this.mPageTransformer!=null);this.mPageTransformer=transformer;this.setChildrenDrawingOrderEnabledCompat(hasTransformer);if(hasTransformer){this.mDrawingOrder=reverseDrawingOrder?ViewPager.DRAW_ORDER_REVERSE:ViewPager.DRAW_ORDER_FORWARD;}else{this.mDrawingOrder=ViewPager.DRAW_ORDER_DEFAULT;}if(needsPopulate)this.populate();}},{key:'setChildrenDrawingOrderEnabledCompat',value:function setChildrenDrawingOrderEnabledCompat(){var enable=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;this.setChildrenDrawingOrderEnabled(enable);}},{key:'getChildDrawingOrder',value:function getChildDrawingOrder(childCount,i){var index=this.mDrawingOrder==ViewPager.DRAW_ORDER_REVERSE?childCount-1-i:i;var result=this.mDrawingOrderedChildren.get(index).getLayoutParams().childIndex;return result;}},{key:'setInternalPageChangeListener',value:function setInternalPageChangeListener(listener){var oldListener=this.mInternalPageChangeListener;this.mInternalPageChangeListener=listener;return oldListener;}},{key:'getOffscreenPageLimit',value:function getOffscreenPageLimit(){return this.mOffscreenPageLimit;}},{key:'setOffscreenPageLimit',value:function setOffscreenPageLimit(limit){if(limit<ViewPager.DEFAULT_OFFSCREEN_PAGES){Log.w(TAG,\"Requested offscreen page limit \"+limit+\" too small; defaulting to \"+ViewPager.DEFAULT_OFFSCREEN_PAGES);limit=ViewPager.DEFAULT_OFFSCREEN_PAGES;}if(limit!=this.mOffscreenPageLimit){this.mOffscreenPageLimit=limit;this.populate();}}},{key:'setPageMargin',value:function setPageMargin(marginPixels){var oldMargin=this.mPageMargin;this.mPageMargin=marginPixels;var width=this.getWidth();this.recomputeScrollPosition(width,width,marginPixels,oldMargin);this.requestLayout();}},{key:'getPageMargin',value:function getPageMargin(){return this.mPageMargin;}},{key:'setPageMarginDrawable',value:function setPageMarginDrawable(d){this.mMarginDrawable=d;if(d!=null)this.refreshDrawableState();this.setWillNotDraw(d==null);this.invalidate();}},{key:'verifyDrawable',value:function verifyDrawable(who){return _get2(ViewPager.prototype.__proto__||Object.getPrototypeOf(ViewPager.prototype),'verifyDrawable',this).call(this,who)||who==this.mMarginDrawable;}},{key:'drawableStateChanged',value:function drawableStateChanged(){_get2(ViewPager.prototype.__proto__||Object.getPrototypeOf(ViewPager.prototype),'drawableStateChanged',this).call(this);var d=this.mMarginDrawable;if(d!=null&&d.isStateful()){d.setState(this.getDrawableState());}}},{key:'distanceInfluenceForSnapDuration',value:function distanceInfluenceForSnapDuration(f){f-=0.5;f*=0.3*Math.PI/2.0;return Math.sin(f);}},{key:'smoothScrollTo',value:function smoothScrollTo(x,y){var velocity=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;if(this.getChildCount()==0){this.setScrollingCacheEnabled(false);return;}var sx=this.getScrollX();var sy=this.getScrollY();var dx=x-sx;var dy=y-sy;if(dx==0&&dy==0){this.completeScroll(false);this.populate();this.setScrollState(ViewPager.SCROLL_STATE_IDLE);return;}this.setScrollingCacheEnabled(true);this.setScrollState(ViewPager.SCROLL_STATE_SETTLING);var width=this.getClientWidth();var halfWidth=width/2;var distanceRatio=Math.min(1,1.0*Math.abs(dx)/width);var distance=halfWidth+halfWidth*this.distanceInfluenceForSnapDuration(distanceRatio);var duration=0;velocity=Math.abs(velocity);if(velocity>0){duration=4*Math.round(1000*Math.abs(distance/velocity));}else{var pageWidth=width*this.mAdapter.getPageWidth(this.mCurItem);var pageDelta=Math.abs(dx)/(pageWidth+this.mPageMargin);duration=Math.floor((pageDelta+1)*100);}duration=Math.min(duration,ViewPager.MAX_SETTLE_DURATION);this.mScroller.startScroll(sx,sy,dx,dy,duration);this.postInvalidateOnAnimation();}},{key:'addNewItem',value:function addNewItem(position,index){var ii=new ItemInfo();ii.position=position;ii.object=this.mAdapter.instantiateItem(this,position);ii.widthFactor=this.mAdapter.getPageWidth(position);if(index<0||index>=this.mItems.size()){this.mItems.add(ii);}else{this.mItems.add(index,ii);}return ii;}},{key:'dataSetChanged',value:function dataSetChanged(){var adapterCount=this.mAdapter.getCount();this.mExpectedAdapterCount=adapterCount;var needPopulate=this.mItems.size()<this.mOffscreenPageLimit*2+1&&this.mItems.size()<adapterCount;var newCurrItem=this.mCurItem;var isUpdating=false;for(var i=0;i<this.mItems.size();i++){var ii=this.mItems.get(i);var newPos=this.mAdapter.getItemPosition(ii.object);if(newPos==PagerAdapter.POSITION_UNCHANGED){continue;}if(newPos==PagerAdapter.POSITION_NONE){this.mItems.remove(i);i--;if(!isUpdating){this.mAdapter.startUpdate(this);isUpdating=true;}this.mAdapter.destroyItem(this,ii.position,ii.object);needPopulate=true;if(this.mCurItem==ii.position){newCurrItem=Math.max(0,Math.min(this.mCurItem,adapterCount-1));needPopulate=true;}continue;}if(ii.position!=newPos){if(ii.position==this.mCurItem){newCurrItem=newPos;}ii.position=newPos;needPopulate=true;}}if(isUpdating){this.mAdapter.finishUpdate(this);}this.mItems.sort(ViewPager.COMPARATOR);if(needPopulate){var childCount=this.getChildCount();for(var _i61=0;_i61<childCount;_i61++){var child=this.getChildAt(_i61);var lp=child.getLayoutParams();if(!lp.isDecor){lp.widthFactor=0;}}this.setCurrentItemInternal(newCurrItem,false,true);this.requestLayout();}}},{key:'populate',value:function populate(){var newCurrentItem=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.mCurItem;var oldCurInfo=null;var focusDirection=View.FOCUS_FORWARD;if(this.mCurItem!=newCurrentItem){focusDirection=this.mCurItem<newCurrentItem?View.FOCUS_RIGHT:View.FOCUS_LEFT;oldCurInfo=this.infoForPosition(this.mCurItem);this.mCurItem=newCurrentItem;}if(this.mAdapter==null){this.sortChildDrawingOrder();return;}if(this.mPopulatePending){if(DEBUG)Log.i(TAG,\"populate is pending, skipping for now...\");this.sortChildDrawingOrder();return;}if(!this.isAttachedToWindow()){return;}this.mAdapter.startUpdate(this);var pageLimit=this.mOffscreenPageLimit;var startPos=Math.max(0,this.mCurItem-pageLimit);var N=this.mAdapter.getCount();var endPos=Math.min(N-1,this.mCurItem+pageLimit);if(N!=this.mExpectedAdapterCount){throw new Error(\"The application's PagerAdapter changed the adapter's\"+\" contents without calling PagerAdapter#notifyDataSetChanged!\"+\" Expected adapter item count: \"+this.mExpectedAdapterCount+\", found: \"+N+\" Pager id: \"+this.getId()+\" Pager class: \"+this.constructor.name+\" Problematic adapter: \"+this.mAdapter.constructor.name);}var curIndex=-1;var curItem=null;for(curIndex=0;curIndex<this.mItems.size();curIndex++){var ii=this.mItems.get(curIndex);if(ii.position>=this.mCurItem){if(ii.position==this.mCurItem)curItem=ii;break;}}if(curItem==null&&N>0){curItem=this.addNewItem(this.mCurItem,curIndex);}if(curItem!=null){var extraWidthLeft=0;var itemIndex=curIndex-1;var _ii=itemIndex>=0?this.mItems.get(itemIndex):null;var clientWidth=this.getClientWidth();var leftWidthNeeded=clientWidth<=0?0:2-curItem.widthFactor+this.getPaddingLeft()/clientWidth;for(var pos=this.mCurItem-1;pos>=0;pos--){if(extraWidthLeft>=leftWidthNeeded&&pos<startPos){if(_ii==null){break;}if(pos==_ii.position&&!_ii.scrolling){this.mItems.remove(itemIndex);this.mAdapter.destroyItem(this,pos,_ii.object);if(DEBUG){Log.i(TAG,\"populate() - destroyItem() with pos: \"+pos+\" view: \"+_ii.object);}itemIndex--;curIndex--;_ii=itemIndex>=0?this.mItems.get(itemIndex):null;}}else if(_ii!=null&&pos==_ii.position){extraWidthLeft+=_ii.widthFactor;itemIndex--;_ii=itemIndex>=0?this.mItems.get(itemIndex):null;}else{_ii=this.addNewItem(pos,itemIndex+1);extraWidthLeft+=_ii.widthFactor;curIndex++;_ii=itemIndex>=0?this.mItems.get(itemIndex):null;}}var extraWidthRight=curItem.widthFactor;itemIndex=curIndex+1;if(extraWidthRight<2){_ii=itemIndex<this.mItems.size()?this.mItems.get(itemIndex):null;var rightWidthNeeded=clientWidth<=0?0:this.getPaddingRight()/clientWidth+2;for(var _pos2=this.mCurItem+1;_pos2<N;_pos2++){if(extraWidthRight>=rightWidthNeeded&&_pos2>endPos){if(_ii==null){break;}if(_pos2==_ii.position&&!_ii.scrolling){this.mItems.remove(itemIndex);this.mAdapter.destroyItem(this,_pos2,_ii.object);if(DEBUG){Log.i(TAG,\"populate() - destroyItem() with pos: \"+_pos2+\" view: \"+_ii.object);}_ii=itemIndex<this.mItems.size()?this.mItems.get(itemIndex):null;}}else if(_ii!=null&&_pos2==_ii.position){extraWidthRight+=_ii.widthFactor;itemIndex++;_ii=itemIndex<this.mItems.size()?this.mItems.get(itemIndex):null;}else{_ii=this.addNewItem(_pos2,itemIndex);itemIndex++;extraWidthRight+=_ii.widthFactor;_ii=itemIndex<this.mItems.size()?this.mItems.get(itemIndex):null;}}}this.calculatePageOffsets(curItem,curIndex,oldCurInfo);}if(DEBUG){Log.i(TAG,\"Current page list:\");for(var i=0;i<this.mItems.size();i++){Log.i(TAG,\"#\"+i+\": page \"+this.mItems.get(i).position);}}this.mAdapter.setPrimaryItem(this,this.mCurItem,curItem!=null?curItem.object:null);this.mAdapter.finishUpdate(this);var childCount=this.getChildCount();for(var _i62=0;_i62<childCount;_i62++){var child=this.getChildAt(_i62);var lp=child.getLayoutParams();lp.childIndex=_i62;if(!lp.isDecor&&lp.widthFactor==0){var _ii2=this.infoForChild(child);if(_ii2!=null){lp.widthFactor=_ii2.widthFactor;lp.position=_ii2.position;}}}this.sortChildDrawingOrder();if(this.hasFocus()){var currentFocused=this.findFocus();var _ii3=currentFocused!=null?this.infoForAnyChild(currentFocused):null;if(_ii3==null||_ii3.position!=this.mCurItem){for(var _i63=0;_i63<this.getChildCount();_i63++){var _child22=this.getChildAt(_i63);_ii3=this.infoForChild(_child22);if(_ii3!=null&&_ii3.position==this.mCurItem){if(_child22.requestFocus(focusDirection)){break;}}}}}}},{key:'sortChildDrawingOrder',value:function sortChildDrawingOrder(){if(this.mDrawingOrder!=ViewPager.DRAW_ORDER_DEFAULT){if(this.mDrawingOrderedChildren==null){this.mDrawingOrderedChildren=new ArrayList();}else{this.mDrawingOrderedChildren.clear();}var childCount=this.getChildCount();for(var i=0;i<childCount;i++){var child=this.getChildAt(i);this.mDrawingOrderedChildren.add(child);}this.mDrawingOrderedChildren.sort(ViewPager.sPositionComparator);}}},{key:'calculatePageOffsets',value:function calculatePageOffsets(curItem,curIndex,oldCurInfo){var N=this.mAdapter.getCount();var width=this.getClientWidth();var marginOffset=width>0?this.mPageMargin/width:0;if(oldCurInfo!=null){var oldCurPosition=oldCurInfo.position;if(oldCurPosition<curItem.position){var itemIndex=0;var ii=null;var _offset3=oldCurInfo.offset+oldCurInfo.widthFactor+marginOffset;for(var _pos3=oldCurPosition+1;_pos3<=curItem.position&&itemIndex<this.mItems.size();_pos3++){ii=this.mItems.get(itemIndex);while(_pos3>ii.position&&itemIndex<this.mItems.size()-1){itemIndex++;ii=this.mItems.get(itemIndex);}while(_pos3<ii.position){_offset3+=this.mAdapter.getPageWidth(_pos3)+marginOffset;_pos3++;}ii.offset=_offset3;_offset3+=ii.widthFactor+marginOffset;}}else if(oldCurPosition>curItem.position){var _itemIndex2=this.mItems.size()-1;var _ii4=null;var _offset4=oldCurInfo.offset;for(var _pos4=oldCurPosition-1;_pos4>=curItem.position&&_itemIndex2>=0;_pos4--){_ii4=this.mItems.get(_itemIndex2);while(_pos4<_ii4.position&&_itemIndex2>0){_itemIndex2--;_ii4=this.mItems.get(_itemIndex2);}while(_pos4>_ii4.position){_offset4-=this.mAdapter.getPageWidth(_pos4)+marginOffset;_pos4--;}_offset4-=_ii4.widthFactor+marginOffset;_ii4.offset=_offset4;}}}var itemCount=this.mItems.size();var offset=curItem.offset;var pos=curItem.position-1;this.mFirstOffset=curItem.position==0?curItem.offset:-Number.MAX_VALUE;this.mLastOffset=curItem.position==N-1?curItem.offset+curItem.widthFactor-1:Number.MAX_VALUE;for(var i=curIndex-1;i>=0;i--,pos--){var _ii5=this.mItems.get(i);while(pos>_ii5.position){offset-=this.mAdapter.getPageWidth(pos--)+marginOffset;}offset-=_ii5.widthFactor+marginOffset;_ii5.offset=offset;if(_ii5.position==0)this.mFirstOffset=offset;}offset=curItem.offset+curItem.widthFactor+marginOffset;pos=curItem.position+1;for(var _i64=curIndex+1;_i64<itemCount;_i64++,pos++){var _ii6=this.mItems.get(_i64);while(pos<_ii6.position){offset+=this.mAdapter.getPageWidth(pos++)+marginOffset;}if(_ii6.position==N-1){this.mLastOffset=offset+_ii6.widthFactor-1;}_ii6.offset=offset;offset+=_ii6.widthFactor+marginOffset;}this.mNeedCalculatePageOffsets=false;}},{key:'addView',value:function addView(){for(var _len33=arguments.length,args=Array(_len33),_key34=0;_key34<_len33;_key34++){args[_key34]=arguments[_key34];}if(args.length===3&&args[2]instanceof ViewGroup.LayoutParams){this._addViewOverride(args[0],args[1],args[2]);}else{var _get7;(_get7=_get2(ViewPager.prototype.__proto__||Object.getPrototypeOf(ViewPager.prototype),'addView',this)).call.apply(_get7,[this].concat(args));}}},{key:'_addViewOverride',value:function _addViewOverride(child,index,params){if(!this.checkLayoutParams(params)){params=this.generateLayoutParams(params);}var lp=params;lp.isDecor=lp.isDecor||ViewPager.isImplDecor(child);if(this.mInLayout){if(lp!=null&&lp.isDecor){throw new Error(\"Cannot add pager decor view during layout\");}lp.needsMeasure=true;this.addViewInLayout(child,index,params);}else{_get2(ViewPager.prototype.__proto__||Object.getPrototypeOf(ViewPager.prototype),'addView',this).call(this,child,index,params);}if(ViewPager.USE_CACHE){if(child.getVisibility()!=View.GONE){child.setDrawingCacheEnabled(this.mScrollingCacheEnabled);}else{child.setDrawingCacheEnabled(false);}}}},{key:'removeView',value:function removeView(view){if(this.mInLayout){this.removeViewInLayout(view);}else{_get2(ViewPager.prototype.__proto__||Object.getPrototypeOf(ViewPager.prototype),'removeView',this).call(this,view);}}},{key:'infoForChild',value:function infoForChild(child){for(var i=0;i<this.mItems.size();i++){var ii=this.mItems.get(i);if(this.mAdapter.isViewFromObject(child,ii.object)){return ii;}}return null;}},{key:'infoForAnyChild',value:function infoForAnyChild(child){var parent=void 0;while((parent=child.getParent())!=this){if(parent==null||!(parent instanceof View)){return null;}child=parent;}return this.infoForChild(child);}},{key:'infoForPosition',value:function infoForPosition(position){for(var i=0;i<this.mItems.size();i++){var ii=this.mItems.get(i);if(ii.position==position){return ii;}}return null;}},{key:'onAttachedToWindow',value:function onAttachedToWindow(){_get2(ViewPager.prototype.__proto__||Object.getPrototypeOf(ViewPager.prototype),'onAttachedToWindow',this).call(this);this.mFirstLayout=true;}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){this.setMeasuredDimension(ViewPager.getDefaultSize(0,widthMeasureSpec),ViewPager.getDefaultSize(0,heightMeasureSpec));var measuredWidth=this.getMeasuredWidth();var maxGutterSize=measuredWidth/10;this.mGutterSize=Math.min(maxGutterSize,this.mDefaultGutterSize);var childWidthSize=measuredWidth-this.getPaddingLeft()-this.getPaddingRight();var childHeightSize=this.getMeasuredHeight()-this.getPaddingTop()-this.getPaddingBottom();var size=this.getChildCount();for(var i=0;i<size;++i){var child=this.getChildAt(i);if(child.getVisibility()!=View.GONE){var lp=child.getLayoutParams();if(lp!=null&&lp.isDecor){var hgrav=lp.gravity&Gravity.HORIZONTAL_GRAVITY_MASK;var vgrav=lp.gravity&Gravity.VERTICAL_GRAVITY_MASK;var widthMode=MeasureSpec.AT_MOST;var heightMode=MeasureSpec.AT_MOST;var consumeVertical=vgrav==Gravity.TOP||vgrav==Gravity.BOTTOM;var consumeHorizontal=hgrav==Gravity.LEFT||hgrav==Gravity.RIGHT;if(consumeVertical){widthMode=MeasureSpec.EXACTLY;}else if(consumeHorizontal){heightMode=MeasureSpec.EXACTLY;}var widthSize=childWidthSize;var heightSize=childHeightSize;if(lp.width!=ViewPager.LayoutParams.WRAP_CONTENT){widthMode=MeasureSpec.EXACTLY;if(lp.width!=ViewPager.LayoutParams.FILL_PARENT){widthSize=lp.width;}}if(lp.height!=ViewPager.LayoutParams.WRAP_CONTENT){heightMode=MeasureSpec.EXACTLY;if(lp.height!=ViewPager.LayoutParams.FILL_PARENT){heightSize=lp.height;}}var widthSpec=MeasureSpec.makeMeasureSpec(widthSize,widthMode);var heightSpec=MeasureSpec.makeMeasureSpec(heightSize,heightMode);child.measure(widthSpec,heightSpec);if(consumeVertical){childHeightSize-=child.getMeasuredHeight();}else if(consumeHorizontal){childWidthSize-=child.getMeasuredWidth();}}}}this.mChildWidthMeasureSpec=MeasureSpec.makeMeasureSpec(childWidthSize,MeasureSpec.EXACTLY);this.mChildHeightMeasureSpec=MeasureSpec.makeMeasureSpec(childHeightSize,MeasureSpec.EXACTLY);this.mInLayout=true;this.populate();this.mInLayout=false;size=this.getChildCount();for(var _i65=0;_i65<size;++_i65){var _child23=this.getChildAt(_i65);if(_child23.getVisibility()!=View.GONE){if(DEBUG)Log.v(TAG,\"Measuring #\"+_i65+\" \"+_child23+\": \"+this.mChildWidthMeasureSpec);var _lp10=_child23.getLayoutParams();if(_lp10==null||!_lp10.isDecor){var _widthSpec=MeasureSpec.makeMeasureSpec(childWidthSize*_lp10.widthFactor,MeasureSpec.EXACTLY);_child23.measure(_widthSpec,this.mChildHeightMeasureSpec);}}}}},{key:'onSizeChanged',value:function onSizeChanged(w,h,oldw,oldh){_get2(ViewPager.prototype.__proto__||Object.getPrototypeOf(ViewPager.prototype),'onSizeChanged',this).call(this,w,h,oldw,oldh);if(w!=oldw){this.recomputeScrollPosition(w,oldw,this.mPageMargin,this.mPageMargin);}}},{key:'recomputeScrollPosition',value:function recomputeScrollPosition(width,oldWidth,margin,oldMargin){if(oldWidth>0&&!this.mItems.isEmpty()){var widthWithMargin=width-this.getPaddingLeft()-this.getPaddingRight()+margin;var oldWidthWithMargin=oldWidth-this.getPaddingLeft()-this.getPaddingRight()+oldMargin;var xpos=this.getScrollX();var pageOffset=xpos/oldWidthWithMargin;var newOffsetPixels=Math.floor(pageOffset*widthWithMargin);this.scrollTo(newOffsetPixels,this.getScrollY());if(!this.mScroller.isFinished()){var newDuration=this.mScroller.getDuration()-this.mScroller.timePassed();var targetInfo=this.infoForPosition(this.mCurItem);this.mScroller.startScroll(newOffsetPixels,0,Math.floor(targetInfo.offset*width),0,newDuration);}}else{var ii=this.infoForPosition(this.mCurItem);var scrollOffset=ii!=null?Math.min(ii.offset,this.mLastOffset):0;var scrollPos=Math.floor(scrollOffset*(width-this.getPaddingLeft()-this.getPaddingRight()));if(scrollPos!=this.getScrollX()){this.completeScroll(false);this.scrollTo(scrollPos,this.getScrollY());}}}},{key:'onLayout',value:function onLayout(changed,l,t,r,b){var count=this.getChildCount();var width=r-l;var height=b-t;var paddingLeft=this.getPaddingLeft();var paddingTop=this.getPaddingTop();var paddingRight=this.getPaddingRight();var paddingBottom=this.getPaddingBottom();var scrollX=this.getScrollX();var decorCount=0;for(var i=0;i<count;i++){var child=this.getChildAt(i);if(child.getVisibility()!=View.GONE){var lp=child.getLayoutParams();var childLeft=0;var childTop=0;if(lp.isDecor){var hgrav=lp.gravity&Gravity.HORIZONTAL_GRAVITY_MASK;var vgrav=lp.gravity&Gravity.VERTICAL_GRAVITY_MASK;switch(hgrav){default:childLeft=paddingLeft;break;case Gravity.LEFT:childLeft=paddingLeft;paddingLeft+=child.getMeasuredWidth();break;case Gravity.CENTER_HORIZONTAL:childLeft=Math.max((width-child.getMeasuredWidth())/2,paddingLeft);break;case Gravity.RIGHT:childLeft=width-paddingRight-child.getMeasuredWidth();paddingRight+=child.getMeasuredWidth();break;}switch(vgrav){default:childTop=paddingTop;break;case Gravity.TOP:childTop=paddingTop;paddingTop+=child.getMeasuredHeight();break;case Gravity.CENTER_VERTICAL:childTop=Math.max((height-child.getMeasuredHeight())/2,paddingTop);break;case Gravity.BOTTOM:childTop=height-paddingBottom-child.getMeasuredHeight();paddingBottom+=child.getMeasuredHeight();break;}childLeft+=scrollX;child.layout(childLeft,childTop,childLeft+child.getMeasuredWidth(),childTop+child.getMeasuredHeight());decorCount++;}}}var childWidth=width-paddingLeft-paddingRight;for(var _i66=0;_i66<count;_i66++){var _child24=this.getChildAt(_i66);if(_child24.getVisibility()!=View.GONE){var _lp11=_child24.getLayoutParams();var ii=void 0;if(!_lp11.isDecor&&(ii=this.infoForChild(_child24))!=null){var loff=Math.floor(childWidth*ii.offset);var _childLeft=paddingLeft+loff;var _childTop=paddingTop;if(_lp11.needsMeasure){_lp11.needsMeasure=false;var widthSpec=MeasureSpec.makeMeasureSpec(Math.floor(childWidth*_lp11.widthFactor),MeasureSpec.EXACTLY);var heightSpec=MeasureSpec.makeMeasureSpec(Math.floor(height-paddingTop-paddingBottom),MeasureSpec.EXACTLY);_child24.measure(widthSpec,heightSpec);}if(DEBUG)Log.v(TAG,\"Positioning #\"+_i66+\" \"+_child24+\" f=\"+ii.object+\":\"+_childLeft+\",\"+_childTop+\" \"+_child24.getMeasuredWidth()+\"x\"+_child24.getMeasuredHeight());_child24.layout(_childLeft,_childTop,_childLeft+_child24.getMeasuredWidth(),_childTop+_child24.getMeasuredHeight());}}}this.mTopPageBounds=paddingTop;this.mBottomPageBounds=height-paddingBottom;this.mDecorChildCount=decorCount;if(this.mFirstLayout){this.scrollToItem(this.mCurItem,false,0,false);}this.mFirstLayout=false;}},{key:'computeScroll',value:function computeScroll(){if(!this.mScroller.isFinished()&&this.mScroller.computeScrollOffset()){var oldX=this.getScrollX();var oldY=this.getScrollY();var _x244=this.mScroller.getCurrX();var _y20=this.mScroller.getCurrY();if(oldX!=_x244||oldY!=_y20){this.scrollTo(_x244,_y20);if(!this.pageScrolled(_x244)){this.mScroller.abortAnimation();this.scrollTo(0,_y20);}}this.postInvalidateOnAnimation();return;}this.completeScroll(true);}},{key:'pageScrolled',value:function pageScrolled(xpos){if(this.mItems.size()==0){this.mCalledSuper=false;this.onPageScrolled(0,0,0);if(!this.mCalledSuper){throw new Error(\"onPageScrolled did not call superclass implementation\");}return false;}var ii=this.infoForCurrentScrollPosition();var width=this.getClientWidth();var widthWithMargin=width+this.mPageMargin;var marginOffset=this.mPageMargin/width;var currentPage=ii.position;var pageOffset=(xpos/width-ii.offset)/(ii.widthFactor+marginOffset);var offsetPixels=Math.floor(pageOffset*widthWithMargin);this.mCalledSuper=false;this.onPageScrolled(currentPage,pageOffset,offsetPixels);if(!this.mCalledSuper){throw new Error(\"onPageScrolled did not call superclass implementation\");}return true;}},{key:'onPageScrolled',value:function onPageScrolled(position,offset,offsetPixels){if(this.mDecorChildCount>0){var scrollX=this.getScrollX();var paddingLeft=this.getPaddingLeft();var paddingRight=this.getPaddingRight();var width=this.getWidth();var childCount=this.getChildCount();for(var i=0;i<childCount;i++){var child=this.getChildAt(i);var lp=child.getLayoutParams();if(!lp.isDecor)continue;var hgrav=lp.gravity&Gravity.HORIZONTAL_GRAVITY_MASK;var childLeft=0;switch(hgrav){default:childLeft=paddingLeft;break;case Gravity.LEFT:childLeft=paddingLeft;paddingLeft+=child.getWidth();break;case Gravity.CENTER_HORIZONTAL:childLeft=Math.max((width-child.getMeasuredWidth())/2,paddingLeft);break;case Gravity.RIGHT:childLeft=width-paddingRight-child.getMeasuredWidth();paddingRight+=child.getMeasuredWidth();break;}childLeft+=scrollX;var childOffset=childLeft-child.getLeft();if(childOffset!=0){child.offsetLeftAndRight(childOffset);}}}this.dispatchOnPageScrolled(position,offset,offsetPixels);if(this.mPageTransformer!=null){var _scrollX=this.getScrollX();var _childCount4=this.getChildCount();for(var _i67=0;_i67<_childCount4;_i67++){var _child25=this.getChildAt(_i67);var _lp12=_child25.getLayoutParams();if(_lp12.isDecor)continue;var transformPos=(_child25.getLeft()-_scrollX)/this.getClientWidth();this.mPageTransformer.transformPage(_child25,transformPos);}}this.mCalledSuper=true;}},{key:'dispatchOnPageScrolled',value:function dispatchOnPageScrolled(position,offset,offsetPixels){if(this.mOnPageChangeListener!=null){this.mOnPageChangeListener.onPageScrolled(position,offset,offsetPixels);}if(this.mOnPageChangeListeners!=null){for(var i=0,z=this.mOnPageChangeListeners.size();i<z;i++){var listener=this.mOnPageChangeListeners.get(i);if(listener!=null){listener.onPageScrolled(position,offset,offsetPixels);}}}if(this.mInternalPageChangeListener!=null){this.mInternalPageChangeListener.onPageScrolled(position,offset,offsetPixels);}}},{key:'dispatchOnPageSelected',value:function dispatchOnPageSelected(position){if(this.mOnPageChangeListener!=null){this.mOnPageChangeListener.onPageSelected(position);}if(this.mOnPageChangeListeners!=null){for(var i=0,z=this.mOnPageChangeListeners.size();i<z;i++){var listener=this.mOnPageChangeListeners.get(i);if(listener!=null){listener.onPageSelected(position);}}}if(this.mInternalPageChangeListener!=null){this.mInternalPageChangeListener.onPageSelected(position);}}},{key:'dispatchOnScrollStateChanged',value:function dispatchOnScrollStateChanged(state){if(this.mOnPageChangeListener!=null){this.mOnPageChangeListener.onPageScrollStateChanged(state);}if(this.mOnPageChangeListeners!=null){for(var i=0,z=this.mOnPageChangeListeners.size();i<z;i++){var listener=this.mOnPageChangeListeners.get(i);if(listener!=null){listener.onPageScrollStateChanged(state);}}}if(this.mInternalPageChangeListener!=null){this.mInternalPageChangeListener.onPageScrollStateChanged(state);}}},{key:'completeScroll',value:function completeScroll(postEvents){var needPopulate=this.mScrollState==ViewPager.SCROLL_STATE_SETTLING;if(needPopulate){this.setScrollingCacheEnabled(false);this.mScroller.abortAnimation();var oldX=this.getScrollX();var oldY=this.getScrollY();var _x245=this.mScroller.getCurrX();var _y21=this.mScroller.getCurrY();if(oldX!=_x245||oldY!=_y21){this.scrollTo(_x245,_y21);if(_x245!=oldX){this.pageScrolled(_x245);}}}this.mPopulatePending=false;for(var i=0;i<this.mItems.size();i++){var ii=this.mItems.get(i);if(ii.scrolling){needPopulate=true;ii.scrolling=false;}}if(needPopulate){if(postEvents){this.postOnAnimation(this.mEndScrollRunnable);}else{this.mEndScrollRunnable.run();}}}},{key:'isGutterDrag',value:function isGutterDrag(x,dx){return x<this.mGutterSize&&dx>0||x>this.getWidth()-this.mGutterSize&&dx<0;}},{key:'enableLayers',value:function enableLayers(enable){}},{key:'onInterceptTouchEvent',value:function onInterceptTouchEvent(ev){var action=ev.getAction()&MotionEvent.ACTION_MASK;if(action==MotionEvent.ACTION_CANCEL||action==MotionEvent.ACTION_UP){if(DEBUG)Log.v(TAG,\"Intercept done!\");this.resetTouch();return false;}if(action!=MotionEvent.ACTION_DOWN){if(this.mIsBeingDragged){if(DEBUG)Log.v(TAG,\"Intercept returning true!\");return true;}if(this.mIsUnableToDrag){if(DEBUG)Log.v(TAG,\"Intercept returning false!\");return false;}}switch(action){case MotionEvent.ACTION_MOVE:{var activePointerId=this.mActivePointerId;if(activePointerId==ViewPager.INVALID_POINTER){break;}var pointerIndex=ev.findPointerIndex(activePointerId);var _x246=ev.getX(pointerIndex);var _dx7=_x246-this.mLastMotionX;var xDiff=Math.abs(_dx7);var _y22=ev.getY(pointerIndex);var yDiff=Math.abs(_y22-this.mInitialMotionY);if(DEBUG)Log.v(TAG,\"Moved x to \"+_x246+\",\"+_y22+\" diff=\"+xDiff+\",\"+yDiff);if(_dx7!=0&&!this.isGutterDrag(this.mLastMotionX,_dx7)&&this.canScroll(this,false,Math.floor(_dx7),Math.floor(_x246),Math.floor(_y22))){this.mLastMotionX=_x246;this.mLastMotionY=_y22;this.mIsUnableToDrag=true;return false;}if(xDiff>this.mTouchSlop&&xDiff*0.5>yDiff){if(DEBUG)Log.v(TAG,\"Starting drag!\");this.mIsBeingDragged=true;this.requestParentDisallowInterceptTouchEvent(true);this.setScrollState(ViewPager.SCROLL_STATE_DRAGGING);this.mLastMotionX=_dx7>0?this.mInitialMotionX+this.mTouchSlop:this.mInitialMotionX-this.mTouchSlop;this.mLastMotionY=_y22;this.setScrollingCacheEnabled(true);}else if(yDiff>this.mTouchSlop){if(DEBUG)Log.v(TAG,\"Starting unable to drag!\");this.mIsUnableToDrag=true;}if(this.mIsBeingDragged){if(this.performDrag(_x246)){this.postInvalidateOnAnimation();}}break;}case MotionEvent.ACTION_DOWN:{this.mLastMotionX=this.mInitialMotionX=ev.getX();this.mLastMotionY=this.mInitialMotionY=ev.getY();this.mActivePointerId=ev.getPointerId(0);this.mIsUnableToDrag=false;this.mScroller.computeScrollOffset();if(this.mScrollState==ViewPager.SCROLL_STATE_SETTLING&&Math.abs(this.mScroller.getFinalX()-this.mScroller.getCurrX())>this.mCloseEnough){this.mScroller.abortAnimation();this.mPopulatePending=false;this.populate();this.mIsBeingDragged=true;this.requestParentDisallowInterceptTouchEvent(true);this.setScrollState(ViewPager.SCROLL_STATE_DRAGGING);}else{this.completeScroll(false);this.mIsBeingDragged=false;}if(DEBUG)Log.v(TAG,\"Down at \"+this.mLastMotionX+\",\"+this.mLastMotionY+\" mIsBeingDragged=\"+this.mIsBeingDragged+\"mIsUnableToDrag=\"+this.mIsUnableToDrag);break;}case MotionEvent.ACTION_POINTER_UP:this.onSecondaryPointerUp(ev);break;}if(this.mVelocityTracker==null){this.mVelocityTracker=VelocityTracker.obtain();}this.mVelocityTracker.addMovement(ev);return this.mIsBeingDragged;}},{key:'onTouchEvent',value:function onTouchEvent(ev){if(this.mFakeDragging){return true;}if(ev.getAction()==MotionEvent.ACTION_DOWN&&ev.getEdgeFlags()!=0){return false;}if(this.mAdapter==null||this.mAdapter.getCount()==0){return false;}if(this.mVelocityTracker==null){this.mVelocityTracker=VelocityTracker.obtain();}this.mVelocityTracker.addMovement(ev);var action=ev.getAction();var needsInvalidate=false;switch(action&MotionEvent.ACTION_MASK){case MotionEvent.ACTION_DOWN:{this.mScroller.abortAnimation();this.mPopulatePending=false;this.populate();this.mLastMotionX=this.mInitialMotionX=ev.getX();this.mLastMotionY=this.mInitialMotionY=ev.getY();this.mActivePointerId=ev.getPointerId(0);break;}case MotionEvent.ACTION_MOVE:if(!this.mIsBeingDragged){var pointerIndex=ev.findPointerIndex(this.mActivePointerId);if(pointerIndex==-1){needsInvalidate=this.resetTouch();break;}var _x247=ev.getX(pointerIndex);var xDiff=Math.abs(_x247-this.mLastMotionX);var _y23=ev.getY(pointerIndex);var yDiff=Math.abs(_y23-this.mLastMotionY);if(DEBUG)Log.v(TAG,\"Moved x to \"+_x247+\",\"+_y23+\" diff=\"+xDiff+\",\"+yDiff);if(xDiff>this.mTouchSlop&&xDiff>yDiff){if(DEBUG)Log.v(TAG,\"Starting drag!\");this.mIsBeingDragged=true;this.requestParentDisallowInterceptTouchEvent(true);this.mLastMotionX=_x247-this.mInitialMotionX>0?this.mInitialMotionX+this.mTouchSlop:this.mInitialMotionX-this.mTouchSlop;this.mLastMotionY=_y23;this.setScrollState(ViewPager.SCROLL_STATE_DRAGGING);this.setScrollingCacheEnabled(true);var parent=this.getParent();if(parent!=null){parent.requestDisallowInterceptTouchEvent(true);}}}if(this.mIsBeingDragged){var activePointerIndex=ev.findPointerIndex(this.mActivePointerId);var _x248=ev.getX(activePointerIndex);needsInvalidate=needsInvalidate||this.performDrag(_x248);}break;case MotionEvent.ACTION_UP:if(this.mIsBeingDragged){var velocityTracker=this.mVelocityTracker;velocityTracker.computeCurrentVelocity(1000,this.mMaximumVelocity);var initialVelocity=velocityTracker.getXVelocity(this.mActivePointerId);this.mPopulatePending=true;var width=this.getClientWidth();var scrollX=this.getScrollX();var ii=this.infoForCurrentScrollPosition();var currentPage=ii.position;var pageOffset=(scrollX/width-ii.offset)/ii.widthFactor;var _activePointerIndex=ev.findPointerIndex(this.mActivePointerId);var _x249=ev.getX(_activePointerIndex);var totalDelta=_x249-this.mInitialMotionX;var nextPage=this.determineTargetPage(currentPage,pageOffset,initialVelocity,totalDelta);this.setCurrentItemInternal(nextPage,true,true,initialVelocity);needsInvalidate=this.resetTouch();}break;case MotionEvent.ACTION_CANCEL:if(this.mIsBeingDragged){this.scrollToItem(this.mCurItem,true,0,false);needsInvalidate=this.resetTouch();}break;case MotionEvent.ACTION_POINTER_DOWN:{var index=ev.getActionIndex();var _x250=ev.getX(index);this.mLastMotionX=_x250;this.mActivePointerId=ev.getPointerId(index);break;}case MotionEvent.ACTION_POINTER_UP:this.onSecondaryPointerUp(ev);this.mLastMotionX=ev.getX(ev.findPointerIndex(this.mActivePointerId));break;}if(needsInvalidate){this.postInvalidateOnAnimation();}return true;}},{key:'resetTouch',value:function resetTouch(){var needsInvalidate=false;this.mActivePointerId=ViewPager.INVALID_POINTER;this.endDrag();return needsInvalidate;}},{key:'requestParentDisallowInterceptTouchEvent',value:function requestParentDisallowInterceptTouchEvent(disallowIntercept){var parent=this.getParent();if(parent!=null){parent.requestDisallowInterceptTouchEvent(disallowIntercept);}}},{key:'performDrag',value:function performDrag(x){var needsInvalidate=false;var deltaX=this.mLastMotionX-x;this.mLastMotionX=x;var oldScrollX=this.getScrollX();var scrollX=oldScrollX+deltaX;var width=this.getClientWidth();var leftBound=width*this.mFirstOffset;var rightBound=width*this.mLastOffset;var leftAbsolute=true;var rightAbsolute=true;var firstItem=this.mItems.get(0);var lastItem=this.mItems.get(this.mItems.size()-1);if(firstItem.position!=0){leftAbsolute=false;leftBound=firstItem.offset*width;}if(lastItem.position!=this.mAdapter.getCount()-1){rightAbsolute=false;rightBound=lastItem.offset*width;}if(scrollX<leftBound){if(leftAbsolute){var over=leftBound-scrollX;needsInvalidate=false;}scrollX-=deltaX/2;}else if(scrollX>rightBound){if(rightAbsolute){var _over=scrollX-rightBound;needsInvalidate=false;}scrollX-=deltaX/2;}this.mLastMotionX+=scrollX-Math.floor(scrollX);this.scrollTo(scrollX,this.getScrollY());this.pageScrolled(scrollX);return needsInvalidate;}},{key:'infoForCurrentScrollPosition',value:function infoForCurrentScrollPosition(){var width=this.getClientWidth();var scrollOffset=width>0?this.getScrollX()/width:0;var marginOffset=width>0?this.mPageMargin/width:0;var lastPos=-1;var lastOffset=0;var lastWidth=0;var first=true;var lastItem=null;for(var i=0;i<this.mItems.size();i++){var ii=this.mItems.get(i);var offset=void 0;if(!first&&ii.position!=lastPos+1){ii=this.mTempItem;ii.offset=lastOffset+lastWidth+marginOffset;ii.position=lastPos+1;ii.widthFactor=this.mAdapter.getPageWidth(ii.position);i--;}offset=ii.offset;var leftBound=offset;var rightBound=offset+ii.widthFactor+marginOffset;if(first||scrollOffset>=leftBound){if(scrollOffset<rightBound||i==this.mItems.size()-1){return ii;}}else{return lastItem;}first=false;lastPos=ii.position;lastOffset=offset;lastWidth=ii.widthFactor;lastItem=ii;}return lastItem;}},{key:'determineTargetPage',value:function determineTargetPage(currentPage,pageOffset,velocity,deltaX){var targetPage=void 0;if(Math.abs(deltaX)>this.mFlingDistance&&Math.abs(velocity)>this.mMinimumVelocity){targetPage=velocity>0?currentPage:currentPage+1;}else{var truncator=currentPage>=this.mCurItem?0.4:0.6;targetPage=Math.floor(currentPage+pageOffset+truncator);}if(this.mItems.size()>0){var firstItem=this.mItems.get(0);var lastItem=this.mItems.get(this.mItems.size()-1);targetPage=Math.max(firstItem.position,Math.min(targetPage,lastItem.position));}return targetPage;}},{key:'draw',value:function draw(canvas){_get2(ViewPager.prototype.__proto__||Object.getPrototypeOf(ViewPager.prototype),'draw',this).call(this,canvas);var needsInvalidate=false;if(needsInvalidate){this.postInvalidateOnAnimation();}}},{key:'onDraw',value:function onDraw(canvas){_get2(ViewPager.prototype.__proto__||Object.getPrototypeOf(ViewPager.prototype),'onDraw',this).call(this,canvas);if(this.mPageMargin>0&&this.mMarginDrawable!=null&&this.mItems.size()>0&&this.mAdapter!=null){var scrollX=this.getScrollX();var width=this.getWidth();var marginOffset=this.mPageMargin/width;var itemIndex=0;var ii=this.mItems.get(0);var offset=ii.offset;var itemCount=this.mItems.size();var firstPos=ii.position;var lastPos=this.mItems.get(itemCount-1).position;for(var pos=firstPos;pos<lastPos;pos++){while(pos>ii.position&&itemIndex<itemCount){ii=this.mItems.get(++itemIndex);}var drawAt=void 0;if(pos==ii.position){drawAt=(ii.offset+ii.widthFactor)*width;offset=ii.offset+ii.widthFactor+marginOffset;}else{var widthFactor=this.mAdapter.getPageWidth(pos);drawAt=(offset+widthFactor)*width;offset+=widthFactor+marginOffset;}if(drawAt+this.mPageMargin>scrollX){this.mMarginDrawable.setBounds(drawAt,this.mTopPageBounds,drawAt+this.mPageMargin,this.mBottomPageBounds);this.mMarginDrawable.draw(canvas);}if(drawAt>scrollX+width){break;}}}}},{key:'beginFakeDrag',value:function beginFakeDrag(){if(this.mIsBeingDragged){return false;}this.mFakeDragging=true;this.setScrollState(ViewPager.SCROLL_STATE_DRAGGING);this.mInitialMotionX=this.mLastMotionX=0;if(this.mVelocityTracker==null){this.mVelocityTracker=VelocityTracker.obtain();}else{this.mVelocityTracker.clear();}var time=android.os.SystemClock.uptimeMillis();var ev=MotionEvent.obtainWithAction(time,time,MotionEvent.ACTION_DOWN,0,0,0);this.mVelocityTracker.addMovement(ev);ev.recycle();this.mFakeDragBeginTime=time;return true;}},{key:'endFakeDrag',value:function endFakeDrag(){if(!this.mFakeDragging){throw new Error(\"No fake drag in progress. Call beginFakeDrag first.\");}var velocityTracker=this.mVelocityTracker;velocityTracker.computeCurrentVelocity(1000,this.mMaximumVelocity);var initialVelocity=Math.floor(velocityTracker.getXVelocity(this.mActivePointerId));this.mPopulatePending=true;var width=this.getClientWidth();var scrollX=this.getScrollX();var ii=this.infoForCurrentScrollPosition();var currentPage=ii.position;var pageOffset=(scrollX/width-ii.offset)/ii.widthFactor;var totalDelta=Math.floor(this.mLastMotionX-this.mInitialMotionX);var nextPage=this.determineTargetPage(currentPage,pageOffset,initialVelocity,totalDelta);this.setCurrentItemInternal(nextPage,true,true,initialVelocity);this.endDrag();this.mFakeDragging=false;}},{key:'fakeDragBy',value:function fakeDragBy(xOffset){if(!this.mFakeDragging){throw new Error(\"No fake drag in progress. Call beginFakeDrag first.\");}this.mLastMotionX+=xOffset;var oldScrollX=this.getScrollX();var scrollX=oldScrollX-xOffset;var width=this.getClientWidth();var leftBound=width*this.mFirstOffset;var rightBound=width*this.mLastOffset;var firstItem=this.mItems.get(0);var lastItem=this.mItems.get(this.mItems.size()-1);if(firstItem.position!=0){leftBound=firstItem.offset*width;}if(lastItem.position!=this.mAdapter.getCount()-1){rightBound=lastItem.offset*width;}if(scrollX<leftBound){scrollX=leftBound;}else if(scrollX>rightBound){scrollX=rightBound;}this.mLastMotionX+=scrollX-Math.floor(scrollX);this.scrollTo(Math.floor(scrollX),this.getScrollY());this.pageScrolled(Math.floor(scrollX));var time=android.os.SystemClock.uptimeMillis();var ev=MotionEvent.obtainWithAction(this.mFakeDragBeginTime,time,MotionEvent.ACTION_MOVE,this.mLastMotionX,0,0);this.mVelocityTracker.addMovement(ev);ev.recycle();}},{key:'isFakeDragging',value:function isFakeDragging(){return this.mFakeDragging;}},{key:'onSecondaryPointerUp',value:function onSecondaryPointerUp(ev){var pointerIndex=ev.getActionIndex();var pointerId=ev.getPointerId(pointerIndex);if(pointerId==this.mActivePointerId){var newPointerIndex=pointerIndex==0?1:0;this.mLastMotionX=ev.getX(newPointerIndex);this.mActivePointerId=ev.getPointerId(newPointerIndex);if(this.mVelocityTracker!=null){this.mVelocityTracker.clear();}}}},{key:'endDrag',value:function endDrag(){this.mIsBeingDragged=false;this.mIsUnableToDrag=false;if(this.mVelocityTracker!=null){this.mVelocityTracker.recycle();this.mVelocityTracker=null;}}},{key:'setScrollingCacheEnabled',value:function setScrollingCacheEnabled(enabled){if(this.mScrollingCacheEnabled!=enabled){this.mScrollingCacheEnabled=enabled;if(ViewPager.USE_CACHE){var size=this.getChildCount();for(var i=0;i<size;++i){var child=this.getChildAt(i);if(child.getVisibility()!=View.GONE){child.setDrawingCacheEnabled(enabled);}}}}}},{key:'canScrollHorizontally',value:function canScrollHorizontally(direction){if(this.mAdapter==null){return false;}var width=this.getClientWidth();var scrollX=this.getScrollX();if(direction<0){return scrollX>width*this.mFirstOffset;}else if(direction>0){return scrollX<width*this.mLastOffset;}else{return false;}}},{key:'canScroll',value:function canScroll(v,checkV,dx,x,y){if(v instanceof ViewGroup){var group=v;var scrollX=v.getScrollX();var scrollY=v.getScrollY();var count=group.getChildCount();for(var i=count-1;i>=0;i--){var child=group.getChildAt(i);if(x+scrollX>=child.getLeft()&&x+scrollX<child.getRight()&&y+scrollY>=child.getTop()&&y+scrollY<child.getBottom()&&this.canScroll(child,true,dx,x+scrollX-child.getLeft(),y+scrollY-child.getTop())){return true;}}}return checkV&&v.canScrollHorizontally(-dx);}},{key:'dispatchKeyEvent',value:function dispatchKeyEvent(event){return _get2(ViewPager.prototype.__proto__||Object.getPrototypeOf(ViewPager.prototype),'dispatchKeyEvent',this).call(this,event)||this.executeKeyEvent(event);}},{key:'executeKeyEvent',value:function executeKeyEvent(event){var handled=false;if(event.getAction()==KeyEvent.ACTION_DOWN){switch(event.getKeyCode()){case KeyEvent.KEYCODE_DPAD_LEFT:handled=this.arrowScroll(View.FOCUS_LEFT);break;case KeyEvent.KEYCODE_DPAD_RIGHT:handled=this.arrowScroll(View.FOCUS_RIGHT);break;case KeyEvent.KEYCODE_TAB:if(event.isShiftPressed()){handled=this.arrowScroll(View.FOCUS_BACKWARD);}else{handled=this.arrowScroll(View.FOCUS_FORWARD);}break;}}return handled;}},{key:'arrowScroll',value:function arrowScroll(direction){var currentFocused=this.findFocus();if(currentFocused==this){currentFocused=null;}else if(currentFocused!=null){var isChild=false;for(var parent=currentFocused.getParent();parent instanceof ViewGroup;parent=parent.getParent()){if(parent==this){isChild=true;break;}}if(!isChild){var sb=new java.lang.StringBuilder();sb.append(currentFocused.toString());for(var _parent3=currentFocused.getParent();_parent3 instanceof ViewGroup;_parent3=_parent3.getParent()){sb.append(\" => \").append(_parent3.toString());}Log.e(TAG,\"arrowScroll tried to find focus based on non-child \"+\"current focused view \"+sb.toString());currentFocused=null;}}var handled=false;var nextFocused=android.view.FocusFinder.getInstance().findNextFocus(this,currentFocused,direction);if(nextFocused!=null&&nextFocused!=currentFocused){if(direction==View.FOCUS_LEFT){var nextLeft=this.getChildRectInPagerCoordinates(this.mTempRect,nextFocused).left;var currLeft=this.getChildRectInPagerCoordinates(this.mTempRect,currentFocused).left;if(currentFocused!=null&&nextLeft>=currLeft){handled=this.pageLeft();}else{handled=nextFocused.requestFocus();}}else if(direction==View.FOCUS_RIGHT){var _nextLeft=this.getChildRectInPagerCoordinates(this.mTempRect,nextFocused).left;var _currLeft=this.getChildRectInPagerCoordinates(this.mTempRect,currentFocused).left;if(currentFocused!=null&&_nextLeft<=_currLeft){handled=this.pageRight();}else{handled=nextFocused.requestFocus();}}}else if(direction==View.FOCUS_LEFT||direction==View.FOCUS_BACKWARD){handled=this.pageLeft();}else if(direction==View.FOCUS_RIGHT||direction==View.FOCUS_FORWARD){handled=this.pageRight();}return handled;}},{key:'getChildRectInPagerCoordinates',value:function getChildRectInPagerCoordinates(outRect,child){if(outRect==null){outRect=new Rect();}if(child==null){outRect.set(0,0,0,0);return outRect;}outRect.left=child.getLeft();outRect.right=child.getRight();outRect.top=child.getTop();outRect.bottom=child.getBottom();var parent=child.getParent();while(parent instanceof ViewGroup&&parent!=this){var group=parent;outRect.left+=group.getLeft();outRect.right+=group.getRight();outRect.top+=group.getTop();outRect.bottom+=group.getBottom();parent=group.getParent();}return outRect;}},{key:'pageLeft',value:function pageLeft(){if(this.mCurItem>0){this.setCurrentItem(this.mCurItem-1,true);return true;}return false;}},{key:'pageRight',value:function pageRight(){if(this.mAdapter!=null&&this.mCurItem<this.mAdapter.getCount()-1){this.setCurrentItem(this.mCurItem+1,true);return true;}return false;}},{key:'addFocusables',value:function addFocusables(views,direction,focusableMode){var focusableCount=views.size();var descendantFocusability=this.getDescendantFocusability();if(descendantFocusability!=ViewGroup.FOCUS_BLOCK_DESCENDANTS){for(var i=0;i<this.getChildCount();i++){var child=this.getChildAt(i);if(child.getVisibility()==View.VISIBLE){var ii=this.infoForChild(child);if(ii!=null&&ii.position==this.mCurItem){child.addFocusables(views,direction,focusableMode);}}}}if(descendantFocusability!=ViewGroup.FOCUS_AFTER_DESCENDANTS||focusableCount==views.size()){if(!this.isFocusable()){return;}if((focusableMode&ViewGroup.FOCUSABLES_TOUCH_MODE)==ViewGroup.FOCUSABLES_TOUCH_MODE&&this.isInTouchMode()&&!this.isFocusableInTouchMode()){return;}if(views!=null){views.add(this);}}}},{key:'addTouchables',value:function addTouchables(views){for(var i=0;i<this.getChildCount();i++){var child=this.getChildAt(i);if(child.getVisibility()==View.VISIBLE){var ii=this.infoForChild(child);if(ii!=null&&ii.position==this.mCurItem){child.addTouchables(views);}}}}},{key:'onRequestFocusInDescendants',value:function onRequestFocusInDescendants(direction,previouslyFocusedRect){var index=void 0;var increment=void 0;var end=void 0;var count=this.getChildCount();if((direction&View.FOCUS_FORWARD)!=0){index=0;increment=1;end=count;}else{index=count-1;increment=-1;end=-1;}for(var i=index;i!=end;i+=increment){var child=this.getChildAt(i);if(child.getVisibility()==View.VISIBLE){var ii=this.infoForChild(child);if(ii!=null&&ii.position==this.mCurItem){if(child.requestFocus(direction,previouslyFocusedRect)){return true;}}}}return false;}},{key:'generateDefaultLayoutParams',value:function generateDefaultLayoutParams(){return new ViewPager.LayoutParams();}},{key:'generateLayoutParams',value:function generateLayoutParams(p){return this.generateDefaultLayoutParams();}},{key:'checkLayoutParams',value:function checkLayoutParams(p){return p instanceof ViewPager.LayoutParams&&_get2(ViewPager.prototype.__proto__||Object.getPrototypeOf(ViewPager.prototype),'checkLayoutParams',this).call(this,p);}},{key:'generateLayoutParamsFromAttr',value:function generateLayoutParamsFromAttr(attrs){return new ViewPager.LayoutParams(this.getContext(),attrs);}}],[{key:'isImplDecor',value:function isImplDecor(view){return view[SymbolDecor]||view.constructor[SymbolDecor];}},{key:'setClassImplDecor',value:function setClassImplDecor(clazz){clazz[SymbolDecor]=true;}}]);return ViewPager;}(ViewGroup);ViewPager.COMPARATOR=function(lhs,rhs){return lhs.position-rhs.position;};ViewPager.USE_CACHE=false;ViewPager.DEFAULT_OFFSCREEN_PAGES=1;ViewPager.MAX_SETTLE_DURATION=600;ViewPager.MIN_DISTANCE_FOR_FLING=25;ViewPager.DEFAULT_GUTTER_SIZE=16;ViewPager.MIN_FLING_VELOCITY=400;ViewPager.sInterpolator={getInterpolation:function getInterpolation(t){t-=1.0;return t*t*t*t*t+1.0;}};ViewPager.INVALID_POINTER=-1;ViewPager.CLOSE_ENOUGH=2;ViewPager.DRAW_ORDER_DEFAULT=0;ViewPager.DRAW_ORDER_FORWARD=1;ViewPager.DRAW_ORDER_REVERSE=2;ViewPager.sPositionComparator=function(lhs,rhs){var llp=lhs.getLayoutParams();var rlp=rhs.getLayoutParams();if(llp.isDecor!=rlp.isDecor){return llp.isDecor?1:-1;}return llp.position-rlp.position;};ViewPager.SCROLL_STATE_IDLE=0;ViewPager.SCROLL_STATE_DRAGGING=1;ViewPager.SCROLL_STATE_SETTLING=2;view_9.ViewPager=ViewPager;(function(ViewPager){var SimpleOnPageChangeListener=function(){function SimpleOnPageChangeListener(){_classCallCheck(this,SimpleOnPageChangeListener);}_createClass(SimpleOnPageChangeListener,[{key:'onPageScrolled',value:function onPageScrolled(position,positionOffset,positionOffsetPixels){}},{key:'onPageSelected',value:function onPageSelected(position){}},{key:'onPageScrollStateChanged',value:function onPageScrollStateChanged(state){}}]);return SimpleOnPageChangeListener;}();ViewPager.SimpleOnPageChangeListener=SimpleOnPageChangeListener;var LayoutParams=function(_ViewGroup$LayoutPara2){_inherits(LayoutParams,_ViewGroup$LayoutPara2);function LayoutParams(){var _ref10;for(var _len34=arguments.length,args=Array(_len34),_key35=0;_key35<_len34;_key35++){args[_key35]=arguments[_key35];}_classCallCheck(this,LayoutParams);var _this170=_possibleConstructorReturn(this,(_ref10=LayoutParams.__proto__||Object.getPrototypeOf(LayoutParams)).call.apply(_ref10,[this].concat(_toConsumableArray(function(){if(args[0]instanceof android.content.Context&&args[1]instanceof HTMLElement)return[args[0],args[1]];else if(args.length===0)return[ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT];}()))));_this170.isDecor=false;_this170.gravity=0;_this170.widthFactor=0;_this170.needsMeasure=false;_this170.position=0;_this170.childIndex=0;if(args[0]instanceof android.content.Context&&args[1]instanceof HTMLElement){var c=args[0];var attrs=args[1];var _a15=c.obtainStyledAttributes(attrs);_this170.gravity=Gravity.parseGravity(_a15.getAttrValue('layout_gravity'),Gravity.TOP);_a15.recycle();}else if(args.length===0){}return _this170;}_createClass(LayoutParams,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(LayoutParams.prototype.__proto__||Object.getPrototypeOf(LayoutParams.prototype),'createClassAttrBinder',this).call(this).set('layout_gravity',{setter:function setter(param,value,attrBinder){param.gravity=attrBinder.parseGravity(value,param.gravity);},getter:function getter(param){return param.gravity;}});}}]);return LayoutParams;}(ViewGroup.LayoutParams);ViewPager.LayoutParams=LayoutParams;})(ViewPager=view_9.ViewPager||(view_9.ViewPager={}));var ItemInfo=function ItemInfo(){_classCallCheck(this,ItemInfo);this.position=0;this.scrolling=false;this.widthFactor=0;this.offset=0;};var PagerObserver=function(_DataSetObserver4){_inherits(PagerObserver,_DataSetObserver4);function PagerObserver(viewPager){_classCallCheck(this,PagerObserver);var _this171=_possibleConstructorReturn(this,(PagerObserver.__proto__||Object.getPrototypeOf(PagerObserver)).call(this));_this171.ViewPager_this=viewPager;return _this171;}_createClass(PagerObserver,[{key:'onChanged',value:function onChanged(){this.ViewPager_this.dataSetChanged();}},{key:'onInvalidated',value:function onInvalidated(){this.ViewPager_this.dataSetChanged();}}]);return PagerObserver;}(DataSetObserver);})(view=v4.view||(v4.view={}));})(v4=support.v4||(support.v4={}));})(support=android.support||(android.support={}));})(android||(android={}));var android;(function(android){var support;(function(support){var v4;(function(v4){var widget;(function(widget){var MotionEvent=android.view.MotionEvent;var VelocityTracker=android.view.VelocityTracker;var ViewConfiguration=android.view.ViewConfiguration;var ViewGroup=android.view.ViewGroup;var OverScroller=android.widget.OverScroller;var System=java.lang.System;var ViewDragHelper=function(){function ViewDragHelper(forParent,cb){var _this172=this;_classCallCheck(this,ViewDragHelper);this.mDragState=0;this.mTouchSlop=0;this.mActivePointerId=ViewDragHelper.INVALID_POINTER;this.mPointersDown=0;this.mMaxVelocity=0;this.mMinVelocity=0;this.mEdgeSize=0;this.mTrackingEdges=0;this.mSetIdleRunnable=function(){var inner_this=_this172;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'run',value:function run(){inner_this.setDragState(ViewDragHelper.STATE_IDLE);}}]);return _Inner;}();return new _Inner();}();if(forParent==null){throw Error('new IllegalArgumentException(\"Parent view may not be null\")');}if(cb==null){throw Error('new IllegalArgumentException(\"Callback may not be null\")');}this.mParentView=forParent;this.mCallback=cb;var vc=ViewConfiguration.get();var density=android.content.res.Resources.getDisplayMetrics().density;this.mEdgeSize=Math.floor(ViewDragHelper.EDGE_SIZE*density+0.5);this.mTouchSlop=vc.getScaledTouchSlop();this.mMaxVelocity=vc.getScaledMaximumFlingVelocity();this.mMinVelocity=vc.getScaledMinimumFlingVelocity();this.mScroller=new OverScroller(ViewDragHelper.sInterpolator);}_createClass(ViewDragHelper,[{key:'setMinVelocity',value:function setMinVelocity(minVel){this.mMinVelocity=minVel;}},{key:'getMinVelocity',value:function getMinVelocity(){return this.mMinVelocity;}},{key:'getViewDragState',value:function getViewDragState(){return this.mDragState;}},{key:'setEdgeTrackingEnabled',value:function setEdgeTrackingEnabled(edgeFlags){this.mTrackingEdges=edgeFlags;}},{key:'getEdgeSize',value:function getEdgeSize(){return this.mEdgeSize;}},{key:'captureChildView',value:function captureChildView(childView,activePointerId){if(childView.getParent()!=this.mParentView){throw Error('new IllegalArgumentException(\"captureChildView: parameter must be a descendant \" + \"of the ViewDragHelper\\'s tracked parent view (\" + this.mParentView + \")\")');}this.mCapturedView=childView;this.mActivePointerId=activePointerId;this.mCallback.onViewCaptured(childView,activePointerId);this.setDragState(ViewDragHelper.STATE_DRAGGING);}},{key:'getCapturedView',value:function getCapturedView(){return this.mCapturedView;}},{key:'getActivePointerId',value:function getActivePointerId(){return this.mActivePointerId;}},{key:'getTouchSlop',value:function getTouchSlop(){return this.mTouchSlop;}},{key:'cancel',value:function cancel(){this.mActivePointerId=ViewDragHelper.INVALID_POINTER;this.clearMotionHistory();if(this.mVelocityTracker!=null){this.mVelocityTracker.recycle();this.mVelocityTracker=null;}}},{key:'abort',value:function abort(){this.cancel();if(this.mDragState==ViewDragHelper.STATE_SETTLING){var oldX=this.mScroller.getCurrX();var oldY=this.mScroller.getCurrY();this.mScroller.abortAnimation();var newX=this.mScroller.getCurrX();var newY=this.mScroller.getCurrY();this.mCallback.onViewPositionChanged(this.mCapturedView,newX,newY,newX-oldX,newY-oldY);}this.setDragState(ViewDragHelper.STATE_IDLE);}},{key:'smoothSlideViewTo',value:function smoothSlideViewTo(child,finalLeft,finalTop){this.mCapturedView=child;this.mActivePointerId=ViewDragHelper.INVALID_POINTER;return this.forceSettleCapturedViewAt(finalLeft,finalTop,0,0);}},{key:'settleCapturedViewAt',value:function settleCapturedViewAt(finalLeft,finalTop){if(!this.mReleaseInProgress){throw Error('new IllegalStateException(\"Cannot settleCapturedViewAt outside of a call to \" + \"Callback#onViewReleased\")');}return this.forceSettleCapturedViewAt(finalLeft,finalTop,Math.floor(this.mVelocityTracker.getXVelocity(this.mActivePointerId)),Math.floor(this.mVelocityTracker.getYVelocity(this.mActivePointerId)));}},{key:'forceSettleCapturedViewAt',value:function forceSettleCapturedViewAt(finalLeft,finalTop,xvel,yvel){var startLeft=this.mCapturedView.getLeft();var startTop=this.mCapturedView.getTop();var dx=finalLeft-startLeft;var dy=finalTop-startTop;if(dx==0&&dy==0){this.mScroller.abortAnimation();this.setDragState(ViewDragHelper.STATE_IDLE);return false;}var duration=this.computeSettleDuration(this.mCapturedView,dx,dy,xvel,yvel);this.mScroller.startScroll(startLeft,startTop,dx,dy,duration);this.setDragState(ViewDragHelper.STATE_SETTLING);return true;}},{key:'computeSettleDuration',value:function computeSettleDuration(child,dx,dy,xvel,yvel){xvel=this.clampMag(xvel,Math.floor(this.mMinVelocity),Math.floor(this.mMaxVelocity));yvel=this.clampMag(yvel,Math.floor(this.mMinVelocity),Math.floor(this.mMaxVelocity));var absDx=Math.abs(dx);var absDy=Math.abs(dy);var absXVel=Math.abs(xvel);var absYVel=Math.abs(yvel);var addedVel=absXVel+absYVel;var addedDistance=absDx+absDy;var xweight=xvel!=0?absXVel/addedVel:absDx/addedDistance;var yweight=yvel!=0?absYVel/addedVel:absDy/addedDistance;var xduration=this.computeAxisDuration(dx,xvel,this.mCallback.getViewHorizontalDragRange(child));var yduration=this.computeAxisDuration(dy,yvel,this.mCallback.getViewVerticalDragRange(child));return Math.floor(xduration*xweight+yduration*yweight);}},{key:'computeAxisDuration',value:function computeAxisDuration(delta,velocity,motionRange){if(delta==0){return 0;}var width=this.mParentView.getWidth();var halfWidth=width/2;var distanceRatio=Math.min(1,Math.abs(delta)/width);var distance=halfWidth+halfWidth*this.distanceInfluenceForSnapDuration(distanceRatio);var duration=void 0;velocity=Math.abs(velocity);if(velocity>0){duration=4*Math.round(1000*Math.abs(distance/velocity));}else{var range=Math.abs(delta)/motionRange;duration=Math.floor((range+1)*ViewDragHelper.BASE_SETTLE_DURATION);}return Math.min(duration,ViewDragHelper.MAX_SETTLE_DURATION);}},{key:'clampMag',value:function clampMag(value,absMin,absMax){var absValue=Math.abs(value);if(absValue<absMin)return 0;if(absValue>absMax)return value>0?absMax:-absMax;return value;}},{key:'distanceInfluenceForSnapDuration',value:function distanceInfluenceForSnapDuration(f){f-=0.5;f*=0.3*Math.PI/2.0;return Math.sin(f);}},{key:'flingCapturedView',value:function flingCapturedView(minLeft,minTop,maxLeft,maxTop){if(!this.mReleaseInProgress){throw Error('new IllegalStateException(\"Cannot flingCapturedView outside of a call to \" + \"Callback#onViewReleased\")');}this.mScroller.fling(this.mCapturedView.getLeft(),this.mCapturedView.getTop(),Math.floor(this.mVelocityTracker.getXVelocity(this.mActivePointerId)),Math.floor(this.mVelocityTracker.getYVelocity(this.mActivePointerId)),minLeft,maxLeft,minTop,maxTop);this.setDragState(ViewDragHelper.STATE_SETTLING);}},{key:'continueSettling',value:function continueSettling(deferCallbacks){if(this.mDragState==ViewDragHelper.STATE_SETTLING){var keepGoing=this.mScroller.computeScrollOffset();var _x251=this.mScroller.getCurrX();var _y24=this.mScroller.getCurrY();var _dx8=_x251-this.mCapturedView.getLeft();var _dy4=_y24-this.mCapturedView.getTop();if(_dx8!=0){this.mCapturedView.offsetLeftAndRight(_dx8);}if(_dy4!=0){this.mCapturedView.offsetTopAndBottom(_dy4);}if(_dx8!=0||_dy4!=0){this.mCallback.onViewPositionChanged(this.mCapturedView,_x251,_y24,_dx8,_dy4);}if(keepGoing&&_x251==this.mScroller.getFinalX()&&_y24==this.mScroller.getFinalY()){this.mScroller.abortAnimation();keepGoing=this.mScroller.isFinished();}if(!keepGoing){if(deferCallbacks){this.mParentView.post(this.mSetIdleRunnable);}else{this.setDragState(ViewDragHelper.STATE_IDLE);}}}return this.mDragState==ViewDragHelper.STATE_SETTLING;}},{key:'dispatchViewReleased',value:function dispatchViewReleased(xvel,yvel){this.mReleaseInProgress=true;this.mCallback.onViewReleased(this.mCapturedView,xvel,yvel);this.mReleaseInProgress=false;if(this.mDragState==ViewDragHelper.STATE_DRAGGING){this.setDragState(ViewDragHelper.STATE_IDLE);}}},{key:'clearMotionHistory',value:function clearMotionHistory(pointerId){if(this.mInitialMotionX==null){return;}if(pointerId==null){this.mInitialMotionX=[];this.mInitialMotionY=[];this.mLastMotionX=[];this.mLastMotionY=[];this.mInitialEdgesTouched=[];this.mEdgeDragsInProgress=[];this.mEdgeDragsLocked=[];this.mPointersDown=0;}else{this.mInitialMotionX[pointerId]=0;this.mInitialMotionY[pointerId]=0;this.mLastMotionX[pointerId]=0;this.mLastMotionY[pointerId]=0;this.mInitialEdgesTouched[pointerId]=0;this.mEdgeDragsInProgress[pointerId]=0;this.mEdgeDragsLocked[pointerId]=0;this.mPointersDown&=~(1<<pointerId);}}},{key:'ensureMotionHistorySizeForId',value:function ensureMotionHistorySizeForId(pointerId){if(this.mInitialMotionX==null||this.mInitialMotionX.length<=pointerId){var imx=androidui.util.ArrayCreator.newNumberArray(pointerId+1);var imy=androidui.util.ArrayCreator.newNumberArray(pointerId+1);var lmx=androidui.util.ArrayCreator.newNumberArray(pointerId+1);var lmy=androidui.util.ArrayCreator.newNumberArray(pointerId+1);var iit=androidui.util.ArrayCreator.newNumberArray(pointerId+1);var edip=androidui.util.ArrayCreator.newNumberArray(pointerId+1);var edl=androidui.util.ArrayCreator.newNumberArray(pointerId+1);if(this.mInitialMotionX!=null){System.arraycopy(this.mInitialMotionX,0,imx,0,this.mInitialMotionX.length);System.arraycopy(this.mInitialMotionY,0,imy,0,this.mInitialMotionY.length);System.arraycopy(this.mLastMotionX,0,lmx,0,this.mLastMotionX.length);System.arraycopy(this.mLastMotionY,0,lmy,0,this.mLastMotionY.length);System.arraycopy(this.mInitialEdgesTouched,0,iit,0,this.mInitialEdgesTouched.length);System.arraycopy(this.mEdgeDragsInProgress,0,edip,0,this.mEdgeDragsInProgress.length);System.arraycopy(this.mEdgeDragsLocked,0,edl,0,this.mEdgeDragsLocked.length);}this.mInitialMotionX=imx;this.mInitialMotionY=imy;this.mLastMotionX=lmx;this.mLastMotionY=lmy;this.mInitialEdgesTouched=iit;this.mEdgeDragsInProgress=edip;this.mEdgeDragsLocked=edl;}}},{key:'saveInitialMotion',value:function saveInitialMotion(x,y,pointerId){this.ensureMotionHistorySizeForId(pointerId);this.mInitialMotionX[pointerId]=this.mLastMotionX[pointerId]=x;this.mInitialMotionY[pointerId]=this.mLastMotionY[pointerId]=y;this.mInitialEdgesTouched[pointerId]=this.getEdgesTouched(Math.floor(x),Math.floor(y));this.mPointersDown|=1<<pointerId;}},{key:'saveLastMotion',value:function saveLastMotion(ev){var pointerCount=ev.getPointerCount();for(var i=0;i<pointerCount;i++){var pointerId=ev.getPointerId(i);var _x252=ev.getX(i);var _y25=ev.getY(i);this.mLastMotionX[pointerId]=_x252;this.mLastMotionY[pointerId]=_y25;}}},{key:'isPointerDown',value:function isPointerDown(pointerId){return(this.mPointersDown&1<<pointerId)!=0;}},{key:'setDragState',value:function setDragState(state){if(this.mDragState!=state){this.mDragState=state;this.mCallback.onViewDragStateChanged(state);if(state==ViewDragHelper.STATE_IDLE){this.mCapturedView=null;}}}},{key:'tryCaptureViewForDrag',value:function tryCaptureViewForDrag(toCapture,pointerId){if(toCapture==this.mCapturedView&&this.mActivePointerId==pointerId){return true;}if(toCapture!=null&&this.mCallback.tryCaptureView(toCapture,pointerId)){this.mActivePointerId=pointerId;this.captureChildView(toCapture,pointerId);return true;}return false;}},{key:'canScroll',value:function canScroll(v,checkV,dx,dy,x,y){if(v instanceof ViewGroup){var group=v;var scrollX=v.getScrollX();var scrollY=v.getScrollY();var count=group.getChildCount();for(var i=count-1;i>=0;i--){var child=group.getChildAt(i);if(x+scrollX>=child.getLeft()&&x+scrollX<child.getRight()&&y+scrollY>=child.getTop()&&y+scrollY<child.getBottom()&&this.canScroll(child,true,dx,dy,x+scrollX-child.getLeft(),y+scrollY-child.getTop())){return true;}}}return checkV&&(v.canScrollHorizontally(-dx)||v.canScrollVertically(-dy));}},{key:'shouldInterceptTouchEvent',value:function shouldInterceptTouchEvent(ev){var action=ev.getActionMasked();var actionIndex=ev.getActionIndex();if(action==MotionEvent.ACTION_DOWN){this.cancel();}if(this.mVelocityTracker==null){this.mVelocityTracker=VelocityTracker.obtain();}this.mVelocityTracker.addMovement(ev);switch(action){case MotionEvent.ACTION_DOWN:{var _x253=ev.getX();var _y26=ev.getY();var pointerId=ev.getPointerId(0);this.saveInitialMotion(_x253,_y26,pointerId);var toCapture=this.findTopChildUnder(Math.floor(_x253),Math.floor(_y26));if(toCapture==this.mCapturedView&&this.mDragState==ViewDragHelper.STATE_SETTLING){this.tryCaptureViewForDrag(toCapture,pointerId);}var edgesTouched=this.mInitialEdgesTouched[pointerId];if((edgesTouched&this.mTrackingEdges)!=0){this.mCallback.onEdgeTouched(edgesTouched&this.mTrackingEdges,pointerId);}break;}case MotionEvent.ACTION_POINTER_DOWN:{var _pointerId=ev.getPointerId(actionIndex);var _x254=ev.getX(actionIndex);var _y27=ev.getY(actionIndex);this.saveInitialMotion(_x254,_y27,_pointerId);if(this.mDragState==ViewDragHelper.STATE_IDLE){var _edgesTouched=this.mInitialEdgesTouched[_pointerId];if((_edgesTouched&this.mTrackingEdges)!=0){this.mCallback.onEdgeTouched(_edgesTouched&this.mTrackingEdges,_pointerId);}}else if(this.mDragState==ViewDragHelper.STATE_SETTLING){var _toCapture=this.findTopChildUnder(Math.floor(_x254),Math.floor(_y27));if(_toCapture==this.mCapturedView){this.tryCaptureViewForDrag(_toCapture,_pointerId);}}break;}case MotionEvent.ACTION_MOVE:{var pointerCount=ev.getPointerCount();for(var i=0;i<pointerCount;i++){var _pointerId2=ev.getPointerId(i);var _x255=ev.getX(i);var _y28=ev.getY(i);var _dx9=_x255-this.mInitialMotionX[_pointerId2];var _dy5=_y28-this.mInitialMotionY[_pointerId2];this.reportNewEdgeDrags(_dx9,_dy5,_pointerId2);if(this.mDragState==ViewDragHelper.STATE_DRAGGING){break;}var _toCapture2=this.findTopChildUnder(Math.floor(_x255),Math.floor(_y28));if(_toCapture2!=null&&this.checkTouchSlop(_toCapture2,_dx9,_dy5)&&this.tryCaptureViewForDrag(_toCapture2,_pointerId2)){break;}}this.saveLastMotion(ev);break;}case MotionEvent.ACTION_POINTER_UP:{var _pointerId3=ev.getPointerId(actionIndex);this.clearMotionHistory(_pointerId3);break;}case MotionEvent.ACTION_UP:case MotionEvent.ACTION_CANCEL:{this.cancel();break;}}return this.mDragState==ViewDragHelper.STATE_DRAGGING;}},{key:'processTouchEvent',value:function processTouchEvent(ev){var action=ev.getActionMasked();var actionIndex=ev.getActionIndex();if(action==MotionEvent.ACTION_DOWN){this.cancel();}if(this.mVelocityTracker==null){this.mVelocityTracker=VelocityTracker.obtain();}this.mVelocityTracker.addMovement(ev);switch(action){case MotionEvent.ACTION_DOWN:{var _x256=ev.getX();var _y29=ev.getY();var pointerId=ev.getPointerId(0);var toCapture=this.findTopChildUnder(Math.floor(_x256),Math.floor(_y29));this.saveInitialMotion(_x256,_y29,pointerId);this.tryCaptureViewForDrag(toCapture,pointerId);var edgesTouched=this.mInitialEdgesTouched[pointerId];if((edgesTouched&this.mTrackingEdges)!=0){this.mCallback.onEdgeTouched(edgesTouched&this.mTrackingEdges,pointerId);}break;}case MotionEvent.ACTION_POINTER_DOWN:{var _pointerId4=ev.getPointerId(actionIndex);var _x257=ev.getX(actionIndex);var _y30=ev.getY(actionIndex);this.saveInitialMotion(_x257,_y30,_pointerId4);if(this.mDragState==ViewDragHelper.STATE_IDLE){var _toCapture3=this.findTopChildUnder(Math.floor(_x257),Math.floor(_y30));this.tryCaptureViewForDrag(_toCapture3,_pointerId4);var _edgesTouched2=this.mInitialEdgesTouched[_pointerId4];if((_edgesTouched2&this.mTrackingEdges)!=0){this.mCallback.onEdgeTouched(_edgesTouched2&this.mTrackingEdges,_pointerId4);}}else if(this.isCapturedViewUnder(Math.floor(_x257),Math.floor(_y30))){this.tryCaptureViewForDrag(this.mCapturedView,_pointerId4);}break;}case MotionEvent.ACTION_MOVE:{if(this.mDragState==ViewDragHelper.STATE_DRAGGING){var index=ev.findPointerIndex(this.mActivePointerId);var _x258=ev.getX(index);var _y31=ev.getY(index);var idx=Math.floor(_x258-this.mLastMotionX[this.mActivePointerId]);var idy=Math.floor(_y31-this.mLastMotionY[this.mActivePointerId]);this.dragTo(this.mCapturedView.getLeft()+idx,this.mCapturedView.getTop()+idy,idx,idy);this.saveLastMotion(ev);}else{var pointerCount=ev.getPointerCount();for(var i=0;i<pointerCount;i++){var _pointerId5=ev.getPointerId(i);var _x259=ev.getX(i);var _y32=ev.getY(i);var _dx10=_x259-this.mInitialMotionX[_pointerId5];var _dy6=_y32-this.mInitialMotionY[_pointerId5];this.reportNewEdgeDrags(_dx10,_dy6,_pointerId5);if(this.mDragState==ViewDragHelper.STATE_DRAGGING){break;}var _toCapture4=this.findTopChildUnder(Math.floor(_x259),Math.floor(_y32));if(this.checkTouchSlop(_toCapture4,_dx10,_dy6)&&this.tryCaptureViewForDrag(_toCapture4,_pointerId5)){break;}}this.saveLastMotion(ev);}break;}case MotionEvent.ACTION_POINTER_UP:{var _pointerId6=ev.getPointerId(actionIndex);if(this.mDragState==ViewDragHelper.STATE_DRAGGING&&_pointerId6==this.mActivePointerId){var newActivePointer=ViewDragHelper.INVALID_POINTER;var _pointerCount=ev.getPointerCount();for(var _i68=0;_i68<_pointerCount;_i68++){var id=ev.getPointerId(_i68);if(id==this.mActivePointerId){continue;}var _x260=ev.getX(_i68);var _y33=ev.getY(_i68);if(this.findTopChildUnder(Math.floor(_x260),Math.floor(_y33))==this.mCapturedView&&this.tryCaptureViewForDrag(this.mCapturedView,id)){newActivePointer=this.mActivePointerId;break;}}if(newActivePointer==ViewDragHelper.INVALID_POINTER){this.releaseViewForPointerUp();}}this.clearMotionHistory(_pointerId6);break;}case MotionEvent.ACTION_UP:{if(this.mDragState==ViewDragHelper.STATE_DRAGGING){this.releaseViewForPointerUp();}this.cancel();break;}case MotionEvent.ACTION_CANCEL:{if(this.mDragState==ViewDragHelper.STATE_DRAGGING){this.dispatchViewReleased(0,0);}this.cancel();break;}}}},{key:'reportNewEdgeDrags',value:function reportNewEdgeDrags(dx,dy,pointerId){var dragsStarted=0;if(this.checkNewEdgeDrag(dx,dy,pointerId,ViewDragHelper.EDGE_LEFT)){dragsStarted|=ViewDragHelper.EDGE_LEFT;}if(this.checkNewEdgeDrag(dy,dx,pointerId,ViewDragHelper.EDGE_TOP)){dragsStarted|=ViewDragHelper.EDGE_TOP;}if(this.checkNewEdgeDrag(dx,dy,pointerId,ViewDragHelper.EDGE_RIGHT)){dragsStarted|=ViewDragHelper.EDGE_RIGHT;}if(this.checkNewEdgeDrag(dy,dx,pointerId,ViewDragHelper.EDGE_BOTTOM)){dragsStarted|=ViewDragHelper.EDGE_BOTTOM;}if(dragsStarted!=0){this.mEdgeDragsInProgress[pointerId]|=dragsStarted;this.mCallback.onEdgeDragStarted(dragsStarted,pointerId);}}},{key:'checkNewEdgeDrag',value:function checkNewEdgeDrag(delta,odelta,pointerId,edge){var absDelta=Math.abs(delta);var absODelta=Math.abs(odelta);if((this.mInitialEdgesTouched[pointerId]&edge)!=edge||(this.mTrackingEdges&edge)==0||(this.mEdgeDragsLocked[pointerId]&edge)==edge||(this.mEdgeDragsInProgress[pointerId]&edge)==edge||absDelta<=this.mTouchSlop&&absODelta<=this.mTouchSlop){return false;}if(absDelta<absODelta*0.5&&this.mCallback.onEdgeLock(edge)){this.mEdgeDragsLocked[pointerId]|=edge;return false;}return(this.mEdgeDragsInProgress[pointerId]&edge)==0&&absDelta>this.mTouchSlop;}},{key:'checkTouchSlop',value:function checkTouchSlop(){if(arguments.length===1)return this._checkTouchSlop_1(arguments.length<=0?undefined:arguments[0]);if(arguments.length===2)return this._checkTouchSlop_2(arguments.length<=0?undefined:arguments[0],arguments.length<=1?undefined:arguments[1]);if(arguments.length===3)return this._checkTouchSlop_3(arguments.length<=0?undefined:arguments[0],arguments.length<=1?undefined:arguments[1],arguments.length<=2?undefined:arguments[2]);return false;}},{key:'_checkTouchSlop_3',value:function _checkTouchSlop_3(child,dx,dy){if(child==null){return false;}var checkHorizontal=this.mCallback.getViewHorizontalDragRange(child)>0;var checkVertical=this.mCallback.getViewVerticalDragRange(child)>0;if(checkHorizontal&&checkVertical){return dx*dx+dy*dy>this.mTouchSlop*this.mTouchSlop;}else if(checkHorizontal){return Math.abs(dx)>this.mTouchSlop;}else if(checkVertical){return Math.abs(dy)>this.mTouchSlop;}return false;}},{key:'_checkTouchSlop_1',value:function _checkTouchSlop_1(directions){var count=this.mInitialMotionX.length;for(var i=0;i<count;i++){if(this.checkTouchSlop(directions,i)){return true;}}return false;}},{key:'_checkTouchSlop_2',value:function _checkTouchSlop_2(directions,pointerId){if(!this.isPointerDown(pointerId)){return false;}var checkHorizontal=(directions&ViewDragHelper.DIRECTION_HORIZONTAL)==ViewDragHelper.DIRECTION_HORIZONTAL;var checkVertical=(directions&ViewDragHelper.DIRECTION_VERTICAL)==ViewDragHelper.DIRECTION_VERTICAL;var dx=this.mLastMotionX[pointerId]-this.mInitialMotionX[pointerId];var dy=this.mLastMotionY[pointerId]-this.mInitialMotionY[pointerId];if(checkHorizontal&&checkVertical){return dx*dx+dy*dy>this.mTouchSlop*this.mTouchSlop;}else if(checkHorizontal){return Math.abs(dx)>this.mTouchSlop;}else if(checkVertical){return Math.abs(dy)>this.mTouchSlop;}return false;}},{key:'isEdgeTouched',value:function isEdgeTouched(edges,pointerId){if(pointerId==null){var count=this.mInitialEdgesTouched.length;for(var i=0;i<count;i++){if(this.isEdgeTouched(edges,i)){return true;}}}return this.isPointerDown(pointerId)&&(this.mInitialEdgesTouched[pointerId]&edges)!=0;}},{key:'releaseViewForPointerUp',value:function releaseViewForPointerUp(){this.mVelocityTracker.computeCurrentVelocity(1000,this.mMaxVelocity);var xvel=this.clampMag(this.mVelocityTracker.getXVelocity(this.mActivePointerId),this.mMinVelocity,this.mMaxVelocity);var yvel=this.clampMag(this.mVelocityTracker.getYVelocity(this.mActivePointerId),this.mMinVelocity,this.mMaxVelocity);this.dispatchViewReleased(xvel,yvel);}},{key:'dragTo',value:function dragTo(left,top,dx,dy){var clampedX=left;var clampedY=top;var oldLeft=this.mCapturedView.getLeft();var oldTop=this.mCapturedView.getTop();if(dx!=0){clampedX=this.mCallback.clampViewPositionHorizontal(this.mCapturedView,left,dx);this.mCapturedView.offsetLeftAndRight(clampedX-oldLeft);}if(dy!=0){clampedY=this.mCallback.clampViewPositionVertical(this.mCapturedView,top,dy);this.mCapturedView.offsetTopAndBottom(clampedY-oldTop);}if(dx!=0||dy!=0){var clampedDx=clampedX-oldLeft;var clampedDy=clampedY-oldTop;this.mCallback.onViewPositionChanged(this.mCapturedView,clampedX,clampedY,clampedDx,clampedDy);}}},{key:'isCapturedViewUnder',value:function isCapturedViewUnder(x,y){return this.isViewUnder(this.mCapturedView,x,y);}},{key:'isViewUnder',value:function isViewUnder(view,x,y){if(view==null){return false;}return x>=view.getLeft()&&x<view.getRight()&&y>=view.getTop()&&y<view.getBottom();}},{key:'findTopChildUnder',value:function findTopChildUnder(x,y){var childCount=this.mParentView.getChildCount();for(var i=childCount-1;i>=0;i--){var child=this.mParentView.getChildAt(this.mCallback.getOrderedChildIndex(i));if(x>=child.getLeft()&&x<child.getRight()&&y>=child.getTop()&&y<child.getBottom()){return child;}}return null;}},{key:'getEdgesTouched',value:function getEdgesTouched(x,y){var result=0;if(x<this.mParentView.getLeft()+this.mEdgeSize)result|=ViewDragHelper.EDGE_LEFT;if(y<this.mParentView.getTop()+this.mEdgeSize)result|=ViewDragHelper.EDGE_TOP;if(x>this.mParentView.getRight()-this.mEdgeSize)result|=ViewDragHelper.EDGE_RIGHT;if(y>this.mParentView.getBottom()-this.mEdgeSize)result|=ViewDragHelper.EDGE_BOTTOM;return result;}}],[{key:'create',value:function create(){for(var _len35=arguments.length,args=Array(_len35),_key36=0;_key36<_len35;_key36++){args[_key36]=arguments[_key36];}if(args.length===2)return new ViewDragHelper(args[0],args[1]);else if(args.length===3){var forParent=args[0],sensitivity=args[1],cb=args[2];var helper=ViewDragHelper.create(forParent,cb);helper.mTouchSlop=Math.floor(helper.mTouchSlop*(1/sensitivity));return helper;}}}]);return ViewDragHelper;}();ViewDragHelper.TAG=\"ViewDragHelper\";ViewDragHelper.INVALID_POINTER=-1;ViewDragHelper.STATE_IDLE=0;ViewDragHelper.STATE_DRAGGING=1;ViewDragHelper.STATE_SETTLING=2;ViewDragHelper.EDGE_LEFT=1<<0;ViewDragHelper.EDGE_RIGHT=1<<1;ViewDragHelper.EDGE_TOP=1<<2;ViewDragHelper.EDGE_BOTTOM=1<<3;ViewDragHelper.EDGE_ALL=ViewDragHelper.EDGE_LEFT|ViewDragHelper.EDGE_TOP|ViewDragHelper.EDGE_RIGHT|ViewDragHelper.EDGE_BOTTOM;ViewDragHelper.DIRECTION_HORIZONTAL=1<<0;ViewDragHelper.DIRECTION_VERTICAL=1<<1;ViewDragHelper.DIRECTION_ALL=ViewDragHelper.DIRECTION_HORIZONTAL|ViewDragHelper.DIRECTION_VERTICAL;ViewDragHelper.EDGE_SIZE=20;ViewDragHelper.BASE_SETTLE_DURATION=256;ViewDragHelper.MAX_SETTLE_DURATION=600;ViewDragHelper.sInterpolator=function(){var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'getInterpolation',value:function getInterpolation(t){t-=1.0;return t*t*t*t*t+1.0;}}]);return _Inner;}();return new _Inner();}();widget.ViewDragHelper=ViewDragHelper;(function(ViewDragHelper){var Callback=function(){function Callback(){_classCallCheck(this,Callback);}_createClass(Callback,[{key:'onViewDragStateChanged',value:function onViewDragStateChanged(state){}},{key:'onViewPositionChanged',value:function onViewPositionChanged(changedView,left,top,dx,dy){}},{key:'onViewCaptured',value:function onViewCaptured(capturedChild,activePointerId){}},{key:'onViewReleased',value:function onViewReleased(releasedChild,xvel,yvel){}},{key:'onEdgeTouched',value:function onEdgeTouched(edgeFlags,pointerId){}},{key:'onEdgeLock',value:function onEdgeLock(edgeFlags){return false;}},{key:'onEdgeDragStarted',value:function onEdgeDragStarted(edgeFlags,pointerId){}},{key:'getOrderedChildIndex',value:function getOrderedChildIndex(index){return index;}},{key:'getViewHorizontalDragRange',value:function getViewHorizontalDragRange(child){return 0;}},{key:'getViewVerticalDragRange',value:function getViewVerticalDragRange(child){return 0;}},{key:'clampViewPositionHorizontal',value:function clampViewPositionHorizontal(child,left,dx){return 0;}},{key:'clampViewPositionVertical',value:function clampViewPositionVertical(child,top,dy){return 0;}}]);return Callback;}();ViewDragHelper.Callback=Callback;})(ViewDragHelper=widget.ViewDragHelper||(widget.ViewDragHelper={}));})(widget=v4.widget||(v4.widget={}));})(v4=support.v4||(support.v4={}));})(support=android.support||(android.support={}));})(android||(android={}));var android;(function(android){var support;(function(support){var v4;(function(v4){var widget;(function(widget){var Paint=android.graphics.Paint;var PixelFormat=android.graphics.PixelFormat;var SystemClock=android.os.SystemClock;var Gravity=android.view.Gravity;var KeyEvent=android.view.KeyEvent;var MotionEvent=android.view.MotionEvent;var View=android.view.View;var ViewGroup=android.view.ViewGroup;var ViewDragHelper=android.support.v4.widget.ViewDragHelper;var Context=android.content.Context;var DrawerLayout=function(_ViewGroup6){_inherits(DrawerLayout,_ViewGroup6);function DrawerLayout(context,bindElement,defStyle){_classCallCheck(this,DrawerLayout);var _this173=_possibleConstructorReturn(this,(DrawerLayout.__proto__||Object.getPrototypeOf(DrawerLayout)).call(this,context,bindElement,defStyle));_this173.mMinDrawerMargin=0;_this173.mScrimColor=DrawerLayout.DEFAULT_SCRIM_COLOR;_this173.mScrimOpacity=0;_this173.mScrimPaint=new Paint();_this173.mDrawerState=0;_this173.mFirstLayout=true;_this173.mLockModeLeft=0;_this173.mLockModeRight=0;_this173.mInitialMotionX=0;_this173.mInitialMotionY=0;var density=_this173.getResources().getDisplayMetrics().density;_this173.mMinDrawerMargin=Math.floor(DrawerLayout.MIN_DRAWER_MARGIN*density+0.5);var minVel=DrawerLayout.MIN_FLING_VELOCITY*density;_this173.mLeftCallback=new DrawerLayout.ViewDragCallback(_this173,Gravity.LEFT);_this173.mRightCallback=new DrawerLayout.ViewDragCallback(_this173,Gravity.RIGHT);_this173.mLeftDragger=ViewDragHelper.create(_this173,DrawerLayout.TOUCH_SLOP_SENSITIVITY,_this173.mLeftCallback);_this173.mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);_this173.mLeftDragger.setMinVelocity(minVel);_this173.mLeftCallback.setDragger(_this173.mLeftDragger);_this173.mRightDragger=ViewDragHelper.create(_this173,DrawerLayout.TOUCH_SLOP_SENSITIVITY,_this173.mRightCallback);_this173.mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);_this173.mRightDragger.setMinVelocity(minVel);_this173.mRightCallback.setDragger(_this173.mRightDragger);_this173.setFocusableInTouchMode(true);_this173.setMotionEventSplittingEnabled(false);return _this173;}_createClass(DrawerLayout,[{key:'setDrawerShadow',value:function setDrawerShadow(shadowDrawable,gravity){var absGravity=Gravity.getAbsoluteGravity(gravity,this.getLayoutDirection());if((absGravity&Gravity.LEFT)==Gravity.LEFT){this.mShadowLeft=shadowDrawable;this.invalidate();}if((absGravity&Gravity.RIGHT)==Gravity.RIGHT){this.mShadowRight=shadowDrawable;this.invalidate();}}},{key:'setScrimColor',value:function setScrimColor(color){this.mScrimColor=color;this.invalidate();}},{key:'setDrawerListener',value:function setDrawerListener(listener){this.mListener=listener;}},{key:'setDrawerLockMode',value:function setDrawerLockMode(lockMode,edgeGravityOrView){if(edgeGravityOrView==null){this.setDrawerLockMode(lockMode,Gravity.LEFT);this.setDrawerLockMode(lockMode,Gravity.RIGHT);return;}if(edgeGravityOrView instanceof View){if(!this.isDrawerView(edgeGravityOrView)){throw Error('new IllegalArgumentException(\"View \" + drawerView + \" is not a \" + \"drawer with appropriate layout_gravity\")');}var gravity=edgeGravityOrView.getLayoutParams().gravity;this.setDrawerLockMode(lockMode,gravity);return;}var edgeGravity=edgeGravityOrView;var absGravity=Gravity.getAbsoluteGravity(edgeGravity,this.getLayoutDirection());if(absGravity==Gravity.LEFT){this.mLockModeLeft=lockMode;}else if(absGravity==Gravity.RIGHT){this.mLockModeRight=lockMode;}if(lockMode!=DrawerLayout.LOCK_MODE_UNLOCKED){var helper=absGravity==Gravity.LEFT?this.mLeftDragger:this.mRightDragger;helper.cancel();}switch(lockMode){case DrawerLayout.LOCK_MODE_LOCKED_OPEN:var toOpen=this.findDrawerWithGravity(absGravity);if(toOpen!=null){this.openDrawer(toOpen);}break;case DrawerLayout.LOCK_MODE_LOCKED_CLOSED:var toClose=this.findDrawerWithGravity(absGravity);if(toClose!=null){this.closeDrawer(toClose);}break;}}},{key:'getDrawerLockMode',value:function getDrawerLockMode(edgeGravityOrView){if(edgeGravityOrView instanceof View){var drawerView=edgeGravityOrView;var absGravity=this.getDrawerViewAbsoluteGravity(drawerView);if(absGravity==Gravity.LEFT){return this.mLockModeLeft;}else if(absGravity==Gravity.RIGHT){return this.mLockModeRight;}return DrawerLayout.LOCK_MODE_UNLOCKED;}else{var edgeGravity=edgeGravityOrView;var _absGravity=Gravity.getAbsoluteGravity(edgeGravity,this.getLayoutDirection());if(_absGravity==Gravity.LEFT){return this.mLockModeLeft;}else if(_absGravity==Gravity.RIGHT){return this.mLockModeRight;}return DrawerLayout.LOCK_MODE_UNLOCKED;}}},{key:'updateDrawerState',value:function updateDrawerState(forGravity,activeState,activeDrawer){var leftState=this.mLeftDragger.getViewDragState();var rightState=this.mRightDragger.getViewDragState();var state=void 0;if(leftState==DrawerLayout.STATE_DRAGGING||rightState==DrawerLayout.STATE_DRAGGING){state=DrawerLayout.STATE_DRAGGING;}else if(leftState==DrawerLayout.STATE_SETTLING||rightState==DrawerLayout.STATE_SETTLING){state=DrawerLayout.STATE_SETTLING;}else{state=DrawerLayout.STATE_IDLE;}if(activeDrawer!=null&&activeState==DrawerLayout.STATE_IDLE){var lp=activeDrawer.getLayoutParams();if(lp.onScreen==0){this.dispatchOnDrawerClosed(activeDrawer);}else if(lp.onScreen==1){this.dispatchOnDrawerOpened(activeDrawer);}}if(state!=this.mDrawerState){this.mDrawerState=state;if(this.mListener!=null){this.mListener.onDrawerStateChanged(state);}}}},{key:'dispatchOnDrawerClosed',value:function dispatchOnDrawerClosed(drawerView){var lp=drawerView.getLayoutParams();if(lp.knownOpen){lp.knownOpen=false;if(this.mListener!=null){this.mListener.onDrawerClosed(drawerView);}}}},{key:'dispatchOnDrawerOpened',value:function dispatchOnDrawerOpened(drawerView){var lp=drawerView.getLayoutParams();if(!lp.knownOpen){lp.knownOpen=true;if(this.mListener!=null){this.mListener.onDrawerOpened(drawerView);}}}},{key:'dispatchOnDrawerSlide',value:function dispatchOnDrawerSlide(drawerView,slideOffset){if(this.mListener!=null){this.mListener.onDrawerSlide(drawerView,slideOffset);}}},{key:'setDrawerViewOffset',value:function setDrawerViewOffset(drawerView,slideOffset){var lp=drawerView.getLayoutParams();if(slideOffset==lp.onScreen){return;}lp.onScreen=slideOffset;this.dispatchOnDrawerSlide(drawerView,slideOffset);}},{key:'getDrawerViewOffset',value:function getDrawerViewOffset(drawerView){return drawerView.getLayoutParams().onScreen;}},{key:'getDrawerViewAbsoluteGravity',value:function getDrawerViewAbsoluteGravity(drawerView){var gravity=drawerView.getLayoutParams().gravity;return Gravity.getAbsoluteGravity(gravity,this.getLayoutDirection());}},{key:'checkDrawerViewAbsoluteGravity',value:function checkDrawerViewAbsoluteGravity(drawerView,checkFor){var absGravity=this.getDrawerViewAbsoluteGravity(drawerView);return(absGravity&checkFor)==checkFor;}},{key:'findOpenDrawer',value:function findOpenDrawer(){var childCount=this.getChildCount();for(var i=0;i<childCount;i++){var child=this.getChildAt(i);if(child.getLayoutParams().knownOpen){return child;}}return null;}},{key:'moveDrawerToOffset',value:function moveDrawerToOffset(drawerView,slideOffset){var oldOffset=this.getDrawerViewOffset(drawerView);var width=drawerView.getWidth();var oldPos=Math.floor(width*oldOffset);var newPos=Math.floor(width*slideOffset);var dx=newPos-oldPos;drawerView.offsetLeftAndRight(this.checkDrawerViewAbsoluteGravity(drawerView,Gravity.LEFT)?dx:-dx);this.setDrawerViewOffset(drawerView,slideOffset);}},{key:'findDrawerWithGravity',value:function findDrawerWithGravity(gravity){var absHorizGravity=Gravity.getAbsoluteGravity(gravity,this.getLayoutDirection())&Gravity.HORIZONTAL_GRAVITY_MASK;var childCount=this.getChildCount();for(var i=0;i<childCount;i++){var child=this.getChildAt(i);var childAbsGravity=this.getDrawerViewAbsoluteGravity(child);if((childAbsGravity&Gravity.HORIZONTAL_GRAVITY_MASK)==absHorizGravity){return child;}}return null;}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){_get2(DrawerLayout.prototype.__proto__||Object.getPrototypeOf(DrawerLayout.prototype),'onDetachedFromWindow',this).call(this);this.mFirstLayout=true;}},{key:'onAttachedToWindow',value:function onAttachedToWindow(){_get2(DrawerLayout.prototype.__proto__||Object.getPrototypeOf(DrawerLayout.prototype),'onAttachedToWindow',this).call(this);this.mFirstLayout=true;}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){var widthMode=View.MeasureSpec.getMode(widthMeasureSpec);var heightMode=View.MeasureSpec.getMode(heightMeasureSpec);var widthSize=View.MeasureSpec.getSize(widthMeasureSpec);var heightSize=View.MeasureSpec.getSize(heightMeasureSpec);if(widthMode!=View.MeasureSpec.EXACTLY||heightMode!=View.MeasureSpec.EXACTLY){if(this.isInEditMode()){if(widthMode==View.MeasureSpec.AT_MOST){widthMode=View.MeasureSpec.EXACTLY;}else if(widthMode==View.MeasureSpec.UNSPECIFIED){widthMode=View.MeasureSpec.EXACTLY;widthSize=300;}if(heightMode==View.MeasureSpec.AT_MOST){heightMode=View.MeasureSpec.EXACTLY;}else if(heightMode==View.MeasureSpec.UNSPECIFIED){heightMode=View.MeasureSpec.EXACTLY;heightSize=300;}}else{throw Error('new IllegalArgumentException(\"DrawerLayout must be measured with MeasureSpec.EXACTLY.\")');}}this.setMeasuredDimension(widthSize,heightSize);var foundDrawers=0;var childCount=this.getChildCount();for(var i=0;i<childCount;i++){var child=this.getChildAt(i);if(child.getVisibility()==DrawerLayout.GONE){continue;}var lp=child.getLayoutParams();if(this.isContentView(child)){var contentWidthSpec=View.MeasureSpec.makeMeasureSpec(widthSize-lp.leftMargin-lp.rightMargin,View.MeasureSpec.EXACTLY);var contentHeightSpec=View.MeasureSpec.makeMeasureSpec(heightSize-lp.topMargin-lp.bottomMargin,View.MeasureSpec.EXACTLY);child.measure(contentWidthSpec,contentHeightSpec);}else if(this.isDrawerView(child)){var childGravity=this.getDrawerViewAbsoluteGravity(child)&Gravity.HORIZONTAL_GRAVITY_MASK;if((foundDrawers&childGravity)!=0){throw Error('new IllegalStateException(\"Child drawer has absolute gravity \" + DrawerLayout.gravityToString(childGravity) + \" but this \" + DrawerLayout.TAG + \" already has a \" + \"drawer view along that edge\")');}var drawerWidthSpec=DrawerLayout.getChildMeasureSpec(widthMeasureSpec,this.mMinDrawerMargin+lp.leftMargin+lp.rightMargin,lp.width);var drawerHeightSpec=DrawerLayout.getChildMeasureSpec(heightMeasureSpec,lp.topMargin+lp.bottomMargin,lp.height);child.measure(drawerWidthSpec,drawerHeightSpec);}else{throw Error('new IllegalStateException(\"Child \" + child + \" at index \" + i + \" does not have a valid layout_gravity - must be Gravity.LEFT, \" + \"Gravity.RIGHT or Gravity.NO_GRAVITY\")');}}}},{key:'onLayout',value:function onLayout(changed,l,t,r,b){this.mInLayout=true;var width=r-l;var childCount=this.getChildCount();for(var i=0;i<childCount;i++){var child=this.getChildAt(i);if(child.getVisibility()==DrawerLayout.GONE){continue;}var lp=child.getLayoutParams();if(this.isContentView(child)){child.layout(lp.leftMargin,lp.topMargin,lp.leftMargin+child.getMeasuredWidth(),lp.topMargin+child.getMeasuredHeight());}else{var childWidth=child.getMeasuredWidth();var childHeight=child.getMeasuredHeight();var childLeft=void 0;var newOffset=void 0;if(this.checkDrawerViewAbsoluteGravity(child,Gravity.LEFT)){childLeft=-childWidth+Math.floor(childWidth*lp.onScreen);newOffset=(childWidth+childLeft)/childWidth;}else{childLeft=width-Math.floor(childWidth*lp.onScreen);newOffset=(width-childLeft)/childWidth;}var changeOffset=newOffset!=lp.onScreen;var vgrav=lp.gravity&Gravity.VERTICAL_GRAVITY_MASK;switch(vgrav){default:case Gravity.TOP:{child.layout(childLeft,lp.topMargin,childLeft+childWidth,lp.topMargin+childHeight);break;}case Gravity.BOTTOM:{var height=b-t;child.layout(childLeft,height-lp.bottomMargin-child.getMeasuredHeight(),childLeft+childWidth,height-lp.bottomMargin);break;}case Gravity.CENTER_VERTICAL:{var _height=b-t;var childTop=(_height-childHeight)/2;if(childTop<lp.topMargin){childTop=lp.topMargin;}else if(childTop+childHeight>_height-lp.bottomMargin){childTop=_height-lp.bottomMargin-childHeight;}child.layout(childLeft,childTop,childLeft+childWidth,childTop+childHeight);break;}}if(changeOffset){this.setDrawerViewOffset(child,newOffset);}var newVisibility=lp.onScreen>0?DrawerLayout.VISIBLE:DrawerLayout.INVISIBLE;if(child.getVisibility()!=newVisibility){child.setVisibility(newVisibility);}}}this.mInLayout=false;this.mFirstLayout=false;}},{key:'requestLayout',value:function requestLayout(){if(!this.mInLayout){_get2(DrawerLayout.prototype.__proto__||Object.getPrototypeOf(DrawerLayout.prototype),'requestLayout',this).call(this);}}},{key:'computeScroll',value:function computeScroll(){var childCount=this.getChildCount();var scrimOpacity=0;for(var i=0;i<childCount;i++){var onscreen=this.getChildAt(i).getLayoutParams().onScreen;scrimOpacity=Math.max(scrimOpacity,onscreen);}this.mScrimOpacity=scrimOpacity;var leftContinue=this.mLeftDragger.continueSettling(true);var rightContinue=this.mRightDragger.continueSettling(true);if(leftContinue||rightContinue){this.postInvalidateOnAnimation();}}},{key:'drawChild',value:function drawChild(canvas,child,drawingTime){var height=this.getHeight();var drawingContent=this.isContentView(child);var clipLeft=0,clipRight=this.getWidth();var restoreCount=canvas.save();if(drawingContent){var childCount=this.getChildCount();for(var i=0;i<childCount;i++){var v=this.getChildAt(i);if(v==child||v.getVisibility()!=DrawerLayout.VISIBLE||!DrawerLayout.hasOpaqueBackground(v)||!this.isDrawerView(v)||v.getHeight()<height){continue;}if(this.checkDrawerViewAbsoluteGravity(v,Gravity.LEFT)){var vright=v.getRight();if(vright>clipLeft)clipLeft=vright;}else{var vleft=v.getLeft();if(vleft<clipRight)clipRight=vleft;}}canvas.clipRect(clipLeft,0,clipRight,this.getHeight());}var result=_get2(DrawerLayout.prototype.__proto__||Object.getPrototypeOf(DrawerLayout.prototype),'drawChild',this).call(this,canvas,child,drawingTime);canvas.restoreToCount(restoreCount);if(this.mScrimOpacity>0&&drawingContent){var baseAlpha=(this.mScrimColor&0xff000000)>>>24;var imag=Math.floor(baseAlpha*this.mScrimOpacity);var color=imag<<24|this.mScrimColor&0xffffff;this.mScrimPaint.setColor(color);canvas.drawRect(clipLeft,0,clipRight,this.getHeight(),this.mScrimPaint);}else if(this.mShadowLeft!=null&&this.checkDrawerViewAbsoluteGravity(child,Gravity.LEFT)){var shadowWidth=this.mShadowLeft.getIntrinsicWidth();var childRight=child.getRight();var drawerPeekDistance=this.mLeftDragger.getEdgeSize();var alpha=Math.max(0,Math.min(childRight/drawerPeekDistance,1.));this.mShadowLeft.setBounds(childRight,child.getTop(),childRight+shadowWidth,child.getBottom());this.mShadowLeft.setAlpha(Math.floor(0xff*alpha));this.mShadowLeft.draw(canvas);}else if(this.mShadowRight!=null&&this.checkDrawerViewAbsoluteGravity(child,Gravity.RIGHT)){var _shadowWidth=this.mShadowRight.getIntrinsicWidth();var childLeft=child.getLeft();var showing=this.getWidth()-childLeft;var _drawerPeekDistance=this.mRightDragger.getEdgeSize();var _alpha=Math.max(0,Math.min(showing/_drawerPeekDistance,1.));this.mShadowRight.setBounds(childLeft-_shadowWidth,child.getTop(),childLeft,child.getBottom());this.mShadowRight.setAlpha(Math.floor(0xff*_alpha));this.mShadowRight.draw(canvas);}return result;}},{key:'isContentView',value:function isContentView(child){return child.getLayoutParams().gravity==Gravity.NO_GRAVITY;}},{key:'isDrawerView',value:function isDrawerView(child){var gravity=child.getLayoutParams().gravity;var absGravity=Gravity.getAbsoluteGravity(gravity,child.getLayoutDirection());return(absGravity&(Gravity.LEFT|Gravity.RIGHT))!=0;}},{key:'onInterceptTouchEvent',value:function onInterceptTouchEvent(ev){var action=ev.getActionMasked();var leftIntercept=this.mLeftDragger.shouldInterceptTouchEvent(ev);var rightIntercept=this.mRightDragger.shouldInterceptTouchEvent(ev);var interceptForDrag=leftIntercept||rightIntercept;var interceptForTap=false;switch(action){case MotionEvent.ACTION_DOWN:{var _x261=ev.getX();var _y34=ev.getY();this.mInitialMotionX=_x261;this.mInitialMotionY=_y34;if(this.mScrimOpacity>0&&this.isContentView(this.mLeftDragger.findTopChildUnder(Math.floor(_x261),Math.floor(_y34)))){interceptForTap=true;}this.mDisallowInterceptRequested=false;this.mChildrenCanceledTouch=false;break;}case MotionEvent.ACTION_MOVE:{if(this.mLeftDragger.checkTouchSlop(ViewDragHelper.DIRECTION_ALL)){this.mLeftCallback.removeCallbacks();this.mRightCallback.removeCallbacks();}break;}case MotionEvent.ACTION_CANCEL:case MotionEvent.ACTION_UP:{this.closeDrawers(true);this.mDisallowInterceptRequested=false;this.mChildrenCanceledTouch=false;}}return interceptForDrag||interceptForTap||this.hasPeekingDrawer()||this.mChildrenCanceledTouch;}},{key:'onTouchEvent',value:function onTouchEvent(ev){this.mLeftDragger.processTouchEvent(ev);this.mRightDragger.processTouchEvent(ev);var action=ev.getAction();var wantTouchEvents=true;switch(action&MotionEvent.ACTION_MASK){case MotionEvent.ACTION_DOWN:{var _x262=ev.getX();var _y35=ev.getY();this.mInitialMotionX=_x262;this.mInitialMotionY=_y35;this.mDisallowInterceptRequested=false;this.mChildrenCanceledTouch=false;break;}case MotionEvent.ACTION_UP:{var _x263=ev.getX();var _y36=ev.getY();var peekingOnly=true;var touchedView=this.mLeftDragger.findTopChildUnder(Math.floor(_x263),Math.floor(_y36));if(touchedView!=null&&this.isContentView(touchedView)){var _dx11=_x263-this.mInitialMotionX;var _dy7=_y36-this.mInitialMotionY;var slop=this.mLeftDragger.getTouchSlop();if(_dx11*_dx11+_dy7*_dy7<slop*slop){var openDrawer=this.findOpenDrawer();if(openDrawer!=null){peekingOnly=this.getDrawerLockMode(openDrawer)==DrawerLayout.LOCK_MODE_LOCKED_OPEN;}}}this.closeDrawers(peekingOnly);this.mDisallowInterceptRequested=false;break;}case MotionEvent.ACTION_CANCEL:{this.closeDrawers(true);this.mDisallowInterceptRequested=false;this.mChildrenCanceledTouch=false;break;}}return wantTouchEvents;}},{key:'requestDisallowInterceptTouchEvent',value:function requestDisallowInterceptTouchEvent(disallowIntercept){if(DrawerLayout.CHILDREN_DISALLOW_INTERCEPT||!this.mLeftDragger.isEdgeTouched(ViewDragHelper.EDGE_LEFT)&&!this.mRightDragger.isEdgeTouched(ViewDragHelper.EDGE_RIGHT)){_get2(DrawerLayout.prototype.__proto__||Object.getPrototypeOf(DrawerLayout.prototype),'requestDisallowInterceptTouchEvent',this).call(this,disallowIntercept);}this.mDisallowInterceptRequested=disallowIntercept;if(disallowIntercept){this.closeDrawers(true);}}},{key:'closeDrawers',value:function closeDrawers(){var peekingOnly=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var needsInvalidate=false;var childCount=this.getChildCount();for(var i=0;i<childCount;i++){var child=this.getChildAt(i);var lp=child.getLayoutParams();if(!this.isDrawerView(child)||peekingOnly&&!lp.isPeeking){continue;}var childWidth=child.getWidth();if(this.checkDrawerViewAbsoluteGravity(child,Gravity.LEFT)){needsInvalidate=this.mLeftDragger.smoothSlideViewTo(child,-childWidth,child.getTop())||needsInvalidate;}else{needsInvalidate=this.mRightDragger.smoothSlideViewTo(child,this.getWidth(),child.getTop())||needsInvalidate;}lp.isPeeking=false;}this.mLeftCallback.removeCallbacks();this.mRightCallback.removeCallbacks();if(needsInvalidate){this.invalidate();}}},{key:'openDrawer',value:function openDrawer(arg){if(arg instanceof View){this._openDrawer_view(arg);}else{this._openDrawer_gravity(arg);}}},{key:'_openDrawer_view',value:function _openDrawer_view(drawerView){if(!this.isDrawerView(drawerView)){throw Error('new IllegalArgumentException(\"View \" + drawerView + \" is not a sliding drawer\")');}if(this.mFirstLayout){var lp=drawerView.getLayoutParams();lp.onScreen=1.;lp.knownOpen=true;}else{if(this.checkDrawerViewAbsoluteGravity(drawerView,Gravity.LEFT)){this.mLeftDragger.smoothSlideViewTo(drawerView,0,drawerView.getTop());}else{this.mRightDragger.smoothSlideViewTo(drawerView,this.getWidth()-drawerView.getWidth(),drawerView.getTop());}}this.invalidate();}},{key:'_openDrawer_gravity',value:function _openDrawer_gravity(gravity){var drawerView=this.findDrawerWithGravity(gravity);if(drawerView==null){throw Error('new IllegalArgumentException(\"No drawer view found with gravity \" + DrawerLayout.gravityToString(gravity))');}this.openDrawer(drawerView);}},{key:'closeDrawer',value:function closeDrawer(arg){if(arg instanceof View){this._closeDrawer_view(arg);}else{this._closeDrawer_gravity(arg);}}},{key:'_closeDrawer_view',value:function _closeDrawer_view(drawerView){if(!this.isDrawerView(drawerView)){throw Error('new IllegalArgumentException(\"View \" + drawerView + \" is not a sliding drawer\")');}if(this.mFirstLayout){var lp=drawerView.getLayoutParams();lp.onScreen=0.;lp.knownOpen=false;}else{if(this.checkDrawerViewAbsoluteGravity(drawerView,Gravity.LEFT)){this.mLeftDragger.smoothSlideViewTo(drawerView,-drawerView.getWidth(),drawerView.getTop());}else{this.mRightDragger.smoothSlideViewTo(drawerView,this.getWidth(),drawerView.getTop());}}this.invalidate();}},{key:'_closeDrawer_gravity',value:function _closeDrawer_gravity(gravity){var drawerView=this.findDrawerWithGravity(gravity);if(drawerView==null){throw Error('new IllegalArgumentException(\"No drawer view found with gravity \" + DrawerLayout.gravityToString(gravity))');}this.closeDrawer(drawerView);}},{key:'isDrawerOpen',value:function isDrawerOpen(arg){if(arg instanceof View){return this._isDrawerOpen_view(arg);}else{return this._isDrawerOpen_gravity(arg);}}},{key:'_isDrawerOpen_view',value:function _isDrawerOpen_view(drawer){if(!this.isDrawerView(drawer)){throw Error('new IllegalArgumentException(\"View \" + drawer + \" is not a drawer\")');}return drawer.getLayoutParams().knownOpen;}},{key:'_isDrawerOpen_gravity',value:function _isDrawerOpen_gravity(drawerGravity){var drawerView=this.findDrawerWithGravity(drawerGravity);if(drawerView!=null){return this.isDrawerOpen(drawerView);}return false;}},{key:'isDrawerVisible',value:function isDrawerVisible(arg){if(arg instanceof View){return this._isDrawerVisible_view(arg);}else{return this._isDrawerVisible_gravity(arg);}}},{key:'_isDrawerVisible_view',value:function _isDrawerVisible_view(drawer){if(!this.isDrawerView(drawer)){throw Error('new IllegalArgumentException(\"View \" + drawer + \" is not a drawer\")');}return drawer.getLayoutParams().onScreen>0;}},{key:'_isDrawerVisible_gravity',value:function _isDrawerVisible_gravity(drawerGravity){var drawerView=this.findDrawerWithGravity(drawerGravity);if(drawerView!=null){return this.isDrawerVisible(drawerView);}return false;}},{key:'hasPeekingDrawer',value:function hasPeekingDrawer(){var childCount=this.getChildCount();for(var i=0;i<childCount;i++){var lp=this.getChildAt(i).getLayoutParams();if(lp.isPeeking){return true;}}return false;}},{key:'generateDefaultLayoutParams',value:function generateDefaultLayoutParams(){return new DrawerLayout.LayoutParams(DrawerLayout.LayoutParams.FILL_PARENT,DrawerLayout.LayoutParams.FILL_PARENT);}},{key:'generateLayoutParams',value:function generateLayoutParams(p){return p instanceof DrawerLayout.LayoutParams?new DrawerLayout.LayoutParams(p):p instanceof ViewGroup.MarginLayoutParams?new DrawerLayout.LayoutParams(p):new DrawerLayout.LayoutParams(p);}},{key:'checkLayoutParams',value:function checkLayoutParams(p){return p instanceof DrawerLayout.LayoutParams&&_get2(DrawerLayout.prototype.__proto__||Object.getPrototypeOf(DrawerLayout.prototype),'checkLayoutParams',this).call(this,p);}},{key:'generateLayoutParamsFromAttr',value:function generateLayoutParamsFromAttr(attrs){return new DrawerLayout.LayoutParams(this.getContext(),attrs);}},{key:'hasVisibleDrawer',value:function hasVisibleDrawer(){return this.findVisibleDrawer()!=null;}},{key:'findVisibleDrawer',value:function findVisibleDrawer(){var childCount=this.getChildCount();for(var i=0;i<childCount;i++){var child=this.getChildAt(i);if(this.isDrawerView(child)&&this.isDrawerVisible(child)){return child;}}return null;}},{key:'cancelChildViewTouch',value:function cancelChildViewTouch(){if(!this.mChildrenCanceledTouch){var now=SystemClock.uptimeMillis();var cancelEvent=MotionEvent.obtainWithAction(now,now,MotionEvent.ACTION_CANCEL,0.0,0.0,0);var childCount=this.getChildCount();for(var i=0;i<childCount;i++){this.getChildAt(i).dispatchTouchEvent(cancelEvent);}cancelEvent.recycle();this.mChildrenCanceledTouch=true;}}},{key:'onKeyDown',value:function onKeyDown(keyCode,event){if(keyCode==KeyEvent.KEYCODE_BACK&&this.hasVisibleDrawer()){event.startTracking();return true;}return _get2(DrawerLayout.prototype.__proto__||Object.getPrototypeOf(DrawerLayout.prototype),'onKeyDown',this).call(this,keyCode,event);}},{key:'onKeyUp',value:function onKeyUp(keyCode,event){if(keyCode==KeyEvent.KEYCODE_BACK){var visibleDrawer=this.findVisibleDrawer();if(visibleDrawer!=null&&this.getDrawerLockMode(visibleDrawer)==DrawerLayout.LOCK_MODE_UNLOCKED){this.closeDrawers();}return visibleDrawer!=null;}return _get2(DrawerLayout.prototype.__proto__||Object.getPrototypeOf(DrawerLayout.prototype),'onKeyUp',this).call(this,keyCode,event);}}],[{key:'gravityToString',value:function gravityToString(gravity){if((gravity&Gravity.LEFT)==Gravity.LEFT){return\"LEFT\";}if((gravity&Gravity.RIGHT)==Gravity.RIGHT){return\"RIGHT\";}return''+gravity;}},{key:'hasOpaqueBackground',value:function hasOpaqueBackground(v){var bg=v.getBackground();if(bg!=null){return bg.getOpacity()==PixelFormat.OPAQUE;}return false;}}]);return DrawerLayout;}(ViewGroup);DrawerLayout.TAG=\"DrawerLayout\";DrawerLayout.STATE_IDLE=ViewDragHelper.STATE_IDLE;DrawerLayout.STATE_DRAGGING=ViewDragHelper.STATE_DRAGGING;DrawerLayout.STATE_SETTLING=ViewDragHelper.STATE_SETTLING;DrawerLayout.LOCK_MODE_UNLOCKED=0;DrawerLayout.LOCK_MODE_LOCKED_CLOSED=1;DrawerLayout.LOCK_MODE_LOCKED_OPEN=2;DrawerLayout.MIN_DRAWER_MARGIN=64;DrawerLayout.DEFAULT_SCRIM_COLOR=0x99000000;DrawerLayout.PEEK_DELAY=160;DrawerLayout.MIN_FLING_VELOCITY=400;DrawerLayout.ALLOW_EDGE_LOCK=false;DrawerLayout.CHILDREN_DISALLOW_INTERCEPT=true;DrawerLayout.TOUCH_SLOP_SENSITIVITY=1.;widget.DrawerLayout=DrawerLayout;(function(DrawerLayout){var SimpleDrawerListener=function(){function SimpleDrawerListener(){_classCallCheck(this,SimpleDrawerListener);}_createClass(SimpleDrawerListener,[{key:'onDrawerSlide',value:function onDrawerSlide(drawerView,slideOffset){}},{key:'onDrawerOpened',value:function onDrawerOpened(drawerView){}},{key:'onDrawerClosed',value:function onDrawerClosed(drawerView){}},{key:'onDrawerStateChanged',value:function onDrawerStateChanged(newState){}}]);return SimpleDrawerListener;}();DrawerLayout.SimpleDrawerListener=SimpleDrawerListener;var ViewDragCallback=function(_ViewDragHelper$Callb){_inherits(ViewDragCallback,_ViewDragHelper$Callb);function ViewDragCallback(arg,gravity){_classCallCheck(this,ViewDragCallback);var _this174=_possibleConstructorReturn(this,(ViewDragCallback.__proto__||Object.getPrototypeOf(ViewDragCallback)).call(this));_this174.mAbsGravity=0;_this174.mPeekRunnable=function(){var inner_this=_this174;var _Inner=function(){function _Inner(){_classCallCheck(this,_Inner);}_createClass(_Inner,[{key:'run',value:function run(){inner_this.peekDrawer();}}]);return _Inner;}();return new _Inner();}();_this174._DrawerLayout_this=arg;_this174.mAbsGravity=gravity;return _this174;}_createClass(ViewDragCallback,[{key:'setDragger',value:function setDragger(dragger){this.mDragger=dragger;}},{key:'removeCallbacks',value:function removeCallbacks(){this._DrawerLayout_this.removeCallbacks(this.mPeekRunnable);}},{key:'tryCaptureView',value:function tryCaptureView(child,pointerId){return this._DrawerLayout_this.isDrawerView(child)&&this._DrawerLayout_this.checkDrawerViewAbsoluteGravity(child,this.mAbsGravity)&&this._DrawerLayout_this.getDrawerLockMode(child)==DrawerLayout.LOCK_MODE_UNLOCKED;}},{key:'onViewDragStateChanged',value:function onViewDragStateChanged(state){this._DrawerLayout_this.updateDrawerState(this.mAbsGravity,state,this.mDragger.getCapturedView());}},{key:'onViewPositionChanged',value:function onViewPositionChanged(changedView,left,top,dx,dy){var offset=void 0;var childWidth=changedView.getWidth();if(this._DrawerLayout_this.checkDrawerViewAbsoluteGravity(changedView,Gravity.LEFT)){offset=(childWidth+left)/childWidth;}else{var width=this._DrawerLayout_this.getWidth();offset=(width-left)/childWidth;}this._DrawerLayout_this.setDrawerViewOffset(changedView,offset);changedView.setVisibility(offset==0?DrawerLayout.INVISIBLE:DrawerLayout.VISIBLE);this._DrawerLayout_this.invalidate();}},{key:'onViewCaptured',value:function onViewCaptured(capturedChild,activePointerId){var lp=capturedChild.getLayoutParams();lp.isPeeking=false;this.closeOtherDrawer();}},{key:'closeOtherDrawer',value:function closeOtherDrawer(){var otherGrav=this.mAbsGravity==Gravity.LEFT?Gravity.RIGHT:Gravity.LEFT;var toClose=this._DrawerLayout_this.findDrawerWithGravity(otherGrav);if(toClose!=null){this._DrawerLayout_this.closeDrawer(toClose);}}},{key:'onViewReleased',value:function onViewReleased(releasedChild,xvel,yvel){var offset=this._DrawerLayout_this.getDrawerViewOffset(releasedChild);var childWidth=releasedChild.getWidth();var left=void 0;if(this._DrawerLayout_this.checkDrawerViewAbsoluteGravity(releasedChild,Gravity.LEFT)){left=xvel>0||xvel==0&&offset>0.5?0:-childWidth;}else{var width=this._DrawerLayout_this.getWidth();left=xvel<0||xvel==0&&offset>0.5?width-childWidth:width;}this.mDragger.settleCapturedViewAt(left,releasedChild.getTop());this._DrawerLayout_this.invalidate();}},{key:'onEdgeTouched',value:function onEdgeTouched(edgeFlags,pointerId){this._DrawerLayout_this.postDelayed(this.mPeekRunnable,DrawerLayout.PEEK_DELAY);}},{key:'peekDrawer',value:function peekDrawer(){var toCapture=void 0;var childLeft=void 0;var peekDistance=this.mDragger.getEdgeSize();var leftEdge=this.mAbsGravity==Gravity.LEFT;if(leftEdge){toCapture=this._DrawerLayout_this.findDrawerWithGravity(Gravity.LEFT);childLeft=(toCapture!=null?-toCapture.getWidth():0)+peekDistance;}else{toCapture=this._DrawerLayout_this.findDrawerWithGravity(Gravity.RIGHT);childLeft=this._DrawerLayout_this.getWidth()-peekDistance;}if(toCapture!=null&&(leftEdge&&toCapture.getLeft()<childLeft||!leftEdge&&toCapture.getLeft()>childLeft)&&this._DrawerLayout_this.getDrawerLockMode(toCapture)==DrawerLayout.LOCK_MODE_UNLOCKED){var lp=toCapture.getLayoutParams();this.mDragger.smoothSlideViewTo(toCapture,childLeft,toCapture.getTop());lp.isPeeking=true;this._DrawerLayout_this.invalidate();this.closeOtherDrawer();this._DrawerLayout_this.cancelChildViewTouch();}}},{key:'onEdgeLock',value:function onEdgeLock(edgeFlags){if(DrawerLayout.ALLOW_EDGE_LOCK){var drawer=this._DrawerLayout_this.findDrawerWithGravity(this.mAbsGravity);if(drawer!=null&&!this._DrawerLayout_this.isDrawerOpen(drawer)){this._DrawerLayout_this.closeDrawer(drawer);}return true;}return false;}},{key:'onEdgeDragStarted',value:function onEdgeDragStarted(edgeFlags,pointerId){var toCapture=void 0;if((edgeFlags&ViewDragHelper.EDGE_LEFT)==ViewDragHelper.EDGE_LEFT){toCapture=this._DrawerLayout_this.findDrawerWithGravity(Gravity.LEFT);}else{toCapture=this._DrawerLayout_this.findDrawerWithGravity(Gravity.RIGHT);}if(toCapture!=null&&this._DrawerLayout_this.getDrawerLockMode(toCapture)==DrawerLayout.LOCK_MODE_UNLOCKED){this.mDragger.captureChildView(toCapture,pointerId);}}},{key:'getViewHorizontalDragRange',value:function getViewHorizontalDragRange(child){return child.getWidth();}},{key:'clampViewPositionHorizontal',value:function clampViewPositionHorizontal(child,left,dx){if(this._DrawerLayout_this.checkDrawerViewAbsoluteGravity(child,Gravity.LEFT)){return Math.max(-child.getWidth(),Math.min(left,0));}else{var width=this._DrawerLayout_this.getWidth();return Math.max(width-child.getWidth(),Math.min(left,width));}}},{key:'clampViewPositionVertical',value:function clampViewPositionVertical(child,top,dy){return child.getTop();}}]);return ViewDragCallback;}(ViewDragHelper.Callback);DrawerLayout.ViewDragCallback=ViewDragCallback;var LayoutParams=function(_ViewGroup$MarginLayo3){_inherits(LayoutParams,_ViewGroup$MarginLayo3);function LayoutParams(){var _ref11;for(var _len36=arguments.length,args=Array(_len36),_key37=0;_key37<_len36;_key37++){args[_key37]=arguments[_key37];}_classCallCheck(this,LayoutParams);var _this175=_possibleConstructorReturn(this,(_ref11=LayoutParams.__proto__||Object.getPrototypeOf(LayoutParams)).call.apply(_ref11,[this].concat(_toConsumableArray(function(){if(args[0]instanceof android.content.Context&&args[1]instanceof HTMLElement)return[args[0],args[1]];else if(typeof args[0]==='number'&&typeof args[1]==='number'&&typeof args[2]==='number')return[args[0],args[1]];else if(typeof args[0]==='number'&&typeof args[1]==='number')return[args[0],args[1]];else if(args[0]instanceof DrawerLayout.LayoutParams)return[args[0]];else if(args[0]instanceof ViewGroup.MarginLayoutParams)return[args[0]];else if(args[0]instanceof ViewGroup.LayoutParams)return[args[0]];}()))));_this175.gravity=Gravity.NO_GRAVITY;_this175.onScreen=0;if(args[0]instanceof Context&&args[1]instanceof HTMLElement){var c=args[0];var attrs=args[1];var _a16=c.obtainStyledAttributes(attrs);_this175.gravity=Gravity.parseGravity(_a16.getAttrValue('layout_gravity'),Gravity.NO_GRAVITY);_a16.recycle();}else if(typeof args[0]==='number'&&typeof args[1]==='number'&&typeof args[2]=='number'){_this175.gravity=args[2];}else if(typeof args[0]==='number'&&typeof args[1]==='number'){}else if(args[0]instanceof DrawerLayout.LayoutParams){var source=args[0];_this175.gravity=source.gravity;}else if(args[0]instanceof ViewGroup.MarginLayoutParams){}else if(args[0]instanceof ViewGroup.LayoutParams){}return _this175;}_createClass(LayoutParams,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(LayoutParams.prototype.__proto__||Object.getPrototypeOf(LayoutParams.prototype),'createClassAttrBinder',this).call(this).set('layout_gravity',{setter:function setter(param,value,attrBinder){param.gravity=attrBinder.parseGravity(value,param.gravity);},getter:function getter(param){return param.gravity;}});}}]);return LayoutParams;}(ViewGroup.MarginLayoutParams);DrawerLayout.LayoutParams=LayoutParams;})(DrawerLayout=widget.DrawerLayout||(widget.DrawerLayout={}));})(widget=v4.widget||(v4.widget={}));})(v4=support.v4||(support.v4={}));})(support=android.support||(android.support={}));})(android||(android={}));var com;(function(com){var jakewharton;(function(jakewharton){var salvage;(function(salvage){var SparseArray=android.util.SparseArray;var PagerAdapter=android.support.v4.view.PagerAdapter;var RecyclingPagerAdapter=function(_PagerAdapter){_inherits(RecyclingPagerAdapter,_PagerAdapter);function RecyclingPagerAdapter(){_classCallCheck(this,RecyclingPagerAdapter);var _this176=_possibleConstructorReturn(this,(RecyclingPagerAdapter.__proto__||Object.getPrototypeOf(RecyclingPagerAdapter)).call(this));_this176.recycleBin=new RecycleBin();_this176.recycleBin.setViewTypeCount(_this176.getViewTypeCount());return _this176;}_createClass(RecyclingPagerAdapter,[{key:'notifyDataSetChanged',value:function notifyDataSetChanged(){this.recycleBin.scrapActiveViews();_get2(RecyclingPagerAdapter.prototype.__proto__||Object.getPrototypeOf(RecyclingPagerAdapter.prototype),'notifyDataSetChanged',this).call(this);}},{key:'instantiateItem',value:function instantiateItem(container,position){var viewType=this.getItemViewType(position);var view=null;if(viewType!=RecyclingPagerAdapter.IGNORE_ITEM_VIEW_TYPE){view=this.recycleBin.getScrapView(position,viewType);}view=this.getView(position,view,container);container.addView(view);return view;}},{key:'destroyItem',value:function destroyItem(container,position,object){var view=object;container.removeView(view);var viewType=this.getItemViewType(position);if(viewType!=RecyclingPagerAdapter.IGNORE_ITEM_VIEW_TYPE){this.recycleBin.addScrapView(view,position,viewType);}}},{key:'isViewFromObject',value:function isViewFromObject(view,object){return view===object;}},{key:'getViewTypeCount',value:function getViewTypeCount(){return 1;}},{key:'getItemViewType',value:function getItemViewType(position){return 0;}}]);return RecyclingPagerAdapter;}(PagerAdapter);RecyclingPagerAdapter.IGNORE_ITEM_VIEW_TYPE=-1;salvage.RecyclingPagerAdapter=RecyclingPagerAdapter;var RecycleBin=function(){function RecycleBin(){_classCallCheck(this,RecycleBin);this.activeViews=[];this.activeViewTypes=[];this.viewTypeCount=0;}_createClass(RecycleBin,[{key:'setViewTypeCount',value:function setViewTypeCount(viewTypeCount){if(viewTypeCount<1){throw new Error(\"Can't have a viewTypeCount < 1\");}var scrapViews=new Array(viewTypeCount);for(var i=0;i<viewTypeCount;i++){scrapViews[i]=new SparseArray();}this.viewTypeCount=viewTypeCount;this.currentScrapViews=scrapViews[0];this.scrapViews=scrapViews;}},{key:'shouldRecycleViewType',value:function shouldRecycleViewType(viewType){return viewType>=0;}},{key:'getScrapView',value:function getScrapView(position,viewType){if(this.viewTypeCount==1){return this.retrieveFromScrap(this.currentScrapViews,position);}else if(viewType>=0&&viewType<this.scrapViews.length){return this.retrieveFromScrap(this.scrapViews[viewType],position);}return null;}},{key:'addScrapView',value:function addScrapView(scrap,position,viewType){if(this.viewTypeCount==1){this.currentScrapViews.put(position,scrap);}else{this.scrapViews[viewType].put(position,scrap);}}},{key:'scrapActiveViews',value:function scrapActiveViews(){var activeViews=this.activeViews;var activeViewTypes=this.activeViewTypes;var multipleScraps=this.viewTypeCount>1;var scrapViews=this.currentScrapViews;var count=activeViews.length;for(var i=count-1;i>=0;i--){var victim=activeViews[i];if(victim!=null){var whichScrap=activeViewTypes[i];activeViews[i]=null;activeViewTypes[i]=-1;if(!this.shouldRecycleViewType(whichScrap)){continue;}if(multipleScraps){scrapViews=this.scrapViews[whichScrap];}scrapViews.put(i,victim);}}this.pruneScrapViews();}},{key:'pruneScrapViews',value:function pruneScrapViews(){var maxViews=this.activeViews.length;var viewTypeCount=this.viewTypeCount;var scrapViews=this.scrapViews;for(var i=0;i<viewTypeCount;++i){var scrapPile=scrapViews[i];var size=scrapPile.size();var extras=size-maxViews;size--;for(var j=0;j<extras;j++){scrapPile.remove(scrapPile.keyAt(size--));}}}},{key:'retrieveFromScrap',value:function retrieveFromScrap(scrapViews,position){var size=scrapViews.size();if(size>0){for(var i=0;i<size;i++){var fromPosition=scrapViews.keyAt(i);var view=scrapViews.get(fromPosition);if(fromPosition==position){scrapViews.remove(fromPosition);return view;}}var index=size-1;var _r4=scrapViews.valueAt(index);scrapViews.remove(scrapViews.keyAt(index));return _r4;}else{return null;}}}]);return RecycleBin;}();})(salvage=jakewharton.salvage||(jakewharton.salvage={}));})(jakewharton=com.jakewharton||(com.jakewharton={}));})(com||(com={}));var uk;(function(uk){var co;(function(co){var senab;(function(senab){var photoview;(function(photoview){var Log=android.util.Log;var MotionEvent=android.view.MotionEvent;var ScaleGestureDetector=android.view.ScaleGestureDetector;var VelocityTracker=android.view.VelocityTracker;var ViewConfiguration=android.view.ViewConfiguration;var GestureDetector=function(){function GestureDetector(){_classCallCheck(this,GestureDetector);this.mActivePointerId=GestureDetector.INVALID_POINTER_ID;this.mActivePointerIndex=0;this.mLastTouchX=0;this.mLastTouchY=0;this.mTouchSlop=0;this.mMinimumVelocity=0;var configuration=ViewConfiguration.get();this.mMinimumVelocity=configuration.getScaledMinimumFlingVelocity();this.mTouchSlop=configuration.getScaledTouchSlop();var inner_this=this;var scaleListener={onScale:function onScale(detector){var scaleFactor=detector.getScaleFactor();if(Number.isNaN(scaleFactor)||!Number.isFinite(scaleFactor))return false;inner_this.mListener.onScale(scaleFactor,detector.getFocusX(),detector.getFocusY());return true;},onScaleBegin:function onScaleBegin(detector){return true;},onScaleEnd:function onScaleEnd(detector){}};this.mScaleDetector=new ScaleGestureDetector(scaleListener);}_createClass(GestureDetector,[{key:'setOnGestureListener',value:function setOnGestureListener(listener){this.mListener=listener;}},{key:'getActiveX',value:function getActiveX(ev){return ev.getX(this.mActivePointerIndex<0?0:this.mActivePointerIndex);}},{key:'getActiveY',value:function getActiveY(ev){return ev.getY(this.mActivePointerIndex<0?0:this.mActivePointerIndex);}},{key:'isScaling',value:function isScaling(){return this.mScaleDetector.isInProgress();}},{key:'isDragging',value:function isDragging(){return this.mIsDragging;}},{key:'onTouchEvent',value:function onTouchEvent(ev){this.mScaleDetector.onTouchEvent(ev);var action=ev.getAction();switch(action&MotionEvent.ACTION_MASK){case MotionEvent.ACTION_DOWN:this.mActivePointerId=ev.getPointerId(0);break;case MotionEvent.ACTION_CANCEL:case MotionEvent.ACTION_UP:this.mActivePointerId=GestureDetector.INVALID_POINTER_ID;break;case MotionEvent.ACTION_POINTER_UP:var pointerIndex=ev.getActionIndex();var pointerId=ev.getPointerId(pointerIndex);if(pointerId==this.mActivePointerId){var newPointerIndex=pointerIndex==0?1:0;this.mActivePointerId=ev.getPointerId(newPointerIndex);this.mLastTouchX=ev.getX(newPointerIndex);this.mLastTouchY=ev.getY(newPointerIndex);}break;}this.mActivePointerIndex=ev.findPointerIndex(this.mActivePointerId!=GestureDetector.INVALID_POINTER_ID?this.mActivePointerId:0);switch(ev.getAction()){case MotionEvent.ACTION_DOWN:{this.mVelocityTracker=VelocityTracker.obtain();if(null!=this.mVelocityTracker){this.mVelocityTracker.addMovement(ev);}else{Log.i(GestureDetector.LOG_TAG,\"Velocity tracker is null\");}this.mLastTouchX=this.getActiveX(ev);this.mLastTouchY=this.getActiveY(ev);this.mIsDragging=false;break;}case MotionEvent.ACTION_MOVE:{var _x265=this.getActiveX(ev);var _y37=this.getActiveY(ev);var _dx12=_x265-this.mLastTouchX,_dy8=_y37-this.mLastTouchY;if(!this.mIsDragging){this.mIsDragging=Math.sqrt(_dx12*_dx12+_dy8*_dy8)>=this.mTouchSlop;}if(this.mIsDragging){this.mListener.onDrag(_dx12,_dy8);this.mLastTouchX=_x265;this.mLastTouchY=_y37;if(null!=this.mVelocityTracker){this.mVelocityTracker.addMovement(ev);}}break;}case MotionEvent.ACTION_CANCEL:{if(null!=this.mVelocityTracker){this.mVelocityTracker.recycle();this.mVelocityTracker=null;}break;}case MotionEvent.ACTION_UP:{if(this.mIsDragging){if(null!=this.mVelocityTracker){this.mLastTouchX=this.getActiveX(ev);this.mLastTouchY=this.getActiveY(ev);this.mVelocityTracker.addMovement(ev);this.mVelocityTracker.computeCurrentVelocity(1000);var vX=this.mVelocityTracker.getXVelocity(),vY=this.mVelocityTracker.getYVelocity();if(Math.max(Math.abs(vX),Math.abs(vY))>=this.mMinimumVelocity){this.mListener.onFling(this.mLastTouchX,this.mLastTouchY,-vX,-vY);}}}if(null!=this.mVelocityTracker){this.mVelocityTracker.recycle();this.mVelocityTracker=null;}break;}}return true;}}]);return GestureDetector;}();GestureDetector.LOG_TAG=\"CupcakeGestureDetector\";GestureDetector.INVALID_POINTER_ID=-1;photoview.GestureDetector=GestureDetector;})(photoview=senab.photoview||(senab.photoview={}));})(senab=co.senab||(co.senab={}));})(co=uk.co||(uk.co={}));})(uk||(uk={}));var uk;(function(uk){var co;(function(co){var senab;(function(senab){var photoview;(function(photoview){var IPhotoView;(function(IPhotoView){IPhotoView.DEFAULT_MAX_SCALE=3.0;IPhotoView.DEFAULT_MID_SCALE=1.75;IPhotoView.DEFAULT_MIN_SCALE=1.0;IPhotoView.DEFAULT_ZOOM_DURATION=200;function isImpl(obj){if(!obj)return false;return obj['canZoom']&&obj['getDisplayRect']&&obj['setDisplayMatrix']&&obj['getDisplayMatrix']&&obj['getMinScale']&&obj['getMinimumScale']&&obj['getMidScale']&&obj['getMediumScale']&&obj['getMaxScale']&&obj['getMaximumScale']&&obj['getScale']&&obj['getScaleType']&&obj['setAllowParentInterceptOnEdge']&&obj['setMinScale']&&obj['setMinimumScale']&&obj['setMidScale']&&obj['setMediumScale']&&obj['setMaxScale']&&obj['setMaximumScale']&&obj['setScaleLevels']&&obj['setOnLongClickListener']&&obj['setOnMatrixChangeListener']&&obj['setOnPhotoTapListener']&&obj['getOnPhotoTapListener']&&obj['setOnViewTapListener']&&obj['setRotationTo']&&obj['setRotationBy']&&obj['getOnViewTapListener']&&obj['setScale']&&obj['setScale']&&obj['setScale']&&obj['setScaleType']&&obj['setZoomable']&&obj['setPhotoViewRotation']&&obj['getVisibleRectangleBitmap']&&obj['setZoomTransitionDuration']&&obj['getIPhotoViewImplementation']&&obj['setOnDoubleTapListener']&&obj['setOnScaleChangeListener'];}IPhotoView.isImpl=isImpl;})(IPhotoView=photoview.IPhotoView||(photoview.IPhotoView={}));})(photoview=senab.photoview||(senab.photoview={}));})(senab=co.senab||(co.senab={}));})(co=uk.co||(uk.co={}));})(uk||(uk={}));var uk;(function(uk){var co;(function(co){var senab;(function(senab){var photoview;(function(photoview){var Matrix=android.graphics.Matrix;var ScaleToFit=android.graphics.Matrix.ScaleToFit;var RectF=android.graphics.RectF;var Log=android.util.Log;var AccelerateDecelerateInterpolator=android.view.animation.AccelerateDecelerateInterpolator;var ScaleType=android.widget.ImageView.ScaleType;var OverScroller=android.widget.OverScroller;var WeakReference=java.lang.ref.WeakReference;var MotionEvent=android.view.MotionEvent;var ACTION_CANCEL=MotionEvent.ACTION_CANCEL;var ACTION_DOWN=MotionEvent.ACTION_DOWN;var ACTION_UP=MotionEvent.ACTION_UP;var System=java.lang.System;var GestureDetector=uk.co.senab.photoview.GestureDetector;var IPhotoView=uk.co.senab.photoview.IPhotoView;var PhotoViewAttacher=function(){function PhotoViewAttacher(imageView){var _this177=this;var zoomable=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;_classCallCheck(this,PhotoViewAttacher);this.ZOOM_DURATION=IPhotoView.DEFAULT_ZOOM_DURATION;this.mMinScale=IPhotoView.DEFAULT_MIN_SCALE;this.mMidScale=IPhotoView.DEFAULT_MID_SCALE;this.mMaxScale=IPhotoView.DEFAULT_MAX_SCALE;this.mAllowParentInterceptOnEdge=true;this.mBlockParentIntercept=false;this.mBaseMatrix=new Matrix();this.mDrawMatrix=new Matrix();this.mSuppMatrix=new Matrix();this.mDisplayRect=new RectF();this.mMatrixValues=androidui.util.ArrayCreator.newNumberArray(9);this.mIvTop=0;this.mIvRight=0;this.mIvBottom=0;this.mIvLeft=0;this.mScrollEdge=PhotoViewAttacher.EDGE_BOTH;this.mScaleType=ScaleType.FIT_CENTER;this.mImageView=new WeakReference(imageView);imageView.setOnTouchListener(this);var observer=imageView.getViewTreeObserver();if(null!=observer)observer.addOnGlobalLayoutListener(this);PhotoViewAttacher.setImageViewScaleTypeMatrix(imageView);this.mScaleDragDetector=new GestureDetector();this.mScaleDragDetector.setOnGestureListener(this);this.mGestureDetector=new android.view.GestureDetector(function(){var inner_this=_this177;var _Inner=function(_android$view$Gesture){_inherits(_Inner,_android$view$Gesture);function _Inner(){_classCallCheck(this,_Inner);return _possibleConstructorReturn(this,(_Inner.__proto__||Object.getPrototypeOf(_Inner)).apply(this,arguments));}_createClass(_Inner,[{key:'onLongPress',value:function onLongPress(e){if(null!=inner_this.mLongClickListener){inner_this.mLongClickListener.onLongClick(inner_this.getImageView());}}}]);return _Inner;}(android.view.GestureDetector.SimpleOnGestureListener);return new _Inner();}());this.mGestureDetector.setOnDoubleTapListener(new PhotoViewAttacher.DefaultOnDoubleTapListener(this));this.setZoomable(zoomable);}_createClass(PhotoViewAttacher,[{key:'setOnDoubleTapListener',value:function setOnDoubleTapListener(newOnDoubleTapListener){if(newOnDoubleTapListener!=null){this.mGestureDetector.setOnDoubleTapListener(newOnDoubleTapListener);}else{this.mGestureDetector.setOnDoubleTapListener(new PhotoViewAttacher.DefaultOnDoubleTapListener(this));}}},{key:'setOnScaleChangeListener',value:function setOnScaleChangeListener(onScaleChangeListener){this.mScaleChangeListener=onScaleChangeListener;}},{key:'canZoom',value:function canZoom(){return this.mZoomEnabled;}},{key:'cleanup',value:function cleanup(){if(null==this.mImageView){return;}var imageView=this.mImageView.get();if(null!=imageView){var observer=imageView.getViewTreeObserver();if(null!=observer&&observer.isAlive()){observer.removeGlobalOnLayoutListener(this);}imageView.setOnTouchListener(null);this.cancelFling();}if(null!=this.mGestureDetector){this.mGestureDetector.setOnDoubleTapListener(null);}this.mMatrixChangeListener=null;this.mPhotoTapListener=null;this.mViewTapListener=null;this.mImageView=null;}},{key:'getDisplayRect',value:function getDisplayRect(){this.checkMatrixBounds();return this._getDisplayRect(this.getDrawMatrix());}},{key:'setDisplayMatrix',value:function setDisplayMatrix(finalMatrix){if(finalMatrix==null)throw Error('new IllegalArgumentException(\"Matrix cannot be null\")');var imageView=this.getImageView();if(null==imageView)return false;if(null==imageView.getDrawable())return false;this.mSuppMatrix.set(finalMatrix);this.setImageViewMatrix(this.getDrawMatrix());this.checkMatrixBounds();return true;}},{key:'setPhotoViewRotation',value:function setPhotoViewRotation(degrees){this.mSuppMatrix.setRotate(degrees%360);this.checkAndDisplayMatrix();}},{key:'setRotationTo',value:function setRotationTo(degrees){this.mSuppMatrix.setRotate(degrees%360);this.checkAndDisplayMatrix();}},{key:'setRotationBy',value:function setRotationBy(degrees){this.mSuppMatrix.postRotate(degrees%360);this.checkAndDisplayMatrix();}},{key:'getImageView',value:function getImageView(){var imageView=null;if(null!=this.mImageView){imageView=this.mImageView.get();}if(null==imageView){this.cleanup();if(PhotoViewAttacher.DEBUG)Log.i(PhotoViewAttacher.LOG_TAG,\"ImageView no longer exists. You should not use this PhotoViewAttacher any more.\");}return imageView;}},{key:'getMinScale',value:function getMinScale(){return this.getMinimumScale();}},{key:'getMinimumScale',value:function getMinimumScale(){return this.mMinScale;}},{key:'getMidScale',value:function getMidScale(){return this.getMediumScale();}},{key:'getMediumScale',value:function getMediumScale(){return this.mMidScale;}},{key:'getMaxScale',value:function getMaxScale(){return this.getMaximumScale();}},{key:'getMaximumScale',value:function getMaximumScale(){return this.mMaxScale;}},{key:'getScale',value:function getScale(){return Math.sqrt(Math.pow(this.getValue(this.mSuppMatrix,Matrix.MSCALE_X),2)+Math.pow(this.getValue(this.mSuppMatrix,Matrix.MSKEW_Y),2));}},{key:'getScaleType',value:function getScaleType(){return this.mScaleType;}},{key:'onDrag',value:function onDrag(dx,dy){if(this.mScaleDragDetector.isScaling()){return;}if(PhotoViewAttacher.DEBUG){Log.d(PhotoViewAttacher.LOG_TAG,'onDrag: dx: '+dx.toFixed(2)+'. dy: '+dy.toFixed(2));}var imageView=this.getImageView();this.mSuppMatrix.postTranslate(dx,dy);this.checkAndDisplayMatrix();var parent=imageView.getParent();if(this.mAllowParentInterceptOnEdge&&!this.mScaleDragDetector.isScaling()&&!this.mBlockParentIntercept){if(this.mScrollEdge==PhotoViewAttacher.EDGE_BOTH||this.mScrollEdge==PhotoViewAttacher.EDGE_LEFT&&dx>=1||this.mScrollEdge==PhotoViewAttacher.EDGE_RIGHT&&dx<=-1){if(null!=parent)parent.requestDisallowInterceptTouchEvent(false);}}else{if(null!=parent){parent.requestDisallowInterceptTouchEvent(true);}}}},{key:'onFling',value:function onFling(startX,startY,velocityX,velocityY){if(PhotoViewAttacher.DEBUG){Log.d(PhotoViewAttacher.LOG_TAG,\"onFling. sX: \"+startX+\" sY: \"+startY+\" Vx: \"+velocityX+\" Vy: \"+velocityY);}var imageView=this.getImageView();this.mCurrentFlingRunnable=new PhotoViewAttacher.FlingRunnable(this);this.mCurrentFlingRunnable.fling(this.getImageViewWidth(imageView),this.getImageViewHeight(imageView),Math.floor(velocityX),Math.floor(velocityY));imageView.post(this.mCurrentFlingRunnable);}},{key:'onGlobalLayout',value:function onGlobalLayout(){var imageView=this.getImageView();if(null!=imageView){if(this.mZoomEnabled){var top=imageView.getTop();var right=imageView.getRight();var bottom=imageView.getBottom();var left=imageView.getLeft();if(top!=this.mIvTop||bottom!=this.mIvBottom||left!=this.mIvLeft||right!=this.mIvRight){this.updateBaseMatrix(imageView.getDrawable());this.mIvTop=top;this.mIvRight=right;this.mIvBottom=bottom;this.mIvLeft=left;}}else{this.updateBaseMatrix(imageView.getDrawable());}}}},{key:'onScale',value:function onScale(scaleFactor,focusX,focusY){if(PhotoViewAttacher.DEBUG){Log.d(PhotoViewAttacher.LOG_TAG,'onScale: scale: '+scaleFactor.toFixed(2)+'. fX: '+focusX.toFixed(2)+'. fY: '+focusY.toFixed(2)+'f');}if(this.getScale()<this.mMaxScale||scaleFactor<1){if(null!=this.mScaleChangeListener){this.mScaleChangeListener.onScaleChange(scaleFactor,focusX,focusY);}this.mSuppMatrix.postScale(scaleFactor,scaleFactor,focusX,focusY);this.checkAndDisplayMatrix();}}},{key:'onTouch',value:function onTouch(v,ev){var handled=false;if(this.mZoomEnabled&&PhotoViewAttacher.hasDrawable(v)){var parent=v.getParent();switch(ev.getAction()){case ACTION_DOWN:if(null!=parent){parent.requestDisallowInterceptTouchEvent(true);}else{Log.i(PhotoViewAttacher.LOG_TAG,\"onTouch getParent() returned null\");}this.cancelFling();break;case ACTION_CANCEL:case ACTION_UP:if(this.getScale()<this.mMinScale){var rect=this.getDisplayRect();if(null!=rect){v.post(new PhotoViewAttacher.AnimatedZoomRunnable(this,this.getScale(),this.mMinScale,rect.centerX(),rect.centerY()));handled=true;}}break;}if(null!=this.mScaleDragDetector){var wasScaling=this.mScaleDragDetector.isScaling();var wasDragging=this.mScaleDragDetector.isDragging();handled=this.mScaleDragDetector.onTouchEvent(ev);var didntScale=!wasScaling&&!this.mScaleDragDetector.isScaling();var didntDrag=!wasDragging&&!this.mScaleDragDetector.isDragging();this.mBlockParentIntercept=didntScale&&didntDrag;}if(null!=this.mGestureDetector&&this.mGestureDetector.onTouchEvent(ev)){handled=true;}}return handled;}},{key:'setAllowParentInterceptOnEdge',value:function setAllowParentInterceptOnEdge(allow){this.mAllowParentInterceptOnEdge=allow;}},{key:'setMinScale',value:function setMinScale(minScale){this.setMinimumScale(minScale);}},{key:'setMinimumScale',value:function setMinimumScale(minimumScale){PhotoViewAttacher.checkZoomLevels(minimumScale,this.mMidScale,this.mMaxScale);this.mMinScale=minimumScale;}},{key:'setMidScale',value:function setMidScale(midScale){this.setMediumScale(midScale);}},{key:'setMediumScale',value:function setMediumScale(mediumScale){PhotoViewAttacher.checkZoomLevels(this.mMinScale,mediumScale,this.mMaxScale);this.mMidScale=mediumScale;}},{key:'setMaxScale',value:function setMaxScale(maxScale){this.setMaximumScale(maxScale);}},{key:'setMaximumScale',value:function setMaximumScale(maximumScale){PhotoViewAttacher.checkZoomLevels(this.mMinScale,this.mMidScale,maximumScale);this.mMaxScale=maximumScale;}},{key:'setScaleLevels',value:function setScaleLevels(minimumScale,mediumScale,maximumScale){PhotoViewAttacher.checkZoomLevels(minimumScale,mediumScale,maximumScale);this.mMinScale=minimumScale;this.mMidScale=mediumScale;this.mMaxScale=maximumScale;}},{key:'setOnLongClickListener',value:function setOnLongClickListener(listener){this.mLongClickListener=listener;}},{key:'setOnMatrixChangeListener',value:function setOnMatrixChangeListener(listener){this.mMatrixChangeListener=listener;}},{key:'setOnPhotoTapListener',value:function setOnPhotoTapListener(listener){this.mPhotoTapListener=listener;}},{key:'getOnPhotoTapListener',value:function getOnPhotoTapListener(){return this.mPhotoTapListener;}},{key:'setOnViewTapListener',value:function setOnViewTapListener(listener){this.mViewTapListener=listener;}},{key:'getOnViewTapListener',value:function getOnViewTapListener(){return this.mViewTapListener;}},{key:'setScale',value:function setScale(){if(arguments.length>=3){this.setScale_4.apply(this,arguments);}else{this.setScale_2.apply(this,arguments);}}},{key:'setScale_2',value:function setScale_2(scale){var animate=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var imageView=this.getImageView();if(null!=imageView){this.setScale(scale,imageView.getRight()/2,imageView.getBottom()/2,animate);}}},{key:'setScale_4',value:function setScale_4(scale,focalX,focalY){var animate=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var imageView=this.getImageView();if(null!=imageView){if(scale<this.mMinScale||scale>this.mMaxScale){Log.i(PhotoViewAttacher.LOG_TAG,\"Scale must be within the range of minScale and maxScale\");return;}if(animate){imageView.post(new PhotoViewAttacher.AnimatedZoomRunnable(this,this.getScale(),scale,focalX,focalY));}else{this.mSuppMatrix.setScale(scale,scale,focalX,focalY);this.checkAndDisplayMatrix();}}}},{key:'setScaleType',value:function setScaleType(scaleType){if(PhotoViewAttacher.isSupportedScaleType(scaleType)&&scaleType!=this.mScaleType){this.mScaleType=scaleType;this.update();}}},{key:'setZoomable',value:function setZoomable(zoomable){this.mZoomEnabled=zoomable;this.update();}},{key:'update',value:function update(){var imageView=this.getImageView();if(null!=imageView){if(this.mZoomEnabled){PhotoViewAttacher.setImageViewScaleTypeMatrix(imageView);this.updateBaseMatrix(imageView.getDrawable());}else{this.resetMatrix();}}}},{key:'getDisplayMatrix',value:function getDisplayMatrix(){return new Matrix(this.getDrawMatrix());}},{key:'getDrawMatrix',value:function getDrawMatrix(){this.mDrawMatrix.set(this.mBaseMatrix);this.mDrawMatrix.postConcat(this.mSuppMatrix);return this.mDrawMatrix;}},{key:'cancelFling',value:function cancelFling(){if(null!=this.mCurrentFlingRunnable){this.mCurrentFlingRunnable.cancelFling();this.mCurrentFlingRunnable=null;}}},{key:'checkAndDisplayMatrix',value:function checkAndDisplayMatrix(){if(this.checkMatrixBounds()){this.setImageViewMatrix(this.getDrawMatrix());}}},{key:'checkImageViewScaleType',value:function checkImageViewScaleType(){var imageView=this.getImageView();if(null!=imageView&&!IPhotoView.isImpl(imageView)){if(ScaleType.MATRIX!=imageView.getScaleType()){throw Error('new IllegalStateException(\"The ImageView\\'s ScaleType has been changed since attaching a PhotoViewAttacher\")');}}}},{key:'checkMatrixBounds',value:function checkMatrixBounds(){var imageView=this.getImageView();if(null==imageView){return false;}var rect=this._getDisplayRect(this.getDrawMatrix());if(null==rect){return false;}var height=rect.height(),width=rect.width();var deltaX=0,deltaY=0;var viewHeight=this.getImageViewHeight(imageView);if(height<=viewHeight){switch(this.mScaleType){case ScaleType.FIT_START:deltaY=-rect.top;break;case ScaleType.FIT_END:deltaY=viewHeight-height-rect.top;break;default:deltaY=(viewHeight-height)/2-rect.top;break;}}else if(rect.top>0){deltaY=-rect.top;}else if(rect.bottom<viewHeight){deltaY=viewHeight-rect.bottom;}var viewWidth=this.getImageViewWidth(imageView);if(width<=viewWidth){switch(this.mScaleType){case ScaleType.FIT_START:deltaX=-rect.left;break;case ScaleType.FIT_END:deltaX=viewWidth-width-rect.left;break;default:deltaX=(viewWidth-width)/2-rect.left;break;}this.mScrollEdge=PhotoViewAttacher.EDGE_BOTH;}else if(rect.left>0){this.mScrollEdge=PhotoViewAttacher.EDGE_LEFT;deltaX=-rect.left;}else if(rect.right<viewWidth){deltaX=viewWidth-rect.right;this.mScrollEdge=PhotoViewAttacher.EDGE_RIGHT;}else{this.mScrollEdge=PhotoViewAttacher.EDGE_NONE;}this.mSuppMatrix.postTranslate(deltaX,deltaY);return true;}},{key:'_getDisplayRect',value:function _getDisplayRect(matrix){var imageView=this.getImageView();if(null!=imageView){var d=imageView.getDrawable();if(null!=d){this.mDisplayRect.set(0,0,d.getIntrinsicWidth(),d.getIntrinsicHeight());matrix.mapRect(this.mDisplayRect);return this.mDisplayRect;}}return null;}},{key:'getVisibleRectangleBitmap',value:function getVisibleRectangleBitmap(){var imageView=this.getImageView();return imageView==null?null:imageView.getDrawingCache();}},{key:'setZoomTransitionDuration',value:function setZoomTransitionDuration(milliseconds){if(milliseconds<0)milliseconds=IPhotoView.DEFAULT_ZOOM_DURATION;this.ZOOM_DURATION=milliseconds;}},{key:'getIPhotoViewImplementation',value:function getIPhotoViewImplementation(){return this;}},{key:'getValue',value:function getValue(matrix,whichValue){matrix.getValues(this.mMatrixValues);return this.mMatrixValues[whichValue];}},{key:'resetMatrix',value:function resetMatrix(){this.mSuppMatrix.reset();this.setImageViewMatrix(this.getDrawMatrix());this.checkMatrixBounds();}},{key:'setImageViewMatrix',value:function setImageViewMatrix(matrix){var imageView=this.getImageView();if(null!=imageView){this.checkImageViewScaleType();imageView.setImageMatrix(matrix);if(null!=this.mMatrixChangeListener){var displayRect=this._getDisplayRect(matrix);if(null!=displayRect){this.mMatrixChangeListener.onMatrixChanged(displayRect);}}}}},{key:'updateBaseMatrix',value:function updateBaseMatrix(d){var imageView=this.getImageView();if(null==imageView||null==d){return;}var viewWidth=this.getImageViewWidth(imageView);var viewHeight=this.getImageViewHeight(imageView);var drawableWidth=d.getIntrinsicWidth();var drawableHeight=d.getIntrinsicHeight();this.mBaseMatrix.reset();var widthScale=viewWidth/drawableWidth;var heightScale=viewHeight/drawableHeight;if(this.mScaleType==ScaleType.CENTER){this.mBaseMatrix.postTranslate((viewWidth-drawableWidth)/2,(viewHeight-drawableHeight)/2);}else if(this.mScaleType==ScaleType.CENTER_CROP){var scale=Math.max(widthScale,heightScale);this.mBaseMatrix.postScale(scale,scale);this.mBaseMatrix.postTranslate((viewWidth-drawableWidth*scale)/2,(viewHeight-drawableHeight*scale)/2);}else if(this.mScaleType==ScaleType.CENTER_INSIDE){var _scale3=Math.min(1.0,Math.min(widthScale,heightScale));this.mBaseMatrix.postScale(_scale3,_scale3);this.mBaseMatrix.postTranslate((viewWidth-drawableWidth*_scale3)/2,(viewHeight-drawableHeight*_scale3)/2);}else{var mTempSrc=new RectF(0,0,drawableWidth,drawableHeight);var mTempDst=new RectF(0,0,viewWidth,viewHeight);switch(this.mScaleType){case ScaleType.FIT_CENTER:this.mBaseMatrix.setRectToRect(mTempSrc,mTempDst,ScaleToFit.CENTER);break;case ScaleType.FIT_START:this.mBaseMatrix.setRectToRect(mTempSrc,mTempDst,ScaleToFit.START);break;case ScaleType.FIT_END:this.mBaseMatrix.setRectToRect(mTempSrc,mTempDst,ScaleToFit.END);break;case ScaleType.FIT_XY:this.mBaseMatrix.setRectToRect(mTempSrc,mTempDst,ScaleToFit.FILL);break;default:break;}}this.resetMatrix();}},{key:'getImageViewWidth',value:function getImageViewWidth(imageView){if(null==imageView)return 0;return imageView.getWidth()-imageView.getPaddingLeft()-imageView.getPaddingRight();}},{key:'getImageViewHeight',value:function getImageViewHeight(imageView){if(null==imageView)return 0;return imageView.getHeight()-imageView.getPaddingTop()-imageView.getPaddingBottom();}}],[{key:'checkZoomLevels',value:function checkZoomLevels(minZoom,midZoom,maxZoom){if(minZoom>=midZoom){throw Error('new IllegalArgumentException(\"MinZoom has to be less than MidZoom\")');}else if(midZoom>=maxZoom){throw Error('new IllegalArgumentException(\"MidZoom has to be less than MaxZoom\")');}}},{key:'hasDrawable',value:function hasDrawable(imageView){return null!=imageView&&null!=imageView.getDrawable();}},{key:'isSupportedScaleType',value:function isSupportedScaleType(scaleType){if(null==scaleType){return false;}switch(scaleType){case ScaleType.MATRIX:throw Error('new IllegalArgumentException(ScaleType.MATRIX is not supported in PhotoView)');default:return true;}}},{key:'setImageViewScaleTypeMatrix',value:function setImageViewScaleTypeMatrix(imageView){if(null!=imageView&&!IPhotoView.isImpl(imageView)){if(ScaleType.MATRIX!=imageView.getScaleType()){imageView.setScaleType(ScaleType.MATRIX);}}}}]);return PhotoViewAttacher;}();PhotoViewAttacher.LOG_TAG=\"PhotoViewAttacher\";PhotoViewAttacher.DEBUG=Log.View_DBG;PhotoViewAttacher.sInterpolator=new AccelerateDecelerateInterpolator();PhotoViewAttacher.EDGE_NONE=-1;PhotoViewAttacher.EDGE_LEFT=0;PhotoViewAttacher.EDGE_RIGHT=1;PhotoViewAttacher.EDGE_BOTH=2;photoview.PhotoViewAttacher=PhotoViewAttacher;(function(PhotoViewAttacher){var AnimatedZoomRunnable=function(){function AnimatedZoomRunnable(arg,currentZoom,targetZoom,focalX,focalY){_classCallCheck(this,AnimatedZoomRunnable);this.mFocalX=0;this.mFocalY=0;this.mStartTime=0;this.mZoomStart=0;this.mZoomEnd=0;this._PhotoViewAttacher_this=arg;this.mFocalX=focalX;this.mFocalY=focalY;this.mStartTime=System.currentTimeMillis();this.mZoomStart=currentZoom;this.mZoomEnd=targetZoom;}_createClass(AnimatedZoomRunnable,[{key:'run',value:function run(){var imageView=this._PhotoViewAttacher_this.getImageView();if(imageView==null){return;}var t=this.interpolate();var scale=this.mZoomStart+t*(this.mZoomEnd-this.mZoomStart);var deltaScale=scale/this._PhotoViewAttacher_this.getScale();this._PhotoViewAttacher_this.onScale(deltaScale,this.mFocalX,this.mFocalY);if(t<1){imageView.postOnAnimation(this);}}},{key:'interpolate',value:function interpolate(){var t=1*(System.currentTimeMillis()-this.mStartTime)/this._PhotoViewAttacher_this.ZOOM_DURATION;t=Math.min(1,t);t=PhotoViewAttacher.sInterpolator.getInterpolation(t);return t;}}]);return AnimatedZoomRunnable;}();PhotoViewAttacher.AnimatedZoomRunnable=AnimatedZoomRunnable;var FlingRunnable=function(){function FlingRunnable(arg){_classCallCheck(this,FlingRunnable);this.mCurrentX=0;this.mCurrentY=0;this._PhotoViewAttacher_this=arg;this.mScroller=new OverScroller();}_createClass(FlingRunnable,[{key:'cancelFling',value:function cancelFling(){if(PhotoViewAttacher.DEBUG){Log.d(PhotoViewAttacher.LOG_TAG,\"Cancel Fling\");}this.mScroller.forceFinished(true);}},{key:'fling',value:function fling(viewWidth,viewHeight,velocityX,velocityY){var rect=this._PhotoViewAttacher_this.getDisplayRect();if(null==rect){return;}var startX=Math.round(-rect.left);var minX=void 0,maxX=void 0,minY=void 0,maxY=void 0;if(viewWidth<rect.width()){minX=0;maxX=Math.round(rect.width()-viewWidth);}else{minX=maxX=startX;}var startY=Math.round(-rect.top);if(viewHeight<rect.height()){minY=0;maxY=Math.round(rect.height()-viewHeight);}else{minY=maxY=startY;}this.mCurrentX=startX;this.mCurrentY=startY;if(PhotoViewAttacher.DEBUG){Log.d(PhotoViewAttacher.LOG_TAG,\"fling. StartX:\"+startX+\" StartY:\"+startY+\" MaxX:\"+maxX+\" MaxY:\"+maxY);}if(startX!=maxX||startY!=maxY){this.mScroller.fling(startX,startY,velocityX,velocityY,minX,maxX,minY,maxY,0,0);}}},{key:'run',value:function run(){if(this.mScroller.isFinished()){return;}var imageView=this._PhotoViewAttacher_this.getImageView();if(null!=imageView&&this.mScroller.computeScrollOffset()){var newX=this.mScroller.getCurrX();var newY=this.mScroller.getCurrY();if(PhotoViewAttacher.DEBUG){Log.d(PhotoViewAttacher.LOG_TAG,\"fling run(). CurrentX:\"+this.mCurrentX+\" CurrentY:\"+this.mCurrentY+\" NewX:\"+newX+\" NewY:\"+newY);}this._PhotoViewAttacher_this.mSuppMatrix.postTranslate(this.mCurrentX-newX,this.mCurrentY-newY);this._PhotoViewAttacher_this.setImageViewMatrix(this._PhotoViewAttacher_this.getDrawMatrix());this.mCurrentX=newX;this.mCurrentY=newY;imageView.postOnAnimation(this);}}}]);return FlingRunnable;}();PhotoViewAttacher.FlingRunnable=FlingRunnable;var DefaultOnDoubleTapListener=function(){function DefaultOnDoubleTapListener(photoViewAttacher){_classCallCheck(this,DefaultOnDoubleTapListener);this.setPhotoViewAttacher(photoViewAttacher);}_createClass(DefaultOnDoubleTapListener,[{key:'setPhotoViewAttacher',value:function setPhotoViewAttacher(newPhotoViewAttacher){this.photoViewAttacher=newPhotoViewAttacher;}},{key:'onSingleTapConfirmed',value:function onSingleTapConfirmed(e){if(this.photoViewAttacher==null)return false;var imageView=this.photoViewAttacher.getImageView();if(null!=this.photoViewAttacher.getOnPhotoTapListener()){var displayRect=this.photoViewAttacher.getDisplayRect();if(null!=displayRect){var _x269=e.getX(),_y38=e.getY();if(displayRect.contains(_x269,_y38)){var xResult=(_x269-displayRect.left)/displayRect.width();var yResult=(_y38-displayRect.top)/displayRect.height();this.photoViewAttacher.getOnPhotoTapListener().onPhotoTap(imageView,xResult,yResult);return true;}}}if(null!=this.photoViewAttacher.getOnViewTapListener()){this.photoViewAttacher.getOnViewTapListener().onViewTap(imageView,e.getX(),e.getY());}return false;}},{key:'onDoubleTap',value:function onDoubleTap(ev){if(this.photoViewAttacher==null)return false;try{var scale=this.photoViewAttacher.getScale();var _x270=ev.getX();var _y39=ev.getY();if(scale<this.photoViewAttacher.getMediumScale()){this.photoViewAttacher.setScale(this.photoViewAttacher.getMediumScale(),_x270,_y39,true);}else if(scale>=this.photoViewAttacher.getMediumScale()&&scale<this.photoViewAttacher.getMaximumScale()){this.photoViewAttacher.setScale(this.photoViewAttacher.getMaximumScale(),_x270,_y39,true);}else{this.photoViewAttacher.setScale(this.photoViewAttacher.getMinimumScale(),_x270,_y39,true);}}catch(e){}return true;}},{key:'onDoubleTapEvent',value:function onDoubleTapEvent(e){return false;}}]);return DefaultOnDoubleTapListener;}();PhotoViewAttacher.DefaultOnDoubleTapListener=DefaultOnDoubleTapListener;})(PhotoViewAttacher=photoview.PhotoViewAttacher||(photoview.PhotoViewAttacher={}));})(photoview=senab.photoview||(senab.photoview={}));})(senab=co.senab||(co.senab={}));})(co=uk.co||(uk.co={}));})(uk||(uk={}));var uk;(function(uk){var co;(function(co){var senab;(function(senab){var photoview;(function(photoview){var ImageView=android.widget.ImageView;var PhotoViewAttacher=uk.co.senab.photoview.PhotoViewAttacher;var ScaleType=ImageView.ScaleType;var PhotoView=function(_ImageView){_inherits(PhotoView,_ImageView);function PhotoView(context,bindElement,defStyle){_classCallCheck(this,PhotoView);var _this179=_possibleConstructorReturn(this,(PhotoView.__proto__||Object.getPrototypeOf(PhotoView)).call(this,context,bindElement,defStyle));_get2(PhotoView.prototype.__proto__||Object.getPrototypeOf(PhotoView.prototype),'setScaleType',_this179).call(_this179,ScaleType.MATRIX);_this179.init();return _this179;}_createClass(PhotoView,[{key:'init',value:function init(){if(null==this.mAttacher||null==this.mAttacher.getImageView()){this.mAttacher=new PhotoViewAttacher(this);}if(null!=this.mPendingScaleType){this.setScaleType(this.mPendingScaleType);this.mPendingScaleType=null;}}},{key:'setPhotoViewRotation',value:function setPhotoViewRotation(rotationDegree){this.mAttacher.setRotationTo(rotationDegree);}},{key:'setRotationTo',value:function setRotationTo(rotationDegree){this.mAttacher.setRotationTo(rotationDegree);}},{key:'setRotationBy',value:function setRotationBy(rotationDegree){this.mAttacher.setRotationBy(rotationDegree);}},{key:'canZoom',value:function canZoom(){return this.mAttacher.canZoom();}},{key:'getDisplayRect',value:function getDisplayRect(){return this.mAttacher.getDisplayRect();}},{key:'getDisplayMatrix',value:function getDisplayMatrix(){return this.mAttacher.getDisplayMatrix();}},{key:'setDisplayMatrix',value:function setDisplayMatrix(finalRectangle){return this.mAttacher.setDisplayMatrix(finalRectangle);}},{key:'getMinScale',value:function getMinScale(){return this.getMinimumScale();}},{key:'getMinimumScale',value:function getMinimumScale(){return this.mAttacher.getMinimumScale();}},{key:'getMidScale',value:function getMidScale(){return this.getMediumScale();}},{key:'getMediumScale',value:function getMediumScale(){return this.mAttacher.getMediumScale();}},{key:'getMaxScale',value:function getMaxScale(){return this.getMaximumScale();}},{key:'getMaximumScale',value:function getMaximumScale(){return this.mAttacher.getMaximumScale();}},{key:'getScale',value:function getScale(){return this.mAttacher.getScale();}},{key:'getScaleType',value:function getScaleType(){return this.mAttacher.getScaleType();}},{key:'setAllowParentInterceptOnEdge',value:function setAllowParentInterceptOnEdge(allow){this.mAttacher.setAllowParentInterceptOnEdge(allow);}},{key:'setMinScale',value:function setMinScale(minScale){this.setMinimumScale(minScale);}},{key:'setMinimumScale',value:function setMinimumScale(minimumScale){this.mAttacher.setMinimumScale(minimumScale);}},{key:'setMidScale',value:function setMidScale(midScale){this.setMediumScale(midScale);}},{key:'setMediumScale',value:function setMediumScale(mediumScale){this.mAttacher.setMediumScale(mediumScale);}},{key:'setMaxScale',value:function setMaxScale(maxScale){this.setMaximumScale(maxScale);}},{key:'setMaximumScale',value:function setMaximumScale(maximumScale){this.mAttacher.setMaximumScale(maximumScale);}},{key:'setScaleLevels',value:function setScaleLevels(minimumScale,mediumScale,maximumScale){this.mAttacher.setScaleLevels(minimumScale,mediumScale,maximumScale);}},{key:'setImageDrawable',value:function setImageDrawable(drawable){_get2(PhotoView.prototype.__proto__||Object.getPrototypeOf(PhotoView.prototype),'setImageDrawable',this).call(this,drawable);if(null!=this.mAttacher){this.mAttacher.update();}}},{key:'setImageURI',value:function setImageURI(uri){_get2(PhotoView.prototype.__proto__||Object.getPrototypeOf(PhotoView.prototype),'setImageURI',this).call(this,uri);}},{key:'resizeFromDrawable',value:function resizeFromDrawable(){var change=_get2(PhotoView.prototype.__proto__||Object.getPrototypeOf(PhotoView.prototype),'resizeFromDrawable',this).call(this);if(change&&null!=this.mAttacher){this.mAttacher.update();}return change;}},{key:'setOnMatrixChangeListener',value:function setOnMatrixChangeListener(listener){this.mAttacher.setOnMatrixChangeListener(listener);}},{key:'setOnLongClickListener',value:function setOnLongClickListener(l){this.mAttacher.setOnLongClickListener(l);}},{key:'setOnPhotoTapListener',value:function setOnPhotoTapListener(listener){this.mAttacher.setOnPhotoTapListener(listener);}},{key:'getOnPhotoTapListener',value:function getOnPhotoTapListener(){return this.mAttacher.getOnPhotoTapListener();}},{key:'setOnViewTapListener',value:function setOnViewTapListener(listener){this.mAttacher.setOnViewTapListener(listener);}},{key:'getOnViewTapListener',value:function getOnViewTapListener(){return this.mAttacher.getOnViewTapListener();}},{key:'setScale',value:function setScale(){var _mAttacher;(_mAttacher=this.mAttacher).setScale.apply(_mAttacher,arguments);}},{key:'setScaleType',value:function setScaleType(scaleType){if(null!=this.mAttacher){this.mAttacher.setScaleType(scaleType);}else{this.mPendingScaleType=scaleType;}}},{key:'setZoomable',value:function setZoomable(zoomable){this.mAttacher.setZoomable(zoomable);}},{key:'getVisibleRectangleBitmap',value:function getVisibleRectangleBitmap(){return this.mAttacher.getVisibleRectangleBitmap();}},{key:'setZoomTransitionDuration',value:function setZoomTransitionDuration(milliseconds){this.mAttacher.setZoomTransitionDuration(milliseconds);}},{key:'getIPhotoViewImplementation',value:function getIPhotoViewImplementation(){return this.mAttacher;}},{key:'setOnDoubleTapListener',value:function setOnDoubleTapListener(newOnDoubleTapListener){this.mAttacher.setOnDoubleTapListener(newOnDoubleTapListener);}},{key:'setOnScaleChangeListener',value:function setOnScaleChangeListener(onScaleChangeListener){this.mAttacher.setOnScaleChangeListener(onScaleChangeListener);}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){this.mAttacher.cleanup();_get2(PhotoView.prototype.__proto__||Object.getPrototypeOf(PhotoView.prototype),'onDetachedFromWindow',this).call(this);}},{key:'onAttachedToWindow',value:function onAttachedToWindow(){this.init();_get2(PhotoView.prototype.__proto__||Object.getPrototypeOf(PhotoView.prototype),'onAttachedToWindow',this).call(this);}}]);return PhotoView;}(ImageView);photoview.PhotoView=PhotoView;})(photoview=senab.photoview||(senab.photoview={}));})(senab=co.senab||(co.senab={}));})(co=uk.co||(uk.co={}));})(uk||(uk={}));var android;(function(android){var app;(function(app){var View=android.view.View;var FrameLayout=android.widget.FrameLayout;var ActionBar=function(_FrameLayout4){_inherits(ActionBar,_FrameLayout4);function ActionBar(context,bindElement){var defStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:android.R.attr.actionBarStyle;_classCallCheck(this,ActionBar);var _this180=_possibleConstructorReturn(this,(ActionBar.__proto__||Object.getPrototypeOf(ActionBar)).call(this,context,bindElement,defStyle));context.getLayoutInflater().inflate(android.R.layout.action_bar,_this180);_this180.mCenterLayout=_this180.findViewById('action_bar_center_layout');_this180.mTitleView=_this180.findViewById('action_bar_title');_this180.mSubTitleView=_this180.findViewById('action_bar_sub_title');_this180.mActionLeft=_this180.findViewById('action_bar_left');_this180.mActionRight=_this180.findViewById('action_bar_right');return _this180;}_createClass(ActionBar,[{key:'setCustomView',value:function setCustomView(view,layoutParams){this.mCenterLayout.removeAllViews();this.mCustomView=view;if(layoutParams)this.mCenterLayout.addView(view,layoutParams);else this.mCenterLayout.addView(view);}},{key:'setIcon',value:function setIcon(icon){icon.setBounds(0,0,icon.getIntrinsicWidth(),icon.getIntrinsicHeight());var drawables=this.mTitleView.getCompoundDrawables();this.mTitleView.setCompoundDrawables(icon,drawables[1],drawables[2],drawables[3]);}},{key:'setLogo',value:function setLogo(logo){this.setIcon(logo);}},{key:'setTitle',value:function setTitle(title){this.mTitleView.setText(title);}},{key:'setSubtitle',value:function setSubtitle(subtitle){this.mSubTitleView.setText(subtitle);var empty=subtitle==null||subtitle.length==0;this.mSubTitleView.setVisibility(empty?View.GONE:View.VISIBLE);}},{key:'getCustomView',value:function getCustomView(){return this.mCustomView;}},{key:'getTitle',value:function getTitle(){return this.mTitleView.getText().toString();}},{key:'getSubtitle',value:function getSubtitle(){return this.mSubTitleView.getText().toString();}},{key:'show',value:function show(){this.setVisibility(View.VISIBLE);}},{key:'hide',value:function hide(){this.setVisibility(View.GONE);}},{key:'isShowing',value:function isShowing(){return this.isShown();}},{key:'setActionLeft',value:function setActionLeft(name,icon,listener){this.mActionLeft.setText(name);this.mActionLeft.setVisibility(View.VISIBLE);var drawables=this.mActionLeft.getCompoundDrawables();icon.setBounds(0,0,icon.getIntrinsicWidth(),icon.getIntrinsicHeight());this.mActionLeft.setCompoundDrawables(icon,drawables[1],drawables[2],drawables[3]);this.mActionLeft.setOnClickListener(listener);}},{key:'hideActionLeft',value:function hideActionLeft(){this.mActionLeft.setVisibility(View.GONE);}},{key:'setActionRight',value:function setActionRight(name,icon,listener){this.mActionRight.setText(name);this.mActionRight.setVisibility(View.VISIBLE);var drawables=this.mActionRight.getCompoundDrawables();if(icon)icon.setBounds(0,0,icon.getIntrinsicWidth(),icon.getIntrinsicHeight());this.mActionRight.setCompoundDrawables(drawables[0],drawables[1],icon,drawables[3]);this.mActionRight.setOnClickListener(listener);}},{key:'hideActionRight',value:function hideActionRight(){this.mActionRight.setVisibility(View.GONE);}}]);return ActionBar;}(FrameLayout);app.ActionBar=ActionBar;})(app=android.app||(android.app={}));})(android||(android={}));var android;(function(android){var app;(function(app){var ActionBarActivity=function(_app$Activity){_inherits(ActionBarActivity,_app$Activity);function ActionBarActivity(){_classCallCheck(this,ActionBarActivity);return _possibleConstructorReturn(this,(ActionBarActivity.__proto__||Object.getPrototypeOf(ActionBarActivity)).apply(this,arguments));}_createClass(ActionBarActivity,[{key:'onCreate',value:function onCreate(savedInstanceState){_get2(ActionBarActivity.prototype.__proto__||Object.getPrototypeOf(ActionBarActivity.prototype),'onCreate',this).call(this,savedInstanceState);this.initActionBar();}},{key:'initActionBar',value:function initActionBar(){this.setActionBar(new app.ActionBar(this));this.initDefaultBackFinish();}},{key:'initDefaultBackFinish',value:function initDefaultBackFinish(){if(this.androidUI.mActivityThread.mLaunchedActivities.size===0)return;var activity=this;this.mActionBar.setActionLeft(android.R.string_.back,android.R.image.actionbar_ic_back_white,{onClick:function onClick(view){activity.finish();}});}},{key:'setActionBar',value:function setActionBar(actionBar){var activity=this;var w=this.getWindow();var decorView=w.mDecor;this.mActionBar=actionBar;decorView.addView(actionBar,-1,-2);var onMeasure=decorView.onMeasure;decorView.onMeasure=function(widthMeasureSpec,heightMeasureSpec){onMeasure.call(decorView,widthMeasureSpec,heightMeasureSpec);if(activity.mActionBar===actionBar){var params=w.mContentParent.getLayoutParams();if(params.topMargin!=actionBar.getMeasuredHeight()){params.topMargin=actionBar.getMeasuredHeight();onMeasure.call(decorView,widthMeasureSpec,heightMeasureSpec);}}};}},{key:'invalidateOptionsMenuPopupHelper',value:function invalidateOptionsMenuPopupHelper(menu){var menuPopuoHelper=new android.view.menu.MenuPopupHelper(this,menu,this.getActionBar().mActionRight);if(menu.hasVisibleItems()){this.getActionBar().setActionRight('',android.R.image.ic_menu_moreoverflow_normal_holo_dark,{onClick:function onClick(view){menuPopuoHelper.show();}});}return menuPopuoHelper;}},{key:'getActionBar',value:function getActionBar(){return this.mActionBar;}},{key:'onTitleChanged',value:function onTitleChanged(title,color){_get2(ActionBarActivity.prototype.__proto__||Object.getPrototypeOf(ActionBarActivity.prototype),'onTitleChanged',this).call(this,title,color);this.mActionBar.setTitle(title);}}]);return ActionBarActivity;}(app.Activity);app.ActionBarActivity=ActionBarActivity;})(app=android.app||(android.app={}));})(android||(android={}));var androidui;(function(androidui){var widget;(function(widget){var View=android.view.View;var MeasureSpec=View.MeasureSpec;var HtmlView=function(_widget$HtmlBaseView){_inherits(HtmlView,_widget$HtmlBaseView);function HtmlView(context,bindElement,defStyle){_classCallCheck(this,HtmlView);return _possibleConstructorReturn(this,(HtmlView.__proto__||Object.getPrototypeOf(HtmlView)).call(this,context,bindElement,defStyle));}_createClass(HtmlView,[{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){var widthMode=MeasureSpec.getMode(widthMeasureSpec);var heightMode=MeasureSpec.getMode(heightMeasureSpec);var widthSize=MeasureSpec.getSize(widthMeasureSpec);var heightSize=MeasureSpec.getSize(heightMeasureSpec);var width=void 0,height=void 0;var density=this.getResources().getDisplayMetrics().density;if(widthMode==MeasureSpec.EXACTLY){width=widthSize;}else{var sWidth=this.bindElement.style.width,sLeft=this.bindElement.style.left;this.bindElement.style.width='';this.bindElement.style.left='';width=this.bindElement.offsetWidth*density+2;this.bindElement.style.width=sWidth;this.bindElement.style.left=sLeft;width=Math.max(width,this.getSuggestedMinimumWidth());if(widthMode==MeasureSpec.AT_MOST){width=Math.min(widthSize,width);}}if(heightMode==MeasureSpec.EXACTLY){height=heightSize;}else{var _sWidth=this.bindElement.style.width;this.bindElement.style.width=width/density+\"px\";this.bindElement.style.height='';height=this.bindElement.offsetHeight*density;this.bindElement.style.width=_sWidth;height=Math.max(height,this.getSuggestedMinimumHeight());if(heightMode==MeasureSpec.AT_MOST){height=Math.min(height,heightSize);}}this.setMeasuredDimension(width,height);}},{key:'setHtml',value:function setHtml(html){this.bindElement.innerHTML=html;this.requestLayout();}},{key:'getHtml',value:function getHtml(){return this.bindElement.innerHTML;}}]);return HtmlView;}(widget.HtmlBaseView);widget.HtmlView=HtmlView;})(widget=androidui.widget||(androidui.widget={}));})(androidui||(androidui={}));var androidui;(function(androidui){var widget;(function(widget){var View=android.view.View;var MeasureSpec=View.MeasureSpec;var HtmlImageView=function(_widget$HtmlBaseView2){_inherits(HtmlImageView,_widget$HtmlBaseView2);function HtmlImageView(context,bindElement,defStyle){_classCallCheck(this,HtmlImageView);var _this183=_possibleConstructorReturn(this,(HtmlImageView.__proto__||Object.getPrototypeOf(HtmlImageView)).call(this,context,bindElement,defStyle));_this183.mHaveFrame=false;_this183.mAdjustViewBounds=false;_this183.mMaxWidth=Number.MAX_SAFE_INTEGER;_this183.mMaxHeight=Number.MAX_SAFE_INTEGER;_this183.mAlpha=255;_this183.mDrawableWidth=0;_this183.mDrawableHeight=0;_this183.mAdjustViewBoundsCompat=false;_this183.initImageView();var a=context.obtainStyledAttributes(bindElement,defStyle);var src=a.getString('src');if(src){_this183.setImageURI(src);}_this183.setAdjustViewBounds(a.getBoolean('adjustViewBounds',false));_this183.setMaxWidth(a.getDimensionPixelSize('maxWidth',_this183.mMaxWidth));_this183.setMaxHeight(a.getDimensionPixelSize('maxHeight',_this183.mMaxHeight));_this183.setScaleType(android.widget.ImageView.parseScaleType(a.getAttrValue('scaleType'),_this183.mScaleType));_this183.setImageAlpha(a.getInt('drawableAlpha',_this183.mAlpha));return _this183;}_createClass(HtmlImageView,[{key:'createClassAttrBinder',value:function createClassAttrBinder(){return _get2(HtmlImageView.prototype.__proto__||Object.getPrototypeOf(HtmlImageView.prototype),'createClassAttrBinder',this).call(this).set('src',{setter:function setter(v,value,attrBinder){v.setImageURI(value);},getter:function getter(v){return v.mImgElement.src;}}).set('adjustViewBounds',{setter:function setter(v,value,attrBinder){v.setAdjustViewBounds(attrBinder.parseBoolean(value,false));},getter:function getter(v){return v.getAdjustViewBounds();}}).set('maxWidth',{setter:function setter(v,value,attrBinder){v.setMaxWidth(attrBinder.parseNumberPixelSize(value,v.mMaxWidth));},getter:function getter(v){return v.mMaxWidth;}}).set('maxHeight',{setter:function setter(v,value,attrBinder){v.setMaxHeight(attrBinder.parseNumberPixelSize(value,v.mMaxHeight));},getter:function getter(v){return v.mMaxHeight;}}).set('scaleType',{setter:function setter(v,value,attrBinder){if(typeof value==='number'){v.setScaleType(value);}else{v.setScaleType(android.widget.ImageView.parseScaleType(value,v.mScaleType));}},getter:function getter(v){return v.mScaleType;}}).set('drawableAlpha',{setter:function setter(v,value,attrBinder){v.setImageAlpha(attrBinder.parseInt(value,v.mAlpha));},getter:function getter(v){return v.mAlpha;}});}},{key:'initImageView',value:function initImageView(){var _this184=this;this.mScaleType=android.widget.ImageView.ScaleType.FIT_CENTER;this.mImgElement=document.createElement('img');this.mImgElement.style.position=\"absolute\";this.mImgElement.onload=function(){_this184.mImgElement.style.left=0+'px';_this184.mImgElement.style.top=0+'px';_this184.mImgElement.style.width='';_this184.mImgElement.style.height='';_this184.mDrawableWidth=_this184.mImgElement.width;_this184.mDrawableHeight=_this184.mImgElement.height;_this184.mImgElement.style.display='none';_this184.mImgElement.style.opacity='';_this184.requestLayout();};this.bindElement.appendChild(this.mImgElement);}},{key:'getAdjustViewBounds',value:function getAdjustViewBounds(){return this.mAdjustViewBounds;}},{key:'setAdjustViewBounds',value:function setAdjustViewBounds(adjustViewBounds){this.mAdjustViewBounds=adjustViewBounds;if(adjustViewBounds){this.setScaleType(android.widget.ImageView.ScaleType.FIT_CENTER);}}},{key:'getMaxWidth',value:function getMaxWidth(){return this.mMaxWidth;}},{key:'setMaxWidth',value:function setMaxWidth(maxWidth){this.mMaxWidth=maxWidth;}},{key:'getMaxHeight',value:function getMaxHeight(){return this.mMaxHeight;}},{key:'setMaxHeight',value:function setMaxHeight(maxHeight){this.mMaxHeight=maxHeight;}},{key:'setImageURI',value:function setImageURI(uri){this.mDrawableWidth=-1;this.mDrawableHeight=-1;this.mImgElement.style.opacity='0';this.mImgElement.src=uri;}},{key:'setScaleType',value:function setScaleType(scaleType){if(scaleType==null){throw new Error('NullPointerException');}if(this.mScaleType!=scaleType){this.mScaleType=scaleType;this.setWillNotCacheDrawing(scaleType==android.widget.ImageView.ScaleType.CENTER);this.requestLayout();this.invalidate();}}},{key:'getScaleType',value:function getScaleType(){return this.mScaleType;}},{key:'onMeasure',value:function onMeasure(widthMeasureSpec,heightMeasureSpec){var w=void 0;var h=void 0;var desiredAspect=0.0;var resizeWidth=false;var resizeHeight=false;var widthSpecMode=MeasureSpec.getMode(widthMeasureSpec);var heightSpecMode=MeasureSpec.getMode(heightMeasureSpec);if(!this.mImgElement.src||!this.mImgElement.complete){this.mDrawableWidth=-1;this.mDrawableHeight=-1;w=h=0;}else{w=this.mDrawableWidth;h=this.mDrawableHeight;if(w<=0)w=1;if(h<=0)h=1;if(this.mAdjustViewBounds){resizeWidth=widthSpecMode!=MeasureSpec.EXACTLY;resizeHeight=heightSpecMode!=MeasureSpec.EXACTLY;desiredAspect=w/h;}}var pleft=this.mPaddingLeft;var pright=this.mPaddingRight;var ptop=this.mPaddingTop;var pbottom=this.mPaddingBottom;var widthSize=void 0;var heightSize=void 0;if(resizeWidth||resizeHeight){widthSize=this.resolveAdjustedSize(w+pleft+pright,this.mMaxWidth,widthMeasureSpec);heightSize=this.resolveAdjustedSize(h+ptop+pbottom,this.mMaxHeight,heightMeasureSpec);if(desiredAspect!=0){var actualAspect=(widthSize-pleft-pright)/(heightSize-ptop-pbottom);if(Math.abs(actualAspect-desiredAspect)>0.0000001){var done=false;if(resizeWidth){var newWidth=Math.floor(desiredAspect*(heightSize-ptop-pbottom))+pleft+pright;if(!resizeHeight&&!this.mAdjustViewBoundsCompat){widthSize=this.resolveAdjustedSize(newWidth,this.mMaxWidth,widthMeasureSpec);}if(newWidth<=widthSize){widthSize=newWidth;done=true;}}if(!done&&resizeHeight){var newHeight=Math.floor((widthSize-pleft-pright)/desiredAspect)+ptop+pbottom;if(!resizeWidth&&!this.mAdjustViewBoundsCompat){heightSize=this.resolveAdjustedSize(newHeight,this.mMaxHeight,heightMeasureSpec);}if(newHeight<=heightSize){heightSize=newHeight;}}}}}else{w+=pleft+pright;h+=ptop+pbottom;w=Math.max(w,this.getSuggestedMinimumWidth());h=Math.max(h,this.getSuggestedMinimumHeight());widthSize=HtmlImageView.resolveSizeAndState(w,widthMeasureSpec,0);heightSize=HtmlImageView.resolveSizeAndState(h,heightMeasureSpec,0);}this.setMeasuredDimension(widthSize,heightSize);}},{key:'resolveAdjustedSize',value:function resolveAdjustedSize(desiredSize,maxSize,measureSpec){var result=desiredSize;var specMode=MeasureSpec.getMode(measureSpec);var specSize=MeasureSpec.getSize(measureSpec);switch(specMode){case MeasureSpec.UNSPECIFIED:result=Math.min(desiredSize,maxSize);break;case MeasureSpec.AT_MOST:result=Math.min(Math.min(desiredSize,specSize),maxSize);break;case MeasureSpec.EXACTLY:result=specSize;break;}return result;}},{key:'setFrame',value:function setFrame(left,top,right,bottom){var changed=_get2(HtmlImageView.prototype.__proto__||Object.getPrototypeOf(HtmlImageView.prototype),'setFrame',this).call(this,left,top,right,bottom);this.mHaveFrame=true;this.configureBounds();this.mImgElement.style.display='';return changed;}},{key:'configureBounds',value:function configureBounds(){var dwidth=this.mDrawableWidth;var dheight=this.mDrawableHeight;var vwidth=this.getWidth()-this.mPaddingLeft-this.mPaddingRight;var vheight=this.getHeight()-this.mPaddingTop-this.mPaddingBottom;var fits=(dwidth<0||vwidth==dwidth)&&(dheight<0||vheight==dheight);this.mImgElement.style.left=0+'px';this.mImgElement.style.top=0+'px';this.mImgElement.style.width='';this.mImgElement.style.height='';if(dwidth<=0||dheight<=0){return;}if(this.mScaleType===android.widget.ImageView.ScaleType.FIT_XY){this.mImgElement.style.width=vwidth+'px';this.mImgElement.style.height=vheight+'px';return;}this.mImgElement.style.width=dwidth+'px';this.mImgElement.style.height=dheight+'px';if(android.widget.ImageView.ScaleType.MATRIX===this.mScaleType){}else if(fits){}else if(android.widget.ImageView.ScaleType.CENTER===this.mScaleType){var left=Math.round((vwidth-dwidth)*0.5);var top=Math.round((vheight-dheight)*0.5);this.mImgElement.style.left=left+'px';this.mImgElement.style.top=top+'px';}else if(android.widget.ImageView.ScaleType.CENTER_CROP===this.mScaleType){var scale=void 0;var _dx13=0,_dy9=0;if(dwidth*vheight>vwidth*dheight){scale=vheight/dheight;_dx13=(vwidth-dwidth*scale)*0.5;this.mImgElement.style.width='auto';this.mImgElement.style.height=vheight+'px';this.mImgElement.style.left=Math.round(_dx13)+'px';this.mImgElement.style.top='0px';}else{scale=vwidth/dwidth;_dy9=(vheight-dheight*scale)*0.5;this.mImgElement.style.width=vwidth+'px';this.mImgElement.style.height='auto';this.mImgElement.style.left='0px';this.mImgElement.style.top=Math.round(_dy9)+'px';}}else if(android.widget.ImageView.ScaleType.CENTER_INSIDE===this.mScaleType){var _scale4=1;if(dwidth<=vwidth&&dheight<=vheight){}else{var wScale=vwidth/dwidth;var hScale=vheight/dheight;if(wScale<hScale){this.mImgElement.style.width=vwidth+'px';this.mImgElement.style.height='auto';}else{this.mImgElement.style.width='auto';this.mImgElement.style.height=vheight+'px';}_scale4=Math.min(wScale,hScale);}var _dx14=Math.round((vwidth-dwidth*_scale4)*0.5);var _dy10=Math.round((vheight-dheight*_scale4)*0.5);this.mImgElement.style.left=_dx14+'px';this.mImgElement.style.top=_dy10+'px';}else{var _wScale=vwidth/dwidth;var _hScale=vheight/dheight;if(_wScale<_hScale){this.mImgElement.style.width=vwidth+'px';this.mImgElement.style.height='auto';}else{this.mImgElement.style.width='auto';this.mImgElement.style.height=vheight+'px';}var _scale5=Math.min(_wScale,_hScale);if(android.widget.ImageView.ScaleType.FIT_CENTER===this.mScaleType){var _dx15=Math.round((vwidth-dwidth*_scale5)*0.5);var _dy11=Math.round((vheight-dheight*_scale5)*0.5);this.mImgElement.style.left=_dx15+'px';this.mImgElement.style.top=_dy11+'px';}else if(android.widget.ImageView.ScaleType.FIT_END===this.mScaleType){var _dx16=Math.round(vwidth-dwidth*_scale5);var _dy12=Math.round(vheight-dheight*_scale5);this.mImgElement.style.left=_dx16+'px';this.mImgElement.style.top=_dy12+'px';}else if(android.widget.ImageView.ScaleType.FIT_START===this.mScaleType){}}}},{key:'getImageAlpha',value:function getImageAlpha(){return this.mAlpha;}},{key:'setImageAlpha',value:function setImageAlpha(alpha){this.setAlpha(alpha);}}]);return HtmlImageView;}(widget.HtmlBaseView);widget.HtmlImageView=HtmlImageView;})(widget=androidui.widget||(androidui.widget={}));})(androidui||(androidui={}));var androidui;(function(androidui){var widget;(function(widget){var View=android.view.View;var AbsListView=android.widget.AbsListView;var BaseAdapter=android.widget.BaseAdapter;var AdapterView=android.widget.AdapterView;var HtmlDataListAdapter=function(_BaseAdapter4){_inherits(HtmlDataListAdapter,_BaseAdapter4);function HtmlDataListAdapter(){_classCallCheck(this,HtmlDataListAdapter);return _possibleConstructorReturn(this,(HtmlDataListAdapter.__proto__||Object.getPrototypeOf(HtmlDataListAdapter)).apply(this,arguments));}_createClass(HtmlDataListAdapter,[{key:'onInflateAdapter',value:function onInflateAdapter(bindElement,context,parent){this.bindElementData=bindElement;this.mContext=context;if(parent instanceof AbsListView){parent.setAdapter(this);}bindElement[HtmlDataListAdapter.BindAdapterProperty]=this;this.registerHtmlDataObserver();}},{key:'registerHtmlDataObserver',value:function registerHtmlDataObserver(){if(!window['MutationObserver'])return;var adapter=this;function callBack(arr,observer){adapter.notifyDataSetChanged();}var observer=new MutationObserver(callBack);observer.observe(this.bindElementData,{childList:true});}},{key:'getItemViewType',value:function getItemViewType(position){return AdapterView.ITEM_VIEW_TYPE_IGNORE;}},{key:'getView',value:function getView(position,convertView,parent){var element=this.getItem(position);var view=element[View.AndroidViewProperty];this.checkReplaceWithRef(element);if(!view){view=View.inflate(this.mContext,element);element[View.AndroidViewProperty]=view;}return view;}},{key:'getCount',value:function getCount(){return this.bindElementData.children.length;}},{key:'getItem',value:function getItem(position){var element=this.bindElementData.children[position];if(element.tagName===HtmlDataListAdapter.RefElementTag){element=element[HtmlDataListAdapter.RefElementProperty];if(!element)throw Error('Reference element is '+element);}return element;}},{key:'checkReplaceWithRef',value:function checkReplaceWithRef(element){var refElement=element[HtmlDataListAdapter.RefElementProperty]||document.createElement(HtmlDataListAdapter.RefElementTag);refElement[HtmlDataListAdapter.RefElementProperty]=element;element[HtmlDataListAdapter.RefElementProperty]=refElement;if(element.parentNode===this.bindElementData){this.bindElementData.insertBefore(refElement,element);this.bindElementData.removeChild(element);}return refElement;}},{key:'removeElementRefAndRestoreToAdapter',value:function removeElementRefAndRestoreToAdapter(childElement){if(childElement.tagName===HtmlDataListAdapter.RefElementTag){var element=childElement[HtmlDataListAdapter.RefElementProperty];this.bindElementData.insertBefore(element,childElement);this.bindElementData.removeChild(childElement);}}},{key:'notifyDataSizeWillChange',value:function notifyDataSizeWillChange(){for(var i=0,count=this.bindElementData.children.length;i<count;i++){this.removeElementRefAndRestoreToAdapter(this.bindElementData.children[i]);}this.notifyDataSetChanged();}},{key:'getItemId',value:function getItemId(position){var id=this.getItem(position).id;var idNumber=Number.parseInt(id);if(Number.isInteger(idNumber))return idNumber;return-1;}}]);return HtmlDataListAdapter;}(BaseAdapter);HtmlDataListAdapter.RefElementTag=\"ref-element\".toUpperCase();HtmlDataListAdapter.RefElementProperty=\"RefElement\";HtmlDataListAdapter.BindAdapterProperty=\"BindAdapter\";widget.HtmlDataListAdapter=HtmlDataListAdapter;})(widget=androidui.widget||(androidui.widget={}));})(androidui||(androidui={}));var androidui;(function(androidui){var widget;(function(widget){var View=android.view.View;var ViewPager=android.support.v4.view.ViewPager;var PagerAdapter=android.support.v4.view.PagerAdapter;var HtmlDataPagerAdapter=function(_PagerAdapter2){_inherits(HtmlDataPagerAdapter,_PagerAdapter2);function HtmlDataPagerAdapter(){_classCallCheck(this,HtmlDataPagerAdapter);return _possibleConstructorReturn(this,(HtmlDataPagerAdapter.__proto__||Object.getPrototypeOf(HtmlDataPagerAdapter)).apply(this,arguments));}_createClass(HtmlDataPagerAdapter,[{key:'onInflateAdapter',value:function onInflateAdapter(bindElement,context,parent){this.bindElementData=bindElement;this.mContext=context;if(parent instanceof ViewPager){parent.setAdapter(this);}bindElement[HtmlDataPagerAdapter.BindAdapterProperty]=this;this.registerHtmlDataObserver();}},{key:'registerHtmlDataObserver',value:function registerHtmlDataObserver(){if(!window['MutationObserver'])return;var adapter=this;function callBack(arr,observer){adapter.notifyDataSetChanged();}var observer=new MutationObserver(callBack);observer.observe(this.bindElementData,{childList:true});}},{key:'getCount',value:function getCount(){return this.bindElementData.children.length;}},{key:'instantiateItem',value:function instantiateItem(container,position){var element=this.getItem(position);var view=element[View.AndroidViewProperty];this.checkReplaceWithRef(element);if(!view){view=View.inflate(this.mContext,element);element[View.AndroidViewProperty]=view;}container.addView(view);return view;}},{key:'getItem',value:function getItem(position){var element=this.bindElementData.children[position];if(element.tagName===HtmlDataPagerAdapter.RefElementTag){element=element[HtmlDataPagerAdapter.RefElementProperty];if(!element)throw Error('Reference element is '+element);}return element;}},{key:'checkReplaceWithRef',value:function checkReplaceWithRef(element){var refElement=element[HtmlDataPagerAdapter.RefElementProperty]||document.createElement(HtmlDataPagerAdapter.RefElementTag);refElement[HtmlDataPagerAdapter.RefElementProperty]=element;element[HtmlDataPagerAdapter.RefElementProperty]=refElement;if(element.parentNode===this.bindElementData){this.bindElementData.insertBefore(refElement,element);this.bindElementData.removeChild(element);}return refElement;}},{key:'removeElementRefAndRestoreToAdapter',value:function removeElementRefAndRestoreToAdapter(childElement){if(childElement.tagName===HtmlDataPagerAdapter.RefElementTag){var element=childElement[HtmlDataPagerAdapter.RefElementProperty];this.bindElementData.insertBefore(element,childElement);this.bindElementData.removeChild(childElement);}}},{key:'notifyDataSizeWillChange',value:function notifyDataSizeWillChange(){for(var i=0,count=this.bindElementData.children.length;i<count;i++){this.removeElementRefAndRestoreToAdapter(this.bindElementData.children[i]);}this.notifyDataSetChanged();}},{key:'destroyItem',value:function destroyItem(container,position,object){var view=object;container.removeView(view);}},{key:'isViewFromObject',value:function isViewFromObject(view,object){return view===object;}},{key:'getItemPosition',value:function getItemPosition(object){var position=PagerAdapter.POSITION_NONE;if(object==null)return position;for(var i=0,count=this.getCount();i<count;i++){if(object===this.getItem(i)[View.AndroidViewProperty]){position=i;break;}}return position;}}]);return HtmlDataPagerAdapter;}(PagerAdapter);HtmlDataPagerAdapter.RefElementTag=\"ref-element\".toUpperCase();HtmlDataPagerAdapter.RefElementProperty=\"RefElement\";HtmlDataPagerAdapter.BindAdapterProperty=\"BindAdapter\";widget.HtmlDataPagerAdapter=HtmlDataPagerAdapter;})(widget=androidui.widget||(androidui.widget={}));})(androidui||(androidui={}));var androidui;(function(androidui){var widget;(function(widget){var NumberPicker=android.widget.NumberPicker;var HtmlDataPickerAdapter=function(){function HtmlDataPickerAdapter(){_classCallCheck(this,HtmlDataPickerAdapter);}_createClass(HtmlDataPickerAdapter,[{key:'onInflateAdapter',value:function onInflateAdapter(bindElement,context,parent){var _this187=this;this.bindElementData=bindElement;if(parent instanceof NumberPicker){if(!window['MutationObserver'])return;var callBack=function callBack(arr,observer){var values=[];var _iteratorNormalCompletion69=true;var _didIteratorError69=false;var _iteratorError69=undefined;try{for(var _iterator69=Array.from(_this187.bindElementData.children)[Symbol.iterator](),_step69;!(_iteratorNormalCompletion69=(_step69=_iterator69.next()).done);_iteratorNormalCompletion69=true){var child=_step69.value;values.push(child.innerText);}}catch(err){_didIteratorError69=true;_iteratorError69=err;}finally{try{if(!_iteratorNormalCompletion69&&_iterator69.return){_iterator69.return();}}finally{if(_didIteratorError69){throw _iteratorError69;}}}parent.setDisplayedValues(values);};callBack.call(this);var observer=new MutationObserver(callBack);observer.observe(this.bindElementData,{childList:true});}}}]);return HtmlDataPickerAdapter;}();widget.HtmlDataPickerAdapter=HtmlDataPickerAdapter;})(widget=androidui.widget||(androidui.widget={}));})(androidui||(androidui={}));var androidui;(function(androidui){var widget;(function(widget){var MotionEvent=android.view.MotionEvent;var AbsListView=android.widget.AbsListView;var ScrollView=android.widget.ScrollView;var Integer=java.lang.Integer;var OverScrollLocker;(function(OverScrollLocker){var InstanceMap=new WeakMap();function getFrom(view){var scrollLocker=InstanceMap.get(view);if(!scrollLocker){if(view instanceof AbsListView){scrollLocker=new ListViewOverScrollLocker(view);}else if(view instanceof ScrollView){scrollLocker=new ScrollViewScrollLocker(view);}if(scrollLocker)InstanceMap.set(view,scrollLocker);}return scrollLocker;}OverScrollLocker.getFrom=getFrom;var BaseOverScrollLocker=function(){function BaseOverScrollLocker(view){var _this188=this;_classCallCheck(this,BaseOverScrollLocker);this.view=view;var onTouchEventFunc=view.onTouchEvent;view.onTouchEvent=function(event){var result=onTouchEventFunc.call(view,event);switch(event.getAction()){case MotionEvent.ACTION_DOWN:case MotionEvent.ACTION_MOVE:_this188.isInTouch=true;break;case MotionEvent.ACTION_UP:case MotionEvent.ACTION_CANCEL:_this188.isInTouch=false;break;}return result;};}_createClass(BaseOverScrollLocker,[{key:'lockOverScrollTop',value:function lockOverScrollTop(lockTop){this.lockTop=lockTop;if(!this.isInTouch&&this.getOverScrollY()<-lockTop){this.springBackToLockTop();}}},{key:'lockOverScrollBottom',value:function lockOverScrollBottom(lockBottom){this.lockBottom=lockBottom;if(!this.isInTouch&&this.getOverScrollY()>lockBottom){this.springBackToLockBottom();}}}]);return BaseOverScrollLocker;}();var ListViewOverScrollLocker=function(_BaseOverScrollLocker){_inherits(ListViewOverScrollLocker,_BaseOverScrollLocker);function ListViewOverScrollLocker(listView){_classCallCheck(this,ListViewOverScrollLocker);var _this189=_possibleConstructorReturn(this,(ListViewOverScrollLocker.__proto__||Object.getPrototypeOf(ListViewOverScrollLocker)).call(this,listView));_this189.listView=listView;_this189.configListView();return _this189;}_createClass(ListViewOverScrollLocker,[{key:'configListView',value:function configListView(){var _this190=this;var listView=this.listView;if(!listView.mFlingRunnable)listView.mFlingRunnable=new AbsListView.FlingRunnable(listView);var scroller=listView.mFlingRunnable.mScroller;listView.mFlingRunnable.startOverfling=function(initialVelocity){scroller.setInterpolator(null);var minY=Integer.MIN_VALUE,maxY=Integer.MAX_VALUE;if(listView.mScrollY<0)minY=-_this190.lockTop;else if(listView.mScrollY>0)maxY=_this190.lockBottom;scroller.fling(0,listView.mScrollY,0,initialVelocity,0,0,minY,maxY,0,listView._mOverflingDistance);listView.mTouchMode=AbsListView.TOUCH_MODE_OVERFLING;listView.invalidate();listView.postOnAnimation(listView.mFlingRunnable);};var layoutChildrenFunc=listView.layoutChildren;listView.layoutChildren=function(){var overScrollY=_this190.getOverScrollY();layoutChildrenFunc.call(listView);if(overScrollY!==0){listView.overScrollBy(0,-overScrollY,0,listView.mScrollY,0,0,0,listView.mOverscrollDistance,false);var atEdge=listView.trackMotionScroll(-overScrollY,-overScrollY);if(atEdge){listView.overScrollBy(0,overScrollY,0,listView.mScrollY,0,0,0,listView.mOverscrollDistance,false);}else{listView.mFlingRunnable.mScroller.abortAnimation();}}};listView.checkOverScrollStartScrollIfNeeded=function(){return listView.mScrollY>_this190.lockBottom||listView.mScrollY<_this190.lockTop;};listView.mFlingRunnable.edgeReached=function(delta){var initialVelocity=listView.mFlingRunnable.mScroller.getCurrVelocity();if(delta>0)initialVelocity=-initialVelocity;listView.mFlingRunnable.startOverfling(initialVelocity);};var oldSpringBack=scroller.springBack;scroller.springBack=function(startX,startY,minX,maxX,minY,maxY){minY=-_this190.lockTop;maxY=_this190.lockBottom;return oldSpringBack.call(scroller,startX,startY,minX,maxX,minY,maxY);};var oldFling=scroller.fling;scroller.fling=function(startX,startY,velocityX,velocityY,minX,maxX,minY,maxY){var overX=arguments.length>8&&arguments[8]!==undefined?arguments[8]:0;var overY=arguments.length>9&&arguments[9]!==undefined?arguments[9]:0;if(velocityY>0)overY+=_this190.lockBottom;else overY+=_this190.lockTop;oldFling.call(scroller,startX,startY,velocityX,velocityY,minX,maxX,minY,maxY,overX,overY);};}},{key:'getScrollContentBottom',value:function getScrollContentBottom(){var childCount=this.listView.getChildCount();var maxBottom=0;var minTop=0;for(var i=0;i<childCount;i++){var child=this.listView.getChildAt(i);var childBottom=child.getBottom();var childTop=child.getTop();if(childBottom>maxBottom){maxBottom=childBottom;}if(childTop<minTop){minTop=childTop;}}if(minTop>0)minTop=0;if(this.listView.getAdapter()&&childCount>0){return(maxBottom-minTop)*this.listView.getAdapter().getCount()/childCount;}return 0;}},{key:'getOverScrollY',value:function getOverScrollY(){return this.listView.mScrollY;}},{key:'startSpringBack',value:function startSpringBack(){this.listView.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_FLING);this.listView.mFlingRunnable.mScroller.springBack(0,this.listView.mScrollY,0,0,0,0);this.listView.mTouchMode=AbsListView.TOUCH_MODE_OVERFLING;this.listView.postOnAnimation(this.listView.mFlingRunnable);}},{key:'springBackToLockTop',value:function springBackToLockTop(){this.startSpringBack();}},{key:'springBackToLockBottom',value:function springBackToLockBottom(){this.startSpringBack();}}]);return ListViewOverScrollLocker;}(BaseOverScrollLocker);var ScrollViewScrollLocker=function(_BaseOverScrollLocker2){_inherits(ScrollViewScrollLocker,_BaseOverScrollLocker2);function ScrollViewScrollLocker(scrollView){_classCallCheck(this,ScrollViewScrollLocker);var _this191=_possibleConstructorReturn(this,(ScrollViewScrollLocker.__proto__||Object.getPrototypeOf(ScrollViewScrollLocker)).call(this,scrollView));_this191.scrollView=scrollView;var scroller=scrollView.mScroller;var oldSpringBack=scroller.springBack;scroller.springBack=function(startX,startY,minX,maxX,minY,maxY){minY=-_this191.lockTop;maxY=_this191.scrollView.getScrollRange()+_this191.lockBottom;return oldSpringBack.call(scroller,startX,startY,minX,maxX,minY,maxY);};var oldFling=scroller.fling;scroller.fling=function(startX,startY,velocityX,velocityY,minX,maxX,minY,maxY){var overX=arguments.length>8&&arguments[8]!==undefined?arguments[8]:0;var overY=arguments.length>9&&arguments[9]!==undefined?arguments[9]:0;if(velocityY>0)overY+=_this191.lockBottom;else overY+=_this191.lockTop;minY-=_this191.lockTop;maxY+=_this191.lockBottom;oldFling.call(scroller,startX,startY,velocityX,velocityY,minX,maxX,minY,maxY,overX,overY);};_this191.listenScrollContentHeightChange();return _this191;}_createClass(ScrollViewScrollLocker,[{key:'listenScrollContentHeightChange',value:function listenScrollContentHeightChange(){var _this192=this;var listenHeightChange=function listenHeightChange(v){var onSizeChangedFunc=v.onSizeChanged;v.onSizeChanged=function(w,h,oldw,oldh){onSizeChangedFunc.call(v,w,h,oldw,oldh);_this192.scrollView.overScrollBy(0,0,0,_this192.scrollView.mScrollY,0,_this192.scrollView.getScrollRange(),0,_this192.scrollView.mOverscrollDistance,false);};};if(this.scrollView.getChildCount()>0){listenHeightChange(this.scrollView.getChildAt(0));}else{(function(){var onViewAddedFunc=_this192.scrollView.onViewAdded;_this192.scrollView.onViewAdded=function(v){onViewAddedFunc.call(_this192.scrollView,v);listenHeightChange(v);};})();}}},{key:'getScrollContentBottom',value:function getScrollContentBottom(){if(this.scrollView.getChildCount()>0){return this.scrollView.getChildAt(0).getBottom();}return this.scrollView.getPaddingTop();}},{key:'getOverScrollY',value:function getOverScrollY(){var scrollY=this.scrollView.getScrollY();if(scrollY<0)return scrollY;var scrollRange=this.scrollView.getScrollRange();if(scrollY>scrollRange){return scrollY-scrollRange;}return 0;}},{key:'startSpringBack',value:function startSpringBack(){if(this.scrollView.mScroller.springBack(this.scrollView.mScrollX,this.scrollView.mScrollY,0,0,0,this.scrollView.getScrollRange())){this.scrollView.postInvalidateOnAnimation();}}},{key:'springBackToLockTop',value:function springBackToLockTop(){this.startSpringBack();}},{key:'springBackToLockBottom',value:function springBackToLockBottom(){this.startSpringBack();}}]);return ScrollViewScrollLocker;}(BaseOverScrollLocker);})(OverScrollLocker=widget.OverScrollLocker||(widget.OverScrollLocker={}));})(widget=androidui.widget||(androidui.widget={}));})(androidui||(androidui={}));var androidui;(function(androidui){var widget;(function(widget){var _PullRefreshLoadLayou;var View=android.view.View;var Gravity=android.view.Gravity;var ViewGroup=android.view.ViewGroup;var FrameLayout=android.widget.FrameLayout;var TextView=android.widget.TextView;var LinearLayout=android.widget.LinearLayout;var ProgressBar=android.widget.ProgressBar;var R=android.R;var PullRefreshLoadLayout=function(_FrameLayout5){_inherits(PullRefreshLoadLayout,_FrameLayout5);function PullRefreshLoadLayout(context,bindElement,defStyle){_classCallCheck(this,PullRefreshLoadLayout);var _this193=_possibleConstructorReturn(this,(PullRefreshLoadLayout.__proto__||Object.getPrototypeOf(PullRefreshLoadLayout)).call(this,context,bindElement,defStyle));_this193.autoLoadScrollAtBottom=true;_this193.footerViewReadyDistance=36*android.content.res.Resources.getDisplayMetrics().density;_this193.contentOverY=0;var a=context.obtainStyledAttributes(bindElement,defStyle);if(a.getBoolean('refreshEnable',true)){_this193.setRefreshEnable(true);}if(a.getBoolean('loadEnable',true)){_this193.setLoadEnable(true);}a.recycle();return _this193;}_createClass(PullRefreshLoadLayout,[{key:'onViewAdded',value:function onViewAdded(child){_get2(PullRefreshLoadLayout.prototype.__proto__||Object.getPrototypeOf(PullRefreshLoadLayout.prototype),'onViewAdded',this).call(this,child);if(child instanceof PullRefreshLoadLayout.HeaderView){if(child!=this.headerView)this.setHeaderView(child);}else if(child instanceof PullRefreshLoadLayout.FooterView){if(child!=this.footerView)this.setFooterView(child);}else{if(child!=this.contentView)this.setContentView(child);}if(this.footerView!=null){this.bringChildToFront(this.footerView);}}},{key:'configHeaderView',value:function configHeaderView(){var headerView=this.headerView;var params=headerView.getLayoutParams();params.gravity=Gravity.TOP|Gravity.CENTER_HORIZONTAL;params.height=ViewGroup.LayoutParams.WRAP_CONTENT;params.width=ViewGroup.LayoutParams.MATCH_PARENT;headerView.setLayoutParams(params);}},{key:'configFooterView',value:function configFooterView(){var footerView=this.footerView;var params=footerView.getLayoutParams();params.gravity=Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL;params.height=ViewGroup.LayoutParams.WRAP_CONTENT;params.width=ViewGroup.LayoutParams.WRAP_CONTENT;footerView.setLayoutParams(params);}},{key:'configContentView',value:function configContentView(){var _this194=this;var contentView=this.contentView;var params=contentView.getLayoutParams();params.height=ViewGroup.LayoutParams.MATCH_PARENT;params.width=ViewGroup.LayoutParams.MATCH_PARENT;contentView.setLayoutParams(params);this.overScrollLocker=widget.OverScrollLocker.getFrom(contentView);var overScrollByFunc=contentView.overScrollBy;contentView.overScrollBy=function(deltaX,deltaY,scrollX,scrollY,scrollRangeX,scrollRangeY,maxOverScrollX,maxOverScrollY,isTouchEvent){var result=overScrollByFunc.call(contentView,deltaX,deltaY,scrollX,scrollY,scrollRangeX,scrollRangeY,maxOverScrollX,maxOverScrollY,isTouchEvent);if(contentView===_this194.contentView){_this194.onContentOverScroll(scrollRangeY,maxOverScrollY,isTouchEvent);}return result;};}},{key:'onContentOverScroll',value:function onContentOverScroll(scrollRangeY,maxOverScrollY,isTouchEvent){var newScrollY=this.contentView.mScrollY;var top=0;var bottom=scrollRangeY;if(newScrollY>bottom){this.contentOverY=newScrollY-bottom;}else if(newScrollY<top){this.contentOverY=newScrollY-top;}else{this.contentOverY=0;}this.checkHeaderFooterPosition();if(this.headerView){if(this.contentOverY<-this.headerView.getHeight()){if(isTouchEvent){this.setHeaderState(PullRefreshLoadLayout.State_Header_ReadyToRefresh);}else if(this.headerView.state===PullRefreshLoadLayout.State_Header_ReadyToRefresh){this.setHeaderState(PullRefreshLoadLayout.State_Header_Refreshing);}}else if(this.headerView.state===PullRefreshLoadLayout.State_Header_ReadyToRefresh){this.setHeaderState(this.headerView.stateBeforeReady);}}if(this.footerView){var footerState=this.footerView.state;if(this.contentOverY>this.footerView.getHeight()+this.footerViewReadyDistance){if(isTouchEvent){this.setFooterState(PullRefreshLoadLayout.State_Footer_ReadyToLoad);}else if(footerState===PullRefreshLoadLayout.State_Footer_ReadyToLoad){this.setFooterState(PullRefreshLoadLayout.State_Footer_Loading);}}else if(footerState===PullRefreshLoadLayout.State_Footer_ReadyToLoad){this.setFooterState(this.footerView.stateBeforeReady);}if(this.contentOverY>0&&this.autoLoadScrollAtBottom&&footerState===PullRefreshLoadLayout.State_Footer_Normal){this.setFooterState(PullRefreshLoadLayout.State_Footer_Loading);}}}},{key:'setHeaderView',value:function setHeaderView(headerView){if(this.headerView){this.removeView(this.headerView);}this.headerView=headerView;if(headerView.getParent()==null)this.addView(headerView);this.configHeaderView();}},{key:'setFooterView',value:function setFooterView(footerView){if(this.footerView){this.removeView(this.footerView);}this.footerView=footerView;if(footerView.getParent()==null)this.addView(footerView);this.configFooterView();}},{key:'setContentView',value:function setContentView(contentView){if(this.contentView){this.removeView(this.contentView);}this.contentView=contentView;if(contentView.getParent()==null)this.addView(contentView);this.configContentView();}},{key:'setHeaderState',value:function setHeaderState(newState){if(!this.headerView)return;if(this.headerView.state===newState)return;var changeLimit=PullRefreshLoadLayout.StateChangeLimit[this.headerView.state];if(changeLimit&&changeLimit.indexOf(newState)!==-1)return;this.headerView.setStateInner(this,newState);this.checkLockOverScroll();if(newState===PullRefreshLoadLayout.State_Header_Refreshing&&this.refreshLoadListener){this.refreshLoadListener.onRefresh(this);}}},{key:'getHeaderState',value:function getHeaderState(){if(!this.headerView)return PullRefreshLoadLayout.State_Disable;return this.headerView.state;}},{key:'setFooterState',value:function setFooterState(newState){if(!this.footerView)return;if(this.footerView.state===newState)return;var changeLimit=PullRefreshLoadLayout.StateChangeLimit[this.footerView.state];if(changeLimit&&changeLimit.indexOf(newState)!==-1)return;this.footerView.setStateInner(this,newState);this.checkLockOverScroll();if(newState===PullRefreshLoadLayout.State_Footer_Loading&&this.refreshLoadListener){this.refreshLoadListener.onLoadMore(this);}}},{key:'getFooterState',value:function getFooterState(){if(!this.footerView)return PullRefreshLoadLayout.State_Disable;return this.footerView.state;}},{key:'checkLockOverScroll',value:function checkLockOverScroll(){if(!this.overScrollLocker)return;if(this.headerView){switch(this.headerView.state){case PullRefreshLoadLayout.State_Header_Normal:this.overScrollLocker.lockOverScrollTop(0);break;case PullRefreshLoadLayout.State_Header_Refreshing:this.overScrollLocker.lockOverScrollTop(this.headerView.getHeight());break;case PullRefreshLoadLayout.State_Header_ReadyToRefresh:this.overScrollLocker.lockOverScrollTop(this.headerView.getHeight());break;case PullRefreshLoadLayout.State_Header_RefreshFail:this.overScrollLocker.lockOverScrollTop(this.headerView.getHeight());break;}}else{this.overScrollLocker.lockOverScrollTop(0);}this.overScrollLocker.lockOverScrollBottom(this.footerView?this.footerView.getHeight():0);}},{key:'checkHeaderFooterPosition',value:function checkHeaderFooterPosition(){if(this.contentOverY>0){this.setHeaderViewAppearDistance(0);this.setFooterViewAppearDistance(this.contentOverY);}else if(this.contentOverY<0){this.setHeaderViewAppearDistance(-this.contentOverY);this.setFooterViewAppearDistance(0);}else{this.setHeaderViewAppearDistance(0);this.setFooterViewAppearDistance(0);}}},{key:'setHeaderViewAppearDistance',value:function setHeaderViewAppearDistance(distance){if(!this.headerView)return;var offset=-this.headerView.getHeight()-this.headerView.getTop()+distance;this.headerView.offsetTopAndBottom(offset);}},{key:'setFooterViewAppearDistance',value:function setFooterViewAppearDistance(distance){if(!this.contentView||!this.footerView)return;var bottomToParentBottom=Math.min(this.overScrollLocker.getScrollContentBottom(),this.contentView.getHeight())-this.footerView.getBottom();if(this.contentOverY<0)bottomToParentBottom-=this.contentOverY;var offset=this.footerView.getHeight()+bottomToParentBottom-distance;this.footerView.offsetTopAndBottom(offset);}},{key:'onLayout',value:function onLayout(changed,left,top,right,bottom){_get2(PullRefreshLoadLayout.prototype.__proto__||Object.getPrototypeOf(PullRefreshLoadLayout.prototype),'onLayout',this).call(this,changed,left,top,right,bottom);this.checkHeaderFooterPosition();this.checkLockOverScroll();if(!this.isLaidOut()){if(this.autoLoadScrollAtBottom&&this.footerView!=null&&this.footerView.getGlobalVisibleRect(new android.graphics.Rect())){this.setFooterState(PullRefreshLoadLayout.State_Footer_Loading);}}}},{key:'setAutoLoadMoreWhenScrollBottom',value:function setAutoLoadMoreWhenScrollBottom(autoLoad){this.autoLoadScrollAtBottom=autoLoad;}},{key:'setRefreshEnable',value:function setRefreshEnable(enable){var oldEnable=this.headerView!=null;if(enable===oldEnable)return;if(!enable){this.removeView(this.headerView);this.headerView=null;if(this.overScrollLocker)this.overScrollLocker.lockOverScrollTop(0);}else{this.setHeaderView(new PullRefreshLoadLayout.DefaultHeaderView(this.getContext()));}}},{key:'setLoadEnable',value:function setLoadEnable(enable){var oldEnable=this.footerView!=null;if(enable===oldEnable)return;if(!enable){this.removeView(this.footerView);this.footerView=null;if(this.overScrollLocker)this.overScrollLocker.lockOverScrollBottom(0);}else{this.setFooterView(new PullRefreshLoadLayout.DefaultFooterView(this.getContext()));}}},{key:'setRefreshLoadListener',value:function setRefreshLoadListener(refreshLoadListener){this.refreshLoadListener=refreshLoadListener;}},{key:'startRefresh',value:function startRefresh(){this.setHeaderState(PullRefreshLoadLayout.State_Header_Refreshing);}},{key:'startLoadMore',value:function startLoadMore(){this.setFooterState(PullRefreshLoadLayout.State_Footer_Loading);}}]);return PullRefreshLoadLayout;}(FrameLayout);PullRefreshLoadLayout.State_Disable=-1;PullRefreshLoadLayout.State_Header_Normal=0;PullRefreshLoadLayout.State_Header_Refreshing=1;PullRefreshLoadLayout.State_Header_ReadyToRefresh=2;PullRefreshLoadLayout.State_Header_RefreshFail=3;PullRefreshLoadLayout.State_Footer_Normal=4;PullRefreshLoadLayout.State_Footer_Loading=5;PullRefreshLoadLayout.State_Footer_ReadyToLoad=6;PullRefreshLoadLayout.State_Footer_LoadFail=7;PullRefreshLoadLayout.State_Footer_NoMoreToLoad=8;PullRefreshLoadLayout.StateChangeLimit=(_PullRefreshLoadLayou={},_defineProperty(_PullRefreshLoadLayou,PullRefreshLoadLayout.State_Header_Refreshing,[PullRefreshLoadLayout.State_Header_ReadyToRefresh,PullRefreshLoadLayout.State_Footer_Loading,PullRefreshLoadLayout.State_Footer_ReadyToLoad,PullRefreshLoadLayout.State_Footer_LoadFail,PullRefreshLoadLayout.State_Footer_NoMoreToLoad]),_defineProperty(_PullRefreshLoadLayou,PullRefreshLoadLayout.State_Header_RefreshFail,[PullRefreshLoadLayout.State_Header_ReadyToRefresh,PullRefreshLoadLayout.State_Footer_Loading,PullRefreshLoadLayout.State_Footer_ReadyToLoad,PullRefreshLoadLayout.State_Footer_LoadFail,PullRefreshLoadLayout.State_Footer_NoMoreToLoad]),_defineProperty(_PullRefreshLoadLayou,PullRefreshLoadLayout.State_Footer_Loading,[PullRefreshLoadLayout.State_Header_ReadyToRefresh,PullRefreshLoadLayout.State_Header_Refreshing,PullRefreshLoadLayout.State_Footer_ReadyToLoad,PullRefreshLoadLayout.State_Header_RefreshFail]),_defineProperty(_PullRefreshLoadLayou,PullRefreshLoadLayout.State_Footer_NoMoreToLoad,[PullRefreshLoadLayout.State_Footer_ReadyToLoad]),_PullRefreshLoadLayou);widget.PullRefreshLoadLayout=PullRefreshLoadLayout;(function(PullRefreshLoadLayout){var HeaderView=function(_FrameLayout6){_inherits(HeaderView,_FrameLayout6);function HeaderView(){_classCallCheck(this,HeaderView);var _this195=_possibleConstructorReturn(this,(HeaderView.__proto__||Object.getPrototypeOf(HeaderView)).apply(this,arguments));_this195.state=PullRefreshLoadLayout.State_Header_Normal;_this195.stateBeforeReady=PullRefreshLoadLayout.State_Header_Normal;return _this195;}_createClass(HeaderView,[{key:'setStateInner',value:function setStateInner(prll,state){var oldState=this.state;this.state=state;this.onStateChange(state,oldState);var inner_this=this;switch(state){case PullRefreshLoadLayout.State_Header_RefreshFail:this.postDelayed({run:function run(){if(state===inner_this.state){prll.setHeaderState(PullRefreshLoadLayout.State_Header_Normal);}}},1000);break;case PullRefreshLoadLayout.State_Header_ReadyToRefresh:this.stateBeforeReady=oldState;break;}}}]);return HeaderView;}(FrameLayout);PullRefreshLoadLayout.HeaderView=HeaderView;var FooterView=function(_FrameLayout7){_inherits(FooterView,_FrameLayout7);function FooterView(){_classCallCheck(this,FooterView);var _this196=_possibleConstructorReturn(this,(FooterView.__proto__||Object.getPrototypeOf(FooterView)).apply(this,arguments));_this196.state=PullRefreshLoadLayout.State_Footer_Normal;_this196.stateBeforeReady=PullRefreshLoadLayout.State_Footer_Normal;return _this196;}_createClass(FooterView,[{key:'setStateInner',value:function setStateInner(prll,state){var oldState=this.state;this.state=state;this.onStateChange(state,oldState);switch(state){case PullRefreshLoadLayout.State_Footer_ReadyToLoad:this.stateBeforeReady=oldState;break;}}}]);return FooterView;}(FrameLayout);PullRefreshLoadLayout.FooterView=FooterView;var DefaultHeaderView=function(_HeaderView){_inherits(DefaultHeaderView,_HeaderView);function DefaultHeaderView(context,bindElement,defStyle){_classCallCheck(this,DefaultHeaderView);var _this197=_possibleConstructorReturn(this,(DefaultHeaderView.__proto__||Object.getPrototypeOf(DefaultHeaderView)).call(this,context,bindElement,defStyle));_this197.progressBar=new ProgressBar(context);_this197.progressBar.setVisibility(View.GONE);_this197.textView=new TextView(context);var density=android.content.res.Resources.getDisplayMetrics().density;var pad=16*density;_this197.textView.setPadding(pad/2,pad,pad/2,pad);_this197.textView.setGravity(Gravity.CENTER);var linear=new LinearLayout(context);linear.addView(_this197.progressBar,32*density,32*density);linear.addView(_this197.textView);linear.setGravity(Gravity.CENTER);_this197.addView(linear,-1,-2);_this197.onStateChange(PullRefreshLoadLayout.State_Header_Normal,PullRefreshLoadLayout.State_Disable);return _this197;}_createClass(DefaultHeaderView,[{key:'onStateChange',value:function onStateChange(newState,oldState){switch(newState){case PullRefreshLoadLayout.State_Header_Refreshing:this.textView.setText(R.string_.prll_header_state_loading);this.progressBar.setVisibility(View.VISIBLE);break;case PullRefreshLoadLayout.State_Header_ReadyToRefresh:this.textView.setText(R.string_.prll_header_state_ready);this.progressBar.setVisibility(View.GONE);break;case PullRefreshLoadLayout.State_Header_RefreshFail:this.textView.setText(R.string_.prll_header_state_fail);this.progressBar.setVisibility(View.GONE);break;default:this.textView.setText(R.string_.prll_header_state_normal);this.progressBar.setVisibility(View.GONE);}}}]);return DefaultHeaderView;}(HeaderView);PullRefreshLoadLayout.DefaultHeaderView=DefaultHeaderView;var DefaultFooterView=function(_FooterView){_inherits(DefaultFooterView,_FooterView);function DefaultFooterView(context,bindElement,defStyle){_classCallCheck(this,DefaultFooterView);var _this198=_possibleConstructorReturn(this,(DefaultFooterView.__proto__||Object.getPrototypeOf(DefaultFooterView)).call(this,context,bindElement,defStyle));_this198.progressBar=new ProgressBar(context);_this198.progressBar.setVisibility(View.GONE);_this198.textView=new TextView(context);var density=android.content.res.Resources.getDisplayMetrics().density;var pad=16*density;_this198.textView.setPadding(pad/2,pad,pad/2,pad);_this198.textView.setGravity(Gravity.CENTER);var linear=new LinearLayout(context);linear.addView(_this198.progressBar);linear.addView(_this198.textView);linear.setGravity(Gravity.CENTER);_this198.addView(linear,-1,-2);_this198.onStateChange(PullRefreshLoadLayout.State_Footer_Normal,PullRefreshLoadLayout.State_Disable);_this198.setOnClickListener({onClick:function onClick(v){var parent=v.getParent();if(parent instanceof PullRefreshLoadLayout){parent.setFooterState(PullRefreshLoadLayout.State_Footer_Loading);}}});return _this198;}_createClass(DefaultFooterView,[{key:'onStateChange',value:function onStateChange(newState,oldState){switch(newState){case PullRefreshLoadLayout.State_Footer_Loading:this.textView.setText(R.string_.prll_footer_state_loading);this.progressBar.setVisibility(View.VISIBLE);break;case PullRefreshLoadLayout.State_Footer_ReadyToLoad:this.textView.setText(R.string_.prll_footer_state_ready);this.progressBar.setVisibility(View.GONE);break;case PullRefreshLoadLayout.State_Footer_LoadFail:this.textView.setText(R.string_.prll_footer_state_fail);this.progressBar.setVisibility(View.GONE);break;case PullRefreshLoadLayout.State_Footer_NoMoreToLoad:this.textView.setText(R.string_.prll_footer_state_no_more);this.progressBar.setVisibility(View.GONE);break;default:this.textView.setText(R.string_.prll_footer_state_normal);this.progressBar.setVisibility(View.GONE);}}}]);return DefaultFooterView;}(FooterView);PullRefreshLoadLayout.DefaultFooterView=DefaultFooterView;})(PullRefreshLoadLayout=widget.PullRefreshLoadLayout||(widget.PullRefreshLoadLayout={}));})(widget=androidui.widget||(androidui.widget={}));})(androidui||(androidui={}));var androidui;(function(androidui){var native;(function(native){var Canvas=android.graphics.Canvas;var sNextID=0;var NativeCanvas=function(_Canvas2){_inherits(NativeCanvas,_Canvas2);function NativeCanvas(){_classCallCheck(this,NativeCanvas);return _possibleConstructorReturn(this,(NativeCanvas.__proto__||Object.getPrototypeOf(NativeCanvas)).apply(this,arguments));}_createClass(NativeCanvas,[{key:'initCanvasImpl',value:function initCanvasImpl(){this.canvasId=++sNextID;this.createCanvasImpl();}},{key:'createCanvasImpl',value:function createCanvasImpl(){native.NativeApi.canvas.createCanvas(this.canvasId,this.mWidth,this.mHeight);this.save();}},{key:'recycleImpl',value:function recycleImpl(){native.NativeApi.canvas.recycleCanvas(this.canvasId);}},{key:'isNativeAccelerated',value:function isNativeAccelerated(){return true;}},{key:'translateImpl',value:function translateImpl(dx,dy){native.NativeApi.canvas.translate(this.canvasId,dx,dy);}},{key:'scaleImpl',value:function scaleImpl(sx,sy){native.NativeApi.canvas.scale(this.canvasId,sx,sy);}},{key:'rotateImpl',value:function rotateImpl(degrees){native.NativeApi.canvas.rotate(this.canvasId,degrees);}},{key:'concatImpl',value:function concatImpl(MSCALE_X,MSKEW_X,MTRANS_X,MSKEW_Y,MSCALE_Y,MTRANS_Y,MPERSP_0,MPERSP_1,MPERSP_2){native.NativeApi.canvas.concat(this.canvasId,MSCALE_X,MSKEW_X,MTRANS_X,MSKEW_Y,MSCALE_Y,MTRANS_Y);}},{key:'drawARGBImpl',value:function drawARGBImpl(a,r,g,b){native.NativeApi.canvas.drawColor(this.canvasId,android.graphics.Color.argb(a,r,g,b));}},{key:'clearColorImpl',value:function clearColorImpl(){native.NativeApi.canvas.clearColor(this.canvasId);}},{key:'saveImpl',value:function saveImpl(){native.NativeApi.canvas.save(this.canvasId);}},{key:'restoreImpl',value:function restoreImpl(){native.NativeApi.canvas.restore(this.canvasId);}},{key:'clipRectImpl',value:function clipRectImpl(left,top,width,height){native.NativeApi.canvas.clipRect(this.canvasId,left,top,width,height);}},{key:'clipRoundRectImpl',value:function clipRoundRectImpl(left,top,width,height,radiusTopLeft,radiusTopRight,radiusBottomRight,radiusBottomLeft){native.NativeApi.canvas.clipRoundRectImpl(this.canvasId,left,top,width,height,radiusTopLeft,radiusTopRight,radiusBottomRight,radiusBottomLeft);}},{key:'drawCanvasImpl',value:function drawCanvasImpl(canvas,offsetX,offsetY){if(canvas instanceof NativeCanvas){native.NativeApi.canvas.drawCanvas(this.canvasId,canvas.canvasId,offsetX,offsetY);}else{throw Error('canvas should be NativeCanvas');}}},{key:'drawImageImpl',value:function drawImageImpl(image,srcRect,dstRect){if(image instanceof native.NativeImage){if(srcRect&&dstRect){native.NativeApi.canvas.drawImage8args(this.canvasId,image.imageId,srcRect.left,srcRect.top,srcRect.right,srcRect.bottom,dstRect.left,dstRect.top,dstRect.right,dstRect.bottom);}else if(dstRect){native.NativeApi.canvas.drawImage4args(this.canvasId,image.imageId,dstRect.left,dstRect.top,dstRect.right,dstRect.bottom);}else{native.NativeApi.canvas.drawImage2args(this.canvasId,image.imageId,0,0);}}else{throw Error('image should be NativeImage');}}},{key:'drawRectImpl',value:function drawRectImpl(left,top,width,height,style){native.NativeApi.canvas.drawRect(this.canvasId,left,top,width,height,style);}},{key:'drawOvalImpl',value:function drawOvalImpl(oval,style){native.NativeApi.canvas.drawOval(this.canvasId,oval.left,oval.top,oval.right,oval.bottom,style);}},{key:'drawCircleImpl',value:function drawCircleImpl(cx,cy,radius,style){native.NativeApi.canvas.drawCircle(this.canvasId,cx,cy,radius,style);}},{key:'drawArcImpl',value:function drawArcImpl(oval,startAngle,sweepAngle,useCenter,style){native.NativeApi.canvas.drawArc(this.canvasId,oval.left,oval.top,oval.right,oval.bottom,startAngle,sweepAngle,useCenter,style);}},{key:'drawRoundRectImpl',value:function drawRoundRectImpl(rect,radiusTopLeft,radiusTopRight,radiusBottomRight,radiusBottomLeft,style){native.NativeApi.canvas.drawRoundRectImpl(this.canvasId,rect.left,rect.top,rect.width(),rect.height(),radiusTopLeft,radiusTopRight,radiusBottomRight,radiusBottomLeft,style);}},{key:'drawTextImpl',value:function drawTextImpl(text,x,y,style){native.NativeApi.canvas.drawText(this.canvasId,text,x,y,style);}},{key:'setColorImpl',value:function setColorImpl(color,style){native.NativeApi.canvas.setFillColor(this.canvasId,color,style);}},{key:'multiplyGlobalAlphaImpl',value:function multiplyGlobalAlphaImpl(alpha){native.NativeApi.canvas.multiplyGlobalAlpha(this.canvasId,alpha);}},{key:'setGlobalAlphaImpl',value:function setGlobalAlphaImpl(alpha){native.NativeApi.canvas.setGlobalAlpha(this.canvasId,alpha);}},{key:'setTextAlignImpl',value:function setTextAlignImpl(align){native.NativeApi.canvas.setTextAlign(this.canvasId,align);}},{key:'setLineWidthImpl',value:function setLineWidthImpl(width){native.NativeApi.canvas.setLineWidth(this.canvasId,width);}},{key:'setLineCapImpl',value:function setLineCapImpl(lineCap){native.NativeApi.canvas.setLineCap(this.canvasId,lineCap);}},{key:'setLineJoinImpl',value:function setLineJoinImpl(lineJoin){native.NativeApi.canvas.setLineJoin(this.canvasId,lineJoin);}},{key:'setShadowImpl',value:function setShadowImpl(radius,dx,dy,color){native.NativeApi.canvas.setShadow(this.canvasId,radius,dx,dy,color);}},{key:'setFontSizeImpl',value:function setFontSizeImpl(size){native.NativeApi.canvas.setFontSize(this.canvasId,size);}},{key:'setFontImpl',value:function setFontImpl(fontName){native.NativeApi.canvas.setFont(this.canvasId,fontName);}},{key:'isImageSmoothingEnabledImpl',value:function isImageSmoothingEnabledImpl(){return false;}},{key:'setImageSmoothingEnabledImpl',value:function setImageSmoothingEnabledImpl(enable){}}],[{key:'applyTextMeasure',value:function applyTextMeasure(cacheMeasureTextSize,defaultWidth,widths){android.graphics.Canvas.measureTextImpl=function(text,textSize){var width=0;for(var i=0,length=text.length;i<length;i++){var c=text.charCodeAt(i);var cWidth=widths[c]||defaultWidth;width+=cWidth*textSize/cacheMeasureTextSize;}return width;};}}]);return NativeCanvas;}(Canvas);native.NativeCanvas=NativeCanvas;})(native=androidui.native||(androidui.native={}));})(androidui||(androidui={}));var androidui;(function(androidui){var native;(function(native){var Surface=android.view.Surface;var sNextSurfaceID=0;var SurfaceInstances=new Map();var NativeSurface=function(_Surface){_inherits(NativeSurface,_Surface);function NativeSurface(){_classCallCheck(this,NativeSurface);return _possibleConstructorReturn(this,(NativeSurface.__proto__||Object.getPrototypeOf(NativeSurface)).apply(this,arguments));}_createClass(NativeSurface,[{key:'initImpl',value:function initImpl(){this.initCanvasBound();this.surfaceId=++sNextSurfaceID;SurfaceInstances.set(this.surfaceId,this);var bound=this.mCanvasBound;native.NativeApi.surface.createSurface(this.surfaceId,bound.left,bound.top,bound.right,bound.bottom);}},{key:'notifyBoundChange',value:function notifyBoundChange(){this.initCanvasBound();var bound=this.mCanvasBound;native.NativeApi.surface.onSurfaceBoundChange(this.surfaceId,bound.left,bound.top,bound.right,bound.bottom);}},{key:'lockCanvasImpl',value:function lockCanvasImpl(left,top,width,height){if(!this.lockedCanvas){this.lockedCanvas=new NativeSurfaceLockCanvas(width,height);}native.NativeApi.surface.lockCanvas(this.surfaceId,this.lockedCanvas.canvasId,left,top,left+width,top+height);return this.lockedCanvas;}},{key:'unlockCanvasAndPost',value:function unlockCanvasAndPost(canvas){if(canvas instanceof native.NativeCanvas){native.NativeApi.surface.unlockCanvasAndPost(this.surfaceId,canvas.canvasId);}else{throw Error('canvas is not NativeCanvas');}}},{key:'showFps',value:function showFps(fps){native.NativeApi.surface.showFps(fps);}}],[{key:'notifySurfaceReady',value:function notifySurfaceReady(surfaceId){var surface=SurfaceInstances.get(surfaceId);surface.viewRoot.scheduleTraversals();}},{key:'notifySurfaceSupportDirtyDraw',value:function notifySurfaceSupportDirtyDraw(surfaceId,dirtyDrawSupport){var surface=SurfaceInstances.get(surfaceId);surface.mSupportDirtyDraw=dirtyDrawSupport;surface.viewRoot.scheduleTraversals();}}]);return NativeSurface;}(Surface);native.NativeSurface=NativeSurface;var NativeSurfaceLockCanvas=function(_native$NativeCanvas){_inherits(NativeSurfaceLockCanvas,_native$NativeCanvas);function NativeSurfaceLockCanvas(){_classCallCheck(this,NativeSurfaceLockCanvas);return _possibleConstructorReturn(this,(NativeSurfaceLockCanvas.__proto__||Object.getPrototypeOf(NativeSurfaceLockCanvas)).apply(this,arguments));}_createClass(NativeSurfaceLockCanvas,[{key:'createCanvasImpl',value:function createCanvasImpl(){}}]);return NativeSurfaceLockCanvas;}(native.NativeCanvas);})(native=androidui.native||(androidui.native={}));})(androidui||(androidui={}));var androidui;(function(androidui){var native;(function(native){var NetImage=androidui.image.NetImage;var Rect=android.graphics.Rect;var sNextId=0;var NativeImageInstances=new Map();var NativeImage=function(_NetImage){_inherits(NativeImage,_NetImage);function NativeImage(){_classCallCheck(this,NativeImage);return _possibleConstructorReturn(this,(NativeImage.__proto__||Object.getPrototypeOf(NativeImage)).apply(this,arguments));}_createClass(NativeImage,[{key:'createImage',value:function createImage(){this.imageId=sNextId++;NativeImageInstances.set(this.imageId,this);native.NativeApi.image.createImage(this.imageId);}},{key:'loadImage',value:function loadImage(){native.NativeApi.image.loadImage(this.imageId,this.src);}},{key:'recycle',value:function recycle(){native.NativeApi.image.recycleImage(this.imageId);NativeImageInstances.delete(this.imageId);}},{key:'getPixels',value:function getPixels(bound,callBack){if(!callBack)return;if(!bound)bound=new Rect(0,0,this.width,this.height);if(bound.isEmpty()){callBack([]);return;}if(!this.getPixelsCallbacks)this.getPixelsCallbacks=[];this.getPixelsCallbacks.push(callBack);var callBackIndex=this.getPixelsCallbacks.length-1;native.NativeApi.image.getPixels(this.imageId,callBackIndex,bound.left,bound.top,bound.right,bound.bottom);}},{key:'getBorderPixels',value:function getBorderPixels(callBack){if(!callBack)return;if(this.leftBorder&&this.topBorder&&this.rightBorder&&this.bottomBorder){callBack(this.leftBorder,this.topBorder,this.rightBorder,this.bottomBorder);}else{_get2(NativeImage.prototype.__proto__||Object.getPrototypeOf(NativeImage.prototype),'getBorderPixels',this).call(this,callBack);}}}],[{key:'notifyLoadFinish',value:function notifyLoadFinish(imageId,width,height,leftBorder,topBorder,rightBorder,bottomBorder){var image=NativeImageInstances.get(imageId);image.mImageWidth=width;image.mImageHeight=height;image.leftBorder=leftBorder;image.topBorder=topBorder;image.rightBorder=rightBorder;image.bottomBorder=bottomBorder;image.fireOnLoad();}},{key:'notifyLoadError',value:function notifyLoadError(imageId){var image=NativeImageInstances.get(imageId);image.mImageWidth=image.mImageHeight=0;image.fireOnError();}},{key:'notifyGetPixels',value:function notifyGetPixels(imageId,callBackIndex,data){var image=NativeImageInstances.get(imageId);var callBack=image.getPixelsCallbacks[callBackIndex];image.getPixelsCallbacks[callBackIndex]=null;callBack(data);}}]);return NativeImage;}(NetImage);native.NativeImage=NativeImage;})(native=androidui.native||(androidui.native={}));})(androidui||(androidui={}));var androidui;(function(androidui){var native;(function(native){var Rect=android.graphics.Rect;var NativeEditText=function(_android$widget$EditT){_inherits(NativeEditText,_android$widget$EditT);function NativeEditText(){_classCallCheck(this,NativeEditText);var _this203=_possibleConstructorReturn(this,(NativeEditText.__proto__||Object.getPrototypeOf(NativeEditText)).apply(this,arguments));_this203.mRectTmp=new Rect();return _this203;}_createClass(NativeEditText,[{key:'computeTextArea',value:function computeTextArea(){this.getGlobalVisibleRect(this.mRectTmp);if(this.mLayout==null){this.assumeLayout();}this.mRectTmp.left+=this.getTotalPaddingLeft();this.mRectTmp.top+=this.getTotalPaddingTop();this.mRectTmp.right-=this.getTotalPaddingRight();this.mRectTmp.bottom-=this.getTotalPaddingBottom();}},{key:'onInputElementFocusChanged',value:function onInputElementFocusChanged(focused){if(focused){this.computeTextArea();native.NativeApi.drawHTML.showDrawHTMLBound(this.hashCode(),this.mRectTmp.left,this.mRectTmp.top,this.mRectTmp.right,this.mRectTmp.bottom);}else{native.NativeApi.drawHTML.hideDrawHTMLBound(this.hashCode());}return _get2(NativeEditText.prototype.__proto__||Object.getPrototypeOf(NativeEditText.prototype),'onInputElementFocusChanged',this).call(this,focused);}},{key:'tryShowInputElement',value:function tryShowInputElement(){this.computeTextArea();native.NativeApi.drawHTML.showDrawHTMLBound(this.hashCode(),this.mRectTmp.left,this.mRectTmp.top,this.mRectTmp.right,this.mRectTmp.bottom);return _get2(NativeEditText.prototype.__proto__||Object.getPrototypeOf(NativeEditText.prototype),'tryShowInputElement',this).call(this);}},{key:'tryDismissInputElement',value:function tryDismissInputElement(){native.NativeApi.drawHTML.hideDrawHTMLBound(this.hashCode());return _get2(NativeEditText.prototype.__proto__||Object.getPrototypeOf(NativeEditText.prototype),'tryDismissInputElement',this).call(this);}},{key:'_syncBoundAndScrollToElement',value:function _syncBoundAndScrollToElement(){_get2(NativeEditText.prototype.__proto__||Object.getPrototypeOf(NativeEditText.prototype),'_syncBoundAndScrollToElement',this).call(this);if(this.isInputElementShowed()&&this.isFocused()&&this.getText().length>0){this.computeTextArea();native.NativeApi.drawHTML.showDrawHTMLBound(this.hashCode(),this.mRectTmp.left,this.mRectTmp.top,this.mRectTmp.right,this.mRectTmp.bottom);}}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){_get2(NativeEditText.prototype.__proto__||Object.getPrototypeOf(NativeEditText.prototype),'onDetachedFromWindow',this).call(this);native.NativeApi.drawHTML.hideDrawHTMLBound(this.hashCode());}}]);return NativeEditText;}(android.widget.EditText);native.NativeEditText=NativeEditText;})(native=androidui.native||(androidui.native={}));})(androidui||(androidui={}));var androidui;(function(androidui){var native;(function(native){var WebView=android.webkit.WebView;var Rect=android.graphics.Rect;var anchor=document.createElement('a');var webViewMap=new Map();var NativeWebView=function(_WebView){_inherits(NativeWebView,_WebView);function NativeWebView(context,bindElement,defStyle){_classCallCheck(this,NativeWebView);var _this204=_possibleConstructorReturn(this,(NativeWebView.__proto__||Object.getPrototypeOf(NativeWebView)).call(this,context,bindElement,defStyle));_this204.mBoundRect=new Rect();_this204.mRectTmp=new Rect();_this204.mLocationTmp=androidui.util.ArrayCreator.newNumberArray(2);native.NativeApi.webView.createWebView(_this204.hashCode());webViewMap.set(_this204.hashCode(),_this204);var activity=_this204.getContext();var onDestroy=activity.onDestroy;activity.onDestroy=function(){onDestroy.call(activity);webViewMap.delete(_this204.hashCode());native.NativeApi.webView.destroyWebView(_this204.hashCode());};return _this204;}_createClass(NativeWebView,[{key:'goBack',value:function goBack(){native.NativeApi.webView.webViewGoBack(this.hashCode());}},{key:'canGoBack',value:function canGoBack(){return this.mCanGoBack;}},{key:'loadUrl',value:function loadUrl(url){anchor.href=url;url=anchor.href;this.mUrl=url;native.NativeApi.webView.webViewLoadUrl(this.hashCode(),url);}},{key:'reload',value:function reload(){native.NativeApi.webView.webViewReload(this.hashCode());}},{key:'getUrl',value:function getUrl(){return this.mUrl;}},{key:'getTitle',value:function getTitle(){return this.mTitle||this.getUrl();}},{key:'setWebViewClient',value:function setWebViewClient(client){_get2(NativeWebView.prototype.__proto__||Object.getPrototypeOf(NativeWebView.prototype),'setWebViewClient',this).call(this,client);}},{key:'dependOnDebugLayout',value:function dependOnDebugLayout(){return false;}},{key:'_syncBoundAndScrollToElement',value:function _syncBoundAndScrollToElement(){_get2(NativeWebView.prototype.__proto__||Object.getPrototypeOf(NativeWebView.prototype),'_syncBoundAndScrollToElement',this).call(this);this.getLocationOnScreen(this.mLocationTmp);this.mRectTmp.set(this.mLocationTmp[0],this.mLocationTmp[1],this.mLocationTmp[0]+this.getWidth(),this.mLocationTmp[1]+this.getHeight());if(!this.mRectTmp.equals(this.mBoundRect)){this.mBoundRect.set(this.mRectTmp);native.NativeApi.webView.webViewBoundChange(this.hashCode(),this.mBoundRect.left,this.mBoundRect.top,this.mBoundRect.right,this.mBoundRect.bottom);}}}],[{key:'notifyLoadFinish',value:function notifyLoadFinish(viewHash,url,title){var nativeWebView=webViewMap.get(viewHash);if(nativeWebView==null)return;nativeWebView.mUrl=url;nativeWebView.mTitle=title;if(nativeWebView.mClient!=null){nativeWebView.mClient.onReceivedTitle(nativeWebView,title);nativeWebView.mClient.onPageFinished(nativeWebView,url);}}},{key:'notifyWebViewHistoryChange',value:function notifyWebViewHistoryChange(viewHash,currentHistoryIndex,historySize){var nativeWebView=webViewMap.get(viewHash);if(nativeWebView==null)return;nativeWebView.mCanGoBack=currentHistoryIndex>0;}}]);return NativeWebView;}(WebView);native.NativeWebView=NativeWebView;})(native=androidui.native||(androidui.native={}));})(androidui||(androidui={}));var androidui;(function(androidui){var native;(function(native){var HtmlView=androidui.widget.HtmlView;var Rect=android.graphics.Rect;var NativeHtmlView=function(_HtmlView){_inherits(NativeHtmlView,_HtmlView);function NativeHtmlView(){_classCallCheck(this,NativeHtmlView);var _this205=_possibleConstructorReturn(this,(NativeHtmlView.__proto__||Object.getPrototypeOf(NativeHtmlView)).apply(this,arguments));_this205.mRectDrawHTMLBoundTmp=new Rect();return _this205;}_createClass(NativeHtmlView,[{key:'_syncBoundAndScrollToElement',value:function _syncBoundAndScrollToElement(){_get2(NativeHtmlView.prototype.__proto__||Object.getPrototypeOf(NativeHtmlView.prototype),'_syncBoundAndScrollToElement',this).call(this);this.getGlobalVisibleRect(this.mRectDrawHTMLBoundTmp);native.NativeApi.drawHTML.showDrawHTMLBound(this.hashCode(),this.mRectDrawHTMLBoundTmp.left,this.mRectDrawHTMLBoundTmp.top,this.mRectDrawHTMLBoundTmp.right,this.mRectDrawHTMLBoundTmp.bottom);}},{key:'onDetachedFromWindow',value:function onDetachedFromWindow(){_get2(NativeHtmlView.prototype.__proto__||Object.getPrototypeOf(NativeHtmlView.prototype),'onDetachedFromWindow',this).call(this);native.NativeApi.drawHTML.hideDrawHTMLBound(this.hashCode());}}]);return NativeHtmlView;}(HtmlView);native.NativeHtmlView=NativeHtmlView;})(native=androidui.native||(androidui.native={}));})(androidui||(androidui={}));var androidui;(function(androidui){var native;(function(native){var AndroidJsBridgeProperty='AndroidUIRuntime';var JSBridge=window[AndroidJsBridgeProperty];var NativeApi=function NativeApi(){_classCallCheck(this,NativeApi);};native.NativeApi=NativeApi;(function(NativeApi){var BatchCall=function(){function BatchCall(){_classCallCheck(this,BatchCall);this.calls=[];}_createClass(BatchCall,[{key:'pushCall',value:function pushCall(method,methodArgs){var _calls;this.calls.push(method);(_calls=this.calls).push.apply(_calls,_toConsumableArray(methodArgs));this.calls.push(null);}},{key:'clear',value:function clear(){this.calls=[];}},{key:'toString',value:function toString(){return this.calls.join('\\n');}}]);return BatchCall;}();var batchCall=new BatchCall();var SurfaceApi=function(){function SurfaceApi(){_classCallCheck(this,SurfaceApi);}_createClass(SurfaceApi,[{key:'createSurface',value:function createSurface(surfaceId,left,top,right,bottom){JSBridge.createSurface(surfaceId,left,top,right,bottom);}},{key:'onSurfaceBoundChange',value:function onSurfaceBoundChange(surfaceId,left,top,right,bottom){JSBridge.onSurfaceBoundChange(surfaceId,left,top,right,bottom);}},{key:'lockCanvas',value:function lockCanvas(surfaceId,canvasId,left,top,right,bottom){batchCall.pushCall('31',[surfaceId,canvasId,left,top,right,bottom]);}},{key:'unlockCanvasAndPost',value:function unlockCanvasAndPost(surfaceId,canvasId){batchCall.pushCall('32',[surfaceId,canvasId]);JSBridge.batchCall(batchCall.toString());batchCall.clear();}},{key:'showFps',value:function showFps(fps){JSBridge.showJSFps(fps);}}]);return SurfaceApi;}();NativeApi.SurfaceApi=SurfaceApi;var CanvasApi=function(){function CanvasApi(){_classCallCheck(this,CanvasApi);}_createClass(CanvasApi,[{key:'createCanvas',value:function createCanvas(canvasId,width,height){batchCall.pushCall('33',[canvasId,width,height]);}},{key:'recycleCanvas',value:function recycleCanvas(canvasId){batchCall.pushCall('34',[canvasId]);}},{key:'translate',value:function translate(canvasId,dx,dy){batchCall.pushCall('35',[canvasId,dx,dy]);}},{key:'scale',value:function scale(canvasId,sx,sy){batchCall.pushCall('36',[canvasId,sx,sy]);}},{key:'rotate',value:function rotate(canvasId,degrees){batchCall.pushCall('37',[canvasId,degrees]);}},{key:'concat',value:function concat(canvasId,MSCALE_X,MSKEW_X,MTRANS_X,MSKEW_Y,MSCALE_Y,MTRANS_Y){batchCall.pushCall('38',[canvasId,MSCALE_X,MSKEW_X,MTRANS_X,MSKEW_Y,MSCALE_Y,MTRANS_Y]);}},{key:'drawColor',value:function drawColor(canvasId,color){batchCall.pushCall('39',[canvasId,color]);}},{key:'clearColor',value:function clearColor(canvasId){batchCall.pushCall('40',[canvasId]);}},{key:'drawRect',value:function drawRect(canvasId,left,top,width,height,style){batchCall.pushCall('41',[canvasId,left,top,width,height,style||android.graphics.Paint.Style.FILL]);}},{key:'clipRect',value:function clipRect(canvasId,left,top,width,height){batchCall.pushCall('42',[canvasId,left,top,width,height]);}},{key:'save',value:function save(canvasId){batchCall.pushCall('43',[canvasId]);}},{key:'restore',value:function restore(canvasId){batchCall.pushCall('44',[canvasId]);}},{key:'drawCanvas',value:function drawCanvas(canvasId,drawCanvasId,offsetX,offsetY){batchCall.pushCall('45',[canvasId,drawCanvasId,offsetX,offsetY]);}},{key:'drawText',value:function drawText(canvasId,text,x,y,fillStyle){text='\"'+text.replace(/(\\n)+|(\\r\\n)+/g,\"\\\\n\")+'\"';batchCall.pushCall('47',[canvasId,text,x,y,fillStyle||android.graphics.Paint.Style.FILL]);}},{key:'setFillColor',value:function setFillColor(canvasId,color,style){batchCall.pushCall('49',[canvasId,color,style||android.graphics.Paint.Style.FILL]);}},{key:'multiplyGlobalAlpha',value:function multiplyGlobalAlpha(canvasId,alpha){batchCall.pushCall('50',[canvasId,alpha]);}},{key:'setGlobalAlpha',value:function setGlobalAlpha(canvasId,alpha){batchCall.pushCall('51',[canvasId,alpha]);}},{key:'setTextAlign',value:function setTextAlign(canvasId,align){batchCall.pushCall('52',[canvasId,align]);}},{key:'setLineWidth',value:function setLineWidth(canvasId,width){batchCall.pushCall('53',[canvasId,width]);}},{key:'setLineCap',value:function setLineCap(canvasId,lineCap){batchCall.pushCall('54',[canvasId,lineCap]);}},{key:'setLineJoin',value:function setLineJoin(canvasId,lineJoin){batchCall.pushCall('55',[canvasId,lineJoin]);}},{key:'setShadow',value:function setShadow(canvasId,radius,dx,dy,color){batchCall.pushCall('56',[canvasId,radius,dx,dy,color]);}},{key:'setFontSize',value:function setFontSize(canvasId,size){batchCall.pushCall('57',[canvasId,size]);}},{key:'setFont',value:function setFont(canvasId,fontName){batchCall.pushCall('58',[canvasId,fontName]);}},{key:'drawOval',value:function drawOval(canvasId,left,top,right,bottom,style){batchCall.pushCall('59',[canvasId,left,top,right,bottom,style||android.graphics.Paint.Style.FILL]);}},{key:'drawCircle',value:function drawCircle(canvasId,cx,cy,radius,style){batchCall.pushCall('60',[canvasId,cx,cy,radius,style||android.graphics.Paint.Style.FILL]);}},{key:'drawArc',value:function drawArc(canvasId,left,top,right,bottom,startAngle,sweepAngle,useCenter,style){batchCall.pushCall('61',[canvasId,left,top,right,bottom,startAngle,sweepAngle,useCenter,style||android.graphics.Paint.Style.FILL]);}},{key:'drawRoundRectImpl',value:function drawRoundRectImpl(canvasId,left,top,width,height,radiusTopLeft,radiusTopRight,radiusBottomRight,radiusBottomLeft,style){batchCall.pushCall('62',[canvasId,left,top,width,height,radiusTopLeft,radiusTopRight,radiusBottomRight,radiusBottomLeft,style||android.graphics.Paint.Style.FILL]);}},{key:'clipRoundRectImpl',value:function clipRoundRectImpl(canvasId,left,top,width,height,radiusTopLeft,radiusTopRight,radiusBottomRight,radiusBottomLeft){batchCall.pushCall('63',[canvasId,left,top,width,height,radiusTopLeft,radiusTopRight,radiusBottomRight,radiusBottomLeft]);}},{key:'drawImage2args',value:function drawImage2args(canvasId,drawImageId,left,top){batchCall.pushCall('70',[canvasId,drawImageId,left,top]);}},{key:'drawImage4args',value:function drawImage4args(canvasId,drawImageId,dstLeft,dstTop,dstRight,dstBottom){batchCall.pushCall('71',[canvasId,drawImageId,dstLeft,dstTop,dstRight,dstBottom]);}},{key:'drawImage8args',value:function drawImage8args(canvasId,drawImageId,srcLeft,srcTop,srcRight,srcBottom,dstLeft,dstTop,dstRight,dstBottom){batchCall.pushCall('72',[canvasId,drawImageId,srcLeft,srcTop,srcRight,srcBottom,dstLeft,dstTop,dstRight,dstBottom]);}}]);return CanvasApi;}();NativeApi.CanvasApi=CanvasApi;})(NativeApi=native.NativeApi||(native.NativeApi={}));if(JSBridge){android.view.Surface.prototype=native.NativeSurface.prototype;android.graphics.Canvas.prototype=native.NativeCanvas.prototype;androidui.image.NetImage.prototype=native.NativeImage.prototype;android.widget.EditText=native.NativeEditText;android.webkit.WebView=native.NativeWebView;androidui.widget.HtmlView=native.NativeHtmlView;NativeApi.surface=new NativeApi.SurfaceApi();NativeApi.canvas=new NativeApi.CanvasApi();NativeApi.image=JSBridge;NativeApi.drawHTML=JSBridge;NativeApi.webView=JSBridge;android.os.MessageQueue.requestNextLoop=function(){setTimeout(android.os.MessageQueue.loop,0);};androidui.AndroidUI.showAppClosed=function(){JSBridge.closeApp();};JSBridge.initRuntime();window.addEventListener('load',function(){setInterval(function(){JSBridge.pageAlive(1500);},800);});}})(native=androidui.native||(androidui.native={}));})(androidui||(androidui={}));window['android']=android;window['java']=java;window['AndroidUI']=androidui.AndroidUI;(function(){var event=document.createEvent(\"CustomEvent\");event.initCustomEvent(\"AndroidUILoadFinish\",true,true,null);document.dispatchEvent(event);})();\n\n//# sourceMappingURL=android-ui.es5.js.map"
  },
  {
    "path": "dist/android-ui.js",
    "content": "/**\n * AndroidUIX v0.7.0\n * https://github.com/linfaxin/AndroidUIX\n */\nvar java;\n(function (java) {\n    var util;\n    (function (util) {\n        class ArrayList {\n            constructor(initialCapacity = 0) {\n                this.array = [];\n            }\n            size() {\n                return this.array.length;\n            }\n            isEmpty() {\n                return this.size() <= 0;\n            }\n            contains(o) {\n                return this.indexOf(o) >= 0;\n            }\n            indexOf(o) {\n                return this.array.indexOf(o);\n            }\n            lastIndexOf(o) {\n                return this.array.lastIndexOf(o);\n            }\n            clone() {\n                let arrayList = new ArrayList();\n                arrayList.array.push(...this.array);\n                return arrayList;\n            }\n            toArray(a = new Array(this.size())) {\n                let size = this.size();\n                for (let i = 0; i < size; i++) {\n                    a[i] = this.array[i];\n                }\n                return a;\n            }\n            getArray() {\n                return this.array;\n            }\n            get(index) {\n                index = Math.floor(index);\n                return this.array[index];\n            }\n            set(index, element) {\n                index = Math.floor(index);\n                let old = this.array[index];\n                this.array[index] = element;\n                return old;\n            }\n            add(...args) {\n                let index, t;\n                if (args.length === 1)\n                    t = args[0];\n                else if (args.length === 2) {\n                    index = Math.floor(args[0]);\n                    t = args[1];\n                }\n                if (index === undefined)\n                    this.array.push(t);\n                else\n                    this.array.splice(index, 0, t);\n            }\n            remove(o) {\n                let index;\n                if (Number.isInteger(o)) {\n                    index = o;\n                }\n                else {\n                    index = this.array.indexOf(o);\n                }\n                let old = this.array[index];\n                this.array.splice(index, 1);\n                return old;\n            }\n            clear() {\n                this.array = [];\n            }\n            addAll(...args) {\n                let index, list;\n                if (args.length === 1) {\n                    list = args[0];\n                }\n                else if (args.length === 2) {\n                    index = Math.floor(args[0]);\n                    list = args[1];\n                }\n                if (index === undefined) {\n                    this.array.push(...list.array);\n                }\n                else {\n                    this.array.splice(index, 0, ...list.array);\n                }\n            }\n            removeAll(list) {\n                let oldSize = this.size();\n                list.array.forEach((item) => {\n                    let index = this.array.indexOf(item);\n                    this.array.splice(index, 1);\n                });\n                return this.size() === oldSize;\n            }\n            [Symbol.iterator]() {\n                return this.array[Symbol.iterator];\n            }\n            subList(fromIndex, toIndex) {\n                let list = new ArrayList();\n                fromIndex = Math.floor(fromIndex);\n                toIndex = Math.floor(toIndex);\n                for (var i = fromIndex; i < toIndex; i++) {\n                    list.array.push(this.array[i]);\n                }\n                return list;\n            }\n            toString() {\n                return this.array.toString();\n            }\n            sort(compareFn) {\n                this.array.sort(compareFn);\n            }\n        }\n        util.ArrayList = ArrayList;\n    })(util = java.util || (java.util = {}));\n})(java || (java = {}));\nvar android;\n(function (android) {\n    var os;\n    (function (os) {\n        class Bundle {\n            constructor(copy) {\n                if (copy)\n                    Object.assign(this, copy);\n            }\n            get(key, defaultValue) {\n                if (this.containsKey(key)) {\n                    return this[key];\n                }\n                return defaultValue;\n            }\n            put(key, value) {\n                this[key] = value;\n            }\n            containsKey(key) {\n                return key in this;\n            }\n        }\n        os.Bundle = Bundle;\n    })(os = android.os || (android.os = {}));\n})(android || (android = {}));\nvar java;\n(function (java) {\n    var lang;\n    (function (lang) {\n        class StringBuilder {\n            constructor(arg) {\n                this.array = [];\n                if (!Number.isInteger(arg) && arg) {\n                    this.append(arg);\n                }\n            }\n            length() {\n                return this.array.length;\n            }\n            append(a) {\n                let str = a + '';\n                this.array.push(...str.split(''));\n                return this;\n            }\n            deleteCharAt(index) {\n                this.array.splice(index, 1);\n                return this;\n            }\n            replace(start, end, str) {\n                this.array.splice(start, end - start, ...str.split(''));\n                return this;\n            }\n            setLength(length) {\n                let arrayLength = this.array.length;\n                if (length === arrayLength)\n                    return;\n                if (length < arrayLength) {\n                    this.array = this.array.splice(length, arrayLength - length);\n                }\n                else {\n                    for (let i = 0; i < arrayLength - length; i++) {\n                        this.array.push('\\0');\n                    }\n                }\n            }\n            toString() {\n                return this.array.join('');\n            }\n        }\n        lang.StringBuilder = StringBuilder;\n    })(lang = java.lang || (java.lang = {}));\n})(java || (java = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        var StringBuilder = java.lang.StringBuilder;\n        class Rect {\n            constructor(...args) {\n                this.left = 0;\n                this.top = 0;\n                this.right = 0;\n                this.bottom = 0;\n                if (args.length === 1) {\n                    let rect = args[0];\n                    this.left = rect.left;\n                    this.top = rect.top;\n                    this.right = rect.right;\n                    this.bottom = rect.bottom;\n                }\n                else if (args.length === 4 || args.length === 0) {\n                    let [left = 0, t = 0, right = 0, bottom = 0] = args;\n                    this.left = left || 0;\n                    this.top = t || 0;\n                    this.right = right || 0;\n                    this.bottom = bottom || 0;\n                }\n            }\n            equals(r) {\n                if (this === r)\n                    return true;\n                if (!r || !(r instanceof Rect))\n                    return false;\n                return this.left === r.left && this.top === r.top\n                    && this.right === r.right && this.bottom === r.bottom;\n            }\n            toString() {\n                let sb = new StringBuilder();\n                sb.append(\"Rect(\");\n                sb.append(this.left);\n                sb.append(\", \");\n                sb.append(this.top);\n                sb.append(\" - \");\n                sb.append(this.right);\n                sb.append(\", \");\n                sb.append(this.bottom);\n                sb.append(\")\");\n                return sb.toString();\n            }\n            toShortString(sb = new StringBuilder()) {\n                sb.setLength(0);\n                sb.append('[');\n                sb.append(this.left);\n                sb.append(',');\n                sb.append(this.top);\n                sb.append(\"][\");\n                sb.append(this.right);\n                sb.append(',');\n                sb.append(this.bottom);\n                sb.append(']');\n                return sb.toString();\n            }\n            flattenToString() {\n                let sb = new StringBuilder(32);\n                sb.append(this.left);\n                sb.append(' ');\n                sb.append(this.top);\n                sb.append(' ');\n                sb.append(this.right);\n                sb.append(' ');\n                sb.append(this.bottom);\n                return sb.toString();\n            }\n            static unflattenFromString(str) {\n                let parts = str.split(\" \");\n                return new Rect(Number.parseInt(parts[0]), Number.parseInt(parts[1]), Number.parseInt(parts[2]), Number.parseInt(parts[3]));\n            }\n            isEmpty() {\n                return this.left >= this.right || this.top >= this.bottom;\n            }\n            width() {\n                return this.right - this.left;\n            }\n            height() {\n                return this.bottom - this.top;\n            }\n            centerX() {\n                return (this.left + this.right) >> 1;\n            }\n            centerY() {\n                return (this.top + this.bottom) >> 1;\n            }\n            exactCenterX() {\n                return (this.left + this.right) * 0.5;\n            }\n            exactCenterY() {\n                return (this.top + this.bottom) * 0.5;\n            }\n            setEmpty() {\n                this.left = this.right = this.top = this.bottom = 0;\n            }\n            set(...args) {\n                if (args.length === 1) {\n                    let rect = args[0];\n                    [this.left, this.top, this.right, this.bottom] = [rect.left, rect.top, rect.right, rect.bottom];\n                }\n                else {\n                    let [left = 0, t = 0, right = 0, bottom = 0] = args;\n                    this.left = left || 0;\n                    this.top = t || 0;\n                    this.right = right || 0;\n                    this.bottom = bottom || 0;\n                }\n            }\n            offset(dx, dy) {\n                this.left += dx;\n                this.top += dy;\n                this.right += dx;\n                this.bottom += dy;\n            }\n            offsetTo(newLeft, newTop) {\n                this.right += newLeft - this.left;\n                this.bottom += newTop - this.top;\n                this.left = newLeft;\n                this.top = newTop;\n            }\n            inset(dx, dy) {\n                this.left += dx;\n                this.top += dy;\n                this.right -= dx;\n                this.bottom -= dy;\n            }\n            contains(...args) {\n                if (args.length === 1) {\n                    let r = args[0];\n                    return this.left < this.right && this.top < this.bottom\n                        && this.left <= r.left && this.top <= r.top && this.right >= r.right && this.bottom >= r.bottom;\n                }\n                else if (args.length === 2) {\n                    let [x, y] = args;\n                    return this.left < this.right && this.top < this.bottom\n                        && x >= this.left && x < this.right && y >= this.top && y < this.bottom;\n                }\n                else {\n                    let [left = 0, t = 0, right = 0, bottom = 0] = args;\n                    return this.left < this.right && this.top < this.bottom\n                        && this.left <= left && this.top <= t\n                        && this.right >= right && this.bottom >= bottom;\n                }\n            }\n            intersect(...args) {\n                if (args.length === 1) {\n                    let rect = args[0];\n                    return this.intersect(rect.left, rect.top, rect.right, rect.bottom);\n                }\n                else {\n                    let [left = 0, t = 0, right = 0, bottom = 0] = args;\n                    if (this.left < right && left < this.right && this.top < bottom && t < this.bottom) {\n                        if (this.left < left)\n                            this.left = left;\n                        if (this.top < t)\n                            this.top = t;\n                        if (this.right > right)\n                            this.right = right;\n                        if (this.bottom > bottom)\n                            this.bottom = bottom;\n                        return true;\n                    }\n                    return false;\n                }\n            }\n            setIntersect(a, b) {\n                if (a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom) {\n                    this.left = Math.max(a.left, b.left);\n                    this.top = Math.max(a.top, b.top);\n                    this.right = Math.min(a.right, b.right);\n                    this.bottom = Math.min(a.bottom, b.bottom);\n                    return true;\n                }\n                return false;\n            }\n            intersects(...args) {\n                if (args.length === 1) {\n                    let rect = args[0];\n                    return this.intersects(rect.left, rect.top, rect.right, rect.bottom);\n                }\n                else {\n                    let [left = 0, t = 0, right = 0, bottom = 0] = args;\n                    return this.left < right && left < this.right && this.top < bottom && t < this.bottom;\n                }\n            }\n            static intersects(a, b) {\n                return a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom;\n            }\n            union(...args) {\n                if (arguments.length === 1) {\n                    let rect = args[0];\n                    this.union(rect.left, rect.top, rect.right, rect.bottom);\n                }\n                else if (arguments.length === 2) {\n                    let [x = 0, y = 0] = args;\n                    if (x < this.left) {\n                        this.left = x;\n                    }\n                    else if (x > this.right) {\n                        this.right = x;\n                    }\n                    if (y < this.top) {\n                        this.top = y;\n                    }\n                    else if (y > this.bottom) {\n                        this.bottom = y;\n                    }\n                }\n                else {\n                    let left = args[0];\n                    let top = args[1];\n                    let right = args[2];\n                    let bottom = args[3];\n                    if ((left < right) && (top < bottom)) {\n                        if ((this.left < this.right) && (this.top < this.bottom)) {\n                            if (this.left > left)\n                                this.left = left;\n                            if (this.top > top)\n                                this.top = top;\n                            if (this.right < right)\n                                this.right = right;\n                            if (this.bottom < bottom)\n                                this.bottom = bottom;\n                        }\n                        else {\n                            this.left = left;\n                            this.top = top;\n                            this.right = right;\n                            this.bottom = bottom;\n                        }\n                    }\n                }\n            }\n            sort() {\n                if (this.left > this.right) {\n                    [this.left, this.right] = [this.right, this.left];\n                }\n                if (this.top > this.bottom) {\n                    [this.top, this.bottom] = [this.bottom, this.top];\n                }\n            }\n            scale(scale) {\n                if (scale != 1) {\n                    this.left = this.left * scale;\n                    this.top = this.top * scale;\n                    this.right = this.right * scale;\n                    this.bottom = this.bottom * scale;\n                }\n            }\n        }\n        graphics.Rect = Rect;\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        class Gravity {\n            static apply(gravity, w, h, container, outRect, layoutDirection) {\n                let xAdj = 0, yAdj = 0;\n                if (layoutDirection != null)\n                    gravity = Gravity.getAbsoluteGravity(gravity, layoutDirection);\n                switch (gravity & ((Gravity.AXIS_PULL_BEFORE | Gravity.AXIS_PULL_AFTER) << Gravity.AXIS_X_SHIFT)) {\n                    case 0:\n                        outRect.left = container.left + ((container.right - container.left - w) / 2) + xAdj;\n                        outRect.right = outRect.left + w;\n                        if ((gravity & (Gravity.AXIS_CLIP << Gravity.AXIS_X_SHIFT)) == (Gravity.AXIS_CLIP << Gravity.AXIS_X_SHIFT)) {\n                            if (outRect.left < container.left) {\n                                outRect.left = container.left;\n                            }\n                            if (outRect.right > container.right) {\n                                outRect.right = container.right;\n                            }\n                        }\n                        break;\n                    case Gravity.AXIS_PULL_BEFORE << Gravity.AXIS_X_SHIFT:\n                        outRect.left = container.left + xAdj;\n                        outRect.right = outRect.left + w;\n                        if ((gravity & (Gravity.AXIS_CLIP << Gravity.AXIS_X_SHIFT)) == (Gravity.AXIS_CLIP << Gravity.AXIS_X_SHIFT)) {\n                            if (outRect.right > container.right) {\n                                outRect.right = container.right;\n                            }\n                        }\n                        break;\n                    case Gravity.AXIS_PULL_AFTER << Gravity.AXIS_X_SHIFT:\n                        outRect.right = container.right - xAdj;\n                        outRect.left = outRect.right - w;\n                        if ((gravity & (Gravity.AXIS_CLIP << Gravity.AXIS_X_SHIFT)) == (Gravity.AXIS_CLIP << Gravity.AXIS_X_SHIFT)) {\n                            if (outRect.left < container.left) {\n                                outRect.left = container.left;\n                            }\n                        }\n                        break;\n                    default:\n                        outRect.left = container.left + xAdj;\n                        outRect.right = container.right + xAdj;\n                        break;\n                }\n                switch (gravity & ((Gravity.AXIS_PULL_BEFORE | Gravity.AXIS_PULL_AFTER) << Gravity.AXIS_Y_SHIFT)) {\n                    case 0:\n                        outRect.top = container.top + ((container.bottom - container.top - h) / 2) + yAdj;\n                        outRect.bottom = outRect.top + h;\n                        if ((gravity & (Gravity.AXIS_CLIP << Gravity.AXIS_Y_SHIFT)) == (Gravity.AXIS_CLIP << Gravity.AXIS_Y_SHIFT)) {\n                            if (outRect.top < container.top) {\n                                outRect.top = container.top;\n                            }\n                            if (outRect.bottom > container.bottom) {\n                                outRect.bottom = container.bottom;\n                            }\n                        }\n                        break;\n                    case Gravity.AXIS_PULL_BEFORE << Gravity.AXIS_Y_SHIFT:\n                        outRect.top = container.top + yAdj;\n                        outRect.bottom = outRect.top + h;\n                        if ((gravity & (Gravity.AXIS_CLIP << Gravity.AXIS_Y_SHIFT)) == (Gravity.AXIS_CLIP << Gravity.AXIS_Y_SHIFT)) {\n                            if (outRect.bottom > container.bottom) {\n                                outRect.bottom = container.bottom;\n                            }\n                        }\n                        break;\n                    case Gravity.AXIS_PULL_AFTER << Gravity.AXIS_Y_SHIFT:\n                        outRect.bottom = container.bottom - yAdj;\n                        outRect.top = outRect.bottom - h;\n                        if ((gravity & (Gravity.AXIS_CLIP << Gravity.AXIS_Y_SHIFT)) == (Gravity.AXIS_CLIP << Gravity.AXIS_Y_SHIFT)) {\n                            if (outRect.top < container.top) {\n                                outRect.top = container.top;\n                            }\n                        }\n                        break;\n                    default:\n                        outRect.top = container.top + yAdj;\n                        outRect.bottom = container.bottom + yAdj;\n                        break;\n                }\n            }\n            static getAbsoluteGravity(gravity, layoutDirection) {\n                return gravity;\n            }\n            static parseGravity(gravityStr, defaultGravity = Gravity.NO_GRAVITY) {\n                if (!gravityStr)\n                    return defaultGravity;\n                let gravity = null;\n                try {\n                    let parts = gravityStr.split(\"|\");\n                    for (let part of parts) {\n                        let g = Gravity[part.toUpperCase()];\n                        if (Number.isInteger(g))\n                            gravity |= g;\n                    }\n                }\n                catch (e) {\n                    console.error(e);\n                }\n                if (Number.isNaN(gravity))\n                    return defaultGravity;\n                return gravity;\n            }\n        }\n        Gravity.NO_GRAVITY = 0x0000;\n        Gravity.AXIS_SPECIFIED = 0x0001;\n        Gravity.AXIS_PULL_BEFORE = 0x0002;\n        Gravity.AXIS_PULL_AFTER = 0x0004;\n        Gravity.AXIS_CLIP = 0x0008;\n        Gravity.AXIS_X_SHIFT = 0;\n        Gravity.AXIS_Y_SHIFT = 4;\n        Gravity.TOP = (Gravity.AXIS_PULL_BEFORE | Gravity.AXIS_SPECIFIED) << Gravity.AXIS_Y_SHIFT;\n        Gravity.BOTTOM = (Gravity.AXIS_PULL_AFTER | Gravity.AXIS_SPECIFIED) << Gravity.AXIS_Y_SHIFT;\n        Gravity.LEFT = (Gravity.AXIS_PULL_BEFORE | Gravity.AXIS_SPECIFIED) << Gravity.AXIS_X_SHIFT;\n        Gravity.RIGHT = (Gravity.AXIS_PULL_AFTER | Gravity.AXIS_SPECIFIED) << Gravity.AXIS_X_SHIFT;\n        Gravity.START = Gravity.LEFT;\n        Gravity.END = Gravity.RIGHT;\n        Gravity.CENTER_VERTICAL = Gravity.AXIS_SPECIFIED << Gravity.AXIS_Y_SHIFT;\n        Gravity.FILL_VERTICAL = Gravity.TOP | Gravity.BOTTOM;\n        Gravity.CENTER_HORIZONTAL = Gravity.AXIS_SPECIFIED << Gravity.AXIS_X_SHIFT;\n        Gravity.FILL_HORIZONTAL = Gravity.LEFT | Gravity.RIGHT;\n        Gravity.CENTER = Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL;\n        Gravity.FILL = Gravity.FILL_VERTICAL | Gravity.FILL_HORIZONTAL;\n        Gravity.CLIP_VERTICAL = Gravity.AXIS_CLIP << Gravity.AXIS_Y_SHIFT;\n        Gravity.CLIP_HORIZONTAL = Gravity.AXIS_CLIP << Gravity.AXIS_X_SHIFT;\n        Gravity.HORIZONTAL_GRAVITY_MASK = (Gravity.AXIS_SPECIFIED |\n            Gravity.AXIS_PULL_BEFORE | Gravity.AXIS_PULL_AFTER) << Gravity.AXIS_X_SHIFT;\n        Gravity.VERTICAL_GRAVITY_MASK = (Gravity.AXIS_SPECIFIED |\n            Gravity.AXIS_PULL_BEFORE | Gravity.AXIS_PULL_AFTER) << Gravity.AXIS_Y_SHIFT;\n        Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK = Gravity.HORIZONTAL_GRAVITY_MASK;\n        Gravity.DISPLAY_CLIP_VERTICAL = 0x10000000;\n        Gravity.DISPLAY_CLIP_HORIZONTAL = 0x01000000;\n        view.Gravity = Gravity;\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var util;\n    (function (util) {\n        class SparseMap {\n            constructor(initialCapacity) {\n                this.map = new Map();\n            }\n            clone() {\n                let clone = new SparseMap();\n                clone.map = new Map(this.map);\n                return clone;\n            }\n            get(key, valueIfKeyNotFound = null) {\n                let value = this.map.get(key);\n                if (value === undefined)\n                    return valueIfKeyNotFound;\n                return value;\n            }\n            delete(key) {\n                this.map.delete(key);\n            }\n            remove(key) {\n                this.delete(key);\n            }\n            removeAt(index) {\n                this.removeAtRange(index);\n            }\n            removeAtRange(index, size = 1) {\n                let keys = [...this.map.keys()];\n                let end = Math.min(this.map.size, index + size);\n                for (let i = index; i < end; i++) {\n                    this.map.delete(keys[i]);\n                }\n            }\n            put(key, value) {\n                this.map.set(key, value);\n            }\n            size() {\n                return this.map.size;\n            }\n            keyAt(index) {\n                return [...this.map.keys()][index];\n            }\n            valueAt(index) {\n                return [...this.map.values()][index];\n            }\n            setValueAt(index, value) {\n                let key = this.keyAt(index);\n                this.map.set(key, value);\n            }\n            indexOfKey(key) {\n                return [...this.map.keys()].indexOf(key);\n            }\n            indexOfValue(value) {\n                return [...this.map.values()].indexOf(value);\n            }\n            clear() {\n                this.map.clear();\n            }\n            append(key, value) {\n                this.put(key, value);\n            }\n        }\n        util.SparseMap = SparseMap;\n    })(util = android.util || (android.util = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var util;\n    (function (util) {\n        class SparseArray extends util.SparseMap {\n        }\n        util.SparseArray = SparseArray;\n    })(util = android.util || (android.util = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var util;\n    (function (util) {\n        class Log {\n            static getPriorityString(priority) {\n                if (priority > Log.PriorityString.length)\n                    return \"\";\n                return Log.PriorityString[priority - 2];\n            }\n            static v(tag, msg, tr) {\n                console.log(Log.getLogMsg(Log.VERBOSE, tag, msg));\n                if (tr)\n                    console.log(tr);\n            }\n            static d(tag, msg) {\n                console.debug(Log.getLogMsg(Log.DEBUG, tag, msg));\n            }\n            static i(tag, msg, tr) {\n                console.info(Log.getLogMsg(Log.INFO, tag, msg));\n                if (tr)\n                    console.info(tr);\n            }\n            static w(tag, msg, tr) {\n                console.warn(Log.getLogMsg(Log.WARN, tag, msg));\n                if (tr)\n                    console.warn(tr);\n            }\n            static e(tag, msg, tr) {\n                console.error(Log.getLogMsg(Log.ERROR, tag, msg));\n                if (tr)\n                    console.error(tr);\n            }\n            static getLogMsg(priority, tag, msg) {\n                let d = new Date();\n                let dateFormat = d.toLocaleTimeString() + '.' + d.getUTCMilliseconds();\n                return \"[\" + Log.getPriorityString(priority) + \"] \" + dateFormat + \" \\t \" + tag + \" \\t \" + msg;\n            }\n        }\n        Log.View_DBG = false;\n        Log.VelocityTracker_DBG = false;\n        Log.DBG_DrawableContainer = false;\n        Log.DBG_StateListDrawable = false;\n        Log.VERBOSE = 2;\n        Log.DEBUG = 3;\n        Log.INFO = 4;\n        Log.WARN = 5;\n        Log.ERROR = 6;\n        Log.ASSERT = 7;\n        Log.PriorityString = [\"VERBOSE\", \"DEBUG\", \"INFO\", \"WARN\", \"ERROR\", \"ASSERT\"];\n        util.Log = Log;\n    })(util = android.util || (android.util = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        class PixelFormat {\n        }\n        PixelFormat.UNKNOWN = 0;\n        PixelFormat.TRANSLUCENT = -3;\n        PixelFormat.TRANSPARENT = -2;\n        PixelFormat.OPAQUE = -1;\n        PixelFormat.RGBA_8888 = 1;\n        PixelFormat.RGBX_8888 = 2;\n        PixelFormat.RGB_888 = 3;\n        PixelFormat.RGB_565 = 4;\n        graphics.PixelFormat = PixelFormat;\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar java;\n(function (java) {\n    var lang;\n    (function (lang) {\n        var ref;\n        (function (ref) {\n            class WeakReference {\n                constructor(referent) {\n                    this.weakMap = new WeakMap();\n                    this.weakMap.set(this, referent);\n                }\n                get() {\n                    return this.weakMap.get(this);\n                }\n                set(value) {\n                    this.weakMap.set(this, value);\n                }\n                clear() {\n                    this.weakMap.delete(this);\n                }\n            }\n            ref.WeakReference = WeakReference;\n        })(ref = lang.ref || (lang.ref = {}));\n    })(lang = java.lang || (java.lang = {}));\n})(java || (java = {}));\nvar java;\n(function (java) {\n    var lang;\n    (function (lang) {\n        var Runnable;\n        (function (Runnable) {\n            function of(func) {\n                return {\n                    run: func\n                };\n            }\n            Runnable.of = of;\n        })(Runnable = lang.Runnable || (lang.Runnable = {}));\n    })(lang = java.lang || (java.lang = {}));\n})(java || (java = {}));\nvar java;\n(function (java) {\n    var lang;\n    (function (lang) {\n        class System {\n            static currentTimeMillis() {\n                return new Date().getTime();\n            }\n            static arraycopy(src, srcPos, dest, destPos, length) {\n                let srcLength = src.length;\n                let destLength = dest.length;\n                for (let i = 0; i < length; i++) {\n                    let srcIndex = i + srcPos;\n                    if (srcIndex >= srcLength)\n                        return;\n                    let destIndex = i + destPos;\n                    if (destIndex >= destLength)\n                        return;\n                    dest[destIndex] = src[srcIndex];\n                }\n            }\n        }\n        System.out = {\n            println(any) {\n                console.log('\\n');\n                console.log(any);\n            },\n            print(any) {\n                console.log(any);\n            }\n        };\n        lang.System = System;\n    })(lang = java.lang || (java.lang = {}));\n})(java || (java = {}));\nvar androidui;\n(function (androidui) {\n    var util;\n    (function (util) {\n        class ArrayCreator {\n            static newNumberArray(size) {\n                let array = new Array(size);\n                if (size > 0)\n                    ArrayCreator.fillArray(array, 0);\n                return array;\n            }\n            static newBooleanArray(size) {\n                let array = new Array(size);\n                ArrayCreator.fillArray(array, false);\n                return array;\n            }\n            static fillArray(array, value) {\n                for (var i = 0, length = array.length; i < length; i++) {\n                    array[i] = value;\n                }\n            }\n        }\n        util.ArrayCreator = ArrayCreator;\n    })(util = androidui.util || (androidui.util = {}));\n})(androidui || (androidui = {}));\nvar android;\n(function (android) {\n    var util;\n    (function (util) {\n        var System = java.lang.System;\n        class StateSet {\n            static isWildCard(stateSetOrSpec) {\n                return stateSetOrSpec.length == 0 || stateSetOrSpec[0] == 0;\n            }\n            static stateSetMatches(stateSpec, stateSetOrState) {\n                if (Number.isInteger(stateSetOrState)) {\n                    return StateSet._stateSetMatches_single(stateSpec, stateSetOrState);\n                }\n                let stateSet = stateSetOrState;\n                if (stateSet == null) {\n                    return (stateSpec == null || this.isWildCard(stateSpec));\n                }\n                let stateSpecSize = stateSpec.length;\n                let stateSetSize = stateSet.length;\n                for (let i = 0; i < stateSpecSize; i++) {\n                    let stateSpecState = stateSpec[i];\n                    if (stateSpecState == 0) {\n                        return true;\n                    }\n                    let mustMatch;\n                    if (stateSpecState > 0) {\n                        mustMatch = true;\n                    }\n                    else {\n                        mustMatch = false;\n                        stateSpecState = -stateSpecState;\n                    }\n                    let found = false;\n                    for (let j = 0; j < stateSetSize; j++) {\n                        const state = stateSet[j];\n                        if (state == 0) {\n                            if (mustMatch) {\n                                return false;\n                            }\n                            else {\n                                break;\n                            }\n                        }\n                        if (state == stateSpecState) {\n                            if (mustMatch) {\n                                found = true;\n                                break;\n                            }\n                            else {\n                                return false;\n                            }\n                        }\n                    }\n                    if (mustMatch && !found) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            static _stateSetMatches_single(stateSpec, state) {\n                let stateSpecSize = stateSpec.length;\n                for (let i = 0; i < stateSpecSize; i++) {\n                    let stateSpecState = stateSpec[i];\n                    if (stateSpecState == 0) {\n                        return true;\n                    }\n                    if (stateSpecState > 0) {\n                        if (state != stateSpecState) {\n                            return false;\n                        }\n                    }\n                    else {\n                        if (state == -stateSpecState) {\n                            return false;\n                        }\n                    }\n                }\n                return true;\n            }\n            static trimStateSet(states, newSize) {\n                if (states.length == newSize) {\n                    return states;\n                }\n                let trimmedStates = androidui.util.ArrayCreator.newNumberArray(newSize);\n                System.arraycopy(states, 0, trimmedStates, 0, newSize);\n                return trimmedStates;\n            }\n        }\n        StateSet.WILD_CARD = [];\n        StateSet.NOTHING = [0];\n        util.StateSet = StateSet;\n    })(util = android.util || (android.util = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var util;\n    (function (util) {\n        class Pools {\n        }\n        util.Pools = Pools;\n        (function (Pools) {\n            class SimplePool {\n                constructor(maxPoolSize) {\n                    this.mPoolSize = 0;\n                    if (maxPoolSize <= 0) {\n                        throw new Error(\"The max pool size must be > 0\");\n                    }\n                    this.mPool = new Array(maxPoolSize);\n                }\n                acquire() {\n                    if (this.mPoolSize > 0) {\n                        const lastPooledIndex = this.mPoolSize - 1;\n                        let instance = this.mPool[lastPooledIndex];\n                        this.mPool[lastPooledIndex] = null;\n                        this.mPoolSize--;\n                        return instance;\n                    }\n                    return null;\n                }\n                release(instance) {\n                    if (this.isInPool(instance)) {\n                        throw new Error(\"Already in the pool!\");\n                    }\n                    if (this.mPoolSize < this.mPool.length) {\n                        this.mPool[this.mPoolSize] = instance;\n                        this.mPoolSize++;\n                        return true;\n                    }\n                    return false;\n                }\n                isInPool(instance) {\n                    for (let i = 0; i < this.mPoolSize; i++) {\n                        if (this.mPool[i] == instance) {\n                            return true;\n                        }\n                    }\n                    return false;\n                }\n            }\n            Pools.SimplePool = SimplePool;\n            class SynchronizedPool extends SimplePool {\n            }\n            Pools.SynchronizedPool = SynchronizedPool;\n        })(Pools = util.Pools || (util.Pools = {}));\n    })(util = android.util || (android.util = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        class Color {\n            static alpha(color) {\n                return color >>> 24;\n            }\n            static red(color) {\n                return (color >> 16) & 0xFF;\n            }\n            static green(color) {\n                return (color >> 8) & 0xFF;\n            }\n            static blue(color) {\n                return color & 0xFF;\n            }\n            static rgb(red, green, blue) {\n                return (0xFF << 24) | (red << 16) | (green << 8) | blue;\n            }\n            static argb(alpha, red, green, blue) {\n                return (alpha << 24) | (red << 16) | (green << 8) | blue;\n            }\n            static rgba(red, green, blue, alpha) {\n                return (alpha << 24) | (red << 16) | (green << 8) | blue;\n            }\n            static parseColor(colorString, defaultColor) {\n                if (colorString.charAt(0) == '#') {\n                    if (colorString.length === 4) {\n                        colorString = '#' + colorString[1] + colorString[1] + colorString[2] + colorString[2] + colorString[3] + colorString[3];\n                    }\n                    let color = parseInt(colorString.substring(1), 16);\n                    if (colorString.length == 7) {\n                        color |= 0x00000000ff000000;\n                    }\n                    else if (colorString.length != 9) {\n                        if (defaultColor != null)\n                            return defaultColor;\n                        throw new Error(\"Unknown color : \" + colorString);\n                    }\n                    return color;\n                }\n                else if (colorString.startsWith('rgb(')) {\n                    colorString = colorString.substring(colorString.indexOf('(') + 1, colorString.lastIndexOf(')'));\n                    let parts = colorString.split(',');\n                    return Color.rgb(Number.parseInt(parts[0]), Number.parseInt(parts[1]), Number.parseInt(parts[2]));\n                }\n                else if (colorString.startsWith('rgba(')) {\n                    colorString = colorString.substring(colorString.indexOf('(') + 1, colorString.lastIndexOf(')'));\n                    let parts = colorString.split(',');\n                    return Color.rgba(Number.parseInt(parts[0]), Number.parseInt(parts[1]), Number.parseInt(parts[2]), Number.parseFloat(parts[3]) * 255);\n                }\n                else {\n                    let color = Color.sColorNameMap.get(colorString.toLowerCase());\n                    if (color != null) {\n                        return color;\n                    }\n                }\n                if (defaultColor != null)\n                    return defaultColor;\n                throw new Error(\"Unknown color : \" + colorString);\n            }\n            static toARGBHex(color) {\n                let r = Color.red(color);\n                let g = Color.green(color);\n                let b = Color.blue(color);\n                let a = Color.alpha(color);\n                let hR = r < 16 ? '0' + r.toString(16) : r.toString(16);\n                let hG = g < 16 ? '0' + g.toString(16) : g.toString(16);\n                let hB = b < 16 ? '0' + b.toString(16) : b.toString(16);\n                let hA = a < 16 ? '0' + a.toString(16) : a.toString(16);\n                return \"#\" + hA + hR + hG + hB;\n            }\n            static toRGBAFunc(color) {\n                let r = Color.red(color);\n                let g = Color.green(color);\n                let b = Color.blue(color);\n                let a = Color.alpha(color);\n                return `rgba(${r},${g},${b},${a / 255})`;\n            }\n            static getHtmlColor(color) {\n                let i = Color.sColorNameMap.get(color.toLowerCase());\n                return i;\n            }\n        }\n        Color.BLACK = 0xFF000000;\n        Color.DKGRAY = 0xFF444444;\n        Color.GRAY = 0xFF888888;\n        Color.LTGRAY = 0xFFCCCCCC;\n        Color.WHITE = 0xFFFFFFFF;\n        Color.RED = 0xFFFF0000;\n        Color.GREEN = 0xFF00FF00;\n        Color.BLUE = 0xFF0000FF;\n        Color.YELLOW = 0xFFFFFF00;\n        Color.CYAN = 0xFF00FFFF;\n        Color.MAGENTA = 0xFFFF00FF;\n        Color.TRANSPARENT = 0;\n        Color.sColorNameMap = new Map();\n        graphics.Color = Color;\n        Color.sColorNameMap = new Map();\n        Color.sColorNameMap.set(\"black\", Color.BLACK);\n        Color.sColorNameMap.set(\"darkgray\", Color.DKGRAY);\n        Color.sColorNameMap.set(\"gray\", Color.GRAY);\n        Color.sColorNameMap.set(\"lightgray\", Color.LTGRAY);\n        Color.sColorNameMap.set(\"white\", Color.WHITE);\n        Color.sColorNameMap.set(\"red\", Color.RED);\n        Color.sColorNameMap.set(\"green\", Color.GREEN);\n        Color.sColorNameMap.set(\"blue\", Color.BLUE);\n        Color.sColorNameMap.set(\"yellow\", Color.YELLOW);\n        Color.sColorNameMap.set(\"cyan\", Color.CYAN);\n        Color.sColorNameMap.set(\"magenta\", Color.MAGENTA);\n        Color.sColorNameMap.set(\"aqua\", 0xFF00FFFF);\n        Color.sColorNameMap.set(\"fuchsia\", 0xFFFF00FF);\n        Color.sColorNameMap.set(\"darkgrey\", Color.DKGRAY);\n        Color.sColorNameMap.set(\"grey\", Color.GRAY);\n        Color.sColorNameMap.set(\"lightgrey\", Color.LTGRAY);\n        Color.sColorNameMap.set(\"lime\", 0xFF00FF00);\n        Color.sColorNameMap.set(\"maroon\", 0xFF800000);\n        Color.sColorNameMap.set(\"navy\", 0xFF000080);\n        Color.sColorNameMap.set(\"olive\", 0xFF808000);\n        Color.sColorNameMap.set(\"purple\", 0xFF800080);\n        Color.sColorNameMap.set(\"silver\", 0xFFC0C0C0);\n        Color.sColorNameMap.set(\"teal\", 0xFF008080);\n        Color.sColorNameMap.set(\"transparent\", Color.TRANSPARENT);\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        class Paint {\n            constructor(flag = 0) {\n                this.mTextStyle = Paint.Style.FILL;\n                this.textScaleX = 1;\n                this.mFlag = 0;\n                this.shadowDx = 0;\n                this.shadowDy = 0;\n                this.shadowRadius = 0;\n                this.shadowColor = 0;\n                this.mFlag = flag;\n            }\n            set(src) {\n                if (this != src) {\n                    this.setClassVariablesFrom(src);\n                }\n            }\n            setClassVariablesFrom(paint) {\n                this.mTextStyle = paint.mTextStyle;\n                this.mColor = paint.mColor;\n                this.mStrokeWidth = paint.mStrokeWidth;\n                this.align = paint.align;\n                this.mStrokeCap = paint.mStrokeCap;\n                this.mStrokeJoin = paint.mStrokeJoin;\n                this.textSize = paint.textSize;\n                this.textScaleX = paint.textScaleX;\n                this.mFlag = paint.mFlag;\n                this.hasShadow = paint.hasShadow;\n                this.shadowDx = paint.shadowDx;\n                this.shadowDy = paint.shadowDy;\n                this.shadowRadius = paint.shadowRadius;\n                this.shadowColor = paint.shadowColor;\n                this.drawableState = paint.drawableState;\n            }\n            getStyle() {\n                return this.mTextStyle;\n            }\n            setStyle(style) {\n                this.mTextStyle = style;\n            }\n            getFlags() {\n                return this.mFlag;\n            }\n            setFlags(flags) {\n                this.mFlag = flags;\n            }\n            getTextScaleX() {\n                return this.textScaleX;\n            }\n            setTextScaleX(scaleX) {\n                this.textScaleX = scaleX;\n            }\n            getColor() {\n                return this.mColor;\n            }\n            setColor(color) {\n                this.mColor = color;\n            }\n            setARGB(a, r, g, b) {\n                this.setColor((a << 24) | (r << 16) | (g << 8) | b);\n            }\n            getAlpha() {\n                return graphics.Color.alpha(this.mColor);\n            }\n            setAlpha(alpha) {\n                this.setColor(graphics.Color.argb(alpha, graphics.Color.red(this.mColor), graphics.Color.green(this.mColor), graphics.Color.blue(this.mColor)));\n            }\n            getStrokeWidth() {\n                return this.mStrokeWidth;\n            }\n            setStrokeWidth(width) {\n                this.mStrokeWidth = width;\n            }\n            getStrokeCap() {\n                return this.mStrokeCap;\n            }\n            setStrokeCap(cap) {\n                this.mStrokeCap = cap;\n            }\n            getStrokeJoin() {\n                return this.mStrokeJoin;\n            }\n            setStrokeJoin(join) {\n                this.mStrokeJoin = join;\n            }\n            setAntiAlias(enable) {\n            }\n            isAntiAlias() {\n                return true;\n            }\n            setShadowLayer(radius, dx, dy, color) {\n                this.hasShadow = radius > 0.0;\n                this.shadowRadius = radius;\n                this.shadowDx = dx;\n                this.shadowDy = dy;\n                this.shadowColor = color;\n            }\n            clearShadowLayer() {\n                this.hasShadow = false;\n            }\n            getTextAlign() {\n                return this.align;\n            }\n            setTextAlign(align) {\n                this.align = align;\n            }\n            getTextSize() {\n                return this.textSize;\n            }\n            setTextSize(textSize) {\n                this.textSize = textSize;\n            }\n            ascent() {\n                return this.textSize * Paint.FontMetrics_Size_Ascent;\n            }\n            descent() {\n                return this.textSize * Paint.FontMetrics_Size_Descent;\n            }\n            getFontMetricsInt(fmi) {\n                if (this.textSize == null) {\n                    console.warn('call Paint.getFontMetricsInt but textSize not init');\n                    return 0;\n                }\n                if (fmi == null) {\n                    return Math.floor((Paint.FontMetrics_Size_Descent - Paint.FontMetrics_Size_Ascent) * this.textSize);\n                }\n                fmi.ascent = Math.floor(Paint.FontMetrics_Size_Ascent * this.textSize);\n                fmi.bottom = Math.floor(Paint.FontMetrics_Size_Bottom * this.textSize);\n                fmi.descent = Math.floor(Paint.FontMetrics_Size_Descent * this.textSize);\n                fmi.leading = Math.floor(Paint.FontMetrics_Size_Leading * this.textSize);\n                fmi.top = Math.floor(Paint.FontMetrics_Size_Top * this.textSize);\n                return fmi.descent - fmi.ascent;\n            }\n            getFontMetrics(metrics) {\n                if (this.textSize == null) {\n                    console.warn('call Paint.getFontMetrics but textSize not init');\n                    return 0;\n                }\n                if (metrics == null) {\n                    return (Paint.FontMetrics_Size_Descent - Paint.FontMetrics_Size_Ascent) * this.textSize;\n                }\n                metrics.ascent = Paint.FontMetrics_Size_Ascent * this.textSize;\n                metrics.bottom = Paint.FontMetrics_Size_Bottom * this.textSize;\n                metrics.descent = Paint.FontMetrics_Size_Descent * this.textSize;\n                metrics.leading = Paint.FontMetrics_Size_Leading * this.textSize;\n                metrics.top = Paint.FontMetrics_Size_Top * this.textSize;\n                return metrics.descent - metrics.ascent;\n            }\n            measureText(text, index = 0, count = text.length) {\n                return graphics.Canvas.measureText(text.substr(index, count), this.textSize) * this.textScaleX;\n            }\n            getTextWidths_count(text, index, count, widths) {\n                return this.getTextWidths_end(text, index, index + count, widths);\n            }\n            getTextWidths_end(text, start, end, widths) {\n                if (text == null) {\n                    throw Error(`new IllegalArgumentException(\"text cannot be null\")`);\n                }\n                if ((start | end | (end - start) | (text.length - end)) < 0) {\n                    throw Error(`new IndexOutOfBoundsException()`);\n                }\n                if (end - start > widths.length) {\n                    throw Error(`new ArrayIndexOutOfBoundsException()`);\n                }\n                if (text.length == 0 || start == end) {\n                    return 0;\n                }\n                for (let i = start; i < end; i++) {\n                    widths[i - start] = this.measureText(text[i]);\n                }\n                return end - start;\n            }\n            getTextWidths_2(text, widths) {\n                return this.getTextWidths_end(text, 0, text.length, widths);\n            }\n            getTextRunAdvances_count(chars, index, count, contextIndex, contextCount, flags, advances, advancesIndex) {\n                return this.getTextRunAdvances_end(chars, index, index + count, contextIndex, contextCount, flags, advances, advancesIndex);\n            }\n            getTextRunAdvances_end(text, start, end, contextStart, contextEnd, flags, advances, advancesIndex) {\n                if (text == null) {\n                    throw Error(`new IllegalArgumentException(\"text cannot be null\")`);\n                }\n                if (flags != Paint.DIRECTION_LTR && flags != Paint.DIRECTION_RTL) {\n                    throw Error(`new IllegalArgumentException(\"unknown flags value: \" + flags)`);\n                }\n                if ((start | end | contextStart | contextEnd | advancesIndex | (end - start)\n                    | (start - contextStart) | (contextEnd - end) | (text.length - contextEnd)\n                    | (advances == null ? 0 : (advances.length - advancesIndex - (end - start)))) < 0) {\n                    throw Error(`new IndexOutOfBoundsException()`);\n                }\n                if (text.length == 0 || start == end) {\n                    return 0;\n                }\n                let totalAdvance = 0;\n                for (let i = start; i < end; i++) {\n                    let width = this.measureText(text[i]);\n                    if (advances)\n                        advances[i - start + advancesIndex] = width;\n                    totalAdvance += width;\n                }\n                return totalAdvance;\n            }\n            getTextRunCursor_len(text, contextStart, contextLength, flags, offset, cursorOpt) {\n                let contextEnd = contextStart + contextLength;\n                if (((contextStart | contextEnd | offset | (contextEnd - contextStart) | (offset - contextStart) | (contextEnd - offset)\n                    | (text.length - contextEnd) | cursorOpt) < 0) || cursorOpt > Paint.CURSOR_OPT_MAX_VALUE) {\n                    throw Error(`new IndexOutOfBoundsException()`);\n                }\n                const scalarArray = androidui.util.ArrayCreator.newNumberArray(contextLength);\n                this.getTextRunAdvances_count(text, contextStart, contextLength, contextStart, contextLength, flags, scalarArray, 0);\n                let pos = offset - contextStart;\n                switch (cursorOpt) {\n                    case Paint.CURSOR_AFTER:\n                        if (pos < contextLength) {\n                            pos += 1;\n                        }\n                    case Paint.CURSOR_AT_OR_AFTER:\n                        while (pos < contextLength && scalarArray[pos] == 0) {\n                            ++pos;\n                        }\n                        break;\n                    case Paint.CURSOR_BEFORE:\n                        if (pos > 0) {\n                            --pos;\n                        }\n                    case Paint.CURSOR_AT_OR_BEFORE:\n                        while (pos > 0 && scalarArray[pos] == 0) {\n                            --pos;\n                        }\n                        break;\n                    case Paint.CURSOR_AT:\n                    default:\n                        if (scalarArray[pos] == 0) {\n                            pos = -1;\n                        }\n                        break;\n                }\n                if (pos != -1) {\n                    pos += contextStart;\n                }\n                return pos;\n            }\n            getTextRunCursor_end(text, contextStart, contextEnd, flags, offset, cursorOpt) {\n                if (((contextStart | contextEnd | offset | (contextEnd - contextStart) | (offset - contextStart) | (contextEnd - offset)\n                    | (text.length - contextEnd) | cursorOpt) < 0) || cursorOpt > Paint.CURSOR_OPT_MAX_VALUE) {\n                    throw Error(`new IndexOutOfBoundsException()`);\n                }\n                let contextLen = contextEnd - contextStart;\n                return this.getTextRunCursor_len(text, 0, contextLen, flags, offset - contextStart, cursorOpt);\n            }\n            isEmpty() {\n                return this.mColor == null\n                    && this.align == null\n                    && this.mStrokeWidth == null\n                    && this.mStrokeCap == null\n                    && this.mStrokeJoin == null\n                    && !this.hasShadow\n                    && this.textSize == null;\n            }\n            applyToCanvas(canvas) {\n                if (this.mColor != null) {\n                    canvas.setColor(this.mColor, this.getStyle());\n                }\n                if (this.align != null) {\n                    canvas.setTextAlign(Paint.Align[this.align].toLowerCase());\n                }\n                if (this.mStrokeWidth != null) {\n                    canvas.setLineWidth(this.mStrokeWidth);\n                }\n                if (this.mStrokeCap != null) {\n                    canvas.setLineCap(Paint.Cap[this.mStrokeCap].toLowerCase());\n                }\n                if (this.mStrokeJoin != null) {\n                    canvas.setLineJoin(Paint.Join[this.mStrokeJoin].toLowerCase());\n                }\n                if (this.hasShadow) {\n                    canvas.setShadow(this.shadowRadius, this.shadowDx, this.shadowDy, this.shadowColor);\n                }\n                if (this.textSize != null) {\n                    canvas.setFontSize(this.textSize);\n                }\n                if (this.textScaleX != 1) {\n                    canvas.scale(this.textScaleX, 1);\n                }\n            }\n        }\n        Paint.FontMetrics_Size_Ascent = -0.9277344;\n        Paint.FontMetrics_Size_Bottom = 0.2709961;\n        Paint.FontMetrics_Size_Descent = 0.24414062;\n        Paint.FontMetrics_Size_Leading = 0;\n        Paint.FontMetrics_Size_Top = -1.05615234;\n        Paint.DIRECTION_LTR = 0;\n        Paint.DIRECTION_RTL = 1;\n        Paint.CURSOR_AFTER = 0;\n        Paint.CURSOR_AT_OR_AFTER = 1;\n        Paint.CURSOR_BEFORE = 2;\n        Paint.CURSOR_AT_OR_BEFORE = 3;\n        Paint.CURSOR_AT = 4;\n        Paint.CURSOR_OPT_MAX_VALUE = Paint.CURSOR_AT;\n        Paint.ANTI_ALIAS_FLAG = 0x01;\n        Paint.FILTER_BITMAP_FLAG = 0x02;\n        Paint.DITHER_FLAG = 0x04;\n        Paint.UNDERLINE_TEXT_FLAG = 0x08;\n        Paint.STRIKE_THRU_TEXT_FLAG = 0x10;\n        Paint.FAKE_BOLD_TEXT_FLAG = 0x20;\n        Paint.LINEAR_TEXT_FLAG = 0x40;\n        Paint.SUBPIXEL_TEXT_FLAG = 0x80;\n        Paint.DEV_KERN_TEXT_FLAG = 0x100;\n        Paint.LCD_RENDER_TEXT_FLAG = 0x200;\n        Paint.EMBEDDED_BITMAP_TEXT_FLAG = 0x400;\n        Paint.AUTO_HINTING_TEXT_FLAG = 0x800;\n        Paint.VERTICAL_TEXT_FLAG = 0x1000;\n        Paint.DEFAULT_PAINT_FLAGS = Paint.DEV_KERN_TEXT_FLAG | Paint.EMBEDDED_BITMAP_TEXT_FLAG;\n        graphics.Paint = Paint;\n        (function (Paint) {\n            var Align;\n            (function (Align) {\n                Align[Align[\"LEFT\"] = 0] = \"LEFT\";\n                Align[Align[\"CENTER\"] = 1] = \"CENTER\";\n                Align[Align[\"RIGHT\"] = 2] = \"RIGHT\";\n            })(Align = Paint.Align || (Paint.Align = {}));\n            class FontMetrics {\n                constructor() {\n                    this.top = 0;\n                    this.ascent = 0;\n                    this.descent = 0;\n                    this.bottom = 0;\n                    this.leading = 0;\n                }\n            }\n            Paint.FontMetrics = FontMetrics;\n            class FontMetricsInt {\n                constructor() {\n                    this.top = 0;\n                    this.ascent = 0;\n                    this.descent = 0;\n                    this.bottom = 0;\n                    this.leading = 0;\n                }\n                toString() {\n                    return \"FontMetricsInt: top=\" + this.top + \" ascent=\" + this.ascent + \" descent=\" + this.descent + \" bottom=\" + this.bottom + \" leading=\" + this.leading;\n                }\n            }\n            Paint.FontMetricsInt = FontMetricsInt;\n            var Style;\n            (function (Style) {\n                Style[Style[\"FILL\"] = 0] = \"FILL\";\n                Style[Style[\"STROKE\"] = 1] = \"STROKE\";\n                Style[Style[\"FILL_AND_STROKE\"] = 2] = \"FILL_AND_STROKE\";\n            })(Style = Paint.Style || (Paint.Style = {}));\n            var Cap;\n            (function (Cap) {\n                Cap[Cap[\"BUTT\"] = 0] = \"BUTT\";\n                Cap[Cap[\"ROUND\"] = 1] = \"ROUND\";\n                Cap[Cap[\"SQUARE\"] = 2] = \"SQUARE\";\n            })(Cap = Paint.Cap || (Paint.Cap = {}));\n            var Join;\n            (function (Join) {\n                Join[Join[\"MITER\"] = 0] = \"MITER\";\n                Join[Join[\"ROUND\"] = 1] = \"ROUND\";\n                Join[Join[\"BEVEL\"] = 2] = \"BEVEL\";\n            })(Join = Paint.Join || (Paint.Join = {}));\n        })(Paint = graphics.Paint || (graphics.Paint = {}));\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        class Path {\n            reset() {\n            }\n        }\n        graphics.Path = Path;\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        class Point {\n            constructor(...args) {\n                this.x = 0;\n                this.y = 0;\n                if (args.length === 1) {\n                    let src = args[0];\n                    this.x = src.x;\n                    this.y = src.y;\n                }\n                else {\n                    let [x = 0, y = 0] = args;\n                    this.x = x;\n                    this.y = y;\n                }\n            }\n            set(x, y) {\n                this.x = x;\n                this.y = y;\n            }\n            negate() {\n                this.x = -this.x;\n                this.y = -this.y;\n            }\n            offset(dx, dy) {\n                this.x += dx;\n                this.y += dy;\n            }\n            equals(...args) {\n                if (args.length === 2) {\n                    let [x = 0, y = 0] = args;\n                    return this.x == x && this.y == y;\n                }\n                else {\n                    let o = args[0];\n                    if (this === o)\n                        return true;\n                    if (!o || !(o instanceof Point))\n                        return false;\n                    let point = o;\n                    if (this.x != point.x)\n                        return false;\n                    if (this.y != point.y)\n                        return false;\n                    return true;\n                }\n            }\n            toString() {\n                return \"Point(\" + this.x + \", \" + this.y + \")\";\n            }\n        }\n        graphics.Point = Point;\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        class RectF extends graphics.Rect {\n        }\n        graphics.RectF = RectF;\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        var System = java.lang.System;\n        var StringBuilder = java.lang.StringBuilder;\n        class Matrix {\n            constructor(values) {\n                this.mValues = androidui.util.ArrayCreator.newNumberArray(Matrix.MATRIX_SIZE);\n                if (values instanceof Matrix)\n                    this.set(values);\n                else if (values instanceof Array) {\n                    System.arraycopy(values, 0, this.mValues, 0, Matrix.MATRIX_SIZE);\n                }\n                else {\n                    Matrix.reset(this.mValues);\n                }\n            }\n            isIdentity() {\n                for (let i = 0, k = 0; i < 3; i++) {\n                    for (let j = 0; j < 3; j++, k++) {\n                        if (this.mValues[k] != ((i == j) ? 1 : 0)) {\n                            return false;\n                        }\n                    }\n                }\n                return true;\n            }\n            hasPerspective() {\n                return (this.mValues[6] != 0 || this.mValues[7] != 0 || this.mValues[8] != 1);\n            }\n            rectStaysRect() {\n                return (this.computeTypeMask() & Matrix.kRectStaysRect_Mask) != 0;\n            }\n            set(src) {\n                if (src == null) {\n                    this.reset();\n                }\n                else {\n                    System.arraycopy(src.mValues, 0, this.mValues, 0, Matrix.MATRIX_SIZE);\n                }\n            }\n            equals(obj) {\n                if (!(obj instanceof Matrix))\n                    return false;\n                let another = obj;\n                for (let i = 0; i < Matrix.MATRIX_SIZE; i++) {\n                    if (this.mValues[i] != another.mValues[i]) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            hashCode() {\n                return 44;\n            }\n            reset() {\n                Matrix.reset(this.mValues);\n            }\n            setTranslate(dx, dy) {\n                Matrix.setTranslate(this.mValues, dx, dy);\n            }\n            setScale(sx, sy, px, py) {\n                if (px == null || py == null) {\n                    this.mValues[0] = sx;\n                    this.mValues[1] = 0;\n                    this.mValues[2] = 0;\n                    this.mValues[3] = 0;\n                    this.mValues[4] = sy;\n                    this.mValues[5] = 0;\n                    this.mValues[6] = 0;\n                    this.mValues[7] = 0;\n                    this.mValues[8] = 1;\n                }\n                else {\n                    this.mValues = Matrix.getScale(sx, sy, px, py);\n                }\n            }\n            setRotate(degrees, px, py) {\n                if (px == null || py == null) {\n                    Matrix.setRotate_1(this.mValues, degrees);\n                }\n                else {\n                    this.mValues = Matrix.getRotate_3(degrees, px, py);\n                }\n            }\n            setSinCos(sinValue, cosValue, px, py) {\n                if (px == null || py == null) {\n                    Matrix.setRotate_2(this.mValues, sinValue, cosValue);\n                }\n                else {\n                    Matrix.setTranslate(this.mValues, -px, -py);\n                    this.postTransform(Matrix.getRotate_2(sinValue, cosValue));\n                    this.postTransform(Matrix.getTranslate(px, py));\n                }\n            }\n            setSkew(kx, ky, px, py) {\n                if (px == null || py == null) {\n                    this.mValues[0] = 1;\n                    this.mValues[1] = kx;\n                    this.mValues[2] = -0;\n                    this.mValues[3] = ky;\n                    this.mValues[4] = 1;\n                    this.mValues[5] = 0;\n                    this.mValues[6] = 0;\n                    this.mValues[7] = 0;\n                    this.mValues[8] = 1;\n                }\n                else {\n                    this.mValues = Matrix.getSkew(kx, ky, px, py);\n                }\n            }\n            setConcat(a, b) {\n                Matrix.multiply(this.mValues, a.mValues, b.mValues);\n                return true;\n            }\n            preTranslate(dx, dy) {\n                this.preTransform(Matrix.getTranslate(dx, dy));\n                return true;\n            }\n            preScale(sx, sy, px, py) {\n                this.preTransform(Matrix.getScale(sx, sy, px, py));\n                return true;\n            }\n            preRotate(degrees, px, py) {\n                if (px == null || py == null) {\n                    let rad = Math_toRadians(degrees);\n                    let sin = Math.sin(rad);\n                    let cos = Math.cos(rad);\n                    this.preTransform(Matrix.getRotate_2(sin, cos));\n                    return true;\n                }\n                this.preTransform(Matrix.getRotate_3(degrees, px, py));\n                return true;\n            }\n            preSkew(kx, ky, px, py) {\n                this.preTransform(Matrix.getSkew(kx, ky, px, py));\n                return true;\n            }\n            preConcat(other) {\n                this.preTransform(other.mValues);\n                return true;\n            }\n            postTranslate(dx, dy) {\n                this.postTransform(Matrix.getTranslate(dx, dy));\n                return true;\n            }\n            postScale(sx, sy, px, py) {\n                this.postTransform(Matrix.getScale(sx, sy, px, py));\n                return true;\n            }\n            postRotate(degrees, px, py) {\n                this.postTransform(Matrix.getRotate_3(degrees, px, py));\n                return true;\n            }\n            postSkew(kx, ky, px, py) {\n                this.postTransform(Matrix.getSkew(kx, ky, px, py));\n                return true;\n            }\n            postConcat(other) {\n                this.postTransform(other.mValues);\n                return true;\n            }\n            setRectToRect(src, dst, stf) {\n                if (dst == null || src == null) {\n                    throw Error(`new NullPointerException()`);\n                }\n                let d = this;\n                if (src.isEmpty()) {\n                    Matrix.reset(d.mValues);\n                    return false;\n                }\n                if (dst.isEmpty()) {\n                    d.mValues[0] = d.mValues[1] = d.mValues[2] = d.mValues[3] = d.mValues[4] = d.mValues[5] = d.mValues[6] = d.mValues[7] = 0;\n                    d.mValues[8] = 1;\n                }\n                else {\n                    let tx, sx = dst.width() / src.width();\n                    let ty, sy = dst.height() / src.height();\n                    let xLarger = false;\n                    if (stf != Matrix.ScaleToFit.FILL) {\n                        if (sx > sy) {\n                            xLarger = true;\n                            sx = sy;\n                        }\n                        else {\n                            sy = sx;\n                        }\n                    }\n                    tx = dst.left - src.left * sx;\n                    ty = dst.top - src.top * sy;\n                    if (stf == Matrix.ScaleToFit.CENTER || stf == Matrix.ScaleToFit.END) {\n                        let diff;\n                        if (xLarger) {\n                            diff = dst.width() - src.width() * sy;\n                        }\n                        else {\n                            diff = dst.height() - src.height() * sy;\n                        }\n                        if (stf == Matrix.ScaleToFit.CENTER) {\n                            diff = diff / 2;\n                        }\n                        if (xLarger) {\n                            tx += diff;\n                        }\n                        else {\n                            ty += diff;\n                        }\n                    }\n                    d.mValues[0] = sx;\n                    d.mValues[4] = sy;\n                    d.mValues[2] = tx;\n                    d.mValues[5] = ty;\n                    d.mValues[1] = d.mValues[3] = d.mValues[6] = d.mValues[7] = 0;\n                }\n                d.mValues[8] = 1;\n                return true;\n            }\n            static checkPointArrays(src, srcIndex, dst, dstIndex, pointCount) {\n                let srcStop = srcIndex + (pointCount << 1);\n                let dstStop = dstIndex + (pointCount << 1);\n                if ((pointCount | srcIndex | dstIndex | srcStop | dstStop) < 0 || srcStop > src.length || dstStop > dst.length) {\n                    throw Error(`new ArrayIndexOutOfBoundsException()`);\n                }\n            }\n            mapPoints(dst, dstIndex = 0, src = dst, srcIndex = 0, pointCount = dst.length >> 1) {\n                Matrix.checkPointArrays(src, srcIndex, dst, dstIndex, pointCount);\n                const count = pointCount * 2;\n                let tmpDest = dst;\n                let inPlace = dst == src;\n                if (inPlace) {\n                    tmpDest = androidui.util.ArrayCreator.newNumberArray(dstIndex + count);\n                }\n                for (let i = 0; i < count; i += 2) {\n                    let x = this.mValues[0] * src[i + srcIndex] + this.mValues[1] * src[i + srcIndex + 1] + this.mValues[2];\n                    let y = this.mValues[3] * src[i + srcIndex] + this.mValues[4] * src[i + srcIndex + 1] + this.mValues[5];\n                    tmpDest[i + dstIndex] = x;\n                    tmpDest[i + dstIndex + 1] = y;\n                }\n                if (inPlace) {\n                    System.arraycopy(tmpDest, dstIndex, dst, dstIndex, count);\n                }\n            }\n            mapVectors(dst, dstIndex = 0, src = dst, srcIndex = 0, ptCount = dst.length >> 1) {\n                Matrix.checkPointArrays(src, srcIndex, dst, dstIndex, ptCount);\n                if (this.hasPerspective()) {\n                    let origin = [0., 0.];\n                    this.mapPoints(origin);\n                    this.mapPoints(dst, dstIndex, src, srcIndex, ptCount);\n                    const count = ptCount * 2;\n                    for (let i = 0; i < count; i += 2) {\n                        dst[dstIndex + i] = dst[dstIndex + i] - origin[0];\n                        dst[dstIndex + i + 1] = dst[dstIndex + i + 1] - origin[1];\n                    }\n                }\n                else {\n                    let copy = new Matrix(this.mValues);\n                    Matrix.setTranslate(copy.mValues, 0, 0);\n                    copy.mapPoints(dst, dstIndex, src, srcIndex, ptCount);\n                }\n            }\n            mapRect(dst, src = dst) {\n                if (dst == null || src == null) {\n                    throw Error(`new NullPointerException()`);\n                }\n                let corners = [src.left, src.top, src.right, src.top, src.right, src.bottom, src.left, src.bottom];\n                this.mapPoints(corners);\n                dst.left = Math.min(Math.min(corners[0], corners[2]), Math.min(corners[4], corners[6]));\n                dst.right = Math.max(Math.max(corners[0], corners[2]), Math.max(corners[4], corners[6]));\n                dst.top = Math.min(Math.min(corners[1], corners[3]), Math.min(corners[5], corners[7]));\n                dst.bottom = Math.max(Math.max(corners[1], corners[3]), Math.max(corners[5], corners[7]));\n                return (this.computeTypeMask() & Matrix.kRectStaysRect_Mask) != 0;\n            }\n            mapRadius(radius) {\n                let src = [radius, 0., 0., radius];\n                this.mapVectors(src, 0, src, 0, 2);\n                let l1 = Matrix.getPointLength(src, 0);\n                let l2 = Matrix.getPointLength(src, 2);\n                return Math.sqrt(l1 * l2);\n            }\n            getValues(values) {\n                if (values.length < 9) {\n                    throw Error(`new ArrayIndexOutOfBoundsException()`);\n                }\n                System.arraycopy(this.mValues, 0, values, 0, Matrix.MATRIX_SIZE);\n            }\n            setValues(values) {\n                if (values.length < 9) {\n                    throw Error(`new ArrayIndexOutOfBoundsException()`);\n                }\n                System.arraycopy(values, 0, this.mValues, 0, Matrix.MATRIX_SIZE);\n            }\n            toString() {\n                let sb = new StringBuilder(64);\n                sb.append(\"Matrix{\");\n                this.toShortString(sb);\n                sb.append('}');\n                return sb.toString();\n            }\n            toShortString(sb) {\n                let values = androidui.util.ArrayCreator.newNumberArray(9);\n                this.getValues(values);\n                sb.append('[');\n                sb.append(values[0]);\n                sb.append(\", \");\n                sb.append(values[1]);\n                sb.append(\", \");\n                sb.append(values[2]);\n                sb.append(\"][\");\n                sb.append(values[3]);\n                sb.append(\", \");\n                sb.append(values[4]);\n                sb.append(\", \");\n                sb.append(values[5]);\n                sb.append(\"][\");\n                sb.append(values[6]);\n                sb.append(\", \");\n                sb.append(values[7]);\n                sb.append(\", \");\n                sb.append(values[8]);\n                sb.append(']');\n            }\n            postTransform(matrix) {\n                let tmp = androidui.util.ArrayCreator.newNumberArray(9);\n                Matrix.multiply(tmp, this.mValues, matrix);\n                this.mValues = tmp;\n            }\n            preTransform(matrix) {\n                let tmp = androidui.util.ArrayCreator.newNumberArray(9);\n                Matrix.multiply(tmp, matrix, this.mValues);\n                this.mValues = tmp;\n            }\n            static getPointLength(src, index) {\n                return Math.sqrt(src[index] * src[index] + src[index + 1] * src[index + 1]);\n            }\n            static multiply(dest, a, b) {\n                dest[0] = b[0] * a[0] + b[1] * a[3] + b[2] * a[6];\n                dest[1] = b[0] * a[1] + b[1] * a[4] + b[2] * a[7];\n                dest[2] = b[0] * a[2] + b[1] * a[5] + b[2] * a[8];\n                dest[3] = b[3] * a[0] + b[4] * a[3] + b[5] * a[6];\n                dest[4] = b[3] * a[1] + b[4] * a[4] + b[5] * a[7];\n                dest[5] = b[3] * a[2] + b[4] * a[5] + b[5] * a[8];\n                dest[6] = b[6] * a[0] + b[7] * a[3] + b[8] * a[6];\n                dest[7] = b[6] * a[1] + b[7] * a[4] + b[8] * a[7];\n                dest[8] = b[6] * a[2] + b[7] * a[5] + b[8] * a[8];\n            }\n            static getTranslate(dx, dy) {\n                return this.setTranslate(androidui.util.ArrayCreator.newNumberArray(9), dx, dy);\n            }\n            static setTranslate(dest, dx, dy) {\n                dest[0] = 1;\n                dest[1] = 0;\n                dest[2] = dx;\n                dest[3] = 0;\n                dest[4] = 1;\n                dest[5] = dy;\n                dest[6] = 0;\n                dest[7] = 0;\n                dest[8] = 1;\n                return dest;\n            }\n            static getScale(sx, sy, px, py) {\n                if (px == null || py == null) {\n                    return [sx, 0, 0, 0, sy, 0, 0, 0, 1];\n                }\n                let tmp = androidui.util.ArrayCreator.newNumberArray(9);\n                let tmp2 = androidui.util.ArrayCreator.newNumberArray(9);\n                this.setTranslate(tmp, -px, -py);\n                Matrix.multiply(tmp2, tmp, Matrix.getScale(sx, sy));\n                Matrix.multiply(tmp, tmp2, Matrix.getTranslate(px, py));\n                return tmp;\n            }\n            static getRotate_1(degrees) {\n                let rad = Math_toRadians(degrees);\n                let sin = Math.sin(rad);\n                let cos = Math.cos(rad);\n                return Matrix.getRotate_2(sin, cos);\n            }\n            static getRotate_2(sin, cos) {\n                return this.setRotate_2(androidui.util.ArrayCreator.newNumberArray(9), sin, cos);\n            }\n            static setRotate_1(dest, degrees) {\n                let rad = Math_toRadians(degrees);\n                let sin = Math.sin(rad);\n                let cos = Math.cos(rad);\n                return Matrix.setRotate_2(dest, sin, cos);\n            }\n            static setRotate_2(dest, sin, cos) {\n                dest[0] = cos;\n                dest[1] = -sin;\n                dest[2] = 0;\n                dest[3] = sin;\n                dest[4] = cos;\n                dest[5] = 0;\n                dest[6] = 0;\n                dest[7] = 0;\n                dest[8] = 1;\n                return dest;\n            }\n            static getRotate_3(degrees, px, py) {\n                let tmp = androidui.util.ArrayCreator.newNumberArray(9);\n                let tmp2 = androidui.util.ArrayCreator.newNumberArray(9);\n                this.setTranslate(tmp, -px, -py);\n                let rad = Math_toRadians(degrees);\n                let cos = Math.cos(rad);\n                let sin = Math.sin(rad);\n                Matrix.multiply(tmp2, tmp, Matrix.getRotate_2(sin, cos));\n                Matrix.multiply(tmp, tmp2, Matrix.getTranslate(px, py));\n                return tmp;\n            }\n            static getSkew(kx, ky, px, py) {\n                if (px == null || py == null) {\n                    return [1, kx, 0, ky, 1, 0, 0, 0, 1];\n                }\n                let tmp = androidui.util.ArrayCreator.newNumberArray(9);\n                let tmp2 = androidui.util.ArrayCreator.newNumberArray(9);\n                this.setTranslate(tmp, -px, -py);\n                Matrix.multiply(tmp2, tmp, [1, kx, 0, ky, 1, 0, 0, 0, 1]);\n                Matrix.multiply(tmp, tmp2, Matrix.getTranslate(px, py));\n                return tmp;\n            }\n            static reset(mtx) {\n                mtx[0] = 1;\n                mtx[1] = 0;\n                mtx[2] = 0;\n                mtx[3] = 0;\n                mtx[4] = 1;\n                mtx[5] = 0;\n                mtx[6] = 0;\n                mtx[7] = 0;\n                mtx[8] = 1;\n            }\n            computeTypeMask() {\n                let mask = 0;\n                if (this.mValues[6] != 0. || this.mValues[7] != 0. || this.mValues[8] != 1.) {\n                    mask |= Matrix.kPerspective_Mask;\n                }\n                if (this.mValues[2] != 0. || this.mValues[5] != 0.) {\n                    mask |= Matrix.kTranslate_Mask;\n                }\n                let m00 = this.mValues[0];\n                let m01 = this.mValues[1];\n                let m10 = this.mValues[3];\n                let m11 = this.mValues[4];\n                if (m01 != 0. || m10 != 0.) {\n                    mask |= Matrix.kAffine_Mask;\n                }\n                if (m00 != 1. || m11 != 1.) {\n                    mask |= Matrix.kScale_Mask;\n                }\n                if ((mask & Matrix.kPerspective_Mask) == 0) {\n                    let im00 = m00 != 0 ? 1 : 0;\n                    let im01 = m01 != 0 ? 1 : 0;\n                    let im10 = m10 != 0 ? 1 : 0;\n                    let im11 = m11 != 0 ? 1 : 0;\n                    let dp0 = (im00 | im11) ^ 1;\n                    let dp1 = im00 & im11;\n                    let ds0 = (im01 | im10) ^ 1;\n                    let ds1 = im01 & im10;\n                    mask |= ((dp0 & ds1) | (dp1 & ds0)) << Matrix.kRectStaysRect_Shift;\n                }\n                return mask;\n            }\n        }\n        Matrix.MSCALE_X = 0;\n        Matrix.MSKEW_X = 1;\n        Matrix.MTRANS_X = 2;\n        Matrix.MSKEW_Y = 3;\n        Matrix.MSCALE_Y = 4;\n        Matrix.MTRANS_Y = 5;\n        Matrix.MPERSP_0 = 6;\n        Matrix.MPERSP_1 = 7;\n        Matrix.MPERSP_2 = 8;\n        Matrix.MATRIX_SIZE = 9;\n        Matrix.IDENTITY_MATRIX = (() => {\n            class _Inner extends Matrix {\n                oops() {\n                    throw Error(`new IllegalStateException(\"Matrix can not be modified\")`);\n                }\n                set(src) {\n                    this.oops();\n                }\n                reset() {\n                    this.oops();\n                }\n                setTranslate(dx, dy) {\n                    this.oops();\n                }\n                setScale(sx, sy, px, py) {\n                    this.oops();\n                }\n                setRotate(degrees, px, py) {\n                    this.oops();\n                }\n                setSinCos(sinValue, cosValue, px, py) {\n                    this.oops();\n                }\n                setSkew(kx, ky, px, py) {\n                    this.oops();\n                }\n                setConcat(a, b) {\n                    this.oops();\n                    return false;\n                }\n                preTranslate(dx, dy) {\n                    this.oops();\n                    return false;\n                }\n                preScale(sx, sy, px, py) {\n                    this.oops();\n                    return false;\n                }\n                preRotate(degrees, px, py) {\n                    this.oops();\n                    return false;\n                }\n                preSkew(kx, ky, px, py) {\n                    this.oops();\n                    return false;\n                }\n                preConcat(other) {\n                    this.oops();\n                    return false;\n                }\n                postTranslate(dx, dy) {\n                    this.oops();\n                    return false;\n                }\n                postScale(sx, sy, px, py) {\n                    this.oops();\n                    return false;\n                }\n                postRotate(degrees, px, py) {\n                    this.oops();\n                    return false;\n                }\n                postSkew(kx, ky, px, py) {\n                    this.oops();\n                    return false;\n                }\n                postConcat(other) {\n                    this.oops();\n                    return false;\n                }\n                setRectToRect(src, dst, stf) {\n                    this.oops();\n                    return false;\n                }\n                setPolyToPoly(src, srcIndex, dst, dstIndex, pointCount) {\n                    this.oops();\n                    return false;\n                }\n                setValues(values) {\n                    this.oops();\n                }\n            }\n            return new _Inner();\n        })();\n        Matrix.kIdentity_Mask = 0;\n        Matrix.kTranslate_Mask = 0x01;\n        Matrix.kScale_Mask = 0x02;\n        Matrix.kAffine_Mask = 0x04;\n        Matrix.kPerspective_Mask = 0x08;\n        Matrix.kRectStaysRect_Mask = 0x10;\n        Matrix.kUnknown_Mask = 0x80;\n        Matrix.kAllMasks = Matrix.kTranslate_Mask | Matrix.kScale_Mask | Matrix.kAffine_Mask | Matrix.kPerspective_Mask | Matrix.kRectStaysRect_Mask;\n        Matrix.kTranslate_Shift = 0;\n        Matrix.kScale_Shift = 1;\n        Matrix.kAffine_Shift = 2;\n        Matrix.kPerspective_Shift = 3;\n        Matrix.kRectStaysRect_Shift = 4;\n        graphics.Matrix = Matrix;\n        (function (Matrix) {\n            var ScaleToFit;\n            (function (ScaleToFit) {\n                ScaleToFit[ScaleToFit[\"FILL\"] = 0] = \"FILL\";\n                ScaleToFit[ScaleToFit[\"START\"] = 1] = \"START\";\n                ScaleToFit[ScaleToFit[\"CENTER\"] = 2] = \"CENTER\";\n                ScaleToFit[ScaleToFit[\"END\"] = 3] = \"END\";\n            })(ScaleToFit = Matrix.ScaleToFit || (Matrix.ScaleToFit = {}));\n        })(Matrix = graphics.Matrix || (graphics.Matrix = {}));\n        function Math_toRadians(angdeg) {\n            return angdeg / 180.0 * Math.PI;\n        }\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar androidui;\n(function (androidui) {\n    var image;\n    (function (image) {\n        var Rect = android.graphics.Rect;\n        var Color = android.graphics.Color;\n        class NetImage {\n            constructor(src, overrideImageRatio) {\n                this.mImageWidth = 0;\n                this.mImageHeight = 0;\n                this.mOnLoads = new Set();\n                this.mOnErrors = new Set();\n                this.mImageLoaded = false;\n                this.init(src);\n                this.mOverrideImageRatio = overrideImageRatio;\n            }\n            init(src) {\n                this.createImage();\n                this.src = src;\n            }\n            createImage() {\n                this.browserImage = new Image();\n            }\n            loadImage() {\n                this.browserImage.src = this.mSrc;\n                this.browserImage.onload = () => {\n                    this.mImageWidth = this.browserImage.width;\n                    this.mImageHeight = this.browserImage.height;\n                    this.fireOnLoad();\n                };\n                this.browserImage.onerror = () => {\n                    this.mImageWidth = this.mImageHeight = 0;\n                    this.fireOnError();\n                };\n            }\n            get src() {\n                return this.mSrc;\n            }\n            set src(value) {\n                value = convertToAbsUrl(value);\n                if (value !== this.mSrc) {\n                    this.mSrc = value;\n                    this.loadImage();\n                }\n            }\n            get width() {\n                return this.mImageWidth;\n            }\n            get height() {\n                return this.mImageHeight;\n            }\n            getImageRatio() {\n                if (this.mOverrideImageRatio)\n                    return this.mOverrideImageRatio;\n                let url = this.src;\n                if (!url)\n                    return 1;\n                if (url.startsWith('data:'))\n                    return 1;\n                const match = url.match(/@(\\d)x(\\.9)?\\.\\w*$/);\n                if (match) {\n                    return parseInt(match[1]);\n                }\n                return 1;\n            }\n            isImageLoaded() {\n                return this.mImageLoaded;\n            }\n            fireOnLoad() {\n                this.mImageLoaded = true;\n                for (let load of [...this.mOnLoads]) {\n                    load();\n                }\n            }\n            fireOnError() {\n                this.mImageLoaded = false;\n                for (let error of [...this.mOnErrors]) {\n                    error();\n                }\n            }\n            addLoadListener(onload, onerror) {\n                if (onload) {\n                    this.mOnLoads.add(onload);\n                }\n                if (onerror) {\n                    this.mOnErrors.add(onerror);\n                }\n            }\n            removeLoadListener(onload, onerror) {\n                if (onload) {\n                    this.mOnLoads.delete(onload);\n                }\n                if (onerror) {\n                    this.mOnErrors.delete(onerror);\n                }\n            }\n            recycle() {\n            }\n            getBorderPixels(callBack) {\n                if (!callBack)\n                    return;\n                let mTmpRect = new Rect();\n                mTmpRect.set(0, 1, 1, this.height - 1);\n                this.getPixels(mTmpRect, (leftBorder) => {\n                    mTmpRect.set(1, 0, this.width - 1, 1);\n                    this.getPixels(mTmpRect, (topBorder) => {\n                        mTmpRect.set(this.width - 1, 1, this.width, this.height - 1);\n                        this.getPixels(mTmpRect, (rightBorder) => {\n                            mTmpRect.set(1, this.height - 1, this.width - 1, this.height);\n                            this.getPixels(mTmpRect, (bottomBorder) => {\n                                callBack(leftBorder, topBorder, rightBorder, bottomBorder);\n                            });\n                        });\n                    });\n                });\n            }\n            getPixels(bound, callBack) {\n                if (!callBack)\n                    return;\n                let canvasEle = document.createElement('canvas');\n                if (!bound)\n                    bound = new Rect(0, 0, this.width, this.height);\n                if (bound.isEmpty()) {\n                    callBack([]);\n                    return;\n                }\n                let w = bound.width();\n                let h = bound.height();\n                canvasEle.width = w;\n                canvasEle.height = h;\n                let canvas = canvasEle.getContext('2d');\n                canvas.drawImage(this.browserImage, bound.left, bound.top, w, h, 0, 0, w, h);\n                let data = canvas.getImageData(0, 0, w, h).data;\n                let colorData = [];\n                for (let i = 0; i < data.length; i += 4) {\n                    colorData.push(Color.rgba(data[i], data[i + 1], data[i + 2], data[i + 3]));\n                }\n                callBack(colorData);\n                canvasEle.width = 0;\n                canvasEle.height = 0;\n            }\n        }\n        image.NetImage = NetImage;\n        let convertA = document.createElement('a');\n        function convertToAbsUrl(url) {\n            convertA.href = url;\n            return convertA.href;\n        }\n    })(image = androidui.image || (androidui.image = {}));\n})(androidui || (androidui = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        var Pools = android.util.Pools;\n        var Rect = android.graphics.Rect;\n        var Color = android.graphics.Color;\n        class Canvas {\n            constructor(width, height) {\n                this.mWidth = 0;\n                this.mHeight = 0;\n                this._saveCount = 0;\n                this.mClipStateMap = new Map();\n                this.mWidth = width;\n                this.mHeight = height;\n                this.mCurrentClip = Canvas.obtainRect();\n                this.mCurrentClip.set(0, 0, this.mWidth, this.mHeight);\n                this.initCanvasImpl();\n            }\n            static obtainRect(copy) {\n                let rect = Canvas.sRectPool.acquire();\n                if (!rect)\n                    rect = new Rect();\n                if (copy)\n                    rect.set(copy);\n                return rect;\n            }\n            static recycleRect(rect) {\n                rect.setEmpty();\n                Canvas.sRectPool.release(rect);\n            }\n            initCanvasImpl() {\n                this.mCanvasElement = document.createElement(\"canvas\");\n                this.mCanvasElement.width = this.mWidth;\n                this.mCanvasElement.height = this.mHeight;\n                this._mCanvasContent = this.mCanvasElement.getContext(\"2d\");\n                this.save();\n            }\n            recycle() {\n                Canvas.recycleRect(this.mCurrentClip);\n                for (let rect of this.mClipStateMap.values()) {\n                    Canvas.recycleRect(rect);\n                }\n                this.recycleImpl();\n            }\n            recycleImpl() {\n                if (this.mCanvasElement)\n                    this.mCanvasElement.width = this.mCanvasElement.height = 0;\n            }\n            getHeight() {\n                return this.mHeight;\n            }\n            getWidth() {\n                return this.mWidth;\n            }\n            isNativeAccelerated() {\n                return false;\n            }\n            translate(dx, dy) {\n                if (dx == 0 && dy == 0)\n                    return;\n                if (this.mCurrentClip)\n                    this.mCurrentClip.offset(-dx, -dy);\n                this.translateImpl(dx, dy);\n            }\n            translateImpl(dx, dy) {\n                this._mCanvasContent.translate(dx, dy);\n            }\n            scale(sx, sy, px, py) {\n                if (px || py)\n                    this.translate(px, py);\n                this.scaleImpl(sx, sy);\n                if (px || py)\n                    this.translate(-px, -py);\n            }\n            scaleImpl(sx, sy) {\n                this._mCanvasContent.scale(sx, sy);\n            }\n            rotate(degrees, px, py) {\n                if (px || py)\n                    this.translate(px, py);\n                this.rotateImpl(degrees);\n                if (px || py)\n                    this.translate(-px, -py);\n            }\n            rotateImpl(degrees) {\n                this._mCanvasContent.rotate(degrees * Math.PI / 180);\n            }\n            concat(m) {\n                let v = Canvas.TempMatrixValue;\n                m.getValues(v);\n                this.concatImpl(v[graphics.Matrix.MSCALE_X], v[graphics.Matrix.MSKEW_X], v[graphics.Matrix.MTRANS_X], v[graphics.Matrix.MSKEW_Y], v[graphics.Matrix.MSCALE_Y], v[graphics.Matrix.MTRANS_Y], v[graphics.Matrix.MPERSP_0], v[graphics.Matrix.MPERSP_1], v[graphics.Matrix.MPERSP_2]);\n            }\n            concatImpl(MSCALE_X, MSKEW_X, MTRANS_X, MSKEW_Y, MSCALE_Y, MTRANS_Y, MPERSP_0, MPERSP_1, MPERSP_2) {\n                this._mCanvasContent.transform(MSCALE_X, -MSKEW_X, -MSKEW_Y, MSCALE_Y, MTRANS_X, MTRANS_Y);\n            }\n            drawRGB(r, g, b) {\n                this.drawARGB(255, r, g, b);\n            }\n            drawARGB(a, r, g, b) {\n                this.drawARGBImpl(a, r, g, b);\n            }\n            drawColor(color) {\n                this.drawARGB(Color.alpha(color), Color.red(color), Color.green(color), Color.blue(color));\n            }\n            drawARGBImpl(a, r, g, b) {\n                let preStyle = this._mCanvasContent.fillStyle;\n                this._mCanvasContent.fillStyle = `rgba(${r},${g},${b},${a / 255})`;\n                this._mCanvasContent.fillRect(this.mCurrentClip.left, this.mCurrentClip.top, this.mCurrentClip.width(), this.mCurrentClip.height());\n                this._mCanvasContent.fillStyle = preStyle;\n            }\n            clearColor() {\n                this.clearColorImpl();\n            }\n            clearColorImpl() {\n                this._mCanvasContent.clearRect(this.mCurrentClip.left, this.mCurrentClip.top, this.mCurrentClip.width(), this.mCurrentClip.height());\n            }\n            save() {\n                this.saveImpl();\n                if (this.mCurrentClip)\n                    this.mClipStateMap.set(this._saveCount, Canvas.obtainRect(this.mCurrentClip));\n                this._saveCount++;\n                return this._saveCount;\n            }\n            saveImpl() {\n                this._mCanvasContent.save();\n            }\n            restore() {\n                this._saveCount--;\n                this.restoreImpl();\n                let savedClip = this.mClipStateMap.get(this._saveCount);\n                if (savedClip) {\n                    this.mClipStateMap.delete(this._saveCount);\n                    this.mCurrentClip.set(savedClip);\n                    Canvas.recycleRect(savedClip);\n                }\n            }\n            restoreImpl() {\n                this._mCanvasContent.restore();\n            }\n            restoreToCount(saveCount) {\n                if (saveCount <= 0)\n                    throw Error('saveCount can\\'t <= 0');\n                while (saveCount <= this._saveCount) {\n                    this.restore();\n                }\n            }\n            getSaveCount() {\n                return this._saveCount;\n            }\n            clipRect(...args) {\n                let rect = Canvas.obtainRect();\n                if (args.length === 1) {\n                    rect.set(args[0]);\n                }\n                else {\n                    let [left = 0, t = 0, right = 0, bottom = 0] = args;\n                    rect.set(left, t, right, bottom);\n                }\n                if (args.length === 4 || (!args[4] && !args[5] && !args[6] && !args[7])) {\n                    this.clipRectImpl(Math.floor(rect.left), Math.floor(rect.top), Math.ceil(rect.width()), Math.ceil(rect.height()));\n                }\n                else if (args.length === 8 && (args[4] != 0 || args[5] != 0 || args[6] != 0 || args[7] != 0)) {\n                    this.clipRoundRectImpl(Math.floor(rect.left), Math.floor(rect.top), Math.ceil(rect.width()), Math.ceil(rect.height()), args[4], args[5], args[6], args[7]);\n                }\n                this.mCurrentClip.intersect(rect);\n                let r = rect.isEmpty();\n                Canvas.recycleRect(rect);\n                return r;\n            }\n            clipRectImpl(left, top, width, height) {\n                this._mCanvasContent.beginPath();\n                this._mCanvasContent.rect(left, top, width, height);\n                this._mCanvasContent.clip();\n            }\n            clipRoundRect(r, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft) {\n                let rect = Canvas.obtainRect(r);\n                this.clipRoundRectImpl(Math.floor(rect.left), Math.floor(rect.top), Math.ceil(rect.width()), Math.ceil(rect.height()), radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft);\n                this.mCurrentClip.intersect(rect);\n                let empty = rect.isEmpty();\n                Canvas.recycleRect(rect);\n                return empty;\n            }\n            clipRoundRectImpl(left, top, width, height, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft) {\n                this.doRoundRectPath(left, top, width, height, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft);\n                this._mCanvasContent.clip();\n            }\n            doRoundRectPath(left, top, width, height, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft) {\n                let scale1 = height / (radiusTopLeft + radiusBottomLeft);\n                let scale2 = height / (radiusTopRight + radiusBottomRight);\n                let scale3 = width / (radiusTopLeft + radiusTopRight);\n                let scale4 = width / (radiusBottomLeft + radiusBottomRight);\n                let scale = Math.min(scale1, scale2, scale3, scale4);\n                if (scale < 1) {\n                    radiusTopLeft *= scale;\n                    radiusTopRight *= scale;\n                    radiusBottomRight *= scale;\n                    radiusBottomLeft *= scale;\n                }\n                let ctx = this._mCanvasContent;\n                ctx.beginPath();\n                ctx.moveTo(left + radiusTopLeft, top);\n                ctx.arcTo(left + width, top, left + width, top + radiusTopRight, radiusTopRight);\n                ctx.arcTo(left + width, top + height, left + width - radiusBottomRight, top + height, radiusBottomRight);\n                ctx.arcTo(left, top + height, left, top + height - radiusBottomLeft, radiusBottomLeft);\n                ctx.arcTo(left, top, left + radiusTopLeft, top, radiusTopLeft);\n                ctx.closePath();\n            }\n            getClipBounds(bounds) {\n                if (!this.mCurrentClip)\n                    this.mCurrentClip = Canvas.obtainRect();\n                let rect = bounds || Canvas.obtainRect();\n                rect.set(this.mCurrentClip);\n                return rect;\n            }\n            quickReject(...args) {\n                if (!this.mCurrentClip)\n                    return false;\n                if (args.length == 1) {\n                    return !this.mCurrentClip.intersects(args[0]);\n                }\n                else {\n                    let [left = 0, t = 0, right = 0, bottom = 0] = args;\n                    return !this.mCurrentClip.intersects(left, t, right, bottom);\n                }\n            }\n            drawCanvas(canvas, offsetX = 0, offsetY = 0) {\n                this.drawCanvasImpl(canvas, offsetX, offsetY);\n            }\n            drawCanvasImpl(canvas, offsetX, offsetY) {\n                this._mCanvasContent.drawImage(canvas.mCanvasElement, offsetX, offsetY);\n            }\n            drawImage(image, srcRect, dstRect, paint) {\n                let paintEmpty = !paint || paint.isEmpty();\n                if (!paintEmpty) {\n                    this.saveImpl();\n                    paint.applyToCanvas(this);\n                }\n                this.drawImageImpl(image, srcRect, dstRect);\n                if (!paintEmpty)\n                    this.restoreImpl();\n            }\n            drawImageImpl(image, srcRect, dstRect) {\n                if (!dstRect) {\n                    if (!srcRect) {\n                        this._mCanvasContent.drawImage(image.browserImage, 0, 0);\n                    }\n                    else {\n                        this._mCanvasContent.drawImage(image.browserImage, srcRect.left, srcRect.top, srcRect.width(), srcRect.height(), 0, 0, srcRect.width(), srcRect.height());\n                    }\n                }\n                else {\n                    if (dstRect.isEmpty())\n                        return;\n                    if (!srcRect) {\n                        this._mCanvasContent.drawImage(image.browserImage, dstRect.left, dstRect.top, dstRect.width(), dstRect.height());\n                    }\n                    else {\n                        this._mCanvasContent.drawImage(image.browserImage, srcRect.left, srcRect.top, srcRect.width(), srcRect.height(), dstRect.left, dstRect.top, dstRect.width(), dstRect.height());\n                    }\n                }\n            }\n            drawRect(...args) {\n                if (args.length == 2) {\n                    let rect = args[0];\n                    this.drawRect(rect.left, rect.top, rect.right, rect.bottom, args[1]);\n                }\n                else {\n                    let [left, top, right, bottom, paint] = args;\n                    let paintEmpty = !paint || paint.isEmpty();\n                    if (!paintEmpty) {\n                        this.saveImpl();\n                        paint.applyToCanvas(this);\n                    }\n                    let style = paint ? paint.getStyle() : graphics.Paint.Style.FILL;\n                    this.drawRectImpl(left, top, right - left, bottom - top, style);\n                    if (!paintEmpty)\n                        this.restoreImpl();\n                }\n            }\n            drawRectImpl(left, top, width, height, style) {\n                switch (style) {\n                    case graphics.Paint.Style.STROKE:\n                        this._mCanvasContent.strokeRect(left, top, width, height);\n                        break;\n                    case graphics.Paint.Style.FILL_AND_STROKE:\n                        this._mCanvasContent.fillRect(left, top, width, height);\n                        this._mCanvasContent.strokeRect(left, top, width, height);\n                        break;\n                    case graphics.Paint.Style.FILL:\n                    default:\n                        this._mCanvasContent.fillRect(left, top, width, height);\n                        break;\n                }\n            }\n            applyFillOrStrokeToContent(style) {\n                switch (style) {\n                    case graphics.Paint.Style.STROKE:\n                        this._mCanvasContent.stroke();\n                        break;\n                    case graphics.Paint.Style.FILL_AND_STROKE:\n                        this._mCanvasContent.fill();\n                        this._mCanvasContent.stroke();\n                        break;\n                    case graphics.Paint.Style.FILL:\n                    default:\n                        this._mCanvasContent.fill();\n                        break;\n                }\n            }\n            drawOval(oval, paint) {\n                if (oval == null) {\n                    throw Error(`new NullPointerException()`);\n                }\n                let paintEmpty = !paint || paint.isEmpty();\n                if (!paintEmpty) {\n                    this.saveImpl();\n                    paint.applyToCanvas(this);\n                }\n                let style = paint ? paint.getStyle() : graphics.Paint.Style.FILL;\n                this.drawOvalImpl(oval, style);\n                if (!paintEmpty)\n                    this.restoreImpl();\n            }\n            drawOvalImpl(oval, style) {\n                let ctx = this._mCanvasContent;\n                ctx.beginPath();\n                let cx = oval.centerX();\n                let cy = oval.centerY();\n                let rx = oval.width() / 2;\n                let ry = oval.height() / 2;\n                ctx.save();\n                ctx.translate(cx - rx, cy - ry);\n                ctx.scale(rx, ry);\n                ctx.arc(1, 1, 1, 0, 2 * Math.PI, false);\n                ctx.restore();\n                this.applyFillOrStrokeToContent(style);\n            }\n            drawCircle(cx, cy, radius, paint) {\n                let paintEmpty = !paint || paint.isEmpty();\n                if (!paintEmpty) {\n                    this.saveImpl();\n                    paint.applyToCanvas(this);\n                }\n                let style = paint ? paint.getStyle() : graphics.Paint.Style.FILL;\n                this.drawCircleImpl(cx, cy, radius, style);\n                if (!paintEmpty)\n                    this.restoreImpl();\n            }\n            drawCircleImpl(cx, cy, radius, style) {\n                let ctx = this._mCanvasContent;\n                ctx.beginPath();\n                ctx.arc(cx, cy, radius, 0, 2 * Math.PI, false);\n                this.applyFillOrStrokeToContent(style);\n            }\n            drawArc(oval, startAngle, sweepAngle, useCenter, paint) {\n                if (oval == null) {\n                    throw Error(`new NullPointerException()`);\n                }\n                let paintEmpty = !paint || paint.isEmpty();\n                if (!paintEmpty) {\n                    this.saveImpl();\n                    paint.applyToCanvas(this);\n                }\n                let style = paint ? paint.getStyle() : graphics.Paint.Style.FILL;\n                this.drawArcImpl(oval, startAngle, sweepAngle, useCenter, style);\n                if (!paintEmpty)\n                    this.restoreImpl();\n            }\n            drawArcImpl(oval, startAngle, sweepAngle, useCenter, style) {\n                let ctx = this._mCanvasContent;\n                ctx.save();\n                ctx.beginPath();\n                let cx = oval.centerX();\n                let cy = oval.centerY();\n                let rx = oval.width() / 2;\n                let ry = oval.height() / 2;\n                ctx.translate(cx - rx, cy - ry);\n                ctx.scale(rx, ry);\n                ctx.arc(1, 1, 1, startAngle / 180 * Math.PI, (sweepAngle + startAngle) / 180 * Math.PI, false);\n                if (useCenter) {\n                    ctx.lineTo(1, 1);\n                    ctx.closePath();\n                }\n                ctx.restore();\n                this.applyFillOrStrokeToContent(style);\n            }\n            drawRoundRect(rect, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft, paint) {\n                if (rect == null) {\n                    throw Error(`new NullPointerException()`);\n                }\n                let paintEmpty = !paint || paint.isEmpty();\n                if (!paintEmpty) {\n                    this.saveImpl();\n                    paint.applyToCanvas(this);\n                }\n                let style = paint ? paint.getStyle() : graphics.Paint.Style.FILL;\n                this.drawRoundRectImpl(rect, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft, style);\n                if (!paintEmpty)\n                    this.restoreImpl();\n            }\n            drawRoundRectImpl(rect, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft, style) {\n                this.doRoundRectPath(rect.left, rect.top, rect.width(), rect.height(), radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft);\n                this.applyFillOrStrokeToContent(style);\n            }\n            drawPath(path, paint) {\n            }\n            drawText_count(text, index, count, x, y, paint) {\n                if ((index | count | (index + count) | (text.length - index - count)) < 0) {\n                    throw Error(`new IndexOutOfBoundsException()`);\n                }\n                this.drawText(text.substr(index, count), x, y, paint);\n            }\n            drawText_end(text, start, end, x, y, paint) {\n                if ((start | end | (end - start) | (text.length - end)) < 0) {\n                    throw Error(`new IndexOutOfBoundsException()`);\n                }\n                this.drawText(text.substring(start, end), x, y, paint);\n            }\n            drawText(text, x, y, paint) {\n                let paintEmpty = !paint || paint.isEmpty();\n                if (!paintEmpty) {\n                    this.saveImpl();\n                    paint.applyToCanvas(this);\n                }\n                this.drawTextImpl(text, x, y, paint ? paint.getStyle() : null);\n                if (!paintEmpty)\n                    this.restoreImpl();\n            }\n            drawTextImpl(text, x, y, style) {\n                switch (style) {\n                    case graphics.Paint.Style.STROKE:\n                        this._mCanvasContent.strokeText(text, x, y);\n                        break;\n                    case graphics.Paint.Style.FILL_AND_STROKE:\n                        this._mCanvasContent.strokeText(text, x, y);\n                        this._mCanvasContent.fillText(text, x, y);\n                        break;\n                    case graphics.Paint.Style.FILL:\n                    default:\n                        this._mCanvasContent.fillText(text, x, y);\n                        break;\n                }\n            }\n            drawTextRun_count(text, index, count, contextIndex, contextCount, x, y, dir, paint) {\n                this.drawText_count(text, index, count, x, y, paint);\n            }\n            drawTextRun_end(text, start, end, contextStart, contextEnd, x, y, dir, paint) {\n                this.drawText_end(text, start, end, x, y, paint);\n            }\n            static measureText(text, textSize) {\n                if (textSize == null || textSize === 0)\n                    return 0;\n                return Canvas.measureTextImpl(text, textSize);\n            }\n            static measureTextImpl(text, textSize) {\n                let width = 0;\n                for (let i = 0, length = text.length; i < length; i++) {\n                    let c = text.charCodeAt(i);\n                    let cWidth = Canvas._measureCacheMap.get(c);\n                    if (cWidth == null) {\n                        cWidth = Canvas._measureTextContext.measureText(text[i]).width;\n                        Canvas._measureCacheMap.set(c, cWidth);\n                    }\n                    width += (cWidth * textSize / Canvas._measureCacheTextSize);\n                }\n                return width;\n            }\n            static getMeasureTextFontFamily() {\n                let fontParts = Canvas._measureTextContext.font.split(' ');\n                return fontParts[fontParts.length - 1];\n            }\n            setColor(color, style) {\n                if (color != null) {\n                    this.setColorImpl(color, style);\n                }\n            }\n            setColorImpl(color, style) {\n                let colorS = Color.toRGBAFunc(color);\n                switch (style) {\n                    case graphics.Paint.Style.STROKE:\n                        if (Color.parseColor(this._mCanvasContent.strokeStyle + '', 0) != color) {\n                            this._mCanvasContent.strokeStyle = colorS;\n                        }\n                        break;\n                    case graphics.Paint.Style.FILL:\n                        if (Color.parseColor(this._mCanvasContent.fillStyle + '', 0) != color) {\n                            this._mCanvasContent.fillStyle = colorS;\n                        }\n                        break;\n                    default:\n                    case graphics.Paint.Style.FILL_AND_STROKE:\n                        if (Color.parseColor(this._mCanvasContent.fillStyle + '', 0) != color) {\n                            this._mCanvasContent.fillStyle = colorS;\n                        }\n                        if (Color.parseColor(this._mCanvasContent.strokeStyle + '', 0) != color) {\n                            this._mCanvasContent.strokeStyle = colorS;\n                        }\n                        break;\n                }\n            }\n            multiplyGlobalAlpha(alpha) {\n                if (typeof alpha === 'number' && alpha < 1) {\n                    this.multiplyGlobalAlphaImpl(alpha);\n                }\n            }\n            multiplyGlobalAlphaImpl(alpha) {\n                this._mCanvasContent.globalAlpha *= alpha;\n            }\n            setGlobalAlpha(alpha) {\n                if (typeof alpha === 'number') {\n                    this.setGlobalAlphaImpl(alpha);\n                }\n            }\n            setGlobalAlphaImpl(alpha) {\n                this._mCanvasContent.globalAlpha = alpha;\n            }\n            setTextAlign(align) {\n                if (align != null)\n                    this.setTextAlignImpl(align);\n            }\n            setTextAlignImpl(align) {\n                this._mCanvasContent.textAlign = align;\n            }\n            setLineWidth(width) {\n                if (width != null)\n                    this.setLineWidthImpl(width);\n            }\n            setLineWidthImpl(width) {\n                this._mCanvasContent.lineWidth = width;\n            }\n            setLineCap(lineCap) {\n                if (lineCap != null)\n                    this.setLineCapImpl(lineCap);\n            }\n            setLineCapImpl(lineCap) {\n                this._mCanvasContent.lineCap = lineCap;\n            }\n            setLineJoin(lineJoin) {\n                if (lineJoin != null)\n                    this.setLineJoinImpl(lineJoin);\n            }\n            setLineJoinImpl(lineJoin) {\n                this._mCanvasContent.lineJoin = lineJoin;\n            }\n            setShadow(radius, dx, dy, color) {\n                if (radius > 0) {\n                    this.setShadowImpl(radius, dx, dy, color);\n                }\n            }\n            setShadowImpl(radius, dx, dy, color) {\n                this._mCanvasContent.shadowBlur = radius;\n                this._mCanvasContent.shadowOffsetX = dx;\n                this._mCanvasContent.shadowOffsetY = dy;\n                this._mCanvasContent.shadowColor = Color.toRGBAFunc(color);\n            }\n            setFontSize(size) {\n                if (size != null) {\n                    this.setFontSizeImpl(size);\n                }\n            }\n            setFontSizeImpl(size) {\n                let cFont = this._mCanvasContent.font;\n                let fontParts = cFont.split(' ');\n                if (Number.parseFloat(fontParts[fontParts.length - 2]) == size)\n                    return;\n                fontParts[fontParts.length - 2] = size + 'px';\n                this._mCanvasContent.font = fontParts.join(' ');\n            }\n            setFont(fontName) {\n                if (fontName != null) {\n                    this.setFontImpl(fontName);\n                }\n            }\n            setFontImpl(fontName) {\n                let cFont = this._mCanvasContent.font;\n                let fontParts = cFont.split(' ');\n                fontParts[fontParts.length - 1] = fontName;\n                let font = fontParts.join(' ');\n                if (font != cFont)\n                    this._mCanvasContent.font = font;\n            }\n            isImageSmoothingEnabled() {\n                return this.isImageSmoothingEnabledImpl();\n            }\n            isImageSmoothingEnabledImpl() {\n                return this._mCanvasContent['imageSmoothingEnabled'] || this._mCanvasContent['webkitImageSmoothingEnabled'];\n            }\n            setImageSmoothingEnabled(enable) {\n                this.setImageSmoothingEnabledImpl(enable);\n            }\n            setImageSmoothingEnabledImpl(enable) {\n                if ('imageSmoothingEnabled' in this._mCanvasContent) {\n                    this._mCanvasContent['imageSmoothingEnabled'] = enable;\n                }\n                else if ('webkitImageSmoothingEnabled' in this._mCanvasContent) {\n                    this._mCanvasContent['webkitImageSmoothingEnabled'] = enable;\n                }\n            }\n        }\n        Canvas.TempMatrixValue = androidui.util.ArrayCreator.newNumberArray(9);\n        Canvas.DIRECTION_LTR = 0;\n        Canvas.DIRECTION_RTL = 1;\n        Canvas.sRectPool = new Pools.SynchronizedPool(20);\n        Canvas._measureTextContext = document.createElement('canvas').getContext('2d');\n        Canvas._measureCacheTextSize = 1000;\n        Canvas._static = (() => {\n            Canvas._measureTextContext.font = Canvas._measureCacheTextSize + 'px ' + Canvas.getMeasureTextFontFamily();\n        })();\n        Canvas._measureCacheMap = new Map();\n        graphics.Canvas = Canvas;\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        var drawable;\n        (function (drawable_1) {\n            var Rect = android.graphics.Rect;\n            var PixelFormat = android.graphics.PixelFormat;\n            var WeakReference = java.lang.ref.WeakReference;\n            var StateSet = android.util.StateSet;\n            class Drawable {\n                constructor() {\n                    this.mBounds = Drawable.ZERO_BOUNDS_RECT;\n                    this.mStateSet = StateSet.WILD_CARD;\n                    this.mLevel = 0;\n                    this.mVisible = true;\n                    this.mIgnoreNotifySizeChange = false;\n                }\n                setBounds(...args) {\n                    if (args.length === 1) {\n                        let rect = args[0];\n                        return this.setBounds(rect.left, rect.top, rect.right, rect.bottom);\n                    }\n                    else {\n                        let [left = 0, top = 0, right = 0, bottom = 0] = args;\n                        let oldBounds = this.mBounds;\n                        if (oldBounds == Drawable.ZERO_BOUNDS_RECT) {\n                            oldBounds = this.mBounds = new Rect();\n                        }\n                        if (oldBounds.left != left || oldBounds.top != top ||\n                            oldBounds.right != right || oldBounds.bottom != bottom) {\n                            if (!oldBounds.isEmpty()) {\n                                this.invalidateSelf();\n                            }\n                            this.mBounds.set(left, top, right, bottom);\n                            this.onBoundsChange(this.mBounds);\n                        }\n                    }\n                }\n                copyBounds(bounds = new Rect()) {\n                    bounds.set(this.mBounds);\n                    return bounds;\n                }\n                getBounds() {\n                    if (this.mBounds == Drawable.ZERO_BOUNDS_RECT) {\n                        this.mBounds = new Rect();\n                    }\n                    return this.mBounds;\n                }\n                setDither(dither) { }\n                setCallback(cb) {\n                    this.mCallback = new WeakReference(cb);\n                }\n                getCallback() {\n                    if (this.mCallback != null) {\n                        return this.mCallback.get();\n                    }\n                    return null;\n                }\n                setIgnoreNotifySizeChange(isIgnore) {\n                    this.mIgnoreNotifySizeChange = isIgnore;\n                }\n                notifySizeChangeSelf() {\n                    if (this.mIgnoreNotifySizeChange)\n                        return;\n                    let callback = this.getCallback();\n                    if (callback != null && callback.drawableSizeChange) {\n                        callback.drawableSizeChange(this);\n                    }\n                }\n                invalidateSelf() {\n                    let callback = this.getCallback();\n                    if (callback != null) {\n                        callback.invalidateDrawable(this);\n                    }\n                }\n                scheduleSelf(what, when) {\n                    let callback = this.getCallback();\n                    if (callback != null) {\n                        callback.scheduleDrawable(this, what, when);\n                    }\n                }\n                unscheduleSelf(what) {\n                    let callback = this.getCallback();\n                    if (callback != null) {\n                        callback.unscheduleDrawable(this, what);\n                    }\n                }\n                getAlpha() {\n                    return 0xFF;\n                }\n                isStateful() {\n                    return false;\n                }\n                setState(stateSet) {\n                    if (this.mStateSet + '' !== stateSet + '') {\n                        this.mStateSet = stateSet;\n                        return this.onStateChange(stateSet);\n                    }\n                    return false;\n                }\n                getState() {\n                    return this.mStateSet;\n                }\n                jumpToCurrentState() {\n                }\n                getCurrent() {\n                    return this;\n                }\n                setLevel(level) {\n                    if (this.mLevel != level) {\n                        this.mLevel = level;\n                        return this.onLevelChange(level);\n                    }\n                    return false;\n                }\n                getLevel() {\n                    return this.mLevel;\n                }\n                setVisible(visible, restart) {\n                    let changed = this.mVisible != visible;\n                    if (changed) {\n                        this.mVisible = visible;\n                        this.invalidateSelf();\n                    }\n                    return changed;\n                }\n                isVisible() {\n                    return this.mVisible;\n                }\n                setAutoMirrored(mirrored) {\n                }\n                isAutoMirrored() {\n                    return false;\n                }\n                getOpacity() {\n                    return PixelFormat.TRANSLUCENT;\n                }\n                static resolveOpacity(op1, op2) {\n                    if (op1 == op2) {\n                        return op1;\n                    }\n                    if (op1 == PixelFormat.UNKNOWN || op2 == PixelFormat.UNKNOWN) {\n                        return PixelFormat.UNKNOWN;\n                    }\n                    if (op1 == PixelFormat.TRANSLUCENT || op2 == PixelFormat.TRANSLUCENT) {\n                        return PixelFormat.TRANSLUCENT;\n                    }\n                    if (op1 == PixelFormat.TRANSPARENT || op2 == PixelFormat.TRANSPARENT) {\n                        return PixelFormat.TRANSPARENT;\n                    }\n                    return PixelFormat.OPAQUE;\n                }\n                onStateChange(state) {\n                    return false;\n                }\n                onLevelChange(level) {\n                    return false;\n                }\n                onBoundsChange(bounds) {\n                }\n                getIntrinsicWidth() {\n                    return -1;\n                }\n                getIntrinsicHeight() {\n                    return -1;\n                }\n                getMinimumWidth() {\n                    let intrinsicWidth = this.getIntrinsicWidth();\n                    return intrinsicWidth > 0 ? intrinsicWidth : 0;\n                }\n                getMinimumHeight() {\n                    let intrinsicHeight = this.getIntrinsicHeight();\n                    return intrinsicHeight > 0 ? intrinsicHeight : 0;\n                }\n                getPadding(padding) {\n                    padding.set(0, 0, 0, 0);\n                    return false;\n                }\n                mutate() {\n                    return this;\n                }\n                getConstantState() {\n                    return null;\n                }\n                static createFromXml(r, parser) {\n                    let drawable;\n                    let name = parser.tagName.toLowerCase();\n                    switch (name) {\n                        case \"selector\":\n                            drawable = new drawable_1.StateListDrawable();\n                            break;\n                        case \"layer-list\":\n                            drawable = new drawable_1.LayerDrawable(null);\n                            break;\n                        case \"color\":\n                            drawable = new drawable_1.ColorDrawable();\n                            break;\n                        case \"scale\":\n                            drawable = new drawable_1.ScaleDrawable();\n                            break;\n                        case \"clip\":\n                            drawable = new drawable_1.ClipDrawable();\n                            break;\n                        case \"rotate\":\n                            drawable = new drawable_1.RotateDrawable();\n                            break;\n                        case \"animation-list\":\n                            drawable = new drawable_1.AnimationDrawable();\n                            break;\n                        case \"inset\":\n                            drawable = new drawable_1.InsetDrawable(null, 0);\n                            break;\n                        case \"bitmap\":\n                            let srcAttr = parser.getAttribute('src');\n                            if (!srcAttr)\n                                throw Error(\"XmlPullParserException: bitmap tag must have 'src' attribute\");\n                            drawable = r.getDrawable(srcAttr);\n                            break;\n                        default:\n                            throw Error(\"XmlPullParserException: invalid drawable tag \" + name);\n                    }\n                    drawable.inflate(r, parser);\n                    return drawable;\n                }\n                inflate(r, parser) {\n                    this.mVisible = (parser.getAttribute('android:visible') !== 'false');\n                }\n            }\n            Drawable.ZERO_BOUNDS_RECT = new Rect();\n            drawable_1.Drawable = Drawable;\n        })(drawable = graphics.drawable || (graphics.drawable = {}));\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        var drawable;\n        (function (drawable) {\n            class ColorDrawable extends drawable.Drawable {\n                constructor(color) {\n                    super();\n                    this.mMutated = false;\n                    this.mPaint = new graphics.Paint();\n                    this.mState = new ColorState();\n                    if (color !== undefined) {\n                        this.setColor(color);\n                    }\n                }\n                _setStateCopyFrom(state) {\n                    this.mState = new ColorState(state);\n                }\n                mutate() {\n                    if (!this.mMutated && super.mutate() == this) {\n                        this.mState = new ColorState(this.mState);\n                        this.mMutated = true;\n                    }\n                    return this;\n                }\n                draw(canvas) {\n                    if ((this.mState.mUseColor >>> 24) != 0) {\n                        this.mPaint.setColor(this.mState.mUseColor);\n                        canvas.drawRect(this.getBounds(), this.mPaint);\n                    }\n                }\n                getColor() {\n                    return this.mState.mUseColor;\n                }\n                setColor(color) {\n                    if (this.mState.mBaseColor != color || this.mState.mUseColor != color) {\n                        this.invalidateSelf();\n                        this.mState.mBaseColor = this.mState.mUseColor = color;\n                    }\n                }\n                getAlpha() {\n                    return this.mState.mUseColor >>> 24;\n                }\n                setAlpha(alpha) {\n                    alpha += alpha >> 7;\n                    let baseAlpha = this.mState.mBaseColor >>> 24;\n                    let useAlpha = baseAlpha * alpha >> 8;\n                    let oldUseColor = this.mState.mUseColor;\n                    this.mState.mUseColor = (this.mState.mBaseColor << 8 >>> 8) | (useAlpha << 24);\n                    if (oldUseColor != this.mState.mUseColor) {\n                        this.invalidateSelf();\n                    }\n                }\n                getOpacity() {\n                    switch (this.mState.mUseColor >>> 24) {\n                        case 255:\n                            return graphics.PixelFormat.OPAQUE;\n                        case 0:\n                            return graphics.PixelFormat.TRANSPARENT;\n                    }\n                    return graphics.PixelFormat.TRANSLUCENT;\n                }\n                inflate(r, parser) {\n                    super.inflate(r, parser);\n                    let state = this.mState;\n                    state.mBaseColor = androidui.attr.AttrValueParser.parseColor(r, parser.innerText, state.mBaseColor);\n                    state.mUseColor = state.mBaseColor;\n                }\n                getConstantState() {\n                    return this.mState;\n                }\n            }\n            drawable.ColorDrawable = ColorDrawable;\n            class ColorState {\n                constructor(state) {\n                    this.mBaseColor = 0;\n                    this.mUseColor = 0;\n                    if (state != null) {\n                        this.mBaseColor = state.mBaseColor;\n                        this.mUseColor = state.mUseColor;\n                    }\n                }\n                newDrawable() {\n                    let c = new ColorDrawable();\n                    c._setStateCopyFrom(this);\n                    return c;\n                }\n            }\n        })(drawable = graphics.drawable || (graphics.drawable = {}));\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        var drawable;\n        (function (drawable) {\n            var Drawable = android.graphics.drawable.Drawable;\n            class ScrollBarDrawable extends Drawable {\n                constructor() {\n                    super(...arguments);\n                    this.mRange = 0;\n                    this.mOffset = 0;\n                    this.mExtent = 0;\n                    this.mVertical = false;\n                    this.mChanged = false;\n                    this.mRangeChanged = false;\n                    this.mTempBounds = new graphics.Rect();\n                    this.mAlwaysDrawHorizontalTrack = false;\n                    this.mAlwaysDrawVerticalTrack = false;\n                }\n                setAlwaysDrawHorizontalTrack(alwaysDrawTrack) {\n                    this.mAlwaysDrawHorizontalTrack = alwaysDrawTrack;\n                }\n                setAlwaysDrawVerticalTrack(alwaysDrawTrack) {\n                    this.mAlwaysDrawVerticalTrack = alwaysDrawTrack;\n                }\n                getAlwaysDrawVerticalTrack() {\n                    return this.mAlwaysDrawVerticalTrack;\n                }\n                getAlwaysDrawHorizontalTrack() {\n                    return this.mAlwaysDrawHorizontalTrack;\n                }\n                setParameters(range, offset, extent, vertical) {\n                    if (this.mVertical != vertical) {\n                        this.mChanged = true;\n                    }\n                    if (this.mRange != range || this.mOffset != offset || this.mExtent != extent) {\n                        this.mRangeChanged = true;\n                    }\n                    this.mRange = range;\n                    this.mOffset = offset;\n                    this.mExtent = extent;\n                    this.mVertical = vertical;\n                }\n                draw(canvas) {\n                    const vertical = this.mVertical;\n                    const extent = this.mExtent;\n                    const range = this.mRange;\n                    let drawTrack = true;\n                    let drawThumb = true;\n                    if (extent <= 0 || range <= extent) {\n                        drawTrack = vertical ? this.mAlwaysDrawVerticalTrack : this.mAlwaysDrawHorizontalTrack;\n                        drawThumb = false;\n                    }\n                    let r = this.getBounds();\n                    if (drawTrack) {\n                        this.drawTrack(canvas, r, vertical);\n                    }\n                    if (drawThumb) {\n                        let size = vertical ? r.height() : r.width();\n                        let thickness = vertical ? r.width() : r.height();\n                        let length = Math.round(size * extent / range);\n                        let offset = Math.round((size - length) * this.mOffset / (range - extent));\n                        let minLength = thickness * 2;\n                        if (length < minLength) {\n                            length = minLength;\n                        }\n                        if (offset + length > size) {\n                            offset = size - length;\n                        }\n                        this.drawThumb(canvas, r, offset, length, vertical);\n                    }\n                }\n                onBoundsChange(bounds) {\n                    super.onBoundsChange(bounds);\n                    this.mChanged = true;\n                }\n                drawTrack(canvas, bounds, vertical) {\n                    let track;\n                    if (vertical) {\n                        track = this.mVerticalTrack;\n                    }\n                    else {\n                        track = this.mHorizontalTrack;\n                    }\n                    if (track != null) {\n                        if (this.mChanged) {\n                            track.setBounds(bounds);\n                        }\n                        track.draw(canvas);\n                    }\n                }\n                drawThumb(canvas, bounds, offset, length, vertical) {\n                    const thumbRect = this.mTempBounds;\n                    const changed = this.mRangeChanged || this.mChanged;\n                    if (changed) {\n                        if (vertical) {\n                            thumbRect.set(bounds.left, bounds.top + offset, bounds.right, bounds.top + offset + length);\n                        }\n                        else {\n                            thumbRect.set(bounds.left + offset, bounds.top, bounds.left + offset + length, bounds.bottom);\n                        }\n                    }\n                    if (vertical) {\n                        const thumb = this.mVerticalThumb;\n                        if (changed)\n                            thumb.setBounds(thumbRect);\n                        thumb.draw(canvas);\n                    }\n                    else {\n                        const thumb = this.mHorizontalThumb;\n                        if (changed)\n                            thumb.setBounds(thumbRect);\n                        thumb.draw(canvas);\n                    }\n                }\n                setVerticalThumbDrawable(thumb) {\n                    if (thumb != null) {\n                        this.mVerticalThumb = thumb;\n                    }\n                }\n                setVerticalTrackDrawable(track) {\n                    this.mVerticalTrack = track;\n                }\n                setHorizontalThumbDrawable(thumb) {\n                    if (thumb != null) {\n                        this.mHorizontalThumb = thumb;\n                    }\n                }\n                setHorizontalTrackDrawable(track) {\n                    this.mHorizontalTrack = track;\n                }\n                getSize(vertical) {\n                    if (vertical) {\n                        return (this.mVerticalTrack != null ?\n                            this.mVerticalTrack : this.mVerticalThumb).getIntrinsicWidth();\n                    }\n                    else {\n                        return (this.mHorizontalTrack != null ?\n                            this.mHorizontalTrack : this.mHorizontalThumb).getIntrinsicHeight();\n                    }\n                }\n                setAlpha(alpha) {\n                    if (this.mVerticalTrack != null) {\n                        this.mVerticalTrack.setAlpha(alpha);\n                    }\n                    this.mVerticalThumb.setAlpha(alpha);\n                    if (this.mHorizontalTrack != null) {\n                        this.mHorizontalTrack.setAlpha(alpha);\n                    }\n                    this.mHorizontalThumb.setAlpha(alpha);\n                }\n                getAlpha() {\n                    return this.mVerticalThumb.getAlpha();\n                }\n                getOpacity() {\n                    return graphics.PixelFormat.TRANSLUCENT;\n                }\n                toString() {\n                    return \"ScrollBarDrawable: range=\" + this.mRange + \" offset=\" + this.mOffset +\n                        \" extent=\" + this.mExtent + (this.mVertical ? \" V\" : \" H\");\n                }\n            }\n            drawable.ScrollBarDrawable = ScrollBarDrawable;\n        })(drawable = graphics.drawable || (graphics.drawable = {}));\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        var drawable;\n        (function (drawable_2) {\n            var Integer = java.lang.Integer;\n            class InsetDrawable extends drawable_2.Drawable {\n                constructor(drawable, insetLeft, insetTop = insetLeft, insetRight = insetTop, insetBottom = insetRight) {\n                    super();\n                    this.mTmpRect = new graphics.Rect();\n                    this.mMutated = false;\n                    this.mInsetState = new InsetState(null, this);\n                    this.mInsetState.mDrawable = drawable;\n                    this.mInsetState.mInsetLeft = insetLeft;\n                    this.mInsetState.mInsetTop = insetTop;\n                    this.mInsetState.mInsetRight = insetRight;\n                    this.mInsetState.mInsetBottom = insetBottom;\n                    if (drawable != null) {\n                        drawable.setCallback(this);\n                    }\n                }\n                inflate(r, parser) {\n                    super.inflate(r, parser);\n                    this.mInsetState.mDrawable = null;\n                    let state = this.mInsetState;\n                    let a = r.obtainAttributes(parser);\n                    let dr = a.getDrawable(\"android:drawable\");\n                    if (!dr && parser.children[0] instanceof HTMLElement) {\n                        dr = drawable_2.Drawable.createFromXml(r, parser.children[0]);\n                    }\n                    if (!dr) {\n                        throw Error(\"<inset> tag requires a 'drawable' attribute or child tag defining a drawable\");\n                    }\n                    let inset = a.getDimensionPixelOffset(\"android:inset\", Integer.MIN_VALUE);\n                    if (inset != Integer.MIN_VALUE) {\n                        state.mInsetLeft = inset;\n                        state.mInsetTop = inset;\n                        state.mInsetRight = inset;\n                        state.mInsetBottom = inset;\n                    }\n                    state.mInsetLeft = a.getDimensionPixelOffset(\"android:insetLeft\", state.mInsetLeft);\n                    state.mInsetTop = a.getDimensionPixelOffset(\"android:insetTop\", state.mInsetTop);\n                    state.mInsetRight = a.getDimensionPixelOffset(\"android:insetRight\", state.mInsetRight);\n                    state.mInsetBottom = a.getDimensionPixelOffset(\"android:insetBottom\", state.mInsetBottom);\n                }\n                drawableSizeChange(who) {\n                    const callback = this.getCallback();\n                    if (callback != null && callback.drawableSizeChange) {\n                        callback.drawableSizeChange(this);\n                    }\n                }\n                invalidateDrawable(who) {\n                    const callback = this.getCallback();\n                    if (callback != null) {\n                        callback.invalidateDrawable(this);\n                    }\n                }\n                scheduleDrawable(who, what, when) {\n                    const callback = this.getCallback();\n                    if (callback != null) {\n                        callback.scheduleDrawable(this, what, when);\n                    }\n                }\n                unscheduleDrawable(who, what) {\n                    const callback = this.getCallback();\n                    if (callback != null) {\n                        callback.unscheduleDrawable(this, what);\n                    }\n                }\n                draw(canvas) {\n                    this.mInsetState.mDrawable.draw(canvas);\n                }\n                getPadding(padding) {\n                    let pad = this.mInsetState.mDrawable.getPadding(padding);\n                    padding.left += this.mInsetState.mInsetLeft;\n                    padding.right += this.mInsetState.mInsetRight;\n                    padding.top += this.mInsetState.mInsetTop;\n                    padding.bottom += this.mInsetState.mInsetBottom;\n                    if (pad || (this.mInsetState.mInsetLeft | this.mInsetState.mInsetRight |\n                        this.mInsetState.mInsetTop | this.mInsetState.mInsetBottom) != 0) {\n                        return true;\n                    }\n                    else {\n                        return false;\n                    }\n                }\n                setVisible(visible, restart) {\n                    this.mInsetState.mDrawable.setVisible(visible, restart);\n                    return super.setVisible(visible, restart);\n                }\n                setAlpha(alpha) {\n                    this.mInsetState.mDrawable.setAlpha(alpha);\n                }\n                getAlpha() {\n                    return this.mInsetState.mDrawable.getAlpha();\n                }\n                getOpacity() {\n                    return this.mInsetState.mDrawable.getOpacity();\n                }\n                isStateful() {\n                    return this.mInsetState.mDrawable.isStateful();\n                }\n                onStateChange(state) {\n                    let changed = this.mInsetState.mDrawable.setState(state);\n                    this.onBoundsChange(this.getBounds());\n                    return changed;\n                }\n                onBoundsChange(bounds) {\n                    const r = this.mTmpRect;\n                    r.set(bounds);\n                    r.left += this.mInsetState.mInsetLeft;\n                    r.top += this.mInsetState.mInsetTop;\n                    r.right -= this.mInsetState.mInsetRight;\n                    r.bottom -= this.mInsetState.mInsetBottom;\n                    this.mInsetState.mDrawable.setBounds(r.left, r.top, r.right, r.bottom);\n                }\n                getIntrinsicWidth() {\n                    return this.mInsetState.mDrawable.getIntrinsicWidth();\n                }\n                getIntrinsicHeight() {\n                    return this.mInsetState.mDrawable.getIntrinsicHeight();\n                }\n                getConstantState() {\n                    if (this.mInsetState.canConstantState()) {\n                        return this.mInsetState;\n                    }\n                    return null;\n                }\n                mutate() {\n                    if (!this.mMutated && super.mutate() == this) {\n                        this.mInsetState.mDrawable.mutate();\n                        this.mMutated = true;\n                    }\n                    return this;\n                }\n                getDrawable() {\n                    return this.mInsetState.mDrawable;\n                }\n            }\n            drawable_2.InsetDrawable = InsetDrawable;\n            class InsetState {\n                constructor(orig, owner) {\n                    this.mInsetLeft = 0;\n                    this.mInsetTop = 0;\n                    this.mInsetRight = 0;\n                    this.mInsetBottom = 0;\n                    if (orig != null) {\n                        this.mDrawable = orig.mDrawable.getConstantState().newDrawable();\n                        this.mDrawable.setCallback(owner);\n                        this.mInsetLeft = orig.mInsetLeft;\n                        this.mInsetTop = orig.mInsetTop;\n                        this.mInsetRight = orig.mInsetRight;\n                        this.mInsetBottom = orig.mInsetBottom;\n                        this.mCheckedConstantState = this.mCanConstantState = true;\n                    }\n                }\n                newDrawable() {\n                    let drawable = new InsetDrawable(null, 0);\n                    drawable.mInsetState = new InsetState(this, drawable);\n                    return drawable;\n                }\n                canConstantState() {\n                    if (!this.mCheckedConstantState) {\n                        this.mCanConstantState = this.mDrawable.getConstantState() != null;\n                        this.mCheckedConstantState = true;\n                    }\n                    return this.mCanConstantState;\n                }\n            }\n        })(drawable = graphics.drawable || (graphics.drawable = {}));\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        var drawable;\n        (function (drawable_3) {\n            class ShadowDrawable extends drawable_3.Drawable {\n                constructor(drawable, radius, dx, dy, color) {\n                    super();\n                    this.mMutated = false;\n                    this.mState = new DrawableState(null, this);\n                    this.mState.mDrawable = drawable;\n                    this.mState.shadowDx = dx;\n                    this.mState.shadowDy = dy;\n                    this.mState.shadowRadius = radius;\n                    this.mState.shadowColor = color;\n                    if (drawable != null) {\n                        drawable.setCallback(this);\n                    }\n                }\n                setShadow(radius, dx, dy, color) {\n                    this.mState.shadowDx = dx;\n                    this.mState.shadowDy = dy;\n                    this.mState.shadowRadius = radius;\n                    this.mState.shadowColor = color;\n                }\n                drawableSizeChange(who) {\n                    const callback = this.getCallback();\n                    if (callback != null && callback.drawableSizeChange) {\n                        callback.drawableSizeChange(this);\n                    }\n                }\n                invalidateDrawable(who) {\n                    const callback = this.getCallback();\n                    if (callback != null) {\n                        callback.invalidateDrawable(this);\n                    }\n                }\n                scheduleDrawable(who, what, when) {\n                    const callback = this.getCallback();\n                    if (callback != null) {\n                        callback.scheduleDrawable(this, what, when);\n                    }\n                }\n                unscheduleDrawable(who, what) {\n                    const callback = this.getCallback();\n                    if (callback != null) {\n                        callback.unscheduleDrawable(this, what);\n                    }\n                }\n                draw(canvas) {\n                    if (!this.mState.shadowRadius || graphics.Color.alpha(this.mState.shadowColor) === 0) {\n                        this.mState.mDrawable.draw(canvas);\n                        return;\n                    }\n                    let saveCount = canvas.save();\n                    canvas.setShadow(this.mState.shadowRadius, this.mState.shadowDx, this.mState.shadowDy, this.mState.shadowColor);\n                    this.mState.mDrawable.draw(canvas);\n                    canvas.restoreToCount(saveCount);\n                }\n                getPadding(padding) {\n                    return this.mState.mDrawable.getPadding(padding);\n                }\n                setVisible(visible, restart) {\n                    this.mState.mDrawable.setVisible(visible, restart);\n                    return super.setVisible(visible, restart);\n                }\n                setAlpha(alpha) {\n                    this.mState.mDrawable.setAlpha(alpha);\n                }\n                getAlpha() {\n                    return this.mState.mDrawable.getAlpha();\n                }\n                getOpacity() {\n                    return graphics.PixelFormat.TRANSPARENT;\n                }\n                isStateful() {\n                    return this.mState.mDrawable.isStateful();\n                }\n                onStateChange(state) {\n                    let changed = this.mState.mDrawable.setState(state);\n                    this.onBoundsChange(this.getBounds());\n                    return changed;\n                }\n                onBoundsChange(bounds) {\n                    this.mState.mDrawable.setBounds(bounds.left, bounds.top, bounds.right, bounds.bottom);\n                }\n                getIntrinsicWidth() {\n                    return this.mState.mDrawable.getIntrinsicWidth();\n                }\n                getIntrinsicHeight() {\n                    return this.mState.mDrawable.getIntrinsicHeight();\n                }\n                getConstantState() {\n                    if (this.mState.canConstantState()) {\n                        return this.mState;\n                    }\n                    return null;\n                }\n                mutate() {\n                    if (!this.mMutated && super.mutate() == this) {\n                        this.mState.mDrawable.mutate();\n                        this.mMutated = true;\n                    }\n                    return this;\n                }\n                getDrawable() {\n                    return this.mState.mDrawable;\n                }\n            }\n            drawable_3.ShadowDrawable = ShadowDrawable;\n            class DrawableState {\n                constructor(orig, owner) {\n                    this.shadowDx = 0;\n                    this.shadowDy = 0;\n                    this.shadowRadius = 0;\n                    this.shadowColor = 0;\n                    if (orig != null) {\n                        this.mDrawable = orig.mDrawable.getConstantState().newDrawable();\n                        this.mDrawable.setCallback(owner);\n                        this.shadowDx = orig.shadowDx;\n                        this.shadowDy = orig.shadowDy;\n                        this.shadowRadius = orig.shadowRadius;\n                        this.shadowColor = orig.shadowColor;\n                    }\n                }\n                newDrawable() {\n                    let drawable = new ShadowDrawable(null, 0, 0, 0, 0);\n                    drawable.mState = new DrawableState(this, drawable);\n                    return drawable;\n                }\n                canConstantState() {\n                    if (!this.mCheckedConstantState) {\n                        this.mCanConstantState = this.mDrawable.getConstantState() != null;\n                        this.mCheckedConstantState = true;\n                    }\n                    return this.mCanConstantState;\n                }\n            }\n        })(drawable = graphics.drawable || (graphics.drawable = {}));\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        var drawable;\n        (function (drawable) {\n            class RoundRectDrawable extends drawable.Drawable {\n                constructor(color, radiusTopLeft, radiusTopRight = radiusTopLeft, radiusBottomRight = radiusTopRight, radiusBottomLeft = radiusBottomRight) {\n                    super();\n                    this.mMutated = false;\n                    this.mPaint = new graphics.Paint();\n                    this.mState = new State();\n                    this.setColor(color);\n                    this.mState.mRadiusTopLeft = radiusTopLeft;\n                    this.mState.mRadiusTopRight = radiusTopRight;\n                    this.mState.mRadiusBottomRight = radiusBottomRight;\n                    this.mState.mRadiusBottomLeft = radiusBottomLeft;\n                }\n                mutate() {\n                    if (!this.mMutated && super.mutate() == this) {\n                        this.mState = new State(this.mState);\n                        this.mMutated = true;\n                    }\n                    return this;\n                }\n                draw(canvas) {\n                    if ((this.mState.mUseColor >>> 24) != 0) {\n                        this.mPaint.setColor(this.mState.mUseColor);\n                        canvas.drawRoundRect(this.getBounds(), this.mState.mRadiusTopLeft, this.mState.mRadiusTopRight, this.mState.mRadiusBottomRight, this.mState.mRadiusBottomLeft, this.mPaint);\n                    }\n                }\n                getColor() {\n                    return this.mState.mUseColor;\n                }\n                setColor(color) {\n                    if (this.mState.mBaseColor != color || this.mState.mUseColor != color) {\n                        this.invalidateSelf();\n                        this.mState.mBaseColor = this.mState.mUseColor = color;\n                    }\n                }\n                getAlpha() {\n                    return this.mState.mUseColor >>> 24;\n                }\n                setAlpha(alpha) {\n                    alpha += alpha >> 7;\n                    let baseAlpha = this.mState.mBaseColor >>> 24;\n                    let useAlpha = baseAlpha * alpha >> 8;\n                    let oldUseColor = this.mState.mUseColor;\n                    this.mState.mUseColor = (this.mState.mBaseColor << 8 >>> 8) | (useAlpha << 24);\n                    if (oldUseColor != this.mState.mUseColor) {\n                        this.invalidateSelf();\n                    }\n                }\n                getOpacity() {\n                    switch (this.mState.mUseColor >>> 24) {\n                        case 255:\n                            return graphics.PixelFormat.OPAQUE;\n                        case 0:\n                            return graphics.PixelFormat.TRANSPARENT;\n                    }\n                    return graphics.PixelFormat.TRANSLUCENT;\n                }\n                getConstantState() {\n                    return this.mState;\n                }\n            }\n            drawable.RoundRectDrawable = RoundRectDrawable;\n            class State {\n                constructor(state) {\n                    this.mBaseColor = 0;\n                    this.mUseColor = 0;\n                    this.mRadiusTopLeft = 0;\n                    this.mRadiusTopRight = 0;\n                    this.mRadiusBottomRight = 0;\n                    this.mRadiusBottomLeft = 0;\n                    if (state != null) {\n                        this.mBaseColor = state.mBaseColor;\n                        this.mUseColor = state.mUseColor;\n                        this.mRadiusTopLeft = state.mRadiusTopLeft;\n                        this.mRadiusTopRight = state.mRadiusTopRight;\n                        this.mRadiusBottomRight = state.mRadiusBottomRight;\n                        this.mRadiusBottomLeft = state.mRadiusBottomLeft;\n                    }\n                }\n                newDrawable() {\n                    let c = new RoundRectDrawable(0, 0, 0, 0, 0);\n                    c.mState = new State(this);\n                    return c;\n                }\n            }\n        })(drawable = graphics.drawable || (graphics.drawable = {}));\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar java;\n(function (java) {\n    var lang;\n    (function (lang) {\n        let hashCodeGenerator = 0;\n        class JavaObject {\n            constructor() {\n                this.hash = hashCodeGenerator++;\n            }\n            static get class() {\n                return Class.getClass(this);\n            }\n            hashCode() {\n                return this.hash;\n            }\n            getClass() {\n                return Class.getClass(this.constructor);\n            }\n            equals(o) {\n                return this === o;\n            }\n        }\n        lang.JavaObject = JavaObject;\n        class Class {\n            constructor(clazz) {\n                this.clazz = clazz;\n            }\n            static getClass(clazz) {\n                let c = Class.classCache.get(clazz);\n                if (!c) {\n                    c = new Class(clazz);\n                    Class.classCache.set(clazz, c);\n                }\n                return c;\n            }\n            getName() {\n                return this.clazz.name;\n            }\n            getSimpleName() {\n                return this.clazz.name;\n            }\n        }\n        Class.classCache = new Map();\n        lang.Class = Class;\n    })(lang = java.lang || (java.lang = {}));\n})(java || (java = {}));\nvar java;\n(function (java) {\n    var lang;\n    (function (lang) {\n        var util;\n        (function (util) {\n            var concurrent;\n            (function (concurrent) {\n                class CopyOnWriteArrayList {\n                    constructor() {\n                        this.mData = [];\n                        this.isDataNew = true;\n                    }\n                    iterator() {\n                        this.isDataNew = false;\n                        return this.mData;\n                    }\n                    [Symbol.iterator]() {\n                        this.isDataNew = false;\n                        return this.mData[Symbol.iterator]();\n                    }\n                    checkNewData() {\n                        if (!this.isDataNew) {\n                            this.isDataNew = true;\n                            this.mData = [...this.mData];\n                        }\n                    }\n                    size() {\n                        return this.mData.length;\n                    }\n                    add(...items) {\n                        this.checkNewData();\n                        this.mData.push(...items);\n                    }\n                    addAll(array) {\n                        this.checkNewData();\n                        this.mData.push(...array.mData);\n                    }\n                    remove(item) {\n                        this.checkNewData();\n                        this.mData.splice(this.mData.indexOf(item), 1);\n                    }\n                }\n                concurrent.CopyOnWriteArrayList = CopyOnWriteArrayList;\n            })(concurrent = util.concurrent || (util.concurrent = {}));\n        })(util = lang.util || (lang.util = {}));\n    })(lang = java.lang || (java.lang = {}));\n})(java || (java = {}));\nvar android;\n(function (android) {\n    var util;\n    (function (util) {\n        class Access {\n            get(index) {\n                return this.mData[index];\n            }\n            size() {\n                return this.mSize;\n            }\n        }\n        class CopyOnWriteArray {\n            constructor() {\n                this.mData = [];\n                this.mAccess = new Access();\n            }\n            getArray() {\n                if (this.mStart) {\n                    if (this.mDataCopy == null)\n                        this.mDataCopy = [...this.mData];\n                    return this.mDataCopy;\n                }\n                return this.mData;\n            }\n            start() {\n                if (this.mStart)\n                    throw new Error(\"Iteration already started\");\n                this.mStart = true;\n                this.mDataCopy = null;\n                this.mAccess.mData = this.mData;\n                this.mAccess.mSize = this.mData.length;\n                return this.mAccess.mData;\n            }\n            end() {\n                if (!this.mStart)\n                    throw new Error(\"Iteration not started\");\n                this.mStart = false;\n                if (this.mDataCopy != null) {\n                    this.mData = this.mDataCopy;\n                    this.mAccess.mData = [];\n                    this.mAccess.mSize = 0;\n                }\n                this.mDataCopy = null;\n            }\n            size() {\n                return this.getArray().length;\n            }\n            add(...items) {\n                this.getArray().push(...items);\n            }\n            addAll(array) {\n                this.getArray().push(...array.mData);\n            }\n            remove(item) {\n                this.getArray().splice(this.getArray().indexOf(item), 1);\n            }\n        }\n        util.CopyOnWriteArray = CopyOnWriteArray;\n    })(util = android.util || (android.util = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var CopyOnWriteArrayList = java.lang.util.concurrent.CopyOnWriteArrayList;\n        var CopyOnWriteArray = android.util.CopyOnWriteArray;\n        class ViewTreeObserver {\n            constructor() {\n                this.mAlive = true;\n            }\n            addOnGlobalLayoutListener(listener) {\n                this.checkIsAlive();\n                if (this.mOnGlobalLayoutListeners == null) {\n                    this.mOnGlobalLayoutListeners = new CopyOnWriteArray();\n                }\n                this.mOnGlobalLayoutListeners.add(listener);\n            }\n            removeGlobalOnLayoutListener(victim) {\n                this.removeOnGlobalLayoutListener(victim);\n            }\n            removeOnGlobalLayoutListener(victim) {\n                this.checkIsAlive();\n                if (this.mOnGlobalLayoutListeners == null) {\n                    return;\n                }\n                this.mOnGlobalLayoutListeners.remove(victim);\n            }\n            dispatchOnGlobalLayout() {\n                let listeners = this.mOnGlobalLayoutListeners;\n                if (listeners != null && listeners.size() > 0) {\n                    let access = listeners.start();\n                    try {\n                        let count = access.length;\n                        for (let i = 0; i < count; i++) {\n                            access[i].onGlobalLayout();\n                        }\n                    }\n                    finally {\n                        listeners.end();\n                    }\n                }\n            }\n            addOnPreDrawListener(listener) {\n                this.checkIsAlive();\n                if (this.mOnPreDrawListeners == null) {\n                    this.mOnPreDrawListeners = new CopyOnWriteArray();\n                }\n                this.mOnPreDrawListeners.add(listener);\n            }\n            removeOnPreDrawListener(victim) {\n                this.checkIsAlive();\n                if (this.mOnPreDrawListeners == null) {\n                    return;\n                }\n                this.mOnPreDrawListeners.remove(victim);\n            }\n            dispatchOnPreDraw() {\n                let cancelDraw = false;\n                const listeners = this.mOnPreDrawListeners;\n                if (listeners != null && listeners.size() > 0) {\n                    let access = listeners.start();\n                    try {\n                        let count = access.length;\n                        for (let i = 0; i < count; i++) {\n                            cancelDraw = cancelDraw || !(access[i].onPreDraw());\n                        }\n                    }\n                    finally {\n                        listeners.end();\n                    }\n                }\n                return cancelDraw;\n            }\n            addOnTouchModeChangeListener(listener) {\n                this.checkIsAlive();\n                if (this.mOnTouchModeChangeListeners == null) {\n                    this.mOnTouchModeChangeListeners = new CopyOnWriteArrayList();\n                }\n                this.mOnTouchModeChangeListeners.add(listener);\n            }\n            removeOnTouchModeChangeListener(victim) {\n                this.checkIsAlive();\n                if (this.mOnTouchModeChangeListeners == null) {\n                    return;\n                }\n                this.mOnTouchModeChangeListeners.remove(victim);\n            }\n            dispatchOnTouchModeChanged(inTouchMode) {\n                const listeners = this.mOnTouchModeChangeListeners;\n                if (listeners != null && listeners.size() > 0) {\n                    for (let listener of listeners) {\n                        listener.onTouchModeChanged(inTouchMode);\n                    }\n                }\n            }\n            addOnScrollChangedListener(listener) {\n                this.checkIsAlive();\n                if (this.mOnScrollChangedListeners == null) {\n                    this.mOnScrollChangedListeners = new CopyOnWriteArray();\n                }\n                this.mOnScrollChangedListeners.add(listener);\n            }\n            removeOnScrollChangedListener(victim) {\n                this.checkIsAlive();\n                if (this.mOnScrollChangedListeners == null) {\n                    return;\n                }\n                this.mOnScrollChangedListeners.remove(victim);\n            }\n            dispatchOnScrollChanged() {\n                let listeners = this.mOnScrollChangedListeners;\n                if (listeners != null && listeners.size() > 0) {\n                    let access = listeners.start();\n                    try {\n                        let count = access.length;\n                        for (let i = 0; i < count; i++) {\n                            access[i].onScrollChanged();\n                        }\n                    }\n                    finally {\n                        listeners.end();\n                    }\n                }\n            }\n            addOnDrawListener(listener) {\n                this.checkIsAlive();\n                if (this.mOnDrawListeners == null) {\n                    this.mOnDrawListeners = new CopyOnWriteArrayList();\n                }\n                this.mOnDrawListeners.add(listener);\n            }\n            removeOnDrawListener(victim) {\n                this.checkIsAlive();\n                if (this.mOnDrawListeners == null) {\n                    return;\n                }\n                this.mOnDrawListeners.remove(victim);\n            }\n            dispatchOnDraw() {\n                if (this.mOnDrawListeners != null) {\n                    for (let listener of this.mOnDrawListeners) {\n                        listener.onDraw();\n                    }\n                }\n            }\n            merge(observer) {\n                if (observer.mOnGlobalLayoutListeners != null) {\n                    if (this.mOnGlobalLayoutListeners != null) {\n                        this.mOnGlobalLayoutListeners.addAll(observer.mOnGlobalLayoutListeners);\n                    }\n                    else {\n                        this.mOnGlobalLayoutListeners = observer.mOnGlobalLayoutListeners;\n                    }\n                }\n                if (observer.mOnPreDrawListeners != null) {\n                    if (this.mOnPreDrawListeners != null) {\n                        this.mOnPreDrawListeners.addAll(observer.mOnPreDrawListeners);\n                    }\n                    else {\n                        this.mOnPreDrawListeners = observer.mOnPreDrawListeners;\n                    }\n                }\n                if (observer.mOnScrollChangedListeners != null) {\n                    if (this.mOnScrollChangedListeners != null) {\n                        this.mOnScrollChangedListeners.addAll(observer.mOnScrollChangedListeners);\n                    }\n                    else {\n                        this.mOnScrollChangedListeners = observer.mOnScrollChangedListeners;\n                    }\n                }\n                observer.kill();\n            }\n            checkIsAlive() {\n                if (!this.mAlive) {\n                    throw new Error(\"This ViewTreeObserver is not alive, call \"\n                        + \"getViewTreeObserver() again\");\n                }\n            }\n            isAlive() {\n                return this.mAlive;\n            }\n            kill() {\n                this.mAlive = false;\n            }\n        }\n        view.ViewTreeObserver = ViewTreeObserver;\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var util;\n    (function (util) {\n        class DisplayMetrics {\n        }\n        DisplayMetrics.DENSITY_LOW = 120;\n        DisplayMetrics.DENSITY_MEDIUM = 160;\n        DisplayMetrics.DENSITY_HIGH = 240;\n        DisplayMetrics.DENSITY_XHIGH = 320;\n        DisplayMetrics.DENSITY_XXHIGH = 480;\n        DisplayMetrics.DENSITY_XXXHIGH = 640;\n        DisplayMetrics.DENSITY_DEFAULT = DisplayMetrics.DENSITY_MEDIUM;\n        util.DisplayMetrics = DisplayMetrics;\n    })(util = android.util || (android.util = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var content;\n    (function (content) {\n        var Bundle = android.os.Bundle;\n        class Intent {\n            constructor(activityName) {\n                this.mRequestCode = -1;\n                this.mFlags = 0;\n                this.activityName = activityName;\n            }\n            getBooleanExtra(name, defaultValue) {\n                return this.mExtras == null ? defaultValue : this.mExtras.get(name, defaultValue);\n            }\n            getIntExtra(name, defaultValue) {\n                return this.mExtras == null ? defaultValue : this.mExtras.get(name, defaultValue);\n            }\n            getLongExtra(name, defaultValue) {\n                return this.mExtras == null ? defaultValue : this.mExtras.get(name, defaultValue);\n            }\n            getFloatExtra(name, defaultValue) {\n                return this.mExtras == null ? defaultValue : this.mExtras.get(name, defaultValue);\n            }\n            getDoubleExtra(name, defaultValue) {\n                return this.mExtras == null ? defaultValue : this.mExtras.get(name, defaultValue);\n            }\n            getStringExtra(name, defaultValue) {\n                return this.mExtras == null ? defaultValue : this.mExtras.get(name, defaultValue);\n            }\n            getStringArrayExtra(name, defaultValue) {\n                return this.mExtras == null ? defaultValue : this.mExtras.get(name, defaultValue);\n            }\n            getIntegerArrayExtra(name, defaultValue) {\n                return this.mExtras == null ? defaultValue : this.mExtras.get(name, defaultValue);\n            }\n            getLongArrayExtra(name, defaultValue) {\n                return this.mExtras == null ? defaultValue : this.mExtras.get(name, defaultValue);\n            }\n            getFloatArrayExtra(name, defaultValue) {\n                return this.mExtras == null ? defaultValue : this.mExtras.get(name, defaultValue);\n            }\n            getDoubleArrayExtra(name, defaultValue) {\n                return this.mExtras == null ? defaultValue : this.mExtras.get(name, defaultValue);\n            }\n            getBooleanArrayExtra(name, defaultValue) {\n                return this.mExtras == null ? defaultValue : this.mExtras.get(name, defaultValue);\n            }\n            hasExtra(name) {\n                return this.mExtras != null && this.mExtras.containsKey(name);\n            }\n            putExtra(name, value) {\n                if (this.mExtras == null) {\n                    this.mExtras = new Bundle();\n                }\n                this.mExtras.put(name, value);\n                return this;\n            }\n            getExtras() {\n                return (this.mExtras != null) ? new Bundle(this.mExtras) : null;\n            }\n            getFlags() {\n                return this.mFlags;\n            }\n            setFlags(flags) {\n                this.mFlags = flags;\n                return this;\n            }\n            addFlags(flags) {\n                this.mFlags |= flags;\n                return this;\n            }\n        }\n        Intent.FLAG_ACTIVITY_CLEAR_TOP = 0x04000000;\n        content.Intent = Intent;\n    })(content = android.content || (android.content = {}));\n})(android || (android = {}));\nvar androidui;\n(function (androidui) {\n    var util;\n    (function (util) {\n        class ClassFinder {\n            static findClass(classFullName, findInRoot = window) {\n                let nameParts = classFullName.split('.');\n                let finding = findInRoot;\n                for (let part of nameParts) {\n                    let quickFind = finding[part.toLowerCase()];\n                    if (quickFind) {\n                        finding = quickFind;\n                        continue;\n                    }\n                    let found = false;\n                    for (let key in finding) {\n                        if (key.toUpperCase() === part.toUpperCase()) {\n                            finding = finding[key];\n                            found = true;\n                            break;\n                        }\n                    }\n                    if (!found)\n                        return null;\n                }\n                if (finding === findInRoot) {\n                    return null;\n                }\n                return finding;\n            }\n            static findViewClass(className) {\n                let rootViewClass = ClassFinder._findViewClassCache[className];\n                if (!rootViewClass)\n                    rootViewClass = ClassFinder.findClass(className, android.view);\n                if (!rootViewClass)\n                    rootViewClass = ClassFinder.findClass(className, android['widget']);\n                if (!rootViewClass)\n                    rootViewClass = ClassFinder.findClass(className, androidui['widget']);\n                if (!rootViewClass)\n                    rootViewClass = ClassFinder.findClass(className);\n                if (!rootViewClass) {\n                    if (document.createElement(className) instanceof HTMLUnknownElement) {\n                        console.warn('inflate: not find class ' + className);\n                    }\n                    return null;\n                }\n                ClassFinder._findViewClassCache[className] = rootViewClass;\n                return rootViewClass;\n            }\n        }\n        ClassFinder._findViewClassCache = {};\n        util.ClassFinder = ClassFinder;\n    })(util = androidui.util || (androidui.util = {}));\n})(androidui || (androidui = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var ClassFinder = androidui.util.ClassFinder;\n        class LayoutInflater {\n            constructor(context) {\n                this.mContext = context;\n            }\n            static from(context) {\n                return context.getLayoutInflater();\n            }\n            getContext() {\n                return this.mContext;\n            }\n            inflate(layout, viewParent, attachToRoot = (viewParent != null)) {\n                let domtree = layout instanceof HTMLElement ? layout : this.mContext.getResources().getLayout(layout);\n                if (!domtree) {\n                    console.error('not find layout: ' + layout);\n                    return null;\n                }\n                let className = domtree.tagName;\n                if (className.startsWith('ANDROID-')) {\n                    className = className.substring('ANDROID-'.length);\n                }\n                if (className === 'LAYOUT') {\n                    domtree = domtree.firstElementChild;\n                }\n                if (className === 'INCLUDE') {\n                    let refLayoutId = domtree.getAttribute('layout');\n                    if (!refLayoutId)\n                        return null;\n                    let refEle = this.mContext.getResources().getLayout(refLayoutId);\n                    for (let attr of Array.from(domtree.attributes)) {\n                        let name = attr.name;\n                        if (name === 'layout')\n                            continue;\n                        refEle.setAttribute(name, attr.value);\n                    }\n                    return this.inflate(refEle, viewParent);\n                }\n                else if (className === 'MERGE') {\n                    if (!viewParent)\n                        throw Error('merge tag need ViewParent');\n                    Array.from(domtree.children).forEach((item) => {\n                        if (item instanceof HTMLElement) {\n                            this.inflate(item, viewParent);\n                        }\n                    });\n                    return viewParent;\n                }\n                else if (className === 'VIEW') {\n                    let overrideClass = domtree.className || domtree.getAttribute('android:class');\n                    if (overrideClass)\n                        className = overrideClass;\n                }\n                let rootViewClass = ClassFinder.findViewClass(className);\n                if (!rootViewClass) {\n                    return null;\n                }\n                let children = Array.from(domtree.children);\n                let defStyle;\n                let styleAttrValue = domtree.getAttribute('style');\n                if (styleAttrValue) {\n                    defStyle = this.mContext.getResources().getDefStyle(styleAttrValue);\n                }\n                let rootView;\n                if (defStyle)\n                    rootView = new rootViewClass(this.mContext, domtree, defStyle);\n                else\n                    rootView = new rootViewClass(this.mContext, domtree);\n                if (rootView['onInflateAdapter']) {\n                    rootView.onInflateAdapter(domtree, this.mContext, viewParent);\n                    domtree.parentNode.removeChild(domtree);\n                }\n                if (!(rootView instanceof view.View)) {\n                    return rootView;\n                }\n                let params;\n                if (viewParent) {\n                    params = viewParent.generateLayoutParamsFromAttr(domtree);\n                    rootView.setLayoutParams(params);\n                }\n                if (rootView instanceof view.ViewGroup) {\n                    let parent = rootView;\n                    children.forEach((item) => {\n                        if (item instanceof HTMLElement) {\n                            this.inflate(item, parent);\n                        }\n                    });\n                }\n                rootView.onFinishInflate();\n                if (attachToRoot && viewParent) {\n                    if (params) {\n                        viewParent.addView(rootView, params);\n                    }\n                    else {\n                        viewParent.addView(rootView);\n                    }\n                }\n                return rootView;\n            }\n        }\n        view.LayoutInflater = LayoutInflater;\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var content;\n    (function (content) {\n        var LayoutInflater = android.view.LayoutInflater;\n        class Context {\n            constructor(androidUI) {\n                this.androidUI = androidUI;\n                this.mLayoutInflater = new LayoutInflater(this);\n                this.mResources = new android.content.res.Resources(this);\n            }\n            getApplicationContext() {\n                return this.androidUI.mApplication;\n            }\n            getResources() {\n                return this.mResources;\n            }\n            getLayoutInflater() {\n                return this.mLayoutInflater;\n            }\n            obtainStyledAttributes(attrs, defStyleAttr) {\n                return content.res.TypedArray.obtain(this.mResources, attrs, defStyleAttr);\n            }\n        }\n        content.Context = Context;\n    })(content = android.content || (android.content = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var R;\n    (function (R) {\n        const _layout_data = {\n            \"action_bar\": \"<merge>\\n    <linearlayout android:layout_height=\\\"wrap_content\\\" android:layout_width=\\\"match_parent\\\" android:layout_marginLeft=\\\"60dp\\\" android:layout_marginRight=\\\"60dp\\\" android:minHeight=\\\"48dp\\\" android:gravity=\\\"center\\\" android:orientation=\\\"vertical\\\" id=\\\"action_bar_center_layout\\\">\\n        <textview android:gravity=\\\"center\\\" android:drawablePadding=\\\"4dp\\\" android:singleLine=\\\"true\\\" android:ellipsize=\\\"end\\\" android:textColor=\\\"@android:color/white\\\" android:textSize=\\\"18sp\\\" id=\\\"action_bar_title\\\"></textview>\\n        <textview android:visibility=\\\"gone\\\" android:gravity=\\\"center\\\" android:layout_marginTop=\\\"4dp\\\" android:drawablePadding=\\\"4dp\\\" android:singleLine=\\\"true\\\" android:ellipsize=\\\"end\\\" android:textColor=\\\"@android:color/white\\\" android:textSize=\\\"12sp\\\" id=\\\"action_bar_sub_title\\\"></textview>\\n    </linearlayout>\\n    <button android:visibility=\\\"gone\\\" android:layout_gravity=\\\"left|center_vertical\\\" android:layout_width=\\\"wrap_content\\\" android:background=\\\"@android:drawable/item_background\\\" android:textColor=\\\"@android:color/white\\\" android:paddingLeft=\\\"6dp\\\" android:paddingRight=\\\"6dp\\\" android:drawablePadding=\\\"4dp\\\" android:minWidth=\\\"32dp\\\" android:textSize=\\\"17sp\\\" android:singleLine=\\\"true\\\" id=\\\"action_bar_left\\\"></button>\\n    <button android:visibility=\\\"gone\\\" android:layout_gravity=\\\"right|center_vertical\\\" android:layout_width=\\\"wrap_content\\\" android:background=\\\"@android:drawable/item_background\\\" android:textColor=\\\"@android:color/white\\\" android:paddingRight=\\\"6dp\\\" android:paddingLeft=\\\"6dp\\\" android:drawablePadding=\\\"4dp\\\" android:minWidth=\\\"32dp\\\" android:textSize=\\\"17sp\\\" android:singleLine=\\\"true\\\" id=\\\"action_bar_right\\\"></button>\\n</merge>\",\n            \"alert_dialog\": \"<linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:layout_marginStart=\\\"8dip\\\" android:layout_marginEnd=\\\"8dip\\\" android:orientation=\\\"vertical\\\" id=\\\"parentPanel\\\">\\n\\n    <linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:orientation=\\\"vertical\\\" id=\\\"topPanel\\\">\\n        <view android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"1dip\\\" android:visibility=\\\"gone\\\" android:background=\\\"#aaa\\\" id=\\\"titleDividerTop\\\"></view>\\n        <linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:orientation=\\\"horizontal\\\" android:gravity=\\\"center_vertical|start\\\" android:minHeight=\\\"64dp\\\" android:layout_marginStart=\\\"16dip\\\" android:layout_marginEnd=\\\"16dip\\\" id=\\\"title_template\\\">\\n            <imageview android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:paddingEnd=\\\"8dip\\\" id=\\\"icon\\\"></imageview>\\n            <textview android:maxLines=\\\"1\\\" android:scrollHorizontally=\\\"true\\\" android:textSize=\\\"22sp\\\" android:textColor=\\\"#333\\\" android:singleLine=\\\"true\\\" android:ellipsize=\\\"end\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:textAlignment=\\\"viewStart\\\" id=\\\"alertTitle\\\"></textview>\\n        </linearlayout>\\n        <view android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"1dip\\\" android:visibility=\\\"gone\\\" android:background=\\\"#aaa\\\" id=\\\"titleDivider\\\"></view>\\n        <!-- If the client uses a customTitle, it will be added here. -->\\n    </linearlayout>\\n\\n    <linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:layout_weight=\\\"1\\\" android:orientation=\\\"vertical\\\" android:minHeight=\\\"64dp\\\" id=\\\"contentPanel\\\">\\n        <scrollview android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:clipToPadding=\\\"false\\\" id=\\\"scrollView\\\">\\n            <textview android:textSize=\\\"18sp\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:paddingStart=\\\"16dip\\\" android:paddingEnd=\\\"16dip\\\" android:paddingTop=\\\"8dip\\\" android:paddingBottom=\\\"8dip\\\" id=\\\"message\\\"></textview>\\n        </scrollview>\\n    </linearlayout>\\n\\n    <framelayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:layout_weight=\\\"1\\\" android:minHeight=\\\"64dp\\\" id=\\\"customPanel\\\">\\n        <framelayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" id=\\\"custom\\\"></framelayout>\\n    </framelayout>\\n\\n    <linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:minHeight=\\\"48dip\\\" android:orientation=\\\"vertical\\\" android:divider=\\\"@android:drawable/divider_horizontal\\\" android:showDividers=\\\"beginning\\\" android:dividerPadding=\\\"0dip\\\" id=\\\"buttonPanel\\\">\\n        <linearlayout android:divider=\\\"@android:drawable/divider_vertical\\\" android:showDividers=\\\"middle\\\" android:dividerPadding=\\\"0dp\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:orientation=\\\"horizontal\\\" android:layoutDirection=\\\"locale\\\" android:measureWithLargestChild=\\\"true\\\">\\n            <button android:layout_width=\\\"wrap_content\\\" android:layout_gravity=\\\"start\\\" android:layout_weight=\\\"1\\\" android:maxLines=\\\"2\\\" android:paddingStart=\\\"4dp\\\" android:paddingEnd=\\\"4dp\\\" android:background=\\\"@android:drawable/item_background\\\" android:textSize=\\\"14sp\\\" android:minHeight=\\\"48dp\\\" android:layout_height=\\\"wrap_content\\\" id=\\\"button2\\\"></button>\\n            <button android:layout_width=\\\"wrap_content\\\" android:layout_gravity=\\\"center_horizontal\\\" android:layout_weight=\\\"1\\\" android:maxLines=\\\"2\\\" android:paddingStart=\\\"4dp\\\" android:paddingEnd=\\\"4dp\\\" android:background=\\\"@android:drawable/item_background\\\" android:textSize=\\\"14sp\\\" android:minHeight=\\\"48dp\\\" android:layout_height=\\\"wrap_content\\\" id=\\\"button3\\\"></button>\\n            <button android:layout_width=\\\"wrap_content\\\" android:layout_gravity=\\\"end\\\" android:layout_weight=\\\"1\\\" android:maxLines=\\\"2\\\" android:paddingStart=\\\"4dp\\\" android:paddingEnd=\\\"4dp\\\" android:background=\\\"@android:drawable/item_background\\\" android:textSize=\\\"14sp\\\" android:minHeight=\\\"48dp\\\" android:layout_height=\\\"wrap_content\\\" id=\\\"button1\\\"></button>\\n        </linearlayout>\\n     </linearlayout>\\n</linearlayout>\",\n            \"alert_dialog_progress\": \"<relativelayout android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"match_parent\\\">\\n    <progressbar style=\\\"@android:attr/progressBarStyleHorizontal\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:layout_marginTop=\\\"16dip\\\" android:layout_marginBottom=\\\"1dip\\\" android:layout_marginStart=\\\"16dip\\\" android:layout_marginEnd=\\\"16dip\\\" android:layout_centerHorizontal=\\\"true\\\" id=\\\"progress\\\"></progressbar>\\n    <textview android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:paddingBottom=\\\"16dip\\\" android:layout_marginStart=\\\"16dip\\\" android:layout_marginEnd=\\\"16dip\\\" android:layout_alignParentStart=\\\"true\\\" android:layout_below=\\\"progress\\\" id=\\\"progress_percent\\\"></textview>\\n    <textview android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:paddingBottom=\\\"16dip\\\" android:layout_marginStart=\\\"16dip\\\" android:layout_marginEnd=\\\"16dip\\\" android:layout_alignParentEnd=\\\"true\\\" android:layout_below=\\\"progress\\\" id=\\\"progress_number\\\"></textview>\\n</relativelayout>\",\n            \"popup_menu_item_layout\": \"<linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"48dp\\\" android:minWidth=\\\"196dip\\\" android:paddingEnd=\\\"16dip\\\">\\n\\n    <imageview android:visibility=\\\"gone\\\" android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:layout_gravity=\\\"center_vertical\\\" android:layout_marginStart=\\\"8dip\\\" android:layout_marginEnd=\\\"-8dip\\\" android:layout_marginTop=\\\"8dip\\\" android:layout_marginBottom=\\\"8dip\\\" android:scaleType=\\\"centerInside\\\" android:duplicateParentState=\\\"true\\\" id=\\\"icon\\\"></imageview>\\n    \\n    <!-- The title and summary have some gap between them, and this 'group' should be centered vertically. -->\\n    <relativelayout android:layout_width=\\\"0dip\\\" android:layout_weight=\\\"1\\\" android:layout_height=\\\"wrap_content\\\" android:layout_gravity=\\\"center_vertical\\\" android:layout_marginStart=\\\"16dip\\\" android:duplicateParentState=\\\"true\\\">\\n\\n        <textview android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:layout_alignParentTop=\\\"true\\\" android:layout_alignParentStart=\\\"true\\\" android:textColor=\\\"@android:color/primary_text_dark_disable_only\\\" android:textSize=\\\"18sp\\\" android:singleLine=\\\"true\\\" android:duplicateParentState=\\\"true\\\" android:ellipsize=\\\"marquee\\\" android:fadingEdge=\\\"horizontal\\\" android:textAlignment=\\\"viewStart\\\" id=\\\"title\\\"></textview>\\n\\n        <textview android:visibility=\\\"gone\\\" android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:layout_below=\\\"title\\\" android:layout_alignParentStart=\\\"true\\\" android:textColor=\\\"@android:color/primary_text_dark_disable_only\\\" android:textSize=\\\"12sp\\\" android:singleLine=\\\"true\\\" android:duplicateParentState=\\\"true\\\" android:textAlignment=\\\"viewStart\\\" id=\\\"shortcut\\\"></textview>\\n\\n    </relativelayout>\\n\\n    <!-- Checkbox, and/or radio button will be inserted here. -->\\n    \\n</linearlayout>\",\n            \"select_dialog\": \"<view class=\\\"android.app.AlertController.RecycleListView\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"match_parent\\\" android:cacheColorHint=\\\"@null\\\" android:divider=\\\"@android:drawable/list_divider\\\" android:scrollbars=\\\"vertical\\\" android:overScrollMode=\\\"ifContentScrolls\\\" android:textAlignment=\\\"viewStart\\\" id=\\\"select_dialog_listview\\\"></view>\",\n            \"select_dialog_item\": \"<textview android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:minHeight=\\\"48dp\\\" android:textSize=\\\"18sp\\\" android:gravity=\\\"center_vertical\\\" android:paddingStart=\\\"16dip\\\" android:paddingEnd=\\\"16dip\\\" android:ellipsize=\\\"end\\\" id=\\\"text1\\\"></textview>\",\n            \"select_dialog_multichoice\": \"<checkedtextview android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:minHeight=\\\"48dp\\\" android:textSize=\\\"18sp\\\" android:gravity=\\\"center_vertical\\\" android:paddingStart=\\\"16dip\\\" android:paddingEnd=\\\"16dip\\\" android:checkMark=\\\"@android:drawable/btn_check\\\" android:ellipsize=\\\"end\\\" id=\\\"text1\\\"></checkedtextview>\",\n            \"select_dialog_singlechoice\": \"<checkedtextview android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:minHeight=\\\"48dp\\\" android:textSize=\\\"18sp\\\" android:gravity=\\\"center_vertical\\\" android:paddingStart=\\\"16dip\\\" android:paddingEnd=\\\"16dip\\\" android:checkMark=\\\"@android:drawable/btn_radio\\\" android:ellipsize=\\\"end\\\" id=\\\"text1\\\"></checkedtextview>\",\n            \"simple_spinner_dropdown_item\": \"<checkedtextview android:paddingStart=\\\"8dp\\\" android:paddingEnd=\\\"8dp\\\" android:textColor=\\\"@android:color/primary_text_light_disable_only\\\" android:gravity=\\\"center_vertical\\\" android:singleLine=\\\"true\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"48dp\\\" android:ellipsize=\\\"end\\\" android:textAlignment=\\\"inherit\\\" id=\\\"text1\\\"></checkedtextview>\",\n            \"simple_spinner_item\": \"<textview android:paddingStart=\\\"8dp\\\" android:paddingEnd=\\\"8dp\\\" android:textColor=\\\"@android:color/primary_text_light_disable_only\\\" android:gravity=\\\"center_vertical\\\" android:singleLine=\\\"true\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:ellipsize=\\\"end\\\" android:textAlignment=\\\"inherit\\\" id=\\\"text1\\\"></textview>\",\n            \"transient_notification\": \"<linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"match_parent\\\" android:orientation=\\\"vertical\\\" android:background=\\\"@android:drawable/toast_frame\\\">\\n\\n    <textview android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:layout_weight=\\\"1\\\" android:layout_gravity=\\\"center_horizontal\\\" android:textColor=\\\"white\\\" android:shadowColor=\\\"#BB000000\\\" android:shadowRadius=\\\"2.75\\\" id=\\\"message\\\"></textview>\\n\\n</linearlayout>\"\n        };\n        const _tempDiv = document.createElement('div');\n        class layout {\n            static getLayoutData(layoutName) {\n                if (!layoutName)\n                    return null;\n                if (!_layout_data[layoutName])\n                    return null;\n                _tempDiv.innerHTML = _layout_data[layoutName];\n                let data = _tempDiv.firstElementChild;\n                _tempDiv.removeChild(data);\n                return data;\n            }\n        }\n        layout.action_bar = '@android:layout/action_bar';\n        layout.alert_dialog = '@android:layout/alert_dialog';\n        layout.alert_dialog_progress = '@android:layout/alert_dialog_progress';\n        layout.popup_menu_item_layout = '@android:layout/popup_menu_item_layout';\n        layout.select_dialog = '@android:layout/select_dialog';\n        layout.select_dialog_item = '@android:layout/select_dialog_item';\n        layout.select_dialog_multichoice = '@android:layout/select_dialog_multichoice';\n        layout.select_dialog_singlechoice = '@android:layout/select_dialog_singlechoice';\n        layout.simple_spinner_dropdown_item = '@android:layout/simple_spinner_dropdown_item';\n        layout.simple_spinner_item = '@android:layout/simple_spinner_item';\n        layout.transient_notification = '@android:layout/transient_notification';\n        R.layout = layout;\n    })(R = android.R || (android.R = {}));\n})(android || (android = {}));\nvar androidui;\n(function (androidui) {\n    var attr;\n    (function (attr) {\n        class AttrValueParser {\n            static parseString(r, value, defValue = value) {\n                if (value == null)\n                    return defValue;\n                if (value.startsWith('@')) {\n                    try {\n                        return r.getString(value);\n                    }\n                    catch (e) {\n                        console.warn(e);\n                    }\n                }\n                return defValue;\n            }\n            static parseBoolean(r, value, defValue) {\n                if (value == null)\n                    return defValue;\n                if (value.startsWith('@')) {\n                    try {\n                        return r.getBoolean(value);\n                    }\n                    catch (e) {\n                        console.warn(e);\n                    }\n                }\n                if (value === 'false' || value === '0')\n                    return false;\n                else if (value === 'true' || value === '1' || value === '')\n                    return true;\n                return defValue;\n            }\n            static parseInt(r, value, defValue) {\n                if (value == null)\n                    return defValue;\n                if (value.startsWith('@')) {\n                    try {\n                        return r.getInteger(value);\n                    }\n                    catch (e) {\n                        console.warn(e);\n                    }\n                }\n                let v = parseInt(value);\n                if (isNaN(v))\n                    return defValue;\n                return v;\n            }\n            static parseFloat(r, value, defValue) {\n                if (value == null)\n                    return defValue;\n                if (value.startsWith('@')) {\n                    try {\n                        return r.getFloat(value);\n                    }\n                    catch (e) {\n                        console.warn(e);\n                    }\n                }\n                let v = parseFloat(value);\n                if (isNaN(v))\n                    return defValue;\n                if (value.endsWith('%'))\n                    v /= 100;\n                return v;\n            }\n            static parseColor(r, value, defValue) {\n                if (value == null)\n                    return defValue;\n                try {\n                    if (value.startsWith('@')) {\n                        return r.getColor(value);\n                    }\n                    else {\n                        return android.graphics.Color.parseColor(value);\n                    }\n                }\n                catch (e) {\n                    console.warn(e);\n                }\n                return defValue;\n            }\n            static parseColorStateList(r, value) {\n                if (value == null)\n                    return null;\n                if (value.startsWith('@')) {\n                    return r.getColorStateList(value);\n                }\n                else {\n                    try {\n                        let color = android.graphics.Color.parseColor(value);\n                        return android.content.res.ColorStateList.valueOf(color);\n                    }\n                    catch (e) {\n                        console.warn(e);\n                    }\n                }\n                return null;\n            }\n            static parseDimension(r, value, defValue, baseValue = 0) {\n                if (value == null)\n                    return defValue;\n                if (value.startsWith('@')) {\n                    try {\n                        return r.getDimension(value, baseValue);\n                    }\n                    catch (e) {\n                        console.warn(e);\n                        return defValue;\n                    }\n                }\n                try {\n                    return android.util.TypedValue.complexToDimension(value, baseValue);\n                }\n                catch (e) {\n                    console.warn(e);\n                }\n                return defValue;\n            }\n            static parseDimensionPixelOffset(r, value, defValue, baseValue = 0) {\n                if (value == null)\n                    return defValue;\n                if (value.startsWith('@')) {\n                    try {\n                        return r.getDimensionPixelOffset(value, baseValue);\n                    }\n                    catch (e) {\n                        console.warn(e);\n                        return defValue;\n                    }\n                }\n                try {\n                    return android.util.TypedValue.complexToDimensionPixelOffset(value, baseValue);\n                }\n                catch (e) {\n                    console.warn(e);\n                }\n                return defValue;\n            }\n            static parseDimensionPixelSize(r, value, defValue, baseValue = 0) {\n                if (value == null)\n                    return defValue;\n                if (value.startsWith('@')) {\n                    try {\n                        return r.getDimensionPixelSize(value);\n                    }\n                    catch (e) {\n                        console.warn(e);\n                        return defValue;\n                    }\n                }\n                try {\n                    return android.util.TypedValue.complexToDimensionPixelSize(value, baseValue);\n                }\n                catch (e) {\n                    console.warn(e);\n                }\n                return defValue;\n            }\n            static parseDrawable(r, value) {\n                if (value == null)\n                    return null;\n                if (value.startsWith('@')) {\n                    try {\n                        return r.getDrawable(value);\n                    }\n                    catch (e) {\n                        console.warn(e);\n                    }\n                }\n                else if (value.startsWith('url(')) {\n                    value = value.substring('url('.length);\n                    if (value.endsWith(')'))\n                        value = value.substring(0, value.length - 1);\n                    return new androidui.image.NetDrawable(value);\n                }\n                else {\n                    try {\n                        let color = android.graphics.Color.parseColor(value);\n                        return new android.graphics.drawable.ColorDrawable(color);\n                    }\n                    catch (e) {\n                    }\n                }\n                return null;\n            }\n            static parseTextArray(r, value) {\n                if (value == null)\n                    return null;\n                if (value.startsWith('@')) {\n                    return r.getStringArray(value);\n                }\n                else {\n                    try {\n                        let json = JSON.parse(value);\n                        if (json instanceof Array)\n                            return json;\n                    }\n                    catch (e) {\n                    }\n                }\n                return null;\n            }\n        }\n        attr.AttrValueParser = AttrValueParser;\n    })(attr = androidui.attr || (androidui.attr = {}));\n})(androidui || (androidui = {}));\nvar android;\n(function (android) {\n    var content;\n    (function (content) {\n        var res;\n        (function (res_1) {\n            var AttrValueParser = androidui.attr.AttrValueParser;\n            class TypedArray {\n                constructor(res, attrMap) {\n                    this.mResources = res;\n                    this.attrMap = attrMap;\n                }\n                static obtain(res, xml, defStyleAttr) {\n                    const attrMap = new Map();\n                    if (defStyleAttr) {\n                        for (let [key, value] of defStyleAttr.entries()) {\n                            attrMap.set(key.toLowerCase(), value);\n                        }\n                    }\n                    if (xml) {\n                        const refStyleString = xml.getAttribute('android:style');\n                        if (refStyleString) {\n                            const map = res.getStyleAsMap(refStyleString);\n                            if (map) {\n                                for (let [key, value] of map.entries()) {\n                                    attrMap.set(key.toLowerCase(), value);\n                                }\n                            }\n                        }\n                        for (let attr of Array.from(xml.attributes)) {\n                            const name = attr.name;\n                            if (name === 'android:style' || name === 'style')\n                                continue;\n                            attrMap.set(name, attr.value);\n                        }\n                    }\n                    const attrs = res.mTypedArrayPool.acquire();\n                    if (attrs != null) {\n                        attrs.mRecycled = false;\n                        attrs.attrMap = attrMap;\n                        attrs.attrMapKeysCache = [];\n                        return attrs;\n                    }\n                    return new TypedArray(res, attrMap);\n                }\n                checkRecycled() {\n                    if (this.mRecycled) {\n                        throw new Error(\"RuntimeException : Cannot make calls to a recycled instance!\");\n                    }\n                }\n                length() {\n                    this.checkRecycled();\n                    if (!this.attrMap)\n                        return 0;\n                    return this.attrMap.size;\n                }\n                getIndex(keyIndex) {\n                    if (!this.attrMapKeysCache) {\n                        this.attrMapKeysCache = Array.from(this.attrMap.keys());\n                    }\n                    return this.attrMapKeysCache[keyIndex];\n                }\n                getLowerCaseNoNamespaceAttrNames() {\n                    const keys = [];\n                    for (let key of this.attrMap.keys()) {\n                        keys.push(key.split(':').pop());\n                    }\n                    return keys;\n                }\n                getResources() {\n                    return this.mResources;\n                }\n                getAttrValue(attrName) {\n                    const name = attrName.toLowerCase();\n                    return this.attrMap && (this.attrMap.get(name) || this.attrMap.get('android:' + name));\n                }\n                getResourceId(attrName, defaultResourceId) {\n                    if (this.hasValueOrEmpty(attrName)) {\n                        return this.getAttrValue(attrName);\n                    }\n                    return defaultResourceId;\n                }\n                getText(attrName) {\n                    return this.getString(attrName);\n                }\n                getString(attrName) {\n                    this.checkRecycled();\n                    let value = this.getAttrValue(attrName);\n                    return AttrValueParser.parseString(this.mResources, value, value);\n                }\n                getBoolean(attrName, defValue) {\n                    this.checkRecycled();\n                    let value = this.getAttrValue(attrName);\n                    return AttrValueParser.parseBoolean(this.mResources, value, defValue);\n                }\n                getInt(attrName, defValue) {\n                    this.checkRecycled();\n                    let value = this.getAttrValue(attrName);\n                    return AttrValueParser.parseInt(this.mResources, value, defValue);\n                }\n                getFloat(attrName, defValue) {\n                    this.checkRecycled();\n                    let value = this.getAttrValue(attrName);\n                    return AttrValueParser.parseFloat(this.mResources, value, defValue);\n                }\n                getColor(attrName, defValue) {\n                    this.checkRecycled();\n                    let value = this.getAttrValue(attrName);\n                    return AttrValueParser.parseColor(this.mResources, value, defValue);\n                }\n                getColorStateList(attrName) {\n                    this.checkRecycled();\n                    let value = this.getAttrValue(attrName);\n                    return AttrValueParser.parseColorStateList(this.mResources, value);\n                }\n                getInteger(attrName, defValue) {\n                    return this.getInt(attrName, defValue);\n                }\n                getLayoutDimension(attrName, defValue) {\n                    this.checkRecycled();\n                    let value = this.getAttrValue(attrName);\n                    if (value === 'wrap_content')\n                        return -2;\n                    if (value === 'fill_parent' || value === 'match_parent')\n                        return -1;\n                    return AttrValueParser.parseDimension(this.mResources, value, defValue);\n                }\n                getDimension(attrName, defValue) {\n                    this.checkRecycled();\n                    let value = this.getAttrValue(attrName);\n                    return AttrValueParser.parseDimension(this.mResources, value, defValue);\n                }\n                getDimensionPixelOffset(attrName, defValue) {\n                    this.checkRecycled();\n                    let value = this.getAttrValue(attrName);\n                    return AttrValueParser.parseDimensionPixelOffset(this.mResources, value, defValue);\n                }\n                getDimensionPixelSize(attrName, defValue) {\n                    this.checkRecycled();\n                    let value = this.getAttrValue(attrName);\n                    return AttrValueParser.parseDimensionPixelSize(this.mResources, value, defValue);\n                }\n                getDrawable(attrName) {\n                    this.checkRecycled();\n                    let value = this.getAttrValue(attrName);\n                    return AttrValueParser.parseDrawable(this.mResources, value);\n                }\n                getTextArray(attrName) {\n                    this.checkRecycled();\n                    let value = this.getAttrValue(attrName);\n                    return AttrValueParser.parseTextArray(this.mResources, value);\n                }\n                hasValue(attrName) {\n                    this.checkRecycled();\n                    return this.getAttrValue(attrName) != null;\n                }\n                hasValueOrEmpty(attrName) {\n                    this.checkRecycled();\n                    const name = attrName.toLowerCase();\n                    return this.attrMap && (this.attrMap.has(name) || this.attrMap.has('android:' + name));\n                }\n                recycle() {\n                    this.mRecycled = true;\n                    this.attrMap = null;\n                    this.attrMapKeysCache = null;\n                    this.mResources.mTypedArrayPool.release(this);\n                }\n            }\n            res_1.TypedArray = TypedArray;\n        })(res = content.res || (content.res = {}));\n    })(content = android.content || (android.content = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var content;\n    (function (content) {\n        var res;\n        (function (res) {\n            var DisplayMetrics = android.util.DisplayMetrics;\n            var Drawable = android.graphics.drawable.Drawable;\n            var Color = android.graphics.Color;\n            var SynchronizedPool = android.util.Pools.SynchronizedPool;\n            var ColorDrawable = android.graphics.drawable.ColorDrawable;\n            class Resources {\n                constructor(context) {\n                    this.mTypedArrayPool = new SynchronizedPool(5);\n                    this.context = context;\n                    window.addEventListener('resize', () => {\n                        if (this.displayMetrics) {\n                            this.fillDisplayMetrics(this.displayMetrics);\n                        }\n                    });\n                }\n                static getSystem() {\n                    return Resources.instance;\n                }\n                static from(context) {\n                    return context.getResources();\n                }\n                static getDisplayMetrics() {\n                    return Resources.instance.getDisplayMetrics();\n                }\n                getDisplayMetrics() {\n                    if (this.displayMetrics)\n                        return this.displayMetrics;\n                    this.displayMetrics = new DisplayMetrics();\n                    this.fillDisplayMetrics(this.displayMetrics);\n                    return this.displayMetrics;\n                }\n                fillDisplayMetrics(displayMetrics) {\n                    let density = window.devicePixelRatio;\n                    displayMetrics.xdpi = window.screen.deviceXDPI || DisplayMetrics.DENSITY_DEFAULT;\n                    displayMetrics.ydpi = window.screen.deviceYDPI || DisplayMetrics.DENSITY_DEFAULT;\n                    displayMetrics.density = density;\n                    displayMetrics.densityDpi = density * DisplayMetrics.DENSITY_DEFAULT;\n                    displayMetrics.scaledDensity = density;\n                    let contentEle = this.context ? this.context.androidUI.androidUIElement : document.documentElement;\n                    displayMetrics.widthPixels = contentEle.offsetWidth * density;\n                    displayMetrics.heightPixels = contentEle.offsetHeight * density;\n                }\n                getDefStyle(refString) {\n                    if (refString === '@null')\n                        return null;\n                    if (refString.startsWith('@android:attr/')) {\n                        refString = refString.substring('@android:attr/'.length);\n                        return android.R.attr[refString];\n                    }\n                }\n                getDrawable(refString) {\n                    if (refString === '@null')\n                        return null;\n                    if (refString.startsWith('@android:drawable/')) {\n                        refString = refString.substring('@android:drawable/'.length);\n                        return android.R.drawable[refString] || android.R.image[refString];\n                    }\n                    if (refString.startsWith('@android:color/')) {\n                        refString = refString.substring('@android:color/'.length);\n                        let color = android.R.color[refString];\n                        if (color instanceof res.ColorStateList) {\n                            color = color.getDefaultColor();\n                        }\n                        return new ColorDrawable(color);\n                    }\n                    if (Resources._AppBuildImageFileFinder) {\n                        let drawable = Resources._AppBuildImageFileFinder(refString);\n                        if (drawable)\n                            return drawable;\n                    }\n                    if (!refString.startsWith('@')) {\n                        refString = '@drawable/' + refString;\n                    }\n                    let ele = this.getXml(refString);\n                    if (ele) {\n                        return Drawable.createFromXml(this, ele);\n                    }\n                    ele = this.getValue(refString);\n                    if (ele) {\n                        let text = ele.innerText;\n                        if (text.startsWith('@android:drawable/') || text.startsWith('@drawable/')) {\n                            return this.getDrawable(text);\n                        }\n                        if (text.startsWith('@android:color/') || text.startsWith('@color/')) {\n                            let color = this.getColor(text);\n                            return new ColorDrawable(color);\n                        }\n                        return Drawable.createFromXml(this, ele);\n                    }\n                    throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n                }\n                getColor(refString) {\n                    if (refString.startsWith('@android:color/')) {\n                        refString = refString.substring('@android:color/'.length);\n                        let color = android.R.color[refString];\n                        if (color instanceof res.ColorStateList) {\n                            color = color.getDefaultColor();\n                        }\n                        return color;\n                    }\n                    else {\n                        if (!refString.startsWith('@color/')) {\n                            refString = '@color/' + refString;\n                        }\n                        let ele = this.getValue(refString);\n                        if (ele) {\n                            let text = ele.innerText;\n                            if (text.startsWith('@android:color/') || text.startsWith('@color/')) {\n                                return this.getColor(text);\n                            }\n                            return Color.parseColor(text);\n                        }\n                        ele = this.getXml(refString);\n                        if (ele) {\n                            let colorList = res.ColorStateList.createFromXml(this, ele);\n                            if (colorList)\n                                return colorList.getDefaultColor();\n                        }\n                    }\n                    throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n                }\n                getColorStateList(refString) {\n                    if (refString === '@null')\n                        return null;\n                    if (refString.startsWith('@android:color/')) {\n                        refString = refString.substring('@android:color/'.length);\n                        let color = android.R.color[refString];\n                        if (typeof color === \"number\") {\n                            color = res.ColorStateList.valueOf(color);\n                        }\n                        return color;\n                    }\n                    else {\n                        if (!refString.startsWith('@color/')) {\n                            refString = '@color/' + refString;\n                        }\n                        let ele = this.getXml(refString);\n                        if (ele) {\n                            return res.ColorStateList.createFromXml(this, ele);\n                        }\n                        ele = this.getValue(refString);\n                        if (ele) {\n                            let text = ele.innerText;\n                            if (text.startsWith('@android:color/') || text.startsWith('@color/')) {\n                                return this.getColorStateList(text);\n                            }\n                            return res.ColorStateList.valueOf(Color.parseColor(text));\n                        }\n                    }\n                    throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n                }\n                getDimension(refString, baseValue = 0) {\n                    if (!refString.startsWith('@dimen/'))\n                        refString = '@dimen/' + refString;\n                    let ele = this.getValue(refString);\n                    if (ele) {\n                        let text = ele.innerText;\n                        return android.util.TypedValue.complexToDimension(text, baseValue, this.getDisplayMetrics());\n                    }\n                    throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n                }\n                getDimensionPixelOffset(refString, baseValue = 0) {\n                    if (!refString.startsWith('@dimen/'))\n                        refString = '@dimen/' + refString;\n                    let ele = this.getValue(refString);\n                    if (ele) {\n                        let text = ele.innerText;\n                        return android.util.TypedValue.complexToDimensionPixelOffset(text, baseValue, this.getDisplayMetrics());\n                    }\n                    throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n                }\n                getDimensionPixelSize(refString, baseValue = 0) {\n                    if (!refString.startsWith('@dimen/'))\n                        refString = '@dimen/' + refString;\n                    let ele = this.getValue(refString);\n                    if (ele) {\n                        let text = ele.innerText;\n                        return android.util.TypedValue.complexToDimensionPixelSize(text, baseValue, this.getDisplayMetrics());\n                    }\n                    throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n                }\n                getBoolean(refString) {\n                    if (!refString.startsWith('@bool/'))\n                        refString = '@bool/' + refString;\n                    let ele = this.getValue(refString);\n                    if (ele) {\n                        let text = ele.innerText;\n                        return text == 'true';\n                    }\n                    throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n                }\n                getInteger(refString) {\n                    if (!refString.startsWith('@integer/'))\n                        refString = '@integer/' + refString;\n                    let ele = this.getValue(refString);\n                    if (ele) {\n                        return parseInt(ele.innerText);\n                    }\n                    throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n                }\n                getIntArray(refString) {\n                    if (!refString.startsWith('@array/'))\n                        refString = '@array/' + refString;\n                    let ele = this.getValue(refString);\n                    if (ele) {\n                        let intArray = [];\n                        for (let child of Array.from(ele.children)) {\n                            intArray.push(parseInt(child.innerText));\n                        }\n                        return intArray;\n                    }\n                    throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n                }\n                getFloat(refString) {\n                    return this.getDimension(refString);\n                }\n                getString(refString) {\n                    if (refString.startsWith('@android:string/')) {\n                        refString = refString.substring('@android:string/'.length);\n                        return android.R.string_[refString];\n                    }\n                    if (!refString.startsWith('@string/'))\n                        refString = '@string/' + refString;\n                    let ele = this.getValue(refString);\n                    if (ele) {\n                        return ele.innerText;\n                    }\n                    throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n                }\n                getStringArray(refString) {\n                    if (!refString.startsWith('@array/'))\n                        refString = '@array/' + refString;\n                    let ele = this.getValue(refString);\n                    if (ele) {\n                        let stringArray = [];\n                        for (let child of Array.from(ele.children)) {\n                            stringArray.push(child.innerText);\n                        }\n                        return stringArray;\n                    }\n                    throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n                }\n                getLayout(refString) {\n                    if (!refString || !refString.trim().startsWith('@'))\n                        return null;\n                    if (refString === '@null')\n                        return null;\n                    if (refString.startsWith('@android:layout/')) {\n                        refString = refString.substring('@android:layout/'.length);\n                        return android.R.layout.getLayoutData(refString);\n                    }\n                    if (!refString.startsWith('@layout/'))\n                        refString = '@layout/' + refString;\n                    let ele = this.getXml(refString);\n                    if (ele)\n                        return ele;\n                    throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n                }\n                getAnimation(refString) {\n                    if (refString === '@null')\n                        return null;\n                    if (!refString || !refString.trim().startsWith('@'))\n                        return null;\n                    if (refString.startsWith('@android:anim/')) {\n                        refString = refString.substring('@android:anim/'.length);\n                        return android.R.anim[refString];\n                    }\n                }\n                getStyleAsMap(refString) {\n                    if (refString === '@null')\n                        return null;\n                    if (!refString.startsWith('@style/')) {\n                        refString = '@style/' + refString;\n                    }\n                    let styleMap = new Map();\n                    const parseStyle = (refString) => {\n                        let styleXml = this.getValue(refString);\n                        if (!styleXml)\n                            return;\n                        let parent = styleXml.getAttribute('parent');\n                        if (parent) {\n                            if (!parent.startsWith('@style/')) {\n                                parent = '@style/' + parent;\n                            }\n                            parseStyle(parent);\n                        }\n                        let styleName = refString.substring('@style/'.length);\n                        if (styleName.includes('.')) {\n                            let parts = styleName.split('.');\n                            parts.shift();\n                            let nameParent = parts.join('.');\n                            parseStyle('@style/' + nameParent);\n                        }\n                        for (let item of Array.from(styleXml.children)) {\n                            let name = item.getAttribute('name');\n                            if (name) {\n                                styleMap.set(name, item.innerText);\n                            }\n                        }\n                    };\n                    parseStyle(refString);\n                    return styleMap;\n                }\n                getXml(refString) {\n                    if (refString === '@null')\n                        return null;\n                    if (Resources._AppBuildXmlFinder)\n                        return Resources._AppBuildXmlFinder(refString);\n                }\n                getValue(refString, resolveRefs = true) {\n                    if (refString === '@null')\n                        return null;\n                    if (Resources._AppBuildValueFinder) {\n                        let ele = Resources._AppBuildValueFinder(refString);\n                        if (!ele)\n                            return null;\n                        if (resolveRefs && ele.children.length == 0) {\n                            let str = ele.innerText;\n                            if (str.startsWith('@')) {\n                                return this.getValue(refString, true) || ele;\n                            }\n                        }\n                        return ele;\n                    }\n                }\n                obtainAttributes(attrs) {\n                    return res.TypedArray.obtain(this, attrs);\n                }\n                obtainStyledAttributes(attrs, defStyleAttr) {\n                    return res.TypedArray.obtain(this, attrs, defStyleAttr);\n                }\n            }\n            Resources.instance = new Resources();\n            Resources._AppBuildImageFileFinder = null;\n            Resources._AppBuildXmlFinder = null;\n            Resources._AppBuildValueFinder = null;\n            res.Resources = Resources;\n        })(res = content.res || (content.res = {}));\n    })(content = android.content || (android.content = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        class ViewConfiguration {\n            constructor() {\n                this.density = android.content.res.Resources.getDisplayMetrics().density;\n                this.sizeAndDensity = this.density;\n                this.mEdgeSlop = this.sizeAndDensity * ViewConfiguration.EDGE_SLOP;\n                this.mFadingEdgeLength = this.sizeAndDensity * ViewConfiguration.FADING_EDGE_LENGTH;\n                this.mMinimumFlingVelocity = this.density * ViewConfiguration.MINIMUM_FLING_VELOCITY;\n                this.mMaximumFlingVelocity = this.density * ViewConfiguration.MAXIMUM_FLING_VELOCITY;\n                this.mScrollbarSize = this.density * ViewConfiguration.SCROLL_BAR_SIZE;\n                this.mTouchSlop = this.density * ViewConfiguration.TOUCH_SLOP;\n                this.mDoubleTapTouchSlop = this.sizeAndDensity * ViewConfiguration.DOUBLE_TAP_TOUCH_SLOP;\n                this.mPagingTouchSlop = this.density * ViewConfiguration.PAGING_TOUCH_SLOP;\n                this.mDoubleTapSlop = this.density * ViewConfiguration.DOUBLE_TAP_SLOP;\n                this.mWindowTouchSlop = this.sizeAndDensity * ViewConfiguration.WINDOW_TOUCH_SLOP;\n                this.mOverscrollDistance = this.sizeAndDensity * ViewConfiguration.OVERSCROLL_DISTANCE;\n                this.mOverflingDistance = this.sizeAndDensity * ViewConfiguration.OVERFLING_DISTANCE;\n                this.mMaximumDrawingCacheSize = android.content.res.Resources.getDisplayMetrics().widthPixels\n                    * android.content.res.Resources.getDisplayMetrics().heightPixels * 4 * 2;\n            }\n            static get(arg) {\n                if (!ViewConfiguration.instance) {\n                    ViewConfiguration.instance = new ViewConfiguration();\n                }\n                return ViewConfiguration.instance;\n            }\n            getScaledScrollBarSize() {\n                return this.mScrollbarSize;\n            }\n            static getScrollBarFadeDuration() {\n                return ViewConfiguration.SCROLL_BAR_FADE_DURATION;\n            }\n            static getScrollDefaultDelay() {\n                return ViewConfiguration.SCROLL_BAR_DEFAULT_DELAY;\n            }\n            getScaledFadingEdgeLength() {\n                return this.mFadingEdgeLength;\n            }\n            static getPressedStateDuration() {\n                return ViewConfiguration.PRESSED_STATE_DURATION;\n            }\n            static getLongPressTimeout() {\n                return ViewConfiguration.DEFAULT_LONG_PRESS_TIMEOUT;\n            }\n            static getKeyRepeatDelay() {\n                return ViewConfiguration.KEY_REPEAT_DELAY;\n            }\n            static getTapTimeout() {\n                return ViewConfiguration.TAP_TIMEOUT;\n            }\n            static getJumpTapTimeout() {\n                return ViewConfiguration.JUMP_TAP_TIMEOUT;\n            }\n            static getDoubleTapTimeout() {\n                return ViewConfiguration.DOUBLE_TAP_TIMEOUT;\n            }\n            static getDoubleTapMinTime() {\n                return ViewConfiguration.DOUBLE_TAP_MIN_TIME;\n            }\n            getScaledEdgeSlop() {\n                return this.mEdgeSlop;\n            }\n            getScaledTouchSlop() {\n                return this.mTouchSlop;\n            }\n            getScaledDoubleTapTouchSlop() {\n                return this.mDoubleTapTouchSlop;\n            }\n            getScaledPagingTouchSlop() {\n                return this.mPagingTouchSlop;\n            }\n            getScaledDoubleTapSlop() {\n                return this.mDoubleTapSlop;\n            }\n            getScaledWindowTouchSlop() {\n                return this.mWindowTouchSlop;\n            }\n            getScaledMinimumFlingVelocity() {\n                return this.mMinimumFlingVelocity;\n            }\n            getScaledMaximumFlingVelocity() {\n                return this.mMaximumFlingVelocity;\n            }\n            getScaledMaximumDrawingCacheSize() {\n                return this.mMaximumDrawingCacheSize;\n            }\n            getScaledOverscrollDistance() {\n                return this.mOverscrollDistance;\n            }\n            getScaledOverflingDistance() {\n                return this.mOverflingDistance;\n            }\n            static getScrollFriction() {\n                return ViewConfiguration.SCROLL_FRICTION;\n            }\n        }\n        ViewConfiguration.SCROLL_BAR_SIZE = 8;\n        ViewConfiguration.SCROLL_BAR_FADE_DURATION = 250;\n        ViewConfiguration.SCROLL_BAR_DEFAULT_DELAY = 300;\n        ViewConfiguration.FADING_EDGE_LENGTH = 12;\n        ViewConfiguration.PRESSED_STATE_DURATION = 64;\n        ViewConfiguration.DEFAULT_LONG_PRESS_TIMEOUT = 500;\n        ViewConfiguration.KEY_REPEAT_DELAY = 50;\n        ViewConfiguration.GLOBAL_ACTIONS_KEY_TIMEOUT = 500;\n        ViewConfiguration.TAP_TIMEOUT = 180;\n        ViewConfiguration.JUMP_TAP_TIMEOUT = 500;\n        ViewConfiguration.DOUBLE_TAP_TIMEOUT = 300;\n        ViewConfiguration.DOUBLE_TAP_MIN_TIME = 40;\n        ViewConfiguration.HOVER_TAP_TIMEOUT = 150;\n        ViewConfiguration.HOVER_TAP_SLOP = 20;\n        ViewConfiguration.ZOOM_CONTROLS_TIMEOUT = 3000;\n        ViewConfiguration.EDGE_SLOP = 12;\n        ViewConfiguration.TOUCH_SLOP = 8;\n        ViewConfiguration.DOUBLE_TAP_TOUCH_SLOP = ViewConfiguration.TOUCH_SLOP;\n        ViewConfiguration.PAGING_TOUCH_SLOP = ViewConfiguration.TOUCH_SLOP * 2;\n        ViewConfiguration.DOUBLE_TAP_SLOP = 100;\n        ViewConfiguration.WINDOW_TOUCH_SLOP = 16;\n        ViewConfiguration.MINIMUM_FLING_VELOCITY = 50;\n        ViewConfiguration.MAXIMUM_FLING_VELOCITY = 8000;\n        ViewConfiguration.SCROLL_FRICTION = 0.015;\n        ViewConfiguration.OVERSCROLL_DISTANCE = 800;\n        ViewConfiguration.OVERFLING_DISTANCE = 100;\n        view.ViewConfiguration = ViewConfiguration;\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var os;\n    (function (os) {\n        class SystemClock {\n            static uptimeMillis() {\n                return new Date().getTime();\n            }\n        }\n        os.SystemClock = SystemClock;\n    })(os = android.os || (android.os = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var Rect = android.graphics.Rect;\n        var ViewConfiguration = android.view.ViewConfiguration;\n        const tempBound = new Rect();\n        const ID_FixID_Cache = [];\n        const tmpTouchEvent = {\n            touches: null,\n            changedTouches: null,\n            type: null\n        };\n        function fixEventId(e) {\n            for (let i = 0, length = e.changedTouches.length; i < length; i++) {\n                fixTouchId(e.changedTouches[i]);\n            }\n            for (let i = 0, length = e.touches.length; i < length; i++) {\n                fixTouchId(e.touches[i]);\n            }\n            if (e.type == 'touchend' || e.type == 'touchcancel') {\n                ID_FixID_Cache[e.changedTouches[0].id_fix] = null;\n            }\n            tmpTouchEvent.type = e.type;\n            tmpTouchEvent.changedTouches = Array.from(e.changedTouches).map((touch) => fixTouchId(touch));\n            tmpTouchEvent.touches = Array.from(e.touches).map((touch) => fixTouchId(touch));\n            return tmpTouchEvent;\n        }\n        function fixTouchId(touch) {\n            let originID = touch['identifier'];\n            let fix_id = ID_FixID_Cache.indexOf(originID);\n            if (fix_id < 0) {\n                for (let i = 0, length = ID_FixID_Cache.length + 1; i < length; i++) {\n                    if (ID_FixID_Cache[i] == null) {\n                        ID_FixID_Cache[i] = originID;\n                        fix_id = i;\n                        break;\n                    }\n                }\n            }\n            return {\n                id_fix: fix_id,\n                target: touch.target,\n                screenX: touch.screenX,\n                screenY: touch.screenY,\n                clientX: touch.clientX,\n                clientY: touch.clientY,\n                pageX: touch.pageX,\n                pageY: touch.pageY,\n                mEventTime: touch.mEventTime,\n            };\n        }\n        class MotionEvent {\n            constructor() {\n                this.mAction = 0;\n                this.mEdgeFlags = 0;\n                this.mDownTime = 0;\n                this.mEventTime = 0;\n                this.mActivePointerId = 0;\n                this.mXOffset = 0;\n                this.mYOffset = 0;\n                this._axisValues = new Map();\n            }\n            static obtainWithTouchEvent(e, action) {\n                let event = new MotionEvent();\n                event.initWithTouch(e, action);\n                return event;\n            }\n            static obtain(event) {\n                let newEv = new MotionEvent();\n                Object.assign(newEv, event);\n                return newEv;\n            }\n            static obtainWithAction(downTime, eventTime, action, x, y, metaState = 0) {\n                let newEv = new MotionEvent();\n                newEv.mAction = action;\n                newEv.mDownTime = downTime;\n                newEv.mEventTime = eventTime;\n                let touch = {\n                    id_fix: 0,\n                    target: null,\n                    screenX: x,\n                    screenY: y,\n                    clientX: x,\n                    clientY: y,\n                    pageX: x,\n                    pageY: y\n                };\n                newEv.mTouchingPointers = [touch];\n                return newEv;\n            }\n            initWithTouch(event, baseAction, windowBound = new Rect()) {\n                let e = fixEventId(event);\n                let now = android.os.SystemClock.uptimeMillis();\n                let action = baseAction;\n                let actionIndex = -1;\n                let activeTouch = e.changedTouches[0];\n                this._activeTouch = activeTouch;\n                let activePointerId = activeTouch.id_fix;\n                if (activePointerId == null)\n                    console.warn('activePointerId null, activeTouch.identifier: ' + activeTouch['identifier']);\n                for (let i = 0, length = e.touches.length; i < length; i++) {\n                    if (e.touches[i].id_fix === activePointerId) {\n                        actionIndex = i;\n                        MotionEvent.IdIndexCache.set(activePointerId, i);\n                        break;\n                    }\n                }\n                if (actionIndex < 0 && (baseAction === MotionEvent.ACTION_UP || baseAction === MotionEvent.ACTION_CANCEL)) {\n                    actionIndex = MotionEvent.IdIndexCache.get(activePointerId);\n                }\n                if (actionIndex < 0)\n                    throw Error('not find action index');\n                switch (baseAction) {\n                    case MotionEvent.ACTION_DOWN:\n                    case MotionEvent.ACTION_UP:\n                        MotionEvent.TouchMoveRecord.set(activePointerId, []);\n                        break;\n                    case MotionEvent.ACTION_MOVE:\n                        let moveHistory = MotionEvent.TouchMoveRecord.get(activePointerId);\n                        if (moveHistory) {\n                            activeTouch.mEventTime = now;\n                            moveHistory.push(activeTouch);\n                            if (moveHistory.length > MotionEvent.HistoryMaxSize)\n                                moveHistory.shift();\n                        }\n                        break;\n                }\n                this.mTouchingPointers = Array.from(e.touches);\n                if (baseAction === MotionEvent.ACTION_UP || baseAction === MotionEvent.ACTION_CANCEL) {\n                    this.mTouchingPointers.splice(actionIndex, 0, activeTouch);\n                }\n                if (this.mTouchingPointers.length > 1) {\n                    switch (action) {\n                        case MotionEvent.ACTION_DOWN:\n                            action = MotionEvent.ACTION_POINTER_DOWN;\n                            action = actionIndex << MotionEvent.ACTION_POINTER_INDEX_SHIFT | action;\n                            break;\n                        case MotionEvent.ACTION_UP:\n                            action = MotionEvent.ACTION_POINTER_UP;\n                            action = actionIndex << MotionEvent.ACTION_POINTER_INDEX_SHIFT | action;\n                            break;\n                    }\n                }\n                this.mAction = action;\n                this.mActivePointerId = activePointerId;\n                if (action == MotionEvent.ACTION_DOWN) {\n                    this.mDownTime = now;\n                }\n                this.mEventTime = now;\n                const density = android.content.res.Resources.getSystem().getDisplayMetrics().density;\n                this.mXOffset = this.mYOffset = 0;\n                let edgeFlag = 0;\n                let unScaledX = activeTouch.pageX;\n                let unScaledY = activeTouch.pageY;\n                let edgeSlop = ViewConfiguration.EDGE_SLOP;\n                tempBound.set(windowBound);\n                tempBound.right = tempBound.left + edgeSlop;\n                if (tempBound.contains(unScaledX, unScaledY)) {\n                    edgeFlag |= MotionEvent.EDGE_LEFT;\n                }\n                tempBound.set(windowBound);\n                tempBound.bottom = tempBound.top + edgeSlop;\n                if (tempBound.contains(unScaledX, unScaledY)) {\n                    edgeFlag |= MotionEvent.EDGE_TOP;\n                }\n                tempBound.set(windowBound);\n                tempBound.left = tempBound.right - edgeSlop;\n                if (tempBound.contains(unScaledX, unScaledY)) {\n                    edgeFlag |= MotionEvent.EDGE_RIGHT;\n                }\n                tempBound.set(windowBound);\n                tempBound.top = tempBound.bottom - edgeSlop;\n                if (tempBound.contains(unScaledX, unScaledY)) {\n                    edgeFlag |= MotionEvent.EDGE_BOTTOM;\n                }\n                this.mEdgeFlags = edgeFlag;\n            }\n            initWithMouseWheel(e) {\n                this.mAction = MotionEvent.ACTION_SCROLL;\n                this.mActivePointerId = 0;\n                let touch = {\n                    id_fix: 0,\n                    target: null,\n                    screenX: e.screenX,\n                    screenY: e.screenY,\n                    clientX: e.clientX,\n                    clientY: e.clientY,\n                    pageX: e.pageX,\n                    pageY: e.pageY\n                };\n                this.mTouchingPointers = [touch];\n                this.mDownTime = this.mEventTime = android.os.SystemClock.uptimeMillis();\n                this.mXOffset = this.mYOffset = 0;\n                this._axisValues.clear();\n                this._axisValues.set(MotionEvent.AXIS_VSCROLL, -e.deltaY);\n                this._axisValues.set(MotionEvent.AXIS_HSCROLL, -e.deltaX);\n            }\n            recycle() {\n            }\n            getAction() {\n                return this.mAction;\n            }\n            getActionMasked() {\n                return this.mAction & MotionEvent.ACTION_MASK;\n            }\n            getActionIndex() {\n                return (this.mAction & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;\n            }\n            getDownTime() {\n                return this.mDownTime;\n            }\n            getEventTime() {\n                return this.mEventTime;\n            }\n            getX(pointerIndex = 0) {\n                let density = android.content.res.Resources.getDisplayMetrics().density;\n                return (this.mTouchingPointers[pointerIndex].pageX) * density + this.mXOffset;\n            }\n            getY(pointerIndex = 0) {\n                let density = android.content.res.Resources.getDisplayMetrics().density;\n                return (this.mTouchingPointers[pointerIndex].pageY) * density + this.mYOffset;\n            }\n            getPointerCount() {\n                return this.mTouchingPointers.length;\n            }\n            getPointerId(pointerIndex) {\n                return this.mTouchingPointers[pointerIndex].id_fix;\n            }\n            findPointerIndex(pointerId) {\n                for (let i = 0, length = this.mTouchingPointers.length; i < length; i++) {\n                    if (this.mTouchingPointers[i].id_fix === pointerId) {\n                        return i;\n                    }\n                }\n                return -1;\n            }\n            getRawX() {\n                let density = android.content.res.Resources.getDisplayMetrics().density;\n                return (this.mTouchingPointers[0].pageX) * density;\n            }\n            getRawY() {\n                let density = android.content.res.Resources.getDisplayMetrics().density;\n                return (this.mTouchingPointers[0].pageY) * density;\n            }\n            getHistorySize(id = this.mActivePointerId) {\n                let moveHistory = MotionEvent.TouchMoveRecord.get(id);\n                return moveHistory ? moveHistory.length : 0;\n            }\n            getHistoricalX(pointerIndex, pos) {\n                let density = android.content.res.Resources.getDisplayMetrics().density;\n                let moveHistory = MotionEvent.TouchMoveRecord.get(this.mTouchingPointers[pointerIndex].id_fix);\n                return (moveHistory[pos].pageX) * density + this.mXOffset;\n            }\n            getHistoricalY(pointerIndex, pos) {\n                let density = android.content.res.Resources.getDisplayMetrics().density;\n                let moveHistory = MotionEvent.TouchMoveRecord.get(this.mTouchingPointers[pointerIndex].id_fix);\n                return (moveHistory[pos].pageY) * density + this.mYOffset;\n            }\n            getHistoricalEventTime(...args) {\n                let pos, activePointerId;\n                if (args.length === 1) {\n                    pos = args[0];\n                    activePointerId = this.mActivePointerId;\n                }\n                else {\n                    pos = args[1];\n                    activePointerId = this.getPointerId(args[0]);\n                }\n                let moveHistory = MotionEvent.TouchMoveRecord.get(activePointerId);\n                return moveHistory[pos].mEventTime;\n            }\n            getTouchMajor(pointerIndex) {\n                return Math.floor(android.content.res.Resources.getDisplayMetrics().density);\n            }\n            getHistoricalTouchMajor(pointerIndex, pos) {\n                return Math.floor(android.content.res.Resources.getDisplayMetrics().density);\n            }\n            getEdgeFlags() {\n                return this.mEdgeFlags;\n            }\n            setEdgeFlags(flags) {\n                this.mEdgeFlags = flags;\n            }\n            setAction(action) {\n                this.mAction = action;\n            }\n            isTouchEvent() {\n                let action = this.getActionMasked();\n                switch (action) {\n                    case MotionEvent.ACTION_DOWN:\n                    case MotionEvent.ACTION_UP:\n                    case MotionEvent.ACTION_MOVE:\n                    case MotionEvent.ACTION_CANCEL:\n                    case MotionEvent.ACTION_OUTSIDE:\n                    case MotionEvent.ACTION_POINTER_DOWN:\n                    case MotionEvent.ACTION_POINTER_UP:\n                        return true;\n                }\n                return false;\n            }\n            isPointerEvent() {\n                return true;\n            }\n            offsetLocation(deltaX, deltaY) {\n                this.mXOffset += deltaX;\n                this.mYOffset += deltaY;\n            }\n            setLocation(x, y) {\n                this.mXOffset = x - this.getRawX();\n                this.mYOffset = y - this.getRawY();\n            }\n            getPointerIdBits() {\n                let idBits = 0;\n                let pointerCount = this.getPointerCount();\n                for (let i = 0; i < pointerCount; i++) {\n                    idBits |= 1 << this.getPointerId(i);\n                }\n                return idBits;\n            }\n            split(idBits) {\n                let ev = MotionEvent.obtain(this);\n                let oldPointerCount = this.getPointerCount();\n                const oldAction = this.getAction();\n                const oldActionMasked = oldAction & MotionEvent.ACTION_MASK;\n                let newPointerIds = [];\n                for (let i = 0; i < oldPointerCount; i++) {\n                    let pointerId = this.getPointerId(i);\n                    let idBit = 1 << pointerId;\n                    if ((idBit & idBits) != 0) {\n                        newPointerIds.push(pointerId);\n                    }\n                }\n                let newActionPointerIndex = newPointerIds.indexOf(this.mActivePointerId);\n                let newPointerCount = newPointerIds.length;\n                let newAction;\n                if (oldActionMasked == MotionEvent.ACTION_POINTER_DOWN || oldActionMasked == MotionEvent.ACTION_POINTER_UP) {\n                    if (newActionPointerIndex < 0) {\n                        newAction = MotionEvent.ACTION_MOVE;\n                    }\n                    else if (newPointerCount == 1) {\n                        newAction = oldActionMasked == MotionEvent.ACTION_POINTER_DOWN\n                            ? MotionEvent.ACTION_DOWN : MotionEvent.ACTION_UP;\n                    }\n                    else {\n                        newAction = oldActionMasked | (newActionPointerIndex << MotionEvent.ACTION_POINTER_INDEX_SHIFT);\n                    }\n                }\n                else {\n                    newAction = oldAction;\n                }\n                ev.mAction = newAction;\n                ev.mTouchingPointers = this.mTouchingPointers.filter((item) => {\n                    return newPointerIds.indexOf(item.id_fix) >= 0;\n                });\n                return ev;\n            }\n            getAxisValue(axis) {\n                let value = this._axisValues.get(axis);\n                return value ? value : 0;\n            }\n            toString() {\n                return \"MotionEvent{action=\" + this.getAction() + \" x=\" + this.getX()\n                    + \" y=\" + this.getY() + \"}\";\n            }\n        }\n        MotionEvent.INVALID_POINTER_ID = -1;\n        MotionEvent.ACTION_MASK = 0xff;\n        MotionEvent.ACTION_DOWN = 0;\n        MotionEvent.ACTION_UP = 1;\n        MotionEvent.ACTION_MOVE = 2;\n        MotionEvent.ACTION_CANCEL = 3;\n        MotionEvent.ACTION_OUTSIDE = 4;\n        MotionEvent.ACTION_POINTER_DOWN = 5;\n        MotionEvent.ACTION_POINTER_UP = 6;\n        MotionEvent.ACTION_HOVER_MOVE = 7;\n        MotionEvent.ACTION_SCROLL = 8;\n        MotionEvent.ACTION_HOVER_ENTER = 9;\n        MotionEvent.ACTION_HOVER_EXIT = 10;\n        MotionEvent.EDGE_TOP = 0x00000001;\n        MotionEvent.EDGE_BOTTOM = 0x00000002;\n        MotionEvent.EDGE_LEFT = 0x00000004;\n        MotionEvent.EDGE_RIGHT = 0x00000008;\n        MotionEvent.ACTION_POINTER_INDEX_MASK = 0xff00;\n        MotionEvent.ACTION_POINTER_INDEX_SHIFT = 8;\n        MotionEvent.AXIS_VSCROLL = 9;\n        MotionEvent.AXIS_HSCROLL = 10;\n        MotionEvent.HistoryMaxSize = 10;\n        MotionEvent.TouchMoveRecord = new Map();\n        MotionEvent.IdIndexCache = new Map();\n        view.MotionEvent = MotionEvent;\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var Rect = android.graphics.Rect;\n        class TouchDelegate {\n            constructor(bounds, delegateView) {\n                this.mDelegateTargeted = false;\n                this.mSlop = 0;\n                this.mBounds = bounds;\n                this.mSlop = view.ViewConfiguration.get().getScaledTouchSlop();\n                this.mSlopBounds = new Rect(bounds);\n                this.mSlopBounds.inset(-this.mSlop, -this.mSlop);\n                this.mDelegateView = delegateView;\n            }\n            onTouchEvent(event) {\n                let x = event.getX();\n                let y = event.getY();\n                let sendToDelegate = false;\n                let hit = true;\n                let handled = false;\n                switch (event.getAction()) {\n                    case view.MotionEvent.ACTION_DOWN:\n                        let bounds = this.mBounds;\n                        if (bounds.contains(x, y)) {\n                            this.mDelegateTargeted = true;\n                            sendToDelegate = true;\n                        }\n                        break;\n                    case view.MotionEvent.ACTION_UP:\n                    case view.MotionEvent.ACTION_MOVE:\n                        sendToDelegate = this.mDelegateTargeted;\n                        if (sendToDelegate) {\n                            let slopBounds = this.mSlopBounds;\n                            if (!slopBounds.contains(x, y)) {\n                                hit = false;\n                            }\n                        }\n                        break;\n                    case view.MotionEvent.ACTION_CANCEL:\n                        sendToDelegate = this.mDelegateTargeted;\n                        this.mDelegateTargeted = false;\n                        break;\n                }\n                if (sendToDelegate) {\n                    let delegateView = this.mDelegateView;\n                    if (hit) {\n                        event.setLocation(delegateView.getWidth() / 2, delegateView.getHeight() / 2);\n                    }\n                    else {\n                        let slop = this.mSlop;\n                        event.setLocation(-(slop * 2), -(slop * 2));\n                    }\n                    handled = delegateView.dispatchTouchEvent(event);\n                }\n                return handled;\n            }\n        }\n        view.TouchDelegate = TouchDelegate;\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var os;\n    (function (os) {\n        var StringBuilder = java.lang.StringBuilder;\n        var Pools = android.util.Pools;\n        class Message {\n            constructor() {\n                this.mType = Message.Type_Normal;\n                this.what = 0;\n                this.arg1 = 0;\n                this.arg2 = 0;\n                this.when = 0;\n            }\n            static obtain(...args) {\n                let m = Message.sPool.acquire();\n                m = m || new Message();\n                if (args.length === 1) {\n                    if (args[0] instanceof Message) {\n                        let orig = args[0];\n                        [m.target, m.what, m.arg1, m.arg2, m.obj, m.callback] =\n                            [orig.target, orig.what, orig.arg1, orig.arg2, orig.obj, orig.callback];\n                    }\n                    else if (args[0] instanceof os.Handler) {\n                        m.target = args[0];\n                    }\n                    else {\n                        throw new Error('unknown args');\n                    }\n                }\n                else if (args.length === 2) {\n                    m.target = args[0];\n                    if (typeof args[1] === 'number')\n                        m.what = args[1];\n                    else\n                        m.callback = args[1];\n                }\n                else if (args.length === 3) {\n                    [m.target, m.what, m.obj] = args;\n                }\n                else if (args.length === 4) {\n                    [m.target, m.what, m.arg1, m.arg2] = args;\n                }\n                else {\n                    [m.target, m.what, m.arg1 = 0, m.arg2, m.obj, m.callback] = args;\n                }\n                return m;\n            }\n            recycle() {\n                this.clearForRecycle();\n                Message.sPool.release(this);\n            }\n            copyFrom(o) {\n                this.mType = o.mType;\n                this.what = o.what;\n                this.arg1 = o.arg1;\n                this.arg2 = o.arg2;\n                this.obj = o.obj;\n            }\n            setTarget(target) {\n                this.target = target;\n            }\n            getTarget() {\n                return this.target;\n            }\n            sendToTarget() {\n                this.target.sendMessage(this);\n            }\n            clearForRecycle() {\n                this.mType = Message.Type_Normal;\n                this.what = 0;\n                this.arg1 = 0;\n                this.arg2 = 0;\n                this.obj = null;\n                this.when = 0;\n                this.target = null;\n                this.callback = null;\n            }\n            toString(now = os.SystemClock.uptimeMillis()) {\n                let b = new StringBuilder();\n                b.append(\"{ what=\");\n                b.append(this.what);\n                b.append(\" when=\");\n                b.append(this.when - now).append(\"ms\");\n                if (this.arg1 != 0) {\n                    b.append(\" arg1=\");\n                    b.append(this.arg1);\n                }\n                if (this.arg2 != 0) {\n                    b.append(\" arg2=\");\n                    b.append(this.arg2);\n                }\n                if (this.obj != null) {\n                    b.append(\" obj=\");\n                    b.append(this.obj);\n                }\n                b.append(\" }\");\n                return b.toString();\n            }\n        }\n        Message.Type_Normal = 0;\n        Message.Type_Traversal = 1;\n        Message.sPool = new Pools.SynchronizedPool(10);\n        os.Message = Message;\n    })(os = android.os || (android.os = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var os;\n    (function (os) {\n        var requestAnimationFrame = window[\"requestAnimationFrame\"] ||\n            window[\"webkitRequestAnimationFrame\"] ||\n            window[\"mozRequestAnimationFrame\"] ||\n            window[\"oRequestAnimationFrame\"] ||\n            window[\"msRequestAnimationFrame\"];\n        if (!requestAnimationFrame) {\n            requestAnimationFrame = function (callback) {\n                return window.setTimeout(callback, 1000 / 60);\n            };\n        }\n        if (!window.requestAnimationFrame)\n            window.requestAnimationFrame = requestAnimationFrame;\n        class MessageQueue {\n            static getMessages(h, args, object) {\n                let msgs = [];\n                if (h == null) {\n                    return msgs;\n                }\n                if (typeof args === \"number\") {\n                    let what = args;\n                    for (let p of MessageQueue.messages) {\n                        if (p.target == h && p.what == what && (object == null || p.obj == object)) {\n                            msgs.push(p);\n                        }\n                    }\n                }\n                else {\n                    let r = args;\n                    for (let p of MessageQueue.messages) {\n                        if (p.target == h && p.callback == r && (object == null || p.obj == object)) {\n                            msgs.push(p);\n                        }\n                    }\n                }\n                return msgs;\n            }\n            static hasMessages(h, args, object) {\n                return MessageQueue.getMessages(h, args, object).length > 0;\n            }\n            static enqueueMessage(msg, when) {\n                if (msg.target == null) {\n                    throw new Error(\"Message must have a target.\");\n                }\n                msg.when = when;\n                MessageQueue.messages.add(msg);\n                MessageQueue.checkLoop();\n                return true;\n            }\n            static recycleMessage(handler, message) {\n                message.recycle();\n                MessageQueue.messages.delete(message);\n            }\n            static removeMessages(h, args, object) {\n                let p = MessageQueue.getMessages(h, args, object);\n                if (p && p.length > 0) {\n                    for (let item of p) {\n                        MessageQueue.recycleMessage(h, item);\n                    }\n                }\n            }\n            static removeCallbacksAndMessages(h, object) {\n                if (h == null) {\n                    return;\n                }\n                for (let p of MessageQueue.messages) {\n                    if (p != null && p.target == h && (object == null || p.obj == object)) {\n                        MessageQueue.recycleMessage(h, p);\n                    }\n                }\n            }\n            static checkLoop() {\n                if (!MessageQueue._loopActive) {\n                    MessageQueue._loopActive = true;\n                    MessageQueue.requestNextLoop();\n                }\n            }\n            static requestNextLoop() {\n                requestAnimationFrame(MessageQueue.loop);\n            }\n            static loop() {\n                let normalMessages = [];\n                let traversalMessages = [];\n                const now = os.SystemClock.uptimeMillis();\n                for (let msg of MessageQueue.messages) {\n                    if (msg.when <= now) {\n                        if (msg.mType === os.Message.Type_Traversal)\n                            traversalMessages.push(msg);\n                        else\n                            normalMessages.push(msg);\n                    }\n                }\n                for (let i = 0, length = normalMessages.length; i < length; i++) {\n                    MessageQueue.dispatchMessage(normalMessages[i]);\n                }\n                for (let i = 0, length = traversalMessages.length; i < length; i++) {\n                    MessageQueue.dispatchMessage(traversalMessages[i]);\n                }\n                if (MessageQueue.messages.size > 0)\n                    MessageQueue.requestNextLoop();\n                else\n                    MessageQueue._loopActive = false;\n            }\n            static dispatchMessage(msg) {\n                if (MessageQueue.messages.has(msg)) {\n                    MessageQueue.messages.delete(msg);\n                    msg.target.dispatchMessage(msg);\n                    MessageQueue.recycleMessage(msg.target, msg);\n                }\n            }\n        }\n        MessageQueue.messages = new Set();\n        MessageQueue._loopActive = false;\n        os.MessageQueue = MessageQueue;\n    })(os = android.os || (android.os = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var os;\n    (function (os) {\n        class Handler {\n            constructor(callback) {\n                this.mCallback = callback;\n            }\n            handleMessage(msg) {\n            }\n            dispatchMessage(msg) {\n                if (msg.callback != null) {\n                    msg.callback.run();\n                }\n                else {\n                    if (this.mCallback != null) {\n                        if (this.mCallback.handleMessage(msg)) {\n                            return;\n                        }\n                    }\n                    this.handleMessage(msg);\n                }\n            }\n            obtainMessage(...args) {\n                if (args.length === 2) {\n                    let [what, obj] = args;\n                    return os.Message.obtain(this, what, obj);\n                }\n                else {\n                    let [what, arg1, arg2, obj] = args;\n                    return os.Message.obtain(this, what, arg1, arg2, obj);\n                }\n            }\n            post(r) {\n                return this.sendMessageDelayed(Handler.getPostMessage(r), 0);\n            }\n            postAsTraversal(r) {\n                let msg = Handler.getPostMessage(r);\n                msg.mType = os.Message.Type_Traversal;\n                return this.sendMessageDelayed(msg, 0);\n            }\n            postAtTime(...args) {\n                if (args.length === 2) {\n                    let [r, uptimeMillis] = args;\n                    return this.sendMessageAtTime(Handler.getPostMessage(r), uptimeMillis);\n                }\n                else {\n                    let [r, token, uptimeMillis] = args;\n                    return this.sendMessageAtTime(Handler.getPostMessage(r, token), uptimeMillis);\n                }\n            }\n            postDelayed(r, delayMillis) {\n                return this.sendMessageDelayed(Handler.getPostMessage(r), delayMillis);\n            }\n            postAtFrontOfQueue(r) {\n                return this.post(r);\n            }\n            removeCallbacks(r, token) {\n                os.MessageQueue.removeMessages(this, r, token);\n            }\n            sendMessage(msg) {\n                return this.sendMessageDelayed(msg, 0);\n            }\n            sendEmptyMessage(what) {\n                return this.sendEmptyMessageDelayed(what, 0);\n            }\n            sendEmptyMessageDelayed(what, delayMillis) {\n                let msg = os.Message.obtain();\n                msg.what = what;\n                return this.sendMessageDelayed(msg, delayMillis);\n            }\n            sendEmptyMessageAtTime(what, uptimeMillis) {\n                let msg = os.Message.obtain();\n                msg.what = what;\n                return this.sendMessageAtTime(msg, uptimeMillis);\n            }\n            sendMessageDelayed(msg, delayMillis) {\n                if (delayMillis < 0) {\n                    delayMillis = 0;\n                }\n                return this.sendMessageAtTime(msg, os.SystemClock.uptimeMillis() + delayMillis);\n            }\n            sendMessageAtTime(msg, uptimeMillis) {\n                msg.target = this;\n                return os.MessageQueue.enqueueMessage(msg, uptimeMillis);\n            }\n            sendMessageAtFrontOfQueue(msg) {\n                return this.sendMessage(msg);\n            }\n            removeMessages(what, object) {\n                os.MessageQueue.removeMessages(this, what, object);\n            }\n            removeCallbacksAndMessages(token) {\n                os.MessageQueue.removeCallbacksAndMessages(this, token);\n            }\n            hasMessages(what, object) {\n                return os.MessageQueue.hasMessages(this, what, object);\n            }\n            static getPostMessage(r, token) {\n                let m = os.Message.obtain();\n                m.obj = token;\n                m.callback = r;\n                return m;\n            }\n        }\n        os.Handler = Handler;\n    })(os = android.os || (android.os = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var content;\n    (function (content) {\n        var res;\n        (function (res) {\n            var SparseArray = android.util.SparseArray;\n            var StateSet = android.util.StateSet;\n            var WeakReference = java.lang.ref.WeakReference;\n            var Color = android.graphics.Color;\n            class ColorStateList {\n                constructor(states, colors) {\n                    this.mDefaultColor = 0xffff0000;\n                    this.mStateSpecs = states;\n                    this.mColors = colors;\n                    if (states && states.length > 0) {\n                        this.mDefaultColor = colors[0];\n                        for (let i = 0; i < states.length; i++) {\n                            if (states[i].length == 0) {\n                                this.mDefaultColor = colors[i];\n                            }\n                        }\n                    }\n                }\n                static valueOf(color) {\n                    let ref = ColorStateList.sCache.get(color);\n                    let csl = ref != null ? ref.get() : null;\n                    if (csl != null) {\n                        return csl;\n                    }\n                    csl = new ColorStateList(ColorStateList.EMPTY, [color]);\n                    ColorStateList.sCache.put(color, new WeakReference(csl));\n                    return csl;\n                }\n                static createFromXml(r, parser) {\n                    let colorStateList;\n                    let name = parser.tagName.toLowerCase();\n                    if (name == \"selector\") {\n                        const stateSpecList = [];\n                        const colorList = [];\n                        for (let child of Array.from(parser.children)) {\n                            let item = child;\n                            if (item.tagName.toLowerCase() !== 'item') {\n                                continue;\n                            }\n                            let alpha = 1.0;\n                            let color = 0xffff0000;\n                            let haveColor = false;\n                            let stateSpec = [];\n                            let typedArray = r.obtainAttributes(item);\n                            for (let attr of Array.from(item.attributes)) {\n                                let attrName = attr.name;\n                                if (attrName === 'android:alpha') {\n                                    alpha = typedArray.getFloat(attrName, alpha);\n                                }\n                                else if (attrName === 'android:color') {\n                                    color = typedArray.getColor(attrName, color);\n                                    haveColor = true;\n                                }\n                                else if (attrName.startsWith('android:state_')) {\n                                    let state = attrName.substring('android:state_'.length);\n                                    let stateValue = android.view.View['VIEW_STATE_' + state.toUpperCase()];\n                                    if (typeof stateValue === \"number\") {\n                                        stateSpec.push(typedArray.getBoolean(attrName, true) ? stateValue : -stateValue);\n                                    }\n                                }\n                            }\n                            if (!haveColor) {\n                                throw new Error(`<item> tag requires a 'android:color' attribute.`);\n                            }\n                            let alphaMod = Math.floor(Color.alpha(color) * alpha);\n                            alphaMod = Math.min(alphaMod, 255);\n                            alphaMod = Math.max(alphaMod, 0);\n                            color = (color & 0xFFFFFF) | (alphaMod << 24);\n                            colorList.push(color);\n                            stateSpecList.push(stateSpec);\n                        }\n                        colorStateList = new ColorStateList(stateSpecList, colorList);\n                    }\n                    else {\n                        throw new Error(`XmlPullParserException(invalid drawable tag: ${name}`);\n                    }\n                    return colorStateList;\n                }\n                withAlpha(alpha) {\n                    let colors = androidui.util.ArrayCreator.newNumberArray(this.mColors.length);\n                    let len = colors.length;\n                    for (let i = 0; i < len; i++) {\n                        colors[i] = (this.mColors[i] & 0xFFFFFF) | (alpha << 24);\n                    }\n                    return new ColorStateList(this.mStateSpecs, colors);\n                }\n                isStateful() {\n                    return this.mStateSpecs.length > 1;\n                }\n                getColorForState(stateSet, defaultColor) {\n                    const setLength = this.mStateSpecs.length;\n                    for (let i = 0; i < setLength; i++) {\n                        let stateSpec = this.mStateSpecs[i];\n                        if (StateSet.stateSetMatches(stateSpec, stateSet)) {\n                            return this.mColors[i];\n                        }\n                    }\n                    return defaultColor;\n                }\n                getDefaultColor() {\n                    return this.mDefaultColor;\n                }\n                toString() {\n                    return \"ColorStateList{\" +\n                        \"mStateSpecs=\" + JSON.stringify(this.mStateSpecs) +\n                        \"mColors=\" + JSON.stringify(this.mColors) +\n                        \"mDefaultColor=\" + this.mDefaultColor + '}';\n                }\n            }\n            ColorStateList.EMPTY = [[]];\n            ColorStateList.sCache = new SparseArray();\n            res.ColorStateList = ColorStateList;\n        })(res = content.res || (content.res = {}));\n    })(content = android.content || (android.content = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var util;\n    (function (util) {\n        class TypedValue {\n            static initUnit() {\n                this.initUnit = null;\n                let temp = document.createElement('div');\n                document.body.appendChild(temp);\n                temp.style.height = 100 + TypedValue.COMPLEX_UNIT_PT;\n                TypedValue.UNIT_SCALE_MAP.set(TypedValue.COMPLEX_UNIT_PT, temp.offsetHeight / 100);\n                temp.style.height = 1 + TypedValue.COMPLEX_UNIT_IN;\n                TypedValue.UNIT_SCALE_MAP.set(TypedValue.COMPLEX_UNIT_IN, temp.offsetHeight);\n                temp.style.height = 100 + TypedValue.COMPLEX_UNIT_MM;\n                TypedValue.UNIT_SCALE_MAP.set(TypedValue.COMPLEX_UNIT_MM, temp.offsetHeight / 100);\n                temp.style.height = 10 + TypedValue.COMPLEX_UNIT_EM;\n                TypedValue.UNIT_SCALE_MAP.set(TypedValue.COMPLEX_UNIT_EM, temp.offsetHeight / 10);\n                temp.style.height = 10 + TypedValue.COMPLEX_UNIT_REM;\n                TypedValue.UNIT_SCALE_MAP.set(TypedValue.COMPLEX_UNIT_REM, temp.offsetHeight / 10);\n                document.body.removeChild(temp);\n            }\n            static applyDimension(unit, size, dm) {\n                let scale = 1;\n                if (unit === TypedValue.COMPLEX_UNIT_DP || unit === TypedValue.COMPLEX_UNIT_DIP || unit === TypedValue.COMPLEX_UNIT_SP) {\n                    scale = dm.density;\n                }\n                else {\n                    scale = TypedValue.UNIT_SCALE_MAP.get(unit) || 1;\n                }\n                return size * scale;\n            }\n            static isDynamicUnitValue(valueWithUnit) {\n                if (typeof valueWithUnit != \"string\")\n                    return false;\n                return valueWithUnit.match(`${TypedValue.COMPLEX_UNIT_VH}$|${TypedValue.COMPLEX_UNIT_VW}$|${TypedValue.COMPLEX_UNIT_FRACTION}$`) != null;\n            }\n            static complexToDimension(valueWithUnit, baseValue = 0, metrics = android.content.res.Resources.getDisplayMetrics()) {\n                if (this.initUnit)\n                    this.initUnit();\n                if (valueWithUnit === undefined || valueWithUnit === null) {\n                    throw Error('complexToDimensionPixelSize error: valueWithUnit is ' + valueWithUnit);\n                }\n                if (valueWithUnit === '' + (Number.parseFloat(valueWithUnit)))\n                    return Number.parseFloat(valueWithUnit);\n                if (typeof valueWithUnit !== 'string')\n                    valueWithUnit = valueWithUnit + \"\";\n                let scale = 1;\n                if (valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_PX)) {\n                    valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_PX, \"\");\n                }\n                else if (valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_DP)) {\n                    valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_DP, \"\");\n                    scale = metrics.density;\n                }\n                else if (valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_DIP)) {\n                    valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_DIP, \"\");\n                    scale = metrics.density;\n                }\n                else if (valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_SP)) {\n                    valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_SP, \"\");\n                    scale = metrics.density * (TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_SP) || 1);\n                }\n                else if (valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_PT)) {\n                    valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_PT, \"\");\n                    scale = TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_PT) || 1;\n                }\n                else if (valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_IN)) {\n                    valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_IN, \"\");\n                    scale = TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_IN) || 1;\n                }\n                else if (valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_MM)) {\n                    valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_MM, \"\");\n                    scale = TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_MM) || 1;\n                }\n                else if (valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_EM)) {\n                    valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_EM, \"\");\n                    scale = TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_EM) || 1;\n                }\n                else if (valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_REM)) {\n                    valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_REM, \"\");\n                    scale = TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_REM) || 1;\n                }\n                else if (valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_VH)) {\n                    valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_VH, \"\");\n                    scale = metrics.heightPixels / 100;\n                }\n                else if (valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_VW)) {\n                    valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_VW, \"\");\n                    scale = metrics.widthPixels / 100;\n                }\n                else if (valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_FRACTION)) {\n                    valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_FRACTION, \"\");\n                    scale = Number.parseFloat(valueWithUnit) / 100;\n                    if (Number.isNaN(scale))\n                        return 0;\n                    valueWithUnit = baseValue;\n                }\n                let value = Number.parseFloat(valueWithUnit);\n                if (Number.isNaN(value))\n                    throw Error('complexToDimensionPixelSize error: ' + valueWithUnit);\n                return value * scale;\n            }\n            static complexToDimensionPixelOffset(valueWithUnit, baseValue = 0, metrics = android.content.res.Resources.getDisplayMetrics()) {\n                let value = this.complexToDimension(valueWithUnit, baseValue, metrics);\n                return Math.floor(value);\n            }\n            static complexToDimensionPixelSize(valueWithUnit, baseValue = 0, metrics = android.content.res.Resources.getDisplayMetrics()) {\n                let value = this.complexToDimension(valueWithUnit, baseValue, metrics);\n                let res = Math.ceil(value);\n                if (res != 0)\n                    return res;\n                if (value == 0)\n                    return 0;\n                if (value > 0)\n                    return 1;\n                return -1;\n            }\n        }\n        TypedValue.COMPLEX_UNIT_PX = 'px';\n        TypedValue.COMPLEX_UNIT_DP = 'dp';\n        TypedValue.COMPLEX_UNIT_DIP = 'dip';\n        TypedValue.COMPLEX_UNIT_SP = 'sp';\n        TypedValue.COMPLEX_UNIT_PT = 'pt';\n        TypedValue.COMPLEX_UNIT_IN = 'in';\n        TypedValue.COMPLEX_UNIT_MM = 'mm';\n        TypedValue.COMPLEX_UNIT_EM = 'em';\n        TypedValue.COMPLEX_UNIT_REM = 'rem';\n        TypedValue.COMPLEX_UNIT_VH = 'vh';\n        TypedValue.COMPLEX_UNIT_VW = 'vw';\n        TypedValue.COMPLEX_UNIT_FRACTION = '%';\n        TypedValue.UNIT_SCALE_MAP = new Map();\n        util.TypedValue = TypedValue;\n    })(util = android.util || (android.util = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var animation;\n        (function (animation) {\n            class LinearInterpolator {\n                getInterpolation(input) {\n                    return input;\n                }\n            }\n            animation.LinearInterpolator = LinearInterpolator;\n        })(animation = view.animation || (view.animation = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var animation;\n        (function (animation) {\n            var SystemClock = android.os.SystemClock;\n            class AnimationUtils {\n                static currentAnimationTimeMillis() {\n                    return SystemClock.uptimeMillis();\n                }\n                static loadAnimation(context, id) {\n                    return context.getResources().getAnimation(id);\n                }\n            }\n            animation.AnimationUtils = AnimationUtils;\n        })(animation = view.animation || (view.animation = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var util;\n    (function (util) {\n        class LayoutDirection {\n        }\n        LayoutDirection.LTR = 0;\n        LayoutDirection.RTL = 1;\n        LayoutDirection.INHERIT = 2;\n        LayoutDirection.LOCALE = 3;\n        util.LayoutDirection = LayoutDirection;\n    })(util = android.util || (android.util = {}));\n})(android || (android = {}));\nvar java;\n(function (java) {\n    var util;\n    (function (util) {\n        class Arrays {\n            static sort(a, fromIndex, toIndex) {\n                Arrays.rangeCheck(a.length, fromIndex, toIndex);\n                var sort = androidui.util.ArrayCreator.newNumberArray(toIndex - fromIndex);\n                for (let i = fromIndex; i < toIndex; i++) {\n                    sort[i - fromIndex] = a[i];\n                }\n                sort.sort((a, b) => {\n                    return a > b ? 1 : -1;\n                });\n                for (let i = fromIndex; i < toIndex; i++) {\n                    a[i] = sort[i - fromIndex];\n                }\n            }\n            static rangeCheck(arrayLength, fromIndex, toIndex) {\n                if (fromIndex > toIndex) {\n                    throw new Error(\"ArrayIndexOutOfBoundsException:fromIndex(\" + fromIndex + \") > toIndex(\" + toIndex + \")\");\n                }\n                if (fromIndex < 0) {\n                    throw new Error('ArrayIndexOutOfBoundsException:' + fromIndex);\n                }\n                if (toIndex > arrayLength) {\n                    throw new Error('ArrayIndexOutOfBoundsException:' + toIndex);\n                }\n            }\n            static asList(array) {\n                let list = new util.ArrayList();\n                list.array.push(...array);\n                return list;\n            }\n            static equals(a, a2) {\n                if (a == a2)\n                    return true;\n                if (a == null || a2 == null)\n                    return false;\n                let length = a.length;\n                if (a2.length != length)\n                    return false;\n                for (let i = 0; i < length; i++) {\n                    if (a[i] != a2[i])\n                        return false;\n                }\n                return true;\n            }\n        }\n        util.Arrays = Arrays;\n    })(util = java.util || (java.util = {}));\n})(java || (java = {}));\nvar androidui;\n(function (androidui) {\n    var attr;\n    (function (attr) {\n        class StateAttr {\n            constructor(state) {\n                this.attributes = new Map();\n                this.stateSpec = state.concat().sort();\n            }\n            clone() {\n                let stateAttr = new StateAttr(this.stateSpec);\n                stateAttr.attributes = new Map(this.attributes);\n                return stateAttr;\n            }\n            setAttr(name, value) {\n                this.attributes.set(name, value);\n            }\n            hasAttr(name) {\n                return this.attributes.has(name);\n            }\n            getAttrMap() {\n                return this.attributes;\n            }\n            putAll(stateAttr) {\n                for (let [key, value] of stateAttr.attributes.entries()) {\n                    this.attributes.set(key, value);\n                }\n            }\n            isDefaultState() {\n                return this.stateSpec.length === 0;\n            }\n            isStateEquals(state) {\n                if (!state)\n                    return false;\n                return java.util.Arrays.equals(this.stateSpec, state.concat().sort());\n            }\n            isStateMatch(state) {\n                return android.util.StateSet.stateSetMatches(this.stateSpec, state);\n            }\n            createDiffKeyAsNullValueAttrMap(another) {\n                if (!another)\n                    return this.attributes;\n                let removed = new Map(another.attributes);\n                for (let key of this.attributes.keys())\n                    removed.delete(key);\n                let merge = new Map(this.attributes);\n                for (let key of removed.keys())\n                    merge.set(key, null);\n                return merge;\n            }\n        }\n        attr.StateAttr = StateAttr;\n    })(attr = androidui.attr || (androidui.attr = {}));\n})(androidui || (androidui = {}));\nlet STATE_MAP;\nvar androidui;\n(function (androidui) {\n    var attr;\n    (function (attr) {\n        class StateAttrList {\n            constructor(view) {\n                this.originStateAttrList = [];\n                this.matchedStateAttrList = [];\n                this.mView = view;\n                this.getOrCreateStateAttr([]);\n            }\n            static getViewStateValue(attrName) {\n                if (!STATE_MAP) {\n                    STATE_MAP = new Map()\n                        .set('state_window_focused', android.view.View.VIEW_STATE_WINDOW_FOCUSED)\n                        .set('state_selected', android.view.View.VIEW_STATE_SELECTED)\n                        .set('state_focused', android.view.View.VIEW_STATE_FOCUSED)\n                        .set('state_enabled', android.view.View.VIEW_STATE_ENABLED)\n                        .set('state_disabled', -android.view.View.VIEW_STATE_ENABLED)\n                        .set('state_pressed', android.view.View.VIEW_STATE_PRESSED)\n                        .set('state_activated', android.view.View.VIEW_STATE_ACTIVATED)\n                        .set('state_hovered', android.view.View.VIEW_STATE_HOVERED)\n                        .set('state_checked', android.view.View.VIEW_STATE_CHECKED);\n                }\n                return STATE_MAP.get(attrName.split(':').pop());\n            }\n            addStatedAttr(attrName, attrValue) {\n                this.addStatedAttrImpl(attrName, attrValue, []);\n            }\n            addStatedAttrImpl(attrName, attrValue, inParseState) {\n                const stateValue = StateAttrList.getViewStateValue(attrName);\n                if (stateValue != null) {\n                    const newInParseState = inParseState.concat(stateValue).sort();\n                    let _stateAttr = this.getOrCreateStateAttr(newInParseState);\n                    if (attrValue.startsWith('@')) {\n                        let styleMap = this.mView.getResources().getStyleAsMap(attrValue);\n                        if (styleMap && styleMap.size > 0) {\n                            const statedEntries = [];\n                            for (let entry of styleMap.entries()) {\n                                const [key, value] = entry;\n                                if (key.startsWith('android:state_')) {\n                                    statedEntries.push(entry);\n                                }\n                                else {\n                                    _stateAttr.setAttr(key.toLowerCase(), value);\n                                }\n                            }\n                            for (let entry of statedEntries) {\n                                const [key, value] = entry;\n                                this.addStatedAttrImpl(key, value, newInParseState);\n                            }\n                        }\n                    }\n                    else {\n                        for (let part of attrValue.split(';')) {\n                            let [name, value] = part.split(':');\n                            name = name.trim();\n                            if (name) {\n                                _stateAttr.setAttr('android:' + name.toLowerCase(), value.trim());\n                            }\n                        }\n                    }\n                }\n            }\n            getStateAttr(state) {\n                for (let stateAttr of this.originStateAttrList) {\n                    if (stateAttr.isStateEquals(state))\n                        return stateAttr;\n                }\n            }\n            getOrCreateStateAttr(state) {\n                let stateAttr = this.getStateAttr(state);\n                if (!stateAttr) {\n                    stateAttr = new attr.StateAttr(state);\n                    this.originStateAttrList.push(stateAttr);\n                }\n                return stateAttr;\n            }\n            getMatchedStateAttr(state) {\n                if (state == null)\n                    return null;\n                for (let stateAttr of this.matchedStateAttrList) {\n                    if (stateAttr.isStateEquals(state))\n                        return stateAttr;\n                }\n                let matchedAttr = new attr.StateAttr(state);\n                for (let stateAttr of this.originStateAttrList) {\n                    if (stateAttr.isDefaultState())\n                        continue;\n                    if (stateAttr.isStateMatch(state)) {\n                        matchedAttr.putAll(stateAttr);\n                    }\n                }\n                this.matchedStateAttrList.push(matchedAttr);\n                return matchedAttr;\n            }\n            removeAttrAllState(attrName) {\n                for (let stateAttr of this.originStateAttrList) {\n                    stateAttr.getAttrMap().delete(attrName);\n                }\n                for (let stateAttr of this.matchedStateAttrList) {\n                    stateAttr.getAttrMap().delete(attrName);\n                }\n            }\n        }\n        attr.StateAttrList = StateAttrList;\n    })(attr = androidui.attr || (androidui.attr = {}));\n})(androidui || (androidui = {}));\nfunction fixDefaultNamespaceAndLowerCase(key) {\n    key = key.toLowerCase();\n    if (!key.includes(':'))\n        key = 'android:' + key;\n    return key;\n}\nvar androidui;\n(function (androidui) {\n    var attr;\n    (function (attr) {\n        var Gravity = android.view.Gravity;\n        var Drawable = android.graphics.drawable.Drawable;\n        var Color = android.graphics.Color;\n        var ColorStateList = android.content.res.ColorStateList;\n        var Resources = android.content.res.Resources;\n        class AttrBinder {\n            constructor(host) {\n                this.objectRefs = [];\n                this.host = host;\n            }\n            setClassAttrBind(classAttrBind) {\n                if (classAttrBind) {\n                    this.classAttrBindMap = classAttrBind;\n                }\n            }\n            addAttr(attrName, onAttrChange, stashAttrValueWhenStateChange) {\n                if (!attrName)\n                    return;\n                attrName = fixDefaultNamespaceAndLowerCase(attrName);\n                if (onAttrChange) {\n                    if (!this.attrChangeMap) {\n                        this.attrChangeMap = new Map();\n                    }\n                    this.attrChangeMap.set(attrName, onAttrChange);\n                }\n                if (stashAttrValueWhenStateChange) {\n                    this.attrStashMap = new Map();\n                    this.attrStashMap.set(attrName, stashAttrValueWhenStateChange);\n                }\n            }\n            onAttrChange(attrName, attrValue, context) {\n                this.mContext = context;\n                if (!attrName)\n                    return;\n                attrName = fixDefaultNamespaceAndLowerCase(attrName);\n                let onAttrChangeCall = this.attrChangeMap && this.attrChangeMap.get(attrName);\n                if (onAttrChangeCall) {\n                    onAttrChangeCall.call(this.host, attrValue, this.host);\n                }\n                if (this.classAttrBindMap) {\n                    this.classAttrBindMap.callSetter(attrName, this.host, attrValue, this);\n                }\n            }\n            getAttrValue(attrName) {\n                if (!attrName)\n                    return undefined;\n                attrName = fixDefaultNamespaceAndLowerCase(attrName);\n                let getAttrCall = this.attrStashMap && this.attrStashMap.get(attrName);\n                let value;\n                if (getAttrCall) {\n                    value = getAttrCall.call(this.host);\n                }\n                else if (this.classAttrBindMap) {\n                    value = this.classAttrBindMap.callGetter(attrName, this.host);\n                }\n                if (value == null)\n                    return null;\n                if (typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"string\")\n                    return value + '';\n                return this.setRefObject(value);\n            }\n            getRefObject(ref) {\n                if (ref && ref.startsWith('@ref/')) {\n                    ref = ref.substring('@ref/'.length);\n                    let index = Number.parseInt(ref);\n                    if (Number.isInteger(index)) {\n                        return this.objectRefs[index];\n                    }\n                }\n            }\n            setRefObject(obj) {\n                let index = this.objectRefs.indexOf(obj);\n                if (index >= 0)\n                    return '@ref/' + index;\n                this.objectRefs.push(obj);\n                return '@ref/' + (this.objectRefs.length - 1);\n            }\n            parsePaddingMarginTRBL(value) {\n                value = (value + '');\n                let parts = [];\n                for (let part of value.split(' ')) {\n                    if (part)\n                        parts.push(part);\n                }\n                let trbl;\n                switch (parts.length) {\n                    case 1:\n                        trbl = [parts[0], parts[0], parts[0], parts[0]];\n                        break;\n                    case 2:\n                        trbl = [parts[0], parts[1], parts[0], parts[1]];\n                        break;\n                    case 3:\n                        trbl = [parts[0], parts[1], parts[2], parts[1]];\n                        break;\n                    case 4:\n                        trbl = [parts[0], parts[1], parts[2], parts[3]];\n                        break;\n                }\n                if (trbl) {\n                    return trbl.map((v) => this.parseDimension(v));\n                }\n                throw Error('not a padding or margin value : ' + value);\n            }\n            parseEnum(value, enumMap, defaultValue) {\n                if (Number.isInteger(value)) {\n                    return value;\n                }\n                if (enumMap.has(value)) {\n                    return enumMap.get(value);\n                }\n                return defaultValue;\n            }\n            parseBoolean(value, defaultValue = true) {\n                if (value === false)\n                    return false;\n                else if (value === true)\n                    return true;\n                let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n                if (typeof value === \"string\") {\n                    return attr.AttrValueParser.parseBoolean(res, value, defaultValue);\n                }\n                return defaultValue;\n            }\n            parseGravity(s, defaultValue = Gravity.NO_GRAVITY) {\n                let gravity = Number.parseInt(s);\n                if (Number.isInteger(gravity))\n                    return gravity;\n                return Gravity.parseGravity(s, defaultValue);\n            }\n            parseDrawable(s) {\n                if (!s)\n                    return null;\n                if (s instanceof Drawable)\n                    return s;\n                if (s.startsWith('@ref/')) {\n                    let refObj = this.getRefObject(s);\n                    if (refObj)\n                        return refObj;\n                }\n                let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n                s = (s + '').trim();\n                return attr.AttrValueParser.parseDrawable(res, s);\n            }\n            parseColor(value, defaultValue) {\n                let color = Number.parseInt(value);\n                if (Number.isInteger(color))\n                    return color;\n                let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n                color = attr.AttrValueParser.parseColor(res, value, defaultValue);\n                if (isNaN(color)) {\n                    return Color.BLACK;\n                }\n                return color;\n            }\n            parseColorList(value) {\n                if (!value)\n                    return null;\n                if (value instanceof ColorStateList)\n                    return value;\n                if (typeof value == 'number')\n                    return ColorStateList.valueOf(value);\n                if (value.startsWith('@ref/')) {\n                    let refObj = this.getRefObject(value);\n                    if (refObj)\n                        return refObj;\n                }\n                let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n                return attr.AttrValueParser.parseColorStateList(res, value);\n            }\n            parseInt(value, defaultValue = 0) {\n                if (typeof value == 'number')\n                    return value;\n                let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n                return attr.AttrValueParser.parseInt(res, value, defaultValue);\n            }\n            parseFloat(value, defaultValue = 0) {\n                if (typeof value == 'number')\n                    return value;\n                let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n                return attr.AttrValueParser.parseFloat(res, value, defaultValue);\n            }\n            parseDimension(value, defaultValue = 0, baseValue = 0) {\n                if (typeof value == 'number')\n                    return value;\n                let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n                return attr.AttrValueParser.parseDimension(res, value, defaultValue, baseValue);\n            }\n            parseNumberPixelOffset(value, defaultValue = 0, baseValue = 0) {\n                if (typeof value == 'number')\n                    return value;\n                let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n                return attr.AttrValueParser.parseDimensionPixelOffset(res, value, defaultValue, baseValue);\n            }\n            parseNumberPixelSize(value, defaultValue = 0, baseValue = 0) {\n                if (typeof value == 'number')\n                    return value;\n                let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n                return attr.AttrValueParser.parseDimensionPixelSize(res, value, defaultValue, baseValue);\n            }\n            parseString(value, defaultValue) {\n                let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n                if (typeof value === 'string') {\n                    return attr.AttrValueParser.parseString(res, value, defaultValue);\n                }\n                return defaultValue;\n            }\n            parseStringArray(value) {\n                if (typeof value === 'string') {\n                    if (value.startsWith('@ref/')) {\n                        let refObj = this.getRefObject(value);\n                        if (refObj)\n                            return refObj;\n                    }\n                    let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n                    return attr.AttrValueParser.parseTextArray(res, value);\n                }\n                return null;\n            }\n        }\n        attr.AttrBinder = AttrBinder;\n        (function (AttrBinder) {\n            class ClassBinderMap {\n                constructor(copyBinderMap) {\n                    this.binderMap = new Map(copyBinderMap);\n                }\n                set(key, value) {\n                    key = fixDefaultNamespaceAndLowerCase(key);\n                    this.binderMap.set(key, value);\n                    return this;\n                }\n                get(key) {\n                    key = fixDefaultNamespaceAndLowerCase(key);\n                    return this.binderMap.get(key);\n                }\n                callSetter(attrName, host, attrValue, attrBinder) {\n                    if (!attrName)\n                        return;\n                    let value = this.get(attrName);\n                    if (value) {\n                        value.setter.call(host, host, attrValue, attrBinder);\n                    }\n                }\n                callGetter(attrName, host) {\n                    if (!attrName)\n                        return;\n                    let value = this.get(attrName);\n                    if (value) {\n                        return value.getter.call(host, host);\n                    }\n                }\n            }\n            AttrBinder.ClassBinderMap = ClassBinderMap;\n        })(AttrBinder = attr.AttrBinder || (attr.AttrBinder = {}));\n    })(attr = androidui.attr || (androidui.attr = {}));\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var util;\n    (function (util) {\n        var ColorDrawable = android.graphics.drawable.ColorDrawable;\n        var Color = android.graphics.Color;\n        class PerformanceAdjuster {\n            static noCanvasMode() {\n                android.graphics.Canvas.prototype = HackCanvas.prototype;\n                android.view.View.prototype.onDrawVerticalScrollBar =\n                    function (canvas, scrollBar, l, t, r, b) {\n                        let scrollBarEl = this.bindElement['VerticalScrollBar'];\n                        if (!scrollBarEl) {\n                            scrollBarEl = document.createElement('div');\n                            this.bindElement['VerticalScrollBar'] = scrollBarEl;\n                            scrollBarEl.style.zIndex = '9';\n                            scrollBarEl.style.position = 'absolute';\n                            scrollBarEl.style.background = 'black';\n                            scrollBarEl.style.left = '0px';\n                            scrollBarEl.style.top = '0px';\n                            this.bindElement.appendChild(scrollBarEl);\n                        }\n                        let height = b - t;\n                        let width = r - l;\n                        let size = height;\n                        let thickness = width;\n                        let extent = this.mScrollCache.scrollBar.mExtent;\n                        let range = this.mScrollCache.scrollBar.mRange;\n                        let length = Math.round(size * extent / range);\n                        let offset = Math.round((size - length) * this.mScrollCache.scrollBar.mOffset / (range - extent));\n                        if (t < 0)\n                            t = 0;\n                        if (offset < 0)\n                            offset = 0;\n                        scrollBarEl.style.transform = scrollBarEl.style.webkitTransform = `translate(${l}px, ${t + offset}px)`;\n                        scrollBarEl.style.width = (r - l) / 2 + 'px';\n                        scrollBarEl.style.height = length + 'px';\n                        scrollBarEl.style.opacity = this.mScrollCache.scrollBar.mVerticalThumb.getAlpha() / 255 + '';\n                    };\n                const oldSetBackground = android.view.View.prototype.setBackground;\n                android.view.View.prototype.setBackground = function (drawable) {\n                    oldSetBackground.call(this, drawable);\n                    if (drawable instanceof ColorDrawable) {\n                        this.bindElement.style.background = Color.toRGBAFunc(this.mBackground.getColor());\n                    }\n                };\n            }\n        }\n        util.PerformanceAdjuster = PerformanceAdjuster;\n        class HackCanvas extends android.graphics.Canvas {\n            init() {\n            }\n            recycle() {\n            }\n            translate(dx, dy) {\n            }\n            scale(sx, sy, px, py) {\n            }\n            rotate(degrees, px, py) {\n            }\n            drawRGB(r, g, b) {\n            }\n            drawARGB(a, r, g, b) {\n            }\n            drawColor(color) {\n            }\n            clearColor() {\n            }\n            save() {\n                return 1;\n            }\n            restore() {\n            }\n            restoreToCount(saveCount) {\n            }\n            getSaveCount() {\n                return 1;\n            }\n            clipRect(...args) {\n                return false;\n            }\n            getClipBounds(bounds) {\n                return null;\n            }\n            quickReject(...args) {\n                return false;\n            }\n            drawCanvas(canvas, offsetX, offsetY) {\n            }\n            drawRect(...args) {\n            }\n            drawText(text, x, y, paint) {\n            }\n        }\n    })(util = androidui.util || (androidui.util = {}));\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var image;\n    (function (image_1) {\n        var Paint = android.graphics.Paint;\n        var Rect = android.graphics.Rect;\n        var Drawable = android.graphics.drawable.Drawable;\n        class NetDrawable extends Drawable {\n            constructor(src, paint, overrideImageRatio) {\n                super();\n                this.mImageWidth = 0;\n                this.mImageHeight = 0;\n                let image;\n                if (src instanceof image_1.NetImage) {\n                    image = src;\n                    if (overrideImageRatio)\n                        image.mOverrideImageRatio = overrideImageRatio;\n                }\n                else {\n                    image = new image_1.NetImage(src, overrideImageRatio);\n                }\n                image.addLoadListener(() => this.onLoad(), () => this.onError());\n                this.mState = new State(image, paint);\n                if (image.isImageLoaded())\n                    this.initBoundWithLoadedImage(image);\n            }\n            initBoundWithLoadedImage(image) {\n                let imageRatio = image.getImageRatio();\n                this.mImageWidth = Math.floor(image.width / imageRatio * android.content.res.Resources.getDisplayMetrics().density);\n                this.mImageHeight = Math.floor(image.height / imageRatio * android.content.res.Resources.getDisplayMetrics().density);\n            }\n            setURL(url, hiddenWhenLoading = true) {\n                if (hiddenWhenLoading) {\n                    this.mImageWidth = this.mImageHeight = 0;\n                }\n                this.mState.mImage.src = url;\n            }\n            draw(canvas) {\n                if (!this.isImageSizeEmpty()) {\n                    let emptyTileX = this.mTileModeX == null || this.mTileModeX == NetDrawable.TileMode.DEFAULT;\n                    let emptyTileY = this.mTileModeY == null || this.mTileModeY == NetDrawable.TileMode.DEFAULT;\n                    if (emptyTileX && emptyTileY) {\n                        canvas.drawImage(this.mState.mImage, null, this.getBounds(), this.mState.paint);\n                    }\n                    else {\n                        this.drawTile(canvas);\n                    }\n                }\n            }\n            drawTile(canvas) {\n                let imageWidth = this.mImageWidth;\n                let imageHeight = this.mImageHeight;\n                if (imageHeight <= 0 || imageWidth <= 0)\n                    return;\n                let tileX = this.mTileModeX;\n                let tileY = this.mTileModeY;\n                let bound = this.getBounds();\n                if (this.mTmpTileBound == null)\n                    this.mTmpTileBound = new Rect();\n                let tmpBound = this.mTmpTileBound;\n                tmpBound.setEmpty();\n                function drawColumn() {\n                    if (tileY === NetDrawable.TileMode.REPEAT) {\n                        tmpBound.bottom = imageHeight;\n                        while (tmpBound.isEmpty() || tmpBound.intersects(bound)) {\n                            canvas.drawImage(this.mState.mImage, null, tmpBound, this.mState.paint);\n                            tmpBound.offset(0, imageHeight);\n                        }\n                    }\n                    else {\n                        tmpBound.bottom = bound.height();\n                        canvas.drawImage(this.mState.mImage, null, tmpBound, this.mState.paint);\n                    }\n                }\n                if (tileX === NetDrawable.TileMode.REPEAT) {\n                    tmpBound.right = imageWidth;\n                    while (tmpBound.isEmpty() || tmpBound.intersects(bound)) {\n                        drawColumn.call(this);\n                        tmpBound.offset(imageWidth, -tmpBound.top);\n                    }\n                }\n                else {\n                    tmpBound.right = bound.width();\n                    drawColumn.call(this);\n                }\n            }\n            setAlpha(alpha) {\n                this.mState.paint.setAlpha(alpha);\n            }\n            getAlpha() {\n                return this.mState.paint.getAlpha();\n            }\n            getIntrinsicWidth() {\n                return this.mImageWidth;\n            }\n            getIntrinsicHeight() {\n                return this.mImageHeight;\n            }\n            onLoad() {\n                this.initBoundWithLoadedImage(this.mState.mImage);\n                if (this.mLoadListener)\n                    this.mLoadListener.onLoad(this);\n                this.invalidateSelf();\n                this.notifySizeChangeSelf();\n            }\n            onError() {\n                this.mImageWidth = this.mImageHeight = 0;\n                if (this.mLoadListener)\n                    this.mLoadListener.onError(this);\n                this.invalidateSelf();\n                this.notifySizeChangeSelf();\n            }\n            isImageSizeEmpty() {\n                return this.mImageWidth <= 0 || this.mImageHeight <= 0;\n            }\n            getImage() {\n                return this.mState.mImage;\n            }\n            setLoadListener(loadListener) {\n                this.mLoadListener = loadListener;\n            }\n            setTileMode(tileX, tileY) {\n                this.mTileModeX = tileX;\n                this.mTileModeY = tileY;\n                this.invalidateSelf();\n            }\n            getConstantState() {\n                return this.mState;\n            }\n        }\n        image_1.NetDrawable = NetDrawable;\n        (function (NetDrawable) {\n            var TileMode;\n            (function (TileMode) {\n                TileMode[TileMode[\"DEFAULT\"] = 0] = \"DEFAULT\";\n                TileMode[TileMode[\"REPEAT\"] = 1] = \"REPEAT\";\n            })(TileMode = NetDrawable.TileMode || (NetDrawable.TileMode = {}));\n        })(NetDrawable = image_1.NetDrawable || (image_1.NetDrawable = {}));\n        class State {\n            constructor(image, paint = new Paint()) {\n                this.mImage = image;\n                this.paint = new Paint();\n                if (paint != null)\n                    this.paint.set(paint);\n            }\n            newDrawable() {\n                return new NetDrawable(this.mImage.src, this.paint);\n            }\n        }\n    })(image = androidui.image || (androidui.image = {}));\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var util;\n    (function (util) {\n        class Platform {\n        }\n        Platform.isIOS = navigator.userAgent.match(/(iPhone|iPad|iPod|ios)/i) ? true : false;\n        Platform.isAndroid = navigator.userAgent.match('Android') ? true : false;\n        Platform.isWeChat = navigator.userAgent.match(/MicroMessenger/i) ? true : false;\n        util.Platform = Platform;\n    })(util = androidui.util || (androidui.util = {}));\n})(androidui || (androidui = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var SystemClock = android.os.SystemClock;\n        var Log = android.util.Log;\n        var Platform = androidui.util.Platform;\n        const DEBUG = false;\n        const TAG = \"KeyEvent\";\n        class KeyEvent {\n            constructor() {\n                this._downingKeyEventMap = new Map();\n            }\n            static obtain(action, code) {\n                let ev = new KeyEvent();\n                ev.mDownTime = SystemClock.uptimeMillis();\n                ev.mEventTime = SystemClock.uptimeMillis();\n                ev.mAction = action;\n                ev.mKeyCode = code;\n                return ev;\n            }\n            initKeyEvent(keyEvent, action) {\n                this.mEventTime = SystemClock.uptimeMillis();\n                this.mKeyCode = keyEvent.keyCode;\n                this.mAltKey = keyEvent.altKey;\n                this.mShiftKey = keyEvent.shiftKey;\n                this.mCtrlKey = keyEvent.ctrlKey;\n                this.mMetaKey = keyEvent.metaKey;\n                let keyIdentifier = keyEvent['keyIdentifier'] + '';\n                if (keyIdentifier) {\n                    this.mIsTypingKey = keyIdentifier.startsWith('U+');\n                    if (this.mIsTypingKey) {\n                        this.mKeyCode = Number.parseInt(keyIdentifier.substr(2), 16) || this.mKeyCode;\n                    }\n                }\n                if (this.mKeyCode >= KeyEvent.KEYCODE_Key_a && this.mKeyCode <= KeyEvent.KEYCODE_Key_z\n                    && this.mShiftKey && !this.mCtrlKey && !this.mAltKey && !this.mMetaKey) {\n                    this.mKeyCode -= 32;\n                }\n                if (this.mKeyCode >= KeyEvent.KEYCODE_KeyA && this.mKeyCode <= KeyEvent.KEYCODE_KeyZ\n                    && !this.mShiftKey && !this.mCtrlKey && !this.mAltKey && !this.mMetaKey) {\n                    this.mKeyCode += 32;\n                }\n                if (Platform.isAndroid) {\n                    if (!this.mShiftKey && !this.mCtrlKey && !this.mAltKey && !this.mMetaKey) {\n                        this.mKeyCode = KeyEvent.KEYCODE_CHANGE_ANDROID_CHROME.noMeta[this.mKeyCode] || this.mKeyCode;\n                    }\n                    else if (this.mShiftKey && !this.mCtrlKey && !this.mAltKey && !this.mMetaKey) {\n                        this.mKeyCode = KeyEvent.KEYCODE_CHANGE_ANDROID_CHROME.shift[this.mKeyCode] || this.mKeyCode;\n                    }\n                    else if (!this.mShiftKey && this.mCtrlKey && !this.mAltKey && !this.mMetaKey) {\n                        this.mKeyCode = KeyEvent.KEYCODE_CHANGE_ANDROID_CHROME.ctrl[this.mKeyCode] || this.mKeyCode;\n                    }\n                    else if (!this.mShiftKey && !this.mCtrlKey && this.mAltKey && !this.mMetaKey) {\n                        this.mKeyCode = KeyEvent.KEYCODE_CHANGE_ANDROID_CHROME.alt[this.mKeyCode] || this.mKeyCode;\n                    }\n                }\n                this.mKeyCode = KeyEvent.FIX_MAP_KEYCODE[this.mKeyCode] || this.mKeyCode;\n                if (action === KeyEvent.ACTION_DOWN) {\n                    this.mDownTime = SystemClock.uptimeMillis();\n                    let keyEvents = this._downingKeyEventMap.get(keyEvent.keyCode);\n                    if (keyEvents == null) {\n                        keyEvents = [];\n                        this._downingKeyEventMap.set(keyEvent.keyCode, keyEvents);\n                    }\n                    keyEvents.push(keyEvent);\n                }\n                else if (action === KeyEvent.ACTION_UP) {\n                    this._downingKeyEventMap.delete(keyEvent.keyCode);\n                }\n                this.mAction = action;\n            }\n            static isConfirmKey(keyCode) {\n                switch (keyCode) {\n                    case KeyEvent.KEYCODE_DPAD_CENTER:\n                    case KeyEvent.KEYCODE_ENTER:\n                        return true;\n                    default:\n                        return false;\n                }\n            }\n            isAltPressed() {\n                return this.mAltKey;\n            }\n            isShiftPressed() {\n                return this.mShiftKey;\n            }\n            isCtrlPressed() {\n                return this.mCtrlKey;\n            }\n            isMetaPressed() {\n                return this.mMetaKey;\n            }\n            getAction() {\n                return this.mAction;\n            }\n            startTracking() {\n                this.mFlags |= KeyEvent.FLAG_START_TRACKING;\n            }\n            isTracking() {\n                return (this.mFlags & KeyEvent.FLAG_TRACKING) != 0;\n            }\n            isLongPress() {\n                return this.getRepeatCount() === 1;\n            }\n            getKeyCode() {\n                return this.mKeyCode;\n            }\n            getRepeatCount() {\n                let downArray = this._downingKeyEventMap.get(this.mKeyCode);\n                return downArray ? downArray.length - 1 : 0;\n            }\n            getDownTime() {\n                return this.mDownTime;\n            }\n            getEventTime() {\n                return this.mEventTime;\n            }\n            dispatch(receiver, state, target) {\n                switch (this.mAction) {\n                    case KeyEvent.ACTION_DOWN: {\n                        this.mFlags &= ~KeyEvent.FLAG_START_TRACKING;\n                        if (DEBUG)\n                            Log.v(TAG, \"Key down to \" + target + \" in \" + state\n                                + \": \" + this);\n                        let res = receiver.onKeyDown(this.getKeyCode(), this);\n                        if (state != null) {\n                            if (res && this.getRepeatCount() == 0 && (this.mFlags & KeyEvent.FLAG_START_TRACKING) != 0) {\n                                if (DEBUG)\n                                    Log.v(TAG, \"  Start tracking!\");\n                                state.startTracking(this, target);\n                            }\n                            else if (this.isLongPress() && state.isTracking(this)) {\n                                if (receiver.onKeyLongPress(this.getKeyCode(), this)) {\n                                    if (DEBUG)\n                                        Log.v(TAG, \"  Clear from long press!\");\n                                    state.performedLongPress(this);\n                                    res = true;\n                                }\n                            }\n                        }\n                        return res;\n                    }\n                    case KeyEvent.ACTION_UP:\n                        if (DEBUG)\n                            Log.v(TAG, \"Key up to \" + target + \" in \" + state\n                                + \": \" + this);\n                        if (state != null) {\n                            state.handleUpEvent(this);\n                        }\n                        return receiver.onKeyUp(this.getKeyCode(), this);\n                }\n                return false;\n            }\n            hasNoModifiers() {\n                if (this.isAltPressed())\n                    return false;\n                if (this.isShiftPressed())\n                    return false;\n                if (this.isCtrlPressed())\n                    return false;\n                if (this.isMetaPressed())\n                    return false;\n                return true;\n            }\n            hasModifiers(modifiers) {\n                if ((modifiers & KeyEvent.META_ALT_ON) === KeyEvent.META_ALT_ON && this.isAltPressed())\n                    return true;\n                if ((modifiers & KeyEvent.META_SHIFT_ON) === KeyEvent.META_SHIFT_ON && this.isShiftPressed())\n                    return true;\n                if ((modifiers & KeyEvent.META_META_ON) === KeyEvent.META_META_ON && this.isMetaPressed())\n                    return true;\n                if ((modifiers & KeyEvent.META_CTRL_ON) === KeyEvent.META_CTRL_ON && this.isCtrlPressed())\n                    return true;\n            }\n            getMetaState() {\n                let meta = 0;\n                if (this.isAltPressed())\n                    meta |= KeyEvent.META_ALT_ON;\n                if (this.isShiftPressed())\n                    meta |= KeyEvent.META_SHIFT_ON;\n                if (this.isCtrlPressed())\n                    meta |= KeyEvent.META_CTRL_ON;\n                if (this.isMetaPressed())\n                    meta |= KeyEvent.META_META_ON;\n                return meta;\n            }\n            toString() {\n                return JSON.stringify(this);\n            }\n            isCanceled() {\n                return false;\n            }\n            static actionToString(action) {\n                switch (action) {\n                    case KeyEvent.ACTION_DOWN:\n                        return \"ACTION_DOWN\";\n                    case KeyEvent.ACTION_UP:\n                        return \"ACTION_UP\";\n                    default:\n                        return '' + (action);\n                }\n            }\n            static keyCodeToString(keyCode) {\n                return String.fromCharCode(keyCode);\n            }\n        }\n        KeyEvent.KEYCODE_DPAD_UP = 38;\n        KeyEvent.KEYCODE_DPAD_DOWN = 40;\n        KeyEvent.KEYCODE_DPAD_LEFT = 37;\n        KeyEvent.KEYCODE_DPAD_RIGHT = 39;\n        KeyEvent.KEYCODE_DPAD_CENTER = 13;\n        KeyEvent.KEYCODE_ENTER = 13;\n        KeyEvent.KEYCODE_TAB = 9;\n        KeyEvent.KEYCODE_SPACE = 32;\n        KeyEvent.KEYCODE_ESCAPE = 27;\n        KeyEvent.KEYCODE_Backspace = 8;\n        KeyEvent.KEYCODE_PAGE_UP = 33;\n        KeyEvent.KEYCODE_PAGE_DOWN = 34;\n        KeyEvent.KEYCODE_MOVE_HOME = 36;\n        KeyEvent.KEYCODE_MOVE_END = 35;\n        KeyEvent.KEYCODE_Digit0 = 48;\n        KeyEvent.KEYCODE_Digit1 = 49;\n        KeyEvent.KEYCODE_Digit2 = 50;\n        KeyEvent.KEYCODE_Digit3 = 51;\n        KeyEvent.KEYCODE_Digit4 = 52;\n        KeyEvent.KEYCODE_Digit5 = 53;\n        KeyEvent.KEYCODE_Digit6 = 54;\n        KeyEvent.KEYCODE_Digit7 = 55;\n        KeyEvent.KEYCODE_Digit8 = 56;\n        KeyEvent.KEYCODE_Digit9 = 57;\n        KeyEvent.KEYCODE_Key_a = 65;\n        KeyEvent.KEYCODE_Key_b = 66;\n        KeyEvent.KEYCODE_Key_c = 67;\n        KeyEvent.KEYCODE_Key_d = 68;\n        KeyEvent.KEYCODE_Key_e = 69;\n        KeyEvent.KEYCODE_Key_f = 70;\n        KeyEvent.KEYCODE_Key_g = 71;\n        KeyEvent.KEYCODE_Key_h = 72;\n        KeyEvent.KEYCODE_Key_i = 73;\n        KeyEvent.KEYCODE_Key_j = 74;\n        KeyEvent.KEYCODE_Key_k = 75;\n        KeyEvent.KEYCODE_Key_l = 76;\n        KeyEvent.KEYCODE_Key_m = 77;\n        KeyEvent.KEYCODE_Key_n = 78;\n        KeyEvent.KEYCODE_Key_o = 79;\n        KeyEvent.KEYCODE_Key_p = 80;\n        KeyEvent.KEYCODE_Key_q = 81;\n        KeyEvent.KEYCODE_Key_r = 82;\n        KeyEvent.KEYCODE_Key_s = 83;\n        KeyEvent.KEYCODE_Key_t = 84;\n        KeyEvent.KEYCODE_Key_u = 85;\n        KeyEvent.KEYCODE_Key_v = 86;\n        KeyEvent.KEYCODE_Key_w = 87;\n        KeyEvent.KEYCODE_Key_x = 88;\n        KeyEvent.KEYCODE_Key_y = 89;\n        KeyEvent.KEYCODE_Key_z = 90;\n        KeyEvent.KEYCODE_KeyA = 0x41;\n        KeyEvent.KEYCODE_KeyB = 0x42;\n        KeyEvent.KEYCODE_KeyC = 0x43;\n        KeyEvent.KEYCODE_KeyD = 0x44;\n        KeyEvent.KEYCODE_KeyE = 0x45;\n        KeyEvent.KEYCODE_KeyF = 0x46;\n        KeyEvent.KEYCODE_KeyG = 0x47;\n        KeyEvent.KEYCODE_KeyH = 0x48;\n        KeyEvent.KEYCODE_KeyI = 0x49;\n        KeyEvent.KEYCODE_KeyJ = 0x4a;\n        KeyEvent.KEYCODE_KeyK = 0x4b;\n        KeyEvent.KEYCODE_KeyL = 0x4c;\n        KeyEvent.KEYCODE_KeyM = 0x4d;\n        KeyEvent.KEYCODE_KeyN = 0x4e;\n        KeyEvent.KEYCODE_KeyO = 0x4f;\n        KeyEvent.KEYCODE_KeyP = 0x50;\n        KeyEvent.KEYCODE_KeyQ = 0x51;\n        KeyEvent.KEYCODE_KeyR = 0x52;\n        KeyEvent.KEYCODE_KeyS = 0x53;\n        KeyEvent.KEYCODE_KeyT = 0x54;\n        KeyEvent.KEYCODE_KeyU = 0x55;\n        KeyEvent.KEYCODE_KeyV = 0x56;\n        KeyEvent.KEYCODE_KeyW = 0x57;\n        KeyEvent.KEYCODE_KeyX = 0x58;\n        KeyEvent.KEYCODE_KeyY = 0x59;\n        KeyEvent.KEYCODE_KeyZ = 0x5a;\n        KeyEvent.KEYCODE_Semicolon = 0x3b;\n        KeyEvent.KEYCODE_LessThan = 0x3c;\n        KeyEvent.KEYCODE_Equal = 0x3d;\n        KeyEvent.KEYCODE_MoreThan = 0x3e;\n        KeyEvent.KEYCODE_Question = 0x3f;\n        KeyEvent.KEYCODE_Comma = 0x2c;\n        KeyEvent.KEYCODE_Period = 0x2e;\n        KeyEvent.KEYCODE_Slash = 0x2f;\n        KeyEvent.KEYCODE_Quotation = 0x27;\n        KeyEvent.KEYCODE_LeftBracket = 0x5b;\n        KeyEvent.KEYCODE_Backslash = 0x5c;\n        KeyEvent.KEYCODE_RightBracket = 0x5d;\n        KeyEvent.KEYCODE_Minus = 0x2d;\n        KeyEvent.KEYCODE_Colon = 0x3a;\n        KeyEvent.KEYCODE_Double_Quotation = 0x22;\n        KeyEvent.KEYCODE_Backquote = 0x60;\n        KeyEvent.KEYCODE_Tilde = 0x7e;\n        KeyEvent.KEYCODE_Left_Brace = 0x7b;\n        KeyEvent.KEYCODE_Or = 0x7c;\n        KeyEvent.KEYCODE_Right_Brace = 0x7d;\n        KeyEvent.KEYCODE_Del = 0x7f;\n        KeyEvent.KEYCODE_Exclamation = 0x21;\n        KeyEvent.KEYCODE_Right_Parenthesis = 0x29;\n        KeyEvent.KEYCODE_AT = 0x40;\n        KeyEvent.KEYCODE_Sharp = 0x23;\n        KeyEvent.KEYCODE_Dollar = 0x24;\n        KeyEvent.KEYCODE_Percent = 0x25;\n        KeyEvent.KEYCODE_Power = 0x5e;\n        KeyEvent.KEYCODE_And = 0x26;\n        KeyEvent.KEYCODE_Asterisk = 0x2a;\n        KeyEvent.KEYCODE_Left_Parenthesis = 0x28;\n        KeyEvent.KEYCODE_Underline = 0x5f;\n        KeyEvent.KEYCODE_Add = 0x2b;\n        KeyEvent.KEYCODE_BACK = -1;\n        KeyEvent.KEYCODE_MENU = -2;\n        KeyEvent.KEYCODE_CHANGE_ANDROID_CHROME = {\n            noMeta: {\n                186: KeyEvent.KEYCODE_Semicolon,\n                187: KeyEvent.KEYCODE_Equal,\n                188: KeyEvent.KEYCODE_Comma,\n                189: KeyEvent.KEYCODE_Minus,\n                190: KeyEvent.KEYCODE_Period,\n                191: KeyEvent.KEYCODE_Slash,\n                192: KeyEvent.KEYCODE_Quotation,\n                219: KeyEvent.KEYCODE_LeftBracket,\n                220: KeyEvent.KEYCODE_Backslash,\n                221: KeyEvent.KEYCODE_RightBracket,\n            },\n            shift: {\n                186: KeyEvent.KEYCODE_Colon,\n                187: KeyEvent.KEYCODE_Add,\n                188: KeyEvent.KEYCODE_LessThan,\n                189: KeyEvent.KEYCODE_Underline,\n                190: KeyEvent.KEYCODE_MoreThan,\n                191: KeyEvent.KEYCODE_Question,\n                192: KeyEvent.KEYCODE_Double_Quotation,\n                219: KeyEvent.KEYCODE_Left_Brace,\n                220: KeyEvent.KEYCODE_Or,\n                221: KeyEvent.KEYCODE_Right_Brace,\n            },\n            ctrl: {},\n            alt: {}\n        };\n        KeyEvent.FIX_MAP_KEYCODE = {\n            186: KeyEvent.KEYCODE_Semicolon,\n            187: KeyEvent.KEYCODE_Equal,\n            188: KeyEvent.KEYCODE_Comma,\n            189: KeyEvent.KEYCODE_Minus,\n            190: KeyEvent.KEYCODE_Period,\n            191: KeyEvent.KEYCODE_Slash,\n            192: KeyEvent.KEYCODE_Backquote,\n            219: KeyEvent.KEYCODE_LeftBracket,\n            220: KeyEvent.KEYCODE_Backslash,\n            221: KeyEvent.KEYCODE_RightBracket,\n            222: KeyEvent.KEYCODE_Quotation,\n            96: KeyEvent.KEYCODE_Digit0,\n            97: KeyEvent.KEYCODE_Digit1,\n            98: KeyEvent.KEYCODE_Digit2,\n            99: KeyEvent.KEYCODE_Digit3,\n            100: KeyEvent.KEYCODE_Digit4,\n            101: KeyEvent.KEYCODE_Digit5,\n            102: KeyEvent.KEYCODE_Digit6,\n            103: KeyEvent.KEYCODE_Digit7,\n            104: KeyEvent.KEYCODE_Digit8,\n            105: KeyEvent.KEYCODE_Digit9\n        };\n        KeyEvent.ACTION_DOWN = 0;\n        KeyEvent.ACTION_UP = 1;\n        KeyEvent.META_MASK_SHIFT = 16;\n        KeyEvent.META_ALT_ON = 0x02;\n        KeyEvent.META_SHIFT_ON = 0x1;\n        KeyEvent.META_CTRL_ON = 0x1000;\n        KeyEvent.META_META_ON = 0x10000;\n        KeyEvent.FLAG_CANCELED = 0x20;\n        KeyEvent.FLAG_CANCELED_LONG_PRESS = 0x100;\n        KeyEvent.FLAG_LONG_PRESS = 0x80;\n        KeyEvent.FLAG_TRACKING = 0x200;\n        KeyEvent.FLAG_START_TRACKING = 0x40000000;\n        view.KeyEvent = KeyEvent;\n        (function (KeyEvent) {\n            class DispatcherState {\n                constructor() {\n                    this.mActiveLongPresses = new android.util.SparseArray();\n                }\n                reset(target) {\n                    if (target == null) {\n                        if (DEBUG)\n                            Log.v(TAG, \"Reset: \" + this);\n                        this.mDownKeyCode = 0;\n                        this.mDownTarget = null;\n                        this.mActiveLongPresses.clear();\n                    }\n                    else {\n                        if (this.mDownTarget == target) {\n                            if (DEBUG)\n                                Log.v(TAG, \"Reset in \" + target + \": \" + this);\n                            this.mDownKeyCode = 0;\n                            this.mDownTarget = null;\n                        }\n                    }\n                }\n                startTracking(event, target) {\n                    if (event.getAction() != KeyEvent.ACTION_DOWN) {\n                        throw new Error(\"Can only start tracking on a down event\");\n                    }\n                    if (DEBUG)\n                        Log.v(TAG, \"Start trackingt in \" + target + \": \" + this);\n                    this.mDownKeyCode = event.getKeyCode();\n                    this.mDownTarget = target;\n                }\n                isTracking(event) {\n                    return this.mDownKeyCode == event.getKeyCode();\n                }\n                performedLongPress(event) {\n                    this.mActiveLongPresses.put(event.getKeyCode(), 1);\n                }\n                handleUpEvent(event) {\n                    const keyCode = event.getKeyCode();\n                    if (DEBUG)\n                        Log.v(TAG, \"Handle key up \" + event + \": \" + this);\n                    let index = this.mActiveLongPresses.indexOfKey(keyCode);\n                    if (index >= 0) {\n                        if (DEBUG)\n                            Log.v(TAG, \"  Index: \" + index);\n                        event.mFlags |= KeyEvent.FLAG_CANCELED | KeyEvent.FLAG_CANCELED_LONG_PRESS;\n                        this.mActiveLongPresses.removeAt(index);\n                    }\n                    if (this.mDownKeyCode == keyCode) {\n                        if (DEBUG)\n                            Log.v(TAG, \"  Tracking!\");\n                        event.mFlags |= KeyEvent.FLAG_TRACKING;\n                        this.mDownKeyCode = 0;\n                        this.mDownTarget = null;\n                    }\n                }\n            }\n            KeyEvent.DispatcherState = DispatcherState;\n        })(KeyEvent = view.KeyEvent || (view.KeyEvent = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        var drawable;\n        (function (drawable_4) {\n            var PixelFormat = android.graphics.PixelFormat;\n            var Rect = android.graphics.Rect;\n            var System = java.lang.System;\n            var Drawable = android.graphics.drawable.Drawable;\n            class LayerDrawable extends Drawable {\n                constructor(layers, state = null) {\n                    super();\n                    this.mOpacityOverride = PixelFormat.UNKNOWN;\n                    this.mTmpRect = new Rect();\n                    let _as = this.createConstantState(state);\n                    this.mLayerState = _as;\n                    if (_as.mNum > 0) {\n                        this.ensurePadding();\n                    }\n                    if (layers != null) {\n                        let length = layers.length;\n                        let r = new Array(length);\n                        for (let i = 0; i < length; i++) {\n                            r[i] = new LayerDrawable.ChildDrawable();\n                            r[i].mDrawable = layers[i];\n                            layers[i].setCallback(this);\n                        }\n                        this.mLayerState.mNum = length;\n                        this.mLayerState.mChildren = r;\n                        this.ensurePadding();\n                    }\n                }\n                createConstantState(state) {\n                    return new LayerDrawable.LayerState(state, this);\n                }\n                inflate(r, parser) {\n                    super.inflate(r, parser);\n                    let a = r.obtainAttributes(parser);\n                    this.mOpacityOverride = a.getInt(\"android:opacity\", PixelFormat.UNKNOWN);\n                    this.setAutoMirrored(a.getBoolean(\"android:autoMirrored\", false));\n                    a.recycle();\n                    for (let child of Array.from(parser.children)) {\n                        let item = child;\n                        if (item.tagName.toLowerCase() !== 'item') {\n                            continue;\n                        }\n                        a = r.obtainAttributes(item);\n                        let left = a.getDimensionPixelOffset(\"android:left\", 0);\n                        let top = a.getDimensionPixelOffset(\"android:top\", 0);\n                        let right = a.getDimensionPixelOffset(\"android:right\", 0);\n                        let bottom = a.getDimensionPixelOffset(\"android:bottom\", 0);\n                        let dr = a.getDrawable(\"android:drawable\");\n                        let id = a.getString(\"android:id\");\n                        a.recycle();\n                        if (!dr && item.children[0] instanceof HTMLElement) {\n                            dr = Drawable.createFromXml(r, item.children[0]);\n                        }\n                        if (!dr) {\n                            throw Error(`new XmlPullParserException(<item> tag requires a 'drawable' attribute or child tag defining a drawable)`);\n                        }\n                        this.addLayer(dr, id, left, top, right, bottom);\n                    }\n                    this.ensurePadding();\n                    this.onStateChange(this.getState());\n                }\n                addLayer(layer, id, left = 0, top = 0, right = 0, bottom = 0) {\n                    const st = this.mLayerState;\n                    let N = st.mChildren != null ? st.mChildren.length : 0;\n                    let i = st.mNum;\n                    if (i >= N) {\n                        let nu = new Array(N + 10);\n                        if (i > 0) {\n                            System.arraycopy(st.mChildren, 0, nu, 0, i);\n                        }\n                        st.mChildren = nu;\n                    }\n                    let childDrawable = new LayerDrawable.ChildDrawable();\n                    st.mChildren[i] = childDrawable;\n                    childDrawable.mId = id;\n                    childDrawable.mDrawable = layer;\n                    childDrawable.mDrawable.setAutoMirrored(this.isAutoMirrored());\n                    childDrawable.mInsetL = left;\n                    childDrawable.mInsetT = top;\n                    childDrawable.mInsetR = right;\n                    childDrawable.mInsetB = bottom;\n                    st.mNum++;\n                    layer.setCallback(this);\n                }\n                findDrawableByLayerId(id) {\n                    const layers = this.mLayerState.mChildren;\n                    for (let i = this.mLayerState.mNum - 1; i >= 0; i--) {\n                        if (layers[i].mId == id) {\n                            return layers[i].mDrawable;\n                        }\n                    }\n                    return null;\n                }\n                setId(index, id) {\n                    this.mLayerState.mChildren[index].mId = id;\n                }\n                getNumberOfLayers() {\n                    return this.mLayerState.mNum;\n                }\n                getDrawable(index) {\n                    return this.mLayerState.mChildren[index].mDrawable;\n                }\n                getId(index) {\n                    return this.mLayerState.mChildren[index].mId;\n                }\n                setDrawableByLayerId(id, drawable) {\n                    const layers = this.mLayerState.mChildren;\n                    for (let i = this.mLayerState.mNum - 1; i >= 0; i--) {\n                        if (layers[i].mId == id) {\n                            if (layers[i].mDrawable != null) {\n                                if (drawable != null) {\n                                    let bounds = layers[i].mDrawable.getBounds();\n                                    drawable.setBounds(bounds);\n                                }\n                                layers[i].mDrawable.setCallback(null);\n                            }\n                            if (drawable != null) {\n                                drawable.setCallback(this);\n                            }\n                            layers[i].mDrawable = drawable;\n                            return true;\n                        }\n                    }\n                    return false;\n                }\n                setLayerInset(index, l, t, r, b) {\n                    let childDrawable = this.mLayerState.mChildren[index];\n                    childDrawable.mInsetL = l;\n                    childDrawable.mInsetT = t;\n                    childDrawable.mInsetR = r;\n                    childDrawable.mInsetB = b;\n                }\n                drawableSizeChange(who) {\n                    let callback = this.getCallback();\n                    if (callback != null && callback.drawableSizeChange) {\n                        callback.drawableSizeChange(this);\n                    }\n                }\n                invalidateDrawable(who) {\n                    const callback = this.getCallback();\n                    if (callback != null) {\n                        callback.invalidateDrawable(this);\n                    }\n                }\n                scheduleDrawable(who, what, when) {\n                    const callback = this.getCallback();\n                    if (callback != null) {\n                        callback.scheduleDrawable(this, what, when);\n                    }\n                }\n                unscheduleDrawable(who, what) {\n                    const callback = this.getCallback();\n                    if (callback != null) {\n                        callback.unscheduleDrawable(this, what);\n                    }\n                }\n                draw(canvas) {\n                    const array = this.mLayerState.mChildren;\n                    const N = this.mLayerState.mNum;\n                    for (let i = 0; i < N; i++) {\n                        array[i].mDrawable.draw(canvas);\n                    }\n                }\n                getPadding(padding) {\n                    padding.left = 0;\n                    padding.top = 0;\n                    padding.right = 0;\n                    padding.bottom = 0;\n                    const array = this.mLayerState.mChildren;\n                    const N = this.mLayerState.mNum;\n                    for (let i = 0; i < N; i++) {\n                        this.reapplyPadding(i, array[i]);\n                        padding.left += this.mPaddingL[i];\n                        padding.top += this.mPaddingT[i];\n                        padding.right += this.mPaddingR[i];\n                        padding.bottom += this.mPaddingB[i];\n                    }\n                    return true;\n                }\n                setVisible(visible, restart) {\n                    let changed = super.setVisible(visible, restart);\n                    const array = this.mLayerState.mChildren;\n                    const N = this.mLayerState.mNum;\n                    for (let i = 0; i < N; i++) {\n                        array[i].mDrawable.setVisible(visible, restart);\n                    }\n                    return changed;\n                }\n                setDither(dither) {\n                    const array = this.mLayerState.mChildren;\n                    const N = this.mLayerState.mNum;\n                    for (let i = 0; i < N; i++) {\n                        array[i].mDrawable.setDither(dither);\n                    }\n                }\n                setAlpha(alpha) {\n                    const array = this.mLayerState.mChildren;\n                    const N = this.mLayerState.mNum;\n                    for (let i = 0; i < N; i++) {\n                        array[i].mDrawable.setAlpha(alpha);\n                    }\n                }\n                getAlpha() {\n                    const array = this.mLayerState.mChildren;\n                    if (this.mLayerState.mNum > 0) {\n                        return array[0].mDrawable.getAlpha();\n                    }\n                    else {\n                        return super.getAlpha();\n                    }\n                }\n                setOpacity(opacity) {\n                    this.mOpacityOverride = opacity;\n                }\n                getOpacity() {\n                    if (this.mOpacityOverride != PixelFormat.UNKNOWN) {\n                        return this.mOpacityOverride;\n                    }\n                    return this.mLayerState.getOpacity();\n                }\n                setAutoMirrored(mirrored) {\n                    this.mLayerState.mAutoMirrored = mirrored;\n                    const array = this.mLayerState.mChildren;\n                    const N = this.mLayerState.mNum;\n                    for (let i = 0; i < N; i++) {\n                        array[i].mDrawable.setAutoMirrored(mirrored);\n                    }\n                }\n                isAutoMirrored() {\n                    return this.mLayerState.mAutoMirrored;\n                }\n                isStateful() {\n                    return this.mLayerState.isStateful();\n                }\n                onStateChange(state) {\n                    const array = this.mLayerState.mChildren;\n                    const N = this.mLayerState.mNum;\n                    let paddingChanged = false;\n                    let changed = false;\n                    for (let i = 0; i < N; i++) {\n                        const r = array[i];\n                        if (r.mDrawable.setState(state)) {\n                            changed = true;\n                        }\n                        if (this.reapplyPadding(i, r)) {\n                            paddingChanged = true;\n                        }\n                    }\n                    if (paddingChanged) {\n                        this.onBoundsChange(this.getBounds());\n                    }\n                    return changed;\n                }\n                onLevelChange(level) {\n                    const array = this.mLayerState.mChildren;\n                    const N = this.mLayerState.mNum;\n                    let paddingChanged = false;\n                    let changed = false;\n                    for (let i = 0; i < N; i++) {\n                        const r = array[i];\n                        if (r.mDrawable.setLevel(level)) {\n                            changed = true;\n                        }\n                        if (this.reapplyPadding(i, r)) {\n                            paddingChanged = true;\n                        }\n                    }\n                    if (paddingChanged) {\n                        this.onBoundsChange(this.getBounds());\n                    }\n                    return changed;\n                }\n                onBoundsChange(bounds) {\n                    const array = this.mLayerState.mChildren;\n                    const N = this.mLayerState.mNum;\n                    let padL = 0, padT = 0, padR = 0, padB = 0;\n                    for (let i = 0; i < N; i++) {\n                        const r = array[i];\n                        r.mDrawable.setBounds(bounds.left + r.mInsetL + padL, bounds.top + r.mInsetT + padT, bounds.right - r.mInsetR - padR, bounds.bottom - r.mInsetB - padB);\n                        padL += this.mPaddingL[i];\n                        padR += this.mPaddingR[i];\n                        padT += this.mPaddingT[i];\n                        padB += this.mPaddingB[i];\n                    }\n                }\n                getIntrinsicWidth() {\n                    let width = -1;\n                    const array = this.mLayerState.mChildren;\n                    const N = this.mLayerState.mNum;\n                    let padL = 0, padR = 0;\n                    for (let i = 0; i < N; i++) {\n                        const r = array[i];\n                        let w = r.mDrawable.getIntrinsicWidth() + r.mInsetL + r.mInsetR + padL + padR;\n                        if (w > width) {\n                            width = w;\n                        }\n                        padL += this.mPaddingL[i];\n                        padR += this.mPaddingR[i];\n                    }\n                    return width;\n                }\n                getIntrinsicHeight() {\n                    let height = -1;\n                    const array = this.mLayerState.mChildren;\n                    const N = this.mLayerState.mNum;\n                    let padT = 0, padB = 0;\n                    for (let i = 0; i < N; i++) {\n                        const r = array[i];\n                        let h = r.mDrawable.getIntrinsicHeight() + r.mInsetT + r.mInsetB + padT + padB;\n                        if (h > height) {\n                            height = h;\n                        }\n                        padT += this.mPaddingT[i];\n                        padB += this.mPaddingB[i];\n                    }\n                    return height;\n                }\n                reapplyPadding(i, r) {\n                    const rect = this.mTmpRect;\n                    r.mDrawable.getPadding(rect);\n                    if (rect.left != this.mPaddingL[i] || rect.top != this.mPaddingT[i] || rect.right != this.mPaddingR[i] || rect.bottom != this.mPaddingB[i]) {\n                        this.mPaddingL[i] = rect.left;\n                        this.mPaddingT[i] = rect.top;\n                        this.mPaddingR[i] = rect.right;\n                        this.mPaddingB[i] = rect.bottom;\n                        return true;\n                    }\n                    return false;\n                }\n                ensurePadding() {\n                    const N = this.mLayerState.mNum;\n                    if (this.mPaddingL != null && this.mPaddingL.length >= N) {\n                        return;\n                    }\n                    this.mPaddingL = androidui.util.ArrayCreator.newNumberArray(N);\n                    this.mPaddingT = androidui.util.ArrayCreator.newNumberArray(N);\n                    this.mPaddingR = androidui.util.ArrayCreator.newNumberArray(N);\n                    this.mPaddingB = androidui.util.ArrayCreator.newNumberArray(N);\n                    for (var i = 0; i < N; i++) {\n                        this.mPaddingL[i] = 0;\n                        this.mPaddingT[i] = 0;\n                        this.mPaddingR[i] = 0;\n                        this.mPaddingB[i] = 0;\n                    }\n                }\n                getConstantState() {\n                    if (this.mLayerState.canConstantState()) {\n                        return this.mLayerState;\n                    }\n                    return null;\n                }\n                mutate() {\n                    if (!this.mMutated && super.mutate() == this) {\n                        this.mLayerState = this.createConstantState(this.mLayerState);\n                        const array = this.mLayerState.mChildren;\n                        const N = this.mLayerState.mNum;\n                        for (let i = 0; i < N; i++) {\n                            array[i].mDrawable.mutate();\n                        }\n                        this.mMutated = true;\n                    }\n                    return this;\n                }\n            }\n            drawable_4.LayerDrawable = LayerDrawable;\n            (function (LayerDrawable) {\n                class ChildDrawable {\n                    constructor() {\n                        this.mInsetL = 0;\n                        this.mInsetT = 0;\n                        this.mInsetR = 0;\n                        this.mInsetB = 0;\n                    }\n                }\n                LayerDrawable.ChildDrawable = ChildDrawable;\n                class LayerState {\n                    constructor(orig, owner) {\n                        this.mNum = 0;\n                        this.mHaveOpacity = false;\n                        this.mOpacity = 0;\n                        this.mHaveStateful = false;\n                        if (orig != null) {\n                            const origChildDrawable = orig.mChildren;\n                            const N = orig.mNum;\n                            this.mNum = N;\n                            this.mChildren = new Array(N);\n                            for (let i = 0; i < N; i++) {\n                                const r = this.mChildren[i] = new LayerDrawable.ChildDrawable();\n                                const or = origChildDrawable[i];\n                                r.mDrawable = or.mDrawable.getConstantState().newDrawable();\n                                r.mDrawable.setCallback(owner);\n                                r.mInsetL = or.mInsetL;\n                                r.mInsetT = or.mInsetT;\n                                r.mInsetR = or.mInsetR;\n                                r.mInsetB = or.mInsetB;\n                                r.mId = or.mId;\n                            }\n                            this.mHaveOpacity = orig.mHaveOpacity;\n                            this.mOpacity = orig.mOpacity;\n                            this.mHaveStateful = orig.mHaveStateful;\n                            this.mStateful = orig.mStateful;\n                            this.mCheckedConstantState = this.mCanConstantState = true;\n                            this.mAutoMirrored = orig.mAutoMirrored;\n                        }\n                        else {\n                            this.mNum = 0;\n                            this.mChildren = null;\n                        }\n                    }\n                    newDrawable() {\n                        return new LayerDrawable(null, this);\n                    }\n                    getOpacity() {\n                        if (this.mHaveOpacity) {\n                            return this.mOpacity;\n                        }\n                        const N = this.mNum;\n                        let op = N > 0 ? this.mChildren[0].mDrawable.getOpacity() : PixelFormat.TRANSPARENT;\n                        for (let i = 1; i < N; i++) {\n                            op = Drawable.resolveOpacity(op, this.mChildren[i].mDrawable.getOpacity());\n                        }\n                        this.mOpacity = op;\n                        this.mHaveOpacity = true;\n                        return op;\n                    }\n                    isStateful() {\n                        if (this.mHaveStateful) {\n                            return this.mStateful;\n                        }\n                        let stateful = false;\n                        const N = this.mNum;\n                        for (let i = 0; i < N; i++) {\n                            if (this.mChildren[i].mDrawable.isStateful()) {\n                                stateful = true;\n                                break;\n                            }\n                        }\n                        this.mStateful = stateful;\n                        this.mHaveStateful = true;\n                        return stateful;\n                    }\n                    canConstantState() {\n                        if (!this.mCheckedConstantState && this.mChildren != null) {\n                            this.mCanConstantState = true;\n                            const N = this.mNum;\n                            for (let i = 0; i < N; i++) {\n                                if (this.mChildren[i].mDrawable.getConstantState() == null) {\n                                    this.mCanConstantState = false;\n                                    break;\n                                }\n                            }\n                            this.mCheckedConstantState = true;\n                        }\n                        return this.mCanConstantState;\n                    }\n                }\n                LayerDrawable.LayerState = LayerState;\n            })(LayerDrawable = drawable_4.LayerDrawable || (drawable_4.LayerDrawable = {}));\n        })(drawable = graphics.drawable || (graphics.drawable = {}));\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        var drawable;\n        (function (drawable_5) {\n            var Log = android.util.Log;\n            var Drawable = android.graphics.drawable.Drawable;\n            class RotateDrawable extends Drawable {\n                constructor(rotateState) {\n                    super();\n                    this.mState = new RotateDrawable.RotateState(rotateState, this);\n                }\n                draw(canvas) {\n                    let saveCount = canvas.save();\n                    let bounds = this.mState.mDrawable.getBounds();\n                    let w = bounds.right - bounds.left;\n                    let h = bounds.bottom - bounds.top;\n                    const st = this.mState;\n                    let px = st.mPivotXRel ? (w * st.mPivotX) : st.mPivotX;\n                    let py = st.mPivotYRel ? (h * st.mPivotY) : st.mPivotY;\n                    canvas.rotate(st.mCurrentDegrees, px + bounds.left, py + bounds.top);\n                    st.mDrawable.draw(canvas);\n                    canvas.restoreToCount(saveCount);\n                }\n                getDrawable() {\n                    return this.mState.mDrawable;\n                }\n                setAlpha(alpha) {\n                    this.mState.mDrawable.setAlpha(alpha);\n                }\n                getAlpha() {\n                    return this.mState.mDrawable.getAlpha();\n                }\n                getOpacity() {\n                    return this.mState.mDrawable.getOpacity();\n                }\n                drawableSizeChange(who) {\n                    const callback = this.getCallback();\n                    if (callback != null && callback.drawableSizeChange) {\n                        callback.drawableSizeChange(this);\n                    }\n                }\n                invalidateDrawable(who) {\n                    const callback = this.getCallback();\n                    if (callback != null) {\n                        callback.invalidateDrawable(this);\n                    }\n                }\n                scheduleDrawable(who, what, when) {\n                    const callback = this.getCallback();\n                    if (callback != null) {\n                        callback.scheduleDrawable(this, what, when);\n                    }\n                }\n                unscheduleDrawable(who, what) {\n                    const callback = this.getCallback();\n                    if (callback != null) {\n                        callback.unscheduleDrawable(this, what);\n                    }\n                }\n                getPadding(padding) {\n                    return this.mState.mDrawable.getPadding(padding);\n                }\n                setVisible(visible, restart) {\n                    this.mState.mDrawable.setVisible(visible, restart);\n                    return super.setVisible(visible, restart);\n                }\n                isStateful() {\n                    return this.mState.mDrawable.isStateful();\n                }\n                onStateChange(state) {\n                    let changed = this.mState.mDrawable.setState(state);\n                    this.onBoundsChange(this.getBounds());\n                    return changed;\n                }\n                onLevelChange(level) {\n                    this.mState.mDrawable.setLevel(level);\n                    this.onBoundsChange(this.getBounds());\n                    this.mState.mCurrentDegrees = this.mState.mFromDegrees + (this.mState.mToDegrees - this.mState.mFromDegrees) * (level / RotateDrawable.MAX_LEVEL);\n                    this.invalidateSelf();\n                    return true;\n                }\n                onBoundsChange(bounds) {\n                    this.mState.mDrawable.setBounds(bounds.left, bounds.top, bounds.right, bounds.bottom);\n                }\n                getIntrinsicWidth() {\n                    return this.mState.mDrawable.getIntrinsicWidth();\n                }\n                getIntrinsicHeight() {\n                    return this.mState.mDrawable.getIntrinsicHeight();\n                }\n                getConstantState() {\n                    if (this.mState.canConstantState()) {\n                        return this.mState;\n                    }\n                    return null;\n                }\n                inflate(r, parser) {\n                    super.inflate(r, parser);\n                    let a = r.obtainAttributes(parser);\n                    let tv = a.getString(\"android:pivotX\");\n                    let pivotXRel;\n                    let pivotX;\n                    if (tv == null) {\n                        pivotXRel = true;\n                        pivotX = 0.5;\n                    }\n                    else {\n                        pivotXRel = tv.endsWith('%');\n                        pivotX = a.getFloat('android:pivotX', 0.5);\n                    }\n                    tv = a.getString(\"android:pivotY\");\n                    let pivotYRel;\n                    let pivotY;\n                    if (tv == null) {\n                        pivotYRel = true;\n                        pivotY = 0.5;\n                    }\n                    else {\n                        pivotYRel = tv.endsWith('%');\n                        pivotY = a.getFloat('android:pivotY', 0.5);\n                    }\n                    let fromDegrees = a.getFloat(\"android:fromDegrees\", 0.0);\n                    let toDegrees = a.getFloat(\"android:toDegrees\", 360.0);\n                    let drawable = a.getDrawable(\"android:drawable\");\n                    a.recycle();\n                    if (!drawable && parser.children[0] instanceof HTMLElement) {\n                        drawable = Drawable.createFromXml(r, parser.children[0]);\n                    }\n                    if (drawable == null) {\n                        Log.w(\"drawable\", \"No drawable specified for <rotate>\");\n                    }\n                    this.mState.mDrawable = drawable;\n                    this.mState.mPivotXRel = pivotXRel;\n                    this.mState.mPivotX = pivotX;\n                    this.mState.mPivotYRel = pivotYRel;\n                    this.mState.mPivotY = pivotY;\n                    this.mState.mFromDegrees = this.mState.mCurrentDegrees = fromDegrees;\n                    this.mState.mToDegrees = toDegrees;\n                    if (drawable != null) {\n                        drawable.setCallback(this);\n                    }\n                }\n                mutate() {\n                    if (!this.mMutated && super.mutate() == this) {\n                        this.mState.mDrawable.mutate();\n                        this.mMutated = true;\n                    }\n                    return this;\n                }\n            }\n            RotateDrawable.MAX_LEVEL = 10000.0;\n            drawable_5.RotateDrawable = RotateDrawable;\n            (function (RotateDrawable) {\n                class RotateState {\n                    constructor(source, owner) {\n                        this.mPivotX = 0;\n                        this.mPivotY = 0;\n                        this.mFromDegrees = 0;\n                        this.mToDegrees = 0;\n                        this.mCurrentDegrees = 0;\n                        if (source != null) {\n                            this.mDrawable = source.mDrawable.getConstantState().newDrawable();\n                            this.mDrawable.setCallback(owner);\n                            this.mPivotXRel = source.mPivotXRel;\n                            this.mPivotX = source.mPivotX;\n                            this.mPivotYRel = source.mPivotYRel;\n                            this.mPivotY = source.mPivotY;\n                            this.mFromDegrees = this.mCurrentDegrees = source.mFromDegrees;\n                            this.mToDegrees = source.mToDegrees;\n                            this.mCanConstantState = this.mCheckedConstantState = true;\n                        }\n                    }\n                    newDrawable() {\n                        return new RotateDrawable(this);\n                    }\n                    canConstantState() {\n                        if (!this.mCheckedConstantState) {\n                            this.mCanConstantState = this.mDrawable.getConstantState() != null;\n                            this.mCheckedConstantState = true;\n                        }\n                        return this.mCanConstantState;\n                    }\n                }\n                RotateDrawable.RotateState = RotateState;\n            })(RotateDrawable = drawable_5.RotateDrawable || (drawable_5.RotateDrawable = {}));\n        })(drawable = graphics.drawable || (graphics.drawable = {}));\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar java;\n(function (java) {\n    var lang;\n    (function (lang) {\n        class Float {\n            static parseFloat(value) {\n                return Number.parseFloat(value);\n            }\n        }\n        Float.MIN_VALUE = Number.MIN_VALUE;\n        Float.MAX_VALUE = Number.MAX_VALUE;\n        lang.Float = Float;\n    })(lang = java.lang || (java.lang = {}));\n})(java || (java = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        var drawable;\n        (function (drawable_6) {\n            var Rect = android.graphics.Rect;\n            var Gravity = android.view.Gravity;\n            var Drawable = android.graphics.drawable.Drawable;\n            class ScaleDrawable extends Drawable {\n                constructor(...args) {\n                    super();\n                    this.mTmpRect = new Rect();\n                    if (args.length <= 1) {\n                        this.mScaleState = new ScaleDrawable.ScaleState(args[0], this);\n                        return;\n                    }\n                    let drawable = args[0];\n                    let gravity = args[1];\n                    let scaleWidth = args[2];\n                    let scaleHeight = args[3];\n                    this.mScaleState = new ScaleDrawable.ScaleState(null, this);\n                    this.mScaleState.mDrawable = drawable;\n                    this.mScaleState.mGravity = gravity;\n                    this.mScaleState.mScaleWidth = scaleWidth;\n                    this.mScaleState.mScaleHeight = scaleHeight;\n                    if (drawable != null) {\n                        drawable.setCallback(this);\n                    }\n                }\n                getDrawable() {\n                    return this.mScaleState.mDrawable;\n                }\n                inflate(r, parser) {\n                    super.inflate(r, parser);\n                    let a = r.obtainAttributes(parser);\n                    let sw = a.getFloat(\"android:scaleWidth\", 1);\n                    let sh = a.getFloat(\"android:scaleHeight\", 1);\n                    let gStr = a.getString(\"android:scaleGravity\");\n                    let g = Gravity.parseGravity(gStr, Gravity.LEFT);\n                    let min = a.getBoolean(\"android:useIntrinsicSizeAsMinimum\", false);\n                    let dr = a.getDrawable(\"android:drawable\");\n                    a.recycle();\n                    if (!dr && parser.children[0] instanceof HTMLElement) {\n                        dr = Drawable.createFromXml(r, parser.children[0]);\n                    }\n                    if (dr == null) {\n                        throw Error(`new IllegalArgumentException(\"No drawable specified for <scale>\")`);\n                    }\n                    this.mScaleState.mDrawable = dr;\n                    this.mScaleState.mScaleWidth = sw;\n                    this.mScaleState.mScaleHeight = sh;\n                    this.mScaleState.mGravity = g;\n                    this.mScaleState.mUseIntrinsicSizeAsMin = min;\n                    if (dr != null) {\n                        dr.setCallback(this);\n                    }\n                }\n                drawableSizeChange(who) {\n                    const callback = this.getCallback();\n                    if (callback != null && callback.drawableSizeChange) {\n                        callback.drawableSizeChange(this);\n                    }\n                }\n                invalidateDrawable(who) {\n                    if (this.getCallback() != null) {\n                        this.getCallback().invalidateDrawable(this);\n                    }\n                }\n                scheduleDrawable(who, what, when) {\n                    if (this.getCallback() != null) {\n                        this.getCallback().scheduleDrawable(this, what, when);\n                    }\n                }\n                unscheduleDrawable(who, what) {\n                    if (this.getCallback() != null) {\n                        this.getCallback().unscheduleDrawable(this, what);\n                    }\n                }\n                draw(canvas) {\n                    if (this.mScaleState.mDrawable.getLevel() != 0)\n                        this.mScaleState.mDrawable.draw(canvas);\n                }\n                getPadding(padding) {\n                    return this.mScaleState.mDrawable.getPadding(padding);\n                }\n                setVisible(visible, restart) {\n                    this.mScaleState.mDrawable.setVisible(visible, restart);\n                    return super.setVisible(visible, restart);\n                }\n                setAlpha(alpha) {\n                    this.mScaleState.mDrawable.setAlpha(alpha);\n                }\n                getAlpha() {\n                    return this.mScaleState.mDrawable.getAlpha();\n                }\n                getOpacity() {\n                    return this.mScaleState.mDrawable.getOpacity();\n                }\n                isStateful() {\n                    return this.mScaleState.mDrawable.isStateful();\n                }\n                onStateChange(state) {\n                    let changed = this.mScaleState.mDrawable.setState(state);\n                    this.onBoundsChange(this.getBounds());\n                    return changed;\n                }\n                onLevelChange(level) {\n                    this.mScaleState.mDrawable.setLevel(level);\n                    this.onBoundsChange(this.getBounds());\n                    this.invalidateSelf();\n                    return true;\n                }\n                onBoundsChange(bounds) {\n                    const r = this.mTmpRect;\n                    const min = this.mScaleState.mUseIntrinsicSizeAsMin;\n                    let level = this.getLevel();\n                    let w = bounds.width();\n                    if (this.mScaleState.mScaleWidth > 0) {\n                        const iw = min ? this.mScaleState.mDrawable.getIntrinsicWidth() : 0;\n                        w -= Math.floor(((w - iw) * (10000 - level) * this.mScaleState.mScaleWidth / 10000));\n                    }\n                    let h = bounds.height();\n                    if (this.mScaleState.mScaleHeight > 0) {\n                        const ih = min ? this.mScaleState.mDrawable.getIntrinsicHeight() : 0;\n                        h -= Math.floor(((h - ih) * (10000 - level) * this.mScaleState.mScaleHeight / 10000));\n                    }\n                    Gravity.apply(this.mScaleState.mGravity, w, h, bounds, r);\n                    if (w > 0 && h > 0) {\n                        this.mScaleState.mDrawable.setBounds(r.left, r.top, r.right, r.bottom);\n                    }\n                }\n                getIntrinsicWidth() {\n                    return this.mScaleState.mDrawable.getIntrinsicWidth();\n                }\n                getIntrinsicHeight() {\n                    return this.mScaleState.mDrawable.getIntrinsicHeight();\n                }\n                getConstantState() {\n                    if (this.mScaleState.canConstantState()) {\n                        return this.mScaleState;\n                    }\n                    return null;\n                }\n                mutate() {\n                    if (!this.mMutated && super.mutate() == this) {\n                        this.mScaleState.mDrawable.mutate();\n                        this.mMutated = true;\n                    }\n                    return this;\n                }\n            }\n            drawable_6.ScaleDrawable = ScaleDrawable;\n            (function (ScaleDrawable) {\n                class ScaleState {\n                    constructor(orig, owner) {\n                        this.mScaleWidth = 0;\n                        this.mScaleHeight = 0;\n                        this.mGravity = 0;\n                        if (orig != null) {\n                            this.mDrawable = orig.mDrawable.getConstantState().newDrawable();\n                            this.mDrawable.setCallback(owner);\n                            this.mScaleWidth = orig.mScaleWidth;\n                            this.mScaleHeight = orig.mScaleHeight;\n                            this.mGravity = orig.mGravity;\n                            this.mUseIntrinsicSizeAsMin = orig.mUseIntrinsicSizeAsMin;\n                            this.mCheckedConstantState = this.mCanConstantState = true;\n                        }\n                    }\n                    newDrawable() {\n                        return new ScaleDrawable(this);\n                    }\n                    canConstantState() {\n                        if (!this.mCheckedConstantState) {\n                            this.mCanConstantState = this.mDrawable.getConstantState() != null;\n                            this.mCheckedConstantState = true;\n                        }\n                        return this.mCanConstantState;\n                    }\n                }\n                ScaleDrawable.ScaleState = ScaleState;\n            })(ScaleDrawable = drawable_6.ScaleDrawable || (drawable_6.ScaleDrawable = {}));\n        })(drawable = graphics.drawable || (graphics.drawable = {}));\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        var drawable;\n        (function (drawable) {\n            var Animatable;\n            (function (Animatable) {\n                function isImpl(obj) {\n                    return obj && obj['start'] && obj['stop'] && obj['isRunning'];\n                }\n                Animatable.isImpl = isImpl;\n            })(Animatable = drawable.Animatable || (drawable.Animatable = {}));\n        })(drawable = graphics.drawable || (graphics.drawable = {}));\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        var drawable;\n        (function (drawable) {\n            var Rect = android.graphics.Rect;\n            var PixelFormat = android.graphics.PixelFormat;\n            var Log = android.util.Log;\n            var SparseArray = android.util.SparseArray;\n            var SystemClock = android.os.SystemClock;\n            class DrawableContainer extends drawable.Drawable {\n                constructor() {\n                    super(...arguments);\n                    this.mAlpha = 0xFF;\n                    this.mCurIndex = -1;\n                    this.mMutated = false;\n                    this.mEnterAnimationEnd = 0;\n                    this.mExitAnimationEnd = 0;\n                }\n                draw(canvas) {\n                    if (this.mCurrDrawable != null) {\n                        this.mCurrDrawable.draw(canvas);\n                    }\n                    if (this.mLastDrawable != null) {\n                        this.mLastDrawable.draw(canvas);\n                    }\n                }\n                needsMirroring() {\n                    return false && this.isAutoMirrored();\n                }\n                getPadding(padding) {\n                    const r = this.mDrawableContainerState.getConstantPadding();\n                    let result;\n                    if (r != null) {\n                        padding.set(r);\n                        result = (r.left | r.top | r.bottom | r.right) != 0;\n                    }\n                    else {\n                        if (this.mCurrDrawable != null) {\n                            result = this.mCurrDrawable.getPadding(padding);\n                        }\n                        else {\n                            result = super.getPadding(padding);\n                        }\n                    }\n                    if (this.needsMirroring()) {\n                        const left = padding.left;\n                        const right = padding.right;\n                        padding.left = right;\n                        padding.right = left;\n                    }\n                    return result;\n                }\n                setAlpha(alpha) {\n                    if (this.mAlpha != alpha) {\n                        this.mAlpha = alpha;\n                        if (this.mCurrDrawable != null) {\n                            if (this.mEnterAnimationEnd == 0) {\n                                this.mCurrDrawable.mutate().setAlpha(alpha);\n                            }\n                            else {\n                                this.animate(false);\n                            }\n                        }\n                    }\n                }\n                getAlpha() {\n                    return this.mAlpha;\n                }\n                setDither(dither) {\n                    if (this.mDrawableContainerState.mDither != dither) {\n                        this.mDrawableContainerState.mDither = dither;\n                        if (this.mCurrDrawable != null) {\n                            this.mCurrDrawable.mutate().setDither(this.mDrawableContainerState.mDither);\n                        }\n                    }\n                }\n                setEnterFadeDuration(ms) {\n                    this.mDrawableContainerState.mEnterFadeDuration = ms;\n                }\n                setExitFadeDuration(ms) {\n                    this.mDrawableContainerState.mExitFadeDuration = ms;\n                }\n                onBoundsChange(bounds) {\n                    if (this.mLastDrawable != null) {\n                        this.mLastDrawable.setBounds(bounds);\n                    }\n                    if (this.mCurrDrawable != null) {\n                        this.mCurrDrawable.setBounds(bounds);\n                    }\n                }\n                isStateful() {\n                    return this.mDrawableContainerState.isStateful();\n                }\n                setAutoMirrored(mirrored) {\n                    this.mDrawableContainerState.mAutoMirrored = mirrored;\n                    if (this.mCurrDrawable != null) {\n                        this.mCurrDrawable.mutate().setAutoMirrored(this.mDrawableContainerState.mAutoMirrored);\n                    }\n                }\n                isAutoMirrored() {\n                    return this.mDrawableContainerState.mAutoMirrored;\n                }\n                jumpToCurrentState() {\n                    let changed = false;\n                    if (this.mLastDrawable != null) {\n                        this.mLastDrawable.jumpToCurrentState();\n                        this.mLastDrawable = null;\n                        changed = true;\n                    }\n                    if (this.mCurrDrawable != null) {\n                        this.mCurrDrawable.jumpToCurrentState();\n                        this.mCurrDrawable.mutate().setAlpha(this.mAlpha);\n                    }\n                    if (this.mExitAnimationEnd != 0) {\n                        this.mExitAnimationEnd = 0;\n                        changed = true;\n                    }\n                    if (this.mEnterAnimationEnd != 0) {\n                        this.mEnterAnimationEnd = 0;\n                        changed = true;\n                    }\n                    if (changed) {\n                        this.invalidateSelf();\n                    }\n                }\n                onStateChange(state) {\n                    if (this.mLastDrawable != null) {\n                        return this.mLastDrawable.setState(state);\n                    }\n                    if (this.mCurrDrawable != null) {\n                        return this.mCurrDrawable.setState(state);\n                    }\n                    return false;\n                }\n                onLevelChange(level) {\n                    if (this.mLastDrawable != null) {\n                        return this.mLastDrawable.setLevel(level);\n                    }\n                    if (this.mCurrDrawable != null) {\n                        return this.mCurrDrawable.setLevel(level);\n                    }\n                    return false;\n                }\n                getIntrinsicWidth() {\n                    if (this.mDrawableContainerState.isConstantSize()) {\n                        return this.mDrawableContainerState.getConstantWidth();\n                    }\n                    return this.mCurrDrawable != null ? this.mCurrDrawable.getIntrinsicWidth() : -1;\n                }\n                getIntrinsicHeight() {\n                    if (this.mDrawableContainerState.isConstantSize()) {\n                        return this.mDrawableContainerState.getConstantHeight();\n                    }\n                    return this.mCurrDrawable != null ? this.mCurrDrawable.getIntrinsicHeight() : -1;\n                }\n                getMinimumWidth() {\n                    if (this.mDrawableContainerState.isConstantSize()) {\n                        return this.mDrawableContainerState.getConstantMinimumWidth();\n                    }\n                    return this.mCurrDrawable != null ? this.mCurrDrawable.getMinimumWidth() : 0;\n                }\n                getMinimumHeight() {\n                    if (this.mDrawableContainerState.isConstantSize()) {\n                        return this.mDrawableContainerState.getConstantMinimumHeight();\n                    }\n                    return this.mCurrDrawable != null ? this.mCurrDrawable.getMinimumHeight() : 0;\n                }\n                drawableSizeChange(who) {\n                    let callback = this.getCallback();\n                    if (who == this.mCurrDrawable && callback != null && callback.drawableSizeChange) {\n                        callback.drawableSizeChange(this);\n                    }\n                }\n                invalidateDrawable(who) {\n                    if (who == this.mCurrDrawable && this.getCallback() != null) {\n                        this.getCallback().invalidateDrawable(this);\n                    }\n                }\n                scheduleDrawable(who, what, when) {\n                    if (who == this.mCurrDrawable && this.getCallback() != null) {\n                        this.getCallback().scheduleDrawable(this, what, when);\n                    }\n                }\n                unscheduleDrawable(who, what) {\n                    if (who == this.mCurrDrawable && this.getCallback() != null) {\n                        this.getCallback().unscheduleDrawable(this, what);\n                    }\n                }\n                setVisible(visible, restart) {\n                    let changed = super.setVisible(visible, restart);\n                    if (this.mLastDrawable != null) {\n                        this.mLastDrawable.setVisible(visible, restart);\n                    }\n                    if (this.mCurrDrawable != null) {\n                        this.mCurrDrawable.setVisible(visible, restart);\n                    }\n                    return changed;\n                }\n                getOpacity() {\n                    return this.mCurrDrawable == null || !this.mCurrDrawable.isVisible() ? PixelFormat.TRANSPARENT :\n                        this.mDrawableContainerState.getOpacity();\n                }\n                selectDrawable(idx) {\n                    if (idx == this.mCurIndex) {\n                        return false;\n                    }\n                    const now = SystemClock.uptimeMillis();\n                    if (DrawableContainer.DEBUG)\n                        android.util.Log.i(DrawableContainer.TAG, toString() + \" from \" + this.mCurIndex + \" to \" + idx\n                            + \": exit=\" + this.mDrawableContainerState.mExitFadeDuration\n                            + \" enter=\" + this.mDrawableContainerState.mEnterFadeDuration);\n                    if (this.mDrawableContainerState.mExitFadeDuration > 0) {\n                        if (this.mLastDrawable != null) {\n                            this.mLastDrawable.setVisible(false, false);\n                        }\n                        if (this.mCurrDrawable != null) {\n                            this.mLastDrawable = this.mCurrDrawable;\n                            this.mExitAnimationEnd = now + this.mDrawableContainerState.mExitFadeDuration;\n                        }\n                        else {\n                            this.mLastDrawable = null;\n                            this.mExitAnimationEnd = 0;\n                        }\n                    }\n                    else if (this.mCurrDrawable != null) {\n                        this.mCurrDrawable.setVisible(false, false);\n                    }\n                    if (idx >= 0 && idx < this.mDrawableContainerState.mNumChildren) {\n                        const d = this.mDrawableContainerState.getChild(idx);\n                        this.mCurrDrawable = d;\n                        this.mCurIndex = idx;\n                        if (d != null) {\n                            d.mutate();\n                            if (this.mDrawableContainerState.mEnterFadeDuration > 0) {\n                                this.mEnterAnimationEnd = now + this.mDrawableContainerState.mEnterFadeDuration;\n                            }\n                            else {\n                                d.setAlpha(this.mAlpha);\n                            }\n                            d.setVisible(this.isVisible(), true);\n                            d.setDither(this.mDrawableContainerState.mDither);\n                            d.setState(this.getState());\n                            d.setLevel(this.getLevel());\n                            d.setBounds(this.getBounds());\n                            d.setAutoMirrored(this.mDrawableContainerState.mAutoMirrored);\n                        }\n                        else {\n                        }\n                    }\n                    else {\n                        this.mCurrDrawable = null;\n                        this.mCurIndex = -1;\n                    }\n                    if (this.mEnterAnimationEnd != 0 || this.mExitAnimationEnd != 0) {\n                        if (this.mAnimationRunnable == null) {\n                            let t = this;\n                            this.mAnimationRunnable = {\n                                run() {\n                                    t.animate(true);\n                                    t.invalidateSelf();\n                                }\n                            };\n                        }\n                        else {\n                            this.unscheduleSelf(this.mAnimationRunnable);\n                        }\n                        this.animate(true);\n                    }\n                    this.invalidateSelf();\n                    return true;\n                }\n                animate(schedule) {\n                    const now = SystemClock.uptimeMillis();\n                    let animating = false;\n                    if (this.mCurrDrawable != null) {\n                        if (this.mEnterAnimationEnd != 0) {\n                            if (this.mEnterAnimationEnd <= now) {\n                                this.mCurrDrawable.mutate().setAlpha(this.mAlpha);\n                                this.mEnterAnimationEnd = 0;\n                            }\n                            else {\n                                let animAlpha = ((this.mEnterAnimationEnd - now) * 255)\n                                    / this.mDrawableContainerState.mEnterFadeDuration;\n                                if (DrawableContainer.DEBUG)\n                                    android.util.Log.i(DrawableContainer.TAG, toString() + \" cur alpha \" + animAlpha);\n                                this.mCurrDrawable.mutate().setAlpha(((255 - animAlpha) * this.mAlpha) / 255);\n                                animating = true;\n                            }\n                        }\n                    }\n                    else {\n                        this.mEnterAnimationEnd = 0;\n                    }\n                    if (this.mLastDrawable != null) {\n                        if (this.mExitAnimationEnd != 0) {\n                            if (this.mExitAnimationEnd <= now) {\n                                this.mLastDrawable.setVisible(false, false);\n                                this.mLastDrawable = null;\n                                this.mExitAnimationEnd = 0;\n                            }\n                            else {\n                                let animAlpha = ((this.mExitAnimationEnd - now) * 255)\n                                    / this.mDrawableContainerState.mExitFadeDuration;\n                                if (DrawableContainer.DEBUG)\n                                    android.util.Log.i(DrawableContainer.TAG, toString() + \" last alpha \" + animAlpha);\n                                this.mLastDrawable.mutate().setAlpha((animAlpha * this.mAlpha) / 255);\n                                animating = true;\n                            }\n                        }\n                    }\n                    else {\n                        this.mExitAnimationEnd = 0;\n                    }\n                    if (schedule && animating) {\n                        this.scheduleSelf(this.mAnimationRunnable, now + 1000 / 60);\n                    }\n                }\n                getCurrent() {\n                    return this.mCurrDrawable;\n                }\n                getConstantState() {\n                    if (this.mDrawableContainerState.canConstantState()) {\n                        return this.mDrawableContainerState;\n                    }\n                    return null;\n                }\n                mutate() {\n                    if (!this.mMutated && super.mutate() == this) {\n                        this.mDrawableContainerState.mutate();\n                        this.mMutated = true;\n                    }\n                    return this;\n                }\n                setConstantState(state) {\n                    this.mDrawableContainerState = state;\n                }\n            }\n            DrawableContainer.DEBUG = Log.DBG_DrawableContainer;\n            DrawableContainer.TAG = \"DrawableContainer\";\n            DrawableContainer.DEFAULT_DITHER = true;\n            drawable.DrawableContainer = DrawableContainer;\n            (function (DrawableContainer) {\n                class DrawableContainerState {\n                    constructor(orig, owner) {\n                        this.mVariablePadding = false;\n                        this.mPaddingChecked = false;\n                        this.mConstantSize = false;\n                        this.mComputedConstantSize = false;\n                        this.mConstantWidth = 0;\n                        this.mConstantHeight = 0;\n                        this.mConstantMinimumWidth = 0;\n                        this.mConstantMinimumHeight = 0;\n                        this.mCheckedOpacity = false;\n                        this.mOpacity = 0;\n                        this.mCheckedStateful = false;\n                        this.mStateful = false;\n                        this.mCheckedConstantState = false;\n                        this.mCanConstantState = false;\n                        this.mDither = DrawableContainer.DEFAULT_DITHER;\n                        this.mMutated = false;\n                        this.mEnterFadeDuration = 0;\n                        this.mExitFadeDuration = 0;\n                        this.mAutoMirrored = false;\n                        this.mOwner = owner;\n                        if (orig != null) {\n                            this.mCheckedConstantState = true;\n                            this.mCanConstantState = true;\n                            this.mVariablePadding = orig.mVariablePadding;\n                            this.mConstantSize = orig.mConstantSize;\n                            this.mDither = orig.mDither;\n                            this.mMutated = orig.mMutated;\n                            this.mEnterFadeDuration = orig.mEnterFadeDuration;\n                            this.mExitFadeDuration = orig.mExitFadeDuration;\n                            this.mAutoMirrored = orig.mAutoMirrored;\n                            this.mConstantPadding = orig.getConstantPadding();\n                            this.mPaddingChecked = true;\n                            this.mConstantWidth = orig.getConstantWidth();\n                            this.mConstantHeight = orig.getConstantHeight();\n                            this.mConstantMinimumWidth = orig.getConstantMinimumWidth();\n                            this.mConstantMinimumHeight = orig.getConstantMinimumHeight();\n                            this.mComputedConstantSize = true;\n                            this.mOpacity = orig.getOpacity();\n                            this.mCheckedOpacity = true;\n                            this.mStateful = orig.isStateful();\n                            this.mCheckedStateful = true;\n                            const origDr = orig.mDrawables;\n                            this.mDrawables = new Array(0);\n                            const origDf = orig.mDrawableFutures;\n                            if (origDf != null) {\n                                this.mDrawableFutures = origDf.clone();\n                            }\n                            else {\n                                this.mDrawableFutures = new SparseArray(this.mNumChildren);\n                            }\n                            const N = this.mNumChildren;\n                            for (let i = 0; i < N; i++) {\n                                if (origDr[i] != null) {\n                                    this.mDrawableFutures.put(i, new ConstantStateFuture(origDr[i]));\n                                }\n                            }\n                        }\n                        else {\n                            this.mDrawables = new Array(0);\n                        }\n                    }\n                    get mNumChildren() {\n                        return this.mDrawables.length;\n                    }\n                    addChild(dr) {\n                        const pos = this.mNumChildren;\n                        dr.setVisible(false, true);\n                        dr.setCallback(this.mOwner);\n                        this.mDrawables.push(dr);\n                        this.mCheckedStateful = false;\n                        this.mCheckedOpacity = false;\n                        this.mConstantPadding = null;\n                        this.mPaddingChecked = false;\n                        this.mComputedConstantSize = false;\n                        return pos;\n                    }\n                    getCapacity() {\n                        return this.mDrawables.length;\n                    }\n                    createAllFutures() {\n                        if (this.mDrawableFutures != null) {\n                            const futureCount = this.mDrawableFutures.size();\n                            for (let keyIndex = 0; keyIndex < futureCount; keyIndex++) {\n                                const index = this.mDrawableFutures.keyAt(keyIndex);\n                                this.mDrawables[index] = this.mDrawableFutures.valueAt(keyIndex).get(this);\n                            }\n                            this.mDrawableFutures = null;\n                        }\n                    }\n                    getChildCount() {\n                        return this.mNumChildren;\n                    }\n                    getChildren() {\n                        this.createAllFutures();\n                        return this.mDrawables;\n                    }\n                    getChild(index) {\n                        const result = this.mDrawables[index];\n                        if (result != null) {\n                            return result;\n                        }\n                        if (this.mDrawableFutures != null) {\n                            const keyIndex = this.mDrawableFutures.indexOfKey(index);\n                            if (keyIndex >= 0) {\n                                const prepared = this.mDrawableFutures.valueAt(keyIndex).get(this);\n                                this.mDrawables[index] = prepared;\n                                this.mDrawableFutures.removeAt(keyIndex);\n                                return prepared;\n                            }\n                        }\n                        return null;\n                    }\n                    mutate() {\n                        const N = this.mNumChildren;\n                        const drawables = this.mDrawables;\n                        for (let i = 0; i < N; i++) {\n                            if (drawables[i] != null) {\n                                drawables[i].mutate();\n                            }\n                        }\n                        this.mMutated = true;\n                    }\n                    setVariablePadding(variable) {\n                        this.mVariablePadding = variable;\n                    }\n                    getConstantPadding() {\n                        if (this.mVariablePadding) {\n                            return null;\n                        }\n                        if ((this.mConstantPadding != null) || this.mPaddingChecked) {\n                            return this.mConstantPadding;\n                        }\n                        this.createAllFutures();\n                        let r = null;\n                        const t = new Rect();\n                        const N = this.mNumChildren;\n                        const drawables = this.mDrawables;\n                        for (let i = 0; i < N; i++) {\n                            if (drawables[i].getPadding(t)) {\n                                if (r == null)\n                                    r = new Rect(0, 0, 0, 0);\n                                if (t.left > r.left)\n                                    r.left = t.left;\n                                if (t.top > r.top)\n                                    r.top = t.top;\n                                if (t.right > r.right)\n                                    r.right = t.right;\n                                if (t.bottom > r.bottom)\n                                    r.bottom = t.bottom;\n                            }\n                        }\n                        this.mPaddingChecked = true;\n                        return (this.mConstantPadding = r);\n                    }\n                    setConstantSize(constant) {\n                        this.mConstantSize = constant;\n                    }\n                    isConstantSize() {\n                        return this.mConstantSize;\n                    }\n                    getConstantWidth() {\n                        if (!this.mComputedConstantSize) {\n                            this.computeConstantSize();\n                        }\n                        return this.mConstantWidth;\n                    }\n                    getConstantHeight() {\n                        if (!this.mComputedConstantSize) {\n                            this.computeConstantSize();\n                        }\n                        return this.mConstantHeight;\n                    }\n                    getConstantMinimumWidth() {\n                        if (!this.mComputedConstantSize) {\n                            this.computeConstantSize();\n                        }\n                        return this.mConstantMinimumWidth;\n                    }\n                    getConstantMinimumHeight() {\n                        if (!this.mComputedConstantSize) {\n                            this.computeConstantSize();\n                        }\n                        return this.mConstantMinimumHeight;\n                    }\n                    computeConstantSize() {\n                        this.mComputedConstantSize = true;\n                        this.createAllFutures();\n                        const N = this.mNumChildren;\n                        const drawables = this.mDrawables;\n                        this.mConstantWidth = this.mConstantHeight = -1;\n                        this.mConstantMinimumWidth = this.mConstantMinimumHeight = 0;\n                        for (let i = 0; i < N; i++) {\n                            const dr = drawables[i];\n                            let s = dr.getIntrinsicWidth();\n                            if (s > this.mConstantWidth)\n                                this.mConstantWidth = s;\n                            s = dr.getIntrinsicHeight();\n                            if (s > this.mConstantHeight)\n                                this.mConstantHeight = s;\n                            s = dr.getMinimumWidth();\n                            if (s > this.mConstantMinimumWidth)\n                                this.mConstantMinimumWidth = s;\n                            s = dr.getMinimumHeight();\n                            if (s > this.mConstantMinimumHeight)\n                                this.mConstantMinimumHeight = s;\n                        }\n                    }\n                    setEnterFadeDuration(duration) {\n                        this.mEnterFadeDuration = duration;\n                    }\n                    getEnterFadeDuration() {\n                        return this.mEnterFadeDuration;\n                    }\n                    setExitFadeDuration(duration) {\n                        this.mExitFadeDuration = duration;\n                    }\n                    getExitFadeDuration() {\n                        return this.mExitFadeDuration;\n                    }\n                    getOpacity() {\n                        if (this.mCheckedOpacity) {\n                            return this.mOpacity;\n                        }\n                        this.createAllFutures();\n                        this.mCheckedOpacity = true;\n                        const N = this.mNumChildren;\n                        const drawables = this.mDrawables;\n                        let op = (N > 0) ? drawables[0].getOpacity() : PixelFormat.TRANSPARENT;\n                        for (let i = 1; i < N; i++) {\n                            op = drawable.Drawable.resolveOpacity(op, drawables[i].getOpacity());\n                        }\n                        this.mOpacity = op;\n                        return op;\n                    }\n                    isStateful() {\n                        if (this.mCheckedStateful) {\n                            return this.mStateful;\n                        }\n                        this.createAllFutures();\n                        this.mCheckedStateful = true;\n                        const N = this.mNumChildren;\n                        const drawables = this.mDrawables;\n                        for (let i = 0; i < N; i++) {\n                            if (drawables[i].isStateful()) {\n                                this.mStateful = true;\n                                return true;\n                            }\n                        }\n                        this.mStateful = false;\n                        return false;\n                    }\n                    canConstantState() {\n                        if (this.mCheckedConstantState) {\n                            return this.mCanConstantState;\n                        }\n                        this.createAllFutures();\n                        this.mCheckedConstantState = true;\n                        const N = this.mNumChildren;\n                        const drawables = this.mDrawables;\n                        for (let i = 0; i < N; i++) {\n                            if (drawables[i].getConstantState() == null) {\n                                this.mCanConstantState = false;\n                                return false;\n                            }\n                        }\n                        this.mCanConstantState = true;\n                        return true;\n                    }\n                    newDrawable() {\n                        return undefined;\n                    }\n                }\n                DrawableContainer.DrawableContainerState = DrawableContainerState;\n                class ConstantStateFuture {\n                    constructor(source) {\n                        this.mConstantState = source.getConstantState();\n                    }\n                    get(state) {\n                        const result = this.mConstantState.newDrawable();\n                        result.setCallback(state.mOwner);\n                        if (state.mMutated) {\n                            result.mutate();\n                        }\n                        return result;\n                    }\n                }\n            })(DrawableContainer = drawable.DrawableContainer || (drawable.DrawableContainer = {}));\n        })(drawable = graphics.drawable || (graphics.drawable = {}));\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        var drawable;\n        (function (drawable) {\n            var SystemClock = android.os.SystemClock;\n            var Drawable = android.graphics.drawable.Drawable;\n            var DrawableContainer = android.graphics.drawable.DrawableContainer;\n            class AnimationDrawable extends DrawableContainer {\n                constructor(state) {\n                    super();\n                    this.mCurFrame = -1;\n                    let _as = new AnimationDrawable.AnimationState(state, this);\n                    this.mAnimationState = _as;\n                    this.setConstantState(_as);\n                    if (state != null) {\n                        this.setFrame(0, true, false);\n                    }\n                }\n                setVisible(visible, restart) {\n                    let changed = super.setVisible(visible, restart);\n                    if (visible) {\n                        if (changed || restart) {\n                            this.setFrame(0, true, true);\n                        }\n                    }\n                    else {\n                        this.unscheduleSelf(this);\n                    }\n                    return changed;\n                }\n                start() {\n                    if (!this.isRunning()) {\n                        this.run();\n                    }\n                }\n                stop() {\n                    if (this.isRunning()) {\n                        this.unscheduleSelf(this);\n                    }\n                }\n                isRunning() {\n                    return this.mCurFrame > -1;\n                }\n                run() {\n                    this.nextFrame(false);\n                }\n                unscheduleSelf(what) {\n                    this.mCurFrame = -1;\n                    super.unscheduleSelf(what);\n                }\n                getNumberOfFrames() {\n                    return this.mAnimationState.getChildCount();\n                }\n                getFrame(index) {\n                    return this.mAnimationState.getChild(index);\n                }\n                getDuration(i) {\n                    return this.mAnimationState.mDurations[i];\n                }\n                isOneShot() {\n                    return this.mAnimationState.mOneShot;\n                }\n                setOneShot(oneShot) {\n                    this.mAnimationState.mOneShot = oneShot;\n                }\n                addFrame(frame, duration) {\n                    this.mAnimationState.addFrame(frame, duration);\n                    if (this.mCurFrame < 0) {\n                        this.setFrame(0, true, false);\n                    }\n                }\n                nextFrame(unschedule) {\n                    let next = this.mCurFrame + 1;\n                    const N = this.mAnimationState.getChildCount();\n                    if (next >= N) {\n                        next = 0;\n                    }\n                    this.setFrame(next, unschedule, !this.mAnimationState.mOneShot || next < (N - 1));\n                }\n                setFrame(frame, unschedule, animate) {\n                    if (frame >= this.mAnimationState.getChildCount()) {\n                        return;\n                    }\n                    this.mCurFrame = frame;\n                    this.selectDrawable(frame);\n                    if (unschedule) {\n                        this.unscheduleSelf(this);\n                    }\n                    if (animate) {\n                        this.mCurFrame = frame;\n                        this.scheduleSelf(this, SystemClock.uptimeMillis() + this.mAnimationState.mDurations[frame]);\n                    }\n                }\n                inflate(r, parser) {\n                    super.inflate(r, parser);\n                    let a = r.obtainAttributes(parser);\n                    this.mAnimationState.setVariablePadding(a.getBoolean(\"android:variablePadding\", false));\n                    this.mAnimationState.mOneShot = a.getBoolean(\"android:oneshot\", false);\n                    a.recycle();\n                    for (let child of Array.from(parser.children)) {\n                        let item = child;\n                        if (item.tagName.toLowerCase() !== 'item') {\n                            continue;\n                        }\n                        a = r.obtainAttributes(item);\n                        let duration = a.getInt(\"android:duration\", -1);\n                        if (duration < 0) {\n                            throw Error(`new XmlPullParserException(parser.getPositionDescription() + \": <item> tag requires a 'duration' attribute\")`);\n                        }\n                        let dr = a.getDrawable(\"android:drawable\");\n                        a.recycle();\n                        if (!dr && item.children[0] instanceof HTMLElement) {\n                            dr = Drawable.createFromXml(r, item.children[0]);\n                        }\n                        if (!dr) {\n                            throw Error(`new XmlPullParserException(<item> tag requires a 'drawable' attribute or child tag defining a drawable)`);\n                        }\n                        this.mAnimationState.addFrame(dr, duration);\n                        if (dr != null) {\n                            dr.setCallback(this);\n                        }\n                    }\n                    this.setFrame(0, true, false);\n                }\n                mutate() {\n                    if (!this.mMutated && super.mutate() == this) {\n                        this.mAnimationState.mDurations = [...this.mAnimationState.mDurations];\n                        this.mMutated = true;\n                    }\n                    return this;\n                }\n            }\n            drawable.AnimationDrawable = AnimationDrawable;\n            (function (AnimationDrawable) {\n                class AnimationState extends DrawableContainer.DrawableContainerState {\n                    constructor(orig, owner) {\n                        super(orig, owner);\n                        if (orig != null) {\n                            this.mDurations = orig.mDurations;\n                            this.mOneShot = orig.mOneShot;\n                        }\n                        else {\n                            this.mDurations = androidui.util.ArrayCreator.newNumberArray(this.getCapacity());\n                            this.mOneShot = true;\n                        }\n                    }\n                    newDrawable() {\n                        return new AnimationDrawable(this);\n                    }\n                    addFrame(dr, dur) {\n                        let pos = super.addChild(dr);\n                        this.mDurations[pos] = dur;\n                    }\n                }\n                AnimationDrawable.AnimationState = AnimationState;\n            })(AnimationDrawable = drawable.AnimationDrawable || (drawable.AnimationDrawable = {}));\n        })(drawable = graphics.drawable || (graphics.drawable = {}));\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        var drawable;\n        (function (drawable_7) {\n            const DEBUG = android.util.Log.DBG_StateListDrawable;\n            const TAG = \"StateListDrawable\";\n            const DEFAULT_DITHER = true;\n            class StateListDrawable extends drawable_7.DrawableContainer {\n                constructor() {\n                    super();\n                    this.initWithState(null);\n                }\n                initWithState(state) {\n                    let _as = new StateListState(state, this);\n                    this.mStateListState = _as;\n                    this.setConstantState(_as);\n                    this.onStateChange(this.getState());\n                }\n                addState(stateSet, drawable) {\n                    if (drawable != null) {\n                        this.mStateListState.addStateSet(stateSet, drawable);\n                        this.onStateChange(this.getState());\n                    }\n                }\n                isStateful() {\n                    return true;\n                }\n                onStateChange(stateSet) {\n                    let idx = this.mStateListState.indexOfStateSet(stateSet);\n                    if (DEBUG)\n                        android.util.Log.i(TAG, \"onStateChange \" + this + \" states \"\n                            + stateSet + \" found \" + idx);\n                    if (idx < 0) {\n                        idx = this.mStateListState.indexOfStateSet(android.util.StateSet.WILD_CARD);\n                    }\n                    if (this.selectDrawable(idx)) {\n                        return true;\n                    }\n                    return super.onStateChange(stateSet);\n                }\n                inflate(r, parser) {\n                    super.inflate(r, parser);\n                    let a = r.obtainAttributes(parser);\n                    const state = this.mStateListState;\n                    state.mVariablePadding = a.getBoolean(\"android:variablePadding\", state.mVariablePadding);\n                    state.mConstantSize = a.getBoolean(\"android:constantSize\", state.mConstantSize);\n                    state.mEnterFadeDuration = a.getInt(\"android:enterFadeDuration\", state.mEnterFadeDuration);\n                    state.mExitFadeDuration = a.getInt(\"android:exitFadeDuration\", state.mExitFadeDuration);\n                    state.mDither = a.getBoolean(\"android:dither\", state.mDither);\n                    state.mAutoMirrored = a.getBoolean(\"android:autoMirrored\", state.mAutoMirrored);\n                    a.recycle();\n                    for (let child of Array.from(parser.children)) {\n                        let item = child;\n                        if (item.tagName.toLowerCase() !== 'item') {\n                            continue;\n                        }\n                        let dr;\n                        let stateSpec = [];\n                        let typedArray = r.obtainAttributes(item);\n                        for (let attrName of typedArray.getLowerCaseNoNamespaceAttrNames()) {\n                            if (attrName === 'drawable') {\n                                dr = typedArray.getDrawable(attrName);\n                            }\n                            else if (attrName.startsWith('state_')) {\n                                let state = attrName.substring('state_'.length);\n                                let stateValue = android.view.View['VIEW_STATE_' + state.toUpperCase()];\n                                if (typeof stateValue === \"number\") {\n                                    stateSpec.push(typedArray.getBoolean(attrName, true) ? stateValue : -stateValue);\n                                }\n                            }\n                        }\n                        if (!dr && item.children[0] instanceof HTMLElement) {\n                            dr = drawable_7.Drawable.createFromXml(r, item.children[0]);\n                        }\n                        if (!dr) {\n                            throw new Error(\": <item> tag requires a 'drawable' attribute or child tag defining a drawable\");\n                        }\n                        state.addStateSet(stateSpec, dr);\n                    }\n                    this.onStateChange(this.getState());\n                }\n                getStateListState() {\n                    return this.mStateListState;\n                }\n                getStateCount() {\n                    return this.mStateListState.getChildCount();\n                }\n                getStateSet(index) {\n                    return this.mStateListState.mStateSets[index];\n                }\n                getStateDrawable(index) {\n                    return this.mStateListState.getChild(index);\n                }\n                getStateDrawableIndex(stateSet) {\n                    return this.mStateListState.indexOfStateSet(stateSet);\n                }\n                mutate() {\n                    if (!this.mMutated && super.mutate() == this) {\n                        const sets = this.mStateListState.mStateSets;\n                        const count = sets.length;\n                        this.mStateListState.mStateSets = new Array(count);\n                        for (let i = 0; i < count; i++) {\n                            const _set = sets[i];\n                            if (_set != null) {\n                                this.mStateListState.mStateSets[i] = _set.concat();\n                            }\n                        }\n                        this.mMutated = true;\n                    }\n                    return this;\n                }\n            }\n            drawable_7.StateListDrawable = StateListDrawable;\n            class StateListState extends drawable_7.DrawableContainer.DrawableContainerState {\n                constructor(orig, owner) {\n                    super(orig, owner);\n                    if (orig != null) {\n                        this.mStateSets = orig.mStateSets.concat();\n                    }\n                    else {\n                        this.mStateSets = new Array(this.getCapacity());\n                    }\n                }\n                addStateSet(stateSet, drawable) {\n                    let pos = this.addChild(drawable);\n                    this.mStateSets[pos] = stateSet;\n                    return pos;\n                }\n                indexOfStateSet(stateSet) {\n                    const stateSets = this.mStateSets;\n                    const N = this.getChildCount();\n                    for (let i = 0; i < N; i++) {\n                        if (android.util.StateSet.stateSetMatches(stateSets[i], stateSet)) {\n                            return i;\n                        }\n                    }\n                    return -1;\n                }\n                newDrawable() {\n                    let drawable = new StateListDrawable();\n                    drawable.initWithState(this);\n                    return drawable;\n                }\n            }\n        })(drawable = graphics.drawable || (graphics.drawable = {}));\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var R;\n    (function (R) {\n        R.id = {\n            \"content\": \"content\",\n            \"background\": \"background\",\n            \"secondaryProgress\": \"secondaryProgress\",\n            \"progress\": \"progress\",\n            \"contentPanel\": \"contentPanel\",\n            \"topPanel\": \"topPanel\",\n            \"buttonPanel\": \"buttonPanel\",\n            \"customPanel\": \"customPanel\",\n            \"custom\": \"custom\",\n            \"titleDivider\": \"titleDivider\",\n            \"titleDividerTop\": \"titleDividerTop\",\n            \"title_template\": \"title_template\",\n            \"icon\": \"icon\",\n            \"alertTitle\": \"alertTitle\",\n            \"scrollView\": \"scrollView\",\n            \"message\": \"message\",\n            \"button1\": \"button1\",\n            \"button2\": \"button2\",\n            \"button3\": \"button3\",\n            \"leftSpacer\": \"leftSpacer\",\n            \"rightSpacer\": \"rightSpacer\",\n            \"text1\": \"text1\",\n            \"action_bar_center_layout\": \"action_bar_center_layout\",\n            \"action_bar_title\": \"action_bar_title\",\n            \"action_bar_sub_title\": \"action_bar_sub_title\",\n            \"action_bar_left\": \"action_bar_left\",\n            \"action_bar_right\": \"action_bar_right\",\n            \"parentPanel\": \"parentPanel\",\n            \"progress_percent\": \"progress_percent\",\n            \"progress_number\": \"progress_number\",\n            \"title\": \"title\",\n            \"shortcut\": \"shortcut\",\n            \"select_dialog_listview\": \"select_dialog_listview\"\n        };\n    })(R = android.R || (android.R = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var R;\n    (function (R) {\n        var Resources = android.content.res.Resources;\n        var Color = android.graphics.Color;\n        var InsetDrawable = android.graphics.drawable.InsetDrawable;\n        var ColorDrawable = android.graphics.drawable.ColorDrawable;\n        var LayerDrawable = android.graphics.drawable.LayerDrawable;\n        var RotateDrawable = android.graphics.drawable.RotateDrawable;\n        var ScaleDrawable = android.graphics.drawable.ScaleDrawable;\n        var AnimationDrawable = android.graphics.drawable.AnimationDrawable;\n        var StateListDrawable = android.graphics.drawable.StateListDrawable;\n        var RoundRectDrawable = android.graphics.drawable.RoundRectDrawable;\n        var ShadowDrawable = android.graphics.drawable.ShadowDrawable;\n        var Gravity = android.view.Gravity;\n        const density = Resources.getDisplayMetrics().density;\n        class drawable {\n            static get btn_default() {\n                let stateList = new StateListDrawable();\n                stateList.addState([-android.view.View.VIEW_STATE_WINDOW_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_default_normal_holo_light);\n                stateList.addState([-android.view.View.VIEW_STATE_WINDOW_FOCUSED, -android.view.View.VIEW_STATE_ENABLED], R.image.btn_default_disabled_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_PRESSED], R.image.btn_default_pressed_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_default_focused_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_ENABLED], R.image.btn_default_normal_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_FOCUSED], R.image.btn_default_disabled_focused_holo_light);\n                stateList.addState([], R.image.btn_default_disabled_holo_light);\n                return stateList;\n            }\n            static get editbox_background() {\n                let stateList = new StateListDrawable();\n                stateList.addState([android.view.View.VIEW_STATE_FOCUSED], R.image.editbox_background_focus_yellow);\n                stateList.addState([], R.image.editbox_background_normal);\n                return stateList;\n            }\n            static get btn_check() {\n                let stateList = new StateListDrawable();\n                stateList.addState([android.view.View.VIEW_STATE_CHECKED, -android.view.View.VIEW_STATE_WINDOW_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_check_on_holo_light);\n                stateList.addState([-android.view.View.VIEW_STATE_CHECKED, -android.view.View.VIEW_STATE_WINDOW_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_check_off_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_PRESSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_check_on_pressed_holo_light);\n                stateList.addState([-android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_PRESSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_check_off_pressed_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_check_on_focused_holo_light);\n                stateList.addState([-android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_check_off_focused_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_check_on_holo_light);\n                stateList.addState([-android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_check_off_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_CHECKED, -android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_check_on_disabled_holo_light);\n                stateList.addState([-android.view.View.VIEW_STATE_CHECKED, -android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_check_off_disabled_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_FOCUSED], R.image.btn_check_on_disabled_focused_holo_light);\n                stateList.addState([-android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_FOCUSED], R.image.btn_check_off_disabled_focused_holo_light);\n                stateList.addState([-android.view.View.VIEW_STATE_CHECKED], R.image.btn_check_off_disabled_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_CHECKED], R.image.btn_check_on_disabled_holo_light);\n                return stateList;\n            }\n            static get btn_radio() {\n                let stateList = new StateListDrawable();\n                stateList.addState([android.view.View.VIEW_STATE_CHECKED, -android.view.View.VIEW_STATE_WINDOW_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_radio_on_holo_light);\n                stateList.addState([-android.view.View.VIEW_STATE_CHECKED, -android.view.View.VIEW_STATE_WINDOW_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_radio_off_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_PRESSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_radio_on_pressed_holo_light);\n                stateList.addState([-android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_PRESSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_radio_off_pressed_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_radio_on_focused_holo_light);\n                stateList.addState([-android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_radio_off_focused_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_radio_on_holo_light);\n                stateList.addState([-android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_radio_off_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_CHECKED, -android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_radio_on_disabled_holo_light);\n                stateList.addState([-android.view.View.VIEW_STATE_CHECKED, -android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_radio_off_disabled_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_FOCUSED], R.image.btn_radio_on_disabled_focused_holo_light);\n                stateList.addState([-android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_FOCUSED], R.image.btn_radio_off_disabled_focused_holo_light);\n                stateList.addState([-android.view.View.VIEW_STATE_CHECKED], R.image.btn_radio_off_disabled_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_CHECKED], R.image.btn_radio_on_disabled_holo_light);\n                return stateList;\n            }\n            static get progress_small_holo() {\n                let rotate1 = new RotateDrawable(null);\n                rotate1.mState.mDrawable = R.image.spinner_16_outer_holo;\n                rotate1.mState.mPivotXRel = true;\n                rotate1.mState.mPivotX = 0.5;\n                rotate1.mState.mPivotYRel = true;\n                rotate1.mState.mPivotY = 0.5;\n                rotate1.mState.mFromDegrees = 0;\n                rotate1.mState.mToDegrees = 1080;\n                let rotate2 = new RotateDrawable(null);\n                rotate2.mState.mDrawable = R.image.spinner_16_inner_holo;\n                rotate2.mState.mPivotXRel = true;\n                rotate2.mState.mPivotX = 0.5;\n                rotate2.mState.mPivotYRel = true;\n                rotate2.mState.mPivotY = 0.5;\n                rotate2.mState.mFromDegrees = 720;\n                rotate2.mState.mToDegrees = 0;\n                return new LayerDrawable([rotate1, rotate2]);\n            }\n            static get progress_medium_holo() {\n                let rotate1 = new RotateDrawable(null);\n                rotate1.mState.mDrawable = R.image.spinner_48_outer_holo;\n                rotate1.mState.mPivotXRel = true;\n                rotate1.mState.mPivotX = 0.5;\n                rotate1.mState.mPivotYRel = true;\n                rotate1.mState.mPivotY = 0.5;\n                rotate1.mState.mFromDegrees = 0;\n                rotate1.mState.mToDegrees = 1080;\n                let rotate2 = new RotateDrawable(null);\n                rotate2.mState.mDrawable = R.image.spinner_48_inner_holo;\n                rotate2.mState.mPivotXRel = true;\n                rotate2.mState.mPivotX = 0.5;\n                rotate2.mState.mPivotYRel = true;\n                rotate2.mState.mPivotY = 0.5;\n                rotate2.mState.mFromDegrees = 720;\n                rotate2.mState.mToDegrees = 0;\n                return new LayerDrawable([rotate1, rotate2]);\n            }\n            static get progress_large_holo() {\n                let rotate1 = new RotateDrawable(null);\n                rotate1.mState.mDrawable = R.image.spinner_76_outer_holo;\n                rotate1.mState.mPivotXRel = true;\n                rotate1.mState.mPivotX = 0.5;\n                rotate1.mState.mPivotYRel = true;\n                rotate1.mState.mPivotY = 0.5;\n                rotate1.mState.mFromDegrees = 0;\n                rotate1.mState.mToDegrees = 1080;\n                let rotate2 = new RotateDrawable(null);\n                rotate2.mState.mDrawable = R.image.spinner_76_inner_holo;\n                rotate2.mState.mPivotXRel = true;\n                rotate2.mState.mPivotX = 0.5;\n                rotate2.mState.mPivotYRel = true;\n                rotate2.mState.mPivotY = 0.5;\n                rotate2.mState.mFromDegrees = 720;\n                rotate2.mState.mToDegrees = 0;\n                return new LayerDrawable([rotate1, rotate2]);\n            }\n            static get progress_horizontal_holo() {\n                let layerDrawable = new LayerDrawable(null);\n                let returnHeight = () => 3 * density;\n                let insetTopBottom = Math.floor(8 * density);\n                let bg = new ColorDrawable(0x4c000000);\n                bg.getIntrinsicHeight = returnHeight;\n                layerDrawable.addLayer(bg, R.id.background, 0, insetTopBottom, 0, insetTopBottom);\n                let secondary = new ScaleDrawable(new ColorDrawable(0x4c33b5e5), Gravity.LEFT, 1, -1);\n                secondary.getIntrinsicHeight = returnHeight;\n                layerDrawable.addLayer(secondary, R.id.secondaryProgress, 0, insetTopBottom, 0, insetTopBottom);\n                let progress = new ScaleDrawable(new ColorDrawable(0xcc33b5e5), Gravity.LEFT, 1, -1);\n                progress.getIntrinsicHeight = returnHeight;\n                layerDrawable.addLayer(progress, R.id.progress, 0, insetTopBottom, 0, insetTopBottom);\n                layerDrawable.ensurePadding();\n                layerDrawable.onStateChange(layerDrawable.getState());\n                return layerDrawable;\n            }\n            static get progress_indeterminate_horizontal_holo() {\n                let animDrawable = new AnimationDrawable();\n                animDrawable.setOneShot(false);\n                let frame = R.image.progressbar_indeterminate_holo1;\n                frame.setCallback(animDrawable);\n                animDrawable.addFrame(frame, 50);\n                frame = R.image.progressbar_indeterminate_holo2;\n                frame.setCallback(animDrawable);\n                animDrawable.addFrame(frame, 50);\n                frame = R.image.progressbar_indeterminate_holo3;\n                frame.setCallback(animDrawable);\n                animDrawable.addFrame(frame, 50);\n                frame = R.image.progressbar_indeterminate_holo4;\n                frame.setCallback(animDrawable);\n                animDrawable.addFrame(frame, 50);\n                frame = R.image.progressbar_indeterminate_holo5;\n                frame.setCallback(animDrawable);\n                animDrawable.addFrame(frame, 50);\n                frame = R.image.progressbar_indeterminate_holo6;\n                frame.setCallback(animDrawable);\n                animDrawable.addFrame(frame, 50);\n                frame = R.image.progressbar_indeterminate_holo7;\n                frame.setCallback(animDrawable);\n                animDrawable.addFrame(frame, 50);\n                frame = R.image.progressbar_indeterminate_holo8;\n                frame.setCallback(animDrawable);\n                animDrawable.addFrame(frame, 50);\n                return animDrawable;\n            }\n            static get ratingbar_full_empty_holo_light() {\n                let stateList = new StateListDrawable();\n                stateList.addState([android.view.View.VIEW_STATE_PRESSED, android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_rating_star_off_pressed_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_rating_star_off_pressed_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_SELECTED, android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_rating_star_off_pressed_holo_light);\n                stateList.addState([], R.image.btn_rating_star_off_normal_holo_light);\n                return stateList;\n            }\n            static get ratingbar_full_filled_holo_light() {\n                let stateList = new StateListDrawable();\n                stateList.addState([android.view.View.VIEW_STATE_PRESSED, android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_rating_star_on_pressed_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_rating_star_on_pressed_holo_light);\n                stateList.addState([android.view.View.VIEW_STATE_SELECTED, android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_rating_star_on_pressed_holo_light);\n                stateList.addState([], R.image.btn_rating_star_on_normal_holo_light);\n                return stateList;\n            }\n            static get ratingbar_full_holo_light() {\n                let layerDrawable = new LayerDrawable(null);\n                layerDrawable.addLayer(R.drawable.ratingbar_full_empty_holo_light, R.id.background);\n                layerDrawable.addLayer(R.drawable.ratingbar_full_empty_holo_light, R.id.secondaryProgress);\n                layerDrawable.addLayer(R.drawable.ratingbar_full_filled_holo_light, R.id.progress);\n                layerDrawable.ensurePadding();\n                layerDrawable.onStateChange(layerDrawable.getState());\n                return layerDrawable;\n            }\n            static get ratingbar_holo_light() {\n                let layerDrawable = new LayerDrawable(null);\n                layerDrawable.addLayer(R.image.rate_star_big_off_holo_light, R.id.background);\n                layerDrawable.addLayer(R.image.rate_star_big_half_holo_light, R.id.secondaryProgress);\n                layerDrawable.addLayer(R.image.rate_star_big_on_holo_light, R.id.progress);\n                layerDrawable.ensurePadding();\n                layerDrawable.onStateChange(layerDrawable.getState());\n                return layerDrawable;\n            }\n            static get ratingbar_small_holo_light() {\n                let layerDrawable = new LayerDrawable(null);\n                layerDrawable.addLayer(R.image.rate_star_small_off_holo_light, R.id.background);\n                layerDrawable.addLayer(R.image.rate_star_small_half_holo_light, R.id.secondaryProgress);\n                layerDrawable.addLayer(R.image.rate_star_small_on_holo_light, R.id.progress);\n                layerDrawable.ensurePadding();\n                layerDrawable.onStateChange(layerDrawable.getState());\n                return layerDrawable;\n            }\n            static get scrubber_control_selector_holo() {\n                let stateList = new StateListDrawable();\n                stateList.addState([-android.view.View.VIEW_STATE_ENABLED], R.image.scrubber_control_disabled_holo);\n                stateList.addState([android.view.View.VIEW_STATE_PRESSED], R.image.scrubber_control_pressed_holo);\n                stateList.addState([android.view.View.VIEW_STATE_SELECTED], R.image.scrubber_control_focused_holo);\n                stateList.addState([], R.image.scrubber_control_normal_holo);\n                return stateList;\n            }\n            static get scrubber_progress_horizontal_holo_light() {\n                let layerDrawable = new LayerDrawable(null);\n                layerDrawable.addLayer(R.drawable.scrubber_track_holo_light, R.id.background);\n                let secondary = new ScaleDrawable(R.drawable.scrubber_secondary_holo, Gravity.LEFT, 1, -1);\n                layerDrawable.addLayer(secondary, R.id.secondaryProgress);\n                let progress = new ScaleDrawable(R.drawable.scrubber_primary_holo, Gravity.LEFT, 1, -1);\n                layerDrawable.addLayer(progress, R.id.progress);\n                layerDrawable.ensurePadding();\n                layerDrawable.onStateChange(layerDrawable.getState());\n                return layerDrawable;\n            }\n            static get scrubber_primary_holo() {\n                let line = new ColorDrawable(0xff33b5e5);\n                line.getIntrinsicHeight = () => 3 * density;\n                return new InsetDrawable(line, 0, 5 * density, 0, 5 * density);\n            }\n            static get scrubber_secondary_holo() {\n                let line = new ColorDrawable(0x4c33b5e5);\n                line.getIntrinsicHeight = () => 3 * density;\n                return new InsetDrawable(line, 0, 5 * density, 0, 5 * density);\n            }\n            static get scrubber_track_holo_light() {\n                let line = new ColorDrawable(0x66666666);\n                line.getIntrinsicHeight = () => 1 * density;\n                return new InsetDrawable(line, 0, 6 * density, 0, 6 * density);\n            }\n            static get list_selector_background() {\n                return this.item_background;\n            }\n            static get list_divider() {\n                let divider = new ColorDrawable(0xffcccccc);\n                return divider;\n            }\n            static get divider_vertical() {\n                return this.divider_horizontal;\n            }\n            static get divider_horizontal() {\n                let divider = new ColorDrawable(0xffdddddd);\n                divider.getIntrinsicWidth = () => 1;\n                divider.getIntrinsicHeight = () => 1;\n                return divider;\n            }\n            static get item_background() {\n                let stateList = new StateListDrawable();\n                stateList.addState([android.view.View.VIEW_STATE_FOCUSED, -android.view.View.VIEW_STATE_ENABLED], new ColorDrawable(0xffebebeb));\n                stateList.addState([android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_PRESSED], new ColorDrawable(0x88888888));\n                stateList.addState([-android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_PRESSED], new ColorDrawable(0x88888888));\n                stateList.addState([android.view.View.VIEW_STATE_FOCUSED], new ColorDrawable(0xffaaaaaa));\n                stateList.addState([], new ColorDrawable(Color.TRANSPARENT));\n                return stateList;\n            }\n            static get toast_frame() {\n                let bg = new RoundRectDrawable(0xff333333, 2 * density, 2 * density, 2 * density, 2 * density);\n                bg.getIntrinsicHeight = () => 32 * density;\n                bg.getPadding = (rect) => {\n                    rect.set(12 * density, 6 * density, 12 * density, 6 * density);\n                    return true;\n                };\n                let shadow = new ShadowDrawable(bg, 5 * density, 0, 2 * density, 0x44000000);\n                return new InsetDrawable(shadow, 7 * density);\n            }\n        }\n        R.drawable = drawable;\n    })(R = android.R || (android.R = {}));\n})(android || (android = {}));\nvar androidui;\n(function (androidui) {\n    var image;\n    (function (image_2) {\n        var Rect = android.graphics.Rect;\n        var Color = android.graphics.Color;\n        var Canvas = android.graphics.Canvas;\n        class NinePatchDrawable extends image_2.NetDrawable {\n            constructor() {\n                super(...arguments);\n                this.mTmpRect = new Rect();\n                this.mTmpRect2 = new Rect();\n            }\n            initBoundWithLoadedImage(image) {\n                let imageRatio = image.getImageRatio();\n                this.mImageWidth = Math.floor((image.width - 2) / imageRatio * android.content.res.Resources.getDisplayMetrics().density);\n                this.mImageHeight = Math.floor((image.height - 2) / imageRatio * android.content.res.Resources.getDisplayMetrics().density);\n                this.initNinePatchBorderInfo(image);\n            }\n            initNinePatchBorderInfo(image) {\n                this.mNinePatchBorderInfo = NinePatchDrawable.GlobalBorderInfoCache.get(image.src);\n                if (!this.mNinePatchBorderInfo) {\n                    image.getBorderPixels((leftBorder, topBorder, rightBorder, bottomBorder) => {\n                        this.mNinePatchBorderInfo = new NinePatchBorderInfo(leftBorder, topBorder, rightBorder, bottomBorder);\n                        NinePatchDrawable.GlobalBorderInfoCache.set(image.src, this.mNinePatchBorderInfo);\n                    });\n                }\n            }\n            onLoad() {\n                let image = this.getImage();\n                let ninePatchBorderInfo = NinePatchDrawable.GlobalBorderInfoCache.get(image.src);\n                if (ninePatchBorderInfo) {\n                    this.mNinePatchBorderInfo = ninePatchBorderInfo;\n                    super.onLoad();\n                    return;\n                }\n                image.getBorderPixels((leftBorder, topBorder, rightBorder, bottomBorder) => {\n                    ninePatchBorderInfo = new NinePatchBorderInfo(leftBorder, topBorder, rightBorder, bottomBorder);\n                    NinePatchDrawable.GlobalBorderInfoCache.set(image.src, ninePatchBorderInfo);\n                    super.onLoad();\n                });\n            }\n            draw(canvas) {\n                if (!this.mNinePatchBorderInfo)\n                    return;\n                if (!this.isImageSizeEmpty()) {\n                    let cache = this.getNinePatchCache();\n                    if (cache) {\n                        canvas.drawCanvas(cache);\n                    }\n                    else {\n                        this.drawNinePatch(canvas);\n                    }\n                }\n            }\n            getNinePatchCache() {\n                let bound = this.getBounds();\n                let width = bound.width();\n                let height = bound.height();\n                let cache = this.mNinePatchDrawCache;\n                if (cache) {\n                    if (cache.getWidth() === width && cache.getHeight() === height) {\n                        return cache;\n                    }\n                    cache.recycle();\n                }\n                const cachePixelSize = width * height * 4;\n                const drawingCacheSize = android.view.ViewConfiguration.get().getScaledMaximumDrawingCacheSize();\n                if (cachePixelSize > drawingCacheSize)\n                    return null;\n                cache = this.mNinePatchDrawCache = new Canvas(bound.width(), bound.height());\n                this.drawNinePatch(cache);\n                return cache;\n            }\n            drawNinePatch(canvas) {\n                let smoothEnableBak = canvas.isImageSmoothingEnabled();\n                canvas.setImageSmoothingEnabled(false);\n                let imageWidth = this.mImageWidth;\n                let imageHeight = this.mImageHeight;\n                if (imageHeight <= 0 || imageWidth <= 0)\n                    return;\n                let image = this.getImage();\n                let bound = this.getBounds();\n                const staticRatioScale = android.content.res.Resources.getDisplayMetrics().density / image.getImageRatio();\n                const staticWidthSum = this.mNinePatchBorderInfo.getHorizontalStaticLengthSum();\n                const staticHeightSum = this.mNinePatchBorderInfo.getVerticalStaticLengthSum();\n                let extraWidth = bound.width() - Math.floor(staticWidthSum * staticRatioScale);\n                let extraHeight = bound.height() - Math.floor(staticHeightSum * staticRatioScale);\n                let staticWidthPartScale = (extraWidth >= 0 || staticWidthSum == 0) ? 1 : bound.width() / staticWidthSum;\n                let staticHeightPartScale = (extraHeight >= 0 || staticHeightSum == 0) ? 1 : bound.height() / staticHeightSum;\n                staticWidthPartScale *= staticRatioScale;\n                staticHeightPartScale *= staticRatioScale;\n                const scaleHorizontalWeightSum = this.mNinePatchBorderInfo.getHorizontalScaleLengthSum();\n                const scaleVerticalWeightSum = this.mNinePatchBorderInfo.getVerticalScaleLengthSum();\n                const drawColumn = (srcFromX, srcToX, dstFromX, dstToX) => {\n                    const heightParts = this.mNinePatchBorderInfo.getVerticalTypedValues();\n                    let srcFromY = 1;\n                    let dstFromY = 0;\n                    for (let i = 0, size = heightParts.length; i < size; i++) {\n                        let typedValue = heightParts[i];\n                        let isScalePart = NinePatchBorderInfo.isScaleType(typedValue);\n                        let srcHeight = NinePatchBorderInfo.getValueUnpack(typedValue);\n                        if (srcHeight <= 0)\n                            continue;\n                        let dstHeight;\n                        if (isScalePart) {\n                            if (scaleVerticalWeightSum == 0)\n                                continue;\n                            dstHeight = extraHeight * srcHeight / scaleVerticalWeightSum;\n                            if (dstHeight <= 0)\n                                continue;\n                        }\n                        else {\n                            dstHeight = srcHeight * staticHeightPartScale;\n                        }\n                        let srcRect = this.mTmpRect;\n                        let dstRect = this.mTmpRect2;\n                        srcRect.set(srcFromX, srcFromY, srcToX, srcFromY + srcHeight);\n                        dstRect.set(dstFromX, dstFromY, dstToX, dstFromY + dstHeight);\n                        if (srcRect.bottom === image.height - 1)\n                            srcRect.bottom -= 0.5;\n                        if (srcRect.right === image.width - 1)\n                            srcRect.right -= 0.5;\n                        canvas.drawImage(image, srcRect, dstRect);\n                        srcFromY += srcHeight;\n                        dstFromY += dstHeight;\n                    }\n                };\n                const widthParts = this.mNinePatchBorderInfo.getHorizontalTypedValues();\n                let srcFromX = 1;\n                let dstFromX = 0;\n                for (let i = 0, size = widthParts.length; i < size; i++) {\n                    let typedValue = widthParts[i];\n                    let isScalePart = NinePatchBorderInfo.isScaleType(typedValue);\n                    let srcWidth = NinePatchBorderInfo.getValueUnpack(typedValue);\n                    let dstWidth;\n                    if (isScalePart) {\n                        dstWidth = extraWidth * srcWidth / scaleHorizontalWeightSum;\n                    }\n                    else {\n                        dstWidth = srcWidth * staticWidthPartScale;\n                    }\n                    if (dstWidth <= 0)\n                        continue;\n                    drawColumn(srcFromX, srcFromX + srcWidth, dstFromX, dstFromX + dstWidth);\n                    srcFromX += srcWidth;\n                    dstFromX += dstWidth;\n                }\n                canvas.setImageSmoothingEnabled(smoothEnableBak);\n            }\n            getPadding(padding) {\n                let info = this.mNinePatchBorderInfo;\n                if (!info)\n                    return false;\n                let imageRatio = this.getImage() && this.getImage().getImageRatio() || 1;\n                const staticRatioScale = android.content.res.Resources.getDisplayMetrics().density / imageRatio;\n                padding.set(Math.floor(info.getPaddingLeft() * staticRatioScale), Math.floor(info.getPaddingTop() * staticRatioScale), Math.floor(info.getPaddingRight() * staticRatioScale), Math.floor(info.getPaddingBottom() * staticRatioScale));\n                return true;\n            }\n        }\n        NinePatchDrawable.GlobalBorderInfoCache = new Map();\n        image_2.NinePatchDrawable = NinePatchDrawable;\n        class NinePatchBorderInfo {\n            constructor(leftBorder, topBorder, rightBorder, bottomBorder) {\n                this.horizontalStaticLengthSum = 0;\n                this.horizontalScaleLengthSum = 0;\n                this.verticalStaticLengthSum = 0;\n                this.verticalScaleLengthSum = 0;\n                this.paddingLeft = 0;\n                this.paddingTop = 0;\n                this.paddingRight = 0;\n                this.paddingBottom = 0;\n                this.horizontalTypedValues = [];\n                this.verticalTypedValues = [];\n                let tmpLength = 0;\n                let currentStatic = true;\n                for (let color of leftBorder) {\n                    let isScaleColor = NinePatchBorderInfo.isScaleColor(color);\n                    let typeChange = (isScaleColor && currentStatic) || (!isScaleColor && !currentStatic);\n                    if (typeChange) {\n                        let lengthValue = currentStatic ? tmpLength : -tmpLength;\n                        if (currentStatic)\n                            this.verticalStaticLengthSum += tmpLength;\n                        this.verticalTypedValues.push(lengthValue);\n                        tmpLength = 1;\n                    }\n                    else {\n                        tmpLength++;\n                    }\n                    currentStatic = !isScaleColor;\n                }\n                if (currentStatic)\n                    this.verticalStaticLengthSum += tmpLength;\n                this.verticalScaleLengthSum = leftBorder.length - this.verticalStaticLengthSum;\n                this.verticalTypedValues.push(currentStatic ? tmpLength : -tmpLength);\n                tmpLength = 0;\n                currentStatic = true;\n                for (let color of topBorder) {\n                    let isScaleColor = NinePatchBorderInfo.isScaleColor(color);\n                    let typeChange = (isScaleColor && currentStatic) || (!isScaleColor && !currentStatic);\n                    if (typeChange) {\n                        let lengthValue = currentStatic ? tmpLength : -tmpLength;\n                        if (currentStatic)\n                            this.horizontalStaticLengthSum += tmpLength;\n                        this.horizontalTypedValues.push(lengthValue);\n                        tmpLength = 1;\n                    }\n                    else {\n                        tmpLength++;\n                    }\n                    currentStatic = !isScaleColor;\n                }\n                if (currentStatic)\n                    this.horizontalStaticLengthSum += tmpLength;\n                this.horizontalScaleLengthSum = topBorder.length - this.horizontalStaticLengthSum;\n                this.horizontalTypedValues.push(currentStatic ? tmpLength : -tmpLength);\n                if (this.horizontalTypedValues.length >= 3) {\n                    this.paddingLeft = Math.max(0, this.horizontalTypedValues[0]);\n                    this.paddingRight = Math.max(0, this.horizontalTypedValues[this.horizontalTypedValues.length - 1]);\n                }\n                if (this.verticalTypedValues.length >= 3) {\n                    this.paddingTop = Math.max(0, this.verticalTypedValues[0]);\n                    this.paddingBottom = Math.max(0, this.verticalTypedValues[this.verticalTypedValues.length - 1]);\n                }\n                for (let i = 0, length = rightBorder.length; i < length; i++) {\n                    if (NinePatchBorderInfo.isScaleColor(rightBorder[i])) {\n                        this.paddingTop = i;\n                        break;\n                    }\n                }\n                for (let i = 0, length = rightBorder.length; i < length; i++) {\n                    if (NinePatchBorderInfo.isScaleColor(rightBorder[length - 1 - i])) {\n                        this.paddingBottom = i;\n                        break;\n                    }\n                }\n                for (let i = 0, length = bottomBorder.length; i < length; i++) {\n                    if (NinePatchBorderInfo.isScaleColor(bottomBorder[i])) {\n                        this.paddingLeft = i;\n                        break;\n                    }\n                }\n                for (let i = 0, length = bottomBorder.length; i < length; i++) {\n                    if (NinePatchBorderInfo.isScaleColor(bottomBorder[length - 1 - i])) {\n                        this.paddingRight = i;\n                        break;\n                    }\n                }\n            }\n            static isScaleColor(color) {\n                return Color.alpha(color) > 200 && Color.red(color) < 50 && Color.green(color) < 50 && Color.blue(color) < 50;\n            }\n            static isScaleType(typedValue) {\n                return typedValue < 0;\n            }\n            static getValueUnpack(typedValue) {\n                return Math.abs(typedValue);\n            }\n            getHorizontalTypedValues() {\n                return this.horizontalTypedValues;\n            }\n            getHorizontalStaticLengthSum() {\n                return this.horizontalStaticLengthSum;\n            }\n            getHorizontalScaleLengthSum() {\n                return this.horizontalScaleLengthSum;\n            }\n            getVerticalTypedValues() {\n                return this.verticalTypedValues;\n            }\n            getVerticalStaticLengthSum() {\n                return this.verticalStaticLengthSum;\n            }\n            getVerticalScaleLengthSum() {\n                return this.verticalScaleLengthSum;\n            }\n            getPaddingLeft() {\n                return this.paddingLeft;\n            }\n            getPaddingTop() {\n                return this.paddingTop;\n            }\n            getPaddingRight() {\n                return this.paddingRight;\n            }\n            getPaddingBottom() {\n                return this.paddingBottom;\n            }\n        }\n    })(image = androidui.image || (androidui.image = {}));\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var image;\n    (function (image) {\n        var Drawable = android.graphics.drawable.Drawable;\n        var Rect = android.graphics.Rect;\n        class ChangeImageSizeDrawable extends Drawable {\n            constructor(drawable, overrideWidth, overrideHeight = overrideWidth) {\n                super();\n                this.mTmpRect = new Rect();\n                this.mMutated = false;\n                this.mState = new State(null, this);\n                this.mState.mDrawable = drawable;\n                this.mState.mOverrideWidth = overrideWidth;\n                this.mState.mOverrideHeight = overrideHeight;\n                if (drawable != null) {\n                    drawable.setCallback(this);\n                }\n            }\n            drawableSizeChange(who) {\n                const callback = this.getCallback();\n                if (callback != null && callback.drawableSizeChange) {\n                    callback.drawableSizeChange(this);\n                }\n            }\n            invalidateDrawable(who) {\n                const callback = this.getCallback();\n                if (callback != null) {\n                    callback.invalidateDrawable(this);\n                }\n            }\n            scheduleDrawable(who, what, when) {\n                const callback = this.getCallback();\n                if (callback != null) {\n                    callback.scheduleDrawable(this, what, when);\n                }\n            }\n            unscheduleDrawable(who, what) {\n                const callback = this.getCallback();\n                if (callback != null) {\n                    callback.unscheduleDrawable(this, what);\n                }\n            }\n            draw(canvas) {\n                this.mState.mDrawable.draw(canvas);\n            }\n            getPadding(padding) {\n                return this.mState.mDrawable.getPadding(padding);\n            }\n            setVisible(visible, restart) {\n                this.mState.mDrawable.setVisible(visible, restart);\n                return super.setVisible(visible, restart);\n            }\n            setAlpha(alpha) {\n                this.mState.mDrawable.setAlpha(alpha);\n            }\n            getAlpha() {\n                return this.mState.mDrawable.getAlpha();\n            }\n            getOpacity() {\n                return this.mState.mDrawable.getOpacity();\n            }\n            isStateful() {\n                return this.mState.mDrawable.isStateful();\n            }\n            onStateChange(state) {\n                let changed = this.mState.mDrawable.setState(state);\n                this.onBoundsChange(this.getBounds());\n                return changed;\n            }\n            onBoundsChange(r) {\n                this.mState.mDrawable.setBounds(r.left, r.top, r.right, r.bottom);\n            }\n            getIntrinsicWidth() {\n                return this.mState.mOverrideWidth;\n            }\n            getIntrinsicHeight() {\n                return this.mState.mOverrideHeight;\n            }\n            getConstantState() {\n                if (this.mState.canConstantState()) {\n                    return this.mState;\n                }\n                return null;\n            }\n            mutate() {\n                if (!this.mMutated && super.mutate() == this) {\n                    this.mState.mDrawable.mutate();\n                    this.mMutated = true;\n                }\n                return this;\n            }\n            getDrawable() {\n                return this.mState.mDrawable;\n            }\n        }\n        image.ChangeImageSizeDrawable = ChangeImageSizeDrawable;\n        class State {\n            constructor(orig, owner) {\n                this.mOverrideWidth = 0;\n                this.mOverrideHeight = 0;\n                if (orig != null) {\n                    this.mDrawable = orig.mDrawable.getConstantState().newDrawable();\n                    this.mDrawable.setCallback(owner);\n                    this.mOverrideWidth = orig.mOverrideWidth;\n                    this.mOverrideHeight = orig.mOverrideHeight;\n                    this.mCheckedConstantState = this.mCanConstantState = true;\n                }\n            }\n            newDrawable() {\n                let drawable = new ChangeImageSizeDrawable(null, 0);\n                drawable.mState = new State(this, drawable);\n                return drawable;\n            }\n            canConstantState() {\n                if (!this.mCheckedConstantState) {\n                    this.mCanConstantState = this.mDrawable.getConstantState() != null;\n                    this.mCheckedConstantState = true;\n                }\n                return this.mCanConstantState;\n            }\n        }\n    })(image = androidui.image || (androidui.image = {}));\n})(androidui || (androidui = {}));\nvar android;\n(function (android) {\n    var R;\n    (function (R) {\n        var NetImage = androidui.image.NetImage;\n        var data = {\n            \"actionbar_ic_back_white\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAzCAMAAABR9YM8AAAAclBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////9eWEHEAAAAJXRSTlMA+wjy9g/JaUDVsqZONr6IFePdmHhbJBzr6c4tVEm9o5OCcF0v6lgICQAAALZJREFUOMu11EcSgzAQRFEZRBbZJjtb97+iS1PFrpuV+Nu3UphRpFq3KSNr7cLJdpCu1pVweiNKhGpOL0S3i6Me0Sb0RGSECkR3oRxRqoUCShWiMqT0E4ojQOtEaRDKGkQtpVGoGxF1lJrMUTtQmhFFi6NpRRQ7ChGpQqhUKHkVo2DZfmh6+0t0gLFvTLVgcICVBwTf9oHRCOa+cdtHhQ9m4Ru/9gATwf4crBVfdlpxnBXpE87mD+wlJVcMMSJcAAAAAElFTkSuQmCC\"\n            ],\n            \"btn_check_off_disabled_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAFVBMVEUAAAAAmcwzMzMAmcwAmcwAmcwAmcySYuXAAAAAB3RSTlMAZk1gRhAMJ+/C7AAAAGhJREFUWMPt1rEJgFAMBuE02gedwA0EtRcXEFxAcP8dXCDvb14gzV3/9WdEVNJwebPtDsDnoiMApwJzAFYFpgC4WzP3JLA0SgQWBgAAAAAAANAJ8m+m5Mj0JGZs6KPAHoBRrfRrRFTRD3MwONmn2VynAAAAAElFTkSuQmCC\"\n            ],\n            \"btn_check_off_disabled_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgAQMAAADYVuV7AAAABlBMVEUAAAAzMzPI8eYgAAAAAnRSTlMATX7+8BUAAAAhSURBVDjLYxgFZIP/YICNcwBEMI9yRjkkcPCkqlFALgAAVYo5bSUJskUAAAAASUVORK5CYII=\"\n            ],\n            \"btn_check_off_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAMFBMVEUAAAAAmcwAmcwAmcwxNTcAmcwAmcwAmcwAmcwAmcwAmcwvOT0AmcwAmcwAmcwAmczmhCwqAAAAEHRSTlMAmRIfzgUJGg4WJtCScyQtx2HoRgAAAORJREFUWMNjGAWjYEgC1lAcIACr8tDQNJwgNBSL8WEdSjhBR2oApgVN04uNcQDzSo1QDAsi9O8I4gRnP7ViaEj6I4gHnFcLQNfQeRGfBtkZ6BpC2w/i0yBTga6BTV1QcNVj7H62WyUoWJSApiFMWVBwcSX2QJ1uJSholIpFw/PdLljB7jocGiy3YNfgPRmHBiMX7GnMRXlUw6iGUQ2jGkY1jGoY1TCqgRINhBsnlDd/CDewKG3CsRJqJJLeDKW0ocsQpoWvKb0oFbOxnoSvsa4WSn53AKEDX4cjgNQuzSgYBUMRAABvBwmfTLNSCwAAAABJRU5ErkJggg==\"\n            ],\n            \"btn_check_off_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgAQMAAADYVuV7AAAABlBMVEUAAAAzMzPI8eYgAAAAAnRSTlMAzORBQ6MAAAAhSURBVDjLYxgFZIP/YICNcwBEMI9yRjkkcPCkqlFALgAAVYo5bSUJskUAAAAASUVORK5CYII=\"\n            ],\n            \"btn_check_off_pressed_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAGFBMVEVPT080NDQ0NDRHR0cAAABPT09PT09PT0+86ZyxAAAACHRSTlMm1MgyABYeBtShLDEAAAB4SURBVFjD7dixDYAwEATBSzAxLdACLbxzAkukLoGE/qEAXmIlZ9ym1uTvU8TV9bFyRCiqQO0BnYASqkI1nQzM2hmY1Bkocs4Nak1KwZKUg+21HCQvBgYGBgYGBv8A+HRI4uePc25M+IuPRwQ8U+AhhE4tfMzBc9ENzCYkZWqWtP8AAAAASUVORK5CYII=\"\n            ],\n            \"btn_check_on_disabled_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAMFBMVEUAAAAAmcw9PT09PT09PT09PT09PT0AmcwAmcwAmcw9PT09PT09PT09PT0Amcw9PT1vR1UqAAAAEHRSTlMAZoBNQTg7Xj8IR0pEMVYjBJa89wAAASlJREFUWMPt1rFJBEEYhuENVsE7DSbS+GfPyEC4BhYrGKxA7OBCQxsQM/MrQazgSrAKQ7ECXZnzRdmd7x84OIT50uWZN5mFaerq6vayo4cwuknwFArBfSlYlYLMp1lfCNbdBFiO7PIrYNYXgY1ZNwGasR2bkfCAzQAu/KC17727wZUNO/cVCNwIIAIAFdDgloALHBIQQAQAIqDANQEXOEgBBV5cAcDc+r+BEHLg2brfAQHm6fYTEGCdTiWQB7PtsSc/gWUWfGzPfbVhiyYLuJ4xBWIe8AMsCGQBiRRQgAQBCVpAlIAEAQlIRA1IEFCARHQAEgQEIBE9gEQKSEAiugAJAj7QRidgFfwjML4dgqntCKxCZqe+Zyg78z102Z3rKc3eHpu6urp97BNIunQiihmctwAAAABJRU5ErkJggg==\"\n            ],\n            \"btn_check_on_disabled_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAG1BMVEUAAAA9PT09PT09PT09PT09PT09PT09PT09PT1gyl+KAAAACXRSTlMAgE05QT1HMyNi/YIlAAAA6ElEQVRYw+3TwQ2CQBRFUaOo6x/AtRILGDvADrQESrAD7VwxQ+4G/I/EhSb/bcmZGzKwiMVise9v084EXTXxoBnZ/hUwa2eBzqyaAONvYEZCAV0Pdjoo7L27DM7Wr9YKBC4yuBKQwJqAAghIgECSAIFyoYIVAQ2cCLjADwCOUgCwtFYJAA5WCwHAcrjYbQ54oBtu9pYDDtgM3w6B5iN45HMJOKDIBxNwQP7DSgIeyIkc8AAJAi4oAMkFJAi4gETyAQkCLuAuBECCgANIJAWQyAEXkEgSIEFAA0USAQvwR2Bi80EsFov98J52GzL3vLeyTQAAAABJRU5ErkJggg==\"\n            ],\n            \"btn_check_on_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAABfVBMVEUAAAAAmcwfqdodqNotsuIBms0AmcwyteU8Pj8yteUyteUyteU7QUMEm84yteU7QUQzteUyteUFnM8yteUyteUyteUyteUzteUyteUyteUyteUEm84yteUBms0zteUyteUyteUJntEAUWsMn9IFnM8NLjsIndAMLDczteUCms0tseIyteUAV3QwtOQEm848QkUto84yteUsqtgwtOQrcokEm84IHSYcqdoDms0KJjEXo9Qiq9s6Q0cJIiszteUVotI7REgPN0UzteUnqdcdaoYeqNkDm84mi7AIGyIys+Mql74niq8jfZ8wfJYFnM8pkrgpbIMmZnsATmgwqtc7Rkksan8sdo8kXnEAmcwAmcwAmcwAmcwAmcwysuElnstChJodcY48eY4lYXUKIy0vp9QwYHAAPlMAOEoMKjUOMkASQVIUR1oAmcwAl8oAksMCms0Al8k/stkAjbwPn88RoNAAjLsqqtUtq9U+stgoqdRavd5Ftdo3r9cAkcEmqNRtLj6xAAAAbHRSTlMAmQMIBR8SDM4VDhzOFBLPIRAhGRclHik9NCMlMZ04LkMZyBcLeg93LKA7Ns0rHNRLSEdBzaZsJKFzMC7Rb1Ur1IFOQTo1o0NpXEs5MtOqSMrGxUzWyNDCko6HbmdiPdPRzsNhVL+3s2RdRkIKm20RAAAGAUlEQVRo3u2Y+VsSQRjHTS6BOASWBXYTNkxQAxJKFCQ88ii7s/u+T8vSsvtv731nZnc22Jhln/qh5+H7PPqDwucz78zszOwMDTLIIP9Lho38SzbPX6e7TfmbDkbvyt8ycLrLFFuKYTsxgX1GzIoeeLdLlHGSCZIAkgMY3dHTgHj4prdnQph8Pq9pWj4fDo/qoQ5q+KMA8CGtXPb0TAyjYOoxLeFnQVWAGP5cwrB73KvcuXXATg5BJicn68lgPJGIw08CHFCFYbAuYEK52Q9+bq4NBhqQgGGUGFBgXUDotm0+4ufWmvVMlAZKwSJ6CLAA7UY//LW1E82SLEnSqY3HZ1EBhh4lgMBbxu/D6InGt91uNBqrkGapJMunZu8/3DibQQOOg1jg0UKW0xOD07PsidXr7SZEzUJOtc59/Xp8VjdACX8WeIhAW4gctE6EZAGyCNlaVNV0er117v337++JIRiHEoQCTygy0ivoqNCk09PrrWufv+ztfSIGLIH0UW+B9+CI/rfuFcjnGw3748GoJBfV9PTY+jzwd9+92yUGUgIdBLGgc3mjeM7Pqumx1AXKf/Pm3e6X/Qcb0SQR+ASC0MERjuVxIT/A+dNTqQuF44SP2d7eef4aBaN2BZzM4kO+PxFPIh+aXzsD/E+Uv73z9sPRDRwEmwKO5mt+AJufCJr57038w7PtTJKOgVjA+0SHAx3x0D0ZqaRa8VsNmQiEsygG05TjkYwJh/2IT0YzchH5uS7+ZlGKMoHbhoDhgYxoP9IJng1v7ljh4m/8+XtqSYric+CzIwA+wyM6EQd4MIl4bD7hH+nkp7NyBgRhG4J8ZAT5OKZAZ+wo0AGfJd3fxS+sjKlFWe8hGwLgUzzSgY1wuVRUAQ/Nn7ly5GoHf2pa0EMdAugfwkc8g2eBPg34GvIv/cY/cqxGBKQAmwJ8pPxkVGE32czq9FQuN0P4+3tmfq6WmkqXcJKy7UAsMJ4p3E1am9OEXgP6zPKTLv5MrrqystqUggmjALHA4ONuMr+eqtWw8cvLyyc7+IVjuVz1/PnzJ5r1II4AK0AgYGtaBvhkNymcmaH0kyeXuvi1WhX4JxogYB0kEGgowAKQD6sl7iaFY0CHnF561Nn/qdRKFfhrjXqcTiEsQCggBSCf7SYXjzwB+mkr/tTU1MoJIkgEKN+mIBndeLD/E2cjMSwB/u7SdRP/I+GPbW2hYG2uEfNzvkgwGoYeevVsZ3sbWNRwdemuJT9d2Vq9B/zJtsfLZ5AtQWbj6Ie3oDAMnfwq8rOVxcYq8CfbZe8454u7CARnZ7lhb//b1affLPhyZbG5CvxDijbh4nw7Y5CRN1smw6dvlnypsthuAJ8IkC8W5PVBlopmw+7e3q4FP1pZrDeAf0jJj/MJKhTgcwACdX2eGVi6+cHKQr19CBJDwZBNAaylIMjA5s4MnfwrBj8eWYihADaqcfeQbQEbhGJ67EKBG6z4/siCRwE+CobtC1gflWD/5QbePyZ+OBIpK8DvU2CUoI6lzjCDNT8wEtGUA/0KXHoJMArcQPmFas3M94EgRs9TLpuCEAhYCVF6yGK9hPzLhWoK9kfOB0GeCrz9CMBAlwupaBh2CH8Fmq8WOd/lSOB20U5CQymr4nvA0Y8/fny8PA/nB+RnDD4IQv0JPPRk52PbJnvVQAPwKV7CYzTju/sT8MMvN2RkPHDBqnG5tapmizI038R3jxwMefoWDIOAGWBni0oSHIw2X7xsFkvQevLSzd+InQl0w2hYP32BRIZfDB82+A4EXhBwAzu2J9mNAcEjn+3vKPD2LxhCA46DoYjzOw+KN/ZfZwJm0E/Z5BQP8QOd4XW+Q4HZQBwgwbCbLRfnOxUwA3+VYum4mnMuYAaM4HLRkUBwO4p45DsT4FLRVyKC50B8nRPpSMd/FzTFWiC+kAr1ivEhzUME5R4C8ZVazIinK4oiFvBLQce5oU0IBPRa03FuhwTnLn4x6yg3FVEB/GrZQW7dUbyiAsyX432mXNZCE+PCAvj1ft+ZADw/WYsUTsLxYoXDDA0yyCCDDPKP8guHrOe8HDBTsAAAAABJRU5ErkJggg==\"\n            ],\n            \"btn_check_on_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAABPlBMVEUAAAAzteUzteU9PT0zteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteU9Pj4zteUzteUzteUzteUzteUzteUzteUMLTkzteUzteUzteUzteUzteUvp9QzteU9P0AIHCQ9QUMAT2kLKTQAV3QKIy0zteUAUWwzteUzteUzteUdaIQOM0Ays+MytOQpkrkzteUnjLErdIwpb4YmX3IPOEcjfZ8AU28oaH4zteUql74updIscokKIy0upNAnjLEnjbMufJYveZI9fJApa4ImZXoysuEsn8kdcY4uptETRFYiepormcIkgKJEh500gZsAWXc2bYAAPlMAOEoOMkAAmcwAmMoAksMAjbwOn88/stkQoNAqqtUsq9VBs9k+stgoqdRavd43r9cAj79HttoyrdYAibcmqNRAenSqAAAAV3RSTlMAAwbNDAgOEgohFBkXGx0fL84lNCMQOCoReDInQiw9Sj/Ra9THdc1wO8gpSFY5fVFNSEVEz8vCgzTJyFxLP81jRj401NHPycViTtFbREA6L9XVzce3s134HTq+AAAE2UlEQVRo3u2ZaXfSUBCGS1EhQoCEBAIxCIlIxbYuWDfUarXu+1qlVFqty///A85MhiZw0ZsCnqPn5P3c8zzcmZu5ye1CnDhx/pckDvI32GLmTxczX/xiKHM0hOFHOWHHXPgMT6ePYNJpdsxDEOAJfgxDElCwYXY+4RFumhbGRAcpyDAzn/GmlUodp6RS4JiLgfmEB3o2m6FkwWHBKoaGmfmMz6hqjqKCghaRZsHsfMLn8nmFkvcVUCVYAgpm5Vs+XjEMXV9ZX38BCjRYwRJm48PPV3OKYuh2u7zibm66LwwypKBILJiRn1Hh1wPdKTxr3fvy5ZZ7lQxYpLS0Rsk/RYM0MJ7nOYVqFfiDr18Hl9CQU2EJ0AWZICrfqxaLnda93b1+f2cbDbgEi2okE4gzefj4HjliprKZnKK3nUKxWOo0L+3u9T586JFByUGNogmILeLTB/xyoVos1YZ8MOx9f+xCF7LYBLlgFMw56m//rOrzS0v1C8zHbG1tvXuKAjOygNkMRzxtfzXv82v1G5Vbuzs9xn/cv+Ya0QQJX8BgJENoLFu4PYlf9PnbAf/TNXeDBNQDucCnE5hnvmn5T5dhE//EjcraCL+1YUcTJFDg45mMI98fnDgbbAf4dZH/3LGVPO+ihEzAeBr4OPER7o8e2j5L9ROPBH6hrOM2NWVPcgIFwXnCbBXoiG870F7i3w/zzzRvFgtlQ4EKRRMgn3pKPxzZNNgQj+29eFLgl6pYIW6BXBAa+FAXnMk4NhGPPx/410f5t5eKBxWS9Bj3Z1KD+iCfy27bZYAD3cefHedXbtdgAbyHqEJyAZ8ogF9x168CnOg1xJ89v3p9+3M/zK/zAnjURRBggYivr7gvN1t3iiWiE/7c6oNR/kngUwcywwXIBJqGRwrzX8Fp0urUmX7+nMg/ERSIOiB7ChZBwDMN6nN3G06TteYNpi8vT+QX2ka4QHIBdACeWuTDtITTZK3yiOjAvzyBzw1IBSe+VEBDH/l8mqytPlle7na7Vy4PBH5R4EcSQAfcx99/Ap8M91efdLsPJ/E9T+RLBSYKnr6FQwRhZLh+5eEY/5T/+z1P4EcUGO7r/Y+kYMNEfsHzRH60EhlX3dOfhob+529vLn+bwC97nsCPKrA3WiHDzmAwia97DYEvF+Bzllds507I0Ov3exP4SqMh4YtPMj8Hiu5U7zTZwBH5uUZDzhdHBXZZMeDw7bBB4NeZn2k05Hxx2HETnGrpwohB5B9vaCJfLuAawRKWLlTYMJmf0jSBLzPgeRAsocaGgD86HzRNzhePzNASSnU2MH98vmmayJcLeAm+ocZ9ID6eXyPzU0syP2pQQK/pXKTAgPzmTShP1WkH8yeZFPlywaJfJDTQizrt1n3kw/FYgPMrmD8kWDhMSBB8ien0utJpnf7x41TrJuLLupE/4JNg4bCCsW89VMDUONUivB3+3FvEv144ZJLJsa9VeuvaWH8P9Dbic2rwRQyChWkEbLBSw7cv3YboOuLxe3jIn1Lw+xsDvjIwmT+tIHynYqGCLz1UoPv4YP5MJxgacBGwCnyLp+DF0Oi90LQCNtAi0GGlIHTrxHjmTytgQ+hTiiNczU0vEO8WxcvFqQWS21HAE39qwaHyLwoi37H/J/8liBMnTpw4ceLEkeQXuf5HL4dNIhQAAAAASUVORK5CYII=\"\n            ],\n            \"btn_check_on_pressed_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAANlBMVEVPT08+Pj4+Pj5KSkpAQEAAAAA/Pz9PT08/Pz9PT09PT08/Pz9AQEBAQEBPT09PT09CQkI9PT36oQq5AAAAEXRSTlMm1MgyiACTFp4eAZeNggYHXQY8LIYAAAExSURBVGje7drBbsJAFENRtx0YJlAg//+zTaRWruQNU+NFxfMa3SOxSBZ5OGy79oGnb/Tb3t6ApSO0vuzAMhDbWDagI7h+wBXR3dARXcdAdAO1Wq1We6mdjojutK6Twtuj++lTCABbn8LDwNT/I4IPaH/bOQGc11+7PxXQfoMBGH0DOErfBPw+gVCfgNv3gYv2fcDvE7D6PtCk7wCns99XQN8mfl8Bvk3svgLsU3D7CvBpf8H3Pu0+AfYpaJ+/ngfuUpO+AejzRvomoIL0PUAF6dsABe3bgAra9wEK2vcBCtr3ARG07wMUpO8DIrCfACg0JAAKDQmAQkMCoNCQACg0ZACugAJeC/iY2F+Auc0D75NDrVar1Wqz+0/fxEf8aCB+9pA+3IifnuSPZ5LnP9e9/QXc5ydUPu9cjgAAAABJRU5ErkJggg==\"\n            ],\n            \"btn_default_disabled_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABiCAMAAADwfaQ5AAAAM1BMVEUAAAAzteUAmcwAAAAAAAAAkMAAmcwAjbwAmMsAM0UAAAAAgq4AfqgAbpMAgawAAAD/AAA0FdE+AAAAD3RSTlMAHz4TD0I5PSkZCjIyDQj2gUbVAAAAn0lEQVRYw+3ZSw6DMAxFUZq2zodP2P9qKzGqGFjYqkoC9y7gjDLJ83CoujWc0QoICHgJcN+SJJiStGjeLMGczAqYgqOkgOIBRQGDq/+Dj8MBdgFWQEBAQEBAQD9YAW8Atv8OAQEBAQE3sPkPOGAvYMvrnPwaHD3eqIA52r2YFbDkKb5NxSkXbRh/OtKX9vIyVnq7BQAC+sD1K8/Beid8AI8uHiWs1BycAAAAAElFTkSuQmCC\"\n            ],\n            \"btn_default_disabled_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABiCAMAAADwfaQ5AAAAbFBMVEUAAACZmZl5eXl0dHQAAAAAAACHh4dsbGyWlpZbW1uNjY1kZGQjIyOWlpZwcHAAAAAAAAB4eHhubm6Li4teXl5aWlqUlJSIiIhzc3NgYGBTU1N6enqMjIyXl5eIiIiXl5eMjIwAAAAAAAD/AADhocx4AAAAInRSTlMAJ4CAJh6AgICAgIAwJxUUAnp6eHh2dGNjX15cWjIxMDADER06CAAAAMlJREFUWMPt2TkOgzAQhWHALIltMPu+Be5/x0hUUYoRQxOjvP8An1y4mRnnVNuR84t2gAAB2gAmY/1gVY8J5SeFlCErKQtKHMJmcllNTTgQYOYtLrPFywhQeC47TwAEaBu4AQQIECBAgACvgxvAPwDt/4cAAQIECPAArR/AAd4BjLleTIK5WLngKnIC7KJ2jlnvm9uoI0BdKhWxUqrUBOjrvnqyqnrtE6DxL2SIxfgr4HtBSoBOagJmJr35cQEgwHPg/tGVg/WX8AZv3Su8QPHBAAAAAABJRU5ErkJggg==\"\n            ],\n            \"btn_default_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABiCAMAAADwfaQ5AAAAS1BMVEUAAAAzteUAmcwAAAAAiLUAAAAAmcwAHigAmcwAAAAAgasAhLEAk8QAksIAa44AcpgAmcwAAAAAAAAAAAAAAAAAmcwAmcwAAAD/AAAMZPkMAAAAF3RSTlMAZsyA5mbAiYgH3NvUy8S8tm5fSz8gFpzXpUMAAACoSURBVFjD7dk5DsMwDABBR0l0+L7l/780gKsgBWGxiGV49wFTsSFZHCruFWe0AQIC5gCuvjdJ9X6V/MWa5OwigN4o8gJoNaAVQKPq/+DjcID3BCMgICAgICCgHoyANwDzn0NAQEBAwB3MfgEH1IGXvs41Gq8RwE4DdgLoqjqVqysngJNry1dSZesmAQzDM7khSIfxMI/vpMY5XPwXAAh4Erh9pXlY/wgfdZAio63fx68AAAAASUVORK5CYII=\"\n            ],\n            \"btn_default_normal_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABiCAMAAADwfaQ5AAAAflBMVEUAAACZmZkAAAB3d3eTk5MsLCzb29sAAABZWVnAwMAAAAAAAACYmJijo6OLi4sAAAAAAAA0NDRSUlLIyMhvb28WFhagoKAAAAAqKirY2NhISEjNzc0mJibDw8NfX1+5ubmzs7NBQUF+fn7R0dGRkZGioqIAAAAAAAAAAAD/AAAgdn43AAAAKHRSTlMAZhB2aLOnMIiEBAFnbWwOCqONino4FxOolZWTi4d+fXlzcW1kVSwjhumNDwAAAOlJREFUWMPt2ckOgjAUhWEFnFpoC4I4Mo/v/4ISVsakxIsaMJ5/3y9p0k3vXbxU07eYohYgQIAzAPkhP61JnfID19i9t7/sbztCt+7AgMjKOHGWpJwkLpkWVIXTeUTRKZQWlNlyRJnUgoZp0T3LNAACfA9sAAIECBAgQIDjwQbgH4Dzf4cAAQIECLAHZ/8BB/gF0P4s6AsyaAt/AIxMYVM9M9KDMvV8Qbm1bQnfS6UWVIHrnr0tIe/suoHSgiwMrscVqeM1CJkW5Cysqw2pqg4ZHxiMMyUNUlIx/tO7AIAApwLbh8YsrJ+EOyFWMqRTaWfwAAAAAElFTkSuQmCC\"\n            ],\n            \"btn_default_pressed_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABiCAMAAADwfaQ5AAAAclBMVEUAAABmZmYAAABkZGRaWlo3NzcAAAC7u7tNTU2Xl5cAAAAAAABycnIAAAA8PDyioqJISEiJiYlXV1eGhoYAAABcXFy6urqnp6eamppPT08uLi6xsbE9PT0VFRUaGhoAAABiYmJiYmJ4eHh3d3cAAAD/AAABlB2hAAAAJHRSTlMAZg9nbowwmnd+BAFrCoSCe3ZwFxRskomAcXFoYzkyI2RjU1NCIACPAAAA10lEQVRYw+3ZyQ6DIBSF4Sp2AlFRtM520Pd/xRpXTROI1400Pf+eLyzYcO9hVePSYY8mgAABOgCKrCnOpIomE2ZeZPEtLq+EyvmAReQvpUKPVKjUkxtB+QhnjyiGd2kE/dzbUO5bQEb3WGABA4AAV4AjQIAAAQIECHA7OAL8A9D9dwgQIECAABfQ+Q84QPfBlDGyx1ILWAV0MKgsYJukjBHvl7RmUPZRlFxIJVHUSyPIdVcfidWd5kZQcD2ciA2aC8tgnEufmOTip3cBAAHuBU4fbVlYfwlvr34uoI6kYcYAAAAASUVORK5CYII=\"\n            ],\n            \"btn_radio_off_disabled_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAaVBMVEUAAAAzteU9PT0zteU9PT09PT0zteUzteUzteU9PT0zteUzteU9PT09PT0zteU9PT0zteUzteU9PT0zteU9PT0zteUzteU9PT09PT09PT09PT0zteUzteUzteU9PT0zteUzteUzteU9PT3dmb2uAAAAI3RSTlMAZkxgRwQ4EkgOBiARPFMuWyYXTTYyLEAgCioMFkMyGxg/J0SE03YAAAMlSURBVGje7VnXltsgEEUDqlbv1Wv7/z8yoS2J4zVgmc0+6D75mIEpd4YyQgcOHDhw4DuxVMGW557n4TzfumpBb8VpK707lNcTehPCK/YeAgch2o9L5D1BtO61Xi3fBH0Ysv/WPmiUij1sJIEMRlQld0NVJMe6183P+RL5KXmo/iTGmxedqDi3ZfVEpOROvJRQHZ/bI4FpLNoMAEjWFuMkvei4FT2yRsApFMGJZwJ/gcyxUMG56F5YXxlWU8uhHevYR8iP67GF38hqPtoLDfbxwR/c+gyAnGv/z3G/PhOAjHvxga2jdGLrh2ypAgBuanWlYwaAmQ2sTIMF0yH+XD8eAAr/sdhUAGTTpwa8GNcXy28Wn5TAEH8tmQ5A0k+XGyuCe8YuQOs/E/VboaG3IHqhshszEKDQCPtnAKYhMg9SQ8s3ofEndH0dzkAmGldKQ4QM8EEdqKhxA7SIQxOljIaxovNCEwckXQUMPjLRQODGJpq5cKGGrJyAFOnBJWPput6Fq3RggBkZooBMuhBoawCLEqiBqADpg5SKYsAaUUZVSX9kMCJj3Hg6YIMNYxNupswBCxdiUaFXjSgWFM+cAXMWbiJBSs02J8NIo2qBFAZJ4PNq7kUux0CQFQjQco60JARiyxrhjKzQwqimP4E0oaDyNrjBLBJ1eyqXi2LMoEZWqFmirtpTgd5zEhFSK8QwiJ0+12Yp58xHVphYViTaPPWEAgBkBx+ImI//rwJMOXATIkXyspNk52nqptBGVWgut4qOTne+2Zlu17GL7VodOIWjAwdFzo5M94e++2uLunhFOy5eDq+OF7Oro7rDFkAmwwDNaqLd9T3zLa/vq+0D5Gz+ACmFA3qETp9Q9o9A0D0C9z9jJXH5j3mIi3d1ucpWAtG0Ei68lWDfLKoQd0LTDKlkZ8a+nRPctXPYgnftHCnqrCHVqHbR7pZaNjDLM9VSQ71oqf3EpuCfbc0vck2OL7sbs2Vw+WdPDLAY7NAOhI0ngKOgEq3lsA8iLP+Pwr3N8cZRc1xh/bK9fw3Re5A8+kCxndBbEcpPLF6eb0G1oAMHDhw48I34BUmSKxG/3YRpAAAAAElFTkSuQmCC\"\n            ],\n            \"btn_radio_off_disabled_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAMFBMVEUAAAA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1STLyxAAAAEHRSTlMATAUMRyoWMBA7P0MhNh49I5b3UAAAAXZJREFUWMNjGAWjYBSMAsoB8/NZgiJr6wyIVW/qKAgGIsHEqc8UFLyTwcDUdlZQcBox6u0F3ZMgLLUSwcmE1asKiirA2EyBggEE/btQXAHBYyqUIuTzFmkUFRwbPfCrZxO8hCqgK5iAV0OjOLpIoQReHzgWoAuxi+DzBZcsptjFBXg0BG7CFNMWxeMiwQZMQQ5B3G7iFMVq7QScGhKdsImqiOHUMPEANlEeSZxeEFHAJszkiMsTrKI4wg5XCuSWwBH9G3BoMHTALs4ijEPDwwLs4uxyuOL5AHZxHlFcoZqAI83L4tCw0QBHcEvj0OCogF2cSQSHBkEGXBKUaiDsJAo9TThYJSmNOMJJg9LERzh5U5qBCGdRcgsByosZfuwF2QfKi0qEYU5YXCSKr7iXUsAIo4ULSKtQeEUMyKqyKK8UEdVuA1q1S1nFTrjpEMRAEHQhN05WENv8SWZgMIM3fyhvYGH6/PgsQcGVNQYMo2AUjIJRQDEAAKdsRGG19ZMWAAAAAElFTkSuQmCC\"\n            ],\n            \"btn_radio_off_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAwFBMVEUAAAAzteU9PT0zteUzteUzteU9PT0zteUzteUzteUzteUzteUzteU9PT0zteUzteUzteUzteU9PT09PT09PT0zteUzteU9PT09PT09PT0zteU9PT0zteU9PT09PT0zteU9PT09PT0zteUzteU9PT09PT09PT09PT09PT09PT0zteUzteU9PT09PT09PT09PT09PT0zteU9PT09PT09PT0zteUzteU9PT0zteUzteU9PT09PT0zteU9PT09PT09PT2npJ6rAAAAQHRSTlMAmcwElCDAN48ValInxnBLPVclpJCHMQy1nnorizK6dGo6CYB9VhkKhHBkQz8eBwV5X6yYdR0PXSwaKRR3TCKGCl/ORQAAA8lJREFUaN7tWNl6qjAQxmErIIq74r4r7kvtqT3tef+3OkwCtLYWEii94r9Rv0xmnCWTyS9kyJAhQ4bfhKYajm1LuZxk205R1X5UuVh3arlPqB3q4g+plw8Pubt4KD0LyZEv5EKgy0kj/66+YFiyLLrxkmWr1H83oSWJvSFRLZKuXm6XLpburxVj50KzqQr7fjpH6piu/43phCrRclG/F7FqNNv1OPpXdO/K//eb6f5UMQGUymn/OvODuKIVZvHrL9EUjuiv8rIJN2gOyl4ydCJYjKVfWtEfwxYAmNXp8LoThO11OK2aANAaeq5KMSwUif48+X6tACiL9fbj+ny9UFwT1Is/EneUVNzRIYdoewYwB42vMo2lCbDckbNOEvGHoz4lTO8jSW0FYPJyX2w2AajMiAWygblaxXEQn64Cx/L3ku0m9NpBlPqsJ84IQjo0oToPE21UQekGRV3kCJBD/r8Jkwjh3QJM4oOOXl+YDGAjq40w/grqj8ICepiHESZaZ+rP6KyK9VOBKoP87gStnV95LN27gK0Zv5yh2RAY0GjCwPdcZ3RAxgoBaAtM6IJZ9ndG33EH34EKLAVG7OHku1CKPAOSdybX0JuzGmgogLVax+MvMjSJmkgceBKYMSAuiB13c9TV4LgyBsmAgg6wu7DBFhwdI/HBS/EZzgIHJjDw0lwLF3zEpoUR6vklxFpIRz+B4S3P8mq5DIrABQVm3hlSI/ocbVlT+MdnoAqvwfYw6F4d7LGGePAES68GD6FyeBPgRdOCIZ+BNelbMk5JoXJYyReS4w2fgTLJ8sXdPg6VwzIQSc7mfAZeoIk9O7JOcy7wE0DgQwMUb/9DmgZENBAZolHCEKWT5DeSZA2TnHqZMh20CUxjHzTGVrGI0yqKuD31Zsfarq987boZtGvWC2eZyoUj6EmvzEMql/5T+KWffGzp3YwtzIPXgH3wagWDF/vo2GUeHdsAHKOj0P8w/L5wD79c4/sRWluG8b3KOb6/P0DeFFiwP0A6xAEWPMd/QmlpPAJNrkcg/zNWaZPEode2yPcQJxW3OQLsOR/i/FSCMpjfic4goBLylErgJ0PUgAzpTW7JkO1HMsSiZEgcusigUV37dA5RWL6lc0RPNB4hVYgkpEYFfkKKoviVUmtVwIVLqU1DKDVuUnCshojEJQUptLFPa37DaPu0pxafmM1RdEr5z0v5UicZMUvxGHDIElLLhASTZcsoSAHjnJQgz/dzISjI6dL7VH1yiKrT+ay95tRF4SehWYZuk7KybcdQNSFDhgwZMvwi/gPvHkn+qOIQ7AAAAABJRU5ErkJggg==\"\n            ],\n            \"btn_radio_off_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAaVBMVEUAAAA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1Pag0XAAAAI3RSTlMAzL8LJcV8OyqQpLpwhGsbtp0zFwcFsZd3VFovqkEfoWEPTH3CfAwAAAGvSURBVGje7ZjpboMwEIR3bHxwhisQyJ33f8hKVSo1akS8hkRU8veXEWgZH7tDgUAgEAgEAh9mM+g+UYBIen3b0MJEWYkHyiKi5TAVABUPxm6JWmvGWAGoDC2DTQCRm5Z+IY+5AKolqmh3gCok/UFmCsi2NJNTAuiGntJoIJlp916giyYed0jtLHcVYjklkDFETd7UCvqFZJtDeddwEtCvVTlSTx/aA2IH2bbH2W8t7dBJF921ROG1gADrqlQR8UmQudfaE5sjUumqvQrUHgWM7uILvwQLId3VUuBEPDJkHLlmL6QUlrXn0RGLCIJYCDQs/YCcWMS4sfQaI7G4IGPpKxhiYRAzPd5wTTswPZPEokHJ0gPEQ0Ks6wM+v2hdJvss03VttNHjqFjXYff245p27AtnbVcm+9J/b9uSovZpvAp3wyq/1nHv6hciv+a3bHjNL799P7cO7Xvs275TJJC7DSBrHaHchkBV0wzq6THWdhB25iB+4A/i/ChBPI0SiokogR2GpNq0D591CEMYHM/3OOf7hZEZ7nHO/wmkfiK1KgGApNfDhgKBQCAQCAQ+yxdkJhHOkHWlWgAAAABJRU5ErkJggg==\"\n            ],\n            \"btn_radio_off_pressed_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAb1BMVEVPT08AAAA+Pj5PT09PT09PT09PT09PT09PT09KSkpPT09PT08+Pj5EREQ+Pj5GRkY+Pj5PT08+Pj5AQEBAQEBBQUE+Pj4+Pj4/Pz9FRUVMTExAQEBAQEA/Pz9DQ0M/Pz9HR0dDQ0NEREQ+Pj5DQ0Mt5iyXAAAAJXRSTlMmANQNAyQiHxswCRfIS8NBvhHMhYxtsayTRiuJdp9XpDxaULhc1kjPGwAAAu5JREFUaN7M1cmS4jAQRdFHavY8gDHGjF3//41NrWiilLJU9qLPmuDaSmUYuygya3NrtFaA0trYvM3kLkpEQIrcwMPkQq4PyNYiwAq5KiCswgJlxa8DrUYUE0og4e95WiQHhEYSkyUFpEUyK+MDQoGRfk7gHz9dHhWQBr9m5HIg01hBZ0sBobCKEuGAwFpKhAICGxB8QGALKuMCmcJGBX9AKmxES2/AYDPWF8ixofZnQGBT4h1gBrDNGN4BiyX1YX9rOqKuue0PNZbkn4EMYae+og9Nf0JY9hEwCHkciai4zNfaAa5+zON37nhFiPk30CKgHIiKvsSH8ly8EqfwnN8BDdZ0Jqpmhx/cXBH1E1j6HWjBqgei3sHLvdrDfeEVEH6BZ0FNCVbZUFGGp4Dgjl07ujgEuBt11+BFQmgHnh2NCJtG6srQLiCwxHVBeywaqeLmoOQrwI94GuiCCBcaJn7M4JdsT41DBNdQDz/7HZDwKz2Hy/2STuwZgb1DA/WItKcje0bgPjRfVDlEcgU9uHsEbssGOiDaTEdu1yC5cy0mRHMFN4UdMu5Yz0gwcgPL0MKrohIJntTASyCHT00VkhRUw6eFhc+BRiS5MHfCwjAjOCDJTGcmoOFzpCuSfNENPgYKPg3dkaSmP/DR7MwcktyZW6HgR4Q0jrr/K/C3WTNKQRgGgmg1oQlN8KPgRxUEzf3vqCD+yXR182gv0EDa7s7Mm35XhL9k/DPFfzR8VODDDh/X+MKhVya+9HHZ0kd4XYXwktJx8UtHWvxq+d46yfc4cAbEb6EGZaHyqgm8O03guo291WNbtI19CBtrMeLNYcTtUcL54ogS4DDEHuecPHEOH0gdii1Sq/Nc/4jU+FCQjzXFwHDClkGgFQdq+R6Oj0Q4zsf7AuA4ns8iFhoS0ZiLBnXbo8bXCQWFpZpWa9zLAusSf0PuqSty997TGPZYe7AWN8rkq56ErGshce/lmc8hUyg5pXf9J+VcgrX+8wRytCpX/RrehwAAAABJRU5ErkJggg==\"\n            ],\n            \"btn_radio_on_disabled_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAA8FBMVEUAAAAzteUzMzP///////89PT3////9/f3///8zteVAQEA+Pj5JSUkzteUzteU9PT0zteU7Ozs1NTU9PT1ZWVkzteUzteUaGho9PT09PT06Ojo9PT09PT0zteUzteUuLi4zteUzteU9PT09PT08PDw9PT0zteU+Pj5NTU1CQkJXV1cfHx8zteUXFxczteUzteUzteUzteU9PT1gYGAzteUzteU9PT1nZ2czteUzteUzteUtLS0UFBQhISEgICAjIyMlJSUsLCx3d3fBwcEzteUzteUnJycbGxs9PT2UlJSrq6tpaWk+Pj4kJCQfHx9HR0fv4rWhAAAAUHRSTlMAZoABBE0JDAZgKi4FFxMNNjWAPyQeXFJJF4BIIQRHeCkkEzsxDw0JgIB+ZDtWTjBSSUZ7VUNDIEwjCGVZSUdFQj0cEUAtbl9FFhOAeWBKbUEUQ9MAAAT3SURBVGje7VnneqJAFI1hZxMBC2Kj2HUtaOwlmr6mJ7vv/zY7FdAFFDT77Q/On0SBc+aWuXO5noQIESJEiH+JH5XkdDCIRCLRwWCarPw4KjmXmWYjW8iuM9yR6OPdaMQR0W78CPSxYcQDxdihq7foF8lyPM5Bf8Vj5eTCkjgkGoUkc0axsty8tCwX2bU+F3j5A0IxyBQc5S8n5PpFQCMqJLbZivst5SwxIhOEv0+efWQOSOhCTc4DkJclQW8yK/pkFWX//F0SwgJl51/ABmZ8ggaDxCIZjP+RfFBqkDIv6UoDfhAbii4hjZpCrj4GUehj95Akb8gAaHVFhBlKAVWUugYliBWZqG8vXWJ+vE9FAS6eF7m/IPIwIDzZjFjBR6TjUZM/AZcvNE3WbxAcQxNqy01TIbp3thZwfmP/VDUwSzBuBkulOgOjBvYS3g/77rik6VIlDyTRoj+nsCRECeSrZqT7e1Z+dO8Urz8PBMxD2L+bgBpMog7y2Ibi/k66QNu3gPyvWfyI/cwE0rAURigOSxSG4l71GRlQQfkjA4nRnyP6tzkvSJLAz9+QxDmTqAEZVxb03D4HxAKVZvSPAGYi4cf0c+H+Jpe7usrlbu6FOZKgCuIM8Mzy4p4GxFAAAGhQfkj/wN/2Pn+Px+/v4/Hvz94t/wAlqAK8M8Ge3G3CmhkgA56DwPw/03e51fh93Om0Wp0O/GeVu0v/xAochABqzITuzj0QpXtSASOR8b+lrz87406rraqplKq2W/DD53X6jSmIGqjSzRD12gssVFkOG6Bb6/+1gmtXU6cUKRXasfpl2cBjEziyOG9MaWFsAM00IH2zgqsn9EwCWrG6SZsm5HEUurt9xEVpiHnAM/6Hu+cW47crtJ7vHpiCAHga5uyOMsfcOKIpBBOUz30Q/m2FjxwPk5Um0owF0Hs3l2kuJ4B2Qg2Y367ahH9bob26nVMTTjSAtjNqci696xwtWTqoMwGh99FWTx2gtj96AhOQgGI+7oUizQOB5tD3s9d7AyankwBMWOP+9Yz4SAc8PajWngITuhlrQEECKIWun1T11BGq+nSNEgkJKECiUb7wFEB9zhLHOEE9xOdKyABnE0o5nvooAWRa6SeeAigNUBLlgUgF6r3TlLMA+r5XpwJN8ILSaGeeRiDQXwBYjKWrUw9cSVRABBp9PvqVAhwV8HZRYdtF7th20RK5yH+Q3fkdg+w/Td0FHNPU/0ZzF3DcaP5LRcnVQ/ZSobPH/Rc7w9UAx2IXoFyXXAzwX66tA0fYOHCcBXwdOAxFxyPTcHSQ7cjUzCNzHezQN/4+0Qzboa/bDv2Abctzacv/z/a2ZbRn28Iar6FT42WUbPSGa+Plq3WsbraOxlOpBMlLT8Zm69jw0TpCLJgJAnhpHr35pZ5k7bss2tv31zRp39OvG+27ZGvfY35fQOr7v4BkqQG7ET/gFer/eAn08RrbmAHN/hr7v7yI01FCNvZlowQ2LKqYw5CR1zCkHGRk1CUzGuJVRSbjnComTCi6lLfGOVz3kIHR0G0g9WIOpBaE/0gjNcQt16yRGvfIRmrBh4KTisctwYaCDPEJG2s6H6+XAzbWPHgwm03GttljbKLNMiGgEQtzEj5Eo2X8XbycHDL2yDB+6HAcSrhjGDvG/H39heN9NqV2+IFimuFOjgno+OkApxX9iSVEiBAhQvxD/AFA6Z2m0icYqQAAAABJRU5ErkJggg==\"\n            ],\n            \"btn_radio_on_disabled_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAsVBMVEUAAAAzMzP///////89PT3///////89PT09PT09PT0+Pj49PT09PT1aWlo6OjoaGhogICA9PT09PT09PT04ODhFRUU9PT09PT1NTU09PT0uLi4dHR09PT1jY2NYWFg9PT08PDy6urpDQ0MxMTEmJiZoaGgUFBQYGBgjIyMlJSV3d3eYmJjr6+tfX19CQkJpaWlhYWEoKCgvLy8hISEWFhYrKysuLi5WVlZBQUEnJydHR0eJLZnuAAAAO3RSTlMAgAIFTQkMSSoDLw4WJDVSSCALPoAsOxGAf3hiQwV/RjIRgH1iH1lURUIcFQ54CICAbWdnVz48eHdubc5A5usAAAMCSURBVGje7VjZcuIwEIRkEskHMsY2+MQO933m/v8PWxGfIng3ltlUUqV+g3J1qzUjaWYaAgICAgICAgLfjI4udw0EgAwi651rsys4BAYhVq5Ir3YBABFdVaRGQ1JUnQBFV73W6g3KHqmU+yYBVVEjRCWu4ULClB4HN58QYCqBpdqhNQDkzc1FbGQAo2a4ewh8JWO8TZD9ofiAerWii4AELDurERBAaq31ywX2uwwFDbmGh07GH7PfZ6A/MoUIQs44SAaQnJ/SL8eWRYhljZcnicwEAYMvlzD4QU6/GsvPbU2bTDSt/SyPV/eZicAHzHW+AHoJP139wppNR+/r9Xa7Xr+PpjNrQV0kCj0AnhPXBRzvD+V/aM21w3q76/dtu9/fbdcHbd56yBQwdDkyFEIp52+PXnZ9e+CYzabpDOz+7mXUPinEAlIIKocBvchP1+40MzjUR1FBr25BASSlATjx2wOzWYA5sE8K6SZJqHIUMODUwGI+svPl5ybs0XyRWsCVE8mHXsx/t7K015SfVXjVrNVdrNADv+IhBtRIDIxnh0G6P+wuDQ6zcWKhgaDacdYhSgXkqZPzswrOVE4FItCrhSDOIcq/fPIcp3kRjuM9LalCnEe4YpKqiYFWe2+alwVMc99uJRZUIBVj3EkELM0tF3A1KxHoVIwyAikRiB6HDD+jMHyMEgEJUCUBgDTGZNL8CyYkjTLA/xWQAPi3qJw/36IAEH+QywWYIHOn6Vu5wFshTbv8B61cID5ot/FB478q3NIdYq4K/svuWCZwzC+7EDo1rmu3xEB+XSvg13lwvOHFHPWYB6fWk+ldjDD7ZNZ79D97GHrso1+3bPHO4uB6dcuWhnFWeB0LJobHs8LLuErp6O1d6sN19x5/6cgmUrj5SvG7CQHzlu9GwJTvLUsmRLZaTPke0M8k7gYk+ncDQgB1fmoLxTSBt2coNIE/uY39SiP+00cJ6TBEPh+GyJTeUK4+zvkQVHWCPsY5v2cglY/UgMLonkZqAgICAgICAgLfiz+OHkqDTzvSAwAAAABJRU5ErkJggg==\"\n            ],\n            \"btn_radio_on_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAB11BMVEUAAAAzteUzteU9Pj4zteUzteUzteUztOQzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUMLDgPN0YzteUzteUzteU2kLAbY30zteUgcZAzteU9Pj83gZ0KJS89P0AzteUzteU9Pj89QUM8Q0Y8S1ACgq09P0AzteUzteU9Pj88Q0Y8REY8QkQzteU8QkQzteU7TVQ8SU48S08zteUIRlw9P0AMKjU9Pj8RPk4UR1kXU2kaXnczteUhdpYjfqAmhqovptIxseA7T1Y4dIk9P0A9P0A9QEIzteU9QkQzteU7TlU6WmU5bH48TVQzteUAl8kBkcIBibcFaIkRPEw9Pj8plb08SE0snsg8SU08Q0U6X2w9P0AzteU8RkozteUGUGkZPUoINkc9Pj8ZWG8oUmI7VmKy4O57w9sBksNYtdOOw9QlmL+VwM93ssU9m7qQu8ljipdAZnQbWG4IQFMrSlYRO0saXHU7VmA4dYwzteUmVGQ8Q0YAmcwHnM4Nn88Zo9I5sNhavd9LuNwnqdQjp9MSoNBCs9qi2u2T1Ol/zOZvxuJsw+Ca1+uQ0+mM0ehVu90wrdY0q10GAAAAiHRSTlMAmQTOIRYcEz4uGTUoOCpJHlQmV05RM5VDj0BGO8O2i1oxGYxLgWrDHc2mkm+9lXQp9cF2ZbiLhX96enJFODAM3MnIx6ylmJB8fHdzYFweC7ShmYZvX0s3KCQJ/vv46bGoamdkYFUznoBAJODW1qyU2zv+/Pz7+Pj29fX06N/f2diykT8kENuNq6nwywAABu5JREFUaN7tWWVD21AUHXlpkzaVpKmtRgUodPiKdMBguAwZG7rhtg2Yu/twl9mP3bsJhZZ6y/ap52PSnPOuvXff7bk00kgjjTT+JyQWrdfnM2RkGHw+r1ZJnSk54fBmZpzC9T4ZcUb0rP18Rlic56VnQK/Jz4iCHDJVz5/QV3E0yxLYXyxJc1UnElQqvtcZRBZDjqU2+FWtJcf/LotIevmtIkWrPizFMHP0/mKSRjAXxHRRCsaEAJ5arovRliXDbxa/NRJH7EMzlb2eBoTcnt7Kma4jDcIsZJiBTpyfF0M4LNIXF5WhIJTdKBYlasU00CbFbzCK9HeuYcorhdPVA06Kcg5UTxdewQ+u3RElzIYkFNTwzQWVQH/Zg1Bpeb+TkkjkAiQSytlf7sYSohUyQYFOKL7wRSYJ/N2X8OKLcimJXCplWRKDZaVSuYTKLcJmFHWDAgmBMCQQackFCC8L/EPjCFV8AXqS1CgUKgyFQkOSIDFYgZCnS1AwwAdU3PXVCgsS/FNTinpmKYmUxewqmUOvZxi93iFTYQ1WKqEe9qCCy8deuhhvxenAQSbgv9OACp2weo1KpmeUFlqARcnoZSoNWJHbi9w1oCAktTpOB8FqvML6G1AFLB/TM0raZDSrszDUZqOJVjJYAhvhLEcNgg05kBVf4xK4CAEexgJDboGfVMj0Stqo1uo4nrfbeZ7TadVGWqmXKUjspnJU0IUFaiHQOfHwK8BYJebvHkeFIj9jwfScfarN5WpudrnapuwclrAwgoJzDnm6sYISvmPjEKiCrRkK7BLqyQV+h5I2a7nO9pYmm9Wal2e12ppa2js5rZlWOkAhtwzdgIK7GJ8Jd2EhdzH/ZYQGRH6TWsd3uMbqP7x5/eLRoxev33yoH3N18Dq1SVR4iK4UYwUVfBn7jOvzGzCOLlFyViED/qvZjda3z3Z3f+z9/Ln3Y3f32VtrY/ZVUJApWDlVieb8JvAxawBqTIb5q1GBUyLVyBharZvKti283Pu1f7i+sbOzsX64/2vv5YIte0qnphmZBjupFNVgBT1kR6xaUIo/IggPmqSkpEpvMeP12x483j/4vba1vbK8vLK9tfb7YP/xAxu2wUzrVdhJN1AvFiAyhcVFhxf/hsOGXEZup4TVyJRGLY/5Dw/W11aXl46wvLq2fnD4zZbNa41KmYaV57rRECFuwfYYHoJsJiGFIAKkCjuI62hceLq+sbkC/H6Flc2N9acLjR0cdpKKlFMVkEhCglyPLiCFTQs8VAApJBjQ6bK+2tjZWlkKwsrWzsYrq6sTmwBR+Ix6wEewB0Tf8mgxl4liVIoNUOixAe1j73bWNoE/WGFzbe3dWDs2Qa/AJpSiLuwjON2YqAIc/kUWFphB3yHEjElrb6l//mdzeykE25t/nte32LUmBoeZKkT9WEAbc8fLEfOAqESTood0E011q1s4viFYxo/rmiZ0oo8mUREhHlR9UQVui8VIXEPVElbhsJi5Ntvo9io4KAQrq9ujtjbObHEoWEk/KsQCJJwKUQUgk2uxQAEalLMQAt5lLVmGBAoFflxidfEQBFY+i+5hga/489tRBaCOod1xI6eQpFn8/bxbS8vhBODprbz7fJaQqIOoDH83DGUaVQDOStiIEBKqwJRlb867uRQRN/Oa7VkmEMhFbtiOIMujC2CkIECAQEwXDYe4KBJCXFQLLko8yJEFTgeZgiAnnqaRBSKnaexCmz4ptMgCiRcaJ9Y6MY3KT7aKkUj8I4FbxYx/q0h8s5uPJDAfdrNLYrsuiRDi8Nt1EgfO4q2wObqY+IEDUfYfmaUBR2bdzTBFVhf2yOxL9NCnhUO/7slp/id1AYf+ZMChn2Tbslhyyv+LgW1LgdC2OITFxdN45YuNV1FQ4zU/EpCf80k3XhAoMcw1CD0MbB0/1r8fLRnB5CWj7+s/BraOAwhB66iIo3UEVPlNuITKBgOb308nze+nZJtfgOq4fb+HPM7A9n2izdXS3NziapsQ2nf6qH3vDWjfyYQuIMVuVB7/BSQzLgMA0uSvUFQCl0A6/CXQZDp9CWyoAX5jvJdAAHH75BrrDr7GMhgB19iBHlQqrF8FVvuIxC7iUlAYuodQZYoX8dijBHeRM+ooQSGOEhIehhgs4jBkHKGCipBhSOnxMMQiDkOSGRdxhCBR7Tka58xSGLPB4xzCnuzACJAfeyBVlQw/QB06UpsbB27PXPBIDUD/o6Gg0j8UTG2s6XOELxe9/z2V9GCWM4gUmZzm9CsFfzQvN2hTGZJLj2fIF/J1FlbY7VmW5vJBWUC+PNXhOEhERD55LnWQfZHG+3b2rP6gYEL/oMj0Oogz/ouF8/qEtGn1eXUW6lwaaaSRRhr/EX8B2K81Wi5jkwYAAAAASUVORK5CYII=\"\n            ],\n            \"btn_radio_on_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAABv1BMVEUAAAA9Pj4zteUzsN4zteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUMLDg9Pj8PN0YgcZAzteUzteUzteU9P0A9Pj89QUM3gp06XGgKJS89P0AbYnw9Pj89P0A8Q0Y8S1ACgq09P0A8Q0Y3haI1l7s8REY8QkQ8SU0BkcMIRlwMKjURPk4XU2kaXXYhdpYjfqAmhqovptIzteU8S1AzteU7UFczsuA4dIk9QkQ8Q0U8SU08TVMAl8kFaIkRPEw9Pj8cY30yseA7UFc7UVk9Pj89P0E9QUI8Rko7VmE5boIBi7mSwtIGUGknU2IINkcPNUMTRVcZWG88REYpk7orm8Qtn8k8SE08REc8SU2y4O57w9slmL8Ch7N3ssWQu8ljipcbWG4IQFMrSlYZPEgRO0sUSFsVSVwcYnwxr946ZnY4dYxYtdNYtNM+m7o9mrlBZ3U/ZXMXPUwdP0sAmcwNn88FnM0Zo9Javd9LuNwnqdQjp9MSoNAInM6i2u2T1OmO0ul/zOZsw+BDtNo8sdg3sNea1+twxuJuxeJVu90wrdau6X5DAAAAfnRSTlMAzgMFIRZIGzMeJz8ZE1gqOS8lQ1VRPTbDyLWBT0sxt8OVHDXNpo29oHQp9cGLHBeFemL83MismJF8d3NgTTAtHhILb1Q5I/7psaiKXE1HrZp+QD0m+ffg29a4p5SBa2djakU0/vz49/X06N/Z2NWypKOLXSwk+/v19N/f1tVUbkKTAAAEvklEQVRo3uyTWVPaYBRAe4UkBJIQIEAAlR3Egqite92trWvVdhyne+syLqMzznRfSNjd9x/c+1HHqdU+BH3oA+dNH87Jvd/lToUKFSpUqFChwp9UIboLyF+3a0f58ND0VNgF4AtPTQ/1YeTWGsReH/PCJbyD9aRxS/qZOlS6/M2TwWR/fzI42ezHSaBuhiRuQd8TBognJpI8RXElKIpvmEj4MHHjKdA/0ATgigV4imMYltUjLMswHMUHYjhGbAALN/IPjwI0fuQpBt1Wo9GMGI1WrDAU/6wRINx3gwKuZz4O3iDRo91sqTWUqLWYsUEST70Q7cE1lf39My7wN1Ac6s0Wg1MUHSbEIYpOg8WMCY4K+MH3EGco0//QBY3k84ke5TaarkFo2oYRksAhkglw9ZRXwP37Sn69sdcgor3bLgklJHs3NkRDr1GPa0pAFN+hHP/AKPhLfovTYaOrJeFNx1ikrS0y1vFGkKppm8NpIYXkFITxlsoINIE3QPy1ThPqxzvbN92yHArJsnuzvXMcEyZnLSkEvDCIAc3+eYBgyS+aaLvQFRlpWV9dmV1YmF1ZXW8ZiXQJdtoklgpPwVWPBa2BUWjiORb3g/4Hnlb5++zW1tH2zs720dbW7De51fMAC7glluNfQR0GNPrfQ7SBYq29xP/W495Y3t7Z3ctk9/ezmb3dne3ln27PW1LotbJUIA54qxoDYWjmGb3Z4CDf/3xucff49DBfUFRVKeQPT493F+eekxkcBjMuaRCmtAZ6wEcGsIi2asHjnts7yRymi6lziunDzMnenNsjVNtEi5XlAj4YrtJ6Qk2lAUy01NW68TmTzSlq6gJVyWUzn360dkm0iYzAN2o7JAxEIXg+wHhE/prdzyupSyj5/ewXOTL+ewQ8pCfaAvUQ5zm9EV9A6hxZOzjIof+vQu7gYG2kU8JXMOo5Pg59mgJDkCAbctq6hfaWpbNcIXWFQu5sqaVd6LY5yY78MKQloJuGZoohG7K/fnE/nU+rVwMq/vv+i9d2siOGegcxnZZAHUxSLP6IaanD/biQVlLXoKQLj90dEo0/Z5aaAL+mQBQ+cCx5AmFMvqsqxesCRUW9K48J5BFYLghPNAV80MCRI60RXobupYrqdQG1mLoXeinUkEPlnoFXp+VKAfrPA22hR6l/8ijUdh4IgE9X9f8EfrVj9ioIA0EQZvURrKyMSPAn8QeNIHYWoghioSGksNDGJpCQ9Hl2c0XIXpITMpWBmxfY425v95spX5FK8hXhj6wuID0y3qbqAnibPvlHUxeAP1pnzUeFmyrkSqMCH3aeqoAnDzt8XFuKJ+bjetDt4AvH39T2qA8sHLYybbYynVPNJ3OqKxNf+s6mcn6HLf0XW/ogtvhW6f59ji1jgS3NwWsqgZfnsv70cPDi6Hjn6Bhug7P1SdOPdQ62IUfHEZFARwR+HwX8JvtdlMNvtNsnKPxyfL+RuZTxPRb4HpfwfQjhu6gwM2gOGBDYQvUKC9UDLBRsAvvCBMI29mj8tLGjAdnMxkJG/Eb0bGDEsSjBmC4aRAnNw5AL0XglhyHL69yuhCF4ibeZxzmHTHKc8/+BFI/UJhfKZE7ySK09oaCWlpaWlpZW+/UFi9DSrrMntOUAAAAASUVORK5CYII=\"\n            ],\n            \"btn_radio_on_pressed_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAkFBMVEVPT08AAAA+Pj5OTk5PT09PT09PT09PT09PT09PT09PT09GRkY+Pj5PT09KSkpPT08+Pj5FRUVAQEBAQEBDQ0M+Pj4+Pj5EREREREQ9PT0+Pj5PT08+Pj4+Pj4/Pz8+Pj4/Pz8/Pz9AQEBBQUFMTEw9PT1DQ0NBQUE9PT0/Pz9KSko+Pj5AQEBCQkJCQkI9PT27eu1wAAAAL3RSTlMmANQnDQMiHwkPGT/RATAVykWLhlrHvkpO9sMcsayQzp+ZeGor7Fdx4aQyuHxeYgwIBCAAAANrSURBVGjezJTJkuIwEESTkiUveGOxjcHsO9M9/v+/G0dMRMt0q4QBH/rdOKCnUmYZg05Iz08CVyk0KOUGie/JQSc6CKSTuDDgJo58XyD9BSwsfPmWwAnwkMB5VRD5Cp1w/cgq4I/vjOIUvMBReArXe0ogAzxNILsLHLyCchjBu9fXJFEXgXTxMq58LPAU3kB5jwQO3sSxC3ygZwOY+/dmQO/nAx4n8NATnlkg0RdKmgSRi95YRAZBgh5JtIAJuLcqgQmgpxi0IMAjhvvxNU+J0vw63g87PxK6NXQ0mdMd+WTUravo0CAxXRJRtj2fhjchbsPpeZsR0fIEG25b4MNCURFlk0LcOWfjtFFYp3C0IFJgOYxDmu9i/CDeZRRODmBR0ZfAt0RbNafEMBI37mr4YATYB5hllBdgmeWUFfYUYN2x05o2MSzcrrQ+WYsE2w7M1rQSsCJWtGZnCP4LJPv+qT7fZsjYHGQj4CM+VLQReIjYUHXgY24E3JKNKY/RgVtOE5hZNAL2hYowLL4t9DY9luUx3U7FfVRhOGLfCFyHRHV/L7G71F9cPsT9rEv2jcB1aErzGJpRWN9BI2jijKbcNxUDBSMV7aH5W9bfOH5Cs6Mlt2uQzApQdmiNU9Y/KPetEVJiUojgcRUatxbiWBsoWx1YcUXy4JsjnlOhf4S1ERKtgXMY8ZHAxIjmrReuGT70HVIamlPGAibOtNV/vnCCix5hQ3uYCODCxIrOOuGa5VNPyYSwgIKJJemP8JYXbFprc4UJF2by1pOmvGDdCu0PTCiYSUmv8ZEXHHWTaY5noFYFy5pHrxqlv0vwr1lzWUEYhoKoSmoUKihYtO1CwdciiP//dwpdBCEhtzecNtl1VUib3JkzA2wR9ZHx3xQ/aPhVgV929HVtRAPn0OoHjmxkvkNvkI1M9dBvb6Khr5ctJ6ls4YVX5R/jgtBLx8/jch0lHXnxG5fvLlu+b6cxIMses1BJE3jMNIFpG/vcr1zCxp7jNlZkxF2GEZejhNc9hBK6FEqgYYgK5ywGnNMJcA4OpFRIranrRoHUWCjIY02/SQyYjUcr+mV3QTi+BuA4hPfpgIKOWOiQiI656KBu/qgRDUt9Wq2Le8sJrH/LWEXkDpYGTIG1B3lxY4NWT0xVennmr/5jh/qP7UfUf77mb6LnjEYeBwAAAABJRU5ErkJggg==\"\n            ],\n            \"btn_rating_star_off_normal_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACRCAMAAAAbxMEvAAAAw1BMVEUAAAAAAAAAAAAAAAAAAACioqI9PT0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACPj49paWkAAAAAAAAAAAAAAACfn5+Kioo5OTkAAAAAAACysrKsrKyhoaGbm5sjIyMAAAAAAAAAAAClpaWTk5OGhoZDQ0MAAAAAAAAAAAC2traYmJhycnIAAAB/f397e3tjY2MyMjKDg4Nubm4YGBgAAACwsLBTU1MsLCwPDw+WlpZ2dnYUFBSmpqZaWlpHR0e3t7fVgxBxAAAAQHRSTlMAgGUJTuaZe2oVcFUlBHoQ0rNfQzYr4s2YdRv58eTejjMgBunWy5xbSj3927pHxMGvlMe3iTD2ppGF2LyH66qfatopVQAABLFJREFUeNrt22dz2kAQgOF7gUiI3jHFNGO6jY17bCf7/39VpNgEGEoQ0VmaiZ7vaG72Vrurk1ChUCgUCoVCodB/KXplqUApUMuqACkBSRUc0Rq2ugqMItxCQQVFNANTIKUCoghncg0RFQzpGrSkEZws6sCtiMwCc6PFISciTSAQtSgF9+IYQFEFwBDm4qhAJqp8lwUe5bczKCnfFeFGPuQgrvzm3PMV+fQSgDu/7NzzSzOIKZ8VYCFL72D6nNZZYCJ/GL6n9VpKO3K+N7TEMqVXaW0pH6XgWdbdwZXyUcyp0uvOoab80zOhKRuefZ3THsCQTXNfh5ACVGVT069StF2EVqWoo3wyhoH8FpBSlICWbPFvcKxDW7bd+DY4xmAm21qQUH5wJqF32aENXeWD5SS05dWnqSgJC9nl3Zf2sWob2259aR9lMGS3a1/axxAuZbcmZNLqi3WBhmxZPaBpaWj1erfTGcdisULkk8nKQPbpsyYe+WRf56rTSdXrbtca7ZacFZgc9nYhez2xz2qVsXHqmBZjxWoc4+drUw7oP71xBHOYOuJsZcUwfubz82q12vr2aSKuvS9/a19nkc8/GcbGWqN/P33iZ95ZQUM0uvhWqc6cjU0e0zK5k6+QA+I9ddSK8qJf1VlP9MixgqdH0WwORI4sACOgfS46TX4cvR7HGNt30ef8Fkj21NFSGeBadJmC2znXSgA3osclkCm77R9DwNCSSHkgYSnXroCXqXjtmwEUouoEDyZQFW+17oFRWp2knvC8aucAs6ROFY14nEh3QK2rTpeOYet7VX3OgHhWrZyaSK+ebRextPpHVtyjbbvbqj4n6iWx9T3ZLkt98n3b+pvb5fu2zTa2y/dtW26XpzomcNfQe3e537bnirj1eANkHpS3VkXy0m3vai+3S4NyBmiJK89AMa00yUbgh9v8qaWUPlFouy3PJaVR6YQIDZVGQ8iJGw29rz6igMtSZEBZaVOGgfsnjKTSJum+Dj2CmVaapE14FJcMjWfEKTDErWsYKU1GpzxeX2h8F5OAC3GtreMLldX7Mfdm2t6fFWEm7lW0fVUUh4qc4E3TO88svMkpbjQ12NLagVEgGmzkUGPN5XOHGiwaGmwPmOybU2+Bl71LGmhpsKn9jXXOh8GeKrVYL9b6y3TlDKh14k6Q+i6Kta4yfYktGVXpIrZ8c0+xtpTHLGjvCc/yqavuBOn+++5jzrHy2Bjye8JTWJa99NWeIE01fKAyhOnu8JTUSjexM0gTDVOaCY294VnpjZZB0jyldcE4GJ7DQZpD0fMUej0YnpXejkyqeJ5Ekc0Uam2FZztI/fUk8rp7pDdS6HG+Hp69QTLON7pHSlsK9dtr4TkUJBaTtVG/6HEKzdZfnpDM/i2mYxN4XiZ3y+N/6iSXB4yTBbbEMeHPFtYabgMyHjeyptimz4B57AFUOYGtuvymyPL8WOhigK2wfeHDyX02/ZhjH5SXs9CTNK6x1crKDSuCLX/h1K2Rtzm9eME2cl1NOhls+SkMPR3O7rFFrFP2O8aHhJc3mSN+ammzkjgy3i4oXlans4aAqTzTSST/tfBbV/GA/PssFAqFQqFQKBQKfa1fDsPNndmUkFoAAAAASUVORK5CYII=\"\n            ],\n            \"btn_rating_star_off_pressed_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACRCAMAAAAbxMEvAAABAlBMVEUAAAAzteUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUebIgzteUpkbgJIis7OzszteUzteUzteUzteVoaGgzteUEDhIzteUto84USFwzteUzteUgdJMGFhwzteUzteUmJiYFCgsrm8QzteUzteWXl5eJiYkysuEkgaMzteUzteWlpaUWT2QRPU4MKjYzteUzteUxrtwaX3kOMj+goKCGhoYnjbOtra2cnJyBgYEXFxeysrIyMjIvqdaioqJsbGyPj497e3tjY2M/Pz+SkpJDQ0MiepsYVGt0dHReXl4ZWG8TQ1WoqKhPT0+3t7doGm77AAAAVXRSTlMAgIAFCg4SGCY2MmYVQxwfIz+AToCAmFZ1XSqzboBKgIBHO4CAYlKPgYAuctrNgIB7aemAgIB5WoCAgOPKgPPfxYj5lIDmttLBr5vVnICAu6yAgO2jRlOc3AAACadJREFUeNrtnNd62kAQhbOzqiB6qMb0Djbghnu3k7jFKXr/VwmLnSy7KyFLMiIX/i9yh7/JnGkaDXz64IMPPnAPlhRVVRUJf/ofwLKqhRKlVCkR0lR59TZJaqjUzCFCrlnSYys2CStatY8ouVZIlT6tDmyEJohlnIiuziJs6GHEsxdZnUVyKIxE9hLqiuJI0rLIinFI/rQKcLSKrJnEVyEaVvQcsqG6CtEkLY/sKK5ANGxEkD2tWOAukgphZE9OD9hFooPKiCEbtIskjXVQHSqrdZGSQPN0OwB1NoqigboIx9kUOwSAxj6aox9soim1EZpjCIQDNE8pyFqEY2zTSAN8BVi/ZhpIIcByLYdynIM6pxmAbTRPxPgUFFgt8RH01RwAdBgX5ePBaCYWxc8AcGmaGS6KRgFlvpjzPwFuTZO4qLGJ5kgFlfk4PmFqNABsmVPaXC0q9gIKa5mdO34A3JmEY4DdwMNaDOnNdYAzcwYAnAQd1mJIPwJcmS98B6isIKyVBJ/zx+YLv0jmBxvWYpXuAoD5lwxAMvBqLfWKaI4ngG/mX74ApNE8CeXT0jEifEgfmf+4ADgJbk6jg4cY0jZh3Q8tXTNZ37MMaRrW+8GVIrEIlV/aGCUDUA+0FGF2lj4AeDDn2QA4ZB70l12KlBo/mQ1MBgAoL3twxC9IkiTL8Sw3eFyYLA/cEDIOKfL0k/gFHzZIsqwYhqpGo7G4Rij0QqGQnmJm6W0yeLAM+FI0qU0/1ysUtCnxWDSqqoahKPLUxDebohjRuNbTa4lItZRqZSf5ZnjKuNjP5UaIL0I3JoWWIoZcLlcch6c085NsK1WqRhI1PVSIR1VFxnixMbIR1UKJaisf7o+QI0NahJhStI0cGfXH+WwpoRdixtRZdvvdqKZHWuEceis7AOcmzxbA+iZ6I3vhbLVWiFmtuLEc01PhEXLBdQfg1BS4AnhEbhhnE5rBWyQZvVQOuSMJkDFFzgF2kEuatSjrJCmaGCO37AJ8MUVOAeAauWSvFJfxvD0Rl+6hk5DIHZmKXNPS5LllTyKHXHNAJyGWezLsuydFV6Vyb4zckybDPYVvH+6J/O0yOJpCrqFtQ+SZtA/3jHsyHUrd88S0DbF9eKCq0scI9zSY2VVoH13kFjo8OSl2/XnGMPnKQWXKDkDbtGMNYLcy5Sn5yuPnGYuspAMv1pqIp/y5ntyu7KTTabCHFiGxfdgz/ZuHlUoyeUKt4x5SpFCfsSVZ2V2HN/DdtOcY3kK6cnDCrQFfxnY0RwUELjIzfq+98nVjyv2puZCzjSnna688Z2a0QWD3mlndzgyqsR2c0M58Wzve+HJzc2O+N1s3N4ONjdu1uysgMCullPoiWW5esXWAzpkZBFt3ADBk8t6weJD4TAIoAIuIPXzTqyl0e8BZNDCXzU0G6DMcu3IzIki0aMNcLmcXgj1oEsfi1pnQbQBZ9C6TAVB7uBCimlHKpB4+m8vjHADWTyybK0HR+4hln2R/5sZcEmsk37vW4wcBq1WrZg6d5YT2DUmvQ2HKbc29y5biWcRT7wBZtbw/A/KHtzeFOb9ABKMzo9hgTxogDqn+OQawmrmLuoLZl/BhseUfAsDV0RLC50ScPGoqdr4r2dyGKffm+3F0RfppWbSH3osIFomB9N18L74ADR/RP+ItUBMJdNMk/99HtksiV6eOBIqsPTSOehMksP+TDof+OGqTmayLBMK6im3WH1oK2ci2Zvplg8rFkg8Z2PbgLl7ds5LNf7ZdfiPNYohEsgWFs4dbOhQtZNsGn/3/rE2yy0KuUUmT8eI9tN5EIo/rpEhe+pLryUKufiQmOd4p9bLIRra2t0Hy9NlOrqa+6MiQhnZphGyK5IZnucpW4dNT8JsuW2MkkASGRLbnS0+964eFXKMUDR8HJFXPI5HyLpHNpUVrdnIVEzEJv/3grZBCIps/XI+2W2T0sZIr7+5GFcuxiKVsAL/dCWaztU5pNHz8yHYC8OB2eH6ykCvCXBX7kG3bbe8/AmgslMunbA0Al5N/G+Czd7lE2cL8XrFtuuOW1ywXYbLLrWy1PXGv6FazNOufmOTrJX2f2wS7bvoX3I444vlVvrg7KtNNsCPijpjugHygMol24OX5esDt9Zua1wgS96G7nh5B6LsY9j21/6uBawAw3fMAUOd2HJ4xqsxwTcq0e46592eTmPesj024feixl/kMYH1f3JP5v8zZp2803XEFMHyfGx4lwXX6jNftVIW9u3qfpK8AnC8QZuFM1BAT33/SN8i5og33bWifXy5usP4TX9ZzDo2VrsQIVwP7BnvwHkdFRoQr07cLdhoN8s/3S/ti7f8QDEezXJkeWEbIA0w52Jw9S16d2RZr/8d7WAtzSX9p5540CZHrHbB7BnjgEr8mewuh0YKkp+6hT10zJ2XOnBO/angLIcekv++8uueVMnWSkPhc9/AdQmkx6U+/iQ+ldeokLvG7noOIhtDi2ez+grjnxGJ1KzpzjdsE67Lf0aMO8Gzhnm3aNTknHfGhv+M3iBQmhH5ynX5wwe6bRScd8x3fbyWKtri+8WvuoHONcY9AssNH0hXbPcIa9tfIukzf+NJh3SPSPeQK9y1A0ns7E18N1+feehxlRPeIJEkktQdzJzw7/h6GlARXhTZokaPJJcLVpIetf0HU8DcTqSXLKjRoA0DnYBO9gWGDBjepRGX27sTPOL0PADO1ZnPGYRc5QtfJr7r9Bhiyg7WfsngCcDd1+1eY0qi7uXrahSl306I0/eyBn9IohfpcTF+ed2adwjqYJ9VWDllRn+l2u+U3quUa9+WWrxcL1CpG4mpMz1vr9gSEW24LUjL8JNlPmJEeIkuyIVXCWNFK1k7qvn58nd05+DHocGbOI7Jzj4xn++2o3rQJpVkJ6PgxSK5xZWi3juzdQ9eSpZy9SQ32dslPoe4mu2ixewgzJ9WadoXyceg9qMXDNGf3UCf10QJoM3Pf7B0ZU/fMO0mfIGt8tXsl4vifbPUMyeaXLoqOro26NUgOOXg+X7PdxktqKDtCC0kovr61JVKsLtp+YzmeaC5UzMOUT294REYtUgodXkyUig6Hwf5/I8JZLQqe6taijwniZY57pHjL2t0RqpbDuxKbfMsXZG/rGM3ConG1YDBqLdQtXstbvbtz+g8tuCvoc96pFhYHj1gCEvkR96q14MEemr/0ux6jcCvBm+OMpMT1VDP3LzuzNP5cQ78Nkw/nWxG9EFUk7PUXk1L5cHNSqvViHtwjfl8orsWjhoyxn9+UimtazPfPSlGr8Hv8jdX/ntQHH6yCPxAVpRFrKWRlAAAAAElFTkSuQmCC\"\n            ],\n            \"btn_rating_star_on_normal_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACPCAMAAAAiGKLEAAAAz1BMVEUAAAAAAAAAAAAAAAAQO0sdaIMAAAAAAAAAAAAAAAAAAAAAAAAqlb0miK0LJjEAAAAAAAAuo88AAAAAAAAoj7UAAAAAAAAAAAAAAAAtoMsAAAAAAAAsnMYAAAAea4gaX3gONUMHGyIEEBQAAAAAAAAAAAAAAAAAAAAAAAAkgKIcZH8TQlQAAAAysuIwqtglg6YjfZ4heJgSP1ANLjsAAAAAAAAsnsgrmcEmhakfcI4xrdsAAAAAAAAxr94uptIpkrkxr90lhagYVGsVTWEzteVy6FwbAAAARHRSTlMAgDMambN+cUl6EgLZzY92TehiQ9NmUiwF5moW4Qi2rZaKhlgiC149JsaxnCn88snDwJuTLw7j3cu59ToP+OzX9sqno0H7ekIAAATzSURBVHja7dqJWtpAEMDx/XMkGLlvEMsNUsAbW7WtPfb9n6lZJBVNYwluTL5++T3BfjOzM8MGEYvFYrFYLBaLvYuxiJaGURRRYh1AQ0TIEDCbIjJGKFMRGTW4gINjEREqQHc9yIiImMC5zEYnREfAdylTcC8ioQ4fpFQhMg9FBIwNKElbPiK9qAKXUjmDsgjfYQE+yTUgKUK3gCv56BYiMNEmcCYffYvCzbeApdxIQUKErAIfpaMKNREuVdI38o9B6GXtlHRkytop6a2ybooQrQynpJ/K+lqE6B7mclsOJiJEbcjKbUswvojQJKEvn5uHuspm1OLxXBbaIiyqCbXkC/0QW9GJakIv3Ya4Ww9hJl8qQSGkxfH4AE6lSw8WIhQJSEm3GQxFKMpQlW53YISyFVmA/JvLkLai6eMm5FYNadlvO8u9CxDC+DhyxoZbN5TxUdkaG5EYHyZ0pIcBHIngHCfXRomNadFWh7z0koZy0VZJbCySa5bY1zh5ncgU67VazcBTVXop4a1dqw2LxURi59OtEplygR1cSG8/2IFRK94nd1hxXPqptV/pjYucrXoqX9XJ2WbpjZ+ptTwu5X819frmDN30Wa7aarWkbqVWK5vLfUhfXqH880lpVYBBR76HUgqMkfiX5AEeLVj/eXYbeklV0lkZtFYPjOvdhoI6UU4Gq9Pf8TzKkbm+1UF6AIzG7n2xBnRlcGZAYSR21xwCqZYMSBowLd/DnEEwpd26BCa+t9xrdf3PpH7ZAZA5FL4lTdSSqpsac0Ziv5E/AXo3UquPgJkU+znMOFuGLjc9oDwWe2uoQrqVuuRwymdvR219afuqbvtBQ7xNs64rbZ0roGYJx9vSll5GIF0OqwZcdd6Wrq5K14nQo5nhjfO/k1e3yxLaLFTaPn6Ve/qMrfKULl1py++XtjuVroKOdLmb5Gfp36e+StdKaHdSALrfpU9nTrr0W5VV2nyeKO2sYkE4rADn0o8SMBmLwIzgl9+EZUSAkjD3uzxXRIAyfmf/DZgiQCa0pC/5QN+ukpCX/nwILmfOu6I/nUDfG9vge3oMAnwj/gID6Vc3wP853e/z+zob4Lt+GR6kb8F9izk2QPo3D+yPVw2Y77ed1UUg6vvtQ6dQaIoANNdfNPfQgxMRgBNIyX2cBzTxM6/uQq/ErhTQgDWhJD1U8+Rny/cdsEeQ934SU66y3gN2KrSbeg7WKjYT2+3yHZt12eM1vTQHjOnhoqCC9OndmrW69Euv8LRViRzXPT9azQO4+OrSe4XH+dW1DlKvE/jF9770D4PH8DjGQ2zn73Lx2+5Lf/rxMTyuxyR3kPJgCa2+uL/SP/RVeJLiudUQ28z99poQWjWg6w4PmabHi1vq5mXpD4US2KTPqvCYI/E3qwkvPwLcQUFoZcI3+cc3JzweEutK2u5JPc3Tw3o2N6oDJzxerAm2i69P00NzEV1vlVAr5QqPV5Dy2aci0rs2Fp/ePGc4l+t14zq2eWlzBzR3oprThbJ54GB6uFNzN7deAfsw1jjIDHjaMybWzs/Jxp+8/dQ6zpJwad/dC2xmw88SVcZ22ZLyAqZ6a3o5G6wnRdNnRzWxfSjpreoKnA+wDS3/6a4Y6yNBTWufVmojsQ+rjqKzVw+xtRf77+NDbAda21C58bZrUTd0NiIrYYm3Gi9GIhaLxWKxWCwW+w/9BhJXDgaJOiFiAAAAAElFTkSuQmCC\"\n            ],\n            \"btn_rating_star_on_pressed_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACPCAMAAAAiGKLEAAABF1BMVEUAAAAzteUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUFExkCCgwebIgzteUzteUokLYzteURPU0zteUdZ4ILKDIzteUzteUzteUto84zteUWTmITR1ozteUzteUzteUzteUzteUzteUzteUzteUzteUmiK0sm8UgdJIRPE0IHygGFBouo88KJC4YVm0NMT0oj7UPNkUxrtwtoMslhKcqlLwzteUrm8Qjf6EieZkzteUMLDgvqdYxrt0snscplLsea4gqlr4bYn0ysuEbYXsysuIkgKITQlQwqtgjfZ4heJgyseAlhKgaXXcfcY8aXHUvp9MWT2QZV24zteUFHZYuAAAAXHRSTlMAgIACBQgNGCZTMgs2EGYVHB8SI4CAgF1OgEOaKrOAcks6gEeAgHZuYlhAPS55as2AgICAiOmOgIDTloDmyoB834CAf5KA9+PYttuvgID8xpzyw8CAgK26gO2jqAdlyAAAAAokSURBVHja7NrXetNAEAVg71n1Ysm9xiV2lLiGNEiCUyihhIQAobPv/xxYJmCt1oYIsMwF/7Uv5hvNzoxWTvz337+BUpr4Z1DJTKuqmjalfyEoKimqZnQbxUbX0FRl6TFRUzUaGx7xeRsNK7XckKhka606mfJ0Q5WXFxGVHaNDeMOuu7yIJMdKkrBBeWkRUdtIEtGgq0qJZaCm1iGzDA17KSmS3BaZrZNZxkOjaatO5mgt4aFRWSuQedYNJfYUUadM5tNTsafIrCbJfJ4Vc12LCVpdcopkjU/QFtZCKYq3imi6S4Lu5IAtPkVurCmSMvwR2weQvU8C6rEeNGo3T0jAO/guSVBDjTEgKaWToBpwDeTOuAFSlROxUQyuST8A8OQQaJOgrhNbiqjaCFfQG3YeTlEhE1tZy3xTPPYTxNhhqIpOYmuONN0jQWvAc8bYMyB7QQKKcZ18KdPhejSAPTZ2F3jIlXXfTMRCsTwScA+oMN8RUCNB5RjKWizpt1nglE0AKMVd1mJJPwQes28+gJ9oJ7EMNGr3wmf+iH3zKXzyi+6iAxK79B0AL9mNCpCPvVub/fVQSb9g3x0AOySol154iqhTDpf0U/bDLlCKYU8TFg+xpOeUdd1YeCtSrMGskg6U9f34WpHYhFaDJe07BLbia0XiLn0JvGJBm8A+CRhYSmKRqN0kQTvAMxb0EsDqghdHSiWfLJumomS4JlQCdhnvFfCRv3lIK6Ypy5Lvt69GxyGYim07jqq6biqj+ap9wzCsIrdLt/3Fg3cebkWFnmEY/WpVG8ukXFdVHSdtK6Ys0Vumw7QdN6P1rWa33GoUdb1T2EiODdfrnjcgQRdZYMQ4Yisijzyvvj5Mjm0UOrpebLTK3Z5lVDOumlZkSn8WjKw4rmb0WnohWR+QX3owbUJcK2qTXzqpDwt6o2tVU449J1dUUlzNKutJj9zWNnDFwvaA3FtyS4Nkp9WsptIypWI4KauYPCERnOWA10xw6C+OUQw7Pc2Rafg+tV/0SDR5oMJEV8A2iWij6ZqUi8ftDUlUNeCAiZ4AOCMRDRoZhQbjKXskqjsAGIfbiqLStWlEktPzSGQfp5sQ7wCokeiKP65KqdIfkuh2/OV+psn4iOxRWZW+3+8WSXTH3NjgvAcuSXTDvsItpRHd48eGOD6ia90MYv82LDpudxXHxzGJgF+e6K+e2Flp4l3+xse1sW3gLptnBdj3f3Qvf+NhaeIOEYkLr6RtkLDV0la+vbZdq9Uw3wGbZw/z7dRq42Dz+VnR9exJCRl1LpZ8u5bDLVyz+Y5wG7W1y1LoGnCytjcfcSuOYLcy8XnlxvXm2MFr9lOn/o+uVm58qUw8hqB2xl3d+lVtN/kJ7rtbebFytHkwGo3Y37Y3Gp1vbj5fmUQXulIqqnTyyLzgE8sCuVMWh70KgAfcuXdmvEiUcgBiiMiPJzz0mpOipimdCBGds0UbHSJ8+7/el2d+RznOAthki3W6y8XDvVUqhjcjomu2SM8gxOOXEJ3e+HBWawDes8W5ApB7N2+4Ulv4enrfP/2VEVuQFQBZoVP768c3ktqaNcyxu5jSHlUA7Atbrj79lk3ljE7CtnIAjtjfd+6Xc/tC2POrwaVa6YsDtpSFv6T+bUcQ2o9v3UpLiSkpbSXFkb8P4PDpAsqnJG4ePZV7f6Uz/1dy0ea3jD/3tZ2rbWoaCMJzl0JTSitpCgm11qat9g0wgrZaR0tLLSpQCii+jP//d+hl1PWydxkv23H84PPBT8Is+zx7u7e7udORkE9DZY8QELIIYSqE9HFl9jziSD7YHrBoo6Mo5Y9WR9tC0LU9ZQjtANsjLCrtdRnCiwerou10JsqfkCEUwR4ZmYLtM6aO/3uL1dCl6It4G3d0vStr3W3uM4RQ0Daj0TY/E3RNGEauWlDYA5f8XltBW4sT8//xQEPXuA5XerVF2c0O00Tb2ZxE11BB1/2Kk8f2YGljhCL/D47T0XWro6uzieSMkVm362OG8B5oS0VXg2F090pYPhhW3lEJiU0EbbfzVLlreK6Qj28X0NxBKySPYTQi2uYpctcHhnHQQ/JJ2iit+icM4VwUSddmVwvIXTI8sx1Va92pKGnj/IspYS2GceLbcPpQaNvlfGlaPA8VyavnwOlDoq1lmvtPOS9T6QLacLRFww0jDDh/RaAL0VaMMzYwjPq3cc4eosPZhLZSsI/7iqacyf1G31mzKEP6+7FOsHHSfxLrEfdIo/yC1MxqoE4whr5HDD0gygzaj418b9Pc4mtSQrXTzqlxP7QGI18DwCwGzamJWwOvYdpigiW0OaDHkXbPoynvu/JluqvqoVR0OJn0mzldqR+a7q5/BesX0CdLhzVpCPICJppmGHE+Qe3xVCj0Y5l+9DUNrjlv4b0retC3Emuhq8SaqIwDnx70ZbGuqMHzGZ9dLpISLDnwYV8RBnYDfUtMYPZOn2AvqEtFuF18oU2sz6MRgfjn40I30KvJgZ/OoK1cbJfqnVIhS2HKp/OpMGl2rD2sqct7MHKAoF/o3HMkJPL6UDu0WsqBfxKsp5PQWA76u2r3wCU5ctLoWB345OwBEtIH/ZsnkXugPomcdK0PfBARWUJHOOivzsA90EwCJ8mBHxJEBBJCtRlyzy4DgJMu8f11hyQiKD0g098q3NOCrBlz0mlc+odUEZUqsTX3l8g9cGfH/W35v88535ZXUi2ihMqcf/5tofMeuEeFHaSkkZw9ivYaLZGFUt54Du7RIIycdDP/PXvsENIZTPNBQmeQuZB7dE4avNGJqFKi1UIPoHl2ySG4EFC4LZ/+KhvLpJoIlnDlU+jNQPQLL87ZH2BSBnGLk6hBWdq1pHL6Becc2HoWMj1wO3kW8faF8wmlsM5Ix+JulMjmN1GdMTXZeqrxH7PSG84/oaORpOnF5XaUKdRi7jZz6jW2xxFvb5/GVd0zUDXeUBlyfv0kga2Dipt1Nj01b0MemRTrgtTvEINMoKY5erqiI5Yp2HW1k8Lox+NhljU0qIdWZo404mlX3OgZAiu/FXQ0Uop+wTbJoCDmodpjluCen/2tqsZJbPcw5qF6liLqcCdkWvdAwzDJSawx/UAQNaSyZMSfaLDWvjvpPtOAkMwg2SfhoOfCIxbgJAg3BEK6h3JIh/3cHmxBx166aDMdYNuM9uUohhfAGx+onbyRGzMEQusT7fAgtJs2zLoU2/Ruv5PIWDVvYAve4cFsbWR13W8QN+INbeYQ34jAbOlhiTdccvsMgDZzTGHlXTVpxQpiS8ObE3RPlH8QbOaYDV9shUUHzSqKLf1Aye17qtldyZQw2CuI6ajYrGbRM0OJUrL73ljWnw+bA2ne8oFvPcbFXF9vjt4kN/A7vzJcuxuYz+7w1zBe0ctVNqtb8IWKiUkF8WKS7xU73Xp/zymZ6xl/L+Ta7tYd8WER4U0p17adbAEcTIElPg1bwe/4lx7e+o//+Hv4BrTtIsYUPbP9AAAAAElFTkSuQmCC\"\n            ],\n            \"dropdown_background_dark\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEcAAAA2CAMAAACiEHRJAAAAflBMVEVAQEAAAABBQUEAAAAAAAATExMlJSU+Pj5BQUEAAAAAAAA4ODggICAvLy8WFhYAAAAAAAAAAAAAAAAfHx8NDQ0AAAAvLy8kJCQgICAQEBAAAAA3NzcWFhYkJCQXFxcAAAASEhIAAAAjIyMAAAAwMDAjIyMAAAAAAAAAAAAAAACu+DqjAAAAKXRSTlPmCekADkqr4e4qFcCA2KhEYwUShjwb1K5/Nge9pZ2YXUxALSTIrGZVSewvjJ0AAAC8SURBVEjH7da3EsIwEEVRr5AjJig4Z5uk//9BJNFBw+zQMLO339Ns84Lde+abPq6cs6q6rnN0avWOAD10e3zdoEFYB/hcsQQfq2YO3gmjmAXYWByFHAw55JBDDjk/dgw5f/UvcsghhxyUEyQMm3f8nofweinL8oCtCsE5LTS5Gsf+iKxXDbTWETzb9OM+nXHdpjTjwjkgi7TRywnZUkhwjoeKLUXnGOs4iEuZoQPhHQeJFvBZxTk+g+8FPAE5Rz/0d6kkJAAAAABJRU5ErkJggg==\"\n            ],\n            \"editbox_background_focus_yellow\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGoAAAA3CAMAAADT7y+MAAACBFBMVEUAAAD/rgD/rgD/sAD/tgB1TABzSgD/rgD/rgD/rgD/rwCGWAB7TwD/tgD/sAD/rgD/rwD/rgD/rgD/rgD/rgD/rgD/rgD/rgD/rgD/sQD/rwD/rgD/rgD/sQD/sgD/rgD/rgD/sAD/sQD/sAD/rgBxSQD/tQD/rgClbwOvdQD/twD/tQD/sgD/rgBzTQF6TwDRjgDBgwD/rwD/twD/twD/twD5qgD/uAD/vQD/rwCDVQB9UQCLXADJigDblwD/uAD2pwD/ugD/rgCVZg+GWgN0TACtdAKOXgCSYQC2ewDnnQD/uQD/uQD/sAD/rgBrSAB4UAGrdASRYACocQDLigDdlgDVkgDhmQD6qgD///8AAAD//Pj/6cx/Yjb88eR1WS/sx53/9Ob03sT/3q//8+T/+/b/58mDYi92WSv90qL/6s3/2qr/+vT/8uH//v3/+O7/+fH+797/5ML+0Jr5zJX//fr/4Lv/2KjuxJOPZB7/6cqEXBv/7tr+6tP03sP03L7/3q381qn/1qLhrW3XpGapfEB0WCyFYCj/8uP+8OD/5L3sxpn3x47twY3OnWGAYDFzVCWBWRiRYw3/7dj87Nf75cr/47v727f51Kfnu4bIml+zhEZ3VydxUBx8Vhp4VBeJXhSaaA3/3rjz1rTz1bLuzKPty6HPomrAlFu9kFe7ikmjdz0LoYhyAAAAWXRSTlMAETRqtO3tMQ4CNu3rrmZsuQcJFgUPDR4LYkQlIl9ZLwNlW04r6qwc69Gld1RJ/ObMwrawnIqKfXg55+TevaugkIEU/vzm49/ezaaQjT8d+/rr2c/CsLCtkDTYHfEAAAMuSURBVFjD7ZhXW9pQAIYxtk1CK20ISdgoQ1DBUfceVevuHirdiK2CTJGhDFnuvbfd408WRPtg27seqBe8+QHvc3Jxzvd9tL/R96/QLgpoJgtjshGCINLAQBAIm4mxMtHfRSwmgvfwpDAMAQOGpTwKJ5jnZShG4jyIKxFzGOnAYHDESi7Ew0kMjTelUbCKk9dVn118CRjF2fWd5RwVTKVhaJyJXylsfJJT0yK7DBBZS03Oo0ZhZZyLhVCVgqdFihXXXij0Ahih0J5rRVHUIKikSNbpoZg4JGwozN//sbBtn519CYpZ+/aX4EF+YYMQxpmxY2USPFXjwzuub/OfP3o8bvdrILjdHs+HT/M7jvyichUPialYOJ3zWHH41b65vmaafg6MadPa+qZ950BRx4Hw2B9k8rnlD4527baJKYNuoB8YAzqDZsJmD97KyeP2YDEVT9JZc+jfUk/pRntBMjKq06i3Ake3SyV8ZvRqpZEiQW7VknVj3BAxgWXUMG6bD1eXiKVsWl/kI2BOdtWSxWwyjoBWjRhNZutgQa5ARJ6o0qD0m1ffTmr1ul7g6PRmy+C17CwYiano1yOqMWciVAMa7bvBaxlxqhsRlVozkCzVUAJVjHOq4ZQqpUqpUqqUKqVKqf7TKzymnkpGjElPWmKCGAnMgdr4HIgkL92SUnF99b7FtmoYjbnAZva5cEGJMJrZY02k6/6y3+fUG/uBukb6jXq1z+84bSJRFcWtyFn5bp2Z0BiMOnD16qRfzVh2o/1Kjp22RkhQd8+1YN1Qr5r0mldg0Gj00+NDM5bAsqJOADexYl0Y4anKa/MdC1bfe7PWqQaEU2u2+awBx92iCi6fRM8aPqwsK2xeDgbmJoe93jdA8HqHJ+f8QVdzYZlShJ8NFyySoovLaluPHeHFxWfgWAw7jltry4R0OTvz1xpDUHRlRUd7W7VMdgUYMllBW3tHhRKikPjlB5GLuOK80pLcjGJgE1NGbklpnpgrkkdM8RsdG+fD3RKhIIsBcDkTSrphPs7G0PPDI8ZukvOlIpB7oEjKlzeR2J/jIxpdOUkE3MqJkNGVE0VpF4TELNI/AVOh3l08hzvaAAAAAElFTkSuQmCC\"\n            ],\n            \"editbox_background_normal\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGoAAAA3CAMAAADT7y+MAAAA0lBMVEUAAAAAAACzs7Oenp7+/v6xsbGmpqYAAAAAAAAAAAAAAAAAAAD9/f36+vqvr6/+/v6Xl5fw8PBUVFTs7OypqampqamEhIQdHR3c3Nzz8/Pd3d3x8fHu7u7S0tLHx8fa2tqenp6+vr6ampqioqKgoKCBgYGSkpIAAAA3NzdSUlIAAAD39/fr6+v39/f09PTo6Ojb29vX19fk5OTf39+srKycnJympqaSkpKMjIyUlJSPj48sLCxoaGhqamoAAAD///8AAAD8/Pzz8/Pm5ub39/fl5eUurhQ7AAAAP3RSTlMAEX19/nZzGAIGCQ34/nT7avwk+GpiTCvn2tfTy7i1qX53cXBjRkMlJB8V+Ozi39/MzLezgXl4aV5ZSSgjIhntDpQOAAABGklEQVRYw+3Yx27CQBCAYTtskm3ujd5DgPTeszGB93+lHIwi2cvFYofT/C/waS4jzVi7+tk3C8PqR7mwDSc43QWxMPWfhg2DDRt+GjKqj/Tx0m9ufo22afbHmTYYO3++i4KV4YKo/ZixihT6t9HayQ3nrIP2OCyPxc96QU6U8Ui+6qW8RInXS0eB5NxMxRYpVqPtA0mKXLh2AW2p5SRXQDkV6vSEKKDy4yqloCJIIYUUUkghhRRSSNWkvg9HLScKKs8tU8JXUMl/qki8XREFknediMp9dS8VTA/vvETRr7gLYslO/Emrt/CoKz3TkCc7o4xpF/58OmhJw1JrEM851f8Wi1niHhnNTWaLYiYNM/+NYdTCsBpBfqT/AK7giup/9WGpAAAAAElFTkSuQmCC\"\n            ],\n            \"ic_menu_moreoverflow_normal_holo_dark\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgAQMAAADYVuV7AAAABlBMVEUAAAD///+l2Z/dAAAAAnRSTlMAgJsrThgAAAAdSURBVDjLYxhhoP7/kOcgwGjoEB06o0EF44wsAABBWUMn9krmtgAAAABJRU5ErkJggg==\"\n            ],\n            \"menu_panel_holo_dark\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAABCCAMAAACsNf57AAAAw1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsLCwVFRU0NDQgICA1NTUfHx9OTk5DQ0NEREQ8PDwwMDAAAAAsLCw4ODj/AAAqKiogICAiIiIkJCRKSkpMTExHR0dFRUVOTk46OjoxMTEiZHnYAAAAMXRSTlMABA0CJBAIChgTGyAqNlAWSWc8X3aJfI8eLidAMkU5TFtWPW9Ug3nti2Dt29rj4srKKLM+WwAAA8dJREFUaN7t2dlW2zAQBuAsTqLIK06gtmRbjhPC2oUlFFoovP9TdUZGh0SmoaeVwBf5H0D6jmacyOPOq7m0lE47s+p8eHaEHWFHeJPQX0vXQNbX+xvClp0NWbYT1ObDOiNjGdZREI3QBKjdewajHE3ESgfg7rj3ADI2GFwPJehQiCZBCRCA24fPIf8VtQoyEKEMDYICjOrtQ0IpTTCugSQYWJCENWOkEE2CrMEzQG7uGIuEPCNkNV4joEACnJMv9w9a7vX8eC0/G/ml5/OJgwhpeCZcvgi6KBiE4cm3x8drY3ncyMPD15MwHKABS6EIqgzyDEJKz66fni5s5enxjNIQz0GWokGAMyA0ObImQML1UUIJnMM6QSL60Ai9HpxB4rCrC6u5Yk4C59DrQTs0CNAHics82wSPuQn0g0aoyzAm1GVpZpuQpcylZFyXYp2AvUigDJlvm+BnUAqCHblJGI6wE1wv9WPbhNhPPRe7YTRsEhIgFJVtQlUAIWkSsBmJ66RZldsm5FWWOi7Bhnwh9GsCNqPP7RO4jw1ZE/oaAZqxyCPbhCgvoCEbhCEQCHU8IAjbBAEEz6EECEOdkDDPj6PANiGIYt9jySuEMUVC9R6ECgl0rBFGAySkBRcL24SF4EWKhMGoXYSuJLgeEma2CTMkeK4kdJuEmAf2CQGPd4TWEvqKULwPAduxfQ9lKwgt+IH+0L8piPZnbdnQ/LPuaFcWcXRzYTFXR6JxZcFsXNyOz+9utufqn3Nzc368cXHrrBN69fWV5+Xx6e33t3K7NXd/zOlxmfP6+tp7IWiXeC6CcrI3ny4PDvf39z8ZCSx0eLCczvcmZSC4dolfqemCIsBjKWblXm04BIWJwEJSsFfOBDySitDdJNQ/TvBMQDcEi3ICiPl0ulweGMhyOZ3OATApFwF0AjwP9Q+TIsio11qHpVnFo2BWThABCiOZS8CknAURr7KUOeq1Vs2aXl7uiSxFwXMhFrMSGWaC25ezhRA5L2QZiHq51whyxMGgFDHPIxEgAhgGUpYICESU8xjKwOSIo0Hoq1ETnAMgiorneRQJIQIDgWWiKM95VQAAzkANm/qKoM+aoB9S348rDgpwGEgO4byKfT+FPtBnTSt97Ij94DAvTbPM94uiiA0ElvH9LEtTjznYB5uDx1Vz7kjRwDypAIeBZJnc32MooNrcUR8A4zkAAhQ4/GUgMRJYSA6BEwqA+gzaOYNGg0SoWXxICDUYQkI1h1eD+BZ+j1CfZWoFngVKjEV9HML9JaDfsm9TKy2XlqPv1/kNylczeSvTmjMAAAAASUVORK5CYII=\"\n            ],\n            \"menu_panel_holo_light\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAABCCAMAAACsNf57AAAA5FBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADd3d0AAADJycnMzMy6urrs7Ozu7u51dXV8fHwkJCRjY2PQ0NDb29vt7e3s7Oz39/fy8vLv7+8AAADx8fHk5OT/AAD39/f19fXm5ubr6+vo6OjHx8fKysrNzc3Pz8/R0dHT09Pz8/P5+flMDi8tAAAAOnRSTlMAAwkNFwYkEBMgHDsqNlBJGnaJfF+PZycwLUEzPk1HW1ZEb1JkgWCGaP1qY+ff3c6KiVsm+vf09OvngRpQJAAAA7pJREFUaN7t2Wl3mkAUBmBsCJEdY1qWYVUkLtnTVY1ZuqQ1////9F6QAKOx51Qm8YNvPod5zp0ZmLlyKzNhFG47M+PePDvCjrAj/JPQYJi1BHr8/ZpTKNYSirHfMUghoQg0oBh+r8YUjBKCJhTj49gHkGaNweehpFC8SMgB8F98rUHGAkERaAAOj6MbhgQRa4oEMQx0ICNH0IS8BBkgG16oLRkjQ+SFoAkoyADXo2/zu7W5/c88Pd1+HV0jAg05YVIqAgoOeH50Pp8yynx+dz7i+QM0PJdhUhU0YQrOpmOGmZ7BdDTLhkl5GrAGkvh5zDLTL6KEdSimYgJ/GQH2AtZAML+PmebBFLAOsC8oAk5DWgNTYU1QTKxDNhUFoYEEXAiiaRPWBGKbIi4HJDTKBFyLOA2WypqgWjgVsCKrhH0gNGEaFFuVWRNk1VZgKppA2F9FsGSXNcGVrZUEXIyGKNjEjVgTIpfYgmjggiwIjZwAK8HxWRN8B1ZDTmhQBMEkaqSzJuiRSkxhNUESFCL7HmuC58tEEaRVBEMyFVXWNdYETZdVxZSMZUITCLbqvgbBVW0gNKsEfDciQXa9LmtC13NlJOD7kSaIQHBeg+AAQVxNUCwghKwJIRAsZQ1BY0/QdoQdoULY1k35Bq+m7XpBlz9T9+PlsP1McfTH+hNTw8Ng+WPNVY4scqSfDMYMc3OiRzJ1ZMFUDm4Xp4+Dmw1z/0JuBqeXlYMbVybs5cfXq4vTH6vzcym/qDyW8ruUP4t8PLm8yo+vewWBPsTrWpAMO61Wr3d8eHj4vobAY457vVarM0wCTacP8TOKANvS98Ig7nda7TYgQLF5jgHQbrc6/TgIPR+2JE0o7pQG7glYDVo3OAIEVAIcdaQFFQDAUdDVYCXgfjCKOyUQMBmBxzslcR1dC4Mk7g87oKgl8KBhP06CUNMdl+Cdks8IXInQyC/3eKt0It3rhkGQJHH8oYbEcZIEQdj19MjBG2V+uW/khGqLw1QsVXYj39MAATmqIUGAAM3zI1dWLcXMWxw0AQxphwHqQADhRL6v656n1RDP03XfjxwAEKhB2l0AQUGge02CaVsqIpwIGODYND4MHzkIUC3bFOhe04xuO/IGIhTbsogKkJoCjyKWZSsIyGqQC5BA9x0zAyBQQYhaQwjB8QGQCqi+I9V9RUTW/k2bvyZIagk8KG0CSwjIO8Db2INODYjIe/HgWETaKMYifNGHBwAKtvD3CDQ8I1IHSmpL8eMQAjBb9tvUjMqEcejxuL9XNZodPDUZeAAAAABJRU5ErkJggg==\"\n            ],\n            \"popup_bottom_bright\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGcAAABOCAMAAAAKPPg1AAAAjVBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABNTU0BAQEAAAAAAAAAAAAAAABaWloAAAAYGBgAAAAAAAAAAAAAAAAAAAAAAAAaGhpoaGhQUFAeHh5ZWVlaWlr///8AAABqampXV1fx8fGbm5tSUlJgYGBRUVH5+fljY2MLHkH2AAAAJHRSTlMAAwYME1IpDwpBITgvThvHSx0WJDP1RW48Oi0ZPUlm4pBe9LzqzGhUAAACDklEQVRYw+3S3VLbMBCG4YQkwrJsodjGjSwrP6X8lAD3f3nd3dkwTIMSK+aEQe+xNc98kifR3WPxx/jIdHo1u57rXBRKmsXi5vHh6U98Tw+PN4uFkaoQuZ5fz66mU1aSk5zkJCc5yUlOcpKTnOQkJznJ+ZlOBo77QseBkwX2uKXolPQjHS9VJ5YudG8ZO70vRzml79nJwk7dNeCUI5wSnKarTzizeUVOO9Jpyanms1OOaKw0ZoRjjLSNOOfQD+f9CMd7+t3+dyh2Dg/UtuC8XuC8gtO2h+dhhzt2rJR3b/u/l7R/u5PSnnI+Xlwvt5v988vLc1R4YL/Zyv7DtbFzPEjnMEj15XZz+/s2Mjix2Za9gjm5PswJODgIb87sduv1+ldM8P1uZ/DWaE7YQaiCFxJFY63tZeuNKYdmjG9lD+eaQsDrVMh87vAgTZBayQscuVLEaJ5DzvEghvJadCDBIrAGBgasAaUTdQ5MaA4Pel+EUqOUxVbnsphSDSrva3jOscODCMprogrABlYUhNQ5MTgn5DCEixxISMVECCgO1xCDTmAQQyQtwQJsYDkYS1KYCczBEKI3QqlyTgM2OK2dq0DBOyOGlfDV4SSkAIsICERwzIlLY4gloNBCbVAkoIEIKcyEIZaQii9jhZkBEJXFRWfOMwwhxVpMLDDCzDlrVEFjvDpJpVKp79R9fJNg/wAgGweRXaclSwAAAABJRU5ErkJggg==\"\n            ],\n            \"popup_center_bright\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGcAAAALCAMAAABVqWPqAAAAS1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABZWVlEREQODg4AAAAAAAAAAAAAAAD///8AAABbW1vd3d2VlZVSUlKKX/cCAAAAE3RSTlMAUAcDQjkoIRoUDwvvsGdNSTEu3NAXBQAAAEtJREFUOMtjIBWIQAHJ+iAUMzMTNxcnBzubECuLACMjr6iomDAZQFyCh4+Rn4VVkI2dg5OLm4mJGWrLqD2j9ozaQ749+HIwyQCPaQAIoTUzantFuwAAAABJRU5ErkJggg==\"\n            ],\n            \"popup_full_bright\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGcAAABnCAMAAAAqn6zLAAAAq1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApKSk8PDw2NjYuLi4AAAA+Pj44ODgqKio5OTlEREQwMDBhYWE0NDQTExNra2tqamppaWlFRUVqampqamr///9cXFwAAABTU1NWVlbBwcHHx8fLy8u9vb1jY2PT09OioqKZmZkZwWr6AAAALHRSTlMABgoOTSMTTxY9Kx0ZETMvHydIRkA2ODqBn5WJRJqQe3iFgf1qUOrf2pTl5E4lyI0AAAMkSURBVGje7drbctMwEAbghDhO5Pgoy1YBA06bHji0TYEA7/9k7Frd2jOtHEnN9DT6M8MNcr/5Vd9kt5OxXFlm8vIzhY/ZqanbD586xgYk5J1lzCWq0hMzw/SYkaQQAhKrKM5A6rugEYbh0irwAFokjYWUBI04jlcWgeNgAbWv0pSYBBAg8nxulTwHDCiSxtugAkXAKIoisggcBwukMEQIC2nqEIMKEFmWpRaB42ApaTZWiJhOAaOqaymZYaSs6ypFak4QFtLWUQwikgnRNE1pFDgoBJN1ilAeLxMFPRBi4nweZWnNRFNyHgTBwihwkPOyEQwkbBQmmkJYB2+tYyopJUFmIUZKBdHNaeus8NKkON20x8fHRx8tcgQPtBsOjaIip0IPBBysU0SpZKfr77tLh+wuWi7rLFKFdH1mSVenYnL97WR77ZDtycVGSlUIL+6+MumuLV7NoY5gX3fbvzcO+bfdtUzU8BuKl3RxmmuDOo34dLn988MhN9eXX0QjU+3FTTtniU4teAPOLxfnNzhNw+DiVvHQuYKPinLUtQXlY5ySiyorco2Dr0GonCbgj3E4F/U+B99qVgb8vbtzxINGwosw5qjXoFwEj3GC4PZFeCIHX+wxR/DX4pRP4yyMnPoADvOOd7zjHe94xzve8Y53vOOdV+BUB3De1vfGwffgl/C9/mDO889dDjlHeqa52B1z6xxozqd1Dj+31PS5N4f96RDNHFY/Vz5znSufbyTTzZXJGc7Jz9zm5OctZzQn3zv3r6Q4bdefIR8sgufXLRdy39x/uMdgbnsMCQ8O9xij658CIWRAWRgnCGgvE82xDl6bfjuX3EIpSqLbMnGDwDG1aKqgDTDaOlSo35ul3UpLRbCR0H/KukqhzJCZji/oYoAKWgNWRlGLwAgUtZ6jOppCg4UjUl0yg9BmE3eoPTMdX6Aqida08LDJB4NIbLCnpYUwrZ1XmNwoeBIRUEYZyv01emyUfpHer7dNFvbKgoSGwbMzRKjMvpBEmFmIIGUf1NV1+asNMowUsvAfx9w9byTRMUuBAKtgf4cnfHx8fF58ruwz0eY/HRQD4ERyIRoAAAAASUVORK5CYII=\"\n            ],\n            \"popup_top_bright\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGcAAABOCAMAAAAKPPg1AAAAgVBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABNTU0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA2NjYAAAAAAAAAAAA5OTlpaWlYWFgjIyNWVlZFRUX///8AAABqampXV1fx8fFcXFxUVFTHx8e+vr5kZGQwQJg3AAAAIXRSTlMAA1IGChNMIRovKA9BOMcNF0g0JSw+HpUcOkWN9aVcv4I+EWOzAAAB1klEQVRYw+3YUU/CMBQFYJxattGpA1q3qqgIKPz/H+i5vUsmiYV2I8aHe567fDmnfdrkZNYpmSTnalzSmOshiYd64yY9vRWnsHGfGrYipE5hYzab3aYE59nqpBNMrzDxkBLGfkjnGChE5HneIDYmDYLzwFhi6AxDCgw7nU4X8cFpC4ukkxBN6stAAQKjLMtlfHB6QRRJvtIVEqrTMXa6AFEU85QUxXIJynZQqBDXIaYhBUZVta2JTdtWFSySGkAoFHT83TBTzKvWaO2cq+OCk1qbtpoXDM0YCtVhBmWggFBKZXHBSWCQUImhQCG6HVott2AwGEOQIlMzg/kA2ZyWu/6tUF+nRBu9entCHlNCH7ytNBqVXaGQQ3WwGkZbvTzvhuT5ZYXpsBwVIicwm69TGQPmc0gAGVNxIR4uMJulOlq/7g77r/TsD7tXramQDQwHhx517us4d7f5eB+Sj82dc75QjqcdcDCbd3Rdw9kOYLZw6lp7xw/XO+sjp6HZnFIjHKUcDdccOesjh6/HjHYMHHveqVU2wslUfdbpricb5WTdBQUdPDd7McfiwYWci/b5P44a6ShxxBFHHHHEEUccccQRRxxxxBFHHHHEEedv//OFs07PJJhvB2dQcPxwm8wAAAAASUVORK5CYII=\"\n            ],\n            \"progressbar_indeterminate_holo1\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwBAMAAAAybmm2AAAAKlBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteWZdn3rAAAADXRSTlMABRAKFywhOfYnMR3v8BlJngAAAUFJREFUaN7s0D1qAlEUxfE7hBRJNc9ZgZk0IU3GZAXGzsZG0A1o4QIEewsFQURBtLHyoxURXIS9he7F8jRPEN6c7vzaPxwu10RERERERESe4R5ACYExmtgi+oXolvx6ZXGEEgBjLM4c+0L0zEofXmkcoQTAGEtmCftC9NQ+K17lnxeUABhjSa3EvhC9bNWW1yFLUAJgjKTz7/6O5AvR93aqey2LBZQAGCNp7t33jHwh+tTaXa9dsbDo5gBjJL2J+9qQL0Rf2/nmdRm/jW45wBjLwObsC9GvD/9Ve8VAAIyx9K1BvBBd/8r1X6t3DATAGMvQtsQL0fUv/evenh3bAACDMBDcf2tW4CUapLsRKBKwzevNvLz3/seDedlX277qHmr3kHu73dvynJbnyAtbXiiPbnm0vqP1Hfq02KcBAADAwgBwBEHj/3RdFwAAAABJRU5ErkJggg==\"\n            ],\n            \"progressbar_indeterminate_holo2\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwBAMAAAAybmm2AAAALVBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUW/iK7AAAADnRSTlMABQoQITkYLCcz9hTw7fhFXIgAAAF4SURBVGje7dmxSgNBEAbgOUE03e5aWm0C9l7ExtJDlDRpUtgmcgg+QCS1KGqTQkHyAmIjKEF8Ct8iRQrvGcRrdCN7e4ObsBf+rzpuYJYZuGN3lgAAAAAAAADKkAUERdKnmdUCyy0ockdJ1e0kybpHWkTGaoHlliSdUU2Npp0m1fQoFpGxWmC5NSlnNKbd1C4WjbfUn55W5mpec6/spQzcas9i+o72aJzYvcqtxKOWVifJL4HlLq62m0dbdNq3Ot+XO1d9fy62Nw6NF0Hlzqt1RS/pqGN1fCvf7zv+PLxsXhsvgsqdV+uK3tFHZjelm8ynYS2bm+H6c8bArvYxj34W9mtCg8r0q73G6Re/2icaLLxf7dWf56r1a4p+saqdlOrXqDr9qv2/X6PiKPrF6xe+R873iP9X8P/7Zd9PYL/6Z7+K8xDvPITzNvO8PXbMMDw6mJm5BJa7W2aeg3khb16IeTRvHo37Dt59B+7TmPdpAAAAAAAAACV8AcebDMLiSs2oAAAAAElFTkSuQmCC\"\n            ],\n            \"progressbar_indeterminate_holo3\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwCAMAAAD3noS3AAAAM1BMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteXQS9SJAAAAEHRSTlMABQIKDyEsGDkm9TMU8fft+mrRFgAAAchJREFUeNrs0ttuwyAQBNBZLsYY4vL/X1sbq/CKKky16pyHJJZWuyNnQERERERERERERERERP+BaT/mQ2UUgarIA2nXH+t9uj9E7m9jZLq2WRFdiVem7cfGBw3EWrkfxb5ABBCxiogARk3ilWl7TcYHBda56/l6ctO1zYroSrwybT82PmjhQnbWGOtymO/ZHBT5eRc6LEzbajI2KHXQIXsfrIgN/gX52axItmL0JF6aNtRjo4O55kOI0TsR5+M2Xdushq7EK9P2Y+ODMcCnFLNIjmmfrm1WQ1filWn7sfHB5PEp5YhAPMobEpCKKqm+Cy1Wpj23sWO1T/5TLl+1XhuwsV6PHdj01Gtl2jONHat9ikvqtQN7UYX1mlKvjfX68z9MV9pz/2W9EpBYr5Y4qarXsrTn6LEjsV7f7dsxCoAwEATAMlb+/7m2WlgYONjFmRccKCRcdhM+WNe0H34vh2PCcdM17Xm4e1V9sK5pA6/2FhMP1dPuLCasVa1VB9eqHoWKJy54FPKk3TtxwZP2aCBn1QVyVlUgZ8UHcsQJb8QJ32zGCYWhmyfOD0OrcqhyzFU5FNGaJ84voqnRqtGO1WgBAAAAAAD4gwuJzBUuUw2jkAAAAABJRU5ErkJggg==\"\n            ],\n            \"progressbar_indeterminate_holo4\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwBAMAAAAybmm2AAAAMFBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteWkAkYNAAAAD3RSTlMAAwoGDyEsGDkmMxT39O9TQliZAAABzElEQVRo3u3ZP0sCcRgH8MehoCZ/6hvwDzSfNzZlRoOrIubiJAi1hHFEi6O01GJBEbgEBULQH6I3IOLSFjT5ElxFtOvH1XYafPGODvx+lpueh+89cMfvjxARERERES0tpVRYP0IK4dT5woniMecFF84hWliUaZqGEhU1EUrX+cOJ4jUjHFIL51C6iZJ0QjMkmgBgBQHonAyH0niOGU2SkspqSZXOArCCAHTOGNEUnmNGk4zsWpZ1klGpVwuhCyx/OFG8Vo9HchZg5kie49FcXV4K2qHaKEAegYIAdC7HI0dgiXskRd2kLMfVarWWVzsXVUAtbwIFWGfDh86t7Vhp4RytrVjpUvaazebptfl21wRgBf/f+f5p82rRHE6TWxna2qfc2JCxPNj+GOso3muvDWxM15Vjer4y/PqZ14ccBGVeIx3Fe41VdF59V45pZW3wO6+u7KNvdWb7YwREQeb1js7LlWNSWeW85ur9Na++dIIzr47tvcY6PC9Xjkmb88Lmxe9xvh7/Xx7877meANcTXK9i61Xuh7D9EPfb4H4bP89BCwLQuejZeQ7PC2eZf17I82jsPJr3Hdh9B+/TsPs03teC97VERERERERL6hv2rPU7MZ28hgAAAABJRU5ErkJggg==\"\n            ],\n            \"progressbar_indeterminate_holo5\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwCAMAAAD3noS3AAAANlBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteV6AHYNAAAAEXRSTlMABQoQFyw5ITIm9R889PfwHc7yYP0AAAGqSURBVHja7NLbbsQgDARQc12T7KbL//9scfqQSyshdYWFpTmPEbFHMAQAAAAAAAAAAAAAAAAA8An3y/5VwbHMIBu5Tyn1Z5Nw/ka+O+cVHMvMsZH7lFJ/9k+/fLjx8p8PCo5l5tjIfUqpPlsONCHeBC+dizpaCNeWmSOXN3/ucSn7NZEDTVwfF2uUF29fFRzLjLGR+5RSf7YcIKJ3SRdlDc6FtSQFxzJjbOQembK8O7NlORE9OF9wkf8KZw1conOxLTNmzx1mzz0wZb8mcoCIvurNqxCVV1XCRFwN4v2SZjcw5ZY6s6VHf9RrSURpqUoyUa4G5f2SZjcw5cad2UtCvWZ8OBsp/10vJmK1m3sSPatBLTfPX6+BKbfcmb0w6jXjw9lIiXp9t2/HNgDDMAzA/v+6szcDHSIZ5AUCkqGN5aHn4DpSul5Dz8F1pFxcL5/2iR/NHSn9OQ49B9eRcnO9PKsGPlh2pNw8qxoK5Y1bOlJuhkJG2qdzJ4y0FXLO5k4o5KgTphX1OlIu6oTK0LdzB5ShrXLczR2wymER7XDu94toAAAAAAAAAD98BS4GIUUirlsAAAAASUVORK5CYII=\"\n            ],\n            \"progressbar_indeterminate_holo6\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwCAMAAAD3noS3AAAAM1BMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteXQS9SJAAAAEHRSTlMABAoXECA5LAb1JjENTd7cUtpBCwAAAcdJREFUeNrt291ygyAQhuFdQCVgk9z/1ZbGtkfgTH/QVd+HQ2bYb8IeGEEBAAAAAAAAAAAAgL9Q1VgZqvXJ/uOrcjzcWIJbTt4h4LJmcyq6uo8sGl1P5iqfPfgSsMeazSkXqmanIurm0JG1ymcP3iHgsmZ0c3Uqisy+LjgRF/wOglMtlY+nBBfTwXsEDFHUhWYL+aHOO1Xnh57MVT578B4Bg1Odfauc+DTVpCGohiFNPRmrfPbgPQImP2ssazbKyTBW5RRiDCmPm8vJx+hL5aN5BQ+Gg/cImIegjd3KKajcnnW3JJLK5A6ySH4eUX79ZIZ1CPgIIm/NFmq31yQy7fNbjSLj84hK8Ml0e3UI+PDt9ppoL+O7Zz7g/ZftlUUy7fXT4Nl6e/13wPvQbq9MexnfPfMBaa82+7tnPiDt1WZ/98wHXG0vHu2NPzmbD3jnn2OT/d0zH3D9xQSvVW2/tTQfcP21KodCps9czAdcPxTiSPtCwXc40uZCzoWC9wjoVy/kcJ3Q9m098wHnteuEXIa+UPDtL0PzKceVgu/wKYe2SKE9Gax89uBSbLimvGhlfNPNxyc93LCffLHVkgAAAAAAAAAAALiGdyuD+5ssDOz3AAAAAElFTkSuQmCC\"\n            ],\n            \"progressbar_indeterminate_holo7\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwBAMAAAAybmm2AAAAMFBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteWkAkYNAAAAD3RSTlMABQIKEBcsOSEm9jMd+vBmaXrxAAABc0lEQVRo3u2Zv0rDUBjFPzNEShZN4p7aJ4j6AkF9AFG3Dp0Et2wdfAFBBwe3OgtOydpdB1/A1UdwFy7xZvLDofY09HJpzm9qPw4/woGE+0cIIYQQQgghpLfsa9RgZTKRAIjjdnHq0in7c7iribPADmAAh0/21oWlMkkONXkW2EE38p0twIHbg8StS3cSy9GJ5jge2gEM4PDJ3rqwVC6nl5qLg5EdwAAOn+ytC0sVMr7VvOWJGuDgDtw+Gjt16dT9ubxfaZ6K1A5gAIdP9tYFpa5f5W6qmRfpbNqR+dke4MDt6cypS3dy8yhfjeb7YVA1HTF19AnEYfugcusyk9/Uy9++JmH3p6mjZo2UYeXWZepwvX2V2/rfRvX1zL7+xZQL+qoj7/uKKrcuo1If7Avri+/jEn3x++XV975P6wmuVxevV7kfwvZD3G9j+22e52DnOTwvhFIFz6OhVM77Duy+g/dpUCrjfS12X0sIIYQQQgghfeUH+E4C2CXdn30AAAAASUVORK5CYII=\"\n            ],\n            \"progressbar_indeterminate_holo8\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwBAMAAAAybmm2AAAAMFBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteWkAkYNAAAAD3RSTlMABQMQFwksOSEy9h4L8O0G0W7OAAABgElEQVRo3u3ZsU7CUBQG4GMHlc0WuzG0TdxcDJCY6GJgKwuSvoFhwIWtcXZpZWGT8ABGpg4Y4kr0PXgMw2Jd1Jv0NjbXHG5K+L/xkvzDP9B7zyEAAAAAAICd5WU5RGR4HBy1IPV00pTz2wiRa0o88kwWlmO4Zo5ypRfniEYssgOJRW7Aonu0ZwfsRLph68kRjXSpV5csvVqdxaXlvuWdlyu9OEc00qRGW9L0em0WreuTRt55udKLc0QjLfKjrFHHfH+NOLwsa37ETqSf+npyRh3ru5E5LfqSuXnRZ3F7Vl3knZcrvThHNHJDcZh1d2+eP4YcJlfHcchOpFdjPTmikQmtUskzPaQ8xpV0g8aHiaacp59GPmmV9+sg5TE8SDdouJ9oypnRAH0p5Kz/7GtG0+3oq5JoyvmgKfpCX+hrK/rC/33WGt/Hf94ncF9Vu6/iPaT2HsJ7W+29jXmO2jwH80K1eSHm0WrzaOw71PYd2Kep7dOwr1Xb1wIAAAAAAOyqL3DZCqyBVRiEAAAAAElFTkSuQmCC\"\n            ],\n            \"rate_star_big_half_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGgAAABoCAMAAAAqwkWTAAABEVBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAA+Pj4AAAAAAAAAAAAQPEwAAABoaGgAAAAAAAAAAAAAAAAAAAAGDRAAAAAAAAAAAAAAAAAdZ4IAAAAmh6sAAAAAAAChoaEqlLwjfZ4SQFJDQ0MAAAAAAAAAAAAAAAAwqtctocwhdZQ4ODgAAAAxsOCmpqafn58qlr6Xl5eJiYl3d3cKJC4hISEAAAAAAAAAAAAytOOysrKjo6MtoMormcKUlJSQkJCPj4+FhYVycnIfbYpeXl4OM0IxMTEMLDgGFhwxrtwsnMYpkrknjLGMjIx/f38YVWsAAAAuo8+bm5sieZofcI5vb28bYnsbXneqqqqnp6cea4gzteW3t7cki/zoAAAAWXRSTlMAgDIGGk5+mmF7N5lws1oWaGU8hXdTEguzD8x0beXYw5ycRCsmIvHmvZcd+eri29rMvY6NVklA/vnn5d3X09HJuraslZSSiPbh19DPw6cO6d7Aubivre/stqtpT24AAAQ9SURBVGje7ZnnUttAFEZ1ZEtxi7txsMEEHHoNoYReQ4AQ0ov8/g8SSTizlhCoLpnM+Pxnzvjq7nfvLsqQIUP+BSPlrvIklMmOKE9ADmgo8knVMUkr0qnCGWQU2aTa0AEWFMmo8M44foKvVIaW8RP0UUUq01AzjN4kTClSKcKcKVqGekqRyK0OM6aoNw+qIpEteGlYokOoKBIpwJ4t6tWkHtpXVm/fib6BpkhjAyb6oiXISmuHpg7v70Ry2yFnt0Jf9EFi4JXh6k5kAUgaSyUrFYToFLYUKWzC7wHRZxhTpNCG3QFR742kYTFtHaJB0bGko9SACYdoSU6yprIwI0QW5yBh8VIhbzhFR1BMXpSBa5foLejNpD2jOmy7RNagzSXoEPHjFh1IiKEKXDlENskvKSN2/AiRqF01Viunbbpqn00tA989RKtQ0LSc2idt49cfaVWtalqxUtHxZPeeyI4hT8YqFU2bMs0pd7w0yvjQMrxEq8LkTaGoDsiaOKnlbX686NNqXW4bDpFgaW3t+HmfZzZut+rMMfLfX8y1Wnuzs9uGHz0/lsbH19ZuTLNVxsHypTKIyDTii0Sv0C4pitv0NWHRIVAYcXd0EfiYqOi18DhMGpCfTU50CpRHH7g0crGXkGj8HNh4YC6qOnAdTyTa4LElaboNnCQgOgKy3cemTgV4ORtX9M1qA0dbe7dErRNLtGMd08xj0So+1EQM0T4mWoD1KF3wLZ/f6dFzwaZR0a98j3S1nW6lwAuCDnyJINrHcXoCli+/G1wkypZVww3zDUw6PqIYZRPkssBcMJEoWyPCMl4as8sXVHQsyhaWVAOTlUCiHVG2KKhZWA8kmhSHNBKlAswEEYGuxr2IfwoiegOxduNRuAhUutOY94oq/Agk2o95r8j4d534SLfxHn+2/UTiThbz9hVMdBDrPluE64Cit5BNxbnxLwaNoGfwKsaDYz5wqN6AFuOVaSKASLyjxHiq/RR8TJxHfoNaEInqZNF7vEZ+3Z/yHnydPPOHHqJlKEcO1Mt7mpkTLOaX75tqEYO16RWonQsgi8lRYsHavX8xe39yt4WqlurZeELh0ICW07OyDhSmrYeUDCYfXOEQscHrruG6ODe4VOfsH7XjMM1HavA0nA169t71f06fkYr9o+I3eNV5Jftyf2ur6q4ftRxp+hUHZ97lGdDuulcX+0cdOKZf+AQfSO7FCXt3b3r8bN3RfpMREnxBJPeV1Wz1rvc+Vh48UzcRPlL1b/7MvsSkePvQzNrSgfPVvx+pEuETdSxPC5PCIwXpn6nnvyKO2bb9P6kVqwn0KZ8/VttA7fBuzKZDb47rxsxXTDIl/5m/aQft595zyIWe4h/tXqurwY633RSTa6CF7oWanTjNwKtZHZtM2HXBIhOm4E1NtxsnnEgDKtNhH8cbhA7waluLsqWVtsYyypAhQ/57/gB4BXFFXDX4xQAAAABJRU5ErkJggg==\"\n            ],\n            \"rate_star_big_off_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGgAAABoCAMAAAAqwkWTAAAAyVBMVEUAAAAAAAA8PDwAAAAAAAAAAAAAAABoaGhBQUEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACJiYkAAAAAAAAAAAA1NTUJCQkAAAAAAAAAAAChoaGPj48kJCQAAAAAAAAAAACmpqajo6Ofn5+WlpaUlJR1dXUVFRUAAACrq6uampqYmJhwcHBgYGAAAAAAAAAAAAC0tLSxsbF/f394eHgAAAAAAACMjIyFhYV9fX1tbW0sLCwAAAAAAACioqIAAACvr69YWFhUVFS3t7eP8DjqAAAAQnRSTlMAgJkyeRpOs5x+BQNzDmEWOsxaaAmVg29TLuTSjkQlHurn4tjXvIg18d3aua5kPhH7+MS+ZijPycK2klZJ5mz1qadtR87CAAAEB0lEQVRo3u2ZiVbaQBSG5wshhbCGTdZKVVQExIXW3bbz/g/VTMSGJUgWxp6ew/cA5Myd//73/oPYs2fPv2Ba/S4+g1wVcyo+gTOgKfRjm7ikhXbKUIei0E0uD8fAodBMCx7l4BNuqQqOPIdsQWjlEE6llBnoCa1U4Nb90BGYttBIIQvn0qUOKaGRS8hIRQdmQh9K20Pp0dDatF+Vtt8YgSW08QQ38o2+TjkoKfyUcwyNcigrKbzzQ6PhVeFE/gXQNJZKyhV8xnAptPAMD9JnCAdCB6qJ2nKBro5h4TeRz0BTKzXhXnrobaWaqfx0iTpoWLxSYMhl7qAidk4RfshlriFbE4od249cJQNnQqHHfnw6Gmxopuxnjd0vKVNoyHUyUE5kAmmPVmrOs1WEsVznGA4sq5yak/bYpg/3dy8tqzKbZQmkLQPoEsjrbGJZPffL9qq9NKts4U4GcdzlY/KVVG5BuyzTMDzGX+Y4zpHcRN9xRl/mZAzFKcu0ln0M93dvHWf48nIlE9N/aTvOjftl4GDxzuwiau/YNUNVu5IQq18ayd3SWf2Owq4Av+UuuVXfma73jgUY3+SuuPoFVAsb7IzTodwN7TrwZG9Ic1n8WZCMC/hoSTrMozad5NwB5kfTtzABMokvarQmt2BJNI5lEr6pNi1uHR+pLGrdic9JA7ByYivpg0TlU92TDTfga5X45Wsbyt1KoRcEVb7buGXzuydk+Yy2jMgAMKPFM/tJle8ketleSyIiZ2bE8p3g0rRj5K5o5RvNyxYDu4nLRbgm9csWh5QJXRkGZQaWnSC25lVWCQFkW0mDeF+GoAuFRBlCBfEwjKGcMEOMw2q7mCh9hVJd8lxRU+lrO8kz2Rlkwu9wlUQvqB0ZjuskbwG2CdcyJAZ8TfBWYsiw3CR4R3mOsvj3wczFf2Xqy9DUY79BHW5y1OAANYj9ut+DQVCaNDCCtHgE1diGup4ozx9QGAFZ8zSmsdaCDPX4FDCDw/M4pjm04NdqV3rHseyU6U/55ObQBGcli3SBAyWtaZH1hHMdT+C51YfAqwEL87ps+otzMoGnob6UsB+BvO8ypYl3qOQCLy+n9HtcmrXFI19mVw51FGv6VRZn3lFdHWce4VYO1VmafnacK7p+vx3vOE/+cVYO9eJPv+gOfug794kSm9kK3seqiz11A70YVzTwgyKVwqaT99ShHi/eL2kS44q8KOageuejgF0q4vKlr2oco5Py3n9SF0oE2Z69xUPyQKPzNmbTkTfHrjwf4VIsbbfFZ1zqQ/kQ2e6+w+97fBFsI+2JIuOAFVkLDVysWth2UJ6kKEZdFxSTdJRqW1mI/OeVBcyiNt+0qWotInGZt77GyVO914nYs2fPf88fm/2TZoiTETIAAAAASUVORK5CYII=\"\n            ],\n            \"rate_star_big_on_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGgAAABoCAMAAAAqwkWTAAAAvVBMVEUAAAAAAAAAAAAAAAARPEwdZ4ISQFIAAAAAAAAtoMsAAAAAAAAAAAAAAAAmia0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqlLwONEICCQwupNAsncYnjbMjfZ4hdZMKJC0AAAAqlr4GFRoAAAAAAAAvqtcebYobX3kAAAAAAAAAAAAysuErmcIpkrklhakfcY8AAAAMLDgAAAAxr94xrtwieZkYVWwQOUkkgqQAAAAzteXrvX7WAAAAPnRSTlMAgBkzmbOcfAXmA2FzTc14Og9uVC1pWiUUfmXYlYPq4tLDvY5E24g1C/G3rlA+CPve18u6HZJJ+PbAqJjHIJaA4UwAAAP2SURBVGje7dkHduIwEAZg/YaAwdh0FkyvIfSEtE2Z+x9rPQ5ZAzbgpuzb9/gOgKPRzEijiKurq3+hXq2In5CtIl0XP+AWQFnIp+ZhUYR0BaAFaEK2bA5oAngUklWAJ9r+wC5VAYPugEZRSPUJTIgoBYyEVDVgQERdIK8KiYoN4I4sLSAhJFoCKWI9wBTycG5vyNaWWrS/OLe/zABdSFMG+vSlIzMdpg3glXbeJaZDgVPhmyGx4VWBe/oLgKTuoHBXcMyBpZDiGZiRYwOUhAxcRBnaM3QOCxlF5NhKKiWniOSW0irN/fRAC5Bw8UoASTr0AdRE7DTAoEOvQGMlWMwnER1LAbeCyWk/jp6ENmRy+3GJ/5JSB9rklgIKkZqAYqskdp51DZiTWxMo6XohsaPYpuI863eXul4zzTQ8ZcjDEJ6qpqnrI+vL6nF7KVdxwQN5aQ5xXq6WyO4dnTjUTtrmNzsPRpdO6RjG9mYnlWQT7DvsHgsA1u8ODGOTyawpsk4mYxh968sASvs1rWoAPihuY45dXYjjL20pXj3nOw61BuCN4vTb/R2WtfcpQ3FZv3GaF0+0M0w2FI9uC0BZPTHNcakacaXBuUvSZw5804nuAUC+cu7UMQGkIm/UjNNAOd9OdW4MTYoiw2WqTS/eDXij+hResw1Az4qLlFKk8HH1pP0d8Kta+PBlktzdFN8XBA7fbwruvu2qnkvhC9UmBhy2YOOZWrbDJy9sjlsO3yBI2OAKm5TwbV1hCxY+jP0dqXbY6iIkLt4h+cHNYKFGuDfmeFbxAWhUog7iHfJhGHFEL/Ig7sccKEScIeZ+c1uLNn15Z13cc8WUpy9PMc9kt0DK/x2uFukFtUf+vADp0HWkpoEX8ikJ/IrwVpIkv/oR3lGeg1we+B0lG/6VqUO+tUK/QT2e6qjrU8frSIQy8j74mu9498rFLlAN3VDdE+XdDOy9Sy6TkI116tVQmxMAee/heR6yOVTcg9mrvRxdTeSdUz56cyi7/urxEEDpk48PDe4J5yVcgmfzR4frevC1nL07ZioTQ4IrQIv2bJ4A5JwuUzftRUVP8AIwO7q7o7zaX/LyeFFdQAvVuccHEykv55BiL6p3cPqpgbdor3Ov+/ZyXKOVa1GpEB380enc98PTE6lSheXD6eCjEFs0cAZF1IqnVj7iRT2NvzfJDLFFze/5GqVzAalrsNx0OMZAOmgl5YBXojEnQXqkXughOQDt3tcxqwS+OQ7pbguLVr88jD7D0trQTeB29wt468MzCc4kRcoA9MC50IZlsfJbDoU8bFrQ6wLTggR8qjeAwP+8WgAwgxZffcGxFoEsc4swtzRlVNLE1dXVf+8PiLJs5G2Z9ooAAAAASUVORK5CYII=\"\n            ],\n            \"scrubber_control_disabled_holo\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAPFBMVEUAAACIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIg4st+Ci486sd5LqMtwlaJJqc0zteWzIZSAAAAAE3RSTlMATUg+Ihs3AywVCEUP4FHVmWCf15i9tgAAAYlJREFUaN7t2Itu6yAMBmD/NhBuabuT93/XI03TOm0qJXasdVK+B4iFTQyYTqfT6S/pIScRBlgk5dDpSDUkxjecQqVDLDHhgRQX++cDY4CDMURgPMGB9IpgghRtdjImZVWeqmCaVEV6GDvw7jRF7BQV33eMEAHXCAUq03WoDBWuNGURKMlCMzLUslMB7oo5QfYkBZiEpwtgmPBiWoB9CUuDUVssPcLeMRLMEg1UHKDqS2wvcwJ8c8Q4ANNDHYfoviUAgrpRX27XbbveLhjL2hq/rdu79U1bZcHIZd0+rOM1CD3SMHLbPv3DSFPu0us9wKrcpxjavsCQewD3FLkX2X2buv9ov9cqIg4R3du194HjfmS6H/ru1xbvi5f71dH98ut+ffd/gPg/ocYEBkLPdRj0V3iIG5IkLzIMIeqqCNydB0bllUZq96Gj39ixN+zQOu1WE6alShphvgEp9YQJ0kkvNjzRItlEwYBEsiuZH2zNXOgYS8ztR2pyXOhItYQsH3IolU6n0+kP+Q9bEx2UrsdzRwAAAABJRU5ErkJggg==\"\n            ],\n            \"scrubber_control_focused_holo\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAllBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteVtyu1yzO1ryuxexetjx+tTwelvy+1yzO1yzO1xzO1syuxqyuxwzO1wy+1nyOxZw+pNv+hxy+1wy+wzteU1tuVOv+k9ueY4t+ZixutDu+dJvehVwelYwupSwelryuxGvOiB2w4OAAAAJXRSTlMATQYKEQ0XGh02RUkgQSwmMjvw1flze2To3M/j3IyrpYRsX62hrNdO2wAAAttJREFUaN7tWWlz2jAQrZb4Ej6wjc0dIC2+OfL//1xllxl1Wq9AVjQhGV6+BD68xx7aXa1+PPHEE5KA7k8LoMXoCmjxseSM1TCMlyvYv+yLjxJp2Rm1aZqWZXewLPaBybQa6uzQsVt24IQepYSBUi90AtvqNABAmd5k5B75Dx4TMdUkOnrLnVCCgE5cq5MYTm+6zpgIMHbcP1YM4mfO4fS4BHPUAIXOOz4ld4D6nZ+k+U03JHcidE1UAXdPQMndoAHiJpzf8okUfEtCoeWfEElMWoX7+R0iDQdRwH+/sg14/vhkEPx7cgnAMAMyEIFpANx2kEuHClCXO0kQgJAMRngrDAA8AEPDACA2wKYqAtTmJiAGOEQJDjcBifBYTWAsjDM3QM0EXQZwE3ADhDVi9mu5jqbr5XYvrBjMBPwMeARFuqhO54bhfKoWO4LCQ88CE8CLxNuyOtdFWWZZWRZ1XsUzvGAwAekQJ/NjXWaHK7KyPkaJdJhHBuqh/TQvGD1HVuTTBPWRMcJO8Rjxz5zzc4XoDckj5DTDCC1D8ZHzc4VjjBakEUgl6aaqOT9XqKuNVKKCgRXqRV4eelDmK6xoIwJIjJPOgF4TEiTKvQJopX49FYdeFMdXtGbLJNGy9VC/j2KJNAJ4sUkv5k3WL5A1EelFv8AIE5iiAu9TGQHQJ8BjoNVFoCHIymn6U5ym6gctxQ4aUouQUrFSLxXifrNDi52o46iX6/NCslzjDWcW9TacmaDhSLbMtKdlXlLBWCHd9NPon6Z/jlJB0x8wtsziKq+LMmPoxpaFeGwZMnjtVtUpb5r3Jj9V882NwWvY6LjfxuvLZR1vE9nRUf/wy6uF+vhuGZ95AeGZqmIA6L4Ear/G6r6I614laF+G6F7nfP5CSm2lpnspCA+y1hy8mNW8WoaHWo7Lr/cf74FC6onlUR+JdD1z4Q919hV/PdR9hafGG4+lX+e994knvjF+A/DCfuTfcOFvAAAAAElFTkSuQmCC\"\n            ],\n            \"scrubber_control_normal_holo\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAhFBMVEUzteUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteVKvugzteUzteUzteUzteUzteUzteU/uuczteUzteVJvehJvegzteUzteVKvug7uOZHvOhHvOhDu+dDu+czteU5t+Y8ueZAuudFvOclVTOqAAAAJ3RSTlOZAAQJDxgTITo2HSomlX0uijJC6IZuYVFMSbJmgf74kHjvp8/MvLsvv+3mAAADbElEQVRo3syU23aiQBBFz4w0NA2t3AXvmqxE8P//bxqMFip0G4W1Zr8keTmbOlUd/BmZ/0fw945hBJQ9mUwsy7Ib1C/qT7K8J2jCVTJjQjg/CMGY8jQSo8CYrr6bCcf3ZqHLf3DDmec7gqlZyPGC4PztzPFnLs+zdBcEgQSk+rFLs5y7M99h5zl0An08Eyq9WE63eGA7XRbKIZheAU28+njPjZYJekmWkeupMTRFoTffquPnUwktcjqvFVbvEOiLt0UdjyeoFcLuU6Dv8/2woHiTogj9viHQma8+n6cSTyNTroYgg1bQtB/mAX5FkIfNJsyCph43k/glMnP9LgM68j2+wwvsuNdhwEO+8KIVXmIVeeLBgI78BC+SdBjw0E8U4GWC6KEl3NxnnZ/gDRKuNn1zrbi5f+bzFd5ipQz0Hu4EE9txd3iTnevYkzsBLTjM8DZZeLNo3Cwgl3gbmXvtNaBVkM8DDEDA/VZJaBeUYhBSKqktYF4hMQiy8BgJWhc0xUBMW5cEGmCOwZjTCKABVsCAI1y2gBEGoBFIYAnawDAjCIsEzRuIJAZERvVbIIHFZksMynLGrLbAcRMYOXzG8Xodx58HGElchwR1QwVMfO1PVVUqquq0/4KJou7oKjA3dIhP1fH43XA8lqf4YO6IBOYbWmwqlU4cq83CfEdXge3wrT5/XZ7zyVCu9YYtd+yLQK0g1/ezoXwybPQt5WoJjaBZQQYdMfXTbimGjqxewlWQau/nRPltw0l7SykJLBFqd7wvvzsp99oth8K6CrTPbEED3I+w0D41EuiP6KPqE1Qf+jO6CNSVSt2Ky+8eSt2apbrT5wSbfsHmaQE0rPsFa2jQTDC8YPyKtuMsmc40GO1Mx39o4/+rMP+z+1etGeMACEIx1BuQqJPRwUQG739BHYzFEMNHfBE5AAwov+2rv3vsfOKx0wHYc80PHH5k8kPfLlvWfNmSJbx8KLy8VXhJOhr837B08zTN3TLYpaPEb7kBjP8CXL7DBoS3UKAJHOVjcRvLG3E+SuDDED7O4QMpPlLjQ0E+1lQwW3TRfasLAKNlOhyn430aUNCI5XtIdGAu9wxz1QHqAtQ4mj6eEzXWA0vzca/2Nx2gIwzAWtu/gdybfZmQe35pwF1LAy4oDdRce0gVN/5SPYlXTe2cDUmLl89GXuGIAAAAAElFTkSuQmCC\"\n            ],\n            \"scrubber_control_pressed_holo\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAA1VBMVEUzteUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteVsyu0zteVuy+0zteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteVdxOszteVpyexuy+1tyuwzteUzteVZw+pNv+huy+1xy+1lx+xgxuszteUzteVryuwzteUzteVSweluy+1uy+0zteUzteUzteUzteU1tuVOv+k8uOZVwuo4t+ZJvehCu+dgxutjx+tEu+dGvOfyQddBAAAAO3RSTlNmAHzex6Jq682mwiLmgYUv7m3hTPX14fmJNNmeY1HSvbCMmI47/e21tI+IeufcnZRyHf4Gn4DVv2BIOFolky4AAARISURBVGje5Zr9e5owEMdvIKiooCKgnS9Tu9p29r3dW0Sttv3//6Stu0BkJQlIfLY9+/5qnnzkcsld7gLvDqz/B1AbaJNSpRIQElQq1qTl1hQCbvrVOnmjerV/owJQ03TCla7VCgL6FSJRpV8AYJZJBpXNPQH9JsmoJuwBcI+Sc1RODdu2TQDTtrvGaJikH7k5AbVJws5VDd5IqybWp+TkAbgeidU2TODINNpsnOdmB2gklmWDULbFxmoZAU6JTd8AqRpWwkxyQC9e3foZZNJZvM/1nhzwPfZ9AzLLiPfEsQxwHERDu5BD3ehvBcdiQC8aWGpBLplW9Md6IoAT2f8D5NaHaB0cASDynyrsoWr08TwA8//3sJfeR/uBB3AT/7/AN7jpAMfj2D/3OnhOKqBETQgFZNE50gDfqJu1igBa1M2/pQCG+NMYCqlL48NbgCk8H3KfGuYbAEaoOhRWHSPg3W+AFoLPigPOcKbWbwBcHAsUyEJnSQK+IrahAtDAub4mABi/dVAiHTOFXUANobYagI2z1XYA+FVtUKQ22nsH0M60B85nF/7trX8xe8i0F9oMcEM3B4h0OX9ahY8/Fa6e5lcgEt20NzGgL1/iT/42fF6uFz+1Xj6H24tP8mXux4CqNAxMO6vNekGoFuvNqnMuDQzVGIC7WxPM/zFc4vQRYhl+FBA0PHcQEDlpU2CfDpufEToCKzXRUSlggBsDuPJXbH5GWF0AV7hxBxSAH3TK95/ths3PCM9bvi+dotEpwJCkEifhmqRoHfqSBMOgAEscyqb4ASmf8MRd5zEezhRwJHaiL6slSdVyNRO70RECaCy45i4xWijNRp+Bo2uMCRTgYQgCjjqPi3TA4vEEOMIA6VEADgeePr4QHqADPOEICgjwqDscoIlrcDgT6ehFh1vkIQagw7npSJwSXRXYaAWPirnsqCh22G3kh93Bj+usAechd8ApY8DJHDKv0kLmVB4yk0HfyBf0p9LEiAV9kF/OHvxtuInSlk249YVpC173AAEsNQWhLk9eE6+Xl9fE6+QShGLJaSJ1nIBY05k/v72d+7NzEGtCU0cG6KpNfvFw6+4Aeuz+oe4G0tu9gAzVX0CGiRsOKPwEjboMA7Bb7EgFYIQHQ/o1dgyFNU6/xt55qi7i6PLeHaeUcA8Fdc8rJdDITLpKiiF6SrXFJQp2m0lrtK6gIGWpL0hROYGqklrgpBcFB0WLggZBDXhlzbGasmbjjxRmUY6uqLQsL45bZk7/HBGU18tY3q/nK+/XZeV9RigTqvv8y0uaxxlaLHreFsu4zVosOZtEIw2k0kZ5mkSoRvY2V8NiYxs5GnVBxkadzsYFgzytRqckbzUapWSrsViztIzN0l9W+dUsTXaCdXePdq/pkYzyWns2rLEbIFPz+q5Ay30om37YL/pooCF6NGDXlDx7MNOfPZg19Q83XmemDzf+tacnfy/gB/s76qMkz3F7AAAAAElFTkSuQmCC\"\n            ],\n            \"spinner_76_inner_holo\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOQAAADkCAMAAAC/iXi/AAACYVBMVEUAAABFRUVISEhVVVW9vb1NTU3BwcFSUlKysrK/v79ZWVleXl5KSkqkpKRmZmZjY2O6urqEhISbm5tpaWmSkpJubm53d3fDw8NPT0+2tra4uLi0tLStra2vr6+rq6upqamnp6dbW1tgYGChoaGfn5+dnZ1ra2t0dHSWlpaUlJSPj495eXmNjY2JiYmBgYF9fX17e3uLi4t/f39ycnJwcHCYmJiHh4eoqKiGhoaMjIxdXV2FhYW/v7+enp5WVlaGhoaxsbFdXV1HR0dISEiMjIyEhIS5ubmnp6fBwcG2trZvb29NTU1UVFRISEi0tLSoqKhSUlJwcHC8vLyZmZlwcHBbW1tNTU1OTk65ublSUlJpaWmqqqpUVFRQUFC/v79kZGRTU1NoaGitra1JSUlra2uioqKVlZWXl5dISEheXl67u7tLS0upqamurq7AwMB9fX10dHRdXV24uLigoKBVVVVJSUmQkJCqqqq3t7dwcHCurq6Li4uysrK/v7+KioplZWWEhIS9vb1nZ2dzc3N+fn5WVlaXl5eWlpZ8fHy9vb2Xl5dUVFRISEigoKCXl5ednZ21tbVra2uUlJReXl6+vr5JSUmioqJ7e3tHR0ednZ2RkZGmpqZkZGSZmZm5ubmQkJC+vr6qqqqTk5O0tLS+vr6fn59nZ2d0dHRgYGCMjIxLS0uenp5vb29MTEx1dXV4eHikpKRXV1eysrJ9fX1cXFyEhIRwcHC7u7uqqqpdXV2NjY21tbW9vb2kpKSQkJCMjIxqamrBwcF6enp0dHRTU1N0dHR7e3unp6ednZ1ISEhQUFB885iiAAAAy3RSTlMAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIADChkbBQUOCUMyGggyfEQzIhx5XlctFBMSDX17V1I6Mi4mGhkOeXNwXktCLi0dEnt5b29uV1ZUUEsmJSQde3h3c3FxXFtUUkJAQD03NTMrJxZ6enRzc25tbWxsaGhfXl5cW1hYUlFQR0A9Ozo6NzEsJiYhISAYend1dHNwZ2ZjY2NhX1NQRzd6dG5sZ1tHNWVKSrmNY9gAAAqQSURBVHja7NpNSxtBHMfxX22sD/XgrabGlr6MDZsQE0gTYmIImAcaRZqLTWqgwVARpXjwIHoQquBJLHooggdLwZb2UhBK+6o6jrWT/7r2YTK7O5b9vIMv/5l/ZkX4fD6fz+fz+Xw+n8/n8/l8Pp/P5/PWummaKSbOJBKJKv4nhllebW7f++XWLzvZWjwRxQ1npFdPv9zhSCSxuVs7NnBDmasrM7zPNpKa2621cdMUUiyQopFWPT09c9l4GDdGLLUywPxjJLd7QzrTn2cGLkhEsnkWj6G5yGGd1UlFCo2Szhu3sM+GKBXZQ2Vq09BTYS8QGJCPpIaKOmYW9gPMACERKcx90y0zsjoT4NRFDg3N1bS6m616gPur83p9I41kGkfQRaEZEGilfOTQhaweZ9Y4nAk4FclkShq8a83tAGUfud3cT6VMxgAM9qHVjsdr2R0SSRuFnQQ8djgc+EPkl+Zhax3XyB+Vspv2gxTmSvBSbIUGWitnmuVJ/FE+nt282ij09mbD8IxZH/5N5Jd9E3+t/W3zN5G9jTY8cjjMXFMZaLYM/BPjKDtn38iV4IXYyvC1kaepGCSE47sikjZ6c2QL26zQvnLFhLT2rv0gmZ1puGyyzvpsK5smupLI0kEKjTxcZS6yOrvKz+voWrVIGoXNBFyUTg7bRm6bUCKxIyI7ZY7hmlzy/rBN5UwKysQzl43ESAUuKd9nrlbuFaBQuHjZSLlUmWOJVyvrJhRrN3ptjBzBBa2kXeTnCJSLFm0aRzIJOC7NGy2VyTIcEc9YG5lMFQ5bX+SBtLK+DofkG7SRa0zDUYUtnkcr1R9VemRpIzMbhoMip8H7VypX4agabeTOonDOXjB4pTIFh8VHSCNXhGPKQYZWJnNwXGWENxJrcIiZDFork2m44Dhjbezra8MRsS0WSCsXTbgikaGJjFg+yi8kzUxKNCqo7OOKcEAu2Ik3tuCaI9LIVaBcYTForSzDRRXayGxMQ7W90aCl8gCuKpFERw5senTUUrkPl32njcwClDK2WCTJ/GTAZcYEayRmDah0wApJZT0G14Vn+yxKUGhykSeKzOQ6PFC1Rm7koc4yqyOVB/BEyVo5AWVaowS7kPDIhOhTvXtOR6nFAjwyvUESb98+gyLp/lGqDM+skURG1Sg/9feTzE/w0IRI5CZUDZITkZPwUP62aOSOocIybxSZq/BUTSSqG+UTHigy30XgqegsTxSqSgZJK8vw2JroUzXKyX5qy/N/qzFmLZV5dOtpP5WD5yqWyBfokvFOt0ECxhmNPImiOzn9Bnl1lBUVa0d4p8EgAeNE6eqJjdHIA2ihRCMHw+hGuZ+KQQvhDVq5hm4sj5FRzkMTUwrPa2zsnOhMQxMLCs9rbowRnUtarB2bB8FgBfLmxxjR+RTaGO8oZKa6eQmMEU+gjaoIPHdiQNYT2rgEjcyeFwpVyDqgkRqdVuDFILGm5EoyLWhkgUZOQdZSqLMxFIFGohsk8gSSJkPcZekytDIxSOQhJxdiROgbaGWcRr6FnDchQpvnju2lHIeceRqpyeP8UljN5lkijVr9Sp57TyLfQ0okRGjzBXJpapCISi5XQrO907F5HnF5yEjTSC3+utPp7XmdsAAZXx/8FOI0ep1fqD4i1iDj8QNCs+UKhGnkOGQ8JY0voZ1nJPIVZMyTyOfQzmsSOQUZH0jkB2jnI4n8CBnPSaR2P5PAFIl8DRlLJFKrL+YLLx7d7fAeMl5qH3m30zO5yIedHkM74woiH96syLt+5I/27falqTCM4/jvH2hSpq/DbFZaafbgNrYlbAh7U2PrzSKGMDeCYIYgiKCiokNQ0UDxCUFQE0UFU0pQQ8n6s7p3juvedTYdO4+3dT4vfP/luu5zdo7bfx35X5xJGvmPXl0/Xq/Ir1oiX8oWIJy3JPIz1Pj2Mp+In11J5HeosUAiRXwKqcnJRr6FGkckUsTnyZp8/VCjLdt25y/x3gzUEK1Q49cdQrx3PDRyDWp00cgOCOYLjYxBjdc0Urj3roM08g3U8NJI4W6UixUk0gdVPpJI4e4hnytkcmMc6izkN964IdQ/mgFfRb6aRajTluuTdUEosQqiFep0ZPs4wa48gzTyC9RJ3SBmIJR2GhmGSrskcleoQ+n7QBrjUGvhIk/EQ6k4kotQa5VGHkEgn2jkGtR6RyPHIZA4jQxBLdcurRToM3rI4XDkH0kXVDuikQK9sWt1MLyzH+p15CfevSvQvsYdOfwuqdIrXijZhCC2HPkqHG5oMMMLs4S5vvY7iHZo8Usq5AR5B+J2UGvQ4tVdahVCGHRQbmgyQyPHhfjRhCuudVupjvzE2tpaId70JBxUAtp4d3li1qQAo3RNVVbmN8Z90KgtP1GMUSYqs3hkK7R6zRMFGWV2kCQzDM3mLgqFGaU8SJ65CO3e1VLjXljKF5f6eGYIOpjJT7x3714bLDVYSbVDD5skkUnBQmFnJbUFXczwRMkcLNSu2yCpLpLIjMAyCeUgY9DJb6mRG/fDIu4fTifJPIBeurKJ3K1bli1su1NCBqmXOdLIrMISayyQVC5CPymSyETewQLbbFlJpjMMHa2SRmYyANO5p6qctHIQenJNkkRmzgWTudqrqlglVznlgq66aCNzDJMNskZaGYPOlkiiBRefIVZIM/uhN39EGfl8FCZKsDxa+eM9dNehbHwe6YJpYtEqZWUCBliiicxYEiYJSY0cX1adBSZpIzPhgSm2e55VUc4eNwyRjNBGZmwTJtiKPnumrAzBICPKxvv3I6MwXIw1KivXYJglZSMzAoOtN0uNpLITxvH+Jo2yFRhqSGqklQc+GMg/8Zw0Spa8MIyvs7m5oHLKDUO9HitofPBgOgWDhM9Yo7KyJwyDbUaUjczYCAyxHpUaaWV0G4YbjdBGmREr6+usq2suqIyGYBhaSRuZ29NJ6Cx0VscUVMZgipEijcxyADoKsDHySF65DpOMRgojme4R6GZ9p7quSGU0AdNsjikbZYce6GL7oLpajqQLG92CiZITpJFbTkGzcCdLLFbZE4KpUhO5Rhr58OGyR+MU09U5isieMEzmny7eyMwnoVpotl4OLBzlgR+mC8zzRhLJHAYDUCGwPltfzyNp5U83rLDCI2ljQ0NDd98GypRJ79RLaKRcWTcEiyQneCOJlPQel3E6Ped7jY2NPFJRafYlh65s0UZZU1NTb9+oHyX5M+lsoRRZvJKtqpVWLo1skj3q7TvZSOES4cxweu8Jc2XkECyWnL5skHKj5MWL/b6BYNDDgPEwweBAev8p80TSeHnlWQiWc610l47MamlpuXnhsYQVypFXjXJnyPIvDkn888UbaWQLj6SVV0b+9EMUG9OssXTkzVKRysrTDATiXekuGvlIU+SQD2LxL3eTxjIjCyvrO8XZVC61fOm2lhvJdIYhJv9xdwPd1pKRxfd151zEKeYETnp5YxmRpPJ0OADBJfu0Raa3cB0ETg7VRs6KP0TOfzKvbKSR9Mojmx0W+SQW5d047i0dmas8Pc8I9UPbMgQ2Bg57S0XuzQ5krtGSFufyBAf69otF7qcHgp7rOsBC/AErODzM/ngY2Gw2m81ms9lsNpvNZrPZbDabzSauP6UMJdVYd1vZAAAAAElFTkSuQmCC\"\n            ],\n            \"spinner_76_outer_holo\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOQAAADkCAMAAAC/iXi/AAAAsVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+3mHKcAAAAO3RSTlMABgoSH/3yGiQO7CkW9vouMkDkRTfJzjvf0+jESqBcV2Hbt66ldlLXv06yZWmBqZtxu49tl5OLfXqFiHO5Lf0AAAtLSURBVHja7NxrU9NAFMbxZzeRNk1qYmxLWyxQLhYsooKI+v0/mHshOXu8dDTNZXHyO4X3/zmbDcMwoNfr9Xq9Xq/X6/V6vV6v1+v1er2eH7bb7WmWZSn+Zy8KL6cXj8eZxPMnNJhxI6n05fzT4ys8X8KCsIXit5HGwbvLCZ4fYVCjQIEl6nmyPN8GeEaEFAqvLEOdRP1FxuPxu9Nn0imkIhgq/M0mqVFnjlaH8J2QmmCVsIOdmxzrz9hY3Hh945pEW+k2FscVPNImUqbZpbH8NoCnTCJtkkDs3iRVlg4eQniIEqmSNqnnj5ukNVLkwejOu20KGUleyTa5+3alTGpUn+VXr55NlagaI75IsnuTFFk0HujRZq/hDRkp1PhLJuzs2iQVUqW28uTMikj5tfLXh3LHJsdm3MhCfi/Qvaiw48BCwCGyLJtst9/PZ/znHdZImdMMHROBE0mZbiV2iK8/3uZ079BZpcbRwfIGnZJB4FTyREmFu4XHF8sxXyQzGt0G6IyIqJGfV9uIv3f4PWfXThloZzFBR2Sg8UyKxL96czHii3RCR6OP6ET0lEiVdF4FqohOP9kfBHif/X4RoX2BZit/PrCobnLOd2hDjaME7aJGXikV7Ce7OKBd6sCychaiVcJJ5JXYX/yhSKQDa2xStIEaEzeTEuuRHbG7tTQ/RGtEQonu3SNQm22uEmmPhfwaLZGJolfJlylRp+Dzbza5XC5P0AqZGAHvjARqNpkVbdQ4Wuav0QKRWO5jGQUS9ZMf2Fld2plnaBg18kyBRpzmJo8qtXWMJlEjP7ARmhJP2Vm1lbMEzUpcgSXRHPmZ7dE6CtCkYMArE2psymW5R8o8k6gfNSoJhVJjg06Xdo8kz+/QGDnQElYp0LjrXBdSZq4qj9EQoQopkxobdzhfsj2qysZeJEkZqccQaEW6Lgvt5Pk0QhOCAaHGdmRzp9J6QAOk22hXKdCa13l5UovMt6jfYBD+VCnRohO2R22ToG5ByCupsSX3epH209SBlWFoKqkzQsu+qT7uFeo1CEP9oW0GaN1t7piruRKoUxQqJrQ4rGhfMOWN8/kNaiRCzWbaUIEOxPMy0TTmmxD1SUKrXKVEJ7bOGvVnvqrz1mHosLbu1q7RJBqvarx1DFomupIszCZ1o/Wu5kUSic6cUGJe6yoH4ZA1JujQrXkgyS1qIVXi0O0U6FC4nnOTehY5HKpCqgzQqUuWuF6vUAOhEt3MAbolp07hWn2l2F+iC02nzYzQseOyUY3q/FDHIjXb6cMilatii2q0IfYVDJnQgz93e0tbNL5iX26gGg8WCZytmanEfqIh1/kTqb3VaXOqvN77/cH48Ze2YrpmVtjPMGaRnvyt/03Zt9Ffm2jfayd2O+GHYEOVm816c4J9hLEqLEP9uHa0B6dQfb/APmLFdppMD94f1iEVaosI1UW6UI3i02lVropCW/kG1Q1ixXSazATeuNwwX1CdbnM6vTmtQKp3SKaoTMaMHy9JOq+uFFUFMePRaQUeWePidJ8XCPHqtAKvyj7jDlXFHHwiZ0+FGzNXqEjEcarHx0cSWC2eCq0Q1USp7jOl3j2SwL1KtJ3Ga1STpJYJ9eyRBCYL5h7VhKrPjObZIwlIHvmAamxdUerRz3TWGYs8QzUp49m9A3xZMAJVSB7p2b0D3BR5MzPDipcr48Vvd1xvVBnN4hBVBDzSs8sViItFWieoYsAa/fvPMtHMetrlfdU3SKbH10gcPeVZ7ytGZs749ppUzmeuO1QxzEpp6t9rElixyBWqiDOXd69J4AuLPEcVqe+Rjyzy7P+M/Moir2qI9Ob3yuR+NpvSVIvM/I+kRtVbLfJHe3faoyYUhmH4BUnEQCInYPkwKMSFiOKOtvr/f1jPIr6cVlOLLKcNF07Tr3ce3GYcxiseCkamoxHtY1/c/7lkyvK+5f+UXbJIwQee06ho+fnpqmLkooLIoepL/pAiVxVEKviy7iZFbqEMS4pU8AV6JkXuoAxTilTwrdZ2NPq6H9SlgkgFr2d5GOWV7PYdyjA8xr8fngpXcZIMvqiR+KK5JyjDpoV4+Op9j4f3iRsVQxk9PuSDIh/hQe4Xop0+lKH7EuWeKKMviQGl+BLlnkM2cqQGpThSZOsXVvvVXGqcQTmWX0BUu7asvvxafqEblGNgIFHvkcehZUt+cGsop8f6RCGhFHvkiZbMo9SFcnTWyAN5qmIv7C5LXsf/pfpQkvcIpBS7U2pT2scTeekKyrKwkFHqTuktEd3yCmX1iUSpt5T7pSSEsgZEotQbka0caUFpPilwiUI/bDYPh8MSraA8q5Co1vm6PlDY+R3Ks/NC1ui6Cj2+zlkhPe6hLpSn5YHEpYirzOPr8MCJUHobwAccwohCSpnXA4sDopVH+ESfEB6YU+R7IINpIZFK4BMaYYlIkdev4ZRVogF8xHElavyxHW0+pbDxBp+x3YLAdZX44ZbLG7GTwIeI1Bgo8SySsUjMnGnwIbOYSCkwJZneHURnCp/SRSE72C1Q4F6ZTRHL7MPHHD6iSFRiSne6mhZt4HMDFxOZtp8r9fFqKmVaUAGPJyILWhWtqCk7hBtUoScakQ4t6s9oIsvM5xxCJbygIAkSD1p0XTGik7lANWwsZEeSGNAaVzSKTLalBxXx80T6xQQatKQ3X0mV0yNAxVMmOR9aspnNZlKmB5Xx8jM1Z0IrEtY4W6HvUB0dd2TiJBlAC4ztjMExZ32okCklxnHcxksCPROFOGYIlSJSI+VD437MEM/MNKiULTUyQ2jYZCbgmA5UzLkXIgsalWy329l2VrCAqumBGDIXxqEBDfJZ4rY45rYHlTOKQ4b0FoZ9aIwz34olsZNADbwkRiET96Ah5ngrYOUe6qC5uCMNbLLSyNiQ0pY7HWrRS7AxZ0MDrPF8zitxzK0FNTF5olxpQO082oiV4uEngNo4YsncJJxMJibUjNwb54UlU6gR4Y1YyTKHUKt4/rDN3TSokR6EYZwXsoPxoT7amu8ob3keQK0GSWHHXH3vSfq38Xg8L3QymQ01s2O8P94zo9rumP5uzMhbjg2oXR/P1lwURUQDVN2pKhqlLccWNMDARLFjxMQ2VMy8jh9wyrkDjTCxETOrHlOPdrvdeHefErck0BBDVGKhMLGgMuS4Y5ECJo59aIzNE+XKdbReJz2ohPGDFvIh5c7dEBrUi7EQGylSQaYdZdnuTrpbZiY0apDgkML6zrU/XDHKmMeUuOSxDw3Tg2dDpus0TQP7g8T0LBqz36a89qBxmssqBRwy5WJLgxJ0b38+i8i8Ebdc6NCGIS6JQwqn1DXgL1mTy5nL5EwhgZbY4fMhT9ya2PA2I9kcj0eeiOcrTnk0oTWaizvikKd75X6fBtbgnasbTVghj5Qr8y33A2jT8MmQeaOQBo7Zgxdsy598v1Ci8enputsF0DI7jqIXQzKL/YKLYuI4+V9xsul/PC+YnG4ULeSRLzOvKnyWeBitXwwpMoUfzHdmw12ZR+TxwhOfnK9ZoMYnM3X3yZB7VolTvo7EKeUlxZQnZT5HDEYoDcnJOy54IycaNxiJjTilaLwq8yliRnNeRGImRgrPlpSnPCdqnKlIJ0/OVjxZMXLzZEnm1ynPE3XOVDQgT0/X95Y8/jKlmomM7q/xsVVekpOXlCrlJS+xqomMNpwUh1zIlfKSL6fcEOV+3f9X/SCliY8p31/yLlLhuf/P9GH8a+O7S6bqXbPhNd1JTrxRvk/KjRgprFX6jbf3aCaJ3llSVC4SS7UnxXfpph+mIvP1kj/WrmpX5i7BtvwkerLkJg1dp/+vDvj6T687juN5Dn/Tpdw1nDudTqfT6XQ6nU6n0+l0Op1Op9Mp+AmSZeem89KYswAAAABJRU5ErkJggg==\"\n            ]\n        };\n        var imageCache = {\n            actionbar_ic_back_white: null,\n            btn_check_off_disabled_focused_holo_light: null,\n            btn_check_off_disabled_holo_light: null,\n            btn_check_off_focused_holo_light: null,\n            btn_check_off_holo_light: null,\n            btn_check_off_pressed_holo_light: null,\n            btn_check_on_disabled_focused_holo_light: null,\n            btn_check_on_disabled_holo_light: null,\n            btn_check_on_focused_holo_light: null,\n            btn_check_on_holo_light: null,\n            btn_check_on_pressed_holo_light: null,\n            btn_default_disabled_focused_holo_light: null,\n            btn_default_disabled_holo_light: null,\n            btn_default_focused_holo_light: null,\n            btn_default_normal_holo_light: null,\n            btn_default_pressed_holo_light: null,\n            btn_radio_off_disabled_focused_holo_light: null,\n            btn_radio_off_disabled_holo_light: null,\n            btn_radio_off_focused_holo_light: null,\n            btn_radio_off_holo_light: null,\n            btn_radio_off_pressed_holo_light: null,\n            btn_radio_on_disabled_focused_holo_light: null,\n            btn_radio_on_disabled_holo_light: null,\n            btn_radio_on_focused_holo_light: null,\n            btn_radio_on_holo_light: null,\n            btn_radio_on_pressed_holo_light: null,\n            btn_rating_star_off_normal_holo_light: null,\n            btn_rating_star_off_pressed_holo_light: null,\n            btn_rating_star_on_normal_holo_light: null,\n            btn_rating_star_on_pressed_holo_light: null,\n            dropdown_background_dark: null,\n            editbox_background_focus_yellow: null,\n            editbox_background_normal: null,\n            ic_menu_moreoverflow_normal_holo_dark: null,\n            menu_panel_holo_dark: null,\n            menu_panel_holo_light: null,\n            popup_bottom_bright: null,\n            popup_center_bright: null,\n            popup_full_bright: null,\n            popup_top_bright: null,\n            progressbar_indeterminate_holo1: null,\n            progressbar_indeterminate_holo2: null,\n            progressbar_indeterminate_holo3: null,\n            progressbar_indeterminate_holo4: null,\n            progressbar_indeterminate_holo5: null,\n            progressbar_indeterminate_holo6: null,\n            progressbar_indeterminate_holo7: null,\n            progressbar_indeterminate_holo8: null,\n            rate_star_big_half_holo_light: null,\n            rate_star_big_off_holo_light: null,\n            rate_star_big_on_holo_light: null,\n            scrubber_control_disabled_holo: null,\n            scrubber_control_focused_holo: null,\n            scrubber_control_normal_holo: null,\n            scrubber_control_pressed_holo: null,\n            spinner_76_inner_holo: null,\n            spinner_76_outer_holo: null\n        };\n        function findRatioImage(array) {\n            if (array[window.devicePixelRatio])\n                return new NetImage(array[window.devicePixelRatio], window.devicePixelRatio);\n            for (let i = array.length; i >= 0; i--) {\n                if (array[i]) {\n                    return new NetImage(array[i], i);\n                }\n            }\n            throw Error('Not find radio image. May something error in build.');\n        }\n        class image_base64 {\n            static get actionbar_ic_back_white() {\n                return imageCache.actionbar_ic_back_white || (imageCache.actionbar_ic_back_white = findRatioImage(data.actionbar_ic_back_white));\n            }\n            static get btn_check_off_disabled_focused_holo_light() {\n                return imageCache.btn_check_off_disabled_focused_holo_light || (imageCache.btn_check_off_disabled_focused_holo_light = findRatioImage(data.btn_check_off_disabled_focused_holo_light));\n            }\n            static get btn_check_off_disabled_holo_light() {\n                return imageCache.btn_check_off_disabled_holo_light || (imageCache.btn_check_off_disabled_holo_light = findRatioImage(data.btn_check_off_disabled_holo_light));\n            }\n            static get btn_check_off_focused_holo_light() {\n                return imageCache.btn_check_off_focused_holo_light || (imageCache.btn_check_off_focused_holo_light = findRatioImage(data.btn_check_off_focused_holo_light));\n            }\n            static get btn_check_off_holo_light() {\n                return imageCache.btn_check_off_holo_light || (imageCache.btn_check_off_holo_light = findRatioImage(data.btn_check_off_holo_light));\n            }\n            static get btn_check_off_pressed_holo_light() {\n                return imageCache.btn_check_off_pressed_holo_light || (imageCache.btn_check_off_pressed_holo_light = findRatioImage(data.btn_check_off_pressed_holo_light));\n            }\n            static get btn_check_on_disabled_focused_holo_light() {\n                return imageCache.btn_check_on_disabled_focused_holo_light || (imageCache.btn_check_on_disabled_focused_holo_light = findRatioImage(data.btn_check_on_disabled_focused_holo_light));\n            }\n            static get btn_check_on_disabled_holo_light() {\n                return imageCache.btn_check_on_disabled_holo_light || (imageCache.btn_check_on_disabled_holo_light = findRatioImage(data.btn_check_on_disabled_holo_light));\n            }\n            static get btn_check_on_focused_holo_light() {\n                return imageCache.btn_check_on_focused_holo_light || (imageCache.btn_check_on_focused_holo_light = findRatioImage(data.btn_check_on_focused_holo_light));\n            }\n            static get btn_check_on_holo_light() {\n                return imageCache.btn_check_on_holo_light || (imageCache.btn_check_on_holo_light = findRatioImage(data.btn_check_on_holo_light));\n            }\n            static get btn_check_on_pressed_holo_light() {\n                return imageCache.btn_check_on_pressed_holo_light || (imageCache.btn_check_on_pressed_holo_light = findRatioImage(data.btn_check_on_pressed_holo_light));\n            }\n            static get btn_default_disabled_focused_holo_light() {\n                return imageCache.btn_default_disabled_focused_holo_light || (imageCache.btn_default_disabled_focused_holo_light = findRatioImage(data.btn_default_disabled_focused_holo_light));\n            }\n            static get btn_default_disabled_holo_light() {\n                return imageCache.btn_default_disabled_holo_light || (imageCache.btn_default_disabled_holo_light = findRatioImage(data.btn_default_disabled_holo_light));\n            }\n            static get btn_default_focused_holo_light() {\n                return imageCache.btn_default_focused_holo_light || (imageCache.btn_default_focused_holo_light = findRatioImage(data.btn_default_focused_holo_light));\n            }\n            static get btn_default_normal_holo_light() {\n                return imageCache.btn_default_normal_holo_light || (imageCache.btn_default_normal_holo_light = findRatioImage(data.btn_default_normal_holo_light));\n            }\n            static get btn_default_pressed_holo_light() {\n                return imageCache.btn_default_pressed_holo_light || (imageCache.btn_default_pressed_holo_light = findRatioImage(data.btn_default_pressed_holo_light));\n            }\n            static get btn_radio_off_disabled_focused_holo_light() {\n                return imageCache.btn_radio_off_disabled_focused_holo_light || (imageCache.btn_radio_off_disabled_focused_holo_light = findRatioImage(data.btn_radio_off_disabled_focused_holo_light));\n            }\n            static get btn_radio_off_disabled_holo_light() {\n                return imageCache.btn_radio_off_disabled_holo_light || (imageCache.btn_radio_off_disabled_holo_light = findRatioImage(data.btn_radio_off_disabled_holo_light));\n            }\n            static get btn_radio_off_focused_holo_light() {\n                return imageCache.btn_radio_off_focused_holo_light || (imageCache.btn_radio_off_focused_holo_light = findRatioImage(data.btn_radio_off_focused_holo_light));\n            }\n            static get btn_radio_off_holo_light() {\n                return imageCache.btn_radio_off_holo_light || (imageCache.btn_radio_off_holo_light = findRatioImage(data.btn_radio_off_holo_light));\n            }\n            static get btn_radio_off_pressed_holo_light() {\n                return imageCache.btn_radio_off_pressed_holo_light || (imageCache.btn_radio_off_pressed_holo_light = findRatioImage(data.btn_radio_off_pressed_holo_light));\n            }\n            static get btn_radio_on_disabled_focused_holo_light() {\n                return imageCache.btn_radio_on_disabled_focused_holo_light || (imageCache.btn_radio_on_disabled_focused_holo_light = findRatioImage(data.btn_radio_on_disabled_focused_holo_light));\n            }\n            static get btn_radio_on_disabled_holo_light() {\n                return imageCache.btn_radio_on_disabled_holo_light || (imageCache.btn_radio_on_disabled_holo_light = findRatioImage(data.btn_radio_on_disabled_holo_light));\n            }\n            static get btn_radio_on_focused_holo_light() {\n                return imageCache.btn_radio_on_focused_holo_light || (imageCache.btn_radio_on_focused_holo_light = findRatioImage(data.btn_radio_on_focused_holo_light));\n            }\n            static get btn_radio_on_holo_light() {\n                return imageCache.btn_radio_on_holo_light || (imageCache.btn_radio_on_holo_light = findRatioImage(data.btn_radio_on_holo_light));\n            }\n            static get btn_radio_on_pressed_holo_light() {\n                return imageCache.btn_radio_on_pressed_holo_light || (imageCache.btn_radio_on_pressed_holo_light = findRatioImage(data.btn_radio_on_pressed_holo_light));\n            }\n            static get btn_rating_star_off_normal_holo_light() {\n                return imageCache.btn_rating_star_off_normal_holo_light || (imageCache.btn_rating_star_off_normal_holo_light = findRatioImage(data.btn_rating_star_off_normal_holo_light));\n            }\n            static get btn_rating_star_off_pressed_holo_light() {\n                return imageCache.btn_rating_star_off_pressed_holo_light || (imageCache.btn_rating_star_off_pressed_holo_light = findRatioImage(data.btn_rating_star_off_pressed_holo_light));\n            }\n            static get btn_rating_star_on_normal_holo_light() {\n                return imageCache.btn_rating_star_on_normal_holo_light || (imageCache.btn_rating_star_on_normal_holo_light = findRatioImage(data.btn_rating_star_on_normal_holo_light));\n            }\n            static get btn_rating_star_on_pressed_holo_light() {\n                return imageCache.btn_rating_star_on_pressed_holo_light || (imageCache.btn_rating_star_on_pressed_holo_light = findRatioImage(data.btn_rating_star_on_pressed_holo_light));\n            }\n            static get dropdown_background_dark() {\n                return imageCache.dropdown_background_dark || (imageCache.dropdown_background_dark = findRatioImage(data.dropdown_background_dark));\n            }\n            static get editbox_background_focus_yellow() {\n                return imageCache.editbox_background_focus_yellow || (imageCache.editbox_background_focus_yellow = findRatioImage(data.editbox_background_focus_yellow));\n            }\n            static get editbox_background_normal() {\n                return imageCache.editbox_background_normal || (imageCache.editbox_background_normal = findRatioImage(data.editbox_background_normal));\n            }\n            static get ic_menu_moreoverflow_normal_holo_dark() {\n                return imageCache.ic_menu_moreoverflow_normal_holo_dark || (imageCache.ic_menu_moreoverflow_normal_holo_dark = findRatioImage(data.ic_menu_moreoverflow_normal_holo_dark));\n            }\n            static get menu_panel_holo_dark() {\n                return imageCache.menu_panel_holo_dark || (imageCache.menu_panel_holo_dark = findRatioImage(data.menu_panel_holo_dark));\n            }\n            static get menu_panel_holo_light() {\n                return imageCache.menu_panel_holo_light || (imageCache.menu_panel_holo_light = findRatioImage(data.menu_panel_holo_light));\n            }\n            static get popup_bottom_bright() {\n                return imageCache.popup_bottom_bright || (imageCache.popup_bottom_bright = findRatioImage(data.popup_bottom_bright));\n            }\n            static get popup_center_bright() {\n                return imageCache.popup_center_bright || (imageCache.popup_center_bright = findRatioImage(data.popup_center_bright));\n            }\n            static get popup_full_bright() {\n                return imageCache.popup_full_bright || (imageCache.popup_full_bright = findRatioImage(data.popup_full_bright));\n            }\n            static get popup_top_bright() {\n                return imageCache.popup_top_bright || (imageCache.popup_top_bright = findRatioImage(data.popup_top_bright));\n            }\n            static get progressbar_indeterminate_holo1() {\n                return imageCache.progressbar_indeterminate_holo1 || (imageCache.progressbar_indeterminate_holo1 = findRatioImage(data.progressbar_indeterminate_holo1));\n            }\n            static get progressbar_indeterminate_holo2() {\n                return imageCache.progressbar_indeterminate_holo2 || (imageCache.progressbar_indeterminate_holo2 = findRatioImage(data.progressbar_indeterminate_holo2));\n            }\n            static get progressbar_indeterminate_holo3() {\n                return imageCache.progressbar_indeterminate_holo3 || (imageCache.progressbar_indeterminate_holo3 = findRatioImage(data.progressbar_indeterminate_holo3));\n            }\n            static get progressbar_indeterminate_holo4() {\n                return imageCache.progressbar_indeterminate_holo4 || (imageCache.progressbar_indeterminate_holo4 = findRatioImage(data.progressbar_indeterminate_holo4));\n            }\n            static get progressbar_indeterminate_holo5() {\n                return imageCache.progressbar_indeterminate_holo5 || (imageCache.progressbar_indeterminate_holo5 = findRatioImage(data.progressbar_indeterminate_holo5));\n            }\n            static get progressbar_indeterminate_holo6() {\n                return imageCache.progressbar_indeterminate_holo6 || (imageCache.progressbar_indeterminate_holo6 = findRatioImage(data.progressbar_indeterminate_holo6));\n            }\n            static get progressbar_indeterminate_holo7() {\n                return imageCache.progressbar_indeterminate_holo7 || (imageCache.progressbar_indeterminate_holo7 = findRatioImage(data.progressbar_indeterminate_holo7));\n            }\n            static get progressbar_indeterminate_holo8() {\n                return imageCache.progressbar_indeterminate_holo8 || (imageCache.progressbar_indeterminate_holo8 = findRatioImage(data.progressbar_indeterminate_holo8));\n            }\n            static get rate_star_big_half_holo_light() {\n                return imageCache.rate_star_big_half_holo_light || (imageCache.rate_star_big_half_holo_light = findRatioImage(data.rate_star_big_half_holo_light));\n            }\n            static get rate_star_big_off_holo_light() {\n                return imageCache.rate_star_big_off_holo_light || (imageCache.rate_star_big_off_holo_light = findRatioImage(data.rate_star_big_off_holo_light));\n            }\n            static get rate_star_big_on_holo_light() {\n                return imageCache.rate_star_big_on_holo_light || (imageCache.rate_star_big_on_holo_light = findRatioImage(data.rate_star_big_on_holo_light));\n            }\n            static get scrubber_control_disabled_holo() {\n                return imageCache.scrubber_control_disabled_holo || (imageCache.scrubber_control_disabled_holo = findRatioImage(data.scrubber_control_disabled_holo));\n            }\n            static get scrubber_control_focused_holo() {\n                return imageCache.scrubber_control_focused_holo || (imageCache.scrubber_control_focused_holo = findRatioImage(data.scrubber_control_focused_holo));\n            }\n            static get scrubber_control_normal_holo() {\n                return imageCache.scrubber_control_normal_holo || (imageCache.scrubber_control_normal_holo = findRatioImage(data.scrubber_control_normal_holo));\n            }\n            static get scrubber_control_pressed_holo() {\n                return imageCache.scrubber_control_pressed_holo || (imageCache.scrubber_control_pressed_holo = findRatioImage(data.scrubber_control_pressed_holo));\n            }\n            static get spinner_76_inner_holo() {\n                return imageCache.spinner_76_inner_holo || (imageCache.spinner_76_inner_holo = findRatioImage(data.spinner_76_inner_holo));\n            }\n            static get spinner_76_outer_holo() {\n                return imageCache.spinner_76_outer_holo || (imageCache.spinner_76_outer_holo = findRatioImage(data.spinner_76_outer_holo));\n            }\n        }\n        R.image_base64 = image_base64;\n    })(R = android.R || (android.R = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var R;\n    (function (R) {\n        var NetDrawable = androidui.image.NetDrawable;\n        var ChangeImageSizeDrawable = androidui.image.ChangeImageSizeDrawable;\n        var NinePatchDrawable = androidui.image.NinePatchDrawable;\n        const density = android.content.res.Resources.getDisplayMetrics().density;\n        class image {\n            static get actionbar_ic_back_white() { return new NetDrawable(R.image_base64.actionbar_ic_back_white); }\n            static get btn_check_off_disabled_focused_holo_light() { return new NetDrawable(R.image_base64.btn_check_off_disabled_focused_holo_light); }\n            static get btn_check_off_disabled_holo_light() { return new NetDrawable(R.image_base64.btn_check_off_disabled_holo_light); }\n            static get btn_check_off_focused_holo_light() { return new NetDrawable(R.image_base64.btn_check_off_focused_holo_light); }\n            static get btn_check_off_holo_light() { return new NetDrawable(R.image_base64.btn_check_off_holo_light); }\n            static get btn_check_off_pressed_holo_light() { return new NetDrawable(R.image_base64.btn_check_off_pressed_holo_light); }\n            static get btn_check_on_disabled_focused_holo_light() { return new NetDrawable(R.image_base64.btn_check_on_disabled_focused_holo_light); }\n            static get btn_check_on_disabled_holo_light() { return new NetDrawable(R.image_base64.btn_check_on_disabled_holo_light); }\n            static get btn_check_on_focused_holo_light() { return new NetDrawable(R.image_base64.btn_check_on_focused_holo_light); }\n            static get btn_check_on_holo_light() { return new NetDrawable(R.image_base64.btn_check_on_holo_light); }\n            static get btn_check_on_pressed_holo_light() { return new NetDrawable(R.image_base64.btn_check_on_pressed_holo_light); }\n            static get btn_default_disabled_focused_holo_light() { return new NinePatchDrawable(R.image_base64.btn_default_disabled_focused_holo_light); }\n            static get btn_default_disabled_holo_light() { return new NinePatchDrawable(R.image_base64.btn_default_disabled_holo_light); }\n            static get btn_default_focused_holo_light() { return new NinePatchDrawable(R.image_base64.btn_default_focused_holo_light); }\n            static get btn_default_normal_holo_light() { return new NinePatchDrawable(R.image_base64.btn_default_normal_holo_light); }\n            static get btn_default_pressed_holo_light() { return new NinePatchDrawable(R.image_base64.btn_default_pressed_holo_light); }\n            static get btn_radio_off_disabled_focused_holo_light() { return new NetDrawable(R.image_base64.btn_radio_off_disabled_focused_holo_light); }\n            static get btn_radio_off_disabled_holo_light() { return new NetDrawable(R.image_base64.btn_radio_off_disabled_holo_light); }\n            static get btn_radio_off_focused_holo_light() { return new NetDrawable(R.image_base64.btn_radio_off_focused_holo_light); }\n            static get btn_radio_off_holo_light() { return new NetDrawable(R.image_base64.btn_radio_off_holo_light); }\n            static get btn_radio_off_pressed_holo_light() { return new NetDrawable(R.image_base64.btn_radio_off_pressed_holo_light); }\n            static get btn_radio_on_disabled_focused_holo_light() { return new NetDrawable(R.image_base64.btn_radio_on_disabled_focused_holo_light); }\n            static get btn_radio_on_disabled_holo_light() { return new NetDrawable(R.image_base64.btn_radio_on_disabled_holo_light); }\n            static get btn_radio_on_focused_holo_light() { return new NetDrawable(R.image_base64.btn_radio_on_focused_holo_light); }\n            static get btn_radio_on_holo_light() { return new NetDrawable(R.image_base64.btn_radio_on_holo_light); }\n            static get btn_radio_on_pressed_holo_light() { return new NetDrawable(R.image_base64.btn_radio_on_pressed_holo_light); }\n            static get btn_rating_star_off_normal_holo_light() { return new NetDrawable(R.image_base64.btn_rating_star_off_normal_holo_light); }\n            static get btn_rating_star_off_pressed_holo_light() { return new NetDrawable(R.image_base64.btn_rating_star_off_pressed_holo_light); }\n            static get btn_rating_star_on_normal_holo_light() { return new NetDrawable(R.image_base64.btn_rating_star_on_normal_holo_light); }\n            static get btn_rating_star_on_pressed_holo_light() { return new NetDrawable(R.image_base64.btn_rating_star_on_pressed_holo_light); }\n            static get dropdown_background_dark() { return new NinePatchDrawable(R.image_base64.dropdown_background_dark); }\n            static get editbox_background_focus_yellow() { return new NinePatchDrawable(R.image_base64.editbox_background_focus_yellow); }\n            static get editbox_background_normal() { return new NinePatchDrawable(R.image_base64.editbox_background_normal); }\n            static get ic_menu_moreoverflow_normal_holo_dark() { return new NetDrawable(R.image_base64.ic_menu_moreoverflow_normal_holo_dark); }\n            static get menu_panel_holo_dark() { return new NinePatchDrawable(R.image_base64.menu_panel_holo_dark); }\n            static get menu_panel_holo_light() { return new NinePatchDrawable(R.image_base64.menu_panel_holo_light); }\n            static get popup_bottom_bright() { return new NinePatchDrawable(R.image_base64.popup_bottom_bright); }\n            static get popup_center_bright() { return new NinePatchDrawable(R.image_base64.popup_center_bright); }\n            static get popup_full_bright() { return new NinePatchDrawable(R.image_base64.popup_full_bright); }\n            static get popup_top_bright() { return new NinePatchDrawable(R.image_base64.popup_top_bright); }\n            static get progressbar_indeterminate_holo1() { return new NetDrawable(R.image_base64.progressbar_indeterminate_holo1); }\n            static get progressbar_indeterminate_holo2() { return new NetDrawable(R.image_base64.progressbar_indeterminate_holo2); }\n            static get progressbar_indeterminate_holo3() { return new NetDrawable(R.image_base64.progressbar_indeterminate_holo3); }\n            static get progressbar_indeterminate_holo4() { return new NetDrawable(R.image_base64.progressbar_indeterminate_holo4); }\n            static get progressbar_indeterminate_holo5() { return new NetDrawable(R.image_base64.progressbar_indeterminate_holo5); }\n            static get progressbar_indeterminate_holo6() { return new NetDrawable(R.image_base64.progressbar_indeterminate_holo6); }\n            static get progressbar_indeterminate_holo7() { return new NetDrawable(R.image_base64.progressbar_indeterminate_holo7); }\n            static get progressbar_indeterminate_holo8() { return new NetDrawable(R.image_base64.progressbar_indeterminate_holo8); }\n            static get rate_star_big_half_holo_light() { return new NetDrawable(R.image_base64.rate_star_big_half_holo_light); }\n            static get rate_star_big_off_holo_light() { return new NetDrawable(R.image_base64.rate_star_big_off_holo_light); }\n            static get rate_star_big_on_holo_light() { return new NetDrawable(R.image_base64.rate_star_big_on_holo_light); }\n            static get scrubber_control_disabled_holo() { return new NetDrawable(R.image_base64.scrubber_control_disabled_holo); }\n            static get scrubber_control_focused_holo() { return new NetDrawable(R.image_base64.scrubber_control_focused_holo); }\n            static get scrubber_control_normal_holo() { return new NetDrawable(R.image_base64.scrubber_control_normal_holo); }\n            static get scrubber_control_pressed_holo() { return new NetDrawable(R.image_base64.scrubber_control_pressed_holo); }\n            static get spinner_76_inner_holo() { return new NetDrawable(R.image_base64.spinner_76_inner_holo); }\n            static get spinner_76_outer_holo() { return new NetDrawable(R.image_base64.spinner_76_outer_holo); }\n            static get spinner_48_outer_holo() { return new ChangeImageSizeDrawable(image.spinner_76_outer_holo, 48 * density, 48 * density); }\n            static get spinner_48_inner_holo() { return new ChangeImageSizeDrawable(image.spinner_76_inner_holo, 48 * density, 48 * density); }\n            static get spinner_16_outer_holo() { return new ChangeImageSizeDrawable(image.spinner_76_outer_holo, 16 * density, 16 * density); }\n            static get spinner_16_inner_holo() { return new ChangeImageSizeDrawable(image.spinner_76_inner_holo, 16 * density, 16 * density); }\n            static get rate_star_small_off_holo_light() { return new ChangeImageSizeDrawable(image.rate_star_big_half_holo_light, 16 * density, 16 * density); }\n            static get rate_star_small_half_holo_light() { return new ChangeImageSizeDrawable(image.rate_star_big_off_holo_light, 16 * density, 16 * density); }\n            static get rate_star_small_on_holo_light() { return new ChangeImageSizeDrawable(image.rate_star_big_on_holo_light, 16 * density, 16 * density); }\n        }\n        R.image = image;\n        R.image_base64.actionbar_ic_back_white;\n        R.image_base64.btn_default_normal_holo_light;\n        R.image_base64.dropdown_background_dark;\n        R.image_base64.editbox_background_normal;\n        R.image_base64.ic_menu_moreoverflow_normal_holo_dark;\n        R.image_base64.menu_panel_holo_dark;\n        R.image_base64.menu_panel_holo_light;\n        R.image_base64.popup_bottom_bright;\n        R.image_base64.popup_center_bright;\n        R.image_base64.popup_full_bright;\n        R.image_base64.popup_top_bright;\n    })(R = android.R || (android.R = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var R;\n    (function (R) {\n        var ColorStateList = android.content.res.ColorStateList;\n        var Color = android.graphics.Color;\n        class color {\n            static get textView_textColor() {\n                let _defaultStates = [[-android.view.View.VIEW_STATE_ENABLED], []];\n                let _defaultColors = [0xffc0c0c0, 0xff333333];\n                class DefaultStyleTextColor extends ColorStateList {\n                    constructor() {\n                        super(_defaultStates, _defaultColors);\n                    }\n                }\n                return new DefaultStyleTextColor();\n            }\n            static get primary_text_light_disable_only() {\n                let _defaultStates = [[-android.view.View.VIEW_STATE_ENABLED], []];\n                let _defaultColors = [0x80000000, 0xff000000];\n                class DefaultStyleTextColor extends ColorStateList {\n                    constructor() {\n                        super(_defaultStates, _defaultColors);\n                    }\n                }\n                return new DefaultStyleTextColor();\n            }\n            static get primary_text_dark_disable_only() {\n                let _defaultStates = [[-android.view.View.VIEW_STATE_ENABLED], []];\n                let _defaultColors = [0x80000000, 0xffffffff];\n                class DefaultStyleTextColor extends ColorStateList {\n                    constructor() {\n                        super(_defaultStates, _defaultColors);\n                    }\n                }\n                return new DefaultStyleTextColor();\n            }\n        }\n        color.white = Color.WHITE;\n        color.black = Color.BLACK;\n        color.transparent = Color.TRANSPARENT;\n        R.color = color;\n    })(R = android.R || (android.R = {}));\n})(android || (android = {}));\nvar goog;\n(function (goog) {\n    var math;\n    (function (math) {\n        class Long {\n            constructor(low, high) {\n                this.low_ = low | 0;\n                this.high_ = high | 0;\n            }\n            toInt() {\n                return this.low_;\n            }\n            toNumber() {\n                return this.high_ * Long.TWO_PWR_32_DBL_ + this.getLowBitsUnsigned();\n            }\n            toString(opt_radix) {\n                var radix = opt_radix || 10;\n                if (radix < 2 || 36 < radix) {\n                    throw Error('radix out of range: ' + radix);\n                }\n                if (this.isZero()) {\n                    return '0';\n                }\n                if (this.isNegative()) {\n                    if (this.equals(Long.MIN_VALUE)) {\n                        var radixLong = Long.fromNumber(radix);\n                        var div = this.div(radixLong);\n                        let rem = div.multiply(radixLong).subtract(this);\n                        return div.toString(radix) + rem.toInt().toString(radix);\n                    }\n                    else {\n                        return '-' + this.negate().toString(radix);\n                    }\n                }\n                var radixToPower = Long.fromNumber(Math.pow(radix, 6));\n                let rem = this;\n                var result = '';\n                while (true) {\n                    var remDiv = rem.div(radixToPower);\n                    var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();\n                    var digits = intval.toString(radix);\n                    rem = remDiv;\n                    if (rem.isZero()) {\n                        return digits + result;\n                    }\n                    else {\n                        while (digits.length < 6) {\n                            digits = '0' + digits;\n                        }\n                        result = '' + digits + result;\n                    }\n                }\n            }\n            getHighBits() {\n                return this.high_;\n            }\n            getLowBits() {\n                return this.low_;\n            }\n            getLowBitsUnsigned() {\n                return (this.low_ >= 0) ? this.low_ : Long.TWO_PWR_32_DBL_ + this.low_;\n            }\n            getNumBitsAbs() {\n                if (this.isNegative()) {\n                    if (this.equals(Long.MIN_VALUE)) {\n                        return 64;\n                    }\n                    else {\n                        return this.negate().getNumBitsAbs();\n                    }\n                }\n                else {\n                    var val = this.high_ != 0 ? this.high_ : this.low_;\n                    for (var bit = 31; bit > 0; bit--) {\n                        if ((val & (1 << bit)) != 0) {\n                            break;\n                        }\n                    }\n                    return this.high_ != 0 ? bit + 33 : bit + 1;\n                }\n            }\n            isZero() {\n                return this.high_ == 0 && this.low_ == 0;\n            }\n            isNegative() {\n                return this.high_ < 0;\n            }\n            isOdd() {\n                return (this.low_ & 1) == 1;\n            }\n            equals(other) {\n                return (this.high_ == other.high_) && (this.low_ == other.low_);\n            }\n            notEquals(other) {\n                return (this.high_ != other.high_) || (this.low_ != other.low_);\n            }\n            lessThan(other) {\n                return this.compare(other) < 0;\n            }\n            lessThanOrEqual(other) {\n                return this.compare(other) <= 0;\n            }\n            greaterThan(other) {\n                return this.compare(other) > 0;\n            }\n            greaterThanOrEqual(other) {\n                return this.compare(other) >= 0;\n            }\n            compare(other) {\n                if (this.equals(other)) {\n                    return 0;\n                }\n                var thisNeg = this.isNegative();\n                var otherNeg = other.isNegative();\n                if (thisNeg && !otherNeg) {\n                    return -1;\n                }\n                if (!thisNeg && otherNeg) {\n                    return 1;\n                }\n                if (this.subtract(other).isNegative()) {\n                    return -1;\n                }\n                else {\n                    return 1;\n                }\n            }\n            negate() {\n                if (this.equals(Long.MIN_VALUE)) {\n                    return Long.MIN_VALUE;\n                }\n                else {\n                    return this.not().add(Long.ONE);\n                }\n            }\n            add(other) {\n                var a48 = this.high_ >>> 16;\n                var a32 = this.high_ & 0xFFFF;\n                var a16 = this.low_ >>> 16;\n                var a00 = this.low_ & 0xFFFF;\n                var b48 = other.high_ >>> 16;\n                var b32 = other.high_ & 0xFFFF;\n                var b16 = other.low_ >>> 16;\n                var b00 = other.low_ & 0xFFFF;\n                var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n                c00 += a00 + b00;\n                c16 += c00 >>> 16;\n                c00 &= 0xFFFF;\n                c16 += a16 + b16;\n                c32 += c16 >>> 16;\n                c16 &= 0xFFFF;\n                c32 += a32 + b32;\n                c48 += c32 >>> 16;\n                c32 &= 0xFFFF;\n                c48 += a48 + b48;\n                c48 &= 0xFFFF;\n                return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n            }\n            subtract(other) {\n                return this.add(other.negate());\n            }\n            multiply(other) {\n                if (this.isZero()) {\n                    return Long.ZERO;\n                }\n                else if (other.isZero()) {\n                    return Long.ZERO;\n                }\n                if (this.equals(Long.MIN_VALUE)) {\n                    return other.isOdd() ? Long.MIN_VALUE : Long.ZERO;\n                }\n                else if (other.equals(Long.MIN_VALUE)) {\n                    return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;\n                }\n                if (this.isNegative()) {\n                    if (other.isNegative()) {\n                        return this.negate().multiply(other.negate());\n                    }\n                    else {\n                        return this.negate().multiply(other).negate();\n                    }\n                }\n                else if (other.isNegative()) {\n                    return this.multiply(other.negate()).negate();\n                }\n                if (this.lessThan(Long.TWO_PWR_24_) &&\n                    other.lessThan(Long.TWO_PWR_24_)) {\n                    return Long.fromNumber(this.toNumber() * other.toNumber());\n                }\n                var a48 = this.high_ >>> 16;\n                var a32 = this.high_ & 0xFFFF;\n                var a16 = this.low_ >>> 16;\n                var a00 = this.low_ & 0xFFFF;\n                var b48 = other.high_ >>> 16;\n                var b32 = other.high_ & 0xFFFF;\n                var b16 = other.low_ >>> 16;\n                var b00 = other.low_ & 0xFFFF;\n                var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n                c00 += a00 * b00;\n                c16 += c00 >>> 16;\n                c00 &= 0xFFFF;\n                c16 += a16 * b00;\n                c32 += c16 >>> 16;\n                c16 &= 0xFFFF;\n                c16 += a00 * b16;\n                c32 += c16 >>> 16;\n                c16 &= 0xFFFF;\n                c32 += a32 * b00;\n                c48 += c32 >>> 16;\n                c32 &= 0xFFFF;\n                c32 += a16 * b16;\n                c48 += c32 >>> 16;\n                c32 &= 0xFFFF;\n                c32 += a00 * b32;\n                c48 += c32 >>> 16;\n                c32 &= 0xFFFF;\n                c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n                c48 &= 0xFFFF;\n                return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n            }\n            div(other) {\n                if (other.isZero()) {\n                    throw Error('division by zero');\n                }\n                else if (this.isZero()) {\n                    return Long.ZERO;\n                }\n                if (this.equals(Long.MIN_VALUE)) {\n                    if (other.equals(Long.ONE) ||\n                        other.equals(Long.NEG_ONE)) {\n                        return Long.MIN_VALUE;\n                    }\n                    else if (other.equals(Long.MIN_VALUE)) {\n                        return Long.ONE;\n                    }\n                    else {\n                        var halfThis = this.shiftRight(1);\n                        let approx = halfThis.div(other).shiftLeft(1);\n                        if (approx.equals(Long.ZERO)) {\n                            return other.isNegative() ? Long.ONE : Long.NEG_ONE;\n                        }\n                        else {\n                            let rem = this.subtract(other.multiply(approx));\n                            var result = approx.add(rem.div(other));\n                            return result;\n                        }\n                    }\n                }\n                else if (other.equals(Long.MIN_VALUE)) {\n                    return Long.ZERO;\n                }\n                if (this.isNegative()) {\n                    if (other.isNegative()) {\n                        return this.negate().div(other.negate());\n                    }\n                    else {\n                        return this.negate().div(other).negate();\n                    }\n                }\n                else if (other.isNegative()) {\n                    return this.div(other.negate()).negate();\n                }\n                var res = Long.ZERO;\n                let rem = this;\n                while (rem.greaterThanOrEqual(other)) {\n                    let approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));\n                    var log2 = Math.ceil(Math.log(approx) / Math.LN2);\n                    var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48);\n                    var approxRes = Long.fromNumber(approx);\n                    var approxRem = approxRes.multiply(other);\n                    while (approxRem.isNegative() || approxRem.greaterThan(rem)) {\n                        approx -= delta;\n                        approxRes = Long.fromNumber(approx);\n                        approxRem = approxRes.multiply(other);\n                    }\n                    if (approxRes.isZero()) {\n                        approxRes = Long.ONE;\n                    }\n                    res = res.add(approxRes);\n                    rem = rem.subtract(approxRem);\n                }\n                return res;\n            }\n            modulo(other) {\n                return this.subtract(this.div(other).multiply(other));\n            }\n            not() {\n                return Long.fromBits(~this.low_, ~this.high_);\n            }\n            and(other) {\n                return Long.fromBits(this.low_ & other.low_, this.high_ & other.high_);\n            }\n            or(other) {\n                return Long.fromBits(this.low_ | other.low_, this.high_ | other.high_);\n            }\n            xor(other) {\n                return Long.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_);\n            }\n            shiftLeft(numBits) {\n                numBits &= 63;\n                if (numBits == 0) {\n                    return this;\n                }\n                else {\n                    var low = this.low_;\n                    if (numBits < 32) {\n                        var high = this.high_;\n                        return Long.fromBits(low << numBits, (high << numBits) | (low >>> (32 - numBits)));\n                    }\n                    else {\n                        return Long.fromBits(0, low << (numBits - 32));\n                    }\n                }\n            }\n            shiftRight(numBits) {\n                numBits &= 63;\n                if (numBits == 0) {\n                    return this;\n                }\n                else {\n                    var high = this.high_;\n                    if (numBits < 32) {\n                        var low = this.low_;\n                        return Long.fromBits((low >>> numBits) | (high << (32 - numBits)), high >> numBits);\n                    }\n                    else {\n                        return Long.fromBits(high >> (numBits - 32), high >= 0 ? 0 : -1);\n                    }\n                }\n            }\n            shiftRightUnsigned(numBits) {\n                numBits &= 63;\n                if (numBits == 0) {\n                    return this;\n                }\n                else {\n                    var high = this.high_;\n                    if (numBits < 32) {\n                        var low = this.low_;\n                        return Long.fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits);\n                    }\n                    else if (numBits == 32) {\n                        return Long.fromBits(high, 0);\n                    }\n                    else {\n                        return Long.fromBits(high >>> (numBits - 32), 0);\n                    }\n                }\n            }\n            static fromInt(value) {\n                if (-128 <= value && value < 128) {\n                    var cachedObj = Long.IntCache_[value];\n                    if (cachedObj) {\n                        return cachedObj;\n                    }\n                }\n                var obj = new Long(value | 0, value < 0 ? -1 : 0);\n                if (-128 <= value && value < 128) {\n                    Long.IntCache_[value] = obj;\n                }\n                return obj;\n            }\n            static fromNumber(value) {\n                if (isNaN(value) || !isFinite(value)) {\n                    return Long.ZERO;\n                }\n                else if (value <= -Long.TWO_PWR_63_DBL_) {\n                    return Long.MIN_VALUE;\n                }\n                else if (value + 1 >= Long.TWO_PWR_63_DBL_) {\n                    return Long.MAX_VALUE;\n                }\n                else if (value < 0) {\n                    return Long.fromNumber(-value).negate();\n                }\n                else {\n                    return new Long((value % Long.TWO_PWR_32_DBL_) | 0, (value / Long.TWO_PWR_32_DBL_) | 0);\n                }\n            }\n            static fromBits(lowBits, highBits) {\n                return new Long(lowBits, highBits);\n            }\n            static fromString(str, opt_radix) {\n                if (str.length == 0) {\n                    throw Error('number format error: empty string');\n                }\n                var radix = opt_radix || 10;\n                if (radix < 2 || 36 < radix) {\n                    throw Error('radix out of range: ' + radix);\n                }\n                if (str.charAt(0) == '-') {\n                    return Long.fromString(str.substring(1), radix).negate();\n                }\n                else if (str.indexOf('-') >= 0) {\n                    throw Error('number format error: interior \"-\" character: ' + str);\n                }\n                var radixToPower = Long.fromNumber(Math.pow(radix, 8));\n                var result = Long.ZERO;\n                for (var i = 0; i < str.length; i += 8) {\n                    var size = Math.min(8, str.length - i);\n                    var value = parseInt(str.substring(i, i + size), radix);\n                    if (size < 8) {\n                        var power = Long.fromNumber(Math.pow(radix, size));\n                        result = result.multiply(power).add(Long.fromNumber(value));\n                    }\n                    else {\n                        result = result.multiply(radixToPower);\n                        result = result.add(Long.fromNumber(value));\n                    }\n                }\n                return result;\n            }\n        }\n        Long.IntCache_ = {};\n        Long.TWO_PWR_16_DBL_ = 1 << 16;\n        Long.TWO_PWR_24_DBL_ = 1 << 24;\n        Long.TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_;\n        Long.TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2;\n        Long.TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_;\n        Long.TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_;\n        Long.TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2;\n        Long.TWO_PWR_24_ = Long.fromInt(1 << 24);\n        Long.ZERO = Long.fromInt(0);\n        Long.ONE = Long.fromInt(1);\n        Long.NEG_ONE = Long.fromInt(-1);\n        Long.MAX_VALUE = Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);\n        Long.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0);\n        math.Long = Long;\n    })(math = goog.math || (goog.math = {}));\n})(goog || (goog = {}));\nvar java;\n(function (java) {\n    var lang;\n    (function (lang) {\n        class Long {\n        }\n        Long.MIN_VALUE = goog.math.Long.MIN_VALUE.toNumber();\n        Long.MAX_VALUE = goog.math.Long.MAX_VALUE.toNumber();\n        lang.Long = Long;\n    })(lang = java.lang || (java.lang = {}));\n})(java || (java = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var animation;\n        (function (animation) {\n            class AccelerateDecelerateInterpolator {\n                getInterpolation(input) {\n                    return (Math.cos((input + 1) * Math.PI) / 2) + 0.5;\n                }\n            }\n            animation.AccelerateDecelerateInterpolator = AccelerateDecelerateInterpolator;\n        })(animation = view.animation || (view.animation = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var animation;\n        (function (animation) {\n            class DecelerateInterpolator {\n                constructor(factor = 1) {\n                    this.mFactor = factor;\n                }\n                getInterpolation(input) {\n                    let result;\n                    if (this.mFactor == 1.0) {\n                        result = (1.0 - (1.0 - input) * (1.0 - input));\n                    }\n                    else {\n                        result = (1.0 - Math.pow((1.0 - input), 2 * this.mFactor));\n                    }\n                    return result;\n                }\n            }\n            animation.DecelerateInterpolator = DecelerateInterpolator;\n        })(animation = view.animation || (view.animation = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var animation;\n        (function (animation) {\n            var Matrix = android.graphics.Matrix;\n            var StringBuilder = java.lang.StringBuilder;\n            class Transformation {\n                constructor() {\n                    this.mAlpha = 0;\n                    this.mTransformationType = 0;\n                    this.clear();\n                }\n                clear() {\n                    if (this.mMatrix == null) {\n                        this.mMatrix = new Matrix();\n                    }\n                    else {\n                        this.mMatrix.reset();\n                    }\n                    this.mAlpha = 1.0;\n                    this.mTransformationType = Transformation.TYPE_BOTH;\n                }\n                getTransformationType() {\n                    return this.mTransformationType;\n                }\n                setTransformationType(transformationType) {\n                    this.mTransformationType = transformationType;\n                }\n                set(t) {\n                    this.mAlpha = t.getAlpha();\n                    this.mMatrix.set(t.getMatrix());\n                    this.mTransformationType = t.getTransformationType();\n                }\n                compose(t) {\n                    this.mAlpha *= t.getAlpha();\n                    this.mMatrix.preConcat(t.getMatrix());\n                }\n                postCompose(t) {\n                    this.mAlpha *= t.getAlpha();\n                    this.mMatrix.postConcat(t.getMatrix());\n                }\n                getMatrix() {\n                    return this.mMatrix;\n                }\n                setAlpha(alpha) {\n                    this.mAlpha = alpha;\n                }\n                getAlpha() {\n                    return this.mAlpha;\n                }\n                toString() {\n                    let sb = new StringBuilder(64);\n                    sb.append(\"Transformation\");\n                    this.toShortString(sb);\n                    return sb.toString();\n                }\n                toShortString(sb) {\n                    sb = sb || new StringBuilder(64);\n                    sb.append(\"{alpha=\");\n                    sb.append(this.mAlpha);\n                    sb.append(\" matrix=\");\n                    this.mMatrix.toShortString(sb);\n                    sb.append('}');\n                }\n            }\n            Transformation.TYPE_IDENTITY = 0x0;\n            Transformation.TYPE_ALPHA = 0x1;\n            Transformation.TYPE_MATRIX = 0x2;\n            Transformation.TYPE_BOTH = Transformation.TYPE_ALPHA | Transformation.TYPE_MATRIX;\n            animation.Transformation = Transformation;\n        })(animation = view.animation || (view.animation = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var animation;\n        (function (animation_1) {\n            var RectF = android.graphics.RectF;\n            var TypedValue = android.util.TypedValue;\n            var Long = java.lang.Long;\n            var AccelerateDecelerateInterpolator = android.view.animation.AccelerateDecelerateInterpolator;\n            var AnimationUtils = android.view.animation.AnimationUtils;\n            var Transformation = android.view.animation.Transformation;\n            class Animation {\n                constructor() {\n                    this.mEnded = false;\n                    this.mStarted = false;\n                    this.mCycleFlip = false;\n                    this.mInitialized = false;\n                    this.mFillBefore = true;\n                    this.mFillAfter = false;\n                    this.mFillEnabled = false;\n                    this.mStartTime = -1;\n                    this.mStartOffset = 0;\n                    this.mDuration = 0;\n                    this.mRepeatCount = 0;\n                    this.mRepeated = 0;\n                    this.mRepeatMode = Animation.RESTART;\n                    this.mZAdjustment = 0;\n                    this.mBackgroundColor = 0;\n                    this.mScaleFactor = 1;\n                    this.mDetachWallpaper = false;\n                    this.mMore = true;\n                    this.mOneMoreTime = true;\n                    this.mPreviousRegion = new RectF();\n                    this.mRegion = new RectF();\n                    this.mTransformation = new Transformation();\n                    this.mPreviousTransformation = new Transformation();\n                    this.ensureInterpolator();\n                }\n                reset() {\n                    this.mPreviousRegion.setEmpty();\n                    this.mPreviousTransformation.clear();\n                    this.mInitialized = false;\n                    this.mCycleFlip = false;\n                    this.mRepeated = 0;\n                    this.mMore = true;\n                    this.mOneMoreTime = true;\n                    this.mListenerHandler = null;\n                }\n                cancel() {\n                    if (this.mStarted && !this.mEnded) {\n                        this.fireAnimationEnd();\n                        this.mEnded = true;\n                    }\n                    this.mStartTime = Long.MIN_VALUE;\n                    this.mMore = this.mOneMoreTime = false;\n                }\n                detach() {\n                    if (this.mStarted && !this.mEnded) {\n                        this.mEnded = true;\n                        this.fireAnimationEnd();\n                    }\n                }\n                isInitialized() {\n                    return this.mInitialized;\n                }\n                initialize(width, height, parentWidth, parentHeight) {\n                    this.reset();\n                    this.mInitialized = true;\n                }\n                setListenerHandler(handler) {\n                    if (this.mListenerHandler == null) {\n                        const inner_this = this;\n                        this.mOnStart = {\n                            run() {\n                                if (inner_this.mListener != null) {\n                                    inner_this.mListener.onAnimationStart(inner_this);\n                                }\n                            }\n                        };\n                        this.mOnRepeat = {\n                            run() {\n                                if (inner_this.mListener != null) {\n                                    inner_this.mListener.onAnimationRepeat(inner_this);\n                                }\n                            }\n                        };\n                        this.mOnEnd = {\n                            run() {\n                                if (inner_this.mListener != null) {\n                                    inner_this.mListener.onAnimationEnd(inner_this);\n                                }\n                            }\n                        };\n                    }\n                    this.mListenerHandler = handler;\n                }\n                setInterpolator(i) {\n                    this.mInterpolator = i;\n                }\n                setStartOffset(startOffset) {\n                    this.mStartOffset = startOffset;\n                }\n                setDuration(durationMillis) {\n                    if (durationMillis < 0) {\n                        throw Error(`new IllegalArgumentException(\"Animation duration cannot be negative\")`);\n                    }\n                    this.mDuration = durationMillis;\n                }\n                restrictDuration(durationMillis) {\n                    if (this.mStartOffset > durationMillis) {\n                        this.mStartOffset = durationMillis;\n                        this.mDuration = 0;\n                        this.mRepeatCount = 0;\n                        return;\n                    }\n                    let dur = this.mDuration + this.mStartOffset;\n                    if (dur > durationMillis) {\n                        this.mDuration = durationMillis - this.mStartOffset;\n                        dur = durationMillis;\n                    }\n                    if (this.mDuration <= 0) {\n                        this.mDuration = 0;\n                        this.mRepeatCount = 0;\n                        return;\n                    }\n                    if (this.mRepeatCount < 0 || this.mRepeatCount > durationMillis || (dur * this.mRepeatCount) > durationMillis) {\n                        this.mRepeatCount = Math.floor((durationMillis / dur)) - 1;\n                        if (this.mRepeatCount < 0) {\n                            this.mRepeatCount = 0;\n                        }\n                    }\n                }\n                scaleCurrentDuration(scale) {\n                    this.mDuration = Math.floor((this.mDuration * scale));\n                    this.mStartOffset = Math.floor((this.mStartOffset * scale));\n                }\n                setStartTime(startTimeMillis) {\n                    this.mStartTime = startTimeMillis;\n                    this.mStarted = this.mEnded = false;\n                    this.mCycleFlip = false;\n                    this.mRepeated = 0;\n                    this.mMore = true;\n                }\n                start() {\n                    this.setStartTime(-1);\n                }\n                startNow() {\n                    this.setStartTime(AnimationUtils.currentAnimationTimeMillis());\n                }\n                setRepeatMode(repeatMode) {\n                    this.mRepeatMode = repeatMode;\n                }\n                setRepeatCount(repeatCount) {\n                    if (repeatCount < 0) {\n                        repeatCount = Animation.INFINITE;\n                    }\n                    this.mRepeatCount = repeatCount;\n                }\n                isFillEnabled() {\n                    return this.mFillEnabled;\n                }\n                setFillEnabled(fillEnabled) {\n                    this.mFillEnabled = fillEnabled;\n                }\n                setFillBefore(fillBefore) {\n                    this.mFillBefore = fillBefore;\n                }\n                setFillAfter(fillAfter) {\n                    this.mFillAfter = fillAfter;\n                }\n                setZAdjustment(zAdjustment) {\n                    this.mZAdjustment = zAdjustment;\n                }\n                setBackgroundColor(bg) {\n                    this.mBackgroundColor = bg;\n                }\n                getScaleFactor() {\n                    return this.mScaleFactor;\n                }\n                setDetachWallpaper(detachWallpaper) {\n                    this.mDetachWallpaper = detachWallpaper;\n                }\n                getInterpolator() {\n                    return this.mInterpolator;\n                }\n                getStartTime() {\n                    return this.mStartTime;\n                }\n                getDuration() {\n                    return this.mDuration;\n                }\n                getStartOffset() {\n                    return this.mStartOffset;\n                }\n                getRepeatMode() {\n                    return this.mRepeatMode;\n                }\n                getRepeatCount() {\n                    return this.mRepeatCount;\n                }\n                getFillBefore() {\n                    return this.mFillBefore;\n                }\n                getFillAfter() {\n                    return this.mFillAfter;\n                }\n                getZAdjustment() {\n                    return this.mZAdjustment;\n                }\n                getBackgroundColor() {\n                    return this.mBackgroundColor;\n                }\n                getDetachWallpaper() {\n                    return this.mDetachWallpaper;\n                }\n                willChangeTransformationMatrix() {\n                    return true;\n                }\n                willChangeBounds() {\n                    return true;\n                }\n                setAnimationListener(listener) {\n                    this.mListener = listener;\n                }\n                ensureInterpolator() {\n                    if (this.mInterpolator == null) {\n                        this.mInterpolator = new AccelerateDecelerateInterpolator();\n                    }\n                }\n                computeDurationHint() {\n                    return (this.getStartOffset() + this.getDuration()) * (this.getRepeatCount() + 1);\n                }\n                getTransformation(currentTime, outTransformation, scale) {\n                    if (scale != null)\n                        this.mScaleFactor = scale;\n                    if (this.mStartTime == -1) {\n                        this.mStartTime = currentTime;\n                    }\n                    const startOffset = this.getStartOffset();\n                    const duration = this.mDuration;\n                    let normalizedTime;\n                    if (duration != 0) {\n                        normalizedTime = (currentTime - (this.mStartTime + startOffset)) / duration;\n                    }\n                    else {\n                        normalizedTime = currentTime < this.mStartTime ? 0.0 : 1.0;\n                    }\n                    const expired = normalizedTime >= 1.0;\n                    this.mMore = !expired;\n                    if (!this.mFillEnabled)\n                        normalizedTime = Math.max(Math.min(normalizedTime, 1.0), 0.0);\n                    if ((normalizedTime >= 0.0 || this.mFillBefore) && (normalizedTime <= 1.0 || this.mFillAfter)) {\n                        if (!this.mStarted) {\n                            this.fireAnimationStart();\n                            this.mStarted = true;\n                        }\n                        if (this.mFillEnabled)\n                            normalizedTime = Math.max(Math.min(normalizedTime, 1.0), 0.0);\n                        if (this.mCycleFlip) {\n                            normalizedTime = 1.0 - normalizedTime;\n                        }\n                        const interpolatedTime = this.mInterpolator.getInterpolation(normalizedTime);\n                        this.applyTransformation(interpolatedTime, outTransformation);\n                    }\n                    if (expired) {\n                        if (this.mRepeatCount == this.mRepeated) {\n                            if (!this.mEnded) {\n                                this.mEnded = true;\n                                this.fireAnimationEnd();\n                            }\n                        }\n                        else {\n                            if (this.mRepeatCount > 0) {\n                                this.mRepeated++;\n                            }\n                            if (this.mRepeatMode == Animation.REVERSE) {\n                                this.mCycleFlip = !this.mCycleFlip;\n                            }\n                            this.mStartTime = -1;\n                            this.mMore = true;\n                            this.fireAnimationRepeat();\n                        }\n                    }\n                    if (!this.mMore && this.mOneMoreTime) {\n                        this.mOneMoreTime = false;\n                        return true;\n                    }\n                    return this.mMore;\n                }\n                fireAnimationStart() {\n                    if (this.mListener != null) {\n                        if (this.mListenerHandler == null)\n                            this.mListener.onAnimationStart(this);\n                        else\n                            this.mListenerHandler.postAtFrontOfQueue(this.mOnStart);\n                    }\n                }\n                fireAnimationRepeat() {\n                    if (this.mListener != null) {\n                        if (this.mListenerHandler == null)\n                            this.mListener.onAnimationRepeat(this);\n                        else\n                            this.mListenerHandler.postAtFrontOfQueue(this.mOnRepeat);\n                    }\n                }\n                fireAnimationEnd() {\n                    if (this.mListener != null) {\n                        if (this.mListenerHandler == null)\n                            this.mListener.onAnimationEnd(this);\n                        else\n                            this.mListenerHandler.postAtFrontOfQueue(this.mOnEnd);\n                    }\n                }\n                hasStarted() {\n                    return this.mStarted;\n                }\n                hasEnded() {\n                    return this.mEnded;\n                }\n                applyTransformation(interpolatedTime, t) {\n                }\n                resolveSize(type, value, size, parentSize) {\n                    switch (type) {\n                        case Animation.ABSOLUTE:\n                            return value;\n                        case Animation.RELATIVE_TO_SELF:\n                            return size * value;\n                        case Animation.RELATIVE_TO_PARENT:\n                            return parentSize * value;\n                        default:\n                            return value;\n                    }\n                }\n                getInvalidateRegion(left, top, right, bottom, invalidate, transformation) {\n                    const tempRegion = this.mRegion;\n                    const previousRegion = this.mPreviousRegion;\n                    invalidate.set(left, top, right, bottom);\n                    transformation.getMatrix().mapRect(invalidate);\n                    invalidate.inset(-1.0, -1.0);\n                    tempRegion.set(invalidate);\n                    invalidate.union(previousRegion);\n                    previousRegion.set(tempRegion);\n                    const tempTransformation = this.mTransformation;\n                    const previousTransformation = this.mPreviousTransformation;\n                    tempTransformation.set(transformation);\n                    transformation.set(previousTransformation);\n                    previousTransformation.set(tempTransformation);\n                }\n                initializeInvalidateRegion(left, top, right, bottom) {\n                    const region = this.mPreviousRegion;\n                    region.set(left, top, right, bottom);\n                    region.inset(-1.0, -1.0);\n                    if (this.mFillBefore) {\n                        const previousTransformation = this.mPreviousTransformation;\n                        this.applyTransformation(this.mInterpolator.getInterpolation(0.0), previousTransformation);\n                    }\n                }\n                hasAlpha() {\n                    return false;\n                }\n            }\n            Animation.INFINITE = -1;\n            Animation.RESTART = 1;\n            Animation.REVERSE = 2;\n            Animation.START_ON_FIRST_FRAME = -1;\n            Animation.ABSOLUTE = 0;\n            Animation.RELATIVE_TO_SELF = 1;\n            Animation.RELATIVE_TO_PARENT = 2;\n            Animation.ZORDER_NORMAL = 0;\n            Animation.ZORDER_TOP = 1;\n            Animation.ZORDER_BOTTOM = -1;\n            Animation.USE_CLOSEGUARD = false;\n            animation_1.Animation = Animation;\n            (function (Animation) {\n                class Description {\n                    constructor() {\n                        this.type = 0;\n                        this.value = 0;\n                    }\n                    static parseValue(value) {\n                        let d = new Description();\n                        if (value == null) {\n                            d.type = Animation.ABSOLUTE;\n                            d.value = 0;\n                        }\n                        else {\n                            if (value.endsWith('%p')) {\n                                d.type = Animation.RELATIVE_TO_PARENT;\n                                d.value = Number.parseFloat(value.substring(0, value.length - 2));\n                            }\n                            else if (value.endsWith('%')) {\n                                d.type = Animation.RELATIVE_TO_SELF;\n                                d.value = Number.parseFloat(value.substring(0, value.length - 1));\n                            }\n                            else {\n                                d.type = Animation.ABSOLUTE;\n                                d.value = TypedValue.complexToDimensionPixelSize(value);\n                            }\n                        }\n                        d.type = Animation.ABSOLUTE;\n                        d.value = 0.0;\n                        return d;\n                    }\n                }\n                Animation.Description = Description;\n            })(Animation = animation_1.Animation || (animation_1.Animation = {}));\n        })(animation = view.animation || (view.animation = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var R;\n    (function (R) {\n        class attr {\n        }\n        attr.textViewStyle = new Map()\n            .set('android:textSize', '14sp')\n            .set('android:layerType', 'software')\n            .set('android:textColor', '@android:color/textView_textColor')\n            .set('android:textColorHint', '#ff808080');\n        attr.buttonStyle = new Map(attr.textViewStyle)\n            .set('android:background', '@android:drawable/btn_default')\n            .set('android:focusable', 'true')\n            .set('android:clickable', 'true')\n            .set('android:minHeight', '48dp')\n            .set('android:minWidth', '64dp')\n            .set('android:textSize', '18sp')\n            .set('android:gravity', 'center');\n        attr.editTextStyle = new Map(attr.textViewStyle)\n            .set('android:background', '@android:drawable/editbox_background')\n            .set('android:focusable', 'true')\n            .set('android:focusableInTouchMode', 'true')\n            .set('android:clickable', 'true')\n            .set('android:textSize', '18sp')\n            .set('android:gravity', 'center_vertical');\n        attr.imageButtonStyle = new Map()\n            .set('android:background', '@android:drawable/btn_default')\n            .set('android:focusable', 'true')\n            .set('android:clickable', 'true')\n            .set('android:gravity', 'center');\n        attr.checkboxStyle = new Map(attr.buttonStyle)\n            .set('android:background', '@null')\n            .set('android:button', '@android:drawable/btn_check');\n        attr.radiobuttonStyle = new Map(attr.buttonStyle)\n            .set('android:background', '@null')\n            .set('android:button', '@android:drawable/btn_radio');\n        attr.checkedTextViewStyle = new Map()\n            .set('android:textAlignment', 'viewStart');\n        attr.progressBarStyle = new Map()\n            .set('android:indeterminateOnly', 'true')\n            .set('android:indeterminateDrawable', '@android:drawable/progress_medium_holo')\n            .set('android:indeterminateBehavior', 'repeat')\n            .set('android:indeterminateDuration', '3500')\n            .set('android:minWidth', '48dp')\n            .set('android:maxWidth', '48dp')\n            .set('android:minHeight', '48dp')\n            .set('android:maxHeight', '48dp')\n            .set('android:mirrorForRtl', 'false');\n        attr.progressBarStyleHorizontal = new Map()\n            .set('android:indeterminateOnly', 'false')\n            .set('android:progressDrawable', '@android:drawable/progress_horizontal_holo')\n            .set('android:indeterminateDrawable', '@android:drawable/progress_indeterminate_horizontal_holo')\n            .set('android:indeterminateBehavior', 'repeat')\n            .set('android:indeterminateDuration', '3500')\n            .set('android:minHeight', '20dp')\n            .set('android:maxHeight', '20dp')\n            .set('android:mirrorForRtl', 'true');\n        attr.progressBarStyleSmall = new Map(attr.progressBarStyle)\n            .set('android:indeterminateDrawable', '@android:drawable/progress_small_holo')\n            .set('android:minWidth', '16dp')\n            .set('android:maxWidth', '16dp')\n            .set('android:minHeight', '16dp')\n            .set('android:maxHeight', '16dp');\n        attr.progressBarStyleLarge = new Map(attr.progressBarStyle)\n            .set('android:indeterminateDrawable', '@android:drawable/progress_large_holo')\n            .set('android:minWidth', '76dp')\n            .set('android:maxWidth', '76dp')\n            .set('android:minHeight', '76dp')\n            .set('android:maxHeight', '76dp');\n        attr.seekBarStyle = new Map()\n            .set('android:indeterminateOnly', 'false')\n            .set('android:progressDrawable', '@android:drawable/scrubber_progress_horizontal_holo_light')\n            .set('android:indeterminateDrawable', '@android:drawable/scrubber_progress_horizontal_holo_light')\n            .set('android:minHeight', '13dp')\n            .set('android:maxHeight', '13dp')\n            .set('android:thumb', '@android:drawable/scrubber_control_selector_holo')\n            .set('android:thumbOffset', '16dp')\n            .set('android:focusable', 'true')\n            .set('android:paddingLeft', '16dp')\n            .set('android:paddingRight', '16dp')\n            .set('android:mirrorForRtl', 'true');\n        attr.ratingBarStyle = new Map()\n            .set('android:indeterminateOnly', 'false')\n            .set('android:progressDrawable', '@android:drawable/ratingbar_full_holo_light')\n            .set('android:indeterminateDrawable', '@android:drawable/ratingbar_full_holo_light')\n            .set('android:minHeight', '48dip')\n            .set('android:maxHeight', '48dip')\n            .set('android:numStars', '5')\n            .set('android:stepSize', '0.5')\n            .set('android:thumb', '@null')\n            .set('android:mirrorForRtl', 'true');\n        attr.ratingBarStyleIndicator = new Map(attr.ratingBarStyle)\n            .set('android:indeterminateOnly', 'false')\n            .set('android:progressDrawable', '@android:drawable/ratingbar_holo_light')\n            .set('android:indeterminateDrawable', '@android:drawable/ratingbar_holo_light')\n            .set('android:minHeight', '35dip')\n            .set('android:maxHeight', '35dip')\n            .set('android:thumb', '@null')\n            .set('android:isIndicator', 'true');\n        attr.ratingBarStyleSmall = new Map(attr.ratingBarStyle)\n            .set('android:indeterminateOnly', 'false')\n            .set('android:progressDrawable', '@android:drawable/ratingbar_small_holo_light')\n            .set('android:indeterminateDrawable', '@android:drawable/ratingbar_small_holo_light')\n            .set('android:minHeight', '16dip')\n            .set('android:maxHeight', '16dip')\n            .set('android:thumb', '@null')\n            .set('android:isIndicator', 'true');\n        attr.absListViewStyle = new Map()\n            .set('android:scrollbars', 'vertical')\n            .set('android:fadingEdge', 'vertical');\n        attr.gridViewStyle = new Map(attr.absListViewStyle)\n            .set('android:listSelector', '@android:drawable/list_selector_background')\n            .set('android:numColumns', '1');\n        attr.listViewStyle = new Map(attr.absListViewStyle)\n            .set('android:divider', '@android:drawable/list_divider')\n            .set('android:listSelector', '@android:drawable/list_selector_background')\n            .set('android:dividerHeight', '1');\n        attr.expandableListViewStyle = new Map(attr.listViewStyle)\n            .set('android:childDivider', '@android:drawable/list_divider');\n        attr.numberPickerStyle = new Map()\n            .set('android:orientation', 'vertical')\n            .set('android:solidColor', 'transparent')\n            .set('android:selectionDivider', '#cc33b5e5')\n            .set('android:selectionDividerHeight', '2dp')\n            .set('android:selectionDividersDistance', '48dp')\n            .set('android:internalMinWidth', '64dp')\n            .set('android:internalMaxHeight', '180dp')\n            .set('android:virtualButtonPressedDrawable', '@android:drawable/item_background');\n        attr.popupWindowStyle = new Map()\n            .set('android:popupBackground', '@android:drawable/dropdown_background_dark')\n            .set('android:popupEnterAnimation', '@android:anim/grow_fade_in_center')\n            .set('android:popupExitAnimation', '@android:anim/shrink_fade_out_center');\n        attr.listPopupWindowStyle = new Map()\n            .set('android:popupBackground', '@android:drawable/menu_panel_holo_light')\n            .set('android:popupEnterAnimation', '@android:anim/grow_fade_in_center')\n            .set('android:popupExitAnimation', '@android:anim/shrink_fade_out_center');\n        attr.popupMenuStyle = new Map()\n            .set('android:popupBackground', '@android:drawable/menu_panel_holo_dark');\n        attr.dropDownListViewStyle = new Map(attr.listViewStyle);\n        attr.spinnerStyle = new Map()\n            .set('android:clickable', 'true')\n            .set('android:spinnerMode', 'dropdown')\n            .set('android:gravity', 'start|center_vertical')\n            .set('android:disableChildrenWhenDisabled', 'true')\n            .set('android:background', '@android:drawable/btn_default')\n            .set('android:popupBackground', '@android:drawable/menu_panel_holo_light')\n            .set('android:dropDownVerticalOffset', '0dp')\n            .set('android:dropDownHorizontalOffset', '0dp')\n            .set('android:dropDownWidth', 'wrap_content');\n        attr.actionBarStyle = new Map()\n            .set('android:background', '#ff333333');\n        attr.scrollViewStyle = new Map()\n            .set('android:scrollbars', 'vertical')\n            .set('android:fadingEdge', 'vertical');\n        R.attr = attr;\n    })(R = android.R || (android.R = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view_1) {\n        var LayoutDirection = android.util.LayoutDirection;\n        var ColorDrawable = android.graphics.drawable.ColorDrawable;\n        var ScrollBarDrawable = android.graphics.drawable.ScrollBarDrawable;\n        var InsetDrawable = android.graphics.drawable.InsetDrawable;\n        var ShadowDrawable = android.graphics.drawable.ShadowDrawable;\n        var RoundRectDrawable = android.graphics.drawable.RoundRectDrawable;\n        var PixelFormat = android.graphics.PixelFormat;\n        var Matrix = android.graphics.Matrix;\n        var Paint = android.graphics.Paint;\n        var StringBuilder = java.lang.StringBuilder;\n        var JavaObject = java.lang.JavaObject;\n        var System = java.lang.System;\n        var SystemClock = android.os.SystemClock;\n        var Log = android.util.Log;\n        var Rect = android.graphics.Rect;\n        var RectF = android.graphics.RectF;\n        var Point = android.graphics.Point;\n        var Canvas = android.graphics.Canvas;\n        var CopyOnWriteArrayList = java.lang.util.concurrent.CopyOnWriteArrayList;\n        var ArrayList = java.util.ArrayList;\n        var Resources = android.content.res.Resources;\n        var Pools = android.util.Pools;\n        var LinearInterpolator = android.view.animation.LinearInterpolator;\n        var AnimationUtils = android.view.animation.AnimationUtils;\n        var AttrBinder = androidui.attr.AttrBinder;\n        var KeyEvent = android.view.KeyEvent;\n        var Animation = android.view.animation.Animation;\n        var Transformation = android.view.animation.Transformation;\n        class View extends JavaObject {\n            constructor(context, bindElement, defStyleAttr) {\n                super();\n                this.mPrivateFlags = 0;\n                this.mPrivateFlags2 = 0;\n                this.mPrivateFlags3 = 0;\n                this.mCurrentAnimation = null;\n                this.mOldWidthMeasureSpec = Number.MIN_SAFE_INTEGER;\n                this.mOldHeightMeasureSpec = Number.MIN_SAFE_INTEGER;\n                this.mMeasuredWidth = 0;\n                this.mMeasuredHeight = 0;\n                this.mBackgroundSizeChanged = false;\n                this.mBackgroundWidth = 0;\n                this.mBackgroundHeight = 0;\n                this.mHasPerformedLongPress = false;\n                this.mMinWidth = 0;\n                this.mMinHeight = 0;\n                this.mDrawingCacheBackgroundColor = 0;\n                this.mTouchSlop = 0;\n                this.mVerticalScrollFactor = 0;\n                this.mOverScrollMode = View.OVER_SCROLL_IF_CONTENT_SCROLLS;\n                this.mViewFlags = 0;\n                this.mLayerType = View.LAYER_TYPE_NONE;\n                this.mCachingFailed = false;\n                this.mWindowAttachCount = 0;\n                this.mTransientStateCount = 0;\n                this.mLastIsOpaque = false;\n                this._mLeft = 0;\n                this._mRight = 0;\n                this._mTop = 0;\n                this._mBottom = 0;\n                this._mScrollX = 0;\n                this._mScrollY = 0;\n                this.mPaddingLeft = 0;\n                this.mPaddingRight = 0;\n                this.mPaddingTop = 0;\n                this.mPaddingBottom = 0;\n                this.mCornerRadiusTopLeft = 0;\n                this.mCornerRadiusTopRight = 0;\n                this.mCornerRadiusBottomRight = 0;\n                this.mCornerRadiusBottomLeft = 0;\n                this._stateAttrList = new androidui.attr.StateAttrList(this);\n                this._attrBinder = new AttrBinder(this);\n                this.mContext = context;\n                this.mTouchSlop = view_1.ViewConfiguration.get().getScaledTouchSlop();\n                this.initBindAttr();\n                this.initBindElement(bindElement);\n                const a = context.obtainStyledAttributes(bindElement, defStyleAttr);\n                let background = null;\n                let leftPadding = -1;\n                let topPadding = -1;\n                let rightPadding = -1;\n                let bottomPadding = -1;\n                let padding = -1;\n                let viewFlagValues = 0;\n                let viewFlagMasks = 0;\n                let setScrollContainer = false;\n                let x = 0;\n                let y = 0;\n                let tx = 0;\n                let ty = 0;\n                let rotation = 0;\n                let rotationX = 0;\n                let rotationY = 0;\n                let sx = 1;\n                let sy = 1;\n                let transformSet = false;\n                let overScrollMode = this.mOverScrollMode;\n                let initializeScrollbars = false;\n                for (let attr of a.getLowerCaseNoNamespaceAttrNames()) {\n                    switch (attr) {\n                        case 'background':\n                            background = a.getDrawable(attr);\n                            break;\n                        case 'padding':\n                            padding = a.getDimensionPixelSize(attr, -1);\n                            break;\n                        case 'paddingleft':\n                            leftPadding = a.getDimensionPixelSize(attr, -1);\n                            break;\n                        case 'paddingtop':\n                            topPadding = a.getDimensionPixelSize(attr, -1);\n                            break;\n                        case 'paddingright':\n                            rightPadding = a.getDimensionPixelSize(attr, -1);\n                            break;\n                        case 'paddingbottom':\n                            bottomPadding = a.getDimensionPixelSize(attr, -1);\n                            break;\n                        case 'paddingstart':\n                            leftPadding = a.getDimensionPixelSize(attr, -1);\n                            break;\n                        case 'paddingend':\n                            rightPadding = a.getDimensionPixelSize(attr, -1);\n                            break;\n                        case 'scrollx':\n                            x = a.getDimensionPixelOffset(attr, 0);\n                            break;\n                        case 'scrolly':\n                            y = a.getDimensionPixelOffset(attr, 0);\n                            break;\n                        case 'alpha':\n                            this.setAlpha(a.getFloat(attr, 1));\n                            break;\n                        case 'transformpivotx':\n                            this.setPivotX(a.getDimensionPixelOffset(attr, 0));\n                            break;\n                        case 'transformpivoty':\n                            this.setPivotY(a.getDimensionPixelOffset(attr, 0));\n                            break;\n                        case 'translationx':\n                            tx = a.getDimensionPixelOffset(attr, 0);\n                            transformSet = true;\n                            break;\n                        case 'translationy':\n                            ty = a.getDimensionPixelOffset(attr, 0);\n                            transformSet = true;\n                            break;\n                        case 'rotation':\n                            rotation = a.getFloat(attr, 0);\n                            transformSet = true;\n                            break;\n                        case 'rotationx':\n                            rotationX = a.getFloat(attr, 0);\n                            transformSet = true;\n                            break;\n                        case 'rotationy':\n                            rotationY = a.getFloat(attr, 0);\n                            transformSet = true;\n                            break;\n                        case 'scalex':\n                            sx = a.getFloat(attr, 1);\n                            transformSet = true;\n                            break;\n                        case 'scaley':\n                            sy = a.getFloat(attr, 1);\n                            transformSet = true;\n                            break;\n                        case 'id':\n                            this.mID = a.getString(attr);\n                            break;\n                        case 'tag':\n                            this.mTag = a.getText(attr);\n                            break;\n                        case 'fitssystemwindows':\n                            break;\n                        case 'focusable':\n                            if (a.getBoolean(attr, false)) {\n                                viewFlagValues |= View.FOCUSABLE;\n                                viewFlagMasks |= View.FOCUSABLE_MASK;\n                            }\n                            break;\n                        case 'focusableintouchmode':\n                            if (a.getBoolean(attr, false)) {\n                                viewFlagValues |= View.FOCUSABLE_IN_TOUCH_MODE | View.FOCUSABLE;\n                                viewFlagMasks |= View.FOCUSABLE_IN_TOUCH_MODE | View.FOCUSABLE_MASK;\n                            }\n                            break;\n                        case 'clickable':\n                            if (a.getBoolean(attr, false)) {\n                                viewFlagValues |= View.CLICKABLE;\n                                viewFlagMasks |= View.CLICKABLE;\n                            }\n                            break;\n                        case 'longclickable':\n                            if (a.getBoolean(attr, false)) {\n                                viewFlagValues |= View.LONG_CLICKABLE;\n                                viewFlagMasks |= View.LONG_CLICKABLE;\n                            }\n                            break;\n                        case 'saveenabled':\n                            break;\n                        case 'duplicateparentstate':\n                            if (a.getBoolean(attr, false)) {\n                                viewFlagValues |= View.DUPLICATE_PARENT_STATE;\n                                viewFlagMasks |= View.DUPLICATE_PARENT_STATE;\n                            }\n                            break;\n                        case 'visibility':\n                            const visibility = a.getAttrValue(attr);\n                            if (visibility === 'gone') {\n                                viewFlagValues |= View.GONE;\n                                viewFlagMasks |= View.VISIBILITY_MASK;\n                            }\n                            else if (visibility === 'invisible') {\n                                viewFlagValues |= View.INVISIBLE;\n                                viewFlagMasks |= View.VISIBILITY_MASK;\n                            }\n                            else if (visibility === 'visible') {\n                                viewFlagValues |= View.VISIBLE;\n                                viewFlagMasks |= View.VISIBILITY_MASK;\n                            }\n                            break;\n                        case 'layoutdirection':\n                            break;\n                        case 'drawingcachequality':\n                            break;\n                        case 'contentdescription':\n                            break;\n                        case 'labelfor':\n                            break;\n                        case 'soundeffectsenabled':\n                            break;\n                        case 'hapticfeedbackenabled':\n                            break;\n                        case 'scrollbars':\n                            const scrollbars = a.getAttrValue(attr);\n                            if (scrollbars === 'horizontal') {\n                                viewFlagValues |= View.SCROLLBARS_HORIZONTAL;\n                                viewFlagMasks |= View.SCROLLBARS_MASK;\n                                initializeScrollbars = true;\n                            }\n                            else if (scrollbars === 'vertical') {\n                                viewFlagValues |= View.SCROLLBARS_VERTICAL;\n                                viewFlagMasks |= View.SCROLLBARS_MASK;\n                                initializeScrollbars = true;\n                            }\n                            break;\n                        case 'fadingedge':\n                        case 'requiresfadingedge':\n                            break;\n                        case 'scrollbarstyle':\n                            break;\n                        case 'isscrollcontainer':\n                            setScrollContainer = true;\n                            if (a.getBoolean(attr, false)) {\n                                this.setScrollContainer(true);\n                            }\n                            break;\n                        case 'keepscreenon':\n                            break;\n                        case 'filtertoucheswhenobscured':\n                            break;\n                        case 'nextfocusleft':\n                            this.mNextFocusLeftId = a.getResourceId(attr, View.NO_ID);\n                            break;\n                        case 'nextfocusright':\n                            this.mNextFocusRightId = a.getResourceId(attr, View.NO_ID);\n                            break;\n                        case 'nextfocusup':\n                            this.mNextFocusUpId = a.getResourceId(attr, View.NO_ID);\n                            break;\n                        case 'nextfocusdown':\n                            this.mNextFocusDownId = a.getResourceId(attr, View.NO_ID);\n                            break;\n                        case 'nextfocusforward':\n                            this.mNextFocusForwardId = a.getResourceId(attr, View.NO_ID);\n                            break;\n                        case 'minwidth':\n                            this.mMinWidth = a.getDimensionPixelSize(attr, 0);\n                            break;\n                        case 'minheight':\n                            this.mMinHeight = a.getDimensionPixelSize(attr, 0);\n                            break;\n                        case 'onclick':\n                            this.setOnClickListenerByAttrValueString(a.getString(attr));\n                            break;\n                        case 'overscrollmode':\n                            let scrollMode = View[('OVER_SCROLL_' + a.getAttrValue(attr)).toUpperCase()];\n                            overScrollMode = scrollMode || View.OVER_SCROLL_IF_CONTENT_SCROLLS;\n                            break;\n                        case 'verticalscrollbarposition':\n                            break;\n                        case 'layertype':\n                            if ((a.getAttrValue(attr) + '').toLowerCase() == 'software') {\n                                this.setLayerType(View.LAYER_TYPE_SOFTWARE);\n                            }\n                            else {\n                                this.setLayerType(View.LAYER_TYPE_NONE);\n                            }\n                            break;\n                        case 'textdirection':\n                            break;\n                        case 'textalignment':\n                            break;\n                        case 'importantforaccessibility':\n                            break;\n                        case 'accessibilityliveregion':\n                            break;\n                        case 'cornerradius':\n                        case 'cornerradiustopleft':\n                        case 'cornerradiustopright':\n                        case 'cornerradiusbottomleft':\n                        case 'cornerradiusbottomright':\n                        case 'viewshadowcolor':\n                        case 'viewshadowdx':\n                        case 'viewshadowdy':\n                        case 'viewshadowradius':\n                            this._attrBinder.onAttrChange(attr, a.getAttrValue(attr), this.getContext());\n                            break;\n                        default:\n                            if (attr && attr.startsWith('state_')) {\n                                this._stateAttrList.addStatedAttr(attr, a.getAttrValue(attr));\n                            }\n                    }\n                }\n                this.setOverScrollMode(overScrollMode);\n                if (background != null) {\n                    this.setBackground(background);\n                }\n                if (padding >= 0) {\n                    leftPadding = padding;\n                    topPadding = padding;\n                    rightPadding = padding;\n                    bottomPadding = padding;\n                }\n                this.setPadding(leftPadding >= 0 ? leftPadding : this.mPaddingLeft, topPadding >= 0 ? topPadding : this.mPaddingTop, rightPadding >= 0 ? rightPadding : this.mPaddingRight, bottomPadding >= 0 ? bottomPadding : this.mPaddingBottom);\n                if (viewFlagMasks != 0) {\n                    this.setFlags(viewFlagValues, viewFlagMasks);\n                }\n                if (initializeScrollbars) {\n                    this.initializeScrollbars(a);\n                }\n                a.recycle();\n                if (x != 0 || y != 0) {\n                    scrollTo(x, y);\n                }\n                if (transformSet) {\n                    this.setTranslationX(tx);\n                    this.setTranslationY(ty);\n                    this.setRotation(rotation);\n                    this.setRotationX(rotationX);\n                    this.setRotationY(rotationY);\n                    this.setScaleX(sx);\n                    this.setScaleY(sy);\n                }\n                if (!setScrollContainer && (viewFlagValues & View.SCROLLBARS_VERTICAL) != 0) {\n                    this.setScrollContainer(true);\n                }\n                this.computeOpaqueFlags();\n            }\n            get mLeft() {\n                return this._mLeft;\n            }\n            set mLeft(value) {\n                this._mLeft = Math.floor(value);\n                this.requestSyncBoundToElement();\n            }\n            get mRight() {\n                return this._mRight;\n            }\n            set mRight(value) {\n                this._mRight = Math.floor(value);\n                this.requestSyncBoundToElement();\n            }\n            get mTop() {\n                return this._mTop;\n            }\n            set mTop(value) {\n                if (Number.isNaN(value)) {\n                    debugger;\n                }\n                this._mTop = Math.floor(value);\n                this.requestSyncBoundToElement();\n            }\n            get mBottom() {\n                return this._mBottom;\n            }\n            set mBottom(value) {\n                this._mBottom = Math.floor(value);\n                this.requestSyncBoundToElement();\n            }\n            get mScrollX() {\n                return this._mScrollX;\n            }\n            set mScrollX(value) {\n                this._mScrollX = Math.floor(value);\n                this.requestSyncBoundToElement();\n            }\n            get mScrollY() {\n                return this._mScrollY;\n            }\n            set mScrollY(value) {\n                this._mScrollY = Math.floor(value);\n                this.requestSyncBoundToElement();\n            }\n            getContext() {\n                return this.mContext;\n            }\n            getWidth() {\n                return this.mRight - this.mLeft;\n            }\n            getHeight() {\n                return this.mBottom - this.mTop;\n            }\n            getPaddingLeft() {\n                return this.mPaddingLeft;\n            }\n            getPaddingTop() {\n                return this.mPaddingTop;\n            }\n            getPaddingRight() {\n                return this.mPaddingRight;\n            }\n            getPaddingBottom() {\n                return this.mPaddingBottom;\n            }\n            setPaddingLeft(left) {\n                if (this.mPaddingLeft != left) {\n                    this.mPaddingLeft = left;\n                    this.requestLayout();\n                }\n            }\n            setPaddingTop(top) {\n                if (this.mPaddingTop != top) {\n                    this.mPaddingTop = top;\n                    this.requestLayout();\n                }\n            }\n            setPaddingRight(right) {\n                if (this.mPaddingRight != right) {\n                    this.mPaddingRight = right;\n                    this.requestLayout();\n                }\n            }\n            setPaddingBottom(bottom) {\n                if (this.mPaddingBottom != bottom) {\n                    this.mPaddingBottom = bottom;\n                    this.requestLayout();\n                }\n            }\n            setPadding(left, top, right, bottom) {\n                let changed = false;\n                if (this.mPaddingLeft != left) {\n                    changed = true;\n                    this.mPaddingLeft = left;\n                }\n                if (this.mPaddingTop != top) {\n                    changed = true;\n                    this.mPaddingTop = top;\n                }\n                if (this.mPaddingRight != right) {\n                    changed = true;\n                    this.mPaddingRight = right;\n                }\n                if (this.mPaddingBottom != bottom) {\n                    changed = true;\n                    this.mPaddingBottom = bottom;\n                }\n                if (changed) {\n                    this.requestLayout();\n                }\n            }\n            resolvePadding() {\n            }\n            setScrollX(value) {\n                this.scrollTo(value, this.mScrollY);\n            }\n            setScrollY(value) {\n                this.scrollTo(this.mScrollX, value);\n            }\n            getScrollX() {\n                return this.mScrollX;\n            }\n            getScrollY() {\n                return this.mScrollY;\n            }\n            offsetTopAndBottom(offset) {\n                if (offset != 0) {\n                    this.updateMatrix();\n                    const matrixIsIdentity = this.mTransformationInfo == null || this.mTransformationInfo.mMatrixIsIdentity;\n                    if (matrixIsIdentity) {\n                        const p = this.mParent;\n                        if (p != null && this.mAttachInfo != null) {\n                            const r = this.mAttachInfo.mTmpInvalRect;\n                            let minTop;\n                            let maxBottom;\n                            let yLoc;\n                            if (offset < 0) {\n                                minTop = this.mTop + offset;\n                                maxBottom = this.mBottom;\n                                yLoc = offset;\n                            }\n                            else {\n                                minTop = this.mTop;\n                                maxBottom = this.mBottom + offset;\n                                yLoc = 0;\n                            }\n                            r.set(0, yLoc, this.mRight - this.mLeft, maxBottom - minTop);\n                            p.invalidateChild(this, r);\n                        }\n                    }\n                    else {\n                        this.invalidateViewProperty(false, false);\n                    }\n                    this.mTop += offset;\n                    this.mBottom += offset;\n                    if (!matrixIsIdentity) {\n                        this.invalidateViewProperty(false, true);\n                    }\n                    this.invalidateParentIfNeeded();\n                }\n            }\n            offsetLeftAndRight(offset) {\n                if (offset != 0) {\n                    this.updateMatrix();\n                    const matrixIsIdentity = this.mTransformationInfo == null || this.mTransformationInfo.mMatrixIsIdentity;\n                    if (matrixIsIdentity) {\n                        const p = this.mParent;\n                        if (p != null && this.mAttachInfo != null) {\n                            const r = this.mAttachInfo.mTmpInvalRect;\n                            let minLeft;\n                            let maxRight;\n                            if (offset < 0) {\n                                minLeft = this.mLeft + offset;\n                                maxRight = this.mRight;\n                            }\n                            else {\n                                minLeft = this.mLeft;\n                                maxRight = this.mRight + offset;\n                            }\n                            r.set(0, 0, maxRight - minLeft, this.mBottom - this.mTop);\n                            p.invalidateChild(this, r);\n                        }\n                    }\n                    else {\n                        this.invalidateViewProperty(false, false);\n                    }\n                    this.mLeft += offset;\n                    this.mRight += offset;\n                    if (!matrixIsIdentity) {\n                        this.invalidateViewProperty(false, true);\n                    }\n                    this.invalidateParentIfNeeded();\n                }\n            }\n            getMatrix() {\n                if (this.mTransformationInfo != null) {\n                    this.updateMatrix();\n                    return this.mTransformationInfo.mMatrix;\n                }\n                return Matrix.IDENTITY_MATRIX;\n            }\n            hasIdentityMatrix() {\n                if (this.mTransformationInfo != null) {\n                    this.updateMatrix();\n                    return this.mTransformationInfo.mMatrixIsIdentity;\n                }\n                return true;\n            }\n            ensureTransformationInfo() {\n                if (this.mTransformationInfo == null) {\n                    this.mTransformationInfo = new View.TransformationInfo();\n                }\n            }\n            updateMatrix() {\n                const info = this.mTransformationInfo;\n                if (info == null) {\n                    this._syncMatrixToElement();\n                    return;\n                }\n                if (info.mMatrixDirty) {\n                    if ((this.mPrivateFlags & View.PFLAG_PIVOT_EXPLICITLY_SET) == 0) {\n                        if ((this.mRight - this.mLeft) != info.mPrevWidth || (this.mBottom - this.mTop) != info.mPrevHeight) {\n                            info.mPrevWidth = this.mRight - this.mLeft;\n                            info.mPrevHeight = this.mBottom - this.mTop;\n                            info.mPivotX = info.mPrevWidth / 2;\n                            info.mPivotY = info.mPrevHeight / 2;\n                        }\n                    }\n                    info.mMatrix.reset();\n                    info.mMatrix.setTranslate(info.mTranslationX, info.mTranslationY);\n                    info.mMatrix.preRotate(info.mRotation, info.mPivotX, info.mPivotY);\n                    info.mMatrix.preScale(info.mScaleX, info.mScaleY, info.mPivotX, info.mPivotY);\n                    info.mMatrixDirty = false;\n                    info.mMatrixIsIdentity = info.mMatrix.isIdentity();\n                    info.mInverseMatrixDirty = true;\n                }\n                this._syncMatrixToElement();\n            }\n            getRotation() {\n                return this.mTransformationInfo != null ? this.mTransformationInfo.mRotation : 0;\n            }\n            setRotation(rotation) {\n                this.ensureTransformationInfo();\n                const info = this.mTransformationInfo;\n                if (info.mRotation != rotation) {\n                    this.invalidateViewProperty(true, false);\n                    info.mRotation = rotation;\n                    info.mMatrixDirty = true;\n                    this.invalidateViewProperty(false, true);\n                    if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                        this.invalidateParentIfNeeded();\n                    }\n                }\n            }\n            getRotationY() {\n                return 0;\n            }\n            setRotationY(rotationY) {\n            }\n            getRotationX() {\n                return 0;\n            }\n            setRotationX(rotationX) {\n            }\n            getScaleX() {\n                return this.mTransformationInfo != null ? this.mTransformationInfo.mScaleX : 1;\n            }\n            setScaleX(scaleX) {\n                this.ensureTransformationInfo();\n                const info = this.mTransformationInfo;\n                if (info.mScaleX != scaleX) {\n                    this.invalidateViewProperty(true, false);\n                    info.mScaleX = scaleX;\n                    info.mMatrixDirty = true;\n                    this.invalidateViewProperty(false, true);\n                    if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                        this.invalidateParentIfNeeded();\n                    }\n                }\n            }\n            getScaleY() {\n                return this.mTransformationInfo != null ? this.mTransformationInfo.mScaleY : 1;\n            }\n            setScaleY(scaleY) {\n                this.ensureTransformationInfo();\n                const info = this.mTransformationInfo;\n                if (info.mScaleY != scaleY) {\n                    this.invalidateViewProperty(true, false);\n                    info.mScaleY = scaleY;\n                    info.mMatrixDirty = true;\n                    this.invalidateViewProperty(false, true);\n                    if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                        this.invalidateParentIfNeeded();\n                    }\n                }\n            }\n            getPivotX() {\n                return this.mTransformationInfo != null ? this.mTransformationInfo.mPivotX : 0;\n            }\n            setPivotX(pivotX) {\n                this.ensureTransformationInfo();\n                const info = this.mTransformationInfo;\n                let pivotSet = (this.mPrivateFlags & View.PFLAG_PIVOT_EXPLICITLY_SET) == View.PFLAG_PIVOT_EXPLICITLY_SET;\n                if (info.mPivotX != pivotX || !pivotSet) {\n                    this.mPrivateFlags |= View.PFLAG_PIVOT_EXPLICITLY_SET;\n                    this.invalidateViewProperty(true, false);\n                    info.mPivotX = pivotX;\n                    info.mMatrixDirty = true;\n                    this.invalidateViewProperty(false, true);\n                    if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                        this.invalidateParentIfNeeded();\n                    }\n                }\n            }\n            getPivotY() {\n                return this.mTransformationInfo != null ? this.mTransformationInfo.mPivotY : 0;\n            }\n            setPivotY(pivotY) {\n                this.ensureTransformationInfo();\n                const info = this.mTransformationInfo;\n                let pivotSet = (this.mPrivateFlags & View.PFLAG_PIVOT_EXPLICITLY_SET) == View.PFLAG_PIVOT_EXPLICITLY_SET;\n                if (info.mPivotY != pivotY || !pivotSet) {\n                    this.mPrivateFlags |= View.PFLAG_PIVOT_EXPLICITLY_SET;\n                    this.invalidateViewProperty(true, false);\n                    info.mPivotY = pivotY;\n                    info.mMatrixDirty = true;\n                    this.invalidateViewProperty(false, true);\n                    if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                        this.invalidateParentIfNeeded();\n                    }\n                }\n            }\n            getAlpha() {\n                return this.mTransformationInfo != null ? this.mTransformationInfo.mAlpha : 1;\n            }\n            hasOverlappingRendering() {\n                return true;\n            }\n            setAlpha(alpha) {\n                this.ensureTransformationInfo();\n                if (this.mTransformationInfo.mAlpha != alpha) {\n                    this.mTransformationInfo.mAlpha = alpha;\n                    if (this.onSetAlpha(Math.floor((alpha * 255)))) {\n                        this.mPrivateFlags |= View.PFLAG_ALPHA_SET;\n                        this.invalidateParentCaches();\n                        this.invalidate(true);\n                    }\n                    else {\n                        this.mPrivateFlags &= ~View.PFLAG_ALPHA_SET;\n                        this.invalidateViewProperty(true, false);\n                    }\n                }\n            }\n            setAlphaNoInvalidation(alpha) {\n                this.ensureTransformationInfo();\n                if (this.mTransformationInfo.mAlpha != alpha) {\n                    this.mTransformationInfo.mAlpha = alpha;\n                    let subclassHandlesAlpha = this.onSetAlpha(Math.floor((alpha * 255)));\n                    if (subclassHandlesAlpha) {\n                        this.mPrivateFlags |= View.PFLAG_ALPHA_SET;\n                        return true;\n                    }\n                    else {\n                        this.mPrivateFlags &= ~View.PFLAG_ALPHA_SET;\n                    }\n                }\n                return false;\n            }\n            setTransitionAlpha(alpha) {\n                this.ensureTransformationInfo();\n                if (this.mTransformationInfo.mTransitionAlpha != alpha) {\n                    this.mTransformationInfo.mTransitionAlpha = alpha;\n                    this.mPrivateFlags &= ~View.PFLAG_ALPHA_SET;\n                    this.invalidateViewProperty(true, false);\n                }\n            }\n            getFinalAlpha() {\n                if (this.mTransformationInfo != null) {\n                    return this.mTransformationInfo.mAlpha * this.mTransformationInfo.mTransitionAlpha;\n                }\n                return 1;\n            }\n            getTransitionAlpha() {\n                return this.mTransformationInfo != null ? this.mTransformationInfo.mTransitionAlpha : 1;\n            }\n            getTop() {\n                return this.mTop;\n            }\n            setTop(top) {\n                if (top != this.mTop) {\n                    this.updateMatrix();\n                    const matrixIsIdentity = this.mTransformationInfo == null || this.mTransformationInfo.mMatrixIsIdentity;\n                    if (matrixIsIdentity) {\n                        if (this.mAttachInfo != null) {\n                            let minTop;\n                            let yLoc;\n                            if (top < this.mTop) {\n                                minTop = top;\n                                yLoc = top - this.mTop;\n                            }\n                            else {\n                                minTop = this.mTop;\n                                yLoc = 0;\n                            }\n                            this.invalidate(0, yLoc, this.mRight - this.mLeft, this.mBottom - minTop);\n                        }\n                    }\n                    else {\n                        this.invalidate(true);\n                    }\n                    let width = this.mRight - this.mLeft;\n                    let oldHeight = this.mBottom - this.mTop;\n                    this.mTop = top;\n                    this.sizeChange(width, this.mBottom - this.mTop, width, oldHeight);\n                    if (!matrixIsIdentity) {\n                        if ((this.mPrivateFlags & View.PFLAG_PIVOT_EXPLICITLY_SET) == 0) {\n                            this.mTransformationInfo.mMatrixDirty = true;\n                        }\n                        this.mPrivateFlags |= View.PFLAG_DRAWN;\n                        this.invalidate(true);\n                    }\n                    this.mBackgroundSizeChanged = true;\n                    this.invalidateParentIfNeeded();\n                    if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                        this.invalidateParentIfNeeded();\n                    }\n                }\n            }\n            getBottom() {\n                return this.mBottom;\n            }\n            isDirty() {\n                return (this.mPrivateFlags & View.PFLAG_DIRTY_MASK) != 0;\n            }\n            setBottom(bottom) {\n                if (bottom != this.mBottom) {\n                    this.updateMatrix();\n                    const matrixIsIdentity = this.mTransformationInfo == null || this.mTransformationInfo.mMatrixIsIdentity;\n                    if (matrixIsIdentity) {\n                        if (this.mAttachInfo != null) {\n                            let maxBottom;\n                            if (bottom < this.mBottom) {\n                                maxBottom = this.mBottom;\n                            }\n                            else {\n                                maxBottom = bottom;\n                            }\n                            this.invalidate(0, 0, this.mRight - this.mLeft, maxBottom - this.mTop);\n                        }\n                    }\n                    else {\n                        this.invalidate(true);\n                    }\n                    let width = this.mRight - this.mLeft;\n                    let oldHeight = this.mBottom - this.mTop;\n                    this.mBottom = bottom;\n                    this.sizeChange(width, this.mBottom - this.mTop, width, oldHeight);\n                    if (!matrixIsIdentity) {\n                        if ((this.mPrivateFlags & View.PFLAG_PIVOT_EXPLICITLY_SET) == 0) {\n                            this.mTransformationInfo.mMatrixDirty = true;\n                        }\n                        this.mPrivateFlags |= View.PFLAG_DRAWN;\n                        this.invalidate(true);\n                    }\n                    this.mBackgroundSizeChanged = true;\n                    this.invalidateParentIfNeeded();\n                    if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                        this.invalidateParentIfNeeded();\n                    }\n                }\n            }\n            getLeft() {\n                return this.mLeft;\n            }\n            setLeft(left) {\n                if (left != this.mLeft) {\n                    this.updateMatrix();\n                    const matrixIsIdentity = this.mTransformationInfo == null || this.mTransformationInfo.mMatrixIsIdentity;\n                    if (matrixIsIdentity) {\n                        if (this.mAttachInfo != null) {\n                            let minLeft;\n                            let xLoc;\n                            if (left < this.mLeft) {\n                                minLeft = left;\n                                xLoc = left - this.mLeft;\n                            }\n                            else {\n                                minLeft = this.mLeft;\n                                xLoc = 0;\n                            }\n                            this.invalidate(xLoc, 0, this.mRight - minLeft, this.mBottom - this.mTop);\n                        }\n                    }\n                    else {\n                        this.invalidate(true);\n                    }\n                    let oldWidth = this.mRight - this.mLeft;\n                    let height = this.mBottom - this.mTop;\n                    this.mLeft = left;\n                    this.sizeChange(this.mRight - this.mLeft, height, oldWidth, height);\n                    if (!matrixIsIdentity) {\n                        if ((this.mPrivateFlags & View.PFLAG_PIVOT_EXPLICITLY_SET) == 0) {\n                            this.mTransformationInfo.mMatrixDirty = true;\n                        }\n                        this.mPrivateFlags |= View.PFLAG_DRAWN;\n                        this.invalidate(true);\n                    }\n                    this.mBackgroundSizeChanged = true;\n                    this.invalidateParentIfNeeded();\n                    if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                        this.invalidateParentIfNeeded();\n                    }\n                }\n            }\n            getRight() {\n                return this.mRight;\n            }\n            setRight(right) {\n                if (right != this.mRight) {\n                    this.updateMatrix();\n                    const matrixIsIdentity = this.mTransformationInfo == null || this.mTransformationInfo.mMatrixIsIdentity;\n                    if (matrixIsIdentity) {\n                        if (this.mAttachInfo != null) {\n                            let maxRight;\n                            if (right < this.mRight) {\n                                maxRight = this.mRight;\n                            }\n                            else {\n                                maxRight = right;\n                            }\n                            this.invalidate(0, 0, maxRight - this.mLeft, this.mBottom - this.mTop);\n                        }\n                    }\n                    else {\n                        this.invalidate(true);\n                    }\n                    let oldWidth = this.mRight - this.mLeft;\n                    let height = this.mBottom - this.mTop;\n                    this.mRight = right;\n                    this.sizeChange(this.mRight - this.mLeft, height, oldWidth, height);\n                    if (!matrixIsIdentity) {\n                        if ((this.mPrivateFlags & View.PFLAG_PIVOT_EXPLICITLY_SET) == 0) {\n                            this.mTransformationInfo.mMatrixDirty = true;\n                        }\n                        this.mPrivateFlags |= View.PFLAG_DRAWN;\n                        this.invalidate(true);\n                    }\n                    this.mBackgroundSizeChanged = true;\n                    this.invalidateParentIfNeeded();\n                    if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                        this.invalidateParentIfNeeded();\n                    }\n                }\n            }\n            getX() {\n                return this.mLeft + (this.mTransformationInfo != null ? this.mTransformationInfo.mTranslationX : 0);\n            }\n            setX(x) {\n                this.setTranslationX(x - this.mLeft);\n            }\n            getY() {\n                return this.mTop + (this.mTransformationInfo != null ? this.mTransformationInfo.mTranslationY : 0);\n            }\n            setY(y) {\n                this.setTranslationY(y - this.mTop);\n            }\n            getTranslationX() {\n                return this.mTransformationInfo != null ? this.mTransformationInfo.mTranslationX : 0;\n            }\n            setTranslationX(translationX) {\n                this.ensureTransformationInfo();\n                const info = this.mTransformationInfo;\n                if (info.mTranslationX != translationX) {\n                    this.invalidateViewProperty(true, false);\n                    info.mTranslationX = translationX;\n                    info.mMatrixDirty = true;\n                    this.invalidateViewProperty(false, true);\n                    if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                        this.invalidateParentIfNeeded();\n                    }\n                }\n            }\n            getTranslationY() {\n                return this.mTransformationInfo != null ? this.mTransformationInfo.mTranslationY : 0;\n            }\n            setTranslationY(translationY) {\n                this.ensureTransformationInfo();\n                const info = this.mTransformationInfo;\n                if (info.mTranslationY != translationY) {\n                    this.invalidateViewProperty(true, false);\n                    info.mTranslationY = translationY;\n                    info.mMatrixDirty = true;\n                    this.invalidateViewProperty(false, true);\n                    if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                        this.invalidateParentIfNeeded();\n                    }\n                }\n            }\n            transformRect(rect) {\n                if (!this.getMatrix().isIdentity()) {\n                    let boundingRect = this.mAttachInfo.mTmpTransformRect;\n                    boundingRect.set(rect);\n                    this.getMatrix().mapRect(boundingRect);\n                    rect.set(boundingRect);\n                }\n            }\n            pointInView(localX, localY, slop = 0) {\n                return localX >= -slop && localY >= -slop && localX < ((this.mRight - this.mLeft) + slop) &&\n                    localY < ((this.mBottom - this.mTop) + slop);\n            }\n            getHandler() {\n                let attachInfo = this.mAttachInfo;\n                if (attachInfo != null) {\n                    return attachInfo.mHandler;\n                }\n                return null;\n            }\n            getViewRootImpl() {\n                if (this.mAttachInfo != null) {\n                    return this.mAttachInfo.mViewRootImpl;\n                }\n                if (this.mContext != null) {\n                    return this.mContext.androidUI._viewRootImpl;\n                }\n                return null;\n            }\n            post(action) {\n                let attachInfo = this.mAttachInfo;\n                if (attachInfo != null) {\n                    return attachInfo.mHandler.post(action);\n                }\n                view_1.ViewRootImpl.getRunQueue().post(action);\n                return true;\n            }\n            postDelayed(action, delayMillis) {\n                let attachInfo = this.mAttachInfo;\n                if (attachInfo != null) {\n                    return attachInfo.mHandler.postDelayed(action, delayMillis);\n                }\n                view_1.ViewRootImpl.getRunQueue().postDelayed(action, delayMillis);\n                return true;\n            }\n            postOnAnimation(action) {\n                return this.post(action);\n            }\n            postOnAnimationDelayed(action, delayMillis) {\n                return this.postDelayed(action, delayMillis);\n            }\n            removeCallbacks(action) {\n                if (action != null) {\n                    let attachInfo = this.mAttachInfo;\n                    if (attachInfo != null) {\n                        attachInfo.mHandler.removeCallbacks(action);\n                    }\n                    else {\n                        view_1.ViewRootImpl.getRunQueue().removeCallbacks(action);\n                    }\n                }\n                return true;\n            }\n            getParent() {\n                return this.mParent;\n            }\n            setFlags(flags, mask) {\n                let old = this.mViewFlags;\n                this.mViewFlags = (this.mViewFlags & ~mask) | (flags & mask);\n                let changed = this.mViewFlags ^ old;\n                if (changed == 0) {\n                    return;\n                }\n                let privateFlags = this.mPrivateFlags;\n                if (((changed & View.FOCUSABLE_MASK) != 0) &&\n                    ((privateFlags & View.PFLAG_HAS_BOUNDS) != 0)) {\n                    if (((old & View.FOCUSABLE_MASK) == View.FOCUSABLE)\n                        && ((privateFlags & View.PFLAG_FOCUSED) != 0)) {\n                        this.clearFocus();\n                    }\n                    else if (((old & View.FOCUSABLE_MASK) == View.NOT_FOCUSABLE)\n                        && ((privateFlags & View.PFLAG_FOCUSED) == 0)) {\n                        if (this.mParent != null)\n                            this.mParent.focusableViewAvailable(this);\n                    }\n                }\n                const newVisibility = flags & View.VISIBILITY_MASK;\n                if (newVisibility == View.VISIBLE) {\n                    if ((changed & View.VISIBILITY_MASK) != 0) {\n                        this.mPrivateFlags |= View.PFLAG_DRAWN;\n                        this.invalidate(true);\n                        if ((this.mParent != null) && (this.mBottom > this.mTop) && (this.mRight > this.mLeft)) {\n                            this.mParent.focusableViewAvailable(this);\n                        }\n                    }\n                }\n                if ((changed & View.GONE) != 0) {\n                    this.requestLayout();\n                    if (((this.mViewFlags & View.VISIBILITY_MASK) == View.GONE)) {\n                        if (this.hasFocus())\n                            this.clearFocus();\n                        this.destroyDrawingCache();\n                        if (this.mParent instanceof View) {\n                            this.mParent.invalidate(true);\n                        }\n                        this.mPrivateFlags |= View.PFLAG_DRAWN;\n                    }\n                }\n                if ((changed & View.INVISIBLE) != 0) {\n                    this.mPrivateFlags |= View.PFLAG_DRAWN;\n                    if (((this.mViewFlags & View.VISIBILITY_MASK) == View.INVISIBLE)) {\n                        if (this.getRootView() != this) {\n                            if (this.hasFocus())\n                                this.clearFocus();\n                        }\n                    }\n                }\n                if ((changed & View.VISIBILITY_MASK) != 0) {\n                    if (newVisibility != View.VISIBLE) {\n                        this.cleanupDraw();\n                    }\n                    if (this.mParent instanceof view_1.ViewGroup) {\n                        this.mParent.onChildVisibilityChanged(this, (changed & View.VISIBILITY_MASK), newVisibility);\n                        this.mParent.invalidate(true);\n                    }\n                    else if (this.mParent != null) {\n                        this.mParent.invalidateChild(this, null);\n                    }\n                    this.dispatchVisibilityChanged(this, newVisibility);\n                    this.syncVisibleToElement();\n                }\n                if ((changed & View.WILL_NOT_CACHE_DRAWING) != 0) {\n                    this.destroyDrawingCache();\n                }\n                if ((changed & View.DRAWING_CACHE_ENABLED) != 0) {\n                    this.destroyDrawingCache();\n                    this.mPrivateFlags &= ~View.PFLAG_DRAWING_CACHE_VALID;\n                    this.invalidateParentCaches();\n                }\n                if ((changed & View.DRAW_MASK) != 0) {\n                    if ((this.mViewFlags & View.WILL_NOT_DRAW) != 0) {\n                        if (this.mBackground != null) {\n                            this.mPrivateFlags &= ~View.PFLAG_SKIP_DRAW;\n                            this.mPrivateFlags |= View.PFLAG_ONLY_DRAWS_BACKGROUND;\n                        }\n                        else {\n                            this.mPrivateFlags |= View.PFLAG_SKIP_DRAW;\n                        }\n                    }\n                    else {\n                        this.mPrivateFlags &= ~View.PFLAG_SKIP_DRAW;\n                    }\n                    this.requestLayout();\n                    this.invalidate(true);\n                }\n            }\n            bringToFront() {\n                if (this.mParent != null) {\n                    this.mParent.bringChildToFront(this);\n                }\n            }\n            onScrollChanged(l, t, oldl, oldt) {\n                this.mBackgroundSizeChanged = true;\n                let rootImpl = this.getViewRootImpl();\n                if (rootImpl != null) {\n                    rootImpl.mViewScrollChanged = true;\n                }\n            }\n            onSizeChanged(w, h, oldw, oldh) {\n            }\n            getTouchables() {\n                let result = new ArrayList();\n                this.addTouchables(result);\n                return result;\n            }\n            addTouchables(views) {\n                const viewFlags = this.mViewFlags;\n                if (((viewFlags & View.CLICKABLE) == View.CLICKABLE || (viewFlags & View.LONG_CLICKABLE) == View.LONG_CLICKABLE)\n                    && (viewFlags & View.ENABLED_MASK) == View.ENABLED) {\n                    views.add(this);\n                }\n            }\n            requestRectangleOnScreen(rectangle, immediate = false) {\n                if (this.mParent == null) {\n                    return false;\n                }\n                let child = this;\n                let position = (this.mAttachInfo != null) ? this.mAttachInfo.mTmpTransformRect : new RectF();\n                position.set(rectangle);\n                let parent = this.mParent;\n                let scrolled = false;\n                while (parent != null) {\n                    rectangle.set(Math.floor(position.left), Math.floor(position.top), Math.floor(position.right), Math.floor(position.bottom));\n                    scrolled = parent.requestChildRectangleOnScreen(child, rectangle, immediate) || scrolled;\n                    if (!child.hasIdentityMatrix()) {\n                        child.getMatrix().mapRect(position);\n                    }\n                    position.offset(child.mLeft, child.mTop);\n                    if (!(parent instanceof View)) {\n                        break;\n                    }\n                    let parentView = parent;\n                    position.offset(-parentView.getScrollX(), -parentView.getScrollY());\n                    child = parentView;\n                    parent = child.getParent();\n                }\n                return scrolled;\n            }\n            onFocusLost() {\n                this.resetPressedState();\n            }\n            resetPressedState() {\n                if ((this.mViewFlags & View.ENABLED_MASK) == View.DISABLED) {\n                    return;\n                }\n                if (this.isPressed()) {\n                    this.setPressed(false);\n                    if (!this.mHasPerformedLongPress) {\n                        this.removeLongPressCallback();\n                    }\n                }\n            }\n            isFocused() {\n                return (this.mPrivateFlags & View.PFLAG_FOCUSED) != 0;\n            }\n            findFocus() {\n                return (this.mPrivateFlags & View.PFLAG_FOCUSED) != 0 ? this : null;\n            }\n            getNextFocusLeftId() {\n                return this.mNextFocusLeftId;\n            }\n            setNextFocusLeftId(nextFocusLeftId) {\n                this.mNextFocusLeftId = nextFocusLeftId;\n            }\n            getNextFocusRightId() {\n                return this.mNextFocusRightId;\n            }\n            setNextFocusRightId(nextFocusRightId) {\n                this.mNextFocusRightId = nextFocusRightId;\n            }\n            getNextFocusUpId() {\n                return this.mNextFocusUpId;\n            }\n            setNextFocusUpId(nextFocusUpId) {\n                this.mNextFocusUpId = nextFocusUpId;\n            }\n            getNextFocusDownId() {\n                return this.mNextFocusDownId;\n            }\n            setNextFocusDownId(nextFocusDownId) {\n                this.mNextFocusDownId = nextFocusDownId;\n            }\n            getNextFocusForwardId() {\n                return this.mNextFocusForwardId;\n            }\n            setNextFocusForwardId(nextFocusForwardId) {\n                this.mNextFocusForwardId = nextFocusForwardId;\n            }\n            setFocusable(focusable) {\n                if (!focusable) {\n                    this.setFlags(0, View.FOCUSABLE_IN_TOUCH_MODE);\n                }\n                this.setFlags(focusable ? View.FOCUSABLE : View.NOT_FOCUSABLE, View.FOCUSABLE_MASK);\n            }\n            isFocusable() {\n                return View.FOCUSABLE == (this.mViewFlags & View.FOCUSABLE_MASK);\n            }\n            setFocusableInTouchMode(focusableInTouchMode) {\n                this.setFlags(focusableInTouchMode ? View.FOCUSABLE_IN_TOUCH_MODE : 0, View.FOCUSABLE_IN_TOUCH_MODE);\n                if (focusableInTouchMode) {\n                    this.setFlags(View.FOCUSABLE, View.FOCUSABLE_MASK);\n                }\n            }\n            isFocusableInTouchMode() {\n                return View.FOCUSABLE_IN_TOUCH_MODE == (this.mViewFlags & View.FOCUSABLE_IN_TOUCH_MODE);\n            }\n            hasFocusable() {\n                return (this.mViewFlags & View.VISIBILITY_MASK) == View.VISIBLE && this.isFocusable();\n            }\n            clearFocus() {\n                if (View.DBG) {\n                    System.out.println(this + \" clearFocus()\");\n                }\n                this.clearFocusInternal(true, true);\n            }\n            clearFocusInternal(propagate, refocus) {\n                if ((this.mPrivateFlags & View.PFLAG_FOCUSED) != 0) {\n                    this.mPrivateFlags &= ~View.PFLAG_FOCUSED;\n                    if (propagate && this.mParent != null) {\n                        this.mParent.clearChildFocus(this);\n                    }\n                    this.onFocusChanged(false, 0, null);\n                    this.refreshDrawableState();\n                    if (propagate && (!refocus || !this.rootViewRequestFocus())) {\n                        this.notifyGlobalFocusCleared(this);\n                    }\n                }\n            }\n            notifyGlobalFocusCleared(oldFocus) {\n            }\n            rootViewRequestFocus() {\n                const root = this.getRootView();\n                return root != null && root.requestFocus();\n            }\n            unFocus() {\n                if (View.DBG) {\n                    System.out.println(this + \" unFocus()\");\n                }\n                this.clearFocusInternal(false, false);\n            }\n            hasFocus() {\n                return (this.mPrivateFlags & View.PFLAG_FOCUSED) != 0;\n            }\n            onFocusChanged(gainFocus, direction, previouslyFocusedRect) {\n                if (!gainFocus) {\n                    if (this.isPressed()) {\n                        this.setPressed(false);\n                    }\n                    this.onFocusLost();\n                }\n                this.invalidate(true);\n                let li = this.mListenerInfo;\n                if (li != null && li.mOnFocusChangeListener != null) {\n                    li.mOnFocusChangeListener.onFocusChange(this, gainFocus);\n                }\n                if (this.mAttachInfo != null) {\n                    this.mAttachInfo.mKeyDispatchState.reset(this);\n                }\n            }\n            focusSearch(direction) {\n                if (this.mParent != null) {\n                    return this.mParent.focusSearch(this, direction);\n                }\n                else {\n                    return null;\n                }\n            }\n            dispatchUnhandledMove(focused, direction) {\n                return false;\n            }\n            findUserSetNextFocus(root, direction) {\n                switch (direction) {\n                    case View.FOCUS_LEFT:\n                        if (!this.mNextFocusLeftId)\n                            return null;\n                        return this.findViewInsideOutShouldExist(root, this.mNextFocusLeftId);\n                    case View.FOCUS_RIGHT:\n                        if (!this.mNextFocusRightId)\n                            return null;\n                        return this.findViewInsideOutShouldExist(root, this.mNextFocusRightId);\n                    case View.FOCUS_UP:\n                        if (!this.mNextFocusUpId)\n                            return null;\n                        return this.findViewInsideOutShouldExist(root, this.mNextFocusUpId);\n                    case View.FOCUS_DOWN:\n                        if (!this.mNextFocusDownId)\n                            return null;\n                        return this.findViewInsideOutShouldExist(root, this.mNextFocusDownId);\n                    case View.FOCUS_FORWARD:\n                        if (!this.mNextFocusForwardId)\n                            return null;\n                        return this.findViewInsideOutShouldExist(root, this.mNextFocusForwardId);\n                    case View.FOCUS_BACKWARD: {\n                        if (!this.mID)\n                            return null;\n                        let id = this.mID;\n                        return root.findViewByPredicateInsideOut(this, {\n                            apply(t) {\n                                return t.mNextFocusForwardId == id;\n                            }\n                        });\n                    }\n                }\n                return null;\n            }\n            findViewInsideOutShouldExist(root, id) {\n                if (this.mMatchIdPredicate == null) {\n                    this.mMatchIdPredicate = new MatchIdPredicate();\n                }\n                this.mMatchIdPredicate.mId = id;\n                let result = root.findViewByPredicateInsideOut(this, this.mMatchIdPredicate);\n                if (result == null) {\n                    Log.w(View.VIEW_LOG_TAG, \"couldn't find view with id \" + id);\n                }\n                return result;\n            }\n            getFocusables(direction) {\n                let result = new ArrayList(24);\n                this.addFocusables(result, direction);\n                return result;\n            }\n            addFocusables(views, direction, focusableMode = View.FOCUSABLES_TOUCH_MODE) {\n                if (views == null) {\n                    return;\n                }\n                if (!this.isFocusable()) {\n                    return;\n                }\n                if ((focusableMode & View.FOCUSABLES_TOUCH_MODE) == View.FOCUSABLES_TOUCH_MODE\n                    && this.isInTouchMode() && !this.isFocusableInTouchMode()) {\n                    return;\n                }\n                views.add(this);\n            }\n            setOnFocusChangeListener(l) {\n                if (typeof l == \"function\") {\n                    l = View.OnFocusChangeListener.fromFunction(l);\n                }\n                this.getListenerInfo().mOnFocusChangeListener = l;\n            }\n            getOnFocusChangeListener() {\n                let li = this.mListenerInfo;\n                return li != null ? li.mOnFocusChangeListener : null;\n            }\n            requestFocus(direction = View.FOCUS_DOWN, previouslyFocusedRect = null) {\n                return this.requestFocusNoSearch(direction, previouslyFocusedRect);\n            }\n            requestFocusNoSearch(direction, previouslyFocusedRect) {\n                if ((this.mViewFlags & View.FOCUSABLE_MASK) != View.FOCUSABLE ||\n                    (this.mViewFlags & View.VISIBILITY_MASK) != View.VISIBLE) {\n                    return false;\n                }\n                if (this.isInTouchMode() &&\n                    (View.FOCUSABLE_IN_TOUCH_MODE != (this.mViewFlags & View.FOCUSABLE_IN_TOUCH_MODE))) {\n                    return false;\n                }\n                if (this.hasAncestorThatBlocksDescendantFocus()) {\n                    return false;\n                }\n                this.handleFocusGainInternal(direction, previouslyFocusedRect);\n                return true;\n            }\n            requestFocusFromTouch() {\n                if (this.isInTouchMode()) {\n                    let viewRoot = this.getViewRootImpl();\n                    if (viewRoot != null) {\n                        viewRoot.ensureTouchMode(false);\n                    }\n                }\n                return this.requestFocus(View.FOCUS_DOWN);\n            }\n            hasAncestorThatBlocksDescendantFocus() {\n                let ancestor = this.mParent;\n                while (ancestor instanceof view_1.ViewGroup) {\n                    const vgAncestor = ancestor;\n                    if (vgAncestor.getDescendantFocusability() == view_1.ViewGroup.FOCUS_BLOCK_DESCENDANTS) {\n                        return true;\n                    }\n                    else {\n                        ancestor = vgAncestor.getParent();\n                    }\n                }\n                return false;\n            }\n            handleFocusGainInternal(direction, previouslyFocusedRect) {\n                if (View.DBG) {\n                    System.out.println(this + \" requestFocus()\");\n                }\n                if ((this.mPrivateFlags & View.PFLAG_FOCUSED) == 0) {\n                    this.mPrivateFlags |= View.PFLAG_FOCUSED;\n                    let oldFocus = (this.mAttachInfo != null) ? this.getRootView().findFocus() : null;\n                    if (this.mParent != null) {\n                        this.mParent.requestChildFocus(this, this);\n                    }\n                    this.onFocusChanged(true, direction, previouslyFocusedRect);\n                    this.refreshDrawableState();\n                }\n            }\n            hasTransientState() {\n                return (this.mPrivateFlags2 & View.PFLAG2_HAS_TRANSIENT_STATE) == View.PFLAG2_HAS_TRANSIENT_STATE;\n            }\n            setHasTransientState(hasTransientState) {\n                this.mTransientStateCount = hasTransientState ? this.mTransientStateCount + 1 :\n                    this.mTransientStateCount - 1;\n                if (this.mTransientStateCount < 0) {\n                    this.mTransientStateCount = 0;\n                    Log.e(View.VIEW_LOG_TAG, \"hasTransientState decremented below 0: \" +\n                        \"unmatched pair of setHasTransientState calls\");\n                }\n                else if ((hasTransientState && this.mTransientStateCount == 1) ||\n                    (!hasTransientState && this.mTransientStateCount == 0)) {\n                    this.mPrivateFlags2 = (this.mPrivateFlags2 & ~View.PFLAG2_HAS_TRANSIENT_STATE) |\n                        (hasTransientState ? View.PFLAG2_HAS_TRANSIENT_STATE : 0);\n                    if (this.mParent != null) {\n                        this.mParent.childHasTransientStateChanged(this, hasTransientState);\n                    }\n                }\n            }\n            isScrollContainer() {\n                return (this.mPrivateFlags & View.PFLAG_SCROLL_CONTAINER_ADDED) != 0;\n            }\n            setScrollContainer(isScrollContainer) {\n                if (isScrollContainer) {\n                    if (this.mAttachInfo != null && (this.mPrivateFlags & View.PFLAG_SCROLL_CONTAINER_ADDED) == 0) {\n                        this.mAttachInfo.mScrollContainers.add(this);\n                        this.mPrivateFlags |= View.PFLAG_SCROLL_CONTAINER_ADDED;\n                    }\n                    this.mPrivateFlags |= View.PFLAG_SCROLL_CONTAINER;\n                }\n                else {\n                    if ((this.mPrivateFlags & View.PFLAG_SCROLL_CONTAINER_ADDED) != 0) {\n                        this.mAttachInfo.mScrollContainers.delete(this);\n                    }\n                    this.mPrivateFlags &= ~(View.PFLAG_SCROLL_CONTAINER | View.PFLAG_SCROLL_CONTAINER_ADDED);\n                }\n            }\n            isInTouchMode() {\n                if (this.getViewRootImpl() != null) {\n                    return this.getViewRootImpl().mInTouchMode;\n                }\n                else {\n                    return false;\n                }\n            }\n            isShown() {\n                let current = this;\n                do {\n                    if ((current.mViewFlags & View.VISIBILITY_MASK) != View.VISIBLE) {\n                        return false;\n                    }\n                    let parent = current.mParent;\n                    if (parent == null) {\n                        return false;\n                    }\n                    if (!(parent instanceof View)) {\n                        return true;\n                    }\n                    current = parent;\n                } while (current != null);\n                return false;\n            }\n            getVisibility() {\n                return this.mViewFlags & View.VISIBILITY_MASK;\n            }\n            setVisibility(visibility) {\n                this.setFlags(visibility, View.VISIBILITY_MASK);\n                if (this.mBackground != null)\n                    this.mBackground.setVisible(visibility == View.VISIBLE, false);\n            }\n            dispatchVisibilityChanged(changedView, visibility) {\n                this.onVisibilityChanged(changedView, visibility);\n            }\n            onVisibilityChanged(changedView, visibility) {\n                if (visibility == View.VISIBLE) {\n                    if (this.mAttachInfo != null) {\n                        this.initialAwakenScrollBars();\n                    }\n                    else {\n                        this.mPrivateFlags |= View.PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH;\n                    }\n                }\n            }\n            dispatchDisplayHint(hint) {\n                this.onDisplayHint(hint);\n            }\n            onDisplayHint(hint) {\n            }\n            dispatchWindowVisibilityChanged(visibility) {\n                this.onWindowVisibilityChanged(visibility);\n            }\n            onWindowVisibilityChanged(visibility) {\n                if (visibility == View.VISIBLE) {\n                    this.initialAwakenScrollBars();\n                }\n            }\n            getWindowVisibility() {\n                return this.mAttachInfo != null ? this.mAttachInfo.mWindowVisibility : View.GONE;\n            }\n            isEnabled() {\n                return (this.mViewFlags & View.ENABLED_MASK) == View.ENABLED;\n            }\n            setEnabled(enabled) {\n                if (enabled == this.isEnabled())\n                    return;\n                this.setFlags(enabled ? View.ENABLED : View.DISABLED, View.ENABLED_MASK);\n                this.refreshDrawableState();\n                this.invalidate(true);\n            }\n            dispatchGenericMotionEvent(event) {\n                if (event.isPointerEvent()) {\n                    const action = event.getAction();\n                    if (action == view_1.MotionEvent.ACTION_HOVER_ENTER\n                        || action == view_1.MotionEvent.ACTION_HOVER_MOVE\n                        || action == view_1.MotionEvent.ACTION_HOVER_EXIT) {\n                    }\n                    else if (this.dispatchGenericPointerEvent(event)) {\n                        return true;\n                    }\n                }\n                if (this.dispatchGenericMotionEventInternal(event)) {\n                    return true;\n                }\n                return false;\n            }\n            dispatchGenericMotionEventInternal(event) {\n                let li = this.mListenerInfo;\n                if (li != null && li.mOnGenericMotionListener != null\n                    && (this.mViewFlags & View.ENABLED_MASK) == View.ENABLED\n                    && li.mOnGenericMotionListener.onGenericMotion(this, event)) {\n                    return true;\n                }\n                if (this.onGenericMotionEvent(event)) {\n                    return true;\n                }\n                return false;\n            }\n            onGenericMotionEvent(event) {\n                return false;\n            }\n            dispatchGenericPointerEvent(event) {\n                return false;\n            }\n            dispatchKeyEvent(event) {\n                let li = this.mListenerInfo;\n                if (li != null && li.mOnKeyListener != null && (this.mViewFlags & View.ENABLED_MASK) == View.ENABLED\n                    && li.mOnKeyListener.onKey(this, event.getKeyCode(), event)) {\n                    return true;\n                }\n                if (event.dispatch(this, this.mAttachInfo != null\n                    ? this.mAttachInfo.mKeyDispatchState : null, this)) {\n                    return true;\n                }\n                return false;\n            }\n            setOnKeyListener(l) {\n                if (typeof l == \"function\") {\n                    l = View.OnKeyListener.fromFunction(l);\n                }\n                this.getListenerInfo().mOnKeyListener = l;\n            }\n            getKeyDispatcherState() {\n                return this.mAttachInfo != null ? this.mAttachInfo.mKeyDispatchState : null;\n            }\n            onKeyDown(keyCode, event) {\n                let result = false;\n                if (KeyEvent.isConfirmKey(keyCode)) {\n                    if ((this.mViewFlags & View.ENABLED_MASK) == View.DISABLED) {\n                        return true;\n                    }\n                    if (((this.mViewFlags & View.CLICKABLE) == View.CLICKABLE ||\n                        (this.mViewFlags & View.LONG_CLICKABLE) == View.LONG_CLICKABLE) &&\n                        (event.getRepeatCount() == 0)) {\n                        this.setPressed(true);\n                        this.checkForLongClick(0);\n                        return true;\n                    }\n                }\n                return result;\n            }\n            onKeyLongPress(keyCode, event) {\n                return false;\n            }\n            onKeyUp(keyCode, event) {\n                if (KeyEvent.isConfirmKey(keyCode)) {\n                    if ((this.mViewFlags & View.ENABLED_MASK) == View.DISABLED) {\n                        return true;\n                    }\n                    if ((this.mViewFlags & View.CLICKABLE) == View.CLICKABLE && this.isPressed()) {\n                        this.setPressed(false);\n                        if (!this.mHasPerformedLongPress) {\n                            this.removeLongPressCallback();\n                            return this.performClick();\n                        }\n                    }\n                }\n                return false;\n            }\n            dispatchTouchEvent(event) {\n                if (this.onFilterTouchEventForSecurity(event)) {\n                    let li = this.mListenerInfo;\n                    if (li != null && li.mOnTouchListener != null && (this.mViewFlags & View.ENABLED_MASK) == View.ENABLED\n                        && li.mOnTouchListener.onTouch(this, event)) {\n                        return true;\n                    }\n                    if (this.onTouchEvent(event)) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n            onFilterTouchEventForSecurity(event) {\n                return true;\n            }\n            onTouchEvent(event) {\n                let viewFlags = this.mViewFlags;\n                if ((viewFlags & View.ENABLED_MASK) == View.DISABLED) {\n                    if (event.getAction() == view_1.MotionEvent.ACTION_UP && (this.mPrivateFlags & View.PFLAG_PRESSED) != 0) {\n                        this.setPressed(false);\n                    }\n                    return (((viewFlags & View.CLICKABLE) == View.CLICKABLE ||\n                        (viewFlags & View.LONG_CLICKABLE) == View.LONG_CLICKABLE));\n                }\n                if (this.mTouchDelegate != null) {\n                    if (this.mTouchDelegate.onTouchEvent(event)) {\n                        return true;\n                    }\n                }\n                if (((viewFlags & View.CLICKABLE) == View.CLICKABLE ||\n                    (viewFlags & View.LONG_CLICKABLE) == View.LONG_CLICKABLE)) {\n                    switch (event.getAction()) {\n                        case view_1.MotionEvent.ACTION_UP:\n                            let prepressed = (this.mPrivateFlags & View.PFLAG_PREPRESSED) != 0;\n                            if ((this.mPrivateFlags & View.PFLAG_PRESSED) != 0 || prepressed) {\n                                let focusTaken = false;\n                                if (this.isFocusable() && this.isFocusableInTouchMode() && !this.isFocused()) {\n                                    focusTaken = this.requestFocus();\n                                }\n                                if (prepressed) {\n                                    this.setPressed(true);\n                                }\n                                if (!this.mHasPerformedLongPress) {\n                                    this.removeLongPressCallback();\n                                    if (!focusTaken) {\n                                        if (this.mPerformClick == null) {\n                                            this.mPerformClick = new PerformClick(this);\n                                        }\n                                        if (prepressed) {\n                                            if (this.mPerformClickAfterPressDraw == null) {\n                                                this.mPerformClickAfterPressDraw = new PerformClickAfterPressDraw(this);\n                                            }\n                                            this.post(this.mPerformClickAfterPressDraw);\n                                        }\n                                        else if (!this.post(this.mPerformClick)) {\n                                            this.performClick(event);\n                                        }\n                                    }\n                                }\n                                if (this.mUnsetPressedState == null) {\n                                    this.mUnsetPressedState = new UnsetPressedState(this);\n                                }\n                                if (prepressed) {\n                                    this.postDelayed(this.mUnsetPressedState, view_1.ViewConfiguration.getPressedStateDuration());\n                                }\n                                else if (!this.post(this.mUnsetPressedState)) {\n                                    this.mUnsetPressedState.run();\n                                }\n                                this.removeTapCallback();\n                            }\n                            break;\n                        case view_1.MotionEvent.ACTION_DOWN:\n                            this.mHasPerformedLongPress = false;\n                            let isInScrollingContainer = this.isInScrollingContainer();\n                            if (isInScrollingContainer) {\n                                this.mPrivateFlags |= View.PFLAG_PREPRESSED;\n                                if (this.mPendingCheckForTap == null) {\n                                    this.mPendingCheckForTap = new CheckForTap(this);\n                                }\n                                this.postDelayed(this.mPendingCheckForTap, view_1.ViewConfiguration.getTapTimeout());\n                            }\n                            else {\n                                this.setPressed(true);\n                                this.checkForLongClick(0);\n                            }\n                            break;\n                        case view_1.MotionEvent.ACTION_CANCEL:\n                            this.setPressed(false);\n                            this.removeTapCallback();\n                            this.removeLongPressCallback();\n                            break;\n                        case view_1.MotionEvent.ACTION_MOVE:\n                            const x = event.getX();\n                            const y = event.getY();\n                            if (!this.pointInView(x, y, this.mTouchSlop)) {\n                                this.removeTapCallback();\n                                if ((this.mPrivateFlags & View.PFLAG_PRESSED) != 0) {\n                                    this.removeLongPressCallback();\n                                    this.setPressed(false);\n                                }\n                            }\n                            break;\n                    }\n                    return true;\n                }\n                return false;\n            }\n            isInScrollingContainer() {\n                let p = this.getParent();\n                while (p != null && p instanceof view_1.ViewGroup) {\n                    if (p.shouldDelayChildPressedState()) {\n                        return true;\n                    }\n                    p = p.getParent();\n                }\n                return false;\n            }\n            cancelPendingInputEvents() {\n                this.dispatchCancelPendingInputEvents();\n            }\n            dispatchCancelPendingInputEvents() {\n                this.mPrivateFlags3 &= ~View.PFLAG3_CALLED_SUPER;\n                this.onCancelPendingInputEvents();\n                if ((this.mPrivateFlags3 & View.PFLAG3_CALLED_SUPER) != View.PFLAG3_CALLED_SUPER) {\n                    throw Error(`new SuperNotCalledException(\"View \" + this.getClass().getSimpleName() + \" did not call through to super.onCancelPendingInputEvents()\")`);\n                }\n            }\n            onCancelPendingInputEvents() {\n                this.removePerformClickCallback();\n                this.cancelLongPress();\n                this.mPrivateFlags3 |= View.PFLAG3_CALLED_SUPER;\n            }\n            removeLongPressCallback() {\n                if (this.mPendingCheckForLongPress != null) {\n                    this.removeCallbacks(this.mPendingCheckForLongPress);\n                }\n            }\n            removePerformClickCallback() {\n                if (this.mPerformClick != null) {\n                    this.removeCallbacks(this.mPerformClick);\n                }\n                if (this.mPerformClickAfterPressDraw != null) {\n                    this.removeCallbacks(this.mPerformClickAfterPressDraw);\n                }\n            }\n            removeUnsetPressCallback() {\n                if ((this.mPrivateFlags & View.PFLAG_PRESSED) != 0 && this.mUnsetPressedState != null) {\n                    this.setPressed(false);\n                    this.removeCallbacks(this.mUnsetPressedState);\n                }\n            }\n            removeTapCallback() {\n                if (this.mPendingCheckForTap != null) {\n                    this.mPrivateFlags &= ~View.PFLAG_PREPRESSED;\n                    this.removeCallbacks(this.mPendingCheckForTap);\n                }\n            }\n            cancelLongPress() {\n                this.removeLongPressCallback();\n                this.removeTapCallback();\n            }\n            setTouchDelegate(delegate) {\n                this.mTouchDelegate = delegate;\n            }\n            getTouchDelegate() {\n                return this.mTouchDelegate;\n            }\n            getListenerInfo() {\n                if (this.mListenerInfo != null) {\n                    return this.mListenerInfo;\n                }\n                this.mListenerInfo = new View.ListenerInfo();\n                return this.mListenerInfo;\n            }\n            addOnLayoutChangeListener(listener) {\n                let li = this.getListenerInfo();\n                if (li.mOnLayoutChangeListeners == null) {\n                    li.mOnLayoutChangeListeners = new ArrayList();\n                }\n                if (!li.mOnLayoutChangeListeners.contains(listener)) {\n                    li.mOnLayoutChangeListeners.add(listener);\n                }\n            }\n            removeOnLayoutChangeListener(listener) {\n                let li = this.mListenerInfo;\n                if (li == null || li.mOnLayoutChangeListeners == null) {\n                    return;\n                }\n                li.mOnLayoutChangeListeners.remove(listener);\n            }\n            addOnAttachStateChangeListener(listener) {\n                let li = this.getListenerInfo();\n                if (li.mOnAttachStateChangeListeners == null) {\n                    li.mOnAttachStateChangeListeners\n                        = new CopyOnWriteArrayList();\n                }\n                li.mOnAttachStateChangeListeners.add(listener);\n            }\n            removeOnAttachStateChangeListener(listener) {\n                let li = this.mListenerInfo;\n                if (li == null || li.mOnAttachStateChangeListeners == null) {\n                    return;\n                }\n                li.mOnAttachStateChangeListeners.remove(listener);\n            }\n            setOnClickListenerByAttrValueString(onClickAttrString) {\n                this.setOnClickListener((view) => {\n                    if (!onClickAttrString)\n                        return;\n                    let activityClickMethod = view.getContext()[onClickAttrString];\n                    if (typeof activityClickMethod === 'function') {\n                        try {\n                            activityClickMethod.call(view.getContext(), view);\n                        }\n                        catch (e) {\n                            console.error(e);\n                            throw new Error(`Could not execute method '${onClickAttrString}' of the activity`);\n                        }\n                        return;\n                    }\n                    else {\n                        try {\n                            new Function(onClickAttrString).call(view);\n                        }\n                        catch (e) {\n                            console.error(e);\n                            throw new Error(\"Could not execute or find a method \" +\n                                onClickAttrString + \"(View) in the activity \"\n                                + view.getContext().constructor.name + \" for onClick handler\"\n                                + \" on view \" + view.getClass() + view.getId());\n                        }\n                    }\n                });\n            }\n            setOnClickListener(l) {\n                if (!this.isClickable()) {\n                    this.setClickable(true);\n                }\n                if (typeof l == \"function\") {\n                    l = View.OnClickListener.fromFunction(l);\n                }\n                this.getListenerInfo().mOnClickListener = l;\n            }\n            hasOnClickListeners() {\n                let li = this.mListenerInfo;\n                return (li != null && li.mOnClickListener != null);\n            }\n            setOnLongClickListener(l) {\n                if (!this.isLongClickable()) {\n                    this.setLongClickable(true);\n                }\n                if (typeof l == \"function\") {\n                    l = View.OnLongClickListener.fromFunction(l);\n                }\n                this.getListenerInfo().mOnLongClickListener = l;\n            }\n            playSoundEffect(soundConstant) {\n            }\n            performHapticFeedback(feedbackConstant) {\n                return false;\n            }\n            performClick(event) {\n                let li = this.mListenerInfo;\n                if (li != null && li.mOnClickListener != null) {\n                    li.mOnClickListener.onClick(this);\n                    return true;\n                }\n                return false;\n            }\n            callOnClick() {\n                let li = this.mListenerInfo;\n                if (li != null && li.mOnClickListener != null) {\n                    li.mOnClickListener.onClick(this);\n                    return true;\n                }\n                return false;\n            }\n            performLongClick() {\n                let handled = false;\n                let li = this.mListenerInfo;\n                if (li != null && li.mOnLongClickListener != null) {\n                    handled = li.mOnLongClickListener.onLongClick(this);\n                }\n                return handled;\n            }\n            performButtonActionOnTouchDown(event) {\n                return false;\n            }\n            checkForLongClick(delayOffset = 0) {\n                if ((this.mViewFlags & View.LONG_CLICKABLE) == View.LONG_CLICKABLE) {\n                    this.mHasPerformedLongPress = false;\n                    if (this.mPendingCheckForLongPress == null) {\n                        this.mPendingCheckForLongPress = new CheckForLongPress(this);\n                    }\n                    this.mPendingCheckForLongPress.rememberWindowAttachCount();\n                    this.postDelayed(this.mPendingCheckForLongPress, view_1.ViewConfiguration.getLongPressTimeout() - delayOffset);\n                }\n            }\n            setOnTouchListener(l) {\n                if (typeof l == \"function\") {\n                    l = View.OnTouchListener.fromFunction(l);\n                }\n                this.getListenerInfo().mOnTouchListener = l;\n            }\n            isClickable() {\n                return (this.mViewFlags & View.CLICKABLE) == View.CLICKABLE;\n            }\n            setClickable(clickable) {\n                this.setFlags(clickable ? View.CLICKABLE : 0, View.CLICKABLE);\n            }\n            isLongClickable() {\n                return (this.mViewFlags & View.LONG_CLICKABLE) == View.LONG_CLICKABLE;\n            }\n            setLongClickable(longClickable) {\n                this.setFlags(longClickable ? View.LONG_CLICKABLE : 0, View.LONG_CLICKABLE);\n            }\n            setPressed(pressed) {\n                const needsRefresh = pressed != ((this.mPrivateFlags & View.PFLAG_PRESSED) == View.PFLAG_PRESSED);\n                if (pressed) {\n                    this.mPrivateFlags |= View.PFLAG_PRESSED;\n                }\n                else {\n                    this.mPrivateFlags &= ~View.PFLAG_PRESSED;\n                }\n                if (needsRefresh) {\n                    this.refreshDrawableState();\n                }\n                this.dispatchSetPressed(pressed);\n            }\n            dispatchSetPressed(pressed) {\n            }\n            isPressed() {\n                return (this.mPrivateFlags & View.PFLAG_PRESSED) == View.PFLAG_PRESSED;\n            }\n            setSelected(selected) {\n                if (((this.mPrivateFlags & View.PFLAG_SELECTED) != 0) != selected) {\n                    this.mPrivateFlags = (this.mPrivateFlags & ~View.PFLAG_SELECTED) | (selected ? View.PFLAG_SELECTED : 0);\n                    if (!selected)\n                        this.resetPressedState();\n                    this.invalidate(true);\n                    this.refreshDrawableState();\n                    this.dispatchSetSelected(selected);\n                }\n            }\n            dispatchSetSelected(selected) {\n            }\n            isSelected() {\n                return (this.mPrivateFlags & View.PFLAG_SELECTED) != 0;\n            }\n            setActivated(activated) {\n                if (((this.mPrivateFlags & View.PFLAG_ACTIVATED) != 0) != activated) {\n                    this.mPrivateFlags = (this.mPrivateFlags & ~View.PFLAG_ACTIVATED) | (activated ? View.PFLAG_ACTIVATED : 0);\n                    this.invalidate(true);\n                    this.refreshDrawableState();\n                    this.dispatchSetActivated(activated);\n                }\n            }\n            dispatchSetActivated(activated) {\n            }\n            isActivated() {\n                return (this.mPrivateFlags & View.PFLAG_ACTIVATED) != 0;\n            }\n            getViewTreeObserver() {\n                if (this.mAttachInfo != null) {\n                    return this.mAttachInfo.mViewRootImpl.mTreeObserver;\n                }\n                if (this.mFloatingTreeObserver == null) {\n                    this.mFloatingTreeObserver = new view_1.ViewTreeObserver();\n                }\n                return this.mFloatingTreeObserver;\n            }\n            setLayoutDirection(layoutDirection) {\n            }\n            getLayoutDirection() {\n                return View.LAYOUT_DIRECTION_LTR;\n            }\n            isLayoutRtl() {\n                return (this.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL);\n            }\n            getTextDirection() {\n                return View.TEXT_DIRECTION_LTR;\n            }\n            setTextDirection(textDirection) {\n            }\n            getTextAlignment() {\n                return View.TEXT_ALIGNMENT_DEFAULT;\n            }\n            setTextAlignment(textAlignment) {\n            }\n            getBaseline() {\n                return -1;\n            }\n            isLayoutRequested() {\n                return (this.mPrivateFlags & View.PFLAG_FORCE_LAYOUT) == View.PFLAG_FORCE_LAYOUT;\n            }\n            getLayoutParams() {\n                return this.mLayoutParams;\n            }\n            setLayoutParams(params) {\n                if (params == null) {\n                    throw new Error(\"Layout parameters cannot be null\");\n                }\n                this.mLayoutParams = params;\n                let p = this.mParent;\n                if (p instanceof view_1.ViewGroup) {\n                    p.onSetLayoutParams(this, params);\n                }\n                this.requestLayout();\n            }\n            isInLayout() {\n                let viewRoot = this.getViewRootImpl();\n                return (viewRoot != null && viewRoot.isInLayout());\n            }\n            requestLayout() {\n                if (this.mMeasureCache != null)\n                    this.mMeasureCache.clear();\n                if (this.mAttachInfo != null && this.mAttachInfo.mViewRequestingLayout == null) {\n                    let viewRoot = this.getViewRootImpl();\n                    if (viewRoot != null && viewRoot.isInLayout()) {\n                        if (!viewRoot.requestLayoutDuringLayout(this)) {\n                            return;\n                        }\n                    }\n                    this.mAttachInfo.mViewRequestingLayout = this;\n                }\n                this.mPrivateFlags |= View.PFLAG_FORCE_LAYOUT;\n                this.mPrivateFlags |= View.PFLAG_INVALIDATED;\n                if (this.mParent != null && !this.mParent.isLayoutRequested()) {\n                    this.mParent.requestLayout();\n                }\n                if (this.mAttachInfo != null && this.mAttachInfo.mViewRequestingLayout == this) {\n                    this.mAttachInfo.mViewRequestingLayout = null;\n                }\n            }\n            forceLayout() {\n                if (this.mMeasureCache != null)\n                    this.mMeasureCache.clear();\n                this.mPrivateFlags |= View.PFLAG_FORCE_LAYOUT;\n                this.mPrivateFlags |= View.PFLAG_INVALIDATED;\n            }\n            isLaidOut() {\n                return (this.mPrivateFlags3 & View.PFLAG3_IS_LAID_OUT) == View.PFLAG3_IS_LAID_OUT;\n            }\n            layout(l, t, r, b) {\n                if ((this.mPrivateFlags3 & View.PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT) != 0) {\n                    this.onMeasure(this.mOldWidthMeasureSpec, this.mOldHeightMeasureSpec);\n                    this.mPrivateFlags3 &= ~View.PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT;\n                }\n                let oldL = this.mLeft;\n                let oldT = this.mTop;\n                let oldB = this.mBottom;\n                let oldR = this.mRight;\n                let changed = this.setFrame(l, t, r, b);\n                if (changed || (this.mPrivateFlags & View.PFLAG_LAYOUT_REQUIRED) == View.PFLAG_LAYOUT_REQUIRED) {\n                    this.onLayout(changed, l, t, r, b);\n                    this.mPrivateFlags &= ~View.PFLAG_LAYOUT_REQUIRED;\n                    let li = this.mListenerInfo;\n                    if (li != null && li.mOnLayoutChangeListeners != null) {\n                        let listenersCopy = li.mOnLayoutChangeListeners.clone();\n                        let numListeners = listenersCopy.size();\n                        for (let i = 0; i < numListeners; ++i) {\n                            listenersCopy.get(i).onLayoutChange(this, l, t, r, b, oldL, oldT, oldR, oldB);\n                        }\n                    }\n                }\n                this.mPrivateFlags &= ~View.PFLAG_FORCE_LAYOUT;\n                this.mPrivateFlags3 |= View.PFLAG3_IS_LAID_OUT;\n            }\n            onLayout(changed, left, top, right, bottom) {\n            }\n            setFrame(left, top, right, bottom) {\n                let changed = false;\n                if (View.DBG) {\n                    Log.i(\"View\", this + \" View.setFrame(\" + left + \",\" + top + \",\"\n                        + right + \",\" + bottom + \")\");\n                }\n                if (this.mLeft != left || this.mRight != right || this.mTop != top || this.mBottom != bottom) {\n                    changed = true;\n                    let drawn = this.mPrivateFlags & View.PFLAG_DRAWN;\n                    let oldWidth = this.mRight - this.mLeft;\n                    let oldHeight = this.mBottom - this.mTop;\n                    let newWidth = right - left;\n                    let newHeight = bottom - top;\n                    let sizeChanged = (newWidth != oldWidth) || (newHeight != oldHeight);\n                    this.invalidate(sizeChanged);\n                    this.mLeft = left;\n                    this.mTop = top;\n                    this.mRight = right;\n                    this.mBottom = bottom;\n                    this.mPrivateFlags |= View.PFLAG_HAS_BOUNDS;\n                    if (sizeChanged) {\n                        if ((this.mPrivateFlags & View.PFLAG_PIVOT_EXPLICITLY_SET) == 0) {\n                            if (this.mTransformationInfo != null) {\n                                this.mTransformationInfo.mMatrixDirty = true;\n                            }\n                        }\n                        this.sizeChange(newWidth, newHeight, oldWidth, oldHeight);\n                    }\n                    if ((this.mViewFlags & View.VISIBILITY_MASK) == View.VISIBLE) {\n                        this.mPrivateFlags |= View.PFLAG_DRAWN;\n                        this.invalidate(sizeChanged);\n                    }\n                    this.mPrivateFlags |= drawn;\n                    this.mBackgroundSizeChanged = true;\n                }\n                return changed;\n            }\n            sizeChange(newWidth, newHeight, oldWidth, oldHeight) {\n                this.onSizeChanged(newWidth, newHeight, oldWidth, oldHeight);\n                if (this.mOverlay != null) {\n                    this.mOverlay.getOverlayView().setRight(newWidth);\n                    this.mOverlay.getOverlayView().setBottom(newHeight);\n                }\n            }\n            getHitRect(outRect) {\n                this.updateMatrix();\n                const info = this.mTransformationInfo;\n                if (info == null || info.mMatrixIsIdentity || this.mAttachInfo == null) {\n                    outRect.set(this.mLeft, this.mTop, this.mRight, this.mBottom);\n                }\n                else {\n                    const tmpRect = this.mAttachInfo.mTmpTransformRect;\n                    tmpRect.set(0, 0, this.getWidth(), this.getHeight());\n                    info.mMatrix.mapRect(tmpRect);\n                    outRect.set(Math.floor(tmpRect.left) + this.mLeft, Math.floor(tmpRect.top) + this.mTop, Math.floor(tmpRect.right) + this.mLeft, Math.floor(tmpRect.bottom) + this.mTop);\n                }\n            }\n            getFocusedRect(r) {\n                this.getDrawingRect(r);\n            }\n            getDrawingRect(outRect) {\n                outRect.left = this.mScrollX;\n                outRect.top = this.mScrollY;\n                outRect.right = this.mScrollX + (this.mRight - this.mLeft);\n                outRect.bottom = this.mScrollY + (this.mBottom - this.mTop);\n            }\n            getGlobalVisibleRect(r, globalOffset = null) {\n                let width = this.mRight - this.mLeft;\n                let height = this.mBottom - this.mTop;\n                if (width > 0 && height > 0) {\n                    r.set(0, 0, width, height);\n                    if (globalOffset != null) {\n                        globalOffset.set(-this.mScrollX, -this.mScrollY);\n                    }\n                    return this.mParent == null || this.mParent.getChildVisibleRect(this, r, globalOffset);\n                }\n                return false;\n            }\n            getLocationOnScreen(location) {\n                this.getLocationInWindow(location);\n                const info = this.mAttachInfo;\n            }\n            getLocationInWindow(location) {\n                if (location == null || location.length < 2) {\n                    throw Error(`new IllegalArgumentException(\"location must be an array of two integers\")`);\n                }\n                if (this.mAttachInfo == null) {\n                    location[0] = location[1] = 0;\n                    return;\n                }\n                let position = this.mAttachInfo.mTmpTransformLocation;\n                position[0] = position[1] = 0.0;\n                if (!this.hasIdentityMatrix()) {\n                    this.getMatrix().mapPoints(position);\n                }\n                position[0] += this.mLeft;\n                position[1] += this.mTop;\n                let viewParent = this.mParent;\n                while (viewParent instanceof View) {\n                    const view = viewParent;\n                    position[0] -= view.mScrollX;\n                    position[1] -= view.mScrollY;\n                    if (!view.hasIdentityMatrix()) {\n                        view.getMatrix().mapPoints(position);\n                    }\n                    position[0] += view.mLeft;\n                    position[1] += view.mTop;\n                    viewParent = view.mParent;\n                }\n                location[0] = Math.floor((position[0] + 0.5));\n                location[1] = Math.floor((position[1] + 0.5));\n            }\n            getWindowVisibleDisplayFrame(outRect) {\n                if (this.mAttachInfo != null) {\n                    let rootView = this.mAttachInfo.mRootView;\n                    let xy = [0, 0];\n                    rootView.getLocationOnScreen(xy);\n                    outRect.set(xy[0], xy[1], rootView.getWidth() + xy[0], rootView.getHeight() + xy[1]);\n                    return;\n                }\n                let dm = Resources.getSystem().getDisplayMetrics();\n                outRect.set(0, 0, dm.widthPixels, dm.heightPixels);\n            }\n            isVisibleToUser(boundInView = null) {\n                if (this.mAttachInfo != null) {\n                    if (this.mAttachInfo.mWindowVisibility != View.VISIBLE) {\n                        return false;\n                    }\n                    let current = this;\n                    while (current instanceof View) {\n                        let view = current;\n                        if (view.getAlpha() <= 0 || view.getTransitionAlpha() <= 0 || view.getVisibility() != View.VISIBLE) {\n                            return false;\n                        }\n                        current = view.mParent;\n                    }\n                    let visibleRect = this.mAttachInfo.mTmpInvalRect;\n                    let offset = this.mAttachInfo.mPoint;\n                    if (!this.getGlobalVisibleRect(visibleRect, offset)) {\n                        return false;\n                    }\n                    if (boundInView != null) {\n                        visibleRect.offset(-offset.x, -offset.y);\n                        return boundInView.intersect(visibleRect);\n                    }\n                    return true;\n                }\n                return false;\n            }\n            getMeasuredWidth() {\n                return this.mMeasuredWidth & View.MEASURED_SIZE_MASK;\n            }\n            getMeasuredWidthAndState() {\n                return this.mMeasuredWidth;\n            }\n            getMeasuredHeight() {\n                return this.mMeasuredHeight & View.MEASURED_SIZE_MASK;\n            }\n            getMeasuredHeightAndState() {\n                return this.mMeasuredHeight;\n            }\n            getMeasuredState() {\n                return (this.mMeasuredWidth & View.MEASURED_STATE_MASK)\n                    | ((this.mMeasuredHeight >> View.MEASURED_HEIGHT_STATE_SHIFT)\n                        & (View.MEASURED_STATE_MASK >> View.MEASURED_HEIGHT_STATE_SHIFT));\n            }\n            measure(widthMeasureSpec, heightMeasureSpec) {\n                let key = widthMeasureSpec + ',' + heightMeasureSpec;\n                if (this.mMeasureCache == null)\n                    this.mMeasureCache = new Map();\n                if ((this.mPrivateFlags & View.PFLAG_FORCE_LAYOUT) == View.PFLAG_FORCE_LAYOUT ||\n                    widthMeasureSpec != this.mOldWidthMeasureSpec ||\n                    heightMeasureSpec != this.mOldHeightMeasureSpec) {\n                    this.mPrivateFlags &= ~View.PFLAG_MEASURED_DIMENSION_SET;\n                    let cacheValue = (this.mPrivateFlags & View.PFLAG_FORCE_LAYOUT) == View.PFLAG_FORCE_LAYOUT ? null : this.mMeasureCache.get(key);\n                    if (cacheValue == null) {\n                        this.onMeasure(widthMeasureSpec, heightMeasureSpec);\n                        this.mPrivateFlags3 &= ~View.PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT;\n                    }\n                    else {\n                        this.setMeasuredDimension(cacheValue[0], cacheValue[1]);\n                        this.mPrivateFlags3 |= View.PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT;\n                    }\n                    if ((this.mPrivateFlags & View.PFLAG_MEASURED_DIMENSION_SET) != View.PFLAG_MEASURED_DIMENSION_SET) {\n                        throw new Error(\"onMeasure() did not set the\"\n                            + \" measured dimension by calling\"\n                            + \" setMeasuredDimension()\");\n                    }\n                    this.mPrivateFlags |= View.PFLAG_LAYOUT_REQUIRED;\n                }\n                this.mOldWidthMeasureSpec = widthMeasureSpec;\n                this.mOldHeightMeasureSpec = heightMeasureSpec;\n                this.mMeasureCache.set(key, [this.mMeasuredWidth, this.mMeasuredHeight]);\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                this.setMeasuredDimension(View.getDefaultSize(this.getSuggestedMinimumWidth(), widthMeasureSpec), View.getDefaultSize(this.getSuggestedMinimumHeight(), heightMeasureSpec));\n            }\n            setMeasuredDimension(measuredWidth, measuredHeight) {\n                this.mMeasuredWidth = measuredWidth;\n                this.mMeasuredHeight = measuredHeight;\n                this.mPrivateFlags |= View.PFLAG_MEASURED_DIMENSION_SET;\n            }\n            static combineMeasuredStates(curState, newState) {\n                return curState | newState;\n            }\n            static resolveSize(size, measureSpec) {\n                return View.resolveSizeAndState(size, measureSpec, 0) & View.MEASURED_SIZE_MASK;\n            }\n            static resolveSizeAndState(size, measureSpec, childMeasuredState) {\n                let MeasureSpec = View.MeasureSpec;\n                let result = size;\n                let specMode = MeasureSpec.getMode(measureSpec);\n                let specSize = MeasureSpec.getSize(measureSpec);\n                switch (specMode) {\n                    case MeasureSpec.UNSPECIFIED:\n                        result = size;\n                        break;\n                    case MeasureSpec.AT_MOST:\n                        if (specSize < size) {\n                            result = specSize | View.MEASURED_STATE_TOO_SMALL;\n                        }\n                        else {\n                            result = size;\n                        }\n                        break;\n                    case MeasureSpec.EXACTLY:\n                        result = specSize;\n                        break;\n                }\n                return result | (childMeasuredState & View.MEASURED_STATE_MASK);\n            }\n            static getDefaultSize(size, measureSpec) {\n                let MeasureSpec = View.MeasureSpec;\n                let result = size;\n                let specMode = MeasureSpec.getMode(measureSpec);\n                let specSize = MeasureSpec.getSize(measureSpec);\n                switch (specMode) {\n                    case MeasureSpec.UNSPECIFIED:\n                        result = size;\n                        break;\n                    case MeasureSpec.AT_MOST:\n                    case MeasureSpec.EXACTLY:\n                        result = specSize;\n                        break;\n                }\n                return result;\n            }\n            getSuggestedMinimumHeight() {\n                return (this.mBackground == null) ? this.mMinHeight :\n                    Math.max(this.mMinHeight, this.mBackground.getMinimumHeight());\n            }\n            getSuggestedMinimumWidth() {\n                return (this.mBackground == null) ? this.mMinWidth :\n                    Math.max(this.mMinWidth, this.mBackground.getMinimumWidth());\n            }\n            getMinimumHeight() {\n                return this.mMinHeight;\n            }\n            setMinimumHeight(minHeight) {\n                this.mMinHeight = minHeight;\n                this.requestLayout();\n            }\n            getMinimumWidth() {\n                return this.mMinWidth;\n            }\n            setMinimumWidth(minWidth) {\n                this.mMinWidth = minWidth;\n                this.requestLayout();\n            }\n            getAnimation() {\n                return this.mCurrentAnimation;\n            }\n            startAnimation(animation) {\n                animation.setStartTime(Animation.START_ON_FIRST_FRAME);\n                this.setAnimation(animation);\n                this.invalidateParentCaches();\n                this.invalidate(true);\n            }\n            clearAnimation() {\n                if (this.mCurrentAnimation != null) {\n                    this.mCurrentAnimation.detach();\n                }\n                this.mCurrentAnimation = null;\n                this.invalidateParentIfNeeded();\n            }\n            setAnimation(animation) {\n                this.mCurrentAnimation = animation;\n                if (animation != null) {\n                    animation.reset();\n                }\n            }\n            onAnimationStart() {\n                this.mPrivateFlags |= View.PFLAG_ANIMATION_STARTED;\n            }\n            onAnimationEnd() {\n                this.mPrivateFlags &= ~View.PFLAG_ANIMATION_STARTED;\n            }\n            onSetAlpha(alpha) {\n                return false;\n            }\n            _invalidateRect(l, t, r, b) {\n                if (this.skipInvalidate()) {\n                    return;\n                }\n                if ((this.mPrivateFlags & (View.PFLAG_DRAWN | View.PFLAG_HAS_BOUNDS)) == (View.PFLAG_DRAWN | View.PFLAG_HAS_BOUNDS) ||\n                    (this.mPrivateFlags & View.PFLAG_DRAWING_CACHE_VALID) == View.PFLAG_DRAWING_CACHE_VALID ||\n                    (this.mPrivateFlags & View.PFLAG_INVALIDATED) != View.PFLAG_INVALIDATED) {\n                    this.mPrivateFlags &= ~View.PFLAG_DRAWING_CACHE_VALID;\n                    this.mPrivateFlags |= View.PFLAG_INVALIDATED;\n                    this.mPrivateFlags |= View.PFLAG_DIRTY;\n                    const p = this.mParent;\n                    const ai = this.mAttachInfo;\n                    if (p != null && ai != null && l < r && t < b) {\n                        const scrollX = this.mScrollX;\n                        const scrollY = this.mScrollY;\n                        const tmpr = ai.mTmpInvalRect;\n                        tmpr.set(l - scrollX, t - scrollY, r - scrollX, b - scrollY);\n                        p.invalidateChild(this, tmpr);\n                    }\n                }\n            }\n            _invalidateCache(invalidateCache = true) {\n                if (this.skipInvalidate()) {\n                    return;\n                }\n                if ((this.mPrivateFlags & (View.PFLAG_DRAWN | View.PFLAG_HAS_BOUNDS)) == (View.PFLAG_DRAWN | View.PFLAG_HAS_BOUNDS) ||\n                    (invalidateCache && (this.mPrivateFlags & View.PFLAG_DRAWING_CACHE_VALID) == View.PFLAG_DRAWING_CACHE_VALID) ||\n                    (this.mPrivateFlags & View.PFLAG_INVALIDATED) != View.PFLAG_INVALIDATED || this.isOpaque() != this.mLastIsOpaque) {\n                    this.mLastIsOpaque = this.isOpaque();\n                    this.mPrivateFlags &= ~View.PFLAG_DRAWN;\n                    this.mPrivateFlags |= View.PFLAG_DIRTY;\n                    if (invalidateCache) {\n                        this.mPrivateFlags |= View.PFLAG_INVALIDATED;\n                        this.mPrivateFlags &= ~View.PFLAG_DRAWING_CACHE_VALID;\n                    }\n                    const ai = this.mAttachInfo;\n                    const p = this.mParent;\n                    if (p != null && ai != null) {\n                        const r = ai.mTmpInvalRect;\n                        r.set(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop);\n                        p.invalidateChild(this, r);\n                    }\n                }\n            }\n            invalidate(...args) {\n                if (args.length === 0) {\n                    this._invalidateCache(true);\n                }\n                else if (args.length === 1 && args[0] instanceof Rect) {\n                    let rect = args[0];\n                    this._invalidateRect(rect.left, rect.top, rect.right, rect.bottom);\n                }\n                else if (args.length === 1) {\n                    this._invalidateCache(args[0]);\n                }\n                else if (args.length === 4) {\n                    this._invalidateRect(...args);\n                }\n            }\n            invalidateViewProperty(invalidateParent, forceRedraw) {\n                if ((this.mPrivateFlags & View.PFLAG_DRAW_ANIMATION) == View.PFLAG_DRAW_ANIMATION) {\n                    if (invalidateParent) {\n                        this.invalidateParentCaches();\n                    }\n                    if (forceRedraw) {\n                        this.mPrivateFlags |= View.PFLAG_DRAWN;\n                    }\n                    this.invalidate(false);\n                }\n                else {\n                    const ai = this.mAttachInfo;\n                    const p = this.mParent;\n                    if (p != null && ai != null) {\n                        const r = ai.mTmpInvalRect;\n                        r.set(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop);\n                        if (this.mParent instanceof view_1.ViewGroup) {\n                            this.mParent.invalidateChildFast(this, r);\n                        }\n                        else {\n                            this.mParent.invalidateChild(this, r);\n                        }\n                    }\n                }\n            }\n            invalidateParentCaches() {\n                if (this.mParent instanceof View) {\n                    this.mParent.mPrivateFlags |= View.PFLAG_INVALIDATED;\n                }\n            }\n            invalidateParentIfNeeded() {\n            }\n            postInvalidate(l, t, r, b) {\n                this.postInvalidateDelayed(0, l, t, r, b);\n            }\n            postInvalidateDelayed(delayMilliseconds, left, top, right, bottom) {\n                const attachInfo = this.mAttachInfo;\n                if (attachInfo != null) {\n                    if (!Number.isInteger(left) || !Number.isInteger(top) || !Number.isInteger(right) || !Number.isInteger(bottom)) {\n                        attachInfo.mViewRootImpl.dispatchInvalidateDelayed(this, delayMilliseconds);\n                    }\n                    else {\n                        const info = View.AttachInfo.InvalidateInfo.obtain();\n                        info.target = this;\n                        info.left = left;\n                        info.top = top;\n                        info.right = right;\n                        info.bottom = bottom;\n                        attachInfo.mViewRootImpl.dispatchInvalidateRectDelayed(info, delayMilliseconds);\n                    }\n                }\n            }\n            postInvalidateOnAnimation(left, top, right, bottom) {\n                const attachInfo = this.mAttachInfo;\n                if (attachInfo != null) {\n                    if (!Number.isInteger(left) || !Number.isInteger(top) || !Number.isInteger(right) || !Number.isInteger(bottom)) {\n                        attachInfo.mViewRootImpl.dispatchInvalidateOnAnimation(this);\n                    }\n                    else {\n                        const info = View.AttachInfo.InvalidateInfo.obtain();\n                        info.target = this;\n                        info.left = left;\n                        info.top = top;\n                        info.right = right;\n                        info.bottom = bottom;\n                        attachInfo.mViewRootImpl.dispatchInvalidateRectOnAnimation(info);\n                    }\n                }\n            }\n            skipInvalidate() {\n                return (this.mViewFlags & View.VISIBILITY_MASK) != View.VISIBLE\n                    && this.mCurrentAnimation == null;\n            }\n            isOpaque() {\n                return (this.mPrivateFlags & View.PFLAG_OPAQUE_MASK) == View.PFLAG_OPAQUE_MASK &&\n                    this.getFinalAlpha() >= 1;\n            }\n            computeOpaqueFlags() {\n                if (this.mBackground != null && this.mBackground.getOpacity() == PixelFormat.OPAQUE) {\n                    this.mPrivateFlags |= View.PFLAG_OPAQUE_BACKGROUND;\n                }\n                else {\n                    this.mPrivateFlags &= ~View.PFLAG_OPAQUE_BACKGROUND;\n                }\n                const flags = this.mViewFlags;\n                if (((flags & View.SCROLLBARS_VERTICAL) == 0 && (flags & View.SCROLLBARS_HORIZONTAL) == 0)) {\n                    this.mPrivateFlags |= View.PFLAG_OPAQUE_SCROLLBARS;\n                }\n                else {\n                    this.mPrivateFlags &= ~View.PFLAG_OPAQUE_SCROLLBARS;\n                }\n            }\n            setLayerType(layerType) {\n                if (layerType < View.LAYER_TYPE_NONE || layerType > View.LAYER_TYPE_SOFTWARE) {\n                    throw Error(`new IllegalArgumentException(\"Layer type can only be one of: LAYER_TYPE_NONE, \" + \"LAYER_TYPE_SOFTWARE\")`);\n                }\n                if (layerType == this.mLayerType) {\n                    return;\n                }\n                switch (this.mLayerType) {\n                    case View.LAYER_TYPE_SOFTWARE:\n                        this.destroyDrawingCache();\n                        break;\n                    default:\n                        break;\n                }\n                this.mLayerType = layerType;\n                const layerDisabled = this.mLayerType == View.LAYER_TYPE_NONE;\n                this.mLocalDirtyRect = layerDisabled ? null : new Rect();\n                this.invalidateParentCaches();\n                this.invalidate(true);\n            }\n            getLayerType() {\n                return this.mLayerType;\n            }\n            setClipBounds(clipBounds) {\n                if (clipBounds != null) {\n                    if (clipBounds.equals(this.mClipBounds)) {\n                        return;\n                    }\n                    if (this.mClipBounds == null) {\n                        this.invalidate();\n                        this.mClipBounds = new Rect(clipBounds);\n                    }\n                    else {\n                        this.invalidate(Math.min(this.mClipBounds.left, clipBounds.left), Math.min(this.mClipBounds.top, clipBounds.top), Math.max(this.mClipBounds.right, clipBounds.right), Math.max(this.mClipBounds.bottom, clipBounds.bottom));\n                        this.mClipBounds.set(clipBounds);\n                    }\n                }\n                else {\n                    if (this.mClipBounds != null) {\n                        this.invalidate();\n                        this.mClipBounds = null;\n                    }\n                }\n            }\n            getClipBounds() {\n                return (this.mClipBounds != null) ? new Rect(this.mClipBounds) : null;\n            }\n            setCornerRadius(radiusTopLeft, radiusTopRight = radiusTopLeft, radiusBottomRight = radiusTopRight, radiusBottomLeft = radiusBottomRight) {\n                this.setCornerRadiusTopLeft(radiusTopLeft);\n                this.setCornerRadiusTopRight(radiusTopRight);\n                this.setCornerRadiusBottomRight(radiusBottomRight);\n                this.setCornerRadiusBottomLeft(radiusBottomLeft);\n            }\n            setCornerRadiusTopLeft(value) {\n                if (this.mCornerRadiusTopLeft != value) {\n                    this.mCornerRadiusTopLeft = value;\n                    this.mShadowDrawable = null;\n                    this.invalidate();\n                }\n            }\n            getCornerRadiusTopLeft() {\n                return this.mCornerRadiusTopLeft;\n            }\n            setCornerRadiusTopRight(value) {\n                if (this.mCornerRadiusTopRight != value) {\n                    this.mCornerRadiusTopRight = value;\n                    this.mShadowDrawable = null;\n                    this.invalidate();\n                }\n            }\n            getCornerRadiusTopRight() {\n                return this.mCornerRadiusTopRight;\n            }\n            setCornerRadiusBottomRight(value) {\n                if (this.mCornerRadiusBottomRight != value) {\n                    this.mCornerRadiusBottomRight = value;\n                    this.mShadowDrawable = null;\n                    this.invalidate();\n                }\n            }\n            getCornerRadiusBottomRight() {\n                return this.mCornerRadiusBottomRight;\n            }\n            setCornerRadiusBottomLeft(value) {\n                if (this.mCornerRadiusBottomLeft != value) {\n                    this.mCornerRadiusBottomLeft = value;\n                    this.mShadowDrawable = null;\n                    this.invalidate();\n                }\n            }\n            getCornerRadiusBottomLeft() {\n                return this.mCornerRadiusBottomLeft;\n            }\n            setShadowView(radius, dx, dy, color) {\n                if (!this.mShadowPaint)\n                    this.mShadowPaint = new Paint();\n                this.mShadowPaint.setShadowLayer(radius, dx, dy, color);\n                this.invalidate();\n            }\n            getDrawingTime() {\n                return this.getViewRootImpl() != null ? this.getViewRootImpl().mDrawingTime : 0;\n            }\n            drawFromParent(canvas, parent, drawingTime) {\n                let useDisplayListProperties = false;\n                let more = false;\n                let childHasIdentityMatrix = this.hasIdentityMatrix();\n                let flags = parent.mGroupFlags;\n                if ((flags & view_1.ViewGroup.FLAG_CLEAR_TRANSFORMATION) == view_1.ViewGroup.FLAG_CLEAR_TRANSFORMATION) {\n                    parent.getChildTransformation().clear();\n                    parent.mGroupFlags &= ~view_1.ViewGroup.FLAG_CLEAR_TRANSFORMATION;\n                }\n                let transformToApply = null;\n                let concatMatrix = false;\n                let scalingRequired = false;\n                let caching = false;\n                let layerType = this.getLayerType();\n                const hardwareAccelerated = false;\n                const nativeAccelerated = canvas.isNativeAccelerated();\n                if ((flags & view_1.ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE) != 0 ||\n                    (flags & view_1.ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE) != 0) {\n                    caching = true;\n                }\n                else {\n                    caching = (layerType != View.LAYER_TYPE_NONE) || hardwareAccelerated || nativeAccelerated;\n                }\n                const a = this.getAnimation();\n                if (a != null) {\n                    more = this.drawAnimation(parent, drawingTime, a, scalingRequired);\n                    concatMatrix = a.willChangeTransformationMatrix();\n                    if (concatMatrix) {\n                        this.mPrivateFlags3 |= View.PFLAG3_VIEW_IS_ANIMATING_TRANSFORM;\n                    }\n                    transformToApply = parent.getChildTransformation();\n                }\n                else {\n                    if (!useDisplayListProperties && (flags & view_1.ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) {\n                        const t = parent.getChildTransformation();\n                        const hasTransform = parent.getChildStaticTransformation(this, t);\n                        if (hasTransform) {\n                            const transformType = t.getTransformationType();\n                            transformToApply = transformType != Transformation.TYPE_IDENTITY ? t : null;\n                            concatMatrix = (transformType & Transformation.TYPE_MATRIX) != 0;\n                        }\n                    }\n                }\n                concatMatrix = !childHasIdentityMatrix || concatMatrix;\n                this.mPrivateFlags |= View.PFLAG_DRAWN;\n                if (!concatMatrix &&\n                    (flags & (view_1.ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS |\n                        view_1.ViewGroup.FLAG_CLIP_CHILDREN)) == view_1.ViewGroup.FLAG_CLIP_CHILDREN &&\n                    canvas.quickReject(this.mLeft, this.mTop, this.mRight, this.mBottom) &&\n                    (this.mPrivateFlags & View.PFLAG_DRAW_ANIMATION) == 0) {\n                    this.mPrivateFlags2 |= View.PFLAG2_VIEW_QUICK_REJECTED;\n                    return more;\n                }\n                this.mPrivateFlags2 &= ~View.PFLAG2_VIEW_QUICK_REJECTED;\n                let cache = null;\n                if (caching) {\n                    if (layerType != View.LAYER_TYPE_NONE) {\n                        layerType = View.LAYER_TYPE_SOFTWARE;\n                        this.buildDrawingCache(true);\n                    }\n                    cache = this.getDrawingCache(true);\n                }\n                this.computeScroll();\n                let sx = this.mScrollX;\n                let sy = this.mScrollY;\n                this.requestSyncBoundToElement();\n                let hasNoCache = cache == null;\n                let offsetForScroll = cache == null;\n                let restoreTo = canvas.save();\n                if (offsetForScroll) {\n                    canvas.translate(this.mLeft - sx, this.mTop - sy);\n                }\n                else {\n                    canvas.translate(this.mLeft, this.mTop);\n                }\n                let alpha = this.getAlpha() * this.getTransitionAlpha();\n                if (transformToApply != null || alpha < 1 || !this.hasIdentityMatrix() || (this.mPrivateFlags3 & View.PFLAG3_VIEW_IS_ANIMATING_ALPHA) == View.PFLAG3_VIEW_IS_ANIMATING_ALPHA) {\n                    if (transformToApply != null || !childHasIdentityMatrix) {\n                        let transX = 0;\n                        let transY = 0;\n                        if (offsetForScroll) {\n                            transX = -sx;\n                            transY = -sy;\n                        }\n                        if (transformToApply != null) {\n                            if (concatMatrix) {\n                                canvas.translate(-transX, -transY);\n                                canvas.concat(transformToApply.getMatrix());\n                                canvas.translate(transX, transY);\n                                parent.mGroupFlags |= view_1.ViewGroup.FLAG_CLEAR_TRANSFORMATION;\n                            }\n                            let transformAlpha = transformToApply.getAlpha();\n                            if (transformAlpha < 1) {\n                                alpha *= transformAlpha;\n                                parent.mGroupFlags |= view_1.ViewGroup.FLAG_CLEAR_TRANSFORMATION;\n                            }\n                        }\n                        if (!childHasIdentityMatrix && !useDisplayListProperties) {\n                            canvas.translate(-transX, -transY);\n                            canvas.concat(this.getMatrix());\n                            canvas.translate(transX, transY);\n                        }\n                    }\n                    if (alpha < 1 || (this.mPrivateFlags3 & View.PFLAG3_VIEW_IS_ANIMATING_ALPHA) == View.PFLAG3_VIEW_IS_ANIMATING_ALPHA) {\n                        if (alpha < 1) {\n                            this.mPrivateFlags3 |= View.PFLAG3_VIEW_IS_ANIMATING_ALPHA;\n                        }\n                        else {\n                            this.mPrivateFlags3 &= ~View.PFLAG3_VIEW_IS_ANIMATING_ALPHA;\n                        }\n                        parent.mGroupFlags |= view_1.ViewGroup.FLAG_CLEAR_TRANSFORMATION;\n                        if (hasNoCache) {\n                            const multipliedAlpha = Math.floor((255 * alpha));\n                            if (!this.onSetAlpha(multipliedAlpha)) {\n                                canvas.multiplyGlobalAlpha(alpha);\n                            }\n                            else {\n                                this.mPrivateFlags |= View.PFLAG_ALPHA_SET;\n                            }\n                        }\n                    }\n                }\n                else if ((this.mPrivateFlags & View.PFLAG_ALPHA_SET) == View.PFLAG_ALPHA_SET) {\n                    this.onSetAlpha(255);\n                    this.mPrivateFlags &= ~View.PFLAG_ALPHA_SET;\n                }\n                if (this.mShadowPaint != null)\n                    this.drawShadow(canvas);\n                if ((flags & view_1.ViewGroup.FLAG_CLIP_CHILDREN) == view_1.ViewGroup.FLAG_CLIP_CHILDREN &&\n                    !useDisplayListProperties && cache == null) {\n                    if (offsetForScroll) {\n                        canvas.clipRect(sx, sy, sx + (this.mRight - this.mLeft), sy + (this.mBottom - this.mTop), this.mCornerRadiusTopLeft, this.mCornerRadiusTopRight, this.mCornerRadiusBottomRight, this.mCornerRadiusBottomLeft);\n                    }\n                    else {\n                        if (!scalingRequired || cache == null) {\n                            canvas.clipRect(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop, this.mCornerRadiusTopLeft, this.mCornerRadiusTopRight, this.mCornerRadiusBottomRight, this.mCornerRadiusBottomLeft);\n                        }\n                        else {\n                            canvas.clipRect(0, 0, cache.getWidth(), cache.getHeight(), this.mCornerRadiusTopLeft, this.mCornerRadiusTopRight, this.mCornerRadiusBottomRight, this.mCornerRadiusBottomLeft);\n                        }\n                    }\n                }\n                if (hasNoCache) {\n                    if ((this.mPrivateFlags & View.PFLAG_SKIP_DRAW) == View.PFLAG_SKIP_DRAW) {\n                        this.mPrivateFlags &= ~View.PFLAG_DIRTY_MASK;\n                        this.dispatchDraw(canvas);\n                    }\n                    else {\n                        this.draw(canvas);\n                    }\n                }\n                else if (cache != null) {\n                    this.mPrivateFlags &= ~View.PFLAG_DIRTY_MASK;\n                    canvas.multiplyGlobalAlpha(alpha);\n                    if (layerType == View.LAYER_TYPE_NONE) {\n                        if (alpha < 1) {\n                            parent.mGroupFlags |= view_1.ViewGroup.FLAG_ALPHA_LOWER_THAN_ONE;\n                        }\n                        else if ((flags & view_1.ViewGroup.FLAG_ALPHA_LOWER_THAN_ONE) != 0) {\n                            parent.mGroupFlags &= ~view_1.ViewGroup.FLAG_ALPHA_LOWER_THAN_ONE;\n                        }\n                    }\n                    canvas.clipRect(0, 0, cache.getWidth(), cache.getHeight(), this.mCornerRadiusTopLeft, this.mCornerRadiusTopRight, this.mCornerRadiusBottomRight, this.mCornerRadiusBottomLeft);\n                    canvas.drawCanvas(cache, 0, 0);\n                }\n                if (restoreTo >= 0) {\n                    canvas.restoreToCount(restoreTo);\n                }\n                if (a != null && !more) {\n                    if (!hardwareAccelerated && !a.getFillAfter()) {\n                        this.onSetAlpha(255);\n                    }\n                    parent.finishAnimatingView(this, a);\n                }\n                return more;\n            }\n            drawShadow(canvas) {\n                let shadowPaint = this.mShadowPaint;\n                if (!shadowPaint || !shadowPaint.shadowRadius)\n                    return;\n                let color = shadowPaint.shadowColor;\n                if (!this.mShadowDrawable) {\n                    let drawable = new RoundRectDrawable(shadowPaint.shadowColor, this.mCornerRadiusTopLeft, this.mCornerRadiusTopRight, this.mCornerRadiusBottomLeft, this.mCornerRadiusBottomRight);\n                    this.mShadowDrawable = new ShadowDrawable(drawable, shadowPaint.shadowRadius, shadowPaint.shadowDx, shadowPaint.shadowDy, shadowPaint.shadowColor);\n                }\n                this.mShadowDrawable.draw(canvas);\n            }\n            draw(canvas) {\n                if (this.mClipBounds != null) {\n                    canvas.clipRect(this.mClipBounds);\n                }\n                let privateFlags = this.mPrivateFlags;\n                const dirtyOpaque = (privateFlags & View.PFLAG_DIRTY_MASK) == View.PFLAG_DIRTY_OPAQUE &&\n                    (this.getViewRootImpl() == null || !this.getViewRootImpl().mIgnoreDirtyState);\n                this.mPrivateFlags = (privateFlags & ~View.PFLAG_DIRTY_MASK) | View.PFLAG_DRAWN;\n                if (!dirtyOpaque) {\n                    let background = this.mBackground;\n                    if (background != null) {\n                        let scrollX = this.mScrollX;\n                        let scrollY = this.mScrollY;\n                        if (this.mBackgroundSizeChanged) {\n                            background.setBounds(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop);\n                            this.mBackgroundSizeChanged = false;\n                        }\n                        if ((scrollX | scrollY) == 0) {\n                            background.draw(canvas);\n                        }\n                        else {\n                            canvas.translate(scrollX, scrollY);\n                            background.draw(canvas);\n                            canvas.translate(-scrollX, -scrollY);\n                        }\n                    }\n                }\n                if (!dirtyOpaque)\n                    this.onDraw(canvas);\n                this.dispatchDraw(canvas);\n                this.onDrawScrollBars(canvas);\n                if (this.mOverlay != null && !this.mOverlay.isEmpty()) {\n                    this.mOverlay.getOverlayView().dispatchDraw(canvas);\n                }\n            }\n            onDraw(canvas) {\n            }\n            dispatchDraw(canvas) {\n            }\n            drawAnimation(parent, drawingTime, a, scalingRequired) {\n                let invalidationTransform;\n                const flags = parent.mGroupFlags;\n                const initialized = a.isInitialized();\n                if (!initialized) {\n                    a.initialize(this.mRight - this.mLeft, this.mBottom - this.mTop, parent.getWidth(), parent.getHeight());\n                    a.initializeInvalidateRegion(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop);\n                    if (this.mAttachInfo != null)\n                        a.setListenerHandler(this.mAttachInfo.mHandler);\n                    this.onAnimationStart();\n                }\n                const t = parent.getChildTransformation();\n                let more = a.getTransformation(drawingTime, t, 1);\n                invalidationTransform = t;\n                if (more) {\n                    if (!a.willChangeBounds()) {\n                        if ((flags & (view_1.ViewGroup.FLAG_OPTIMIZE_INVALIDATE | view_1.ViewGroup.FLAG_ANIMATION_DONE)) == view_1.ViewGroup.FLAG_OPTIMIZE_INVALIDATE) {\n                            parent.mGroupFlags |= view_1.ViewGroup.FLAG_INVALIDATE_REQUIRED;\n                        }\n                        else if ((flags & view_1.ViewGroup.FLAG_INVALIDATE_REQUIRED) == 0) {\n                            parent.mPrivateFlags |= View.PFLAG_DRAW_ANIMATION;\n                            parent.invalidate(this.mLeft, this.mTop, this.mRight, this.mBottom);\n                        }\n                    }\n                    else {\n                        if (parent.mInvalidateRegion == null) {\n                            parent.mInvalidateRegion = new RectF();\n                        }\n                        const region = parent.mInvalidateRegion;\n                        a.getInvalidateRegion(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop, region, invalidationTransform);\n                        parent.mPrivateFlags |= View.PFLAG_DRAW_ANIMATION;\n                        const left = this.mLeft + Math.floor(region.left);\n                        const top = this.mTop + Math.floor(region.top);\n                        parent.invalidate(left, top, left + Math.floor((region.width() + .5)), top + Math.floor((region.height() + .5)));\n                    }\n                }\n                return more;\n            }\n            onDrawScrollBars(canvas) {\n                const cache = this.mScrollCache;\n                if (cache != null) {\n                    let state = cache.state;\n                    if (state == ScrollabilityCache.OFF) {\n                        return;\n                    }\n                    let invalidate = false;\n                    if (state == ScrollabilityCache.FADING) {\n                        cache._computeAlphaToScrollBar();\n                        invalidate = true;\n                    }\n                    else {\n                        cache.scrollBar.setAlpha(255);\n                    }\n                    const viewFlags = this.mViewFlags;\n                    const drawHorizontalScrollBar = (viewFlags & View.SCROLLBARS_HORIZONTAL) == View.SCROLLBARS_HORIZONTAL;\n                    const drawVerticalScrollBar = (viewFlags & View.SCROLLBARS_VERTICAL) == View.SCROLLBARS_VERTICAL\n                        && !this.isVerticalScrollBarHidden();\n                    if (drawVerticalScrollBar || drawHorizontalScrollBar) {\n                        const width = this.mRight - this.mLeft;\n                        const height = this.mBottom - this.mTop;\n                        const scrollBar = cache.scrollBar;\n                        const scrollX = this.mScrollX;\n                        const scrollY = this.mScrollY;\n                        const inside = true;\n                        let left;\n                        let top;\n                        let right;\n                        let bottom;\n                        if (drawHorizontalScrollBar) {\n                            let size = scrollBar.getSize(false);\n                            if (size <= 0) {\n                                size = cache.scrollBarSize;\n                            }\n                            scrollBar.setParameters(this.computeHorizontalScrollRange(), this.computeHorizontalScrollOffset(), this.computeHorizontalScrollExtent(), false);\n                            const verticalScrollBarGap = drawVerticalScrollBar ?\n                                this.getVerticalScrollbarWidth() : 0;\n                            top = scrollY + height - size;\n                            left = scrollX + (this.mPaddingLeft);\n                            right = scrollX + width - -verticalScrollBarGap;\n                            bottom = top + size;\n                            this.onDrawHorizontalScrollBar(canvas, scrollBar, left, top, right, bottom);\n                            if (invalidate) {\n                                this.invalidate(left, top, right, bottom);\n                            }\n                        }\n                        if (drawVerticalScrollBar) {\n                            let size = scrollBar.getSize(true);\n                            if (size <= 0) {\n                                size = cache.scrollBarSize;\n                            }\n                            scrollBar.setParameters(this.computeVerticalScrollRange(), this.computeVerticalScrollOffset(), this.computeVerticalScrollExtent(), true);\n                            left = scrollX + width - size;\n                            top = scrollY + (this.mPaddingTop);\n                            right = left + size;\n                            bottom = scrollY + height;\n                            this.onDrawVerticalScrollBar(canvas, scrollBar, left, top, right, bottom);\n                            if (invalidate) {\n                                this.invalidate(left, top, right, bottom);\n                            }\n                        }\n                    }\n                }\n            }\n            isVerticalScrollBarHidden() {\n                return false;\n            }\n            onDrawHorizontalScrollBar(canvas, scrollBar, l, t, r, b) {\n                scrollBar.setBounds(l, t, r, b);\n                scrollBar.draw(canvas);\n            }\n            onDrawVerticalScrollBar(canvas, scrollBar, l, t, r, b) {\n                scrollBar.setBounds(l, t, r, b);\n                scrollBar.draw(canvas);\n            }\n            isHardwareAccelerated() {\n                return false;\n            }\n            setDrawingCacheEnabled(enabled) {\n                this.mCachingFailed = false;\n                this.setFlags(enabled ? View.DRAWING_CACHE_ENABLED : 0, View.DRAWING_CACHE_ENABLED);\n            }\n            isDrawingCacheEnabled() {\n                return (this.mViewFlags & View.DRAWING_CACHE_ENABLED) == View.DRAWING_CACHE_ENABLED;\n            }\n            getDrawingCache(autoScale = false) {\n                if ((this.mViewFlags & View.WILL_NOT_CACHE_DRAWING) == View.WILL_NOT_CACHE_DRAWING) {\n                    return null;\n                }\n                if ((this.mViewFlags & View.DRAWING_CACHE_ENABLED) == View.DRAWING_CACHE_ENABLED) {\n                    this.buildDrawingCache(autoScale);\n                }\n                return this.mUnscaledDrawingCache;\n            }\n            setDrawingCacheBackgroundColor(color) {\n                if (color != this.mDrawingCacheBackgroundColor) {\n                    this.mDrawingCacheBackgroundColor = color;\n                    this.mPrivateFlags &= ~View.PFLAG_DRAWING_CACHE_VALID;\n                }\n            }\n            getDrawingCacheBackgroundColor() {\n                return this.mDrawingCacheBackgroundColor;\n            }\n            destroyDrawingCache() {\n                if (this.mUnscaledDrawingCache != null) {\n                    this.mUnscaledDrawingCache.recycle();\n                    this.mUnscaledDrawingCache = null;\n                }\n            }\n            buildDrawingCache(autoScale = false) {\n                if ((this.mPrivateFlags & View.PFLAG_DRAWING_CACHE_VALID) == 0 || this.mUnscaledDrawingCache == null) {\n                    this.mCachingFailed = false;\n                    let width = this.mRight - this.mLeft;\n                    let height = this.mBottom - this.mTop;\n                    const attachInfo = this.mAttachInfo;\n                    const drawingCacheBackgroundColor = this.mDrawingCacheBackgroundColor;\n                    const opaque = drawingCacheBackgroundColor != 0 || this.isOpaque();\n                    const projectedBitmapSize = width * height * 4;\n                    const drawingCacheSize = view_1.ViewConfiguration.get().getScaledMaximumDrawingCacheSize();\n                    if (width <= 0 || height <= 0 || projectedBitmapSize > drawingCacheSize) {\n                        if (width > 0 && height > 0) {\n                            Log.w(View.VIEW_LOG_TAG, \"View too large to fit into drawing cache, needs \" + projectedBitmapSize + \" bytes, only \" + drawingCacheSize + \" available\");\n                        }\n                        this.destroyDrawingCache();\n                        this.mCachingFailed = true;\n                        return;\n                    }\n                    if (this.mUnscaledDrawingCache &&\n                        (this.mUnscaledDrawingCache.getWidth() !== width || this.mUnscaledDrawingCache.getHeight() !== height)) {\n                        this.mUnscaledDrawingCache.recycle();\n                        this.mUnscaledDrawingCache = null;\n                    }\n                    if (this.mUnscaledDrawingCache) {\n                        this.mUnscaledDrawingCache.clearColor();\n                    }\n                    else {\n                        this.mUnscaledDrawingCache = new Canvas(width, height);\n                    }\n                    const canvas = this.mUnscaledDrawingCache;\n                    this.computeScroll();\n                    const restoreCount = canvas.save();\n                    canvas.translate(-this.mScrollX, -this.mScrollY);\n                    this.mPrivateFlags |= View.PFLAG_DRAWN;\n                    if (this.mAttachInfo == null || this.mLayerType != View.LAYER_TYPE_NONE) {\n                        this.mPrivateFlags |= View.PFLAG_DRAWING_CACHE_VALID;\n                    }\n                    if ((this.mPrivateFlags & View.PFLAG_SKIP_DRAW) == View.PFLAG_SKIP_DRAW) {\n                        this.mPrivateFlags &= ~View.PFLAG_DIRTY_MASK;\n                        this.dispatchDraw(canvas);\n                        if (this.mOverlay != null && !this.mOverlay.isEmpty()) {\n                            this.mOverlay.getOverlayView().draw(canvas);\n                        }\n                    }\n                    else {\n                        this.draw(canvas);\n                    }\n                    canvas.restoreToCount(restoreCount);\n                }\n            }\n            setWillNotDraw(willNotDraw) {\n                this.setFlags(willNotDraw ? View.WILL_NOT_DRAW : 0, View.DRAW_MASK);\n            }\n            willNotDraw() {\n                return (this.mViewFlags & View.DRAW_MASK) == View.WILL_NOT_DRAW;\n            }\n            setWillNotCacheDrawing(willNotCacheDrawing) {\n                this.setFlags(willNotCacheDrawing ? View.WILL_NOT_CACHE_DRAWING : 0, View.WILL_NOT_CACHE_DRAWING);\n            }\n            willNotCacheDrawing() {\n                return (this.mViewFlags & View.WILL_NOT_CACHE_DRAWING) == View.WILL_NOT_CACHE_DRAWING;\n            }\n            drawableSizeChange(who) {\n                if (who === this.mBackground) {\n                    let w = who.getIntrinsicWidth();\n                    if (w < 0)\n                        w = this.mBackgroundWidth;\n                    let h = who.getIntrinsicHeight();\n                    if (h < 0)\n                        h = this.mBackgroundHeight;\n                    if (w != this.mBackgroundWidth || h != this.mBackgroundHeight) {\n                        let padding = new Rect();\n                        if (who.getPadding(padding)) {\n                            this.setPadding(padding.left, padding.top, padding.right, padding.bottom);\n                        }\n                        this.mBackgroundWidth = w;\n                        this.mBackgroundHeight = h;\n                        this.requestLayout();\n                    }\n                }\n                else if (this.verifyDrawable(who)) {\n                    this.requestLayout();\n                }\n            }\n            invalidateDrawable(drawable) {\n                if (this.verifyDrawable(drawable)) {\n                    const dirty = drawable.getBounds();\n                    const scrollX = this.mScrollX;\n                    const scrollY = this.mScrollY;\n                    this.invalidate(dirty.left + scrollX, dirty.top + scrollY, dirty.right + scrollX, dirty.bottom + scrollY);\n                }\n            }\n            scheduleDrawable(who, what, when) {\n                if (this.verifyDrawable(who) && what != null) {\n                    const delay = when - SystemClock.uptimeMillis();\n                    if (this.mAttachInfo != null) {\n                        this.mAttachInfo.mHandler.postAtTime(what, who, when);\n                    }\n                    else {\n                        view_1.ViewRootImpl.getRunQueue().postDelayed(what, delay);\n                    }\n                }\n            }\n            unscheduleDrawable(who, what) {\n                if (this.verifyDrawable(who) && what != null) {\n                    if (this.mAttachInfo != null) {\n                        this.mAttachInfo.mHandler.removeCallbacks(what, who);\n                    }\n                    else {\n                        view_1.ViewRootImpl.getRunQueue().removeCallbacks(what);\n                    }\n                }\n                else if (what === null) {\n                    if (this.mAttachInfo != null && who != null) {\n                        this.mAttachInfo.mHandler.removeCallbacksAndMessages(who);\n                    }\n                }\n            }\n            verifyDrawable(who) {\n                return who == this.mBackground;\n            }\n            drawableStateChanged() {\n                this.getDrawableState();\n                let d = this.mBackground;\n                if (d != null && d.isStateful()) {\n                    d.setState(this.getDrawableState());\n                }\n            }\n            resolveDrawables() {\n            }\n            refreshDrawableState() {\n                this.mPrivateFlags |= View.PFLAG_DRAWABLE_STATE_DIRTY;\n                this.drawableStateChanged();\n                let parent = this.mParent;\n                if (parent != null) {\n                    parent.childDrawableStateChanged(this);\n                }\n            }\n            getDrawableState() {\n                if ((this.mDrawableState != null) && ((this.mPrivateFlags & View.PFLAG_DRAWABLE_STATE_DIRTY) == 0)) {\n                    return this.mDrawableState;\n                }\n                else {\n                    let oldDrawableState = this.mDrawableState;\n                    this.mDrawableState = this.onCreateDrawableState(0);\n                    this.mPrivateFlags &= ~View.PFLAG_DRAWABLE_STATE_DIRTY;\n                    this._fireStateChangeToAttribute(oldDrawableState, this.mDrawableState);\n                    return this.mDrawableState;\n                }\n            }\n            onCreateDrawableState(extraSpace) {\n                if ((this.mViewFlags & View.DUPLICATE_PARENT_STATE) == View.DUPLICATE_PARENT_STATE &&\n                    this.mParent instanceof View) {\n                    return this.mParent.onCreateDrawableState(extraSpace);\n                }\n                let drawableState;\n                let privateFlags = this.mPrivateFlags;\n                let viewStateIndex = 0;\n                if ((privateFlags & View.PFLAG_PRESSED) != 0)\n                    viewStateIndex |= View.VIEW_STATE_PRESSED;\n                if ((this.mViewFlags & View.ENABLED_MASK) == View.ENABLED)\n                    viewStateIndex |= View.VIEW_STATE_ENABLED;\n                if (this.isFocused())\n                    viewStateIndex |= View.VIEW_STATE_FOCUSED;\n                if ((privateFlags & View.PFLAG_SELECTED) != 0)\n                    viewStateIndex |= View.VIEW_STATE_SELECTED;\n                if (this.hasWindowFocus())\n                    viewStateIndex |= View.VIEW_STATE_WINDOW_FOCUSED;\n                if ((privateFlags & View.PFLAG_ACTIVATED) != 0)\n                    viewStateIndex |= View.VIEW_STATE_ACTIVATED;\n                const privateFlags2 = this.mPrivateFlags2;\n                drawableState = View.VIEW_STATE_SETS[viewStateIndex];\n                if (extraSpace == 0) {\n                    return drawableState;\n                }\n                let fullState;\n                if (drawableState != null) {\n                    fullState = androidui.util.ArrayCreator.newNumberArray(drawableState.length + extraSpace);\n                    System.arraycopy(drawableState, 0, fullState, 0, drawableState.length);\n                }\n                else {\n                    fullState = androidui.util.ArrayCreator.newNumberArray(extraSpace);\n                }\n                return fullState;\n            }\n            static mergeDrawableStates(baseState, additionalState) {\n                const N = baseState.length;\n                let i = N - 1;\n                while (i >= 0 && !baseState[i]) {\n                    i--;\n                }\n                System.arraycopy(additionalState, 0, baseState, i + 1, additionalState.length);\n                return baseState;\n            }\n            jumpDrawablesToCurrentState() {\n                if (this.mBackground != null) {\n                    this.mBackground.jumpToCurrentState();\n                }\n            }\n            setBackgroundColor(color) {\n                if (this.mBackground instanceof ColorDrawable) {\n                    this.mBackground.mutate().setColor(color);\n                    this.computeOpaqueFlags();\n                }\n                else {\n                    this.setBackground(new ColorDrawable(color));\n                }\n            }\n            setBackground(background) {\n                this.setBackgroundDrawable(background);\n            }\n            getBackground() {\n                return this.mBackground;\n            }\n            setBackgroundDrawable(background) {\n                this.computeOpaqueFlags();\n                if (background == this.mBackground) {\n                    return;\n                }\n                let requestLayout = false;\n                if (this.mBackground != null) {\n                    this.mBackground.setCallback(null);\n                    this.unscheduleDrawable(this.mBackground);\n                }\n                if (background != null) {\n                    let padding = new Rect();\n                    if (background.getPadding(padding)) {\n                        this.setPadding(padding.left, padding.top, padding.right, padding.bottom);\n                    }\n                    if (this.mBackground == null || this.mBackground.getMinimumHeight() != background.getMinimumHeight() ||\n                        this.mBackground.getMinimumWidth() != background.getMinimumWidth()) {\n                        requestLayout = true;\n                    }\n                    background.setCallback(this);\n                    if (background.isStateful()) {\n                        background.setState(this.getDrawableState());\n                    }\n                    background.setVisible(this.getVisibility() == View.VISIBLE, false);\n                    this.mBackground = background;\n                    this.mBackgroundWidth = background.getIntrinsicWidth();\n                    this.mBackgroundHeight = background.getIntrinsicHeight();\n                    if ((this.mPrivateFlags & View.PFLAG_SKIP_DRAW) != 0) {\n                        this.mPrivateFlags &= ~View.PFLAG_SKIP_DRAW;\n                        this.mPrivateFlags |= View.PFLAG_ONLY_DRAWS_BACKGROUND;\n                        requestLayout = true;\n                    }\n                }\n                else {\n                    this.mBackground = null;\n                    this.mBackgroundWidth = this.mBackgroundHeight = -1;\n                    if ((this.mPrivateFlags & View.PFLAG_ONLY_DRAWS_BACKGROUND) != 0) {\n                        this.mPrivateFlags &= ~View.PFLAG_ONLY_DRAWS_BACKGROUND;\n                        this.mPrivateFlags |= View.PFLAG_SKIP_DRAW;\n                    }\n                    requestLayout = true;\n                }\n                this.computeOpaqueFlags();\n                if (requestLayout) {\n                    this.requestLayout();\n                }\n                this.mBackgroundSizeChanged = true;\n                this.mShadowDrawable = null;\n                this.invalidate(true);\n            }\n            computeHorizontalScrollRange() {\n                return this.getWidth();\n            }\n            computeHorizontalScrollOffset() {\n                return this.mScrollX;\n            }\n            computeHorizontalScrollExtent() {\n                return this.getWidth();\n            }\n            computeVerticalScrollRange() {\n                return this.getHeight();\n            }\n            computeVerticalScrollOffset() {\n                return this.mScrollY;\n            }\n            computeVerticalScrollExtent() {\n                return this.getHeight();\n            }\n            canScrollHorizontally(direction) {\n                const offset = this.computeHorizontalScrollOffset();\n                const range = this.computeHorizontalScrollRange() - this.computeHorizontalScrollExtent();\n                if (range == 0)\n                    return false;\n                if (direction < 0) {\n                    return offset > 0;\n                }\n                else {\n                    return offset < range - 1;\n                }\n            }\n            canScrollVertically(direction) {\n                const offset = this.computeVerticalScrollOffset();\n                const range = this.computeVerticalScrollRange() - this.computeVerticalScrollExtent();\n                if (range == 0)\n                    return false;\n                if (direction < 0) {\n                    return offset > 0;\n                }\n                else {\n                    return offset < range - 1;\n                }\n            }\n            overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX, scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent) {\n                const overScrollMode = this.mOverScrollMode;\n                const canScrollHorizontal = this.computeHorizontalScrollRange() > this.computeHorizontalScrollExtent();\n                const canScrollVertical = this.computeVerticalScrollRange() > this.computeVerticalScrollExtent();\n                const overScrollHorizontal = overScrollMode == View.OVER_SCROLL_ALWAYS ||\n                    (overScrollMode == View.OVER_SCROLL_IF_CONTENT_SCROLLS && canScrollHorizontal);\n                const overScrollVertical = overScrollMode == View.OVER_SCROLL_ALWAYS ||\n                    (overScrollMode == View.OVER_SCROLL_IF_CONTENT_SCROLLS && canScrollVertical);\n                if (isTouchEvent) {\n                    if ((deltaX < 0 && scrollX <= 0) || (deltaX > 0 && scrollX >= scrollRangeX)) {\n                        deltaX /= 2;\n                    }\n                    if ((deltaY < 0 && scrollY <= 0) || (deltaY > 0 && scrollY >= scrollRangeY)) {\n                        deltaY /= 2;\n                    }\n                }\n                let newScrollX = scrollX + deltaX;\n                if (!overScrollHorizontal) {\n                    maxOverScrollX = 0;\n                }\n                let newScrollY = scrollY + deltaY;\n                if (!overScrollVertical) {\n                    maxOverScrollY = 0;\n                }\n                const left = -maxOverScrollX;\n                const right = maxOverScrollX + scrollRangeX;\n                const top = -maxOverScrollY;\n                const bottom = maxOverScrollY + scrollRangeY;\n                let clampedX = false;\n                if (newScrollX > right) {\n                    newScrollX = right;\n                    clampedX = true;\n                }\n                else if (newScrollX < left) {\n                    newScrollX = left;\n                    clampedX = true;\n                }\n                let clampedY = false;\n                if (newScrollY > bottom) {\n                    newScrollY = bottom;\n                    clampedY = true;\n                }\n                else if (newScrollY < top) {\n                    newScrollY = top;\n                    clampedY = true;\n                }\n                this.onOverScrolled(newScrollX, newScrollY, clampedX, clampedY);\n                return clampedX || clampedY;\n            }\n            onOverScrolled(scrollX, scrollY, clampedX, clampedY) {\n            }\n            getOverScrollMode() {\n                return this.mOverScrollMode;\n            }\n            setOverScrollMode(overScrollMode) {\n                if (overScrollMode != View.OVER_SCROLL_ALWAYS &&\n                    overScrollMode != View.OVER_SCROLL_IF_CONTENT_SCROLLS &&\n                    overScrollMode != View.OVER_SCROLL_NEVER) {\n                    throw new Error(\"Invalid overscroll mode \" + overScrollMode);\n                }\n                this.mOverScrollMode = overScrollMode;\n            }\n            getVerticalScrollFactor() {\n                if (this.mVerticalScrollFactor == 0) {\n                    this.mVerticalScrollFactor = Resources.getDisplayMetrics().density * 1;\n                }\n                return this.mVerticalScrollFactor;\n            }\n            getHorizontalScrollFactor() {\n                return this.getVerticalScrollFactor();\n            }\n            computeScroll() {\n            }\n            scrollTo(x, y) {\n                if (this.mScrollX != x || this.mScrollY != y) {\n                    let oldX = this.mScrollX;\n                    let oldY = this.mScrollY;\n                    this.mScrollX = x;\n                    this.mScrollY = y;\n                    this.invalidateParentCaches();\n                    this.onScrollChanged(this.mScrollX, this.mScrollY, oldX, oldY);\n                    if (!this.awakenScrollBars()) {\n                        this.postInvalidateOnAnimation();\n                    }\n                }\n            }\n            scrollBy(x, y) {\n                this.scrollTo(this.mScrollX + x, this.mScrollY + y);\n            }\n            initialAwakenScrollBars() {\n                return this.mScrollCache != null &&\n                    this.awakenScrollBars(this.mScrollCache.scrollBarDefaultDelayBeforeFade * 4, true);\n            }\n            awakenScrollBars(startDelay, invalidate = true) {\n                const scrollCache = this.mScrollCache;\n                if (scrollCache == null)\n                    return false;\n                startDelay = startDelay || scrollCache.scrollBarDefaultDelayBeforeFade;\n                if (scrollCache == null || !scrollCache.fadeScrollBars) {\n                    return false;\n                }\n                if (scrollCache.scrollBar == null) {\n                    scrollCache.scrollBar = new ScrollBarDrawable();\n                }\n                if (this.isHorizontalScrollBarEnabled() || this.isVerticalScrollBarEnabled()) {\n                    if (invalidate) {\n                        this.postInvalidateOnAnimation();\n                    }\n                    if (scrollCache.state == ScrollabilityCache.OFF) {\n                        const KEY_REPEAT_FIRST_DELAY = 750;\n                        startDelay = Math.max(KEY_REPEAT_FIRST_DELAY, startDelay);\n                    }\n                    let fadeStartTime = AnimationUtils.currentAnimationTimeMillis() + startDelay;\n                    scrollCache.fadeStartTime = fadeStartTime;\n                    scrollCache.state = ScrollabilityCache.ON;\n                    if (this.mAttachInfo != null) {\n                        this.mAttachInfo.mHandler.removeCallbacks(scrollCache);\n                        this.mAttachInfo.mHandler.postAtTime(scrollCache, fadeStartTime);\n                    }\n                    return true;\n                }\n                return false;\n            }\n            getVerticalFadingEdgeLength() {\n                return 0;\n            }\n            setVerticalFadingEdgeEnabled(enable) {\n            }\n            setHorizontalFadingEdgeEnabled(enable) {\n            }\n            setFadingEdgeLength(length) {\n            }\n            getHorizontalFadingEdgeLength() {\n                return 0;\n            }\n            getVerticalScrollbarWidth() {\n                let cache = this.mScrollCache;\n                if (cache != null) {\n                    let scrollBar = cache.scrollBar;\n                    if (scrollBar != null) {\n                        let size = scrollBar.getSize(true);\n                        if (size <= 0) {\n                            size = cache.scrollBarSize;\n                        }\n                        return size;\n                    }\n                    return 0;\n                }\n                return 0;\n            }\n            getHorizontalScrollbarHeight() {\n                let cache = this.mScrollCache;\n                if (cache != null) {\n                    let scrollBar = cache.scrollBar;\n                    if (scrollBar != null) {\n                        let size = scrollBar.getSize(false);\n                        if (size <= 0) {\n                            size = cache.scrollBarSize;\n                        }\n                        return size;\n                    }\n                    return 0;\n                }\n                return 0;\n            }\n            initializeScrollbars(a) {\n                this.initScrollCache();\n            }\n            initScrollCache() {\n                if (this.mScrollCache == null) {\n                    this.mScrollCache = new ScrollabilityCache(this);\n                }\n            }\n            getScrollCache() {\n                this.initScrollCache();\n                return this.mScrollCache;\n            }\n            isHorizontalScrollBarEnabled() {\n                return (this.mViewFlags & View.SCROLLBARS_HORIZONTAL) == View.SCROLLBARS_HORIZONTAL;\n            }\n            setHorizontalScrollBarEnabled(horizontalScrollBarEnabled) {\n                if (this.isHorizontalScrollBarEnabled() != horizontalScrollBarEnabled) {\n                    this.mViewFlags ^= View.SCROLLBARS_HORIZONTAL;\n                    this.computeOpaqueFlags();\n                }\n            }\n            isVerticalScrollBarEnabled() {\n                return (this.mViewFlags & View.SCROLLBARS_VERTICAL) == View.SCROLLBARS_VERTICAL;\n            }\n            setVerticalScrollBarEnabled(verticalScrollBarEnabled) {\n                if (this.isVerticalScrollBarEnabled() != verticalScrollBarEnabled) {\n                    this.mViewFlags ^= View.SCROLLBARS_VERTICAL;\n                    this.computeOpaqueFlags();\n                }\n            }\n            setScrollbarFadingEnabled(fadeScrollbars) {\n                this.initScrollCache();\n                const scrollabilityCache = this.mScrollCache;\n                scrollabilityCache.fadeScrollBars = fadeScrollbars;\n                if (fadeScrollbars) {\n                    scrollabilityCache.state = ScrollabilityCache.OFF;\n                }\n                else {\n                    scrollabilityCache.state = ScrollabilityCache.ON;\n                }\n            }\n            setVerticalScrollbarPosition(position) {\n            }\n            setHorizontalScrollbarPosition(position) {\n            }\n            setScrollBarStyle(position) {\n            }\n            getTopFadingEdgeStrength() {\n                return 0;\n            }\n            getBottomFadingEdgeStrength() {\n                return 0;\n            }\n            getLeftFadingEdgeStrength() {\n                return 0;\n            }\n            getRightFadingEdgeStrength() {\n                return 0;\n            }\n            isScrollbarFadingEnabled() {\n                return this.mScrollCache != null && this.mScrollCache.fadeScrollBars;\n            }\n            getScrollBarDefaultDelayBeforeFade() {\n                return this.mScrollCache == null ? view_1.ViewConfiguration.getScrollDefaultDelay() :\n                    this.mScrollCache.scrollBarDefaultDelayBeforeFade;\n            }\n            setScrollBarDefaultDelayBeforeFade(scrollBarDefaultDelayBeforeFade) {\n                this.getScrollCache().scrollBarDefaultDelayBeforeFade = scrollBarDefaultDelayBeforeFade;\n            }\n            getScrollBarFadeDuration() {\n                return this.mScrollCache == null ? view_1.ViewConfiguration.getScrollBarFadeDuration() :\n                    this.mScrollCache.scrollBarFadeDuration;\n            }\n            setScrollBarFadeDuration(scrollBarFadeDuration) {\n                this.getScrollCache().scrollBarFadeDuration = scrollBarFadeDuration;\n            }\n            getScrollBarSize() {\n                return this.mScrollCache == null ? view_1.ViewConfiguration.get().getScaledScrollBarSize() :\n                    this.mScrollCache.scrollBarSize;\n            }\n            setScrollBarSize(scrollBarSize) {\n                this.getScrollCache().scrollBarSize = scrollBarSize;\n            }\n            hasOpaqueScrollbars() {\n                return true;\n            }\n            assignParent(parent) {\n                if (this.mParent == null) {\n                    this.mParent = parent;\n                }\n                else if (parent == null) {\n                    this.mParent = null;\n                }\n                else {\n                    throw new Error(\"view \" + this + \" being added, but\"\n                        + \" it already has a parent\");\n                }\n            }\n            onFinishInflate() {\n            }\n            dispatchStartTemporaryDetach() {\n                this.onStartTemporaryDetach();\n            }\n            onStartTemporaryDetach() {\n                this.removeUnsetPressCallback();\n                this.mPrivateFlags |= View.PFLAG_CANCEL_NEXT_UP_EVENT;\n            }\n            dispatchFinishTemporaryDetach() {\n                this.onFinishTemporaryDetach();\n            }\n            onFinishTemporaryDetach() {\n            }\n            dispatchWindowFocusChanged(hasFocus) {\n                this.onWindowFocusChanged(hasFocus);\n            }\n            onWindowFocusChanged(hasWindowFocus) {\n                if (!hasWindowFocus) {\n                    if (this.isPressed()) {\n                        this.setPressed(false);\n                    }\n                    this.removeLongPressCallback();\n                    this.removeTapCallback();\n                    this.onFocusLost();\n                }\n                this.refreshDrawableState();\n            }\n            hasWindowFocus() {\n                return this.mAttachInfo != null && this.mAttachInfo.mHasWindowFocus;\n            }\n            getWindowAttachCount() {\n                return this.mWindowAttachCount;\n            }\n            isAttachedToWindow() {\n                return this.mAttachInfo != null;\n            }\n            dispatchAttachedToWindow(info, visibility) {\n                this.mAttachInfo = info;\n                if (this.mOverlay != null) {\n                    this.mOverlay.getOverlayView().dispatchAttachedToWindow(info, visibility);\n                }\n                this.mWindowAttachCount++;\n                this.mPrivateFlags |= View.PFLAG_DRAWABLE_STATE_DIRTY;\n                if (this.mFloatingTreeObserver != null) {\n                    info.mViewRootImpl.mTreeObserver.merge(this.mFloatingTreeObserver);\n                    this.mFloatingTreeObserver = null;\n                }\n                if ((this.mPrivateFlags & View.PFLAG_SCROLL_CONTAINER) != 0) {\n                    this.mAttachInfo.mScrollContainers.add(this);\n                    this.mPrivateFlags |= View.PFLAG_SCROLL_CONTAINER_ADDED;\n                }\n                this.onAttachedToWindow();\n                if (this.dependOnDebugLayout()) {\n                    this.getContext().androidUI.viewAttachedDependOnDebugLayout(this);\n                }\n                let li = this.mListenerInfo;\n                let listeners = li != null ? li.mOnAttachStateChangeListeners : null;\n                if (listeners != null && listeners.size() > 0) {\n                    for (let listener of listeners) {\n                        listener.onViewAttachedToWindow(this);\n                    }\n                }\n                let vis = info.mWindowVisibility;\n                if (vis != View.GONE) {\n                    this.onWindowVisibilityChanged(vis);\n                }\n                if ((this.mPrivateFlags & View.PFLAG_DRAWABLE_STATE_DIRTY) != 0) {\n                    this.refreshDrawableState();\n                }\n            }\n            onAttachedToWindow() {\n                if ((this.mPrivateFlags & View.PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH) != 0) {\n                    this.initialAwakenScrollBars();\n                    this.mPrivateFlags &= ~View.PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH;\n                }\n                this.mPrivateFlags3 &= ~View.PFLAG3_IS_LAID_OUT;\n                this.jumpDrawablesToCurrentState();\n            }\n            dispatchDetachedFromWindow() {\n                let info = this.mAttachInfo;\n                if (info != null) {\n                    let vis = info.mWindowVisibility;\n                    if (vis != View.GONE) {\n                        this.onWindowVisibilityChanged(View.GONE);\n                    }\n                }\n                this.onDetachedFromWindow();\n                if (this.dependOnDebugLayout()) {\n                    this.getContext().androidUI.viewDetachedDependOnDebugLayout(this);\n                }\n                let li = this.mListenerInfo;\n                let listeners = li != null ? li.mOnAttachStateChangeListeners : null;\n                if (listeners != null && listeners.size() > 0) {\n                    for (let listener of listeners) {\n                        listener.onViewDetachedFromWindow(this);\n                    }\n                }\n                if ((this.mPrivateFlags & View.PFLAG_SCROLL_CONTAINER_ADDED) != 0) {\n                    this.mAttachInfo.mScrollContainers.delete(this);\n                    this.mPrivateFlags &= ~View.PFLAG_SCROLL_CONTAINER_ADDED;\n                }\n                this.mAttachInfo = null;\n                if (this.mOverlay != null) {\n                    this.mOverlay.getOverlayView().dispatchDetachedFromWindow();\n                }\n            }\n            onDetachedFromWindow() {\n                this.mPrivateFlags &= ~View.PFLAG_CANCEL_NEXT_UP_EVENT;\n                this.mPrivateFlags3 &= ~View.PFLAG3_IS_LAID_OUT;\n                this.removeUnsetPressCallback();\n                this.removeLongPressCallback();\n                this.removePerformClickCallback();\n                this.destroyDrawingCache();\n                this.cleanupDraw();\n                this.mCurrentAnimation = null;\n            }\n            cleanupDraw() {\n                if (this.mAttachInfo != null) {\n                    this.mAttachInfo.mViewRootImpl.cancelInvalidate(this);\n                }\n            }\n            isInEditMode() {\n                return false;\n            }\n            debug(depth = 0) {\n                console.dir(this.bindElement);\n            }\n            toString() {\n                return this.tagName();\n            }\n            getRootView() {\n                if (this.mAttachInfo != null) {\n                    let v = this.mAttachInfo.mRootView;\n                    if (v != null) {\n                        return v;\n                    }\n                }\n                let parent = this;\n                while (parent.mParent != null && parent.mParent instanceof View) {\n                    parent = parent.mParent;\n                }\n                return parent;\n            }\n            findViewById(id) {\n                if (!id)\n                    return null;\n                return this.findViewTraversal(id);\n            }\n            findViewWithTag(tag) {\n                if (!tag)\n                    return null;\n                return this.findViewWithTagTraversal(tag);\n            }\n            findViewTraversal(id) {\n                if (id == this.mID) {\n                    return this;\n                }\n                return null;\n            }\n            findViewWithTagTraversal(tag) {\n                if (tag != null && tag === this.mTag) {\n                    return this;\n                }\n                return null;\n            }\n            findViewByPredicate(predicate) {\n                return this.findViewByPredicateTraversal(predicate, null);\n            }\n            findViewByPredicateTraversal(predicate, childToSkip) {\n                if (predicate.apply(this)) {\n                    return this;\n                }\n                return null;\n            }\n            findViewByPredicateInsideOut(start, predicate) {\n                let childToSkip = null;\n                for (;;) {\n                    let view = start.findViewByPredicateTraversal(predicate, childToSkip);\n                    if (view != null || start == this) {\n                        return view;\n                    }\n                    let parent = start.getParent();\n                    if (parent == null || !(parent instanceof View)) {\n                        return null;\n                    }\n                    childToSkip = start;\n                    start = parent;\n                }\n            }\n            setId(id) {\n                this.mID = id;\n            }\n            getId() {\n                return this.mID;\n            }\n            getTag() {\n                return this.mTag;\n            }\n            setTag(tag) {\n                this.mTag = tag;\n            }\n            setIsRootNamespace(isRoot) {\n                if (isRoot) {\n                    this.mPrivateFlags |= View.PFLAG_IS_ROOT_NAMESPACE;\n                }\n                else {\n                    this.mPrivateFlags &= ~View.PFLAG_IS_ROOT_NAMESPACE;\n                }\n            }\n            isRootNamespace() {\n                return (this.mPrivateFlags & View.PFLAG_IS_ROOT_NAMESPACE) != 0;\n            }\n            getResources() {\n                let context = this.getContext();\n                if (context != null) {\n                    return context.getResources();\n                }\n                return Resources.getSystem();\n            }\n            static inflate(context, xml, root) {\n                return view_1.LayoutInflater.from(context).inflate(xml, root);\n            }\n            static _AttrObserverCallBack(arr, observer) {\n                arr.forEach((record) => {\n                    let target = record.target;\n                    let androidView = target[View.AndroidViewProperty];\n                    if (!androidView)\n                        return;\n                    let attrName = record.attributeName;\n                    let newValue = target.getAttribute(attrName);\n                    let oldValue = record.oldValue;\n                    if (newValue === oldValue)\n                        return;\n                    androidView.onBindElementAttributeChanged(attrName, record.oldValue, newValue);\n                });\n            }\n            initBindElement(bindElement) {\n                if (this.bindElement) {\n                    this.bindElement[View.AndroidViewProperty] = null;\n                }\n                this.bindElement = bindElement || document.createElement(this.tagName());\n                this.bindElement.style.position = 'absolute';\n                let oldBindView = this.bindElement[View.AndroidViewProperty];\n                if (oldBindView) {\n                    if (oldBindView._AttrObserver)\n                        oldBindView._AttrObserver.disconnect();\n                }\n                this.bindElement[View.AndroidViewProperty] = this;\n                this._initAttrObserver();\n            }\n            initBindAttr() {\n                let classAttrBinder = View.ViewClassAttrBinderClazzMap.get(this.getClass());\n                if (!classAttrBinder) {\n                    classAttrBinder = this.createClassAttrBinder();\n                    View.ViewClassAttrBinderClazzMap.set(this.getClass(), classAttrBinder);\n                }\n                this._attrBinder.setClassAttrBind(classAttrBinder);\n            }\n            createClassAttrBinder() {\n                const classAttrBinder = new AttrBinder.ClassBinderMap()\n                    .set('background', {\n                    setter(v, value, attrBinder) {\n                        v.setBackground(attrBinder.parseDrawable(value));\n                    },\n                    getter(v) {\n                        return v.mBackground;\n                    },\n                }).set('padding', {\n                    setter(v, value, attrBinder) {\n                        if (value == null)\n                            value = 0;\n                        let [top, right, bottom, left] = attrBinder.parsePaddingMarginTRBL(value);\n                        v.setPadding(left, top, right, bottom);\n                    },\n                    getter(v) {\n                        return v.mPaddingTop + ' ' + v.mPaddingRight + ' ' + v.mPaddingBottom + ' ' + v.mPaddingLeft;\n                    },\n                }).set('paddingLeft', {\n                    setter(v, value, attrBinder) {\n                        if (value == null)\n                            value = 0;\n                        v.setPadding(attrBinder.parseDimension(value, 0), v.mPaddingTop, v.mPaddingRight, v.mPaddingBottom);\n                    },\n                    getter(v) {\n                        return v.mPaddingLeft;\n                    },\n                }).set('paddingTop', {\n                    setter(v, value, attrBinder) {\n                        if (value == null)\n                            value = 0;\n                        v.setPadding(v.mPaddingLeft, attrBinder.parseDimension(value, 0), v.mPaddingRight, v.mPaddingBottom);\n                    },\n                    getter(v) {\n                        return v.mPaddingTop;\n                    },\n                }).set('paddingRight', {\n                    setter(v, value, attrBinder) {\n                        if (value == null)\n                            value = 0;\n                        v.setPadding(v.mPaddingLeft, v.mPaddingTop, attrBinder.parseDimension(value, 0), v.mPaddingBottom);\n                    },\n                    getter(v) {\n                        return v.mPaddingRight;\n                    },\n                }).set('paddingBottom', {\n                    setter(v, value, attrBinder) {\n                        if (value == null)\n                            value = 0;\n                        v.setPadding(v.mPaddingLeft, v.mPaddingTop, v.mPaddingRight, attrBinder.parseDimension(value, 0));\n                    },\n                    getter(v) {\n                        return v.mPaddingBottom;\n                    },\n                }).set('scrollX', {\n                    setter(v, value, attrBinder) {\n                        value = attrBinder.parseNumberPixelOffset(value);\n                        if (Number.isInteger(value))\n                            v.scrollTo(value, v.mScrollY);\n                    },\n                    getter(v) {\n                        v.getScrollX();\n                    },\n                }).set('scrollY', {\n                    setter(v, value, attrBinder) {\n                        value = attrBinder.parseNumberPixelOffset(value);\n                        if (Number.isInteger(value))\n                            v.scrollTo(v.mScrollX, value);\n                    },\n                    getter(v) {\n                        return v.getScrollY();\n                    },\n                }).set('alpha', {\n                    setter(v, value, attrBinder) {\n                        v.setAlpha(attrBinder.parseFloat(value, v.getAlpha()));\n                    },\n                    getter(v) {\n                        return v.getAlpha();\n                    },\n                }).set('transformPivotX', {\n                    setter(v, value, attrBinder) {\n                        v.setPivotX(attrBinder.parseNumberPixelOffset(value, v.getPivotX()));\n                    },\n                    getter(v) {\n                        return v.getPivotX();\n                    },\n                }).set('transformPivotY', {\n                    setter(v, value, attrBinder) {\n                        v.setPivotY(attrBinder.parseNumberPixelOffset(value, v.getPivotY()));\n                    },\n                    getter(v) {\n                        return v.getPivotY();\n                    },\n                }).set('translationX', {\n                    setter(v, value, attrBinder) {\n                        v.setTranslationX(attrBinder.parseNumberPixelOffset(value, v.getTranslationX()));\n                    },\n                    getter(v) {\n                        return v.getTranslationX();\n                    },\n                }).set('translationY', {\n                    setter(v, value, attrBinder) {\n                        v.setTranslationY(attrBinder.parseNumberPixelOffset(value, v.getTranslationY()));\n                    },\n                    getter(v) {\n                        return v.getTranslationY();\n                    },\n                }).set('rotation', {\n                    setter(v, value, attrBinder) {\n                        v.setRotation(attrBinder.parseFloat(value, v.getRotation()));\n                    },\n                    getter(v) {\n                        return v.getRotation();\n                    },\n                }).set('scaleX', {\n                    setter(v, value, attrBinder) {\n                        v.setScaleX(attrBinder.parseFloat(value, v.getScaleX()));\n                    },\n                    getter(v) {\n                        return v.getScaleX();\n                    },\n                }).set('scaleY', {\n                    setter(v, value, attrBinder) {\n                        v.setScaleY(attrBinder.parseFloat(value, v.getScaleY()));\n                    },\n                    getter(v) {\n                        return v.getScaleY();\n                    },\n                }).set('tag', {\n                    setter(v, value, attrBinder) {\n                        v.setTag(value);\n                    },\n                    getter(v) {\n                        return v.getTag();\n                    },\n                }).set('id', {\n                    setter(v, value, attrBinder) {\n                        v.setId(value);\n                    },\n                    getter(v) {\n                        return v.getId();\n                    },\n                }).set('focusable', {\n                    setter(v, value, attrBinder) {\n                        if (attrBinder.parseBoolean(value, false)) {\n                            v.setFlags(View.FOCUSABLE, View.FOCUSABLE_MASK);\n                        }\n                    },\n                    getter(v) {\n                        return v.isFocusable();\n                    },\n                }).set('focusableInTouchMode', {\n                    setter(v, value, attrBinder) {\n                        if (attrBinder.parseBoolean(value, false)) {\n                            v.setFlags(View.FOCUSABLE_IN_TOUCH_MODE | View.FOCUSABLE, View.FOCUSABLE_IN_TOUCH_MODE | View.FOCUSABLE_MASK);\n                        }\n                    },\n                    getter(v) {\n                        return v.isFocusableInTouchMode();\n                    },\n                }).set('clickable', {\n                    setter(v, value, attrBinder) {\n                        if (attrBinder.parseBoolean(value, false)) {\n                            v.setFlags(View.CLICKABLE, View.CLICKABLE);\n                        }\n                    },\n                    getter(v) {\n                        return v.isClickable();\n                    },\n                }).set('longClickable', {\n                    setter(v, value, attrBinder) {\n                        if (attrBinder.parseBoolean(value, false)) {\n                            v.setFlags(View.LONG_CLICKABLE, View.LONG_CLICKABLE);\n                        }\n                    },\n                    getter(v) {\n                        return v.isLongClickable();\n                    },\n                }).set('duplicateParentState', {\n                    setter(v, value, attrBinder) {\n                        if (attrBinder.parseBoolean(value, false)) {\n                            v.setFlags(View.DUPLICATE_PARENT_STATE, View.DUPLICATE_PARENT_STATE);\n                        }\n                    },\n                    getter(v) {\n                        return (v.mViewFlags & View.DUPLICATE_PARENT_STATE) == View.DUPLICATE_PARENT_STATE;\n                    },\n                }).set('visibility', {\n                    setter(v, value, attrBinder) {\n                        if (value === 'gone')\n                            v.setVisibility(View.GONE);\n                        else if (value === 'invisible')\n                            v.setVisibility(View.INVISIBLE);\n                        else if (value === 'visible')\n                            v.setVisibility(View.VISIBLE);\n                    },\n                    getter(v) {\n                        return v.getVisibility();\n                    },\n                }).set('scrollbars', {\n                    setter(v, value, attrBinder) {\n                        if (value === 'none') {\n                            v.setHorizontalScrollBarEnabled(false);\n                            v.setVerticalScrollBarEnabled(false);\n                        }\n                        else if (value === 'horizontal') {\n                            v.setHorizontalScrollBarEnabled(true);\n                            v.setVerticalScrollBarEnabled(false);\n                        }\n                        else if (value === 'vertical') {\n                            v.setHorizontalScrollBarEnabled(false);\n                            v.setVerticalScrollBarEnabled(true);\n                        }\n                    },\n                }).set('isScrollContainer', {\n                    setter(v, value, attrBinder) {\n                        if (attrBinder.parseBoolean(value, false)) {\n                            v.setScrollContainer(true);\n                        }\n                    },\n                    getter(v) {\n                        return v.isScrollContainer();\n                    },\n                }).set('minWidth', {\n                    setter(v, value, attrBinder) {\n                        v.setMinimumWidth(attrBinder.parseNumberPixelSize(value, 0));\n                    },\n                    getter(v) {\n                        return v.mMinWidth;\n                    },\n                }).set('minHeight', {\n                    setter(v, value, attrBinder) {\n                        v.setMinimumHeight(attrBinder.parseNumberPixelSize(value, 0));\n                    },\n                    getter(v) {\n                        return v.mMinHeight;\n                    },\n                }).set('onClick', {\n                    setter(v, value, attrBinder) {\n                        if (value && typeof value === 'string') {\n                            v.setOnClickListenerByAttrValueString(value);\n                        }\n                        v.bindElement.removeAttribute('onclick');\n                    },\n                }).set('overScrollMode', {\n                    setter(v, value, attrBinder) {\n                        let scrollMode = View[('OVER_SCROLL_' + value).toUpperCase()];\n                        if (scrollMode === undefined)\n                            scrollMode = View.OVER_SCROLL_IF_CONTENT_SCROLLS;\n                        v.setOverScrollMode(scrollMode);\n                    }\n                }).set('layerType', {\n                    setter(v, value, attrBinder) {\n                        if ((value + '').toLowerCase() == 'software') {\n                            v.setLayerType(View.LAYER_TYPE_SOFTWARE);\n                        }\n                        else {\n                            v.setLayerType(View.LAYER_TYPE_NONE);\n                        }\n                    }\n                }).set('cornerRadius', {\n                    setter(v, value, attrBinder) {\n                        let [topRight, rightBottom, bottomLeft, leftTop] = attrBinder.parsePaddingMarginTRBL(value);\n                        v.setCornerRadius(leftTop, topRight, rightBottom, bottomLeft);\n                    },\n                    getter(v) {\n                        return v.mCornerRadiusTopRight + ' ' + v.mCornerRadiusBottomRight + ' ' + v.mCornerRadiusBottomLeft + ' ' + v.mCornerRadiusTopLeft;\n                    },\n                }).set('cornerRadiusTopLeft', {\n                    setter(v, value, attrBinder) {\n                        v.setCornerRadiusTopLeft(attrBinder.parseNumberPixelSize(value, v.mCornerRadiusTopLeft));\n                    },\n                    getter(v) {\n                        return v.mCornerRadiusTopLeft;\n                    },\n                }).set('cornerRadiusTopRight', {\n                    setter(v, value, attrBinder) {\n                        v.setCornerRadiusTopRight(attrBinder.parseNumberPixelSize(value, v.mCornerRadiusTopRight));\n                    },\n                    getter(v) {\n                        return v.mCornerRadiusTopRight;\n                    },\n                }).set('cornerRadiusBottomLeft', {\n                    setter(v, value, attrBinder) {\n                        v.setCornerRadiusBottomLeft(attrBinder.parseNumberPixelSize(value, v.mCornerRadiusBottomLeft));\n                    },\n                    getter(v) {\n                        return v.mCornerRadiusBottomLeft;\n                    },\n                }).set('cornerRadiusBottomRight', {\n                    setter(v, value, attrBinder) {\n                        v.setCornerRadiusBottomRight(attrBinder.parseNumberPixelSize(value, v.mCornerRadiusBottomRight));\n                    },\n                    getter(v) {\n                        return v.mCornerRadiusBottomRight;\n                    },\n                }).set('viewShadowColor', {\n                    setter(v, value, attrBinder) {\n                        if (!v.mShadowPaint)\n                            v.mShadowPaint = new Paint();\n                        v.setShadowView(v.mShadowPaint.shadowRadius, v.mShadowPaint.shadowDx, v.mShadowPaint.shadowDy, attrBinder.parseColor(value, v.mShadowPaint.shadowColor));\n                    },\n                    getter(v) {\n                        if (v.mShadowPaint)\n                            return v.mShadowPaint.shadowColor;\n                    },\n                }).set('viewShadowDx', {\n                    setter(v, value, attrBinder) {\n                        if (!v.mShadowPaint)\n                            v.mShadowPaint = new Paint();\n                        let dx = attrBinder.parseNumberPixelSize(value, v.mShadowPaint.shadowDx);\n                        v.setShadowView(v.mShadowPaint.shadowRadius, dx, v.mShadowPaint.shadowDy, v.mShadowPaint.shadowColor);\n                    },\n                    getter(v) {\n                        if (v.mShadowPaint)\n                            return v.mShadowPaint.shadowDx;\n                    },\n                }).set('viewShadowDy', {\n                    setter(v, value, attrBinder) {\n                        if (!v.mShadowPaint)\n                            v.mShadowPaint = new Paint();\n                        let dy = attrBinder.parseNumberPixelSize(value, v.mShadowPaint.shadowDy);\n                        v.setShadowView(v.mShadowPaint.shadowRadius, v.mShadowPaint.shadowDx, dy, v.mShadowPaint.shadowColor);\n                    },\n                    getter(v) {\n                        if (v.mShadowPaint)\n                            return v.mShadowPaint.shadowDy;\n                    },\n                }).set('viewShadowRadius', {\n                    setter(v, value, attrBinder) {\n                        if (!v.mShadowPaint)\n                            v.mShadowPaint = new Paint();\n                        let radius = attrBinder.parseNumberPixelSize(value, v.mShadowPaint.shadowRadius);\n                        v.setShadowView(radius, v.mShadowPaint.shadowDx, v.mShadowPaint.shadowDy, v.mShadowPaint.shadowColor);\n                    },\n                    getter(v) {\n                        if (v.mShadowPaint)\n                            return v.mShadowPaint.shadowRadius;\n                    },\n                });\n                classAttrBinder.set('paddingStart', classAttrBinder.get('paddingLeft'));\n                classAttrBinder.set('paddingEnd', classAttrBinder.get('paddingRight'));\n                return classAttrBinder;\n            }\n            requestSyncBoundToElement(immediately = this.dependOnDebugLayout()) {\n                let rootView = this.getRootView();\n                if (!rootView)\n                    return;\n                if (!rootView._syncToElementRun) {\n                    rootView._syncToElementRun = {\n                        run: () => {\n                            rootView._syncToElementLock = false;\n                            rootView._syncToElementImmediatelyLock = false;\n                            rootView._syncBoundAndScrollToElement();\n                        }\n                    };\n                }\n                if (immediately) {\n                    if (rootView._syncToElementImmediatelyLock)\n                        return;\n                    rootView._syncToElementImmediatelyLock = true;\n                    rootView._syncToElementLock = true;\n                    rootView.removeCallbacks(rootView._syncToElementRun);\n                    rootView.post(rootView._syncToElementRun);\n                    return;\n                }\n                if (rootView._syncToElementLock)\n                    return;\n                rootView._syncToElementLock = true;\n                rootView.postDelayed(rootView._syncToElementRun, 1000);\n            }\n            _syncBoundAndScrollToElement() {\n                if (!this.isAttachedToWindow()) {\n                    return;\n                }\n                const left = this.mLeft;\n                const top = this.mTop;\n                const width = this.getWidth();\n                const height = this.getHeight();\n                const parent = this.getParent();\n                const pScrollX = parent instanceof View ? parent.mScrollX : 0;\n                const pScrollY = parent instanceof View ? parent.mScrollY : 0;\n                if (left !== this._lastSyncLeft || top !== this._lastSyncTop\n                    || width !== this._lastSyncWidth || height !== this._lastSyncHeight\n                    || pScrollX !== this._lastSyncScrollX || pScrollY !== this._lastSyncScrollY) {\n                    this._lastSyncLeft = left;\n                    this._lastSyncTop = top;\n                    this._lastSyncWidth = width;\n                    this._lastSyncHeight = height;\n                    this._lastSyncScrollX = pScrollX;\n                    this._lastSyncScrollY = pScrollY;\n                    const density = this.getResources().getDisplayMetrics().density;\n                    let bind = this.bindElement;\n                    bind.style.width = width / density + 'px';\n                    bind.style.height = height / density + 'px';\n                    bind.style.left = (left - pScrollX) / density + 'px';\n                    bind.style.top = (top - pScrollY) / density + 'px';\n                    if (bind.parentElement) {\n                        bind.parentElement.scrollTop = 0;\n                    }\n                    this.getMatrix();\n                }\n                if (this instanceof view_1.ViewGroup) {\n                    const group = this;\n                    for (var i = 0, count = group.getChildCount(); i < count; i++) {\n                        group.getChildAt(i)._syncBoundAndScrollToElement();\n                    }\n                }\n            }\n            _syncMatrixToElement() {\n                let matrix = this.mTransformationInfo == null ? Matrix.IDENTITY_MATRIX : this.mTransformationInfo.mMatrix;\n                matrix = matrix || Matrix.IDENTITY_MATRIX;\n                let v = View.TempMatrixValue;\n                matrix.getValues(v);\n                let transfrom = `matrix(${v[Matrix.MSCALE_X]}, ${-v[Matrix.MSKEW_X]}, ${-v[Matrix.MSKEW_Y]}, ${v[Matrix.MSCALE_Y]}, ${v[Matrix.MTRANS_X]}, ${v[Matrix.MTRANS_Y]})`;\n                if (this._lastSyncTransform != transfrom) {\n                    this._lastSyncTransform = this.bindElement.style.transform = this.bindElement.style.webkitTransform = transfrom;\n                }\n            }\n            syncVisibleToElement() {\n                let visibility = this.getVisibility();\n                if (visibility === View.VISIBLE) {\n                    this.bindElement.style.display = '';\n                    this.bindElement.style.visibility = '';\n                }\n                else if (visibility === View.INVISIBLE) {\n                    this.bindElement.style.display = '';\n                    this.bindElement.style.visibility = 'hidden';\n                }\n                else {\n                    this.bindElement.style.display = 'none';\n                    this.bindElement.style.visibility = '';\n                }\n            }\n            dependOnDebugLayout() {\n                return false;\n            }\n            _initAttrObserver() {\n                if (!window['MutationObserver'])\n                    return;\n                if (!this._AttrObserver)\n                    this._AttrObserver = new MutationObserver(View._AttrObserverCallBack);\n                else\n                    this._AttrObserver.disconnect();\n                this._AttrObserver.observe(this.bindElement, { attributes: true, attributeOldValue: true });\n            }\n            _fireStateChangeToAttribute(oldState, newState) {\n                if (!this._stateAttrList)\n                    return;\n                if (java.util.Arrays.equals(oldState, newState))\n                    return;\n                let oldMatchedAttr = this._stateAttrList.getMatchedStateAttr(oldState);\n                let matchedAttr = this._stateAttrList.getMatchedStateAttr(newState);\n                for (let [key, value] of matchedAttr.getAttrMap().entries()) {\n                    let attrValue = this._getBinderAttrValue(key);\n                    if (oldMatchedAttr) {\n                        oldMatchedAttr.setAttr(key, attrValue);\n                    }\n                    if (value == attrValue)\n                        continue;\n                    this.onBindElementAttributeChanged(key, null, value);\n                }\n            }\n            _getBinderAttrValue(key) {\n                if (!key)\n                    return null;\n                if (key.startsWith('layout_') || key.startsWith('android:layout_')) {\n                    let params = this.getLayoutParams();\n                    if (params) {\n                        return params.getAttrBinder().getAttrValue(key);\n                    }\n                }\n                else {\n                    return this._attrBinder.getAttrValue(key);\n                }\n            }\n            onBindElementAttributeChanged(attributeName, oldVal, newVal) {\n                let parts = attributeName.split(\":\");\n                let attrName = parts[parts.length - 1].toLowerCase();\n                if (newVal === 'true')\n                    newVal = true;\n                else if (newVal === 'false')\n                    newVal = false;\n                if (attrName.startsWith('layout_')) {\n                    let params = this.getLayoutParams();\n                    if (params) {\n                        params.getAttrBinder().onAttrChange(attrName, newVal, this.getContext());\n                        this.requestLayout();\n                    }\n                    return;\n                }\n                this._attrBinder.onAttrChange(attrName, newVal, this.getContext());\n            }\n            tagName() {\n                return this.constructor.name;\n            }\n        }\n        View.DBG = Log.View_DBG;\n        View.VIEW_LOG_TAG = \"View\";\n        View.PFLAG_WANTS_FOCUS = 0x00000001;\n        View.PFLAG_FOCUSED = 0x00000002;\n        View.PFLAG_SELECTED = 0x00000004;\n        View.PFLAG_IS_ROOT_NAMESPACE = 0x00000008;\n        View.PFLAG_HAS_BOUNDS = 0x00000010;\n        View.PFLAG_DRAWN = 0x00000020;\n        View.PFLAG_DRAW_ANIMATION = 0x00000040;\n        View.PFLAG_SKIP_DRAW = 0x00000080;\n        View.PFLAG_ONLY_DRAWS_BACKGROUND = 0x00000100;\n        View.PFLAG_REQUEST_TRANSPARENT_REGIONS = 0x00000200;\n        View.PFLAG_DRAWABLE_STATE_DIRTY = 0x00000400;\n        View.PFLAG_MEASURED_DIMENSION_SET = 0x00000800;\n        View.PFLAG_FORCE_LAYOUT = 0x00001000;\n        View.PFLAG_LAYOUT_REQUIRED = 0x00002000;\n        View.PFLAG_PRESSED = 0x00004000;\n        View.PFLAG_DRAWING_CACHE_VALID = 0x00008000;\n        View.PFLAG_ANIMATION_STARTED = 0x00010000;\n        View.PFLAG_ALPHA_SET = 0x00040000;\n        View.PFLAG_SCROLL_CONTAINER = 0x00080000;\n        View.PFLAG_SCROLL_CONTAINER_ADDED = 0x00100000;\n        View.PFLAG_DIRTY = 0x00200000;\n        View.PFLAG_DIRTY_OPAQUE = 0x00400000;\n        View.PFLAG_DIRTY_MASK = 0x00600000;\n        View.PFLAG_OPAQUE_BACKGROUND = 0x00800000;\n        View.PFLAG_OPAQUE_SCROLLBARS = 0x01000000;\n        View.PFLAG_OPAQUE_MASK = 0x01800000;\n        View.PFLAG_PREPRESSED = 0x02000000;\n        View.PFLAG_CANCEL_NEXT_UP_EVENT = 0x04000000;\n        View.PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH = 0x08000000;\n        View.PFLAG_HOVERED = 0x10000000;\n        View.PFLAG_PIVOT_EXPLICITLY_SET = 0x20000000;\n        View.PFLAG_ACTIVATED = 0x40000000;\n        View.PFLAG_INVALIDATED = 0x80000000;\n        View.PFLAG2_VIEW_QUICK_REJECTED = 0x10000000;\n        View.PFLAG2_HAS_TRANSIENT_STATE = 0x80000000;\n        View.PFLAG3_VIEW_IS_ANIMATING_TRANSFORM = 0x1;\n        View.PFLAG3_VIEW_IS_ANIMATING_ALPHA = 0x2;\n        View.PFLAG3_IS_LAID_OUT = 0x4;\n        View.PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT = 0x8;\n        View.PFLAG3_CALLED_SUPER = 0x10;\n        View.NOT_FOCUSABLE = 0x00000000;\n        View.FOCUSABLE = 0x00000001;\n        View.FOCUSABLE_MASK = 0x00000001;\n        View.OVER_SCROLL_ALWAYS = 0;\n        View.OVER_SCROLL_IF_CONTENT_SCROLLS = 1;\n        View.OVER_SCROLL_NEVER = 2;\n        View.MEASURED_SIZE_MASK = 0x00ffffff;\n        View.MEASURED_STATE_MASK = 0xff000000;\n        View.MEASURED_HEIGHT_STATE_SHIFT = 16;\n        View.MEASURED_STATE_TOO_SMALL = 0x01000000;\n        View.VISIBILITY_MASK = 0x0000000C;\n        View.VISIBLE = 0x00000000;\n        View.INVISIBLE = 0x00000004;\n        View.GONE = 0x00000008;\n        View.ENABLED = 0x00000000;\n        View.DISABLED = 0x00000020;\n        View.ENABLED_MASK = 0x00000020;\n        View.WILL_NOT_DRAW = 0x00000080;\n        View.DRAW_MASK = 0x00000080;\n        View.SCROLLBARS_NONE = 0x00000000;\n        View.SCROLLBARS_HORIZONTAL = 0x00000100;\n        View.SCROLLBARS_VERTICAL = 0x00000200;\n        View.SCROLLBARS_MASK = 0x00000300;\n        View.FOCUSABLES_ALL = 0x00000000;\n        View.FOCUSABLES_TOUCH_MODE = 0x00000001;\n        View.FOCUS_BACKWARD = 0x00000001;\n        View.FOCUS_FORWARD = 0x00000002;\n        View.FOCUS_LEFT = 0x00000011;\n        View.FOCUS_UP = 0x00000021;\n        View.FOCUS_RIGHT = 0x00000042;\n        View.FOCUS_DOWN = 0x00000082;\n        View.VIEW_STATE_WINDOW_FOCUSED = 1;\n        View.VIEW_STATE_SELECTED = 1 << 1;\n        View.VIEW_STATE_FOCUSED = 1 << 2;\n        View.VIEW_STATE_ENABLED = 1 << 3;\n        View.VIEW_STATE_PRESSED = 1 << 4;\n        View.VIEW_STATE_ACTIVATED = 1 << 5;\n        View.VIEW_STATE_HOVERED = 1 << 7;\n        View.VIEW_STATE_CHECKED = 1 << 10;\n        View.VIEW_STATE_MULTILINE = 1 << 11;\n        View.VIEW_STATE_EXPANDED = 1 << 12;\n        View.VIEW_STATE_EMPTY = 1 << 13;\n        View.VIEW_STATE_LAST = 1 << 14;\n        View.VIEW_STATE_IDS = [\n            View.VIEW_STATE_WINDOW_FOCUSED, View.VIEW_STATE_WINDOW_FOCUSED,\n            View.VIEW_STATE_SELECTED, View.VIEW_STATE_SELECTED,\n            View.VIEW_STATE_FOCUSED, View.VIEW_STATE_FOCUSED,\n            View.VIEW_STATE_ENABLED, View.VIEW_STATE_ENABLED,\n            View.VIEW_STATE_PRESSED, View.VIEW_STATE_PRESSED,\n            View.VIEW_STATE_ACTIVATED, View.VIEW_STATE_ACTIVATED,\n            View.VIEW_STATE_HOVERED, View.VIEW_STATE_HOVERED,\n        ];\n        View._static = (() => {\n            function Integer_bitCount(i) {\n                i = i - ((i >>> 1) & 0x55555555);\n                i = (i & 0x33333333) + ((i >>> 2) & 0x33333333);\n                i = (i + (i >>> 4)) & 0x0f0f0f0f;\n                i = i + (i >>> 8);\n                i = i + (i >>> 16);\n                return i & 0x3f;\n            }\n            let orderedIds = View.VIEW_STATE_IDS;\n            const NUM_BITS = View.VIEW_STATE_IDS.length / 2;\n            View.VIEW_STATE_SETS = new Array(1 << NUM_BITS);\n            for (let i = 0; i < View.VIEW_STATE_SETS.length; i++) {\n                let numBits = Integer_bitCount(i);\n                const stataSet = androidui.util.ArrayCreator.newNumberArray(numBits);\n                let pos = 0;\n                for (let j = 0; j < orderedIds.length; j += 2) {\n                    if ((i & orderedIds[j + 1]) != 0) {\n                        stataSet[pos++] = orderedIds[j];\n                    }\n                }\n                View.VIEW_STATE_SETS[i] = stataSet;\n            }\n            View.EMPTY_STATE_SET = View.VIEW_STATE_SETS[0];\n            View.WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED];\n            View.SELECTED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED];\n            View.SELECTED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_SELECTED];\n            View.FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_FOCUSED];\n            View.FOCUSED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_FOCUSED];\n            View.FOCUSED_SELECTED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED | View.VIEW_STATE_FOCUSED];\n            View.FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_SELECTED | View.VIEW_STATE_FOCUSED];\n            View.ENABLED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_ENABLED];\n            View.ENABLED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_ENABLED];\n            View.ENABLED_SELECTED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED | View.VIEW_STATE_ENABLED];\n            View.ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_SELECTED | View.VIEW_STATE_ENABLED];\n            View.ENABLED_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_FOCUSED | View.VIEW_STATE_ENABLED];\n            View.ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_ENABLED];\n            View.ENABLED_FOCUSED_SELECTED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_ENABLED];\n            View.ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_SELECTED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_ENABLED];\n            View.PRESSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_PRESSED];\n            View.PRESSED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_SELECTED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_SELECTED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_FOCUSED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_FOCUSED_SELECTED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_SELECTED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_ENABLED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_ENABLED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_ENABLED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_ENABLED_SELECTED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED | View.VIEW_STATE_ENABLED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_SELECTED | View.VIEW_STATE_ENABLED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_ENABLED_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_FOCUSED | View.VIEW_STATE_ENABLED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_ENABLED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_ENABLED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_SELECTED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_ENABLED | View.VIEW_STATE_PRESSED];\n        })();\n        View.CLICKABLE = 0x00004000;\n        View.DRAWING_CACHE_ENABLED = 0x00008000;\n        View.WILL_NOT_CACHE_DRAWING = 0x000020000;\n        View.FOCUSABLE_IN_TOUCH_MODE = 0x00040000;\n        View.LONG_CLICKABLE = 0x00200000;\n        View.DUPLICATE_PARENT_STATE = 0x00400000;\n        View.LAYER_TYPE_NONE = 0;\n        View.LAYER_TYPE_SOFTWARE = 1;\n        View.LAYOUT_DIRECTION_LTR = LayoutDirection.LTR;\n        View.LAYOUT_DIRECTION_RTL = LayoutDirection.RTL;\n        View.LAYOUT_DIRECTION_INHERIT = LayoutDirection.INHERIT;\n        View.LAYOUT_DIRECTION_LOCALE = LayoutDirection.LOCALE;\n        View.TEXT_DIRECTION_INHERIT = 0;\n        View.TEXT_DIRECTION_FIRST_STRONG = 1;\n        View.TEXT_DIRECTION_ANY_RTL = 2;\n        View.TEXT_DIRECTION_LTR = 3;\n        View.TEXT_DIRECTION_RTL = 4;\n        View.TEXT_DIRECTION_LOCALE = 5;\n        View.TEXT_DIRECTION_DEFAULT = View.TEXT_DIRECTION_INHERIT;\n        View.TEXT_DIRECTION_RESOLVED_DEFAULT = View.TEXT_DIRECTION_FIRST_STRONG;\n        View.TEXT_ALIGNMENT_INHERIT = 0;\n        View.TEXT_ALIGNMENT_GRAVITY = 1;\n        View.TEXT_ALIGNMENT_TEXT_START = 2;\n        View.TEXT_ALIGNMENT_TEXT_END = 3;\n        View.TEXT_ALIGNMENT_CENTER = 4;\n        View.TEXT_ALIGNMENT_VIEW_START = 5;\n        View.TEXT_ALIGNMENT_VIEW_END = 6;\n        View.TEXT_ALIGNMENT_DEFAULT = View.TEXT_ALIGNMENT_GRAVITY;\n        View.TEXT_ALIGNMENT_RESOLVED_DEFAULT = View.TEXT_ALIGNMENT_GRAVITY;\n        View.ViewClassAttrBinderClazzMap = new Map();\n        View.AndroidViewProperty = 'AndroidView';\n        View.TempMatrixValue = androidui.util.ArrayCreator.newNumberArray(9);\n        view_1.View = View;\n        (function (View) {\n            class TransformationInfo {\n                constructor() {\n                    this.mMatrix = new Matrix();\n                    this.mMatrixDirty = false;\n                    this.mInverseMatrixDirty = true;\n                    this.mMatrixIsIdentity = true;\n                    this.mPrevWidth = -1;\n                    this.mPrevHeight = -1;\n                    this.mRotation = 0;\n                    this.mTranslationX = 0;\n                    this.mTranslationY = 0;\n                    this.mScaleX = 1;\n                    this.mScaleY = 1;\n                    this.mPivotX = 0;\n                    this.mPivotY = 0;\n                    this.mAlpha = 1;\n                    this.mTransitionAlpha = 1;\n                }\n            }\n            View.TransformationInfo = TransformationInfo;\n            class MeasureSpec {\n                static makeMeasureSpec(size, mode) {\n                    return (size & ~MeasureSpec.MODE_MASK) | (mode & MeasureSpec.MODE_MASK);\n                }\n                static getMode(measureSpec) {\n                    return (measureSpec & MeasureSpec.MODE_MASK);\n                }\n                static getSize(measureSpec) {\n                    return (measureSpec & ~MeasureSpec.MODE_MASK);\n                }\n                static adjust(measureSpec, delta) {\n                    return MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(measureSpec + delta), MeasureSpec.getMode(measureSpec));\n                }\n                static toString(measureSpec) {\n                    let mode = MeasureSpec.getMode(measureSpec);\n                    let size = MeasureSpec.getSize(measureSpec);\n                    let sb = new StringBuilder(\"MeasureSpec: \");\n                    if (mode == MeasureSpec.UNSPECIFIED)\n                        sb.append(\"UNSPECIFIED \");\n                    else if (mode == MeasureSpec.EXACTLY)\n                        sb.append(\"EXACTLY \");\n                    else if (mode == MeasureSpec.AT_MOST)\n                        sb.append(\"AT_MOST \");\n                    else\n                        sb.append(mode).append(\" \");\n                    sb.append(size);\n                    return sb.toString();\n                }\n            }\n            MeasureSpec.MODE_SHIFT = 30;\n            MeasureSpec.MODE_MASK = 0x3 << MeasureSpec.MODE_SHIFT;\n            MeasureSpec.UNSPECIFIED = 0 << MeasureSpec.MODE_SHIFT;\n            MeasureSpec.EXACTLY = 1 << MeasureSpec.MODE_SHIFT;\n            MeasureSpec.AT_MOST = 2 << MeasureSpec.MODE_SHIFT;\n            View.MeasureSpec = MeasureSpec;\n            class AttachInfo {\n                constructor(mViewRootImpl, mHandler) {\n                    this.mKeyDispatchState = new KeyEvent.DispatcherState();\n                    this.mTmpInvalRect = new Rect();\n                    this.mTmpTransformRect = new Rect();\n                    this.mPoint = new Point();\n                    this.mTmpMatrix = new Matrix();\n                    this.mTmpTransformation = new Transformation();\n                    this.mTmpTransformLocation = androidui.util.ArrayCreator.newNumberArray(2);\n                    this.mScrollContainers = new Set();\n                    this.mInvalidateChildLocation = androidui.util.ArrayCreator.newNumberArray(2);\n                    this.mHasWindowFocus = false;\n                    this.mWindowVisibility = 0;\n                    this.mViewRootImpl = mViewRootImpl;\n                    this.mHandler = mHandler;\n                }\n            }\n            View.AttachInfo = AttachInfo;\n            class ListenerInfo {\n            }\n            View.ListenerInfo = ListenerInfo;\n            var OnClickListener;\n            (function (OnClickListener) {\n                function fromFunction(func) {\n                    return {\n                        onClick: func\n                    };\n                }\n                OnClickListener.fromFunction = fromFunction;\n            })(OnClickListener = View.OnClickListener || (View.OnClickListener = {}));\n            var OnLongClickListener;\n            (function (OnLongClickListener) {\n                function fromFunction(func) {\n                    return {\n                        onLongClick: func\n                    };\n                }\n                OnLongClickListener.fromFunction = fromFunction;\n            })(OnLongClickListener = View.OnLongClickListener || (View.OnLongClickListener = {}));\n            var OnFocusChangeListener;\n            (function (OnFocusChangeListener) {\n                function fromFunction(func) {\n                    return {\n                        onFocusChange: func\n                    };\n                }\n                OnFocusChangeListener.fromFunction = fromFunction;\n            })(OnFocusChangeListener = View.OnFocusChangeListener || (View.OnFocusChangeListener = {}));\n            var OnTouchListener;\n            (function (OnTouchListener) {\n                function fromFunction(func) {\n                    return {\n                        onTouch: func\n                    };\n                }\n                OnTouchListener.fromFunction = fromFunction;\n            })(OnTouchListener = View.OnTouchListener || (View.OnTouchListener = {}));\n            var OnKeyListener;\n            (function (OnKeyListener) {\n                function fromFunction(func) {\n                    return {\n                        onKey: func\n                    };\n                }\n                OnKeyListener.fromFunction = fromFunction;\n            })(OnKeyListener = View.OnKeyListener || (View.OnKeyListener = {}));\n            var OnGenericMotionListener;\n            (function (OnGenericMotionListener) {\n                function fromFunction(func) {\n                    return {\n                        onGenericMotion: func\n                    };\n                }\n                OnGenericMotionListener.fromFunction = fromFunction;\n            })(OnGenericMotionListener = View.OnGenericMotionListener || (View.OnGenericMotionListener = {}));\n        })(View = view_1.View || (view_1.View = {}));\n        (function (View) {\n            var AttachInfo;\n            (function (AttachInfo) {\n                class InvalidateInfo {\n                    constructor() {\n                        this.left = 0;\n                        this.top = 0;\n                        this.right = 0;\n                        this.bottom = 0;\n                    }\n                    static obtain() {\n                        let instance = InvalidateInfo.sPool.acquire();\n                        return (instance != null) ? instance : new InvalidateInfo();\n                    }\n                    recycle() {\n                        this.target = null;\n                        InvalidateInfo.sPool.release(this);\n                    }\n                }\n                InvalidateInfo.POOL_LIMIT = 10;\n                InvalidateInfo.sPool = new Pools.SynchronizedPool(InvalidateInfo.POOL_LIMIT);\n                AttachInfo.InvalidateInfo = InvalidateInfo;\n            })(AttachInfo = View.AttachInfo || (View.AttachInfo = {}));\n        })(View = view_1.View || (view_1.View = {}));\n        class CheckForLongPress {\n            constructor(View_this) {\n                this.mOriginalWindowAttachCount = 0;\n                this.View_this = View_this;\n            }\n            run() {\n                if (this.View_this.isPressed() && (this.View_this.mParent != null)\n                    && this.mOriginalWindowAttachCount == this.View_this.mWindowAttachCount) {\n                    if (this.View_this.performLongClick()) {\n                        this.View_this.mHasPerformedLongPress = true;\n                    }\n                }\n            }\n            rememberWindowAttachCount() {\n                this.mOriginalWindowAttachCount = this.View_this.mWindowAttachCount;\n            }\n        }\n        class CheckForTap {\n            constructor(View_this) {\n                this.View_this = View_this;\n            }\n            run() {\n                this.View_this.mPrivateFlags &= ~View.PFLAG_PREPRESSED;\n                this.View_this.setPressed(true);\n                this.View_this.checkForLongClick(view_1.ViewConfiguration.getTapTimeout());\n            }\n        }\n        class PerformClick {\n            constructor(View_this) {\n                this.View_this = View_this;\n            }\n            run() {\n                this.View_this.performClick();\n            }\n        }\n        class PerformClickAfterPressDraw {\n            constructor(View_this) {\n                this.View_this = View_this;\n            }\n            run() {\n                this.View_this.post(this.View_this.mPerformClick);\n            }\n        }\n        class UnsetPressedState {\n            constructor(View_this) {\n                this.View_this = View_this;\n            }\n            run() {\n                this.View_this.setPressed(false);\n            }\n        }\n        class ScrollabilityCache {\n            constructor(host) {\n                this.fadeScrollBars = true;\n                this.fadingEdgeLength = view_1.ViewConfiguration.get().getScaledFadingEdgeLength();\n                this.scrollBarDefaultDelayBeforeFade = view_1.ViewConfiguration.getScrollDefaultDelay();\n                this.scrollBarFadeDuration = view_1.ViewConfiguration.getScrollBarFadeDuration();\n                this.scrollBarSize = view_1.ViewConfiguration.get().getScaledScrollBarSize();\n                this.interpolator = new LinearInterpolator();\n                this.state = ScrollabilityCache.OFF;\n                this.host = host;\n                this.scrollBar = new ScrollBarDrawable();\n                let thumbColor = new ColorDrawable(0x44000000);\n                let density = Resources.getDisplayMetrics().density;\n                let thumb = new InsetDrawable(thumbColor, 0, 2 * density, view_1.ViewConfiguration.get().getScaledScrollBarSize() / 2, 2 * density);\n                this.scrollBar.setHorizontalThumbDrawable(thumb);\n                this.scrollBar.setVerticalThumbDrawable(thumb);\n            }\n            run() {\n                let now = AnimationUtils.currentAnimationTimeMillis();\n                if (now >= this.fadeStartTime) {\n                    this.state = ScrollabilityCache.FADING;\n                    this.host.invalidate(true);\n                }\n            }\n            _computeAlphaToScrollBar() {\n                let now = AnimationUtils.currentAnimationTimeMillis();\n                let factor = (now - this.fadeStartTime) / this.scrollBarFadeDuration;\n                if (factor >= 1) {\n                    this.state = ScrollabilityCache.OFF;\n                    factor = 1;\n                }\n                let alpha = 1 - this.interpolator.getInterpolation(factor);\n                this.scrollBar.setAlpha(255 * alpha);\n            }\n        }\n        ScrollabilityCache.OFF = 0;\n        ScrollabilityCache.ON = 1;\n        ScrollabilityCache.FADING = 2;\n        class MatchIdPredicate {\n            apply(view) {\n                return view.mID === this.mId;\n            }\n        }\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var Rect = android.graphics.Rect;\n        var Canvas = android.graphics.Canvas;\n        class Surface {\n            constructor(canvasElement, viewRoot) {\n                this.mLockedRect = new Rect();\n                this.mCanvasBound = new Rect();\n                this.mSupportDirtyDraw = true;\n                this.mLockSaveCount = 1;\n                this.mCanvasElement = canvasElement;\n                this.viewRoot = viewRoot;\n                this.initImpl();\n            }\n            initImpl() {\n                this.initCanvasBound();\n            }\n            isValid() {\n                return true;\n            }\n            notifyBoundChange() {\n                this.initCanvasBound();\n            }\n            initCanvasBound() {\n                let density = android.content.res.Resources.getDisplayMetrics().density;\n                let clientRect = this.mCanvasElement.getBoundingClientRect();\n                this.mCanvasBound.set(clientRect.left * density, clientRect.top * density, clientRect.right * density, clientRect.bottom * density);\n            }\n            lockCanvas(dirty) {\n                let fullWidth = this.mCanvasBound.width();\n                let fullHeight = this.mCanvasBound.height();\n                if (!this.mSupportDirtyDraw)\n                    dirty.set(0, 0, fullWidth, fullHeight);\n                let rect = this.mLockedRect;\n                rect.set(Math.floor(dirty.left), Math.floor(dirty.top), Math.ceil(dirty.right), Math.ceil(dirty.bottom));\n                if (dirty.isEmpty()) {\n                    rect.set(0, 0, fullWidth, fullHeight);\n                }\n                if (rect.isEmpty())\n                    return null;\n                return this.lockCanvasImpl(rect.left, rect.top, rect.width(), rect.height());\n            }\n            lockCanvasImpl(left, top, width, height) {\n                let canvas;\n                if (Surface.DrawToCacheFirstMode) {\n                    canvas = new Canvas(width, height);\n                    if (left != 0 || top != 0)\n                        canvas.translate(-left, -top);\n                }\n                else {\n                    canvas = new SurfaceLockCanvas(this.mCanvasBound.width(), this.mCanvasBound.height(), this.mCanvasElement);\n                    this.mLockSaveCount = canvas.save();\n                    canvas.clipRect(left, top, left + width, top + height);\n                }\n                return canvas;\n            }\n            unlockCanvasAndPost(canvas) {\n                if (Surface.DrawToCacheFirstMode) {\n                    let mCanvasContent = this.mCanvasElement.getContext('2d');\n                    if (canvas.mCanvasElement)\n                        mCanvasContent.drawImage(canvas.mCanvasElement, this.mLockedRect.left, this.mLockedRect.top);\n                    canvas.recycle();\n                }\n                else {\n                    canvas.restoreToCount(this.mLockSaveCount);\n                }\n            }\n            showFps(fps) {\n                if (!this._showFPSNode) {\n                    this._showFPSNode = document.createElement('div');\n                    this._showFPSNode.style.position = 'absolute';\n                    this._showFPSNode.style.top = '0';\n                    this._showFPSNode.style.left = '0';\n                    this._showFPSNode.style.width = '60px';\n                    this._showFPSNode.style.fontSize = '14px';\n                    this._showFPSNode.style.background = 'black';\n                    this._showFPSNode.style.color = 'white';\n                    this._showFPSNode.style.opacity = '0.7';\n                    this._showFPSNode.style.zIndex = '1';\n                    this.mCanvasElement.parentNode.appendChild(this._showFPSNode);\n                }\n                this._showFPSNode.innerText = 'FPS:' + fps.toFixed(1);\n            }\n        }\n        Surface.DrawToCacheFirstMode = false;\n        view.Surface = Surface;\n        class SurfaceLockCanvas extends Canvas {\n            constructor(width, height, canvasElement) {\n                super(width, height);\n                this.mCanvasElement = canvasElement;\n                this._mCanvasContent = this.mCanvasElement.getContext(\"2d\");\n            }\n            initCanvasImpl() {\n            }\n        }\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view_2) {\n        var View = android.view.View;\n        var Rect = android.graphics.Rect;\n        var Handler = android.os.Handler;\n        var SystemClock = android.os.SystemClock;\n        var System = java.lang.System;\n        var Log = android.util.Log;\n        var Surface = android.view.Surface;\n        class ViewRootImpl {\n            constructor() {\n                this.mViewVisibility = View.GONE;\n                this.mStopped = false;\n                this.mWidth = -1;\n                this.mHeight = -1;\n                this.mDirty = new Rect();\n                this.mIsAnimating = false;\n                this.mTempRect = new Rect();\n                this.mVisRect = new Rect();\n                this.mTraversalScheduled = false;\n                this.mWillDrawSoon = false;\n                this.mIsInTraversal = false;\n                this.mLayoutRequested = false;\n                this.mFirst = true;\n                this.mFullRedrawNeeded = false;\n                this.mIsDrawing = false;\n                this.mAdded = false;\n                this.mAddedTouchMode = false;\n                this.mInTouchMode = false;\n                this.mWinFrame = new Rect();\n                this.mLayoutRequesters = [];\n                this.mHandler = new ViewRootHandler();\n                this.mViewScrollChanged = false;\n                this.mTreeObserver = new view_2.ViewTreeObserver();\n                this.mIgnoreDirtyState = false;\n                this.mSetIgnoreDirtyState = false;\n                this.mDrawingTime = 0;\n                this.mFpsStartTime = -1;\n                this.mFpsPrevTime = -1;\n                this.mFpsNumFrames = 0;\n                this.mTraversalRunnable = new TraversalRunnable(this);\n                this._continueTraversalesCount = 0;\n                this.mInvalidateOnAnimationRunnable = new InvalidateOnAnimationRunnable(this.mHandler);\n            }\n            initSurface(canvasElement) {\n                this.mSurface = new Surface(canvasElement, this);\n            }\n            notifyResized(frame) {\n                this.mWinFrame.set(frame.left, frame.top, frame.right, frame.bottom);\n                this.requestLayout();\n                if (this.mSurface)\n                    this.mSurface.notifyBoundChange();\n            }\n            setView(view) {\n                if (this.mView == null) {\n                    this.mView = view;\n                    this.mAdded = true;\n                    this.requestLayout();\n                    view.assignParent(this);\n                    this.mAddedTouchMode = true;\n                    let syntheticInputStage = new SyntheticInputStage(this);\n                    let viewPostImeStage = new ViewPostImeInputStage(this, syntheticInputStage);\n                    let earlyPostImeStage = new EarlyPostImeInputStage(this, viewPostImeStage);\n                    this.mFirstInputStage = earlyPostImeStage;\n                }\n            }\n            getView() {\n                return this.mView;\n            }\n            getHostVisibility() {\n                return this.mView.getVisibility();\n            }\n            scheduleTraversals() {\n                if (!this.mTraversalScheduled) {\n                    this.mTraversalScheduled = true;\n                    this.mHandler.postAsTraversal(this.mTraversalRunnable);\n                }\n            }\n            unscheduleTraversals() {\n                if (this.mTraversalScheduled) {\n                    this.mTraversalScheduled = false;\n                    this.mHandler.removeCallbacks(this.mTraversalRunnable);\n                }\n            }\n            doTraversal() {\n                if (this.mTraversalScheduled) {\n                    this.mTraversalScheduled = false;\n                    this.performTraversals();\n                }\n            }\n            measureHierarchy(host, lp, desiredWindowWidth, desiredWindowHeight) {\n                let windowSizeMayChange = false;\n                if (ViewRootImpl.DEBUG_ORIENTATION || ViewRootImpl.DEBUG_LAYOUT)\n                    Log.v(ViewRootImpl.TAG, \"Measuring \" + host + \" in display \" + desiredWindowWidth\n                        + \"x\" + desiredWindowHeight + \"...\");\n                let childWidthMeasureSpec = ViewRootImpl.getRootMeasureSpec(desiredWindowWidth, lp.width);\n                let childHeightMeasureSpec = ViewRootImpl.getRootMeasureSpec(desiredWindowHeight, lp.height);\n                this.performMeasure(childWidthMeasureSpec, childHeightMeasureSpec);\n                if (this.mWidth != host.getMeasuredWidth() || this.mHeight != host.getMeasuredHeight()) {\n                    windowSizeMayChange = true;\n                }\n                if (ViewRootImpl.DBG) {\n                    System.out.println(\"======================================\");\n                    System.out.println(\"performTraversals -- after measure\");\n                    host.debug();\n                }\n                return windowSizeMayChange;\n            }\n            static getRootMeasureSpec(windowSize, rootDimension) {\n                let MeasureSpec = View.MeasureSpec;\n                let measureSpec;\n                switch (rootDimension) {\n                    case view_2.ViewGroup.LayoutParams.MATCH_PARENT:\n                        measureSpec = MeasureSpec.makeMeasureSpec(windowSize, MeasureSpec.EXACTLY);\n                        break;\n                    case view_2.ViewGroup.LayoutParams.WRAP_CONTENT:\n                        measureSpec = MeasureSpec.makeMeasureSpec(windowSize, MeasureSpec.AT_MOST);\n                        break;\n                    default:\n                        measureSpec = MeasureSpec.makeMeasureSpec(rootDimension, MeasureSpec.EXACTLY);\n                        break;\n                }\n                return measureSpec;\n            }\n            performTraversals() {\n                let host = this.mView;\n                if (ViewRootImpl.DBG) {\n                    System.out.println(\"======================================\");\n                    System.out.println(\"performTraversals\");\n                    host.debug();\n                }\n                if (host == null || !this.mAdded)\n                    return;\n                this.mIsInTraversal = true;\n                this.mWillDrawSoon = true;\n                let windowSizeMayChange = false;\n                let newSurface = false;\n                let surfaceChanged = false;\n                let lp = new view_2.ViewGroup.LayoutParams(view_2.ViewGroup.LayoutParams.MATCH_PARENT, view_2.ViewGroup.LayoutParams.MATCH_PARENT);\n                let desiredWindowWidth;\n                let desiredWindowHeight;\n                let viewVisibility = this.getHostVisibility();\n                let viewVisibilityChanged = this.mViewVisibility != viewVisibility;\n                let params = null;\n                let frame = this.mWinFrame;\n                desiredWindowWidth = frame.width();\n                desiredWindowHeight = frame.height();\n                if (this.mFirst) {\n                    this.mFullRedrawNeeded = true;\n                    this.mLayoutRequested = true;\n                    viewVisibilityChanged = false;\n                }\n                else {\n                    if (desiredWindowWidth != this.mWidth || desiredWindowHeight != this.mHeight) {\n                        if (ViewRootImpl.DEBUG_ORIENTATION) {\n                            Log.v(ViewRootImpl.TAG, \"View \" + host + \" resized to: \" + frame);\n                        }\n                        this.mFullRedrawNeeded = true;\n                        this.mLayoutRequested = true;\n                        windowSizeMayChange = true;\n                    }\n                }\n                if (viewVisibilityChanged) {\n                }\n                ViewRootImpl.getRunQueue(this).executeActions(this.mHandler);\n                let layoutRequested = this.mLayoutRequested;\n                if (layoutRequested) {\n                    if (this.mFirst) {\n                        this.mInTouchMode = !this.mAddedTouchMode;\n                        this.ensureTouchModeLocally(this.mAddedTouchMode);\n                    }\n                    else {\n                        if (lp.width < 0 || lp.height < 0) {\n                            windowSizeMayChange = true;\n                        }\n                    }\n                    windowSizeMayChange = this.measureHierarchy(host, lp, desiredWindowWidth, desiredWindowHeight) || windowSizeMayChange;\n                }\n                if (layoutRequested) {\n                    this.mLayoutRequested = false;\n                }\n                let windowShouldResize = layoutRequested && windowSizeMayChange\n                    && ((this.mWidth != host.getMeasuredWidth() || this.mHeight != host.getMeasuredHeight())\n                        || (lp.width < 0 && frame.width() !== desiredWindowWidth && frame.width() !== this.mWidth)\n                        || (lp.height < 0 && frame.height() !== desiredWindowHeight && frame.height() !== this.mHeight));\n                if (this.mFirst || windowShouldResize || viewVisibilityChanged) {\n                    if (ViewRootImpl.DEBUG_LAYOUT) {\n                        Log.i(ViewRootImpl.TAG, \"host=w:\" + host.getMeasuredWidth() + \", h:\" +\n                            host.getMeasuredHeight() + \", params=\" + params);\n                    }\n                    if (ViewRootImpl.DEBUG_ORIENTATION)\n                        Log.v(ViewRootImpl.TAG, \"Relayout returned: frame=\" + frame);\n                    if (this.mWidth != frame.width() || this.mHeight != frame.height()) {\n                        this.mWidth = frame.width();\n                        this.mHeight = frame.height();\n                    }\n                    if (this.mWidth != host.getMeasuredWidth()\n                        || this.mHeight != host.getMeasuredHeight()) {\n                        let childWidthMeasureSpec = ViewRootImpl.getRootMeasureSpec(this.mWidth, lp.width);\n                        let childHeightMeasureSpec = ViewRootImpl.getRootMeasureSpec(this.mHeight, lp.height);\n                        if (ViewRootImpl.DEBUG_LAYOUT)\n                            Log.v(ViewRootImpl.TAG, \"Ooops, something changed!  mWidth=\"\n                                + this.mWidth + \" measuredWidth=\" + host.getMeasuredWidth()\n                                + \" mHeight=\" + this.mHeight\n                                + \" measuredHeight=\" + host.getMeasuredHeight());\n                        this.performMeasure(childWidthMeasureSpec, childHeightMeasureSpec);\n                        layoutRequested = true;\n                    }\n                }\n                else {\n                }\n                const didLayout = layoutRequested;\n                let triggerGlobalLayoutListener = didLayout;\n                if (didLayout) {\n                    this.performLayout(lp, desiredWindowWidth, desiredWindowHeight);\n                    if (ViewRootImpl.DBG) {\n                        System.out.println(\"======================================\");\n                        System.out.println(\"performTraversals -- after setFrame\");\n                        host.debug();\n                    }\n                }\n                if (triggerGlobalLayoutListener) {\n                    this.mTreeObserver.dispatchOnGlobalLayout();\n                }\n                let skipDraw = false;\n                if (this.mFirst) {\n                    if (ViewRootImpl.DEBUG_INPUT_RESIZE)\n                        Log.v(ViewRootImpl.TAG, \"First: mView.hasFocus()=\"\n                            + this.mView.hasFocus());\n                    if (this.mView != null) {\n                        if (!this.mView.hasFocus()) {\n                            this.mView.requestFocus(View.FOCUS_FORWARD);\n                            if (ViewRootImpl.DEBUG_INPUT_RESIZE)\n                                Log.v(ViewRootImpl.TAG, \"First: requested focused view=\"\n                                    + this.mView.findFocus());\n                        }\n                        else {\n                            if (ViewRootImpl.DEBUG_INPUT_RESIZE)\n                                Log.v(ViewRootImpl.TAG, \"First: existing focused view=\"\n                                    + this.mView.findFocus());\n                        }\n                    }\n                }\n                this.mFirst = false;\n                this.mWillDrawSoon = false;\n                this.mViewVisibility = viewVisibility;\n                let cancelDraw = this.mTreeObserver.dispatchOnPreDraw() ||\n                    viewVisibility != View.VISIBLE;\n                if (!cancelDraw) {\n                    if (!skipDraw) {\n                        this.performDraw();\n                    }\n                }\n                else {\n                    if (viewVisibility == View.VISIBLE) {\n                        this.scheduleTraversals();\n                    }\n                }\n                this.mIsInTraversal = false;\n                this.checkContinueTraversalsNextFrame();\n            }\n            performLayout(lp, desiredWindowWidth, desiredWindowHeight) {\n                this.mLayoutRequested = false;\n                this.mInLayout = true;\n                let host = this.mView;\n                if (ViewRootImpl.DEBUG_ORIENTATION || ViewRootImpl.DEBUG_LAYOUT) {\n                    Log.v(ViewRootImpl.TAG, \"Laying out \" + host + \" to (\" +\n                        host.getMeasuredWidth() + \", \" + host.getMeasuredHeight() + \")\");\n                }\n                host.layout(0, 0, host.getMeasuredWidth(), host.getMeasuredHeight());\n                this.mInLayout = false;\n                let numViewsRequestingLayout = this.mLayoutRequesters.length;\n                if (numViewsRequestingLayout > 0) {\n                    let validLayoutRequesters = this.getValidLayoutRequesters(this.mLayoutRequesters, false);\n                    if (validLayoutRequesters != null) {\n                        this.mHandlingLayoutInLayoutRequest = true;\n                        let numValidRequests = validLayoutRequesters.length;\n                        for (let i = 0; i < numValidRequests; ++i) {\n                            let view = validLayoutRequesters[i];\n                            Log.w(\"View\", \"requestLayout() improperly called by \" + view +\n                                \" during layout: running second layout pass\");\n                            view.requestLayout();\n                        }\n                        this.measureHierarchy(host, lp, desiredWindowWidth, desiredWindowHeight);\n                        this.mInLayout = true;\n                        host.layout(0, 0, host.getMeasuredWidth(), host.getMeasuredHeight());\n                        this.mHandlingLayoutInLayoutRequest = false;\n                        validLayoutRequesters = this.getValidLayoutRequesters(this.mLayoutRequesters, true);\n                        if (validLayoutRequesters != null) {\n                            let finalRequesters = validLayoutRequesters;\n                            ViewRootImpl.getRunQueue(this).post({\n                                run() {\n                                    let numValidRequests = finalRequesters.length;\n                                    for (let i = 0; i < numValidRequests; ++i) {\n                                        const view = finalRequesters[i];\n                                        Log.w(\"View\", \"requestLayout() improperly called by \" + view +\n                                            \" during second layout pass: posting in next frame\");\n                                        view.requestLayout();\n                                    }\n                                }\n                            });\n                        }\n                    }\n                }\n                this.mInLayout = false;\n            }\n            getValidLayoutRequesters(layoutRequesters, secondLayoutRequests) {\n                let numViewsRequestingLayout = layoutRequesters.length;\n                let validLayoutRequesters = null;\n                for (let i = 0; i < numViewsRequestingLayout; ++i) {\n                    let view = layoutRequesters[i];\n                    if (view != null && view.mAttachInfo != null && view.mParent != null &&\n                        (secondLayoutRequests || (view.mPrivateFlags & View.PFLAG_FORCE_LAYOUT) ==\n                            View.PFLAG_FORCE_LAYOUT)) {\n                        let gone = false;\n                        let parent = view;\n                        while (parent != null) {\n                            if ((parent.mViewFlags & View.VISIBILITY_MASK) == View.GONE) {\n                                gone = true;\n                                break;\n                            }\n                            if (parent.mParent instanceof View) {\n                                parent = parent.mParent;\n                            }\n                            else {\n                                parent = null;\n                            }\n                        }\n                        if (!gone) {\n                            if (validLayoutRequesters == null) {\n                                validLayoutRequesters = [];\n                            }\n                            validLayoutRequesters.push(view);\n                        }\n                    }\n                }\n                if (!secondLayoutRequests) {\n                    for (let i = 0; i < numViewsRequestingLayout; ++i) {\n                        let view = layoutRequesters[i];\n                        while (view != null &&\n                            (view.mPrivateFlags & View.PFLAG_FORCE_LAYOUT) != 0) {\n                            view.mPrivateFlags &= ~View.PFLAG_FORCE_LAYOUT;\n                            if (view.mParent instanceof View) {\n                                view = view.mParent;\n                            }\n                            else {\n                                view = null;\n                            }\n                        }\n                    }\n                }\n                layoutRequesters.splice(0, layoutRequesters.length);\n                return validLayoutRequesters;\n            }\n            performMeasure(childWidthMeasureSpec, childHeightMeasureSpec) {\n                this.mView.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n            }\n            isInLayout() {\n                return this.mInLayout;\n            }\n            requestLayoutDuringLayout(view) {\n                if (view.mParent == null || view.mAttachInfo == null) {\n                    return true;\n                }\n                if (this.mLayoutRequesters.indexOf(view) === -1) {\n                    this.mLayoutRequesters.push(view);\n                }\n                if (!this.mHandlingLayoutInLayoutRequest) {\n                    return true;\n                }\n                else {\n                    return false;\n                }\n            }\n            trackFPS() {\n                let nowTime = System.currentTimeMillis();\n                if (this.mFpsStartTime < 0) {\n                    this.mFpsStartTime = this.mFpsPrevTime = nowTime;\n                    this.mFpsNumFrames = 0;\n                }\n                else {\n                    this.mFpsNumFrames++;\n                    let frameTime = nowTime - this.mFpsPrevTime;\n                    let totalTime = nowTime - this.mFpsStartTime;\n                    this.mFpsPrevTime = nowTime;\n                    if (totalTime > 1000) {\n                        let fps = this.mFpsNumFrames * 1000 / totalTime;\n                        Log.v(ViewRootImpl.TAG, \"FPS:\\t\" + fps);\n                        this.mSurface.showFps(fps);\n                        this.mFpsStartTime = nowTime;\n                        this.mFpsNumFrames = 0;\n                    }\n                }\n            }\n            performDraw() {\n                let fullRedrawNeeded = this.mFullRedrawNeeded;\n                this.mFullRedrawNeeded = false;\n                this.mIsDrawing = true;\n                try {\n                    this.draw(fullRedrawNeeded);\n                }\n                finally {\n                    this.mIsDrawing = false;\n                }\n            }\n            draw(fullRedrawNeeded) {\n                let surface = this.mSurface;\n                if (!surface.isValid()) {\n                    return;\n                }\n                if (ViewRootImpl.DEBUG_FPS) {\n                    this.trackFPS();\n                }\n                if (this.mViewScrollChanged) {\n                    this.mViewScrollChanged = false;\n                    this.mTreeObserver.dispatchOnScrollChanged();\n                }\n                if (fullRedrawNeeded) {\n                    this.mIgnoreDirtyState = true;\n                    this.mDirty.set(0, 0, this.mWidth, this.mHeight);\n                }\n                if (ViewRootImpl.DEBUG_ORIENTATION || ViewRootImpl.DEBUG_DRAW) {\n                    Log.v(ViewRootImpl.TAG, \"Draw \" + this.mView + \", width=\" + this.mWidth + \", height=\" + this.mHeight + \", dirty=\" + this.mDirty);\n                }\n                this.mTreeObserver.dispatchOnDraw();\n                this.drawSoftware();\n            }\n            drawSoftware() {\n                let canvas;\n                try {\n                    canvas = this.mSurface.lockCanvas(this.mDirty);\n                    if (!canvas)\n                        return;\n                }\n                catch (e) {\n                    return;\n                }\n                this.mDirty.setEmpty();\n                this.mIsAnimating = false;\n                this.mDrawingTime = SystemClock.uptimeMillis();\n                this.mView.mPrivateFlags |= View.PFLAG_DRAWN;\n                this.mSetIgnoreDirtyState = false;\n                if (!this.mSurface['lastRenderCanvas'])\n                    this.mView.draw(canvas);\n                if (!this.mSetIgnoreDirtyState) {\n                    this.mIgnoreDirtyState = false;\n                }\n                this.mSurface.unlockCanvasAndPost(this.mSurface['lastRenderCanvas'] || canvas);\n                if (ViewRootImpl.LOCAL_LOGV) {\n                    Log.v(ViewRootImpl.TAG, \"Surface unlockCanvasAndPost\");\n                }\n            }\n            checkContinueTraversalsNextFrame() {\n                const continueFrame = ViewRootImpl.DEBUG_FPS ? 60 : 5;\n                if (!this.mTraversalScheduled && this._continueTraversalesCount < continueFrame) {\n                    this._continueTraversalesCount++;\n                    this.scheduleTraversals();\n                }\n                else {\n                    this._continueTraversalesCount = 0;\n                }\n            }\n            isLayoutRequested() {\n                return this.mLayoutRequested;\n            }\n            dispatchInvalidateDelayed(view, delayMilliseconds) {\n                let msg = this.mHandler.obtainMessage(ViewRootHandler.MSG_INVALIDATE, view);\n                this.mHandler.sendMessageDelayed(msg, delayMilliseconds);\n            }\n            dispatchInvalidateRectDelayed(info, delayMilliseconds) {\n                let msg = this.mHandler.obtainMessage(ViewRootHandler.MSG_INVALIDATE_RECT, info);\n                this.mHandler.sendMessageDelayed(msg, delayMilliseconds);\n            }\n            dispatchInvalidateOnAnimation(view) {\n                this.mInvalidateOnAnimationRunnable.addView(view);\n            }\n            dispatchInvalidateRectOnAnimation(info) {\n                this.mInvalidateOnAnimationRunnable.addViewRect(info);\n            }\n            cancelInvalidate(view) {\n                this.mHandler.removeMessages(ViewRootHandler.MSG_INVALIDATE, view);\n                this.mHandler.removeMessages(ViewRootHandler.MSG_INVALIDATE_RECT, view);\n                this.mInvalidateOnAnimationRunnable.removeView(view);\n            }\n            getParent() {\n                return null;\n            }\n            requestLayout() {\n                if (!this.mHandlingLayoutInLayoutRequest) {\n                    this.mLayoutRequested = true;\n                    this.scheduleTraversals();\n                }\n            }\n            invalidate() {\n                this.mDirty.set(0, 0, this.mWidth, this.mHeight);\n                this.scheduleTraversals();\n            }\n            invalidateWorld(view) {\n                view.invalidate();\n                if (view instanceof view_2.ViewGroup) {\n                    let parent = view;\n                    for (let i = 0; i < parent.getChildCount(); i++) {\n                        this.invalidateWorld(parent.getChildAt(i));\n                    }\n                }\n            }\n            invalidateChild(child, dirty) {\n                this.invalidateChildInParent(null, dirty);\n            }\n            invalidateChildInParent(location, dirty) {\n                if (ViewRootImpl.DEBUG_DRAW)\n                    Log.v(ViewRootImpl.TAG, \"Invalidate child: \" + dirty);\n                if (dirty == null) {\n                    this.invalidate();\n                    return null;\n                }\n                else if (dirty.isEmpty() && !this.mIsAnimating) {\n                    return null;\n                }\n                const localDirty = this.mDirty;\n                if (!localDirty.isEmpty() && !localDirty.contains(dirty)) {\n                    this.mSetIgnoreDirtyState = true;\n                    this.mIgnoreDirtyState = true;\n                }\n                localDirty.union(dirty.left, dirty.top, dirty.right, dirty.bottom);\n                const intersected = localDirty.intersect(0, 0, this.mWidth, this.mHeight);\n                if (!intersected) {\n                    localDirty.setEmpty();\n                }\n                if (!this.mWillDrawSoon && (intersected || this.mIsAnimating)) {\n                    this.scheduleTraversals();\n                }\n                return null;\n            }\n            requestChildFocus(child, focused) {\n                if (ViewRootImpl.DEBUG_INPUT_RESIZE) {\n                    Log.v(ViewRootImpl.TAG, \"Request child focus: focus now \" + focused);\n                }\n                this.scheduleTraversals();\n            }\n            clearChildFocus(focused) {\n                if (ViewRootImpl.DEBUG_INPUT_RESIZE) {\n                    Log.v(ViewRootImpl.TAG, \"Request child focus: focus now \" + focused);\n                }\n                this.scheduleTraversals();\n            }\n            getChildVisibleRect(child, r, offset) {\n                if (child != this.mView) {\n                    throw new Error(\"child is not mine, honest!\");\n                }\n                return r.intersect(0, 0, this.mWidth, this.mHeight);\n            }\n            focusSearch(focused, direction) {\n                if (!(this.mView instanceof view_2.ViewGroup)) {\n                    return null;\n                }\n                if (this.mView instanceof view_2.WindowManager.Layout) {\n                    let topWindow = this.mView.getTopFocusableWindowView();\n                    if (topWindow)\n                        return view_2.FocusFinder.getInstance().findNextFocus(topWindow, focused, direction);\n                }\n                return view_2.FocusFinder.getInstance().findNextFocus(this.mView, focused, direction);\n            }\n            bringChildToFront(child) {\n            }\n            focusableViewAvailable(v) {\n                if (this.mView != null) {\n                    if (!this.mView.hasFocus()) {\n                        v.requestFocus();\n                    }\n                    else {\n                        let focused = this.mView.findFocus();\n                        if (focused instanceof view_2.ViewGroup) {\n                            let group = focused;\n                            if (group.getDescendantFocusability() == view_2.ViewGroup.FOCUS_AFTER_DESCENDANTS\n                                && ViewRootImpl.isViewDescendantOf(v, focused)) {\n                                v.requestFocus();\n                            }\n                        }\n                    }\n                }\n            }\n            static isViewDescendantOf(child, parent) {\n                if (child == parent) {\n                    return true;\n                }\n                const theParent = child.getParent();\n                return (theParent instanceof view_2.ViewGroup) && ViewRootImpl.isViewDescendantOf(theParent, parent);\n            }\n            childDrawableStateChanged(child) {\n            }\n            requestDisallowInterceptTouchEvent(disallowIntercept) {\n            }\n            requestChildRectangleOnScreen(child, rectangle, immediate) {\n                return false;\n            }\n            childHasTransientStateChanged(child, hasTransientState) {\n            }\n            dispatchInputEvent(event) {\n                this.deliverInputEvent(event);\n                let result = event[InputStage.FLAG_FINISHED_HANDLED];\n                event[InputStage.FLAG_FINISHED] = false;\n                event[InputStage.FLAG_FINISHED_HANDLED] = false;\n                let continueToDom = event[ViewRootImpl.ContinueEventToDom];\n                event[ViewRootImpl.ContinueEventToDom] = null;\n                return result && !continueToDom;\n            }\n            deliverInputEvent(event) {\n                this.mFirstInputStage.deliver(event);\n            }\n            finishInputEvent(event) {\n            }\n            checkForLeavingTouchModeAndConsume(event) {\n                if (!this.mInTouchMode) {\n                    return false;\n                }\n                const action = event.getAction();\n                if (action != view_2.KeyEvent.ACTION_DOWN) {\n                    return false;\n                }\n                if (ViewRootImpl.isNavigationKey(event)) {\n                    return this.ensureTouchMode(false);\n                }\n                if (ViewRootImpl.isTypingKey(event)) {\n                    this.ensureTouchMode(false);\n                    return false;\n                }\n                return false;\n            }\n            static isNavigationKey(keyEvent) {\n                switch (keyEvent.getKeyCode()) {\n                    case view_2.KeyEvent.KEYCODE_DPAD_LEFT:\n                    case view_2.KeyEvent.KEYCODE_DPAD_RIGHT:\n                    case view_2.KeyEvent.KEYCODE_DPAD_UP:\n                    case view_2.KeyEvent.KEYCODE_DPAD_DOWN:\n                    case view_2.KeyEvent.KEYCODE_DPAD_CENTER:\n                    case view_2.KeyEvent.KEYCODE_PAGE_UP:\n                    case view_2.KeyEvent.KEYCODE_PAGE_DOWN:\n                    case view_2.KeyEvent.KEYCODE_MOVE_HOME:\n                    case view_2.KeyEvent.KEYCODE_MOVE_END:\n                    case view_2.KeyEvent.KEYCODE_TAB:\n                    case view_2.KeyEvent.KEYCODE_SPACE:\n                    case view_2.KeyEvent.KEYCODE_ENTER:\n                        return true;\n                }\n                return false;\n            }\n            static isTypingKey(keyEvent) {\n                try {\n                    return keyEvent.mIsTypingKey;\n                }\n                catch (e) {\n                    console.warn(e);\n                }\n                return true;\n            }\n            ensureTouchMode(inTouchMode) {\n                if (ViewRootImpl.DBG)\n                    Log.d(\"touchmode\", \"ensureTouchMode(\" + inTouchMode + \"), current \"\n                        + \"touch mode is \" + this.mInTouchMode);\n                if (this.mInTouchMode == inTouchMode)\n                    return false;\n                return this.ensureTouchModeLocally(inTouchMode);\n            }\n            ensureTouchModeLocally(inTouchMode) {\n                if (ViewRootImpl.DBG)\n                    Log.d(\"touchmode\", \"ensureTouchModeLocally(\" + inTouchMode + \"), current \"\n                        + \"touch mode is \" + this.mInTouchMode);\n                if (this.mInTouchMode == inTouchMode)\n                    return false;\n                this.mInTouchMode = inTouchMode;\n                this.mTreeObserver.dispatchOnTouchModeChanged(inTouchMode);\n                return (inTouchMode) ? this.enterTouchMode() : this.leaveTouchMode();\n            }\n            enterTouchMode() {\n                if (this.mView != null && this.mView.hasFocus()) {\n                    const focused = this.mView.findFocus();\n                    if (focused != null && !focused.isFocusableInTouchMode()) {\n                        const ancestorToTakeFocus = ViewRootImpl.findAncestorToTakeFocusInTouchMode(focused);\n                        if (ancestorToTakeFocus != null) {\n                            return ancestorToTakeFocus.requestFocus();\n                        }\n                        else {\n                            focused.clearFocusInternal(true, false);\n                            return true;\n                        }\n                    }\n                }\n                return false;\n            }\n            static findAncestorToTakeFocusInTouchMode(focused) {\n                let parent = focused.getParent();\n                while (parent instanceof view_2.ViewGroup) {\n                    const vgParent = parent;\n                    if (vgParent.getDescendantFocusability() == view_2.ViewGroup.FOCUS_AFTER_DESCENDANTS\n                        && vgParent.isFocusableInTouchMode()) {\n                        return vgParent;\n                    }\n                    if (vgParent.isRootNamespace()) {\n                        return null;\n                    }\n                    else {\n                        parent = vgParent.getParent();\n                    }\n                }\n                return null;\n            }\n            leaveTouchMode() {\n                if (this.mView != null) {\n                    if (this.mView.hasFocus()) {\n                        let focusedView = this.mView.findFocus();\n                        if (!(focusedView instanceof view_2.ViewGroup)) {\n                            return false;\n                        }\n                        else if (focusedView.getDescendantFocusability() !=\n                            view_2.ViewGroup.FOCUS_AFTER_DESCENDANTS) {\n                            return false;\n                        }\n                    }\n                    const focused = this.focusSearch(null, View.FOCUS_DOWN);\n                    if (focused != null) {\n                        return focused.requestFocus(View.FOCUS_DOWN);\n                    }\n                }\n                return false;\n            }\n            static getRunQueue(viewRoot) {\n                if (viewRoot) {\n                    if (!viewRoot.mRunQueue)\n                        viewRoot.mRunQueue = new ViewRootImpl.RunQueue();\n                    return viewRoot.mRunQueue;\n                }\n                else {\n                    if (!this.RunQueueInstance) {\n                        this.RunQueueInstance = new RunQueueForNoViewRoot();\n                    }\n                    return this.RunQueueInstance;\n                }\n            }\n        }\n        ViewRootImpl.TAG = \"ViewRootImpl\";\n        ViewRootImpl.DBG = Log.View_DBG;\n        ViewRootImpl.LOCAL_LOGV = ViewRootImpl.DBG;\n        ViewRootImpl.DEBUG_DRAW = false || ViewRootImpl.LOCAL_LOGV;\n        ViewRootImpl.DEBUG_LAYOUT = false || ViewRootImpl.LOCAL_LOGV;\n        ViewRootImpl.DEBUG_INPUT_RESIZE = false || ViewRootImpl.LOCAL_LOGV;\n        ViewRootImpl.DEBUG_ORIENTATION = false || ViewRootImpl.LOCAL_LOGV;\n        ViewRootImpl.DEBUG_CONFIGURATION = false || ViewRootImpl.LOCAL_LOGV;\n        ViewRootImpl.DEBUG_FPS = false || ViewRootImpl.LOCAL_LOGV;\n        ViewRootImpl.ContinueEventToDom = Symbol();\n        view_2.ViewRootImpl = ViewRootImpl;\n        (function (ViewRootImpl) {\n            class RunQueue {\n                constructor() {\n                    this.mActions = [];\n                }\n                post(action) {\n                    this.postDelayed(action, 0);\n                }\n                postDelayed(action, delayMillis) {\n                    let handlerAction = {\n                        action: action,\n                        delay: delayMillis\n                    };\n                    this.mActions.push(handlerAction);\n                }\n                removeCallbacks(action) {\n                    this.mActions = this.mActions.filter((item) => {\n                        return item.action == action;\n                    });\n                }\n                executeActions(handler) {\n                    for (let handlerAction of this.mActions) {\n                        handler.postDelayed(handlerAction.action, handlerAction.delay);\n                    }\n                    this.mActions = [];\n                }\n            }\n            ViewRootImpl.RunQueue = RunQueue;\n        })(ViewRootImpl = view_2.ViewRootImpl || (view_2.ViewRootImpl = {}));\n        class RunQueueForNoViewRoot extends ViewRootImpl.RunQueue {\n            postDelayed(action, delayMillis) {\n                RunQueueForNoViewRoot.Handler.postDelayed(action, delayMillis);\n            }\n            removeCallbacks(action) {\n                RunQueueForNoViewRoot.Handler.removeCallbacks(action);\n            }\n        }\n        RunQueueForNoViewRoot.Handler = new Handler();\n        class TraversalRunnable {\n            constructor(impl) {\n                this.ViewRootImpl_this = impl;\n            }\n            run() {\n                this.ViewRootImpl_this.doTraversal();\n            }\n        }\n        class InvalidateOnAnimationRunnable {\n            constructor(handler) {\n                this.mPosted = false;\n                this.mViews = new Set();\n                this.mViewRects = new Map();\n                this.mHandler = handler;\n            }\n            addView(view) {\n                this.mViews.add(view);\n                this.postIfNeededLocked();\n            }\n            addViewRect(info) {\n                this.mViewRects.set(info.target, info);\n                this.postIfNeededLocked();\n            }\n            removeView(view) {\n                this.mViews.delete(view);\n                this.mViewRects.delete(view);\n                if (this.mPosted && this.mViews.size === 0 && this.mViewRects.size === 0) {\n                    this.mHandler.removeCallbacks(this);\n                    this.mPosted = false;\n                }\n            }\n            run() {\n                this.mPosted = false;\n                for (let view of this.mViews) {\n                    view.invalidate();\n                }\n                this.mViews.clear();\n                for (let info of this.mViewRects.values()) {\n                    info.target.invalidate(info.left, info.top, info.right, info.bottom);\n                    info.recycle();\n                }\n                this.mViewRects.clear();\n            }\n            postIfNeededLocked() {\n                if (!this.mPosted) {\n                    this.mHandler.post(this);\n                    this.mPosted = true;\n                }\n            }\n        }\n        class ViewRootHandler extends Handler {\n            handleMessage(msg) {\n                switch (msg.what) {\n                    case ViewRootHandler.MSG_INVALIDATE:\n                        msg.obj.invalidate();\n                        break;\n                    case ViewRootHandler.MSG_INVALIDATE_RECT:\n                        const info = msg.obj;\n                        info.target.invalidate(info.left, info.top, info.right, info.bottom);\n                        info.recycle();\n                        break;\n                }\n            }\n        }\n        ViewRootHandler.MSG_INVALIDATE = 1;\n        ViewRootHandler.MSG_INVALIDATE_RECT = 2;\n        class InputStage {\n            constructor(impl, next) {\n                this.ViewRootImpl_this = impl;\n                this.mNext = next;\n            }\n            deliver(event) {\n                if (event[InputStage.FLAG_FINISHED]) {\n                    this.forward(event);\n                }\n                else if (this.shouldDropInputEvent(event)) {\n                    this.finish(event, false);\n                }\n                else {\n                    this.apply(event, this.onProcess(event));\n                }\n            }\n            finish(event, handled) {\n                event[InputStage.FLAG_FINISHED] = true;\n                if (handled) {\n                    event[InputStage.FLAG_FINISHED_HANDLED] = true;\n                }\n                this.forward(event);\n            }\n            forward(event) {\n                this.onDeliverToNext(event);\n            }\n            apply(event, result) {\n                if (result == InputStage.FORWARD) {\n                    this.forward(event);\n                }\n                else if (result == InputStage.FINISH_HANDLED) {\n                    this.finish(event, true);\n                }\n                else if (result == InputStage.FINISH_NOT_HANDLED) {\n                    this.finish(event, false);\n                }\n                else {\n                    throw new Error(\"Invalid result: \" + result);\n                }\n            }\n            onDeliverToNext(event) {\n                if (this.mNext != null) {\n                    this.mNext.deliver(event);\n                }\n                else {\n                    this.ViewRootImpl_this.finishInputEvent(event);\n                }\n            }\n            onProcess(event) {\n                return InputStage.FORWARD;\n            }\n            shouldDropInputEvent(event) {\n                if (this.ViewRootImpl_this.mView == null || !this.ViewRootImpl_this.mAdded) {\n                    Log.w(ViewRootImpl.TAG, \"Dropping event due to root view being removed: \" + event);\n                    return true;\n                }\n                return false;\n            }\n        }\n        InputStage.FLAG_FINISHED = Symbol();\n        InputStage.FLAG_FINISHED_HANDLED = Symbol();\n        InputStage.FORWARD = 0;\n        InputStage.FINISH_HANDLED = 1;\n        InputStage.FINISH_NOT_HANDLED = 2;\n        class EarlyPostImeInputStage extends InputStage {\n            onProcess(event) {\n                if (event instanceof view_2.MotionEvent) {\n                    return this.processMotionEvent(event);\n                }\n                else if (event instanceof view_2.KeyEvent) {\n                    return this.processKeyEvent(event);\n                }\n                return InputStage.FORWARD;\n            }\n            processKeyEvent(event) {\n                if (this.ViewRootImpl_this.checkForLeavingTouchModeAndConsume(event)) {\n                    return InputStage.FINISH_HANDLED;\n                }\n                return InputStage.FORWARD;\n            }\n            processMotionEvent(event) {\n                const action = event.getAction();\n                if (action == view_2.MotionEvent.ACTION_DOWN || action == view_2.MotionEvent.ACTION_SCROLL) {\n                    this.ViewRootImpl_this.ensureTouchMode(true);\n                }\n                event.offsetLocation(-this.ViewRootImpl_this.mWinFrame.left, -this.ViewRootImpl_this.mWinFrame.top);\n                return InputStage.FORWARD;\n            }\n        }\n        class ViewPostImeInputStage extends InputStage {\n            onProcess(event) {\n                if (event instanceof view_2.KeyEvent) {\n                    return this.processKeyEvent(event);\n                }\n                else if (event instanceof view_2.MotionEvent) {\n                    if (event.isTouchEvent()) {\n                        return this.processTouchEvent(event);\n                    }\n                    else {\n                        return this.processGenericMotionEvent(event);\n                    }\n                }\n                return InputStage.FORWARD;\n            }\n            processKeyEvent(event) {\n                let mView = this.ViewRootImpl_this.mView;\n                if (this.ViewRootImpl_this.mView.dispatchKeyEvent(event)) {\n                    return InputStage.FINISH_HANDLED;\n                }\n                if (this.shouldDropInputEvent(event)) {\n                    return InputStage.FINISH_NOT_HANDLED;\n                }\n                if (event.getAction() == view_2.KeyEvent.ACTION_DOWN\n                    && event.isCtrlPressed()\n                    && event.getRepeatCount() == 0) {\n                    if (this.shouldDropInputEvent(event)) {\n                        return InputStage.FINISH_NOT_HANDLED;\n                    }\n                }\n                if (this.shouldDropInputEvent(event)) {\n                    return InputStage.FINISH_NOT_HANDLED;\n                }\n                if (event.getAction() == view_2.KeyEvent.ACTION_DOWN) {\n                    let direction = 0;\n                    switch (event.getKeyCode()) {\n                        case view_2.KeyEvent.KEYCODE_DPAD_LEFT:\n                            direction = View.FOCUS_LEFT;\n                            break;\n                        case view_2.KeyEvent.KEYCODE_DPAD_RIGHT:\n                            direction = View.FOCUS_RIGHT;\n                            break;\n                        case view_2.KeyEvent.KEYCODE_DPAD_UP:\n                            direction = View.FOCUS_UP;\n                            break;\n                        case view_2.KeyEvent.KEYCODE_DPAD_DOWN:\n                            direction = View.FOCUS_DOWN;\n                            break;\n                        case view_2.KeyEvent.KEYCODE_TAB:\n                            if (event.isShiftPressed()) {\n                                direction = View.FOCUS_BACKWARD;\n                            }\n                            else {\n                                direction = View.FOCUS_FORWARD;\n                            }\n                            break;\n                    }\n                    if (direction != 0) {\n                        let focused = mView.findFocus();\n                        if (focused != null) {\n                            let v = focused.focusSearch(direction);\n                            if (v != null && v != focused) {\n                                focused.getFocusedRect(this.ViewRootImpl_this.mTempRect);\n                                if (mView instanceof view_2.ViewGroup) {\n                                    mView.offsetDescendantRectToMyCoords(focused, this.ViewRootImpl_this.mTempRect);\n                                    mView.offsetRectIntoDescendantCoords(v, this.ViewRootImpl_this.mTempRect);\n                                }\n                                if (v.requestFocus(direction, this.ViewRootImpl_this.mTempRect)) {\n                                    return InputStage.FINISH_HANDLED;\n                                }\n                            }\n                            if (mView.dispatchUnhandledMove(focused, direction)) {\n                                return InputStage.FINISH_HANDLED;\n                            }\n                        }\n                        else {\n                            let v = this.ViewRootImpl_this.focusSearch(null, direction);\n                            if (v != null && v.requestFocus(direction)) {\n                                return InputStage.FINISH_HANDLED;\n                            }\n                        }\n                    }\n                }\n                return InputStage.FORWARD;\n            }\n            processGenericMotionEvent(event) {\n                if (this.ViewRootImpl_this.mView.dispatchGenericMotionEvent(event)) {\n                    return InputStage.FINISH_HANDLED;\n                }\n                return InputStage.FORWARD;\n            }\n            processTouchEvent(event) {\n                let handled = this.ViewRootImpl_this.mView.dispatchTouchEvent(event);\n                return handled ? InputStage.FINISH_HANDLED : InputStage.FORWARD;\n            }\n        }\n        class SyntheticInputStage extends InputStage {\n            onProcess(event) {\n                return super.onProcess(event);\n            }\n        }\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view_3) {\n        var View = android.view.View;\n        var Rect = android.graphics.Rect;\n        var ArrayList = java.util.ArrayList;\n        class FocusFinder {\n            constructor() {\n                this.mFocusedRect = new Rect();\n                this.mOtherRect = new Rect();\n                this.mBestCandidateRect = new Rect();\n                this.mSequentialFocusComparator = new SequentialFocusComparator();\n                this.mTempList = new ArrayList();\n            }\n            static getInstance() {\n                if (!FocusFinder.sFocusFinder) {\n                    FocusFinder.sFocusFinder = new FocusFinder();\n                }\n                return FocusFinder.sFocusFinder;\n            }\n            findNextFocus(root, focused, direction) {\n                return this._findNextFocus(root, focused, null, direction);\n            }\n            findNextFocusFromRect(root, focusedRect, direction) {\n                this.mFocusedRect.set(focusedRect);\n                return this._findNextFocus(root, null, this.mFocusedRect, direction);\n            }\n            _findNextFocus(root, focused, focusedRect, direction) {\n                let next = null;\n                if (focused != null) {\n                    next = this.findNextUserSpecifiedFocus(root, focused, direction);\n                }\n                if (next != null) {\n                    return next;\n                }\n                let focusables = this.mTempList;\n                try {\n                    focusables.clear();\n                    root.addFocusables(focusables, direction);\n                    if (!focusables.isEmpty()) {\n                        next = this.__findNextFocus(root, focused, focusedRect, direction, focusables);\n                    }\n                }\n                finally {\n                    focusables.clear();\n                }\n                return next;\n            }\n            findNextUserSpecifiedFocus(root, focused, direction) {\n                let userSetNextFocus = focused.findUserSetNextFocus(root, direction);\n                if (userSetNextFocus != null && userSetNextFocus.isFocusable()\n                    && (!userSetNextFocus.isInTouchMode()\n                        || userSetNextFocus.isFocusableInTouchMode())) {\n                    return userSetNextFocus;\n                }\n                return null;\n            }\n            __findNextFocus(root, focused, focusedRect, direction, focusables) {\n                if (focused != null) {\n                    if (focusedRect == null) {\n                        focusedRect = this.mFocusedRect;\n                    }\n                    focused.getFocusedRect(focusedRect);\n                    root.offsetDescendantRectToMyCoords(focused, focusedRect);\n                }\n                else {\n                    if (focusedRect == null) {\n                        focusedRect = this.mFocusedRect;\n                        switch (direction) {\n                            case View.FOCUS_RIGHT:\n                            case View.FOCUS_DOWN:\n                                this.setFocusTopLeft(root, focusedRect);\n                                break;\n                            case View.FOCUS_FORWARD:\n                                this.setFocusTopLeft(root, focusedRect);\n                                break;\n                            case View.FOCUS_LEFT:\n                            case View.FOCUS_UP:\n                                this.setFocusBottomRight(root, focusedRect);\n                                break;\n                            case View.FOCUS_BACKWARD:\n                                this.setFocusBottomRight(root, focusedRect);\n                        }\n                    }\n                }\n                switch (direction) {\n                    case View.FOCUS_FORWARD:\n                    case View.FOCUS_BACKWARD:\n                        return this.findNextFocusInRelativeDirection(focusables, root, focused, focusedRect, direction);\n                    case View.FOCUS_UP:\n                    case View.FOCUS_DOWN:\n                    case View.FOCUS_LEFT:\n                    case View.FOCUS_RIGHT:\n                        return this.findNextFocusInAbsoluteDirection(focusables, root, focused, focusedRect, direction);\n                    default:\n                        throw new Error(\"Unknown direction: \" + direction);\n                }\n            }\n            findNextFocusInRelativeDirection(focusables, root, focused, focusedRect, direction) {\n                try {\n                    this.mSequentialFocusComparator.setRoot(root);\n                    this.mSequentialFocusComparator.sort(focusables);\n                }\n                finally {\n                    this.mSequentialFocusComparator.recycle();\n                }\n                const count = focusables.size();\n                switch (direction) {\n                    case View.FOCUS_FORWARD:\n                        return FocusFinder.getNextFocusable(focused, focusables, count);\n                    case View.FOCUS_BACKWARD:\n                        return FocusFinder.getPreviousFocusable(focused, focusables, count);\n                }\n                return focusables.get(count - 1);\n            }\n            setFocusBottomRight(root, focusedRect) {\n                const rootBottom = root.getScrollY() + root.getHeight();\n                const rootRight = root.getScrollX() + root.getWidth();\n                focusedRect.set(rootRight, rootBottom, rootRight, rootBottom);\n            }\n            setFocusTopLeft(root, focusedRect) {\n                const rootTop = root.getScrollY();\n                const rootLeft = root.getScrollX();\n                focusedRect.set(rootLeft, rootTop, rootLeft, rootTop);\n            }\n            findNextFocusInAbsoluteDirection(focusables, root, focused, focusedRect, direction) {\n                this.mBestCandidateRect.set(focusedRect);\n                switch (direction) {\n                    case View.FOCUS_LEFT:\n                        this.mBestCandidateRect.offset(focusedRect.width() + 1, 0);\n                        break;\n                    case View.FOCUS_RIGHT:\n                        this.mBestCandidateRect.offset(-(focusedRect.width() + 1), 0);\n                        break;\n                    case View.FOCUS_UP:\n                        this.mBestCandidateRect.offset(0, focusedRect.height() + 1);\n                        break;\n                    case View.FOCUS_DOWN:\n                        this.mBestCandidateRect.offset(0, -(focusedRect.height() + 1));\n                }\n                let closest = null;\n                let numFocusables = focusables.size();\n                for (let i = 0; i < numFocusables; i++) {\n                    let focusable = focusables.get(i);\n                    if (focusable == focused || focusable == root)\n                        continue;\n                    focusable.getFocusedRect(this.mOtherRect);\n                    root.offsetDescendantRectToMyCoords(focusable, this.mOtherRect);\n                    if (this.isBetterCandidate(direction, focusedRect, this.mOtherRect, this.mBestCandidateRect)) {\n                        this.mBestCandidateRect.set(this.mOtherRect);\n                        closest = focusable;\n                    }\n                }\n                return closest;\n            }\n            static getNextFocusable(focused, focusables, count) {\n                if (focused != null) {\n                    let position = focusables.lastIndexOf(focused);\n                    if (position >= 0 && position + 1 < count) {\n                        return focusables.get(position + 1);\n                    }\n                }\n                if (!focusables.isEmpty()) {\n                    return focusables.get(0);\n                }\n                return null;\n            }\n            static getPreviousFocusable(focused, focusables, count) {\n                if (focused != null) {\n                    let position = focusables.indexOf(focused);\n                    if (position > 0) {\n                        return focusables.get(position - 1);\n                    }\n                }\n                if (!focusables.isEmpty()) {\n                    return focusables.get(count - 1);\n                }\n                return null;\n            }\n            isBetterCandidate(direction, source, rect1, rect2) {\n                if (!this.isCandidate(source, rect1, direction)) {\n                    return false;\n                }\n                if (!this.isCandidate(source, rect2, direction)) {\n                    return true;\n                }\n                if (this.beamBeats(direction, source, rect1, rect2)) {\n                    return true;\n                }\n                if (this.beamBeats(direction, source, rect2, rect1)) {\n                    return false;\n                }\n                return (this.getWeightedDistanceFor(FocusFinder.majorAxisDistance(direction, source, rect1), FocusFinder.minorAxisDistance(direction, source, rect1))\n                    < this.getWeightedDistanceFor(FocusFinder.majorAxisDistance(direction, source, rect2), FocusFinder.minorAxisDistance(direction, source, rect2)));\n            }\n            beamBeats(direction, source, rect1, rect2) {\n                const rect1InSrcBeam = this.beamsOverlap(direction, source, rect1);\n                const rect2InSrcBeam = this.beamsOverlap(direction, source, rect2);\n                if (rect2InSrcBeam || !rect1InSrcBeam) {\n                    return false;\n                }\n                if (!this.isToDirectionOf(direction, source, rect2)) {\n                    return true;\n                }\n                if ((direction == View.FOCUS_LEFT || direction == View.FOCUS_RIGHT)) {\n                    return true;\n                }\n                return (FocusFinder.majorAxisDistance(direction, source, rect1)\n                    < FocusFinder.majorAxisDistanceToFarEdge(direction, source, rect2));\n            }\n            getWeightedDistanceFor(majorAxisDistance, minorAxisDistance) {\n                return 13 * majorAxisDistance * majorAxisDistance\n                    + minorAxisDistance * minorAxisDistance;\n            }\n            isCandidate(srcRect, destRect, direction) {\n                switch (direction) {\n                    case View.FOCUS_LEFT:\n                        return (srcRect.right > destRect.right || srcRect.left >= destRect.right)\n                            && srcRect.left > destRect.left;\n                    case View.FOCUS_RIGHT:\n                        return (srcRect.left < destRect.left || srcRect.right <= destRect.left)\n                            && srcRect.right < destRect.right;\n                    case View.FOCUS_UP:\n                        return (srcRect.bottom > destRect.bottom || srcRect.top >= destRect.bottom)\n                            && srcRect.top > destRect.top;\n                    case View.FOCUS_DOWN:\n                        return (srcRect.top < destRect.top || srcRect.bottom <= destRect.top)\n                            && srcRect.bottom < destRect.bottom;\n                }\n                throw new Error(\"direction must be one of \"\n                    + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");\n            }\n            beamsOverlap(direction, rect1, rect2) {\n                switch (direction) {\n                    case View.FOCUS_LEFT:\n                    case View.FOCUS_RIGHT:\n                        return (rect2.bottom >= rect1.top) && (rect2.top <= rect1.bottom);\n                    case View.FOCUS_UP:\n                    case View.FOCUS_DOWN:\n                        return (rect2.right >= rect1.left) && (rect2.left <= rect1.right);\n                }\n                throw new Error(\"direction must be one of \"\n                    + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");\n            }\n            isToDirectionOf(direction, src, dest) {\n                switch (direction) {\n                    case View.FOCUS_LEFT:\n                        return src.left >= dest.right;\n                    case View.FOCUS_RIGHT:\n                        return src.right <= dest.left;\n                    case View.FOCUS_UP:\n                        return src.top >= dest.bottom;\n                    case View.FOCUS_DOWN:\n                        return src.bottom <= dest.top;\n                }\n                throw new Error(\"direction must be one of \"\n                    + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");\n            }\n            static majorAxisDistance(direction, source, dest) {\n                return Math.max(0, FocusFinder.majorAxisDistanceRaw(direction, source, dest));\n            }\n            static majorAxisDistanceRaw(direction, source, dest) {\n                switch (direction) {\n                    case View.FOCUS_LEFT:\n                        return source.left - dest.right;\n                    case View.FOCUS_RIGHT:\n                        return dest.left - source.right;\n                    case View.FOCUS_UP:\n                        return source.top - dest.bottom;\n                    case View.FOCUS_DOWN:\n                        return dest.top - source.bottom;\n                }\n                throw new Error(\"direction must be one of \"\n                    + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");\n            }\n            static majorAxisDistanceToFarEdge(direction, source, dest) {\n                return Math.max(1, FocusFinder.majorAxisDistanceToFarEdgeRaw(direction, source, dest));\n            }\n            static majorAxisDistanceToFarEdgeRaw(direction, source, dest) {\n                switch (direction) {\n                    case View.FOCUS_LEFT:\n                        return source.left - dest.left;\n                    case View.FOCUS_RIGHT:\n                        return dest.right - source.right;\n                    case View.FOCUS_UP:\n                        return source.top - dest.top;\n                    case View.FOCUS_DOWN:\n                        return dest.bottom - source.bottom;\n                }\n                throw new Error(\"direction must be one of \"\n                    + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");\n            }\n            static minorAxisDistance(direction, source, dest) {\n                switch (direction) {\n                    case View.FOCUS_LEFT:\n                    case View.FOCUS_RIGHT:\n                        return Math.abs(((source.top + source.height() / 2) -\n                            ((dest.top + dest.height() / 2))));\n                    case View.FOCUS_UP:\n                    case View.FOCUS_DOWN:\n                        return Math.abs(((source.left + source.width() / 2) -\n                            ((dest.left + dest.width() / 2))));\n                }\n                throw new Error(\"direction must be one of \"\n                    + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");\n            }\n            findNearestTouchable(root, x, y, direction, deltas) {\n                let touchables = root.getTouchables();\n                let minDistance = Number.MAX_SAFE_INTEGER;\n                let closest = null;\n                let numTouchables = touchables.size();\n                let edgeSlop = view_3.ViewConfiguration.get().getScaledEdgeSlop();\n                let closestBounds = new Rect();\n                let touchableBounds = this.mOtherRect;\n                for (let i = 0; i < numTouchables; i++) {\n                    let touchable = touchables.get(i);\n                    touchable.getDrawingRect(touchableBounds);\n                    root.offsetRectBetweenParentAndChild(touchable, touchableBounds, true, true);\n                    if (!this.isTouchCandidate(x, y, touchableBounds, direction)) {\n                        continue;\n                    }\n                    let distance = Number.MAX_SAFE_INTEGER;\n                    switch (direction) {\n                        case View.FOCUS_LEFT:\n                            distance = x - touchableBounds.right + 1;\n                            break;\n                        case View.FOCUS_RIGHT:\n                            distance = touchableBounds.left;\n                            break;\n                        case View.FOCUS_UP:\n                            distance = y - touchableBounds.bottom + 1;\n                            break;\n                        case View.FOCUS_DOWN:\n                            distance = touchableBounds.top;\n                            break;\n                    }\n                    if (distance < edgeSlop) {\n                        if (closest == null ||\n                            closestBounds.contains(touchableBounds) ||\n                            (!touchableBounds.contains(closestBounds) && distance < minDistance)) {\n                            minDistance = distance;\n                            closest = touchable;\n                            closestBounds.set(touchableBounds);\n                            switch (direction) {\n                                case View.FOCUS_LEFT:\n                                    deltas[0] = -distance;\n                                    break;\n                                case View.FOCUS_RIGHT:\n                                    deltas[0] = distance;\n                                    break;\n                                case View.FOCUS_UP:\n                                    deltas[1] = -distance;\n                                    break;\n                                case View.FOCUS_DOWN:\n                                    deltas[1] = distance;\n                                    break;\n                            }\n                        }\n                    }\n                }\n                return closest;\n            }\n            isTouchCandidate(x, y, destRect, direction) {\n                switch (direction) {\n                    case View.FOCUS_LEFT:\n                        return destRect.left <= x && destRect.top <= y && y <= destRect.bottom;\n                    case View.FOCUS_RIGHT:\n                        return destRect.left >= x && destRect.top <= y && y <= destRect.bottom;\n                    case View.FOCUS_UP:\n                        return destRect.top <= y && destRect.left <= x && x <= destRect.right;\n                    case View.FOCUS_DOWN:\n                        return destRect.top >= y && destRect.left <= x && x <= destRect.right;\n                }\n                throw new Error(\"direction must be one of \"\n                    + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");\n            }\n        }\n        view_3.FocusFinder = FocusFinder;\n        class SequentialFocusComparator {\n            constructor() {\n                this.mFirstRect = new Rect();\n                this.mSecondRect = new Rect();\n                this.mIsLayoutRtl = false;\n                this.compareFn = (first, second) => {\n                    if (first == second) {\n                        return 0;\n                    }\n                    this.getRect(first, this.mFirstRect);\n                    this.getRect(second, this.mSecondRect);\n                    if (this.mFirstRect.top < this.mSecondRect.top) {\n                        return -1;\n                    }\n                    else if (this.mFirstRect.top > this.mSecondRect.top) {\n                        return 1;\n                    }\n                    else if (this.mFirstRect.left < this.mSecondRect.left) {\n                        return this.mIsLayoutRtl ? 1 : -1;\n                    }\n                    else if (this.mFirstRect.left > this.mSecondRect.left) {\n                        return this.mIsLayoutRtl ? -1 : 1;\n                    }\n                    else if (this.mFirstRect.bottom < this.mSecondRect.bottom) {\n                        return -1;\n                    }\n                    else if (this.mFirstRect.bottom > this.mSecondRect.bottom) {\n                        return 1;\n                    }\n                    else if (this.mFirstRect.right < this.mSecondRect.right) {\n                        return this.mIsLayoutRtl ? 1 : -1;\n                    }\n                    else if (this.mFirstRect.right > this.mSecondRect.right) {\n                        return this.mIsLayoutRtl ? -1 : 1;\n                    }\n                    else {\n                        return 0;\n                    }\n                };\n            }\n            recycle() {\n                this.mRoot = null;\n            }\n            setRoot(root) {\n                this.mRoot = root;\n            }\n            getRect(view, rect) {\n                view.getDrawingRect(rect);\n                this.mRoot.offsetDescendantRectToMyCoords(view, rect);\n            }\n            sort(array) {\n                array.sort(this.compareFn);\n            }\n        }\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar java;\n(function (java) {\n    var lang;\n    (function (lang) {\n        class Integer {\n            static parseInt(value) {\n                return Number.parseInt(value);\n            }\n            static toHexString(n) {\n                if (!n)\n                    return n + '';\n                return n.toString(16);\n            }\n        }\n        Integer.MIN_VALUE = -0x80000000;\n        Integer.MAX_VALUE = 0x7fffffff;\n        lang.Integer = Integer;\n    })(lang = java.lang || (java.lang = {}));\n})(java || (java = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view_4) {\n        var Rect = android.graphics.Rect;\n        var SystemClock = android.os.SystemClock;\n        var Context = android.content.Context;\n        var System = java.lang.System;\n        var ArrayList = java.util.ArrayList;\n        var Integer = java.lang.Integer;\n        var Transformation = android.view.animation.Transformation;\n        var AttrBinder = androidui.attr.AttrBinder;\n        class ViewGroup extends view_4.View {\n            constructor(context, bindElement, defStyle) {\n                super(context, bindElement, defStyle);\n                this.mLastTouchDownTime = 0;\n                this.mLastTouchDownIndex = -1;\n                this.mLastTouchDownX = 0;\n                this.mLastTouchDownY = 0;\n                this.mGroupFlags = 0;\n                this.mLayoutMode = ViewGroup.LAYOUT_MODE_UNDEFINED;\n                this.mChildren = [];\n                this.mSuppressLayout = false;\n                this.mLayoutCalledWhileSuppressed = false;\n                this.mChildCountWithTransientState = 0;\n                this.initViewGroup();\n                if (bindElement || defStyle) {\n                    this.initFromAttributes(context, bindElement, defStyle);\n                }\n            }\n            get mChildrenCount() {\n                return this.mChildren.length;\n            }\n            initViewGroup() {\n                this.setFlags(view_4.View.WILL_NOT_DRAW, view_4.View.DRAW_MASK);\n                this.mGroupFlags |= ViewGroup.FLAG_CLIP_CHILDREN;\n                this.mGroupFlags |= ViewGroup.FLAG_CLIP_TO_PADDING;\n                this.mGroupFlags |= ViewGroup.FLAG_ANIMATION_DONE;\n                this.mGroupFlags |= ViewGroup.FLAG_ANIMATION_CACHE;\n                this.mGroupFlags |= ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE;\n                this.mGroupFlags |= ViewGroup.FLAG_SPLIT_MOTION_EVENTS;\n                this.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);\n                this.mPersistentDrawingCache = ViewGroup.PERSISTENT_SCROLLING_CACHE;\n            }\n            initFromAttributes(context, attrs, defStyle) {\n                const a = context.obtainStyledAttributes(attrs, defStyle);\n                for (let attr of a.getLowerCaseNoNamespaceAttrNames()) {\n                    switch (attr) {\n                        case 'clipchildren':\n                            this.setClipChildren(a.getBoolean(attr, true));\n                            break;\n                        case 'cliptopadding':\n                            this.setClipToPadding(a.getBoolean(attr, true));\n                            break;\n                        case 'animationcache':\n                            this.setAnimationCacheEnabled(a.getBoolean(attr, true));\n                            break;\n                        case 'persistentdrawingcache': {\n                            let value = a.getAttrValue(attr);\n                            if (value === 'none')\n                                this.setPersistentDrawingCache(ViewGroup.PERSISTENT_NO_CACHE);\n                            else if (value === 'animation')\n                                this.setPersistentDrawingCache(ViewGroup.PERSISTENT_ANIMATION_CACHE);\n                            else if (value === 'scrolling')\n                                this.setPersistentDrawingCache(ViewGroup.PERSISTENT_SCROLLING_CACHE);\n                            else if (value === 'all')\n                                this.setPersistentDrawingCache(ViewGroup.PERSISTENT_ALL_CACHES);\n                            break;\n                        }\n                        case 'addstatesfromchildren':\n                            this.setAddStatesFromChildren(a.getBoolean(attr, false));\n                            break;\n                        case 'alwaysdrawnwithcache':\n                            this.setAlwaysDrawnWithCacheEnabled(a.getBoolean(attr, true));\n                            break;\n                        case 'layoutanimation':\n                            break;\n                        case 'descendantfocusability': {\n                            let value = a.getAttrValue(attr);\n                            if (value == 'beforeDescendants')\n                                this.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);\n                            else if (value == 'afterDescendants')\n                                this.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);\n                            else if (value == 'blocksDescendants')\n                                this.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);\n                            break;\n                        }\n                        case 'splitmotionevents':\n                            this.setMotionEventSplittingEnabled(a.getBoolean(attr, false));\n                            break;\n                        case 'animatelayoutchanges':\n                            break;\n                        case 'layoutmode':\n                            break;\n                    }\n                }\n                a.recycle();\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder()\n                    .set('clipChildren', {\n                    setter(v, value, attrBinder) {\n                        v.setClipChildren(attrBinder.parseBoolean(value));\n                    },\n                    getter(v) {\n                        return v.getClipChildren();\n                    }\n                }).set('clipToPadding', {\n                    setter(v, value, attrBinder) {\n                        v.setClipToPadding(attrBinder.parseBoolean(value));\n                    },\n                    getter(v) {\n                        return v.isClipToPadding();\n                    }\n                }).set('animationCache', {\n                    setter(v, value, attrBinder) {\n                        v.setAnimationCacheEnabled(attrBinder.parseBoolean(value, true));\n                    }\n                }).set('persistentDrawingCache', {\n                    setter(v, value, attrBinder) {\n                        if (value === 'none')\n                            v.setPersistentDrawingCache(ViewGroup.PERSISTENT_NO_CACHE);\n                        else if (value === 'animation')\n                            v.setPersistentDrawingCache(ViewGroup.PERSISTENT_ANIMATION_CACHE);\n                        else if (value === 'scrolling')\n                            v.setPersistentDrawingCache(ViewGroup.PERSISTENT_SCROLLING_CACHE);\n                        else if (value === 'all')\n                            v.setPersistentDrawingCache(ViewGroup.PERSISTENT_ALL_CACHES);\n                    }\n                }).set('addStatesFromChildren', {\n                    setter(v, value, attrBinder) {\n                        v.setAddStatesFromChildren(attrBinder.parseBoolean(value, false));\n                    }\n                }).set('alwaysDrawnWithCache', {\n                    setter(v, value, attrBinder) {\n                        v.setAlwaysDrawnWithCacheEnabled(attrBinder.parseBoolean(value, true));\n                    }\n                }).set('descendantFocusability', {\n                    setter(v, value, attrBinder) {\n                        if (value == 'beforeDescendants')\n                            this.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);\n                        else if (value == 'afterDescendants')\n                            this.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);\n                        else if (value == 'blocksDescendants')\n                            this.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);\n                    }\n                }).set('splitMotionEvents', {\n                    setter(v, value, attrBinder) {\n                        v.setMotionEventSplittingEnabled(attrBinder.parseBoolean(value, false));\n                    }\n                });\n            }\n            getDescendantFocusability() {\n                return this.mGroupFlags & ViewGroup.FLAG_MASK_FOCUSABILITY;\n            }\n            setDescendantFocusability(focusability) {\n                switch (focusability) {\n                    case ViewGroup.FOCUS_BEFORE_DESCENDANTS:\n                    case ViewGroup.FOCUS_AFTER_DESCENDANTS:\n                    case ViewGroup.FOCUS_BLOCK_DESCENDANTS:\n                        break;\n                    default:\n                        throw new Error(\"must be one of FOCUS_BEFORE_DESCENDANTS, \"\n                            + \"FOCUS_AFTER_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS\");\n                }\n                this.mGroupFlags &= ~ViewGroup.FLAG_MASK_FOCUSABILITY;\n                this.mGroupFlags |= (focusability & ViewGroup.FLAG_MASK_FOCUSABILITY);\n            }\n            handleFocusGainInternal(direction, previouslyFocusedRect) {\n                if (this.mFocused != null) {\n                    this.mFocused.unFocus();\n                    this.mFocused = null;\n                }\n                super.handleFocusGainInternal(direction, previouslyFocusedRect);\n            }\n            requestChildFocus(child, focused) {\n                if (view_4.View.DBG) {\n                    System.out.println(this + \" requestChildFocus()\");\n                }\n                if (this.getDescendantFocusability() == ViewGroup.FOCUS_BLOCK_DESCENDANTS) {\n                    return;\n                }\n                super.unFocus();\n                if (this.mFocused != child) {\n                    if (this.mFocused != null) {\n                        this.mFocused.unFocus();\n                    }\n                    this.mFocused = child;\n                }\n                if (this.mParent != null) {\n                    this.mParent.requestChildFocus(this, focused);\n                }\n            }\n            focusableViewAvailable(v) {\n                if (this.mParent != null\n                    && (this.getDescendantFocusability() != ViewGroup.FOCUS_BLOCK_DESCENDANTS)\n                    && !(this.isFocused() && this.getDescendantFocusability() != ViewGroup.FOCUS_AFTER_DESCENDANTS)) {\n                    this.mParent.focusableViewAvailable(v);\n                }\n            }\n            focusSearch(...args) {\n                if (arguments.length === 1) {\n                    return super.focusSearch(args[0]);\n                }\n                const focused = args[0];\n                const direction = args[1];\n                if (this.isRootNamespace()) {\n                    return view_4.FocusFinder.getInstance().findNextFocus(this, focused, direction);\n                }\n                else if (this.mParent != null) {\n                    return this.mParent.focusSearch(focused, direction);\n                }\n                return null;\n            }\n            requestChildRectangleOnScreen(child, rectangle, immediate) {\n                return false;\n            }\n            childHasTransientStateChanged(child, childHasTransientState) {\n                const oldHasTransientState = this.hasTransientState();\n                if (childHasTransientState) {\n                    this.mChildCountWithTransientState++;\n                }\n                else {\n                    this.mChildCountWithTransientState--;\n                }\n                const newHasTransientState = this.hasTransientState();\n                if (this.mParent != null && oldHasTransientState != newHasTransientState) {\n                    this.mParent.childHasTransientStateChanged(this, newHasTransientState);\n                }\n            }\n            hasTransientState() {\n                return this.mChildCountWithTransientState > 0 || super.hasTransientState();\n            }\n            dispatchUnhandledMove(focused, direction) {\n                return this.mFocused != null && this.mFocused.dispatchUnhandledMove(focused, direction);\n            }\n            clearChildFocus(child) {\n                if (view_4.View.DBG) {\n                    System.out.println(this + \" clearChildFocus()\");\n                }\n                this.mFocused = null;\n                if (this.mParent != null) {\n                    this.mParent.clearChildFocus(this);\n                }\n            }\n            clearFocus() {\n                if (view_4.View.DBG) {\n                    System.out.println(this + \" clearFocus()\");\n                }\n                if (this.mFocused == null) {\n                    super.clearFocus();\n                }\n                else {\n                    let focused = this.mFocused;\n                    this.mFocused = null;\n                    focused.clearFocus();\n                }\n            }\n            unFocus() {\n                if (view_4.View.DBG) {\n                    System.out.println(this + \" unFocus()\");\n                }\n                if (this.mFocused == null) {\n                    super.unFocus();\n                }\n                else {\n                    this.mFocused.unFocus();\n                    this.mFocused = null;\n                }\n            }\n            getFocusedChild() {\n                return this.mFocused;\n            }\n            hasFocus() {\n                return (this.mPrivateFlags & view_4.View.PFLAG_FOCUSED) != 0 || this.mFocused != null;\n            }\n            findFocus() {\n                if (ViewGroup.DBG) {\n                    System.out.println(\"Find focus in \" + this + \": flags=\" + this.isFocused() + \", child=\" + this.mFocused);\n                }\n                if (this.isFocused()) {\n                    return this;\n                }\n                if (this.mFocused != null) {\n                    return this.mFocused.findFocus();\n                }\n                return null;\n            }\n            hasFocusable() {\n                if ((this.mViewFlags & view_4.View.VISIBILITY_MASK) != view_4.View.VISIBLE) {\n                    return false;\n                }\n                if (this.isFocusable()) {\n                    return true;\n                }\n                const descendantFocusability = this.getDescendantFocusability();\n                if (descendantFocusability != ViewGroup.FOCUS_BLOCK_DESCENDANTS) {\n                    const count = this.mChildrenCount;\n                    const children = this.mChildren;\n                    for (let i = 0; i < count; i++) {\n                        const child = children[i];\n                        if (child.hasFocusable()) {\n                            return true;\n                        }\n                    }\n                }\n                return false;\n            }\n            addFocusables(views, direction, focusableMode = view_4.View.FOCUSABLES_TOUCH_MODE) {\n                const focusableCount = views.size();\n                const descendantFocusability = this.getDescendantFocusability();\n                if (descendantFocusability != ViewGroup.FOCUS_BLOCK_DESCENDANTS) {\n                    const count = this.mChildrenCount;\n                    const children = this.mChildren;\n                    for (let i = 0; i < count; i++) {\n                        const child = children[i];\n                        if ((child.mViewFlags & view_4.View.VISIBILITY_MASK) == view_4.View.VISIBLE) {\n                            child.addFocusables(views, direction, focusableMode);\n                        }\n                    }\n                }\n                if (descendantFocusability != ViewGroup.FOCUS_AFTER_DESCENDANTS\n                    || (focusableCount == views.size())) {\n                    super.addFocusables(views, direction, focusableMode);\n                }\n            }\n            requestFocus(direction = view_4.View.FOCUS_DOWN, previouslyFocusedRect = null) {\n                if (view_4.View.DBG) {\n                    System.out.println(this + \" ViewGroup.requestFocus direction=\"\n                        + direction);\n                }\n                let descendantFocusability = this.getDescendantFocusability();\n                switch (descendantFocusability) {\n                    case ViewGroup.FOCUS_BLOCK_DESCENDANTS:\n                        return super.requestFocus(direction, previouslyFocusedRect);\n                    case ViewGroup.FOCUS_BEFORE_DESCENDANTS: {\n                        const took = super.requestFocus(direction, previouslyFocusedRect);\n                        return took ? took : this.onRequestFocusInDescendants(direction, previouslyFocusedRect);\n                    }\n                    case ViewGroup.FOCUS_AFTER_DESCENDANTS: {\n                        const took = this.onRequestFocusInDescendants(direction, previouslyFocusedRect);\n                        return took ? took : super.requestFocus(direction, previouslyFocusedRect);\n                    }\n                    default:\n                        throw new Error(\"descendant focusability must be \"\n                            + \"one of FOCUS_BEFORE_DESCENDANTS, FOCUS_AFTER_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS \"\n                            + \"but is \" + descendantFocusability);\n                }\n            }\n            onRequestFocusInDescendants(direction, previouslyFocusedRect) {\n                let index;\n                let increment;\n                let end;\n                let count = this.mChildrenCount;\n                if ((direction & view_4.View.FOCUS_FORWARD) != 0) {\n                    index = 0;\n                    increment = 1;\n                    end = count;\n                }\n                else {\n                    index = count - 1;\n                    increment = -1;\n                    end = -1;\n                }\n                const children = this.mChildren;\n                for (let i = index; i != end; i += increment) {\n                    let child = children[i];\n                    if ((child.mViewFlags & view_4.View.VISIBILITY_MASK) == view_4.View.VISIBLE) {\n                        if (child.requestFocus(direction, previouslyFocusedRect)) {\n                            return true;\n                        }\n                    }\n                }\n                return false;\n            }\n            addView(...args) {\n                let child = args[0];\n                let params = child.getLayoutParams();\n                let index = -1;\n                if (args.length == 2) {\n                    if (args[1] instanceof ViewGroup.LayoutParams)\n                        params = args[1];\n                    else if (typeof args[1] === 'number')\n                        index = args[1];\n                }\n                else if (args.length == 3) {\n                    if (args[2] instanceof ViewGroup.LayoutParams) {\n                        index = args[1];\n                        params = args[2];\n                    }\n                    else {\n                        params = this.generateDefaultLayoutParams();\n                        params.width = args[1];\n                        params.height = args[2];\n                    }\n                }\n                if (params == null) {\n                    params = this.generateDefaultLayoutParams();\n                    if (params == null) {\n                        throw new Error(\"generateDefaultLayoutParams() cannot return null\");\n                    }\n                }\n                this.requestLayout();\n                this.invalidate(true);\n                this.addViewInner(child, index, params, false);\n            }\n            checkLayoutParams(p) {\n                return p != null;\n            }\n            setOnHierarchyChangeListener(listener) {\n                this.mOnHierarchyChangeListener = listener;\n            }\n            onViewAdded(child) {\n                if (this.mOnHierarchyChangeListener != null) {\n                    this.mOnHierarchyChangeListener.onChildViewAdded(this, child);\n                }\n            }\n            onViewRemoved(child) {\n                if (this.mOnHierarchyChangeListener != null) {\n                    this.mOnHierarchyChangeListener.onChildViewRemoved(this, child);\n                }\n            }\n            clearCachedLayoutMode() {\n                if (!this.hasBooleanFlag(ViewGroup.FLAG_LAYOUT_MODE_WAS_EXPLICITLY_SET)) {\n                    this.mLayoutMode = ViewGroup.LAYOUT_MODE_UNDEFINED;\n                }\n            }\n            addViewInLayout(child, index, params, preventRequestLayout = false) {\n                child.mParent = null;\n                this.addViewInner(child, index, params, preventRequestLayout);\n                child.mPrivateFlags = (child.mPrivateFlags & ~ViewGroup.PFLAG_DIRTY_MASK) | ViewGroup.PFLAG_DRAWN;\n                return true;\n            }\n            cleanupLayoutState(child) {\n                child.mPrivateFlags &= ~view_4.View.PFLAG_FORCE_LAYOUT;\n            }\n            addViewInner(child, index, params, preventRequestLayout) {\n                if (child.getParent() != null) {\n                    throw new Error(\"The specified child already has a parent. \" +\n                        \"You must call removeView() on the child's parent first.\");\n                }\n                if (!this.checkLayoutParams(params)) {\n                    params = this.generateLayoutParams(params);\n                }\n                if (preventRequestLayout) {\n                    child.mLayoutParams = params;\n                }\n                else {\n                    child.setLayoutParams(params);\n                }\n                if (index < 0) {\n                    index = this.mChildrenCount;\n                }\n                if (this.mDisappearingChildren)\n                    this.mDisappearingChildren.remove(child);\n                this.addInArray(child, index);\n                if (preventRequestLayout) {\n                    child.assignParent(this);\n                }\n                else {\n                    child.mParent = this;\n                }\n                if (child.hasFocus()) {\n                    this.requestChildFocus(child, child.findFocus());\n                }\n                let ai = this.mAttachInfo;\n                if (ai != null && (this.mGroupFlags & ViewGroup.FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW) == 0) {\n                    child.dispatchAttachedToWindow(this.mAttachInfo, (this.mViewFlags & ViewGroup.VISIBILITY_MASK));\n                }\n                this.onViewAdded(child);\n                if ((child.mViewFlags & ViewGroup.DUPLICATE_PARENT_STATE) == ViewGroup.DUPLICATE_PARENT_STATE) {\n                    this.mGroupFlags |= ViewGroup.FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE;\n                }\n            }\n            addInArray(child, index) {\n                let count = this.mChildrenCount;\n                if (index == count) {\n                    this.mChildren.push(child);\n                    this.addToBindElement(child.bindElement, null);\n                }\n                else if (index < count) {\n                    let refChild = this.getChildAt(index);\n                    this.mChildren.splice(index, 0, child);\n                    this.addToBindElement(child.bindElement, refChild.bindElement);\n                }\n                else {\n                    throw new Error(\"index=\" + index + \" count=\" + count);\n                }\n            }\n            addToBindElement(childElement, insertBeforeElement) {\n                if (childElement.parentElement) {\n                    if (childElement.parentElement == this.bindElement)\n                        return;\n                    childElement.parentElement.removeChild(childElement);\n                }\n                if (insertBeforeElement) {\n                    this.bindElement.insertBefore(childElement, insertBeforeElement);\n                }\n                else {\n                    this.bindElement.appendChild(childElement);\n                }\n            }\n            removeChildElement(childElement) {\n                try {\n                    this.bindElement.removeChild(childElement);\n                }\n                catch (e) {\n                }\n            }\n            removeFromArray(index, count = 1) {\n                let start = Math.max(0, index);\n                let end = Math.min(this.mChildrenCount, start + count);\n                if (start == end) {\n                    return;\n                }\n                for (let i = start; i < end; i++) {\n                    this.mChildren[i].mParent = null;\n                    this.removeChildElement(this.mChildren[i].bindElement);\n                }\n                this.mChildren.splice(index, end - start);\n            }\n            removeView(view) {\n                this.removeViewInternal(view);\n                this.requestLayout();\n                this.invalidate(true);\n            }\n            removeViewInLayout(view) {\n                this.removeViewInternal(view);\n            }\n            removeViewsInLayout(start, count) {\n                this.removeViewsInternal(start, count);\n            }\n            removeViewAt(index) {\n                this.removeViewsInternal(index, 1);\n                this.requestLayout();\n                this.invalidate(true);\n            }\n            removeViews(start, count) {\n                this.removeViewsInternal(start, count);\n                this.requestLayout();\n                this.invalidate(true);\n            }\n            removeViewInternal(view) {\n                let index = this.indexOfChild(view);\n                if (index >= 0) {\n                    this.removeViewsInternal(index, 1);\n                }\n            }\n            removeViewsInternal(start, count) {\n                let focused = this.mFocused;\n                let clearChildFocus = false;\n                const detach = this.mAttachInfo != null;\n                const children = this.mChildren;\n                const end = start + count;\n                for (let i = start; i < end; i++) {\n                    const view = children[i];\n                    if (view == focused) {\n                        view.unFocus();\n                        clearChildFocus = true;\n                    }\n                    this.cancelTouchTarget(view);\n                    if (view.getAnimation() != null) {\n                        this.addDisappearingView(view);\n                    }\n                    else if (detach) {\n                        view.dispatchDetachedFromWindow();\n                    }\n                    this.onViewRemoved(view);\n                }\n                this.removeFromArray(start, count);\n                if (clearChildFocus) {\n                    this.clearChildFocus(focused);\n                    if (!this.rootViewRequestFocus()) {\n                        this.notifyGlobalFocusCleared(focused);\n                    }\n                }\n            }\n            removeAllViews() {\n                this.removeAllViewsInLayout();\n                this.requestLayout();\n                this.invalidate(true);\n            }\n            removeAllViewsInLayout() {\n                const count = this.mChildrenCount;\n                if (count <= 0) {\n                    return;\n                }\n                this.removeViewsInternal(0, count);\n            }\n            detachViewFromParent(child) {\n                if (child instanceof view_4.View)\n                    child = this.indexOfChild(child);\n                this.removeFromArray(child);\n            }\n            removeDetachedView(child, animate) {\n                if (child == this.mFocused) {\n                    child.clearFocus();\n                }\n                this.cancelTouchTarget(child);\n                if ((animate && child.getAnimation() != null)) {\n                    this.addDisappearingView(child);\n                }\n                else if (child.mAttachInfo != null) {\n                    child.dispatchDetachedFromWindow();\n                }\n                if (child.hasTransientState()) {\n                    this.childHasTransientStateChanged(child, false);\n                }\n                this.onViewRemoved(child);\n            }\n            attachViewToParent(child, index, params) {\n                child.mLayoutParams = params;\n                if (index < 0) {\n                    index = this.mChildrenCount;\n                }\n                this.addInArray(child, index);\n                child.mParent = this;\n                child.mPrivateFlags = (child.mPrivateFlags & ~ViewGroup.PFLAG_DIRTY_MASK & ~ViewGroup.PFLAG_DRAWING_CACHE_VALID) | ViewGroup.PFLAG_DRAWN | ViewGroup.PFLAG_INVALIDATED;\n                this.mPrivateFlags |= ViewGroup.PFLAG_INVALIDATED;\n                if (child.hasFocus()) {\n                    this.requestChildFocus(child, child.findFocus());\n                }\n            }\n            detachViewsFromParent(start, count = 1) {\n                this.removeFromArray(start, count);\n            }\n            detachAllViewsFromParent() {\n                const count = this.mChildrenCount;\n                if (count <= 0) {\n                    return;\n                }\n                const children = this.mChildren;\n                this.mChildren = [];\n                for (let i = count - 1; i >= 0; i--) {\n                    children[i].mParent = null;\n                    this.removeChildElement(children[i].bindElement);\n                }\n            }\n            indexOfChild(child) {\n                return this.mChildren.indexOf(child);\n            }\n            getChildCount() {\n                return this.mChildrenCount;\n            }\n            getChildAt(index) {\n                if (index < 0 || index >= this.mChildrenCount) {\n                    return null;\n                }\n                return this.mChildren[index];\n            }\n            bringChildToFront(child) {\n                let index = this.indexOfChild(child);\n                if (index >= 0) {\n                    this.removeFromArray(index);\n                    this.addInArray(child, this.mChildrenCount);\n                    child.mParent = this;\n                    this.requestLayout();\n                    this.invalidate();\n                }\n            }\n            hasBooleanFlag(flag) {\n                return (this.mGroupFlags & flag) == flag;\n            }\n            setBooleanFlag(flag, value) {\n                if (value) {\n                    this.mGroupFlags |= flag;\n                }\n                else {\n                    this.mGroupFlags &= ~flag;\n                }\n            }\n            dispatchGenericPointerEvent(event) {\n                const childrenCount = this.mChildrenCount;\n                if (childrenCount != 0) {\n                    const children = this.mChildren;\n                    const x = event.getX();\n                    const y = event.getY();\n                    const customOrder = this.isChildrenDrawingOrderEnabled();\n                    for (let i = childrenCount - 1; i >= 0; i--) {\n                        const childIndex = customOrder ? this.getChildDrawingOrder(childrenCount, i) : i;\n                        const child = children[childIndex];\n                        if (!ViewGroup.canViewReceivePointerEvents(child)\n                            || !this.isTransformedTouchPointInView(x, y, child, null)) {\n                            continue;\n                        }\n                        if (this.dispatchTransformedGenericPointerEvent(event, child)) {\n                            return true;\n                        }\n                    }\n                }\n                return super.dispatchGenericPointerEvent(event);\n            }\n            dispatchTransformedGenericPointerEvent(event, child) {\n                const offsetX = this.mScrollX - child.mLeft;\n                const offsetY = this.mScrollY - child.mTop;\n                let handled;\n                if (!child.hasIdentityMatrix()) {\n                }\n                else {\n                    event.offsetLocation(offsetX, offsetY);\n                    handled = child.dispatchGenericMotionEvent(event);\n                    event.offsetLocation(-offsetX, -offsetY);\n                }\n                return handled;\n            }\n            dispatchKeyEvent(event) {\n                if ((this.mPrivateFlags & (view_4.View.PFLAG_FOCUSED | view_4.View.PFLAG_HAS_BOUNDS))\n                    == (view_4.View.PFLAG_FOCUSED | view_4.View.PFLAG_HAS_BOUNDS)) {\n                    if (super.dispatchKeyEvent(event)) {\n                        return true;\n                    }\n                }\n                else if (this.mFocused != null && (this.mFocused.mPrivateFlags & view_4.View.PFLAG_HAS_BOUNDS)\n                    == view_4.View.PFLAG_HAS_BOUNDS) {\n                    if (this.mFocused.dispatchKeyEvent(event)) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n            dispatchWindowFocusChanged(hasFocus) {\n                super.dispatchWindowFocusChanged(hasFocus);\n                const count = this.mChildrenCount;\n                const children = this.mChildren;\n                for (let i = 0; i < count; i++) {\n                    children[i].dispatchWindowFocusChanged(hasFocus);\n                }\n            }\n            addTouchables(views) {\n                super.addTouchables(views);\n                const count = this.mChildrenCount;\n                const children = this.mChildren;\n                for (let i = 0; i < count; i++) {\n                    const child = children[i];\n                    if ((child.mViewFlags & view_4.View.VISIBILITY_MASK) == view_4.View.VISIBLE) {\n                        child.addTouchables(views);\n                    }\n                }\n            }\n            onInterceptTouchEvent(ev) {\n                return false;\n            }\n            dispatchTouchEvent(ev) {\n                let handled = false;\n                if (this.onFilterTouchEventForSecurity(ev)) {\n                    let action = ev.getAction();\n                    let actionMasked = action & view_4.MotionEvent.ACTION_MASK;\n                    if (actionMasked == view_4.MotionEvent.ACTION_DOWN) {\n                        this.cancelAndClearTouchTargets(ev);\n                        this.resetTouchState();\n                    }\n                    let intercepted;\n                    if (actionMasked == view_4.MotionEvent.ACTION_DOWN\n                        || this.mFirstTouchTarget != null) {\n                        let disallowIntercept = (this.mGroupFlags & ViewGroup.FLAG_DISALLOW_INTERCEPT) != 0;\n                        if (!disallowIntercept) {\n                            intercepted = this.onInterceptTouchEvent(ev);\n                            ev.setAction(action);\n                        }\n                        else {\n                            intercepted = false;\n                        }\n                    }\n                    else {\n                        intercepted = true;\n                    }\n                    let canceled = ViewGroup.resetCancelNextUpFlag(this)\n                        || actionMasked == view_4.MotionEvent.ACTION_CANCEL;\n                    let split = (this.mGroupFlags & ViewGroup.FLAG_SPLIT_MOTION_EVENTS) != 0;\n                    let newTouchTarget = null;\n                    let alreadyDispatchedToNewTouchTarget = false;\n                    if (!canceled && !intercepted) {\n                        if (actionMasked == view_4.MotionEvent.ACTION_DOWN\n                            || (split && actionMasked == view_4.MotionEvent.ACTION_POINTER_DOWN)\n                            || actionMasked == view_4.MotionEvent.ACTION_HOVER_MOVE) {\n                            let actionIndex = ev.getActionIndex();\n                            let idBitsToAssign = split ? 1 << ev.getPointerId(actionIndex)\n                                : TouchTarget.ALL_POINTER_IDS;\n                            this.removePointersFromTouchTargets(idBitsToAssign);\n                            let childrenCount = this.mChildrenCount;\n                            if (newTouchTarget == null && childrenCount != 0) {\n                                let x = ev.getX(actionIndex);\n                                let y = ev.getY(actionIndex);\n                                let children = this.mChildren;\n                                let customOrder = this.isChildrenDrawingOrderEnabled();\n                                for (let i = childrenCount - 1; i >= 0; i--) {\n                                    let childIndex = customOrder ? this.getChildDrawingOrder(childrenCount, i) : i;\n                                    let child = children[childIndex];\n                                    if (!ViewGroup.canViewReceivePointerEvents(child)\n                                        || !this.isTransformedTouchPointInView(x, y, child, null)) {\n                                        continue;\n                                    }\n                                    newTouchTarget = this.getTouchTarget(child);\n                                    if (newTouchTarget != null) {\n                                        newTouchTarget.pointerIdBits |= idBitsToAssign;\n                                        break;\n                                    }\n                                    ViewGroup.resetCancelNextUpFlag(child);\n                                    if (this.dispatchTransformedTouchEvent(ev, false, child, idBitsToAssign)) {\n                                        this.mLastTouchDownTime = ev.getDownTime();\n                                        this.mLastTouchDownIndex = childIndex;\n                                        this.mLastTouchDownX = ev.getX();\n                                        this.mLastTouchDownY = ev.getY();\n                                        newTouchTarget = this.addTouchTarget(child, idBitsToAssign);\n                                        alreadyDispatchedToNewTouchTarget = true;\n                                        break;\n                                    }\n                                }\n                            }\n                            if (newTouchTarget == null && this.mFirstTouchTarget != null) {\n                                newTouchTarget = this.mFirstTouchTarget;\n                                while (newTouchTarget.next != null) {\n                                    newTouchTarget = newTouchTarget.next;\n                                }\n                                newTouchTarget.pointerIdBits |= idBitsToAssign;\n                            }\n                        }\n                    }\n                    if (this.mFirstTouchTarget == null) {\n                        handled = this.dispatchTransformedTouchEvent(ev, canceled, null, TouchTarget.ALL_POINTER_IDS);\n                    }\n                    else {\n                        let predecessor = null;\n                        let target = this.mFirstTouchTarget;\n                        while (target != null) {\n                            const next = target.next;\n                            if (alreadyDispatchedToNewTouchTarget && target == newTouchTarget) {\n                                handled = true;\n                            }\n                            else {\n                                let cancelChild = ViewGroup.resetCancelNextUpFlag(target.child)\n                                    || intercepted;\n                                if (this.dispatchTransformedTouchEvent(ev, cancelChild, target.child, target.pointerIdBits)) {\n                                    handled = true;\n                                }\n                                if (cancelChild) {\n                                    if (predecessor == null) {\n                                        this.mFirstTouchTarget = next;\n                                    }\n                                    else {\n                                        predecessor.next = next;\n                                    }\n                                    target.recycle();\n                                    target = next;\n                                    continue;\n                                }\n                            }\n                            predecessor = target;\n                            target = next;\n                        }\n                    }\n                    if (canceled\n                        || actionMasked == view_4.MotionEvent.ACTION_UP\n                        || actionMasked == view_4.MotionEvent.ACTION_HOVER_MOVE) {\n                        this.resetTouchState();\n                    }\n                    else if (split && actionMasked == view_4.MotionEvent.ACTION_POINTER_UP) {\n                        let actionIndex = ev.getActionIndex();\n                        let idBitsToRemove = 1 << ev.getPointerId(actionIndex);\n                        this.removePointersFromTouchTargets(idBitsToRemove);\n                    }\n                }\n                return handled;\n            }\n            resetTouchState() {\n                this.clearTouchTargets();\n                ViewGroup.resetCancelNextUpFlag(this);\n                this.mGroupFlags &= ~ViewGroup.FLAG_DISALLOW_INTERCEPT;\n            }\n            static resetCancelNextUpFlag(view) {\n                if ((view.mPrivateFlags & view_4.View.PFLAG_CANCEL_NEXT_UP_EVENT) != 0) {\n                    view.mPrivateFlags &= ~view_4.View.PFLAG_CANCEL_NEXT_UP_EVENT;\n                    return true;\n                }\n                return false;\n            }\n            clearTouchTargets() {\n                let target = this.mFirstTouchTarget;\n                if (target != null) {\n                    do {\n                        let next = target.next;\n                        target.recycle();\n                        target = next;\n                    } while (target != null);\n                    this.mFirstTouchTarget = null;\n                }\n            }\n            cancelAndClearTouchTargets(event) {\n                if (this.mFirstTouchTarget != null) {\n                    let syntheticEvent = false;\n                    if (event == null) {\n                        let now = SystemClock.uptimeMillis();\n                        event = view_4.MotionEvent.obtainWithAction(now, now, view_4.MotionEvent.ACTION_CANCEL, 0, 0);\n                        syntheticEvent = true;\n                    }\n                    for (let target = this.mFirstTouchTarget; target != null; target = target.next) {\n                        ViewGroup.resetCancelNextUpFlag(target.child);\n                        this.dispatchTransformedTouchEvent(event, true, target.child, target.pointerIdBits);\n                    }\n                    this.clearTouchTargets();\n                    if (syntheticEvent) {\n                        event.recycle();\n                    }\n                }\n            }\n            getTouchTarget(child) {\n                for (let target = this.mFirstTouchTarget; target != null; target = target.next) {\n                    if (target.child == child) {\n                        return target;\n                    }\n                }\n                return null;\n            }\n            addTouchTarget(child, pointerIdBits) {\n                let target = TouchTarget.obtain(child, pointerIdBits);\n                target.next = this.mFirstTouchTarget;\n                this.mFirstTouchTarget = target;\n                return target;\n            }\n            removePointersFromTouchTargets(pointerIdBits) {\n                let predecessor = null;\n                let target = this.mFirstTouchTarget;\n                while (target != null) {\n                    let next = target.next;\n                    if ((target.pointerIdBits & pointerIdBits) != 0) {\n                        target.pointerIdBits &= ~pointerIdBits;\n                        if (target.pointerIdBits == 0) {\n                            if (predecessor == null) {\n                                this.mFirstTouchTarget = next;\n                            }\n                            else {\n                                predecessor.next = next;\n                            }\n                            target.recycle();\n                            target = next;\n                            continue;\n                        }\n                    }\n                    predecessor = target;\n                    target = next;\n                }\n            }\n            cancelTouchTarget(view) {\n                let predecessor = null;\n                let target = this.mFirstTouchTarget;\n                while (target != null) {\n                    let next = target.next;\n                    if (target.child == view) {\n                        if (predecessor == null) {\n                            this.mFirstTouchTarget = next;\n                        }\n                        else {\n                            predecessor.next = next;\n                        }\n                        target.recycle();\n                        let now = SystemClock.uptimeMillis();\n                        let event = view_4.MotionEvent.obtainWithAction(now, now, view_4.MotionEvent.ACTION_CANCEL, 0, 0);\n                        view.dispatchTouchEvent(event);\n                        event.recycle();\n                        return;\n                    }\n                    predecessor = target;\n                    target = next;\n                }\n            }\n            static canViewReceivePointerEvents(child) {\n                return (child.mViewFlags & view_4.View.VISIBILITY_MASK) == view_4.View.VISIBLE\n                    || child.getAnimation() != null;\n            }\n            isTransformedTouchPointInView(x, y, child, outLocalPoint) {\n                let localX = x + this.mScrollX - child.mLeft;\n                let localY = y + this.mScrollY - child.mTop;\n                let isInView = child.pointInView(localX, localY);\n                if (isInView && outLocalPoint != null) {\n                    outLocalPoint.set(localX, localY);\n                }\n                return isInView;\n            }\n            dispatchTransformedTouchEvent(event, cancel, child, desiredPointerIdBits) {\n                let handled;\n                const oldAction = event.getAction();\n                if (cancel || oldAction == view_4.MotionEvent.ACTION_CANCEL) {\n                    event.setAction(view_4.MotionEvent.ACTION_CANCEL);\n                    if (child == null) {\n                        handled = super.dispatchTouchEvent(event);\n                    }\n                    else {\n                        handled = child.dispatchTouchEvent(event);\n                    }\n                    event.setAction(oldAction);\n                    return handled;\n                }\n                const oldPointerIdBits = event.getPointerIdBits();\n                const newPointerIdBits = oldPointerIdBits & desiredPointerIdBits;\n                if (newPointerIdBits == 0) {\n                    return false;\n                }\n                let transformedEvent;\n                if (newPointerIdBits == oldPointerIdBits) {\n                    if (child == null || child.hasIdentityMatrix()) {\n                        if (child == null) {\n                            handled = super.dispatchTouchEvent(event);\n                        }\n                        else {\n                            let offsetX = this.mScrollX - child.mLeft;\n                            let offsetY = this.mScrollY - child.mTop;\n                            event.offsetLocation(offsetX, offsetY);\n                            handled = child.dispatchTouchEvent(event);\n                            event.offsetLocation(-offsetX, -offsetY);\n                        }\n                        return handled;\n                    }\n                    transformedEvent = view_4.MotionEvent.obtain(event);\n                }\n                else {\n                    transformedEvent = event.split(newPointerIdBits);\n                }\n                if (child == null) {\n                    handled = super.dispatchTouchEvent(transformedEvent);\n                }\n                else {\n                    let offsetX = this.mScrollX - child.mLeft;\n                    let offsetY = this.mScrollY - child.mTop;\n                    transformedEvent.offsetLocation(offsetX, offsetY);\n                    handled = child.dispatchTouchEvent(transformedEvent);\n                }\n                transformedEvent.recycle();\n                return handled;\n            }\n            setMotionEventSplittingEnabled(split) {\n                if (split) {\n                    this.mGroupFlags |= ViewGroup.FLAG_SPLIT_MOTION_EVENTS;\n                }\n                else {\n                    this.mGroupFlags &= ~ViewGroup.FLAG_SPLIT_MOTION_EVENTS;\n                }\n            }\n            isMotionEventSplittingEnabled() {\n                return (this.mGroupFlags & ViewGroup.FLAG_SPLIT_MOTION_EVENTS) == ViewGroup.FLAG_SPLIT_MOTION_EVENTS;\n            }\n            isAnimationCacheEnabled() {\n                return (this.mGroupFlags & ViewGroup.FLAG_ANIMATION_CACHE) == ViewGroup.FLAG_ANIMATION_CACHE;\n            }\n            setAnimationCacheEnabled(enabled) {\n                this.setBooleanFlag(ViewGroup.FLAG_ANIMATION_CACHE, enabled);\n            }\n            isAlwaysDrawnWithCacheEnabled() {\n                return (this.mGroupFlags & ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE) == ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE;\n            }\n            setAlwaysDrawnWithCacheEnabled(always) {\n                this.setBooleanFlag(ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE, always);\n            }\n            isChildrenDrawnWithCacheEnabled() {\n                return (this.mGroupFlags & ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE) == ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE;\n            }\n            setChildrenDrawnWithCacheEnabled(enabled) {\n                this.setBooleanFlag(ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE, enabled);\n            }\n            setChildrenDrawingCacheEnabled(enabled) {\n                if (enabled || (this.mPersistentDrawingCache & ViewGroup.PERSISTENT_ALL_CACHES) != ViewGroup.PERSISTENT_ALL_CACHES) {\n                    const children = this.mChildren;\n                    const count = this.mChildrenCount;\n                    for (let i = 0; i < count; i++) {\n                        children[i].setDrawingCacheEnabled(enabled);\n                    }\n                }\n            }\n            onAnimationStart() {\n                super.onAnimationStart();\n                if ((this.mGroupFlags & ViewGroup.FLAG_ANIMATION_CACHE) == ViewGroup.FLAG_ANIMATION_CACHE) {\n                    const count = this.mChildrenCount;\n                    const children = this.mChildren;\n                    const buildCache = !this.isHardwareAccelerated();\n                    for (let i = 0; i < count; i++) {\n                        const child = children[i];\n                        if ((child.mViewFlags & ViewGroup.VISIBILITY_MASK) == ViewGroup.VISIBLE) {\n                            child.setDrawingCacheEnabled(true);\n                            if (buildCache) {\n                                child.buildDrawingCache(true);\n                            }\n                        }\n                    }\n                    this.mGroupFlags |= ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE;\n                }\n            }\n            onAnimationEnd() {\n                super.onAnimationEnd();\n                if ((this.mGroupFlags & ViewGroup.FLAG_ANIMATION_CACHE) == ViewGroup.FLAG_ANIMATION_CACHE) {\n                    this.mGroupFlags &= ~ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE;\n                    if ((this.mPersistentDrawingCache & ViewGroup.PERSISTENT_ANIMATION_CACHE) == 0) {\n                        this.setChildrenDrawingCacheEnabled(false);\n                    }\n                }\n            }\n            getPersistentDrawingCache() {\n                return this.mPersistentDrawingCache;\n            }\n            setPersistentDrawingCache(drawingCacheToKeep) {\n                this.mPersistentDrawingCache = drawingCacheToKeep & ViewGroup.PERSISTENT_ALL_CACHES;\n            }\n            isChildrenDrawingOrderEnabled() {\n                return (this.mGroupFlags & ViewGroup.FLAG_USE_CHILD_DRAWING_ORDER) == ViewGroup.FLAG_USE_CHILD_DRAWING_ORDER;\n            }\n            setChildrenDrawingOrderEnabled(enabled) {\n                this.setBooleanFlag(ViewGroup.FLAG_USE_CHILD_DRAWING_ORDER, enabled);\n            }\n            getChildDrawingOrder(childCount, i) {\n                return i;\n            }\n            generateLayoutParamsFromAttr(attrs) {\n                return new ViewGroup.LayoutParams(this.getContext(), attrs);\n            }\n            generateLayoutParams(p) {\n                return p;\n            }\n            generateDefaultLayoutParams() {\n                return new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);\n            }\n            measureChildren(widthMeasureSpec, heightMeasureSpec) {\n                const size = this.mChildren.length;\n                for (let i = 0; i < size; ++i) {\n                    const child = this.mChildren[i];\n                    if ((child.mViewFlags & view_4.View.VISIBILITY_MASK) != view_4.View.GONE) {\n                        this.measureChild(child, widthMeasureSpec, heightMeasureSpec);\n                    }\n                }\n            }\n            measureChild(child, parentWidthMeasureSpec, parentHeightMeasureSpec) {\n                let lp = child.getLayoutParams();\n                const childWidthMeasureSpec = ViewGroup.getChildMeasureSpec(parentWidthMeasureSpec, this.mPaddingLeft + this.mPaddingRight, lp.width);\n                const childHeightMeasureSpec = ViewGroup.getChildMeasureSpec(parentHeightMeasureSpec, this.mPaddingTop + this.mPaddingBottom, lp.height);\n                child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n            }\n            measureChildWithMargins(child, parentWidthMeasureSpec, widthUsed, parentHeightMeasureSpec, heightUsed) {\n                let lp = child.getLayoutParams();\n                if (lp instanceof ViewGroup.MarginLayoutParams) {\n                    const childWidthMeasureSpec = ViewGroup.getChildMeasureSpec(parentWidthMeasureSpec, this.mPaddingLeft + this.mPaddingRight + lp.leftMargin + lp.rightMargin\n                        + widthUsed, lp.width);\n                    const childHeightMeasureSpec = ViewGroup.getChildMeasureSpec(parentHeightMeasureSpec, this.mPaddingTop + this.mPaddingBottom + lp.topMargin + lp.bottomMargin\n                        + heightUsed, lp.height);\n                    child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n                }\n            }\n            static getChildMeasureSpec(spec, padding, childDimension) {\n                let MeasureSpec = view_4.View.MeasureSpec;\n                let specMode = MeasureSpec.getMode(spec);\n                let specSize = MeasureSpec.getSize(spec);\n                let size = Math.max(0, specSize - padding);\n                let resultSize = 0;\n                let resultMode = 0;\n                switch (specMode) {\n                    case MeasureSpec.EXACTLY:\n                        if (childDimension >= 0) {\n                            resultSize = childDimension;\n                            resultMode = MeasureSpec.EXACTLY;\n                        }\n                        else if (childDimension == ViewGroup.LayoutParams.MATCH_PARENT) {\n                            resultSize = size;\n                            resultMode = MeasureSpec.EXACTLY;\n                        }\n                        else if (childDimension == ViewGroup.LayoutParams.WRAP_CONTENT) {\n                            resultSize = size;\n                            resultMode = MeasureSpec.AT_MOST;\n                        }\n                        break;\n                    case MeasureSpec.AT_MOST:\n                        if (childDimension >= 0) {\n                            resultSize = childDimension;\n                            resultMode = MeasureSpec.EXACTLY;\n                        }\n                        else if (childDimension == ViewGroup.LayoutParams.MATCH_PARENT) {\n                            resultSize = size;\n                            resultMode = MeasureSpec.AT_MOST;\n                        }\n                        else if (childDimension == ViewGroup.LayoutParams.WRAP_CONTENT) {\n                            resultSize = size;\n                            resultMode = MeasureSpec.AT_MOST;\n                        }\n                        break;\n                    case MeasureSpec.UNSPECIFIED:\n                        if (childDimension >= 0) {\n                            resultSize = childDimension;\n                            resultMode = MeasureSpec.EXACTLY;\n                        }\n                        else if (childDimension == ViewGroup.LayoutParams.MATCH_PARENT) {\n                            resultSize = 0;\n                            resultMode = MeasureSpec.UNSPECIFIED;\n                        }\n                        else if (childDimension == ViewGroup.LayoutParams.WRAP_CONTENT) {\n                            resultSize = 0;\n                            resultMode = MeasureSpec.UNSPECIFIED;\n                        }\n                        break;\n                }\n                return MeasureSpec.makeMeasureSpec(resultSize, resultMode);\n            }\n            clearDisappearingChildren() {\n                if (this.mDisappearingChildren != null) {\n                    this.mDisappearingChildren.clear();\n                    this.invalidate();\n                }\n            }\n            addDisappearingView(v) {\n                let disappearingChildren = this.mDisappearingChildren;\n                if (disappearingChildren == null) {\n                    disappearingChildren = this.mDisappearingChildren = new ArrayList();\n                }\n                disappearingChildren.add(v);\n            }\n            finishAnimatingView(view, animation) {\n                const disappearingChildren = this.mDisappearingChildren;\n                if (disappearingChildren != null) {\n                    if (disappearingChildren.contains(view)) {\n                        disappearingChildren.remove(view);\n                        if (view.mAttachInfo != null) {\n                            view.dispatchDetachedFromWindow();\n                        }\n                        view.clearAnimation();\n                        this.mGroupFlags |= ViewGroup.FLAG_INVALIDATE_REQUIRED;\n                    }\n                }\n                if (animation != null && !animation.getFillAfter()) {\n                    view.clearAnimation();\n                }\n                if ((view.mPrivateFlags & ViewGroup.PFLAG_ANIMATION_STARTED) == ViewGroup.PFLAG_ANIMATION_STARTED) {\n                    view.onAnimationEnd();\n                    view.mPrivateFlags &= ~ViewGroup.PFLAG_ANIMATION_STARTED;\n                    this.mGroupFlags |= ViewGroup.FLAG_INVALIDATE_REQUIRED;\n                }\n            }\n            dispatchAttachedToWindow(info, visibility) {\n                this.mGroupFlags |= ViewGroup.FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW;\n                super.dispatchAttachedToWindow(info, visibility);\n                this.mGroupFlags &= ~ViewGroup.FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW;\n                const count = this.mChildrenCount;\n                const children = this.mChildren;\n                for (let i = 0; i < count; i++) {\n                    const child = children[i];\n                    child.dispatchAttachedToWindow(info, visibility | (child.mViewFlags & view_4.View.VISIBILITY_MASK));\n                }\n            }\n            onAttachedToWindow() {\n                super.onAttachedToWindow();\n                this.clearCachedLayoutMode();\n            }\n            onDetachedFromWindow() {\n                super.onDetachedFromWindow();\n                this.clearCachedLayoutMode();\n            }\n            dispatchDetachedFromWindow() {\n                this.cancelAndClearTouchTargets(null);\n                this.mLayoutCalledWhileSuppressed = false;\n                this.mChildren.forEach((child) => child.dispatchDetachedFromWindow());\n                super.dispatchDetachedFromWindow();\n            }\n            dispatchDisplayHint(hint) {\n                super.dispatchDisplayHint(hint);\n                const count = this.mChildrenCount;\n                const children = this.mChildren;\n                for (let i = 0; i < count; i++) {\n                    children[i].dispatchDisplayHint(hint);\n                }\n            }\n            onChildVisibilityChanged(child, oldVisibility, newVisibility) {\n            }\n            dispatchVisibilityChanged(changedView, visibility) {\n                super.dispatchVisibilityChanged(changedView, visibility);\n                const count = this.mChildrenCount;\n                let children = this.mChildren;\n                for (let i = 0; i < count; i++) {\n                    children[i].dispatchVisibilityChanged(changedView, visibility);\n                }\n            }\n            dispatchSetSelected(selected) {\n                const children = this.mChildren;\n                const count = this.mChildrenCount;\n                for (let i = 0; i < count; i++) {\n                    children[i].setSelected(selected);\n                }\n            }\n            dispatchSetActivated(activated) {\n                const children = this.mChildren;\n                const count = this.mChildrenCount;\n                for (let i = 0; i < count; i++) {\n                    children[i].setActivated(activated);\n                }\n            }\n            dispatchSetPressed(pressed) {\n                const children = this.mChildren;\n                const count = this.mChildrenCount;\n                for (let i = 0; i < count; i++) {\n                    const child = children[i];\n                    if (!pressed || (!child.isClickable() && !child.isLongClickable())) {\n                        child.setPressed(pressed);\n                    }\n                }\n            }\n            dispatchCancelPendingInputEvents() {\n                super.dispatchCancelPendingInputEvents();\n                const children = this.mChildren;\n                const count = this.mChildrenCount;\n                for (let i = 0; i < count; i++) {\n                    children[i].dispatchCancelPendingInputEvents();\n                }\n            }\n            offsetDescendantRectToMyCoords(descendant, rect) {\n                this.offsetRectBetweenParentAndChild(descendant, rect, true, false);\n            }\n            offsetRectIntoDescendantCoords(descendant, rect) {\n                this.offsetRectBetweenParentAndChild(descendant, rect, false, false);\n            }\n            offsetRectBetweenParentAndChild(descendant, rect, offsetFromChildToParent, clipToBounds) {\n                if (descendant == this) {\n                    return;\n                }\n                let theParent = descendant.mParent;\n                while ((theParent != null)\n                    && (theParent instanceof view_4.View)\n                    && (theParent != this)) {\n                    if (offsetFromChildToParent) {\n                        rect.offset(descendant.mLeft - descendant.mScrollX, descendant.mTop - descendant.mScrollY);\n                        if (clipToBounds) {\n                            let p = theParent;\n                            rect.intersect(0, 0, p.mRight - p.mLeft, p.mBottom - p.mTop);\n                        }\n                    }\n                    else {\n                        if (clipToBounds) {\n                            let p = theParent;\n                            rect.intersect(0, 0, p.mRight - p.mLeft, p.mBottom - p.mTop);\n                        }\n                        rect.offset(descendant.mScrollX - descendant.mLeft, descendant.mScrollY - descendant.mTop);\n                    }\n                    descendant = theParent;\n                    theParent = descendant.mParent;\n                }\n                if (theParent == this) {\n                    if (offsetFromChildToParent) {\n                        rect.offset(descendant.mLeft - descendant.mScrollX, descendant.mTop - descendant.mScrollY);\n                    }\n                    else {\n                        rect.offset(descendant.mScrollX - descendant.mLeft, descendant.mScrollY - descendant.mTop);\n                    }\n                }\n                else {\n                    throw new Error(\"parameter must be a descendant of this view\");\n                }\n            }\n            offsetChildrenTopAndBottom(offset) {\n                const count = this.mChildrenCount;\n                const children = this.mChildren;\n                for (let i = 0; i < count; i++) {\n                    const v = children[i];\n                    v.mTop += offset;\n                    v.mBottom += offset;\n                }\n                this.invalidateViewProperty(false, false);\n            }\n            suppressLayout(suppress) {\n                this.mSuppressLayout = suppress;\n                if (!suppress) {\n                    if (this.mLayoutCalledWhileSuppressed) {\n                        this.requestLayout();\n                        this.mLayoutCalledWhileSuppressed = false;\n                    }\n                }\n            }\n            isLayoutSuppressed() {\n                return this.mSuppressLayout;\n            }\n            layout(l, t, r, b) {\n                if (!this.mSuppressLayout) {\n                    super.layout(l, t, r, b);\n                }\n                else {\n                    this.mLayoutCalledWhileSuppressed = true;\n                }\n            }\n            canAnimate() {\n                return false;\n            }\n            getChildVisibleRect(child, r, offset) {\n                const rect = this.mAttachInfo != null ? this.mAttachInfo.mTmpTransformRect : new Rect();\n                rect.set(r);\n                if (!child.hasIdentityMatrix()) {\n                    child.getMatrix().mapRect(rect);\n                }\n                let dx = child.mLeft - this.mScrollX;\n                let dy = child.mTop - this.mScrollY;\n                rect.offset(dx, dy);\n                if (offset != null) {\n                    if (!child.hasIdentityMatrix()) {\n                        let position = this.mAttachInfo != null ? this.mAttachInfo.mTmpTransformLocation : androidui.util.ArrayCreator.newNumberArray(2);\n                        position[0] = offset.x;\n                        position[1] = offset.y;\n                        child.getMatrix().mapPoints(position);\n                        offset.x = Math.floor(position[0] + 0.5);\n                        offset.y = Math.floor(position[1] + 0.5);\n                    }\n                    offset.x += dx;\n                    offset.y += dy;\n                }\n                if (rect.intersect(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop)) {\n                    if (this.mParent == null)\n                        return true;\n                    r.set(rect);\n                    return this.mParent.getChildVisibleRect(this, r, offset);\n                }\n                return false;\n            }\n            dispatchDraw(canvas) {\n                let count = this.mChildrenCount;\n                let children = this.mChildren;\n                let flags = this.mGroupFlags;\n                let saveCount = 0;\n                let clipToPadding = (flags & ViewGroup.CLIP_TO_PADDING_MASK) == ViewGroup.CLIP_TO_PADDING_MASK;\n                if (clipToPadding) {\n                    saveCount = canvas.save();\n                    canvas.clipRect(this.mScrollX + this.mPaddingLeft, this.mScrollY + this.mPaddingTop, this.mScrollX + this.mRight - this.mLeft - this.mPaddingRight, this.mScrollY + this.mBottom - this.mTop - this.mPaddingBottom);\n                }\n                this.mPrivateFlags &= ~ViewGroup.PFLAG_DRAW_ANIMATION;\n                this.mGroupFlags &= ~ViewGroup.FLAG_INVALIDATE_REQUIRED;\n                let more = false;\n                const drawingTime = this.getDrawingTime();\n                if ((flags & ViewGroup.FLAG_USE_CHILD_DRAWING_ORDER) == 0) {\n                    for (let i = 0; i < count; i++) {\n                        const child = children[i];\n                        if ((child.mViewFlags & ViewGroup.VISIBILITY_MASK) == ViewGroup.VISIBLE || child.getAnimation() != null) {\n                            more = this.drawChild(canvas, child, drawingTime) || more;\n                        }\n                    }\n                }\n                else {\n                    for (let i = 0; i < count; i++) {\n                        const child = children[this.getChildDrawingOrder(count, i)];\n                        if ((child.mViewFlags & ViewGroup.VISIBILITY_MASK) == ViewGroup.VISIBLE || child.getAnimation() != null) {\n                            more = this.drawChild(canvas, child, drawingTime) || more;\n                        }\n                    }\n                }\n                if (this.mDisappearingChildren != null) {\n                    const disappearingChildren = this.mDisappearingChildren;\n                    const disappearingCount = disappearingChildren.size() - 1;\n                    for (let i = disappearingCount; i >= 0; i--) {\n                        const child = disappearingChildren.get(i);\n                        more = this.drawChild(canvas, child, drawingTime) || more;\n                    }\n                }\n                if (clipToPadding) {\n                    canvas.restoreToCount(saveCount);\n                }\n                flags = this.mGroupFlags;\n                if ((flags & ViewGroup.FLAG_INVALIDATE_REQUIRED) == ViewGroup.FLAG_INVALIDATE_REQUIRED) {\n                    this.invalidate(true);\n                }\n            }\n            drawChild(canvas, child, drawingTime) {\n                return child.drawFromParent(canvas, this, drawingTime);\n            }\n            drawableStateChanged() {\n                super.drawableStateChanged();\n                if ((this.mGroupFlags & ViewGroup.FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE) != 0) {\n                    if ((this.mGroupFlags & ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN) != 0) {\n                        throw new Error(\"addStateFromChildren cannot be enabled if a\"\n                            + \" child has duplicateParentState set to true\");\n                    }\n                    const children = this.mChildren;\n                    const count = this.mChildrenCount;\n                    for (let i = 0; i < count; i++) {\n                        const child = children[i];\n                        if ((child.mViewFlags & view_4.View.DUPLICATE_PARENT_STATE) != 0) {\n                            child.refreshDrawableState();\n                        }\n                    }\n                }\n            }\n            jumpDrawablesToCurrentState() {\n                super.jumpDrawablesToCurrentState();\n                const children = this.mChildren;\n                const count = this.mChildrenCount;\n                for (let i = 0; i < count; i++) {\n                    children[i].jumpDrawablesToCurrentState();\n                }\n            }\n            onCreateDrawableState(extraSpace) {\n                if ((this.mGroupFlags & ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN) == 0) {\n                    return super.onCreateDrawableState(extraSpace);\n                }\n                let need = 0;\n                let n = this.getChildCount();\n                for (let i = 0; i < n; i++) {\n                    let childState = this.getChildAt(i).getDrawableState();\n                    if (childState != null) {\n                        need += childState.length;\n                    }\n                }\n                let state = super.onCreateDrawableState(extraSpace + need);\n                for (let i = 0; i < n; i++) {\n                    let childState = this.getChildAt(i).getDrawableState();\n                    if (childState != null) {\n                        state = view_4.View.mergeDrawableStates(state, childState);\n                    }\n                }\n                return state;\n            }\n            setAddStatesFromChildren(addsStates) {\n                if (addsStates) {\n                    this.mGroupFlags |= ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN;\n                }\n                else {\n                    this.mGroupFlags &= ~ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN;\n                }\n                this.refreshDrawableState();\n            }\n            addStatesFromChildren() {\n                return (this.mGroupFlags & ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN) != 0;\n            }\n            childDrawableStateChanged(child) {\n                if ((this.mGroupFlags & ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN) != 0) {\n                    this.refreshDrawableState();\n                }\n            }\n            getClipChildren() {\n                return ((this.mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) != 0);\n            }\n            setClipChildren(clipChildren) {\n                let previousValue = (this.mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) == ViewGroup.FLAG_CLIP_CHILDREN;\n                if (clipChildren != previousValue) {\n                    this.setBooleanFlag(ViewGroup.FLAG_CLIP_CHILDREN, clipChildren);\n                }\n            }\n            setClipToPadding(clipToPadding) {\n                this.setBooleanFlag(ViewGroup.FLAG_CLIP_TO_PADDING, clipToPadding);\n            }\n            isClipToPadding() {\n                return (this.mGroupFlags & ViewGroup.FLAG_CLIP_TO_PADDING) == ViewGroup.FLAG_CLIP_TO_PADDING;\n            }\n            invalidateChild(child, dirty) {\n                let parent = this;\n                const attachInfo = this.mAttachInfo;\n                if (attachInfo != null) {\n                    const drawAnimation = (child.mPrivateFlags & view_4.View.PFLAG_DRAW_ANIMATION)\n                        == view_4.View.PFLAG_DRAW_ANIMATION;\n                    let childMatrix = child.getMatrix();\n                    const isOpaque = child.isOpaque() && !drawAnimation && child.getAnimation() == null && childMatrix.isIdentity();\n                    let opaqueFlag = isOpaque ? view_4.View.PFLAG_DIRTY_OPAQUE : view_4.View.PFLAG_DIRTY;\n                    if (child.mLayerType != view_4.View.LAYER_TYPE_NONE) {\n                        this.mPrivateFlags |= view_4.View.PFLAG_INVALIDATED;\n                        this.mPrivateFlags &= ~view_4.View.PFLAG_DRAWING_CACHE_VALID;\n                        child.mLocalDirtyRect.union(dirty);\n                    }\n                    const location = attachInfo.mInvalidateChildLocation;\n                    location[0] = child.mLeft;\n                    location[1] = child.mTop;\n                    if (!childMatrix.isIdentity() ||\n                        (this.mGroupFlags & ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) {\n                        let boundingRect = attachInfo.mTmpTransformRect;\n                        boundingRect.set(dirty);\n                        let transformMatrix;\n                        if ((this.mGroupFlags & ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) {\n                            let t = attachInfo.mTmpTransformation;\n                            let transformed = this.getChildStaticTransformation(child, t);\n                            if (transformed) {\n                                transformMatrix = attachInfo.mTmpMatrix;\n                                transformMatrix.set(t.getMatrix());\n                                if (!childMatrix.isIdentity()) {\n                                    transformMatrix.preConcat(childMatrix);\n                                }\n                            }\n                            else {\n                                transformMatrix = childMatrix;\n                            }\n                        }\n                        else {\n                            transformMatrix = childMatrix;\n                        }\n                        transformMatrix.mapRect(boundingRect);\n                        dirty.set(boundingRect);\n                    }\n                    do {\n                        let view = null;\n                        if (parent instanceof view_4.View) {\n                            view = parent;\n                        }\n                        if (drawAnimation) {\n                            if (view != null) {\n                                view.mPrivateFlags |= ViewGroup.PFLAG_DRAW_ANIMATION;\n                            }\n                            else if (parent instanceof view_4.ViewRootImpl) {\n                                parent.mIsAnimating = true;\n                            }\n                        }\n                        if (view != null) {\n                            opaqueFlag = view_4.View.PFLAG_DIRTY;\n                            if ((view.mPrivateFlags & view_4.View.PFLAG_DIRTY_MASK) != view_4.View.PFLAG_DIRTY) {\n                                view.mPrivateFlags = (view.mPrivateFlags & ~view_4.View.PFLAG_DIRTY_MASK) | opaqueFlag;\n                            }\n                        }\n                        parent = parent.invalidateChildInParent(location, dirty);\n                        if (view != null) {\n                            let m = view.getMatrix();\n                            if (!m.isIdentity()) {\n                                let boundingRect = attachInfo.mTmpTransformRect;\n                                boundingRect.set(dirty);\n                                m.mapRect(boundingRect);\n                                dirty.set(boundingRect);\n                            }\n                        }\n                    } while (parent != null);\n                }\n            }\n            invalidateChildInParent(location, dirty) {\n                if ((this.mPrivateFlags & view_4.View.PFLAG_DRAWN) == view_4.View.PFLAG_DRAWN ||\n                    (this.mPrivateFlags & view_4.View.PFLAG_DRAWING_CACHE_VALID) == view_4.View.PFLAG_DRAWING_CACHE_VALID) {\n                    if ((this.mGroupFlags & (ViewGroup.FLAG_OPTIMIZE_INVALIDATE | ViewGroup.FLAG_ANIMATION_DONE)) !=\n                        ViewGroup.FLAG_OPTIMIZE_INVALIDATE) {\n                        dirty.offset(location[0] - this.mScrollX, location[1] - this.mScrollY);\n                        if ((this.mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) == 0) {\n                            dirty.union(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop);\n                        }\n                        const left = this.mLeft;\n                        const top = this.mTop;\n                        if ((this.mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) == ViewGroup.FLAG_CLIP_CHILDREN) {\n                            if (!dirty.intersect(0, 0, this.mRight - left, this.mBottom - top)) {\n                                dirty.setEmpty();\n                            }\n                        }\n                        this.mPrivateFlags &= ~view_4.View.PFLAG_DRAWING_CACHE_VALID;\n                        location[0] = left;\n                        location[1] = top;\n                        if (this.mLayerType != view_4.View.LAYER_TYPE_NONE) {\n                            this.mPrivateFlags |= view_4.View.PFLAG_INVALIDATED;\n                            this.mLocalDirtyRect.union(dirty);\n                        }\n                        return this.mParent;\n                    }\n                    else {\n                        this.mPrivateFlags &= ~view_4.View.PFLAG_DRAWN & ~view_4.View.PFLAG_DRAWING_CACHE_VALID;\n                        location[0] = this.mLeft;\n                        location[1] = this.mTop;\n                        if ((this.mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) == ViewGroup.FLAG_CLIP_CHILDREN) {\n                            dirty.set(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop);\n                        }\n                        else {\n                            dirty.union(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop);\n                        }\n                        if (this.mLayerType != view_4.View.LAYER_TYPE_NONE) {\n                            this.mPrivateFlags |= view_4.View.PFLAG_INVALIDATED;\n                            this.mLocalDirtyRect.union(dirty);\n                        }\n                        return this.mParent;\n                    }\n                }\n                return null;\n            }\n            invalidateChildFast(child, dirty) {\n                let parent = this;\n                const attachInfo = this.mAttachInfo;\n                if (attachInfo != null) {\n                    if (child.mLayerType != view_4.View.LAYER_TYPE_NONE) {\n                        child.mLocalDirtyRect.union(dirty);\n                    }\n                    let left = child.mLeft;\n                    let top = child.mTop;\n                    if (!child.getMatrix().isIdentity()) {\n                        child.transformRect(dirty);\n                    }\n                    do {\n                        if (parent instanceof ViewGroup) {\n                            let parentVG = parent;\n                            if (parentVG.mLayerType != view_4.View.LAYER_TYPE_NONE) {\n                                parentVG.invalidate();\n                                parent = null;\n                            }\n                            else {\n                                parent = parentVG.invalidateChildInParentFast(left, top, dirty);\n                                left = parentVG.mLeft;\n                                top = parentVG.mTop;\n                            }\n                        }\n                        else {\n                            const location = attachInfo.mInvalidateChildLocation;\n                            location[0] = left;\n                            location[1] = top;\n                            parent = parent.invalidateChildInParent(location, dirty);\n                        }\n                    } while (parent != null);\n                }\n            }\n            invalidateChildInParentFast(left, top, dirty) {\n                if ((this.mPrivateFlags & view_4.View.PFLAG_DRAWN) == view_4.View.PFLAG_DRAWN ||\n                    (this.mPrivateFlags & view_4.View.PFLAG_DRAWING_CACHE_VALID) == view_4.View.PFLAG_DRAWING_CACHE_VALID) {\n                    dirty.offset(left - this.mScrollX, top - this.mScrollY);\n                    if ((this.mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) == 0) {\n                        dirty.union(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop);\n                    }\n                    if ((this.mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) == 0 ||\n                        dirty.intersect(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop)) {\n                        if (this.mLayerType != view_4.View.LAYER_TYPE_NONE) {\n                            this.mLocalDirtyRect.union(dirty);\n                        }\n                        if (!this.getMatrix().isIdentity()) {\n                            this.transformRect(dirty);\n                        }\n                        return this.mParent;\n                    }\n                }\n                return null;\n            }\n            getChildStaticTransformation(child, t) {\n                return false;\n            }\n            getChildTransformation() {\n                if (this.mChildTransformation == null) {\n                    this.mChildTransformation = new Transformation();\n                }\n                return this.mChildTransformation;\n            }\n            findViewTraversal(id) {\n                if (id == this.mID) {\n                    return this;\n                }\n                let where = this.mChildren;\n                const len = this.mChildrenCount;\n                for (let i = 0; i < len; i++) {\n                    let v = where[i];\n                    if ((v.mPrivateFlags & view_4.View.PFLAG_IS_ROOT_NAMESPACE) == 0) {\n                        v = v.findViewById(id);\n                        if (v != null) {\n                            return v;\n                        }\n                    }\n                }\n                return null;\n            }\n            findViewWithTagTraversal(tag) {\n                if (tag != null && tag === this.mTag) {\n                    return this;\n                }\n                let where = this.mChildren;\n                const len = this.mChildrenCount;\n                for (let i = 0; i < len; i++) {\n                    let v = where[i];\n                    if ((v.mPrivateFlags & view_4.View.PFLAG_IS_ROOT_NAMESPACE) == 0) {\n                        v = v.findViewWithTag(tag);\n                        if (v != null) {\n                            return v;\n                        }\n                    }\n                }\n                return null;\n            }\n            findViewByPredicateTraversal(predicate, childToSkip) {\n                if (predicate.apply(this)) {\n                    return this;\n                }\n                const where = this.mChildren;\n                const len = this.mChildrenCount;\n                for (let i = 0; i < len; i++) {\n                    let v = where[i];\n                    if (v != childToSkip && (v.mPrivateFlags & view_4.View.PFLAG_IS_ROOT_NAMESPACE) == 0) {\n                        v = v.findViewByPredicate(predicate);\n                        if (v != null) {\n                            return v;\n                        }\n                    }\n                }\n                return null;\n            }\n            requestDisallowInterceptTouchEvent(disallowIntercept) {\n                if (disallowIntercept == ((this.mGroupFlags & ViewGroup.FLAG_DISALLOW_INTERCEPT) != 0)) {\n                    return;\n                }\n                if (disallowIntercept) {\n                    this.mGroupFlags |= ViewGroup.FLAG_DISALLOW_INTERCEPT;\n                }\n                else {\n                    this.mGroupFlags &= ~ViewGroup.FLAG_DISALLOW_INTERCEPT;\n                }\n                if (this.mParent != null) {\n                    this.mParent.requestDisallowInterceptTouchEvent(disallowIntercept);\n                }\n            }\n            shouldDelayChildPressedState() {\n                return true;\n            }\n            onSetLayoutParams(child, layoutParams) {\n            }\n        }\n        ViewGroup.FLAG_CLIP_CHILDREN = 0x1;\n        ViewGroup.FLAG_CLIP_TO_PADDING = 0x2;\n        ViewGroup.FLAG_INVALIDATE_REQUIRED = 0x4;\n        ViewGroup.FLAG_RUN_ANIMATION = 0x8;\n        ViewGroup.FLAG_ANIMATION_DONE = 0x10;\n        ViewGroup.FLAG_PADDING_NOT_NULL = 0x20;\n        ViewGroup.FLAG_ANIMATION_CACHE = 0x40;\n        ViewGroup.FLAG_OPTIMIZE_INVALIDATE = 0x80;\n        ViewGroup.FLAG_CLEAR_TRANSFORMATION = 0x100;\n        ViewGroup.FLAG_NOTIFY_ANIMATION_LISTENER = 0x200;\n        ViewGroup.FLAG_USE_CHILD_DRAWING_ORDER = 0x400;\n        ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS = 0x800;\n        ViewGroup.FLAG_ALPHA_LOWER_THAN_ONE = 0x1000;\n        ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN = 0x2000;\n        ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE = 0x4000;\n        ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE = 0x8000;\n        ViewGroup.FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE = 0x10000;\n        ViewGroup.FLAG_MASK_FOCUSABILITY = 0x60000;\n        ViewGroup.FOCUS_BEFORE_DESCENDANTS = 0x20000;\n        ViewGroup.FOCUS_AFTER_DESCENDANTS = 0x40000;\n        ViewGroup.FOCUS_BLOCK_DESCENDANTS = 0x60000;\n        ViewGroup.FLAG_DISALLOW_INTERCEPT = 0x80000;\n        ViewGroup.FLAG_SPLIT_MOTION_EVENTS = 0x200000;\n        ViewGroup.FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW = 0x400000;\n        ViewGroup.FLAG_LAYOUT_MODE_WAS_EXPLICITLY_SET = 0x800000;\n        ViewGroup.PERSISTENT_NO_CACHE = 0x0;\n        ViewGroup.PERSISTENT_ANIMATION_CACHE = 0x1;\n        ViewGroup.PERSISTENT_SCROLLING_CACHE = 0x2;\n        ViewGroup.PERSISTENT_ALL_CACHES = 0x3;\n        ViewGroup.LAYOUT_MODE_UNDEFINED = -1;\n        ViewGroup.LAYOUT_MODE_CLIP_BOUNDS = 0;\n        ViewGroup.LAYOUT_MODE_DEFAULT = ViewGroup.LAYOUT_MODE_CLIP_BOUNDS;\n        ViewGroup.CLIP_TO_PADDING_MASK = ViewGroup.FLAG_CLIP_TO_PADDING | ViewGroup.FLAG_PADDING_NOT_NULL;\n        view_4.ViewGroup = ViewGroup;\n        (function (ViewGroup) {\n            class LayoutParams extends java.lang.JavaObject {\n                constructor(...args) {\n                    super();\n                    this.width = 0;\n                    this.height = 0;\n                    if (args[0] instanceof Context && args[1] instanceof HTMLElement) {\n                        const a = args[0].obtainStyledAttributes(args[1]);\n                        this.setBaseAttributes(a, 'layout_width', 'layout_height');\n                        a.recycle();\n                    }\n                    else if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n                        this.width = args[0];\n                        this.height = args[1];\n                    }\n                    else if (args[0] instanceof LayoutParams) {\n                        this.width = args[0].width;\n                        this.height = args[0].height;\n                    }\n                    else if (args.length === 0) {\n                    }\n                }\n                setBaseAttributes(a, widthAttr, heightAttr) {\n                    this.width = a.getLayoutDimension(widthAttr, LayoutParams.WRAP_CONTENT);\n                    this.height = a.getLayoutDimension(heightAttr, LayoutParams.WRAP_CONTENT);\n                }\n                getAttrBinder() {\n                    if (!this._attrBinder) {\n                        this._attrBinder = this.initBindAttr();\n                    }\n                    return this._attrBinder;\n                }\n                initBindAttr() {\n                    let classAttrBinder = LayoutParams.ClassAttrBinderClazzMap.get(this.getClass());\n                    if (!classAttrBinder) {\n                        classAttrBinder = this.createClassAttrBinder();\n                        LayoutParams.ClassAttrBinderClazzMap.set(this.getClass(), classAttrBinder);\n                    }\n                    const attrBinder = new AttrBinder(this);\n                    attrBinder.setClassAttrBind(classAttrBinder);\n                    return attrBinder;\n                }\n                createClassAttrBinder() {\n                    return new androidui.attr.AttrBinder.ClassBinderMap()\n                        .set('layout_width', {\n                        setter(host, value, attrBinder) {\n                            host.width = attrBinder.parseDimension(value, host.width);\n                        }, getter(host) {\n                            return host.width;\n                        }\n                    }).set('layout_height', {\n                        setter(host, value, attrBinder) {\n                            host.height = attrBinder.parseDimension(value, host.height);\n                        }, getter(host) {\n                            return host.height;\n                        }\n                    });\n                }\n            }\n            LayoutParams.ClassAttrBinderClazzMap = new Map();\n            LayoutParams.FILL_PARENT = -1;\n            LayoutParams.MATCH_PARENT = -1;\n            LayoutParams.WRAP_CONTENT = -2;\n            ViewGroup.LayoutParams = LayoutParams;\n            class MarginLayoutParams extends LayoutParams {\n                constructor(...args) {\n                    super(...(() => {\n                        if (args[0] instanceof Context && args[1] instanceof HTMLElement)\n                            return [0, 0];\n                        else if (typeof args[0] === 'number' && typeof args[1] === 'number')\n                            return [args[0], args[1]];\n                        else if (args[0] instanceof MarginLayoutParams)\n                            return [args[0]];\n                        else if (args[0] instanceof ViewGroup.LayoutParams)\n                            return [args[0]];\n                    })());\n                    this.leftMargin = 0;\n                    this.topMargin = 0;\n                    this.rightMargin = 0;\n                    this.bottomMargin = 0;\n                    if (args[0] instanceof Context && args[1] instanceof HTMLElement) {\n                        const a = args[0].obtainStyledAttributes(args[1]);\n                        this.setBaseAttributes(a, 'layout_width', 'layout_height');\n                        let margin = a.getDimensionPixelSize('layout_margin', -1);\n                        if (margin >= 0) {\n                            this.leftMargin = margin;\n                            this.topMargin = margin;\n                            this.rightMargin = margin;\n                            this.bottomMargin = margin;\n                        }\n                        else {\n                            this.leftMargin = a.getDimensionPixelSize('layout_marginLeft', 0);\n                            this.rightMargin = a.getDimensionPixelSize('layout_marginRight', 0);\n                            this.topMargin = a.getDimensionPixelSize('layout_marginTop', 0);\n                            this.bottomMargin = a.getDimensionPixelSize('layout_marginBottom', 0);\n                            this.leftMargin = a.getDimensionPixelSize('layout_marginStart', this.leftMargin);\n                            this.rightMargin = a.getDimensionPixelSize('layout_marginEnd', this.rightMargin);\n                        }\n                        a.recycle();\n                    }\n                    else if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n                    }\n                    else if (args[0] instanceof MarginLayoutParams) {\n                        const source = args[0];\n                        this.width = source.width;\n                        this.height = source.height;\n                        this.leftMargin = source.leftMargin;\n                        this.topMargin = source.topMargin;\n                        this.rightMargin = source.rightMargin;\n                        this.bottomMargin = source.bottomMargin;\n                    }\n                    else if (args[0] instanceof ViewGroup.LayoutParams) {\n                    }\n                }\n                createClassAttrBinder() {\n                    return super.createClassAttrBinder().set('layout_marginLeft', {\n                        setter(host, value) {\n                            if (value == null)\n                                value = 0;\n                            host.leftMargin = value;\n                        }, getter(host) {\n                            return host.leftMargin;\n                        }\n                    }).set('layout_marginStart', {\n                        setter(host, value) {\n                            if (value == null)\n                                value = 0;\n                            host.leftMargin = value;\n                        }, getter(host) {\n                            return host.leftMargin;\n                        }\n                    }).set('layout_marginTop', {\n                        setter(host, value) {\n                            if (value == null)\n                                value = 0;\n                            host.topMargin = value;\n                        }, getter(host) {\n                            return host.topMargin;\n                        }\n                    }).set('layout_marginRight', {\n                        setter(host, value) {\n                            if (value == null)\n                                value = 0;\n                            host.rightMargin = value;\n                        }, getter(host) {\n                            return host.rightMargin;\n                        }\n                    }).set('layout_marginEnd', {\n                        setter(host, value) {\n                            if (value == null)\n                                value = 0;\n                            host.rightMargin = value;\n                        }, getter(host) {\n                            return host.rightMargin;\n                        }\n                    }).set('layout_marginBottom', {\n                        setter(host, value) {\n                            if (value == null)\n                                value = 0;\n                            host.bottomMargin = value;\n                        }, getter(host) {\n                            return host.bottomMargin;\n                        }\n                    }).set('layout_margin', {\n                        setter(host, value, attrBinder) {\n                            if (value == null)\n                                value = 0;\n                            let [top, right, bottom, left] = attrBinder.parsePaddingMarginTRBL(value);\n                            host.topMargin = top;\n                            host.rightMargin = right;\n                            host.bottomMargin = bottom;\n                            host.leftMargin = left;\n                        }, getter(host) {\n                            return host.topMargin + ' ' + host.rightMargin + ' ' + host.bottomMargin + ' ' + host.leftMargin;\n                        }\n                    });\n                }\n                setMargins(left, top, right, bottom) {\n                    this.leftMargin = left;\n                    this.topMargin = top;\n                    this.rightMargin = right;\n                    this.bottomMargin = bottom;\n                }\n                setLayoutDirection(layoutDirection) {\n                }\n                getLayoutDirection() {\n                    return view_4.View.LAYOUT_DIRECTION_LTR;\n                }\n                isLayoutRtl() {\n                    return this.getLayoutDirection() == view_4.View.LAYOUT_DIRECTION_RTL;\n                }\n                resolveLayoutDirection(layoutDirection) {\n                }\n            }\n            MarginLayoutParams.DEFAULT_MARGIN_RELATIVE = Integer.MIN_VALUE;\n            MarginLayoutParams.DEFAULT_MARGIN_RESOLVED = 0;\n            MarginLayoutParams.UNDEFINED_MARGIN = MarginLayoutParams.DEFAULT_MARGIN_RELATIVE;\n            ViewGroup.MarginLayoutParams = MarginLayoutParams;\n        })(ViewGroup = view_4.ViewGroup || (view_4.ViewGroup = {}));\n        class TouchTarget {\n            static obtain(child, pointerIdBits) {\n                let target;\n                if (TouchTarget.sRecycleBin == null) {\n                    target = new TouchTarget();\n                }\n                else {\n                    target = TouchTarget.sRecycleBin;\n                    TouchTarget.sRecycleBin = target.next;\n                    TouchTarget.sRecycledCount--;\n                    target.next = null;\n                }\n                target.child = child;\n                target.pointerIdBits = pointerIdBits;\n                return target;\n            }\n            recycle() {\n                if (TouchTarget.sRecycledCount < TouchTarget.MAX_RECYCLED) {\n                    this.next = TouchTarget.sRecycleBin;\n                    TouchTarget.sRecycleBin = this;\n                    TouchTarget.sRecycledCount += 1;\n                }\n                else {\n                    this.next = null;\n                }\n                this.child = null;\n            }\n        }\n        TouchTarget.MAX_RECYCLED = 32;\n        TouchTarget.sRecycledCount = 0;\n        TouchTarget.ALL_POINTER_IDS = -1;\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var Drawable = android.graphics.drawable.Drawable;\n        class ViewOverlay {\n            constructor(hostView) {\n                this.mOverlayViewGroup = new ViewOverlay.OverlayViewGroup(hostView);\n            }\n            getOverlayView() {\n                return this.mOverlayViewGroup;\n            }\n            add(drawable) {\n                this.mOverlayViewGroup.add(drawable);\n            }\n            remove(drawable) {\n            }\n            clear() {\n                this.mOverlayViewGroup.clear();\n            }\n            isEmpty() {\n                return this.mOverlayViewGroup.isEmpty();\n            }\n        }\n        view.ViewOverlay = ViewOverlay;\n        (function (ViewOverlay) {\n            class OverlayViewGroup extends view.ViewGroup {\n                constructor(hostView) {\n                    super(hostView.getContext());\n                    this.mHostView = hostView;\n                    this.mAttachInfo = hostView.mAttachInfo;\n                    this.mRight = hostView.getWidth();\n                    this.mBottom = hostView.getHeight();\n                }\n                addDrawable(drawable) {\n                }\n                addView(child) {\n                }\n                add(arg) {\n                    if (arg instanceof Drawable)\n                        this.addDrawable(arg);\n                    else if (arg instanceof view.View)\n                        this.addView(arg);\n                }\n                clear() {\n                }\n                isEmpty() {\n                    return true;\n                }\n                onLayout(changed, l, t, r, b) {\n                }\n            }\n            ViewOverlay.OverlayViewGroup = OverlayViewGroup;\n        })(ViewOverlay = view.ViewOverlay || (view.ViewOverlay = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var Gravity = android.view.Gravity;\n        var View = android.view.View;\n        var ViewGroup = android.view.ViewGroup;\n        var Rect = android.graphics.Rect;\n        var Context = android.content.Context;\n        class FrameLayout extends ViewGroup {\n            constructor(context, bindElement, defStyle) {\n                super(context, bindElement, defStyle);\n                this.mMeasureAllChildren = false;\n                this.mForegroundPaddingLeft = 0;\n                this.mForegroundPaddingTop = 0;\n                this.mForegroundPaddingRight = 0;\n                this.mForegroundPaddingBottom = 0;\n                this.mSelfBounds = new Rect();\n                this.mOverlayBounds = new Rect();\n                this.mForegroundGravity = Gravity.FILL;\n                this.mForegroundInPadding = true;\n                this.mForegroundBoundsChanged = false;\n                this.mMatchParentChildren = new Array(1);\n                const a = context.obtainStyledAttributes(bindElement, defStyle);\n                this.mForegroundGravity = Gravity.parseGravity(a.getAttrValue('foregroundGravity'), this.mForegroundGravity);\n                const d = a.getDrawable('foreground');\n                if (d != null) {\n                    this.setForeground(d);\n                }\n                if (a.getBoolean('measureAllChildren', false)) {\n                    this.setMeasureAllChildren(true);\n                }\n                this.mForegroundInPadding = a.getBoolean('foregroundInsidePadding', true);\n                a.recycle();\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('foregroundGravity', {\n                    setter(v, value, attrBinder) {\n                        v.mForegroundGravity = attrBinder.parseGravity(value, v.mForegroundGravity);\n                    }, getter(v) {\n                        return v.mForegroundGravity;\n                    }\n                }).set('foreground', {\n                    setter(v, value, attrBinder) {\n                        v.setForeground(attrBinder.parseDrawable(value));\n                    }, getter(v) {\n                        return v.getForeground();\n                    }\n                }).set('measureAllChildren', {\n                    setter(v, value, attrBinder) {\n                        if (attrBinder.parseBoolean(value)) {\n                            v.setMeasureAllChildren(true);\n                        }\n                    }, getter(v) {\n                        return v.mMeasureAllChildren;\n                    }\n                });\n            }\n            getForegroundGravity() {\n                return this.mForegroundGravity;\n            }\n            setForegroundGravity(foregroundGravity) {\n                if (this.mForegroundGravity != foregroundGravity) {\n                    if ((foregroundGravity & Gravity.HORIZONTAL_GRAVITY_MASK) == 0) {\n                        foregroundGravity |= Gravity.LEFT;\n                    }\n                    if ((foregroundGravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) {\n                        foregroundGravity |= Gravity.TOP;\n                    }\n                    this.mForegroundGravity = foregroundGravity;\n                    if (this.mForegroundGravity == Gravity.FILL && this.mForeground != null) {\n                        let padding = new Rect();\n                        if (this.mForeground.getPadding(padding)) {\n                            this.mForegroundPaddingLeft = padding.left;\n                            this.mForegroundPaddingTop = padding.top;\n                            this.mForegroundPaddingRight = padding.right;\n                            this.mForegroundPaddingBottom = padding.bottom;\n                        }\n                    }\n                    else {\n                        this.mForegroundPaddingLeft = 0;\n                        this.mForegroundPaddingTop = 0;\n                        this.mForegroundPaddingRight = 0;\n                        this.mForegroundPaddingBottom = 0;\n                    }\n                    this.requestLayout();\n                }\n            }\n            verifyDrawable(who) {\n                return super.verifyDrawable(who) || (who == this.mForeground);\n            }\n            jumpDrawablesToCurrentState() {\n                super.jumpDrawablesToCurrentState();\n                if (this.mForeground != null)\n                    this.mForeground.jumpToCurrentState();\n            }\n            drawableStateChanged() {\n                super.drawableStateChanged();\n                if (this.mForeground != null && this.mForeground.isStateful()) {\n                    this.mForeground.setState(this.getDrawableState());\n                }\n            }\n            generateDefaultLayoutParams() {\n                return new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);\n            }\n            setForeground(drawable) {\n                if (this.mForeground != drawable) {\n                    if (this.mForeground != null) {\n                        this.mForeground.setCallback(null);\n                        this.unscheduleDrawable(this.mForeground);\n                    }\n                    this.mForeground = drawable;\n                    this.mForegroundPaddingLeft = 0;\n                    this.mForegroundPaddingTop = 0;\n                    this.mForegroundPaddingRight = 0;\n                    this.mForegroundPaddingBottom = 0;\n                    if (drawable != null) {\n                        this.setWillNotDraw(false);\n                        drawable.setCallback(this);\n                        if (drawable.isStateful()) {\n                            drawable.setState(this.getDrawableState());\n                        }\n                        if (this.mForegroundGravity == Gravity.FILL) {\n                            let padding = new Rect();\n                            if (drawable.getPadding(padding)) {\n                                this.mForegroundPaddingLeft = padding.left;\n                                this.mForegroundPaddingTop = padding.top;\n                                this.mForegroundPaddingRight = padding.right;\n                                this.mForegroundPaddingBottom = padding.bottom;\n                            }\n                        }\n                    }\n                    else {\n                        this.setWillNotDraw(true);\n                    }\n                    this.requestLayout();\n                    this.invalidate();\n                }\n            }\n            getForeground() {\n                return this.mForeground;\n            }\n            getPaddingLeftWithForeground() {\n                return this.mForegroundInPadding ? Math.max(this.mPaddingLeft, this.mForegroundPaddingLeft) :\n                    this.mPaddingLeft + this.mForegroundPaddingLeft;\n            }\n            getPaddingRightWithForeground() {\n                return this.mForegroundInPadding ? Math.max(this.mPaddingRight, this.mForegroundPaddingRight) :\n                    this.mPaddingRight + this.mForegroundPaddingRight;\n            }\n            getPaddingTopWithForeground() {\n                return this.mForegroundInPadding ? Math.max(this.mPaddingTop, this.mForegroundPaddingTop) :\n                    this.mPaddingTop + this.mForegroundPaddingTop;\n            }\n            getPaddingBottomWithForeground() {\n                return this.mForegroundInPadding ? Math.max(this.mPaddingBottom, this.mForegroundPaddingBottom) :\n                    this.mPaddingBottom + this.mForegroundPaddingBottom;\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                let count = this.getChildCount();\n                let measureMatchParentChildren = View.MeasureSpec.getMode(widthMeasureSpec) != View.MeasureSpec.EXACTLY ||\n                    View.MeasureSpec.getMode(heightMeasureSpec) != View.MeasureSpec.EXACTLY;\n                this.mMatchParentChildren = [];\n                let maxHeight = 0;\n                let maxWidth = 0;\n                let childState = 0;\n                for (let i = 0; i < count; i++) {\n                    let child = this.getChildAt(i);\n                    if (this.mMeasureAllChildren || child.getVisibility() != View.GONE) {\n                        this.measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);\n                        let lp = child.getLayoutParams();\n                        maxWidth = Math.max(maxWidth, child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin);\n                        maxHeight = Math.max(maxHeight, child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin);\n                        childState = View.combineMeasuredStates(childState, child.getMeasuredState());\n                        if (measureMatchParentChildren) {\n                            if (lp.width == FrameLayout.LayoutParams.MATCH_PARENT ||\n                                lp.height == FrameLayout.LayoutParams.MATCH_PARENT) {\n                                this.mMatchParentChildren.push(child);\n                            }\n                        }\n                    }\n                }\n                maxWidth += this.getPaddingLeftWithForeground() + this.getPaddingRightWithForeground();\n                maxHeight += this.getPaddingTopWithForeground() + this.getPaddingBottomWithForeground();\n                maxHeight = Math.max(maxHeight, this.getSuggestedMinimumHeight());\n                maxWidth = Math.max(maxWidth, this.getSuggestedMinimumWidth());\n                let drawable = this.getForeground();\n                if (drawable != null) {\n                    maxHeight = Math.max(maxHeight, drawable.getMinimumHeight());\n                    maxWidth = Math.max(maxWidth, drawable.getMinimumWidth());\n                }\n                this.setMeasuredDimension(View.resolveSizeAndState(maxWidth, widthMeasureSpec, childState), View.resolveSizeAndState(maxHeight, heightMeasureSpec, childState << View.MEASURED_HEIGHT_STATE_SHIFT));\n                count = this.mMatchParentChildren.length;\n                if (count > 1) {\n                    for (let i = 0; i < count; i++) {\n                        let child = this.mMatchParentChildren[i];\n                        let lp = child.getLayoutParams();\n                        let childWidthMeasureSpec;\n                        let childHeightMeasureSpec;\n                        if (lp.width == FrameLayout.LayoutParams.MATCH_PARENT) {\n                            childWidthMeasureSpec = View.MeasureSpec.makeMeasureSpec(this.getMeasuredWidth() -\n                                this.getPaddingLeftWithForeground() - this.getPaddingRightWithForeground() -\n                                lp.leftMargin - lp.rightMargin, View.MeasureSpec.EXACTLY);\n                        }\n                        else {\n                            childWidthMeasureSpec = ViewGroup.getChildMeasureSpec(widthMeasureSpec, this.getPaddingLeftWithForeground() + this.getPaddingRightWithForeground() +\n                                lp.leftMargin + lp.rightMargin, lp.width);\n                        }\n                        if (lp.height == FrameLayout.LayoutParams.MATCH_PARENT) {\n                            childHeightMeasureSpec = View.MeasureSpec.makeMeasureSpec(this.getMeasuredHeight() -\n                                this.getPaddingTopWithForeground() - this.getPaddingBottomWithForeground() -\n                                lp.topMargin - lp.bottomMargin, View.MeasureSpec.EXACTLY);\n                        }\n                        else {\n                            childHeightMeasureSpec = ViewGroup.getChildMeasureSpec(heightMeasureSpec, this.getPaddingTopWithForeground() + this.getPaddingBottomWithForeground() +\n                                lp.topMargin + lp.bottomMargin, lp.height);\n                        }\n                        child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n                    }\n                }\n            }\n            onLayout(changed, left, top, right, bottom) {\n                this.layoutChildren(left, top, right, bottom, false);\n            }\n            layoutChildren(left, top, right, bottom, forceLeftGravity) {\n                const count = this.getChildCount();\n                const parentLeft = this.getPaddingLeftWithForeground();\n                const parentRight = right - left - this.getPaddingRightWithForeground();\n                const parentTop = this.getPaddingTopWithForeground();\n                const parentBottom = bottom - top - this.getPaddingBottomWithForeground();\n                this.mForegroundBoundsChanged = true;\n                for (let i = 0; i < count; i++) {\n                    let child = this.getChildAt(i);\n                    if (child.getVisibility() != View.GONE) {\n                        const lp = child.getLayoutParams();\n                        const width = child.getMeasuredWidth();\n                        const height = child.getMeasuredHeight();\n                        let childLeft;\n                        let childTop;\n                        let gravity = lp.gravity;\n                        if (gravity == -1) {\n                            gravity = FrameLayout.DEFAULT_CHILD_GRAVITY;\n                        }\n                        const absoluteGravity = gravity;\n                        const verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK;\n                        switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n                            case Gravity.CENTER_HORIZONTAL:\n                                childLeft = parentLeft + (parentRight - parentLeft - width) / 2 +\n                                    lp.leftMargin - lp.rightMargin;\n                                break;\n                            case Gravity.RIGHT:\n                                if (!forceLeftGravity) {\n                                    childLeft = parentRight - width - lp.rightMargin;\n                                    break;\n                                }\n                            case Gravity.LEFT:\n                            default:\n                                childLeft = parentLeft + lp.leftMargin;\n                        }\n                        switch (verticalGravity) {\n                            case Gravity.TOP:\n                                childTop = parentTop + lp.topMargin;\n                                break;\n                            case Gravity.CENTER_VERTICAL:\n                                childTop = parentTop + (parentBottom - parentTop - height) / 2 +\n                                    lp.topMargin - lp.bottomMargin;\n                                break;\n                            case Gravity.BOTTOM:\n                                childTop = parentBottom - height - lp.bottomMargin;\n                                break;\n                            default:\n                                childTop = parentTop + lp.topMargin;\n                        }\n                        child.layout(childLeft, childTop, childLeft + width, childTop + height);\n                    }\n                }\n            }\n            onSizeChanged(w, h, oldw, oldh) {\n                super.onSizeChanged(w, h, oldw, oldh);\n                this.mForegroundBoundsChanged = true;\n            }\n            draw(canvas) {\n                super.draw(canvas);\n                if (this.mForeground != null) {\n                    const foreground = this.mForeground;\n                    if (this.mForegroundBoundsChanged) {\n                        this.mForegroundBoundsChanged = false;\n                        const selfBounds = this.mSelfBounds;\n                        const overlayBounds = this.mOverlayBounds;\n                        const w = this.mRight - this.mLeft;\n                        const h = this.mBottom - this.mTop;\n                        if (this.mForegroundInPadding) {\n                            selfBounds.set(0, 0, w, h);\n                        }\n                        else {\n                            selfBounds.set(this.mPaddingLeft, this.mPaddingTop, w - this.mPaddingRight, h - this.mPaddingBottom);\n                        }\n                        Gravity.apply(this.mForegroundGravity, foreground.getIntrinsicWidth(), foreground.getIntrinsicHeight(), selfBounds, overlayBounds);\n                        foreground.setBounds(overlayBounds);\n                    }\n                    foreground.draw(canvas);\n                }\n            }\n            setMeasureAllChildren(measureAll) {\n                this.mMeasureAllChildren = measureAll;\n            }\n            getMeasureAllChildren() {\n                return this.mMeasureAllChildren;\n            }\n            generateLayoutParamsFromAttr(attrs) {\n                return new FrameLayout.LayoutParams(this.getContext(), attrs);\n            }\n            shouldDelayChildPressedState() {\n                return false;\n            }\n            checkLayoutParams(p) {\n                return p instanceof FrameLayout.LayoutParams;\n            }\n            generateLayoutParams(p) {\n                return new FrameLayout.LayoutParams(p);\n            }\n        }\n        FrameLayout.DEFAULT_CHILD_GRAVITY = Gravity.TOP | Gravity.LEFT;\n        widget.FrameLayout = FrameLayout;\n        (function (FrameLayout) {\n            class LayoutParams extends ViewGroup.MarginLayoutParams {\n                constructor(...args) {\n                    super(...(() => {\n                        if (args[0] instanceof android.content.Context && args[1] instanceof HTMLElement)\n                            return [args[0], args[1]];\n                        else if (typeof args[0] === 'number' && typeof args[1] === 'number' && typeof args[2] === 'number')\n                            return [args[0], args[1]];\n                        else if (typeof args[0] === 'number' && typeof args[1] === 'number')\n                            return [args[0], args[1]];\n                        else if (args[0] instanceof ViewGroup.LayoutParams)\n                            return [args[0]];\n                    })());\n                    this.gravity = -1;\n                    if (args[0] instanceof Context && args[1] instanceof HTMLElement) {\n                        const c = args[0];\n                        const attrs = args[1];\n                        const a = c.obtainStyledAttributes(attrs);\n                        this.gravity = Gravity.parseGravity(a.getAttrValue('layout_gravity'), -1);\n                        a.recycle();\n                    }\n                    else if (typeof args[0] === 'number' && typeof args[1] === 'number' && typeof args[2] === 'number') {\n                        this.gravity = args[2];\n                    }\n                    else if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n                    }\n                    else if (args[0] instanceof FrameLayout.LayoutParams) {\n                        const source = args[0];\n                        this.gravity = source.gravity;\n                    }\n                    else if (args[0] instanceof ViewGroup.MarginLayoutParams) {\n                    }\n                    else if (args[0] instanceof ViewGroup.LayoutParams) {\n                    }\n                }\n                createClassAttrBinder() {\n                    return super.createClassAttrBinder().set('layout_gravity', {\n                        setter(param, value, attrBinder) {\n                            param.gravity = attrBinder.parseGravity(value, param.gravity);\n                        }, getter(param) {\n                            return param.gravity;\n                        }\n                    });\n                }\n            }\n            FrameLayout.LayoutParams = LayoutParams;\n        })(FrameLayout = widget.FrameLayout || (widget.FrameLayout = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        var Spanned;\n        (function (Spanned) {\n            function isImplements(obj) {\n                return obj && obj['getSpans'] && obj['getSpanStart'] && obj['getSpanEnd']\n                    && obj['getSpanFlags'] && obj['nextSpanTransition'];\n            }\n            Spanned.isImplements = isImplements;\n            Spanned.SPAN_POINT_MARK_MASK = 0x33;\n            Spanned.SPAN_MARK_MARK = 0x11;\n            Spanned.SPAN_MARK_POINT = 0x12;\n            Spanned.SPAN_POINT_MARK = 0x21;\n            Spanned.SPAN_POINT_POINT = 0x22;\n            Spanned.SPAN_PARAGRAPH = 0x33;\n            Spanned.SPAN_INCLUSIVE_EXCLUSIVE = Spanned.SPAN_MARK_MARK;\n            Spanned.SPAN_INCLUSIVE_INCLUSIVE = Spanned.SPAN_MARK_POINT;\n            Spanned.SPAN_EXCLUSIVE_EXCLUSIVE = Spanned.SPAN_POINT_MARK;\n            Spanned.SPAN_EXCLUSIVE_INCLUSIVE = Spanned.SPAN_POINT_POINT;\n            Spanned.SPAN_COMPOSING = 0x100;\n            Spanned.SPAN_INTERMEDIATE = 0x200;\n            Spanned.SPAN_USER_SHIFT = 24;\n            Spanned.SPAN_USER = 0xFFFFFFFF << Spanned.SPAN_USER_SHIFT;\n            Spanned.SPAN_PRIORITY_SHIFT = 16;\n            Spanned.SPAN_PRIORITY = 0xFF << Spanned.SPAN_PRIORITY_SHIFT;\n        })(Spanned = text.Spanned || (text.Spanned = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        class TextPaint extends android.graphics.Paint {\n            constructor() {\n                super(...arguments);\n                this.baselineShift = 0;\n                this.bgColor = 0;\n                this.linkColor = 0;\n                this.underlineColor = 0;\n                this.underlineThickness = 0;\n            }\n            set(tp) {\n                super.set(tp);\n                this.bgColor = tp.bgColor;\n                this.baselineShift = tp.baselineShift;\n                this.linkColor = tp.linkColor;\n                this.underlineColor = tp.underlineColor;\n                this.underlineThickness = tp.underlineThickness;\n            }\n            setUnderlineText(color, thickness) {\n                this.underlineColor = color;\n                this.underlineThickness = thickness;\n            }\n        }\n        text.TextPaint = TextPaint;\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        var style;\n        (function (style) {\n            var MetricAffectingSpan = android.text.style.MetricAffectingSpan;\n            class CharacterStyle {\n                constructor() {\n                    this.mType = CharacterStyle.type;\n                }\n                static wrap(cs) {\n                    if (cs instanceof MetricAffectingSpan) {\n                        return new MetricAffectingSpan.Passthrough_MetricAffectingSpan(cs);\n                    }\n                    else {\n                        return new CharacterStyle.Passthrough_CharacterStyle(cs);\n                    }\n                }\n                getUnderlying() {\n                    return this;\n                }\n            }\n            CharacterStyle.type = Symbol();\n            style.CharacterStyle = CharacterStyle;\n            (function (CharacterStyle) {\n                class Passthrough_CharacterStyle extends CharacterStyle {\n                    constructor(cs) {\n                        super();\n                        this.mStyle = cs;\n                    }\n                    updateDrawState(tp) {\n                        this.mStyle.updateDrawState(tp);\n                    }\n                    getUnderlying() {\n                        return this.mStyle.getUnderlying();\n                    }\n                }\n                CharacterStyle.Passthrough_CharacterStyle = Passthrough_CharacterStyle;\n            })(CharacterStyle = style.CharacterStyle || (style.CharacterStyle = {}));\n        })(style = text.style || (text.style = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        var style;\n        (function (style) {\n            var CharacterStyle = android.text.style.CharacterStyle;\n            class MetricAffectingSpan extends CharacterStyle {\n                constructor() {\n                    super(...arguments);\n                    this.mType = MetricAffectingSpan.type;\n                }\n                getUnderlying() {\n                    return this;\n                }\n            }\n            MetricAffectingSpan.type = Symbol();\n            style.MetricAffectingSpan = MetricAffectingSpan;\n            (function (MetricAffectingSpan) {\n                class Passthrough_MetricAffectingSpan extends MetricAffectingSpan {\n                    constructor(cs) {\n                        super();\n                        this.mStyle = cs;\n                    }\n                    updateDrawState(tp) {\n                        this.mStyle.updateDrawState(tp);\n                    }\n                    updateMeasureState(tp) {\n                        this.mStyle.updateMeasureState(tp);\n                    }\n                    getUnderlying() {\n                        return this.mStyle.getUnderlying();\n                    }\n                }\n                MetricAffectingSpan.Passthrough_MetricAffectingSpan = Passthrough_MetricAffectingSpan;\n            })(MetricAffectingSpan = style.MetricAffectingSpan || (style.MetricAffectingSpan = {}));\n        })(style = text.style || (text.style = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text_1) {\n        var style;\n        (function (style) {\n            var MetricAffectingSpan = android.text.style.MetricAffectingSpan;\n            class ReplacementSpan extends MetricAffectingSpan {\n                constructor() {\n                    super(...arguments);\n                    this.mType = ReplacementSpan.type;\n                }\n                updateMeasureState(p) {\n                }\n                updateDrawState(ds) {\n                }\n            }\n            ReplacementSpan.type = Symbol();\n            style.ReplacementSpan = ReplacementSpan;\n        })(style = text_1.style || (text_1.style = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        var style;\n        (function (style) {\n            var ParagraphStyle;\n            (function (ParagraphStyle) {\n                ParagraphStyle.type = Symbol();\n            })(ParagraphStyle = style.ParagraphStyle || (style.ParagraphStyle = {}));\n        })(style = text.style || (text.style = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text_2) {\n        var style;\n        (function (style) {\n            var TextUtils = android.text.TextUtils;\n            var LeadingMarginSpan;\n            (function (LeadingMarginSpan) {\n                function isImpl(obj) {\n                    return obj && obj['getLeadingMargin'] && obj['drawLeadingMargin'];\n                }\n                LeadingMarginSpan.isImpl = isImpl;\n                LeadingMarginSpan.type = Symbol();\n                var LeadingMarginSpan2;\n                (function (LeadingMarginSpan2) {\n                    function isImpl(obj) {\n                        return obj['getLeadingMarginLineCount'];\n                    }\n                    LeadingMarginSpan2.isImpl = isImpl;\n                })(LeadingMarginSpan2 = LeadingMarginSpan.LeadingMarginSpan2 || (LeadingMarginSpan.LeadingMarginSpan2 = {}));\n                class Standard {\n                    constructor(first, rest = first) {\n                        this.mFirst = 0;\n                        this.mRest = 0;\n                        this.mFirst = first;\n                        this.mRest = rest;\n                    }\n                    getSpanTypeId() {\n                        return TextUtils.LEADING_MARGIN_SPAN;\n                    }\n                    describeContents() {\n                        return 0;\n                    }\n                    getLeadingMargin(first) {\n                        return first ? this.mFirst : this.mRest;\n                    }\n                    drawLeadingMargin(c, p, x, dir, top, baseline, bottom, text, start, end, first, layout) {\n                        ;\n                    }\n                }\n                LeadingMarginSpan.Standard = Standard;\n            })(LeadingMarginSpan = style.LeadingMarginSpan || (style.LeadingMarginSpan = {}));\n        })(style = text_2.style || (text_2.style = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text_3) {\n        var style;\n        (function (style) {\n            var LineBackgroundSpan;\n            (function (LineBackgroundSpan) {\n                LineBackgroundSpan.type = Symbol();\n            })(LineBackgroundSpan = style.LineBackgroundSpan || (style.LineBackgroundSpan = {}));\n        })(style = text_3.style || (text_3.style = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        var style;\n        (function (style) {\n            var TabStopSpan;\n            (function (TabStopSpan) {\n                TabStopSpan.type = Symbol();\n                function isImpl(obj) {\n                    return obj && obj['getTabStop'];\n                }\n                TabStopSpan.isImpl = isImpl;\n                class Standard {\n                    constructor(where) {\n                        this.mTab = 0;\n                        this.mTab = where;\n                    }\n                    getTabStop() {\n                        return this.mTab;\n                    }\n                }\n                TabStopSpan.Standard = Standard;\n            })(TabStopSpan = style.TabStopSpan || (style.TabStopSpan = {}));\n        })(style = text.style || (text.style = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        class SpanSet {\n            constructor(type) {\n                this.numberOfSpans = 0;\n                this.classType = type;\n                this.numberOfSpans = 0;\n            }\n            init(spanned, start, limit) {\n                const allSpans = spanned.getSpans(start, limit, this.classType);\n                const length = allSpans.length;\n                if (length > 0 && (this.spans == null || this.spans.length < length)) {\n                    this.spans = new Array(length);\n                    this.spanStarts = androidui.util.ArrayCreator.newNumberArray(length);\n                    this.spanEnds = androidui.util.ArrayCreator.newNumberArray(length);\n                    this.spanFlags = androidui.util.ArrayCreator.newNumberArray(length);\n                }\n                this.numberOfSpans = 0;\n                for (let i = 0; i < length; i++) {\n                    const span = allSpans[i];\n                    const spanStart = spanned.getSpanStart(span);\n                    const spanEnd = spanned.getSpanEnd(span);\n                    if (spanStart == spanEnd)\n                        continue;\n                    const spanFlag = spanned.getSpanFlags(span);\n                    this.spans[this.numberOfSpans] = span;\n                    this.spanStarts[this.numberOfSpans] = spanStart;\n                    this.spanEnds[this.numberOfSpans] = spanEnd;\n                    this.spanFlags[this.numberOfSpans] = spanFlag;\n                    this.numberOfSpans++;\n                }\n            }\n            hasSpansIntersecting(start, end) {\n                for (let i = 0; i < this.numberOfSpans; i++) {\n                    if (this.spanStarts[i] >= end || this.spanEnds[i] <= start)\n                        continue;\n                    return true;\n                }\n                return false;\n            }\n            getNextTransition(start, limit) {\n                for (let i = 0; i < this.numberOfSpans; i++) {\n                    const spanStart = this.spanStarts[i];\n                    const spanEnd = this.spanEnds[i];\n                    if (spanStart > start && spanStart < limit)\n                        limit = spanStart;\n                    if (spanEnd > start && spanEnd < limit)\n                        limit = spanEnd;\n                }\n                return limit;\n            }\n            recycle() {\n                for (let i = 0; i < this.numberOfSpans; i++) {\n                    this.spans[i] = null;\n                }\n            }\n        }\n        text.SpanSet = SpanSet;\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        class TextDirectionHeuristics {\n            static isRtlText(directionality) {\n                return TextDirectionHeuristics.STATE_FALSE;\n            }\n            static isRtlTextOrFormat(directionality) {\n                return TextDirectionHeuristics.STATE_FALSE;\n            }\n        }\n        TextDirectionHeuristics.STATE_TRUE = 0;\n        TextDirectionHeuristics.STATE_FALSE = 1;\n        TextDirectionHeuristics.STATE_UNKNOWN = 2;\n        text.TextDirectionHeuristics = TextDirectionHeuristics;\n        (function (TextDirectionHeuristics) {\n            class TextDirectionHeuristicImpl {\n                constructor(algorithm) {\n                    this.mAlgorithm = algorithm;\n                }\n                isRtl(cs, start, count) {\n                    if (cs == null || start < 0 || count < 0 || cs.length - count < start) {\n                        throw Error(`new IllegalArgumentException()`);\n                    }\n                    if (this.mAlgorithm == null) {\n                        return this.defaultIsRtl();\n                    }\n                    return this.doCheck(cs, start, count);\n                }\n                doCheck(cs, start, count) {\n                    switch (this.mAlgorithm.checkRtl(cs, start, count)) {\n                        case TextDirectionHeuristics.STATE_TRUE:\n                            return true;\n                        case TextDirectionHeuristics.STATE_FALSE:\n                            return false;\n                        default:\n                            return this.defaultIsRtl();\n                    }\n                }\n            }\n            TextDirectionHeuristics.TextDirectionHeuristicImpl = TextDirectionHeuristicImpl;\n            class TextDirectionHeuristicInternal extends TextDirectionHeuristics.TextDirectionHeuristicImpl {\n                constructor(algorithm, defaultIsRtl) {\n                    super(algorithm);\n                    this.mDefaultIsRtl = defaultIsRtl;\n                }\n                defaultIsRtl() {\n                    return this.mDefaultIsRtl;\n                }\n            }\n            TextDirectionHeuristics.TextDirectionHeuristicInternal = TextDirectionHeuristicInternal;\n            class FirstStrong {\n                constructor() {\n                }\n                checkRtl(cs, start, count) {\n                    let result = TextDirectionHeuristics.STATE_UNKNOWN;\n                    for (let i = start, e = start + count; i < e && result == TextDirectionHeuristics.STATE_UNKNOWN; ++i) {\n                        result = TextDirectionHeuristics.STATE_FALSE;\n                    }\n                    return result;\n                }\n            }\n            FirstStrong.INSTANCE = new FirstStrong();\n            TextDirectionHeuristics.FirstStrong = FirstStrong;\n            class AnyStrong {\n                constructor(lookForRtl) {\n                    this.mLookForRtl = lookForRtl;\n                }\n                checkRtl(cs, start, count) {\n                    let haveUnlookedFor = false;\n                    for (let i = start, e = start + count; i < e; ++i) {\n                        switch (TextDirectionHeuristics.isRtlText(0)) {\n                            case TextDirectionHeuristics.STATE_TRUE:\n                                if (this.mLookForRtl) {\n                                    return TextDirectionHeuristics.STATE_TRUE;\n                                }\n                                haveUnlookedFor = true;\n                                break;\n                            case TextDirectionHeuristics.STATE_FALSE:\n                                if (!this.mLookForRtl) {\n                                    return TextDirectionHeuristics.STATE_FALSE;\n                                }\n                                haveUnlookedFor = true;\n                                break;\n                            default:\n                                break;\n                        }\n                    }\n                    if (haveUnlookedFor) {\n                        return this.mLookForRtl ? TextDirectionHeuristics.STATE_FALSE : TextDirectionHeuristics.STATE_TRUE;\n                    }\n                    return TextDirectionHeuristics.STATE_UNKNOWN;\n                }\n            }\n            AnyStrong.INSTANCE_RTL = new AnyStrong(true);\n            AnyStrong.INSTANCE_LTR = new AnyStrong(false);\n            TextDirectionHeuristics.AnyStrong = AnyStrong;\n            class TextDirectionHeuristicLocale extends TextDirectionHeuristics.TextDirectionHeuristicImpl {\n                constructor() {\n                    super(null);\n                }\n                defaultIsRtl() {\n                    return false;\n                }\n            }\n            TextDirectionHeuristicLocale.INSTANCE = new TextDirectionHeuristicLocale();\n            TextDirectionHeuristics.TextDirectionHeuristicLocale = TextDirectionHeuristicLocale;\n        })(TextDirectionHeuristics = text.TextDirectionHeuristics || (text.TextDirectionHeuristics = {}));\n        TextDirectionHeuristics.LTR = new TextDirectionHeuristics.TextDirectionHeuristicInternal(null, false);\n        TextDirectionHeuristics.RTL = new TextDirectionHeuristics.TextDirectionHeuristicInternal(null, true);\n        TextDirectionHeuristics.FIRSTSTRONG_LTR = new TextDirectionHeuristics.TextDirectionHeuristicInternal(TextDirectionHeuristics.FirstStrong.INSTANCE, false);\n        TextDirectionHeuristics.FIRSTSTRONG_RTL = new TextDirectionHeuristics.TextDirectionHeuristicInternal(TextDirectionHeuristics.FirstStrong.INSTANCE, true);\n        TextDirectionHeuristics.ANYRTL_LTR = new TextDirectionHeuristics.TextDirectionHeuristicInternal(TextDirectionHeuristics.AnyStrong.INSTANCE_RTL, false);\n        TextDirectionHeuristics.LOCALE = TextDirectionHeuristics.TextDirectionHeuristicLocale.INSTANCE;\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text_4) {\n        var Canvas = android.graphics.Canvas;\n        var Paint = android.graphics.Paint;\n        var CharacterStyle = android.text.style.CharacterStyle;\n        var MetricAffectingSpan = android.text.style.MetricAffectingSpan;\n        var ReplacementSpan = android.text.style.ReplacementSpan;\n        var Log = android.util.Log;\n        var Spanned = android.text.Spanned;\n        var SpanSet = android.text.SpanSet;\n        var TextPaint = android.text.TextPaint;\n        var TextUtils = android.text.TextUtils;\n        var Layout = android.text.Layout;\n        window.addEventListener('AndroidUILoadFinish', () => {\n            eval('Layout = android.text.Layout;');\n        });\n        class TextLine {\n            constructor() {\n                this.mStart = 0;\n                this.mLen = 0;\n                this.mDir = 0;\n                this.mWorkPaint = new TextPaint();\n                this.mMetricAffectingSpanSpanSet = new SpanSet(MetricAffectingSpan.type);\n                this.mCharacterStyleSpanSet = new SpanSet(CharacterStyle.type);\n                this.mReplacementSpanSpanSet = new SpanSet(ReplacementSpan.type);\n            }\n            static obtain() {\n                let tl;\n                {\n                    for (let i = TextLine.sCached.length; --i >= 0;) {\n                        if (TextLine.sCached[i] != null) {\n                            tl = TextLine.sCached[i];\n                            TextLine.sCached[i] = null;\n                            return tl;\n                        }\n                    }\n                }\n                tl = new TextLine();\n                if (TextLine.DEBUG) {\n                    Log.v(\"TLINE\", \"new: \" + tl);\n                }\n                return tl;\n            }\n            static recycle(tl) {\n                tl.mText = null;\n                tl.mPaint = null;\n                tl.mDirections = null;\n                tl.mMetricAffectingSpanSpanSet.recycle();\n                tl.mCharacterStyleSpanSet.recycle();\n                tl.mReplacementSpanSpanSet.recycle();\n                {\n                    for (let i = 0; i < TextLine.sCached.length; ++i) {\n                        if (TextLine.sCached[i] == null) {\n                            TextLine.sCached[i] = tl;\n                            break;\n                        }\n                    }\n                }\n                return null;\n            }\n            set(paint, text, start, limit, dir, directions, hasTabs, tabStops) {\n                this.mPaint = paint;\n                this.mText = text;\n                this.mStart = start;\n                this.mLen = limit - start;\n                this.mDir = dir;\n                this.mDirections = directions;\n                if (this.mDirections == null) {\n                    throw Error(`new IllegalArgumentException(\"Directions cannot be null\")`);\n                }\n                this.mHasTabs = hasTabs;\n                this.mSpanned = null;\n                let hasReplacement = false;\n                if (Spanned.isImplements(text)) {\n                    this.mSpanned = text;\n                    this.mReplacementSpanSpanSet.init(this.mSpanned, start, limit);\n                    hasReplacement = this.mReplacementSpanSpanSet.numberOfSpans > 0;\n                }\n                this.mCharsValid = hasReplacement || hasTabs || directions != Layout.DIRS_ALL_LEFT_TO_RIGHT;\n                if (this.mCharsValid) {\n                    this.mChars = text;\n                    if (hasReplacement) {\n                        let chars = this.mChars.split('');\n                        for (let i = start, inext; i < limit; i = inext) {\n                            inext = this.mReplacementSpanSpanSet.getNextTransition(i, limit);\n                            if (this.mReplacementSpanSpanSet.hasSpansIntersecting(i, inext)) {\n                                chars[i - start] = '￼';\n                                for (let j = i - start + 1, e = inext - start; j < e; ++j) {\n                                    chars[j] = '﻿';\n                                }\n                            }\n                        }\n                        this.mChars = chars.join('');\n                    }\n                }\n                this.mTabs = tabStops;\n            }\n            draw(c, x, top, y, bottom) {\n                if (!this.mHasTabs) {\n                    if (this.mDirections == Layout.DIRS_ALL_LEFT_TO_RIGHT) {\n                        this.drawRun(c, 0, this.mLen, false, x, top, y, bottom, false);\n                        return;\n                    }\n                    if (this.mDirections == Layout.DIRS_ALL_RIGHT_TO_LEFT) {\n                        this.drawRun(c, 0, this.mLen, true, x, top, y, bottom, false);\n                        return;\n                    }\n                }\n                let h = 0;\n                let runs = this.mDirections.mDirections;\n                let emojiRect = null;\n                let lastRunIndex = runs.length - 2;\n                for (let i = 0; i < runs.length; i += 2) {\n                    let runStart = runs[i];\n                    let runLimit = runStart + (runs[i + 1] & Layout.RUN_LENGTH_MASK);\n                    if (runLimit > this.mLen) {\n                        runLimit = this.mLen;\n                    }\n                    let runIsRtl = (runs[i + 1] & Layout.RUN_RTL_FLAG) != 0;\n                    let segstart = runStart;\n                    for (let j = this.mHasTabs ? runStart : runLimit; j <= runLimit; j++) {\n                        let codept = 0;\n                        if (this.mHasTabs && j < runLimit) {\n                            codept = this.mChars.codePointAt(j);\n                            if (codept >= 0xd800 && codept < 0xdc00 && j + 1 < runLimit) {\n                                codept = this.mChars.codePointAt(j);\n                                if (codept > 0xffff) {\n                                    ++j;\n                                    continue;\n                                }\n                            }\n                        }\n                        if (j == runLimit || codept == '\\t'.codePointAt(0)) {\n                            h += this.drawRun(c, segstart, j, runIsRtl, x + h, top, y, bottom, i != lastRunIndex || j != this.mLen);\n                            if (codept == '\\t'.codePointAt(0)) {\n                                h = this.mDir * this.nextTab(h * this.mDir);\n                            }\n                            segstart = j + 1;\n                        }\n                    }\n                }\n            }\n            metrics(fmi) {\n                return this.measure(this.mLen, false, fmi);\n            }\n            measure(offset, trailing, fmi) {\n                let target = trailing ? offset - 1 : offset;\n                if (target < 0) {\n                    return 0;\n                }\n                let h = 0;\n                if (!this.mHasTabs) {\n                    if (this.mDirections == Layout.DIRS_ALL_LEFT_TO_RIGHT) {\n                        return this.measureRun(0, offset, this.mLen, false, fmi);\n                    }\n                    if (this.mDirections == Layout.DIRS_ALL_RIGHT_TO_LEFT) {\n                        return this.measureRun(0, offset, this.mLen, true, fmi);\n                    }\n                }\n                let chars = this.mChars;\n                let runs = this.mDirections.mDirections;\n                for (let i = 0; i < runs.length; i += 2) {\n                    let runStart = runs[i];\n                    let runLimit = runStart + (runs[i + 1] & Layout.RUN_LENGTH_MASK);\n                    if (runLimit > this.mLen) {\n                        runLimit = this.mLen;\n                    }\n                    let runIsRtl = (runs[i + 1] & Layout.RUN_RTL_FLAG) != 0;\n                    let segstart = runStart;\n                    for (let j = this.mHasTabs ? runStart : runLimit; j <= runLimit; j++) {\n                        let codept = 0;\n                        if (this.mHasTabs && j < runLimit) {\n                            codept = chars.codePointAt(j);\n                            if (codept >= 0xd800 && codept < 0xdc00 && j + 1 < runLimit) {\n                                codept = chars.codePointAt(j);\n                                if (codept > 0xffff) {\n                                    ++j;\n                                    continue;\n                                }\n                            }\n                        }\n                        if (j == runLimit || codept == '\\t'.codePointAt(0)) {\n                            let inSegment = target >= segstart && target < j;\n                            let advance = (this.mDir == Layout.DIR_RIGHT_TO_LEFT) == runIsRtl;\n                            if (inSegment && advance) {\n                                return h += this.measureRun(segstart, offset, j, runIsRtl, fmi);\n                            }\n                            let w = this.measureRun(segstart, j, j, runIsRtl, fmi);\n                            h += advance ? w : -w;\n                            if (inSegment) {\n                                return h += this.measureRun(segstart, offset, j, runIsRtl, null);\n                            }\n                            if (codept == '\\t'.codePointAt(0)) {\n                                if (offset == j) {\n                                    return h;\n                                }\n                                h = this.mDir * this.nextTab(h * this.mDir);\n                                if (target == j) {\n                                    return h;\n                                }\n                            }\n                            segstart = j + 1;\n                        }\n                    }\n                }\n                return h;\n            }\n            drawRun(c, start, limit, runIsRtl, x, top, y, bottom, needWidth) {\n                if ((this.mDir == Layout.DIR_LEFT_TO_RIGHT) == runIsRtl) {\n                    let w = -this.measureRun(start, limit, limit, runIsRtl, null);\n                    this.handleRun(start, limit, limit, runIsRtl, c, x + w, top, y, bottom, null, false);\n                    return w;\n                }\n                return this.handleRun(start, limit, limit, runIsRtl, c, x, top, y, bottom, null, needWidth);\n            }\n            measureRun(start, offset, limit, runIsRtl, fmi) {\n                return this.handleRun(start, offset, limit, runIsRtl, null, 0, 0, 0, 0, fmi, true);\n            }\n            getOffsetToLeftRightOf(cursor, toLeft) {\n                let lineStart = 0;\n                let lineEnd = this.mLen;\n                let paraIsRtl = this.mDir == -1;\n                let runs = this.mDirections.mDirections;\n                let runIndex, runLevel = 0, runStart = lineStart, runLimit = lineEnd, newCaret = -1;\n                let trailing = false;\n                if (cursor == lineStart) {\n                    runIndex = -2;\n                }\n                else if (cursor == lineEnd) {\n                    runIndex = runs.length;\n                }\n                else {\n                    for (runIndex = 0; runIndex < runs.length; runIndex += 2) {\n                        runStart = lineStart + runs[runIndex];\n                        if (cursor >= runStart) {\n                            runLimit = runStart + (runs[runIndex + 1] & Layout.RUN_LENGTH_MASK);\n                            if (runLimit > lineEnd) {\n                                runLimit = lineEnd;\n                            }\n                            if (cursor < runLimit) {\n                                runLevel = (runs[runIndex + 1] >>> Layout.RUN_LEVEL_SHIFT) & Layout.RUN_LEVEL_MASK;\n                                if (cursor == runStart) {\n                                    let prevRunIndex, prevRunLevel, prevRunStart, prevRunLimit;\n                                    let pos = cursor - 1;\n                                    for (prevRunIndex = 0; prevRunIndex < runs.length; prevRunIndex += 2) {\n                                        prevRunStart = lineStart + runs[prevRunIndex];\n                                        if (pos >= prevRunStart) {\n                                            prevRunLimit = prevRunStart + (runs[prevRunIndex + 1] & Layout.RUN_LENGTH_MASK);\n                                            if (prevRunLimit > lineEnd) {\n                                                prevRunLimit = lineEnd;\n                                            }\n                                            if (pos < prevRunLimit) {\n                                                prevRunLevel = (runs[prevRunIndex + 1] >>> Layout.RUN_LEVEL_SHIFT) & Layout.RUN_LEVEL_MASK;\n                                                if (prevRunLevel < runLevel) {\n                                                    runIndex = prevRunIndex;\n                                                    runLevel = prevRunLevel;\n                                                    runStart = prevRunStart;\n                                                    runLimit = prevRunLimit;\n                                                    trailing = true;\n                                                    break;\n                                                }\n                                            }\n                                        }\n                                    }\n                                }\n                                break;\n                            }\n                        }\n                    }\n                    if (runIndex != runs.length) {\n                        let runIsRtl = (runLevel & 0x1) != 0;\n                        let advance = toLeft == runIsRtl;\n                        if (cursor != (advance ? runLimit : runStart) || advance != trailing) {\n                            newCaret = this.getOffsetBeforeAfter(runIndex, runStart, runLimit, runIsRtl, cursor, advance);\n                            if (newCaret != (advance ? runLimit : runStart)) {\n                                return newCaret;\n                            }\n                        }\n                    }\n                }\n                while (true) {\n                    let advance = toLeft == paraIsRtl;\n                    let otherRunIndex = runIndex + (advance ? 2 : -2);\n                    if (otherRunIndex >= 0 && otherRunIndex < runs.length) {\n                        let otherRunStart = lineStart + runs[otherRunIndex];\n                        let otherRunLimit = otherRunStart + (runs[otherRunIndex + 1] & Layout.RUN_LENGTH_MASK);\n                        if (otherRunLimit > lineEnd) {\n                            otherRunLimit = lineEnd;\n                        }\n                        let otherRunLevel = (runs[otherRunIndex + 1] >>> Layout.RUN_LEVEL_SHIFT) & Layout.RUN_LEVEL_MASK;\n                        let otherRunIsRtl = (otherRunLevel & 1) != 0;\n                        advance = toLeft == otherRunIsRtl;\n                        if (newCaret == -1) {\n                            newCaret = this.getOffsetBeforeAfter(otherRunIndex, otherRunStart, otherRunLimit, otherRunIsRtl, advance ? otherRunStart : otherRunLimit, advance);\n                            if (newCaret == (advance ? otherRunLimit : otherRunStart)) {\n                                runIndex = otherRunIndex;\n                                runLevel = otherRunLevel;\n                                continue;\n                            }\n                            break;\n                        }\n                        if (otherRunLevel < runLevel) {\n                            newCaret = advance ? otherRunStart : otherRunLimit;\n                        }\n                        break;\n                    }\n                    if (newCaret == -1) {\n                        newCaret = advance ? this.mLen + 1 : -1;\n                        break;\n                    }\n                    if (newCaret <= lineEnd) {\n                        newCaret = advance ? lineEnd : lineStart;\n                    }\n                    break;\n                }\n                return newCaret;\n            }\n            getOffsetBeforeAfter(runIndex, runStart, runLimit, runIsRtl, offset, after) {\n                if (runIndex < 0 || offset == (after ? this.mLen : 0)) {\n                    if (after) {\n                        return TextUtils.getOffsetAfter(this.mText, offset + this.mStart) - this.mStart;\n                    }\n                    return TextUtils.getOffsetBefore(this.mText, offset + this.mStart) - this.mStart;\n                }\n                let wp = this.mWorkPaint;\n                wp.set(this.mPaint);\n                let spanStart = runStart;\n                let spanLimit;\n                if (this.mSpanned == null) {\n                    spanLimit = runLimit;\n                }\n                else {\n                    let target = after ? offset + 1 : offset;\n                    let limit = this.mStart + runLimit;\n                    while (true) {\n                        spanLimit = this.mSpanned.nextSpanTransition(this.mStart + spanStart, limit, MetricAffectingSpan.type) - this.mStart;\n                        if (spanLimit >= target) {\n                            break;\n                        }\n                        spanStart = spanLimit;\n                    }\n                    let spans = this.mSpanned.getSpans(this.mStart + spanStart, this.mStart + spanLimit, MetricAffectingSpan.type);\n                    spans = TextUtils.removeEmptySpans(spans, this.mSpanned, MetricAffectingSpan.type);\n                    if (spans.length > 0) {\n                        let replacement = null;\n                        for (let j = 0; j < spans.length; j++) {\n                            let span = spans[j];\n                            if (span instanceof ReplacementSpan) {\n                                replacement = span;\n                            }\n                            else {\n                                span.updateMeasureState(wp);\n                            }\n                        }\n                        if (replacement != null) {\n                            return after ? spanLimit : spanStart;\n                        }\n                    }\n                }\n                let flags = runIsRtl ? Paint.DIRECTION_RTL : Paint.DIRECTION_LTR;\n                let cursorOpt = after ? Paint.CURSOR_AFTER : Paint.CURSOR_BEFORE;\n                if (this.mCharsValid) {\n                    return wp.getTextRunCursor_len(this.mChars.toString(), spanStart, spanLimit - spanStart, flags, offset, cursorOpt);\n                }\n                else {\n                    return wp.getTextRunCursor_end(this.mText.toString(), this.mStart + spanStart, this.mStart + spanLimit, flags, this.mStart + offset, cursorOpt) - this.mStart;\n                }\n            }\n            static expandMetricsFromPaint(fmi, wp) {\n                const previousTop = fmi.top;\n                const previousAscent = fmi.ascent;\n                const previousDescent = fmi.descent;\n                const previousBottom = fmi.bottom;\n                const previousLeading = fmi.leading;\n                wp.getFontMetricsInt(fmi);\n                TextLine.updateMetrics(fmi, previousTop, previousAscent, previousDescent, previousBottom, previousLeading);\n            }\n            static updateMetrics(fmi, previousTop, previousAscent, previousDescent, previousBottom, previousLeading) {\n                fmi.top = Math.min(fmi.top, previousTop);\n                fmi.ascent = Math.min(fmi.ascent, previousAscent);\n                fmi.descent = Math.max(fmi.descent, previousDescent);\n                fmi.bottom = Math.max(fmi.bottom, previousBottom);\n                fmi.leading = Math.max(fmi.leading, previousLeading);\n            }\n            handleText(wp, start, end, contextStart, contextEnd, runIsRtl, c, x, top, y, bottom, fmi, needWidth) {\n                if (fmi != null) {\n                    TextLine.expandMetricsFromPaint(fmi, wp);\n                }\n                let runLen = end - start;\n                if (runLen == 0) {\n                    return 0;\n                }\n                let ret = 0;\n                let contextLen = contextEnd - contextStart;\n                if (needWidth || (c != null && (wp.bgColor != 0 || wp.underlineColor != 0 || runIsRtl))) {\n                    let flags = runIsRtl ? Paint.DIRECTION_RTL : Paint.DIRECTION_LTR;\n                    if (this.mCharsValid) {\n                        ret = wp.getTextRunAdvances_count(this.mChars.toString(), start, runLen, contextStart, contextLen, flags, null, 0);\n                    }\n                    else {\n                        let delta = this.mStart;\n                        ret = wp.getTextRunAdvances_end(this.mText.toString(), delta + start, delta + end, delta + contextStart, delta + contextEnd, flags, null, 0);\n                    }\n                }\n                if (c != null) {\n                    if (runIsRtl) {\n                        x -= ret;\n                    }\n                    if (wp.bgColor != 0) {\n                        let previousColor = wp.getColor();\n                        let previousStyle = wp.getStyle();\n                        wp.setColor(wp.bgColor);\n                        wp.setStyle(Paint.Style.FILL);\n                        c.drawRect(x, top, x + ret, bottom, wp);\n                        wp.setStyle(previousStyle);\n                        wp.setColor(previousColor);\n                    }\n                    if (wp.underlineColor != 0) {\n                        let underlineTop = y + wp.baselineShift + (1.0 / 9.0) * wp.getTextSize();\n                        let previousColor = wp.getColor();\n                        let previousStyle = wp.getStyle();\n                        let previousAntiAlias = wp.isAntiAlias();\n                        wp.setStyle(Paint.Style.FILL);\n                        wp.setAntiAlias(true);\n                        wp.setColor(wp.underlineColor);\n                        c.drawRect(x, underlineTop, x + ret, underlineTop + wp.underlineThickness, wp);\n                        wp.setStyle(previousStyle);\n                        wp.setColor(previousColor);\n                        wp.setAntiAlias(previousAntiAlias);\n                    }\n                    this.drawTextRun(c, wp, start, end, contextStart, contextEnd, runIsRtl, x, y + wp.baselineShift);\n                }\n                return runIsRtl ? -ret : ret;\n            }\n            handleReplacement(replacement, wp, start, limit, runIsRtl, c, x, top, y, bottom, fmi, needWidth) {\n                let ret = 0;\n                let textStart = this.mStart + start;\n                let textLimit = this.mStart + limit;\n                if (needWidth || (c != null && runIsRtl)) {\n                    let previousTop = 0;\n                    let previousAscent = 0;\n                    let previousDescent = 0;\n                    let previousBottom = 0;\n                    let previousLeading = 0;\n                    let needUpdateMetrics = (fmi != null);\n                    if (needUpdateMetrics) {\n                        previousTop = fmi.top;\n                        previousAscent = fmi.ascent;\n                        previousDescent = fmi.descent;\n                        previousBottom = fmi.bottom;\n                        previousLeading = fmi.leading;\n                    }\n                    ret = replacement.getSize(wp, this.mText, textStart, textLimit, fmi);\n                    if (needUpdateMetrics) {\n                        TextLine.updateMetrics(fmi, previousTop, previousAscent, previousDescent, previousBottom, previousLeading);\n                    }\n                }\n                if (c != null) {\n                    if (runIsRtl) {\n                        x -= ret;\n                    }\n                    replacement.draw(c, this.mText, textStart, textLimit, x, top, y, bottom, wp);\n                }\n                return runIsRtl ? -ret : ret;\n            }\n            handleRun(start, measureLimit, limit, runIsRtl, c, x, top, y, bottom, fmi, needWidth) {\n                if (start == measureLimit) {\n                    let wp = this.mWorkPaint;\n                    wp.set(this.mPaint);\n                    if (fmi != null) {\n                        TextLine.expandMetricsFromPaint(fmi, wp);\n                    }\n                    return 0;\n                }\n                if (this.mSpanned == null) {\n                    let wp = this.mWorkPaint;\n                    wp.set(this.mPaint);\n                    const mlimit = measureLimit;\n                    return this.handleText(wp, start, mlimit, start, limit, runIsRtl, c, x, top, y, bottom, fmi, needWidth || mlimit < measureLimit);\n                }\n                this.mMetricAffectingSpanSpanSet.init(this.mSpanned, this.mStart + start, this.mStart + limit);\n                this.mCharacterStyleSpanSet.init(this.mSpanned, this.mStart + start, this.mStart + limit);\n                const originalX = x;\n                for (let i = start, inext; i < measureLimit; i = inext) {\n                    let wp = this.mWorkPaint;\n                    wp.set(this.mPaint);\n                    inext = this.mMetricAffectingSpanSpanSet.getNextTransition(this.mStart + i, this.mStart + limit) - this.mStart;\n                    let mlimit = Math.min(inext, measureLimit);\n                    let replacement = null;\n                    for (let j = 0; j < this.mMetricAffectingSpanSpanSet.numberOfSpans; j++) {\n                        if ((this.mMetricAffectingSpanSpanSet.spanStarts[j] >= this.mStart + mlimit) || (this.mMetricAffectingSpanSpanSet.spanEnds[j] <= this.mStart + i))\n                            continue;\n                        let span = this.mMetricAffectingSpanSpanSet.spans[j];\n                        if (span instanceof ReplacementSpan) {\n                            replacement = span;\n                        }\n                        else {\n                            span.updateDrawState(wp);\n                        }\n                    }\n                    if (replacement != null) {\n                        x += this.handleReplacement(replacement, wp, i, mlimit, runIsRtl, c, x, top, y, bottom, fmi, needWidth || mlimit < measureLimit);\n                        continue;\n                    }\n                    for (let j = i, jnext; j < mlimit; j = jnext) {\n                        jnext = this.mCharacterStyleSpanSet.getNextTransition(this.mStart + j, this.mStart + mlimit) - this.mStart;\n                        wp.set(this.mPaint);\n                        for (let k = 0; k < this.mCharacterStyleSpanSet.numberOfSpans; k++) {\n                            if ((this.mCharacterStyleSpanSet.spanStarts[k] >= this.mStart + jnext) || (this.mCharacterStyleSpanSet.spanEnds[k] <= this.mStart + j))\n                                continue;\n                            let span = this.mCharacterStyleSpanSet.spans[k];\n                            span.updateDrawState(wp);\n                        }\n                        x += this.handleText(wp, j, jnext, i, inext, runIsRtl, c, x, top, y, bottom, fmi, needWidth || jnext < measureLimit);\n                    }\n                }\n                return x - originalX;\n            }\n            drawTextRun(c, wp, start, end, contextStart, contextEnd, runIsRtl, x, y) {\n                let flags = runIsRtl ? Canvas.DIRECTION_RTL : Canvas.DIRECTION_LTR;\n                if (this.mCharsValid) {\n                    let count = end - start;\n                    let contextCount = contextEnd - contextStart;\n                    c.drawTextRun_count(this.mChars.toString(), start, count, contextStart, contextCount, x, y, flags, wp);\n                }\n                else {\n                    let delta = this.mStart;\n                    c.drawTextRun_end(this.mText.toString(), delta + start, delta + end, delta + contextStart, delta + contextEnd, x, y, flags, wp);\n                }\n            }\n            ascent(pos) {\n                if (this.mSpanned == null) {\n                    return this.mPaint.ascent();\n                }\n                pos += this.mStart;\n                let spans = this.mSpanned.getSpans(pos, pos + 1, MetricAffectingSpan.type);\n                if (spans.length == 0) {\n                    return this.mPaint.ascent();\n                }\n                let wp = this.mWorkPaint;\n                wp.set(this.mPaint);\n                for (let span of spans) {\n                    span.updateMeasureState(wp);\n                }\n                return wp.ascent();\n            }\n            nextTab(h) {\n                if (this.mTabs != null) {\n                    return this.mTabs.nextTab(h);\n                }\n                return Layout.TabStops.nextDefaultStop(h, TextLine.TAB_INCREMENT);\n            }\n        }\n        TextLine.DEBUG = false;\n        TextLine.sCached = new Array(3);\n        TextLine.TAB_INCREMENT = 20;\n        text_4.TextLine = TextLine;\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text_5) {\n        var Rect = android.graphics.Rect;\n        var LeadingMarginSpan = android.text.style.LeadingMarginSpan;\n        var LeadingMarginSpan2 = android.text.style.LeadingMarginSpan.LeadingMarginSpan2;\n        var LineBackgroundSpan = android.text.style.LineBackgroundSpan;\n        var ParagraphStyle = android.text.style.ParagraphStyle;\n        var ReplacementSpan = android.text.style.ReplacementSpan;\n        var TabStopSpan = android.text.style.TabStopSpan;\n        var Arrays = java.util.Arrays;\n        var Float = java.lang.Float;\n        var System = java.lang.System;\n        var MeasuredText = android.text.MeasuredText;\n        var Spanned = android.text.Spanned;\n        var SpanSet = android.text.SpanSet;\n        var TextDirectionHeuristics = android.text.TextDirectionHeuristics;\n        var TextLine = android.text.TextLine;\n        var TextPaint = android.text.TextPaint;\n        var TextUtils = android.text.TextUtils;\n        window.addEventListener('AndroidUILoadFinish', () => {\n            eval(`TextUtils = android.text.TextUtils;\n              MeasuredText = android.text.MeasuredText;\n              `);\n        });\n        class Layout {\n            constructor(text, paint, width, align, textDir = TextDirectionHeuristics.FIRSTSTRONG_LTR, spacingMult = 1, spacingAdd = 0) {\n                this.mWidth = 0;\n                this.mAlignment = Layout.Alignment.ALIGN_NORMAL;\n                this.mSpacingMult = 0;\n                this.mSpacingAdd = 0;\n                if (width < 0)\n                    throw Error(`new IllegalArgumentException(\"Layout: \" + width + \" < 0\")`);\n                if (paint != null) {\n                    paint.bgColor = 0;\n                    paint.baselineShift = 0;\n                }\n                this.mText = text;\n                this.mPaint = paint;\n                this.mWorkPaint = new TextPaint();\n                this.mWidth = width;\n                this.mAlignment = align;\n                this.mSpacingMult = spacingMult;\n                this.mSpacingAdd = spacingAdd;\n                this.mSpannedText = Spanned.isImplements(text);\n                this.mTextDir = textDir;\n            }\n            static getDesiredWidth(...args) {\n                if (args.length == 2)\n                    return Layout.getDesiredWidth_2(...args);\n                if (args.length == 4)\n                    return Layout.getDesiredWidth_4(...args);\n            }\n            static getDesiredWidth_2(source, paint) {\n                return Layout.getDesiredWidth(source, 0, source.length, paint);\n            }\n            static getDesiredWidth_4(source, start, end, paint) {\n                let need = 0;\n                let next;\n                for (let i = start; i <= end; i = next) {\n                    next = source.substring(0, end).indexOf('\\n', i);\n                    if (next < 0)\n                        next = end;\n                    let w = Layout.measurePara(paint, source, i, next);\n                    if (w > need)\n                        need = w;\n                    next++;\n                }\n                return need;\n            }\n            replaceWith(text, paint, width, align, spacingmult, spacingadd) {\n                if (width < 0) {\n                    throw Error(`new IllegalArgumentException(\"Layout: \" + width + \" < 0\")`);\n                }\n                this.mText = text;\n                this.mPaint = paint;\n                this.mWidth = width;\n                this.mAlignment = align;\n                this.mSpacingMult = spacingmult;\n                this.mSpacingAdd = spacingadd;\n                this.mSpannedText = Spanned.isImplements(text);\n            }\n            draw(canvas, highlight = null, highlightPaint = null, cursorOffsetVertical = 0) {\n                const lineRange = this.getLineRangeForDraw(canvas);\n                let firstLine = TextUtils.unpackRangeStartFromLong(lineRange);\n                let lastLine = TextUtils.unpackRangeEndFromLong(lineRange);\n                if (lastLine < 0)\n                    return;\n                this.drawBackground(canvas, highlight, highlightPaint, cursorOffsetVertical, firstLine, lastLine);\n                this.drawText(canvas, firstLine, lastLine);\n            }\n            drawText(canvas, firstLine, lastLine) {\n                let previousLineBottom = this.getLineTop(firstLine);\n                let previousLineEnd = this.getLineStart(firstLine);\n                let spans = Layout.NO_PARA_SPANS;\n                let spanEnd = 0;\n                let paint = this.mPaint;\n                let buf = this.mText;\n                let paraAlign = this.mAlignment;\n                let tabStops = null;\n                let tabStopsIsInitialized = false;\n                let tl = TextLine.obtain();\n                for (let i = firstLine; i <= lastLine; i++) {\n                    let start = previousLineEnd;\n                    previousLineEnd = this.getLineStart(i + 1);\n                    let end = this.getLineVisibleEnd(i, start, previousLineEnd);\n                    let ltop = previousLineBottom;\n                    let lbottom = this.getLineTop(i + 1);\n                    previousLineBottom = lbottom;\n                    let lbaseline = lbottom - this.getLineDescent(i);\n                    let dir = this.getParagraphDirection(i);\n                    let left = 0;\n                    let right = this.mWidth;\n                    if (this.mSpannedText) {\n                        let sp = buf;\n                        let textLength = buf.length;\n                        let isFirstParaLine = (start == 0 || buf.charAt(start - 1) == '\\n');\n                        if (start >= spanEnd && (i == firstLine || isFirstParaLine)) {\n                            spanEnd = sp.nextSpanTransition(start, textLength, ParagraphStyle.type);\n                            spans = Layout.getParagraphSpans(sp, start, spanEnd, ParagraphStyle.type);\n                            paraAlign = this.mAlignment;\n                            tabStopsIsInitialized = false;\n                        }\n                        const length = spans.length;\n                        for (let n = 0; n < length; n++) {\n                            if (LeadingMarginSpan.isImpl(spans[n])) {\n                                let margin = spans[n];\n                                let useFirstLineMargin = isFirstParaLine;\n                                if (LeadingMarginSpan2.isImpl(margin)) {\n                                    let count = margin.getLeadingMarginLineCount();\n                                    let startLine = this.getLineForOffset(sp.getSpanStart(margin));\n                                    useFirstLineMargin = i < startLine + count;\n                                }\n                                if (dir == Layout.DIR_RIGHT_TO_LEFT) {\n                                    margin.drawLeadingMargin(canvas, paint, right, dir, ltop, lbaseline, lbottom, buf, start, end, isFirstParaLine, this);\n                                    right -= margin.getLeadingMargin(useFirstLineMargin);\n                                }\n                                else {\n                                    margin.drawLeadingMargin(canvas, paint, left, dir, ltop, lbaseline, lbottom, buf, start, end, isFirstParaLine, this);\n                                    left += margin.getLeadingMargin(useFirstLineMargin);\n                                }\n                            }\n                        }\n                    }\n                    let hasTabOrEmoji = this.getLineContainsTab(i);\n                    if (hasTabOrEmoji && !tabStopsIsInitialized) {\n                        if (tabStops == null) {\n                            tabStops = new Layout.TabStops(Layout.TAB_INCREMENT, spans);\n                        }\n                        else {\n                            tabStops.reset(Layout.TAB_INCREMENT, spans);\n                        }\n                        tabStopsIsInitialized = true;\n                    }\n                    let align = paraAlign;\n                    if (align == Layout.Alignment.ALIGN_LEFT) {\n                        align = (dir == Layout.DIR_LEFT_TO_RIGHT) ? Layout.Alignment.ALIGN_NORMAL : Layout.Alignment.ALIGN_OPPOSITE;\n                    }\n                    else if (align == Layout.Alignment.ALIGN_RIGHT) {\n                        align = (dir == Layout.DIR_LEFT_TO_RIGHT) ? Layout.Alignment.ALIGN_OPPOSITE : Layout.Alignment.ALIGN_NORMAL;\n                    }\n                    let x;\n                    if (align == Layout.Alignment.ALIGN_NORMAL) {\n                        if (dir == Layout.DIR_LEFT_TO_RIGHT) {\n                            x = left;\n                        }\n                        else {\n                            x = right;\n                        }\n                    }\n                    else {\n                        let max = Math.floor(this.getLineExtent(i, tabStops, false));\n                        if (align == Layout.Alignment.ALIGN_OPPOSITE) {\n                            if (dir == Layout.DIR_LEFT_TO_RIGHT) {\n                                x = right - max;\n                            }\n                            else {\n                                x = left - max;\n                            }\n                        }\n                        else {\n                            max = max & ~1;\n                            x = (right + left - max) >> 1;\n                        }\n                    }\n                    let directions = this.getLineDirections(i);\n                    if (directions == Layout.DIRS_ALL_LEFT_TO_RIGHT && !this.mSpannedText && !hasTabOrEmoji) {\n                        canvas.drawText_end(buf.toString(), start, end, x, lbaseline, paint);\n                    }\n                    else {\n                        tl.set(paint, buf, start, end, dir, directions, hasTabOrEmoji, tabStops);\n                        tl.draw(canvas, x, ltop, lbaseline, lbottom);\n                    }\n                }\n                TextLine.recycle(tl);\n            }\n            drawBackground(canvas, highlight, highlightPaint, cursorOffsetVertical, firstLine, lastLine) {\n                if (this.mSpannedText) {\n                    if (this.mLineBackgroundSpans == null) {\n                        this.mLineBackgroundSpans = new SpanSet(LineBackgroundSpan.type);\n                    }\n                    let buffer = this.mText;\n                    let textLength = buffer.length;\n                    this.mLineBackgroundSpans.init(buffer, 0, textLength);\n                    if (this.mLineBackgroundSpans.numberOfSpans > 0) {\n                        let previousLineBottom = this.getLineTop(firstLine);\n                        let previousLineEnd = this.getLineStart(firstLine);\n                        let spans = Layout.NO_PARA_SPANS;\n                        let spansLength = 0;\n                        let paint = this.mPaint;\n                        let spanEnd = 0;\n                        const width = this.mWidth;\n                        for (let i = firstLine; i <= lastLine; i++) {\n                            let start = previousLineEnd;\n                            let end = this.getLineStart(i + 1);\n                            previousLineEnd = end;\n                            let ltop = previousLineBottom;\n                            let lbottom = this.getLineTop(i + 1);\n                            previousLineBottom = lbottom;\n                            let lbaseline = lbottom - this.getLineDescent(i);\n                            if (start >= spanEnd) {\n                                spanEnd = this.mLineBackgroundSpans.getNextTransition(start, textLength);\n                                spansLength = 0;\n                                if (start != end || start == 0) {\n                                    for (let j = 0; j < this.mLineBackgroundSpans.numberOfSpans; j++) {\n                                        if (this.mLineBackgroundSpans.spanStarts[j] >= end || this.mLineBackgroundSpans.spanEnds[j] <= start)\n                                            continue;\n                                        if (spansLength == spans.length) {\n                                            let newSize = (2 * spansLength);\n                                            let newSpans = new Array(newSize);\n                                            System.arraycopy(spans, 0, newSpans, 0, spansLength);\n                                            spans = newSpans;\n                                        }\n                                        spans[spansLength++] = this.mLineBackgroundSpans.spans[j];\n                                    }\n                                }\n                            }\n                            for (let n = 0; n < spansLength; n++) {\n                                let lineBackgroundSpan = spans[n];\n                                lineBackgroundSpan.drawBackground(canvas, paint, 0, width, ltop, lbaseline, lbottom, buffer, start, end, i);\n                            }\n                        }\n                    }\n                    this.mLineBackgroundSpans.recycle();\n                }\n                if (highlight != null) {\n                    if (cursorOffsetVertical != 0)\n                        canvas.translate(0, cursorOffsetVertical);\n                    canvas.drawPath(highlight, highlightPaint);\n                    if (cursorOffsetVertical != 0)\n                        canvas.translate(0, -cursorOffsetVertical);\n                }\n            }\n            getLineRangeForDraw(canvas) {\n                let dtop, dbottom;\n                {\n                    if (!canvas.getClipBounds(Layout.sTempRect)) {\n                        return TextUtils.packRangeInLong(0, -1);\n                    }\n                    dtop = Layout.sTempRect.top;\n                    dbottom = Layout.sTempRect.bottom;\n                }\n                const top = Math.max(dtop, 0);\n                const bottom = Math.min(this.getLineTop(this.getLineCount()), dbottom);\n                if (top >= bottom)\n                    return TextUtils.packRangeInLong(0, -1);\n                return TextUtils.packRangeInLong(this.getLineForVertical(top), this.getLineForVertical(bottom));\n            }\n            getLineStartPos(line, left, right) {\n                let align = this.getParagraphAlignment(line);\n                let dir = this.getParagraphDirection(line);\n                if (align == Layout.Alignment.ALIGN_LEFT) {\n                    align = (dir == Layout.DIR_LEFT_TO_RIGHT) ? Layout.Alignment.ALIGN_NORMAL : Layout.Alignment.ALIGN_OPPOSITE;\n                }\n                else if (align == Layout.Alignment.ALIGN_RIGHT) {\n                    align = (dir == Layout.DIR_LEFT_TO_RIGHT) ? Layout.Alignment.ALIGN_OPPOSITE : Layout.Alignment.ALIGN_NORMAL;\n                }\n                let x;\n                if (align == Layout.Alignment.ALIGN_NORMAL) {\n                    if (dir == Layout.DIR_LEFT_TO_RIGHT) {\n                        x = left;\n                    }\n                    else {\n                        x = right;\n                    }\n                }\n                else {\n                    let tabStops = null;\n                    if (this.mSpannedText && this.getLineContainsTab(line)) {\n                        let spanned = this.mText;\n                        let start = this.getLineStart(line);\n                        let spanEnd = spanned.nextSpanTransition(start, spanned.length, TabStopSpan.type);\n                        let tabSpans = Layout.getParagraphSpans(spanned, start, spanEnd, TabStopSpan.type);\n                        if (tabSpans.length > 0) {\n                            tabStops = new Layout.TabStops(Layout.TAB_INCREMENT, tabSpans);\n                        }\n                    }\n                    let max = Math.floor(this.getLineExtent(line, tabStops, false));\n                    if (align == Layout.Alignment.ALIGN_OPPOSITE) {\n                        if (dir == Layout.DIR_LEFT_TO_RIGHT) {\n                            x = right - max;\n                        }\n                        else {\n                            x = left - max;\n                        }\n                    }\n                    else {\n                        max = max & ~1;\n                        x = (left + right - max) >> 1;\n                    }\n                }\n                return x;\n            }\n            getText() {\n                return this.mText;\n            }\n            getPaint() {\n                return this.mPaint;\n            }\n            getWidth() {\n                return this.mWidth;\n            }\n            getEllipsizedWidth() {\n                return this.mWidth;\n            }\n            increaseWidthTo(wid) {\n                if (wid < this.mWidth) {\n                    throw Error(`new RuntimeException(\"attempted to reduce Layout width\")`);\n                }\n                this.mWidth = wid;\n            }\n            getHeight() {\n                return this.getLineTop(this.getLineCount());\n            }\n            getAlignment() {\n                return this.mAlignment;\n            }\n            getSpacingMultiplier() {\n                return this.mSpacingMult;\n            }\n            getSpacingAdd() {\n                return this.mSpacingAdd;\n            }\n            getTextDirectionHeuristic() {\n                return this.mTextDir;\n            }\n            getLineBounds(line, bounds) {\n                if (bounds != null) {\n                    bounds.left = 0;\n                    bounds.top = this.getLineTop(line);\n                    bounds.right = this.mWidth;\n                    bounds.bottom = this.getLineTop(line + 1);\n                }\n                return this.getLineBaseline(line);\n            }\n            isLevelBoundary(offset) {\n                let line = this.getLineForOffset(offset);\n                let dirs = this.getLineDirections(line);\n                if (dirs == Layout.DIRS_ALL_LEFT_TO_RIGHT || dirs == Layout.DIRS_ALL_RIGHT_TO_LEFT) {\n                    return false;\n                }\n                let runs = dirs.mDirections;\n                let lineStart = this.getLineStart(line);\n                let lineEnd = this.getLineEnd(line);\n                if (offset == lineStart || offset == lineEnd) {\n                    let paraLevel = this.getParagraphDirection(line) == 1 ? 0 : 1;\n                    let runIndex = offset == lineStart ? 0 : runs.length - 2;\n                    return ((runs[runIndex + 1] >>> Layout.RUN_LEVEL_SHIFT) & Layout.RUN_LEVEL_MASK) != paraLevel;\n                }\n                offset -= lineStart;\n                for (let i = 0; i < runs.length; i += 2) {\n                    if (offset == runs[i]) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n            isRtlCharAt(offset) {\n                let line = this.getLineForOffset(offset);\n                let dirs = this.getLineDirections(line);\n                if (dirs == Layout.DIRS_ALL_LEFT_TO_RIGHT) {\n                    return false;\n                }\n                if (dirs == Layout.DIRS_ALL_RIGHT_TO_LEFT) {\n                    return true;\n                }\n                let runs = dirs.mDirections;\n                let lineStart = this.getLineStart(line);\n                for (let i = 0; i < runs.length; i += 2) {\n                    let start = lineStart + (runs[i] & Layout.RUN_LENGTH_MASK);\n                    if (offset >= start) {\n                        let level = (runs[i + 1] >>> Layout.RUN_LEVEL_SHIFT) & Layout.RUN_LEVEL_MASK;\n                        return ((level & 1) != 0);\n                    }\n                }\n                return false;\n            }\n            primaryIsTrailingPrevious(offset) {\n                let line = this.getLineForOffset(offset);\n                let lineStart = this.getLineStart(line);\n                let lineEnd = this.getLineEnd(line);\n                let runs = this.getLineDirections(line).mDirections;\n                let levelAt = -1;\n                for (let i = 0; i < runs.length; i += 2) {\n                    let start = lineStart + runs[i];\n                    let limit = start + (runs[i + 1] & Layout.RUN_LENGTH_MASK);\n                    if (limit > lineEnd) {\n                        limit = lineEnd;\n                    }\n                    if (offset >= start && offset < limit) {\n                        if (offset > start) {\n                            return false;\n                        }\n                        levelAt = (runs[i + 1] >>> Layout.RUN_LEVEL_SHIFT) & Layout.RUN_LEVEL_MASK;\n                        break;\n                    }\n                }\n                if (levelAt == -1) {\n                    levelAt = this.getParagraphDirection(line) == 1 ? 0 : 1;\n                }\n                let levelBefore = -1;\n                if (offset == lineStart) {\n                    levelBefore = this.getParagraphDirection(line) == 1 ? 0 : 1;\n                }\n                else {\n                    offset -= 1;\n                    for (let i = 0; i < runs.length; i += 2) {\n                        let start = lineStart + runs[i];\n                        let limit = start + (runs[i + 1] & Layout.RUN_LENGTH_MASK);\n                        if (limit > lineEnd) {\n                            limit = lineEnd;\n                        }\n                        if (offset >= start && offset < limit) {\n                            levelBefore = (runs[i + 1] >>> Layout.RUN_LEVEL_SHIFT) & Layout.RUN_LEVEL_MASK;\n                            break;\n                        }\n                    }\n                }\n                return levelBefore < levelAt;\n            }\n            getPrimaryHorizontal(offset, clamped = false) {\n                let trailing = this.primaryIsTrailingPrevious(offset);\n                return this.getHorizontal(offset, trailing, clamped);\n            }\n            getSecondaryHorizontal(offset, clamped = false) {\n                let trailing = this.primaryIsTrailingPrevious(offset);\n                return this.getHorizontal(offset, !trailing, clamped);\n            }\n            getHorizontal(offset, trailing, clamped) {\n                let line = this.getLineForOffset(offset);\n                return this.getHorizontal_4(offset, trailing, line, clamped);\n            }\n            getHorizontal_4(offset, trailing, line, clamped) {\n                let start = this.getLineStart(line);\n                let end = this.getLineEnd(line);\n                let dir = this.getParagraphDirection(line);\n                let hasTabOrEmoji = this.getLineContainsTab(line);\n                let directions = this.getLineDirections(line);\n                let tabStops = null;\n                if (hasTabOrEmoji && Spanned.isImplements(this.mText)) {\n                    let tabs = Layout.getParagraphSpans(this.mText, start, end, TabStopSpan.type);\n                    if (tabs.length > 0) {\n                        tabStops = new Layout.TabStops(Layout.TAB_INCREMENT, tabs);\n                    }\n                }\n                let tl = TextLine.obtain();\n                tl.set(this.mPaint, this.mText, start, end, dir, directions, hasTabOrEmoji, tabStops);\n                let wid = tl.measure(offset - start, trailing, null);\n                TextLine.recycle(tl);\n                if (clamped && wid > this.mWidth) {\n                    wid = this.mWidth;\n                }\n                let left = this.getParagraphLeft(line);\n                let right = this.getParagraphRight(line);\n                return this.getLineStartPos(line, left, right) + wid;\n            }\n            getLineLeft(line) {\n                let dir = this.getParagraphDirection(line);\n                let align = this.getParagraphAlignment(line);\n                if (align == Layout.Alignment.ALIGN_LEFT) {\n                    return 0;\n                }\n                else if (align == Layout.Alignment.ALIGN_NORMAL) {\n                    if (dir == Layout.DIR_RIGHT_TO_LEFT)\n                        return this.getParagraphRight(line) - this.getLineMax(line);\n                    else\n                        return 0;\n                }\n                else if (align == Layout.Alignment.ALIGN_RIGHT) {\n                    return this.mWidth - this.getLineMax(line);\n                }\n                else if (align == Layout.Alignment.ALIGN_OPPOSITE) {\n                    if (dir == Layout.DIR_RIGHT_TO_LEFT)\n                        return 0;\n                    else\n                        return this.mWidth - this.getLineMax(line);\n                }\n                else {\n                    let left = this.getParagraphLeft(line);\n                    let right = this.getParagraphRight(line);\n                    let max = (Math.floor(this.getLineMax(line))) & ~1;\n                    return left + ((right - left) - max) / 2;\n                }\n            }\n            getLineRight(line) {\n                let dir = this.getParagraphDirection(line);\n                let align = this.getParagraphAlignment(line);\n                if (align == Layout.Alignment.ALIGN_LEFT) {\n                    return this.getParagraphLeft(line) + this.getLineMax(line);\n                }\n                else if (align == Layout.Alignment.ALIGN_NORMAL) {\n                    if (dir == Layout.DIR_RIGHT_TO_LEFT)\n                        return this.mWidth;\n                    else\n                        return this.getParagraphLeft(line) + this.getLineMax(line);\n                }\n                else if (align == Layout.Alignment.ALIGN_RIGHT) {\n                    return this.mWidth;\n                }\n                else if (align == Layout.Alignment.ALIGN_OPPOSITE) {\n                    if (dir == Layout.DIR_RIGHT_TO_LEFT)\n                        return this.getLineMax(line);\n                    else\n                        return this.mWidth;\n                }\n                else {\n                    let left = this.getParagraphLeft(line);\n                    let right = this.getParagraphRight(line);\n                    let max = (Math.floor(this.getLineMax(line))) & ~1;\n                    return right - ((right - left) - max) / 2;\n                }\n            }\n            getLineMax(line) {\n                let margin = this.getParagraphLeadingMargin(line);\n                let signedExtent = this.getLineExtent(line, false);\n                return margin + signedExtent >= 0 ? signedExtent : -signedExtent;\n            }\n            getLineWidth(line) {\n                let margin = this.getParagraphLeadingMargin(line);\n                let signedExtent = this.getLineExtent(line, true);\n                return margin + signedExtent >= 0 ? signedExtent : -signedExtent;\n            }\n            getLineExtent(...args) {\n                if (args.length === 2)\n                    return this.getLineExtent_2(...args);\n                if (args.length === 3)\n                    return this.getLineExtent_3(...args);\n            }\n            getLineExtent_2(line, full) {\n                let start = this.getLineStart(line);\n                let end = full ? this.getLineEnd(line) : this.getLineVisibleEnd(line);\n                let hasTabsOrEmoji = this.getLineContainsTab(line);\n                let tabStops = null;\n                if (hasTabsOrEmoji && Spanned.isImplements(this.mText)) {\n                    let tabs = Layout.getParagraphSpans(this.mText, start, end, TabStopSpan.type);\n                    if (tabs.length > 0) {\n                        tabStops = new Layout.TabStops(Layout.TAB_INCREMENT, tabs);\n                    }\n                }\n                let directions = this.getLineDirections(line);\n                if (directions == null) {\n                    return 0;\n                }\n                let dir = this.getParagraphDirection(line);\n                let tl = TextLine.obtain();\n                tl.set(this.mPaint, this.mText, start, end, dir, directions, hasTabsOrEmoji, tabStops);\n                let width = tl.metrics(null);\n                TextLine.recycle(tl);\n                return width;\n            }\n            getLineExtent_3(line, tabStops, full) {\n                let start = this.getLineStart(line);\n                let end = full ? this.getLineEnd(line) : this.getLineVisibleEnd(line);\n                let hasTabsOrEmoji = this.getLineContainsTab(line);\n                let directions = this.getLineDirections(line);\n                let dir = this.getParagraphDirection(line);\n                let tl = TextLine.obtain();\n                tl.set(this.mPaint, this.mText, start, end, dir, directions, hasTabsOrEmoji, tabStops);\n                let width = tl.metrics(null);\n                TextLine.recycle(tl);\n                return width;\n            }\n            getLineForVertical(vertical) {\n                let high = this.getLineCount(), low = -1, guess;\n                while (high - low > 1) {\n                    guess = Math.floor((high + low) / 2);\n                    if (this.getLineTop(guess) > vertical)\n                        high = guess;\n                    else\n                        low = guess;\n                }\n                if (low < 0)\n                    return 0;\n                else\n                    return low;\n            }\n            getLineForOffset(offset) {\n                let high = this.getLineCount(), low = -1, guess;\n                while (high - low > 1) {\n                    guess = Math.floor((high + low) / 2);\n                    if (this.getLineStart(guess) > offset)\n                        high = guess;\n                    else\n                        low = guess;\n                }\n                if (low < 0)\n                    return 0;\n                else\n                    return low;\n            }\n            getOffsetForHorizontal(line, horiz) {\n                let max = this.getLineEnd(line) - 1;\n                let min = this.getLineStart(line);\n                let dirs = this.getLineDirections(line);\n                if (line == this.getLineCount() - 1)\n                    max++;\n                let best = min;\n                let bestdist = Math.abs(this.getPrimaryHorizontal(best) - horiz);\n                for (let i = 0; i < dirs.mDirections.length; i += 2) {\n                    let here = min + dirs.mDirections[i];\n                    let there = here + (dirs.mDirections[i + 1] & Layout.RUN_LENGTH_MASK);\n                    let swap = (dirs.mDirections[i + 1] & Layout.RUN_RTL_FLAG) != 0 ? -1 : 1;\n                    if (there > max)\n                        there = max;\n                    let high = there - 1 + 1, low = here + 1 - 1, guess;\n                    while (high - low > 1) {\n                        guess = Math.floor((high + low) / 2);\n                        let adguess = this.getOffsetAtStartOf(guess);\n                        if (this.getPrimaryHorizontal(adguess) * swap >= horiz * swap)\n                            high = guess;\n                        else\n                            low = guess;\n                    }\n                    if (low < here + 1)\n                        low = here + 1;\n                    if (low < there) {\n                        low = this.getOffsetAtStartOf(low);\n                        let dist = Math.abs(this.getPrimaryHorizontal(low) - horiz);\n                        let aft = TextUtils.getOffsetAfter(this.mText, low);\n                        if (aft < there) {\n                            let other = Math.abs(this.getPrimaryHorizontal(aft) - horiz);\n                            if (other < dist) {\n                                dist = other;\n                                low = aft;\n                            }\n                        }\n                        if (dist < bestdist) {\n                            bestdist = dist;\n                            best = low;\n                        }\n                    }\n                    let dist = Math.abs(this.getPrimaryHorizontal(here) - horiz);\n                    if (dist < bestdist) {\n                        bestdist = dist;\n                        best = here;\n                    }\n                }\n                let dist = Math.abs(this.getPrimaryHorizontal(max) - horiz);\n                if (dist <= bestdist) {\n                    bestdist = dist;\n                    best = max;\n                }\n                return best;\n            }\n            getLineEnd(line) {\n                return this.getLineStart(line + 1);\n            }\n            getLineVisibleEnd(line, start = this.getLineStart(line), end = this.getLineStart(line + 1)) {\n                let text = this.mText;\n                let ch;\n                if (line == this.getLineCount() - 1) {\n                    return end;\n                }\n                for (; end > start; end--) {\n                    ch = text.charAt(end - 1);\n                    if (ch == '\\n') {\n                        return end - 1;\n                    }\n                    if (ch != ' ' && ch != '\\t') {\n                        break;\n                    }\n                }\n                return end;\n            }\n            getLineBottom(line) {\n                return this.getLineTop(line + 1);\n            }\n            getLineBaseline(line) {\n                return this.getLineTop(line + 1) - this.getLineDescent(line);\n            }\n            getLineAscent(line) {\n                return this.getLineTop(line) - (this.getLineTop(line + 1) - this.getLineDescent(line));\n            }\n            getOffsetToLeftOf(offset) {\n                return this.getOffsetToLeftRightOf(offset, true);\n            }\n            getOffsetToRightOf(offset) {\n                return this.getOffsetToLeftRightOf(offset, false);\n            }\n            getOffsetToLeftRightOf(caret, toLeft) {\n                let line = this.getLineForOffset(caret);\n                let lineStart = this.getLineStart(line);\n                let lineEnd = this.getLineEnd(line);\n                let lineDir = this.getParagraphDirection(line);\n                let lineChanged = false;\n                let advance = toLeft == (lineDir == Layout.DIR_RIGHT_TO_LEFT);\n                if (advance) {\n                    if (caret == lineEnd) {\n                        if (line < this.getLineCount() - 1) {\n                            lineChanged = true;\n                            ++line;\n                        }\n                        else {\n                            return caret;\n                        }\n                    }\n                }\n                else {\n                    if (caret == lineStart) {\n                        if (line > 0) {\n                            lineChanged = true;\n                            --line;\n                        }\n                        else {\n                            return caret;\n                        }\n                    }\n                }\n                if (lineChanged) {\n                    lineStart = this.getLineStart(line);\n                    lineEnd = this.getLineEnd(line);\n                    let newDir = this.getParagraphDirection(line);\n                    if (newDir != lineDir) {\n                        toLeft = !toLeft;\n                        lineDir = newDir;\n                    }\n                }\n                let directions = this.getLineDirections(line);\n                let tl = TextLine.obtain();\n                tl.set(this.mPaint, this.mText, lineStart, lineEnd, lineDir, directions, false, null);\n                caret = lineStart + tl.getOffsetToLeftRightOf(caret - lineStart, toLeft);\n                tl = TextLine.recycle(tl);\n                return caret;\n            }\n            getOffsetAtStartOf(offset) {\n                if (offset == 0)\n                    return 0;\n                let text = this.mText;\n                let c = text.codePointAt(offset);\n                let questionMark = '?'.codePointAt(0);\n                if (c >= questionMark && c <= questionMark) {\n                    let c1 = text.codePointAt(offset - 1);\n                    if (c1 >= questionMark && c1 <= questionMark)\n                        offset -= 1;\n                }\n                if (this.mSpannedText) {\n                    let spans = text.getSpans(offset, offset, ReplacementSpan.type);\n                    for (let i = 0; i < spans.length; i++) {\n                        let start = text.getSpanStart(spans[i]);\n                        let end = text.getSpanEnd(spans[i]);\n                        if (start < offset && end > offset)\n                            offset = start;\n                    }\n                }\n                return offset;\n            }\n            shouldClampCursor(line) {\n                switch (this.getParagraphAlignment(line)) {\n                    case Layout.Alignment.ALIGN_LEFT:\n                        return true;\n                    case Layout.Alignment.ALIGN_NORMAL:\n                        return this.getParagraphDirection(line) > 0;\n                    default:\n                        return false;\n                }\n            }\n            getCursorPath(point, dest, editingBuffer) {\n                dest.reset();\n            }\n            addSelection(line, start, end, top, bottom, dest) {\n            }\n            getSelectionPath(start, end, dest) {\n                dest.reset();\n            }\n            getParagraphAlignment(line) {\n                let align = this.mAlignment;\n                return align;\n            }\n            getParagraphLeft(line) {\n                let left = 0;\n                let dir = this.getParagraphDirection(line);\n                if (dir == Layout.DIR_RIGHT_TO_LEFT || !this.mSpannedText) {\n                    return left;\n                }\n                return this.getParagraphLeadingMargin(line);\n            }\n            getParagraphRight(line) {\n                let right = this.mWidth;\n                let dir = this.getParagraphDirection(line);\n                if (dir == Layout.DIR_LEFT_TO_RIGHT || !this.mSpannedText) {\n                    return right;\n                }\n                return right - this.getParagraphLeadingMargin(line);\n            }\n            getParagraphLeadingMargin(line) {\n                if (!this.mSpannedText) {\n                    return 0;\n                }\n                let spanned = this.mText;\n                let lineStart = this.getLineStart(line);\n                let lineEnd = this.getLineEnd(line);\n                let spanEnd = spanned.nextSpanTransition(lineStart, lineEnd, LeadingMarginSpan.type);\n                let spans = Layout.getParagraphSpans(spanned, lineStart, spanEnd, LeadingMarginSpan.type);\n                if (spans.length == 0) {\n                    return 0;\n                }\n                let margin = 0;\n                let isFirstParaLine = lineStart == 0 || spanned.charAt(lineStart - 1) == '\\n';\n                for (let i = 0; i < spans.length; i++) {\n                    let span = spans[i];\n                    let useFirstLineMargin = isFirstParaLine;\n                    if (LeadingMarginSpan2.isImpl(span)) {\n                        let spStart = spanned.getSpanStart(span);\n                        let spanLine = this.getLineForOffset(spStart);\n                        let count = span.getLeadingMarginLineCount();\n                        useFirstLineMargin = line < spanLine + count;\n                    }\n                    margin += span.getLeadingMargin(useFirstLineMargin);\n                }\n                return margin;\n            }\n            static measurePara(paint, text, start, end) {\n                let mt = MeasuredText.obtain();\n                let tl = TextLine.obtain();\n                try {\n                    mt.setPara(text, start, end, TextDirectionHeuristics.LTR);\n                    let directions;\n                    let dir;\n                    directions = Layout.DIRS_ALL_LEFT_TO_RIGHT;\n                    dir = Layout.DIR_LEFT_TO_RIGHT;\n                    let chars = mt.mChars;\n                    let len = mt.mLen;\n                    let hasTabs = false;\n                    let tabStops = null;\n                    for (let i = 0; i < len; ++i) {\n                        if (chars[i] == '\\t') {\n                            hasTabs = true;\n                            if (Spanned.isImplements(text)) {\n                                let spanned = text;\n                                let spanEnd = spanned.nextSpanTransition(start, end, TabStopSpan.type);\n                                let spans = Layout.getParagraphSpans(spanned, start, spanEnd, TabStopSpan.type);\n                                if (spans.length > 0) {\n                                    tabStops = new Layout.TabStops(Layout.TAB_INCREMENT, spans);\n                                }\n                            }\n                            break;\n                        }\n                    }\n                    tl.set(paint, text, start, end, dir, directions, hasTabs, tabStops);\n                    return tl.metrics(null);\n                }\n                finally {\n                    TextLine.recycle(tl);\n                    MeasuredText.recycle(mt);\n                }\n            }\n            static nextTab(text, start, end, h, tabs) {\n                let nh = Float.MAX_VALUE;\n                let alltabs = false;\n                if (Spanned.isImplements(text)) {\n                    if (tabs == null) {\n                        tabs = Layout.getParagraphSpans(text, start, end, TabStopSpan.type);\n                        alltabs = true;\n                    }\n                    for (let i = 0; i < tabs.length; i++) {\n                        if (!alltabs) {\n                            if (!(TabStopSpan.isImpl(tabs[i])))\n                                continue;\n                        }\n                        let where = tabs[i].getTabStop();\n                        if (where < nh && where > h)\n                            nh = where;\n                    }\n                    if (nh != Float.MAX_VALUE)\n                        return nh;\n                }\n                return (Math.floor(((h + Layout.TAB_INCREMENT) / Layout.TAB_INCREMENT))) * Layout.TAB_INCREMENT;\n            }\n            isSpanned() {\n                return this.mSpannedText;\n            }\n            static getParagraphSpans(text, start, end, type) {\n                if (start == end && start > 0) {\n                    return [];\n                }\n                return text.getSpans(start, end, type);\n            }\n            getEllipsisChar(method) {\n                return (method == TextUtils.TruncateAt.END_SMALL) ? Layout.ELLIPSIS_TWO_DOTS[0] : Layout.ELLIPSIS_NORMAL[0];\n            }\n            ellipsize(start, end, line, dest, destoff, method) {\n                let ellipsisCount = this.getEllipsisCount(line);\n                if (ellipsisCount == 0) {\n                    return;\n                }\n                let ellipsisStart = this.getEllipsisStart(line);\n                let linestart = this.getLineStart(line);\n                for (let i = ellipsisStart; i < ellipsisStart + ellipsisCount; i++) {\n                    let c;\n                    if (i == ellipsisStart) {\n                        c = this.getEllipsisChar(method);\n                    }\n                    else {\n                        c = String.fromCharCode(20);\n                    }\n                    let a = i + linestart;\n                    if (a >= start && a < end) {\n                        dest[destoff + a - start] = c;\n                    }\n                }\n            }\n        }\n        Layout.NO_PARA_SPANS = [];\n        Layout.sTempRect = new Rect();\n        Layout.DIR_LEFT_TO_RIGHT = 1;\n        Layout.DIR_RIGHT_TO_LEFT = -1;\n        Layout.DIR_REQUEST_LTR = 1;\n        Layout.DIR_REQUEST_RTL = -1;\n        Layout.DIR_REQUEST_DEFAULT_LTR = 2;\n        Layout.DIR_REQUEST_DEFAULT_RTL = -2;\n        Layout.RUN_LENGTH_MASK = 0x03ffffff;\n        Layout.RUN_LEVEL_SHIFT = 26;\n        Layout.RUN_LEVEL_MASK = 0x3f;\n        Layout.RUN_RTL_FLAG = 1 << Layout.RUN_LEVEL_SHIFT;\n        Layout.TAB_INCREMENT = 20;\n        Layout.ELLIPSIS_NORMAL = ['…'];\n        Layout.ELLIPSIS_TWO_DOTS = ['‥'];\n        text_5.Layout = Layout;\n        (function (Layout) {\n            class TabStops {\n                constructor(increment, spans) {\n                    this.mNumStops = 0;\n                    this.mIncrement = 0;\n                    this.reset(increment, spans);\n                }\n                reset(increment, spans) {\n                    this.mIncrement = increment;\n                    let ns = 0;\n                    if (spans != null) {\n                        let stops = this.mStops;\n                        for (let o of spans) {\n                            if (TabStopSpan.isImpl(o)) {\n                                if (stops == null) {\n                                    stops = androidui.util.ArrayCreator.newNumberArray(10);\n                                }\n                                else if (ns == stops.length) {\n                                    let nstops = androidui.util.ArrayCreator.newNumberArray(ns * 2);\n                                    for (let i = 0; i < ns; ++i) {\n                                        nstops[i] = stops[i];\n                                    }\n                                    stops = nstops;\n                                }\n                                stops[ns++] = o.getTabStop();\n                            }\n                        }\n                        if (ns > 1) {\n                            Arrays.sort(stops, 0, ns);\n                        }\n                        if (stops != this.mStops) {\n                            this.mStops = stops;\n                        }\n                    }\n                    this.mNumStops = ns;\n                }\n                nextTab(h) {\n                    let ns = this.mNumStops;\n                    if (ns > 0) {\n                        let stops = this.mStops;\n                        for (let i = 0; i < ns; ++i) {\n                            let stop = stops[i];\n                            if (stop > h) {\n                                return stop;\n                            }\n                        }\n                    }\n                    return TabStops.nextDefaultStop(h, this.mIncrement);\n                }\n                static nextDefaultStop(h, inc) {\n                    return (Math.floor(((h + inc) / inc))) * inc;\n                }\n            }\n            Layout.TabStops = TabStops;\n            class Directions {\n                constructor(dirs) {\n                    this.mDirections = dirs;\n                }\n            }\n            Layout.Directions = Directions;\n            class Ellipsizer extends String {\n                constructor(s) {\n                    super(s);\n                    this.mWidth = 0;\n                    this.mText = s;\n                }\n                toString() {\n                    let line1 = this.mLayout.getLineForOffset(0);\n                    let line2 = this.mLayout.getLineForOffset(this.mText.length);\n                    let dest = this.mText.split('');\n                    for (let i = line1; i <= line2; i++) {\n                        this.mLayout.ellipsize(0, this.mText.length, i, dest, 0, this.mMethod);\n                    }\n                    return dest.join('');\n                }\n            }\n            Layout.Ellipsizer = Ellipsizer;\n            class SpannedEllipsizer extends Layout.Ellipsizer {\n                constructor(display) {\n                    super(display);\n                    this.mSpanned = display;\n                }\n                getSpans(start, end, type) {\n                    return this.mSpanned.getSpans(start, end, type);\n                }\n                getSpanStart(tag) {\n                    return this.mSpanned.getSpanStart(tag);\n                }\n                getSpanEnd(tag) {\n                    return this.mSpanned.getSpanEnd(tag);\n                }\n                getSpanFlags(tag) {\n                    return this.mSpanned.getSpanFlags(tag);\n                }\n                nextSpanTransition(start, limit, type) {\n                    return this.mSpanned.nextSpanTransition(start, limit, type);\n                }\n            }\n            Layout.SpannedEllipsizer = SpannedEllipsizer;\n            var Alignment;\n            (function (Alignment) {\n                Alignment[Alignment[\"ALIGN_NORMAL\"] = 0] = \"ALIGN_NORMAL\";\n                Alignment[Alignment[\"ALIGN_OPPOSITE\"] = 1] = \"ALIGN_OPPOSITE\";\n                Alignment[Alignment[\"ALIGN_CENTER\"] = 2] = \"ALIGN_CENTER\";\n                Alignment[Alignment[\"ALIGN_LEFT\"] = 3] = \"ALIGN_LEFT\";\n                Alignment[Alignment[\"ALIGN_RIGHT\"] = 4] = \"ALIGN_RIGHT\";\n            })(Alignment = Layout.Alignment || (Layout.Alignment = {}));\n        })(Layout = text_5.Layout || (text_5.Layout = {}));\n        Layout.DIRS_ALL_LEFT_TO_RIGHT = new Layout.Directions([0, Layout.RUN_LENGTH_MASK]);\n        Layout.DIRS_ALL_RIGHT_TO_LEFT = new Layout.Directions([0, Layout.RUN_LENGTH_MASK | Layout.RUN_RTL_FLAG]);\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text_6) {\n        var Canvas = android.graphics.Canvas;\n        var ReplacementSpan = android.text.style.ReplacementSpan;\n        var Log = android.util.Log;\n        var Spanned = android.text.Spanned;\n        var TextPaint = android.text.TextPaint;\n        class MeasuredText {\n            constructor() {\n                this.mTextStart = 0;\n                this.mDir = 0;\n                this.mLen = 0;\n                this.mPos = 0;\n                this.mWorkPaint = new TextPaint();\n            }\n            static obtain() {\n                let mt;\n                {\n                    for (let i = MeasuredText.sCached.length; --i >= 0;) {\n                        if (MeasuredText.sCached[i] != null) {\n                            mt = MeasuredText.sCached[i];\n                            MeasuredText.sCached[i] = null;\n                            return mt;\n                        }\n                    }\n                }\n                mt = new MeasuredText();\n                if (MeasuredText.localLOGV) {\n                    Log.v(\"MEAS\", \"new: \" + mt);\n                }\n                return mt;\n            }\n            static recycle(mt) {\n                mt.mText = null;\n                if (mt.mLen < 1000) {\n                    {\n                        for (let i = 0; i < MeasuredText.sCached.length; ++i) {\n                            if (MeasuredText.sCached[i] == null) {\n                                MeasuredText.sCached[i] = mt;\n                                mt.mText = null;\n                                break;\n                            }\n                        }\n                    }\n                }\n                return null;\n            }\n            setPos(pos) {\n                this.mPos = pos - this.mTextStart;\n            }\n            setPara(text, start, end, textDir) {\n                this.mText = text;\n                this.mTextStart = start;\n                let len = end - start;\n                this.mLen = len;\n                this.mPos = 0;\n                if (this.mWidths == null || this.mWidths.length < len) {\n                    this.mWidths = androidui.util.ArrayCreator.newNumberArray(len);\n                }\n                this.mChars = text.toString().substring(start, end);\n                if (Spanned.isImplements(text)) {\n                    let spanned = text;\n                    let spans = spanned.getSpans(start, end, ReplacementSpan.type);\n                    for (let i = 0; i < spans.length; i++) {\n                        let startInPara = spanned.getSpanStart(spans[i]) - start;\n                        let endInPara = spanned.getSpanEnd(spans[i]) - start;\n                        if (startInPara < 0)\n                            startInPara = 0;\n                        if (endInPara > len)\n                            endInPara = len;\n                        for (let j = startInPara; j < endInPara; j++) {\n                            this.mChars = this.mChars.substring(0, j) + ' ' + this.mChars.substring(j + 1);\n                        }\n                    }\n                }\n                this.mDir = android.text.Layout.DIR_LEFT_TO_RIGHT;\n                this.mEasy = true;\n            }\n            addStyleRun(...args) {\n                if (args.length === 3)\n                    return this.addStyleRun_3(...args);\n                if (args.length === 4)\n                    return this.addStyleRun_4(...args);\n            }\n            addStyleRun_3(paint, len, fm) {\n                if (fm != null) {\n                    paint.getFontMetricsInt(fm);\n                }\n                let p = this.mPos;\n                this.mPos = p + len;\n                if (this.mEasy) {\n                    let flags = this.mDir == android.text.Layout.DIR_LEFT_TO_RIGHT ? Canvas.DIRECTION_LTR : Canvas.DIRECTION_RTL;\n                    return paint.getTextRunAdvances_count(this.mChars, p, len, p, len, flags, this.mWidths, p);\n                }\n                let totalAdvance = 0;\n                let level = this.mLevels[p];\n                for (let q = p, i = p + 1, e = p + len;; ++i) {\n                    if (i == e || this.mLevels[i] != level) {\n                        let flags = (level & 0x1) == 0 ? Canvas.DIRECTION_LTR : Canvas.DIRECTION_RTL;\n                        totalAdvance += paint.getTextRunAdvances_count(this.mChars, q, i - q, q, i - q, flags, this.mWidths, q);\n                        if (i == e) {\n                            break;\n                        }\n                        q = i;\n                        level = this.mLevels[i];\n                    }\n                }\n                return totalAdvance;\n            }\n            addStyleRun_4(paint, spans, len, fm) {\n                let workPaint = this.mWorkPaint;\n                workPaint.set(paint);\n                workPaint.baselineShift = 0;\n                let replacement = null;\n                for (let i = 0; i < spans.length; i++) {\n                    let span = spans[i];\n                    if (span instanceof ReplacementSpan) {\n                        replacement = span;\n                    }\n                    else {\n                        span.updateMeasureState(workPaint);\n                    }\n                }\n                let wid;\n                if (replacement == null) {\n                    wid = this.addStyleRun(workPaint, len, fm);\n                }\n                else {\n                    wid = replacement.getSize(workPaint, this.mText, this.mTextStart + this.mPos, this.mTextStart + this.mPos + len, fm);\n                    let w = this.mWidths;\n                    w[this.mPos] = wid;\n                    for (let i = this.mPos + 1, e = this.mPos + len; i < e; i++)\n                        w[i] = 0;\n                    this.mPos += len;\n                }\n                if (fm != null) {\n                    if (workPaint.baselineShift < 0) {\n                        fm.ascent += workPaint.baselineShift;\n                        fm.top += workPaint.baselineShift;\n                    }\n                    else {\n                        fm.descent += workPaint.baselineShift;\n                        fm.bottom += workPaint.baselineShift;\n                    }\n                }\n                return wid;\n            }\n            breakText(limit, forwards, width) {\n                let w = this.mWidths;\n                if (forwards) {\n                    let i = 0;\n                    while (i < limit) {\n                        width -= w[i];\n                        if (width < 0.0)\n                            break;\n                        i++;\n                    }\n                    while (i > 0 && this.mChars[i - 1] == ' ')\n                        i--;\n                    return i;\n                }\n                else {\n                    let i = limit - 1;\n                    while (i >= 0) {\n                        width -= w[i];\n                        if (width < 0.0)\n                            break;\n                        i--;\n                    }\n                    while (i < limit - 1 && this.mChars[i + 1] == ' ')\n                        i++;\n                    return limit - i - 1;\n                }\n            }\n            measure(start, limit) {\n                let width = 0;\n                let w = this.mWidths;\n                for (let i = start; i < limit; ++i) {\n                    width += w[i];\n                }\n                return width;\n            }\n        }\n        MeasuredText.localLOGV = false;\n        MeasuredText.sLock = new Array(0);\n        MeasuredText.sCached = new Array(3);\n        text_6.MeasuredText = MeasuredText;\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text_7) {\n        var System = java.lang.System;\n        var StringBuilder = java.lang.StringBuilder;\n        var MeasuredText = android.text.MeasuredText;\n        var Spanned = android.text.Spanned;\n        var TextDirectionHeuristics = android.text.TextDirectionHeuristics;\n        class TextUtils {\n            static isEmpty(str) {\n                if (str == null || str.length == 0)\n                    return true;\n                else\n                    return false;\n            }\n            static getOffsetBefore(text, offset) {\n                if (offset == 0)\n                    return 0;\n                if (offset == 1)\n                    return 0;\n                let c = text.codePointAt(offset - 1);\n                if (c >= '?'.codePointAt(0) && c <= '?'.codePointAt(0)) {\n                    let c1 = text.codePointAt(offset - 2);\n                    if (c1 >= '?'.codePointAt(0) && c1 <= '?'.codePointAt(0))\n                        offset -= 2;\n                    else\n                        offset -= 1;\n                }\n                else {\n                    offset -= 1;\n                }\n                if (Spanned.isImplements(text)) {\n                    let spans = text.getSpans(offset, offset, android.text.style.ReplacementSpan.type);\n                    for (let i = 0; i < spans.length; i++) {\n                        let start = text.getSpanStart(spans[i]);\n                        let end = text.getSpanEnd(spans[i]);\n                        if (start < offset && end > offset)\n                            offset = start;\n                    }\n                }\n                return offset;\n            }\n            static getOffsetAfter(text, offset) {\n                let len = text.length;\n                if (offset == len)\n                    return len;\n                if (offset == len - 1)\n                    return len;\n                let c = text.codePointAt(offset);\n                if (c >= '?'.codePointAt(0) && c <= '?'.codePointAt(0)) {\n                    let c1 = text.codePointAt(offset + 1);\n                    if (c1 >= '?'.codePointAt(0) && c1 <= '?'.codePointAt(0))\n                        offset += 2;\n                    else\n                        offset += 1;\n                }\n                else {\n                    offset += 1;\n                }\n                if (Spanned.isImplements(text)) {\n                    let spans = text.getSpans(offset, offset, android.text.style.ReplacementSpan.type);\n                    for (let i = 0; i < spans.length; i++) {\n                        let start = text.getSpanStart(spans[i]);\n                        let end = text.getSpanEnd(spans[i]);\n                        if (start < offset && end > offset)\n                            offset = end;\n                    }\n                }\n                return offset;\n            }\n            static ellipsize(text, paint, avail, where, preserveLength = false, callback = null, textDir = TextDirectionHeuristics.FIRSTSTRONG_LTR, ellipsis = undefined) {\n                ellipsis = ellipsis || (where == TextUtils.TruncateAt.END_SMALL ? android.text.Layout.ELLIPSIS_TWO_DOTS[0] : android.text.Layout.ELLIPSIS_NORMAL[0]);\n                let len = text.length;\n                let mt = MeasuredText.obtain();\n                try {\n                    let width = TextUtils.setPara(mt, paint, text, 0, text.length, textDir);\n                    if (width <= avail) {\n                        if (callback != null) {\n                            callback.ellipsized(0, 0);\n                        }\n                        return text;\n                    }\n                    let ellipsiswid = paint.measureText(ellipsis);\n                    avail -= ellipsiswid;\n                    let left = 0;\n                    let right = len;\n                    if (avail < 0) {\n                    }\n                    else if (where == TextUtils.TruncateAt.START) {\n                        right = len - mt.breakText(len, false, avail);\n                    }\n                    else if (where == TextUtils.TruncateAt.END || where == TextUtils.TruncateAt.END_SMALL) {\n                        left = mt.breakText(len, true, avail);\n                    }\n                    else {\n                        right = len - mt.breakText(len, false, avail / 2);\n                        avail -= mt.measure(right, len);\n                        left = mt.breakText(right, true, avail);\n                    }\n                    if (callback != null) {\n                        callback.ellipsized(left, right);\n                    }\n                    let buf = mt.mChars.split('');\n                    let sp = Spanned.isImplements(text) ? text : null;\n                    let remaining = len - (right - left);\n                    if (preserveLength) {\n                        if (remaining > 0) {\n                            buf[left++] = ellipsis.charAt(0);\n                        }\n                        for (let i = left; i < right; i++) {\n                            buf[i] = TextUtils.ZWNBS_CHAR;\n                        }\n                        let s = buf.join('');\n                        return s;\n                    }\n                    if (remaining == 0) {\n                        return \"\";\n                    }\n                    let sb = new StringBuilder(remaining + ellipsis.length());\n                    sb.append(buf.join('').substr(0, left));\n                    sb.append(ellipsis);\n                    sb.append(buf.join('').substr(right, len - right));\n                    return sb.toString();\n                }\n                finally {\n                    MeasuredText.recycle(mt);\n                }\n            }\n            static setPara(mt, paint, text, start, end, textDir) {\n                mt.setPara(text, start, end, textDir);\n                let width;\n                let sp = Spanned.isImplements(text) ? text : null;\n                let len = end - start;\n                if (sp == null) {\n                    width = mt.addStyleRun(paint, len, null);\n                }\n                else {\n                    width = 0;\n                    let spanEnd;\n                    for (let spanStart = 0; spanStart < len; spanStart = spanEnd) {\n                        spanEnd = sp.nextSpanTransition(spanStart, len, android.text.style.MetricAffectingSpan.type);\n                        let spans = sp.getSpans(spanStart, spanEnd, android.text.style.MetricAffectingSpan.type);\n                        spans = TextUtils.removeEmptySpans(spans, sp, android.text.style.MetricAffectingSpan.type);\n                        width += mt.addStyleRun(paint, spans, spanEnd - spanStart, null);\n                    }\n                }\n                return width;\n            }\n            static removeEmptySpans(spans, spanned, klass) {\n                let copy = null;\n                let count = 0;\n                for (let i = 0; i < spans.length; i++) {\n                    const span = spans[i];\n                    const start = spanned.getSpanStart(span);\n                    const end = spanned.getSpanEnd(span);\n                    if (start == end) {\n                        if (copy == null) {\n                            copy = new Array(spans.length - 1);\n                            System.arraycopy(spans, 0, copy, 0, i);\n                            count = i;\n                        }\n                    }\n                    else {\n                        if (copy != null) {\n                            copy[count] = span;\n                            count++;\n                        }\n                    }\n                }\n                if (copy != null) {\n                    let result = new Array(count);\n                    System.arraycopy(copy, 0, result, 0, count);\n                    return result;\n                }\n                else {\n                    return spans;\n                }\n            }\n            static packRangeInLong(start, end) {\n                return [start, end];\n            }\n            static unpackRangeStartFromLong(range) {\n                return range[0] || 0;\n            }\n            static unpackRangeEndFromLong(range) {\n                return range[1] || 0;\n            }\n        }\n        TextUtils.ALIGNMENT_SPAN = 1;\n        TextUtils.FIRST_SPAN = TextUtils.ALIGNMENT_SPAN;\n        TextUtils.FOREGROUND_COLOR_SPAN = 2;\n        TextUtils.RELATIVE_SIZE_SPAN = 3;\n        TextUtils.SCALE_X_SPAN = 4;\n        TextUtils.STRIKETHROUGH_SPAN = 5;\n        TextUtils.UNDERLINE_SPAN = 6;\n        TextUtils.STYLE_SPAN = 7;\n        TextUtils.BULLET_SPAN = 8;\n        TextUtils.QUOTE_SPAN = 9;\n        TextUtils.LEADING_MARGIN_SPAN = 10;\n        TextUtils.URL_SPAN = 11;\n        TextUtils.BACKGROUND_COLOR_SPAN = 12;\n        TextUtils.TYPEFACE_SPAN = 13;\n        TextUtils.SUPERSCRIPT_SPAN = 14;\n        TextUtils.SUBSCRIPT_SPAN = 15;\n        TextUtils.ABSOLUTE_SIZE_SPAN = 16;\n        TextUtils.TEXT_APPEARANCE_SPAN = 17;\n        TextUtils.ANNOTATION = 18;\n        TextUtils.SUGGESTION_SPAN = 19;\n        TextUtils.SPELL_CHECK_SPAN = 20;\n        TextUtils.SUGGESTION_RANGE_SPAN = 21;\n        TextUtils.EASY_EDIT_SPAN = 22;\n        TextUtils.LOCALE_SPAN = 23;\n        TextUtils.LAST_SPAN = TextUtils.LOCALE_SPAN;\n        TextUtils.EMPTY_STRING_ARRAY = [];\n        TextUtils.ZWNBS_CHAR = String.fromCodePoint(20);\n        TextUtils.ARAB_SCRIPT_SUBTAG = \"Arab\";\n        TextUtils.HEBR_SCRIPT_SUBTAG = \"Hebr\";\n        text_7.TextUtils = TextUtils;\n        (function (TextUtils) {\n            var TruncateAt;\n            (function (TruncateAt) {\n                TruncateAt[TruncateAt[\"START\"] = 0] = \"START\";\n                TruncateAt[TruncateAt[\"MIDDLE\"] = 1] = \"MIDDLE\";\n                TruncateAt[TruncateAt[\"END\"] = 2] = \"END\";\n                TruncateAt[TruncateAt[\"MARQUEE\"] = 3] = \"MARQUEE\";\n                TruncateAt[TruncateAt[\"END_SMALL\"] = 4] = \"END_SMALL\";\n            })(TruncateAt = TextUtils.TruncateAt || (TextUtils.TruncateAt = {}));\n        })(TextUtils = text_7.TextUtils || (text_7.TextUtils = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var Gravity = android.view.Gravity;\n        var View = android.view.View;\n        var ViewGroup = android.view.ViewGroup;\n        class WindowManager {\n            constructor(context) {\n                this.mWindowsLayout = new WindowManager.Layout(context, this);\n                let viewRootImpl = context.androidUI._viewRootImpl;\n                let fakeAttachInfo = new View.AttachInfo(viewRootImpl, viewRootImpl.mHandler);\n                fakeAttachInfo.mRootView = this.mWindowsLayout;\n                this.mWindowsLayout.dispatchAttachedToWindow(fakeAttachInfo, 0);\n                this.mWindowsLayout.mGroupFlags |= ViewGroup.FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW;\n                this.mWindowsLayout.mGroupFlags |= ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE;\n            }\n            getWindowsLayout() {\n                return this.mWindowsLayout;\n            }\n            addWindow(window) {\n                let wparams = window.getAttributes();\n                if (!wparams) {\n                    wparams = new WindowManager.LayoutParams();\n                }\n                if (!(wparams instanceof WindowManager.LayoutParams)) {\n                    throw Error('can\\'t addWindow, params must be WindowManager.LayoutParams : ' + wparams);\n                }\n                window.setContainer(this);\n                let decorView = window.getDecorView();\n                let type = wparams.type;\n                let lastFocusWindowView = this.mWindowsLayout.getTopFocusableWindowView();\n                this.mWindowsLayout.addView(decorView, wparams);\n                decorView.dispatchAttachedToWindow(window.mAttachInfo, 0);\n                if (wparams.isFocusable()) {\n                    decorView.dispatchWindowFocusChanged(true);\n                    if (lastFocusWindowView && lastFocusWindowView.hasFocus()) {\n                        const focused = lastFocusWindowView.findFocus();\n                        lastFocusWindowView[WindowManager.FocusViewRemember] = focused;\n                        if (focused != null) {\n                            focused.clearFocusInternal(true, false);\n                        }\n                        lastFocusWindowView.dispatchWindowFocusChanged(false);\n                        decorView.addOnLayoutChangeListener({\n                            onLayoutChange(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) {\n                                decorView.removeOnLayoutChangeListener(this);\n                                const newWindowFocused = view.FocusFinder.getInstance().findNextFocus(decorView, null, View.FOCUS_DOWN);\n                                if (newWindowFocused != null) {\n                                    newWindowFocused.requestFocus(View.FOCUS_DOWN);\n                                }\n                            }\n                        });\n                    }\n                }\n                if (decorView instanceof ViewGroup) {\n                    decorView.setMotionEventSplittingEnabled(wparams.isSplitTouch());\n                }\n                let enterAnimation = window.getContext().androidUI.mActivityThread.getOverrideEnterAnimation();\n                if (enterAnimation === undefined)\n                    enterAnimation = wparams.enterAnimation;\n                if (enterAnimation) {\n                    decorView.bindElement.style.visibility = 'hidden';\n                    enterAnimation.setAnimationListener({\n                        onAnimationStart(animation) {\n                        },\n                        onAnimationEnd(animation) {\n                            decorView.bindElement.style.visibility = '';\n                        },\n                        onAnimationRepeat(animation) {\n                        }\n                    });\n                    decorView.startAnimation(enterAnimation);\n                }\n            }\n            updateWindowLayout(window, params) {\n                if (!(params instanceof WindowManager.LayoutParams)) {\n                    throw Error('can\\'t updateWindowLayout, params must be WindowManager.LayoutParams');\n                }\n                window.getDecorView().setLayoutParams(params);\n            }\n            removeWindow(window) {\n                let decor = window.getDecorView();\n                if (decor.getParent() == null)\n                    return;\n                if (decor.getParent() !== this.mWindowsLayout) {\n                    console.error('removeWindow fail, don\\'t has the window, decor belong to ', decor.getParent());\n                    return;\n                }\n                let wparams = decor.getLayoutParams();\n                let exitAnimation = window.getContext().androidUI.mActivityThread.getOverrideExitAnimation();\n                if (exitAnimation === undefined)\n                    exitAnimation = wparams.exitAnimation;\n                if (exitAnimation) {\n                    let t = this;\n                    decor.startAnimation(exitAnimation);\n                    decor.drawAnimation(this.mWindowsLayout, android.os.SystemClock.uptimeMillis(), exitAnimation);\n                    this.mWindowsLayout.removeView(decor);\n                }\n                else {\n                    this.mWindowsLayout.removeView(decor);\n                }\n                if (wparams.isFocusable()) {\n                    let resumeWindowView = this.mWindowsLayout.getTopFocusableWindowView();\n                    if (resumeWindowView) {\n                        resumeWindowView.dispatchWindowFocusChanged(true);\n                        let resumeFocus = resumeWindowView[WindowManager.FocusViewRemember];\n                        if (resumeFocus) {\n                            resumeFocus.requestFocus(View.FOCUS_DOWN);\n                        }\n                    }\n                }\n            }\n        }\n        WindowManager.FocusViewRemember = Symbol();\n        view.WindowManager = WindowManager;\n        (function (WindowManager) {\n            class Layout extends android.widget.FrameLayout {\n                constructor(context, windowManager) {\n                    super(context);\n                    this.mWindowManager = windowManager;\n                }\n                getTopFocusableWindowView(findParent = true) {\n                    const count = this.getChildCount();\n                    for (let i = count - 1; i >= 0; i--) {\n                        let child = this.getChildAt(i);\n                        let wparams = child.getLayoutParams();\n                        if (wparams.isFocusable()) {\n                            return child;\n                        }\n                    }\n                    if (findParent) {\n                        let decor = this.getParent();\n                        if (decor != null) {\n                            let windowLayout = decor.getParent();\n                            if (windowLayout instanceof Layout) {\n                                return windowLayout.getTopFocusableWindowView();\n                            }\n                        }\n                    }\n                }\n                dispatchKeyEvent(event) {\n                    let topFocusView = this.getTopFocusableWindowView(false);\n                    if (topFocusView && topFocusView.dispatchKeyEvent(event)) {\n                        return true;\n                    }\n                    return super.dispatchKeyEvent(event);\n                }\n                isTransformedTouchPointInView(x, y, child, outLocalPoint) {\n                    let wparams = child.getLayoutParams();\n                    if (wparams.isFocusable() && wparams.isTouchable()) {\n                        return true;\n                    }\n                    return false;\n                }\n                onChildVisibilityChanged(child, oldVisibility, newVisibility) {\n                    super.onChildVisibilityChanged(child, oldVisibility, newVisibility);\n                    let wparams = child.getLayoutParams();\n                    if (newVisibility === View.VISIBLE) {\n                        let resumeAnimation = child.getContext().androidUI.mActivityThread.getOverrideResumeAnimation();\n                        if (resumeAnimation === undefined)\n                            resumeAnimation = wparams.resumeAnimation;\n                        if (resumeAnimation) {\n                            child.startAnimation(resumeAnimation);\n                        }\n                    }\n                    else {\n                        let hideAnimation = child.getContext().androidUI.mActivityThread.getOverrideHideAnimation();\n                        if (hideAnimation === undefined)\n                            hideAnimation = wparams.hideAnimation;\n                        if (hideAnimation) {\n                            child.startAnimation(hideAnimation);\n                            child.drawAnimation(this, android.os.SystemClock.uptimeMillis(), hideAnimation);\n                        }\n                    }\n                }\n                onLayout(changed, left, top, right, bottom) {\n                    this.layoutChildren(left, top, right, bottom, false);\n                }\n                layoutChildren(left, top, right, bottom, forceLeftGravity) {\n                    const count = this.getChildCount();\n                    const parentLeft = this.getPaddingLeftWithForeground();\n                    const parentRight = right - left - this.getPaddingRightWithForeground();\n                    const parentTop = this.getPaddingTopWithForeground();\n                    const parentBottom = bottom - top - this.getPaddingBottomWithForeground();\n                    this.mForegroundBoundsChanged = true;\n                    for (let i = 0; i < count; i++) {\n                        let child = this.getChildAt(i);\n                        if (child.getVisibility() != View.GONE) {\n                            const lp = child.getLayoutParams();\n                            const width = child.getMeasuredWidth();\n                            const height = child.getMeasuredHeight();\n                            let childLeft;\n                            let childTop;\n                            let gravity = lp.gravity;\n                            if (gravity == -1) {\n                                gravity = Layout.DEFAULT_CHILD_GRAVITY;\n                            }\n                            const absoluteGravity = gravity;\n                            const verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK;\n                            switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n                                case Gravity.CENTER_HORIZONTAL:\n                                    childLeft = parentLeft + (parentRight - parentLeft - width) / 2 + lp.leftMargin - lp.rightMargin;\n                                    break;\n                                case Gravity.RIGHT:\n                                    if (!forceLeftGravity) {\n                                        childLeft = parentRight - width - lp.rightMargin - lp.x;\n                                        break;\n                                    }\n                                case Gravity.LEFT:\n                                default:\n                                    childLeft = parentLeft + lp.leftMargin + lp.x;\n                            }\n                            switch (verticalGravity) {\n                                case Gravity.TOP:\n                                    childTop = parentTop + lp.topMargin + lp.y;\n                                    break;\n                                case Gravity.CENTER_VERTICAL:\n                                    childTop = parentTop + (parentBottom - parentTop - height) / 2 + lp.topMargin - lp.bottomMargin;\n                                    break;\n                                case Gravity.BOTTOM:\n                                    childTop = parentBottom - height - lp.bottomMargin - lp.y;\n                                    break;\n                                default:\n                                    childTop = parentTop + lp.topMargin;\n                            }\n                            child.layout(childLeft, childTop, childLeft + width, childTop + height);\n                        }\n                    }\n                }\n                tagName() {\n                    return 'windowsGroup';\n                }\n            }\n            WindowManager.Layout = Layout;\n            class LayoutParams extends android.widget.FrameLayout.LayoutParams {\n                constructor(_type = LayoutParams.TYPE_APPLICATION) {\n                    super(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);\n                    this.x = 0;\n                    this.y = 0;\n                    this.type = 0;\n                    this.flags = 0;\n                    this.exitAnimation = android.R.anim.activity_close_exit;\n                    this.enterAnimation = android.R.anim.activity_open_enter;\n                    this.resumeAnimation = android.R.anim.activity_close_enter;\n                    this.hideAnimation = android.R.anim.activity_open_exit;\n                    this.dimAmount = 0;\n                    this.mTitle = \"\";\n                    this.type = _type;\n                }\n                setTitle(title) {\n                    if (null == title)\n                        title = \"\";\n                    this.mTitle = title;\n                }\n                getTitle() {\n                    return this.mTitle;\n                }\n                copyFrom(o) {\n                    let changes = 0;\n                    if (this.width != o.width) {\n                        this.width = o.width;\n                        changes |= LayoutParams.LAYOUT_CHANGED;\n                    }\n                    if (this.height != o.height) {\n                        this.height = o.height;\n                        changes |= LayoutParams.LAYOUT_CHANGED;\n                    }\n                    if (this.x != o.x) {\n                        this.x = o.x;\n                        changes |= LayoutParams.LAYOUT_CHANGED;\n                    }\n                    if (this.y != o.y) {\n                        this.y = o.y;\n                        changes |= LayoutParams.LAYOUT_CHANGED;\n                    }\n                    if (this.type != o.type) {\n                        this.type = o.type;\n                        changes |= LayoutParams.TYPE_CHANGED;\n                    }\n                    if (this.flags != o.flags) {\n                        const diff = this.flags ^ o.flags;\n                        this.flags = o.flags;\n                        changes |= LayoutParams.FLAGS_CHANGED;\n                    }\n                    if (this.gravity != o.gravity) {\n                        this.gravity = o.gravity;\n                        changes |= LayoutParams.LAYOUT_CHANGED;\n                    }\n                    if (this.mTitle != (o.mTitle)) {\n                        this.mTitle = o.mTitle;\n                        changes |= LayoutParams.TITLE_CHANGED;\n                    }\n                    if (this.dimAmount != o.dimAmount) {\n                        this.dimAmount = o.dimAmount;\n                        changes |= LayoutParams.DIM_AMOUNT_CHANGED;\n                    }\n                    return changes;\n                }\n                isFocusable() {\n                    return (this.flags & LayoutParams.FLAG_NOT_FOCUSABLE) == 0;\n                }\n                isTouchable() {\n                    return (this.flags & LayoutParams.FLAG_NOT_TOUCHABLE) == 0;\n                }\n                isTouchModal() {\n                    return (this.flags & LayoutParams.FLAG_NOT_TOUCH_MODAL) == 0;\n                }\n                isFloating() {\n                    return (this.flags & LayoutParams.FLAG_FLOATING) != 0;\n                }\n                isSplitTouch() {\n                    return (this.flags & LayoutParams.FLAG_SPLIT_TOUCH) != 0;\n                }\n                isWatchTouchOutside() {\n                    return (this.flags & LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH) != 0;\n                }\n            }\n            LayoutParams.FIRST_APPLICATION_WINDOW = 1;\n            LayoutParams.TYPE_BASE_APPLICATION = 1;\n            LayoutParams.TYPE_APPLICATION = 2;\n            LayoutParams.TYPE_APPLICATION_STARTING = 3;\n            LayoutParams.LAST_APPLICATION_WINDOW = 99;\n            LayoutParams.FIRST_SUB_WINDOW = 1000;\n            LayoutParams.TYPE_APPLICATION_PANEL = LayoutParams.FIRST_SUB_WINDOW;\n            LayoutParams.TYPE_APPLICATION_MEDIA = LayoutParams.FIRST_SUB_WINDOW + 1;\n            LayoutParams.TYPE_APPLICATION_SUB_PANEL = LayoutParams.FIRST_SUB_WINDOW + 2;\n            LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG = LayoutParams.FIRST_SUB_WINDOW + 3;\n            LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY = LayoutParams.FIRST_SUB_WINDOW + 4;\n            LayoutParams.LAST_SUB_WINDOW = 1999;\n            LayoutParams.FIRST_SYSTEM_WINDOW = 2000;\n            LayoutParams.TYPE_STATUS_BAR = LayoutParams.FIRST_SYSTEM_WINDOW;\n            LayoutParams.TYPE_SEARCH_BAR = LayoutParams.FIRST_SYSTEM_WINDOW + 1;\n            LayoutParams.TYPE_PHONE = LayoutParams.FIRST_SYSTEM_WINDOW + 2;\n            LayoutParams.TYPE_SYSTEM_ALERT = LayoutParams.FIRST_SYSTEM_WINDOW + 3;\n            LayoutParams.TYPE_KEYGUARD = LayoutParams.FIRST_SYSTEM_WINDOW + 4;\n            LayoutParams.TYPE_TOAST = LayoutParams.FIRST_SYSTEM_WINDOW + 5;\n            LayoutParams.TYPE_SYSTEM_OVERLAY = LayoutParams.FIRST_SYSTEM_WINDOW + 6;\n            LayoutParams.TYPE_PRIORITY_PHONE = LayoutParams.FIRST_SYSTEM_WINDOW + 7;\n            LayoutParams.TYPE_SYSTEM_DIALOG = LayoutParams.FIRST_SYSTEM_WINDOW + 8;\n            LayoutParams.LAST_SYSTEM_WINDOW = 2999;\n            LayoutParams.FLAG_NOT_FOCUSABLE = 0x00000008;\n            LayoutParams.FLAG_NOT_TOUCHABLE = 0x00000010;\n            LayoutParams.FLAG_NOT_TOUCH_MODAL = 0x00000020;\n            LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;\n            LayoutParams.FLAG_SPLIT_TOUCH = 0x00800000;\n            LayoutParams.FLAG_FLOATING = 0x40000000;\n            LayoutParams.LAYOUT_CHANGED = 1 << 0;\n            LayoutParams.TYPE_CHANGED = 1 << 1;\n            LayoutParams.FLAGS_CHANGED = 1 << 2;\n            LayoutParams.FORMAT_CHANGED = 1 << 3;\n            LayoutParams.ANIMATION_CHANGED = 1 << 4;\n            LayoutParams.DIM_AMOUNT_CHANGED = 1 << 5;\n            LayoutParams.TITLE_CHANGED = 1 << 6;\n            LayoutParams.ALPHA_CHANGED = 1 << 7;\n            WindowManager.LayoutParams = LayoutParams;\n        })(WindowManager = view.WindowManager || (view.WindowManager = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var animation;\n        (function (animation) {\n            var Animation = android.view.animation.Animation;\n            class TranslateAnimation extends Animation {\n                constructor(...args) {\n                    super();\n                    this.mFromXType = TranslateAnimation.ABSOLUTE;\n                    this.mToXType = TranslateAnimation.ABSOLUTE;\n                    this.mFromYType = TranslateAnimation.ABSOLUTE;\n                    this.mToYType = TranslateAnimation.ABSOLUTE;\n                    this.mFromXValue = 0.0;\n                    this.mToXValue = 0.0;\n                    this.mFromYValue = 0.0;\n                    this.mToYValue = 0.0;\n                    this.mFromXDelta = 0;\n                    this.mToXDelta = 0;\n                    this.mFromYDelta = 0;\n                    this.mToYDelta = 0;\n                    if (args.length === 4) {\n                        this.mFromXValue = args[0];\n                        this.mToXValue = args[1];\n                        this.mFromYValue = args[2];\n                        this.mToYValue = args[3];\n                        this.mFromXType = TranslateAnimation.ABSOLUTE;\n                        this.mToXType = TranslateAnimation.ABSOLUTE;\n                        this.mFromYType = TranslateAnimation.ABSOLUTE;\n                        this.mToYType = TranslateAnimation.ABSOLUTE;\n                    }\n                    else {\n                        this.mFromXType = args[0];\n                        this.mFromXValue = args[1];\n                        this.mToXType = args[2];\n                        this.mToXValue = args[3];\n                        this.mFromYType = args[4];\n                        this.mFromYValue = args[5];\n                        this.mToYType = args[6];\n                        this.mToYValue = args[7];\n                    }\n                }\n                applyTransformation(interpolatedTime, t) {\n                    let dx = this.mFromXDelta;\n                    let dy = this.mFromYDelta;\n                    if (this.mFromXDelta != this.mToXDelta) {\n                        dx = this.mFromXDelta + ((this.mToXDelta - this.mFromXDelta) * interpolatedTime);\n                    }\n                    if (this.mFromYDelta != this.mToYDelta) {\n                        dy = this.mFromYDelta + ((this.mToYDelta - this.mFromYDelta) * interpolatedTime);\n                    }\n                    t.getMatrix().setTranslate(dx, dy);\n                }\n                initialize(width, height, parentWidth, parentHeight) {\n                    super.initialize(width, height, parentWidth, parentHeight);\n                    this.mFromXDelta = this.resolveSize(this.mFromXType, this.mFromXValue, width, parentWidth);\n                    this.mToXDelta = this.resolveSize(this.mToXType, this.mToXValue, width, parentWidth);\n                    this.mFromYDelta = this.resolveSize(this.mFromYType, this.mFromYValue, height, parentHeight);\n                    this.mToYDelta = this.resolveSize(this.mToYType, this.mToYValue, height, parentHeight);\n                }\n            }\n            animation.TranslateAnimation = TranslateAnimation;\n        })(animation = view.animation || (view.animation = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var animation;\n        (function (animation) {\n            var Animation = android.view.animation.Animation;\n            class AlphaAnimation extends Animation {\n                constructor(fromAlpha, toAlpha) {\n                    super();\n                    this.mFromAlpha = 0;\n                    this.mToAlpha = 0;\n                    this.mFromAlpha = fromAlpha;\n                    this.mToAlpha = toAlpha;\n                }\n                applyTransformation(interpolatedTime, t) {\n                    const alpha = this.mFromAlpha;\n                    t.setAlpha(alpha + ((this.mToAlpha - alpha) * interpolatedTime));\n                }\n                willChangeTransformationMatrix() {\n                    return false;\n                }\n                willChangeBounds() {\n                    return false;\n                }\n                hasAlpha() {\n                    return true;\n                }\n            }\n            animation.AlphaAnimation = AlphaAnimation;\n        })(animation = view.animation || (view.animation = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var animation;\n        (function (animation) {\n            var Animation = android.view.animation.Animation;\n            class ScaleAnimation extends Animation {\n                constructor(fromX, toX, fromY, toY, pivotXType = ScaleAnimation.ABSOLUTE, pivotXValue = 0, pivotYType = ScaleAnimation.ABSOLUTE, pivotYValue = 0) {\n                    super();\n                    this.mFromX = 0;\n                    this.mToX = 0;\n                    this.mFromY = 0;\n                    this.mToY = 0;\n                    this.mFromXData = 0;\n                    this.mToXData = 0;\n                    this.mFromYData = 0;\n                    this.mToYData = 0;\n                    this.mPivotXType = ScaleAnimation.ABSOLUTE;\n                    this.mPivotYType = ScaleAnimation.ABSOLUTE;\n                    this.mPivotXValue = 0.0;\n                    this.mPivotYValue = 0.0;\n                    this.mPivotX = 0;\n                    this.mPivotY = 0;\n                    this.mResources = null;\n                    this.mFromX = fromX;\n                    this.mToX = toX;\n                    this.mFromY = fromY;\n                    this.mToY = toY;\n                    this.mPivotXValue = pivotXValue;\n                    this.mPivotXType = pivotXType;\n                    this.mPivotYValue = pivotYValue;\n                    this.mPivotYType = pivotYType;\n                    this.initializePivotPoint();\n                }\n                initializePivotPoint() {\n                    if (this.mPivotXType == ScaleAnimation.ABSOLUTE) {\n                        this.mPivotX = this.mPivotXValue;\n                    }\n                    if (this.mPivotYType == ScaleAnimation.ABSOLUTE) {\n                        this.mPivotY = this.mPivotYValue;\n                    }\n                }\n                applyTransformation(interpolatedTime, t) {\n                    let sx = 1.0;\n                    let sy = 1.0;\n                    let scale = this.getScaleFactor();\n                    if (this.mFromX != 1.0 || this.mToX != 1.0) {\n                        sx = this.mFromX + ((this.mToX - this.mFromX) * interpolatedTime);\n                    }\n                    if (this.mFromY != 1.0 || this.mToY != 1.0) {\n                        sy = this.mFromY + ((this.mToY - this.mFromY) * interpolatedTime);\n                    }\n                    if (this.mPivotX == 0 && this.mPivotY == 0) {\n                        t.getMatrix().setScale(sx, sy);\n                    }\n                    else {\n                        t.getMatrix().setScale(sx, sy, scale * this.mPivotX, scale * this.mPivotY);\n                    }\n                }\n                initialize(width, height, parentWidth, parentHeight) {\n                    super.initialize(width, height, parentWidth, parentHeight);\n                    this.mPivotX = this.resolveSize(this.mPivotXType, this.mPivotXValue, width, parentWidth);\n                    this.mPivotY = this.resolveSize(this.mPivotYType, this.mPivotYValue, height, parentHeight);\n                }\n            }\n            animation.ScaleAnimation = ScaleAnimation;\n        })(animation = view.animation || (view.animation = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var animation;\n        (function (animation) {\n            var ArrayList = java.util.ArrayList;\n            var Long = java.lang.Long;\n            var Animation = android.view.animation.Animation;\n            var Transformation = android.view.animation.Transformation;\n            class AnimationSet extends Animation {\n                constructor(shareInterpolator = false) {\n                    super();\n                    this.mFlags = 0;\n                    this.mAnimations = new ArrayList();\n                    this.mTempTransformation = new Transformation();\n                    this.mLastEnd = 0;\n                    this.setFlag(AnimationSet.PROPERTY_SHARE_INTERPOLATOR_MASK, shareInterpolator);\n                    this.init();\n                }\n                setFlag(mask, value) {\n                    if (value) {\n                        this.mFlags |= mask;\n                    }\n                    else {\n                        this.mFlags &= ~mask;\n                    }\n                }\n                init() {\n                    this.mStartTime = 0;\n                }\n                setFillAfter(fillAfter) {\n                    this.mFlags |= AnimationSet.PROPERTY_FILL_AFTER_MASK;\n                    super.setFillAfter(fillAfter);\n                }\n                setFillBefore(fillBefore) {\n                    this.mFlags |= AnimationSet.PROPERTY_FILL_BEFORE_MASK;\n                    super.setFillBefore(fillBefore);\n                }\n                setRepeatMode(repeatMode) {\n                    this.mFlags |= AnimationSet.PROPERTY_REPEAT_MODE_MASK;\n                    super.setRepeatMode(repeatMode);\n                }\n                setStartOffset(startOffset) {\n                    this.mFlags |= AnimationSet.PROPERTY_START_OFFSET_MASK;\n                    super.setStartOffset(startOffset);\n                }\n                hasAlpha() {\n                    if (this.mDirty) {\n                        this.mDirty = this.mHasAlpha = false;\n                        const count = this.mAnimations.size();\n                        const animations = this.mAnimations;\n                        for (let i = 0; i < count; i++) {\n                            if (animations.get(i).hasAlpha()) {\n                                this.mHasAlpha = true;\n                                break;\n                            }\n                        }\n                    }\n                    return this.mHasAlpha;\n                }\n                setDuration(durationMillis) {\n                    this.mFlags |= AnimationSet.PROPERTY_DURATION_MASK;\n                    super.setDuration(durationMillis);\n                    this.mLastEnd = this.mStartOffset + this.mDuration;\n                }\n                addAnimation(a) {\n                    this.mAnimations.add(a);\n                    let noMatrix = (this.mFlags & AnimationSet.PROPERTY_MORPH_MATRIX_MASK) == 0;\n                    if (noMatrix && a.willChangeTransformationMatrix()) {\n                        this.mFlags |= AnimationSet.PROPERTY_MORPH_MATRIX_MASK;\n                    }\n                    let changeBounds = (this.mFlags & AnimationSet.PROPERTY_CHANGE_BOUNDS_MASK) == 0;\n                    if (changeBounds && a.willChangeBounds()) {\n                        this.mFlags |= AnimationSet.PROPERTY_CHANGE_BOUNDS_MASK;\n                    }\n                    if ((this.mFlags & AnimationSet.PROPERTY_DURATION_MASK) == AnimationSet.PROPERTY_DURATION_MASK) {\n                        this.mLastEnd = this.mStartOffset + this.mDuration;\n                    }\n                    else {\n                        if (this.mAnimations.size() == 1) {\n                            this.mDuration = a.getStartOffset() + a.getDuration();\n                            this.mLastEnd = this.mStartOffset + this.mDuration;\n                        }\n                        else {\n                            this.mLastEnd = Math.max(this.mLastEnd, a.getStartOffset() + a.getDuration());\n                            this.mDuration = this.mLastEnd - this.mStartOffset;\n                        }\n                    }\n                    this.mDirty = true;\n                }\n                setStartTime(startTimeMillis) {\n                    super.setStartTime(startTimeMillis);\n                    const count = this.mAnimations.size();\n                    const animations = this.mAnimations;\n                    for (let i = 0; i < count; i++) {\n                        let a = animations.get(i);\n                        a.setStartTime(startTimeMillis);\n                    }\n                }\n                getStartTime() {\n                    let startTime = Long.MAX_VALUE;\n                    const count = this.mAnimations.size();\n                    const animations = this.mAnimations;\n                    for (let i = 0; i < count; i++) {\n                        let a = animations.get(i);\n                        startTime = Math.min(startTime, a.getStartTime());\n                    }\n                    return startTime;\n                }\n                restrictDuration(durationMillis) {\n                    super.restrictDuration(durationMillis);\n                    const animations = this.mAnimations;\n                    let count = animations.size();\n                    for (let i = 0; i < count; i++) {\n                        animations.get(i).restrictDuration(durationMillis);\n                    }\n                }\n                getDuration() {\n                    const animations = this.mAnimations;\n                    const count = animations.size();\n                    let duration = 0;\n                    let durationSet = (this.mFlags & AnimationSet.PROPERTY_DURATION_MASK) == AnimationSet.PROPERTY_DURATION_MASK;\n                    if (durationSet) {\n                        duration = this.mDuration;\n                    }\n                    else {\n                        for (let i = 0; i < count; i++) {\n                            duration = Math.max(duration, animations.get(i).getDuration());\n                        }\n                    }\n                    return duration;\n                }\n                computeDurationHint() {\n                    let duration = 0;\n                    const count = this.mAnimations.size();\n                    const animations = this.mAnimations;\n                    for (let i = count - 1; i >= 0; --i) {\n                        const d = animations.get(i).computeDurationHint();\n                        if (d > duration)\n                            duration = d;\n                    }\n                    return duration;\n                }\n                initializeInvalidateRegion(left, top, right, bottom) {\n                    const region = this.mPreviousRegion;\n                    region.set(left, top, right, bottom);\n                    region.inset(-1.0, -1.0);\n                    if (this.mFillBefore) {\n                        const count = this.mAnimations.size();\n                        const animations = this.mAnimations;\n                        const temp = this.mTempTransformation;\n                        const previousTransformation = this.mPreviousTransformation;\n                        for (let i = count - 1; i >= 0; --i) {\n                            const a = animations.get(i);\n                            if (!a.isFillEnabled() || a.getFillBefore() || a.getStartOffset() == 0) {\n                                temp.clear();\n                                const interpolator = a.mInterpolator;\n                                a.applyTransformation(interpolator != null ? interpolator.getInterpolation(0.0) : 0.0, temp);\n                                previousTransformation.compose(temp);\n                            }\n                        }\n                    }\n                }\n                getTransformation(currentTime, t) {\n                    const count = this.mAnimations.size();\n                    const animations = this.mAnimations;\n                    const temp = this.mTempTransformation;\n                    let more = false;\n                    let started = false;\n                    let ended = true;\n                    t.clear();\n                    for (let i = count - 1; i >= 0; --i) {\n                        const a = animations.get(i);\n                        temp.clear();\n                        more = a.getTransformation(currentTime, temp, this.getScaleFactor()) || more;\n                        t.compose(temp);\n                        started = started || a.hasStarted();\n                        ended = a.hasEnded() && ended;\n                    }\n                    if (started && !this.mStarted) {\n                        if (this.mListener != null) {\n                            this.mListener.onAnimationStart(this);\n                        }\n                        this.mStarted = true;\n                    }\n                    if (ended != this.mEnded) {\n                        if (this.mListener != null) {\n                            this.mListener.onAnimationEnd(this);\n                        }\n                        this.mEnded = ended;\n                    }\n                    return more;\n                }\n                scaleCurrentDuration(scale) {\n                    const animations = this.mAnimations;\n                    let count = animations.size();\n                    for (let i = 0; i < count; i++) {\n                        animations.get(i).scaleCurrentDuration(scale);\n                    }\n                }\n                initialize(width, height, parentWidth, parentHeight) {\n                    super.initialize(width, height, parentWidth, parentHeight);\n                    let durationSet = (this.mFlags & AnimationSet.PROPERTY_DURATION_MASK) == AnimationSet.PROPERTY_DURATION_MASK;\n                    let fillAfterSet = (this.mFlags & AnimationSet.PROPERTY_FILL_AFTER_MASK) == AnimationSet.PROPERTY_FILL_AFTER_MASK;\n                    let fillBeforeSet = (this.mFlags & AnimationSet.PROPERTY_FILL_BEFORE_MASK) == AnimationSet.PROPERTY_FILL_BEFORE_MASK;\n                    let repeatModeSet = (this.mFlags & AnimationSet.PROPERTY_REPEAT_MODE_MASK) == AnimationSet.PROPERTY_REPEAT_MODE_MASK;\n                    let shareInterpolator = (this.mFlags & AnimationSet.PROPERTY_SHARE_INTERPOLATOR_MASK) == AnimationSet.PROPERTY_SHARE_INTERPOLATOR_MASK;\n                    let startOffsetSet = (this.mFlags & AnimationSet.PROPERTY_START_OFFSET_MASK) == AnimationSet.PROPERTY_START_OFFSET_MASK;\n                    if (shareInterpolator) {\n                        this.ensureInterpolator();\n                    }\n                    const children = this.mAnimations;\n                    const count = children.size();\n                    const duration = this.mDuration;\n                    const fillAfter = this.mFillAfter;\n                    const fillBefore = this.mFillBefore;\n                    const repeatMode = this.mRepeatMode;\n                    const interpolator = this.mInterpolator;\n                    const startOffset = this.mStartOffset;\n                    let storedOffsets = this.mStoredOffsets;\n                    if (startOffsetSet) {\n                        if (storedOffsets == null || storedOffsets.length != count) {\n                            storedOffsets = this.mStoredOffsets = androidui.util.ArrayCreator.newNumberArray(count);\n                        }\n                    }\n                    else if (storedOffsets != null) {\n                        storedOffsets = this.mStoredOffsets = null;\n                    }\n                    for (let i = 0; i < count; i++) {\n                        let a = children.get(i);\n                        if (durationSet) {\n                            a.setDuration(duration);\n                        }\n                        if (fillAfterSet) {\n                            a.setFillAfter(fillAfter);\n                        }\n                        if (fillBeforeSet) {\n                            a.setFillBefore(fillBefore);\n                        }\n                        if (repeatModeSet) {\n                            a.setRepeatMode(repeatMode);\n                        }\n                        if (shareInterpolator) {\n                            a.setInterpolator(interpolator);\n                        }\n                        if (startOffsetSet) {\n                            let offset = a.getStartOffset();\n                            a.setStartOffset(offset + startOffset);\n                            storedOffsets[i] = offset;\n                        }\n                        a.initialize(width, height, parentWidth, parentHeight);\n                    }\n                }\n                reset() {\n                    super.reset();\n                    this.restoreChildrenStartOffset();\n                }\n                restoreChildrenStartOffset() {\n                    const offsets = this.mStoredOffsets;\n                    if (offsets == null)\n                        return;\n                    const children = this.mAnimations;\n                    const count = children.size();\n                    for (let i = 0; i < count; i++) {\n                        children.get(i).setStartOffset(offsets[i]);\n                    }\n                }\n                getAnimations() {\n                    return this.mAnimations;\n                }\n                willChangeTransformationMatrix() {\n                    return (this.mFlags & AnimationSet.PROPERTY_MORPH_MATRIX_MASK) == AnimationSet.PROPERTY_MORPH_MATRIX_MASK;\n                }\n                willChangeBounds() {\n                    return (this.mFlags & AnimationSet.PROPERTY_CHANGE_BOUNDS_MASK) == AnimationSet.PROPERTY_CHANGE_BOUNDS_MASK;\n                }\n            }\n            AnimationSet.PROPERTY_FILL_AFTER_MASK = 0x1;\n            AnimationSet.PROPERTY_FILL_BEFORE_MASK = 0x2;\n            AnimationSet.PROPERTY_REPEAT_MODE_MASK = 0x4;\n            AnimationSet.PROPERTY_START_OFFSET_MASK = 0x8;\n            AnimationSet.PROPERTY_SHARE_INTERPOLATOR_MASK = 0x10;\n            AnimationSet.PROPERTY_DURATION_MASK = 0x20;\n            AnimationSet.PROPERTY_MORPH_MATRIX_MASK = 0x40;\n            AnimationSet.PROPERTY_CHANGE_BOUNDS_MASK = 0x80;\n            animation.AnimationSet = AnimationSet;\n        })(animation = view.animation || (view.animation = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var animation;\n        (function (animation) {\n            class AccelerateInterpolator {\n                constructor(factor = 1) {\n                    this.mFactor = factor;\n                    this.mDoubleFactor = factor * 2;\n                }\n                getInterpolation(input) {\n                    if (this.mFactor == 1.0) {\n                        return input * input;\n                    }\n                    else {\n                        return Math.pow(input, this.mDoubleFactor);\n                    }\n                }\n            }\n            animation.AccelerateInterpolator = AccelerateInterpolator;\n        })(animation = view.animation || (view.animation = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var animation;\n        (function (animation) {\n            class AnticipateInterpolator {\n                constructor(tension = 2) {\n                    this.mTension = tension;\n                }\n                getInterpolation(t) {\n                    return t * t * ((this.mTension + 1) * t - this.mTension);\n                }\n            }\n            animation.AnticipateInterpolator = AnticipateInterpolator;\n        })(animation = view.animation || (view.animation = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var animation;\n        (function (animation) {\n            class AnticipateOvershootInterpolator {\n                constructor(tension = 2, extraTension = 1.5) {\n                    this.mTension = tension * extraTension;\n                }\n                static a(t, s) {\n                    return t * t * ((s + 1) * t - s);\n                }\n                static o(t, s) {\n                    return t * t * ((s + 1) * t + s);\n                }\n                getInterpolation(t) {\n                    if (t < 0.5)\n                        return 0.5 * AnticipateOvershootInterpolator.a(t * 2.0, this.mTension);\n                    else\n                        return 0.5 * (AnticipateOvershootInterpolator.o(t * 2.0 - 2.0, this.mTension) + 2.0);\n                }\n            }\n            animation.AnticipateOvershootInterpolator = AnticipateOvershootInterpolator;\n        })(animation = view.animation || (view.animation = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var animation;\n        (function (animation) {\n            class BounceInterpolator {\n                static bounce(t) {\n                    return t * t * 8.0;\n                }\n                getInterpolation(t) {\n                    t *= 1.1226;\n                    if (t < 0.3535)\n                        return BounceInterpolator.bounce(t);\n                    else if (t < 0.7408)\n                        return BounceInterpolator.bounce(t - 0.54719) + 0.7;\n                    else if (t < 0.9644)\n                        return BounceInterpolator.bounce(t - 0.8526) + 0.9;\n                    else\n                        return BounceInterpolator.bounce(t - 1.0435) + 0.95;\n                }\n            }\n            animation.BounceInterpolator = BounceInterpolator;\n        })(animation = view.animation || (view.animation = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var animation;\n        (function (animation) {\n            class CycleInterpolator {\n                constructor(mCycles) {\n                    this.mCycles = mCycles;\n                }\n                getInterpolation(input) {\n                    return (Math.sin(2 * this.mCycles * Math.PI * input));\n                }\n            }\n            animation.CycleInterpolator = CycleInterpolator;\n        })(animation = view.animation || (view.animation = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var animation;\n        (function (animation) {\n            class OvershootInterpolator {\n                constructor(tension = 2) {\n                    this.mTension = tension;\n                }\n                getInterpolation(t) {\n                    t -= 1.0;\n                    return t * t * ((this.mTension + 1) * t + this.mTension) + 1.0;\n                }\n            }\n            animation.OvershootInterpolator = OvershootInterpolator;\n        })(animation = view.animation || (view.animation = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var R;\n    (function (R) {\n        var AccelerateDecelerateInterpolator = android.view.animation.AccelerateDecelerateInterpolator;\n        var AccelerateInterpolator = android.view.animation.AccelerateInterpolator;\n        var AnticipateInterpolator = android.view.animation.AnticipateInterpolator;\n        var AnticipateOvershootInterpolator = android.view.animation.AnticipateOvershootInterpolator;\n        var BounceInterpolator = android.view.animation.BounceInterpolator;\n        var CycleInterpolator = android.view.animation.CycleInterpolator;\n        var DecelerateInterpolator = android.view.animation.DecelerateInterpolator;\n        var LinearInterpolator = android.view.animation.LinearInterpolator;\n        var OvershootInterpolator = android.view.animation.OvershootInterpolator;\n        class interpolator {\n        }\n        interpolator.accelerate_cubic = new AccelerateInterpolator(1.5);\n        interpolator.accelerate_decelerate = new AccelerateDecelerateInterpolator();\n        interpolator.accelerate_quad = new AccelerateInterpolator();\n        interpolator.accelerate_quint = new AccelerateInterpolator(2.5);\n        interpolator.anticipate_overshoot = new AnticipateOvershootInterpolator();\n        interpolator.anticipate = new AnticipateInterpolator();\n        interpolator.bounce = new BounceInterpolator();\n        interpolator.cycle = new CycleInterpolator(1);\n        interpolator.decelerate_cubic = new DecelerateInterpolator(1.5);\n        interpolator.decelerate_quad = new DecelerateInterpolator();\n        interpolator.decelerate_quint = new DecelerateInterpolator(2.5);\n        interpolator.linear = new LinearInterpolator();\n        interpolator.overshoot = new OvershootInterpolator();\n        R.interpolator = interpolator;\n    })(R = android.R || (android.R = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var R;\n    (function (R) {\n        var Animation = android.view.animation.Animation;\n        var AlphaAnimation = android.view.animation.AlphaAnimation;\n        var TranslateAnimation = android.view.animation.TranslateAnimation;\n        var ScaleAnimation = android.view.animation.ScaleAnimation;\n        var AnimationSet = android.view.animation.AnimationSet;\n        class anim {\n            static get activity_close_enter() {\n                let alpha = new AlphaAnimation(1, 1);\n                alpha.setDuration(300);\n                alpha.setFillBefore(true);\n                alpha.setFillEnabled(true);\n                alpha.setFillAfter(true);\n                return alpha;\n            }\n            static get activity_close_exit() {\n                let animSet = new AnimationSet();\n                let alpha = new AlphaAnimation(1, 0);\n                alpha.setDuration(300);\n                alpha.setFillBefore(true);\n                alpha.setFillEnabled(true);\n                alpha.setFillAfter(true);\n                alpha.setInterpolator(R.interpolator.decelerate_cubic);\n                let scale = new ScaleAnimation(1, 0.8, 1, 0.8, Animation.RELATIVE_TO_PARENT, 0.5, Animation.RELATIVE_TO_PARENT, 0.5);\n                scale.setDuration(300);\n                scale.setFillBefore(true);\n                scale.setFillEnabled(true);\n                scale.setFillAfter(true);\n                scale.setInterpolator(R.interpolator.decelerate_cubic);\n                animSet.addAnimation(alpha);\n                animSet.addAnimation(scale);\n                return animSet;\n            }\n            static get activity_open_enter() {\n                let animSet = new AnimationSet();\n                let alpha = new AlphaAnimation(0, 1);\n                alpha.setDuration(300);\n                alpha.setFillBefore(false);\n                alpha.setFillEnabled(true);\n                alpha.setFillAfter(true);\n                alpha.setInterpolator(R.interpolator.decelerate_cubic);\n                let scale = new ScaleAnimation(0.8, 1, 0.8, 1, Animation.RELATIVE_TO_PARENT, 0.5, Animation.RELATIVE_TO_PARENT, 0.5);\n                scale.setDuration(300);\n                scale.setFillBefore(false);\n                scale.setFillEnabled(true);\n                scale.setFillAfter(true);\n                scale.setInterpolator(R.interpolator.decelerate_cubic);\n                animSet.addAnimation(alpha);\n                animSet.addAnimation(scale);\n                return animSet;\n            }\n            static get activity_open_exit() {\n                let alpha = new AlphaAnimation(1, 0);\n                alpha.setDuration(300);\n                alpha.setFillBefore(false);\n                alpha.setFillEnabled(true);\n                alpha.setFillAfter(true);\n                alpha.setInterpolator(R.interpolator.decelerate_quint);\n                return alpha;\n            }\n            static get activity_close_enter_ios() {\n                let anim = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, -0.25, Animation.RELATIVE_TO_PARENT, 0, 0, 0, 0, 0);\n                anim.setDuration(300);\n                return anim;\n            }\n            static get activity_close_exit_ios() {\n                let anim = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 1, 0, 0, 0, 0);\n                anim.setDuration(300);\n                return anim;\n            }\n            static get activity_open_enter_ios() {\n                let anim = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 1, Animation.RELATIVE_TO_PARENT, 0, 0, 0, 0, 0);\n                anim.setDuration(300);\n                return anim;\n            }\n            static get activity_open_exit_ios() {\n                let anim = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, -0.25, 0, 0, 0, 0);\n                anim.setDuration(300);\n                return anim;\n            }\n            static get dialog_enter() {\n                let animSet = new AnimationSet();\n                let alpha = new AlphaAnimation(0, 1);\n                alpha.setDuration(150);\n                alpha.setInterpolator(R.interpolator.decelerate_cubic);\n                let scale = new ScaleAnimation(0.9, 1, 0.9, 1, Animation.RELATIVE_TO_SELF, 0.5, Animation.RELATIVE_TO_SELF, 0.5);\n                scale.setDuration(220);\n                scale.setInterpolator(R.interpolator.decelerate_quint);\n                animSet.addAnimation(scale);\n                animSet.addAnimation(alpha);\n                return animSet;\n            }\n            static get dialog_exit() {\n                let animSet = new AnimationSet();\n                let alpha = new AlphaAnimation(1, 0);\n                alpha.setDuration(150);\n                alpha.setInterpolator(R.interpolator.decelerate_cubic);\n                let scale = new ScaleAnimation(1, 0.9, 1, 0.9, Animation.RELATIVE_TO_SELF, 0.5, Animation.RELATIVE_TO_SELF, 0.5);\n                scale.setDuration(220);\n                scale.setInterpolator(R.interpolator.decelerate_quint);\n                animSet.addAnimation(scale);\n                animSet.addAnimation(alpha);\n                return animSet;\n            }\n            static get fade_in() {\n                let alpha = new AlphaAnimation(0, 1);\n                alpha.setDuration(500);\n                alpha.setInterpolator(R.interpolator.decelerate_quad);\n                return alpha;\n            }\n            static get fade_out() {\n                let alpha = new AlphaAnimation(1, 0);\n                alpha.setDuration(400);\n                alpha.setInterpolator(R.interpolator.accelerate_quad);\n                return alpha;\n            }\n            static get toast_enter() {\n                let alpha = new AlphaAnimation(0, 1);\n                alpha.setDuration(500);\n                alpha.setInterpolator(R.interpolator.decelerate_quad);\n                return alpha;\n            }\n            static get toast_exit() {\n                let alpha = new AlphaAnimation(1, 0);\n                alpha.setDuration(500);\n                alpha.setInterpolator(R.interpolator.accelerate_quad);\n                return alpha;\n            }\n            static get grow_fade_in() {\n                let animSet = new AnimationSet();\n                let alpha = new AlphaAnimation(0, 1);\n                alpha.setDuration(150);\n                alpha.setInterpolator(R.interpolator.decelerate_cubic);\n                let scale = new ScaleAnimation(0.9, 1, 0.9, 1, Animation.RELATIVE_TO_SELF, 0.5, Animation.RELATIVE_TO_SELF, 0);\n                scale.setDuration(220);\n                scale.setInterpolator(R.interpolator.decelerate_quint);\n                animSet.addAnimation(scale);\n                animSet.addAnimation(alpha);\n                return animSet;\n            }\n            static get grow_fade_in_center() {\n                let animSet = new AnimationSet();\n                let alpha = new AlphaAnimation(0, 1);\n                alpha.setDuration(150);\n                alpha.setInterpolator(R.interpolator.decelerate_cubic);\n                let scale = new ScaleAnimation(0.9, 1, 0.9, 1, Animation.RELATIVE_TO_SELF, 0.5, Animation.RELATIVE_TO_SELF, 0.5);\n                scale.setDuration(220);\n                scale.setInterpolator(R.interpolator.decelerate_quint);\n                animSet.addAnimation(scale);\n                animSet.addAnimation(alpha);\n                return animSet;\n            }\n            static get grow_fade_in_from_bottom() {\n                let animSet = new AnimationSet();\n                let alpha = new AlphaAnimation(0, 1);\n                alpha.setDuration(150);\n                alpha.setInterpolator(R.interpolator.decelerate_cubic);\n                let scale = new ScaleAnimation(0.9, 1, 0.9, 1, Animation.RELATIVE_TO_SELF, 0.5, Animation.RELATIVE_TO_SELF, 1);\n                scale.setDuration(220);\n                scale.setInterpolator(R.interpolator.decelerate_quint);\n                animSet.addAnimation(scale);\n                animSet.addAnimation(alpha);\n                return animSet;\n            }\n            static get shrink_fade_out() {\n                let animSet = new AnimationSet();\n                let alpha = new AlphaAnimation(1, 0);\n                alpha.setDuration(150);\n                alpha.setInterpolator(R.interpolator.decelerate_cubic);\n                let scale = new ScaleAnimation(1, 0.9, 1, 0.9, Animation.RELATIVE_TO_SELF, 0.5, Animation.RELATIVE_TO_SELF, 0);\n                scale.setDuration(220);\n                scale.setInterpolator(R.interpolator.decelerate_quint);\n                animSet.addAnimation(scale);\n                animSet.addAnimation(alpha);\n                return animSet;\n            }\n            static get shrink_fade_out_center() {\n                let animSet = new AnimationSet();\n                let alpha = new AlphaAnimation(1, 0);\n                alpha.setDuration(150);\n                alpha.setInterpolator(R.interpolator.decelerate_cubic);\n                let scale = new ScaleAnimation(1, 0.9, 1, 0.9, Animation.RELATIVE_TO_SELF, 0.5, Animation.RELATIVE_TO_SELF, 0.5);\n                scale.setDuration(220);\n                scale.setInterpolator(R.interpolator.decelerate_quint);\n                animSet.addAnimation(scale);\n                animSet.addAnimation(alpha);\n                return animSet;\n            }\n            static get shrink_fade_out_from_bottom() {\n                let animSet = new AnimationSet();\n                let alpha = new AlphaAnimation(1, 0);\n                alpha.setDuration(150);\n                alpha.setInterpolator(R.interpolator.decelerate_cubic);\n                let scale = new ScaleAnimation(1, 0.9, 1, 0.9, Animation.RELATIVE_TO_SELF, 0.5, Animation.RELATIVE_TO_SELF, 1);\n                scale.setDuration(220);\n                scale.setInterpolator(R.interpolator.decelerate_quint);\n                animSet.addAnimation(scale);\n                animSet.addAnimation(alpha);\n                return animSet;\n            }\n        }\n        R.anim = anim;\n    })(R = android.R || (android.R = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view_5) {\n        var MotionEvent = android.view.MotionEvent;\n        var View = android.view.View;\n        var ViewConfiguration = android.view.ViewConfiguration;\n        var WindowManager = android.view.WindowManager;\n        var FrameLayout = android.widget.FrameLayout;\n        class Window {\n            constructor(context) {\n                this.mIsActive = false;\n                this.mCloseOnTouchOutside = false;\n                this.mSetCloseOnTouchOutside = false;\n                this.mWindowAttributes = new WindowManager.LayoutParams();\n                this.mContext = context;\n                this.initDecorView();\n                this.initAttachInfo();\n                this.getAttributes().setTitle(context.androidUI.appName);\n            }\n            initDecorView() {\n                this.mDecor = new DecorView(this);\n                this.mContentParent = new FrameLayout(this.mContext);\n                this.mContentParent.setId(android.R.id.content);\n                this.mDecor.addView(this.mContentParent, -1, -1);\n            }\n            initAttachInfo() {\n                let viewRootImpl = this.mContext.androidUI._viewRootImpl;\n                this.mAttachInfo = new View.AttachInfo(viewRootImpl, viewRootImpl.mHandler);\n                this.mAttachInfo.mRootView = this.mDecor;\n                this.mAttachInfo.mHasWindowFocus = true;\n            }\n            getContext() {\n                return this.mContext;\n            }\n            setContainer(container) {\n                this.mContainer = container;\n            }\n            getContainer() {\n                return this.mContainer;\n            }\n            destroy() {\n                this.mDestroyed = true;\n            }\n            isDestroyed() {\n                return this.mDestroyed;\n            }\n            setChildWindowManager(wm) {\n                if (this.mChildWindowManager) {\n                    this.mDecor.removeView(this.mChildWindowManager.getWindowsLayout());\n                }\n                this.mChildWindowManager = wm;\n            }\n            getChildWindowManager() {\n                if (!this.mChildWindowManager) {\n                    this.mChildWindowManager = new WindowManager(this.mContext);\n                    this.mDecor.addView(this.mChildWindowManager.getWindowsLayout(), -1, -1);\n                }\n                return this.mChildWindowManager;\n            }\n            setCallback(callback) {\n                this.mCallback = callback;\n            }\n            getCallback() {\n                return this.mCallback;\n            }\n            setFloating(isFloating) {\n                const attrs = this.getAttributes();\n                if (isFloating === attrs.isFloating())\n                    return;\n                if (isFloating)\n                    attrs.flags |= WindowManager.LayoutParams.FLAG_FLOATING;\n                else\n                    attrs.flags &= ~WindowManager.LayoutParams.FLAG_FLOATING;\n                if (this.mCallback != null) {\n                    this.mCallback.onWindowAttributesChanged(attrs);\n                }\n            }\n            isFloating() {\n                return this.mWindowAttributes.isFloating();\n            }\n            setLayout(width, height) {\n                const attrs = this.getAttributes();\n                attrs.width = width;\n                attrs.height = height;\n                if (this.mCallback != null) {\n                    this.mCallback.onWindowAttributesChanged(attrs);\n                }\n            }\n            setGravity(gravity) {\n                const attrs = this.getAttributes();\n                attrs.gravity = gravity;\n                if (this.mCallback != null) {\n                    this.mCallback.onWindowAttributesChanged(attrs);\n                }\n            }\n            setType(type) {\n                const attrs = this.getAttributes();\n                attrs.type = type;\n                if (this.mCallback != null) {\n                    this.mCallback.onWindowAttributesChanged(attrs);\n                }\n            }\n            setWindowAnimations(enterAnimation, exitAnimation, resumeAnimation = this.mWindowAttributes.resumeAnimation, hideAnimation = this.mWindowAttributes.hideAnimation) {\n                const attrs = this.getAttributes();\n                attrs.enterAnimation = enterAnimation;\n                attrs.exitAnimation = exitAnimation;\n                attrs.resumeAnimation = resumeAnimation;\n                attrs.hideAnimation = hideAnimation;\n                if (this.mCallback != null) {\n                    this.mCallback.onWindowAttributesChanged(attrs);\n                }\n            }\n            addFlags(flags) {\n                this.setFlags(flags, flags);\n            }\n            clearFlags(flags) {\n                this.setFlags(0, flags);\n            }\n            setFlags(flags, mask) {\n                const attrs = this.getAttributes();\n                attrs.flags = (attrs.flags & ~mask) | (flags & mask);\n                if (this.mCallback != null) {\n                    this.mCallback.onWindowAttributesChanged(attrs);\n                }\n            }\n            setDimAmount(amount) {\n                const attrs = this.getAttributes();\n                attrs.dimAmount = amount;\n                if (this.mCallback != null) {\n                    this.mCallback.onWindowAttributesChanged(attrs);\n                }\n            }\n            setAttributes(a) {\n                this.mWindowAttributes.copyFrom(a);\n                if (this.mCallback != null) {\n                    this.mCallback.onWindowAttributesChanged(this.mWindowAttributes);\n                }\n            }\n            getAttributes() {\n                return this.mWindowAttributes;\n            }\n            setCloseOnTouchOutside(close) {\n                this.mCloseOnTouchOutside = close;\n                this.mSetCloseOnTouchOutside = true;\n            }\n            setCloseOnTouchOutsideIfNotSet(close) {\n                if (!this.mSetCloseOnTouchOutside) {\n                    this.mCloseOnTouchOutside = close;\n                    this.mSetCloseOnTouchOutside = true;\n                }\n            }\n            shouldCloseOnTouch(context, event) {\n                if (this.mCloseOnTouchOutside && event.getAction() == MotionEvent.ACTION_DOWN && this.isOutOfBounds(context, event) && this.peekDecorView() != null) {\n                    return true;\n                }\n                return false;\n            }\n            isOutOfBounds(context, event) {\n                const x = Math.floor(event.getX());\n                const y = Math.floor(event.getY());\n                const slop = ViewConfiguration.get(context).getScaledWindowTouchSlop();\n                const decorView = this.getDecorView();\n                return (x < -slop) || (y < -slop) || (x > (decorView.getWidth() + slop)) || (y > (decorView.getHeight() + slop));\n            }\n            makeActive() {\n                if (this.mContainer != null) {\n                    if (this.mContainer.mActiveWindow != null) {\n                        this.mContainer.mActiveWindow.mIsActive = false;\n                    }\n                    this.mContainer.mActiveWindow = this;\n                }\n                this.mIsActive = true;\n                this.onActive();\n            }\n            isActive() {\n                return this.mIsActive;\n            }\n            findViewById(id) {\n                return this.getDecorView().findViewById(id);\n            }\n            setContentView(view, params) {\n                this.mContentParent.removeAllViews();\n                this.addContentView(view, params);\n            }\n            addContentView(view, params) {\n                if (params) {\n                    this.mContentParent.addView(view, params);\n                }\n                else {\n                    this.mContentParent.addView(view);\n                }\n                let cb = this.getCallback();\n                if (cb != null && !this.isDestroyed()) {\n                    cb.onContentChanged();\n                }\n            }\n            getContentParent() {\n                return this.mContentParent;\n            }\n            getCurrentFocus() {\n                return this.mDecor != null ? this.mDecor.findFocus() : null;\n            }\n            getLayoutInflater() {\n                return this.mContext.getLayoutInflater();\n            }\n            setTitle(title) {\n                this.mDecor.bindElement.setAttribute('title', title);\n                this.getAttributes().setTitle(title);\n            }\n            setBackgroundDrawable(drawable) {\n                if (this.mDecor != null) {\n                    this.mDecor.setBackground(drawable);\n                }\n            }\n            setBackgroundColor(color) {\n                if (this.mDecor != null) {\n                    this.mDecor.setBackgroundColor(color);\n                }\n            }\n            takeKeyEvents(_get) {\n                this.mDecor.setFocusable(_get);\n            }\n            superDispatchKeyEvent(event) {\n                return this.mDecor.superDispatchKeyEvent(event);\n            }\n            superDispatchTouchEvent(event) {\n                return this.mDecor.superDispatchTouchEvent(event);\n            }\n            superDispatchGenericMotionEvent(event) {\n                return this.mDecor.superDispatchGenericMotionEvent(event);\n            }\n            getDecorView() {\n                return this.mDecor;\n            }\n            peekDecorView() {\n                return this.mDecor;\n            }\n            onActive() {\n            }\n        }\n        view_5.Window = Window;\n        class DecorView extends FrameLayout {\n            constructor(window) {\n                super(window.mContext);\n                this._ignoreRequestLayoutInAnimation = true;\n                this._pendingRequestLayoutOnAnimationEnd = false;\n                this._ignoreInvalidateInAnimation = true;\n                this._pendingInvalidateOnAnimationEnd = false;\n                this.Window_this = window;\n                this.bindElement.classList.add(window.mContext.constructor.name);\n                this.setBackgroundColor(android.graphics.Color.WHITE);\n                this.setIsRootNamespace(true);\n            }\n            invalidate(...args) {\n                if (this._ignoreInvalidateInAnimation && this.getAnimation()) {\n                    this._pendingInvalidateOnAnimationEnd = true;\n                    return null;\n                }\n                super.invalidate.call(this, ...args);\n            }\n            invalidateChild(child, dirty) {\n                if (this._ignoreInvalidateInAnimation && this.getAnimation()) {\n                    this._pendingInvalidateOnAnimationEnd = true;\n                    return null;\n                }\n                super.invalidateChild(child, dirty);\n            }\n            invalidateChildFast(child, dirty) {\n                if (this._ignoreInvalidateInAnimation && this.getAnimation()) {\n                    this._pendingInvalidateOnAnimationEnd = true;\n                    return null;\n                }\n                super.invalidateChildFast(child, dirty);\n            }\n            requestLayout() {\n                if (this._ignoreRequestLayoutInAnimation && this.getAnimation()) {\n                    this._pendingRequestLayoutOnAnimationEnd = true;\n                    return null;\n                }\n                super.requestLayout();\n            }\n            onAnimationStart() {\n                super.onAnimationStart();\n                this.setDrawingCacheEnabled(true);\n                this.buildDrawingCache(true);\n            }\n            onAnimationEnd() {\n                super.onAnimationEnd();\n                this.setDrawingCacheEnabled(false);\n                if (this._pendingInvalidateOnAnimationEnd) {\n                    this._pendingInvalidateOnAnimationEnd = false;\n                    this.invalidate();\n                }\n                if (this._pendingRequestLayoutOnAnimationEnd) {\n                    this._pendingRequestLayoutOnAnimationEnd = false;\n                    this.requestLayout();\n                }\n            }\n            buildDrawingCache(autoScale = false) {\n                if (this.getAnimation() && this.mUnscaledDrawingCache)\n                    return;\n                super.buildDrawingCache(autoScale);\n            }\n            drawFromParent(canvas, parent, drawingTime) {\n                let windowAnimation = this.getAnimation();\n                let wparams = this.getLayoutParams();\n                let shadowAlpha = wparams.dimAmount * 255;\n                if (windowAnimation != null && shadowAlpha) {\n                    const duration = windowAnimation.getDuration();\n                    let startTime = windowAnimation.getStartTime();\n                    if (startTime < 0)\n                        startTime = drawingTime;\n                    let startOffset = windowAnimation.getStartOffset();\n                    let normalizedTime;\n                    if (duration != 0) {\n                        normalizedTime = (drawingTime - (startTime + startOffset)) / duration;\n                        normalizedTime = Math.max(Math.min(normalizedTime, 1.0), 0.0);\n                    }\n                    else {\n                        normalizedTime = drawingTime < startTime ? 0.0 : 1.0;\n                    }\n                    const interpolatedTime = windowAnimation.getInterpolator().getInterpolation(normalizedTime);\n                    if (windowAnimation === wparams.exitAnimation) {\n                        shadowAlpha = shadowAlpha * (1 - interpolatedTime);\n                        if (!windowAnimation.hasEnded())\n                            parent.invalidate();\n                    }\n                    else if (windowAnimation === wparams.enterAnimation) {\n                        shadowAlpha = shadowAlpha * interpolatedTime;\n                        if (!windowAnimation.hasEnded())\n                            parent.invalidate();\n                    }\n                }\n                if ((windowAnimation != null || wparams.isFloating()) && shadowAlpha) {\n                    canvas.drawColor(android.graphics.Color.argb(shadowAlpha, 0, 0, 0));\n                }\n                return super.drawFromParent(canvas, parent, drawingTime);\n            }\n            tagName() {\n                return 'Window';\n            }\n            dispatchKeyEvent(event) {\n                const count = this.getChildCount();\n                for (let i = count - 1; i >= 0; i--) {\n                    let child = this.getChildAt(i);\n                    if (child instanceof WindowManager.Layout && child.dispatchKeyEvent(event)) {\n                        return true;\n                    }\n                }\n                const action = event.getAction();\n                if (!this.Window_this.isDestroyed()) {\n                    const cb = this.Window_this.getCallback();\n                    const handled = cb != null ? cb.dispatchKeyEvent(event) : super.dispatchKeyEvent(event);\n                    if (handled) {\n                        return true;\n                    }\n                }\n                return super.dispatchKeyEvent(event);\n            }\n            dispatchTouchEvent(ev) {\n                let wparams = this.getLayoutParams();\n                const cb = this.Window_this.getCallback();\n                let outside = this.Window_this.isOutOfBounds(this.getContext(), ev);\n                if (outside && !wparams.isTouchModal()) {\n                    if (wparams.isWatchTouchOutside() && ev.getAction() == android.view.MotionEvent.ACTION_DOWN) {\n                        let action = ev.getAction();\n                        ev.setAction(android.view.MotionEvent.ACTION_OUTSIDE);\n                        if (cb != null && !this.Window_this.isDestroyed()) {\n                            cb.dispatchTouchEvent(ev);\n                        }\n                        else {\n                            super.dispatchTouchEvent(ev);\n                        }\n                        ev.setAction(action);\n                    }\n                    return false;\n                }\n                cb != null && !this.Window_this.isDestroyed() ? cb.dispatchTouchEvent(ev) : super.dispatchTouchEvent(ev);\n                return true;\n            }\n            dispatchGenericMotionEvent(ev) {\n                const cb = this.Window_this.getCallback();\n                return cb != null && !this.Window_this.isDestroyed() ? cb.dispatchGenericMotionEvent(ev) : super.dispatchGenericMotionEvent(ev);\n            }\n            superDispatchKeyEvent(event) {\n                return super.dispatchKeyEvent(event);\n            }\n            superDispatchTouchEvent(event) {\n                return super.dispatchTouchEvent(event);\n            }\n            superDispatchGenericMotionEvent(event) {\n                return super.dispatchGenericMotionEvent(event);\n            }\n            onTouchEvent(event) {\n                return this.onInterceptTouchEvent(event);\n            }\n            onVisibilityChanged(changedView, visibility) {\n                this.Window_this.mAttachInfo.mWindowVisibility = visibility;\n                this.dispatchWindowVisibilityChanged(visibility);\n                super.onVisibilityChanged(changedView, visibility);\n            }\n            onWindowFocusChanged(hasWindowFocus) {\n                this.Window_this.mAttachInfo.mHasWindowFocus = hasWindowFocus;\n                super.onWindowFocusChanged(hasWindowFocus);\n                const cb = this.Window_this.getCallback();\n                if (cb != null && !this.Window_this.isDestroyed()) {\n                    cb.onWindowFocusChanged(hasWindowFocus);\n                }\n            }\n            onAttachedToWindow() {\n                this.Window_this.mAttachInfo.mWindowVisibility = this.getVisibility();\n                super.onAttachedToWindow();\n                const cb = this.Window_this.getCallback();\n                if (cb != null && !this.Window_this.isDestroyed()) {\n                    cb.onAttachedToWindow();\n                }\n            }\n            onDetachedFromWindow() {\n                super.onDetachedFromWindow();\n                const cb = this.Window_this.getCallback();\n                if (cb != null && !this.Window_this.isDestroyed()) {\n                    cb.onDetachedFromWindow();\n                }\n            }\n        }\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar PageStack;\n(function (PageStack) {\n    PageStack.DEBUG = false;\n    const history_go = history.go;\n    var iFrameHistoryLengthAsFake = 0;\n    let historyLocking = false;\n    let windowLoadLocking = true;\n    let pendingFuncLock = [];\n    let initCalled = false;\n    function init() {\n        initCalled = true;\n        _init();\n        history.go = function (delta) {\n            PageStack.go(delta);\n        };\n        history.back = function (delta = -1) {\n            PageStack.go(delta);\n        };\n        history.forward = function (delta = 1) {\n            PageStack.go(delta);\n        };\n    }\n    PageStack.init = init;\n    function checkInitCalled() {\n        if (!initCalled)\n            throw Error(\"PageStack.init() must be call first\");\n    }\n    function _init() {\n        PageStack.currentStack = history.state;\n        if (PageStack.currentStack && !PageStack.currentStack.isRoot) {\n            console.log('already has history.state when _init PageState, restore page');\n            restorePageFromStackIfNeed();\n        }\n        else {\n            PageStack.currentStack = PageStack.currentStack || {\n                pageId: '',\n                isRoot: true,\n                stack: [{ pageId: null }]\n            };\n            let initOpenUrl = location.hash;\n            if (initOpenUrl && initOpenUrl.indexOf('#') === 0)\n                initOpenUrl = initOpenUrl.substring(1);\n            removeLastHistoryIfFaked();\n            ensureLockDo(() => {\n                history.replaceState(PageStack.currentStack, null, '#');\n            });\n            if (initOpenUrl && initOpenUrl.length > 0) {\n                if (firePagePush(initOpenUrl, null)) {\n                    notifyNewPageOpened(initOpenUrl);\n                }\n            }\n        }\n        ensureLastHistoryFaked();\n        if (document.readyState === 'complete') {\n            windowLoadLocking = false;\n            setTimeout(initOnpopstate, 0);\n        }\n        else {\n            window.addEventListener('load', () => {\n                windowLoadLocking = false;\n                window.removeEventListener('popstate', onpopstateListener);\n                setTimeout(initOnpopstate, 0);\n            });\n        }\n    }\n    let onpopstateListener = function (ev) {\n        let stack = ev.state;\n        if (historyLocking) {\n            PageStack.currentStack = stack;\n            return;\n        }\n        if (PageStack.DEBUG)\n            console.log('onpopstate', stack);\n        if (!stack) {\n            let pageId = location.hash;\n            if (pageId[0] === '#')\n                pageId = pageId.substring(1);\n            historyGo(-2, false);\n            if (firePagePush(pageId, null)) {\n                notifyNewPageOpened(pageId);\n            }\n            else {\n                ensureLastHistoryFaked();\n            }\n        }\n        else if (PageStack.currentStack.stack.length != stack.stack.length) {\n            let delta = stack.stack.length - PageStack.currentStack.stack.length;\n            if (delta >= 0) {\n                console.warn('something error! stack: ', stack, 'last stack: ', PageStack.currentStack);\n                return;\n            }\n            var stackList = PageStack.currentStack.stack;\n            PageStack.currentStack = stack;\n            tryClosePageAfterHistoryChanged(stackList, delta);\n        }\n        else {\n            PageStack.currentStack = stack;\n            if (fireBackPressed()) {\n                ensureLastHistoryFaked();\n            }\n            else {\n                var stackList = PageStack.currentStack.stack;\n                var pageId = stackList[stackList.length - 1].pageId;\n                if (firePageClose(pageId, stackList[stackList.length - 1].extra)) {\n                    historyGo(-1);\n                }\n                else {\n                    ensureLastHistoryFaked();\n                }\n            }\n        }\n    };\n    function initOnpopstate() {\n        window.removeEventListener('popstate', onpopstateListener);\n        window.addEventListener('popstate', onpopstateListener);\n    }\n    function go(delta, pageAlreadyClose = false) {\n        checkInitCalled();\n        if (historyLocking) {\n            ensureLockDo(() => {\n                go(delta);\n            });\n            return;\n        }\n        var stackList = PageStack.currentStack.stack;\n        if (delta === -1 && !pageAlreadyClose) {\n            if (!firePageClose(stackList[stackList.length - 1].pageId, stackList[stackList.length - 1].extra)) {\n                return;\n            }\n        }\n        removeLastHistoryIfFaked();\n        historyGo(delta);\n        if (delta < -1 && !pageAlreadyClose) {\n            ensureLockDo(() => {\n                tryClosePageAfterHistoryChanged(stackList, delta);\n            });\n        }\n    }\n    PageStack.go = go;\n    function tryClosePageAfterHistoryChanged(stateListBeforeHistoryChange, delta) {\n        let historyLength = stateListBeforeHistoryChange.length;\n        for (let i = historyLength + delta; i < historyLength; i++) {\n            let state = stateListBeforeHistoryChange[i];\n            if (!firePageClose(state.pageId, state.extra)) {\n                notifyNewPageOpened(state.pageId, state.extra);\n            }\n        }\n    }\n    function back(pageAlreadyClose = false) {\n        checkInitCalled();\n        go(-1, pageAlreadyClose);\n    }\n    PageStack.back = back;\n    function openPage(pageId, extra) {\n        checkInitCalled();\n        pageId += '';\n        var openResult = firePageOpen(pageId, extra);\n        if (openResult) {\n            notifyNewPageOpened(pageId, extra);\n        }\n        return openResult;\n    }\n    PageStack.openPage = openPage;\n    function backToPage(pageId) {\n        checkInitCalled();\n        if (PageStack.DEBUG)\n            console.log('backToPage', pageId);\n        if (historyLocking) {\n            ensureLockDo(() => {\n                backToPage(pageId);\n            });\n        }\n        let stackList = PageStack.currentStack.stack;\n        let historyLength = stackList.length;\n        for (let i = historyLength - 1; i >= 0; i--) {\n            let state = stackList[i];\n            if (state.pageId == pageId) {\n                let delta = i - historyLength;\n                removeLastHistoryIfFaked();\n                historyGo(delta);\n                return;\n            }\n        }\n    }\n    PageStack.backToPage = backToPage;\n    let releaseLockingTimeout;\n    let requestHistoryGoWhenLocking = 0;\n    let ensureFakeAfterHistoryChange = false;\n    function historyGo(delta, ensureFaked = true) {\n        if (delta >= 0)\n            return;\n        if (history.length === 1)\n            return;\n        ensureFakeAfterHistoryChange = ensureFakeAfterHistoryChange || ensureFaked;\n        if (historyLocking) {\n            requestHistoryGoWhenLocking += delta;\n            return;\n        }\n        if (PageStack.DEBUG)\n            console.log('historyGo', delta);\n        historyLocking = true;\n        const state = history.state;\n        if (releaseLockingTimeout)\n            clearTimeout(releaseLockingTimeout);\n        function checkRelease() {\n            clearTimeout(releaseLockingTimeout);\n            if (history.state === state) {\n                releaseLockingTimeout = setTimeout(checkRelease, 0);\n            }\n            else {\n                let continueGo = requestHistoryGoWhenLocking;\n                if (continueGo != 0) {\n                    requestHistoryGoWhenLocking = 0;\n                    historyLocking = false;\n                    historyGo(continueGo, false);\n                }\n                else {\n                    if (ensureFakeAfterHistoryChange)\n                        ensureLastHistoryFakedImpl();\n                    ensureFakeAfterHistoryChange = false;\n                    releaseLockingTimeout = setTimeout(() => {\n                        historyLocking = false;\n                    }, 10);\n                }\n            }\n        }\n        releaseLockingTimeout = setTimeout(checkRelease, 0);\n        history_go.call(history, delta);\n    }\n    PageStack.historyGo = historyGo;\n    function restorePageFromStackIfNeed() {\n        if (PageStack.currentStack) {\n            let copy = PageStack.currentStack.stack.concat();\n            copy.shift();\n            for (let saveState of copy) {\n                firePageOpen(saveState.pageId, saveState.extra, true);\n            }\n        }\n    }\n    function fireBackPressed() {\n        if (PageStack.backListener) {\n            try {\n                return PageStack.backListener();\n            }\n            catch (e) {\n                console.error(e);\n            }\n        }\n    }\n    function firePageOpen(pageId, pageExtra, isRestore = false) {\n        if (PageStack.pageOpenHandler) {\n            try {\n                return PageStack.pageOpenHandler(pageId, pageExtra, isRestore);\n            }\n            catch (e) {\n                console.error(e);\n            }\n        }\n    }\n    function firePagePush(pageId, pageExtra) {\n        if (PageStack.pagePushHandler) {\n            try {\n                return PageStack.pagePushHandler(pageId, pageExtra);\n            }\n            catch (e) {\n                console.error(e);\n            }\n        }\n    }\n    function firePageClose(pageId, pageExtra) {\n        if (PageStack.pageCloseHandler) {\n            try {\n                return PageStack.pageCloseHandler(pageId, pageExtra);\n            }\n            catch (e) {\n                console.error(e);\n            }\n        }\n    }\n    function notifyPageClosed(pageId) {\n        checkInitCalled();\n        if (PageStack.DEBUG)\n            console.log('notifyPageClosed', pageId);\n        if (historyLocking) {\n            ensureLockDo(() => {\n                notifyPageClosed(pageId);\n            });\n            return;\n        }\n        let stackList = PageStack.currentStack.stack;\n        let historyLength = stackList.length;\n        for (let i = historyLength - 1; i >= 0; i--) {\n            let state = stackList[i];\n            if (state.pageId == pageId) {\n                if (i === historyLength - 1) {\n                    removeLastHistoryIfFaked();\n                    historyGo(-1);\n                }\n                else {\n                    let delta = i - historyLength;\n                    (function (delta) {\n                        removeLastHistoryIfFaked();\n                        historyGo(delta);\n                        ensureLockDoAtFront(() => {\n                            let historyLength = stackList.length;\n                            let pageStartAddIndex = historyLength + delta + 1;\n                            for (let j = pageStartAddIndex; j < historyLength; j++) {\n                                notifyNewPageOpened(stackList[j].pageId, stackList[j].extra);\n                            }\n                        });\n                    })(delta);\n                }\n                return;\n            }\n        }\n    }\n    PageStack.notifyPageClosed = notifyPageClosed;\n    function notifyNewPageOpened(pageId, extra) {\n        checkInitCalled();\n        if (PageStack.DEBUG)\n            console.log('notifyNewPageOpened', pageId);\n        let state = {\n            pageId: pageId,\n            extra: extra\n        };\n        ensureLockDo(function () {\n            PageStack.currentStack.stack.push(state);\n            PageStack.currentStack.pageId = pageId;\n            PageStack.currentStack.isRoot = false;\n            if (history.state.isFake) {\n                history.replaceState(PageStack.currentStack, null, '#' + pageId);\n            }\n            else {\n                history.pushState(PageStack.currentStack, null, '#' + pageId);\n            }\n            ensureLastHistoryFakedImpl();\n        });\n    }\n    PageStack.notifyNewPageOpened = notifyNewPageOpened;\n    function getPageExtra(pageId) {\n        checkInitCalled();\n        let stackList = PageStack.currentStack.stack;\n        let historyLength = stackList.length;\n        if (!pageId) {\n            return stackList[historyLength - 1].extra;\n        }\n        else {\n            for (let i = historyLength - 1; i >= 0; i--) {\n                let state = stackList[i];\n                if (state.pageId == pageId) {\n                    return state.extra;\n                }\n            }\n        }\n    }\n    PageStack.getPageExtra = getPageExtra;\n    function setPageExtra(extra, pageId) {\n        checkInitCalled();\n        removeLastHistoryIfFaked();\n        ensureLockDo(function () {\n            let stackList = PageStack.currentStack.stack;\n            let historyLength = stackList.length;\n            if (!pageId) {\n                stackList[historyLength - 1].extra = extra;\n                history.replaceState(PageStack.currentStack, null, '');\n            }\n            else {\n                for (let i = historyLength - 1; i >= 0; i--) {\n                    let state = stackList[i];\n                    if (state.pageId == pageId) {\n                        state.extra = extra;\n                        history.replaceState(PageStack.currentStack, null, '');\n                        break;\n                    }\n                }\n            }\n            ensureLastHistoryFakedImpl();\n        });\n    }\n    PageStack.setPageExtra = setPageExtra;\n    function ensureLockDo(func) {\n        checkInitCalled();\n        if (!historyLocking && !windowLoadLocking) {\n            func();\n            return;\n        }\n        pendingFuncLock.push(func);\n        _queryLockDo();\n    }\n    function ensureLockDoAtFront(func, runNowIfNotLock = false) {\n        checkInitCalled();\n        if (!historyLocking && !windowLoadLocking && runNowIfNotLock) {\n            func();\n            return;\n        }\n        pendingFuncLock.splice(0, 0, func);\n        _queryLockDo();\n    }\n    let execLockedTimeoutId;\n    function _queryLockDo() {\n        if (execLockedTimeoutId)\n            clearTimeout(execLockedTimeoutId);\n        function execLockedFunctions() {\n            if (historyLocking || windowLoadLocking) {\n                clearTimeout(execLockedTimeoutId);\n                execLockedTimeoutId = setTimeout(execLockedFunctions, 0);\n            }\n            else {\n                let f;\n                while (f = pendingFuncLock.shift()) {\n                    f();\n                    if (historyLocking || windowLoadLocking) {\n                        clearTimeout(execLockedTimeoutId);\n                        execLockedTimeoutId = setTimeout(execLockedFunctions, 0);\n                        break;\n                    }\n                }\n            }\n        }\n        execLockedTimeoutId = setTimeout(execLockedFunctions, 0);\n    }\n    function preClosePageHasIFrame(historyLengthWhenInitIFrame) {\n        history.pushState({ isFake: true }, null, null);\n        iFrameHistoryLengthAsFake = history.length - historyLengthWhenInitIFrame;\n    }\n    PageStack.preClosePageHasIFrame = preClosePageHasIFrame;\n    function removeLastHistoryIfFaked() {\n        ensureLockDo(removeLastHistoryIfFakedImpl);\n    }\n    function removeLastHistoryIfFakedImpl() {\n        if (history.state && history.state.isFake) {\n            if (PageStack.DEBUG)\n                console.log('remove Fake History');\n            history.replaceState(null, null, '');\n            historyGo(-1 - iFrameHistoryLengthAsFake, false);\n            iFrameHistoryLengthAsFake = 0;\n        }\n    }\n    function ensureLastHistoryFaked() {\n        ensureLockDo(ensureLastHistoryFakedImpl);\n    }\n    function ensureLastHistoryFakedImpl() {\n        if (!history.state.isFake) {\n            if (PageStack.DEBUG)\n                console.log('append Fake History');\n            history.pushState({\n                isFake: true,\n                isRoot: PageStack.currentStack.isRoot,\n                stack: PageStack.currentStack.stack,\n            }, null, '');\n        }\n    }\n})(PageStack || (PageStack = {}));\nvar android;\n(function (android) {\n    var app;\n    (function (app) {\n        var Bundle = android.os.Bundle;\n        var Intent = android.content.Intent;\n        var View = android.view.View;\n        class ActivityThread {\n            constructor(androidUI) {\n                this.mLaunchedActivities = new Set();\n                this.androidUI = androidUI;\n            }\n            initWithPageStack() {\n                let backKeyDownEvent = android.view.KeyEvent.obtain(android.view.KeyEvent.ACTION_DOWN, android.view.KeyEvent.KEYCODE_BACK);\n                let backKeyUpEvent = android.view.KeyEvent.obtain(android.view.KeyEvent.ACTION_UP, android.view.KeyEvent.KEYCODE_BACK);\n                PageStack.backListener = () => {\n                    let handleDown = this.androidUI._viewRootImpl.dispatchInputEvent(backKeyDownEvent);\n                    let handleUp = this.androidUI._viewRootImpl.dispatchInputEvent(backKeyUpEvent);\n                    return handleDown || handleUp;\n                };\n                PageStack.pageOpenHandler = (pageId, pageExtra, isRestore) => {\n                    let intent = new Intent(pageId);\n                    if (pageExtra)\n                        intent.mExtras = new Bundle(pageExtra.mExtras);\n                    if (isRestore)\n                        this.overrideNextWindowAnimation(null, null, null, null);\n                    let activity = this.handleLaunchActivity(intent);\n                    return activity && !activity.mFinished;\n                };\n                PageStack.pageCloseHandler = (pageId, pageExtra) => {\n                    if (this.mLaunchedActivities.size === 1) {\n                        let rootActivity = Array.from(this.mLaunchedActivities)[0];\n                        if (pageId == null || rootActivity.getIntent().activityName == pageId) {\n                            this.handleDestroyActivity(rootActivity, true);\n                            return true;\n                        }\n                        return false;\n                    }\n                    for (let activity of Array.from(this.mLaunchedActivities).reverse()) {\n                        let intent = activity.getIntent();\n                        if (intent.activityName == pageId) {\n                            this.handleDestroyActivity(activity, true);\n                            return true;\n                        }\n                    }\n                };\n                PageStack.init();\n            }\n            overrideNextWindowAnimation(enterAnimation, exitAnimation, resumeAnimation, hideAnimation) {\n                this.overrideEnterAnimation = enterAnimation;\n                this.overrideExitAnimation = exitAnimation;\n                this.overrideResumeAnimation = resumeAnimation;\n                this.overrideHideAnimation = hideAnimation;\n            }\n            getOverrideEnterAnimation() {\n                return this.overrideEnterAnimation;\n            }\n            getOverrideExitAnimation() {\n                return this.overrideExitAnimation;\n            }\n            getOverrideResumeAnimation() {\n                return this.overrideResumeAnimation;\n            }\n            getOverrideHideAnimation() {\n                return this.overrideHideAnimation;\n            }\n            scheduleApplicationHide() {\n                if (this.scheduleApplicationHideTimeout)\n                    clearTimeout(this.scheduleApplicationHideTimeout);\n                this.scheduleApplicationHideTimeout = setTimeout(() => {\n                    let visibleActivities = this.getVisibleToUserActivities();\n                    if (visibleActivities.length == 0)\n                        return;\n                    this.handlePauseActivity(visibleActivities[visibleActivities.length - 1]);\n                    for (let visibleActivity of visibleActivities) {\n                        this.handleStopActivity(visibleActivity, true);\n                    }\n                }, 0);\n            }\n            scheduleApplicationShow() {\n                this.scheduleActivityResume();\n            }\n            execStartActivity(callActivity, intent, options) {\n                if ((intent.getFlags() & Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0) {\n                    if (this.scheduleBackTo(intent))\n                        return;\n                }\n                this.scheduleLaunchActivity(callActivity, intent, options);\n            }\n            scheduleActivityResume() {\n                if (this.activityResumeTimeout)\n                    clearTimeout(this.activityResumeTimeout);\n                this.activityResumeTimeout = setTimeout(() => {\n                    let visibleActivities = this.getVisibleToUserActivities();\n                    if (visibleActivities.length == 0)\n                        return;\n                    for (let visibleActivity of visibleActivities) {\n                        visibleActivity.performRestart();\n                    }\n                    let activity = visibleActivities.pop();\n                    this.handleResumeActivity(activity, false);\n                    if (activity.getWindow().isFloating()) {\n                        for (let visibleActivity of visibleActivities.reverse()) {\n                            if (visibleActivity.mVisibleFromClient) {\n                                visibleActivity.makeVisible();\n                                if (!visibleActivity.getWindow().isFloating()) {\n                                    break;\n                                }\n                            }\n                        }\n                    }\n                }, 0);\n            }\n            scheduleLaunchActivity(callActivity, intent, options) {\n                let activity = this.handleLaunchActivity(intent);\n                activity.mCallActivity = callActivity;\n                if (activity && !activity.mFinished) {\n                    PageStack.notifyNewPageOpened(intent.activityName, intent);\n                }\n            }\n            scheduleDestroyActivityByRequestCode(requestCode) {\n                for (let activity of Array.from(this.mLaunchedActivities).reverse()) {\n                    if (activity.getIntent() && requestCode == activity.getIntent().mRequestCode) {\n                        this.scheduleDestroyActivity(activity);\n                    }\n                }\n            }\n            scheduleDestroyActivity(activity, finishing = true) {\n                setTimeout(() => {\n                    let isCreateSuc = this.mLaunchedActivities.has(activity);\n                    if (activity.mCallActivity && activity.getIntent() && activity.getIntent().mRequestCode >= 0) {\n                        activity.mCallActivity.dispatchActivityResult(null, activity.getIntent().mRequestCode, activity.mResultCode, activity.mResultData);\n                    }\n                    this.handleDestroyActivity(activity, finishing);\n                    if (!isCreateSuc)\n                        return;\n                    if (this.mLaunchedActivities.size == 0) {\n                        if (history.length <= 2) {\n                            this.androidUI.showAppClosed();\n                        }\n                        else {\n                            PageStack.back(true);\n                        }\n                    }\n                    else if (activity.getIntent()) {\n                        PageStack.notifyPageClosed(activity.getIntent().activityName);\n                    }\n                }, 0);\n            }\n            scheduleBackTo(intent) {\n                let destroyList = [];\n                let findActivity = false;\n                for (let activity of Array.from(this.mLaunchedActivities).reverse()) {\n                    if (activity.getIntent() && activity.getIntent().activityName == intent.activityName) {\n                        findActivity = true;\n                        break;\n                    }\n                    destroyList.push(activity);\n                }\n                if (findActivity) {\n                    for (let activity of destroyList) {\n                        this.scheduleDestroyActivity(activity);\n                    }\n                    return true;\n                }\n                return false;\n            }\n            canBackTo(intent) {\n                for (let activity of this.mLaunchedActivities) {\n                    if (activity.getIntent().activityName == intent.activityName) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n            scheduleBackToRoot() {\n                let destroyList = Array.from(this.mLaunchedActivities).reverse();\n                destroyList.shift();\n                for (let activity of destroyList) {\n                    this.scheduleDestroyActivity(activity);\n                }\n            }\n            handlePauseActivity(activity) {\n                this.performPauseActivity(activity);\n            }\n            performPauseActivity(activity) {\n                activity.performPause();\n            }\n            handleStopActivity(activity, show = false) {\n                this.performStopActivity(activity, true);\n                this.updateVisibility(activity, show);\n            }\n            performStopActivity(activity, saveState) {\n                if (!activity.mFinished && saveState) {\n                    let state = new Bundle();\n                    activity.performSaveInstanceState(state);\n                }\n                activity.performStop();\n            }\n            handleResumeActivity(a, launching) {\n                this.performResumeActivity(a, launching);\n                let willBeVisible = !a.mStartedActivity && !a.mFinished;\n                if (willBeVisible && a.mVisibleFromClient) {\n                    a.makeVisible();\n                    this.overrideEnterAnimation = undefined;\n                    this.overrideExitAnimation = undefined;\n                    this.overrideResumeAnimation = undefined;\n                    this.overrideHideAnimation = undefined;\n                }\n            }\n            performResumeActivity(a, launching) {\n                if (!launching) {\n                    a.mStartedActivity = false;\n                }\n                a.performResume();\n            }\n            handleLaunchActivity(intent) {\n                let visibleActivities = this.getVisibleToUserActivities();\n                let a = this.performLaunchActivity(intent);\n                if (a) {\n                    this.handleResumeActivity(a, true);\n                    if (!a.mFinished && visibleActivities.length > 0) {\n                        this.handlePauseActivity(visibleActivities[visibleActivities.length - 1]);\n                        if (!a.getWindow().getAttributes().isFloating()) {\n                            for (let visibleActivity of visibleActivities) {\n                                this.handleStopActivity(visibleActivity);\n                            }\n                        }\n                    }\n                }\n                return a;\n            }\n            performLaunchActivity(intent) {\n                let activity;\n                let clazz = intent.activityName;\n                try {\n                    if (typeof clazz === 'string')\n                        clazz = eval(clazz);\n                }\n                catch (e) { }\n                if (typeof clazz === 'function')\n                    activity = new clazz(this.androidUI);\n                if (activity instanceof app.Activity) {\n                    try {\n                        let savedInstanceState = null;\n                        activity.mIntent = intent;\n                        activity.mStartedActivity = false;\n                        activity.mCalled = false;\n                        activity.performCreate(savedInstanceState);\n                        if (!activity.mCalled) {\n                            throw new Error(\"Activity \" + intent.activityName + \" did not call through to super.onCreate()\");\n                        }\n                        if (!activity.mFinished) {\n                            activity.performStart();\n                            activity.performRestoreInstanceState(savedInstanceState);\n                            activity.mCalled = false;\n                            activity.onPostCreate(savedInstanceState);\n                            if (!activity.mCalled) {\n                                throw new Error(\"Activity \" + intent.activityName + \" did not call through to super.onPostCreate()\");\n                            }\n                        }\n                    }\n                    catch (e) {\n                        console.error(e);\n                        return null;\n                    }\n                    if (!activity.mFinished) {\n                        this.mLaunchedActivities.add(activity);\n                    }\n                    return activity;\n                }\n                return null;\n            }\n            handleDestroyActivity(activity, finishing) {\n                let visibleActivities = this.getVisibleToUserActivities();\n                let isTopVisibleActivity = activity == visibleActivities[visibleActivities.length - 1];\n                let isRootActivity = this.isRootActivity(activity);\n                this.performDestroyActivity(activity, finishing);\n                if (isRootActivity)\n                    activity.getWindow().setWindowAnimations(null, null);\n                this.androidUI.windowManager.removeWindow(activity.getWindow());\n                if (isTopVisibleActivity && !isRootActivity) {\n                    this.scheduleActivityResume();\n                }\n            }\n            performDestroyActivity(activity, finishing) {\n                if (finishing) {\n                    activity.mFinished = true;\n                }\n                activity.performPause();\n                activity.performStop();\n                activity.mCalled = false;\n                activity.performDestroy();\n                if (!activity.mCalled) {\n                    throw new Error(\"Activity \" + ActivityThread.getActivityName(activity) + \" did not call through to super.onDestroy()\");\n                }\n                this.mLaunchedActivities.delete(activity);\n            }\n            updateVisibility(activity, show) {\n                if (show) {\n                    if (activity.mVisibleFromClient) {\n                        activity.makeVisible();\n                    }\n                }\n                else {\n                    activity.getWindow().getDecorView().setVisibility(View.INVISIBLE);\n                }\n            }\n            getVisibleToUserActivities() {\n                let list = [];\n                for (let activity of Array.from(this.mLaunchedActivities).reverse()) {\n                    list.push(activity);\n                    if (!activity.getWindow().getAttributes().isFloating())\n                        break;\n                }\n                list.reverse();\n                return list;\n            }\n            isRootActivity(activity) {\n                return this.mLaunchedActivities.values().next().value == activity;\n            }\n            static getActivityName(activity) {\n                if (activity.getIntent())\n                    return activity.getIntent().activityName;\n                return activity.constructor.name;\n            }\n        }\n        app.ActivityThread = ActivityThread;\n    })(app = android.app || (android.app = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var R;\n    (function (R) {\n        class string_ {\n            static zh() {\n                this.ok = '确定';\n                this.cancel = '取消';\n                this.close = '关闭';\n                this.back = '返回';\n                this.crash_catch_alert = '程序发生错误, 即将重载网页:';\n                this.prll_header_state_normal = '下拉以刷新';\n                this.prll_header_state_ready = '松开马上刷新';\n                this.prll_header_state_loading = '正在刷新...';\n                this.prll_header_state_fail = '刷新失败';\n                this.prll_footer_state_normal = '点击加载更多';\n                this.prll_footer_state_loading = '正在加载...';\n                this.prll_footer_state_ready = '松开加载更多';\n                this.prll_footer_state_no_more = '加载完毕';\n                this.prll_footer_state_fail = '加载失败,点击重试';\n            }\n        }\n        string_.ok = 'OK';\n        string_.cancel = 'Cancel';\n        string_.close = 'Close';\n        string_.back = 'Back';\n        string_.crash_catch_alert = 'Some error happen, will refresh page:';\n        string_.prll_header_state_normal = 'Pull to refresh';\n        string_.prll_header_state_ready = 'Release to refresh';\n        string_.prll_header_state_loading = 'Loading';\n        string_.prll_header_state_fail = 'Refresh fail';\n        string_.prll_footer_state_normal = 'Load more';\n        string_.prll_footer_state_loading = 'Loading';\n        string_.prll_footer_state_ready = 'Pull to load more';\n        string_.prll_footer_state_fail = 'Click to reload';\n        string_.prll_footer_state_no_more = 'Load Finish';\n        R.string_ = string_;\n        const lang = navigator.language.split('-')[0].toLowerCase();\n        if (typeof string_[lang] === 'function')\n            string_[lang].call(string_);\n    })(R = android.R || (android.R = {}));\n})(android || (android = {}));\nvar androidui;\n(function (androidui) {\n    if (typeof HTMLDivElement !== 'function') {\n        const _HTMLDivElement = function () { };\n        _HTMLDivElement.prototype = HTMLDivElement.prototype;\n        HTMLDivElement = _HTMLDivElement;\n    }\n    class AndroidUIElement extends HTMLDivElement {\n        createdCallback() {\n            $domReady(() => initElement(this));\n        }\n        attachedCallback() {\n        }\n        detachedCallback() {\n        }\n        attributeChangedCallback(attributeName, oldVal, newVal) {\n            if (attributeName === 'debug' && newVal != null && newVal != 'false' && newVal != '0') {\n                this.AndroidUI.setDebugEnable();\n            }\n        }\n    }\n    androidui.AndroidUIElement = AndroidUIElement;\n    function runFunction(func) {\n        if (typeof window[func] === \"function\") {\n            window[func]();\n        }\n        else {\n            try {\n                eval(func);\n            }\n            catch (e) {\n                console.warn(e);\n            }\n        }\n    }\n    function $domReady(func) {\n        if (/^loaded|^complete|^interactive/.test(document.readyState)) {\n            setTimeout(func, 0);\n        }\n        else {\n            document.addEventListener('DOMContentLoaded', func);\n        }\n    }\n    function initElement(ele) {\n        ele.AndroidUI = new androidui.AndroidUI(ele);\n        let debugAttr = ele.getAttribute('debug');\n        if (debugAttr != null && debugAttr != '0' && debugAttr != 'false')\n            ele.AndroidUI.setDebugEnable();\n        let onClose = ele.getAttribute('onclose');\n        if (onClose) {\n            ele.AndroidUI.setUIClient({\n                shouldShowAppClosed(androidUI) {\n                    if (!onClose)\n                        return;\n                    runFunction(onClose);\n                }\n            });\n        }\n        let onLoad = ele.getAttribute('onload');\n        if (onLoad) {\n            runFunction(onLoad);\n        }\n    }\n    if (typeof document['registerElement'] === \"function\") {\n        document.registerElement(\"android-ui\", AndroidUIElement);\n    }\n    else {\n        $domReady(() => {\n            let eles = document.getElementsByTagName('android-ui');\n            for (let ele of Array.from(eles)) {\n                initElement(ele);\n            }\n        });\n    }\n    let styleElement = document.createElement('style');\n    styleElement.innerHTML += `\n        android-ui {\n            position : relative;\n            overflow : hidden;\n            display : block;\n            outline: none;\n        }\n        android-ui * {\n            overflow : hidden;\n            border : none;\n            outline: none;\n            pointer-events: auto;\n        }\n        android-ui resources {\n            display: none;\n        }\n        android-ui Button {\n            border: none;\n            background: none;\n        }\n        android-ui windowsgroup {\n            pointer-events: none;\n        }\n        android-ui > canvas {\n            position: absolute;\n            left: 0;\n            top: 0;\n        }\n        `;\n    document.head.appendChild(styleElement);\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var MotionEvent = android.view.MotionEvent;\n    var KeyEvent = android.view.KeyEvent;\n    var Intent = android.content.Intent;\n    var ActivityThread = android.app.ActivityThread;\n    var ViewRootImpl = android.view.ViewRootImpl;\n    class AndroidUI {\n        constructor(androidUIElement) {\n            this._canvas = document.createElement(\"canvas\");\n            this.viewsDependOnDebugLayout = new Set();\n            this.showDebugLayoutDefault = false;\n            this._windowBound = new android.graphics.Rect();\n            this.tempRect = new android.graphics.Rect();\n            this.touchEvent = new MotionEvent();\n            this.ketEvent = new KeyEvent();\n            this.androidUIElement = androidUIElement;\n            if (androidUIElement[AndroidUI.BindToElementName]) {\n                throw Error('already init a AndroidUI with this element');\n            }\n            androidUIElement[AndroidUI.BindToElementName] = this;\n            this.init();\n        }\n        get windowManager() {\n            return this.mApplication.getWindowManager();\n        }\n        get windowBound() {\n            return this._windowBound;\n        }\n        init() {\n            this.appName = document.title;\n            this._viewRootImpl = new android.view.ViewRootImpl();\n            this.initAndroidUIElement();\n            this.initApplication();\n            this.androidUIElement.appendChild(this._canvas);\n            this.initEvent();\n            this.initRootSizeChange();\n            this._viewRootImpl.setView(this.windowManager.getWindowsLayout());\n            this._viewRootImpl.initSurface(this._canvas);\n            this.initBrowserVisibleChange();\n            this.initLaunchActivity();\n            this.initGlobalCrashHandle();\n        }\n        initApplication() {\n            const appName = this.androidUIElement.getAttribute('appName');\n            let appClazz;\n            if (appName) {\n                try {\n                    appClazz = eval(appName);\n                }\n                catch (e) {\n                }\n            }\n            appClazz = appClazz || android.app.Application;\n            this.mApplication = new appClazz(this);\n            this.mApplication.onCreate();\n        }\n        initLaunchActivity() {\n            this.mActivityThread = new ActivityThread(this);\n            for (let ele of Array.from(this.androidUIElement.children)) {\n                let tagName = ele.tagName;\n                if (tagName != 'ACTIVITY')\n                    continue;\n                let activityName = ele.getAttribute('name') || ele.getAttribute('android:name') || 'android.app.Activity';\n                let intent = new Intent(activityName);\n                this.mActivityThread.overrideNextWindowAnimation(null, null, null, null);\n                let activity = this.mActivityThread.handleLaunchActivity(intent);\n                if (activity) {\n                    this.androidUIElement.removeChild(ele);\n                    for (let element of Array.from(ele.children)) {\n                        android.view.LayoutInflater.from(activity).inflate(element, activity.getWindow().mContentParent, true);\n                    }\n                    let onCreateFunc = ele.getAttribute('oncreate');\n                    if (onCreateFunc && typeof window[onCreateFunc] === \"function\") {\n                        window[onCreateFunc].call(this, activity);\n                    }\n                }\n            }\n            this.mActivityThread.initWithPageStack();\n        }\n        initGlobalCrashHandle() {\n            window.onerror = (sMsg, sUrl, sLine) => {\n                if (window.confirm(android.R.string_.crash_catch_alert + '\\n' + sMsg)) {\n                    window.location.reload();\n                }\n            };\n        }\n        refreshWindowBound() {\n            let boundLeft = this.androidUIElement.offsetLeft;\n            let boundTop = this.androidUIElement.offsetTop;\n            let parent = this.androidUIElement.parentElement;\n            if (parent) {\n                boundLeft += parent.offsetLeft;\n                boundTop += parent.offsetTop;\n                parent = parent.parentElement;\n            }\n            let boundRight = boundLeft + this.androidUIElement.offsetWidth;\n            let boundBottom = boundTop + this.androidUIElement.offsetHeight;\n            if (this._windowBound && this._windowBound.left == boundLeft && this._windowBound.top == boundTop\n                && this._windowBound.right == boundRight && this._windowBound.bottom == boundBottom) {\n                return false;\n            }\n            this._windowBound.set(boundLeft, boundTop, boundRight, boundBottom);\n            return true;\n        }\n        initAndroidUIElement() {\n            if (this.androidUIElement.style.display === 'none') {\n                this.androidUIElement.style.display = '';\n            }\n            this.androidUIElement.setAttribute('tabindex', '0');\n            this.androidUIElement.focus();\n            this.androidUIElement.onblur = (e) => {\n                this._viewRootImpl.ensureTouchMode(true);\n            };\n        }\n        initEvent() {\n            this.initTouchEvent();\n            this.initMouseEvent();\n            this.initKeyEvent();\n            this.initGenericEvent();\n        }\n        initTouchEvent() {\n            this.androidUIElement.addEventListener('touchstart', (e) => {\n                this.refreshWindowBound();\n                if (e.target != document.activeElement || !this.androidUIElement.contains(document.activeElement)) {\n                    this.androidUIElement.focus();\n                }\n                this.touchEvent.initWithTouch(e, MotionEvent.ACTION_DOWN, this._windowBound);\n                if (this._viewRootImpl.dispatchInputEvent(this.touchEvent)) {\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n            this.androidUIElement.addEventListener('touchmove', (e) => {\n                this.touchEvent.initWithTouch(e, MotionEvent.ACTION_MOVE, this._windowBound);\n                if (this._viewRootImpl.dispatchInputEvent(this.touchEvent)) {\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n            this.androidUIElement.addEventListener('touchend', (e) => {\n                this.touchEvent.initWithTouch(e, MotionEvent.ACTION_UP, this._windowBound);\n                if (this._viewRootImpl.dispatchInputEvent(this.touchEvent)) {\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n            this.androidUIElement.addEventListener('touchcancel', (e) => {\n                this.touchEvent.initWithTouch(e, MotionEvent.ACTION_CANCEL, this._windowBound);\n                if (this._viewRootImpl.dispatchInputEvent(this.touchEvent)) {\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n        }\n        initMouseEvent() {\n            function mouseToTouchEvent(e) {\n                let touch = {\n                    identifier: 0,\n                    target: null,\n                    screenX: e.screenX,\n                    screenY: e.screenY,\n                    clientX: e.clientX,\n                    clientY: e.clientY,\n                    pageX: e.pageX,\n                    pageY: e.pageY\n                };\n                return {\n                    changedTouches: [touch],\n                    targetTouches: [touch],\n                    touches: e.type === 'mouseup' ? [] : [touch],\n                    timeStamp: e.timeStamp\n                };\n            }\n            let isMouseDown = false;\n            this.androidUIElement.addEventListener('mousedown', (e) => {\n                isMouseDown = true;\n                this.refreshWindowBound();\n                if (e.target != document.activeElement || !this.androidUIElement.contains(document.activeElement)) {\n                    this.androidUIElement.focus();\n                }\n                this.touchEvent.initWithTouch(mouseToTouchEvent(e), MotionEvent.ACTION_DOWN, this._windowBound);\n                if (this._viewRootImpl.dispatchInputEvent(this.touchEvent)) {\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n            this.androidUIElement.addEventListener('mousemove', (e) => {\n                if (!isMouseDown)\n                    return;\n                this.touchEvent.initWithTouch(mouseToTouchEvent(e), MotionEvent.ACTION_MOVE, this._windowBound);\n                if (this._viewRootImpl.dispatchInputEvent(this.touchEvent)) {\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n            this.androidUIElement.addEventListener('mouseup', (e) => {\n                isMouseDown = false;\n                this.touchEvent.initWithTouch(mouseToTouchEvent(e), MotionEvent.ACTION_UP, this._windowBound);\n                if (this._viewRootImpl.dispatchInputEvent(this.touchEvent)) {\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n            this.androidUIElement.addEventListener('mouseleave', (e) => {\n                if (e.fromElement === this.androidUIElement) {\n                    isMouseDown = false;\n                    this.touchEvent.initWithTouch(mouseToTouchEvent(e), MotionEvent.ACTION_CANCEL, this._windowBound);\n                    if (this._viewRootImpl.dispatchInputEvent(this.touchEvent)) {\n                        e.stopPropagation();\n                        e.preventDefault();\n                        return true;\n                    }\n                }\n            }, true);\n            let scrollEvent = new MotionEvent();\n            this.androidUIElement.addEventListener('mousewheel', (e) => {\n                scrollEvent.initWithMouseWheel(e);\n                if (this._viewRootImpl.dispatchInputEvent(scrollEvent)) {\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n        }\n        initKeyEvent() {\n            this.androidUIElement.addEventListener('keydown', (e) => {\n                this.ketEvent.initKeyEvent(e, KeyEvent.ACTION_DOWN);\n                if (this._viewRootImpl.dispatchInputEvent(this.ketEvent)) {\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n            this.androidUIElement.addEventListener('keyup', (e) => {\n                this.ketEvent.initKeyEvent(e, KeyEvent.ACTION_UP);\n                if (this._viewRootImpl.dispatchInputEvent(this.ketEvent)) {\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n        }\n        initGenericEvent() {\n        }\n        initRootSizeChange() {\n            const inner_this = this;\n            window.addEventListener('resize', () => {\n                inner_this.notifyRootSizeChange();\n            });\n            let lastWidth = this.androidUIElement.offsetWidth;\n            let lastHeight = this.androidUIElement.offsetHeight;\n            if (lastWidth > 0 && lastHeight > 0)\n                this.notifyRootSizeChange();\n            setInterval(() => {\n                let width = inner_this.androidUIElement.offsetWidth;\n                let height = inner_this.androidUIElement.offsetHeight;\n                if (lastHeight !== height || lastWidth !== width) {\n                    lastWidth = width;\n                    lastHeight = height;\n                    inner_this.notifyRootSizeChange();\n                }\n            }, 500);\n        }\n        initBrowserVisibleChange() {\n            var eventName = 'visibilitychange';\n            if (document['webkitHidden'] != undefined) {\n                eventName = 'webkitvisibilitychange';\n            }\n            document.addEventListener(eventName, () => {\n                if (document['hidden'] || document['webkitHidden']) {\n                    this.mActivityThread.scheduleApplicationHide();\n                }\n                else {\n                    this.mActivityThread.scheduleApplicationShow();\n                    this._viewRootImpl.invalidate();\n                }\n            }, false);\n        }\n        notifyRootSizeChange() {\n            if (this.refreshWindowBound()) {\n                let density = android.content.res.Resources.getDisplayMetrics().density;\n                this.tempRect.set(this._windowBound.left * density, this._windowBound.top * density, this._windowBound.right * density, this._windowBound.bottom * density);\n                let width = this._windowBound.width();\n                let height = this._windowBound.height();\n                this._canvas.width = width * density;\n                this._canvas.height = height * density;\n                this._canvas.style.width = width + \"px\";\n                this._canvas.style.height = height + \"px\";\n                this._viewRootImpl.notifyResized(this.tempRect);\n            }\n        }\n        viewAttachedDependOnDebugLayout(view) {\n            this.viewsDependOnDebugLayout.add(view);\n            this.showDebugLayout();\n        }\n        viewDetachedDependOnDebugLayout(view) {\n            this.viewsDependOnDebugLayout.delete(view);\n            if (this.viewsDependOnDebugLayout.size == 0 && !this.showDebugLayoutDefault) {\n                this.hideDebugLayout();\n            }\n        }\n        setDebugEnable(enable = true) {\n            ViewRootImpl.DEBUG_FPS = enable;\n            this.setShowDebugLayout(enable);\n        }\n        setShowDebugLayout(showDebugLayoutDefault = true) {\n            this.showDebugLayoutDefault = showDebugLayoutDefault;\n            if (showDebugLayoutDefault) {\n                this.showDebugLayout();\n            }\n            else {\n                this.hideDebugLayout();\n            }\n        }\n        showDebugLayout() {\n            if (this.windowManager.getWindowsLayout().bindElement.parentNode === null) {\n                this.androidUIElement.appendChild(this.windowManager.getWindowsLayout().bindElement);\n            }\n        }\n        hideDebugLayout() {\n            if (this.windowManager.getWindowsLayout().bindElement.parentNode === this.androidUIElement) {\n                this.androidUIElement.removeChild(this.windowManager.getWindowsLayout().bindElement);\n            }\n        }\n        setUIClient(uiClient) {\n            this.uiClient = uiClient;\n        }\n        showAppClosed() {\n            AndroidUI.showAppClosed(this);\n        }\n        static showAppClosed(androidUI) {\n            androidUI.androidUIElement.parentNode.removeChild(androidUI.androidUIElement);\n            if (androidUI.uiClient && androidUI.uiClient.shouldShowAppClosed) {\n                androidUI.uiClient.shouldShowAppClosed(androidUI);\n            }\n        }\n    }\n    AndroidUI.BindToElementName = 'AndroidUI';\n    androidui.AndroidUI = AndroidUI;\n})(androidui || (androidui = {}));\nvar android;\n(function (android) {\n    var app;\n    (function (app) {\n        var View = android.view.View;\n        var KeyEvent = android.view.KeyEvent;\n        var MotionEvent = android.view.MotionEvent;\n        var Window = android.view.Window;\n        var WindowManager = android.view.WindowManager;\n        var Log = android.util.Log;\n        var Context = android.content.Context;\n        var Intent = android.content.Intent;\n        class Activity extends Context {\n            constructor(androidUI) {\n                super(androidUI);\n                this.mWindowAdded = false;\n                this.mVisibleFromClient = true;\n                this.mResultCode = Activity.RESULT_CANCELED;\n                this.mResultData = null;\n                this.mWindow = new Window(this);\n                this.mWindow.setWindowAnimations(android.R.anim.activity_open_enter_ios, android.R.anim.activity_close_exit_ios, android.R.anim.activity_close_enter_ios, android.R.anim.activity_open_exit_ios);\n                this.mWindow.setDimAmount(0.7);\n                this.mWindow.getAttributes().flags |= WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;\n                this.mWindow.setCallback(this);\n            }\n            getIntent() {\n                return this.mIntent;\n            }\n            setIntent(newIntent) {\n                this.mIntent = newIntent;\n            }\n            getApplication() {\n                return this.getApplicationContext();\n            }\n            getWindowManager() {\n                return this.mWindow.getChildWindowManager();\n            }\n            getGlobalWindowManager() {\n                return this.getApplicationContext().getWindowManager();\n            }\n            getWindow() {\n                return this.mWindow;\n            }\n            getCurrentFocus() {\n                return this.mWindow != null ? this.mWindow.getCurrentFocus() : null;\n            }\n            onCreate(savedInstanceState) {\n                if (Activity.DEBUG_LIFECYCLE)\n                    Log.v(Activity.TAG, \"onCreate \" + this + \": \" + savedInstanceState);\n                this.getApplication().dispatchActivityCreated(this, savedInstanceState);\n                this.mCalled = true;\n            }\n            performRestoreInstanceState(savedInstanceState) {\n                this.onRestoreInstanceState(savedInstanceState);\n            }\n            onRestoreInstanceState(savedInstanceState) {\n            }\n            onPostCreate(savedInstanceState) {\n                this.onTitleChanged(this.getTitle());\n                this.mCalled = true;\n            }\n            onStart() {\n                if (Activity.DEBUG_LIFECYCLE)\n                    Log.v(Activity.TAG, \"onStart \" + this);\n                this.mCalled = true;\n                this.getApplication().dispatchActivityStarted(this);\n            }\n            onRestart() {\n                this.mCalled = true;\n            }\n            onResume() {\n                if (Activity.DEBUG_LIFECYCLE)\n                    Log.v(Activity.TAG, \"onResume \" + this);\n                this.getApplication().dispatchActivityResumed(this);\n                this.mCalled = true;\n            }\n            onPostResume() {\n                const win = this.getWindow();\n                if (win != null)\n                    win.makeActive();\n                this.mCalled = true;\n            }\n            onNewIntent(intent) {\n            }\n            performSaveInstanceState(outState) {\n                this.onSaveInstanceState(outState);\n                if (Activity.DEBUG_LIFECYCLE)\n                    Log.v(Activity.TAG, \"onSaveInstanceState \" + this + \": \" + outState);\n            }\n            onSaveInstanceState(outState) {\n                this.getApplication().dispatchActivitySaveInstanceState(this, outState);\n            }\n            onPause() {\n                if (Activity.DEBUG_LIFECYCLE)\n                    Log.v(Activity.TAG, \"onPause \" + this);\n                this.getApplication().dispatchActivityPaused(this);\n                this.mCalled = true;\n            }\n            onUserLeaveHint() {\n            }\n            onStop() {\n                if (Activity.DEBUG_LIFECYCLE)\n                    Log.v(Activity.TAG, \"onStop \" + this);\n                this.getApplication().dispatchActivityStopped(this);\n                this.mCalled = true;\n            }\n            onDestroy() {\n                if (Activity.DEBUG_LIFECYCLE)\n                    Log.v(Activity.TAG, \"onDestroy \" + this);\n                this.mCalled = true;\n                this.getApplication().dispatchActivityDestroyed(this);\n            }\n            findViewById(id) {\n                return this.getWindow().findViewById(id);\n            }\n            setContentView(view, params) {\n                if (!(view instanceof View)) {\n                    view = this.getLayoutInflater().inflate(view);\n                }\n                this.getWindow().setContentView(view, params);\n            }\n            addContentView(view, params) {\n                this.mWindow.addContentView(view, params);\n            }\n            setFinishOnTouchOutside(finish) {\n                this.mWindow.setCloseOnTouchOutside(finish);\n            }\n            onKeyDown(keyCode, event) {\n                if (keyCode == KeyEvent.KEYCODE_BACK) {\n                    event.startTracking();\n                    return true;\n                }\n                return false;\n            }\n            onKeyLongPress(keyCode, event) {\n                return false;\n            }\n            onKeyUp(keyCode, event) {\n                if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() && !event.isCanceled()) {\n                    this.onBackPressed();\n                    return true;\n                }\n                return false;\n            }\n            onBackPressed() {\n                this.finish();\n            }\n            onTouchEvent(event) {\n                if (this.mWindow.shouldCloseOnTouch(this, event)) {\n                    this.finish();\n                    return true;\n                }\n                return false;\n            }\n            onGenericMotionEvent(event) {\n                return false;\n            }\n            onUserInteraction() {\n            }\n            onWindowAttributesChanged(params) {\n                let decor = this.getWindow().getDecorView();\n                if (decor != null && decor.getParent() != null) {\n                    this.getWindowManager().updateWindowLayout(this.getWindow(), params);\n                }\n            }\n            onContentChanged() {\n            }\n            onWindowFocusChanged(hasFocus) {\n            }\n            onAttachedToWindow() {\n            }\n            onDetachedFromWindow() {\n            }\n            hasWindowFocus() {\n                let w = this.getWindow();\n                if (w != null) {\n                    let d = w.getDecorView();\n                    if (d != null) {\n                        return d.hasWindowFocus();\n                    }\n                }\n                return false;\n            }\n            dispatchKeyEvent(event) {\n                this.onUserInteraction();\n                let win = this.getWindow();\n                if (win.superDispatchKeyEvent(event)) {\n                    return true;\n                }\n                let decor = win.getDecorView();\n                return event.dispatch(this, decor != null ? decor.getKeyDispatcherState() : null, this);\n            }\n            dispatchTouchEvent(ev) {\n                if (ev.getAction() == MotionEvent.ACTION_DOWN) {\n                    this.onUserInteraction();\n                }\n                if (this.getWindow().superDispatchTouchEvent(ev)) {\n                    return true;\n                }\n                return this.onTouchEvent(ev);\n            }\n            dispatchGenericMotionEvent(ev) {\n                this.onUserInteraction();\n                if (this.getWindow().superDispatchGenericMotionEvent(ev)) {\n                    return true;\n                }\n                return this.onGenericMotionEvent(ev);\n            }\n            takeKeyEvents(_get) {\n                this.getWindow().takeKeyEvents(_get);\n            }\n            invalidateOptionsMenu() {\n                let menu = new android.view.Menu(this);\n                if (this.onCreateOptionsMenu(menu)) {\n                    menu.setCallback({\n                        onMenuItemSelected: (menu, item) => {\n                            let handle = this.onOptionsItemSelected(item);\n                            this.onOptionsMenuClosed(menu);\n                            return handle;\n                        }\n                    });\n                    this.mMenu = menu;\n                    this.mMenuPopuoHelper = this.invalidateOptionsMenuPopupHelper(menu);\n                }\n            }\n            invalidateOptionsMenuPopupHelper(menu) {\n                return null;\n            }\n            onCreateOptionsMenu(menu) {\n                return true;\n            }\n            onPrepareOptionsMenu(menu) {\n                return true;\n            }\n            onOptionsItemSelected(item) {\n                return false;\n            }\n            onOptionsMenuClosed(menu) {\n            }\n            openOptionsMenu() {\n                if (this.mMenuPopuoHelper)\n                    this.mMenuPopuoHelper.show();\n            }\n            closeOptionsMenu() {\n                if (this.mMenuPopuoHelper)\n                    this.mMenuPopuoHelper.dismiss();\n            }\n            startActivityForResult(intent, requestCode, options) {\n                if (typeof intent === 'string')\n                    intent = new Intent(intent);\n                if (requestCode >= 0)\n                    intent.mRequestCode = requestCode;\n                this.androidUI.mActivityThread.execStartActivity(this, intent, options);\n                if (requestCode >= 0) {\n                    this.mStartedActivity = true;\n                }\n                const decor = this.mWindow != null ? this.mWindow.peekDecorView() : null;\n                if (decor != null) {\n                    decor.cancelPendingInputEvents();\n                }\n            }\n            startActivities(intents, options) {\n                for (let intent of intents) {\n                    this.startActivity(intent, options);\n                }\n            }\n            startActivity(intent, options) {\n                if (options != null) {\n                    this.startActivityForResult(intent, -1, options);\n                }\n                else {\n                    this.startActivityForResult(intent, -1);\n                }\n            }\n            startActivityIfNeeded(intent, requestCode, options) {\n                if (this.androidUI.mActivityThread.canBackTo(intent)) {\n                    return false;\n                }\n                this.startActivityForResult(intent, requestCode, options);\n                return true;\n            }\n            overrideNextTransition(enterAnimation, exitAnimation, resumeAnimation, hideAnimation) {\n                this.androidUI.mActivityThread.overrideNextWindowAnimation(enterAnimation, exitAnimation, resumeAnimation, hideAnimation);\n            }\n            setResult(resultCode, data) {\n                {\n                    this.mResultCode = resultCode;\n                    this.mResultData = data;\n                }\n            }\n            getCallingActivity() {\n                return null;\n            }\n            setVisible(visible) {\n                if (this.mVisibleFromClient != visible) {\n                    this.mVisibleFromClient = visible;\n                }\n            }\n            makeVisible() {\n                if (!this.mWindowAdded) {\n                    let wm = this.getGlobalWindowManager();\n                    wm.addWindow(this.getWindow());\n                    this.mWindowAdded = true;\n                }\n                this.getWindow().getDecorView().setVisibility(View.VISIBLE);\n            }\n            isFinishing() {\n                return this.mFinished;\n            }\n            isDestroyed() {\n                return this.mDestroyed;\n            }\n            finish() {\n                let resultCode = this.mResultCode;\n                let resultData = this.mResultData;\n                try {\n                    this.androidUI.mActivityThread.scheduleDestroyActivity(this);\n                }\n                catch (e) {\n                }\n            }\n            finishActivity(requestCode) {\n                this.androidUI.mActivityThread.scheduleDestroyActivityByRequestCode(requestCode);\n            }\n            onActivityResult(requestCode, resultCode, data) {\n            }\n            setTitle(title) {\n                this.getWindow().setTitle(title);\n                this.onTitleChanged(title);\n            }\n            getTitle() {\n                return this.getWindow().getAttributes().getTitle();\n            }\n            onTitleChanged(title, color) {\n                const win = this.getWindow();\n                if (win != null) {\n                    win.setTitle(title);\n                }\n            }\n            runOnUiThread(action) {\n                action.run();\n            }\n            navigateUpTo(upIntent, upToRootIfNotFound = true) {\n                if (this.androidUI.mActivityThread.scheduleBackTo(upIntent)) {\n                    return true;\n                }\n                if (upToRootIfNotFound)\n                    this.androidUI.mActivityThread.scheduleBackToRoot();\n                return false;\n            }\n            performCreate(icicle) {\n                this.onCreate(icicle);\n                this.invalidateOptionsMenu();\n            }\n            performStart() {\n                this.mCalled = false;\n                this.onStart();\n                if (!this.mCalled) {\n                    throw Error(`new SuperNotCalledException(\"Activity \" + this.mComponent.toShortString() + \" did not call through to super.onStart()\")`);\n                }\n            }\n            performRestart() {\n                if (this.mStopped) {\n                    this.mStopped = false;\n                    this.mCalled = false;\n                    this.onRestart();\n                    if (!this.mCalled) {\n                        throw Error(`new SuperNotCalledException(\"Activity \" + this.mComponent.toShortString() + \" did not call through to super.onRestart()\")`);\n                    }\n                    this.performStart();\n                }\n            }\n            performResume() {\n                this.performRestart();\n                this.mCalled = false;\n                this.mResumed = true;\n                this.onResume();\n                if (!this.mCalled) {\n                    throw Error(`new SuperNotCalledException(\"Activity \" + this.mComponent.toShortString() + \" did not call through to super.onResume()\")`);\n                }\n                this.mCalled = false;\n                this.onPostResume();\n                if (!this.mCalled) {\n                    throw Error(`new SuperNotCalledException(\"Activity \" + this.mComponent.toShortString() + \" did not call through to super.onPostResume()\")`);\n                }\n            }\n            performPause() {\n                if (this.mResumed) {\n                    this.mCalled = false;\n                    this.onPause();\n                    this.mResumed = false;\n                    if (!this.mCalled) {\n                        throw Error(`new SuperNotCalledException(\"Activity ${this.constructor.name} did not call through to super.onPause()\")`);\n                    }\n                    this.mResumed = false;\n                }\n            }\n            performUserLeaving() {\n                this.onUserInteraction();\n                this.onUserLeaveHint();\n            }\n            performStop() {\n                if (!this.mStopped) {\n                    this.mCalled = false;\n                    this.onStop();\n                    if (!this.mCalled) {\n                        throw Error(`new SuperNotCalledException(\"Activity \" + this.mComponent.toShortString() + \" did not call through to super.onStop()\")`);\n                    }\n                    this.mStopped = true;\n                }\n                this.mResumed = false;\n            }\n            performDestroy() {\n                this.mDestroyed = true;\n                this.mWindow.destroy();\n                this.onDestroy();\n            }\n            isResumed() {\n                return this.mResumed;\n            }\n            dispatchActivityResult(who, requestCode, resultCode, data) {\n                this.onActivityResult(requestCode, resultCode, data);\n            }\n        }\n        Activity.TAG = \"Activity\";\n        Activity.DEBUG_LIFECYCLE = false;\n        Activity.RESULT_CANCELED = 0;\n        Activity.RESULT_OK = -1;\n        Activity.RESULT_FIRST_USER = 1;\n        app.Activity = Activity;\n    })(app = android.app || (android.app = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var app;\n    (function (app) {\n        var ArrayList = java.util.ArrayList;\n        var Context = android.content.Context;\n        class Application extends Context {\n            constructor() {\n                super(...arguments);\n                this.mActivityLifecycleCallbacks = new ArrayList();\n            }\n            onCreate() {\n            }\n            getWindowManager() {\n                if (!this.mWindowManager)\n                    this.mWindowManager = new android.view.WindowManager(this);\n                return this.mWindowManager;\n            }\n            registerActivityLifecycleCallbacks(callback) {\n                {\n                    this.mActivityLifecycleCallbacks.add(callback);\n                }\n            }\n            unregisterActivityLifecycleCallbacks(callback) {\n                {\n                    this.mActivityLifecycleCallbacks.remove(callback);\n                }\n            }\n            dispatchActivityCreated(activity, savedInstanceState) {\n                let callbacks = this.collectActivityLifecycleCallbacks();\n                if (callbacks != null) {\n                    for (let i = 0; i < callbacks.length; i++) {\n                        callbacks[i].onActivityCreated(activity, savedInstanceState);\n                    }\n                }\n            }\n            dispatchActivityStarted(activity) {\n                let callbacks = this.collectActivityLifecycleCallbacks();\n                if (callbacks != null) {\n                    for (let i = 0; i < callbacks.length; i++) {\n                        callbacks[i].onActivityStarted(activity);\n                    }\n                }\n            }\n            dispatchActivityResumed(activity) {\n                let callbacks = this.collectActivityLifecycleCallbacks();\n                if (callbacks != null) {\n                    for (let i = 0; i < callbacks.length; i++) {\n                        callbacks[i].onActivityResumed(activity);\n                    }\n                }\n            }\n            dispatchActivityPaused(activity) {\n                let callbacks = this.collectActivityLifecycleCallbacks();\n                if (callbacks != null) {\n                    for (let i = 0; i < callbacks.length; i++) {\n                        callbacks[i].onActivityPaused(activity);\n                    }\n                }\n            }\n            dispatchActivityStopped(activity) {\n                let callbacks = this.collectActivityLifecycleCallbacks();\n                if (callbacks != null) {\n                    for (let i = 0; i < callbacks.length; i++) {\n                        callbacks[i].onActivityStopped(activity);\n                    }\n                }\n            }\n            dispatchActivitySaveInstanceState(activity, outState) {\n                let callbacks = this.collectActivityLifecycleCallbacks();\n                if (callbacks != null) {\n                    for (let i = 0; i < callbacks.length; i++) {\n                        callbacks[i].onActivitySaveInstanceState(activity, outState);\n                    }\n                }\n            }\n            dispatchActivityDestroyed(activity) {\n                let callbacks = this.collectActivityLifecycleCallbacks();\n                if (callbacks != null) {\n                    for (let i = 0; i < callbacks.length; i++) {\n                        callbacks[i].onActivityDestroyed(activity);\n                    }\n                }\n            }\n            collectActivityLifecycleCallbacks() {\n                let callbacks = null;\n                {\n                    if (this.mActivityLifecycleCallbacks.size() > 0) {\n                        callbacks = this.mActivityLifecycleCallbacks.toArray();\n                    }\n                }\n                return callbacks;\n            }\n        }\n        app.Application = Application;\n    })(app = android.app || (android.app = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var Log = android.util.Log;\n        var Pools = android.util.Pools;\n        class VelocityTracker {\n            constructor() {\n                this.mLastTouchIndex = 0;\n                this.mGeneration = 0;\n                this.clear();\n            }\n            static obtain() {\n                let instance = VelocityTracker.sPool.acquire();\n                return (instance != null) ? instance : new VelocityTracker();\n            }\n            recycle() {\n                this.clear();\n                VelocityTracker.sPool.release(this);\n            }\n            setNextPoolable(element) {\n                this.mNext = element;\n            }\n            getNextPoolable() {\n                return this.mNext;\n            }\n            clear() {\n                VelocityTracker.releasePointerList(this.mPointerListHead);\n                this.mPointerListHead = null;\n                this.mLastTouchIndex = 0;\n            }\n            addMovement(ev) {\n                let historySize = ev.getHistorySize();\n                const pointerCount = ev.getPointerCount();\n                const lastTouchIndex = this.mLastTouchIndex;\n                const nextTouchIndex = (lastTouchIndex + 1) % VelocityTracker.NUM_PAST;\n                const finalTouchIndex = (nextTouchIndex + historySize) % VelocityTracker.NUM_PAST;\n                const generation = this.mGeneration++;\n                this.mLastTouchIndex = finalTouchIndex;\n                let previousPointer = null;\n                for (let i = 0; i < pointerCount; i++) {\n                    const pointerId = ev.getPointerId(i);\n                    let nextPointer;\n                    if (previousPointer == null || pointerId < previousPointer.id) {\n                        previousPointer = null;\n                        nextPointer = this.mPointerListHead;\n                    }\n                    else {\n                        nextPointer = previousPointer.next;\n                    }\n                    let pointer;\n                    for (;;) {\n                        if (nextPointer != null) {\n                            const nextPointerId = nextPointer.id;\n                            if (nextPointerId == pointerId) {\n                                pointer = nextPointer;\n                                break;\n                            }\n                            if (nextPointerId < pointerId) {\n                                nextPointer = nextPointer.next;\n                                continue;\n                            }\n                        }\n                        pointer = VelocityTracker.obtainPointer();\n                        pointer.id = pointerId;\n                        pointer.pastTime[lastTouchIndex] = Number.MIN_VALUE;\n                        pointer.next = nextPointer;\n                        if (previousPointer == null) {\n                            this.mPointerListHead = pointer;\n                        }\n                        else {\n                            previousPointer.next = pointer;\n                        }\n                        break;\n                    }\n                    pointer.generation = generation;\n                    previousPointer = pointer;\n                    const pastX = pointer.pastX;\n                    const pastY = pointer.pastY;\n                    const pastTime = pointer.pastTime;\n                    historySize = ev.getHistorySize(pointerId);\n                    for (let j = 0; j < historySize; j++) {\n                        const touchIndex = (nextTouchIndex + j) % VelocityTracker.NUM_PAST;\n                        pastX[touchIndex] = ev.getHistoricalX(i, j);\n                        pastY[touchIndex] = ev.getHistoricalY(i, j);\n                        pastTime[touchIndex] = ev.getHistoricalEventTime(i, j);\n                    }\n                    pastX[finalTouchIndex] = ev.getX(i);\n                    pastY[finalTouchIndex] = ev.getY(i);\n                    pastTime[finalTouchIndex] = ev.getEventTime();\n                }\n                previousPointer = null;\n                for (let pointer = this.mPointerListHead; pointer != null;) {\n                    const nextPointer = pointer.next;\n                    if (pointer.generation != generation) {\n                        if (previousPointer == null) {\n                            this.mPointerListHead = nextPointer;\n                        }\n                        else {\n                            previousPointer.next = nextPointer;\n                        }\n                        VelocityTracker.releasePointer(pointer);\n                    }\n                    else {\n                        previousPointer = pointer;\n                    }\n                    pointer = nextPointer;\n                }\n            }\n            computeCurrentVelocity(units, maxVelocity = Number.MAX_SAFE_INTEGER) {\n                const lastTouchIndex = this.mLastTouchIndex;\n                for (let pointer = this.mPointerListHead; pointer != null; pointer = pointer.next) {\n                    const pastTime = pointer.pastTime;\n                    let oldestTouchIndex = lastTouchIndex;\n                    let numTouches = 1;\n                    const minTime = pastTime[lastTouchIndex] - VelocityTracker.MAX_AGE_MILLISECONDS;\n                    while (numTouches < VelocityTracker.NUM_PAST) {\n                        const nextOldestTouchIndex = (oldestTouchIndex + VelocityTracker.NUM_PAST - 1) % VelocityTracker.NUM_PAST;\n                        const nextOldestTime = pastTime[nextOldestTouchIndex];\n                        if (nextOldestTime < minTime) {\n                            break;\n                        }\n                        oldestTouchIndex = nextOldestTouchIndex;\n                        numTouches += 1;\n                    }\n                    if (numTouches > 3) {\n                        numTouches -= 1;\n                    }\n                    const pastX = pointer.pastX;\n                    const pastY = pointer.pastY;\n                    const oldestX = pastX[oldestTouchIndex];\n                    const oldestY = pastY[oldestTouchIndex];\n                    const oldestTime = pastTime[oldestTouchIndex];\n                    let accumX = 0;\n                    let accumY = 0;\n                    for (let i = 1; i < numTouches; i++) {\n                        const touchIndex = (oldestTouchIndex + i) % VelocityTracker.NUM_PAST;\n                        const duration = (pastTime[touchIndex] - oldestTime);\n                        if (duration == 0)\n                            continue;\n                        let delta = pastX[touchIndex] - oldestX;\n                        let velocity = (delta / duration) * units;\n                        accumX = (accumX == 0) ? velocity : (accumX + velocity) * .5;\n                        delta = pastY[touchIndex] - oldestY;\n                        velocity = (delta / duration) * units;\n                        accumY = (accumY == 0) ? velocity : (accumY + velocity) * .5;\n                    }\n                    if (accumX < -maxVelocity) {\n                        accumX = -maxVelocity;\n                    }\n                    else if (accumX > maxVelocity) {\n                        accumX = maxVelocity;\n                    }\n                    if (accumY < -maxVelocity) {\n                        accumY = -maxVelocity;\n                    }\n                    else if (accumY > maxVelocity) {\n                        accumY = maxVelocity;\n                    }\n                    pointer.xVelocity = accumX;\n                    pointer.yVelocity = accumY;\n                    if (VelocityTracker.localLOGV) {\n                        Log.v(VelocityTracker.TAG, \"Pointer \" + pointer.id\n                            + \": Y velocity=\" + accumX + \" X velocity=\" + accumY + \" N=\" + numTouches);\n                    }\n                }\n            }\n            getXVelocity(id = 0) {\n                let pointer = this.getPointer(id);\n                return pointer != null ? pointer.xVelocity : 0;\n            }\n            getYVelocity(id = 0) {\n                let pointer = this.getPointer(id);\n                return pointer != null ? pointer.yVelocity : 0;\n            }\n            getPointer(id) {\n                for (let pointer = this.mPointerListHead; pointer != null; pointer = pointer.next) {\n                    if (pointer.id == id) {\n                        return pointer;\n                    }\n                }\n                return null;\n            }\n            static obtainPointer() {\n                if (VelocityTracker.sRecycledPointerCount != 0) {\n                    let element = VelocityTracker.sRecycledPointerListHead;\n                    VelocityTracker.sRecycledPointerCount -= 1;\n                    VelocityTracker.sRecycledPointerListHead = element.next;\n                    element.next = null;\n                    return element;\n                }\n                return new Pointer();\n            }\n            static releasePointer(pointer) {\n                if (VelocityTracker.sRecycledPointerCount < VelocityTracker.POINTER_POOL_CAPACITY) {\n                    pointer.next = VelocityTracker.sRecycledPointerListHead;\n                    VelocityTracker.sRecycledPointerCount += 1;\n                    VelocityTracker.sRecycledPointerListHead = pointer;\n                }\n            }\n            static releasePointerList(pointer) {\n                if (pointer != null) {\n                    let count = VelocityTracker.sRecycledPointerCount;\n                    if (count >= VelocityTracker.POINTER_POOL_CAPACITY) {\n                        return;\n                    }\n                    let tail = pointer;\n                    for (;;) {\n                        count += 1;\n                        if (count >= VelocityTracker.POINTER_POOL_CAPACITY) {\n                            break;\n                        }\n                        let next = tail.next;\n                        if (next == null) {\n                            break;\n                        }\n                        tail = next;\n                    }\n                    tail.next = VelocityTracker.sRecycledPointerListHead;\n                    VelocityTracker.sRecycledPointerCount = count;\n                    VelocityTracker.sRecycledPointerListHead = pointer;\n                }\n            }\n        }\n        VelocityTracker.TAG = \"VelocityTracker\";\n        VelocityTracker.DEBUG = Log.VelocityTracker_DBG;\n        VelocityTracker.localLOGV = VelocityTracker.DEBUG;\n        VelocityTracker.NUM_PAST = 10;\n        VelocityTracker.MAX_AGE_MILLISECONDS = 200;\n        VelocityTracker.POINTER_POOL_CAPACITY = 20;\n        VelocityTracker.sPool = new Pools.SynchronizedPool(2);\n        VelocityTracker.sRecycledPointerCount = 0;\n        view.VelocityTracker = VelocityTracker;\n        class Pointer {\n            constructor() {\n                this.id = 0;\n                this.xVelocity = 0;\n                this.yVelocity = 0;\n                this.pastX = androidui.util.ArrayCreator.newNumberArray(VelocityTracker.NUM_PAST);\n                this.pastY = androidui.util.ArrayCreator.newNumberArray(VelocityTracker.NUM_PAST);\n                this.pastTime = androidui.util.ArrayCreator.newNumberArray(VelocityTracker.NUM_PAST);\n                this.generation = 0;\n            }\n        }\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var SystemClock = android.os.SystemClock;\n        var MotionEvent = android.view.MotionEvent;\n        var ViewConfiguration = android.view.ViewConfiguration;\n        var TypedValue = android.util.TypedValue;\n        class ScaleGestureDetector {\n            constructor(listener, handler) {\n                this.mFocusX = 0;\n                this.mFocusY = 0;\n                this.mCurrSpan = 0;\n                this.mPrevSpan = 0;\n                this.mInitialSpan = 0;\n                this.mCurrSpanX = 0;\n                this.mCurrSpanY = 0;\n                this.mPrevSpanX = 0;\n                this.mPrevSpanY = 0;\n                this.mCurrTime = 0;\n                this.mPrevTime = 0;\n                this.mSpanSlop = 0;\n                this.mMinSpan = 0;\n                this.mTouchUpper = 0;\n                this.mTouchLower = 0;\n                this.mTouchHistoryLastAccepted = 0;\n                this.mTouchHistoryDirection = 0;\n                this.mTouchHistoryLastAcceptedTime = 0;\n                this.mTouchMinMajor = 0;\n                this.mDoubleTapMode = ScaleGestureDetector.DOUBLE_TAP_MODE_NONE;\n                this.mListener = listener;\n                this.mSpanSlop = ViewConfiguration.get().getScaledTouchSlop() * 2;\n                this.mTouchMinMajor = TypedValue.complexToDimensionPixelSize('48dp');\n                this.mMinSpan = TypedValue.complexToDimensionPixelSize('27mm');\n                this.mHandler = handler;\n                this.setQuickScaleEnabled(true);\n            }\n            addTouchHistory(ev) {\n                const currentTime = SystemClock.uptimeMillis();\n                const count = ev.getPointerCount();\n                let accept = currentTime - this.mTouchHistoryLastAcceptedTime >= ScaleGestureDetector.TOUCH_STABILIZE_TIME;\n                let total = 0;\n                let sampleCount = 0;\n                for (let i = 0; i < count; i++) {\n                    const hasLastAccepted = !Number.isNaN(this.mTouchHistoryLastAccepted);\n                    const historySize = ev.getHistorySize();\n                    const pointerSampleCount = historySize + 1;\n                    for (let h = 0; h < pointerSampleCount; h++) {\n                        let major;\n                        if (h < historySize) {\n                            major = ev.getHistoricalTouchMajor(i, h);\n                        }\n                        else {\n                            major = ev.getTouchMajor(i);\n                        }\n                        if (major < this.mTouchMinMajor)\n                            major = this.mTouchMinMajor;\n                        total += major;\n                        if (Number.isNaN(this.mTouchUpper) || major > this.mTouchUpper) {\n                            this.mTouchUpper = major;\n                        }\n                        if (Number.isNaN(this.mTouchLower) || major < this.mTouchLower) {\n                            this.mTouchLower = major;\n                        }\n                        if (hasLastAccepted) {\n                            function Math_signum(value) {\n                                if (value === 0 || Number.isNaN(value))\n                                    return value;\n                                return Math.abs(value) === value ? 1 : -1;\n                            }\n                            const directionSig = Math.floor(Math_signum(major - this.mTouchHistoryLastAccepted));\n                            if (directionSig != this.mTouchHistoryDirection || (directionSig == 0 && this.mTouchHistoryDirection == 0)) {\n                                this.mTouchHistoryDirection = directionSig;\n                                const time = h < historySize ? ev.getHistoricalEventTime(h) : ev.getEventTime();\n                                this.mTouchHistoryLastAcceptedTime = time;\n                                accept = false;\n                            }\n                        }\n                    }\n                    sampleCount += pointerSampleCount;\n                }\n                const avg = total / sampleCount;\n                if (accept) {\n                    let newAccepted = (this.mTouchUpper + this.mTouchLower + avg) / 3;\n                    this.mTouchUpper = (this.mTouchUpper + newAccepted) / 2;\n                    this.mTouchLower = (this.mTouchLower + newAccepted) / 2;\n                    this.mTouchHistoryLastAccepted = newAccepted;\n                    this.mTouchHistoryDirection = 0;\n                    this.mTouchHistoryLastAcceptedTime = ev.getEventTime();\n                }\n            }\n            clearTouchHistory() {\n                this.mTouchUpper = Number.NaN;\n                this.mTouchLower = Number.NaN;\n                this.mTouchHistoryLastAccepted = Number.NaN;\n                this.mTouchHistoryDirection = 0;\n                this.mTouchHistoryLastAcceptedTime = 0;\n            }\n            onTouchEvent(event) {\n                this.mCurrTime = event.getEventTime();\n                const action = event.getActionMasked();\n                if (this.mQuickScaleEnabled) {\n                    this.mGestureDetector.onTouchEvent(event);\n                }\n                const streamComplete = action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL;\n                if (action == MotionEvent.ACTION_DOWN || streamComplete) {\n                    if (this.mInProgress) {\n                        this.mListener.onScaleEnd(this);\n                        this.mInProgress = false;\n                        this.mInitialSpan = 0;\n                        this.mDoubleTapMode = ScaleGestureDetector.DOUBLE_TAP_MODE_NONE;\n                    }\n                    else if (this.mDoubleTapMode == ScaleGestureDetector.DOUBLE_TAP_MODE_IN_PROGRESS && streamComplete) {\n                        this.mInProgress = false;\n                        this.mInitialSpan = 0;\n                        this.mDoubleTapMode = ScaleGestureDetector.DOUBLE_TAP_MODE_NONE;\n                    }\n                    if (streamComplete) {\n                        this.clearTouchHistory();\n                        return true;\n                    }\n                }\n                const configChanged = action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_POINTER_UP || action == MotionEvent.ACTION_POINTER_DOWN;\n                const pointerUp = action == MotionEvent.ACTION_POINTER_UP;\n                const skipIndex = pointerUp ? event.getActionIndex() : -1;\n                let sumX = 0, sumY = 0;\n                const count = event.getPointerCount();\n                const div = pointerUp ? count - 1 : count;\n                let focusX;\n                let focusY;\n                if (this.mDoubleTapMode == ScaleGestureDetector.DOUBLE_TAP_MODE_IN_PROGRESS) {\n                    focusX = this.mDoubleTapEvent.getX();\n                    focusY = this.mDoubleTapEvent.getY();\n                    if (event.getY() < focusY) {\n                        this.mEventBeforeOrAboveStartingGestureEvent = true;\n                    }\n                    else {\n                        this.mEventBeforeOrAboveStartingGestureEvent = false;\n                    }\n                }\n                else {\n                    for (let i = 0; i < count; i++) {\n                        if (skipIndex == i)\n                            continue;\n                        sumX += event.getX(i);\n                        sumY += event.getY(i);\n                    }\n                    focusX = sumX / div;\n                    focusY = sumY / div;\n                }\n                this.addTouchHistory(event);\n                let devSumX = 0, devSumY = 0;\n                for (let i = 0; i < count; i++) {\n                    if (skipIndex == i)\n                        continue;\n                    const touchSize = this.mTouchHistoryLastAccepted / 2;\n                    devSumX += Math.abs(event.getX(i) - focusX) + touchSize;\n                    devSumY += Math.abs(event.getY(i) - focusY) + touchSize;\n                }\n                const devX = devSumX / div;\n                const devY = devSumY / div;\n                const spanX = devX * 2;\n                const spanY = devY * 2;\n                let span;\n                if (this.inDoubleTapMode()) {\n                    span = spanY;\n                }\n                else {\n                    span = Math.sqrt(spanX * spanX + spanY * spanY);\n                }\n                const wasInProgress = this.mInProgress;\n                this.mFocusX = focusX;\n                this.mFocusY = focusY;\n                if (!this.inDoubleTapMode() && this.mInProgress && (span < this.mMinSpan || configChanged)) {\n                    this.mListener.onScaleEnd(this);\n                    this.mInProgress = false;\n                    this.mInitialSpan = span;\n                    this.mDoubleTapMode = ScaleGestureDetector.DOUBLE_TAP_MODE_NONE;\n                }\n                if (configChanged) {\n                    this.mPrevSpanX = this.mCurrSpanX = spanX;\n                    this.mPrevSpanY = this.mCurrSpanY = spanY;\n                    this.mInitialSpan = this.mPrevSpan = this.mCurrSpan = span;\n                }\n                const minSpan = this.inDoubleTapMode() ? this.mSpanSlop : this.mMinSpan;\n                if (!this.mInProgress && span >= minSpan && (wasInProgress || Math.abs(span - this.mInitialSpan) > this.mSpanSlop)) {\n                    this.mPrevSpanX = this.mCurrSpanX = spanX;\n                    this.mPrevSpanY = this.mCurrSpanY = spanY;\n                    this.mPrevSpan = this.mCurrSpan = span;\n                    this.mPrevTime = this.mCurrTime;\n                    this.mInProgress = this.mListener.onScaleBegin(this);\n                }\n                if (action == MotionEvent.ACTION_MOVE) {\n                    this.mCurrSpanX = spanX;\n                    this.mCurrSpanY = spanY;\n                    this.mCurrSpan = span;\n                    let updatePrev = true;\n                    if (this.mInProgress) {\n                        updatePrev = this.mListener.onScale(this);\n                    }\n                    if (updatePrev) {\n                        this.mPrevSpanX = this.mCurrSpanX;\n                        this.mPrevSpanY = this.mCurrSpanY;\n                        this.mPrevSpan = this.mCurrSpan;\n                        this.mPrevTime = this.mCurrTime;\n                    }\n                }\n                return true;\n            }\n            inDoubleTapMode() {\n                return this.mDoubleTapMode == ScaleGestureDetector.DOUBLE_TAP_MODE_IN_PROGRESS;\n            }\n            setQuickScaleEnabled(scales) {\n                this.mQuickScaleEnabled = scales;\n                if (this.mQuickScaleEnabled && this.mGestureDetector == null) {\n                    let gestureListener = (() => {\n                        const inner_this = this;\n                        class _Inner extends view.GestureDetector.SimpleOnGestureListener {\n                            onDoubleTap(e) {\n                                inner_this.mDoubleTapEvent = e;\n                                inner_this.mDoubleTapMode = ScaleGestureDetector.DOUBLE_TAP_MODE_IN_PROGRESS;\n                                return true;\n                            }\n                        }\n                        return new _Inner();\n                    })();\n                    this.mGestureDetector = new view.GestureDetector(gestureListener, this.mHandler);\n                }\n            }\n            isQuickScaleEnabled() {\n                return this.mQuickScaleEnabled;\n            }\n            isInProgress() {\n                return this.mInProgress;\n            }\n            getFocusX() {\n                return this.mFocusX;\n            }\n            getFocusY() {\n                return this.mFocusY;\n            }\n            getCurrentSpan() {\n                return this.mCurrSpan;\n            }\n            getCurrentSpanX() {\n                return this.mCurrSpanX;\n            }\n            getCurrentSpanY() {\n                return this.mCurrSpanY;\n            }\n            getPreviousSpan() {\n                return this.mPrevSpan;\n            }\n            getPreviousSpanX() {\n                return this.mPrevSpanX;\n            }\n            getPreviousSpanY() {\n                return this.mPrevSpanY;\n            }\n            getScaleFactor() {\n                if (this.inDoubleTapMode()) {\n                    const scaleUp = (this.mEventBeforeOrAboveStartingGestureEvent && (this.mCurrSpan < this.mPrevSpan)) || (!this.mEventBeforeOrAboveStartingGestureEvent && (this.mCurrSpan > this.mPrevSpan));\n                    const spanDiff = (Math.abs(1 - (this.mCurrSpan / this.mPrevSpan)) * ScaleGestureDetector.SCALE_FACTOR);\n                    return this.mPrevSpan <= 0 ? 1 : scaleUp ? (1 + spanDiff) : (1 - spanDiff);\n                }\n                return this.mPrevSpan > 0 ? this.mCurrSpan / this.mPrevSpan : 1;\n            }\n            getTimeDelta() {\n                return this.mCurrTime - this.mPrevTime;\n            }\n            getEventTime() {\n                return this.mCurrTime;\n            }\n        }\n        ScaleGestureDetector.TAG = \"ScaleGestureDetector\";\n        ScaleGestureDetector.TOUCH_STABILIZE_TIME = 128;\n        ScaleGestureDetector.DOUBLE_TAP_MODE_NONE = 0;\n        ScaleGestureDetector.DOUBLE_TAP_MODE_IN_PROGRESS = 1;\n        ScaleGestureDetector.SCALE_FACTOR = .5;\n        view.ScaleGestureDetector = ScaleGestureDetector;\n        (function (ScaleGestureDetector) {\n            class SimpleOnScaleGestureListener {\n                onScale(detector) {\n                    return false;\n                }\n                onScaleBegin(detector) {\n                    return true;\n                }\n                onScaleEnd(detector) {\n                }\n            }\n            ScaleGestureDetector.SimpleOnScaleGestureListener = SimpleOnScaleGestureListener;\n        })(ScaleGestureDetector = view.ScaleGestureDetector || (view.ScaleGestureDetector = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var Handler = android.os.Handler;\n        var MotionEvent = android.view.MotionEvent;\n        var VelocityTracker = android.view.VelocityTracker;\n        var ViewConfiguration = android.view.ViewConfiguration;\n        class GestureDetector {\n            constructor(listener, handler) {\n                this.mTouchSlopSquare = 0;\n                this.mDoubleTapTouchSlopSquare = 0;\n                this.mDoubleTapSlopSquare = 0;\n                this.mMinimumFlingVelocity = 0;\n                this.mMaximumFlingVelocity = 0;\n                this.mLastFocusX = 0;\n                this.mLastFocusY = 0;\n                this.mDownFocusX = 0;\n                this.mDownFocusY = 0;\n                this.mHandler = new GestureDetector.GestureHandler(this);\n                this.mListener = listener;\n                if (listener['setOnDoubleTapListener']) {\n                    this.setOnDoubleTapListener(listener);\n                }\n                this.init();\n            }\n            init() {\n                if (this.mListener == null) {\n                    throw Error(`new NullPointerException(\"OnGestureListener must not be null\")`);\n                }\n                this.mIsLongpressEnabled = true;\n                let touchSlop, doubleTapSlop, doubleTapTouchSlop;\n                const configuration = ViewConfiguration.get();\n                touchSlop = configuration.getScaledTouchSlop();\n                doubleTapTouchSlop = configuration.getScaledDoubleTapTouchSlop();\n                doubleTapSlop = configuration.getScaledDoubleTapSlop();\n                this.mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();\n                this.mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();\n                this.mTouchSlopSquare = touchSlop * touchSlop;\n                this.mDoubleTapTouchSlopSquare = doubleTapTouchSlop * doubleTapTouchSlop;\n                this.mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;\n            }\n            setOnDoubleTapListener(onDoubleTapListener) {\n                this.mDoubleTapListener = onDoubleTapListener;\n            }\n            setIsLongpressEnabled(isLongpressEnabled) {\n                this.mIsLongpressEnabled = isLongpressEnabled;\n            }\n            isLongpressEnabled() {\n                return this.mIsLongpressEnabled;\n            }\n            onTouchEvent(ev) {\n                const action = ev.getAction();\n                if (this.mVelocityTracker == null) {\n                    this.mVelocityTracker = VelocityTracker.obtain();\n                }\n                this.mVelocityTracker.addMovement(ev);\n                const pointerUp = (action & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP;\n                const skipIndex = pointerUp ? ev.getActionIndex() : -1;\n                let sumX = 0, sumY = 0;\n                const count = ev.getPointerCount();\n                for (let i = 0; i < count; i++) {\n                    if (skipIndex == i)\n                        continue;\n                    sumX += ev.getX(i);\n                    sumY += ev.getY(i);\n                }\n                const div = pointerUp ? count - 1 : count;\n                const focusX = sumX / div;\n                const focusY = sumY / div;\n                let handled = false;\n                switch (action & MotionEvent.ACTION_MASK) {\n                    case MotionEvent.ACTION_POINTER_DOWN:\n                        this.mDownFocusX = this.mLastFocusX = focusX;\n                        this.mDownFocusY = this.mLastFocusY = focusY;\n                        this.cancelTaps();\n                        break;\n                    case MotionEvent.ACTION_POINTER_UP:\n                        this.mDownFocusX = this.mLastFocusX = focusX;\n                        this.mDownFocusY = this.mLastFocusY = focusY;\n                        this.mVelocityTracker.computeCurrentVelocity(1000, this.mMaximumFlingVelocity);\n                        const upIndex = ev.getActionIndex();\n                        const id1 = ev.getPointerId(upIndex);\n                        const x1 = this.mVelocityTracker.getXVelocity(id1);\n                        const y1 = this.mVelocityTracker.getYVelocity(id1);\n                        for (let i = 0; i < count; i++) {\n                            if (i == upIndex)\n                                continue;\n                            const id2 = ev.getPointerId(i);\n                            const x = x1 * this.mVelocityTracker.getXVelocity(id2);\n                            const y = y1 * this.mVelocityTracker.getYVelocity(id2);\n                            const dot = x + y;\n                            if (dot < 0) {\n                                this.mVelocityTracker.clear();\n                                break;\n                            }\n                        }\n                        break;\n                    case MotionEvent.ACTION_DOWN:\n                        if (this.mDoubleTapListener != null) {\n                            let hadTapMessage = this.mHandler.hasMessages(GestureDetector.TAP);\n                            if (hadTapMessage)\n                                this.mHandler.removeMessages(GestureDetector.TAP);\n                            if ((this.mCurrentDownEvent != null) && (this.mPreviousUpEvent != null) && hadTapMessage && this.isConsideredDoubleTap(this.mCurrentDownEvent, this.mPreviousUpEvent, ev)) {\n                                this.mIsDoubleTapping = true;\n                                handled = this.mDoubleTapListener.onDoubleTap(this.mCurrentDownEvent) || handled;\n                                handled = this.mDoubleTapListener.onDoubleTapEvent(ev) || handled;\n                            }\n                            else {\n                                this.mHandler.sendEmptyMessageDelayed(GestureDetector.TAP, GestureDetector.DOUBLE_TAP_TIMEOUT);\n                            }\n                        }\n                        this.mDownFocusX = this.mLastFocusX = focusX;\n                        this.mDownFocusY = this.mLastFocusY = focusY;\n                        if (this.mCurrentDownEvent != null) {\n                            this.mCurrentDownEvent.recycle();\n                        }\n                        this.mCurrentDownEvent = MotionEvent.obtain(ev);\n                        this.mAlwaysInTapRegion = true;\n                        this.mAlwaysInBiggerTapRegion = true;\n                        this.mStillDown = true;\n                        this.mInLongPress = false;\n                        this.mDeferConfirmSingleTap = false;\n                        if (this.mIsLongpressEnabled) {\n                            this.mHandler.removeMessages(GestureDetector.LONG_PRESS);\n                            this.mHandler.sendEmptyMessageAtTime(GestureDetector.LONG_PRESS, this.mCurrentDownEvent.getDownTime() + GestureDetector.TAP_TIMEOUT + GestureDetector.LONGPRESS_TIMEOUT);\n                        }\n                        this.mHandler.sendEmptyMessageAtTime(GestureDetector.SHOW_PRESS, this.mCurrentDownEvent.getDownTime() + GestureDetector.TAP_TIMEOUT);\n                        handled = this.mListener.onDown(ev) || handled;\n                        break;\n                    case MotionEvent.ACTION_MOVE:\n                        if (this.mInLongPress) {\n                            break;\n                        }\n                        const scrollX = this.mLastFocusX - focusX;\n                        const scrollY = this.mLastFocusY - focusY;\n                        if (this.mIsDoubleTapping) {\n                            handled = this.mDoubleTapListener.onDoubleTapEvent(ev) || handled;\n                        }\n                        else if (this.mAlwaysInTapRegion) {\n                            const deltaX = Math.floor((focusX - this.mDownFocusX));\n                            const deltaY = Math.floor((focusY - this.mDownFocusY));\n                            let distance = (deltaX * deltaX) + (deltaY * deltaY);\n                            if (distance > this.mTouchSlopSquare) {\n                                handled = this.mListener.onScroll(this.mCurrentDownEvent, ev, scrollX, scrollY);\n                                this.mLastFocusX = focusX;\n                                this.mLastFocusY = focusY;\n                                this.mAlwaysInTapRegion = false;\n                                this.mHandler.removeMessages(GestureDetector.TAP);\n                                this.mHandler.removeMessages(GestureDetector.SHOW_PRESS);\n                                this.mHandler.removeMessages(GestureDetector.LONG_PRESS);\n                            }\n                            if (distance > this.mDoubleTapTouchSlopSquare) {\n                                this.mAlwaysInBiggerTapRegion = false;\n                            }\n                        }\n                        else if ((Math.abs(scrollX) >= 1) || (Math.abs(scrollY) >= 1)) {\n                            handled = this.mListener.onScroll(this.mCurrentDownEvent, ev, scrollX, scrollY);\n                            this.mLastFocusX = focusX;\n                            this.mLastFocusY = focusY;\n                        }\n                        break;\n                    case MotionEvent.ACTION_UP:\n                        this.mStillDown = false;\n                        let currentUpEvent = MotionEvent.obtain(ev);\n                        if (this.mIsDoubleTapping) {\n                            handled = this.mDoubleTapListener.onDoubleTapEvent(ev) || handled;\n                        }\n                        else if (this.mInLongPress) {\n                            this.mHandler.removeMessages(GestureDetector.TAP);\n                            this.mInLongPress = false;\n                        }\n                        else if (this.mAlwaysInTapRegion) {\n                            handled = this.mListener.onSingleTapUp(ev);\n                            if (this.mDeferConfirmSingleTap && this.mDoubleTapListener != null) {\n                                this.mDoubleTapListener.onSingleTapConfirmed(ev);\n                            }\n                        }\n                        else {\n                            const velocityTracker = this.mVelocityTracker;\n                            const pointerId = ev.getPointerId(0);\n                            velocityTracker.computeCurrentVelocity(1000, this.mMaximumFlingVelocity);\n                            const velocityY = velocityTracker.getYVelocity(pointerId);\n                            const velocityX = velocityTracker.getXVelocity(pointerId);\n                            if ((Math.abs(velocityY) > this.mMinimumFlingVelocity) || (Math.abs(velocityX) > this.mMinimumFlingVelocity)) {\n                                handled = this.mListener.onFling(this.mCurrentDownEvent, ev, velocityX, velocityY);\n                            }\n                        }\n                        if (this.mPreviousUpEvent != null) {\n                            this.mPreviousUpEvent.recycle();\n                        }\n                        this.mPreviousUpEvent = currentUpEvent;\n                        if (this.mVelocityTracker != null) {\n                            this.mVelocityTracker.recycle();\n                            this.mVelocityTracker = null;\n                        }\n                        this.mIsDoubleTapping = false;\n                        this.mDeferConfirmSingleTap = false;\n                        this.mHandler.removeMessages(GestureDetector.SHOW_PRESS);\n                        this.mHandler.removeMessages(GestureDetector.LONG_PRESS);\n                        break;\n                    case MotionEvent.ACTION_CANCEL:\n                        this.cancel();\n                        break;\n                }\n                return handled;\n            }\n            cancel() {\n                this.mHandler.removeMessages(GestureDetector.SHOW_PRESS);\n                this.mHandler.removeMessages(GestureDetector.LONG_PRESS);\n                this.mHandler.removeMessages(GestureDetector.TAP);\n                this.mVelocityTracker.recycle();\n                this.mVelocityTracker = null;\n                this.mIsDoubleTapping = false;\n                this.mStillDown = false;\n                this.mAlwaysInTapRegion = false;\n                this.mAlwaysInBiggerTapRegion = false;\n                this.mDeferConfirmSingleTap = false;\n                if (this.mInLongPress) {\n                    this.mInLongPress = false;\n                }\n            }\n            cancelTaps() {\n                this.mHandler.removeMessages(GestureDetector.SHOW_PRESS);\n                this.mHandler.removeMessages(GestureDetector.LONG_PRESS);\n                this.mHandler.removeMessages(GestureDetector.TAP);\n                this.mIsDoubleTapping = false;\n                this.mAlwaysInTapRegion = false;\n                this.mAlwaysInBiggerTapRegion = false;\n                this.mDeferConfirmSingleTap = false;\n                if (this.mInLongPress) {\n                    this.mInLongPress = false;\n                }\n            }\n            isConsideredDoubleTap(firstDown, firstUp, secondDown) {\n                if (!this.mAlwaysInBiggerTapRegion) {\n                    return false;\n                }\n                const deltaTime = secondDown.getEventTime() - firstUp.getEventTime();\n                if (deltaTime > GestureDetector.DOUBLE_TAP_TIMEOUT || deltaTime < GestureDetector.DOUBLE_TAP_MIN_TIME) {\n                    return false;\n                }\n                let deltaX = Math.floor(firstDown.getX()) - Math.floor(secondDown.getX());\n                let deltaY = Math.floor(firstDown.getY()) - Math.floor(secondDown.getY());\n                return (deltaX * deltaX + deltaY * deltaY < this.mDoubleTapSlopSquare);\n            }\n            dispatchLongPress() {\n                this.mHandler.removeMessages(GestureDetector.TAP);\n                this.mDeferConfirmSingleTap = false;\n                this.mInLongPress = true;\n                this.mListener.onLongPress(this.mCurrentDownEvent);\n            }\n        }\n        GestureDetector.LONGPRESS_TIMEOUT = ViewConfiguration.getLongPressTimeout();\n        GestureDetector.TAP_TIMEOUT = ViewConfiguration.getTapTimeout();\n        GestureDetector.DOUBLE_TAP_TIMEOUT = ViewConfiguration.getDoubleTapTimeout();\n        GestureDetector.DOUBLE_TAP_MIN_TIME = ViewConfiguration.getDoubleTapMinTime();\n        GestureDetector.SHOW_PRESS = 1;\n        GestureDetector.LONG_PRESS = 2;\n        GestureDetector.TAP = 3;\n        view.GestureDetector = GestureDetector;\n        (function (GestureDetector) {\n            class SimpleOnGestureListener {\n                onSingleTapUp(e) {\n                    return false;\n                }\n                onLongPress(e) {\n                }\n                onScroll(e1, e2, distanceX, distanceY) {\n                    return false;\n                }\n                onFling(e1, e2, velocityX, velocityY) {\n                    return false;\n                }\n                onShowPress(e) {\n                }\n                onDown(e) {\n                    return false;\n                }\n                onDoubleTap(e) {\n                    return false;\n                }\n                onDoubleTapEvent(e) {\n                    return false;\n                }\n                onSingleTapConfirmed(e) {\n                    return false;\n                }\n            }\n            GestureDetector.SimpleOnGestureListener = SimpleOnGestureListener;\n            class GestureHandler extends Handler {\n                constructor(arg) {\n                    super();\n                    this._GestureDetector_this = arg;\n                }\n                handleMessage(msg) {\n                    switch (msg.what) {\n                        case GestureDetector.SHOW_PRESS:\n                            this._GestureDetector_this.mListener.onShowPress(this._GestureDetector_this.mCurrentDownEvent);\n                            break;\n                        case GestureDetector.LONG_PRESS:\n                            this._GestureDetector_this.dispatchLongPress();\n                            break;\n                        case GestureDetector.TAP:\n                            if (this._GestureDetector_this.mDoubleTapListener != null) {\n                                if (!this._GestureDetector_this.mStillDown) {\n                                    this._GestureDetector_this.mDoubleTapListener.onSingleTapConfirmed(this._GestureDetector_this.mCurrentDownEvent);\n                                }\n                                else {\n                                    this._GestureDetector_this.mDeferConfirmSingleTap = true;\n                                }\n                            }\n                            break;\n                        default:\n                            throw Error(`new RuntimeException(\"Unknown message \" + msg)`);\n                    }\n                }\n            }\n            GestureDetector.GestureHandler = GestureHandler;\n        })(GestureDetector = view.GestureDetector || (view.GestureDetector = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var Gravity = android.view.Gravity;\n        var View = android.view.View;\n        var MeasureSpec = View.MeasureSpec;\n        var ViewGroup = android.view.ViewGroup;\n        var Context = android.content.Context;\n        class LinearLayout extends ViewGroup {\n            constructor(context, bindElement, defStyle) {\n                super(context, bindElement, defStyle);\n                this.mBaselineAligned = true;\n                this.mBaselineAlignedChildIndex = -1;\n                this.mBaselineChildTop = 0;\n                this.mOrientation = 0;\n                this.mGravity = Gravity.LEFT | Gravity.TOP;\n                this.mTotalLength = 0;\n                this.mWeightSum = -1;\n                this.mUseLargestChild = false;\n                this.mDividerWidth = 0;\n                this.mDividerHeight = 0;\n                this.mShowDividers = LinearLayout.SHOW_DIVIDER_NONE;\n                this.mDividerPadding = 0;\n                const a = context.obtainStyledAttributes(bindElement, defStyle);\n                const orientationS = a.getAttrValue('orientation');\n                if (orientationS) {\n                    const orientation = LinearLayout[orientationS.toUpperCase()];\n                    if (Number.isInteger(orientation)) {\n                        this.setOrientation(orientation);\n                    }\n                }\n                const gravityS = a.getAttrValue('gravity');\n                if (gravityS) {\n                    this.setGravity(Gravity.parseGravity(gravityS));\n                }\n                let baselineAligned = a.getBoolean('baselineAligned', true);\n                if (!baselineAligned) {\n                    this.setBaselineAligned(baselineAligned);\n                }\n                this.mWeightSum = a.getFloat('weightSum', -1.0);\n                this.mBaselineAlignedChildIndex = a.getInt('baselineAlignedChildIndex', -1);\n                this.mUseLargestChild = a.getBoolean('measureWithLargestChild', false);\n                this.setDividerDrawable(a.getDrawable('divider'));\n                let fieldName = ('SHOW_DIVIDER_' + a.getAttrValue('showDividers')).toUpperCase();\n                if (Number.isInteger(LinearLayout[fieldName])) {\n                    this.mShowDividers = LinearLayout[fieldName];\n                }\n                this.mDividerPadding = a.getDimensionPixelSize('dividerPadding', 0);\n                a.recycle();\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('orientation', {\n                    setter(v, value, attrBinder) {\n                        if ((value + \"\").toUpperCase() === 'VERTICAL' || LinearLayout.VERTICAL == value) {\n                            v.setOrientation(LinearLayout.VERTICAL);\n                        }\n                        else if ((value + \"\").toUpperCase() === 'HORIZONTAL' || LinearLayout.HORIZONTAL == value) {\n                            v.setOrientation(LinearLayout.HORIZONTAL);\n                        }\n                    }, getter(v) {\n                        return v.mOrientation;\n                    }\n                }).set('gravity', {\n                    setter(v, value, attrBinder) {\n                        v.setGravity(attrBinder.parseGravity(value, v.mGravity));\n                    }, getter(v) {\n                        return v.mGravity;\n                    }\n                }).set('baselineAligned', {\n                    setter(v, value, attrBinder) {\n                        if (!attrBinder.parseBoolean(value))\n                            v.setBaselineAligned(false);\n                    }, getter(v) {\n                        return v.mBaselineAligned;\n                    }\n                }).set('weightSum', {\n                    setter(v, value, attrBinder) {\n                        v.setWeightSum(attrBinder.parseFloat(value, v.mWeightSum));\n                    }, getter(v) {\n                        return v.mWeightSum;\n                    }\n                }).set('baselineAlignedChildIndex', {\n                    setter(v, value, attrBinder) {\n                        v.setBaselineAlignedChildIndex(attrBinder.parseInt(value, v.mBaselineAlignedChildIndex));\n                    }, getter(v) {\n                        return v.mBaselineAlignedChildIndex;\n                    }\n                }).set('measureWithLargestChild', {\n                    setter(v, value, attrBinder) {\n                        v.setMeasureWithLargestChildEnabled(attrBinder.parseBoolean(value, v.mUseLargestChild));\n                    }, getter(v) {\n                        return v.mUseLargestChild;\n                    }\n                }).set('divider', {\n                    setter(v, value, attrBinder) {\n                        v.setDividerDrawable(attrBinder.parseDrawable(value));\n                    }, getter(v) {\n                        return v.mDivider;\n                    }\n                }).set('showDividers', {\n                    setter(v, value, attrBinder) {\n                        if (Number.isInteger(parseInt(value))) {\n                            this.setShowDividers(parseInt(value));\n                        }\n                        else {\n                            let fieldName = ('SHOW_DIVIDER_' + value).toUpperCase();\n                            if (Number.isInteger(LinearLayout[fieldName])) {\n                                this.setShowDividers(LinearLayout[fieldName]);\n                            }\n                        }\n                    }, getter(v) {\n                        return v.getShowDividers();\n                    }\n                }).set('dividerPadding', {\n                    setter(v, value, attrBinder) {\n                        v.setDividerPadding(attrBinder.parseInt(value, v.mDividerPadding));\n                    }, getter(v) {\n                        return v.getDividerPadding();\n                    }\n                });\n            }\n            setShowDividers(showDividers) {\n                if (showDividers != this.mShowDividers) {\n                    this.requestLayout();\n                }\n                this.mShowDividers = showDividers;\n            }\n            shouldDelayChildPressedState() {\n                return false;\n            }\n            getShowDividers() {\n                return this.mShowDividers;\n            }\n            getDividerDrawable() {\n                return this.mDivider;\n            }\n            setDividerDrawable(divider) {\n                if (divider == this.mDivider) {\n                    return;\n                }\n                this.mDivider = divider;\n                if (divider != null) {\n                    this.mDividerWidth = divider.getIntrinsicWidth();\n                    this.mDividerHeight = divider.getIntrinsicHeight();\n                }\n                else {\n                    this.mDividerWidth = 0;\n                    this.mDividerHeight = 0;\n                }\n                this.setWillNotDraw(divider == null);\n                this.requestLayout();\n            }\n            setDividerPadding(padding) {\n                this.mDividerPadding = padding;\n            }\n            getDividerPadding() {\n                return this.mDividerPadding;\n            }\n            getDividerWidth() {\n                return this.mDividerWidth;\n            }\n            onDraw(canvas) {\n                if (this.mDivider == null) {\n                    return;\n                }\n                if (this.mOrientation == LinearLayout.VERTICAL) {\n                    this.drawDividersVertical(canvas);\n                }\n                else {\n                    this.drawDividersHorizontal(canvas);\n                }\n            }\n            drawDividersVertical(canvas) {\n                const count = this.getVirtualChildCount();\n                for (let i = 0; i < count; i++) {\n                    const child = this.getVirtualChildAt(i);\n                    if (child != null && child.getVisibility() != View.GONE) {\n                        if (this.hasDividerBeforeChildAt(i)) {\n                            const lp = child.getLayoutParams();\n                            const top = child.getTop() - lp.topMargin - this.mDividerHeight;\n                            this.drawHorizontalDivider(canvas, top);\n                        }\n                    }\n                }\n                if (this.hasDividerBeforeChildAt(count)) {\n                    const child = this.getVirtualChildAt(count - 1);\n                    let bottom = 0;\n                    if (child == null) {\n                        bottom = this.getHeight() - this.getPaddingBottom() - this.mDividerHeight;\n                    }\n                    else {\n                        const lp = child.getLayoutParams();\n                        bottom = child.getBottom() + lp.bottomMargin;\n                    }\n                    this.drawHorizontalDivider(canvas, bottom);\n                }\n            }\n            drawDividersHorizontal(canvas) {\n                const count = this.getVirtualChildCount();\n                const isLayoutRtl = this.isLayoutRtl();\n                for (let i = 0; i < count; i++) {\n                    const child = this.getVirtualChildAt(i);\n                    if (child != null && child.getVisibility() != View.GONE) {\n                        if (this.hasDividerBeforeChildAt(i)) {\n                            const lp = child.getLayoutParams();\n                            let position;\n                            if (isLayoutRtl) {\n                                position = child.getRight() + lp.rightMargin;\n                            }\n                            else {\n                                position = child.getLeft() - lp.leftMargin - this.mDividerWidth;\n                            }\n                            this.drawVerticalDivider(canvas, position);\n                        }\n                    }\n                }\n                if (this.hasDividerBeforeChildAt(count)) {\n                    const child = this.getVirtualChildAt(count - 1);\n                    let position;\n                    if (child == null) {\n                        if (isLayoutRtl) {\n                            position = this.getPaddingLeft();\n                        }\n                        else {\n                            position = this.getWidth() - this.getPaddingRight() - this.mDividerWidth;\n                        }\n                    }\n                    else {\n                        const lp = child.getLayoutParams();\n                        if (isLayoutRtl) {\n                            position = child.getLeft() - lp.leftMargin - this.mDividerWidth;\n                        }\n                        else {\n                            position = child.getRight() + lp.rightMargin;\n                        }\n                    }\n                    this.drawVerticalDivider(canvas, position);\n                }\n            }\n            drawHorizontalDivider(canvas, top) {\n                this.mDivider.setBounds(this.getPaddingLeft() + this.mDividerPadding, top, this.getWidth() - this.getPaddingRight() - this.mDividerPadding, top + this.mDividerHeight);\n                this.mDivider.draw(canvas);\n            }\n            drawVerticalDivider(canvas, left) {\n                this.mDivider.setBounds(left, this.getPaddingTop() + this.mDividerPadding, left + this.mDividerWidth, this.getHeight() - this.getPaddingBottom() - this.mDividerPadding);\n                this.mDivider.draw(canvas);\n            }\n            isBaselineAligned() {\n                return this.mBaselineAligned;\n            }\n            setBaselineAligned(baselineAligned) {\n                this.mBaselineAligned = baselineAligned;\n            }\n            isMeasureWithLargestChildEnabled() {\n                return this.mUseLargestChild;\n            }\n            setMeasureWithLargestChildEnabled(enabled) {\n                this.mUseLargestChild = enabled;\n            }\n            getBaseline() {\n                if (this.mBaselineAlignedChildIndex < 0) {\n                    return super.getBaseline();\n                }\n                if (this.getChildCount() <= this.mBaselineAlignedChildIndex) {\n                    throw new Error(\"mBaselineAlignedChildIndex of LinearLayout \"\n                        + \"set to an index that is out of bounds.\");\n                }\n                const child = this.getChildAt(this.mBaselineAlignedChildIndex);\n                const childBaseline = child.getBaseline();\n                if (childBaseline == -1) {\n                    if (this.mBaselineAlignedChildIndex == 0) {\n                        return -1;\n                    }\n                    throw new Error(\"mBaselineAlignedChildIndex of LinearLayout \"\n                        + \"points to a View that doesn't know how to get its baseline.\");\n                }\n                let childTop = this.mBaselineChildTop;\n                if (this.mOrientation == LinearLayout.VERTICAL) {\n                    const majorGravity = this.mGravity & Gravity.VERTICAL_GRAVITY_MASK;\n                    if (majorGravity != Gravity.TOP) {\n                        switch (majorGravity) {\n                            case Gravity.BOTTOM:\n                                childTop = this.mBottom - this.mTop - this.mPaddingBottom - this.mTotalLength;\n                                break;\n                            case Gravity.CENTER_VERTICAL:\n                                childTop += ((this.mBottom - this.mTop - this.mPaddingTop - this.mPaddingBottom) -\n                                    this.mTotalLength) / 2;\n                                break;\n                        }\n                    }\n                }\n                let lp = child.getLayoutParams();\n                return childTop + lp.topMargin + childBaseline;\n            }\n            getBaselineAlignedChildIndex() {\n                return this.mBaselineAlignedChildIndex;\n            }\n            setBaselineAlignedChildIndex(i) {\n                if ((i < 0) || (i >= this.getChildCount())) {\n                    throw new Error(\"base aligned child index out \"\n                        + \"of range (0, \" + this.getChildCount() + \")\");\n                }\n                this.mBaselineAlignedChildIndex = i;\n            }\n            getVirtualChildAt(index) {\n                return this.getChildAt(index);\n            }\n            getVirtualChildCount() {\n                return this.getChildCount();\n            }\n            getWeightSum() {\n                return this.mWeightSum;\n            }\n            setWeightSum(weightSum) {\n                this.mWeightSum = Math.max(0, weightSum);\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                if (this.mOrientation == LinearLayout.VERTICAL) {\n                    this.measureVertical(widthMeasureSpec, heightMeasureSpec);\n                }\n                else {\n                    this.measureHorizontal(widthMeasureSpec, heightMeasureSpec);\n                }\n            }\n            hasDividerBeforeChildAt(childIndex) {\n                if (childIndex == 0) {\n                    return (this.mShowDividers & LinearLayout.SHOW_DIVIDER_BEGINNING) != 0;\n                }\n                else if (childIndex == this.getChildCount()) {\n                    return (this.mShowDividers & LinearLayout.SHOW_DIVIDER_END) != 0;\n                }\n                else if ((this.mShowDividers & LinearLayout.SHOW_DIVIDER_MIDDLE) != 0) {\n                    let hasVisibleViewBefore = false;\n                    for (let i = childIndex - 1; i >= 0; i--) {\n                        if (this.getChildAt(i).getVisibility() != LinearLayout.GONE) {\n                            hasVisibleViewBefore = true;\n                            break;\n                        }\n                    }\n                    return hasVisibleViewBefore;\n                }\n                return false;\n            }\n            measureVertical(widthMeasureSpec, heightMeasureSpec) {\n                this.mTotalLength = 0;\n                let maxWidth = 0;\n                let childState = 0;\n                let alternativeMaxWidth = 0;\n                let weightedMaxWidth = 0;\n                let allFillParent = true;\n                let totalWeight = 0;\n                const count = this.getVirtualChildCount();\n                const widthMode = MeasureSpec.getMode(widthMeasureSpec);\n                const heightMode = MeasureSpec.getMode(heightMeasureSpec);\n                let matchWidth = false;\n                const baselineChildIndex = this.mBaselineAlignedChildIndex;\n                const useLargestChild = this.mUseLargestChild;\n                let largestChildHeight = Number.MIN_SAFE_INTEGER;\n                for (let i = 0; i < count; ++i) {\n                    const child = this.getVirtualChildAt(i);\n                    if (child == null) {\n                        this.mTotalLength += this.measureNullChild(i);\n                        continue;\n                    }\n                    if (child.getVisibility() == View.GONE) {\n                        i += this.getChildrenSkipCount(child, i);\n                        continue;\n                    }\n                    if (this.hasDividerBeforeChildAt(i)) {\n                        this.mTotalLength += this.mDividerHeight;\n                    }\n                    let lp = child.getLayoutParams();\n                    totalWeight += lp.weight;\n                    if (heightMode == MeasureSpec.EXACTLY && lp.height == 0 && lp.weight > 0) {\n                        const totalLength = this.mTotalLength;\n                        this.mTotalLength = Math.max(totalLength, totalLength + lp.topMargin + lp.bottomMargin);\n                    }\n                    else {\n                        let oldHeight = Number.MIN_SAFE_INTEGER;\n                        if (lp.height == 0 && lp.weight > 0) {\n                            oldHeight = 0;\n                            lp.height = LinearLayout.LayoutParams.WRAP_CONTENT;\n                        }\n                        this.measureChildBeforeLayout(child, i, widthMeasureSpec, 0, heightMeasureSpec, totalWeight == 0 ? this.mTotalLength : 0);\n                        if (oldHeight != Number.MIN_SAFE_INTEGER) {\n                            lp.height = oldHeight;\n                        }\n                        const childHeight = child.getMeasuredHeight();\n                        const totalLength = this.mTotalLength;\n                        this.mTotalLength = Math.max(totalLength, totalLength + childHeight + lp.topMargin +\n                            lp.bottomMargin + this.getNextLocationOffset(child));\n                        if (useLargestChild) {\n                            largestChildHeight = Math.max(childHeight, largestChildHeight);\n                        }\n                    }\n                    if ((baselineChildIndex >= 0) && (baselineChildIndex == i + 1)) {\n                        this.mBaselineChildTop = this.mTotalLength;\n                    }\n                    if (i < baselineChildIndex && lp.weight > 0) {\n                        throw new Error(\"A child of LinearLayout with index \"\n                            + \"less than mBaselineAlignedChildIndex has weight > 0, which \"\n                            + \"won't work.  Either remove the weight, or don't set \"\n                            + \"mBaselineAlignedChildIndex.\");\n                    }\n                    let matchWidthLocally = false;\n                    if (widthMode != MeasureSpec.EXACTLY && lp.width == LinearLayout.LayoutParams.MATCH_PARENT) {\n                        matchWidth = true;\n                        matchWidthLocally = true;\n                    }\n                    const margin = lp.leftMargin + lp.rightMargin;\n                    const measuredWidth = child.getMeasuredWidth() + margin;\n                    maxWidth = Math.max(maxWidth, measuredWidth);\n                    childState = LinearLayout.combineMeasuredStates(childState, child.getMeasuredState());\n                    allFillParent = allFillParent && lp.width == LinearLayout.LayoutParams.MATCH_PARENT;\n                    if (lp.weight > 0) {\n                        weightedMaxWidth = Math.max(weightedMaxWidth, matchWidthLocally ? margin : measuredWidth);\n                    }\n                    else {\n                        alternativeMaxWidth = Math.max(alternativeMaxWidth, matchWidthLocally ? margin : measuredWidth);\n                    }\n                    i += this.getChildrenSkipCount(child, i);\n                }\n                if (this.mTotalLength > 0 && this.hasDividerBeforeChildAt(count)) {\n                    this.mTotalLength += this.mDividerHeight;\n                }\n                if (useLargestChild &&\n                    (heightMode == MeasureSpec.AT_MOST || heightMode == MeasureSpec.UNSPECIFIED)) {\n                    this.mTotalLength = 0;\n                    for (let i = 0; i < count; ++i) {\n                        const child = this.getVirtualChildAt(i);\n                        if (child == null) {\n                            this.mTotalLength += this.measureNullChild(i);\n                            continue;\n                        }\n                        if (child.getVisibility() == View.GONE) {\n                            i += this.getChildrenSkipCount(child, i);\n                            continue;\n                        }\n                        const lp = child.getLayoutParams();\n                        const totalLength = this.mTotalLength;\n                        this.mTotalLength = Math.max(totalLength, totalLength + largestChildHeight +\n                            lp.topMargin + lp.bottomMargin + this.getNextLocationOffset(child));\n                    }\n                }\n                this.mTotalLength += this.mPaddingTop + this.mPaddingBottom;\n                let heightSize = this.mTotalLength;\n                heightSize = Math.max(heightSize, this.getSuggestedMinimumHeight());\n                let heightSizeAndState = LinearLayout.resolveSizeAndState(heightSize, heightMeasureSpec, 0);\n                heightSize = heightSizeAndState & View.MEASURED_SIZE_MASK;\n                let delta = heightSize - this.mTotalLength;\n                if (delta != 0 && totalWeight > 0) {\n                    let weightSum = this.mWeightSum > 0 ? this.mWeightSum : totalWeight;\n                    this.mTotalLength = 0;\n                    for (let i = 0; i < count; ++i) {\n                        const child = this.getVirtualChildAt(i);\n                        if (child.getVisibility() == View.GONE) {\n                            continue;\n                        }\n                        let lp = child.getLayoutParams();\n                        let childExtra = lp.weight;\n                        if (childExtra > 0) {\n                            let share = (childExtra * delta / weightSum);\n                            weightSum -= childExtra;\n                            delta -= share;\n                            const childWidthMeasureSpec = LinearLayout.getChildMeasureSpec(widthMeasureSpec, this.mPaddingLeft + this.mPaddingRight +\n                                lp.leftMargin + lp.rightMargin, lp.width);\n                            if ((lp.height != 0) || (heightMode != MeasureSpec.EXACTLY)) {\n                                let childHeight = child.getMeasuredHeight() + share;\n                                if (childHeight < 0) {\n                                    childHeight = 0;\n                                }\n                                child.measure(childWidthMeasureSpec, MeasureSpec.makeMeasureSpec(childHeight, MeasureSpec.EXACTLY));\n                            }\n                            else {\n                                child.measure(childWidthMeasureSpec, MeasureSpec.makeMeasureSpec(share > 0 ? share : 0, MeasureSpec.EXACTLY));\n                            }\n                            childState = LinearLayout.combineMeasuredStates(childState, child.getMeasuredState()\n                                & (View.MEASURED_STATE_MASK >> View.MEASURED_HEIGHT_STATE_SHIFT));\n                        }\n                        const margin = lp.leftMargin + lp.rightMargin;\n                        const measuredWidth = child.getMeasuredWidth() + margin;\n                        maxWidth = Math.max(maxWidth, measuredWidth);\n                        let matchWidthLocally = widthMode != MeasureSpec.EXACTLY &&\n                            lp.width == LinearLayout.LayoutParams.MATCH_PARENT;\n                        alternativeMaxWidth = Math.max(alternativeMaxWidth, matchWidthLocally ? margin : measuredWidth);\n                        allFillParent = allFillParent && lp.width == LinearLayout.LayoutParams.MATCH_PARENT;\n                        const totalLength = this.mTotalLength;\n                        this.mTotalLength = Math.max(totalLength, totalLength + child.getMeasuredHeight() +\n                            lp.topMargin + lp.bottomMargin + this.getNextLocationOffset(child));\n                    }\n                    this.mTotalLength += this.mPaddingTop + this.mPaddingBottom;\n                }\n                else {\n                    alternativeMaxWidth = Math.max(alternativeMaxWidth, weightedMaxWidth);\n                    if (useLargestChild && heightMode != MeasureSpec.EXACTLY) {\n                        for (let i = 0; i < count; i++) {\n                            const child = this.getVirtualChildAt(i);\n                            if (child == null || child.getVisibility() == View.GONE) {\n                                continue;\n                            }\n                            const lp = child.getLayoutParams();\n                            let childExtra = lp.weight;\n                            if (childExtra > 0) {\n                                child.measure(MeasureSpec.makeMeasureSpec(child.getMeasuredWidth(), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(largestChildHeight, MeasureSpec.EXACTLY));\n                            }\n                        }\n                    }\n                }\n                if (!allFillParent && widthMode != MeasureSpec.EXACTLY) {\n                    maxWidth = alternativeMaxWidth;\n                }\n                maxWidth += this.mPaddingLeft + this.mPaddingRight;\n                maxWidth = Math.max(maxWidth, this.getSuggestedMinimumWidth());\n                this.setMeasuredDimension(LinearLayout.resolveSizeAndState(maxWidth, widthMeasureSpec, childState), heightSizeAndState);\n                if (matchWidth) {\n                    this.forceUniformWidth(count, heightMeasureSpec);\n                }\n            }\n            forceUniformWidth(count, heightMeasureSpec) {\n                let uniformMeasureSpec = MeasureSpec.makeMeasureSpec(this.getMeasuredWidth(), MeasureSpec.EXACTLY);\n                for (let i = 0; i < count; ++i) {\n                    const child = this.getVirtualChildAt(i);\n                    if (child.getVisibility() != View.GONE) {\n                        let lp = child.getLayoutParams();\n                        if (lp.width == LinearLayout.LayoutParams.MATCH_PARENT) {\n                            let oldHeight = lp.height;\n                            lp.height = child.getMeasuredHeight();\n                            this.measureChildWithMargins(child, uniformMeasureSpec, 0, heightMeasureSpec, 0);\n                            lp.height = oldHeight;\n                        }\n                    }\n                }\n            }\n            measureHorizontal(widthMeasureSpec, heightMeasureSpec) {\n                this.mTotalLength = 0;\n                let maxHeight = 0;\n                let childState = 0;\n                let alternativeMaxHeight = 0;\n                let weightedMaxHeight = 0;\n                let allFillParent = true;\n                let totalWeight = 0;\n                const count = this.getVirtualChildCount();\n                const widthMode = MeasureSpec.getMode(widthMeasureSpec);\n                const heightMode = MeasureSpec.getMode(heightMeasureSpec);\n                let matchHeight = false;\n                if (this.mMaxAscent == null || this.mMaxDescent == null) {\n                    this.mMaxAscent = androidui.util.ArrayCreator.newNumberArray(LinearLayout.VERTICAL_GRAVITY_COUNT);\n                    this.mMaxDescent = androidui.util.ArrayCreator.newNumberArray(LinearLayout.VERTICAL_GRAVITY_COUNT);\n                }\n                let maxAscent = this.mMaxAscent;\n                let maxDescent = this.mMaxDescent;\n                maxAscent[0] = maxAscent[1] = maxAscent[2] = maxAscent[3] = -1;\n                maxDescent[0] = maxDescent[1] = maxDescent[2] = maxDescent[3] = -1;\n                const baselineAligned = this.mBaselineAligned;\n                const useLargestChild = this.mUseLargestChild;\n                const isExactly = widthMode == MeasureSpec.EXACTLY;\n                let largestChildWidth = Number.MAX_SAFE_INTEGER;\n                for (let i = 0; i < count; ++i) {\n                    const child = this.getVirtualChildAt(i);\n                    if (child == null) {\n                        this.mTotalLength += this.measureNullChild(i);\n                        continue;\n                    }\n                    if (child.getVisibility() == View.GONE) {\n                        i += this.getChildrenSkipCount(child, i);\n                        continue;\n                    }\n                    if (this.hasDividerBeforeChildAt(i)) {\n                        this.mTotalLength += this.mDividerWidth;\n                    }\n                    const lp = child.getLayoutParams();\n                    totalWeight += lp.weight;\n                    if (widthMode == MeasureSpec.EXACTLY && lp.width == 0 && lp.weight > 0) {\n                        if (isExactly) {\n                            this.mTotalLength += lp.leftMargin + lp.rightMargin;\n                        }\n                        else {\n                            const totalLength = this.mTotalLength;\n                            this.mTotalLength = Math.max(totalLength, totalLength +\n                                lp.leftMargin + lp.rightMargin);\n                        }\n                        if (baselineAligned) {\n                            const freeSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);\n                            child.measure(freeSpec, freeSpec);\n                        }\n                    }\n                    else {\n                        let oldWidth = Number.MIN_SAFE_INTEGER;\n                        if (lp.width == 0 && lp.weight > 0) {\n                            oldWidth = 0;\n                            lp.width = LinearLayout.LayoutParams.WRAP_CONTENT;\n                        }\n                        this.measureChildBeforeLayout(child, i, widthMeasureSpec, totalWeight == 0 ? this.mTotalLength : 0, heightMeasureSpec, 0);\n                        if (oldWidth != Number.MIN_SAFE_INTEGER) {\n                            lp.width = oldWidth;\n                        }\n                        const childWidth = child.getMeasuredWidth();\n                        if (isExactly) {\n                            this.mTotalLength += childWidth + lp.leftMargin + lp.rightMargin +\n                                this.getNextLocationOffset(child);\n                        }\n                        else {\n                            const totalLength = this.mTotalLength;\n                            this.mTotalLength = Math.max(totalLength, totalLength + childWidth + lp.leftMargin +\n                                lp.rightMargin + this.getNextLocationOffset(child));\n                        }\n                        if (useLargestChild) {\n                            largestChildWidth = Math.max(childWidth, largestChildWidth);\n                        }\n                    }\n                    let matchHeightLocally = false;\n                    if (heightMode != MeasureSpec.EXACTLY && lp.height == LinearLayout.LayoutParams.MATCH_PARENT) {\n                        matchHeight = true;\n                        matchHeightLocally = true;\n                    }\n                    const margin = lp.topMargin + lp.bottomMargin;\n                    const childHeight = child.getMeasuredHeight() + margin;\n                    childState = LinearLayout.combineMeasuredStates(childState, child.getMeasuredState());\n                    if (baselineAligned) {\n                        const childBaseline = child.getBaseline();\n                        if (childBaseline != -1) {\n                            const gravity = (lp.gravity < 0 ? this.mGravity : lp.gravity)\n                                & Gravity.VERTICAL_GRAVITY_MASK;\n                            const index = ((gravity >> Gravity.AXIS_Y_SHIFT)\n                                & ~Gravity.AXIS_SPECIFIED) >> 1;\n                            maxAscent[index] = Math.max(maxAscent[index], childBaseline);\n                            maxDescent[index] = Math.max(maxDescent[index], childHeight - childBaseline);\n                        }\n                    }\n                    maxHeight = Math.max(maxHeight, childHeight);\n                    allFillParent = allFillParent && lp.height == LinearLayout.LayoutParams.MATCH_PARENT;\n                    if (lp.weight > 0) {\n                        weightedMaxHeight = Math.max(weightedMaxHeight, matchHeightLocally ? margin : childHeight);\n                    }\n                    else {\n                        alternativeMaxHeight = Math.max(alternativeMaxHeight, matchHeightLocally ? margin : childHeight);\n                    }\n                    i += this.getChildrenSkipCount(child, i);\n                }\n                if (this.mTotalLength > 0 && this.hasDividerBeforeChildAt(count)) {\n                    this.mTotalLength += this.mDividerWidth;\n                }\n                if (maxAscent[LinearLayout.INDEX_TOP] != -1 ||\n                    maxAscent[LinearLayout.INDEX_CENTER_VERTICAL] != -1 ||\n                    maxAscent[LinearLayout.INDEX_BOTTOM] != -1 ||\n                    maxAscent[LinearLayout.INDEX_FILL] != -1) {\n                    const ascent = Math.max(maxAscent[LinearLayout.INDEX_FILL], Math.max(maxAscent[LinearLayout.INDEX_CENTER_VERTICAL], Math.max(maxAscent[LinearLayout.INDEX_TOP], maxAscent[LinearLayout.INDEX_BOTTOM])));\n                    const descent = Math.max(maxDescent[LinearLayout.INDEX_FILL], Math.max(maxDescent[LinearLayout.INDEX_CENTER_VERTICAL], Math.max(maxDescent[LinearLayout.INDEX_TOP], maxDescent[LinearLayout.INDEX_BOTTOM])));\n                    maxHeight = Math.max(maxHeight, ascent + descent);\n                }\n                if (useLargestChild &&\n                    (widthMode == MeasureSpec.AT_MOST || widthMode == MeasureSpec.UNSPECIFIED)) {\n                    this.mTotalLength = 0;\n                    for (let i = 0; i < count; ++i) {\n                        const child = this.getVirtualChildAt(i);\n                        if (child == null) {\n                            this.mTotalLength += this.measureNullChild(i);\n                            continue;\n                        }\n                        if (child.getVisibility() == View.GONE) {\n                            i += this.getChildrenSkipCount(child, i);\n                            continue;\n                        }\n                        const lp = child.getLayoutParams();\n                        if (isExactly) {\n                            this.mTotalLength += largestChildWidth + lp.leftMargin + lp.rightMargin +\n                                this.getNextLocationOffset(child);\n                        }\n                        else {\n                            const totalLength = this.mTotalLength;\n                            this.mTotalLength = Math.max(totalLength, totalLength + largestChildWidth +\n                                lp.leftMargin + lp.rightMargin + this.getNextLocationOffset(child));\n                        }\n                    }\n                }\n                this.mTotalLength += this.mPaddingLeft + this.mPaddingRight;\n                let widthSize = this.mTotalLength;\n                widthSize = Math.max(widthSize, this.getSuggestedMinimumWidth());\n                let widthSizeAndState = LinearLayout.resolveSizeAndState(widthSize, widthMeasureSpec, 0);\n                widthSize = widthSizeAndState & View.MEASURED_SIZE_MASK;\n                let delta = widthSize - this.mTotalLength;\n                if (delta != 0 && totalWeight > 0) {\n                    let weightSum = this.mWeightSum > 0 ? this.mWeightSum : totalWeight;\n                    maxAscent[0] = maxAscent[1] = maxAscent[2] = maxAscent[3] = -1;\n                    maxDescent[0] = maxDescent[1] = maxDescent[2] = maxDescent[3] = -1;\n                    maxHeight = -1;\n                    this.mTotalLength = 0;\n                    for (let i = 0; i < count; ++i) {\n                        const child = this.getVirtualChildAt(i);\n                        if (child == null || child.getVisibility() == View.GONE) {\n                            continue;\n                        }\n                        const lp = child.getLayoutParams();\n                        let childExtra = lp.weight;\n                        if (childExtra > 0) {\n                            let share = (childExtra * delta / weightSum);\n                            weightSum -= childExtra;\n                            delta -= share;\n                            const childHeightMeasureSpec = LinearLayout.getChildMeasureSpec(heightMeasureSpec, this.mPaddingTop + this.mPaddingBottom + lp.topMargin + lp.bottomMargin, lp.height);\n                            if ((lp.width != 0) || (widthMode != MeasureSpec.EXACTLY)) {\n                                let childWidth = child.getMeasuredWidth() + share;\n                                if (childWidth < 0) {\n                                    childWidth = 0;\n                                }\n                                child.measure(MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY), childHeightMeasureSpec);\n                            }\n                            else {\n                                child.measure(MeasureSpec.makeMeasureSpec(share > 0 ? share : 0, MeasureSpec.EXACTLY), childHeightMeasureSpec);\n                            }\n                            childState = LinearLayout.combineMeasuredStates(childState, child.getMeasuredState() & View.MEASURED_STATE_MASK);\n                        }\n                        if (isExactly) {\n                            this.mTotalLength += child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin +\n                                this.getNextLocationOffset(child);\n                        }\n                        else {\n                            const totalLength = this.mTotalLength;\n                            this.mTotalLength = Math.max(totalLength, totalLength + child.getMeasuredWidth() +\n                                lp.leftMargin + lp.rightMargin + this.getNextLocationOffset(child));\n                        }\n                        let matchHeightLocally = heightMode != MeasureSpec.EXACTLY &&\n                            lp.height == LinearLayout.LayoutParams.MATCH_PARENT;\n                        const margin = lp.topMargin + lp.bottomMargin;\n                        let childHeight = child.getMeasuredHeight() + margin;\n                        maxHeight = Math.max(maxHeight, childHeight);\n                        alternativeMaxHeight = Math.max(alternativeMaxHeight, matchHeightLocally ? margin : childHeight);\n                        allFillParent = allFillParent && lp.height == LinearLayout.LayoutParams.MATCH_PARENT;\n                        if (baselineAligned) {\n                            const childBaseline = child.getBaseline();\n                            if (childBaseline != -1) {\n                                const gravity = (lp.gravity < 0 ? this.mGravity : lp.gravity)\n                                    & Gravity.VERTICAL_GRAVITY_MASK;\n                                const index = ((gravity >> Gravity.AXIS_Y_SHIFT)\n                                    & ~Gravity.AXIS_SPECIFIED) >> 1;\n                                maxAscent[index] = Math.max(maxAscent[index], childBaseline);\n                                maxDescent[index] = Math.max(maxDescent[index], childHeight - childBaseline);\n                            }\n                        }\n                    }\n                    this.mTotalLength += this.mPaddingLeft + this.mPaddingRight;\n                    if (maxAscent[LinearLayout.INDEX_TOP] != -1 ||\n                        maxAscent[LinearLayout.INDEX_CENTER_VERTICAL] != -1 ||\n                        maxAscent[LinearLayout.INDEX_BOTTOM] != -1 ||\n                        maxAscent[LinearLayout.INDEX_FILL] != -1) {\n                        const ascent = Math.max(maxAscent[LinearLayout.INDEX_FILL], Math.max(maxAscent[LinearLayout.INDEX_CENTER_VERTICAL], Math.max(maxAscent[LinearLayout.INDEX_TOP], maxAscent[LinearLayout.INDEX_BOTTOM])));\n                        const descent = Math.max(maxDescent[LinearLayout.INDEX_FILL], Math.max(maxDescent[LinearLayout.INDEX_CENTER_VERTICAL], Math.max(maxDescent[LinearLayout.INDEX_TOP], maxDescent[LinearLayout.INDEX_BOTTOM])));\n                        maxHeight = Math.max(maxHeight, ascent + descent);\n                    }\n                }\n                else {\n                    alternativeMaxHeight = Math.max(alternativeMaxHeight, weightedMaxHeight);\n                    if (useLargestChild && widthMode != MeasureSpec.EXACTLY) {\n                        for (let i = 0; i < count; i++) {\n                            const child = this.getVirtualChildAt(i);\n                            if (child == null || child.getVisibility() == View.GONE) {\n                                continue;\n                            }\n                            const lp = child.getLayoutParams();\n                            let childExtra = lp.weight;\n                            if (childExtra > 0) {\n                                child.measure(MeasureSpec.makeMeasureSpec(largestChildWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(child.getMeasuredHeight(), MeasureSpec.EXACTLY));\n                            }\n                        }\n                    }\n                }\n                if (!allFillParent && heightMode != MeasureSpec.EXACTLY) {\n                    maxHeight = alternativeMaxHeight;\n                }\n                maxHeight += this.mPaddingTop + this.mPaddingBottom;\n                maxHeight = Math.max(maxHeight, this.getSuggestedMinimumHeight());\n                this.setMeasuredDimension(widthSizeAndState | (childState & View.MEASURED_STATE_MASK), LinearLayout.resolveSizeAndState(maxHeight, heightMeasureSpec, (childState << View.MEASURED_HEIGHT_STATE_SHIFT)));\n                if (matchHeight) {\n                    this.forceUniformHeight(count, widthMeasureSpec);\n                }\n            }\n            forceUniformHeight(count, widthMeasureSpec) {\n                let uniformMeasureSpec = MeasureSpec.makeMeasureSpec(this.getMeasuredHeight(), MeasureSpec.EXACTLY);\n                for (let i = 0; i < count; ++i) {\n                    const child = this.getVirtualChildAt(i);\n                    if (child.getVisibility() != View.GONE) {\n                        let lp = child.getLayoutParams();\n                        if (lp.height == LinearLayout.LayoutParams.MATCH_PARENT) {\n                            let oldWidth = lp.width;\n                            lp.width = child.getMeasuredWidth();\n                            this.measureChildWithMargins(child, widthMeasureSpec, 0, uniformMeasureSpec, 0);\n                            lp.width = oldWidth;\n                        }\n                    }\n                }\n            }\n            getChildrenSkipCount(child, index) {\n                return 0;\n            }\n            measureNullChild(childIndex) {\n                return 0;\n            }\n            measureChildBeforeLayout(child, childIndex, widthMeasureSpec, totalWidth, heightMeasureSpec, totalHeight) {\n                this.measureChildWithMargins(child, widthMeasureSpec, totalWidth, heightMeasureSpec, totalHeight);\n            }\n            getLocationOffset(child) {\n                return 0;\n            }\n            getNextLocationOffset(child) {\n                return 0;\n            }\n            onLayout(changed, l, t, r, b) {\n                if (this.mOrientation == LinearLayout.VERTICAL) {\n                    this.layoutVertical(l, t, r, b);\n                }\n                else {\n                    this.layoutHorizontal(l, t, r, b);\n                }\n            }\n            layoutVertical(left, top, right, bottom) {\n                const paddingLeft = this.mPaddingLeft;\n                let childTop;\n                let childLeft;\n                const width = right - left;\n                let childRight = width - this.mPaddingRight;\n                let childSpace = width - paddingLeft - this.mPaddingRight;\n                const count = this.getVirtualChildCount();\n                const majorGravity = this.mGravity & Gravity.VERTICAL_GRAVITY_MASK;\n                const minorGravity = this.mGravity & Gravity.HORIZONTAL_GRAVITY_MASK;\n                switch (majorGravity) {\n                    case Gravity.BOTTOM:\n                        childTop = this.mPaddingTop + bottom - top - this.mTotalLength;\n                        break;\n                    case Gravity.CENTER_VERTICAL:\n                        childTop = this.mPaddingTop + (bottom - top - this.mTotalLength) / 2;\n                        break;\n                    case Gravity.TOP:\n                    default:\n                        childTop = this.mPaddingTop;\n                        break;\n                }\n                for (let i = 0; i < count; i++) {\n                    const child = this.getVirtualChildAt(i);\n                    if (child == null) {\n                        childTop += this.measureNullChild(i);\n                    }\n                    else if (child.getVisibility() != View.GONE) {\n                        const childWidth = child.getMeasuredWidth();\n                        const childHeight = child.getMeasuredHeight();\n                        const lp = child.getLayoutParams();\n                        let gravity = lp.gravity;\n                        if (gravity < 0) {\n                            gravity = minorGravity;\n                        }\n                        const absoluteGravity = gravity;\n                        switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n                            case Gravity.CENTER_HORIZONTAL:\n                                childLeft = paddingLeft + ((childSpace - childWidth) / 2)\n                                    + lp.leftMargin - lp.rightMargin;\n                                break;\n                            case Gravity.RIGHT:\n                                childLeft = childRight - childWidth - lp.rightMargin;\n                                break;\n                            case Gravity.LEFT:\n                            default:\n                                childLeft = paddingLeft + lp.leftMargin;\n                                break;\n                        }\n                        if (this.hasDividerBeforeChildAt(i)) {\n                            childTop += this.mDividerHeight;\n                        }\n                        childTop += lp.topMargin;\n                        this.setChildFrame(child, childLeft, childTop + this.getLocationOffset(child), childWidth, childHeight);\n                        childTop += childHeight + lp.bottomMargin + this.getNextLocationOffset(child);\n                        i += this.getChildrenSkipCount(child, i);\n                    }\n                }\n            }\n            layoutHorizontal(left, top, right, bottom) {\n                const isLayoutRtl = this.isLayoutRtl();\n                const paddingTop = this.mPaddingTop;\n                let childTop;\n                let childLeft;\n                const height = bottom - top;\n                let childBottom = height - this.mPaddingBottom;\n                let childSpace = height - paddingTop - this.mPaddingBottom;\n                const count = this.getVirtualChildCount();\n                const majorGravity = this.mGravity & Gravity.HORIZONTAL_GRAVITY_MASK;\n                const minorGravity = this.mGravity & Gravity.VERTICAL_GRAVITY_MASK;\n                const baselineAligned = this.mBaselineAligned;\n                const maxAscent = this.mMaxAscent;\n                const maxDescent = this.mMaxDescent;\n                let absoluteGravity = majorGravity;\n                switch (absoluteGravity) {\n                    case Gravity.RIGHT:\n                        childLeft = this.mPaddingLeft + right - left - this.mTotalLength;\n                        break;\n                    case Gravity.CENTER_HORIZONTAL:\n                        childLeft = this.mPaddingLeft + (right - left - this.mTotalLength) / 2;\n                        break;\n                    case Gravity.LEFT:\n                    default:\n                        childLeft = this.mPaddingLeft;\n                        break;\n                }\n                let start = 0;\n                let dir = 1;\n                if (isLayoutRtl) {\n                    start = count - 1;\n                    dir = -1;\n                }\n                for (let i = 0; i < count; i++) {\n                    let childIndex = start + dir * i;\n                    const child = this.getVirtualChildAt(childIndex);\n                    if (child == null) {\n                        childLeft += this.measureNullChild(childIndex);\n                    }\n                    else if (child.getVisibility() != View.GONE) {\n                        const childWidth = child.getMeasuredWidth();\n                        const childHeight = child.getMeasuredHeight();\n                        let childBaseline = -1;\n                        const lp = child.getLayoutParams();\n                        if (baselineAligned && lp.height != LinearLayout.LayoutParams.MATCH_PARENT) {\n                            childBaseline = child.getBaseline();\n                        }\n                        let gravity = lp.gravity;\n                        if (gravity < 0) {\n                            gravity = minorGravity;\n                        }\n                        switch (gravity & Gravity.VERTICAL_GRAVITY_MASK) {\n                            case Gravity.TOP:\n                                childTop = paddingTop + lp.topMargin;\n                                if (childBaseline != -1) {\n                                    childTop += maxAscent[LinearLayout.INDEX_TOP] - childBaseline;\n                                }\n                                break;\n                            case Gravity.CENTER_VERTICAL:\n                                childTop = paddingTop + ((childSpace - childHeight) / 2)\n                                    + lp.topMargin - lp.bottomMargin;\n                                break;\n                            case Gravity.BOTTOM:\n                                childTop = childBottom - childHeight - lp.bottomMargin;\n                                if (childBaseline != -1) {\n                                    let descent = child.getMeasuredHeight() - childBaseline;\n                                    childTop -= (maxDescent[LinearLayout.INDEX_BOTTOM] - descent);\n                                }\n                                break;\n                            default:\n                                childTop = paddingTop;\n                                break;\n                        }\n                        if (this.hasDividerBeforeChildAt(childIndex)) {\n                            childLeft += this.mDividerWidth;\n                        }\n                        childLeft += lp.leftMargin;\n                        this.setChildFrame(child, childLeft + this.getLocationOffset(child), childTop, childWidth, childHeight);\n                        childLeft += childWidth + lp.rightMargin +\n                            this.getNextLocationOffset(child);\n                        i += this.getChildrenSkipCount(child, childIndex);\n                    }\n                }\n            }\n            setChildFrame(child, left, top, width, height) {\n                child.layout(left, top, left + width, top + height);\n            }\n            setOrientation(orientation) {\n                if (typeof orientation === 'string') {\n                    if ('VERTICAL' === (orientation + '').toUpperCase())\n                        orientation = LinearLayout.VERTICAL;\n                    else if ('HORIZONTAL' === (orientation + '').toUpperCase())\n                        orientation = LinearLayout.HORIZONTAL;\n                }\n                if (this.mOrientation != orientation) {\n                    this.mOrientation = orientation;\n                    this.requestLayout();\n                }\n            }\n            getOrientation() {\n                return this.mOrientation;\n            }\n            setGravity(gravity) {\n                if (this.mGravity != gravity) {\n                    if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == 0) {\n                        gravity |= Gravity.LEFT;\n                    }\n                    if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) {\n                        gravity |= Gravity.TOP;\n                    }\n                    this.mGravity = gravity;\n                    this.requestLayout();\n                }\n            }\n            setHorizontalGravity(horizontalGravity) {\n                const gravity = horizontalGravity & Gravity.HORIZONTAL_GRAVITY_MASK;\n                if ((this.mGravity & Gravity.HORIZONTAL_GRAVITY_MASK) != gravity) {\n                    this.mGravity = (this.mGravity & ~Gravity.HORIZONTAL_GRAVITY_MASK) | gravity;\n                    this.requestLayout();\n                }\n            }\n            setVerticalGravity(verticalGravity) {\n                const gravity = verticalGravity & Gravity.VERTICAL_GRAVITY_MASK;\n                if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) != gravity) {\n                    this.mGravity = (this.mGravity & ~Gravity.VERTICAL_GRAVITY_MASK) | gravity;\n                    this.requestLayout();\n                }\n            }\n            generateLayoutParamsFromAttr(attrs) {\n                return new LinearLayout.LayoutParams(this.getContext(), attrs);\n            }\n            generateDefaultLayoutParams() {\n                let LayoutParams = LinearLayout.LayoutParams;\n                if (this.mOrientation == LinearLayout.HORIZONTAL) {\n                    return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);\n                }\n                else if (this.mOrientation == LinearLayout.VERTICAL) {\n                    return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);\n                }\n                return super.generateDefaultLayoutParams();\n            }\n            generateLayoutParams(p) {\n                return new LinearLayout.LayoutParams(p);\n            }\n            checkLayoutParams(p) {\n                return p instanceof LinearLayout.LayoutParams;\n            }\n        }\n        LinearLayout.HORIZONTAL = 0;\n        LinearLayout.VERTICAL = 1;\n        LinearLayout.SHOW_DIVIDER_NONE = 0;\n        LinearLayout.SHOW_DIVIDER_BEGINNING = 1;\n        LinearLayout.SHOW_DIVIDER_MIDDLE = 2;\n        LinearLayout.SHOW_DIVIDER_END = 4;\n        LinearLayout.VERTICAL_GRAVITY_COUNT = 4;\n        LinearLayout.INDEX_CENTER_VERTICAL = 0;\n        LinearLayout.INDEX_TOP = 1;\n        LinearLayout.INDEX_BOTTOM = 2;\n        LinearLayout.INDEX_FILL = 3;\n        widget.LinearLayout = LinearLayout;\n        (function (LinearLayout) {\n            class LayoutParams extends android.view.ViewGroup.MarginLayoutParams {\n                constructor(...args) {\n                    super(...(() => {\n                        if (args[0] instanceof Context && args[1] instanceof HTMLElement)\n                            return [args[0], args[1]];\n                        else if (typeof args[0] === 'number' && typeof args[1] === 'number' && typeof args[2] === 'number')\n                            return [args[0], args[1]];\n                        else if (typeof args[0] === 'number' && typeof args[1] === 'number')\n                            return [args[0], args[1]];\n                        else if (args[0] instanceof LinearLayout.LayoutParams)\n                            return [args[0]];\n                        else if (args[0] instanceof ViewGroup.MarginLayoutParams)\n                            return [args[0]];\n                        else if (args[0] instanceof ViewGroup.LayoutParams)\n                            return [args[0]];\n                    })());\n                    this.weight = 0;\n                    this.gravity = -1;\n                    if (args[0] instanceof Context && args[1] instanceof HTMLElement) {\n                        const c = args[0];\n                        const attrs = args[1];\n                        const a = c.obtainStyledAttributes(attrs);\n                        this.weight = a.getFloat('layout_weight', 0);\n                        this.gravity = Gravity.parseGravity(a.getAttrValue('layout_gravity'), -1);\n                        a.recycle();\n                    }\n                    else if (typeof args[0] === 'number' && typeof args[1] === 'number' && typeof args[2] == 'number') {\n                        this.weight = args[2];\n                    }\n                    else if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n                        this.weight = 0;\n                    }\n                    else if (args[0] instanceof LinearLayout.LayoutParams) {\n                        const source = args[0];\n                        this.weight = source.weight;\n                        this.gravity = source.gravity;\n                    }\n                    else if (args[0] instanceof ViewGroup.MarginLayoutParams) {\n                    }\n                    else if (args[0] instanceof ViewGroup.LayoutParams) {\n                    }\n                }\n                createClassAttrBinder() {\n                    return super.createClassAttrBinder().set('layout_gravity', {\n                        setter(param, value, attrBinder) {\n                            param.gravity = attrBinder.parseGravity(value, param.gravity);\n                        }, getter(param) {\n                            return param.gravity;\n                        }\n                    }).set('layout_weight', {\n                        setter(param, value, attrBinder) {\n                            param.weight = attrBinder.parseFloat(value, param.weight);\n                        }, getter(param) {\n                            return param.weight;\n                        }\n                    });\n                }\n            }\n            LinearLayout.LayoutParams = LayoutParams;\n        })(LinearLayout = widget.LinearLayout || (widget.LinearLayout = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var util;\n    (function (util) {\n        class MathUtils {\n            constructor() {\n            }\n            static abs(v) {\n                return v > 0 ? v : -v;\n            }\n            static constrain(amount, low, high) {\n                return amount < low ? low : (amount > high ? high : amount);\n            }\n            static log(a) {\n                return Math.log(a);\n            }\n            static exp(a) {\n                return Math.exp(a);\n            }\n            static pow(a, b) {\n                return Math.pow(a, b);\n            }\n            static max(a, b, c) {\n                if (c == null)\n                    return a > b ? a : b;\n                return a > b ? (a > c ? a : c) : (b > c ? b : c);\n            }\n            static min(a, b, c) {\n                if (c == null)\n                    return a < b ? a : b;\n                return a < b ? (a < c ? a : c) : (b < c ? b : c);\n            }\n            static dist(x1, y1, x2, y2) {\n                const x = (x2 - x1);\n                const y = (y2 - y1);\n                return Math.sqrt(x * x + y * y);\n            }\n            static dist3(x1, y1, z1, x2, y2, z2) {\n                const x = (x2 - x1);\n                const y = (y2 - y1);\n                const z = (z2 - z1);\n                return Math.sqrt(x * x + y * y + z * z);\n            }\n            static mag(a, b, c) {\n                if (c == null)\n                    return Math.sqrt(a * a + b * b);\n                return Math.sqrt(a * a + b * b + c * c);\n            }\n            static sq(v) {\n                return v * v;\n            }\n            static radians(degrees) {\n                return degrees * MathUtils.DEG_TO_RAD;\n            }\n            static degrees(radians) {\n                return radians * MathUtils.RAD_TO_DEG;\n            }\n            static acos(value) {\n                return Math.acos(value);\n            }\n            static asin(value) {\n                return Math.asin(value);\n            }\n            static atan(value) {\n                return Math.atan(value);\n            }\n            static atan2(a, b) {\n                return Math.atan2(a, b);\n            }\n            static tan(angle) {\n                return Math.tan(angle);\n            }\n            static lerp(start, stop, amount) {\n                return start + (stop - start) * amount;\n            }\n            static norm(start, stop, value) {\n                return (value - start) / (stop - start);\n            }\n            static map(minStart, minStop, maxStart, maxStop, value) {\n                return maxStart + (maxStart - maxStop) * ((value - minStart) / (minStop - minStart));\n            }\n            static random(...args) {\n                if (args.length == 1)\n                    return Math.random() * args[0];\n                let [howsmall, howbig] = args;\n                if (howsmall >= howbig)\n                    return howsmall;\n                return Math.random() * (howbig - howsmall) + howsmall;\n            }\n        }\n        MathUtils.DEG_TO_RAD = 3.1415926 / 180.0;\n        MathUtils.RAD_TO_DEG = 180.0 / 3.1415926;\n        util.MathUtils = MathUtils;\n    })(util = android.util || (android.util = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var util;\n    (function (util) {\n        class SparseBooleanArray extends util.SparseArray {\n        }\n        util.SparseBooleanArray = SparseBooleanArray;\n    })(util = android.util || (android.util = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        class SoundEffectConstants {\n            static getContantForFocusDirection(direction) {\n                switch (direction) {\n                    case view.View.FOCUS_RIGHT:\n                        return SoundEffectConstants.NAVIGATION_RIGHT;\n                    case view.View.FOCUS_FORWARD:\n                    case view.View.FOCUS_DOWN:\n                        return SoundEffectConstants.NAVIGATION_DOWN;\n                    case view.View.FOCUS_LEFT:\n                        return SoundEffectConstants.NAVIGATION_LEFT;\n                    case view.View.FOCUS_BACKWARD:\n                    case view.View.FOCUS_UP:\n                        return SoundEffectConstants.NAVIGATION_UP;\n                }\n                throw Error(`new IllegalArgumentException(\"direction must be one of \" + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_FORWARD, FOCUS_BACKWARD}.\")`);\n            }\n        }\n        SoundEffectConstants.CLICK = 0;\n        SoundEffectConstants.NAVIGATION_LEFT = 1;\n        SoundEffectConstants.NAVIGATION_UP = 2;\n        SoundEffectConstants.NAVIGATION_RIGHT = 3;\n        SoundEffectConstants.NAVIGATION_DOWN = 4;\n        view.SoundEffectConstants = SoundEffectConstants;\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var os;\n    (function (os) {\n        class Trace {\n            static nativeGetEnabledTags() {\n                return Trace.TRACE_TAG_ALWAYS;\n            }\n            static nativeTraceCounter(tag, name, value) {\n            }\n            static nativeTraceBegin(tag, name) { }\n            static nativeTraceEnd(tag) { }\n            static nativeAsyncTraceBegin(tag, name, cookie) { }\n            static nativeAsyncTraceEnd(tag, name, cookie) { }\n            static nativeSetAppTracingAllowed(allowed) { }\n            static nativeSetTracingEnabled(allowed) { }\n            static cacheEnabledTags() {\n                let tags = Trace.nativeGetEnabledTags();\n                Trace.sEnabledTags = tags;\n                return tags;\n            }\n            static isTagEnabled(traceTag) {\n                let tags = Trace.sEnabledTags;\n                if (tags == Trace.TRACE_TAG_NOT_READY) {\n                    tags = Trace.cacheEnabledTags();\n                }\n                return (tags & traceTag) != 0;\n            }\n            static traceCounter(traceTag, counterName, counterValue) {\n                if (Trace.isTagEnabled(traceTag)) {\n                    Trace.nativeTraceCounter(traceTag, counterName, counterValue);\n                }\n            }\n            static setAppTracingAllowed(allowed) {\n                Trace.nativeSetAppTracingAllowed(allowed);\n                Trace.cacheEnabledTags();\n            }\n            static setTracingEnabled(enabled) {\n                Trace.nativeSetTracingEnabled(enabled);\n                Trace.cacheEnabledTags();\n            }\n            static traceBegin(traceTag, methodName) {\n                if (Trace.isTagEnabled(traceTag)) {\n                    Trace.nativeTraceBegin(traceTag, methodName);\n                }\n            }\n            static traceEnd(traceTag) {\n                if (Trace.isTagEnabled(traceTag)) {\n                    Trace.nativeTraceEnd(traceTag);\n                }\n            }\n            static asyncTraceBegin(traceTag, methodName, cookie) {\n                if (Trace.isTagEnabled(traceTag)) {\n                    Trace.nativeAsyncTraceBegin(traceTag, methodName, cookie);\n                }\n            }\n            static asyncTraceEnd(traceTag, methodName, cookie) {\n                if (Trace.isTagEnabled(traceTag)) {\n                    Trace.nativeAsyncTraceEnd(traceTag, methodName, cookie);\n                }\n            }\n            static beginSection(sectionName) {\n                if (Trace.isTagEnabled(Trace.TRACE_TAG_APP)) {\n                    if (sectionName.length > Trace.MAX_SECTION_NAME_LEN) {\n                        throw Error(`new IllegalArgumentException(\"sectionName is too long\")`);\n                    }\n                    Trace.nativeTraceBegin(Trace.TRACE_TAG_APP, sectionName);\n                }\n            }\n            static endSection() {\n                if (Trace.isTagEnabled(Trace.TRACE_TAG_APP)) {\n                    Trace.nativeTraceEnd(Trace.TRACE_TAG_APP);\n                }\n            }\n        }\n        Trace.TAG = \"Trace\";\n        Trace.TRACE_TAG_NEVER = 0;\n        Trace.TRACE_TAG_ALWAYS = 1 << 0;\n        Trace.TRACE_TAG_GRAPHICS = 1 << 1;\n        Trace.TRACE_TAG_INPUT = 1 << 2;\n        Trace.TRACE_TAG_VIEW = 1 << 3;\n        Trace.TRACE_TAG_WEBVIEW = 1 << 4;\n        Trace.TRACE_TAG_WINDOW_MANAGER = 1 << 5;\n        Trace.TRACE_TAG_ACTIVITY_MANAGER = 1 << 6;\n        Trace.TRACE_TAG_SYNC_MANAGER = 1 << 7;\n        Trace.TRACE_TAG_AUDIO = 1 << 8;\n        Trace.TRACE_TAG_VIDEO = 1 << 9;\n        Trace.TRACE_TAG_CAMERA = 1 << 10;\n        Trace.TRACE_TAG_HAL = 1 << 11;\n        Trace.TRACE_TAG_APP = 1 << 12;\n        Trace.TRACE_TAG_RESOURCES = 1 << 13;\n        Trace.TRACE_TAG_DALVIK = 1 << 14;\n        Trace.TRACE_TAG_RS = 1 << 15;\n        Trace.TRACE_TAG_NOT_READY = 1 << 63;\n        Trace.MAX_SECTION_NAME_LEN = 127;\n        Trace.sEnabledTags = Trace.TRACE_TAG_NOT_READY;\n        os.Trace = Trace;\n    })(os = android.os || (android.os = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        var KeyEvent = android.view.KeyEvent;\n        class InputType {\n        }\n        InputType.TYPE_MASK_CLASS = 0x0000000f;\n        InputType.TYPE_MASK_VARIATION = 0x00000ff0;\n        InputType.TYPE_MASK_FLAGS = 0x00fff000;\n        InputType.TYPE_NULL = 0x00000000;\n        InputType.TYPE_CLASS_TEXT = 0x00000001;\n        InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS = 0x00001000;\n        InputType.TYPE_TEXT_FLAG_CAP_WORDS = 0x00002000;\n        InputType.TYPE_TEXT_FLAG_CAP_SENTENCES = 0x00004000;\n        InputType.TYPE_TEXT_FLAG_AUTO_CORRECT = 0x00008000;\n        InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE = 0x00010000;\n        InputType.TYPE_TEXT_FLAG_MULTI_LINE = 0x00020000;\n        InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE = 0x00040000;\n        InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS = 0x00080000;\n        InputType.TYPE_TEXT_VARIATION_NORMAL = 0x00000000;\n        InputType.TYPE_TEXT_VARIATION_URI = 0x00000010;\n        InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS = 0x00000020;\n        InputType.TYPE_TEXT_VARIATION_EMAIL_SUBJECT = 0x00000030;\n        InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE = 0x00000040;\n        InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE = 0x00000050;\n        InputType.TYPE_TEXT_VARIATION_PERSON_NAME = 0x00000060;\n        InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS = 0x00000070;\n        InputType.TYPE_TEXT_VARIATION_PASSWORD = 0x00000080;\n        InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD = 0x00000090;\n        InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT = 0x000000a0;\n        InputType.TYPE_TEXT_VARIATION_FILTER = 0x000000b0;\n        InputType.TYPE_TEXT_VARIATION_PHONETIC = 0x000000c0;\n        InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS = 0x000000d0;\n        InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD = 0x000000e0;\n        InputType.TYPE_CLASS_NUMBER = 0x00000002;\n        InputType.TYPE_NUMBER_FLAG_SIGNED = 0x00001000;\n        InputType.TYPE_NUMBER_FLAG_DECIMAL = 0x00002000;\n        InputType.TYPE_NUMBER_VARIATION_NORMAL = 0x00000000;\n        InputType.TYPE_NUMBER_VARIATION_PASSWORD = 0x00000010;\n        InputType.TYPE_CLASS_PHONE = 0x00000003;\n        InputType.TYPE_CLASS_DATETIME = 0x00000004;\n        InputType.TYPE_DATETIME_VARIATION_NORMAL = 0x00000000;\n        InputType.TYPE_DATETIME_VARIATION_DATE = 0x00000010;\n        InputType.TYPE_DATETIME_VARIATION_TIME = 0x00000020;\n        text.InputType = InputType;\n        (function (InputType) {\n            class LimitCode {\n            }\n            LimitCode.TYPE_CLASS_NUMBER = [\n                KeyEvent.KEYCODE_Digit0,\n                KeyEvent.KEYCODE_Digit1,\n                KeyEvent.KEYCODE_Digit2,\n                KeyEvent.KEYCODE_Digit3,\n                KeyEvent.KEYCODE_Digit4,\n                KeyEvent.KEYCODE_Digit5,\n                KeyEvent.KEYCODE_Digit6,\n                KeyEvent.KEYCODE_Digit7,\n                KeyEvent.KEYCODE_Digit8,\n                KeyEvent.KEYCODE_Digit9,\n            ];\n            LimitCode.TYPE_CLASS_PHONE = [\n                KeyEvent.KEYCODE_Comma,\n                KeyEvent.KEYCODE_Sharp,\n                KeyEvent.KEYCODE_Semicolon,\n                KeyEvent.KEYCODE_Asterisk,\n                KeyEvent.KEYCODE_Left_Parenthesis,\n                KeyEvent.KEYCODE_Right_Parenthesis,\n                KeyEvent.KEYCODE_Slash,\n                KeyEvent.KEYCODE_KeyN,\n                KeyEvent.KEYCODE_Period,\n                KeyEvent.KEYCODE_SPACE,\n                KeyEvent.KEYCODE_Add,\n                KeyEvent.KEYCODE_Minus,\n                KeyEvent.KEYCODE_Period,\n                KeyEvent.KEYCODE_Digit0,\n                KeyEvent.KEYCODE_Digit1,\n                KeyEvent.KEYCODE_Digit2,\n                KeyEvent.KEYCODE_Digit3,\n                KeyEvent.KEYCODE_Digit4,\n                KeyEvent.KEYCODE_Digit5,\n                KeyEvent.KEYCODE_Digit6,\n                KeyEvent.KEYCODE_Digit7,\n                KeyEvent.KEYCODE_Digit8,\n                KeyEvent.KEYCODE_Digit9,\n            ];\n            InputType.LimitCode = LimitCode;\n        })(InputType = text.InputType || (text.InputType = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var util;\n    (function (util) {\n        class LongSparseArray extends util.SparseArray {\n        }\n        util.LongSparseArray = LongSparseArray;\n    })(util = android.util || (android.util = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        class HapticFeedbackConstants {\n        }\n        HapticFeedbackConstants.LONG_PRESS = 0;\n        HapticFeedbackConstants.VIRTUAL_KEY = 1;\n        HapticFeedbackConstants.KEYBOARD_TAP = 3;\n        HapticFeedbackConstants.SAFE_MODE_DISABLED = 10000;\n        HapticFeedbackConstants.SAFE_MODE_ENABLED = 10001;\n        HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING = 0x0001;\n        HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING = 0x0002;\n        view.HapticFeedbackConstants = HapticFeedbackConstants;\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var database;\n    (function (database) {\n        class DataSetObserver {\n            onChanged() {\n            }\n            onInvalidated() {\n            }\n        }\n        database.DataSetObserver = DataSetObserver;\n    })(database = android.database || (android.database = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var DataSetObserver = android.database.DataSetObserver;\n        var SystemClock = android.os.SystemClock;\n        var SoundEffectConstants = android.view.SoundEffectConstants;\n        var View = android.view.View;\n        var ViewGroup = android.view.ViewGroup;\n        var Long = java.lang.Long;\n        class AdapterView extends ViewGroup {\n            constructor() {\n                super(...arguments);\n                this.mFirstPosition = 0;\n                this.mSpecificTop = 0;\n                this.mSyncPosition = 0;\n                this.mSyncRowId = AdapterView.INVALID_ROW_ID;\n                this.mSyncHeight = 0;\n                this.mNeedSync = false;\n                this.mSyncMode = 0;\n                this.mLayoutHeight = 0;\n                this.mInLayout = false;\n                this.mNextSelectedPosition = AdapterView.INVALID_POSITION;\n                this.mNextSelectedRowId = AdapterView.INVALID_ROW_ID;\n                this.mSelectedPosition = AdapterView.INVALID_POSITION;\n                this.mSelectedRowId = AdapterView.INVALID_ROW_ID;\n                this.mItemCount = 0;\n                this.mOldItemCount = 0;\n                this.mOldSelectedPosition = AdapterView.INVALID_POSITION;\n                this.mOldSelectedRowId = AdapterView.INVALID_ROW_ID;\n                this.mBlockLayoutRequests = false;\n            }\n            setOnItemClickListener(listener) {\n                this.mOnItemClickListener = listener;\n            }\n            getOnItemClickListener() {\n                return this.mOnItemClickListener;\n            }\n            performItemClick(view, position, id) {\n                if (this.mOnItemClickListener != null) {\n                    this.playSoundEffect(SoundEffectConstants.CLICK);\n                    this.mOnItemClickListener.onItemClick(this, view, position, id);\n                    return true;\n                }\n                return false;\n            }\n            setOnItemLongClickListener(listener) {\n                if (!this.isLongClickable()) {\n                    this.setLongClickable(true);\n                }\n                this.mOnItemLongClickListener = listener;\n            }\n            getOnItemLongClickListener() {\n                return this.mOnItemLongClickListener;\n            }\n            setOnItemSelectedListener(listener) {\n                this.mOnItemSelectedListener = listener;\n            }\n            getOnItemSelectedListener() {\n                return this.mOnItemSelectedListener;\n            }\n            addView(...args) {\n                throw Error(`new UnsupportedOperationException(\"addView() is not supported in AdapterView\")`);\n            }\n            removeView(child) {\n                throw Error(`new UnsupportedOperationException(\"removeView(View) is not supported in AdapterView\")`);\n            }\n            removeViewAt(index) {\n                throw Error(`new UnsupportedOperationException(\"removeViewAt(int) is not supported in AdapterView\")`);\n            }\n            removeAllViews() {\n                throw Error(`new UnsupportedOperationException(\"removeAllViews() is not supported in AdapterView\")`);\n            }\n            onLayout(changed, left, top, right, bottom) {\n                this.mLayoutHeight = this.getHeight();\n            }\n            getSelectedItemPosition() {\n                return this.mNextSelectedPosition;\n            }\n            getSelectedItemId() {\n                return this.mNextSelectedRowId;\n            }\n            getSelectedItem() {\n                let adapter = this.getAdapter();\n                let selection = this.getSelectedItemPosition();\n                if (adapter != null && adapter.getCount() > 0 && selection >= 0) {\n                    return adapter.getItem(selection);\n                }\n                else {\n                    return null;\n                }\n            }\n            getCount() {\n                return this.mItemCount;\n            }\n            getPositionForView(view) {\n                let listItem = view;\n                try {\n                    let v;\n                    while (!((v = listItem.getParent()) == (this))) {\n                        listItem = v;\n                    }\n                }\n                catch (e) {\n                    return AdapterView.INVALID_POSITION;\n                }\n                const childCount = this.getChildCount();\n                for (let i = 0; i < childCount; i++) {\n                    if (this.getChildAt(i) == (listItem)) {\n                        return this.mFirstPosition + i;\n                    }\n                }\n                return AdapterView.INVALID_POSITION;\n            }\n            getFirstVisiblePosition() {\n                return this.mFirstPosition;\n            }\n            getLastVisiblePosition() {\n                return this.mFirstPosition + this.getChildCount() - 1;\n            }\n            setEmptyView(emptyView) {\n                this.mEmptyView = emptyView;\n                const adapter = this.getAdapter();\n                const empty = ((adapter == null) || adapter.isEmpty());\n                this.updateEmptyStatus(empty);\n            }\n            getEmptyView() {\n                return this.mEmptyView;\n            }\n            isInFilterMode() {\n                return false;\n            }\n            setFocusable(focusable) {\n                const adapter = this.getAdapter();\n                const empty = adapter == null || adapter.getCount() == 0;\n                this.mDesiredFocusableState = focusable;\n                if (!focusable) {\n                    this.mDesiredFocusableInTouchModeState = false;\n                }\n                super.setFocusable(focusable && (!empty || this.isInFilterMode()));\n            }\n            setFocusableInTouchMode(focusable) {\n                const adapter = this.getAdapter();\n                const empty = adapter == null || adapter.getCount() == 0;\n                this.mDesiredFocusableInTouchModeState = focusable;\n                if (focusable) {\n                    this.mDesiredFocusableState = true;\n                }\n                super.setFocusableInTouchMode(focusable && (!empty || this.isInFilterMode()));\n            }\n            checkFocus() {\n                const adapter = this.getAdapter();\n                const empty = adapter == null || adapter.getCount() == 0;\n                const focusable = !empty || this.isInFilterMode();\n                super.setFocusableInTouchMode(focusable && this.mDesiredFocusableInTouchModeState);\n                super.setFocusable(focusable && this.mDesiredFocusableState);\n                if (this.mEmptyView != null) {\n                    this.updateEmptyStatus((adapter == null) || adapter.isEmpty());\n                }\n            }\n            updateEmptyStatus(empty) {\n                if (this.isInFilterMode()) {\n                    empty = false;\n                }\n                if (empty) {\n                    if (this.mEmptyView != null) {\n                        this.mEmptyView.setVisibility(View.VISIBLE);\n                        this.setVisibility(View.GONE);\n                    }\n                    else {\n                        this.setVisibility(View.VISIBLE);\n                    }\n                    if (this.mDataChanged) {\n                        this.onLayout(false, this.mLeft, this.mTop, this.mRight, this.mBottom);\n                    }\n                }\n                else {\n                    if (this.mEmptyView != null)\n                        this.mEmptyView.setVisibility(View.GONE);\n                    this.setVisibility(View.VISIBLE);\n                }\n            }\n            getItemAtPosition(position) {\n                let adapter = this.getAdapter();\n                return (adapter == null || position < 0) ? null : adapter.getItem(position);\n            }\n            getItemIdAtPosition(position) {\n                let adapter = this.getAdapter();\n                return (adapter == null || position < 0) ? AdapterView.INVALID_ROW_ID : adapter.getItemId(position);\n            }\n            setOnClickListener(l) {\n                throw Error(`new RuntimeException(\"Don't call setOnClickListener for an AdapterView. \" + \"You probably want setOnItemClickListener instead\")`);\n            }\n            onDetachedFromWindow() {\n                super.onDetachedFromWindow();\n                this.removeCallbacks(this.mSelectionNotifier);\n            }\n            selectionChanged() {\n                if (this.mOnItemSelectedListener != null) {\n                    if (this.mInLayout || this.mBlockLayoutRequests) {\n                        if (this.mSelectionNotifier == null) {\n                            this.mSelectionNotifier = new SelectionNotifier(this);\n                        }\n                        this.post(this.mSelectionNotifier);\n                    }\n                    else {\n                        this.fireOnSelected();\n                        this.performAccessibilityActionsOnSelected();\n                    }\n                }\n            }\n            fireOnSelected() {\n                if (this.mOnItemSelectedListener == null) {\n                    return;\n                }\n                const selection = this.getSelectedItemPosition();\n                if (selection >= 0) {\n                    let v = this.getSelectedView();\n                    this.mOnItemSelectedListener.onItemSelected(this, v, selection, this.getAdapter().getItemId(selection));\n                }\n                else {\n                    this.mOnItemSelectedListener.onNothingSelected(this);\n                }\n            }\n            performAccessibilityActionsOnSelected() {\n            }\n            isScrollableForAccessibility() {\n                let adapter = this.getAdapter();\n                if (adapter != null) {\n                    const itemCount = adapter.getCount();\n                    return itemCount > 0 && (this.getFirstVisiblePosition() > 0 || this.getLastVisiblePosition() < itemCount - 1);\n                }\n                return false;\n            }\n            canAnimate() {\n                return super.canAnimate() && this.mItemCount > 0;\n            }\n            handleDataChanged() {\n                const count = this.mItemCount;\n                let found = false;\n                if (count > 0) {\n                    let newPos;\n                    if (this.mNeedSync) {\n                        this.mNeedSync = false;\n                        newPos = this.findSyncPosition();\n                        if (newPos >= 0) {\n                            let selectablePos = this.lookForSelectablePosition(newPos, true);\n                            if (selectablePos == newPos) {\n                                this.setNextSelectedPositionInt(newPos);\n                                found = true;\n                            }\n                        }\n                    }\n                    if (!found) {\n                        newPos = this.getSelectedItemPosition();\n                        if (newPos >= count) {\n                            newPos = count - 1;\n                        }\n                        if (newPos < 0) {\n                            newPos = 0;\n                        }\n                        let selectablePos = this.lookForSelectablePosition(newPos, true);\n                        if (selectablePos < 0) {\n                            selectablePos = this.lookForSelectablePosition(newPos, false);\n                        }\n                        if (selectablePos >= 0) {\n                            this.setNextSelectedPositionInt(selectablePos);\n                            this.checkSelectionChanged();\n                            found = true;\n                        }\n                    }\n                }\n                if (!found) {\n                    this.mSelectedPosition = AdapterView.INVALID_POSITION;\n                    this.mSelectedRowId = AdapterView.INVALID_ROW_ID;\n                    this.mNextSelectedPosition = AdapterView.INVALID_POSITION;\n                    this.mNextSelectedRowId = AdapterView.INVALID_ROW_ID;\n                    this.mNeedSync = false;\n                    this.checkSelectionChanged();\n                }\n            }\n            checkSelectionChanged() {\n                if ((this.mSelectedPosition != this.mOldSelectedPosition) || (this.mSelectedRowId != this.mOldSelectedRowId)) {\n                    this.selectionChanged();\n                    this.mOldSelectedPosition = this.mSelectedPosition;\n                    this.mOldSelectedRowId = this.mSelectedRowId;\n                }\n            }\n            findSyncPosition() {\n                let count = this.mItemCount;\n                if (count == 0) {\n                    return AdapterView.INVALID_POSITION;\n                }\n                let idToMatch = this.mSyncRowId;\n                let seed = this.mSyncPosition;\n                if (idToMatch == AdapterView.INVALID_ROW_ID) {\n                    return AdapterView.INVALID_POSITION;\n                }\n                seed = Math.max(0, seed);\n                seed = Math.min(count - 1, seed);\n                let endTime = SystemClock.uptimeMillis() + AdapterView.SYNC_MAX_DURATION_MILLIS;\n                let rowId;\n                let first = seed;\n                let last = seed;\n                let next = false;\n                let hitFirst;\n                let hitLast;\n                let adapter = this.getAdapter();\n                if (adapter == null) {\n                    return AdapterView.INVALID_POSITION;\n                }\n                while (SystemClock.uptimeMillis() <= endTime) {\n                    rowId = adapter.getItemId(seed);\n                    if (rowId == idToMatch) {\n                        return seed;\n                    }\n                    hitLast = last == count - 1;\n                    hitFirst = first == 0;\n                    if (hitLast && hitFirst) {\n                        break;\n                    }\n                    if (hitFirst || (next && !hitLast)) {\n                        last++;\n                        seed = last;\n                        next = false;\n                    }\n                    else if (hitLast || (!next && !hitFirst)) {\n                        first--;\n                        seed = first;\n                        next = true;\n                    }\n                }\n                return AdapterView.INVALID_POSITION;\n            }\n            lookForSelectablePosition(position, lookDown) {\n                return position;\n            }\n            setSelectedPositionInt(position) {\n                this.mSelectedPosition = position;\n                this.mSelectedRowId = this.getItemIdAtPosition(position);\n            }\n            setNextSelectedPositionInt(position) {\n                this.mNextSelectedPosition = position;\n                this.mNextSelectedRowId = this.getItemIdAtPosition(position);\n                if (this.mNeedSync && this.mSyncMode == AdapterView.SYNC_SELECTED_POSITION && position >= 0) {\n                    this.mSyncPosition = position;\n                    this.mSyncRowId = this.mNextSelectedRowId;\n                }\n            }\n            rememberSyncState() {\n                if (this.getChildCount() > 0) {\n                    this.mNeedSync = true;\n                    this.mSyncHeight = this.mLayoutHeight;\n                    if (this.mSelectedPosition >= 0) {\n                        let v = this.getChildAt(this.mSelectedPosition - this.mFirstPosition);\n                        this.mSyncRowId = this.mNextSelectedRowId;\n                        this.mSyncPosition = this.mNextSelectedPosition;\n                        if (v != null) {\n                            this.mSpecificTop = v.getTop();\n                        }\n                        this.mSyncMode = AdapterView.SYNC_SELECTED_POSITION;\n                    }\n                    else {\n                        let v = this.getChildAt(0);\n                        let adapter = this.getAdapter();\n                        if (this.mFirstPosition >= 0 && this.mFirstPosition < adapter.getCount()) {\n                            this.mSyncRowId = adapter.getItemId(this.mFirstPosition);\n                        }\n                        else {\n                            this.mSyncRowId = AdapterView.NO_ID;\n                        }\n                        this.mSyncPosition = this.mFirstPosition;\n                        if (v != null) {\n                            this.mSpecificTop = v.getTop();\n                        }\n                        this.mSyncMode = AdapterView.SYNC_FIRST_POSITION;\n                    }\n                }\n            }\n        }\n        AdapterView.ITEM_VIEW_TYPE_IGNORE = -1;\n        AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER = -2;\n        AdapterView.SYNC_SELECTED_POSITION = 0;\n        AdapterView.SYNC_FIRST_POSITION = 1;\n        AdapterView.SYNC_MAX_DURATION_MILLIS = 100;\n        AdapterView.INVALID_POSITION = -1;\n        AdapterView.INVALID_ROW_ID = Long.MIN_VALUE;\n        widget.AdapterView = AdapterView;\n        (function (AdapterView) {\n            class AdapterDataSetObserver extends DataSetObserver {\n                constructor(AdapterView_this) {\n                    super();\n                    this.AdapterView_this = AdapterView_this;\n                }\n                onChanged() {\n                    this.AdapterView_this.mDataChanged = true;\n                    this.AdapterView_this.mOldItemCount = this.AdapterView_this.mItemCount;\n                    this.AdapterView_this.mItemCount = this.AdapterView_this.getAdapter().getCount();\n                    this.AdapterView_this.rememberSyncState();\n                    this.AdapterView_this.checkFocus();\n                    this.AdapterView_this.requestLayout();\n                }\n                onInvalidated() {\n                    this.AdapterView_this.mDataChanged = true;\n                    this.AdapterView_this.mOldItemCount = this.AdapterView_this.mItemCount;\n                    this.AdapterView_this.mItemCount = 0;\n                    this.AdapterView_this.mSelectedPosition = AdapterView.INVALID_POSITION;\n                    this.AdapterView_this.mSelectedRowId = AdapterView.INVALID_ROW_ID;\n                    this.AdapterView_this.mNextSelectedPosition = AdapterView.INVALID_POSITION;\n                    this.AdapterView_this.mNextSelectedRowId = AdapterView.INVALID_ROW_ID;\n                    this.AdapterView_this.mNeedSync = false;\n                    this.AdapterView_this.checkFocus();\n                    this.AdapterView_this.requestLayout();\n                }\n                clearSavedState() {\n                }\n            }\n            AdapterView.AdapterDataSetObserver = AdapterDataSetObserver;\n        })(AdapterView = widget.AdapterView || (widget.AdapterView = {}));\n        class SelectionNotifier {\n            constructor(AdapterView_this) {\n                this.AdapterView_this = AdapterView_this;\n            }\n            run() {\n                if (this.AdapterView_this.mDataChanged) {\n                    if (this.AdapterView_this.getAdapter() != null) {\n                        this.AdapterView_this.post(this);\n                    }\n                }\n                else {\n                    this.AdapterView_this.fireOnSelected();\n                    this.AdapterView_this.performAccessibilityActionsOnSelected();\n                }\n            }\n        }\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var Integer = java.lang.Integer;\n        var Adapter;\n        (function (Adapter) {\n            Adapter.IGNORE_ITEM_VIEW_TYPE = widget.AdapterView.ITEM_VIEW_TYPE_IGNORE;\n            Adapter.NO_SELECTION = Integer.MIN_VALUE;\n        })(Adapter = widget.Adapter || (widget.Adapter = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text_8) {\n        var Paint = android.graphics.Paint;\n        var ParagraphStyle = android.text.style.ParagraphStyle;\n        var Layout = android.text.Layout;\n        var Spanned = android.text.Spanned;\n        var TextDirectionHeuristics = android.text.TextDirectionHeuristics;\n        var TextLine = android.text.TextLine;\n        var TextPaint = android.text.TextPaint;\n        var TextUtils = android.text.TextUtils;\n        class BoringLayout extends Layout {\n            constructor(source, paint, outerwidth, align, spacingmult, spacingadd, metrics, includepad, ellipsize = null, ellipsizedWidth = outerwidth) {\n                super(source, paint, outerwidth, align, TextDirectionHeuristics.FIRSTSTRONG_LTR, spacingmult, spacingadd);\n                this.mBottom = 0;\n                this.mDesc = 0;\n                this.mTopPadding = 0;\n                this.mBottomPadding = 0;\n                this.mMax = 0;\n                this.mEllipsizedWidth = 0;\n                this.mEllipsizedStart = 0;\n                this.mEllipsizedCount = 0;\n                let trust;\n                if (ellipsize == null || ellipsize == TextUtils.TruncateAt.MARQUEE) {\n                    this.mEllipsizedWidth = outerwidth;\n                    this.mEllipsizedStart = 0;\n                    this.mEllipsizedCount = 0;\n                    trust = true;\n                }\n                else {\n                    this.replaceWith(TextUtils.ellipsize(source, paint, ellipsizedWidth, ellipsize, true, this), paint, outerwidth, align, spacingmult, spacingadd);\n                    this.mEllipsizedWidth = ellipsizedWidth;\n                    trust = false;\n                }\n                this.init(this.getText(), paint, outerwidth, align, spacingmult, spacingadd, metrics, includepad, trust);\n            }\n            static make(source, paint, outerwidth, align, spacingmult, spacingadd, metrics, includepad, ellipsize = null, ellipsizedWidth = outerwidth) {\n                return new BoringLayout(source, paint, outerwidth, align, spacingmult, spacingadd, metrics, includepad, ellipsize, ellipsizedWidth);\n            }\n            replaceOrMake(source, paint, outerwidth, align, spacingmult, spacingadd, metrics, includepad, ellipsize = null, ellipsizedWidth = outerwidth) {\n                let trust;\n                if (ellipsize == null || ellipsize == TextUtils.TruncateAt.MARQUEE) {\n                    this.replaceWith(source, paint, outerwidth, align, spacingmult, spacingadd);\n                    this.mEllipsizedWidth = outerwidth;\n                    this.mEllipsizedStart = 0;\n                    this.mEllipsizedCount = 0;\n                    trust = true;\n                }\n                else {\n                    this.replaceWith(TextUtils.ellipsize(source, paint, ellipsizedWidth, ellipsize, true, this), paint, outerwidth, align, spacingmult, spacingadd);\n                    this.mEllipsizedWidth = ellipsizedWidth;\n                    trust = false;\n                }\n                this.init(this.getText(), paint, outerwidth, align, spacingmult, spacingadd, metrics, includepad, trust);\n                return this;\n            }\n            init(source, paint, outerwidth, align, spacingmult, spacingadd, metrics, includepad, trustWidth) {\n                let spacing;\n                if (Object.getPrototypeOf(source) === String.prototype && align == Layout.Alignment.ALIGN_NORMAL) {\n                    this.mDirect = source.toString();\n                }\n                else {\n                    this.mDirect = null;\n                }\n                this.mPaint = paint;\n                if (includepad) {\n                    spacing = metrics.bottom - metrics.top;\n                }\n                else {\n                    spacing = metrics.descent - metrics.ascent;\n                }\n                if (spacingmult != 1 || spacingadd != 0) {\n                    spacing = Math.floor((spacing * spacingmult + spacingadd + 0.5));\n                }\n                this.mBottom = spacing;\n                if (includepad) {\n                    this.mDesc = spacing + metrics.top;\n                }\n                else {\n                    this.mDesc = spacing + metrics.ascent;\n                }\n                if (trustWidth) {\n                    this.mMax = metrics.width;\n                }\n                else {\n                    let line = TextLine.obtain();\n                    line.set(paint, source, 0, source.length, Layout.DIR_LEFT_TO_RIGHT, Layout.DIRS_ALL_LEFT_TO_RIGHT, false, null);\n                    this.mMax = Math.floor(Math.ceil(line.metrics(null)));\n                    TextLine.recycle(line);\n                }\n                if (includepad) {\n                    this.mTopPadding = metrics.top - metrics.ascent;\n                    this.mBottomPadding = metrics.bottom - metrics.descent;\n                }\n            }\n            static isBoring(text, paint, textDir = TextDirectionHeuristics.FIRSTSTRONG_LTR, metrics = null) {\n                let temp;\n                let length = text.length;\n                let boring = true;\n                outer: for (let i = 0; i < length; i += 500) {\n                    let j = i + 500;\n                    if (j > length)\n                        j = length;\n                    temp = text.substring(i, j);\n                    let n = j - i;\n                    for (let a = 0; a < n; a++) {\n                        let c = temp[a];\n                        if (c == '\\n' || c == '\\t') {\n                            boring = false;\n                            break outer;\n                        }\n                    }\n                    if (textDir != null && textDir.isRtl(temp, 0, n)) {\n                        boring = false;\n                        break outer;\n                    }\n                }\n                if (boring && Spanned.isImplements(text)) {\n                    let sp = text;\n                    let styles = sp.getSpans(0, length, ParagraphStyle.type);\n                    if (styles.length > 0) {\n                        boring = false;\n                    }\n                }\n                if (boring) {\n                    let fm = metrics;\n                    if (fm == null) {\n                        fm = new BoringLayout.Metrics();\n                    }\n                    let line = TextLine.obtain();\n                    line.set(paint, text, 0, length, Layout.DIR_LEFT_TO_RIGHT, Layout.DIRS_ALL_LEFT_TO_RIGHT, false, null);\n                    fm.width = Math.floor(Math.ceil(line.metrics(fm)));\n                    TextLine.recycle(line);\n                    return fm;\n                }\n                else {\n                    return null;\n                }\n            }\n            getHeight() {\n                return this.mBottom;\n            }\n            getLineCount() {\n                return 1;\n            }\n            getLineTop(line) {\n                if (line == 0)\n                    return 0;\n                else\n                    return this.mBottom;\n            }\n            getLineDescent(line) {\n                return this.mDesc;\n            }\n            getLineStart(line) {\n                if (line == 0)\n                    return 0;\n                else\n                    return this.getText().length;\n            }\n            getParagraphDirection(line) {\n                return BoringLayout.DIR_LEFT_TO_RIGHT;\n            }\n            getLineContainsTab(line) {\n                return false;\n            }\n            getLineMax(line) {\n                return this.mMax;\n            }\n            getLineDirections(line) {\n                return Layout.DIRS_ALL_LEFT_TO_RIGHT;\n            }\n            getTopPadding() {\n                return this.mTopPadding;\n            }\n            getBottomPadding() {\n                return this.mBottomPadding;\n            }\n            getEllipsisCount(line) {\n                return this.mEllipsizedCount;\n            }\n            getEllipsisStart(line) {\n                return this.mEllipsizedStart;\n            }\n            getEllipsizedWidth() {\n                return this.mEllipsizedWidth;\n            }\n            draw(c, highlight, highlightpaint, cursorOffset) {\n                if (this.mDirect != null && highlight == null) {\n                    c.drawText(this.mDirect, 0, this.mBottom - this.mDesc, this.mPaint);\n                }\n                else {\n                    super.draw(c, highlight, highlightpaint, cursorOffset);\n                }\n            }\n            ellipsized(start, end) {\n                this.mEllipsizedStart = start;\n                this.mEllipsizedCount = end - start;\n            }\n        }\n        BoringLayout.FIRST_RIGHT_TO_LEFT = '֐'.codePointAt(0);\n        BoringLayout.sTemp = new TextPaint();\n        text_8.BoringLayout = BoringLayout;\n        (function (BoringLayout) {\n            class Metrics extends Paint.FontMetricsInt {\n                constructor() {\n                    super(...arguments);\n                    this.width = 0;\n                }\n                toString() {\n                    return super.toString() + \" width=\" + this.width;\n                }\n            }\n            BoringLayout.Metrics = Metrics;\n        })(BoringLayout = text_8.BoringLayout || (text_8.BoringLayout = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        var System = java.lang.System;\n        class PackedIntVector {\n            constructor(columns) {\n                this.mColumns = 0;\n                this.mRows = 0;\n                this.mRowGapStart = 0;\n                this.mRowGapLength = 0;\n                this.mColumns = columns;\n                this.mRows = 0;\n                this.mRowGapStart = 0;\n                this.mRowGapLength = this.mRows;\n                this.mValues = null;\n                this.mValueGap = androidui.util.ArrayCreator.newNumberArray(2 * columns);\n            }\n            getValue(row, column) {\n                const columns = this.mColumns;\n                if (((row | column) < 0) || (row >= this.size()) || (column >= columns)) {\n                    throw Error(`new IndexOutOfBoundsException(row + \", \" + column)`);\n                }\n                if (row >= this.mRowGapStart) {\n                    row += this.mRowGapLength;\n                }\n                let value = this.mValues[row * columns + column];\n                let valuegap = this.mValueGap;\n                if (row >= valuegap[column]) {\n                    value += valuegap[column + columns];\n                }\n                return value;\n            }\n            setValue(row, column, value) {\n                if (((row | column) < 0) || (row >= this.size()) || (column >= this.mColumns)) {\n                    throw Error(`new IndexOutOfBoundsException(row + \", \" + column)`);\n                }\n                if (row >= this.mRowGapStart) {\n                    row += this.mRowGapLength;\n                }\n                let valuegap = this.mValueGap;\n                if (row >= valuegap[column]) {\n                    value -= valuegap[column + this.mColumns];\n                }\n                this.mValues[row * this.mColumns + column] = value;\n            }\n            setValueInternal(row, column, value) {\n                if (row >= this.mRowGapStart) {\n                    row += this.mRowGapLength;\n                }\n                let valuegap = this.mValueGap;\n                if (row >= valuegap[column]) {\n                    value -= valuegap[column + this.mColumns];\n                }\n                this.mValues[row * this.mColumns + column] = value;\n            }\n            adjustValuesBelow(startRow, column, delta) {\n                if (((startRow | column) < 0) || (startRow > this.size()) || (column >= this.width())) {\n                    throw Error(`new IndexOutOfBoundsException(startRow + \", \" + column)`);\n                }\n                if (startRow >= this.mRowGapStart) {\n                    startRow += this.mRowGapLength;\n                }\n                this.moveValueGapTo(column, startRow);\n                this.mValueGap[column + this.mColumns] += delta;\n            }\n            insertAt(row, values) {\n                if ((row < 0) || (row > this.size())) {\n                    throw Error(`new IndexOutOfBoundsException(\"row \" + row)`);\n                }\n                if ((values != null) && (values.length < this.width())) {\n                    throw Error(`new IndexOutOfBoundsException(\"value count \" + values.length)`);\n                }\n                this.moveRowGapTo(row);\n                if (this.mRowGapLength == 0) {\n                    this.growBuffer();\n                }\n                this.mRowGapStart++;\n                this.mRowGapLength--;\n                if (values == null) {\n                    for (let i = this.mColumns - 1; i >= 0; i--) {\n                        this.setValueInternal(row, i, 0);\n                    }\n                }\n                else {\n                    for (let i = this.mColumns - 1; i >= 0; i--) {\n                        this.setValueInternal(row, i, values[i]);\n                    }\n                }\n            }\n            deleteAt(row, count) {\n                if (((row | count) < 0) || (row + count > this.size())) {\n                    throw Error(`new IndexOutOfBoundsException(row + \", \" + count)`);\n                }\n                this.moveRowGapTo(row + count);\n                this.mRowGapStart -= count;\n                this.mRowGapLength += count;\n            }\n            size() {\n                return this.mRows - this.mRowGapLength;\n            }\n            width() {\n                return this.mColumns;\n            }\n            growBuffer() {\n                const columns = this.mColumns;\n                let newsize = this.size() + 1;\n                newsize = (newsize * columns) / columns;\n                let newvalues = androidui.util.ArrayCreator.newNumberArray(newsize * columns);\n                const valuegap = this.mValueGap;\n                const rowgapstart = this.mRowGapStart;\n                let after = this.mRows - (rowgapstart + this.mRowGapLength);\n                if (this.mValues != null) {\n                    System.arraycopy(this.mValues, 0, newvalues, 0, columns * rowgapstart);\n                    System.arraycopy(this.mValues, (this.mRows - after) * columns, newvalues, (newsize - after) * columns, after * columns);\n                }\n                for (let i = 0; i < columns; i++) {\n                    if (valuegap[i] >= rowgapstart) {\n                        valuegap[i] += newsize - this.mRows;\n                        if (valuegap[i] < rowgapstart) {\n                            valuegap[i] = rowgapstart;\n                        }\n                    }\n                }\n                this.mRowGapLength += newsize - this.mRows;\n                this.mRows = newsize;\n                this.mValues = newvalues;\n            }\n            moveValueGapTo(column, where) {\n                const valuegap = this.mValueGap;\n                const values = this.mValues;\n                const columns = this.mColumns;\n                if (where == valuegap[column]) {\n                    return;\n                }\n                else if (where > valuegap[column]) {\n                    for (let i = valuegap[column]; i < where; i++) {\n                        values[i * columns + column] += valuegap[column + columns];\n                    }\n                }\n                else {\n                    for (let i = where; i < valuegap[column]; i++) {\n                        values[i * columns + column] -= valuegap[column + columns];\n                    }\n                }\n                valuegap[column] = where;\n            }\n            moveRowGapTo(where) {\n                if (where == this.mRowGapStart) {\n                    return;\n                }\n                else if (where > this.mRowGapStart) {\n                    let moving = where + this.mRowGapLength - (this.mRowGapStart + this.mRowGapLength);\n                    const columns = this.mColumns;\n                    const valuegap = this.mValueGap;\n                    const values = this.mValues;\n                    const gapend = this.mRowGapStart + this.mRowGapLength;\n                    for (let i = gapend; i < gapend + moving; i++) {\n                        let destrow = i - gapend + this.mRowGapStart;\n                        for (let j = 0; j < columns; j++) {\n                            let val = values[i * columns + j];\n                            if (i >= valuegap[j]) {\n                                val += valuegap[j + columns];\n                            }\n                            if (destrow >= valuegap[j]) {\n                                val -= valuegap[j + columns];\n                            }\n                            values[destrow * columns + j] = val;\n                        }\n                    }\n                }\n                else {\n                    let moving = this.mRowGapStart - where;\n                    const columns = this.mColumns;\n                    const valuegap = this.mValueGap;\n                    const values = this.mValues;\n                    const gapend = this.mRowGapStart + this.mRowGapLength;\n                    for (let i = where + moving - 1; i >= where; i--) {\n                        let destrow = i - where + gapend - moving;\n                        for (let j = 0; j < columns; j++) {\n                            let val = values[i * columns + j];\n                            if (i >= valuegap[j]) {\n                                val += valuegap[j + columns];\n                            }\n                            if (destrow >= valuegap[j]) {\n                                val -= valuegap[j + columns];\n                            }\n                            values[destrow * columns + j] = val;\n                        }\n                    }\n                }\n                this.mRowGapStart = where;\n            }\n        }\n        text.PackedIntVector = PackedIntVector;\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        var System = java.lang.System;\n        class PackedObjectVector {\n            constructor(columns) {\n                this.mColumns = 0;\n                this.mRows = 0;\n                this.mRowGapStart = 0;\n                this.mRowGapLength = 0;\n                this.mColumns = columns;\n                this.mRows = 1;\n                this.mRowGapStart = 0;\n                this.mRowGapLength = this.mRows;\n                this.mValues = new Array(this.mRows * this.mColumns);\n            }\n            getValue(row, column) {\n                if (row >= this.mRowGapStart)\n                    row += this.mRowGapLength;\n                let value = this.mValues[row * this.mColumns + column];\n                return value;\n            }\n            setValue(row, column, value) {\n                if (row >= this.mRowGapStart)\n                    row += this.mRowGapLength;\n                this.mValues[row * this.mColumns + column] = value;\n            }\n            insertAt(row, values) {\n                this.moveRowGapTo(row);\n                if (this.mRowGapLength == 0)\n                    this.growBuffer();\n                this.mRowGapStart++;\n                this.mRowGapLength--;\n                if (values == null)\n                    for (let i = 0; i < this.mColumns; i++)\n                        this.setValue(row, i, null);\n                else\n                    for (let i = 0; i < this.mColumns; i++)\n                        this.setValue(row, i, values[i]);\n            }\n            deleteAt(row, count) {\n                this.moveRowGapTo(row + count);\n                this.mRowGapStart -= count;\n                this.mRowGapLength += count;\n                if (this.mRowGapLength > this.size() * 2) {\n                }\n            }\n            size() {\n                return this.mRows - this.mRowGapLength;\n            }\n            width() {\n                return this.mColumns;\n            }\n            growBuffer() {\n                let newsize = this.size() + 1;\n                newsize = (newsize * this.mColumns) / this.mColumns;\n                let newvalues = new Array(newsize * this.mColumns);\n                let after = this.mRows - (this.mRowGapStart + this.mRowGapLength);\n                System.arraycopy(this.mValues, 0, newvalues, 0, this.mColumns * this.mRowGapStart);\n                System.arraycopy(this.mValues, (this.mRows - after) * this.mColumns, newvalues, (newsize - after) * this.mColumns, after * this.mColumns);\n                this.mRowGapLength += newsize - this.mRows;\n                this.mRows = newsize;\n                this.mValues = newvalues;\n            }\n            moveRowGapTo(where) {\n                if (where == this.mRowGapStart)\n                    return;\n                if (where > this.mRowGapStart) {\n                    let moving = where + this.mRowGapLength - (this.mRowGapStart + this.mRowGapLength);\n                    for (let i = this.mRowGapStart + this.mRowGapLength; i < this.mRowGapStart + this.mRowGapLength + moving; i++) {\n                        let destrow = i - (this.mRowGapStart + this.mRowGapLength) + this.mRowGapStart;\n                        for (let j = 0; j < this.mColumns; j++) {\n                            let val = this.mValues[i * this.mColumns + j];\n                            this.mValues[destrow * this.mColumns + j] = val;\n                        }\n                    }\n                }\n                else {\n                    let moving = this.mRowGapStart - where;\n                    for (let i = where + moving - 1; i >= where; i--) {\n                        let destrow = i - where + this.mRowGapStart + this.mRowGapLength - moving;\n                        for (let j = 0; j < this.mColumns; j++) {\n                            let val = this.mValues[i * this.mColumns + j];\n                            this.mValues[destrow * this.mColumns + j] = val;\n                        }\n                    }\n                }\n                this.mRowGapStart = where;\n            }\n            dump() {\n                for (let i = 0; i < this.mRows; i++) {\n                    for (let j = 0; j < this.mColumns; j++) {\n                        let val = this.mValues[i * this.mColumns + j];\n                        if (i < this.mRowGapStart || i >= this.mRowGapStart + this.mRowGapLength)\n                            System.out.print(val + \" \");\n                        else\n                            System.out.print(\"(\" + val + \") \");\n                    }\n                    System.out.print(\" << \\n\");\n                }\n                System.out.print(\"-----\\n\\n\");\n            }\n        }\n        text.PackedObjectVector = PackedObjectVector;\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        var Spannable;\n        (function (Spannable) {\n            function isImpl(obj) {\n                return obj && obj['setSpan'] && obj['removeSpan'];\n            }\n            Spannable.isImpl = isImpl;\n            class Factory {\n                static getInstance() {\n                    return Factory.sInstance;\n                }\n                newSpannable(source) {\n                    return source;\n                }\n            }\n            Factory.sInstance = new Factory();\n            Spannable.Factory = Factory;\n        })(Spannable = text.Spannable || (text.Spannable = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text_9) {\n        var style;\n        (function (style) {\n            var LineHeightSpan;\n            (function (LineHeightSpan) {\n                LineHeightSpan.type = Symbol();\n            })(LineHeightSpan = style.LineHeightSpan || (style.LineHeightSpan = {}));\n        })(style = text_9.style || (text_9.style = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text_10) {\n        var Paint = android.graphics.Paint;\n        var LeadingMarginSpan = android.text.style.LeadingMarginSpan;\n        var LeadingMarginSpan2 = android.text.style.LeadingMarginSpan.LeadingMarginSpan2;\n        var LineHeightSpan = android.text.style.LineHeightSpan;\n        var MetricAffectingSpan = android.text.style.MetricAffectingSpan;\n        var TabStopSpan = android.text.style.TabStopSpan;\n        var Integer = java.lang.Integer;\n        var System = java.lang.System;\n        var Layout = android.text.Layout;\n        var MeasuredText = android.text.MeasuredText;\n        var Spanned = android.text.Spanned;\n        var TextUtils = android.text.TextUtils;\n        class StaticLayout extends Layout {\n            constructor(source, bufstart, bufend, paint, outerwidth, align, textDir, spacingmult, spacingadd, includepad, ellipsize = null, ellipsizedWidth = 0, maxLines = Integer.MAX_VALUE) {\n                super((ellipsize == null) ? source : (Spanned.isImplements(source)) ? new Layout.SpannedEllipsizer(source) : new Layout.Ellipsizer(source), paint, outerwidth, align, textDir, spacingmult, spacingadd);\n                this.mLineCount = 0;\n                this.mTopPadding = 0;\n                this.mBottomPadding = 0;\n                this.mColumns = 0;\n                this.mEllipsizedWidth = 0;\n                this.mMaximumVisibleLineCount = Integer.MAX_VALUE;\n                this.mFontMetricsInt = new Paint.FontMetricsInt();\n                if (source == null) {\n                    this.mColumns = StaticLayout.COLUMNS_ELLIPSIZE;\n                    this.mLines = androidui.util.ArrayCreator.newNumberArray((2 * this.mColumns));\n                    this.mLineDirections = new Array((2 * this.mColumns));\n                    this.mMeasured = MeasuredText.obtain();\n                    return;\n                }\n                if (ellipsize != null) {\n                    let e = this.getText();\n                    e.mLayout = this;\n                    e.mWidth = ellipsizedWidth;\n                    e.mMethod = ellipsize;\n                    this.mEllipsizedWidth = ellipsizedWidth;\n                    this.mColumns = StaticLayout.COLUMNS_ELLIPSIZE;\n                }\n                else {\n                    this.mColumns = StaticLayout.COLUMNS_NORMAL;\n                    this.mEllipsizedWidth = outerwidth;\n                }\n                this.mLines = androidui.util.ArrayCreator.newNumberArray(2 * this.mColumns);\n                this.mLineDirections = new Array(2 * this.mColumns);\n                this.mMaximumVisibleLineCount = maxLines;\n                this.mMeasured = MeasuredText.obtain();\n                this.generate(source, bufstart, bufend, paint, outerwidth, textDir, spacingmult, spacingadd, includepad, includepad, ellipsizedWidth, ellipsize);\n                this.mMeasured = MeasuredText.recycle(this.mMeasured);\n                this.mFontMetricsInt = null;\n            }\n            generate(source, bufStart, bufEnd, paint, outerWidth, textDir, spacingmult, spacingadd, includepad, trackpad, ellipsizedWidth, ellipsize) {\n                this.mLineCount = 0;\n                let v = 0;\n                let needMultiply = (spacingmult != 1 || spacingadd != 0);\n                let fm = this.mFontMetricsInt;\n                let chooseHtv = null;\n                let measured = this.mMeasured;\n                let spanned = null;\n                if (Spanned.isImplements(source))\n                    spanned = source;\n                let DEFAULT_DIR = StaticLayout.DIR_LEFT_TO_RIGHT;\n                let paraEnd;\n                for (let paraStart = bufStart; paraStart <= bufEnd; paraStart = paraEnd) {\n                    paraEnd = source.substring(0, bufEnd).indexOf(StaticLayout.CHAR_NEW_LINE, paraStart);\n                    if (paraEnd < 0)\n                        paraEnd = bufEnd;\n                    else\n                        paraEnd++;\n                    let firstWidthLineLimit = this.mLineCount + 1;\n                    let firstWidth = outerWidth;\n                    let restWidth = outerWidth;\n                    let chooseHt = null;\n                    if (spanned != null) {\n                        let sp = StaticLayout.getParagraphSpans(spanned, paraStart, paraEnd, LeadingMarginSpan.type);\n                        for (let i = 0; i < sp.length; i++) {\n                            let lms = sp[i];\n                            firstWidth -= sp[i].getLeadingMargin(true);\n                            restWidth -= sp[i].getLeadingMargin(false);\n                            if (LeadingMarginSpan2.isImpl(lms)) {\n                                let lms2 = lms;\n                                let lmsFirstLine = this.getLineForOffset(spanned.getSpanStart(lms2));\n                                firstWidthLineLimit = lmsFirstLine + lms2.getLeadingMarginLineCount();\n                            }\n                        }\n                        chooseHt = StaticLayout.getParagraphSpans(spanned, paraStart, paraEnd, LineHeightSpan.type);\n                        if (chooseHt.length != 0) {\n                            if (chooseHtv == null || chooseHtv.length < chooseHt.length) {\n                                chooseHtv = androidui.util.ArrayCreator.newNumberArray(chooseHt.length);\n                            }\n                            for (let i = 0; i < chooseHt.length; i++) {\n                                let o = spanned.getSpanStart(chooseHt[i]);\n                                if (o < paraStart) {\n                                    chooseHtv[i] = this.getLineTop(this.getLineForOffset(o));\n                                }\n                                else {\n                                    chooseHtv[i] = v;\n                                }\n                            }\n                        }\n                    }\n                    measured.setPara(source, paraStart, paraEnd, textDir);\n                    let chs = measured.mChars;\n                    let widths = measured.mWidths;\n                    let chdirs = measured.mLevels;\n                    let dir = measured.mDir;\n                    let easy = measured.mEasy;\n                    let width = firstWidth;\n                    let w = 0;\n                    let here = paraStart;\n                    let ok = paraStart;\n                    let okWidth = w;\n                    let okAscent = 0, okDescent = 0, okTop = 0, okBottom = 0;\n                    let fit = paraStart;\n                    let fitWidth = w;\n                    let fitAscent = 0, fitDescent = 0, fitTop = 0, fitBottom = 0;\n                    let hasTabOrEmoji = false;\n                    let hasTab = false;\n                    let tabStops = null;\n                    for (let spanStart = paraStart, spanEnd; spanStart < paraEnd; spanStart = spanEnd) {\n                        if (spanned == null) {\n                            spanEnd = paraEnd;\n                            let spanLen = spanEnd - spanStart;\n                            measured.addStyleRun(paint, spanLen, fm);\n                        }\n                        else {\n                            spanEnd = spanned.nextSpanTransition(spanStart, paraEnd, MetricAffectingSpan.type);\n                            let spanLen = spanEnd - spanStart;\n                            let spans = spanned.getSpans(spanStart, spanEnd, MetricAffectingSpan.type);\n                            spans = TextUtils.removeEmptySpans(spans, spanned, MetricAffectingSpan.type);\n                            measured.addStyleRun(paint, spans, spanLen, fm);\n                        }\n                        let fmTop = fm.top;\n                        let fmBottom = fm.bottom;\n                        let fmAscent = fm.ascent;\n                        let fmDescent = fm.descent;\n                        for (let j = spanStart; j < spanEnd; j++) {\n                            let c = chs[j - paraStart];\n                            if (c == StaticLayout.CHAR_NEW_LINE) {\n                            }\n                            else if (c == StaticLayout.CHAR_TAB) {\n                                if (hasTab == false) {\n                                    hasTab = true;\n                                    hasTabOrEmoji = true;\n                                    if (spanned != null) {\n                                        let spans = StaticLayout.getParagraphSpans(spanned, paraStart, paraEnd, TabStopSpan.type);\n                                        if (spans.length > 0) {\n                                            tabStops = new Layout.TabStops(StaticLayout.TAB_INCREMENT, spans);\n                                        }\n                                    }\n                                }\n                                if (tabStops != null) {\n                                    w = tabStops.nextTab(w);\n                                }\n                                else {\n                                    w = StaticLayout.TabStops.nextDefaultStop(w, StaticLayout.TAB_INCREMENT);\n                                }\n                            }\n                            else if (c.codePointAt(0) >= StaticLayout.CHAR_FIRST_HIGH_SURROGATE\n                                && c.codePointAt(0) <= StaticLayout.CHAR_LAST_LOW_SURROGATE && j + 1 < spanEnd) {\n                                let emoji = chs.codePointAt(j - paraStart);\n                                w += widths[j - paraStart];\n                            }\n                            else {\n                                w += widths[j - paraStart];\n                            }\n                            let isSpaceOrTab = c == StaticLayout.CHAR_SPACE || c == StaticLayout.CHAR_TAB || c == StaticLayout.CHAR_ZWSP;\n                            if (w <= width || isSpaceOrTab) {\n                                fitWidth = w;\n                                fit = j + 1;\n                                if (fmTop < fitTop)\n                                    fitTop = fmTop;\n                                if (fmAscent < fitAscent)\n                                    fitAscent = fmAscent;\n                                if (fmDescent > fitDescent)\n                                    fitDescent = fmDescent;\n                                if (fmBottom > fitBottom)\n                                    fitBottom = fmBottom;\n                                let isLineBreak = isSpaceOrTab ||\n                                    ((c == StaticLayout.CHAR_SLASH || c == StaticLayout.CHAR_HYPHEN) && (j + 1 >= spanEnd ||\n                                        !Number.isInteger(Number.parseInt(chs[j + 1 - paraStart])))) ||\n                                    (c.codePointAt(0) >= StaticLayout.CHAR_FIRST_CJK.codePointAt(0) && StaticLayout.isIdeographic(c, true) && j + 1 < spanEnd && StaticLayout.isIdeographic(chs[j + 1 - paraStart], false));\n                                if (isLineBreak) {\n                                    okWidth = w;\n                                    ok = j + 1;\n                                    if (fitTop < okTop)\n                                        okTop = fitTop;\n                                    if (fitAscent < okAscent)\n                                        okAscent = fitAscent;\n                                    if (fitDescent > okDescent)\n                                        okDescent = fitDescent;\n                                    if (fitBottom > okBottom)\n                                        okBottom = fitBottom;\n                                }\n                            }\n                            else {\n                                const moreChars = (j + 1 < spanEnd);\n                                let endPos;\n                                let above, below, top, bottom;\n                                let currentTextWidth;\n                                if (ok != here) {\n                                    endPos = ok;\n                                    above = okAscent;\n                                    below = okDescent;\n                                    top = okTop;\n                                    bottom = okBottom;\n                                    currentTextWidth = okWidth;\n                                }\n                                else if (fit != here) {\n                                    endPos = fit;\n                                    above = fitAscent;\n                                    below = fitDescent;\n                                    top = fitTop;\n                                    bottom = fitBottom;\n                                    currentTextWidth = fitWidth;\n                                }\n                                else {\n                                    endPos = here + 1;\n                                    above = fm.ascent;\n                                    below = fm.descent;\n                                    top = fm.top;\n                                    bottom = fm.bottom;\n                                    currentTextWidth = widths[here - paraStart];\n                                }\n                                v = this.out(source, here, endPos, above, below, top, bottom, v, spacingmult, spacingadd, chooseHt, chooseHtv, fm, hasTabOrEmoji, needMultiply, chdirs, dir, easy, bufEnd, includepad, trackpad, chs, widths, paraStart, ellipsize, ellipsizedWidth, currentTextWidth, paint, moreChars);\n                                here = endPos;\n                                j = here - 1;\n                                ok = fit = here;\n                                w = 0;\n                                fitAscent = fitDescent = fitTop = fitBottom = 0;\n                                okAscent = okDescent = okTop = okBottom = 0;\n                                if (--firstWidthLineLimit <= 0) {\n                                    width = restWidth;\n                                }\n                                if (here < spanStart) {\n                                    measured.setPos(here);\n                                    spanEnd = here;\n                                    break;\n                                }\n                                if (this.mLineCount >= this.mMaximumVisibleLineCount) {\n                                    break;\n                                }\n                            }\n                        }\n                    }\n                    if (paraEnd != here && this.mLineCount < this.mMaximumVisibleLineCount) {\n                        if ((fitTop | fitBottom | fitDescent | fitAscent) == 0) {\n                            paint.getFontMetricsInt(fm);\n                            fitTop = fm.top;\n                            fitBottom = fm.bottom;\n                            fitAscent = fm.ascent;\n                            fitDescent = fm.descent;\n                        }\n                        v = this.out(source, here, paraEnd, fitAscent, fitDescent, fitTop, fitBottom, v, spacingmult, spacingadd, chooseHt, chooseHtv, fm, hasTabOrEmoji, needMultiply, chdirs, dir, easy, bufEnd, includepad, trackpad, chs, widths, paraStart, ellipsize, ellipsizedWidth, w, paint, paraEnd != bufEnd);\n                    }\n                    paraStart = paraEnd;\n                    if (paraEnd == bufEnd)\n                        break;\n                }\n                if ((bufEnd == bufStart || source.charAt(bufEnd - 1) == StaticLayout.CHAR_NEW_LINE) && this.mLineCount < this.mMaximumVisibleLineCount) {\n                    measured.setPara(source, bufStart, bufEnd, textDir);\n                    paint.getFontMetricsInt(fm);\n                    v = this.out(source, bufEnd, bufEnd, fm.ascent, fm.descent, fm.top, fm.bottom, v, spacingmult, spacingadd, null, null, fm, false, needMultiply, measured.mLevels, measured.mDir, measured.mEasy, bufEnd, includepad, trackpad, null, null, bufStart, ellipsize, ellipsizedWidth, 0, paint, false);\n                }\n            }\n            static isIdeographic(c, includeNonStarters) {\n                let code = c.codePointAt(0);\n                if (code >= '⺀'.codePointAt(0) && code <= '⿿'.codePointAt(0)) {\n                    return true;\n                }\n                if (c == '　') {\n                    return true;\n                }\n                if (code >= '぀'.codePointAt(0) && code <= 'ゟ'.codePointAt(0)) {\n                    if (!includeNonStarters) {\n                        switch (c) {\n                            case 'ぁ':\n                            case 'ぃ':\n                            case 'ぅ':\n                            case 'ぇ':\n                            case 'ぉ':\n                            case 'っ':\n                            case 'ゃ':\n                            case 'ゅ':\n                            case 'ょ':\n                            case 'ゎ':\n                            case 'ゕ':\n                            case 'ゖ':\n                            case '゛':\n                            case '゜':\n                            case 'ゝ':\n                            case 'ゞ':\n                                return false;\n                        }\n                    }\n                    return true;\n                }\n                if (code >= '゠'.codePointAt(0) && code <= 'ヿ'.codePointAt(0)) {\n                    if (!includeNonStarters) {\n                        switch (c) {\n                            case '゠':\n                            case 'ァ':\n                            case 'ィ':\n                            case 'ゥ':\n                            case 'ェ':\n                            case 'ォ':\n                            case 'ッ':\n                            case 'ャ':\n                            case 'ュ':\n                            case 'ョ':\n                            case 'ヮ':\n                            case 'ヵ':\n                            case 'ヶ':\n                            case '・':\n                            case 'ー':\n                            case 'ヽ':\n                            case 'ヾ':\n                                return false;\n                        }\n                    }\n                    return true;\n                }\n                if (code >= '㐀'.codePointAt(0) && code <= '䶵'.codePointAt(0)) {\n                    return true;\n                }\n                if (code >= '一'.codePointAt(0) && code <= '龻'.codePointAt(0)) {\n                    return true;\n                }\n                if (code >= '豈'.codePointAt(0) && code <= '龎'.codePointAt(0)) {\n                    return true;\n                }\n                if (code >= 'ꀀ'.codePointAt(0) && code <= '꒏'.codePointAt(0)) {\n                    return true;\n                }\n                if (code >= '꒐'.codePointAt(0) && code <= '꓏'.codePointAt(0)) {\n                    return true;\n                }\n                if (code >= '﹢'.codePointAt(0) && code <= '﹦'.codePointAt(0)) {\n                    return true;\n                }\n                if (code >= '０'.codePointAt(0) && code <= '９'.codePointAt(0)) {\n                    return true;\n                }\n                return false;\n            }\n            out(text, start, end, above, below, top, bottom, v, spacingmult, spacingadd, chooseHt, chooseHtv, fm, hasTabOrEmoji, needMultiply, chdirs, dir, easy, bufEnd, includePad, trackPad, chs, widths, widthStart, ellipsize, ellipsisWidth, textWidth, paint, moreChars) {\n                let j = this.mLineCount;\n                let off = j * this.mColumns;\n                let want = off + this.mColumns + StaticLayout.TOP;\n                let lines = this.mLines;\n                if (want >= lines.length) {\n                    let nlen = (want + 1);\n                    let grow = androidui.util.ArrayCreator.newNumberArray(nlen);\n                    System.arraycopy(lines, 0, grow, 0, lines.length);\n                    this.mLines = grow;\n                    lines = grow;\n                    let grow2 = new Array(nlen);\n                    System.arraycopy(this.mLineDirections, 0, grow2, 0, this.mLineDirections.length);\n                    this.mLineDirections = grow2;\n                }\n                if (chooseHt != null) {\n                    fm.ascent = above;\n                    fm.descent = below;\n                    fm.top = top;\n                    fm.bottom = bottom;\n                    for (let i = 0; i < chooseHt.length; i++) {\n                        chooseHt[i].chooseHeight(text, start, end, chooseHtv[i], v, fm, paint);\n                    }\n                    above = fm.ascent;\n                    below = fm.descent;\n                    top = fm.top;\n                    bottom = fm.bottom;\n                }\n                if (j == 0) {\n                    if (trackPad) {\n                        this.mTopPadding = top - above;\n                    }\n                    if (includePad) {\n                        above = top;\n                    }\n                }\n                if (end == bufEnd) {\n                    if (trackPad) {\n                        this.mBottomPadding = bottom - below;\n                    }\n                    if (includePad) {\n                        below = bottom;\n                    }\n                }\n                let extra;\n                if (needMultiply) {\n                    let ex = (below - above) * (spacingmult - 1) + spacingadd;\n                    if (ex >= 0) {\n                        extra = Math.floor((ex + StaticLayout.EXTRA_ROUNDING));\n                    }\n                    else {\n                        extra = -Math.floor((-ex + StaticLayout.EXTRA_ROUNDING));\n                    }\n                }\n                else {\n                    extra = 0;\n                }\n                lines[off + StaticLayout.START] = start;\n                lines[off + StaticLayout.TOP] = v;\n                lines[off + StaticLayout.DESCENT] = below + extra;\n                v += (below - above) + extra;\n                lines[off + this.mColumns + StaticLayout.START] = end;\n                lines[off + this.mColumns + StaticLayout.TOP] = v;\n                if (hasTabOrEmoji)\n                    lines[off + StaticLayout.TAB] |= StaticLayout.TAB_MASK;\n                lines[off + StaticLayout.DIR] |= dir << StaticLayout.DIR_SHIFT;\n                let linedirs = StaticLayout.DIRS_ALL_LEFT_TO_RIGHT;\n                this.mLineDirections[j] = linedirs;\n                if (ellipsize != null) {\n                    let firstLine = (j == 0);\n                    let currentLineIsTheLastVisibleOne = (j + 1 == this.mMaximumVisibleLineCount);\n                    let forceEllipsis = moreChars && (this.mLineCount + 1 == this.mMaximumVisibleLineCount);\n                    let doEllipsis = (((this.mMaximumVisibleLineCount == 1 && moreChars) || (firstLine && !moreChars)) && ellipsize != TextUtils.TruncateAt.MARQUEE) || (!firstLine && (currentLineIsTheLastVisibleOne || !moreChars) && ellipsize == TextUtils.TruncateAt.END);\n                    if (doEllipsis) {\n                        this.calculateEllipsis(start, end, widths, widthStart, ellipsisWidth, ellipsize, j, textWidth, paint, forceEllipsis);\n                    }\n                }\n                this.mLineCount++;\n                return v;\n            }\n            calculateEllipsis(lineStart, lineEnd, widths, widthStart, avail, where, line, textWidth, paint, forceEllipsis) {\n                if (textWidth <= avail && !forceEllipsis) {\n                    this.mLines[this.mColumns * line + StaticLayout.ELLIPSIS_START] = 0;\n                    this.mLines[this.mColumns * line + StaticLayout.ELLIPSIS_COUNT] = 0;\n                    return;\n                }\n                let ellipsisWidth = paint.measureText((where == TextUtils.TruncateAt.END_SMALL) ? StaticLayout.ELLIPSIS_TWO_DOTS[0] : StaticLayout.ELLIPSIS_NORMAL[0], 0, 1);\n                let ellipsisStart = 0;\n                let ellipsisCount = 0;\n                let len = lineEnd - lineStart;\n                if (where == TextUtils.TruncateAt.START) {\n                    if (this.mMaximumVisibleLineCount == 1) {\n                        let sum = 0;\n                        let i;\n                        for (i = len; i >= 0; i--) {\n                            let w = widths[i - 1 + lineStart - widthStart];\n                            if (w + sum + ellipsisWidth > avail) {\n                                break;\n                            }\n                            sum += w;\n                        }\n                        ellipsisStart = 0;\n                        ellipsisCount = i;\n                    }\n                    else {\n                    }\n                }\n                else if (where == TextUtils.TruncateAt.END || where == TextUtils.TruncateAt.MARQUEE || where == TextUtils.TruncateAt.END_SMALL) {\n                    let sum = 0;\n                    let i;\n                    for (i = 0; i < len; i++) {\n                        let w = widths[i + lineStart - widthStart];\n                        if (w + sum + ellipsisWidth > avail) {\n                            break;\n                        }\n                        sum += w;\n                    }\n                    ellipsisStart = i;\n                    ellipsisCount = len - i;\n                    if (forceEllipsis && ellipsisCount == 0 && len > 0) {\n                        ellipsisStart = len - 1;\n                        ellipsisCount = 1;\n                    }\n                }\n                else {\n                    if (this.mMaximumVisibleLineCount == 1) {\n                        let lsum = 0, rsum = 0;\n                        let left = 0, right = len;\n                        let ravail = (avail - ellipsisWidth) / 2;\n                        for (right = len; right >= 0; right--) {\n                            let w = widths[right - 1 + lineStart - widthStart];\n                            if (w + rsum > ravail) {\n                                break;\n                            }\n                            rsum += w;\n                        }\n                        let lavail = avail - ellipsisWidth - rsum;\n                        for (left = 0; left < right; left++) {\n                            let w = widths[left + lineStart - widthStart];\n                            if (w + lsum > lavail) {\n                                break;\n                            }\n                            lsum += w;\n                        }\n                        ellipsisStart = left;\n                        ellipsisCount = right - left;\n                    }\n                    else {\n                    }\n                }\n                this.mLines[this.mColumns * line + StaticLayout.ELLIPSIS_START] = ellipsisStart;\n                this.mLines[this.mColumns * line + StaticLayout.ELLIPSIS_COUNT] = ellipsisCount;\n            }\n            getLineForVertical(vertical) {\n                let high = this.mLineCount;\n                let low = -1;\n                let guess;\n                let lines = this.mLines;\n                while (high - low > 1) {\n                    guess = (high + low) >> 1;\n                    if (lines[this.mColumns * guess + StaticLayout.TOP] > vertical) {\n                        high = guess;\n                    }\n                    else {\n                        low = guess;\n                    }\n                }\n                if (low < 0) {\n                    return 0;\n                }\n                else {\n                    return low;\n                }\n            }\n            getLineCount() {\n                return this.mLineCount;\n            }\n            getLineTop(line) {\n                let top = this.mLines[this.mColumns * line + StaticLayout.TOP];\n                if (this.mMaximumVisibleLineCount > 0 && line >= this.mMaximumVisibleLineCount && line != this.mLineCount) {\n                    top += this.getBottomPadding();\n                }\n                return top;\n            }\n            getLineDescent(line) {\n                let descent = this.mLines[this.mColumns * line + StaticLayout.DESCENT];\n                if (this.mMaximumVisibleLineCount > 0 && line >= this.mMaximumVisibleLineCount - 1 && line != this.mLineCount) {\n                    descent += this.getBottomPadding();\n                }\n                return descent;\n            }\n            getLineStart(line) {\n                return this.mLines[this.mColumns * line + StaticLayout.START] & StaticLayout.START_MASK;\n            }\n            getParagraphDirection(line) {\n                return this.mLines[this.mColumns * line + StaticLayout.DIR] >> StaticLayout.DIR_SHIFT;\n            }\n            getLineContainsTab(line) {\n                return (this.mLines[this.mColumns * line + StaticLayout.TAB] & StaticLayout.TAB_MASK) != 0;\n            }\n            getLineDirections(line) {\n                return this.mLineDirections[line];\n            }\n            getTopPadding() {\n                return this.mTopPadding;\n            }\n            getBottomPadding() {\n                return this.mBottomPadding;\n            }\n            getEllipsisCount(line) {\n                if (this.mColumns < StaticLayout.COLUMNS_ELLIPSIZE) {\n                    return 0;\n                }\n                return this.mLines[this.mColumns * line + StaticLayout.ELLIPSIS_COUNT];\n            }\n            getEllipsisStart(line) {\n                if (this.mColumns < StaticLayout.COLUMNS_ELLIPSIZE) {\n                    return 0;\n                }\n                return this.mLines[this.mColumns * line + StaticLayout.ELLIPSIS_START];\n            }\n            getEllipsizedWidth() {\n                return this.mEllipsizedWidth;\n            }\n            prepare() {\n                this.mMeasured = MeasuredText.obtain();\n            }\n            finish() {\n                this.mMeasured = MeasuredText.recycle(this.mMeasured);\n            }\n        }\n        StaticLayout.TAG = \"StaticLayout\";\n        StaticLayout.COLUMNS_NORMAL = 3;\n        StaticLayout.COLUMNS_ELLIPSIZE = 5;\n        StaticLayout.START = 0;\n        StaticLayout.DIR = StaticLayout.START;\n        StaticLayout.TAB = StaticLayout.START;\n        StaticLayout.TOP = 1;\n        StaticLayout.DESCENT = 2;\n        StaticLayout.ELLIPSIS_START = 3;\n        StaticLayout.ELLIPSIS_COUNT = 4;\n        StaticLayout.START_MASK = 0x1FFFFFFF;\n        StaticLayout.DIR_SHIFT = 30;\n        StaticLayout.TAB_MASK = 0x20000000;\n        StaticLayout.CHAR_FIRST_CJK = '⺀';\n        StaticLayout.CHAR_NEW_LINE = '\\n';\n        StaticLayout.CHAR_TAB = '\\t';\n        StaticLayout.CHAR_SPACE = ' ';\n        StaticLayout.CHAR_SLASH = '/';\n        StaticLayout.CHAR_HYPHEN = '-';\n        StaticLayout.CHAR_ZWSP = '​';\n        StaticLayout.EXTRA_ROUNDING = 0.5;\n        StaticLayout.CHAR_FIRST_HIGH_SURROGATE = 0xD800;\n        StaticLayout.CHAR_LAST_LOW_SURROGATE = 0xDFFF;\n        text_10.StaticLayout = StaticLayout;\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text_11) {\n        var Paint = android.graphics.Paint;\n        var System = java.lang.System;\n        var Layout = android.text.Layout;\n        var PackedIntVector = android.text.PackedIntVector;\n        var PackedObjectVector = android.text.PackedObjectVector;\n        var Spanned = android.text.Spanned;\n        var StaticLayout = android.text.StaticLayout;\n        class DynamicLayout extends Layout {\n            constructor(base, display, paint, width, align, textDir, spacingmult, spacingadd, includepad, ellipsize = null, ellipsizedWidth = 0) {\n                super((ellipsize == null) ? display : (Spanned.isImplements(display)) ? new Layout.SpannedEllipsizer(display) : new Layout.Ellipsizer(display), paint, width, align, textDir, spacingmult, spacingadd);\n                this.mEllipsizedWidth = 0;\n                this.mNumberOfBlocks = 0;\n                this.mIndexFirstChangedBlock = 0;\n                this.mTopPadding = 0;\n                this.mBottomPadding = 0;\n                this.mBase = base;\n                this.mDisplay = display;\n                if (ellipsize != null) {\n                    this.mInts = new PackedIntVector(DynamicLayout.COLUMNS_ELLIPSIZE);\n                    this.mEllipsizedWidth = ellipsizedWidth;\n                    this.mEllipsizeAt = ellipsize;\n                }\n                else {\n                    this.mInts = new PackedIntVector(DynamicLayout.COLUMNS_NORMAL);\n                    this.mEllipsizedWidth = width;\n                    this.mEllipsizeAt = null;\n                }\n                this.mObjects = new PackedObjectVector(1);\n                this.mIncludePad = includepad;\n                if (ellipsize != null) {\n                    let e = this.getText();\n                    e.mLayout = this;\n                    e.mWidth = ellipsizedWidth;\n                    e.mMethod = ellipsize;\n                    this.mEllipsize = true;\n                }\n                let start;\n                if (ellipsize != null) {\n                    start = androidui.util.ArrayCreator.newNumberArray(DynamicLayout.COLUMNS_ELLIPSIZE);\n                    start[DynamicLayout.ELLIPSIS_START] = DynamicLayout.ELLIPSIS_UNDEFINED;\n                }\n                else {\n                    start = androidui.util.ArrayCreator.newNumberArray(DynamicLayout.COLUMNS_NORMAL);\n                }\n                let dirs = [DynamicLayout.DIRS_ALL_LEFT_TO_RIGHT];\n                let fm = new Paint.FontMetricsInt();\n                paint.getFontMetricsInt(fm);\n                let asc = fm.ascent;\n                let desc = fm.descent;\n                start[DynamicLayout.DIR] = DynamicLayout.DIR_LEFT_TO_RIGHT << DynamicLayout.DIR_SHIFT;\n                start[DynamicLayout.TOP] = 0;\n                start[DynamicLayout.DESCENT] = desc;\n                this.mInts.insertAt(0, start);\n                start[DynamicLayout.TOP] = desc - asc;\n                this.mInts.insertAt(1, start);\n                this.mObjects.insertAt(0, dirs);\n                this.reflow(base, 0, 0, base.length);\n            }\n            reflow(s, where, before, after) {\n                if (s != this.mBase)\n                    return;\n                let text = this.mDisplay;\n                let len = text.length;\n                let find = text.lastIndexOf('\\n', where - 1);\n                if (find < 0)\n                    find = 0;\n                else\n                    find = find + 1;\n                {\n                    let diff = where - find;\n                    before += diff;\n                    after += diff;\n                    where -= diff;\n                }\n                let look = text.indexOf('\\n', where + after);\n                if (look < 0)\n                    look = len;\n                else\n                    look++;\n                let change = look - (where + after);\n                before += change;\n                after += change;\n                let startline = this.getLineForOffset(where);\n                let startv = this.getLineTop(startline);\n                let endline = this.getLineForOffset(where + before);\n                if (where + after == len)\n                    endline = this.getLineCount();\n                let endv = this.getLineTop(endline);\n                let islast = (endline == this.getLineCount());\n                let reflowed;\n                {\n                    reflowed = DynamicLayout.sStaticLayout;\n                    DynamicLayout.sStaticLayout = null;\n                }\n                if (reflowed == null) {\n                    reflowed = new StaticLayout(null, 0, 0, null, 0, null, null, 0, 1, true);\n                }\n                else {\n                    reflowed.prepare();\n                }\n                reflowed.generate(text, where, where + after, this.getPaint(), this.getWidth(), this.getTextDirectionHeuristic(), this.getSpacingMultiplier(), this.getSpacingAdd(), false, true, this.mEllipsizedWidth, this.mEllipsizeAt);\n                let n = reflowed.getLineCount();\n                if (where + after != len && reflowed.getLineStart(n - 1) == where + after)\n                    n--;\n                this.mInts.deleteAt(startline, endline - startline);\n                this.mObjects.deleteAt(startline, endline - startline);\n                let ht = reflowed.getLineTop(n);\n                let toppad = 0, botpad = 0;\n                if (this.mIncludePad && startline == 0) {\n                    toppad = reflowed.getTopPadding();\n                    this.mTopPadding = toppad;\n                    ht -= toppad;\n                }\n                if (this.mIncludePad && islast) {\n                    botpad = reflowed.getBottomPadding();\n                    this.mBottomPadding = botpad;\n                    ht += botpad;\n                }\n                this.mInts.adjustValuesBelow(startline, DynamicLayout.START, after - before);\n                this.mInts.adjustValuesBelow(startline, DynamicLayout.TOP, startv - endv + ht);\n                let ints;\n                if (this.mEllipsize) {\n                    ints = androidui.util.ArrayCreator.newNumberArray(DynamicLayout.COLUMNS_ELLIPSIZE);\n                    ints[DynamicLayout.ELLIPSIS_START] = DynamicLayout.ELLIPSIS_UNDEFINED;\n                }\n                else {\n                    ints = androidui.util.ArrayCreator.newNumberArray(DynamicLayout.COLUMNS_NORMAL);\n                }\n                let objects = new Array(1);\n                for (let i = 0; i < n; i++) {\n                    ints[DynamicLayout.START] = reflowed.getLineStart(i) | (reflowed.getParagraphDirection(i) << DynamicLayout.DIR_SHIFT) | (reflowed.getLineContainsTab(i) ? DynamicLayout.TAB_MASK : 0);\n                    let top = reflowed.getLineTop(i) + startv;\n                    if (i > 0)\n                        top -= toppad;\n                    ints[DynamicLayout.TOP] = top;\n                    let desc = reflowed.getLineDescent(i);\n                    if (i == n - 1)\n                        desc += botpad;\n                    ints[DynamicLayout.DESCENT] = desc;\n                    objects[0] = reflowed.getLineDirections(i);\n                    if (this.mEllipsize) {\n                        ints[DynamicLayout.ELLIPSIS_START] = reflowed.getEllipsisStart(i);\n                        ints[DynamicLayout.ELLIPSIS_COUNT] = reflowed.getEllipsisCount(i);\n                    }\n                    this.mInts.insertAt(startline + i, ints);\n                    this.mObjects.insertAt(startline + i, objects);\n                }\n                this.updateBlocks(startline, endline - 1, n);\n                {\n                    DynamicLayout.sStaticLayout = reflowed;\n                    reflowed.finish();\n                }\n            }\n            createBlocks() {\n                let offset = DynamicLayout.BLOCK_MINIMUM_CHARACTER_LENGTH;\n                this.mNumberOfBlocks = 0;\n                const text = this.mDisplay;\n                while (true) {\n                    offset = text.indexOf('\\n', offset);\n                    if (offset < 0) {\n                        this.addBlockAtOffset(text.length);\n                        break;\n                    }\n                    else {\n                        this.addBlockAtOffset(offset);\n                        offset += DynamicLayout.BLOCK_MINIMUM_CHARACTER_LENGTH;\n                    }\n                }\n                this.mBlockIndices = androidui.util.ArrayCreator.newNumberArray(this.mBlockEndLines.length);\n                for (let i = 0; i < this.mBlockEndLines.length; i++) {\n                    this.mBlockIndices[i] = DynamicLayout.INVALID_BLOCK_INDEX;\n                }\n            }\n            addBlockAtOffset(offset) {\n                const line = this.getLineForOffset(offset);\n                if (this.mBlockEndLines == null) {\n                    this.mBlockEndLines = androidui.util.ArrayCreator.newNumberArray((1));\n                    this.mBlockEndLines[this.mNumberOfBlocks] = line;\n                    this.mNumberOfBlocks++;\n                    return;\n                }\n                const previousBlockEndLine = this.mBlockEndLines[this.mNumberOfBlocks - 1];\n                if (line > previousBlockEndLine) {\n                    if (this.mNumberOfBlocks == this.mBlockEndLines.length) {\n                        let blockEndLines = androidui.util.ArrayCreator.newNumberArray((this.mNumberOfBlocks + 1));\n                        System.arraycopy(this.mBlockEndLines, 0, blockEndLines, 0, this.mNumberOfBlocks);\n                        this.mBlockEndLines = blockEndLines;\n                    }\n                    this.mBlockEndLines[this.mNumberOfBlocks] = line;\n                    this.mNumberOfBlocks++;\n                }\n            }\n            updateBlocks(startLine, endLine, newLineCount) {\n                if (this.mBlockEndLines == null) {\n                    this.createBlocks();\n                    return;\n                }\n                let firstBlock = -1;\n                let lastBlock = -1;\n                for (let i = 0; i < this.mNumberOfBlocks; i++) {\n                    if (this.mBlockEndLines[i] >= startLine) {\n                        firstBlock = i;\n                        break;\n                    }\n                }\n                for (let i = firstBlock; i < this.mNumberOfBlocks; i++) {\n                    if (this.mBlockEndLines[i] >= endLine) {\n                        lastBlock = i;\n                        break;\n                    }\n                }\n                const lastBlockEndLine = this.mBlockEndLines[lastBlock];\n                let createBlockBefore = startLine > (firstBlock == 0 ? 0 : this.mBlockEndLines[firstBlock - 1] + 1);\n                let createBlock = newLineCount > 0;\n                let createBlockAfter = endLine < this.mBlockEndLines[lastBlock];\n                let numAddedBlocks = 0;\n                if (createBlockBefore)\n                    numAddedBlocks++;\n                if (createBlock)\n                    numAddedBlocks++;\n                if (createBlockAfter)\n                    numAddedBlocks++;\n                const numRemovedBlocks = lastBlock - firstBlock + 1;\n                const newNumberOfBlocks = this.mNumberOfBlocks + numAddedBlocks - numRemovedBlocks;\n                if (newNumberOfBlocks == 0) {\n                    this.mBlockEndLines[0] = 0;\n                    this.mBlockIndices[0] = DynamicLayout.INVALID_BLOCK_INDEX;\n                    this.mNumberOfBlocks = 1;\n                    return;\n                }\n                if (newNumberOfBlocks > this.mBlockEndLines.length) {\n                    const newSize = (newNumberOfBlocks);\n                    let blockEndLines = androidui.util.ArrayCreator.newNumberArray(newSize);\n                    let blockIndices = androidui.util.ArrayCreator.newNumberArray(newSize);\n                    System.arraycopy(this.mBlockEndLines, 0, blockEndLines, 0, firstBlock);\n                    System.arraycopy(this.mBlockIndices, 0, blockIndices, 0, firstBlock);\n                    System.arraycopy(this.mBlockEndLines, lastBlock + 1, blockEndLines, firstBlock + numAddedBlocks, this.mNumberOfBlocks - lastBlock - 1);\n                    System.arraycopy(this.mBlockIndices, lastBlock + 1, blockIndices, firstBlock + numAddedBlocks, this.mNumberOfBlocks - lastBlock - 1);\n                    this.mBlockEndLines = blockEndLines;\n                    this.mBlockIndices = blockIndices;\n                }\n                else {\n                    System.arraycopy(this.mBlockEndLines, lastBlock + 1, this.mBlockEndLines, firstBlock + numAddedBlocks, this.mNumberOfBlocks - lastBlock - 1);\n                    System.arraycopy(this.mBlockIndices, lastBlock + 1, this.mBlockIndices, firstBlock + numAddedBlocks, this.mNumberOfBlocks - lastBlock - 1);\n                }\n                this.mNumberOfBlocks = newNumberOfBlocks;\n                let newFirstChangedBlock;\n                const deltaLines = newLineCount - (endLine - startLine + 1);\n                if (deltaLines != 0) {\n                    newFirstChangedBlock = firstBlock + numAddedBlocks;\n                    for (let i = newFirstChangedBlock; i < this.mNumberOfBlocks; i++) {\n                        this.mBlockEndLines[i] += deltaLines;\n                    }\n                }\n                else {\n                    newFirstChangedBlock = this.mNumberOfBlocks;\n                }\n                this.mIndexFirstChangedBlock = Math.min(this.mIndexFirstChangedBlock, newFirstChangedBlock);\n                let blockIndex = firstBlock;\n                if (createBlockBefore) {\n                    this.mBlockEndLines[blockIndex] = startLine - 1;\n                    this.mBlockIndices[blockIndex] = DynamicLayout.INVALID_BLOCK_INDEX;\n                    blockIndex++;\n                }\n                if (createBlock) {\n                    this.mBlockEndLines[blockIndex] = startLine + newLineCount - 1;\n                    this.mBlockIndices[blockIndex] = DynamicLayout.INVALID_BLOCK_INDEX;\n                    blockIndex++;\n                }\n                if (createBlockAfter) {\n                    this.mBlockEndLines[blockIndex] = lastBlockEndLine + deltaLines;\n                    this.mBlockIndices[blockIndex] = DynamicLayout.INVALID_BLOCK_INDEX;\n                }\n            }\n            setBlocksDataForTest(blockEndLines, blockIndices, numberOfBlocks) {\n                this.mBlockEndLines = androidui.util.ArrayCreator.newNumberArray(blockEndLines.length);\n                this.mBlockIndices = androidui.util.ArrayCreator.newNumberArray(blockIndices.length);\n                System.arraycopy(blockEndLines, 0, this.mBlockEndLines, 0, blockEndLines.length);\n                System.arraycopy(blockIndices, 0, this.mBlockIndices, 0, blockIndices.length);\n                this.mNumberOfBlocks = numberOfBlocks;\n            }\n            getBlockEndLines() {\n                return this.mBlockEndLines;\n            }\n            getBlockIndices() {\n                return this.mBlockIndices;\n            }\n            getNumberOfBlocks() {\n                return this.mNumberOfBlocks;\n            }\n            getIndexFirstChangedBlock() {\n                return this.mIndexFirstChangedBlock;\n            }\n            setIndexFirstChangedBlock(i) {\n                this.mIndexFirstChangedBlock = i;\n            }\n            getLineCount() {\n                return this.mInts.size() - 1;\n            }\n            getLineTop(line) {\n                return this.mInts.getValue(line, DynamicLayout.TOP);\n            }\n            getLineDescent(line) {\n                return this.mInts.getValue(line, DynamicLayout.DESCENT);\n            }\n            getLineStart(line) {\n                return this.mInts.getValue(line, DynamicLayout.START) & DynamicLayout.START_MASK;\n            }\n            getLineContainsTab(line) {\n                return (this.mInts.getValue(line, DynamicLayout.TAB) & DynamicLayout.TAB_MASK) != 0;\n            }\n            getParagraphDirection(line) {\n                return this.mInts.getValue(line, DynamicLayout.DIR) >> DynamicLayout.DIR_SHIFT;\n            }\n            getLineDirections(line) {\n                return this.mObjects.getValue(line, 0);\n            }\n            getTopPadding() {\n                return this.mTopPadding;\n            }\n            getBottomPadding() {\n                return this.mBottomPadding;\n            }\n            getEllipsizedWidth() {\n                return this.mEllipsizedWidth;\n            }\n            getEllipsisStart(line) {\n                if (this.mEllipsizeAt == null) {\n                    return 0;\n                }\n                return this.mInts.getValue(line, DynamicLayout.ELLIPSIS_START);\n            }\n            getEllipsisCount(line) {\n                if (this.mEllipsizeAt == null) {\n                    return 0;\n                }\n                return this.mInts.getValue(line, DynamicLayout.ELLIPSIS_COUNT);\n            }\n        }\n        DynamicLayout.PRIORITY = 128;\n        DynamicLayout.BLOCK_MINIMUM_CHARACTER_LENGTH = 400;\n        DynamicLayout.INVALID_BLOCK_INDEX = -1;\n        DynamicLayout.sStaticLayout = new StaticLayout(null, 0, 0, null, 0, null, null, 1, 0, true);\n        DynamicLayout.sLock = new Array(0);\n        DynamicLayout.START = 0;\n        DynamicLayout.DIR = DynamicLayout.START;\n        DynamicLayout.TAB = DynamicLayout.START;\n        DynamicLayout.TOP = 1;\n        DynamicLayout.DESCENT = 2;\n        DynamicLayout.COLUMNS_NORMAL = 3;\n        DynamicLayout.ELLIPSIS_START = 3;\n        DynamicLayout.ELLIPSIS_COUNT = 4;\n        DynamicLayout.COLUMNS_ELLIPSIZE = 5;\n        DynamicLayout.START_MASK = 0x1FFFFFFF;\n        DynamicLayout.DIR_SHIFT = 30;\n        DynamicLayout.TAB_MASK = 0x20000000;\n        DynamicLayout.ELLIPSIS_UNDEFINED = 0x80000000;\n        text_11.DynamicLayout = DynamicLayout;\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        var method;\n        (function (method) {\n            var TransformationMethod;\n            (function (TransformationMethod) {\n                function isImpl(obj) {\n                    return obj && obj['getTransformation'] && obj['onFocusChanged'];\n                }\n                TransformationMethod.isImpl = isImpl;\n            })(TransformationMethod = method.TransformationMethod || (method.TransformationMethod = {}));\n        })(method = text.method || (text.method = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        var method;\n        (function (method) {\n            var TransformationMethod = android.text.method.TransformationMethod;\n            var TransformationMethod2;\n            (function (TransformationMethod2) {\n                function isImpl(obj) {\n                    return TransformationMethod.isImpl(obj) && obj['setLengthChangesAllowed'];\n                }\n                TransformationMethod2.isImpl = isImpl;\n            })(TransformationMethod2 = method.TransformationMethod2 || (method.TransformationMethod2 = {}));\n        })(method = text.method || (text.method = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        var method;\n        (function (method) {\n            var Log = android.util.Log;\n            class AllCapsTransformationMethod {\n                constructor(context) {\n                }\n                getTransformation(source, view) {\n                    if (this.mEnabled) {\n                        return source != null ? source.toLocaleUpperCase() : null;\n                    }\n                    Log.w(AllCapsTransformationMethod.TAG, \"Caller did not enable length changes; not transforming text\");\n                    return source;\n                }\n                onFocusChanged(view, sourceText, focused, direction, previouslyFocusedRect) {\n                }\n                setLengthChangesAllowed(allowLengthChanges) {\n                    this.mEnabled = allowLengthChanges;\n                }\n            }\n            AllCapsTransformationMethod.TAG = \"AllCapsTransformationMethod\";\n            method.AllCapsTransformationMethod = AllCapsTransformationMethod;\n        })(method = text.method || (text.method = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        var method;\n        (function (method) {\n            class ReplacementTransformationMethod {\n                getTransformation(source, v) {\n                    let original = this.getOriginal();\n                    let replacement = this.getReplacement();\n                    let doNothing = true;\n                    let n = original.length;\n                    for (let i = 0; i < n; i++) {\n                        if (source.indexOf(original[i]) >= 0) {\n                            doNothing = false;\n                            break;\n                        }\n                    }\n                    if (doNothing) {\n                        return source;\n                    }\n                    return new ReplacementTransformationMethod.ReplacementCharSequence(source, original, replacement).toString();\n                }\n                onFocusChanged(view, sourceText, focused, direction, previouslyFocusedRect) {\n                }\n            }\n            method.ReplacementTransformationMethod = ReplacementTransformationMethod;\n            (function (ReplacementTransformationMethod) {\n                class ReplacementCharSequence extends String {\n                    constructor(source, original, replacement) {\n                        super(source);\n                        this.mSource = source;\n                        this.mOriginal = original;\n                        this.mReplacement = replacement;\n                    }\n                    charAt(i) {\n                        let c = this.mSource.charAt(i);\n                        let n = this.mOriginal.length;\n                        for (let j = 0; j < n; j++) {\n                            if (c == this.mOriginal[j]) {\n                                c = this.mReplacement[j];\n                            }\n                        }\n                        return c;\n                    }\n                    toString() {\n                        return this.startReplace(0, this.length);\n                    }\n                    substr(from, length) {\n                        return this.startReplace(from, from + length);\n                    }\n                    substring(start, end) {\n                        return this.startReplace(start, end);\n                    }\n                    startReplace(start, end) {\n                        let dest = this.mSource.substring(start, end).split('');\n                        let offend = end - start;\n                        let n = this.mOriginal.length;\n                        for (let i = 0; i < offend; i++) {\n                            let c = dest[i];\n                            for (let j = 0; j < n; j++) {\n                                if (c == this.mOriginal[j]) {\n                                    dest[i] = this.mReplacement[j];\n                                }\n                            }\n                        }\n                        return dest.join('');\n                    }\n                }\n                ReplacementTransformationMethod.ReplacementCharSequence = ReplacementCharSequence;\n            })(ReplacementTransformationMethod = method.ReplacementTransformationMethod || (method.ReplacementTransformationMethod = {}));\n        })(method = text.method || (text.method = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        var method;\n        (function (method) {\n            var ReplacementTransformationMethod = android.text.method.ReplacementTransformationMethod;\n            class SingleLineTransformationMethod extends ReplacementTransformationMethod {\n                getOriginal() {\n                    return SingleLineTransformationMethod.ORIGINAL;\n                }\n                getReplacement() {\n                    return SingleLineTransformationMethod.REPLACEMENT;\n                }\n                static getInstance() {\n                    if (SingleLineTransformationMethod.sInstance != null)\n                        return SingleLineTransformationMethod.sInstance;\n                    SingleLineTransformationMethod.sInstance = new SingleLineTransformationMethod();\n                    return SingleLineTransformationMethod.sInstance;\n                }\n            }\n            SingleLineTransformationMethod.ORIGINAL = ['\\n', '\\r'];\n            SingleLineTransformationMethod.REPLACEMENT = [' ', '﻿'];\n            method.SingleLineTransformationMethod = SingleLineTransformationMethod;\n        })(method = text.method || (text.method = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar androidui;\n(function (androidui) {\n    var util;\n    (function (util) {\n        class NumberChecker {\n            static warnNotNumber(...n) {\n                try {\n                    this.assetNotNumber(...n);\n                }\n                catch (e) {\n                    console.error(e);\n                    return true;\n                }\n                return false;\n            }\n            static assetNotNumber(...ns) {\n                if (!this.checkIsNumber()) {\n                    throw Error('assetNotNumber : ' + ns);\n                }\n            }\n            static checkIsNumber(...ns) {\n                if (ns == null)\n                    return false;\n                for (let n of ns) {\n                    if (n == null || Number.isNaN(n))\n                        return false;\n                }\n                return true;\n            }\n        }\n        util.NumberChecker = NumberChecker;\n    })(util = androidui.util || (androidui.util = {}));\n})(androidui || (androidui = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var ViewConfiguration = android.view.ViewConfiguration;\n        var Resources = android.content.res.Resources;\n        var SystemClock = android.os.SystemClock;\n        var Log = android.util.Log;\n        var NumberChecker = androidui.util.NumberChecker;\n        class OverScroller {\n            constructor(interpolator, flywheel = true) {\n                this.mMode = 0;\n                this.mFlywheel = true;\n                this.mInterpolator = interpolator;\n                this.mFlywheel = flywheel;\n                this.mScrollerX = new SplineOverScroller();\n                this.mScrollerY = new SplineOverScroller();\n            }\n            setInterpolator(interpolator) {\n                this.mInterpolator = interpolator;\n            }\n            setFriction(friction) {\n                NumberChecker.warnNotNumber(friction);\n                this.mScrollerX.setFriction(friction);\n                this.mScrollerY.setFriction(friction);\n            }\n            isFinished() {\n                return this.mScrollerX.mFinished && this.mScrollerY.mFinished;\n            }\n            forceFinished(finished) {\n                this.mScrollerX.mFinished = this.mScrollerY.mFinished = finished;\n            }\n            getCurrX() {\n                return this.mScrollerX.mCurrentPosition;\n            }\n            getCurrY() {\n                return this.mScrollerY.mCurrentPosition;\n            }\n            getCurrVelocity() {\n                let squaredNorm = this.mScrollerX.mCurrVelocity * this.mScrollerX.mCurrVelocity;\n                squaredNorm += this.mScrollerY.mCurrVelocity * this.mScrollerY.mCurrVelocity;\n                return Math.sqrt(squaredNorm);\n            }\n            getStartX() {\n                return this.mScrollerX.mStart;\n            }\n            getStartY() {\n                return this.mScrollerY.mStart;\n            }\n            getFinalX() {\n                return this.mScrollerX.mFinal;\n            }\n            getFinalY() {\n                return this.mScrollerY.mFinal;\n            }\n            getDuration() {\n                return Math.max(this.mScrollerX.mDuration, this.mScrollerY.mDuration);\n            }\n            computeScrollOffset() {\n                if (this.isFinished()) {\n                    return false;\n                }\n                switch (this.mMode) {\n                    case OverScroller.SCROLL_MODE:\n                        let time = SystemClock.uptimeMillis();\n                        const elapsedTime = time - this.mScrollerX.mStartTime;\n                        const duration = this.mScrollerX.mDuration;\n                        if (elapsedTime < duration) {\n                            let q = (elapsedTime) / duration;\n                            if (this.mInterpolator == null) {\n                                q = Scroller_viscousFluid(q);\n                            }\n                            else {\n                                q = this.mInterpolator.getInterpolation(q);\n                            }\n                            this.mScrollerX.updateScroll(q);\n                            this.mScrollerY.updateScroll(q);\n                        }\n                        else {\n                            this.abortAnimation();\n                        }\n                        break;\n                    case OverScroller.FLING_MODE:\n                        if (!this.mScrollerX.mFinished) {\n                            if (!this.mScrollerX.update()) {\n                                if (!this.mScrollerX.continueWhenFinished()) {\n                                    this.mScrollerX.finish();\n                                }\n                            }\n                        }\n                        if (!this.mScrollerY.mFinished) {\n                            if (!this.mScrollerY.update()) {\n                                if (!this.mScrollerY.continueWhenFinished()) {\n                                    this.mScrollerY.finish();\n                                }\n                            }\n                        }\n                        break;\n                }\n                return true;\n            }\n            startScroll(startX, startY, dx, dy, duration = OverScroller.DEFAULT_DURATION) {\n                NumberChecker.warnNotNumber(startX, startY, dx, dy, duration);\n                this.mMode = OverScroller.SCROLL_MODE;\n                this.mScrollerX.startScroll(startX, dx, duration);\n                this.mScrollerY.startScroll(startY, dy, duration);\n            }\n            springBack(startX, startY, minX, maxX, minY, maxY) {\n                NumberChecker.warnNotNumber(startX, startY, minX, maxX, minY, maxY);\n                this.mMode = OverScroller.FLING_MODE;\n                const spingbackX = this.mScrollerX.springback(startX, minX, maxX);\n                const spingbackY = this.mScrollerY.springback(startY, minY, maxY);\n                return spingbackX || spingbackY;\n            }\n            fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, overX = 0, overY = 0) {\n                NumberChecker.warnNotNumber(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, overX, overY);\n                if (this.mFlywheel && !this.isFinished()) {\n                    let oldVelocityX = this.mScrollerX.mCurrVelocity;\n                    let oldVelocityY = this.mScrollerY.mCurrVelocity;\n                    if (Math_signum(velocityX) == Math_signum(oldVelocityX) &&\n                        Math_signum(velocityY) == Math_signum(oldVelocityY)) {\n                        velocityX += oldVelocityX;\n                        velocityY += oldVelocityY;\n                    }\n                }\n                this.mMode = OverScroller.FLING_MODE;\n                this.mScrollerX.fling(startX, velocityX, minX, maxX, overX);\n                this.mScrollerY.fling(startY, velocityY, minY, maxY, overY);\n            }\n            notifyHorizontalEdgeReached(startX, finalX, overX) {\n                NumberChecker.warnNotNumber(startX, finalX, overX);\n                this.mScrollerX.notifyEdgeReached(startX, finalX, overX);\n            }\n            notifyVerticalEdgeReached(startY, finalY, overY) {\n                NumberChecker.warnNotNumber(startY, finalY, overY);\n                this.mScrollerY.notifyEdgeReached(startY, finalY, overY);\n            }\n            isOverScrolled() {\n                return ((!this.mScrollerX.mFinished &&\n                    this.mScrollerX.mState != SplineOverScroller.SPLINE) ||\n                    (!this.mScrollerY.mFinished &&\n                        this.mScrollerY.mState != SplineOverScroller.SPLINE));\n            }\n            abortAnimation() {\n                this.mScrollerX.finish();\n                this.mScrollerY.finish();\n            }\n            timePassed() {\n                const time = SystemClock.uptimeMillis();\n                const startTime = Math.min(this.mScrollerX.mStartTime, this.mScrollerY.mStartTime);\n                return (time - startTime);\n            }\n            isScrollingInDirection(xvel, yvel) {\n                const dx = this.mScrollerX.mFinal - this.mScrollerX.mStart;\n                const dy = this.mScrollerY.mFinal - this.mScrollerY.mStart;\n                return !this.isFinished() && Math_signum(xvel) == Math_signum(dx) &&\n                    Math_signum(yvel) == Math_signum(dy);\n            }\n        }\n        OverScroller.DEFAULT_DURATION = 250;\n        OverScroller.SCROLL_MODE = 0;\n        OverScroller.FLING_MODE = 1;\n        widget.OverScroller = OverScroller;\n        class SplineOverScroller {\n            constructor() {\n                this.mStart = 0;\n                this.mCurrentPosition = 0;\n                this.mFinal = 0;\n                this.mVelocity = 0;\n                this._mCurrVelocity = 0;\n                this.mDeceleration = 0;\n                this.mStartTime = 0;\n                this.mDuration = 0;\n                this.mSplineDuration = 0;\n                this.mSplineDistance = 0;\n                this.mFinished = false;\n                this.mOver = 0;\n                this.mFlingFriction = ViewConfiguration.getScrollFriction();\n                this.mState = SplineOverScroller.SPLINE;\n                this.mPhysicalCoeff = 0;\n                this.mFinished = true;\n                let ppi = Resources.getDisplayMetrics().density * 160;\n                this.mPhysicalCoeff = 9.80665\n                    * 39.37\n                    * ppi\n                    * 0.84;\n            }\n            get mCurrVelocity() {\n                return this._mCurrVelocity;\n            }\n            set mCurrVelocity(value) {\n                if (!NumberChecker.checkIsNumber(value)) {\n                    value = 0;\n                }\n                this._mCurrVelocity = value;\n            }\n            setFriction(friction) {\n                this.mFlingFriction = friction;\n            }\n            updateScroll(q) {\n                this.mCurrentPosition = this.mStart + Math.round(q * (this.mFinal - this.mStart));\n            }\n            static getDeceleration(velocity) {\n                return velocity > 0 ? -SplineOverScroller.GRAVITY : SplineOverScroller.GRAVITY;\n            }\n            adjustDuration(start, oldFinal, newFinal) {\n                let oldDistance = oldFinal - start;\n                let newDistance = newFinal - start;\n                let x = Math.abs(newDistance / oldDistance);\n                let index = Math.floor(SplineOverScroller.NB_SAMPLES * x);\n                if (index < SplineOverScroller.NB_SAMPLES) {\n                    let x_inf = index / SplineOverScroller.NB_SAMPLES;\n                    let x_sup = (index + 1) / SplineOverScroller.NB_SAMPLES;\n                    let t_inf = SplineOverScroller.SPLINE_TIME[index];\n                    let t_sup = SplineOverScroller.SPLINE_TIME[index + 1];\n                    let timeCoef = t_inf + (x - x_inf) / (x_sup - x_inf) * (t_sup - t_inf);\n                    this.mDuration *= timeCoef;\n                }\n            }\n            startScroll(start, distance, duration) {\n                this.mFinished = false;\n                this.mStart = start;\n                this.mFinal = start + distance;\n                this.mStartTime = SystemClock.uptimeMillis();\n                this.mDuration = duration;\n                this.mDeceleration = 0;\n                this.mVelocity = 0;\n            }\n            finish() {\n                this.mCurrentPosition = this.mFinal;\n                this.mFinished = true;\n            }\n            setFinalPosition(position) {\n                this.mFinal = position;\n                this.mFinished = false;\n            }\n            extendDuration(extend) {\n                let time = SystemClock.uptimeMillis();\n                let elapsedTime = (time - this.mStartTime);\n                this.mDuration = elapsedTime + extend;\n                this.mFinished = false;\n            }\n            springback(start, min, max) {\n                this.mFinished = true;\n                this.mStart = this.mFinal = start;\n                this.mVelocity = 0;\n                this.mStartTime = SystemClock.uptimeMillis();\n                this.mDuration = 0;\n                if (start < min) {\n                    this.startSpringback(start, min, 0);\n                }\n                else if (start > max) {\n                    this.startSpringback(start, max, 0);\n                }\n                return !this.mFinished;\n            }\n            startSpringback(start, end, velocity) {\n                this.mFinished = false;\n                this.mState = SplineOverScroller.CUBIC;\n                this.mStart = start;\n                this.mFinal = end;\n                const delta = start - end;\n                this.mDeceleration = SplineOverScroller.getDeceleration(delta);\n                this.mVelocity = -delta;\n                this.mOver = Math.abs(delta);\n                const density = android.content.res.Resources.getDisplayMetrics().density;\n                this.mDuration = Math.floor(1000.0 * Math.sqrt(-2.0 * (delta / density) / this.mDeceleration));\n            }\n            fling(start, velocity, min, max, over) {\n                this.mOver = over;\n                this.mFinished = false;\n                this.mCurrVelocity = this.mVelocity = velocity;\n                this.mDuration = this.mSplineDuration = 0;\n                this.mStartTime = SystemClock.uptimeMillis();\n                this.mCurrentPosition = this.mStart = start;\n                if (start > max || start < min) {\n                    this.startAfterEdge(start, min, max, velocity);\n                    return;\n                }\n                this.mState = SplineOverScroller.SPLINE;\n                let totalDistance = 0.0;\n                if (velocity != 0) {\n                    this.mDuration = this.mSplineDuration = this.getSplineFlingDuration(velocity);\n                    totalDistance = this.getSplineFlingDistance(velocity);\n                }\n                this.mSplineDistance = (totalDistance * Math_signum(velocity));\n                this.mFinal = start + this.mSplineDistance;\n                if (this.mFinal < min) {\n                    this.adjustDuration(this.mStart, this.mFinal, min);\n                    this.mFinal = min;\n                }\n                if (this.mFinal > max) {\n                    this.adjustDuration(this.mStart, this.mFinal, max);\n                    this.mFinal = max;\n                }\n            }\n            getSplineDeceleration(velocity) {\n                return Math.log(SplineOverScroller.INFLEXION * Math.abs(velocity) / (this.mFlingFriction * this.mPhysicalCoeff));\n            }\n            getSplineFlingDistance(velocity) {\n                let l = this.getSplineDeceleration(velocity);\n                let decelMinusOne = SplineOverScroller.DECELERATION_RATE - 1.0;\n                return this.mFlingFriction * this.mPhysicalCoeff * Math.exp(SplineOverScroller.DECELERATION_RATE / decelMinusOne * l);\n            }\n            getSplineFlingDuration(velocity) {\n                let l = this.getSplineDeceleration(velocity);\n                let decelMinusOne = SplineOverScroller.DECELERATION_RATE - 1.0;\n                return (1000.0 * Math.exp(l / decelMinusOne));\n            }\n            fitOnBounceCurve(start, end, velocity) {\n                let durationToApex = -velocity / this.mDeceleration;\n                let distanceToApex = velocity * velocity / 2.0 / Math.abs(this.mDeceleration);\n                let distanceToEdge = Math.abs(end - start);\n                let totalDuration = Math.sqrt(2.0 * (distanceToApex + distanceToEdge) / Math.abs(this.mDeceleration));\n                this.mStartTime -= (1000 * (totalDuration - durationToApex));\n                this.mStart = end;\n                this.mVelocity = (-this.mDeceleration * totalDuration);\n            }\n            startBounceAfterEdge(start, end, velocity) {\n                this.mDeceleration = SplineOverScroller.getDeceleration(velocity == 0 ? start - end : velocity);\n                this.fitOnBounceCurve(start, end, velocity);\n                this.onEdgeReached();\n            }\n            startAfterEdge(start, min, max, velocity) {\n                if (start > min && start < max) {\n                    Log.e(\"OverScroller\", \"startAfterEdge called from a valid position\");\n                    this.mFinished = true;\n                    return;\n                }\n                const positive = start > max;\n                const edge = positive ? max : min;\n                const overDistance = start - edge;\n                let keepIncreasing = overDistance * velocity >= 0;\n                if (keepIncreasing) {\n                    this.startBounceAfterEdge(start, edge, velocity);\n                }\n                else {\n                    const totalDistance = this.getSplineFlingDistance(velocity);\n                    if (totalDistance > Math.abs(overDistance)) {\n                        this.fling(start, velocity, positive ? min : start, positive ? start : max, this.mOver);\n                    }\n                    else {\n                        this.startSpringback(start, edge, velocity);\n                    }\n                }\n            }\n            notifyEdgeReached(start, end, over) {\n                if (this.mState == SplineOverScroller.SPLINE) {\n                    this.mOver = over;\n                    this.mStartTime = SystemClock.uptimeMillis();\n                    this.startAfterEdge(start, end, end, this.mCurrVelocity);\n                }\n            }\n            onEdgeReached() {\n                let distance = this.mVelocity * this.mVelocity / (2 * Math.abs(this.mDeceleration));\n                const sign = Math_signum(this.mVelocity);\n                if (distance > this.mOver) {\n                    this.mDeceleration = -sign * this.mVelocity * this.mVelocity / (2.0 * this.mOver);\n                    distance = this.mOver;\n                }\n                this.mOver = distance;\n                this.mState = SplineOverScroller.BALLISTIC;\n                this.mFinal = this.mStart + (this.mVelocity > 0 ? distance : -distance);\n                this.mDuration = -(1000 * this.mVelocity / this.mDeceleration);\n            }\n            continueWhenFinished() {\n                switch (this.mState) {\n                    case SplineOverScroller.SPLINE:\n                        if (this.mDuration < this.mSplineDuration) {\n                            this.mStart = this.mFinal;\n                            this.mVelocity = this.mCurrVelocity;\n                            this.mDeceleration = SplineOverScroller.getDeceleration(this.mVelocity);\n                            this.mStartTime += this.mDuration;\n                            this.onEdgeReached();\n                        }\n                        else {\n                            return false;\n                        }\n                        break;\n                    case SplineOverScroller.BALLISTIC:\n                        this.mStartTime += this.mDuration;\n                        this.startSpringback(this.mFinal, this.mStart, 0);\n                        break;\n                    case SplineOverScroller.CUBIC:\n                        return false;\n                }\n                this.update();\n                return true;\n            }\n            update() {\n                const time = SystemClock.uptimeMillis();\n                const currentTime = time - this.mStartTime;\n                if (currentTime > this.mDuration) {\n                    return false;\n                }\n                let distance = 0;\n                switch (this.mState) {\n                    case SplineOverScroller.SPLINE: {\n                        const t = currentTime / this.mSplineDuration;\n                        const index = Math.floor(SplineOverScroller.NB_SAMPLES * t);\n                        let distanceCoef = 1;\n                        let velocityCoef = 0;\n                        if (index < SplineOverScroller.NB_SAMPLES) {\n                            const t_inf = index / SplineOverScroller.NB_SAMPLES;\n                            const t_sup = (index + 1) / SplineOverScroller.NB_SAMPLES;\n                            const d_inf = SplineOverScroller.SPLINE_POSITION[index];\n                            const d_sup = SplineOverScroller.SPLINE_POSITION[index + 1];\n                            velocityCoef = (d_sup - d_inf) / (t_sup - t_inf);\n                            distanceCoef = d_inf + (t - t_inf) * velocityCoef;\n                        }\n                        distance = distanceCoef * this.mSplineDistance;\n                        this.mCurrVelocity = velocityCoef * this.mSplineDistance / this.mSplineDuration * 1000;\n                        break;\n                    }\n                    case SplineOverScroller.BALLISTIC: {\n                        const t = currentTime / 1000;\n                        this.mCurrVelocity = this.mVelocity + this.mDeceleration * t;\n                        distance = this.mVelocity * t + this.mDeceleration * t * t / 2;\n                        break;\n                    }\n                    case SplineOverScroller.CUBIC: {\n                        const t = (currentTime) / this.mDuration;\n                        const t2 = t * t;\n                        const sign = Math_signum(this.mVelocity);\n                        distance = sign * this.mOver * (3 * t2 - 2 * t * t2);\n                        this.mCurrVelocity = sign * this.mOver * 6 * (-t + t2);\n                        break;\n                    }\n                }\n                this.mCurrentPosition = this.mStart + Math.round(distance);\n                return true;\n            }\n        }\n        SplineOverScroller.DECELERATION_RATE = (Math.log(0.78) / Math.log(0.9));\n        SplineOverScroller.INFLEXION = 0.35;\n        SplineOverScroller.START_TENSION = 0.5;\n        SplineOverScroller.END_TENSION = 1.0;\n        SplineOverScroller.P1 = SplineOverScroller.START_TENSION * SplineOverScroller.INFLEXION;\n        SplineOverScroller.P2 = 1.0 - SplineOverScroller.END_TENSION * (1 - SplineOverScroller.INFLEXION);\n        SplineOverScroller.NB_SAMPLES = 100;\n        SplineOverScroller.SPLINE_POSITION = androidui.util.ArrayCreator.newNumberArray(SplineOverScroller.NB_SAMPLES + 1);\n        SplineOverScroller.SPLINE_TIME = androidui.util.ArrayCreator.newNumberArray(SplineOverScroller.NB_SAMPLES + 1);\n        SplineOverScroller.SPLINE = 0;\n        SplineOverScroller.CUBIC = 1;\n        SplineOverScroller.BALLISTIC = 2;\n        SplineOverScroller.GRAVITY = 2000;\n        SplineOverScroller._staticFunc = function () {\n            let x_min = 0.0;\n            let y_min = 0.0;\n            for (let i = 0; i < SplineOverScroller.NB_SAMPLES; i++) {\n                const alpha = i / SplineOverScroller.NB_SAMPLES;\n                let x_max = 1.0;\n                let x, tx, coef;\n                while (true) {\n                    x = x_min + (x_max - x_min) / 2.0;\n                    coef = 3.0 * x * (1.0 - x);\n                    tx = coef * ((1.0 - x) * SplineOverScroller.P1 + x * SplineOverScroller.P2) + x * x * x;\n                    if (Math.abs(tx - alpha) < 1E-5)\n                        break;\n                    if (tx > alpha)\n                        x_max = x;\n                    else\n                        x_min = x;\n                }\n                SplineOverScroller.SPLINE_POSITION[i] = coef * ((1.0 - x) * SplineOverScroller.START_TENSION + x) + x * x * x;\n                let y_max = 1.0;\n                let y, dy;\n                while (true) {\n                    y = y_min + (y_max - y_min) / 2.0;\n                    coef = 3.0 * y * (1.0 - y);\n                    dy = coef * ((1.0 - y) * SplineOverScroller.START_TENSION + y) + y * y * y;\n                    if (Math.abs(dy - alpha) < 1E-5)\n                        break;\n                    if (dy > alpha)\n                        y_max = y;\n                    else\n                        y_min = y;\n                }\n                SplineOverScroller.SPLINE_TIME[i] = coef * ((1.0 - y) * SplineOverScroller.P1 + y * SplineOverScroller.P2) + y * y * y;\n            }\n            SplineOverScroller.SPLINE_POSITION[SplineOverScroller.NB_SAMPLES] = SplineOverScroller.SPLINE_TIME[SplineOverScroller.NB_SAMPLES] = 1.0;\n        }();\n        function Math_signum(value) {\n            if (value === 0 || Number.isNaN(value))\n                return value;\n            return Math.abs(value) === value ? 1 : -1;\n        }\n        let sViscousFluidScale = 8;\n        let sViscousFluidNormalize = 1;\n        function Scroller_viscousFluid(x) {\n            x *= sViscousFluidScale;\n            if (x < 1) {\n                x -= (1 - Math.exp(-x));\n            }\n            else {\n                let start = 0.36787944117;\n                x = 1 - Math.exp(1 - x);\n                x = start + x * (1 - start);\n            }\n            x *= sViscousFluidNormalize;\n            return x;\n        }\n        sViscousFluidNormalize = 1 / Scroller_viscousFluid(1);\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var ColorStateList = android.content.res.ColorStateList;\n        var Paint = android.graphics.Paint;\n        var Path = android.graphics.Path;\n        var Rect = android.graphics.Rect;\n        var Color = android.graphics.Color;\n        var RectF = android.graphics.RectF;\n        var Handler = android.os.Handler;\n        var BoringLayout = android.text.BoringLayout;\n        var DynamicLayout = android.text.DynamicLayout;\n        var Layout = android.text.Layout;\n        var Spannable = android.text.Spannable;\n        var Spanned = android.text.Spanned;\n        var StaticLayout = android.text.StaticLayout;\n        var TextDirectionHeuristics = android.text.TextDirectionHeuristics;\n        var TextPaint = android.text.TextPaint;\n        var TextUtils = android.text.TextUtils;\n        var TruncateAt = android.text.TextUtils.TruncateAt;\n        var AllCapsTransformationMethod = android.text.method.AllCapsTransformationMethod;\n        var SingleLineTransformationMethod = android.text.method.SingleLineTransformationMethod;\n        var TransformationMethod2 = android.text.method.TransformationMethod2;\n        var Log = android.util.Log;\n        var TypedValue = android.util.TypedValue;\n        var Gravity = android.view.Gravity;\n        var HapticFeedbackConstants = android.view.HapticFeedbackConstants;\n        var MotionEvent = android.view.MotionEvent;\n        var View = android.view.View;\n        var LayoutParams = android.view.ViewGroup.LayoutParams;\n        var AnimationUtils = android.view.animation.AnimationUtils;\n        var WeakReference = java.lang.ref.WeakReference;\n        var ArrayList = java.util.ArrayList;\n        var Integer = java.lang.Integer;\n        var System = java.lang.System;\n        class TextView extends View {\n            constructor(context, bindElement, defStyle = android.R.attr.textViewStyle) {\n                super(context, bindElement, defStyle);\n                this.mTextColor = ColorStateList.valueOf(Color.BLACK);\n                this.mCurTextColor = 0;\n                this.mCurHintTextColor = 0;\n                this.mSpannableFactory = Spannable.Factory.getInstance();\n                this.mShadowRadius = 0;\n                this.mShadowDx = 0;\n                this.mShadowDy = 0;\n                this.mMarqueeRepeatLimit = 3;\n                this.mLastLayoutDirection = -1;\n                this.mMarqueeFadeMode = TextView.MARQUEE_FADE_NORMAL;\n                this.mBufferType = TextView.BufferType.NORMAL;\n                this.mGravity = Gravity.TOP | Gravity.LEFT;\n                this.mAutoLinkMask = 0;\n                this.mLinksClickable = true;\n                this.mSpacingMult = 1.0;\n                this.mSpacingAdd = 0.0;\n                this.mMaximum = Integer.MAX_VALUE;\n                this.mMaxMode = TextView.LINES;\n                this.mMinimum = 0;\n                this.mMinMode = TextView.LINES;\n                this.mOldMaximum = this.mMaximum;\n                this.mOldMaxMode = this.mMaxMode;\n                this.mMaxWidthValue = Integer.MAX_VALUE;\n                this.mMaxWidthMode = TextView.PIXELS;\n                this.mMinWidthValue = 0;\n                this.mMinWidthMode = TextView.PIXELS;\n                this.mDesiredHeightAtMeasure = -1;\n                this.mIncludePad = true;\n                this.mDeferScroll = -1;\n                this.mLastScroll = 0;\n                this.mFilters = TextView.NO_FILTERS;\n                this.mHighlightColor = 0x6633B5E5;\n                this.mHighlightPathBogus = true;\n                this.mCursorDrawableRes = 0;\n                this.mTextSelectHandleLeftRes = 0;\n                this.mTextSelectHandleRightRes = 0;\n                this.mTextSelectHandleRes = 0;\n                this.mTextEditSuggestionItemLayout = 0;\n                this.mSkipDrawText = false;\n                this.mText = \"\";\n                this.mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);\n                this.mHighlightPaint = new Paint(Paint.ANTI_ALIAS_FLAG);\n                this.mMovement = this.getDefaultMovementMethod();\n                this.mTransformation = null;\n                let textColorHighlight = 0;\n                let textColor = null;\n                let textColorHint = null;\n                let textColorLink = null;\n                let textSize = 14 * this.getResources().getDisplayMetrics().density;\n                let allCaps = false;\n                let shadowcolor = 0;\n                let dx = 0, dy = 0, r = 0;\n                let editable = this.getDefaultEditable();\n                let numeric = 0;\n                let digits = null;\n                let drawableLeft = null, drawableTop = null, drawableRight = null, drawableBottom = null, drawableStart = null, drawableEnd = null;\n                let drawablePadding = 0;\n                let ellipsize;\n                let singleLine = false;\n                let maxlength = -1;\n                let text = \"\";\n                let hint = null;\n                let a = context.obtainStyledAttributes(bindElement, defStyle);\n                for (let attr of a.getLowerCaseNoNamespaceAttrNames()) {\n                    switch (attr) {\n                        case 'editable':\n                            editable = a.getBoolean(attr, editable);\n                            break;\n                        case 'inputmethod':\n                            break;\n                        case 'numeric':\n                            numeric = a.getInt(attr, numeric);\n                            break;\n                        case 'digits':\n                            digits = a.getText(attr);\n                            break;\n                        case 'phonenumber':\n                            break;\n                        case 'autotext':\n                            break;\n                        case 'capitalize':\n                            break;\n                        case 'buffertype':\n                            break;\n                        case 'selectallonfocus':\n                            break;\n                        case 'autolink':\n                            this.mAutoLinkMask = a.getInt(attr, 0);\n                            break;\n                        case 'linksclickable':\n                            this.mLinksClickable = a.getBoolean(attr, true);\n                            break;\n                        case 'drawableleft':\n                            drawableLeft = a.getDrawable(attr);\n                            break;\n                        case 'drawabletop':\n                            drawableTop = a.getDrawable(attr);\n                            break;\n                        case 'drawableright':\n                            drawableRight = a.getDrawable(attr);\n                            break;\n                        case 'drawablebottom':\n                            drawableBottom = a.getDrawable(attr);\n                            break;\n                        case 'drawablestart':\n                            drawableStart = a.getDrawable(attr);\n                            break;\n                        case 'drawableend':\n                            drawableEnd = a.getDrawable(attr);\n                            break;\n                        case 'drawablepadding':\n                            drawablePadding = a.getDimensionPixelSize(attr, drawablePadding);\n                            break;\n                        case 'maxlines':\n                            this.setMaxLines(a.getInt(attr, -1));\n                            break;\n                        case 'maxheight':\n                            this.setMaxHeight(a.getDimensionPixelSize(attr, -1));\n                            break;\n                        case 'lines':\n                            this.setLines(a.getInt(attr, -1));\n                            break;\n                        case 'height':\n                            this.setHeight(a.getDimensionPixelSize(attr, -1));\n                            break;\n                        case 'minlines':\n                            this.setMinLines(a.getInt(attr, -1));\n                            break;\n                        case 'minheight':\n                            this.setMinHeight(a.getDimensionPixelSize(attr, -1));\n                            break;\n                        case 'maxems':\n                            this.setMaxEms(a.getInt(attr, -1));\n                            break;\n                        case 'maxwidth':\n                            this.setMaxWidth(a.getDimensionPixelSize(attr, -1));\n                            break;\n                        case 'ems':\n                            this.setEms(a.getInt(attr, -1));\n                            break;\n                        case 'width':\n                            this.setWidth(a.getDimensionPixelSize(attr, -1));\n                            break;\n                        case 'minems':\n                            this.setMinEms(a.getInt(attr, -1));\n                            break;\n                        case 'minwidth':\n                            this.setMinWidth(a.getDimensionPixelSize(attr, -1));\n                            break;\n                        case 'gravity':\n                            this.setGravity(Gravity.parseGravity(a.getAttrValue(attr), -1));\n                            break;\n                        case 'hint':\n                            hint = a.getText(attr);\n                            break;\n                        case 'text':\n                            text = a.getText(attr);\n                            break;\n                        case 'scrollhorizontally':\n                            if (a.getBoolean(attr, false)) {\n                                this.setHorizontallyScrolling(true);\n                            }\n                            break;\n                        case 'singleline':\n                            singleLine = a.getBoolean(attr, singleLine);\n                            break;\n                        case 'ellipsize':\n                            ellipsize = TextUtils.TruncateAt[(a.getAttrValue(attr) + '').toUpperCase()];\n                            break;\n                        case 'marqueerepeatlimit':\n                            this.setMarqueeRepeatLimit(a.getInt(attr, this.mMarqueeRepeatLimit));\n                            break;\n                        case 'includefontpadding':\n                            if (!a.getBoolean(attr, true)) {\n                                this.setIncludeFontPadding(false);\n                            }\n                            break;\n                        case 'cursorvisible':\n                            if (!a.getBoolean(attr, true)) {\n                                this.setCursorVisible(false);\n                            }\n                            break;\n                        case 'maxlength':\n                            maxlength = a.getInt(attr, -1);\n                            break;\n                        case 'textscalex':\n                            this.setTextScaleX(a.getFloat(attr, 1.0));\n                            break;\n                        case 'freezestext':\n                            this.mFreezesText = a.getBoolean(attr, false);\n                            break;\n                        case 'shadowcolor':\n                            shadowcolor = a.getInt(attr, 0);\n                            break;\n                        case 'shadowdx':\n                            dx = a.getFloat(attr, 0);\n                            break;\n                        case 'shadowdy':\n                            dy = a.getFloat(attr, 0);\n                            break;\n                        case 'shadowradius':\n                            r = a.getFloat(attr, 0);\n                            break;\n                        case 'enabled':\n                            this.setEnabled(a.getBoolean(attr, this.isEnabled()));\n                            break;\n                        case 'textcolorhighlight':\n                            textColorHighlight = a.getColor(attr, textColorHighlight);\n                            break;\n                        case 'textcolor':\n                            textColor = a.getColorStateList(attr);\n                            break;\n                        case 'textcolorhint':\n                            textColorHint = a.getColorStateList(attr);\n                            break;\n                        case 'textcolorlink':\n                            textColorLink = a.getColorStateList(attr);\n                            break;\n                        case 'textsize':\n                            textSize = a.getDimensionPixelSize(attr, textSize);\n                            break;\n                        case 'typeface':\n                            break;\n                        case 'textstyle':\n                            break;\n                        case 'fontfamily':\n                            break;\n                        case 'password':\n                            break;\n                        case 'linespacingextra':\n                            this.mSpacingAdd = a.getDimensionPixelSize(attr, Math.floor(this.mSpacingAdd));\n                            break;\n                        case 'linespacingmultiplier':\n                            this.mSpacingMult = a.getFloat(attr, this.mSpacingMult);\n                            break;\n                        case 'inputtype':\n                            break;\n                        case 'imeoptions':\n                            break;\n                        case 'imeactionlabel':\n                            break;\n                        case 'imeactionid':\n                            break;\n                        case 'privateimeoptions':\n                            break;\n                        case 'editorextras':\n                            break;\n                        case 'textcursordrawable':\n                            break;\n                        case 'textselecthandleleft':\n                            break;\n                        case 'textselecthandleright':\n                            break;\n                        case 'textselecthandle':\n                            break;\n                        case 'texteditsuggestionitemlayout':\n                            break;\n                        case 'textisselectable':\n                            this.setTextIsSelectable(a.getBoolean(attr, false));\n                            break;\n                        case 'textallcaps':\n                            allCaps = a.getBoolean(attr, false);\n                            break;\n                    }\n                }\n                a.recycle();\n                let bufferType = this.mBufferType;\n                this.setCompoundDrawablesWithIntrinsicBounds(drawableLeft, drawableTop, drawableRight, drawableBottom);\n                this.setRelativeDrawablesIfNeeded(drawableStart, drawableEnd);\n                this.setCompoundDrawablePadding(drawablePadding);\n                this.setInputTypeSingleLine(singleLine);\n                this.applySingleLine(singleLine, singleLine, singleLine);\n                if (singleLine && this.getKeyListener() == null && ellipsize == null) {\n                    ellipsize = TextUtils.TruncateAt.END;\n                }\n                switch (ellipsize) {\n                    case TextUtils.TruncateAt.START:\n                        this.setEllipsize(TextUtils.TruncateAt.START);\n                        break;\n                    case TextUtils.TruncateAt.MIDDLE:\n                        this.setEllipsize(TextUtils.TruncateAt.MIDDLE);\n                        break;\n                    case TextUtils.TruncateAt.END:\n                        this.setEllipsize(TextUtils.TruncateAt.END);\n                        break;\n                    case TextUtils.TruncateAt.MARQUEE:\n                        this.setHorizontalFadingEdgeEnabled(false);\n                        this.mMarqueeFadeMode = TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS;\n                        this.setEllipsize(TextUtils.TruncateAt.MARQUEE);\n                        break;\n                }\n                this.setTextColor(textColor != null ? textColor : ColorStateList.valueOf(0xFF000000));\n                this.setHintTextColor(textColorHint);\n                this.setLinkTextColor(textColorLink);\n                if (textColorHighlight != 0) {\n                    this.setHighlightColor(textColorHighlight);\n                }\n                this.setRawTextSize(textSize);\n                if (allCaps) {\n                    this.setTransformationMethod(new AllCapsTransformationMethod(this.getContext()));\n                }\n                if (shadowcolor != 0) {\n                    this.setShadowLayer(r, dx, dy, shadowcolor);\n                }\n                this.setText(text, bufferType);\n                if (hint != null)\n                    this.setHint(hint);\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder()\n                    .set('textColorHighlight', {\n                    setter(v, value, attrBinder) {\n                        v.setHighlightColor(attrBinder.parseColor(value, v.mHighlightColor));\n                    },\n                    getter(v) {\n                        return v.getHighlightColor();\n                    }\n                }).set('textColor', {\n                    setter(v, value, attrBinder) {\n                        let color = attrBinder.parseColorList(value);\n                        if (color)\n                            v.setTextColor(color);\n                    },\n                    getter(v) {\n                        return v.mTextColor;\n                    }\n                }).set('textColorHint', {\n                    setter(v, value, attrBinder) {\n                        let color = attrBinder.parseColorList(value);\n                        if (color)\n                            v.setHintTextColor(color);\n                    },\n                    getter(v) {\n                        return v.mHintTextColor;\n                    }\n                }).set('textSize', {\n                    setter(v, value, attrBinder) {\n                        let size = attrBinder.parseNumberPixelSize(value, v.mTextPaint.getTextSize());\n                        v.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);\n                    },\n                    getter(v) {\n                        return v.mTextPaint.getTextSize();\n                    }\n                }).set('textAllCaps', {\n                    setter(v, value, attrBinder) {\n                        v.setAllCaps(attrBinder.parseBoolean(value, true));\n                    }\n                }).set('shadowColor', {\n                    setter(v, value, attrBinder) {\n                        v.setShadowLayer(v.mShadowRadius, v.mShadowDx, v.mShadowDy, attrBinder.parseColor(value, v.mTextPaint.shadowColor));\n                    },\n                    getter(v) {\n                        return v.getShadowColor();\n                    }\n                }).set('shadowDx', {\n                    setter(v, value, attrBinder) {\n                        let dx = attrBinder.parseNumberPixelSize(value, v.mShadowDx);\n                        v.setShadowLayer(v.mShadowRadius, dx, v.mShadowDy, v.mTextPaint.shadowColor);\n                    },\n                    getter(v) {\n                        return v.getShadowDx();\n                    }\n                }).set('shadowDy', {\n                    setter(v, value, attrBinder) {\n                        let dy = attrBinder.parseNumberPixelSize(value, v.mShadowDy);\n                        v.setShadowLayer(v.mShadowRadius, v.mShadowDx, dy, v.mTextPaint.shadowColor);\n                    },\n                    getter(v) {\n                        return v.getShadowDy();\n                    }\n                }).set('shadowRadius', {\n                    setter(v, value, attrBinder) {\n                        let radius = attrBinder.parseNumberPixelSize(value, v.mShadowRadius);\n                        v.setShadowLayer(radius, v.mShadowDx, v.mShadowDy, v.mTextPaint.shadowColor);\n                    },\n                    getter(v) {\n                        return v.getShadowRadius();\n                    }\n                }).set('drawableLeft', {\n                    setter(v, value, attrBinder) {\n                        let dr = v.mDrawables || {};\n                        let drawable = attrBinder.parseDrawable(value);\n                        v.setCompoundDrawablesWithIntrinsicBounds(drawable, dr.mDrawableTop, dr.mDrawableRight, dr.mDrawableBottom);\n                    },\n                    getter(v) {\n                        return v.getCompoundDrawables()[0];\n                    }\n                }).set('drawableStart', {\n                    setter(v, value, attrBinder) {\n                        let dr = v.mDrawables || {};\n                        let drawable = attrBinder.parseDrawable(value);\n                        v.setCompoundDrawablesWithIntrinsicBounds(drawable, dr.mDrawableTop, dr.mDrawableRight, dr.mDrawableBottom);\n                    },\n                    getter(v) {\n                        return v.getCompoundDrawables()[0];\n                    }\n                }).set('drawableTop', {\n                    setter(v, value, attrBinder) {\n                        let dr = v.mDrawables || {};\n                        let drawable = attrBinder.parseDrawable(value);\n                        v.setCompoundDrawablesWithIntrinsicBounds(dr.mDrawableLeft, drawable, dr.mDrawableRight, dr.mDrawableBottom);\n                    },\n                    getter(v) {\n                        return v.getCompoundDrawables()[1];\n                    }\n                }).set('drawableRight', {\n                    setter(v, value, attrBinder) {\n                        let dr = v.mDrawables || {};\n                        let drawable = attrBinder.parseDrawable(value);\n                        v.setCompoundDrawablesWithIntrinsicBounds(dr.mDrawableLeft, dr.mDrawableTop, drawable, dr.mDrawableBottom);\n                    },\n                    getter(v) {\n                        return v.getCompoundDrawables()[2];\n                    }\n                }).set('drawableEnd', {\n                    setter(v, value, attrBinder) {\n                        let dr = v.mDrawables || {};\n                        let drawable = attrBinder.parseDrawable(value);\n                        v.setCompoundDrawablesWithIntrinsicBounds(dr.mDrawableLeft, dr.mDrawableTop, drawable, dr.mDrawableBottom);\n                    },\n                    getter(v) {\n                        return v.getCompoundDrawables()[2];\n                    }\n                }).set('drawableBottom', {\n                    setter(v, value, attrBinder) {\n                        let dr = v.mDrawables || {};\n                        let drawable = attrBinder.parseDrawable(value);\n                        v.setCompoundDrawablesWithIntrinsicBounds(dr.mDrawableLeft, dr.mDrawableTop, dr.mDrawableRight, drawable);\n                    },\n                    getter(v) {\n                        return v.getCompoundDrawables()[3];\n                    }\n                }).set('drawablePadding', {\n                    setter(v, value, attrBinder) {\n                        v.setCompoundDrawablePadding(attrBinder.parseNumberPixelSize(value));\n                    },\n                    getter(v) {\n                        return v.getCompoundDrawablePadding();\n                    }\n                }).set('maxLines', {\n                    setter(v, value, attrBinder) {\n                        value = Number.parseInt(value);\n                        if (Number.isInteger(value))\n                            v.setMaxLines(value);\n                    },\n                    getter(v) {\n                        return v.getMaxLines();\n                    }\n                }).set('maxHeight', {\n                    setter(v, value, attrBinder) {\n                        v.setMaxHeight(attrBinder.parseNumberPixelSize(value, v.getMaxHeight()));\n                    },\n                    getter(v) {\n                        return v.getMaxHeight();\n                    }\n                }).set('lines', {\n                    setter(v, value, attrBinder) {\n                        value = Number.parseInt(value);\n                        if (Number.isInteger(value))\n                            v.setLines(value);\n                    },\n                    getter(v) {\n                        if (v.getMaxLines() === v.getMinLines())\n                            return v.getMaxLines();\n                        return null;\n                    }\n                }).set('height', {\n                    setter(v, value, attrBinder) {\n                        value = attrBinder.parseNumberPixelSize(value, -1);\n                        if (value >= 0)\n                            v.setHeight(value);\n                    },\n                    getter(v) {\n                        if (v.getMaxHeight() === v.getMinimumHeight())\n                            return v.getMaxHeight();\n                        return null;\n                    }\n                }).set('minLines', {\n                    setter(v, value, attrBinder) {\n                        v.setMinLines(attrBinder.parseInt(value, v.getMinLines()));\n                    },\n                    getter(v) {\n                        return v.getMinLines();\n                    }\n                }).set('minHeight', {\n                    setter(v, value, attrBinder) {\n                        v.setMinHeight(attrBinder.parseNumberPixelSize(value, v.getMinHeight()));\n                    },\n                    getter(v) {\n                        return v.getMinHeight();\n                    }\n                }).set('maxEms', {\n                    setter(v, value, attrBinder) {\n                        v.setMaxEms(attrBinder.parseInt(value, v.getMaxEms()));\n                    },\n                    getter(v) {\n                        return v.getMaxEms();\n                    }\n                }).set('maxWidth', {\n                    setter(v, value, attrBinder) {\n                        v.setMaxWidth(attrBinder.parseNumberPixelSize(value, v.getMaxWidth()));\n                    },\n                    getter(v) {\n                        return v.getMaxWidth();\n                    }\n                }).set('ems', {\n                    setter(v, value, attrBinder) {\n                        let ems = attrBinder.parseInt(value, null);\n                        if (ems != null)\n                            v.setEms(ems);\n                    },\n                    getter(v) {\n                        if (v.getMinEms() === v.getMaxEms())\n                            return v.getMaxEms();\n                        return null;\n                    }\n                }).set('width', {\n                    setter(v, value, attrBinder) {\n                        value = attrBinder.parseNumberPixelSize(value, -1);\n                        if (value >= 0)\n                            v.setWidth(value);\n                    },\n                    getter(v) {\n                        if (v.getMinWidth() === v.getMaxWidth())\n                            return v.getMinWidth();\n                        return null;\n                    }\n                }).set('minEms', {\n                    setter(v, value, attrBinder) {\n                        v.setMinEms(attrBinder.parseInt(value, v.getMinEms()));\n                    },\n                    getter(v) {\n                        return v.getMinEms();\n                    }\n                }).set('minWidth', {\n                    setter(v, value, attrBinder) {\n                        v.setMinWidth(attrBinder.parseNumberPixelSize(value, v.getMinWidth()));\n                    },\n                    getter(v) {\n                        return v.getMinWidth();\n                    }\n                }).set('gravity', {\n                    setter(v, value, attrBinder) {\n                        v.setGravity(attrBinder.parseGravity(value, v.mGravity));\n                    },\n                    getter(v) {\n                        return v.mGravity;\n                    }\n                }).set('hint', {\n                    setter(v, value, attrBinder) {\n                        v.setHint(attrBinder.parseString(value));\n                    },\n                    getter(v) {\n                        return v.getHint();\n                    }\n                }).set('text', {\n                    setter(v, value, attrBinder) {\n                        v.setText(attrBinder.parseString(value));\n                    },\n                    getter(v) {\n                        return v.getText();\n                    }\n                }).set('scrollHorizontally', {\n                    setter(v, value, attrBinder) {\n                        v.setHorizontallyScrolling(attrBinder.parseBoolean(value, false));\n                    }\n                }).set('singleLine', {\n                    setter(v, value, attrBinder) {\n                        v.setSingleLine(attrBinder.parseBoolean(value, false));\n                    }\n                }).set('ellipsize', {\n                    setter(v, value, attrBinder) {\n                        let ellipsize = TextUtils.TruncateAt[(value + '').toUpperCase()];\n                        if (ellipsize)\n                            v.setEllipsize(ellipsize);\n                    }\n                }).set('marqueeRepeatLimit', {\n                    setter(v, value, attrBinder) {\n                        let marqueeRepeatLimit = attrBinder.parseInt(value, -1);\n                        if (marqueeRepeatLimit >= 0)\n                            v.setMarqueeRepeatLimit(marqueeRepeatLimit);\n                    }\n                }).set('includeFontPadding', {\n                    setter(v, value, attrBinder) {\n                        v.setIncludeFontPadding(attrBinder.parseBoolean(value, false));\n                    }\n                }).set('enabled', {\n                    setter(v, value, attrBinder) {\n                        v.setEnabled(attrBinder.parseBoolean(value, v.isEnabled()));\n                    },\n                    getter(v) {\n                        return v.isEnabled();\n                    }\n                }).set('lineSpacingExtra', {\n                    setter(v, value, attrBinder) {\n                        v.setLineSpacing(attrBinder.parseNumberPixelSize(value, v.mSpacingAdd), v.mSpacingMult);\n                    },\n                    getter(v) {\n                        return v.mSpacingAdd;\n                    }\n                }).set('lineSpacingMultiplier', {\n                    setter(v, value, attrBinder) {\n                        v.setLineSpacing(v.mSpacingAdd, attrBinder.parseFloat(value, v.mSpacingMult));\n                    },\n                    getter(v) {\n                        return v.mSpacingMult;\n                    }\n                });\n            }\n            setTypefaceFromAttrs(familyName, typefaceIndex, styleIndex) {\n            }\n            setRelativeDrawablesIfNeeded(start, end) {\n                let hasRelativeDrawables = (start != null) || (end != null);\n                if (hasRelativeDrawables) {\n                    let dr = this.mDrawables;\n                    if (dr == null) {\n                        this.mDrawables = dr = new TextView.Drawables();\n                    }\n                    this.mDrawables.mOverride = true;\n                    const compoundRect = dr.mCompoundRect;\n                    let state = this.getDrawableState();\n                    if (start != null) {\n                        start.setBounds(0, 0, start.getIntrinsicWidth(), start.getIntrinsicHeight());\n                        start.setState(state);\n                        start.copyBounds(compoundRect);\n                        start.setCallback(this);\n                        dr.mDrawableStart = start;\n                        dr.mDrawableSizeStart = compoundRect.width();\n                        dr.mDrawableHeightStart = compoundRect.height();\n                    }\n                    else {\n                        dr.mDrawableSizeStart = dr.mDrawableHeightStart = 0;\n                    }\n                    if (end != null) {\n                        end.setBounds(0, 0, end.getIntrinsicWidth(), end.getIntrinsicHeight());\n                        end.setState(state);\n                        end.copyBounds(compoundRect);\n                        end.setCallback(this);\n                        dr.mDrawableEnd = end;\n                        dr.mDrawableSizeEnd = compoundRect.width();\n                        dr.mDrawableHeightEnd = compoundRect.height();\n                    }\n                    else {\n                        dr.mDrawableSizeEnd = dr.mDrawableHeightEnd = 0;\n                    }\n                    this.resetResolvedDrawables();\n                    this.resolveDrawables();\n                }\n            }\n            setEnabled(enabled) {\n                if (enabled == this.isEnabled()) {\n                    return;\n                }\n                super.setEnabled(enabled);\n            }\n            setTypeface(tf, style) {\n            }\n            getDefaultEditable() {\n                return false;\n            }\n            getDefaultMovementMethod() {\n                return null;\n            }\n            getText() {\n                return this.mText;\n            }\n            length() {\n                return this.mText.length;\n            }\n            getEditableText() {\n                return null;\n            }\n            getLineHeight() {\n                return Math.round(this.mTextPaint.getFontMetricsInt(null) * this.mSpacingMult + this.mSpacingAdd);\n            }\n            getLayout() {\n                return this.mLayout;\n            }\n            getHintLayout() {\n                return this.mHintLayout;\n            }\n            getUndoManager() {\n                return null;\n            }\n            setUndoManager(undoManager, tag) {\n            }\n            getKeyListener() {\n                return null;\n            }\n            setKeyListener(input) {\n            }\n            setKeyListenerOnly(input) {\n            }\n            getMovementMethod() {\n                return this.mMovement;\n            }\n            setMovementMethod(movement) {\n                if (this.mMovement != movement) {\n                    this.mMovement = movement;\n                    if (movement != null && !Spannable.isImpl(this.mText)) {\n                        this.setText(this.mText);\n                    }\n                    this.fixFocusableAndClickableSettings();\n                }\n            }\n            fixFocusableAndClickableSettings() {\n                if (this.mMovement != null) {\n                    this.setFocusable(true);\n                    this.setClickable(true);\n                    this.setLongClickable(true);\n                }\n                else {\n                    this.setFocusable(false);\n                    this.setClickable(false);\n                    this.setLongClickable(false);\n                }\n            }\n            getTransformationMethod() {\n                return this.mTransformation;\n            }\n            setTransformationMethod(method) {\n                if (method == this.mTransformation) {\n                    return;\n                }\n                if (this.mTransformation != null) {\n                    if (Spannable.isImpl(this.mText)) {\n                        this.mText.removeSpan(this.mTransformation);\n                    }\n                }\n                this.mTransformation = method;\n                if (TransformationMethod2.isImpl(method)) {\n                    let method2 = method;\n                    this.mAllowTransformationLengthChange = !this.isTextSelectable();\n                    method2.setLengthChangesAllowed(this.mAllowTransformationLengthChange);\n                }\n                else {\n                    this.mAllowTransformationLengthChange = false;\n                }\n                this.setText(this.mText);\n            }\n            getCompoundPaddingTop() {\n                const dr = this.mDrawables;\n                if (dr == null || dr.mDrawableTop == null) {\n                    return this.mPaddingTop;\n                }\n                else {\n                    return this.mPaddingTop + dr.mDrawablePadding + dr.mDrawableSizeTop;\n                }\n            }\n            getCompoundPaddingBottom() {\n                const dr = this.mDrawables;\n                if (dr == null || dr.mDrawableBottom == null) {\n                    return this.mPaddingBottom;\n                }\n                else {\n                    return this.mPaddingBottom + dr.mDrawablePadding + dr.mDrawableSizeBottom;\n                }\n            }\n            getCompoundPaddingLeft() {\n                const dr = this.mDrawables;\n                if (dr == null || dr.mDrawableLeft == null) {\n                    return this.mPaddingLeft;\n                }\n                else {\n                    return this.mPaddingLeft + dr.mDrawablePadding + dr.mDrawableSizeLeft;\n                }\n            }\n            getCompoundPaddingRight() {\n                const dr = this.mDrawables;\n                if (dr == null || dr.mDrawableRight == null) {\n                    return this.mPaddingRight;\n                }\n                else {\n                    return this.mPaddingRight + dr.mDrawablePadding + dr.mDrawableSizeRight;\n                }\n            }\n            getCompoundPaddingStart() {\n                this.resolveDrawables();\n                return this.getCompoundPaddingLeft();\n            }\n            getCompoundPaddingEnd() {\n                this.resolveDrawables();\n                return this.getCompoundPaddingRight();\n            }\n            getExtendedPaddingTop() {\n                if (this.mMaxMode != TextView.LINES) {\n                    return this.getCompoundPaddingTop();\n                }\n                if (this.mLayout.getLineCount() <= this.mMaximum) {\n                    return this.getCompoundPaddingTop();\n                }\n                let top = this.getCompoundPaddingTop();\n                let bottom = this.getCompoundPaddingBottom();\n                let viewht = this.getHeight() - top - bottom;\n                let layoutht = this.mLayout.getLineTop(this.mMaximum);\n                if (layoutht >= viewht) {\n                    return top;\n                }\n                const gravity = this.mGravity & Gravity.VERTICAL_GRAVITY_MASK;\n                if (gravity == Gravity.TOP) {\n                    return top;\n                }\n                else if (gravity == Gravity.BOTTOM) {\n                    return top + viewht - layoutht;\n                }\n                else {\n                    return top + (viewht - layoutht) / 2;\n                }\n            }\n            getExtendedPaddingBottom() {\n                if (this.mMaxMode != TextView.LINES) {\n                    return this.getCompoundPaddingBottom();\n                }\n                if (this.mLayout.getLineCount() <= this.mMaximum) {\n                    return this.getCompoundPaddingBottom();\n                }\n                let top = this.getCompoundPaddingTop();\n                let bottom = this.getCompoundPaddingBottom();\n                let viewht = this.getHeight() - top - bottom;\n                let layoutht = this.mLayout.getLineTop(this.mMaximum);\n                if (layoutht >= viewht) {\n                    return bottom;\n                }\n                const gravity = this.mGravity & Gravity.VERTICAL_GRAVITY_MASK;\n                if (gravity == Gravity.TOP) {\n                    return bottom + viewht - layoutht;\n                }\n                else if (gravity == Gravity.BOTTOM) {\n                    return bottom;\n                }\n                else {\n                    return bottom + (viewht - layoutht) / 2;\n                }\n            }\n            getTotalPaddingLeft() {\n                return this.getCompoundPaddingLeft();\n            }\n            getTotalPaddingRight() {\n                return this.getCompoundPaddingRight();\n            }\n            getTotalPaddingStart() {\n                return this.getCompoundPaddingStart();\n            }\n            getTotalPaddingEnd() {\n                return this.getCompoundPaddingEnd();\n            }\n            getTotalPaddingTop() {\n                return this.getExtendedPaddingTop() + this.getVerticalOffset(true);\n            }\n            getTotalPaddingBottom() {\n                return this.getExtendedPaddingBottom() + this.getBottomVerticalOffset(true);\n            }\n            setCompoundDrawables(left, top, right, bottom) {\n                let dr = this.mDrawables;\n                const drawables = left != null || top != null || right != null || bottom != null;\n                if (!drawables) {\n                    if (dr != null) {\n                        if (dr.mDrawablePadding == 0) {\n                            this.mDrawables = null;\n                        }\n                        else {\n                            if (dr.mDrawableLeft != null) {\n                                dr.mDrawableLeft.setCallback(null);\n                            }\n                            dr.mDrawableLeft = null;\n                            if (dr.mDrawableTop != null) {\n                                dr.mDrawableTop.setCallback(null);\n                            }\n                            dr.mDrawableTop = null;\n                            if (dr.mDrawableRight != null) {\n                                dr.mDrawableRight.setCallback(null);\n                            }\n                            dr.mDrawableRight = null;\n                            if (dr.mDrawableBottom != null) {\n                                dr.mDrawableBottom.setCallback(null);\n                            }\n                            dr.mDrawableBottom = null;\n                            dr.mDrawableSizeLeft = dr.mDrawableHeightLeft = 0;\n                            dr.mDrawableSizeRight = dr.mDrawableHeightRight = 0;\n                            dr.mDrawableSizeTop = dr.mDrawableWidthTop = 0;\n                            dr.mDrawableSizeBottom = dr.mDrawableWidthBottom = 0;\n                        }\n                    }\n                }\n                else {\n                    if (dr == null) {\n                        this.mDrawables = dr = new TextView.Drawables();\n                    }\n                    this.mDrawables.mOverride = false;\n                    if (dr.mDrawableLeft != left && dr.mDrawableLeft != null) {\n                        dr.mDrawableLeft.setCallback(null);\n                    }\n                    dr.mDrawableLeft = left;\n                    if (dr.mDrawableTop != top && dr.mDrawableTop != null) {\n                        dr.mDrawableTop.setCallback(null);\n                    }\n                    dr.mDrawableTop = top;\n                    if (dr.mDrawableRight != right && dr.mDrawableRight != null) {\n                        dr.mDrawableRight.setCallback(null);\n                    }\n                    dr.mDrawableRight = right;\n                    if (dr.mDrawableBottom != bottom && dr.mDrawableBottom != null) {\n                        dr.mDrawableBottom.setCallback(null);\n                    }\n                    dr.mDrawableBottom = bottom;\n                    const compoundRect = dr.mCompoundRect;\n                    let state;\n                    state = this.getDrawableState();\n                    if (left != null) {\n                        left.setState(state);\n                        left.copyBounds(compoundRect);\n                        left.setCallback(this);\n                        dr.mDrawableSizeLeft = compoundRect.width();\n                        dr.mDrawableHeightLeft = compoundRect.height();\n                    }\n                    else {\n                        dr.mDrawableSizeLeft = dr.mDrawableHeightLeft = 0;\n                    }\n                    if (right != null) {\n                        right.setState(state);\n                        right.copyBounds(compoundRect);\n                        right.setCallback(this);\n                        dr.mDrawableSizeRight = compoundRect.width();\n                        dr.mDrawableHeightRight = compoundRect.height();\n                    }\n                    else {\n                        dr.mDrawableSizeRight = dr.mDrawableHeightRight = 0;\n                    }\n                    if (top != null) {\n                        top.setState(state);\n                        top.copyBounds(compoundRect);\n                        top.setCallback(this);\n                        dr.mDrawableSizeTop = compoundRect.height();\n                        dr.mDrawableWidthTop = compoundRect.width();\n                    }\n                    else {\n                        dr.mDrawableSizeTop = dr.mDrawableWidthTop = 0;\n                    }\n                    if (bottom != null) {\n                        bottom.setState(state);\n                        bottom.copyBounds(compoundRect);\n                        bottom.setCallback(this);\n                        dr.mDrawableSizeBottom = compoundRect.height();\n                        dr.mDrawableWidthBottom = compoundRect.width();\n                    }\n                    else {\n                        dr.mDrawableSizeBottom = dr.mDrawableWidthBottom = 0;\n                    }\n                }\n                if (dr != null) {\n                    dr.mDrawableLeftInitial = left;\n                    dr.mDrawableRightInitial = right;\n                }\n                this.resetResolvedDrawables();\n                this.resolveDrawables();\n                this.invalidate();\n                this.requestLayout();\n            }\n            setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom) {\n                if (left != null) {\n                    left.setBounds(0, 0, left.getIntrinsicWidth(), left.getIntrinsicHeight());\n                }\n                if (right != null) {\n                    right.setBounds(0, 0, right.getIntrinsicWidth(), right.getIntrinsicHeight());\n                }\n                if (top != null) {\n                    top.setBounds(0, 0, top.getIntrinsicWidth(), top.getIntrinsicHeight());\n                }\n                if (bottom != null) {\n                    bottom.setBounds(0, 0, bottom.getIntrinsicWidth(), bottom.getIntrinsicHeight());\n                }\n                this.setCompoundDrawables(left, top, right, bottom);\n            }\n            setCompoundDrawablesRelative(start, top, end, bottom) {\n                let dr = this.mDrawables;\n                const drawables = start != null || top != null || end != null || bottom != null;\n                if (!drawables) {\n                    if (dr != null) {\n                        if (dr.mDrawablePadding == 0) {\n                            this.mDrawables = null;\n                        }\n                        else {\n                            if (dr.mDrawableStart != null) {\n                                dr.mDrawableStart.setCallback(null);\n                            }\n                            dr.mDrawableStart = null;\n                            if (dr.mDrawableTop != null) {\n                                dr.mDrawableTop.setCallback(null);\n                            }\n                            dr.mDrawableTop = null;\n                            if (dr.mDrawableEnd != null) {\n                                dr.mDrawableEnd.setCallback(null);\n                            }\n                            dr.mDrawableEnd = null;\n                            if (dr.mDrawableBottom != null) {\n                                dr.mDrawableBottom.setCallback(null);\n                            }\n                            dr.mDrawableBottom = null;\n                            dr.mDrawableSizeStart = dr.mDrawableHeightStart = 0;\n                            dr.mDrawableSizeEnd = dr.mDrawableHeightEnd = 0;\n                            dr.mDrawableSizeTop = dr.mDrawableWidthTop = 0;\n                            dr.mDrawableSizeBottom = dr.mDrawableWidthBottom = 0;\n                        }\n                    }\n                }\n                else {\n                    if (dr == null) {\n                        this.mDrawables = dr = new TextView.Drawables();\n                    }\n                    this.mDrawables.mOverride = true;\n                    if (dr.mDrawableStart != start && dr.mDrawableStart != null) {\n                        dr.mDrawableStart.setCallback(null);\n                    }\n                    dr.mDrawableStart = start;\n                    if (dr.mDrawableTop != top && dr.mDrawableTop != null) {\n                        dr.mDrawableTop.setCallback(null);\n                    }\n                    dr.mDrawableTop = top;\n                    if (dr.mDrawableEnd != end && dr.mDrawableEnd != null) {\n                        dr.mDrawableEnd.setCallback(null);\n                    }\n                    dr.mDrawableEnd = end;\n                    if (dr.mDrawableBottom != bottom && dr.mDrawableBottom != null) {\n                        dr.mDrawableBottom.setCallback(null);\n                    }\n                    dr.mDrawableBottom = bottom;\n                    const compoundRect = dr.mCompoundRect;\n                    let state;\n                    state = this.getDrawableState();\n                    if (start != null) {\n                        start.setState(state);\n                        start.copyBounds(compoundRect);\n                        start.setCallback(this);\n                        dr.mDrawableSizeStart = compoundRect.width();\n                        dr.mDrawableHeightStart = compoundRect.height();\n                    }\n                    else {\n                        dr.mDrawableSizeStart = dr.mDrawableHeightStart = 0;\n                    }\n                    if (end != null) {\n                        end.setState(state);\n                        end.copyBounds(compoundRect);\n                        end.setCallback(this);\n                        dr.mDrawableSizeEnd = compoundRect.width();\n                        dr.mDrawableHeightEnd = compoundRect.height();\n                    }\n                    else {\n                        dr.mDrawableSizeEnd = dr.mDrawableHeightEnd = 0;\n                    }\n                    if (top != null) {\n                        top.setState(state);\n                        top.copyBounds(compoundRect);\n                        top.setCallback(this);\n                        dr.mDrawableSizeTop = compoundRect.height();\n                        dr.mDrawableWidthTop = compoundRect.width();\n                    }\n                    else {\n                        dr.mDrawableSizeTop = dr.mDrawableWidthTop = 0;\n                    }\n                    if (bottom != null) {\n                        bottom.setState(state);\n                        bottom.copyBounds(compoundRect);\n                        bottom.setCallback(this);\n                        dr.mDrawableSizeBottom = compoundRect.height();\n                        dr.mDrawableWidthBottom = compoundRect.width();\n                    }\n                    else {\n                        dr.mDrawableSizeBottom = dr.mDrawableWidthBottom = 0;\n                    }\n                }\n                this.resetResolvedDrawables();\n                this.resolveDrawables();\n                this.invalidate();\n                this.requestLayout();\n            }\n            setCompoundDrawablesRelativeWithIntrinsicBounds(start, top, end, bottom) {\n                if (start != null) {\n                    start.setBounds(0, 0, start.getIntrinsicWidth(), start.getIntrinsicHeight());\n                }\n                if (end != null) {\n                    end.setBounds(0, 0, end.getIntrinsicWidth(), end.getIntrinsicHeight());\n                }\n                if (top != null) {\n                    top.setBounds(0, 0, top.getIntrinsicWidth(), top.getIntrinsicHeight());\n                }\n                if (bottom != null) {\n                    bottom.setBounds(0, 0, bottom.getIntrinsicWidth(), bottom.getIntrinsicHeight());\n                }\n                this.setCompoundDrawablesRelative(start, top, end, bottom);\n            }\n            getCompoundDrawables() {\n                const dr = this.mDrawables;\n                if (dr != null) {\n                    return [dr.mDrawableLeft, dr.mDrawableTop, dr.mDrawableRight, dr.mDrawableBottom];\n                }\n                else {\n                    return [null, null, null, null];\n                }\n            }\n            getCompoundDrawablesRelative() {\n                const dr = this.mDrawables;\n                if (dr != null) {\n                    return [dr.mDrawableStart, dr.mDrawableTop, dr.mDrawableEnd, dr.mDrawableBottom];\n                }\n                else {\n                    return [null, null, null, null];\n                }\n            }\n            setCompoundDrawablePadding(pad) {\n                let dr = this.mDrawables;\n                if (pad == 0) {\n                    if (dr != null) {\n                        dr.mDrawablePadding = pad;\n                    }\n                }\n                else {\n                    if (dr == null) {\n                        this.mDrawables = dr = new TextView.Drawables();\n                    }\n                    dr.mDrawablePadding = pad;\n                }\n                this.invalidate();\n                this.requestLayout();\n            }\n            getCompoundDrawablePadding() {\n                const dr = this.mDrawables;\n                return dr != null ? dr.mDrawablePadding : 0;\n            }\n            setPadding(left, top, right, bottom) {\n                if (left != this.mPaddingLeft || right != this.mPaddingRight || top != this.mPaddingTop || bottom != this.mPaddingBottom) {\n                    this.nullLayouts();\n                }\n                super.setPadding(left, top, right, bottom);\n                this.invalidate();\n            }\n            getAutoLinkMask() {\n                return this.mAutoLinkMask;\n            }\n            getTextLocale() {\n                return null;\n            }\n            setTextLocale(locale) {\n            }\n            getTextSize() {\n                return this.mTextPaint.getTextSize();\n            }\n            setTextSize(...args) {\n                if (args.length == 1) {\n                    this.setTextSize(TypedValue.COMPLEX_UNIT_SP, args[0]);\n                    return;\n                }\n                let [unit, size] = args;\n                this.setRawTextSize(TypedValue.applyDimension(unit, size, this.getResources().getDisplayMetrics()));\n            }\n            setRawTextSize(size) {\n                if (size != this.mTextPaint.getTextSize()) {\n                    this.mTextPaint.setTextSize(size);\n                    if (this.mLayout != null) {\n                        this.nullLayouts();\n                        this.requestLayout();\n                        this.invalidate();\n                    }\n                }\n            }\n            getTextScaleX() {\n                return 1;\n            }\n            setTextScaleX(size) {\n            }\n            getTypeface() {\n                return null;\n            }\n            setTextColor(colors) {\n                if (typeof colors === 'number') {\n                    colors = ColorStateList.valueOf(colors);\n                }\n                if (colors == null) {\n                    throw Error(`new NullPointerException()`);\n                }\n                this.mTextColor = colors;\n                this.updateTextColors();\n            }\n            getTextColors() {\n                return this.mTextColor;\n            }\n            getCurrentTextColor() {\n                return this.mCurTextColor;\n            }\n            setHighlightColor(color) {\n                if (this.mHighlightColor != color) {\n                    this.mHighlightColor = color;\n                    this.invalidate();\n                }\n            }\n            getHighlightColor() {\n                return this.mHighlightColor;\n            }\n            setShowSoftInputOnFocus(show) {\n                this.createEditorIfNeeded();\n            }\n            getShowSoftInputOnFocus() {\n                return false;\n            }\n            setShadowLayer(radius, dx, dy, color) {\n                this.mTextPaint.setShadowLayer(radius, dx, dy, color);\n                this.mShadowRadius = radius;\n                this.mShadowDx = dx;\n                this.mShadowDy = dy;\n                this.invalidate();\n            }\n            getShadowRadius() {\n                return this.mShadowRadius;\n            }\n            getShadowDx() {\n                return this.mShadowDx;\n            }\n            getShadowDy() {\n                return this.mShadowDy;\n            }\n            getShadowColor() {\n                return this.mTextPaint.shadowColor;\n            }\n            getPaint() {\n                return this.mTextPaint;\n            }\n            setAutoLinkMask(mask) {\n                this.mAutoLinkMask = mask;\n            }\n            setLinksClickable(whether) {\n                this.mLinksClickable = whether;\n            }\n            getLinksClickable() {\n                return this.mLinksClickable;\n            }\n            getUrls() {\n                return new Array(0);\n            }\n            setHintTextColor(colors) {\n                if (typeof colors === 'number') {\n                    colors = ColorStateList.valueOf(colors);\n                }\n                this.mHintTextColor = colors;\n                this.updateTextColors();\n            }\n            getHintTextColors() {\n                return this.mHintTextColor;\n            }\n            getCurrentHintTextColor() {\n                return this.mHintTextColor != null ? this.mCurHintTextColor : this.mCurTextColor;\n            }\n            setLinkTextColor(colors) {\n                if (typeof colors === 'number') {\n                    colors = ColorStateList.valueOf(colors);\n                }\n                this.mLinkTextColor = colors;\n                this.updateTextColors();\n            }\n            getLinkTextColors() {\n                return this.mLinkTextColor;\n            }\n            setGravity(gravity) {\n                if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == 0) {\n                    gravity |= Gravity.LEFT;\n                }\n                if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) {\n                    gravity |= Gravity.TOP;\n                }\n                let newLayout = false;\n                if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) != (this.mGravity & Gravity.HORIZONTAL_GRAVITY_MASK)) {\n                    newLayout = true;\n                }\n                if (gravity != this.mGravity) {\n                    this.invalidate();\n                }\n                this.mGravity = gravity;\n                if (this.mLayout != null && newLayout) {\n                    let want = this.mLayout.getWidth();\n                    let hintWant = this.mHintLayout == null ? 0 : this.mHintLayout.getWidth();\n                    this.makeNewLayout(want, hintWant, TextView.UNKNOWN_BORING, TextView.UNKNOWN_BORING, this.mRight - this.mLeft - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight(), true);\n                }\n            }\n            getGravity() {\n                return this.mGravity;\n            }\n            getPaintFlags() {\n                return this.mTextPaint.getFlags();\n            }\n            setPaintFlags(flags) {\n                if (this.mTextPaint.getFlags() != flags) {\n                    this.mTextPaint.setFlags(flags);\n                    if (this.mLayout != null) {\n                        this.nullLayouts();\n                        this.requestLayout();\n                        this.invalidate();\n                    }\n                }\n            }\n            setHorizontallyScrolling(whether) {\n                if (this.mHorizontallyScrolling != whether) {\n                    this.mHorizontallyScrolling = whether;\n                    if (this.mLayout != null) {\n                        this.nullLayouts();\n                        this.requestLayout();\n                        this.invalidate();\n                    }\n                }\n            }\n            getHorizontallyScrolling() {\n                return this.mHorizontallyScrolling;\n            }\n            setMinLines(minlines) {\n                this.mMinimum = minlines;\n                this.mMinMode = TextView.LINES;\n                this.requestLayout();\n                this.invalidate();\n            }\n            getMinLines() {\n                return this.mMinMode == TextView.LINES ? this.mMinimum : -1;\n            }\n            setMinHeight(minHeight) {\n                this.mMinimum = minHeight;\n                this.mMinMode = TextView.PIXELS;\n                this.requestLayout();\n                this.invalidate();\n            }\n            getMinHeight() {\n                return this.mMinMode == TextView.PIXELS ? this.mMinimum : -1;\n            }\n            setMaxLines(maxlines) {\n                this.mMaximum = maxlines;\n                this.mMaxMode = TextView.LINES;\n                this.requestLayout();\n                this.invalidate();\n            }\n            getMaxLines() {\n                return this.mMaxMode == TextView.LINES ? this.mMaximum : -1;\n            }\n            setMaxHeight(maxHeight) {\n                this.mMaximum = maxHeight;\n                this.mMaxMode = TextView.PIXELS;\n                this.requestLayout();\n                this.invalidate();\n            }\n            getMaxHeight() {\n                return this.mMaxMode == TextView.PIXELS ? this.mMaximum : -1;\n            }\n            setLines(lines) {\n                this.mMaximum = this.mMinimum = lines;\n                this.mMaxMode = this.mMinMode = TextView.LINES;\n                this.requestLayout();\n                this.invalidate();\n            }\n            setHeight(pixels) {\n                this.mMaximum = this.mMinimum = pixels;\n                this.mMaxMode = this.mMinMode = TextView.PIXELS;\n                this.requestLayout();\n                this.invalidate();\n            }\n            setMinEms(minems) {\n                this.mMinWidthValue = minems;\n                this.mMinWidthMode = TextView.EMS;\n                this.requestLayout();\n                this.invalidate();\n            }\n            getMinEms() {\n                return this.mMinWidthMode == TextView.EMS ? this.mMinWidthValue : -1;\n            }\n            setMinWidth(minpixels) {\n                this.mMinWidthValue = minpixels;\n                this.mMinWidthMode = TextView.PIXELS;\n                this.requestLayout();\n                this.invalidate();\n            }\n            getMinWidth() {\n                return this.mMinWidthMode == TextView.PIXELS ? this.mMinWidthValue : -1;\n            }\n            setMaxEms(maxems) {\n                this.mMaxWidthValue = maxems;\n                this.mMaxWidthMode = TextView.EMS;\n                this.requestLayout();\n                this.invalidate();\n            }\n            getMaxEms() {\n                return this.mMaxWidthMode == TextView.EMS ? this.mMaxWidthValue : -1;\n            }\n            setMaxWidth(maxpixels) {\n                this.mMaxWidthValue = maxpixels;\n                this.mMaxWidthMode = TextView.PIXELS;\n                this.requestLayout();\n                this.invalidate();\n            }\n            getMaxWidth() {\n                return this.mMaxWidthMode == TextView.PIXELS ? this.mMaxWidthValue : -1;\n            }\n            setEms(ems) {\n                this.mMaxWidthValue = this.mMinWidthValue = ems;\n                this.mMaxWidthMode = this.mMinWidthMode = TextView.EMS;\n                this.requestLayout();\n                this.invalidate();\n            }\n            setWidth(pixels) {\n                this.mMaxWidthValue = this.mMinWidthValue = pixels;\n                this.mMaxWidthMode = this.mMinWidthMode = TextView.PIXELS;\n                this.requestLayout();\n                this.invalidate();\n            }\n            setLineSpacing(add, mult) {\n                if (this.mSpacingAdd != add || this.mSpacingMult != mult) {\n                    this.mSpacingAdd = add;\n                    this.mSpacingMult = mult;\n                    if (this.mLayout != null) {\n                        this.nullLayouts();\n                        this.requestLayout();\n                        this.invalidate();\n                    }\n                }\n            }\n            getLineSpacingMultiplier() {\n                return this.mSpacingMult;\n            }\n            getLineSpacingExtra() {\n                return this.mSpacingAdd;\n            }\n            updateTextColors() {\n                let inval = false;\n                let color = this.mTextColor.getColorForState(this.getDrawableState(), 0);\n                if (color != this.mCurTextColor) {\n                    this.mCurTextColor = color;\n                    inval = true;\n                }\n                if (this.mLinkTextColor != null) {\n                    color = this.mLinkTextColor.getColorForState(this.getDrawableState(), 0);\n                    if (color != this.mTextPaint.linkColor) {\n                        this.mTextPaint.linkColor = color;\n                        inval = true;\n                    }\n                }\n                if (this.mHintTextColor != null) {\n                    color = this.mHintTextColor.getColorForState(this.getDrawableState(), 0);\n                    if (color != this.mCurHintTextColor && this.mText.length == 0) {\n                        this.mCurHintTextColor = color;\n                        inval = true;\n                    }\n                }\n                if (inval) {\n                    this.invalidate();\n                }\n            }\n            drawableStateChanged() {\n                super.drawableStateChanged();\n                if (this.mTextColor != null && this.mTextColor.isStateful() || (this.mHintTextColor != null && this.mHintTextColor.isStateful()) || (this.mLinkTextColor != null && this.mLinkTextColor.isStateful())) {\n                    this.updateTextColors();\n                }\n                const dr = this.mDrawables;\n                if (dr != null) {\n                    let state = this.getDrawableState();\n                    if (dr.mDrawableTop != null && dr.mDrawableTop.isStateful()) {\n                        dr.mDrawableTop.setState(state);\n                    }\n                    if (dr.mDrawableBottom != null && dr.mDrawableBottom.isStateful()) {\n                        dr.mDrawableBottom.setState(state);\n                    }\n                    if (dr.mDrawableLeft != null && dr.mDrawableLeft.isStateful()) {\n                        dr.mDrawableLeft.setState(state);\n                    }\n                    if (dr.mDrawableRight != null && dr.mDrawableRight.isStateful()) {\n                        dr.mDrawableRight.setState(state);\n                    }\n                    if (dr.mDrawableStart != null && dr.mDrawableStart.isStateful()) {\n                        dr.mDrawableStart.setState(state);\n                    }\n                    if (dr.mDrawableEnd != null && dr.mDrawableEnd.isStateful()) {\n                        dr.mDrawableEnd.setState(state);\n                    }\n                }\n            }\n            removeMisspelledSpans(spannable) {\n            }\n            setFreezesText(freezesText) {\n                this.mFreezesText = freezesText;\n            }\n            getFreezesText() {\n                return this.mFreezesText;\n            }\n            setSpannableFactory(factory) {\n                this.mSpannableFactory = factory;\n                this.setText(this.mText);\n            }\n            setText(text, type = this.mBufferType, notifyBefore = true, oldlen = 0) {\n                if (text == null) {\n                    text = \"\";\n                }\n                if (!this.isSuggestionsEnabled()) {\n                    text = this.removeSuggestionSpans(text);\n                }\n                if (Spanned.isImplements(text) && text.getSpanStart(TextUtils.TruncateAt.MARQUEE) >= 0) {\n                    this.setHorizontalFadingEdgeEnabled(true);\n                    this.mMarqueeFadeMode = TextView.MARQUEE_FADE_NORMAL;\n                    this.setEllipsize(TextUtils.TruncateAt.MARQUEE);\n                }\n                if (notifyBefore) {\n                    if (this.mText != null) {\n                        oldlen = this.mText.length;\n                        this.sendBeforeTextChanged(this.mText, 0, oldlen, text.length);\n                    }\n                    else {\n                        this.sendBeforeTextChanged(\"\", 0, 0, text.length);\n                    }\n                }\n                let needEditableForNotification = false;\n                if (this.mListeners != null && this.mListeners.size() != 0) {\n                    needEditableForNotification = true;\n                }\n                if (type == TextView.BufferType.SPANNABLE || this.mMovement != null) {\n                    text = this.mSpannableFactory.newSpannable(text);\n                }\n                this.mBufferType = type;\n                this.mText = text;\n                if (this.mTransformation == null) {\n                    this.mTransformed = text;\n                }\n                else {\n                    this.mTransformed = this.mTransformation.getTransformation(text, this);\n                }\n                const textLength = text.length;\n                if (this.mLayout != null) {\n                    this.checkForRelayout();\n                }\n                this.sendOnTextChanged(text, 0, oldlen, textLength);\n                this.onTextChanged(text, 0, oldlen, textLength);\n            }\n            setHint(hint) {\n                this.mHint = hint;\n                if (this.mLayout != null) {\n                    this.checkForRelayout();\n                }\n                if (this.mText.length == 0) {\n                    this.invalidate();\n                }\n            }\n            getHint() {\n                return this.mHint;\n            }\n            isSingleLine() {\n                return this.mSingleLine;\n            }\n            static isMultilineInputType(type) {\n                return true;\n            }\n            removeSuggestionSpans(text) {\n                return text;\n            }\n            hasPasswordTransformationMethod() {\n                return false;\n            }\n            static isPasswordInputType(inputType) {\n                return false;\n            }\n            static isVisiblePasswordInputType(inputType) {\n                return true;\n            }\n            setRawInputType(type) {\n            }\n            setInputType(type, direct = false) {\n            }\n            getInputType() {\n                return 0;\n            }\n            setImeOptions(imeOptions) {\n            }\n            getImeOptions() {\n                return -1;\n            }\n            setImeActionLabel(label, actionId) {\n                this.createEditorIfNeeded();\n            }\n            getImeActionLabel() {\n                return '';\n            }\n            getImeActionId() {\n                return 0;\n            }\n            setOnEditorActionListener(l) {\n                this.createEditorIfNeeded();\n            }\n            setFrame(l, t, r, b) {\n                let result = super.setFrame(l, t, r, b);\n                this.restartMarqueeIfNeeded();\n                return result;\n            }\n            restartMarqueeIfNeeded() {\n                if (this.mRestartMarquee && this.mEllipsize == TextUtils.TruncateAt.MARQUEE) {\n                    this.mRestartMarquee = false;\n                    this.startMarquee();\n                }\n            }\n            setFilters(...args) {\n            }\n            getFilters() {\n                return this.mFilters;\n            }\n            getBoxHeight(l) {\n                let padding = (l == this.mHintLayout) ? this.getCompoundPaddingTop() + this.getCompoundPaddingBottom() : this.getExtendedPaddingTop() + this.getExtendedPaddingBottom();\n                return this.getMeasuredHeight() - padding;\n            }\n            getVerticalOffset(forceNormal) {\n                let voffset = 0;\n                const gravity = this.mGravity & Gravity.VERTICAL_GRAVITY_MASK;\n                let l = this.mLayout;\n                if (!forceNormal && this.mText.length == 0 && this.mHintLayout != null) {\n                    l = this.mHintLayout;\n                }\n                if (gravity != Gravity.TOP) {\n                    let boxht = this.getBoxHeight(l);\n                    let textht = l.getHeight();\n                    if (textht < boxht) {\n                        if (gravity == Gravity.BOTTOM)\n                            voffset = boxht - textht;\n                        else\n                            voffset = (boxht - textht) >> 1;\n                    }\n                }\n                return voffset;\n            }\n            getBottomVerticalOffset(forceNormal) {\n                let voffset = 0;\n                const gravity = this.mGravity & Gravity.VERTICAL_GRAVITY_MASK;\n                let l = this.mLayout;\n                if (!forceNormal && this.mText.length == 0 && this.mHintLayout != null) {\n                    l = this.mHintLayout;\n                }\n                if (gravity != Gravity.BOTTOM) {\n                    let boxht = this.getBoxHeight(l);\n                    let textht = l.getHeight();\n                    if (textht < boxht) {\n                        if (gravity == Gravity.TOP)\n                            voffset = boxht - textht;\n                        else\n                            voffset = (boxht - textht) >> 1;\n                    }\n                }\n                return voffset;\n            }\n            invalidateRegion(start, end, invalidateCursor) {\n                if (this.mLayout == null) {\n                    this.invalidate();\n                }\n                else {\n                    let lineStart = this.mLayout.getLineForOffset(start);\n                    let top = this.mLayout.getLineTop(lineStart);\n                    if (lineStart > 0) {\n                        top -= this.mLayout.getLineDescent(lineStart - 1);\n                    }\n                    let lineEnd;\n                    if (start == end)\n                        lineEnd = lineStart;\n                    else\n                        lineEnd = this.mLayout.getLineForOffset(end);\n                    let bottom = this.mLayout.getLineBottom(lineEnd);\n                    const compoundPaddingLeft = this.getCompoundPaddingLeft();\n                    const verticalPadding = this.getExtendedPaddingTop() + this.getVerticalOffset(true);\n                    let left, right;\n                    if (lineStart == lineEnd && !invalidateCursor) {\n                        left = Math.floor(this.mLayout.getPrimaryHorizontal(start));\n                        right = Math.floor((this.mLayout.getPrimaryHorizontal(end) + 1.0));\n                        left += compoundPaddingLeft;\n                        right += compoundPaddingLeft;\n                    }\n                    else {\n                        left = compoundPaddingLeft;\n                        right = this.getWidth() - this.getCompoundPaddingRight();\n                    }\n                    this.invalidate(this.mScrollX + left, verticalPadding + top, this.mScrollX + right, verticalPadding + bottom);\n                }\n            }\n            registerForPreDraw() {\n                if (!this.mPreDrawRegistered) {\n                    this.getViewTreeObserver().addOnPreDrawListener(this);\n                    this.mPreDrawRegistered = true;\n                }\n            }\n            onPreDraw() {\n                if (this.mLayout == null) {\n                    this.assumeLayout();\n                }\n                if (this.mMovement != null) {\n                    let curs = this.getSelectionEnd();\n                    if (curs < 0 && (this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {\n                        curs = this.mText.length;\n                    }\n                    if (curs >= 0) {\n                        this.bringPointIntoView(curs);\n                    }\n                }\n                else {\n                    this.bringTextIntoView();\n                }\n                this.getViewTreeObserver().removeOnPreDrawListener(this);\n                this.mPreDrawRegistered = false;\n                return true;\n            }\n            onAttachedToWindow() {\n                super.onAttachedToWindow();\n                this.mTemporaryDetach = false;\n            }\n            onDetachedFromWindow() {\n                super.onDetachedFromWindow();\n                if (this.mPreDrawRegistered) {\n                    this.getViewTreeObserver().removeOnPreDrawListener(this);\n                    this.mPreDrawRegistered = false;\n                }\n                this.resetResolvedDrawables();\n            }\n            isPaddingOffsetRequired() {\n                return this.mShadowRadius != 0 || this.mDrawables != null;\n            }\n            getLeftPaddingOffset() {\n                return this.getCompoundPaddingLeft() - this.mPaddingLeft + Math.floor(Math.min(0, this.mShadowDx - this.mShadowRadius));\n            }\n            getTopPaddingOffset() {\n                return Math.floor(Math.min(0, this.mShadowDy - this.mShadowRadius));\n            }\n            getBottomPaddingOffset() {\n                return Math.floor(Math.max(0, this.mShadowDy + this.mShadowRadius));\n            }\n            getRightPaddingOffset() {\n                return -(this.getCompoundPaddingRight() - this.mPaddingRight) + Math.floor(Math.max(0, this.mShadowDx + this.mShadowRadius));\n            }\n            verifyDrawable(who) {\n                const verified = super.verifyDrawable(who);\n                if (!verified && this.mDrawables != null) {\n                    return who == this.mDrawables.mDrawableLeft || who == this.mDrawables.mDrawableTop || who == this.mDrawables.mDrawableRight || who == this.mDrawables.mDrawableBottom || who == this.mDrawables.mDrawableStart || who == this.mDrawables.mDrawableEnd;\n                }\n                return verified;\n            }\n            jumpDrawablesToCurrentState() {\n                super.jumpDrawablesToCurrentState();\n                if (this.mDrawables != null) {\n                    if (this.mDrawables.mDrawableLeft != null) {\n                        this.mDrawables.mDrawableLeft.jumpToCurrentState();\n                    }\n                    if (this.mDrawables.mDrawableTop != null) {\n                        this.mDrawables.mDrawableTop.jumpToCurrentState();\n                    }\n                    if (this.mDrawables.mDrawableRight != null) {\n                        this.mDrawables.mDrawableRight.jumpToCurrentState();\n                    }\n                    if (this.mDrawables.mDrawableBottom != null) {\n                        this.mDrawables.mDrawableBottom.jumpToCurrentState();\n                    }\n                    if (this.mDrawables.mDrawableStart != null) {\n                        this.mDrawables.mDrawableStart.jumpToCurrentState();\n                    }\n                    if (this.mDrawables.mDrawableEnd != null) {\n                        this.mDrawables.mDrawableEnd.jumpToCurrentState();\n                    }\n                }\n            }\n            drawableSizeChange(d) {\n                const drawables = this.mDrawables;\n                const isCompoundDrawable = drawables != null && (d == drawables.mDrawableLeft || d == drawables.mDrawableTop\n                    || d == drawables.mDrawableRight || d == drawables.mDrawableBottom || d == drawables.mDrawableStart || d == drawables.mDrawableEnd);\n                if (isCompoundDrawable) {\n                    d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());\n                    this.setCompoundDrawables(drawables.mDrawableLeft, drawables.mDrawableTop, drawables.mDrawableRight, drawables.mDrawableBottom);\n                }\n                else {\n                    super.drawableSizeChange(d);\n                }\n            }\n            invalidateDrawable(drawable) {\n                if (this.verifyDrawable(drawable)) {\n                    const dirty = drawable.getBounds();\n                    let scrollX = this.mScrollX;\n                    let scrollY = this.mScrollY;\n                    const drawables = this.mDrawables;\n                    if (drawables != null) {\n                        if (drawable == drawables.mDrawableLeft) {\n                            const compoundPaddingTop = this.getCompoundPaddingTop();\n                            const compoundPaddingBottom = this.getCompoundPaddingBottom();\n                            const vspace = this.mBottom - this.mTop - compoundPaddingBottom - compoundPaddingTop;\n                            scrollX += this.mPaddingLeft;\n                            scrollY += compoundPaddingTop + (vspace - drawables.mDrawableHeightLeft) / 2;\n                        }\n                        else if (drawable == drawables.mDrawableRight) {\n                            const compoundPaddingTop = this.getCompoundPaddingTop();\n                            const compoundPaddingBottom = this.getCompoundPaddingBottom();\n                            const vspace = this.mBottom - this.mTop - compoundPaddingBottom - compoundPaddingTop;\n                            scrollX += (this.mRight - this.mLeft - this.mPaddingRight - drawables.mDrawableSizeRight);\n                            scrollY += compoundPaddingTop + (vspace - drawables.mDrawableHeightRight) / 2;\n                        }\n                        else if (drawable == drawables.mDrawableTop) {\n                            const compoundPaddingLeft = this.getCompoundPaddingLeft();\n                            const compoundPaddingRight = this.getCompoundPaddingRight();\n                            const hspace = this.mRight - this.mLeft - compoundPaddingRight - compoundPaddingLeft;\n                            scrollX += compoundPaddingLeft + (hspace - drawables.mDrawableWidthTop) / 2;\n                            scrollY += this.mPaddingTop;\n                        }\n                        else if (drawable == drawables.mDrawableBottom) {\n                            const compoundPaddingLeft = this.getCompoundPaddingLeft();\n                            const compoundPaddingRight = this.getCompoundPaddingRight();\n                            const hspace = this.mRight - this.mLeft - compoundPaddingRight - compoundPaddingLeft;\n                            scrollX += compoundPaddingLeft + (hspace - drawables.mDrawableWidthBottom) / 2;\n                            scrollY += (this.mBottom - this.mTop - this.mPaddingBottom - drawables.mDrawableSizeBottom);\n                        }\n                    }\n                    this.invalidate(dirty.left + scrollX, dirty.top + scrollY, dirty.right + scrollX, dirty.bottom + scrollY);\n                }\n            }\n            isTextSelectable() {\n                return false;\n            }\n            setTextIsSelectable(selectable) {\n            }\n            onCreateDrawableState(extraSpace) {\n                let drawableState;\n                if (this.mSingleLine) {\n                    drawableState = super.onCreateDrawableState(extraSpace);\n                }\n                else {\n                    drawableState = super.onCreateDrawableState(extraSpace + 1);\n                    TextView.mergeDrawableStates(drawableState, TextView.MULTILINE_STATE_SET);\n                }\n                if (this.isTextSelectable()) {\n                    const length = drawableState.length;\n                    for (let i = 0; i < length; i++) {\n                        if (drawableState[i] == View.VIEW_STATE_PRESSED) {\n                            const nonPressedState = androidui.util.ArrayCreator.newNumberArray(length - 1);\n                            System.arraycopy(drawableState, 0, nonPressedState, 0, i);\n                            System.arraycopy(drawableState, i + 1, nonPressedState, i, length - i - 1);\n                            return nonPressedState;\n                        }\n                    }\n                }\n                return drawableState;\n            }\n            getUpdatedHighlightPath() {\n                let highlight = null;\n                let highlightPaint = this.mHighlightPaint;\n                const selStart = this.getSelectionStart();\n                const selEnd = this.getSelectionEnd();\n                if (this.mMovement != null && (this.isFocused() || this.isPressed()) && selStart >= 0) {\n                    if (selStart == selEnd) {\n                    }\n                    else {\n                        if (this.mHighlightPathBogus) {\n                            if (this.mHighlightPath == null)\n                                this.mHighlightPath = new Path();\n                            this.mHighlightPath.reset();\n                            this.mLayout.getSelectionPath(selStart, selEnd, this.mHighlightPath);\n                            this.mHighlightPathBogus = false;\n                        }\n                        highlightPaint.setColor(this.mHighlightColor);\n                        highlightPaint.setStyle(Paint.Style.FILL);\n                        highlight = this.mHighlightPath;\n                    }\n                }\n                return highlight;\n            }\n            getHorizontalOffsetForDrawables() {\n                return 0;\n            }\n            onDraw(canvas) {\n                this.restartMarqueeIfNeeded();\n                super.onDraw(canvas);\n                const compoundPaddingLeft = this.getCompoundPaddingLeft();\n                const compoundPaddingTop = this.getCompoundPaddingTop();\n                const compoundPaddingRight = this.getCompoundPaddingRight();\n                const compoundPaddingBottom = this.getCompoundPaddingBottom();\n                const scrollX = this.mScrollX;\n                const scrollY = this.mScrollY;\n                const right = this.mRight;\n                const left = this.mLeft;\n                const bottom = this.mBottom;\n                const top = this.mTop;\n                const isLayoutRtl = this.isLayoutRtl();\n                const offset = this.getHorizontalOffsetForDrawables();\n                const leftOffset = isLayoutRtl ? 0 : offset;\n                const rightOffset = isLayoutRtl ? offset : 0;\n                const dr = this.mDrawables;\n                if (dr != null) {\n                    let vspace = bottom - top - compoundPaddingBottom - compoundPaddingTop;\n                    let hspace = right - left - compoundPaddingRight - compoundPaddingLeft;\n                    if (dr.mDrawableLeft != null) {\n                        canvas.save();\n                        canvas.translate(scrollX + this.mPaddingLeft + leftOffset, scrollY + compoundPaddingTop + (vspace - dr.mDrawableHeightLeft) / 2);\n                        dr.mDrawableLeft.draw(canvas);\n                        canvas.restore();\n                    }\n                    if (dr.mDrawableRight != null) {\n                        canvas.save();\n                        canvas.translate(scrollX + right - left - this.mPaddingRight - dr.mDrawableSizeRight - rightOffset, scrollY + compoundPaddingTop + (vspace - dr.mDrawableHeightRight) / 2);\n                        dr.mDrawableRight.draw(canvas);\n                        canvas.restore();\n                    }\n                    if (dr.mDrawableTop != null) {\n                        canvas.save();\n                        canvas.translate(scrollX + compoundPaddingLeft + (hspace - dr.mDrawableWidthTop) / 2, scrollY + this.mPaddingTop);\n                        dr.mDrawableTop.draw(canvas);\n                        canvas.restore();\n                    }\n                    if (dr.mDrawableBottom != null) {\n                        canvas.save();\n                        canvas.translate(scrollX + compoundPaddingLeft + (hspace - dr.mDrawableWidthBottom) / 2, scrollY + bottom - top - this.mPaddingBottom - dr.mDrawableSizeBottom);\n                        dr.mDrawableBottom.draw(canvas);\n                        canvas.restore();\n                    }\n                }\n                let color = this.mCurTextColor;\n                if (this.mLayout == null) {\n                    this.assumeLayout();\n                }\n                let layout = this.mLayout;\n                if (this.mHint != null && this.mText.length == 0) {\n                    if (this.mHintTextColor != null) {\n                        color = this.mCurHintTextColor;\n                    }\n                    layout = this.mHintLayout;\n                }\n                this.mTextPaint.setColor(color);\n                this.mTextPaint.drawableState = this.getDrawableState();\n                if (this.mSkipDrawText)\n                    return;\n                canvas.save();\n                let extendedPaddingTop = this.getExtendedPaddingTop();\n                let extendedPaddingBottom = this.getExtendedPaddingBottom();\n                const vspace = this.mBottom - this.mTop - compoundPaddingBottom - compoundPaddingTop;\n                const maxScrollY = this.mLayout.getHeight() - vspace;\n                let clipLeft = compoundPaddingLeft + scrollX;\n                let clipTop = (scrollY == 0) ? 0 : extendedPaddingTop + scrollY;\n                let clipRight = right - left - compoundPaddingRight + scrollX;\n                let clipBottom = bottom - top + scrollY - ((scrollY == maxScrollY) ? 0 : extendedPaddingBottom);\n                if (this.mShadowRadius != 0) {\n                    clipLeft += Math.min(0, this.mShadowDx - this.mShadowRadius);\n                    clipRight += Math.max(0, this.mShadowDx + this.mShadowRadius);\n                    clipTop += Math.min(0, this.mShadowDy - this.mShadowRadius);\n                    clipBottom += Math.max(0, this.mShadowDy + this.mShadowRadius);\n                }\n                canvas.clipRect(clipLeft, clipTop, clipRight, clipBottom);\n                let voffsetText = 0;\n                let voffsetCursor = 0;\n                if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) != Gravity.TOP) {\n                    voffsetText = this.getVerticalOffset(false);\n                    voffsetCursor = this.getVerticalOffset(true);\n                }\n                canvas.translate(compoundPaddingLeft, extendedPaddingTop + voffsetText);\n                const absoluteGravity = this.mGravity;\n                if (this.mEllipsize == TextUtils.TruncateAt.MARQUEE && this.mMarqueeFadeMode != TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS) {\n                    if (!this.mSingleLine && this.getLineCount() == 1 && this.canMarquee() && (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) != Gravity.LEFT) {\n                        const width = this.mRight - this.mLeft;\n                        const padding = this.getCompoundPaddingLeft() + this.getCompoundPaddingRight();\n                        const dx = this.mLayout.getLineRight(0) - (width - padding);\n                        canvas.translate(isLayoutRtl ? -dx : +dx, 0.0);\n                    }\n                    if (this.mMarquee != null && this.mMarquee.isRunning()) {\n                        const dx = -this.mMarquee.getScroll();\n                        canvas.translate(isLayoutRtl ? -dx : +dx, 0.0);\n                    }\n                }\n                const cursorOffsetVertical = voffsetCursor - voffsetText;\n                let highlight = this.getUpdatedHighlightPath();\n                layout.draw(canvas, highlight, this.mHighlightPaint, cursorOffsetVertical);\n                if (this.mMarquee != null && this.mMarquee.shouldDrawGhost()) {\n                    const dx = Math.floor(this.mMarquee.getGhostOffset());\n                    canvas.translate(isLayoutRtl ? -dx : dx, 0.0);\n                    layout.draw(canvas, highlight, this.mHighlightPaint, cursorOffsetVertical);\n                }\n                canvas.restore();\n            }\n            getFocusedRect(r) {\n                if (this.mLayout == null) {\n                    super.getFocusedRect(r);\n                    return;\n                }\n                let selEnd = this.getSelectionEnd();\n                if (selEnd < 0) {\n                    super.getFocusedRect(r);\n                    return;\n                }\n            }\n            getLineCount() {\n                return this.mLayout != null ? this.mLayout.getLineCount() : 0;\n            }\n            getLineBounds(line, bounds) {\n                if (this.mLayout == null) {\n                    if (bounds != null) {\n                        bounds.set(0, 0, 0, 0);\n                    }\n                    return 0;\n                }\n                else {\n                    let baseline = this.mLayout.getLineBounds(line, bounds);\n                    let voffset = this.getExtendedPaddingTop();\n                    if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) != Gravity.TOP) {\n                        voffset += this.getVerticalOffset(true);\n                    }\n                    if (bounds != null) {\n                        bounds.offset(this.getCompoundPaddingLeft(), voffset);\n                    }\n                    return baseline + voffset;\n                }\n            }\n            getBaseline() {\n                if (this.mLayout == null) {\n                    return super.getBaseline();\n                }\n                let voffset = 0;\n                if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) != Gravity.TOP) {\n                    voffset = this.getVerticalOffset(true);\n                }\n                return this.getExtendedPaddingTop() + voffset + this.mLayout.getLineBaseline(0);\n            }\n            getFadeTop(offsetRequired) {\n                if (this.mLayout == null)\n                    return 0;\n                let voffset = 0;\n                if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) != Gravity.TOP) {\n                    voffset = this.getVerticalOffset(true);\n                }\n                if (offsetRequired)\n                    voffset += this.getTopPaddingOffset();\n                return this.getExtendedPaddingTop() + voffset;\n            }\n            getFadeHeight(offsetRequired) {\n                return this.mLayout != null ? this.mLayout.getHeight() : 0;\n            }\n            onKeyDown(keyCode, event) {\n                let which = this.doKeyDown(keyCode, event, null);\n                if (which == 0) {\n                    return super.onKeyDown(keyCode, event);\n                }\n                return true;\n            }\n            shouldAdvanceFocusOnEnter() {\n                if (this.getKeyListener() == null) {\n                    return false;\n                }\n                if (this.mSingleLine) {\n                    return true;\n                }\n                return false;\n            }\n            shouldAdvanceFocusOnTab() {\n                return true;\n            }\n            doKeyDown(keyCode, event, otherEvent) {\n                return 0;\n            }\n            resetErrorChangedFlag() {\n            }\n            hideErrorIfUnchanged() {\n            }\n            onKeyUp(keyCode, event) {\n                return super.onKeyUp(keyCode, event);\n            }\n            onCheckIsTextEditor() {\n                return false;\n            }\n            nullLayouts() {\n                if (this.mLayout instanceof BoringLayout && this.mSavedLayout == null) {\n                    this.mSavedLayout = this.mLayout;\n                }\n                if (this.mHintLayout instanceof BoringLayout && this.mSavedHintLayout == null) {\n                    this.mSavedHintLayout = this.mHintLayout;\n                }\n                this.mSavedMarqueeModeLayout = this.mLayout = this.mHintLayout = null;\n                this.mBoring = this.mHintBoring = null;\n            }\n            assumeLayout() {\n                let width = this.mRight - this.mLeft - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight();\n                if (width < 1) {\n                    width = 0;\n                }\n                let physicalWidth = width;\n                if (this.mHorizontallyScrolling) {\n                    width = TextView.VERY_WIDE;\n                }\n                this.makeNewLayout(width, physicalWidth, TextView.UNKNOWN_BORING, TextView.UNKNOWN_BORING, physicalWidth, false);\n            }\n            getLayoutAlignment() {\n                let alignment;\n                switch (this.mGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n                    case Gravity.LEFT:\n                        alignment = Layout.Alignment.ALIGN_LEFT;\n                        break;\n                    case Gravity.RIGHT:\n                        alignment = Layout.Alignment.ALIGN_RIGHT;\n                        break;\n                    case Gravity.CENTER_HORIZONTAL:\n                        alignment = Layout.Alignment.ALIGN_CENTER;\n                        break;\n                    default:\n                        alignment = Layout.Alignment.ALIGN_NORMAL;\n                        break;\n                }\n                return alignment;\n            }\n            makeNewLayout(wantWidth, hintWidth, boring, hintBoring, ellipsisWidth, bringIntoView) {\n                this.stopMarquee();\n                this.mOldMaximum = this.mMaximum;\n                this.mOldMaxMode = this.mMaxMode;\n                this.mHighlightPathBogus = true;\n                if (wantWidth < 0) {\n                    wantWidth = 0;\n                }\n                if (hintWidth < 0) {\n                    hintWidth = 0;\n                }\n                let alignment = this.getLayoutAlignment();\n                const testDirChange = this.mSingleLine && this.mLayout != null && (alignment == Layout.Alignment.ALIGN_NORMAL || alignment == Layout.Alignment.ALIGN_OPPOSITE);\n                let oldDir = 0;\n                if (testDirChange)\n                    oldDir = this.mLayout.getParagraphDirection(0);\n                let shouldEllipsize = this.mEllipsize != null && this.getKeyListener() == null;\n                const switchEllipsize = this.mEllipsize == TruncateAt.MARQUEE && this.mMarqueeFadeMode != TextView.MARQUEE_FADE_NORMAL;\n                let effectiveEllipsize = this.mEllipsize;\n                if (this.mEllipsize == TruncateAt.MARQUEE && this.mMarqueeFadeMode == TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS) {\n                    effectiveEllipsize = TruncateAt.END_SMALL;\n                }\n                if (this.mTextDir == null) {\n                    this.mTextDir = this.getTextDirectionHeuristic();\n                }\n                this.mLayout = this.makeSingleLayout(wantWidth, boring, ellipsisWidth, alignment, shouldEllipsize, effectiveEllipsize, effectiveEllipsize == this.mEllipsize);\n                if (switchEllipsize) {\n                    let oppositeEllipsize = effectiveEllipsize == TruncateAt.MARQUEE ? TruncateAt.END : TruncateAt.MARQUEE;\n                    this.mSavedMarqueeModeLayout = this.makeSingleLayout(wantWidth, boring, ellipsisWidth, alignment, shouldEllipsize, oppositeEllipsize, effectiveEllipsize != this.mEllipsize);\n                }\n                shouldEllipsize = this.mEllipsize != null;\n                this.mHintLayout = null;\n                if (this.mHint != null) {\n                    if (shouldEllipsize)\n                        hintWidth = wantWidth;\n                    if (hintBoring == TextView.UNKNOWN_BORING) {\n                        hintBoring = BoringLayout.isBoring(this.mHint, this.mTextPaint, this.mTextDir, this.mHintBoring);\n                        if (hintBoring != null) {\n                            this.mHintBoring = hintBoring;\n                        }\n                    }\n                    if (hintBoring != null) {\n                        if (hintBoring.width <= hintWidth && (!shouldEllipsize || hintBoring.width <= ellipsisWidth)) {\n                            if (this.mSavedHintLayout != null) {\n                                this.mHintLayout = this.mSavedHintLayout.replaceOrMake(this.mHint, this.mTextPaint, hintWidth, alignment, this.mSpacingMult, this.mSpacingAdd, hintBoring, this.mIncludePad);\n                            }\n                            else {\n                                this.mHintLayout = BoringLayout.make(this.mHint, this.mTextPaint, hintWidth, alignment, this.mSpacingMult, this.mSpacingAdd, hintBoring, this.mIncludePad);\n                            }\n                            this.mSavedHintLayout = this.mHintLayout;\n                        }\n                        else if (shouldEllipsize && hintBoring.width <= hintWidth) {\n                            if (this.mSavedHintLayout != null) {\n                                this.mHintLayout = this.mSavedHintLayout.replaceOrMake(this.mHint, this.mTextPaint, hintWidth, alignment, this.mSpacingMult, this.mSpacingAdd, hintBoring, this.mIncludePad, this.mEllipsize, ellipsisWidth);\n                            }\n                            else {\n                                this.mHintLayout = BoringLayout.make(this.mHint, this.mTextPaint, hintWidth, alignment, this.mSpacingMult, this.mSpacingAdd, hintBoring, this.mIncludePad, this.mEllipsize, ellipsisWidth);\n                            }\n                        }\n                        else if (shouldEllipsize) {\n                            this.mHintLayout = new StaticLayout(this.mHint, 0, this.mHint.length, this.mTextPaint, hintWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad, this.mEllipsize, ellipsisWidth, this.mMaxMode == TextView.LINES ? this.mMaximum : Integer.MAX_VALUE);\n                        }\n                        else {\n                            this.mHintLayout = new StaticLayout(this.mHint, 0, this.mHint.length, this.mTextPaint, hintWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad);\n                        }\n                    }\n                    else if (shouldEllipsize) {\n                        this.mHintLayout = new StaticLayout(this.mHint, 0, this.mHint.length, this.mTextPaint, hintWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad, this.mEllipsize, ellipsisWidth, this.mMaxMode == TextView.LINES ? this.mMaximum : Integer.MAX_VALUE);\n                    }\n                    else {\n                        this.mHintLayout = new StaticLayout(this.mHint, 0, this.mHint.length, this.mTextPaint, hintWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad);\n                    }\n                }\n                if (bringIntoView || (testDirChange && oldDir != this.mLayout.getParagraphDirection(0))) {\n                    this.registerForPreDraw();\n                }\n                if (this.mEllipsize == TextUtils.TruncateAt.MARQUEE) {\n                    if (!this.compressText(ellipsisWidth)) {\n                        const height = this.mLayoutParams.height;\n                        if (height != LayoutParams.WRAP_CONTENT && height != LayoutParams.MATCH_PARENT) {\n                            this.startMarquee();\n                        }\n                        else {\n                            this.mRestartMarquee = true;\n                        }\n                    }\n                }\n            }\n            makeSingleLayout(wantWidth, boring, ellipsisWidth, alignment, shouldEllipsize, effectiveEllipsize, useSaved) {\n                let result = null;\n                if (Spannable.isImpl(this.mText)) {\n                    result = new DynamicLayout(this.mText, this.mTransformed, this.mTextPaint, wantWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad, this.getKeyListener() == null ? effectiveEllipsize : null, ellipsisWidth);\n                }\n                else {\n                    if (boring == TextView.UNKNOWN_BORING) {\n                        boring = BoringLayout.isBoring(this.mTransformed, this.mTextPaint, this.mTextDir, this.mBoring);\n                        if (boring != null) {\n                            this.mBoring = boring;\n                        }\n                    }\n                    if (boring != null) {\n                        if (boring.width <= wantWidth && (effectiveEllipsize == null || boring.width <= ellipsisWidth)) {\n                            if (useSaved && this.mSavedLayout != null) {\n                                result = this.mSavedLayout.replaceOrMake(this.mTransformed, this.mTextPaint, wantWidth, alignment, this.mSpacingMult, this.mSpacingAdd, boring, this.mIncludePad);\n                            }\n                            else {\n                                result = BoringLayout.make(this.mTransformed, this.mTextPaint, wantWidth, alignment, this.mSpacingMult, this.mSpacingAdd, boring, this.mIncludePad);\n                            }\n                            if (useSaved) {\n                                this.mSavedLayout = result;\n                            }\n                        }\n                        else if (shouldEllipsize && boring.width <= wantWidth) {\n                            if (useSaved && this.mSavedLayout != null) {\n                                result = this.mSavedLayout.replaceOrMake(this.mTransformed, this.mTextPaint, wantWidth, alignment, this.mSpacingMult, this.mSpacingAdd, boring, this.mIncludePad, effectiveEllipsize, ellipsisWidth);\n                            }\n                            else {\n                                result = BoringLayout.make(this.mTransformed, this.mTextPaint, wantWidth, alignment, this.mSpacingMult, this.mSpacingAdd, boring, this.mIncludePad, effectiveEllipsize, ellipsisWidth);\n                            }\n                        }\n                        else if (shouldEllipsize) {\n                            result = new StaticLayout(this.mTransformed, 0, this.mTransformed.length, this.mTextPaint, wantWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad, effectiveEllipsize, ellipsisWidth, this.mMaxMode == TextView.LINES ? this.mMaximum : Integer.MAX_VALUE);\n                        }\n                        else {\n                            result = new StaticLayout(this.mTransformed, 0, this.mTransformed.length, this.mTextPaint, wantWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad);\n                        }\n                    }\n                    else if (shouldEllipsize) {\n                        result = new StaticLayout(this.mTransformed, 0, this.mTransformed.length, this.mTextPaint, wantWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad, effectiveEllipsize, ellipsisWidth, this.mMaxMode == TextView.LINES ? this.mMaximum : Integer.MAX_VALUE);\n                    }\n                    else {\n                        result = new StaticLayout(this.mTransformed, 0, this.mTransformed.length, this.mTextPaint, wantWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad);\n                    }\n                }\n                return result;\n            }\n            compressText(width) {\n                if (this.isHardwareAccelerated())\n                    return false;\n                if (width > 0.0 && this.mLayout != null && this.getLineCount() == 1 && !this.mUserSetTextScaleX && this.mTextPaint.getTextScaleX() == 1.0) {\n                    const textWidth = this.mLayout.getLineWidth(0);\n                    const overflow = (textWidth + 1.0 - width) / width;\n                    if (overflow > 0.0 && overflow <= TextView.Marquee.MARQUEE_DELTA_MAX) {\n                        this.mTextPaint.setTextScaleX(1.0 - overflow - 0.005);\n                        this.post((() => {\n                            const inner_this = this;\n                            class _Inner {\n                                run() {\n                                    inner_this.requestLayout();\n                                }\n                            }\n                            return new _Inner();\n                        })());\n                        return true;\n                    }\n                }\n                return false;\n            }\n            static desired(layout) {\n                let n = layout.getLineCount();\n                let text = layout.getText();\n                let max = 0;\n                for (let i = 0; i < n - 1; i++) {\n                    if (text.charAt(layout.getLineEnd(i) - 1) != '\\n')\n                        return -1;\n                }\n                for (let i = 0; i < n; i++) {\n                    max = Math.max(max, layout.getLineWidth(i));\n                }\n                return Math.floor(Math.ceil(max));\n            }\n            setIncludeFontPadding(includepad) {\n                if (this.mIncludePad != includepad) {\n                    this.mIncludePad = includepad;\n                    if (this.mLayout != null) {\n                        this.nullLayouts();\n                        this.requestLayout();\n                        this.invalidate();\n                    }\n                }\n            }\n            getIncludeFontPadding() {\n                return this.mIncludePad;\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                let widthMode = View.MeasureSpec.getMode(widthMeasureSpec);\n                let heightMode = View.MeasureSpec.getMode(heightMeasureSpec);\n                let widthSize = View.MeasureSpec.getSize(widthMeasureSpec);\n                let heightSize = View.MeasureSpec.getSize(heightMeasureSpec);\n                let width;\n                let height;\n                let boring = TextView.UNKNOWN_BORING;\n                let hintBoring = TextView.UNKNOWN_BORING;\n                if (this.mTextDir == null) {\n                    this.mTextDir = this.getTextDirectionHeuristic();\n                }\n                let des = -1;\n                let fromexisting = false;\n                if (widthMode == View.MeasureSpec.EXACTLY) {\n                    width = widthSize;\n                }\n                else {\n                    if (this.mLayout != null && this.mEllipsize == null) {\n                        des = TextView.desired(this.mLayout);\n                    }\n                    if (des < 0) {\n                        boring = BoringLayout.isBoring(this.mTransformed, this.mTextPaint, this.mTextDir, this.mBoring);\n                        if (boring != null) {\n                            this.mBoring = boring;\n                        }\n                    }\n                    else {\n                        fromexisting = true;\n                    }\n                    if (boring == null || boring == TextView.UNKNOWN_BORING) {\n                        if (des < 0) {\n                            des = Math.floor(Math.ceil(Layout.getDesiredWidth(this.mTransformed, this.mTextPaint)));\n                        }\n                        width = des;\n                    }\n                    else {\n                        width = boring.width;\n                    }\n                    const dr = this.mDrawables;\n                    if (dr != null) {\n                        width = Math.max(width, dr.mDrawableWidthTop);\n                        width = Math.max(width, dr.mDrawableWidthBottom);\n                    }\n                    if (this.mHint != null) {\n                        let hintDes = -1;\n                        let hintWidth;\n                        if (this.mHintLayout != null && this.mEllipsize == null) {\n                            hintDes = TextView.desired(this.mHintLayout);\n                        }\n                        if (hintDes < 0) {\n                            hintBoring = BoringLayout.isBoring(this.mHint, this.mTextPaint, this.mTextDir, this.mHintBoring);\n                            if (hintBoring != null) {\n                                this.mHintBoring = hintBoring;\n                            }\n                        }\n                        if (hintBoring == null || hintBoring == TextView.UNKNOWN_BORING) {\n                            if (hintDes < 0) {\n                                hintDes = Math.floor(Math.ceil(Layout.getDesiredWidth(this.mHint, this.mTextPaint)));\n                            }\n                            hintWidth = hintDes;\n                        }\n                        else {\n                            hintWidth = hintBoring.width;\n                        }\n                        if (hintWidth > width) {\n                            width = hintWidth;\n                        }\n                    }\n                    width += this.getCompoundPaddingLeft() + this.getCompoundPaddingRight();\n                    if (this.mMaxWidthMode == TextView.EMS) {\n                        width = Math.min(width, this.mMaxWidthValue * this.getLineHeight());\n                    }\n                    else {\n                        width = Math.min(width, this.mMaxWidthValue);\n                    }\n                    if (this.mMinWidthMode == TextView.EMS) {\n                        width = Math.max(width, this.mMinWidthValue * this.getLineHeight());\n                    }\n                    else {\n                        width = Math.max(width, this.mMinWidthValue);\n                    }\n                    width = Math.max(width, this.getSuggestedMinimumWidth());\n                    if (widthMode == View.MeasureSpec.AT_MOST) {\n                        width = Math.min(widthSize, width);\n                    }\n                }\n                let want = width - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight();\n                let unpaddedWidth = want;\n                if (this.mHorizontallyScrolling)\n                    want = TextView.VERY_WIDE;\n                let hintWant = want;\n                let hintWidth = (this.mHintLayout == null) ? hintWant : this.mHintLayout.getWidth();\n                if (this.mLayout == null) {\n                    this.makeNewLayout(want, hintWant, boring, hintBoring, width - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight(), false);\n                }\n                else {\n                    const layoutChanged = (this.mLayout.getWidth() != want) || (hintWidth != hintWant) || (this.mLayout.getEllipsizedWidth() != width - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight());\n                    const widthChanged = (this.mHint == null) && (this.mEllipsize == null) && (want > this.mLayout.getWidth()) && (this.mLayout instanceof BoringLayout || (fromexisting && des >= 0 && des <= want));\n                    const maximumChanged = (this.mMaxMode != this.mOldMaxMode) || (this.mMaximum != this.mOldMaximum);\n                    if (layoutChanged || maximumChanged) {\n                        if (!maximumChanged && widthChanged) {\n                            this.mLayout.increaseWidthTo(want);\n                        }\n                        else {\n                            this.makeNewLayout(want, hintWant, boring, hintBoring, width - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight(), false);\n                        }\n                    }\n                    else {\n                    }\n                }\n                if (heightMode == View.MeasureSpec.EXACTLY) {\n                    height = heightSize;\n                    this.mDesiredHeightAtMeasure = -1;\n                }\n                else {\n                    let desired = this.getDesiredHeight();\n                    height = desired;\n                    this.mDesiredHeightAtMeasure = desired;\n                    if (heightMode == View.MeasureSpec.AT_MOST) {\n                        height = Math.min(desired, heightSize);\n                    }\n                }\n                let unpaddedHeight = height - this.getCompoundPaddingTop() - this.getCompoundPaddingBottom();\n                if (this.mMaxMode == TextView.LINES && this.mLayout.getLineCount() > this.mMaximum) {\n                    unpaddedHeight = Math.min(unpaddedHeight, this.mLayout.getLineTop(this.mMaximum));\n                }\n                if (this.mMovement != null || this.mLayout.getWidth() > unpaddedWidth || this.mLayout.getHeight() > unpaddedHeight) {\n                    this.registerForPreDraw();\n                }\n                else {\n                    this.scrollTo(0, 0);\n                }\n                this.setMeasuredDimension(width, height);\n            }\n            getDesiredHeight(layout, cap = true) {\n                if (arguments.length === 0) {\n                    return Math.max(this.getDesiredHeight(this.mLayout, true), this.getDesiredHeight(this.mHintLayout, this.mEllipsize != null));\n                }\n                if (layout == null) {\n                    return 0;\n                }\n                let linecount = layout.getLineCount();\n                let pad = this.getCompoundPaddingTop() + this.getCompoundPaddingBottom();\n                let desired = layout.getLineTop(linecount);\n                const dr = this.mDrawables;\n                if (dr != null) {\n                    desired = Math.max(desired, dr.mDrawableHeightLeft);\n                    desired = Math.max(desired, dr.mDrawableHeightRight);\n                }\n                desired += pad;\n                if (this.mMaxMode == TextView.LINES) {\n                    if (cap) {\n                        if (linecount > this.mMaximum) {\n                            desired = layout.getLineTop(this.mMaximum);\n                            if (dr != null) {\n                                desired = Math.max(desired, dr.mDrawableHeightLeft);\n                                desired = Math.max(desired, dr.mDrawableHeightRight);\n                            }\n                            desired += pad;\n                            linecount = this.mMaximum;\n                        }\n                    }\n                }\n                else {\n                    desired = Math.min(desired, this.mMaximum);\n                }\n                if (this.mMinMode == TextView.LINES) {\n                    if (linecount < this.mMinimum) {\n                        desired += this.getLineHeight() * (this.mMinimum - linecount);\n                    }\n                }\n                else {\n                    desired = Math.max(desired, this.mMinimum);\n                }\n                desired = Math.max(desired, this.getSuggestedMinimumHeight());\n                return desired;\n            }\n            checkForResize() {\n                let sizeChanged = false;\n                if (this.mLayout != null) {\n                    if (this.mLayoutParams.width == LayoutParams.WRAP_CONTENT) {\n                        sizeChanged = true;\n                        this.invalidate();\n                    }\n                    if (this.mLayoutParams.height == LayoutParams.WRAP_CONTENT) {\n                        let desiredHeight = this.getDesiredHeight();\n                        if (desiredHeight != this.getHeight()) {\n                            sizeChanged = true;\n                        }\n                    }\n                    else if (this.mLayoutParams.height == LayoutParams.MATCH_PARENT) {\n                        if (this.mDesiredHeightAtMeasure >= 0) {\n                            let desiredHeight = this.getDesiredHeight();\n                            if (desiredHeight != this.mDesiredHeightAtMeasure) {\n                                sizeChanged = true;\n                            }\n                        }\n                    }\n                }\n                if (sizeChanged) {\n                    this.requestLayout();\n                }\n            }\n            checkForRelayout() {\n                if ((this.mLayoutParams.width != LayoutParams.WRAP_CONTENT || (this.mMaxWidthMode == this.mMinWidthMode && this.mMaxWidthValue == this.mMinWidthValue)) && (this.mHint == null || this.mHintLayout != null) && (this.mRight - this.mLeft - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight() > 0)) {\n                    let oldht = this.mLayout.getHeight();\n                    let want = this.mLayout.getWidth();\n                    let hintWant = this.mHintLayout == null ? 0 : this.mHintLayout.getWidth();\n                    this.makeNewLayout(want, hintWant, TextView.UNKNOWN_BORING, TextView.UNKNOWN_BORING, this.mRight - this.mLeft - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight(), false);\n                    if (this.mEllipsize != TextUtils.TruncateAt.MARQUEE) {\n                        if (this.mLayoutParams.height != LayoutParams.WRAP_CONTENT && this.mLayoutParams.height != LayoutParams.MATCH_PARENT) {\n                            this.invalidate();\n                            return;\n                        }\n                        if (this.mLayout.getHeight() == oldht && (this.mHintLayout == null || this.mHintLayout.getHeight() == oldht)) {\n                            this.invalidate();\n                            return;\n                        }\n                    }\n                    this.requestLayout();\n                    this.invalidate();\n                }\n                else {\n                    this.nullLayouts();\n                    this.requestLayout();\n                    this.invalidate();\n                }\n            }\n            onLayout(changed, left, top, right, bottom) {\n                super.onLayout(changed, left, top, right, bottom);\n                if (this.mDeferScroll >= 0) {\n                    let curs = this.mDeferScroll;\n                    this.mDeferScroll = -1;\n                    this.bringPointIntoView(Math.min(curs, this.mText.length));\n                }\n            }\n            isShowingHint() {\n                return TextUtils.isEmpty(this.mText) && !TextUtils.isEmpty(this.mHint);\n            }\n            bringTextIntoView() {\n                let layout = this.isShowingHint() ? this.mHintLayout : this.mLayout;\n                let line = 0;\n                if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {\n                    line = layout.getLineCount() - 1;\n                }\n                let a = layout.getParagraphAlignment(line);\n                let dir = layout.getParagraphDirection(line);\n                let hspace = this.mRight - this.mLeft - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight();\n                let vspace = this.mBottom - this.mTop - this.getExtendedPaddingTop() - this.getExtendedPaddingBottom();\n                let ht = layout.getHeight();\n                let scrollx, scrolly;\n                if (a == Layout.Alignment.ALIGN_NORMAL) {\n                    a = dir == Layout.DIR_LEFT_TO_RIGHT ? Layout.Alignment.ALIGN_LEFT : Layout.Alignment.ALIGN_RIGHT;\n                }\n                else if (a == Layout.Alignment.ALIGN_OPPOSITE) {\n                    a = dir == Layout.DIR_LEFT_TO_RIGHT ? Layout.Alignment.ALIGN_RIGHT : Layout.Alignment.ALIGN_LEFT;\n                }\n                if (a == Layout.Alignment.ALIGN_CENTER) {\n                    let left = Math.floor(Math.floor(layout.getLineLeft(line)));\n                    let right = Math.floor(Math.ceil(layout.getLineRight(line)));\n                    if (right - left < hspace) {\n                        scrollx = (right + left) / 2 - hspace / 2;\n                    }\n                    else {\n                        if (dir < 0) {\n                            scrollx = right - hspace;\n                        }\n                        else {\n                            scrollx = left;\n                        }\n                    }\n                }\n                else if (a == Layout.Alignment.ALIGN_RIGHT) {\n                    let right = Math.floor(Math.ceil(layout.getLineRight(line)));\n                    scrollx = right - hspace;\n                }\n                else {\n                    scrollx = Math.floor(Math.floor(layout.getLineLeft(line)));\n                }\n                if (ht < vspace) {\n                    scrolly = 0;\n                }\n                else {\n                    if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {\n                        scrolly = ht - vspace;\n                    }\n                    else {\n                        scrolly = 0;\n                    }\n                }\n                if (scrollx != this.mScrollX || scrolly != this.mScrollY) {\n                    this.scrollTo(scrollx, scrolly);\n                    return true;\n                }\n                else {\n                    return false;\n                }\n            }\n            bringPointIntoView(offset) {\n                if (this.isLayoutRequested()) {\n                    this.mDeferScroll = offset;\n                    return false;\n                }\n                let changed = false;\n                let layout = this.isShowingHint() ? this.mHintLayout : this.mLayout;\n                if (layout == null)\n                    return changed;\n                let line = layout.getLineForOffset(offset);\n                let grav;\n                switch (layout.getParagraphAlignment(line)) {\n                    case Layout.Alignment.ALIGN_LEFT:\n                        grav = 1;\n                        break;\n                    case Layout.Alignment.ALIGN_RIGHT:\n                        grav = -1;\n                        break;\n                    case Layout.Alignment.ALIGN_NORMAL:\n                        grav = layout.getParagraphDirection(line);\n                        break;\n                    case Layout.Alignment.ALIGN_OPPOSITE:\n                        grav = -layout.getParagraphDirection(line);\n                        break;\n                    case Layout.Alignment.ALIGN_CENTER:\n                    default:\n                        grav = 0;\n                        break;\n                }\n                const clamped = grav > 0;\n                const x = Math.floor(layout.getPrimaryHorizontal(offset, clamped));\n                const top = layout.getLineTop(line);\n                const bottom = layout.getLineTop(line + 1);\n                let left = Math.floor(Math.floor(layout.getLineLeft(line)));\n                let right = Math.floor(Math.ceil(layout.getLineRight(line)));\n                let ht = layout.getHeight();\n                let hspace = this.mRight - this.mLeft - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight();\n                let vspace = this.mBottom - this.mTop - this.getExtendedPaddingTop() - this.getExtendedPaddingBottom();\n                if (!this.mHorizontallyScrolling && right - left > hspace && right > x) {\n                    right = Math.max(x, left + hspace);\n                }\n                let hslack = (bottom - top) / 2;\n                let vslack = hslack;\n                if (vslack > vspace / 4)\n                    vslack = vspace / 4;\n                if (hslack > hspace / 4)\n                    hslack = hspace / 4;\n                let hs = this.mScrollX;\n                let vs = this.mScrollY;\n                if (top - vs < vslack)\n                    vs = top - vslack;\n                if (bottom - vs > vspace - vslack)\n                    vs = bottom - (vspace - vslack);\n                if (ht - vs < vspace)\n                    vs = ht - vspace;\n                if (0 - vs > 0)\n                    vs = 0;\n                if (grav != 0) {\n                    if (x - hs < hslack) {\n                        hs = x - hslack;\n                    }\n                    if (x - hs > hspace - hslack) {\n                        hs = x - (hspace - hslack);\n                    }\n                }\n                if (grav < 0) {\n                    if (left - hs > 0)\n                        hs = left;\n                    if (right - hs < hspace)\n                        hs = right - hspace;\n                }\n                else if (grav > 0) {\n                    if (right - hs < hspace)\n                        hs = right - hspace;\n                    if (left - hs > 0)\n                        hs = left;\n                }\n                else {\n                    if (right - left <= hspace) {\n                        hs = left - (hspace - (right - left)) / 2;\n                    }\n                    else if (x > right - hslack) {\n                        hs = right - hspace;\n                    }\n                    else if (x < left + hslack) {\n                        hs = left;\n                    }\n                    else if (left > hs) {\n                        hs = left;\n                    }\n                    else if (right < hs + hspace) {\n                        hs = right - hspace;\n                    }\n                    else {\n                        if (x - hs < hslack) {\n                            hs = x - hslack;\n                        }\n                        if (x - hs > hspace - hslack) {\n                            hs = x - (hspace - hslack);\n                        }\n                    }\n                }\n                if (hs != this.mScrollX || vs != this.mScrollY) {\n                    if (this.mScroller == null) {\n                        this.scrollTo(hs, vs);\n                    }\n                    else {\n                        let duration = AnimationUtils.currentAnimationTimeMillis() - this.mLastScroll;\n                        let dx = hs - this.mScrollX;\n                        let dy = vs - this.mScrollY;\n                        if (duration > TextView.ANIMATED_SCROLL_GAP) {\n                            this.mScroller.startScroll(this.mScrollX, this.mScrollY, dx, dy);\n                            this.awakenScrollBars(this.mScroller.getDuration());\n                            this.invalidate();\n                        }\n                        else {\n                            if (!this.mScroller.isFinished()) {\n                                this.mScroller.abortAnimation();\n                            }\n                            this.scrollBy(dx, dy);\n                        }\n                        this.mLastScroll = AnimationUtils.currentAnimationTimeMillis();\n                    }\n                    changed = true;\n                }\n                if (this.isFocused()) {\n                    if (this.mTempRect == null)\n                        this.mTempRect = new Rect();\n                    this.mTempRect.set(x - 2, top, x + 2, bottom);\n                    this.getInterestingRect(this.mTempRect, line);\n                    this.mTempRect.offset(this.mScrollX, this.mScrollY);\n                }\n                return changed;\n            }\n            moveCursorToVisibleOffset() {\n                return false;\n            }\n            computeScroll() {\n                if (this.mScroller != null) {\n                    if (this.mScroller.computeScrollOffset()) {\n                        this.mScrollX = this.mScroller.getCurrX();\n                        this.mScrollY = this.mScroller.getCurrY();\n                        this.invalidateParentCaches();\n                        this.postInvalidate();\n                    }\n                }\n            }\n            getInterestingRect(r, line) {\n                this.convertFromViewportToContentCoordinates(r);\n                if (line == 0)\n                    r.top -= this.getExtendedPaddingTop();\n                if (line == this.mLayout.getLineCount() - 1)\n                    r.bottom += this.getExtendedPaddingBottom();\n            }\n            convertFromViewportToContentCoordinates(r) {\n                const horizontalOffset = this.viewportToContentHorizontalOffset();\n                r.left += horizontalOffset;\n                r.right += horizontalOffset;\n                const verticalOffset = this.viewportToContentVerticalOffset();\n                r.top += verticalOffset;\n                r.bottom += verticalOffset;\n            }\n            viewportToContentHorizontalOffset() {\n                return this.getCompoundPaddingLeft() - this.mScrollX;\n            }\n            viewportToContentVerticalOffset() {\n                let offset = this.getExtendedPaddingTop() - this.mScrollY;\n                if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) != Gravity.TOP) {\n                    offset += this.getVerticalOffset(false);\n                }\n                return offset;\n            }\n            getSelectionStart() {\n                return -1;\n            }\n            getSelectionEnd() {\n                return -1;\n            }\n            hasSelection() {\n                const selectionStart = this.getSelectionStart();\n                const selectionEnd = this.getSelectionEnd();\n                return selectionStart >= 0 && selectionStart != selectionEnd;\n            }\n            setAllCaps(allCaps) {\n                if (allCaps) {\n                    this.setTransformationMethod(new AllCapsTransformationMethod());\n                }\n                else {\n                    this.setTransformationMethod(null);\n                }\n            }\n            setSingleLine(singleLine = true) {\n                if (this.mSingleLine == singleLine)\n                    return;\n                this.setInputTypeSingleLine(singleLine);\n                this.applySingleLine(singleLine, true, true);\n            }\n            setInputTypeSingleLine(singleLine) {\n            }\n            applySingleLine(singleLine, applyTransformation, changeMaxLines) {\n                this.mSingleLine = singleLine;\n                if (singleLine) {\n                    this.setLines(1);\n                    this.setHorizontallyScrolling(true);\n                    if (applyTransformation) {\n                        this.setTransformationMethod(SingleLineTransformationMethod.getInstance());\n                    }\n                }\n                else {\n                    if (changeMaxLines) {\n                        this.setMaxLines(Integer.MAX_VALUE);\n                    }\n                    this.setHorizontallyScrolling(false);\n                    if (applyTransformation) {\n                        this.setTransformationMethod(null);\n                    }\n                }\n            }\n            setEllipsize(where) {\n                if (this.mEllipsize != where) {\n                    this.mEllipsize = where;\n                    if (this.mLayout != null) {\n                        this.nullLayouts();\n                        this.requestLayout();\n                        this.invalidate();\n                    }\n                }\n            }\n            setMarqueeRepeatLimit(marqueeLimit) {\n                this.mMarqueeRepeatLimit = marqueeLimit;\n            }\n            getMarqueeRepeatLimit() {\n                return this.mMarqueeRepeatLimit;\n            }\n            getEllipsize() {\n                return this.mEllipsize;\n            }\n            setSelectAllOnFocus(selectAllOnFocus) {\n                this.createEditorIfNeeded();\n                this.mEditor.mSelectAllOnFocus = selectAllOnFocus;\n                if (selectAllOnFocus && !Spannable.isImpl(this.mText)) {\n                    this.setText(this.mText, TextView.BufferType.SPANNABLE);\n                }\n            }\n            setCursorVisible(visible) {\n            }\n            isCursorVisible() {\n                return null;\n            }\n            canMarquee() {\n                let width = (this.mRight - this.mLeft - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight());\n                return width > 0 && (this.mLayout.getLineWidth(0) > width || (this.mMarqueeFadeMode != TextView.MARQUEE_FADE_NORMAL && this.mSavedMarqueeModeLayout != null && this.mSavedMarqueeModeLayout.getLineWidth(0) > width));\n            }\n            startMarquee() {\n                if (this.getKeyListener() != null)\n                    return;\n                if (this.compressText(this.getWidth() - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight())) {\n                    return;\n                }\n                if ((this.mMarquee == null || this.mMarquee.isStopped()) && (this.isFocused() || this.isSelected()) && this.getLineCount() == 1 && this.canMarquee()) {\n                    if (this.mMarqueeFadeMode == TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS) {\n                        this.mMarqueeFadeMode = TextView.MARQUEE_FADE_SWITCH_SHOW_FADE;\n                        const tmp = this.mLayout;\n                        this.mLayout = this.mSavedMarqueeModeLayout;\n                        this.mSavedMarqueeModeLayout = tmp;\n                        this.setHorizontalFadingEdgeEnabled(true);\n                        this.requestLayout();\n                        this.invalidate();\n                    }\n                    if (this.mMarquee == null)\n                        this.mMarquee = new TextView.Marquee(this);\n                    this.mMarquee.start(this.mMarqueeRepeatLimit);\n                }\n            }\n            stopMarquee() {\n                if (this.mMarquee != null && !this.mMarquee.isStopped()) {\n                    this.mMarquee.stop();\n                }\n                if (this.mMarqueeFadeMode == TextView.MARQUEE_FADE_SWITCH_SHOW_FADE) {\n                    this.mMarqueeFadeMode = TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS;\n                    const tmp = this.mSavedMarqueeModeLayout;\n                    this.mSavedMarqueeModeLayout = this.mLayout;\n                    this.mLayout = tmp;\n                    this.setHorizontalFadingEdgeEnabled(false);\n                    this.requestLayout();\n                    this.invalidate();\n                }\n            }\n            startStopMarquee(start) {\n                if (this.mEllipsize == TextUtils.TruncateAt.MARQUEE) {\n                    if (start) {\n                        this.startMarquee();\n                    }\n                    else {\n                        this.stopMarquee();\n                    }\n                }\n            }\n            onTextChanged(text, start, lengthBefore, lengthAfter) {\n            }\n            onSelectionChanged(selStart, selEnd) {\n            }\n            addTextChangedListener(watcher) {\n                if (this.mListeners == null) {\n                    this.mListeners = new ArrayList();\n                }\n                this.mListeners.add(watcher);\n            }\n            removeTextChangedListener(watcher) {\n                if (this.mListeners != null) {\n                    let i = this.mListeners.indexOf(watcher);\n                    if (i >= 0) {\n                        this.mListeners.remove(i);\n                    }\n                }\n            }\n            sendBeforeTextChanged(text, start, before, after) {\n                if (this.mListeners != null) {\n                    const list = this.mListeners;\n                    const count = list.size();\n                    for (let i = 0; i < count; i++) {\n                        list.get(i).beforeTextChanged(text, start, before, after);\n                    }\n                }\n            }\n            removeAdjacentSuggestionSpans(pos) {\n            }\n            sendOnTextChanged(text, start, before, after) {\n                if (this.mListeners != null) {\n                    const list = this.mListeners;\n                    const count = list.size();\n                    for (let i = 0; i < count; i++) {\n                        list.get(i).onTextChanged(text, start, before, after);\n                    }\n                }\n            }\n            sendAfterTextChanged(text) {\n                if (this.mListeners != null) {\n                    const list = this.mListeners;\n                    const count = list.size();\n                    for (let i = 0; i < count; i++) {\n                        list.get(i).afterTextChanged(text + '');\n                    }\n                }\n            }\n            updateAfterEdit() {\n                this.invalidate();\n                let curs = this.getSelectionStart();\n                if (curs >= 0 || (this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {\n                    this.registerForPreDraw();\n                }\n                this.checkForResize();\n                if (curs >= 0) {\n                    this.mHighlightPathBogus = true;\n                    this.bringPointIntoView(curs);\n                }\n            }\n            handleTextChanged(buffer, start, before, after) {\n                this.updateAfterEdit();\n                this.sendOnTextChanged(buffer, start, before, after);\n                this.onTextChanged(buffer, start, before, after);\n            }\n            spanChange(buf, what, oldStart, newStart, oldEnd, newEnd) {\n                let selChanged = false;\n                let newSelStart = -1, newSelEnd = -1;\n                this.invalidate();\n                this.mHighlightPathBogus = true;\n                this.checkForResize();\n            }\n            dispatchFinishTemporaryDetach() {\n                this.mDispatchTemporaryDetach = true;\n                super.dispatchFinishTemporaryDetach();\n                this.mDispatchTemporaryDetach = false;\n            }\n            onStartTemporaryDetach() {\n                super.onStartTemporaryDetach();\n                if (!this.mDispatchTemporaryDetach)\n                    this.mTemporaryDetach = true;\n            }\n            onFinishTemporaryDetach() {\n                super.onFinishTemporaryDetach();\n                if (!this.mDispatchTemporaryDetach)\n                    this.mTemporaryDetach = false;\n            }\n            onFocusChanged(focused, direction, previouslyFocusedRect) {\n                if (this.mTemporaryDetach) {\n                    super.onFocusChanged(focused, direction, previouslyFocusedRect);\n                    return;\n                }\n                this.startStopMarquee(focused);\n                if (this.mTransformation != null) {\n                    this.mTransformation.onFocusChanged(this, this.mText, focused, direction, previouslyFocusedRect);\n                }\n                super.onFocusChanged(focused, direction, previouslyFocusedRect);\n            }\n            onWindowFocusChanged(hasWindowFocus) {\n                super.onWindowFocusChanged(hasWindowFocus);\n                this.startStopMarquee(hasWindowFocus);\n            }\n            onVisibilityChanged(changedView, visibility) {\n                super.onVisibilityChanged(changedView, visibility);\n            }\n            clearComposingText() {\n            }\n            setSelected(selected) {\n                let wasSelected = this.isSelected();\n                super.setSelected(selected);\n                if (selected != wasSelected && this.mEllipsize == TextUtils.TruncateAt.MARQUEE) {\n                    if (selected) {\n                        this.startMarquee();\n                    }\n                    else {\n                        this.stopMarquee();\n                    }\n                }\n            }\n            onTouchEvent(event) {\n                const action = event.getActionMasked();\n                const superResult = super.onTouchEvent(event);\n                const touchIsFinished = (action == MotionEvent.ACTION_UP)\n                    && this.isFocused();\n                if ((this.mMovement != null || this.onCheckIsTextEditor()) && this.isEnabled() && Spannable.isImpl(this.mText) && this.mLayout != null) {\n                    let handled = false;\n                    if (this.mMovement != null) {\n                        handled = this.mMovement.onTouchEvent(this, this.mText, event) || handled;\n                    }\n                    if (handled) {\n                        return true;\n                    }\n                }\n                return superResult;\n            }\n            onGenericMotionEvent(event) {\n                if (this.mMovement != null && Spannable.isImpl(this.mText) && this.mLayout != null) {\n                    try {\n                        if (this.mMovement.onGenericMotionEvent(this, this.mText, event)) {\n                            return true;\n                        }\n                    }\n                    catch (e) {\n                    }\n                }\n                return super.onGenericMotionEvent(event);\n            }\n            isTextEditable() {\n                return false;\n            }\n            didTouchFocusSelect() {\n                return false;\n            }\n            cancelLongPress() {\n                super.cancelLongPress();\n            }\n            setScroller(s) {\n                this.mScroller = s;\n            }\n            getLeftFadingEdgeStrength() {\n                if (this.mEllipsize == TextUtils.TruncateAt.MARQUEE && this.mMarqueeFadeMode != TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS) {\n                    if (this.mMarquee != null && !this.mMarquee.isStopped()) {\n                        const marquee = this.mMarquee;\n                        if (marquee.shouldDrawLeftFade()) {\n                            const scroll = marquee.getScroll();\n                            return scroll / this.getHorizontalFadingEdgeLength();\n                        }\n                        else {\n                            return 0.0;\n                        }\n                    }\n                    else if (this.getLineCount() == 1) {\n                        const absoluteGravity = this.mGravity;\n                        switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n                            case Gravity.LEFT:\n                                return 0.0;\n                            case Gravity.RIGHT:\n                                return (this.mLayout.getLineRight(0) - (this.mRight - this.mLeft) - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight() - this.mLayout.getLineLeft(0)) / this.getHorizontalFadingEdgeLength();\n                            case Gravity.CENTER_HORIZONTAL:\n                            case Gravity.FILL_HORIZONTAL:\n                                const textDirection = this.mLayout.getParagraphDirection(0);\n                                if (textDirection == Layout.DIR_LEFT_TO_RIGHT) {\n                                    return 0.0;\n                                }\n                                else {\n                                    return (this.mLayout.getLineRight(0) - (this.mRight - this.mLeft) - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight() - this.mLayout.getLineLeft(0)) / this.getHorizontalFadingEdgeLength();\n                                }\n                        }\n                    }\n                }\n                return super.getLeftFadingEdgeStrength();\n            }\n            getRightFadingEdgeStrength() {\n                if (this.mEllipsize == TextUtils.TruncateAt.MARQUEE && this.mMarqueeFadeMode != TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS) {\n                    if (this.mMarquee != null && !this.mMarquee.isStopped()) {\n                        const marquee = this.mMarquee;\n                        const maxFadeScroll = marquee.getMaxFadeScroll();\n                        const scroll = marquee.getScroll();\n                        return (maxFadeScroll - scroll) / this.getHorizontalFadingEdgeLength();\n                    }\n                    else if (this.getLineCount() == 1) {\n                        const absoluteGravity = this.mGravity;\n                        switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n                            case Gravity.LEFT:\n                                const textWidth = (this.mRight - this.mLeft) - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight();\n                                const lineWidth = this.mLayout.getLineWidth(0);\n                                return (lineWidth - textWidth) / this.getHorizontalFadingEdgeLength();\n                            case Gravity.RIGHT:\n                                return 0.0;\n                            case Gravity.CENTER_HORIZONTAL:\n                            case Gravity.FILL_HORIZONTAL:\n                                const textDirection = this.mLayout.getParagraphDirection(0);\n                                if (textDirection == Layout.DIR_RIGHT_TO_LEFT) {\n                                    return 0.0;\n                                }\n                                else {\n                                    return (this.mLayout.getLineWidth(0) - ((this.mRight - this.mLeft) - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight())) / this.getHorizontalFadingEdgeLength();\n                                }\n                        }\n                    }\n                }\n                return super.getRightFadingEdgeStrength();\n            }\n            computeHorizontalScrollRange() {\n                if (this.mLayout != null) {\n                    return this.mSingleLine && (this.mGravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.LEFT ? Math.floor(this.mLayout.getLineWidth(0)) : this.mLayout.getWidth();\n                }\n                return super.computeHorizontalScrollRange();\n            }\n            computeVerticalScrollRange() {\n                if (this.mLayout != null)\n                    return this.mLayout.getHeight();\n                return super.computeVerticalScrollRange();\n            }\n            computeVerticalScrollExtent() {\n                return this.getHeight() - this.getCompoundPaddingTop() - this.getCompoundPaddingBottom();\n            }\n            static getTextColors() {\n                return android.R.color.textView_textColor;\n            }\n            static getTextColor(def) {\n                let colors = this.getTextColors();\n                if (colors == null) {\n                    return def;\n                }\n                else {\n                    return colors.getDefaultColor();\n                }\n            }\n            canSelectText() {\n                return false;\n            }\n            textCanBeSelected() {\n                return false;\n            }\n            getTransformedText(start, end) {\n                return this.removeSuggestionSpans(this.mTransformed.substring(start, end));\n            }\n            performLongClick() {\n                let handled = false;\n                if (super.performLongClick()) {\n                    handled = true;\n                }\n                if (handled) {\n                    this.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);\n                }\n                return handled;\n            }\n            isSuggestionsEnabled() {\n                return false;\n            }\n            setCustomSelectionActionModeCallback(actionModeCallback) {\n                this.createEditorIfNeeded();\n            }\n            getCustomSelectionActionModeCallback() {\n                return null;\n            }\n            stopSelectionActionMode() {\n            }\n            canCut() {\n                return false;\n            }\n            canCopy() {\n                return true;\n            }\n            canPaste() {\n                return false;\n            }\n            selectAllText() {\n                return false;\n            }\n            getOffsetForPosition(x, y) {\n                if (this.getLayout() == null)\n                    return -1;\n                const line = this.getLineAtCoordinate(y);\n                const offset = this.getOffsetAtCoordinate(line, x);\n                return offset;\n            }\n            convertToLocalHorizontalCoordinate(x) {\n                x -= this.getTotalPaddingLeft();\n                x = Math.max(0.0, x);\n                x = Math.min(this.getWidth() - this.getTotalPaddingRight() - 1, x);\n                x += this.getScrollX();\n                return x;\n            }\n            getLineAtCoordinate(y) {\n                y -= this.getTotalPaddingTop();\n                y = Math.max(0.0, y);\n                y = Math.min(this.getHeight() - this.getTotalPaddingBottom() - 1, y);\n                y += this.getScrollY();\n                return this.getLayout().getLineForVertical(Math.floor(y));\n            }\n            getOffsetAtCoordinate(line, x) {\n                x = this.convertToLocalHorizontalCoordinate(x);\n                return this.getLayout().getOffsetForHorizontal(line, x);\n            }\n            isInBatchEditMode() {\n                return false;\n            }\n            getTextDirectionHeuristic() {\n                return TextDirectionHeuristics.LTR;\n            }\n            onResolveDrawables(layoutDirection) {\n                if (this.mLastLayoutDirection == layoutDirection) {\n                    return;\n                }\n                this.mLastLayoutDirection = layoutDirection;\n                if (this.mDrawables != null) {\n                    this.mDrawables.resolveWithLayoutDirection(layoutDirection);\n                }\n            }\n            resetResolvedDrawables() {\n                this.mLastLayoutDirection = -1;\n            }\n            deleteText_internal(start, end) {\n            }\n            replaceText_internal(start, end, text) {\n            }\n            setSpan_internal(span, start, end, flags) {\n            }\n            setCursorPosition_internal(start, end) {\n            }\n            createEditorIfNeeded() {\n            }\n        }\n        TextView.LOG_TAG = \"TextView\";\n        TextView.DEBUG_EXTRACT = false;\n        TextView.SANS = 1;\n        TextView.SERIF = 2;\n        TextView.MONOSPACE = 3;\n        TextView.SIGNED = 2;\n        TextView.DECIMAL = 4;\n        TextView.MARQUEE_FADE_NORMAL = 0;\n        TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS = 1;\n        TextView.MARQUEE_FADE_SWITCH_SHOW_FADE = 2;\n        TextView.LINES = 1;\n        TextView.EMS = TextView.LINES;\n        TextView.PIXELS = 2;\n        TextView.TEMP_RECTF = new RectF();\n        TextView.VERY_WIDE = 1024 * 1024;\n        TextView.ANIMATED_SCROLL_GAP = 250;\n        TextView.NO_FILTERS = new Array(0);\n        TextView.CHANGE_WATCHER_PRIORITY = 100;\n        TextView.MULTILINE_STATE_SET = [View.VIEW_STATE_MULTILINE];\n        TextView.LAST_CUT_OR_COPY_TIME = 0;\n        TextView.UNKNOWN_BORING = new BoringLayout.Metrics();\n        widget.TextView = TextView;\n        (function (TextView) {\n            class Drawables {\n                constructor(context) {\n                    this.mCompoundRect = new Rect();\n                    this.mDrawableSizeTop = 0;\n                    this.mDrawableSizeBottom = 0;\n                    this.mDrawableSizeLeft = 0;\n                    this.mDrawableSizeRight = 0;\n                    this.mDrawableSizeStart = 0;\n                    this.mDrawableSizeEnd = 0;\n                    this.mDrawableSizeError = 0;\n                    this.mDrawableSizeTemp = 0;\n                    this.mDrawableWidthTop = 0;\n                    this.mDrawableWidthBottom = 0;\n                    this.mDrawableHeightLeft = 0;\n                    this.mDrawableHeightRight = 0;\n                    this.mDrawableHeightStart = 0;\n                    this.mDrawableHeightEnd = 0;\n                    this.mDrawableHeightError = 0;\n                    this.mDrawableHeightTemp = 0;\n                    this.mDrawablePadding = 0;\n                    this.mDrawableSaved = Drawables.DRAWABLE_NONE;\n                    this.mIsRtlCompatibilityMode = false;\n                    this.mOverride = false;\n                }\n                resolveWithLayoutDirection(layoutDirection) {\n                    this.mDrawableLeft = this.mDrawableLeftInitial;\n                    this.mDrawableRight = this.mDrawableRightInitial;\n                    if (this.mOverride) {\n                        this.mDrawableLeft = this.mDrawableStart;\n                        this.mDrawableSizeLeft = this.mDrawableSizeStart;\n                        this.mDrawableHeightLeft = this.mDrawableHeightStart;\n                        this.mDrawableRight = this.mDrawableEnd;\n                        this.mDrawableSizeRight = this.mDrawableSizeEnd;\n                        this.mDrawableHeightRight = this.mDrawableHeightEnd;\n                    }\n                    this.applyErrorDrawableIfNeeded(layoutDirection);\n                    this.updateDrawablesLayoutDirection(layoutDirection);\n                }\n                updateDrawablesLayoutDirection(layoutDirection) {\n                }\n                setErrorDrawable(dr, tv) {\n                    if (this.mDrawableError != dr && this.mDrawableError != null) {\n                        this.mDrawableError.setCallback(null);\n                    }\n                    this.mDrawableError = dr;\n                    const compoundRect = this.mCompoundRect;\n                    let state = tv.getDrawableState();\n                    if (this.mDrawableError != null) {\n                        this.mDrawableError.setState(state);\n                        this.mDrawableError.copyBounds(compoundRect);\n                        this.mDrawableError.setCallback(tv);\n                        this.mDrawableSizeError = compoundRect.width();\n                        this.mDrawableHeightError = compoundRect.height();\n                    }\n                    else {\n                        this.mDrawableSizeError = this.mDrawableHeightError = 0;\n                    }\n                }\n                applyErrorDrawableIfNeeded(layoutDirection) {\n                    switch (this.mDrawableSaved) {\n                        case Drawables.DRAWABLE_LEFT:\n                            this.mDrawableLeft = this.mDrawableTemp;\n                            this.mDrawableSizeLeft = this.mDrawableSizeTemp;\n                            this.mDrawableHeightLeft = this.mDrawableHeightTemp;\n                            break;\n                        case Drawables.DRAWABLE_RIGHT:\n                            this.mDrawableRight = this.mDrawableTemp;\n                            this.mDrawableSizeRight = this.mDrawableSizeTemp;\n                            this.mDrawableHeightRight = this.mDrawableHeightTemp;\n                            break;\n                        case Drawables.DRAWABLE_NONE:\n                        default:\n                    }\n                    this.mDrawableSaved = Drawables.DRAWABLE_RIGHT;\n                    this.mDrawableTemp = this.mDrawableRight;\n                    this.mDrawableSizeTemp = this.mDrawableSizeRight;\n                    this.mDrawableHeightTemp = this.mDrawableHeightRight;\n                    this.mDrawableRight = this.mDrawableError;\n                    this.mDrawableSizeRight = this.mDrawableSizeError;\n                    this.mDrawableHeightRight = this.mDrawableHeightError;\n                }\n            }\n            Drawables.DRAWABLE_NONE = -1;\n            Drawables.DRAWABLE_RIGHT = 0;\n            Drawables.DRAWABLE_LEFT = 1;\n            TextView.Drawables = Drawables;\n            class Marquee extends Handler {\n                constructor(v) {\n                    super();\n                    this.mStatus = Marquee.MARQUEE_STOPPED;\n                    this.mScrollUnit = 0;\n                    this.mMaxScroll = 0;\n                    this.mMaxFadeScroll = 0;\n                    this.mGhostStart = 0;\n                    this.mGhostOffset = 0;\n                    this.mFadeStop = 0;\n                    this.mRepeatLimit = 0;\n                    this.mScroll = 0;\n                    const density = v.getResources().getDisplayMetrics().density;\n                    this.mScrollUnit = (Marquee.MARQUEE_PIXELS_PER_SECOND * density) / Marquee.MARQUEE_RESOLUTION;\n                    this.mView = new WeakReference(v);\n                }\n                handleMessage(msg) {\n                    switch (msg.what) {\n                        case Marquee.MESSAGE_START:\n                            this.mStatus = Marquee.MARQUEE_RUNNING;\n                            this.tick();\n                            break;\n                        case Marquee.MESSAGE_TICK:\n                            this.tick();\n                            break;\n                        case Marquee.MESSAGE_RESTART:\n                            if (this.mStatus == Marquee.MARQUEE_RUNNING) {\n                                if (this.mRepeatLimit >= 0) {\n                                    this.mRepeatLimit--;\n                                }\n                                this.start(this.mRepeatLimit);\n                            }\n                            break;\n                    }\n                }\n                tick() {\n                    if (this.mStatus != Marquee.MARQUEE_RUNNING) {\n                        return;\n                    }\n                    this.removeMessages(Marquee.MESSAGE_TICK);\n                    const textView = this.mView.get();\n                    if (textView != null && (textView.isFocused() || textView.isSelected())) {\n                        this.mScroll += this.mScrollUnit;\n                        if (this.mScroll > this.mMaxScroll) {\n                            this.mScroll = this.mMaxScroll;\n                            this.sendEmptyMessageDelayed(Marquee.MESSAGE_RESTART, Marquee.MARQUEE_RESTART_DELAY);\n                        }\n                        else {\n                            this.sendEmptyMessageDelayed(Marquee.MESSAGE_TICK, Marquee.MARQUEE_RESOLUTION);\n                        }\n                        textView.invalidate();\n                    }\n                }\n                stop() {\n                    this.mStatus = Marquee.MARQUEE_STOPPED;\n                    this.removeMessages(Marquee.MESSAGE_START);\n                    this.removeMessages(Marquee.MESSAGE_RESTART);\n                    this.removeMessages(Marquee.MESSAGE_TICK);\n                    this.resetScroll();\n                }\n                resetScroll() {\n                    this.mScroll = 0.0;\n                    const textView = this.mView.get();\n                    if (textView != null)\n                        textView.invalidate();\n                }\n                start(repeatLimit) {\n                    if (repeatLimit == 0) {\n                        this.stop();\n                        return;\n                    }\n                    this.mRepeatLimit = repeatLimit;\n                    const textView = this.mView.get();\n                    if (textView != null && textView.mLayout != null) {\n                        this.mStatus = Marquee.MARQUEE_STARTING;\n                        this.mScroll = 0.0;\n                        const textWidth = textView.getWidth() - textView.getCompoundPaddingLeft() - textView.getCompoundPaddingRight();\n                        const lineWidth = textView.mLayout.getLineWidth(0);\n                        const gap = textWidth / 3.0;\n                        this.mGhostStart = lineWidth - textWidth + gap;\n                        this.mMaxScroll = this.mGhostStart + textWidth;\n                        this.mGhostOffset = lineWidth + gap;\n                        this.mFadeStop = lineWidth + textWidth / 6.0;\n                        this.mMaxFadeScroll = this.mGhostStart + lineWidth + lineWidth;\n                        textView.invalidate();\n                        this.sendEmptyMessageDelayed(Marquee.MESSAGE_START, Marquee.MARQUEE_DELAY);\n                    }\n                }\n                getGhostOffset() {\n                    return this.mGhostOffset;\n                }\n                getScroll() {\n                    return this.mScroll;\n                }\n                getMaxFadeScroll() {\n                    return this.mMaxFadeScroll;\n                }\n                shouldDrawLeftFade() {\n                    return this.mScroll <= this.mFadeStop;\n                }\n                shouldDrawGhost() {\n                    return this.mStatus == Marquee.MARQUEE_RUNNING && this.mScroll > this.mGhostStart;\n                }\n                isRunning() {\n                    return this.mStatus == Marquee.MARQUEE_RUNNING;\n                }\n                isStopped() {\n                    return this.mStatus == Marquee.MARQUEE_STOPPED;\n                }\n            }\n            Marquee.MARQUEE_DELTA_MAX = 0.07;\n            Marquee.MARQUEE_DELAY = 1200;\n            Marquee.MARQUEE_RESTART_DELAY = 1200;\n            Marquee.MARQUEE_RESOLUTION = 1000 / 30;\n            Marquee.MARQUEE_PIXELS_PER_SECOND = 30;\n            Marquee.MARQUEE_STOPPED = 0x0;\n            Marquee.MARQUEE_STARTING = 0x1;\n            Marquee.MARQUEE_RUNNING = 0x2;\n            Marquee.MESSAGE_START = 0x1;\n            Marquee.MESSAGE_TICK = 0x2;\n            Marquee.MESSAGE_RESTART = 0x3;\n            TextView.Marquee = Marquee;\n            class ChangeWatcher {\n                constructor(arg) {\n                    this._TextView_this = arg;\n                }\n                beforeTextChanged(buffer, start, before, after) {\n                    if (TextView.DEBUG_EXTRACT)\n                        Log.v(TextView.LOG_TAG, \"beforeTextChanged start=\" + start + \" before=\" + before + \" after=\" + after + \": \" + buffer);\n                    this._TextView_this.sendBeforeTextChanged(buffer, start, before, after);\n                }\n                onTextChanged(buffer, start, before, after) {\n                    if (TextView.DEBUG_EXTRACT)\n                        Log.v(TextView.LOG_TAG, \"onTextChanged start=\" + start + \" before=\" + before + \" after=\" + after + \": \" + buffer);\n                    this._TextView_this.handleTextChanged(buffer, start, before, after);\n                }\n                afterTextChanged(buffer) {\n                    if (TextView.DEBUG_EXTRACT)\n                        Log.v(TextView.LOG_TAG, \"afterTextChanged: \" + buffer);\n                    this._TextView_this.sendAfterTextChanged(buffer);\n                }\n                onSpanChanged(buf, what, s, e, st, en) {\n                    if (TextView.DEBUG_EXTRACT)\n                        Log.v(TextView.LOG_TAG, \"onSpanChanged s=\" + s + \" e=\" + e + \" st=\" + st + \" en=\" + en + \" what=\" + what + \": \" + buf);\n                    this._TextView_this.spanChange(buf, what, s, st, e, en);\n                }\n                onSpanAdded(buf, what, s, e) {\n                    if (TextView.DEBUG_EXTRACT)\n                        Log.v(TextView.LOG_TAG, \"onSpanAdded s=\" + s + \" e=\" + e + \" what=\" + what + \": \" + buf);\n                    this._TextView_this.spanChange(buf, what, -1, s, -1, e);\n                }\n                onSpanRemoved(buf, what, s, e) {\n                    if (TextView.DEBUG_EXTRACT)\n                        Log.v(TextView.LOG_TAG, \"onSpanRemoved s=\" + s + \" e=\" + e + \" what=\" + what + \": \" + buf);\n                    this._TextView_this.spanChange(buf, what, s, -1, e, -1);\n                }\n            }\n            TextView.ChangeWatcher = ChangeWatcher;\n            var BufferType;\n            (function (BufferType) {\n                BufferType[BufferType[\"NORMAL\"] = 0] = \"NORMAL\";\n                BufferType[BufferType[\"SPANNABLE\"] = 1] = \"SPANNABLE\";\n                BufferType[BufferType[\"EDITABLE\"] = 2] = \"EDITABLE\";\n            })(BufferType = TextView.BufferType || (TextView.BufferType = {}));\n        })(TextView = widget.TextView || (widget.TextView = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        class Button extends widget.TextView {\n            constructor(context, bindElement, defStyle = android.R.attr.buttonStyle) {\n                super(context, bindElement, defStyle);\n            }\n        }\n        widget.Button = Button;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var ListAdapter;\n        (function (ListAdapter) {\n            function isImpl(obj) {\n                return obj && obj['areAllItemsEnabled'] && obj['isEnabled'];\n            }\n            ListAdapter.isImpl = isImpl;\n        })(ListAdapter = widget.ListAdapter || (widget.ListAdapter = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var Rect = android.graphics.Rect;\n        var Log = android.util.Log;\n        var LongSparseArray = android.util.LongSparseArray;\n        var SparseArray = android.util.SparseArray;\n        var SparseBooleanArray = android.util.SparseBooleanArray;\n        var StateSet = android.util.StateSet;\n        var HapticFeedbackConstants = android.view.HapticFeedbackConstants;\n        var KeyEvent = android.view.KeyEvent;\n        var MotionEvent = android.view.MotionEvent;\n        var VelocityTracker = android.view.VelocityTracker;\n        var View = android.view.View;\n        var ViewConfiguration = android.view.ViewConfiguration;\n        var ViewGroup = android.view.ViewGroup;\n        var LinearInterpolator = android.view.animation.LinearInterpolator;\n        var ArrayList = java.util.ArrayList;\n        var Integer = java.lang.Integer;\n        var System = java.lang.System;\n        var AdapterView = android.widget.AdapterView;\n        var OverScroller = android.widget.OverScroller;\n        class AbsListView extends AdapterView {\n            constructor(context, bindElement, defStyle) {\n                super(context, bindElement, defStyle);\n                this.mChoiceMode = AbsListView.CHOICE_MODE_NONE;\n                this.mCheckedItemCount = 0;\n                this.mDeferNotifyDataSetChanged = false;\n                this.mDrawSelectorOnTop = false;\n                this.mSelectorPosition = AbsListView.INVALID_POSITION;\n                this.mSelectorRect = new Rect();\n                this.mRecycler = new AbsListView.RecycleBin(this);\n                this.mSelectionLeftPadding = 0;\n                this.mSelectionTopPadding = 0;\n                this.mSelectionRightPadding = 0;\n                this.mSelectionBottomPadding = 0;\n                this.mListPadding = new Rect();\n                this.mWidthMeasureSpec = 0;\n                this.mMotionPosition = 0;\n                this.mMotionViewOriginalTop = 0;\n                this.mMotionViewNewTop = 0;\n                this.mMotionX = 0;\n                this.mMotionY = 0;\n                this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                this.mLastY = 0;\n                this.mMotionCorrection = 0;\n                this.mSelectedTop = 0;\n                this.mSmoothScrollbarEnabled = true;\n                this.mResurrectToPosition = AbsListView.INVALID_POSITION;\n                this.mOverscrollMax = 0;\n                this.mLastTouchMode = AbsListView.TOUCH_MODE_UNKNOWN;\n                this.mScrollProfilingStarted = false;\n                this.mFlingProfilingStarted = false;\n                this.mTranscriptMode = 0;\n                this.mCacheColorHint = 0;\n                this.mLastScrollState = AbsListView.OnScrollListener.SCROLL_STATE_IDLE;\n                this.mDensityScale = 0;\n                this.mMinimumVelocity = 0;\n                this.mMaximumVelocity = 0;\n                this.mVelocityScale = 1.0;\n                this.mIsScrap = new Array(1);\n                this.mActivePointerId = AbsListView.INVALID_POINTER;\n                this.mOverscrollDistance = 0;\n                this._mOverflingDistance = 0;\n                this.mFirstPositionDistanceGuess = 0;\n                this.mLastPositionDistanceGuess = 0;\n                this.mDirection = 0;\n                this.mGlowPaddingLeft = 0;\n                this.mGlowPaddingRight = 0;\n                this.mLastHandledItemCount = 0;\n                this.initAbsListView();\n                let a = context.obtainStyledAttributes(bindElement, defStyle);\n                let d = a.getDrawable('listSelector');\n                if (d != null) {\n                    this.setSelector(d);\n                }\n                this.mDrawSelectorOnTop = a.getBoolean('drawSelectorOnTop', false);\n                let stackFromBottom = a.getBoolean('stackFromBottom', false);\n                this.setStackFromBottom(stackFromBottom);\n                let scrollingCacheEnabled = a.getBoolean('scrollingCache', true);\n                this.setScrollingCacheEnabled(scrollingCacheEnabled);\n                let useTextFilter = a.getBoolean('textFilterEnabled', false);\n                this.setTextFilterEnabled(useTextFilter);\n                let transcriptModeValue = a.getAttrValue('transcriptMode');\n                let transcriptMode = AbsListView.TRANSCRIPT_MODE_DISABLED;\n                if (transcriptModeValue === \"disabled\")\n                    transcriptMode = AbsListView.TRANSCRIPT_MODE_DISABLED;\n                else if (transcriptModeValue === \"normal\")\n                    transcriptMode = AbsListView.TRANSCRIPT_MODE_NORMAL;\n                else if (transcriptModeValue === \"alwaysScroll\")\n                    transcriptMode = AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL;\n                this.setTranscriptMode(transcriptMode);\n                let color = a.getColor('cacheColorHint', 0);\n                this.setCacheColorHint(color);\n                let enableFastScroll = a.getBoolean('fastScrollEnabled', false);\n                this.setFastScrollEnabled(enableFastScroll);\n                let smoothScrollbar = a.getBoolean('smoothScrollbar', true);\n                this.setSmoothScrollbarEnabled(smoothScrollbar);\n                let choiceModeValue = a.getAttrValue('choiceMode');\n                let choiceMode = AbsListView.CHOICE_MODE_NONE;\n                if (choiceModeValue === \"none\")\n                    choiceMode = AbsListView.CHOICE_MODE_NONE;\n                else if (choiceModeValue === \"singleChoice\")\n                    choiceMode = AbsListView.CHOICE_MODE_SINGLE;\n                else if (choiceModeValue === \"multipleChoice\")\n                    choiceMode = AbsListView.CHOICE_MODE_MULTIPLE;\n                this.setChoiceMode(choiceMode);\n                this.setFastScrollAlwaysVisible(a.getBoolean('fastScrollAlwaysVisible', false));\n                a.recycle();\n            }\n            get mOverflingDistance() {\n                if (this.mScrollY <= 0) {\n                    if (this.mScrollY < -this._mOverflingDistance)\n                        return -this.mScrollY;\n                    return this._mOverflingDistance;\n                }\n                let overDistance = this.mScrollY;\n                if (overDistance > this._mOverflingDistance)\n                    return overDistance;\n                return this._mOverflingDistance;\n            }\n            set mOverflingDistance(value) {\n                this._mOverflingDistance = value;\n            }\n            initAbsListView() {\n                this.setClickable(true);\n                this.setFocusableInTouchMode(true);\n                this.setWillNotDraw(false);\n                this.setAlwaysDrawnWithCacheEnabled(false);\n                this.setScrollingCacheEnabled(true);\n                const configuration = ViewConfiguration.get();\n                this.mTouchSlop = configuration.getScaledTouchSlop();\n                this.mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();\n                this.mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();\n                this.mOverscrollDistance = configuration.getScaledOverscrollDistance();\n                this.mOverflingDistance = configuration.getScaledOverflingDistance();\n                this.mDensityScale = android.content.res.Resources.getDisplayMetrics().density;\n                this.mLayoutMode = AbsListView.LAYOUT_NORMAL;\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder()\n                    .set('listSelector', {\n                    setter(v, value, attrBinder) {\n                        let d = attrBinder.parseDrawable(value);\n                        if (d)\n                            v.setSelector(d);\n                    }, getter(v) {\n                        return v.getSelector();\n                    }\n                })\n                    .set('drawSelectorOnTop', {\n                    setter(v, value, attrBinder) {\n                        v.setDrawSelectorOnTop(attrBinder.parseBoolean(value, false));\n                    }, getter(v) {\n                        return v.mDrawSelectorOnTop;\n                    }\n                })\n                    .set('stackFromBottom', {\n                    setter(v, value, attrBinder) {\n                        v.setStackFromBottom(attrBinder.parseBoolean(value, false));\n                    }, getter(v) {\n                        return v.isStackFromBottom();\n                    }\n                })\n                    .set('scrollingCache', {\n                    setter(v, value, attrBinder) {\n                        v.setScrollingCacheEnabled(attrBinder.parseBoolean(value, true));\n                    }, getter(v) {\n                        return v.isScrollingCacheEnabled();\n                    }\n                })\n                    .set('transcriptMode', {\n                    setter(v, value, attrBinder) {\n                        v.setTranscriptMode(attrBinder.parseEnum(value, new Map()\n                            .set(\"disabled\", AbsListView.TRANSCRIPT_MODE_DISABLED)\n                            .set(\"normal\", AbsListView.TRANSCRIPT_MODE_NORMAL)\n                            .set(\"alwaysScroll\", AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL), AbsListView.TRANSCRIPT_MODE_DISABLED));\n                    }, getter(v) {\n                        return v.getTranscriptMode();\n                    }\n                })\n                    .set('cacheColorHint', {\n                    setter(v, value, attrBinder) {\n                        let color = attrBinder.parseColor(value, 0);\n                        v.setCacheColorHint(color);\n                    }, getter(v) {\n                        return v.getCacheColorHint();\n                    }\n                })\n                    .set('fastScrollEnabled', {\n                    setter(v, value, attrBinder) {\n                        let enableFastScroll = attrBinder.parseBoolean(value, false);\n                        v.setFastScrollEnabled(enableFastScroll);\n                    }, getter(v) {\n                        return v.isFastScrollEnabled();\n                    }\n                })\n                    .set('fastScrollAlwaysVisible', {\n                    setter(v, value, attrBinder) {\n                        let fastScrollAlwaysVisible = attrBinder.parseBoolean(value, false);\n                        v.setFastScrollAlwaysVisible(fastScrollAlwaysVisible);\n                    }, getter(v) {\n                        return v.isFastScrollAlwaysVisible();\n                    }\n                })\n                    .set('smoothScrollbar', {\n                    setter(v, value, attrBinder) {\n                        let smoothScrollbar = attrBinder.parseBoolean(value, true);\n                        v.setSmoothScrollbarEnabled(smoothScrollbar);\n                    }, getter(v) {\n                        return v.isSmoothScrollbarEnabled();\n                    }\n                })\n                    .set('choiceMode', {\n                    setter(v, value, attrBinder) {\n                        v.setChoiceMode(attrBinder.parseEnum(value, new Map()\n                            .set(\"none\", AbsListView.CHOICE_MODE_NONE)\n                            .set(\"singleChoice\", AbsListView.CHOICE_MODE_SINGLE)\n                            .set(\"multipleChoice\", AbsListView.CHOICE_MODE_MULTIPLE), AbsListView.CHOICE_MODE_NONE));\n                    }, getter(v) {\n                        return v.getChoiceMode();\n                    }\n                });\n            }\n            setOverScrollMode(mode) {\n                if (mode != AbsListView.OVER_SCROLL_NEVER) {\n                }\n                else {\n                }\n                super.setOverScrollMode(mode);\n            }\n            setAdapter(adapter) {\n                if (adapter != null) {\n                    this.mAdapterHasStableIds = this.mAdapter.hasStableIds();\n                    if (this.mChoiceMode != AbsListView.CHOICE_MODE_NONE && this.mAdapterHasStableIds && this.mCheckedIdStates == null) {\n                        this.mCheckedIdStates = new LongSparseArray();\n                    }\n                }\n                if (this.mCheckStates != null) {\n                    this.mCheckStates.clear();\n                }\n                if (this.mCheckedIdStates != null) {\n                    this.mCheckedIdStates.clear();\n                }\n            }\n            getCheckedItemCount() {\n                return this.mCheckedItemCount;\n            }\n            isItemChecked(position) {\n                if (this.mChoiceMode != AbsListView.CHOICE_MODE_NONE && this.mCheckStates != null) {\n                    return this.mCheckStates.get(position);\n                }\n                return false;\n            }\n            getCheckedItemPosition() {\n                if (this.mChoiceMode == AbsListView.CHOICE_MODE_SINGLE && this.mCheckStates != null && this.mCheckStates.size() == 1) {\n                    return this.mCheckStates.keyAt(0);\n                }\n                return AbsListView.INVALID_POSITION;\n            }\n            getCheckedItemPositions() {\n                if (this.mChoiceMode != AbsListView.CHOICE_MODE_NONE) {\n                    return this.mCheckStates;\n                }\n                return null;\n            }\n            getCheckedItemIds() {\n                if (this.mChoiceMode == AbsListView.CHOICE_MODE_NONE || this.mCheckedIdStates == null || this.mAdapter == null) {\n                    return [0];\n                }\n                const idStates = this.mCheckedIdStates;\n                const count = idStates.size();\n                const ids = [count];\n                for (let i = 0; i < count; i++) {\n                    ids[i] = idStates.keyAt(i);\n                }\n                return ids;\n            }\n            clearChoices() {\n                if (this.mCheckStates != null) {\n                    this.mCheckStates.clear();\n                }\n                if (this.mCheckedIdStates != null) {\n                    this.mCheckedIdStates.clear();\n                }\n                this.mCheckedItemCount = 0;\n            }\n            setItemChecked(position, value) {\n                if (this.mChoiceMode == AbsListView.CHOICE_MODE_NONE) {\n                    return;\n                }\n                if (this.mChoiceMode == AbsListView.CHOICE_MODE_MULTIPLE || this.mChoiceMode == AbsListView.CHOICE_MODE_MULTIPLE_MODAL) {\n                    let oldValue = this.mCheckStates.get(position);\n                    this.mCheckStates.put(position, value);\n                    if (this.mCheckedIdStates != null && this.mAdapter.hasStableIds()) {\n                        if (value) {\n                            this.mCheckedIdStates.put(this.mAdapter.getItemId(position), position);\n                        }\n                        else {\n                            this.mCheckedIdStates.delete(this.mAdapter.getItemId(position));\n                        }\n                    }\n                    if (oldValue != value) {\n                        if (value) {\n                            this.mCheckedItemCount++;\n                        }\n                        else {\n                            this.mCheckedItemCount--;\n                        }\n                    }\n                }\n                else {\n                    let updateIds = this.mCheckedIdStates != null && this.mAdapter.hasStableIds();\n                    if (value || this.isItemChecked(position)) {\n                        this.mCheckStates.clear();\n                        if (updateIds) {\n                            this.mCheckedIdStates.clear();\n                        }\n                    }\n                    if (value) {\n                        this.mCheckStates.put(position, true);\n                        if (updateIds) {\n                            this.mCheckedIdStates.put(this.mAdapter.getItemId(position), position);\n                        }\n                        this.mCheckedItemCount = 1;\n                    }\n                    else if (this.mCheckStates.size() == 0 || !this.mCheckStates.valueAt(0)) {\n                        this.mCheckedItemCount = 0;\n                    }\n                }\n                if (!this.mInLayout && !this.mBlockLayoutRequests) {\n                    this.mDataChanged = true;\n                    this.rememberSyncState();\n                    this.requestLayout();\n                }\n            }\n            performItemClick(view, position, id) {\n                let handled = false;\n                let dispatchItemClick = true;\n                if (this.mChoiceMode != AbsListView.CHOICE_MODE_NONE) {\n                    handled = true;\n                    let checkedStateChanged = false;\n                    if (this.mChoiceMode == AbsListView.CHOICE_MODE_MULTIPLE || (this.mChoiceMode == AbsListView.CHOICE_MODE_MULTIPLE_MODAL && this.mChoiceActionMode != null)) {\n                        let checked = !this.mCheckStates.get(position, false);\n                        this.mCheckStates.put(position, checked);\n                        if (this.mCheckedIdStates != null && this.mAdapter.hasStableIds()) {\n                            if (checked) {\n                                this.mCheckedIdStates.put(this.mAdapter.getItemId(position), position);\n                            }\n                            else {\n                                this.mCheckedIdStates.delete(this.mAdapter.getItemId(position));\n                            }\n                        }\n                        if (checked) {\n                            this.mCheckedItemCount++;\n                        }\n                        else {\n                            this.mCheckedItemCount--;\n                        }\n                        checkedStateChanged = true;\n                    }\n                    else if (this.mChoiceMode == AbsListView.CHOICE_MODE_SINGLE) {\n                        let checked = !this.mCheckStates.get(position, false);\n                        if (checked) {\n                            this.mCheckStates.clear();\n                            this.mCheckStates.put(position, true);\n                            if (this.mCheckedIdStates != null && this.mAdapter.hasStableIds()) {\n                                this.mCheckedIdStates.clear();\n                                this.mCheckedIdStates.put(this.mAdapter.getItemId(position), position);\n                            }\n                            this.mCheckedItemCount = 1;\n                        }\n                        else if (this.mCheckStates.size() == 0 || !this.mCheckStates.valueAt(0)) {\n                            this.mCheckedItemCount = 0;\n                        }\n                        checkedStateChanged = true;\n                    }\n                    if (checkedStateChanged) {\n                        this.updateOnScreenCheckedViews();\n                    }\n                }\n                if (dispatchItemClick) {\n                    handled = super.performItemClick(view, position, id) || handled;\n                }\n                return handled;\n            }\n            updateOnScreenCheckedViews() {\n                const firstPos = this.mFirstPosition;\n                const count = this.getChildCount();\n                const useActivated = true;\n                for (let i = 0; i < count; i++) {\n                    const child = this.getChildAt(i);\n                    const position = firstPos + i;\n                    if (child['setChecked']) {\n                        child.setChecked(this.mCheckStates.get(position));\n                    }\n                    else if (useActivated) {\n                        child.setActivated(this.mCheckStates.get(position));\n                    }\n                }\n            }\n            getChoiceMode() {\n                return this.mChoiceMode;\n            }\n            setChoiceMode(choiceMode) {\n                this.mChoiceMode = choiceMode;\n                if (this.mChoiceActionMode != null) {\n                    this.mChoiceActionMode.finish();\n                    this.mChoiceActionMode = null;\n                }\n                if (this.mChoiceMode != AbsListView.CHOICE_MODE_NONE) {\n                    if (this.mCheckStates == null) {\n                        this.mCheckStates = new SparseBooleanArray(0);\n                    }\n                    if (this.mCheckedIdStates == null && this.mAdapter != null && this.mAdapter.hasStableIds()) {\n                        this.mCheckedIdStates = new LongSparseArray(0);\n                    }\n                    if (this.mChoiceMode == AbsListView.CHOICE_MODE_MULTIPLE_MODAL) {\n                        this.clearChoices();\n                        this.setLongClickable(true);\n                    }\n                }\n            }\n            contentFits() {\n                const childCount = this.getChildCount();\n                if (childCount == 0)\n                    return true;\n                if (childCount != this.mItemCount)\n                    return false;\n                return this.getChildAt(0).getTop() >= this.mListPadding.top && this.getChildAt(childCount - 1).getBottom() <= this.getHeight() - this.mListPadding.bottom;\n            }\n            setFastScrollEnabled(enabled) {\n                if (this.mFastScrollEnabled != enabled) {\n                    this.mFastScrollEnabled = enabled;\n                    this.setFastScrollerEnabledUiThread(enabled);\n                }\n            }\n            setFastScrollerEnabledUiThread(enabled) {\n            }\n            setFastScrollAlwaysVisible(alwaysShow) {\n                if (this.mFastScrollAlwaysVisible != alwaysShow) {\n                    if (alwaysShow && !this.mFastScrollEnabled) {\n                        this.setFastScrollEnabled(true);\n                    }\n                    this.mFastScrollAlwaysVisible = alwaysShow;\n                    this.setFastScrollerAlwaysVisibleUiThread(alwaysShow);\n                }\n            }\n            setFastScrollerAlwaysVisibleUiThread(alwaysShow) {\n            }\n            isOwnerThread() {\n                return true;\n            }\n            isFastScrollAlwaysVisible() {\n                return false;\n            }\n            getVerticalScrollbarWidth() {\n                return super.getVerticalScrollbarWidth();\n            }\n            isFastScrollEnabled() {\n                return false;\n            }\n            setVerticalScrollbarPosition(position) {\n                super.setVerticalScrollbarPosition(position);\n            }\n            setScrollBarStyle(style) {\n                super.setScrollBarStyle(style);\n            }\n            isVerticalScrollBarHidden() {\n                return this.isFastScrollEnabled();\n            }\n            setSmoothScrollbarEnabled(enabled) {\n                this.mSmoothScrollbarEnabled = enabled;\n            }\n            isSmoothScrollbarEnabled() {\n                return this.mSmoothScrollbarEnabled;\n            }\n            setOnScrollListener(l) {\n                this.mOnScrollListener = l;\n                this.invokeOnItemScrollListener();\n            }\n            invokeOnItemScrollListener() {\n                if (this.mOnScrollListener != null) {\n                    this.mOnScrollListener.onScroll(this, this.mFirstPosition, this.getChildCount(), this.mItemCount);\n                }\n                this.onScrollChanged(0, 0, 0, 0);\n            }\n            isScrollingCacheEnabled() {\n                return this.mScrollingCacheEnabled;\n            }\n            setScrollingCacheEnabled(enabled) {\n                if (this.mScrollingCacheEnabled && !enabled) {\n                    this.clearScrollingCache();\n                }\n                this.mScrollingCacheEnabled = enabled;\n            }\n            setTextFilterEnabled(textFilterEnabled) {\n                this.mTextFilterEnabled = textFilterEnabled;\n            }\n            isTextFilterEnabled() {\n                return this.mTextFilterEnabled;\n            }\n            getFocusedRect(r) {\n                let view = this.getSelectedView();\n                if (view != null && view.getParent() == this) {\n                    view.getFocusedRect(r);\n                    this.offsetDescendantRectToMyCoords(view, r);\n                }\n                else {\n                    super.getFocusedRect(r);\n                }\n            }\n            useDefaultSelector() {\n                this.setSelector(android.R.drawable.list_selector_background);\n            }\n            isStackFromBottom() {\n                return this.mStackFromBottom;\n            }\n            setStackFromBottom(stackFromBottom) {\n                if (this.mStackFromBottom != stackFromBottom) {\n                    this.mStackFromBottom = stackFromBottom;\n                    this.requestLayoutIfNecessary();\n                }\n            }\n            requestLayoutIfNecessary() {\n                if (this.getChildCount() > 0) {\n                    this.resetList();\n                    this.requestLayout();\n                    this.invalidate();\n                }\n            }\n            onFocusChanged(gainFocus, direction, previouslyFocusedRect) {\n                super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);\n                if (gainFocus && this.mSelectedPosition < 0 && !this.isInTouchMode()) {\n                    if (!this.isAttachedToWindow() && this.mAdapter != null) {\n                        this.mDataChanged = true;\n                        this.mOldItemCount = this.mItemCount;\n                        this.mItemCount = this.mAdapter.getCount();\n                    }\n                    this.resurrectSelection();\n                }\n            }\n            requestLayout() {\n                if (!this.mBlockLayoutRequests && !this.mInLayout) {\n                    super.requestLayout();\n                }\n            }\n            resetList() {\n                this.removeAllViewsInLayout();\n                this.mFirstPosition = 0;\n                this.mDataChanged = false;\n                this.mPositionScrollAfterLayout = null;\n                this.mNeedSync = false;\n                this.mPendingSync = null;\n                this.mOldSelectedPosition = AbsListView.INVALID_POSITION;\n                this.mOldSelectedRowId = AbsListView.INVALID_ROW_ID;\n                this.setSelectedPositionInt(AbsListView.INVALID_POSITION);\n                this.setNextSelectedPositionInt(AbsListView.INVALID_POSITION);\n                this.mSelectedTop = 0;\n                this.mSelectorPosition = AbsListView.INVALID_POSITION;\n                this.mSelectorRect.setEmpty();\n                this.invalidate();\n            }\n            computeVerticalScrollExtent() {\n                const count = this.getChildCount();\n                if (count > 0) {\n                    if (this.mSmoothScrollbarEnabled) {\n                        let extent = count * 100;\n                        let view = this.getChildAt(0);\n                        const top = view.getTop();\n                        let height = view.getHeight();\n                        if (height > 0) {\n                            extent += (top * 100) / height;\n                        }\n                        view = this.getChildAt(count - 1);\n                        const bottom = view.getBottom();\n                        height = view.getHeight();\n                        if (height > 0) {\n                            extent -= ((bottom - this.getHeight()) * 100) / height;\n                        }\n                        return extent;\n                    }\n                    else {\n                        return 1;\n                    }\n                }\n                return 0;\n            }\n            computeVerticalScrollOffset() {\n                const firstPosition = this.mFirstPosition;\n                const childCount = this.getChildCount();\n                if (firstPosition >= 0 && childCount > 0) {\n                    if (this.mSmoothScrollbarEnabled) {\n                        const view = this.getChildAt(0);\n                        const top = view.getTop();\n                        let height = view.getHeight();\n                        if (height > 0) {\n                            return Math.max(firstPosition * 100 - (top * 100) / height + Math.floor((this.mScrollY / this.getHeight() * this.mItemCount * 100)), 0);\n                        }\n                    }\n                    else {\n                        let index;\n                        const count = this.mItemCount;\n                        if (firstPosition == 0) {\n                            index = 0;\n                        }\n                        else if (firstPosition + childCount == count) {\n                            index = count;\n                        }\n                        else {\n                            index = firstPosition + childCount / 2;\n                        }\n                        return Math.floor((firstPosition + childCount * (index / count)));\n                    }\n                }\n                return 0;\n            }\n            computeVerticalScrollRange() {\n                let result;\n                if (this.mSmoothScrollbarEnabled) {\n                    result = Math.max(this.mItemCount * 100, 0);\n                    if (this.mScrollY != 0) {\n                        result += Math.abs(Math.floor((this.mScrollY / this.getHeight() * this.mItemCount * 100)));\n                    }\n                }\n                else {\n                    result = this.mItemCount;\n                }\n                return result;\n            }\n            getTopFadingEdgeStrength() {\n                const count = this.getChildCount();\n                const fadeEdge = super.getTopFadingEdgeStrength();\n                if (count == 0) {\n                    return fadeEdge;\n                }\n                else {\n                    if (this.mFirstPosition > 0) {\n                        return 1.0;\n                    }\n                    const top = this.getChildAt(0).getTop();\n                    const fadeLength = this.getVerticalFadingEdgeLength();\n                    return top < this.mPaddingTop ? -(top - this.mPaddingTop) / fadeLength : fadeEdge;\n                }\n            }\n            getBottomFadingEdgeStrength() {\n                const count = this.getChildCount();\n                const fadeEdge = super.getBottomFadingEdgeStrength();\n                if (count == 0) {\n                    return fadeEdge;\n                }\n                else {\n                    if (this.mFirstPosition + count - 1 < this.mItemCount - 1) {\n                        return 1.0;\n                    }\n                    const bottom = this.getChildAt(count - 1).getBottom();\n                    const height = this.getHeight();\n                    const fadeLength = this.getVerticalFadingEdgeLength();\n                    return bottom > height - this.mPaddingBottom ? (bottom - height + this.mPaddingBottom) / fadeLength : fadeEdge;\n                }\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                if (this.mSelector == null) {\n                    this.useDefaultSelector();\n                }\n                const listPadding = this.mListPadding;\n                listPadding.left = this.mSelectionLeftPadding + this.mPaddingLeft;\n                listPadding.top = this.mSelectionTopPadding + this.mPaddingTop;\n                listPadding.right = this.mSelectionRightPadding + this.mPaddingRight;\n                listPadding.bottom = this.mSelectionBottomPadding + this.mPaddingBottom;\n                if (this.mTranscriptMode == AbsListView.TRANSCRIPT_MODE_NORMAL) {\n                    const childCount = this.getChildCount();\n                    const listBottom = this.getHeight() - this.getPaddingBottom();\n                    const lastChild = this.getChildAt(childCount - 1);\n                    const lastBottom = lastChild != null ? lastChild.getBottom() : listBottom;\n                    this.mForceTranscriptScroll = this.mFirstPosition + childCount >= this.mLastHandledItemCount && lastBottom <= listBottom;\n                }\n            }\n            onLayout(changed, l, t, r, b) {\n                super.onLayout(changed, l, t, r, b);\n                this.mInLayout = true;\n                if (changed) {\n                    let childCount = this.getChildCount();\n                    for (let i = 0; i < childCount; i++) {\n                        this.getChildAt(i).forceLayout();\n                    }\n                    this.mRecycler.markChildrenDirty();\n                }\n                this.layoutChildren();\n                this.mInLayout = false;\n                this.mOverscrollMax = (b - t) / AbsListView.OVERSCROLL_LIMIT_DIVISOR;\n            }\n            setFrame(left, top, right, bottom) {\n                const changed = super.setFrame(left, top, right, bottom);\n                if (changed) {\n                    const visible = this.getWindowVisibility() == View.VISIBLE;\n                }\n                return changed;\n            }\n            layoutChildren() {\n            }\n            updateScrollIndicators() {\n                if (this.mScrollUp != null) {\n                    let canScrollUp;\n                    canScrollUp = this.mFirstPosition > 0;\n                    if (!canScrollUp) {\n                        if (this.getChildCount() > 0) {\n                            let child = this.getChildAt(0);\n                            canScrollUp = child.getTop() < this.mListPadding.top;\n                        }\n                    }\n                    this.mScrollUp.setVisibility(canScrollUp ? View.VISIBLE : View.INVISIBLE);\n                }\n                if (this.mScrollDown != null) {\n                    let canScrollDown;\n                    let count = this.getChildCount();\n                    canScrollDown = (this.mFirstPosition + count) < this.mItemCount;\n                    if (!canScrollDown && count > 0) {\n                        let child = this.getChildAt(count - 1);\n                        canScrollDown = child.getBottom() > this.mBottom - this.mListPadding.bottom;\n                    }\n                    this.mScrollDown.setVisibility(canScrollDown ? View.VISIBLE : View.INVISIBLE);\n                }\n            }\n            getSelectedView() {\n                if (this.mItemCount > 0 && this.mSelectedPosition >= 0) {\n                    return this.getChildAt(this.mSelectedPosition - this.mFirstPosition);\n                }\n                else {\n                    return null;\n                }\n            }\n            getListPaddingTop() {\n                return this.mListPadding.top;\n            }\n            getListPaddingBottom() {\n                return this.mListPadding.bottom;\n            }\n            getListPaddingLeft() {\n                return this.mListPadding.left;\n            }\n            getListPaddingRight() {\n                return this.mListPadding.right;\n            }\n            obtainView(position, isScrap) {\n                isScrap[0] = false;\n                let scrapView;\n                scrapView = this.mRecycler.getTransientStateView(position);\n                if (scrapView == null) {\n                    scrapView = this.mRecycler.getScrapView(position);\n                }\n                let child;\n                if (scrapView != null) {\n                    child = this.mAdapter.getView(position, scrapView, this);\n                    if (child != scrapView) {\n                        this.mRecycler.addScrapView(scrapView, position);\n                        if (this.mCacheColorHint != 0) {\n                            child.setDrawingCacheBackgroundColor(this.mCacheColorHint);\n                        }\n                    }\n                    else {\n                        isScrap[0] = true;\n                        child.dispatchFinishTemporaryDetach();\n                    }\n                }\n                else {\n                    child = this.mAdapter.getView(position, null, this);\n                    if (this.mCacheColorHint != 0) {\n                        child.setDrawingCacheBackgroundColor(this.mCacheColorHint);\n                    }\n                }\n                if (this.mAdapterHasStableIds) {\n                    const vlp = child.getLayoutParams();\n                    let lp;\n                    if (vlp == null) {\n                        lp = this.generateDefaultLayoutParams();\n                    }\n                    else if (!this.checkLayoutParams(vlp)) {\n                        lp = this.generateLayoutParams(vlp);\n                    }\n                    else {\n                        lp = vlp;\n                    }\n                    lp.itemId = this.mAdapter.getItemId(position);\n                    child.setLayoutParams(lp);\n                }\n                return child;\n            }\n            positionSelector(...args) {\n                if (args.length === 4) {\n                    let [l, t, r, b] = args;\n                    this.mSelectorRect.set(l - this.mSelectionLeftPadding, t - this.mSelectionTopPadding, r + this.mSelectionRightPadding, b + this.mSelectionBottomPadding);\n                }\n                else {\n                    let position = args[0];\n                    let sel = args[1];\n                    if (position != AbsListView.INVALID_POSITION) {\n                        this.mSelectorPosition = position;\n                    }\n                    const selectorRect = this.mSelectorRect;\n                    selectorRect.set(sel.getLeft(), sel.getTop(), sel.getRight(), sel.getBottom());\n                    if (sel['adjustListItemSelectionBounds']) {\n                        sel.adjustListItemSelectionBounds(selectorRect);\n                    }\n                    this.positionSelector(selectorRect.left, selectorRect.top, selectorRect.right, selectorRect.bottom);\n                    const isChildViewEnabled = this.mIsChildViewEnabled;\n                    if (sel.isEnabled() != isChildViewEnabled) {\n                        this.mIsChildViewEnabled = !isChildViewEnabled;\n                        if (this.getSelectedItemPosition() != AbsListView.INVALID_POSITION) {\n                            this.refreshDrawableState();\n                        }\n                    }\n                }\n            }\n            dispatchDraw(canvas) {\n                let saveCount = 0;\n                const clipToPadding = (this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) == AbsListView.CLIP_TO_PADDING_MASK;\n                if (clipToPadding) {\n                    saveCount = canvas.save();\n                    const scrollX = this.mScrollX;\n                    const scrollY = this.mScrollY;\n                    canvas.clipRect(scrollX + this.mPaddingLeft, scrollY + this.mPaddingTop, scrollX + this.mRight - this.mLeft - this.mPaddingRight, scrollY + this.mBottom - this.mTop - this.mPaddingBottom);\n                    this.mGroupFlags &= ~AbsListView.CLIP_TO_PADDING_MASK;\n                }\n                const drawSelectorOnTop = this.mDrawSelectorOnTop;\n                if (!drawSelectorOnTop) {\n                    this.drawSelector(canvas);\n                }\n                super.dispatchDraw(canvas);\n                if (drawSelectorOnTop) {\n                    this.drawSelector(canvas);\n                }\n                if (clipToPadding) {\n                    canvas.restoreToCount(saveCount);\n                    this.mGroupFlags |= AbsListView.CLIP_TO_PADDING_MASK;\n                }\n            }\n            isPaddingOffsetRequired() {\n                return (this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) != AbsListView.CLIP_TO_PADDING_MASK;\n            }\n            getLeftPaddingOffset() {\n                return (this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) == AbsListView.CLIP_TO_PADDING_MASK ? 0 : -this.mPaddingLeft;\n            }\n            getTopPaddingOffset() {\n                return (this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) == AbsListView.CLIP_TO_PADDING_MASK ? 0 : -this.mPaddingTop;\n            }\n            getRightPaddingOffset() {\n                return (this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) == AbsListView.CLIP_TO_PADDING_MASK ? 0 : this.mPaddingRight;\n            }\n            getBottomPaddingOffset() {\n                return (this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) == AbsListView.CLIP_TO_PADDING_MASK ? 0 : this.mPaddingBottom;\n            }\n            onSizeChanged(w, h, oldw, oldh) {\n                if (this.getChildCount() > 0) {\n                    this.mDataChanged = true;\n                    this.rememberSyncState();\n                }\n            }\n            touchModeDrawsInPressedState() {\n                switch (this.mTouchMode) {\n                    case AbsListView.TOUCH_MODE_TAP:\n                    case AbsListView.TOUCH_MODE_DONE_WAITING:\n                        return true;\n                    default:\n                        return false;\n                }\n            }\n            shouldShowSelector() {\n                return (!this.isInTouchMode()) || (this.touchModeDrawsInPressedState() && this.isPressed());\n            }\n            drawSelector(canvas) {\n                if (!this.mSelectorRect.isEmpty()) {\n                    const selector = this.mSelector;\n                    selector.setBounds(this.mSelectorRect);\n                    selector.draw(canvas);\n                }\n            }\n            setDrawSelectorOnTop(onTop) {\n                this.mDrawSelectorOnTop = onTop;\n            }\n            setSelector(sel) {\n                if (this.mSelector != null) {\n                    this.mSelector.setCallback(null);\n                    this.unscheduleDrawable(this.mSelector);\n                }\n                this.mSelector = sel;\n                let padding = new Rect();\n                sel.getPadding(padding);\n                this.mSelectionLeftPadding = padding.left;\n                this.mSelectionTopPadding = padding.top;\n                this.mSelectionRightPadding = padding.right;\n                this.mSelectionBottomPadding = padding.bottom;\n                sel.setCallback(this);\n                this.updateSelectorState();\n            }\n            getSelector() {\n                return this.mSelector;\n            }\n            keyPressed() {\n                if (!this.isEnabled() || !this.isClickable()) {\n                    return;\n                }\n                let selector = this.mSelector;\n                let selectorRect = this.mSelectorRect;\n                if (selector != null && (this.isFocused() || this.touchModeDrawsInPressedState()) && !selectorRect.isEmpty()) {\n                    const v = this.getChildAt(this.mSelectedPosition - this.mFirstPosition);\n                    if (v != null) {\n                        if (v.hasFocusable())\n                            return;\n                        v.setPressed(true);\n                    }\n                    this.setPressed(true);\n                    const longClickable = this.isLongClickable();\n                    let d = selector.getCurrent();\n                    if (longClickable && !this.mDataChanged) {\n                        if (this.mPendingCheckForKeyLongPress == null) {\n                            this.mPendingCheckForKeyLongPress = new AbsListView.CheckForKeyLongPress(this);\n                        }\n                        this.mPendingCheckForKeyLongPress.rememberWindowAttachCount();\n                        this.postDelayed(this.mPendingCheckForKeyLongPress, ViewConfiguration.getLongPressTimeout());\n                    }\n                }\n            }\n            setScrollIndicators(up, down) {\n                this.mScrollUp = up;\n                this.mScrollDown = down;\n            }\n            updateSelectorState() {\n                if (this.mSelector != null) {\n                    if (this.shouldShowSelector()) {\n                        this.mSelector.setState(this.getDrawableState());\n                    }\n                    else {\n                        this.mSelector.setState(StateSet.NOTHING);\n                    }\n                }\n            }\n            drawableStateChanged() {\n                super.drawableStateChanged();\n                this.updateSelectorState();\n            }\n            onCreateDrawableState(extraSpace) {\n                if (this.mIsChildViewEnabled) {\n                    return super.onCreateDrawableState(extraSpace);\n                }\n                const enabledState = AbsListView.ENABLED_STATE_SET[0];\n                let state = super.onCreateDrawableState(extraSpace + 1);\n                let enabledPos = -1;\n                for (let i = state.length - 1; i >= 0; i--) {\n                    if (state[i] == enabledState) {\n                        enabledPos = i;\n                        break;\n                    }\n                }\n                if (enabledPos >= 0) {\n                    System.arraycopy(state, enabledPos + 1, state, enabledPos, state.length - enabledPos - 1);\n                }\n                return state;\n            }\n            verifyDrawable(dr) {\n                return this.mSelector == dr || super.verifyDrawable(dr);\n            }\n            jumpDrawablesToCurrentState() {\n                super.jumpDrawablesToCurrentState();\n                if (this.mSelector != null)\n                    this.mSelector.jumpToCurrentState();\n            }\n            onAttachedToWindow() {\n                super.onAttachedToWindow();\n                const treeObserver = this.getViewTreeObserver();\n                treeObserver.addOnTouchModeChangeListener(this);\n                if (this.mAdapter != null && this.mDataSetObserver == null) {\n                    this.mDataSetObserver = new AbsListView.AdapterDataSetObserver(this);\n                    this.mAdapter.registerDataSetObserver(this.mDataSetObserver);\n                    this.mDataChanged = true;\n                    this.mOldItemCount = this.mItemCount;\n                    this.mItemCount = this.mAdapter.getCount();\n                }\n            }\n            onDetachedFromWindow() {\n                super.onDetachedFromWindow();\n                this.dismissPopup();\n                this.mRecycler.clear();\n                const treeObserver = this.getViewTreeObserver();\n                treeObserver.removeOnTouchModeChangeListener(this);\n                if (this.mAdapter != null && this.mDataSetObserver != null) {\n                    this.mAdapter.unregisterDataSetObserver(this.mDataSetObserver);\n                    this.mDataSetObserver = null;\n                }\n                if (this.mFlingRunnable != null) {\n                    this.removeCallbacks(this.mFlingRunnable);\n                }\n                if (this.mPositionScroller != null) {\n                    this.mPositionScroller.stop();\n                }\n                if (this.mClearScrollingCache != null) {\n                    this.removeCallbacks(this.mClearScrollingCache);\n                }\n                if (this.mPerformClick_ != null) {\n                    this.removeCallbacks(this.mPerformClick_);\n                }\n                if (this.mTouchModeReset != null) {\n                    this.removeCallbacks(this.mTouchModeReset);\n                    this.mTouchModeReset.run();\n                }\n            }\n            onWindowFocusChanged(hasWindowFocus) {\n                super.onWindowFocusChanged(hasWindowFocus);\n                const touchMode = this.isInTouchMode() ? AbsListView.TOUCH_MODE_ON : AbsListView.TOUCH_MODE_OFF;\n                if (!hasWindowFocus) {\n                    this.setChildrenDrawingCacheEnabled(false);\n                    if (this.mFlingRunnable != null) {\n                        this.removeCallbacks(this.mFlingRunnable);\n                        this.mFlingRunnable.endFling();\n                        if (this.mPositionScroller != null) {\n                            this.mPositionScroller.stop();\n                        }\n                        if (this.mScrollY != 0) {\n                            this.mScrollY = 0;\n                            this.invalidateParentCaches();\n                            this.finishGlows();\n                            this.invalidate();\n                        }\n                    }\n                    this.dismissPopup();\n                    if (touchMode == AbsListView.TOUCH_MODE_OFF) {\n                        this.mResurrectToPosition = this.mSelectedPosition;\n                    }\n                }\n                else {\n                    if (this.mFiltered && !this.mPopupHidden) {\n                        this.showPopup();\n                    }\n                    if (touchMode != this.mLastTouchMode && this.mLastTouchMode != AbsListView.TOUCH_MODE_UNKNOWN) {\n                        if (touchMode == AbsListView.TOUCH_MODE_OFF) {\n                            this.resurrectSelection();\n                        }\n                        else {\n                            this.hideSelector();\n                            this.mLayoutMode = AbsListView.LAYOUT_NORMAL;\n                            this.layoutChildren();\n                        }\n                    }\n                }\n                this.mLastTouchMode = touchMode;\n            }\n            onCancelPendingInputEvents() {\n                super.onCancelPendingInputEvents();\n                if (this.mPerformClick_ != null) {\n                    this.removeCallbacks(this.mPerformClick_);\n                }\n                if (this.mPendingCheckForTap_ != null) {\n                    this.removeCallbacks(this.mPendingCheckForTap_);\n                }\n                if (this.mPendingCheckForLongPress_List != null) {\n                    this.removeCallbacks(this.mPendingCheckForLongPress_List);\n                }\n                if (this.mPendingCheckForKeyLongPress != null) {\n                    this.removeCallbacks(this.mPendingCheckForKeyLongPress);\n                }\n            }\n            performLongPress(child, longPressPosition, longPressId) {\n                let handled = false;\n                if (this.mOnItemLongClickListener != null) {\n                    handled = this.mOnItemLongClickListener.onItemLongClick(this, child, longPressPosition, longPressId);\n                }\n                if (handled) {\n                    this.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);\n                }\n                return handled;\n            }\n            onKeyDown(keyCode, event) {\n                return false;\n            }\n            onKeyUp(keyCode, event) {\n                if (KeyEvent.isConfirmKey(keyCode)) {\n                    if (!this.isEnabled()) {\n                        return true;\n                    }\n                    if (this.isClickable() && this.isPressed() && this.mSelectedPosition >= 0\n                        && this.mAdapter != null && this.mSelectedPosition < this.mAdapter.getCount()) {\n                        const view = this.getChildAt(this.mSelectedPosition - this.mFirstPosition);\n                        if (view != null) {\n                            this.performItemClick(view, this.mSelectedPosition, this.mSelectedRowId);\n                            view.setPressed(false);\n                        }\n                        this.setPressed(false);\n                        return true;\n                    }\n                }\n                return super.onKeyUp(keyCode, event);\n            }\n            dispatchSetPressed(pressed) {\n            }\n            pointToPosition(x, y) {\n                let frame = this.mTouchFrame;\n                if (frame == null) {\n                    this.mTouchFrame = new Rect();\n                    frame = this.mTouchFrame;\n                }\n                const count = this.getChildCount();\n                for (let i = count - 1; i >= 0; i--) {\n                    const child = this.getChildAt(i);\n                    if (child.getVisibility() == View.VISIBLE) {\n                        child.getHitRect(frame);\n                        if (frame.contains(x, y)) {\n                            return this.mFirstPosition + i;\n                        }\n                    }\n                }\n                return AbsListView.INVALID_POSITION;\n            }\n            pointToRowId(x, y) {\n                let position = this.pointToPosition(x, y);\n                if (position >= 0) {\n                    return this.mAdapter.getItemId(position);\n                }\n                return AbsListView.INVALID_ROW_ID;\n            }\n            checkOverScrollStartScrollIfNeeded() {\n                return this.mScrollY != 0;\n            }\n            startScrollIfNeeded(y) {\n                const deltaY = y - this.mMotionY;\n                const distance = Math.abs(deltaY);\n                const overscroll = this.checkOverScrollStartScrollIfNeeded();\n                if (overscroll || distance > this.mTouchSlop) {\n                    this.createScrollingCache();\n                    if (this.mScrollY != 0) {\n                        this.mTouchMode = AbsListView.TOUCH_MODE_OVERSCROLL;\n                        this.mMotionCorrection = 0;\n                    }\n                    else {\n                        this.mTouchMode = AbsListView.TOUCH_MODE_SCROLL;\n                        this.mMotionCorrection = deltaY > 0 ? this.mTouchSlop : -this.mTouchSlop;\n                    }\n                    this.removeCallbacks(this.mPendingCheckForLongPress_List);\n                    this.setPressed(false);\n                    const motionView = this.getChildAt(this.mMotionPosition - this.mFirstPosition);\n                    if (motionView != null) {\n                        motionView.setPressed(false);\n                    }\n                    this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);\n                    const parent = this.getParent();\n                    if (parent != null) {\n                        parent.requestDisallowInterceptTouchEvent(true);\n                    }\n                    this.scrollIfNeeded(y);\n                    return true;\n                }\n                return false;\n            }\n            scrollIfNeeded(y) {\n                const rawDeltaY = y - this.mMotionY;\n                const deltaY = rawDeltaY - this.mMotionCorrection;\n                let incrementalDeltaY = this.mLastY != Integer.MIN_VALUE ? y - this.mLastY : deltaY;\n                if (this.mTouchMode == AbsListView.TOUCH_MODE_SCROLL) {\n                    if (AbsListView.PROFILE_SCROLLING) {\n                        if (!this.mScrollProfilingStarted) {\n                            this.mScrollProfilingStarted = true;\n                        }\n                    }\n                    if (y != this.mLastY) {\n                        if ((this.mGroupFlags & AbsListView.FLAG_DISALLOW_INTERCEPT) == 0 && Math.abs(rawDeltaY) > this.mTouchSlop) {\n                            const parent = this.getParent();\n                            if (parent != null) {\n                                parent.requestDisallowInterceptTouchEvent(true);\n                            }\n                        }\n                        let motionIndex;\n                        if (this.mMotionPosition >= 0) {\n                            motionIndex = this.mMotionPosition - this.mFirstPosition;\n                        }\n                        else {\n                            motionIndex = this.getChildCount() / 2;\n                        }\n                        let motionViewPrevTop = 0;\n                        let motionView = this.getChildAt(motionIndex);\n                        if (motionView != null) {\n                            motionViewPrevTop = motionView.getTop();\n                        }\n                        let atEdge = false;\n                        if (incrementalDeltaY != 0) {\n                            atEdge = this.trackMotionScroll(deltaY, incrementalDeltaY);\n                        }\n                        motionView = this.getChildAt(motionIndex);\n                        if (motionView != null) {\n                            const motionViewRealTop = motionView.getTop();\n                            if (atEdge) {\n                                let overscroll = -incrementalDeltaY - (motionViewRealTop - motionViewPrevTop);\n                                this.overScrollBy(0, overscroll, 0, this.mScrollY, 0, 0, 0, this.mOverscrollDistance, true);\n                                if (Math.abs(this.mOverscrollDistance) == Math.abs(this.mScrollY)) {\n                                    if (this.mVelocityTracker != null) {\n                                        this.mVelocityTracker.clear();\n                                    }\n                                }\n                                const overscrollMode = this.getOverScrollMode();\n                                if (overscrollMode == AbsListView.OVER_SCROLL_ALWAYS || (overscrollMode == AbsListView.OVER_SCROLL_IF_CONTENT_SCROLLS && !this.contentFits())) {\n                                    this.mDirection = 0;\n                                    this.mTouchMode = AbsListView.TOUCH_MODE_OVERSCROLL;\n                                    if (rawDeltaY > 0) {\n                                    }\n                                    else if (rawDeltaY < 0) {\n                                    }\n                                }\n                            }\n                            this.mMotionY = y;\n                        }\n                        this.mLastY = y;\n                    }\n                }\n                else if (this.mTouchMode == AbsListView.TOUCH_MODE_OVERSCROLL) {\n                    if (y != this.mLastY) {\n                        const oldScroll = this.mScrollY;\n                        const newScroll = oldScroll - incrementalDeltaY;\n                        let newDirection = y > this.mLastY ? 1 : -1;\n                        if (this.mDirection == 0) {\n                            this.mDirection = newDirection;\n                        }\n                        let overScrollDistance = -incrementalDeltaY;\n                        if ((newScroll < 0 && oldScroll >= 0) || (newScroll > 0 && oldScroll <= 0)) {\n                            overScrollDistance = -oldScroll;\n                            incrementalDeltaY += overScrollDistance;\n                        }\n                        else {\n                            incrementalDeltaY = 0;\n                        }\n                        if (overScrollDistance != 0) {\n                            this.overScrollBy(0, overScrollDistance, 0, this.mScrollY, 0, 0, 0, this.mOverscrollDistance, true);\n                        }\n                        if (incrementalDeltaY != 0) {\n                            if (this.mScrollY != 0) {\n                                this.mScrollY = 0;\n                                this.invalidateParentIfNeeded();\n                            }\n                            this.trackMotionScroll(incrementalDeltaY, incrementalDeltaY);\n                            this.mTouchMode = AbsListView.TOUCH_MODE_SCROLL;\n                            const motionPosition = this.findClosestMotionRow(y);\n                            this.mMotionCorrection = 0;\n                            let motionView = this.getChildAt(motionPosition - this.mFirstPosition);\n                            this.mMotionViewOriginalTop = motionView != null ? motionView.getTop() : 0;\n                            this.mMotionY = y;\n                            this.mMotionPosition = motionPosition;\n                        }\n                        this.mLastY = y;\n                        this.mDirection = newDirection;\n                    }\n                }\n            }\n            onTouchModeChanged(isInTouchMode) {\n                if (isInTouchMode) {\n                    this.hideSelector();\n                    if (this.getHeight() > 0 && this.getChildCount() > 0) {\n                        this.layoutChildren();\n                    }\n                    this.updateSelectorState();\n                }\n                else {\n                    let touchMode = this.mTouchMode;\n                    if (touchMode == AbsListView.TOUCH_MODE_OVERSCROLL || touchMode == AbsListView.TOUCH_MODE_OVERFLING) {\n                        if (this.mFlingRunnable != null) {\n                            this.mFlingRunnable.endFling();\n                        }\n                        if (this.mPositionScroller != null) {\n                            this.mPositionScroller.stop();\n                        }\n                        if (this.mScrollY != 0) {\n                            this.mScrollY = 0;\n                            this.invalidateParentCaches();\n                            this.finishGlows();\n                            this.invalidate();\n                        }\n                    }\n                }\n            }\n            onTouchEvent(ev) {\n                if (!this.isEnabled()) {\n                    return this.isClickable() || this.isLongClickable();\n                }\n                if (this.mPositionScroller != null) {\n                    this.mPositionScroller.stop();\n                }\n                if (!this.isAttachedToWindow()) {\n                    return false;\n                }\n                this.initVelocityTrackerIfNotExists();\n                this.mVelocityTracker.addMovement(ev);\n                const actionMasked = ev.getActionMasked();\n                switch (actionMasked) {\n                    case MotionEvent.ACTION_DOWN:\n                        {\n                            this.onTouchDown(ev);\n                            break;\n                        }\n                    case MotionEvent.ACTION_MOVE:\n                        {\n                            this.onTouchMove(ev);\n                            break;\n                        }\n                    case MotionEvent.ACTION_UP:\n                        {\n                            this.onTouchUp(ev);\n                            break;\n                        }\n                    case MotionEvent.ACTION_CANCEL:\n                        {\n                            this.onTouchCancel();\n                            break;\n                        }\n                    case MotionEvent.ACTION_POINTER_UP:\n                        {\n                            this.onSecondaryPointerUp(ev);\n                            const x = this.mMotionX;\n                            const y = this.mMotionY;\n                            const motionPosition = this.pointToPosition(x, y);\n                            if (motionPosition >= 0) {\n                                const child = this.getChildAt(motionPosition - this.mFirstPosition);\n                                this.mMotionViewOriginalTop = child.getTop();\n                                this.mMotionPosition = motionPosition;\n                            }\n                            this.mLastY = y;\n                            break;\n                        }\n                    case MotionEvent.ACTION_POINTER_DOWN:\n                        {\n                            const index = ev.getActionIndex();\n                            const id = ev.getPointerId(index);\n                            const x = Math.floor(ev.getX(index));\n                            const y = Math.floor(ev.getY(index));\n                            this.mMotionCorrection = 0;\n                            this.mActivePointerId = id;\n                            this.mMotionX = x;\n                            this.mMotionY = y;\n                            const motionPosition = this.pointToPosition(x, y);\n                            if (motionPosition >= 0) {\n                                const child = this.getChildAt(motionPosition - this.mFirstPosition);\n                                this.mMotionViewOriginalTop = child.getTop();\n                                this.mMotionPosition = motionPosition;\n                            }\n                            this.mLastY = y;\n                            break;\n                        }\n                }\n                return true;\n            }\n            onTouchDown(ev) {\n                this.mActivePointerId = ev.getPointerId(0);\n                if (this.mTouchMode == AbsListView.TOUCH_MODE_OVERFLING) {\n                    this.mFlingRunnable.endFling();\n                    if (this.mPositionScroller != null) {\n                        this.mPositionScroller.stop();\n                    }\n                    this.mTouchMode = AbsListView.TOUCH_MODE_OVERSCROLL;\n                    this.mMotionX = Math.floor(ev.getX());\n                    this.mMotionY = Math.floor(ev.getY());\n                    this.mLastY = this.mMotionY;\n                    this.mMotionCorrection = 0;\n                    this.mDirection = 0;\n                }\n                else {\n                    const x = Math.floor(ev.getX());\n                    const y = Math.floor(ev.getY());\n                    let motionPosition = this.pointToPosition(x, y);\n                    if (!this.mDataChanged) {\n                        if (this.mTouchMode == AbsListView.TOUCH_MODE_FLING) {\n                            this.createScrollingCache();\n                            this.mTouchMode = AbsListView.TOUCH_MODE_SCROLL;\n                            this.mMotionCorrection = 0;\n                            motionPosition = this.findMotionRow(y);\n                            this.mFlingRunnable.flywheelTouch();\n                        }\n                        else if ((motionPosition >= 0) && this.getAdapter().isEnabled(motionPosition)) {\n                            this.mTouchMode = AbsListView.TOUCH_MODE_DOWN;\n                            if (this.mPendingCheckForTap_ == null) {\n                                this.mPendingCheckForTap_ = new AbsListView.CheckForTap(this);\n                            }\n                            this.postDelayed(this.mPendingCheckForTap_, ViewConfiguration.getTapTimeout());\n                        }\n                        else if (motionPosition < 0) {\n                            this.mTouchMode = AbsListView.TOUCH_MODE_DOWN;\n                        }\n                    }\n                    if (motionPosition >= 0) {\n                        const v = this.getChildAt(motionPosition - this.mFirstPosition);\n                        this.mMotionViewOriginalTop = v.getTop();\n                    }\n                    this.mMotionX = x;\n                    this.mMotionY = y;\n                    this.mMotionPosition = motionPosition;\n                    this.mLastY = Integer.MIN_VALUE;\n                }\n                if (this.mTouchMode == AbsListView.TOUCH_MODE_DOWN && this.mMotionPosition != AbsListView.INVALID_POSITION\n                    && this.performButtonActionOnTouchDown(ev)) {\n                    this.removeCallbacks(this.mPendingCheckForTap_);\n                }\n            }\n            onTouchMove(ev) {\n                let pointerIndex = ev.findPointerIndex(this.mActivePointerId);\n                if (pointerIndex == -1) {\n                    pointerIndex = 0;\n                    this.mActivePointerId = ev.getPointerId(pointerIndex);\n                }\n                if (this.mDataChanged) {\n                    this.layoutChildren();\n                }\n                const y = Math.floor(ev.getY(pointerIndex));\n                switch (this.mTouchMode) {\n                    case AbsListView.TOUCH_MODE_DOWN:\n                    case AbsListView.TOUCH_MODE_TAP:\n                    case AbsListView.TOUCH_MODE_DONE_WAITING:\n                        if (this.startScrollIfNeeded(y)) {\n                            break;\n                        }\n                        const x = ev.getX(pointerIndex);\n                        if (!this.pointInView(x, y, this.mTouchSlop)) {\n                            this.setPressed(false);\n                            const motionView = this.getChildAt(this.mMotionPosition - this.mFirstPosition);\n                            if (motionView != null) {\n                                motionView.setPressed(false);\n                            }\n                            this.removeCallbacks(this.mTouchMode == AbsListView.TOUCH_MODE_DOWN ? this.mPendingCheckForTap_ : this.mPendingCheckForLongPress_List);\n                            this.mTouchMode = AbsListView.TOUCH_MODE_DONE_WAITING;\n                            this.updateSelectorState();\n                        }\n                        break;\n                    case AbsListView.TOUCH_MODE_SCROLL:\n                    case AbsListView.TOUCH_MODE_OVERSCROLL:\n                        this.scrollIfNeeded(y);\n                        break;\n                }\n            }\n            onTouchUp(ev) {\n                switch (this.mTouchMode) {\n                    case AbsListView.TOUCH_MODE_DOWN:\n                    case AbsListView.TOUCH_MODE_TAP:\n                    case AbsListView.TOUCH_MODE_DONE_WAITING:\n                        const motionPosition = this.mMotionPosition;\n                        const child = this.getChildAt(motionPosition - this.mFirstPosition);\n                        if (child != null) {\n                            if (this.mTouchMode != AbsListView.TOUCH_MODE_DOWN) {\n                                child.setPressed(false);\n                            }\n                            const x = ev.getX();\n                            const inList = x > this.mListPadding.left && x < this.getWidth() - this.mListPadding.right;\n                            if (inList && !child.hasFocusable()) {\n                                if (this.mPerformClick_ == null) {\n                                    this.mPerformClick_ = new AbsListView.PerformClick(this);\n                                }\n                                const performClick = this.mPerformClick_;\n                                performClick.mClickMotionPosition = motionPosition;\n                                performClick.rememberWindowAttachCount();\n                                this.mResurrectToPosition = motionPosition;\n                                if (this.mTouchMode == AbsListView.TOUCH_MODE_DOWN || this.mTouchMode == AbsListView.TOUCH_MODE_TAP) {\n                                    this.removeCallbacks(this.mTouchMode == AbsListView.TOUCH_MODE_DOWN ? this.mPendingCheckForTap_ : this.mPendingCheckForLongPress_List);\n                                    this.mLayoutMode = AbsListView.LAYOUT_NORMAL;\n                                    if (!this.mDataChanged && this.mAdapter.isEnabled(motionPosition)) {\n                                        this.mTouchMode = AbsListView.TOUCH_MODE_TAP;\n                                        this.setSelectedPositionInt(this.mMotionPosition);\n                                        this.layoutChildren();\n                                        child.setPressed(true);\n                                        this.positionSelector(this.mMotionPosition, child);\n                                        this.setPressed(true);\n                                        if (this.mSelector != null) {\n                                            let d = this.mSelector.getCurrent();\n                                        }\n                                        if (this.mTouchModeReset != null) {\n                                            this.removeCallbacks(this.mTouchModeReset);\n                                        }\n                                        this.mTouchModeReset = (() => {\n                                            const inner_this = this;\n                                            class _Inner {\n                                                run() {\n                                                    inner_this.mTouchModeReset = null;\n                                                    inner_this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                                                    child.setPressed(false);\n                                                    inner_this.setPressed(false);\n                                                    if (!inner_this.mDataChanged && inner_this.isAttachedToWindow()) {\n                                                        performClick.run();\n                                                    }\n                                                }\n                                            }\n                                            return new _Inner();\n                                        })();\n                                        this.postDelayed(this.mTouchModeReset, ViewConfiguration.getPressedStateDuration());\n                                    }\n                                    else {\n                                        this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                                        this.updateSelectorState();\n                                    }\n                                    return;\n                                }\n                                else if (!this.mDataChanged && this.mAdapter.isEnabled(motionPosition)) {\n                                    performClick.run();\n                                }\n                            }\n                        }\n                        this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                        this.updateSelectorState();\n                        break;\n                    case AbsListView.TOUCH_MODE_SCROLL:\n                        const childCount = this.getChildCount();\n                        if (childCount > 0) {\n                            const firstChildTop = this.getChildAt(0).getTop();\n                            const lastChildBottom = this.getChildAt(childCount - 1).getBottom();\n                            const contentTop = this.mListPadding.top;\n                            const contentBottom = this.getHeight() - this.mListPadding.bottom;\n                            if (this.mFirstPosition == 0 && firstChildTop >= contentTop && this.mFirstPosition + childCount < this.mItemCount\n                                && lastChildBottom <= this.getHeight() - contentBottom) {\n                                this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                                this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_IDLE);\n                            }\n                            else {\n                                const velocityTracker = this.mVelocityTracker;\n                                velocityTracker.computeCurrentVelocity(1000, this.mMaximumVelocity);\n                                const initialVelocity = Math.floor((velocityTracker.getYVelocity(this.mActivePointerId) * this.mVelocityScale));\n                                if (Math.abs(initialVelocity) > this.mMinimumVelocity\n                                    && !((this.mFirstPosition == 0 && firstChildTop == contentTop - this.mOverscrollDistance)\n                                        || (this.mFirstPosition + childCount == this.mItemCount\n                                            && lastChildBottom == contentBottom + this.mOverscrollDistance))) {\n                                    if (this.mFlingRunnable == null) {\n                                        this.mFlingRunnable = new AbsListView.FlingRunnable(this);\n                                    }\n                                    this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_FLING);\n                                    this.mFlingRunnable.start(-initialVelocity);\n                                }\n                                else {\n                                    this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                                    this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_IDLE);\n                                    if (this.mFlingRunnable != null) {\n                                        this.mFlingRunnable.endFling();\n                                    }\n                                    if (this.mPositionScroller != null) {\n                                        this.mPositionScroller.stop();\n                                    }\n                                }\n                            }\n                        }\n                        else {\n                            this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                            this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_IDLE);\n                        }\n                        break;\n                    case AbsListView.TOUCH_MODE_OVERSCROLL:\n                        if (this.mFlingRunnable == null) {\n                            this.mFlingRunnable = new AbsListView.FlingRunnable(this);\n                        }\n                        const velocityTracker = this.mVelocityTracker;\n                        velocityTracker.computeCurrentVelocity(1000, this.mMaximumVelocity);\n                        const initialVelocity = Math.floor(velocityTracker.getYVelocity(this.mActivePointerId));\n                        this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_FLING);\n                        if (Math.abs(initialVelocity) > this.mMinimumVelocity) {\n                            this.mFlingRunnable.startOverfling(-initialVelocity);\n                        }\n                        else {\n                            this.mFlingRunnable.startSpringback();\n                        }\n                        break;\n                }\n                this.setPressed(false);\n                this.invalidate();\n                this.removeCallbacks(this.mPendingCheckForLongPress_List);\n                this.recycleVelocityTracker();\n                this.mActivePointerId = AbsListView.INVALID_POINTER;\n                if (AbsListView.PROFILE_SCROLLING) {\n                    if (this.mScrollProfilingStarted) {\n                        this.mScrollProfilingStarted = false;\n                    }\n                }\n            }\n            onTouchCancel() {\n                switch (this.mTouchMode) {\n                    case AbsListView.TOUCH_MODE_OVERSCROLL:\n                        if (this.mFlingRunnable == null) {\n                            this.mFlingRunnable = new AbsListView.FlingRunnable(this);\n                        }\n                        this.mFlingRunnable.startSpringback();\n                        break;\n                    case AbsListView.TOUCH_MODE_OVERFLING:\n                        break;\n                    default:\n                        this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                        this.setPressed(false);\n                        const motionView = this.getChildAt(this.mMotionPosition - this.mFirstPosition);\n                        if (motionView != null) {\n                            motionView.setPressed(false);\n                        }\n                        this.clearScrollingCache();\n                        this.removeCallbacks(this.mPendingCheckForLongPress_List);\n                        this.recycleVelocityTracker();\n                }\n                this.mActivePointerId = AbsListView.INVALID_POINTER;\n            }\n            onOverScrolled(scrollX, scrollY, clampedX, clampedY) {\n                if (this.mScrollY != scrollY) {\n                    this.onScrollChanged(this.mScrollX, scrollY, this.mScrollX, this.mScrollY);\n                    this.mScrollY = scrollY;\n                    this.invalidateParentIfNeeded();\n                    this.awakenScrollBars();\n                }\n            }\n            onGenericMotionEvent(event) {\n                if (event.isPointerEvent()) {\n                    switch (event.getAction()) {\n                        case MotionEvent.ACTION_SCROLL:\n                            {\n                                if (this.mTouchMode == AbsListView.TOUCH_MODE_REST) {\n                                    const vscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL);\n                                    if (vscroll != 0) {\n                                        const delta = Math.floor((vscroll * this.getVerticalScrollFactor()));\n                                        if (!this.trackMotionScroll(delta, delta)) {\n                                            return true;\n                                        }\n                                    }\n                                }\n                            }\n                    }\n                }\n                return super.onGenericMotionEvent(event);\n            }\n            draw(canvas) {\n                super.draw(canvas);\n            }\n            setOverScrollEffectPadding(leftPadding, rightPadding) {\n                this.mGlowPaddingLeft = leftPadding;\n                this.mGlowPaddingRight = rightPadding;\n            }\n            initOrResetVelocityTracker() {\n                if (this.mVelocityTracker == null) {\n                    this.mVelocityTracker = VelocityTracker.obtain();\n                }\n                else {\n                    this.mVelocityTracker.clear();\n                }\n            }\n            initVelocityTrackerIfNotExists() {\n                if (this.mVelocityTracker == null) {\n                    this.mVelocityTracker = VelocityTracker.obtain();\n                }\n            }\n            recycleVelocityTracker() {\n                if (this.mVelocityTracker != null) {\n                    this.mVelocityTracker.recycle();\n                    this.mVelocityTracker = null;\n                }\n            }\n            requestDisallowInterceptTouchEvent(disallowIntercept) {\n                if (disallowIntercept) {\n                    this.recycleVelocityTracker();\n                }\n                super.requestDisallowInterceptTouchEvent(disallowIntercept);\n            }\n            onInterceptTouchEvent(ev) {\n                let action = ev.getAction();\n                let v;\n                if (this.mPositionScroller != null) {\n                    this.mPositionScroller.stop();\n                }\n                if (!this.isAttachedToWindow()) {\n                    return false;\n                }\n                switch (action & MotionEvent.ACTION_MASK) {\n                    case MotionEvent.ACTION_DOWN:\n                        {\n                            let touchMode = this.mTouchMode;\n                            if (touchMode == AbsListView.TOUCH_MODE_OVERFLING || touchMode == AbsListView.TOUCH_MODE_OVERSCROLL) {\n                                this.mMotionCorrection = 0;\n                                return true;\n                            }\n                            const x = Math.floor(ev.getX());\n                            const y = Math.floor(ev.getY());\n                            this.mActivePointerId = ev.getPointerId(0);\n                            let motionPosition = this.findMotionRow(y);\n                            if (touchMode != AbsListView.TOUCH_MODE_FLING && motionPosition >= 0) {\n                                v = this.getChildAt(motionPosition - this.mFirstPosition);\n                                this.mMotionViewOriginalTop = v.getTop();\n                                this.mMotionX = x;\n                                this.mMotionY = y;\n                                this.mMotionPosition = motionPosition;\n                                this.mTouchMode = AbsListView.TOUCH_MODE_DOWN;\n                                this.clearScrollingCache();\n                            }\n                            this.mLastY = Integer.MIN_VALUE;\n                            this.initOrResetVelocityTracker();\n                            this.mVelocityTracker.addMovement(ev);\n                            if (touchMode == AbsListView.TOUCH_MODE_FLING) {\n                                return true;\n                            }\n                            break;\n                        }\n                    case MotionEvent.ACTION_MOVE:\n                        {\n                            switch (this.mTouchMode) {\n                                case AbsListView.TOUCH_MODE_DOWN:\n                                    let pointerIndex = ev.findPointerIndex(this.mActivePointerId);\n                                    if (pointerIndex == -1) {\n                                        pointerIndex = 0;\n                                        this.mActivePointerId = ev.getPointerId(pointerIndex);\n                                    }\n                                    const y = Math.floor(ev.getY(pointerIndex));\n                                    this.initVelocityTrackerIfNotExists();\n                                    this.mVelocityTracker.addMovement(ev);\n                                    if (this.startScrollIfNeeded(y)) {\n                                        return true;\n                                    }\n                                    break;\n                            }\n                            break;\n                        }\n                    case MotionEvent.ACTION_CANCEL:\n                    case MotionEvent.ACTION_UP:\n                        {\n                            this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                            this.mActivePointerId = AbsListView.INVALID_POINTER;\n                            this.recycleVelocityTracker();\n                            this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_IDLE);\n                            break;\n                        }\n                    case MotionEvent.ACTION_POINTER_UP:\n                        {\n                            this.onSecondaryPointerUp(ev);\n                            break;\n                        }\n                }\n                return false;\n            }\n            onSecondaryPointerUp(ev) {\n                const pointerIndex = (ev.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;\n                const pointerId = ev.getPointerId(pointerIndex);\n                if (pointerId == this.mActivePointerId) {\n                    const newPointerIndex = pointerIndex == 0 ? 1 : 0;\n                    this.mMotionX = Math.floor(ev.getX(newPointerIndex));\n                    this.mMotionY = Math.floor(ev.getY(newPointerIndex));\n                    this.mMotionCorrection = 0;\n                    this.mActivePointerId = ev.getPointerId(newPointerIndex);\n                }\n            }\n            addTouchables(views) {\n                const count = this.getChildCount();\n                const firstPosition = this.mFirstPosition;\n                const adapter = this.mAdapter;\n                if (adapter == null) {\n                    return;\n                }\n                for (let i = 0; i < count; i++) {\n                    const child = this.getChildAt(i);\n                    if (adapter.isEnabled(firstPosition + i)) {\n                        views.add(child);\n                    }\n                    child.addTouchables(views);\n                }\n            }\n            reportScrollStateChange(newState) {\n                if (newState != this.mLastScrollState) {\n                    if (this.mOnScrollListener != null) {\n                        this.mLastScrollState = newState;\n                        this.mOnScrollListener.onScrollStateChanged(this, newState);\n                    }\n                }\n            }\n            setFriction(friction) {\n                if (this.mFlingRunnable == null) {\n                    this.mFlingRunnable = new AbsListView.FlingRunnable(this);\n                }\n                this.mFlingRunnable.mScroller.setFriction(friction);\n            }\n            setVelocityScale(scale) {\n                this.mVelocityScale = scale;\n            }\n            smoothScrollToPositionFromTop(position, offset, duration) {\n                if (this.mPositionScroller == null) {\n                    this.mPositionScroller = new AbsListView.PositionScroller(this);\n                }\n                this.mPositionScroller.startWithOffset(position, offset, duration);\n            }\n            smoothScrollToPosition(position, boundPosition) {\n                if (this.mPositionScroller == null) {\n                    this.mPositionScroller = new AbsListView.PositionScroller(this);\n                }\n                this.mPositionScroller.start(position, boundPosition);\n            }\n            smoothScrollBy(distance, duration, linear = false) {\n                if (this.mFlingRunnable == null) {\n                    this.mFlingRunnable = new AbsListView.FlingRunnable(this);\n                }\n                const firstPos = this.mFirstPosition;\n                const childCount = this.getChildCount();\n                const lastPos = firstPos + childCount;\n                const topLimit = this.getPaddingTop();\n                const bottomLimit = this.getHeight() - this.getPaddingBottom();\n                if (distance == 0 || this.mItemCount == 0 || childCount == 0\n                    || (firstPos == 0 && this.getChildAt(0).getTop() == topLimit && distance < 0)\n                    || (lastPos == this.mItemCount && this.getChildAt(childCount - 1).getBottom() == bottomLimit && distance > 0)) {\n                    this.mFlingRunnable.endFling();\n                    if (this.mPositionScroller != null) {\n                        this.mPositionScroller.stop();\n                    }\n                }\n                else {\n                    this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_FLING);\n                    this.mFlingRunnable.startScroll(distance, duration, linear);\n                }\n            }\n            smoothScrollByOffset(position) {\n                let index = -1;\n                if (position < 0) {\n                    index = this.getFirstVisiblePosition();\n                }\n                else if (position > 0) {\n                    index = this.getLastVisiblePosition();\n                }\n                if (index > -1) {\n                    let child = this.getChildAt(index - this.getFirstVisiblePosition());\n                    if (child != null) {\n                        let visibleRect = new Rect();\n                        if (child.getGlobalVisibleRect(visibleRect)) {\n                            let childRectArea = child.getWidth() * child.getHeight();\n                            let visibleRectArea = visibleRect.width() * visibleRect.height();\n                            let visibleArea = (visibleRectArea / childRectArea);\n                            const visibleThreshold = 0.75;\n                            if ((position < 0) && (visibleArea < visibleThreshold)) {\n                                ++index;\n                            }\n                            else if ((position > 0) && (visibleArea < visibleThreshold)) {\n                                --index;\n                            }\n                        }\n                        this.smoothScrollToPosition(Math.max(0, Math.min(this.getCount(), index + position)));\n                    }\n                }\n            }\n            createScrollingCache() {\n                if (this.mScrollingCacheEnabled && !this.mCachingStarted && !this.isHardwareAccelerated()) {\n                    this.setChildrenDrawnWithCacheEnabled(true);\n                    this.setChildrenDrawingCacheEnabled(true);\n                    this.mCachingStarted = this.mCachingActive = true;\n                }\n            }\n            clearScrollingCache() {\n                if (!this.isHardwareAccelerated()) {\n                    if (this.mClearScrollingCache == null) {\n                        this.mClearScrollingCache = (() => {\n                            const inner_this = this;\n                            class _Inner {\n                                run() {\n                                    if (inner_this.mCachingStarted) {\n                                        inner_this.mCachingStarted = inner_this.mCachingActive = false;\n                                        inner_this.setChildrenDrawnWithCacheEnabled(false);\n                                        if ((inner_this.mPersistentDrawingCache & AbsListView.PERSISTENT_SCROLLING_CACHE) == 0) {\n                                            inner_this.setChildrenDrawingCacheEnabled(false);\n                                        }\n                                        if (!inner_this.isAlwaysDrawnWithCacheEnabled()) {\n                                            inner_this.invalidate();\n                                        }\n                                    }\n                                }\n                            }\n                            return new _Inner();\n                        })();\n                    }\n                    this.post(this.mClearScrollingCache);\n                }\n            }\n            scrollListBy(y) {\n                this.trackMotionScroll(-y, -y);\n            }\n            canScrollList(direction) {\n                const childCount = this.getChildCount();\n                if (childCount == 0) {\n                    return false;\n                }\n                const firstPosition = this.mFirstPosition;\n                const listPadding = this.mListPadding;\n                if (direction > 0) {\n                    const lastBottom = this.getChildAt(childCount - 1).getBottom();\n                    const lastPosition = firstPosition + childCount;\n                    return lastPosition < this.mItemCount || lastBottom > this.getHeight() - listPadding.bottom;\n                }\n                else {\n                    const firstTop = this.getChildAt(0).getTop();\n                    return firstPosition > 0 || firstTop < listPadding.top;\n                }\n            }\n            trackMotionScroll(deltaY, incrementalDeltaY) {\n                const childCount = this.getChildCount();\n                if (childCount == 0) {\n                    return true;\n                }\n                const firstTop = this.getChildAt(0).getTop();\n                const lastBottom = this.getChildAt(childCount - 1).getBottom();\n                const listPadding = this.mListPadding;\n                let effectivePaddingTop = 0;\n                let effectivePaddingBottom = 0;\n                if ((this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) == AbsListView.CLIP_TO_PADDING_MASK) {\n                    effectivePaddingTop = listPadding.top;\n                    effectivePaddingBottom = listPadding.bottom;\n                }\n                const spaceAbove = effectivePaddingTop - firstTop;\n                const end = this.getHeight() - effectivePaddingBottom;\n                const spaceBelow = lastBottom - end;\n                const height = this.getHeight() - this.mPaddingBottom - this.mPaddingTop;\n                if (deltaY < 0) {\n                    deltaY = Math.max(-(height - 1), deltaY);\n                }\n                else {\n                    deltaY = Math.min(height - 1, deltaY);\n                }\n                if (incrementalDeltaY < 0) {\n                    incrementalDeltaY = Math.max(-(height - 1), incrementalDeltaY);\n                }\n                else {\n                    incrementalDeltaY = Math.min(height - 1, incrementalDeltaY);\n                }\n                const firstPosition = this.mFirstPosition;\n                if (firstPosition == 0) {\n                    this.mFirstPositionDistanceGuess = firstTop - listPadding.top;\n                }\n                else {\n                    this.mFirstPositionDistanceGuess += incrementalDeltaY;\n                }\n                if (firstPosition + childCount == this.mItemCount) {\n                    this.mLastPositionDistanceGuess = lastBottom + listPadding.bottom;\n                }\n                else {\n                    this.mLastPositionDistanceGuess += incrementalDeltaY;\n                }\n                const cannotScrollDown = (firstPosition == 0 && firstTop >= listPadding.top && incrementalDeltaY >= 0);\n                const cannotScrollUp = (firstPosition + childCount == this.mItemCount && lastBottom <= this.getHeight() - listPadding.bottom && incrementalDeltaY <= 0);\n                if (cannotScrollDown || cannotScrollUp) {\n                    return incrementalDeltaY != 0;\n                }\n                const down = incrementalDeltaY < 0;\n                const inTouchMode = this.isInTouchMode();\n                if (inTouchMode) {\n                    this.hideSelector();\n                }\n                const headerViewsCount = this.getHeaderViewsCount();\n                const footerViewsStart = this.mItemCount - this.getFooterViewsCount();\n                let start = 0;\n                let count = 0;\n                if (down) {\n                    let top = -incrementalDeltaY;\n                    if ((this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) == AbsListView.CLIP_TO_PADDING_MASK) {\n                        top += listPadding.top;\n                    }\n                    for (let i = 0; i < childCount; i++) {\n                        const child = this.getChildAt(i);\n                        if (child.getBottom() >= top) {\n                            break;\n                        }\n                        else {\n                            count++;\n                            let position = firstPosition + i;\n                            if (position >= headerViewsCount && position < footerViewsStart) {\n                                this.mRecycler.addScrapView(child, position);\n                            }\n                        }\n                    }\n                }\n                else {\n                    let bottom = this.getHeight() - incrementalDeltaY;\n                    if ((this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) == AbsListView.CLIP_TO_PADDING_MASK) {\n                        bottom -= listPadding.bottom;\n                    }\n                    for (let i = childCount - 1; i >= 0; i--) {\n                        const child = this.getChildAt(i);\n                        if (child.getTop() <= bottom) {\n                            break;\n                        }\n                        else {\n                            start = i;\n                            count++;\n                            let position = firstPosition + i;\n                            if (position >= headerViewsCount && position < footerViewsStart) {\n                                this.mRecycler.addScrapView(child, position);\n                            }\n                        }\n                    }\n                }\n                this.mMotionViewNewTop = this.mMotionViewOriginalTop + deltaY;\n                this.mBlockLayoutRequests = true;\n                if (count > 0) {\n                    this.detachViewsFromParent(start, count);\n                    this.mRecycler.removeSkippedScrap();\n                }\n                if (!this.awakenScrollBars()) {\n                    this.invalidate();\n                }\n                this.offsetChildrenTopAndBottom(incrementalDeltaY);\n                if (down) {\n                    this.mFirstPosition += count;\n                }\n                const absIncrementalDeltaY = Math.abs(incrementalDeltaY);\n                if (spaceAbove < absIncrementalDeltaY || spaceBelow < absIncrementalDeltaY) {\n                    this.fillGap(down);\n                }\n                if (!inTouchMode && this.mSelectedPosition != AbsListView.INVALID_POSITION) {\n                    const childIndex = this.mSelectedPosition - this.mFirstPosition;\n                    if (childIndex >= 0 && childIndex < this.getChildCount()) {\n                        this.positionSelector(this.mSelectedPosition, this.getChildAt(childIndex));\n                    }\n                }\n                else if (this.mSelectorPosition != AbsListView.INVALID_POSITION) {\n                    const childIndex = this.mSelectorPosition - this.mFirstPosition;\n                    if (childIndex >= 0 && childIndex < this.getChildCount()) {\n                        this.positionSelector(AbsListView.INVALID_POSITION, this.getChildAt(childIndex));\n                    }\n                }\n                else {\n                    this.mSelectorRect.setEmpty();\n                }\n                this.mBlockLayoutRequests = false;\n                this.invokeOnItemScrollListener();\n                return false;\n            }\n            getHeaderViewsCount() {\n                return 0;\n            }\n            getFooterViewsCount() {\n                return 0;\n            }\n            hideSelector() {\n                if (this.mSelectedPosition != AbsListView.INVALID_POSITION) {\n                    if (this.mLayoutMode != AbsListView.LAYOUT_SPECIFIC) {\n                        this.mResurrectToPosition = this.mSelectedPosition;\n                    }\n                    if (this.mNextSelectedPosition >= 0 && this.mNextSelectedPosition != this.mSelectedPosition) {\n                        this.mResurrectToPosition = this.mNextSelectedPosition;\n                    }\n                    this.setSelectedPositionInt(AbsListView.INVALID_POSITION);\n                    this.setNextSelectedPositionInt(AbsListView.INVALID_POSITION);\n                    this.mSelectedTop = 0;\n                }\n            }\n            reconcileSelectedPosition() {\n                let position = this.mSelectedPosition;\n                if (position < 0) {\n                    position = this.mResurrectToPosition;\n                }\n                position = Math.max(0, position);\n                position = Math.min(position, this.mItemCount - 1);\n                return position;\n            }\n            findClosestMotionRow(y) {\n                const childCount = this.getChildCount();\n                if (childCount == 0) {\n                    return AbsListView.INVALID_POSITION;\n                }\n                const motionRow = this.findMotionRow(y);\n                return motionRow != AbsListView.INVALID_POSITION ? motionRow : this.mFirstPosition + childCount - 1;\n            }\n            invalidateViews() {\n                this.mDataChanged = true;\n                this.rememberSyncState();\n                this.requestLayout();\n                this.invalidate();\n            }\n            resurrectSelectionIfNeeded() {\n                if (this.mSelectedPosition < 0 && this.resurrectSelection()) {\n                    this.updateSelectorState();\n                    return true;\n                }\n                return false;\n            }\n            resurrectSelection() {\n                const childCount = this.getChildCount();\n                if (childCount <= 0) {\n                    return false;\n                }\n                let selectedTop = 0;\n                let selectedPos;\n                let childrenTop = this.mListPadding.top;\n                let childrenBottom = this.mBottom - this.mTop - this.mListPadding.bottom;\n                const firstPosition = this.mFirstPosition;\n                const toPosition = this.mResurrectToPosition;\n                let down = true;\n                if (toPosition >= firstPosition && toPosition < firstPosition + childCount) {\n                    selectedPos = toPosition;\n                    const selected = this.getChildAt(selectedPos - this.mFirstPosition);\n                    selectedTop = selected.getTop();\n                    let selectedBottom = selected.getBottom();\n                    if (selectedTop < childrenTop) {\n                        selectedTop = childrenTop + this.getVerticalFadingEdgeLength();\n                    }\n                    else if (selectedBottom > childrenBottom) {\n                        selectedTop = childrenBottom - selected.getMeasuredHeight() - this.getVerticalFadingEdgeLength();\n                    }\n                }\n                else {\n                    if (toPosition < firstPosition) {\n                        selectedPos = firstPosition;\n                        for (let i = 0; i < childCount; i++) {\n                            const v = this.getChildAt(i);\n                            const top = v.getTop();\n                            if (i == 0) {\n                                selectedTop = top;\n                                if (firstPosition > 0 || top < childrenTop) {\n                                    childrenTop += this.getVerticalFadingEdgeLength();\n                                }\n                            }\n                            if (top >= childrenTop) {\n                                selectedPos = firstPosition + i;\n                                selectedTop = top;\n                                break;\n                            }\n                        }\n                    }\n                    else {\n                        const itemCount = this.mItemCount;\n                        down = false;\n                        selectedPos = firstPosition + childCount - 1;\n                        for (let i = childCount - 1; i >= 0; i--) {\n                            const v = this.getChildAt(i);\n                            const top = v.getTop();\n                            const bottom = v.getBottom();\n                            if (i == childCount - 1) {\n                                selectedTop = top;\n                                if (firstPosition + childCount < itemCount || bottom > childrenBottom) {\n                                    childrenBottom -= this.getVerticalFadingEdgeLength();\n                                }\n                            }\n                            if (bottom <= childrenBottom) {\n                                selectedPos = firstPosition + i;\n                                selectedTop = top;\n                                break;\n                            }\n                        }\n                    }\n                }\n                this.mResurrectToPosition = AbsListView.INVALID_POSITION;\n                this.removeCallbacks(this.mFlingRunnable);\n                if (this.mPositionScroller != null) {\n                    this.mPositionScroller.stop();\n                }\n                this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                this.clearScrollingCache();\n                this.mSpecificTop = selectedTop;\n                selectedPos = this.lookForSelectablePosition(selectedPos, down);\n                if (selectedPos >= firstPosition && selectedPos <= this.getLastVisiblePosition()) {\n                    this.mLayoutMode = AbsListView.LAYOUT_SPECIFIC;\n                    this.updateSelectorState();\n                    this.setSelectionInt(selectedPos);\n                    this.invokeOnItemScrollListener();\n                }\n                else {\n                    selectedPos = AbsListView.INVALID_POSITION;\n                }\n                this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_IDLE);\n                return selectedPos >= 0;\n            }\n            confirmCheckedPositionsById() {\n                this.mCheckStates.clear();\n                let checkedCountChanged = false;\n                for (let checkedIndex = 0; checkedIndex < this.mCheckedIdStates.size(); checkedIndex++) {\n                    const id = this.mCheckedIdStates.keyAt(checkedIndex);\n                    const lastPos = this.mCheckedIdStates.valueAt(checkedIndex);\n                    const lastPosId = this.mAdapter.getItemId(lastPos);\n                    if (id != lastPosId) {\n                        const start = Math.max(0, lastPos - AbsListView.CHECK_POSITION_SEARCH_DISTANCE);\n                        const end = Math.min(lastPos + AbsListView.CHECK_POSITION_SEARCH_DISTANCE, this.mItemCount);\n                        let found = false;\n                        for (let searchPos = start; searchPos < end; searchPos++) {\n                            const searchId = this.mAdapter.getItemId(searchPos);\n                            if (id == searchId) {\n                                found = true;\n                                this.mCheckStates.put(searchPos, true);\n                                this.mCheckedIdStates.setValueAt(checkedIndex, searchPos);\n                                break;\n                            }\n                        }\n                        if (!found) {\n                            this.mCheckedIdStates.delete(id);\n                            checkedIndex--;\n                            this.mCheckedItemCount--;\n                            checkedCountChanged = true;\n                        }\n                    }\n                    else {\n                        this.mCheckStates.put(lastPos, true);\n                    }\n                }\n                if (checkedCountChanged && this.mChoiceActionMode != null) {\n                    this.mChoiceActionMode.invalidate();\n                }\n            }\n            handleDataChanged() {\n                let count = this.mItemCount;\n                let lastHandledItemCount = this.mLastHandledItemCount;\n                this.mLastHandledItemCount = this.mItemCount;\n                if (this.mChoiceMode != AbsListView.CHOICE_MODE_NONE && this.mAdapter != null && this.mAdapter.hasStableIds()) {\n                    this.confirmCheckedPositionsById();\n                }\n                this.mRecycler.clearTransientStateViews();\n                if (count > 0) {\n                    let newPos;\n                    let selectablePos;\n                    if (this.mNeedSync) {\n                        this.mNeedSync = false;\n                        this.mPendingSync = null;\n                        if (this.mTranscriptMode == AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL) {\n                            this.mLayoutMode = AbsListView.LAYOUT_FORCE_BOTTOM;\n                            return;\n                        }\n                        else if (this.mTranscriptMode == AbsListView.TRANSCRIPT_MODE_NORMAL) {\n                            if (this.mForceTranscriptScroll) {\n                                this.mForceTranscriptScroll = false;\n                                this.mLayoutMode = AbsListView.LAYOUT_FORCE_BOTTOM;\n                                return;\n                            }\n                            const childCount = this.getChildCount();\n                            const listBottom = this.getHeight() - this.getPaddingBottom();\n                            const lastChild = this.getChildAt(childCount - 1);\n                            const lastBottom = lastChild != null ? lastChild.getBottom() : listBottom;\n                            if (this.mFirstPosition + childCount >= lastHandledItemCount && lastBottom <= listBottom) {\n                                this.mLayoutMode = AbsListView.LAYOUT_FORCE_BOTTOM;\n                                return;\n                            }\n                            this.awakenScrollBars();\n                        }\n                        switch (this.mSyncMode) {\n                            case AbsListView.SYNC_SELECTED_POSITION:\n                                if (this.isInTouchMode()) {\n                                    this.mLayoutMode = AbsListView.LAYOUT_SYNC;\n                                    this.mSyncPosition = Math.min(Math.max(0, this.mSyncPosition), count - 1);\n                                    return;\n                                }\n                                else {\n                                    newPos = this.findSyncPosition();\n                                    if (newPos >= 0) {\n                                        selectablePos = this.lookForSelectablePosition(newPos, true);\n                                        if (selectablePos == newPos) {\n                                            this.mSyncPosition = newPos;\n                                            if (this.mSyncHeight == this.getHeight()) {\n                                                this.mLayoutMode = AbsListView.LAYOUT_SYNC;\n                                            }\n                                            else {\n                                                this.mLayoutMode = AbsListView.LAYOUT_SET_SELECTION;\n                                            }\n                                            this.setNextSelectedPositionInt(newPos);\n                                            return;\n                                        }\n                                    }\n                                }\n                                break;\n                            case AbsListView.SYNC_FIRST_POSITION:\n                                this.mLayoutMode = AbsListView.LAYOUT_SYNC;\n                                this.mSyncPosition = Math.min(Math.max(0, this.mSyncPosition), count - 1);\n                                return;\n                        }\n                    }\n                    if (!this.isInTouchMode()) {\n                        newPos = this.getSelectedItemPosition();\n                        if (newPos >= count) {\n                            newPos = count - 1;\n                        }\n                        if (newPos < 0) {\n                            newPos = 0;\n                        }\n                        selectablePos = this.lookForSelectablePosition(newPos, true);\n                        if (selectablePos >= 0) {\n                            this.setNextSelectedPositionInt(selectablePos);\n                            return;\n                        }\n                        else {\n                            selectablePos = this.lookForSelectablePosition(newPos, false);\n                            if (selectablePos >= 0) {\n                                this.setNextSelectedPositionInt(selectablePos);\n                                return;\n                            }\n                        }\n                    }\n                    else {\n                        if (this.mResurrectToPosition >= 0) {\n                            return;\n                        }\n                    }\n                }\n                this.mLayoutMode = this.mStackFromBottom ? AbsListView.LAYOUT_FORCE_BOTTOM : AbsListView.LAYOUT_FORCE_TOP;\n                this.mSelectedPosition = AbsListView.INVALID_POSITION;\n                this.mSelectedRowId = AbsListView.INVALID_ROW_ID;\n                this.mNextSelectedPosition = AbsListView.INVALID_POSITION;\n                this.mNextSelectedRowId = AbsListView.INVALID_ROW_ID;\n                this.mNeedSync = false;\n                this.mPendingSync = null;\n                this.mSelectorPosition = AbsListView.INVALID_POSITION;\n                this.checkSelectionChanged();\n            }\n            onDisplayHint(hint) {\n                super.onDisplayHint(hint);\n                this.mPopupHidden = hint == AbsListView.INVISIBLE;\n            }\n            dismissPopup() {\n            }\n            showPopup() {\n            }\n            positionPopup() {\n            }\n            static getDistance(source, dest, direction) {\n                let sX, sY;\n                let dX, dY;\n                switch (direction) {\n                    case View.FOCUS_RIGHT:\n                        sX = source.right;\n                        sY = source.top + source.height() / 2;\n                        dX = dest.left;\n                        dY = dest.top + dest.height() / 2;\n                        break;\n                    case View.FOCUS_DOWN:\n                        sX = source.left + source.width() / 2;\n                        sY = source.bottom;\n                        dX = dest.left + dest.width() / 2;\n                        dY = dest.top;\n                        break;\n                    case View.FOCUS_LEFT:\n                        sX = source.left;\n                        sY = source.top + source.height() / 2;\n                        dX = dest.right;\n                        dY = dest.top + dest.height() / 2;\n                        break;\n                    case View.FOCUS_UP:\n                        sX = source.left + source.width() / 2;\n                        sY = source.top;\n                        dX = dest.left + dest.width() / 2;\n                        dY = dest.bottom;\n                        break;\n                    case View.FOCUS_FORWARD:\n                    case View.FOCUS_BACKWARD:\n                        sX = source.right + source.width() / 2;\n                        sY = source.top + source.height() / 2;\n                        dX = dest.left + dest.width() / 2;\n                        dY = dest.top + dest.height() / 2;\n                        break;\n                    default:\n                        throw Error(`new IllegalArgumentException(\"direction must be one of \" + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, \" + \"FOCUS_FORWARD, FOCUS_BACKWARD}.\")`);\n                }\n                let deltaX = dX - sX;\n                let deltaY = dY - sY;\n                return deltaY * deltaY + deltaX * deltaX;\n            }\n            isInFilterMode() {\n                return this.mFiltered;\n            }\n            hasTextFilter() {\n                return this.mFiltered;\n            }\n            onGlobalLayout() {\n                if (this.isShown()) {\n                }\n                else {\n                }\n            }\n            generateDefaultLayoutParams() {\n                return new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0);\n            }\n            generateLayoutParams(p) {\n                return new AbsListView.LayoutParams(p);\n            }\n            generateLayoutParamsFromAttr(attrs) {\n                return new AbsListView.LayoutParams(this.getContext(), attrs);\n            }\n            checkLayoutParams(p) {\n                return p instanceof AbsListView.LayoutParams;\n            }\n            setTranscriptMode(mode) {\n                this.mTranscriptMode = mode;\n            }\n            getTranscriptMode() {\n                return this.mTranscriptMode;\n            }\n            getSolidColor() {\n                return this.mCacheColorHint;\n            }\n            setCacheColorHint(color) {\n                if (color != this.mCacheColorHint) {\n                    this.mCacheColorHint = color;\n                    let count = this.getChildCount();\n                    for (let i = 0; i < count; i++) {\n                        this.getChildAt(i).setDrawingCacheBackgroundColor(color);\n                    }\n                    this.mRecycler.setCacheColorHint(color);\n                }\n            }\n            getCacheColorHint() {\n                return this.mCacheColorHint;\n            }\n            reclaimViews(views) {\n                let childCount = this.getChildCount();\n                let listener = this.mRecycler.mRecyclerListener;\n                for (let i = 0; i < childCount; i++) {\n                    let child = this.getChildAt(i);\n                    let lp = child.getLayoutParams();\n                    if (lp != null && this.mRecycler.shouldRecycleViewType(lp.viewType)) {\n                        views.add(child);\n                        if (listener != null) {\n                            listener.onMovedToScrapHeap(child);\n                        }\n                    }\n                }\n                this.mRecycler.reclaimScrapViews(views);\n                this.removeAllViewsInLayout();\n            }\n            finishGlows() {\n            }\n            setVisibleRangeHint(start, end) {\n            }\n            setRecyclerListener(listener) {\n                this.mRecycler.mRecyclerListener = listener;\n            }\n            static retrieveFromScrap(scrapViews, position) {\n                let size = scrapViews.size();\n                if (size > 0) {\n                    for (let i = 0; i < size; i++) {\n                        let view = scrapViews.get(i);\n                        if (view.getLayoutParams().scrappedFromPosition == position) {\n                            scrapViews.remove(i);\n                            return view;\n                        }\n                    }\n                    return scrapViews.remove(size - 1);\n                }\n                else {\n                    return null;\n                }\n            }\n        }\n        AbsListView.TAG_AbsListView = \"AbsListView\";\n        AbsListView.TRANSCRIPT_MODE_DISABLED = 0;\n        AbsListView.TRANSCRIPT_MODE_NORMAL = 1;\n        AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL = 2;\n        AbsListView.TOUCH_MODE_REST = -1;\n        AbsListView.TOUCH_MODE_DOWN = 0;\n        AbsListView.TOUCH_MODE_TAP = 1;\n        AbsListView.TOUCH_MODE_DONE_WAITING = 2;\n        AbsListView.TOUCH_MODE_SCROLL = 3;\n        AbsListView.TOUCH_MODE_FLING = 4;\n        AbsListView.TOUCH_MODE_OVERSCROLL = 5;\n        AbsListView.TOUCH_MODE_OVERFLING = 6;\n        AbsListView.LAYOUT_NORMAL = 0;\n        AbsListView.LAYOUT_FORCE_TOP = 1;\n        AbsListView.LAYOUT_SET_SELECTION = 2;\n        AbsListView.LAYOUT_FORCE_BOTTOM = 3;\n        AbsListView.LAYOUT_SPECIFIC = 4;\n        AbsListView.LAYOUT_SYNC = 5;\n        AbsListView.LAYOUT_MOVE_SELECTION = 6;\n        AbsListView.CHOICE_MODE_NONE = 0;\n        AbsListView.CHOICE_MODE_SINGLE = 1;\n        AbsListView.CHOICE_MODE_MULTIPLE = 2;\n        AbsListView.CHOICE_MODE_MULTIPLE_MODAL = 3;\n        AbsListView.OVERSCROLL_LIMIT_DIVISOR = 3;\n        AbsListView.CHECK_POSITION_SEARCH_DISTANCE = 20;\n        AbsListView.TOUCH_MODE_UNKNOWN = -1;\n        AbsListView.TOUCH_MODE_ON = 0;\n        AbsListView.TOUCH_MODE_OFF = 1;\n        AbsListView.PROFILE_SCROLLING = false;\n        AbsListView.PROFILE_FLINGING = false;\n        AbsListView.INVALID_POINTER = -1;\n        AbsListView.sLinearInterpolator = new LinearInterpolator();\n        widget.AbsListView = AbsListView;\n        (function (AbsListView) {\n            var OnScrollListener;\n            (function (OnScrollListener) {\n                OnScrollListener.SCROLL_STATE_IDLE = 0;\n                OnScrollListener.SCROLL_STATE_TOUCH_SCROLL = 1;\n                OnScrollListener.SCROLL_STATE_FLING = 2;\n            })(OnScrollListener = AbsListView.OnScrollListener || (AbsListView.OnScrollListener = {}));\n            class WindowRunnnable {\n                constructor(arg) {\n                    this._AbsListView_this = arg;\n                }\n                rememberWindowAttachCount() {\n                    this.mOriginalAttachCount = this._AbsListView_this.getWindowAttachCount();\n                }\n                sameWindow() {\n                    return this._AbsListView_this.getWindowAttachCount() == this.mOriginalAttachCount;\n                }\n            }\n            AbsListView.WindowRunnnable = WindowRunnnable;\n            class PerformClick extends AbsListView.WindowRunnnable {\n                constructor(arg) {\n                    super(arg);\n                    this.mClickMotionPosition = 0;\n                    this._AbsListView_this = arg;\n                }\n                run() {\n                    if (this._AbsListView_this.mDataChanged)\n                        return;\n                    const adapter = this._AbsListView_this.mAdapter;\n                    const motionPosition = this.mClickMotionPosition;\n                    if (adapter != null && this._AbsListView_this.mItemCount > 0 && motionPosition != AbsListView.INVALID_POSITION\n                        && motionPosition < adapter.getCount() && this.sameWindow()) {\n                        const view = this._AbsListView_this.getChildAt(motionPosition - this._AbsListView_this.mFirstPosition);\n                        if (view != null) {\n                            this._AbsListView_this.performItemClick(view, motionPosition, adapter.getItemId(motionPosition));\n                        }\n                    }\n                }\n            }\n            AbsListView.PerformClick = PerformClick;\n            class CheckForLongPress extends AbsListView.WindowRunnnable {\n                constructor(arg) {\n                    super(arg);\n                    this._AbsListView_this = arg;\n                }\n                run() {\n                    const motionPosition = this._AbsListView_this.mMotionPosition;\n                    const child = this._AbsListView_this.getChildAt(motionPosition - this._AbsListView_this.mFirstPosition);\n                    if (child != null) {\n                        const longPressPosition = this._AbsListView_this.mMotionPosition;\n                        const longPressId = this._AbsListView_this.mAdapter.getItemId(this._AbsListView_this.mMotionPosition);\n                        let handled = false;\n                        if (this.sameWindow() && !this._AbsListView_this.mDataChanged) {\n                            handled = this._AbsListView_this.performLongPress(child, longPressPosition, longPressId);\n                        }\n                        if (handled) {\n                            this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                            this._AbsListView_this.setPressed(false);\n                            child.setPressed(false);\n                        }\n                        else {\n                            this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_DONE_WAITING;\n                        }\n                    }\n                }\n            }\n            AbsListView.CheckForLongPress = CheckForLongPress;\n            class CheckForKeyLongPress extends AbsListView.WindowRunnnable {\n                constructor(arg) {\n                    super(arg);\n                    this._AbsListView_this = arg;\n                }\n                run() {\n                    if (this._AbsListView_this.isPressed() && this._AbsListView_this.mSelectedPosition >= 0) {\n                        let index = this._AbsListView_this.mSelectedPosition - this._AbsListView_this.mFirstPosition;\n                        let v = this._AbsListView_this.getChildAt(index);\n                        if (!this._AbsListView_this.mDataChanged) {\n                            let handled = false;\n                            if (this.sameWindow()) {\n                                handled = this._AbsListView_this.performLongPress(v, this._AbsListView_this.mSelectedPosition, this._AbsListView_this.mSelectedRowId);\n                            }\n                            if (handled) {\n                                this._AbsListView_this.setPressed(false);\n                                v.setPressed(false);\n                            }\n                        }\n                        else {\n                            this._AbsListView_this.setPressed(false);\n                            if (v != null)\n                                v.setPressed(false);\n                        }\n                    }\n                }\n            }\n            AbsListView.CheckForKeyLongPress = CheckForKeyLongPress;\n            class CheckForTap {\n                constructor(arg) {\n                    this._AbsListView_this = arg;\n                }\n                run() {\n                    if (this._AbsListView_this.mTouchMode == AbsListView.TOUCH_MODE_DOWN) {\n                        this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_TAP;\n                        const child = this._AbsListView_this.getChildAt(this._AbsListView_this.mMotionPosition - this._AbsListView_this.mFirstPosition);\n                        if (child != null && !child.hasFocusable()) {\n                            this._AbsListView_this.mLayoutMode = AbsListView.LAYOUT_NORMAL;\n                            if (!this._AbsListView_this.mDataChanged) {\n                                child.setPressed(true);\n                                this._AbsListView_this.setPressed(true);\n                                this._AbsListView_this.layoutChildren();\n                                this._AbsListView_this.positionSelector(this._AbsListView_this.mMotionPosition, child);\n                                this._AbsListView_this.refreshDrawableState();\n                                const longPressTimeout = ViewConfiguration.getLongPressTimeout();\n                                const longClickable = this._AbsListView_this.isLongClickable();\n                                if (this._AbsListView_this.mSelector != null) {\n                                    let d = this._AbsListView_this.mSelector.getCurrent();\n                                }\n                                if (longClickable) {\n                                    if (this._AbsListView_this.mPendingCheckForLongPress_List == null) {\n                                        this._AbsListView_this.mPendingCheckForLongPress_List = new AbsListView.CheckForLongPress(this._AbsListView_this);\n                                    }\n                                    this._AbsListView_this.mPendingCheckForLongPress_List.rememberWindowAttachCount();\n                                    this._AbsListView_this.postDelayed(this._AbsListView_this.mPendingCheckForLongPress_List, longPressTimeout);\n                                }\n                                else {\n                                    this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_DONE_WAITING;\n                                }\n                            }\n                            else {\n                                this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_DONE_WAITING;\n                            }\n                        }\n                    }\n                }\n            }\n            AbsListView.CheckForTap = CheckForTap;\n            class FlingRunnable {\n                constructor(arg) {\n                    this.mLastFlingY = 0;\n                    this.mCheckFlywheel = (() => {\n                        const inner_this = this;\n                        class _Inner {\n                            run() {\n                                const activeId = inner_this._AbsListView_this.mActivePointerId;\n                                const vt = inner_this._AbsListView_this.mVelocityTracker;\n                                const scroller = inner_this.mScroller;\n                                if (vt == null || activeId == AbsListView.INVALID_POINTER) {\n                                    return;\n                                }\n                                vt.computeCurrentVelocity(1000, inner_this._AbsListView_this.mMaximumVelocity);\n                                const yvel = -vt.getYVelocity(activeId);\n                                if (Math.abs(yvel) >= inner_this._AbsListView_this.mMinimumVelocity && scroller.isScrollingInDirection(0, yvel)) {\n                                    inner_this._AbsListView_this.postDelayed(inner_this, FlingRunnable.FLYWHEEL_TIMEOUT);\n                                }\n                                else {\n                                    inner_this.endFling();\n                                    inner_this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_SCROLL;\n                                    inner_this._AbsListView_this.reportScrollStateChange(OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);\n                                }\n                            }\n                        }\n                        return new _Inner();\n                    })();\n                    this._AbsListView_this = arg;\n                    this.mScroller = new OverScroller();\n                }\n                start(initialVelocity) {\n                    let initialY = initialVelocity < 0 ? Integer.MAX_VALUE : 0;\n                    this.mLastFlingY = initialY;\n                    this.mScroller.setInterpolator(null);\n                    this.mScroller.fling(0, initialY, 0, initialVelocity, 0, Integer.MAX_VALUE, 0, Integer.MAX_VALUE);\n                    this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_FLING;\n                    this._AbsListView_this.postOnAnimation(this);\n                    if (AbsListView.PROFILE_FLINGING) {\n                        if (!this._AbsListView_this.mFlingProfilingStarted) {\n                            this._AbsListView_this.mFlingProfilingStarted = true;\n                        }\n                    }\n                }\n                startSpringback() {\n                    if (this.mScroller.springBack(0, this._AbsListView_this.mScrollY, 0, 0, 0, 0)) {\n                        this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_OVERFLING;\n                        this._AbsListView_this.invalidate();\n                        this._AbsListView_this.postOnAnimation(this);\n                    }\n                    else {\n                        this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                        this._AbsListView_this.reportScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);\n                    }\n                }\n                startOverfling(initialVelocity) {\n                    this.mScroller.setInterpolator(null);\n                    let minY = Integer.MIN_VALUE, maxY = Integer.MAX_VALUE;\n                    if (this._AbsListView_this.mScrollY < 0)\n                        minY = 0;\n                    else if (this._AbsListView_this.mScrollY > 0)\n                        maxY = 0;\n                    this.mScroller.fling(0, this._AbsListView_this.mScrollY, 0, initialVelocity, 0, 0, minY, maxY, 0, this._AbsListView_this.getHeight());\n                    this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_OVERFLING;\n                    this._AbsListView_this.invalidate();\n                    this._AbsListView_this.postOnAnimation(this);\n                }\n                edgeReached(delta) {\n                    this.mScroller.notifyVerticalEdgeReached(this._AbsListView_this.mScrollY, 0, this._AbsListView_this.mOverflingDistance);\n                    const overscrollMode = this._AbsListView_this.getOverScrollMode();\n                    if (overscrollMode == AbsListView.OVER_SCROLL_ALWAYS || (overscrollMode == AbsListView.OVER_SCROLL_IF_CONTENT_SCROLLS && !this._AbsListView_this.contentFits())) {\n                        this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_OVERFLING;\n                    }\n                    else {\n                        this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                        if (this._AbsListView_this.mPositionScroller != null) {\n                            this._AbsListView_this.mPositionScroller.stop();\n                        }\n                    }\n                    this._AbsListView_this.invalidate();\n                    this._AbsListView_this.postOnAnimation(this);\n                }\n                startScroll(distance, duration, linear) {\n                    let initialY = distance < 0 ? Integer.MAX_VALUE : 0;\n                    this.mLastFlingY = initialY;\n                    this.mScroller.setInterpolator(linear ? AbsListView.sLinearInterpolator : null);\n                    this.mScroller.startScroll(0, initialY, 0, distance, duration);\n                    this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_FLING;\n                    this._AbsListView_this.postOnAnimation(this);\n                }\n                endFling() {\n                    this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                    this._AbsListView_this.removeCallbacks(this);\n                    this._AbsListView_this.removeCallbacks(this.mCheckFlywheel);\n                    this._AbsListView_this.reportScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);\n                    this._AbsListView_this.clearScrollingCache();\n                    this.mScroller.abortAnimation();\n                }\n                flywheelTouch() {\n                    this._AbsListView_this.postDelayed(this.mCheckFlywheel, FlingRunnable.FLYWHEEL_TIMEOUT);\n                }\n                run() {\n                    switch (this._AbsListView_this.mTouchMode) {\n                        default:\n                            this.endFling();\n                            return;\n                        case AbsListView.TOUCH_MODE_SCROLL:\n                            if (this.mScroller.isFinished()) {\n                                return;\n                            }\n                        case AbsListView.TOUCH_MODE_FLING:\n                            {\n                                if (this._AbsListView_this.mDataChanged) {\n                                    this._AbsListView_this.layoutChildren();\n                                }\n                                if (this._AbsListView_this.mItemCount == 0 || this._AbsListView_this.getChildCount() == 0) {\n                                    this.endFling();\n                                    return;\n                                }\n                                const scroller = this.mScroller;\n                                let more = scroller.computeScrollOffset();\n                                const y = scroller.getCurrY();\n                                let delta = this.mLastFlingY - y;\n                                if (delta > 0) {\n                                    this._AbsListView_this.mMotionPosition = this._AbsListView_this.mFirstPosition;\n                                    const firstView = this._AbsListView_this.getChildAt(0);\n                                    this._AbsListView_this.mMotionViewOriginalTop = firstView.getTop();\n                                    delta = Math.min(this._AbsListView_this.getHeight() - this._AbsListView_this.mPaddingBottom - this._AbsListView_this.mPaddingTop - 1, delta);\n                                }\n                                else {\n                                    let offsetToLast = this._AbsListView_this.getChildCount() - 1;\n                                    this._AbsListView_this.mMotionPosition = this._AbsListView_this.mFirstPosition + offsetToLast;\n                                    const lastView = this._AbsListView_this.getChildAt(offsetToLast);\n                                    this._AbsListView_this.mMotionViewOriginalTop = lastView.getTop();\n                                    delta = Math.max(-(this._AbsListView_this.getHeight() - this._AbsListView_this.mPaddingBottom - this._AbsListView_this.mPaddingTop - 1), delta);\n                                }\n                                let motionView = this._AbsListView_this.getChildAt(this._AbsListView_this.mMotionPosition - this._AbsListView_this.mFirstPosition);\n                                let oldTop = 0;\n                                if (motionView != null) {\n                                    oldTop = motionView.getTop();\n                                }\n                                const atEdge = this._AbsListView_this.trackMotionScroll(delta, delta);\n                                const atEnd = atEdge && (delta != 0);\n                                if (atEnd) {\n                                    if (motionView != null) {\n                                        let overshoot = -(delta - (motionView.getTop() - oldTop));\n                                        this._AbsListView_this.overScrollBy(0, overshoot, 0, this._AbsListView_this.mScrollY, 0, 0, 0, this._AbsListView_this.mOverflingDistance, false);\n                                    }\n                                    if (more) {\n                                        this.edgeReached(delta);\n                                    }\n                                    break;\n                                }\n                                if (more && !atEnd) {\n                                    if (atEdge)\n                                        this._AbsListView_this.invalidate();\n                                    this.mLastFlingY = y;\n                                    this._AbsListView_this.postOnAnimation(this);\n                                }\n                                else {\n                                    this.endFling();\n                                    if (AbsListView.PROFILE_FLINGING) {\n                                        if (this._AbsListView_this.mFlingProfilingStarted) {\n                                            this._AbsListView_this.mFlingProfilingStarted = false;\n                                        }\n                                    }\n                                }\n                                break;\n                            }\n                        case AbsListView.TOUCH_MODE_OVERFLING:\n                            {\n                                const scroller = this.mScroller;\n                                if (scroller.computeScrollOffset()) {\n                                    const scrollY = this._AbsListView_this.mScrollY;\n                                    const currY = scroller.getCurrY();\n                                    let deltaY = currY - scrollY;\n                                    const crossDown = scrollY <= 0 && currY > 0;\n                                    const crossUp = scrollY >= 0 && currY < 0;\n                                    if (crossDown || crossUp) {\n                                        let velocity = Math.floor(scroller.getCurrVelocity());\n                                        if (crossUp)\n                                            velocity = -velocity;\n                                        scroller.abortAnimation();\n                                        this.start(velocity);\n                                        deltaY = -scrollY;\n                                    }\n                                    if (this._AbsListView_this.overScrollBy(0, deltaY, 0, scrollY, 0, 0, 0, this._AbsListView_this.mOverflingDistance, false)) {\n                                        this.startSpringback();\n                                    }\n                                    else {\n                                        this._AbsListView_this.invalidate();\n                                        this._AbsListView_this.postOnAnimation(this);\n                                    }\n                                }\n                                else {\n                                    this.endFling();\n                                }\n                                break;\n                            }\n                    }\n                }\n            }\n            FlingRunnable.FLYWHEEL_TIMEOUT = 40;\n            AbsListView.FlingRunnable = FlingRunnable;\n            class PositionScroller {\n                constructor(arg) {\n                    this.mMode = 0;\n                    this.mTargetPos = 0;\n                    this.mBoundPos = 0;\n                    this.mLastSeenPos = 0;\n                    this.mScrollDuration = 0;\n                    this.mExtraScroll = 0;\n                    this.mOffsetFromTop = 0;\n                    this._AbsListView_this = arg;\n                    this.mExtraScroll = ViewConfiguration.get().getScaledFadingEdgeLength();\n                }\n                start(position, boundPosition) {\n                    if (boundPosition == null)\n                        this._start_1(position);\n                    else\n                        this._start_2(position, boundPosition);\n                }\n                _start_1(position) {\n                    this.stop();\n                    if (this._AbsListView_this.mDataChanged) {\n                        this._AbsListView_this.mPositionScrollAfterLayout = (() => {\n                            const inner_this = this;\n                            class _Inner {\n                                run() {\n                                    inner_this.start(position);\n                                }\n                            }\n                            return new _Inner();\n                        })();\n                        return;\n                    }\n                    const childCount = this._AbsListView_this.getChildCount();\n                    if (childCount == 0) {\n                        return;\n                    }\n                    const firstPos = this._AbsListView_this.mFirstPosition;\n                    const lastPos = firstPos + childCount - 1;\n                    let viewTravelCount;\n                    let clampedPosition = Math.max(0, Math.min(this._AbsListView_this.getCount() - 1, position));\n                    if (clampedPosition < firstPos) {\n                        viewTravelCount = firstPos - clampedPosition + 1;\n                        this.mMode = PositionScroller.MOVE_UP_POS;\n                    }\n                    else if (clampedPosition > lastPos) {\n                        viewTravelCount = clampedPosition - lastPos + 1;\n                        this.mMode = PositionScroller.MOVE_DOWN_POS;\n                    }\n                    else {\n                        this.scrollToVisible(clampedPosition, AbsListView.INVALID_POSITION, PositionScroller.SCROLL_DURATION);\n                        return;\n                    }\n                    if (viewTravelCount > 0) {\n                        this.mScrollDuration = PositionScroller.SCROLL_DURATION / viewTravelCount;\n                    }\n                    else {\n                        this.mScrollDuration = PositionScroller.SCROLL_DURATION;\n                    }\n                    this.mTargetPos = clampedPosition;\n                    this.mBoundPos = AbsListView.INVALID_POSITION;\n                    this.mLastSeenPos = AbsListView.INVALID_POSITION;\n                    this._AbsListView_this.postOnAnimation(this);\n                }\n                _start_2(position, boundPosition) {\n                    this.stop();\n                    if (boundPosition == AbsListView.INVALID_POSITION) {\n                        this.start(position);\n                        return;\n                    }\n                    if (this._AbsListView_this.mDataChanged) {\n                        this._AbsListView_this.mPositionScrollAfterLayout = (() => {\n                            const inner_this = this;\n                            class _Inner {\n                                run() {\n                                    inner_this.start(position, boundPosition);\n                                }\n                            }\n                            return new _Inner();\n                        })();\n                        return;\n                    }\n                    const childCount = this._AbsListView_this.getChildCount();\n                    if (childCount == 0) {\n                        return;\n                    }\n                    const firstPos = this._AbsListView_this.mFirstPosition;\n                    const lastPos = firstPos + childCount - 1;\n                    let viewTravelCount;\n                    let clampedPosition = Math.max(0, Math.min(this._AbsListView_this.getCount() - 1, position));\n                    if (clampedPosition < firstPos) {\n                        const boundPosFromLast = lastPos - boundPosition;\n                        if (boundPosFromLast < 1) {\n                            return;\n                        }\n                        const posTravel = firstPos - clampedPosition + 1;\n                        const boundTravel = boundPosFromLast - 1;\n                        if (boundTravel < posTravel) {\n                            viewTravelCount = boundTravel;\n                            this.mMode = PositionScroller.MOVE_UP_BOUND;\n                        }\n                        else {\n                            viewTravelCount = posTravel;\n                            this.mMode = PositionScroller.MOVE_UP_POS;\n                        }\n                    }\n                    else if (clampedPosition > lastPos) {\n                        const boundPosFromFirst = boundPosition - firstPos;\n                        if (boundPosFromFirst < 1) {\n                            return;\n                        }\n                        const posTravel = clampedPosition - lastPos + 1;\n                        const boundTravel = boundPosFromFirst - 1;\n                        if (boundTravel < posTravel) {\n                            viewTravelCount = boundTravel;\n                            this.mMode = PositionScroller.MOVE_DOWN_BOUND;\n                        }\n                        else {\n                            viewTravelCount = posTravel;\n                            this.mMode = PositionScroller.MOVE_DOWN_POS;\n                        }\n                    }\n                    else {\n                        this.scrollToVisible(clampedPosition, boundPosition, PositionScroller.SCROLL_DURATION);\n                        return;\n                    }\n                    if (viewTravelCount > 0) {\n                        this.mScrollDuration = PositionScroller.SCROLL_DURATION / viewTravelCount;\n                    }\n                    else {\n                        this.mScrollDuration = PositionScroller.SCROLL_DURATION;\n                    }\n                    this.mTargetPos = clampedPosition;\n                    this.mBoundPos = boundPosition;\n                    this.mLastSeenPos = AbsListView.INVALID_POSITION;\n                    this._AbsListView_this.postOnAnimation(this);\n                }\n                startWithOffset(position, offset, duration = PositionScroller.SCROLL_DURATION) {\n                    this.stop();\n                    if (this._AbsListView_this.mDataChanged) {\n                        const postOffset = offset;\n                        this._AbsListView_this.mPositionScrollAfterLayout = (() => {\n                            const inner_this = this;\n                            class _Inner {\n                                run() {\n                                    inner_this.startWithOffset(position, postOffset, duration);\n                                }\n                            }\n                            return new _Inner();\n                        })();\n                        return;\n                    }\n                    const childCount = this._AbsListView_this.getChildCount();\n                    if (childCount == 0) {\n                        return;\n                    }\n                    offset += this._AbsListView_this.getPaddingTop();\n                    this.mTargetPos = Math.max(0, Math.min(this._AbsListView_this.getCount() - 1, position));\n                    this.mOffsetFromTop = offset;\n                    this.mBoundPos = AbsListView.INVALID_POSITION;\n                    this.mLastSeenPos = AbsListView.INVALID_POSITION;\n                    this.mMode = PositionScroller.MOVE_OFFSET;\n                    const firstPos = this._AbsListView_this.mFirstPosition;\n                    const lastPos = firstPos + childCount - 1;\n                    let viewTravelCount;\n                    if (this.mTargetPos < firstPos) {\n                        viewTravelCount = firstPos - this.mTargetPos;\n                    }\n                    else if (this.mTargetPos > lastPos) {\n                        viewTravelCount = this.mTargetPos - lastPos;\n                    }\n                    else {\n                        const targetTop = this._AbsListView_this.getChildAt(this.mTargetPos - firstPos).getTop();\n                        this._AbsListView_this.smoothScrollBy(targetTop - offset, duration, true);\n                        return;\n                    }\n                    const screenTravelCount = viewTravelCount / childCount;\n                    this.mScrollDuration = screenTravelCount < 1 ? duration : Math.floor((duration / screenTravelCount));\n                    this.mLastSeenPos = AbsListView.INVALID_POSITION;\n                    this._AbsListView_this.postOnAnimation(this);\n                }\n                scrollToVisible(targetPos, boundPos, duration) {\n                    const firstPos = this._AbsListView_this.mFirstPosition;\n                    const childCount = this._AbsListView_this.getChildCount();\n                    const lastPos = firstPos + childCount - 1;\n                    const paddedTop = this._AbsListView_this.mListPadding.top;\n                    const paddedBottom = this._AbsListView_this.getHeight() - this._AbsListView_this.mListPadding.bottom;\n                    if (targetPos < firstPos || targetPos > lastPos) {\n                        Log.w(AbsListView.TAG_AbsListView, \"scrollToVisible called with targetPos \" + targetPos + \" not visible [\" + firstPos + \", \" + lastPos + \"]\");\n                    }\n                    if (boundPos < firstPos || boundPos > lastPos) {\n                        boundPos = AbsListView.INVALID_POSITION;\n                    }\n                    const targetChild = this._AbsListView_this.getChildAt(targetPos - firstPos);\n                    const targetTop = targetChild.getTop();\n                    const targetBottom = targetChild.getBottom();\n                    let scrollBy = 0;\n                    if (targetBottom > paddedBottom) {\n                        scrollBy = targetBottom - paddedBottom;\n                    }\n                    if (targetTop < paddedTop) {\n                        scrollBy = targetTop - paddedTop;\n                    }\n                    if (scrollBy == 0) {\n                        return;\n                    }\n                    if (boundPos >= 0) {\n                        const boundChild = this._AbsListView_this.getChildAt(boundPos - firstPos);\n                        const boundTop = boundChild.getTop();\n                        const boundBottom = boundChild.getBottom();\n                        const absScroll = Math.abs(scrollBy);\n                        if (scrollBy < 0 && boundBottom + absScroll > paddedBottom) {\n                            scrollBy = Math.max(0, boundBottom - paddedBottom);\n                        }\n                        else if (scrollBy > 0 && boundTop - absScroll < paddedTop) {\n                            scrollBy = Math.min(0, boundTop - paddedTop);\n                        }\n                    }\n                    this._AbsListView_this.smoothScrollBy(scrollBy, duration);\n                }\n                stop() {\n                    this._AbsListView_this.removeCallbacks(this);\n                }\n                run() {\n                    const listHeight = this._AbsListView_this.getHeight();\n                    const firstPos = this._AbsListView_this.mFirstPosition;\n                    switch (this.mMode) {\n                        case PositionScroller.MOVE_DOWN_POS:\n                            {\n                                const lastViewIndex = this._AbsListView_this.getChildCount() - 1;\n                                const lastPos = firstPos + lastViewIndex;\n                                if (lastViewIndex < 0) {\n                                    return;\n                                }\n                                if (lastPos == this.mLastSeenPos) {\n                                    this._AbsListView_this.postOnAnimation(this);\n                                    return;\n                                }\n                                const lastView = this._AbsListView_this.getChildAt(lastViewIndex);\n                                const lastViewHeight = lastView.getHeight();\n                                const lastViewTop = lastView.getTop();\n                                const lastViewPixelsShowing = listHeight - lastViewTop;\n                                const extraScroll = lastPos < this._AbsListView_this.mItemCount - 1 ? Math.max(this._AbsListView_this.mListPadding.bottom, this.mExtraScroll) : this._AbsListView_this.mListPadding.bottom;\n                                const scrollBy = lastViewHeight - lastViewPixelsShowing + extraScroll;\n                                this._AbsListView_this.smoothScrollBy(scrollBy, this.mScrollDuration, true);\n                                this.mLastSeenPos = lastPos;\n                                if (lastPos < this.mTargetPos) {\n                                    this._AbsListView_this.postOnAnimation(this);\n                                }\n                                break;\n                            }\n                        case PositionScroller.MOVE_DOWN_BOUND:\n                            {\n                                const nextViewIndex = 1;\n                                const childCount = this._AbsListView_this.getChildCount();\n                                if (firstPos == this.mBoundPos || childCount <= nextViewIndex || firstPos + childCount >= this._AbsListView_this.mItemCount) {\n                                    return;\n                                }\n                                const nextPos = firstPos + nextViewIndex;\n                                if (nextPos == this.mLastSeenPos) {\n                                    this._AbsListView_this.postOnAnimation(this);\n                                    return;\n                                }\n                                const nextView = this._AbsListView_this.getChildAt(nextViewIndex);\n                                const nextViewHeight = nextView.getHeight();\n                                const nextViewTop = nextView.getTop();\n                                const extraScroll = Math.max(this._AbsListView_this.mListPadding.bottom, this.mExtraScroll);\n                                if (nextPos < this.mBoundPos) {\n                                    this._AbsListView_this.smoothScrollBy(Math.max(0, nextViewHeight + nextViewTop - extraScroll), this.mScrollDuration, true);\n                                    this.mLastSeenPos = nextPos;\n                                    this._AbsListView_this.postOnAnimation(this);\n                                }\n                                else {\n                                    if (nextViewTop > extraScroll) {\n                                        this._AbsListView_this.smoothScrollBy(nextViewTop - extraScroll, this.mScrollDuration, true);\n                                    }\n                                }\n                                break;\n                            }\n                        case PositionScroller.MOVE_UP_POS:\n                            {\n                                if (firstPos == this.mLastSeenPos) {\n                                    this._AbsListView_this.postOnAnimation(this);\n                                    return;\n                                }\n                                const firstView = this._AbsListView_this.getChildAt(0);\n                                if (firstView == null) {\n                                    return;\n                                }\n                                const firstViewTop = firstView.getTop();\n                                const extraScroll = firstPos > 0 ? Math.max(this.mExtraScroll, this._AbsListView_this.mListPadding.top) : this._AbsListView_this.mListPadding.top;\n                                this._AbsListView_this.smoothScrollBy(firstViewTop - extraScroll, this.mScrollDuration, true);\n                                this.mLastSeenPos = firstPos;\n                                if (firstPos > this.mTargetPos) {\n                                    this._AbsListView_this.postOnAnimation(this);\n                                }\n                                break;\n                            }\n                        case PositionScroller.MOVE_UP_BOUND:\n                            {\n                                const lastViewIndex = this._AbsListView_this.getChildCount() - 2;\n                                if (lastViewIndex < 0) {\n                                    return;\n                                }\n                                const lastPos = firstPos + lastViewIndex;\n                                if (lastPos == this.mLastSeenPos) {\n                                    this._AbsListView_this.postOnAnimation(this);\n                                    return;\n                                }\n                                const lastView = this._AbsListView_this.getChildAt(lastViewIndex);\n                                const lastViewHeight = lastView.getHeight();\n                                const lastViewTop = lastView.getTop();\n                                const lastViewPixelsShowing = listHeight - lastViewTop;\n                                const extraScroll = Math.max(this._AbsListView_this.mListPadding.top, this.mExtraScroll);\n                                this.mLastSeenPos = lastPos;\n                                if (lastPos > this.mBoundPos) {\n                                    this._AbsListView_this.smoothScrollBy(-(lastViewPixelsShowing - extraScroll), this.mScrollDuration, true);\n                                    this._AbsListView_this.postOnAnimation(this);\n                                }\n                                else {\n                                    const bottom = listHeight - extraScroll;\n                                    const lastViewBottom = lastViewTop + lastViewHeight;\n                                    if (bottom > lastViewBottom) {\n                                        this._AbsListView_this.smoothScrollBy(-(bottom - lastViewBottom), this.mScrollDuration, true);\n                                    }\n                                }\n                                break;\n                            }\n                        case PositionScroller.MOVE_OFFSET:\n                            {\n                                if (this.mLastSeenPos == firstPos) {\n                                    this._AbsListView_this.postOnAnimation(this);\n                                    return;\n                                }\n                                this.mLastSeenPos = firstPos;\n                                const childCount = this._AbsListView_this.getChildCount();\n                                const position = this.mTargetPos;\n                                const lastPos = firstPos + childCount - 1;\n                                let viewTravelCount = 0;\n                                if (position < firstPos) {\n                                    viewTravelCount = firstPos - position + 1;\n                                }\n                                else if (position > lastPos) {\n                                    viewTravelCount = position - lastPos;\n                                }\n                                const screenTravelCount = viewTravelCount / childCount;\n                                const modifier = Math.min(Math.abs(screenTravelCount), 1.);\n                                if (position < firstPos) {\n                                    const distance = Math.floor((-this._AbsListView_this.getHeight() * modifier));\n                                    const duration = Math.floor((this.mScrollDuration * modifier));\n                                    this._AbsListView_this.smoothScrollBy(distance, duration, true);\n                                    this._AbsListView_this.postOnAnimation(this);\n                                }\n                                else if (position > lastPos) {\n                                    const distance = Math.floor((this._AbsListView_this.getHeight() * modifier));\n                                    const duration = Math.floor((this.mScrollDuration * modifier));\n                                    this._AbsListView_this.smoothScrollBy(distance, duration, true);\n                                    this._AbsListView_this.postOnAnimation(this);\n                                }\n                                else {\n                                    const targetTop = this._AbsListView_this.getChildAt(position - firstPos).getTop();\n                                    const distance = targetTop - this.mOffsetFromTop;\n                                    const duration = Math.floor((this.mScrollDuration * (Math.abs(distance) / this._AbsListView_this.getHeight())));\n                                    this._AbsListView_this.smoothScrollBy(distance, duration, true);\n                                }\n                                break;\n                            }\n                        default:\n                            break;\n                    }\n                }\n            }\n            PositionScroller.SCROLL_DURATION = 200;\n            PositionScroller.MOVE_DOWN_POS = 1;\n            PositionScroller.MOVE_UP_POS = 2;\n            PositionScroller.MOVE_DOWN_BOUND = 3;\n            PositionScroller.MOVE_UP_BOUND = 4;\n            PositionScroller.MOVE_OFFSET = 5;\n            AbsListView.PositionScroller = PositionScroller;\n            class AdapterDataSetObserver extends AdapterView.AdapterDataSetObserver {\n                constructor(arg) {\n                    super(arg);\n                    this._AbsListView_this = arg;\n                }\n                onChanged() {\n                    super.onChanged();\n                }\n                onInvalidated() {\n                    super.onInvalidated();\n                }\n            }\n            AbsListView.AdapterDataSetObserver = AdapterDataSetObserver;\n            class LayoutParams extends ViewGroup.LayoutParams {\n                constructor(...args) {\n                    super(...(() => {\n                        if (args[0] instanceof android.content.Context && args[1] instanceof HTMLElement)\n                            return [args[0], args[1]];\n                        else if (typeof args[0] === 'number' && typeof args[1] === 'number' && typeof args[2] === 'number')\n                            return [args[0], args[1]];\n                        else if (typeof args[0] === 'number' && typeof args[1] === 'number')\n                            return [args[0], args[1]];\n                        else if (args[0] instanceof ViewGroup.LayoutParams)\n                            return [args[0]];\n                    })());\n                    this.viewType = 0;\n                    this.scrappedFromPosition = 0;\n                    this.itemId = -1;\n                    if (args[0] instanceof android.content.Context && args[1] instanceof HTMLElement) {\n                    }\n                    else if (typeof args[0] === 'number' && typeof args[1] === 'number' && typeof args[2] == 'number') {\n                        this.viewType = args[2];\n                    }\n                    else if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n                    }\n                    else if (args[0] instanceof ViewGroup.LayoutParams) {\n                    }\n                }\n            }\n            AbsListView.LayoutParams = LayoutParams;\n            class RecycleBin {\n                constructor(arg) {\n                    this.mFirstActivePosition = 0;\n                    this.mActiveViews = [];\n                    this.mViewTypeCount = 0;\n                    this._AbsListView_this = arg;\n                }\n                setViewTypeCount(viewTypeCount) {\n                    if (viewTypeCount < 1) {\n                        throw Error(`new IllegalArgumentException(\"Can't have a viewTypeCount < 1\")`);\n                    }\n                    let scrapViews = new Array(viewTypeCount);\n                    for (let i = 0; i < viewTypeCount; i++) {\n                        scrapViews[i] = new ArrayList();\n                    }\n                    this.mViewTypeCount = viewTypeCount;\n                    this.mCurrentScrap = scrapViews[0];\n                    this.mScrapViews = scrapViews;\n                }\n                markChildrenDirty() {\n                    if (this.mViewTypeCount == 1) {\n                        const scrap = this.mCurrentScrap;\n                        const scrapCount = scrap.size();\n                        for (let i = 0; i < scrapCount; i++) {\n                            scrap.get(i).forceLayout();\n                        }\n                    }\n                    else {\n                        const typeCount = this.mViewTypeCount;\n                        for (let i = 0; i < typeCount; i++) {\n                            const scrap = this.mScrapViews[i];\n                            const scrapCount = scrap.size();\n                            for (let j = 0; j < scrapCount; j++) {\n                                scrap.get(j).forceLayout();\n                            }\n                        }\n                    }\n                    if (this.mTransientStateViews != null) {\n                        const count = this.mTransientStateViews.size();\n                        for (let i = 0; i < count; i++) {\n                            this.mTransientStateViews.valueAt(i).forceLayout();\n                        }\n                    }\n                    if (this.mTransientStateViewsById != null) {\n                        const count = this.mTransientStateViewsById.size();\n                        for (let i = 0; i < count; i++) {\n                            this.mTransientStateViewsById.valueAt(i).forceLayout();\n                        }\n                    }\n                }\n                shouldRecycleViewType(viewType) {\n                    return viewType >= 0;\n                }\n                clear() {\n                    if (this.mViewTypeCount == 1) {\n                        const scrap = this.mCurrentScrap;\n                        const scrapCount = scrap.size();\n                        for (let i = 0; i < scrapCount; i++) {\n                            this._AbsListView_this.removeDetachedView(scrap.remove(scrapCount - 1 - i), false);\n                        }\n                    }\n                    else {\n                        const typeCount = this.mViewTypeCount;\n                        for (let i = 0; i < typeCount; i++) {\n                            const scrap = this.mScrapViews[i];\n                            const scrapCount = scrap.size();\n                            for (let j = 0; j < scrapCount; j++) {\n                                this._AbsListView_this.removeDetachedView(scrap.remove(scrapCount - 1 - j), false);\n                            }\n                        }\n                    }\n                    if (this.mTransientStateViews != null) {\n                        this.mTransientStateViews.clear();\n                    }\n                    if (this.mTransientStateViewsById != null) {\n                        this.mTransientStateViewsById.clear();\n                    }\n                }\n                fillActiveViews(childCount, firstActivePosition) {\n                    if (this.mActiveViews.length < childCount) {\n                        this.mActiveViews = new Array(childCount);\n                    }\n                    this.mFirstActivePosition = firstActivePosition;\n                    const activeViews = this.mActiveViews;\n                    for (let i = 0; i < childCount; i++) {\n                        let child = this._AbsListView_this.getChildAt(i);\n                        let lp = child.getLayoutParams();\n                        if (lp != null && lp.viewType != AbsListView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER) {\n                            activeViews[i] = child;\n                        }\n                    }\n                }\n                getActiveView(position) {\n                    let index = position - this.mFirstActivePosition;\n                    const activeViews = this.mActiveViews;\n                    if (index >= 0 && index < activeViews.length) {\n                        const match = activeViews[index];\n                        activeViews[index] = null;\n                        return match;\n                    }\n                    return null;\n                }\n                getTransientStateView(position) {\n                    if (this._AbsListView_this.mAdapter != null && this._AbsListView_this.mAdapterHasStableIds && this.mTransientStateViewsById != null) {\n                        let id = this._AbsListView_this.mAdapter.getItemId(position);\n                        let result = this.mTransientStateViewsById.get(id);\n                        this.mTransientStateViewsById.remove(id);\n                        return result;\n                    }\n                    if (this.mTransientStateViews != null) {\n                        const index = this.mTransientStateViews.indexOfKey(position);\n                        if (index >= 0) {\n                            let result = this.mTransientStateViews.valueAt(index);\n                            this.mTransientStateViews.removeAt(index);\n                            return result;\n                        }\n                    }\n                    return null;\n                }\n                clearTransientStateViews() {\n                    if (this.mTransientStateViews != null) {\n                        this.mTransientStateViews.clear();\n                    }\n                    if (this.mTransientStateViewsById != null) {\n                        this.mTransientStateViewsById.clear();\n                    }\n                }\n                getScrapView(position) {\n                    if (this.mViewTypeCount == 1) {\n                        return AbsListView.retrieveFromScrap(this.mCurrentScrap, position);\n                    }\n                    else {\n                        let whichScrap = this._AbsListView_this.mAdapter.getItemViewType(position);\n                        if (whichScrap >= 0 && whichScrap < this.mScrapViews.length) {\n                            return AbsListView.retrieveFromScrap(this.mScrapViews[whichScrap], position);\n                        }\n                    }\n                    return null;\n                }\n                addScrapView(scrap, position) {\n                    const lp = scrap.getLayoutParams();\n                    if (lp == null) {\n                        return;\n                    }\n                    lp.scrappedFromPosition = position;\n                    const viewType = lp.viewType;\n                    if (!this.shouldRecycleViewType(viewType)) {\n                        return;\n                    }\n                    scrap.dispatchStartTemporaryDetach();\n                    const scrapHasTransientState = scrap.hasTransientState();\n                    if (scrapHasTransientState) {\n                        if (this._AbsListView_this.mAdapter != null && this._AbsListView_this.mAdapterHasStableIds) {\n                            if (this.mTransientStateViewsById == null) {\n                                this.mTransientStateViewsById = new LongSparseArray();\n                            }\n                            this.mTransientStateViewsById.put(lp.itemId, scrap);\n                        }\n                        else if (!this._AbsListView_this.mDataChanged) {\n                            if (this.mTransientStateViews == null) {\n                                this.mTransientStateViews = new SparseArray();\n                            }\n                            this.mTransientStateViews.put(position, scrap);\n                        }\n                        else {\n                            if (this.mSkippedScrap == null) {\n                                this.mSkippedScrap = new ArrayList();\n                            }\n                            this.mSkippedScrap.add(scrap);\n                        }\n                    }\n                    else {\n                        if (this.mViewTypeCount == 1) {\n                            this.mCurrentScrap.add(scrap);\n                        }\n                        else {\n                            this.mScrapViews[viewType].add(scrap);\n                        }\n                        if (this.mRecyclerListener != null) {\n                            this.mRecyclerListener.onMovedToScrapHeap(scrap);\n                        }\n                    }\n                }\n                removeSkippedScrap() {\n                    if (this.mSkippedScrap == null) {\n                        return;\n                    }\n                    const count = this.mSkippedScrap.size();\n                    for (let i = 0; i < count; i++) {\n                        this._AbsListView_this.removeDetachedView(this.mSkippedScrap.get(i), false);\n                    }\n                    this.mSkippedScrap.clear();\n                }\n                scrapActiveViews() {\n                    const activeViews = this.mActiveViews;\n                    const hasListener = this.mRecyclerListener != null;\n                    const multipleScraps = this.mViewTypeCount > 1;\n                    let scrapViews = this.mCurrentScrap;\n                    const count = activeViews.length;\n                    for (let i = count - 1; i >= 0; i--) {\n                        const victim = activeViews[i];\n                        if (victim != null) {\n                            const lp = victim.getLayoutParams();\n                            let whichScrap = lp.viewType;\n                            activeViews[i] = null;\n                            const scrapHasTransientState = victim.hasTransientState();\n                            if (!this.shouldRecycleViewType(whichScrap) || scrapHasTransientState) {\n                                if (whichScrap != AbsListView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER && scrapHasTransientState) {\n                                    this._AbsListView_this.removeDetachedView(victim, false);\n                                }\n                                if (scrapHasTransientState) {\n                                    if (this._AbsListView_this.mAdapter != null && this._AbsListView_this.mAdapterHasStableIds) {\n                                        if (this.mTransientStateViewsById == null) {\n                                            this.mTransientStateViewsById = new LongSparseArray();\n                                        }\n                                        let id = this._AbsListView_this.mAdapter.getItemId(this.mFirstActivePosition + i);\n                                        this.mTransientStateViewsById.put(id, victim);\n                                    }\n                                    else {\n                                        if (this.mTransientStateViews == null) {\n                                            this.mTransientStateViews = new SparseArray();\n                                        }\n                                        this.mTransientStateViews.put(this.mFirstActivePosition + i, victim);\n                                    }\n                                }\n                                continue;\n                            }\n                            if (multipleScraps) {\n                                scrapViews = this.mScrapViews[whichScrap];\n                            }\n                            victim.dispatchStartTemporaryDetach();\n                            lp.scrappedFromPosition = this.mFirstActivePosition + i;\n                            scrapViews.add(victim);\n                            if (hasListener) {\n                                this.mRecyclerListener.onMovedToScrapHeap(victim);\n                            }\n                        }\n                    }\n                    this.pruneScrapViews();\n                }\n                pruneScrapViews() {\n                    const maxViews = this.mActiveViews.length;\n                    const viewTypeCount = this.mViewTypeCount;\n                    const scrapViews = this.mScrapViews;\n                    for (let i = 0; i < viewTypeCount; ++i) {\n                        const scrapPile = scrapViews[i];\n                        let size = scrapPile.size();\n                        const extras = size - maxViews;\n                        size--;\n                        for (let j = 0; j < extras; j++) {\n                            this._AbsListView_this.removeDetachedView(scrapPile.remove(size--), false);\n                        }\n                    }\n                    if (this.mTransientStateViews != null) {\n                        for (let i = 0; i < this.mTransientStateViews.size(); i++) {\n                            const v = this.mTransientStateViews.valueAt(i);\n                            if (!v.hasTransientState()) {\n                                this.mTransientStateViews.removeAt(i);\n                                i--;\n                            }\n                        }\n                    }\n                    if (this.mTransientStateViewsById != null) {\n                        for (let i = 0; i < this.mTransientStateViewsById.size(); i++) {\n                            const v = this.mTransientStateViewsById.valueAt(i);\n                            if (!v.hasTransientState()) {\n                                this.mTransientStateViewsById.removeAt(i);\n                                i--;\n                            }\n                        }\n                    }\n                }\n                reclaimScrapViews(views) {\n                    if (this.mViewTypeCount == 1) {\n                        views.addAll(this.mCurrentScrap);\n                    }\n                    else {\n                        const viewTypeCount = this.mViewTypeCount;\n                        const scrapViews = this.mScrapViews;\n                        for (let i = 0; i < viewTypeCount; ++i) {\n                            const scrapPile = scrapViews[i];\n                            views.addAll(scrapPile);\n                        }\n                    }\n                }\n                setCacheColorHint(color) {\n                    if (this.mViewTypeCount == 1) {\n                        const scrap = this.mCurrentScrap;\n                        const scrapCount = scrap.size();\n                        for (let i = 0; i < scrapCount; i++) {\n                            scrap.get(i).setDrawingCacheBackgroundColor(color);\n                        }\n                    }\n                    else {\n                        const typeCount = this.mViewTypeCount;\n                        for (let i = 0; i < typeCount; i++) {\n                            const scrap = this.mScrapViews[i];\n                            const scrapCount = scrap.size();\n                            for (let j = 0; j < scrapCount; j++) {\n                                scrap.get(j).setDrawingCacheBackgroundColor(color);\n                            }\n                        }\n                    }\n                    const activeViews = this.mActiveViews;\n                    const count = activeViews.length;\n                    for (let i = 0; i < count; ++i) {\n                        const victim = activeViews[i];\n                        if (victim != null) {\n                            victim.setDrawingCacheBackgroundColor(color);\n                        }\n                    }\n                }\n            }\n            AbsListView.RecycleBin = RecycleBin;\n        })(AbsListView = widget.AbsListView || (widget.AbsListView = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var ArrayList = java.util.ArrayList;\n        var AdapterView = android.widget.AdapterView;\n        class HeaderViewListAdapter {\n            constructor(headerViewInfos, footerViewInfos, adapter) {\n                this.mAdapter = adapter;\n                this.mIsFilterable = false;\n                if (headerViewInfos == null) {\n                    this.mHeaderViewInfos = HeaderViewListAdapter.EMPTY_INFO_LIST;\n                }\n                else {\n                    this.mHeaderViewInfos = headerViewInfos;\n                }\n                if (footerViewInfos == null) {\n                    this.mFooterViewInfos = HeaderViewListAdapter.EMPTY_INFO_LIST;\n                }\n                else {\n                    this.mFooterViewInfos = footerViewInfos;\n                }\n                this.mAreAllFixedViewsSelectable = this.areAllListInfosSelectable(this.mHeaderViewInfos) && this.areAllListInfosSelectable(this.mFooterViewInfos);\n            }\n            getHeadersCount() {\n                return this.mHeaderViewInfos.size();\n            }\n            getFootersCount() {\n                return this.mFooterViewInfos.size();\n            }\n            isEmpty() {\n                return this.mAdapter == null || this.mAdapter.isEmpty();\n            }\n            areAllListInfosSelectable(infos) {\n                if (infos != null) {\n                    for (let info of infos.array) {\n                        if (!info.isSelectable) {\n                            return false;\n                        }\n                    }\n                }\n                return true;\n            }\n            removeHeader(v) {\n                for (let i = 0; i < this.mHeaderViewInfos.size(); i++) {\n                    let info = this.mHeaderViewInfos.get(i);\n                    if (info.view == v) {\n                        this.mHeaderViewInfos.remove(i);\n                        this.mAreAllFixedViewsSelectable = this.areAllListInfosSelectable(this.mHeaderViewInfos) && this.areAllListInfosSelectable(this.mFooterViewInfos);\n                        return true;\n                    }\n                }\n                return false;\n            }\n            removeFooter(v) {\n                for (let i = 0; i < this.mFooterViewInfos.size(); i++) {\n                    let info = this.mFooterViewInfos.get(i);\n                    if (info.view == v) {\n                        this.mFooterViewInfos.remove(i);\n                        this.mAreAllFixedViewsSelectable = this.areAllListInfosSelectable(this.mHeaderViewInfos) && this.areAllListInfosSelectable(this.mFooterViewInfos);\n                        return true;\n                    }\n                }\n                return false;\n            }\n            getCount() {\n                if (this.mAdapter != null) {\n                    return this.getFootersCount() + this.getHeadersCount() + this.mAdapter.getCount();\n                }\n                else {\n                    return this.getFootersCount() + this.getHeadersCount();\n                }\n            }\n            areAllItemsEnabled() {\n                if (this.mAdapter != null) {\n                    return this.mAreAllFixedViewsSelectable && this.mAdapter.areAllItemsEnabled();\n                }\n                else {\n                    return true;\n                }\n            }\n            isEnabled(position) {\n                let numHeaders = this.getHeadersCount();\n                if (position < numHeaders) {\n                    return this.mHeaderViewInfos.get(position).isSelectable;\n                }\n                const adjPosition = position - numHeaders;\n                let adapterCount = 0;\n                if (this.mAdapter != null) {\n                    adapterCount = this.mAdapter.getCount();\n                    if (adjPosition < adapterCount) {\n                        return this.mAdapter.isEnabled(adjPosition);\n                    }\n                }\n                return this.mFooterViewInfos.get(adjPosition - adapterCount).isSelectable;\n            }\n            getItem(position) {\n                let numHeaders = this.getHeadersCount();\n                if (position < numHeaders) {\n                    return this.mHeaderViewInfos.get(position).data;\n                }\n                const adjPosition = position - numHeaders;\n                let adapterCount = 0;\n                if (this.mAdapter != null) {\n                    adapterCount = this.mAdapter.getCount();\n                    if (adjPosition < adapterCount) {\n                        return this.mAdapter.getItem(adjPosition);\n                    }\n                }\n                return this.mFooterViewInfos.get(adjPosition - adapterCount).data;\n            }\n            getItemId(position) {\n                let numHeaders = this.getHeadersCount();\n                if (this.mAdapter != null && position >= numHeaders) {\n                    let adjPosition = position - numHeaders;\n                    let adapterCount = this.mAdapter.getCount();\n                    if (adjPosition < adapterCount) {\n                        return this.mAdapter.getItemId(adjPosition);\n                    }\n                }\n                return -1;\n            }\n            hasStableIds() {\n                if (this.mAdapter != null) {\n                    return this.mAdapter.hasStableIds();\n                }\n                return false;\n            }\n            getView(position, convertView, parent) {\n                let numHeaders = this.getHeadersCount();\n                if (position < numHeaders) {\n                    return this.mHeaderViewInfos.get(position).view;\n                }\n                const adjPosition = position - numHeaders;\n                let adapterCount = 0;\n                if (this.mAdapter != null) {\n                    adapterCount = this.mAdapter.getCount();\n                    if (adjPosition < adapterCount) {\n                        return this.mAdapter.getView(adjPosition, convertView, parent);\n                    }\n                }\n                return this.mFooterViewInfos.get(adjPosition - adapterCount).view;\n            }\n            getItemViewType(position) {\n                let numHeaders = this.getHeadersCount();\n                if (this.mAdapter != null && position >= numHeaders) {\n                    let adjPosition = position - numHeaders;\n                    let adapterCount = this.mAdapter.getCount();\n                    if (adjPosition < adapterCount) {\n                        return this.mAdapter.getItemViewType(adjPosition);\n                    }\n                }\n                return AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER;\n            }\n            getViewTypeCount() {\n                if (this.mAdapter != null) {\n                    return this.mAdapter.getViewTypeCount();\n                }\n                return 1;\n            }\n            registerDataSetObserver(observer) {\n                if (this.mAdapter != null) {\n                    this.mAdapter.registerDataSetObserver(observer);\n                }\n            }\n            unregisterDataSetObserver(observer) {\n                if (this.mAdapter != null) {\n                    this.mAdapter.unregisterDataSetObserver(observer);\n                }\n            }\n            getFilter() {\n                return null;\n            }\n            getWrappedAdapter() {\n                return this.mAdapter;\n            }\n        }\n        HeaderViewListAdapter.EMPTY_INFO_LIST = new ArrayList();\n        widget.HeaderViewListAdapter = HeaderViewListAdapter;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var database;\n    (function (database) {\n        var ArrayList = java.util.ArrayList;\n        class Observable {\n            constructor() {\n                this.mObservers = new ArrayList();\n            }\n            registerObserver(observer) {\n                if (observer == null) {\n                    throw new Error(\"The observer is null.\");\n                }\n                if (this.mObservers.contains(observer)) {\n                    throw new Error(\"Observer \" + observer + \" is already registered.\");\n                }\n                this.mObservers.add(observer);\n            }\n            unregisterObserver(observer) {\n                if (observer == null) {\n                    throw new Error(\"The observer is null.\");\n                }\n                let index = this.mObservers.indexOf(observer);\n                if (index == -1) {\n                    throw new Error(\"Observer \" + observer + \" was not registered.\");\n                }\n                this.mObservers.remove(index);\n            }\n            unregisterAll() {\n                this.mObservers.clear();\n            }\n        }\n        database.Observable = Observable;\n    })(database = android.database || (android.database = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var database;\n    (function (database) {\n        var Observable = android.database.Observable;\n        class DataSetObservable extends Observable {\n            notifyChanged() {\n                for (let i = this.mObservers.size() - 1; i >= 0; i--) {\n                    this.mObservers.get(i).onChanged();\n                }\n            }\n            notifyInvalidated() {\n                for (let i = this.mObservers.size() - 1; i >= 0; i--) {\n                    this.mObservers.get(i).onInvalidated();\n                }\n            }\n        }\n        database.DataSetObservable = DataSetObservable;\n    })(database = android.database || (android.database = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var DataSetObservable = android.database.DataSetObservable;\n        class BaseAdapter {\n            constructor() {\n                this.mDataSetObservable = new DataSetObservable();\n            }\n            hasStableIds() {\n                return false;\n            }\n            registerDataSetObserver(observer) {\n                this.mDataSetObservable.registerObserver(observer);\n            }\n            unregisterDataSetObserver(observer) {\n                this.mDataSetObservable.unregisterObserver(observer);\n            }\n            notifyDataSetChanged() {\n                this.mDataSetObservable.notifyChanged();\n            }\n            notifyDataSetInvalidated() {\n                this.mDataSetObservable.notifyInvalidated();\n            }\n            areAllItemsEnabled() {\n                return true;\n            }\n            isEnabled(position) {\n                return true;\n            }\n            getDropDownView(position, convertView, parent) {\n                return this.getView(position, convertView, parent);\n            }\n            getItemViewType(position) {\n                return 0;\n            }\n            getViewTypeCount() {\n                return 1;\n            }\n            isEmpty() {\n                return this.getCount() == 0;\n            }\n        }\n        widget.BaseAdapter = BaseAdapter;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var Paint = android.graphics.Paint;\n        var PixelFormat = android.graphics.PixelFormat;\n        var Rect = android.graphics.Rect;\n        var MathUtils = android.util.MathUtils;\n        var FocusFinder = android.view.FocusFinder;\n        var KeyEvent = android.view.KeyEvent;\n        var SoundEffectConstants = android.view.SoundEffectConstants;\n        var View = android.view.View;\n        var ViewGroup = android.view.ViewGroup;\n        var Trace = android.os.Trace;\n        var ArrayList = java.util.ArrayList;\n        var Integer = java.lang.Integer;\n        var System = java.lang.System;\n        var AbsListView = android.widget.AbsListView;\n        var AdapterView = android.widget.AdapterView;\n        var HeaderViewListAdapter = android.widget.HeaderViewListAdapter;\n        class ListView extends AbsListView {\n            constructor(context, bindElement, defStyle = android.R.attr.listViewStyle) {\n                super(context, bindElement, defStyle);\n                this.mHeaderViewInfos = new ArrayList();\n                this.mFooterViewInfos = new ArrayList();\n                this.mDividerHeight = 0;\n                this.mIsCacheColorOpaque = false;\n                this.mDividerIsOpaque = false;\n                this.mHeaderDividersEnabled = true;\n                this.mFooterDividersEnabled = true;\n                this.mAreAllItemsSelectable = true;\n                this.mItemsCanFocus = false;\n                this.mTempRect = new Rect();\n                this.mArrowScrollFocusResult = new ListView.ArrowScrollFocusResult();\n                let a = context.obtainStyledAttributes(bindElement, defStyle);\n                const d = a.getDrawable('divider');\n                if (d != null) {\n                    this.setDivider(d);\n                }\n                const osHeader = a.getDrawable('overScrollHeader');\n                if (osHeader != null) {\n                    this.setOverscrollHeader(osHeader);\n                }\n                const osFooter = a.getDrawable('overScrollFooter');\n                if (osFooter != null) {\n                    this.setOverscrollFooter(osFooter);\n                }\n                const dividerHeight = a.getDimensionPixelSize('dividerHeight', 0);\n                if (dividerHeight != 0) {\n                    this.setDividerHeight(dividerHeight);\n                }\n                this.mHeaderDividersEnabled = a.getBoolean('headerDividersEnabled', true);\n                this.mFooterDividersEnabled = a.getBoolean('footerDividersEnabled', true);\n                a.recycle();\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('divider', {\n                    setter(v, value, attrBinder) {\n                        let divider = attrBinder.parseDrawable(value);\n                        if (divider)\n                            v.setDivider(divider);\n                    }, getter(v) {\n                        return v.mDivider;\n                    }\n                }).set('overScrollHeader', {\n                    setter(v, value, attrBinder) {\n                        let header = attrBinder.parseDrawable(value);\n                        if (header)\n                            v.setOverscrollHeader(header);\n                    }, getter(v) {\n                        return v.getOverscrollHeader();\n                    }\n                }).set('overScrollFooter', {\n                    setter(v, value, attrBinder) {\n                        let footer = attrBinder.parseDrawable(value);\n                        if (footer)\n                            v.setOverscrollFooter(footer);\n                    }, getter(v) {\n                        return v.getOverscrollFooter();\n                    }\n                }).set('dividerHeight', {\n                    setter(v, value, attrBinder) {\n                        v.setDividerHeight(attrBinder.parseNumberPixelSize(value, v.getDividerHeight()));\n                    }, getter(v) {\n                        return v.getDividerHeight();\n                    }\n                }).set('headerDividersEnabled', {\n                    setter(v, value, attrBinder) {\n                        v.setHeaderDividersEnabled(attrBinder.parseBoolean(value, v.mHeaderDividersEnabled));\n                    }, getter(v) {\n                        return v.mHeaderDividersEnabled;\n                    }\n                }).set('dividerHeight', {\n                    setter(v, value, attrBinder) {\n                        v.setFooterDividersEnabled(attrBinder.parseBoolean(value, v.mFooterDividersEnabled));\n                    }, getter(v) {\n                        return v.mFooterDividersEnabled;\n                    }\n                });\n            }\n            getMaxScrollAmount() {\n                return Math.floor((ListView.MAX_SCROLL_FACTOR * (this.mBottom - this.mTop)));\n            }\n            adjustViewsUpOrDown() {\n                const childCount = this.getChildCount();\n                let delta;\n                if (childCount > 0) {\n                    let child;\n                    if (!this.mStackFromBottom) {\n                        child = this.getChildAt(0);\n                        delta = child.getTop() - this.mListPadding.top;\n                        if (this.mFirstPosition != 0) {\n                            delta -= this.mDividerHeight;\n                        }\n                        if (delta < 0) {\n                            delta = 0;\n                        }\n                    }\n                    else {\n                        child = this.getChildAt(childCount - 1);\n                        delta = child.getBottom() - (this.getHeight() - this.mListPadding.bottom);\n                        if (this.mFirstPosition + childCount < this.mItemCount) {\n                            delta += this.mDividerHeight;\n                        }\n                        if (delta > 0) {\n                            delta = 0;\n                        }\n                    }\n                    if (delta != 0) {\n                        this.offsetChildrenTopAndBottom(-delta);\n                    }\n                }\n            }\n            addHeaderView(v, data = null, isSelectable = true) {\n                const info = new ListView.FixedViewInfo(this);\n                info.view = v;\n                info.data = data;\n                info.isSelectable = isSelectable;\n                this.mHeaderViewInfos.add(info);\n                if (this.mAdapter != null) {\n                    if (!(this.mAdapter instanceof HeaderViewListAdapter)) {\n                        this.mAdapter = new HeaderViewListAdapter(this.mHeaderViewInfos, this.mFooterViewInfos, this.mAdapter);\n                    }\n                    if (this.mDataSetObserver != null) {\n                        this.mDataSetObserver.onChanged();\n                    }\n                }\n            }\n            getHeaderViewsCount() {\n                return this.mHeaderViewInfos.size();\n            }\n            removeHeaderView(v) {\n                if (this.mHeaderViewInfos.size() > 0) {\n                    let result = false;\n                    if (this.mAdapter != null && this.mAdapter.removeHeader(v)) {\n                        if (this.mDataSetObserver != null) {\n                            this.mDataSetObserver.onChanged();\n                        }\n                        result = true;\n                    }\n                    this.removeFixedViewInfo(v, this.mHeaderViewInfos);\n                    return result;\n                }\n                return false;\n            }\n            removeFixedViewInfo(v, where) {\n                let len = where.size();\n                for (let i = 0; i < len; ++i) {\n                    let info = where.get(i);\n                    if (info.view == v) {\n                        where.remove(i);\n                        break;\n                    }\n                }\n            }\n            addFooterView(v, data = null, isSelectable = true) {\n                const info = new ListView.FixedViewInfo(this);\n                info.view = v;\n                info.data = data;\n                info.isSelectable = isSelectable;\n                this.mFooterViewInfos.add(info);\n                if (this.mAdapter != null) {\n                    if (!(this.mAdapter instanceof HeaderViewListAdapter)) {\n                        this.mAdapter = new HeaderViewListAdapter(this.mHeaderViewInfos, this.mFooterViewInfos, this.mAdapter);\n                    }\n                    if (this.mDataSetObserver != null) {\n                        this.mDataSetObserver.onChanged();\n                    }\n                }\n            }\n            getFooterViewsCount() {\n                return this.mFooterViewInfos.size();\n            }\n            removeFooterView(v) {\n                if (this.mFooterViewInfos.size() > 0) {\n                    let result = false;\n                    if (this.mAdapter != null && this.mAdapter.removeFooter(v)) {\n                        if (this.mDataSetObserver != null) {\n                            this.mDataSetObserver.onChanged();\n                        }\n                        result = true;\n                    }\n                    this.removeFixedViewInfo(v, this.mFooterViewInfos);\n                    return result;\n                }\n                return false;\n            }\n            getAdapter() {\n                return this.mAdapter;\n            }\n            setAdapter(adapter) {\n                if (this.mAdapter != null && this.mDataSetObserver != null) {\n                    this.mAdapter.unregisterDataSetObserver(this.mDataSetObserver);\n                }\n                this.resetList();\n                this.mRecycler.clear();\n                if (this.mHeaderViewInfos.size() > 0 || this.mFooterViewInfos.size() > 0) {\n                    this.mAdapter = new HeaderViewListAdapter(this.mHeaderViewInfos, this.mFooterViewInfos, adapter);\n                }\n                else {\n                    this.mAdapter = adapter;\n                }\n                this.mOldSelectedPosition = ListView.INVALID_POSITION;\n                this.mOldSelectedRowId = ListView.INVALID_ROW_ID;\n                super.setAdapter(adapter);\n                if (this.mAdapter != null) {\n                    this.mAreAllItemsSelectable = this.mAdapter.areAllItemsEnabled();\n                    this.mOldItemCount = this.mItemCount;\n                    this.mItemCount = this.mAdapter.getCount();\n                    this.checkFocus();\n                    this.mDataSetObserver = new AbsListView.AdapterDataSetObserver(this);\n                    this.mAdapter.registerDataSetObserver(this.mDataSetObserver);\n                    this.mRecycler.setViewTypeCount(this.mAdapter.getViewTypeCount());\n                    let position;\n                    if (this.mStackFromBottom) {\n                        position = this.lookForSelectablePosition(this.mItemCount - 1, false);\n                    }\n                    else {\n                        position = this.lookForSelectablePosition(0, true);\n                    }\n                    this.setSelectedPositionInt(position);\n                    this.setNextSelectedPositionInt(position);\n                    if (this.mItemCount == 0) {\n                        this.checkSelectionChanged();\n                    }\n                }\n                else {\n                    this.mAreAllItemsSelectable = true;\n                    this.checkFocus();\n                    this.checkSelectionChanged();\n                }\n                this.requestLayout();\n            }\n            resetList() {\n                this.clearRecycledState(this.mHeaderViewInfos);\n                this.clearRecycledState(this.mFooterViewInfos);\n                super.resetList();\n                this.mLayoutMode = ListView.LAYOUT_NORMAL;\n            }\n            clearRecycledState(infos) {\n                if (infos != null) {\n                    const count = infos.size();\n                    for (let i = 0; i < count; i++) {\n                        const child = infos.get(i).view;\n                        const p = child.getLayoutParams();\n                        if (p != null) {\n                            p.recycledHeaderFooter = false;\n                        }\n                    }\n                }\n            }\n            showingTopFadingEdge() {\n                const listTop = this.mScrollY + this.mListPadding.top;\n                return (this.mFirstPosition > 0) || (this.getChildAt(0).getTop() > listTop);\n            }\n            showingBottomFadingEdge() {\n                const childCount = this.getChildCount();\n                const bottomOfBottomChild = this.getChildAt(childCount - 1).getBottom();\n                const lastVisiblePosition = this.mFirstPosition + childCount - 1;\n                const listBottom = this.mScrollY + this.getHeight() - this.mListPadding.bottom;\n                return (lastVisiblePosition < this.mItemCount - 1) || (bottomOfBottomChild < listBottom);\n            }\n            requestChildRectangleOnScreen(child, rect, immediate) {\n                let rectTopWithinChild = rect.top;\n                rect.offset(child.getLeft(), child.getTop());\n                rect.offset(-child.getScrollX(), -child.getScrollY());\n                const height = this.getHeight();\n                let listUnfadedTop = this.getScrollY();\n                let listUnfadedBottom = listUnfadedTop + height;\n                const fadingEdge = this.getVerticalFadingEdgeLength();\n                if (this.showingTopFadingEdge()) {\n                    if ((this.mSelectedPosition > 0) || (rectTopWithinChild > fadingEdge)) {\n                        listUnfadedTop += fadingEdge;\n                    }\n                }\n                let childCount = this.getChildCount();\n                let bottomOfBottomChild = this.getChildAt(childCount - 1).getBottom();\n                if (this.showingBottomFadingEdge()) {\n                    if ((this.mSelectedPosition < this.mItemCount - 1) || (rect.bottom < (bottomOfBottomChild - fadingEdge))) {\n                        listUnfadedBottom -= fadingEdge;\n                    }\n                }\n                let scrollYDelta = 0;\n                if (rect.bottom > listUnfadedBottom && rect.top > listUnfadedTop) {\n                    if (rect.height() > height) {\n                        scrollYDelta += (rect.top - listUnfadedTop);\n                    }\n                    else {\n                        scrollYDelta += (rect.bottom - listUnfadedBottom);\n                    }\n                    let distanceToBottom = bottomOfBottomChild - listUnfadedBottom;\n                    scrollYDelta = Math.min(scrollYDelta, distanceToBottom);\n                }\n                else if (rect.top < listUnfadedTop && rect.bottom < listUnfadedBottom) {\n                    if (rect.height() > height) {\n                        scrollYDelta -= (listUnfadedBottom - rect.bottom);\n                    }\n                    else {\n                        scrollYDelta -= (listUnfadedTop - rect.top);\n                    }\n                    let top = this.getChildAt(0).getTop();\n                    let deltaToTop = top - listUnfadedTop;\n                    scrollYDelta = Math.max(scrollYDelta, deltaToTop);\n                }\n                const scroll = scrollYDelta != 0;\n                if (scroll) {\n                    this.scrollListItemsBy(-scrollYDelta);\n                    this.positionSelector(ListView.INVALID_POSITION, child);\n                    this.mSelectedTop = child.getTop();\n                    this.invalidate();\n                }\n                return scroll;\n            }\n            fillGap(down) {\n                const count = this.getChildCount();\n                if (down) {\n                    let paddingTop = 0;\n                    if ((this.mGroupFlags & ListView.CLIP_TO_PADDING_MASK) == ListView.CLIP_TO_PADDING_MASK) {\n                        paddingTop = this.getListPaddingTop();\n                    }\n                    const startOffset = count > 0 ? this.getChildAt(count - 1).getBottom() + this.mDividerHeight : paddingTop;\n                    this.fillDown(this.mFirstPosition + count, startOffset);\n                    this.correctTooHigh(this.getChildCount());\n                }\n                else {\n                    let paddingBottom = 0;\n                    if ((this.mGroupFlags & ListView.CLIP_TO_PADDING_MASK) == ListView.CLIP_TO_PADDING_MASK) {\n                        paddingBottom = this.getListPaddingBottom();\n                    }\n                    const startOffset = count > 0 ? this.getChildAt(0).getTop() - this.mDividerHeight : this.getHeight() - paddingBottom;\n                    this.fillUp(this.mFirstPosition - 1, startOffset);\n                    this.correctTooLow(this.getChildCount());\n                }\n            }\n            fillDown(pos, nextTop) {\n                let selectedView = null;\n                let end = (this.mBottom - this.mTop);\n                if ((this.mGroupFlags & ListView.CLIP_TO_PADDING_MASK) == ListView.CLIP_TO_PADDING_MASK) {\n                    end -= this.mListPadding.bottom;\n                }\n                while (nextTop < end && pos < this.mItemCount) {\n                    let selected = pos == this.mSelectedPosition;\n                    let child = this.makeAndAddView(pos, nextTop, true, this.mListPadding.left, selected);\n                    nextTop = child.getBottom() + this.mDividerHeight;\n                    if (selected) {\n                        selectedView = child;\n                    }\n                    pos++;\n                }\n                this.setVisibleRangeHint(this.mFirstPosition, this.mFirstPosition + this.getChildCount() - 1);\n                return selectedView;\n            }\n            fillUp(pos, nextBottom) {\n                let selectedView = null;\n                let end = 0;\n                if ((this.mGroupFlags & ListView.CLIP_TO_PADDING_MASK) == ListView.CLIP_TO_PADDING_MASK) {\n                    end = this.mListPadding.top;\n                }\n                while (nextBottom > end && pos >= 0) {\n                    let selected = pos == this.mSelectedPosition;\n                    let child = this.makeAndAddView(pos, nextBottom, false, this.mListPadding.left, selected);\n                    nextBottom = child.getTop() - this.mDividerHeight;\n                    if (selected) {\n                        selectedView = child;\n                    }\n                    pos--;\n                }\n                this.mFirstPosition = pos + 1;\n                this.setVisibleRangeHint(this.mFirstPosition, this.mFirstPosition + this.getChildCount() - 1);\n                return selectedView;\n            }\n            fillFromTop(nextTop) {\n                this.mFirstPosition = Math.min(this.mFirstPosition, this.mSelectedPosition);\n                this.mFirstPosition = Math.min(this.mFirstPosition, this.mItemCount - 1);\n                if (this.mFirstPosition < 0) {\n                    this.mFirstPosition = 0;\n                }\n                return this.fillDown(this.mFirstPosition, nextTop);\n            }\n            fillFromMiddle(childrenTop, childrenBottom) {\n                let height = childrenBottom - childrenTop;\n                let position = this.reconcileSelectedPosition();\n                let sel = this.makeAndAddView(position, childrenTop, true, this.mListPadding.left, true);\n                this.mFirstPosition = position;\n                let selHeight = sel.getMeasuredHeight();\n                if (selHeight <= height) {\n                    sel.offsetTopAndBottom((height - selHeight) / 2);\n                }\n                this.fillAboveAndBelow(sel, position);\n                if (!this.mStackFromBottom) {\n                    this.correctTooHigh(this.getChildCount());\n                }\n                else {\n                    this.correctTooLow(this.getChildCount());\n                }\n                return sel;\n            }\n            fillAboveAndBelow(sel, position) {\n                const dividerHeight = this.mDividerHeight;\n                if (!this.mStackFromBottom) {\n                    this.fillUp(position - 1, sel.getTop() - dividerHeight);\n                    this.adjustViewsUpOrDown();\n                    this.fillDown(position + 1, sel.getBottom() + dividerHeight);\n                }\n                else {\n                    this.fillDown(position + 1, sel.getBottom() + dividerHeight);\n                    this.adjustViewsUpOrDown();\n                    this.fillUp(position - 1, sel.getTop() - dividerHeight);\n                }\n            }\n            fillFromSelection(selectedTop, childrenTop, childrenBottom) {\n                let fadingEdgeLength = this.getVerticalFadingEdgeLength();\n                const selectedPosition = this.mSelectedPosition;\n                let sel;\n                const topSelectionPixel = this.getTopSelectionPixel(childrenTop, fadingEdgeLength, selectedPosition);\n                const bottomSelectionPixel = this.getBottomSelectionPixel(childrenBottom, fadingEdgeLength, selectedPosition);\n                sel = this.makeAndAddView(selectedPosition, selectedTop, true, this.mListPadding.left, true);\n                if (sel.getBottom() > bottomSelectionPixel) {\n                    const spaceAbove = sel.getTop() - topSelectionPixel;\n                    const spaceBelow = sel.getBottom() - bottomSelectionPixel;\n                    const offset = Math.min(spaceAbove, spaceBelow);\n                    sel.offsetTopAndBottom(-offset);\n                }\n                else if (sel.getTop() < topSelectionPixel) {\n                    const spaceAbove = topSelectionPixel - sel.getTop();\n                    const spaceBelow = bottomSelectionPixel - sel.getBottom();\n                    const offset = Math.min(spaceAbove, spaceBelow);\n                    sel.offsetTopAndBottom(offset);\n                }\n                this.fillAboveAndBelow(sel, selectedPosition);\n                if (!this.mStackFromBottom) {\n                    this.correctTooHigh(this.getChildCount());\n                }\n                else {\n                    this.correctTooLow(this.getChildCount());\n                }\n                return sel;\n            }\n            getBottomSelectionPixel(childrenBottom, fadingEdgeLength, selectedPosition) {\n                let bottomSelectionPixel = childrenBottom;\n                if (selectedPosition != this.mItemCount - 1) {\n                    bottomSelectionPixel -= fadingEdgeLength;\n                }\n                return bottomSelectionPixel;\n            }\n            getTopSelectionPixel(childrenTop, fadingEdgeLength, selectedPosition) {\n                let topSelectionPixel = childrenTop;\n                if (selectedPosition > 0) {\n                    topSelectionPixel += fadingEdgeLength;\n                }\n                return topSelectionPixel;\n            }\n            smoothScrollToPosition(position, boundPosition) {\n                super.smoothScrollToPosition(position, boundPosition);\n            }\n            smoothScrollByOffset(offset) {\n                super.smoothScrollByOffset(offset);\n            }\n            moveSelection(oldSel, newSel, delta, childrenTop, childrenBottom) {\n                let fadingEdgeLength = this.getVerticalFadingEdgeLength();\n                const selectedPosition = this.mSelectedPosition;\n                let sel;\n                const topSelectionPixel = this.getTopSelectionPixel(childrenTop, fadingEdgeLength, selectedPosition);\n                const bottomSelectionPixel = this.getBottomSelectionPixel(childrenTop, fadingEdgeLength, selectedPosition);\n                if (delta > 0) {\n                    oldSel = this.makeAndAddView(selectedPosition - 1, oldSel.getTop(), true, this.mListPadding.left, false);\n                    const dividerHeight = this.mDividerHeight;\n                    sel = this.makeAndAddView(selectedPosition, oldSel.getBottom() + dividerHeight, true, this.mListPadding.left, true);\n                    if (sel.getBottom() > bottomSelectionPixel) {\n                        let spaceAbove = sel.getTop() - topSelectionPixel;\n                        let spaceBelow = sel.getBottom() - bottomSelectionPixel;\n                        let halfVerticalSpace = (childrenBottom - childrenTop) / 2;\n                        let offset = Math.min(spaceAbove, spaceBelow);\n                        offset = Math.min(offset, halfVerticalSpace);\n                        oldSel.offsetTopAndBottom(-offset);\n                        sel.offsetTopAndBottom(-offset);\n                    }\n                    if (!this.mStackFromBottom) {\n                        this.fillUp(this.mSelectedPosition - 2, sel.getTop() - dividerHeight);\n                        this.adjustViewsUpOrDown();\n                        this.fillDown(this.mSelectedPosition + 1, sel.getBottom() + dividerHeight);\n                    }\n                    else {\n                        this.fillDown(this.mSelectedPosition + 1, sel.getBottom() + dividerHeight);\n                        this.adjustViewsUpOrDown();\n                        this.fillUp(this.mSelectedPosition - 2, sel.getTop() - dividerHeight);\n                    }\n                }\n                else if (delta < 0) {\n                    if (newSel != null) {\n                        sel = this.makeAndAddView(selectedPosition, newSel.getTop(), true, this.mListPadding.left, true);\n                    }\n                    else {\n                        sel = this.makeAndAddView(selectedPosition, oldSel.getTop(), false, this.mListPadding.left, true);\n                    }\n                    if (sel.getTop() < topSelectionPixel) {\n                        let spaceAbove = topSelectionPixel - sel.getTop();\n                        let spaceBelow = bottomSelectionPixel - sel.getBottom();\n                        let halfVerticalSpace = (childrenBottom - childrenTop) / 2;\n                        let offset = Math.min(spaceAbove, spaceBelow);\n                        offset = Math.min(offset, halfVerticalSpace);\n                        sel.offsetTopAndBottom(offset);\n                    }\n                    this.fillAboveAndBelow(sel, selectedPosition);\n                }\n                else {\n                    let oldTop = oldSel.getTop();\n                    sel = this.makeAndAddView(selectedPosition, oldTop, true, this.mListPadding.left, true);\n                    if (oldTop < childrenTop) {\n                        let newBottom = sel.getBottom();\n                        if (newBottom < childrenTop + 20) {\n                            sel.offsetTopAndBottom(childrenTop - sel.getTop());\n                        }\n                    }\n                    this.fillAboveAndBelow(sel, selectedPosition);\n                }\n                return sel;\n            }\n            onSizeChanged(w, h, oldw, oldh) {\n                if (this.getChildCount() > 0) {\n                    let focusedChild = this.getFocusedChild();\n                    if (focusedChild != null) {\n                        const childPosition = this.mFirstPosition + this.indexOfChild(focusedChild);\n                        const childBottom = focusedChild.getBottom();\n                        const offset = Math.max(0, childBottom - (h - this.mPaddingTop));\n                        const top = focusedChild.getTop() - offset;\n                        if (this.mFocusSelector == null) {\n                            this.mFocusSelector = new ListView.FocusSelector(this);\n                        }\n                        this.post(this.mFocusSelector.setup(childPosition, top));\n                    }\n                }\n                super.onSizeChanged(w, h, oldw, oldh);\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n                let widthMode = View.MeasureSpec.getMode(widthMeasureSpec);\n                let heightMode = View.MeasureSpec.getMode(heightMeasureSpec);\n                let widthSize = View.MeasureSpec.getSize(widthMeasureSpec);\n                let heightSize = View.MeasureSpec.getSize(heightMeasureSpec);\n                let childWidth = 0;\n                let childHeight = 0;\n                let childState = 0;\n                this.mItemCount = this.mAdapter == null ? 0 : this.mAdapter.getCount();\n                if (this.mItemCount > 0 && (widthMode == View.MeasureSpec.UNSPECIFIED || heightMode == View.MeasureSpec.UNSPECIFIED)) {\n                    const child = this.obtainView(0, this.mIsScrap);\n                    this.measureScrapChild(child, 0, widthMeasureSpec);\n                    childWidth = child.getMeasuredWidth();\n                    childHeight = child.getMeasuredHeight();\n                    childState = ListView.combineMeasuredStates(childState, child.getMeasuredState());\n                    if (this.recycleOnMeasure() && this.mRecycler.shouldRecycleViewType(child.getLayoutParams().viewType)) {\n                        this.mRecycler.addScrapView(child, -1);\n                    }\n                }\n                if (widthMode == View.MeasureSpec.UNSPECIFIED) {\n                    widthSize = this.mListPadding.left + this.mListPadding.right + childWidth + this.getVerticalScrollbarWidth();\n                }\n                else {\n                    widthSize |= (childState & ListView.MEASURED_STATE_MASK);\n                }\n                if (heightMode == View.MeasureSpec.UNSPECIFIED) {\n                    heightSize = this.mListPadding.top + this.mListPadding.bottom + childHeight + this.getVerticalFadingEdgeLength() * 2;\n                }\n                if (heightMode == View.MeasureSpec.AT_MOST) {\n                    heightSize = this.measureHeightOfChildren(widthMeasureSpec, 0, ListView.NO_POSITION, heightSize, -1);\n                }\n                this.setMeasuredDimension(widthSize, heightSize);\n                this.mWidthMeasureSpec = widthMeasureSpec;\n            }\n            measureScrapChild(child, position, widthMeasureSpec) {\n                let p = child.getLayoutParams();\n                if (p == null) {\n                    p = this.generateDefaultLayoutParams();\n                    child.setLayoutParams(p);\n                }\n                p.viewType = this.mAdapter.getItemViewType(position);\n                p.forceAdd = true;\n                let childWidthSpec = ViewGroup.getChildMeasureSpec(widthMeasureSpec, this.mListPadding.left + this.mListPadding.right, p.width);\n                let lpHeight = p.height;\n                let childHeightSpec;\n                if (lpHeight > 0) {\n                    childHeightSpec = View.MeasureSpec.makeMeasureSpec(lpHeight, View.MeasureSpec.EXACTLY);\n                }\n                else {\n                    childHeightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n                }\n                child.measure(childWidthSpec, childHeightSpec);\n            }\n            recycleOnMeasure() {\n                return true;\n            }\n            measureHeightOfChildren(widthMeasureSpec, startPosition, endPosition, maxHeight, disallowPartialChildPosition) {\n                const adapter = this.mAdapter;\n                if (adapter == null) {\n                    return this.mListPadding.top + this.mListPadding.bottom;\n                }\n                let returnedHeight = this.mListPadding.top + this.mListPadding.bottom;\n                const dividerHeight = ((this.mDividerHeight > 0) && this.mDivider != null) ? this.mDividerHeight : 0;\n                let prevHeightWithoutPartialChild = 0;\n                let i;\n                let child;\n                endPosition = (endPosition == ListView.NO_POSITION) ? adapter.getCount() - 1 : endPosition;\n                const recycleBin = this.mRecycler;\n                const recyle = this.recycleOnMeasure();\n                const isScrap = this.mIsScrap;\n                for (i = startPosition; i <= endPosition; ++i) {\n                    child = this.obtainView(i, isScrap);\n                    this.measureScrapChild(child, i, widthMeasureSpec);\n                    if (i > 0) {\n                        returnedHeight += dividerHeight;\n                    }\n                    if (recyle && recycleBin.shouldRecycleViewType(child.getLayoutParams().viewType)) {\n                        recycleBin.addScrapView(child, -1);\n                    }\n                    returnedHeight += child.getMeasuredHeight();\n                    if (returnedHeight >= maxHeight) {\n                        return (disallowPartialChildPosition >= 0) &&\n                            (i > disallowPartialChildPosition) &&\n                            (prevHeightWithoutPartialChild > 0) &&\n                            (returnedHeight != maxHeight) ? prevHeightWithoutPartialChild : maxHeight;\n                    }\n                    if ((disallowPartialChildPosition >= 0) && (i >= disallowPartialChildPosition)) {\n                        prevHeightWithoutPartialChild = returnedHeight;\n                    }\n                }\n                return returnedHeight;\n            }\n            findMotionRow(y) {\n                let childCount = this.getChildCount();\n                if (childCount > 0) {\n                    if (!this.mStackFromBottom) {\n                        for (let i = 0; i < childCount; i++) {\n                            let v = this.getChildAt(i);\n                            if (y <= v.getBottom()) {\n                                return this.mFirstPosition + i;\n                            }\n                        }\n                    }\n                    else {\n                        for (let i = childCount - 1; i >= 0; i--) {\n                            let v = this.getChildAt(i);\n                            if (y >= v.getTop()) {\n                                return this.mFirstPosition + i;\n                            }\n                        }\n                    }\n                }\n                return ListView.INVALID_POSITION;\n            }\n            fillSpecific(position, top) {\n                let tempIsSelected = position == this.mSelectedPosition;\n                let temp = this.makeAndAddView(position, top, true, this.mListPadding.left, tempIsSelected);\n                this.mFirstPosition = position;\n                let above;\n                let below;\n                const dividerHeight = this.mDividerHeight;\n                if (!this.mStackFromBottom) {\n                    above = this.fillUp(position - 1, temp.getTop() - dividerHeight);\n                    this.adjustViewsUpOrDown();\n                    below = this.fillDown(position + 1, temp.getBottom() + dividerHeight);\n                    let childCount = this.getChildCount();\n                    if (childCount > 0) {\n                        this.correctTooHigh(childCount);\n                    }\n                }\n                else {\n                    below = this.fillDown(position + 1, temp.getBottom() + dividerHeight);\n                    this.adjustViewsUpOrDown();\n                    above = this.fillUp(position - 1, temp.getTop() - dividerHeight);\n                    let childCount = this.getChildCount();\n                    if (childCount > 0) {\n                        this.correctTooLow(childCount);\n                    }\n                }\n                if (tempIsSelected) {\n                    return temp;\n                }\n                else if (above != null) {\n                    return above;\n                }\n                else {\n                    return below;\n                }\n            }\n            correctTooHigh(childCount) {\n                let lastPosition = this.mFirstPosition + childCount - 1;\n                if (lastPosition == this.mItemCount - 1 && childCount > 0) {\n                    const lastChild = this.getChildAt(childCount - 1);\n                    const lastBottom = lastChild.getBottom();\n                    const end = (this.mBottom - this.mTop) - this.mListPadding.bottom;\n                    let bottomOffset = end - lastBottom;\n                    let firstChild = this.getChildAt(0);\n                    const firstTop = firstChild.getTop();\n                    if (bottomOffset > 0 && (this.mFirstPosition > 0 || firstTop < this.mListPadding.top)) {\n                        if (this.mFirstPosition == 0) {\n                            bottomOffset = Math.min(bottomOffset, this.mListPadding.top - firstTop);\n                        }\n                        this.offsetChildrenTopAndBottom(bottomOffset);\n                        if (this.mFirstPosition > 0) {\n                            this.fillUp(this.mFirstPosition - 1, firstChild.getTop() - this.mDividerHeight);\n                            this.adjustViewsUpOrDown();\n                        }\n                    }\n                }\n            }\n            correctTooLow(childCount) {\n                if (this.mFirstPosition == 0 && childCount > 0) {\n                    const firstChild = this.getChildAt(0);\n                    const firstTop = firstChild.getTop();\n                    const start = this.mListPadding.top;\n                    const end = (this.mBottom - this.mTop) - this.mListPadding.bottom;\n                    let topOffset = firstTop - start;\n                    let lastChild = this.getChildAt(childCount - 1);\n                    const lastBottom = lastChild.getBottom();\n                    let lastPosition = this.mFirstPosition + childCount - 1;\n                    if (topOffset > 0) {\n                        if (lastPosition < this.mItemCount - 1 || lastBottom > end) {\n                            if (lastPosition == this.mItemCount - 1) {\n                                topOffset = Math.min(topOffset, lastBottom - end);\n                            }\n                            this.offsetChildrenTopAndBottom(-topOffset);\n                            if (lastPosition < this.mItemCount - 1) {\n                                this.fillDown(lastPosition + 1, lastChild.getBottom() + this.mDividerHeight);\n                                this.adjustViewsUpOrDown();\n                            }\n                        }\n                        else if (lastPosition == this.mItemCount - 1) {\n                            this.adjustViewsUpOrDown();\n                        }\n                    }\n                }\n            }\n            layoutChildren() {\n                const blockLayoutRequests = this.mBlockLayoutRequests;\n                if (blockLayoutRequests) {\n                    return;\n                }\n                this.mBlockLayoutRequests = true;\n                try {\n                    super.layoutChildren();\n                    this.invalidate();\n                    if (this.mAdapter == null) {\n                        this.resetList();\n                        this.invokeOnItemScrollListener();\n                        return;\n                    }\n                    const childrenTop = this.mListPadding.top;\n                    const childrenBottom = this.mBottom - this.mTop - this.mListPadding.bottom;\n                    const childCount = this.getChildCount();\n                    let index = 0;\n                    let delta = 0;\n                    let sel;\n                    let oldSel = null;\n                    let oldFirst = null;\n                    let newSel = null;\n                    switch (this.mLayoutMode) {\n                        case ListView.LAYOUT_SET_SELECTION:\n                            index = this.mNextSelectedPosition - this.mFirstPosition;\n                            if (index >= 0 && index < childCount) {\n                                newSel = this.getChildAt(index);\n                            }\n                            break;\n                        case ListView.LAYOUT_FORCE_TOP:\n                        case ListView.LAYOUT_FORCE_BOTTOM:\n                        case ListView.LAYOUT_SPECIFIC:\n                        case ListView.LAYOUT_SYNC:\n                            break;\n                        case ListView.LAYOUT_MOVE_SELECTION:\n                        default:\n                            index = this.mSelectedPosition - this.mFirstPosition;\n                            if (index >= 0 && index < childCount) {\n                                oldSel = this.getChildAt(index);\n                            }\n                            oldFirst = this.getChildAt(0);\n                            if (this.mNextSelectedPosition >= 0) {\n                                delta = this.mNextSelectedPosition - this.mSelectedPosition;\n                            }\n                            newSel = this.getChildAt(index + delta);\n                    }\n                    let dataChanged = this.mDataChanged;\n                    if (dataChanged) {\n                        this.handleDataChanged();\n                    }\n                    if (this.mItemCount == 0) {\n                        this.resetList();\n                        this.invokeOnItemScrollListener();\n                        return;\n                    }\n                    else if (this.mItemCount != this.mAdapter.getCount()) {\n                        throw Error(`IllegalStateException(\"The content of the adapter has changed but\n                ListView did not receive a notification. Make sure the content of\n                your adapter is not modified from a background thread, but only from\n                the UI thread. Make sure your adapter calls notifyDataSetChanged()\n                when its content changes. [in ListView(${this.getId()},${this.constructor.name})\n                with Adapter(${this.mAdapter.constructor.name})]\")`);\n                    }\n                    this.setSelectedPositionInt(this.mNextSelectedPosition);\n                    const accessFocusedChild = null;\n                    const focusedChild = this.getFocusedChild();\n                    if (focusedChild != null) {\n                        focusedChild.setHasTransientState(true);\n                    }\n                    const firstPosition = this.mFirstPosition;\n                    const recycleBin = this.mRecycler;\n                    if (dataChanged) {\n                        for (let i = 0; i < childCount; i++) {\n                            recycleBin.addScrapView(this.getChildAt(i), firstPosition + i);\n                        }\n                    }\n                    else {\n                        recycleBin.fillActiveViews(childCount, firstPosition);\n                    }\n                    this.detachAllViewsFromParent();\n                    recycleBin.removeSkippedScrap();\n                    switch (this.mLayoutMode) {\n                        case ListView.LAYOUT_SET_SELECTION:\n                            if (newSel != null) {\n                                sel = this.fillFromSelection(newSel.getTop(), childrenTop, childrenBottom);\n                            }\n                            else {\n                                sel = this.fillFromMiddle(childrenTop, childrenBottom);\n                            }\n                            break;\n                        case ListView.LAYOUT_SYNC:\n                            sel = this.fillSpecific(this.mSyncPosition, this.mSpecificTop);\n                            break;\n                        case ListView.LAYOUT_FORCE_BOTTOM:\n                            sel = this.fillUp(this.mItemCount - 1, childrenBottom);\n                            this.adjustViewsUpOrDown();\n                            break;\n                        case ListView.LAYOUT_FORCE_TOP:\n                            this.mFirstPosition = 0;\n                            sel = this.fillFromTop(childrenTop);\n                            this.adjustViewsUpOrDown();\n                            break;\n                        case ListView.LAYOUT_SPECIFIC:\n                            sel = this.fillSpecific(this.reconcileSelectedPosition(), this.mSpecificTop);\n                            break;\n                        case ListView.LAYOUT_MOVE_SELECTION:\n                            sel = this.moveSelection(oldSel, newSel, delta, childrenTop, childrenBottom);\n                            break;\n                        default:\n                            if (childCount == 0) {\n                                if (!this.mStackFromBottom) {\n                                    const position = this.lookForSelectablePosition(0, true);\n                                    this.setSelectedPositionInt(position);\n                                    sel = this.fillFromTop(childrenTop);\n                                }\n                                else {\n                                    const position = this.lookForSelectablePosition(this.mItemCount - 1, false);\n                                    this.setSelectedPositionInt(position);\n                                    sel = this.fillUp(this.mItemCount - 1, childrenBottom);\n                                }\n                            }\n                            else {\n                                if (this.mSelectedPosition >= 0 && this.mSelectedPosition < this.mItemCount) {\n                                    sel = this.fillSpecific(this.mSelectedPosition, oldSel == null ? childrenTop : oldSel.getTop());\n                                }\n                                else if (this.mFirstPosition < this.mItemCount) {\n                                    sel = this.fillSpecific(this.mFirstPosition, oldFirst == null ? childrenTop : oldFirst.getTop());\n                                }\n                                else {\n                                    sel = this.fillSpecific(0, childrenTop);\n                                }\n                            }\n                            break;\n                    }\n                    recycleBin.scrapActiveViews();\n                    if (sel != null) {\n                        const shouldPlaceFocus = this.mItemsCanFocus && this.hasFocus();\n                        const maintainedFocus = focusedChild != null && focusedChild.hasFocus();\n                        if (shouldPlaceFocus && !maintainedFocus && !sel.hasFocus()) {\n                            if (sel.requestFocus()) {\n                                sel.setSelected(false);\n                                this.mSelectorRect.setEmpty();\n                            }\n                            else {\n                                const focused = this.getFocusedChild();\n                                if (focused != null) {\n                                    focused.clearFocus();\n                                }\n                                this.positionSelector(ListView.INVALID_POSITION, sel);\n                            }\n                        }\n                        else {\n                            this.positionSelector(ListView.INVALID_POSITION, sel);\n                        }\n                        this.mSelectedTop = sel.getTop();\n                    }\n                    else {\n                        if (this.mTouchMode == ListView.TOUCH_MODE_TAP || this.mTouchMode == ListView.TOUCH_MODE_DONE_WAITING) {\n                            const child = this.getChildAt(this.mMotionPosition - this.mFirstPosition);\n                            if (child != null) {\n                                this.positionSelector(this.mMotionPosition, child);\n                            }\n                        }\n                        else {\n                            this.mSelectedTop = 0;\n                            this.mSelectorRect.setEmpty();\n                        }\n                    }\n                    if (accessFocusedChild != null) {\n                        accessFocusedChild.setHasTransientState(false);\n                    }\n                    if (focusedChild != null) {\n                        focusedChild.setHasTransientState(false);\n                    }\n                    this.mLayoutMode = ListView.LAYOUT_NORMAL;\n                    this.mDataChanged = false;\n                    if (this.mPositionScrollAfterLayout != null) {\n                        this.post(this.mPositionScrollAfterLayout);\n                        this.mPositionScrollAfterLayout = null;\n                    }\n                    this.mNeedSync = false;\n                    this.setNextSelectedPositionInt(this.mSelectedPosition);\n                    this.updateScrollIndicators();\n                    if (this.mItemCount > 0) {\n                        this.checkSelectionChanged();\n                    }\n                    this.invokeOnItemScrollListener();\n                }\n                finally {\n                    if (!blockLayoutRequests) {\n                        this.mBlockLayoutRequests = false;\n                    }\n                }\n            }\n            makeAndAddView(position, y, flow, childrenLeft, selected) {\n                let child;\n                if (!this.mDataChanged) {\n                    child = this.mRecycler.getActiveView(position);\n                    if (child != null) {\n                        this.setupChild(child, position, y, flow, childrenLeft, selected, true);\n                        return child;\n                    }\n                }\n                child = this.obtainView(position, this.mIsScrap);\n                this.setupChild(child, position, y, flow, childrenLeft, selected, this.mIsScrap[0]);\n                return child;\n            }\n            setupChild(child, position, y, flowDown, childrenLeft, selected, recycled) {\n                Trace.traceBegin(Trace.TRACE_TAG_VIEW, \"setupListItem\");\n                const isSelected = selected && this.shouldShowSelector();\n                const updateChildSelected = isSelected != child.isSelected();\n                const mode = this.mTouchMode;\n                const isPressed = mode > ListView.TOUCH_MODE_DOWN && mode < ListView.TOUCH_MODE_SCROLL && this.mMotionPosition == position;\n                const updateChildPressed = isPressed != child.isPressed();\n                const needToMeasure = !recycled || updateChildSelected || child.isLayoutRequested();\n                let p = child.getLayoutParams();\n                if (p == null) {\n                    p = this.generateDefaultLayoutParams();\n                }\n                if (!(p instanceof AbsListView.LayoutParams)) {\n                    const name = p instanceof Function ? p.constructor.name : p + '';\n                    throw Error('ClassCaseException(' + name + ' can\\'t case to AbsListView.LayoutParams)');\n                }\n                p.viewType = this.mAdapter.getItemViewType(position);\n                if ((recycled && !p.forceAdd) || (p.recycledHeaderFooter && p.viewType == AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER)) {\n                    this.attachViewToParent(child, flowDown ? -1 : 0, p);\n                }\n                else {\n                    p.forceAdd = false;\n                    if (p.viewType == AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER) {\n                        p.recycledHeaderFooter = true;\n                    }\n                    this.addViewInLayout(child, flowDown ? -1 : 0, p, true);\n                }\n                if (updateChildSelected) {\n                    child.setSelected(isSelected);\n                }\n                if (updateChildPressed) {\n                    child.setPressed(isPressed);\n                }\n                if (this.mChoiceMode != ListView.CHOICE_MODE_NONE && this.mCheckStates != null) {\n                    if (child['setChecked']) {\n                        child.setChecked(this.mCheckStates.get(position));\n                    }\n                    else {\n                        child.setActivated(this.mCheckStates.get(position));\n                    }\n                }\n                if (needToMeasure) {\n                    let childWidthSpec = ViewGroup.getChildMeasureSpec(this.mWidthMeasureSpec, this.mListPadding.left + this.mListPadding.right, p.width);\n                    let lpHeight = p.height;\n                    let childHeightSpec;\n                    if (lpHeight > 0) {\n                        childHeightSpec = View.MeasureSpec.makeMeasureSpec(lpHeight, View.MeasureSpec.EXACTLY);\n                    }\n                    else {\n                        childHeightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n                    }\n                    child.measure(childWidthSpec, childHeightSpec);\n                }\n                else {\n                    this.cleanupLayoutState(child);\n                }\n                const w = child.getMeasuredWidth();\n                const h = child.getMeasuredHeight();\n                const childTop = flowDown ? y : y - h;\n                if (needToMeasure) {\n                    const childRight = childrenLeft + w;\n                    const childBottom = childTop + h;\n                    child.layout(childrenLeft, childTop, childRight, childBottom);\n                }\n                else {\n                    child.offsetLeftAndRight(childrenLeft - child.getLeft());\n                    child.offsetTopAndBottom(childTop - child.getTop());\n                }\n                if (this.mCachingStarted && !child.isDrawingCacheEnabled()) {\n                    child.setDrawingCacheEnabled(true);\n                }\n                if (recycled && (child.getLayoutParams().scrappedFromPosition) != position) {\n                    child.jumpDrawablesToCurrentState();\n                }\n                Trace.traceEnd(Trace.TRACE_TAG_VIEW);\n            }\n            canAnimate() {\n                return super.canAnimate() && this.mItemCount > 0;\n            }\n            setSelection(position) {\n                this.setSelectionFromTop(position, 0);\n            }\n            setSelectionFromTop(position, y) {\n                if (this.mAdapter == null) {\n                    return;\n                }\n                if (!this.isInTouchMode()) {\n                    position = this.lookForSelectablePosition(position, true);\n                    if (position >= 0) {\n                        this.setNextSelectedPositionInt(position);\n                    }\n                }\n                else {\n                    this.mResurrectToPosition = position;\n                }\n                if (position >= 0) {\n                    this.mLayoutMode = ListView.LAYOUT_SPECIFIC;\n                    this.mSpecificTop = this.mListPadding.top + y;\n                    if (this.mNeedSync) {\n                        this.mSyncPosition = position;\n                        this.mSyncRowId = this.mAdapter.getItemId(position);\n                    }\n                    if (this.mPositionScroller != null) {\n                        this.mPositionScroller.stop();\n                    }\n                    this.requestLayout();\n                }\n            }\n            setSelectionInt(position) {\n                this.setNextSelectedPositionInt(position);\n                let awakeScrollbars = false;\n                const selectedPosition = this.mSelectedPosition;\n                if (selectedPosition >= 0) {\n                    if (position == selectedPosition - 1) {\n                        awakeScrollbars = true;\n                    }\n                    else if (position == selectedPosition + 1) {\n                        awakeScrollbars = true;\n                    }\n                }\n                if (this.mPositionScroller != null) {\n                    this.mPositionScroller.stop();\n                }\n                this.layoutChildren();\n                if (awakeScrollbars) {\n                    this.awakenScrollBars();\n                }\n            }\n            lookForSelectablePosition(position, lookDown) {\n                const adapter = this.mAdapter;\n                if (adapter == null || this.isInTouchMode()) {\n                    return ListView.INVALID_POSITION;\n                }\n                const count = adapter.getCount();\n                if (!this.mAreAllItemsSelectable) {\n                    if (lookDown) {\n                        position = Math.max(0, position);\n                        while (position < count && !adapter.isEnabled(position)) {\n                            position++;\n                        }\n                    }\n                    else {\n                        position = Math.min(position, count - 1);\n                        while (position >= 0 && !adapter.isEnabled(position)) {\n                            position--;\n                        }\n                    }\n                }\n                if (position < 0 || position >= count) {\n                    return ListView.INVALID_POSITION;\n                }\n                return position;\n            }\n            lookForSelectablePositionAfter(current, position, lookDown) {\n                const adapter = this.mAdapter;\n                if (adapter == null || this.isInTouchMode()) {\n                    return ListView.INVALID_POSITION;\n                }\n                const after = this.lookForSelectablePosition(position, lookDown);\n                if (after != ListView.INVALID_POSITION) {\n                    return after;\n                }\n                const count = adapter.getCount();\n                current = MathUtils.constrain(current, -1, count - 1);\n                if (lookDown) {\n                    position = Math.min(position - 1, count - 1);\n                    while ((position > current) && !adapter.isEnabled(position)) {\n                        position--;\n                    }\n                    if (position <= current) {\n                        return ListView.INVALID_POSITION;\n                    }\n                }\n                else {\n                    position = Math.max(0, position + 1);\n                    while ((position < current) && !adapter.isEnabled(position)) {\n                        position++;\n                    }\n                    if (position >= current) {\n                        return ListView.INVALID_POSITION;\n                    }\n                }\n                return position;\n            }\n            setSelectionAfterHeaderView() {\n                const count = this.mHeaderViewInfos.size();\n                if (count > 0) {\n                    this.mNextSelectedPosition = 0;\n                    return;\n                }\n                if (this.mAdapter != null) {\n                    this.setSelection(count);\n                }\n                else {\n                    this.mNextSelectedPosition = count;\n                    this.mLayoutMode = ListView.LAYOUT_SET_SELECTION;\n                }\n            }\n            dispatchKeyEvent(event) {\n                let handled = super.dispatchKeyEvent(event);\n                if (!handled) {\n                    let focused = this.getFocusedChild();\n                    if (focused != null && event.getAction() == KeyEvent.ACTION_DOWN) {\n                        handled = this.onKeyDown(event.getKeyCode(), event);\n                    }\n                }\n                return handled;\n            }\n            onKeyDown(keyCode, event) {\n                return this.commonKey(keyCode, 1, event);\n            }\n            onKeyMultiple(keyCode, repeatCount, event) {\n                return this.commonKey(keyCode, repeatCount, event);\n            }\n            onKeyUp(keyCode, event) {\n                return this.commonKey(keyCode, 1, event);\n            }\n            commonKey(keyCode, count, event) {\n                if (this.mAdapter == null || !this.isAttachedToWindow()) {\n                    return false;\n                }\n                if (this.mDataChanged) {\n                    this.layoutChildren();\n                }\n                let handled = false;\n                let action = event.getAction();\n                if (action != KeyEvent.ACTION_UP) {\n                    switch (keyCode) {\n                        case KeyEvent.KEYCODE_DPAD_UP:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded();\n                                if (!handled) {\n                                    while (count-- > 0) {\n                                        if (this.arrowScroll(ListView.FOCUS_UP)) {\n                                            handled = true;\n                                        }\n                                        else {\n                                            break;\n                                        }\n                                    }\n                                }\n                            }\n                            else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {\n                                handled = this.resurrectSelectionIfNeeded() || this.fullScroll(ListView.FOCUS_UP);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_DPAD_DOWN:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded();\n                                if (!handled) {\n                                    while (count-- > 0) {\n                                        if (this.arrowScroll(ListView.FOCUS_DOWN)) {\n                                            handled = true;\n                                        }\n                                        else {\n                                            break;\n                                        }\n                                    }\n                                }\n                            }\n                            else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {\n                                handled = this.resurrectSelectionIfNeeded() || this.fullScroll(ListView.FOCUS_DOWN);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_DPAD_LEFT:\n                            if (event.hasNoModifiers()) {\n                                handled = this.handleHorizontalFocusWithinListItem(View.FOCUS_LEFT);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_DPAD_RIGHT:\n                            if (event.hasNoModifiers()) {\n                                handled = this.handleHorizontalFocusWithinListItem(View.FOCUS_RIGHT);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_DPAD_CENTER:\n                        case KeyEvent.KEYCODE_ENTER:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded();\n                                if (!handled && event.getRepeatCount() == 0 && this.getChildCount() > 0) {\n                                    this.keyPressed();\n                                    handled = true;\n                                }\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_SPACE:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded() || this.pageScroll(ListView.FOCUS_DOWN);\n                            }\n                            else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) {\n                                handled = this.resurrectSelectionIfNeeded() || this.pageScroll(ListView.FOCUS_UP);\n                            }\n                            handled = true;\n                            break;\n                        case KeyEvent.KEYCODE_PAGE_UP:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded() || this.pageScroll(ListView.FOCUS_UP);\n                            }\n                            else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {\n                                handled = this.resurrectSelectionIfNeeded() || this.fullScroll(ListView.FOCUS_UP);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_PAGE_DOWN:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded() || this.pageScroll(ListView.FOCUS_DOWN);\n                            }\n                            else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {\n                                handled = this.resurrectSelectionIfNeeded() || this.fullScroll(ListView.FOCUS_DOWN);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_MOVE_HOME:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded() || this.fullScroll(ListView.FOCUS_UP);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_MOVE_END:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded() || this.fullScroll(ListView.FOCUS_DOWN);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_TAB:\n                            break;\n                    }\n                }\n                if (handled) {\n                    return true;\n                }\n                switch (action) {\n                    case KeyEvent.ACTION_DOWN:\n                        return super.onKeyDown(keyCode, event);\n                    case KeyEvent.ACTION_UP:\n                        return super.onKeyUp(keyCode, event);\n                    default:\n                        return false;\n                }\n            }\n            pageScroll(direction) {\n                let nextPage;\n                let down;\n                if (direction == ListView.FOCUS_UP) {\n                    nextPage = Math.max(0, this.mSelectedPosition - this.getChildCount() - 1);\n                    down = false;\n                }\n                else if (direction == ListView.FOCUS_DOWN) {\n                    nextPage = Math.min(this.mItemCount - 1, this.mSelectedPosition + this.getChildCount() - 1);\n                    down = true;\n                }\n                else {\n                    return false;\n                }\n                if (nextPage >= 0) {\n                    const position = this.lookForSelectablePositionAfter(this.mSelectedPosition, nextPage, down);\n                    if (position >= 0) {\n                        this.mLayoutMode = ListView.LAYOUT_SPECIFIC;\n                        this.mSpecificTop = this.mPaddingTop + this.getVerticalFadingEdgeLength();\n                        if (down && (position > (this.mItemCount - this.getChildCount()))) {\n                            this.mLayoutMode = ListView.LAYOUT_FORCE_BOTTOM;\n                        }\n                        if (!down && (position < this.getChildCount())) {\n                            this.mLayoutMode = ListView.LAYOUT_FORCE_TOP;\n                        }\n                        this.setSelectionInt(position);\n                        this.invokeOnItemScrollListener();\n                        if (!this.awakenScrollBars()) {\n                            this.invalidate();\n                        }\n                        return true;\n                    }\n                }\n                return false;\n            }\n            fullScroll(direction) {\n                let moved = false;\n                if (direction == ListView.FOCUS_UP) {\n                    if (this.mSelectedPosition != 0) {\n                        const position = this.lookForSelectablePositionAfter(this.mSelectedPosition, 0, true);\n                        if (position >= 0) {\n                            this.mLayoutMode = ListView.LAYOUT_FORCE_TOP;\n                            this.setSelectionInt(position);\n                            this.invokeOnItemScrollListener();\n                        }\n                        moved = true;\n                    }\n                }\n                else if (direction == ListView.FOCUS_DOWN) {\n                    const lastItem = (this.mItemCount - 1);\n                    if (this.mSelectedPosition < lastItem) {\n                        const position = this.lookForSelectablePositionAfter(this.mSelectedPosition, lastItem, false);\n                        if (position >= 0) {\n                            this.mLayoutMode = ListView.LAYOUT_FORCE_BOTTOM;\n                            this.setSelectionInt(position);\n                            this.invokeOnItemScrollListener();\n                        }\n                        moved = true;\n                    }\n                }\n                if (moved && !this.awakenScrollBars()) {\n                    this.awakenScrollBars();\n                    this.invalidate();\n                }\n                return moved;\n            }\n            handleHorizontalFocusWithinListItem(direction) {\n                if (direction != View.FOCUS_LEFT && direction != View.FOCUS_RIGHT) {\n                    throw Error(`new IllegalArgumentException(\"direction must be one of\" + \" {View.FOCUS_LEFT, View.FOCUS_RIGHT}\")`);\n                }\n                const numChildren = this.getChildCount();\n                if (this.mItemsCanFocus && numChildren > 0 && this.mSelectedPosition != ListView.INVALID_POSITION) {\n                    const selectedView = this.getSelectedView();\n                    if (selectedView != null && selectedView.hasFocus() && selectedView instanceof ViewGroup) {\n                        const currentFocus = selectedView.findFocus();\n                        const nextFocus = FocusFinder.getInstance().findNextFocus(selectedView, currentFocus, direction);\n                        if (nextFocus != null) {\n                            currentFocus.getFocusedRect(this.mTempRect);\n                            this.offsetDescendantRectToMyCoords(currentFocus, this.mTempRect);\n                            this.offsetRectIntoDescendantCoords(nextFocus, this.mTempRect);\n                            if (nextFocus.requestFocus(direction, this.mTempRect)) {\n                                return true;\n                            }\n                        }\n                        const globalNextFocus = FocusFinder.getInstance().findNextFocus(this.getRootView(), currentFocus, direction);\n                        if (globalNextFocus != null) {\n                            return this.isViewAncestorOf(globalNextFocus, this);\n                        }\n                    }\n                }\n                return false;\n            }\n            arrowScroll(direction) {\n                try {\n                    this.mInLayout = true;\n                    const handled = this.arrowScrollImpl(direction);\n                    if (handled) {\n                        this.playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));\n                    }\n                    return handled;\n                }\n                finally {\n                    this.mInLayout = false;\n                }\n            }\n            nextSelectedPositionForDirection(selectedView, selectedPos, direction) {\n                let nextSelected;\n                if (direction == View.FOCUS_DOWN) {\n                    const listBottom = this.getHeight() - this.mListPadding.bottom;\n                    if (selectedView != null && selectedView.getBottom() <= listBottom) {\n                        nextSelected = selectedPos != ListView.INVALID_POSITION && selectedPos >= this.mFirstPosition ? selectedPos + 1 : this.mFirstPosition;\n                    }\n                    else {\n                        return ListView.INVALID_POSITION;\n                    }\n                }\n                else {\n                    const listTop = this.mListPadding.top;\n                    if (selectedView != null && selectedView.getTop() >= listTop) {\n                        const lastPos = this.mFirstPosition + this.getChildCount() - 1;\n                        nextSelected = selectedPos != ListView.INVALID_POSITION && selectedPos <= lastPos ? selectedPos - 1 : lastPos;\n                    }\n                    else {\n                        return ListView.INVALID_POSITION;\n                    }\n                }\n                if (nextSelected < 0 || nextSelected >= this.mAdapter.getCount()) {\n                    return ListView.INVALID_POSITION;\n                }\n                return this.lookForSelectablePosition(nextSelected, direction == View.FOCUS_DOWN);\n            }\n            arrowScrollImpl(direction) {\n                if (this.getChildCount() <= 0) {\n                    return false;\n                }\n                let selectedView = this.getSelectedView();\n                let selectedPos = this.mSelectedPosition;\n                let nextSelectedPosition = this.nextSelectedPositionForDirection(selectedView, selectedPos, direction);\n                let amountToScroll = this.amountToScroll(direction, nextSelectedPosition);\n                const focusResult = this.mItemsCanFocus ? this.arrowScrollFocused(direction) : null;\n                if (focusResult != null) {\n                    nextSelectedPosition = focusResult.getSelectedPosition();\n                    amountToScroll = focusResult.getAmountToScroll();\n                }\n                let needToRedraw = focusResult != null;\n                if (nextSelectedPosition != ListView.INVALID_POSITION) {\n                    this.handleNewSelectionChange(selectedView, direction, nextSelectedPosition, focusResult != null);\n                    this.setSelectedPositionInt(nextSelectedPosition);\n                    this.setNextSelectedPositionInt(nextSelectedPosition);\n                    selectedView = this.getSelectedView();\n                    selectedPos = nextSelectedPosition;\n                    if (this.mItemsCanFocus && focusResult == null) {\n                        const focused = this.getFocusedChild();\n                        if (focused != null) {\n                            focused.clearFocus();\n                        }\n                    }\n                    needToRedraw = true;\n                    this.checkSelectionChanged();\n                }\n                if (amountToScroll > 0) {\n                    this.scrollListItemsBy((direction == View.FOCUS_UP) ? amountToScroll : -amountToScroll);\n                    needToRedraw = true;\n                }\n                if (this.mItemsCanFocus && (focusResult == null) && selectedView != null && selectedView.hasFocus()) {\n                    const focused = selectedView.findFocus();\n                    if (!this.isViewAncestorOf(focused, this) || this.distanceToView(focused) > 0) {\n                        focused.clearFocus();\n                    }\n                }\n                if (nextSelectedPosition == ListView.INVALID_POSITION && selectedView != null && !this.isViewAncestorOf(selectedView, this)) {\n                    selectedView = null;\n                    this.hideSelector();\n                    this.mResurrectToPosition = ListView.INVALID_POSITION;\n                }\n                if (needToRedraw) {\n                    if (selectedView != null) {\n                        this.positionSelector(selectedPos, selectedView);\n                        this.mSelectedTop = selectedView.getTop();\n                    }\n                    if (!this.awakenScrollBars()) {\n                        this.invalidate();\n                    }\n                    this.invokeOnItemScrollListener();\n                    return true;\n                }\n                return false;\n            }\n            handleNewSelectionChange(selectedView, direction, newSelectedPosition, newFocusAssigned) {\n                if (newSelectedPosition == ListView.INVALID_POSITION) {\n                    throw Error(`new IllegalArgumentException(\"newSelectedPosition needs to be valid\")`);\n                }\n                let topView;\n                let bottomView;\n                let topViewIndex, bottomViewIndex;\n                let topSelected = false;\n                const selectedIndex = this.mSelectedPosition - this.mFirstPosition;\n                const nextSelectedIndex = newSelectedPosition - this.mFirstPosition;\n                if (direction == View.FOCUS_UP) {\n                    topViewIndex = nextSelectedIndex;\n                    bottomViewIndex = selectedIndex;\n                    topView = this.getChildAt(topViewIndex);\n                    bottomView = selectedView;\n                    topSelected = true;\n                }\n                else {\n                    topViewIndex = selectedIndex;\n                    bottomViewIndex = nextSelectedIndex;\n                    topView = selectedView;\n                    bottomView = this.getChildAt(bottomViewIndex);\n                }\n                const numChildren = this.getChildCount();\n                if (topView != null) {\n                    topView.setSelected(!newFocusAssigned && topSelected);\n                    this.measureAndAdjustDown(topView, topViewIndex, numChildren);\n                }\n                if (bottomView != null) {\n                    bottomView.setSelected(!newFocusAssigned && !topSelected);\n                    this.measureAndAdjustDown(bottomView, bottomViewIndex, numChildren);\n                }\n            }\n            measureAndAdjustDown(child, childIndex, numChildren) {\n                let oldHeight = child.getHeight();\n                this.measureItem(child);\n                if (child.getMeasuredHeight() != oldHeight) {\n                    this.relayoutMeasuredItem(child);\n                    const heightDelta = child.getMeasuredHeight() - oldHeight;\n                    for (let i = childIndex + 1; i < numChildren; i++) {\n                        this.getChildAt(i).offsetTopAndBottom(heightDelta);\n                    }\n                }\n            }\n            measureItem(child) {\n                let p = child.getLayoutParams();\n                if (p == null) {\n                    p = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);\n                }\n                let childWidthSpec = ViewGroup.getChildMeasureSpec(this.mWidthMeasureSpec, this.mListPadding.left + this.mListPadding.right, p.width);\n                let lpHeight = p.height;\n                let childHeightSpec;\n                if (lpHeight > 0) {\n                    childHeightSpec = View.MeasureSpec.makeMeasureSpec(lpHeight, View.MeasureSpec.EXACTLY);\n                }\n                else {\n                    childHeightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n                }\n                child.measure(childWidthSpec, childHeightSpec);\n            }\n            relayoutMeasuredItem(child) {\n                const w = child.getMeasuredWidth();\n                const h = child.getMeasuredHeight();\n                const childLeft = this.mListPadding.left;\n                const childRight = childLeft + w;\n                const childTop = child.getTop();\n                const childBottom = childTop + h;\n                child.layout(childLeft, childTop, childRight, childBottom);\n            }\n            getArrowScrollPreviewLength() {\n                return Math.max(ListView.MIN_SCROLL_PREVIEW_PIXELS, this.getVerticalFadingEdgeLength());\n            }\n            amountToScroll(direction, nextSelectedPosition) {\n                const listBottom = this.getHeight() - this.mListPadding.bottom;\n                const listTop = this.mListPadding.top;\n                let numChildren = this.getChildCount();\n                if (direction == View.FOCUS_DOWN) {\n                    let indexToMakeVisible = numChildren - 1;\n                    if (nextSelectedPosition != ListView.INVALID_POSITION) {\n                        indexToMakeVisible = nextSelectedPosition - this.mFirstPosition;\n                    }\n                    while (numChildren <= indexToMakeVisible) {\n                        this.addViewBelow(this.getChildAt(numChildren - 1), this.mFirstPosition + numChildren - 1);\n                        numChildren++;\n                    }\n                    const positionToMakeVisible = this.mFirstPosition + indexToMakeVisible;\n                    const viewToMakeVisible = this.getChildAt(indexToMakeVisible);\n                    let goalBottom = listBottom;\n                    if (positionToMakeVisible < this.mItemCount - 1) {\n                        goalBottom -= this.getArrowScrollPreviewLength();\n                    }\n                    if (viewToMakeVisible.getBottom() <= goalBottom) {\n                        return 0;\n                    }\n                    if (nextSelectedPosition != ListView.INVALID_POSITION && (goalBottom - viewToMakeVisible.getTop()) >= this.getMaxScrollAmount()) {\n                        return 0;\n                    }\n                    let amountToScroll = (viewToMakeVisible.getBottom() - goalBottom);\n                    if ((this.mFirstPosition + numChildren) == this.mItemCount) {\n                        const max = this.getChildAt(numChildren - 1).getBottom() - listBottom;\n                        amountToScroll = Math.min(amountToScroll, max);\n                    }\n                    return Math.min(amountToScroll, this.getMaxScrollAmount());\n                }\n                else {\n                    let indexToMakeVisible = 0;\n                    if (nextSelectedPosition != ListView.INVALID_POSITION) {\n                        indexToMakeVisible = nextSelectedPosition - this.mFirstPosition;\n                    }\n                    while (indexToMakeVisible < 0) {\n                        this.addViewAbove(this.getChildAt(0), this.mFirstPosition);\n                        this.mFirstPosition--;\n                        indexToMakeVisible = nextSelectedPosition - this.mFirstPosition;\n                    }\n                    const positionToMakeVisible = this.mFirstPosition + indexToMakeVisible;\n                    const viewToMakeVisible = this.getChildAt(indexToMakeVisible);\n                    let goalTop = listTop;\n                    if (positionToMakeVisible > 0) {\n                        goalTop += this.getArrowScrollPreviewLength();\n                    }\n                    if (viewToMakeVisible.getTop() >= goalTop) {\n                        return 0;\n                    }\n                    if (nextSelectedPosition != ListView.INVALID_POSITION && (viewToMakeVisible.getBottom() - goalTop) >= this.getMaxScrollAmount()) {\n                        return 0;\n                    }\n                    let amountToScroll = (goalTop - viewToMakeVisible.getTop());\n                    if (this.mFirstPosition == 0) {\n                        const max = listTop - this.getChildAt(0).getTop();\n                        amountToScroll = Math.min(amountToScroll, max);\n                    }\n                    return Math.min(amountToScroll, this.getMaxScrollAmount());\n                }\n            }\n            lookForSelectablePositionOnScreen(direction) {\n                const firstPosition = this.mFirstPosition;\n                if (direction == View.FOCUS_DOWN) {\n                    let startPos = (this.mSelectedPosition != ListView.INVALID_POSITION) ? this.mSelectedPosition + 1 : firstPosition;\n                    if (startPos >= this.mAdapter.getCount()) {\n                        return ListView.INVALID_POSITION;\n                    }\n                    if (startPos < firstPosition) {\n                        startPos = firstPosition;\n                    }\n                    const lastVisiblePos = this.getLastVisiblePosition();\n                    const adapter = this.getAdapter();\n                    for (let pos = startPos; pos <= lastVisiblePos; pos++) {\n                        if (adapter.isEnabled(pos) && this.getChildAt(pos - firstPosition).getVisibility() == View.VISIBLE) {\n                            return pos;\n                        }\n                    }\n                }\n                else {\n                    let last = firstPosition + this.getChildCount() - 1;\n                    let startPos = (this.mSelectedPosition != ListView.INVALID_POSITION) ? this.mSelectedPosition - 1 : firstPosition + this.getChildCount() - 1;\n                    if (startPos < 0 || startPos >= this.mAdapter.getCount()) {\n                        return ListView.INVALID_POSITION;\n                    }\n                    if (startPos > last) {\n                        startPos = last;\n                    }\n                    const adapter = this.getAdapter();\n                    for (let pos = startPos; pos >= firstPosition; pos--) {\n                        if (adapter.isEnabled(pos) && this.getChildAt(pos - firstPosition).getVisibility() == View.VISIBLE) {\n                            return pos;\n                        }\n                    }\n                }\n                return ListView.INVALID_POSITION;\n            }\n            arrowScrollFocused(direction) {\n                const selectedView = this.getSelectedView();\n                let newFocus;\n                if (selectedView != null && selectedView.hasFocus()) {\n                    let oldFocus = selectedView.findFocus();\n                    newFocus = FocusFinder.getInstance().findNextFocus(this, oldFocus, direction);\n                }\n                else {\n                    if (direction == View.FOCUS_DOWN) {\n                        const topFadingEdgeShowing = (this.mFirstPosition > 0);\n                        const listTop = this.mListPadding.top + (topFadingEdgeShowing ? this.getArrowScrollPreviewLength() : 0);\n                        const ySearchPoint = (selectedView != null && selectedView.getTop() > listTop) ? selectedView.getTop() : listTop;\n                        this.mTempRect.set(0, ySearchPoint, 0, ySearchPoint);\n                    }\n                    else {\n                        const bottomFadingEdgeShowing = (this.mFirstPosition + this.getChildCount() - 1) < this.mItemCount;\n                        const listBottom = this.getHeight() - this.mListPadding.bottom - (bottomFadingEdgeShowing ? this.getArrowScrollPreviewLength() : 0);\n                        const ySearchPoint = (selectedView != null && selectedView.getBottom() < listBottom) ? selectedView.getBottom() : listBottom;\n                        this.mTempRect.set(0, ySearchPoint, 0, ySearchPoint);\n                    }\n                    newFocus = FocusFinder.getInstance().findNextFocusFromRect(this, this.mTempRect, direction);\n                }\n                if (newFocus != null) {\n                    const positionOfNewFocus = this.positionOfNewFocus(newFocus);\n                    if (this.mSelectedPosition != ListView.INVALID_POSITION && positionOfNewFocus != this.mSelectedPosition) {\n                        const selectablePosition = this.lookForSelectablePositionOnScreen(direction);\n                        if (selectablePosition != ListView.INVALID_POSITION && ((direction == View.FOCUS_DOWN && selectablePosition < positionOfNewFocus) || (direction == View.FOCUS_UP && selectablePosition > positionOfNewFocus))) {\n                            return null;\n                        }\n                    }\n                    let focusScroll = this.amountToScrollToNewFocus(direction, newFocus, positionOfNewFocus);\n                    const maxScrollAmount = this.getMaxScrollAmount();\n                    if (focusScroll < maxScrollAmount) {\n                        newFocus.requestFocus(direction);\n                        this.mArrowScrollFocusResult.populate(positionOfNewFocus, focusScroll);\n                        return this.mArrowScrollFocusResult;\n                    }\n                    else if (this.distanceToView(newFocus) < maxScrollAmount) {\n                        newFocus.requestFocus(direction);\n                        this.mArrowScrollFocusResult.populate(positionOfNewFocus, maxScrollAmount);\n                        return this.mArrowScrollFocusResult;\n                    }\n                }\n                return null;\n            }\n            positionOfNewFocus(newFocus) {\n                const numChildren = this.getChildCount();\n                for (let i = 0; i < numChildren; i++) {\n                    const child = this.getChildAt(i);\n                    if (this.isViewAncestorOf(newFocus, child)) {\n                        return this.mFirstPosition + i;\n                    }\n                }\n                throw Error(`new IllegalArgumentException(\"newFocus is not a child of any of the\" + \" children of the list!\")`);\n            }\n            isViewAncestorOf(child, parent) {\n                if (child == parent) {\n                    return true;\n                }\n                const theParent = child.getParent();\n                return (theParent instanceof ViewGroup) && this.isViewAncestorOf(theParent, parent);\n            }\n            amountToScrollToNewFocus(direction, newFocus, positionOfNewFocus) {\n                let amountToScroll = 0;\n                newFocus.getDrawingRect(this.mTempRect);\n                this.offsetDescendantRectToMyCoords(newFocus, this.mTempRect);\n                if (direction == View.FOCUS_UP) {\n                    if (this.mTempRect.top < this.mListPadding.top) {\n                        amountToScroll = this.mListPadding.top - this.mTempRect.top;\n                        if (positionOfNewFocus > 0) {\n                            amountToScroll += this.getArrowScrollPreviewLength();\n                        }\n                    }\n                }\n                else {\n                    const listBottom = this.getHeight() - this.mListPadding.bottom;\n                    if (this.mTempRect.bottom > listBottom) {\n                        amountToScroll = this.mTempRect.bottom - listBottom;\n                        if (positionOfNewFocus < this.mItemCount - 1) {\n                            amountToScroll += this.getArrowScrollPreviewLength();\n                        }\n                    }\n                }\n                return amountToScroll;\n            }\n            distanceToView(descendant) {\n                let distance = 0;\n                descendant.getDrawingRect(this.mTempRect);\n                this.offsetDescendantRectToMyCoords(descendant, this.mTempRect);\n                const listBottom = this.mBottom - this.mTop - this.mListPadding.bottom;\n                if (this.mTempRect.bottom < this.mListPadding.top) {\n                    distance = this.mListPadding.top - this.mTempRect.bottom;\n                }\n                else if (this.mTempRect.top > listBottom) {\n                    distance = this.mTempRect.top - listBottom;\n                }\n                return distance;\n            }\n            scrollListItemsBy(amount) {\n                this.offsetChildrenTopAndBottom(amount);\n                const listBottom = this.getHeight() - this.mListPadding.bottom;\n                const listTop = this.mListPadding.top;\n                const recycleBin = this.mRecycler;\n                if (amount < 0) {\n                    let numChildren = this.getChildCount();\n                    let last = this.getChildAt(numChildren - 1);\n                    while (last.getBottom() < listBottom) {\n                        const lastVisiblePosition = this.mFirstPosition + numChildren - 1;\n                        if (lastVisiblePosition < this.mItemCount - 1) {\n                            last = this.addViewBelow(last, lastVisiblePosition);\n                            numChildren++;\n                        }\n                        else {\n                            break;\n                        }\n                    }\n                    if (last.getBottom() < listBottom) {\n                        this.offsetChildrenTopAndBottom(listBottom - last.getBottom());\n                    }\n                    let first = this.getChildAt(0);\n                    while (first.getBottom() < listTop) {\n                        let layoutParams = first.getLayoutParams();\n                        if (recycleBin.shouldRecycleViewType(layoutParams.viewType)) {\n                            recycleBin.addScrapView(first, this.mFirstPosition);\n                        }\n                        this.detachViewFromParent(first);\n                        first = this.getChildAt(0);\n                        this.mFirstPosition++;\n                    }\n                }\n                else {\n                    let first = this.getChildAt(0);\n                    while ((first.getTop() > listTop) && (this.mFirstPosition > 0)) {\n                        first = this.addViewAbove(first, this.mFirstPosition);\n                        this.mFirstPosition--;\n                    }\n                    if (first.getTop() > listTop) {\n                        this.offsetChildrenTopAndBottom(listTop - first.getTop());\n                    }\n                    let lastIndex = this.getChildCount() - 1;\n                    let last = this.getChildAt(lastIndex);\n                    while (last.getTop() > listBottom) {\n                        let layoutParams = last.getLayoutParams();\n                        if (recycleBin.shouldRecycleViewType(layoutParams.viewType)) {\n                            recycleBin.addScrapView(last, this.mFirstPosition + lastIndex);\n                        }\n                        this.detachViewFromParent(last);\n                        last = this.getChildAt(--lastIndex);\n                    }\n                }\n            }\n            addViewAbove(theView, position) {\n                let abovePosition = position - 1;\n                let view = this.obtainView(abovePosition, this.mIsScrap);\n                let edgeOfNewChild = theView.getTop() - this.mDividerHeight;\n                this.setupChild(view, abovePosition, edgeOfNewChild, false, this.mListPadding.left, false, this.mIsScrap[0]);\n                return view;\n            }\n            addViewBelow(theView, position) {\n                let belowPosition = position + 1;\n                let view = this.obtainView(belowPosition, this.mIsScrap);\n                let edgeOfNewChild = theView.getBottom() + this.mDividerHeight;\n                this.setupChild(view, belowPosition, edgeOfNewChild, true, this.mListPadding.left, false, this.mIsScrap[0]);\n                return view;\n            }\n            setItemsCanFocus(itemsCanFocus) {\n                this.mItemsCanFocus = itemsCanFocus;\n                if (!itemsCanFocus) {\n                    this.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);\n                }\n            }\n            getItemsCanFocus() {\n                return this.mItemsCanFocus;\n            }\n            isOpaque() {\n                let retValue = (this.mCachingActive && this.mIsCacheColorOpaque && this.mDividerIsOpaque && this.hasOpaqueScrollbars()) || super.isOpaque();\n                if (retValue) {\n                    const listTop = this.mListPadding != null ? this.mListPadding.top : this.mPaddingTop;\n                    let first = this.getChildAt(0);\n                    if (first == null || first.getTop() > listTop) {\n                        return false;\n                    }\n                    const listBottom = this.getHeight() - (this.mListPadding != null ? this.mListPadding.bottom : this.mPaddingBottom);\n                    let last = this.getChildAt(this.getChildCount() - 1);\n                    if (last == null || last.getBottom() < listBottom) {\n                        return false;\n                    }\n                }\n                return retValue;\n            }\n            setCacheColorHint(color) {\n                const opaque = (color >>> 24) == 0xFF;\n                this.mIsCacheColorOpaque = opaque;\n                if (opaque) {\n                    if (this.mDividerPaint == null) {\n                        this.mDividerPaint = new Paint();\n                    }\n                    this.mDividerPaint.setColor(color);\n                }\n                super.setCacheColorHint(color);\n            }\n            drawOverscrollHeader(canvas, drawable, bounds) {\n                const height = drawable.getMinimumHeight();\n                canvas.save();\n                canvas.clipRect(bounds);\n                const span = bounds.bottom - bounds.top;\n                if (span < height) {\n                    bounds.top = bounds.bottom - height;\n                }\n                drawable.setBounds(bounds);\n                drawable.draw(canvas);\n                canvas.restore();\n            }\n            drawOverscrollFooter(canvas, drawable, bounds) {\n                const height = drawable.getMinimumHeight();\n                canvas.save();\n                canvas.clipRect(bounds);\n                const span = bounds.bottom - bounds.top;\n                if (span < height) {\n                    bounds.bottom = bounds.top + height;\n                }\n                drawable.setBounds(bounds);\n                drawable.draw(canvas);\n                canvas.restore();\n            }\n            dispatchDraw(canvas) {\n                if (this.mCachingStarted) {\n                    this.mCachingActive = true;\n                }\n                const dividerHeight = this.mDividerHeight;\n                const overscrollHeader = this.mOverScrollHeader;\n                const overscrollFooter = this.mOverScrollFooter;\n                const drawOverscrollHeader = overscrollHeader != null;\n                const drawOverscrollFooter = overscrollFooter != null;\n                const drawDividers = dividerHeight > 0 && this.mDivider != null;\n                if (drawDividers || drawOverscrollHeader || drawOverscrollFooter) {\n                    const bounds = this.mTempRect;\n                    bounds.left = this.mPaddingLeft;\n                    bounds.right = this.mRight - this.mLeft - this.mPaddingRight;\n                    const count = this.getChildCount();\n                    const headerCount = this.mHeaderViewInfos.size();\n                    const itemCount = this.mItemCount;\n                    const footerLimit = (itemCount - this.mFooterViewInfos.size());\n                    const headerDividers = this.mHeaderDividersEnabled;\n                    const footerDividers = this.mFooterDividersEnabled;\n                    const first = this.mFirstPosition;\n                    const areAllItemsSelectable = this.mAreAllItemsSelectable;\n                    const adapter = this.mAdapter;\n                    const fillForMissingDividers = this.isOpaque() && !super.isOpaque();\n                    if (fillForMissingDividers && this.mDividerPaint == null && this.mIsCacheColorOpaque) {\n                        this.mDividerPaint = new Paint();\n                        this.mDividerPaint.setColor(this.getCacheColorHint());\n                    }\n                    const paint = this.mDividerPaint;\n                    let effectivePaddingTop = 0;\n                    let effectivePaddingBottom = 0;\n                    if ((this.mGroupFlags & ListView.CLIP_TO_PADDING_MASK) == ListView.CLIP_TO_PADDING_MASK) {\n                        effectivePaddingTop = this.mListPadding.top;\n                        effectivePaddingBottom = this.mListPadding.bottom;\n                    }\n                    const listBottom = this.mBottom - this.mTop - effectivePaddingBottom + this.mScrollY;\n                    if (!this.mStackFromBottom) {\n                        let bottom = 0;\n                        const scrollY = this.mScrollY;\n                        if (count > 0 && scrollY < 0) {\n                            if (drawOverscrollHeader) {\n                                bounds.bottom = 0;\n                                bounds.top = scrollY;\n                                this.drawOverscrollHeader(canvas, overscrollHeader, bounds);\n                            }\n                            else if (drawDividers) {\n                                bounds.bottom = 0;\n                                bounds.top = -dividerHeight;\n                                this.drawDivider(canvas, bounds, -1);\n                            }\n                        }\n                        for (let i = 0; i < count; i++) {\n                            const itemIndex = (first + i);\n                            const isHeader = (itemIndex < headerCount);\n                            const isFooter = (itemIndex >= footerLimit);\n                            if ((headerDividers || !isHeader) && (footerDividers || !isFooter)) {\n                                const child = this.getChildAt(i);\n                                bottom = child.getBottom();\n                                const isLastItem = (i == (count - 1));\n                                if (drawDividers && (bottom < listBottom) && !(drawOverscrollFooter && isLastItem)) {\n                                    const nextIndex = (itemIndex + 1);\n                                    if (areAllItemsSelectable || ((adapter.isEnabled(itemIndex) || (headerDividers && isHeader) || (footerDividers && isFooter)) && (isLastItem || adapter.isEnabled(nextIndex) || (headerDividers && (nextIndex < headerCount)) || (footerDividers && (nextIndex >= footerLimit))))) {\n                                        bounds.top = bottom;\n                                        bounds.bottom = bottom + dividerHeight;\n                                        this.drawDivider(canvas, bounds, i);\n                                    }\n                                    else if (fillForMissingDividers) {\n                                        bounds.top = bottom;\n                                        bounds.bottom = bottom + dividerHeight;\n                                        canvas.drawRect(bounds, paint);\n                                    }\n                                }\n                            }\n                        }\n                        const overFooterBottom = this.mBottom + this.mScrollY;\n                        if (drawOverscrollFooter && first + count == itemCount && overFooterBottom > bottom) {\n                            bounds.top = bottom;\n                            bounds.bottom = overFooterBottom;\n                            this.drawOverscrollFooter(canvas, overscrollFooter, bounds);\n                        }\n                    }\n                    else {\n                        let top;\n                        const scrollY = this.mScrollY;\n                        if (count > 0 && drawOverscrollHeader) {\n                            bounds.top = scrollY;\n                            bounds.bottom = this.getChildAt(0).getTop();\n                            this.drawOverscrollHeader(canvas, overscrollHeader, bounds);\n                        }\n                        const start = drawOverscrollHeader ? 1 : 0;\n                        for (let i = start; i < count; i++) {\n                            const itemIndex = (first + i);\n                            const isHeader = (itemIndex < headerCount);\n                            const isFooter = (itemIndex >= footerLimit);\n                            if ((headerDividers || !isHeader) && (footerDividers || !isFooter)) {\n                                const child = this.getChildAt(i);\n                                top = child.getTop();\n                                if (drawDividers && (top > effectivePaddingTop)) {\n                                    const isFirstItem = (i == start);\n                                    const previousIndex = (itemIndex - 1);\n                                    if (areAllItemsSelectable || ((adapter.isEnabled(itemIndex) || (headerDividers && isHeader) || (footerDividers && isFooter)) && (isFirstItem || adapter.isEnabled(previousIndex) || (headerDividers && (previousIndex < headerCount)) || (footerDividers && (previousIndex >= footerLimit))))) {\n                                        bounds.top = top - dividerHeight;\n                                        bounds.bottom = top;\n                                        this.drawDivider(canvas, bounds, i - 1);\n                                    }\n                                    else if (fillForMissingDividers) {\n                                        bounds.top = top - dividerHeight;\n                                        bounds.bottom = top;\n                                        canvas.drawRect(bounds, paint);\n                                    }\n                                }\n                            }\n                        }\n                        if (count > 0 && scrollY > 0) {\n                            if (drawOverscrollFooter) {\n                                const absListBottom = this.mBottom;\n                                bounds.top = absListBottom;\n                                bounds.bottom = absListBottom + scrollY;\n                                this.drawOverscrollFooter(canvas, overscrollFooter, bounds);\n                            }\n                            else if (drawDividers) {\n                                bounds.top = listBottom;\n                                bounds.bottom = listBottom + dividerHeight;\n                                this.drawDivider(canvas, bounds, -1);\n                            }\n                        }\n                    }\n                }\n                super.dispatchDraw(canvas);\n            }\n            drawChild(canvas, child, drawingTime) {\n                let more = super.drawChild(canvas, child, drawingTime);\n                if (this.mCachingActive && child.mCachingFailed) {\n                    this.mCachingActive = false;\n                }\n                return more;\n            }\n            drawDivider(canvas, bounds, childIndex) {\n                const divider = this.mDivider;\n                divider.setBounds(bounds);\n                divider.draw(canvas);\n            }\n            getDivider() {\n                return this.mDivider;\n            }\n            setDivider(divider) {\n                if (divider != null) {\n                    this.mDividerHeight = divider.getIntrinsicHeight();\n                }\n                else {\n                    this.mDividerHeight = 0;\n                }\n                this.mDivider = divider;\n                this.mDividerIsOpaque = divider == null || divider.getOpacity() == PixelFormat.OPAQUE;\n                this.requestLayout();\n                this.invalidate();\n            }\n            getDividerHeight() {\n                return this.mDividerHeight;\n            }\n            setDividerHeight(height) {\n                this.mDividerHeight = height;\n                this.requestLayout();\n                this.invalidate();\n            }\n            setHeaderDividersEnabled(headerDividersEnabled) {\n                this.mHeaderDividersEnabled = headerDividersEnabled;\n                this.invalidate();\n            }\n            areHeaderDividersEnabled() {\n                return this.mHeaderDividersEnabled;\n            }\n            setFooterDividersEnabled(footerDividersEnabled) {\n                this.mFooterDividersEnabled = footerDividersEnabled;\n                this.invalidate();\n            }\n            areFooterDividersEnabled() {\n                return this.mFooterDividersEnabled;\n            }\n            setOverscrollHeader(header) {\n                this.mOverScrollHeader = header;\n                if (this.mScrollY < 0) {\n                    this.invalidate();\n                }\n            }\n            getOverscrollHeader() {\n                return this.mOverScrollHeader;\n            }\n            setOverscrollFooter(footer) {\n                this.mOverScrollFooter = footer;\n                this.invalidate();\n            }\n            getOverscrollFooter() {\n                return this.mOverScrollFooter;\n            }\n            onFocusChanged(gainFocus, direction, previouslyFocusedRect) {\n                super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);\n                const adapter = this.mAdapter;\n                let closetChildIndex = -1;\n                let closestChildTop = 0;\n                if (adapter != null && gainFocus && previouslyFocusedRect != null) {\n                    previouslyFocusedRect.offset(this.mScrollX, this.mScrollY);\n                    if (adapter.getCount() < this.getChildCount() + this.mFirstPosition) {\n                        this.mLayoutMode = ListView.LAYOUT_NORMAL;\n                        this.layoutChildren();\n                    }\n                    let otherRect = this.mTempRect;\n                    let minDistance = Integer.MAX_VALUE;\n                    const childCount = this.getChildCount();\n                    const firstPosition = this.mFirstPosition;\n                    for (let i = 0; i < childCount; i++) {\n                        if (!adapter.isEnabled(firstPosition + i)) {\n                            continue;\n                        }\n                        let other = this.getChildAt(i);\n                        other.getDrawingRect(otherRect);\n                        this.offsetDescendantRectToMyCoords(other, otherRect);\n                        let distance = ListView.getDistance(previouslyFocusedRect, otherRect, direction);\n                        if (distance < minDistance) {\n                            minDistance = distance;\n                            closetChildIndex = i;\n                            closestChildTop = other.getTop();\n                        }\n                    }\n                }\n                if (closetChildIndex >= 0) {\n                    this.setSelectionFromTop(closetChildIndex + this.mFirstPosition, closestChildTop);\n                }\n                else {\n                    this.requestLayout();\n                }\n            }\n            onFinishInflate() {\n                super.onFinishInflate();\n                let count = this.getChildCount();\n                if (count > 0) {\n                    for (let i = 0; i < count; ++i) {\n                        this.addHeaderView(this.getChildAt(i));\n                    }\n                    this.removeAllViews();\n                }\n            }\n            findViewTraversal(id) {\n                let v;\n                v = super.findViewTraversal(id);\n                if (v == null) {\n                    v = this.findViewInHeadersOrFooters(this.mHeaderViewInfos, id);\n                    if (v != null) {\n                        return v;\n                    }\n                    v = this.findViewInHeadersOrFooters(this.mFooterViewInfos, id);\n                    if (v != null) {\n                        return v;\n                    }\n                }\n                return v;\n            }\n            findViewInHeadersOrFooters(where, id) {\n                if (where != null) {\n                    let len = where.size();\n                    let v;\n                    for (let i = 0; i < len; i++) {\n                        v = where.get(i).view;\n                        if (!v.isRootNamespace()) {\n                            v = v.findViewById(id);\n                            if (v != null) {\n                                return v;\n                            }\n                        }\n                    }\n                }\n                return null;\n            }\n            findViewByPredicateTraversal(predicate, childToSkip) {\n                let v;\n                v = super.findViewByPredicateTraversal(predicate, childToSkip);\n                if (v == null) {\n                    v = this.findViewByPredicateInHeadersOrFooters(this.mHeaderViewInfos, predicate, childToSkip);\n                    if (v != null) {\n                        return v;\n                    }\n                    v = this.findViewByPredicateInHeadersOrFooters(this.mFooterViewInfos, predicate, childToSkip);\n                    if (v != null) {\n                        return v;\n                    }\n                }\n                return v;\n            }\n            findViewByPredicateInHeadersOrFooters(where, predicate, childToSkip) {\n                if (where != null) {\n                    let len = where.size();\n                    let v;\n                    for (let i = 0; i < len; i++) {\n                        v = where.get(i).view;\n                        if (v != childToSkip && !v.isRootNamespace()) {\n                            v = v.findViewByPredicate(predicate);\n                            if (v != null) {\n                                return v;\n                            }\n                        }\n                    }\n                }\n                return null;\n            }\n            getCheckItemIds() {\n                if (this.mAdapter != null && this.mAdapter.hasStableIds()) {\n                    return this.getCheckedItemIds();\n                }\n                if (this.mChoiceMode != ListView.CHOICE_MODE_NONE && this.mCheckStates != null && this.mAdapter != null) {\n                    const states = this.mCheckStates;\n                    const count = states.size();\n                    const ids = androidui.util.ArrayCreator.newNumberArray(count);\n                    const adapter = this.mAdapter;\n                    let checkedCount = 0;\n                    for (let i = 0; i < count; i++) {\n                        if (states.valueAt(i)) {\n                            ids[checkedCount++] = adapter.getItemId(states.keyAt(i));\n                        }\n                    }\n                    if (checkedCount == count) {\n                        return ids;\n                    }\n                    else {\n                        const result = androidui.util.ArrayCreator.newNumberArray(checkedCount);\n                        System.arraycopy(ids, 0, result, 0, checkedCount);\n                        return result;\n                    }\n                }\n                return androidui.util.ArrayCreator.newNumberArray(0);\n            }\n        }\n        ListView.NO_POSITION = -1;\n        ListView.MAX_SCROLL_FACTOR = 0.33;\n        ListView.MIN_SCROLL_PREVIEW_PIXELS = 2;\n        widget.ListView = ListView;\n        (function (ListView) {\n            class FixedViewInfo {\n                constructor(arg) {\n                    this._ListView_this = arg;\n                }\n            }\n            ListView.FixedViewInfo = FixedViewInfo;\n            class FocusSelector {\n                constructor(arg) {\n                    this.mPosition = 0;\n                    this.mPositionTop = 0;\n                    this._ListView_this = arg;\n                }\n                setup(position, top) {\n                    this.mPosition = position;\n                    this.mPositionTop = top;\n                    return this;\n                }\n                run() {\n                    this._ListView_this.setSelectionFromTop(this.mPosition, this.mPositionTop);\n                }\n            }\n            ListView.FocusSelector = FocusSelector;\n            class ArrowScrollFocusResult {\n                constructor() {\n                    this.mSelectedPosition = 0;\n                    this.mAmountToScroll = 0;\n                }\n                populate(selectedPosition, amountToScroll) {\n                    this.mSelectedPosition = selectedPosition;\n                    this.mAmountToScroll = amountToScroll;\n                }\n                getSelectedPosition() {\n                    return this.mSelectedPosition;\n                }\n                getAmountToScroll() {\n                    return this.mAmountToScroll;\n                }\n            }\n            ListView.ArrowScrollFocusResult = ArrowScrollFocusResult;\n        })(ListView = widget.ListView || (widget.ListView = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        class Scroller extends widget.OverScroller {\n        }\n        widget.Scroller = Scroller;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var Rect = android.graphics.Rect;\n        var Log = android.util.Log;\n        var FocusFinder = android.view.FocusFinder;\n        var KeyEvent = android.view.KeyEvent;\n        var MotionEvent = android.view.MotionEvent;\n        var VelocityTracker = android.view.VelocityTracker;\n        var View = android.view.View;\n        var ViewConfiguration = android.view.ViewConfiguration;\n        var ViewGroup = android.view.ViewGroup;\n        var AnimationUtils = android.view.animation.AnimationUtils;\n        var FrameLayout = android.widget.FrameLayout;\n        var OverScroller = android.widget.OverScroller;\n        class ScrollView extends FrameLayout {\n            constructor(context, bindElement, defStyle = android.R.attr.scrollViewStyle) {\n                super(context, bindElement, defStyle);\n                this.mLastScroll = 0;\n                this.mTempRect = new Rect();\n                this.mLastMotionY = 0;\n                this.mIsLayoutDirty = true;\n                this.mChildToScrollTo = null;\n                this.mIsBeingDragged = false;\n                this.mSmoothScrollingEnabled = true;\n                this.mMinimumVelocity = 0;\n                this.mMaximumVelocity = 0;\n                this.mOverscrollDistance = 0;\n                this.mOverflingDistance = 0;\n                this.mActivePointerId = ScrollView.INVALID_POINTER;\n                this.initScrollView();\n                const a = context.obtainStyledAttributes(bindElement, defStyle);\n                this.setFillViewport(a.getBoolean('fillViewport', false));\n                a.recycle();\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('fillViewport', {\n                    setter(v, value, attrBinder) {\n                        v.setFillViewport(attrBinder.parseBoolean(value));\n                    }, getter(v) {\n                        return v.isFillViewport();\n                    }\n                });\n            }\n            shouldDelayChildPressedState() {\n                return true;\n            }\n            getTopFadingEdgeStrength() {\n                if (this.getChildCount() == 0) {\n                    return 0.0;\n                }\n                const length = this.getVerticalFadingEdgeLength();\n                if (this.mScrollY < length) {\n                    return this.mScrollY / length;\n                }\n                return 1.0;\n            }\n            getBottomFadingEdgeStrength() {\n                if (this.getChildCount() == 0) {\n                    return 0.0;\n                }\n                const length = this.getVerticalFadingEdgeLength();\n                const bottomEdge = this.getHeight() - this.mPaddingBottom;\n                const span = this.getChildAt(0).getBottom() - this.mScrollY - bottomEdge;\n                if (span < length) {\n                    return span / length;\n                }\n                return 1.0;\n            }\n            getMaxScrollAmount() {\n                return Math.floor((ScrollView.MAX_SCROLL_FACTOR * (this.mBottom - this.mTop)));\n            }\n            initScrollView() {\n                this.mScroller = new OverScroller();\n                this.setFocusable(true);\n                this.setDescendantFocusability(ScrollView.FOCUS_AFTER_DESCENDANTS);\n                this.setWillNotDraw(false);\n                const configuration = ViewConfiguration.get(this.mContext);\n                this.mTouchSlop = configuration.getScaledTouchSlop();\n                this.mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();\n                this.mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();\n                this.mOverscrollDistance = configuration.getScaledOverscrollDistance();\n                this.mOverflingDistance = configuration.getScaledOverflingDistance();\n            }\n            addView(...args) {\n                if (this.getChildCount() > 0) {\n                    throw new Error(\"ScrollView can host only one direct child\");\n                }\n                return super.addView(...args);\n            }\n            canScroll() {\n                let child = this.getChildAt(0);\n                if (child != null) {\n                    let childHeight = child.getHeight();\n                    return this.getHeight() < childHeight + this.mPaddingTop + this.mPaddingBottom;\n                }\n                return false;\n            }\n            isFillViewport() {\n                return this.mFillViewport;\n            }\n            setFillViewport(fillViewport) {\n                if (fillViewport != this.mFillViewport) {\n                    this.mFillViewport = fillViewport;\n                    this.requestLayout();\n                }\n            }\n            isSmoothScrollingEnabled() {\n                return this.mSmoothScrollingEnabled;\n            }\n            setSmoothScrollingEnabled(smoothScrollingEnabled) {\n                this.mSmoothScrollingEnabled = smoothScrollingEnabled;\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n                if (!this.mFillViewport) {\n                    return;\n                }\n                const heightMode = View.MeasureSpec.getMode(heightMeasureSpec);\n                if (heightMode == View.MeasureSpec.UNSPECIFIED) {\n                    return;\n                }\n                if (this.getChildCount() > 0) {\n                    const child = this.getChildAt(0);\n                    let height = this.getMeasuredHeight();\n                    if (child.getMeasuredHeight() < height) {\n                        const lp = child.getLayoutParams();\n                        let childWidthMeasureSpec = ScrollView.getChildMeasureSpec(widthMeasureSpec, this.mPaddingLeft + this.mPaddingRight, lp.width);\n                        height -= this.mPaddingTop;\n                        height -= this.mPaddingBottom;\n                        let childHeightMeasureSpec = View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.EXACTLY);\n                        child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n                    }\n                }\n            }\n            dispatchKeyEvent(event) {\n                return super.dispatchKeyEvent(event) || this.executeKeyEvent(event);\n            }\n            executeKeyEvent(event) {\n                this.mTempRect.setEmpty();\n                if (!this.canScroll()) {\n                    if (this.isFocused() && event.getKeyCode() != KeyEvent.KEYCODE_BACK) {\n                        let currentFocused = this.findFocus();\n                        if (currentFocused == this)\n                            currentFocused = null;\n                        let nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, View.FOCUS_DOWN);\n                        return nextFocused != null && nextFocused != this && nextFocused.requestFocus(View.FOCUS_DOWN);\n                    }\n                    return false;\n                }\n                let handled = false;\n                if (event.getAction() == KeyEvent.ACTION_DOWN) {\n                    switch (event.getKeyCode()) {\n                        case KeyEvent.KEYCODE_DPAD_UP:\n                            if (!event.isAltPressed()) {\n                                handled = this.arrowScroll(View.FOCUS_UP);\n                            }\n                            else {\n                                handled = this.fullScroll(View.FOCUS_UP);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_DPAD_DOWN:\n                            if (!event.isAltPressed()) {\n                                handled = this.arrowScroll(View.FOCUS_DOWN);\n                            }\n                            else {\n                                handled = this.fullScroll(View.FOCUS_DOWN);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_SPACE:\n                            this.pageScroll(event.isShiftPressed() ? View.FOCUS_UP : View.FOCUS_DOWN);\n                            break;\n                    }\n                }\n                return handled;\n            }\n            inChild(x, y) {\n                if (this.getChildCount() > 0) {\n                    const scrollY = this.mScrollY;\n                    const child = this.getChildAt(0);\n                    return !(y < child.getTop() - scrollY || y >= child.getBottom() - scrollY || x < child.getLeft() || x >= child.getRight());\n                }\n                return false;\n            }\n            initOrResetVelocityTracker() {\n                if (this.mVelocityTracker == null) {\n                    this.mVelocityTracker = VelocityTracker.obtain();\n                }\n                else {\n                    this.mVelocityTracker.clear();\n                }\n            }\n            initVelocityTrackerIfNotExists() {\n                if (this.mVelocityTracker == null) {\n                    this.mVelocityTracker = VelocityTracker.obtain();\n                }\n            }\n            recycleVelocityTracker() {\n                if (this.mVelocityTracker != null) {\n                    this.mVelocityTracker.recycle();\n                    this.mVelocityTracker = null;\n                }\n            }\n            requestDisallowInterceptTouchEvent(disallowIntercept) {\n                if (disallowIntercept) {\n                    this.recycleVelocityTracker();\n                }\n                super.requestDisallowInterceptTouchEvent(disallowIntercept);\n            }\n            onInterceptTouchEvent(ev) {\n                const action = ev.getAction();\n                if ((action == MotionEvent.ACTION_MOVE) && (this.mIsBeingDragged)) {\n                    return true;\n                }\n                if (this.getScrollY() == 0 && !this.canScrollVertically(1)) {\n                    return false;\n                }\n                switch (action & MotionEvent.ACTION_MASK) {\n                    case MotionEvent.ACTION_MOVE: {\n                        const activePointerId = this.mActivePointerId;\n                        if (activePointerId == ScrollView.INVALID_POINTER) {\n                            break;\n                        }\n                        const pointerIndex = ev.findPointerIndex(activePointerId);\n                        if (pointerIndex == -1) {\n                            Log.e(ScrollView.TAG, \"Invalid pointerId=\" + activePointerId + \" in onInterceptTouchEvent\");\n                            break;\n                        }\n                        const y = Math.floor(ev.getY(pointerIndex));\n                        const yDiff = Math.abs(y - this.mLastMotionY);\n                        if (yDiff > this.mTouchSlop) {\n                            this.mIsBeingDragged = true;\n                            this.mLastMotionY = y;\n                            this.initVelocityTrackerIfNotExists();\n                            this.mVelocityTracker.addMovement(ev);\n                            const parent = this.getParent();\n                            if (parent != null) {\n                                parent.requestDisallowInterceptTouchEvent(true);\n                            }\n                        }\n                        break;\n                    }\n                    case MotionEvent.ACTION_DOWN: {\n                        const y = Math.floor(ev.getY());\n                        if (!this.inChild(Math.floor(ev.getX()), Math.floor(y))) {\n                            this.mIsBeingDragged = false;\n                            this.recycleVelocityTracker();\n                            break;\n                        }\n                        this.mLastMotionY = y;\n                        this.mActivePointerId = ev.getPointerId(0);\n                        this.initOrResetVelocityTracker();\n                        this.mVelocityTracker.addMovement(ev);\n                        this.mIsBeingDragged = !this.mScroller.isFinished();\n                        break;\n                    }\n                    case MotionEvent.ACTION_CANCEL:\n                    case MotionEvent.ACTION_UP:\n                        this.mIsBeingDragged = false;\n                        this.mActivePointerId = ScrollView.INVALID_POINTER;\n                        this.recycleVelocityTracker();\n                        if (this.mScroller.springBack(this.mScrollX, this.mScrollY, 0, 0, 0, this.getScrollRange())) {\n                            this.postInvalidateOnAnimation();\n                        }\n                        break;\n                    case MotionEvent.ACTION_POINTER_UP:\n                        this.onSecondaryPointerUp(ev);\n                        break;\n                }\n                return this.mIsBeingDragged;\n            }\n            onTouchEvent(ev) {\n                this.initVelocityTrackerIfNotExists();\n                this.mVelocityTracker.addMovement(ev);\n                const action = ev.getAction();\n                switch (action & MotionEvent.ACTION_MASK) {\n                    case MotionEvent.ACTION_DOWN: {\n                        if (this.getChildCount() == 0) {\n                            return false;\n                        }\n                        if ((this.mIsBeingDragged = !this.mScroller.isFinished())) {\n                            const parent = this.getParent();\n                            if (parent != null) {\n                                parent.requestDisallowInterceptTouchEvent(true);\n                            }\n                        }\n                        if (!this.mScroller.isFinished()) {\n                            this.mScroller.abortAnimation();\n                        }\n                        this.mLastMotionY = Math.floor(ev.getY());\n                        this.mActivePointerId = ev.getPointerId(0);\n                        break;\n                    }\n                    case MotionEvent.ACTION_MOVE:\n                        const activePointerIndex = ev.findPointerIndex(this.mActivePointerId);\n                        if (activePointerIndex == -1) {\n                            Log.e(ScrollView.TAG, \"Invalid pointerId=\" + this.mActivePointerId + \" in onTouchEvent\");\n                            break;\n                        }\n                        const y = Math.floor(ev.getY(activePointerIndex));\n                        let deltaY = this.mLastMotionY - y;\n                        if (!this.mIsBeingDragged && Math.abs(deltaY) > this.mTouchSlop) {\n                            const parent = this.getParent();\n                            if (parent != null) {\n                                parent.requestDisallowInterceptTouchEvent(true);\n                            }\n                            this.mIsBeingDragged = true;\n                            if (deltaY > 0) {\n                                deltaY -= this.mTouchSlop;\n                            }\n                            else {\n                                deltaY += this.mTouchSlop;\n                            }\n                        }\n                        if (this.mIsBeingDragged) {\n                            this.mLastMotionY = y;\n                            const oldX = this.mScrollX;\n                            const oldY = this.mScrollY;\n                            const range = this.getScrollRange();\n                            const overscrollMode = this.getOverScrollMode();\n                            const canOverscroll = overscrollMode == ScrollView.OVER_SCROLL_ALWAYS || (overscrollMode == ScrollView.OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0);\n                            if (this.overScrollBy(0, deltaY, 0, this.mScrollY, 0, range, 0, this.mOverscrollDistance, true)) {\n                                this.mVelocityTracker.clear();\n                            }\n                        }\n                        break;\n                    case MotionEvent.ACTION_UP:\n                        if (this.mIsBeingDragged) {\n                            const velocityTracker = this.mVelocityTracker;\n                            velocityTracker.computeCurrentVelocity(1000, this.mMaximumVelocity);\n                            let initialVelocity = Math.floor(velocityTracker.getYVelocity(this.mActivePointerId));\n                            if (this.getChildCount() > 0) {\n                                const springBack = this.mScrollY < -this.mOverflingDistance || this.mScrollY - this.getScrollRange() > this.mOverflingDistance;\n                                if (!springBack && (Math.abs(initialVelocity) > this.mMinimumVelocity)) {\n                                    this.fling(-initialVelocity);\n                                }\n                                else {\n                                    if (this.mScroller.springBack(this.mScrollX, this.mScrollY, 0, 0, 0, this.getScrollRange())) {\n                                        this.postInvalidateOnAnimation();\n                                    }\n                                }\n                            }\n                            this.mActivePointerId = ScrollView.INVALID_POINTER;\n                            this.endDrag();\n                        }\n                        break;\n                    case MotionEvent.ACTION_CANCEL:\n                        if (this.mIsBeingDragged && this.getChildCount() > 0) {\n                            if (this.mScroller.springBack(this.mScrollX, this.mScrollY, 0, 0, 0, this.getScrollRange())) {\n                                this.postInvalidateOnAnimation();\n                            }\n                            this.mActivePointerId = ScrollView.INVALID_POINTER;\n                            this.endDrag();\n                        }\n                        break;\n                    case MotionEvent.ACTION_POINTER_DOWN: {\n                        const index = ev.getActionIndex();\n                        this.mLastMotionY = Math.floor(ev.getY(index));\n                        this.mActivePointerId = ev.getPointerId(index);\n                        break;\n                    }\n                    case MotionEvent.ACTION_POINTER_UP:\n                        this.onSecondaryPointerUp(ev);\n                        this.mLastMotionY = Math.floor(ev.getY(ev.findPointerIndex(this.mActivePointerId)));\n                        break;\n                }\n                return true;\n            }\n            onSecondaryPointerUp(ev) {\n                const pointerIndex = (ev.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;\n                const pointerId = ev.getPointerId(pointerIndex);\n                if (pointerId == this.mActivePointerId) {\n                    const newPointerIndex = pointerIndex == 0 ? 1 : 0;\n                    this.mLastMotionY = Math.floor(ev.getY(newPointerIndex));\n                    this.mActivePointerId = ev.getPointerId(newPointerIndex);\n                    if (this.mVelocityTracker != null) {\n                        this.mVelocityTracker.clear();\n                    }\n                }\n            }\n            onGenericMotionEvent(event) {\n                if (event.isPointerEvent()) {\n                    switch (event.getAction()) {\n                        case MotionEvent.ACTION_SCROLL: {\n                            if (!this.mIsBeingDragged) {\n                                const vscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL);\n                                if (vscroll != 0) {\n                                    const delta = Math.floor((vscroll * this.getVerticalScrollFactor()));\n                                    const range = this.getScrollRange();\n                                    let oldScrollY = this.mScrollY;\n                                    let newScrollY = oldScrollY - delta;\n                                    if (newScrollY < 0) {\n                                        newScrollY = 0;\n                                    }\n                                    else if (newScrollY > range) {\n                                        newScrollY = range;\n                                    }\n                                    if (newScrollY != oldScrollY) {\n                                        super.scrollTo(this.mScrollX, newScrollY);\n                                        return true;\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }\n                return super.onGenericMotionEvent(event);\n            }\n            onOverScrolled(scrollX, scrollY, clampedX, clampedY) {\n                if (!this.mScroller.isFinished()) {\n                    const oldX = this.mScrollX;\n                    const oldY = this.mScrollY;\n                    this.mScrollX = scrollX;\n                    this.mScrollY = scrollY;\n                    this.invalidateParentIfNeeded();\n                    this.onScrollChanged(this.mScrollX, this.mScrollY, oldX, oldY);\n                    if (clampedY) {\n                        this.mScroller.springBack(this.mScrollX, this.mScrollY, 0, 0, 0, this.getScrollRange());\n                    }\n                }\n                else {\n                    super.scrollTo(scrollX, scrollY);\n                }\n                this.awakenScrollBars();\n            }\n            getScrollRange() {\n                let scrollRange = 0;\n                if (this.getChildCount() > 0) {\n                    let child = this.getChildAt(0);\n                    scrollRange = Math.max(0, child.getHeight() - (this.getHeight() - this.mPaddingBottom - this.mPaddingTop));\n                }\n                return scrollRange;\n            }\n            findFocusableViewInBounds(topFocus, top, bottom) {\n                let focusables = this.getFocusables(View.FOCUS_FORWARD);\n                let focusCandidate = null;\n                let foundFullyContainedFocusable = false;\n                let count = focusables.size();\n                for (let i = 0; i < count; i++) {\n                    let view = focusables.get(i);\n                    let viewTop = view.getTop();\n                    let viewBottom = view.getBottom();\n                    if (top < viewBottom && viewTop < bottom) {\n                        const viewIsFullyContained = (top < viewTop) && (viewBottom < bottom);\n                        if (focusCandidate == null) {\n                            focusCandidate = view;\n                            foundFullyContainedFocusable = viewIsFullyContained;\n                        }\n                        else {\n                            const viewIsCloserToBoundary = (topFocus && viewTop < focusCandidate.getTop()) || (!topFocus && viewBottom > focusCandidate.getBottom());\n                            if (foundFullyContainedFocusable) {\n                                if (viewIsFullyContained && viewIsCloserToBoundary) {\n                                    focusCandidate = view;\n                                }\n                            }\n                            else {\n                                if (viewIsFullyContained) {\n                                    focusCandidate = view;\n                                    foundFullyContainedFocusable = true;\n                                }\n                                else if (viewIsCloserToBoundary) {\n                                    focusCandidate = view;\n                                }\n                            }\n                        }\n                    }\n                }\n                return focusCandidate;\n            }\n            pageScroll(direction) {\n                let down = direction == View.FOCUS_DOWN;\n                let height = this.getHeight();\n                if (down) {\n                    this.mTempRect.top = this.getScrollY() + height;\n                    let count = this.getChildCount();\n                    if (count > 0) {\n                        let view = this.getChildAt(count - 1);\n                        if (this.mTempRect.top + height > view.getBottom()) {\n                            this.mTempRect.top = view.getBottom() - height;\n                        }\n                    }\n                }\n                else {\n                    this.mTempRect.top = this.getScrollY() - height;\n                    if (this.mTempRect.top < 0) {\n                        this.mTempRect.top = 0;\n                    }\n                }\n                this.mTempRect.bottom = this.mTempRect.top + height;\n                return this.scrollAndFocus(direction, this.mTempRect.top, this.mTempRect.bottom);\n            }\n            fullScroll(direction) {\n                let down = direction == View.FOCUS_DOWN;\n                let height = this.getHeight();\n                this.mTempRect.top = 0;\n                this.mTempRect.bottom = height;\n                if (down) {\n                    let count = this.getChildCount();\n                    if (count > 0) {\n                        let view = this.getChildAt(count - 1);\n                        this.mTempRect.bottom = view.getBottom() + this.mPaddingBottom;\n                        this.mTempRect.top = this.mTempRect.bottom - height;\n                    }\n                }\n                return this.scrollAndFocus(direction, this.mTempRect.top, this.mTempRect.bottom);\n            }\n            scrollAndFocus(direction, top, bottom) {\n                let handled = true;\n                let height = this.getHeight();\n                let containerTop = this.getScrollY();\n                let containerBottom = containerTop + height;\n                let up = direction == View.FOCUS_UP;\n                let newFocused = this.findFocusableViewInBounds(up, top, bottom);\n                if (newFocused == null) {\n                    newFocused = this;\n                }\n                if (top >= containerTop && bottom <= containerBottom) {\n                    handled = false;\n                }\n                else {\n                    let delta = up ? (top - containerTop) : (bottom - containerBottom);\n                    this.doScrollY(delta);\n                }\n                if (newFocused != this.findFocus())\n                    newFocused.requestFocus(direction);\n                return handled;\n            }\n            arrowScroll(direction) {\n                let currentFocused = this.findFocus();\n                if (currentFocused == this)\n                    currentFocused = null;\n                let nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, direction);\n                const maxJump = this.getMaxScrollAmount();\n                if (nextFocused != null && this.isWithinDeltaOfScreen(nextFocused, maxJump, this.getHeight())) {\n                    nextFocused.getDrawingRect(this.mTempRect);\n                    this.offsetDescendantRectToMyCoords(nextFocused, this.mTempRect);\n                    let scrollDelta = this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);\n                    this.doScrollY(scrollDelta);\n                    nextFocused.requestFocus(direction);\n                }\n                else {\n                    let scrollDelta = maxJump;\n                    if (direction == View.FOCUS_UP && this.getScrollY() < scrollDelta) {\n                        scrollDelta = this.getScrollY();\n                    }\n                    else if (direction == View.FOCUS_DOWN) {\n                        if (this.getChildCount() > 0) {\n                            let daBottom = this.getChildAt(0).getBottom();\n                            let screenBottom = this.getScrollY() + this.getHeight() - this.mPaddingBottom;\n                            if (daBottom - screenBottom < maxJump) {\n                                scrollDelta = daBottom - screenBottom;\n                            }\n                        }\n                    }\n                    if (scrollDelta == 0) {\n                        return false;\n                    }\n                    this.doScrollY(direction == View.FOCUS_DOWN ? scrollDelta : -scrollDelta);\n                }\n                if (currentFocused != null && currentFocused.isFocused() && this.isOffScreen(currentFocused)) {\n                    const descendantFocusability = this.getDescendantFocusability();\n                    this.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);\n                    this.requestFocus();\n                    this.setDescendantFocusability(descendantFocusability);\n                }\n                return true;\n            }\n            isOffScreen(descendant) {\n                return !this.isWithinDeltaOfScreen(descendant, 0, this.getHeight());\n            }\n            isWithinDeltaOfScreen(descendant, delta, height) {\n                descendant.getDrawingRect(this.mTempRect);\n                this.offsetDescendantRectToMyCoords(descendant, this.mTempRect);\n                return (this.mTempRect.bottom + delta) >= this.getScrollY() && (this.mTempRect.top - delta) <= (this.getScrollY() + height);\n            }\n            doScrollY(delta) {\n                if (delta != 0) {\n                    if (this.mSmoothScrollingEnabled) {\n                        this.smoothScrollBy(0, delta);\n                    }\n                    else {\n                        this.scrollBy(0, delta);\n                    }\n                }\n            }\n            smoothScrollBy(dx, dy) {\n                if (this.getChildCount() == 0) {\n                    return;\n                }\n                let duration = AnimationUtils.currentAnimationTimeMillis() - this.mLastScroll;\n                if (duration > ScrollView.ANIMATED_SCROLL_GAP) {\n                    const height = this.getHeight() - this.mPaddingBottom - this.mPaddingTop;\n                    const bottom = this.getChildAt(0).getHeight();\n                    const maxY = Math.max(0, bottom - height);\n                    const scrollY = this.mScrollY;\n                    dy = Math.max(0, Math.min(scrollY + dy, maxY)) - scrollY;\n                    this.mScroller.startScroll(this.mScrollX, scrollY, 0, dy);\n                    this.postInvalidateOnAnimation();\n                }\n                else {\n                    if (!this.mScroller.isFinished()) {\n                        this.mScroller.abortAnimation();\n                    }\n                    this.scrollBy(dx, dy);\n                }\n                this.mLastScroll = AnimationUtils.currentAnimationTimeMillis();\n            }\n            smoothScrollTo(x, y) {\n                this.smoothScrollBy(x - this.mScrollX, y - this.mScrollY);\n            }\n            computeVerticalScrollRange() {\n                const count = this.getChildCount();\n                const contentHeight = this.getHeight() - this.mPaddingBottom - this.mPaddingTop;\n                if (count == 0) {\n                    return contentHeight;\n                }\n                let scrollRange = this.getChildAt(0).getBottom();\n                const scrollY = this.mScrollY;\n                const overscrollBottom = Math.max(0, scrollRange - contentHeight);\n                if (scrollY < 0) {\n                    scrollRange -= scrollY;\n                }\n                else if (scrollY > overscrollBottom) {\n                    scrollRange += scrollY - overscrollBottom;\n                }\n                return scrollRange;\n            }\n            computeVerticalScrollOffset() {\n                return Math.max(0, super.computeVerticalScrollOffset());\n            }\n            measureChild(child, parentWidthMeasureSpec, parentHeightMeasureSpec) {\n                let lp = child.getLayoutParams();\n                let childWidthMeasureSpec;\n                let childHeightMeasureSpec;\n                childWidthMeasureSpec = ScrollView.getChildMeasureSpec(parentWidthMeasureSpec, this.mPaddingLeft + this.mPaddingRight, lp.width);\n                childHeightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n                child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n            }\n            measureChildWithMargins(child, parentWidthMeasureSpec, widthUsed, parentHeightMeasureSpec, heightUsed) {\n                const lp = child.getLayoutParams();\n                const childWidthMeasureSpec = ScrollView.getChildMeasureSpec(parentWidthMeasureSpec, this.mPaddingLeft + this.mPaddingRight + lp.leftMargin + lp.rightMargin + widthUsed, lp.width);\n                const childHeightMeasureSpec = View.MeasureSpec.makeMeasureSpec(lp.topMargin + lp.bottomMargin, View.MeasureSpec.UNSPECIFIED);\n                child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n            }\n            computeScroll() {\n                if (this.mScroller.computeScrollOffset()) {\n                    let oldX = this.mScrollX;\n                    let oldY = this.mScrollY;\n                    let x = this.mScroller.getCurrX();\n                    let y = this.mScroller.getCurrY();\n                    if (oldX != x || oldY != y) {\n                        const range = this.getScrollRange();\n                        const overscrollMode = this.getOverScrollMode();\n                        const canOverscroll = overscrollMode == ScrollView.OVER_SCROLL_ALWAYS || (overscrollMode == ScrollView.OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0);\n                        this.overScrollBy(x - oldX, y - oldY, oldX, oldY, 0, range, 0, this.getHeight() / 2, false);\n                        this.onScrollChanged(this.mScrollX, this.mScrollY, oldX, oldY);\n                    }\n                    if (!this.awakenScrollBars()) {\n                        this.postInvalidateOnAnimation();\n                    }\n                }\n                else {\n                }\n            }\n            scrollToChild(child) {\n                child.getDrawingRect(this.mTempRect);\n                this.offsetDescendantRectToMyCoords(child, this.mTempRect);\n                let scrollDelta = this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);\n                if (scrollDelta != 0) {\n                    this.scrollBy(0, scrollDelta);\n                }\n            }\n            scrollToChildRect(rect, immediate) {\n                const delta = this.computeScrollDeltaToGetChildRectOnScreen(rect);\n                const scroll = delta != 0;\n                if (scroll) {\n                    if (immediate) {\n                        this.scrollBy(0, delta);\n                    }\n                    else {\n                        this.smoothScrollBy(0, delta);\n                    }\n                }\n                return scroll;\n            }\n            computeScrollDeltaToGetChildRectOnScreen(rect) {\n                if (this.getChildCount() == 0)\n                    return 0;\n                let height = this.getHeight();\n                let screenTop = this.getScrollY();\n                let screenBottom = screenTop + height;\n                let fadingEdge = this.getVerticalFadingEdgeLength();\n                if (rect.top > 0) {\n                    screenTop += fadingEdge;\n                }\n                if (rect.bottom < this.getChildAt(0).getHeight()) {\n                    screenBottom -= fadingEdge;\n                }\n                let scrollYDelta = 0;\n                if (rect.bottom > screenBottom && rect.top > screenTop) {\n                    if (rect.height() > height) {\n                        scrollYDelta += (rect.top - screenTop);\n                    }\n                    else {\n                        scrollYDelta += (rect.bottom - screenBottom);\n                    }\n                    let bottom = this.getChildAt(0).getBottom();\n                    let distanceToBottom = bottom - screenBottom;\n                    scrollYDelta = Math.min(scrollYDelta, distanceToBottom);\n                }\n                else if (rect.top < screenTop && rect.bottom < screenBottom) {\n                    if (rect.height() > height) {\n                        scrollYDelta -= (screenBottom - rect.bottom);\n                    }\n                    else {\n                        scrollYDelta -= (screenTop - rect.top);\n                    }\n                    scrollYDelta = Math.max(scrollYDelta, -this.getScrollY());\n                }\n                return scrollYDelta;\n            }\n            requestChildFocus(child, focused) {\n                if (!this.mIsLayoutDirty) {\n                    this.scrollToChild(focused);\n                }\n                else {\n                    this.mChildToScrollTo = focused;\n                }\n                super.requestChildFocus(child, focused);\n            }\n            onRequestFocusInDescendants(direction, previouslyFocusedRect) {\n                if (direction == View.FOCUS_FORWARD) {\n                    direction = View.FOCUS_DOWN;\n                }\n                else if (direction == View.FOCUS_BACKWARD) {\n                    direction = View.FOCUS_UP;\n                }\n                const nextFocus = previouslyFocusedRect == null ? FocusFinder.getInstance().findNextFocus(this, null, direction) : FocusFinder.getInstance().findNextFocusFromRect(this, previouslyFocusedRect, direction);\n                if (nextFocus == null) {\n                    return false;\n                }\n                if (this.isOffScreen(nextFocus)) {\n                    return false;\n                }\n                return nextFocus.requestFocus(direction, previouslyFocusedRect);\n            }\n            requestChildRectangleOnScreen(child, rectangle, immediate) {\n                rectangle.offset(child.getLeft() - child.getScrollX(), child.getTop() - child.getScrollY());\n                return this.scrollToChildRect(rectangle, immediate);\n            }\n            requestLayout() {\n                this.mIsLayoutDirty = true;\n                super.requestLayout();\n            }\n            onLayout(changed, l, t, r, b) {\n                super.onLayout(changed, l, t, r, b);\n                this.mIsLayoutDirty = false;\n                if (this.mChildToScrollTo != null && ScrollView.isViewDescendantOf(this.mChildToScrollTo, this)) {\n                    this.scrollToChild(this.mChildToScrollTo);\n                }\n                this.mChildToScrollTo = null;\n                if (!this.isLaidOut()) {\n                    const childHeight = (this.getChildCount() > 0) ? this.getChildAt(0).getMeasuredHeight() : 0;\n                    const scrollRange = Math.max(0, childHeight - (b - t - this.mPaddingBottom - this.mPaddingTop));\n                    if (this.mScrollY > scrollRange) {\n                        this.mScrollY = scrollRange;\n                    }\n                    else if (this.mScrollY < 0) {\n                        this.mScrollY = 0;\n                    }\n                }\n                this.scrollTo(this.mScrollX, this.mScrollY);\n            }\n            onSizeChanged(w, h, oldw, oldh) {\n                super.onSizeChanged(w, h, oldw, oldh);\n                let currentFocused = this.findFocus();\n                if (null == currentFocused || this == currentFocused)\n                    return;\n                if (this.isWithinDeltaOfScreen(currentFocused, 0, oldh)) {\n                    currentFocused.getDrawingRect(this.mTempRect);\n                    this.offsetDescendantRectToMyCoords(currentFocused, this.mTempRect);\n                    let scrollDelta = this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);\n                    this.doScrollY(scrollDelta);\n                }\n            }\n            static isViewDescendantOf(child, parent) {\n                if (child == parent) {\n                    return true;\n                }\n                const theParent = child.getParent();\n                return (theParent instanceof ViewGroup) && ScrollView.isViewDescendantOf(theParent, parent);\n            }\n            fling(velocityY) {\n                if (this.getChildCount() > 0) {\n                    let height = this.getHeight() - this.mPaddingBottom - this.mPaddingTop;\n                    let bottom = this.getChildAt(0).getHeight();\n                    this.mScroller.fling(this.mScrollX, this.mScrollY, 0, velocityY, 0, 0, 0, Math.max(0, bottom - height), 0, this.mOverflingDistance);\n                    this.postInvalidateOnAnimation();\n                }\n            }\n            endDrag() {\n                this.mIsBeingDragged = false;\n                this.recycleVelocityTracker();\n            }\n            scrollTo(x, y) {\n                if (this.getChildCount() > 0) {\n                    let child = this.getChildAt(0);\n                    x = ScrollView.clamp(x, this.getWidth() - this.mPaddingRight - this.mPaddingLeft, child.getWidth());\n                    y = ScrollView.clamp(y, this.getHeight() - this.mPaddingBottom - this.mPaddingTop, child.getHeight());\n                    if (x != this.mScrollX || y != this.mScrollY) {\n                        super.scrollTo(x, y);\n                    }\n                }\n            }\n            draw(canvas) {\n                super.draw(canvas);\n            }\n            static clamp(n, my, child) {\n                if (my >= child || n < 0) {\n                    return 0;\n                }\n                if ((my + n) > child) {\n                    return child - my;\n                }\n                return n;\n            }\n        }\n        ScrollView.ANIMATED_SCROLL_GAP = 250;\n        ScrollView.MAX_SCROLL_FACTOR = 0.5;\n        ScrollView.TAG = \"ScrollView\";\n        ScrollView.INVALID_POINTER = -1;\n        widget.ScrollView = ScrollView;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var util;\n    (function (util) {\n        class ArrayMap {\n            constructor(capacity) {\n                this.map = new Map();\n            }\n            clear() {\n                this.map.clear();\n            }\n            erase() {\n                this.map.clear();\n            }\n            ensureCapacity(minimumCapacity) {\n            }\n            containsKey(key) {\n                return this.map.has(key);\n            }\n            indexOfValue(value) {\n                return [...this.map.values()].indexOf(value);\n            }\n            containsValue(value) {\n                return this.indexOfValue(value) >= 0;\n            }\n            get(key) {\n                return this.map.get(key);\n            }\n            keyAt(index) {\n                return [...this.map.keys()][index];\n            }\n            valueAt(index) {\n                return [...this.map.values()][index];\n            }\n            setValueAt(index, value) {\n                let key = this.keyAt(index);\n                if (key == null)\n                    throw Error('index error');\n                let oldV = this.get(key);\n                this.map.set(key, value);\n                return oldV;\n            }\n            isEmpty() {\n                return this.map.size <= 0;\n            }\n            put(key, value) {\n                let oldV = this.get(key);\n                this.map.set(key, value);\n                return oldV;\n            }\n            append(key, value) {\n                this.map.set(key, value);\n            }\n            remove(key) {\n                let oldV = this.get(key);\n                this.map.delete(key);\n                return oldV;\n            }\n            removeAt(index) {\n                let key = this.keyAt(index);\n                if (key == null)\n                    throw Error('index error');\n                let oldV = this.get(key);\n                this.map.delete(key);\n                return oldV;\n            }\n            keySet() {\n                return new Set(this.map.keys());\n            }\n            size() {\n                return this.map.size;\n            }\n        }\n        util.ArrayMap = ArrayMap;\n    })(util = android.util || (android.util = {}));\n})(android || (android = {}));\nvar java;\n(function (java) {\n    var util;\n    (function (util) {\n        class ArrayDeque extends util.ArrayList {\n            addFirst(e) {\n                this.add(0, e);\n            }\n            addLast(e) {\n                this.add(e);\n            }\n            offerFirst(e) {\n                this.addFirst(e);\n                return true;\n            }\n            offerLast(e) {\n                this.addLast(e);\n                return true;\n            }\n            removeFirst() {\n                let x = this.pollFirst();\n                if (x == null)\n                    throw Error('NoSuchElementException');\n                return x;\n            }\n            removeLast() {\n                let x = this.pollLast();\n                if (x == null)\n                    throw Error('NoSuchElementException');\n                return x;\n            }\n            pollFirst() {\n                return this.array.shift();\n            }\n            pollLast() {\n                return this.array.splice(this.array.length - 1)[0];\n            }\n            getFirst() {\n                let x = this.peekFirst();\n                if (x == null)\n                    throw Error('NoSuchElementException');\n                return x;\n            }\n            getLast() {\n                let x = this.peekLast();\n                if (x == null)\n                    throw Error('NoSuchElementException');\n                return x;\n            }\n            peekFirst() {\n                return this.array[0];\n            }\n            peekLast() {\n                return this.array[this.array.length - 1];\n            }\n            removeFirstOccurrence(o) {\n                if (o == null)\n                    return false;\n                for (let i = 0, count = this.size(); i < count; i++) {\n                    if (this.array[i] == o) {\n                        this.delete(i);\n                        return true;\n                    }\n                }\n                return false;\n            }\n            removeLastOccurrence(o) {\n                if (o == null)\n                    return false;\n                for (let i = this.size(); i >= 0; i--) {\n                    if (this.array[i] == o) {\n                        this.delete(i);\n                        return true;\n                    }\n                }\n                return false;\n            }\n            offer(e) {\n                return this.offerLast(e);\n            }\n            remove() {\n                return this.removeFirst();\n            }\n            poll() {\n                return this.pollFirst();\n            }\n            element() {\n                return this.getFirst();\n            }\n            peek() {\n                return this.peekFirst();\n            }\n            push(e) {\n                this.addFirst(e);\n            }\n            pop() {\n                return this.removeFirst();\n            }\n            delete(i) {\n                if (i >= this.array.length)\n                    return false;\n                this.array.splice(i, 1);\n                return true;\n            }\n        }\n        util.ArrayDeque = ArrayDeque;\n    })(util = java.util || (java.util = {}));\n})(java || (java = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var Rect = android.graphics.Rect;\n        var Log = android.util.Log;\n        var FocusFinder = android.view.FocusFinder;\n        var KeyEvent = android.view.KeyEvent;\n        var MotionEvent = android.view.MotionEvent;\n        var VelocityTracker = android.view.VelocityTracker;\n        var View = android.view.View;\n        var ViewConfiguration = android.view.ViewConfiguration;\n        var ViewGroup = android.view.ViewGroup;\n        var AnimationUtils = android.view.animation.AnimationUtils;\n        var FrameLayout = android.widget.FrameLayout;\n        var OverScroller = android.widget.OverScroller;\n        var ScrollView = android.widget.ScrollView;\n        class HorizontalScrollView extends FrameLayout {\n            constructor(context, bindElement, defStyle) {\n                super(context, bindElement, defStyle);\n                this.mLastScroll = 0;\n                this.mTempRect = new Rect();\n                this.mLastMotionX = 0;\n                this.mIsLayoutDirty = true;\n                this.mChildToScrollTo = null;\n                this.mIsBeingDragged = false;\n                this.mSmoothScrollingEnabled = true;\n                this.mMinimumVelocity = 0;\n                this.mMaximumVelocity = 0;\n                this.mOverscrollDistance = 0;\n                this._mOverflingDistance = 0;\n                this.mActivePointerId = HorizontalScrollView.INVALID_POINTER;\n                this.initScrollView();\n                let a = context.obtainStyledAttributes(bindElement, defStyle);\n                this.setFillViewport(a.getBoolean('fillViewport', false));\n                a.recycle();\n            }\n            get mOverflingDistance() {\n                if (this.mScrollX < -this._mOverflingDistance)\n                    return -this.mScrollX;\n                let overDistance = this.mScrollX - this.getScrollRange();\n                if (overDistance > this._mOverflingDistance)\n                    return overDistance;\n                return this._mOverflingDistance;\n            }\n            set mOverflingDistance(value) {\n                this._mOverflingDistance = value;\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('', {\n                    setter(v, value, attrBinder) {\n                        v.setFillViewport(attrBinder.parseBoolean(value));\n                    }, getter(v) {\n                        return v.isFillViewport();\n                    }\n                });\n            }\n            getLeftFadingEdgeStrength() {\n                if (this.getChildCount() == 0) {\n                    return 0.0;\n                }\n                const length = this.getHorizontalFadingEdgeLength();\n                if (this.mScrollX < length) {\n                    return this.mScrollX / length;\n                }\n                return 1.0;\n            }\n            getRightFadingEdgeStrength() {\n                if (this.getChildCount() == 0) {\n                    return 0.0;\n                }\n                const length = this.getHorizontalFadingEdgeLength();\n                const rightEdge = this.getWidth() - this.mPaddingRight;\n                const span = this.getChildAt(0).getRight() - this.mScrollX - rightEdge;\n                if (span < length) {\n                    return span / length;\n                }\n                return 1.0;\n            }\n            getMaxScrollAmount() {\n                return Math.floor((HorizontalScrollView.MAX_SCROLL_FACTOR * (this.mRight - this.mLeft)));\n            }\n            initScrollView() {\n                this.mScroller = new OverScroller();\n                this.setFocusable(true);\n                this.setDescendantFocusability(HorizontalScrollView.FOCUS_AFTER_DESCENDANTS);\n                this.setWillNotDraw(false);\n                const configuration = ViewConfiguration.get();\n                this.mTouchSlop = configuration.getScaledTouchSlop();\n                this.mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();\n                this.mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();\n                this.mOverscrollDistance = configuration.getScaledOverscrollDistance();\n                this._mOverflingDistance = configuration.getScaledOverflingDistance();\n                this.initScrollCache();\n                this.setHorizontalScrollBarEnabled(true);\n            }\n            addView(...args) {\n                if (this.getChildCount() > 0) {\n                    throw new Error(\"ScrollView can host only one direct child\");\n                }\n                return super.addView(...args);\n            }\n            canScroll() {\n                let child = this.getChildAt(0);\n                if (child != null) {\n                    let childWidth = child.getWidth();\n                    return this.getWidth() < childWidth + this.mPaddingLeft + this.mPaddingRight;\n                }\n                return false;\n            }\n            isFillViewport() {\n                return this.mFillViewport;\n            }\n            setFillViewport(fillViewport) {\n                if (fillViewport != this.mFillViewport) {\n                    this.mFillViewport = fillViewport;\n                    this.requestLayout();\n                }\n            }\n            isSmoothScrollingEnabled() {\n                return this.mSmoothScrollingEnabled;\n            }\n            setSmoothScrollingEnabled(smoothScrollingEnabled) {\n                this.mSmoothScrollingEnabled = smoothScrollingEnabled;\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n                if (!this.mFillViewport) {\n                    return;\n                }\n                const widthMode = View.MeasureSpec.getMode(widthMeasureSpec);\n                if (widthMode == View.MeasureSpec.UNSPECIFIED) {\n                    return;\n                }\n                if (this.getChildCount() > 0) {\n                    const child = this.getChildAt(0);\n                    let width = this.getMeasuredWidth();\n                    if (child.getMeasuredWidth() < width) {\n                        const lp = child.getLayoutParams();\n                        let childHeightMeasureSpec = HorizontalScrollView.getChildMeasureSpec(heightMeasureSpec, this.mPaddingTop + this.mPaddingBottom, lp.height);\n                        width -= this.mPaddingLeft;\n                        width -= this.mPaddingRight;\n                        let childWidthMeasureSpec = View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY);\n                        child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n                    }\n                }\n            }\n            dispatchKeyEvent(event) {\n                return super.dispatchKeyEvent(event) || this.executeKeyEvent(event);\n            }\n            executeKeyEvent(event) {\n                this.mTempRect.setEmpty();\n                if (!this.canScroll()) {\n                    if (this.isFocused()) {\n                        let currentFocused = this.findFocus();\n                        if (currentFocused == this)\n                            currentFocused = null;\n                        let nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, View.FOCUS_RIGHT);\n                        return nextFocused != null && nextFocused != this && nextFocused.requestFocus(View.FOCUS_RIGHT);\n                    }\n                    return false;\n                }\n                let handled = false;\n                if (event.getAction() == KeyEvent.ACTION_DOWN) {\n                    switch (event.getKeyCode()) {\n                        case KeyEvent.KEYCODE_DPAD_LEFT:\n                            if (!event.isAltPressed()) {\n                                handled = this.arrowScroll(View.FOCUS_LEFT);\n                            }\n                            else {\n                                handled = this.fullScroll(View.FOCUS_LEFT);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_DPAD_RIGHT:\n                            if (!event.isAltPressed()) {\n                                handled = this.arrowScroll(View.FOCUS_RIGHT);\n                            }\n                            else {\n                                handled = this.fullScroll(View.FOCUS_RIGHT);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_SPACE:\n                            this.pageScroll(event.isShiftPressed() ? View.FOCUS_LEFT : View.FOCUS_RIGHT);\n                            break;\n                    }\n                }\n                return handled;\n            }\n            inChild(x, y) {\n                if (this.getChildCount() > 0) {\n                    const scrollX = this.mScrollX;\n                    const child = this.getChildAt(0);\n                    return !(y < child.getTop() || y >= child.getBottom() || x < child.getLeft() - scrollX || x >= child.getRight() - scrollX);\n                }\n                return false;\n            }\n            initOrResetVelocityTracker() {\n                if (this.mVelocityTracker == null) {\n                    this.mVelocityTracker = VelocityTracker.obtain();\n                }\n                else {\n                    this.mVelocityTracker.clear();\n                }\n            }\n            initVelocityTrackerIfNotExists() {\n                if (this.mVelocityTracker == null) {\n                    this.mVelocityTracker = VelocityTracker.obtain();\n                }\n            }\n            recycleVelocityTracker() {\n                if (this.mVelocityTracker != null) {\n                    this.mVelocityTracker.recycle();\n                    this.mVelocityTracker = null;\n                }\n            }\n            requestDisallowInterceptTouchEvent(disallowIntercept) {\n                if (disallowIntercept) {\n                    this.recycleVelocityTracker();\n                }\n                super.requestDisallowInterceptTouchEvent(disallowIntercept);\n            }\n            onInterceptTouchEvent(ev) {\n                const action = ev.getAction();\n                if ((action == MotionEvent.ACTION_MOVE) && (this.mIsBeingDragged)) {\n                    return true;\n                }\n                switch (action & MotionEvent.ACTION_MASK) {\n                    case MotionEvent.ACTION_MOVE:\n                        {\n                            const activePointerId = this.mActivePointerId;\n                            if (activePointerId == HorizontalScrollView.INVALID_POINTER) {\n                                break;\n                            }\n                            const pointerIndex = ev.findPointerIndex(activePointerId);\n                            if (pointerIndex == -1) {\n                                Log.e(HorizontalScrollView.TAG, \"Invalid pointerId=\" + activePointerId + \" in onInterceptTouchEvent\");\n                                break;\n                            }\n                            const x = Math.floor(ev.getX(pointerIndex));\n                            const xDiff = Math.floor(Math.abs(x - this.mLastMotionX));\n                            if (xDiff > this.mTouchSlop) {\n                                this.mIsBeingDragged = true;\n                                this.mLastMotionX = x;\n                                this.initVelocityTrackerIfNotExists();\n                                this.mVelocityTracker.addMovement(ev);\n                                if (this.mParent != null)\n                                    this.mParent.requestDisallowInterceptTouchEvent(true);\n                            }\n                            break;\n                        }\n                    case MotionEvent.ACTION_DOWN:\n                        {\n                            const x = Math.floor(ev.getX());\n                            if (!this.inChild(Math.floor(x), Math.floor(ev.getY()))) {\n                                this.mIsBeingDragged = false;\n                                this.recycleVelocityTracker();\n                                break;\n                            }\n                            this.mLastMotionX = x;\n                            this.mActivePointerId = ev.getPointerId(0);\n                            this.initOrResetVelocityTracker();\n                            this.mVelocityTracker.addMovement(ev);\n                            this.mIsBeingDragged = !this.mScroller.isFinished();\n                            break;\n                        }\n                    case MotionEvent.ACTION_CANCEL:\n                    case MotionEvent.ACTION_UP:\n                        this.mIsBeingDragged = false;\n                        this.mActivePointerId = HorizontalScrollView.INVALID_POINTER;\n                        if (this.mScroller.springBack(this.mScrollX, this.mScrollY, 0, this.getScrollRange(), 0, 0)) {\n                            this.postInvalidateOnAnimation();\n                        }\n                        break;\n                    case MotionEvent.ACTION_POINTER_DOWN:\n                        {\n                            const index = ev.getActionIndex();\n                            this.mLastMotionX = Math.floor(ev.getX(index));\n                            this.mActivePointerId = ev.getPointerId(index);\n                            break;\n                        }\n                    case MotionEvent.ACTION_POINTER_UP:\n                        this.onSecondaryPointerUp(ev);\n                        this.mLastMotionX = Math.floor(ev.getX(ev.findPointerIndex(this.mActivePointerId)));\n                        break;\n                }\n                return this.mIsBeingDragged;\n            }\n            onTouchEvent(ev) {\n                this.initVelocityTrackerIfNotExists();\n                this.mVelocityTracker.addMovement(ev);\n                const action = ev.getAction();\n                switch (action & MotionEvent.ACTION_MASK) {\n                    case MotionEvent.ACTION_DOWN:\n                        {\n                            if (this.getChildCount() == 0) {\n                                return false;\n                            }\n                            if ((this.mIsBeingDragged = !this.mScroller.isFinished())) {\n                                const parent = this.getParent();\n                                if (parent != null) {\n                                    parent.requestDisallowInterceptTouchEvent(true);\n                                }\n                            }\n                            if (!this.mScroller.isFinished()) {\n                                this.mScroller.abortAnimation();\n                            }\n                            this.mLastMotionX = Math.floor(ev.getX());\n                            this.mActivePointerId = ev.getPointerId(0);\n                            break;\n                        }\n                    case MotionEvent.ACTION_MOVE:\n                        const activePointerIndex = ev.findPointerIndex(this.mActivePointerId);\n                        if (activePointerIndex == -1) {\n                            Log.e(HorizontalScrollView.TAG, \"Invalid pointerId=\" + this.mActivePointerId + \" in onTouchEvent\");\n                            break;\n                        }\n                        const x = Math.floor(ev.getX(activePointerIndex));\n                        let deltaX = this.mLastMotionX - x;\n                        if (!this.mIsBeingDragged && Math.abs(deltaX) > this.mTouchSlop) {\n                            const parent = this.getParent();\n                            if (parent != null) {\n                                parent.requestDisallowInterceptTouchEvent(true);\n                            }\n                            this.mIsBeingDragged = true;\n                            if (deltaX > 0) {\n                                deltaX -= this.mTouchSlop;\n                            }\n                            else {\n                                deltaX += this.mTouchSlop;\n                            }\n                        }\n                        if (this.mIsBeingDragged) {\n                            this.mLastMotionX = x;\n                            const oldX = this.mScrollX;\n                            const oldY = this.mScrollY;\n                            const range = this.getScrollRange();\n                            const overscrollMode = this.getOverScrollMode();\n                            const canOverscroll = overscrollMode == HorizontalScrollView.OVER_SCROLL_ALWAYS || (overscrollMode == HorizontalScrollView.OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0);\n                            if (this.overScrollBy(deltaX, 0, this.mScrollX, 0, range, 0, this.mOverscrollDistance, 0, true)) {\n                                this.mVelocityTracker.clear();\n                            }\n                            if (canOverscroll) {\n                            }\n                        }\n                        break;\n                    case MotionEvent.ACTION_UP:\n                        if (this.mIsBeingDragged) {\n                            const velocityTracker = this.mVelocityTracker;\n                            velocityTracker.computeCurrentVelocity(1000, this.mMaximumVelocity);\n                            let initialVelocity = Math.floor(velocityTracker.getXVelocity(this.mActivePointerId));\n                            if (this.getChildCount() > 0) {\n                                let isOverDrag = this.mScrollX < 0 || this.mScrollX > this.getScrollRange();\n                                if (!isOverDrag && (Math.abs(initialVelocity) > this.mMinimumVelocity)) {\n                                    this.fling(-initialVelocity);\n                                }\n                                else {\n                                    if (this.mScroller.springBack(this.mScrollX, this.mScrollY, 0, this.getScrollRange(), 0, 0)) {\n                                        this.postInvalidateOnAnimation();\n                                    }\n                                }\n                            }\n                            this.mActivePointerId = HorizontalScrollView.INVALID_POINTER;\n                            this.mIsBeingDragged = false;\n                            this.recycleVelocityTracker();\n                        }\n                        break;\n                    case MotionEvent.ACTION_CANCEL:\n                        if (this.mIsBeingDragged && this.getChildCount() > 0) {\n                            if (this.mScroller.springBack(this.mScrollX, this.mScrollY, 0, this.getScrollRange(), 0, 0)) {\n                                this.postInvalidateOnAnimation();\n                            }\n                            this.mActivePointerId = HorizontalScrollView.INVALID_POINTER;\n                            this.mIsBeingDragged = false;\n                            this.recycleVelocityTracker();\n                        }\n                        break;\n                    case MotionEvent.ACTION_POINTER_UP:\n                        this.onSecondaryPointerUp(ev);\n                        break;\n                }\n                return true;\n            }\n            onSecondaryPointerUp(ev) {\n                const pointerIndex = (ev.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;\n                const pointerId = ev.getPointerId(pointerIndex);\n                if (pointerId == this.mActivePointerId) {\n                    const newPointerIndex = pointerIndex == 0 ? 1 : 0;\n                    this.mLastMotionX = Math.floor(ev.getX(newPointerIndex));\n                    this.mActivePointerId = ev.getPointerId(newPointerIndex);\n                    if (this.mVelocityTracker != null) {\n                        this.mVelocityTracker.clear();\n                    }\n                }\n            }\n            onGenericMotionEvent(event) {\n                if (event.isPointerEvent()) {\n                    switch (event.getAction()) {\n                        case MotionEvent.ACTION_SCROLL:\n                            {\n                                if (!this.mIsBeingDragged) {\n                                    let hscroll;\n                                    hscroll = -event.getAxisValue(MotionEvent.AXIS_VSCROLL);\n                                    if (hscroll != 0) {\n                                        const delta = Math.floor((hscroll * this.getHorizontalScrollFactor()));\n                                        const range = this.getScrollRange();\n                                        let oldScrollX = this.mScrollX;\n                                        let newScrollX = oldScrollX + delta;\n                                        if (newScrollX < 0) {\n                                            newScrollX = 0;\n                                        }\n                                        else if (newScrollX > range) {\n                                            newScrollX = range;\n                                        }\n                                        if (newScrollX != oldScrollX) {\n                                            super.scrollTo(newScrollX, this.mScrollY);\n                                            return true;\n                                        }\n                                    }\n                                }\n                            }\n                    }\n                }\n                return super.onGenericMotionEvent(event);\n            }\n            shouldDelayChildPressedState() {\n                return true;\n            }\n            onOverScrolled(scrollX, scrollY, clampedX, clampedY) {\n                if (!this.mScroller.isFinished()) {\n                    const oldX = this.mScrollX;\n                    const oldY = this.mScrollY;\n                    this.mScrollX = scrollX;\n                    this.mScrollY = scrollY;\n                    this.invalidateParentIfNeeded();\n                    this.onScrollChanged(this.mScrollX, this.mScrollY, oldX, oldY);\n                    if (clampedX) {\n                        this.mScroller.springBack(this.mScrollX, this.mScrollY, 0, this.getScrollRange(), 0, 0);\n                    }\n                }\n                else {\n                    super.scrollTo(scrollX, scrollY);\n                }\n                this.awakenScrollBars();\n            }\n            getScrollRange() {\n                let scrollRange = 0;\n                if (this.getChildCount() > 0) {\n                    let child = this.getChildAt(0);\n                    scrollRange = Math.max(0, child.getWidth() - (this.getWidth() - this.mPaddingLeft - this.mPaddingRight));\n                }\n                return scrollRange;\n            }\n            findFocusableViewInMyBounds(leftFocus, left, preferredFocusable) {\n                const fadingEdgeLength = this.getHorizontalFadingEdgeLength() / 2;\n                const leftWithoutFadingEdge = left + fadingEdgeLength;\n                const rightWithoutFadingEdge = left + this.getWidth() - fadingEdgeLength;\n                if ((preferredFocusable != null) && (preferredFocusable.getLeft() < rightWithoutFadingEdge) && (preferredFocusable.getRight() > leftWithoutFadingEdge)) {\n                    return preferredFocusable;\n                }\n                return this.findFocusableViewInBounds(leftFocus, leftWithoutFadingEdge, rightWithoutFadingEdge);\n            }\n            findFocusableViewInBounds(leftFocus, left, right) {\n                let focusables = this.getFocusables(View.FOCUS_FORWARD);\n                let focusCandidate = null;\n                let foundFullyContainedFocusable = false;\n                let count = focusables.size();\n                for (let i = 0; i < count; i++) {\n                    let view = focusables.get(i);\n                    let viewLeft = view.getLeft();\n                    let viewRight = view.getRight();\n                    if (left < viewRight && viewLeft < right) {\n                        const viewIsFullyContained = (left < viewLeft) && (viewRight < right);\n                        if (focusCandidate == null) {\n                            focusCandidate = view;\n                            foundFullyContainedFocusable = viewIsFullyContained;\n                        }\n                        else {\n                            const viewIsCloserToBoundary = (leftFocus && viewLeft < focusCandidate.getLeft()) || (!leftFocus && viewRight > focusCandidate.getRight());\n                            if (foundFullyContainedFocusable) {\n                                if (viewIsFullyContained && viewIsCloserToBoundary) {\n                                    focusCandidate = view;\n                                }\n                            }\n                            else {\n                                if (viewIsFullyContained) {\n                                    focusCandidate = view;\n                                    foundFullyContainedFocusable = true;\n                                }\n                                else if (viewIsCloserToBoundary) {\n                                    focusCandidate = view;\n                                }\n                            }\n                        }\n                    }\n                }\n                return focusCandidate;\n            }\n            pageScroll(direction) {\n                let right = direction == View.FOCUS_RIGHT;\n                let width = this.getWidth();\n                if (right) {\n                    this.mTempRect.left = this.getScrollX() + width;\n                    let count = this.getChildCount();\n                    if (count > 0) {\n                        let view = this.getChildAt(0);\n                        if (this.mTempRect.left + width > view.getRight()) {\n                            this.mTempRect.left = view.getRight() - width;\n                        }\n                    }\n                }\n                else {\n                    this.mTempRect.left = this.getScrollX() - width;\n                    if (this.mTempRect.left < 0) {\n                        this.mTempRect.left = 0;\n                    }\n                }\n                this.mTempRect.right = this.mTempRect.left + width;\n                return this.scrollAndFocus(direction, this.mTempRect.left, this.mTempRect.right);\n            }\n            fullScroll(direction) {\n                let right = direction == View.FOCUS_RIGHT;\n                let width = this.getWidth();\n                this.mTempRect.left = 0;\n                this.mTempRect.right = width;\n                if (right) {\n                    let count = this.getChildCount();\n                    if (count > 0) {\n                        let view = this.getChildAt(0);\n                        this.mTempRect.right = view.getRight();\n                        this.mTempRect.left = this.mTempRect.right - width;\n                    }\n                }\n                return this.scrollAndFocus(direction, this.mTempRect.left, this.mTempRect.right);\n            }\n            scrollAndFocus(direction, left, right) {\n                let handled = true;\n                let width = this.getWidth();\n                let containerLeft = this.getScrollX();\n                let containerRight = containerLeft + width;\n                let goLeft = direction == View.FOCUS_LEFT;\n                let newFocused = this.findFocusableViewInBounds(goLeft, left, right);\n                if (newFocused == null) {\n                    newFocused = this;\n                }\n                if (left >= containerLeft && right <= containerRight) {\n                    handled = false;\n                }\n                else {\n                    let delta = goLeft ? (left - containerLeft) : (right - containerRight);\n                    this.doScrollX(delta);\n                }\n                if (newFocused != this.findFocus())\n                    newFocused.requestFocus(direction);\n                return handled;\n            }\n            arrowScroll(direction) {\n                let currentFocused = this.findFocus();\n                if (currentFocused == this)\n                    currentFocused = null;\n                let nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, direction);\n                const maxJump = this.getMaxScrollAmount();\n                if (nextFocused != null && this.isWithinDeltaOfScreen(nextFocused, maxJump)) {\n                    nextFocused.getDrawingRect(this.mTempRect);\n                    this.offsetDescendantRectToMyCoords(nextFocused, this.mTempRect);\n                    let scrollDelta = this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);\n                    this.doScrollX(scrollDelta);\n                    nextFocused.requestFocus(direction);\n                }\n                else {\n                    let scrollDelta = maxJump;\n                    if (direction == View.FOCUS_LEFT && this.getScrollX() < scrollDelta) {\n                        scrollDelta = this.getScrollX();\n                    }\n                    else if (direction == View.FOCUS_RIGHT && this.getChildCount() > 0) {\n                        let daRight = this.getChildAt(0).getRight();\n                        let screenRight = this.getScrollX() + this.getWidth();\n                        if (daRight - screenRight < maxJump) {\n                            scrollDelta = daRight - screenRight;\n                        }\n                    }\n                    if (scrollDelta == 0) {\n                        return false;\n                    }\n                    this.doScrollX(direction == View.FOCUS_RIGHT ? scrollDelta : -scrollDelta);\n                }\n                if (currentFocused != null && currentFocused.isFocused() && this.isOffScreen(currentFocused)) {\n                    const descendantFocusability = this.getDescendantFocusability();\n                    this.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);\n                    this.requestFocus();\n                    this.setDescendantFocusability(descendantFocusability);\n                }\n                return true;\n            }\n            isOffScreen(descendant) {\n                return !this.isWithinDeltaOfScreen(descendant, 0);\n            }\n            isWithinDeltaOfScreen(descendant, delta) {\n                descendant.getDrawingRect(this.mTempRect);\n                this.offsetDescendantRectToMyCoords(descendant, this.mTempRect);\n                return (this.mTempRect.right + delta) >= this.getScrollX() && (this.mTempRect.left - delta) <= (this.getScrollX() + this.getWidth());\n            }\n            doScrollX(delta) {\n                if (delta != 0) {\n                    if (this.mSmoothScrollingEnabled) {\n                        this.smoothScrollBy(delta, 0);\n                    }\n                    else {\n                        this.scrollBy(delta, 0);\n                    }\n                }\n            }\n            smoothScrollBy(dx, dy) {\n                if (this.getChildCount() == 0) {\n                    return;\n                }\n                let duration = AnimationUtils.currentAnimationTimeMillis() - this.mLastScroll;\n                if (duration > HorizontalScrollView.ANIMATED_SCROLL_GAP) {\n                    const width = this.getWidth() - this.mPaddingRight - this.mPaddingLeft;\n                    const right = this.getChildAt(0).getWidth();\n                    const maxX = Math.max(0, right - width);\n                    const scrollX = this.mScrollX;\n                    dx = Math.max(0, Math.min(scrollX + dx, maxX)) - scrollX;\n                    this.mScroller.startScroll(scrollX, this.mScrollY, dx, 0);\n                    this.postInvalidateOnAnimation();\n                }\n                else {\n                    if (!this.mScroller.isFinished()) {\n                        this.mScroller.abortAnimation();\n                    }\n                    this.scrollBy(dx, dy);\n                }\n                this.mLastScroll = AnimationUtils.currentAnimationTimeMillis();\n            }\n            smoothScrollTo(x, y) {\n                this.smoothScrollBy(x - this.mScrollX, y - this.mScrollY);\n            }\n            computeHorizontalScrollRange() {\n                const count = this.getChildCount();\n                const contentWidth = this.getWidth() - this.mPaddingLeft - this.mPaddingRight;\n                if (count == 0) {\n                    return contentWidth;\n                }\n                let scrollRange = this.getChildAt(0).getRight();\n                const scrollX = this.mScrollX;\n                const overscrollRight = Math.max(0, scrollRange - contentWidth);\n                if (scrollX < 0) {\n                    scrollRange -= scrollX;\n                }\n                else if (scrollX > overscrollRight) {\n                    scrollRange += scrollX - overscrollRight;\n                }\n                return scrollRange;\n            }\n            computeHorizontalScrollOffset() {\n                return Math.max(0, super.computeHorizontalScrollOffset());\n            }\n            measureChild(child, parentWidthMeasureSpec, parentHeightMeasureSpec) {\n                let lp = child.getLayoutParams();\n                let childWidthMeasureSpec;\n                let childHeightMeasureSpec;\n                childHeightMeasureSpec = HorizontalScrollView.getChildMeasureSpec(parentHeightMeasureSpec, this.mPaddingTop + this.mPaddingBottom, lp.height);\n                childWidthMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n                child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n            }\n            measureChildWithMargins(child, parentWidthMeasureSpec, widthUsed, parentHeightMeasureSpec, heightUsed) {\n                const lp = child.getLayoutParams();\n                const childHeightMeasureSpec = HorizontalScrollView.getChildMeasureSpec(parentHeightMeasureSpec, this.mPaddingTop + this.mPaddingBottom + lp.topMargin + lp.bottomMargin + heightUsed, lp.height);\n                const childWidthMeasureSpec = View.MeasureSpec.makeMeasureSpec(lp.leftMargin + lp.rightMargin, View.MeasureSpec.UNSPECIFIED);\n                child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n            }\n            computeScroll() {\n                if (this.mScroller.computeScrollOffset()) {\n                    let oldX = this.mScrollX;\n                    let oldY = this.mScrollY;\n                    let x = this.mScroller.getCurrX();\n                    let y = this.mScroller.getCurrY();\n                    if (oldX != x || oldY != y) {\n                        const range = this.getScrollRange();\n                        const overscrollMode = this.getOverScrollMode();\n                        const canOverscroll = overscrollMode == HorizontalScrollView.OVER_SCROLL_ALWAYS || (overscrollMode == HorizontalScrollView.OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0);\n                        this.overScrollBy(x - oldX, y - oldY, oldX, oldY, range, 0, this.mOverflingDistance, 0, false);\n                        this.onScrollChanged(this.mScrollX, this.mScrollY, oldX, oldY);\n                        if (canOverscroll) {\n                        }\n                    }\n                    if (!this.awakenScrollBars()) {\n                        this.postInvalidateOnAnimation();\n                    }\n                }\n            }\n            scrollToChild(child) {\n                child.getDrawingRect(this.mTempRect);\n                this.offsetDescendantRectToMyCoords(child, this.mTempRect);\n                let scrollDelta = this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);\n                if (scrollDelta != 0) {\n                    this.scrollBy(scrollDelta, 0);\n                }\n            }\n            scrollToChildRect(rect, immediate) {\n                const delta = this.computeScrollDeltaToGetChildRectOnScreen(rect);\n                const scroll = delta != 0;\n                if (scroll) {\n                    if (immediate) {\n                        this.scrollBy(delta, 0);\n                    }\n                    else {\n                        this.smoothScrollBy(delta, 0);\n                    }\n                }\n                return scroll;\n            }\n            computeScrollDeltaToGetChildRectOnScreen(rect) {\n                if (this.getChildCount() == 0)\n                    return 0;\n                let width = this.getWidth();\n                let screenLeft = this.getScrollX();\n                let screenRight = screenLeft + width;\n                let fadingEdge = this.getHorizontalFadingEdgeLength();\n                if (rect.left > 0) {\n                    screenLeft += fadingEdge;\n                }\n                if (rect.right < this.getChildAt(0).getWidth()) {\n                    screenRight -= fadingEdge;\n                }\n                let scrollXDelta = 0;\n                if (rect.right > screenRight && rect.left > screenLeft) {\n                    if (rect.width() > width) {\n                        scrollXDelta += (rect.left - screenLeft);\n                    }\n                    else {\n                        scrollXDelta += (rect.right - screenRight);\n                    }\n                    let right = this.getChildAt(0).getRight();\n                    let distanceToRight = right - screenRight;\n                    scrollXDelta = Math.min(scrollXDelta, distanceToRight);\n                }\n                else if (rect.left < screenLeft && rect.right < screenRight) {\n                    if (rect.width() > width) {\n                        scrollXDelta -= (screenRight - rect.right);\n                    }\n                    else {\n                        scrollXDelta -= (screenLeft - rect.left);\n                    }\n                    scrollXDelta = Math.max(scrollXDelta, -this.getScrollX());\n                }\n                return scrollXDelta;\n            }\n            requestChildFocus(child, focused) {\n                if (!this.mIsLayoutDirty) {\n                    this.scrollToChild(focused);\n                }\n                else {\n                    this.mChildToScrollTo = focused;\n                }\n                super.requestChildFocus(child, focused);\n            }\n            onRequestFocusInDescendants(direction, previouslyFocusedRect) {\n                if (direction == View.FOCUS_FORWARD) {\n                    direction = View.FOCUS_RIGHT;\n                }\n                else if (direction == View.FOCUS_BACKWARD) {\n                    direction = View.FOCUS_LEFT;\n                }\n                const nextFocus = previouslyFocusedRect == null ? FocusFinder.getInstance().findNextFocus(this, null, direction) : FocusFinder.getInstance().findNextFocusFromRect(this, previouslyFocusedRect, direction);\n                if (nextFocus == null) {\n                    return false;\n                }\n                if (this.isOffScreen(nextFocus)) {\n                    return false;\n                }\n                return nextFocus.requestFocus(direction, previouslyFocusedRect);\n            }\n            requestChildRectangleOnScreen(child, rectangle, immediate) {\n                rectangle.offset(child.getLeft() - child.getScrollX(), child.getTop() - child.getScrollY());\n                return this.scrollToChildRect(rectangle, immediate);\n            }\n            requestLayout() {\n                this.mIsLayoutDirty = true;\n                super.requestLayout();\n            }\n            onLayout(changed, l, t, r, b) {\n                let childWidth = 0;\n                let childMargins = 0;\n                if (this.getChildCount() > 0) {\n                    childWidth = this.getChildAt(0).getMeasuredWidth();\n                    let childParams = this.getChildAt(0).getLayoutParams();\n                    childMargins = childParams.leftMargin + childParams.rightMargin;\n                }\n                const available = r - l - this.getPaddingLeftWithForeground() - this.getPaddingRightWithForeground() - childMargins;\n                const forceLeftGravity = (childWidth > available);\n                this.layoutChildren(l, t, r, b, forceLeftGravity);\n                this.mIsLayoutDirty = false;\n                if (this.mChildToScrollTo != null && HorizontalScrollView.isViewDescendantOf(this.mChildToScrollTo, this)) {\n                    this.scrollToChild(this.mChildToScrollTo);\n                }\n                this.mChildToScrollTo = null;\n                if (!this.isLaidOut()) {\n                    const scrollRange = Math.max(0, childWidth - (r - l - this.mPaddingLeft - this.mPaddingRight));\n                    {\n                        if (this.isLayoutRtl()) {\n                            this.mScrollX = scrollRange - this.mScrollX;\n                        }\n                    }\n                    if (this.mScrollX > scrollRange) {\n                        this.mScrollX = scrollRange;\n                    }\n                    else if (this.mScrollX < 0) {\n                        this.mScrollX = 0;\n                    }\n                }\n                this.scrollTo(this.mScrollX, this.mScrollY);\n            }\n            onSizeChanged(w, h, oldw, oldh) {\n                super.onSizeChanged(w, h, oldw, oldh);\n                let currentFocused = this.findFocus();\n                if (null == currentFocused || this == currentFocused)\n                    return;\n                const maxJump = this.mRight - this.mLeft;\n                if (this.isWithinDeltaOfScreen(currentFocused, maxJump)) {\n                    currentFocused.getDrawingRect(this.mTempRect);\n                    this.offsetDescendantRectToMyCoords(currentFocused, this.mTempRect);\n                    let scrollDelta = this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);\n                    this.doScrollX(scrollDelta);\n                }\n            }\n            static isViewDescendantOf(child, parent) {\n                if (child == parent) {\n                    return true;\n                }\n                const theParent = child.getParent();\n                return (theParent instanceof ViewGroup) && HorizontalScrollView.isViewDescendantOf(theParent, parent);\n            }\n            fling(velocityX) {\n                if (this.getChildCount() > 0) {\n                    let width = this.getWidth() - this.mPaddingRight - this.mPaddingLeft;\n                    let right = this.getChildAt(0).getWidth();\n                    this.mScroller.fling(this.mScrollX, this.mScrollY, velocityX, 0, 0, Math.max(0, right - width), 0, 0, width / 2, 0);\n                    const movingRight = velocityX > 0;\n                    let currentFocused = this.findFocus();\n                    let newFocused = this.findFocusableViewInMyBounds(movingRight, this.mScroller.getFinalX(), currentFocused);\n                    if (newFocused == null) {\n                        newFocused = this;\n                    }\n                    if (newFocused != currentFocused) {\n                        newFocused.requestFocus(movingRight ? View.FOCUS_RIGHT : View.FOCUS_LEFT);\n                    }\n                    this.postInvalidateOnAnimation();\n                }\n            }\n            scrollTo(x, y) {\n                if (this.getChildCount() > 0) {\n                    let child = this.getChildAt(0);\n                    x = HorizontalScrollView.clamp(x, this.getWidth() - this.mPaddingRight - this.mPaddingLeft, child.getWidth());\n                    y = HorizontalScrollView.clamp(y, this.getHeight() - this.mPaddingBottom - this.mPaddingTop, child.getHeight());\n                    if (x != this.mScrollX || y != this.mScrollY) {\n                        super.scrollTo(x, y);\n                    }\n                }\n            }\n            setOverScrollMode(mode) {\n                super.setOverScrollMode(mode);\n            }\n            draw(canvas) {\n                super.draw(canvas);\n            }\n            static clamp(n, my, child) {\n                if (my >= child || n < 0) {\n                    return 0;\n                }\n                if ((my + n) > child) {\n                    return child - my;\n                }\n                return n;\n            }\n        }\n        HorizontalScrollView.ANIMATED_SCROLL_GAP = ScrollView.ANIMATED_SCROLL_GAP;\n        HorizontalScrollView.MAX_SCROLL_FACTOR = ScrollView.MAX_SCROLL_FACTOR;\n        HorizontalScrollView.TAG = \"HorizontalScrollView\";\n        HorizontalScrollView.INVALID_POINTER = -1;\n        widget.HorizontalScrollView = HorizontalScrollView;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var ArrayMap = android.util.ArrayMap;\n        var ArrayDeque = java.util.ArrayDeque;\n        var ArrayList = java.util.ArrayList;\n        var Rect = android.graphics.Rect;\n        var SynchronizedPool = android.util.Pools.SynchronizedPool;\n        var SparseMap = android.util.SparseMap;\n        var Gravity = android.view.Gravity;\n        var View = android.view.View;\n        var ViewGroup = android.view.ViewGroup;\n        var Integer = java.lang.Integer;\n        var System = java.lang.System;\n        var Context = android.content.Context;\n        class RelativeLayout extends ViewGroup {\n            constructor(context, bindElement, defStyle) {\n                super(context, bindElement, defStyle);\n                this.mBaselineView = null;\n                this.mGravity = Gravity.START | Gravity.TOP;\n                this.mContentBounds = new Rect();\n                this.mSelfBounds = new Rect();\n                this.mIgnoreGravity = View.NO_ID;\n                this.mGraph = new RelativeLayout.DependencyGraph();\n                this.mAllowBrokenMeasureSpecs = false;\n                this.mMeasureVerticalWithPaddingMargin = false;\n                if (bindElement || defStyle) {\n                    const a = context.obtainStyledAttributes(bindElement, defStyle);\n                    this.mIgnoreGravity = a.getResourceId('ignoreGravity', View.NO_ID);\n                    this.mGravity = Gravity.parseGravity(a.getAttrValue('gravity'), this.mGravity);\n                    a.recycle();\n                }\n                this.queryCompatibilityModes();\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('ignoreGravity', {\n                    setter(v, value, a) {\n                        v.setIgnoreGravity(value + '');\n                    }, getter(v) {\n                        return v.mIgnoreGravity;\n                    }\n                }).set('gravity', {\n                    setter(v, value, a) {\n                        v.setGravity(a.parseGravity(value, v.mGravity));\n                    }, getter(v) {\n                        return v.mGravity;\n                    }\n                });\n            }\n            queryCompatibilityModes() {\n                this.mAllowBrokenMeasureSpecs = false;\n                this.mMeasureVerticalWithPaddingMargin = true;\n            }\n            shouldDelayChildPressedState() {\n                return false;\n            }\n            setIgnoreGravity(viewId) {\n                this.mIgnoreGravity = viewId;\n            }\n            getGravity() {\n                return this.mGravity;\n            }\n            setGravity(gravity) {\n                if (this.mGravity != gravity) {\n                    if ((gravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) {\n                        gravity |= Gravity.START;\n                    }\n                    if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) {\n                        gravity |= Gravity.TOP;\n                    }\n                    this.mGravity = gravity;\n                    this.requestLayout();\n                }\n            }\n            setHorizontalGravity(horizontalGravity) {\n                const gravity = horizontalGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK;\n                if ((this.mGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) != gravity) {\n                    this.mGravity = (this.mGravity & ~Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) | gravity;\n                    this.requestLayout();\n                }\n            }\n            setVerticalGravity(verticalGravity) {\n                const gravity = verticalGravity & Gravity.VERTICAL_GRAVITY_MASK;\n                if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) != gravity) {\n                    this.mGravity = (this.mGravity & ~Gravity.VERTICAL_GRAVITY_MASK) | gravity;\n                    this.requestLayout();\n                }\n            }\n            getBaseline() {\n                return this.mBaselineView != null ? this.mBaselineView.getBaseline() : super.getBaseline();\n            }\n            requestLayout() {\n                super.requestLayout();\n                this.mDirtyHierarchy = true;\n            }\n            sortChildren() {\n                const count = this.getChildCount();\n                if (this.mSortedVerticalChildren == null || this.mSortedVerticalChildren.length != count) {\n                    this.mSortedVerticalChildren = new Array(count);\n                }\n                if (this.mSortedHorizontalChildren == null || this.mSortedHorizontalChildren.length != count) {\n                    this.mSortedHorizontalChildren = new Array(count);\n                }\n                const graph = this.mGraph;\n                graph.clear();\n                for (let i = 0; i < count; i++) {\n                    graph.add(this.getChildAt(i));\n                }\n                graph.getSortedViews(this.mSortedVerticalChildren, RelativeLayout.RULES_VERTICAL);\n                graph.getSortedViews(this.mSortedHorizontalChildren, RelativeLayout.RULES_HORIZONTAL);\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                if (this.mDirtyHierarchy) {\n                    this.mDirtyHierarchy = false;\n                    this.sortChildren();\n                }\n                let myWidth = -1;\n                let myHeight = -1;\n                let width = 0;\n                let height = 0;\n                const widthMode = View.MeasureSpec.getMode(widthMeasureSpec);\n                const heightMode = View.MeasureSpec.getMode(heightMeasureSpec);\n                const widthSize = View.MeasureSpec.getSize(widthMeasureSpec);\n                const heightSize = View.MeasureSpec.getSize(heightMeasureSpec);\n                if (widthMode != View.MeasureSpec.UNSPECIFIED) {\n                    myWidth = widthSize;\n                }\n                if (heightMode != View.MeasureSpec.UNSPECIFIED) {\n                    myHeight = heightSize;\n                }\n                if (widthMode == View.MeasureSpec.EXACTLY) {\n                    width = myWidth;\n                }\n                if (heightMode == View.MeasureSpec.EXACTLY) {\n                    height = myHeight;\n                }\n                this.mHasBaselineAlignedChild = false;\n                let ignore = null;\n                let gravity = this.mGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK;\n                const horizontalGravity = gravity != Gravity.START && gravity != 0;\n                gravity = this.mGravity & Gravity.VERTICAL_GRAVITY_MASK;\n                const verticalGravity = gravity != Gravity.TOP && gravity != 0;\n                let left = Integer.MAX_VALUE;\n                let top = Integer.MAX_VALUE;\n                let right = Integer.MIN_VALUE;\n                let bottom = Integer.MIN_VALUE;\n                let offsetHorizontalAxis = false;\n                let offsetVerticalAxis = false;\n                if ((horizontalGravity || verticalGravity) && this.mIgnoreGravity != View.NO_ID) {\n                    ignore = this.findViewById(this.mIgnoreGravity);\n                }\n                const isWrapContentWidth = widthMode != View.MeasureSpec.EXACTLY;\n                const isWrapContentHeight = heightMode != View.MeasureSpec.EXACTLY;\n                const layoutDirection = this.getLayoutDirection();\n                if (this.isLayoutRtl() && myWidth == -1) {\n                    myWidth = RelativeLayout.DEFAULT_WIDTH;\n                }\n                let views = this.mSortedHorizontalChildren;\n                let count = views.length;\n                for (let i = 0; i < count; i++) {\n                    let child = views[i];\n                    if (child.getVisibility() != RelativeLayout.GONE) {\n                        let params = child.getLayoutParams();\n                        let rules = params.getRules(layoutDirection);\n                        this.applyHorizontalSizeRules(params, myWidth, rules);\n                        this.measureChildHorizontal(child, params, myWidth, myHeight);\n                        if (this.positionChildHorizontal(child, params, myWidth, isWrapContentWidth)) {\n                            offsetHorizontalAxis = true;\n                        }\n                    }\n                }\n                views = this.mSortedVerticalChildren;\n                count = views.length;\n                for (let i = 0; i < count; i++) {\n                    let child = views[i];\n                    if (child.getVisibility() != RelativeLayout.GONE) {\n                        let params = child.getLayoutParams();\n                        this.applyVerticalSizeRules(params, myHeight);\n                        this._measureChild(child, params, myWidth, myHeight);\n                        if (this.positionChildVertical(child, params, myHeight, isWrapContentHeight)) {\n                            offsetVerticalAxis = true;\n                        }\n                        if (isWrapContentWidth) {\n                            if (this.isLayoutRtl()) {\n                                width = Math.max(width, myWidth - params.mLeft - params.leftMargin);\n                            }\n                            else {\n                                width = Math.max(width, params.mRight + params.rightMargin);\n                            }\n                        }\n                        if (isWrapContentHeight) {\n                            height = Math.max(height, params.mBottom + params.bottomMargin);\n                        }\n                        if (child != ignore || verticalGravity) {\n                            left = Math.min(left, params.mLeft - params.leftMargin);\n                            top = Math.min(top, params.mTop - params.topMargin);\n                        }\n                        if (child != ignore || horizontalGravity) {\n                            right = Math.max(right, params.mRight + params.rightMargin);\n                            bottom = Math.max(bottom, params.mBottom + params.bottomMargin);\n                        }\n                    }\n                }\n                if (this.mHasBaselineAlignedChild) {\n                    for (let i = 0; i < count; i++) {\n                        let child = this.getChildAt(i);\n                        if (child.getVisibility() != RelativeLayout.GONE) {\n                            let params = child.getLayoutParams();\n                            this.alignBaseline(child, params);\n                            if (child != ignore || verticalGravity) {\n                                left = Math.min(left, params.mLeft - params.leftMargin);\n                                top = Math.min(top, params.mTop - params.topMargin);\n                            }\n                            if (child != ignore || horizontalGravity) {\n                                right = Math.max(right, params.mRight + params.rightMargin);\n                                bottom = Math.max(bottom, params.mBottom + params.bottomMargin);\n                            }\n                        }\n                    }\n                }\n                if (isWrapContentWidth) {\n                    width += this.mPaddingRight;\n                    if (this.mLayoutParams != null && this.mLayoutParams.width >= 0) {\n                        width = Math.max(width, this.mLayoutParams.width);\n                    }\n                    width = Math.max(width, this.getSuggestedMinimumWidth());\n                    width = RelativeLayout.resolveSize(width, widthMeasureSpec);\n                    if (offsetHorizontalAxis) {\n                        for (let i = 0; i < count; i++) {\n                            let child = this.getChildAt(i);\n                            if (child.getVisibility() != RelativeLayout.GONE) {\n                                let params = child.getLayoutParams();\n                                const rules = params.getRules(layoutDirection);\n                                if (rules[RelativeLayout.CENTER_IN_PARENT] != null || rules[RelativeLayout.CENTER_HORIZONTAL] != null) {\n                                    RelativeLayout.centerHorizontal(child, params, width);\n                                }\n                                else if (rules[RelativeLayout.ALIGN_PARENT_RIGHT] != null) {\n                                    const childWidth = child.getMeasuredWidth();\n                                    params.mLeft = width - this.mPaddingRight - childWidth;\n                                    params.mRight = params.mLeft + childWidth;\n                                }\n                            }\n                        }\n                    }\n                }\n                if (isWrapContentHeight) {\n                    height += this.mPaddingBottom;\n                    if (this.mLayoutParams != null && this.mLayoutParams.height >= 0) {\n                        height = Math.max(height, this.mLayoutParams.height);\n                    }\n                    height = Math.max(height, this.getSuggestedMinimumHeight());\n                    height = RelativeLayout.resolveSize(height, heightMeasureSpec);\n                    if (offsetVerticalAxis) {\n                        for (let i = 0; i < count; i++) {\n                            let child = this.getChildAt(i);\n                            if (child.getVisibility() != RelativeLayout.GONE) {\n                                let params = child.getLayoutParams();\n                                const rules = params.getRules(layoutDirection);\n                                if (rules[RelativeLayout.CENTER_IN_PARENT] != null || rules[RelativeLayout.CENTER_VERTICAL] != null) {\n                                    RelativeLayout.centerVertical(child, params, height);\n                                }\n                                else if (rules[RelativeLayout.ALIGN_PARENT_BOTTOM] != null) {\n                                    const childHeight = child.getMeasuredHeight();\n                                    params.mTop = height - this.mPaddingBottom - childHeight;\n                                    params.mBottom = params.mTop + childHeight;\n                                }\n                            }\n                        }\n                    }\n                }\n                if (horizontalGravity || verticalGravity) {\n                    const selfBounds = this.mSelfBounds;\n                    selfBounds.set(this.mPaddingLeft, this.mPaddingTop, width - this.mPaddingRight, height - this.mPaddingBottom);\n                    const contentBounds = this.mContentBounds;\n                    Gravity.apply(this.mGravity, right - left, bottom - top, selfBounds, contentBounds, layoutDirection);\n                    const horizontalOffset = contentBounds.left - left;\n                    const verticalOffset = contentBounds.top - top;\n                    if (horizontalOffset != 0 || verticalOffset != 0) {\n                        for (let i = 0; i < count; i++) {\n                            let child = this.getChildAt(i);\n                            if (child.getVisibility() != RelativeLayout.GONE && child != ignore) {\n                                let params = child.getLayoutParams();\n                                if (horizontalGravity) {\n                                    params.mLeft += horizontalOffset;\n                                    params.mRight += horizontalOffset;\n                                }\n                                if (verticalGravity) {\n                                    params.mTop += verticalOffset;\n                                    params.mBottom += verticalOffset;\n                                }\n                            }\n                        }\n                    }\n                }\n                if (this.isLayoutRtl()) {\n                    const offsetWidth = myWidth - width;\n                    for (let i = 0; i < count; i++) {\n                        let child = this.getChildAt(i);\n                        if (child.getVisibility() != RelativeLayout.GONE) {\n                            let params = child.getLayoutParams();\n                            params.mLeft -= offsetWidth;\n                            params.mRight -= offsetWidth;\n                        }\n                    }\n                }\n                this.setMeasuredDimension(width, height);\n            }\n            alignBaseline(child, params) {\n                const layoutDirection = this.getLayoutDirection();\n                let rules = params.getRules(layoutDirection);\n                let anchorBaseline = this.getRelatedViewBaseline(rules, RelativeLayout.ALIGN_BASELINE);\n                if (anchorBaseline != -1) {\n                    let anchorParams = this.getRelatedViewParams(rules, RelativeLayout.ALIGN_BASELINE);\n                    if (anchorParams != null) {\n                        let offset = anchorParams.mTop + anchorBaseline;\n                        let baseline = child.getBaseline();\n                        if (baseline != -1) {\n                            offset -= baseline;\n                        }\n                        let height = params.mBottom - params.mTop;\n                        params.mTop = offset;\n                        params.mBottom = params.mTop + height;\n                    }\n                }\n                if (this.mBaselineView == null) {\n                    this.mBaselineView = child;\n                }\n                else {\n                    let lp = this.mBaselineView.getLayoutParams();\n                    if (params.mTop < lp.mTop || (params.mTop == lp.mTop && params.mLeft < lp.mLeft)) {\n                        this.mBaselineView = child;\n                    }\n                }\n            }\n            _measureChild(child, params, myWidth, myHeight) {\n                let childWidthMeasureSpec = this.getChildMeasureSpec(params.mLeft, params.mRight, params.width, params.leftMargin, params.rightMargin, this.mPaddingLeft, this.mPaddingRight, myWidth);\n                let childHeightMeasureSpec = this.getChildMeasureSpec(params.mTop, params.mBottom, params.height, params.topMargin, params.bottomMargin, this.mPaddingTop, this.mPaddingBottom, myHeight);\n                child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n            }\n            measureChildHorizontal(child, params, myWidth, myHeight) {\n                let childWidthMeasureSpec = this.getChildMeasureSpec(params.mLeft, params.mRight, params.width, params.leftMargin, params.rightMargin, this.mPaddingLeft, this.mPaddingRight, myWidth);\n                let maxHeight = myHeight;\n                if (this.mMeasureVerticalWithPaddingMargin) {\n                    maxHeight = Math.max(0, myHeight - this.mPaddingTop - this.mPaddingBottom - params.topMargin - params.bottomMargin);\n                }\n                let childHeightMeasureSpec;\n                if (myHeight < 0 && !this.mAllowBrokenMeasureSpecs) {\n                    if (params.height >= 0) {\n                        childHeightMeasureSpec = View.MeasureSpec.makeMeasureSpec(params.height, View.MeasureSpec.EXACTLY);\n                    }\n                    else {\n                        childHeightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n                    }\n                }\n                else if (params.width == RelativeLayout.LayoutParams.MATCH_PARENT) {\n                    childHeightMeasureSpec = View.MeasureSpec.makeMeasureSpec(maxHeight, View.MeasureSpec.EXACTLY);\n                }\n                else {\n                    childHeightMeasureSpec = View.MeasureSpec.makeMeasureSpec(maxHeight, View.MeasureSpec.AT_MOST);\n                }\n                child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n            }\n            getChildMeasureSpec(childStart, childEnd, childSize, startMargin, endMargin, startPadding, endPadding, mySize) {\n                if (mySize < 0 && !this.mAllowBrokenMeasureSpecs) {\n                    if (childSize >= 0) {\n                        return View.MeasureSpec.makeMeasureSpec(childSize, View.MeasureSpec.EXACTLY);\n                    }\n                    return View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n                }\n                let childSpecMode = 0;\n                let childSpecSize = 0;\n                let tempStart = childStart;\n                let tempEnd = childEnd;\n                if (tempStart < 0) {\n                    tempStart = startPadding + startMargin;\n                }\n                if (tempEnd < 0) {\n                    tempEnd = mySize - endPadding - endMargin;\n                }\n                let maxAvailable = tempEnd - tempStart;\n                if (childStart >= 0 && childEnd >= 0) {\n                    childSpecMode = View.MeasureSpec.EXACTLY;\n                    childSpecSize = maxAvailable;\n                }\n                else {\n                    if (childSize >= 0) {\n                        childSpecMode = View.MeasureSpec.EXACTLY;\n                        if (maxAvailable >= 0) {\n                            childSpecSize = Math.min(maxAvailable, childSize);\n                        }\n                        else {\n                            childSpecSize = childSize;\n                        }\n                    }\n                    else if (childSize == RelativeLayout.LayoutParams.MATCH_PARENT) {\n                        childSpecMode = View.MeasureSpec.EXACTLY;\n                        childSpecSize = maxAvailable;\n                    }\n                    else if (childSize == RelativeLayout.LayoutParams.WRAP_CONTENT) {\n                        if (maxAvailable >= 0) {\n                            childSpecMode = View.MeasureSpec.AT_MOST;\n                            childSpecSize = maxAvailable;\n                        }\n                        else {\n                            childSpecMode = View.MeasureSpec.UNSPECIFIED;\n                            childSpecSize = 0;\n                        }\n                    }\n                }\n                return View.MeasureSpec.makeMeasureSpec(childSpecSize, childSpecMode);\n            }\n            positionChildHorizontal(child, params, myWidth, wrapContent) {\n                const layoutDirection = this.getLayoutDirection();\n                let rules = params.getRules(layoutDirection);\n                if (params.mLeft < 0 && params.mRight >= 0) {\n                    params.mLeft = params.mRight - child.getMeasuredWidth();\n                }\n                else if (params.mLeft >= 0 && params.mRight < 0) {\n                    params.mRight = params.mLeft + child.getMeasuredWidth();\n                }\n                else if (params.mLeft < 0 && params.mRight < 0) {\n                    if (rules[RelativeLayout.CENTER_IN_PARENT] != null || rules[RelativeLayout.CENTER_HORIZONTAL] != null) {\n                        if (!wrapContent) {\n                            RelativeLayout.centerHorizontal(child, params, myWidth);\n                        }\n                        else {\n                            params.mLeft = this.mPaddingLeft + params.leftMargin;\n                            params.mRight = params.mLeft + child.getMeasuredWidth();\n                        }\n                        return true;\n                    }\n                    else {\n                        if (this.isLayoutRtl()) {\n                            params.mRight = myWidth - this.mPaddingRight - params.rightMargin;\n                            params.mLeft = params.mRight - child.getMeasuredWidth();\n                        }\n                        else {\n                            params.mLeft = this.mPaddingLeft + params.leftMargin;\n                            params.mRight = params.mLeft + child.getMeasuredWidth();\n                        }\n                    }\n                }\n                return rules[RelativeLayout.ALIGN_PARENT_END] != null;\n            }\n            positionChildVertical(child, params, myHeight, wrapContent) {\n                let rules = params.getRules();\n                if (params.mTop < 0 && params.mBottom >= 0) {\n                    params.mTop = params.mBottom - child.getMeasuredHeight();\n                }\n                else if (params.mTop >= 0 && params.mBottom < 0) {\n                    params.mBottom = params.mTop + child.getMeasuredHeight();\n                }\n                else if (params.mTop < 0 && params.mBottom < 0) {\n                    if (rules[RelativeLayout.CENTER_IN_PARENT] != null || rules[RelativeLayout.CENTER_VERTICAL] != null) {\n                        if (!wrapContent) {\n                            RelativeLayout.centerVertical(child, params, myHeight);\n                        }\n                        else {\n                            params.mTop = this.mPaddingTop + params.topMargin;\n                            params.mBottom = params.mTop + child.getMeasuredHeight();\n                        }\n                        return true;\n                    }\n                    else {\n                        params.mTop = this.mPaddingTop + params.topMargin;\n                        params.mBottom = params.mTop + child.getMeasuredHeight();\n                    }\n                }\n                return rules[RelativeLayout.ALIGN_PARENT_BOTTOM] != null;\n            }\n            applyHorizontalSizeRules(childParams, myWidth, rules) {\n                let anchorParams;\n                childParams.mLeft = -1;\n                childParams.mRight = -1;\n                anchorParams = this.getRelatedViewParams(rules, RelativeLayout.LEFT_OF);\n                if (anchorParams != null) {\n                    childParams.mRight = anchorParams.mLeft - (anchorParams.leftMargin + childParams.rightMargin);\n                }\n                else if (childParams.alignWithParent && rules[RelativeLayout.LEFT_OF] != null) {\n                    if (myWidth >= 0) {\n                        childParams.mRight = myWidth - this.mPaddingRight - childParams.rightMargin;\n                    }\n                }\n                anchorParams = this.getRelatedViewParams(rules, RelativeLayout.RIGHT_OF);\n                if (anchorParams != null) {\n                    childParams.mLeft = anchorParams.mRight + (anchorParams.rightMargin + childParams.leftMargin);\n                }\n                else if (childParams.alignWithParent && rules[RelativeLayout.RIGHT_OF] != null) {\n                    childParams.mLeft = this.mPaddingLeft + childParams.leftMargin;\n                }\n                anchorParams = this.getRelatedViewParams(rules, RelativeLayout.ALIGN_LEFT);\n                if (anchorParams != null) {\n                    childParams.mLeft = anchorParams.mLeft + childParams.leftMargin;\n                }\n                else if (childParams.alignWithParent && rules[RelativeLayout.ALIGN_LEFT] != null) {\n                    childParams.mLeft = this.mPaddingLeft + childParams.leftMargin;\n                }\n                anchorParams = this.getRelatedViewParams(rules, RelativeLayout.ALIGN_RIGHT);\n                if (anchorParams != null) {\n                    childParams.mRight = anchorParams.mRight - childParams.rightMargin;\n                }\n                else if (childParams.alignWithParent && rules[RelativeLayout.ALIGN_RIGHT] != null) {\n                    if (myWidth >= 0) {\n                        childParams.mRight = myWidth - this.mPaddingRight - childParams.rightMargin;\n                    }\n                }\n                if (null != rules[RelativeLayout.ALIGN_PARENT_LEFT]) {\n                    childParams.mLeft = this.mPaddingLeft + childParams.leftMargin;\n                }\n                if (null != rules[RelativeLayout.ALIGN_PARENT_RIGHT]) {\n                    if (myWidth >= 0) {\n                        childParams.mRight = myWidth - this.mPaddingRight - childParams.rightMargin;\n                    }\n                }\n            }\n            applyVerticalSizeRules(childParams, myHeight) {\n                let rules = childParams.getRules();\n                let anchorParams;\n                childParams.mTop = -1;\n                childParams.mBottom = -1;\n                anchorParams = this.getRelatedViewParams(rules, RelativeLayout.ABOVE);\n                if (anchorParams != null) {\n                    childParams.mBottom = anchorParams.mTop - (anchorParams.topMargin + childParams.bottomMargin);\n                }\n                else if (childParams.alignWithParent && rules[RelativeLayout.ABOVE] != null) {\n                    if (myHeight >= 0) {\n                        childParams.mBottom = myHeight - this.mPaddingBottom - childParams.bottomMargin;\n                    }\n                }\n                anchorParams = this.getRelatedViewParams(rules, RelativeLayout.BELOW);\n                if (anchorParams != null) {\n                    childParams.mTop = anchorParams.mBottom + (anchorParams.bottomMargin + childParams.topMargin);\n                }\n                else if (childParams.alignWithParent && rules[RelativeLayout.BELOW] != null) {\n                    childParams.mTop = this.mPaddingTop + childParams.topMargin;\n                }\n                anchorParams = this.getRelatedViewParams(rules, RelativeLayout.ALIGN_TOP);\n                if (anchorParams != null) {\n                    childParams.mTop = anchorParams.mTop + childParams.topMargin;\n                }\n                else if (childParams.alignWithParent && rules[RelativeLayout.ALIGN_TOP] != null) {\n                    childParams.mTop = this.mPaddingTop + childParams.topMargin;\n                }\n                anchorParams = this.getRelatedViewParams(rules, RelativeLayout.ALIGN_BOTTOM);\n                if (anchorParams != null) {\n                    childParams.mBottom = anchorParams.mBottom - childParams.bottomMargin;\n                }\n                else if (childParams.alignWithParent && rules[RelativeLayout.ALIGN_BOTTOM] != null) {\n                    if (myHeight >= 0) {\n                        childParams.mBottom = myHeight - this.mPaddingBottom - childParams.bottomMargin;\n                    }\n                }\n                if (null != rules[RelativeLayout.ALIGN_PARENT_TOP]) {\n                    childParams.mTop = this.mPaddingTop + childParams.topMargin;\n                }\n                if (null != rules[RelativeLayout.ALIGN_PARENT_BOTTOM]) {\n                    if (myHeight >= 0) {\n                        childParams.mBottom = myHeight - this.mPaddingBottom - childParams.bottomMargin;\n                    }\n                }\n                if (rules[RelativeLayout.ALIGN_BASELINE] != null) {\n                    this.mHasBaselineAlignedChild = true;\n                }\n            }\n            getRelatedView(rules, relation) {\n                let id = rules[relation];\n                if (id != null) {\n                    let node = this.mGraph.mKeyNodes.get(id);\n                    if (node == null)\n                        return null;\n                    let v = node.view;\n                    while (v.getVisibility() == View.GONE) {\n                        rules = v.getLayoutParams().getRules(v.getLayoutDirection());\n                        node = this.mGraph.mKeyNodes.get((rules[relation]));\n                        if (node == null)\n                            return null;\n                        v = node.view;\n                    }\n                    return v;\n                }\n                return null;\n            }\n            getRelatedViewParams(rules, relation) {\n                let v = this.getRelatedView(rules, relation);\n                if (v != null) {\n                    let params = v.getLayoutParams();\n                    if (params instanceof RelativeLayout.LayoutParams) {\n                        return v.getLayoutParams();\n                    }\n                }\n                return null;\n            }\n            getRelatedViewBaseline(rules, relation) {\n                let v = this.getRelatedView(rules, relation);\n                if (v != null) {\n                    return v.getBaseline();\n                }\n                return -1;\n            }\n            static centerHorizontal(child, params, myWidth) {\n                let childWidth = child.getMeasuredWidth();\n                let left = (myWidth - childWidth) / 2;\n                params.mLeft = left;\n                params.mRight = left + childWidth;\n            }\n            static centerVertical(child, params, myHeight) {\n                let childHeight = child.getMeasuredHeight();\n                let top = (myHeight - childHeight) / 2;\n                params.mTop = top;\n                params.mBottom = top + childHeight;\n            }\n            onLayout(changed, l, t, r, b) {\n                const count = this.getChildCount();\n                for (let i = 0; i < count; i++) {\n                    let child = this.getChildAt(i);\n                    if (child.getVisibility() != RelativeLayout.GONE) {\n                        let st = child.getLayoutParams();\n                        child.layout(st.mLeft, st.mTop, st.mRight, st.mBottom);\n                    }\n                }\n            }\n            generateLayoutParamsFromAttr(attrs) {\n                return new RelativeLayout.LayoutParams(this.getContext(), attrs);\n            }\n            generateDefaultLayoutParams() {\n                return new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);\n            }\n            checkLayoutParams(p) {\n                return p instanceof RelativeLayout.LayoutParams;\n            }\n            generateLayoutParams(p) {\n                return new RelativeLayout.LayoutParams(p);\n            }\n        }\n        RelativeLayout.TRUE = \"\";\n        RelativeLayout.LEFT_OF = 0;\n        RelativeLayout.RIGHT_OF = 1;\n        RelativeLayout.ABOVE = 2;\n        RelativeLayout.BELOW = 3;\n        RelativeLayout.ALIGN_BASELINE = 4;\n        RelativeLayout.ALIGN_LEFT = 5;\n        RelativeLayout.ALIGN_TOP = 6;\n        RelativeLayout.ALIGN_RIGHT = 7;\n        RelativeLayout.ALIGN_BOTTOM = 8;\n        RelativeLayout.ALIGN_PARENT_LEFT = 9;\n        RelativeLayout.ALIGN_PARENT_TOP = 10;\n        RelativeLayout.ALIGN_PARENT_RIGHT = 11;\n        RelativeLayout.ALIGN_PARENT_BOTTOM = 12;\n        RelativeLayout.CENTER_IN_PARENT = 13;\n        RelativeLayout.CENTER_HORIZONTAL = 14;\n        RelativeLayout.CENTER_VERTICAL = 15;\n        RelativeLayout.START_OF = 16;\n        RelativeLayout.END_OF = 17;\n        RelativeLayout.ALIGN_START = 18;\n        RelativeLayout.ALIGN_END = 19;\n        RelativeLayout.ALIGN_PARENT_START = 20;\n        RelativeLayout.ALIGN_PARENT_END = 21;\n        RelativeLayout.VERB_COUNT = 22;\n        RelativeLayout.RULES_VERTICAL = [RelativeLayout.ABOVE, RelativeLayout.BELOW, RelativeLayout.ALIGN_BASELINE, RelativeLayout.ALIGN_TOP, RelativeLayout.ALIGN_BOTTOM];\n        RelativeLayout.RULES_HORIZONTAL = [RelativeLayout.LEFT_OF, RelativeLayout.RIGHT_OF, RelativeLayout.ALIGN_LEFT, RelativeLayout.ALIGN_RIGHT, RelativeLayout.START_OF, RelativeLayout.END_OF, RelativeLayout.ALIGN_START, RelativeLayout.ALIGN_END];\n        RelativeLayout.DEFAULT_WIDTH = 0x00010000;\n        widget.RelativeLayout = RelativeLayout;\n        (function (RelativeLayout) {\n            class LayoutParams extends ViewGroup.MarginLayoutParams {\n                constructor(...args) {\n                    super(...(() => {\n                        if (args[0] instanceof android.content.Context && args[1] instanceof HTMLElement)\n                            return [args[0], args[1]];\n                        else if (typeof args[0] === 'number' && typeof args[1] === 'number')\n                            return [args[0], args[1]];\n                        else if (args[0] instanceof RelativeLayout.LayoutParams)\n                            return [args[0]];\n                        else if (args[0] instanceof ViewGroup.MarginLayoutParams)\n                            return [args[0]];\n                        else if (args[0] instanceof ViewGroup.LayoutParams)\n                            return [args[0]];\n                    })());\n                    this.mRules = new Array(RelativeLayout.VERB_COUNT);\n                    this.mInitialRules = new Array(RelativeLayout.VERB_COUNT);\n                    this.mLeft = 0;\n                    this.mTop = 0;\n                    this.mRight = 0;\n                    this.mBottom = 0;\n                    this.mStart = LayoutParams.DEFAULT_MARGIN_RELATIVE;\n                    this.mEnd = LayoutParams.DEFAULT_MARGIN_RELATIVE;\n                    this.mRulesChanged = false;\n                    this.mIsRtlCompatibilityMode = false;\n                    if (args[0] instanceof Context && args[1] instanceof HTMLElement) {\n                        const c = args[0];\n                        const attrs = args[1];\n                        let a = c.obtainStyledAttributes(attrs);\n                        this.mIsRtlCompatibilityMode = false;\n                        const rules = this.mRules;\n                        const initialRules = this.mInitialRules;\n                        for (let attr of a.getLowerCaseNoNamespaceAttrNames()) {\n                            switch (attr) {\n                                case 'layout_alignwithparentifmissing':\n                                    this.alignWithParent = a.getBoolean(attr, false);\n                                    break;\n                                case 'layout_toleftof':\n                                    rules[RelativeLayout.LEFT_OF] = a.getResourceId(attr, null);\n                                    break;\n                                case 'layout_torightof':\n                                    rules[RelativeLayout.RIGHT_OF] = a.getResourceId(attr, null);\n                                    break;\n                                case 'layout_above':\n                                    rules[RelativeLayout.ABOVE] = a.getResourceId(attr, null);\n                                    break;\n                                case 'layout_below':\n                                    rules[RelativeLayout.BELOW] = a.getResourceId(attr, null);\n                                    break;\n                                case 'layout_alignbaseline':\n                                    rules[RelativeLayout.ALIGN_BASELINE] = a.getResourceId(attr, null);\n                                    break;\n                                case 'layout_alignleft':\n                                    rules[RelativeLayout.ALIGN_LEFT] = a.getResourceId(attr, null);\n                                    break;\n                                case 'layout_aligntop':\n                                    rules[RelativeLayout.ALIGN_TOP] = a.getResourceId(attr, null);\n                                    break;\n                                case 'layout_alignright':\n                                    rules[RelativeLayout.ALIGN_RIGHT] = a.getResourceId(attr, null);\n                                    break;\n                                case 'layout_alignbottom':\n                                    rules[RelativeLayout.ALIGN_BOTTOM] = a.getResourceId(attr, null);\n                                    break;\n                                case 'layout_alignparentleft':\n                                    rules[RelativeLayout.ALIGN_PARENT_LEFT] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                                    break;\n                                case 'layout_alignparenttop':\n                                    rules[RelativeLayout.ALIGN_PARENT_TOP] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                                    break;\n                                case 'layout_alignparentright':\n                                    rules[RelativeLayout.ALIGN_PARENT_RIGHT] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                                    break;\n                                case 'layout_alignparentbottom':\n                                    rules[RelativeLayout.ALIGN_PARENT_BOTTOM] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                                    break;\n                                case 'layout_centerinparent':\n                                    rules[RelativeLayout.CENTER_IN_PARENT] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                                    break;\n                                case 'layout_centerhorizontal':\n                                    rules[RelativeLayout.CENTER_HORIZONTAL] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                                    break;\n                                case 'layout_centervertical':\n                                    rules[RelativeLayout.CENTER_VERTICAL] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                                    break;\n                                case 'layout_tostartof':\n                                    rules[RelativeLayout.START_OF] = a.getResourceId(attr, null);\n                                    break;\n                                case 'layout_toendof':\n                                    rules[RelativeLayout.END_OF] = a.getResourceId(attr, null);\n                                    break;\n                                case 'layout_alignstart':\n                                    rules[RelativeLayout.ALIGN_START] = a.getResourceId(attr, null);\n                                    break;\n                                case 'layout_alignend':\n                                    rules[RelativeLayout.ALIGN_END] = a.getResourceId(attr, null);\n                                    break;\n                                case 'layout_alignparentstart':\n                                    rules[RelativeLayout.ALIGN_PARENT_START] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                                    break;\n                                case 'layout_alignparentend':\n                                    rules[RelativeLayout.ALIGN_PARENT_END] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                                    break;\n                            }\n                        }\n                        this.mRulesChanged = true;\n                        System.arraycopy(rules, RelativeLayout.LEFT_OF, initialRules, RelativeLayout.LEFT_OF, RelativeLayout.VERB_COUNT);\n                        a.recycle();\n                    }\n                    else if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n                        super(args[0], args[1]);\n                    }\n                    else if (args[0] instanceof RelativeLayout.LayoutParams) {\n                        const source = args[0];\n                        this.mIsRtlCompatibilityMode = source.mIsRtlCompatibilityMode;\n                        this.mRulesChanged = source.mRulesChanged;\n                        this.alignWithParent = source.alignWithParent;\n                        System.arraycopy(source.mRules, RelativeLayout.LEFT_OF, this.mRules, RelativeLayout.LEFT_OF, RelativeLayout.VERB_COUNT);\n                        System.arraycopy(source.mInitialRules, RelativeLayout.LEFT_OF, this.mInitialRules, RelativeLayout.LEFT_OF, RelativeLayout.VERB_COUNT);\n                    }\n                    else if (args[0] instanceof ViewGroup.MarginLayoutParams) {\n                    }\n                    else if (args[0] instanceof ViewGroup.LayoutParams) {\n                    }\n                }\n                createClassAttrBinder() {\n                    return super.createClassAttrBinder().set('layout_alignWithParentIfMissing', {\n                        setter(param, value, attrBinder) {\n                            param.alignWithParent = attrBinder.parseBoolean(value, false);\n                        }, getter(param) {\n                            return param.alignWithParent;\n                        }\n                    }).set('layout_toLeftOf', {\n                        setter(param, value, attrBinder) {\n                            this.addRule(RelativeLayout.LEFT_OF, value + '');\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.LEFT_OF];\n                        }\n                    }).set('layout_toRightOf', {\n                        setter(param, value, attrBinder) {\n                            this.addRule(RelativeLayout.RIGHT_OF, value + '');\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.RIGHT_OF];\n                        }\n                    }).set('layout_above', {\n                        setter(param, value, attrBinder) {\n                            this.addRule(RelativeLayout.ABOVE, value + '');\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.ABOVE];\n                        }\n                    }).set('layout_below', {\n                        setter(param, value, attrBinder) {\n                            this.addRule(RelativeLayout.BELOW, value + '');\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.BELOW];\n                        }\n                    }).set('layout_alignBaseline', {\n                        setter(param, value, attrBinder) {\n                            this.addRule(RelativeLayout.ALIGN_BASELINE, value + '');\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.ALIGN_BASELINE];\n                        }\n                    }).set('layout_alignLeft', {\n                        setter(param, value, attrBinder) {\n                            this.addRule(RelativeLayout.ALIGN_LEFT, value + '');\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.ALIGN_LEFT];\n                        }\n                    }).set('layout_alignTop', {\n                        setter(param, value, attrBinder) {\n                            this.addRule(RelativeLayout.ALIGN_TOP, value + '');\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.ALIGN_TOP];\n                        }\n                    }).set('layout_alignRight', {\n                        setter(param, value, attrBinder) {\n                            this.addRule(RelativeLayout.ALIGN_RIGHT, value + '');\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.ALIGN_RIGHT];\n                        }\n                    }).set('layout_alignBottom', {\n                        setter(param, value, attrBinder) {\n                            this.addRule(RelativeLayout.ALIGN_BOTTOM, value + '');\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.ALIGN_BOTTOM];\n                        }\n                    }).set('layout_alignParentLeft', {\n                        setter(param, value, attrBinder) {\n                            const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                            this.addRule(RelativeLayout.ALIGN_PARENT_LEFT, anchor);\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.ALIGN_PARENT_LEFT];\n                        }\n                    }).set('layout_alignParentTop', {\n                        setter(param, value, attrBinder) {\n                            const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                            this.addRule(RelativeLayout.ALIGN_PARENT_TOP, anchor);\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.ALIGN_PARENT_TOP];\n                        }\n                    }).set('layout_alignParentRight', {\n                        setter(param, value, attrBinder) {\n                            const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                            this.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, anchor);\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.ALIGN_PARENT_RIGHT];\n                        }\n                    }).set('layout_alignParentBottom', {\n                        setter(param, value, attrBinder) {\n                            const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                            this.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, anchor);\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.ALIGN_PARENT_BOTTOM];\n                        }\n                    }).set('layout_centerInParent', {\n                        setter(param, value, attrBinder) {\n                            const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                            this.addRule(RelativeLayout.CENTER_IN_PARENT, anchor);\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.CENTER_IN_PARENT];\n                        }\n                    }).set('layout_centerHorizontal', {\n                        setter(param, value, attrBinder) {\n                            const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                            this.addRule(RelativeLayout.CENTER_HORIZONTAL, anchor);\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.CENTER_HORIZONTAL];\n                        }\n                    }).set('layout_centerVertical', {\n                        setter(param, value, attrBinder) {\n                            const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                            this.addRule(RelativeLayout.CENTER_VERTICAL, anchor);\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.CENTER_VERTICAL];\n                        }\n                    }).set('layout_toStartOf', {\n                        setter(param, value, attrBinder) {\n                            this.addRule(RelativeLayout.LEFT_OF, value + '');\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.LEFT_OF];\n                        }\n                    }).set('layout_toEndOf', {\n                        setter(param, value, attrBinder) {\n                            this.addRule(RelativeLayout.RIGHT_OF, value + '');\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.RIGHT_OF];\n                        }\n                    }).set('layout_alignStart', {\n                        setter(param, value, attrBinder) {\n                            this.addRule(RelativeLayout.ALIGN_LEFT, value + '');\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.ALIGN_LEFT];\n                        }\n                    }).set('layout_alignEnd', {\n                        setter(param, value, attrBinder) {\n                            this.addRule(RelativeLayout.ALIGN_RIGHT, value + '');\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.ALIGN_RIGHT];\n                        }\n                    }).set('layout_alignParentStart', {\n                        setter(param, value, attrBinder) {\n                            const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                            this.addRule(RelativeLayout.ALIGN_PARENT_LEFT, anchor);\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.ALIGN_PARENT_LEFT];\n                        }\n                    }).set('layout_alignParentEnd', {\n                        setter(param, value, attrBinder) {\n                            const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                            this.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, anchor);\n                        }, getter(param) {\n                            return param.mRules[RelativeLayout.ALIGN_PARENT_RIGHT];\n                        }\n                    });\n                }\n                addRule(verb, anchor = RelativeLayout.TRUE) {\n                    this.mRules[verb] = anchor;\n                    this.mInitialRules[verb] = anchor;\n                    this.mRulesChanged = true;\n                }\n                removeRule(verb) {\n                    this.mRules[verb] = null;\n                    this.mInitialRules[verb] = null;\n                    this.mRulesChanged = true;\n                }\n                hasRelativeRules() {\n                    return (this.mInitialRules[RelativeLayout.START_OF] != null || this.mInitialRules[RelativeLayout.END_OF] != null\n                        || this.mInitialRules[RelativeLayout.ALIGN_START] != null || this.mInitialRules[RelativeLayout.ALIGN_END] != null\n                        || this.mInitialRules[RelativeLayout.ALIGN_PARENT_START] != null || this.mInitialRules[RelativeLayout.ALIGN_PARENT_END] != null);\n                }\n                resolveRules(layoutDirection) {\n                    const isLayoutRtl = (layoutDirection == View.LAYOUT_DIRECTION_RTL);\n                    System.arraycopy(this.mInitialRules, RelativeLayout.LEFT_OF, this.mRules, RelativeLayout.LEFT_OF, RelativeLayout.VERB_COUNT);\n                    if (this.mIsRtlCompatibilityMode) {\n                        if (this.mRules[RelativeLayout.ALIGN_START] != null) {\n                            if (this.mRules[RelativeLayout.ALIGN_LEFT] == null) {\n                                this.mRules[RelativeLayout.ALIGN_LEFT] = this.mRules[RelativeLayout.ALIGN_START];\n                            }\n                            this.mRules[RelativeLayout.ALIGN_START] = null;\n                        }\n                        if (this.mRules[RelativeLayout.ALIGN_END] != null) {\n                            if (this.mRules[RelativeLayout.ALIGN_RIGHT] == null) {\n                                this.mRules[RelativeLayout.ALIGN_RIGHT] = this.mRules[RelativeLayout.ALIGN_END];\n                            }\n                            this.mRules[RelativeLayout.ALIGN_END] = null;\n                        }\n                        if (this.mRules[RelativeLayout.START_OF] != null) {\n                            if (this.mRules[RelativeLayout.LEFT_OF] == null) {\n                                this.mRules[RelativeLayout.LEFT_OF] = this.mRules[RelativeLayout.START_OF];\n                            }\n                            this.mRules[RelativeLayout.START_OF] = null;\n                        }\n                        if (this.mRules[RelativeLayout.END_OF] != null) {\n                            if (this.mRules[RelativeLayout.RIGHT_OF] == null) {\n                                this.mRules[RelativeLayout.RIGHT_OF] = this.mRules[RelativeLayout.END_OF];\n                            }\n                            this.mRules[RelativeLayout.END_OF] = null;\n                        }\n                        if (this.mRules[RelativeLayout.ALIGN_PARENT_START] != null) {\n                            if (this.mRules[RelativeLayout.ALIGN_PARENT_LEFT] == null) {\n                                this.mRules[RelativeLayout.ALIGN_PARENT_LEFT] = this.mRules[RelativeLayout.ALIGN_PARENT_START];\n                            }\n                            this.mRules[RelativeLayout.ALIGN_PARENT_START] = null;\n                        }\n                        if (this.mRules[RelativeLayout.ALIGN_PARENT_RIGHT] == null) {\n                            if (this.mRules[RelativeLayout.ALIGN_PARENT_RIGHT] == null) {\n                                this.mRules[RelativeLayout.ALIGN_PARENT_RIGHT] = this.mRules[RelativeLayout.ALIGN_PARENT_END];\n                            }\n                            this.mRules[RelativeLayout.ALIGN_PARENT_END] = null;\n                        }\n                    }\n                    else {\n                        if ((this.mRules[RelativeLayout.ALIGN_START] != null || this.mRules[RelativeLayout.ALIGN_END] != null)\n                            && (this.mRules[RelativeLayout.ALIGN_LEFT] != null || this.mRules[RelativeLayout.ALIGN_RIGHT] != null)) {\n                            this.mRules[RelativeLayout.ALIGN_LEFT] = null;\n                            this.mRules[RelativeLayout.ALIGN_RIGHT] = null;\n                        }\n                        if (this.mRules[RelativeLayout.ALIGN_START] != null) {\n                            this.mRules[isLayoutRtl ? RelativeLayout.ALIGN_RIGHT : RelativeLayout.ALIGN_LEFT] = this.mRules[RelativeLayout.ALIGN_START];\n                            this.mRules[RelativeLayout.ALIGN_START] = null;\n                        }\n                        if (this.mRules[RelativeLayout.ALIGN_END] != null) {\n                            this.mRules[isLayoutRtl ? RelativeLayout.ALIGN_LEFT : RelativeLayout.ALIGN_RIGHT] = this.mRules[RelativeLayout.ALIGN_END];\n                            this.mRules[RelativeLayout.ALIGN_END] = null;\n                        }\n                        if ((this.mRules[RelativeLayout.START_OF] != null || this.mRules[RelativeLayout.END_OF] != null)\n                            && (this.mRules[RelativeLayout.LEFT_OF] != null || this.mRules[RelativeLayout.RIGHT_OF] != null)) {\n                            this.mRules[RelativeLayout.LEFT_OF] = null;\n                            this.mRules[RelativeLayout.RIGHT_OF] = null;\n                        }\n                        if (this.mRules[RelativeLayout.START_OF] != null) {\n                            this.mRules[isLayoutRtl ? RelativeLayout.RIGHT_OF : RelativeLayout.LEFT_OF] = this.mRules[RelativeLayout.START_OF];\n                            this.mRules[RelativeLayout.START_OF] = null;\n                        }\n                        if (this.mRules[RelativeLayout.END_OF] != null) {\n                            this.mRules[isLayoutRtl ? RelativeLayout.LEFT_OF : RelativeLayout.RIGHT_OF] = this.mRules[RelativeLayout.END_OF];\n                            this.mRules[RelativeLayout.END_OF] = null;\n                        }\n                        if ((this.mRules[RelativeLayout.ALIGN_PARENT_START] != null || this.mRules[RelativeLayout.ALIGN_PARENT_END] != null)\n                            && (this.mRules[RelativeLayout.ALIGN_PARENT_LEFT] != null || this.mRules[RelativeLayout.ALIGN_PARENT_RIGHT] != null)) {\n                            this.mRules[RelativeLayout.ALIGN_PARENT_LEFT] = null;\n                            this.mRules[RelativeLayout.ALIGN_PARENT_RIGHT] = null;\n                        }\n                        if (this.mRules[RelativeLayout.ALIGN_PARENT_START] != null) {\n                            this.mRules[isLayoutRtl ? RelativeLayout.ALIGN_PARENT_RIGHT : RelativeLayout.ALIGN_PARENT_LEFT] = this.mRules[RelativeLayout.ALIGN_PARENT_START];\n                            this.mRules[RelativeLayout.ALIGN_PARENT_START] = null;\n                        }\n                        if (this.mRules[RelativeLayout.ALIGN_PARENT_END] != null) {\n                            this.mRules[isLayoutRtl ? RelativeLayout.ALIGN_PARENT_LEFT : RelativeLayout.ALIGN_PARENT_RIGHT] = this.mRules[RelativeLayout.ALIGN_PARENT_END];\n                            this.mRules[RelativeLayout.ALIGN_PARENT_END] = null;\n                        }\n                    }\n                    this.mRulesChanged = false;\n                }\n                getRules(layoutDirection) {\n                    if (layoutDirection != null) {\n                        if (this.hasRelativeRules() && (this.mRulesChanged || layoutDirection != this.getLayoutDirection())) {\n                            this.resolveRules(layoutDirection);\n                            if (layoutDirection != this.getLayoutDirection()) {\n                                this.setLayoutDirection(layoutDirection);\n                            }\n                        }\n                    }\n                    return this.mRules;\n                }\n                resolveLayoutDirection(layoutDirection) {\n                    const isLayoutRtl = this.isLayoutRtl();\n                    if (isLayoutRtl) {\n                        if (this.mStart != LayoutParams.DEFAULT_MARGIN_RELATIVE)\n                            this.mRight = this.mStart;\n                        if (this.mEnd != LayoutParams.DEFAULT_MARGIN_RELATIVE)\n                            this.mLeft = this.mEnd;\n                    }\n                    else {\n                        if (this.mStart != LayoutParams.DEFAULT_MARGIN_RELATIVE)\n                            this.mLeft = this.mStart;\n                        if (this.mEnd != LayoutParams.DEFAULT_MARGIN_RELATIVE)\n                            this.mRight = this.mEnd;\n                    }\n                    if (this.hasRelativeRules() && layoutDirection != this.getLayoutDirection()) {\n                        this.resolveRules(layoutDirection);\n                    }\n                    super.resolveLayoutDirection(layoutDirection);\n                }\n            }\n            RelativeLayout.LayoutParams = LayoutParams;\n            class DependencyGraph {\n                constructor() {\n                    this.mNodes = new ArrayList();\n                    this.mKeyNodes = new SparseMap();\n                    this.mRoots = new ArrayDeque();\n                }\n                clear() {\n                    const nodes = this.mNodes;\n                    const count = nodes.size();\n                    for (let i = 0; i < count; i++) {\n                        nodes.get(i).release();\n                    }\n                    nodes.clear();\n                    this.mKeyNodes.clear();\n                    this.mRoots.clear();\n                }\n                add(view) {\n                    const id = view.getId();\n                    const node = DependencyGraph.Node.acquire(view);\n                    if (id != View.NO_ID) {\n                        this.mKeyNodes.put(id, node);\n                    }\n                    this.mNodes.add(node);\n                }\n                getSortedViews(sorted, rules) {\n                    const roots = this.findRoots(rules);\n                    let index = 0;\n                    let node;\n                    while ((node = roots.pollLast()) != null) {\n                        const view = node.view;\n                        const key = view.getId();\n                        sorted[index++] = view;\n                        const dependents = node.dependents;\n                        const count = dependents.size();\n                        for (let i = 0; i < count; i++) {\n                            const dependent = dependents.keyAt(i);\n                            const dependencies = dependent.dependencies;\n                            dependencies.remove(key);\n                            if (dependencies.size() == 0) {\n                                roots.add(dependent);\n                            }\n                        }\n                    }\n                    if (index < sorted.length) {\n                        throw Error(`new IllegalStateException(\"Circular dependencies cannot exist\" + \" in RelativeLayout\")`);\n                    }\n                }\n                findRoots(rulesFilter) {\n                    const keyNodes = this.mKeyNodes;\n                    const nodes = this.mNodes;\n                    const count = nodes.size();\n                    for (let i = 0; i < count; i++) {\n                        const node = nodes.get(i);\n                        node.dependents.clear();\n                        node.dependencies.clear();\n                    }\n                    for (let i = 0; i < count; i++) {\n                        const node = nodes.get(i);\n                        const layoutParams = node.view.getLayoutParams();\n                        const rules = layoutParams.mRules;\n                        const rulesCount = rulesFilter.length;\n                        for (let j = 0; j < rulesCount; j++) {\n                            const rule = rules[rulesFilter[j]];\n                            if (rule != null) {\n                                const dependency = keyNodes.get(rule);\n                                if (dependency == null || dependency == node) {\n                                    continue;\n                                }\n                                dependency.dependents.put(node, this);\n                                node.dependencies.put(rule, dependency);\n                            }\n                        }\n                    }\n                    const roots = this.mRoots;\n                    roots.clear();\n                    for (let i = 0; i < count; i++) {\n                        const node = nodes.get(i);\n                        if (node.dependencies.size() == 0)\n                            roots.addLast(node);\n                    }\n                    return roots;\n                }\n            }\n            RelativeLayout.DependencyGraph = DependencyGraph;\n            (function (DependencyGraph) {\n                class Node {\n                    constructor() {\n                        this.dependents = new ArrayMap();\n                        this.dependencies = new SparseMap();\n                    }\n                    static acquire(view) {\n                        let node = Node.sPool.acquire();\n                        if (node == null) {\n                            node = new Node();\n                        }\n                        node.view = view;\n                        return node;\n                    }\n                    release() {\n                        this.view = null;\n                        this.dependents.clear();\n                        this.dependencies.clear();\n                        Node.sPool.release(this);\n                    }\n                }\n                Node.POOL_LIMIT = 100;\n                Node.sPool = new SynchronizedPool(Node.POOL_LIMIT);\n                DependencyGraph.Node = Node;\n            })(DependencyGraph = RelativeLayout.DependencyGraph || (RelativeLayout.DependencyGraph = {}));\n        })(RelativeLayout = widget.RelativeLayout || (widget.RelativeLayout = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var text;\n    (function (text) {\n        var method;\n        (function (method) {\n            class PasswordTransformationMethod extends method.SingleLineTransformationMethod {\n                getTransformation(source, v) {\n                    let transform = super.getTransformation(source, v);\n                    if (transform)\n                        transform = new Array(transform.length + 1).join('•');\n                    return transform;\n                }\n                static getInstance() {\n                    if (PasswordTransformationMethod.instance != null)\n                        return PasswordTransformationMethod.instance;\n                    PasswordTransformationMethod.instance = new PasswordTransformationMethod();\n                    return PasswordTransformationMethod.instance;\n                }\n            }\n            method.PasswordTransformationMethod = PasswordTransformationMethod;\n        })(method = text.method || (text.method = {}));\n    })(text = android.text || (android.text = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var TextUtils = android.text.TextUtils;\n        var TextView = android.widget.TextView;\n        var Gravity = android.view.Gravity;\n        var Color = android.graphics.Color;\n        var Canvas = android.graphics.Canvas;\n        var Integer = java.lang.Integer;\n        var InputType = android.text.InputType;\n        var PasswordTransformationMethod = android.text.method.PasswordTransformationMethod;\n        var Platform = androidui.util.Platform;\n        class EditText extends TextView {\n            constructor(context, bindElement, defStyle = android.R.attr.editTextStyle) {\n                super(context, bindElement, defStyle);\n                this.mInputType = InputType.TYPE_NULL;\n                this.mForceDisableDraw = false;\n                this.mMaxLength = Integer.MAX_VALUE;\n                const a = context.obtainStyledAttributes(bindElement, defStyle);\n                const inputTypeS = a.getAttrValue(\"inputType\");\n                if (inputTypeS) {\n                    this._setInputType(inputTypeS);\n                }\n                this.mMaxLength = a.getInteger('maxLength', this.mMaxLength);\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('inputType', {\n                    setter(v, value, attrBinder) {\n                        if (Number.isInteger(Number.parseInt(value))) {\n                            v.setInputType(Number.parseInt(value));\n                        }\n                        else {\n                            v._setInputType(value + '');\n                        }\n                    }, getter(v) {\n                        return v.getInputType();\n                    }\n                }).set('maxLength', {\n                    setter(v, value, attrBinder) {\n                        v.mMaxLength = attrBinder.parseInt(value, v.mMaxLength);\n                    }, getter(v) {\n                        return v.mMaxLength;\n                    }\n                });\n            }\n            initBindElement(bindElement) {\n                super.initBindElement(bindElement);\n                this.switchToMultiLineInputElement();\n            }\n            onInputValueChange(e) {\n                let text = this.inputElement.value;\n                let filterText = '';\n                for (let i = 0, length = text.length; i < length; i++) {\n                    let c = text.codePointAt(i);\n                    if (!this.filterKeyCodeByInputType(c) && filterText.length < this.mMaxLength) {\n                        filterText += text[i];\n                    }\n                }\n                if (text != filterText) {\n                    text = filterText;\n                    this.inputElement.value = text;\n                }\n                if (!text || text.length === 0) {\n                    this.setForceDisableDrawText(false);\n                }\n                else {\n                    this.setForceDisableDrawText(true);\n                }\n                this.setText(text);\n            }\n            onDomTextInput(e) {\n                let text = e['data'];\n                for (let i = 0, length = text.length; i < length; i++) {\n                    let c = text.codePointAt(i);\n                    if (!this.filterKeyCodeOnInput(c)) {\n                        return;\n                    }\n                }\n                e.preventDefault();\n                e.stopPropagation();\n            }\n            switchToInputElement(inputElement) {\n                if (this.inputElement === inputElement)\n                    return;\n                inputElement.onblur = () => {\n                    inputElement.style.opacity = '0';\n                    this.setForceDisableDrawText(false);\n                    this.onInputElementFocusChanged(false);\n                };\n                inputElement.onfocus = () => {\n                    inputElement.style.opacity = '1';\n                    if (this.getText().length > 0) {\n                        this.setForceDisableDrawText(true);\n                    }\n                    this.onInputElementFocusChanged(true);\n                };\n                inputElement.oninput = (e) => this.onInputValueChange(e);\n                inputElement.removeEventListener('textInput', (e) => this.onDomTextInput(e));\n                inputElement.addEventListener('textInput', (e) => this.onDomTextInput(e));\n                if (this.inputElement && this.inputElement.parentElement) {\n                    this.bindElement.removeChild(this.inputElement);\n                    this.bindElement.appendChild(inputElement);\n                }\n                this.inputElement = inputElement;\n            }\n            switchToSingleLineInputElement() {\n                if (!this.mSingleLineInputElement) {\n                    this.mSingleLineInputElement = document.createElement('input');\n                    this.mSingleLineInputElement.style.position = 'absolute';\n                    this.mSingleLineInputElement.style['webkitAppearance'] = 'none';\n                    this.mSingleLineInputElement.style.borderRadius = '0';\n                    this.mSingleLineInputElement.style.overflow = 'auto';\n                    this.mSingleLineInputElement.style.background = 'transparent';\n                    this.mSingleLineInputElement.style.fontFamily = Canvas.getMeasureTextFontFamily();\n                }\n                this.switchToInputElement(this.mSingleLineInputElement);\n            }\n            switchToMultiLineInputElement() {\n                if (!this.mMultiLineInputElement) {\n                    this.mMultiLineInputElement = document.createElement('textarea');\n                    this.mMultiLineInputElement.style.position = 'absolute';\n                    this.mMultiLineInputElement.style['webkitAppearance'] = 'none';\n                    this.mMultiLineInputElement.style['resize'] = 'none';\n                    this.mMultiLineInputElement.style.borderRadius = '0';\n                    this.mMultiLineInputElement.style.overflow = 'auto';\n                    this.mMultiLineInputElement.style.background = 'transparent';\n                    this.mMultiLineInputElement.style.boxSizing = 'border-box';\n                    this.mMultiLineInputElement.style.fontFamily = Canvas.getMeasureTextFontFamily();\n                }\n                this.switchToInputElement(this.mMultiLineInputElement);\n            }\n            tryShowInputElement() {\n                if (!this.isInputElementShowed()) {\n                    this.inputElement.value = this.getText().toString();\n                    this.bindElement.appendChild(this.inputElement);\n                    this.inputElement.focus();\n                    if (this.getText().length > 0) {\n                        this.setForceDisableDrawText(true);\n                    }\n                    this.syncTextBoundInfoToInputElement();\n                }\n            }\n            tryDismissInputElement() {\n                try {\n                    if (this.inputElement.parentNode)\n                        this.bindElement.removeChild(this.inputElement);\n                }\n                catch (e) {\n                }\n                this.setForceDisableDrawText(false);\n            }\n            onInputElementFocusChanged(focused) {\n            }\n            isInputElementShowed() {\n                return this.inputElement.parentElement != null && this.inputElement.style.opacity != '0';\n            }\n            performClick(event) {\n                this.tryShowInputElement();\n                return super.performClick(event);\n            }\n            onFocusChanged(focused, direction, previouslyFocusedRect) {\n                super.onFocusChanged(focused, direction, previouslyFocusedRect);\n                if (focused) {\n                    this.tryShowInputElement();\n                }\n                else {\n                    this.tryDismissInputElement();\n                }\n            }\n            setForceDisableDrawText(disable) {\n                if (this.mForceDisableDraw == disable)\n                    return;\n                this.mForceDisableDraw = disable;\n                if (disable) {\n                    this.mSkipDrawText = true;\n                }\n                else {\n                    this.mSkipDrawText = false;\n                }\n                this.invalidate();\n            }\n            updateTextColors() {\n                super.updateTextColors();\n                if (this.isInputElementShowed()) {\n                    this.syncTextBoundInfoToInputElement();\n                }\n            }\n            onTouchEvent(event) {\n                const superResult = super.onTouchEvent(event);\n                if (this.isInputElementShowed()) {\n                    event[android.view.ViewRootImpl.ContinueEventToDom] = true;\n                    if (this.inputElement.scrollHeight > this.inputElement.offsetHeight || this.inputElement.scrollWidth > this.inputElement.offsetWidth) {\n                        this.getParent().requestDisallowInterceptTouchEvent(true);\n                    }\n                    return true;\n                }\n                return superResult;\n            }\n            filterKeyEvent(event) {\n                let keyCode = event.getKeyCode();\n                if (keyCode == android.view.KeyEvent.KEYCODE_Backspace || keyCode == android.view.KeyEvent.KEYCODE_Del\n                    || event.isCtrlPressed() || event.isAltPressed() || event.isMetaPressed()) {\n                    return false;\n                }\n                if (keyCode == android.view.KeyEvent.KEYCODE_ENTER && this.isSingleLine()) {\n                    return true;\n                }\n                if (event.mIsTypingKey) {\n                    if (this.getText().length >= this.mMaxLength) {\n                        return true;\n                    }\n                    return this.filterKeyCodeOnInput(keyCode);\n                }\n                return false;\n            }\n            filterKeyCodeByInputType(keyCode) {\n                let filter = false;\n                const inputType = this.mInputType;\n                const typeClass = inputType & InputType.TYPE_MASK_CLASS;\n                if (typeClass === InputType.TYPE_CLASS_NUMBER) {\n                    filter = InputType.LimitCode.TYPE_CLASS_NUMBER.indexOf(keyCode) === -1;\n                    if ((inputType & InputType.TYPE_NUMBER_FLAG_SIGNED) === InputType.TYPE_NUMBER_FLAG_SIGNED) {\n                        filter = filter && keyCode !== android.view.KeyEvent.KEYCODE_Minus;\n                    }\n                    if ((inputType & InputType.TYPE_NUMBER_FLAG_DECIMAL) === InputType.TYPE_NUMBER_FLAG_DECIMAL) {\n                        filter = filter && keyCode !== android.view.KeyEvent.KEYCODE_Period;\n                    }\n                }\n                else if (typeClass === InputType.TYPE_CLASS_PHONE) {\n                    filter = InputType.LimitCode.TYPE_CLASS_PHONE.indexOf(keyCode) === -1;\n                }\n                return filter;\n            }\n            filterKeyCodeOnInput(keyCode) {\n                let filter = false;\n                const inputType = this.mInputType;\n                const typeClass = inputType & InputType.TYPE_MASK_CLASS;\n                if (typeClass === InputType.TYPE_CLASS_NUMBER) {\n                    if ((inputType & InputType.TYPE_NUMBER_FLAG_SIGNED) === InputType.TYPE_NUMBER_FLAG_SIGNED) {\n                        if (keyCode === android.view.KeyEvent.KEYCODE_Minus && this.getText().length > 0) {\n                            filter = true;\n                        }\n                    }\n                    if ((inputType & InputType.TYPE_NUMBER_FLAG_DECIMAL) === InputType.TYPE_NUMBER_FLAG_DECIMAL) {\n                        if (keyCode === android.view.KeyEvent.KEYCODE_Period && (this.getText().includes('.') || this.getText().length === 0)) {\n                            filter = true;\n                        }\n                    }\n                }\n                return filter || this.filterKeyCodeByInputType(keyCode);\n            }\n            checkFilterKeyEventToDom(event) {\n                if (this.isInputElementShowed()) {\n                    if (this.filterKeyEvent(event)) {\n                        event[android.view.ViewRootImpl.ContinueEventToDom] = false;\n                    }\n                    else {\n                        event[android.view.ViewRootImpl.ContinueEventToDom] = true;\n                    }\n                    return true;\n                }\n                return false;\n            }\n            onKeyDown(keyCode, event) {\n                const filter = this.checkFilterKeyEventToDom(event);\n                return super.onKeyDown(keyCode, event) || filter;\n            }\n            onKeyUp(keyCode, event) {\n                const filter = this.checkFilterKeyEventToDom(event);\n                return super.onKeyUp(keyCode, event) || filter;\n            }\n            requestSyncBoundToElement(immediately = false) {\n                if (this.isInputElementShowed()) {\n                    immediately = true;\n                }\n                super.requestSyncBoundToElement(immediately);\n            }\n            setRawTextSize(size) {\n                super.setRawTextSize(size);\n                if (this.isInputElementShowed()) {\n                    this.syncTextBoundInfoToInputElement();\n                }\n            }\n            onTextChanged(text, start, lengthBefore, lengthAfter) {\n                if (this.isInputElementShowed()) {\n                    this.syncTextBoundInfoToInputElement();\n                }\n            }\n            onLayout(changed, left, top, right, bottom) {\n                super.onLayout(changed, left, top, right, bottom);\n                if (this.isInputElementShowed()) {\n                    this.syncTextBoundInfoToInputElement();\n                }\n            }\n            setGravity(gravity) {\n                super.setGravity(gravity);\n                if (this.isInputElementShowed()) {\n                    this.syncTextBoundInfoToInputElement();\n                }\n            }\n            setSingleLine(singleLine = true) {\n                if (singleLine) {\n                    this.switchToSingleLineInputElement();\n                }\n                else {\n                    this.switchToMultiLineInputElement();\n                }\n                super.setSingleLine(singleLine);\n            }\n            _setInputType(value) {\n                switch (value + '') {\n                    case 'none':\n                        this.setInputType(InputType.TYPE_NULL);\n                        break;\n                    case 'text':\n                        this.setInputType(InputType.TYPE_CLASS_TEXT);\n                        break;\n                    case 'textUri':\n                        this.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);\n                        break;\n                    case 'textEmailAddress':\n                        this.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);\n                        break;\n                    case 'textPassword':\n                        this.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);\n                        break;\n                    case 'textVisiblePassword':\n                        this.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);\n                        break;\n                    case 'number':\n                        this.setInputType(InputType.TYPE_CLASS_NUMBER);\n                        break;\n                    case 'numberSigned':\n                        this.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED);\n                        break;\n                    case 'numberDecimal':\n                        this.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);\n                        break;\n                    case 'numberPassword':\n                        this.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD);\n                        break;\n                    case 'phone':\n                        this.setInputType(InputType.TYPE_CLASS_PHONE);\n                        break;\n                    case 'datetime':\n                        this.setInputType(InputType.TYPE_CLASS_DATETIME);\n                        break;\n                    case 'date':\n                        this.setInputType(InputType.TYPE_CLASS_DATETIME | InputType.TYPE_DATETIME_VARIATION_DATE);\n                        break;\n                    case 'time':\n                        this.setInputType(InputType.TYPE_CLASS_DATETIME | InputType.TYPE_DATETIME_VARIATION_TIME);\n                        break;\n                }\n            }\n            setInputType(type) {\n                this.mInputType = type;\n                const typeClass = type & InputType.TYPE_MASK_CLASS;\n                this.inputElement.style['webkitTextSecurity'] = '';\n                this.setTransformationMethod(null);\n                switch (typeClass) {\n                    case InputType.TYPE_NULL:\n                        this.setSingleLine(false);\n                        this.inputElement.removeAttribute('type');\n                        break;\n                    case InputType.TYPE_CLASS_TEXT:\n                        if ((type & InputType.TYPE_TEXT_VARIATION_URI) === InputType.TYPE_TEXT_VARIATION_URI) {\n                            this.setSingleLine(true);\n                            this.inputElement.setAttribute('type', 'url');\n                        }\n                        else if ((type & InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS) === InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS) {\n                            this.setSingleLine(true);\n                            this.inputElement.setAttribute('type', 'email');\n                        }\n                        else if ((type & InputType.TYPE_TEXT_VARIATION_PASSWORD) === InputType.TYPE_TEXT_VARIATION_PASSWORD) {\n                            this.setSingleLine(true);\n                            this.inputElement.setAttribute('type', 'password');\n                            this.setTransformationMethod(PasswordTransformationMethod.getInstance());\n                        }\n                        else if ((type & InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) === InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {\n                            this.setSingleLine(true);\n                            this.inputElement.setAttribute('type', 'email');\n                        }\n                        else {\n                            this.setSingleLine(false);\n                            this.inputElement.removeAttribute('type');\n                        }\n                        break;\n                    case InputType.TYPE_CLASS_NUMBER:\n                        this.setSingleLine(true);\n                        this.inputElement.setAttribute('type', 'number');\n                        if ((type & InputType.TYPE_NUMBER_VARIATION_PASSWORD) === InputType.TYPE_NUMBER_VARIATION_PASSWORD) {\n                            this.inputElement.style['webkitTextSecurity'] = 'disc';\n                            this.setTransformationMethod(PasswordTransformationMethod.getInstance());\n                        }\n                        break;\n                    case InputType.TYPE_CLASS_PHONE:\n                        this.setSingleLine(true);\n                        this.inputElement.setAttribute('type', 'tel');\n                        break;\n                    case InputType.TYPE_CLASS_DATETIME:\n                        this.setSingleLine(true);\n                        if ((type & InputType.TYPE_DATETIME_VARIATION_DATE) === InputType.TYPE_DATETIME_VARIATION_DATE) {\n                            this.inputElement.setAttribute('type', 'date');\n                        }\n                        else if ((type & InputType.TYPE_DATETIME_VARIATION_TIME) === InputType.TYPE_DATETIME_VARIATION_TIME) {\n                            this.inputElement.setAttribute('type', 'time');\n                        }\n                        else {\n                            this.inputElement.setAttribute('type', 'datetime');\n                        }\n                        break;\n                }\n            }\n            getInputType() {\n                return this.mInputType;\n            }\n            syncTextBoundInfoToInputElement() {\n                let left = this.getLeft();\n                let top = this.getTop();\n                let right = this.getRight();\n                let bottom = this.getBottom();\n                const density = this.getResources().getDisplayMetrics().density;\n                let maxHeight = this.getMaxHeight();\n                if (maxHeight <= 0 || maxHeight >= Integer.MAX_VALUE) {\n                    let maxLine = this.getMaxLines();\n                    if (maxLine > 0 && maxLine < Integer.MAX_VALUE) {\n                        maxHeight = maxLine * this.getLineHeight();\n                    }\n                }\n                let textHeight = bottom - top - this.getCompoundPaddingTop() - this.getCompoundPaddingBottom();\n                if (maxHeight <= 0 || maxHeight > textHeight) {\n                    maxHeight = textHeight;\n                }\n                let layout = this.mLayout;\n                if (this.mHint != null && this.mText.length == 0) {\n                    layout = this.mHintLayout;\n                }\n                let height = layout ? Math.min(layout.getLineTop(layout.getLineCount()), maxHeight) : maxHeight;\n                this.inputElement.style.height = height / density + 1 + 'px';\n                this.inputElement.style.top = '';\n                this.inputElement.style.bottom = '';\n                this.inputElement.style.transform = this.inputElement.style.webkitTransform = '';\n                let gravity = this.getGravity();\n                switch (gravity & Gravity.VERTICAL_GRAVITY_MASK) {\n                    case Gravity.TOP:\n                        this.inputElement.style.top = this.getCompoundPaddingTop() / density + 'px';\n                        break;\n                    case Gravity.BOTTOM:\n                        this.inputElement.style.bottom = this.getCompoundPaddingBottom() / density + 'px';\n                        break;\n                    default:\n                        this.inputElement.style.top = '50%';\n                        this.inputElement.style.transform = this.inputElement.style.webkitTransform = 'translate(0, -50%)';\n                        break;\n                }\n                switch (gravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n                    case Gravity.LEFT:\n                        this.inputElement.style.textAlign = 'left';\n                        break;\n                    case Gravity.RIGHT:\n                        this.inputElement.style.textAlign = 'right';\n                        break;\n                    default:\n                        this.inputElement.style.textAlign = 'center';\n                        break;\n                }\n                const isIOS = Platform.isIOS;\n                this.inputElement.style.left = this.getCompoundPaddingLeft() / density - (isIOS ? 3 : 0) + 'px';\n                this.inputElement.style.width = (right - left - this.getCompoundPaddingRight() - this.getCompoundPaddingLeft()) / density + (isIOS ? 6 : 1) + 'px';\n                this.inputElement.style.lineHeight = this.getLineHeight() / density + 'px';\n                if (this.getLineCount() == 1) {\n                    this.inputElement.style.whiteSpace = 'nowrap';\n                }\n                else {\n                    this.inputElement.style.whiteSpace = '';\n                }\n                let text = this.getText().toString();\n                if (text != this.inputElement.value)\n                    this.inputElement.value = text;\n                this.inputElement.style.fontSize = this.getTextSize() / density + 'px';\n                this.inputElement.style.color = Color.toRGBAFunc(this.getCurrentTextColor());\n                if (this.inputElement == this.mMultiLineInputElement) {\n                    this.inputElement.style.padding = (this.getTextSize() / density / 5).toFixed(1) + 'px 0px 0px 0px';\n                }\n                else {\n                    this.inputElement.style.padding = '0px';\n                }\n            }\n            dependOnDebugLayout() {\n                return true;\n            }\n            setEllipsize(ellipsis) {\n                if (ellipsis == TextUtils.TruncateAt.MARQUEE) {\n                    throw Error(`new IllegalArgumentException(\"EditText cannot use the ellipsize mode \" + \"TextUtils.TruncateAt.MARQUEE\")`);\n                }\n                super.setEllipsize(ellipsis);\n            }\n        }\n        widget.EditText = EditText;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var Matrix = android.graphics.Matrix;\n        var RectF = android.graphics.RectF;\n        var View = android.view.View;\n        var Integer = java.lang.Integer;\n        var NetDrawable = androidui.image.NetDrawable;\n        var LayoutParams = android.view.ViewGroup.LayoutParams;\n        class ImageView extends View {\n            constructor(context, bindElement, defStyle) {\n                super(context, bindElement, defStyle);\n                this.mHaveFrame = false;\n                this.mAdjustViewBounds = false;\n                this.mMaxWidth = Integer.MAX_VALUE;\n                this.mMaxHeight = Integer.MAX_VALUE;\n                this.mAlpha = 255;\n                this.mViewAlphaScale = 256;\n                this.mColorMod = false;\n                this.mDrawable = null;\n                this.mState = null;\n                this.mMergeState = false;\n                this.mLevel = 0;\n                this.mDrawableWidth = 0;\n                this.mDrawableHeight = 0;\n                this.mDrawMatrix = null;\n                this.mTempSrc = new RectF();\n                this.mTempDst = new RectF();\n                this.mBaseline = -1;\n                this.mBaselineAlignBottom = false;\n                this.mAdjustViewBoundsCompat = false;\n                this.initImageView();\n                let a = context.obtainStyledAttributes(bindElement, defStyle);\n                let d = a.getDrawable('src');\n                if (d != null) {\n                    this.setImageDrawable(d);\n                }\n                this.mBaselineAlignBottom = a.getBoolean('baselineAlignBottom', false);\n                this.mBaseline = a.getDimensionPixelSize('baseline', -1);\n                this.setAdjustViewBounds(a.getBoolean('adjustViewBounds', false));\n                this.setMaxWidth(a.getDimensionPixelSize('maxWidth', Integer.MAX_VALUE));\n                this.setMaxHeight(a.getDimensionPixelSize('maxHeight', Integer.MAX_VALUE));\n                let scaleType = ImageView.parseScaleType(a.getString('scaleType'), null);\n                if (scaleType != null) {\n                    this.setScaleType(scaleType);\n                }\n                let alpha = a.getInt('drawableAlpha', 255);\n                if (alpha != 255) {\n                    this.setAlpha(alpha);\n                }\n                this.mCropToPadding = a.getBoolean('cropToPadding', false);\n                a.recycle();\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder()\n                    .set('src', {\n                    setter(v, value, attrBinder) {\n                        let d = attrBinder.parseDrawable(value);\n                        if (d)\n                            v.setImageDrawable(d);\n                        else\n                            v.setImageURI(value);\n                    }, getter(v) {\n                        return v.mDrawable;\n                    }\n                }).set('baselineAlignBottom', {\n                    setter(v, value, attrBinder) {\n                        v.setBaselineAlignBottom(attrBinder.parseBoolean(value, v.mBaselineAlignBottom));\n                    }, getter(v) {\n                        return v.getBaselineAlignBottom();\n                    }\n                }).set('baseline', {\n                    setter(v, value, attrBinder) {\n                        v.setBaseline(attrBinder.parseNumberPixelSize(value, v.mBaseline));\n                    }, getter(v) {\n                        return v.mBaseline;\n                    }\n                }).set('adjustViewBounds', {\n                    setter(v, value, attrBinder) {\n                        v.setAdjustViewBounds(attrBinder.parseBoolean(value, false));\n                    }, getter(v) {\n                        return v.getAdjustViewBounds();\n                    }\n                }).set('maxWidth', {\n                    setter(v, value, attrBinder) {\n                        let baseValue = v.getParent() instanceof View ? v.getParent().getWidth() : 0;\n                        v.setMaxWidth(attrBinder.parseNumberPixelSize(value, v.mMaxWidth, baseValue));\n                    }, getter(v) {\n                        return v.mMaxWidth;\n                    }\n                }).set('maxHeight', {\n                    setter(v, value, attrBinder) {\n                        let baseValue = v.getParent() instanceof View ? v.getParent().getHeight() : 0;\n                        v.setMaxHeight(attrBinder.parseNumberPixelSize(value, v.mMaxHeight, baseValue));\n                    }, getter(v) {\n                        return v.mMaxHeight;\n                    }\n                }).set('scaleType', {\n                    setter(v, value, attrBinder) {\n                        if (typeof value === 'number') {\n                            v.setScaleType(value);\n                        }\n                        else {\n                            v.setScaleType(ImageView.parseScaleType(value, v.mScaleType));\n                        }\n                    }, getter(v) {\n                        return v.mScaleType;\n                    }\n                }).set('drawableAlpha', {\n                    setter(v, value, attrBinder) {\n                        v.setImageAlpha(attrBinder.parseInt(value, v.mAlpha));\n                    }, getter(v) {\n                        return v.mAlpha;\n                    }\n                }).set('cropToPadding', {\n                    setter(v, value, attrBinder) {\n                        v.setCropToPadding(attrBinder.parseBoolean(value, false));\n                    }, getter(v) {\n                        return v.getCropToPadding();\n                    }\n                });\n            }\n            initImageView() {\n                this.mMatrix = new Matrix();\n                this.mScaleType = ImageView.ScaleType.FIT_CENTER;\n            }\n            verifyDrawable(dr) {\n                return this.mDrawable == dr || super.verifyDrawable(dr);\n            }\n            jumpDrawablesToCurrentState() {\n                super.jumpDrawablesToCurrentState();\n                if (this.mDrawable != null)\n                    this.mDrawable.jumpToCurrentState();\n            }\n            invalidateDrawable(dr) {\n                if (dr == this.mDrawable) {\n                    this.invalidate();\n                }\n                else {\n                    super.invalidateDrawable(dr);\n                }\n            }\n            drawableSizeChange(who) {\n                if (who == this.mDrawable) {\n                    this.resizeFromDrawable();\n                }\n                else {\n                    super.drawableSizeChange(who);\n                }\n            }\n            hasOverlappingRendering() {\n                return (this.getBackground() != null && this.getBackground().getCurrent() != null);\n            }\n            getAdjustViewBounds() {\n                return this.mAdjustViewBounds;\n            }\n            setAdjustViewBounds(adjustViewBounds) {\n                this.mAdjustViewBounds = adjustViewBounds;\n                if (adjustViewBounds) {\n                    this.setScaleType(ImageView.ScaleType.FIT_CENTER);\n                }\n            }\n            getMaxWidth() {\n                return this.mMaxWidth;\n            }\n            setMaxWidth(maxWidth) {\n                this.mMaxWidth = maxWidth;\n            }\n            getMaxHeight() {\n                return this.mMaxHeight;\n            }\n            setMaxHeight(maxHeight) {\n                this.mMaxHeight = maxHeight;\n            }\n            getDrawable() {\n                return this.mDrawable;\n            }\n            setImageURI(uri) {\n                if (this.mUri != uri) {\n                    if (this.mDrawable instanceof NetDrawable) {\n                        this.mUri = uri;\n                        this.mDrawable.setURL(uri);\n                        this.invalidate();\n                    }\n                    else {\n                        this.updateDrawable(null);\n                        this.mUri = uri;\n                        const oldWidth = this.mDrawableWidth;\n                        const oldHeight = this.mDrawableHeight;\n                        this.resolveUri();\n                        if (oldWidth != this.mDrawableWidth || oldHeight != this.mDrawableHeight) {\n                            this.requestLayout();\n                        }\n                        this.invalidate();\n                    }\n                }\n            }\n            setImageDrawable(drawable) {\n                if (this.mDrawable != drawable) {\n                    this.mUri = null;\n                    const oldWidth = this.mDrawableWidth;\n                    const oldHeight = this.mDrawableHeight;\n                    this.updateDrawable(drawable);\n                    if (oldWidth != this.mDrawableWidth || oldHeight != this.mDrawableHeight) {\n                        this.requestLayout();\n                    }\n                    this.invalidate();\n                }\n            }\n            setImageState(state, merge) {\n                this.mState = state;\n                this.mMergeState = merge;\n                if (this.mDrawable != null) {\n                    this.refreshDrawableState();\n                    this.resizeFromDrawable();\n                }\n            }\n            setSelected(selected) {\n                super.setSelected(selected);\n                this.resizeFromDrawable();\n            }\n            setImageLevel(level) {\n                this.mLevel = level;\n                if (this.mDrawable != null) {\n                    this.mDrawable.setLevel(level);\n                    this.resizeFromDrawable();\n                }\n            }\n            setScaleType(scaleType) {\n                if (scaleType == null) {\n                    throw Error(`new NullPointerException()`);\n                }\n                if (this.mScaleType != scaleType) {\n                    this.mScaleType = scaleType;\n                    this.setWillNotCacheDrawing(this.mScaleType == ImageView.ScaleType.CENTER);\n                    this.requestLayout();\n                    this.invalidate();\n                }\n            }\n            getScaleType() {\n                return this.mScaleType;\n            }\n            getImageMatrix() {\n                if (this.mDrawMatrix == null) {\n                    return new Matrix(Matrix.IDENTITY_MATRIX);\n                }\n                return this.mDrawMatrix;\n            }\n            setImageMatrix(matrix) {\n                if (matrix != null && matrix.isIdentity()) {\n                    matrix = null;\n                }\n                if (matrix == null && !this.mMatrix.isIdentity() || matrix != null && !this.mMatrix.equals(matrix)) {\n                    this.mMatrix.set(matrix);\n                    this.configureBounds();\n                    this.invalidate();\n                }\n            }\n            getCropToPadding() {\n                return this.mCropToPadding;\n            }\n            setCropToPadding(cropToPadding) {\n                if (this.mCropToPadding != cropToPadding) {\n                    this.mCropToPadding = cropToPadding;\n                    this.requestLayout();\n                    this.invalidate();\n                }\n            }\n            resolveUri() {\n                if (this.mDrawable != null) {\n                    return;\n                }\n                let d = null;\n                if (this.mUri != null) {\n                    d = new androidui.image.NetDrawable(this.mUri);\n                }\n                else {\n                    return;\n                }\n                this.updateDrawable(d);\n            }\n            onCreateDrawableState(extraSpace) {\n                if (this.mState == null) {\n                    return super.onCreateDrawableState(extraSpace);\n                }\n                else if (!this.mMergeState) {\n                    return this.mState;\n                }\n                else {\n                    return ImageView.mergeDrawableStates(super.onCreateDrawableState(extraSpace + this.mState.length), this.mState);\n                }\n            }\n            updateDrawable(d) {\n                if (this.mDrawable != null) {\n                    this.mDrawable.setCallback(null);\n                    this.unscheduleDrawable(this.mDrawable);\n                }\n                this.mDrawable = d;\n                if (d != null) {\n                    d.setCallback(this);\n                    if (d.isStateful()) {\n                        d.setState(this.getDrawableState());\n                    }\n                    d.setLevel(this.mLevel);\n                    d.setVisible(this.getVisibility() == ImageView.VISIBLE, true);\n                    this.mDrawableWidth = d.getIntrinsicWidth();\n                    this.mDrawableHeight = d.getIntrinsicHeight();\n                    this.applyColorMod();\n                    this.configureBounds();\n                }\n                else {\n                    this.mDrawableWidth = this.mDrawableHeight = -1;\n                }\n            }\n            resizeFromDrawable() {\n                let d = this.mDrawable;\n                if (d != null) {\n                    let w = d.getIntrinsicWidth();\n                    if (w < 0)\n                        w = this.mDrawableWidth;\n                    let h = d.getIntrinsicHeight();\n                    if (h < 0)\n                        h = this.mDrawableHeight;\n                    if (w != this.mDrawableWidth || h != this.mDrawableHeight) {\n                        this.mDrawableWidth = w;\n                        this.mDrawableHeight = h;\n                        if (this.mLayoutParams != null\n                            && this.mLayoutParams.width != LayoutParams.WRAP_CONTENT && this.mLayoutParams.width != LayoutParams.MATCH_PARENT\n                            && this.mLayoutParams.height != LayoutParams.WRAP_CONTENT && this.mLayoutParams.height != LayoutParams.MATCH_PARENT) {\n                            this.configureBounds();\n                        }\n                        else {\n                            this.requestLayout();\n                        }\n                        this.invalidate();\n                        return true;\n                    }\n                }\n                return false;\n            }\n            static scaleTypeToScaleToFit(st) {\n                return ImageView.sS2FArray[st - 1];\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                this.resolveUri();\n                let w;\n                let h;\n                let desiredAspect = 0.0;\n                let resizeWidth = false;\n                let resizeHeight = false;\n                const widthSpecMode = View.MeasureSpec.getMode(widthMeasureSpec);\n                const heightSpecMode = View.MeasureSpec.getMode(heightMeasureSpec);\n                if (this.mDrawable == null) {\n                    this.mDrawableWidth = -1;\n                    this.mDrawableHeight = -1;\n                    w = h = 0;\n                }\n                else {\n                    w = this.mDrawableWidth;\n                    h = this.mDrawableHeight;\n                    if (w <= 0)\n                        w = 1;\n                    if (h <= 0)\n                        h = 1;\n                    if (this.mAdjustViewBounds) {\n                        resizeWidth = widthSpecMode != View.MeasureSpec.EXACTLY;\n                        resizeHeight = heightSpecMode != View.MeasureSpec.EXACTLY;\n                        desiredAspect = w / h;\n                    }\n                }\n                let pleft = this.mPaddingLeft;\n                let pright = this.mPaddingRight;\n                let ptop = this.mPaddingTop;\n                let pbottom = this.mPaddingBottom;\n                let widthSize;\n                let heightSize;\n                if (resizeWidth || resizeHeight) {\n                    widthSize = this.resolveAdjustedSize(w + pleft + pright, this.mMaxWidth, widthMeasureSpec);\n                    heightSize = this.resolveAdjustedSize(h + ptop + pbottom, this.mMaxHeight, heightMeasureSpec);\n                    if (desiredAspect != 0.0) {\n                        let actualAspect = (widthSize - pleft - pright) / (heightSize - ptop - pbottom);\n                        if (Math.abs(actualAspect - desiredAspect) > 0.0000001) {\n                            let done = false;\n                            if (resizeWidth) {\n                                let newWidth = Math.floor((desiredAspect * (heightSize - ptop - pbottom))) + pleft + pright;\n                                if (!resizeHeight && !this.mAdjustViewBoundsCompat) {\n                                    widthSize = this.resolveAdjustedSize(newWidth, this.mMaxWidth, widthMeasureSpec);\n                                }\n                                if (newWidth <= widthSize) {\n                                    widthSize = newWidth;\n                                    done = true;\n                                }\n                            }\n                            if (!done && resizeHeight) {\n                                let newHeight = Math.floor(((widthSize - pleft - pright) / desiredAspect)) + ptop + pbottom;\n                                if (!resizeWidth && !this.mAdjustViewBoundsCompat) {\n                                    heightSize = this.resolveAdjustedSize(newHeight, this.mMaxHeight, heightMeasureSpec);\n                                }\n                                if (newHeight <= heightSize) {\n                                    heightSize = newHeight;\n                                }\n                            }\n                        }\n                    }\n                }\n                else {\n                    w += pleft + pright;\n                    h += ptop + pbottom;\n                    w = Math.max(w, this.getSuggestedMinimumWidth());\n                    h = Math.max(h, this.getSuggestedMinimumHeight());\n                    widthSize = ImageView.resolveSizeAndState(w, widthMeasureSpec, 0);\n                    heightSize = ImageView.resolveSizeAndState(h, heightMeasureSpec, 0);\n                }\n                this.setMeasuredDimension(widthSize, heightSize);\n            }\n            resolveAdjustedSize(desiredSize, maxSize, measureSpec) {\n                let result = desiredSize;\n                let specMode = View.MeasureSpec.getMode(measureSpec);\n                let specSize = View.MeasureSpec.getSize(measureSpec);\n                switch (specMode) {\n                    case View.MeasureSpec.UNSPECIFIED:\n                        result = Math.min(desiredSize, maxSize);\n                        break;\n                    case View.MeasureSpec.AT_MOST:\n                        result = Math.min(Math.min(desiredSize, specSize), maxSize);\n                        break;\n                    case View.MeasureSpec.EXACTLY:\n                        result = specSize;\n                        break;\n                }\n                return result;\n            }\n            setFrame(l, t, r, b) {\n                let changed = super.setFrame(l, t, r, b);\n                this.mHaveFrame = true;\n                this.configureBounds();\n                return changed;\n            }\n            configureBounds() {\n                if (this.mDrawable == null || !this.mHaveFrame) {\n                    return;\n                }\n                let dwidth = this.mDrawableWidth;\n                let dheight = this.mDrawableHeight;\n                let vwidth = this.getWidth() - this.mPaddingLeft - this.mPaddingRight;\n                let vheight = this.getHeight() - this.mPaddingTop - this.mPaddingBottom;\n                let fits = (dwidth < 0 || vwidth == dwidth) && (dheight < 0 || vheight == dheight);\n                if (dwidth <= 0 || dheight <= 0 || ImageView.ScaleType.FIT_XY == this.mScaleType) {\n                    this.mDrawable.setBounds(0, 0, vwidth, vheight);\n                    this.mDrawMatrix = null;\n                }\n                else {\n                    this.mDrawable.setBounds(0, 0, dwidth, dheight);\n                    if (ImageView.ScaleType.MATRIX == this.mScaleType) {\n                        if (this.mMatrix.isIdentity()) {\n                            this.mDrawMatrix = null;\n                        }\n                        else {\n                            this.mDrawMatrix = this.mMatrix;\n                        }\n                    }\n                    else if (fits) {\n                        this.mDrawMatrix = null;\n                    }\n                    else if (ImageView.ScaleType.CENTER == this.mScaleType) {\n                        this.mDrawMatrix = this.mMatrix;\n                        this.mDrawMatrix.setTranslate(Math.floor(((vwidth - dwidth) * 0.5 + 0.5)), Math.floor(((vheight - dheight) * 0.5 + 0.5)));\n                    }\n                    else if (ImageView.ScaleType.CENTER_CROP == this.mScaleType) {\n                        this.mDrawMatrix = this.mMatrix;\n                        let scale;\n                        let dx = 0, dy = 0;\n                        if (dwidth * vheight > vwidth * dheight) {\n                            scale = vheight / dheight;\n                            dx = (vwidth - dwidth * scale) * 0.5;\n                        }\n                        else {\n                            scale = vwidth / dwidth;\n                            dy = (vheight - dheight * scale) * 0.5;\n                        }\n                        this.mDrawMatrix.setScale(scale, scale);\n                        this.mDrawMatrix.postTranslate(Math.floor((dx + 0.5)), Math.floor((dy + 0.5)));\n                    }\n                    else if (ImageView.ScaleType.CENTER_INSIDE == this.mScaleType) {\n                        this.mDrawMatrix = this.mMatrix;\n                        let scale;\n                        let dx;\n                        let dy;\n                        if (dwidth <= vwidth && dheight <= vheight) {\n                            scale = 1.0;\n                        }\n                        else {\n                            scale = Math.min(vwidth / dwidth, vheight / dheight);\n                        }\n                        dx = Math.floor(((vwidth - dwidth * scale) * 0.5 + 0.5));\n                        dy = Math.floor(((vheight - dheight * scale) * 0.5 + 0.5));\n                        this.mDrawMatrix.setScale(scale, scale);\n                        this.mDrawMatrix.postTranslate(dx, dy);\n                    }\n                    else {\n                        this.mTempSrc.set(0, 0, dwidth, dheight);\n                        this.mTempDst.set(0, 0, vwidth, vheight);\n                        this.mDrawMatrix = this.mMatrix;\n                        this.mDrawMatrix.setRectToRect(this.mTempSrc, this.mTempDst, ImageView.scaleTypeToScaleToFit(this.mScaleType));\n                    }\n                }\n            }\n            drawableStateChanged() {\n                super.drawableStateChanged();\n                let d = this.mDrawable;\n                if (d != null && d.isStateful()) {\n                    d.setState(this.getDrawableState());\n                }\n            }\n            onDraw(canvas) {\n                super.onDraw(canvas);\n                if (this.mDrawable == null) {\n                    return;\n                }\n                if (this.mDrawableWidth == 0 || this.mDrawableHeight == 0) {\n                    return;\n                }\n                if (this.mDrawMatrix == null && this.mPaddingTop == 0 && this.mPaddingLeft == 0) {\n                    this.mDrawable.draw(canvas);\n                }\n                else {\n                    let saveCount = canvas.getSaveCount();\n                    canvas.save();\n                    if (this.mCropToPadding) {\n                        const scrollX = this.mScrollX;\n                        const scrollY = this.mScrollY;\n                        canvas.clipRect(scrollX + this.mPaddingLeft, scrollY + this.mPaddingTop, scrollX + this.mRight - this.mLeft - this.mPaddingRight, scrollY + this.mBottom - this.mTop - this.mPaddingBottom);\n                    }\n                    canvas.translate(this.mPaddingLeft, this.mPaddingTop);\n                    if (this.mDrawMatrix != null) {\n                        canvas.concat(this.mDrawMatrix);\n                    }\n                    this.mDrawable.draw(canvas);\n                    canvas.restoreToCount(saveCount);\n                }\n            }\n            getBaseline() {\n                if (this.mBaselineAlignBottom) {\n                    return this.getMeasuredHeight();\n                }\n                else {\n                    return this.mBaseline;\n                }\n            }\n            setBaseline(baseline) {\n                if (this.mBaseline != baseline) {\n                    this.mBaseline = baseline;\n                    this.requestLayout();\n                }\n            }\n            setBaselineAlignBottom(aligned) {\n                if (this.mBaselineAlignBottom != aligned) {\n                    this.mBaselineAlignBottom = aligned;\n                    this.requestLayout();\n                }\n            }\n            getBaselineAlignBottom() {\n                return this.mBaselineAlignBottom;\n            }\n            getImageAlpha() {\n                return this.mAlpha;\n            }\n            setImageAlpha(alpha) {\n                alpha &= 0xFF;\n                if (this.mAlpha != alpha) {\n                    this.mAlpha = alpha;\n                    this.mColorMod = true;\n                    this.applyColorMod();\n                    this.invalidate();\n                }\n            }\n            applyColorMod() {\n                if (this.mDrawable != null && this.mColorMod) {\n                    this.mDrawable = this.mDrawable.mutate();\n                    this.mDrawable.setAlpha(this.mAlpha * this.mViewAlphaScale >> 8);\n                }\n            }\n            setVisibility(visibility) {\n                super.setVisibility(visibility);\n                if (this.mDrawable != null) {\n                    this.mDrawable.setVisible(visibility == ImageView.VISIBLE, false);\n                }\n            }\n            onAttachedToWindow() {\n                super.onAttachedToWindow();\n                if (this.mDrawable != null) {\n                    this.mDrawable.setVisible(this.getVisibility() == ImageView.VISIBLE, false);\n                }\n            }\n            onDetachedFromWindow() {\n                super.onDetachedFromWindow();\n                if (this.mDrawable != null) {\n                    this.mDrawable.setVisible(false, false);\n                }\n            }\n            static parseScaleType(s, defaultType) {\n                if (s == null)\n                    return defaultType;\n                s = s.toLowerCase();\n                if (s === 'matrix'.toLowerCase())\n                    return ImageView.ScaleType.MATRIX;\n                if (s === 'fitXY'.toLowerCase())\n                    return ImageView.ScaleType.FIT_XY;\n                if (s === 'fitStart'.toLowerCase())\n                    return ImageView.ScaleType.FIT_START;\n                if (s === 'fitCenter'.toLowerCase())\n                    return ImageView.ScaleType.FIT_CENTER;\n                if (s === 'fitEnd'.toLowerCase())\n                    return ImageView.ScaleType.FIT_END;\n                if (s === 'center'.toLowerCase())\n                    return ImageView.ScaleType.CENTER;\n                if (s === 'centerCrop'.toLowerCase())\n                    return ImageView.ScaleType.CENTER_CROP;\n                if (s === 'centerInside'.toLowerCase())\n                    return ImageView.ScaleType.CENTER_INSIDE;\n                return defaultType;\n            }\n        }\n        ImageView.sS2FArray = [Matrix.ScaleToFit.FILL, Matrix.ScaleToFit.START, Matrix.ScaleToFit.CENTER, Matrix.ScaleToFit.END];\n        widget.ImageView = ImageView;\n        (function (ImageView) {\n            var ScaleType;\n            (function (ScaleType) {\n                ScaleType[ScaleType[\"MATRIX\"] = 0] = \"MATRIX\";\n                ScaleType[ScaleType[\"FIT_XY\"] = 1] = \"FIT_XY\";\n                ScaleType[ScaleType[\"FIT_START\"] = 2] = \"FIT_START\";\n                ScaleType[ScaleType[\"FIT_CENTER\"] = 3] = \"FIT_CENTER\";\n                ScaleType[ScaleType[\"FIT_END\"] = 4] = \"FIT_END\";\n                ScaleType[ScaleType[\"CENTER\"] = 5] = \"CENTER\";\n                ScaleType[ScaleType[\"CENTER_CROP\"] = 6] = \"CENTER_CROP\";\n                ScaleType[ScaleType[\"CENTER_INSIDE\"] = 7] = \"CENTER_INSIDE\";\n            })(ScaleType = ImageView.ScaleType || (ImageView.ScaleType = {}));\n        })(ImageView = widget.ImageView || (widget.ImageView = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        class ImageButton extends widget.ImageView {\n            constructor(context, bindElement, defStyle = android.R.attr.imageButtonStyle) {\n                super(context, bindElement, defStyle);\n            }\n        }\n        widget.ImageButton = ImageButton;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var Rect = android.graphics.Rect;\n        var Trace = android.os.Trace;\n        var Gravity = android.view.Gravity;\n        var KeyEvent = android.view.KeyEvent;\n        var SoundEffectConstants = android.view.SoundEffectConstants;\n        var View = android.view.View;\n        var ViewGroup = android.view.ViewGroup;\n        var Integer = java.lang.Integer;\n        var AbsListView = android.widget.AbsListView;\n        class GridView extends AbsListView {\n            constructor(context, attrs, defStyle = android.R.attr.gridViewStyle) {\n                super(context, attrs, defStyle);\n                this.mNumColumns = GridView.AUTO_FIT;\n                this.mHorizontalSpacing = 0;\n                this.mRequestedHorizontalSpacing = 0;\n                this.mVerticalSpacing = 0;\n                this.mStretchMode = GridView.STRETCH_COLUMN_WIDTH;\n                this.mColumnWidth = 0;\n                this.mRequestedColumnWidth = 0;\n                this.mRequestedNumColumns = 0;\n                this.mReferenceView = null;\n                this.mReferenceViewInSelectedRow = null;\n                this.mGravity = Gravity.LEFT;\n                this.mTempRect = new Rect();\n                let a = context.obtainStyledAttributes(attrs, defStyle);\n                let hSpacing = a.getDimensionPixelOffset('horizontalSpacing', 0);\n                this.setHorizontalSpacing(hSpacing);\n                let vSpacing = a.getDimensionPixelOffset('verticalSpacing', 0);\n                this.setVerticalSpacing(vSpacing);\n                let stretchModeS = a.getAttrValue('stretchMode');\n                if (stretchModeS) {\n                    switch (stretchModeS) {\n                        case \"none\":\n                            this.setStretchMode(GridView.NO_STRETCH);\n                            break;\n                        case \"spacingWidth\":\n                            this.setStretchMode(GridView.STRETCH_SPACING);\n                            break;\n                        case \"columnWidth\":\n                            this.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);\n                            break;\n                        case \"spacingWidthUniform\":\n                            this.setStretchMode(GridView.STRETCH_SPACING_UNIFORM);\n                            break;\n                    }\n                }\n                let columnWidth = a.getDimensionPixelOffset('columnWidth', -1);\n                if (columnWidth > 0) {\n                    this.setColumnWidth(columnWidth);\n                }\n                let numColumns = a.getInt('numColumns', 1);\n                this.setNumColumns(numColumns);\n                let gravityS = a.getAttrValue('gravity');\n                if (gravityS) {\n                    this.setGravity(Gravity.parseGravity(gravityS, this.mGravity));\n                }\n                a.recycle();\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('horizontalSpacing', {\n                    setter(v, value, attrBinder) {\n                        v.setHorizontalSpacing(attrBinder.parseNumberPixelOffset(value, 0));\n                    }, getter(v) {\n                        return v.getHorizontalSpacing();\n                    }\n                }).set('verticalSpacing', {\n                    setter(v, value, attrBinder) {\n                        v.setVerticalSpacing(attrBinder.parseNumberPixelOffset(value, 0));\n                    }, getter(v) {\n                        return v.getVerticalSpacing();\n                    }\n                }).set('stretchMode', {\n                    setter(v, value, attrBinder) {\n                        v.setStretchMode(attrBinder.parseEnum(value, new Map()\n                            .set(\"none\", GridView.NO_STRETCH)\n                            .set(\"spacingWidth\", GridView.STRETCH_SPACING)\n                            .set(\"columnWidth\", GridView.STRETCH_COLUMN_WIDTH)\n                            .set(\"spacingWidthUniform\", GridView.STRETCH_SPACING_UNIFORM), GridView.STRETCH_COLUMN_WIDTH));\n                    }, getter(v) {\n                        return v.getStretchMode();\n                    }\n                }).set('columnWidth', {\n                    setter(v, value, attrBinder) {\n                        let columnWidth = attrBinder.parseNumberPixelOffset(value, -1);\n                        if (columnWidth > 0) {\n                            this.setColumnWidth(columnWidth);\n                        }\n                    }, getter(v) {\n                        return v.getColumnWidth();\n                    }\n                }).set('numColumns', {\n                    setter(v, value, attrBinder) {\n                        v.setNumColumns(attrBinder.parseInt(value, 1));\n                    }, getter(v) {\n                        return v.getNumColumns();\n                    }\n                }).set('gravity', {\n                    setter(v, value, attrBinder) {\n                        v.setGravity(attrBinder.parseGravity(value, v.getGravity()));\n                    }, getter(v) {\n                        return v.getGravity();\n                    }\n                });\n            }\n            getAdapter() {\n                return this.mAdapter;\n            }\n            setAdapter(adapter) {\n                if (this.mAdapter != null && this.mDataSetObserver != null) {\n                    this.mAdapter.unregisterDataSetObserver(this.mDataSetObserver);\n                }\n                this.resetList();\n                this.mRecycler.clear();\n                this.mAdapter = adapter;\n                this.mOldSelectedPosition = GridView.INVALID_POSITION;\n                this.mOldSelectedRowId = GridView.INVALID_ROW_ID;\n                super.setAdapter(adapter);\n                if (this.mAdapter != null) {\n                    this.mOldItemCount = this.mItemCount;\n                    this.mItemCount = this.mAdapter.getCount();\n                    this.mDataChanged = true;\n                    this.checkFocus();\n                    this.mDataSetObserver = new AbsListView.AdapterDataSetObserver(this);\n                    this.mAdapter.registerDataSetObserver(this.mDataSetObserver);\n                    this.mRecycler.setViewTypeCount(this.mAdapter.getViewTypeCount());\n                    let position;\n                    if (this.mStackFromBottom) {\n                        position = this.lookForSelectablePosition(this.mItemCount - 1, false);\n                    }\n                    else {\n                        position = this.lookForSelectablePosition(0, true);\n                    }\n                    this.setSelectedPositionInt(position);\n                    this.setNextSelectedPositionInt(position);\n                    this.checkSelectionChanged();\n                }\n                else {\n                    this.checkFocus();\n                    this.checkSelectionChanged();\n                }\n                this.requestLayout();\n            }\n            lookForSelectablePosition(position, lookDown) {\n                const adapter = this.mAdapter;\n                if (adapter == null || this.isInTouchMode()) {\n                    return GridView.INVALID_POSITION;\n                }\n                if (position < 0 || position >= this.mItemCount) {\n                    return GridView.INVALID_POSITION;\n                }\n                return position;\n            }\n            fillGap(down) {\n                const numColumns = this.mNumColumns;\n                const verticalSpacing = this.mVerticalSpacing;\n                const count = this.getChildCount();\n                if (down) {\n                    let paddingTop = 0;\n                    if ((this.mGroupFlags & GridView.CLIP_TO_PADDING_MASK) == GridView.CLIP_TO_PADDING_MASK) {\n                        paddingTop = this.getListPaddingTop();\n                    }\n                    const startOffset = count > 0 ? this.getChildAt(count - 1).getBottom() + verticalSpacing : paddingTop;\n                    let position = this.mFirstPosition + count;\n                    if (this.mStackFromBottom) {\n                        position += numColumns - 1;\n                    }\n                    this.fillDown(position, startOffset);\n                    this.correctTooHigh(numColumns, verticalSpacing, this.getChildCount());\n                }\n                else {\n                    let paddingBottom = 0;\n                    if ((this.mGroupFlags & GridView.CLIP_TO_PADDING_MASK) == GridView.CLIP_TO_PADDING_MASK) {\n                        paddingBottom = this.getListPaddingBottom();\n                    }\n                    const startOffset = count > 0 ? this.getChildAt(0).getTop() - verticalSpacing : this.getHeight() - paddingBottom;\n                    let position = this.mFirstPosition;\n                    if (!this.mStackFromBottom) {\n                        position -= numColumns;\n                    }\n                    else {\n                        position--;\n                    }\n                    this.fillUp(position, startOffset);\n                    this.correctTooLow(numColumns, verticalSpacing, this.getChildCount());\n                }\n            }\n            fillDown(pos, nextTop) {\n                let selectedView = null;\n                let end = (this.mBottom - this.mTop);\n                if ((this.mGroupFlags & GridView.CLIP_TO_PADDING_MASK) == GridView.CLIP_TO_PADDING_MASK) {\n                    end -= this.mListPadding.bottom;\n                }\n                while (nextTop < end && pos < this.mItemCount) {\n                    let temp = this.makeRow(pos, nextTop, true);\n                    if (temp != null) {\n                        selectedView = temp;\n                    }\n                    nextTop = this.mReferenceView.getBottom() + this.mVerticalSpacing;\n                    pos += this.mNumColumns;\n                }\n                this.setVisibleRangeHint(this.mFirstPosition, this.mFirstPosition + this.getChildCount() - 1);\n                return selectedView;\n            }\n            makeRow(startPos, y, flow) {\n                const columnWidth = this.mColumnWidth;\n                const horizontalSpacing = this.mHorizontalSpacing;\n                const isLayoutRtl = this.isLayoutRtl();\n                let last;\n                let nextLeft;\n                if (isLayoutRtl) {\n                    nextLeft = this.getWidth() - this.mListPadding.right - columnWidth - ((this.mStretchMode == GridView.STRETCH_SPACING_UNIFORM) ? horizontalSpacing : 0);\n                }\n                else {\n                    nextLeft = this.mListPadding.left + ((this.mStretchMode == GridView.STRETCH_SPACING_UNIFORM) ? horizontalSpacing : 0);\n                }\n                if (!this.mStackFromBottom) {\n                    last = Math.min(startPos + this.mNumColumns, this.mItemCount);\n                }\n                else {\n                    last = startPos + 1;\n                    startPos = Math.max(0, startPos - this.mNumColumns + 1);\n                    if (last - startPos < this.mNumColumns) {\n                        const deltaLeft = (this.mNumColumns - (last - startPos)) * (columnWidth + horizontalSpacing);\n                        nextLeft += (isLayoutRtl ? -1 : +1) * deltaLeft;\n                    }\n                }\n                let selectedView = null;\n                const hasFocus = this.shouldShowSelector();\n                const inClick = this.touchModeDrawsInPressedState();\n                const selectedPosition = this.mSelectedPosition;\n                let child = null;\n                for (let pos = startPos; pos < last; pos++) {\n                    let selected = pos == selectedPosition;\n                    const where = flow ? -1 : pos - startPos;\n                    child = this.makeAndAddView(pos, y, flow, nextLeft, selected, where);\n                    nextLeft += (isLayoutRtl ? -1 : +1) * columnWidth;\n                    if (pos < last - 1) {\n                        nextLeft += horizontalSpacing;\n                    }\n                    if (selected && (hasFocus || inClick)) {\n                        selectedView = child;\n                    }\n                }\n                this.mReferenceView = child;\n                if (selectedView != null) {\n                    this.mReferenceViewInSelectedRow = this.mReferenceView;\n                }\n                return selectedView;\n            }\n            fillUp(pos, nextBottom) {\n                let selectedView = null;\n                let end = 0;\n                if ((this.mGroupFlags & GridView.CLIP_TO_PADDING_MASK) == GridView.CLIP_TO_PADDING_MASK) {\n                    end = this.mListPadding.top;\n                }\n                while (nextBottom > end && pos >= 0) {\n                    let temp = this.makeRow(pos, nextBottom, false);\n                    if (temp != null) {\n                        selectedView = temp;\n                    }\n                    nextBottom = this.mReferenceView.getTop() - this.mVerticalSpacing;\n                    this.mFirstPosition = pos;\n                    pos -= this.mNumColumns;\n                }\n                if (this.mStackFromBottom) {\n                    this.mFirstPosition = Math.max(0, pos + 1);\n                }\n                this.setVisibleRangeHint(this.mFirstPosition, this.mFirstPosition + this.getChildCount() - 1);\n                return selectedView;\n            }\n            fillFromTop(nextTop) {\n                this.mFirstPosition = Math.min(this.mFirstPosition, this.mSelectedPosition);\n                this.mFirstPosition = Math.min(this.mFirstPosition, this.mItemCount - 1);\n                if (this.mFirstPosition < 0) {\n                    this.mFirstPosition = 0;\n                }\n                this.mFirstPosition -= this.mFirstPosition % this.mNumColumns;\n                return this.fillDown(this.mFirstPosition, nextTop);\n            }\n            fillFromBottom(lastPosition, nextBottom) {\n                lastPosition = Math.max(lastPosition, this.mSelectedPosition);\n                lastPosition = Math.min(lastPosition, this.mItemCount - 1);\n                const invertedPosition = this.mItemCount - 1 - lastPosition;\n                lastPosition = this.mItemCount - 1 - (invertedPosition - (invertedPosition % this.mNumColumns));\n                return this.fillUp(lastPosition, nextBottom);\n            }\n            fillSelection(childrenTop, childrenBottom) {\n                const selectedPosition = this.reconcileSelectedPosition();\n                const numColumns = this.mNumColumns;\n                const verticalSpacing = this.mVerticalSpacing;\n                let rowStart;\n                let rowEnd = -1;\n                if (!this.mStackFromBottom) {\n                    rowStart = selectedPosition - (selectedPosition % numColumns);\n                }\n                else {\n                    const invertedSelection = this.mItemCount - 1 - selectedPosition;\n                    rowEnd = this.mItemCount - 1 - (invertedSelection - (invertedSelection % numColumns));\n                    rowStart = Math.max(0, rowEnd - numColumns + 1);\n                }\n                const fadingEdgeLength = this.getVerticalFadingEdgeLength();\n                const topSelectionPixel = this.getTopSelectionPixel(childrenTop, fadingEdgeLength, rowStart);\n                const sel = this.makeRow(this.mStackFromBottom ? rowEnd : rowStart, topSelectionPixel, true);\n                this.mFirstPosition = rowStart;\n                const referenceView = this.mReferenceView;\n                if (!this.mStackFromBottom) {\n                    this.fillDown(rowStart + numColumns, referenceView.getBottom() + verticalSpacing);\n                    this.pinToBottom(childrenBottom);\n                    this.fillUp(rowStart - numColumns, referenceView.getTop() - verticalSpacing);\n                    this.adjustViewsUpOrDown();\n                }\n                else {\n                    const bottomSelectionPixel = this.getBottomSelectionPixel(childrenBottom, fadingEdgeLength, numColumns, rowStart);\n                    const offset = bottomSelectionPixel - referenceView.getBottom();\n                    this.offsetChildrenTopAndBottom(offset);\n                    this.fillUp(rowStart - 1, referenceView.getTop() - verticalSpacing);\n                    this.pinToTop(childrenTop);\n                    this.fillDown(rowEnd + numColumns, referenceView.getBottom() + verticalSpacing);\n                    this.adjustViewsUpOrDown();\n                }\n                return sel;\n            }\n            pinToTop(childrenTop) {\n                if (this.mFirstPosition == 0) {\n                    const top = this.getChildAt(0).getTop();\n                    const offset = childrenTop - top;\n                    if (offset < 0) {\n                        this.offsetChildrenTopAndBottom(offset);\n                    }\n                }\n            }\n            pinToBottom(childrenBottom) {\n                const count = this.getChildCount();\n                if (this.mFirstPosition + count == this.mItemCount) {\n                    const bottom = this.getChildAt(count - 1).getBottom();\n                    const offset = childrenBottom - bottom;\n                    if (offset > 0) {\n                        this.offsetChildrenTopAndBottom(offset);\n                    }\n                }\n            }\n            findMotionRow(y) {\n                const childCount = this.getChildCount();\n                if (childCount > 0) {\n                    const numColumns = this.mNumColumns;\n                    if (!this.mStackFromBottom) {\n                        for (let i = 0; i < childCount; i += numColumns) {\n                            if (y <= this.getChildAt(i).getBottom()) {\n                                return this.mFirstPosition + i;\n                            }\n                        }\n                    }\n                    else {\n                        for (let i = childCount - 1; i >= 0; i -= numColumns) {\n                            if (y >= this.getChildAt(i).getTop()) {\n                                return this.mFirstPosition + i;\n                            }\n                        }\n                    }\n                }\n                return GridView.INVALID_POSITION;\n            }\n            fillSpecific(position, top) {\n                const numColumns = this.mNumColumns;\n                let motionRowStart;\n                let motionRowEnd = -1;\n                if (!this.mStackFromBottom) {\n                    motionRowStart = position - (position % numColumns);\n                }\n                else {\n                    const invertedSelection = this.mItemCount - 1 - position;\n                    motionRowEnd = this.mItemCount - 1 - (invertedSelection - (invertedSelection % numColumns));\n                    motionRowStart = Math.max(0, motionRowEnd - numColumns + 1);\n                }\n                const temp = this.makeRow(this.mStackFromBottom ? motionRowEnd : motionRowStart, top, true);\n                this.mFirstPosition = motionRowStart;\n                const referenceView = this.mReferenceView;\n                if (referenceView == null) {\n                    return null;\n                }\n                const verticalSpacing = this.mVerticalSpacing;\n                let above;\n                let below;\n                if (!this.mStackFromBottom) {\n                    above = this.fillUp(motionRowStart - numColumns, referenceView.getTop() - verticalSpacing);\n                    this.adjustViewsUpOrDown();\n                    below = this.fillDown(motionRowStart + numColumns, referenceView.getBottom() + verticalSpacing);\n                    const childCount = this.getChildCount();\n                    if (childCount > 0) {\n                        this.correctTooHigh(numColumns, verticalSpacing, childCount);\n                    }\n                }\n                else {\n                    below = this.fillDown(motionRowEnd + numColumns, referenceView.getBottom() + verticalSpacing);\n                    this.adjustViewsUpOrDown();\n                    above = this.fillUp(motionRowStart - 1, referenceView.getTop() - verticalSpacing);\n                    const childCount = this.getChildCount();\n                    if (childCount > 0) {\n                        this.correctTooLow(numColumns, verticalSpacing, childCount);\n                    }\n                }\n                if (temp != null) {\n                    return temp;\n                }\n                else if (above != null) {\n                    return above;\n                }\n                else {\n                    return below;\n                }\n            }\n            correctTooHigh(numColumns, verticalSpacing, childCount) {\n                const lastPosition = this.mFirstPosition + childCount - 1;\n                if (lastPosition == this.mItemCount - 1 && childCount > 0) {\n                    const lastChild = this.getChildAt(childCount - 1);\n                    const lastBottom = lastChild.getBottom();\n                    const end = (this.mBottom - this.mTop) - this.mListPadding.bottom;\n                    let bottomOffset = end - lastBottom;\n                    const firstChild = this.getChildAt(0);\n                    const firstTop = firstChild.getTop();\n                    if (bottomOffset > 0 && (this.mFirstPosition > 0 || firstTop < this.mListPadding.top)) {\n                        if (this.mFirstPosition == 0) {\n                            bottomOffset = Math.min(bottomOffset, this.mListPadding.top - firstTop);\n                        }\n                        this.offsetChildrenTopAndBottom(bottomOffset);\n                        if (this.mFirstPosition > 0) {\n                            this.fillUp(this.mFirstPosition - (this.mStackFromBottom ? 1 : numColumns), firstChild.getTop() - verticalSpacing);\n                            this.adjustViewsUpOrDown();\n                        }\n                    }\n                }\n            }\n            correctTooLow(numColumns, verticalSpacing, childCount) {\n                if (this.mFirstPosition == 0 && childCount > 0) {\n                    const firstChild = this.getChildAt(0);\n                    const firstTop = firstChild.getTop();\n                    const start = this.mListPadding.top;\n                    const end = (this.mBottom - this.mTop) - this.mListPadding.bottom;\n                    let topOffset = firstTop - start;\n                    const lastChild = this.getChildAt(childCount - 1);\n                    const lastBottom = lastChild.getBottom();\n                    const lastPosition = this.mFirstPosition + childCount - 1;\n                    if (topOffset > 0 && (lastPosition < this.mItemCount - 1 || lastBottom > end)) {\n                        if (lastPosition == this.mItemCount - 1) {\n                            topOffset = Math.min(topOffset, lastBottom - end);\n                        }\n                        this.offsetChildrenTopAndBottom(-topOffset);\n                        if (lastPosition < this.mItemCount - 1) {\n                            this.fillDown(lastPosition + (!this.mStackFromBottom ? 1 : numColumns), lastChild.getBottom() + verticalSpacing);\n                            this.adjustViewsUpOrDown();\n                        }\n                    }\n                }\n            }\n            fillFromSelection(selectedTop, childrenTop, childrenBottom) {\n                const fadingEdgeLength = this.getVerticalFadingEdgeLength();\n                const selectedPosition = this.mSelectedPosition;\n                const numColumns = this.mNumColumns;\n                const verticalSpacing = this.mVerticalSpacing;\n                let rowStart;\n                let rowEnd = -1;\n                if (!this.mStackFromBottom) {\n                    rowStart = selectedPosition - (selectedPosition % numColumns);\n                }\n                else {\n                    let invertedSelection = this.mItemCount - 1 - selectedPosition;\n                    rowEnd = this.mItemCount - 1 - (invertedSelection - (invertedSelection % numColumns));\n                    rowStart = Math.max(0, rowEnd - numColumns + 1);\n                }\n                let sel;\n                let referenceView;\n                let topSelectionPixel = this.getTopSelectionPixel(childrenTop, fadingEdgeLength, rowStart);\n                let bottomSelectionPixel = this.getBottomSelectionPixel(childrenBottom, fadingEdgeLength, numColumns, rowStart);\n                sel = this.makeRow(this.mStackFromBottom ? rowEnd : rowStart, selectedTop, true);\n                this.mFirstPosition = rowStart;\n                referenceView = this.mReferenceView;\n                this.adjustForTopFadingEdge(referenceView, topSelectionPixel, bottomSelectionPixel);\n                this.adjustForBottomFadingEdge(referenceView, topSelectionPixel, bottomSelectionPixel);\n                if (!this.mStackFromBottom) {\n                    this.fillUp(rowStart - numColumns, referenceView.getTop() - verticalSpacing);\n                    this.adjustViewsUpOrDown();\n                    this.fillDown(rowStart + numColumns, referenceView.getBottom() + verticalSpacing);\n                }\n                else {\n                    this.fillDown(rowEnd + numColumns, referenceView.getBottom() + verticalSpacing);\n                    this.adjustViewsUpOrDown();\n                    this.fillUp(rowStart - 1, referenceView.getTop() - verticalSpacing);\n                }\n                return sel;\n            }\n            getBottomSelectionPixel(childrenBottom, fadingEdgeLength, numColumns, rowStart) {\n                let bottomSelectionPixel = childrenBottom;\n                if (rowStart + numColumns - 1 < this.mItemCount - 1) {\n                    bottomSelectionPixel -= fadingEdgeLength;\n                }\n                return bottomSelectionPixel;\n            }\n            getTopSelectionPixel(childrenTop, fadingEdgeLength, rowStart) {\n                let topSelectionPixel = childrenTop;\n                if (rowStart > 0) {\n                    topSelectionPixel += fadingEdgeLength;\n                }\n                return topSelectionPixel;\n            }\n            adjustForBottomFadingEdge(childInSelectedRow, topSelectionPixel, bottomSelectionPixel) {\n                if (childInSelectedRow.getBottom() > bottomSelectionPixel) {\n                    let spaceAbove = childInSelectedRow.getTop() - topSelectionPixel;\n                    let spaceBelow = childInSelectedRow.getBottom() - bottomSelectionPixel;\n                    let offset = Math.min(spaceAbove, spaceBelow);\n                    this.offsetChildrenTopAndBottom(-offset);\n                }\n            }\n            adjustForTopFadingEdge(childInSelectedRow, topSelectionPixel, bottomSelectionPixel) {\n                if (childInSelectedRow.getTop() < topSelectionPixel) {\n                    let spaceAbove = topSelectionPixel - childInSelectedRow.getTop();\n                    let spaceBelow = bottomSelectionPixel - childInSelectedRow.getBottom();\n                    let offset = Math.min(spaceAbove, spaceBelow);\n                    this.offsetChildrenTopAndBottom(offset);\n                }\n            }\n            smoothScrollToPosition(position) {\n                super.smoothScrollToPosition(position);\n            }\n            smoothScrollByOffset(offset) {\n                super.smoothScrollByOffset(offset);\n            }\n            moveSelection(delta, childrenTop, childrenBottom) {\n                const fadingEdgeLength = this.getVerticalFadingEdgeLength();\n                const selectedPosition = this.mSelectedPosition;\n                const numColumns = this.mNumColumns;\n                const verticalSpacing = this.mVerticalSpacing;\n                let oldRowStart;\n                let rowStart;\n                let rowEnd = -1;\n                if (!this.mStackFromBottom) {\n                    oldRowStart = (selectedPosition - delta) - ((selectedPosition - delta) % numColumns);\n                    rowStart = selectedPosition - (selectedPosition % numColumns);\n                }\n                else {\n                    let invertedSelection = this.mItemCount - 1 - selectedPosition;\n                    rowEnd = this.mItemCount - 1 - (invertedSelection - (invertedSelection % numColumns));\n                    rowStart = Math.max(0, rowEnd - numColumns + 1);\n                    invertedSelection = this.mItemCount - 1 - (selectedPosition - delta);\n                    oldRowStart = this.mItemCount - 1 - (invertedSelection - (invertedSelection % numColumns));\n                    oldRowStart = Math.max(0, oldRowStart - numColumns + 1);\n                }\n                const rowDelta = rowStart - oldRowStart;\n                const topSelectionPixel = this.getTopSelectionPixel(childrenTop, fadingEdgeLength, rowStart);\n                const bottomSelectionPixel = this.getBottomSelectionPixel(childrenBottom, fadingEdgeLength, numColumns, rowStart);\n                this.mFirstPosition = rowStart;\n                let sel;\n                let referenceView;\n                if (rowDelta > 0) {\n                    const oldBottom = this.mReferenceViewInSelectedRow == null ? 0 : this.mReferenceViewInSelectedRow.getBottom();\n                    sel = this.makeRow(this.mStackFromBottom ? rowEnd : rowStart, oldBottom + verticalSpacing, true);\n                    referenceView = this.mReferenceView;\n                    this.adjustForBottomFadingEdge(referenceView, topSelectionPixel, bottomSelectionPixel);\n                }\n                else if (rowDelta < 0) {\n                    const oldTop = this.mReferenceViewInSelectedRow == null ? 0 : this.mReferenceViewInSelectedRow.getTop();\n                    sel = this.makeRow(this.mStackFromBottom ? rowEnd : rowStart, oldTop - verticalSpacing, false);\n                    referenceView = this.mReferenceView;\n                    this.adjustForTopFadingEdge(referenceView, topSelectionPixel, bottomSelectionPixel);\n                }\n                else {\n                    const oldTop = this.mReferenceViewInSelectedRow == null ? 0 : this.mReferenceViewInSelectedRow.getTop();\n                    sel = this.makeRow(this.mStackFromBottom ? rowEnd : rowStart, oldTop, true);\n                    referenceView = this.mReferenceView;\n                }\n                if (!this.mStackFromBottom) {\n                    this.fillUp(rowStart - numColumns, referenceView.getTop() - verticalSpacing);\n                    this.adjustViewsUpOrDown();\n                    this.fillDown(rowStart + numColumns, referenceView.getBottom() + verticalSpacing);\n                }\n                else {\n                    this.fillDown(rowEnd + numColumns, referenceView.getBottom() + verticalSpacing);\n                    this.adjustViewsUpOrDown();\n                    this.fillUp(rowStart - 1, referenceView.getTop() - verticalSpacing);\n                }\n                return sel;\n            }\n            determineColumns(availableSpace) {\n                const requestedHorizontalSpacing = this.mRequestedHorizontalSpacing;\n                const stretchMode = this.mStretchMode;\n                const requestedColumnWidth = this.mRequestedColumnWidth;\n                let didNotInitiallyFit = false;\n                if (this.mRequestedNumColumns == GridView.AUTO_FIT) {\n                    if (requestedColumnWidth > 0) {\n                        this.mNumColumns = (availableSpace + requestedHorizontalSpacing) / (requestedColumnWidth + requestedHorizontalSpacing);\n                    }\n                    else {\n                        this.mNumColumns = 2;\n                    }\n                }\n                else {\n                    this.mNumColumns = this.mRequestedNumColumns;\n                }\n                if (this.mNumColumns <= 0) {\n                    this.mNumColumns = 1;\n                }\n                switch (stretchMode) {\n                    case GridView.NO_STRETCH:\n                        this.mColumnWidth = requestedColumnWidth;\n                        this.mHorizontalSpacing = requestedHorizontalSpacing;\n                        break;\n                    default:\n                        let spaceLeftOver = availableSpace - (this.mNumColumns * requestedColumnWidth) - ((this.mNumColumns - 1) * requestedHorizontalSpacing);\n                        if (spaceLeftOver < 0) {\n                            didNotInitiallyFit = true;\n                        }\n                        switch (stretchMode) {\n                            case GridView.STRETCH_COLUMN_WIDTH:\n                                this.mColumnWidth = requestedColumnWidth + spaceLeftOver / this.mNumColumns;\n                                this.mHorizontalSpacing = requestedHorizontalSpacing;\n                                break;\n                            case GridView.STRETCH_SPACING:\n                                this.mColumnWidth = requestedColumnWidth;\n                                if (this.mNumColumns > 1) {\n                                    this.mHorizontalSpacing = requestedHorizontalSpacing + spaceLeftOver / (this.mNumColumns - 1);\n                                }\n                                else {\n                                    this.mHorizontalSpacing = requestedHorizontalSpacing + spaceLeftOver;\n                                }\n                                break;\n                            case GridView.STRETCH_SPACING_UNIFORM:\n                                this.mColumnWidth = requestedColumnWidth;\n                                if (this.mNumColumns > 1) {\n                                    this.mHorizontalSpacing = requestedHorizontalSpacing + spaceLeftOver / (this.mNumColumns + 1);\n                                }\n                                else {\n                                    this.mHorizontalSpacing = requestedHorizontalSpacing + spaceLeftOver;\n                                }\n                                break;\n                        }\n                        break;\n                }\n                return didNotInitiallyFit;\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n                let widthMode = View.MeasureSpec.getMode(widthMeasureSpec);\n                let heightMode = View.MeasureSpec.getMode(heightMeasureSpec);\n                let widthSize = View.MeasureSpec.getSize(widthMeasureSpec);\n                let heightSize = View.MeasureSpec.getSize(heightMeasureSpec);\n                if (widthMode == View.MeasureSpec.UNSPECIFIED) {\n                    if (this.mColumnWidth > 0) {\n                        widthSize = this.mColumnWidth + this.mListPadding.left + this.mListPadding.right;\n                    }\n                    else {\n                        widthSize = this.mListPadding.left + this.mListPadding.right;\n                    }\n                    widthSize += this.getVerticalScrollbarWidth();\n                }\n                let childWidth = widthSize - this.mListPadding.left - this.mListPadding.right;\n                let didNotInitiallyFit = this.determineColumns(childWidth);\n                let childHeight = 0;\n                let childState = 0;\n                this.mItemCount = this.mAdapter == null ? 0 : this.mAdapter.getCount();\n                const count = this.mItemCount;\n                if (count > 0) {\n                    const child = this.obtainView(0, this.mIsScrap);\n                    let p = child.getLayoutParams();\n                    if (p == null) {\n                        p = this.generateDefaultLayoutParams();\n                        child.setLayoutParams(p);\n                    }\n                    p.viewType = this.mAdapter.getItemViewType(0);\n                    p.forceAdd = true;\n                    let childHeightSpec = GridView.getChildMeasureSpec(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), 0, p.height);\n                    let childWidthSpec = GridView.getChildMeasureSpec(View.MeasureSpec.makeMeasureSpec(this.mColumnWidth, View.MeasureSpec.EXACTLY), 0, p.width);\n                    child.measure(childWidthSpec, childHeightSpec);\n                    childHeight = child.getMeasuredHeight();\n                    childState = GridView.combineMeasuredStates(childState, child.getMeasuredState());\n                    if (this.mRecycler.shouldRecycleViewType(p.viewType)) {\n                        this.mRecycler.addScrapView(child, -1);\n                    }\n                }\n                if (heightMode == View.MeasureSpec.UNSPECIFIED) {\n                    heightSize = this.mListPadding.top + this.mListPadding.bottom + childHeight + this.getVerticalFadingEdgeLength() * 2;\n                }\n                if (heightMode == View.MeasureSpec.AT_MOST) {\n                    let ourSize = this.mListPadding.top + this.mListPadding.bottom;\n                    const numColumns = this.mNumColumns;\n                    for (let i = 0; i < count; i += numColumns) {\n                        ourSize += childHeight;\n                        if (i + numColumns < count) {\n                            ourSize += this.mVerticalSpacing;\n                        }\n                        if (ourSize >= heightSize) {\n                            ourSize = heightSize;\n                            break;\n                        }\n                    }\n                    heightSize = ourSize;\n                }\n                if (widthMode == View.MeasureSpec.AT_MOST && this.mRequestedNumColumns != GridView.AUTO_FIT) {\n                    let ourSize = (this.mRequestedNumColumns * this.mColumnWidth) + ((this.mRequestedNumColumns - 1) * this.mHorizontalSpacing) + this.mListPadding.left + this.mListPadding.right;\n                    if (ourSize > widthSize || didNotInitiallyFit) {\n                        widthSize |= GridView.MEASURED_STATE_TOO_SMALL;\n                    }\n                }\n                this.setMeasuredDimension(widthSize, heightSize);\n                this.mWidthMeasureSpec = widthMeasureSpec;\n            }\n            layoutChildren() {\n                const blockLayoutRequests = this.mBlockLayoutRequests;\n                if (!blockLayoutRequests) {\n                    this.mBlockLayoutRequests = true;\n                }\n                try {\n                    super.layoutChildren();\n                    this.invalidate();\n                    if (this.mAdapter == null) {\n                        this.resetList();\n                        this.invokeOnItemScrollListener();\n                        return;\n                    }\n                    const childrenTop = this.mListPadding.top;\n                    const childrenBottom = this.mBottom - this.mTop - this.mListPadding.bottom;\n                    let childCount = this.getChildCount();\n                    let index;\n                    let delta = 0;\n                    let sel;\n                    let oldSel = null;\n                    let oldFirst = null;\n                    let newSel = null;\n                    switch (this.mLayoutMode) {\n                        case GridView.LAYOUT_SET_SELECTION:\n                            index = this.mNextSelectedPosition - this.mFirstPosition;\n                            if (index >= 0 && index < childCount) {\n                                newSel = this.getChildAt(index);\n                            }\n                            break;\n                        case GridView.LAYOUT_FORCE_TOP:\n                        case GridView.LAYOUT_FORCE_BOTTOM:\n                        case GridView.LAYOUT_SPECIFIC:\n                        case GridView.LAYOUT_SYNC:\n                            break;\n                        case GridView.LAYOUT_MOVE_SELECTION:\n                            if (this.mNextSelectedPosition >= 0) {\n                                delta = this.mNextSelectedPosition - this.mSelectedPosition;\n                            }\n                            break;\n                        default:\n                            index = this.mSelectedPosition - this.mFirstPosition;\n                            if (index >= 0 && index < childCount) {\n                                oldSel = this.getChildAt(index);\n                            }\n                            oldFirst = this.getChildAt(0);\n                    }\n                    let dataChanged = this.mDataChanged;\n                    if (dataChanged) {\n                        this.handleDataChanged();\n                    }\n                    if (this.mItemCount == 0) {\n                        this.resetList();\n                        this.invokeOnItemScrollListener();\n                        return;\n                    }\n                    this.setSelectedPositionInt(this.mNextSelectedPosition);\n                    const firstPosition = this.mFirstPosition;\n                    const recycleBin = this.mRecycler;\n                    if (dataChanged) {\n                        for (let i = 0; i < childCount; i++) {\n                            recycleBin.addScrapView(this.getChildAt(i), firstPosition + i);\n                        }\n                    }\n                    else {\n                        recycleBin.fillActiveViews(childCount, firstPosition);\n                    }\n                    this.detachAllViewsFromParent();\n                    recycleBin.removeSkippedScrap();\n                    switch (this.mLayoutMode) {\n                        case GridView.LAYOUT_SET_SELECTION:\n                            if (newSel != null) {\n                                sel = this.fillFromSelection(newSel.getTop(), childrenTop, childrenBottom);\n                            }\n                            else {\n                                sel = this.fillSelection(childrenTop, childrenBottom);\n                            }\n                            break;\n                        case GridView.LAYOUT_FORCE_TOP:\n                            this.mFirstPosition = 0;\n                            sel = this.fillFromTop(childrenTop);\n                            this.adjustViewsUpOrDown();\n                            break;\n                        case GridView.LAYOUT_FORCE_BOTTOM:\n                            sel = this.fillUp(this.mItemCount - 1, childrenBottom);\n                            this.adjustViewsUpOrDown();\n                            break;\n                        case GridView.LAYOUT_SPECIFIC:\n                            sel = this.fillSpecific(this.mSelectedPosition, this.mSpecificTop);\n                            break;\n                        case GridView.LAYOUT_SYNC:\n                            sel = this.fillSpecific(this.mSyncPosition, this.mSpecificTop);\n                            break;\n                        case GridView.LAYOUT_MOVE_SELECTION:\n                            sel = this.moveSelection(delta, childrenTop, childrenBottom);\n                            break;\n                        default:\n                            if (childCount == 0) {\n                                if (!this.mStackFromBottom) {\n                                    this.setSelectedPositionInt(this.mAdapter == null || this.isInTouchMode() ? GridView.INVALID_POSITION : 0);\n                                    sel = this.fillFromTop(childrenTop);\n                                }\n                                else {\n                                    const last = this.mItemCount - 1;\n                                    this.setSelectedPositionInt(this.mAdapter == null || this.isInTouchMode() ? GridView.INVALID_POSITION : last);\n                                    sel = this.fillFromBottom(last, childrenBottom);\n                                }\n                            }\n                            else {\n                                if (this.mSelectedPosition >= 0 && this.mSelectedPosition < this.mItemCount) {\n                                    sel = this.fillSpecific(this.mSelectedPosition, oldSel == null ? childrenTop : oldSel.getTop());\n                                }\n                                else if (this.mFirstPosition < this.mItemCount) {\n                                    sel = this.fillSpecific(this.mFirstPosition, oldFirst == null ? childrenTop : oldFirst.getTop());\n                                }\n                                else {\n                                    sel = this.fillSpecific(0, childrenTop);\n                                }\n                            }\n                            break;\n                    }\n                    recycleBin.scrapActiveViews();\n                    if (sel != null) {\n                        this.positionSelector(GridView.INVALID_POSITION, sel);\n                        this.mSelectedTop = sel.getTop();\n                    }\n                    else if (this.mTouchMode > GridView.TOUCH_MODE_DOWN && this.mTouchMode < GridView.TOUCH_MODE_SCROLL) {\n                        let child = this.getChildAt(this.mMotionPosition - this.mFirstPosition);\n                        if (child != null)\n                            this.positionSelector(this.mMotionPosition, child);\n                    }\n                    else {\n                        this.mSelectedTop = 0;\n                        this.mSelectorRect.setEmpty();\n                    }\n                    this.mLayoutMode = GridView.LAYOUT_NORMAL;\n                    this.mDataChanged = false;\n                    if (this.mPositionScrollAfterLayout != null) {\n                        this.post(this.mPositionScrollAfterLayout);\n                        this.mPositionScrollAfterLayout = null;\n                    }\n                    this.mNeedSync = false;\n                    this.setNextSelectedPositionInt(this.mSelectedPosition);\n                    this.updateScrollIndicators();\n                    if (this.mItemCount > 0) {\n                        this.checkSelectionChanged();\n                    }\n                    this.invokeOnItemScrollListener();\n                }\n                finally {\n                    if (!blockLayoutRequests) {\n                        this.mBlockLayoutRequests = false;\n                    }\n                }\n            }\n            makeAndAddView(position, y, flow, childrenLeft, selected, where) {\n                let child;\n                if (!this.mDataChanged) {\n                    child = this.mRecycler.getActiveView(position);\n                    if (child != null) {\n                        this.setupChild(child, position, y, flow, childrenLeft, selected, true, where);\n                        return child;\n                    }\n                }\n                child = this.obtainView(position, this.mIsScrap);\n                this.setupChild(child, position, y, flow, childrenLeft, selected, this.mIsScrap[0], where);\n                return child;\n            }\n            setupChild(child, position, y, flow, childrenLeft, selected, recycled, where) {\n                Trace.traceBegin(Trace.TRACE_TAG_VIEW, \"setupGridItem\");\n                let isSelected = selected && this.shouldShowSelector();\n                const updateChildSelected = isSelected != child.isSelected();\n                const mode = this.mTouchMode;\n                const isPressed = mode > GridView.TOUCH_MODE_DOWN && mode < GridView.TOUCH_MODE_SCROLL && this.mMotionPosition == position;\n                const updateChildPressed = isPressed != child.isPressed();\n                let needToMeasure = !recycled || updateChildSelected || child.isLayoutRequested();\n                let p = child.getLayoutParams();\n                if (p == null) {\n                    p = this.generateDefaultLayoutParams();\n                }\n                p.viewType = this.mAdapter.getItemViewType(position);\n                if (recycled && !p.forceAdd) {\n                    this.attachViewToParent(child, where, p);\n                }\n                else {\n                    p.forceAdd = false;\n                    this.addViewInLayout(child, where, p, true);\n                }\n                if (updateChildSelected) {\n                    child.setSelected(isSelected);\n                    if (isSelected) {\n                        this.requestFocus();\n                    }\n                }\n                if (updateChildPressed) {\n                    child.setPressed(isPressed);\n                }\n                if (this.mChoiceMode != GridView.CHOICE_MODE_NONE && this.mCheckStates != null) {\n                    if (child['setChecked']) {\n                        child.setChecked(this.mCheckStates.get(position));\n                    }\n                    else {\n                        child.setActivated(this.mCheckStates.get(position));\n                    }\n                }\n                if (needToMeasure) {\n                    let childHeightSpec = ViewGroup.getChildMeasureSpec(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), 0, p.height);\n                    let childWidthSpec = ViewGroup.getChildMeasureSpec(View.MeasureSpec.makeMeasureSpec(this.mColumnWidth, View.MeasureSpec.EXACTLY), 0, p.width);\n                    child.measure(childWidthSpec, childHeightSpec);\n                }\n                else {\n                    this.cleanupLayoutState(child);\n                }\n                const w = child.getMeasuredWidth();\n                const h = child.getMeasuredHeight();\n                let childLeft;\n                const childTop = flow ? y : y - h;\n                const absoluteGravity = this.mGravity;\n                switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n                    case Gravity.LEFT:\n                        childLeft = childrenLeft;\n                        break;\n                    case Gravity.CENTER_HORIZONTAL:\n                        childLeft = childrenLeft + ((this.mColumnWidth - w) / 2);\n                        break;\n                    case Gravity.RIGHT:\n                        childLeft = childrenLeft + this.mColumnWidth - w;\n                        break;\n                    default:\n                        childLeft = childrenLeft;\n                        break;\n                }\n                if (needToMeasure) {\n                    const childRight = childLeft + w;\n                    const childBottom = childTop + h;\n                    child.layout(childLeft, childTop, childRight, childBottom);\n                }\n                else {\n                    child.offsetLeftAndRight(childLeft - child.getLeft());\n                    child.offsetTopAndBottom(childTop - child.getTop());\n                }\n                if (this.mCachingStarted) {\n                    child.setDrawingCacheEnabled(true);\n                }\n                if (recycled && (child.getLayoutParams().scrappedFromPosition) != position) {\n                    child.jumpDrawablesToCurrentState();\n                }\n                Trace.traceEnd(Trace.TRACE_TAG_VIEW);\n            }\n            setSelection(position) {\n                if (!this.isInTouchMode()) {\n                    this.setNextSelectedPositionInt(position);\n                }\n                else {\n                    this.mResurrectToPosition = position;\n                }\n                this.mLayoutMode = GridView.LAYOUT_SET_SELECTION;\n                if (this.mPositionScroller != null) {\n                    this.mPositionScroller.stop();\n                }\n                this.requestLayout();\n            }\n            setSelectionInt(position) {\n                let previousSelectedPosition = this.mNextSelectedPosition;\n                if (this.mPositionScroller != null) {\n                    this.mPositionScroller.stop();\n                }\n                this.setNextSelectedPositionInt(position);\n                this.layoutChildren();\n                const next = this.mStackFromBottom ? this.mItemCount - 1 - this.mNextSelectedPosition : this.mNextSelectedPosition;\n                const previous = this.mStackFromBottom ? this.mItemCount - 1 - previousSelectedPosition : previousSelectedPosition;\n                const nextRow = next / this.mNumColumns;\n                const previousRow = previous / this.mNumColumns;\n                if (nextRow != previousRow) {\n                    this.awakenScrollBars();\n                }\n            }\n            onKeyDown(keyCode, event) {\n                return this.commonKey(keyCode, 1, event);\n            }\n            onKeyMultiple(keyCode, repeatCount, event) {\n                return this.commonKey(keyCode, repeatCount, event);\n            }\n            onKeyUp(keyCode, event) {\n                return this.commonKey(keyCode, 1, event);\n            }\n            commonKey(keyCode, count, event) {\n                if (this.mAdapter == null) {\n                    return false;\n                }\n                if (this.mDataChanged) {\n                    this.layoutChildren();\n                }\n                let handled = false;\n                let action = event.getAction();\n                if (action != KeyEvent.ACTION_UP) {\n                    switch (keyCode) {\n                        case KeyEvent.KEYCODE_DPAD_LEFT:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded() || this.arrowScroll(GridView.FOCUS_LEFT);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_DPAD_RIGHT:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded() || this.arrowScroll(GridView.FOCUS_RIGHT);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_DPAD_UP:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded() || this.arrowScroll(GridView.FOCUS_UP);\n                            }\n                            else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {\n                                handled = this.resurrectSelectionIfNeeded() || this.fullScroll(GridView.FOCUS_UP);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_DPAD_DOWN:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded() || this.arrowScroll(GridView.FOCUS_DOWN);\n                            }\n                            else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {\n                                handled = this.resurrectSelectionIfNeeded() || this.fullScroll(GridView.FOCUS_DOWN);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_DPAD_CENTER:\n                        case KeyEvent.KEYCODE_ENTER:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded();\n                                if (!handled && event.getRepeatCount() == 0 && this.getChildCount() > 0) {\n                                    this.keyPressed();\n                                    handled = true;\n                                }\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_SPACE:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded() || this.pageScroll(GridView.FOCUS_DOWN);\n                            }\n                            else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) {\n                                handled = this.resurrectSelectionIfNeeded() || this.pageScroll(GridView.FOCUS_UP);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_PAGE_UP:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded() || this.pageScroll(GridView.FOCUS_UP);\n                            }\n                            else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {\n                                handled = this.resurrectSelectionIfNeeded() || this.fullScroll(GridView.FOCUS_UP);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_PAGE_DOWN:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded() || this.pageScroll(GridView.FOCUS_DOWN);\n                            }\n                            else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {\n                                handled = this.resurrectSelectionIfNeeded() || this.fullScroll(GridView.FOCUS_DOWN);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_MOVE_HOME:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded() || this.fullScroll(GridView.FOCUS_UP);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_MOVE_END:\n                            if (event.hasNoModifiers()) {\n                                handled = this.resurrectSelectionIfNeeded() || this.fullScroll(GridView.FOCUS_DOWN);\n                            }\n                            break;\n                        case KeyEvent.KEYCODE_TAB:\n                            break;\n                    }\n                }\n                if (handled) {\n                    return true;\n                }\n                switch (action) {\n                    case KeyEvent.ACTION_DOWN:\n                        return super.onKeyDown(keyCode, event);\n                    case KeyEvent.ACTION_UP:\n                        return super.onKeyUp(keyCode, event);\n                    default:\n                        return false;\n                }\n            }\n            pageScroll(direction) {\n                let nextPage = -1;\n                if (direction == GridView.FOCUS_UP) {\n                    nextPage = Math.max(0, this.mSelectedPosition - this.getChildCount());\n                }\n                else if (direction == GridView.FOCUS_DOWN) {\n                    nextPage = Math.min(this.mItemCount - 1, this.mSelectedPosition + this.getChildCount());\n                }\n                if (nextPage >= 0) {\n                    this.setSelectionInt(nextPage);\n                    this.invokeOnItemScrollListener();\n                    this.awakenScrollBars();\n                    return true;\n                }\n                return false;\n            }\n            fullScroll(direction) {\n                let moved = false;\n                if (direction == GridView.FOCUS_UP) {\n                    this.mLayoutMode = GridView.LAYOUT_SET_SELECTION;\n                    this.setSelectionInt(0);\n                    this.invokeOnItemScrollListener();\n                    moved = true;\n                }\n                else if (direction == GridView.FOCUS_DOWN) {\n                    this.mLayoutMode = GridView.LAYOUT_SET_SELECTION;\n                    this.setSelectionInt(this.mItemCount - 1);\n                    this.invokeOnItemScrollListener();\n                    moved = true;\n                }\n                if (moved) {\n                    this.awakenScrollBars();\n                }\n                return moved;\n            }\n            arrowScroll(direction) {\n                const selectedPosition = this.mSelectedPosition;\n                const numColumns = this.mNumColumns;\n                let startOfRowPos;\n                let endOfRowPos;\n                let moved = false;\n                if (!this.mStackFromBottom) {\n                    startOfRowPos = Math.floor(selectedPosition / numColumns) * numColumns;\n                    endOfRowPos = Math.min(startOfRowPos + numColumns - 1, this.mItemCount - 1);\n                }\n                else {\n                    const invertedSelection = this.mItemCount - 1 - selectedPosition;\n                    endOfRowPos = this.mItemCount - 1 - (invertedSelection / numColumns) * numColumns;\n                    startOfRowPos = Math.max(0, endOfRowPos - numColumns + 1);\n                }\n                switch (direction) {\n                    case GridView.FOCUS_UP:\n                        if (startOfRowPos > 0) {\n                            this.mLayoutMode = GridView.LAYOUT_MOVE_SELECTION;\n                            this.setSelectionInt(Math.max(0, selectedPosition - numColumns));\n                            moved = true;\n                        }\n                        break;\n                    case GridView.FOCUS_DOWN:\n                        if (endOfRowPos < this.mItemCount - 1) {\n                            this.mLayoutMode = GridView.LAYOUT_MOVE_SELECTION;\n                            this.setSelectionInt(Math.min(selectedPosition + numColumns, this.mItemCount - 1));\n                            moved = true;\n                        }\n                        break;\n                    case GridView.FOCUS_LEFT:\n                        if (selectedPosition > startOfRowPos) {\n                            this.mLayoutMode = GridView.LAYOUT_MOVE_SELECTION;\n                            this.setSelectionInt(Math.max(0, selectedPosition - 1));\n                            moved = true;\n                        }\n                        break;\n                    case GridView.FOCUS_RIGHT:\n                        if (selectedPosition < endOfRowPos) {\n                            this.mLayoutMode = GridView.LAYOUT_MOVE_SELECTION;\n                            this.setSelectionInt(Math.min(selectedPosition + 1, this.mItemCount - 1));\n                            moved = true;\n                        }\n                        break;\n                }\n                if (moved) {\n                    this.playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));\n                    this.invokeOnItemScrollListener();\n                }\n                if (moved) {\n                    this.awakenScrollBars();\n                }\n                return moved;\n            }\n            sequenceScroll(direction) {\n                let selectedPosition = this.mSelectedPosition;\n                let numColumns = this.mNumColumns;\n                let count = this.mItemCount;\n                let startOfRow;\n                let endOfRow;\n                if (!this.mStackFromBottom) {\n                    startOfRow = (selectedPosition / numColumns) * numColumns;\n                    endOfRow = Math.min(startOfRow + numColumns - 1, count - 1);\n                }\n                else {\n                    let invertedSelection = count - 1 - selectedPosition;\n                    endOfRow = count - 1 - (invertedSelection / numColumns) * numColumns;\n                    startOfRow = Math.max(0, endOfRow - numColumns + 1);\n                }\n                let moved = false;\n                let showScroll = false;\n                switch (direction) {\n                    case GridView.FOCUS_FORWARD:\n                        if (selectedPosition < count - 1) {\n                            this.mLayoutMode = GridView.LAYOUT_MOVE_SELECTION;\n                            this.setSelectionInt(selectedPosition + 1);\n                            moved = true;\n                            showScroll = selectedPosition == endOfRow;\n                        }\n                        break;\n                    case GridView.FOCUS_BACKWARD:\n                        if (selectedPosition > 0) {\n                            this.mLayoutMode = GridView.LAYOUT_MOVE_SELECTION;\n                            this.setSelectionInt(selectedPosition - 1);\n                            moved = true;\n                            showScroll = selectedPosition == startOfRow;\n                        }\n                        break;\n                }\n                if (moved) {\n                    this.playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));\n                    this.invokeOnItemScrollListener();\n                }\n                if (showScroll) {\n                    this.awakenScrollBars();\n                }\n                return moved;\n            }\n            onFocusChanged(gainFocus, direction, previouslyFocusedRect) {\n                super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);\n                let closestChildIndex = -1;\n                if (gainFocus && previouslyFocusedRect != null) {\n                    previouslyFocusedRect.offset(this.mScrollX, this.mScrollY);\n                    let otherRect = this.mTempRect;\n                    let minDistance = Integer.MAX_VALUE;\n                    const childCount = this.getChildCount();\n                    for (let i = 0; i < childCount; i++) {\n                        if (!this.isCandidateSelection(i, direction)) {\n                            continue;\n                        }\n                        const other = this.getChildAt(i);\n                        other.getDrawingRect(otherRect);\n                        this.offsetDescendantRectToMyCoords(other, otherRect);\n                        let distance = GridView.getDistance(previouslyFocusedRect, otherRect, direction);\n                        if (distance < minDistance) {\n                            minDistance = distance;\n                            closestChildIndex = i;\n                        }\n                    }\n                }\n                if (closestChildIndex >= 0) {\n                    this.setSelection(closestChildIndex + this.mFirstPosition);\n                }\n                else {\n                    this.requestLayout();\n                }\n            }\n            isCandidateSelection(childIndex, direction) {\n                const count = this.getChildCount();\n                const invertedIndex = count - 1 - childIndex;\n                let rowStart;\n                let rowEnd;\n                if (!this.mStackFromBottom) {\n                    rowStart = childIndex - (childIndex % this.mNumColumns);\n                    rowEnd = Math.max(rowStart + this.mNumColumns - 1, count);\n                }\n                else {\n                    rowEnd = count - 1 - (invertedIndex - (invertedIndex % this.mNumColumns));\n                    rowStart = Math.max(0, rowEnd - this.mNumColumns + 1);\n                }\n                switch (direction) {\n                    case View.FOCUS_RIGHT:\n                        return childIndex == rowStart;\n                    case View.FOCUS_DOWN:\n                        return rowStart == 0;\n                    case View.FOCUS_LEFT:\n                        return childIndex == rowEnd;\n                    case View.FOCUS_UP:\n                        return rowEnd == count - 1;\n                    case View.FOCUS_FORWARD:\n                        return childIndex == rowStart && rowStart == 0;\n                    case View.FOCUS_BACKWARD:\n                        return childIndex == rowEnd && rowEnd == count - 1;\n                    default:\n                        throw Error(`new IllegalArgumentException(\"direction must be one of \" + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, \" + \"FOCUS_FORWARD, FOCUS_BACKWARD}.\")`);\n                }\n            }\n            setGravity(gravity) {\n                if (this.mGravity != gravity) {\n                    this.mGravity = gravity;\n                    this.requestLayoutIfNecessary();\n                }\n            }\n            getGravity() {\n                return this.mGravity;\n            }\n            setHorizontalSpacing(horizontalSpacing) {\n                if (horizontalSpacing != this.mRequestedHorizontalSpacing) {\n                    this.mRequestedHorizontalSpacing = horizontalSpacing;\n                    this.requestLayoutIfNecessary();\n                }\n            }\n            getHorizontalSpacing() {\n                return this.mHorizontalSpacing;\n            }\n            getRequestedHorizontalSpacing() {\n                return this.mRequestedHorizontalSpacing;\n            }\n            setVerticalSpacing(verticalSpacing) {\n                if (verticalSpacing != this.mVerticalSpacing) {\n                    this.mVerticalSpacing = verticalSpacing;\n                    this.requestLayoutIfNecessary();\n                }\n            }\n            getVerticalSpacing() {\n                return this.mVerticalSpacing;\n            }\n            setStretchMode(stretchMode) {\n                if (stretchMode != this.mStretchMode) {\n                    this.mStretchMode = stretchMode;\n                    this.requestLayoutIfNecessary();\n                }\n            }\n            getStretchMode() {\n                return this.mStretchMode;\n            }\n            setColumnWidth(columnWidth) {\n                if (columnWidth != this.mRequestedColumnWidth) {\n                    this.mRequestedColumnWidth = columnWidth;\n                    this.requestLayoutIfNecessary();\n                }\n            }\n            getColumnWidth() {\n                return this.mColumnWidth;\n            }\n            getRequestedColumnWidth() {\n                return this.mRequestedColumnWidth;\n            }\n            setNumColumns(numColumns) {\n                if (numColumns != this.mRequestedNumColumns) {\n                    this.mRequestedNumColumns = numColumns;\n                    this.requestLayoutIfNecessary();\n                }\n            }\n            getNumColumns() {\n                return this.mNumColumns;\n            }\n            adjustViewsUpOrDown() {\n                const childCount = this.getChildCount();\n                if (childCount > 0) {\n                    let delta;\n                    let child;\n                    if (!this.mStackFromBottom) {\n                        child = this.getChildAt(0);\n                        delta = child.getTop() - this.mListPadding.top;\n                        if (this.mFirstPosition != 0) {\n                            delta -= this.mVerticalSpacing;\n                        }\n                        if (delta < 0) {\n                            delta = 0;\n                        }\n                    }\n                    else {\n                        child = this.getChildAt(childCount - 1);\n                        delta = child.getBottom() - (this.getHeight() - this.mListPadding.bottom);\n                        if (this.mFirstPosition + childCount < this.mItemCount) {\n                            delta += this.mVerticalSpacing;\n                        }\n                        if (delta > 0) {\n                            delta = 0;\n                        }\n                    }\n                    if (delta != 0) {\n                        this.offsetChildrenTopAndBottom(-delta);\n                    }\n                }\n            }\n            computeVerticalScrollExtent() {\n                const count = this.getChildCount();\n                if (count > 0) {\n                    const numColumns = this.mNumColumns;\n                    const rowCount = (count + numColumns - 1) / numColumns;\n                    let extent = rowCount * 100;\n                    let view = this.getChildAt(0);\n                    const top = view.getTop();\n                    let height = view.getHeight();\n                    if (height > 0) {\n                        extent += (top * 100) / height;\n                    }\n                    view = this.getChildAt(count - 1);\n                    const bottom = view.getBottom();\n                    height = view.getHeight();\n                    if (height > 0) {\n                        extent -= ((bottom - this.getHeight()) * 100) / height;\n                    }\n                    return extent;\n                }\n                return 0;\n            }\n            computeVerticalScrollOffset() {\n                if (this.mFirstPosition >= 0 && this.getChildCount() > 0) {\n                    const view = this.getChildAt(0);\n                    const top = view.getTop();\n                    let height = view.getHeight();\n                    if (height > 0) {\n                        const numColumns = this.mNumColumns;\n                        const rowCount = (this.mItemCount + numColumns - 1) / numColumns;\n                        const oddItemsOnFirstRow = this.isStackFromBottom() ? ((rowCount * numColumns) - this.mItemCount) : 0;\n                        const whichRow = (this.mFirstPosition + oddItemsOnFirstRow) / numColumns;\n                        return Math.max(whichRow * 100 - (top * 100) / height + Math.floor((this.mScrollY / this.getHeight() * rowCount * 100)), 0);\n                    }\n                }\n                return 0;\n            }\n            computeVerticalScrollRange() {\n                const numColumns = this.mNumColumns;\n                const rowCount = (this.mItemCount + numColumns - 1) / numColumns;\n                let result = Math.max(rowCount * 100, 0);\n                if (this.mScrollY != 0) {\n                    result += Math.abs(Math.floor((this.mScrollY / this.getHeight() * rowCount * 100)));\n                }\n                return result;\n            }\n        }\n        GridView.NO_STRETCH = 0;\n        GridView.STRETCH_SPACING = 1;\n        GridView.STRETCH_COLUMN_WIDTH = 2;\n        GridView.STRETCH_SPACING_UNIFORM = 3;\n        GridView.AUTO_FIT = -1;\n        widget.GridView = GridView;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar java;\n(function (java) {\n    var lang;\n    (function (lang) {\n        var Comparable;\n        (function (Comparable) {\n            function isImpl(obj) {\n                return obj && obj['compareTo'];\n            }\n            Comparable.isImpl = isImpl;\n        })(Comparable = lang.Comparable || (lang.Comparable = {}));\n    })(lang = java.lang || (java.lang = {}));\n})(java || (java = {}));\nvar java;\n(function (java) {\n    var util;\n    (function (util) {\n        var Comparable = java.lang.Comparable;\n        class Collections {\n            static emptyList() {\n                return Collections.EMPTY_LIST;\n            }\n            static sort(list, c) {\n                if (c) {\n                    list.sort((t1, t2) => {\n                        return c.compare(t1, t2);\n                    });\n                }\n                else {\n                    list.sort((t1, t2) => {\n                        if (Comparable.isImpl(t1) && Comparable.isImpl(t2)) {\n                            return t1.compareTo(t2);\n                        }\n                        return 0;\n                    });\n                }\n            }\n        }\n        Collections.EMPTY_LIST = new util.ArrayList();\n        util.Collections = Collections;\n    })(util = java.util || (java.util = {}));\n})(java || (java = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var Color = android.graphics.Color;\n        var Paint = android.graphics.Paint;\n        var Align = android.graphics.Paint.Align;\n        var SparseArray = android.util.SparseArray;\n        var TypedValue = android.util.TypedValue;\n        var KeyEvent = android.view.KeyEvent;\n        var MotionEvent = android.view.MotionEvent;\n        var VelocityTracker = android.view.VelocityTracker;\n        var View = android.view.View;\n        var ViewConfiguration = android.view.ViewConfiguration;\n        var DecelerateInterpolator = android.view.animation.DecelerateInterpolator;\n        var Integer = java.lang.Integer;\n        var LinearLayout = android.widget.LinearLayout;\n        var OverScroller = android.widget.OverScroller;\n        class NumberPicker extends LinearLayout {\n            constructor(context, bindElement, defStyle = android.R.attr.numberPickerStyle) {\n                super(context, bindElement, defStyle);\n                this.SELECTOR_WHEEL_ITEM_COUNT = 3;\n                this.SELECTOR_MIDDLE_ITEM_INDEX = Math.floor(this.SELECTOR_WHEEL_ITEM_COUNT / 2);\n                this.mSelectionDividersDistance = 0;\n                this.mMinHeight_ = NumberPicker.SIZE_UNSPECIFIED;\n                this.mMaxHeight = NumberPicker.SIZE_UNSPECIFIED;\n                this.mMinWidth_ = NumberPicker.SIZE_UNSPECIFIED;\n                this.mMaxWidth = NumberPicker.SIZE_UNSPECIFIED;\n                this.mTextSize = 0;\n                this.mSelectorTextGapHeight = 0;\n                this.mMinValue = 0;\n                this.mMaxValue = 0;\n                this.mValue = 0;\n                this.mLongPressUpdateInterval = NumberPicker.DEFAULT_LONG_PRESS_UPDATE_INTERVAL;\n                this.mSelectorIndexToStringCache = new SparseArray();\n                this.mSelectorElementHeight = 0;\n                this.mInitialScrollOffset = Integer.MIN_VALUE;\n                this.mCurrentScrollOffset = 0;\n                this.mPreviousScrollerY = 0;\n                this.mLastDownEventY = 0;\n                this.mLastDownEventTime = 0;\n                this.mLastDownOrMoveEventY = 0;\n                this.mMinimumFlingVelocity = 0;\n                this.mMaximumFlingVelocity = 0;\n                this.mSolidColor = 0;\n                this.mSelectionDividerHeight = 0;\n                this.mScrollState = NumberPicker.OnScrollListener.SCROLL_STATE_IDLE;\n                this.mTopSelectionDividerTop = 0;\n                this.mBottomSelectionDividerBottom = 0;\n                this.mLastHoveredChildVirtualViewId = 0;\n                this.mLastHandledDownDpadKeyCode = -1;\n                let attributesArray = context.obtainStyledAttributes(bindElement, defStyle);\n                this.mHasSelectorWheel = true;\n                this.mSolidColor = attributesArray.getColor('solidColor', 0);\n                this.mSelectionDivider = attributesArray.getDrawable('selectionDivider');\n                const defSelectionDividerHeight = Math.floor(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, NumberPicker.UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT, this.getResources().getDisplayMetrics()));\n                this.mSelectionDividerHeight = attributesArray.getDimensionPixelSize('selectionDividerHeight', defSelectionDividerHeight);\n                const defSelectionDividerDistance = Math.floor(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, NumberPicker.UNSCALED_DEFAULT_SELECTION_DIVIDERS_DISTANCE, this.getResources().getDisplayMetrics()));\n                this.mSelectionDividersDistance = attributesArray.getDimensionPixelSize('selectionDividersDistance', defSelectionDividerDistance);\n                this.mMinHeight = attributesArray.getDimensionPixelSize('internalMinHeight', NumberPicker.SIZE_UNSPECIFIED);\n                this.mMaxHeight = attributesArray.getDimensionPixelSize('internalMaxHeight', NumberPicker.SIZE_UNSPECIFIED);\n                if (this.mMinHeight != NumberPicker.SIZE_UNSPECIFIED && this.mMaxHeight != NumberPicker.SIZE_UNSPECIFIED && this.mMinHeight > this.mMaxHeight) {\n                    throw Error(`new IllegalArgumentException(\"minHeight > maxHeight\")`);\n                }\n                this.mMinWidth = attributesArray.getDimensionPixelSize('internalMinWidth', NumberPicker.SIZE_UNSPECIFIED);\n                this.mMaxWidth = attributesArray.getDimensionPixelSize('internalMaxWidth', NumberPicker.SIZE_UNSPECIFIED);\n                if (this.mMinWidth != NumberPicker.SIZE_UNSPECIFIED && this.mMaxWidth != NumberPicker.SIZE_UNSPECIFIED && this.mMinWidth > this.mMaxWidth) {\n                    throw Error(`new IllegalArgumentException(\"minWidth > maxWidth\")`);\n                }\n                this.mComputeMaxWidth = (this.mMaxWidth == NumberPicker.SIZE_UNSPECIFIED);\n                this.mVirtualButtonPressedDrawable = attributesArray.getDrawable('virtualButtonPressedDrawable');\n                this.mTextSize = attributesArray.getDimensionPixelSize('textSize', Math.floor(16 * this.getResources().getDisplayMetrics().density));\n                let paint = new Paint();\n                paint.setAntiAlias(true);\n                paint.setTextAlign(Align.CENTER);\n                paint.setTextSize(this.mTextSize);\n                paint.setColor(attributesArray.getColor('textColor', Color.DKGRAY));\n                this.mSelectorWheelPaint = paint;\n                this.SELECTOR_WHEEL_ITEM_COUNT = attributesArray.getInt('itemCount', this.SELECTOR_WHEEL_ITEM_COUNT);\n                this.SELECTOR_MIDDLE_ITEM_INDEX = Math.floor(this.SELECTOR_WHEEL_ITEM_COUNT / 2);\n                this.mSelectorIndices = androidui.util.ArrayCreator.newNumberArray(this.SELECTOR_WHEEL_ITEM_COUNT);\n                if (this.mMinHeight_ != NumberPicker.SIZE_UNSPECIFIED && this.mMaxHeight != NumberPicker.SIZE_UNSPECIFIED && this.mMinHeight_ > this.mMaxHeight) {\n                    throw Error(`new IllegalArgumentException(\"minHeight > maxHeight\")`);\n                }\n                if (this.mMinWidth_ != NumberPicker.SIZE_UNSPECIFIED && this.mMaxWidth != NumberPicker.SIZE_UNSPECIFIED && this.mMinWidth_ > this.mMaxWidth) {\n                    throw Error(`new IllegalArgumentException(\"minWidth > maxWidth\")`);\n                }\n                this.mComputeMaxWidth = (this.mMaxWidth == NumberPicker.SIZE_UNSPECIFIED);\n                this.setMinValue(attributesArray.getInt('minValue', this.mMinValue));\n                this.setMaxValue(attributesArray.getInt('maxValue', this.mMaxValue));\n                attributesArray.recycle();\n                this.mPressedStateHelper = new NumberPicker.PressedStateHelper(this);\n                this.setWillNotDraw(!this.mHasSelectorWheel);\n                let configuration = ViewConfiguration.get();\n                this.mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();\n                this.mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity() / NumberPicker.SELECTOR_MAX_FLING_VELOCITY_ADJUSTMENT;\n                this.mFlingScroller = new OverScroller(null, true);\n                this.mAdjustScroller = new OverScroller(new DecelerateInterpolator(2.5));\n                this.updateInputTextView();\n            }\n            static getTwoDigitFormatter() {\n                if (!NumberPicker.sTwoDigitFormatter) {\n                    NumberPicker.sTwoDigitFormatter = new NumberPicker.TwoDigitFormatter();\n                }\n                return NumberPicker.sTwoDigitFormatter;\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('solidColor', {\n                    setter(v, value, attrBinder) {\n                        v.mSolidColor = attrBinder.parseColor(value, v.mSolidColor);\n                        v.invalidate();\n                    }, getter(v) {\n                        return v.mSolidColor;\n                    }\n                }).set('selectionDivider', {\n                    setter(v, value, attrBinder) {\n                        v.mSelectionDivider = attrBinder.parseDrawable(value);\n                        v.invalidate();\n                    }, getter(v) {\n                        return v.mSelectionDivider;\n                    }\n                }).set('selectionDividerHeight', {\n                    setter(v, value, attrBinder) {\n                        v.mSelectionDividerHeight = attrBinder.parseNumberPixelSize(value, v.mSelectionDividerHeight);\n                        v.invalidate();\n                    }, getter(v) {\n                        return v.mSelectionDividerHeight;\n                    }\n                }).set('selectionDividersDistance', {\n                    setter(v, value, attrBinder) {\n                        v.mSelectionDividersDistance = attrBinder.parseNumberPixelSize(value, v.mSelectionDividersDistance);\n                        v.invalidate();\n                    }, getter(v) {\n                        return v.mSelectionDividersDistance;\n                    }\n                }).set('internalMinHeight', {\n                    setter(v, value, attrBinder) {\n                        v.mMinHeight_ = attrBinder.parseNumberPixelSize(value, v.mMinHeight_);\n                        v.invalidate();\n                    }, getter(v) {\n                        return v.mMinHeight_;\n                    }\n                }).set('internalMaxHeight', {\n                    setter(v, value, attrBinder) {\n                        v.mMaxHeight = attrBinder.parseNumberPixelSize(value, v.mMaxHeight);\n                        v.invalidate();\n                    }, getter(v) {\n                        return v.mMaxHeight;\n                    }\n                }).set('internalMinWidth', {\n                    setter(v, value, attrBinder) {\n                        v.mMinWidth_ = attrBinder.parseNumberPixelSize(value, v.mMinWidth_);\n                        v.invalidate();\n                    }, getter(v) {\n                        return v.mMinWidth_;\n                    }\n                }).set('internalMaxWidth', {\n                    setter(v, value, attrBinder) {\n                        v.mMaxWidth = attrBinder.parseNumberPixelSize(value, v.mMaxWidth);\n                        v.invalidate();\n                    }, getter(v) {\n                        return v.mMaxWidth;\n                    }\n                }).set('virtualButtonPressedDrawable', {\n                    setter(v, value, attrBinder) {\n                        v.mVirtualButtonPressedDrawable = attrBinder.parseDrawable(value);\n                        v.invalidate();\n                    }, getter(v) {\n                        return v.mVirtualButtonPressedDrawable;\n                    }\n                });\n            }\n            onLayout(changed, left, top, right, bottom) {\n                if (!this.mHasSelectorWheel) {\n                    super.onLayout(changed, left, top, right, bottom);\n                    return;\n                }\n                const msrdWdth = this.getMeasuredWidth();\n                const msrdHght = this.getMeasuredHeight();\n                if (changed) {\n                    this.initializeSelectorWheel();\n                    this.initializeFadingEdges();\n                    this.mTopSelectionDividerTop = (this.getHeight() - this.mSelectionDividersDistance) / 2 - this.mSelectionDividerHeight;\n                    this.mBottomSelectionDividerBottom = this.mTopSelectionDividerTop + 2 * this.mSelectionDividerHeight + this.mSelectionDividersDistance;\n                }\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                if (!this.mHasSelectorWheel) {\n                    super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n                    return;\n                }\n                const newWidthMeasureSpec = this.makeMeasureSpec(widthMeasureSpec, this.mMaxWidth);\n                const newHeightMeasureSpec = this.makeMeasureSpec(heightMeasureSpec, this.mMaxHeight);\n                super.onMeasure(newWidthMeasureSpec, newHeightMeasureSpec);\n                const widthSize = this.resolveSizeAndStateRespectingMinSize(this.mMinWidth_, this.getMeasuredWidth(), widthMeasureSpec);\n                const heightSize = this.resolveSizeAndStateRespectingMinSize(this.mMinHeight_, this.getMeasuredHeight(), heightMeasureSpec);\n                this.setMeasuredDimension(widthSize, heightSize);\n            }\n            moveToFinalScrollerPosition(scroller) {\n                scroller.forceFinished(true);\n                let amountToScroll = scroller.getFinalY() - scroller.getCurrY();\n                let futureScrollOffset = (this.mCurrentScrollOffset + amountToScroll) % this.mSelectorElementHeight;\n                let overshootAdjustment = this.mInitialScrollOffset - futureScrollOffset;\n                if (overshootAdjustment != 0) {\n                    if (Math.abs(overshootAdjustment) > this.mSelectorElementHeight / 2) {\n                        if (overshootAdjustment > 0) {\n                            overshootAdjustment -= this.mSelectorElementHeight;\n                        }\n                        else {\n                            overshootAdjustment += this.mSelectorElementHeight;\n                        }\n                    }\n                    amountToScroll += overshootAdjustment;\n                    this.scrollBy(0, amountToScroll);\n                    return true;\n                }\n                return false;\n            }\n            onInterceptTouchEvent(event) {\n                if (!this.mHasSelectorWheel || !this.isEnabled()) {\n                    return false;\n                }\n                const action = event.getActionMasked();\n                switch (action) {\n                    case MotionEvent.ACTION_DOWN:\n                        {\n                            this.removeAllCallbacks();\n                            this.mLastDownOrMoveEventY = this.mLastDownEventY = event.getY();\n                            this.mLastDownEventTime = event.getEventTime();\n                            this.mIngonreMoveEvents = false;\n                            this.mShowSoftInputOnTap = false;\n                            if (this.mLastDownEventY < this.mTopSelectionDividerTop) {\n                                if (this.mScrollState == NumberPicker.OnScrollListener.SCROLL_STATE_IDLE) {\n                                    this.mPressedStateHelper.buttonPressDelayed(NumberPicker.PressedStateHelper.BUTTON_DECREMENT);\n                                }\n                            }\n                            else if (this.mLastDownEventY > this.mBottomSelectionDividerBottom) {\n                                if (this.mScrollState == NumberPicker.OnScrollListener.SCROLL_STATE_IDLE) {\n                                    this.mPressedStateHelper.buttonPressDelayed(NumberPicker.PressedStateHelper.BUTTON_INCREMENT);\n                                }\n                            }\n                            this.getParent().requestDisallowInterceptTouchEvent(true);\n                            if (!this.mFlingScroller.isFinished()) {\n                                this.mFlingScroller.forceFinished(true);\n                                this.mAdjustScroller.forceFinished(true);\n                                this.onScrollStateChange(NumberPicker.OnScrollListener.SCROLL_STATE_IDLE);\n                            }\n                            else if (!this.mAdjustScroller.isFinished()) {\n                                this.mFlingScroller.forceFinished(true);\n                                this.mAdjustScroller.forceFinished(true);\n                            }\n                            else if (this.mLastDownEventY < this.mTopSelectionDividerTop) {\n                                this.hideSoftInput();\n                                this.postChangeCurrentByOneFromLongPress(false, ViewConfiguration.getLongPressTimeout());\n                            }\n                            else if (this.mLastDownEventY > this.mBottomSelectionDividerBottom) {\n                                this.hideSoftInput();\n                                this.postChangeCurrentByOneFromLongPress(true, ViewConfiguration.getLongPressTimeout());\n                            }\n                            else {\n                                this.mShowSoftInputOnTap = true;\n                                this.postBeginSoftInputOnLongPressCommand();\n                            }\n                            return true;\n                        }\n                }\n                return false;\n            }\n            onTouchEvent(event) {\n                if (!this.isEnabled() || !this.mHasSelectorWheel) {\n                    return false;\n                }\n                if (this.mVelocityTracker == null) {\n                    this.mVelocityTracker = VelocityTracker.obtain();\n                }\n                this.mVelocityTracker.addMovement(event);\n                let action = event.getActionMasked();\n                switch (action) {\n                    case MotionEvent.ACTION_MOVE:\n                        {\n                            if (this.mIngonreMoveEvents) {\n                                break;\n                            }\n                            let currentMoveY = event.getY();\n                            if (this.mScrollState != NumberPicker.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {\n                                let deltaDownY = Math.floor(Math.abs(currentMoveY - this.mLastDownEventY));\n                                if (deltaDownY > this.mTouchSlop) {\n                                    this.removeAllCallbacks();\n                                    this.onScrollStateChange(NumberPicker.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);\n                                }\n                            }\n                            else {\n                                let deltaMoveY = Math.floor(((currentMoveY - this.mLastDownOrMoveEventY)));\n                                this.scrollBy(0, deltaMoveY);\n                                this.invalidate();\n                            }\n                            this.mLastDownOrMoveEventY = currentMoveY;\n                        }\n                        break;\n                    case MotionEvent.ACTION_UP:\n                        {\n                            this.removeBeginSoftInputCommand();\n                            this.removeChangeCurrentByOneFromLongPress();\n                            this.mPressedStateHelper.cancel();\n                            let velocityTracker = this.mVelocityTracker;\n                            velocityTracker.computeCurrentVelocity(1000, this.mMaximumFlingVelocity);\n                            let initialVelocity = Math.floor(velocityTracker.getYVelocity());\n                            if (Math.abs(initialVelocity) > this.mMinimumFlingVelocity) {\n                                this.fling(initialVelocity);\n                                this.onScrollStateChange(NumberPicker.OnScrollListener.SCROLL_STATE_FLING);\n                            }\n                            else {\n                                let eventY = Math.floor(event.getY());\n                                let deltaMoveY = Math.floor(Math.abs(eventY - this.mLastDownEventY));\n                                let deltaTime = event.getEventTime() - this.mLastDownEventTime;\n                                if (deltaMoveY <= this.mTouchSlop && deltaTime < ViewConfiguration.getTapTimeout()) {\n                                    if (this.mShowSoftInputOnTap) {\n                                        this.mShowSoftInputOnTap = false;\n                                        this.showSoftInput();\n                                    }\n                                    else {\n                                        let selectorIndexOffset = (eventY / this.mSelectorElementHeight) - this.SELECTOR_MIDDLE_ITEM_INDEX;\n                                        if (selectorIndexOffset > 0) {\n                                            this.changeValueByOne(true);\n                                            this.mPressedStateHelper.buttonTapped(NumberPicker.PressedStateHelper.BUTTON_INCREMENT);\n                                        }\n                                        else if (selectorIndexOffset < 0) {\n                                            this.changeValueByOne(false);\n                                            this.mPressedStateHelper.buttonTapped(NumberPicker.PressedStateHelper.BUTTON_DECREMENT);\n                                        }\n                                    }\n                                }\n                                else {\n                                    this.ensureScrollWheelAdjusted();\n                                }\n                                this.onScrollStateChange(NumberPicker.OnScrollListener.SCROLL_STATE_IDLE);\n                            }\n                            this.mVelocityTracker.recycle();\n                            this.mVelocityTracker = null;\n                        }\n                        break;\n                }\n                return true;\n            }\n            dispatchTouchEvent(event) {\n                const action = event.getActionMasked();\n                switch (action) {\n                    case MotionEvent.ACTION_CANCEL:\n                    case MotionEvent.ACTION_UP:\n                        this.removeAllCallbacks();\n                        break;\n                }\n                return super.dispatchTouchEvent(event);\n            }\n            dispatchKeyEvent(event) {\n                const keyCode = event.getKeyCode();\n                switch (keyCode) {\n                    case KeyEvent.KEYCODE_DPAD_CENTER:\n                    case KeyEvent.KEYCODE_ENTER:\n                        this.removeAllCallbacks();\n                        break;\n                    case KeyEvent.KEYCODE_DPAD_DOWN:\n                    case KeyEvent.KEYCODE_DPAD_UP:\n                        if (!this.mHasSelectorWheel) {\n                            break;\n                        }\n                        switch (event.getAction()) {\n                            case KeyEvent.ACTION_DOWN:\n                                if (this.mWrapSelectorWheel || (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) ? this.getValue() < this.getMaxValue() : this.getValue() > this.getMinValue()) {\n                                    this.requestFocus();\n                                    this.mLastHandledDownDpadKeyCode = keyCode;\n                                    this.removeAllCallbacks();\n                                    if (this.mFlingScroller.isFinished()) {\n                                        this.changeValueByOne(keyCode == KeyEvent.KEYCODE_DPAD_DOWN);\n                                    }\n                                    return true;\n                                }\n                                break;\n                            case KeyEvent.ACTION_UP:\n                                if (this.mLastHandledDownDpadKeyCode == keyCode) {\n                                    this.mLastHandledDownDpadKeyCode = -1;\n                                    return true;\n                                }\n                                break;\n                        }\n                }\n                return super.dispatchKeyEvent(event);\n            }\n            computeScroll() {\n                let scroller = this.mFlingScroller;\n                if (scroller.isFinished()) {\n                    scroller = this.mAdjustScroller;\n                    if (scroller.isFinished()) {\n                        return;\n                    }\n                }\n                scroller.computeScrollOffset();\n                let currentScrollerY = scroller.getCurrY();\n                if (this.mPreviousScrollerY == 0) {\n                    this.mPreviousScrollerY = scroller.getStartY();\n                }\n                this.scrollBy(0, currentScrollerY - this.mPreviousScrollerY);\n                this.mPreviousScrollerY = currentScrollerY;\n                if (scroller.isFinished()) {\n                    this.onScrollerFinished(scroller);\n                }\n                else {\n                    this.invalidate();\n                }\n            }\n            setEnabled(enabled) {\n                super.setEnabled(enabled);\n                if (!this.mHasSelectorWheel) {\n                }\n                if (!this.mHasSelectorWheel) {\n                }\n            }\n            scrollBy(x, y) {\n                let selectorIndices = this.mSelectorIndices;\n                if (!this.mWrapSelectorWheel && y > 0 && selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX] <= this.mMinValue) {\n                    this.mCurrentScrollOffset = this.mInitialScrollOffset;\n                    return;\n                }\n                if (!this.mWrapSelectorWheel && y < 0 && selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX] >= this.mMaxValue) {\n                    this.mCurrentScrollOffset = this.mInitialScrollOffset;\n                    return;\n                }\n                this.mCurrentScrollOffset += y;\n                while (this.mCurrentScrollOffset - this.mInitialScrollOffset > this.mSelectorTextGapHeight) {\n                    this.mCurrentScrollOffset -= this.mSelectorElementHeight;\n                    this.decrementSelectorIndices(selectorIndices);\n                    this.setValueInternal(selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX], true);\n                    if (!this.mWrapSelectorWheel && selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX] <= this.mMinValue) {\n                        this.mCurrentScrollOffset = this.mInitialScrollOffset;\n                    }\n                }\n                while (this.mCurrentScrollOffset - this.mInitialScrollOffset < -this.mSelectorTextGapHeight) {\n                    this.mCurrentScrollOffset += this.mSelectorElementHeight;\n                    this.incrementSelectorIndices(selectorIndices);\n                    this.setValueInternal(selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX], true);\n                    if (!this.mWrapSelectorWheel && selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX] >= this.mMaxValue) {\n                        this.mCurrentScrollOffset = this.mInitialScrollOffset;\n                    }\n                }\n            }\n            computeVerticalScrollOffset() {\n                return this.mCurrentScrollOffset;\n            }\n            computeVerticalScrollRange() {\n                return (this.mMaxValue - this.mMinValue + 1) * this.mSelectorElementHeight;\n            }\n            computeVerticalScrollExtent() {\n                return this.getHeight();\n            }\n            getSolidColor() {\n                return this.mSolidColor;\n            }\n            setOnValueChangedListener(onValueChangedListener) {\n                this.mOnValueChangeListener = onValueChangedListener;\n            }\n            setOnScrollListener(onScrollListener) {\n                this.mOnScrollListener = onScrollListener;\n            }\n            setFormatter(formatter) {\n                if (formatter == this.mFormatter) {\n                    return;\n                }\n                this.mFormatter = formatter;\n                this.initializeSelectorWheelIndices();\n                this.updateInputTextView();\n            }\n            setValue(value) {\n                this.setValueInternal(value, false);\n            }\n            showSoftInput() {\n            }\n            hideSoftInput() {\n            }\n            tryComputeMaxWidth() {\n                if (!this.mComputeMaxWidth) {\n                    return;\n                }\n                let maxTextWidth = 0;\n                if (this.mDisplayedValues == null) {\n                    let maxDigitWidth = 0;\n                    for (let i = 0; i <= 9; i++) {\n                        const digitWidth = this.mSelectorWheelPaint.measureText(NumberPicker.formatNumberWithLocale(i));\n                        if (digitWidth > maxDigitWidth) {\n                            maxDigitWidth = digitWidth;\n                        }\n                    }\n                    let numberOfDigits = 0;\n                    let current = this.mMaxValue;\n                    while (current > 0) {\n                        numberOfDigits++;\n                        current = current / 10;\n                    }\n                    maxTextWidth = Math.floor((numberOfDigits * maxDigitWidth));\n                }\n                else {\n                    const valueCount = this.mDisplayedValues.length;\n                    for (let i = 0; i < valueCount; i++) {\n                        const textWidth = this.mSelectorWheelPaint.measureText(this.mDisplayedValues[i]);\n                        if (textWidth > maxTextWidth) {\n                            maxTextWidth = Math.floor(textWidth);\n                        }\n                    }\n                }\n                if (this.mMaxWidth != maxTextWidth) {\n                    if (maxTextWidth > this.mMinWidth_) {\n                        this.mMaxWidth = maxTextWidth;\n                    }\n                    else {\n                        this.mMaxWidth = this.mMinWidth_;\n                    }\n                    this.invalidate();\n                }\n            }\n            getWrapSelectorWheel() {\n                return this.mWrapSelectorWheel;\n            }\n            setWrapSelectorWheel(wrapSelectorWheel) {\n                const wrappingAllowed = (this.mMaxValue - this.mMinValue) >= this.mSelectorIndices.length;\n                if ((!wrapSelectorWheel || wrappingAllowed) && wrapSelectorWheel != this.mWrapSelectorWheel) {\n                    this.mWrapSelectorWheel = wrapSelectorWheel;\n                }\n            }\n            setOnLongPressUpdateInterval(intervalMillis) {\n                this.mLongPressUpdateInterval = intervalMillis;\n            }\n            getValue() {\n                return this.mValue;\n            }\n            getMinValue() {\n                return this.mMinValue;\n            }\n            setMinValue(minValue) {\n                if (this.mMinValue == minValue) {\n                    return;\n                }\n                if (minValue < 0) {\n                    throw Error(`new IllegalArgumentException(\"minValue must be >= 0\")`);\n                }\n                this.mMinValue = minValue;\n                if (this.mMinValue > this.mValue) {\n                    this.mValue = this.mMinValue;\n                }\n                let wrapSelectorWheel = this.mMaxValue - this.mMinValue > this.mSelectorIndices.length;\n                this.setWrapSelectorWheel(wrapSelectorWheel);\n                this.initializeSelectorWheelIndices();\n                this.updateInputTextView();\n                this.tryComputeMaxWidth();\n                this.invalidate();\n            }\n            getMaxValue() {\n                return this.mMaxValue;\n            }\n            setMaxValue(maxValue) {\n                if (this.mMaxValue == maxValue) {\n                    return;\n                }\n                if (maxValue < 0) {\n                    throw Error(`new IllegalArgumentException(\"maxValue must be >= 0\")`);\n                }\n                this.mMaxValue = maxValue;\n                if (this.mMaxValue < this.mValue) {\n                    this.mValue = this.mMaxValue;\n                }\n                let wrapSelectorWheel = this.mMaxValue - this.mMinValue > this.mSelectorIndices.length;\n                this.setWrapSelectorWheel(wrapSelectorWheel);\n                this.initializeSelectorWheelIndices();\n                this.updateInputTextView();\n                this.tryComputeMaxWidth();\n                this.invalidate();\n            }\n            getDisplayedValues() {\n                return this.mDisplayedValues;\n            }\n            setDisplayedValues(displayedValues) {\n                if (this.mDisplayedValues == displayedValues) {\n                    return;\n                }\n                this.mDisplayedValues = displayedValues;\n                if (this.mDisplayedValues != null) {\n                }\n                else {\n                }\n                this.updateInputTextView();\n                this.initializeSelectorWheelIndices();\n                this.tryComputeMaxWidth();\n            }\n            getTopFadingEdgeStrength() {\n                return NumberPicker.TOP_AND_BOTTOM_FADING_EDGE_STRENGTH;\n            }\n            getBottomFadingEdgeStrength() {\n                return NumberPicker.TOP_AND_BOTTOM_FADING_EDGE_STRENGTH;\n            }\n            onDetachedFromWindow() {\n                super.onDetachedFromWindow();\n                this.removeAllCallbacks();\n            }\n            onDraw(canvas) {\n                if (!this.mHasSelectorWheel) {\n                    super.onDraw(canvas);\n                    return;\n                }\n                let x = (this.mRight - this.mLeft) / 2;\n                let y = this.mCurrentScrollOffset;\n                if (this.mVirtualButtonPressedDrawable != null && this.mScrollState == NumberPicker.OnScrollListener.SCROLL_STATE_IDLE) {\n                    if (this.mDecrementVirtualButtonPressed) {\n                        this.mVirtualButtonPressedDrawable.setState(NumberPicker.PRESSED_STATE_SET);\n                        this.mVirtualButtonPressedDrawable.setBounds(0, 0, this.mRight, this.mTopSelectionDividerTop);\n                        this.mVirtualButtonPressedDrawable.draw(canvas);\n                    }\n                    if (this.mIncrementVirtualButtonPressed) {\n                        this.mVirtualButtonPressedDrawable.setState(NumberPicker.PRESSED_STATE_SET);\n                        this.mVirtualButtonPressedDrawable.setBounds(0, this.mBottomSelectionDividerBottom, this.mRight, this.mBottom);\n                        this.mVirtualButtonPressedDrawable.draw(canvas);\n                    }\n                }\n                let selectorIndices = this.mSelectorIndices;\n                for (let i = 0; i < selectorIndices.length; i++) {\n                    let selectorIndex = selectorIndices[i];\n                    let scrollSelectorValue = this.mSelectorIndexToStringCache.get(selectorIndex);\n                    canvas.drawText(scrollSelectorValue, x, y, this.mSelectorWheelPaint);\n                    y += this.mSelectorElementHeight;\n                }\n                if (this.mSelectionDivider != null) {\n                    let topOfTopDivider = this.mTopSelectionDividerTop;\n                    let bottomOfTopDivider = topOfTopDivider + this.mSelectionDividerHeight;\n                    this.mSelectionDivider.setBounds(0, topOfTopDivider, this.mRight, bottomOfTopDivider);\n                    this.mSelectionDivider.draw(canvas);\n                    let bottomOfBottomDivider = this.mBottomSelectionDividerBottom;\n                    let topOfBottomDivider = bottomOfBottomDivider - this.mSelectionDividerHeight;\n                    this.mSelectionDivider.setBounds(0, topOfBottomDivider, this.mRight, bottomOfBottomDivider);\n                    this.mSelectionDivider.draw(canvas);\n                }\n            }\n            makeMeasureSpec(measureSpec, maxSize) {\n                if (maxSize == NumberPicker.SIZE_UNSPECIFIED) {\n                    return measureSpec;\n                }\n                const size = View.MeasureSpec.getSize(measureSpec);\n                const mode = View.MeasureSpec.getMode(measureSpec);\n                switch (mode) {\n                    case View.MeasureSpec.EXACTLY:\n                        return measureSpec;\n                    case View.MeasureSpec.AT_MOST:\n                        return View.MeasureSpec.makeMeasureSpec(Math.min(size, maxSize), View.MeasureSpec.EXACTLY);\n                    case View.MeasureSpec.UNSPECIFIED:\n                        return View.MeasureSpec.makeMeasureSpec(maxSize, View.MeasureSpec.EXACTLY);\n                    default:\n                        throw Error(`new IllegalArgumentException(\"Unknown measure mode: \" + mode)`);\n                }\n            }\n            resolveSizeAndStateRespectingMinSize(minSize, measuredSize, measureSpec) {\n                if (minSize != NumberPicker.SIZE_UNSPECIFIED) {\n                    const desiredWidth = Math.max(minSize, measuredSize);\n                    return NumberPicker.resolveSizeAndState(desiredWidth, measureSpec, 0);\n                }\n                else {\n                    return measuredSize;\n                }\n            }\n            initializeSelectorWheelIndices() {\n                this.mSelectorIndexToStringCache.clear();\n                let selectorIndices = this.mSelectorIndices;\n                let current = this.getValue();\n                for (let i = 0; i < this.mSelectorIndices.length; i++) {\n                    let selectorIndex = Math.floor(current + (i - this.SELECTOR_MIDDLE_ITEM_INDEX));\n                    if (this.mWrapSelectorWheel) {\n                        selectorIndex = this.getWrappedSelectorIndex(selectorIndex);\n                    }\n                    selectorIndices[i] = selectorIndex;\n                    this.ensureCachedScrollSelectorValue(selectorIndices[i]);\n                }\n            }\n            setValueInternal(current, notifyChange) {\n                if (this.mValue == current) {\n                    return;\n                }\n                if (this.mWrapSelectorWheel) {\n                    current = this.getWrappedSelectorIndex(current);\n                }\n                else {\n                    current = Math.max(current, this.mMinValue);\n                    current = Math.min(current, this.mMaxValue);\n                }\n                let previous = this.mValue;\n                this.mValue = current;\n                this.updateInputTextView();\n                if (notifyChange) {\n                    this.notifyChange(previous, current);\n                }\n                this.initializeSelectorWheelIndices();\n                this.invalidate();\n            }\n            changeValueByOne(increment) {\n                if (this.mHasSelectorWheel) {\n                    if (!this.moveToFinalScrollerPosition(this.mFlingScroller)) {\n                        this.moveToFinalScrollerPosition(this.mAdjustScroller);\n                    }\n                    this.mPreviousScrollerY = 0;\n                    if (increment) {\n                        this.mFlingScroller.startScroll(0, 0, 0, -this.mSelectorElementHeight, NumberPicker.SNAP_SCROLL_DURATION);\n                    }\n                    else {\n                        this.mFlingScroller.startScroll(0, 0, 0, this.mSelectorElementHeight, NumberPicker.SNAP_SCROLL_DURATION);\n                    }\n                    this.invalidate();\n                }\n                else {\n                    if (increment) {\n                        this.setValueInternal(this.mValue + 1, true);\n                    }\n                    else {\n                        this.setValueInternal(this.mValue - 1, true);\n                    }\n                }\n            }\n            initializeSelectorWheel() {\n                this.initializeSelectorWheelIndices();\n                let selectorIndices = this.mSelectorIndices;\n                let totalTextHeight = selectorIndices.length * this.mTextSize;\n                let totalTextGapHeight = (this.mBottom - this.mTop) - totalTextHeight;\n                let textGapCount = selectorIndices.length;\n                this.mSelectorTextGapHeight = Math.floor((totalTextGapHeight / textGapCount + 0.5));\n                this.mSelectorElementHeight = this.mTextSize + this.mSelectorTextGapHeight;\n                let editTextTextPosition = this.getHeight() / 2 + this.mTextSize / 2;\n                this.mInitialScrollOffset = editTextTextPosition - (this.mSelectorElementHeight * this.SELECTOR_MIDDLE_ITEM_INDEX);\n                this.mCurrentScrollOffset = this.mInitialScrollOffset;\n                this.updateInputTextView();\n            }\n            initializeFadingEdges() {\n                this.setVerticalFadingEdgeEnabled(true);\n                this.setFadingEdgeLength((this.mBottom - this.mTop - this.mTextSize) / 2);\n            }\n            onScrollerFinished(scroller) {\n                if (scroller == this.mFlingScroller) {\n                    if (!this.ensureScrollWheelAdjusted()) {\n                        this.updateInputTextView();\n                    }\n                    this.onScrollStateChange(NumberPicker.OnScrollListener.SCROLL_STATE_IDLE);\n                }\n                else {\n                    if (this.mScrollState != NumberPicker.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {\n                        this.updateInputTextView();\n                    }\n                }\n            }\n            onScrollStateChange(scrollState) {\n                if (this.mScrollState == scrollState) {\n                    return;\n                }\n                this.mScrollState = scrollState;\n                if (this.mOnScrollListener != null) {\n                    this.mOnScrollListener.onScrollStateChange(this, scrollState);\n                }\n            }\n            fling(velocityY) {\n                this.mPreviousScrollerY = 0;\n                if (velocityY > 0) {\n                    this.mFlingScroller.fling(0, 0, 0, velocityY, 0, 0, 0, Integer.MAX_VALUE);\n                }\n                else {\n                    this.mFlingScroller.fling(0, Integer.MAX_VALUE, 0, velocityY, 0, 0, 0, Integer.MAX_VALUE);\n                }\n                this.invalidate();\n            }\n            getWrappedSelectorIndex(selectorIndex) {\n                if (selectorIndex > this.mMaxValue) {\n                    return this.mMinValue + (selectorIndex - this.mMaxValue) % (this.mMaxValue - this.mMinValue) - 1;\n                }\n                else if (selectorIndex < this.mMinValue) {\n                    return this.mMaxValue - (this.mMinValue - selectorIndex) % (this.mMaxValue - this.mMinValue) + 1;\n                }\n                return selectorIndex;\n            }\n            incrementSelectorIndices(selectorIndices) {\n                for (let i = 0; i < selectorIndices.length - 1; i++) {\n                    selectorIndices[i] = selectorIndices[i + 1];\n                }\n                let nextScrollSelectorIndex = selectorIndices[selectorIndices.length - 2] + 1;\n                if (this.mWrapSelectorWheel && nextScrollSelectorIndex > this.mMaxValue) {\n                    nextScrollSelectorIndex = this.mMinValue;\n                }\n                selectorIndices[selectorIndices.length - 1] = nextScrollSelectorIndex;\n                this.ensureCachedScrollSelectorValue(nextScrollSelectorIndex);\n            }\n            decrementSelectorIndices(selectorIndices) {\n                for (let i = selectorIndices.length - 1; i > 0; i--) {\n                    selectorIndices[i] = selectorIndices[i - 1];\n                }\n                let nextScrollSelectorIndex = selectorIndices[1] - 1;\n                if (this.mWrapSelectorWheel && nextScrollSelectorIndex < this.mMinValue) {\n                    nextScrollSelectorIndex = this.mMaxValue;\n                }\n                selectorIndices[0] = nextScrollSelectorIndex;\n                this.ensureCachedScrollSelectorValue(nextScrollSelectorIndex);\n            }\n            ensureCachedScrollSelectorValue(selectorIndex) {\n                let cache = this.mSelectorIndexToStringCache;\n                let scrollSelectorValue = cache.get(selectorIndex);\n                if (scrollSelectorValue != null) {\n                    return;\n                }\n                if (selectorIndex < this.mMinValue || selectorIndex > this.mMaxValue) {\n                    scrollSelectorValue = \"\";\n                }\n                else {\n                    if (this.mDisplayedValues != null) {\n                        let displayedValueIndex = selectorIndex - this.mMinValue;\n                        scrollSelectorValue = this.mDisplayedValues[displayedValueIndex];\n                    }\n                    else {\n                        scrollSelectorValue = this.formatNumber(selectorIndex);\n                    }\n                }\n                cache.put(selectorIndex, scrollSelectorValue);\n            }\n            formatNumber(value) {\n                return (this.mFormatter != null) ? this.mFormatter.format(value) : NumberPicker.formatNumberWithLocale(value);\n            }\n            validateInputTextView(v) {\n            }\n            updateInputTextView() {\n                return false;\n            }\n            notifyChange(previous, current) {\n                if (this.mOnValueChangeListener != null) {\n                    this.mOnValueChangeListener.onValueChange(this, previous, this.mValue);\n                }\n            }\n            postChangeCurrentByOneFromLongPress(increment, delayMillis) {\n                if (this.mChangeCurrentByOneFromLongPressCommand == null) {\n                    this.mChangeCurrentByOneFromLongPressCommand = new NumberPicker.ChangeCurrentByOneFromLongPressCommand(this);\n                }\n                else {\n                    this.removeCallbacks(this.mChangeCurrentByOneFromLongPressCommand);\n                }\n                this.mChangeCurrentByOneFromLongPressCommand.setStep(increment);\n                this.postDelayed(this.mChangeCurrentByOneFromLongPressCommand, delayMillis);\n            }\n            removeChangeCurrentByOneFromLongPress() {\n                if (this.mChangeCurrentByOneFromLongPressCommand != null) {\n                    this.removeCallbacks(this.mChangeCurrentByOneFromLongPressCommand);\n                }\n            }\n            postBeginSoftInputOnLongPressCommand() {\n                if (this.mBeginSoftInputOnLongPressCommand == null) {\n                    this.mBeginSoftInputOnLongPressCommand = new NumberPicker.BeginSoftInputOnLongPressCommand(this);\n                }\n                else {\n                    this.removeCallbacks(this.mBeginSoftInputOnLongPressCommand);\n                }\n                this.postDelayed(this.mBeginSoftInputOnLongPressCommand, ViewConfiguration.getLongPressTimeout());\n            }\n            removeBeginSoftInputCommand() {\n                if (this.mBeginSoftInputOnLongPressCommand != null) {\n                    this.removeCallbacks(this.mBeginSoftInputOnLongPressCommand);\n                }\n            }\n            removeAllCallbacks() {\n                if (this.mChangeCurrentByOneFromLongPressCommand != null) {\n                    this.removeCallbacks(this.mChangeCurrentByOneFromLongPressCommand);\n                }\n                if (this.mSetSelectionCommand != null) {\n                    this.removeCallbacks(this.mSetSelectionCommand);\n                }\n                if (this.mBeginSoftInputOnLongPressCommand != null) {\n                    this.removeCallbacks(this.mBeginSoftInputOnLongPressCommand);\n                }\n                this.mPressedStateHelper.cancel();\n            }\n            getSelectedPos(value) {\n                if (this.mDisplayedValues == null) {\n                    try {\n                        return Integer.parseInt(value);\n                    }\n                    catch (e) {\n                    }\n                }\n                else {\n                    for (let i = 0; i < this.mDisplayedValues.length; i++) {\n                        value = value.toLowerCase();\n                        if (this.mDisplayedValues[i].toLowerCase().startsWith(value)) {\n                            return this.mMinValue + i;\n                        }\n                    }\n                    try {\n                        return Integer.parseInt(value);\n                    }\n                    catch (e) {\n                    }\n                }\n                return this.mMinValue;\n            }\n            postSetSelectionCommand(selectionStart, selectionEnd) {\n                if (this.mSetSelectionCommand == null) {\n                    this.mSetSelectionCommand = new NumberPicker.SetSelectionCommand(this);\n                }\n                else {\n                    this.removeCallbacks(this.mSetSelectionCommand);\n                }\n                this.mSetSelectionCommand.mSelectionStart = selectionStart;\n                this.mSetSelectionCommand.mSelectionEnd = selectionEnd;\n                this.post(this.mSetSelectionCommand);\n            }\n            ensureScrollWheelAdjusted() {\n                let deltaY = this.mInitialScrollOffset - this.mCurrentScrollOffset;\n                if (deltaY != 0) {\n                    this.mPreviousScrollerY = 0;\n                    if (Math.abs(deltaY) > this.mSelectorElementHeight / 2) {\n                        deltaY += (deltaY > 0) ? -this.mSelectorElementHeight : this.mSelectorElementHeight;\n                    }\n                    this.mAdjustScroller.startScroll(0, 0, 0, deltaY, NumberPicker.SELECTOR_ADJUSTMENT_DURATION_MILLIS);\n                    this.invalidate();\n                    return true;\n                }\n                return false;\n            }\n            static formatNumberWithLocale(value) {\n                return value + '';\n            }\n        }\n        NumberPicker.DEFAULT_LONG_PRESS_UPDATE_INTERVAL = 300;\n        NumberPicker.SELECTOR_MAX_FLING_VELOCITY_ADJUSTMENT = 8;\n        NumberPicker.SELECTOR_ADJUSTMENT_DURATION_MILLIS = 800;\n        NumberPicker.SNAP_SCROLL_DURATION = 300;\n        NumberPicker.TOP_AND_BOTTOM_FADING_EDGE_STRENGTH = 0.9;\n        NumberPicker.UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT = 2;\n        NumberPicker.UNSCALED_DEFAULT_SELECTION_DIVIDERS_DISTANCE = 48;\n        NumberPicker.SIZE_UNSPECIFIED = -1;\n        widget.NumberPicker = NumberPicker;\n        (function (NumberPicker) {\n            class TwoDigitFormatter {\n                format(value) {\n                    let s = value + '';\n                    if (s.length === 1)\n                        s = '0' + s;\n                    return s;\n                }\n            }\n            NumberPicker.TwoDigitFormatter = TwoDigitFormatter;\n            var OnScrollListener;\n            (function (OnScrollListener) {\n                OnScrollListener.SCROLL_STATE_IDLE = 0;\n                OnScrollListener.SCROLL_STATE_TOUCH_SCROLL = 1;\n                OnScrollListener.SCROLL_STATE_FLING = 2;\n            })(OnScrollListener = NumberPicker.OnScrollListener || (NumberPicker.OnScrollListener = {}));\n            class PressedStateHelper {\n                constructor(arg) {\n                    this.MODE_PRESS = 1;\n                    this.MODE_TAPPED = 2;\n                    this.mManagedButton = 0;\n                    this.mMode = 0;\n                    this._NumberPicker_this = arg;\n                }\n                cancel() {\n                    this.mMode = 0;\n                    this.mManagedButton = 0;\n                    this._NumberPicker_this.removeCallbacks(this);\n                    if (this._NumberPicker_this.mIncrementVirtualButtonPressed) {\n                        this._NumberPicker_this.mIncrementVirtualButtonPressed = false;\n                        this._NumberPicker_this.invalidate(0, this._NumberPicker_this.mBottomSelectionDividerBottom, this._NumberPicker_this.mRight, this._NumberPicker_this.mBottom);\n                    }\n                    if (this._NumberPicker_this.mDecrementVirtualButtonPressed) {\n                        this._NumberPicker_this.mDecrementVirtualButtonPressed = false;\n                        this._NumberPicker_this.invalidate(0, 0, this._NumberPicker_this.mRight, this._NumberPicker_this.mTopSelectionDividerTop);\n                    }\n                }\n                buttonPressDelayed(button) {\n                    this.cancel();\n                    this.mMode = this.MODE_PRESS;\n                    this.mManagedButton = button;\n                    this._NumberPicker_this.postDelayed(this, ViewConfiguration.getTapTimeout());\n                }\n                buttonTapped(button) {\n                    this.cancel();\n                    this.mMode = this.MODE_TAPPED;\n                    this.mManagedButton = button;\n                    this._NumberPicker_this.post(this);\n                }\n                run() {\n                    switch (this.mMode) {\n                        case this.MODE_PRESS:\n                            {\n                                switch (this.mManagedButton) {\n                                    case PressedStateHelper.BUTTON_INCREMENT:\n                                        {\n                                            this._NumberPicker_this.mIncrementVirtualButtonPressed = true;\n                                            this._NumberPicker_this.invalidate(0, this._NumberPicker_this.mBottomSelectionDividerBottom, this._NumberPicker_this.mRight, this._NumberPicker_this.mBottom);\n                                        }\n                                        break;\n                                    case PressedStateHelper.BUTTON_DECREMENT:\n                                        {\n                                            this._NumberPicker_this.mDecrementVirtualButtonPressed = true;\n                                            this._NumberPicker_this.invalidate(0, 0, this._NumberPicker_this.mRight, this._NumberPicker_this.mTopSelectionDividerTop);\n                                        }\n                                }\n                            }\n                            break;\n                        case this.MODE_TAPPED:\n                            {\n                                switch (this.mManagedButton) {\n                                    case PressedStateHelper.BUTTON_INCREMENT:\n                                        {\n                                            if (!this._NumberPicker_this.mIncrementVirtualButtonPressed) {\n                                                this._NumberPicker_this.postDelayed(this, ViewConfiguration.getPressedStateDuration());\n                                            }\n                                            this._NumberPicker_this.mIncrementVirtualButtonPressed = !this._NumberPicker_this.mIncrementVirtualButtonPressed;\n                                            this._NumberPicker_this.invalidate(0, this._NumberPicker_this.mBottomSelectionDividerBottom, this._NumberPicker_this.mRight, this._NumberPicker_this.mBottom);\n                                        }\n                                        break;\n                                    case PressedStateHelper.BUTTON_DECREMENT:\n                                        {\n                                            if (!this._NumberPicker_this.mDecrementVirtualButtonPressed) {\n                                                this._NumberPicker_this.postDelayed(this, ViewConfiguration.getPressedStateDuration());\n                                            }\n                                            this._NumberPicker_this.mDecrementVirtualButtonPressed = !this._NumberPicker_this.mDecrementVirtualButtonPressed;\n                                            this._NumberPicker_this.invalidate(0, 0, this._NumberPicker_this.mRight, this._NumberPicker_this.mTopSelectionDividerTop);\n                                        }\n                                }\n                            }\n                            break;\n                    }\n                }\n            }\n            PressedStateHelper.BUTTON_INCREMENT = 1;\n            PressedStateHelper.BUTTON_DECREMENT = 2;\n            NumberPicker.PressedStateHelper = PressedStateHelper;\n            class SetSelectionCommand {\n                constructor(arg) {\n                    this.mSelectionStart = 0;\n                    this.mSelectionEnd = 0;\n                    this._NumberPicker_this = arg;\n                }\n                run() {\n                }\n            }\n            NumberPicker.SetSelectionCommand = SetSelectionCommand;\n            class ChangeCurrentByOneFromLongPressCommand {\n                constructor(arg) {\n                    this._NumberPicker_this = arg;\n                }\n                setStep(increment) {\n                    this.mIncrement = increment;\n                }\n                run() {\n                    this._NumberPicker_this.changeValueByOne(this.mIncrement);\n                    this._NumberPicker_this.postDelayed(this, this._NumberPicker_this.mLongPressUpdateInterval);\n                }\n            }\n            NumberPicker.ChangeCurrentByOneFromLongPressCommand = ChangeCurrentByOneFromLongPressCommand;\n            class BeginSoftInputOnLongPressCommand {\n                constructor(arg) {\n                    this._NumberPicker_this = arg;\n                }\n                run() {\n                    this._NumberPicker_this.showSoftInput();\n                    this._NumberPicker_this.mIngonreMoveEvents = true;\n                }\n            }\n            NumberPicker.BeginSoftInputOnLongPressCommand = BeginSoftInputOnLongPressCommand;\n        })(NumberPicker = widget.NumberPicker || (widget.NumberPicker = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var graphics;\n    (function (graphics) {\n        var drawable;\n        (function (drawable_8) {\n            var Rect = android.graphics.Rect;\n            var Gravity = android.view.Gravity;\n            var Drawable = android.graphics.drawable.Drawable;\n            class ClipDrawable extends Drawable {\n                constructor(...args) {\n                    super();\n                    this.mTmpRect = new Rect();\n                    if (args.length <= 1) {\n                        this.mClipState = new ClipDrawable.ClipState(args[0], this);\n                    }\n                    else {\n                        this.mClipState = new ClipDrawable.ClipState(null, this);\n                        let drawable = args[0];\n                        let gravity = args[1];\n                        let orientation = args[2];\n                        this.mClipState.mDrawable = drawable;\n                        this.mClipState.mGravity = gravity;\n                        this.mClipState.mOrientation = orientation;\n                        if (drawable != null) {\n                            drawable.setCallback(this);\n                        }\n                    }\n                }\n                inflate(r, parser) {\n                    super.inflate(r, parser);\n                    let a = r.obtainAttributes(parser);\n                    let orientation = a.getInt(\"android:clipOrientation\", ClipDrawable.HORIZONTAL);\n                    let gStr = a.getString(\"android:gravity\");\n                    let g = Gravity.parseGravity(gStr, Gravity.LEFT);\n                    let dr = a.getDrawable(\"android:drawable\");\n                    a.recycle();\n                    if (!dr && parser.children[0] instanceof HTMLElement) {\n                        dr = Drawable.createFromXml(r, parser.children[0]);\n                    }\n                    if (dr == null) {\n                        throw Error(`new IllegalArgumentException(\"No drawable specified for <clip>\")`);\n                    }\n                    this.mClipState.mDrawable = dr;\n                    this.mClipState.mOrientation = orientation;\n                    this.mClipState.mGravity = g;\n                    dr.setCallback(this);\n                }\n                drawableSizeChange(who) {\n                    const callback = this.getCallback();\n                    if (callback != null && callback.drawableSizeChange) {\n                        callback.drawableSizeChange(this);\n                    }\n                }\n                invalidateDrawable(who) {\n                    const callback = this.getCallback();\n                    if (callback != null) {\n                        callback.invalidateDrawable(this);\n                    }\n                }\n                scheduleDrawable(who, what, when) {\n                    const callback = this.getCallback();\n                    if (callback != null) {\n                        callback.scheduleDrawable(this, what, when);\n                    }\n                }\n                unscheduleDrawable(who, what) {\n                    const callback = this.getCallback();\n                    if (callback != null) {\n                        callback.unscheduleDrawable(this, what);\n                    }\n                }\n                getPadding(padding) {\n                    return this.mClipState.mDrawable.getPadding(padding);\n                }\n                setVisible(visible, restart) {\n                    this.mClipState.mDrawable.setVisible(visible, restart);\n                    return super.setVisible(visible, restart);\n                }\n                setAlpha(alpha) {\n                    this.mClipState.mDrawable.setAlpha(alpha);\n                }\n                getAlpha() {\n                    return this.mClipState.mDrawable.getAlpha();\n                }\n                getOpacity() {\n                    return this.mClipState.mDrawable.getOpacity();\n                }\n                isStateful() {\n                    return this.mClipState.mDrawable.isStateful();\n                }\n                onStateChange(state) {\n                    return this.mClipState.mDrawable.setState(state);\n                }\n                onLevelChange(level) {\n                    this.mClipState.mDrawable.setLevel(level);\n                    this.invalidateSelf();\n                    return true;\n                }\n                onBoundsChange(bounds) {\n                    this.mClipState.mDrawable.setBounds(bounds);\n                }\n                draw(canvas) {\n                    if (this.mClipState.mDrawable.getLevel() == 0) {\n                        return;\n                    }\n                    const r = this.mTmpRect;\n                    const bounds = this.getBounds();\n                    let level = this.getLevel();\n                    let w = bounds.width();\n                    const iw = 0;\n                    if ((this.mClipState.mOrientation & ClipDrawable.HORIZONTAL) != 0) {\n                        w -= (w - iw) * (10000 - level) / 10000;\n                    }\n                    let h = bounds.height();\n                    const ih = 0;\n                    if ((this.mClipState.mOrientation & ClipDrawable.VERTICAL) != 0) {\n                        h -= (h - ih) * (10000 - level) / 10000;\n                    }\n                    Gravity.apply(this.mClipState.mGravity, w, h, bounds, r);\n                    if (w > 0 && h > 0) {\n                        canvas.save();\n                        canvas.clipRect(r);\n                        this.mClipState.mDrawable.draw(canvas);\n                        canvas.restore();\n                    }\n                }\n                getIntrinsicWidth() {\n                    return this.mClipState.mDrawable.getIntrinsicWidth();\n                }\n                getIntrinsicHeight() {\n                    return this.mClipState.mDrawable.getIntrinsicHeight();\n                }\n                getConstantState() {\n                    if (this.mClipState.canConstantState()) {\n                        return this.mClipState;\n                    }\n                    return null;\n                }\n            }\n            ClipDrawable.HORIZONTAL = 1;\n            ClipDrawable.VERTICAL = 2;\n            drawable_8.ClipDrawable = ClipDrawable;\n            (function (ClipDrawable) {\n                class ClipState {\n                    constructor(orig, owner) {\n                        this.mOrientation = 0;\n                        this.mGravity = 0;\n                        if (orig != null) {\n                            this.mDrawable = orig.mDrawable.getConstantState().newDrawable();\n                            this.mDrawable.setCallback(owner);\n                            this.mOrientation = orig.mOrientation;\n                            this.mGravity = orig.mGravity;\n                            this.mCheckedConstantState = this.mCanConstantState = true;\n                        }\n                    }\n                    newDrawable() {\n                        return new ClipDrawable(this);\n                    }\n                    canConstantState() {\n                        if (!this.mCheckedConstantState) {\n                            this.mCanConstantState = this.mDrawable.getConstantState() != null;\n                            this.mCheckedConstantState = true;\n                        }\n                        return this.mCanConstantState;\n                    }\n                }\n                ClipDrawable.ClipState = ClipState;\n            })(ClipDrawable = drawable_8.ClipDrawable || (drawable_8.ClipDrawable = {}));\n        })(drawable = graphics.drawable || (graphics.drawable = {}));\n    })(graphics = android.graphics || (android.graphics = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var Animatable = android.graphics.drawable.Animatable;\n        var AnimationDrawable = android.graphics.drawable.AnimationDrawable;\n        var LayerDrawable = android.graphics.drawable.LayerDrawable;\n        var StateListDrawable = android.graphics.drawable.StateListDrawable;\n        var ClipDrawable = android.graphics.drawable.ClipDrawable;\n        var SynchronizedPool = android.util.Pools.SynchronizedPool;\n        var Gravity = android.view.Gravity;\n        var View = android.view.View;\n        var AlphaAnimation = android.view.animation.AlphaAnimation;\n        var Animation = android.view.animation.Animation;\n        var LinearInterpolator = android.view.animation.LinearInterpolator;\n        var Transformation = android.view.animation.Transformation;\n        var ArrayList = java.util.ArrayList;\n        var R = android.R;\n        var NetDrawable = androidui.image.NetDrawable;\n        class ProgressBar extends View {\n            constructor(context, bindElement, defStyle = android.R.attr.progressBarStyle) {\n                super(context, bindElement, defStyle);\n                this.mMinWidth = 0;\n                this.mMaxWidth = 0;\n                this.mMinHeight = 0;\n                this.mMaxHeight = 0;\n                this.mProgress = 0;\n                this.mSecondaryProgress = 0;\n                this.mMax = 0;\n                this.mBehavior = 0;\n                this.mDuration = 0;\n                this.mMirrorForRtl = false;\n                this.mRefreshData = new ArrayList();\n                this.initProgressBar();\n                let a = context.obtainStyledAttributes(bindElement, defStyle);\n                this.mNoInvalidate = true;\n                let drawable = a.getDrawable('progressDrawable');\n                if (drawable != null) {\n                    drawable = this.tileify(drawable, false);\n                    this.setProgressDrawable(drawable);\n                }\n                this.mDuration = a.getInt('indeterminateDuration', this.mDuration);\n                this.mMinWidth = a.getDimensionPixelSize('minWidth', this.mMinWidth);\n                this.mMaxWidth = a.getDimensionPixelSize('maxWidth', this.mMaxWidth);\n                this.mMinHeight = a.getDimensionPixelSize('minHeight', this.mMinHeight);\n                this.mMaxHeight = a.getDimensionPixelSize('maxHeight', this.mMaxHeight);\n                if (a.getAttrValue('indeterminateBehavior') == 'cycle') {\n                    this.mBehavior = Animation.REVERSE;\n                }\n                else {\n                    this.mBehavior = Animation.RESTART;\n                }\n                this.setMax(a.getInt('max', this.mMax));\n                this.setProgress(a.getInt('progress', this.mProgress));\n                this.setSecondaryProgress(a.getInt('secondaryProgress', this.mSecondaryProgress));\n                drawable = a.getDrawable('indeterminateDrawable');\n                if (drawable != null) {\n                    drawable = this.tileifyIndeterminate(drawable);\n                    this.setIndeterminateDrawable(drawable);\n                }\n                this.mOnlyIndeterminate = a.getBoolean('indeterminateOnly', this.mOnlyIndeterminate);\n                this.mNoInvalidate = false;\n                this.setIndeterminate(this.mOnlyIndeterminate || a.getBoolean('indeterminate', this.mIndeterminate));\n                this.mMirrorForRtl = a.getBoolean('mirrorForRtl', this.mMirrorForRtl);\n                a.recycle();\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('progressDrawable', {\n                    setter(v, value, a) {\n                        let drawable = a.parseDrawable(value);\n                        if (drawable != null) {\n                            drawable = v.tileify(drawable, false);\n                            v.setProgressDrawable(drawable);\n                        }\n                    }, getter(v) {\n                        return v.getProgressDrawable();\n                    }\n                }).set('indeterminateDuration', {\n                    setter(v, value, a) {\n                        v.mDuration = Math.floor(a.parseInt(value, v.mDuration));\n                    }, getter(v) {\n                        return v.mDuration;\n                    }\n                }).set('minWidth', {\n                    setter(v, value, a) {\n                        v.mMinWidth = Math.floor(a.parseNumberPixelSize(value, v.mMinWidth));\n                    }, getter(v) {\n                        return v.mMinWidth;\n                    }\n                }).set('maxWidth', {\n                    setter(v, value, a) {\n                        v.mMaxWidth = Math.floor(a.parseNumberPixelSize(value, v.mMaxWidth));\n                    }, getter(v) {\n                        return v.mMaxWidth;\n                    }\n                }).set('minHeight', {\n                    setter(v, value, a) {\n                        v.mMinHeight = Math.floor(a.parseNumberPixelSize(value, v.mMinHeight));\n                    }, getter(v) {\n                        return v.mMinHeight;\n                    }\n                }).set('maxHeight', {\n                    setter(v, value, a) {\n                        v.mMaxHeight = Math.floor(a.parseNumberPixelSize(value, v.mMaxHeight));\n                    }, getter(v) {\n                        return v.mMaxHeight;\n                    }\n                }).set('indeterminateBehavior', {\n                    setter(v, value, a) {\n                        if (Number.isInteger(Number.parseInt(value))) {\n                            v.mBehavior = Number.parseInt(value);\n                        }\n                        else {\n                            if (value + ''.toLowerCase() == 'cycle') {\n                                v.mBehavior = Animation.REVERSE;\n                            }\n                            else {\n                                v.mBehavior = Animation.RESTART;\n                            }\n                        }\n                    }, getter(v) {\n                        return v.mBehavior;\n                    }\n                }).set('interpolator', {\n                    setter(v, value, a) {\n                    }, getter(v) {\n                    }\n                }).set('max', {\n                    setter(v, value, a) {\n                        v.setMax(a.parseInt(value, v.mMax));\n                    }, getter(v) {\n                        return v.mMax;\n                    }\n                }).set('progress', {\n                    setter(v, value, a) {\n                        v.setProgress(a.parseInt(value, v.mProgress));\n                    }, getter(v) {\n                        return v.mProgress;\n                    }\n                }).set('secondaryProgress', {\n                    setter(v, value, a) {\n                        v.setSecondaryProgress(a.parseInt(value, v.mSecondaryProgress));\n                    }, getter(v) {\n                        return v.mSecondaryProgress;\n                    }\n                }).set('indeterminateDrawable', {\n                    setter(v, value, a) {\n                        let drawable = a.parseDrawable(value);\n                        if (drawable != null) {\n                            drawable = v.tileifyIndeterminate(drawable);\n                            v.setIndeterminateDrawable(drawable);\n                        }\n                    }, getter(v) {\n                        return v.mIndeterminateDrawable;\n                    }\n                }).set('indeterminateOnly', {\n                    setter(v, value, a) {\n                        v.mOnlyIndeterminate = a.parseBoolean(value, v.mOnlyIndeterminate);\n                        v.setIndeterminate(v.mOnlyIndeterminate || v.mIndeterminate);\n                    }, getter(v) {\n                        return v.mOnlyIndeterminate;\n                    }\n                }).set('indeterminate', {\n                    setter(v, value, a) {\n                        v.setIndeterminate(v.mOnlyIndeterminate || a.parseBoolean(value, v.mIndeterminate));\n                    }, getter(v) {\n                        return v.mIndeterminate;\n                    }\n                });\n            }\n            tileify(drawable, clip) {\n                if (drawable instanceof LayerDrawable) {\n                    let background = drawable;\n                    const N = background.getNumberOfLayers();\n                    let outDrawables = new Array(N);\n                    let drawableChange = false;\n                    for (let i = 0; i < N; i++) {\n                        let id = background.getId(i);\n                        let orig = background.getDrawable(i);\n                        outDrawables[i] = this.tileify(orig, (id == R.id.progress || id == R.id.secondaryProgress));\n                        drawableChange = drawableChange || outDrawables[i] !== orig;\n                    }\n                    if (!drawableChange)\n                        return background;\n                    let newBg = new LayerDrawable(outDrawables);\n                    for (let i = 0; i < N; i++) {\n                        newBg.setId(i, background.getId(i));\n                    }\n                    return newBg;\n                }\n                else if (drawable instanceof StateListDrawable) {\n                    let _in = drawable;\n                    let out = new StateListDrawable();\n                    let numStates = _in.getStateCount();\n                    for (let i = 0; i < numStates; i++) {\n                        out.addState(_in.getStateSet(i), this.tileify(_in.getStateDrawable(i), clip));\n                    }\n                    return out;\n                }\n                else if (drawable instanceof NetDrawable) {\n                    const netDrawable = drawable;\n                    if (this.mSampleTile == null) {\n                        this.mSampleTile = netDrawable;\n                    }\n                    netDrawable.setTileMode(NetDrawable.TileMode.REPEAT, null);\n                    return (clip) ? new ClipDrawable(netDrawable, Gravity.LEFT, ClipDrawable.HORIZONTAL) : netDrawable;\n                }\n                return drawable;\n            }\n            tileifyIndeterminate(drawable) {\n                if (drawable instanceof AnimationDrawable) {\n                    let background = drawable;\n                    const N = background.getNumberOfFrames();\n                    let newBg = new AnimationDrawable();\n                    newBg.setOneShot(background.isOneShot());\n                    for (let i = 0; i < N; i++) {\n                        let frame = this.tileify(background.getFrame(i), true);\n                        frame.setLevel(10000);\n                        newBg.addFrame(frame, background.getDuration(i));\n                    }\n                    newBg.setLevel(10000);\n                    drawable = newBg;\n                }\n                return drawable;\n            }\n            initProgressBar() {\n                this.mMax = 100;\n                this.mProgress = 0;\n                this.mSecondaryProgress = 0;\n                this.mIndeterminate = false;\n                this.mOnlyIndeterminate = false;\n                this.mDuration = 4000;\n                this.mBehavior = AlphaAnimation.RESTART;\n                this.mMinWidth = 24;\n                this.mMaxWidth = 48;\n                this.mMinHeight = 24;\n                this.mMaxHeight = 48;\n            }\n            isIndeterminate() {\n                return this.mIndeterminate;\n            }\n            setIndeterminate(indeterminate) {\n                if ((!this.mOnlyIndeterminate || !this.mIndeterminate) && indeterminate != this.mIndeterminate) {\n                    this.mIndeterminate = indeterminate;\n                    if (indeterminate) {\n                        this.mCurrentDrawable = this.mIndeterminateDrawable;\n                        this.startAnimation();\n                    }\n                    else {\n                        this.mCurrentDrawable = this.mProgressDrawable;\n                        this.stopAnimation();\n                    }\n                }\n            }\n            getIndeterminateDrawable() {\n                return this.mIndeterminateDrawable;\n            }\n            setIndeterminateDrawable(d) {\n                if (d != null) {\n                    d.setCallback(this);\n                }\n                this.mIndeterminateDrawable = d;\n                if (this.mIndeterminate) {\n                    this.mCurrentDrawable = d;\n                    this.postInvalidate();\n                }\n            }\n            getProgressDrawable() {\n                return this.mProgressDrawable;\n            }\n            setProgressDrawable(d) {\n                let needUpdate;\n                if (this.mProgressDrawable != null && d != this.mProgressDrawable) {\n                    this.mProgressDrawable.setCallback(null);\n                    needUpdate = true;\n                }\n                else {\n                    needUpdate = false;\n                }\n                if (d != null) {\n                    d.setCallback(this);\n                    let drawableHeight = d.getMinimumHeight();\n                    if (this.mMaxHeight < drawableHeight) {\n                        this.mMaxHeight = drawableHeight;\n                        this.requestLayout();\n                    }\n                }\n                this.mProgressDrawable = d;\n                if (!this.mIndeterminate) {\n                    this.mCurrentDrawable = d;\n                    this.postInvalidate();\n                }\n                if (needUpdate) {\n                    this.updateDrawableBounds(this.getWidth(), this.getHeight());\n                    this.updateDrawableState();\n                    this.doRefreshProgress(R.id.progress, this.mProgress, false, false);\n                    this.doRefreshProgress(R.id.secondaryProgress, this.mSecondaryProgress, false, false);\n                }\n            }\n            getCurrentDrawable() {\n                return this.mCurrentDrawable;\n            }\n            verifyDrawable(who) {\n                return who == this.mProgressDrawable || who == this.mIndeterminateDrawable || super.verifyDrawable(who);\n            }\n            jumpDrawablesToCurrentState() {\n                super.jumpDrawablesToCurrentState();\n                if (this.mProgressDrawable != null)\n                    this.mProgressDrawable.jumpToCurrentState();\n                if (this.mIndeterminateDrawable != null)\n                    this.mIndeterminateDrawable.jumpToCurrentState();\n            }\n            postInvalidate() {\n                if (!this.mNoInvalidate) {\n                    super.postInvalidate();\n                }\n            }\n            doRefreshProgress(id, progress, fromUser, callBackToApp) {\n                let scale = this.mMax > 0 ? progress / this.mMax : 0;\n                const d = this.mCurrentDrawable;\n                if (d != null) {\n                    let progressDrawable = null;\n                    if (d instanceof LayerDrawable) {\n                        progressDrawable = d.findDrawableByLayerId(id);\n                    }\n                    const level = Math.floor((scale * ProgressBar.MAX_LEVEL));\n                    (progressDrawable != null ? progressDrawable : d).setLevel(level);\n                }\n                else {\n                    this.invalidate();\n                }\n                if (callBackToApp && id == R.id.progress) {\n                    this.onProgressRefresh(scale, fromUser);\n                }\n            }\n            onProgressRefresh(scale, fromUser) {\n            }\n            refreshProgress(id, progress, fromUser) {\n                this.doRefreshProgress(id, progress, fromUser, true);\n            }\n            setProgress(progress, fromUser = false) {\n                if (this.mIndeterminate) {\n                    return;\n                }\n                if (progress < 0) {\n                    progress = 0;\n                }\n                if (progress > this.mMax) {\n                    progress = this.mMax;\n                }\n                if (progress != this.mProgress) {\n                    this.mProgress = progress;\n                    this.refreshProgress(R.id.progress, this.mProgress, fromUser);\n                }\n            }\n            setSecondaryProgress(secondaryProgress) {\n                if (this.mIndeterminate) {\n                    return;\n                }\n                if (secondaryProgress < 0) {\n                    secondaryProgress = 0;\n                }\n                if (secondaryProgress > this.mMax) {\n                    secondaryProgress = this.mMax;\n                }\n                if (secondaryProgress != this.mSecondaryProgress) {\n                    this.mSecondaryProgress = secondaryProgress;\n                    this.refreshProgress(R.id.secondaryProgress, this.mSecondaryProgress, false);\n                }\n            }\n            getProgress() {\n                return this.mIndeterminate ? 0 : this.mProgress;\n            }\n            getSecondaryProgress() {\n                return this.mIndeterminate ? 0 : this.mSecondaryProgress;\n            }\n            getMax() {\n                return this.mMax;\n            }\n            setMax(max) {\n                if (max < 0) {\n                    max = 0;\n                }\n                if (max != this.mMax) {\n                    this.mMax = max;\n                    this.postInvalidate();\n                    if (this.mProgress > max) {\n                        this.mProgress = max;\n                    }\n                    this.refreshProgress(R.id.progress, this.mProgress, false);\n                }\n            }\n            incrementProgressBy(diff) {\n                this.setProgress(this.mProgress + diff);\n            }\n            incrementSecondaryProgressBy(diff) {\n                this.setSecondaryProgress(this.mSecondaryProgress + diff);\n            }\n            startAnimation() {\n                if (this.getVisibility() != ProgressBar.VISIBLE) {\n                    return;\n                }\n                if (Animatable.isImpl(this.mIndeterminateDrawable)) {\n                    this.mShouldStartAnimationDrawable = true;\n                    this.mHasAnimation = false;\n                }\n                else {\n                    this.mHasAnimation = true;\n                    if (this.mInterpolator == null) {\n                        this.mInterpolator = new LinearInterpolator();\n                    }\n                    if (this.mTransformation == null) {\n                        this.mTransformation = new Transformation();\n                    }\n                    else {\n                        this.mTransformation.clear();\n                    }\n                    if (this.mAnimation == null) {\n                        this.mAnimation = new AlphaAnimation(0.0, 1.0);\n                    }\n                    else {\n                        this.mAnimation.reset();\n                    }\n                    this.mAnimation.setRepeatMode(this.mBehavior);\n                    this.mAnimation.setRepeatCount(Animation.INFINITE);\n                    this.mAnimation.setDuration(this.mDuration);\n                    this.mAnimation.setInterpolator(this.mInterpolator);\n                    this.mAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);\n                }\n                this.postInvalidate();\n            }\n            stopAnimation() {\n                this.mHasAnimation = false;\n                if (Animatable.isImpl(this.mIndeterminateDrawable)) {\n                    this.mIndeterminateDrawable.stop();\n                    this.mShouldStartAnimationDrawable = false;\n                }\n                this.postInvalidate();\n            }\n            setInterpolator(interpolator) {\n                this.mInterpolator = interpolator;\n            }\n            getInterpolator() {\n                return this.mInterpolator;\n            }\n            setVisibility(v) {\n                if (this.getVisibility() != v) {\n                    super.setVisibility(v);\n                    if (this.mIndeterminate) {\n                        if (v == ProgressBar.GONE || v == ProgressBar.INVISIBLE) {\n                            this.stopAnimation();\n                        }\n                        else {\n                            this.startAnimation();\n                        }\n                    }\n                }\n            }\n            onVisibilityChanged(changedView, visibility) {\n                super.onVisibilityChanged(changedView, visibility);\n                if (this.mIndeterminate) {\n                    if (visibility == ProgressBar.GONE || visibility == ProgressBar.INVISIBLE) {\n                        this.stopAnimation();\n                    }\n                    else {\n                        this.startAnimation();\n                    }\n                }\n            }\n            invalidateDrawable(dr) {\n                if (!this.mInDrawing) {\n                    if (this.verifyDrawable(dr)) {\n                        const dirty = dr.getBounds();\n                        const scrollX = this.mScrollX + this.mPaddingLeft;\n                        const scrollY = this.mScrollY + this.mPaddingTop;\n                        this.invalidate(dirty.left + scrollX, dirty.top + scrollY, dirty.right + scrollX, dirty.bottom + scrollY);\n                    }\n                    else {\n                        super.invalidateDrawable(dr);\n                    }\n                }\n            }\n            onSizeChanged(w, h, oldw, oldh) {\n                this.updateDrawableBounds(w, h);\n            }\n            updateDrawableBounds(w, h) {\n                w -= this.mPaddingRight + this.mPaddingLeft;\n                h -= this.mPaddingTop + this.mPaddingBottom;\n                let right = w;\n                let bottom = h;\n                let top = 0;\n                let left = 0;\n                if (this.mIndeterminateDrawable != null) {\n                    if (this.mOnlyIndeterminate && !(this.mIndeterminateDrawable instanceof AnimationDrawable)) {\n                        const intrinsicWidth = this.mIndeterminateDrawable.getIntrinsicWidth();\n                        const intrinsicHeight = this.mIndeterminateDrawable.getIntrinsicHeight();\n                        const intrinsicAspect = intrinsicWidth / intrinsicHeight;\n                        const boundAspect = w / h;\n                        if (intrinsicAspect != boundAspect) {\n                            if (boundAspect > intrinsicAspect) {\n                                const width = Math.floor((h * intrinsicAspect));\n                                left = (w - width) / 2;\n                                right = left + width;\n                            }\n                            else {\n                                const height = Math.floor((w * (1 / intrinsicAspect)));\n                                top = (h - height) / 2;\n                                bottom = top + height;\n                            }\n                        }\n                    }\n                    if (this.isLayoutRtl() && this.mMirrorForRtl) {\n                        let tempLeft = left;\n                        left = w - right;\n                        right = w - tempLeft;\n                    }\n                    this.mIndeterminateDrawable.setBounds(left, top, right, bottom);\n                }\n                if (this.mProgressDrawable != null) {\n                    this.mProgressDrawable.setBounds(0, 0, right, bottom);\n                }\n            }\n            onDraw(canvas) {\n                super.onDraw(canvas);\n                let d = this.mCurrentDrawable;\n                if (d != null) {\n                    canvas.save();\n                    if (this.isLayoutRtl() && this.mMirrorForRtl) {\n                        canvas.translate(this.getWidth() - this.mPaddingRight, this.mPaddingTop);\n                        canvas.scale(-1.0, 1.0);\n                    }\n                    else {\n                        canvas.translate(this.mPaddingLeft, this.mPaddingTop);\n                    }\n                    let time = this.getDrawingTime();\n                    if (this.mHasAnimation) {\n                        this.mAnimation.getTransformation(time, this.mTransformation);\n                        let scale = this.mTransformation.getAlpha();\n                        try {\n                            this.mInDrawing = true;\n                            d.setLevel(Math.floor((scale * ProgressBar.MAX_LEVEL)));\n                        }\n                        finally {\n                            this.mInDrawing = false;\n                        }\n                        this.postInvalidateOnAnimation();\n                    }\n                    d.draw(canvas);\n                    canvas.restore();\n                    if (this.mShouldStartAnimationDrawable && Animatable.isImpl(d)) {\n                        d.start();\n                        this.mShouldStartAnimationDrawable = false;\n                    }\n                }\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                let d = this.mCurrentDrawable;\n                let dw = 0;\n                let dh = 0;\n                if (d != null) {\n                    dw = Math.max(this.mMinWidth, Math.min(this.mMaxWidth, d.getIntrinsicWidth()));\n                    dh = Math.max(this.mMinHeight, Math.min(this.mMaxHeight, d.getIntrinsicHeight()));\n                }\n                this.updateDrawableState();\n                dw += this.mPaddingLeft + this.mPaddingRight;\n                dh += this.mPaddingTop + this.mPaddingBottom;\n                this.setMeasuredDimension(ProgressBar.resolveSizeAndState(dw, widthMeasureSpec, 0), ProgressBar.resolveSizeAndState(dh, heightMeasureSpec, 0));\n            }\n            drawableStateChanged() {\n                super.drawableStateChanged();\n                this.updateDrawableState();\n            }\n            updateDrawableState() {\n                let state = this.getDrawableState();\n                if (this.mProgressDrawable != null && this.mProgressDrawable.isStateful()) {\n                    this.mProgressDrawable.setState(state);\n                }\n                if (this.mIndeterminateDrawable != null && this.mIndeterminateDrawable.isStateful()) {\n                    this.mIndeterminateDrawable.setState(state);\n                }\n            }\n            onAttachedToWindow() {\n                super.onAttachedToWindow();\n                if (this.mIndeterminate) {\n                    this.startAnimation();\n                }\n                if (this.mRefreshData != null) {\n                    {\n                        const count = this.mRefreshData.size();\n                        for (let i = 0; i < count; i++) {\n                            const rd = this.mRefreshData.get(i);\n                            this.doRefreshProgress(rd.id, rd.progress, rd.fromUser, true);\n                            rd.recycle();\n                        }\n                        this.mRefreshData.clear();\n                    }\n                }\n                this.mAttached = true;\n            }\n            onDetachedFromWindow() {\n                if (this.mIndeterminate) {\n                    this.stopAnimation();\n                }\n                super.onDetachedFromWindow();\n                this.mAttached = false;\n            }\n        }\n        ProgressBar.MAX_LEVEL = 10000;\n        ProgressBar.TIMEOUT_SEND_ACCESSIBILITY_EVENT = 200;\n        widget.ProgressBar = ProgressBar;\n        (function (ProgressBar) {\n            class RefreshData {\n                constructor() {\n                    this.progress = 0;\n                }\n                static obtain(id, progress, fromUser) {\n                    let rd = RefreshData.sPool.acquire();\n                    if (rd == null) {\n                        rd = new RefreshData();\n                    }\n                    rd.id = id;\n                    rd.progress = progress;\n                    rd.fromUser = fromUser;\n                    return rd;\n                }\n                recycle() {\n                    RefreshData.sPool.release(this);\n                }\n            }\n            RefreshData.POOL_MAX = 24;\n            RefreshData.sPool = new SynchronizedPool(RefreshData.POOL_MAX);\n            ProgressBar.RefreshData = RefreshData;\n        })(ProgressBar = widget.ProgressBar || (widget.ProgressBar = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var Gravity = android.view.Gravity;\n        var View = android.view.View;\n        var Button = android.widget.Button;\n        class CompoundButton extends Button {\n            constructor(context, bindElement, defStyle) {\n                super(context, bindElement, defStyle);\n                this.mButtonResource = 0;\n                const a = context.obtainStyledAttributes(bindElement, defStyle);\n                const d = a.getDrawable('button');\n                if (d != null) {\n                    this.setButtonDrawable(d);\n                }\n                const checked = a.getBoolean('checked', false);\n                this.setChecked(checked);\n                a.recycle();\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('button', {\n                    setter(v, value, attrBinder) {\n                        v.setButtonDrawable(attrBinder.parseDrawable(value));\n                    }, getter(v) {\n                        return v.mButtonDrawable;\n                    }\n                }).set('checked', {\n                    setter(v, value, attrBinder) {\n                        v.setChecked(attrBinder.parseBoolean(value, v.isChecked()));\n                    }, getter(v) {\n                        return v.isChecked();\n                    }\n                });\n            }\n            toggle() {\n                this.setChecked(!this.mChecked);\n            }\n            performClick() {\n                this.toggle();\n                return super.performClick();\n            }\n            isChecked() {\n                return this.mChecked;\n            }\n            setChecked(checked) {\n                if (this.mChecked != checked) {\n                    this.mChecked = checked;\n                    this.refreshDrawableState();\n                    if (this.mBroadcasting) {\n                        return;\n                    }\n                    this.mBroadcasting = true;\n                    if (this.mOnCheckedChangeListener != null) {\n                        this.mOnCheckedChangeListener.onCheckedChanged(this, this.mChecked);\n                    }\n                    if (this.mOnCheckedChangeWidgetListener != null) {\n                        this.mOnCheckedChangeWidgetListener.onCheckedChanged(this, this.mChecked);\n                    }\n                    this.mBroadcasting = false;\n                }\n            }\n            setOnCheckedChangeListener(listener) {\n                this.mOnCheckedChangeListener = listener;\n            }\n            setOnCheckedChangeWidgetListener(listener) {\n                this.mOnCheckedChangeWidgetListener = listener;\n            }\n            setButtonDrawable(d) {\n                if (d != null) {\n                    if (this.mButtonDrawable != null) {\n                        this.mButtonDrawable.setCallback(null);\n                        this.unscheduleDrawable(this.mButtonDrawable);\n                    }\n                    d.setCallback(this);\n                    d.setVisible(this.getVisibility() == CompoundButton.VISIBLE, false);\n                    this.mButtonDrawable = d;\n                    this.setMinHeight(this.mButtonDrawable.getIntrinsicHeight());\n                }\n                this.refreshDrawableState();\n            }\n            getCompoundPaddingLeft() {\n                let padding = super.getCompoundPaddingLeft();\n                if (!this.isLayoutRtl()) {\n                    const buttonDrawable = this.mButtonDrawable;\n                    if (buttonDrawable != null) {\n                        padding += buttonDrawable.getIntrinsicWidth();\n                    }\n                }\n                return padding;\n            }\n            getCompoundPaddingRight() {\n                let padding = super.getCompoundPaddingRight();\n                if (this.isLayoutRtl()) {\n                    const buttonDrawable = this.mButtonDrawable;\n                    if (buttonDrawable != null) {\n                        padding += buttonDrawable.getIntrinsicWidth();\n                    }\n                }\n                return padding;\n            }\n            getHorizontalOffsetForDrawables() {\n                const buttonDrawable = this.mButtonDrawable;\n                return (buttonDrawable != null) ? buttonDrawable.getIntrinsicWidth() : 0;\n            }\n            onDraw(canvas) {\n                super.onDraw(canvas);\n                const buttonDrawable = this.mButtonDrawable;\n                if (buttonDrawable != null) {\n                    const verticalGravity = this.getGravity() & Gravity.VERTICAL_GRAVITY_MASK;\n                    const drawableHeight = buttonDrawable.getIntrinsicHeight();\n                    const drawableWidth = buttonDrawable.getIntrinsicWidth();\n                    let top = 0;\n                    switch (verticalGravity) {\n                        case Gravity.BOTTOM:\n                            top = this.getHeight() - drawableHeight;\n                            break;\n                        case Gravity.CENTER_VERTICAL:\n                            top = (this.getHeight() - drawableHeight) / 2;\n                            break;\n                    }\n                    let bottom = top + drawableHeight;\n                    let left = this.isLayoutRtl() ? this.getWidth() - drawableWidth : 0;\n                    let right = this.isLayoutRtl() ? this.getWidth() : drawableWidth;\n                    buttonDrawable.setBounds(left, top, right, bottom);\n                    buttonDrawable.draw(canvas);\n                }\n            }\n            onCreateDrawableState(extraSpace) {\n                const drawableState = super.onCreateDrawableState(extraSpace + 1);\n                if (this.isChecked()) {\n                    CompoundButton.mergeDrawableStates(drawableState, CompoundButton.CHECKED_STATE_SET);\n                }\n                return drawableState;\n            }\n            drawableStateChanged() {\n                super.drawableStateChanged();\n                if (this.mButtonDrawable != null) {\n                    let myDrawableState = this.getDrawableState();\n                    this.mButtonDrawable.setState(myDrawableState);\n                    this.invalidate();\n                }\n            }\n            drawableSizeChange(d) {\n                if (d == this.mButtonDrawable) {\n                    this.setButtonDrawable(d);\n                    this.requestLayout();\n                }\n                else {\n                    super.drawableSizeChange(d);\n                }\n            }\n            verifyDrawable(who) {\n                return super.verifyDrawable(who) || who == this.mButtonDrawable;\n            }\n            jumpDrawablesToCurrentState() {\n                super.jumpDrawablesToCurrentState();\n                if (this.mButtonDrawable != null)\n                    this.mButtonDrawable.jumpToCurrentState();\n            }\n        }\n        CompoundButton.CHECKED_STATE_SET = [View.VIEW_STATE_CHECKED];\n        widget.CompoundButton = CompoundButton;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var CompoundButton = android.widget.CompoundButton;\n        class CheckBox extends CompoundButton {\n            constructor(context, bindElement, defStyle = android.R.attr.checkboxStyle) {\n                super(context, bindElement, defStyle);\n            }\n        }\n        widget.CheckBox = CheckBox;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var CompoundButton = android.widget.CompoundButton;\n        class RadioButton extends CompoundButton {\n            constructor(context, bindElement, defStyle = android.R.attr.radiobuttonStyle) {\n                super(context, bindElement, defStyle);\n            }\n            toggle() {\n                if (!this.isChecked()) {\n                    super.toggle();\n                }\n            }\n        }\n        widget.RadioButton = RadioButton;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var View = android.view.View;\n        var LinearLayout = android.widget.LinearLayout;\n        var RadioButton = android.widget.RadioButton;\n        class RadioGroup extends LinearLayout {\n            constructor(context, bindElement, defStyle) {\n                super(context, bindElement, defStyle);\n                this.mCheckedId = View.NO_ID;\n                this.mProtectFromCheckedChange = false;\n                let attributes = context.obtainStyledAttributes(bindElement, defStyle);\n                let value = attributes.getString('checkedButton');\n                if (value) {\n                    this.mCheckedId = value;\n                }\n                const orientation = attributes.getString('orientation');\n                if (orientation === 'horizontal') {\n                    this.setOrientation(RadioGroup.HORIZONTAL);\n                }\n                else {\n                    this.setOrientation(RadioGroup.VERTICAL);\n                }\n                attributes.recycle();\n                this.init();\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('checkedButton', {\n                    setter(v, value) {\n                        if (typeof value === 'string' || value == null) {\n                            v.setCheckedId(value);\n                        }\n                    }\n                });\n            }\n            init() {\n                this.mChildOnCheckedChangeListener = new RadioGroup.CheckedStateTracker(this);\n                this.mPassThroughListener = new RadioGroup.PassThroughHierarchyChangeListener(this);\n                super.setOnHierarchyChangeListener(this.mPassThroughListener);\n            }\n            setOnHierarchyChangeListener(listener) {\n                this.mPassThroughListener.mOnHierarchyChangeListener = listener;\n            }\n            onFinishInflate() {\n                super.onFinishInflate();\n                if (this.mCheckedId != null) {\n                    this.mProtectFromCheckedChange = true;\n                    this.setCheckedStateForView(this.mCheckedId, true);\n                    this.mProtectFromCheckedChange = false;\n                    this.setCheckedId(this.mCheckedId);\n                }\n            }\n            addView(...args) {\n                let child = args[0];\n                if (child instanceof RadioButton) {\n                    const button = child;\n                    if (button.isChecked()) {\n                        this.mProtectFromCheckedChange = true;\n                        if (this.mCheckedId != null) {\n                            this.setCheckedStateForView(this.mCheckedId, false);\n                        }\n                        this.mProtectFromCheckedChange = false;\n                        this.setCheckedId(button.getId());\n                    }\n                }\n                super.addView(...args);\n            }\n            check(id) {\n                if (id != null && (id == this.mCheckedId)) {\n                    return;\n                }\n                if (this.mCheckedId != null) {\n                    this.setCheckedStateForView(this.mCheckedId, false);\n                }\n                if (id != null) {\n                    this.setCheckedStateForView(id, true);\n                }\n                this.setCheckedId(id);\n            }\n            setCheckedId(id) {\n                this.mCheckedId = id;\n                if (this.mOnCheckedChangeListener != null) {\n                    this.mOnCheckedChangeListener.onCheckedChanged(this, this.mCheckedId);\n                }\n            }\n            setCheckedStateForView(viewId, checked) {\n                let checkedView = this.findViewById(viewId);\n                if (checkedView != null && checkedView instanceof RadioButton) {\n                    checkedView.setChecked(checked);\n                }\n            }\n            getCheckedRadioButtonId() {\n                return this.mCheckedId;\n            }\n            clearCheck() {\n                this.check(null);\n            }\n            setOnCheckedChangeListener(listener) {\n                this.mOnCheckedChangeListener = listener;\n            }\n            generateLayoutParamsFromAttr(attrs) {\n                return new RadioGroup.LayoutParams(this.getContext(), attrs);\n            }\n            checkLayoutParams(p) {\n                return p instanceof RadioGroup.LayoutParams;\n            }\n            generateDefaultLayoutParams() {\n                return new RadioGroup.LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT);\n            }\n        }\n        widget.RadioGroup = RadioGroup;\n        (function (RadioGroup) {\n            class LayoutParams extends LinearLayout.LayoutParams {\n                setBaseAttributes(a, widthAttr, heightAttr) {\n                    if (a.hasValue(widthAttr)) {\n                        this.width = a.getLayoutDimension(widthAttr, LayoutParams.WRAP_CONTENT);\n                    }\n                    else {\n                        this.width = LayoutParams.WRAP_CONTENT;\n                    }\n                    if (a.hasValue(heightAttr)) {\n                        this.height = a.getLayoutDimension(heightAttr, LayoutParams.WRAP_CONTENT);\n                    }\n                    else {\n                        this.height = LayoutParams.WRAP_CONTENT;\n                    }\n                }\n            }\n            RadioGroup.LayoutParams = LayoutParams;\n            class CheckedStateTracker {\n                constructor(arg) {\n                    this._RadioGroup_this = arg;\n                }\n                onCheckedChanged(buttonView, isChecked) {\n                    if (this._RadioGroup_this.mProtectFromCheckedChange) {\n                        return;\n                    }\n                    this._RadioGroup_this.mProtectFromCheckedChange = true;\n                    if (this._RadioGroup_this.mCheckedId != null) {\n                        this._RadioGroup_this.setCheckedStateForView(this._RadioGroup_this.mCheckedId, false);\n                    }\n                    this._RadioGroup_this.mProtectFromCheckedChange = false;\n                    let id = buttonView.getId();\n                    this._RadioGroup_this.setCheckedId(id);\n                }\n            }\n            RadioGroup.CheckedStateTracker = CheckedStateTracker;\n            class PassThroughHierarchyChangeListener {\n                constructor(arg) {\n                    this._RadioGroup_this = arg;\n                }\n                onChildViewAdded(parent, child) {\n                    if (parent == this._RadioGroup_this && child instanceof RadioButton) {\n                        let id = child.getId();\n                        if (id == View.NO_ID) {\n                            id = 'hash' + child.hashCode();\n                            child.setId(id);\n                        }\n                        child.setOnCheckedChangeWidgetListener(this._RadioGroup_this.mChildOnCheckedChangeListener);\n                    }\n                    if (this.mOnHierarchyChangeListener != null) {\n                        this.mOnHierarchyChangeListener.onChildViewAdded(parent, child);\n                    }\n                }\n                onChildViewRemoved(parent, child) {\n                    if (parent == this._RadioGroup_this && child instanceof RadioButton) {\n                        child.setOnCheckedChangeWidgetListener(null);\n                    }\n                    if (this.mOnHierarchyChangeListener != null) {\n                        this.mOnHierarchyChangeListener.onChildViewRemoved(parent, child);\n                    }\n                }\n            }\n            RadioGroup.PassThroughHierarchyChangeListener = PassThroughHierarchyChangeListener;\n        })(RadioGroup = widget.RadioGroup || (widget.RadioGroup = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var Gravity = android.view.Gravity;\n        var TextView = android.widget.TextView;\n        var View = android.view.View;\n        class CheckedTextView extends TextView {\n            constructor(context, bindElement, defStyle = android.R.attr.checkedTextViewStyle) {\n                super(context, bindElement, defStyle);\n                this.mCheckMarkResource = 0;\n                this.mBasePadding = 0;\n                this.mCheckMarkWidth = 0;\n                const a = context.obtainStyledAttributes(bindElement, defStyle);\n                const d = a.getDrawable('checkMark');\n                if (d != null) {\n                    this.setCheckMarkDrawable(d);\n                }\n                const checked = a.getBoolean('checked', false);\n                this.setChecked(checked);\n                a.recycle();\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('checkMark', {\n                    setter(v, value, attrBinder) {\n                        v.setCheckMarkDrawable(attrBinder.parseDrawable(value));\n                    }, getter(v) {\n                        return v.getCheckMarkDrawable();\n                    }\n                }).set('checked', {\n                    setter(v, value, attrBinder) {\n                        v.setChecked(attrBinder.parseBoolean(value, false));\n                    }, getter(v) {\n                        return v.isChecked();\n                    }\n                });\n            }\n            toggle() {\n                this.setChecked(!this.mChecked);\n            }\n            isChecked() {\n                return this.mChecked;\n            }\n            setChecked(checked) {\n                if (this.mChecked != checked) {\n                    this.mChecked = checked;\n                    this.refreshDrawableState();\n                }\n            }\n            setCheckMarkDrawable(d) {\n                if (this.mCheckMarkDrawable != null) {\n                    this.mCheckMarkDrawable.setCallback(null);\n                    this.unscheduleDrawable(this.mCheckMarkDrawable);\n                }\n                this.mNeedRequestlayout = (d != this.mCheckMarkDrawable);\n                if (d != null) {\n                    d.setCallback(this);\n                    d.setVisible(this.getVisibility() == CheckedTextView.VISIBLE, false);\n                    d.setState(CheckedTextView.CHECKED_STATE_SET);\n                    this.setMinHeight(d.getIntrinsicHeight());\n                    this.mCheckMarkWidth = d.getIntrinsicWidth();\n                    d.setState(this.getDrawableState());\n                }\n                else {\n                    this.mCheckMarkWidth = 0;\n                }\n                this.mCheckMarkDrawable = d;\n                this.resolvePadding();\n            }\n            getCheckMarkDrawable() {\n                return this.mCheckMarkDrawable;\n            }\n            setPadding(left, top, right, bottom) {\n                super.setPadding(left, top, right, bottom);\n                this.setBasePadding(this.isLayoutRtl());\n            }\n            updatePadding() {\n                let newPadding = (this.mCheckMarkDrawable != null) ? this.mCheckMarkWidth + this.mBasePadding : this.mBasePadding;\n                if (this.isLayoutRtl()) {\n                    this.mNeedRequestlayout = (this.mPaddingLeft != newPadding) || this.mNeedRequestlayout;\n                    this.mPaddingLeft = newPadding;\n                }\n                else {\n                    this.mNeedRequestlayout = (this.mPaddingRight != newPadding) || this.mNeedRequestlayout;\n                    this.mPaddingRight = newPadding;\n                }\n                if (this.mNeedRequestlayout) {\n                    this.requestLayout();\n                    this.mNeedRequestlayout = false;\n                }\n            }\n            setBasePadding(isLayoutRtl) {\n                if (isLayoutRtl) {\n                    this.mBasePadding = this.mPaddingLeft;\n                }\n                else {\n                    this.mBasePadding = this.mPaddingRight;\n                }\n            }\n            onDraw(canvas) {\n                super.onDraw(canvas);\n                const checkMarkDrawable = this.mCheckMarkDrawable;\n                if (checkMarkDrawable != null) {\n                    const verticalGravity = this.getGravity() & Gravity.VERTICAL_GRAVITY_MASK;\n                    const height = checkMarkDrawable.getIntrinsicHeight();\n                    let y = 0;\n                    switch (verticalGravity) {\n                        case Gravity.BOTTOM:\n                            y = this.getHeight() - height;\n                            break;\n                        case Gravity.CENTER_VERTICAL:\n                            y = (this.getHeight() - height) / 2;\n                            break;\n                    }\n                    const isLayoutRtl = this.isLayoutRtl();\n                    const width = this.getWidth();\n                    const top = y;\n                    const bottom = top + height;\n                    let left;\n                    let right;\n                    if (isLayoutRtl) {\n                        left = this.mBasePadding;\n                        right = left + this.mCheckMarkWidth;\n                    }\n                    else {\n                        right = width - this.mBasePadding;\n                        left = right - this.mCheckMarkWidth;\n                    }\n                    checkMarkDrawable.setBounds(this.mScrollX + left, top, this.mScrollX + right, bottom);\n                    checkMarkDrawable.draw(canvas);\n                }\n            }\n            onCreateDrawableState(extraSpace) {\n                const drawableState = super.onCreateDrawableState(extraSpace + 1);\n                if (this.isChecked()) {\n                    CheckedTextView.mergeDrawableStates(drawableState, CheckedTextView.CHECKED_STATE_SET);\n                }\n                return drawableState;\n            }\n            drawableStateChanged() {\n                super.drawableStateChanged();\n                if (this.mCheckMarkDrawable != null) {\n                    let myDrawableState = this.getDrawableState();\n                    this.mCheckMarkDrawable.setState(myDrawableState);\n                    this.invalidate();\n                }\n            }\n        }\n        CheckedTextView.CHECKED_STATE_SET = [View.VIEW_STATE_CHECKED];\n        widget.CheckedTextView = CheckedTextView;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var KeyEvent = android.view.KeyEvent;\n        var MotionEvent = android.view.MotionEvent;\n        var Integer = java.lang.Integer;\n        var ProgressBar = android.widget.ProgressBar;\n        class AbsSeekBar extends ProgressBar {\n            constructor(context, bindElement, defStyle) {\n                super(context, bindElement, defStyle);\n                this.mThumbOffset = 0;\n                this.mTouchProgressOffset = 0;\n                this.mIsUserSeekable = true;\n                this.mKeyProgressIncrement = 1;\n                this.mDisabledAlpha = 0;\n                this.mTouchDownX = 0;\n                let a = context.obtainStyledAttributes(bindElement, defStyle);\n                const thumb = a.getDrawable('thumb');\n                this.setThumb(thumb);\n                const thumbOffset = a.getDimensionPixelOffset('thumbOffset', this.getThumbOffset());\n                this.setThumbOffset(thumbOffset);\n                a.recycle();\n                a = context.obtainStyledAttributes(bindElement, defStyle);\n                this.mDisabledAlpha = a.getFloat('disabledAlpha', 0.5);\n                a.recycle();\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('thumb', {\n                    setter(v, value, attrBinder) {\n                        v.setThumb(attrBinder.parseDrawable(value));\n                    }, getter(v) {\n                        return v.mThumb;\n                    }\n                }).set('thumbOffset', {\n                    setter(v, value, attrBinder) {\n                        v.setThumbOffset(attrBinder.parseNumberPixelOffset(value));\n                    }, getter(v) {\n                        return v.mThumbOffset;\n                    }\n                }).set('disabledAlpha', {\n                    setter(v, value, attrBinder) {\n                        v.mDisabledAlpha = attrBinder.parseFloat(value, 0.5);\n                    }, getter(v) {\n                        return v.mDisabledAlpha;\n                    }\n                });\n            }\n            setThumb(thumb) {\n                let needUpdate;\n                if (this.mThumb != null && thumb != this.mThumb) {\n                    this.mThumb.setCallback(null);\n                    needUpdate = true;\n                }\n                else {\n                    needUpdate = false;\n                }\n                if (thumb != null) {\n                    thumb.setCallback(this);\n                    this.mThumbOffset = thumb.getIntrinsicWidth() / 2;\n                    if (needUpdate && (thumb.getIntrinsicWidth() != this.mThumb.getIntrinsicWidth() || thumb.getIntrinsicHeight() != this.mThumb.getIntrinsicHeight())) {\n                        this.requestLayout();\n                    }\n                }\n                this.mThumb = thumb;\n                this.invalidate();\n                if (needUpdate) {\n                    this.updateThumbPos(this.getWidth(), this.getHeight());\n                    if (thumb != null && thumb.isStateful()) {\n                        let state = this.getDrawableState();\n                        thumb.setState(state);\n                    }\n                }\n            }\n            getThumb() {\n                return this.mThumb;\n            }\n            getThumbOffset() {\n                return this.mThumbOffset;\n            }\n            setThumbOffset(thumbOffset) {\n                this.mThumbOffset = thumbOffset;\n                this.invalidate();\n            }\n            setKeyProgressIncrement(increment) {\n                this.mKeyProgressIncrement = increment < 0 ? -increment : increment;\n            }\n            getKeyProgressIncrement() {\n                return this.mKeyProgressIncrement;\n            }\n            setMax(max) {\n                super.setMax(max);\n                if ((this.mKeyProgressIncrement == 0) || (this.getMax() / this.mKeyProgressIncrement > 20)) {\n                    this.setKeyProgressIncrement(Math.max(1, Math.round(this.getMax() / 20)));\n                }\n            }\n            verifyDrawable(who) {\n                return who == this.mThumb || super.verifyDrawable(who);\n            }\n            jumpDrawablesToCurrentState() {\n                super.jumpDrawablesToCurrentState();\n                if (this.mThumb != null)\n                    this.mThumb.jumpToCurrentState();\n            }\n            drawableStateChanged() {\n                super.drawableStateChanged();\n                let progressDrawable = this.getProgressDrawable();\n                if (progressDrawable != null) {\n                    progressDrawable.setAlpha(this.isEnabled() ? AbsSeekBar.NO_ALPHA : Math.floor((AbsSeekBar.NO_ALPHA * this.mDisabledAlpha)));\n                }\n                if (this.mThumb != null && this.mThumb.isStateful()) {\n                    let state = this.getDrawableState();\n                    this.mThumb.setState(state);\n                }\n            }\n            onProgressRefresh(scale, fromUser) {\n                super.onProgressRefresh(scale, fromUser);\n                let thumb = this.mThumb;\n                if (thumb != null) {\n                    this.setThumbPos(this.getWidth(), thumb, scale, Integer.MIN_VALUE);\n                    this.invalidate();\n                }\n            }\n            onSizeChanged(w, h, oldw, oldh) {\n                super.onSizeChanged(w, h, oldw, oldh);\n                this.updateThumbPos(w, h);\n            }\n            updateThumbPos(w, h) {\n                let d = this.getCurrentDrawable();\n                let thumb = this.mThumb;\n                let thumbHeight = thumb == null ? 0 : thumb.getIntrinsicHeight();\n                let trackHeight = Math.min(this.mMaxHeight, h - this.mPaddingTop - this.mPaddingBottom);\n                let max = this.getMax();\n                let scale = max > 0 ? this.getProgress() / max : 0;\n                if (thumbHeight > trackHeight) {\n                    if (thumb != null) {\n                        this.setThumbPos(w, thumb, scale, 0);\n                    }\n                    let gapForCenteringTrack = (thumbHeight - trackHeight) / 2;\n                    if (d != null) {\n                        d.setBounds(0, gapForCenteringTrack, w - this.mPaddingRight - this.mPaddingLeft, h - this.mPaddingBottom - gapForCenteringTrack - this.mPaddingTop);\n                    }\n                }\n                else {\n                    if (d != null) {\n                        d.setBounds(0, 0, w - this.mPaddingRight - this.mPaddingLeft, h - this.mPaddingBottom - this.mPaddingTop);\n                    }\n                    let gap = (trackHeight - thumbHeight) / 2;\n                    if (thumb != null) {\n                        this.setThumbPos(w, thumb, scale, gap);\n                    }\n                }\n            }\n            setThumbPos(w, thumb, scale, gap) {\n                let available = w - this.mPaddingLeft - this.mPaddingRight;\n                let thumbWidth = thumb.getIntrinsicWidth();\n                let thumbHeight = thumb.getIntrinsicHeight();\n                available -= thumbWidth;\n                available += this.mThumbOffset * 2;\n                let thumbPos = Math.floor((scale * available));\n                let topBound, bottomBound;\n                if (gap == Integer.MIN_VALUE) {\n                    let oldBounds = thumb.getBounds();\n                    topBound = oldBounds.top;\n                    bottomBound = oldBounds.bottom;\n                }\n                else {\n                    topBound = gap;\n                    bottomBound = gap + thumbHeight;\n                }\n                const left = (this.isLayoutRtl() && this.mMirrorForRtl) ? available - thumbPos : thumbPos;\n                thumb.setBounds(left, topBound, left + thumbWidth, bottomBound);\n            }\n            onDraw(canvas) {\n                super.onDraw(canvas);\n                if (this.mThumb != null) {\n                    canvas.save();\n                    canvas.translate(this.mPaddingLeft - this.mThumbOffset, this.mPaddingTop);\n                    this.mThumb.draw(canvas);\n                    canvas.restore();\n                }\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                let d = this.getCurrentDrawable();\n                let thumbHeight = this.mThumb == null ? 0 : this.mThumb.getIntrinsicHeight();\n                let dw = 0;\n                let dh = 0;\n                if (d != null) {\n                    dw = Math.max(this.mMinWidth, Math.min(this.mMaxWidth, d.getIntrinsicWidth()));\n                    dh = Math.max(this.mMinHeight, Math.min(this.mMaxHeight, d.getIntrinsicHeight()));\n                    dh = Math.max(thumbHeight, dh);\n                }\n                dw += this.mPaddingLeft + this.mPaddingRight;\n                dh += this.mPaddingTop + this.mPaddingBottom;\n                this.setMeasuredDimension(AbsSeekBar.resolveSizeAndState(dw, widthMeasureSpec, 0), AbsSeekBar.resolveSizeAndState(dh, heightMeasureSpec, 0));\n            }\n            onTouchEvent(event) {\n                if (!this.mIsUserSeekable || !this.isEnabled()) {\n                    return false;\n                }\n                switch (event.getAction()) {\n                    case MotionEvent.ACTION_DOWN:\n                        if (this.isInScrollingContainer()) {\n                            this.mTouchDownX = event.getX();\n                        }\n                        else {\n                            this.setPressed(true);\n                            if (this.mThumb != null) {\n                                this.invalidate(this.mThumb.getBounds());\n                            }\n                            this.onStartTrackingTouch();\n                            this.trackTouchEvent(event);\n                            this.attemptClaimDrag();\n                        }\n                        break;\n                    case MotionEvent.ACTION_MOVE:\n                        if (this.mIsDragging) {\n                            this.trackTouchEvent(event);\n                        }\n                        else {\n                            const x = event.getX();\n                            if (Math.abs(x - this.mTouchDownX) > this.mTouchSlop) {\n                                this.setPressed(true);\n                                if (this.mThumb != null) {\n                                    this.invalidate(this.mThumb.getBounds());\n                                }\n                                this.onStartTrackingTouch();\n                                this.trackTouchEvent(event);\n                                this.attemptClaimDrag();\n                            }\n                        }\n                        break;\n                    case MotionEvent.ACTION_UP:\n                        if (this.mIsDragging) {\n                            this.trackTouchEvent(event);\n                            this.onStopTrackingTouch();\n                            this.setPressed(false);\n                        }\n                        else {\n                            this.onStartTrackingTouch();\n                            this.trackTouchEvent(event);\n                            this.onStopTrackingTouch();\n                        }\n                        this.invalidate();\n                        break;\n                    case MotionEvent.ACTION_CANCEL:\n                        if (this.mIsDragging) {\n                            this.onStopTrackingTouch();\n                            this.setPressed(false);\n                        }\n                        this.invalidate();\n                        break;\n                }\n                return true;\n            }\n            trackTouchEvent(event) {\n                const width = this.getWidth();\n                const available = width - this.mPaddingLeft - this.mPaddingRight;\n                let x = Math.floor(event.getX());\n                let scale;\n                let progress = 0;\n                if (this.isLayoutRtl() && this.mMirrorForRtl) {\n                    if (x > width - this.mPaddingRight) {\n                        scale = 0.0;\n                    }\n                    else if (x < this.mPaddingLeft) {\n                        scale = 1.0;\n                    }\n                    else {\n                        scale = (available - x + this.mPaddingLeft) / available;\n                        progress = this.mTouchProgressOffset;\n                    }\n                }\n                else {\n                    if (x < this.mPaddingLeft) {\n                        scale = 0.0;\n                    }\n                    else if (x > width - this.mPaddingRight) {\n                        scale = 1.0;\n                    }\n                    else {\n                        scale = (x - this.mPaddingLeft) / available;\n                        progress = this.mTouchProgressOffset;\n                    }\n                }\n                const max = this.getMax();\n                progress += scale * max;\n                this.setProgress(Math.floor(progress), true);\n            }\n            attemptClaimDrag() {\n                if (this.mParent != null) {\n                    this.mParent.requestDisallowInterceptTouchEvent(true);\n                }\n            }\n            onStartTrackingTouch() {\n                this.mIsDragging = true;\n            }\n            onStopTrackingTouch() {\n                this.mIsDragging = false;\n            }\n            onKeyChange() {\n            }\n            onKeyDown(keyCode, event) {\n                if (this.isEnabled()) {\n                    let progress = this.getProgress();\n                    switch (keyCode) {\n                        case KeyEvent.KEYCODE_DPAD_LEFT:\n                            if (progress <= 0)\n                                break;\n                            this.setProgress(progress - this.mKeyProgressIncrement, true);\n                            this.onKeyChange();\n                            return true;\n                        case KeyEvent.KEYCODE_DPAD_RIGHT:\n                            if (progress >= this.getMax())\n                                break;\n                            this.setProgress(progress + this.mKeyProgressIncrement, true);\n                            this.onKeyChange();\n                            return true;\n                    }\n                }\n                return super.onKeyDown(keyCode, event);\n            }\n        }\n        AbsSeekBar.NO_ALPHA = 0xFF;\n        widget.AbsSeekBar = AbsSeekBar;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var AbsSeekBar = android.widget.AbsSeekBar;\n        class SeekBar extends AbsSeekBar {\n            constructor(context, bindElement, defStyle = android.R.attr.seekBarStyle) {\n                super(context, bindElement, defStyle);\n            }\n            onProgressRefresh(scale, fromUser) {\n                super.onProgressRefresh(scale, fromUser);\n                if (this.mOnSeekBarChangeListener != null) {\n                    this.mOnSeekBarChangeListener.onProgressChanged(this, this.getProgress(), fromUser);\n                }\n            }\n            setOnSeekBarChangeListener(l) {\n                this.mOnSeekBarChangeListener = l;\n            }\n            onStartTrackingTouch() {\n                super.onStartTrackingTouch();\n                if (this.mOnSeekBarChangeListener != null) {\n                    this.mOnSeekBarChangeListener.onStartTrackingTouch(this);\n                }\n            }\n            onStopTrackingTouch() {\n                super.onStopTrackingTouch();\n                if (this.mOnSeekBarChangeListener != null) {\n                    this.mOnSeekBarChangeListener.onStopTrackingTouch(this);\n                }\n            }\n        }\n        widget.SeekBar = SeekBar;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var AbsSeekBar = android.widget.AbsSeekBar;\n        class RatingBar extends AbsSeekBar {\n            constructor(context, bindElement, defStyle = android.R.attr.ratingBarStyle) {\n                super(context, bindElement, defStyle);\n                this.mNumStars = 5;\n                this.mProgressOnStartTracking = 0;\n                const a = context.obtainStyledAttributes(bindElement, defStyle);\n                const numStars = a.getInt('numStars', this.mNumStars);\n                this.setIsIndicator(a.getBoolean('isIndicator', !this.mIsUserSeekable));\n                const rating = a.getFloat('rating', -1);\n                const stepSize = a.getFloat('stepSize', -1);\n                a.recycle();\n                if (numStars > 0 && numStars != this.mNumStars) {\n                    this.setNumStars(numStars);\n                }\n                if (stepSize >= 0) {\n                    this.setStepSize(stepSize);\n                }\n                else {\n                    this.setStepSize(0.5);\n                }\n                if (rating >= 0) {\n                    this.setRating(rating);\n                }\n                this.mTouchProgressOffset = 1.1;\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('numStars', {\n                    setter(v, value, a) {\n                        v.setNumStars(a.parseInt(value, v.mNumStars));\n                    }, getter(v) {\n                        return v.mNumStars;\n                    }\n                }).set('isIndicator', {\n                    setter(v, value, a) {\n                        v.setIsIndicator(a.parseBoolean(value, !v.mIsUserSeekable));\n                    }, getter(v) {\n                        return v.isIndicator();\n                    }\n                }).set('stepSize', {\n                    setter(v, value, a) {\n                        v.setStepSize(a.parseFloat(value, 0.5));\n                    }, getter(v) {\n                        return v.getStepSize();\n                    }\n                }).set('rating', {\n                    setter(v, value, a) {\n                        v.setRating(a.parseFloat(value, v.getRating()));\n                    }, getter(v) {\n                        return v.getRating();\n                    }\n                });\n            }\n            setOnRatingBarChangeListener(listener) {\n                this.mOnRatingBarChangeListener = listener;\n            }\n            getOnRatingBarChangeListener() {\n                return this.mOnRatingBarChangeListener;\n            }\n            setIsIndicator(isIndicator) {\n                this.mIsUserSeekable = !isIndicator;\n                this.setFocusable(!isIndicator);\n            }\n            isIndicator() {\n                return !this.mIsUserSeekable;\n            }\n            setNumStars(numStars) {\n                if (numStars <= 0) {\n                    return;\n                }\n                let step = this.getStepSize();\n                this.mNumStars = numStars;\n                this.setStepSize(step);\n                this.requestLayout();\n            }\n            getNumStars() {\n                return this.mNumStars;\n            }\n            setRating(rating) {\n                this.setProgress(Math.round(rating * this.getProgressPerStar()));\n            }\n            getRating() {\n                return this.getProgress() / this.getProgressPerStar();\n            }\n            setStepSize(stepSize) {\n                if (Number.isNaN(stepSize) || !Number.isFinite(stepSize) || stepSize <= 0) {\n                    return;\n                }\n                const newMax = this.mNumStars / stepSize;\n                let newProgress = Math.floor((newMax / this.getMax() * this.getProgress()));\n                if (Number.isNaN(newProgress))\n                    newProgress = 0;\n                this.setMax(Math.floor(newMax));\n                this.setProgress(newProgress);\n            }\n            getStepSize() {\n                return this.getNumStars() / this.getMax();\n            }\n            getProgressPerStar() {\n                if (this.mNumStars > 0) {\n                    return 1 * this.getMax() / this.mNumStars;\n                }\n                else {\n                    return 1;\n                }\n            }\n            onProgressRefresh(scale, fromUser) {\n                super.onProgressRefresh(scale, fromUser);\n                this.updateSecondaryProgress(this.getProgress());\n                if (!fromUser) {\n                    this.dispatchRatingChange(false);\n                }\n            }\n            updateSecondaryProgress(progress) {\n                const ratio = this.getProgressPerStar();\n                if (ratio > 0) {\n                    const progressInStars = progress / ratio;\n                    const secondaryProgress = Math.floor((Math.ceil(progressInStars) * ratio));\n                    this.setSecondaryProgress(secondaryProgress);\n                }\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n                if (this.mSampleTile != null) {\n                    const width = this.mSampleTile.getIntrinsicWidth() * this.mNumStars;\n                    this.setMeasuredDimension(RatingBar.resolveSizeAndState(width, widthMeasureSpec, 0), this.getMeasuredHeight());\n                }\n            }\n            onStartTrackingTouch() {\n                this.mProgressOnStartTracking = this.getProgress();\n                super.onStartTrackingTouch();\n            }\n            onStopTrackingTouch() {\n                super.onStopTrackingTouch();\n                if (this.getProgress() != this.mProgressOnStartTracking) {\n                    this.dispatchRatingChange(true);\n                }\n            }\n            onKeyChange() {\n                super.onKeyChange();\n                this.dispatchRatingChange(true);\n            }\n            dispatchRatingChange(fromUser) {\n                if (this.mOnRatingBarChangeListener != null) {\n                    this.mOnRatingBarChangeListener.onRatingChanged(this, this.getRating(), fromUser);\n                }\n            }\n            setMax(max) {\n                if (max <= 0) {\n                    return;\n                }\n                super.setMax(max);\n            }\n        }\n        widget.RatingBar = RatingBar;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var ArrayList = java.util.ArrayList;\n        var ExpandableListView = android.widget.ExpandableListView;\n        class ExpandableListPosition {\n            constructor() {\n                this.groupPos = 0;\n                this.childPos = 0;\n                this.flatListPos = 0;\n                this.type = 0;\n            }\n            resetState() {\n                this.groupPos = 0;\n                this.childPos = 0;\n                this.flatListPos = 0;\n                this.type = 0;\n            }\n            getPackedPosition() {\n                if (this.type == ExpandableListPosition.CHILD)\n                    return ExpandableListView.getPackedPositionForChild(this.groupPos, this.childPos);\n                else\n                    return ExpandableListView.getPackedPositionForGroup(this.groupPos);\n            }\n            static obtainGroupPosition(groupPosition) {\n                return ExpandableListPosition.obtain(ExpandableListPosition.GROUP, groupPosition, 0, 0);\n            }\n            static obtainChildPosition(groupPosition, childPosition) {\n                return ExpandableListPosition.obtain(ExpandableListPosition.CHILD, groupPosition, childPosition, 0);\n            }\n            static obtainPosition(packedPosition) {\n                if (packedPosition == ExpandableListView.PACKED_POSITION_VALUE_NULL) {\n                    return null;\n                }\n                let elp = ExpandableListPosition.getRecycledOrCreate();\n                elp.groupPos = ExpandableListView.getPackedPositionGroup(packedPosition);\n                if (ExpandableListView.getPackedPositionType(packedPosition) == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {\n                    elp.type = ExpandableListPosition.CHILD;\n                    elp.childPos = ExpandableListView.getPackedPositionChild(packedPosition);\n                }\n                else {\n                    elp.type = ExpandableListPosition.GROUP;\n                }\n                return elp;\n            }\n            static obtain(type, groupPos, childPos, flatListPos) {\n                let elp = ExpandableListPosition.getRecycledOrCreate();\n                elp.type = type;\n                elp.groupPos = groupPos;\n                elp.childPos = childPos;\n                elp.flatListPos = flatListPos;\n                return elp;\n            }\n            static getRecycledOrCreate() {\n                let elp;\n                {\n                    if (ExpandableListPosition.sPool.size() > 0) {\n                        elp = ExpandableListPosition.sPool.remove(0);\n                    }\n                    else {\n                        return new ExpandableListPosition();\n                    }\n                }\n                elp.resetState();\n                return elp;\n            }\n            recycle() {\n                {\n                    if (ExpandableListPosition.sPool.size() < ExpandableListPosition.MAX_POOL_SIZE) {\n                        ExpandableListPosition.sPool.add(this);\n                    }\n                }\n            }\n        }\n        ExpandableListPosition.MAX_POOL_SIZE = 5;\n        ExpandableListPosition.sPool = new ArrayList(ExpandableListPosition.MAX_POOL_SIZE);\n        ExpandableListPosition.CHILD = 1;\n        ExpandableListPosition.GROUP = 2;\n        widget.ExpandableListPosition = ExpandableListPosition;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var HeterogeneousExpandableList;\n        (function (HeterogeneousExpandableList) {\n            function isImpl(obj) {\n                return obj && obj['getGroupType'] && obj['getChildType'] && obj['getGroupTypeCount'] && obj['getChildTypeCount'];\n            }\n            HeterogeneousExpandableList.isImpl = isImpl;\n        })(HeterogeneousExpandableList = widget.HeterogeneousExpandableList || (widget.HeterogeneousExpandableList = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var DataSetObserver = android.database.DataSetObserver;\n        var SystemClock = android.os.SystemClock;\n        var ArrayList = java.util.ArrayList;\n        var Collections = java.util.Collections;\n        var Integer = java.lang.Integer;\n        var AdapterView = android.widget.AdapterView;\n        var BaseAdapter = android.widget.BaseAdapter;\n        var ExpandableListPosition = android.widget.ExpandableListPosition;\n        var HeterogeneousExpandableList = android.widget.HeterogeneousExpandableList;\n        class ExpandableListConnector extends BaseAdapter {\n            constructor(expandableListAdapter) {\n                super();\n                this.mTotalExpChildrenCount = 0;\n                this.mMaxExpGroupCount = Integer.MAX_VALUE;\n                this.mDataSetObserver = new ExpandableListConnector.MyDataSetObserver(this);\n                this.mExpGroupMetadataList = new ArrayList();\n                this.setExpandableListAdapter(expandableListAdapter);\n            }\n            setExpandableListAdapter(expandableListAdapter) {\n                if (this.mExpandableListAdapter != null) {\n                    this.mExpandableListAdapter.unregisterDataSetObserver(this.mDataSetObserver);\n                }\n                this.mExpandableListAdapter = expandableListAdapter;\n                expandableListAdapter.registerDataSetObserver(this.mDataSetObserver);\n            }\n            getUnflattenedPos(flPos) {\n                const egml = this.mExpGroupMetadataList;\n                const numExpGroups = egml.size();\n                let leftExpGroupIndex = 0;\n                let rightExpGroupIndex = numExpGroups - 1;\n                let midExpGroupIndex = 0;\n                let midExpGm;\n                if (numExpGroups == 0) {\n                    return ExpandableListConnector.PositionMetadata.obtain(flPos, ExpandableListPosition.GROUP, flPos, -1, null, 0);\n                }\n                while (leftExpGroupIndex <= rightExpGroupIndex) {\n                    midExpGroupIndex = Math.floor((rightExpGroupIndex - leftExpGroupIndex) / 2 + leftExpGroupIndex);\n                    midExpGm = egml.get(midExpGroupIndex);\n                    if (flPos > midExpGm.lastChildFlPos) {\n                        leftExpGroupIndex = midExpGroupIndex + 1;\n                    }\n                    else if (flPos < midExpGm.flPos) {\n                        rightExpGroupIndex = midExpGroupIndex - 1;\n                    }\n                    else if (flPos == midExpGm.flPos) {\n                        return ExpandableListConnector.PositionMetadata.obtain(flPos, ExpandableListPosition.GROUP, midExpGm.gPos, -1, midExpGm, midExpGroupIndex);\n                    }\n                    else if (flPos <= midExpGm.lastChildFlPos) {\n                        const childPos = flPos - (midExpGm.flPos + 1);\n                        return ExpandableListConnector.PositionMetadata.obtain(flPos, ExpandableListPosition.CHILD, midExpGm.gPos, childPos, midExpGm, midExpGroupIndex);\n                    }\n                }\n                let insertPosition = 0;\n                let groupPos = 0;\n                if (leftExpGroupIndex > midExpGroupIndex) {\n                    const leftExpGm = egml.get(leftExpGroupIndex - 1);\n                    insertPosition = leftExpGroupIndex;\n                    groupPos = (flPos - leftExpGm.lastChildFlPos) + leftExpGm.gPos;\n                }\n                else if (rightExpGroupIndex < midExpGroupIndex) {\n                    const rightExpGm = egml.get(++rightExpGroupIndex);\n                    insertPosition = rightExpGroupIndex;\n                    groupPos = rightExpGm.gPos - (rightExpGm.flPos - flPos);\n                }\n                else {\n                    throw Error(`new RuntimeException(\"Unknown state\")`);\n                }\n                return ExpandableListConnector.PositionMetadata.obtain(flPos, ExpandableListPosition.GROUP, groupPos, -1, null, insertPosition);\n            }\n            getFlattenedPos(pos) {\n                const egml = this.mExpGroupMetadataList;\n                const numExpGroups = egml.size();\n                let leftExpGroupIndex = 0;\n                let rightExpGroupIndex = numExpGroups - 1;\n                let midExpGroupIndex = 0;\n                let midExpGm;\n                if (numExpGroups == 0) {\n                    return ExpandableListConnector.PositionMetadata.obtain(pos.groupPos, pos.type, pos.groupPos, pos.childPos, null, 0);\n                }\n                while (leftExpGroupIndex <= rightExpGroupIndex) {\n                    midExpGroupIndex = Math.floor((rightExpGroupIndex - leftExpGroupIndex) / 2 + leftExpGroupIndex);\n                    midExpGm = egml.get(midExpGroupIndex);\n                    if (pos.groupPos > midExpGm.gPos) {\n                        leftExpGroupIndex = midExpGroupIndex + 1;\n                    }\n                    else if (pos.groupPos < midExpGm.gPos) {\n                        rightExpGroupIndex = midExpGroupIndex - 1;\n                    }\n                    else if (pos.groupPos == midExpGm.gPos) {\n                        if (pos.type == ExpandableListPosition.GROUP) {\n                            return ExpandableListConnector.PositionMetadata.obtain(midExpGm.flPos, pos.type, pos.groupPos, pos.childPos, midExpGm, midExpGroupIndex);\n                        }\n                        else if (pos.type == ExpandableListPosition.CHILD) {\n                            return ExpandableListConnector.PositionMetadata.obtain(midExpGm.flPos + pos.childPos + 1, pos.type, pos.groupPos, pos.childPos, midExpGm, midExpGroupIndex);\n                        }\n                        else {\n                            return null;\n                        }\n                    }\n                }\n                if (pos.type != ExpandableListPosition.GROUP) {\n                    return null;\n                }\n                if (leftExpGroupIndex > midExpGroupIndex) {\n                    const leftExpGm = egml.get(leftExpGroupIndex - 1);\n                    const flPos = leftExpGm.lastChildFlPos + (pos.groupPos - leftExpGm.gPos);\n                    return ExpandableListConnector.PositionMetadata.obtain(flPos, pos.type, pos.groupPos, pos.childPos, null, leftExpGroupIndex);\n                }\n                else if (rightExpGroupIndex < midExpGroupIndex) {\n                    const rightExpGm = egml.get(++rightExpGroupIndex);\n                    const flPos = rightExpGm.flPos - (rightExpGm.gPos - pos.groupPos);\n                    return ExpandableListConnector.PositionMetadata.obtain(flPos, pos.type, pos.groupPos, pos.childPos, null, rightExpGroupIndex);\n                }\n                else {\n                    return null;\n                }\n            }\n            areAllItemsEnabled() {\n                return this.mExpandableListAdapter.areAllItemsEnabled();\n            }\n            isEnabled(flatListPos) {\n                const metadata = this.getUnflattenedPos(flatListPos);\n                const pos = metadata.position;\n                let retValue;\n                if (pos.type == ExpandableListPosition.CHILD) {\n                    retValue = this.mExpandableListAdapter.isChildSelectable(pos.groupPos, pos.childPos);\n                }\n                else {\n                    retValue = true;\n                }\n                metadata.recycle();\n                return retValue;\n            }\n            getCount() {\n                return this.mExpandableListAdapter.getGroupCount() + this.mTotalExpChildrenCount;\n            }\n            getItem(flatListPos) {\n                const posMetadata = this.getUnflattenedPos(flatListPos);\n                let retValue;\n                if (posMetadata.position.type == ExpandableListPosition.GROUP) {\n                    retValue = this.mExpandableListAdapter.getGroup(posMetadata.position.groupPos);\n                }\n                else if (posMetadata.position.type == ExpandableListPosition.CHILD) {\n                    retValue = this.mExpandableListAdapter.getChild(posMetadata.position.groupPos, posMetadata.position.childPos);\n                }\n                else {\n                    throw Error(`new RuntimeException(\"Flat list position is of unknown type\")`);\n                }\n                posMetadata.recycle();\n                return retValue;\n            }\n            getItemId(flatListPos) {\n                const posMetadata = this.getUnflattenedPos(flatListPos);\n                const groupId = this.mExpandableListAdapter.getGroupId(posMetadata.position.groupPos);\n                let retValue;\n                if (posMetadata.position.type == ExpandableListPosition.GROUP) {\n                    retValue = this.mExpandableListAdapter.getCombinedGroupId(groupId);\n                }\n                else if (posMetadata.position.type == ExpandableListPosition.CHILD) {\n                    const childId = this.mExpandableListAdapter.getChildId(posMetadata.position.groupPos, posMetadata.position.childPos);\n                    retValue = this.mExpandableListAdapter.getCombinedChildId(groupId, childId);\n                }\n                else {\n                    throw Error(`new RuntimeException(\"Flat list position is of unknown type\")`);\n                }\n                posMetadata.recycle();\n                return retValue;\n            }\n            getView(flatListPos, convertView, parent) {\n                const posMetadata = this.getUnflattenedPos(flatListPos);\n                let retValue;\n                if (posMetadata.position.type == ExpandableListPosition.GROUP) {\n                    retValue = this.mExpandableListAdapter.getGroupView(posMetadata.position.groupPos, posMetadata.isExpanded(), convertView, parent);\n                }\n                else if (posMetadata.position.type == ExpandableListPosition.CHILD) {\n                    const isLastChild = posMetadata.groupMetadata.lastChildFlPos == flatListPos;\n                    retValue = this.mExpandableListAdapter.getChildView(posMetadata.position.groupPos, posMetadata.position.childPos, isLastChild, convertView, parent);\n                }\n                else {\n                    throw Error(`new RuntimeException(\"Flat list position is of unknown type\")`);\n                }\n                posMetadata.recycle();\n                return retValue;\n            }\n            getItemViewType(flatListPos) {\n                const metadata = this.getUnflattenedPos(flatListPos);\n                const pos = metadata.position;\n                let retValue;\n                if (HeterogeneousExpandableList.isImpl(this.mExpandableListAdapter)) {\n                    let adapter = this.mExpandableListAdapter;\n                    if (pos.type == ExpandableListPosition.GROUP) {\n                        retValue = adapter.getGroupType(pos.groupPos);\n                    }\n                    else {\n                        const childType = adapter.getChildType(pos.groupPos, pos.childPos);\n                        retValue = adapter.getGroupTypeCount() + childType;\n                    }\n                }\n                else {\n                    if (pos.type == ExpandableListPosition.GROUP) {\n                        retValue = 0;\n                    }\n                    else {\n                        retValue = 1;\n                    }\n                }\n                metadata.recycle();\n                return retValue;\n            }\n            getViewTypeCount() {\n                if (HeterogeneousExpandableList.isImpl(this.mExpandableListAdapter)) {\n                    let adapter = this.mExpandableListAdapter;\n                    return adapter.getGroupTypeCount() + adapter.getChildTypeCount();\n                }\n                else {\n                    return 2;\n                }\n            }\n            hasStableIds() {\n                return this.mExpandableListAdapter.hasStableIds();\n            }\n            refreshExpGroupMetadataList(forceChildrenCountRefresh, syncGroupPositions) {\n                const egml = this.mExpGroupMetadataList;\n                let egmlSize = egml.size();\n                let curFlPos = 0;\n                this.mTotalExpChildrenCount = 0;\n                if (syncGroupPositions) {\n                    let positionsChanged = false;\n                    for (let i = egmlSize - 1; i >= 0; i--) {\n                        let curGm = egml.get(i);\n                        let newGPos = this.findGroupPosition(curGm.gId, curGm.gPos);\n                        if (newGPos != curGm.gPos) {\n                            if (newGPos == AdapterView.INVALID_POSITION) {\n                                egml.remove(i);\n                                egmlSize--;\n                            }\n                            curGm.gPos = newGPos;\n                            if (!positionsChanged)\n                                positionsChanged = true;\n                        }\n                    }\n                    if (positionsChanged) {\n                        Collections.sort(egml);\n                    }\n                }\n                let gChildrenCount;\n                let lastGPos = 0;\n                for (let i = 0; i < egmlSize; i++) {\n                    let curGm = egml.get(i);\n                    if ((curGm.lastChildFlPos == ExpandableListConnector.GroupMetadata.REFRESH) || forceChildrenCountRefresh) {\n                        gChildrenCount = this.mExpandableListAdapter.getChildrenCount(curGm.gPos);\n                    }\n                    else {\n                        gChildrenCount = curGm.lastChildFlPos - curGm.flPos;\n                    }\n                    this.mTotalExpChildrenCount += gChildrenCount;\n                    curFlPos += (curGm.gPos - lastGPos);\n                    lastGPos = curGm.gPos;\n                    curGm.flPos = curFlPos;\n                    curFlPos += gChildrenCount;\n                    curGm.lastChildFlPos = curFlPos;\n                }\n            }\n            collapseGroup(groupPos) {\n                let elGroupPos = ExpandableListPosition.obtain(ExpandableListPosition.GROUP, groupPos, -1, -1);\n                let pm = this.getFlattenedPos(elGroupPos);\n                elGroupPos.recycle();\n                if (pm == null)\n                    return false;\n                let retValue = this.collapseGroupWithMeta(pm);\n                pm.recycle();\n                return retValue;\n            }\n            collapseGroupWithMeta(posMetadata) {\n                if (posMetadata.groupMetadata == null)\n                    return false;\n                this.mExpGroupMetadataList.remove(posMetadata.groupMetadata);\n                this.refreshExpGroupMetadataList(false, false);\n                this.notifyDataSetChanged();\n                this.mExpandableListAdapter.onGroupCollapsed(posMetadata.groupMetadata.gPos);\n                return true;\n            }\n            expandGroup(groupPos) {\n                let elGroupPos = ExpandableListPosition.obtain(ExpandableListPosition.GROUP, groupPos, -1, -1);\n                let pm = this.getFlattenedPos(elGroupPos);\n                elGroupPos.recycle();\n                let retValue = this.expandGroupWithMeta(pm);\n                pm.recycle();\n                return retValue;\n            }\n            expandGroupWithMeta(posMetadata) {\n                if (posMetadata.position.groupPos < 0) {\n                    throw Error(`new RuntimeException(\"Need group\")`);\n                }\n                if (this.mMaxExpGroupCount == 0)\n                    return false;\n                if (posMetadata.groupMetadata != null)\n                    return false;\n                if (this.mExpGroupMetadataList.size() >= this.mMaxExpGroupCount) {\n                    let collapsedGm = this.mExpGroupMetadataList.get(0);\n                    let collapsedIndex = this.mExpGroupMetadataList.indexOf(collapsedGm);\n                    this.collapseGroup(collapsedGm.gPos);\n                    if (posMetadata.groupInsertIndex > collapsedIndex) {\n                        posMetadata.groupInsertIndex--;\n                    }\n                }\n                let expandedGm = ExpandableListConnector.GroupMetadata.obtain(ExpandableListConnector.GroupMetadata.REFRESH, ExpandableListConnector.GroupMetadata.REFRESH, posMetadata.position.groupPos, this.mExpandableListAdapter.getGroupId(posMetadata.position.groupPos));\n                this.mExpGroupMetadataList.add(posMetadata.groupInsertIndex, expandedGm);\n                this.refreshExpGroupMetadataList(false, false);\n                this.notifyDataSetChanged();\n                this.mExpandableListAdapter.onGroupExpanded(expandedGm.gPos);\n                return true;\n            }\n            isGroupExpanded(groupPosition) {\n                let groupMetadata;\n                for (let i = this.mExpGroupMetadataList.size() - 1; i >= 0; i--) {\n                    groupMetadata = this.mExpGroupMetadataList.get(i);\n                    if (groupMetadata.gPos == groupPosition) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n            setMaxExpGroupCount(maxExpGroupCount) {\n                this.mMaxExpGroupCount = maxExpGroupCount;\n            }\n            getAdapter() {\n                return this.mExpandableListAdapter;\n            }\n            getExpandedGroupMetadataList() {\n                return this.mExpGroupMetadataList;\n            }\n            setExpandedGroupMetadataList(expandedGroupMetadataList) {\n                if ((expandedGroupMetadataList == null) || (this.mExpandableListAdapter == null)) {\n                    return;\n                }\n                let numGroups = this.mExpandableListAdapter.getGroupCount();\n                for (let i = expandedGroupMetadataList.size() - 1; i >= 0; i--) {\n                    if (expandedGroupMetadataList.get(i).gPos >= numGroups) {\n                        return;\n                    }\n                }\n                this.mExpGroupMetadataList = expandedGroupMetadataList;\n                this.refreshExpGroupMetadataList(true, false);\n            }\n            isEmpty() {\n                let adapter = this.getAdapter();\n                return adapter != null ? adapter.isEmpty() : true;\n            }\n            findGroupPosition(groupIdToMatch, seedGroupPosition) {\n                let count = this.mExpandableListAdapter.getGroupCount();\n                if (count == 0) {\n                    return AdapterView.INVALID_POSITION;\n                }\n                if (groupIdToMatch == AdapterView.INVALID_ROW_ID) {\n                    return AdapterView.INVALID_POSITION;\n                }\n                seedGroupPosition = Math.max(0, seedGroupPosition);\n                seedGroupPosition = Math.min(count - 1, seedGroupPosition);\n                let endTime = SystemClock.uptimeMillis() + AdapterView.SYNC_MAX_DURATION_MILLIS;\n                let rowId;\n                let first = seedGroupPosition;\n                let last = seedGroupPosition;\n                let next = false;\n                let hitFirst;\n                let hitLast;\n                let adapter = this.getAdapter();\n                if (adapter == null) {\n                    return AdapterView.INVALID_POSITION;\n                }\n                while (SystemClock.uptimeMillis() <= endTime) {\n                    rowId = adapter.getGroupId(seedGroupPosition);\n                    if (rowId == groupIdToMatch) {\n                        return seedGroupPosition;\n                    }\n                    hitLast = last == count - 1;\n                    hitFirst = first == 0;\n                    if (hitLast && hitFirst) {\n                        break;\n                    }\n                    if (hitFirst || (next && !hitLast)) {\n                        last++;\n                        seedGroupPosition = last;\n                        next = false;\n                    }\n                    else if (hitLast || (!next && !hitFirst)) {\n                        first--;\n                        seedGroupPosition = first;\n                        next = true;\n                    }\n                }\n                return AdapterView.INVALID_POSITION;\n            }\n        }\n        widget.ExpandableListConnector = ExpandableListConnector;\n        (function (ExpandableListConnector) {\n            class MyDataSetObserver extends DataSetObserver {\n                constructor(arg) {\n                    super();\n                    this._ExpandableListConnector_this = arg;\n                }\n                onChanged() {\n                    this._ExpandableListConnector_this.refreshExpGroupMetadataList(true, true);\n                    this._ExpandableListConnector_this.notifyDataSetChanged();\n                }\n                onInvalidated() {\n                    this._ExpandableListConnector_this.refreshExpGroupMetadataList(true, true);\n                    this._ExpandableListConnector_this.notifyDataSetInvalidated();\n                }\n            }\n            ExpandableListConnector.MyDataSetObserver = MyDataSetObserver;\n            class GroupMetadata {\n                constructor() {\n                    this.flPos = 0;\n                    this.lastChildFlPos = 0;\n                    this.gPos = 0;\n                    this.gId = 0;\n                }\n                static obtain(flPos, lastChildFlPos, gPos, gId) {\n                    let gm = new GroupMetadata();\n                    gm.flPos = flPos;\n                    gm.lastChildFlPos = lastChildFlPos;\n                    gm.gPos = gPos;\n                    gm.gId = gId;\n                    return gm;\n                }\n                compareTo(another) {\n                    if (another == null) {\n                        throw Error(`new IllegalArgumentException()`);\n                    }\n                    return this.gPos - another.gPos;\n                }\n            }\n            GroupMetadata.REFRESH = -1;\n            ExpandableListConnector.GroupMetadata = GroupMetadata;\n            class PositionMetadata {\n                constructor() {\n                    this.groupInsertIndex = 0;\n                }\n                resetState() {\n                    if (this.position != null) {\n                        this.position.recycle();\n                        this.position = null;\n                    }\n                    this.groupMetadata = null;\n                    this.groupInsertIndex = 0;\n                }\n                static obtain(flatListPos, type, groupPos, childPos, groupMetadata, groupInsertIndex) {\n                    let pm = PositionMetadata.getRecycledOrCreate();\n                    pm.position = ExpandableListPosition.obtain(type, groupPos, childPos, flatListPos);\n                    pm.groupMetadata = groupMetadata;\n                    pm.groupInsertIndex = groupInsertIndex;\n                    return pm;\n                }\n                static getRecycledOrCreate() {\n                    let pm;\n                    {\n                        if (PositionMetadata.sPool.size() > 0) {\n                            pm = PositionMetadata.sPool.remove(0);\n                        }\n                        else {\n                            return new PositionMetadata();\n                        }\n                    }\n                    pm.resetState();\n                    return pm;\n                }\n                recycle() {\n                    this.resetState();\n                    {\n                        if (PositionMetadata.sPool.size() < PositionMetadata.MAX_POOL_SIZE) {\n                            PositionMetadata.sPool.add(this);\n                        }\n                    }\n                }\n                isExpanded() {\n                    return this.groupMetadata != null;\n                }\n            }\n            PositionMetadata.MAX_POOL_SIZE = 5;\n            PositionMetadata.sPool = new ArrayList(PositionMetadata.MAX_POOL_SIZE);\n            ExpandableListConnector.PositionMetadata = PositionMetadata;\n        })(ExpandableListConnector = widget.ExpandableListConnector || (widget.ExpandableListConnector = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var Rect = android.graphics.Rect;\n        var SoundEffectConstants = android.view.SoundEffectConstants;\n        var View = android.view.View;\n        var ExpandableListConnector = android.widget.ExpandableListConnector;\n        var ExpandableListPosition = android.widget.ExpandableListPosition;\n        var ListView = android.widget.ListView;\n        var Long = goog.math.Long;\n        class ExpandableListView extends ListView {\n            constructor(context, attrs, defStyle = android.R.attr.expandableListViewStyle) {\n                super(context, attrs, defStyle);\n                this.mIndicatorLeft = 0;\n                this.mIndicatorRight = 0;\n                this.mIndicatorStart = 0;\n                this.mIndicatorEnd = 0;\n                this.mChildIndicatorLeft = 0;\n                this.mChildIndicatorRight = 0;\n                this.mChildIndicatorStart = 0;\n                this.mChildIndicatorEnd = 0;\n                this.mIndicatorRect = new Rect();\n                let a = context.obtainStyledAttributes(attrs, defStyle);\n                this.mGroupIndicator = a.getDrawable('groupIndicator');\n                this.mChildIndicator = a.getDrawable('childIndicator');\n                this.mIndicatorLeft = a.getDimensionPixelSize('indicatorLeft', 0);\n                this.mIndicatorRight = a.getDimensionPixelSize('indicatorRight', 0);\n                if (this.mIndicatorRight == 0 && this.mGroupIndicator != null) {\n                    this.mIndicatorRight = this.mIndicatorLeft + this.mGroupIndicator.getIntrinsicWidth();\n                }\n                this.mChildIndicatorLeft = a.getDimensionPixelSize('childIndicatorLeft', ExpandableListView.CHILD_INDICATOR_INHERIT);\n                this.mChildIndicatorRight = a.getDimensionPixelSize('childIndicatorRight', ExpandableListView.CHILD_INDICATOR_INHERIT);\n                this.mChildDivider = a.getDrawable('childDivider');\n                if (!this.isRtlCompatibilityMode()) {\n                    this.mIndicatorStart = a.getDimensionPixelSize('indicatorStart', ExpandableListView.INDICATOR_UNDEFINED);\n                    this.mIndicatorEnd = a.getDimensionPixelSize('indicatorEnd', ExpandableListView.INDICATOR_UNDEFINED);\n                    this.mChildIndicatorStart = a.getDimensionPixelSize('childIndicatorStart', ExpandableListView.CHILD_INDICATOR_INHERIT);\n                    this.mChildIndicatorEnd = a.getDimensionPixelSize('childIndicatorEnd', ExpandableListView.CHILD_INDICATOR_INHERIT);\n                }\n                a.recycle();\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('groupIndicator', {\n                    setter(v, value, attrBinder) {\n                        v.setGroupIndicator(attrBinder.parseDrawable(value));\n                    }, getter(v) {\n                        return v.mGroupIndicator;\n                    }\n                }).set('childIndicator', {\n                    setter(v, value, attrBinder) {\n                        v.setChildIndicator(attrBinder.parseDrawable(value));\n                    }, getter(v) {\n                        return v.mChildIndicator;\n                    }\n                }).set('indicatorLeft', {\n                    setter(v, value, attrBinder) {\n                        v.setIndicatorBounds(attrBinder.parseNumberPixelOffset(value, 0), v.mIndicatorRight);\n                    }, getter(v) {\n                        return v.mIndicatorLeft;\n                    }\n                }).set('indicatorRight', {\n                    setter(v, value, attrBinder) {\n                        let num = attrBinder.parseNumberPixelOffset(value, 0);\n                        if (num == 0 && v.mGroupIndicator != null) {\n                            num = v.mIndicatorLeft + v.mGroupIndicator.getIntrinsicWidth();\n                        }\n                        this.setIndicatorBounds(v.mIndicatorLeft, num);\n                    }, getter(v) {\n                        return v.mIndicatorRight;\n                    }\n                }).set('childIndicatorLeft', {\n                    setter(v, value, attrBinder) {\n                        v.setChildIndicatorBounds(attrBinder.parseNumberPixelOffset(value, ExpandableListView.CHILD_INDICATOR_INHERIT), v.mChildIndicatorRight);\n                    }, getter(v) {\n                        return v.mChildIndicatorLeft;\n                    }\n                }).set('childIndicatorRight', {\n                    setter(v, value, attrBinder) {\n                        let num = attrBinder.parseNumberPixelOffset(value, ExpandableListView.CHILD_INDICATOR_INHERIT);\n                        if (num == 0 && v.mChildIndicator != null) {\n                            num = v.mChildIndicatorLeft + v.mChildIndicator.getIntrinsicWidth();\n                        }\n                        v.setIndicatorBounds(v.mChildIndicatorLeft, num);\n                    }, getter(v) {\n                        return v.mChildIndicatorRight;\n                    }\n                }).set('childDivider', {\n                    setter(v, value, attrBinder) {\n                        v.setChildDivider(attrBinder.parseDrawable(value));\n                    }, getter(v) {\n                        return v.mChildDivider;\n                    }\n                });\n            }\n            isRtlCompatibilityMode() {\n                return !this.hasRtlSupport();\n            }\n            hasRtlSupport() {\n                return false;\n            }\n            onRtlPropertiesChanged(layoutDirection) {\n                this.resolveIndicator();\n                this.resolveChildIndicator();\n            }\n            resolveIndicator() {\n                const isLayoutRtl = this.isLayoutRtl();\n                if (isLayoutRtl) {\n                    if (this.mIndicatorStart >= 0) {\n                        this.mIndicatorRight = this.mIndicatorStart;\n                    }\n                    if (this.mIndicatorEnd >= 0) {\n                        this.mIndicatorLeft = this.mIndicatorEnd;\n                    }\n                }\n                else {\n                    if (this.mIndicatorStart >= 0) {\n                        this.mIndicatorLeft = this.mIndicatorStart;\n                    }\n                    if (this.mIndicatorEnd >= 0) {\n                        this.mIndicatorRight = this.mIndicatorEnd;\n                    }\n                }\n                if (this.mIndicatorRight == 0 && this.mGroupIndicator != null) {\n                    this.mIndicatorRight = this.mIndicatorLeft + this.mGroupIndicator.getIntrinsicWidth();\n                }\n            }\n            resolveChildIndicator() {\n                const isLayoutRtl = this.isLayoutRtl();\n                if (isLayoutRtl) {\n                    if (this.mChildIndicatorStart >= ExpandableListView.CHILD_INDICATOR_INHERIT) {\n                        this.mChildIndicatorRight = this.mChildIndicatorStart;\n                    }\n                    if (this.mChildIndicatorEnd >= ExpandableListView.CHILD_INDICATOR_INHERIT) {\n                        this.mChildIndicatorLeft = this.mChildIndicatorEnd;\n                    }\n                }\n                else {\n                    if (this.mChildIndicatorStart >= ExpandableListView.CHILD_INDICATOR_INHERIT) {\n                        this.mChildIndicatorLeft = this.mChildIndicatorStart;\n                    }\n                    if (this.mChildIndicatorEnd >= ExpandableListView.CHILD_INDICATOR_INHERIT) {\n                        this.mChildIndicatorRight = this.mChildIndicatorEnd;\n                    }\n                }\n            }\n            dispatchDraw(canvas) {\n                super.dispatchDraw(canvas);\n                if ((this.mChildIndicator == null) && (this.mGroupIndicator == null)) {\n                    return;\n                }\n                let saveCount = 0;\n                const clipToPadding = (this.mGroupFlags & ExpandableListView.CLIP_TO_PADDING_MASK) == ExpandableListView.CLIP_TO_PADDING_MASK;\n                if (clipToPadding) {\n                    saveCount = canvas.save();\n                    const scrollX = this.mScrollX;\n                    const scrollY = this.mScrollY;\n                    canvas.clipRect(scrollX + this.mPaddingLeft, scrollY + this.mPaddingTop, scrollX + this.mRight - this.mLeft - this.mPaddingRight, scrollY + this.mBottom - this.mTop - this.mPaddingBottom);\n                }\n                const headerViewsCount = this.getHeaderViewsCount();\n                const lastChildFlPos = this.mItemCount - this.getFooterViewsCount() - headerViewsCount - 1;\n                const myB = this.mBottom;\n                let pos;\n                let item;\n                let indicator;\n                let t, b;\n                let lastItemType = ~(ExpandableListPosition.CHILD | ExpandableListPosition.GROUP);\n                const indicatorRect = this.mIndicatorRect;\n                const childCount = this.getChildCount();\n                for (let i = 0, childFlPos = this.mFirstPosition - headerViewsCount; i < childCount; i++, childFlPos++) {\n                    if (childFlPos < 0) {\n                        continue;\n                    }\n                    else if (childFlPos > lastChildFlPos) {\n                        break;\n                    }\n                    item = this.getChildAt(i);\n                    t = item.getTop();\n                    b = item.getBottom();\n                    if ((b < 0) || (t > myB))\n                        continue;\n                    pos = this.mConnector.getUnflattenedPos(childFlPos);\n                    const isLayoutRtl = this.isLayoutRtl();\n                    const width = this.getWidth();\n                    if (pos.position.type != lastItemType) {\n                        if (pos.position.type == ExpandableListPosition.CHILD) {\n                            indicatorRect.left = (this.mChildIndicatorLeft == ExpandableListView.CHILD_INDICATOR_INHERIT) ? this.mIndicatorLeft : this.mChildIndicatorLeft;\n                            indicatorRect.right = (this.mChildIndicatorRight == ExpandableListView.CHILD_INDICATOR_INHERIT) ? this.mIndicatorRight : this.mChildIndicatorRight;\n                        }\n                        else {\n                            indicatorRect.left = this.mIndicatorLeft;\n                            indicatorRect.right = this.mIndicatorRight;\n                        }\n                        if (isLayoutRtl) {\n                            const temp = indicatorRect.left;\n                            indicatorRect.left = width - indicatorRect.right;\n                            indicatorRect.right = width - temp;\n                            indicatorRect.left -= this.mPaddingRight;\n                            indicatorRect.right -= this.mPaddingRight;\n                        }\n                        else {\n                            indicatorRect.left += this.mPaddingLeft;\n                            indicatorRect.right += this.mPaddingLeft;\n                        }\n                        lastItemType = pos.position.type;\n                    }\n                    if (indicatorRect.left != indicatorRect.right) {\n                        if (this.mStackFromBottom) {\n                            indicatorRect.top = t;\n                            indicatorRect.bottom = b;\n                        }\n                        else {\n                            indicatorRect.top = t;\n                            indicatorRect.bottom = b;\n                        }\n                        indicator = this.getIndicator(pos);\n                        if (indicator != null) {\n                            indicator.setBounds(indicatorRect);\n                            indicator.draw(canvas);\n                        }\n                    }\n                    pos.recycle();\n                }\n                if (clipToPadding) {\n                    canvas.restoreToCount(saveCount);\n                }\n            }\n            getIndicator(pos) {\n                let indicator;\n                if (pos.position.type == ExpandableListPosition.GROUP) {\n                    indicator = this.mGroupIndicator;\n                    if (indicator != null && indicator.isStateful()) {\n                        let isEmpty = (pos.groupMetadata == null) || (pos.groupMetadata.lastChildFlPos == pos.groupMetadata.flPos);\n                        const stateSetIndex = (pos.isExpanded() ? 1 : 0) |\n                            (isEmpty ? 2 : 0);\n                        indicator.setState(ExpandableListView.GROUP_STATE_SETS[stateSetIndex]);\n                    }\n                }\n                else {\n                    indicator = this.mChildIndicator;\n                    if (indicator != null && indicator.isStateful()) {\n                        const stateSet = pos.position.flatListPos == pos.groupMetadata.lastChildFlPos ? ExpandableListView.CHILD_LAST_STATE_SET : ExpandableListView.EMPTY_STATE_SET;\n                        indicator.setState(stateSet);\n                    }\n                }\n                return indicator;\n            }\n            setChildDivider(childDivider) {\n                this.mChildDivider = childDivider;\n            }\n            drawDivider(canvas, bounds, childIndex) {\n                let flatListPosition = childIndex + this.mFirstPosition;\n                if (flatListPosition >= 0) {\n                    const adjustedPosition = this.getFlatPositionForConnector(flatListPosition);\n                    let pos = this.mConnector.getUnflattenedPos(adjustedPosition);\n                    if ((pos.position.type == ExpandableListPosition.CHILD) || (pos.isExpanded() && pos.groupMetadata.lastChildFlPos != pos.groupMetadata.flPos)) {\n                        const divider = this.mChildDivider;\n                        divider.setBounds(bounds);\n                        divider.draw(canvas);\n                        pos.recycle();\n                        return;\n                    }\n                    pos.recycle();\n                }\n                super.drawDivider(canvas, bounds, flatListPosition);\n            }\n            setAdapter(adapter) {\n                throw Error(`new RuntimeException(\"For ExpandableListView, use setAdapter(ExpandableListAdapter) instead of \" + \"setAdapter(ListAdapter)\")`);\n            }\n            getAdapter() {\n                return super.getAdapter();\n            }\n            setOnItemClickListener(l) {\n                super.setOnItemClickListener(l);\n            }\n            setExpandableAdapter(adapter) {\n                this.mExpandAdapter = adapter;\n                if (adapter != null) {\n                    this.mConnector = new ExpandableListConnector(adapter);\n                }\n                else {\n                    this.mConnector = null;\n                }\n                super.setAdapter(this.mConnector);\n            }\n            getExpandableListAdapter() {\n                return this.mExpandAdapter;\n            }\n            isHeaderOrFooterPosition(position) {\n                const footerViewsStart = this.mItemCount - this.getFooterViewsCount();\n                return (position < this.getHeaderViewsCount() || position >= footerViewsStart);\n            }\n            getFlatPositionForConnector(flatListPosition) {\n                return flatListPosition - this.getHeaderViewsCount();\n            }\n            getAbsoluteFlatPosition(flatListPosition) {\n                return flatListPosition + this.getHeaderViewsCount();\n            }\n            performItemClick(v, position, id) {\n                if (this.isHeaderOrFooterPosition(position)) {\n                    return super.performItemClick(v, position, id);\n                }\n                const adjustedPosition = this.getFlatPositionForConnector(position);\n                return this.handleItemClick(v, adjustedPosition, id);\n            }\n            handleItemClick(v, position, id) {\n                const posMetadata = this.mConnector.getUnflattenedPos(position);\n                id = this.getChildOrGroupId(posMetadata.position);\n                let returnValue;\n                if (posMetadata.position.type == ExpandableListPosition.GROUP) {\n                    if (this.mOnGroupClickListener != null) {\n                        if (this.mOnGroupClickListener.onGroupClick(this, v, posMetadata.position.groupPos, id)) {\n                            posMetadata.recycle();\n                            return true;\n                        }\n                    }\n                    if (posMetadata.isExpanded()) {\n                        this.mConnector.collapseGroupWithMeta(posMetadata);\n                        this.playSoundEffect(SoundEffectConstants.CLICK);\n                        if (this.mOnGroupCollapseListener != null) {\n                            this.mOnGroupCollapseListener.onGroupCollapse(posMetadata.position.groupPos);\n                        }\n                    }\n                    else {\n                        this.mConnector.expandGroupWithMeta(posMetadata);\n                        this.playSoundEffect(SoundEffectConstants.CLICK);\n                        if (this.mOnGroupExpandListener != null) {\n                            this.mOnGroupExpandListener.onGroupExpand(posMetadata.position.groupPos);\n                        }\n                        const groupPos = posMetadata.position.groupPos;\n                        const groupFlatPos = posMetadata.position.flatListPos;\n                        const shiftedGroupPosition = groupFlatPos + this.getHeaderViewsCount();\n                        this.smoothScrollToPosition(shiftedGroupPosition + this.mExpandAdapter.getChildrenCount(groupPos), shiftedGroupPosition);\n                    }\n                    returnValue = true;\n                }\n                else {\n                    if (this.mOnChildClickListener != null) {\n                        this.playSoundEffect(SoundEffectConstants.CLICK);\n                        return this.mOnChildClickListener.onChildClick(this, v, posMetadata.position.groupPos, posMetadata.position.childPos, id);\n                    }\n                    returnValue = false;\n                }\n                posMetadata.recycle();\n                return returnValue;\n            }\n            expandGroup(groupPos, animate = false) {\n                let elGroupPos = ExpandableListPosition.obtain(ExpandableListPosition.GROUP, groupPos, -1, -1);\n                let pm = this.mConnector.getFlattenedPos(elGroupPos);\n                elGroupPos.recycle();\n                let retValue = this.mConnector.expandGroupWithMeta(pm);\n                if (this.mOnGroupExpandListener != null) {\n                    this.mOnGroupExpandListener.onGroupExpand(groupPos);\n                }\n                if (animate) {\n                    const groupFlatPos = pm.position.flatListPos;\n                    const shiftedGroupPosition = groupFlatPos + this.getHeaderViewsCount();\n                    this.smoothScrollToPosition(shiftedGroupPosition + this.mExpandAdapter.getChildrenCount(groupPos), shiftedGroupPosition);\n                }\n                pm.recycle();\n                return retValue;\n            }\n            collapseGroup(groupPos) {\n                let retValue = this.mConnector.collapseGroup(groupPos);\n                if (this.mOnGroupCollapseListener != null) {\n                    this.mOnGroupCollapseListener.onGroupCollapse(groupPos);\n                }\n                return retValue;\n            }\n            setOnGroupCollapseListener(onGroupCollapseListener) {\n                this.mOnGroupCollapseListener = onGroupCollapseListener;\n            }\n            setOnGroupExpandListener(onGroupExpandListener) {\n                this.mOnGroupExpandListener = onGroupExpandListener;\n            }\n            setOnGroupClickListener(onGroupClickListener) {\n                this.mOnGroupClickListener = onGroupClickListener;\n            }\n            setOnChildClickListener(onChildClickListener) {\n                this.mOnChildClickListener = onChildClickListener;\n            }\n            getExpandableListPosition(flatListPosition) {\n                if (this.isHeaderOrFooterPosition(flatListPosition)) {\n                    return ExpandableListView.PACKED_POSITION_VALUE_NULL;\n                }\n                const adjustedPosition = this.getFlatPositionForConnector(flatListPosition);\n                let pm = this.mConnector.getUnflattenedPos(adjustedPosition);\n                let packedPos = pm.position.getPackedPosition();\n                pm.recycle();\n                return packedPos;\n            }\n            getFlatListPosition(packedPosition) {\n                let elPackedPos = ExpandableListPosition.obtainPosition(packedPosition);\n                let pm = this.mConnector.getFlattenedPos(elPackedPos);\n                elPackedPos.recycle();\n                const flatListPosition = pm.position.flatListPos;\n                pm.recycle();\n                return this.getAbsoluteFlatPosition(flatListPosition);\n            }\n            getSelectedPosition() {\n                const selectedPos = this.getSelectedItemPosition();\n                return this.getExpandableListPosition(selectedPos);\n            }\n            getSelectedId() {\n                let packedPos = this.getSelectedPosition();\n                if (packedPos == ExpandableListView.PACKED_POSITION_VALUE_NULL)\n                    return -1;\n                let groupPos = ExpandableListView.getPackedPositionGroup(packedPos);\n                if (ExpandableListView.getPackedPositionType(packedPos) == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {\n                    return this.mExpandAdapter.getGroupId(groupPos);\n                }\n                else {\n                    return this.mExpandAdapter.getChildId(groupPos, ExpandableListView.getPackedPositionChild(packedPos));\n                }\n            }\n            setSelectedGroup(groupPosition) {\n                let elGroupPos = ExpandableListPosition.obtainGroupPosition(groupPosition);\n                let pm = this.mConnector.getFlattenedPos(elGroupPos);\n                elGroupPos.recycle();\n                const absoluteFlatPosition = this.getAbsoluteFlatPosition(pm.position.flatListPos);\n                super.setSelection(absoluteFlatPosition);\n                pm.recycle();\n            }\n            setSelectedChild(groupPosition, childPosition, shouldExpandGroup) {\n                let elChildPos = ExpandableListPosition.obtainChildPosition(groupPosition, childPosition);\n                let flatChildPos = this.mConnector.getFlattenedPos(elChildPos);\n                if (flatChildPos == null) {\n                    if (!shouldExpandGroup)\n                        return false;\n                    this.expandGroup(groupPosition);\n                    flatChildPos = this.mConnector.getFlattenedPos(elChildPos);\n                    if (flatChildPos == null) {\n                        throw Error(`new IllegalStateException(\"Could not find child\")`);\n                    }\n                }\n                let absoluteFlatPosition = this.getAbsoluteFlatPosition(flatChildPos.position.flatListPos);\n                super.setSelection(absoluteFlatPosition);\n                elChildPos.recycle();\n                flatChildPos.recycle();\n                return true;\n            }\n            isGroupExpanded(groupPosition) {\n                return this.mConnector.isGroupExpanded(groupPosition);\n            }\n            static getPackedPositionType(packedPosition) {\n                if (packedPosition == ExpandableListView.PACKED_POSITION_VALUE_NULL) {\n                    return ExpandableListView.PACKED_POSITION_TYPE_NULL;\n                }\n                return (Long.fromNumber(packedPosition).and(ExpandableListView.PACKED_POSITION_MASK_TYPE)).equals(ExpandableListView.PACKED_POSITION_MASK_TYPE)\n                    ? ExpandableListView.PACKED_POSITION_TYPE_CHILD : ExpandableListView.PACKED_POSITION_TYPE_GROUP;\n            }\n            static getPackedPositionGroup(packedPosition) {\n                if (packedPosition == ExpandableListView.PACKED_POSITION_VALUE_NULL)\n                    return -1;\n                return (Long.fromNumber(packedPosition).and(ExpandableListView.PACKED_POSITION_MASK_GROUP))\n                    .shiftRight(ExpandableListView.PACKED_POSITION_SHIFT_GROUP).toNumber();\n            }\n            static getPackedPositionChild(packedPosition) {\n                if (packedPosition == ExpandableListView.PACKED_POSITION_VALUE_NULL)\n                    return -1;\n                if ((Long.fromNumber(packedPosition).and(ExpandableListView.PACKED_POSITION_MASK_TYPE)).notEquals(ExpandableListView.PACKED_POSITION_MASK_TYPE))\n                    return -1;\n                return Long.fromNumber(packedPosition).and(ExpandableListView.PACKED_POSITION_MASK_CHILD).toNumber();\n            }\n            static getPackedPositionForChild(groupPosition, childPosition) {\n                return Long.fromInt(ExpandableListView.PACKED_POSITION_TYPE_CHILD).shiftLeft(ExpandableListView.PACKED_POSITION_SHIFT_TYPE)\n                    .or(Long.fromNumber(groupPosition).and(ExpandableListView.PACKED_POSITION_INT_MASK_GROUP).shiftLeft(ExpandableListView.PACKED_POSITION_SHIFT_GROUP))\n                    .or(Long.fromNumber(childPosition).and(ExpandableListView.PACKED_POSITION_INT_MASK_CHILD)).toNumber();\n            }\n            static getPackedPositionForGroup(groupPosition) {\n                return Long.fromInt(groupPosition).and(ExpandableListView.PACKED_POSITION_INT_MASK_GROUP)\n                    .shiftLeft(ExpandableListView.PACKED_POSITION_SHIFT_GROUP).toNumber();\n            }\n            getChildOrGroupId(position) {\n                if (position.type == ExpandableListPosition.CHILD) {\n                    return this.mExpandAdapter.getChildId(position.groupPos, position.childPos);\n                }\n                else {\n                    return this.mExpandAdapter.getGroupId(position.groupPos);\n                }\n            }\n            setChildIndicator(childIndicator) {\n                this.mChildIndicator = childIndicator;\n            }\n            setChildIndicatorBounds(left, right) {\n                this.mChildIndicatorLeft = left;\n                this.mChildIndicatorRight = right;\n                this.resolveChildIndicator();\n            }\n            setChildIndicatorBoundsRelative(start, end) {\n                this.mChildIndicatorStart = start;\n                this.mChildIndicatorEnd = end;\n                this.resolveChildIndicator();\n            }\n            setGroupIndicator(groupIndicator) {\n                this.mGroupIndicator = groupIndicator;\n                if (this.mIndicatorRight == 0 && this.mGroupIndicator != null) {\n                    this.mIndicatorRight = this.mIndicatorLeft + this.mGroupIndicator.getIntrinsicWidth();\n                }\n            }\n            setIndicatorBounds(left, right) {\n                this.mIndicatorLeft = left;\n                this.mIndicatorRight = right;\n                this.resolveIndicator();\n            }\n            setIndicatorBoundsRelative(start, end) {\n                this.mIndicatorStart = start;\n                this.mIndicatorEnd = end;\n                this.resolveIndicator();\n            }\n        }\n        ExpandableListView.PACKED_POSITION_TYPE_GROUP = 0;\n        ExpandableListView.PACKED_POSITION_TYPE_CHILD = 1;\n        ExpandableListView.PACKED_POSITION_TYPE_NULL = 2;\n        ExpandableListView.PACKED_POSITION_VALUE_NULL = 0x00000000FFFFFFFF;\n        ExpandableListView.PACKED_POSITION_MASK_CHILD = Long.fromNumber(0x00000000FFFFFFFF);\n        ExpandableListView.PACKED_POSITION_MASK_GROUP = Long.fromNumber(0x7FFFFFFF00000000);\n        ExpandableListView.PACKED_POSITION_MASK_TYPE = Long.fromNumber(0x8000000000000000);\n        ExpandableListView.PACKED_POSITION_SHIFT_GROUP = 32;\n        ExpandableListView.PACKED_POSITION_SHIFT_TYPE = 63;\n        ExpandableListView.PACKED_POSITION_INT_MASK_CHILD = Long.fromNumber(0xFFFFFFFF);\n        ExpandableListView.PACKED_POSITION_INT_MASK_GROUP = Long.fromNumber(0x7FFFFFFF);\n        ExpandableListView.CHILD_INDICATOR_INHERIT = -1;\n        ExpandableListView.INDICATOR_UNDEFINED = -2;\n        ExpandableListView.GROUP_EXPANDED_STATE_SET = [View.VIEW_STATE_EXPANDED];\n        ExpandableListView.GROUP_EMPTY_STATE_SET = [View.VIEW_STATE_EMPTY];\n        ExpandableListView.GROUP_EXPANDED_EMPTY_STATE_SET = [View.VIEW_STATE_EXPANDED, View.VIEW_STATE_EMPTY];\n        ExpandableListView.GROUP_STATE_SETS = [\n            ExpandableListView.EMPTY_STATE_SET,\n            ExpandableListView.GROUP_EXPANDED_STATE_SET,\n            ExpandableListView.GROUP_EMPTY_STATE_SET,\n            ExpandableListView.GROUP_EXPANDED_EMPTY_STATE_SET\n        ];\n        ExpandableListView.CHILD_LAST_STATE_SET = [View.VIEW_STATE_LAST];\n        widget.ExpandableListView = ExpandableListView;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var DataSetObservable = android.database.DataSetObservable;\n        var Long = goog.math.Long;\n        const _0x8000000000000000 = Long.fromNumber(0x8000000000000000);\n        const _0x7FFFFFFF = Long.fromNumber(0x7FFFFFFF);\n        const _0xFFFFFFFF = Long.fromNumber(0xFFFFFFFF);\n        class BaseExpandableListAdapter {\n            constructor() {\n                this.mDataSetObservable = new DataSetObservable();\n            }\n            registerDataSetObserver(observer) {\n                this.mDataSetObservable.registerObserver(observer);\n            }\n            unregisterDataSetObserver(observer) {\n                this.mDataSetObservable.unregisterObserver(observer);\n            }\n            notifyDataSetInvalidated() {\n                this.mDataSetObservable.notifyInvalidated();\n            }\n            notifyDataSetChanged() {\n                this.mDataSetObservable.notifyChanged();\n            }\n            areAllItemsEnabled() {\n                return true;\n            }\n            onGroupCollapsed(groupPosition) {\n            }\n            onGroupExpanded(groupPosition) {\n            }\n            getCombinedChildId(groupId, childId) {\n                const _groupId = Long.fromNumber(groupId);\n                const _childId = Long.fromNumber(childId);\n                return _0x8000000000000000.or(_groupId.and(_0x7FFFFFFF).shiftLeft(32)).or(_childId.and(_0xFFFFFFFF)).toNumber();\n            }\n            getCombinedGroupId(groupId) {\n                const _groupId = Long.fromNumber(groupId);\n                return _groupId.add(_0x7FFFFFFF).shiftLeft(32).toNumber();\n            }\n            isEmpty() {\n                return this.getGroupCount() == 0;\n            }\n            getChildType(groupPosition, childPosition) {\n                return 0;\n            }\n            getChildTypeCount() {\n                return 1;\n            }\n            getGroupType(groupPosition) {\n                return 0;\n            }\n            getGroupTypeCount() {\n                return 1;\n            }\n        }\n        widget.BaseExpandableListAdapter = BaseExpandableListAdapter;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var Handler = android.os.Handler;\n        var Log = android.util.Log;\n        var Gravity = android.view.Gravity;\n        var WindowManager = android.view.WindowManager;\n        var Window = android.view.Window;\n        class Toast {\n            constructor(context) {\n                this.mDuration = 0;\n                this.mHandler = new Handler();\n                this.mDelayHide = (() => {\n                    const inner_this = this;\n                    return {\n                        run() {\n                            inner_this.mTN.hide();\n                        }\n                    };\n                })();\n                this.mContext = context;\n                this.mTN = new Toast.TN();\n                this.mTN.mY = context.getResources().getDisplayMetrics().density * 64;\n                this.mTN.mGravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;\n            }\n            show() {\n                if (this.mNextView == null) {\n                    throw Error(`new RuntimeException(\"setView must have been called\")`);\n                }\n                let tn = this.mTN;\n                tn.mNextView = this.mNextView;\n                tn.show();\n                this.mHandler.removeCallbacks(this.mDelayHide);\n                let showDuration = this.mDuration === Toast.LENGTH_LONG ? 3500 : (this.mDuration === Toast.LENGTH_SHORT ? 2000 : this.mDuration);\n                this.mHandler.postDelayed(this.mDelayHide, showDuration);\n            }\n            cancel() {\n                this.mTN.hide();\n            }\n            setView(view) {\n                this.mNextView = view;\n            }\n            getView() {\n                return this.mNextView;\n            }\n            setDuration(duration) {\n                this.mDuration = duration;\n            }\n            getDuration() {\n                return this.mDuration;\n            }\n            setGravity(gravity, xOffset, yOffset) {\n                this.mTN.mGravity = gravity;\n                this.mTN.mX = xOffset;\n                this.mTN.mY = yOffset;\n            }\n            getGravity() {\n                return this.mTN.mGravity;\n            }\n            getXOffset() {\n                return this.mTN.mX;\n            }\n            getYOffset() {\n                return this.mTN.mY;\n            }\n            static makeText(context, text, duration) {\n                let result = new Toast(context);\n                let inflate = context.getLayoutInflater();\n                let v = inflate.inflate(android.R.layout.transient_notification, null);\n                let tv = v.findViewById(android.R.id.message);\n                tv.setMaxWidth(260 * context.getResources().getDisplayMetrics().density);\n                tv.setText(text);\n                result.mNextView = v;\n                result.mDuration = duration;\n                return result;\n            }\n            setText(s) {\n                if (this.mNextView == null) {\n                    throw Error(`new RuntimeException(\"This Toast was not created with Toast.makeText()\")`);\n                }\n                let tv = this.mNextView.findViewById(android.R.id.message);\n                if (tv == null) {\n                    throw Error(`new RuntimeException(\"This Toast was not created with Toast.makeText()\")`);\n                }\n                tv.setText(s);\n            }\n        }\n        Toast.TAG = \"Toast\";\n        Toast.localLOGV = false;\n        Toast.LENGTH_SHORT = 0;\n        Toast.LENGTH_LONG = 1;\n        widget.Toast = Toast;\n        (function (Toast) {\n            class TN {\n                constructor() {\n                    this.mShow = (() => {\n                        const inner_this = this;\n                        class _Inner {\n                            run() {\n                                inner_this.handleShow();\n                            }\n                        }\n                        return new _Inner();\n                    })();\n                    this.mHide = (() => {\n                        const inner_this = this;\n                        class _Inner {\n                            run() {\n                                inner_this.handleHide();\n                                inner_this.mNextView = null;\n                            }\n                        }\n                        return new _Inner();\n                    })();\n                    this.mHandler = new Handler();\n                    this.mGravity = 0;\n                    this.mX = 0;\n                    this.mY = 0;\n                }\n                show() {\n                    if (Toast.localLOGV)\n                        Log.v(Toast.TAG, \"SHOW: \" + this);\n                    this.mHandler.post(this.mShow);\n                }\n                hide() {\n                    if (Toast.localLOGV)\n                        Log.v(Toast.TAG, \"HIDE: \" + this);\n                    this.mHandler.post(this.mHide);\n                }\n                handleShow() {\n                    if (Toast.localLOGV)\n                        Log.v(Toast.TAG, \"HANDLE SHOW: \" + this + \" mView=\" + this.mView + \" mNextView=\" + this.mNextView);\n                    if (this.mView != this.mNextView) {\n                        this.handleHide();\n                        this.mView = this.mNextView;\n                        if (!this.mWindow) {\n                            this.mWindow = new Window(this.mView.getContext().getApplicationContext());\n                            const params = this.mWindow.getAttributes();\n                            params.height = WindowManager.LayoutParams.WRAP_CONTENT;\n                            params.width = WindowManager.LayoutParams.WRAP_CONTENT;\n                            params.dimAmount = 0;\n                            params.type = WindowManager.LayoutParams.TYPE_TOAST;\n                            params.setTitle(\"Toast\");\n                            params.leftMargin = params.rightMargin = 36 * this.mView.getContext().getResources().getDisplayMetrics().density;\n                            params.flags =\n                                WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;\n                            this.mWindow.setFloating(true);\n                            this.mWindow.setBackgroundColor(android.graphics.Color.TRANSPARENT);\n                            this.mWindow.setWindowAnimations(android.R.anim.toast_enter, android.R.anim.toast_exit, null, null);\n                        }\n                        const params = this.mWindow.getAttributes();\n                        this.mWindow.setContentView(this.mView);\n                        let context = this.mView.getContext().getApplicationContext();\n                        this.mWM = context.getWindowManager();\n                        const gravity = Gravity.getAbsoluteGravity(this.mGravity);\n                        params.gravity = gravity;\n                        params.x = this.mX;\n                        params.y = this.mY;\n                        if (this.mWindow.getDecorView().getParent() != null) {\n                            if (Toast.localLOGV)\n                                Log.v(Toast.TAG, \"REMOVE! \" + this.mView + \" in \" + this);\n                            this.mWM.removeWindow(this.mWindow);\n                        }\n                        if (Toast.localLOGV)\n                            Log.v(Toast.TAG, \"ADD! \" + this.mView + \" in \" + this);\n                        this.mWM.addWindow(this.mWindow);\n                    }\n                }\n                handleHide() {\n                    if (Toast.localLOGV)\n                        Log.v(Toast.TAG, \"HANDLE HIDE: \" + this + \" mView=\" + this.mView);\n                    if (this.mView != null) {\n                        if (this.mView.getParent() != null) {\n                            if (Toast.localLOGV)\n                                Log.v(Toast.TAG, \"REMOVE! \" + this.mView + \" in \" + this);\n                            this.mWM.removeWindow(this.mWindow);\n                        }\n                        this.mView = null;\n                    }\n                }\n            }\n            Toast.TN = TN;\n        })(Toast = widget.Toast || (widget.Toast = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var content;\n    (function (content) {\n        var DialogInterface;\n        (function (DialogInterface) {\n            DialogInterface.BUTTON_POSITIVE = -1;\n            DialogInterface.BUTTON_NEGATIVE = -2;\n            DialogInterface.BUTTON_NEUTRAL = -3;\n            DialogInterface.BUTTON1 = DialogInterface.BUTTON_POSITIVE;\n            DialogInterface.BUTTON2 = DialogInterface.BUTTON_NEGATIVE;\n            DialogInterface.BUTTON3 = DialogInterface.BUTTON_NEUTRAL;\n        })(DialogInterface = content.DialogInterface || (content.DialogInterface = {}));\n    })(content = android.content || (android.content = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var app;\n    (function (app) {\n        var Handler = android.os.Handler;\n        var Message = android.os.Message;\n        var Log = android.util.Log;\n        var Gravity = android.view.Gravity;\n        var KeyEvent = android.view.KeyEvent;\n        var View = android.view.View;\n        var ViewGroup = android.view.ViewGroup;\n        var Window = android.view.Window;\n        var WindowManager = android.view.WindowManager;\n        var WeakReference = java.lang.ref.WeakReference;\n        class Dialog {\n            constructor(context, cancelable, cancelListener) {\n                this.mCancelable = true;\n                this.mCreated = false;\n                this.mShowing = false;\n                this.mCanceled = false;\n                this.mHandler = new Handler();\n                this.mDismissAction = (() => {\n                    const inner_this = this;\n                    class _Inner {\n                        run() {\n                            inner_this.dismissDialog();\n                        }\n                    }\n                    return new _Inner();\n                })();\n                this.mContext = context;\n                this.mWindowManager = context.getWindowManager();\n                let w = new Window(context);\n                w.setFloating(true);\n                w.setDimAmount(0.7);\n                w.setBackgroundColor(android.graphics.Color.TRANSPARENT);\n                this.mWindow = w;\n                let dm = context.getResources().getDisplayMetrics();\n                let decor = w.getDecorView();\n                decor.setMinimumWidth(dm.density * 280);\n                decor.setMinimumHeight(dm.density * 20);\n                const onMeasure = decor.onMeasure;\n                decor.onMeasure = (widthMeasureSpec, heightMeasureSpec) => {\n                    onMeasure.call(decor, widthMeasureSpec, heightMeasureSpec);\n                    let width = decor.getMeasuredWidth();\n                    if (width > 360 * dm.density) {\n                        let widthSpec = View.MeasureSpec.makeMeasureSpec(360 * dm.density, View.MeasureSpec.EXACTLY);\n                        onMeasure.call(decor, widthSpec, heightMeasureSpec);\n                    }\n                };\n                let wp = w.getAttributes();\n                wp.flags |= WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;\n                wp.height = wp.width = ViewGroup.LayoutParams.WRAP_CONTENT;\n                wp.leftMargin = wp.rightMargin = wp.topMargin = wp.bottomMargin = dm.density * 16;\n                w.setWindowAnimations(android.R.anim.dialog_enter, android.R.anim.dialog_exit, null, null);\n                w.setChildWindowManager(this.mWindowManager);\n                w.setGravity(Gravity.CENTER);\n                w.setCallback(this);\n                this.mListenersHandler = new Dialog.ListenersHandler(this);\n                this.mCancelable = cancelable;\n                this.setOnCancelListener(cancelListener);\n            }\n            getContext() {\n                return this.mContext;\n            }\n            isShowing() {\n                return this.mShowing;\n            }\n            show() {\n                if (this.mShowing) {\n                    if (this.mDecor != null) {\n                        this.mDecor.setVisibility(View.VISIBLE);\n                    }\n                    return;\n                }\n                this.mCanceled = false;\n                if (!this.mCreated) {\n                    this.dispatchOnCreate(null);\n                }\n                this.onStart();\n                this.mDecor = this.mWindow.getDecorView();\n                try {\n                    this.mWindowManager.addWindow(this.mWindow);\n                    this.mShowing = true;\n                    this.sendShowMessage();\n                }\n                finally {\n                }\n            }\n            hide() {\n                if (this.mDecor != null) {\n                    this.mDecor.setVisibility(View.GONE);\n                }\n            }\n            dismiss() {\n                this.dismissDialog();\n            }\n            dismissDialog() {\n                if (this.mDecor == null || !this.mShowing) {\n                    return;\n                }\n                if (this.mWindow.isDestroyed()) {\n                    Log.e(Dialog.TAG, \"Tried to dismissDialog() but the Dialog's window was already destroyed!\");\n                    return;\n                }\n                try {\n                    this.mWindowManager.removeWindow(this.mWindow);\n                }\n                finally {\n                    this.mDecor = null;\n                    this.onStop();\n                    this.mShowing = false;\n                    this.sendDismissMessage();\n                }\n            }\n            sendDismissMessage() {\n                if (this.mDismissMessage != null) {\n                    Message.obtain(this.mDismissMessage).sendToTarget();\n                }\n            }\n            sendShowMessage() {\n                if (this.mShowMessage != null) {\n                    Message.obtain(this.mShowMessage).sendToTarget();\n                }\n            }\n            dispatchOnCreate(savedInstanceState) {\n                if (!this.mCreated) {\n                    this.onCreate(savedInstanceState);\n                    this.mCreated = true;\n                }\n            }\n            onCreate(savedInstanceState) {\n            }\n            onStart() {\n            }\n            onStop() {\n            }\n            getWindow() {\n                return this.mWindow;\n            }\n            getCurrentFocus() {\n                return this.mWindow != null ? this.mWindow.getCurrentFocus() : null;\n            }\n            findViewById(id) {\n                return this.mWindow.findViewById(id);\n            }\n            setContentView(view, params) {\n                this.mWindow.setContentView(view, params);\n            }\n            addContentView(view, params) {\n                this.mWindow.addContentView(view, params);\n            }\n            setTitle(title) {\n                this.mWindow.setTitle(title);\n                this.mWindow.getAttributes().setTitle(title);\n            }\n            onKeyDown(keyCode, event) {\n                if (keyCode == KeyEvent.KEYCODE_BACK) {\n                    event.startTracking();\n                    return true;\n                }\n                return false;\n            }\n            onKeyLongPress(keyCode, event) {\n                return false;\n            }\n            onKeyUp(keyCode, event) {\n                if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() && !event.isCanceled()) {\n                    this.onBackPressed();\n                    return true;\n                }\n                return false;\n            }\n            onKeyMultiple(keyCode, repeatCount, event) {\n                return false;\n            }\n            onBackPressed() {\n                if (this.mCancelable) {\n                    this.cancel();\n                }\n            }\n            onTouchEvent(event) {\n                if (this.mCancelable && this.mShowing && this.mWindow.shouldCloseOnTouch(this.mContext, event)) {\n                    this.cancel();\n                    return true;\n                }\n                return false;\n            }\n            onTrackballEvent(event) {\n                return false;\n            }\n            onGenericMotionEvent(event) {\n                return false;\n            }\n            onWindowAttributesChanged(params) {\n                if (this.mDecor != null) {\n                    this.mWindowManager.updateWindowLayout(this.mWindow, params);\n                }\n            }\n            onContentChanged() {\n            }\n            onWindowFocusChanged(hasFocus) {\n            }\n            onAttachedToWindow() {\n            }\n            onDetachedFromWindow() {\n            }\n            dispatchKeyEvent(event) {\n                if ((this.mOnKeyListener != null) && (this.mOnKeyListener.onKey(this, event.getKeyCode(), event))) {\n                    return true;\n                }\n                if (this.mWindow.superDispatchKeyEvent(event)) {\n                    return true;\n                }\n                return event.dispatch(this, this.mDecor != null ? this.mDecor.getKeyDispatcherState() : null, this);\n            }\n            dispatchTouchEvent(ev) {\n                if (this.mWindow.superDispatchTouchEvent(ev)) {\n                    return true;\n                }\n                return this.onTouchEvent(ev);\n            }\n            dispatchGenericMotionEvent(ev) {\n                if (this.mWindow.superDispatchGenericMotionEvent(ev)) {\n                    return true;\n                }\n                return this.onGenericMotionEvent(ev);\n            }\n            takeKeyEvents(get) {\n                this.mWindow.takeKeyEvents(get);\n            }\n            getLayoutInflater() {\n                return this.getWindow().getLayoutInflater();\n            }\n            setCancelable(flag) {\n                this.mCancelable = flag;\n            }\n            setCanceledOnTouchOutside(cancel) {\n                if (cancel && !this.mCancelable) {\n                    this.mCancelable = true;\n                }\n                this.mWindow.setCloseOnTouchOutside(cancel);\n            }\n            cancel() {\n                if (!this.mCanceled && this.mCancelMessage != null) {\n                    this.mCanceled = true;\n                    Message.obtain(this.mCancelMessage).sendToTarget();\n                }\n                this.dismiss();\n            }\n            setOnCancelListener(listener) {\n                if (this.mCancelAndDismissTaken != null) {\n                    throw Error(`new IllegalStateException(\"OnCancelListener is already taken by \" + this.mCancelAndDismissTaken + \" and can not be replaced.\")`);\n                }\n                if (listener != null) {\n                    this.mCancelMessage = this.mListenersHandler.obtainMessage(Dialog.CANCEL, listener);\n                }\n                else {\n                    this.mCancelMessage = null;\n                }\n            }\n            setCancelMessage(msg) {\n                this.mCancelMessage = msg;\n            }\n            setOnDismissListener(listener) {\n                if (this.mCancelAndDismissTaken != null) {\n                    throw Error(`new IllegalStateException(\"OnDismissListener is already taken by \" + this.mCancelAndDismissTaken + \" and can not be replaced.\")`);\n                }\n                if (listener != null) {\n                    this.mDismissMessage = this.mListenersHandler.obtainMessage(Dialog.DISMISS, listener);\n                }\n                else {\n                    this.mDismissMessage = null;\n                }\n            }\n            setOnShowListener(listener) {\n                if (listener != null) {\n                    this.mShowMessage = this.mListenersHandler.obtainMessage(Dialog.SHOW, listener);\n                }\n                else {\n                    this.mShowMessage = null;\n                }\n            }\n            setDismissMessage(msg) {\n                this.mDismissMessage = msg;\n            }\n            takeCancelAndDismissListeners(msg, cancel, dismiss) {\n                if (this.mCancelAndDismissTaken != null) {\n                    this.mCancelAndDismissTaken = null;\n                }\n                else if (this.mCancelMessage != null || this.mDismissMessage != null) {\n                    return false;\n                }\n                this.setOnCancelListener(cancel);\n                this.setOnDismissListener(dismiss);\n                this.mCancelAndDismissTaken = msg;\n                return true;\n            }\n            setOnKeyListener(onKeyListener) {\n                this.mOnKeyListener = onKeyListener;\n            }\n        }\n        Dialog.TAG = \"Dialog\";\n        Dialog.DISMISS = 0x43;\n        Dialog.CANCEL = 0x44;\n        Dialog.SHOW = 0x45;\n        Dialog.DIALOG_SHOWING_TAG = \"android:dialogShowing\";\n        Dialog.DIALOG_HIERARCHY_TAG = \"android:dialogHierarchy\";\n        app.Dialog = Dialog;\n        (function (Dialog) {\n            class ListenersHandler extends Handler {\n                constructor(dialog) {\n                    super();\n                    this.mDialog = new WeakReference(dialog);\n                }\n                handleMessage(msg) {\n                    switch (msg.what) {\n                        case Dialog.DISMISS:\n                            msg.obj.onDismiss(this.mDialog.get());\n                            break;\n                        case Dialog.CANCEL:\n                            msg.obj.onCancel(this.mDialog.get());\n                            break;\n                        case Dialog.SHOW:\n                            msg.obj.onShow(this.mDialog.get());\n                            break;\n                    }\n                }\n            }\n            Dialog.ListenersHandler = ListenersHandler;\n        })(Dialog = app.Dialog || (app.Dialog = {}));\n    })(app = android.app || (android.app = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var Log = android.util.Log;\n        var ArrayList = java.util.ArrayList;\n        var Arrays = java.util.Arrays;\n        var Collections = java.util.Collections;\n        var BaseAdapter = android.widget.BaseAdapter;\n        class ArrayAdapter extends BaseAdapter {\n            constructor(...args) {\n                super();\n                this.mNotifyOnChange = true;\n                if (args.length === 2) {\n                    this.init(args[0], args[1], null, new ArrayList());\n                }\n                else if (args.length === 3) {\n                    if (args[2] instanceof Array) {\n                        this.init(args[0], args[1], null, Arrays.asList(args[2]));\n                    }\n                    else {\n                        this.init(args[0], args[1], args[2], new ArrayList());\n                    }\n                }\n                else if (args.length === 4) {\n                    this.init(args[0], args[1], args[2], args[3]);\n                }\n            }\n            add(object) {\n                {\n                    this.mObjects.add(object);\n                }\n                if (this.mNotifyOnChange)\n                    this.notifyDataSetChanged();\n            }\n            addAll(collection) {\n                {\n                    this.mObjects.addAll(collection);\n                }\n                if (this.mNotifyOnChange)\n                    this.notifyDataSetChanged();\n            }\n            insert(object, index) {\n                {\n                    this.mObjects.add(index, object);\n                }\n                if (this.mNotifyOnChange)\n                    this.notifyDataSetChanged();\n            }\n            remove(object) {\n                {\n                    this.mObjects.remove(object);\n                }\n                if (this.mNotifyOnChange)\n                    this.notifyDataSetChanged();\n            }\n            clear() {\n                {\n                    this.mObjects.clear();\n                }\n                if (this.mNotifyOnChange)\n                    this.notifyDataSetChanged();\n            }\n            sort(comparator) {\n                {\n                    Collections.sort(this.mObjects, comparator);\n                }\n                if (this.mNotifyOnChange)\n                    this.notifyDataSetChanged();\n            }\n            notifyDataSetChanged() {\n                super.notifyDataSetChanged();\n                this.mNotifyOnChange = true;\n            }\n            setNotifyOnChange(notifyOnChange) {\n                this.mNotifyOnChange = notifyOnChange;\n            }\n            init(context, resource, textViewResourceId, objects) {\n                this.mContext = context;\n                this.mInflater = context.getLayoutInflater();\n                this.mResource = this.mDropDownResource = resource;\n                if (objects instanceof Array)\n                    objects = Arrays.asList(objects);\n                this.mObjects = objects;\n                this.mFieldId = textViewResourceId;\n            }\n            getContext() {\n                return this.mContext;\n            }\n            getCount() {\n                return this.mObjects.size();\n            }\n            getItem(position) {\n                return this.mObjects.get(position);\n            }\n            getPosition(item) {\n                return this.mObjects.indexOf(item);\n            }\n            getItemId(position) {\n                return position;\n            }\n            getView(position, convertView, parent) {\n                return this.createViewFromResource(position, convertView, parent, this.mResource);\n            }\n            createViewFromResource(position, convertView, parent, resource) {\n                let view;\n                let text;\n                if (convertView == null) {\n                    view = this.mInflater.inflate(this.mContext.getResources().getLayout(resource), parent, false);\n                }\n                else {\n                    view = convertView;\n                }\n                try {\n                    if (this.mFieldId == null) {\n                        text = view;\n                    }\n                    else {\n                        text = view.findViewById(this.mFieldId);\n                    }\n                }\n                catch (e) {\n                    Log.e(\"ArrayAdapter\", \"You must supply a resource ID for a TextView\");\n                    throw Error(`new IllegalStateException(\"ArrayAdapter requires the resource ID to be a TextView\", e)`);\n                }\n                let item = this.getItem(position);\n                if (typeof item === 'string') {\n                    text.setText(item);\n                }\n                else {\n                    text.setText(item.toString());\n                }\n                return view;\n            }\n            setDropDownViewResource(resource) {\n                this.mDropDownResource = resource;\n            }\n            getDropDownView(position, convertView, parent) {\n                return this.createViewFromResource(position, convertView, parent, this.mDropDownResource);\n            }\n        }\n        widget.ArrayAdapter = ArrayAdapter;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var app;\n    (function (app) {\n        const MATCH_PARENT = android.view.ViewGroup.LayoutParams.MATCH_PARENT;\n        var R = android.R;\n        var DialogInterface = android.content.DialogInterface;\n        var Handler = android.os.Handler;\n        var Message = android.os.Message;\n        var TextUtils = android.text.TextUtils;\n        var Gravity = android.view.Gravity;\n        var View = android.view.View;\n        var LayoutParams = android.view.ViewGroup.LayoutParams;\n        var ArrayAdapter = android.widget.ArrayAdapter;\n        var LinearLayout = android.widget.LinearLayout;\n        var ListView = android.widget.ListView;\n        var WeakReference = java.lang.ref.WeakReference;\n        class AlertController {\n            constructor(context, di, window) {\n                this.mViewSpacingLeft = 0;\n                this.mViewSpacingTop = 0;\n                this.mViewSpacingRight = 0;\n                this.mViewSpacingBottom = 0;\n                this.mViewSpacingSpecified = false;\n                this.mCheckedItem = -1;\n                this.mButtonHandler = (() => {\n                    const inner_this = this;\n                    class _Inner {\n                        onClick(v) {\n                            let m = null;\n                            if (v == inner_this.mButtonPositive && inner_this.mButtonPositiveMessage != null) {\n                                m = Message.obtain(inner_this.mButtonPositiveMessage);\n                            }\n                            else if (v == inner_this.mButtonNegative && inner_this.mButtonNegativeMessage != null) {\n                                m = Message.obtain(inner_this.mButtonNegativeMessage);\n                            }\n                            else if (v == inner_this.mButtonNeutral && inner_this.mButtonNeutralMessage != null) {\n                                m = Message.obtain(inner_this.mButtonNeutralMessage);\n                            }\n                            if (m != null) {\n                                m.sendToTarget();\n                            }\n                            inner_this.mHandler.obtainMessage(AlertController.ButtonHandler.MSG_DISMISS_DIALOG, inner_this.mDialogInterface).sendToTarget();\n                        }\n                    }\n                    return new _Inner();\n                })();\n                this.mContext = context;\n                this.mDialogInterface = di;\n                this.mWindow = window;\n                this.mHandler = new AlertController.ButtonHandler(di);\n                this.mAlertDialogLayout = R.layout.alert_dialog;\n                this.mListLayout = R.layout.select_dialog;\n                this.mMultiChoiceItemLayout = R.layout.select_dialog_multichoice;\n                this.mSingleChoiceItemLayout = R.layout.select_dialog_singlechoice;\n                this.mListItemLayout = R.layout.select_dialog_item;\n            }\n            static shouldCenterSingleButton(context) {\n                return true;\n            }\n            installContent() {\n                let layout = this.mContext.getLayoutInflater().inflate(this.mAlertDialogLayout, this.mWindow.getContentParent(), false);\n                this.mWindow.setContentView(layout);\n                this.setupView();\n            }\n            setTitle(title) {\n                this.mTitle = title;\n                if (this.mTitleView != null) {\n                    this.mTitleView.setText(title);\n                }\n            }\n            setCustomTitle(customTitleView) {\n                this.mCustomTitleView = customTitleView;\n            }\n            setMessage(message) {\n                this.mMessage = message;\n                if (this.mMessageView != null) {\n                    this.mMessageView.setText(message);\n                }\n            }\n            setView(view, viewSpacingLeft = 0, viewSpacingTop = 0, viewSpacingRight = 0, viewSpacingBottom = 0) {\n                this.mView = view;\n                if (!viewSpacingLeft && !viewSpacingTop && !viewSpacingRight && !viewSpacingBottom) {\n                    this.mViewSpacingSpecified = false;\n                }\n                else {\n                    this.mViewSpacingSpecified = true;\n                    this.mViewSpacingLeft = viewSpacingLeft;\n                    this.mViewSpacingTop = viewSpacingTop;\n                    this.mViewSpacingRight = viewSpacingRight;\n                    this.mViewSpacingBottom = viewSpacingBottom;\n                }\n            }\n            setButton(whichButton, text, listener, msg) {\n                if (msg == null && listener != null) {\n                    msg = this.mHandler.obtainMessage(whichButton, listener);\n                }\n                switch (whichButton) {\n                    case DialogInterface.BUTTON_POSITIVE:\n                        this.mButtonPositiveText = text;\n                        this.mButtonPositiveMessage = msg;\n                        break;\n                    case DialogInterface.BUTTON_NEGATIVE:\n                        this.mButtonNegativeText = text;\n                        this.mButtonNegativeMessage = msg;\n                        break;\n                    case DialogInterface.BUTTON_NEUTRAL:\n                        this.mButtonNeutralText = text;\n                        this.mButtonNeutralMessage = msg;\n                        break;\n                    default:\n                        throw Error(`new IllegalArgumentException(\"Button does not exist\")`);\n                }\n            }\n            setIcon(icon) {\n                this.mIcon = icon;\n                if ((this.mIconView != null) && (this.mIcon != null)) {\n                    this.mIconView.setImageDrawable(icon);\n                }\n            }\n            setInverseBackgroundForced(forceInverseBackground) {\n                this.mForceInverseBackground = forceInverseBackground;\n            }\n            getListView() {\n                return this.mListView;\n            }\n            getButton(whichButton) {\n                switch (whichButton) {\n                    case DialogInterface.BUTTON_POSITIVE:\n                        return this.mButtonPositive;\n                    case DialogInterface.BUTTON_NEGATIVE:\n                        return this.mButtonNegative;\n                    case DialogInterface.BUTTON_NEUTRAL:\n                        return this.mButtonNeutral;\n                    default:\n                        return null;\n                }\n            }\n            onKeyDown(keyCode, event) {\n                return this.mScrollView != null && this.mScrollView.executeKeyEvent(event);\n            }\n            onKeyUp(keyCode, event) {\n                return this.mScrollView != null && this.mScrollView.executeKeyEvent(event);\n            }\n            setupView() {\n                let contentPanel = this.mWindow.findViewById(R.id.contentPanel);\n                this.setupContent(contentPanel);\n                let hasButtons = this.setupButtons();\n                let topPanel = this.mWindow.findViewById(R.id.topPanel);\n                let hasTitle = this.setupTitle(topPanel);\n                let buttonPanel = this.mWindow.findViewById(R.id.buttonPanel);\n                if (!hasButtons) {\n                    buttonPanel.setVisibility(View.GONE);\n                    this.mWindow.setCloseOnTouchOutsideIfNotSet(true);\n                }\n                let customPanel = null;\n                if (this.mView != null) {\n                    customPanel = this.mWindow.findViewById(R.id.customPanel);\n                    let custom = this.mWindow.findViewById(R.id.custom);\n                    custom.addView(this.mView, new LayoutParams(MATCH_PARENT, MATCH_PARENT));\n                    if (this.mViewSpacingSpecified) {\n                        custom.setPadding(this.mViewSpacingLeft, this.mViewSpacingTop, this.mViewSpacingRight, this.mViewSpacingBottom);\n                    }\n                    if (this.mListView != null) {\n                        customPanel.getLayoutParams().weight = 0;\n                    }\n                }\n                else {\n                    this.mWindow.findViewById(R.id.customPanel).setVisibility(View.GONE);\n                }\n                if (hasTitle) {\n                    let divider = null;\n                    if (this.mMessage != null || this.mView != null || this.mListView != null) {\n                        divider = this.mWindow.findViewById(R.id.titleDivider);\n                    }\n                    else {\n                        divider = this.mWindow.findViewById(R.id.titleDividerTop);\n                    }\n                    if (divider != null) {\n                        divider.setVisibility(View.VISIBLE);\n                    }\n                }\n                this.setBackground(topPanel, contentPanel, customPanel, hasButtons, hasTitle, buttonPanel);\n            }\n            setupTitle(topPanel) {\n                let hasTitle = true;\n                if (this.mCustomTitleView != null) {\n                    let lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);\n                    topPanel.addView(this.mCustomTitleView, 0, lp);\n                    let titleTemplate = this.mWindow.findViewById(R.id.title_template);\n                    titleTemplate.setVisibility(View.GONE);\n                }\n                else {\n                    const hasTextTitle = !TextUtils.isEmpty(this.mTitle);\n                    this.mIconView = this.mWindow.findViewById(R.id.icon);\n                    if (hasTextTitle) {\n                        this.mTitleView = this.mWindow.findViewById(R.id.alertTitle);\n                        this.mTitleView.setText(this.mTitle);\n                        if (this.mIcon != null) {\n                            this.mIconView.setImageDrawable(this.mIcon);\n                        }\n                        else {\n                            this.mTitleView.setPadding(this.mIconView.getPaddingLeft(), this.mIconView.getPaddingTop(), this.mIconView.getPaddingRight(), this.mIconView.getPaddingBottom());\n                            this.mIconView.setVisibility(View.GONE);\n                        }\n                    }\n                    else {\n                        let titleTemplate = this.mWindow.findViewById(R.id.title_template);\n                        titleTemplate.setVisibility(View.GONE);\n                        this.mIconView.setVisibility(View.GONE);\n                        topPanel.setVisibility(View.GONE);\n                        hasTitle = false;\n                    }\n                }\n                return hasTitle;\n            }\n            setupContent(contentPanel) {\n                this.mScrollView = this.mWindow.findViewById(R.id.scrollView);\n                this.mScrollView.setFocusable(false);\n                this.mMessageView = this.mWindow.findViewById(R.id.message);\n                if (this.mMessageView == null) {\n                    return;\n                }\n                if (this.mMessage != null) {\n                    this.mMessageView.setText(this.mMessage);\n                }\n                else {\n                    this.mMessageView.setVisibility(View.GONE);\n                    this.mScrollView.removeView(this.mMessageView);\n                    if (this.mListView != null) {\n                        contentPanel.removeView(this.mWindow.findViewById(R.id.scrollView));\n                        contentPanel.addView(this.mListView, new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));\n                        contentPanel.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, 0, 1.0));\n                    }\n                    else {\n                        contentPanel.setVisibility(View.GONE);\n                    }\n                }\n            }\n            setupButtons() {\n                let BIT_BUTTON_POSITIVE = 1;\n                let BIT_BUTTON_NEGATIVE = 2;\n                let BIT_BUTTON_NEUTRAL = 4;\n                let whichButtons = 0;\n                this.mButtonPositive = this.mWindow.findViewById(R.id.button1);\n                this.mButtonPositive.setOnClickListener(this.mButtonHandler);\n                if (TextUtils.isEmpty(this.mButtonPositiveText)) {\n                    this.mButtonPositive.setVisibility(View.GONE);\n                }\n                else {\n                    this.mButtonPositive.setText(this.mButtonPositiveText);\n                    this.mButtonPositive.setVisibility(View.VISIBLE);\n                    whichButtons = whichButtons | BIT_BUTTON_POSITIVE;\n                }\n                this.mButtonNegative = this.mWindow.findViewById(R.id.button2);\n                this.mButtonNegative.setOnClickListener(this.mButtonHandler);\n                if (TextUtils.isEmpty(this.mButtonNegativeText)) {\n                    this.mButtonNegative.setVisibility(View.GONE);\n                }\n                else {\n                    this.mButtonNegative.setText(this.mButtonNegativeText);\n                    this.mButtonNegative.setVisibility(View.VISIBLE);\n                    whichButtons = whichButtons | BIT_BUTTON_NEGATIVE;\n                }\n                this.mButtonNeutral = this.mWindow.findViewById(R.id.button3);\n                this.mButtonNeutral.setOnClickListener(this.mButtonHandler);\n                if (TextUtils.isEmpty(this.mButtonNeutralText)) {\n                    this.mButtonNeutral.setVisibility(View.GONE);\n                }\n                else {\n                    this.mButtonNeutral.setText(this.mButtonNeutralText);\n                    this.mButtonNeutral.setVisibility(View.VISIBLE);\n                    whichButtons = whichButtons | BIT_BUTTON_NEUTRAL;\n                }\n                if (AlertController.shouldCenterSingleButton(this.mContext)) {\n                    if (whichButtons == BIT_BUTTON_POSITIVE) {\n                        this.centerButton(this.mButtonPositive);\n                    }\n                    else if (whichButtons == BIT_BUTTON_NEGATIVE) {\n                        this.centerButton(this.mButtonNegative);\n                    }\n                    else if (whichButtons == BIT_BUTTON_NEUTRAL) {\n                        this.centerButton(this.mButtonNeutral);\n                    }\n                }\n                return whichButtons != 0;\n            }\n            centerButton(button) {\n                let params = button.getLayoutParams();\n                params.gravity = Gravity.CENTER_HORIZONTAL;\n                params.weight = 0.5;\n                button.setLayoutParams(params);\n                let leftSpacer = this.mWindow.findViewById(R.id.leftSpacer);\n                if (leftSpacer != null) {\n                    leftSpacer.setVisibility(View.VISIBLE);\n                }\n                let rightSpacer = this.mWindow.findViewById(R.id.rightSpacer);\n                if (rightSpacer != null) {\n                    rightSpacer.setVisibility(View.VISIBLE);\n                }\n            }\n            setBackground(topPanel, contentPanel, customPanel, hasButtons, hasTitle, buttonPanel) {\n                let fullDark = R.image.popup_full_bright;\n                let topDark = R.image.popup_top_bright;\n                let centerDark = R.image.popup_center_bright;\n                let bottomDark = R.image.popup_bottom_bright;\n                let fullBright = R.image.popup_full_bright;\n                let topBright = R.image.popup_top_bright;\n                let centerBright = R.image.popup_center_bright;\n                let bottomBright = R.image.popup_bottom_bright;\n                let bottomMedium = R.image.popup_bottom_bright;\n                let views = new Array(4);\n                let light = new Array(4);\n                let lastView = null;\n                let lastLight = false;\n                let pos = 0;\n                if (hasTitle) {\n                    views[pos] = topPanel;\n                    light[pos] = false;\n                    pos++;\n                }\n                views[pos] = (contentPanel.getVisibility() == View.GONE) ? null : contentPanel;\n                light[pos] = this.mListView != null;\n                pos++;\n                if (customPanel != null) {\n                    views[pos] = customPanel;\n                    light[pos] = this.mForceInverseBackground;\n                    pos++;\n                }\n                if (hasButtons) {\n                    views[pos] = buttonPanel;\n                    light[pos] = true;\n                }\n                let setView = false;\n                for (pos = 0; pos < views.length; pos++) {\n                    let v = views[pos];\n                    if (v == null) {\n                        continue;\n                    }\n                    if (lastView != null) {\n                        if (!setView) {\n                            lastView.setBackground(lastLight ? topBright : topDark);\n                        }\n                        else {\n                            lastView.setBackground(lastLight ? centerBright : centerDark);\n                        }\n                        setView = true;\n                    }\n                    lastView = v;\n                    lastLight = light[pos];\n                }\n                if (lastView != null) {\n                    if (setView) {\n                        lastView.setBackground(lastLight ? (hasButtons ? bottomMedium : bottomBright) : bottomDark);\n                    }\n                    else {\n                        lastView.setBackground(lastLight ? fullBright : fullDark);\n                    }\n                }\n                if ((this.mListView != null) && (this.mAdapter != null)) {\n                    this.mListView.setAdapter(this.mAdapter);\n                    if (this.mCheckedItem > -1) {\n                        this.mListView.setItemChecked(this.mCheckedItem, true);\n                        this.mListView.setSelection(this.mCheckedItem);\n                    }\n                }\n            }\n        }\n        app.AlertController = AlertController;\n        (function (AlertController) {\n            class ButtonHandler extends Handler {\n                constructor(dialog) {\n                    super();\n                    this.mDialog = new WeakReference(dialog);\n                }\n                handleMessage(msg) {\n                    switch (msg.what) {\n                        case DialogInterface.BUTTON_POSITIVE:\n                        case DialogInterface.BUTTON_NEGATIVE:\n                        case DialogInterface.BUTTON_NEUTRAL:\n                            msg.obj.onClick(this.mDialog.get(), msg.what);\n                            break;\n                        case ButtonHandler.MSG_DISMISS_DIALOG:\n                            msg.obj.dismiss();\n                    }\n                }\n            }\n            ButtonHandler.MSG_DISMISS_DIALOG = 1;\n            AlertController.ButtonHandler = ButtonHandler;\n            class RecycleListView extends ListView {\n                constructor(context, bindElement, defStyle) {\n                    super(context, bindElement, defStyle);\n                    this.mRecycleOnMeasure = true;\n                }\n                recycleOnMeasure() {\n                    return this.mRecycleOnMeasure;\n                }\n            }\n            AlertController.RecycleListView = RecycleListView;\n            class AlertParams {\n                constructor(context) {\n                    this.mIconId = 0;\n                    this.mViewSpacingLeft = 0;\n                    this.mViewSpacingTop = 0;\n                    this.mViewSpacingRight = 0;\n                    this.mViewSpacingBottom = 0;\n                    this.mViewSpacingSpecified = false;\n                    this.mCheckedItem = -1;\n                    this.mRecycleOnMeasure = true;\n                    this.mContext = context;\n                    this.mCancelable = true;\n                    this.mInflater = context.getLayoutInflater();\n                }\n                apply(dialog) {\n                    if (this.mCustomTitleView != null) {\n                        dialog.setCustomTitle(this.mCustomTitleView);\n                    }\n                    else {\n                        if (this.mTitle != null) {\n                            dialog.setTitle(this.mTitle);\n                        }\n                        if (this.mIcon != null) {\n                            dialog.setIcon(this.mIcon);\n                        }\n                    }\n                    if (this.mMessage != null) {\n                        dialog.setMessage(this.mMessage);\n                    }\n                    if (this.mPositiveButtonText != null) {\n                        dialog.setButton(DialogInterface.BUTTON_POSITIVE, this.mPositiveButtonText, this.mPositiveButtonListener, null);\n                    }\n                    if (this.mNegativeButtonText != null) {\n                        dialog.setButton(DialogInterface.BUTTON_NEGATIVE, this.mNegativeButtonText, this.mNegativeButtonListener, null);\n                    }\n                    if (this.mNeutralButtonText != null) {\n                        dialog.setButton(DialogInterface.BUTTON_NEUTRAL, this.mNeutralButtonText, this.mNeutralButtonListener, null);\n                    }\n                    if (this.mForceInverseBackground) {\n                        dialog.setInverseBackgroundForced(true);\n                    }\n                    if ((this.mItems != null) || (this.mAdapter != null)) {\n                        this.createListView(dialog);\n                    }\n                    if (this.mView != null) {\n                        if (this.mViewSpacingSpecified) {\n                            dialog.setView(this.mView, this.mViewSpacingLeft, this.mViewSpacingTop, this.mViewSpacingRight, this.mViewSpacingBottom);\n                        }\n                        else {\n                            dialog.setView(this.mView);\n                        }\n                    }\n                }\n                createListView(dialog) {\n                    const listView = this.mInflater.inflate(dialog.mListLayout, null);\n                    let adapter;\n                    if (this.mIsMultiChoice) {\n                        adapter = (() => {\n                            const inner_this = this;\n                            class _Inner extends ArrayAdapter {\n                                getView(position, convertView, parent) {\n                                    let view = super.getView(position, convertView, parent);\n                                    if (inner_this.mCheckedItems != null) {\n                                        let isItemChecked = inner_this.mCheckedItems[position];\n                                        if (isItemChecked) {\n                                            listView.setItemChecked(position, true);\n                                        }\n                                    }\n                                    return view;\n                                }\n                            }\n                            return new _Inner(this.mContext, dialog.mMultiChoiceItemLayout, R.id.text1, this.mItems);\n                        })();\n                    }\n                    else {\n                        let layout = this.mIsSingleChoice ? dialog.mSingleChoiceItemLayout : dialog.mListItemLayout;\n                        adapter = (this.mAdapter != null) ? this.mAdapter : new ArrayAdapter(this.mContext, layout, R.id.text1, this.mItems);\n                    }\n                    if (this.mOnPrepareListViewListener != null) {\n                        this.mOnPrepareListViewListener.onPrepareListView(listView);\n                    }\n                    dialog.mAdapter = adapter;\n                    dialog.mCheckedItem = this.mCheckedItem;\n                    const inner_this = this;\n                    if (this.mOnClickListener != null) {\n                        listView.setOnItemClickListener({\n                            onItemClick(parent, v, position, id) {\n                                inner_this.mOnClickListener.onClick(dialog.mDialogInterface, position);\n                                if (!inner_this.mIsSingleChoice) {\n                                    dialog.mDialogInterface.dismiss();\n                                }\n                            }\n                        });\n                    }\n                    else if (this.mOnCheckboxClickListener != null) {\n                        listView.setOnItemClickListener({\n                            onItemClick(parent, v, position, id) {\n                                if (inner_this.mCheckedItems != null) {\n                                    inner_this.mCheckedItems[position] = listView.isItemChecked(position);\n                                }\n                                inner_this.mOnCheckboxClickListener.onClick(dialog.mDialogInterface, position, listView.isItemChecked(position));\n                            }\n                        });\n                    }\n                    if (this.mOnItemSelectedListener != null) {\n                        listView.setOnItemSelectedListener(this.mOnItemSelectedListener);\n                    }\n                    if (this.mIsSingleChoice) {\n                        listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);\n                    }\n                    else if (this.mIsMultiChoice) {\n                        listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);\n                    }\n                    listView.mRecycleOnMeasure = this.mRecycleOnMeasure;\n                    dialog.mListView = listView;\n                }\n            }\n            AlertController.AlertParams = AlertParams;\n        })(AlertController = app.AlertController || (app.AlertController = {}));\n    })(app = android.app || (android.app = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var app;\n    (function (app) {\n        var Dialog = android.app.Dialog;\n        class AlertDialog extends Dialog {\n            constructor(context, cancelable, cancelListener) {\n                super(context);\n                this.setCancelable(cancelable);\n                this.setOnCancelListener(cancelListener);\n                this.mAlert = new app.AlertController(context, this, this.getWindow());\n            }\n            getButton(whichButton) {\n                return this.mAlert.getButton(whichButton);\n            }\n            getListView() {\n                return this.mAlert.getListView();\n            }\n            setTitle(title) {\n                super.setTitle(title);\n                this.mAlert.setTitle(title);\n            }\n            setCustomTitle(customTitleView) {\n                this.mAlert.setCustomTitle(customTitleView);\n            }\n            setMessage(message) {\n                this.mAlert.setMessage(message);\n            }\n            setView(view, viewSpacingLeft = 0, viewSpacingTop = 0, viewSpacingRight = 0, viewSpacingBottom = 0) {\n                this.mAlert.setView(view, viewSpacingLeft, viewSpacingTop, viewSpacingRight, viewSpacingBottom);\n            }\n            setButton(whichButton, text, listener) {\n                this.mAlert.setButton(whichButton, text, listener, null);\n            }\n            setIcon(icon) {\n                this.mAlert.setIcon(icon);\n            }\n            onCreate(savedInstanceState) {\n                super.onCreate(savedInstanceState);\n                this.mAlert.installContent();\n            }\n            onKeyDown(keyCode, event) {\n                if (this.mAlert.onKeyDown(keyCode, event))\n                    return true;\n                return super.onKeyDown(keyCode, event);\n            }\n            onKeyUp(keyCode, event) {\n                if (this.mAlert.onKeyUp(keyCode, event))\n                    return true;\n                return super.onKeyUp(keyCode, event);\n            }\n        }\n        AlertDialog.THEME_TRADITIONAL = 1;\n        AlertDialog.THEME_HOLO_DARK = 2;\n        AlertDialog.THEME_HOLO_LIGHT = 3;\n        AlertDialog.THEME_DEVICE_DEFAULT_DARK = 4;\n        AlertDialog.THEME_DEVICE_DEFAULT_LIGHT = 5;\n        app.AlertDialog = AlertDialog;\n        (function (AlertDialog) {\n            class Builder {\n                constructor(context) {\n                    this.P = new app.AlertController.AlertParams(context);\n                }\n                getContext() {\n                    return this.P.mContext;\n                }\n                setTitle(title) {\n                    this.P.mTitle = title;\n                    return this;\n                }\n                setCustomTitle(customTitleView) {\n                    this.P.mCustomTitleView = customTitleView;\n                    return this;\n                }\n                setMessage(message) {\n                    this.P.mMessage = message;\n                    return this;\n                }\n                setIcon(icon) {\n                    this.P.mIcon = icon;\n                    return this;\n                }\n                setPositiveButton(text, listener) {\n                    this.P.mPositiveButtonText = text;\n                    this.P.mPositiveButtonListener = listener;\n                    return this;\n                }\n                setNegativeButton(text, listener) {\n                    this.P.mNegativeButtonText = text;\n                    this.P.mNegativeButtonListener = listener;\n                    return this;\n                }\n                setNeutralButton(text, listener) {\n                    this.P.mNeutralButtonText = text;\n                    this.P.mNeutralButtonListener = listener;\n                    return this;\n                }\n                setCancelable(cancelable) {\n                    this.P.mCancelable = cancelable;\n                    return this;\n                }\n                setOnCancelListener(onCancelListener) {\n                    this.P.mOnCancelListener = onCancelListener;\n                    return this;\n                }\n                setOnDismissListener(onDismissListener) {\n                    this.P.mOnDismissListener = onDismissListener;\n                    return this;\n                }\n                setOnKeyListener(onKeyListener) {\n                    this.P.mOnKeyListener = onKeyListener;\n                    return this;\n                }\n                setItems(items, listener) {\n                    this.P.mItems = items;\n                    this.P.mOnClickListener = listener;\n                    return this;\n                }\n                setAdapter(adapter, listener) {\n                    this.P.mAdapter = adapter;\n                    this.P.mOnClickListener = listener;\n                    return this;\n                }\n                setMultiChoiceItems(items, checkedItems, listener) {\n                    this.P.mItems = items;\n                    this.P.mOnCheckboxClickListener = listener;\n                    this.P.mCheckedItems = checkedItems;\n                    this.P.mIsMultiChoice = true;\n                    return this;\n                }\n                setSingleChoiceItems(items, checkedItem, listener) {\n                    this.P.mItems = items;\n                    this.P.mOnClickListener = listener;\n                    this.P.mCheckedItem = checkedItem;\n                    this.P.mIsSingleChoice = true;\n                    return this;\n                }\n                setSingleChoiceItemsWithAdapter(adapter, checkedItem, listener) {\n                    this.P.mAdapter = adapter;\n                    this.P.mOnClickListener = listener;\n                    this.P.mCheckedItem = checkedItem;\n                    this.P.mIsSingleChoice = true;\n                    return this;\n                }\n                setOnItemSelectedListener(listener) {\n                    this.P.mOnItemSelectedListener = listener;\n                    return this;\n                }\n                setView(view, viewSpacingLeft = 0, viewSpacingTop = 0, viewSpacingRight = 0, viewSpacingBottom = 0) {\n                    this.P.mView = view;\n                    if (!viewSpacingLeft && !viewSpacingTop && !viewSpacingRight && !viewSpacingBottom) {\n                        this.P.mViewSpacingSpecified = false;\n                    }\n                    else {\n                        this.P.mViewSpacingSpecified = true;\n                        this.P.mViewSpacingLeft = viewSpacingLeft;\n                        this.P.mViewSpacingTop = viewSpacingTop;\n                        this.P.mViewSpacingRight = viewSpacingRight;\n                        this.P.mViewSpacingBottom = viewSpacingBottom;\n                    }\n                    return this;\n                }\n                setInverseBackgroundForced(useInverseBackground) {\n                    this.P.mForceInverseBackground = useInverseBackground;\n                    return this;\n                }\n                setRecycleOnMeasureEnabled(enabled) {\n                    this.P.mRecycleOnMeasure = enabled;\n                    return this;\n                }\n                create() {\n                    const dialog = new AlertDialog(this.P.mContext);\n                    this.P.apply(dialog.mAlert);\n                    dialog.setCancelable(this.P.mCancelable);\n                    if (this.P.mCancelable) {\n                        dialog.setCanceledOnTouchOutside(true);\n                    }\n                    dialog.setOnCancelListener(this.P.mOnCancelListener);\n                    dialog.setOnDismissListener(this.P.mOnDismissListener);\n                    if (this.P.mOnKeyListener != null) {\n                        dialog.setOnKeyListener(this.P.mOnKeyListener);\n                    }\n                    return dialog;\n                }\n                show() {\n                    let dialog = this.create();\n                    dialog.show();\n                    return dialog;\n                }\n            }\n            AlertDialog.Builder = Builder;\n        })(AlertDialog = app.AlertDialog || (app.AlertDialog = {}));\n    })(app = android.app || (android.app = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var Rect = android.graphics.Rect;\n        var SparseArray = android.util.SparseArray;\n        var View = android.view.View;\n        var ViewGroup = android.view.ViewGroup;\n        var AdapterView = android.widget.AdapterView;\n        var ArrayAdapter = android.widget.ArrayAdapter;\n        class AbsSpinner extends AdapterView {\n            constructor(context, bindElement, defStyle) {\n                super(context, bindElement, defStyle);\n                this.mHeightMeasureSpec = 0;\n                this.mWidthMeasureSpec = 0;\n                this.mSelectionLeftPadding = 0;\n                this.mSelectionTopPadding = 0;\n                this.mSelectionRightPadding = 0;\n                this.mSelectionBottomPadding = 0;\n                this.mSpinnerPadding = new Rect();\n                this.mRecycler = new AbsSpinner.RecycleBin(this);\n                this.initAbsSpinner();\n                const a = context.obtainStyledAttributes(bindElement, defStyle);\n                const entries = a.getTextArray('entries');\n                if (entries != null) {\n                    const adapter = new ArrayAdapter(context, android.R.layout.simple_spinner_item, entries);\n                    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n                    this.setAdapter(adapter);\n                }\n                a.recycle();\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('entries', {\n                    setter(v, value, attrBinder) {\n                        let entries = attrBinder.parseStringArray(value);\n                        if (entries != null) {\n                            let adapter = new ArrayAdapter(v.getContext(), android.R.layout.simple_spinner_item, entries);\n                            adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n                            v.setAdapter(adapter);\n                        }\n                    }\n                });\n            }\n            initAbsSpinner() {\n                this.setFocusable(true);\n                this.setWillNotDraw(false);\n            }\n            setAdapter(adapter) {\n                if (null != this.mAdapter) {\n                    this.mAdapter.unregisterDataSetObserver(this.mDataSetObserver);\n                    this.resetList();\n                }\n                this.mAdapter = adapter;\n                this.mOldSelectedPosition = AbsSpinner.INVALID_POSITION;\n                this.mOldSelectedRowId = AbsSpinner.INVALID_ROW_ID;\n                if (this.mAdapter != null) {\n                    this.mOldItemCount = this.mItemCount;\n                    this.mItemCount = this.mAdapter.getCount();\n                    this.checkFocus();\n                    this.mDataSetObserver = new AdapterView.AdapterDataSetObserver(this);\n                    this.mAdapter.registerDataSetObserver(this.mDataSetObserver);\n                    let position = this.mItemCount > 0 ? 0 : AbsSpinner.INVALID_POSITION;\n                    this.setSelectedPositionInt(position);\n                    this.setNextSelectedPositionInt(position);\n                    if (this.mItemCount == 0) {\n                        this.checkSelectionChanged();\n                    }\n                }\n                else {\n                    this.checkFocus();\n                    this.resetList();\n                    this.checkSelectionChanged();\n                }\n                this.requestLayout();\n            }\n            resetList() {\n                this.mDataChanged = false;\n                this.mNeedSync = false;\n                this.removeAllViewsInLayout();\n                this.mOldSelectedPosition = AbsSpinner.INVALID_POSITION;\n                this.mOldSelectedRowId = AbsSpinner.INVALID_ROW_ID;\n                this.setSelectedPositionInt(AbsSpinner.INVALID_POSITION);\n                this.setNextSelectedPositionInt(AbsSpinner.INVALID_POSITION);\n                this.invalidate();\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                let widthMode = View.MeasureSpec.getMode(widthMeasureSpec);\n                let widthSize;\n                let heightSize;\n                this.mSpinnerPadding.left = this.mPaddingLeft > this.mSelectionLeftPadding ? this.mPaddingLeft : this.mSelectionLeftPadding;\n                this.mSpinnerPadding.top = this.mPaddingTop > this.mSelectionTopPadding ? this.mPaddingTop : this.mSelectionTopPadding;\n                this.mSpinnerPadding.right = this.mPaddingRight > this.mSelectionRightPadding ? this.mPaddingRight : this.mSelectionRightPadding;\n                this.mSpinnerPadding.bottom = this.mPaddingBottom > this.mSelectionBottomPadding ? this.mPaddingBottom : this.mSelectionBottomPadding;\n                if (this.mDataChanged) {\n                    this.handleDataChanged();\n                }\n                let preferredHeight = 0;\n                let preferredWidth = 0;\n                let needsMeasuring = true;\n                let selectedPosition = this.getSelectedItemPosition();\n                if (selectedPosition >= 0 && this.mAdapter != null && selectedPosition < this.mAdapter.getCount()) {\n                    let view = this.mRecycler.get(selectedPosition);\n                    if (view == null) {\n                        view = this.mAdapter.getView(selectedPosition, null, this);\n                    }\n                    if (view != null) {\n                        this.mRecycler.put(selectedPosition, view);\n                        if (view.getLayoutParams() == null) {\n                            this.mBlockLayoutRequests = true;\n                            view.setLayoutParams(this.generateDefaultLayoutParams());\n                            this.mBlockLayoutRequests = false;\n                        }\n                        this.measureChild(view, widthMeasureSpec, heightMeasureSpec);\n                        preferredHeight = this.getChildHeight(view) + this.mSpinnerPadding.top + this.mSpinnerPadding.bottom;\n                        preferredWidth = this.getChildWidth(view) + this.mSpinnerPadding.left + this.mSpinnerPadding.right;\n                        needsMeasuring = false;\n                    }\n                }\n                if (needsMeasuring) {\n                    preferredHeight = this.mSpinnerPadding.top + this.mSpinnerPadding.bottom;\n                    if (widthMode == View.MeasureSpec.UNSPECIFIED) {\n                        preferredWidth = this.mSpinnerPadding.left + this.mSpinnerPadding.right;\n                    }\n                }\n                preferredHeight = Math.max(preferredHeight, this.getSuggestedMinimumHeight());\n                preferredWidth = Math.max(preferredWidth, this.getSuggestedMinimumWidth());\n                heightSize = AbsSpinner.resolveSizeAndState(preferredHeight, heightMeasureSpec, 0);\n                widthSize = AbsSpinner.resolveSizeAndState(preferredWidth, widthMeasureSpec, 0);\n                this.setMeasuredDimension(widthSize, heightSize);\n                this.mHeightMeasureSpec = heightMeasureSpec;\n                this.mWidthMeasureSpec = widthMeasureSpec;\n            }\n            getChildHeight(child) {\n                return child.getMeasuredHeight();\n            }\n            getChildWidth(child) {\n                return child.getMeasuredWidth();\n            }\n            generateDefaultLayoutParams() {\n                return new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);\n            }\n            recycleAllViews() {\n                const childCount = this.getChildCount();\n                const recycleBin = this.mRecycler;\n                const position = this.mFirstPosition;\n                for (let i = 0; i < childCount; i++) {\n                    let v = this.getChildAt(i);\n                    let index = position + i;\n                    recycleBin.put(index, v);\n                }\n            }\n            setSelection(position, animate) {\n                if (arguments.length === 1) {\n                    this.setNextSelectedPositionInt(position);\n                    this.requestLayout();\n                    this.invalidate();\n                }\n                else {\n                    let shouldAnimate = animate && this.mFirstPosition <= position && position <= this.mFirstPosition + this.getChildCount() - 1;\n                    this.setSelectionInt(position, shouldAnimate);\n                }\n            }\n            setSelectionInt(position, animate) {\n                if (position != this.mOldSelectedPosition) {\n                    this.mBlockLayoutRequests = true;\n                    let delta = position - this.mSelectedPosition;\n                    this.setNextSelectedPositionInt(position);\n                    this.layoutSpinner(delta, animate);\n                    this.mBlockLayoutRequests = false;\n                }\n            }\n            getSelectedView() {\n                if (this.mItemCount > 0 && this.mSelectedPosition >= 0) {\n                    return this.getChildAt(this.mSelectedPosition - this.mFirstPosition);\n                }\n                else {\n                    return null;\n                }\n            }\n            requestLayout() {\n                if (!this.mBlockLayoutRequests) {\n                    super.requestLayout();\n                }\n            }\n            getAdapter() {\n                return this.mAdapter;\n            }\n            getCount() {\n                return this.mItemCount;\n            }\n            pointToPosition(x, y) {\n                let frame = this.mTouchFrame;\n                if (frame == null) {\n                    this.mTouchFrame = new Rect();\n                    frame = this.mTouchFrame;\n                }\n                const count = this.getChildCount();\n                for (let i = count - 1; i >= 0; i--) {\n                    let child = this.getChildAt(i);\n                    if (child.getVisibility() == View.VISIBLE) {\n                        child.getHitRect(frame);\n                        if (frame.contains(x, y)) {\n                            return this.mFirstPosition + i;\n                        }\n                    }\n                }\n                return AbsSpinner.INVALID_POSITION;\n            }\n        }\n        widget.AbsSpinner = AbsSpinner;\n        (function (AbsSpinner) {\n            class RecycleBin {\n                constructor(arg) {\n                    this.mScrapHeap = new SparseArray();\n                    this._AbsSpinner_this = arg;\n                }\n                put(position, v) {\n                    this.mScrapHeap.put(position, v);\n                }\n                get(position) {\n                    let result = this.mScrapHeap.get(position);\n                    if (result != null) {\n                        this.mScrapHeap.delete(position);\n                    }\n                    else {\n                    }\n                    return result;\n                }\n                clear() {\n                    const scrapHeap = this.mScrapHeap;\n                    const count = scrapHeap.size();\n                    for (let i = 0; i < count; i++) {\n                        const view = scrapHeap.valueAt(i);\n                        if (view != null) {\n                            this._AbsSpinner_this.removeDetachedView(view, true);\n                        }\n                    }\n                    scrapHeap.clear();\n                }\n            }\n            AbsSpinner.RecycleBin = RecycleBin;\n        })(AbsSpinner = widget.AbsSpinner || (widget.AbsSpinner = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var R = android.R;\n        var Context = android.content.Context;\n        var Rect = android.graphics.Rect;\n        var Gravity = android.view.Gravity;\n        var KeyEvent = android.view.KeyEvent;\n        var MotionEvent = android.view.MotionEvent;\n        var View = android.view.View;\n        var ViewGroup = android.view.ViewGroup;\n        var WindowManager = android.view.WindowManager;\n        var Window = android.view.Window;\n        var WeakReference = java.lang.ref.WeakReference;\n        var AnimationUtils = android.view.animation.AnimationUtils;\n        class PopupWindow {\n            constructor(...args) {\n                this.mInputMethodMode = PopupWindow.INPUT_METHOD_FROM_FOCUSABLE;\n                this.mTouchable = true;\n                this.mOutsideTouchable = false;\n                this.mSplitTouchEnabled = -1;\n                this.mAllowScrollingAnchorParent = true;\n                this.mDrawingLocation = [0, 0];\n                this.mScreenLocation = [0, 0];\n                this.mTempRect = new Rect();\n                this.mWindowLayoutType = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;\n                this.mDefaultDropdownAboveEnterAnimation = R.anim.grow_fade_in_from_bottom;\n                this.mDefaultDropdownBelowEnterAnimation = R.anim.grow_fade_in;\n                this.mDefaultDropdownAboveExitAnimation = R.anim.shrink_fade_out_from_bottom;\n                this.mDefaultDropdownBelowExitAnimation = R.anim.shrink_fade_out;\n                this.mOnScrollChangedListener = (() => {\n                    const inner_this = this;\n                    class _Inner {\n                        onScrollChanged() {\n                            let anchor = inner_this.mAnchor != null ? inner_this.mAnchor.get() : null;\n                            if (anchor != null && inner_this.mPopupView != null) {\n                                let p = inner_this.mPopupView.getLayoutParams();\n                                inner_this.updateAboveAnchor(inner_this.findDropDownPosition(anchor, p, inner_this.mAnchorXoff, inner_this.mAnchorYoff, inner_this.mAnchoredGravity));\n                                inner_this.update(p.x, p.y, -1, -1, true);\n                            }\n                        }\n                    }\n                    return new _Inner();\n                })();\n                if (args[0] instanceof Context) {\n                    let context = args[0];\n                    let styleAttr = args.length == 1 ? R.attr.popupWindowStyle : args[1];\n                    this.mContext = context;\n                    this.mWindowManager = context.getWindowManager();\n                    this.mPopupWindow = new Window(context);\n                    this.mPopupWindow.setCallback(this);\n                    let a = context.obtainStyledAttributes(null, styleAttr);\n                    this.mBackground = a.getDrawable('popupBackground');\n                    this.mEnterAnimation = AnimationUtils.loadAnimation(context, a.getAttrValue('popupEnterAnimation'));\n                    this.mExitAnimation = AnimationUtils.loadAnimation(context, a.getAttrValue('popupExitAnimation'));\n                }\n                else {\n                    let [contentView = null, width = 0, height = 0, focusable = false] = args;\n                    if (contentView != null) {\n                        this.mContext = contentView.getContext();\n                        this.mWindowManager = this.mContext.getWindowManager();\n                        this.mPopupWindow = new Window(this.mContext);\n                        this.mPopupWindow.setCallback(this);\n                    }\n                    this.setContentView(contentView);\n                    this.setWidth(width);\n                    this.setHeight(height);\n                    this.setFocusable(focusable);\n                }\n            }\n            getBackground() {\n                return this.mBackground;\n            }\n            setBackgroundDrawable(background) {\n                this.mBackground = background;\n            }\n            getEnterAnimation() {\n                return this.mEnterAnimation;\n            }\n            getExitAnimation() {\n                return this.mExitAnimation;\n            }\n            setWindowAnimation(enterAnimation, exitAnimation) {\n                this.mEnterAnimation = enterAnimation;\n                this.mExitAnimation = exitAnimation;\n            }\n            getContentView() {\n                return this.mContentView;\n            }\n            setContentView(contentView) {\n                if (this.isShowing()) {\n                    return;\n                }\n                this.mContentView = contentView;\n                if (this.mContext == null && this.mContentView != null) {\n                    this.mContext = this.mContentView.getContext();\n                }\n                if (this.mWindowManager == null && this.mContentView != null) {\n                    this.mWindowManager = this.mContext.getWindowManager();\n                }\n                if (this.mPopupWindow == null && this.mContext != null) {\n                    this.mPopupWindow = new Window(this.mContext);\n                    this.mPopupWindow.setCallback(this);\n                }\n            }\n            setTouchInterceptor(l) {\n                this.mTouchInterceptor = l;\n            }\n            isFocusable() {\n                return this.mFocusable;\n            }\n            setFocusable(focusable) {\n                this.mFocusable = focusable;\n            }\n            getInputMethodMode() {\n                return this.mInputMethodMode;\n            }\n            setInputMethodMode(mode) {\n                this.mInputMethodMode = mode;\n            }\n            isTouchable() {\n                return this.mTouchable;\n            }\n            setTouchable(touchable) {\n                this.mTouchable = touchable;\n            }\n            isOutsideTouchable() {\n                return this.mOutsideTouchable;\n            }\n            setOutsideTouchable(touchable) {\n                this.mOutsideTouchable = touchable;\n            }\n            setClipToScreenEnabled(enabled) {\n                this.mClipToScreen = enabled;\n            }\n            setAllowScrollingAnchorParent(enabled) {\n                this.mAllowScrollingAnchorParent = enabled;\n            }\n            isSplitTouchEnabled() {\n                if (this.mSplitTouchEnabled < 0 && this.mContext != null) {\n                    return true;\n                }\n                return this.mSplitTouchEnabled == 1;\n            }\n            setSplitTouchEnabled(enabled) {\n                this.mSplitTouchEnabled = enabled ? 1 : 0;\n            }\n            setWindowLayoutType(layoutType) {\n                this.mWindowLayoutType = layoutType;\n            }\n            getWindowLayoutType() {\n                return this.mWindowLayoutType;\n            }\n            setTouchModal(touchModal) {\n                this.mNotTouchModal = !touchModal;\n            }\n            setWindowLayoutMode(widthSpec, heightSpec) {\n                this.mWidthMode = widthSpec;\n                this.mHeightMode = heightSpec;\n            }\n            getHeight() {\n                return this.mHeight;\n            }\n            setHeight(height) {\n                this.mHeight = height;\n            }\n            getWidth() {\n                return this.mWidth;\n            }\n            setWidth(width) {\n                this.mWidth = width;\n            }\n            isShowing() {\n                return this.mIsShowing;\n            }\n            showAtLocation(parent, gravity, x, y) {\n                if (this.isShowing() || this.mContentView == null) {\n                    return;\n                }\n                this.unregisterForScrollChanged();\n                this.mIsShowing = true;\n                this.mIsDropdown = false;\n                let p = this.createPopupLayout();\n                p.enterAnimation = this.computeWindowEnterAnimation();\n                p.exitAnimation = this.computeWindowExitAnimation();\n                this.preparePopup(p);\n                if (gravity == Gravity.NO_GRAVITY) {\n                    gravity = Gravity.TOP | Gravity.START;\n                }\n                p.gravity = gravity;\n                p.x = x;\n                p.y = y;\n                if (this.mHeightMode < 0)\n                    p.height = this.mLastHeight = this.mHeightMode;\n                if (this.mWidthMode < 0)\n                    p.width = this.mLastWidth = this.mWidthMode;\n                this.invokePopup(p);\n            }\n            showAsDropDown(anchor, xoff = 0, yoff = 0, gravity = PopupWindow.DEFAULT_ANCHORED_GRAVITY) {\n                if (this.isShowing() || this.mContentView == null) {\n                    return;\n                }\n                this.registerForScrollChanged(anchor, xoff, yoff, gravity);\n                this.mIsShowing = true;\n                this.mIsDropdown = true;\n                let p = this.createPopupLayout();\n                this.preparePopup(p);\n                this.updateAboveAnchor(this.findDropDownPosition(anchor, p, xoff, yoff, gravity));\n                if (this.mHeightMode < 0)\n                    p.height = this.mLastHeight = this.mHeightMode;\n                if (this.mWidthMode < 0)\n                    p.width = this.mLastWidth = this.mWidthMode;\n                p.enterAnimation = this.computeWindowEnterAnimation();\n                p.exitAnimation = this.computeWindowExitAnimation();\n                this.invokePopup(p);\n            }\n            updateAboveAnchor(aboveAnchor) {\n                if (aboveAnchor != this.mAboveAnchor) {\n                    this.mAboveAnchor = aboveAnchor;\n                    if (this.mBackground != null) {\n                        if (this.mAboveAnchorBackgroundDrawable != null) {\n                            if (this.mAboveAnchor) {\n                                this.mPopupView.setBackgroundDrawable(this.mAboveAnchorBackgroundDrawable);\n                            }\n                            else {\n                                this.mPopupView.setBackgroundDrawable(this.mBelowAnchorBackgroundDrawable);\n                            }\n                        }\n                        else {\n                            this.mPopupView.refreshDrawableState();\n                        }\n                    }\n                }\n            }\n            isAboveAnchor() {\n                return this.mAboveAnchor;\n            }\n            preparePopup(p) {\n                if (this.mContentView == null || this.mContext == null || this.mWindowManager == null) {\n                    throw Error(`new IllegalStateException(\"You must specify a valid content view by \" + \"calling setContentView() before attempting to show the popup.\")`);\n                }\n                this.mPopupWindow.setContentView(this.mContentView);\n                this.mPopupWindow.setFloating(true);\n                this.mPopupWindow.setBackgroundColor(android.graphics.Color.TRANSPARENT);\n                this.mPopupWindow.setDimAmount(0);\n                this.mPopupView = this.mPopupWindow.getDecorView();\n                if (this.mBackground != null) {\n                    this.mPopupView.setBackground(this.mBackground);\n                }\n                this.mPopupViewInitialLayoutDirectionInherited = false;\n                this.mPopupWidth = p.width;\n                this.mPopupHeight = p.height;\n            }\n            invokePopup(p) {\n                this.setLayoutDirectionFromAnchor();\n                this.mWindowManager.addWindow(this.mPopupWindow);\n            }\n            setLayoutDirectionFromAnchor() {\n                if (this.mAnchor != null) {\n                    let anchor = this.mAnchor.get();\n                    if (anchor != null && this.mPopupViewInitialLayoutDirectionInherited) {\n                        this.mPopupView.setLayoutDirection(anchor.getLayoutDirection());\n                    }\n                }\n            }\n            createPopupLayout() {\n                let p = this.mPopupWindow.getAttributes();\n                p.gravity = Gravity.START | Gravity.TOP;\n                p.width = this.mLastWidth = this.mWidth;\n                p.height = this.mLastHeight = this.mHeight;\n                p.flags = this.computeFlags(p.flags);\n                p.type = this.mWindowLayoutType;\n                p.setTitle(\"PopupWindow\");\n                return p;\n            }\n            computeFlags(curFlags) {\n                curFlags &= ~(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |\n                    WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE |\n                    WindowManager.LayoutParams.FLAG_SPLIT_TOUCH);\n                if (!this.mFocusable) {\n                    curFlags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;\n                }\n                if (!this.mTouchable) {\n                    curFlags |= WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;\n                }\n                if (this.mOutsideTouchable) {\n                    curFlags |= WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;\n                }\n                if (this.isSplitTouchEnabled()) {\n                    curFlags |= WindowManager.LayoutParams.FLAG_SPLIT_TOUCH;\n                }\n                if (this.mNotTouchModal) {\n                    curFlags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;\n                }\n                return curFlags;\n            }\n            computeWindowEnterAnimation() {\n                if (this.mEnterAnimation == null) {\n                    if (this.mIsDropdown) {\n                        return this.mAboveAnchor ? this.mDefaultDropdownAboveEnterAnimation : this.mDefaultDropdownBelowEnterAnimation;\n                    }\n                    return null;\n                }\n                return this.mEnterAnimation;\n            }\n            computeWindowExitAnimation() {\n                if (this.mExitAnimation == null) {\n                    if (this.mIsDropdown) {\n                        return this.mAboveAnchor ? this.mDefaultDropdownAboveExitAnimation : this.mDefaultDropdownBelowExitAnimation;\n                    }\n                    return null;\n                }\n                return this.mExitAnimation;\n            }\n            findDropDownPosition(anchor, p, xoff, yoff, gravity) {\n                const anchorHeight = anchor.getHeight();\n                anchor.getLocationInWindow(this.mDrawingLocation);\n                p.x = this.mDrawingLocation[0] + xoff;\n                p.y = this.mDrawingLocation[1] + anchorHeight + yoff;\n                const hgrav = Gravity.getAbsoluteGravity(gravity, anchor.getLayoutDirection()) & Gravity.HORIZONTAL_GRAVITY_MASK;\n                if (hgrav == Gravity.RIGHT) {\n                    p.x -= this.mPopupWidth - anchor.getWidth();\n                }\n                let onTop = false;\n                p.gravity = Gravity.LEFT | Gravity.TOP;\n                anchor.getLocationOnScreen(this.mScreenLocation);\n                const displayFrame = new Rect();\n                anchor.getWindowVisibleDisplayFrame(displayFrame);\n                let screenY = this.mScreenLocation[1] + anchorHeight + yoff;\n                const root = anchor.getRootView();\n                if (screenY + this.mPopupHeight > displayFrame.bottom || p.x + this.mPopupWidth - root.getWidth() > 0) {\n                    if (this.mAllowScrollingAnchorParent) {\n                        let scrollX = anchor.getScrollX();\n                        let scrollY = anchor.getScrollY();\n                        let r = new Rect(scrollX, scrollY, scrollX + this.mPopupWidth + xoff, scrollY + this.mPopupHeight + anchor.getHeight() + yoff);\n                        anchor.requestRectangleOnScreen(r, true);\n                    }\n                    anchor.getLocationInWindow(this.mDrawingLocation);\n                    p.x = this.mDrawingLocation[0] + xoff;\n                    p.y = this.mDrawingLocation[1] + anchor.getHeight() + yoff;\n                    if (hgrav == Gravity.RIGHT) {\n                        p.x -= this.mPopupWidth - anchor.getWidth();\n                    }\n                    anchor.getLocationOnScreen(this.mScreenLocation);\n                    onTop = (displayFrame.bottom - this.mScreenLocation[1] - anchor.getHeight() - yoff) < (this.mScreenLocation[1] - yoff - displayFrame.top);\n                    if (onTop) {\n                        p.gravity = Gravity.LEFT | Gravity.BOTTOM;\n                        p.y = root.getHeight() - this.mDrawingLocation[1] + yoff;\n                    }\n                    else {\n                        p.y = this.mDrawingLocation[1] + anchor.getHeight() + yoff;\n                    }\n                }\n                if (this.mClipToScreen) {\n                    const displayFrameWidth = displayFrame.right - displayFrame.left;\n                    let right = p.x + p.width;\n                    if (right > displayFrameWidth) {\n                        p.x -= right - displayFrameWidth;\n                    }\n                    if (p.x < displayFrame.left) {\n                        p.x = displayFrame.left;\n                        p.width = Math.min(p.width, displayFrameWidth);\n                    }\n                    if (onTop) {\n                        let popupTop = this.mScreenLocation[1] + yoff - this.mPopupHeight;\n                        if (popupTop < 0) {\n                            p.y += popupTop;\n                        }\n                    }\n                    else {\n                        p.y = Math.max(p.y, displayFrame.top);\n                    }\n                }\n                p.gravity |= Gravity.DISPLAY_CLIP_VERTICAL;\n                return onTop;\n            }\n            getMaxAvailableHeight(anchor, yOffset = 0, ignoreBottomDecorations = false) {\n                const displayFrame = new Rect();\n                anchor.getWindowVisibleDisplayFrame(displayFrame);\n                const anchorPos = this.mDrawingLocation;\n                anchor.getLocationOnScreen(anchorPos);\n                let bottomEdge = displayFrame.bottom;\n                if (ignoreBottomDecorations) {\n                    let res = anchor.getContext().getResources();\n                    bottomEdge = res.getDisplayMetrics().heightPixels;\n                }\n                const distanceToBottom = bottomEdge - (anchorPos[1] + anchor.getHeight()) - yOffset;\n                const distanceToTop = anchorPos[1] - displayFrame.top + yOffset;\n                let returnedHeight = Math.max(distanceToBottom, distanceToTop);\n                if (this.mBackground != null) {\n                    this.mBackground.getPadding(this.mTempRect);\n                    returnedHeight -= this.mTempRect.top + this.mTempRect.bottom;\n                }\n                return returnedHeight;\n            }\n            dismiss() {\n                if (this.isShowing() && this.mPopupView != null) {\n                    this.mIsShowing = false;\n                    this.unregisterForScrollChanged();\n                    try {\n                        this.mWindowManager.removeWindow(this.mPopupWindow);\n                    }\n                    finally {\n                        if (this.mPopupView != this.mContentView && this.mPopupView instanceof ViewGroup) {\n                            this.mPopupView.removeView(this.mContentView);\n                        }\n                        this.mPopupView = null;\n                        if (this.mOnDismissListener != null) {\n                            this.mOnDismissListener.onDismiss();\n                        }\n                    }\n                }\n            }\n            setOnDismissListener(onDismissListener) {\n                this.mOnDismissListener = onDismissListener;\n            }\n            update(...args) {\n                if (args.length == 0) {\n                    this._update();\n                }\n                else if (args.length == 2) {\n                    this._update_w_h(args[0], args[1]);\n                }\n                else if (args.length == 3) {\n                    this._update_a_w_h(args[0], args[1], args[2]);\n                }\n                else if (args.length == 4) {\n                    this._update_x_y_w_h_f(args[0], args[1], args[2], args[3]);\n                }\n                else if (args.length == 5) {\n                    if (args[0] instanceof View)\n                        this._update_a_x_y_w_h(args[0], args[1], args[2], args[3], args[4]);\n                    else\n                        this._update_x_y_w_h_f(args[0], args[1], args[2], args[3], args[4]);\n                }\n            }\n            _update() {\n                if (!this.isShowing() || this.mContentView == null) {\n                    return;\n                }\n                let p = this.mPopupView.getLayoutParams();\n                let update = false;\n                const enterAnim = this.computeWindowEnterAnimation();\n                const exitAnim = this.computeWindowExitAnimation();\n                if (enterAnim != p.enterAnimation) {\n                    p.enterAnimation = enterAnim;\n                    update = true;\n                }\n                if (exitAnim != p.exitAnimation) {\n                    p.exitAnimation = exitAnim;\n                    update = true;\n                }\n                const newFlags = this.computeFlags(p.flags);\n                if (newFlags != p.flags) {\n                    p.flags = newFlags;\n                    update = true;\n                }\n                if (update) {\n                    this.setLayoutDirectionFromAnchor();\n                    this.mWindowManager.updateWindowLayout(this.mPopupWindow, p);\n                }\n            }\n            _update_w_h(width, height) {\n                let p = this.mPopupView.getLayoutParams();\n                this.update(p.x, p.y, width, height, false);\n            }\n            _update_x_y_w_h_f(x, y, width, height, force = false) {\n                if (width != -1) {\n                    this.mLastWidth = width;\n                    this.setWidth(width);\n                }\n                if (height != -1) {\n                    this.mLastHeight = height;\n                    this.setHeight(height);\n                }\n                if (!this.isShowing() || this.mContentView == null) {\n                    return;\n                }\n                let p = this.mPopupView.getLayoutParams();\n                let update = force;\n                const finalWidth = this.mWidthMode < 0 ? this.mWidthMode : this.mLastWidth;\n                if (width != -1 && p.width != finalWidth) {\n                    p.width = this.mLastWidth = finalWidth;\n                    update = true;\n                }\n                const finalHeight = this.mHeightMode < 0 ? this.mHeightMode : this.mLastHeight;\n                if (height != -1 && p.height != finalHeight) {\n                    p.height = this.mLastHeight = finalHeight;\n                    update = true;\n                }\n                if (p.x != x) {\n                    p.x = x;\n                    update = true;\n                }\n                if (p.y != y) {\n                    p.y = y;\n                    update = true;\n                }\n                const enterAnim = this.computeWindowEnterAnimation();\n                const exitAnim = this.computeWindowExitAnimation();\n                if (enterAnim != p.enterAnimation) {\n                    p.enterAnimation = enterAnim;\n                    update = true;\n                }\n                if (exitAnim != p.exitAnimation) {\n                    p.exitAnimation = exitAnim;\n                    update = true;\n                }\n                const newFlags = this.computeFlags(p.flags);\n                if (newFlags != p.flags) {\n                    p.flags = newFlags;\n                    update = true;\n                }\n                if (update) {\n                    this.setLayoutDirectionFromAnchor();\n                    this.mWindowManager.updateWindowLayout(this.mPopupWindow, p);\n                }\n            }\n            _update_a_w_h(anchor, width, height) {\n                this._update_all_args(anchor, false, 0, 0, true, width, height, this.mAnchoredGravity);\n            }\n            _update_a_x_y_w_h(anchor, xoff, yoff, width, height) {\n                this._update_all_args(anchor, true, xoff, yoff, true, width, height, this.mAnchoredGravity);\n            }\n            _update_all_args(anchor, updateLocation, xoff, yoff, updateDimension, width, height, gravity) {\n                if (!this.isShowing() || this.mContentView == null) {\n                    return;\n                }\n                let oldAnchor = this.mAnchor;\n                const needsUpdate = updateLocation && (this.mAnchorXoff != xoff || this.mAnchorYoff != yoff);\n                if (oldAnchor == null || oldAnchor.get() != anchor || (needsUpdate && !this.mIsDropdown)) {\n                    this.registerForScrollChanged(anchor, xoff, yoff, gravity);\n                }\n                else if (needsUpdate) {\n                    this.mAnchorXoff = xoff;\n                    this.mAnchorYoff = yoff;\n                    this.mAnchoredGravity = gravity;\n                }\n                let p = this.mPopupView.getLayoutParams();\n                if (updateDimension) {\n                    if (width == -1) {\n                        width = this.mPopupWidth;\n                    }\n                    else {\n                        this.mPopupWidth = width;\n                    }\n                    if (height == -1) {\n                        height = this.mPopupHeight;\n                    }\n                    else {\n                        this.mPopupHeight = height;\n                    }\n                }\n                let x = p.x;\n                let y = p.y;\n                if (updateLocation) {\n                    this.updateAboveAnchor(this.findDropDownPosition(anchor, p, xoff, yoff, gravity));\n                }\n                else {\n                    this.updateAboveAnchor(this.findDropDownPosition(anchor, p, this.mAnchorXoff, this.mAnchorYoff, this.mAnchoredGravity));\n                }\n                this.update(p.x, p.y, width, height, x != p.x || y != p.y);\n            }\n            unregisterForScrollChanged() {\n                let anchorRef = this.mAnchor;\n                let anchor = null;\n                if (anchorRef != null) {\n                    anchor = anchorRef.get();\n                }\n                if (anchor != null) {\n                    let vto = anchor.getViewTreeObserver();\n                    vto.removeOnScrollChangedListener(this.mOnScrollChangedListener);\n                }\n                this.mAnchor = null;\n            }\n            registerForScrollChanged(anchor, xoff, yoff, gravity) {\n                this.unregisterForScrollChanged();\n                this.mAnchor = new WeakReference(anchor);\n                let vto = anchor.getViewTreeObserver();\n                if (vto != null) {\n                    vto.addOnScrollChangedListener(this.mOnScrollChangedListener);\n                }\n                this.mAnchorXoff = xoff;\n                this.mAnchorYoff = yoff;\n                this.mAnchoredGravity = gravity;\n            }\n            onTouchEvent(event) {\n                const x = Math.floor(event.getX());\n                const y = Math.floor(event.getY());\n                if ((event.getAction() == MotionEvent.ACTION_DOWN) && ((x < 0) || (x >= this.mPopupView.getWidth()) || (y < 0) || (y >= this.mPopupView.getHeight()))) {\n                    this.dismiss();\n                    return true;\n                }\n                else if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {\n                    this.dismiss();\n                    return true;\n                }\n                else if (this.mPopupView) {\n                    return this.mPopupView.onTouchEvent(event);\n                }\n                return false;\n            }\n            onGenericMotionEvent(event) {\n                return false;\n            }\n            onWindowAttributesChanged(params) {\n                if (this.mPopupWindow != null) {\n                    this.mWindowManager.updateWindowLayout(this.mPopupWindow, params);\n                }\n            }\n            onContentChanged() {\n            }\n            onWindowFocusChanged(hasFocus) {\n            }\n            onAttachedToWindow() {\n            }\n            onDetachedFromWindow() {\n            }\n            dispatchKeyEvent(event) {\n                if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {\n                    if (this.mPopupView.getKeyDispatcherState() == null) {\n                        return this.mPopupWindow.superDispatchKeyEvent(event);\n                    }\n                    if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {\n                        let state = this.mPopupView.getKeyDispatcherState();\n                        if (state != null) {\n                            state.startTracking(event, this);\n                        }\n                        return true;\n                    }\n                    else if (event.getAction() == KeyEvent.ACTION_UP) {\n                        let state = this.mPopupView.getKeyDispatcherState();\n                        if (state != null && state.isTracking(event) && !event.isCanceled()) {\n                            this.dismiss();\n                            return true;\n                        }\n                    }\n                    return this.mPopupWindow.superDispatchKeyEvent(event);\n                }\n                else {\n                    return this.mPopupWindow.superDispatchKeyEvent(event);\n                }\n            }\n            dispatchTouchEvent(ev) {\n                if (this.mTouchInterceptor != null && this.mTouchInterceptor.onTouch(this.mPopupView, ev)) {\n                    return true;\n                }\n                if (this.mPopupWindow.superDispatchTouchEvent(ev)) {\n                    return true;\n                }\n                return this.onTouchEvent(ev);\n            }\n            dispatchGenericMotionEvent(ev) {\n                if (this.mPopupWindow.superDispatchGenericMotionEvent(ev)) {\n                    return true;\n                }\n                return this.onGenericMotionEvent(ev);\n            }\n        }\n        PopupWindow.INPUT_METHOD_FROM_FOCUSABLE = 0;\n        PopupWindow.INPUT_METHOD_NEEDED = 1;\n        PopupWindow.INPUT_METHOD_NOT_NEEDED = 2;\n        PopupWindow.DEFAULT_ANCHORED_GRAVITY = Gravity.TOP | Gravity.START;\n        widget.PopupWindow = PopupWindow;\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var DataSetObserver = android.database.DataSetObserver;\n        var Rect = android.graphics.Rect;\n        var Handler = android.os.Handler;\n        var Log = android.util.Log;\n        var Gravity = android.view.Gravity;\n        var KeyEvent = android.view.KeyEvent;\n        var MotionEvent = android.view.MotionEvent;\n        var View = android.view.View;\n        var MeasureSpec = android.view.View.MeasureSpec;\n        var ViewConfiguration = android.view.ViewConfiguration;\n        var ViewGroup = android.view.ViewGroup;\n        var Integer = java.lang.Integer;\n        var AbsListView = android.widget.AbsListView;\n        var LinearLayout = android.widget.LinearLayout;\n        var ListView = android.widget.ListView;\n        var PopupWindow = android.widget.PopupWindow;\n        var TextView = android.widget.TextView;\n        class ListPopupWindow {\n            constructor(context, styleAttr = android.R.attr.listPopupWindowStyle) {\n                this.mDropDownHeight = ViewGroup.LayoutParams.WRAP_CONTENT;\n                this.mDropDownWidth = ViewGroup.LayoutParams.WRAP_CONTENT;\n                this.mDropDownHorizontalOffset = 0;\n                this.mDropDownVerticalOffset = 0;\n                this.mDropDownGravity = Gravity.NO_GRAVITY;\n                this.mDropDownAlwaysVisible = false;\n                this.mForceIgnoreOutsideTouch = false;\n                this.mListItemExpandMaximum = Integer.MAX_VALUE;\n                this.mPromptPosition = ListPopupWindow.POSITION_PROMPT_ABOVE;\n                this.mResizePopupRunnable = new ListPopupWindow.ResizePopupRunnable(this);\n                this.mTouchInterceptor = new ListPopupWindow.PopupTouchInterceptor(this);\n                this.mScrollListener = new ListPopupWindow.PopupScrollListener(this);\n                this.mHideSelector = new ListPopupWindow.ListSelectorHider(this);\n                this.mHandler = new Handler();\n                this.mTempRect = new Rect();\n                this.mLayoutDirection = 0;\n                this.mContext = context;\n                this.mPopup = new PopupWindow(context, styleAttr);\n                this.mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);\n                this.mLayoutDirection = View.LAYOUT_DIRECTION_LTR;\n            }\n            setAdapter(adapter) {\n                if (this.mObserver == null) {\n                    this.mObserver = new ListPopupWindow.PopupDataSetObserver(this);\n                }\n                else if (this.mAdapter != null) {\n                    this.mAdapter.unregisterDataSetObserver(this.mObserver);\n                }\n                this.mAdapter = adapter;\n                if (this.mAdapter != null) {\n                    adapter.registerDataSetObserver(this.mObserver);\n                }\n                if (this.mDropDownList != null) {\n                    this.mDropDownList.setAdapter(this.mAdapter);\n                }\n            }\n            setPromptPosition(position) {\n                this.mPromptPosition = position;\n            }\n            getPromptPosition() {\n                return this.mPromptPosition;\n            }\n            setModal(modal) {\n                this.mModal = true;\n                this.mPopup.setFocusable(modal);\n            }\n            isModal() {\n                return this.mModal;\n            }\n            setForceIgnoreOutsideTouch(forceIgnoreOutsideTouch) {\n                this.mForceIgnoreOutsideTouch = forceIgnoreOutsideTouch;\n            }\n            setDropDownAlwaysVisible(dropDownAlwaysVisible) {\n                this.mDropDownAlwaysVisible = dropDownAlwaysVisible;\n            }\n            isDropDownAlwaysVisible() {\n                return this.mDropDownAlwaysVisible;\n            }\n            getBackground() {\n                return this.mPopup.getBackground();\n            }\n            setBackgroundDrawable(d) {\n                this.mPopup.setBackgroundDrawable(d);\n            }\n            setWindowAnimation(enterAnimation, exitAnimation) {\n                this.mPopup.setWindowAnimation(enterAnimation, exitAnimation);\n            }\n            getEnterAnimation() {\n                return this.mPopup.mEnterAnimation;\n            }\n            getExitAnimation() {\n                return this.mPopup.mExitAnimation;\n            }\n            getAnchorView() {\n                return this.mDropDownAnchorView;\n            }\n            setAnchorView(anchor) {\n                this.mDropDownAnchorView = anchor;\n            }\n            getHorizontalOffset() {\n                return this.mDropDownHorizontalOffset;\n            }\n            setHorizontalOffset(offset) {\n                this.mDropDownHorizontalOffset = offset;\n            }\n            getVerticalOffset() {\n                if (!this.mDropDownVerticalOffsetSet) {\n                    return 0;\n                }\n                return this.mDropDownVerticalOffset;\n            }\n            setVerticalOffset(offset) {\n                this.mDropDownVerticalOffset = offset;\n                this.mDropDownVerticalOffsetSet = true;\n            }\n            setDropDownGravity(gravity) {\n                this.mDropDownGravity = gravity;\n            }\n            getWidth() {\n                return this.mDropDownWidth;\n            }\n            setWidth(width) {\n                this.mDropDownWidth = width;\n            }\n            setContentWidth(width) {\n                let popupBackground = this.mPopup.getBackground();\n                if (popupBackground != null) {\n                    popupBackground.getPadding(this.mTempRect);\n                    this.mDropDownWidth = this.mTempRect.left + this.mTempRect.right + width;\n                }\n                else {\n                    this.setWidth(width);\n                }\n            }\n            getHeight() {\n                return this.mDropDownHeight;\n            }\n            setHeight(height) {\n                this.mDropDownHeight = height;\n            }\n            setOnItemClickListener(clickListener) {\n                this.mItemClickListener = clickListener;\n            }\n            setOnItemSelectedListener(selectedListener) {\n                this.mItemSelectedListener = selectedListener;\n            }\n            setPromptView(prompt) {\n                let showing = this.isShowing();\n                if (showing) {\n                    this.removePromptView();\n                }\n                this.mPromptView = prompt;\n                if (showing) {\n                    this.show();\n                }\n            }\n            postShow() {\n                this.mHandler.post(this.mShowDropDownRunnable);\n            }\n            show() {\n                let height = this.buildDropDown();\n                let widthSpec = 0;\n                let heightSpec = 0;\n                let noInputMethod = this.isInputMethodNotNeeded();\n                this.mPopup.setAllowScrollingAnchorParent(!noInputMethod);\n                if (this.mPopup.isShowing()) {\n                    if (this.mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) {\n                        widthSpec = -1;\n                    }\n                    else if (this.mDropDownWidth == ViewGroup.LayoutParams.WRAP_CONTENT) {\n                        widthSpec = this.getAnchorView().getWidth();\n                    }\n                    else {\n                        widthSpec = this.mDropDownWidth;\n                    }\n                    if (this.mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {\n                        heightSpec = noInputMethod ? height : ViewGroup.LayoutParams.MATCH_PARENT;\n                        if (noInputMethod) {\n                            this.mPopup.setWindowLayoutMode(this.mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT ? ViewGroup.LayoutParams.MATCH_PARENT : 0, 0);\n                        }\n                        else {\n                            this.mPopup.setWindowLayoutMode(this.mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT ? ViewGroup.LayoutParams.MATCH_PARENT : 0, ViewGroup.LayoutParams.MATCH_PARENT);\n                        }\n                    }\n                    else if (this.mDropDownHeight == ViewGroup.LayoutParams.WRAP_CONTENT) {\n                        heightSpec = height;\n                    }\n                    else {\n                        heightSpec = this.mDropDownHeight;\n                    }\n                    this.mPopup.setOutsideTouchable(!this.mForceIgnoreOutsideTouch && !this.mDropDownAlwaysVisible);\n                    this.mPopup.update(this.getAnchorView(), this.mDropDownHorizontalOffset, this.mDropDownVerticalOffset, widthSpec, heightSpec);\n                }\n                else {\n                    if (this.mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) {\n                        widthSpec = ViewGroup.LayoutParams.MATCH_PARENT;\n                    }\n                    else {\n                        if (this.mDropDownWidth == ViewGroup.LayoutParams.WRAP_CONTENT) {\n                            this.mPopup.setWidth(this.getAnchorView().getWidth());\n                        }\n                        else {\n                            this.mPopup.setWidth(this.mDropDownWidth);\n                        }\n                    }\n                    if (this.mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {\n                        heightSpec = ViewGroup.LayoutParams.MATCH_PARENT;\n                    }\n                    else {\n                        if (this.mDropDownHeight == ViewGroup.LayoutParams.WRAP_CONTENT) {\n                            this.mPopup.setHeight(height);\n                        }\n                        else {\n                            this.mPopup.setHeight(this.mDropDownHeight);\n                        }\n                    }\n                    this.mPopup.setWindowLayoutMode(widthSpec, heightSpec);\n                    this.mPopup.setClipToScreenEnabled(true);\n                    this.mPopup.setOutsideTouchable(!this.mForceIgnoreOutsideTouch && !this.mDropDownAlwaysVisible);\n                    this.mPopup.setTouchInterceptor(this.mTouchInterceptor);\n                    this.mPopup.showAsDropDown(this.getAnchorView(), this.mDropDownHorizontalOffset, this.mDropDownVerticalOffset, this.mDropDownGravity);\n                    this.mDropDownList.setSelection(ListView.INVALID_POSITION);\n                    if (!this.mModal || this.mDropDownList.isInTouchMode()) {\n                        this.clearListSelection();\n                    }\n                    if (!this.mModal) {\n                        this.mHandler.post(this.mHideSelector);\n                    }\n                }\n            }\n            dismiss() {\n                this.mPopup.dismiss();\n                this.removePromptView();\n                this.mPopup.setContentView(null);\n                this.mDropDownList = null;\n                this.mHandler.removeCallbacks(this.mResizePopupRunnable);\n            }\n            setOnDismissListener(listener) {\n                this.mPopup.setOnDismissListener(listener);\n            }\n            removePromptView() {\n                if (this.mPromptView != null) {\n                    const parent = this.mPromptView.getParent();\n                    if (parent instanceof ViewGroup) {\n                        const group = parent;\n                        group.removeView(this.mPromptView);\n                    }\n                }\n            }\n            setInputMethodMode(mode) {\n                this.mPopup.setInputMethodMode(mode);\n            }\n            getInputMethodMode() {\n                return this.mPopup.getInputMethodMode();\n            }\n            setSelection(position) {\n                let list = this.mDropDownList;\n                if (this.isShowing() && list != null) {\n                    list.mListSelectionHidden = false;\n                    list.setSelection(position);\n                    if (list.getChoiceMode() != ListView.CHOICE_MODE_NONE) {\n                        list.setItemChecked(position, true);\n                    }\n                }\n            }\n            clearListSelection() {\n                const list = this.mDropDownList;\n                if (list != null) {\n                    list.mListSelectionHidden = true;\n                    list.hideSelector();\n                    list.requestLayout();\n                }\n            }\n            isShowing() {\n                return this.mPopup.isShowing();\n            }\n            isInputMethodNotNeeded() {\n                return this.mPopup.getInputMethodMode() == ListPopupWindow.INPUT_METHOD_NOT_NEEDED;\n            }\n            performItemClick(position) {\n                if (this.isShowing()) {\n                    if (this.mItemClickListener != null) {\n                        const list = this.mDropDownList;\n                        const child = list.getChildAt(position - list.getFirstVisiblePosition());\n                        const adapter = list.getAdapter();\n                        this.mItemClickListener.onItemClick(list, child, position, adapter.getItemId(position));\n                    }\n                    return true;\n                }\n                return false;\n            }\n            getSelectedItem() {\n                if (!this.isShowing()) {\n                    return null;\n                }\n                return this.mDropDownList.getSelectedItem();\n            }\n            getSelectedItemPosition() {\n                if (!this.isShowing()) {\n                    return ListView.INVALID_POSITION;\n                }\n                return this.mDropDownList.getSelectedItemPosition();\n            }\n            getSelectedItemId() {\n                if (!this.isShowing()) {\n                    return ListView.INVALID_ROW_ID;\n                }\n                return this.mDropDownList.getSelectedItemId();\n            }\n            getSelectedView() {\n                if (!this.isShowing()) {\n                    return null;\n                }\n                return this.mDropDownList.getSelectedView();\n            }\n            getListView() {\n                return this.mDropDownList;\n            }\n            setListItemExpandMax(max) {\n                this.mListItemExpandMaximum = max;\n            }\n            onKeyDown(keyCode, event) {\n                if (this.isShowing()) {\n                    if (keyCode != KeyEvent.KEYCODE_SPACE && (this.mDropDownList.getSelectedItemPosition() >= 0 || !KeyEvent.isConfirmKey(keyCode))) {\n                        let curIndex = this.mDropDownList.getSelectedItemPosition();\n                        let consumed;\n                        const below = !this.mPopup.isAboveAnchor();\n                        const adapter = this.mAdapter;\n                        let allEnabled;\n                        let firstItem = Integer.MAX_VALUE;\n                        let lastItem = Integer.MIN_VALUE;\n                        if (adapter != null) {\n                            allEnabled = adapter.areAllItemsEnabled();\n                            firstItem = allEnabled ? 0 : this.mDropDownList.lookForSelectablePosition(0, true);\n                            lastItem = allEnabled ? adapter.getCount() - 1 : this.mDropDownList.lookForSelectablePosition(adapter.getCount() - 1, false);\n                        }\n                        if ((below && keyCode == KeyEvent.KEYCODE_DPAD_UP && curIndex <= firstItem) || (!below && keyCode == KeyEvent.KEYCODE_DPAD_DOWN && curIndex >= lastItem)) {\n                            this.clearListSelection();\n                            this.mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);\n                            this.show();\n                            return true;\n                        }\n                        else {\n                            this.mDropDownList.mListSelectionHidden = false;\n                        }\n                        consumed = this.mDropDownList.onKeyDown(keyCode, event);\n                        if (ListPopupWindow.DEBUG)\n                            Log.v(ListPopupWindow.TAG, \"Key down: code=\" + keyCode + \" list consumed=\" + consumed);\n                        if (consumed) {\n                            this.mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);\n                            this.mDropDownList.requestFocusFromTouch();\n                            this.show();\n                            switch (keyCode) {\n                                case KeyEvent.KEYCODE_ENTER:\n                                case KeyEvent.KEYCODE_DPAD_CENTER:\n                                case KeyEvent.KEYCODE_DPAD_DOWN:\n                                case KeyEvent.KEYCODE_DPAD_UP:\n                                    return true;\n                            }\n                        }\n                        else {\n                            if (below && keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {\n                                if (curIndex == lastItem) {\n                                    return true;\n                                }\n                            }\n                            else if (!below && keyCode == KeyEvent.KEYCODE_DPAD_UP && curIndex == firstItem) {\n                                return true;\n                            }\n                        }\n                    }\n                }\n                return false;\n            }\n            onKeyUp(keyCode, event) {\n                if (this.isShowing() && this.mDropDownList.getSelectedItemPosition() >= 0) {\n                    let consumed = this.mDropDownList.onKeyUp(keyCode, event);\n                    if (consumed && KeyEvent.isConfirmKey(keyCode)) {\n                        this.dismiss();\n                    }\n                    return consumed;\n                }\n                return false;\n            }\n            onKeyPreIme(keyCode, event) {\n                if (keyCode == KeyEvent.KEYCODE_BACK && this.isShowing()) {\n                    const anchorView = this.mDropDownAnchorView;\n                    if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {\n                        let state = anchorView.getKeyDispatcherState();\n                        if (state != null) {\n                            state.startTracking(event, this);\n                        }\n                        return true;\n                    }\n                    else if (event.getAction() == KeyEvent.ACTION_UP) {\n                        let state = anchorView.getKeyDispatcherState();\n                        if (state != null) {\n                            state.handleUpEvent(event);\n                        }\n                        if (event.isTracking() && !event.isCanceled()) {\n                            this.dismiss();\n                            return true;\n                        }\n                    }\n                }\n                return false;\n            }\n            createDragToOpenListener(src) {\n                return (() => {\n                    const inner_this = this;\n                    class _Inner extends ListPopupWindow.ForwardingListener {\n                        getPopup() {\n                            return inner_this;\n                        }\n                    }\n                    return new _Inner(src);\n                })();\n            }\n            buildDropDown() {\n                let dropDownView;\n                let otherHeights = 0;\n                if (this.mDropDownList == null) {\n                    let context = this.mContext;\n                    this.mShowDropDownRunnable = (() => {\n                        const inner_this = this;\n                        class _Inner {\n                            run() {\n                                let view = inner_this.getAnchorView();\n                                if (view != null && view.isAttachedToWindow()) {\n                                    inner_this.show();\n                                }\n                            }\n                        }\n                        return new _Inner();\n                    })();\n                    this.mDropDownList = new ListPopupWindow.DropDownListView(context, !this.mModal);\n                    if (this.mDropDownListHighlight != null) {\n                        this.mDropDownList.setSelector(this.mDropDownListHighlight);\n                    }\n                    this.mDropDownList.setAdapter(this.mAdapter);\n                    this.mDropDownList.setOnItemClickListener(this.mItemClickListener);\n                    this.mDropDownList.setFocusable(true);\n                    this.mDropDownList.setFocusableInTouchMode(true);\n                    this.mDropDownList.setOnItemSelectedListener((() => {\n                        const inner_this = this;\n                        class _Inner {\n                            onItemSelected(parent, view, position, id) {\n                                if (position != -1) {\n                                    let dropDownList = inner_this.mDropDownList;\n                                    if (dropDownList != null) {\n                                        dropDownList.mListSelectionHidden = false;\n                                    }\n                                }\n                            }\n                            onNothingSelected(parent) {\n                            }\n                        }\n                        return new _Inner();\n                    })());\n                    this.mDropDownList.setOnScrollListener(this.mScrollListener);\n                    if (this.mItemSelectedListener != null) {\n                        this.mDropDownList.setOnItemSelectedListener(this.mItemSelectedListener);\n                    }\n                    dropDownView = this.mDropDownList;\n                    let hintView = this.mPromptView;\n                    if (hintView != null) {\n                        let hintContainer = new LinearLayout(context);\n                        hintContainer.setOrientation(LinearLayout.VERTICAL);\n                        let hintParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1.0);\n                        switch (this.mPromptPosition) {\n                            case ListPopupWindow.POSITION_PROMPT_BELOW:\n                                hintContainer.addView(dropDownView, hintParams);\n                                hintContainer.addView(hintView);\n                                break;\n                            case ListPopupWindow.POSITION_PROMPT_ABOVE:\n                                hintContainer.addView(hintView);\n                                hintContainer.addView(dropDownView, hintParams);\n                                break;\n                            default:\n                                Log.e(ListPopupWindow.TAG, \"Invalid hint position \" + this.mPromptPosition);\n                                break;\n                        }\n                        let widthSpec = MeasureSpec.makeMeasureSpec(this.mDropDownWidth, MeasureSpec.AT_MOST);\n                        let heightSpec = MeasureSpec.UNSPECIFIED;\n                        hintView.measure(widthSpec, heightSpec);\n                        hintParams = hintView.getLayoutParams();\n                        otherHeights = hintView.getMeasuredHeight() + hintParams.topMargin + hintParams.bottomMargin;\n                        dropDownView = hintContainer;\n                    }\n                    this.mPopup.setContentView(dropDownView);\n                }\n                else {\n                    dropDownView = this.mPopup.getContentView();\n                    const view = this.mPromptView;\n                    if (view != null) {\n                        let hintParams = view.getLayoutParams();\n                        otherHeights = view.getMeasuredHeight() + hintParams.topMargin + hintParams.bottomMargin;\n                    }\n                }\n                let padding = 0;\n                let background = this.mPopup.getBackground();\n                if (background != null) {\n                    background.getPadding(this.mTempRect);\n                    padding = this.mTempRect.top + this.mTempRect.bottom;\n                    if (!this.mDropDownVerticalOffsetSet) {\n                        this.mDropDownVerticalOffset = -this.mTempRect.top;\n                    }\n                }\n                else {\n                    this.mTempRect.setEmpty();\n                }\n                let ignoreBottomDecorations = this.mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;\n                const maxHeight = this.mPopup.getMaxAvailableHeight(this.getAnchorView(), this.mDropDownVerticalOffset, ignoreBottomDecorations);\n                if (this.mDropDownAlwaysVisible || this.mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {\n                    return maxHeight + padding;\n                }\n                let childWidthSpec;\n                switch (this.mDropDownWidth) {\n                    case ViewGroup.LayoutParams.WRAP_CONTENT:\n                        childWidthSpec = MeasureSpec.makeMeasureSpec(this.mContext.getResources().getDisplayMetrics().widthPixels - (this.mTempRect.left + this.mTempRect.right), MeasureSpec.AT_MOST);\n                        break;\n                    case ViewGroup.LayoutParams.MATCH_PARENT:\n                        childWidthSpec = MeasureSpec.makeMeasureSpec(this.mContext.getResources().getDisplayMetrics().widthPixels - (this.mTempRect.left + this.mTempRect.right), MeasureSpec.EXACTLY);\n                        break;\n                    default:\n                        childWidthSpec = MeasureSpec.makeMeasureSpec(this.mDropDownWidth, MeasureSpec.EXACTLY);\n                        break;\n                }\n                const listContent = this.mDropDownList.measureHeightOfChildren(childWidthSpec, 0, ListView.NO_POSITION, maxHeight - otherHeights, -1);\n                if (listContent > 0)\n                    otherHeights += padding;\n                return listContent + otherHeights;\n            }\n        }\n        ListPopupWindow.TAG = \"ListPopupWindow\";\n        ListPopupWindow.DEBUG = false;\n        ListPopupWindow.EXPAND_LIST_TIMEOUT = 250;\n        ListPopupWindow.POSITION_PROMPT_ABOVE = 0;\n        ListPopupWindow.POSITION_PROMPT_BELOW = 1;\n        ListPopupWindow.MATCH_PARENT = ViewGroup.LayoutParams.MATCH_PARENT;\n        ListPopupWindow.WRAP_CONTENT = ViewGroup.LayoutParams.WRAP_CONTENT;\n        ListPopupWindow.INPUT_METHOD_FROM_FOCUSABLE = PopupWindow.INPUT_METHOD_FROM_FOCUSABLE;\n        ListPopupWindow.INPUT_METHOD_NEEDED = PopupWindow.INPUT_METHOD_NEEDED;\n        ListPopupWindow.INPUT_METHOD_NOT_NEEDED = PopupWindow.INPUT_METHOD_NOT_NEEDED;\n        widget.ListPopupWindow = ListPopupWindow;\n        (function (ListPopupWindow) {\n            class ForwardingListener {\n                constructor(src) {\n                    this.mScaledTouchSlop = 0;\n                    this.mTapTimeout = 0;\n                    this.mActivePointerId = 0;\n                    this.mSrc = src;\n                    this.mScaledTouchSlop = ViewConfiguration.get(src.getContext()).getScaledTouchSlop();\n                    this.mTapTimeout = ViewConfiguration.getTapTimeout();\n                    src.addOnAttachStateChangeListener(this);\n                }\n                onTouch(v, event) {\n                    const wasForwarding = this.mForwarding;\n                    let forwarding;\n                    if (wasForwarding) {\n                        forwarding = this.onTouchForwarded(event) || !this.onForwardingStopped();\n                    }\n                    else {\n                        forwarding = this.onTouchObserved(event) && this.onForwardingStarted();\n                    }\n                    this.mForwarding = forwarding;\n                    return forwarding || wasForwarding;\n                }\n                onViewAttachedToWindow(v) {\n                }\n                onViewDetachedFromWindow(v) {\n                    this.mForwarding = false;\n                    this.mActivePointerId = MotionEvent.INVALID_POINTER_ID;\n                    if (this.mDisallowIntercept != null) {\n                        this.mSrc.removeCallbacks(this.mDisallowIntercept);\n                    }\n                }\n                onForwardingStarted() {\n                    const popup = this.getPopup();\n                    if (popup != null && !popup.isShowing()) {\n                        popup.show();\n                    }\n                    return true;\n                }\n                onForwardingStopped() {\n                    const popup = this.getPopup();\n                    if (popup != null && popup.isShowing()) {\n                        popup.dismiss();\n                    }\n                    return true;\n                }\n                onTouchObserved(srcEvent) {\n                    const src = this.mSrc;\n                    if (!src.isEnabled()) {\n                        return false;\n                    }\n                    const actionMasked = srcEvent.getActionMasked();\n                    switch (actionMasked) {\n                        case MotionEvent.ACTION_DOWN:\n                            this.mActivePointerId = srcEvent.getPointerId(0);\n                            if (this.mDisallowIntercept == null) {\n                                this.mDisallowIntercept = new ForwardingListener.DisallowIntercept(this);\n                            }\n                            src.postDelayed(this.mDisallowIntercept, this.mTapTimeout);\n                            break;\n                        case MotionEvent.ACTION_MOVE:\n                            const activePointerIndex = srcEvent.findPointerIndex(this.mActivePointerId);\n                            if (activePointerIndex >= 0) {\n                                const x = srcEvent.getX(activePointerIndex);\n                                const y = srcEvent.getY(activePointerIndex);\n                                if (!src.pointInView(x, y, this.mScaledTouchSlop)) {\n                                    if (this.mDisallowIntercept != null) {\n                                        src.removeCallbacks(this.mDisallowIntercept);\n                                    }\n                                    src.getParent().requestDisallowInterceptTouchEvent(true);\n                                    return true;\n                                }\n                            }\n                            break;\n                        case MotionEvent.ACTION_CANCEL:\n                        case MotionEvent.ACTION_UP:\n                            if (this.mDisallowIntercept != null) {\n                                src.removeCallbacks(this.mDisallowIntercept);\n                            }\n                            break;\n                    }\n                    return false;\n                }\n                onTouchForwarded(srcEvent) {\n                    return false;\n                }\n            }\n            ListPopupWindow.ForwardingListener = ForwardingListener;\n            (function (ForwardingListener) {\n                class DisallowIntercept {\n                    constructor(arg) {\n                        this._ForwardingListener_this = arg;\n                    }\n                    run() {\n                        const parent = this._ForwardingListener_this.mSrc.getParent();\n                        parent.requestDisallowInterceptTouchEvent(true);\n                    }\n                }\n                ForwardingListener.DisallowIntercept = DisallowIntercept;\n            })(ForwardingListener = ListPopupWindow.ForwardingListener || (ListPopupWindow.ForwardingListener = {}));\n            class DropDownListView extends ListView {\n                constructor(context, hijackFocus) {\n                    super(context, null, android.R.attr.dropDownListViewStyle);\n                    this.mHijackFocus = hijackFocus;\n                    this.setCacheColorHint(0);\n                }\n                onForwardedEvent(event, activePointerId) {\n                    let handledEvent = true;\n                    let clearPressedItem = false;\n                    const actionMasked = event.getActionMasked();\n                    switch (actionMasked) {\n                        case MotionEvent.ACTION_CANCEL:\n                            handledEvent = false;\n                            break;\n                        case MotionEvent.ACTION_UP:\n                            handledEvent = false;\n                        case MotionEvent.ACTION_MOVE:\n                            const activeIndex = event.findPointerIndex(activePointerId);\n                            if (activeIndex < 0) {\n                                handledEvent = false;\n                                break;\n                            }\n                            const x = Math.floor(event.getX(activeIndex));\n                            const y = Math.floor(event.getY(activeIndex));\n                            const position = this.pointToPosition(x, y);\n                            if (position == DropDownListView.INVALID_POSITION) {\n                                clearPressedItem = true;\n                                break;\n                            }\n                            const child = this.getChildAt(position - this.getFirstVisiblePosition());\n                            this.setPressedItem(child, position);\n                            handledEvent = true;\n                            if (actionMasked == MotionEvent.ACTION_UP) {\n                                this.clickPressedItem(child, position);\n                            }\n                            break;\n                    }\n                    if (!handledEvent || clearPressedItem) {\n                        this.clearPressedItem();\n                    }\n                    return handledEvent;\n                }\n                clickPressedItem(child, position) {\n                    const id = this.getItemIdAtPosition(position);\n                    this.performItemClick(child, position, id);\n                }\n                clearPressedItem() {\n                    this.mDrawsInPressedState = false;\n                    this.setPressed(false);\n                    this.updateSelectorState();\n                }\n                setPressedItem(child, position) {\n                    this.mDrawsInPressedState = true;\n                    this.setPressed(true);\n                    this.layoutChildren();\n                    this.setSelectedPositionInt(position);\n                    this.positionSelector(position, child);\n                    this.refreshDrawableState();\n                }\n                touchModeDrawsInPressedState() {\n                    return this.mDrawsInPressedState || super.touchModeDrawsInPressedState();\n                }\n                obtainView(position, isScrap) {\n                    let view = super.obtainView(position, isScrap);\n                    if (view instanceof TextView) {\n                        view.setHorizontallyScrolling(true);\n                    }\n                    return view;\n                }\n                isInTouchMode() {\n                    return (this.mHijackFocus && this.mListSelectionHidden) || super.isInTouchMode();\n                }\n                hasWindowFocus() {\n                    return this.mHijackFocus || super.hasWindowFocus();\n                }\n                isFocused() {\n                    return this.mHijackFocus || super.isFocused();\n                }\n                hasFocus() {\n                    return this.mHijackFocus || super.hasFocus();\n                }\n            }\n            DropDownListView.CLICK_ANIM_DURATION = 150;\n            DropDownListView.CLICK_ANIM_ALPHA = 0x80;\n            ListPopupWindow.DropDownListView = DropDownListView;\n            class PopupDataSetObserver extends DataSetObserver {\n                constructor(arg) {\n                    super();\n                    this._ListPopupWindow_this = arg;\n                }\n                onChanged() {\n                    if (this._ListPopupWindow_this.isShowing()) {\n                        this._ListPopupWindow_this.show();\n                    }\n                }\n                onInvalidated() {\n                    this._ListPopupWindow_this.dismiss();\n                }\n            }\n            ListPopupWindow.PopupDataSetObserver = PopupDataSetObserver;\n            class ListSelectorHider {\n                constructor(arg) {\n                    this._ListPopupWindow_this = arg;\n                }\n                run() {\n                    this._ListPopupWindow_this.clearListSelection();\n                }\n            }\n            ListPopupWindow.ListSelectorHider = ListSelectorHider;\n            class ResizePopupRunnable {\n                constructor(arg) {\n                    this._ListPopupWindow_this = arg;\n                }\n                run() {\n                    if (this._ListPopupWindow_this.mDropDownList != null && this._ListPopupWindow_this.mDropDownList.getCount() > this._ListPopupWindow_this.mDropDownList.getChildCount() && this._ListPopupWindow_this.mDropDownList.getChildCount() <= this._ListPopupWindow_this.mListItemExpandMaximum) {\n                        this._ListPopupWindow_this.mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);\n                        this._ListPopupWindow_this.show();\n                    }\n                }\n            }\n            ListPopupWindow.ResizePopupRunnable = ResizePopupRunnable;\n            class PopupTouchInterceptor {\n                constructor(arg) {\n                    this._ListPopupWindow_this = arg;\n                }\n                onTouch(v, event) {\n                    const action = event.getAction();\n                    const x = Math.floor(event.getX());\n                    const y = Math.floor(event.getY());\n                    if (action == MotionEvent.ACTION_DOWN && this._ListPopupWindow_this.mPopup != null && this._ListPopupWindow_this.mPopup.isShowing() && (x >= 0 && x < this._ListPopupWindow_this.mPopup.getWidth() && y >= 0 && y < this._ListPopupWindow_this.mPopup.getHeight())) {\n                        this._ListPopupWindow_this.mHandler.postDelayed(this._ListPopupWindow_this.mResizePopupRunnable, ListPopupWindow.EXPAND_LIST_TIMEOUT);\n                    }\n                    else if (action == MotionEvent.ACTION_UP) {\n                        this._ListPopupWindow_this.mHandler.removeCallbacks(this._ListPopupWindow_this.mResizePopupRunnable);\n                    }\n                    return false;\n                }\n            }\n            ListPopupWindow.PopupTouchInterceptor = PopupTouchInterceptor;\n            class PopupScrollListener {\n                constructor(arg) {\n                    this._ListPopupWindow_this = arg;\n                }\n                onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount) {\n                }\n                onScrollStateChanged(view, scrollState) {\n                    if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL\n                        && !this._ListPopupWindow_this.isInputMethodNotNeeded() && this._ListPopupWindow_this.mPopup.getContentView() != null) {\n                        this._ListPopupWindow_this.mHandler.removeCallbacks(this._ListPopupWindow_this.mResizePopupRunnable);\n                        this._ListPopupWindow_this.mResizePopupRunnable.run();\n                    }\n                }\n            }\n            ListPopupWindow.PopupScrollListener = PopupScrollListener;\n        })(ListPopupWindow = widget.ListPopupWindow || (widget.ListPopupWindow = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var widget;\n    (function (widget) {\n        var AlertDialog = android.app.AlertDialog;\n        var Rect = android.graphics.Rect;\n        var Log = android.util.Log;\n        var Gravity = android.view.Gravity;\n        var View = android.view.View;\n        var ViewGroup = android.view.ViewGroup;\n        var AbsSpinner = android.widget.AbsSpinner;\n        var ListAdapter = android.widget.ListAdapter;\n        var ListPopupWindow = android.widget.ListPopupWindow;\n        var ListView = android.widget.ListView;\n        var R = android.R;\n        class Spinner extends AbsSpinner {\n            constructor(context, bindElement, defStyle = R.attr.spinnerStyle, mode = Spinner.MODE_THEME) {\n                super(context, bindElement, defStyle);\n                this.mDropDownWidth = 0;\n                this.mGravity = 0;\n                this.mTempRect = new Rect();\n                const a = context.obtainStyledAttributes(bindElement, defStyle);\n                if (mode == Spinner.MODE_THEME) {\n                    if ('dialog' === a.getAttrValue('spinnerMode')) {\n                        mode = Spinner.MODE_DIALOG;\n                    }\n                    else {\n                        mode = Spinner.MODE_DROPDOWN;\n                    }\n                }\n                switch (mode) {\n                    case Spinner.MODE_DIALOG: {\n                        this.mPopup = new Spinner.DialogPopup(this);\n                        break;\n                    }\n                    case Spinner.MODE_DROPDOWN: {\n                        const popup = new Spinner.DropdownPopup(context, defStyle, this);\n                        this.mDropDownWidth = a.getLayoutDimension('dropDownWidth', ViewGroup.LayoutParams.WRAP_CONTENT);\n                        popup.setBackgroundDrawable(a.getDrawable('popupBackground'));\n                        const verticalOffset = a.getDimensionPixelOffset('dropDownVerticalOffset', 0);\n                        if (verticalOffset != 0) {\n                            popup.setVerticalOffset(verticalOffset);\n                        }\n                        const horizontalOffset = a.getDimensionPixelOffset('dropDownHorizontalOffset', 0);\n                        if (horizontalOffset != 0) {\n                            popup.setHorizontalOffset(horizontalOffset);\n                        }\n                        this.mPopup = popup;\n                        break;\n                    }\n                }\n                this.mGravity = Gravity.parseGravity(a.getAttrValue('gravity'), Gravity.CENTER);\n                this.mPopup.setPromptText(a.getString('prompt'));\n                this.mDisableChildrenWhenDisabled = a.getBoolean('disableChildrenWhenDisabled', false);\n                a.recycle();\n                if (this.mTempAdapter != null) {\n                    this.mPopup.setAdapter(this.mTempAdapter);\n                    this.mTempAdapter = null;\n                }\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('dropDownWidth', {\n                    setter(v, value, a) {\n                        v.mDropDownWidth = a.parseNumberPixelSize(value, v.mDropDownWidth);\n                    }, getter(v) {\n                        return v.mDropDownWidth;\n                    }\n                }).set('popupBackground', {\n                    setter(v, value, a) {\n                        v.mPopup.setBackgroundDrawable(a.parseDrawable(value));\n                    }, getter(v) {\n                        return v.mPopup.getBackground();\n                    }\n                }).set('dropDownVerticalOffset', {\n                    setter(v, value, a) {\n                        const verticalOffset = a.parseNumberPixelSize(value, 0);\n                        if (verticalOffset != 0) {\n                            v.mPopup.setVerticalOffset(verticalOffset);\n                        }\n                    }, getter(v) {\n                        return v.mPopup.getVerticalOffset();\n                    }\n                }).set('dropDownHorizontalOffset', {\n                    setter(v, value, a) {\n                        const horizontalOffset = a.parseNumberPixelSize(value, 0);\n                        if (horizontalOffset != 0) {\n                            v.mPopup.setHorizontalOffset(horizontalOffset);\n                        }\n                    }, getter(v) {\n                        return v.mPopup.getHorizontalOffset();\n                    }\n                }).set('gravity', {\n                    setter(v, value, a) {\n                        v.mGravity = a.parseGravity(value, Gravity.CENTER);\n                    }, getter(v) {\n                        return v.mGravity;\n                    }\n                }).set('prompt', {\n                    setter(v, value, a) {\n                        v.mPopup.setPromptText(a.parseString(value));\n                    }, getter(v) {\n                        return v.mPopup.getHintText();\n                    }\n                }).set('disableChildrenWhenDisabled', {\n                    setter(v, value, a) {\n                        v.mDisableChildrenWhenDisabled = a.parseBoolean(value, false);\n                    }, getter(v) {\n                        return v.mDisableChildrenWhenDisabled;\n                    }\n                });\n            }\n            setPopupBackgroundDrawable(background) {\n                if (!(this.mPopup instanceof Spinner.DropdownPopup)) {\n                    Log.e(Spinner.TAG, \"setPopupBackgroundDrawable: incompatible spinner mode; ignoring...\");\n                    return;\n                }\n                this.mPopup.setBackgroundDrawable(background);\n            }\n            getPopupBackground() {\n                return this.mPopup.getBackground();\n            }\n            setDropDownVerticalOffset(pixels) {\n                this.mPopup.setVerticalOffset(pixels);\n            }\n            getDropDownVerticalOffset() {\n                return this.mPopup.getVerticalOffset();\n            }\n            setDropDownHorizontalOffset(pixels) {\n                this.mPopup.setHorizontalOffset(pixels);\n            }\n            getDropDownHorizontalOffset() {\n                return this.mPopup.getHorizontalOffset();\n            }\n            setDropDownWidth(pixels) {\n                if (!(this.mPopup instanceof Spinner.DropdownPopup)) {\n                    Log.e(Spinner.TAG, \"Cannot set dropdown width for MODE_DIALOG, ignoring\");\n                    return;\n                }\n                this.mDropDownWidth = pixels;\n            }\n            getDropDownWidth() {\n                return this.mDropDownWidth;\n            }\n            setEnabled(enabled) {\n                super.setEnabled(enabled);\n                if (this.mDisableChildrenWhenDisabled) {\n                    const count = this.getChildCount();\n                    for (let i = 0; i < count; i++) {\n                        this.getChildAt(i).setEnabled(enabled);\n                    }\n                }\n            }\n            setGravity(gravity) {\n                if (this.mGravity != gravity) {\n                    if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == 0) {\n                        gravity |= Gravity.START;\n                    }\n                    this.mGravity = gravity;\n                    this.requestLayout();\n                }\n            }\n            getGravity() {\n                return this.mGravity;\n            }\n            setAdapter(adapter) {\n                super.setAdapter(adapter);\n                this.mRecycler.clear();\n                if (this.mPopup != null) {\n                    this.mPopup.setAdapter(new Spinner.DropDownAdapter(adapter));\n                }\n                else {\n                    this.mTempAdapter = new Spinner.DropDownAdapter(adapter);\n                }\n            }\n            getBaseline() {\n                let child = null;\n                if (this.getChildCount() > 0) {\n                    child = this.getChildAt(0);\n                }\n                else if (this.mAdapter != null && this.mAdapter.getCount() > 0) {\n                    child = this.makeView(0, false);\n                    this.mRecycler.put(0, child);\n                }\n                if (child != null) {\n                    const childBaseline = child.getBaseline();\n                    return childBaseline >= 0 ? child.getTop() + childBaseline : -1;\n                }\n                else {\n                    return -1;\n                }\n            }\n            onDetachedFromWindow() {\n                super.onDetachedFromWindow();\n                if (this.mPopup != null && this.mPopup.isShowing()) {\n                    this.mPopup.dismiss();\n                }\n            }\n            setOnItemClickListener(l) {\n                throw Error(`new RuntimeException(\"setOnItemClickListener cannot be used with a spinner.\")`);\n            }\n            setOnItemClickListenerInt(l) {\n                super.setOnItemClickListener(l);\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n                if (this.mPopup != null && View.MeasureSpec.getMode(widthMeasureSpec) == View.MeasureSpec.AT_MOST) {\n                    const measuredWidth = this.getMeasuredWidth();\n                    this.setMeasuredDimension(Math.min(Math.max(measuredWidth, this.measureContentWidth(this.getAdapter(), this.getBackground())), View.MeasureSpec.getSize(widthMeasureSpec)), this.getMeasuredHeight());\n                }\n            }\n            onLayout(changed, l, t, r, b) {\n                super.onLayout(changed, l, t, r, b);\n                this.mInLayout = true;\n                this.layoutSpinner(0, false);\n                this.mInLayout = false;\n            }\n            layoutSpinner(delta, animate) {\n                let childrenLeft = this.mSpinnerPadding.left;\n                let childrenWidth = this.mRight - this.mLeft - this.mSpinnerPadding.left - this.mSpinnerPadding.right;\n                if (this.mDataChanged) {\n                    this.handleDataChanged();\n                }\n                if (this.mItemCount == 0) {\n                    this.resetList();\n                    return;\n                }\n                if (this.mNextSelectedPosition >= 0) {\n                    this.setSelectedPositionInt(this.mNextSelectedPosition);\n                }\n                this.recycleAllViews();\n                this.removeAllViewsInLayout();\n                this.mFirstPosition = this.mSelectedPosition;\n                if (this.mAdapter != null) {\n                    let sel = this.makeView(this.mSelectedPosition, true);\n                    let width = sel.getMeasuredWidth();\n                    let selectedOffset = childrenLeft;\n                    const layoutDirection = this.getLayoutDirection();\n                    const absoluteGravity = Gravity.getAbsoluteGravity(this.mGravity, layoutDirection);\n                    switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n                        case Gravity.CENTER_HORIZONTAL:\n                            selectedOffset = childrenLeft + (childrenWidth / 2) - (width / 2);\n                            break;\n                        case Gravity.RIGHT:\n                            selectedOffset = childrenLeft + childrenWidth - width;\n                            break;\n                    }\n                    sel.offsetLeftAndRight(selectedOffset);\n                }\n                this.mRecycler.clear();\n                this.invalidate();\n                this.checkSelectionChanged();\n                this.mDataChanged = false;\n                this.mNeedSync = false;\n                this.setNextSelectedPositionInt(this.mSelectedPosition);\n            }\n            makeView(position, addChild) {\n                let child;\n                if (!this.mDataChanged) {\n                    child = this.mRecycler.get(position);\n                    if (child != null) {\n                        this.setUpChild(child, addChild);\n                        return child;\n                    }\n                }\n                child = this.mAdapter.getView(position, null, this);\n                this.setUpChild(child, addChild);\n                return child;\n            }\n            setUpChild(child, addChild) {\n                let lp = child.getLayoutParams();\n                if (lp == null) {\n                    lp = this.generateDefaultLayoutParams();\n                }\n                if (addChild) {\n                    this.addViewInLayout(child, 0, lp);\n                }\n                child.setSelected(this.hasFocus());\n                if (this.mDisableChildrenWhenDisabled) {\n                    child.setEnabled(this.isEnabled());\n                }\n                let childHeightSpec = ViewGroup.getChildMeasureSpec(this.mHeightMeasureSpec, this.mSpinnerPadding.top + this.mSpinnerPadding.bottom, lp.height);\n                let childWidthSpec = ViewGroup.getChildMeasureSpec(this.mWidthMeasureSpec, this.mSpinnerPadding.left + this.mSpinnerPadding.right, lp.width);\n                child.measure(childWidthSpec, childHeightSpec);\n                let childLeft;\n                let childRight;\n                let childTop = this.mSpinnerPadding.top + ((this.getMeasuredHeight() - this.mSpinnerPadding.bottom - this.mSpinnerPadding.top - child.getMeasuredHeight()) / 2);\n                let childBottom = childTop + child.getMeasuredHeight();\n                let width = child.getMeasuredWidth();\n                childLeft = 0;\n                childRight = childLeft + width;\n                child.layout(childLeft, childTop, childRight, childBottom);\n            }\n            performClick() {\n                let handled = super.performClick();\n                if (!handled) {\n                    handled = true;\n                    if (!this.mPopup.isShowing()) {\n                        this.mPopup.showPopup(this.getTextDirection(), this.getTextAlignment());\n                    }\n                }\n                return handled;\n            }\n            onClick(dialog, which) {\n                this.setSelection(which);\n                dialog.dismiss();\n            }\n            setPrompt(prompt) {\n                this.mPopup.setPromptText(prompt);\n            }\n            getPrompt() {\n                return this.mPopup.getHintText();\n            }\n            measureContentWidth(adapter, background) {\n                if (adapter == null) {\n                    return 0;\n                }\n                let width = 0;\n                let itemView = null;\n                let itemType = 0;\n                const widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n                const heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n                let start = Math.max(0, this.getSelectedItemPosition());\n                const end = Math.min(adapter.getCount(), start + Spinner.MAX_ITEMS_MEASURED);\n                const count = end - start;\n                start = Math.max(0, start - (Spinner.MAX_ITEMS_MEASURED - count));\n                for (let i = start; i < end; i++) {\n                    const positionType = adapter.getItemViewType(i);\n                    if (positionType != itemType) {\n                        itemType = positionType;\n                        itemView = null;\n                    }\n                    itemView = adapter.getView(i, itemView, this);\n                    if (itemView.getLayoutParams() == null) {\n                        itemView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));\n                    }\n                    itemView.measure(widthMeasureSpec, heightMeasureSpec);\n                    width = Math.max(width, itemView.getMeasuredWidth());\n                }\n                if (background != null) {\n                    background.getPadding(this.mTempRect);\n                    width += this.mTempRect.left + this.mTempRect.right;\n                }\n                return width;\n            }\n        }\n        Spinner.TAG = \"Spinner\";\n        Spinner.MAX_ITEMS_MEASURED = 15;\n        Spinner.MODE_DIALOG = 0;\n        Spinner.MODE_DROPDOWN = 1;\n        Spinner.MODE_THEME = -1;\n        widget.Spinner = Spinner;\n        (function (Spinner) {\n            class DropDownAdapter {\n                constructor(adapter) {\n                    this.mAdapter = adapter;\n                    if (ListAdapter.isImpl(adapter)) {\n                        this.mListAdapter = adapter;\n                    }\n                }\n                getCount() {\n                    return this.mAdapter == null ? 0 : this.mAdapter.getCount();\n                }\n                getItem(position) {\n                    return this.mAdapter == null ? null : this.mAdapter.getItem(position);\n                }\n                getItemId(position) {\n                    return this.mAdapter == null ? -1 : this.mAdapter.getItemId(position);\n                }\n                getView(position, convertView, parent) {\n                    return this.getDropDownView(position, convertView, parent);\n                }\n                getDropDownView(position, convertView, parent) {\n                    return (this.mAdapter == null) ? null : this.mAdapter.getDropDownView(position, convertView, parent);\n                }\n                hasStableIds() {\n                    return this.mAdapter != null && this.mAdapter.hasStableIds();\n                }\n                registerDataSetObserver(observer) {\n                    if (this.mAdapter != null) {\n                        this.mAdapter.registerDataSetObserver(observer);\n                    }\n                }\n                unregisterDataSetObserver(observer) {\n                    if (this.mAdapter != null) {\n                        this.mAdapter.unregisterDataSetObserver(observer);\n                    }\n                }\n                areAllItemsEnabled() {\n                    const adapter = this.mListAdapter;\n                    if (adapter != null) {\n                        return adapter.areAllItemsEnabled();\n                    }\n                    else {\n                        return true;\n                    }\n                }\n                isEnabled(position) {\n                    const adapter = this.mListAdapter;\n                    if (adapter != null) {\n                        return adapter.isEnabled(position);\n                    }\n                    else {\n                        return true;\n                    }\n                }\n                getItemViewType(position) {\n                    return 0;\n                }\n                getViewTypeCount() {\n                    return 1;\n                }\n                isEmpty() {\n                    return this.getCount() == 0;\n                }\n            }\n            Spinner.DropDownAdapter = DropDownAdapter;\n            class DialogPopup {\n                constructor(arg) {\n                    this._Spinner_this = arg;\n                }\n                dismiss() {\n                    this.mPopup.dismiss();\n                    this.mPopup = null;\n                }\n                isShowing() {\n                    return this.mPopup != null ? this.mPopup.isShowing() : false;\n                }\n                setAdapter(adapter) {\n                    this.mListAdapter = adapter;\n                }\n                setPromptText(hintText) {\n                    this.mPrompt = hintText;\n                }\n                getHintText() {\n                    return this.mPrompt;\n                }\n                showPopup(textDirection, textAlignment) {\n                    if (this.mListAdapter == null) {\n                        return;\n                    }\n                    let builder = new AlertDialog.Builder(this._Spinner_this.getContext());\n                    if (this.mPrompt != null) {\n                        builder.setTitle(this.mPrompt);\n                    }\n                    this.mPopup = builder.setSingleChoiceItemsWithAdapter(this.mListAdapter, this._Spinner_this.getSelectedItemPosition(), this).create();\n                    const listView = this.mPopup.getListView();\n                    listView.setTextDirection(textDirection);\n                    listView.setTextAlignment(textAlignment);\n                    this.mPopup.show();\n                }\n                onClick(dialog, which) {\n                    this._Spinner_this.setSelection(which);\n                    if (this._Spinner_this.mOnItemClickListener != null) {\n                        this._Spinner_this.performItemClick(null, which, this.mListAdapter.getItemId(which));\n                    }\n                    this.dismiss();\n                }\n                setBackgroundDrawable(bg) {\n                    Log.e(Spinner.TAG, \"Cannot set popup background for MODE_DIALOG, ignoring\");\n                }\n                setVerticalOffset(px) {\n                    Log.e(Spinner.TAG, \"Cannot set vertical offset for MODE_DIALOG, ignoring\");\n                }\n                setHorizontalOffset(px) {\n                    Log.e(Spinner.TAG, \"Cannot set horizontal offset for MODE_DIALOG, ignoring\");\n                }\n                getBackground() {\n                    return null;\n                }\n                getVerticalOffset() {\n                    return 0;\n                }\n                getHorizontalOffset() {\n                    return 0;\n                }\n            }\n            Spinner.DialogPopup = DialogPopup;\n            class DropdownPopup extends ListPopupWindow {\n                constructor(context, defStyleRes, arg) {\n                    super(context, defStyleRes);\n                    this._Spinner_this = arg;\n                    this.setAnchorView(this._Spinner_this);\n                    this.setModal(true);\n                    this.setPromptPosition(DropdownPopup.POSITION_PROMPT_ABOVE);\n                    this.setOnItemClickListener((() => {\n                        const inner_this = this;\n                        class _Inner {\n                            onItemClick(parent, v, position, id) {\n                                inner_this._Spinner_this.setSelection(position);\n                                if (inner_this._Spinner_this.mOnItemClickListener != null) {\n                                    inner_this._Spinner_this.performItemClick(v, position, inner_this.mAdapter.getItemId(position));\n                                }\n                                inner_this.dismiss();\n                            }\n                        }\n                        return new _Inner();\n                    })());\n                }\n                setAdapter(adapter) {\n                    super.setAdapter(adapter);\n                }\n                getHintText() {\n                    return this.mHintText;\n                }\n                setPromptText(hintText) {\n                    this.mHintText = hintText;\n                }\n                computeContentWidth() {\n                    const background = this.getBackground();\n                    let hOffset = 0;\n                    if (background != null) {\n                        background.getPadding(this._Spinner_this.mTempRect);\n                        hOffset = this._Spinner_this.isLayoutRtl() ? this._Spinner_this.mTempRect.right : -this._Spinner_this.mTempRect.left;\n                    }\n                    else {\n                        this._Spinner_this.mTempRect.left = this._Spinner_this.mTempRect.right = 0;\n                    }\n                    const spinnerPaddingLeft = this._Spinner_this.getPaddingLeft();\n                    const spinnerPaddingRight = this._Spinner_this.getPaddingRight();\n                    const spinnerWidth = this._Spinner_this.getWidth();\n                    if (this._Spinner_this.mDropDownWidth == DropdownPopup.WRAP_CONTENT) {\n                        let contentWidth = this._Spinner_this.measureContentWidth(this.mAdapter, this.getBackground());\n                        const contentWidthLimit = this._Spinner_this.mContext.getResources().getDisplayMetrics().widthPixels - this._Spinner_this.mTempRect.left - this._Spinner_this.mTempRect.right;\n                        if (contentWidth > contentWidthLimit) {\n                            contentWidth = contentWidthLimit;\n                        }\n                        this.setContentWidth(Math.max(contentWidth, spinnerWidth - spinnerPaddingLeft - spinnerPaddingRight));\n                    }\n                    else if (this._Spinner_this.mDropDownWidth == DropdownPopup.MATCH_PARENT) {\n                        this.setContentWidth(spinnerWidth - spinnerPaddingLeft - spinnerPaddingRight);\n                    }\n                    else {\n                        this.setContentWidth(this._Spinner_this.mDropDownWidth);\n                    }\n                    if (this._Spinner_this.isLayoutRtl()) {\n                        hOffset += spinnerWidth - spinnerPaddingRight - this.getWidth();\n                    }\n                    else {\n                        hOffset += spinnerPaddingLeft;\n                    }\n                    this.setHorizontalOffset(hOffset);\n                }\n                showPopup(textDirection, textAlignment) {\n                    const wasShowing = this.isShowing();\n                    this.computeContentWidth();\n                    this.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NOT_NEEDED);\n                    super.show();\n                    const listView = this.getListView();\n                    listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);\n                    listView.setTextDirection(textDirection);\n                    listView.setTextAlignment(textAlignment);\n                    this.setSelection(this._Spinner_this.getSelectedItemPosition());\n                    if (wasShowing) {\n                        return;\n                    }\n                    const vto = this._Spinner_this.getViewTreeObserver();\n                    if (vto != null) {\n                        const layoutListener = (() => {\n                            const inner_this = this;\n                            class _Inner {\n                                onGlobalLayout() {\n                                    if (!inner_this._Spinner_this.isVisibleToUser()) {\n                                        inner_this.dismiss();\n                                    }\n                                    else {\n                                        inner_this.computeContentWidth();\n                                        inner_this.show();\n                                    }\n                                }\n                            }\n                            return new _Inner();\n                        })();\n                        vto.addOnGlobalLayoutListener(layoutListener);\n                        this.setOnDismissListener((() => {\n                            const inner_this = this;\n                            class _Inner {\n                                onDismiss() {\n                                    const vto = inner_this._Spinner_this.getViewTreeObserver();\n                                    if (vto != null) {\n                                        vto.removeOnGlobalLayoutListener(layoutListener);\n                                    }\n                                }\n                            }\n                            return new _Inner();\n                        })());\n                    }\n                }\n            }\n            Spinner.DropdownPopup = DropdownPopup;\n        })(Spinner = widget.Spinner || (widget.Spinner = {}));\n    })(widget = android.widget || (android.widget = {}));\n})(android || (android = {}));\nvar androidui;\n(function (androidui) {\n    var widget;\n    (function (widget) {\n        var View = android.view.View;\n        class HtmlBaseView extends View {\n            constructor(context, bindElement, defStyle) {\n                super(context, bindElement, defStyle);\n                this.mHtmlTouchAble = false;\n            }\n            onTouchEvent(event) {\n                if (this.mHtmlTouchAble) {\n                    event[android.view.ViewRootImpl.ContinueEventToDom] = true;\n                }\n                return super.onTouchEvent(event) || this.mHtmlTouchAble;\n            }\n            setHtmlTouchAble(enable) {\n                this.mHtmlTouchAble = enable;\n            }\n            isHtmlTouchAble() {\n                return this.mHtmlTouchAble;\n            }\n            dependOnDebugLayout() {\n                return true;\n            }\n        }\n        widget.HtmlBaseView = HtmlBaseView;\n    })(widget = androidui.widget || (androidui.widget = {}));\n})(androidui || (androidui = {}));\nvar android;\n(function (android) {\n    var webkit;\n    (function (webkit) {\n        class WebViewClient {\n            onPageFinished(view, url) {\n            }\n            onReceivedTitle(view, title) {\n            }\n        }\n        webkit.WebViewClient = WebViewClient;\n    })(webkit = android.webkit || (android.webkit = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var webkit;\n    (function (webkit) {\n        var HtmlBaseView = androidui.widget.HtmlBaseView;\n        class WebView extends HtmlBaseView {\n            constructor(context, bindElement, defStyle) {\n                super(context, bindElement, defStyle);\n                this.initIFrameHistoryLength = -1;\n                let density = this.getResources().getDisplayMetrics().density;\n                this.setMinimumWidth(300 * density);\n                this.setMinimumHeight(150 * density);\n            }\n            initIFrameElement(url) {\n                this.iFrameElement = document.createElement('iframe');\n                this.iFrameElement.style.border = 'none';\n                this.iFrameElement.style.height = '100%';\n                this.iFrameElement.style.width = '100%';\n                this.iFrameElement.onload = () => {\n                    this.checkActivityResume();\n                    if (this.initIFrameHistoryLength < 0)\n                        this.initIFrameHistoryLength = history.length;\n                    if (this.mClient) {\n                        this.mClient.onReceivedTitle(this, this.getTitle());\n                        this.mClient.onPageFinished(this, this.getUrl());\n                    }\n                };\n                this.bindElement.style['webkitOverflowScrolling'] = this.bindElement.style['overflowScrolling'] = 'touch';\n                this.bindElement.style.overflowY = 'auto';\n                if (url)\n                    this.iFrameElement.src = url;\n                this.bindElement.appendChild(this.iFrameElement);\n                let activity = this.getContext();\n                let onDestroy = activity.onDestroy;\n                activity.onDestroy = () => {\n                    onDestroy.call(activity);\n                    PageStack.preClosePageHasIFrame(this.initIFrameHistoryLength);\n                };\n            }\n            checkActivityResume() {\n                if (!this.getContext().mResumed) {\n                    console.error('can\\'t call any webview\\'s methods when host activity was pause');\n                }\n            }\n            goBack() {\n                this.checkActivityResume();\n                if (this.canGoBack()) {\n                    history.back();\n                }\n            }\n            canGoBack() {\n                this.checkActivityResume();\n                if (this.initIFrameHistoryLength < 0)\n                    return false;\n                return history.length > this.initIFrameHistoryLength;\n            }\n            loadUrl(url) {\n                if (this.initIFrameHistoryLength > 0) {\n                    this.checkActivityResume();\n                }\n                if (!this.iFrameElement) {\n                    this.initIFrameElement(url);\n                }\n                this.iFrameElement.src = url;\n            }\n            reload() {\n                if (!this.iFrameElement)\n                    return;\n                try {\n                    this.iFrameElement.contentWindow.location.reload();\n                }\n                catch (e) {\n                    this.iFrameElement.src = this.iFrameElement.src;\n                }\n            }\n            getUrl() {\n                if (!this.iFrameElement)\n                    return '';\n                try {\n                    return this.iFrameElement.contentWindow.document.URL;\n                }\n                catch (e) {\n                    return this.iFrameElement.src;\n                }\n            }\n            getTitle() {\n                try {\n                    return this.iFrameElement.contentWindow.document.title;\n                }\n                catch (e) {\n                    console.warn(e);\n                    return '';\n                }\n            }\n            setWebViewClient(client) {\n                this.mClient = client;\n            }\n        }\n        webkit.WebView = WebView;\n    })(webkit = android.webkit || (android.webkit = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var animation;\n        (function (animation) {\n            var Animation = android.view.animation.Animation;\n            class RotateAnimation extends Animation {\n                constructor(fromDegrees, toDegrees, pivotXType = RotateAnimation.ABSOLUTE, pivotXValue = 0, pivotYType = RotateAnimation.ABSOLUTE, pivotYValue = 0) {\n                    super();\n                    this.mFromDegrees = 0;\n                    this.mToDegrees = 0;\n                    this.mPivotXType = RotateAnimation.ABSOLUTE;\n                    this.mPivotYType = RotateAnimation.ABSOLUTE;\n                    this.mPivotXValue = 0.0;\n                    this.mPivotYValue = 0.0;\n                    this.mPivotX = 0;\n                    this.mPivotY = 0;\n                    this.mFromDegrees = fromDegrees;\n                    this.mToDegrees = toDegrees;\n                    this.mPivotXValue = pivotXValue;\n                    this.mPivotXType = pivotXType;\n                    this.mPivotYValue = pivotYValue;\n                    this.mPivotYType = pivotYType;\n                    this.initializePivotPoint();\n                }\n                initializePivotPoint() {\n                    if (this.mPivotXType == RotateAnimation.ABSOLUTE) {\n                        this.mPivotX = this.mPivotXValue;\n                    }\n                    if (this.mPivotYType == RotateAnimation.ABSOLUTE) {\n                        this.mPivotY = this.mPivotYValue;\n                    }\n                }\n                applyTransformation(interpolatedTime, t) {\n                    let degrees = this.mFromDegrees + ((this.mToDegrees - this.mFromDegrees) * interpolatedTime);\n                    let scale = this.getScaleFactor();\n                    if (this.mPivotX == 0.0 && this.mPivotY == 0.0) {\n                        t.getMatrix().setRotate(degrees);\n                    }\n                    else {\n                        t.getMatrix().setRotate(degrees, this.mPivotX * scale, this.mPivotY * scale);\n                    }\n                }\n                initialize(width, height, parentWidth, parentHeight) {\n                    super.initialize(width, height, parentWidth, parentHeight);\n                    this.mPivotX = this.resolveSize(this.mPivotXType, this.mPivotXValue, width, parentWidth);\n                    this.mPivotY = this.resolveSize(this.mPivotYType, this.mPivotYValue, height, parentHeight);\n                }\n            }\n            animation.RotateAnimation = RotateAnimation;\n        })(animation = view.animation || (view.animation = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view_6) {\n        class MenuItem {\n            constructor(menu, group, id, categoryOrder, ordering, title) {\n                this.mId = 0;\n                this.mGroup = 0;\n                this.mCategoryOrder = 0;\n                this.mOrdering = 0;\n                this.mVisible = true;\n                this.mEnable = true;\n                this.mMenu = menu;\n                this.mId = id;\n                this.mGroup = group;\n                this.mCategoryOrder = categoryOrder;\n                this.mOrdering = ordering;\n                this.mTitle = title;\n            }\n            getItemId() {\n                return this.mId;\n            }\n            getGroupId() {\n                return this.mGroup;\n            }\n            getOrder() {\n                return this.mOrdering;\n            }\n            setTitle(title) {\n                this.mTitle = title;\n                return this;\n            }\n            getTitle() {\n                return this.mTitle;\n            }\n            setIcon(icon) {\n                this.mIconDrawable = icon;\n                return this;\n            }\n            getIcon() {\n                return this.mIconDrawable;\n            }\n            setIntent(intent) {\n                this.mIntent = intent;\n                return this;\n            }\n            getIntent() {\n                return this.mIntent;\n            }\n            setVisible(visible) {\n                this.mVisible = visible;\n                return this;\n            }\n            isVisible() {\n                return this.mVisible;\n            }\n            setEnabled(enabled) {\n                this.mEnable = enabled;\n                return this;\n            }\n            isEnabled() {\n                return this.mEnable;\n            }\n            setOnMenuItemClickListener(menuItemClickListener) {\n                this.mClickListener = menuItemClickListener;\n                return this;\n            }\n            setActionView(view) {\n                this.mActionView = view;\n                return this;\n            }\n            getActionView() {\n                return this.mActionView;\n            }\n            invoke() {\n                if (this.mClickListener != null && this.mClickListener.onMenuItemClick(this)) {\n                    return true;\n                }\n                if (this.mMenu.dispatchMenuItemSelected(this.mMenu.getRootMenu(), this)) {\n                    return true;\n                }\n                if (this.mIntent != null) {\n                    try {\n                        this.mMenu.getContext().startActivity(this.mIntent);\n                        return true;\n                    }\n                    catch (e) {\n                        android.util.Log.e(\"MenuItem\", \"Can't find activity to handle intent; ignoring\", e);\n                    }\n                }\n                return false;\n            }\n        }\n        view_6.MenuItem = MenuItem;\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view) {\n        var MenuItem = android.view.MenuItem;\n        var ArrayList = java.util.ArrayList;\n        class Menu {\n            constructor(context) {\n                this.mItems = new ArrayList();\n                this.mVisibleItems = new ArrayList();\n                this.mContext = context;\n            }\n            getContext() {\n                return this.mContext;\n            }\n            add(...args) {\n                if (args.length == 1)\n                    return this.addInternal(0, 0, 0, args[0]);\n                return this.addInternal(args[0], args[1], args[2], args[3]);\n            }\n            addInternal(group, id, categoryOrder, title) {\n                const ordering = 0;\n                const item = new MenuItem(this, group, id, categoryOrder, ordering, title);\n                this.mItems.add(item);\n                this.onItemsChanged(true);\n                return item;\n            }\n            removeItem(id) {\n                this.removeItemAtInt(this.findItemIndex(id), true);\n            }\n            removeGroup(groupId) {\n                const i = this.findGroupIndex(groupId);\n                if (i >= 0) {\n                    const maxRemovable = this.mItems.size() - i;\n                    let numRemoved = 0;\n                    while ((numRemoved++ < maxRemovable) && (this.mItems.get(i).getGroupId() == groupId)) {\n                        this.removeItemAtInt(i, false);\n                    }\n                    this.onItemsChanged(true);\n                }\n            }\n            removeItemAtInt(index, updateChildrenOnMenuViews) {\n                if ((index < 0) || (index >= this.mItems.size())) {\n                    return;\n                }\n                this.mItems.remove(index);\n                if (updateChildrenOnMenuViews) {\n                    this.onItemsChanged(true);\n                }\n            }\n            clear() {\n                this.mItems.clear();\n                this.onItemsChanged(true);\n            }\n            setGroupVisible(group, visible) {\n                const N = this.mItems.size();\n                let changedAtLeastOneItem = false;\n                for (let i = 0; i < N; i++) {\n                    let item = this.mItems.get(i);\n                    if (item.getGroupId() == group) {\n                        if (item.setVisible(visible)) {\n                            changedAtLeastOneItem = true;\n                        }\n                    }\n                }\n                if (changedAtLeastOneItem) {\n                    this.onItemsChanged(true);\n                }\n            }\n            setGroupEnabled(group, enabled) {\n                const N = this.mItems.size();\n                for (let i = 0; i < N; i++) {\n                    let item = this.mItems.get(i);\n                    if (item.getGroupId() == group) {\n                        item.setEnabled(enabled);\n                    }\n                }\n            }\n            hasVisibleItems() {\n                const size = this.size();\n                for (let i = 0; i < size; i++) {\n                    let item = this.mItems.get(i);\n                    if (item.isVisible()) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n            findItem(id) {\n                const size = this.size();\n                for (let i = 0; i < size; i++) {\n                    let item = this.mItems.get(i);\n                    if (item.getItemId() == id) {\n                        return item;\n                    }\n                }\n                return null;\n            }\n            findItemIndex(id) {\n                const size = this.size();\n                for (let i = 0; i < size; i++) {\n                    let item = this.mItems.get(i);\n                    if (item.getItemId() == id) {\n                        return i;\n                    }\n                }\n                return -1;\n            }\n            findGroupIndex(group, start = 0) {\n                const size = this.size();\n                if (start < 0) {\n                    start = 0;\n                }\n                for (let i = start; i < size; i++) {\n                    const item = this.mItems.get(i);\n                    if (item.getGroupId() == group) {\n                        return i;\n                    }\n                }\n                return -1;\n            }\n            size() {\n                return this.mItems.size();\n            }\n            getItem(index) {\n                return this.mItems.get(index);\n            }\n            onItemsChanged(structureChanged) {\n            }\n            getRootMenu() {\n                return this;\n            }\n            setCallback(cb) {\n                this.mCallback = cb;\n            }\n            dispatchMenuItemSelected(menu, item) {\n                return this.mCallback != null && this.mCallback.onMenuItemSelected(menu, item);\n            }\n            getVisibleItems() {\n                this.mVisibleItems.clear();\n                const itemsSize = this.mItems.size();\n                let item;\n                for (let i = 0; i < itemsSize; i++) {\n                    item = this.mItems.get(i);\n                    if (item.isVisible()) {\n                        this.mVisibleItems.add(item);\n                    }\n                }\n                return this.mVisibleItems;\n            }\n        }\n        view.Menu = Menu;\n        (function (Menu) {\n            Menu.USER_MASK = 0x0000ffff;\n            Menu.USER_SHIFT = 0;\n            Menu.CATEGORY_MASK = 0xffff0000;\n            Menu.CATEGORY_SHIFT = 16;\n            Menu.NONE = 0;\n            Menu.FIRST = 1;\n            Menu.CATEGORY_CONTAINER = 0x00010000;\n            Menu.CATEGORY_SYSTEM = 0x00020000;\n            Menu.CATEGORY_SECONDARY = 0x00030000;\n            Menu.CATEGORY_ALTERNATIVE = 0x00040000;\n            Menu.FLAG_APPEND_TO_GROUP = 0x0001;\n            Menu.FLAG_PERFORM_NO_CLOSE = 0x0001;\n            Menu.FLAG_ALWAYS_PERFORM_CLOSE = 0x0002;\n        })(Menu = view.Menu || (view.Menu = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var view;\n    (function (view_7) {\n        var menu;\n        (function (menu_1) {\n            var R = android.R;\n            var ListPopupWindow = android.widget.ListPopupWindow;\n            var KeyEvent = android.view.KeyEvent;\n            var LayoutInflater = android.view.LayoutInflater;\n            var View = android.view.View;\n            var MeasureSpec = android.view.View.MeasureSpec;\n            var BaseAdapter = android.widget.BaseAdapter;\n            var FrameLayout = android.widget.FrameLayout;\n            var PopupWindow = android.widget.PopupWindow;\n            class MenuPopupHelper {\n                constructor(context, menu, anchorView = null) {\n                    this.mPopupMaxWidth = 0;\n                    this.mContext = context;\n                    this.mInflater = LayoutInflater.from(context);\n                    this.mMenu = menu;\n                    const res = context.getResources();\n                    this.mPopupMaxWidth = Math.max(res.getDisplayMetrics().widthPixels / 2, res.getDisplayMetrics().density * 320);\n                    this.mAnchorView = anchorView;\n                }\n                setAnchorView(anchor) {\n                    this.mAnchorView = anchor;\n                }\n                show() {\n                    if (!this.tryShow()) {\n                        throw Error(`new IllegalStateException(\"MenuPopupHelper cannot be used without an anchor\")`);\n                    }\n                }\n                tryShow() {\n                    this.mPopup = new ListPopupWindow(this.mContext, R.attr.popupMenuStyle);\n                    this.mPopup.setOnDismissListener(this);\n                    this.mPopup.setOnItemClickListener(this);\n                    this.mAdapter = new MenuPopupHelper.MenuAdapter(this.mMenu, this);\n                    this.mPopup.setAdapter(this.mAdapter);\n                    this.mPopup.setModal(true);\n                    let anchor = this.mAnchorView;\n                    if (anchor != null) {\n                        const addGlobalListener = this.mTreeObserver == null;\n                        this.mTreeObserver = anchor.getViewTreeObserver();\n                        if (addGlobalListener) {\n                            this.mTreeObserver.addOnGlobalLayoutListener(this);\n                        }\n                        this.mPopup.setAnchorView(anchor);\n                    }\n                    else {\n                        return false;\n                    }\n                    this.mPopup.setContentWidth(Math.min(this.measureContentWidth(this.mAdapter), this.mPopupMaxWidth));\n                    this.mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);\n                    this.mPopup.show();\n                    this.mPopup.getListView().setOnKeyListener(this);\n                    return true;\n                }\n                dismiss() {\n                    if (this.isShowing()) {\n                        this.mPopup.dismiss();\n                    }\n                }\n                onDismiss() {\n                    this.mPopup = null;\n                    if (this.mTreeObserver != null) {\n                        if (!this.mTreeObserver.isAlive()) {\n                            this.mTreeObserver = this.mAnchorView.getViewTreeObserver();\n                        }\n                        this.mTreeObserver.removeGlobalOnLayoutListener(this);\n                        this.mTreeObserver = null;\n                    }\n                }\n                isShowing() {\n                    return this.mPopup != null && this.mPopup.isShowing();\n                }\n                onItemClick(parent, view, position, id) {\n                    let adapter = this.mAdapter;\n                    let invoked = adapter.getItem(position).invoke();\n                    if (invoked)\n                        this.mPopup.dismiss();\n                }\n                onKey(v, keyCode, event) {\n                    if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_MENU) {\n                        this.dismiss();\n                        return true;\n                    }\n                    return false;\n                }\n                measureContentWidth(adapter) {\n                    let width = 0;\n                    let itemView = null;\n                    let itemType = 0;\n                    const widthMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);\n                    const heightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);\n                    const count = adapter.getCount();\n                    for (let i = 0; i < count; i++) {\n                        const positionType = adapter.getItemViewType(i);\n                        if (positionType != itemType) {\n                            itemType = positionType;\n                            itemView = null;\n                        }\n                        if (this.mMeasureParent == null) {\n                            this.mMeasureParent = new FrameLayout(this.mContext);\n                        }\n                        itemView = adapter.getView(i, itemView, this.mMeasureParent);\n                        itemView.measure(widthMeasureSpec, heightMeasureSpec);\n                        width = Math.max(width, itemView.getMeasuredWidth());\n                    }\n                    return width;\n                }\n                onGlobalLayout() {\n                    if (this.isShowing()) {\n                        const anchor = this.mAnchorView;\n                        if (anchor == null || !anchor.isShown()) {\n                            this.dismiss();\n                        }\n                        else if (this.isShowing()) {\n                            try {\n                                this.mPopup.setContentWidth(Math.min(this.measureContentWidth(this.mAdapter), this.mPopupMaxWidth));\n                            }\n                            catch (e) {\n                            }\n                            this.mPopup.show();\n                        }\n                    }\n                }\n            }\n            MenuPopupHelper.TAG = \"MenuPopupHelper\";\n            MenuPopupHelper.ITEM_LAYOUT = R.layout.popup_menu_item_layout;\n            menu_1.MenuPopupHelper = MenuPopupHelper;\n            (function (MenuPopupHelper) {\n                class MenuAdapter extends BaseAdapter {\n                    constructor(menu, arg) {\n                        super();\n                        this._MenuPopupHelper_this = arg;\n                        this.mAdapterMenu = menu;\n                    }\n                    getCount() {\n                        let items = this.mAdapterMenu.getVisibleItems();\n                        return items.size();\n                    }\n                    getItem(position) {\n                        let items = this.mAdapterMenu.getVisibleItems();\n                        return items.get(position);\n                    }\n                    getItemId(position) {\n                        return position;\n                    }\n                    getView(position, convertView, parent) {\n                        if (convertView == null) {\n                            convertView = this._MenuPopupHelper_this.mInflater.inflate(MenuPopupHelper.ITEM_LAYOUT, parent, false);\n                        }\n                        let itemData = this.getItem(position);\n                        convertView.setVisibility(itemData.isVisible() ? View.VISIBLE : View.GONE);\n                        let titleView = convertView.findViewById('title');\n                        titleView.setText(itemData.getTitle());\n                        let iconView = convertView.findViewById('icon');\n                        let icon = itemData.getIcon();\n                        iconView.setImageDrawable(icon);\n                        if (icon != null) {\n                            iconView.setImageDrawable(icon);\n                            iconView.setVisibility(View.VISIBLE);\n                        }\n                        else {\n                            iconView.setVisibility(View.GONE);\n                        }\n                        convertView.setEnabled(itemData.isEnabled());\n                        return convertView;\n                    }\n                    notifyDataSetChanged() {\n                        super.notifyDataSetChanged();\n                    }\n                }\n                MenuPopupHelper.MenuAdapter = MenuAdapter;\n            })(MenuPopupHelper = menu_1.MenuPopupHelper || (menu_1.MenuPopupHelper = {}));\n        })(menu = view_7.menu || (view_7.menu = {}));\n    })(view = android.view || (android.view = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var support;\n    (function (support) {\n        var v4;\n        (function (v4) {\n            var view;\n            (function (view_8) {\n                var DataSetObservable = android.database.DataSetObservable;\n                class PagerAdapter {\n                    constructor() {\n                        this.mObservable = new DataSetObservable();\n                    }\n                    startUpdate(container) {\n                    }\n                    instantiateItem(container, position) {\n                        throw new Error(\"Required method instantiateItem was not overridden\");\n                    }\n                    destroyItem(container, position, object) {\n                        throw new Error(\"Required method destroyItem was not overridden\");\n                    }\n                    setPrimaryItem(container, position, object) {\n                    }\n                    finishUpdate(container) {\n                    }\n                    getItemPosition(object) {\n                        return PagerAdapter.POSITION_UNCHANGED;\n                    }\n                    notifyDataSetChanged() {\n                        this.mObservable.notifyChanged();\n                    }\n                    registerDataSetObserver(observer) {\n                        this.mObservable.registerObserver(observer);\n                    }\n                    unregisterDataSetObserver(observer) {\n                        this.mObservable.unregisterObserver(observer);\n                    }\n                    getPageTitle(position) {\n                        return null;\n                    }\n                    getPageWidth(position) {\n                        return 1;\n                    }\n                }\n                PagerAdapter.POSITION_UNCHANGED = -1;\n                PagerAdapter.POSITION_NONE = -2;\n                view_8.PagerAdapter = PagerAdapter;\n            })(view = v4.view || (v4.view = {}));\n        })(v4 = support.v4 || (support.v4 = {}));\n    })(support = android.support || (android.support = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var support;\n    (function (support) {\n        var v4;\n        (function (v4) {\n            var view;\n            (function (view_9) {\n                var View = android.view.View;\n                var Gravity = android.view.Gravity;\n                var MeasureSpec = View.MeasureSpec;\n                var OverScroller = android.widget.OverScroller;\n                var ViewGroup = android.view.ViewGroup;\n                var ArrayList = java.util.ArrayList;\n                var Rect = android.graphics.Rect;\n                var PagerAdapter = android.support.v4.view.PagerAdapter;\n                var DataSetObserver = android.database.DataSetObserver;\n                var VelocityTracker = android.view.VelocityTracker;\n                var ViewConfiguration = android.view.ViewConfiguration;\n                var Resources = android.content.res.Resources;\n                var Log = android.util.Log;\n                var MotionEvent = android.view.MotionEvent;\n                var KeyEvent = android.view.KeyEvent;\n                const TAG = \"ViewPager\";\n                const DEBUG = false;\n                const SymbolDecor = Symbol();\n                class ViewPager extends ViewGroup {\n                    constructor(context, bindElement, defStyle) {\n                        super(context, bindElement, defStyle);\n                        this.mExpectedAdapterCount = 0;\n                        this.mItems = new ArrayList();\n                        this.mTempItem = new ItemInfo();\n                        this.mTempRect = new Rect();\n                        this.mCurItem = 0;\n                        this.mRestoredCurItem = -1;\n                        this.mPageMargin = 0;\n                        this.mTopPageBounds = 0;\n                        this.mBottomPageBounds = 0;\n                        this.mFirstOffset = -Number.MAX_VALUE;\n                        this.mLastOffset = Number.MAX_VALUE;\n                        this.mChildWidthMeasureSpec = 0;\n                        this.mChildHeightMeasureSpec = 0;\n                        this.mInLayout = false;\n                        this.mScrollingCacheEnabled = false;\n                        this.mPopulatePending = false;\n                        this.mOffscreenPageLimit = ViewPager.DEFAULT_OFFSCREEN_PAGES;\n                        this.mIsBeingDragged = false;\n                        this.mIsUnableToDrag = false;\n                        this.mDefaultGutterSize = 0;\n                        this.mGutterSize = 0;\n                        this.mLastMotionX = 0;\n                        this.mLastMotionY = 0;\n                        this.mInitialMotionX = 0;\n                        this.mInitialMotionY = 0;\n                        this.mActivePointerId = ViewPager.INVALID_POINTER;\n                        this.mMinimumVelocity = 0;\n                        this.mMaximumVelocity = 0;\n                        this.mFlingDistance = 0;\n                        this.mCloseEnough = 0;\n                        this.mFakeDragging = false;\n                        this.mFakeDragBeginTime = 0;\n                        this.mFirstLayout = true;\n                        this.mNeedCalculatePageOffsets = false;\n                        this.mCalledSuper = false;\n                        this.mDecorChildCount = 0;\n                        this.mDrawingOrder = 0;\n                        this.mEndScrollRunnable = (() => {\n                            let ViewPager_this = this;\n                            class InnerClass {\n                                run() {\n                                    ViewPager_this.setScrollState(ViewPager.SCROLL_STATE_IDLE);\n                                    ViewPager_this.populate();\n                                }\n                            }\n                            return new InnerClass();\n                        })();\n                        this.mScrollState = ViewPager.SCROLL_STATE_IDLE;\n                        this.initViewPager();\n                    }\n                    initViewPager() {\n                        this.setWillNotDraw(false);\n                        this.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);\n                        this.setFocusable(true);\n                        this.mScroller = new OverScroller(ViewPager.sInterpolator);\n                        let density = Resources.getDisplayMetrics().density;\n                        this.mTouchSlop = ViewConfiguration.get().getScaledPagingTouchSlop();\n                        this.mMinimumVelocity = Math.floor(ViewPager.MIN_FLING_VELOCITY * density);\n                        this.mMaximumVelocity = ViewConfiguration.get().getScaledMaximumFlingVelocity();\n                        this.mFlingDistance = Math.floor(ViewPager.MIN_DISTANCE_FOR_FLING * density);\n                        this.mCloseEnough = Math.floor(ViewPager.CLOSE_ENOUGH * density);\n                        this.mDefaultGutterSize = Math.floor(ViewPager.DEFAULT_GUTTER_SIZE * density);\n                    }\n                    onDetachedFromWindow() {\n                        this.removeCallbacks(this.mEndScrollRunnable);\n                        super.onDetachedFromWindow();\n                    }\n                    setScrollState(newState) {\n                        if (this.mScrollState == newState) {\n                            return;\n                        }\n                        this.mScrollState = newState;\n                        if (this.mPageTransformer != null) {\n                            this.enableLayers(newState != ViewPager.SCROLL_STATE_IDLE);\n                        }\n                        this.dispatchOnScrollStateChanged(newState);\n                    }\n                    setAdapter(adapter) {\n                        if (this.mAdapter != null) {\n                            this.mAdapter.unregisterDataSetObserver(this.mObserver);\n                            this.mAdapter.startUpdate(this);\n                            for (let i = 0; i < this.mItems.size(); i++) {\n                                const ii = this.mItems.get(i);\n                                this.mAdapter.destroyItem(this, ii.position, ii.object);\n                            }\n                            this.mAdapter.finishUpdate(this);\n                            this.mItems.clear();\n                            this.removeNonDecorViews();\n                            this.mCurItem = 0;\n                            this.scrollTo(0, 0);\n                        }\n                        const oldAdapter = this.mAdapter;\n                        this.mAdapter = adapter;\n                        this.mExpectedAdapterCount = 0;\n                        if (this.mAdapter != null) {\n                            if (this.mObserver == null) {\n                                this.mObserver = new PagerObserver(this);\n                            }\n                            this.mAdapter.registerDataSetObserver(this.mObserver);\n                            this.mPopulatePending = false;\n                            const wasFirstLayout = this.mFirstLayout;\n                            this.mFirstLayout = true;\n                            this.mExpectedAdapterCount = this.mAdapter.getCount();\n                            if (this.mRestoredCurItem >= 0) {\n                                this.setCurrentItemInternal(this.mRestoredCurItem, false, true);\n                                this.mRestoredCurItem = -1;\n                            }\n                            else if (!wasFirstLayout) {\n                                this.populate();\n                            }\n                            else {\n                                this.requestLayout();\n                            }\n                        }\n                        if (this.mAdapterChangeListener != null && oldAdapter != adapter) {\n                            this.mAdapterChangeListener.onAdapterChanged(oldAdapter, adapter);\n                        }\n                    }\n                    removeNonDecorViews() {\n                        for (let i = 0; i < this.getChildCount(); i++) {\n                            const child = this.getChildAt(i);\n                            const lp = child.getLayoutParams();\n                            if (!lp.isDecor) {\n                                this.removeViewAt(i);\n                                i--;\n                            }\n                        }\n                    }\n                    getAdapter() {\n                        return this.mAdapter;\n                    }\n                    setOnAdapterChangeListener(listener) {\n                        this.mAdapterChangeListener = listener;\n                    }\n                    getClientWidth() {\n                        return this.getMeasuredWidth() - this.getPaddingLeft() - this.getPaddingRight();\n                    }\n                    setCurrentItem(item, smoothScroll = !this.mFirstLayout) {\n                        this.mPopulatePending = false;\n                        this.setCurrentItemInternal(item, smoothScroll, false);\n                    }\n                    getCurrentItem() {\n                        return this.mCurItem;\n                    }\n                    setCurrentItemInternal(item, smoothScroll, always, velocity = 0) {\n                        if (this.mAdapter == null || this.mAdapter.getCount() <= 0) {\n                            this.setScrollingCacheEnabled(false);\n                            return;\n                        }\n                        if (!always && this.mCurItem == item && this.mItems.size() != 0) {\n                            this.setScrollingCacheEnabled(false);\n                            return;\n                        }\n                        if (item < 0) {\n                            item = 0;\n                        }\n                        else if (item >= this.mAdapter.getCount()) {\n                            item = this.mAdapter.getCount() - 1;\n                        }\n                        const pageLimit = this.mOffscreenPageLimit;\n                        if (item > (this.mCurItem + pageLimit) || item < (this.mCurItem - pageLimit)) {\n                            for (let i = 0; i < this.mItems.size(); i++) {\n                                this.mItems.get(i).scrolling = true;\n                            }\n                        }\n                        const dispatchSelected = this.mCurItem != item;\n                        if (this.mFirstLayout) {\n                            this.mCurItem = item;\n                            if (dispatchSelected) {\n                                this.dispatchOnPageSelected(item);\n                            }\n                            this.requestLayout();\n                        }\n                        else {\n                            this.populate(item);\n                            this.scrollToItem(item, smoothScroll, velocity, dispatchSelected);\n                        }\n                    }\n                    scrollToItem(item, smoothScroll, velocity, dispatchSelected) {\n                        const curInfo = this.infoForPosition(item);\n                        let destX = 0;\n                        if (curInfo != null) {\n                            const width = this.getClientWidth();\n                            destX = Math.floor(width * Math.max(this.mFirstOffset, Math.min(curInfo.offset, this.mLastOffset)));\n                        }\n                        if (smoothScroll) {\n                            this.smoothScrollTo(destX, 0, velocity);\n                            if (dispatchSelected) {\n                                this.dispatchOnPageSelected(item);\n                            }\n                        }\n                        else {\n                            if (dispatchSelected) {\n                                this.dispatchOnPageSelected(item);\n                            }\n                            this.completeScroll(false);\n                            this.scrollTo(destX, 0);\n                            this.pageScrolled(destX);\n                        }\n                    }\n                    setOnPageChangeListener(listener) {\n                        this.mOnPageChangeListener = listener;\n                    }\n                    addOnPageChangeListener(listener) {\n                        if (this.mOnPageChangeListeners == null) {\n                            this.mOnPageChangeListeners = new ArrayList();\n                        }\n                        this.mOnPageChangeListeners.add(listener);\n                    }\n                    removeOnPageChangeListener(listener) {\n                        if (this.mOnPageChangeListeners != null) {\n                            this.mOnPageChangeListeners.remove(listener);\n                        }\n                    }\n                    clearOnPageChangeListeners() {\n                        if (this.mOnPageChangeListeners != null) {\n                            this.mOnPageChangeListeners.clear();\n                        }\n                    }\n                    setPageTransformer(reverseDrawingOrder, transformer) {\n                        const hasTransformer = transformer != null;\n                        const needsPopulate = hasTransformer != (this.mPageTransformer != null);\n                        this.mPageTransformer = transformer;\n                        this.setChildrenDrawingOrderEnabledCompat(hasTransformer);\n                        if (hasTransformer) {\n                            this.mDrawingOrder = reverseDrawingOrder ? ViewPager.DRAW_ORDER_REVERSE : ViewPager.DRAW_ORDER_FORWARD;\n                        }\n                        else {\n                            this.mDrawingOrder = ViewPager.DRAW_ORDER_DEFAULT;\n                        }\n                        if (needsPopulate)\n                            this.populate();\n                    }\n                    setChildrenDrawingOrderEnabledCompat(enable = true) {\n                        this.setChildrenDrawingOrderEnabled(enable);\n                    }\n                    getChildDrawingOrder(childCount, i) {\n                        const index = this.mDrawingOrder == ViewPager.DRAW_ORDER_REVERSE ? childCount - 1 - i : i;\n                        const result = this.mDrawingOrderedChildren.get(index).getLayoutParams().childIndex;\n                        return result;\n                    }\n                    setInternalPageChangeListener(listener) {\n                        let oldListener = this.mInternalPageChangeListener;\n                        this.mInternalPageChangeListener = listener;\n                        return oldListener;\n                    }\n                    getOffscreenPageLimit() {\n                        return this.mOffscreenPageLimit;\n                    }\n                    setOffscreenPageLimit(limit) {\n                        if (limit < ViewPager.DEFAULT_OFFSCREEN_PAGES) {\n                            Log.w(TAG, \"Requested offscreen page limit \" + limit + \" too small; defaulting to \" +\n                                ViewPager.DEFAULT_OFFSCREEN_PAGES);\n                            limit = ViewPager.DEFAULT_OFFSCREEN_PAGES;\n                        }\n                        if (limit != this.mOffscreenPageLimit) {\n                            this.mOffscreenPageLimit = limit;\n                            this.populate();\n                        }\n                    }\n                    setPageMargin(marginPixels) {\n                        const oldMargin = this.mPageMargin;\n                        this.mPageMargin = marginPixels;\n                        const width = this.getWidth();\n                        this.recomputeScrollPosition(width, width, marginPixels, oldMargin);\n                        this.requestLayout();\n                    }\n                    getPageMargin() {\n                        return this.mPageMargin;\n                    }\n                    setPageMarginDrawable(d) {\n                        this.mMarginDrawable = d;\n                        if (d != null)\n                            this.refreshDrawableState();\n                        this.setWillNotDraw(d == null);\n                        this.invalidate();\n                    }\n                    verifyDrawable(who) {\n                        return super.verifyDrawable(who) || who == this.mMarginDrawable;\n                    }\n                    drawableStateChanged() {\n                        super.drawableStateChanged();\n                        const d = this.mMarginDrawable;\n                        if (d != null && d.isStateful()) {\n                            d.setState(this.getDrawableState());\n                        }\n                    }\n                    distanceInfluenceForSnapDuration(f) {\n                        f -= 0.5;\n                        f *= 0.3 * Math.PI / 2.0;\n                        return Math.sin(f);\n                    }\n                    smoothScrollTo(x, y, velocity = 0) {\n                        if (this.getChildCount() == 0) {\n                            this.setScrollingCacheEnabled(false);\n                            return;\n                        }\n                        let sx = this.getScrollX();\n                        let sy = this.getScrollY();\n                        let dx = x - sx;\n                        let dy = y - sy;\n                        if (dx == 0 && dy == 0) {\n                            this.completeScroll(false);\n                            this.populate();\n                            this.setScrollState(ViewPager.SCROLL_STATE_IDLE);\n                            return;\n                        }\n                        this.setScrollingCacheEnabled(true);\n                        this.setScrollState(ViewPager.SCROLL_STATE_SETTLING);\n                        const width = this.getClientWidth();\n                        const halfWidth = width / 2;\n                        const distanceRatio = Math.min(1, 1.0 * Math.abs(dx) / width);\n                        const distance = halfWidth + halfWidth *\n                            this.distanceInfluenceForSnapDuration(distanceRatio);\n                        let duration = 0;\n                        velocity = Math.abs(velocity);\n                        if (velocity > 0) {\n                            duration = 4 * Math.round(1000 * Math.abs(distance / velocity));\n                        }\n                        else {\n                            const pageWidth = width * this.mAdapter.getPageWidth(this.mCurItem);\n                            const pageDelta = Math.abs(dx) / (pageWidth + this.mPageMargin);\n                            duration = Math.floor((pageDelta + 1) * 100);\n                        }\n                        duration = Math.min(duration, ViewPager.MAX_SETTLE_DURATION);\n                        this.mScroller.startScroll(sx, sy, dx, dy, duration);\n                        this.postInvalidateOnAnimation();\n                    }\n                    addNewItem(position, index) {\n                        let ii = new ItemInfo();\n                        ii.position = position;\n                        ii.object = this.mAdapter.instantiateItem(this, position);\n                        ii.widthFactor = this.mAdapter.getPageWidth(position);\n                        if (index < 0 || index >= this.mItems.size()) {\n                            this.mItems.add(ii);\n                        }\n                        else {\n                            this.mItems.add(index, ii);\n                        }\n                        return ii;\n                    }\n                    dataSetChanged() {\n                        const adapterCount = this.mAdapter.getCount();\n                        this.mExpectedAdapterCount = adapterCount;\n                        let needPopulate = this.mItems.size() < this.mOffscreenPageLimit * 2 + 1 &&\n                            this.mItems.size() < adapterCount;\n                        let newCurrItem = this.mCurItem;\n                        let isUpdating = false;\n                        for (let i = 0; i < this.mItems.size(); i++) {\n                            const ii = this.mItems.get(i);\n                            const newPos = this.mAdapter.getItemPosition(ii.object);\n                            if (newPos == PagerAdapter.POSITION_UNCHANGED) {\n                                continue;\n                            }\n                            if (newPos == PagerAdapter.POSITION_NONE) {\n                                this.mItems.remove(i);\n                                i--;\n                                if (!isUpdating) {\n                                    this.mAdapter.startUpdate(this);\n                                    isUpdating = true;\n                                }\n                                this.mAdapter.destroyItem(this, ii.position, ii.object);\n                                needPopulate = true;\n                                if (this.mCurItem == ii.position) {\n                                    newCurrItem = Math.max(0, Math.min(this.mCurItem, adapterCount - 1));\n                                    needPopulate = true;\n                                }\n                                continue;\n                            }\n                            if (ii.position != newPos) {\n                                if (ii.position == this.mCurItem) {\n                                    newCurrItem = newPos;\n                                }\n                                ii.position = newPos;\n                                needPopulate = true;\n                            }\n                        }\n                        if (isUpdating) {\n                            this.mAdapter.finishUpdate(this);\n                        }\n                        this.mItems.sort(ViewPager.COMPARATOR);\n                        if (needPopulate) {\n                            const childCount = this.getChildCount();\n                            for (let i = 0; i < childCount; i++) {\n                                const child = this.getChildAt(i);\n                                const lp = child.getLayoutParams();\n                                if (!lp.isDecor) {\n                                    lp.widthFactor = 0;\n                                }\n                            }\n                            this.setCurrentItemInternal(newCurrItem, false, true);\n                            this.requestLayout();\n                        }\n                    }\n                    populate(newCurrentItem = this.mCurItem) {\n                        let oldCurInfo = null;\n                        let focusDirection = View.FOCUS_FORWARD;\n                        if (this.mCurItem != newCurrentItem) {\n                            focusDirection = this.mCurItem < newCurrentItem ? View.FOCUS_RIGHT : View.FOCUS_LEFT;\n                            oldCurInfo = this.infoForPosition(this.mCurItem);\n                            this.mCurItem = newCurrentItem;\n                        }\n                        if (this.mAdapter == null) {\n                            this.sortChildDrawingOrder();\n                            return;\n                        }\n                        if (this.mPopulatePending) {\n                            if (DEBUG)\n                                Log.i(TAG, \"populate is pending, skipping for now...\");\n                            this.sortChildDrawingOrder();\n                            return;\n                        }\n                        if (!this.isAttachedToWindow()) {\n                            return;\n                        }\n                        this.mAdapter.startUpdate(this);\n                        const pageLimit = this.mOffscreenPageLimit;\n                        const startPos = Math.max(0, this.mCurItem - pageLimit);\n                        const N = this.mAdapter.getCount();\n                        const endPos = Math.min(N - 1, this.mCurItem + pageLimit);\n                        if (N != this.mExpectedAdapterCount) {\n                            throw new Error(\"The application's PagerAdapter changed the adapter's\" +\n                                \" contents without calling PagerAdapter#notifyDataSetChanged!\" +\n                                \" Expected adapter item count: \" + this.mExpectedAdapterCount + \", found: \" + N +\n                                \" Pager id: \" + this.getId() +\n                                \" Pager class: \" + this.constructor.name +\n                                \" Problematic adapter: \" + this.mAdapter.constructor.name);\n                        }\n                        let curIndex = -1;\n                        let curItem = null;\n                        for (curIndex = 0; curIndex < this.mItems.size(); curIndex++) {\n                            const ii = this.mItems.get(curIndex);\n                            if (ii.position >= this.mCurItem) {\n                                if (ii.position == this.mCurItem)\n                                    curItem = ii;\n                                break;\n                            }\n                        }\n                        if (curItem == null && N > 0) {\n                            curItem = this.addNewItem(this.mCurItem, curIndex);\n                        }\n                        if (curItem != null) {\n                            let extraWidthLeft = 0;\n                            let itemIndex = curIndex - 1;\n                            let ii = itemIndex >= 0 ? this.mItems.get(itemIndex) : null;\n                            const clientWidth = this.getClientWidth();\n                            const leftWidthNeeded = clientWidth <= 0 ? 0 :\n                                2 - curItem.widthFactor + this.getPaddingLeft() / clientWidth;\n                            for (let pos = this.mCurItem - 1; pos >= 0; pos--) {\n                                if (extraWidthLeft >= leftWidthNeeded && pos < startPos) {\n                                    if (ii == null) {\n                                        break;\n                                    }\n                                    if (pos == ii.position && !ii.scrolling) {\n                                        this.mItems.remove(itemIndex);\n                                        this.mAdapter.destroyItem(this, pos, ii.object);\n                                        if (DEBUG) {\n                                            Log.i(TAG, \"populate() - destroyItem() with pos: \" + pos +\n                                                \" view: \" + ii.object);\n                                        }\n                                        itemIndex--;\n                                        curIndex--;\n                                        ii = itemIndex >= 0 ? this.mItems.get(itemIndex) : null;\n                                    }\n                                }\n                                else if (ii != null && pos == ii.position) {\n                                    extraWidthLeft += ii.widthFactor;\n                                    itemIndex--;\n                                    ii = itemIndex >= 0 ? this.mItems.get(itemIndex) : null;\n                                }\n                                else {\n                                    ii = this.addNewItem(pos, itemIndex + 1);\n                                    extraWidthLeft += ii.widthFactor;\n                                    curIndex++;\n                                    ii = itemIndex >= 0 ? this.mItems.get(itemIndex) : null;\n                                }\n                            }\n                            let extraWidthRight = curItem.widthFactor;\n                            itemIndex = curIndex + 1;\n                            if (extraWidthRight < 2) {\n                                ii = itemIndex < this.mItems.size() ? this.mItems.get(itemIndex) : null;\n                                const rightWidthNeeded = clientWidth <= 0 ? 0 :\n                                    this.getPaddingRight() / clientWidth + 2;\n                                for (let pos = this.mCurItem + 1; pos < N; pos++) {\n                                    if (extraWidthRight >= rightWidthNeeded && pos > endPos) {\n                                        if (ii == null) {\n                                            break;\n                                        }\n                                        if (pos == ii.position && !ii.scrolling) {\n                                            this.mItems.remove(itemIndex);\n                                            this.mAdapter.destroyItem(this, pos, ii.object);\n                                            if (DEBUG) {\n                                                Log.i(TAG, \"populate() - destroyItem() with pos: \" + pos +\n                                                    \" view: \" + ii.object);\n                                            }\n                                            ii = itemIndex < this.mItems.size() ? this.mItems.get(itemIndex) : null;\n                                        }\n                                    }\n                                    else if (ii != null && pos == ii.position) {\n                                        extraWidthRight += ii.widthFactor;\n                                        itemIndex++;\n                                        ii = itemIndex < this.mItems.size() ? this.mItems.get(itemIndex) : null;\n                                    }\n                                    else {\n                                        ii = this.addNewItem(pos, itemIndex);\n                                        itemIndex++;\n                                        extraWidthRight += ii.widthFactor;\n                                        ii = itemIndex < this.mItems.size() ? this.mItems.get(itemIndex) : null;\n                                    }\n                                }\n                            }\n                            this.calculatePageOffsets(curItem, curIndex, oldCurInfo);\n                        }\n                        if (DEBUG) {\n                            Log.i(TAG, \"Current page list:\");\n                            for (let i = 0; i < this.mItems.size(); i++) {\n                                Log.i(TAG, \"#\" + i + \": page \" + this.mItems.get(i).position);\n                            }\n                        }\n                        this.mAdapter.setPrimaryItem(this, this.mCurItem, curItem != null ? curItem.object : null);\n                        this.mAdapter.finishUpdate(this);\n                        const childCount = this.getChildCount();\n                        for (let i = 0; i < childCount; i++) {\n                            const child = this.getChildAt(i);\n                            const lp = child.getLayoutParams();\n                            lp.childIndex = i;\n                            if (!lp.isDecor && lp.widthFactor == 0) {\n                                const ii = this.infoForChild(child);\n                                if (ii != null) {\n                                    lp.widthFactor = ii.widthFactor;\n                                    lp.position = ii.position;\n                                }\n                            }\n                        }\n                        this.sortChildDrawingOrder();\n                        if (this.hasFocus()) {\n                            let currentFocused = this.findFocus();\n                            let ii = currentFocused != null ? this.infoForAnyChild(currentFocused) : null;\n                            if (ii == null || ii.position != this.mCurItem) {\n                                for (let i = 0; i < this.getChildCount(); i++) {\n                                    let child = this.getChildAt(i);\n                                    ii = this.infoForChild(child);\n                                    if (ii != null && ii.position == this.mCurItem) {\n                                        if (child.requestFocus(focusDirection)) {\n                                            break;\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                    }\n                    sortChildDrawingOrder() {\n                        if (this.mDrawingOrder != ViewPager.DRAW_ORDER_DEFAULT) {\n                            if (this.mDrawingOrderedChildren == null) {\n                                this.mDrawingOrderedChildren = new ArrayList();\n                            }\n                            else {\n                                this.mDrawingOrderedChildren.clear();\n                            }\n                            const childCount = this.getChildCount();\n                            for (let i = 0; i < childCount; i++) {\n                                const child = this.getChildAt(i);\n                                this.mDrawingOrderedChildren.add(child);\n                            }\n                            this.mDrawingOrderedChildren.sort(ViewPager.sPositionComparator);\n                        }\n                    }\n                    calculatePageOffsets(curItem, curIndex, oldCurInfo) {\n                        const N = this.mAdapter.getCount();\n                        const width = this.getClientWidth();\n                        const marginOffset = width > 0 ? this.mPageMargin / width : 0;\n                        if (oldCurInfo != null) {\n                            const oldCurPosition = oldCurInfo.position;\n                            if (oldCurPosition < curItem.position) {\n                                let itemIndex = 0;\n                                let ii = null;\n                                let offset = oldCurInfo.offset + oldCurInfo.widthFactor + marginOffset;\n                                for (let pos = oldCurPosition + 1; pos <= curItem.position && itemIndex < this.mItems.size(); pos++) {\n                                    ii = this.mItems.get(itemIndex);\n                                    while (pos > ii.position && itemIndex < this.mItems.size() - 1) {\n                                        itemIndex++;\n                                        ii = this.mItems.get(itemIndex);\n                                    }\n                                    while (pos < ii.position) {\n                                        offset += this.mAdapter.getPageWidth(pos) + marginOffset;\n                                        pos++;\n                                    }\n                                    ii.offset = offset;\n                                    offset += ii.widthFactor + marginOffset;\n                                }\n                            }\n                            else if (oldCurPosition > curItem.position) {\n                                let itemIndex = this.mItems.size() - 1;\n                                let ii = null;\n                                let offset = oldCurInfo.offset;\n                                for (let pos = oldCurPosition - 1; pos >= curItem.position && itemIndex >= 0; pos--) {\n                                    ii = this.mItems.get(itemIndex);\n                                    while (pos < ii.position && itemIndex > 0) {\n                                        itemIndex--;\n                                        ii = this.mItems.get(itemIndex);\n                                    }\n                                    while (pos > ii.position) {\n                                        offset -= this.mAdapter.getPageWidth(pos) + marginOffset;\n                                        pos--;\n                                    }\n                                    offset -= ii.widthFactor + marginOffset;\n                                    ii.offset = offset;\n                                }\n                            }\n                        }\n                        const itemCount = this.mItems.size();\n                        let offset = curItem.offset;\n                        let pos = curItem.position - 1;\n                        this.mFirstOffset = curItem.position == 0 ? curItem.offset : -Number.MAX_VALUE;\n                        this.mLastOffset = curItem.position == N - 1 ?\n                            curItem.offset + curItem.widthFactor - 1 : Number.MAX_VALUE;\n                        for (let i = curIndex - 1; i >= 0; i--, pos--) {\n                            const ii = this.mItems.get(i);\n                            while (pos > ii.position) {\n                                offset -= this.mAdapter.getPageWidth(pos--) + marginOffset;\n                            }\n                            offset -= ii.widthFactor + marginOffset;\n                            ii.offset = offset;\n                            if (ii.position == 0)\n                                this.mFirstOffset = offset;\n                        }\n                        offset = curItem.offset + curItem.widthFactor + marginOffset;\n                        pos = curItem.position + 1;\n                        for (let i = curIndex + 1; i < itemCount; i++, pos++) {\n                            const ii = this.mItems.get(i);\n                            while (pos < ii.position) {\n                                offset += this.mAdapter.getPageWidth(pos++) + marginOffset;\n                            }\n                            if (ii.position == N - 1) {\n                                this.mLastOffset = offset + ii.widthFactor - 1;\n                            }\n                            ii.offset = offset;\n                            offset += ii.widthFactor + marginOffset;\n                        }\n                        this.mNeedCalculatePageOffsets = false;\n                    }\n                    addView(...args) {\n                        if (args.length === 3 && args[2] instanceof ViewGroup.LayoutParams) {\n                            this._addViewOverride(args[0], args[1], args[2]);\n                        }\n                        else {\n                            super.addView(...args);\n                        }\n                    }\n                    _addViewOverride(child, index, params) {\n                        if (!this.checkLayoutParams(params)) {\n                            params = this.generateLayoutParams(params);\n                        }\n                        const lp = params;\n                        lp.isDecor = lp.isDecor || ViewPager.isImplDecor(child);\n                        if (this.mInLayout) {\n                            if (lp != null && lp.isDecor) {\n                                throw new Error(\"Cannot add pager decor view during layout\");\n                            }\n                            lp.needsMeasure = true;\n                            this.addViewInLayout(child, index, params);\n                        }\n                        else {\n                            super.addView(child, index, params);\n                        }\n                        if (ViewPager.USE_CACHE) {\n                            if (child.getVisibility() != View.GONE) {\n                                child.setDrawingCacheEnabled(this.mScrollingCacheEnabled);\n                            }\n                            else {\n                                child.setDrawingCacheEnabled(false);\n                            }\n                        }\n                    }\n                    removeView(view) {\n                        if (this.mInLayout) {\n                            this.removeViewInLayout(view);\n                        }\n                        else {\n                            super.removeView(view);\n                        }\n                    }\n                    infoForChild(child) {\n                        for (let i = 0; i < this.mItems.size(); i++) {\n                            let ii = this.mItems.get(i);\n                            if (this.mAdapter.isViewFromObject(child, ii.object)) {\n                                return ii;\n                            }\n                        }\n                        return null;\n                    }\n                    infoForAnyChild(child) {\n                        let parent;\n                        while ((parent = child.getParent()) != this) {\n                            if (parent == null || !(parent instanceof View)) {\n                                return null;\n                            }\n                            child = parent;\n                        }\n                        return this.infoForChild(child);\n                    }\n                    infoForPosition(position) {\n                        for (let i = 0; i < this.mItems.size(); i++) {\n                            let ii = this.mItems.get(i);\n                            if (ii.position == position) {\n                                return ii;\n                            }\n                        }\n                        return null;\n                    }\n                    onAttachedToWindow() {\n                        super.onAttachedToWindow();\n                        this.mFirstLayout = true;\n                    }\n                    onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                        this.setMeasuredDimension(ViewPager.getDefaultSize(0, widthMeasureSpec), ViewPager.getDefaultSize(0, heightMeasureSpec));\n                        const measuredWidth = this.getMeasuredWidth();\n                        const maxGutterSize = measuredWidth / 10;\n                        this.mGutterSize = Math.min(maxGutterSize, this.mDefaultGutterSize);\n                        let childWidthSize = measuredWidth - this.getPaddingLeft() - this.getPaddingRight();\n                        let childHeightSize = this.getMeasuredHeight() - this.getPaddingTop() - this.getPaddingBottom();\n                        let size = this.getChildCount();\n                        for (let i = 0; i < size; ++i) {\n                            const child = this.getChildAt(i);\n                            if (child.getVisibility() != View.GONE) {\n                                const lp = child.getLayoutParams();\n                                if (lp != null && lp.isDecor) {\n                                    const hgrav = lp.gravity & Gravity.HORIZONTAL_GRAVITY_MASK;\n                                    const vgrav = lp.gravity & Gravity.VERTICAL_GRAVITY_MASK;\n                                    let widthMode = MeasureSpec.AT_MOST;\n                                    let heightMode = MeasureSpec.AT_MOST;\n                                    let consumeVertical = vgrav == Gravity.TOP || vgrav == Gravity.BOTTOM;\n                                    let consumeHorizontal = hgrav == Gravity.LEFT || hgrav == Gravity.RIGHT;\n                                    if (consumeVertical) {\n                                        widthMode = MeasureSpec.EXACTLY;\n                                    }\n                                    else if (consumeHorizontal) {\n                                        heightMode = MeasureSpec.EXACTLY;\n                                    }\n                                    let widthSize = childWidthSize;\n                                    let heightSize = childHeightSize;\n                                    if (lp.width != ViewPager.LayoutParams.WRAP_CONTENT) {\n                                        widthMode = MeasureSpec.EXACTLY;\n                                        if (lp.width != ViewPager.LayoutParams.FILL_PARENT) {\n                                            widthSize = lp.width;\n                                        }\n                                    }\n                                    if (lp.height != ViewPager.LayoutParams.WRAP_CONTENT) {\n                                        heightMode = MeasureSpec.EXACTLY;\n                                        if (lp.height != ViewPager.LayoutParams.FILL_PARENT) {\n                                            heightSize = lp.height;\n                                        }\n                                    }\n                                    const widthSpec = MeasureSpec.makeMeasureSpec(widthSize, widthMode);\n                                    const heightSpec = MeasureSpec.makeMeasureSpec(heightSize, heightMode);\n                                    child.measure(widthSpec, heightSpec);\n                                    if (consumeVertical) {\n                                        childHeightSize -= child.getMeasuredHeight();\n                                    }\n                                    else if (consumeHorizontal) {\n                                        childWidthSize -= child.getMeasuredWidth();\n                                    }\n                                }\n                            }\n                        }\n                        this.mChildWidthMeasureSpec = MeasureSpec.makeMeasureSpec(childWidthSize, MeasureSpec.EXACTLY);\n                        this.mChildHeightMeasureSpec = MeasureSpec.makeMeasureSpec(childHeightSize, MeasureSpec.EXACTLY);\n                        this.mInLayout = true;\n                        this.populate();\n                        this.mInLayout = false;\n                        size = this.getChildCount();\n                        for (let i = 0; i < size; ++i) {\n                            const child = this.getChildAt(i);\n                            if (child.getVisibility() != View.GONE) {\n                                if (DEBUG)\n                                    Log.v(TAG, \"Measuring #\" + i + \" \" + child\n                                        + \": \" + this.mChildWidthMeasureSpec);\n                                const lp = child.getLayoutParams();\n                                if (lp == null || !lp.isDecor) {\n                                    const widthSpec = MeasureSpec.makeMeasureSpec((childWidthSize * lp.widthFactor), MeasureSpec.EXACTLY);\n                                    child.measure(widthSpec, this.mChildHeightMeasureSpec);\n                                }\n                            }\n                        }\n                    }\n                    onSizeChanged(w, h, oldw, oldh) {\n                        super.onSizeChanged(w, h, oldw, oldh);\n                        if (w != oldw) {\n                            this.recomputeScrollPosition(w, oldw, this.mPageMargin, this.mPageMargin);\n                        }\n                    }\n                    recomputeScrollPosition(width, oldWidth, margin, oldMargin) {\n                        if (oldWidth > 0 && !this.mItems.isEmpty()) {\n                            const widthWithMargin = width - this.getPaddingLeft() - this.getPaddingRight() + margin;\n                            const oldWidthWithMargin = oldWidth - this.getPaddingLeft() - this.getPaddingRight()\n                                + oldMargin;\n                            const xpos = this.getScrollX();\n                            const pageOffset = xpos / oldWidthWithMargin;\n                            const newOffsetPixels = Math.floor(pageOffset * widthWithMargin);\n                            this.scrollTo(newOffsetPixels, this.getScrollY());\n                            if (!this.mScroller.isFinished()) {\n                                const newDuration = this.mScroller.getDuration() - this.mScroller.timePassed();\n                                let targetInfo = this.infoForPosition(this.mCurItem);\n                                this.mScroller.startScroll(newOffsetPixels, 0, Math.floor(targetInfo.offset * width), 0, newDuration);\n                            }\n                        }\n                        else {\n                            const ii = this.infoForPosition(this.mCurItem);\n                            const scrollOffset = ii != null ? Math.min(ii.offset, this.mLastOffset) : 0;\n                            const scrollPos = Math.floor(scrollOffset *\n                                (width - this.getPaddingLeft() - this.getPaddingRight()));\n                            if (scrollPos != this.getScrollX()) {\n                                this.completeScroll(false);\n                                this.scrollTo(scrollPos, this.getScrollY());\n                            }\n                        }\n                    }\n                    onLayout(changed, l, t, r, b) {\n                        const count = this.getChildCount();\n                        let width = r - l;\n                        let height = b - t;\n                        let paddingLeft = this.getPaddingLeft();\n                        let paddingTop = this.getPaddingTop();\n                        let paddingRight = this.getPaddingRight();\n                        let paddingBottom = this.getPaddingBottom();\n                        const scrollX = this.getScrollX();\n                        let decorCount = 0;\n                        for (let i = 0; i < count; i++) {\n                            const child = this.getChildAt(i);\n                            if (child.getVisibility() != View.GONE) {\n                                const lp = child.getLayoutParams();\n                                let childLeft = 0;\n                                let childTop = 0;\n                                if (lp.isDecor) {\n                                    const hgrav = lp.gravity & Gravity.HORIZONTAL_GRAVITY_MASK;\n                                    const vgrav = lp.gravity & Gravity.VERTICAL_GRAVITY_MASK;\n                                    switch (hgrav) {\n                                        default:\n                                            childLeft = paddingLeft;\n                                            break;\n                                        case Gravity.LEFT:\n                                            childLeft = paddingLeft;\n                                            paddingLeft += child.getMeasuredWidth();\n                                            break;\n                                        case Gravity.CENTER_HORIZONTAL:\n                                            childLeft = Math.max((width - child.getMeasuredWidth()) / 2, paddingLeft);\n                                            break;\n                                        case Gravity.RIGHT:\n                                            childLeft = width - paddingRight - child.getMeasuredWidth();\n                                            paddingRight += child.getMeasuredWidth();\n                                            break;\n                                    }\n                                    switch (vgrav) {\n                                        default:\n                                            childTop = paddingTop;\n                                            break;\n                                        case Gravity.TOP:\n                                            childTop = paddingTop;\n                                            paddingTop += child.getMeasuredHeight();\n                                            break;\n                                        case Gravity.CENTER_VERTICAL:\n                                            childTop = Math.max((height - child.getMeasuredHeight()) / 2, paddingTop);\n                                            break;\n                                        case Gravity.BOTTOM:\n                                            childTop = height - paddingBottom - child.getMeasuredHeight();\n                                            paddingBottom += child.getMeasuredHeight();\n                                            break;\n                                    }\n                                    childLeft += scrollX;\n                                    child.layout(childLeft, childTop, childLeft + child.getMeasuredWidth(), childTop + child.getMeasuredHeight());\n                                    decorCount++;\n                                }\n                            }\n                        }\n                        const childWidth = width - paddingLeft - paddingRight;\n                        for (let i = 0; i < count; i++) {\n                            const child = this.getChildAt(i);\n                            if (child.getVisibility() != View.GONE) {\n                                const lp = child.getLayoutParams();\n                                let ii;\n                                if (!lp.isDecor && (ii = this.infoForChild(child)) != null) {\n                                    let loff = Math.floor(childWidth * ii.offset);\n                                    let childLeft = paddingLeft + loff;\n                                    let childTop = paddingTop;\n                                    if (lp.needsMeasure) {\n                                        lp.needsMeasure = false;\n                                        const widthSpec = MeasureSpec.makeMeasureSpec(Math.floor(childWidth * lp.widthFactor), MeasureSpec.EXACTLY);\n                                        const heightSpec = MeasureSpec.makeMeasureSpec(Math.floor(height - paddingTop - paddingBottom), MeasureSpec.EXACTLY);\n                                        child.measure(widthSpec, heightSpec);\n                                    }\n                                    if (DEBUG)\n                                        Log.v(TAG, \"Positioning #\" + i + \" \" + child + \" f=\" + ii.object\n                                            + \":\" + childLeft + \",\" + childTop + \" \" + child.getMeasuredWidth()\n                                            + \"x\" + child.getMeasuredHeight());\n                                    child.layout(childLeft, childTop, childLeft + child.getMeasuredWidth(), childTop + child.getMeasuredHeight());\n                                }\n                            }\n                        }\n                        this.mTopPageBounds = paddingTop;\n                        this.mBottomPageBounds = height - paddingBottom;\n                        this.mDecorChildCount = decorCount;\n                        if (this.mFirstLayout) {\n                            this.scrollToItem(this.mCurItem, false, 0, false);\n                        }\n                        this.mFirstLayout = false;\n                    }\n                    computeScroll() {\n                        if (!this.mScroller.isFinished() && this.mScroller.computeScrollOffset()) {\n                            let oldX = this.getScrollX();\n                            let oldY = this.getScrollY();\n                            let x = this.mScroller.getCurrX();\n                            let y = this.mScroller.getCurrY();\n                            if (oldX != x || oldY != y) {\n                                this.scrollTo(x, y);\n                                if (!this.pageScrolled(x)) {\n                                    this.mScroller.abortAnimation();\n                                    this.scrollTo(0, y);\n                                }\n                            }\n                            this.postInvalidateOnAnimation();\n                            return;\n                        }\n                        this.completeScroll(true);\n                    }\n                    pageScrolled(xpos) {\n                        if (this.mItems.size() == 0) {\n                            this.mCalledSuper = false;\n                            this.onPageScrolled(0, 0, 0);\n                            if (!this.mCalledSuper) {\n                                throw new Error(\"onPageScrolled did not call superclass implementation\");\n                            }\n                            return false;\n                        }\n                        const ii = this.infoForCurrentScrollPosition();\n                        const width = this.getClientWidth();\n                        const widthWithMargin = width + this.mPageMargin;\n                        const marginOffset = this.mPageMargin / width;\n                        const currentPage = ii.position;\n                        const pageOffset = ((xpos / width) - ii.offset) / (ii.widthFactor + marginOffset);\n                        const offsetPixels = Math.floor(pageOffset * widthWithMargin);\n                        this.mCalledSuper = false;\n                        this.onPageScrolled(currentPage, pageOffset, offsetPixels);\n                        if (!this.mCalledSuper) {\n                            throw new Error(\"onPageScrolled did not call superclass implementation\");\n                        }\n                        return true;\n                    }\n                    onPageScrolled(position, offset, offsetPixels) {\n                        if (this.mDecorChildCount > 0) {\n                            const scrollX = this.getScrollX();\n                            let paddingLeft = this.getPaddingLeft();\n                            let paddingRight = this.getPaddingRight();\n                            const width = this.getWidth();\n                            const childCount = this.getChildCount();\n                            for (let i = 0; i < childCount; i++) {\n                                const child = this.getChildAt(i);\n                                const lp = child.getLayoutParams();\n                                if (!lp.isDecor)\n                                    continue;\n                                const hgrav = lp.gravity & Gravity.HORIZONTAL_GRAVITY_MASK;\n                                let childLeft = 0;\n                                switch (hgrav) {\n                                    default:\n                                        childLeft = paddingLeft;\n                                        break;\n                                    case Gravity.LEFT:\n                                        childLeft = paddingLeft;\n                                        paddingLeft += child.getWidth();\n                                        break;\n                                    case Gravity.CENTER_HORIZONTAL:\n                                        childLeft = Math.max((width - child.getMeasuredWidth()) / 2, paddingLeft);\n                                        break;\n                                    case Gravity.RIGHT:\n                                        childLeft = width - paddingRight - child.getMeasuredWidth();\n                                        paddingRight += child.getMeasuredWidth();\n                                        break;\n                                }\n                                childLeft += scrollX;\n                                const childOffset = childLeft - child.getLeft();\n                                if (childOffset != 0) {\n                                    child.offsetLeftAndRight(childOffset);\n                                }\n                            }\n                        }\n                        this.dispatchOnPageScrolled(position, offset, offsetPixels);\n                        if (this.mPageTransformer != null) {\n                            const scrollX = this.getScrollX();\n                            const childCount = this.getChildCount();\n                            for (let i = 0; i < childCount; i++) {\n                                const child = this.getChildAt(i);\n                                const lp = child.getLayoutParams();\n                                if (lp.isDecor)\n                                    continue;\n                                const transformPos = (child.getLeft() - scrollX) / this.getClientWidth();\n                                this.mPageTransformer.transformPage(child, transformPos);\n                            }\n                        }\n                        this.mCalledSuper = true;\n                    }\n                    dispatchOnPageScrolled(position, offset, offsetPixels) {\n                        if (this.mOnPageChangeListener != null) {\n                            this.mOnPageChangeListener.onPageScrolled(position, offset, offsetPixels);\n                        }\n                        if (this.mOnPageChangeListeners != null) {\n                            for (let i = 0, z = this.mOnPageChangeListeners.size(); i < z; i++) {\n                                let listener = this.mOnPageChangeListeners.get(i);\n                                if (listener != null) {\n                                    listener.onPageScrolled(position, offset, offsetPixels);\n                                }\n                            }\n                        }\n                        if (this.mInternalPageChangeListener != null) {\n                            this.mInternalPageChangeListener.onPageScrolled(position, offset, offsetPixels);\n                        }\n                    }\n                    dispatchOnPageSelected(position) {\n                        if (this.mOnPageChangeListener != null) {\n                            this.mOnPageChangeListener.onPageSelected(position);\n                        }\n                        if (this.mOnPageChangeListeners != null) {\n                            for (let i = 0, z = this.mOnPageChangeListeners.size(); i < z; i++) {\n                                let listener = this.mOnPageChangeListeners.get(i);\n                                if (listener != null) {\n                                    listener.onPageSelected(position);\n                                }\n                            }\n                        }\n                        if (this.mInternalPageChangeListener != null) {\n                            this.mInternalPageChangeListener.onPageSelected(position);\n                        }\n                    }\n                    dispatchOnScrollStateChanged(state) {\n                        if (this.mOnPageChangeListener != null) {\n                            this.mOnPageChangeListener.onPageScrollStateChanged(state);\n                        }\n                        if (this.mOnPageChangeListeners != null) {\n                            for (let i = 0, z = this.mOnPageChangeListeners.size(); i < z; i++) {\n                                let listener = this.mOnPageChangeListeners.get(i);\n                                if (listener != null) {\n                                    listener.onPageScrollStateChanged(state);\n                                }\n                            }\n                        }\n                        if (this.mInternalPageChangeListener != null) {\n                            this.mInternalPageChangeListener.onPageScrollStateChanged(state);\n                        }\n                    }\n                    completeScroll(postEvents) {\n                        let needPopulate = this.mScrollState == ViewPager.SCROLL_STATE_SETTLING;\n                        if (needPopulate) {\n                            this.setScrollingCacheEnabled(false);\n                            this.mScroller.abortAnimation();\n                            let oldX = this.getScrollX();\n                            let oldY = this.getScrollY();\n                            let x = this.mScroller.getCurrX();\n                            let y = this.mScroller.getCurrY();\n                            if (oldX != x || oldY != y) {\n                                this.scrollTo(x, y);\n                                if (x != oldX) {\n                                    this.pageScrolled(x);\n                                }\n                            }\n                        }\n                        this.mPopulatePending = false;\n                        for (let i = 0; i < this.mItems.size(); i++) {\n                            let ii = this.mItems.get(i);\n                            if (ii.scrolling) {\n                                needPopulate = true;\n                                ii.scrolling = false;\n                            }\n                        }\n                        if (needPopulate) {\n                            if (postEvents) {\n                                this.postOnAnimation(this.mEndScrollRunnable);\n                            }\n                            else {\n                                this.mEndScrollRunnable.run();\n                            }\n                        }\n                    }\n                    isGutterDrag(x, dx) {\n                        return (x < this.mGutterSize && dx > 0) || (x > this.getWidth() - this.mGutterSize && dx < 0);\n                    }\n                    enableLayers(enable) {\n                    }\n                    onInterceptTouchEvent(ev) {\n                        const action = ev.getAction() & MotionEvent.ACTION_MASK;\n                        if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP) {\n                            if (DEBUG)\n                                Log.v(TAG, \"Intercept done!\");\n                            this.resetTouch();\n                            return false;\n                        }\n                        if (action != MotionEvent.ACTION_DOWN) {\n                            if (this.mIsBeingDragged) {\n                                if (DEBUG)\n                                    Log.v(TAG, \"Intercept returning true!\");\n                                return true;\n                            }\n                            if (this.mIsUnableToDrag) {\n                                if (DEBUG)\n                                    Log.v(TAG, \"Intercept returning false!\");\n                                return false;\n                            }\n                        }\n                        switch (action) {\n                            case MotionEvent.ACTION_MOVE: {\n                                const activePointerId = this.mActivePointerId;\n                                if (activePointerId == ViewPager.INVALID_POINTER) {\n                                    break;\n                                }\n                                const pointerIndex = ev.findPointerIndex(activePointerId);\n                                const x = ev.getX(pointerIndex);\n                                const dx = x - this.mLastMotionX;\n                                const xDiff = Math.abs(dx);\n                                const y = ev.getY(pointerIndex);\n                                const yDiff = Math.abs(y - this.mInitialMotionY);\n                                if (DEBUG)\n                                    Log.v(TAG, \"Moved x to \" + x + \",\" + y + \" diff=\" + xDiff + \",\" + yDiff);\n                                if (dx != 0 && !this.isGutterDrag(this.mLastMotionX, dx) &&\n                                    this.canScroll(this, false, Math.floor(dx), Math.floor(x), Math.floor(y))) {\n                                    this.mLastMotionX = x;\n                                    this.mLastMotionY = y;\n                                    this.mIsUnableToDrag = true;\n                                    return false;\n                                }\n                                if (xDiff > this.mTouchSlop && xDiff * 0.5 > yDiff) {\n                                    if (DEBUG)\n                                        Log.v(TAG, \"Starting drag!\");\n                                    this.mIsBeingDragged = true;\n                                    this.requestParentDisallowInterceptTouchEvent(true);\n                                    this.setScrollState(ViewPager.SCROLL_STATE_DRAGGING);\n                                    this.mLastMotionX = dx > 0 ? this.mInitialMotionX + this.mTouchSlop :\n                                        this.mInitialMotionX - this.mTouchSlop;\n                                    this.mLastMotionY = y;\n                                    this.setScrollingCacheEnabled(true);\n                                }\n                                else if (yDiff > this.mTouchSlop) {\n                                    if (DEBUG)\n                                        Log.v(TAG, \"Starting unable to drag!\");\n                                    this.mIsUnableToDrag = true;\n                                }\n                                if (this.mIsBeingDragged) {\n                                    if (this.performDrag(x)) {\n                                        this.postInvalidateOnAnimation();\n                                    }\n                                }\n                                break;\n                            }\n                            case MotionEvent.ACTION_DOWN: {\n                                this.mLastMotionX = this.mInitialMotionX = ev.getX();\n                                this.mLastMotionY = this.mInitialMotionY = ev.getY();\n                                this.mActivePointerId = ev.getPointerId(0);\n                                this.mIsUnableToDrag = false;\n                                this.mScroller.computeScrollOffset();\n                                if (this.mScrollState == ViewPager.SCROLL_STATE_SETTLING &&\n                                    Math.abs(this.mScroller.getFinalX() - this.mScroller.getCurrX()) > this.mCloseEnough) {\n                                    this.mScroller.abortAnimation();\n                                    this.mPopulatePending = false;\n                                    this.populate();\n                                    this.mIsBeingDragged = true;\n                                    this.requestParentDisallowInterceptTouchEvent(true);\n                                    this.setScrollState(ViewPager.SCROLL_STATE_DRAGGING);\n                                }\n                                else {\n                                    this.completeScroll(false);\n                                    this.mIsBeingDragged = false;\n                                }\n                                if (DEBUG)\n                                    Log.v(TAG, \"Down at \" + this.mLastMotionX + \",\" + this.mLastMotionY\n                                        + \" mIsBeingDragged=\" + this.mIsBeingDragged\n                                        + \"mIsUnableToDrag=\" + this.mIsUnableToDrag);\n                                break;\n                            }\n                            case MotionEvent.ACTION_POINTER_UP:\n                                this.onSecondaryPointerUp(ev);\n                                break;\n                        }\n                        if (this.mVelocityTracker == null) {\n                            this.mVelocityTracker = VelocityTracker.obtain();\n                        }\n                        this.mVelocityTracker.addMovement(ev);\n                        return this.mIsBeingDragged;\n                    }\n                    onTouchEvent(ev) {\n                        if (this.mFakeDragging) {\n                            return true;\n                        }\n                        if (ev.getAction() == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0) {\n                            return false;\n                        }\n                        if (this.mAdapter == null || this.mAdapter.getCount() == 0) {\n                            return false;\n                        }\n                        if (this.mVelocityTracker == null) {\n                            this.mVelocityTracker = VelocityTracker.obtain();\n                        }\n                        this.mVelocityTracker.addMovement(ev);\n                        const action = ev.getAction();\n                        let needsInvalidate = false;\n                        switch (action & MotionEvent.ACTION_MASK) {\n                            case MotionEvent.ACTION_DOWN: {\n                                this.mScroller.abortAnimation();\n                                this.mPopulatePending = false;\n                                this.populate();\n                                this.mLastMotionX = this.mInitialMotionX = ev.getX();\n                                this.mLastMotionY = this.mInitialMotionY = ev.getY();\n                                this.mActivePointerId = ev.getPointerId(0);\n                                break;\n                            }\n                            case MotionEvent.ACTION_MOVE:\n                                if (!this.mIsBeingDragged) {\n                                    const pointerIndex = ev.findPointerIndex(this.mActivePointerId);\n                                    if (pointerIndex == -1) {\n                                        needsInvalidate = this.resetTouch();\n                                        break;\n                                    }\n                                    const x = ev.getX(pointerIndex);\n                                    const xDiff = Math.abs(x - this.mLastMotionX);\n                                    const y = ev.getY(pointerIndex);\n                                    const yDiff = Math.abs(y - this.mLastMotionY);\n                                    if (DEBUG)\n                                        Log.v(TAG, \"Moved x to \" + x + \",\" + y + \" diff=\" + xDiff + \",\" + yDiff);\n                                    if (xDiff > this.mTouchSlop && xDiff > yDiff) {\n                                        if (DEBUG)\n                                            Log.v(TAG, \"Starting drag!\");\n                                        this.mIsBeingDragged = true;\n                                        this.requestParentDisallowInterceptTouchEvent(true);\n                                        this.mLastMotionX = x - this.mInitialMotionX > 0 ? this.mInitialMotionX + this.mTouchSlop :\n                                            this.mInitialMotionX - this.mTouchSlop;\n                                        this.mLastMotionY = y;\n                                        this.setScrollState(ViewPager.SCROLL_STATE_DRAGGING);\n                                        this.setScrollingCacheEnabled(true);\n                                        let parent = this.getParent();\n                                        if (parent != null) {\n                                            parent.requestDisallowInterceptTouchEvent(true);\n                                        }\n                                    }\n                                }\n                                if (this.mIsBeingDragged) {\n                                    const activePointerIndex = ev.findPointerIndex(this.mActivePointerId);\n                                    const x = ev.getX(activePointerIndex);\n                                    needsInvalidate = needsInvalidate || this.performDrag(x);\n                                }\n                                break;\n                            case MotionEvent.ACTION_UP:\n                                if (this.mIsBeingDragged) {\n                                    const velocityTracker = this.mVelocityTracker;\n                                    velocityTracker.computeCurrentVelocity(1000, this.mMaximumVelocity);\n                                    let initialVelocity = velocityTracker.getXVelocity(this.mActivePointerId);\n                                    this.mPopulatePending = true;\n                                    const width = this.getClientWidth();\n                                    const scrollX = this.getScrollX();\n                                    const ii = this.infoForCurrentScrollPosition();\n                                    const currentPage = ii.position;\n                                    const pageOffset = ((scrollX / width) - ii.offset) / ii.widthFactor;\n                                    const activePointerIndex = ev.findPointerIndex(this.mActivePointerId);\n                                    const x = ev.getX(activePointerIndex);\n                                    const totalDelta = (x - this.mInitialMotionX);\n                                    let nextPage = this.determineTargetPage(currentPage, pageOffset, initialVelocity, totalDelta);\n                                    this.setCurrentItemInternal(nextPage, true, true, initialVelocity);\n                                    needsInvalidate = this.resetTouch();\n                                }\n                                break;\n                            case MotionEvent.ACTION_CANCEL:\n                                if (this.mIsBeingDragged) {\n                                    this.scrollToItem(this.mCurItem, true, 0, false);\n                                    needsInvalidate = this.resetTouch();\n                                }\n                                break;\n                            case MotionEvent.ACTION_POINTER_DOWN: {\n                                const index = ev.getActionIndex();\n                                const x = ev.getX(index);\n                                this.mLastMotionX = x;\n                                this.mActivePointerId = ev.getPointerId(index);\n                                break;\n                            }\n                            case MotionEvent.ACTION_POINTER_UP:\n                                this.onSecondaryPointerUp(ev);\n                                this.mLastMotionX = ev.getX(ev.findPointerIndex(this.mActivePointerId));\n                                break;\n                        }\n                        if (needsInvalidate) {\n                            this.postInvalidateOnAnimation();\n                        }\n                        return true;\n                    }\n                    resetTouch() {\n                        let needsInvalidate = false;\n                        this.mActivePointerId = ViewPager.INVALID_POINTER;\n                        this.endDrag();\n                        return needsInvalidate;\n                    }\n                    requestParentDisallowInterceptTouchEvent(disallowIntercept) {\n                        const parent = this.getParent();\n                        if (parent != null) {\n                            parent.requestDisallowInterceptTouchEvent(disallowIntercept);\n                        }\n                    }\n                    performDrag(x) {\n                        let needsInvalidate = false;\n                        const deltaX = this.mLastMotionX - x;\n                        this.mLastMotionX = x;\n                        let oldScrollX = this.getScrollX();\n                        let scrollX = oldScrollX + deltaX;\n                        const width = this.getClientWidth();\n                        let leftBound = width * this.mFirstOffset;\n                        let rightBound = width * this.mLastOffset;\n                        let leftAbsolute = true;\n                        let rightAbsolute = true;\n                        const firstItem = this.mItems.get(0);\n                        const lastItem = this.mItems.get(this.mItems.size() - 1);\n                        if (firstItem.position != 0) {\n                            leftAbsolute = false;\n                            leftBound = firstItem.offset * width;\n                        }\n                        if (lastItem.position != this.mAdapter.getCount() - 1) {\n                            rightAbsolute = false;\n                            rightBound = lastItem.offset * width;\n                        }\n                        if (scrollX < leftBound) {\n                            if (leftAbsolute) {\n                                let over = leftBound - scrollX;\n                                needsInvalidate = false;\n                            }\n                            scrollX -= deltaX / 2;\n                        }\n                        else if (scrollX > rightBound) {\n                            if (rightAbsolute) {\n                                let over = scrollX - rightBound;\n                                needsInvalidate = false;\n                            }\n                            scrollX -= deltaX / 2;\n                        }\n                        this.mLastMotionX += scrollX - Math.floor(scrollX);\n                        this.scrollTo(scrollX, this.getScrollY());\n                        this.pageScrolled(scrollX);\n                        return needsInvalidate;\n                    }\n                    infoForCurrentScrollPosition() {\n                        const width = this.getClientWidth();\n                        const scrollOffset = width > 0 ? this.getScrollX() / width : 0;\n                        const marginOffset = width > 0 ? this.mPageMargin / width : 0;\n                        let lastPos = -1;\n                        let lastOffset = 0;\n                        let lastWidth = 0;\n                        let first = true;\n                        let lastItem = null;\n                        for (let i = 0; i < this.mItems.size(); i++) {\n                            let ii = this.mItems.get(i);\n                            let offset;\n                            if (!first && ii.position != lastPos + 1) {\n                                ii = this.mTempItem;\n                                ii.offset = lastOffset + lastWidth + marginOffset;\n                                ii.position = lastPos + 1;\n                                ii.widthFactor = this.mAdapter.getPageWidth(ii.position);\n                                i--;\n                            }\n                            offset = ii.offset;\n                            const leftBound = offset;\n                            const rightBound = offset + ii.widthFactor + marginOffset;\n                            if (first || scrollOffset >= leftBound) {\n                                if (scrollOffset < rightBound || i == this.mItems.size() - 1) {\n                                    return ii;\n                                }\n                            }\n                            else {\n                                return lastItem;\n                            }\n                            first = false;\n                            lastPos = ii.position;\n                            lastOffset = offset;\n                            lastWidth = ii.widthFactor;\n                            lastItem = ii;\n                        }\n                        return lastItem;\n                    }\n                    determineTargetPage(currentPage, pageOffset, velocity, deltaX) {\n                        let targetPage;\n                        if (Math.abs(deltaX) > this.mFlingDistance && Math.abs(velocity) > this.mMinimumVelocity) {\n                            targetPage = velocity > 0 ? currentPage : currentPage + 1;\n                        }\n                        else {\n                            const truncator = currentPage >= this.mCurItem ? 0.4 : 0.6;\n                            targetPage = Math.floor(currentPage + pageOffset + truncator);\n                        }\n                        if (this.mItems.size() > 0) {\n                            const firstItem = this.mItems.get(0);\n                            const lastItem = this.mItems.get(this.mItems.size() - 1);\n                            targetPage = Math.max(firstItem.position, Math.min(targetPage, lastItem.position));\n                        }\n                        return targetPage;\n                    }\n                    draw(canvas) {\n                        super.draw(canvas);\n                        let needsInvalidate = false;\n                        if (needsInvalidate) {\n                            this.postInvalidateOnAnimation();\n                        }\n                    }\n                    onDraw(canvas) {\n                        super.onDraw(canvas);\n                        if (this.mPageMargin > 0 && this.mMarginDrawable != null && this.mItems.size() > 0 && this.mAdapter != null) {\n                            const scrollX = this.getScrollX();\n                            const width = this.getWidth();\n                            const marginOffset = this.mPageMargin / width;\n                            let itemIndex = 0;\n                            let ii = this.mItems.get(0);\n                            let offset = ii.offset;\n                            const itemCount = this.mItems.size();\n                            const firstPos = ii.position;\n                            const lastPos = this.mItems.get(itemCount - 1).position;\n                            for (let pos = firstPos; pos < lastPos; pos++) {\n                                while (pos > ii.position && itemIndex < itemCount) {\n                                    ii = this.mItems.get(++itemIndex);\n                                }\n                                let drawAt;\n                                if (pos == ii.position) {\n                                    drawAt = (ii.offset + ii.widthFactor) * width;\n                                    offset = ii.offset + ii.widthFactor + marginOffset;\n                                }\n                                else {\n                                    let widthFactor = this.mAdapter.getPageWidth(pos);\n                                    drawAt = (offset + widthFactor) * width;\n                                    offset += widthFactor + marginOffset;\n                                }\n                                if (drawAt + this.mPageMargin > scrollX) {\n                                    this.mMarginDrawable.setBounds(drawAt, this.mTopPageBounds, drawAt + this.mPageMargin, this.mBottomPageBounds);\n                                    this.mMarginDrawable.draw(canvas);\n                                }\n                                if (drawAt > scrollX + width) {\n                                    break;\n                                }\n                            }\n                        }\n                    }\n                    beginFakeDrag() {\n                        if (this.mIsBeingDragged) {\n                            return false;\n                        }\n                        this.mFakeDragging = true;\n                        this.setScrollState(ViewPager.SCROLL_STATE_DRAGGING);\n                        this.mInitialMotionX = this.mLastMotionX = 0;\n                        if (this.mVelocityTracker == null) {\n                            this.mVelocityTracker = VelocityTracker.obtain();\n                        }\n                        else {\n                            this.mVelocityTracker.clear();\n                        }\n                        const time = android.os.SystemClock.uptimeMillis();\n                        const ev = MotionEvent.obtainWithAction(time, time, MotionEvent.ACTION_DOWN, 0, 0, 0);\n                        this.mVelocityTracker.addMovement(ev);\n                        ev.recycle();\n                        this.mFakeDragBeginTime = time;\n                        return true;\n                    }\n                    endFakeDrag() {\n                        if (!this.mFakeDragging) {\n                            throw new Error(\"No fake drag in progress. Call beginFakeDrag first.\");\n                        }\n                        const velocityTracker = this.mVelocityTracker;\n                        velocityTracker.computeCurrentVelocity(1000, this.mMaximumVelocity);\n                        let initialVelocity = Math.floor(velocityTracker.getXVelocity(this.mActivePointerId));\n                        this.mPopulatePending = true;\n                        const width = this.getClientWidth();\n                        const scrollX = this.getScrollX();\n                        const ii = this.infoForCurrentScrollPosition();\n                        const currentPage = ii.position;\n                        const pageOffset = ((scrollX / width) - ii.offset) / ii.widthFactor;\n                        const totalDelta = Math.floor(this.mLastMotionX - this.mInitialMotionX);\n                        let nextPage = this.determineTargetPage(currentPage, pageOffset, initialVelocity, totalDelta);\n                        this.setCurrentItemInternal(nextPage, true, true, initialVelocity);\n                        this.endDrag();\n                        this.mFakeDragging = false;\n                    }\n                    fakeDragBy(xOffset) {\n                        if (!this.mFakeDragging) {\n                            throw new Error(\"No fake drag in progress. Call beginFakeDrag first.\");\n                        }\n                        this.mLastMotionX += xOffset;\n                        let oldScrollX = this.getScrollX();\n                        let scrollX = oldScrollX - xOffset;\n                        const width = this.getClientWidth();\n                        let leftBound = width * this.mFirstOffset;\n                        let rightBound = width * this.mLastOffset;\n                        const firstItem = this.mItems.get(0);\n                        const lastItem = this.mItems.get(this.mItems.size() - 1);\n                        if (firstItem.position != 0) {\n                            leftBound = firstItem.offset * width;\n                        }\n                        if (lastItem.position != this.mAdapter.getCount() - 1) {\n                            rightBound = lastItem.offset * width;\n                        }\n                        if (scrollX < leftBound) {\n                            scrollX = leftBound;\n                        }\n                        else if (scrollX > rightBound) {\n                            scrollX = rightBound;\n                        }\n                        this.mLastMotionX += scrollX - Math.floor(scrollX);\n                        this.scrollTo(Math.floor(scrollX), this.getScrollY());\n                        this.pageScrolled(Math.floor(scrollX));\n                        const time = android.os.SystemClock.uptimeMillis();\n                        const ev = MotionEvent.obtainWithAction(this.mFakeDragBeginTime, time, MotionEvent.ACTION_MOVE, this.mLastMotionX, 0, 0);\n                        this.mVelocityTracker.addMovement(ev);\n                        ev.recycle();\n                    }\n                    isFakeDragging() {\n                        return this.mFakeDragging;\n                    }\n                    onSecondaryPointerUp(ev) {\n                        const pointerIndex = ev.getActionIndex();\n                        const pointerId = ev.getPointerId(pointerIndex);\n                        if (pointerId == this.mActivePointerId) {\n                            const newPointerIndex = pointerIndex == 0 ? 1 : 0;\n                            this.mLastMotionX = ev.getX(newPointerIndex);\n                            this.mActivePointerId = ev.getPointerId(newPointerIndex);\n                            if (this.mVelocityTracker != null) {\n                                this.mVelocityTracker.clear();\n                            }\n                        }\n                    }\n                    endDrag() {\n                        this.mIsBeingDragged = false;\n                        this.mIsUnableToDrag = false;\n                        if (this.mVelocityTracker != null) {\n                            this.mVelocityTracker.recycle();\n                            this.mVelocityTracker = null;\n                        }\n                    }\n                    setScrollingCacheEnabled(enabled) {\n                        if (this.mScrollingCacheEnabled != enabled) {\n                            this.mScrollingCacheEnabled = enabled;\n                            if (ViewPager.USE_CACHE) {\n                                const size = this.getChildCount();\n                                for (let i = 0; i < size; ++i) {\n                                    const child = this.getChildAt(i);\n                                    if (child.getVisibility() != View.GONE) {\n                                        child.setDrawingCacheEnabled(enabled);\n                                    }\n                                }\n                            }\n                        }\n                    }\n                    canScrollHorizontally(direction) {\n                        if (this.mAdapter == null) {\n                            return false;\n                        }\n                        const width = this.getClientWidth();\n                        const scrollX = this.getScrollX();\n                        if (direction < 0) {\n                            return (scrollX > (width * this.mFirstOffset));\n                        }\n                        else if (direction > 0) {\n                            return (scrollX < (width * this.mLastOffset));\n                        }\n                        else {\n                            return false;\n                        }\n                    }\n                    canScroll(v, checkV, dx, x, y) {\n                        if (v instanceof ViewGroup) {\n                            const group = v;\n                            const scrollX = v.getScrollX();\n                            const scrollY = v.getScrollY();\n                            const count = group.getChildCount();\n                            for (let i = count - 1; i >= 0; i--) {\n                                const child = group.getChildAt(i);\n                                if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight() &&\n                                    y + scrollY >= child.getTop() && y + scrollY < child.getBottom() &&\n                                    this.canScroll(child, true, dx, x + scrollX - child.getLeft(), y + scrollY - child.getTop())) {\n                                    return true;\n                                }\n                            }\n                        }\n                        return checkV && v.canScrollHorizontally(-dx);\n                    }\n                    dispatchKeyEvent(event) {\n                        return super.dispatchKeyEvent(event) || this.executeKeyEvent(event);\n                    }\n                    executeKeyEvent(event) {\n                        let handled = false;\n                        if (event.getAction() == KeyEvent.ACTION_DOWN) {\n                            switch (event.getKeyCode()) {\n                                case KeyEvent.KEYCODE_DPAD_LEFT:\n                                    handled = this.arrowScroll(View.FOCUS_LEFT);\n                                    break;\n                                case KeyEvent.KEYCODE_DPAD_RIGHT:\n                                    handled = this.arrowScroll(View.FOCUS_RIGHT);\n                                    break;\n                                case KeyEvent.KEYCODE_TAB:\n                                    if (event.isShiftPressed()) {\n                                        handled = this.arrowScroll(View.FOCUS_BACKWARD);\n                                    }\n                                    else {\n                                        handled = this.arrowScroll(View.FOCUS_FORWARD);\n                                    }\n                                    break;\n                            }\n                        }\n                        return handled;\n                    }\n                    arrowScroll(direction) {\n                        let currentFocused = this.findFocus();\n                        if (currentFocused == this) {\n                            currentFocused = null;\n                        }\n                        else if (currentFocused != null) {\n                            let isChild = false;\n                            for (let parent = currentFocused.getParent(); parent instanceof ViewGroup; parent = parent.getParent()) {\n                                if (parent == this) {\n                                    isChild = true;\n                                    break;\n                                }\n                            }\n                            if (!isChild) {\n                                const sb = new java.lang.StringBuilder();\n                                sb.append(currentFocused.toString());\n                                for (let parent = currentFocused.getParent(); parent instanceof ViewGroup; parent = parent.getParent()) {\n                                    sb.append(\" => \").append(parent.toString());\n                                }\n                                Log.e(TAG, \"arrowScroll tried to find focus based on non-child \" +\n                                    \"current focused view \" + sb.toString());\n                                currentFocused = null;\n                            }\n                        }\n                        let handled = false;\n                        let nextFocused = android.view.FocusFinder.getInstance().findNextFocus(this, currentFocused, direction);\n                        if (nextFocused != null && nextFocused != currentFocused) {\n                            if (direction == View.FOCUS_LEFT) {\n                                const nextLeft = this.getChildRectInPagerCoordinates(this.mTempRect, nextFocused).left;\n                                const currLeft = this.getChildRectInPagerCoordinates(this.mTempRect, currentFocused).left;\n                                if (currentFocused != null && nextLeft >= currLeft) {\n                                    handled = this.pageLeft();\n                                }\n                                else {\n                                    handled = nextFocused.requestFocus();\n                                }\n                            }\n                            else if (direction == View.FOCUS_RIGHT) {\n                                const nextLeft = this.getChildRectInPagerCoordinates(this.mTempRect, nextFocused).left;\n                                const currLeft = this.getChildRectInPagerCoordinates(this.mTempRect, currentFocused).left;\n                                if (currentFocused != null && nextLeft <= currLeft) {\n                                    handled = this.pageRight();\n                                }\n                                else {\n                                    handled = nextFocused.requestFocus();\n                                }\n                            }\n                        }\n                        else if (direction == View.FOCUS_LEFT || direction == View.FOCUS_BACKWARD) {\n                            handled = this.pageLeft();\n                        }\n                        else if (direction == View.FOCUS_RIGHT || direction == View.FOCUS_FORWARD) {\n                            handled = this.pageRight();\n                        }\n                        return handled;\n                    }\n                    getChildRectInPagerCoordinates(outRect, child) {\n                        if (outRect == null) {\n                            outRect = new Rect();\n                        }\n                        if (child == null) {\n                            outRect.set(0, 0, 0, 0);\n                            return outRect;\n                        }\n                        outRect.left = child.getLeft();\n                        outRect.right = child.getRight();\n                        outRect.top = child.getTop();\n                        outRect.bottom = child.getBottom();\n                        let parent = child.getParent();\n                        while (parent instanceof ViewGroup && parent != this) {\n                            const group = parent;\n                            outRect.left += group.getLeft();\n                            outRect.right += group.getRight();\n                            outRect.top += group.getTop();\n                            outRect.bottom += group.getBottom();\n                            parent = group.getParent();\n                        }\n                        return outRect;\n                    }\n                    pageLeft() {\n                        if (this.mCurItem > 0) {\n                            this.setCurrentItem(this.mCurItem - 1, true);\n                            return true;\n                        }\n                        return false;\n                    }\n                    pageRight() {\n                        if (this.mAdapter != null && this.mCurItem < (this.mAdapter.getCount() - 1)) {\n                            this.setCurrentItem(this.mCurItem + 1, true);\n                            return true;\n                        }\n                        return false;\n                    }\n                    addFocusables(views, direction, focusableMode) {\n                        const focusableCount = views.size();\n                        const descendantFocusability = this.getDescendantFocusability();\n                        if (descendantFocusability != ViewGroup.FOCUS_BLOCK_DESCENDANTS) {\n                            for (let i = 0; i < this.getChildCount(); i++) {\n                                const child = this.getChildAt(i);\n                                if (child.getVisibility() == View.VISIBLE) {\n                                    let ii = this.infoForChild(child);\n                                    if (ii != null && ii.position == this.mCurItem) {\n                                        child.addFocusables(views, direction, focusableMode);\n                                    }\n                                }\n                            }\n                        }\n                        if (descendantFocusability != ViewGroup.FOCUS_AFTER_DESCENDANTS ||\n                            (focusableCount == views.size())) {\n                            if (!this.isFocusable()) {\n                                return;\n                            }\n                            if ((focusableMode & ViewGroup.FOCUSABLES_TOUCH_MODE) == ViewGroup.FOCUSABLES_TOUCH_MODE &&\n                                this.isInTouchMode() && !this.isFocusableInTouchMode()) {\n                                return;\n                            }\n                            if (views != null) {\n                                views.add(this);\n                            }\n                        }\n                    }\n                    addTouchables(views) {\n                        for (let i = 0; i < this.getChildCount(); i++) {\n                            const child = this.getChildAt(i);\n                            if (child.getVisibility() == View.VISIBLE) {\n                                let ii = this.infoForChild(child);\n                                if (ii != null && ii.position == this.mCurItem) {\n                                    child.addTouchables(views);\n                                }\n                            }\n                        }\n                    }\n                    onRequestFocusInDescendants(direction, previouslyFocusedRect) {\n                        let index;\n                        let increment;\n                        let end;\n                        let count = this.getChildCount();\n                        if ((direction & View.FOCUS_FORWARD) != 0) {\n                            index = 0;\n                            increment = 1;\n                            end = count;\n                        }\n                        else {\n                            index = count - 1;\n                            increment = -1;\n                            end = -1;\n                        }\n                        for (let i = index; i != end; i += increment) {\n                            let child = this.getChildAt(i);\n                            if (child.getVisibility() == View.VISIBLE) {\n                                let ii = this.infoForChild(child);\n                                if (ii != null && ii.position == this.mCurItem) {\n                                    if (child.requestFocus(direction, previouslyFocusedRect)) {\n                                        return true;\n                                    }\n                                }\n                            }\n                        }\n                        return false;\n                    }\n                    generateDefaultLayoutParams() {\n                        return new ViewPager.LayoutParams();\n                    }\n                    generateLayoutParams(p) {\n                        return this.generateDefaultLayoutParams();\n                    }\n                    checkLayoutParams(p) {\n                        return p instanceof ViewPager.LayoutParams && super.checkLayoutParams(p);\n                    }\n                    generateLayoutParamsFromAttr(attrs) {\n                        return new ViewPager.LayoutParams(this.getContext(), attrs);\n                    }\n                    static isImplDecor(view) {\n                        return view[SymbolDecor] || view.constructor[SymbolDecor];\n                    }\n                    static setClassImplDecor(clazz) {\n                        clazz[SymbolDecor] = true;\n                    }\n                }\n                ViewPager.COMPARATOR = (lhs, rhs) => {\n                    return lhs.position - rhs.position;\n                };\n                ViewPager.USE_CACHE = false;\n                ViewPager.DEFAULT_OFFSCREEN_PAGES = 1;\n                ViewPager.MAX_SETTLE_DURATION = 600;\n                ViewPager.MIN_DISTANCE_FOR_FLING = 25;\n                ViewPager.DEFAULT_GUTTER_SIZE = 16;\n                ViewPager.MIN_FLING_VELOCITY = 400;\n                ViewPager.sInterpolator = {\n                    getInterpolation(t) {\n                        t -= 1.0;\n                        return t * t * t * t * t + 1.0;\n                    }\n                };\n                ViewPager.INVALID_POINTER = -1;\n                ViewPager.CLOSE_ENOUGH = 2;\n                ViewPager.DRAW_ORDER_DEFAULT = 0;\n                ViewPager.DRAW_ORDER_FORWARD = 1;\n                ViewPager.DRAW_ORDER_REVERSE = 2;\n                ViewPager.sPositionComparator = (lhs, rhs) => {\n                    let llp = lhs.getLayoutParams();\n                    let rlp = rhs.getLayoutParams();\n                    if (llp.isDecor != rlp.isDecor) {\n                        return llp.isDecor ? 1 : -1;\n                    }\n                    return llp.position - rlp.position;\n                };\n                ViewPager.SCROLL_STATE_IDLE = 0;\n                ViewPager.SCROLL_STATE_DRAGGING = 1;\n                ViewPager.SCROLL_STATE_SETTLING = 2;\n                view_9.ViewPager = ViewPager;\n                (function (ViewPager) {\n                    class SimpleOnPageChangeListener {\n                        onPageScrolled(position, positionOffset, positionOffsetPixels) {\n                        }\n                        onPageSelected(position) {\n                        }\n                        onPageScrollStateChanged(state) {\n                        }\n                    }\n                    ViewPager.SimpleOnPageChangeListener = SimpleOnPageChangeListener;\n                    class LayoutParams extends ViewGroup.LayoutParams {\n                        constructor(...args) {\n                            super(...(() => {\n                                if (args[0] instanceof android.content.Context && args[1] instanceof HTMLElement)\n                                    return [args[0], args[1]];\n                                else if (args.length === 0)\n                                    return [ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT];\n                            })());\n                            this.isDecor = false;\n                            this.gravity = 0;\n                            this.widthFactor = 0;\n                            this.needsMeasure = false;\n                            this.position = 0;\n                            this.childIndex = 0;\n                            if (args[0] instanceof android.content.Context && args[1] instanceof HTMLElement) {\n                                const c = args[0];\n                                const attrs = args[1];\n                                const a = c.obtainStyledAttributes(attrs);\n                                this.gravity = Gravity.parseGravity(a.getAttrValue('layout_gravity'), Gravity.TOP);\n                                a.recycle();\n                            }\n                            else if (args.length === 0) {\n                            }\n                        }\n                        createClassAttrBinder() {\n                            return super.createClassAttrBinder().set('layout_gravity', {\n                                setter(param, value, attrBinder) {\n                                    param.gravity = attrBinder.parseGravity(value, param.gravity);\n                                }, getter(param) {\n                                    return param.gravity;\n                                }\n                            });\n                        }\n                    }\n                    ViewPager.LayoutParams = LayoutParams;\n                })(ViewPager = view_9.ViewPager || (view_9.ViewPager = {}));\n                class ItemInfo {\n                    constructor() {\n                        this.position = 0;\n                        this.scrolling = false;\n                        this.widthFactor = 0;\n                        this.offset = 0;\n                    }\n                }\n                class PagerObserver extends DataSetObserver {\n                    constructor(viewPager) {\n                        super();\n                        this.ViewPager_this = viewPager;\n                    }\n                    onChanged() {\n                        this.ViewPager_this.dataSetChanged();\n                    }\n                    onInvalidated() {\n                        this.ViewPager_this.dataSetChanged();\n                    }\n                }\n            })(view = v4.view || (v4.view = {}));\n        })(v4 = support.v4 || (support.v4 = {}));\n    })(support = android.support || (android.support = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var support;\n    (function (support) {\n        var v4;\n        (function (v4) {\n            var widget;\n            (function (widget) {\n                var MotionEvent = android.view.MotionEvent;\n                var VelocityTracker = android.view.VelocityTracker;\n                var ViewConfiguration = android.view.ViewConfiguration;\n                var ViewGroup = android.view.ViewGroup;\n                var OverScroller = android.widget.OverScroller;\n                var System = java.lang.System;\n                class ViewDragHelper {\n                    constructor(forParent, cb) {\n                        this.mDragState = 0;\n                        this.mTouchSlop = 0;\n                        this.mActivePointerId = ViewDragHelper.INVALID_POINTER;\n                        this.mPointersDown = 0;\n                        this.mMaxVelocity = 0;\n                        this.mMinVelocity = 0;\n                        this.mEdgeSize = 0;\n                        this.mTrackingEdges = 0;\n                        this.mSetIdleRunnable = (() => {\n                            const inner_this = this;\n                            class _Inner {\n                                run() {\n                                    inner_this.setDragState(ViewDragHelper.STATE_IDLE);\n                                }\n                            }\n                            return new _Inner();\n                        })();\n                        if (forParent == null) {\n                            throw Error(`new IllegalArgumentException(\"Parent view may not be null\")`);\n                        }\n                        if (cb == null) {\n                            throw Error(`new IllegalArgumentException(\"Callback may not be null\")`);\n                        }\n                        this.mParentView = forParent;\n                        this.mCallback = cb;\n                        const vc = ViewConfiguration.get();\n                        const density = android.content.res.Resources.getDisplayMetrics().density;\n                        this.mEdgeSize = Math.floor((ViewDragHelper.EDGE_SIZE * density + 0.5));\n                        this.mTouchSlop = vc.getScaledTouchSlop();\n                        this.mMaxVelocity = vc.getScaledMaximumFlingVelocity();\n                        this.mMinVelocity = vc.getScaledMinimumFlingVelocity();\n                        this.mScroller = new OverScroller(ViewDragHelper.sInterpolator);\n                    }\n                    static create(...args) {\n                        if (args.length === 2)\n                            return new ViewDragHelper(args[0], args[1]);\n                        else if (args.length === 3) {\n                            let [forParent, sensitivity, cb] = args;\n                            const helper = ViewDragHelper.create(forParent, cb);\n                            helper.mTouchSlop = Math.floor((helper.mTouchSlop * (1 / sensitivity)));\n                            return helper;\n                        }\n                    }\n                    setMinVelocity(minVel) {\n                        this.mMinVelocity = minVel;\n                    }\n                    getMinVelocity() {\n                        return this.mMinVelocity;\n                    }\n                    getViewDragState() {\n                        return this.mDragState;\n                    }\n                    setEdgeTrackingEnabled(edgeFlags) {\n                        this.mTrackingEdges = edgeFlags;\n                    }\n                    getEdgeSize() {\n                        return this.mEdgeSize;\n                    }\n                    captureChildView(childView, activePointerId) {\n                        if (childView.getParent() != this.mParentView) {\n                            throw Error(`new IllegalArgumentException(\"captureChildView: parameter must be a descendant \" + \"of the ViewDragHelper's tracked parent view (\" + this.mParentView + \")\")`);\n                        }\n                        this.mCapturedView = childView;\n                        this.mActivePointerId = activePointerId;\n                        this.mCallback.onViewCaptured(childView, activePointerId);\n                        this.setDragState(ViewDragHelper.STATE_DRAGGING);\n                    }\n                    getCapturedView() {\n                        return this.mCapturedView;\n                    }\n                    getActivePointerId() {\n                        return this.mActivePointerId;\n                    }\n                    getTouchSlop() {\n                        return this.mTouchSlop;\n                    }\n                    cancel() {\n                        this.mActivePointerId = ViewDragHelper.INVALID_POINTER;\n                        this.clearMotionHistory();\n                        if (this.mVelocityTracker != null) {\n                            this.mVelocityTracker.recycle();\n                            this.mVelocityTracker = null;\n                        }\n                    }\n                    abort() {\n                        this.cancel();\n                        if (this.mDragState == ViewDragHelper.STATE_SETTLING) {\n                            const oldX = this.mScroller.getCurrX();\n                            const oldY = this.mScroller.getCurrY();\n                            this.mScroller.abortAnimation();\n                            const newX = this.mScroller.getCurrX();\n                            const newY = this.mScroller.getCurrY();\n                            this.mCallback.onViewPositionChanged(this.mCapturedView, newX, newY, newX - oldX, newY - oldY);\n                        }\n                        this.setDragState(ViewDragHelper.STATE_IDLE);\n                    }\n                    smoothSlideViewTo(child, finalLeft, finalTop) {\n                        this.mCapturedView = child;\n                        this.mActivePointerId = ViewDragHelper.INVALID_POINTER;\n                        return this.forceSettleCapturedViewAt(finalLeft, finalTop, 0, 0);\n                    }\n                    settleCapturedViewAt(finalLeft, finalTop) {\n                        if (!this.mReleaseInProgress) {\n                            throw Error(`new IllegalStateException(\"Cannot settleCapturedViewAt outside of a call to \" + \"Callback#onViewReleased\")`);\n                        }\n                        return this.forceSettleCapturedViewAt(finalLeft, finalTop, Math.floor(this.mVelocityTracker.getXVelocity(this.mActivePointerId)), Math.floor(this.mVelocityTracker.getYVelocity(this.mActivePointerId)));\n                    }\n                    forceSettleCapturedViewAt(finalLeft, finalTop, xvel, yvel) {\n                        const startLeft = this.mCapturedView.getLeft();\n                        const startTop = this.mCapturedView.getTop();\n                        const dx = finalLeft - startLeft;\n                        const dy = finalTop - startTop;\n                        if (dx == 0 && dy == 0) {\n                            this.mScroller.abortAnimation();\n                            this.setDragState(ViewDragHelper.STATE_IDLE);\n                            return false;\n                        }\n                        const duration = this.computeSettleDuration(this.mCapturedView, dx, dy, xvel, yvel);\n                        this.mScroller.startScroll(startLeft, startTop, dx, dy, duration);\n                        this.setDragState(ViewDragHelper.STATE_SETTLING);\n                        return true;\n                    }\n                    computeSettleDuration(child, dx, dy, xvel, yvel) {\n                        xvel = this.clampMag(xvel, Math.floor(this.mMinVelocity), Math.floor(this.mMaxVelocity));\n                        yvel = this.clampMag(yvel, Math.floor(this.mMinVelocity), Math.floor(this.mMaxVelocity));\n                        const absDx = Math.abs(dx);\n                        const absDy = Math.abs(dy);\n                        const absXVel = Math.abs(xvel);\n                        const absYVel = Math.abs(yvel);\n                        const addedVel = absXVel + absYVel;\n                        const addedDistance = absDx + absDy;\n                        const xweight = xvel != 0 ? absXVel / addedVel : absDx / addedDistance;\n                        const yweight = yvel != 0 ? absYVel / addedVel : absDy / addedDistance;\n                        let xduration = this.computeAxisDuration(dx, xvel, this.mCallback.getViewHorizontalDragRange(child));\n                        let yduration = this.computeAxisDuration(dy, yvel, this.mCallback.getViewVerticalDragRange(child));\n                        return Math.floor((xduration * xweight + yduration * yweight));\n                    }\n                    computeAxisDuration(delta, velocity, motionRange) {\n                        if (delta == 0) {\n                            return 0;\n                        }\n                        const width = this.mParentView.getWidth();\n                        const halfWidth = width / 2;\n                        const distanceRatio = Math.min(1, Math.abs(delta) / width);\n                        const distance = halfWidth + halfWidth * this.distanceInfluenceForSnapDuration(distanceRatio);\n                        let duration;\n                        velocity = Math.abs(velocity);\n                        if (velocity > 0) {\n                            duration = 4 * Math.round(1000 * Math.abs(distance / velocity));\n                        }\n                        else {\n                            const range = Math.abs(delta) / motionRange;\n                            duration = Math.floor(((range + 1) * ViewDragHelper.BASE_SETTLE_DURATION));\n                        }\n                        return Math.min(duration, ViewDragHelper.MAX_SETTLE_DURATION);\n                    }\n                    clampMag(value, absMin, absMax) {\n                        const absValue = Math.abs(value);\n                        if (absValue < absMin)\n                            return 0;\n                        if (absValue > absMax)\n                            return value > 0 ? absMax : -absMax;\n                        return value;\n                    }\n                    distanceInfluenceForSnapDuration(f) {\n                        f -= 0.5;\n                        f *= 0.3 * Math.PI / 2.0;\n                        return Math.sin(f);\n                    }\n                    flingCapturedView(minLeft, minTop, maxLeft, maxTop) {\n                        if (!this.mReleaseInProgress) {\n                            throw Error(`new IllegalStateException(\"Cannot flingCapturedView outside of a call to \" + \"Callback#onViewReleased\")`);\n                        }\n                        this.mScroller.fling(this.mCapturedView.getLeft(), this.mCapturedView.getTop(), Math.floor(this.mVelocityTracker.getXVelocity(this.mActivePointerId)), Math.floor(this.mVelocityTracker.getYVelocity(this.mActivePointerId)), minLeft, maxLeft, minTop, maxTop);\n                        this.setDragState(ViewDragHelper.STATE_SETTLING);\n                    }\n                    continueSettling(deferCallbacks) {\n                        if (this.mDragState == ViewDragHelper.STATE_SETTLING) {\n                            let keepGoing = this.mScroller.computeScrollOffset();\n                            const x = this.mScroller.getCurrX();\n                            const y = this.mScroller.getCurrY();\n                            const dx = x - this.mCapturedView.getLeft();\n                            const dy = y - this.mCapturedView.getTop();\n                            if (dx != 0) {\n                                this.mCapturedView.offsetLeftAndRight(dx);\n                            }\n                            if (dy != 0) {\n                                this.mCapturedView.offsetTopAndBottom(dy);\n                            }\n                            if (dx != 0 || dy != 0) {\n                                this.mCallback.onViewPositionChanged(this.mCapturedView, x, y, dx, dy);\n                            }\n                            if (keepGoing && x == this.mScroller.getFinalX() && y == this.mScroller.getFinalY()) {\n                                this.mScroller.abortAnimation();\n                                keepGoing = this.mScroller.isFinished();\n                            }\n                            if (!keepGoing) {\n                                if (deferCallbacks) {\n                                    this.mParentView.post(this.mSetIdleRunnable);\n                                }\n                                else {\n                                    this.setDragState(ViewDragHelper.STATE_IDLE);\n                                }\n                            }\n                        }\n                        return this.mDragState == ViewDragHelper.STATE_SETTLING;\n                    }\n                    dispatchViewReleased(xvel, yvel) {\n                        this.mReleaseInProgress = true;\n                        this.mCallback.onViewReleased(this.mCapturedView, xvel, yvel);\n                        this.mReleaseInProgress = false;\n                        if (this.mDragState == ViewDragHelper.STATE_DRAGGING) {\n                            this.setDragState(ViewDragHelper.STATE_IDLE);\n                        }\n                    }\n                    clearMotionHistory(pointerId) {\n                        if (this.mInitialMotionX == null) {\n                            return;\n                        }\n                        if (pointerId == null) {\n                            this.mInitialMotionX = [];\n                            this.mInitialMotionY = [];\n                            this.mLastMotionX = [];\n                            this.mLastMotionY = [];\n                            this.mInitialEdgesTouched = [];\n                            this.mEdgeDragsInProgress = [];\n                            this.mEdgeDragsLocked = [];\n                            this.mPointersDown = 0;\n                        }\n                        else {\n                            this.mInitialMotionX[pointerId] = 0;\n                            this.mInitialMotionY[pointerId] = 0;\n                            this.mLastMotionX[pointerId] = 0;\n                            this.mLastMotionY[pointerId] = 0;\n                            this.mInitialEdgesTouched[pointerId] = 0;\n                            this.mEdgeDragsInProgress[pointerId] = 0;\n                            this.mEdgeDragsLocked[pointerId] = 0;\n                            this.mPointersDown &= ~(1 << pointerId);\n                        }\n                    }\n                    ensureMotionHistorySizeForId(pointerId) {\n                        if (this.mInitialMotionX == null || this.mInitialMotionX.length <= pointerId) {\n                            let imx = androidui.util.ArrayCreator.newNumberArray(pointerId + 1);\n                            let imy = androidui.util.ArrayCreator.newNumberArray(pointerId + 1);\n                            let lmx = androidui.util.ArrayCreator.newNumberArray(pointerId + 1);\n                            let lmy = androidui.util.ArrayCreator.newNumberArray(pointerId + 1);\n                            let iit = androidui.util.ArrayCreator.newNumberArray(pointerId + 1);\n                            let edip = androidui.util.ArrayCreator.newNumberArray(pointerId + 1);\n                            let edl = androidui.util.ArrayCreator.newNumberArray(pointerId + 1);\n                            if (this.mInitialMotionX != null) {\n                                System.arraycopy(this.mInitialMotionX, 0, imx, 0, this.mInitialMotionX.length);\n                                System.arraycopy(this.mInitialMotionY, 0, imy, 0, this.mInitialMotionY.length);\n                                System.arraycopy(this.mLastMotionX, 0, lmx, 0, this.mLastMotionX.length);\n                                System.arraycopy(this.mLastMotionY, 0, lmy, 0, this.mLastMotionY.length);\n                                System.arraycopy(this.mInitialEdgesTouched, 0, iit, 0, this.mInitialEdgesTouched.length);\n                                System.arraycopy(this.mEdgeDragsInProgress, 0, edip, 0, this.mEdgeDragsInProgress.length);\n                                System.arraycopy(this.mEdgeDragsLocked, 0, edl, 0, this.mEdgeDragsLocked.length);\n                            }\n                            this.mInitialMotionX = imx;\n                            this.mInitialMotionY = imy;\n                            this.mLastMotionX = lmx;\n                            this.mLastMotionY = lmy;\n                            this.mInitialEdgesTouched = iit;\n                            this.mEdgeDragsInProgress = edip;\n                            this.mEdgeDragsLocked = edl;\n                        }\n                    }\n                    saveInitialMotion(x, y, pointerId) {\n                        this.ensureMotionHistorySizeForId(pointerId);\n                        this.mInitialMotionX[pointerId] = this.mLastMotionX[pointerId] = x;\n                        this.mInitialMotionY[pointerId] = this.mLastMotionY[pointerId] = y;\n                        this.mInitialEdgesTouched[pointerId] = this.getEdgesTouched(Math.floor(x), Math.floor(y));\n                        this.mPointersDown |= 1 << pointerId;\n                    }\n                    saveLastMotion(ev) {\n                        const pointerCount = ev.getPointerCount();\n                        for (let i = 0; i < pointerCount; i++) {\n                            const pointerId = ev.getPointerId(i);\n                            const x = ev.getX(i);\n                            const y = ev.getY(i);\n                            this.mLastMotionX[pointerId] = x;\n                            this.mLastMotionY[pointerId] = y;\n                        }\n                    }\n                    isPointerDown(pointerId) {\n                        return (this.mPointersDown & 1 << pointerId) != 0;\n                    }\n                    setDragState(state) {\n                        if (this.mDragState != state) {\n                            this.mDragState = state;\n                            this.mCallback.onViewDragStateChanged(state);\n                            if (state == ViewDragHelper.STATE_IDLE) {\n                                this.mCapturedView = null;\n                            }\n                        }\n                    }\n                    tryCaptureViewForDrag(toCapture, pointerId) {\n                        if (toCapture == this.mCapturedView && this.mActivePointerId == pointerId) {\n                            return true;\n                        }\n                        if (toCapture != null && this.mCallback.tryCaptureView(toCapture, pointerId)) {\n                            this.mActivePointerId = pointerId;\n                            this.captureChildView(toCapture, pointerId);\n                            return true;\n                        }\n                        return false;\n                    }\n                    canScroll(v, checkV, dx, dy, x, y) {\n                        if (v instanceof ViewGroup) {\n                            const group = v;\n                            const scrollX = v.getScrollX();\n                            const scrollY = v.getScrollY();\n                            const count = group.getChildCount();\n                            for (let i = count - 1; i >= 0; i--) {\n                                const child = group.getChildAt(i);\n                                if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight()\n                                    && y + scrollY >= child.getTop() && y + scrollY < child.getBottom()\n                                    && this.canScroll(child, true, dx, dy, x + scrollX - child.getLeft(), y + scrollY - child.getTop())) {\n                                    return true;\n                                }\n                            }\n                        }\n                        return checkV && (v.canScrollHorizontally(-dx) || v.canScrollVertically(-dy));\n                    }\n                    shouldInterceptTouchEvent(ev) {\n                        const action = ev.getActionMasked();\n                        const actionIndex = ev.getActionIndex();\n                        if (action == MotionEvent.ACTION_DOWN) {\n                            this.cancel();\n                        }\n                        if (this.mVelocityTracker == null) {\n                            this.mVelocityTracker = VelocityTracker.obtain();\n                        }\n                        this.mVelocityTracker.addMovement(ev);\n                        switch (action) {\n                            case MotionEvent.ACTION_DOWN:\n                                {\n                                    const x = ev.getX();\n                                    const y = ev.getY();\n                                    const pointerId = ev.getPointerId(0);\n                                    this.saveInitialMotion(x, y, pointerId);\n                                    const toCapture = this.findTopChildUnder(Math.floor(x), Math.floor(y));\n                                    if (toCapture == this.mCapturedView && this.mDragState == ViewDragHelper.STATE_SETTLING) {\n                                        this.tryCaptureViewForDrag(toCapture, pointerId);\n                                    }\n                                    const edgesTouched = this.mInitialEdgesTouched[pointerId];\n                                    if ((edgesTouched & this.mTrackingEdges) != 0) {\n                                        this.mCallback.onEdgeTouched(edgesTouched & this.mTrackingEdges, pointerId);\n                                    }\n                                    break;\n                                }\n                            case MotionEvent.ACTION_POINTER_DOWN:\n                                {\n                                    const pointerId = ev.getPointerId(actionIndex);\n                                    const x = ev.getX(actionIndex);\n                                    const y = ev.getY(actionIndex);\n                                    this.saveInitialMotion(x, y, pointerId);\n                                    if (this.mDragState == ViewDragHelper.STATE_IDLE) {\n                                        const edgesTouched = this.mInitialEdgesTouched[pointerId];\n                                        if ((edgesTouched & this.mTrackingEdges) != 0) {\n                                            this.mCallback.onEdgeTouched(edgesTouched & this.mTrackingEdges, pointerId);\n                                        }\n                                    }\n                                    else if (this.mDragState == ViewDragHelper.STATE_SETTLING) {\n                                        const toCapture = this.findTopChildUnder(Math.floor(x), Math.floor(y));\n                                        if (toCapture == this.mCapturedView) {\n                                            this.tryCaptureViewForDrag(toCapture, pointerId);\n                                        }\n                                    }\n                                    break;\n                                }\n                            case MotionEvent.ACTION_MOVE:\n                                {\n                                    const pointerCount = ev.getPointerCount();\n                                    for (let i = 0; i < pointerCount; i++) {\n                                        const pointerId = ev.getPointerId(i);\n                                        const x = ev.getX(i);\n                                        const y = ev.getY(i);\n                                        const dx = x - this.mInitialMotionX[pointerId];\n                                        const dy = y - this.mInitialMotionY[pointerId];\n                                        this.reportNewEdgeDrags(dx, dy, pointerId);\n                                        if (this.mDragState == ViewDragHelper.STATE_DRAGGING) {\n                                            break;\n                                        }\n                                        const toCapture = this.findTopChildUnder(Math.floor(x), Math.floor(y));\n                                        if (toCapture != null && this.checkTouchSlop(toCapture, dx, dy) && this.tryCaptureViewForDrag(toCapture, pointerId)) {\n                                            break;\n                                        }\n                                    }\n                                    this.saveLastMotion(ev);\n                                    break;\n                                }\n                            case MotionEvent.ACTION_POINTER_UP:\n                                {\n                                    const pointerId = ev.getPointerId(actionIndex);\n                                    this.clearMotionHistory(pointerId);\n                                    break;\n                                }\n                            case MotionEvent.ACTION_UP:\n                            case MotionEvent.ACTION_CANCEL:\n                                {\n                                    this.cancel();\n                                    break;\n                                }\n                        }\n                        return this.mDragState == ViewDragHelper.STATE_DRAGGING;\n                    }\n                    processTouchEvent(ev) {\n                        const action = ev.getActionMasked();\n                        const actionIndex = ev.getActionIndex();\n                        if (action == MotionEvent.ACTION_DOWN) {\n                            this.cancel();\n                        }\n                        if (this.mVelocityTracker == null) {\n                            this.mVelocityTracker = VelocityTracker.obtain();\n                        }\n                        this.mVelocityTracker.addMovement(ev);\n                        switch (action) {\n                            case MotionEvent.ACTION_DOWN:\n                                {\n                                    const x = ev.getX();\n                                    const y = ev.getY();\n                                    const pointerId = ev.getPointerId(0);\n                                    const toCapture = this.findTopChildUnder(Math.floor(x), Math.floor(y));\n                                    this.saveInitialMotion(x, y, pointerId);\n                                    this.tryCaptureViewForDrag(toCapture, pointerId);\n                                    const edgesTouched = this.mInitialEdgesTouched[pointerId];\n                                    if ((edgesTouched & this.mTrackingEdges) != 0) {\n                                        this.mCallback.onEdgeTouched(edgesTouched & this.mTrackingEdges, pointerId);\n                                    }\n                                    break;\n                                }\n                            case MotionEvent.ACTION_POINTER_DOWN:\n                                {\n                                    const pointerId = ev.getPointerId(actionIndex);\n                                    const x = ev.getX(actionIndex);\n                                    const y = ev.getY(actionIndex);\n                                    this.saveInitialMotion(x, y, pointerId);\n                                    if (this.mDragState == ViewDragHelper.STATE_IDLE) {\n                                        const toCapture = this.findTopChildUnder(Math.floor(x), Math.floor(y));\n                                        this.tryCaptureViewForDrag(toCapture, pointerId);\n                                        const edgesTouched = this.mInitialEdgesTouched[pointerId];\n                                        if ((edgesTouched & this.mTrackingEdges) != 0) {\n                                            this.mCallback.onEdgeTouched(edgesTouched & this.mTrackingEdges, pointerId);\n                                        }\n                                    }\n                                    else if (this.isCapturedViewUnder(Math.floor(x), Math.floor(y))) {\n                                        this.tryCaptureViewForDrag(this.mCapturedView, pointerId);\n                                    }\n                                    break;\n                                }\n                            case MotionEvent.ACTION_MOVE:\n                                {\n                                    if (this.mDragState == ViewDragHelper.STATE_DRAGGING) {\n                                        const index = ev.findPointerIndex(this.mActivePointerId);\n                                        const x = ev.getX(index);\n                                        const y = ev.getY(index);\n                                        const idx = Math.floor((x - this.mLastMotionX[this.mActivePointerId]));\n                                        const idy = Math.floor((y - this.mLastMotionY[this.mActivePointerId]));\n                                        this.dragTo(this.mCapturedView.getLeft() + idx, this.mCapturedView.getTop() + idy, idx, idy);\n                                        this.saveLastMotion(ev);\n                                    }\n                                    else {\n                                        const pointerCount = ev.getPointerCount();\n                                        for (let i = 0; i < pointerCount; i++) {\n                                            const pointerId = ev.getPointerId(i);\n                                            const x = ev.getX(i);\n                                            const y = ev.getY(i);\n                                            const dx = x - this.mInitialMotionX[pointerId];\n                                            const dy = y - this.mInitialMotionY[pointerId];\n                                            this.reportNewEdgeDrags(dx, dy, pointerId);\n                                            if (this.mDragState == ViewDragHelper.STATE_DRAGGING) {\n                                                break;\n                                            }\n                                            const toCapture = this.findTopChildUnder(Math.floor(x), Math.floor(y));\n                                            if (this.checkTouchSlop(toCapture, dx, dy) && this.tryCaptureViewForDrag(toCapture, pointerId)) {\n                                                break;\n                                            }\n                                        }\n                                        this.saveLastMotion(ev);\n                                    }\n                                    break;\n                                }\n                            case MotionEvent.ACTION_POINTER_UP:\n                                {\n                                    const pointerId = ev.getPointerId(actionIndex);\n                                    if (this.mDragState == ViewDragHelper.STATE_DRAGGING && pointerId == this.mActivePointerId) {\n                                        let newActivePointer = ViewDragHelper.INVALID_POINTER;\n                                        const pointerCount = ev.getPointerCount();\n                                        for (let i = 0; i < pointerCount; i++) {\n                                            const id = ev.getPointerId(i);\n                                            if (id == this.mActivePointerId) {\n                                                continue;\n                                            }\n                                            const x = ev.getX(i);\n                                            const y = ev.getY(i);\n                                            if (this.findTopChildUnder(Math.floor(x), Math.floor(y)) == this.mCapturedView && this.tryCaptureViewForDrag(this.mCapturedView, id)) {\n                                                newActivePointer = this.mActivePointerId;\n                                                break;\n                                            }\n                                        }\n                                        if (newActivePointer == ViewDragHelper.INVALID_POINTER) {\n                                            this.releaseViewForPointerUp();\n                                        }\n                                    }\n                                    this.clearMotionHistory(pointerId);\n                                    break;\n                                }\n                            case MotionEvent.ACTION_UP:\n                                {\n                                    if (this.mDragState == ViewDragHelper.STATE_DRAGGING) {\n                                        this.releaseViewForPointerUp();\n                                    }\n                                    this.cancel();\n                                    break;\n                                }\n                            case MotionEvent.ACTION_CANCEL:\n                                {\n                                    if (this.mDragState == ViewDragHelper.STATE_DRAGGING) {\n                                        this.dispatchViewReleased(0, 0);\n                                    }\n                                    this.cancel();\n                                    break;\n                                }\n                        }\n                    }\n                    reportNewEdgeDrags(dx, dy, pointerId) {\n                        let dragsStarted = 0;\n                        if (this.checkNewEdgeDrag(dx, dy, pointerId, ViewDragHelper.EDGE_LEFT)) {\n                            dragsStarted |= ViewDragHelper.EDGE_LEFT;\n                        }\n                        if (this.checkNewEdgeDrag(dy, dx, pointerId, ViewDragHelper.EDGE_TOP)) {\n                            dragsStarted |= ViewDragHelper.EDGE_TOP;\n                        }\n                        if (this.checkNewEdgeDrag(dx, dy, pointerId, ViewDragHelper.EDGE_RIGHT)) {\n                            dragsStarted |= ViewDragHelper.EDGE_RIGHT;\n                        }\n                        if (this.checkNewEdgeDrag(dy, dx, pointerId, ViewDragHelper.EDGE_BOTTOM)) {\n                            dragsStarted |= ViewDragHelper.EDGE_BOTTOM;\n                        }\n                        if (dragsStarted != 0) {\n                            this.mEdgeDragsInProgress[pointerId] |= dragsStarted;\n                            this.mCallback.onEdgeDragStarted(dragsStarted, pointerId);\n                        }\n                    }\n                    checkNewEdgeDrag(delta, odelta, pointerId, edge) {\n                        const absDelta = Math.abs(delta);\n                        const absODelta = Math.abs(odelta);\n                        if ((this.mInitialEdgesTouched[pointerId] & edge) != edge || (this.mTrackingEdges & edge) == 0 || (this.mEdgeDragsLocked[pointerId] & edge) == edge || (this.mEdgeDragsInProgress[pointerId] & edge) == edge || (absDelta <= this.mTouchSlop && absODelta <= this.mTouchSlop)) {\n                            return false;\n                        }\n                        if (absDelta < absODelta * 0.5 && this.mCallback.onEdgeLock(edge)) {\n                            this.mEdgeDragsLocked[pointerId] |= edge;\n                            return false;\n                        }\n                        return (this.mEdgeDragsInProgress[pointerId] & edge) == 0 && absDelta > this.mTouchSlop;\n                    }\n                    checkTouchSlop(...args) {\n                        if (args.length === 1)\n                            return this._checkTouchSlop_1(args[0]);\n                        if (args.length === 2)\n                            return this._checkTouchSlop_2(args[0], args[1]);\n                        if (args.length === 3)\n                            return this._checkTouchSlop_3(args[0], args[1], args[2]);\n                        return false;\n                    }\n                    _checkTouchSlop_3(child, dx, dy) {\n                        if (child == null) {\n                            return false;\n                        }\n                        const checkHorizontal = this.mCallback.getViewHorizontalDragRange(child) > 0;\n                        const checkVertical = this.mCallback.getViewVerticalDragRange(child) > 0;\n                        if (checkHorizontal && checkVertical) {\n                            return dx * dx + dy * dy > this.mTouchSlop * this.mTouchSlop;\n                        }\n                        else if (checkHorizontal) {\n                            return Math.abs(dx) > this.mTouchSlop;\n                        }\n                        else if (checkVertical) {\n                            return Math.abs(dy) > this.mTouchSlop;\n                        }\n                        return false;\n                    }\n                    _checkTouchSlop_1(directions) {\n                        const count = this.mInitialMotionX.length;\n                        for (let i = 0; i < count; i++) {\n                            if (this.checkTouchSlop(directions, i)) {\n                                return true;\n                            }\n                        }\n                        return false;\n                    }\n                    _checkTouchSlop_2(directions, pointerId) {\n                        if (!this.isPointerDown(pointerId)) {\n                            return false;\n                        }\n                        const checkHorizontal = (directions & ViewDragHelper.DIRECTION_HORIZONTAL) == ViewDragHelper.DIRECTION_HORIZONTAL;\n                        const checkVertical = (directions & ViewDragHelper.DIRECTION_VERTICAL) == ViewDragHelper.DIRECTION_VERTICAL;\n                        const dx = this.mLastMotionX[pointerId] - this.mInitialMotionX[pointerId];\n                        const dy = this.mLastMotionY[pointerId] - this.mInitialMotionY[pointerId];\n                        if (checkHorizontal && checkVertical) {\n                            return dx * dx + dy * dy > this.mTouchSlop * this.mTouchSlop;\n                        }\n                        else if (checkHorizontal) {\n                            return Math.abs(dx) > this.mTouchSlop;\n                        }\n                        else if (checkVertical) {\n                            return Math.abs(dy) > this.mTouchSlop;\n                        }\n                        return false;\n                    }\n                    isEdgeTouched(edges, pointerId) {\n                        if (pointerId == null) {\n                            const count = this.mInitialEdgesTouched.length;\n                            for (let i = 0; i < count; i++) {\n                                if (this.isEdgeTouched(edges, i)) {\n                                    return true;\n                                }\n                            }\n                        }\n                        return this.isPointerDown(pointerId) && (this.mInitialEdgesTouched[pointerId] & edges) != 0;\n                    }\n                    releaseViewForPointerUp() {\n                        this.mVelocityTracker.computeCurrentVelocity(1000, this.mMaxVelocity);\n                        const xvel = this.clampMag(this.mVelocityTracker.getXVelocity(this.mActivePointerId), this.mMinVelocity, this.mMaxVelocity);\n                        const yvel = this.clampMag(this.mVelocityTracker.getYVelocity(this.mActivePointerId), this.mMinVelocity, this.mMaxVelocity);\n                        this.dispatchViewReleased(xvel, yvel);\n                    }\n                    dragTo(left, top, dx, dy) {\n                        let clampedX = left;\n                        let clampedY = top;\n                        const oldLeft = this.mCapturedView.getLeft();\n                        const oldTop = this.mCapturedView.getTop();\n                        if (dx != 0) {\n                            clampedX = this.mCallback.clampViewPositionHorizontal(this.mCapturedView, left, dx);\n                            this.mCapturedView.offsetLeftAndRight(clampedX - oldLeft);\n                        }\n                        if (dy != 0) {\n                            clampedY = this.mCallback.clampViewPositionVertical(this.mCapturedView, top, dy);\n                            this.mCapturedView.offsetTopAndBottom(clampedY - oldTop);\n                        }\n                        if (dx != 0 || dy != 0) {\n                            const clampedDx = clampedX - oldLeft;\n                            const clampedDy = clampedY - oldTop;\n                            this.mCallback.onViewPositionChanged(this.mCapturedView, clampedX, clampedY, clampedDx, clampedDy);\n                        }\n                    }\n                    isCapturedViewUnder(x, y) {\n                        return this.isViewUnder(this.mCapturedView, x, y);\n                    }\n                    isViewUnder(view, x, y) {\n                        if (view == null) {\n                            return false;\n                        }\n                        return x >= view.getLeft() && x < view.getRight() && y >= view.getTop() && y < view.getBottom();\n                    }\n                    findTopChildUnder(x, y) {\n                        const childCount = this.mParentView.getChildCount();\n                        for (let i = childCount - 1; i >= 0; i--) {\n                            const child = this.mParentView.getChildAt(this.mCallback.getOrderedChildIndex(i));\n                            if (x >= child.getLeft() && x < child.getRight() && y >= child.getTop() && y < child.getBottom()) {\n                                return child;\n                            }\n                        }\n                        return null;\n                    }\n                    getEdgesTouched(x, y) {\n                        let result = 0;\n                        if (x < this.mParentView.getLeft() + this.mEdgeSize)\n                            result |= ViewDragHelper.EDGE_LEFT;\n                        if (y < this.mParentView.getTop() + this.mEdgeSize)\n                            result |= ViewDragHelper.EDGE_TOP;\n                        if (x > this.mParentView.getRight() - this.mEdgeSize)\n                            result |= ViewDragHelper.EDGE_RIGHT;\n                        if (y > this.mParentView.getBottom() - this.mEdgeSize)\n                            result |= ViewDragHelper.EDGE_BOTTOM;\n                        return result;\n                    }\n                }\n                ViewDragHelper.TAG = \"ViewDragHelper\";\n                ViewDragHelper.INVALID_POINTER = -1;\n                ViewDragHelper.STATE_IDLE = 0;\n                ViewDragHelper.STATE_DRAGGING = 1;\n                ViewDragHelper.STATE_SETTLING = 2;\n                ViewDragHelper.EDGE_LEFT = 1 << 0;\n                ViewDragHelper.EDGE_RIGHT = 1 << 1;\n                ViewDragHelper.EDGE_TOP = 1 << 2;\n                ViewDragHelper.EDGE_BOTTOM = 1 << 3;\n                ViewDragHelper.EDGE_ALL = ViewDragHelper.EDGE_LEFT | ViewDragHelper.EDGE_TOP | ViewDragHelper.EDGE_RIGHT | ViewDragHelper.EDGE_BOTTOM;\n                ViewDragHelper.DIRECTION_HORIZONTAL = 1 << 0;\n                ViewDragHelper.DIRECTION_VERTICAL = 1 << 1;\n                ViewDragHelper.DIRECTION_ALL = ViewDragHelper.DIRECTION_HORIZONTAL | ViewDragHelper.DIRECTION_VERTICAL;\n                ViewDragHelper.EDGE_SIZE = 20;\n                ViewDragHelper.BASE_SETTLE_DURATION = 256;\n                ViewDragHelper.MAX_SETTLE_DURATION = 600;\n                ViewDragHelper.sInterpolator = (() => {\n                    class _Inner {\n                        getInterpolation(t) {\n                            t -= 1.0;\n                            return t * t * t * t * t + 1.0;\n                        }\n                    }\n                    return new _Inner();\n                })();\n                widget.ViewDragHelper = ViewDragHelper;\n                (function (ViewDragHelper) {\n                    class Callback {\n                        onViewDragStateChanged(state) {\n                        }\n                        onViewPositionChanged(changedView, left, top, dx, dy) {\n                        }\n                        onViewCaptured(capturedChild, activePointerId) {\n                        }\n                        onViewReleased(releasedChild, xvel, yvel) {\n                        }\n                        onEdgeTouched(edgeFlags, pointerId) {\n                        }\n                        onEdgeLock(edgeFlags) {\n                            return false;\n                        }\n                        onEdgeDragStarted(edgeFlags, pointerId) {\n                        }\n                        getOrderedChildIndex(index) {\n                            return index;\n                        }\n                        getViewHorizontalDragRange(child) {\n                            return 0;\n                        }\n                        getViewVerticalDragRange(child) {\n                            return 0;\n                        }\n                        clampViewPositionHorizontal(child, left, dx) {\n                            return 0;\n                        }\n                        clampViewPositionVertical(child, top, dy) {\n                            return 0;\n                        }\n                    }\n                    ViewDragHelper.Callback = Callback;\n                })(ViewDragHelper = widget.ViewDragHelper || (widget.ViewDragHelper = {}));\n            })(widget = v4.widget || (v4.widget = {}));\n        })(v4 = support.v4 || (support.v4 = {}));\n    })(support = android.support || (android.support = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var support;\n    (function (support) {\n        var v4;\n        (function (v4) {\n            var widget;\n            (function (widget) {\n                var Paint = android.graphics.Paint;\n                var PixelFormat = android.graphics.PixelFormat;\n                var SystemClock = android.os.SystemClock;\n                var Gravity = android.view.Gravity;\n                var KeyEvent = android.view.KeyEvent;\n                var MotionEvent = android.view.MotionEvent;\n                var View = android.view.View;\n                var ViewGroup = android.view.ViewGroup;\n                var ViewDragHelper = android.support.v4.widget.ViewDragHelper;\n                var Context = android.content.Context;\n                class DrawerLayout extends ViewGroup {\n                    constructor(context, bindElement, defStyle) {\n                        super(context, bindElement, defStyle);\n                        this.mMinDrawerMargin = 0;\n                        this.mScrimColor = DrawerLayout.DEFAULT_SCRIM_COLOR;\n                        this.mScrimOpacity = 0;\n                        this.mScrimPaint = new Paint();\n                        this.mDrawerState = 0;\n                        this.mFirstLayout = true;\n                        this.mLockModeLeft = 0;\n                        this.mLockModeRight = 0;\n                        this.mInitialMotionX = 0;\n                        this.mInitialMotionY = 0;\n                        const density = this.getResources().getDisplayMetrics().density;\n                        this.mMinDrawerMargin = Math.floor((DrawerLayout.MIN_DRAWER_MARGIN * density + 0.5));\n                        const minVel = DrawerLayout.MIN_FLING_VELOCITY * density;\n                        this.mLeftCallback = new DrawerLayout.ViewDragCallback(this, Gravity.LEFT);\n                        this.mRightCallback = new DrawerLayout.ViewDragCallback(this, Gravity.RIGHT);\n                        this.mLeftDragger = ViewDragHelper.create(this, DrawerLayout.TOUCH_SLOP_SENSITIVITY, this.mLeftCallback);\n                        this.mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);\n                        this.mLeftDragger.setMinVelocity(minVel);\n                        this.mLeftCallback.setDragger(this.mLeftDragger);\n                        this.mRightDragger = ViewDragHelper.create(this, DrawerLayout.TOUCH_SLOP_SENSITIVITY, this.mRightCallback);\n                        this.mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);\n                        this.mRightDragger.setMinVelocity(minVel);\n                        this.mRightCallback.setDragger(this.mRightDragger);\n                        this.setFocusableInTouchMode(true);\n                        this.setMotionEventSplittingEnabled(false);\n                    }\n                    setDrawerShadow(shadowDrawable, gravity) {\n                        const absGravity = Gravity.getAbsoluteGravity(gravity, this.getLayoutDirection());\n                        if ((absGravity & Gravity.LEFT) == Gravity.LEFT) {\n                            this.mShadowLeft = shadowDrawable;\n                            this.invalidate();\n                        }\n                        if ((absGravity & Gravity.RIGHT) == Gravity.RIGHT) {\n                            this.mShadowRight = shadowDrawable;\n                            this.invalidate();\n                        }\n                    }\n                    setScrimColor(color) {\n                        this.mScrimColor = color;\n                        this.invalidate();\n                    }\n                    setDrawerListener(listener) {\n                        this.mListener = listener;\n                    }\n                    setDrawerLockMode(lockMode, edgeGravityOrView) {\n                        if (edgeGravityOrView == null) {\n                            this.setDrawerLockMode(lockMode, Gravity.LEFT);\n                            this.setDrawerLockMode(lockMode, Gravity.RIGHT);\n                            return;\n                        }\n                        if (edgeGravityOrView instanceof View) {\n                            if (!this.isDrawerView(edgeGravityOrView)) {\n                                throw Error(`new IllegalArgumentException(\"View \" + drawerView + \" is not a \" + \"drawer with appropriate layout_gravity\")`);\n                            }\n                            const gravity = edgeGravityOrView.getLayoutParams().gravity;\n                            this.setDrawerLockMode(lockMode, gravity);\n                            return;\n                        }\n                        let edgeGravity = edgeGravityOrView;\n                        const absGravity = Gravity.getAbsoluteGravity(edgeGravity, this.getLayoutDirection());\n                        if (absGravity == Gravity.LEFT) {\n                            this.mLockModeLeft = lockMode;\n                        }\n                        else if (absGravity == Gravity.RIGHT) {\n                            this.mLockModeRight = lockMode;\n                        }\n                        if (lockMode != DrawerLayout.LOCK_MODE_UNLOCKED) {\n                            const helper = absGravity == Gravity.LEFT ? this.mLeftDragger : this.mRightDragger;\n                            helper.cancel();\n                        }\n                        switch (lockMode) {\n                            case DrawerLayout.LOCK_MODE_LOCKED_OPEN:\n                                const toOpen = this.findDrawerWithGravity(absGravity);\n                                if (toOpen != null) {\n                                    this.openDrawer(toOpen);\n                                }\n                                break;\n                            case DrawerLayout.LOCK_MODE_LOCKED_CLOSED:\n                                const toClose = this.findDrawerWithGravity(absGravity);\n                                if (toClose != null) {\n                                    this.closeDrawer(toClose);\n                                }\n                                break;\n                        }\n                    }\n                    getDrawerLockMode(edgeGravityOrView) {\n                        if (edgeGravityOrView instanceof View) {\n                            let drawerView = edgeGravityOrView;\n                            const absGravity = this.getDrawerViewAbsoluteGravity(drawerView);\n                            if (absGravity == Gravity.LEFT) {\n                                return this.mLockModeLeft;\n                            }\n                            else if (absGravity == Gravity.RIGHT) {\n                                return this.mLockModeRight;\n                            }\n                            return DrawerLayout.LOCK_MODE_UNLOCKED;\n                        }\n                        else {\n                            let edgeGravity = edgeGravityOrView;\n                            const absGravity = Gravity.getAbsoluteGravity(edgeGravity, this.getLayoutDirection());\n                            if (absGravity == Gravity.LEFT) {\n                                return this.mLockModeLeft;\n                            }\n                            else if (absGravity == Gravity.RIGHT) {\n                                return this.mLockModeRight;\n                            }\n                            return DrawerLayout.LOCK_MODE_UNLOCKED;\n                        }\n                    }\n                    updateDrawerState(forGravity, activeState, activeDrawer) {\n                        const leftState = this.mLeftDragger.getViewDragState();\n                        const rightState = this.mRightDragger.getViewDragState();\n                        let state;\n                        if (leftState == DrawerLayout.STATE_DRAGGING || rightState == DrawerLayout.STATE_DRAGGING) {\n                            state = DrawerLayout.STATE_DRAGGING;\n                        }\n                        else if (leftState == DrawerLayout.STATE_SETTLING || rightState == DrawerLayout.STATE_SETTLING) {\n                            state = DrawerLayout.STATE_SETTLING;\n                        }\n                        else {\n                            state = DrawerLayout.STATE_IDLE;\n                        }\n                        if (activeDrawer != null && activeState == DrawerLayout.STATE_IDLE) {\n                            const lp = activeDrawer.getLayoutParams();\n                            if (lp.onScreen == 0) {\n                                this.dispatchOnDrawerClosed(activeDrawer);\n                            }\n                            else if (lp.onScreen == 1) {\n                                this.dispatchOnDrawerOpened(activeDrawer);\n                            }\n                        }\n                        if (state != this.mDrawerState) {\n                            this.mDrawerState = state;\n                            if (this.mListener != null) {\n                                this.mListener.onDrawerStateChanged(state);\n                            }\n                        }\n                    }\n                    dispatchOnDrawerClosed(drawerView) {\n                        const lp = drawerView.getLayoutParams();\n                        if (lp.knownOpen) {\n                            lp.knownOpen = false;\n                            if (this.mListener != null) {\n                                this.mListener.onDrawerClosed(drawerView);\n                            }\n                        }\n                    }\n                    dispatchOnDrawerOpened(drawerView) {\n                        const lp = drawerView.getLayoutParams();\n                        if (!lp.knownOpen) {\n                            lp.knownOpen = true;\n                            if (this.mListener != null) {\n                                this.mListener.onDrawerOpened(drawerView);\n                            }\n                        }\n                    }\n                    dispatchOnDrawerSlide(drawerView, slideOffset) {\n                        if (this.mListener != null) {\n                            this.mListener.onDrawerSlide(drawerView, slideOffset);\n                        }\n                    }\n                    setDrawerViewOffset(drawerView, slideOffset) {\n                        const lp = drawerView.getLayoutParams();\n                        if (slideOffset == lp.onScreen) {\n                            return;\n                        }\n                        lp.onScreen = slideOffset;\n                        this.dispatchOnDrawerSlide(drawerView, slideOffset);\n                    }\n                    getDrawerViewOffset(drawerView) {\n                        return drawerView.getLayoutParams().onScreen;\n                    }\n                    getDrawerViewAbsoluteGravity(drawerView) {\n                        const gravity = drawerView.getLayoutParams().gravity;\n                        return Gravity.getAbsoluteGravity(gravity, this.getLayoutDirection());\n                    }\n                    checkDrawerViewAbsoluteGravity(drawerView, checkFor) {\n                        const absGravity = this.getDrawerViewAbsoluteGravity(drawerView);\n                        return (absGravity & checkFor) == checkFor;\n                    }\n                    findOpenDrawer() {\n                        const childCount = this.getChildCount();\n                        for (let i = 0; i < childCount; i++) {\n                            const child = this.getChildAt(i);\n                            if (child.getLayoutParams().knownOpen) {\n                                return child;\n                            }\n                        }\n                        return null;\n                    }\n                    moveDrawerToOffset(drawerView, slideOffset) {\n                        const oldOffset = this.getDrawerViewOffset(drawerView);\n                        const width = drawerView.getWidth();\n                        const oldPos = Math.floor((width * oldOffset));\n                        const newPos = Math.floor((width * slideOffset));\n                        const dx = newPos - oldPos;\n                        drawerView.offsetLeftAndRight(this.checkDrawerViewAbsoluteGravity(drawerView, Gravity.LEFT) ? dx : -dx);\n                        this.setDrawerViewOffset(drawerView, slideOffset);\n                    }\n                    findDrawerWithGravity(gravity) {\n                        const absHorizGravity = Gravity.getAbsoluteGravity(gravity, this.getLayoutDirection()) & Gravity.HORIZONTAL_GRAVITY_MASK;\n                        const childCount = this.getChildCount();\n                        for (let i = 0; i < childCount; i++) {\n                            const child = this.getChildAt(i);\n                            const childAbsGravity = this.getDrawerViewAbsoluteGravity(child);\n                            if ((childAbsGravity & Gravity.HORIZONTAL_GRAVITY_MASK) == absHorizGravity) {\n                                return child;\n                            }\n                        }\n                        return null;\n                    }\n                    static gravityToString(gravity) {\n                        if ((gravity & Gravity.LEFT) == Gravity.LEFT) {\n                            return \"LEFT\";\n                        }\n                        if ((gravity & Gravity.RIGHT) == Gravity.RIGHT) {\n                            return \"RIGHT\";\n                        }\n                        return '' + gravity;\n                    }\n                    onDetachedFromWindow() {\n                        super.onDetachedFromWindow();\n                        this.mFirstLayout = true;\n                    }\n                    onAttachedToWindow() {\n                        super.onAttachedToWindow();\n                        this.mFirstLayout = true;\n                    }\n                    onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                        let widthMode = View.MeasureSpec.getMode(widthMeasureSpec);\n                        let heightMode = View.MeasureSpec.getMode(heightMeasureSpec);\n                        let widthSize = View.MeasureSpec.getSize(widthMeasureSpec);\n                        let heightSize = View.MeasureSpec.getSize(heightMeasureSpec);\n                        if (widthMode != View.MeasureSpec.EXACTLY || heightMode != View.MeasureSpec.EXACTLY) {\n                            if (this.isInEditMode()) {\n                                if (widthMode == View.MeasureSpec.AT_MOST) {\n                                    widthMode = View.MeasureSpec.EXACTLY;\n                                }\n                                else if (widthMode == View.MeasureSpec.UNSPECIFIED) {\n                                    widthMode = View.MeasureSpec.EXACTLY;\n                                    widthSize = 300;\n                                }\n                                if (heightMode == View.MeasureSpec.AT_MOST) {\n                                    heightMode = View.MeasureSpec.EXACTLY;\n                                }\n                                else if (heightMode == View.MeasureSpec.UNSPECIFIED) {\n                                    heightMode = View.MeasureSpec.EXACTLY;\n                                    heightSize = 300;\n                                }\n                            }\n                            else {\n                                throw Error(`new IllegalArgumentException(\"DrawerLayout must be measured with MeasureSpec.EXACTLY.\")`);\n                            }\n                        }\n                        this.setMeasuredDimension(widthSize, heightSize);\n                        let foundDrawers = 0;\n                        const childCount = this.getChildCount();\n                        for (let i = 0; i < childCount; i++) {\n                            const child = this.getChildAt(i);\n                            if (child.getVisibility() == DrawerLayout.GONE) {\n                                continue;\n                            }\n                            const lp = child.getLayoutParams();\n                            if (this.isContentView(child)) {\n                                const contentWidthSpec = View.MeasureSpec.makeMeasureSpec(widthSize - lp.leftMargin - lp.rightMargin, View.MeasureSpec.EXACTLY);\n                                const contentHeightSpec = View.MeasureSpec.makeMeasureSpec(heightSize - lp.topMargin - lp.bottomMargin, View.MeasureSpec.EXACTLY);\n                                child.measure(contentWidthSpec, contentHeightSpec);\n                            }\n                            else if (this.isDrawerView(child)) {\n                                const childGravity = this.getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;\n                                if ((foundDrawers & childGravity) != 0) {\n                                    throw Error(`new IllegalStateException(\"Child drawer has absolute gravity \" + DrawerLayout.gravityToString(childGravity) + \" but this \" + DrawerLayout.TAG + \" already has a \" + \"drawer view along that edge\")`);\n                                }\n                                const drawerWidthSpec = DrawerLayout.getChildMeasureSpec(widthMeasureSpec, this.mMinDrawerMargin + lp.leftMargin + lp.rightMargin, lp.width);\n                                const drawerHeightSpec = DrawerLayout.getChildMeasureSpec(heightMeasureSpec, lp.topMargin + lp.bottomMargin, lp.height);\n                                child.measure(drawerWidthSpec, drawerHeightSpec);\n                            }\n                            else {\n                                throw Error(`new IllegalStateException(\"Child \" + child + \" at index \" + i + \" does not have a valid layout_gravity - must be Gravity.LEFT, \" + \"Gravity.RIGHT or Gravity.NO_GRAVITY\")`);\n                            }\n                        }\n                    }\n                    onLayout(changed, l, t, r, b) {\n                        this.mInLayout = true;\n                        const width = r - l;\n                        const childCount = this.getChildCount();\n                        for (let i = 0; i < childCount; i++) {\n                            const child = this.getChildAt(i);\n                            if (child.getVisibility() == DrawerLayout.GONE) {\n                                continue;\n                            }\n                            const lp = child.getLayoutParams();\n                            if (this.isContentView(child)) {\n                                child.layout(lp.leftMargin, lp.topMargin, lp.leftMargin + child.getMeasuredWidth(), lp.topMargin + child.getMeasuredHeight());\n                            }\n                            else {\n                                const childWidth = child.getMeasuredWidth();\n                                const childHeight = child.getMeasuredHeight();\n                                let childLeft;\n                                let newOffset;\n                                if (this.checkDrawerViewAbsoluteGravity(child, Gravity.LEFT)) {\n                                    childLeft = -childWidth + Math.floor((childWidth * lp.onScreen));\n                                    newOffset = (childWidth + childLeft) / childWidth;\n                                }\n                                else {\n                                    childLeft = width - Math.floor((childWidth * lp.onScreen));\n                                    newOffset = (width - childLeft) / childWidth;\n                                }\n                                const changeOffset = newOffset != lp.onScreen;\n                                const vgrav = lp.gravity & Gravity.VERTICAL_GRAVITY_MASK;\n                                switch (vgrav) {\n                                    default:\n                                    case Gravity.TOP:\n                                        {\n                                            child.layout(childLeft, lp.topMargin, childLeft + childWidth, lp.topMargin + childHeight);\n                                            break;\n                                        }\n                                    case Gravity.BOTTOM:\n                                        {\n                                            const height = b - t;\n                                            child.layout(childLeft, height - lp.bottomMargin - child.getMeasuredHeight(), childLeft + childWidth, height - lp.bottomMargin);\n                                            break;\n                                        }\n                                    case Gravity.CENTER_VERTICAL:\n                                        {\n                                            const height = b - t;\n                                            let childTop = (height - childHeight) / 2;\n                                            if (childTop < lp.topMargin) {\n                                                childTop = lp.topMargin;\n                                            }\n                                            else if (childTop + childHeight > height - lp.bottomMargin) {\n                                                childTop = height - lp.bottomMargin - childHeight;\n                                            }\n                                            child.layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight);\n                                            break;\n                                        }\n                                }\n                                if (changeOffset) {\n                                    this.setDrawerViewOffset(child, newOffset);\n                                }\n                                const newVisibility = lp.onScreen > 0 ? DrawerLayout.VISIBLE : DrawerLayout.INVISIBLE;\n                                if (child.getVisibility() != newVisibility) {\n                                    child.setVisibility(newVisibility);\n                                }\n                            }\n                        }\n                        this.mInLayout = false;\n                        this.mFirstLayout = false;\n                    }\n                    requestLayout() {\n                        if (!this.mInLayout) {\n                            super.requestLayout();\n                        }\n                    }\n                    computeScroll() {\n                        const childCount = this.getChildCount();\n                        let scrimOpacity = 0;\n                        for (let i = 0; i < childCount; i++) {\n                            const onscreen = this.getChildAt(i).getLayoutParams().onScreen;\n                            scrimOpacity = Math.max(scrimOpacity, onscreen);\n                        }\n                        this.mScrimOpacity = scrimOpacity;\n                        let leftContinue = this.mLeftDragger.continueSettling(true);\n                        let rightContinue = this.mRightDragger.continueSettling(true);\n                        if (leftContinue || rightContinue) {\n                            this.postInvalidateOnAnimation();\n                        }\n                    }\n                    static hasOpaqueBackground(v) {\n                        const bg = v.getBackground();\n                        if (bg != null) {\n                            return bg.getOpacity() == PixelFormat.OPAQUE;\n                        }\n                        return false;\n                    }\n                    drawChild(canvas, child, drawingTime) {\n                        const height = this.getHeight();\n                        const drawingContent = this.isContentView(child);\n                        let clipLeft = 0, clipRight = this.getWidth();\n                        const restoreCount = canvas.save();\n                        if (drawingContent) {\n                            const childCount = this.getChildCount();\n                            for (let i = 0; i < childCount; i++) {\n                                const v = this.getChildAt(i);\n                                if (v == child || v.getVisibility() != DrawerLayout.VISIBLE || !DrawerLayout.hasOpaqueBackground(v) || !this.isDrawerView(v) || v.getHeight() < height) {\n                                    continue;\n                                }\n                                if (this.checkDrawerViewAbsoluteGravity(v, Gravity.LEFT)) {\n                                    const vright = v.getRight();\n                                    if (vright > clipLeft)\n                                        clipLeft = vright;\n                                }\n                                else {\n                                    const vleft = v.getLeft();\n                                    if (vleft < clipRight)\n                                        clipRight = vleft;\n                                }\n                            }\n                            canvas.clipRect(clipLeft, 0, clipRight, this.getHeight());\n                        }\n                        const result = super.drawChild(canvas, child, drawingTime);\n                        canvas.restoreToCount(restoreCount);\n                        if (this.mScrimOpacity > 0 && drawingContent) {\n                            const baseAlpha = (this.mScrimColor & 0xff000000) >>> 24;\n                            const imag = Math.floor((baseAlpha * this.mScrimOpacity));\n                            const color = imag << 24 | (this.mScrimColor & 0xffffff);\n                            this.mScrimPaint.setColor(color);\n                            canvas.drawRect(clipLeft, 0, clipRight, this.getHeight(), this.mScrimPaint);\n                        }\n                        else if (this.mShadowLeft != null && this.checkDrawerViewAbsoluteGravity(child, Gravity.LEFT)) {\n                            const shadowWidth = this.mShadowLeft.getIntrinsicWidth();\n                            const childRight = child.getRight();\n                            const drawerPeekDistance = this.mLeftDragger.getEdgeSize();\n                            const alpha = Math.max(0, Math.min(childRight / drawerPeekDistance, 1.));\n                            this.mShadowLeft.setBounds(childRight, child.getTop(), childRight + shadowWidth, child.getBottom());\n                            this.mShadowLeft.setAlpha(Math.floor((0xff * alpha)));\n                            this.mShadowLeft.draw(canvas);\n                        }\n                        else if (this.mShadowRight != null && this.checkDrawerViewAbsoluteGravity(child, Gravity.RIGHT)) {\n                            const shadowWidth = this.mShadowRight.getIntrinsicWidth();\n                            const childLeft = child.getLeft();\n                            const showing = this.getWidth() - childLeft;\n                            const drawerPeekDistance = this.mRightDragger.getEdgeSize();\n                            const alpha = Math.max(0, Math.min(showing / drawerPeekDistance, 1.));\n                            this.mShadowRight.setBounds(childLeft - shadowWidth, child.getTop(), childLeft, child.getBottom());\n                            this.mShadowRight.setAlpha(Math.floor((0xff * alpha)));\n                            this.mShadowRight.draw(canvas);\n                        }\n                        return result;\n                    }\n                    isContentView(child) {\n                        return child.getLayoutParams().gravity == Gravity.NO_GRAVITY;\n                    }\n                    isDrawerView(child) {\n                        const gravity = child.getLayoutParams().gravity;\n                        const absGravity = Gravity.getAbsoluteGravity(gravity, child.getLayoutDirection());\n                        return (absGravity & (Gravity.LEFT | Gravity.RIGHT)) != 0;\n                    }\n                    onInterceptTouchEvent(ev) {\n                        const action = ev.getActionMasked();\n                        const leftIntercept = this.mLeftDragger.shouldInterceptTouchEvent(ev);\n                        const rightIntercept = this.mRightDragger.shouldInterceptTouchEvent(ev);\n                        const interceptForDrag = leftIntercept || rightIntercept;\n                        let interceptForTap = false;\n                        switch (action) {\n                            case MotionEvent.ACTION_DOWN:\n                                {\n                                    const x = ev.getX();\n                                    const y = ev.getY();\n                                    this.mInitialMotionX = x;\n                                    this.mInitialMotionY = y;\n                                    if (this.mScrimOpacity > 0 && this.isContentView(this.mLeftDragger.findTopChildUnder(Math.floor(x), Math.floor(y)))) {\n                                        interceptForTap = true;\n                                    }\n                                    this.mDisallowInterceptRequested = false;\n                                    this.mChildrenCanceledTouch = false;\n                                    break;\n                                }\n                            case MotionEvent.ACTION_MOVE:\n                                {\n                                    if (this.mLeftDragger.checkTouchSlop(ViewDragHelper.DIRECTION_ALL)) {\n                                        this.mLeftCallback.removeCallbacks();\n                                        this.mRightCallback.removeCallbacks();\n                                    }\n                                    break;\n                                }\n                            case MotionEvent.ACTION_CANCEL:\n                            case MotionEvent.ACTION_UP:\n                                {\n                                    this.closeDrawers(true);\n                                    this.mDisallowInterceptRequested = false;\n                                    this.mChildrenCanceledTouch = false;\n                                }\n                        }\n                        return interceptForDrag || interceptForTap || this.hasPeekingDrawer() || this.mChildrenCanceledTouch;\n                    }\n                    onTouchEvent(ev) {\n                        this.mLeftDragger.processTouchEvent(ev);\n                        this.mRightDragger.processTouchEvent(ev);\n                        const action = ev.getAction();\n                        let wantTouchEvents = true;\n                        switch (action & MotionEvent.ACTION_MASK) {\n                            case MotionEvent.ACTION_DOWN:\n                                {\n                                    const x = ev.getX();\n                                    const y = ev.getY();\n                                    this.mInitialMotionX = x;\n                                    this.mInitialMotionY = y;\n                                    this.mDisallowInterceptRequested = false;\n                                    this.mChildrenCanceledTouch = false;\n                                    break;\n                                }\n                            case MotionEvent.ACTION_UP:\n                                {\n                                    const x = ev.getX();\n                                    const y = ev.getY();\n                                    let peekingOnly = true;\n                                    const touchedView = this.mLeftDragger.findTopChildUnder(Math.floor(x), Math.floor(y));\n                                    if (touchedView != null && this.isContentView(touchedView)) {\n                                        const dx = x - this.mInitialMotionX;\n                                        const dy = y - this.mInitialMotionY;\n                                        const slop = this.mLeftDragger.getTouchSlop();\n                                        if (dx * dx + dy * dy < slop * slop) {\n                                            const openDrawer = this.findOpenDrawer();\n                                            if (openDrawer != null) {\n                                                peekingOnly = this.getDrawerLockMode(openDrawer) == DrawerLayout.LOCK_MODE_LOCKED_OPEN;\n                                            }\n                                        }\n                                    }\n                                    this.closeDrawers(peekingOnly);\n                                    this.mDisallowInterceptRequested = false;\n                                    break;\n                                }\n                            case MotionEvent.ACTION_CANCEL:\n                                {\n                                    this.closeDrawers(true);\n                                    this.mDisallowInterceptRequested = false;\n                                    this.mChildrenCanceledTouch = false;\n                                    break;\n                                }\n                        }\n                        return wantTouchEvents;\n                    }\n                    requestDisallowInterceptTouchEvent(disallowIntercept) {\n                        if (DrawerLayout.CHILDREN_DISALLOW_INTERCEPT || (!this.mLeftDragger.isEdgeTouched(ViewDragHelper.EDGE_LEFT) && !this.mRightDragger.isEdgeTouched(ViewDragHelper.EDGE_RIGHT))) {\n                            super.requestDisallowInterceptTouchEvent(disallowIntercept);\n                        }\n                        this.mDisallowInterceptRequested = disallowIntercept;\n                        if (disallowIntercept) {\n                            this.closeDrawers(true);\n                        }\n                    }\n                    closeDrawers(peekingOnly = false) {\n                        let needsInvalidate = false;\n                        const childCount = this.getChildCount();\n                        for (let i = 0; i < childCount; i++) {\n                            const child = this.getChildAt(i);\n                            const lp = child.getLayoutParams();\n                            if (!this.isDrawerView(child) || (peekingOnly && !lp.isPeeking)) {\n                                continue;\n                            }\n                            const childWidth = child.getWidth();\n                            if (this.checkDrawerViewAbsoluteGravity(child, Gravity.LEFT)) {\n                                needsInvalidate = this.mLeftDragger.smoothSlideViewTo(child, -childWidth, child.getTop()) || needsInvalidate;\n                            }\n                            else {\n                                needsInvalidate = this.mRightDragger.smoothSlideViewTo(child, this.getWidth(), child.getTop()) || needsInvalidate;\n                            }\n                            lp.isPeeking = false;\n                        }\n                        this.mLeftCallback.removeCallbacks();\n                        this.mRightCallback.removeCallbacks();\n                        if (needsInvalidate) {\n                            this.invalidate();\n                        }\n                    }\n                    openDrawer(arg) {\n                        if (arg instanceof View) {\n                            this._openDrawer_view(arg);\n                        }\n                        else {\n                            this._openDrawer_gravity(arg);\n                        }\n                    }\n                    _openDrawer_view(drawerView) {\n                        if (!this.isDrawerView(drawerView)) {\n                            throw Error(`new IllegalArgumentException(\"View \" + drawerView + \" is not a sliding drawer\")`);\n                        }\n                        if (this.mFirstLayout) {\n                            const lp = drawerView.getLayoutParams();\n                            lp.onScreen = 1.;\n                            lp.knownOpen = true;\n                        }\n                        else {\n                            if (this.checkDrawerViewAbsoluteGravity(drawerView, Gravity.LEFT)) {\n                                this.mLeftDragger.smoothSlideViewTo(drawerView, 0, drawerView.getTop());\n                            }\n                            else {\n                                this.mRightDragger.smoothSlideViewTo(drawerView, this.getWidth() - drawerView.getWidth(), drawerView.getTop());\n                            }\n                        }\n                        this.invalidate();\n                    }\n                    _openDrawer_gravity(gravity) {\n                        const drawerView = this.findDrawerWithGravity(gravity);\n                        if (drawerView == null) {\n                            throw Error(`new IllegalArgumentException(\"No drawer view found with gravity \" + DrawerLayout.gravityToString(gravity))`);\n                        }\n                        this.openDrawer(drawerView);\n                    }\n                    closeDrawer(arg) {\n                        if (arg instanceof View) {\n                            this._closeDrawer_view(arg);\n                        }\n                        else {\n                            this._closeDrawer_gravity(arg);\n                        }\n                    }\n                    _closeDrawer_view(drawerView) {\n                        if (!this.isDrawerView(drawerView)) {\n                            throw Error(`new IllegalArgumentException(\"View \" + drawerView + \" is not a sliding drawer\")`);\n                        }\n                        if (this.mFirstLayout) {\n                            const lp = drawerView.getLayoutParams();\n                            lp.onScreen = 0.;\n                            lp.knownOpen = false;\n                        }\n                        else {\n                            if (this.checkDrawerViewAbsoluteGravity(drawerView, Gravity.LEFT)) {\n                                this.mLeftDragger.smoothSlideViewTo(drawerView, -drawerView.getWidth(), drawerView.getTop());\n                            }\n                            else {\n                                this.mRightDragger.smoothSlideViewTo(drawerView, this.getWidth(), drawerView.getTop());\n                            }\n                        }\n                        this.invalidate();\n                    }\n                    _closeDrawer_gravity(gravity) {\n                        const drawerView = this.findDrawerWithGravity(gravity);\n                        if (drawerView == null) {\n                            throw Error(`new IllegalArgumentException(\"No drawer view found with gravity \" + DrawerLayout.gravityToString(gravity))`);\n                        }\n                        this.closeDrawer(drawerView);\n                    }\n                    isDrawerOpen(arg) {\n                        if (arg instanceof View) {\n                            return this._isDrawerOpen_view(arg);\n                        }\n                        else {\n                            return this._isDrawerOpen_gravity(arg);\n                        }\n                    }\n                    _isDrawerOpen_view(drawer) {\n                        if (!this.isDrawerView(drawer)) {\n                            throw Error(`new IllegalArgumentException(\"View \" + drawer + \" is not a drawer\")`);\n                        }\n                        return drawer.getLayoutParams().knownOpen;\n                    }\n                    _isDrawerOpen_gravity(drawerGravity) {\n                        const drawerView = this.findDrawerWithGravity(drawerGravity);\n                        if (drawerView != null) {\n                            return this.isDrawerOpen(drawerView);\n                        }\n                        return false;\n                    }\n                    isDrawerVisible(arg) {\n                        if (arg instanceof View) {\n                            return this._isDrawerVisible_view(arg);\n                        }\n                        else {\n                            return this._isDrawerVisible_gravity(arg);\n                        }\n                    }\n                    _isDrawerVisible_view(drawer) {\n                        if (!this.isDrawerView(drawer)) {\n                            throw Error(`new IllegalArgumentException(\"View \" + drawer + \" is not a drawer\")`);\n                        }\n                        return drawer.getLayoutParams().onScreen > 0;\n                    }\n                    _isDrawerVisible_gravity(drawerGravity) {\n                        const drawerView = this.findDrawerWithGravity(drawerGravity);\n                        if (drawerView != null) {\n                            return this.isDrawerVisible(drawerView);\n                        }\n                        return false;\n                    }\n                    hasPeekingDrawer() {\n                        const childCount = this.getChildCount();\n                        for (let i = 0; i < childCount; i++) {\n                            const lp = this.getChildAt(i).getLayoutParams();\n                            if (lp.isPeeking) {\n                                return true;\n                            }\n                        }\n                        return false;\n                    }\n                    generateDefaultLayoutParams() {\n                        return new DrawerLayout.LayoutParams(DrawerLayout.LayoutParams.FILL_PARENT, DrawerLayout.LayoutParams.FILL_PARENT);\n                    }\n                    generateLayoutParams(p) {\n                        return p instanceof DrawerLayout.LayoutParams ? new DrawerLayout.LayoutParams(p)\n                            : p instanceof ViewGroup.MarginLayoutParams ? new DrawerLayout.LayoutParams(p)\n                                : new DrawerLayout.LayoutParams(p);\n                    }\n                    checkLayoutParams(p) {\n                        return p instanceof DrawerLayout.LayoutParams && super.checkLayoutParams(p);\n                    }\n                    generateLayoutParamsFromAttr(attrs) {\n                        return new DrawerLayout.LayoutParams(this.getContext(), attrs);\n                    }\n                    hasVisibleDrawer() {\n                        return this.findVisibleDrawer() != null;\n                    }\n                    findVisibleDrawer() {\n                        const childCount = this.getChildCount();\n                        for (let i = 0; i < childCount; i++) {\n                            const child = this.getChildAt(i);\n                            if (this.isDrawerView(child) && this.isDrawerVisible(child)) {\n                                return child;\n                            }\n                        }\n                        return null;\n                    }\n                    cancelChildViewTouch() {\n                        if (!this.mChildrenCanceledTouch) {\n                            const now = SystemClock.uptimeMillis();\n                            const cancelEvent = MotionEvent.obtainWithAction(now, now, MotionEvent.ACTION_CANCEL, 0.0, 0.0, 0);\n                            const childCount = this.getChildCount();\n                            for (let i = 0; i < childCount; i++) {\n                                this.getChildAt(i).dispatchTouchEvent(cancelEvent);\n                            }\n                            cancelEvent.recycle();\n                            this.mChildrenCanceledTouch = true;\n                        }\n                    }\n                    onKeyDown(keyCode, event) {\n                        if (keyCode == KeyEvent.KEYCODE_BACK && this.hasVisibleDrawer()) {\n                            event.startTracking();\n                            return true;\n                        }\n                        return super.onKeyDown(keyCode, event);\n                    }\n                    onKeyUp(keyCode, event) {\n                        if (keyCode == KeyEvent.KEYCODE_BACK) {\n                            const visibleDrawer = this.findVisibleDrawer();\n                            if (visibleDrawer != null && this.getDrawerLockMode(visibleDrawer) == DrawerLayout.LOCK_MODE_UNLOCKED) {\n                                this.closeDrawers();\n                            }\n                            return visibleDrawer != null;\n                        }\n                        return super.onKeyUp(keyCode, event);\n                    }\n                }\n                DrawerLayout.TAG = \"DrawerLayout\";\n                DrawerLayout.STATE_IDLE = ViewDragHelper.STATE_IDLE;\n                DrawerLayout.STATE_DRAGGING = ViewDragHelper.STATE_DRAGGING;\n                DrawerLayout.STATE_SETTLING = ViewDragHelper.STATE_SETTLING;\n                DrawerLayout.LOCK_MODE_UNLOCKED = 0;\n                DrawerLayout.LOCK_MODE_LOCKED_CLOSED = 1;\n                DrawerLayout.LOCK_MODE_LOCKED_OPEN = 2;\n                DrawerLayout.MIN_DRAWER_MARGIN = 64;\n                DrawerLayout.DEFAULT_SCRIM_COLOR = 0x99000000;\n                DrawerLayout.PEEK_DELAY = 160;\n                DrawerLayout.MIN_FLING_VELOCITY = 400;\n                DrawerLayout.ALLOW_EDGE_LOCK = false;\n                DrawerLayout.CHILDREN_DISALLOW_INTERCEPT = true;\n                DrawerLayout.TOUCH_SLOP_SENSITIVITY = 1.;\n                widget.DrawerLayout = DrawerLayout;\n                (function (DrawerLayout) {\n                    class SimpleDrawerListener {\n                        onDrawerSlide(drawerView, slideOffset) {\n                        }\n                        onDrawerOpened(drawerView) {\n                        }\n                        onDrawerClosed(drawerView) {\n                        }\n                        onDrawerStateChanged(newState) {\n                        }\n                    }\n                    DrawerLayout.SimpleDrawerListener = SimpleDrawerListener;\n                    class ViewDragCallback extends ViewDragHelper.Callback {\n                        constructor(arg, gravity) {\n                            super();\n                            this.mAbsGravity = 0;\n                            this.mPeekRunnable = (() => {\n                                const inner_this = this;\n                                class _Inner {\n                                    run() {\n                                        inner_this.peekDrawer();\n                                    }\n                                }\n                                return new _Inner();\n                            })();\n                            this._DrawerLayout_this = arg;\n                            this.mAbsGravity = gravity;\n                        }\n                        setDragger(dragger) {\n                            this.mDragger = dragger;\n                        }\n                        removeCallbacks() {\n                            this._DrawerLayout_this.removeCallbacks(this.mPeekRunnable);\n                        }\n                        tryCaptureView(child, pointerId) {\n                            return this._DrawerLayout_this.isDrawerView(child) && this._DrawerLayout_this.checkDrawerViewAbsoluteGravity(child, this.mAbsGravity) && this._DrawerLayout_this.getDrawerLockMode(child) == DrawerLayout.LOCK_MODE_UNLOCKED;\n                        }\n                        onViewDragStateChanged(state) {\n                            this._DrawerLayout_this.updateDrawerState(this.mAbsGravity, state, this.mDragger.getCapturedView());\n                        }\n                        onViewPositionChanged(changedView, left, top, dx, dy) {\n                            let offset;\n                            const childWidth = changedView.getWidth();\n                            if (this._DrawerLayout_this.checkDrawerViewAbsoluteGravity(changedView, Gravity.LEFT)) {\n                                offset = (childWidth + left) / childWidth;\n                            }\n                            else {\n                                const width = this._DrawerLayout_this.getWidth();\n                                offset = (width - left) / childWidth;\n                            }\n                            this._DrawerLayout_this.setDrawerViewOffset(changedView, offset);\n                            changedView.setVisibility(offset == 0 ? DrawerLayout.INVISIBLE : DrawerLayout.VISIBLE);\n                            this._DrawerLayout_this.invalidate();\n                        }\n                        onViewCaptured(capturedChild, activePointerId) {\n                            const lp = capturedChild.getLayoutParams();\n                            lp.isPeeking = false;\n                            this.closeOtherDrawer();\n                        }\n                        closeOtherDrawer() {\n                            const otherGrav = this.mAbsGravity == Gravity.LEFT ? Gravity.RIGHT : Gravity.LEFT;\n                            const toClose = this._DrawerLayout_this.findDrawerWithGravity(otherGrav);\n                            if (toClose != null) {\n                                this._DrawerLayout_this.closeDrawer(toClose);\n                            }\n                        }\n                        onViewReleased(releasedChild, xvel, yvel) {\n                            const offset = this._DrawerLayout_this.getDrawerViewOffset(releasedChild);\n                            const childWidth = releasedChild.getWidth();\n                            let left;\n                            if (this._DrawerLayout_this.checkDrawerViewAbsoluteGravity(releasedChild, Gravity.LEFT)) {\n                                left = xvel > 0 || xvel == 0 && offset > 0.5 ? 0 : -childWidth;\n                            }\n                            else {\n                                const width = this._DrawerLayout_this.getWidth();\n                                left = xvel < 0 || xvel == 0 && offset > 0.5 ? width - childWidth : width;\n                            }\n                            this.mDragger.settleCapturedViewAt(left, releasedChild.getTop());\n                            this._DrawerLayout_this.invalidate();\n                        }\n                        onEdgeTouched(edgeFlags, pointerId) {\n                            this._DrawerLayout_this.postDelayed(this.mPeekRunnable, DrawerLayout.PEEK_DELAY);\n                        }\n                        peekDrawer() {\n                            let toCapture;\n                            let childLeft;\n                            const peekDistance = this.mDragger.getEdgeSize();\n                            const leftEdge = this.mAbsGravity == Gravity.LEFT;\n                            if (leftEdge) {\n                                toCapture = this._DrawerLayout_this.findDrawerWithGravity(Gravity.LEFT);\n                                childLeft = (toCapture != null ? -toCapture.getWidth() : 0) + peekDistance;\n                            }\n                            else {\n                                toCapture = this._DrawerLayout_this.findDrawerWithGravity(Gravity.RIGHT);\n                                childLeft = this._DrawerLayout_this.getWidth() - peekDistance;\n                            }\n                            if (toCapture != null && ((leftEdge && toCapture.getLeft() < childLeft) || (!leftEdge && toCapture.getLeft() > childLeft)) && this._DrawerLayout_this.getDrawerLockMode(toCapture) == DrawerLayout.LOCK_MODE_UNLOCKED) {\n                                const lp = toCapture.getLayoutParams();\n                                this.mDragger.smoothSlideViewTo(toCapture, childLeft, toCapture.getTop());\n                                lp.isPeeking = true;\n                                this._DrawerLayout_this.invalidate();\n                                this.closeOtherDrawer();\n                                this._DrawerLayout_this.cancelChildViewTouch();\n                            }\n                        }\n                        onEdgeLock(edgeFlags) {\n                            if (DrawerLayout.ALLOW_EDGE_LOCK) {\n                                const drawer = this._DrawerLayout_this.findDrawerWithGravity(this.mAbsGravity);\n                                if (drawer != null && !this._DrawerLayout_this.isDrawerOpen(drawer)) {\n                                    this._DrawerLayout_this.closeDrawer(drawer);\n                                }\n                                return true;\n                            }\n                            return false;\n                        }\n                        onEdgeDragStarted(edgeFlags, pointerId) {\n                            let toCapture;\n                            if ((edgeFlags & ViewDragHelper.EDGE_LEFT) == ViewDragHelper.EDGE_LEFT) {\n                                toCapture = this._DrawerLayout_this.findDrawerWithGravity(Gravity.LEFT);\n                            }\n                            else {\n                                toCapture = this._DrawerLayout_this.findDrawerWithGravity(Gravity.RIGHT);\n                            }\n                            if (toCapture != null && this._DrawerLayout_this.getDrawerLockMode(toCapture) == DrawerLayout.LOCK_MODE_UNLOCKED) {\n                                this.mDragger.captureChildView(toCapture, pointerId);\n                            }\n                        }\n                        getViewHorizontalDragRange(child) {\n                            return child.getWidth();\n                        }\n                        clampViewPositionHorizontal(child, left, dx) {\n                            if (this._DrawerLayout_this.checkDrawerViewAbsoluteGravity(child, Gravity.LEFT)) {\n                                return Math.max(-child.getWidth(), Math.min(left, 0));\n                            }\n                            else {\n                                const width = this._DrawerLayout_this.getWidth();\n                                return Math.max(width - child.getWidth(), Math.min(left, width));\n                            }\n                        }\n                        clampViewPositionVertical(child, top, dy) {\n                            return child.getTop();\n                        }\n                    }\n                    DrawerLayout.ViewDragCallback = ViewDragCallback;\n                    class LayoutParams extends ViewGroup.MarginLayoutParams {\n                        constructor(...args) {\n                            super(...(() => {\n                                if (args[0] instanceof android.content.Context && args[1] instanceof HTMLElement)\n                                    return [args[0], args[1]];\n                                else if (typeof args[0] === 'number' && typeof args[1] === 'number' && typeof args[2] === 'number')\n                                    return [args[0], args[1]];\n                                else if (typeof args[0] === 'number' && typeof args[1] === 'number')\n                                    return [args[0], args[1]];\n                                else if (args[0] instanceof DrawerLayout.LayoutParams)\n                                    return [args[0]];\n                                else if (args[0] instanceof ViewGroup.MarginLayoutParams)\n                                    return [args[0]];\n                                else if (args[0] instanceof ViewGroup.LayoutParams)\n                                    return [args[0]];\n                            })());\n                            this.gravity = Gravity.NO_GRAVITY;\n                            this.onScreen = 0;\n                            if (args[0] instanceof Context && args[1] instanceof HTMLElement) {\n                                const c = args[0];\n                                const attrs = args[1];\n                                const a = c.obtainStyledAttributes(attrs);\n                                this.gravity = Gravity.parseGravity(a.getAttrValue('layout_gravity'), Gravity.NO_GRAVITY);\n                                a.recycle();\n                            }\n                            else if (typeof args[0] === 'number' && typeof args[1] === 'number' && typeof args[2] == 'number') {\n                                this.gravity = args[2];\n                            }\n                            else if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n                            }\n                            else if (args[0] instanceof DrawerLayout.LayoutParams) {\n                                const source = args[0];\n                                this.gravity = source.gravity;\n                            }\n                            else if (args[0] instanceof ViewGroup.MarginLayoutParams) {\n                            }\n                            else if (args[0] instanceof ViewGroup.LayoutParams) {\n                            }\n                        }\n                        createClassAttrBinder() {\n                            return super.createClassAttrBinder().set('layout_gravity', {\n                                setter(param, value, attrBinder) {\n                                    param.gravity = attrBinder.parseGravity(value, param.gravity);\n                                }, getter(param) {\n                                    return param.gravity;\n                                }\n                            });\n                        }\n                    }\n                    DrawerLayout.LayoutParams = LayoutParams;\n                })(DrawerLayout = widget.DrawerLayout || (widget.DrawerLayout = {}));\n            })(widget = v4.widget || (v4.widget = {}));\n        })(v4 = support.v4 || (support.v4 = {}));\n    })(support = android.support || (android.support = {}));\n})(android || (android = {}));\nvar com;\n(function (com) {\n    var jakewharton;\n    (function (jakewharton) {\n        var salvage;\n        (function (salvage) {\n            var SparseArray = android.util.SparseArray;\n            var PagerAdapter = android.support.v4.view.PagerAdapter;\n            class RecyclingPagerAdapter extends PagerAdapter {\n                constructor() {\n                    super();\n                    this.recycleBin = new RecycleBin();\n                    this.recycleBin.setViewTypeCount(this.getViewTypeCount());\n                }\n                notifyDataSetChanged() {\n                    this.recycleBin.scrapActiveViews();\n                    super.notifyDataSetChanged();\n                }\n                instantiateItem(container, position) {\n                    let viewType = this.getItemViewType(position);\n                    let view = null;\n                    if (viewType != RecyclingPagerAdapter.IGNORE_ITEM_VIEW_TYPE) {\n                        view = this.recycleBin.getScrapView(position, viewType);\n                    }\n                    view = this.getView(position, view, container);\n                    container.addView(view);\n                    return view;\n                }\n                destroyItem(container, position, object) {\n                    let view = object;\n                    container.removeView(view);\n                    let viewType = this.getItemViewType(position);\n                    if (viewType != RecyclingPagerAdapter.IGNORE_ITEM_VIEW_TYPE) {\n                        this.recycleBin.addScrapView(view, position, viewType);\n                    }\n                }\n                isViewFromObject(view, object) {\n                    return view === object;\n                }\n                getViewTypeCount() {\n                    return 1;\n                }\n                getItemViewType(position) {\n                    return 0;\n                }\n            }\n            RecyclingPagerAdapter.IGNORE_ITEM_VIEW_TYPE = -1;\n            salvage.RecyclingPagerAdapter = RecyclingPagerAdapter;\n            class RecycleBin {\n                constructor() {\n                    this.activeViews = [];\n                    this.activeViewTypes = [];\n                    this.viewTypeCount = 0;\n                }\n                setViewTypeCount(viewTypeCount) {\n                    if (viewTypeCount < 1) {\n                        throw new Error(\"Can't have a viewTypeCount < 1\");\n                    }\n                    let scrapViews = new Array(viewTypeCount);\n                    for (let i = 0; i < viewTypeCount; i++) {\n                        scrapViews[i] = new SparseArray();\n                    }\n                    this.viewTypeCount = viewTypeCount;\n                    this.currentScrapViews = scrapViews[0];\n                    this.scrapViews = scrapViews;\n                }\n                shouldRecycleViewType(viewType) {\n                    return viewType >= 0;\n                }\n                getScrapView(position, viewType) {\n                    if (this.viewTypeCount == 1) {\n                        return this.retrieveFromScrap(this.currentScrapViews, position);\n                    }\n                    else if (viewType >= 0 && viewType < this.scrapViews.length) {\n                        return this.retrieveFromScrap(this.scrapViews[viewType], position);\n                    }\n                    return null;\n                }\n                addScrapView(scrap, position, viewType) {\n                    if (this.viewTypeCount == 1) {\n                        this.currentScrapViews.put(position, scrap);\n                    }\n                    else {\n                        this.scrapViews[viewType].put(position, scrap);\n                    }\n                }\n                scrapActiveViews() {\n                    const activeViews = this.activeViews;\n                    const activeViewTypes = this.activeViewTypes;\n                    const multipleScraps = this.viewTypeCount > 1;\n                    let scrapViews = this.currentScrapViews;\n                    const count = activeViews.length;\n                    for (let i = count - 1; i >= 0; i--) {\n                        const victim = activeViews[i];\n                        if (victim != null) {\n                            let whichScrap = activeViewTypes[i];\n                            activeViews[i] = null;\n                            activeViewTypes[i] = -1;\n                            if (!this.shouldRecycleViewType(whichScrap)) {\n                                continue;\n                            }\n                            if (multipleScraps) {\n                                scrapViews = this.scrapViews[whichScrap];\n                            }\n                            scrapViews.put(i, victim);\n                        }\n                    }\n                    this.pruneScrapViews();\n                }\n                pruneScrapViews() {\n                    const maxViews = this.activeViews.length;\n                    const viewTypeCount = this.viewTypeCount;\n                    const scrapViews = this.scrapViews;\n                    for (let i = 0; i < viewTypeCount; ++i) {\n                        const scrapPile = scrapViews[i];\n                        let size = scrapPile.size();\n                        const extras = size - maxViews;\n                        size--;\n                        for (let j = 0; j < extras; j++) {\n                            scrapPile.remove(scrapPile.keyAt(size--));\n                        }\n                    }\n                }\n                retrieveFromScrap(scrapViews, position) {\n                    let size = scrapViews.size();\n                    if (size > 0) {\n                        for (let i = 0; i < size; i++) {\n                            let fromPosition = scrapViews.keyAt(i);\n                            let view = scrapViews.get(fromPosition);\n                            if (fromPosition == position) {\n                                scrapViews.remove(fromPosition);\n                                return view;\n                            }\n                        }\n                        let index = size - 1;\n                        let r = scrapViews.valueAt(index);\n                        scrapViews.remove(scrapViews.keyAt(index));\n                        return r;\n                    }\n                    else {\n                        return null;\n                    }\n                }\n            }\n        })(salvage = jakewharton.salvage || (jakewharton.salvage = {}));\n    })(jakewharton = com.jakewharton || (com.jakewharton = {}));\n})(com || (com = {}));\nvar uk;\n(function (uk) {\n    var co;\n    (function (co) {\n        var senab;\n        (function (senab) {\n            var photoview;\n            (function (photoview) {\n                var Log = android.util.Log;\n                var MotionEvent = android.view.MotionEvent;\n                var ScaleGestureDetector = android.view.ScaleGestureDetector;\n                var VelocityTracker = android.view.VelocityTracker;\n                var ViewConfiguration = android.view.ViewConfiguration;\n                class GestureDetector {\n                    constructor() {\n                        this.mActivePointerId = GestureDetector.INVALID_POINTER_ID;\n                        this.mActivePointerIndex = 0;\n                        this.mLastTouchX = 0;\n                        this.mLastTouchY = 0;\n                        this.mTouchSlop = 0;\n                        this.mMinimumVelocity = 0;\n                        const configuration = ViewConfiguration.get();\n                        this.mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();\n                        this.mTouchSlop = configuration.getScaledTouchSlop();\n                        const inner_this = this;\n                        let scaleListener = {\n                            onScale(detector) {\n                                let scaleFactor = detector.getScaleFactor();\n                                if (Number.isNaN(scaleFactor) || !Number.isFinite(scaleFactor))\n                                    return false;\n                                inner_this.mListener.onScale(scaleFactor, detector.getFocusX(), detector.getFocusY());\n                                return true;\n                            },\n                            onScaleBegin(detector) {\n                                return true;\n                            },\n                            onScaleEnd(detector) {\n                            }\n                        };\n                        this.mScaleDetector = new ScaleGestureDetector(scaleListener);\n                    }\n                    setOnGestureListener(listener) {\n                        this.mListener = listener;\n                    }\n                    getActiveX(ev) {\n                        return ev.getX(this.mActivePointerIndex < 0 ? 0 : this.mActivePointerIndex);\n                    }\n                    getActiveY(ev) {\n                        return ev.getY(this.mActivePointerIndex < 0 ? 0 : this.mActivePointerIndex);\n                    }\n                    isScaling() {\n                        return this.mScaleDetector.isInProgress();\n                    }\n                    isDragging() {\n                        return this.mIsDragging;\n                    }\n                    onTouchEvent(ev) {\n                        this.mScaleDetector.onTouchEvent(ev);\n                        const action = ev.getAction();\n                        switch (action & MotionEvent.ACTION_MASK) {\n                            case MotionEvent.ACTION_DOWN:\n                                this.mActivePointerId = ev.getPointerId(0);\n                                break;\n                            case MotionEvent.ACTION_CANCEL:\n                            case MotionEvent.ACTION_UP:\n                                this.mActivePointerId = GestureDetector.INVALID_POINTER_ID;\n                                break;\n                            case MotionEvent.ACTION_POINTER_UP:\n                                const pointerIndex = ev.getActionIndex();\n                                const pointerId = ev.getPointerId(pointerIndex);\n                                if (pointerId == this.mActivePointerId) {\n                                    const newPointerIndex = pointerIndex == 0 ? 1 : 0;\n                                    this.mActivePointerId = ev.getPointerId(newPointerIndex);\n                                    this.mLastTouchX = ev.getX(newPointerIndex);\n                                    this.mLastTouchY = ev.getY(newPointerIndex);\n                                }\n                                break;\n                        }\n                        this.mActivePointerIndex = ev.findPointerIndex(this.mActivePointerId != GestureDetector.INVALID_POINTER_ID ? this.mActivePointerId : 0);\n                        switch (ev.getAction()) {\n                            case MotionEvent.ACTION_DOWN:\n                                {\n                                    this.mVelocityTracker = VelocityTracker.obtain();\n                                    if (null != this.mVelocityTracker) {\n                                        this.mVelocityTracker.addMovement(ev);\n                                    }\n                                    else {\n                                        Log.i(GestureDetector.LOG_TAG, \"Velocity tracker is null\");\n                                    }\n                                    this.mLastTouchX = this.getActiveX(ev);\n                                    this.mLastTouchY = this.getActiveY(ev);\n                                    this.mIsDragging = false;\n                                    break;\n                                }\n                            case MotionEvent.ACTION_MOVE:\n                                {\n                                    const x = this.getActiveX(ev);\n                                    const y = this.getActiveY(ev);\n                                    const dx = x - this.mLastTouchX, dy = y - this.mLastTouchY;\n                                    if (!this.mIsDragging) {\n                                        this.mIsDragging = Math.sqrt((dx * dx) + (dy * dy)) >= this.mTouchSlop;\n                                    }\n                                    if (this.mIsDragging) {\n                                        this.mListener.onDrag(dx, dy);\n                                        this.mLastTouchX = x;\n                                        this.mLastTouchY = y;\n                                        if (null != this.mVelocityTracker) {\n                                            this.mVelocityTracker.addMovement(ev);\n                                        }\n                                    }\n                                    break;\n                                }\n                            case MotionEvent.ACTION_CANCEL:\n                                {\n                                    if (null != this.mVelocityTracker) {\n                                        this.mVelocityTracker.recycle();\n                                        this.mVelocityTracker = null;\n                                    }\n                                    break;\n                                }\n                            case MotionEvent.ACTION_UP:\n                                {\n                                    if (this.mIsDragging) {\n                                        if (null != this.mVelocityTracker) {\n                                            this.mLastTouchX = this.getActiveX(ev);\n                                            this.mLastTouchY = this.getActiveY(ev);\n                                            this.mVelocityTracker.addMovement(ev);\n                                            this.mVelocityTracker.computeCurrentVelocity(1000);\n                                            const vX = this.mVelocityTracker.getXVelocity(), vY = this.mVelocityTracker.getYVelocity();\n                                            if (Math.max(Math.abs(vX), Math.abs(vY)) >= this.mMinimumVelocity) {\n                                                this.mListener.onFling(this.mLastTouchX, this.mLastTouchY, -vX, -vY);\n                                            }\n                                        }\n                                    }\n                                    if (null != this.mVelocityTracker) {\n                                        this.mVelocityTracker.recycle();\n                                        this.mVelocityTracker = null;\n                                    }\n                                    break;\n                                }\n                        }\n                        return true;\n                    }\n                }\n                GestureDetector.LOG_TAG = \"CupcakeGestureDetector\";\n                GestureDetector.INVALID_POINTER_ID = -1;\n                photoview.GestureDetector = GestureDetector;\n            })(photoview = senab.photoview || (senab.photoview = {}));\n        })(senab = co.senab || (co.senab = {}));\n    })(co = uk.co || (uk.co = {}));\n})(uk || (uk = {}));\nvar uk;\n(function (uk) {\n    var co;\n    (function (co) {\n        var senab;\n        (function (senab) {\n            var photoview;\n            (function (photoview) {\n                var IPhotoView;\n                (function (IPhotoView) {\n                    IPhotoView.DEFAULT_MAX_SCALE = 3.0;\n                    IPhotoView.DEFAULT_MID_SCALE = 1.75;\n                    IPhotoView.DEFAULT_MIN_SCALE = 1.0;\n                    IPhotoView.DEFAULT_ZOOM_DURATION = 200;\n                    function isImpl(obj) {\n                        if (!obj)\n                            return false;\n                        return obj['canZoom'] &&\n                            obj['getDisplayRect'] &&\n                            obj['setDisplayMatrix'] &&\n                            obj['getDisplayMatrix'] &&\n                            obj['getMinScale'] &&\n                            obj['getMinimumScale'] &&\n                            obj['getMidScale'] &&\n                            obj['getMediumScale'] &&\n                            obj['getMaxScale'] &&\n                            obj['getMaximumScale'] &&\n                            obj['getScale'] &&\n                            obj['getScaleType'] &&\n                            obj['setAllowParentInterceptOnEdge'] &&\n                            obj['setMinScale'] &&\n                            obj['setMinimumScale'] &&\n                            obj['setMidScale'] &&\n                            obj['setMediumScale'] &&\n                            obj['setMaxScale'] &&\n                            obj['setMaximumScale'] &&\n                            obj['setScaleLevels'] &&\n                            obj['setOnLongClickListener'] &&\n                            obj['setOnMatrixChangeListener'] &&\n                            obj['setOnPhotoTapListener'] &&\n                            obj['getOnPhotoTapListener'] &&\n                            obj['setOnViewTapListener'] &&\n                            obj['setRotationTo'] &&\n                            obj['setRotationBy'] &&\n                            obj['getOnViewTapListener'] &&\n                            obj['setScale'] &&\n                            obj['setScale'] &&\n                            obj['setScale'] &&\n                            obj['setScaleType'] &&\n                            obj['setZoomable'] &&\n                            obj['setPhotoViewRotation'] &&\n                            obj['getVisibleRectangleBitmap'] &&\n                            obj['setZoomTransitionDuration'] &&\n                            obj['getIPhotoViewImplementation'] &&\n                            obj['setOnDoubleTapListener'] &&\n                            obj['setOnScaleChangeListener'];\n                    }\n                    IPhotoView.isImpl = isImpl;\n                })(IPhotoView = photoview.IPhotoView || (photoview.IPhotoView = {}));\n            })(photoview = senab.photoview || (senab.photoview = {}));\n        })(senab = co.senab || (co.senab = {}));\n    })(co = uk.co || (uk.co = {}));\n})(uk || (uk = {}));\nvar uk;\n(function (uk) {\n    var co;\n    (function (co) {\n        var senab;\n        (function (senab) {\n            var photoview;\n            (function (photoview) {\n                var Matrix = android.graphics.Matrix;\n                var ScaleToFit = android.graphics.Matrix.ScaleToFit;\n                var RectF = android.graphics.RectF;\n                var Log = android.util.Log;\n                var AccelerateDecelerateInterpolator = android.view.animation.AccelerateDecelerateInterpolator;\n                var ScaleType = android.widget.ImageView.ScaleType;\n                var OverScroller = android.widget.OverScroller;\n                var WeakReference = java.lang.ref.WeakReference;\n                var MotionEvent = android.view.MotionEvent;\n                const ACTION_CANCEL = MotionEvent.ACTION_CANCEL;\n                const ACTION_DOWN = MotionEvent.ACTION_DOWN;\n                const ACTION_UP = MotionEvent.ACTION_UP;\n                var System = java.lang.System;\n                var GestureDetector = uk.co.senab.photoview.GestureDetector;\n                var IPhotoView = uk.co.senab.photoview.IPhotoView;\n                class PhotoViewAttacher {\n                    constructor(imageView, zoomable = true) {\n                        this.ZOOM_DURATION = IPhotoView.DEFAULT_ZOOM_DURATION;\n                        this.mMinScale = IPhotoView.DEFAULT_MIN_SCALE;\n                        this.mMidScale = IPhotoView.DEFAULT_MID_SCALE;\n                        this.mMaxScale = IPhotoView.DEFAULT_MAX_SCALE;\n                        this.mAllowParentInterceptOnEdge = true;\n                        this.mBlockParentIntercept = false;\n                        this.mBaseMatrix = new Matrix();\n                        this.mDrawMatrix = new Matrix();\n                        this.mSuppMatrix = new Matrix();\n                        this.mDisplayRect = new RectF();\n                        this.mMatrixValues = androidui.util.ArrayCreator.newNumberArray(9);\n                        this.mIvTop = 0;\n                        this.mIvRight = 0;\n                        this.mIvBottom = 0;\n                        this.mIvLeft = 0;\n                        this.mScrollEdge = PhotoViewAttacher.EDGE_BOTH;\n                        this.mScaleType = ScaleType.FIT_CENTER;\n                        this.mImageView = new WeakReference(imageView);\n                        imageView.setOnTouchListener(this);\n                        let observer = imageView.getViewTreeObserver();\n                        if (null != observer)\n                            observer.addOnGlobalLayoutListener(this);\n                        PhotoViewAttacher.setImageViewScaleTypeMatrix(imageView);\n                        this.mScaleDragDetector = new GestureDetector();\n                        this.mScaleDragDetector.setOnGestureListener(this);\n                        this.mGestureDetector = new android.view.GestureDetector((() => {\n                            const inner_this = this;\n                            class _Inner extends android.view.GestureDetector.SimpleOnGestureListener {\n                                onLongPress(e) {\n                                    if (null != inner_this.mLongClickListener) {\n                                        inner_this.mLongClickListener.onLongClick(inner_this.getImageView());\n                                    }\n                                }\n                            }\n                            return new _Inner();\n                        })());\n                        this.mGestureDetector.setOnDoubleTapListener(new PhotoViewAttacher.DefaultOnDoubleTapListener(this));\n                        this.setZoomable(zoomable);\n                    }\n                    static checkZoomLevels(minZoom, midZoom, maxZoom) {\n                        if (minZoom >= midZoom) {\n                            throw Error(`new IllegalArgumentException(\"MinZoom has to be less than MidZoom\")`);\n                        }\n                        else if (midZoom >= maxZoom) {\n                            throw Error(`new IllegalArgumentException(\"MidZoom has to be less than MaxZoom\")`);\n                        }\n                    }\n                    static hasDrawable(imageView) {\n                        return null != imageView && null != imageView.getDrawable();\n                    }\n                    static isSupportedScaleType(scaleType) {\n                        if (null == scaleType) {\n                            return false;\n                        }\n                        switch (scaleType) {\n                            case ScaleType.MATRIX:\n                                throw Error(`new IllegalArgumentException(ScaleType.MATRIX is not supported in PhotoView)`);\n                            default:\n                                return true;\n                        }\n                    }\n                    static setImageViewScaleTypeMatrix(imageView) {\n                        if (null != imageView && !(IPhotoView.isImpl(imageView))) {\n                            if (ScaleType.MATRIX != (imageView.getScaleType())) {\n                                imageView.setScaleType(ScaleType.MATRIX);\n                            }\n                        }\n                    }\n                    setOnDoubleTapListener(newOnDoubleTapListener) {\n                        if (newOnDoubleTapListener != null) {\n                            this.mGestureDetector.setOnDoubleTapListener(newOnDoubleTapListener);\n                        }\n                        else {\n                            this.mGestureDetector.setOnDoubleTapListener(new PhotoViewAttacher.DefaultOnDoubleTapListener(this));\n                        }\n                    }\n                    setOnScaleChangeListener(onScaleChangeListener) {\n                        this.mScaleChangeListener = onScaleChangeListener;\n                    }\n                    canZoom() {\n                        return this.mZoomEnabled;\n                    }\n                    cleanup() {\n                        if (null == this.mImageView) {\n                            return;\n                        }\n                        const imageView = this.mImageView.get();\n                        if (null != imageView) {\n                            let observer = imageView.getViewTreeObserver();\n                            if (null != observer && observer.isAlive()) {\n                                observer.removeGlobalOnLayoutListener(this);\n                            }\n                            imageView.setOnTouchListener(null);\n                            this.cancelFling();\n                        }\n                        if (null != this.mGestureDetector) {\n                            this.mGestureDetector.setOnDoubleTapListener(null);\n                        }\n                        this.mMatrixChangeListener = null;\n                        this.mPhotoTapListener = null;\n                        this.mViewTapListener = null;\n                        this.mImageView = null;\n                    }\n                    getDisplayRect() {\n                        this.checkMatrixBounds();\n                        return this._getDisplayRect(this.getDrawMatrix());\n                    }\n                    setDisplayMatrix(finalMatrix) {\n                        if (finalMatrix == null)\n                            throw Error(`new IllegalArgumentException(\"Matrix cannot be null\")`);\n                        let imageView = this.getImageView();\n                        if (null == imageView)\n                            return false;\n                        if (null == imageView.getDrawable())\n                            return false;\n                        this.mSuppMatrix.set(finalMatrix);\n                        this.setImageViewMatrix(this.getDrawMatrix());\n                        this.checkMatrixBounds();\n                        return true;\n                    }\n                    setPhotoViewRotation(degrees) {\n                        this.mSuppMatrix.setRotate(degrees % 360);\n                        this.checkAndDisplayMatrix();\n                    }\n                    setRotationTo(degrees) {\n                        this.mSuppMatrix.setRotate(degrees % 360);\n                        this.checkAndDisplayMatrix();\n                    }\n                    setRotationBy(degrees) {\n                        this.mSuppMatrix.postRotate(degrees % 360);\n                        this.checkAndDisplayMatrix();\n                    }\n                    getImageView() {\n                        let imageView = null;\n                        if (null != this.mImageView) {\n                            imageView = this.mImageView.get();\n                        }\n                        if (null == imageView) {\n                            this.cleanup();\n                            if (PhotoViewAttacher.DEBUG)\n                                Log.i(PhotoViewAttacher.LOG_TAG, \"ImageView no longer exists. You should not use this PhotoViewAttacher any more.\");\n                        }\n                        return imageView;\n                    }\n                    getMinScale() {\n                        return this.getMinimumScale();\n                    }\n                    getMinimumScale() {\n                        return this.mMinScale;\n                    }\n                    getMidScale() {\n                        return this.getMediumScale();\n                    }\n                    getMediumScale() {\n                        return this.mMidScale;\n                    }\n                    getMaxScale() {\n                        return this.getMaximumScale();\n                    }\n                    getMaximumScale() {\n                        return this.mMaxScale;\n                    }\n                    getScale() {\n                        return Math.sqrt(Math.pow(this.getValue(this.mSuppMatrix, Matrix.MSCALE_X), 2) + Math.pow(this.getValue(this.mSuppMatrix, Matrix.MSKEW_Y), 2));\n                    }\n                    getScaleType() {\n                        return this.mScaleType;\n                    }\n                    onDrag(dx, dy) {\n                        if (this.mScaleDragDetector.isScaling()) {\n                            return;\n                        }\n                        if (PhotoViewAttacher.DEBUG) {\n                            Log.d(PhotoViewAttacher.LOG_TAG, `onDrag: dx: ${dx.toFixed(2)}. dy: ${dy.toFixed(2)}`);\n                        }\n                        let imageView = this.getImageView();\n                        this.mSuppMatrix.postTranslate(dx, dy);\n                        this.checkAndDisplayMatrix();\n                        let parent = imageView.getParent();\n                        if (this.mAllowParentInterceptOnEdge && !this.mScaleDragDetector.isScaling() && !this.mBlockParentIntercept) {\n                            if (this.mScrollEdge == PhotoViewAttacher.EDGE_BOTH || (this.mScrollEdge == PhotoViewAttacher.EDGE_LEFT && dx >= 1) || (this.mScrollEdge == PhotoViewAttacher.EDGE_RIGHT && dx <= -1)) {\n                                if (null != parent)\n                                    parent.requestDisallowInterceptTouchEvent(false);\n                            }\n                        }\n                        else {\n                            if (null != parent) {\n                                parent.requestDisallowInterceptTouchEvent(true);\n                            }\n                        }\n                    }\n                    onFling(startX, startY, velocityX, velocityY) {\n                        if (PhotoViewAttacher.DEBUG) {\n                            Log.d(PhotoViewAttacher.LOG_TAG, \"onFling. sX: \" + startX + \" sY: \" + startY + \" Vx: \" + velocityX + \" Vy: \" + velocityY);\n                        }\n                        let imageView = this.getImageView();\n                        this.mCurrentFlingRunnable = new PhotoViewAttacher.FlingRunnable(this);\n                        this.mCurrentFlingRunnable.fling(this.getImageViewWidth(imageView), this.getImageViewHeight(imageView), Math.floor(velocityX), Math.floor(velocityY));\n                        imageView.post(this.mCurrentFlingRunnable);\n                    }\n                    onGlobalLayout() {\n                        let imageView = this.getImageView();\n                        if (null != imageView) {\n                            if (this.mZoomEnabled) {\n                                const top = imageView.getTop();\n                                const right = imageView.getRight();\n                                const bottom = imageView.getBottom();\n                                const left = imageView.getLeft();\n                                if (top != this.mIvTop || bottom != this.mIvBottom || left != this.mIvLeft || right != this.mIvRight) {\n                                    this.updateBaseMatrix(imageView.getDrawable());\n                                    this.mIvTop = top;\n                                    this.mIvRight = right;\n                                    this.mIvBottom = bottom;\n                                    this.mIvLeft = left;\n                                }\n                            }\n                            else {\n                                this.updateBaseMatrix(imageView.getDrawable());\n                            }\n                        }\n                    }\n                    onScale(scaleFactor, focusX, focusY) {\n                        if (PhotoViewAttacher.DEBUG) {\n                            Log.d(PhotoViewAttacher.LOG_TAG, `onScale: scale: ${scaleFactor.toFixed(2)}. fX: ${focusX.toFixed(2)}. fY: ${focusY.toFixed(2)}f`);\n                        }\n                        if (this.getScale() < this.mMaxScale || scaleFactor < 1) {\n                            if (null != this.mScaleChangeListener) {\n                                this.mScaleChangeListener.onScaleChange(scaleFactor, focusX, focusY);\n                            }\n                            this.mSuppMatrix.postScale(scaleFactor, scaleFactor, focusX, focusY);\n                            this.checkAndDisplayMatrix();\n                        }\n                    }\n                    onTouch(v, ev) {\n                        let handled = false;\n                        if (this.mZoomEnabled && PhotoViewAttacher.hasDrawable(v)) {\n                            let parent = v.getParent();\n                            switch (ev.getAction()) {\n                                case ACTION_DOWN:\n                                    if (null != parent) {\n                                        parent.requestDisallowInterceptTouchEvent(true);\n                                    }\n                                    else {\n                                        Log.i(PhotoViewAttacher.LOG_TAG, \"onTouch getParent() returned null\");\n                                    }\n                                    this.cancelFling();\n                                    break;\n                                case ACTION_CANCEL:\n                                case ACTION_UP:\n                                    if (this.getScale() < this.mMinScale) {\n                                        let rect = this.getDisplayRect();\n                                        if (null != rect) {\n                                            v.post(new PhotoViewAttacher.AnimatedZoomRunnable(this, this.getScale(), this.mMinScale, rect.centerX(), rect.centerY()));\n                                            handled = true;\n                                        }\n                                    }\n                                    break;\n                            }\n                            if (null != this.mScaleDragDetector) {\n                                let wasScaling = this.mScaleDragDetector.isScaling();\n                                let wasDragging = this.mScaleDragDetector.isDragging();\n                                handled = this.mScaleDragDetector.onTouchEvent(ev);\n                                let didntScale = !wasScaling && !this.mScaleDragDetector.isScaling();\n                                let didntDrag = !wasDragging && !this.mScaleDragDetector.isDragging();\n                                this.mBlockParentIntercept = didntScale && didntDrag;\n                            }\n                            if (null != this.mGestureDetector && this.mGestureDetector.onTouchEvent(ev)) {\n                                handled = true;\n                            }\n                        }\n                        return handled;\n                    }\n                    setAllowParentInterceptOnEdge(allow) {\n                        this.mAllowParentInterceptOnEdge = allow;\n                    }\n                    setMinScale(minScale) {\n                        this.setMinimumScale(minScale);\n                    }\n                    setMinimumScale(minimumScale) {\n                        PhotoViewAttacher.checkZoomLevels(minimumScale, this.mMidScale, this.mMaxScale);\n                        this.mMinScale = minimumScale;\n                    }\n                    setMidScale(midScale) {\n                        this.setMediumScale(midScale);\n                    }\n                    setMediumScale(mediumScale) {\n                        PhotoViewAttacher.checkZoomLevels(this.mMinScale, mediumScale, this.mMaxScale);\n                        this.mMidScale = mediumScale;\n                    }\n                    setMaxScale(maxScale) {\n                        this.setMaximumScale(maxScale);\n                    }\n                    setMaximumScale(maximumScale) {\n                        PhotoViewAttacher.checkZoomLevels(this.mMinScale, this.mMidScale, maximumScale);\n                        this.mMaxScale = maximumScale;\n                    }\n                    setScaleLevels(minimumScale, mediumScale, maximumScale) {\n                        PhotoViewAttacher.checkZoomLevels(minimumScale, mediumScale, maximumScale);\n                        this.mMinScale = minimumScale;\n                        this.mMidScale = mediumScale;\n                        this.mMaxScale = maximumScale;\n                    }\n                    setOnLongClickListener(listener) {\n                        this.mLongClickListener = listener;\n                    }\n                    setOnMatrixChangeListener(listener) {\n                        this.mMatrixChangeListener = listener;\n                    }\n                    setOnPhotoTapListener(listener) {\n                        this.mPhotoTapListener = listener;\n                    }\n                    getOnPhotoTapListener() {\n                        return this.mPhotoTapListener;\n                    }\n                    setOnViewTapListener(listener) {\n                        this.mViewTapListener = listener;\n                    }\n                    getOnViewTapListener() {\n                        return this.mViewTapListener;\n                    }\n                    setScale(...args) {\n                        if (args.length >= 3) {\n                            this.setScale_4(...args);\n                        }\n                        else {\n                            this.setScale_2(...args);\n                        }\n                    }\n                    setScale_2(scale, animate = false) {\n                        let imageView = this.getImageView();\n                        if (null != imageView) {\n                            this.setScale(scale, (imageView.getRight()) / 2, (imageView.getBottom()) / 2, animate);\n                        }\n                    }\n                    setScale_4(scale, focalX, focalY, animate = false) {\n                        let imageView = this.getImageView();\n                        if (null != imageView) {\n                            if (scale < this.mMinScale || scale > this.mMaxScale) {\n                                Log.i(PhotoViewAttacher.LOG_TAG, \"Scale must be within the range of minScale and maxScale\");\n                                return;\n                            }\n                            if (animate) {\n                                imageView.post(new PhotoViewAttacher.AnimatedZoomRunnable(this, this.getScale(), scale, focalX, focalY));\n                            }\n                            else {\n                                this.mSuppMatrix.setScale(scale, scale, focalX, focalY);\n                                this.checkAndDisplayMatrix();\n                            }\n                        }\n                    }\n                    setScaleType(scaleType) {\n                        if (PhotoViewAttacher.isSupportedScaleType(scaleType) && scaleType != this.mScaleType) {\n                            this.mScaleType = scaleType;\n                            this.update();\n                        }\n                    }\n                    setZoomable(zoomable) {\n                        this.mZoomEnabled = zoomable;\n                        this.update();\n                    }\n                    update() {\n                        let imageView = this.getImageView();\n                        if (null != imageView) {\n                            if (this.mZoomEnabled) {\n                                PhotoViewAttacher.setImageViewScaleTypeMatrix(imageView);\n                                this.updateBaseMatrix(imageView.getDrawable());\n                            }\n                            else {\n                                this.resetMatrix();\n                            }\n                        }\n                    }\n                    getDisplayMatrix() {\n                        return new Matrix(this.getDrawMatrix());\n                    }\n                    getDrawMatrix() {\n                        this.mDrawMatrix.set(this.mBaseMatrix);\n                        this.mDrawMatrix.postConcat(this.mSuppMatrix);\n                        return this.mDrawMatrix;\n                    }\n                    cancelFling() {\n                        if (null != this.mCurrentFlingRunnable) {\n                            this.mCurrentFlingRunnable.cancelFling();\n                            this.mCurrentFlingRunnable = null;\n                        }\n                    }\n                    checkAndDisplayMatrix() {\n                        if (this.checkMatrixBounds()) {\n                            this.setImageViewMatrix(this.getDrawMatrix());\n                        }\n                    }\n                    checkImageViewScaleType() {\n                        let imageView = this.getImageView();\n                        if (null != imageView && !(IPhotoView.isImpl(imageView))) {\n                            if (ScaleType.MATRIX != (imageView.getScaleType())) {\n                                throw Error(`new IllegalStateException(\"The ImageView's ScaleType has been changed since attaching a PhotoViewAttacher\")`);\n                            }\n                        }\n                    }\n                    checkMatrixBounds() {\n                        const imageView = this.getImageView();\n                        if (null == imageView) {\n                            return false;\n                        }\n                        const rect = this._getDisplayRect(this.getDrawMatrix());\n                        if (null == rect) {\n                            return false;\n                        }\n                        const height = rect.height(), width = rect.width();\n                        let deltaX = 0, deltaY = 0;\n                        const viewHeight = this.getImageViewHeight(imageView);\n                        if (height <= viewHeight) {\n                            switch (this.mScaleType) {\n                                case ScaleType.FIT_START:\n                                    deltaY = -rect.top;\n                                    break;\n                                case ScaleType.FIT_END:\n                                    deltaY = viewHeight - height - rect.top;\n                                    break;\n                                default:\n                                    deltaY = (viewHeight - height) / 2 - rect.top;\n                                    break;\n                            }\n                        }\n                        else if (rect.top > 0) {\n                            deltaY = -rect.top;\n                        }\n                        else if (rect.bottom < viewHeight) {\n                            deltaY = viewHeight - rect.bottom;\n                        }\n                        const viewWidth = this.getImageViewWidth(imageView);\n                        if (width <= viewWidth) {\n                            switch (this.mScaleType) {\n                                case ScaleType.FIT_START:\n                                    deltaX = -rect.left;\n                                    break;\n                                case ScaleType.FIT_END:\n                                    deltaX = viewWidth - width - rect.left;\n                                    break;\n                                default:\n                                    deltaX = (viewWidth - width) / 2 - rect.left;\n                                    break;\n                            }\n                            this.mScrollEdge = PhotoViewAttacher.EDGE_BOTH;\n                        }\n                        else if (rect.left > 0) {\n                            this.mScrollEdge = PhotoViewAttacher.EDGE_LEFT;\n                            deltaX = -rect.left;\n                        }\n                        else if (rect.right < viewWidth) {\n                            deltaX = viewWidth - rect.right;\n                            this.mScrollEdge = PhotoViewAttacher.EDGE_RIGHT;\n                        }\n                        else {\n                            this.mScrollEdge = PhotoViewAttacher.EDGE_NONE;\n                        }\n                        this.mSuppMatrix.postTranslate(deltaX, deltaY);\n                        return true;\n                    }\n                    _getDisplayRect(matrix) {\n                        let imageView = this.getImageView();\n                        if (null != imageView) {\n                            let d = imageView.getDrawable();\n                            if (null != d) {\n                                this.mDisplayRect.set(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());\n                                matrix.mapRect(this.mDisplayRect);\n                                return this.mDisplayRect;\n                            }\n                        }\n                        return null;\n                    }\n                    getVisibleRectangleBitmap() {\n                        let imageView = this.getImageView();\n                        return imageView == null ? null : imageView.getDrawingCache();\n                    }\n                    setZoomTransitionDuration(milliseconds) {\n                        if (milliseconds < 0)\n                            milliseconds = IPhotoView.DEFAULT_ZOOM_DURATION;\n                        this.ZOOM_DURATION = milliseconds;\n                    }\n                    getIPhotoViewImplementation() {\n                        return this;\n                    }\n                    getValue(matrix, whichValue) {\n                        matrix.getValues(this.mMatrixValues);\n                        return this.mMatrixValues[whichValue];\n                    }\n                    resetMatrix() {\n                        this.mSuppMatrix.reset();\n                        this.setImageViewMatrix(this.getDrawMatrix());\n                        this.checkMatrixBounds();\n                    }\n                    setImageViewMatrix(matrix) {\n                        let imageView = this.getImageView();\n                        if (null != imageView) {\n                            this.checkImageViewScaleType();\n                            imageView.setImageMatrix(matrix);\n                            if (null != this.mMatrixChangeListener) {\n                                let displayRect = this._getDisplayRect(matrix);\n                                if (null != displayRect) {\n                                    this.mMatrixChangeListener.onMatrixChanged(displayRect);\n                                }\n                            }\n                        }\n                    }\n                    updateBaseMatrix(d) {\n                        let imageView = this.getImageView();\n                        if (null == imageView || null == d) {\n                            return;\n                        }\n                        const viewWidth = this.getImageViewWidth(imageView);\n                        const viewHeight = this.getImageViewHeight(imageView);\n                        const drawableWidth = d.getIntrinsicWidth();\n                        const drawableHeight = d.getIntrinsicHeight();\n                        this.mBaseMatrix.reset();\n                        const widthScale = viewWidth / drawableWidth;\n                        const heightScale = viewHeight / drawableHeight;\n                        if (this.mScaleType == ScaleType.CENTER) {\n                            this.mBaseMatrix.postTranslate((viewWidth - drawableWidth) / 2, (viewHeight - drawableHeight) / 2);\n                        }\n                        else if (this.mScaleType == ScaleType.CENTER_CROP) {\n                            let scale = Math.max(widthScale, heightScale);\n                            this.mBaseMatrix.postScale(scale, scale);\n                            this.mBaseMatrix.postTranslate((viewWidth - drawableWidth * scale) / 2, (viewHeight - drawableHeight * scale) / 2);\n                        }\n                        else if (this.mScaleType == ScaleType.CENTER_INSIDE) {\n                            let scale = Math.min(1.0, Math.min(widthScale, heightScale));\n                            this.mBaseMatrix.postScale(scale, scale);\n                            this.mBaseMatrix.postTranslate((viewWidth - drawableWidth * scale) / 2, (viewHeight - drawableHeight * scale) / 2);\n                        }\n                        else {\n                            let mTempSrc = new RectF(0, 0, drawableWidth, drawableHeight);\n                            let mTempDst = new RectF(0, 0, viewWidth, viewHeight);\n                            switch (this.mScaleType) {\n                                case ScaleType.FIT_CENTER:\n                                    this.mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.CENTER);\n                                    break;\n                                case ScaleType.FIT_START:\n                                    this.mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.START);\n                                    break;\n                                case ScaleType.FIT_END:\n                                    this.mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.END);\n                                    break;\n                                case ScaleType.FIT_XY:\n                                    this.mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.FILL);\n                                    break;\n                                default:\n                                    break;\n                            }\n                        }\n                        this.resetMatrix();\n                    }\n                    getImageViewWidth(imageView) {\n                        if (null == imageView)\n                            return 0;\n                        return imageView.getWidth() - imageView.getPaddingLeft() - imageView.getPaddingRight();\n                    }\n                    getImageViewHeight(imageView) {\n                        if (null == imageView)\n                            return 0;\n                        return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();\n                    }\n                }\n                PhotoViewAttacher.LOG_TAG = \"PhotoViewAttacher\";\n                PhotoViewAttacher.DEBUG = Log.View_DBG;\n                PhotoViewAttacher.sInterpolator = new AccelerateDecelerateInterpolator();\n                PhotoViewAttacher.EDGE_NONE = -1;\n                PhotoViewAttacher.EDGE_LEFT = 0;\n                PhotoViewAttacher.EDGE_RIGHT = 1;\n                PhotoViewAttacher.EDGE_BOTH = 2;\n                photoview.PhotoViewAttacher = PhotoViewAttacher;\n                (function (PhotoViewAttacher) {\n                    class AnimatedZoomRunnable {\n                        constructor(arg, currentZoom, targetZoom, focalX, focalY) {\n                            this.mFocalX = 0;\n                            this.mFocalY = 0;\n                            this.mStartTime = 0;\n                            this.mZoomStart = 0;\n                            this.mZoomEnd = 0;\n                            this._PhotoViewAttacher_this = arg;\n                            this.mFocalX = focalX;\n                            this.mFocalY = focalY;\n                            this.mStartTime = System.currentTimeMillis();\n                            this.mZoomStart = currentZoom;\n                            this.mZoomEnd = targetZoom;\n                        }\n                        run() {\n                            let imageView = this._PhotoViewAttacher_this.getImageView();\n                            if (imageView == null) {\n                                return;\n                            }\n                            let t = this.interpolate();\n                            let scale = this.mZoomStart + t * (this.mZoomEnd - this.mZoomStart);\n                            let deltaScale = scale / this._PhotoViewAttacher_this.getScale();\n                            this._PhotoViewAttacher_this.onScale(deltaScale, this.mFocalX, this.mFocalY);\n                            if (t < 1) {\n                                imageView.postOnAnimation(this);\n                            }\n                        }\n                        interpolate() {\n                            let t = 1 * (System.currentTimeMillis() - this.mStartTime) / this._PhotoViewAttacher_this.ZOOM_DURATION;\n                            t = Math.min(1, t);\n                            t = PhotoViewAttacher.sInterpolator.getInterpolation(t);\n                            return t;\n                        }\n                    }\n                    PhotoViewAttacher.AnimatedZoomRunnable = AnimatedZoomRunnable;\n                    class FlingRunnable {\n                        constructor(arg) {\n                            this.mCurrentX = 0;\n                            this.mCurrentY = 0;\n                            this._PhotoViewAttacher_this = arg;\n                            this.mScroller = new OverScroller();\n                        }\n                        cancelFling() {\n                            if (PhotoViewAttacher.DEBUG) {\n                                Log.d(PhotoViewAttacher.LOG_TAG, \"Cancel Fling\");\n                            }\n                            this.mScroller.forceFinished(true);\n                        }\n                        fling(viewWidth, viewHeight, velocityX, velocityY) {\n                            const rect = this._PhotoViewAttacher_this.getDisplayRect();\n                            if (null == rect) {\n                                return;\n                            }\n                            const startX = Math.round(-rect.left);\n                            let minX, maxX, minY, maxY;\n                            if (viewWidth < rect.width()) {\n                                minX = 0;\n                                maxX = Math.round(rect.width() - viewWidth);\n                            }\n                            else {\n                                minX = maxX = startX;\n                            }\n                            const startY = Math.round(-rect.top);\n                            if (viewHeight < rect.height()) {\n                                minY = 0;\n                                maxY = Math.round(rect.height() - viewHeight);\n                            }\n                            else {\n                                minY = maxY = startY;\n                            }\n                            this.mCurrentX = startX;\n                            this.mCurrentY = startY;\n                            if (PhotoViewAttacher.DEBUG) {\n                                Log.d(PhotoViewAttacher.LOG_TAG, \"fling. StartX:\" + startX + \" StartY:\" + startY + \" MaxX:\" + maxX + \" MaxY:\" + maxY);\n                            }\n                            if (startX != maxX || startY != maxY) {\n                                this.mScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, 0, 0);\n                            }\n                        }\n                        run() {\n                            if (this.mScroller.isFinished()) {\n                                return;\n                            }\n                            let imageView = this._PhotoViewAttacher_this.getImageView();\n                            if (null != imageView && this.mScroller.computeScrollOffset()) {\n                                const newX = this.mScroller.getCurrX();\n                                const newY = this.mScroller.getCurrY();\n                                if (PhotoViewAttacher.DEBUG) {\n                                    Log.d(PhotoViewAttacher.LOG_TAG, \"fling run(). CurrentX:\" + this.mCurrentX + \" CurrentY:\" + this.mCurrentY + \" NewX:\" + newX + \" NewY:\" + newY);\n                                }\n                                this._PhotoViewAttacher_this.mSuppMatrix.postTranslate(this.mCurrentX - newX, this.mCurrentY - newY);\n                                this._PhotoViewAttacher_this.setImageViewMatrix(this._PhotoViewAttacher_this.getDrawMatrix());\n                                this.mCurrentX = newX;\n                                this.mCurrentY = newY;\n                                imageView.postOnAnimation(this);\n                            }\n                        }\n                    }\n                    PhotoViewAttacher.FlingRunnable = FlingRunnable;\n                    class DefaultOnDoubleTapListener {\n                        constructor(photoViewAttacher) {\n                            this.setPhotoViewAttacher(photoViewAttacher);\n                        }\n                        setPhotoViewAttacher(newPhotoViewAttacher) {\n                            this.photoViewAttacher = newPhotoViewAttacher;\n                        }\n                        onSingleTapConfirmed(e) {\n                            if (this.photoViewAttacher == null)\n                                return false;\n                            let imageView = this.photoViewAttacher.getImageView();\n                            if (null != this.photoViewAttacher.getOnPhotoTapListener()) {\n                                const displayRect = this.photoViewAttacher.getDisplayRect();\n                                if (null != displayRect) {\n                                    const x = e.getX(), y = e.getY();\n                                    if (displayRect.contains(x, y)) {\n                                        let xResult = (x - displayRect.left) / displayRect.width();\n                                        let yResult = (y - displayRect.top) / displayRect.height();\n                                        this.photoViewAttacher.getOnPhotoTapListener().onPhotoTap(imageView, xResult, yResult);\n                                        return true;\n                                    }\n                                }\n                            }\n                            if (null != this.photoViewAttacher.getOnViewTapListener()) {\n                                this.photoViewAttacher.getOnViewTapListener().onViewTap(imageView, e.getX(), e.getY());\n                            }\n                            return false;\n                        }\n                        onDoubleTap(ev) {\n                            if (this.photoViewAttacher == null)\n                                return false;\n                            try {\n                                let scale = this.photoViewAttacher.getScale();\n                                let x = ev.getX();\n                                let y = ev.getY();\n                                if (scale < this.photoViewAttacher.getMediumScale()) {\n                                    this.photoViewAttacher.setScale(this.photoViewAttacher.getMediumScale(), x, y, true);\n                                }\n                                else if (scale >= this.photoViewAttacher.getMediumScale() && scale < this.photoViewAttacher.getMaximumScale()) {\n                                    this.photoViewAttacher.setScale(this.photoViewAttacher.getMaximumScale(), x, y, true);\n                                }\n                                else {\n                                    this.photoViewAttacher.setScale(this.photoViewAttacher.getMinimumScale(), x, y, true);\n                                }\n                            }\n                            catch (e) {\n                            }\n                            return true;\n                        }\n                        onDoubleTapEvent(e) {\n                            return false;\n                        }\n                    }\n                    PhotoViewAttacher.DefaultOnDoubleTapListener = DefaultOnDoubleTapListener;\n                })(PhotoViewAttacher = photoview.PhotoViewAttacher || (photoview.PhotoViewAttacher = {}));\n            })(photoview = senab.photoview || (senab.photoview = {}));\n        })(senab = co.senab || (co.senab = {}));\n    })(co = uk.co || (uk.co = {}));\n})(uk || (uk = {}));\nvar uk;\n(function (uk) {\n    var co;\n    (function (co) {\n        var senab;\n        (function (senab) {\n            var photoview;\n            (function (photoview) {\n                var ImageView = android.widget.ImageView;\n                var PhotoViewAttacher = uk.co.senab.photoview.PhotoViewAttacher;\n                var ScaleType = ImageView.ScaleType;\n                class PhotoView extends ImageView {\n                    constructor(context, bindElement, defStyle) {\n                        super(context, bindElement, defStyle);\n                        super.setScaleType(ScaleType.MATRIX);\n                        this.init();\n                    }\n                    init() {\n                        if (null == this.mAttacher || null == this.mAttacher.getImageView()) {\n                            this.mAttacher = new PhotoViewAttacher(this);\n                        }\n                        if (null != this.mPendingScaleType) {\n                            this.setScaleType(this.mPendingScaleType);\n                            this.mPendingScaleType = null;\n                        }\n                    }\n                    setPhotoViewRotation(rotationDegree) {\n                        this.mAttacher.setRotationTo(rotationDegree);\n                    }\n                    setRotationTo(rotationDegree) {\n                        this.mAttacher.setRotationTo(rotationDegree);\n                    }\n                    setRotationBy(rotationDegree) {\n                        this.mAttacher.setRotationBy(rotationDegree);\n                    }\n                    canZoom() {\n                        return this.mAttacher.canZoom();\n                    }\n                    getDisplayRect() {\n                        return this.mAttacher.getDisplayRect();\n                    }\n                    getDisplayMatrix() {\n                        return this.mAttacher.getDisplayMatrix();\n                    }\n                    setDisplayMatrix(finalRectangle) {\n                        return this.mAttacher.setDisplayMatrix(finalRectangle);\n                    }\n                    getMinScale() {\n                        return this.getMinimumScale();\n                    }\n                    getMinimumScale() {\n                        return this.mAttacher.getMinimumScale();\n                    }\n                    getMidScale() {\n                        return this.getMediumScale();\n                    }\n                    getMediumScale() {\n                        return this.mAttacher.getMediumScale();\n                    }\n                    getMaxScale() {\n                        return this.getMaximumScale();\n                    }\n                    getMaximumScale() {\n                        return this.mAttacher.getMaximumScale();\n                    }\n                    getScale() {\n                        return this.mAttacher.getScale();\n                    }\n                    getScaleType() {\n                        return this.mAttacher.getScaleType();\n                    }\n                    setAllowParentInterceptOnEdge(allow) {\n                        this.mAttacher.setAllowParentInterceptOnEdge(allow);\n                    }\n                    setMinScale(minScale) {\n                        this.setMinimumScale(minScale);\n                    }\n                    setMinimumScale(minimumScale) {\n                        this.mAttacher.setMinimumScale(minimumScale);\n                    }\n                    setMidScale(midScale) {\n                        this.setMediumScale(midScale);\n                    }\n                    setMediumScale(mediumScale) {\n                        this.mAttacher.setMediumScale(mediumScale);\n                    }\n                    setMaxScale(maxScale) {\n                        this.setMaximumScale(maxScale);\n                    }\n                    setMaximumScale(maximumScale) {\n                        this.mAttacher.setMaximumScale(maximumScale);\n                    }\n                    setScaleLevels(minimumScale, mediumScale, maximumScale) {\n                        this.mAttacher.setScaleLevels(minimumScale, mediumScale, maximumScale);\n                    }\n                    setImageDrawable(drawable) {\n                        super.setImageDrawable(drawable);\n                        if (null != this.mAttacher) {\n                            this.mAttacher.update();\n                        }\n                    }\n                    setImageURI(uri) {\n                        super.setImageURI(uri);\n                    }\n                    resizeFromDrawable() {\n                        let change = super.resizeFromDrawable();\n                        if (change && null != this.mAttacher) {\n                            this.mAttacher.update();\n                        }\n                        return change;\n                    }\n                    setOnMatrixChangeListener(listener) {\n                        this.mAttacher.setOnMatrixChangeListener(listener);\n                    }\n                    setOnLongClickListener(l) {\n                        this.mAttacher.setOnLongClickListener(l);\n                    }\n                    setOnPhotoTapListener(listener) {\n                        this.mAttacher.setOnPhotoTapListener(listener);\n                    }\n                    getOnPhotoTapListener() {\n                        return this.mAttacher.getOnPhotoTapListener();\n                    }\n                    setOnViewTapListener(listener) {\n                        this.mAttacher.setOnViewTapListener(listener);\n                    }\n                    getOnViewTapListener() {\n                        return this.mAttacher.getOnViewTapListener();\n                    }\n                    setScale(...args) {\n                        this.mAttacher.setScale(...args);\n                    }\n                    setScaleType(scaleType) {\n                        if (null != this.mAttacher) {\n                            this.mAttacher.setScaleType(scaleType);\n                        }\n                        else {\n                            this.mPendingScaleType = scaleType;\n                        }\n                    }\n                    setZoomable(zoomable) {\n                        this.mAttacher.setZoomable(zoomable);\n                    }\n                    getVisibleRectangleBitmap() {\n                        return this.mAttacher.getVisibleRectangleBitmap();\n                    }\n                    setZoomTransitionDuration(milliseconds) {\n                        this.mAttacher.setZoomTransitionDuration(milliseconds);\n                    }\n                    getIPhotoViewImplementation() {\n                        return this.mAttacher;\n                    }\n                    setOnDoubleTapListener(newOnDoubleTapListener) {\n                        this.mAttacher.setOnDoubleTapListener(newOnDoubleTapListener);\n                    }\n                    setOnScaleChangeListener(onScaleChangeListener) {\n                        this.mAttacher.setOnScaleChangeListener(onScaleChangeListener);\n                    }\n                    onDetachedFromWindow() {\n                        this.mAttacher.cleanup();\n                        super.onDetachedFromWindow();\n                    }\n                    onAttachedToWindow() {\n                        this.init();\n                        super.onAttachedToWindow();\n                    }\n                }\n                photoview.PhotoView = PhotoView;\n            })(photoview = senab.photoview || (senab.photoview = {}));\n        })(senab = co.senab || (co.senab = {}));\n    })(co = uk.co || (uk.co = {}));\n})(uk || (uk = {}));\nvar android;\n(function (android) {\n    var app;\n    (function (app) {\n        var View = android.view.View;\n        var FrameLayout = android.widget.FrameLayout;\n        class ActionBar extends FrameLayout {\n            constructor(context, bindElement, defStyle = android.R.attr.actionBarStyle) {\n                super(context, bindElement, defStyle);\n                context.getLayoutInflater().inflate(android.R.layout.action_bar, this);\n                this.mCenterLayout = this.findViewById('action_bar_center_layout');\n                this.mTitleView = this.findViewById('action_bar_title');\n                this.mSubTitleView = this.findViewById('action_bar_sub_title');\n                this.mActionLeft = this.findViewById('action_bar_left');\n                this.mActionRight = this.findViewById('action_bar_right');\n            }\n            setCustomView(view, layoutParams) {\n                this.mCenterLayout.removeAllViews();\n                this.mCustomView = view;\n                if (layoutParams)\n                    this.mCenterLayout.addView(view, layoutParams);\n                else\n                    this.mCenterLayout.addView(view);\n            }\n            setIcon(icon) {\n                icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());\n                let drawables = this.mTitleView.getCompoundDrawables();\n                this.mTitleView.setCompoundDrawables(icon, drawables[1], drawables[2], drawables[3]);\n            }\n            setLogo(logo) {\n                this.setIcon(logo);\n            }\n            setTitle(title) {\n                this.mTitleView.setText(title);\n            }\n            setSubtitle(subtitle) {\n                this.mSubTitleView.setText(subtitle);\n                let empty = subtitle == null || subtitle.length == 0;\n                this.mSubTitleView.setVisibility(empty ? View.GONE : View.VISIBLE);\n            }\n            getCustomView() {\n                return this.mCustomView;\n            }\n            getTitle() {\n                return this.mTitleView.getText().toString();\n            }\n            getSubtitle() {\n                return this.mSubTitleView.getText().toString();\n            }\n            show() {\n                this.setVisibility(View.VISIBLE);\n            }\n            hide() {\n                this.setVisibility(View.GONE);\n            }\n            isShowing() {\n                return this.isShown();\n            }\n            setActionLeft(name, icon, listener) {\n                this.mActionLeft.setText(name);\n                this.mActionLeft.setVisibility(View.VISIBLE);\n                let drawables = this.mActionLeft.getCompoundDrawables();\n                icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());\n                this.mActionLeft.setCompoundDrawables(icon, drawables[1], drawables[2], drawables[3]);\n                this.mActionLeft.setOnClickListener(listener);\n            }\n            hideActionLeft() {\n                this.mActionLeft.setVisibility(View.GONE);\n            }\n            setActionRight(name, icon, listener) {\n                this.mActionRight.setText(name);\n                this.mActionRight.setVisibility(View.VISIBLE);\n                let drawables = this.mActionRight.getCompoundDrawables();\n                if (icon)\n                    icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());\n                this.mActionRight.setCompoundDrawables(drawables[0], drawables[1], icon, drawables[3]);\n                this.mActionRight.setOnClickListener(listener);\n            }\n            hideActionRight() {\n                this.mActionRight.setVisibility(View.GONE);\n            }\n        }\n        app.ActionBar = ActionBar;\n    })(app = android.app || (android.app = {}));\n})(android || (android = {}));\nvar android;\n(function (android) {\n    var app;\n    (function (app) {\n        class ActionBarActivity extends app.Activity {\n            onCreate(savedInstanceState) {\n                super.onCreate(savedInstanceState);\n                this.initActionBar();\n            }\n            initActionBar() {\n                this.setActionBar(new app.ActionBar(this));\n                this.initDefaultBackFinish();\n            }\n            initDefaultBackFinish() {\n                if (this.androidUI.mActivityThread.mLaunchedActivities.size === 0)\n                    return;\n                const activity = this;\n                this.mActionBar.setActionLeft(android.R.string_.back, android.R.image.actionbar_ic_back_white, {\n                    onClick(view) {\n                        activity.finish();\n                    }\n                });\n            }\n            setActionBar(actionBar) {\n                const activity = this;\n                let w = this.getWindow();\n                let decorView = w.mDecor;\n                this.mActionBar = actionBar;\n                decorView.addView(actionBar, -1, -2);\n                const onMeasure = decorView.onMeasure;\n                decorView.onMeasure = (widthMeasureSpec, heightMeasureSpec) => {\n                    onMeasure.call(decorView, widthMeasureSpec, heightMeasureSpec);\n                    if (activity.mActionBar === actionBar) {\n                        let params = w.mContentParent.getLayoutParams();\n                        if (params.topMargin != actionBar.getMeasuredHeight()) {\n                            params.topMargin = actionBar.getMeasuredHeight();\n                            onMeasure.call(decorView, widthMeasureSpec, heightMeasureSpec);\n                        }\n                    }\n                };\n            }\n            invalidateOptionsMenuPopupHelper(menu) {\n                let menuPopuoHelper = new android.view.menu.MenuPopupHelper(this, menu, this.getActionBar().mActionRight);\n                if (menu.hasVisibleItems()) {\n                    this.getActionBar().setActionRight('', android.R.image.ic_menu_moreoverflow_normal_holo_dark, {\n                        onClick: function (view) {\n                            menuPopuoHelper.show();\n                        }\n                    });\n                }\n                return menuPopuoHelper;\n            }\n            getActionBar() {\n                return this.mActionBar;\n            }\n            onTitleChanged(title, color) {\n                super.onTitleChanged(title, color);\n                this.mActionBar.setTitle(title);\n            }\n        }\n        app.ActionBarActivity = ActionBarActivity;\n    })(app = android.app || (android.app = {}));\n})(android || (android = {}));\nvar androidui;\n(function (androidui) {\n    var widget;\n    (function (widget) {\n        var View = android.view.View;\n        var MeasureSpec = View.MeasureSpec;\n        class HtmlView extends widget.HtmlBaseView {\n            constructor(context, bindElement, defStyle) {\n                super(context, bindElement, defStyle);\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                let widthMode = MeasureSpec.getMode(widthMeasureSpec);\n                let heightMode = MeasureSpec.getMode(heightMeasureSpec);\n                let widthSize = MeasureSpec.getSize(widthMeasureSpec);\n                let heightSize = MeasureSpec.getSize(heightMeasureSpec);\n                let width, height;\n                const density = this.getResources().getDisplayMetrics().density;\n                if (widthMode == MeasureSpec.EXACTLY) {\n                    width = widthSize;\n                }\n                else {\n                    let sWidth = this.bindElement.style.width, sLeft = this.bindElement.style.left;\n                    this.bindElement.style.width = '';\n                    this.bindElement.style.left = '';\n                    width = this.bindElement.offsetWidth * density + 2;\n                    this.bindElement.style.width = sWidth;\n                    this.bindElement.style.left = sLeft;\n                    width = Math.max(width, this.getSuggestedMinimumWidth());\n                    if (widthMode == MeasureSpec.AT_MOST) {\n                        width = Math.min(widthSize, width);\n                    }\n                }\n                if (heightMode == MeasureSpec.EXACTLY) {\n                    height = heightSize;\n                }\n                else {\n                    let sWidth = this.bindElement.style.width;\n                    this.bindElement.style.width = width / density + \"px\";\n                    this.bindElement.style.height = '';\n                    height = this.bindElement.offsetHeight * density;\n                    this.bindElement.style.width = sWidth;\n                    height = Math.max(height, this.getSuggestedMinimumHeight());\n                    if (heightMode == MeasureSpec.AT_MOST) {\n                        height = Math.min(height, heightSize);\n                    }\n                }\n                this.setMeasuredDimension(width, height);\n            }\n            setHtml(html) {\n                this.bindElement.innerHTML = html;\n                this.requestLayout();\n            }\n            getHtml() {\n                return this.bindElement.innerHTML;\n            }\n        }\n        widget.HtmlView = HtmlView;\n    })(widget = androidui.widget || (androidui.widget = {}));\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var widget;\n    (function (widget) {\n        var View = android.view.View;\n        var MeasureSpec = View.MeasureSpec;\n        class HtmlImageView extends widget.HtmlBaseView {\n            constructor(context, bindElement, defStyle) {\n                super(context, bindElement, defStyle);\n                this.mHaveFrame = false;\n                this.mAdjustViewBounds = false;\n                this.mMaxWidth = Number.MAX_SAFE_INTEGER;\n                this.mMaxHeight = Number.MAX_SAFE_INTEGER;\n                this.mAlpha = 255;\n                this.mDrawableWidth = 0;\n                this.mDrawableHeight = 0;\n                this.mAdjustViewBoundsCompat = false;\n                this.initImageView();\n                const a = context.obtainStyledAttributes(bindElement, defStyle);\n                const src = a.getString('src');\n                if (src) {\n                    this.setImageURI(src);\n                }\n                this.setAdjustViewBounds(a.getBoolean('adjustViewBounds', false));\n                this.setMaxWidth(a.getDimensionPixelSize('maxWidth', this.mMaxWidth));\n                this.setMaxHeight(a.getDimensionPixelSize('maxHeight', this.mMaxHeight));\n                this.setScaleType(android.widget.ImageView.parseScaleType(a.getAttrValue('scaleType'), this.mScaleType));\n                this.setImageAlpha(a.getInt('drawableAlpha', this.mAlpha));\n            }\n            createClassAttrBinder() {\n                return super.createClassAttrBinder().set('src', {\n                    setter(v, value, attrBinder) {\n                        v.setImageURI(value);\n                    }, getter(v) {\n                        return v.mImgElement.src;\n                    }\n                }).set('adjustViewBounds', {\n                    setter(v, value, attrBinder) {\n                        v.setAdjustViewBounds(attrBinder.parseBoolean(value, false));\n                    }, getter(v) {\n                        return v.getAdjustViewBounds();\n                    }\n                }).set('maxWidth', {\n                    setter(v, value, attrBinder) {\n                        v.setMaxWidth(attrBinder.parseNumberPixelSize(value, v.mMaxWidth));\n                    }, getter(v) {\n                        return v.mMaxWidth;\n                    }\n                }).set('maxHeight', {\n                    setter(v, value, attrBinder) {\n                        v.setMaxHeight(attrBinder.parseNumberPixelSize(value, v.mMaxHeight));\n                    }, getter(v) {\n                        return v.mMaxHeight;\n                    }\n                }).set('scaleType', {\n                    setter(v, value, attrBinder) {\n                        if (typeof value === 'number') {\n                            v.setScaleType(value);\n                        }\n                        else {\n                            v.setScaleType(android.widget.ImageView.parseScaleType(value, v.mScaleType));\n                        }\n                    }, getter(v) {\n                        return v.mScaleType;\n                    }\n                }).set('drawableAlpha', {\n                    setter(v, value, attrBinder) {\n                        v.setImageAlpha(attrBinder.parseInt(value, v.mAlpha));\n                    }, getter(v) {\n                        return v.mAlpha;\n                    }\n                });\n            }\n            initImageView() {\n                this.mScaleType = android.widget.ImageView.ScaleType.FIT_CENTER;\n                this.mImgElement = document.createElement('img');\n                this.mImgElement.style.position = \"absolute\";\n                this.mImgElement.onload = (() => {\n                    this.mImgElement.style.left = 0 + 'px';\n                    this.mImgElement.style.top = 0 + 'px';\n                    this.mImgElement.style.width = '';\n                    this.mImgElement.style.height = '';\n                    this.mDrawableWidth = this.mImgElement.width;\n                    this.mDrawableHeight = this.mImgElement.height;\n                    this.mImgElement.style.display = 'none';\n                    this.mImgElement.style.opacity = '';\n                    this.requestLayout();\n                });\n                this.bindElement.appendChild(this.mImgElement);\n            }\n            getAdjustViewBounds() {\n                return this.mAdjustViewBounds;\n            }\n            setAdjustViewBounds(adjustViewBounds) {\n                this.mAdjustViewBounds = adjustViewBounds;\n                if (adjustViewBounds) {\n                    this.setScaleType(android.widget.ImageView.ScaleType.FIT_CENTER);\n                }\n            }\n            getMaxWidth() {\n                return this.mMaxWidth;\n            }\n            setMaxWidth(maxWidth) {\n                this.mMaxWidth = maxWidth;\n            }\n            getMaxHeight() {\n                return this.mMaxHeight;\n            }\n            setMaxHeight(maxHeight) {\n                this.mMaxHeight = maxHeight;\n            }\n            setImageURI(uri) {\n                this.mDrawableWidth = -1;\n                this.mDrawableHeight = -1;\n                this.mImgElement.style.opacity = '0';\n                this.mImgElement.src = uri;\n            }\n            setScaleType(scaleType) {\n                if (scaleType == null) {\n                    throw new Error('NullPointerException');\n                }\n                if (this.mScaleType != scaleType) {\n                    this.mScaleType = scaleType;\n                    this.setWillNotCacheDrawing(scaleType == android.widget.ImageView.ScaleType.CENTER);\n                    this.requestLayout();\n                    this.invalidate();\n                }\n            }\n            getScaleType() {\n                return this.mScaleType;\n            }\n            onMeasure(widthMeasureSpec, heightMeasureSpec) {\n                let w;\n                let h;\n                let desiredAspect = 0.0;\n                let resizeWidth = false;\n                let resizeHeight = false;\n                const widthSpecMode = MeasureSpec.getMode(widthMeasureSpec);\n                const heightSpecMode = MeasureSpec.getMode(heightMeasureSpec);\n                if (!this.mImgElement.src || !this.mImgElement.complete) {\n                    this.mDrawableWidth = -1;\n                    this.mDrawableHeight = -1;\n                    w = h = 0;\n                }\n                else {\n                    w = this.mDrawableWidth;\n                    h = this.mDrawableHeight;\n                    if (w <= 0)\n                        w = 1;\n                    if (h <= 0)\n                        h = 1;\n                    if (this.mAdjustViewBounds) {\n                        resizeWidth = widthSpecMode != MeasureSpec.EXACTLY;\n                        resizeHeight = heightSpecMode != MeasureSpec.EXACTLY;\n                        desiredAspect = w / h;\n                    }\n                }\n                let pleft = this.mPaddingLeft;\n                let pright = this.mPaddingRight;\n                let ptop = this.mPaddingTop;\n                let pbottom = this.mPaddingBottom;\n                let widthSize;\n                let heightSize;\n                if (resizeWidth || resizeHeight) {\n                    widthSize = this.resolveAdjustedSize(w + pleft + pright, this.mMaxWidth, widthMeasureSpec);\n                    heightSize = this.resolveAdjustedSize(h + ptop + pbottom, this.mMaxHeight, heightMeasureSpec);\n                    if (desiredAspect != 0) {\n                        let actualAspect = (widthSize - pleft - pright) / (heightSize - ptop - pbottom);\n                        if (Math.abs(actualAspect - desiredAspect) > 0.0000001) {\n                            let done = false;\n                            if (resizeWidth) {\n                                let newWidth = Math.floor(desiredAspect * (heightSize - ptop - pbottom)) +\n                                    pleft + pright;\n                                if (!resizeHeight && !this.mAdjustViewBoundsCompat) {\n                                    widthSize = this.resolveAdjustedSize(newWidth, this.mMaxWidth, widthMeasureSpec);\n                                }\n                                if (newWidth <= widthSize) {\n                                    widthSize = newWidth;\n                                    done = true;\n                                }\n                            }\n                            if (!done && resizeHeight) {\n                                let newHeight = Math.floor((widthSize - pleft - pright) / desiredAspect) +\n                                    ptop + pbottom;\n                                if (!resizeWidth && !this.mAdjustViewBoundsCompat) {\n                                    heightSize = this.resolveAdjustedSize(newHeight, this.mMaxHeight, heightMeasureSpec);\n                                }\n                                if (newHeight <= heightSize) {\n                                    heightSize = newHeight;\n                                }\n                            }\n                        }\n                    }\n                }\n                else {\n                    w += pleft + pright;\n                    h += ptop + pbottom;\n                    w = Math.max(w, this.getSuggestedMinimumWidth());\n                    h = Math.max(h, this.getSuggestedMinimumHeight());\n                    widthSize = HtmlImageView.resolveSizeAndState(w, widthMeasureSpec, 0);\n                    heightSize = HtmlImageView.resolveSizeAndState(h, heightMeasureSpec, 0);\n                }\n                this.setMeasuredDimension(widthSize, heightSize);\n            }\n            resolveAdjustedSize(desiredSize, maxSize, measureSpec) {\n                let result = desiredSize;\n                let specMode = MeasureSpec.getMode(measureSpec);\n                let specSize = MeasureSpec.getSize(measureSpec);\n                switch (specMode) {\n                    case MeasureSpec.UNSPECIFIED:\n                        result = Math.min(desiredSize, maxSize);\n                        break;\n                    case MeasureSpec.AT_MOST:\n                        result = Math.min(Math.min(desiredSize, specSize), maxSize);\n                        break;\n                    case MeasureSpec.EXACTLY:\n                        result = specSize;\n                        break;\n                }\n                return result;\n            }\n            setFrame(left, top, right, bottom) {\n                let changed = super.setFrame(left, top, right, bottom);\n                this.mHaveFrame = true;\n                this.configureBounds();\n                this.mImgElement.style.display = '';\n                return changed;\n            }\n            configureBounds() {\n                let dwidth = this.mDrawableWidth;\n                let dheight = this.mDrawableHeight;\n                let vwidth = this.getWidth() - this.mPaddingLeft - this.mPaddingRight;\n                let vheight = this.getHeight() - this.mPaddingTop - this.mPaddingBottom;\n                let fits = (dwidth < 0 || vwidth == dwidth) && (dheight < 0 || vheight == dheight);\n                this.mImgElement.style.left = 0 + 'px';\n                this.mImgElement.style.top = 0 + 'px';\n                this.mImgElement.style.width = '';\n                this.mImgElement.style.height = '';\n                if (dwidth <= 0 || dheight <= 0) {\n                    return;\n                }\n                if (this.mScaleType === android.widget.ImageView.ScaleType.FIT_XY) {\n                    this.mImgElement.style.width = vwidth + 'px';\n                    this.mImgElement.style.height = vheight + 'px';\n                    return;\n                }\n                this.mImgElement.style.width = dwidth + 'px';\n                this.mImgElement.style.height = dheight + 'px';\n                if (android.widget.ImageView.ScaleType.MATRIX === this.mScaleType) {\n                }\n                else if (fits) {\n                }\n                else if (android.widget.ImageView.ScaleType.CENTER === this.mScaleType) {\n                    let left = Math.round((vwidth - dwidth) * 0.5);\n                    let top = Math.round((vheight - dheight) * 0.5);\n                    this.mImgElement.style.left = left + 'px';\n                    this.mImgElement.style.top = top + 'px';\n                }\n                else if (android.widget.ImageView.ScaleType.CENTER_CROP === this.mScaleType) {\n                    let scale;\n                    let dx = 0, dy = 0;\n                    if (dwidth * vheight > vwidth * dheight) {\n                        scale = vheight / dheight;\n                        dx = (vwidth - dwidth * scale) * 0.5;\n                        this.mImgElement.style.width = 'auto';\n                        this.mImgElement.style.height = vheight + 'px';\n                        this.mImgElement.style.left = Math.round(dx) + 'px';\n                        this.mImgElement.style.top = '0px';\n                    }\n                    else {\n                        scale = vwidth / dwidth;\n                        dy = (vheight - dheight * scale) * 0.5;\n                        this.mImgElement.style.width = vwidth + 'px';\n                        this.mImgElement.style.height = 'auto';\n                        this.mImgElement.style.left = '0px';\n                        this.mImgElement.style.top = Math.round(dy) + 'px';\n                    }\n                }\n                else if (android.widget.ImageView.ScaleType.CENTER_INSIDE === this.mScaleType) {\n                    let scale = 1;\n                    if (dwidth <= vwidth && dheight <= vheight) {\n                    }\n                    else {\n                        let wScale = vwidth / dwidth;\n                        let hScale = vheight / dheight;\n                        if (wScale < hScale) {\n                            this.mImgElement.style.width = vwidth + 'px';\n                            this.mImgElement.style.height = 'auto';\n                        }\n                        else {\n                            this.mImgElement.style.width = 'auto';\n                            this.mImgElement.style.height = vheight + 'px';\n                        }\n                        scale = Math.min(wScale, hScale);\n                    }\n                    let dx = Math.round((vwidth - dwidth * scale) * 0.5);\n                    let dy = Math.round((vheight - dheight * scale) * 0.5);\n                    this.mImgElement.style.left = dx + 'px';\n                    this.mImgElement.style.top = dy + 'px';\n                }\n                else {\n                    let wScale = vwidth / dwidth;\n                    let hScale = vheight / dheight;\n                    if (wScale < hScale) {\n                        this.mImgElement.style.width = vwidth + 'px';\n                        this.mImgElement.style.height = 'auto';\n                    }\n                    else {\n                        this.mImgElement.style.width = 'auto';\n                        this.mImgElement.style.height = vheight + 'px';\n                    }\n                    let scale = Math.min(wScale, hScale);\n                    if (android.widget.ImageView.ScaleType.FIT_CENTER === this.mScaleType) {\n                        let dx = Math.round((vwidth - dwidth * scale) * 0.5);\n                        let dy = Math.round((vheight - dheight * scale) * 0.5);\n                        this.mImgElement.style.left = dx + 'px';\n                        this.mImgElement.style.top = dy + 'px';\n                    }\n                    else if (android.widget.ImageView.ScaleType.FIT_END === this.mScaleType) {\n                        let dx = Math.round((vwidth - dwidth * scale));\n                        let dy = Math.round((vheight - dheight * scale));\n                        this.mImgElement.style.left = dx + 'px';\n                        this.mImgElement.style.top = dy + 'px';\n                    }\n                    else if (android.widget.ImageView.ScaleType.FIT_START === this.mScaleType) {\n                    }\n                }\n            }\n            getImageAlpha() {\n                return this.mAlpha;\n            }\n            setImageAlpha(alpha) {\n                this.setAlpha(alpha);\n            }\n        }\n        widget.HtmlImageView = HtmlImageView;\n    })(widget = androidui.widget || (androidui.widget = {}));\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var widget;\n    (function (widget) {\n        var View = android.view.View;\n        var AbsListView = android.widget.AbsListView;\n        var BaseAdapter = android.widget.BaseAdapter;\n        var AdapterView = android.widget.AdapterView;\n        class HtmlDataListAdapter extends BaseAdapter {\n            onInflateAdapter(bindElement, context, parent) {\n                this.bindElementData = bindElement;\n                this.mContext = context;\n                if (parent instanceof AbsListView) {\n                    parent.setAdapter(this);\n                }\n                bindElement[HtmlDataListAdapter.BindAdapterProperty] = this;\n                this.registerHtmlDataObserver();\n            }\n            registerHtmlDataObserver() {\n                if (!window['MutationObserver'])\n                    return;\n                const adapter = this;\n                function callBack(arr, observer) {\n                    adapter.notifyDataSetChanged();\n                }\n                let observer = new MutationObserver(callBack);\n                observer.observe(this.bindElementData, { childList: true });\n            }\n            getItemViewType(position) {\n                return AdapterView.ITEM_VIEW_TYPE_IGNORE;\n            }\n            getView(position, convertView, parent) {\n                let element = this.getItem(position);\n                let view = element[View.AndroidViewProperty];\n                this.checkReplaceWithRef(element);\n                if (!view) {\n                    view = View.inflate(this.mContext, element);\n                    element[View.AndroidViewProperty] = view;\n                }\n                return view;\n            }\n            getCount() {\n                return this.bindElementData.children.length;\n            }\n            getItem(position) {\n                let element = this.bindElementData.children[position];\n                if (element.tagName === HtmlDataListAdapter.RefElementTag) {\n                    element = element[HtmlDataListAdapter.RefElementProperty];\n                    if (!element)\n                        throw Error('Reference element is ' + element);\n                }\n                return element;\n            }\n            checkReplaceWithRef(element) {\n                let refElement = element[HtmlDataListAdapter.RefElementProperty] || document.createElement(HtmlDataListAdapter.RefElementTag);\n                refElement[HtmlDataListAdapter.RefElementProperty] = element;\n                element[HtmlDataListAdapter.RefElementProperty] = refElement;\n                if (element.parentNode === this.bindElementData) {\n                    this.bindElementData.insertBefore(refElement, element);\n                    this.bindElementData.removeChild(element);\n                }\n                return refElement;\n            }\n            removeElementRefAndRestoreToAdapter(childElement) {\n                if (childElement.tagName === HtmlDataListAdapter.RefElementTag) {\n                    let element = childElement[HtmlDataListAdapter.RefElementProperty];\n                    this.bindElementData.insertBefore(element, childElement);\n                    this.bindElementData.removeChild(childElement);\n                }\n            }\n            notifyDataSizeWillChange() {\n                for (let i = 0, count = this.bindElementData.children.length; i < count; i++) {\n                    this.removeElementRefAndRestoreToAdapter(this.bindElementData.children[i]);\n                }\n                this.notifyDataSetChanged();\n            }\n            getItemId(position) {\n                let id = this.getItem(position).id;\n                let idNumber = Number.parseInt(id);\n                if (Number.isInteger(idNumber))\n                    return idNumber;\n                return -1;\n            }\n        }\n        HtmlDataListAdapter.RefElementTag = \"ref-element\".toUpperCase();\n        HtmlDataListAdapter.RefElementProperty = \"RefElement\";\n        HtmlDataListAdapter.BindAdapterProperty = \"BindAdapter\";\n        widget.HtmlDataListAdapter = HtmlDataListAdapter;\n    })(widget = androidui.widget || (androidui.widget = {}));\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var widget;\n    (function (widget) {\n        var View = android.view.View;\n        var ViewPager = android.support.v4.view.ViewPager;\n        var PagerAdapter = android.support.v4.view.PagerAdapter;\n        class HtmlDataPagerAdapter extends PagerAdapter {\n            onInflateAdapter(bindElement, context, parent) {\n                this.bindElementData = bindElement;\n                this.mContext = context;\n                if (parent instanceof ViewPager) {\n                    parent.setAdapter(this);\n                }\n                bindElement[HtmlDataPagerAdapter.BindAdapterProperty] = this;\n                this.registerHtmlDataObserver();\n            }\n            registerHtmlDataObserver() {\n                if (!window['MutationObserver'])\n                    return;\n                const adapter = this;\n                function callBack(arr, observer) {\n                    adapter.notifyDataSetChanged();\n                }\n                let observer = new MutationObserver(callBack);\n                observer.observe(this.bindElementData, { childList: true });\n            }\n            getCount() {\n                return this.bindElementData.children.length;\n            }\n            instantiateItem(container, position) {\n                let element = this.getItem(position);\n                let view = element[View.AndroidViewProperty];\n                this.checkReplaceWithRef(element);\n                if (!view) {\n                    view = View.inflate(this.mContext, element);\n                    element[View.AndroidViewProperty] = view;\n                }\n                container.addView(view);\n                return view;\n            }\n            getItem(position) {\n                let element = this.bindElementData.children[position];\n                if (element.tagName === HtmlDataPagerAdapter.RefElementTag) {\n                    element = element[HtmlDataPagerAdapter.RefElementProperty];\n                    if (!element)\n                        throw Error('Reference element is ' + element);\n                }\n                return element;\n            }\n            checkReplaceWithRef(element) {\n                let refElement = element[HtmlDataPagerAdapter.RefElementProperty] || document.createElement(HtmlDataPagerAdapter.RefElementTag);\n                refElement[HtmlDataPagerAdapter.RefElementProperty] = element;\n                element[HtmlDataPagerAdapter.RefElementProperty] = refElement;\n                if (element.parentNode === this.bindElementData) {\n                    this.bindElementData.insertBefore(refElement, element);\n                    this.bindElementData.removeChild(element);\n                }\n                return refElement;\n            }\n            removeElementRefAndRestoreToAdapter(childElement) {\n                if (childElement.tagName === HtmlDataPagerAdapter.RefElementTag) {\n                    let element = childElement[HtmlDataPagerAdapter.RefElementProperty];\n                    this.bindElementData.insertBefore(element, childElement);\n                    this.bindElementData.removeChild(childElement);\n                }\n            }\n            notifyDataSizeWillChange() {\n                for (let i = 0, count = this.bindElementData.children.length; i < count; i++) {\n                    this.removeElementRefAndRestoreToAdapter(this.bindElementData.children[i]);\n                }\n                this.notifyDataSetChanged();\n            }\n            destroyItem(container, position, object) {\n                let view = object;\n                container.removeView(view);\n            }\n            isViewFromObject(view, object) {\n                return view === object;\n            }\n            getItemPosition(object) {\n                let position = PagerAdapter.POSITION_NONE;\n                if (object == null)\n                    return position;\n                for (let i = 0, count = this.getCount(); i < count; i++) {\n                    if (object === this.getItem(i)[View.AndroidViewProperty]) {\n                        position = i;\n                        break;\n                    }\n                }\n                return position;\n            }\n        }\n        HtmlDataPagerAdapter.RefElementTag = \"ref-element\".toUpperCase();\n        HtmlDataPagerAdapter.RefElementProperty = \"RefElement\";\n        HtmlDataPagerAdapter.BindAdapterProperty = \"BindAdapter\";\n        widget.HtmlDataPagerAdapter = HtmlDataPagerAdapter;\n    })(widget = androidui.widget || (androidui.widget = {}));\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var widget;\n    (function (widget) {\n        var NumberPicker = android.widget.NumberPicker;\n        class HtmlDataPickerAdapter {\n            onInflateAdapter(bindElement, context, parent) {\n                this.bindElementData = bindElement;\n                if (parent instanceof NumberPicker) {\n                    if (!window['MutationObserver'])\n                        return;\n                    const callBack = (arr, observer) => {\n                        const values = [];\n                        for (let child of Array.from(this.bindElementData.children)) {\n                            values.push(child.innerText);\n                        }\n                        parent.setDisplayedValues(values);\n                    };\n                    callBack.call(this);\n                    let observer = new MutationObserver(callBack);\n                    observer.observe(this.bindElementData, { childList: true });\n                }\n            }\n        }\n        widget.HtmlDataPickerAdapter = HtmlDataPickerAdapter;\n    })(widget = androidui.widget || (androidui.widget = {}));\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var widget;\n    (function (widget) {\n        var MotionEvent = android.view.MotionEvent;\n        var AbsListView = android.widget.AbsListView;\n        var ScrollView = android.widget.ScrollView;\n        var Integer = java.lang.Integer;\n        var OverScrollLocker;\n        (function (OverScrollLocker) {\n            const InstanceMap = new WeakMap();\n            function getFrom(view) {\n                let scrollLocker = InstanceMap.get(view);\n                if (!scrollLocker) {\n                    if (view instanceof AbsListView) {\n                        scrollLocker = new ListViewOverScrollLocker(view);\n                    }\n                    else if (view instanceof ScrollView) {\n                        scrollLocker = new ScrollViewScrollLocker(view);\n                    }\n                    if (scrollLocker)\n                        InstanceMap.set(view, scrollLocker);\n                }\n                return scrollLocker;\n            }\n            OverScrollLocker.getFrom = getFrom;\n            class BaseOverScrollLocker {\n                constructor(view) {\n                    this.view = view;\n                    const onTouchEventFunc = view.onTouchEvent;\n                    view.onTouchEvent = (event) => {\n                        let result = onTouchEventFunc.call(view, event);\n                        switch (event.getAction()) {\n                            case MotionEvent.ACTION_DOWN:\n                            case MotionEvent.ACTION_MOVE:\n                                this.isInTouch = true;\n                                break;\n                            case MotionEvent.ACTION_UP:\n                            case MotionEvent.ACTION_CANCEL:\n                                this.isInTouch = false;\n                                break;\n                        }\n                        return result;\n                    };\n                }\n                lockOverScrollTop(lockTop) {\n                    this.lockTop = lockTop;\n                    if (!this.isInTouch && this.getOverScrollY() < -lockTop) {\n                        this.springBackToLockTop();\n                    }\n                }\n                lockOverScrollBottom(lockBottom) {\n                    this.lockBottom = lockBottom;\n                    if (!this.isInTouch && this.getOverScrollY() > lockBottom) {\n                        this.springBackToLockBottom();\n                    }\n                }\n            }\n            class ListViewOverScrollLocker extends BaseOverScrollLocker {\n                constructor(listView) {\n                    super(listView);\n                    this.listView = listView;\n                    this.configListView();\n                }\n                configListView() {\n                    let listView = this.listView;\n                    if (!listView.mFlingRunnable)\n                        listView.mFlingRunnable = new AbsListView.FlingRunnable(listView);\n                    const scroller = listView.mFlingRunnable.mScroller;\n                    listView.mFlingRunnable.startOverfling = (initialVelocity) => {\n                        scroller.setInterpolator(null);\n                        let minY = Integer.MIN_VALUE, maxY = Integer.MAX_VALUE;\n                        if (listView.mScrollY < 0)\n                            minY = -this.lockTop;\n                        else if (listView.mScrollY > 0)\n                            maxY = this.lockBottom;\n                        scroller.fling(0, listView.mScrollY, 0, initialVelocity, 0, 0, minY, maxY, 0, listView._mOverflingDistance);\n                        listView.mTouchMode = AbsListView.TOUCH_MODE_OVERFLING;\n                        listView.invalidate();\n                        listView.postOnAnimation(listView.mFlingRunnable);\n                    };\n                    const layoutChildrenFunc = listView.layoutChildren;\n                    listView.layoutChildren = () => {\n                        const overScrollY = this.getOverScrollY();\n                        layoutChildrenFunc.call(listView);\n                        if (overScrollY !== 0) {\n                            listView.overScrollBy(0, -overScrollY, 0, listView.mScrollY, 0, 0, 0, listView.mOverscrollDistance, false);\n                            const atEdge = listView.trackMotionScroll(-overScrollY, -overScrollY);\n                            if (atEdge) {\n                                listView.overScrollBy(0, overScrollY, 0, listView.mScrollY, 0, 0, 0, listView.mOverscrollDistance, false);\n                            }\n                            else {\n                                listView.mFlingRunnable.mScroller.abortAnimation();\n                            }\n                        }\n                    };\n                    listView.checkOverScrollStartScrollIfNeeded = () => {\n                        return listView.mScrollY > this.lockBottom || listView.mScrollY < this.lockTop;\n                    };\n                    listView.mFlingRunnable.edgeReached = (delta) => {\n                        let initialVelocity = listView.mFlingRunnable.mScroller.getCurrVelocity();\n                        if (delta > 0)\n                            initialVelocity = -initialVelocity;\n                        listView.mFlingRunnable.startOverfling(initialVelocity);\n                    };\n                    const oldSpringBack = scroller.springBack;\n                    scroller.springBack = (startX, startY, minX, maxX, minY, maxY) => {\n                        minY = -this.lockTop;\n                        maxY = this.lockBottom;\n                        return oldSpringBack.call(scroller, startX, startY, minX, maxX, minY, maxY);\n                    };\n                    const oldFling = scroller.fling;\n                    scroller.fling = (startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, overX = 0, overY = 0) => {\n                        if (velocityY > 0)\n                            overY += this.lockBottom;\n                        else\n                            overY += this.lockTop;\n                        oldFling.call(scroller, startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, overX, overY);\n                    };\n                }\n                getScrollContentBottom() {\n                    let childCount = this.listView.getChildCount();\n                    let maxBottom = 0;\n                    let minTop = 0;\n                    for (let i = 0; i < childCount; i++) {\n                        let child = this.listView.getChildAt(i);\n                        let childBottom = child.getBottom();\n                        let childTop = child.getTop();\n                        if (childBottom > maxBottom) {\n                            maxBottom = childBottom;\n                        }\n                        if (childTop < minTop) {\n                            minTop = childTop;\n                        }\n                    }\n                    if (minTop > 0)\n                        minTop = 0;\n                    if (this.listView.getAdapter() && childCount > 0) {\n                        return (maxBottom - minTop) * this.listView.getAdapter().getCount() / childCount;\n                    }\n                    return 0;\n                }\n                getOverScrollY() {\n                    return this.listView.mScrollY;\n                }\n                startSpringBack() {\n                    this.listView.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_FLING);\n                    this.listView.mFlingRunnable.mScroller.springBack(0, this.listView.mScrollY, 0, 0, 0, 0);\n                    this.listView.mTouchMode = AbsListView.TOUCH_MODE_OVERFLING;\n                    this.listView.postOnAnimation(this.listView.mFlingRunnable);\n                }\n                springBackToLockTop() {\n                    this.startSpringBack();\n                }\n                springBackToLockBottom() {\n                    this.startSpringBack();\n                }\n            }\n            class ScrollViewScrollLocker extends BaseOverScrollLocker {\n                constructor(scrollView) {\n                    super(scrollView);\n                    this.scrollView = scrollView;\n                    const scroller = scrollView.mScroller;\n                    const oldSpringBack = scroller.springBack;\n                    scroller.springBack = (startX, startY, minX, maxX, minY, maxY) => {\n                        minY = -this.lockTop;\n                        maxY = this.scrollView.getScrollRange() + this.lockBottom;\n                        return oldSpringBack.call(scroller, startX, startY, minX, maxX, minY, maxY);\n                    };\n                    const oldFling = scroller.fling;\n                    scroller.fling = (startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, overX = 0, overY = 0) => {\n                        if (velocityY > 0)\n                            overY += this.lockBottom;\n                        else\n                            overY += this.lockTop;\n                        minY -= this.lockTop;\n                        maxY += this.lockBottom;\n                        oldFling.call(scroller, startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, overX, overY);\n                    };\n                    this.listenScrollContentHeightChange();\n                }\n                listenScrollContentHeightChange() {\n                    const listenHeightChange = (v) => {\n                        const onSizeChangedFunc = v.onSizeChanged;\n                        v.onSizeChanged = (w, h, oldw, oldh) => {\n                            onSizeChangedFunc.call(v, w, h, oldw, oldh);\n                            this.scrollView.overScrollBy(0, 0, 0, this.scrollView.mScrollY, 0, this.scrollView.getScrollRange(), 0, this.scrollView.mOverscrollDistance, false);\n                        };\n                    };\n                    if (this.scrollView.getChildCount() > 0) {\n                        listenHeightChange(this.scrollView.getChildAt(0));\n                    }\n                    else {\n                        const onViewAddedFunc = this.scrollView.onViewAdded;\n                        this.scrollView.onViewAdded = (v) => {\n                            onViewAddedFunc.call(this.scrollView, v);\n                            listenHeightChange(v);\n                        };\n                    }\n                }\n                getScrollContentBottom() {\n                    if (this.scrollView.getChildCount() > 0) {\n                        return this.scrollView.getChildAt(0).getBottom();\n                    }\n                    return this.scrollView.getPaddingTop();\n                }\n                getOverScrollY() {\n                    let scrollY = this.scrollView.getScrollY();\n                    if (scrollY < 0)\n                        return scrollY;\n                    let scrollRange = this.scrollView.getScrollRange();\n                    if (scrollY > scrollRange) {\n                        return scrollY - scrollRange;\n                    }\n                    return 0;\n                }\n                startSpringBack() {\n                    if (this.scrollView.mScroller.springBack(this.scrollView.mScrollX, this.scrollView.mScrollY, 0, 0, 0, this.scrollView.getScrollRange())) {\n                        this.scrollView.postInvalidateOnAnimation();\n                    }\n                }\n                springBackToLockTop() {\n                    this.startSpringBack();\n                }\n                springBackToLockBottom() {\n                    this.startSpringBack();\n                }\n            }\n        })(OverScrollLocker = widget.OverScrollLocker || (widget.OverScrollLocker = {}));\n    })(widget = androidui.widget || (androidui.widget = {}));\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var widget;\n    (function (widget) {\n        var View = android.view.View;\n        var Gravity = android.view.Gravity;\n        var ViewGroup = android.view.ViewGroup;\n        var FrameLayout = android.widget.FrameLayout;\n        var TextView = android.widget.TextView;\n        var LinearLayout = android.widget.LinearLayout;\n        var ProgressBar = android.widget.ProgressBar;\n        var R = android.R;\n        class PullRefreshLoadLayout extends FrameLayout {\n            constructor(context, bindElement, defStyle) {\n                super(context, bindElement, defStyle);\n                this.autoLoadScrollAtBottom = true;\n                this.footerViewReadyDistance = 36 * android.content.res.Resources.getDisplayMetrics().density;\n                this.contentOverY = 0;\n                const a = context.obtainStyledAttributes(bindElement, defStyle);\n                if (a.getBoolean('refreshEnable', true)) {\n                    this.setRefreshEnable(true);\n                }\n                if (a.getBoolean('loadEnable', true)) {\n                    this.setLoadEnable(true);\n                }\n                a.recycle();\n            }\n            onViewAdded(child) {\n                super.onViewAdded(child);\n                if (child instanceof PullRefreshLoadLayout.HeaderView) {\n                    if (child != this.headerView)\n                        this.setHeaderView(child);\n                }\n                else if (child instanceof PullRefreshLoadLayout.FooterView) {\n                    if (child != this.footerView)\n                        this.setFooterView(child);\n                }\n                else {\n                    if (child != this.contentView)\n                        this.setContentView(child);\n                }\n                if (this.footerView != null) {\n                    this.bringChildToFront(this.footerView);\n                }\n            }\n            configHeaderView() {\n                let headerView = this.headerView;\n                let params = headerView.getLayoutParams();\n                params.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;\n                params.height = ViewGroup.LayoutParams.WRAP_CONTENT;\n                params.width = ViewGroup.LayoutParams.MATCH_PARENT;\n                headerView.setLayoutParams(params);\n            }\n            configFooterView() {\n                let footerView = this.footerView;\n                let params = footerView.getLayoutParams();\n                params.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;\n                params.height = ViewGroup.LayoutParams.WRAP_CONTENT;\n                params.width = ViewGroup.LayoutParams.WRAP_CONTENT;\n                footerView.setLayoutParams(params);\n            }\n            configContentView() {\n                let contentView = this.contentView;\n                let params = contentView.getLayoutParams();\n                params.height = ViewGroup.LayoutParams.MATCH_PARENT;\n                params.width = ViewGroup.LayoutParams.MATCH_PARENT;\n                contentView.setLayoutParams(params);\n                this.overScrollLocker = widget.OverScrollLocker.getFrom(contentView);\n                const overScrollByFunc = contentView.overScrollBy;\n                contentView.overScrollBy = (deltaX, deltaY, scrollX, scrollY, scrollRangeX, scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent) => {\n                    let result = overScrollByFunc.call(contentView, deltaX, deltaY, scrollX, scrollY, scrollRangeX, scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);\n                    if (contentView === this.contentView) {\n                        this.onContentOverScroll(scrollRangeY, maxOverScrollY, isTouchEvent);\n                    }\n                    return result;\n                };\n            }\n            onContentOverScroll(scrollRangeY, maxOverScrollY, isTouchEvent) {\n                let newScrollY = this.contentView.mScrollY;\n                const top = 0;\n                const bottom = scrollRangeY;\n                if (newScrollY > bottom) {\n                    this.contentOverY = newScrollY - bottom;\n                }\n                else if (newScrollY < top) {\n                    this.contentOverY = newScrollY - top;\n                }\n                else {\n                    this.contentOverY = 0;\n                }\n                this.checkHeaderFooterPosition();\n                if (this.headerView) {\n                    if (this.contentOverY < -this.headerView.getHeight()) {\n                        if (isTouchEvent) {\n                            this.setHeaderState(PullRefreshLoadLayout.State_Header_ReadyToRefresh);\n                        }\n                        else if (this.headerView.state === PullRefreshLoadLayout.State_Header_ReadyToRefresh) {\n                            this.setHeaderState(PullRefreshLoadLayout.State_Header_Refreshing);\n                        }\n                    }\n                    else if (this.headerView.state === PullRefreshLoadLayout.State_Header_ReadyToRefresh) {\n                        this.setHeaderState(this.headerView.stateBeforeReady);\n                    }\n                }\n                if (this.footerView) {\n                    const footerState = this.footerView.state;\n                    if (this.contentOverY > this.footerView.getHeight() + this.footerViewReadyDistance) {\n                        if (isTouchEvent) {\n                            this.setFooterState(PullRefreshLoadLayout.State_Footer_ReadyToLoad);\n                        }\n                        else if (footerState === PullRefreshLoadLayout.State_Footer_ReadyToLoad) {\n                            this.setFooterState(PullRefreshLoadLayout.State_Footer_Loading);\n                        }\n                    }\n                    else if (footerState === PullRefreshLoadLayout.State_Footer_ReadyToLoad) {\n                        this.setFooterState(this.footerView.stateBeforeReady);\n                    }\n                    if (this.contentOverY > 0 && this.autoLoadScrollAtBottom\n                        && footerState === PullRefreshLoadLayout.State_Footer_Normal) {\n                        this.setFooterState(PullRefreshLoadLayout.State_Footer_Loading);\n                    }\n                }\n            }\n            setHeaderView(headerView) {\n                if (this.headerView) {\n                    this.removeView(this.headerView);\n                }\n                this.headerView = headerView;\n                if (headerView.getParent() == null)\n                    this.addView(headerView);\n                this.configHeaderView();\n            }\n            setFooterView(footerView) {\n                if (this.footerView) {\n                    this.removeView(this.footerView);\n                }\n                this.footerView = footerView;\n                if (footerView.getParent() == null)\n                    this.addView(footerView);\n                this.configFooterView();\n            }\n            setContentView(contentView) {\n                if (this.contentView) {\n                    this.removeView(this.contentView);\n                }\n                this.contentView = contentView;\n                if (contentView.getParent() == null)\n                    this.addView(contentView);\n                this.configContentView();\n            }\n            setHeaderState(newState) {\n                if (!this.headerView)\n                    return;\n                if (this.headerView.state === newState)\n                    return;\n                const changeLimit = PullRefreshLoadLayout.StateChangeLimit[this.headerView.state];\n                if (changeLimit && changeLimit.indexOf(newState) !== -1)\n                    return;\n                this.headerView.setStateInner(this, newState);\n                this.checkLockOverScroll();\n                if (newState === PullRefreshLoadLayout.State_Header_Refreshing && this.refreshLoadListener) {\n                    this.refreshLoadListener.onRefresh(this);\n                }\n            }\n            getHeaderState() {\n                if (!this.headerView)\n                    return PullRefreshLoadLayout.State_Disable;\n                return this.headerView.state;\n            }\n            setFooterState(newState) {\n                if (!this.footerView)\n                    return;\n                if (this.footerView.state === newState)\n                    return;\n                const changeLimit = PullRefreshLoadLayout.StateChangeLimit[this.footerView.state];\n                if (changeLimit && changeLimit.indexOf(newState) !== -1)\n                    return;\n                this.footerView.setStateInner(this, newState);\n                this.checkLockOverScroll();\n                if (newState === PullRefreshLoadLayout.State_Footer_Loading && this.refreshLoadListener) {\n                    this.refreshLoadListener.onLoadMore(this);\n                }\n            }\n            getFooterState() {\n                if (!this.footerView)\n                    return PullRefreshLoadLayout.State_Disable;\n                return this.footerView.state;\n            }\n            checkLockOverScroll() {\n                if (!this.overScrollLocker)\n                    return;\n                if (this.headerView) {\n                    switch (this.headerView.state) {\n                        case PullRefreshLoadLayout.State_Header_Normal:\n                            this.overScrollLocker.lockOverScrollTop(0);\n                            break;\n                        case PullRefreshLoadLayout.State_Header_Refreshing:\n                            this.overScrollLocker.lockOverScrollTop(this.headerView.getHeight());\n                            break;\n                        case PullRefreshLoadLayout.State_Header_ReadyToRefresh:\n                            this.overScrollLocker.lockOverScrollTop(this.headerView.getHeight());\n                            break;\n                        case PullRefreshLoadLayout.State_Header_RefreshFail:\n                            this.overScrollLocker.lockOverScrollTop(this.headerView.getHeight());\n                            break;\n                    }\n                }\n                else {\n                    this.overScrollLocker.lockOverScrollTop(0);\n                }\n                this.overScrollLocker.lockOverScrollBottom(this.footerView ? this.footerView.getHeight() : 0);\n            }\n            checkHeaderFooterPosition() {\n                if (this.contentOverY > 0) {\n                    this.setHeaderViewAppearDistance(0);\n                    this.setFooterViewAppearDistance(this.contentOverY);\n                }\n                else if (this.contentOverY < 0) {\n                    this.setHeaderViewAppearDistance(-this.contentOverY);\n                    this.setFooterViewAppearDistance(0);\n                }\n                else {\n                    this.setHeaderViewAppearDistance(0);\n                    this.setFooterViewAppearDistance(0);\n                }\n            }\n            setHeaderViewAppearDistance(distance) {\n                if (!this.headerView)\n                    return;\n                let offset = -this.headerView.getHeight() - this.headerView.getTop() + distance;\n                this.headerView.offsetTopAndBottom(offset);\n            }\n            setFooterViewAppearDistance(distance) {\n                if (!this.contentView || !this.footerView)\n                    return;\n                let bottomToParentBottom = Math.min(this.overScrollLocker.getScrollContentBottom(), this.contentView.getHeight()) - this.footerView.getBottom();\n                if (this.contentOverY < 0)\n                    bottomToParentBottom -= this.contentOverY;\n                let offset = this.footerView.getHeight() + bottomToParentBottom - distance;\n                this.footerView.offsetTopAndBottom(offset);\n            }\n            onLayout(changed, left, top, right, bottom) {\n                super.onLayout(changed, left, top, right, bottom);\n                this.checkHeaderFooterPosition();\n                this.checkLockOverScroll();\n                if (!this.isLaidOut()) {\n                    if (this.autoLoadScrollAtBottom && this.footerView != null\n                        && this.footerView.getGlobalVisibleRect(new android.graphics.Rect())) {\n                        this.setFooterState(PullRefreshLoadLayout.State_Footer_Loading);\n                    }\n                }\n            }\n            setAutoLoadMoreWhenScrollBottom(autoLoad) {\n                this.autoLoadScrollAtBottom = autoLoad;\n            }\n            setRefreshEnable(enable) {\n                const oldEnable = this.headerView != null;\n                if (enable === oldEnable)\n                    return;\n                if (!enable) {\n                    this.removeView(this.headerView);\n                    this.headerView = null;\n                    if (this.overScrollLocker)\n                        this.overScrollLocker.lockOverScrollTop(0);\n                }\n                else {\n                    this.setHeaderView(new PullRefreshLoadLayout.DefaultHeaderView(this.getContext()));\n                }\n            }\n            setLoadEnable(enable) {\n                const oldEnable = this.footerView != null;\n                if (enable === oldEnable)\n                    return;\n                if (!enable) {\n                    this.removeView(this.footerView);\n                    this.footerView = null;\n                    if (this.overScrollLocker)\n                        this.overScrollLocker.lockOverScrollBottom(0);\n                }\n                else {\n                    this.setFooterView(new PullRefreshLoadLayout.DefaultFooterView(this.getContext()));\n                }\n            }\n            setRefreshLoadListener(refreshLoadListener) {\n                this.refreshLoadListener = refreshLoadListener;\n            }\n            startRefresh() {\n                this.setHeaderState(PullRefreshLoadLayout.State_Header_Refreshing);\n            }\n            startLoadMore() {\n                this.setFooterState(PullRefreshLoadLayout.State_Footer_Loading);\n            }\n        }\n        PullRefreshLoadLayout.State_Disable = -1;\n        PullRefreshLoadLayout.State_Header_Normal = 0;\n        PullRefreshLoadLayout.State_Header_Refreshing = 1;\n        PullRefreshLoadLayout.State_Header_ReadyToRefresh = 2;\n        PullRefreshLoadLayout.State_Header_RefreshFail = 3;\n        PullRefreshLoadLayout.State_Footer_Normal = 4;\n        PullRefreshLoadLayout.State_Footer_Loading = 5;\n        PullRefreshLoadLayout.State_Footer_ReadyToLoad = 6;\n        PullRefreshLoadLayout.State_Footer_LoadFail = 7;\n        PullRefreshLoadLayout.State_Footer_NoMoreToLoad = 8;\n        PullRefreshLoadLayout.StateChangeLimit = {\n            [PullRefreshLoadLayout.State_Header_Refreshing]: [PullRefreshLoadLayout.State_Header_ReadyToRefresh, PullRefreshLoadLayout.State_Footer_Loading,\n                PullRefreshLoadLayout.State_Footer_ReadyToLoad, PullRefreshLoadLayout.State_Footer_LoadFail,\n                PullRefreshLoadLayout.State_Footer_NoMoreToLoad,],\n            [PullRefreshLoadLayout.State_Header_RefreshFail]: [PullRefreshLoadLayout.State_Header_ReadyToRefresh, PullRefreshLoadLayout.State_Footer_Loading,\n                PullRefreshLoadLayout.State_Footer_ReadyToLoad, PullRefreshLoadLayout.State_Footer_LoadFail,\n                PullRefreshLoadLayout.State_Footer_NoMoreToLoad,],\n            [PullRefreshLoadLayout.State_Footer_Loading]: [PullRefreshLoadLayout.State_Header_ReadyToRefresh, PullRefreshLoadLayout.State_Header_Refreshing,\n                PullRefreshLoadLayout.State_Footer_ReadyToLoad, PullRefreshLoadLayout.State_Header_RefreshFail],\n            [PullRefreshLoadLayout.State_Footer_NoMoreToLoad]: [PullRefreshLoadLayout.State_Footer_ReadyToLoad]\n        };\n        widget.PullRefreshLoadLayout = PullRefreshLoadLayout;\n        (function (PullRefreshLoadLayout) {\n            class HeaderView extends FrameLayout {\n                constructor() {\n                    super(...arguments);\n                    this.state = PullRefreshLoadLayout.State_Header_Normal;\n                    this.stateBeforeReady = PullRefreshLoadLayout.State_Header_Normal;\n                }\n                setStateInner(prll, state) {\n                    const oldState = this.state;\n                    this.state = state;\n                    this.onStateChange(state, oldState);\n                    const inner_this = this;\n                    switch (state) {\n                        case PullRefreshLoadLayout.State_Header_RefreshFail:\n                            this.postDelayed({\n                                run() {\n                                    if (state === inner_this.state) {\n                                        prll.setHeaderState(PullRefreshLoadLayout.State_Header_Normal);\n                                    }\n                                }\n                            }, 1000);\n                            break;\n                        case PullRefreshLoadLayout.State_Header_ReadyToRefresh:\n                            this.stateBeforeReady = oldState;\n                            break;\n                    }\n                }\n            }\n            PullRefreshLoadLayout.HeaderView = HeaderView;\n            class FooterView extends FrameLayout {\n                constructor() {\n                    super(...arguments);\n                    this.state = PullRefreshLoadLayout.State_Footer_Normal;\n                    this.stateBeforeReady = PullRefreshLoadLayout.State_Footer_Normal;\n                }\n                setStateInner(prll, state) {\n                    const oldState = this.state;\n                    this.state = state;\n                    this.onStateChange(state, oldState);\n                    switch (state) {\n                        case PullRefreshLoadLayout.State_Footer_ReadyToLoad:\n                            this.stateBeforeReady = oldState;\n                            break;\n                    }\n                }\n            }\n            PullRefreshLoadLayout.FooterView = FooterView;\n            class DefaultHeaderView extends HeaderView {\n                constructor(context, bindElement, defStyle) {\n                    super(context, bindElement, defStyle);\n                    this.progressBar = new ProgressBar(context);\n                    this.progressBar.setVisibility(View.GONE);\n                    this.textView = new TextView(context);\n                    let density = android.content.res.Resources.getDisplayMetrics().density;\n                    const pad = 16 * density;\n                    this.textView.setPadding(pad / 2, pad, pad / 2, pad);\n                    this.textView.setGravity(Gravity.CENTER);\n                    let linear = new LinearLayout(context);\n                    linear.addView(this.progressBar, 32 * density, 32 * density);\n                    linear.addView(this.textView);\n                    linear.setGravity(Gravity.CENTER);\n                    this.addView(linear, -1, -2);\n                    this.onStateChange(PullRefreshLoadLayout.State_Header_Normal, PullRefreshLoadLayout.State_Disable);\n                }\n                onStateChange(newState, oldState) {\n                    switch (newState) {\n                        case PullRefreshLoadLayout.State_Header_Refreshing:\n                            this.textView.setText(R.string_.prll_header_state_loading);\n                            this.progressBar.setVisibility(View.VISIBLE);\n                            break;\n                        case PullRefreshLoadLayout.State_Header_ReadyToRefresh:\n                            this.textView.setText(R.string_.prll_header_state_ready);\n                            this.progressBar.setVisibility(View.GONE);\n                            break;\n                        case PullRefreshLoadLayout.State_Header_RefreshFail:\n                            this.textView.setText(R.string_.prll_header_state_fail);\n                            this.progressBar.setVisibility(View.GONE);\n                            break;\n                        default:\n                            this.textView.setText(R.string_.prll_header_state_normal);\n                            this.progressBar.setVisibility(View.GONE);\n                    }\n                }\n            }\n            PullRefreshLoadLayout.DefaultHeaderView = DefaultHeaderView;\n            class DefaultFooterView extends FooterView {\n                constructor(context, bindElement, defStyle) {\n                    super(context, bindElement, defStyle);\n                    this.progressBar = new ProgressBar(context);\n                    this.progressBar.setVisibility(View.GONE);\n                    this.textView = new TextView(context);\n                    let density = android.content.res.Resources.getDisplayMetrics().density;\n                    const pad = 16 * density;\n                    this.textView.setPadding(pad / 2, pad, pad / 2, pad);\n                    this.textView.setGravity(Gravity.CENTER);\n                    let linear = new LinearLayout(context);\n                    linear.addView(this.progressBar);\n                    linear.addView(this.textView);\n                    linear.setGravity(Gravity.CENTER);\n                    this.addView(linear, -1, -2);\n                    this.onStateChange(PullRefreshLoadLayout.State_Footer_Normal, PullRefreshLoadLayout.State_Disable);\n                    this.setOnClickListener({\n                        onClick(v) {\n                            let parent = v.getParent();\n                            if (parent instanceof PullRefreshLoadLayout) {\n                                parent.setFooterState(PullRefreshLoadLayout.State_Footer_Loading);\n                            }\n                        }\n                    });\n                }\n                onStateChange(newState, oldState) {\n                    switch (newState) {\n                        case PullRefreshLoadLayout.State_Footer_Loading:\n                            this.textView.setText(R.string_.prll_footer_state_loading);\n                            this.progressBar.setVisibility(View.VISIBLE);\n                            break;\n                        case PullRefreshLoadLayout.State_Footer_ReadyToLoad:\n                            this.textView.setText(R.string_.prll_footer_state_ready);\n                            this.progressBar.setVisibility(View.GONE);\n                            break;\n                        case PullRefreshLoadLayout.State_Footer_LoadFail:\n                            this.textView.setText(R.string_.prll_footer_state_fail);\n                            this.progressBar.setVisibility(View.GONE);\n                            break;\n                        case PullRefreshLoadLayout.State_Footer_NoMoreToLoad:\n                            this.textView.setText(R.string_.prll_footer_state_no_more);\n                            this.progressBar.setVisibility(View.GONE);\n                            break;\n                        default:\n                            this.textView.setText(R.string_.prll_footer_state_normal);\n                            this.progressBar.setVisibility(View.GONE);\n                    }\n                }\n            }\n            PullRefreshLoadLayout.DefaultFooterView = DefaultFooterView;\n        })(PullRefreshLoadLayout = widget.PullRefreshLoadLayout || (widget.PullRefreshLoadLayout = {}));\n    })(widget = androidui.widget || (androidui.widget = {}));\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var native;\n    (function (native) {\n        var Canvas = android.graphics.Canvas;\n        let sNextID = 0;\n        class NativeCanvas extends Canvas {\n            initCanvasImpl() {\n                this.canvasId = ++sNextID;\n                this.createCanvasImpl();\n            }\n            createCanvasImpl() {\n                native.NativeApi.canvas.createCanvas(this.canvasId, this.mWidth, this.mHeight);\n                this.save();\n            }\n            recycleImpl() {\n                native.NativeApi.canvas.recycleCanvas(this.canvasId);\n            }\n            isNativeAccelerated() {\n                return true;\n            }\n            translateImpl(dx, dy) {\n                native.NativeApi.canvas.translate(this.canvasId, dx, dy);\n            }\n            scaleImpl(sx, sy) {\n                native.NativeApi.canvas.scale(this.canvasId, sx, sy);\n            }\n            rotateImpl(degrees) {\n                native.NativeApi.canvas.rotate(this.canvasId, degrees);\n            }\n            concatImpl(MSCALE_X, MSKEW_X, MTRANS_X, MSKEW_Y, MSCALE_Y, MTRANS_Y, MPERSP_0, MPERSP_1, MPERSP_2) {\n                native.NativeApi.canvas.concat(this.canvasId, MSCALE_X, MSKEW_X, MTRANS_X, MSKEW_Y, MSCALE_Y, MTRANS_Y);\n            }\n            drawARGBImpl(a, r, g, b) {\n                native.NativeApi.canvas.drawColor(this.canvasId, android.graphics.Color.argb(a, r, g, b));\n            }\n            clearColorImpl() {\n                native.NativeApi.canvas.clearColor(this.canvasId);\n            }\n            saveImpl() {\n                native.NativeApi.canvas.save(this.canvasId);\n            }\n            restoreImpl() {\n                native.NativeApi.canvas.restore(this.canvasId);\n            }\n            clipRectImpl(left, top, width, height) {\n                native.NativeApi.canvas.clipRect(this.canvasId, left, top, width, height);\n            }\n            clipRoundRectImpl(left, top, width, height, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft) {\n                native.NativeApi.canvas.clipRoundRectImpl(this.canvasId, left, top, width, height, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft);\n            }\n            drawCanvasImpl(canvas, offsetX, offsetY) {\n                if (canvas instanceof NativeCanvas) {\n                    native.NativeApi.canvas.drawCanvas(this.canvasId, canvas.canvasId, offsetX, offsetY);\n                }\n                else {\n                    throw Error('canvas should be NativeCanvas');\n                }\n            }\n            drawImageImpl(image, srcRect, dstRect) {\n                if (image instanceof native.NativeImage) {\n                    if (srcRect && dstRect) {\n                        native.NativeApi.canvas.drawImage8args(this.canvasId, image.imageId, srcRect.left, srcRect.top, srcRect.right, srcRect.bottom, dstRect.left, dstRect.top, dstRect.right, dstRect.bottom);\n                    }\n                    else if (dstRect) {\n                        native.NativeApi.canvas.drawImage4args(this.canvasId, image.imageId, dstRect.left, dstRect.top, dstRect.right, dstRect.bottom);\n                    }\n                    else {\n                        native.NativeApi.canvas.drawImage2args(this.canvasId, image.imageId, 0, 0);\n                    }\n                }\n                else {\n                    throw Error('image should be NativeImage');\n                }\n            }\n            drawRectImpl(left, top, width, height, style) {\n                native.NativeApi.canvas.drawRect(this.canvasId, left, top, width, height, style);\n            }\n            drawOvalImpl(oval, style) {\n                native.NativeApi.canvas.drawOval(this.canvasId, oval.left, oval.top, oval.right, oval.bottom, style);\n            }\n            drawCircleImpl(cx, cy, radius, style) {\n                native.NativeApi.canvas.drawCircle(this.canvasId, cx, cy, radius, style);\n            }\n            drawArcImpl(oval, startAngle, sweepAngle, useCenter, style) {\n                native.NativeApi.canvas.drawArc(this.canvasId, oval.left, oval.top, oval.right, oval.bottom, startAngle, sweepAngle, useCenter, style);\n            }\n            drawRoundRectImpl(rect, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft, style) {\n                native.NativeApi.canvas.drawRoundRectImpl(this.canvasId, rect.left, rect.top, rect.width(), rect.height(), radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft, style);\n            }\n            drawTextImpl(text, x, y, style) {\n                native.NativeApi.canvas.drawText(this.canvasId, text, x, y, style);\n            }\n            setColorImpl(color, style) {\n                native.NativeApi.canvas.setFillColor(this.canvasId, color, style);\n            }\n            multiplyGlobalAlphaImpl(alpha) {\n                native.NativeApi.canvas.multiplyGlobalAlpha(this.canvasId, alpha);\n            }\n            setGlobalAlphaImpl(alpha) {\n                native.NativeApi.canvas.setGlobalAlpha(this.canvasId, alpha);\n            }\n            setTextAlignImpl(align) {\n                native.NativeApi.canvas.setTextAlign(this.canvasId, align);\n            }\n            setLineWidthImpl(width) {\n                native.NativeApi.canvas.setLineWidth(this.canvasId, width);\n            }\n            setLineCapImpl(lineCap) {\n                native.NativeApi.canvas.setLineCap(this.canvasId, lineCap);\n            }\n            setLineJoinImpl(lineJoin) {\n                native.NativeApi.canvas.setLineJoin(this.canvasId, lineJoin);\n            }\n            setShadowImpl(radius, dx, dy, color) {\n                native.NativeApi.canvas.setShadow(this.canvasId, radius, dx, dy, color);\n            }\n            setFontSizeImpl(size) {\n                native.NativeApi.canvas.setFontSize(this.canvasId, size);\n            }\n            setFontImpl(fontName) {\n                native.NativeApi.canvas.setFont(this.canvasId, fontName);\n            }\n            isImageSmoothingEnabledImpl() {\n                return false;\n            }\n            setImageSmoothingEnabledImpl(enable) {\n            }\n            static applyTextMeasure(cacheMeasureTextSize, defaultWidth, widths) {\n                android.graphics.Canvas.measureTextImpl = function (text, textSize) {\n                    let width = 0;\n                    for (let i = 0, length = text.length; i < length; i++) {\n                        let c = text.charCodeAt(i);\n                        let cWidth = widths[c] || defaultWidth;\n                        width += cWidth * textSize / cacheMeasureTextSize;\n                    }\n                    return width;\n                };\n            }\n        }\n        native.NativeCanvas = NativeCanvas;\n    })(native = androidui.native || (androidui.native = {}));\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var native;\n    (function (native) {\n        var Surface = android.view.Surface;\n        let sNextSurfaceID = 0;\n        const SurfaceInstances = new Map();\n        class NativeSurface extends Surface {\n            initImpl() {\n                this.initCanvasBound();\n                this.surfaceId = ++sNextSurfaceID;\n                SurfaceInstances.set(this.surfaceId, this);\n                let bound = this.mCanvasBound;\n                native.NativeApi.surface.createSurface(this.surfaceId, bound.left, bound.top, bound.right, bound.bottom);\n            }\n            notifyBoundChange() {\n                this.initCanvasBound();\n                let bound = this.mCanvasBound;\n                native.NativeApi.surface.onSurfaceBoundChange(this.surfaceId, bound.left, bound.top, bound.right, bound.bottom);\n            }\n            lockCanvasImpl(left, top, width, height) {\n                if (!this.lockedCanvas) {\n                    this.lockedCanvas = new NativeSurfaceLockCanvas(width, height);\n                }\n                native.NativeApi.surface.lockCanvas(this.surfaceId, this.lockedCanvas.canvasId, left, top, left + width, top + height);\n                return this.lockedCanvas;\n            }\n            unlockCanvasAndPost(canvas) {\n                if (canvas instanceof native.NativeCanvas) {\n                    native.NativeApi.surface.unlockCanvasAndPost(this.surfaceId, canvas.canvasId);\n                }\n                else {\n                    throw Error('canvas is not NativeCanvas');\n                }\n            }\n            showFps(fps) {\n                native.NativeApi.surface.showFps(fps);\n            }\n            static notifySurfaceReady(surfaceId) {\n                let surface = SurfaceInstances.get(surfaceId);\n                surface.viewRoot.scheduleTraversals();\n            }\n            static notifySurfaceSupportDirtyDraw(surfaceId, dirtyDrawSupport) {\n                let surface = SurfaceInstances.get(surfaceId);\n                surface.mSupportDirtyDraw = dirtyDrawSupport;\n                surface.viewRoot.scheduleTraversals();\n            }\n        }\n        native.NativeSurface = NativeSurface;\n        class NativeSurfaceLockCanvas extends native.NativeCanvas {\n            createCanvasImpl() {\n            }\n        }\n    })(native = androidui.native || (androidui.native = {}));\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var native;\n    (function (native) {\n        var NetImage = androidui.image.NetImage;\n        var Rect = android.graphics.Rect;\n        let sNextId = 0;\n        const NativeImageInstances = new Map();\n        class NativeImage extends NetImage {\n            createImage() {\n                this.imageId = sNextId++;\n                NativeImageInstances.set(this.imageId, this);\n                native.NativeApi.image.createImage(this.imageId);\n            }\n            loadImage() {\n                native.NativeApi.image.loadImage(this.imageId, this.src);\n            }\n            recycle() {\n                native.NativeApi.image.recycleImage(this.imageId);\n                NativeImageInstances.delete(this.imageId);\n            }\n            getPixels(bound, callBack) {\n                if (!callBack)\n                    return;\n                if (!bound)\n                    bound = new Rect(0, 0, this.width, this.height);\n                if (bound.isEmpty()) {\n                    callBack([]);\n                    return;\n                }\n                if (!this.getPixelsCallbacks)\n                    this.getPixelsCallbacks = [];\n                this.getPixelsCallbacks.push(callBack);\n                let callBackIndex = this.getPixelsCallbacks.length - 1;\n                native.NativeApi.image.getPixels(this.imageId, callBackIndex, bound.left, bound.top, bound.right, bound.bottom);\n            }\n            getBorderPixels(callBack) {\n                if (!callBack)\n                    return;\n                if (this.leftBorder && this.topBorder && this.rightBorder && this.bottomBorder) {\n                    callBack(this.leftBorder, this.topBorder, this.rightBorder, this.bottomBorder);\n                }\n                else {\n                    super.getBorderPixels(callBack);\n                }\n            }\n            static notifyLoadFinish(imageId, width, height, leftBorder, topBorder, rightBorder, bottomBorder) {\n                let image = NativeImageInstances.get(imageId);\n                image.mImageWidth = width;\n                image.mImageHeight = height;\n                image.leftBorder = leftBorder;\n                image.topBorder = topBorder;\n                image.rightBorder = rightBorder;\n                image.bottomBorder = bottomBorder;\n                image.fireOnLoad();\n            }\n            static notifyLoadError(imageId) {\n                let image = NativeImageInstances.get(imageId);\n                image.mImageWidth = image.mImageHeight = 0;\n                image.fireOnError();\n            }\n            static notifyGetPixels(imageId, callBackIndex, data) {\n                let image = NativeImageInstances.get(imageId);\n                let callBack = image.getPixelsCallbacks[callBackIndex];\n                image.getPixelsCallbacks[callBackIndex] = null;\n                callBack(data);\n            }\n        }\n        native.NativeImage = NativeImage;\n    })(native = androidui.native || (androidui.native = {}));\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var native;\n    (function (native) {\n        var Rect = android.graphics.Rect;\n        class NativeEditText extends android.widget.EditText {\n            constructor() {\n                super(...arguments);\n                this.mRectTmp = new Rect();\n            }\n            computeTextArea() {\n                this.getGlobalVisibleRect(this.mRectTmp);\n                if (this.mLayout == null) {\n                    this.assumeLayout();\n                }\n                this.mRectTmp.left += this.getTotalPaddingLeft();\n                this.mRectTmp.top += this.getTotalPaddingTop();\n                this.mRectTmp.right -= (this.getTotalPaddingRight());\n                this.mRectTmp.bottom -= (this.getTotalPaddingBottom());\n            }\n            onInputElementFocusChanged(focused) {\n                if (focused) {\n                    this.computeTextArea();\n                    native.NativeApi.drawHTML.showDrawHTMLBound(this.hashCode(), this.mRectTmp.left, this.mRectTmp.top, this.mRectTmp.right, this.mRectTmp.bottom);\n                }\n                else {\n                    native.NativeApi.drawHTML.hideDrawHTMLBound(this.hashCode());\n                }\n                return super.onInputElementFocusChanged(focused);\n            }\n            tryShowInputElement() {\n                this.computeTextArea();\n                native.NativeApi.drawHTML.showDrawHTMLBound(this.hashCode(), this.mRectTmp.left, this.mRectTmp.top, this.mRectTmp.right, this.mRectTmp.bottom);\n                return super.tryShowInputElement();\n            }\n            tryDismissInputElement() {\n                native.NativeApi.drawHTML.hideDrawHTMLBound(this.hashCode());\n                return super.tryDismissInputElement();\n            }\n            _syncBoundAndScrollToElement() {\n                super._syncBoundAndScrollToElement();\n                if (this.isInputElementShowed() && this.isFocused() && this.getText().length > 0) {\n                    this.computeTextArea();\n                    native.NativeApi.drawHTML.showDrawHTMLBound(this.hashCode(), this.mRectTmp.left, this.mRectTmp.top, this.mRectTmp.right, this.mRectTmp.bottom);\n                }\n            }\n            onDetachedFromWindow() {\n                super.onDetachedFromWindow();\n                native.NativeApi.drawHTML.hideDrawHTMLBound(this.hashCode());\n            }\n        }\n        native.NativeEditText = NativeEditText;\n    })(native = androidui.native || (androidui.native = {}));\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var native;\n    (function (native) {\n        var WebView = android.webkit.WebView;\n        var Rect = android.graphics.Rect;\n        const anchor = document.createElement('a');\n        const webViewMap = new Map();\n        class NativeWebView extends WebView {\n            constructor(context, bindElement, defStyle) {\n                super(context, bindElement, defStyle);\n                this.mBoundRect = new Rect();\n                this.mRectTmp = new Rect();\n                this.mLocationTmp = androidui.util.ArrayCreator.newNumberArray(2);\n                native.NativeApi.webView.createWebView(this.hashCode());\n                webViewMap.set(this.hashCode(), this);\n                let activity = this.getContext();\n                let onDestroy = activity.onDestroy;\n                activity.onDestroy = () => {\n                    onDestroy.call(activity);\n                    webViewMap.delete(this.hashCode());\n                    native.NativeApi.webView.destroyWebView(this.hashCode());\n                };\n            }\n            goBack() {\n                native.NativeApi.webView.webViewGoBack(this.hashCode());\n            }\n            canGoBack() {\n                return this.mCanGoBack;\n            }\n            loadUrl(url) {\n                anchor.href = url;\n                url = anchor.href;\n                this.mUrl = url;\n                native.NativeApi.webView.webViewLoadUrl(this.hashCode(), url);\n            }\n            reload() {\n                native.NativeApi.webView.webViewReload(this.hashCode());\n            }\n            getUrl() {\n                return this.mUrl;\n            }\n            getTitle() {\n                return this.mTitle || this.getUrl();\n            }\n            setWebViewClient(client) {\n                super.setWebViewClient(client);\n            }\n            dependOnDebugLayout() {\n                return false;\n            }\n            _syncBoundAndScrollToElement() {\n                super._syncBoundAndScrollToElement();\n                this.getLocationOnScreen(this.mLocationTmp);\n                this.mRectTmp.set(this.mLocationTmp[0], this.mLocationTmp[1], this.mLocationTmp[0] + this.getWidth(), this.mLocationTmp[1] + this.getHeight());\n                if (!this.mRectTmp.equals(this.mBoundRect)) {\n                    this.mBoundRect.set(this.mRectTmp);\n                    native.NativeApi.webView.webViewBoundChange(this.hashCode(), this.mBoundRect.left, this.mBoundRect.top, this.mBoundRect.right, this.mBoundRect.bottom);\n                }\n            }\n            static notifyLoadFinish(viewHash, url, title) {\n                let nativeWebView = webViewMap.get(viewHash);\n                if (nativeWebView == null)\n                    return;\n                nativeWebView.mUrl = url;\n                nativeWebView.mTitle = title;\n                if (nativeWebView.mClient != null) {\n                    nativeWebView.mClient.onReceivedTitle(nativeWebView, title);\n                    nativeWebView.mClient.onPageFinished(nativeWebView, url);\n                }\n            }\n            static notifyWebViewHistoryChange(viewHash, currentHistoryIndex, historySize) {\n                let nativeWebView = webViewMap.get(viewHash);\n                if (nativeWebView == null)\n                    return;\n                nativeWebView.mCanGoBack = currentHistoryIndex > 0;\n            }\n        }\n        native.NativeWebView = NativeWebView;\n    })(native = androidui.native || (androidui.native = {}));\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var native;\n    (function (native) {\n        var HtmlView = androidui.widget.HtmlView;\n        var Rect = android.graphics.Rect;\n        class NativeHtmlView extends HtmlView {\n            constructor() {\n                super(...arguments);\n                this.mRectDrawHTMLBoundTmp = new Rect();\n            }\n            _syncBoundAndScrollToElement() {\n                super._syncBoundAndScrollToElement();\n                this.getGlobalVisibleRect(this.mRectDrawHTMLBoundTmp);\n                native.NativeApi.drawHTML.showDrawHTMLBound(this.hashCode(), this.mRectDrawHTMLBoundTmp.left, this.mRectDrawHTMLBoundTmp.top, this.mRectDrawHTMLBoundTmp.right, this.mRectDrawHTMLBoundTmp.bottom);\n            }\n            onDetachedFromWindow() {\n                super.onDetachedFromWindow();\n                native.NativeApi.drawHTML.hideDrawHTMLBound(this.hashCode());\n            }\n        }\n        native.NativeHtmlView = NativeHtmlView;\n    })(native = androidui.native || (androidui.native = {}));\n})(androidui || (androidui = {}));\nvar androidui;\n(function (androidui) {\n    var native;\n    (function (native) {\n        const AndroidJsBridgeProperty = 'AndroidUIRuntime';\n        const JSBridge = window[AndroidJsBridgeProperty];\n        class NativeApi {\n        }\n        native.NativeApi = NativeApi;\n        (function (NativeApi) {\n            class BatchCall {\n                constructor() {\n                    this.calls = [];\n                }\n                pushCall(method, methodArgs) {\n                    this.calls.push(method);\n                    this.calls.push(...methodArgs);\n                    this.calls.push(null);\n                }\n                clear() {\n                    this.calls = [];\n                }\n                toString() {\n                    return this.calls.join('\\n');\n                }\n            }\n            let batchCall = new BatchCall();\n            class SurfaceApi {\n                createSurface(surfaceId, left, top, right, bottom) {\n                    JSBridge.createSurface(surfaceId, left, top, right, bottom);\n                }\n                onSurfaceBoundChange(surfaceId, left, top, right, bottom) {\n                    JSBridge.onSurfaceBoundChange(surfaceId, left, top, right, bottom);\n                }\n                lockCanvas(surfaceId, canvasId, left, top, right, bottom) {\n                    batchCall.pushCall('31', [surfaceId, canvasId, left, top, right, bottom]);\n                }\n                unlockCanvasAndPost(surfaceId, canvasId) {\n                    batchCall.pushCall('32', [surfaceId, canvasId]);\n                    JSBridge.batchCall(batchCall.toString());\n                    batchCall.clear();\n                }\n                showFps(fps) {\n                    JSBridge.showJSFps(fps);\n                }\n            }\n            NativeApi.SurfaceApi = SurfaceApi;\n            class CanvasApi {\n                createCanvas(canvasId, width, height) {\n                    batchCall.pushCall('33', [canvasId, width, height]);\n                }\n                recycleCanvas(canvasId) {\n                    batchCall.pushCall('34', [canvasId]);\n                }\n                translate(canvasId, dx, dy) {\n                    batchCall.pushCall('35', [canvasId, dx, dy]);\n                }\n                scale(canvasId, sx, sy) {\n                    batchCall.pushCall('36', [canvasId, sx, sy]);\n                }\n                rotate(canvasId, degrees) {\n                    batchCall.pushCall('37', [canvasId, degrees]);\n                }\n                concat(canvasId, MSCALE_X, MSKEW_X, MTRANS_X, MSKEW_Y, MSCALE_Y, MTRANS_Y) {\n                    batchCall.pushCall('38', [canvasId, MSCALE_X, MSKEW_X, MTRANS_X, MSKEW_Y, MSCALE_Y, MTRANS_Y]);\n                }\n                drawColor(canvasId, color) {\n                    batchCall.pushCall('39', [canvasId, color]);\n                }\n                clearColor(canvasId) {\n                    batchCall.pushCall('40', [canvasId]);\n                }\n                drawRect(canvasId, left, top, width, height, style) {\n                    batchCall.pushCall('41', [canvasId, left, top, width, height, style || android.graphics.Paint.Style.FILL]);\n                }\n                clipRect(canvasId, left, top, width, height) {\n                    batchCall.pushCall('42', [canvasId, left, top, width, height]);\n                }\n                save(canvasId) {\n                    batchCall.pushCall('43', [canvasId]);\n                }\n                restore(canvasId) {\n                    batchCall.pushCall('44', [canvasId]);\n                }\n                drawCanvas(canvasId, drawCanvasId, offsetX, offsetY) {\n                    batchCall.pushCall('45', [canvasId, drawCanvasId, offsetX, offsetY]);\n                }\n                drawText(canvasId, text, x, y, fillStyle) {\n                    text = '\"' + text.replace(/(\\n)+|(\\r\\n)+/g, \"\\\\n\") + '\"';\n                    batchCall.pushCall('47', [canvasId, text, x, y, fillStyle || android.graphics.Paint.Style.FILL]);\n                }\n                setFillColor(canvasId, color, style) {\n                    batchCall.pushCall('49', [canvasId, color, style || android.graphics.Paint.Style.FILL]);\n                }\n                multiplyGlobalAlpha(canvasId, alpha) {\n                    batchCall.pushCall('50', [canvasId, alpha]);\n                }\n                setGlobalAlpha(canvasId, alpha) {\n                    batchCall.pushCall('51', [canvasId, alpha]);\n                }\n                setTextAlign(canvasId, align) {\n                    batchCall.pushCall('52', [canvasId, align]);\n                }\n                setLineWidth(canvasId, width) {\n                    batchCall.pushCall('53', [canvasId, width]);\n                }\n                setLineCap(canvasId, lineCap) {\n                    batchCall.pushCall('54', [canvasId, lineCap]);\n                }\n                setLineJoin(canvasId, lineJoin) {\n                    batchCall.pushCall('55', [canvasId, lineJoin]);\n                }\n                setShadow(canvasId, radius, dx, dy, color) {\n                    batchCall.pushCall('56', [canvasId, radius, dx, dy, color]);\n                }\n                setFontSize(canvasId, size) {\n                    batchCall.pushCall('57', [canvasId, size]);\n                }\n                setFont(canvasId, fontName) {\n                    batchCall.pushCall('58', [canvasId, fontName]);\n                }\n                drawOval(canvasId, left, top, right, bottom, style) {\n                    batchCall.pushCall('59', [canvasId, left, top, right, bottom, style || android.graphics.Paint.Style.FILL]);\n                }\n                drawCircle(canvasId, cx, cy, radius, style) {\n                    batchCall.pushCall('60', [canvasId, cx, cy, radius, style || android.graphics.Paint.Style.FILL]);\n                }\n                drawArc(canvasId, left, top, right, bottom, startAngle, sweepAngle, useCenter, style) {\n                    batchCall.pushCall('61', [canvasId, left, top, right, bottom, startAngle, sweepAngle, useCenter, style || android.graphics.Paint.Style.FILL]);\n                }\n                drawRoundRectImpl(canvasId, left, top, width, height, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft, style) {\n                    batchCall.pushCall('62', [canvasId, left, top, width, height, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft, style || android.graphics.Paint.Style.FILL]);\n                }\n                clipRoundRectImpl(canvasId, left, top, width, height, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft) {\n                    batchCall.pushCall('63', [canvasId, left, top, width, height, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft]);\n                }\n                drawImage2args(canvasId, drawImageId, left, top) {\n                    batchCall.pushCall('70', [canvasId, drawImageId, left, top]);\n                }\n                drawImage4args(canvasId, drawImageId, dstLeft, dstTop, dstRight, dstBottom) {\n                    batchCall.pushCall('71', [canvasId, drawImageId, dstLeft, dstTop, dstRight, dstBottom]);\n                }\n                drawImage8args(canvasId, drawImageId, srcLeft, srcTop, srcRight, srcBottom, dstLeft, dstTop, dstRight, dstBottom) {\n                    batchCall.pushCall('72', [canvasId, drawImageId, srcLeft, srcTop, srcRight, srcBottom, dstLeft, dstTop, dstRight, dstBottom]);\n                }\n            }\n            NativeApi.CanvasApi = CanvasApi;\n        })(NativeApi = native.NativeApi || (native.NativeApi = {}));\n        if (JSBridge) {\n            android.view.Surface.prototype = native.NativeSurface.prototype;\n            android.graphics.Canvas.prototype = native.NativeCanvas.prototype;\n            androidui.image.NetImage.prototype = native.NativeImage.prototype;\n            android.widget.EditText = native.NativeEditText;\n            android.webkit.WebView = native.NativeWebView;\n            androidui.widget.HtmlView = native.NativeHtmlView;\n            NativeApi.surface = new NativeApi.SurfaceApi();\n            NativeApi.canvas = new NativeApi.CanvasApi();\n            NativeApi.image = JSBridge;\n            NativeApi.drawHTML = JSBridge;\n            NativeApi.webView = JSBridge;\n            android.os.MessageQueue.requestNextLoop = () => {\n                setTimeout(android.os.MessageQueue.loop, 0);\n            };\n            androidui.AndroidUI.showAppClosed = () => {\n                JSBridge.closeApp();\n            };\n            JSBridge.initRuntime();\n            window.addEventListener('load', () => {\n                setInterval(() => {\n                    JSBridge.pageAlive(1500);\n                }, 800);\n            });\n        }\n    })(native = androidui.native || (androidui.native = {}));\n})(androidui || (androidui = {}));\nwindow[`android`] = android;\nwindow[`java`] = java;\nwindow[`AndroidUI`] = androidui.AndroidUI;\n(function () {\n    var event = document.createEvent(\"CustomEvent\");\n    event.initCustomEvent(\"AndroidUILoadFinish\", true, true, null);\n    document.dispatchEvent(event);\n})();\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"androiduix\",\n  \"version\": \"0.7.0\",\n  \"description\": \"Framework to make high-performance SPA/WebApp. Render with web canvas.\",\n  \"keywords\": [\n    \"webapp\",\n    \"app\",\n    \"canvas\",\n    \"spa\"\n  ],\n  \"author\": \"LinFaXin\",\n  \"maintainers\": [\n    \"LinFaXin <linlinfaxin@163.com> (http://linfaxin.com)\"\n  ],\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/linfaxin/AndroidUIX\"\n  },\n  \"bugs\": {\n    \"url\": \"https://github.com/linfaxin/AndroidUIX/issues\"\n  },\n  \"devDependencies\": {\n    \"jsdom\": \"^7.2.2\",\n    \"babel-cli\": \"^6.18.0\",\n    \"babel-preset-es2015\": \"^6.18.0\"\n  },\n  \"scripts\": {\n    \"build\" : \"npm install --registry=https://registry.npm.taobao.org && npm run buildRes && npm run buildTS2ES6 && npm run buildES62ES5\",\n    \"buildRes\" : \"cd src && node build_sdk_res.js\",\n    \"buildTS2ES6\" : \"cd src && \\\"../buildtool/typescript/bin/tsc\\\" -p ./\",\n    \"buildES62ES5\" : \"cd src && node insert_sdk_version_dist.js && babel ../dist/android-ui.js -o ../dist/android-ui.es5.js -s --presets=es2015\"\n  }\n}\n"
  },
  {
    "path": "src/android/R/anim.ts",
    "content": "/**\n * Created by linfaxin on 16/1/10.\n */\n///<reference path=\"../view/animation/Animation.ts\"/>\n///<reference path=\"../view/animation/AlphaAnimation.ts\"/>\n///<reference path=\"../view/animation/TranslateAnimation.ts\"/>\n///<reference path=\"../view/animation/ScaleAnimation.ts\"/>\n///<reference path=\"../view/animation/AnimationSet.ts\"/>\n///<reference path=\"interpolator.ts\"/>\n\nmodule android.R {\n    import Animation = android.view.animation.Animation;\n    import AlphaAnimation = android.view.animation.AlphaAnimation;\n    import TranslateAnimation = android.view.animation.TranslateAnimation;\n    import ScaleAnimation = android.view.animation.ScaleAnimation;\n    import AnimationSet = android.view.animation.AnimationSet;\n\n    export class anim{\n        static get activity_close_enter():Animation {\n            let alpha = new AlphaAnimation(1, 1);\n            alpha.setDuration(300);\n            alpha.setFillBefore(true);\n            alpha.setFillEnabled(true);\n            alpha.setFillAfter(true);\n            return alpha;\n        }\n        static get activity_close_exit():Animation {\n            let animSet = new AnimationSet();\n            let alpha = new AlphaAnimation(1, 0);\n            alpha.setDuration(300);\n            alpha.setFillBefore(true);\n            alpha.setFillEnabled(true);\n            alpha.setFillAfter(true);\n            alpha.setInterpolator(R.interpolator.decelerate_cubic);\n\n            let scale = new ScaleAnimation(1, 0.8, 1, 0.8, Animation.RELATIVE_TO_PARENT, 0.5, Animation.RELATIVE_TO_PARENT, 0.5);\n            scale.setDuration(300);\n            scale.setFillBefore(true);\n            scale.setFillEnabled(true);\n            scale.setFillAfter(true);\n            scale.setInterpolator(R.interpolator.decelerate_cubic);\n\n            animSet.addAnimation(alpha);\n            animSet.addAnimation(scale);\n            return animSet;\n        }\n\n        static get activity_open_enter():Animation {\n            let animSet = new AnimationSet();\n            let alpha = new AlphaAnimation(0, 1);\n            alpha.setDuration(300);\n            alpha.setFillBefore(false);\n            alpha.setFillEnabled(true);\n            alpha.setFillAfter(true);\n            alpha.setInterpolator(R.interpolator.decelerate_cubic);\n\n            let scale = new ScaleAnimation(0.8, 1, 0.8, 1, Animation.RELATIVE_TO_PARENT, 0.5, Animation.RELATIVE_TO_PARENT, 0.5);\n            scale.setDuration(300);\n            scale.setFillBefore(false);\n            scale.setFillEnabled(true);\n            scale.setFillAfter(true);\n            scale.setInterpolator(R.interpolator.decelerate_cubic);\n\n            animSet.addAnimation(alpha);\n            animSet.addAnimation(scale);\n            return animSet;\n        }\n\n        static get activity_open_exit():Animation {\n            let alpha = new AlphaAnimation(1, 0);\n            alpha.setDuration(300);\n            alpha.setFillBefore(false);\n            alpha.setFillEnabled(true);\n            alpha.setFillAfter(true);\n            alpha.setInterpolator(R.interpolator.decelerate_quint);\n            return alpha;\n        }\n\n        static get activity_close_enter_ios():Animation {\n            let anim = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, -0.25, Animation.RELATIVE_TO_PARENT, 0, 0, 0, 0, 0);\n            anim.setDuration(300);\n            return anim;\n        }\n        static get activity_close_exit_ios():Animation {\n            let anim = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 1, 0, 0, 0, 0);\n            anim.setDuration(300);\n            return anim;\n        }\n\n        static get activity_open_enter_ios():Animation {\n            let anim = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 1, Animation.RELATIVE_TO_PARENT, 0, 0, 0, 0, 0);\n            anim.setDuration(300);\n            return anim;\n        }\n\n        static get activity_open_exit_ios():Animation {\n            let anim = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, -0.25, 0, 0, 0, 0);\n            anim.setDuration(300);\n            return anim;\n        }\n\n\n        static get dialog_enter():Animation {\n            let animSet = new AnimationSet();\n            let alpha = new AlphaAnimation(0, 1);\n            alpha.setDuration(150);\n            alpha.setInterpolator(R.interpolator.decelerate_cubic);\n\n            let scale = new ScaleAnimation(0.9, 1, 0.9, 1, Animation.RELATIVE_TO_SELF, 0.5, Animation.RELATIVE_TO_SELF, 0.5);\n            scale.setDuration(220);\n            scale.setInterpolator(R.interpolator.decelerate_quint);\n\n            animSet.addAnimation(scale);\n            animSet.addAnimation(alpha);\n            return animSet;\n        }\n\n        static get dialog_exit():Animation {\n            let animSet = new AnimationSet();\n            let alpha = new AlphaAnimation(1, 0);\n            alpha.setDuration(150);\n            alpha.setInterpolator(R.interpolator.decelerate_cubic);\n\n            let scale = new ScaleAnimation(1, 0.9, 1, 0.9, Animation.RELATIVE_TO_SELF, 0.5, Animation.RELATIVE_TO_SELF, 0.5);\n            scale.setDuration(220);\n            scale.setInterpolator(R.interpolator.decelerate_quint);\n\n            animSet.addAnimation(scale);\n            animSet.addAnimation(alpha);\n            return animSet;\n        }\n\n        static get fade_in():Animation {\n            let alpha = new AlphaAnimation(0, 1);\n            alpha.setDuration(500);\n            alpha.setInterpolator(R.interpolator.decelerate_quad);\n            return alpha;\n        }\n\n        static get fade_out():Animation {\n            let alpha = new AlphaAnimation(1, 0);\n            alpha.setDuration(400);\n            alpha.setInterpolator(R.interpolator.accelerate_quad);\n            return alpha;\n        }\n\n        static get toast_enter():Animation {\n            let alpha = new AlphaAnimation(0, 1);\n            alpha.setDuration(500);\n            alpha.setInterpolator(R.interpolator.decelerate_quad);\n            return alpha;\n        }\n\n        static get toast_exit():Animation {\n            let alpha = new AlphaAnimation(1, 0);\n            alpha.setDuration(500);\n            alpha.setInterpolator(R.interpolator.accelerate_quad);\n            return alpha;\n        }\n\n        static get grow_fade_in():Animation {\n            let animSet = new AnimationSet();\n            let alpha = new AlphaAnimation(0, 1);\n            alpha.setDuration(150);\n            alpha.setInterpolator(R.interpolator.decelerate_cubic);\n\n            let scale = new ScaleAnimation(0.9, 1, 0.9, 1, Animation.RELATIVE_TO_SELF, 0.5, Animation.RELATIVE_TO_SELF, 0);\n            scale.setDuration(220);\n            scale.setInterpolator(R.interpolator.decelerate_quint);\n\n            animSet.addAnimation(scale);\n            animSet.addAnimation(alpha);\n            return animSet;\n        }\n        static get grow_fade_in_center():Animation {\n            let animSet = new AnimationSet();\n            let alpha = new AlphaAnimation(0, 1);\n            alpha.setDuration(150);\n            alpha.setInterpolator(R.interpolator.decelerate_cubic);\n\n            let scale = new ScaleAnimation(0.9, 1, 0.9, 1, Animation.RELATIVE_TO_SELF, 0.5, Animation.RELATIVE_TO_SELF, 0.5);\n            scale.setDuration(220);\n            scale.setInterpolator(R.interpolator.decelerate_quint);\n\n            animSet.addAnimation(scale);\n            animSet.addAnimation(alpha);\n            return animSet;\n        }\n        static get grow_fade_in_from_bottom():Animation {\n            let animSet = new AnimationSet();\n            let alpha = new AlphaAnimation(0, 1);\n            alpha.setDuration(150);\n            alpha.setInterpolator(R.interpolator.decelerate_cubic);\n\n            let scale = new ScaleAnimation(0.9, 1, 0.9, 1, Animation.RELATIVE_TO_SELF, 0.5, Animation.RELATIVE_TO_SELF, 1);\n            scale.setDuration(220);\n            scale.setInterpolator(R.interpolator.decelerate_quint);\n\n            animSet.addAnimation(scale);\n            animSet.addAnimation(alpha);\n            return animSet;\n        }\n        static get shrink_fade_out():Animation {\n            let animSet = new AnimationSet();\n            let alpha = new AlphaAnimation(1, 0);\n            alpha.setDuration(150);\n            alpha.setInterpolator(R.interpolator.decelerate_cubic);\n\n            let scale = new ScaleAnimation(1, 0.9, 1, 0.9, Animation.RELATIVE_TO_SELF, 0.5, Animation.RELATIVE_TO_SELF, 0);\n            scale.setDuration(220);\n            scale.setInterpolator(R.interpolator.decelerate_quint);\n\n            animSet.addAnimation(scale);\n            animSet.addAnimation(alpha);\n            return animSet;\n        }\n        static get shrink_fade_out_center():Animation {\n            let animSet = new AnimationSet();\n            let alpha = new AlphaAnimation(1, 0);\n            alpha.setDuration(150);\n            alpha.setInterpolator(R.interpolator.decelerate_cubic);\n\n            let scale = new ScaleAnimation(1, 0.9, 1, 0.9, Animation.RELATIVE_TO_SELF, 0.5, Animation.RELATIVE_TO_SELF, 0.5);\n            scale.setDuration(220);\n            scale.setInterpolator(R.interpolator.decelerate_quint);\n\n            animSet.addAnimation(scale);\n            animSet.addAnimation(alpha);\n            return animSet;\n        }\n        static get shrink_fade_out_from_bottom():Animation {\n            let animSet = new AnimationSet();\n            let alpha = new AlphaAnimation(1, 0);\n            alpha.setDuration(150);\n            alpha.setInterpolator(R.interpolator.decelerate_cubic);\n\n            let scale = new ScaleAnimation(1, 0.9, 1, 0.9, Animation.RELATIVE_TO_SELF, 0.5, Animation.RELATIVE_TO_SELF, 1);\n            scale.setDuration(220);\n            scale.setInterpolator(R.interpolator.decelerate_quint);\n\n            animSet.addAnimation(scale);\n            animSet.addAnimation(alpha);\n            return animSet;\n        }\n\n    }\n}"
  },
  {
    "path": "src/android/R/attr.ts",
    "content": "/**\n * Created by linfaxin on 15/11/26.\n */\n///<reference path=\"drawable.ts\"/>\n///<reference path=\"image.ts\"/>\n///<reference path=\"color.ts\"/>\n///<reference path=\"../view/Gravity.ts\"/>\n///<reference path=\"../view/View.ts\"/>\n///<reference path=\"../view/animation/Animation.ts\"/>\n///<reference path=\"../content/res/Resources.ts\"/>\n///<reference path=\"../graphics/Color.ts\"/>\n///<reference path=\"../graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../graphics/drawable/InsetDrawable.ts\"/>\n///<reference path=\"../graphics/drawable/ColorDrawable.ts\"/>\n///<reference path=\"../graphics/drawable/StateListDrawable.ts\"/>\n\nmodule android.R {\n    import Gravity = android.view.Gravity;\n    import Resources = android.content.res.Resources;\n    import Color = android.graphics.Color;\n    import Drawable = android.graphics.drawable.Drawable;\n    import InsetDrawable = android.graphics.drawable.InsetDrawable;\n    import ColorDrawable = android.graphics.drawable.ColorDrawable;\n    import StateListDrawable = android.graphics.drawable.StateListDrawable;\n\n\n    export class attr {\n\n        static textViewStyle = new Map<string, string>()\n            .set('android:textSize', '14sp')\n            .set('android:layerType', 'software')\n            .set('android:textColor', '@android:color/textView_textColor')\n            .set('android:textColorHint', '#ff808080');\n\n        static buttonStyle = new Map<string, string>(attr.textViewStyle)\n            .set('android:background', '@android:drawable/btn_default')\n            .set('android:focusable', 'true')\n            .set('android:clickable', 'true')\n            .set('android:minHeight', '48dp')\n            .set('android:minWidth', '64dp')\n            .set('android:textSize', '18sp')\n            .set('android:gravity', 'center');\n\n        static editTextStyle = new Map<string, string>(attr.textViewStyle)\n            .set('android:background', '@android:drawable/editbox_background')\n            .set('android:focusable', 'true')\n            .set('android:focusableInTouchMode', 'true')\n            .set('android:clickable', 'true')\n            .set('android:textSize', '18sp')\n            .set('android:gravity', 'center_vertical');\n\n        static imageButtonStyle = new Map<string, string>()\n            .set('android:background', '@android:drawable/btn_default')\n            .set('android:focusable', 'true')\n            .set('android:clickable', 'true')\n            .set('android:gravity', 'center');\n\n        static checkboxStyle = new Map<string, string>(attr.buttonStyle)\n            .set('android:background', '@null')\n            .set('android:button', '@android:drawable/btn_check');\n\n        static radiobuttonStyle = new Map<string, string>(attr.buttonStyle)\n            .set('android:background', '@null')\n            .set('android:button', '@android:drawable/btn_radio');\n\n        static checkedTextViewStyle = new Map<string, string>()\n            .set('android:textAlignment', 'viewStart');\n\n        static progressBarStyle = new Map<string, string>()\n            .set('android:indeterminateOnly', 'true')\n            .set('android:indeterminateDrawable', '@android:drawable/progress_medium_holo')\n            .set('android:indeterminateBehavior', 'repeat')\n            .set('android:indeterminateDuration', '3500')\n            .set('android:minWidth', '48dp')\n            .set('android:maxWidth', '48dp')\n            .set('android:minHeight', '48dp')\n            .set('android:maxHeight', '48dp')\n            .set('android:mirrorForRtl', 'false');\n\n        static progressBarStyleHorizontal = new Map<string, string>()\n            .set('android:indeterminateOnly', 'false')\n            .set('android:progressDrawable', '@android:drawable/progress_horizontal_holo')\n            .set('android:indeterminateDrawable', '@android:drawable/progress_indeterminate_horizontal_holo')\n            .set('android:indeterminateBehavior', 'repeat')\n            .set('android:indeterminateDuration', '3500')\n            .set('android:minHeight', '20dp')\n            .set('android:maxHeight', '20dp')\n            .set('android:mirrorForRtl', 'true');\n\n        static progressBarStyleSmall = new Map<string, string>(attr.progressBarStyle)\n            .set('android:indeterminateDrawable', '@android:drawable/progress_small_holo')\n            .set('android:minWidth', '16dp')\n            .set('android:maxWidth', '16dp')\n            .set('android:minHeight', '16dp')\n            .set('android:maxHeight', '16dp');\n\n        static progressBarStyleLarge = new Map<string, string>(attr.progressBarStyle)\n            .set('android:indeterminateDrawable', '@android:drawable/progress_large_holo')\n            .set('android:minWidth', '76dp')\n            .set('android:maxWidth', '76dp')\n            .set('android:minHeight', '76dp')\n            .set('android:maxHeight', '76dp');\n\n        static seekBarStyle = new Map<string, string>()\n            .set('android:indeterminateOnly', 'false')\n            .set('android:progressDrawable', '@android:drawable/scrubber_progress_horizontal_holo_light')\n            .set('android:indeterminateDrawable', '@android:drawable/scrubber_progress_horizontal_holo_light')\n            .set('android:minHeight', '13dp')\n            .set('android:maxHeight', '13dp')\n            .set('android:thumb', '@android:drawable/scrubber_control_selector_holo')\n            .set('android:thumbOffset', '16dp')\n            .set('android:focusable', 'true')\n            .set('android:paddingLeft', '16dp')\n            .set('android:paddingRight', '16dp')\n            .set('android:mirrorForRtl', 'true');\n\n        static ratingBarStyle = new Map<string, string>()\n            .set('android:indeterminateOnly', 'false')\n            .set('android:progressDrawable', '@android:drawable/ratingbar_full_holo_light')\n            .set('android:indeterminateDrawable', '@android:drawable/ratingbar_full_holo_light')\n            .set('android:minHeight', '48dip')\n            .set('android:maxHeight', '48dip')\n            .set('android:numStars', '5')\n            .set('android:stepSize', '0.5')\n            .set('android:thumb', '@null')\n            .set('android:mirrorForRtl', 'true');\n\n        static ratingBarStyleIndicator = new Map<string, string>(attr.ratingBarStyle)\n            .set('android:indeterminateOnly', 'false')\n            .set('android:progressDrawable', '@android:drawable/ratingbar_holo_light')\n            .set('android:indeterminateDrawable', '@android:drawable/ratingbar_holo_light')\n            .set('android:minHeight', '35dip')\n            .set('android:maxHeight', '35dip')\n            .set('android:thumb', '@null')\n            .set('android:isIndicator', 'true');\n\n        static ratingBarStyleSmall = new Map<string, string>(attr.ratingBarStyle)\n            .set('android:indeterminateOnly', 'false')\n            .set('android:progressDrawable', '@android:drawable/ratingbar_small_holo_light')\n            .set('android:indeterminateDrawable', '@android:drawable/ratingbar_small_holo_light')\n            .set('android:minHeight', '16dip')\n            .set('android:maxHeight', '16dip')\n            .set('android:thumb', '@null')\n            .set('android:isIndicator', 'true');\n\n        static absListViewStyle = new Map<string, string>()\n            .set('android:scrollbars', 'vertical')\n            .set('android:fadingEdge', 'vertical');\n\n        static gridViewStyle = new Map<string, string>(attr.absListViewStyle)\n            .set('android:listSelector', '@android:drawable/list_selector_background')\n            .set('android:numColumns', '1');\n\n        static listViewStyle = new Map<string, string>(attr.absListViewStyle)\n            .set('android:divider', '@android:drawable/list_divider')\n            .set('android:listSelector', '@android:drawable/list_selector_background')\n            .set('android:dividerHeight', '1');\n\n        static expandableListViewStyle = new Map<string, string>(attr.listViewStyle)\n            .set('android:childDivider', '@android:drawable/list_divider');\n\n        static numberPickerStyle = new Map<string, string>()\n            .set('android:orientation', 'vertical')\n            .set('android:solidColor', 'transparent')\n            .set('android:selectionDivider', '#cc33b5e5')\n            .set('android:selectionDividerHeight', '2dp')\n            .set('android:selectionDividersDistance', '48dp')\n            .set('android:internalMinWidth', '64dp')\n            .set('android:internalMaxHeight', '180dp')\n            .set('android:virtualButtonPressedDrawable', '@android:drawable/item_background');\n\n        static popupWindowStyle = new Map<string, string>()\n            .set('android:popupBackground', '@android:drawable/dropdown_background_dark')\n            .set('android:popupEnterAnimation', '@android:anim/grow_fade_in_center')\n            .set('android:popupExitAnimation', '@android:anim/shrink_fade_out_center');\n\n        static listPopupWindowStyle = new Map<string, string>()\n            .set('android:popupBackground', '@android:drawable/menu_panel_holo_light')\n            .set('android:popupEnterAnimation', '@android:anim/grow_fade_in_center')\n            .set('android:popupExitAnimation', '@android:anim/shrink_fade_out_center');\n\n        static popupMenuStyle = new Map<string, string>()\n            .set('android:popupBackground', '@android:drawable/menu_panel_holo_dark');\n\n        static dropDownListViewStyle = new Map<string, string>(attr.listViewStyle);\n\n        static spinnerStyle = new Map<string, string>()\n            .set('android:clickable', 'true')\n            .set('android:spinnerMode', 'dropdown')\n            .set('android:gravity', 'start|center_vertical')\n            .set('android:disableChildrenWhenDisabled', 'true')\n            .set('android:background', '@android:drawable/btn_default')\n            .set('android:popupBackground', '@android:drawable/menu_panel_holo_light')\n            .set('android:dropDownVerticalOffset', '0dp')\n            .set('android:dropDownHorizontalOffset', '0dp')\n            .set('android:dropDownWidth', 'wrap_content');\n\n        static actionBarStyle = new Map<string, string>()\n            .set('android:background', '#ff333333');\n\n        static scrollViewStyle = new Map<string, string>()\n            .set('android:scrollbars', 'vertical')\n            .set('android:fadingEdge', 'vertical');\n\n    }\n}"
  },
  {
    "path": "src/android/R/color.ts",
    "content": "/**\n * Created by linfaxin on 15/11/15.\n */\n///<reference path=\"../view/View.ts\"/>\n///<reference path=\"../content/res/Resources.ts\"/>\n///<reference path=\"../content/res/ColorStateList.ts\"/>\n///<reference path=\"../graphics/Color.ts\"/>\n///<reference path=\"../graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../graphics/drawable/InsetDrawable.ts\"/>\n///<reference path=\"../graphics/drawable/ColorDrawable.ts\"/>\n///<reference path=\"../graphics/drawable/StateListDrawable.ts\"/>\nmodule android.R{\n    import Resources = android.content.res.Resources;\n    import ColorStateList = android.content.res.ColorStateList;\n    import Color = android.graphics.Color;\n    import Drawable = android.graphics.drawable.Drawable;\n    import InsetDrawable = android.graphics.drawable.InsetDrawable;\n    import ColorDrawable = android.graphics.drawable.ColorDrawable;\n    import StateListDrawable = android.graphics.drawable.StateListDrawable;\n    import Gravity = android.view.Gravity;\n\n    export class color {\n        static get textView_textColor():ColorStateList {\n            let _defaultStates = [[-android.view.View.VIEW_STATE_ENABLED], []];\n            let _defaultColors = [0xffc0c0c0, 0xff333333];\n            class DefaultStyleTextColor extends ColorStateList{\n                constructor() {\n                    super(_defaultStates, _defaultColors);\n                }\n            }\n            return new DefaultStyleTextColor();\n        }\n\n        static get primary_text_light_disable_only():ColorStateList {\n            let _defaultStates = [[-android.view.View.VIEW_STATE_ENABLED], []];\n            let _defaultColors = [0x80000000, 0xff000000];\n            class DefaultStyleTextColor extends ColorStateList{\n                constructor() {\n                    super(_defaultStates, _defaultColors);\n                }\n            }\n            return new DefaultStyleTextColor();\n        }\n\n        static get primary_text_dark_disable_only():ColorStateList {\n            let _defaultStates = [[-android.view.View.VIEW_STATE_ENABLED], []];\n            let _defaultColors = [0x80000000, 0xffffffff];\n            class DefaultStyleTextColor extends ColorStateList{\n                constructor() {\n                    super(_defaultStates, _defaultColors);\n                }\n            }\n            return new DefaultStyleTextColor();\n        }\n\n        static white = Color.WHITE;\n        static black = Color.BLACK;\n        static transparent = Color.TRANSPARENT;\n    }\n}"
  },
  {
    "path": "src/android/R/drawable.ts",
    "content": "/**\n * Created by linfaxin on 15/11/15.\n */\n///<reference path=\"../view/View.ts\"/>\n///<reference path=\"../content/res/Resources.ts\"/>\n///<reference path=\"../graphics/Color.ts\"/>\n///<reference path=\"../graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../graphics/drawable/InsetDrawable.ts\"/>\n///<reference path=\"../graphics/drawable/ColorDrawable.ts\"/>\n///<reference path=\"../graphics/drawable/LayerDrawable.ts\"/>\n///<reference path=\"../graphics/drawable/RotateDrawable.ts\"/>\n///<reference path=\"../graphics/drawable/ScaleDrawable.ts\"/>\n///<reference path=\"../graphics/drawable/AnimationDrawable.ts\"/>\n///<reference path=\"../graphics/drawable/StateListDrawable.ts\"/>\n///<reference path=\"../graphics/drawable/RoundRectDrawable.ts\"/>\n///<reference path=\"../graphics/drawable/ShadowDrawable.ts\"/>\n///<reference path=\"id.ts\"/>\n\n\nmodule android.R{\n    import Resources = android.content.res.Resources;\n    import Color = android.graphics.Color;\n    import Drawable = android.graphics.drawable.Drawable;\n    import InsetDrawable = android.graphics.drawable.InsetDrawable;\n    import ColorDrawable = android.graphics.drawable.ColorDrawable;\n    import LayerDrawable = android.graphics.drawable.LayerDrawable;\n    import RotateDrawable = android.graphics.drawable.RotateDrawable;\n    import ScaleDrawable = android.graphics.drawable.ScaleDrawable;\n    import AnimationDrawable = android.graphics.drawable.AnimationDrawable;\n    import StateListDrawable = android.graphics.drawable.StateListDrawable;\n    import RoundRectDrawable = android.graphics.drawable.RoundRectDrawable;\n    import ShadowDrawable = android.graphics.drawable.ShadowDrawable;\n    import Gravity = android.view.Gravity;\n\n\n    const density = Resources.getDisplayMetrics().density;\n    export class drawable{\n        static get btn_default():Drawable {\n            let stateList = new StateListDrawable();\n            stateList.addState([-android.view.View.VIEW_STATE_WINDOW_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_default_normal_holo_light);\n            stateList.addState([-android.view.View.VIEW_STATE_WINDOW_FOCUSED, -android.view.View.VIEW_STATE_ENABLED], R.image.btn_default_disabled_holo_light);\n            stateList.addState([android.view.View.VIEW_STATE_PRESSED], R.image.btn_default_pressed_holo_light);\n            stateList.addState([android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_default_focused_holo_light);\n            stateList.addState([android.view.View.VIEW_STATE_ENABLED], R.image.btn_default_normal_holo_light);\n            stateList.addState([android.view.View.VIEW_STATE_FOCUSED], R.image.btn_default_disabled_focused_holo_light);\n            stateList.addState([], R.image.btn_default_disabled_holo_light);\n            return stateList;\n        }\n\n        static get editbox_background():Drawable {\n            let stateList = new StateListDrawable();\n            stateList.addState([android.view.View.VIEW_STATE_FOCUSED], R.image.editbox_background_focus_yellow);\n            stateList.addState([], R.image.editbox_background_normal);\n            return stateList;\n        }\n\n        static get btn_check():Drawable {\n            let stateList = new StateListDrawable();\n            //Enabled states\n            stateList.addState([android.view.View.VIEW_STATE_CHECKED, -android.view.View.VIEW_STATE_WINDOW_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_check_on_holo_light);\n            stateList.addState([-android.view.View.VIEW_STATE_CHECKED, -android.view.View.VIEW_STATE_WINDOW_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_check_off_holo_light);\n\n            stateList.addState([android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_PRESSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_check_on_pressed_holo_light);\n            stateList.addState([-android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_PRESSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_check_off_pressed_holo_light);\n\n            stateList.addState([android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_check_on_focused_holo_light);\n            stateList.addState([-android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_check_off_focused_holo_light);\n\n            stateList.addState([android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_check_on_holo_light);\n            stateList.addState([-android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_check_off_holo_light);\n\n            //Disabled states\n            stateList.addState([android.view.View.VIEW_STATE_CHECKED, -android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_check_on_disabled_holo_light);\n            stateList.addState([-android.view.View.VIEW_STATE_CHECKED, -android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_check_off_disabled_holo_light);\n\n            stateList.addState([android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_FOCUSED], R.image.btn_check_on_disabled_focused_holo_light);\n            stateList.addState([-android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_FOCUSED], R.image.btn_check_off_disabled_focused_holo_light);\n\n            stateList.addState([-android.view.View.VIEW_STATE_CHECKED], R.image.btn_check_off_disabled_holo_light);\n            stateList.addState([android.view.View.VIEW_STATE_CHECKED], R.image.btn_check_on_disabled_holo_light);\n\n            return stateList;\n        }\n\n        static get btn_radio():Drawable {\n            let stateList = new StateListDrawable();\n            //Enabled states\n            stateList.addState([android.view.View.VIEW_STATE_CHECKED, -android.view.View.VIEW_STATE_WINDOW_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_radio_on_holo_light);\n            stateList.addState([-android.view.View.VIEW_STATE_CHECKED, -android.view.View.VIEW_STATE_WINDOW_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_radio_off_holo_light);\n\n            stateList.addState([android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_PRESSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_radio_on_pressed_holo_light);\n            stateList.addState([-android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_PRESSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_radio_off_pressed_holo_light);\n\n            stateList.addState([android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_radio_on_focused_holo_light);\n            stateList.addState([-android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_radio_off_focused_holo_light);\n\n            stateList.addState([android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_radio_on_holo_light);\n            stateList.addState([-android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_ENABLED], R.image.btn_radio_off_holo_light);\n\n            //Disabled states\n            stateList.addState([android.view.View.VIEW_STATE_CHECKED, -android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_radio_on_disabled_holo_light);\n            stateList.addState([-android.view.View.VIEW_STATE_CHECKED, -android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_radio_off_disabled_holo_light);\n\n            stateList.addState([android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_FOCUSED], R.image.btn_radio_on_disabled_focused_holo_light);\n            stateList.addState([-android.view.View.VIEW_STATE_CHECKED, android.view.View.VIEW_STATE_FOCUSED], R.image.btn_radio_off_disabled_focused_holo_light);\n\n            stateList.addState([-android.view.View.VIEW_STATE_CHECKED], R.image.btn_radio_off_disabled_holo_light);\n            stateList.addState([android.view.View.VIEW_STATE_CHECKED], R.image.btn_radio_on_disabled_holo_light);\n\n            return stateList;\n        }\n\n        static get progress_small_holo():Drawable {\n            let rotate1 = new RotateDrawable(null);\n            rotate1.mState.mDrawable = R.image.spinner_16_outer_holo;\n            rotate1.mState.mPivotXRel = true;\n            rotate1.mState.mPivotX = 0.5;\n            rotate1.mState.mPivotYRel = true;\n            rotate1.mState.mPivotY = 0.5;\n            rotate1.mState.mFromDegrees = 0;\n            rotate1.mState.mToDegrees = 1080;\n\n            let rotate2 = new RotateDrawable(null);\n            rotate2.mState.mDrawable = R.image.spinner_16_inner_holo;\n            rotate2.mState.mPivotXRel = true;\n            rotate2.mState.mPivotX = 0.5;\n            rotate2.mState.mPivotYRel = true;\n            rotate2.mState.mPivotY = 0.5;\n            rotate2.mState.mFromDegrees = 720;\n            rotate2.mState.mToDegrees = 0;\n\n            return new LayerDrawable([rotate1, rotate2]);\n        }\n\n        static get progress_medium_holo():Drawable {\n            let rotate1 = new RotateDrawable(null);\n            rotate1.mState.mDrawable = R.image.spinner_48_outer_holo;\n            rotate1.mState.mPivotXRel = true;\n            rotate1.mState.mPivotX = 0.5;\n            rotate1.mState.mPivotYRel = true;\n            rotate1.mState.mPivotY = 0.5;\n            rotate1.mState.mFromDegrees = 0;\n            rotate1.mState.mToDegrees = 1080;\n\n            let rotate2 = new RotateDrawable(null);\n            rotate2.mState.mDrawable = R.image.spinner_48_inner_holo;\n            rotate2.mState.mPivotXRel = true;\n            rotate2.mState.mPivotX = 0.5;\n            rotate2.mState.mPivotYRel = true;\n            rotate2.mState.mPivotY = 0.5;\n            rotate2.mState.mFromDegrees = 720;\n            rotate2.mState.mToDegrees = 0;\n\n            return new LayerDrawable([rotate1, rotate2]);\n        }\n\n        static get progress_large_holo():Drawable {\n            let rotate1 = new RotateDrawable(null);\n            rotate1.mState.mDrawable = R.image.spinner_76_outer_holo;\n            rotate1.mState.mPivotXRel = true;\n            rotate1.mState.mPivotX = 0.5;\n            rotate1.mState.mPivotYRel = true;\n            rotate1.mState.mPivotY = 0.5;\n            rotate1.mState.mFromDegrees = 0;\n            rotate1.mState.mToDegrees = 1080;\n\n            let rotate2 = new RotateDrawable(null);\n            rotate2.mState.mDrawable = R.image.spinner_76_inner_holo;\n            rotate2.mState.mPivotXRel = true;\n            rotate2.mState.mPivotX = 0.5;\n            rotate2.mState.mPivotYRel = true;\n            rotate2.mState.mPivotY = 0.5;\n            rotate2.mState.mFromDegrees = 720;\n            rotate2.mState.mToDegrees = 0;\n\n            return new LayerDrawable([rotate1, rotate2]);\n        }\n\n        static get progress_horizontal_holo():Drawable {\n            let layerDrawable = new LayerDrawable(null);\n            let returnHeight = ()=> 3 * density;\n            let insetTopBottom = Math.floor(8 * density);\n\n            let bg = new ColorDrawable(0x4c000000);\n            bg.getIntrinsicHeight = returnHeight;\n            layerDrawable.addLayer(bg, R.id.background, 0, insetTopBottom, 0, insetTopBottom);\n\n            let secondary = new ScaleDrawable(new ColorDrawable(0x4c33b5e5), Gravity.LEFT, 1, -1);\n            secondary.getIntrinsicHeight = returnHeight;\n            layerDrawable.addLayer(secondary, R.id.secondaryProgress, 0, insetTopBottom, 0, insetTopBottom);\n\n            let progress = new ScaleDrawable(new ColorDrawable(0xcc33b5e5), Gravity.LEFT, 1, -1);\n            progress.getIntrinsicHeight = returnHeight;\n            layerDrawable.addLayer(progress, R.id.progress, 0, insetTopBottom, 0, insetTopBottom);\n\n            layerDrawable.ensurePadding();\n            layerDrawable.onStateChange(layerDrawable.getState());\n\n            return layerDrawable;\n        }\n\n        static get progress_indeterminate_horizontal_holo():Drawable {\n            let animDrawable = new AnimationDrawable();\n            animDrawable.setOneShot(false);\n\n            let frame = R.image.progressbar_indeterminate_holo1;\n            frame.setCallback(animDrawable);\n            animDrawable.addFrame(frame, 50);\n            frame = R.image.progressbar_indeterminate_holo2;\n            frame.setCallback(animDrawable);\n            animDrawable.addFrame(frame, 50);\n            frame = R.image.progressbar_indeterminate_holo3;\n            frame.setCallback(animDrawable);\n            animDrawable.addFrame(frame, 50);\n            frame = R.image.progressbar_indeterminate_holo4;\n            frame.setCallback(animDrawable);\n            animDrawable.addFrame(frame, 50);\n            frame = R.image.progressbar_indeterminate_holo5;\n            frame.setCallback(animDrawable);\n            animDrawable.addFrame(frame, 50);\n            frame = R.image.progressbar_indeterminate_holo6;\n            frame.setCallback(animDrawable);\n            animDrawable.addFrame(frame, 50);\n            frame = R.image.progressbar_indeterminate_holo7;\n            frame.setCallback(animDrawable);\n            animDrawable.addFrame(frame, 50);\n            frame = R.image.progressbar_indeterminate_holo8;\n            frame.setCallback(animDrawable);\n            animDrawable.addFrame(frame, 50);\n\n            return animDrawable;\n        }\n\n        static get ratingbar_full_empty_holo_light():Drawable {\n            let stateList = new StateListDrawable();\n            stateList.addState([android.view.View.VIEW_STATE_PRESSED, android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_rating_star_off_pressed_holo_light);\n            stateList.addState([android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_rating_star_off_pressed_holo_light);\n            stateList.addState([android.view.View.VIEW_STATE_SELECTED, android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_rating_star_off_pressed_holo_light);\n            //stateList.addState([android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_rating_star_off_focused_holo_light);\n            //stateList.addState([android.view.View.VIEW_STATE_SELECTED, android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_rating_star_off_focused_holo_light);\n            stateList.addState([], R.image.btn_rating_star_off_normal_holo_light);\n            return stateList;\n        }\n        \n        static get ratingbar_full_filled_holo_light():Drawable {\n            let stateList = new StateListDrawable();\n            stateList.addState([android.view.View.VIEW_STATE_PRESSED, android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_rating_star_on_pressed_holo_light);\n            stateList.addState([android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_rating_star_on_pressed_holo_light);\n            stateList.addState([android.view.View.VIEW_STATE_SELECTED, android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_rating_star_on_pressed_holo_light);\n            //stateList.addState([android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_rating_star_on_focused_holo_light);\n            //stateList.addState([android.view.View.VIEW_STATE_SELECTED, android.view.View.VIEW_STATE_WINDOW_FOCUSED], R.image.btn_rating_star_on_focused_holo_light);\n            stateList.addState([], R.image.btn_rating_star_on_normal_holo_light);\n            return stateList;\n        }\n\n        static get ratingbar_full_holo_light():Drawable {\n            let layerDrawable = new LayerDrawable(null);\n\n            layerDrawable.addLayer(R.drawable.ratingbar_full_empty_holo_light, R.id.background);\n            layerDrawable.addLayer(R.drawable.ratingbar_full_empty_holo_light, R.id.secondaryProgress);\n            layerDrawable.addLayer(R.drawable.ratingbar_full_filled_holo_light, R.id.progress);\n\n            layerDrawable.ensurePadding();\n            layerDrawable.onStateChange(layerDrawable.getState());\n\n            return layerDrawable;\n        }\n\n        static get ratingbar_holo_light():Drawable {\n            let layerDrawable = new LayerDrawable(null);\n\n            layerDrawable.addLayer(R.image.rate_star_big_off_holo_light, R.id.background);\n            layerDrawable.addLayer(R.image.rate_star_big_half_holo_light, R.id.secondaryProgress);\n            layerDrawable.addLayer(R.image.rate_star_big_on_holo_light, R.id.progress);\n\n            layerDrawable.ensurePadding();\n            layerDrawable.onStateChange(layerDrawable.getState());\n\n            return layerDrawable;\n        }\n\n        static get ratingbar_small_holo_light():Drawable {\n            let layerDrawable = new LayerDrawable(null);\n\n            layerDrawable.addLayer(R.image.rate_star_small_off_holo_light, R.id.background);\n            layerDrawable.addLayer(R.image.rate_star_small_half_holo_light, R.id.secondaryProgress);\n            layerDrawable.addLayer(R.image.rate_star_small_on_holo_light, R.id.progress);\n\n            layerDrawable.ensurePadding();\n            layerDrawable.onStateChange(layerDrawable.getState());\n\n            return layerDrawable;\n        }\n\n        static get scrubber_control_selector_holo():Drawable {\n            let stateList = new StateListDrawable();\n            stateList.addState([-android.view.View.VIEW_STATE_ENABLED], R.image.scrubber_control_disabled_holo);\n            stateList.addState([android.view.View.VIEW_STATE_PRESSED], R.image.scrubber_control_pressed_holo);\n            stateList.addState([android.view.View.VIEW_STATE_SELECTED], R.image.scrubber_control_focused_holo);\n            stateList.addState([], R.image.scrubber_control_normal_holo);\n            return stateList;\n        }\n\n        static get scrubber_progress_horizontal_holo_light():Drawable {\n            let layerDrawable = new LayerDrawable(null);\n\n            layerDrawable.addLayer(R.drawable.scrubber_track_holo_light, R.id.background);\n\n            let secondary = new ScaleDrawable(R.drawable.scrubber_secondary_holo, Gravity.LEFT, 1, -1);\n            layerDrawable.addLayer(secondary, R.id.secondaryProgress);\n\n            let progress = new ScaleDrawable(R.drawable.scrubber_primary_holo, Gravity.LEFT, 1, -1);\n            layerDrawable.addLayer(progress, R.id.progress);\n\n            layerDrawable.ensurePadding();\n            layerDrawable.onStateChange(layerDrawable.getState());\n\n            return layerDrawable;\n        }\n\n        static get scrubber_primary_holo():Drawable {\n            let line = new ColorDrawable(0xff33b5e5);\n            line.getIntrinsicHeight = ()=> 3 * density;\n            return new InsetDrawable(line, 0, 5 * density, 0, 5 * density);\n        }\n\n        static get scrubber_secondary_holo():Drawable {\n            let line = new ColorDrawable(0x4c33b5e5);\n            line.getIntrinsicHeight = ()=> 3 * density;\n            return new InsetDrawable(line, 0, 5 * density, 0, 5 * density);\n        }\n\n        static get scrubber_track_holo_light():Drawable {\n            let line = new ColorDrawable(0x66666666);\n            line.getIntrinsicHeight = ()=> 1 * density;\n            return new InsetDrawable(line, 0, 6 * density, 0, 6 * density);\n        }\n\n        static get list_selector_background():Drawable {\n            return this.item_background;\n        }\n\n        static get list_divider():Drawable {\n            let divider = new ColorDrawable(0xffcccccc);\n            return divider;\n        }\n\n        static get divider_vertical():Drawable {\n            return this.divider_horizontal;\n        }\n\n        static get divider_horizontal():Drawable {\n            let divider = new ColorDrawable(0xffdddddd);\n            divider.getIntrinsicWidth = ()=> 1;\n            divider.getIntrinsicHeight = ()=> 1;\n            return divider;\n        }\n\n        static get item_background(){\n            let stateList = new StateListDrawable();\n            stateList.addState([android.view.View.VIEW_STATE_FOCUSED, -android.view.View.VIEW_STATE_ENABLED], new ColorDrawable(0xffebebeb));\n            stateList.addState([android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_PRESSED], new ColorDrawable(0x88888888));\n            stateList.addState([-android.view.View.VIEW_STATE_FOCUSED, android.view.View.VIEW_STATE_PRESSED], new ColorDrawable(0x88888888));\n            stateList.addState([android.view.View.VIEW_STATE_FOCUSED], new ColorDrawable(0xffaaaaaa));\n            stateList.addState([], new ColorDrawable(Color.TRANSPARENT));\n            return stateList;\n        }\n\n        static get toast_frame(){\n            let bg = new RoundRectDrawable(0xff333333, 2 * density,  2 * density,  2 * density,  2 * density);\n            bg.getIntrinsicHeight = ()=> 32 * density;\n            bg.getPadding = (rect)=>{\n                rect.set(12 * density, 6 * density, 12 * density, 6 * density);\n                return true;\n            };\n            let shadow = new ShadowDrawable(bg, 5 * density, 0, 2 * density, 0x44000000);\n            return new InsetDrawable(shadow, 7 * density);//more space show shadow\n        }\n\n    }\n}"
  },
  {
    "path": "src/android/R/id.ts",
    "content": "module android.R {\n    export const id = {\n        \"content\": \"content\",\n        \"background\": \"background\",\n        \"secondaryProgress\": \"secondaryProgress\",\n        \"progress\": \"progress\",\n        \"contentPanel\": \"contentPanel\",\n        \"topPanel\": \"topPanel\",\n        \"buttonPanel\": \"buttonPanel\",\n        \"customPanel\": \"customPanel\",\n        \"custom\": \"custom\",\n        \"titleDivider\": \"titleDivider\",\n        \"titleDividerTop\": \"titleDividerTop\",\n        \"title_template\": \"title_template\",\n        \"icon\": \"icon\",\n        \"alertTitle\": \"alertTitle\",\n        \"scrollView\": \"scrollView\",\n        \"message\": \"message\",\n        \"button1\": \"button1\",\n        \"button2\": \"button2\",\n        \"button3\": \"button3\",\n        \"leftSpacer\": \"leftSpacer\",\n        \"rightSpacer\": \"rightSpacer\",\n        \"text1\": \"text1\",\n        \"action_bar_center_layout\": \"action_bar_center_layout\",\n        \"action_bar_title\": \"action_bar_title\",\n        \"action_bar_sub_title\": \"action_bar_sub_title\",\n        \"action_bar_left\": \"action_bar_left\",\n        \"action_bar_right\": \"action_bar_right\",\n        \"parentPanel\": \"parentPanel\",\n        \"progress_percent\": \"progress_percent\",\n        \"progress_number\": \"progress_number\",\n        \"title\": \"title\",\n        \"shortcut\": \"shortcut\",\n        \"select_dialog_listview\": \"select_dialog_listview\"\n};\n}"
  },
  {
    "path": "src/android/R/image.ts",
    "content": "///<reference path=\"../../androidui/image/NetDrawable.ts\"/>\n///<reference path=\"../../androidui/image/NinePatchDrawable.ts\"/>\n///<reference path=\"../../androidui/image/ChangeImageSizeDrawable.ts\"/>\n///<reference path=\"image_base64.ts\"/>\nmodule android.R {\n    import NetDrawable = androidui.image.NetDrawable;\n    import ChangeImageSizeDrawable = androidui.image.ChangeImageSizeDrawable;\n    import NinePatchDrawable = androidui.image.NinePatchDrawable;\n\n    const density = android.content.res.Resources.getDisplayMetrics().density;\n    export class image{\n\n        static get actionbar_ic_back_white(){return new NetDrawable(image_base64.actionbar_ic_back_white)}\n        static get btn_check_off_disabled_focused_holo_light(){return new NetDrawable(image_base64.btn_check_off_disabled_focused_holo_light)}\n        static get btn_check_off_disabled_holo_light(){return new NetDrawable(image_base64.btn_check_off_disabled_holo_light)}\n        static get btn_check_off_focused_holo_light(){return new NetDrawable(image_base64.btn_check_off_focused_holo_light)}\n        static get btn_check_off_holo_light(){return new NetDrawable(image_base64.btn_check_off_holo_light)}\n        static get btn_check_off_pressed_holo_light(){return new NetDrawable(image_base64.btn_check_off_pressed_holo_light)}\n        static get btn_check_on_disabled_focused_holo_light(){return new NetDrawable(image_base64.btn_check_on_disabled_focused_holo_light)}\n        static get btn_check_on_disabled_holo_light(){return new NetDrawable(image_base64.btn_check_on_disabled_holo_light)}\n        static get btn_check_on_focused_holo_light(){return new NetDrawable(image_base64.btn_check_on_focused_holo_light)}\n        static get btn_check_on_holo_light(){return new NetDrawable(image_base64.btn_check_on_holo_light)}\n        static get btn_check_on_pressed_holo_light(){return new NetDrawable(image_base64.btn_check_on_pressed_holo_light)}\n        static get btn_default_disabled_focused_holo_light(){return new NinePatchDrawable(image_base64.btn_default_disabled_focused_holo_light)}\n        static get btn_default_disabled_holo_light(){return new NinePatchDrawable(image_base64.btn_default_disabled_holo_light)}\n        static get btn_default_focused_holo_light(){return new NinePatchDrawable(image_base64.btn_default_focused_holo_light)}\n        static get btn_default_normal_holo_light(){return new NinePatchDrawable(image_base64.btn_default_normal_holo_light)}\n        static get btn_default_pressed_holo_light(){return new NinePatchDrawable(image_base64.btn_default_pressed_holo_light)}\n        static get btn_radio_off_disabled_focused_holo_light(){return new NetDrawable(image_base64.btn_radio_off_disabled_focused_holo_light)}\n        static get btn_radio_off_disabled_holo_light(){return new NetDrawable(image_base64.btn_radio_off_disabled_holo_light)}\n        static get btn_radio_off_focused_holo_light(){return new NetDrawable(image_base64.btn_radio_off_focused_holo_light)}\n        static get btn_radio_off_holo_light(){return new NetDrawable(image_base64.btn_radio_off_holo_light)}\n        static get btn_radio_off_pressed_holo_light(){return new NetDrawable(image_base64.btn_radio_off_pressed_holo_light)}\n        static get btn_radio_on_disabled_focused_holo_light(){return new NetDrawable(image_base64.btn_radio_on_disabled_focused_holo_light)}\n        static get btn_radio_on_disabled_holo_light(){return new NetDrawable(image_base64.btn_radio_on_disabled_holo_light)}\n        static get btn_radio_on_focused_holo_light(){return new NetDrawable(image_base64.btn_radio_on_focused_holo_light)}\n        static get btn_radio_on_holo_light(){return new NetDrawable(image_base64.btn_radio_on_holo_light)}\n        static get btn_radio_on_pressed_holo_light(){return new NetDrawable(image_base64.btn_radio_on_pressed_holo_light)}\n        static get btn_rating_star_off_normal_holo_light(){return new NetDrawable(image_base64.btn_rating_star_off_normal_holo_light)}\n        static get btn_rating_star_off_pressed_holo_light(){return new NetDrawable(image_base64.btn_rating_star_off_pressed_holo_light)}\n        static get btn_rating_star_on_normal_holo_light(){return new NetDrawable(image_base64.btn_rating_star_on_normal_holo_light)}\n        static get btn_rating_star_on_pressed_holo_light(){return new NetDrawable(image_base64.btn_rating_star_on_pressed_holo_light)}\n        static get dropdown_background_dark(){return new NinePatchDrawable(image_base64.dropdown_background_dark)}\n        static get editbox_background_focus_yellow(){return new NinePatchDrawable(image_base64.editbox_background_focus_yellow)}\n        static get editbox_background_normal(){return new NinePatchDrawable(image_base64.editbox_background_normal)}\n        static get ic_menu_moreoverflow_normal_holo_dark(){return new NetDrawable(image_base64.ic_menu_moreoverflow_normal_holo_dark)}\n        static get menu_panel_holo_dark(){return new NinePatchDrawable(image_base64.menu_panel_holo_dark)}\n        static get menu_panel_holo_light(){return new NinePatchDrawable(image_base64.menu_panel_holo_light)}\n        static get popup_bottom_bright(){return new NinePatchDrawable(image_base64.popup_bottom_bright)}\n        static get popup_center_bright(){return new NinePatchDrawable(image_base64.popup_center_bright)}\n        static get popup_full_bright(){return new NinePatchDrawable(image_base64.popup_full_bright)}\n        static get popup_top_bright(){return new NinePatchDrawable(image_base64.popup_top_bright)}\n        static get progressbar_indeterminate_holo1(){return new NetDrawable(image_base64.progressbar_indeterminate_holo1)}\n        static get progressbar_indeterminate_holo2(){return new NetDrawable(image_base64.progressbar_indeterminate_holo2)}\n        static get progressbar_indeterminate_holo3(){return new NetDrawable(image_base64.progressbar_indeterminate_holo3)}\n        static get progressbar_indeterminate_holo4(){return new NetDrawable(image_base64.progressbar_indeterminate_holo4)}\n        static get progressbar_indeterminate_holo5(){return new NetDrawable(image_base64.progressbar_indeterminate_holo5)}\n        static get progressbar_indeterminate_holo6(){return new NetDrawable(image_base64.progressbar_indeterminate_holo6)}\n        static get progressbar_indeterminate_holo7(){return new NetDrawable(image_base64.progressbar_indeterminate_holo7)}\n        static get progressbar_indeterminate_holo8(){return new NetDrawable(image_base64.progressbar_indeterminate_holo8)}\n        static get rate_star_big_half_holo_light(){return new NetDrawable(image_base64.rate_star_big_half_holo_light)}\n        static get rate_star_big_off_holo_light(){return new NetDrawable(image_base64.rate_star_big_off_holo_light)}\n        static get rate_star_big_on_holo_light(){return new NetDrawable(image_base64.rate_star_big_on_holo_light)}\n        static get scrubber_control_disabled_holo(){return new NetDrawable(image_base64.scrubber_control_disabled_holo)}\n        static get scrubber_control_focused_holo(){return new NetDrawable(image_base64.scrubber_control_focused_holo)}\n        static get scrubber_control_normal_holo(){return new NetDrawable(image_base64.scrubber_control_normal_holo)}\n        static get scrubber_control_pressed_holo(){return new NetDrawable(image_base64.scrubber_control_pressed_holo)}\n        static get spinner_76_inner_holo(){return new NetDrawable(image_base64.spinner_76_inner_holo)}\n        static get spinner_76_outer_holo(){return new NetDrawable(image_base64.spinner_76_outer_holo)}\n\n        //scale images\n        static get spinner_48_outer_holo(){ return new ChangeImageSizeDrawable(image.spinner_76_outer_holo, 48 * density, 48 * density)}\n        static get spinner_48_inner_holo(){ return new ChangeImageSizeDrawable(image.spinner_76_inner_holo, 48 * density, 48 * density)}\n        static get spinner_16_outer_holo(){ return new ChangeImageSizeDrawable(image.spinner_76_outer_holo, 16 * density, 16 * density)}\n        static get spinner_16_inner_holo(){ return new ChangeImageSizeDrawable(image.spinner_76_inner_holo, 16 * density, 16 * density)}\n\n        static get rate_star_small_off_holo_light(){ return new ChangeImageSizeDrawable(image.rate_star_big_half_holo_light, 16 * density, 16 * density)}\n        static get rate_star_small_half_holo_light(){ return new ChangeImageSizeDrawable(image.rate_star_big_off_holo_light, 16 * density, 16 * density)}\n        static get rate_star_small_on_holo_light(){ return new ChangeImageSizeDrawable(image.rate_star_big_on_holo_light, 16 * density, 16 * density)}\n    }\n    \n    // load these image when init\n    image_base64.actionbar_ic_back_white;\n    image_base64.btn_default_normal_holo_light;\n    image_base64.dropdown_background_dark;\n    image_base64.editbox_background_normal;\n    image_base64.ic_menu_moreoverflow_normal_holo_dark;\n    image_base64.menu_panel_holo_dark;\n    image_base64.menu_panel_holo_light;\n    image_base64.popup_bottom_bright;\n    image_base64.popup_center_bright;\n    image_base64.popup_full_bright;\n    image_base64.popup_top_bright;\n}"
  },
  {
    "path": "src/android/R/image_base64.ts",
    "content": "///<reference path=\"../../androidui/image/NetImage.ts\"/>\nmodule android.R {\n    import NetImage = androidui.image.NetImage;\n\n    //index=ratio, index-0 alway null, index-3 = @x3\n    var data = {\n        \"actionbar_ic_back_white\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAzCAMAAABR9YM8AAAAclBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////9eWEHEAAAAJXRSTlMA+wjy9g/JaUDVsqZONr6IFePdmHhbJBzr6c4tVEm9o5OCcF0v6lgICQAAALZJREFUOMu11EcSgzAQRFEZRBbZJjtb97+iS1PFrpuV+Nu3UphRpFq3KSNr7cLJdpCu1pVweiNKhGpOL0S3i6Me0Sb0RGSECkR3oRxRqoUCShWiMqT0E4ojQOtEaRDKGkQtpVGoGxF1lJrMUTtQmhFFi6NpRRQ7ChGpQqhUKHkVo2DZfmh6+0t0gLFvTLVgcICVBwTf9oHRCOa+cdtHhQ9m4Ru/9gATwf4crBVfdlpxnBXpE87mD+wlJVcMMSJcAAAAAElFTkSuQmCC\"\n        ],\n        \"btn_check_off_disabled_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAFVBMVEUAAAAAmcwzMzMAmcwAmcwAmcwAmcySYuXAAAAAB3RSTlMAZk1gRhAMJ+/C7AAAAGhJREFUWMPt1rEJgFAMBuE02gedwA0EtRcXEFxAcP8dXCDvb14gzV3/9WdEVNJwebPtDsDnoiMApwJzAFYFpgC4WzP3JLA0SgQWBgAAAAAAANAJ8m+m5Mj0JGZs6KPAHoBRrfRrRFTRD3MwONmn2VynAAAAAElFTkSuQmCC\"\n        ],\n        \"btn_check_off_disabled_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgAQMAAADYVuV7AAAABlBMVEUAAAAzMzPI8eYgAAAAAnRSTlMATX7+8BUAAAAhSURBVDjLYxgFZIP/YICNcwBEMI9yRjkkcPCkqlFALgAAVYo5bSUJskUAAAAASUVORK5CYII=\"\n        ],\n        \"btn_check_off_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAMFBMVEUAAAAAmcwAmcwAmcwxNTcAmcwAmcwAmcwAmcwAmcwAmcwvOT0AmcwAmcwAmcwAmczmhCwqAAAAEHRSTlMAmRIfzgUJGg4WJtCScyQtx2HoRgAAAORJREFUWMNjGAWjYEgC1lAcIACr8tDQNJwgNBSL8WEdSjhBR2oApgVN04uNcQDzSo1QDAsi9O8I4gRnP7ViaEj6I4gHnFcLQNfQeRGfBtkZ6BpC2w/i0yBTga6BTV1QcNVj7H62WyUoWJSApiFMWVBwcSX2QJ1uJSholIpFw/PdLljB7jocGiy3YNfgPRmHBiMX7GnMRXlUw6iGUQ2jGkY1jGoY1TCqgRINhBsnlDd/CDewKG3CsRJqJJLeDKW0ocsQpoWvKb0oFbOxnoSvsa4WSn53AKEDX4cjgNQuzSgYBUMRAABvBwmfTLNSCwAAAABJRU5ErkJggg==\"\n        ],\n        \"btn_check_off_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgAQMAAADYVuV7AAAABlBMVEUAAAAzMzPI8eYgAAAAAnRSTlMAzORBQ6MAAAAhSURBVDjLYxgFZIP/YICNcwBEMI9yRjkkcPCkqlFALgAAVYo5bSUJskUAAAAASUVORK5CYII=\"\n        ],\n        \"btn_check_off_pressed_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAGFBMVEVPT080NDQ0NDRHR0cAAABPT09PT09PT0+86ZyxAAAACHRSTlMm1MgyABYeBtShLDEAAAB4SURBVFjD7dixDYAwEATBSzAxLdACLbxzAkukLoGE/qEAXmIlZ9ym1uTvU8TV9bFyRCiqQO0BnYASqkI1nQzM2hmY1Bkocs4Nak1KwZKUg+21HCQvBgYGBgYGBv8A+HRI4uePc25M+IuPRwQ8U+AhhE4tfMzBc9ENzCYkZWqWtP8AAAAASUVORK5CYII=\"\n        ],\n        \"btn_check_on_disabled_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAMFBMVEUAAAAAmcw9PT09PT09PT09PT09PT0AmcwAmcwAmcw9PT09PT09PT09PT0Amcw9PT1vR1UqAAAAEHRSTlMAZoBNQTg7Xj8IR0pEMVYjBJa89wAAASlJREFUWMPt1rFJBEEYhuENVsE7DSbS+GfPyEC4BhYrGKxA7OBCQxsQM/MrQazgSrAKQ7ECXZnzRdmd7x84OIT50uWZN5mFaerq6vayo4cwuknwFArBfSlYlYLMp1lfCNbdBFiO7PIrYNYXgY1ZNwGasR2bkfCAzQAu/KC17727wZUNO/cVCNwIIAIAFdDgloALHBIQQAQAIqDANQEXOEgBBV5cAcDc+r+BEHLg2brfAQHm6fYTEGCdTiWQB7PtsSc/gWUWfGzPfbVhiyYLuJ4xBWIe8AMsCGQBiRRQgAQBCVpAlIAEAQlIRA1IEFCARHQAEgQEIBE9gEQKSEAiugAJAj7QRidgFfwjML4dgqntCKxCZqe+Zyg78z102Z3rKc3eHpu6urp97BNIunQiihmctwAAAABJRU5ErkJggg==\"\n        ],\n        \"btn_check_on_disabled_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAG1BMVEUAAAA9PT09PT09PT09PT09PT09PT09PT09PT1gyl+KAAAACXRSTlMAgE05QT1HMyNi/YIlAAAA6ElEQVRYw+3TwQ2CQBRFUaOo6x/AtRILGDvADrQESrAD7VwxQ+4G/I/EhSb/bcmZGzKwiMVise9v084EXTXxoBnZ/hUwa2eBzqyaAONvYEZCAV0Pdjoo7L27DM7Wr9YKBC4yuBKQwJqAAghIgECSAIFyoYIVAQ2cCLjADwCOUgCwtFYJAA5WCwHAcrjYbQ54oBtu9pYDDtgM3w6B5iN45HMJOKDIBxNwQP7DSgIeyIkc8AAJAi4oAMkFJAi4gETyAQkCLuAuBECCgANIJAWQyAEXkEgSIEFAA0USAQvwR2Bi80EsFov98J52GzL3vLeyTQAAAABJRU5ErkJggg==\"\n        ],\n        \"btn_check_on_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAABfVBMVEUAAAAAmcwfqdodqNotsuIBms0AmcwyteU8Pj8yteUyteUyteU7QUMEm84yteU7QUQzteUyteUFnM8yteUyteUyteUyteUzteUyteUyteUyteUEm84yteUBms0zteUyteUyteUJntEAUWsMn9IFnM8NLjsIndAMLDczteUCms0tseIyteUAV3QwtOQEm848QkUto84yteUsqtgwtOQrcokEm84IHSYcqdoDms0KJjEXo9Qiq9s6Q0cJIiszteUVotI7REgPN0UzteUnqdcdaoYeqNkDm84mi7AIGyIys+Mql74niq8jfZ8wfJYFnM8pkrgpbIMmZnsATmgwqtc7Rkksan8sdo8kXnEAmcwAmcwAmcwAmcwAmcwysuElnstChJodcY48eY4lYXUKIy0vp9QwYHAAPlMAOEoMKjUOMkASQVIUR1oAmcwAl8oAksMCms0Al8k/stkAjbwPn88RoNAAjLsqqtUtq9U+stgoqdRavd5Ftdo3r9cAkcEmqNRtLj6xAAAAbHRSTlMAmQMIBR8SDM4VDhzOFBLPIRAhGRclHik9NCMlMZ04LkMZyBcLeg93LKA7Ns0rHNRLSEdBzaZsJKFzMC7Rb1Ur1IFOQTo1o0NpXEs5MtOqSMrGxUzWyNDCko6HbmdiPdPRzsNhVL+3s2RdRkIKm20RAAAGAUlEQVRo3u2Y+VsSQRjHTS6BOASWBXYTNkxQAxJKFCQ88ii7s/u+T8vSsvtv731nZnc22Jhln/qh5+H7PPqDwucz78zszOwMDTLIIP9Lho38SzbPX6e7TfmbDkbvyt8ycLrLFFuKYTsxgX1GzIoeeLdLlHGSCZIAkgMY3dHTgHj4prdnQph8Pq9pWj4fDo/qoQ5q+KMA8CGtXPb0TAyjYOoxLeFnQVWAGP5cwrB73KvcuXXATg5BJicn68lgPJGIw08CHFCFYbAuYEK52Q9+bq4NBhqQgGGUGFBgXUDotm0+4ufWmvVMlAZKwSJ6CLAA7UY//LW1E82SLEnSqY3HZ1EBhh4lgMBbxu/D6InGt91uNBqrkGapJMunZu8/3DibQQOOg1jg0UKW0xOD07PsidXr7SZEzUJOtc59/Xp8VjdACX8WeIhAW4gctE6EZAGyCNlaVNV0er117v337++JIRiHEoQCTygy0ivoqNCk09PrrWufv+ztfSIGLIH0UW+B9+CI/rfuFcjnGw3748GoJBfV9PTY+jzwd9+92yUGUgIdBLGgc3mjeM7Pqumx1AXKf/Pm3e6X/Qcb0SQR+ASC0MERjuVxIT/A+dNTqQuF44SP2d7eef4aBaN2BZzM4kO+PxFPIh+aXzsD/E+Uv73z9sPRDRwEmwKO5mt+AJufCJr57038w7PtTJKOgVjA+0SHAx3x0D0ZqaRa8VsNmQiEsygG05TjkYwJh/2IT0YzchH5uS7+ZlGKMoHbhoDhgYxoP9IJng1v7ljh4m/8+XtqSYric+CzIwA+wyM6EQd4MIl4bD7hH+nkp7NyBgRhG4J8ZAT5OKZAZ+wo0AGfJd3fxS+sjKlFWe8hGwLgUzzSgY1wuVRUAQ/Nn7ly5GoHf2pa0EMdAugfwkc8g2eBPg34GvIv/cY/cqxGBKQAmwJ8pPxkVGE32czq9FQuN0P4+3tmfq6WmkqXcJKy7UAsMJ4p3E1am9OEXgP6zPKTLv5MrrqystqUggmjALHA4ONuMr+eqtWw8cvLyyc7+IVjuVz1/PnzJ5r1II4AK0AgYGtaBvhkNymcmaH0kyeXuvi1WhX4JxogYB0kEGgowAKQD6sl7iaFY0CHnF561Nn/qdRKFfhrjXqcTiEsQCggBSCf7SYXjzwB+mkr/tTU1MoJIkgEKN+mIBndeLD/E2cjMSwB/u7SdRP/I+GPbW2hYG2uEfNzvkgwGoYeevVsZ3sbWNRwdemuJT9d2Vq9B/zJtsfLZ5AtQWbj6Ie3oDAMnfwq8rOVxcYq8CfbZe8454u7CARnZ7lhb//b1affLPhyZbG5CvxDijbh4nw7Y5CRN1smw6dvlnypsthuAJ8IkC8W5PVBlopmw+7e3q4FP1pZrDeAf0jJj/MJKhTgcwACdX2eGVi6+cHKQr19CBJDwZBNAaylIMjA5s4MnfwrBj8eWYihADaqcfeQbQEbhGJ67EKBG6z4/siCRwE+CobtC1gflWD/5QbePyZ+OBIpK8DvU2CUoI6lzjCDNT8wEtGUA/0KXHoJMArcQPmFas3M94EgRs9TLpuCEAhYCVF6yGK9hPzLhWoK9kfOB0GeCrz9CMBAlwupaBh2CH8Fmq8WOd/lSOB20U5CQymr4nvA0Y8/fny8PA/nB+RnDD4IQv0JPPRk52PbJnvVQAPwKV7CYzTju/sT8MMvN2RkPHDBqnG5tapmizI038R3jxwMefoWDIOAGWBni0oSHIw2X7xsFkvQevLSzd+InQl0w2hYP32BRIZfDB82+A4EXhBwAzu2J9mNAcEjn+3vKPD2LxhCA46DoYjzOw+KN/ZfZwJm0E/Z5BQP8QOd4XW+Q4HZQBwgwbCbLRfnOxUwA3+VYum4mnMuYAaM4HLRkUBwO4p45DsT4FLRVyKC50B8nRPpSMd/FzTFWiC+kAr1ivEhzUME5R4C8ZVazIinK4oiFvBLQce5oU0IBPRa03FuhwTnLn4x6yg3FVEB/GrZQW7dUbyiAsyX432mXNZCE+PCAvj1ft+ZADw/WYsUTsLxYoXDDA0yyCCDDPKP8guHrOe8HDBTsAAAAABJRU5ErkJggg==\"\n        ],\n        \"btn_check_on_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAABPlBMVEUAAAAzteUzteU9PT0zteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteU9Pj4zteUzteUzteUzteUzteUzteUzteUMLTkzteUzteUzteUzteUzteUvp9QzteU9P0AIHCQ9QUMAT2kLKTQAV3QKIy0zteUAUWwzteUzteUzteUdaIQOM0Ays+MytOQpkrkzteUnjLErdIwpb4YmX3IPOEcjfZ8AU28oaH4zteUql74updIscokKIy0upNAnjLEnjbMufJYveZI9fJApa4ImZXoysuEsn8kdcY4uptETRFYiepormcIkgKJEh500gZsAWXc2bYAAPlMAOEoOMkAAmcwAmMoAksMAjbwOn88/stkQoNAqqtUsq9VBs9k+stgoqdRavd43r9cAj79HttoyrdYAibcmqNRAenSqAAAAV3RSTlMAAwbNDAgOEgohFBkXGx0fL84lNCMQOCoReDInQiw9Sj/Ra9THdc1wO8gpSFY5fVFNSEVEz8vCgzTJyFxLP81jRj401NHPycViTtFbREA6L9XVzce3s134HTq+AAAE2UlEQVRo3u2ZaXfSUBCGS1EhQoCEBAIxCIlIxbYuWDfUarXu+1qlVFqty///A85MhiZw0ZsCnqPn5P3c8zzcmZu5ye1CnDhx/pckDvI32GLmTxczX/xiKHM0hOFHOWHHXPgMT6ePYNJpdsxDEOAJfgxDElCwYXY+4RFumhbGRAcpyDAzn/GmlUodp6RS4JiLgfmEB3o2m6FkwWHBKoaGmfmMz6hqjqKCghaRZsHsfMLn8nmFkvcVUCVYAgpm5Vs+XjEMXV9ZX38BCjRYwRJm48PPV3OKYuh2u7zibm66LwwypKBILJiRn1Hh1wPdKTxr3fvy5ZZ7lQxYpLS0Rsk/RYM0MJ7nOYVqFfiDr18Hl9CQU2EJ0AWZICrfqxaLnda93b1+f2cbDbgEi2okE4gzefj4HjliprKZnKK3nUKxWOo0L+3u9T586JFByUGNogmILeLTB/xyoVos1YZ8MOx9f+xCF7LYBLlgFMw56m//rOrzS0v1C8zHbG1tvXuKAjOygNkMRzxtfzXv82v1G5Vbuzs9xn/cv+Ya0QQJX8BgJENoLFu4PYlf9PnbAf/TNXeDBNQDucCnE5hnvmn5T5dhE//EjcraCL+1YUcTJFDg45mMI98fnDgbbAf4dZH/3LGVPO+ihEzAeBr4OPER7o8e2j5L9ROPBH6hrOM2NWVPcgIFwXnCbBXoiG870F7i3w/zzzRvFgtlQ4EKRRMgn3pKPxzZNNgQj+29eFLgl6pYIW6BXBAa+FAXnMk4NhGPPx/410f5t5eKBxWS9Bj3Z1KD+iCfy27bZYAD3cefHedXbtdgAbyHqEJyAZ8ogF9x168CnOg1xJ89v3p9+3M/zK/zAnjURRBggYivr7gvN1t3iiWiE/7c6oNR/kngUwcywwXIBJqGRwrzX8Fp0urUmX7+nMg/ERSIOiB7ChZBwDMN6nN3G06TteYNpi8vT+QX2ka4QHIBdACeWuTDtITTZK3yiOjAvzyBzw1IBSe+VEBDH/l8mqytPlle7na7Vy4PBH5R4EcSQAfcx99/Ap8M91efdLsPJ/E9T+RLBSYKnr6FQwRhZLh+5eEY/5T/+z1P4EcUGO7r/Y+kYMNEfsHzRH60EhlX3dOfhob+529vLn+bwC97nsCPKrA3WiHDzmAwia97DYEvF+Bzllds507I0Ov3exP4SqMh4YtPMj8Hiu5U7zTZwBH5uUZDzhdHBXZZMeDw7bBB4NeZn2k05Hxx2HETnGrpwohB5B9vaCJfLuAawRKWLlTYMJmf0jSBLzPgeRAsocaGgD86HzRNzhePzNASSnU2MH98vmmayJcLeAm+ocZ9ID6eXyPzU0syP2pQQK/pXKTAgPzmTShP1WkH8yeZFPlywaJfJDTQizrt1n3kw/FYgPMrmD8kWDhMSBB8ien0utJpnf7x41TrJuLLupE/4JNg4bCCsW89VMDUONUivB3+3FvEv144ZJLJsa9VeuvaWH8P9Dbic2rwRQyChWkEbLBSw7cv3YboOuLxe3jIn1Lw+xsDvjIwmT+tIHynYqGCLz1UoPv4YP5MJxgacBGwCnyLp+DF0Oi90LQCNtAi0GGlIHTrxHjmTytgQ+hTiiNczU0vEO8WxcvFqQWS21HAE39qwaHyLwoi37H/J/8liBMnTpw4ceLEkeQXuf5HL4dNIhQAAAAASUVORK5CYII=\"\n        ],\n        \"btn_check_on_pressed_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAANlBMVEVPT08+Pj4+Pj5KSkpAQEAAAAA/Pz9PT08/Pz9PT09PT08/Pz9AQEBAQEBPT09PT09CQkI9PT36oQq5AAAAEXRSTlMm1MgyiACTFp4eAZeNggYHXQY8LIYAAAExSURBVGje7drBbsJAFENRtx0YJlAg//+zTaRWruQNU+NFxfMa3SOxSBZ5OGy79oGnb/Tb3t6ApSO0vuzAMhDbWDagI7h+wBXR3dARXcdAdAO1Wq1We6mdjojutK6Twtuj++lTCABbn8LDwNT/I4IPaH/bOQGc11+7PxXQfoMBGH0DOErfBPw+gVCfgNv3gYv2fcDvE7D6PtCk7wCns99XQN8mfl8Bvk3svgLsU3D7CvBpf8H3Pu0+AfYpaJ+/ngfuUpO+AejzRvomoIL0PUAF6dsABe3bgAra9wEK2vcBCtr3ARG07wMUpO8DIrCfACg0JAAKDQmAQkMCoNCQACg0ZACugAJeC/iY2F+Auc0D75NDrVar1Wqz+0/fxEf8aCB+9pA+3IifnuSPZ5LnP9e9/QXc5ydUPu9cjgAAAABJRU5ErkJggg==\"\n        ],\n        \"btn_default_disabled_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABiCAMAAADwfaQ5AAAAM1BMVEUAAAAzteUAmcwAAAAAAAAAkMAAmcwAjbwAmMsAM0UAAAAAgq4AfqgAbpMAgawAAAD/AAA0FdE+AAAAD3RSTlMAHz4TD0I5PSkZCjIyDQj2gUbVAAAAn0lEQVRYw+3ZSw6DMAxFUZq2zodP2P9qKzGqGFjYqkoC9y7gjDLJ83CoujWc0QoICHgJcN+SJJiStGjeLMGczAqYgqOkgOIBRQGDq/+Dj8MBdgFWQEBAQEBAQD9YAW8Atv8OAQEBAQE3sPkPOGAvYMvrnPwaHD3eqIA52r2YFbDkKb5NxSkXbRh/OtKX9vIyVnq7BQAC+sD1K8/Beid8AI8uHiWs1BycAAAAAElFTkSuQmCC\"\n        ],\n        \"btn_default_disabled_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABiCAMAAADwfaQ5AAAAbFBMVEUAAACZmZl5eXl0dHQAAAAAAACHh4dsbGyWlpZbW1uNjY1kZGQjIyOWlpZwcHAAAAAAAAB4eHhubm6Li4teXl5aWlqUlJSIiIhzc3NgYGBTU1N6enqMjIyXl5eIiIiXl5eMjIwAAAAAAAD/AADhocx4AAAAInRSTlMAJ4CAJh6AgICAgIAwJxUUAnp6eHh2dGNjX15cWjIxMDADER06CAAAAMlJREFUWMPt2TkOgzAQhWHALIltMPu+Be5/x0hUUYoRQxOjvP8An1y4mRnnVNuR84t2gAAB2gAmY/1gVY8J5SeFlCErKQtKHMJmcllNTTgQYOYtLrPFywhQeC47TwAEaBu4AQQIECBAgACvgxvAPwDt/4cAAQIECPAArR/AAd4BjLleTIK5WLngKnIC7KJ2jlnvm9uoI0BdKhWxUqrUBOjrvnqyqnrtE6DxL2SIxfgr4HtBSoBOagJmJr35cQEgwHPg/tGVg/WX8AZv3Su8QPHBAAAAAABJRU5ErkJggg==\"\n        ],\n        \"btn_default_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABiCAMAAADwfaQ5AAAAS1BMVEUAAAAzteUAmcwAAAAAiLUAAAAAmcwAHigAmcwAAAAAgasAhLEAk8QAksIAa44AcpgAmcwAAAAAAAAAAAAAAAAAmcwAmcwAAAD/AAAMZPkMAAAAF3RSTlMAZsyA5mbAiYgH3NvUy8S8tm5fSz8gFpzXpUMAAACoSURBVFjD7dk5DsMwDABBR0l0+L7l/780gKsgBWGxiGV49wFTsSFZHCruFWe0AQIC5gCuvjdJ9X6V/MWa5OwigN4o8gJoNaAVQKPq/+DjcID3BCMgICAgICCgHoyANwDzn0NAQEBAwB3MfgEH1IGXvs41Gq8RwE4DdgLoqjqVqysngJNry1dSZesmAQzDM7khSIfxMI/vpMY5XPwXAAh4Erh9pXlY/wgfdZAio63fx68AAAAASUVORK5CYII=\"\n        ],\n        \"btn_default_normal_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABiCAMAAADwfaQ5AAAAflBMVEUAAACZmZkAAAB3d3eTk5MsLCzb29sAAABZWVnAwMAAAAAAAACYmJijo6OLi4sAAAAAAAA0NDRSUlLIyMhvb28WFhagoKAAAAAqKirY2NhISEjNzc0mJibDw8NfX1+5ubmzs7NBQUF+fn7R0dGRkZGioqIAAAAAAAAAAAD/AAAgdn43AAAAKHRSTlMAZhB2aLOnMIiEBAFnbWwOCqONino4FxOolZWTi4d+fXlzcW1kVSwjhumNDwAAAOlJREFUWMPt2ckOgjAUhWEFnFpoC4I4Mo/v/4ISVsakxIsaMJ5/3y9p0k3vXbxU07eYohYgQIAzAPkhP61JnfID19i9t7/sbztCt+7AgMjKOHGWpJwkLpkWVIXTeUTRKZQWlNlyRJnUgoZp0T3LNAACfA9sAAIECBAgQIDjwQbgH4Dzf4cAAQIECLAHZ/8BB/gF0P4s6AsyaAt/AIxMYVM9M9KDMvV8Qbm1bQnfS6UWVIHrnr0tIe/suoHSgiwMrscVqeM1CJkW5Cysqw2pqg4ZHxiMMyUNUlIx/tO7AIAApwLbh8YsrJ+EOyFWMqRTaWfwAAAAAElFTkSuQmCC\"\n        ],\n        \"btn_default_pressed_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABiCAMAAADwfaQ5AAAAclBMVEUAAABmZmYAAABkZGRaWlo3NzcAAAC7u7tNTU2Xl5cAAAAAAABycnIAAAA8PDyioqJISEiJiYlXV1eGhoYAAABcXFy6urqnp6eamppPT08uLi6xsbE9PT0VFRUaGhoAAABiYmJiYmJ4eHh3d3cAAAD/AAABlB2hAAAAJHRSTlMAZg9nbowwmnd+BAFrCoSCe3ZwFxRskomAcXFoYzkyI2RjU1NCIACPAAAA10lEQVRYw+3ZyQ6DIBSF4Sp2AlFRtM520Pd/xRpXTROI1400Pf+eLyzYcO9hVePSYY8mgAABOgCKrCnOpIomE2ZeZPEtLq+EyvmAReQvpUKPVKjUkxtB+QhnjyiGd2kE/dzbUO5bQEb3WGABA4AAV4AjQIAAAQIECHA7OAL8A9D9dwgQIECAABfQ+Q84QPfBlDGyx1ILWAV0MKgsYJukjBHvl7RmUPZRlFxIJVHUSyPIdVcfidWd5kZQcD2ciA2aC8tgnEufmOTip3cBAAHuBU4fbVlYfwlvr34uoI6kYcYAAAAASUVORK5CYII=\"\n        ],\n        \"btn_radio_off_disabled_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAaVBMVEUAAAAzteU9PT0zteU9PT09PT0zteUzteUzteU9PT0zteUzteU9PT09PT0zteU9PT0zteUzteU9PT0zteU9PT0zteUzteU9PT09PT09PT09PT0zteUzteUzteU9PT0zteUzteUzteU9PT3dmb2uAAAAI3RSTlMAZkxgRwQ4EkgOBiARPFMuWyYXTTYyLEAgCioMFkMyGxg/J0SE03YAAAMlSURBVGje7VnXltsgEEUDqlbv1Wv7/z8yoS2J4zVgmc0+6D75mIEpd4YyQgcOHDhw4DuxVMGW557n4TzfumpBb8VpK707lNcTehPCK/YeAgch2o9L5D1BtO61Xi3fBH0Ysv/WPmiUij1sJIEMRlQld0NVJMe6183P+RL5KXmo/iTGmxedqDi3ZfVEpOROvJRQHZ/bI4FpLNoMAEjWFuMkvei4FT2yRsApFMGJZwJ/gcyxUMG56F5YXxlWU8uhHevYR8iP67GF38hqPtoLDfbxwR/c+gyAnGv/z3G/PhOAjHvxga2jdGLrh2ypAgBuanWlYwaAmQ2sTIMF0yH+XD8eAAr/sdhUAGTTpwa8GNcXy28Wn5TAEH8tmQ5A0k+XGyuCe8YuQOs/E/VboaG3IHqhshszEKDQCPtnAKYhMg9SQ8s3ofEndH0dzkAmGldKQ4QM8EEdqKhxA7SIQxOljIaxovNCEwckXQUMPjLRQODGJpq5cKGGrJyAFOnBJWPput6Fq3RggBkZooBMuhBoawCLEqiBqADpg5SKYsAaUUZVSX9kMCJj3Hg6YIMNYxNupswBCxdiUaFXjSgWFM+cAXMWbiJBSs02J8NIo2qBFAZJ4PNq7kUux0CQFQjQco60JARiyxrhjKzQwqimP4E0oaDyNrjBLBJ1eyqXi2LMoEZWqFmirtpTgd5zEhFSK8QwiJ0+12Yp58xHVphYViTaPPWEAgBkBx+ImI//rwJMOXATIkXyspNk52nqptBGVWgut4qOTne+2Zlu17GL7VodOIWjAwdFzo5M94e++2uLunhFOy5eDq+OF7Oro7rDFkAmwwDNaqLd9T3zLa/vq+0D5Gz+ACmFA3qETp9Q9o9A0D0C9z9jJXH5j3mIi3d1ucpWAtG0Ei68lWDfLKoQd0LTDKlkZ8a+nRPctXPYgnftHCnqrCHVqHbR7pZaNjDLM9VSQ71oqf3EpuCfbc0vck2OL7sbs2Vw+WdPDLAY7NAOhI0ngKOgEq3lsA8iLP+Pwr3N8cZRc1xh/bK9fw3Re5A8+kCxndBbEcpPLF6eb0G1oAMHDhw48I34BUmSKxG/3YRpAAAAAElFTkSuQmCC\"\n        ],\n        \"btn_radio_off_disabled_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgBAMAAAAQtmoLAAAAMFBMVEUAAAA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1STLyxAAAAEHRSTlMATAUMRyoWMBA7P0MhNh49I5b3UAAAAXZJREFUWMNjGAWjYBSMAsoB8/NZgiJr6wyIVW/qKAgGIsHEqc8UFLyTwcDUdlZQcBox6u0F3ZMgLLUSwcmE1asKiirA2EyBggEE/btQXAHBYyqUIuTzFmkUFRwbPfCrZxO8hCqgK5iAV0OjOLpIoQReHzgWoAuxi+DzBZcsptjFBXg0BG7CFNMWxeMiwQZMQQ5B3G7iFMVq7QScGhKdsImqiOHUMPEANlEeSZxeEFHAJszkiMsTrKI4wg5XCuSWwBH9G3BoMHTALs4ijEPDwwLs4uxyuOL5AHZxHlFcoZqAI83L4tCw0QBHcEvj0OCogF2cSQSHBkEGXBKUaiDsJAo9TThYJSmNOMJJg9LERzh5U5qBCGdRcgsByosZfuwF2QfKi0qEYU5YXCSKr7iXUsAIo4ULSKtQeEUMyKqyKK8UEdVuA1q1S1nFTrjpEMRAEHQhN05WENv8SWZgMIM3fyhvYGH6/PgsQcGVNQYMo2AUjIJRQDEAAKdsRGG19ZMWAAAAAElFTkSuQmCC\"\n        ],\n        \"btn_radio_off_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAwFBMVEUAAAAzteU9PT0zteUzteUzteU9PT0zteUzteUzteUzteUzteUzteU9PT0zteUzteUzteUzteU9PT09PT09PT0zteUzteU9PT09PT09PT0zteU9PT0zteU9PT09PT0zteU9PT09PT0zteUzteU9PT09PT09PT09PT09PT09PT0zteUzteU9PT09PT09PT09PT09PT0zteU9PT09PT09PT0zteUzteU9PT0zteUzteU9PT09PT0zteU9PT09PT09PT2npJ6rAAAAQHRSTlMAmcwElCDAN48ValInxnBLPVclpJCHMQy1nnorizK6dGo6CYB9VhkKhHBkQz8eBwV5X6yYdR0PXSwaKRR3TCKGCl/ORQAAA8lJREFUaN7tWNl6qjAQxmErIIq74r4r7kvtqT3tef+3OkwCtLYWEii94r9Rv0xmnCWTyS9kyJAhQ4bfhKYajm1LuZxk205R1X5UuVh3arlPqB3q4g+plw8Pubt4KD0LyZEv5EKgy0kj/66+YFiyLLrxkmWr1H83oSWJvSFRLZKuXm6XLpburxVj50KzqQr7fjpH6piu/43phCrRclG/F7FqNNv1OPpXdO/K//eb6f5UMQGUymn/OvODuKIVZvHrL9EUjuiv8rIJN2gOyl4ydCJYjKVfWtEfwxYAmNXp8LoThO11OK2aANAaeq5KMSwUif48+X6tACiL9fbj+ny9UFwT1Is/EneUVNzRIYdoewYwB42vMo2lCbDckbNOEvGHoz4lTO8jSW0FYPJyX2w2AajMiAWygblaxXEQn64Cx/L3ku0m9NpBlPqsJ84IQjo0oToPE21UQekGRV3kCJBD/r8Jkwjh3QJM4oOOXl+YDGAjq40w/grqj8ICepiHESZaZ+rP6KyK9VOBKoP87gStnV95LN27gK0Zv5yh2RAY0GjCwPdcZ3RAxgoBaAtM6IJZ9ndG33EH34EKLAVG7OHku1CKPAOSdybX0JuzGmgogLVax+MvMjSJmkgceBKYMSAuiB13c9TV4LgyBsmAgg6wu7DBFhwdI/HBS/EZzgIHJjDw0lwLF3zEpoUR6vklxFpIRz+B4S3P8mq5DIrABQVm3hlSI/ocbVlT+MdnoAqvwfYw6F4d7LGGePAES68GD6FyeBPgRdOCIZ+BNelbMk5JoXJYyReS4w2fgTLJ8sXdPg6VwzIQSc7mfAZeoIk9O7JOcy7wE0DgQwMUb/9DmgZENBAZolHCEKWT5DeSZA2TnHqZMh20CUxjHzTGVrGI0yqKuD31Zsfarq987boZtGvWC2eZyoUj6EmvzEMql/5T+KWffGzp3YwtzIPXgH3wagWDF/vo2GUeHdsAHKOj0P8w/L5wD79c4/sRWluG8b3KOb6/P0DeFFiwP0A6xAEWPMd/QmlpPAJNrkcg/zNWaZPEode2yPcQJxW3OQLsOR/i/FSCMpjfic4goBLylErgJ0PUgAzpTW7JkO1HMsSiZEgcusigUV37dA5RWL6lc0RPNB4hVYgkpEYFfkKKoviVUmtVwIVLqU1DKDVuUnCshojEJQUptLFPa37DaPu0pxafmM1RdEr5z0v5UicZMUvxGHDIElLLhASTZcsoSAHjnJQgz/dzISjI6dL7VH1yiKrT+ay95tRF4SehWYZuk7KybcdQNSFDhgwZMvwi/gPvHkn+qOIQ7AAAAABJRU5ErkJggg==\"\n        ],\n        \"btn_radio_off_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAaVBMVEUAAAA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1Pag0XAAAAI3RSTlMAzL8LJcV8OyqQpLpwhGsbtp0zFwcFsZd3VFovqkEfoWEPTH3CfAwAAAGvSURBVGje7ZjpboMwEIR3bHxwhisQyJ33f8hKVSo1akS8hkRU8veXEWgZH7tDgUAgEAgEAh9mM+g+UYBIen3b0MJEWYkHyiKi5TAVABUPxm6JWmvGWAGoDC2DTQCRm5Z+IY+5AKolqmh3gCok/UFmCsi2NJNTAuiGntJoIJlp916giyYed0jtLHcVYjklkDFETd7UCvqFZJtDeddwEtCvVTlSTx/aA2IH2bbH2W8t7dBJF921ROG1gADrqlQR8UmQudfaE5sjUumqvQrUHgWM7uILvwQLId3VUuBEPDJkHLlmL6QUlrXn0RGLCIJYCDQs/YCcWMS4sfQaI7G4IGPpKxhiYRAzPd5wTTswPZPEokHJ0gPEQ0Ks6wM+v2hdJvss03VttNHjqFjXYff245p27AtnbVcm+9J/b9uSovZpvAp3wyq/1nHv6hciv+a3bHjNL799P7cO7Xvs275TJJC7DSBrHaHchkBV0wzq6THWdhB25iB+4A/i/ChBPI0SiokogR2GpNq0D591CEMYHM/3OOf7hZEZ7nHO/wmkfiK1KgGApNfDhgKBQCAQCAQ+yxdkJhHOkHWlWgAAAABJRU5ErkJggg==\"\n        ],\n        \"btn_radio_off_pressed_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAb1BMVEVPT08AAAA+Pj5PT09PT09PT09PT09PT09PT09KSkpPT09PT08+Pj5EREQ+Pj5GRkY+Pj5PT08+Pj5AQEBAQEBBQUE+Pj4+Pj4/Pz9FRUVMTExAQEBAQEA/Pz9DQ0M/Pz9HR0dDQ0NEREQ+Pj5DQ0Mt5iyXAAAAJXRSTlMmANQNAyQiHxswCRfIS8NBvhHMhYxtsayTRiuJdp9XpDxaULhc1kjPGwAAAu5JREFUaN7M1cmS4jAQRdFHavY8gDHGjF3//41NrWiilLJU9qLPmuDaSmUYuygya3NrtFaA0trYvM3kLkpEQIrcwMPkQq4PyNYiwAq5KiCswgJlxa8DrUYUE0og4e95WiQHhEYSkyUFpEUyK+MDQoGRfk7gHz9dHhWQBr9m5HIg01hBZ0sBobCKEuGAwFpKhAICGxB8QGALKuMCmcJGBX9AKmxES2/AYDPWF8ixofZnQGBT4h1gBrDNGN4BiyX1YX9rOqKuue0PNZbkn4EMYae+og9Nf0JY9hEwCHkciai4zNfaAa5+zON37nhFiPk30CKgHIiKvsSH8ly8EqfwnN8BDdZ0Jqpmhx/cXBH1E1j6HWjBqgei3sHLvdrDfeEVEH6BZ0FNCVbZUFGGp4Dgjl07ujgEuBt11+BFQmgHnh2NCJtG6srQLiCwxHVBeywaqeLmoOQrwI94GuiCCBcaJn7M4JdsT41DBNdQDz/7HZDwKz2Hy/2STuwZgb1DA/WItKcje0bgPjRfVDlEcgU9uHsEbssGOiDaTEdu1yC5cy0mRHMFN4UdMu5Yz0gwcgPL0MKrohIJntTASyCHT00VkhRUw6eFhc+BRiS5MHfCwjAjOCDJTGcmoOFzpCuSfNENPgYKPg3dkaSmP/DR7MwcktyZW6HgR4Q0jrr/K/C3WTNKQRgGgmg1oQlN8KPgRxUEzf3vqCD+yXR182gv0EDa7s7Mm35XhL9k/DPFfzR8VODDDh/X+MKhVya+9HHZ0kd4XYXwktJx8UtHWvxq+d46yfc4cAbEb6EGZaHyqgm8O03guo291WNbtI19CBtrMeLNYcTtUcL54ogS4DDEHuecPHEOH0gdii1Sq/Nc/4jU+FCQjzXFwHDClkGgFQdq+R6Oj0Q4zsf7AuA4ns8iFhoS0ZiLBnXbo8bXCQWFpZpWa9zLAusSf0PuqSty997TGPZYe7AWN8rkq56ErGshce/lmc8hUyg5pXf9J+VcgrX+8wRytCpX/RrehwAAAABJRU5ErkJggg==\"\n        ],\n        \"btn_radio_on_disabled_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAA8FBMVEUAAAAzteUzMzP///////89PT3////9/f3///8zteVAQEA+Pj5JSUkzteUzteU9PT0zteU7Ozs1NTU9PT1ZWVkzteUzteUaGho9PT09PT06Ojo9PT09PT0zteUzteUuLi4zteUzteU9PT09PT08PDw9PT0zteU+Pj5NTU1CQkJXV1cfHx8zteUXFxczteUzteUzteUzteU9PT1gYGAzteUzteU9PT1nZ2czteUzteUzteUtLS0UFBQhISEgICAjIyMlJSUsLCx3d3fBwcEzteUzteUnJycbGxs9PT2UlJSrq6tpaWk+Pj4kJCQfHx9HR0fv4rWhAAAAUHRSTlMAZoABBE0JDAZgKi4FFxMNNjWAPyQeXFJJF4BIIQRHeCkkEzsxDw0JgIB+ZDtWTjBSSUZ7VUNDIEwjCGVZSUdFQj0cEUAtbl9FFhOAeWBKbUEUQ9MAAAT3SURBVGje7VnneqJAFI1hZxMBC2Kj2HUtaOwlmr6mJ7vv/zY7FdAFFDT77Q/On0SBc+aWuXO5noQIESJEiH+JH5XkdDCIRCLRwWCarPw4KjmXmWYjW8iuM9yR6OPdaMQR0W78CPSxYcQDxdihq7foF8lyPM5Bf8Vj5eTCkjgkGoUkc0axsty8tCwX2bU+F3j5A0IxyBQc5S8n5PpFQCMqJLbZivst5SwxIhOEv0+efWQOSOhCTc4DkJclQW8yK/pkFWX//F0SwgJl51/ABmZ8ggaDxCIZjP+RfFBqkDIv6UoDfhAbii4hjZpCrj4GUehj95Akb8gAaHVFhBlKAVWUugYliBWZqG8vXWJ+vE9FAS6eF7m/IPIwIDzZjFjBR6TjUZM/AZcvNE3WbxAcQxNqy01TIbp3thZwfmP/VDUwSzBuBkulOgOjBvYS3g/77rik6VIlDyTRoj+nsCRECeSrZqT7e1Z+dO8Urz8PBMxD2L+bgBpMog7y2Ibi/k66QNu3gPyvWfyI/cwE0rAURigOSxSG4l71GRlQQfkjA4nRnyP6tzkvSJLAz9+QxDmTqAEZVxb03D4HxAKVZvSPAGYi4cf0c+H+Jpe7usrlbu6FOZKgCuIM8Mzy4p4GxFAAAGhQfkj/wN/2Pn+Px+/v4/Hvz94t/wAlqAK8M8Ge3G3CmhkgA56DwPw/03e51fh93Om0Wp0O/GeVu0v/xAochABqzITuzj0QpXtSASOR8b+lrz87406rraqplKq2W/DD53X6jSmIGqjSzRD12gssVFkOG6Bb6/+1gmtXU6cUKRXasfpl2cBjEziyOG9MaWFsAM00IH2zgqsn9EwCWrG6SZsm5HEUurt9xEVpiHnAM/6Hu+cW47crtJ7vHpiCAHga5uyOMsfcOKIpBBOUz30Q/m2FjxwPk5Um0owF0Hs3l2kuJ4B2Qg2Y367ahH9bob26nVMTTjSAtjNqci696xwtWTqoMwGh99FWTx2gtj96AhOQgGI+7oUizQOB5tD3s9d7AyankwBMWOP+9Yz4SAc8PajWngITuhlrQEECKIWun1T11BGq+nSNEgkJKECiUb7wFEB9zhLHOEE9xOdKyABnE0o5nvooAWRa6SeeAigNUBLlgUgF6r3TlLMA+r5XpwJN8ILSaGeeRiDQXwBYjKWrUw9cSVRABBp9PvqVAhwV8HZRYdtF7th20RK5yH+Q3fkdg+w/Td0FHNPU/0ZzF3DcaP5LRcnVQ/ZSobPH/Rc7w9UAx2IXoFyXXAzwX66tA0fYOHCcBXwdOAxFxyPTcHSQ7cjUzCNzHezQN/4+0Qzboa/bDv2Abctzacv/z/a2ZbRn28Iar6FT42WUbPSGa+Plq3WsbraOxlOpBMlLT8Zm69jw0TpCLJgJAnhpHr35pZ5k7bss2tv31zRp39OvG+27ZGvfY35fQOr7v4BkqQG7ET/gFer/eAn08RrbmAHN/hr7v7yI01FCNvZlowQ2LKqYw5CR1zCkHGRk1CUzGuJVRSbjnComTCi6lLfGOVz3kIHR0G0g9WIOpBaE/0gjNcQt16yRGvfIRmrBh4KTisctwYaCDPEJG2s6H6+XAzbWPHgwm03GttljbKLNMiGgEQtzEj5Eo2X8XbycHDL2yDB+6HAcSrhjGDvG/H39heN9NqV2+IFimuFOjgno+OkApxX9iSVEiBAhQvxD/AFA6Z2m0icYqQAAAABJRU5ErkJggg==\"\n        ],\n        \"btn_radio_on_disabled_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAsVBMVEUAAAAzMzP///////89PT3///////89PT09PT09PT0+Pj49PT09PT1aWlo6OjoaGhogICA9PT09PT09PT04ODhFRUU9PT09PT1NTU09PT0uLi4dHR09PT1jY2NYWFg9PT08PDy6urpDQ0MxMTEmJiZoaGgUFBQYGBgjIyMlJSV3d3eYmJjr6+tfX19CQkJpaWlhYWEoKCgvLy8hISEWFhYrKysuLi5WVlZBQUEnJydHR0eJLZnuAAAAO3RSTlMAgAIFTQkMSSoDLw4WJDVSSCALPoAsOxGAf3hiQwV/RjIRgH1iH1lURUIcFQ54CICAbWdnVz48eHdubc5A5usAAAMCSURBVGje7VjZcuIwEIRkEskHMsY2+MQO933m/v8PWxGfIng3ltlUUqV+g3J1qzUjaWYaAgICAgICAgLfjI4udw0EgAwi651rsys4BAYhVq5Ir3YBABFdVaRGQ1JUnQBFV73W6g3KHqmU+yYBVVEjRCWu4ULClB4HN58QYCqBpdqhNQDkzc1FbGQAo2a4ewh8JWO8TZD9ofiAerWii4AELDurERBAaq31ywX2uwwFDbmGh07GH7PfZ6A/MoUIQs44SAaQnJ/SL8eWRYhljZcnicwEAYMvlzD4QU6/GsvPbU2bTDSt/SyPV/eZicAHzHW+AHoJP139wppNR+/r9Xa7Xr+PpjNrQV0kCj0AnhPXBRzvD+V/aM21w3q76/dtu9/fbdcHbd56yBQwdDkyFEIp52+PXnZ9e+CYzabpDOz+7mXUPinEAlIIKocBvchP1+40MzjUR1FBr25BASSlATjx2wOzWYA5sE8K6SZJqHIUMODUwGI+svPl5ybs0XyRWsCVE8mHXsx/t7K015SfVXjVrNVdrNADv+IhBtRIDIxnh0G6P+wuDQ6zcWKhgaDacdYhSgXkqZPzswrOVE4FItCrhSDOIcq/fPIcp3kRjuM9LalCnEe4YpKqiYFWe2+alwVMc99uJRZUIBVj3EkELM0tF3A1KxHoVIwyAikRiB6HDD+jMHyMEgEJUCUBgDTGZNL8CyYkjTLA/xWQAPi3qJw/36IAEH+QywWYIHOn6Vu5wFshTbv8B61cID5ot/FB478q3NIdYq4K/svuWCZwzC+7EDo1rmu3xEB+XSvg13lwvOHFHPWYB6fWk+ldjDD7ZNZ79D97GHrso1+3bPHO4uB6dcuWhnFWeB0LJobHs8LLuErp6O1d6sN19x5/6cgmUrj5SvG7CQHzlu9GwJTvLUsmRLZaTPke0M8k7gYk+ncDQgB1fmoLxTSBt2coNIE/uY39SiP+00cJ6TBEPh+GyJTeUK4+zvkQVHWCPsY5v2cglY/UgMLonkZqAgICAgICAgLfiz+OHkqDTzvSAwAAAABJRU5ErkJggg==\"\n        ],\n        \"btn_radio_on_focused_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAB11BMVEUAAAAzteUzteU9Pj4zteUzteUzteUztOQzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUMLDgPN0YzteUzteUzteU2kLAbY30zteUgcZAzteU9Pj83gZ0KJS89P0AzteUzteU9Pj89QUM8Q0Y8S1ACgq09P0AzteUzteU9Pj88Q0Y8REY8QkQzteU8QkQzteU7TVQ8SU48S08zteUIRlw9P0AMKjU9Pj8RPk4UR1kXU2kaXnczteUhdpYjfqAmhqovptIxseA7T1Y4dIk9P0A9P0A9QEIzteU9QkQzteU7TlU6WmU5bH48TVQzteUAl8kBkcIBibcFaIkRPEw9Pj8plb08SE0snsg8SU08Q0U6X2w9P0AzteU8RkozteUGUGkZPUoINkc9Pj8ZWG8oUmI7VmKy4O57w9sBksNYtdOOw9QlmL+VwM93ssU9m7qQu8ljipdAZnQbWG4IQFMrSlYRO0saXHU7VmA4dYwzteUmVGQ8Q0YAmcwHnM4Nn88Zo9I5sNhavd9LuNwnqdQjp9MSoNBCs9qi2u2T1Ol/zOZvxuJsw+Ca1+uQ0+mM0ehVu90wrdY0q10GAAAAiHRSTlMAmQTOIRYcEz4uGTUoOCpJHlQmV05RM5VDj0BGO8O2i1oxGYxLgWrDHc2mkm+9lXQp9cF2ZbiLhX96enJFODAM3MnIx6ylmJB8fHdzYFweC7ShmYZvX0s3KCQJ/vv46bGoamdkYFUznoBAJODW1qyU2zv+/Pz7+Pj29fX06N/f2diykT8kENuNq6nwywAABu5JREFUaN7tWWVD21AUHXlpkzaVpKmtRgUodPiKdMBguAwZG7rhtg2Yu/twl9mP3bsJhZZ6y/ap52PSnPOuvXff7bk00kgjjTT+JyQWrdfnM2RkGHw+r1ZJnSk54fBmZpzC9T4ZcUb0rP18Rlic56VnQK/Jz4iCHDJVz5/QV3E0yxLYXyxJc1UnElQqvtcZRBZDjqU2+FWtJcf/LotIevmtIkWrPizFMHP0/mKSRjAXxHRRCsaEAJ5arovRliXDbxa/NRJH7EMzlb2eBoTcnt7Kma4jDcIsZJiBTpyfF0M4LNIXF5WhIJTdKBYlasU00CbFbzCK9HeuYcorhdPVA06Kcg5UTxdewQ+u3RElzIYkFNTwzQWVQH/Zg1Bpeb+TkkjkAiQSytlf7sYSohUyQYFOKL7wRSYJ/N2X8OKLcimJXCplWRKDZaVSuYTKLcJmFHWDAgmBMCQQackFCC8L/EPjCFV8AXqS1CgUKgyFQkOSIDFYgZCnS1AwwAdU3PXVCgsS/FNTinpmKYmUxewqmUOvZxi93iFTYQ1WKqEe9qCCy8deuhhvxenAQSbgv9OACp2weo1KpmeUFlqARcnoZSoNWJHbi9w1oCAktTpOB8FqvML6G1AFLB/TM0raZDSrszDUZqOJVjJYAhvhLEcNgg05kBVf4xK4CAEexgJDboGfVMj0Stqo1uo4nrfbeZ7TadVGWqmXKUjspnJU0IUFaiHQOfHwK8BYJebvHkeFIj9jwfScfarN5WpudrnapuwclrAwgoJzDnm6sYISvmPjEKiCrRkK7BLqyQV+h5I2a7nO9pYmm9Wal2e12ppa2js5rZlWOkAhtwzdgIK7GJ8Jd2EhdzH/ZYQGRH6TWsd3uMbqP7x5/eLRoxev33yoH3N18Dq1SVR4iK4UYwUVfBn7jOvzGzCOLlFyViED/qvZjda3z3Z3f+z9/Ln3Y3f32VtrY/ZVUJApWDlVieb8JvAxawBqTIb5q1GBUyLVyBharZvKti283Pu1f7i+sbOzsX64/2vv5YIte0qnphmZBjupFNVgBT1kR6xaUIo/IggPmqSkpEpvMeP12x483j/4vba1vbK8vLK9tfb7YP/xAxu2wUzrVdhJN1AvFiAyhcVFhxf/hsOGXEZup4TVyJRGLY/5Dw/W11aXl46wvLq2fnD4zZbNa41KmYaV57rRECFuwfYYHoJsJiGFIAKkCjuI62hceLq+sbkC/H6Flc2N9acLjR0cdpKKlFMVkEhCglyPLiCFTQs8VAApJBjQ6bK+2tjZWlkKwsrWzsYrq6sTmwBR+Ix6wEewB0Tf8mgxl4liVIoNUOixAe1j73bWNoE/WGFzbe3dWDs2Qa/AJpSiLuwjON2YqAIc/kUWFphB3yHEjElrb6l//mdzeykE25t/nte32LUmBoeZKkT9WEAbc8fLEfOAqESTood0E011q1s4viFYxo/rmiZ0oo8mUREhHlR9UQVui8VIXEPVElbhsJi5Ntvo9io4KAQrq9ujtjbObHEoWEk/KsQCJJwKUQUgk2uxQAEalLMQAt5lLVmGBAoFflxidfEQBFY+i+5hga/489tRBaCOod1xI6eQpFn8/bxbS8vhBODprbz7fJaQqIOoDH83DGUaVQDOStiIEBKqwJRlb867uRQRN/Oa7VkmEMhFbtiOIMujC2CkIECAQEwXDYe4KBJCXFQLLko8yJEFTgeZgiAnnqaRBSKnaexCmz4ptMgCiRcaJ9Y6MY3KT7aKkUj8I4FbxYx/q0h8s5uPJDAfdrNLYrsuiRDi8Nt1EgfO4q2wObqY+IEDUfYfmaUBR2bdzTBFVhf2yOxL9NCnhUO/7slp/id1AYf+ZMChn2Tbslhyyv+LgW1LgdC2OITFxdN45YuNV1FQ4zU/EpCf80k3XhAoMcw1CD0MbB0/1r8fLRnB5CWj7+s/BraOAwhB66iIo3UEVPlNuITKBgOb308nze+nZJtfgOq4fb+HPM7A9n2izdXS3NziapsQ2nf6qH3vDWjfyYQuIMVuVB7/BSQzLgMA0uSvUFQCl0A6/CXQZDp9CWyoAX5jvJdAAHH75BrrDr7GMhgB19iBHlQqrF8FVvuIxC7iUlAYuodQZYoX8dijBHeRM+ooQSGOEhIehhgs4jBkHKGCipBhSOnxMMQiDkOSGRdxhCBR7Tka58xSGLPB4xzCnuzACJAfeyBVlQw/QB06UpsbB27PXPBIDUD/o6Gg0j8UTG2s6XOELxe9/z2V9GCWM4gUmZzm9CsFfzQvN2hTGZJLj2fIF/J1FlbY7VmW5vJBWUC+PNXhOEhERD55LnWQfZHG+3b2rP6gYEL/oMj0Oogz/ouF8/qEtGn1eXUW6lwaaaSRRhr/EX8B2K81Wi5jkwYAAAAASUVORK5CYII=\"\n        ],\n        \"btn_radio_on_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAABv1BMVEUAAAA9Pj4zteUzsN4zteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUMLDg9Pj8PN0YgcZAzteUzteUzteU9P0A9Pj89QUM3gp06XGgKJS89P0AbYnw9Pj89P0A8Q0Y8S1ACgq09P0A8Q0Y3haI1l7s8REY8QkQ8SU0BkcMIRlwMKjURPk4XU2kaXXYhdpYjfqAmhqovptIzteU8S1AzteU7UFczsuA4dIk9QkQ8Q0U8SU08TVMAl8kFaIkRPEw9Pj8cY30yseA7UFc7UVk9Pj89P0E9QUI8Rko7VmE5boIBi7mSwtIGUGknU2IINkcPNUMTRVcZWG88REYpk7orm8Qtn8k8SE08REc8SU2y4O57w9slmL8Ch7N3ssWQu8ljipcbWG4IQFMrSlYZPEgRO0sUSFsVSVwcYnwxr946ZnY4dYxYtdNYtNM+m7o9mrlBZ3U/ZXMXPUwdP0sAmcwNn88FnM0Zo9Javd9LuNwnqdQjp9MSoNAInM6i2u2T1OmO0ul/zOZsw+BDtNo8sdg3sNea1+twxuJuxeJVu90wrdau6X5DAAAAfnRSTlMAzgMFIRZIGzMeJz8ZE1gqOS8lQ1VRPTbDyLWBT0sxt8OVHDXNpo29oHQp9cGLHBeFemL83MismJF8d3NgTTAtHhILb1Q5I/7psaiKXE1HrZp+QD0m+ffg29a4p5SBa2djakU0/vz49/X06N/Z2NWypKOLXSwk+/v19N/f1tVUbkKTAAAEvklEQVRo3uyTWVPaYBRAe4UkBJIQIEAAlR3Egqite92trWvVdhyne+syLqMzznRfSNjd9x/c+1HHqdU+BH3oA+dNH87Jvd/lToUKFSpUqFChwp9UIboLyF+3a0f58ND0VNgF4AtPTQ/1YeTWGsReH/PCJbyD9aRxS/qZOlS6/M2TwWR/fzI42ezHSaBuhiRuQd8TBognJpI8RXElKIpvmEj4MHHjKdA/0ATgigV4imMYltUjLMswHMUHYjhGbAALN/IPjwI0fuQpBt1Wo9GMGI1WrDAU/6wRINx3gwKuZz4O3iDRo91sqTWUqLWYsUEST70Q7cE1lf39My7wN1Ac6s0Wg1MUHSbEIYpOg8WMCY4K+MH3EGco0//QBY3k84ke5TaarkFo2oYRksAhkglw9ZRXwP37Sn69sdcgor3bLgklJHs3NkRDr1GPa0pAFN+hHP/AKPhLfovTYaOrJeFNx1ikrS0y1vFGkKppm8NpIYXkFITxlsoINIE3QPy1ThPqxzvbN92yHArJsnuzvXMcEyZnLSkEvDCIAc3+eYBgyS+aaLvQFRlpWV9dmV1YmF1ZXW8ZiXQJdtoklgpPwVWPBa2BUWjiORb3g/4Hnlb5++zW1tH2zs720dbW7De51fMAC7glluNfQR0GNPrfQ7SBYq29xP/W495Y3t7Z3ctk9/ezmb3dne3ln27PW1LotbJUIA54qxoDYWjmGb3Z4CDf/3xucff49DBfUFRVKeQPT493F+eekxkcBjMuaRCmtAZ6wEcGsIi2asHjnts7yRymi6lziunDzMnenNsjVNtEi5XlAj4YrtJ6Qk2lAUy01NW68TmTzSlq6gJVyWUzn360dkm0iYzAN2o7JAxEIXg+wHhE/prdzyupSyj5/ewXOTL+ewQ8pCfaAvUQ5zm9EV9A6hxZOzjIof+vQu7gYG2kU8JXMOo5Pg59mgJDkCAbctq6hfaWpbNcIXWFQu5sqaVd6LY5yY78MKQloJuGZoohG7K/fnE/nU+rVwMq/vv+i9d2siOGegcxnZZAHUxSLP6IaanD/biQVlLXoKQLj90dEo0/Z5aaAL+mQBQ+cCx5AmFMvqsqxesCRUW9K48J5BFYLghPNAV80MCRI60RXobupYrqdQG1mLoXeinUkEPlnoFXp+VKAfrPA22hR6l/8ijUdh4IgE9X9f8EfrVj9ioIA0EQZvURrKyMSPAn8QeNIHYWoghioSGksNDGJpCQ9Hl2c0XIXpITMpWBmxfY425v95spX5FK8hXhj6wuID0y3qbqAnibPvlHUxeAP1pnzUeFmyrkSqMCH3aeqoAnDzt8XFuKJ+bjetDt4AvH39T2qA8sHLYybbYynVPNJ3OqKxNf+s6mcn6HLf0XW/ogtvhW6f59ji1jgS3NwWsqgZfnsv70cPDi6Hjn6Bhug7P1SdOPdQ62IUfHEZFARwR+HwX8JvtdlMNvtNsnKPxyfL+RuZTxPRb4HpfwfQjhu6gwM2gOGBDYQvUKC9UDLBRsAvvCBMI29mj8tLGjAdnMxkJG/Eb0bGDEsSjBmC4aRAnNw5AL0XglhyHL69yuhCF4ibeZxzmHTHKc8/+BFI/UJhfKZE7ySK09oaCWlpaWlpZW+/UFi9DSrrMntOUAAAAASUVORK5CYII=\"\n        ],\n        \"btn_radio_on_pressed_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAkFBMVEVPT08AAAA+Pj5OTk5PT09PT09PT09PT09PT09PT09PT09GRkY+Pj5PT09KSkpPT08+Pj5FRUVAQEBAQEBDQ0M+Pj4+Pj5EREREREQ9PT0+Pj5PT08+Pj4+Pj4/Pz8+Pj4/Pz8/Pz9AQEBBQUFMTEw9PT1DQ0NBQUE9PT0/Pz9KSko+Pj5AQEBCQkJCQkI9PT27eu1wAAAAL3RSTlMmANQnDQMiHwkPGT/RATAVykWLhlrHvkpO9sMcsayQzp+ZeGor7Fdx4aQyuHxeYgwIBCAAAANrSURBVGjezJTJkuIwEESTkiUveGOxjcHsO9M9/v+/G0dMRMt0q4QBH/rdOKCnUmYZg05Iz08CVyk0KOUGie/JQSc6CKSTuDDgJo58XyD9BSwsfPmWwAnwkMB5VRD5Cp1w/cgq4I/vjOIUvMBReArXe0ogAzxNILsLHLyCchjBu9fXJFEXgXTxMq58LPAU3kB5jwQO3sSxC3ygZwOY+/dmQO/nAx4n8NATnlkg0RdKmgSRi95YRAZBgh5JtIAJuLcqgQmgpxi0IMAjhvvxNU+J0vw63g87PxK6NXQ0mdMd+WTUravo0CAxXRJRtj2fhjchbsPpeZsR0fIEG25b4MNCURFlk0LcOWfjtFFYp3C0IFJgOYxDmu9i/CDeZRRODmBR0ZfAt0RbNafEMBI37mr4YATYB5hllBdgmeWUFfYUYN2x05o2MSzcrrQ+WYsE2w7M1rQSsCJWtGZnCP4LJPv+qT7fZsjYHGQj4CM+VLQReIjYUHXgY24E3JKNKY/RgVtOE5hZNAL2hYowLL4t9DY9luUx3U7FfVRhOGLfCFyHRHV/L7G71F9cPsT9rEv2jcB1aErzGJpRWN9BI2jijKbcNxUDBSMV7aH5W9bfOH5Cs6Mlt2uQzApQdmiNU9Y/KPetEVJiUojgcRUatxbiWBsoWx1YcUXy4JsjnlOhf4S1ERKtgXMY8ZHAxIjmrReuGT70HVIamlPGAibOtNV/vnCCix5hQ3uYCODCxIrOOuGa5VNPyYSwgIKJJemP8JYXbFprc4UJF2by1pOmvGDdCu0PTCiYSUmv8ZEXHHWTaY5noFYFy5pHrxqlv0vwr1lzWUEYhoKoSmoUKihYtO1CwdciiP//dwpdBCEhtzecNtl1VUib3JkzA2wR9ZHx3xQ/aPhVgV929HVtRAPn0OoHjmxkvkNvkI1M9dBvb6Khr5ctJ6ls4YVX5R/jgtBLx8/jch0lHXnxG5fvLlu+b6cxIMses1BJE3jMNIFpG/vcr1zCxp7jNlZkxF2GEZejhNc9hBK6FEqgYYgK5ywGnNMJcA4OpFRIranrRoHUWCjIY02/SQyYjUcr+mV3QTi+BuA4hPfpgIKOWOiQiI656KBu/qgRDUt9Wq2Le8sJrH/LWEXkDpYGTIG1B3lxY4NWT0xVennmr/5jh/qP7UfUf77mb6LnjEYeBwAAAABJRU5ErkJggg==\"\n        ],\n        \"btn_rating_star_off_normal_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACRCAMAAAAbxMEvAAAAw1BMVEUAAAAAAAAAAAAAAAAAAACioqI9PT0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACPj49paWkAAAAAAAAAAAAAAACfn5+Kioo5OTkAAAAAAACysrKsrKyhoaGbm5sjIyMAAAAAAAAAAAClpaWTk5OGhoZDQ0MAAAAAAAAAAAC2traYmJhycnIAAAB/f397e3tjY2MyMjKDg4Nubm4YGBgAAACwsLBTU1MsLCwPDw+WlpZ2dnYUFBSmpqZaWlpHR0e3t7fVgxBxAAAAQHRSTlMAgGUJTuaZe2oVcFUlBHoQ0rNfQzYr4s2YdRv58eTejjMgBunWy5xbSj3927pHxMGvlMe3iTD2ppGF2LyH66qfatopVQAABLFJREFUeNrt22dz2kAQgOF7gUiI3jHFNGO6jY17bCf7/39VpNgEGEoQ0VmaiZ7vaG72Vrurk1ChUCgUCoVCodB/KXplqUApUMuqACkBSRUc0Rq2ugqMItxCQQVFNANTIKUCoghncg0RFQzpGrSkEZws6sCtiMwCc6PFISciTSAQtSgF9+IYQFEFwBDm4qhAJqp8lwUe5bczKCnfFeFGPuQgrvzm3PMV+fQSgDu/7NzzSzOIKZ8VYCFL72D6nNZZYCJ/GL6n9VpKO3K+N7TEMqVXaW0pH6XgWdbdwZXyUcyp0uvOoab80zOhKRuefZ3THsCQTXNfh5ACVGVT069StF2EVqWoo3wyhoH8FpBSlICWbPFvcKxDW7bd+DY4xmAm21qQUH5wJqF32aENXeWD5SS05dWnqSgJC9nl3Zf2sWob2259aR9lMGS3a1/axxAuZbcmZNLqi3WBhmxZPaBpaWj1erfTGcdisULkk8nKQPbpsyYe+WRf56rTSdXrbtca7ZacFZgc9nYhez2xz2qVsXHqmBZjxWoc4+drUw7oP71xBHOYOuJsZcUwfubz82q12vr2aSKuvS9/a19nkc8/GcbGWqN/P33iZ95ZQUM0uvhWqc6cjU0e0zK5k6+QA+I9ddSK8qJf1VlP9MixgqdH0WwORI4sACOgfS46TX4cvR7HGNt30ef8Fkj21NFSGeBadJmC2znXSgA3osclkCm77R9DwNCSSHkgYSnXroCXqXjtmwEUouoEDyZQFW+17oFRWp2knvC8aucAs6ROFY14nEh3QK2rTpeOYet7VX3OgHhWrZyaSK+ebRextPpHVtyjbbvbqj4n6iWx9T3ZLkt98n3b+pvb5fu2zTa2y/dtW26XpzomcNfQe3e537bnirj1eANkHpS3VkXy0m3vai+3S4NyBmiJK89AMa00yUbgh9v8qaWUPlFouy3PJaVR6YQIDZVGQ8iJGw29rz6igMtSZEBZaVOGgfsnjKTSJum+Dj2CmVaapE14FJcMjWfEKTDErWsYKU1GpzxeX2h8F5OAC3GtreMLldX7Mfdm2t6fFWEm7lW0fVUUh4qc4E3TO88svMkpbjQ12NLagVEgGmzkUGPN5XOHGiwaGmwPmOybU2+Bl71LGmhpsKn9jXXOh8GeKrVYL9b6y3TlDKh14k6Q+i6Kta4yfYktGVXpIrZ8c0+xtpTHLGjvCc/yqavuBOn+++5jzrHy2Bjye8JTWJa99NWeIE01fKAyhOnu8JTUSjexM0gTDVOaCY294VnpjZZB0jyldcE4GJ7DQZpD0fMUej0YnpXejkyqeJ5Ekc0Uam2FZztI/fUk8rp7pDdS6HG+Hp69QTLON7pHSlsK9dtr4TkUJBaTtVG/6HEKzdZfnpDM/i2mYxN4XiZ3y+N/6iSXB4yTBbbEMeHPFtYabgMyHjeyptimz4B57AFUOYGtuvymyPL8WOhigK2wfeHDyX02/ZhjH5SXs9CTNK6x1crKDSuCLX/h1K2Rtzm9eME2cl1NOhls+SkMPR3O7rFFrFP2O8aHhJc3mSN+ammzkjgy3i4oXlans4aAqTzTSST/tfBbV/GA/PssFAqFQqFQKBQKfa1fDsPNndmUkFoAAAAASUVORK5CYII=\"\n        ],\n        \"btn_rating_star_off_pressed_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACRCAMAAAAbxMEvAAABAlBMVEUAAAAzteUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUebIgzteUpkbgJIis7OzszteUzteUzteUzteVoaGgzteUEDhIzteUto84USFwzteUzteUgdJMGFhwzteUzteUmJiYFCgsrm8QzteUzteWXl5eJiYkysuEkgaMzteUzteWlpaUWT2QRPU4MKjYzteUzteUxrtwaX3kOMj+goKCGhoYnjbOtra2cnJyBgYEXFxeysrIyMjIvqdaioqJsbGyPj497e3tjY2M/Pz+SkpJDQ0MiepsYVGt0dHReXl4ZWG8TQ1WoqKhPT0+3t7doGm77AAAAVXRSTlMAgIAFCg4SGCY2MmYVQxwfIz+AToCAmFZ1XSqzboBKgIBHO4CAYlKPgYAuctrNgIB7aemAgIB5WoCAgOPKgPPfxYj5lIDmttLBr5vVnICAu6yAgO2jRlOc3AAACadJREFUeNrtnNd62kAQhbOzqiB6qMb0Djbghnu3k7jFKXr/VwmLnSy7KyFLMiIX/i9yh7/JnGkaDXz64IMPPnAPlhRVVRUJf/ofwLKqhRKlVCkR0lR59TZJaqjUzCFCrlnSYys2CStatY8ouVZIlT6tDmyEJohlnIiuziJs6GHEsxdZnUVyKIxE9hLqiuJI0rLIinFI/rQKcLSKrJnEVyEaVvQcsqG6CtEkLY/sKK5ANGxEkD2tWOAukgphZE9OD9hFooPKiCEbtIskjXVQHSqrdZGSQPN0OwB1NoqigboIx9kUOwSAxj6aox9soim1EZpjCIQDNE8pyFqEY2zTSAN8BVi/ZhpIIcByLYdynIM6pxmAbTRPxPgUFFgt8RH01RwAdBgX5ePBaCYWxc8AcGmaGS6KRgFlvpjzPwFuTZO4qLGJ5kgFlfk4PmFqNABsmVPaXC0q9gIKa5mdO34A3JmEY4DdwMNaDOnNdYAzcwYAnAQd1mJIPwJcmS98B6isIKyVBJ/zx+YLv0jmBxvWYpXuAoD5lwxAMvBqLfWKaI4ngG/mX74ApNE8CeXT0jEifEgfmf+4ADgJbk6jg4cY0jZh3Q8tXTNZ37MMaRrW+8GVIrEIlV/aGCUDUA+0FGF2lj4AeDDn2QA4ZB70l12KlBo/mQ1MBgAoL3twxC9IkiTL8Sw3eFyYLA/cEDIOKfL0k/gFHzZIsqwYhqpGo7G4Rij0QqGQnmJm6W0yeLAM+FI0qU0/1ysUtCnxWDSqqoahKPLUxDebohjRuNbTa4lItZRqZSf5ZnjKuNjP5UaIL0I3JoWWIoZcLlcch6c085NsK1WqRhI1PVSIR1VFxnixMbIR1UKJaisf7o+QI0NahJhStI0cGfXH+WwpoRdixtRZdvvdqKZHWuEceis7AOcmzxbA+iZ6I3vhbLVWiFmtuLEc01PhEXLBdQfg1BS4AnhEbhhnE5rBWyQZvVQOuSMJkDFFzgF2kEuatSjrJCmaGCO37AJ8MUVOAeAauWSvFJfxvD0Rl+6hk5DIHZmKXNPS5LllTyKHXHNAJyGWezLsuydFV6Vyb4zckybDPYVvH+6J/O0yOJpCrqFtQ+SZtA/3jHsyHUrd88S0DbF9eKCq0scI9zSY2VVoH13kFjo8OSl2/XnGMPnKQWXKDkDbtGMNYLcy5Sn5yuPnGYuspAMv1pqIp/y5ntyu7KTTabCHFiGxfdgz/ZuHlUoyeUKt4x5SpFCfsSVZ2V2HN/DdtOcY3kK6cnDCrQFfxnY0RwUELjIzfq+98nVjyv2puZCzjSnna688Z2a0QWD3mlndzgyqsR2c0M58Wzve+HJzc2O+N1s3N4ONjdu1uysgMCullPoiWW5esXWAzpkZBFt3ADBk8t6weJD4TAIoAIuIPXzTqyl0e8BZNDCXzU0G6DMcu3IzIki0aMNcLmcXgj1oEsfi1pnQbQBZ9C6TAVB7uBCimlHKpB4+m8vjHADWTyybK0HR+4hln2R/5sZcEmsk37vW4wcBq1WrZg6d5YT2DUmvQ2HKbc29y5biWcRT7wBZtbw/A/KHtzeFOb9ABKMzo9hgTxogDqn+OQawmrmLuoLZl/BhseUfAsDV0RLC50ScPGoqdr4r2dyGKffm+3F0RfppWbSH3osIFomB9N18L74ADR/RP+ItUBMJdNMk/99HtksiV6eOBIqsPTSOehMksP+TDof+OGqTmayLBMK6im3WH1oK2ci2Zvplg8rFkg8Z2PbgLl7ds5LNf7ZdfiPNYohEsgWFs4dbOhQtZNsGn/3/rE2yy0KuUUmT8eI9tN5EIo/rpEhe+pLryUKufiQmOd4p9bLIRra2t0Hy9NlOrqa+6MiQhnZphGyK5IZnucpW4dNT8JsuW2MkkASGRLbnS0+964eFXKMUDR8HJFXPI5HyLpHNpUVrdnIVEzEJv/3grZBCIps/XI+2W2T0sZIr7+5GFcuxiKVsAL/dCWaztU5pNHz8yHYC8OB2eH6ykCvCXBX7kG3bbe8/AmgslMunbA0Al5N/G+Czd7lE2cL8XrFtuuOW1ywXYbLLrWy1PXGv6FazNOufmOTrJX2f2wS7bvoX3I444vlVvrg7KtNNsCPijpjugHygMol24OX5esDt9Zua1wgS96G7nh5B6LsY9j21/6uBawAw3fMAUOd2HJ4xqsxwTcq0e46592eTmPesj024feixl/kMYH1f3JP5v8zZp2803XEFMHyfGx4lwXX6jNftVIW9u3qfpK8AnC8QZuFM1BAT33/SN8i5og33bWifXy5usP4TX9ZzDo2VrsQIVwP7BnvwHkdFRoQr07cLdhoN8s/3S/ti7f8QDEezXJkeWEbIA0w52Jw9S16d2RZr/8d7WAtzSX9p5540CZHrHbB7BnjgEr8mewuh0YKkp+6hT10zJ2XOnBO/angLIcekv++8uueVMnWSkPhc9/AdQmkx6U+/iQ+ldeokLvG7noOIhtDi2ez+grjnxGJ1KzpzjdsE67Lf0aMO8Gzhnm3aNTknHfGhv+M3iBQmhH5ynX5wwe6bRScd8x3fbyWKtri+8WvuoHONcY9AssNH0hXbPcIa9tfIukzf+NJh3SPSPeQK9y1A0ns7E18N1+feehxlRPeIJEkktQdzJzw7/h6GlARXhTZokaPJJcLVpIetf0HU8DcTqSXLKjRoA0DnYBO9gWGDBjepRGX27sTPOL0PADO1ZnPGYRc5QtfJr7r9Bhiyg7WfsngCcDd1+1eY0qi7uXrahSl306I0/eyBn9IohfpcTF+ed2adwjqYJ9VWDllRn+l2u+U3quUa9+WWrxcL1CpG4mpMz1vr9gSEW24LUjL8JNlPmJEeIkuyIVXCWNFK1k7qvn58nd05+DHocGbOI7Jzj4xn++2o3rQJpVkJ6PgxSK5xZWi3juzdQ9eSpZy9SQ32dslPoe4mu2ixewgzJ9WadoXyceg9qMXDNGf3UCf10QJoM3Pf7B0ZU/fMO0mfIGt8tXsl4vifbPUMyeaXLoqOro26NUgOOXg+X7PdxktqKDtCC0kovr61JVKsLtp+YzmeaC5UzMOUT294REYtUgodXkyUig6Hwf5/I8JZLQqe6taijwniZY57pHjL2t0RqpbDuxKbfMsXZG/rGM3ConG1YDBqLdQtXstbvbtz+g8tuCvoc96pFhYHj1gCEvkR96q14MEemr/0ux6jcCvBm+OMpMT1VDP3LzuzNP5cQ78Nkw/nWxG9EFUk7PUXk1L5cHNSqvViHtwjfl8orsWjhoyxn9+UimtazPfPSlGr8Hv8jdX/ntQHH6yCPxAVpRFrKWRlAAAAAElFTkSuQmCC\"\n        ],\n        \"btn_rating_star_on_normal_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACPCAMAAAAiGKLEAAAAz1BMVEUAAAAAAAAAAAAAAAAQO0sdaIMAAAAAAAAAAAAAAAAAAAAAAAAqlb0miK0LJjEAAAAAAAAuo88AAAAAAAAoj7UAAAAAAAAAAAAAAAAtoMsAAAAAAAAsnMYAAAAea4gaX3gONUMHGyIEEBQAAAAAAAAAAAAAAAAAAAAAAAAkgKIcZH8TQlQAAAAysuIwqtglg6YjfZ4heJgSP1ANLjsAAAAAAAAsnsgrmcEmhakfcI4xrdsAAAAAAAAxr94uptIpkrkxr90lhagYVGsVTWEzteVy6FwbAAAARHRSTlMAgDMambN+cUl6EgLZzY92TehiQ9NmUiwF5moW4Qi2rZaKhlgiC149JsaxnCn88snDwJuTLw7j3cu59ToP+OzX9sqno0H7ekIAAATzSURBVHja7dqJWtpAEMDx/XMkGLlvEMsNUsAbW7WtPfb9n6lZJBVNYwluTL5++T3BfjOzM8MGEYvFYrFYLBaLvYuxiJaGURRRYh1AQ0TIEDCbIjJGKFMRGTW4gINjEREqQHc9yIiImMC5zEYnREfAdylTcC8ioQ4fpFQhMg9FBIwNKElbPiK9qAKXUjmDsgjfYQE+yTUgKUK3gCv56BYiMNEmcCYffYvCzbeApdxIQUKErAIfpaMKNREuVdI38o9B6GXtlHRkytop6a2ybooQrQynpJ/K+lqE6B7mclsOJiJEbcjKbUswvojQJKEvn5uHuspm1OLxXBbaIiyqCbXkC/0QW9GJakIv3Ya4Ww9hJl8qQSGkxfH4AE6lSw8WIhQJSEm3GQxFKMpQlW53YISyFVmA/JvLkLai6eMm5FYNadlvO8u9CxDC+DhyxoZbN5TxUdkaG5EYHyZ0pIcBHIngHCfXRomNadFWh7z0koZy0VZJbCySa5bY1zh5ncgU67VazcBTVXop4a1dqw2LxURi59OtEplygR1cSG8/2IFRK94nd1hxXPqptV/pjYucrXoqX9XJ2WbpjZ+ptTwu5X819frmDN30Wa7aarWkbqVWK5vLfUhfXqH880lpVYBBR76HUgqMkfiX5AEeLVj/eXYbeklV0lkZtFYPjOvdhoI6UU4Gq9Pf8TzKkbm+1UF6AIzG7n2xBnRlcGZAYSR21xwCqZYMSBowLd/DnEEwpd26BCa+t9xrdf3PpH7ZAZA5FL4lTdSSqpsac0Ziv5E/AXo3UquPgJkU+znMOFuGLjc9oDwWe2uoQrqVuuRwymdvR219afuqbvtBQ7xNs64rbZ0roGYJx9vSll5GIF0OqwZcdd6Wrq5K14nQo5nhjfO/k1e3yxLaLFTaPn6Ve/qMrfKULl1py++XtjuVroKOdLmb5Gfp36e+StdKaHdSALrfpU9nTrr0W5VV2nyeKO2sYkE4rADn0o8SMBmLwIzgl9+EZUSAkjD3uzxXRIAyfmf/DZgiQCa0pC/5QN+ukpCX/nwILmfOu6I/nUDfG9vge3oMAnwj/gID6Vc3wP853e/z+zob4Lt+GR6kb8F9izk2QPo3D+yPVw2Y77ed1UUg6vvtQ6dQaIoANNdfNPfQgxMRgBNIyX2cBzTxM6/uQq/ErhTQgDWhJD1U8+Rny/cdsEeQ934SU66y3gN2KrSbeg7WKjYT2+3yHZt12eM1vTQHjOnhoqCC9OndmrW69Euv8LRViRzXPT9azQO4+OrSe4XH+dW1DlKvE/jF9770D4PH8DjGQ2zn73Lx2+5Lf/rxMTyuxyR3kPJgCa2+uL/SP/RVeJLiudUQ28z99poQWjWg6w4PmabHi1vq5mXpD4US2KTPqvCYI/E3qwkvPwLcQUFoZcI3+cc3JzweEutK2u5JPc3Tw3o2N6oDJzxerAm2i69P00NzEV1vlVAr5QqPV5Dy2aci0rs2Fp/ePGc4l+t14zq2eWlzBzR3oprThbJ54GB6uFNzN7deAfsw1jjIDHjaMybWzs/Jxp+8/dQ6zpJwad/dC2xmw88SVcZ22ZLyAqZ6a3o5G6wnRdNnRzWxfSjpreoKnA+wDS3/6a4Y6yNBTWufVmojsQ+rjqKzVw+xtRf77+NDbAda21C58bZrUTd0NiIrYYm3Gi9GIhaLxWKxWCwW+w/9BhJXDgaJOiFiAAAAAElFTkSuQmCC\"\n        ],\n        \"btn_rating_star_on_pressed_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACPCAMAAAAiGKLEAAABF1BMVEUAAAAzteUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUFExkCCgwebIgzteUzteUokLYzteURPU0zteUdZ4ILKDIzteUzteUzteUto84zteUWTmITR1ozteUzteUzteUzteUzteUzteUzteUzteUzteUmiK0sm8UgdJIRPE0IHygGFBouo88KJC4YVm0NMT0oj7UPNkUxrtwtoMslhKcqlLwzteUrm8Qjf6EieZkzteUMLDgvqdYxrt0snscplLsea4gqlr4bYn0ysuEbYXsysuIkgKITQlQwqtgjfZ4heJgyseAlhKgaXXcfcY8aXHUvp9MWT2QZV24zteUFHZYuAAAAXHRSTlMAgIACBQgNGCZTMgs2EGYVHB8SI4CAgF1OgEOaKrOAcks6gEeAgHZuYlhAPS55as2AgICAiOmOgIDTloDmyoB834CAf5KA9+PYttuvgID8xpzyw8CAgK26gO2jqAdlyAAAAAokSURBVHja7NrXetNAEAVg71n1Ysm9xiV2lLiGNEiCUyihhIQAobPv/xxYJmCt1oYIsMwF/7Uv5hvNzoxWTvz337+BUpr4Z1DJTKuqmjalfyEoKimqZnQbxUbX0FRl6TFRUzUaGx7xeRsNK7XckKhka606mfJ0Q5WXFxGVHaNDeMOuu7yIJMdKkrBBeWkRUdtIEtGgq0qJZaCm1iGzDA17KSmS3BaZrZNZxkOjaatO5mgt4aFRWSuQedYNJfYUUadM5tNTsafIrCbJfJ4Vc12LCVpdcopkjU/QFtZCKYq3imi6S4Lu5IAtPkVurCmSMvwR2weQvU8C6rEeNGo3T0jAO/guSVBDjTEgKaWToBpwDeTOuAFSlROxUQyuST8A8OQQaJOgrhNbiqjaCFfQG3YeTlEhE1tZy3xTPPYTxNhhqIpOYmuONN0jQWvAc8bYMyB7QQKKcZ18KdPhejSAPTZ2F3jIlXXfTMRCsTwScA+oMN8RUCNB5RjKWizpt1nglE0AKMVd1mJJPwQes28+gJ9oJ7EMNGr3wmf+iH3zKXzyi+6iAxK79B0AL9mNCpCPvVub/fVQSb9g3x0AOySol154iqhTDpf0U/bDLlCKYU8TFg+xpOeUdd1YeCtSrMGskg6U9f34WpHYhFaDJe07BLbia0XiLn0JvGJBm8A+CRhYSmKRqN0kQTvAMxb0EsDqghdHSiWfLJumomS4JlQCdhnvFfCRv3lIK6Ypy5Lvt69GxyGYim07jqq6biqj+ap9wzCsIrdLt/3Fg3cebkWFnmEY/WpVG8ukXFdVHSdtK6Ys0Vumw7QdN6P1rWa33GoUdb1T2EiODdfrnjcgQRdZYMQ4Yisijzyvvj5Mjm0UOrpebLTK3Z5lVDOumlZkSn8WjKw4rmb0WnohWR+QX3owbUJcK2qTXzqpDwt6o2tVU449J1dUUlzNKutJj9zWNnDFwvaA3FtyS4Nkp9WsptIypWI4KauYPCERnOWA10xw6C+OUQw7Pc2Rafg+tV/0SDR5oMJEV8A2iWij6ZqUi8ftDUlUNeCAiZ4AOCMRDRoZhQbjKXskqjsAGIfbiqLStWlEktPzSGQfp5sQ7wCokeiKP65KqdIfkuh2/OV+psn4iOxRWZW+3+8WSXTH3NjgvAcuSXTDvsItpRHd48eGOD6ia90MYv82LDpudxXHxzGJgF+e6K+e2Flp4l3+xse1sW3gLptnBdj3f3Qvf+NhaeIOEYkLr6RtkLDV0la+vbZdq9Uw3wGbZw/z7dRq42Dz+VnR9exJCRl1LpZ8u5bDLVyz+Y5wG7W1y1LoGnCytjcfcSuOYLcy8XnlxvXm2MFr9lOn/o+uVm58qUw8hqB2xl3d+lVtN/kJ7rtbebFytHkwGo3Y37Y3Gp1vbj5fmUQXulIqqnTyyLzgE8sCuVMWh70KgAfcuXdmvEiUcgBiiMiPJzz0mpOipimdCBGds0UbHSJ8+7/el2d+RznOAthki3W6y8XDvVUqhjcjomu2SM8gxOOXEJ3e+HBWawDes8W5ApB7N2+4Ulv4enrfP/2VEVuQFQBZoVP768c3ktqaNcyxu5jSHlUA7Atbrj79lk3ljE7CtnIAjtjfd+6Xc/tC2POrwaVa6YsDtpSFv6T+bUcQ2o9v3UpLiSkpbSXFkb8P4PDpAsqnJG4ePZV7f6Uz/1dy0ea3jD/3tZ2rbWoaCMJzl0JTSitpCgm11qat9g0wgrZaR0tLLSpQCii+jP//d+hl1PWydxkv23H84PPBT8Is+zx7u7e7udORkE9DZY8QELIIYSqE9HFl9jziSD7YHrBoo6Mo5Y9WR9tC0LU9ZQjtANsjLCrtdRnCiwerou10JsqfkCEUwR4ZmYLtM6aO/3uL1dCl6It4G3d0vStr3W3uM4RQ0Daj0TY/E3RNGEauWlDYA5f8XltBW4sT8//xQEPXuA5XerVF2c0O00Tb2ZxE11BB1/2Kk8f2YGljhCL/D47T0XWro6uzieSMkVm362OG8B5oS0VXg2F090pYPhhW3lEJiU0EbbfzVLlreK6Qj28X0NxBKySPYTQi2uYpctcHhnHQQ/JJ2iit+icM4VwUSddmVwvIXTI8sx1Va92pKGnj/IspYS2GceLbcPpQaNvlfGlaPA8VyavnwOlDoq1lmvtPOS9T6QLacLRFww0jDDh/RaAL0VaMMzYwjPq3cc4eosPZhLZSsI/7iqacyf1G31mzKEP6+7FOsHHSfxLrEfdIo/yC1MxqoE4whr5HDD0gygzaj418b9Pc4mtSQrXTzqlxP7QGI18DwCwGzamJWwOvYdpigiW0OaDHkXbPoynvu/JluqvqoVR0OJn0mzldqR+a7q5/BesX0CdLhzVpCPICJppmGHE+Qe3xVCj0Y5l+9DUNrjlv4b0retC3Emuhq8SaqIwDnx70ZbGuqMHzGZ9dLpISLDnwYV8RBnYDfUtMYPZOn2AvqEtFuF18oU2sz6MRgfjn40I30KvJgZ/OoK1cbJfqnVIhS2HKp/OpMGl2rD2sqct7MHKAoF/o3HMkJPL6UDu0WsqBfxKsp5PQWA76u2r3wCU5ctLoWB345OwBEtIH/ZsnkXugPomcdK0PfBARWUJHOOivzsA90EwCJ8mBHxJEBBJCtRlyzy4DgJMu8f11hyQiKD0g098q3NOCrBlz0mlc+odUEZUqsTX3l8g9cGfH/W35v88535ZXUi2ihMqcf/5tofMeuEeFHaSkkZw9ivYaLZGFUt54Du7RIIycdDP/PXvsENIZTPNBQmeQuZB7dE4avNGJqFKi1UIPoHl2ySG4EFC4LZ/+KhvLpJoIlnDlU+jNQPQLL87ZH2BSBnGLk6hBWdq1pHL6Becc2HoWMj1wO3kW8faF8wmlsM5Ix+JulMjmN1GdMTXZeqrxH7PSG84/oaORpOnF5XaUKdRi7jZz6jW2xxFvb5/GVd0zUDXeUBlyfv0kga2Dipt1Nj01b0MemRTrgtTvEINMoKY5erqiI5Yp2HW1k8Lox+NhljU0qIdWZo404mlX3OgZAiu/FXQ0Uop+wTbJoCDmodpjluCen/2tqsZJbPcw5qF6liLqcCdkWvdAwzDJSawx/UAQNaSyZMSfaLDWvjvpPtOAkMwg2SfhoOfCIxbgJAg3BEK6h3JIh/3cHmxBx166aDMdYNuM9uUohhfAGx+onbyRGzMEQusT7fAgtJs2zLoU2/Ruv5PIWDVvYAve4cFsbWR13W8QN+INbeYQ34jAbOlhiTdccvsMgDZzTGHlXTVpxQpiS8ObE3RPlH8QbOaYDV9shUUHzSqKLf1Aye17qtldyZQw2CuI6ajYrGbRM0OJUrL73ljWnw+bA2ne8oFvPcbFXF9vjt4kN/A7vzJcuxuYz+7w1zBe0ctVNqtb8IWKiUkF8WKS7xU73Xp/zymZ6xl/L+Ta7tYd8WER4U0p17adbAEcTIElPg1bwe/4lx7e+o//+Hv4BrTtIsYUPbP9AAAAAElFTkSuQmCC\"\n        ],\n        \"dropdown_background_dark\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEcAAAA2CAMAAACiEHRJAAAAflBMVEVAQEAAAABBQUEAAAAAAAATExMlJSU+Pj5BQUEAAAAAAAA4ODggICAvLy8WFhYAAAAAAAAAAAAAAAAfHx8NDQ0AAAAvLy8kJCQgICAQEBAAAAA3NzcWFhYkJCQXFxcAAAASEhIAAAAjIyMAAAAwMDAjIyMAAAAAAAAAAAAAAACu+DqjAAAAKXRSTlPmCekADkqr4e4qFcCA2KhEYwUShjwb1K5/Nge9pZ2YXUxALSTIrGZVSewvjJ0AAAC8SURBVEjH7da3EsIwEEVRr5AjJig4Z5uk//9BJNFBw+zQMLO339Ns84Lde+abPq6cs6q6rnN0avWOAD10e3zdoEFYB/hcsQQfq2YO3gmjmAXYWByFHAw55JBDDjk/dgw5f/UvcsghhxyUEyQMm3f8nofweinL8oCtCsE5LTS5Gsf+iKxXDbTWETzb9OM+nXHdpjTjwjkgi7TRywnZUkhwjoeKLUXnGOs4iEuZoQPhHQeJFvBZxTk+g+8FPAE5Rz/0d6kkJAAAAABJRU5ErkJggg==\"\n        ],\n        \"editbox_background_focus_yellow\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGoAAAA3CAMAAADT7y+MAAACBFBMVEUAAAD/rgD/rgD/sAD/tgB1TABzSgD/rgD/rgD/rgD/rwCGWAB7TwD/tgD/sAD/rgD/rwD/rgD/rgD/rgD/rgD/rgD/rgD/rgD/rgD/sQD/rwD/rgD/rgD/sQD/sgD/rgD/rgD/sAD/sQD/sAD/rgBxSQD/tQD/rgClbwOvdQD/twD/tQD/sgD/rgBzTQF6TwDRjgDBgwD/rwD/twD/twD/twD5qgD/uAD/vQD/rwCDVQB9UQCLXADJigDblwD/uAD2pwD/ugD/rgCVZg+GWgN0TACtdAKOXgCSYQC2ewDnnQD/uQD/uQD/sAD/rgBrSAB4UAGrdASRYACocQDLigDdlgDVkgDhmQD6qgD///8AAAD//Pj/6cx/Yjb88eR1WS/sx53/9Ob03sT/3q//8+T/+/b/58mDYi92WSv90qL/6s3/2qr/+vT/8uH//v3/+O7/+fH+797/5ML+0Jr5zJX//fr/4Lv/2KjuxJOPZB7/6cqEXBv/7tr+6tP03sP03L7/3q381qn/1qLhrW3XpGapfEB0WCyFYCj/8uP+8OD/5L3sxpn3x47twY3OnWGAYDFzVCWBWRiRYw3/7dj87Nf75cr/47v727f51Kfnu4bIml+zhEZ3VydxUBx8Vhp4VBeJXhSaaA3/3rjz1rTz1bLuzKPty6HPomrAlFu9kFe7ikmjdz0LoYhyAAAAWXRSTlMAETRqtO3tMQ4CNu3rrmZsuQcJFgUPDR4LYkQlIl9ZLwNlW04r6qwc69Gld1RJ/ObMwrawnIqKfXg55+TevaugkIEU/vzm49/ezaaQjT8d+/rr2c/CsLCtkDTYHfEAAAMuSURBVFjD7ZhXW9pQAIYxtk1CK20ISdgoQ1DBUfceVevuHirdiK2CTJGhDFnuvbfd408WRPtg27seqBe8+QHvc3Jxzvd9tL/R96/QLgpoJgtjshGCINLAQBAIm4mxMtHfRSwmgvfwpDAMAQOGpTwKJ5jnZShG4jyIKxFzGOnAYHDESi7Ew0kMjTelUbCKk9dVn118CRjF2fWd5RwVTKVhaJyJXylsfJJT0yK7DBBZS03Oo0ZhZZyLhVCVgqdFihXXXij0Ahih0J5rRVHUIKikSNbpoZg4JGwozN//sbBtn519CYpZ+/aX4EF+YYMQxpmxY2USPFXjwzuub/OfP3o8bvdrILjdHs+HT/M7jvyichUPialYOJ3zWHH41b65vmaafg6MadPa+qZ950BRx4Hw2B9k8rnlD4527baJKYNuoB8YAzqDZsJmD97KyeP2YDEVT9JZc+jfUk/pRntBMjKq06i3Ake3SyV8ZvRqpZEiQW7VknVj3BAxgWXUMG6bD1eXiKVsWl/kI2BOdtWSxWwyjoBWjRhNZutgQa5ARJ6o0qD0m1ffTmr1ul7g6PRmy+C17CwYiano1yOqMWciVAMa7bvBaxlxqhsRlVozkCzVUAJVjHOq4ZQqpUqpUqqUKqVKqf7TKzymnkpGjElPWmKCGAnMgdr4HIgkL92SUnF99b7FtmoYjbnAZva5cEGJMJrZY02k6/6y3+fUG/uBukb6jXq1z+84bSJRFcWtyFn5bp2Z0BiMOnD16qRfzVh2o/1Kjp22RkhQd8+1YN1Qr5r0mldg0Gj00+NDM5bAsqJOADexYl0Y4anKa/MdC1bfe7PWqQaEU2u2+awBx92iCi6fRM8aPqwsK2xeDgbmJoe93jdA8HqHJ+f8QVdzYZlShJ8NFyySoovLaluPHeHFxWfgWAw7jltry4R0OTvz1xpDUHRlRUd7W7VMdgUYMllBW3tHhRKikPjlB5GLuOK80pLcjGJgE1NGbklpnpgrkkdM8RsdG+fD3RKhIIsBcDkTSrphPs7G0PPDI8ZukvOlIpB7oEjKlzeR2J/jIxpdOUkE3MqJkNGVE0VpF4TELNI/AVOh3l08hzvaAAAAAElFTkSuQmCC\"\n        ],\n        \"editbox_background_normal\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGoAAAA3CAMAAADT7y+MAAAA0lBMVEUAAAAAAACzs7Oenp7+/v6xsbGmpqYAAAAAAAAAAAAAAAAAAAD9/f36+vqvr6/+/v6Xl5fw8PBUVFTs7OypqampqamEhIQdHR3c3Nzz8/Pd3d3x8fHu7u7S0tLHx8fa2tqenp6+vr6ampqioqKgoKCBgYGSkpIAAAA3NzdSUlIAAAD39/fr6+v39/f09PTo6Ojb29vX19fk5OTf39+srKycnJympqaSkpKMjIyUlJSPj48sLCxoaGhqamoAAAD///8AAAD8/Pzz8/Pm5ub39/fl5eUurhQ7AAAAP3RSTlMAEX19/nZzGAIGCQ34/nT7avwk+GpiTCvn2tfTy7i1qX53cXBjRkMlJB8V+Ozi39/MzLezgXl4aV5ZSSgjIhntDpQOAAABGklEQVRYw+3Yx27CQBCAYTtskm3ujd5DgPTeszGB93+lHIwi2cvFYofT/C/waS4jzVi7+tk3C8PqR7mwDSc43QWxMPWfhg2DDRt+GjKqj/Tx0m9ufo22afbHmTYYO3++i4KV4YKo/ZixihT6t9HayQ3nrIP2OCyPxc96QU6U8Ui+6qW8RInXS0eB5NxMxRYpVqPtA0mKXLh2AW2p5SRXQDkV6vSEKKDy4yqloCJIIYUUUkghhRRSSNWkvg9HLScKKs8tU8JXUMl/qki8XREFknediMp9dS8VTA/vvETRr7gLYslO/Emrt/CoKz3TkCc7o4xpF/58OmhJw1JrEM851f8Wi1niHhnNTWaLYiYNM/+NYdTCsBpBfqT/AK7giup/9WGpAAAAAElFTkSuQmCC\"\n        ],\n        \"ic_menu_moreoverflow_normal_holo_dark\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgAQMAAADYVuV7AAAABlBMVEUAAAD///+l2Z/dAAAAAnRSTlMAgJsrThgAAAAdSURBVDjLYxhhoP7/kOcgwGjoEB06o0EF44wsAABBWUMn9krmtgAAAABJRU5ErkJggg==\"\n        ],\n        \"menu_panel_holo_dark\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAABCCAMAAACsNf57AAAAw1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsLCwVFRU0NDQgICA1NTUfHx9OTk5DQ0NEREQ8PDwwMDAAAAAsLCw4ODj/AAAqKiogICAiIiIkJCRKSkpMTExHR0dFRUVOTk46OjoxMTEiZHnYAAAAMXRSTlMABA0CJBAIChgTGyAqNlAWSWc8X3aJfI8eLidAMkU5TFtWPW9Ug3nti2Dt29rj4srKKLM+WwAAA8dJREFUaN7t2dlW2zAQBuAsTqLIK06gtmRbjhPC2oUlFFoovP9TdUZGh0SmoaeVwBf5H0D6jmacyOPOq7m0lE47s+p8eHaEHWFHeJPQX0vXQNbX+xvClp0NWbYT1ObDOiNjGdZREI3QBKjdewajHE3ESgfg7rj3ADI2GFwPJehQiCZBCRCA24fPIf8VtQoyEKEMDYICjOrtQ0IpTTCugSQYWJCENWOkEE2CrMEzQG7uGIuEPCNkNV4joEACnJMv9w9a7vX8eC0/G/ml5/OJgwhpeCZcvgi6KBiE4cm3x8drY3ncyMPD15MwHKABS6EIqgzyDEJKz66fni5s5enxjNIQz0GWokGAMyA0ObImQML1UUIJnMM6QSL60Ai9HpxB4rCrC6u5Yk4C59DrQTs0CNAHics82wSPuQn0g0aoyzAm1GVpZpuQpcylZFyXYp2AvUigDJlvm+BnUAqCHblJGI6wE1wv9WPbhNhPPRe7YTRsEhIgFJVtQlUAIWkSsBmJ66RZldsm5FWWOi7Bhnwh9GsCNqPP7RO4jw1ZE/oaAZqxyCPbhCgvoCEbhCEQCHU8IAjbBAEEz6EECEOdkDDPj6PANiGIYt9jySuEMUVC9R6ECgl0rBFGAySkBRcL24SF4EWKhMGoXYSuJLgeEma2CTMkeK4kdJuEmAf2CQGPd4TWEvqKULwPAduxfQ9lKwgt+IH+0L8piPZnbdnQ/LPuaFcWcXRzYTFXR6JxZcFsXNyOz+9utufqn3Nzc368cXHrrBN69fWV5+Xx6e33t3K7NXd/zOlxmfP6+tp7IWiXeC6CcrI3ny4PDvf39z8ZCSx0eLCczvcmZSC4dolfqemCIsBjKWblXm04BIWJwEJSsFfOBDySitDdJNQ/TvBMQDcEi3ICiPl0ulweGMhyOZ3OATApFwF0AjwP9Q+TIsio11qHpVnFo2BWThABCiOZS8CknAURr7KUOeq1Vs2aXl7uiSxFwXMhFrMSGWaC25ezhRA5L2QZiHq51whyxMGgFDHPIxEgAhgGUpYICESU8xjKwOSIo0Hoq1ETnAMgiorneRQJIQIDgWWiKM95VQAAzkANm/qKoM+aoB9S348rDgpwGEgO4byKfT+FPtBnTSt97Ij94DAvTbPM94uiiA0ElvH9LEtTjznYB5uDx1Vz7kjRwDypAIeBZJnc32MooNrcUR8A4zkAAhQ4/GUgMRJYSA6BEwqA+gzaOYNGg0SoWXxICDUYQkI1h1eD+BZ+j1CfZWoFngVKjEV9HML9JaDfsm9TKy2XlqPv1/kNylczeSvTmjMAAAAASUVORK5CYII=\"\n        ],\n        \"menu_panel_holo_light\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAABCCAMAAACsNf57AAAA5FBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADd3d0AAADJycnMzMy6urrs7Ozu7u51dXV8fHwkJCRjY2PQ0NDb29vt7e3s7Oz39/fy8vLv7+8AAADx8fHk5OT/AAD39/f19fXm5ubr6+vo6OjHx8fKysrNzc3Pz8/R0dHT09Pz8/P5+flMDi8tAAAAOnRSTlMAAwkNFwYkEBMgHDsqNlBJGnaJfF+PZycwLUEzPk1HW1ZEb1JkgWCGaP1qY+ff3c6KiVsm+vf09OvngRpQJAAAA7pJREFUaN7t2Wl3mkAUBmBsCJEdY1qWYVUkLtnTVY1ZuqQ1////9F6QAKOx51Qm8YNvPod5zp0ZmLlyKzNhFG47M+PePDvCjrAj/JPQYJi1BHr8/ZpTKNYSirHfMUghoQg0oBh+r8YUjBKCJhTj49gHkGaNweehpFC8SMgB8F98rUHGAkERaAAOj6MbhgQRa4oEMQx0ICNH0IS8BBkgG16oLRkjQ+SFoAkoyADXo2/zu7W5/c88Pd1+HV0jAg05YVIqAgoOeH50Pp8yynx+dz7i+QM0PJdhUhU0YQrOpmOGmZ7BdDTLhkl5GrAGkvh5zDLTL6KEdSimYgJ/GQH2AtZAML+PmebBFLAOsC8oAk5DWgNTYU1QTKxDNhUFoYEEXAiiaRPWBGKbIi4HJDTKBFyLOA2WypqgWjgVsCKrhH0gNGEaFFuVWRNk1VZgKppA2F9FsGSXNcGVrZUEXIyGKNjEjVgTIpfYgmjggiwIjZwAK8HxWRN8B1ZDTmhQBMEkaqSzJuiRSkxhNUESFCL7HmuC58tEEaRVBEMyFVXWNdYETZdVxZSMZUITCLbqvgbBVW0gNKsEfDciQXa9LmtC13NlJOD7kSaIQHBeg+AAQVxNUCwghKwJIRAsZQ1BY0/QdoQdoULY1k35Bq+m7XpBlz9T9+PlsP1McfTH+hNTw8Ng+WPNVY4scqSfDMYMc3OiRzJ1ZMFUDm4Xp4+Dmw1z/0JuBqeXlYMbVybs5cfXq4vTH6vzcym/qDyW8ruUP4t8PLm8yo+vewWBPsTrWpAMO61Wr3d8eHj4vobAY457vVarM0wCTacP8TOKANvS98Ig7nda7TYgQLF5jgHQbrc6/TgIPR+2JE0o7pQG7glYDVo3OAIEVAIcdaQFFQDAUdDVYCXgfjCKOyUQMBmBxzslcR1dC4Mk7g87oKgl8KBhP06CUNMdl+Cdks8IXInQyC/3eKt0It3rhkGQJHH8oYbEcZIEQdj19MjBG2V+uW/khGqLw1QsVXYj39MAATmqIUGAAM3zI1dWLcXMWxw0AQxphwHqQADhRL6v656n1RDP03XfjxwAEKhB2l0AQUGge02CaVsqIpwIGODYND4MHzkIUC3bFOhe04xuO/IGIhTbsogKkJoCjyKWZSsIyGqQC5BA9x0zAyBQQYhaQwjB8QGQCqi+I9V9RUTW/k2bvyZIagk8KG0CSwjIO8Db2INODYjIe/HgWETaKMYifNGHBwAKtvD3CDQ8I1IHSmpL8eMQAjBb9tvUjMqEcejxuL9XNZodPDUZeAAAAABJRU5ErkJggg==\"\n        ],\n        \"popup_bottom_bright\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGcAAABOCAMAAAAKPPg1AAAAjVBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABNTU0BAQEAAAAAAAAAAAAAAABaWloAAAAYGBgAAAAAAAAAAAAAAAAAAAAAAAAaGhpoaGhQUFAeHh5ZWVlaWlr///8AAABqampXV1fx8fGbm5tSUlJgYGBRUVH5+fljY2MLHkH2AAAAJHRSTlMAAwYME1IpDwpBITgvThvHSx0WJDP1RW48Oi0ZPUlm4pBe9LzqzGhUAAACDklEQVRYw+3S3VLbMBCG4YQkwrJsodjGjSwrP6X8lAD3f3nd3dkwTIMSK+aEQe+xNc98kifR3WPxx/jIdHo1u57rXBRKmsXi5vHh6U98Tw+PN4uFkaoQuZ5fz66mU1aSk5zkJCc5yUlOcpKTnOQkJznJ+ZlOBo77QseBkwX2uKXolPQjHS9VJ5YudG8ZO70vRzml79nJwk7dNeCUI5wSnKarTzizeUVOO9Jpyanms1OOaKw0ZoRjjLSNOOfQD+f9CMd7+t3+dyh2Dg/UtuC8XuC8gtO2h+dhhzt2rJR3b/u/l7R/u5PSnnI+Xlwvt5v988vLc1R4YL/Zyv7DtbFzPEjnMEj15XZz+/s2Mjix2Za9gjm5PswJODgIb87sduv1+ldM8P1uZ/DWaE7YQaiCFxJFY63tZeuNKYdmjG9lD+eaQsDrVMh87vAgTZBayQscuVLEaJ5DzvEghvJadCDBIrAGBgasAaUTdQ5MaA4Pel+EUqOUxVbnsphSDSrva3jOscODCMprogrABlYUhNQ5MTgn5DCEixxISMVECCgO1xCDTmAQQyQtwQJsYDkYS1KYCczBEKI3QqlyTgM2OK2dq0DBOyOGlfDV4SSkAIsICERwzIlLY4gloNBCbVAkoIEIKcyEIZaQii9jhZkBEJXFRWfOMwwhxVpMLDDCzDlrVEFjvDpJpVKp79R9fJNg/wAgGweRXaclSwAAAABJRU5ErkJggg==\"\n        ],\n        \"popup_center_bright\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGcAAAALCAMAAABVqWPqAAAAS1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABZWVlEREQODg4AAAAAAAAAAAAAAAD///8AAABbW1vd3d2VlZVSUlKKX/cCAAAAE3RSTlMAUAcDQjkoIRoUDwvvsGdNSTEu3NAXBQAAAEtJREFUOMtjIBWIQAHJ+iAUMzMTNxcnBzubECuLACMjr6iomDAZQFyCh4+Rn4VVkI2dg5OLm4mJGWrLqD2j9ozaQ749+HIwyQCPaQAIoTUzantFuwAAAABJRU5ErkJggg==\"\n        ],\n        \"popup_full_bright\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGcAAABnCAMAAAAqn6zLAAAAq1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApKSk8PDw2NjYuLi4AAAA+Pj44ODgqKio5OTlEREQwMDBhYWE0NDQTExNra2tqamppaWlFRUVqampqamr///9cXFwAAABTU1NWVlbBwcHHx8fLy8u9vb1jY2PT09OioqKZmZkZwWr6AAAALHRSTlMABgoOTSMTTxY9Kx0ZETMvHydIRkA2ODqBn5WJRJqQe3iFgf1qUOrf2pTl5E4lyI0AAAMkSURBVGje7drbctMwEAbghDhO5Pgoy1YBA06bHji0TYEA7/9k7Frd2jOtHEnN9DT6M8MNcr/5Vd9kt5OxXFlm8vIzhY/ZqanbD586xgYk5J1lzCWq0hMzw/SYkaQQAhKrKM5A6rugEYbh0irwAFokjYWUBI04jlcWgeNgAbWv0pSYBBAg8nxulTwHDCiSxtugAkXAKIoisggcBwukMEQIC2nqEIMKEFmWpRaB42ApaTZWiJhOAaOqaymZYaSs6ypFak4QFtLWUQwikgnRNE1pFDgoBJN1ilAeLxMFPRBi4nweZWnNRFNyHgTBwihwkPOyEQwkbBQmmkJYB2+tYyopJUFmIUZKBdHNaeus8NKkON20x8fHRx8tcgQPtBsOjaIip0IPBBysU0SpZKfr77tLh+wuWi7rLFKFdH1mSVenYnL97WR77ZDtycVGSlUIL+6+MumuLV7NoY5gX3fbvzcO+bfdtUzU8BuKl3RxmmuDOo34dLn988MhN9eXX0QjU+3FTTtniU4teAPOLxfnNzhNw+DiVvHQuYKPinLUtQXlY5ySiyorco2Dr0GonCbgj3E4F/U+B99qVgb8vbtzxINGwosw5qjXoFwEj3GC4PZFeCIHX+wxR/DX4pRP4yyMnPoADvOOd7zjHe94xzve8Y53vOOdV+BUB3De1vfGwffgl/C9/mDO889dDjlHeqa52B1z6xxozqd1Dj+31PS5N4f96RDNHFY/Vz5znSufbyTTzZXJGc7Jz9zm5OctZzQn3zv3r6Q4bdefIR8sgufXLRdy39x/uMdgbnsMCQ8O9xij658CIWRAWRgnCGgvE82xDl6bfjuX3EIpSqLbMnGDwDG1aKqgDTDaOlSo35ul3UpLRbCR0H/KukqhzJCZji/oYoAKWgNWRlGLwAgUtZ6jOppCg4UjUl0yg9BmE3eoPTMdX6Aqida08LDJB4NIbLCnpYUwrZ1XmNwoeBIRUEYZyv01emyUfpHer7dNFvbKgoSGwbMzRKjMvpBEmFmIIGUf1NV1+asNMowUsvAfx9w9byTRMUuBAKtgf4cnfHx8fF58ruwz0eY/HRQD4ERyIRoAAAAASUVORK5CYII=\"\n        ],\n        \"popup_top_bright\": [\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGcAAABOCAMAAAAKPPg1AAAAgVBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABNTU0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA2NjYAAAAAAAAAAAA5OTlpaWlYWFgjIyNWVlZFRUX///8AAABqampXV1fx8fFcXFxUVFTHx8e+vr5kZGQwQJg3AAAAIXRSTlMAA1IGChNMIRovKA9BOMcNF0g0JSw+HpUcOkWN9aVcv4I+EWOzAAAB1klEQVRYw+3YUU/CMBQFYJxattGpA1q3qqgIKPz/H+i5vUsmiYV2I8aHe567fDmnfdrkZNYpmSTnalzSmOshiYd64yY9vRWnsHGfGrYipE5hYzab3aYE59nqpBNMrzDxkBLGfkjnGChE5HneIDYmDYLzwFhi6AxDCgw7nU4X8cFpC4ukkxBN6stAAQKjLMtlfHB6QRRJvtIVEqrTMXa6AFEU85QUxXIJynZQqBDXIaYhBUZVta2JTdtWFSySGkAoFHT83TBTzKvWaO2cq+OCk1qbtpoXDM0YCtVhBmWggFBKZXHBSWCQUImhQCG6HVott2AwGEOQIlMzg/kA2ZyWu/6tUF+nRBu9entCHlNCH7ytNBqVXaGQQ3WwGkZbvTzvhuT5ZYXpsBwVIicwm69TGQPmc0gAGVNxIR4uMJulOlq/7g77r/TsD7tXramQDQwHhx517us4d7f5eB+Sj82dc75QjqcdcDCbd3Rdw9kOYLZw6lp7xw/XO+sjp6HZnFIjHKUcDdccOesjh6/HjHYMHHveqVU2wslUfdbpricb5WTdBQUdPDd7McfiwYWci/b5P44a6ShxxBFHHHHEEUccccQRRxxxxBFHHHHEEedv//OFs07PJJhvB2dQcPxwm8wAAAAASUVORK5CYII=\"\n        ],\n        \"progressbar_indeterminate_holo1\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwBAMAAAAybmm2AAAAKlBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteWZdn3rAAAADXRSTlMABRAKFywhOfYnMR3v8BlJngAAAUFJREFUaN7s0D1qAlEUxfE7hBRJNc9ZgZk0IU3GZAXGzsZG0A1o4QIEewsFQURBtLHyoxURXIS9he7F8jRPEN6c7vzaPxwu10RERERERESe4R5ACYExmtgi+oXolvx6ZXGEEgBjLM4c+0L0zEofXmkcoQTAGEtmCftC9NQ+K17lnxeUABhjSa3EvhC9bNWW1yFLUAJgjKTz7/6O5AvR93aqey2LBZQAGCNp7t33jHwh+tTaXa9dsbDo5gBjJL2J+9qQL0Rf2/nmdRm/jW45wBjLwObsC9GvD/9Ve8VAAIyx9K1BvBBd/8r1X6t3DATAGMvQtsQL0fUv/evenh3bAACDMBDcf2tW4CUapLsRKBKwzevNvLz3/seDedlX277qHmr3kHu73dvynJbnyAtbXiiPbnm0vqP1Hfq02KcBAADAwgBwBEHj/3RdFwAAAABJRU5ErkJggg==\"\n        ],\n        \"progressbar_indeterminate_holo2\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwBAMAAAAybmm2AAAALVBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUW/iK7AAAADnRSTlMABQoQITkYLCcz9hTw7fhFXIgAAAF4SURBVGje7dmxSgNBEAbgOUE03e5aWm0C9l7ExtJDlDRpUtgmcgg+QCS1KGqTQkHyAmIjKEF8Ct8iRQrvGcRrdCN7e4ObsBf+rzpuYJYZuGN3lgAAAAAAAADKkAUERdKnmdUCyy0ockdJ1e0kybpHWkTGaoHlliSdUU2Npp0m1fQoFpGxWmC5NSlnNKbd1C4WjbfUn55W5mpec6/spQzcas9i+o72aJzYvcqtxKOWVifJL4HlLq62m0dbdNq3Ot+XO1d9fy62Nw6NF0Hlzqt1RS/pqGN1fCvf7zv+PLxsXhsvgsqdV+uK3tFHZjelm8ynYS2bm+H6c8bArvYxj34W9mtCg8r0q73G6Re/2icaLLxf7dWf56r1a4p+saqdlOrXqDr9qv2/X6PiKPrF6xe+R873iP9X8P/7Zd9PYL/6Z7+K8xDvPITzNvO8PXbMMDw6mJm5BJa7W2aeg3khb16IeTRvHo37Dt59B+7TmPdpAAAAAAAAACV8AcebDMLiSs2oAAAAAElFTkSuQmCC\"\n        ],\n        \"progressbar_indeterminate_holo3\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwCAMAAAD3noS3AAAAM1BMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteXQS9SJAAAAEHRSTlMABQIKDyEsGDkm9TMU8fft+mrRFgAAAchJREFUeNrs0ttuwyAQBNBZLsYY4vL/X1sbq/CKKky16pyHJJZWuyNnQERERERERERERERERP+BaT/mQ2UUgarIA2nXH+t9uj9E7m9jZLq2WRFdiVem7cfGBw3EWrkfxb5ABBCxiogARk3ilWl7TcYHBda56/l6ctO1zYroSrwybT82PmjhQnbWGOtymO/ZHBT5eRc6LEzbajI2KHXQIXsfrIgN/gX52axItmL0JF6aNtRjo4O55kOI0TsR5+M2Xdushq7EK9P2Y+ODMcCnFLNIjmmfrm1WQ1filWn7sfHB5PEp5YhAPMobEpCKKqm+Cy1Wpj23sWO1T/5TLl+1XhuwsV6PHdj01Gtl2jONHat9ikvqtQN7UYX1mlKvjfX68z9MV9pz/2W9EpBYr5Y4qarXsrTn6LEjsV7f7dsxCoAwEATAMlb+/7m2WlgYONjFmRccKCRcdhM+WNe0H34vh2PCcdM17Xm4e1V9sK5pA6/2FhMP1dPuLCasVa1VB9eqHoWKJy54FPKk3TtxwZP2aCBn1QVyVlUgZ8UHcsQJb8QJ32zGCYWhmyfOD0OrcqhyzFU5FNGaJ84voqnRqtGO1WgBAAAAAAD4gwuJzBUuUw2jkAAAAABJRU5ErkJggg==\"\n        ],\n        \"progressbar_indeterminate_holo4\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwBAMAAAAybmm2AAAAMFBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteWkAkYNAAAAD3RSTlMAAwoGDyEsGDkmMxT39O9TQliZAAABzElEQVRo3u3ZP0sCcRgH8MehoCZ/6hvwDzSfNzZlRoOrIubiJAi1hHFEi6O01GJBEbgEBULQH6I3IOLSFjT5ElxFtOvH1XYafPGODvx+lpueh+89cMfvjxARERERES0tpVRYP0IK4dT5woniMecFF84hWliUaZqGEhU1EUrX+cOJ4jUjHFIL51C6iZJ0QjMkmgBgBQHonAyH0niOGU2SkspqSZXOArCCAHTOGNEUnmNGk4zsWpZ1klGpVwuhCyx/OFG8Vo9HchZg5kie49FcXV4K2qHaKEAegYIAdC7HI0dgiXskRd2kLMfVarWWVzsXVUAtbwIFWGfDh86t7Vhp4RytrVjpUvaazebptfl21wRgBf/f+f5p82rRHE6TWxna2qfc2JCxPNj+GOso3muvDWxM15Vjer4y/PqZ14ccBGVeIx3Fe41VdF59V45pZW3wO6+u7KNvdWb7YwREQeb1js7LlWNSWeW85ur9Na++dIIzr47tvcY6PC9Xjkmb88Lmxe9xvh7/Xx7877meANcTXK9i61Xuh7D9EPfb4H4bP89BCwLQuejZeQ7PC2eZf17I82jsPJr3Hdh9B+/TsPs03teC97VERERERERL6hv2rPU7MZ28hgAAAABJRU5ErkJggg==\"\n        ],\n        \"progressbar_indeterminate_holo5\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwCAMAAAD3noS3AAAANlBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteV6AHYNAAAAEXRSTlMABQoQFyw5ITIm9R889PfwHc7yYP0AAAGqSURBVHja7NLbbsQgDARQc12T7KbL//9scfqQSyshdYWFpTmPEbFHMAQAAAAAAAAAAAAAAAAA8An3y/5VwbHMIBu5Tyn1Z5Nw/ka+O+cVHMvMsZH7lFJ/9k+/fLjx8p8PCo5l5tjIfUqpPlsONCHeBC+dizpaCNeWmSOXN3/ucSn7NZEDTVwfF2uUF29fFRzLjLGR+5RSf7YcIKJ3SRdlDc6FtSQFxzJjbOQembK8O7NlORE9OF9wkf8KZw1conOxLTNmzx1mzz0wZb8mcoCIvurNqxCVV1XCRFwN4v2SZjcw5ZY6s6VHf9RrSURpqUoyUa4G5f2SZjcw5cad2UtCvWZ8OBsp/10vJmK1m3sSPatBLTfPX6+BKbfcmb0w6jXjw9lIiXp9t2/HNgDDMAzA/v+6szcDHSIZ5AUCkqGN5aHn4DpSul5Dz8F1pFxcL5/2iR/NHSn9OQ49B9eRcnO9PKsGPlh2pNw8qxoK5Y1bOlJuhkJG2qdzJ4y0FXLO5k4o5KgTphX1OlIu6oTK0LdzB5ShrXLczR2wymER7XDu94toAAAAAAAAAD98BS4GIUUirlsAAAAASUVORK5CYII=\"\n        ],\n        \"progressbar_indeterminate_holo6\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwCAMAAAD3noS3AAAAM1BMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteXQS9SJAAAAEHRSTlMABAoXECA5LAb1JjENTd7cUtpBCwAAAcdJREFUeNrt291ygyAQhuFdQCVgk9z/1ZbGtkfgTH/QVd+HQ2bYb8IeGEEBAAAAAAAAAAAAgL9Q1VgZqvXJ/uOrcjzcWIJbTt4h4LJmcyq6uo8sGl1P5iqfPfgSsMeazSkXqmanIurm0JG1ymcP3iHgsmZ0c3Uqisy+LjgRF/wOglMtlY+nBBfTwXsEDFHUhWYL+aHOO1Xnh57MVT578B4Bg1Odfauc+DTVpCGohiFNPRmrfPbgPQImP2ssazbKyTBW5RRiDCmPm8vJx+hL5aN5BQ+Gg/cImIegjd3KKajcnnW3JJLK5A6ySH4eUX79ZIZ1CPgIIm/NFmq31yQy7fNbjSLj84hK8Ml0e3UI+PDt9ppoL+O7Zz7g/ZftlUUy7fXT4Nl6e/13wPvQbq9MexnfPfMBaa82+7tnPiDt1WZ/98wHXG0vHu2NPzmbD3jnn2OT/d0zH3D9xQSvVW2/tTQfcP21KodCps9czAdcPxTiSPtCwXc40uZCzoWC9wjoVy/kcJ3Q9m098wHnteuEXIa+UPDtL0PzKceVgu/wKYe2SKE9Gax89uBSbLimvGhlfNPNxyc93LCffLHVkgAAAAAAAAAAALiGdyuD+5ssDOz3AAAAAElFTkSuQmCC\"\n        ],\n        \"progressbar_indeterminate_holo7\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwBAMAAAAybmm2AAAAMFBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteWkAkYNAAAAD3RSTlMABQIKEBcsOSEm9jMd+vBmaXrxAAABc0lEQVRo3u2Zv0rDUBjFPzNEShZN4p7aJ4j6AkF9AFG3Dp0Et2wdfAFBBwe3OgtOydpdB1/A1UdwFy7xZvLDofY09HJpzm9qPw4/woGE+0cIIYQQQgghpLfsa9RgZTKRAIjjdnHq0in7c7iribPADmAAh0/21oWlMkkONXkW2EE38p0twIHbg8StS3cSy9GJ5jge2gEM4PDJ3rqwVC6nl5qLg5EdwAAOn+ytC0sVMr7VvOWJGuDgDtw+Gjt16dT9ubxfaZ6K1A5gAIdP9tYFpa5f5W6qmRfpbNqR+dke4MDt6cypS3dy8yhfjeb7YVA1HTF19AnEYfugcusyk9/Uy9++JmH3p6mjZo2UYeXWZepwvX2V2/rfRvX1zL7+xZQL+qoj7/uKKrcuo1If7Avri+/jEn3x++XV975P6wmuVxevV7kfwvZD3G9j+22e52DnOTwvhFIFz6OhVM77Duy+g/dpUCrjfS12X0sIIYQQQgghfeUH+E4C2CXdn30AAAAASUVORK5CYII=\"\n        ],\n        \"progressbar_indeterminate_holo8\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl4AAAAwBAMAAAAybmm2AAAAMFBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteWkAkYNAAAAD3RSTlMABQMQFwksOSEy9h4L8O0G0W7OAAABgElEQVRo3u3ZsU7CUBQG4GMHlc0WuzG0TdxcDJCY6GJgKwuSvoFhwIWtcXZpZWGT8ABGpg4Y4kr0PXgMw2Jd1Jv0NjbXHG5K+L/xkvzDP9B7zyEAAAAAAICd5WU5RGR4HBy1IPV00pTz2wiRa0o88kwWlmO4Zo5ypRfniEYssgOJRW7Aonu0ZwfsRLph68kRjXSpV5csvVqdxaXlvuWdlyu9OEc00qRGW9L0em0WreuTRt55udKLc0QjLfKjrFHHfH+NOLwsa37ETqSf+npyRh3ru5E5LfqSuXnRZ3F7Vl3knZcrvThHNHJDcZh1d2+eP4YcJlfHcchOpFdjPTmikQmtUskzPaQ8xpV0g8aHiaacp59GPmmV9+sg5TE8SDdouJ9oypnRAH0p5Kz/7GtG0+3oq5JoyvmgKfpCX+hrK/rC/33WGt/Hf94ncF9Vu6/iPaT2HsJ7W+29jXmO2jwH80K1eSHm0WrzaOw71PYd2Kep7dOwr1Xb1wIAAAAAAOyqL3DZCqyBVRiEAAAAAElFTkSuQmCC\"\n        ],\n        \"rate_star_big_half_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGgAAABoCAMAAAAqwkWTAAABEVBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAA+Pj4AAAAAAAAAAAAQPEwAAABoaGgAAAAAAAAAAAAAAAAAAAAGDRAAAAAAAAAAAAAAAAAdZ4IAAAAmh6sAAAAAAAChoaEqlLwjfZ4SQFJDQ0MAAAAAAAAAAAAAAAAwqtctocwhdZQ4ODgAAAAxsOCmpqafn58qlr6Xl5eJiYl3d3cKJC4hISEAAAAAAAAAAAAytOOysrKjo6MtoMormcKUlJSQkJCPj4+FhYVycnIfbYpeXl4OM0IxMTEMLDgGFhwxrtwsnMYpkrknjLGMjIx/f38YVWsAAAAuo8+bm5sieZofcI5vb28bYnsbXneqqqqnp6cea4gzteW3t7cki/zoAAAAWXRSTlMAgDIGGk5+mmF7N5lws1oWaGU8hXdTEguzD8x0beXYw5ycRCsmIvHmvZcd+eri29rMvY6NVklA/vnn5d3X09HJuraslZSSiPbh19DPw6cO6d7Aubivre/stqtpT24AAAQ9SURBVGje7ZnnUttAFEZ1ZEtxi7txsMEEHHoNoYReQ4AQ0ov8/g8SSTizlhCoLpnM+Pxnzvjq7nfvLsqQIUP+BSPlrvIklMmOKE9ADmgo8knVMUkr0qnCGWQU2aTa0AEWFMmo8M44foKvVIaW8RP0UUUq01AzjN4kTClSKcKcKVqGekqRyK0OM6aoNw+qIpEteGlYokOoKBIpwJ4t6tWkHtpXVm/fib6BpkhjAyb6oiXISmuHpg7v70Ry2yFnt0Jf9EFi4JXh6k5kAUgaSyUrFYToFLYUKWzC7wHRZxhTpNCG3QFR742kYTFtHaJB0bGko9SACYdoSU6yprIwI0QW5yBh8VIhbzhFR1BMXpSBa5foLejNpD2jOmy7RNagzSXoEPHjFh1IiKEKXDlENskvKSN2/AiRqF01Viunbbpqn00tA989RKtQ0LSc2idt49cfaVWtalqxUtHxZPeeyI4hT8YqFU2bMs0pd7w0yvjQMrxEq8LkTaGoDsiaOKnlbX686NNqXW4bDpFgaW3t+HmfZzZut+rMMfLfX8y1Wnuzs9uGHz0/lsbH19ZuTLNVxsHypTKIyDTii0Sv0C4pitv0NWHRIVAYcXd0EfiYqOi18DhMGpCfTU50CpRHH7g0crGXkGj8HNh4YC6qOnAdTyTa4LElaboNnCQgOgKy3cemTgV4ORtX9M1qA0dbe7dErRNLtGMd08xj0So+1EQM0T4mWoD1KF3wLZ/f6dFzwaZR0a98j3S1nW6lwAuCDnyJINrHcXoCli+/G1wkypZVww3zDUw6PqIYZRPkssBcMJEoWyPCMl4as8sXVHQsyhaWVAOTlUCiHVG2KKhZWA8kmhSHNBKlAswEEYGuxr2IfwoiegOxduNRuAhUutOY94oq/Agk2o95r8j4d534SLfxHn+2/UTiThbz9hVMdBDrPluE64Cit5BNxbnxLwaNoGfwKsaDYz5wqN6AFuOVaSKASLyjxHiq/RR8TJxHfoNaEInqZNF7vEZ+3Z/yHnydPPOHHqJlKEcO1Mt7mpkTLOaX75tqEYO16RWonQsgi8lRYsHavX8xe39yt4WqlurZeELh0ICW07OyDhSmrYeUDCYfXOEQscHrruG6ODe4VOfsH7XjMM1HavA0nA169t71f06fkYr9o+I3eNV5Jftyf2ur6q4ftRxp+hUHZ97lGdDuulcX+0cdOKZf+AQfSO7FCXt3b3r8bN3RfpMREnxBJPeV1Wz1rvc+Vh48UzcRPlL1b/7MvsSkePvQzNrSgfPVvx+pEuETdSxPC5PCIwXpn6nnvyKO2bb9P6kVqwn0KZ8/VttA7fBuzKZDb47rxsxXTDIl/5m/aQft595zyIWe4h/tXqurwY633RSTa6CF7oWanTjNwKtZHZtM2HXBIhOm4E1NtxsnnEgDKtNhH8cbhA7waluLsqWVtsYyypAhQ/57/gB4BXFFXDX4xQAAAABJRU5ErkJggg==\"\n        ],\n        \"rate_star_big_off_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGgAAABoCAMAAAAqwkWTAAAAyVBMVEUAAAAAAAA8PDwAAAAAAAAAAAAAAABoaGhBQUEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACJiYkAAAAAAAAAAAA1NTUJCQkAAAAAAAAAAAChoaGPj48kJCQAAAAAAAAAAACmpqajo6Ofn5+WlpaUlJR1dXUVFRUAAACrq6uampqYmJhwcHBgYGAAAAAAAAAAAAC0tLSxsbF/f394eHgAAAAAAACMjIyFhYV9fX1tbW0sLCwAAAAAAACioqIAAACvr69YWFhUVFS3t7eP8DjqAAAAQnRSTlMAgJkyeRpOs5x+BQNzDmEWOsxaaAmVg29TLuTSjkQlHurn4tjXvIg18d3aua5kPhH7+MS+ZijPycK2klZJ5mz1qadtR87CAAAEB0lEQVRo3u2ZiVbaQBSG5wshhbCGTdZKVVQExIXW3bbz/g/VTMSGJUgWxp6ew/cA5Myd//73/oPYs2fPv2Ba/S4+g1wVcyo+gTOgKfRjm7ikhXbKUIei0E0uD8fAodBMCx7l4BNuqQqOPIdsQWjlEE6llBnoCa1U4Nb90BGYttBIIQvn0qUOKaGRS8hIRQdmQh9K20Pp0dDatF+Vtt8YgSW08QQ38o2+TjkoKfyUcwyNcigrKbzzQ6PhVeFE/gXQNJZKyhV8xnAptPAMD9JnCAdCB6qJ2nKBro5h4TeRz0BTKzXhXnrobaWaqfx0iTpoWLxSYMhl7qAidk4RfshlriFbE4od249cJQNnQqHHfnw6Gmxopuxnjd0vKVNoyHUyUE5kAmmPVmrOs1WEsVznGA4sq5yak/bYpg/3dy8tqzKbZQmkLQPoEsjrbGJZPffL9qq9NKts4U4GcdzlY/KVVG5BuyzTMDzGX+Y4zpHcRN9xRl/mZAzFKcu0ln0M93dvHWf48nIlE9N/aTvOjftl4GDxzuwiau/YNUNVu5IQq18ayd3SWf2Owq4Av+UuuVXfma73jgUY3+SuuPoFVAsb7IzTodwN7TrwZG9Ic1n8WZCMC/hoSTrMozad5NwB5kfTtzABMokvarQmt2BJNI5lEr6pNi1uHR+pLGrdic9JA7ByYivpg0TlU92TDTfga5X45Wsbyt1KoRcEVb7buGXzuydk+Yy2jMgAMKPFM/tJle8ketleSyIiZ2bE8p3g0rRj5K5o5RvNyxYDu4nLRbgm9csWh5QJXRkGZQaWnSC25lVWCQFkW0mDeF+GoAuFRBlCBfEwjKGcMEOMw2q7mCh9hVJd8lxRU+lrO8kz2Rlkwu9wlUQvqB0ZjuskbwG2CdcyJAZ8TfBWYsiw3CR4R3mOsvj3wczFf2Xqy9DUY79BHW5y1OAANYj9ut+DQVCaNDCCtHgE1diGup4ozx9QGAFZ8zSmsdaCDPX4FDCDw/M4pjm04NdqV3rHseyU6U/55ObQBGcli3SBAyWtaZH1hHMdT+C51YfAqwEL87ps+otzMoGnob6UsB+BvO8ypYl3qOQCLy+n9HtcmrXFI19mVw51FGv6VRZn3lFdHWce4VYO1VmafnacK7p+vx3vOE/+cVYO9eJPv+gOfug794kSm9kK3seqiz11A70YVzTwgyKVwqaT99ShHi/eL2kS44q8KOageuejgF0q4vKlr2oco5Py3n9SF0oE2Z69xUPyQKPzNmbTkTfHrjwf4VIsbbfFZ1zqQ/kQ2e6+w+97fBFsI+2JIuOAFVkLDVysWth2UJ6kKEZdFxSTdJRqW1mI/OeVBcyiNt+0qWotInGZt77GyVO914nYs2fPf88fm/2TZoiTETIAAAAASUVORK5CYII=\"\n        ],\n        \"rate_star_big_on_holo_light\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGgAAABoCAMAAAAqwkWTAAAAvVBMVEUAAAAAAAAAAAAAAAARPEwdZ4ISQFIAAAAAAAAtoMsAAAAAAAAAAAAAAAAmia0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqlLwONEICCQwupNAsncYnjbMjfZ4hdZMKJC0AAAAqlr4GFRoAAAAAAAAvqtcebYobX3kAAAAAAAAAAAAysuErmcIpkrklhakfcY8AAAAMLDgAAAAxr94xrtwieZkYVWwQOUkkgqQAAAAzteXrvX7WAAAAPnRSTlMAgBkzmbOcfAXmA2FzTc14Og9uVC1pWiUUfmXYlYPq4tLDvY5E24g1C/G3rlA+CPve18u6HZJJ+PbAqJjHIJaA4UwAAAP2SURBVGje7dkHduIwEAZg/YaAwdh0FkyvIfSEtE2Z+x9rPQ5ZAzbgpuzb9/gOgKPRzEijiKurq3+hXq2In5CtIl0XP+AWQFnIp+ZhUYR0BaAFaEK2bA5oAngUklWAJ9r+wC5VAYPugEZRSPUJTIgoBYyEVDVgQERdIK8KiYoN4I4sLSAhJFoCKWI9wBTycG5vyNaWWrS/OLe/zABdSFMG+vSlIzMdpg3glXbeJaZDgVPhmyGx4VWBe/oLgKTuoHBXcMyBpZDiGZiRYwOUhAxcRBnaM3QOCxlF5NhKKiWniOSW0irN/fRAC5Bw8UoASTr0AdRE7DTAoEOvQGMlWMwnER1LAbeCyWk/jp6ENmRy+3GJ/5JSB9rklgIKkZqAYqskdp51DZiTWxMo6XohsaPYpuI863eXul4zzTQ8ZcjDEJ6qpqnrI+vL6nF7KVdxwQN5aQ5xXq6WyO4dnTjUTtrmNzsPRpdO6RjG9mYnlWQT7DvsHgsA1u8ODGOTyawpsk4mYxh968sASvs1rWoAPihuY45dXYjjL20pXj3nOw61BuCN4vTb/R2WtfcpQ3FZv3GaF0+0M0w2FI9uC0BZPTHNcakacaXBuUvSZw5804nuAUC+cu7UMQGkIm/UjNNAOd9OdW4MTYoiw2WqTS/eDXij+hResw1Az4qLlFKk8HH1pP0d8Kta+PBlktzdFN8XBA7fbwruvu2qnkvhC9UmBhy2YOOZWrbDJy9sjlsO3yBI2OAKm5TwbV1hCxY+jP0dqXbY6iIkLt4h+cHNYKFGuDfmeFbxAWhUog7iHfJhGHFEL/Ig7sccKEScIeZ+c1uLNn15Z13cc8WUpy9PMc9kt0DK/x2uFukFtUf+vADp0HWkpoEX8ikJ/IrwVpIkv/oR3lGeg1we+B0lG/6VqUO+tUK/QT2e6qjrU8frSIQy8j74mu9498rFLlAN3VDdE+XdDOy9Sy6TkI116tVQmxMAee/heR6yOVTcg9mrvRxdTeSdUz56cyi7/urxEEDpk48PDe4J5yVcgmfzR4frevC1nL07ZioTQ4IrQIv2bJ4A5JwuUzftRUVP8AIwO7q7o7zaX/LyeFFdQAvVuccHEykv55BiL6p3cPqpgbdor3Ov+/ZyXKOVa1GpEB380enc98PTE6lSheXD6eCjEFs0cAZF1IqnVj7iRT2NvzfJDLFFze/5GqVzAalrsNx0OMZAOmgl5YBXojEnQXqkXughOQDt3tcxqwS+OQ7pbguLVr88jD7D0trQTeB29wt468MzCc4kRcoA9MC50IZlsfJbDoU8bFrQ6wLTggR8qjeAwP+8WgAwgxZffcGxFoEsc4swtzRlVNLE1dXVf+8PiLJs5G2Z9ooAAAAASUVORK5CYII=\"\n        ],\n        \"scrubber_control_disabled_holo\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAPFBMVEUAAACIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIg4st+Ci486sd5LqMtwlaJJqc0zteWzIZSAAAAAE3RSTlMATUg+Ihs3AywVCEUP4FHVmWCf15i9tgAAAYlJREFUaN7t2Itu6yAMBmD/NhBuabuT93/XI03TOm0qJXasdVK+B4iFTQyYTqfT6S/pIScRBlgk5dDpSDUkxjecQqVDLDHhgRQX++cDY4CDMURgPMGB9IpgghRtdjImZVWeqmCaVEV6GDvw7jRF7BQV33eMEAHXCAUq03WoDBWuNGURKMlCMzLUslMB7oo5QfYkBZiEpwtgmPBiWoB9CUuDUVssPcLeMRLMEg1UHKDqS2wvcwJ8c8Q4ANNDHYfoviUAgrpRX27XbbveLhjL2hq/rdu79U1bZcHIZd0+rOM1CD3SMHLbPv3DSFPu0us9wKrcpxjavsCQewD3FLkX2X2buv9ov9cqIg4R3du194HjfmS6H/ru1xbvi5f71dH98ut+ffd/gPg/ocYEBkLPdRj0V3iIG5IkLzIMIeqqCNydB0bllUZq96Gj39ixN+zQOu1WE6alShphvgEp9YQJ0kkvNjzRItlEwYBEsiuZH2zNXOgYS8ztR2pyXOhItYQsH3IolU6n0+kP+Q9bEx2UrsdzRwAAAABJRU5ErkJggg==\"\n        ],\n        \"scrubber_control_focused_holo\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAllBMVEUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteVtyu1yzO1ryuxexetjx+tTwelvy+1yzO1yzO1xzO1syuxqyuxwzO1wy+1nyOxZw+pNv+hxy+1wy+wzteU1tuVOv+k9ueY4t+ZixutDu+dJvehVwelYwupSwelryuxGvOiB2w4OAAAAJXRSTlMATQYKEQ0XGh02RUkgQSwmMjvw1flze2To3M/j3IyrpYRsX62hrNdO2wAAAttJREFUaN7tWWlz2jAQrZb4Ej6wjc0dIC2+OfL//1xllxl1Wq9AVjQhGV6+BD68xx7aXa1+PPHEE5KA7k8LoMXoCmjxseSM1TCMlyvYv+yLjxJp2Rm1aZqWZXewLPaBybQa6uzQsVt24IQepYSBUi90AtvqNABAmd5k5B75Dx4TMdUkOnrLnVCCgE5cq5MYTm+6zpgIMHbcP1YM4mfO4fS4BHPUAIXOOz4ld4D6nZ+k+U03JHcidE1UAXdPQMndoAHiJpzf8okUfEtCoeWfEElMWoX7+R0iDQdRwH+/sg14/vhkEPx7cgnAMAMyEIFpANx2kEuHClCXO0kQgJAMRngrDAA8AEPDACA2wKYqAtTmJiAGOEQJDjcBifBYTWAsjDM3QM0EXQZwE3ADhDVi9mu5jqbr5XYvrBjMBPwMeARFuqhO54bhfKoWO4LCQ88CE8CLxNuyOtdFWWZZWRZ1XsUzvGAwAekQJ/NjXWaHK7KyPkaJdJhHBuqh/TQvGD1HVuTTBPWRMcJO8Rjxz5zzc4XoDckj5DTDCC1D8ZHzc4VjjBakEUgl6aaqOT9XqKuNVKKCgRXqRV4eelDmK6xoIwJIjJPOgF4TEiTKvQJopX49FYdeFMdXtGbLJNGy9VC/j2KJNAJ4sUkv5k3WL5A1EelFv8AIE5iiAu9TGQHQJ8BjoNVFoCHIymn6U5ym6gctxQ4aUouQUrFSLxXifrNDi52o46iX6/NCslzjDWcW9TacmaDhSLbMtKdlXlLBWCHd9NPon6Z/jlJB0x8wtsziKq+LMmPoxpaFeGwZMnjtVtUpb5r3Jj9V882NwWvY6LjfxuvLZR1vE9nRUf/wy6uF+vhuGZ95AeGZqmIA6L4Ear/G6r6I614laF+G6F7nfP5CSm2lpnspCA+y1hy8mNW8WoaHWo7Lr/cf74FC6onlUR+JdD1z4Q919hV/PdR9hafGG4+lX+e994knvjF+A/DCfuTfcOFvAAAAAElFTkSuQmCC\"\n        ],\n        \"scrubber_control_normal_holo\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAhFBMVEUzteUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteVKvugzteUzteUzteUzteUzteUzteU/uuczteUzteVJvehJvegzteUzteVKvug7uOZHvOhHvOhDu+dDu+czteU5t+Y8ueZAuudFvOclVTOqAAAAJ3RSTlOZAAQJDxgTITo2HSomlX0uijJC6IZuYVFMSbJmgf74kHjvp8/MvLsvv+3mAAADbElEQVRo3syU23aiQBBFz4w0NA2t3AXvmqxE8P//bxqMFip0G4W1Zr8keTmbOlUd/BmZ/0fw945hBJQ9mUwsy7Ib1C/qT7K8J2jCVTJjQjg/CMGY8jQSo8CYrr6bCcf3ZqHLf3DDmec7gqlZyPGC4PztzPFnLs+zdBcEgQSk+rFLs5y7M99h5zl0An08Eyq9WE63eGA7XRbKIZheAU28+njPjZYJekmWkeupMTRFoTffquPnUwktcjqvFVbvEOiLt0UdjyeoFcLuU6Dv8/2woHiTogj9viHQma8+n6cSTyNTroYgg1bQtB/mAX5FkIfNJsyCph43k/glMnP9LgM68j2+wwvsuNdhwEO+8KIVXmIVeeLBgI78BC+SdBjw0E8U4GWC6KEl3NxnnZ/gDRKuNn1zrbi5f+bzFd5ipQz0Hu4EE9txd3iTnevYkzsBLTjM8DZZeLNo3Cwgl3gbmXvtNaBVkM8DDEDA/VZJaBeUYhBSKqktYF4hMQiy8BgJWhc0xUBMW5cEGmCOwZjTCKABVsCAI1y2gBEGoBFIYAnawDAjCIsEzRuIJAZERvVbIIHFZksMynLGrLbAcRMYOXzG8Xodx58HGElchwR1QwVMfO1PVVUqquq0/4KJou7oKjA3dIhP1fH43XA8lqf4YO6IBOYbWmwqlU4cq83CfEdXge3wrT5/XZ7zyVCu9YYtd+yLQK0g1/ezoXwybPQt5WoJjaBZQQYdMfXTbimGjqxewlWQau/nRPltw0l7SykJLBFqd7wvvzsp99oth8K6CrTPbEED3I+w0D41EuiP6KPqE1Qf+jO6CNSVSt2Ky+8eSt2apbrT5wSbfsHmaQE0rPsFa2jQTDC8YPyKtuMsmc40GO1Mx39o4/+rMP+z+1etGeMACEIx1BuQqJPRwUQG739BHYzFEMNHfBE5AAwov+2rv3vsfOKx0wHYc80PHH5k8kPfLlvWfNmSJbx8KLy8VXhJOhr837B08zTN3TLYpaPEb7kBjP8CXL7DBoS3UKAJHOVjcRvLG3E+SuDDED7O4QMpPlLjQ0E+1lQwW3TRfasLAKNlOhyn430aUNCI5XtIdGAu9wxz1QHqAtQ4mj6eEzXWA0vzca/2Nx2gIwzAWtu/gdybfZmQe35pwF1LAy4oDdRce0gVN/5SPYlXTe2cDUmLl89GXuGIAAAAAElFTkSuQmCC\"\n        ],\n        \"scrubber_control_pressed_holo\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAA1VBMVEUzteUAAAAzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteVsyu0zteVuy+0zteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteUzteVdxOszteVpyexuy+1tyuwzteUzteVZw+pNv+huy+1xy+1lx+xgxuszteUzteVryuwzteUzteVSweluy+1uy+0zteUzteUzteUzteU1tuVOv+k8uOZVwuo4t+ZJvehCu+dgxutjx+tEu+dGvOfyQddBAAAAO3RSTlNmAHzex6Jq682mwiLmgYUv7m3hTPX14fmJNNmeY1HSvbCMmI47/e21tI+IeufcnZRyHf4Gn4DVv2BIOFolky4AAARISURBVGje5Zr9e5owEMdvIKiooCKgnS9Tu9p29r3dW0Sttv3//6Stu0BkJQlIfLY9+/5qnnzkcsld7gLvDqz/B1AbaJNSpRIQElQq1qTl1hQCbvrVOnmjerV/owJQ03TCla7VCgL6FSJRpV8AYJZJBpXNPQH9JsmoJuwBcI+Sc1RODdu2TQDTtrvGaJikH7k5AbVJws5VDd5IqybWp+TkAbgeidU2TODINNpsnOdmB2gklmWDULbFxmoZAU6JTd8AqRpWwkxyQC9e3foZZNJZvM/1nhzwPfZ9AzLLiPfEsQxwHERDu5BD3ehvBcdiQC8aWGpBLplW9Md6IoAT2f8D5NaHaB0cASDynyrsoWr08TwA8//3sJfeR/uBB3AT/7/AN7jpAMfj2D/3OnhOKqBETQgFZNE50gDfqJu1igBa1M2/pQCG+NMYCqlL48NbgCk8H3KfGuYbAEaoOhRWHSPg3W+AFoLPigPOcKbWbwBcHAsUyEJnSQK+IrahAtDAub4mABi/dVAiHTOFXUANobYagI2z1XYA+FVtUKQ22nsH0M60B85nF/7trX8xe8i0F9oMcEM3B4h0OX9ahY8/Fa6e5lcgEt20NzGgL1/iT/42fF6uFz+1Xj6H24tP8mXux4CqNAxMO6vNekGoFuvNqnMuDQzVGIC7WxPM/zFc4vQRYhl+FBA0PHcQEDlpU2CfDpufEToCKzXRUSlggBsDuPJXbH5GWF0AV7hxBxSAH3TK95/ths3PCM9bvi+dotEpwJCkEifhmqRoHfqSBMOgAEscyqb4ASmf8MRd5zEezhRwJHaiL6slSdVyNRO70RECaCy45i4xWijNRp+Bo2uMCRTgYQgCjjqPi3TA4vEEOMIA6VEADgeePr4QHqADPOEICgjwqDscoIlrcDgT6ehFh1vkIQagw7npSJwSXRXYaAWPirnsqCh22G3kh93Bj+usAechd8ApY8DJHDKv0kLmVB4yk0HfyBf0p9LEiAV9kF/OHvxtuInSlk249YVpC173AAEsNQWhLk9eE6+Xl9fE6+QShGLJaSJ1nIBY05k/v72d+7NzEGtCU0cG6KpNfvFw6+4Aeuz+oe4G0tu9gAzVX0CGiRsOKPwEjboMA7Bb7EgFYIQHQ/o1dgyFNU6/xt55qi7i6PLeHaeUcA8Fdc8rJdDITLpKiiF6SrXFJQp2m0lrtK6gIGWpL0hROYGqklrgpBcFB0WLggZBDXhlzbGasmbjjxRmUY6uqLQsL45bZk7/HBGU18tY3q/nK+/XZeV9RigTqvv8y0uaxxlaLHreFsu4zVosOZtEIw2k0kZ5mkSoRvY2V8NiYxs5GnVBxkadzsYFgzytRqckbzUapWSrsViztIzN0l9W+dUsTXaCdXePdq/pkYzyWns2rLEbIFPz+q5Ay30om37YL/pooCF6NGDXlDx7MNOfPZg19Q83XmemDzf+tacnfy/gB/s76qMkz3F7AAAAAElFTkSuQmCC\"\n        ],\n        \"spinner_76_inner_holo\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOQAAADkCAMAAAC/iXi/AAACYVBMVEUAAABFRUVISEhVVVW9vb1NTU3BwcFSUlKysrK/v79ZWVleXl5KSkqkpKRmZmZjY2O6urqEhISbm5tpaWmSkpJubm53d3fDw8NPT0+2tra4uLi0tLStra2vr6+rq6upqamnp6dbW1tgYGChoaGfn5+dnZ1ra2t0dHSWlpaUlJSPj495eXmNjY2JiYmBgYF9fX17e3uLi4t/f39ycnJwcHCYmJiHh4eoqKiGhoaMjIxdXV2FhYW/v7+enp5WVlaGhoaxsbFdXV1HR0dISEiMjIyEhIS5ubmnp6fBwcG2trZvb29NTU1UVFRISEi0tLSoqKhSUlJwcHC8vLyZmZlwcHBbW1tNTU1OTk65ublSUlJpaWmqqqpUVFRQUFC/v79kZGRTU1NoaGitra1JSUlra2uioqKVlZWXl5dISEheXl67u7tLS0upqamurq7AwMB9fX10dHRdXV24uLigoKBVVVVJSUmQkJCqqqq3t7dwcHCurq6Li4uysrK/v7+KioplZWWEhIS9vb1nZ2dzc3N+fn5WVlaXl5eWlpZ8fHy9vb2Xl5dUVFRISEigoKCXl5ednZ21tbVra2uUlJReXl6+vr5JSUmioqJ7e3tHR0ednZ2RkZGmpqZkZGSZmZm5ubmQkJC+vr6qqqqTk5O0tLS+vr6fn59nZ2d0dHRgYGCMjIxLS0uenp5vb29MTEx1dXV4eHikpKRXV1eysrJ9fX1cXFyEhIRwcHC7u7uqqqpdXV2NjY21tbW9vb2kpKSQkJCMjIxqamrBwcF6enp0dHRTU1N0dHR7e3unp6ednZ1ISEhQUFB885iiAAAAy3RSTlMAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIADChkbBQUOCUMyGggyfEQzIhx5XlctFBMSDX17V1I6Mi4mGhkOeXNwXktCLi0dEnt5b29uV1ZUUEsmJSQde3h3c3FxXFtUUkJAQD03NTMrJxZ6enRzc25tbWxsaGhfXl5cW1hYUlFQR0A9Ozo6NzEsJiYhISAYend1dHNwZ2ZjY2NhX1NQRzd6dG5sZ1tHNWVKSrmNY9gAAAqQSURBVHja7NpNSxtBHMfxX22sD/XgrabGlr6MDZsQE0gTYmIImAcaRZqLTWqgwVARpXjwIHoQquBJLHooggdLwZb2UhBK+6o6jrWT/7r2YTK7O5b9vIMv/5l/ZkX4fD6fz+fz+Xw+n8/n8/l8Pp/P5/PWummaKSbOJBKJKv4nhllebW7f++XWLzvZWjwRxQ1npFdPv9zhSCSxuVs7NnBDmasrM7zPNpKa2621cdMUUiyQopFWPT09c9l4GDdGLLUywPxjJLd7QzrTn2cGLkhEsnkWj6G5yGGd1UlFCo2Szhu3sM+GKBXZQ2Vq09BTYS8QGJCPpIaKOmYW9gPMACERKcx90y0zsjoT4NRFDg3N1bS6m616gPur83p9I41kGkfQRaEZEGilfOTQhaweZ9Y4nAk4FclkShq8a83tAGUfud3cT6VMxgAM9qHVjsdr2R0SSRuFnQQ8djgc+EPkl+Zhax3XyB+Vspv2gxTmSvBSbIUGWitnmuVJ/FE+nt282ij09mbD8IxZH/5N5Jd9E3+t/W3zN5G9jTY8cjjMXFMZaLYM/BPjKDtn38iV4IXYyvC1kaepGCSE47sikjZ6c2QL26zQvnLFhLT2rv0gmZ1puGyyzvpsK5smupLI0kEKjTxcZS6yOrvKz+voWrVIGoXNBFyUTg7bRm6bUCKxIyI7ZY7hmlzy/rBN5UwKysQzl43ESAUuKd9nrlbuFaBQuHjZSLlUmWOJVyvrJhRrN3ptjBzBBa2kXeTnCJSLFm0aRzIJOC7NGy2VyTIcEc9YG5lMFQ5bX+SBtLK+DofkG7SRa0zDUYUtnkcr1R9VemRpIzMbhoMip8H7VypX4agabeTOonDOXjB4pTIFh8VHSCNXhGPKQYZWJnNwXGWENxJrcIiZDFork2m44Dhjbezra8MRsS0WSCsXTbgikaGJjFg+yi8kzUxKNCqo7OOKcEAu2Ik3tuCaI9LIVaBcYTForSzDRRXayGxMQ7W90aCl8gCuKpFERw5senTUUrkPl32njcwClDK2WCTJ/GTAZcYEayRmDah0wApJZT0G14Vn+yxKUGhykSeKzOQ6PFC1Rm7koc4yqyOVB/BEyVo5AWVaowS7kPDIhOhTvXtOR6nFAjwyvUESb98+gyLp/lGqDM+skURG1Sg/9feTzE/w0IRI5CZUDZITkZPwUP62aOSOocIybxSZq/BUTSSqG+UTHigy30XgqegsTxSqSgZJK8vw2JroUzXKyX5qy/N/qzFmLZV5dOtpP5WD5yqWyBfokvFOt0ECxhmNPImiOzn9Bnl1lBUVa0d4p8EgAeNE6eqJjdHIA2ihRCMHw+hGuZ+KQQvhDVq5hm4sj5FRzkMTUwrPa2zsnOhMQxMLCs9rbowRnUtarB2bB8FgBfLmxxjR+RTaGO8oZKa6eQmMEU+gjaoIPHdiQNYT2rgEjcyeFwpVyDqgkRqdVuDFILGm5EoyLWhkgUZOQdZSqLMxFIFGohsk8gSSJkPcZekytDIxSOQhJxdiROgbaGWcRr6FnDchQpvnju2lHIeceRqpyeP8UljN5lkijVr9Sp57TyLfQ0okRGjzBXJpapCISi5XQrO907F5HnF5yEjTSC3+utPp7XmdsAAZXx/8FOI0ep1fqD4i1iDj8QNCs+UKhGnkOGQ8JY0voZ1nJPIVZMyTyOfQzmsSOQUZH0jkB2jnI4n8CBnPSaR2P5PAFIl8DRlLJFKrL+YLLx7d7fAeMl5qH3m30zO5yIedHkM74woiH96syLt+5I/27falqTCM4/jvH2hSpq/DbFZaafbgNrYlbAh7U2PrzSKGMDeCYIYgiKCiokNQ0UDxCUFQE0UFU0pQQ8n6s7p3juvedTYdO4+3dT4vfP/luu5zdo7bfx35X5xJGvmPXl0/Xq/Ir1oiX8oWIJy3JPIz1Pj2Mp+In11J5HeosUAiRXwKqcnJRr6FGkckUsTnyZp8/VCjLdt25y/x3gzUEK1Q49cdQrx3PDRyDWp00cgOCOYLjYxBjdc0Urj3roM08g3U8NJI4W6UixUk0gdVPpJI4e4hnytkcmMc6izkN964IdQ/mgFfRb6aRajTluuTdUEosQqiFep0ZPs4wa48gzTyC9RJ3SBmIJR2GhmGSrskcleoQ+n7QBrjUGvhIk/EQ6k4kotQa5VGHkEgn2jkGtR6RyPHIZA4jQxBLdcurRToM3rI4XDkH0kXVDuikQK9sWt1MLyzH+p15CfevSvQvsYdOfwuqdIrXijZhCC2HPkqHG5oMMMLs4S5vvY7iHZo8Usq5AR5B+J2UGvQ4tVdahVCGHRQbmgyQyPHhfjRhCuudVupjvzE2tpaId70JBxUAtp4d3li1qQAo3RNVVbmN8Z90KgtP1GMUSYqs3hkK7R6zRMFGWV2kCQzDM3mLgqFGaU8SJ65CO3e1VLjXljKF5f6eGYIOpjJT7x3714bLDVYSbVDD5skkUnBQmFnJbUFXczwRMkcLNSu2yCpLpLIjMAyCeUgY9DJb6mRG/fDIu4fTifJPIBeurKJ3K1bli1su1NCBqmXOdLIrMISayyQVC5CPymSyETewQLbbFlJpjMMHa2SRmYyANO5p6qctHIQenJNkkRmzgWTudqrqlglVznlgq66aCNzDJMNskZaGYPOlkiiBRefIVZIM/uhN39EGfl8FCZKsDxa+eM9dNehbHwe6YJpYtEqZWUCBliiicxYEiYJSY0cX1adBSZpIzPhgSm2e55VUc4eNwyRjNBGZmwTJtiKPnumrAzBICPKxvv3I6MwXIw1KivXYJglZSMzAoOtN0uNpLITxvH+Jo2yFRhqSGqklQc+GMg/8Zw0Spa8MIyvs7m5oHLKDUO9HitofPBgOgWDhM9Yo7KyJwyDbUaUjczYCAyxHpUaaWV0G4YbjdBGmREr6+usq2suqIyGYBhaSRuZ29NJ6Cx0VscUVMZgipEijcxyADoKsDHySF65DpOMRgojme4R6GZ9p7quSGU0AdNsjikbZYce6GL7oLpajqQLG92CiZITpJFbTkGzcCdLLFbZE4KpUhO5Rhr58OGyR+MU09U5isieMEzmny7eyMwnoVpotl4OLBzlgR+mC8zzRhLJHAYDUCGwPltfzyNp5U83rLDCI2ljQ0NDd98GypRJ79RLaKRcWTcEiyQneCOJlPQel3E6Ped7jY2NPFJRafYlh65s0UZZU1NTb9+oHyX5M+lsoRRZvJKtqpVWLo1skj3q7TvZSOES4cxweu8Jc2XkECyWnL5skHKj5MWL/b6BYNDDgPEwweBAev8p80TSeHnlWQiWc610l47MamlpuXnhsYQVypFXjXJnyPIvDkn888UbaWQLj6SVV0b+9EMUG9OssXTkzVKRysrTDATiXekuGvlIU+SQD2LxL3eTxjIjCyvrO8XZVC61fOm2lhvJdIYhJv9xdwPd1pKRxfd151zEKeYETnp5YxmRpPJ0OADBJfu0Raa3cB0ETg7VRs6KP0TOfzKvbKSR9Mojmx0W+SQW5d047i0dmas8Pc8I9UPbMgQ2Bg57S0XuzQ5krtGSFufyBAf69otF7qcHgp7rOsBC/AErODzM/ngY2Gw2m81ms9lsNpvNZrPZbDabzSauP6UMJdVYd1vZAAAAAElFTkSuQmCC\"\n        ],\n        \"spinner_76_outer_holo\": [\n                null,\n                null,\n                null,\n                \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOQAAADkCAMAAAC/iXi/AAAAsVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+3mHKcAAAAO3RSTlMABgoSH/3yGiQO7CkW9vouMkDkRTfJzjvf0+jESqBcV2Hbt66ldlLXv06yZWmBqZtxu49tl5OLfXqFiHO5Lf0AAAtLSURBVHja7NxrU9NAFMbxZzeRNk1qYmxLWyxQLhYsooKI+v0/mHshOXu8dDTNZXHyO4X3/zmbDcMwoNfr9Xq9Xq/X6/V6vV6v1+v1er2eH7bb7WmWZSn+Zy8KL6cXj8eZxPMnNJhxI6n05fzT4ys8X8KCsIXit5HGwbvLCZ4fYVCjQIEl6nmyPN8GeEaEFAqvLEOdRP1FxuPxu9Nn0imkIhgq/M0mqVFnjlaH8J2QmmCVsIOdmxzrz9hY3Hh945pEW+k2FscVPNImUqbZpbH8NoCnTCJtkkDs3iRVlg4eQniIEqmSNqnnj5ukNVLkwejOu20KGUleyTa5+3alTGpUn+VXr55NlagaI75IsnuTFFk0HujRZq/hDRkp1PhLJuzs2iQVUqW28uTMikj5tfLXh3LHJsdm3MhCfi/Qvaiw48BCwCGyLJtst9/PZ/znHdZImdMMHROBE0mZbiV2iK8/3uZ079BZpcbRwfIGnZJB4FTyREmFu4XHF8sxXyQzGt0G6IyIqJGfV9uIv3f4PWfXThloZzFBR2Sg8UyKxL96czHii3RCR6OP6ET0lEiVdF4FqohOP9kfBHif/X4RoX2BZit/PrCobnLOd2hDjaME7aJGXikV7Ce7OKBd6sCychaiVcJJ5JXYX/yhSKQDa2xStIEaEzeTEuuRHbG7tTQ/RGtEQonu3SNQm22uEmmPhfwaLZGJolfJlylRp+Dzbza5XC5P0AqZGAHvjARqNpkVbdQ4Wuav0QKRWO5jGQUS9ZMf2Fld2plnaBg18kyBRpzmJo8qtXWMJlEjP7ARmhJP2Vm1lbMEzUpcgSXRHPmZ7dE6CtCkYMArE2psymW5R8o8k6gfNSoJhVJjg06Xdo8kz+/QGDnQElYp0LjrXBdSZq4qj9EQoQopkxobdzhfsj2qysZeJEkZqccQaEW6Lgvt5Pk0QhOCAaHGdmRzp9J6QAOk22hXKdCa13l5UovMt6jfYBD+VCnRohO2R22ToG5ByCupsSX3epH209SBlWFoKqkzQsu+qT7uFeo1CEP9oW0GaN1t7piruRKoUxQqJrQ4rGhfMOWN8/kNaiRCzWbaUIEOxPMy0TTmmxD1SUKrXKVEJ7bOGvVnvqrz1mHosLbu1q7RJBqvarx1DFomupIszCZ1o/Wu5kUSic6cUGJe6yoH4ZA1JujQrXkgyS1qIVXi0O0U6FC4nnOTehY5HKpCqgzQqUuWuF6vUAOhEt3MAbolp07hWn2l2F+iC02nzYzQseOyUY3q/FDHIjXb6cMilatii2q0IfYVDJnQgz93e0tbNL5iX26gGg8WCZytmanEfqIh1/kTqb3VaXOqvN77/cH48Ze2YrpmVtjPMGaRnvyt/03Zt9Ffm2jfayd2O+GHYEOVm816c4J9hLEqLEP9uHa0B6dQfb/APmLFdppMD94f1iEVaosI1UW6UI3i02lVropCW/kG1Q1ixXSazATeuNwwX1CdbnM6vTmtQKp3SKaoTMaMHy9JOq+uFFUFMePRaQUeWePidJ8XCPHqtAKvyj7jDlXFHHwiZ0+FGzNXqEjEcarHx0cSWC2eCq0Q1USp7jOl3j2SwL1KtJ3Ga1STpJYJ9eyRBCYL5h7VhKrPjObZIwlIHvmAamxdUerRz3TWGYs8QzUp49m9A3xZMAJVSB7p2b0D3BR5MzPDipcr48Vvd1xvVBnN4hBVBDzSs8sViItFWieoYsAa/fvPMtHMetrlfdU3SKbH10gcPeVZ7ytGZs749ppUzmeuO1QxzEpp6t9rElixyBWqiDOXd69J4AuLPEcVqe+Rjyzy7P+M/Moir2qI9Ob3yuR+NpvSVIvM/I+kRtVbLfJHe3faoyYUhmH4BUnEQCInYPkwKMSFiOKOtvr/f1jPIr6cVlOLLKcNF07Tr3ce3GYcxiseCkamoxHtY1/c/7lkyvK+5f+UXbJIwQee06ho+fnpqmLkooLIoepL/pAiVxVEKviy7iZFbqEMS4pU8AV6JkXuoAxTilTwrdZ2NPq6H9SlgkgFr2d5GOWV7PYdyjA8xr8fngpXcZIMvqiR+KK5JyjDpoV4+Op9j4f3iRsVQxk9PuSDIh/hQe4Xop0+lKH7EuWeKKMviQGl+BLlnkM2cqQGpThSZOsXVvvVXGqcQTmWX0BUu7asvvxafqEblGNgIFHvkcehZUt+cGsop8f6RCGhFHvkiZbMo9SFcnTWyAN5qmIv7C5LXsf/pfpQkvcIpBS7U2pT2scTeekKyrKwkFHqTuktEd3yCmX1iUSpt5T7pSSEsgZEotQbka0caUFpPilwiUI/bDYPh8MSraA8q5Co1vm6PlDY+R3Ks/NC1ui6Cj2+zlkhPe6hLpSn5YHEpYirzOPr8MCJUHobwAccwohCSpnXA4sDopVH+ESfEB6YU+R7IINpIZFK4BMaYYlIkdev4ZRVogF8xHElavyxHW0+pbDxBp+x3YLAdZX44ZbLG7GTwIeI1Bgo8SySsUjMnGnwIbOYSCkwJZneHURnCp/SRSE72C1Q4F6ZTRHL7MPHHD6iSFRiSne6mhZt4HMDFxOZtp8r9fFqKmVaUAGPJyILWhWtqCk7hBtUoScakQ4t6s9oIsvM5xxCJbygIAkSD1p0XTGik7lANWwsZEeSGNAaVzSKTLalBxXx80T6xQQatKQ3X0mV0yNAxVMmOR9aspnNZlKmB5Xx8jM1Z0IrEtY4W6HvUB0dd2TiJBlAC4ztjMExZ32okCklxnHcxksCPROFOGYIlSJSI+VD437MEM/MNKiULTUyQ2jYZCbgmA5UzLkXIgsalWy329l2VrCAqumBGDIXxqEBDfJZ4rY45rYHlTOKQ4b0FoZ9aIwz34olsZNADbwkRiET96Ah5ngrYOUe6qC5uCMNbLLSyNiQ0pY7HWrRS7AxZ0MDrPF8zitxzK0FNTF5olxpQO082oiV4uEngNo4YsncJJxMJibUjNwb54UlU6gR4Y1YyTKHUKt4/rDN3TSokR6EYZwXsoPxoT7amu8ob3keQK0GSWHHXH3vSfq38Xg8L3QymQ01s2O8P94zo9rumP5uzMhbjg2oXR/P1lwURUQDVN2pKhqlLccWNMDARLFjxMQ2VMy8jh9wyrkDjTCxETOrHlOPdrvdeHefErck0BBDVGKhMLGgMuS4Y5ECJo59aIzNE+XKdbReJz2ohPGDFvIh5c7dEBrUi7EQGylSQaYdZdnuTrpbZiY0apDgkML6zrU/XDHKmMeUuOSxDw3Tg2dDpus0TQP7g8T0LBqz36a89qBxmssqBRwy5WJLgxJ0b38+i8i8Ebdc6NCGIS6JQwqn1DXgL1mTy5nL5EwhgZbY4fMhT9ya2PA2I9kcj0eeiOcrTnk0oTWaizvikKd75X6fBtbgnasbTVghj5Qr8y33A2jT8MmQeaOQBo7Zgxdsy598v1Ci8enputsF0DI7jqIXQzKL/YKLYuI4+V9xsul/PC+YnG4ULeSRLzOvKnyWeBitXwwpMoUfzHdmw12ZR+TxwhOfnK9ZoMYnM3X3yZB7VolTvo7EKeUlxZQnZT5HDEYoDcnJOy54IycaNxiJjTilaLwq8yliRnNeRGImRgrPlpSnPCdqnKlIJ0/OVjxZMXLzZEnm1ynPE3XOVDQgT0/X95Y8/jKlmomM7q/xsVVekpOXlCrlJS+xqomMNpwUh1zIlfKSL6fcEOV+3f9X/SCliY8p31/yLlLhuf/P9GH8a+O7S6bqXbPhNd1JTrxRvk/KjRgprFX6jbf3aCaJ3llSVC4SS7UnxXfpph+mIvP1kj/WrmpX5i7BtvwkerLkJg1dp/+vDvj6T687juN5Dn/Tpdw1nDudTqfT6XQ6nU6n0+l0Op1Op9Mp+AmSZeem89KYswAAAABJRU5ErkJggg==\"\n        ]\n};\n    var imageCache = {\n        actionbar_ic_back_white:null,\n        btn_check_off_disabled_focused_holo_light:null,\n        btn_check_off_disabled_holo_light:null,\n        btn_check_off_focused_holo_light:null,\n        btn_check_off_holo_light:null,\n        btn_check_off_pressed_holo_light:null,\n        btn_check_on_disabled_focused_holo_light:null,\n        btn_check_on_disabled_holo_light:null,\n        btn_check_on_focused_holo_light:null,\n        btn_check_on_holo_light:null,\n        btn_check_on_pressed_holo_light:null,\n        btn_default_disabled_focused_holo_light:null,\n        btn_default_disabled_holo_light:null,\n        btn_default_focused_holo_light:null,\n        btn_default_normal_holo_light:null,\n        btn_default_pressed_holo_light:null,\n        btn_radio_off_disabled_focused_holo_light:null,\n        btn_radio_off_disabled_holo_light:null,\n        btn_radio_off_focused_holo_light:null,\n        btn_radio_off_holo_light:null,\n        btn_radio_off_pressed_holo_light:null,\n        btn_radio_on_disabled_focused_holo_light:null,\n        btn_radio_on_disabled_holo_light:null,\n        btn_radio_on_focused_holo_light:null,\n        btn_radio_on_holo_light:null,\n        btn_radio_on_pressed_holo_light:null,\n        btn_rating_star_off_normal_holo_light:null,\n        btn_rating_star_off_pressed_holo_light:null,\n        btn_rating_star_on_normal_holo_light:null,\n        btn_rating_star_on_pressed_holo_light:null,\n        dropdown_background_dark:null,\n        editbox_background_focus_yellow:null,\n        editbox_background_normal:null,\n        ic_menu_moreoverflow_normal_holo_dark:null,\n        menu_panel_holo_dark:null,\n        menu_panel_holo_light:null,\n        popup_bottom_bright:null,\n        popup_center_bright:null,\n        popup_full_bright:null,\n        popup_top_bright:null,\n        progressbar_indeterminate_holo1:null,\n        progressbar_indeterminate_holo2:null,\n        progressbar_indeterminate_holo3:null,\n        progressbar_indeterminate_holo4:null,\n        progressbar_indeterminate_holo5:null,\n        progressbar_indeterminate_holo6:null,\n        progressbar_indeterminate_holo7:null,\n        progressbar_indeterminate_holo8:null,\n        rate_star_big_half_holo_light:null,\n        rate_star_big_off_holo_light:null,\n        rate_star_big_on_holo_light:null,\n        scrubber_control_disabled_holo:null,\n        scrubber_control_focused_holo:null,\n        scrubber_control_normal_holo:null,\n        scrubber_control_pressed_holo:null,\n        spinner_76_inner_holo:null,\n        spinner_76_outer_holo:null\n    };\n\n    function findRatioImage(array:string[]):NetImage {\n        if(array[window.devicePixelRatio]) return new NetImage(array[window.devicePixelRatio], window.devicePixelRatio);\n        for(let i=array.length; i>=0; i--){\n            if(array[i]){\n                return new NetImage(array[i], i);\n            }\n        }\n        throw Error('Not find radio image. May something error in build.')\n    }\n    export class image_base64{\n        static get actionbar_ic_back_white(){\n            return imageCache.actionbar_ic_back_white || (imageCache.actionbar_ic_back_white=findRatioImage(data.actionbar_ic_back_white));\n        }\n        static get btn_check_off_disabled_focused_holo_light(){\n            return imageCache.btn_check_off_disabled_focused_holo_light || (imageCache.btn_check_off_disabled_focused_holo_light=findRatioImage(data.btn_check_off_disabled_focused_holo_light));\n        }\n        static get btn_check_off_disabled_holo_light(){\n            return imageCache.btn_check_off_disabled_holo_light || (imageCache.btn_check_off_disabled_holo_light=findRatioImage(data.btn_check_off_disabled_holo_light));\n        }\n        static get btn_check_off_focused_holo_light(){\n            return imageCache.btn_check_off_focused_holo_light || (imageCache.btn_check_off_focused_holo_light=findRatioImage(data.btn_check_off_focused_holo_light));\n        }\n        static get btn_check_off_holo_light(){\n            return imageCache.btn_check_off_holo_light || (imageCache.btn_check_off_holo_light=findRatioImage(data.btn_check_off_holo_light));\n        }\n        static get btn_check_off_pressed_holo_light(){\n            return imageCache.btn_check_off_pressed_holo_light || (imageCache.btn_check_off_pressed_holo_light=findRatioImage(data.btn_check_off_pressed_holo_light));\n        }\n        static get btn_check_on_disabled_focused_holo_light(){\n            return imageCache.btn_check_on_disabled_focused_holo_light || (imageCache.btn_check_on_disabled_focused_holo_light=findRatioImage(data.btn_check_on_disabled_focused_holo_light));\n        }\n        static get btn_check_on_disabled_holo_light(){\n            return imageCache.btn_check_on_disabled_holo_light || (imageCache.btn_check_on_disabled_holo_light=findRatioImage(data.btn_check_on_disabled_holo_light));\n        }\n        static get btn_check_on_focused_holo_light(){\n            return imageCache.btn_check_on_focused_holo_light || (imageCache.btn_check_on_focused_holo_light=findRatioImage(data.btn_check_on_focused_holo_light));\n        }\n        static get btn_check_on_holo_light(){\n            return imageCache.btn_check_on_holo_light || (imageCache.btn_check_on_holo_light=findRatioImage(data.btn_check_on_holo_light));\n        }\n        static get btn_check_on_pressed_holo_light(){\n            return imageCache.btn_check_on_pressed_holo_light || (imageCache.btn_check_on_pressed_holo_light=findRatioImage(data.btn_check_on_pressed_holo_light));\n        }\n        static get btn_default_disabled_focused_holo_light(){\n            return imageCache.btn_default_disabled_focused_holo_light || (imageCache.btn_default_disabled_focused_holo_light=findRatioImage(data.btn_default_disabled_focused_holo_light));\n        }\n        static get btn_default_disabled_holo_light(){\n            return imageCache.btn_default_disabled_holo_light || (imageCache.btn_default_disabled_holo_light=findRatioImage(data.btn_default_disabled_holo_light));\n        }\n        static get btn_default_focused_holo_light(){\n            return imageCache.btn_default_focused_holo_light || (imageCache.btn_default_focused_holo_light=findRatioImage(data.btn_default_focused_holo_light));\n        }\n        static get btn_default_normal_holo_light(){\n            return imageCache.btn_default_normal_holo_light || (imageCache.btn_default_normal_holo_light=findRatioImage(data.btn_default_normal_holo_light));\n        }\n        static get btn_default_pressed_holo_light(){\n            return imageCache.btn_default_pressed_holo_light || (imageCache.btn_default_pressed_holo_light=findRatioImage(data.btn_default_pressed_holo_light));\n        }\n        static get btn_radio_off_disabled_focused_holo_light(){\n            return imageCache.btn_radio_off_disabled_focused_holo_light || (imageCache.btn_radio_off_disabled_focused_holo_light=findRatioImage(data.btn_radio_off_disabled_focused_holo_light));\n        }\n        static get btn_radio_off_disabled_holo_light(){\n            return imageCache.btn_radio_off_disabled_holo_light || (imageCache.btn_radio_off_disabled_holo_light=findRatioImage(data.btn_radio_off_disabled_holo_light));\n        }\n        static get btn_radio_off_focused_holo_light(){\n            return imageCache.btn_radio_off_focused_holo_light || (imageCache.btn_radio_off_focused_holo_light=findRatioImage(data.btn_radio_off_focused_holo_light));\n        }\n        static get btn_radio_off_holo_light(){\n            return imageCache.btn_radio_off_holo_light || (imageCache.btn_radio_off_holo_light=findRatioImage(data.btn_radio_off_holo_light));\n        }\n        static get btn_radio_off_pressed_holo_light(){\n            return imageCache.btn_radio_off_pressed_holo_light || (imageCache.btn_radio_off_pressed_holo_light=findRatioImage(data.btn_radio_off_pressed_holo_light));\n        }\n        static get btn_radio_on_disabled_focused_holo_light(){\n            return imageCache.btn_radio_on_disabled_focused_holo_light || (imageCache.btn_radio_on_disabled_focused_holo_light=findRatioImage(data.btn_radio_on_disabled_focused_holo_light));\n        }\n        static get btn_radio_on_disabled_holo_light(){\n            return imageCache.btn_radio_on_disabled_holo_light || (imageCache.btn_radio_on_disabled_holo_light=findRatioImage(data.btn_radio_on_disabled_holo_light));\n        }\n        static get btn_radio_on_focused_holo_light(){\n            return imageCache.btn_radio_on_focused_holo_light || (imageCache.btn_radio_on_focused_holo_light=findRatioImage(data.btn_radio_on_focused_holo_light));\n        }\n        static get btn_radio_on_holo_light(){\n            return imageCache.btn_radio_on_holo_light || (imageCache.btn_radio_on_holo_light=findRatioImage(data.btn_radio_on_holo_light));\n        }\n        static get btn_radio_on_pressed_holo_light(){\n            return imageCache.btn_radio_on_pressed_holo_light || (imageCache.btn_radio_on_pressed_holo_light=findRatioImage(data.btn_radio_on_pressed_holo_light));\n        }\n        static get btn_rating_star_off_normal_holo_light(){\n            return imageCache.btn_rating_star_off_normal_holo_light || (imageCache.btn_rating_star_off_normal_holo_light=findRatioImage(data.btn_rating_star_off_normal_holo_light));\n        }\n        static get btn_rating_star_off_pressed_holo_light(){\n            return imageCache.btn_rating_star_off_pressed_holo_light || (imageCache.btn_rating_star_off_pressed_holo_light=findRatioImage(data.btn_rating_star_off_pressed_holo_light));\n        }\n        static get btn_rating_star_on_normal_holo_light(){\n            return imageCache.btn_rating_star_on_normal_holo_light || (imageCache.btn_rating_star_on_normal_holo_light=findRatioImage(data.btn_rating_star_on_normal_holo_light));\n        }\n        static get btn_rating_star_on_pressed_holo_light(){\n            return imageCache.btn_rating_star_on_pressed_holo_light || (imageCache.btn_rating_star_on_pressed_holo_light=findRatioImage(data.btn_rating_star_on_pressed_holo_light));\n        }\n        static get dropdown_background_dark(){\n            return imageCache.dropdown_background_dark || (imageCache.dropdown_background_dark=findRatioImage(data.dropdown_background_dark));\n        }\n        static get editbox_background_focus_yellow(){\n            return imageCache.editbox_background_focus_yellow || (imageCache.editbox_background_focus_yellow=findRatioImage(data.editbox_background_focus_yellow));\n        }\n        static get editbox_background_normal(){\n            return imageCache.editbox_background_normal || (imageCache.editbox_background_normal=findRatioImage(data.editbox_background_normal));\n        }\n        static get ic_menu_moreoverflow_normal_holo_dark(){\n            return imageCache.ic_menu_moreoverflow_normal_holo_dark || (imageCache.ic_menu_moreoverflow_normal_holo_dark=findRatioImage(data.ic_menu_moreoverflow_normal_holo_dark));\n        }\n        static get menu_panel_holo_dark(){\n            return imageCache.menu_panel_holo_dark || (imageCache.menu_panel_holo_dark=findRatioImage(data.menu_panel_holo_dark));\n        }\n        static get menu_panel_holo_light(){\n            return imageCache.menu_panel_holo_light || (imageCache.menu_panel_holo_light=findRatioImage(data.menu_panel_holo_light));\n        }\n        static get popup_bottom_bright(){\n            return imageCache.popup_bottom_bright || (imageCache.popup_bottom_bright=findRatioImage(data.popup_bottom_bright));\n        }\n        static get popup_center_bright(){\n            return imageCache.popup_center_bright || (imageCache.popup_center_bright=findRatioImage(data.popup_center_bright));\n        }\n        static get popup_full_bright(){\n            return imageCache.popup_full_bright || (imageCache.popup_full_bright=findRatioImage(data.popup_full_bright));\n        }\n        static get popup_top_bright(){\n            return imageCache.popup_top_bright || (imageCache.popup_top_bright=findRatioImage(data.popup_top_bright));\n        }\n        static get progressbar_indeterminate_holo1(){\n            return imageCache.progressbar_indeterminate_holo1 || (imageCache.progressbar_indeterminate_holo1=findRatioImage(data.progressbar_indeterminate_holo1));\n        }\n        static get progressbar_indeterminate_holo2(){\n            return imageCache.progressbar_indeterminate_holo2 || (imageCache.progressbar_indeterminate_holo2=findRatioImage(data.progressbar_indeterminate_holo2));\n        }\n        static get progressbar_indeterminate_holo3(){\n            return imageCache.progressbar_indeterminate_holo3 || (imageCache.progressbar_indeterminate_holo3=findRatioImage(data.progressbar_indeterminate_holo3));\n        }\n        static get progressbar_indeterminate_holo4(){\n            return imageCache.progressbar_indeterminate_holo4 || (imageCache.progressbar_indeterminate_holo4=findRatioImage(data.progressbar_indeterminate_holo4));\n        }\n        static get progressbar_indeterminate_holo5(){\n            return imageCache.progressbar_indeterminate_holo5 || (imageCache.progressbar_indeterminate_holo5=findRatioImage(data.progressbar_indeterminate_holo5));\n        }\n        static get progressbar_indeterminate_holo6(){\n            return imageCache.progressbar_indeterminate_holo6 || (imageCache.progressbar_indeterminate_holo6=findRatioImage(data.progressbar_indeterminate_holo6));\n        }\n        static get progressbar_indeterminate_holo7(){\n            return imageCache.progressbar_indeterminate_holo7 || (imageCache.progressbar_indeterminate_holo7=findRatioImage(data.progressbar_indeterminate_holo7));\n        }\n        static get progressbar_indeterminate_holo8(){\n            return imageCache.progressbar_indeterminate_holo8 || (imageCache.progressbar_indeterminate_holo8=findRatioImage(data.progressbar_indeterminate_holo8));\n        }\n        static get rate_star_big_half_holo_light(){\n            return imageCache.rate_star_big_half_holo_light || (imageCache.rate_star_big_half_holo_light=findRatioImage(data.rate_star_big_half_holo_light));\n        }\n        static get rate_star_big_off_holo_light(){\n            return imageCache.rate_star_big_off_holo_light || (imageCache.rate_star_big_off_holo_light=findRatioImage(data.rate_star_big_off_holo_light));\n        }\n        static get rate_star_big_on_holo_light(){\n            return imageCache.rate_star_big_on_holo_light || (imageCache.rate_star_big_on_holo_light=findRatioImage(data.rate_star_big_on_holo_light));\n        }\n        static get scrubber_control_disabled_holo(){\n            return imageCache.scrubber_control_disabled_holo || (imageCache.scrubber_control_disabled_holo=findRatioImage(data.scrubber_control_disabled_holo));\n        }\n        static get scrubber_control_focused_holo(){\n            return imageCache.scrubber_control_focused_holo || (imageCache.scrubber_control_focused_holo=findRatioImage(data.scrubber_control_focused_holo));\n        }\n        static get scrubber_control_normal_holo(){\n            return imageCache.scrubber_control_normal_holo || (imageCache.scrubber_control_normal_holo=findRatioImage(data.scrubber_control_normal_holo));\n        }\n        static get scrubber_control_pressed_holo(){\n            return imageCache.scrubber_control_pressed_holo || (imageCache.scrubber_control_pressed_holo=findRatioImage(data.scrubber_control_pressed_holo));\n        }\n        static get spinner_76_inner_holo(){\n            return imageCache.spinner_76_inner_holo || (imageCache.spinner_76_inner_holo=findRatioImage(data.spinner_76_inner_holo));\n        }\n        static get spinner_76_outer_holo(){\n            return imageCache.spinner_76_outer_holo || (imageCache.spinner_76_outer_holo=findRatioImage(data.spinner_76_outer_holo));\n        }\n\n    }\n}"
  },
  {
    "path": "src/android/R/interpolator.ts",
    "content": "/**\n * Created by linfaxin on 16/1/10.\n */\n///<reference path=\"../view/animation/Interpolator\"/>\n///<reference path=\"../view/animation/AccelerateDecelerateInterpolator\"/>\n///<reference path=\"../view/animation/AccelerateInterpolator\"/>\n///<reference path=\"../view/animation/AnticipateInterpolator\"/>\n///<reference path=\"../view/animation/AnticipateOvershootInterpolator\"/>\n///<reference path=\"../view/animation/BounceInterpolator\"/>\n///<reference path=\"../view/animation/CycleInterpolator\"/>\n///<reference path=\"../view/animation/DecelerateInterpolator\"/>\n///<reference path=\"../view/animation/LinearInterpolator\"/>\n///<reference path=\"../view/animation/OvershootInterpolator\"/>\n\nmodule android.R{\n    import Interpolator = android.view.animation.Interpolator;\n    import AccelerateDecelerateInterpolator = android.view.animation.AccelerateDecelerateInterpolator;\n    import AccelerateInterpolator = android.view.animation.AccelerateInterpolator;\n    import AnticipateInterpolator = android.view.animation.AnticipateInterpolator;\n    import AnticipateOvershootInterpolator = android.view.animation.AnticipateOvershootInterpolator;\n    import BounceInterpolator = android.view.animation.BounceInterpolator;\n    import CycleInterpolator = android.view.animation.CycleInterpolator;\n    import DecelerateInterpolator = android.view.animation.DecelerateInterpolator;\n    import LinearInterpolator = android.view.animation.LinearInterpolator;\n    import OvershootInterpolator = android.view.animation.OvershootInterpolator;\n\n    export class interpolator {\n        static accelerate_cubic = new AccelerateInterpolator(1.5);\n        static accelerate_decelerate = new AccelerateDecelerateInterpolator();\n        static accelerate_quad = new AccelerateInterpolator();\n        static accelerate_quint = new AccelerateInterpolator(2.5);\n        static anticipate_overshoot = new AnticipateOvershootInterpolator();\n        static anticipate = new AnticipateInterpolator();\n        static bounce = new BounceInterpolator();\n        static cycle = new CycleInterpolator(1);\n        static decelerate_cubic = new DecelerateInterpolator(1.5);\n        static decelerate_quad = new DecelerateInterpolator();\n        static decelerate_quint = new DecelerateInterpolator(2.5);\n        static linear = new LinearInterpolator();\n        static overshoot = new OvershootInterpolator();\n    }\n}"
  },
  {
    "path": "src/android/R/layout.ts",
    "content": "module android.R {\n    const _layout_data = {\n        \"action_bar\": \"<merge>\\n    <linearlayout android:layout_height=\\\"wrap_content\\\" android:layout_width=\\\"match_parent\\\" android:layout_marginLeft=\\\"60dp\\\" android:layout_marginRight=\\\"60dp\\\" android:minHeight=\\\"48dp\\\" android:gravity=\\\"center\\\" android:orientation=\\\"vertical\\\" id=\\\"action_bar_center_layout\\\">\\n        <textview android:gravity=\\\"center\\\" android:drawablePadding=\\\"4dp\\\" android:singleLine=\\\"true\\\" android:ellipsize=\\\"end\\\" android:textColor=\\\"@android:color/white\\\" android:textSize=\\\"18sp\\\" id=\\\"action_bar_title\\\"></textview>\\n        <textview android:visibility=\\\"gone\\\" android:gravity=\\\"center\\\" android:layout_marginTop=\\\"4dp\\\" android:drawablePadding=\\\"4dp\\\" android:singleLine=\\\"true\\\" android:ellipsize=\\\"end\\\" android:textColor=\\\"@android:color/white\\\" android:textSize=\\\"12sp\\\" id=\\\"action_bar_sub_title\\\"></textview>\\n    </linearlayout>\\n    <button android:visibility=\\\"gone\\\" android:layout_gravity=\\\"left|center_vertical\\\" android:layout_width=\\\"wrap_content\\\" android:background=\\\"@android:drawable/item_background\\\" android:textColor=\\\"@android:color/white\\\" android:paddingLeft=\\\"6dp\\\" android:paddingRight=\\\"6dp\\\" android:drawablePadding=\\\"4dp\\\" android:minWidth=\\\"32dp\\\" android:textSize=\\\"17sp\\\" android:singleLine=\\\"true\\\" id=\\\"action_bar_left\\\"></button>\\n    <button android:visibility=\\\"gone\\\" android:layout_gravity=\\\"right|center_vertical\\\" android:layout_width=\\\"wrap_content\\\" android:background=\\\"@android:drawable/item_background\\\" android:textColor=\\\"@android:color/white\\\" android:paddingRight=\\\"6dp\\\" android:paddingLeft=\\\"6dp\\\" android:drawablePadding=\\\"4dp\\\" android:minWidth=\\\"32dp\\\" android:textSize=\\\"17sp\\\" android:singleLine=\\\"true\\\" id=\\\"action_bar_right\\\"></button>\\n</merge>\",\n        \"alert_dialog\": \"<linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:layout_marginStart=\\\"8dip\\\" android:layout_marginEnd=\\\"8dip\\\" android:orientation=\\\"vertical\\\" id=\\\"parentPanel\\\">\\n\\n    <linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:orientation=\\\"vertical\\\" id=\\\"topPanel\\\">\\n        <view android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"1dip\\\" android:visibility=\\\"gone\\\" android:background=\\\"#aaa\\\" id=\\\"titleDividerTop\\\"></view>\\n        <linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:orientation=\\\"horizontal\\\" android:gravity=\\\"center_vertical|start\\\" android:minHeight=\\\"64dp\\\" android:layout_marginStart=\\\"16dip\\\" android:layout_marginEnd=\\\"16dip\\\" id=\\\"title_template\\\">\\n            <imageview android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:paddingEnd=\\\"8dip\\\" id=\\\"icon\\\"></imageview>\\n            <textview android:maxLines=\\\"1\\\" android:scrollHorizontally=\\\"true\\\" android:textSize=\\\"22sp\\\" android:textColor=\\\"#333\\\" android:singleLine=\\\"true\\\" android:ellipsize=\\\"end\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:textAlignment=\\\"viewStart\\\" id=\\\"alertTitle\\\"></textview>\\n        </linearlayout>\\n        <view android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"1dip\\\" android:visibility=\\\"gone\\\" android:background=\\\"#aaa\\\" id=\\\"titleDivider\\\"></view>\\n        <!-- If the client uses a customTitle, it will be added here. -->\\n    </linearlayout>\\n\\n    <linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:layout_weight=\\\"1\\\" android:orientation=\\\"vertical\\\" android:minHeight=\\\"64dp\\\" id=\\\"contentPanel\\\">\\n        <scrollview android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:clipToPadding=\\\"false\\\" id=\\\"scrollView\\\">\\n            <textview android:textSize=\\\"18sp\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:paddingStart=\\\"16dip\\\" android:paddingEnd=\\\"16dip\\\" android:paddingTop=\\\"8dip\\\" android:paddingBottom=\\\"8dip\\\" id=\\\"message\\\"></textview>\\n        </scrollview>\\n    </linearlayout>\\n\\n    <framelayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:layout_weight=\\\"1\\\" android:minHeight=\\\"64dp\\\" id=\\\"customPanel\\\">\\n        <framelayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" id=\\\"custom\\\"></framelayout>\\n    </framelayout>\\n\\n    <linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:minHeight=\\\"48dip\\\" android:orientation=\\\"vertical\\\" android:divider=\\\"@android:drawable/divider_horizontal\\\" android:showDividers=\\\"beginning\\\" android:dividerPadding=\\\"0dip\\\" id=\\\"buttonPanel\\\">\\n        <linearlayout android:divider=\\\"@android:drawable/divider_vertical\\\" android:showDividers=\\\"middle\\\" android:dividerPadding=\\\"0dp\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:orientation=\\\"horizontal\\\" android:layoutDirection=\\\"locale\\\" android:measureWithLargestChild=\\\"true\\\">\\n            <button android:layout_width=\\\"wrap_content\\\" android:layout_gravity=\\\"start\\\" android:layout_weight=\\\"1\\\" android:maxLines=\\\"2\\\" android:paddingStart=\\\"4dp\\\" android:paddingEnd=\\\"4dp\\\" android:background=\\\"@android:drawable/item_background\\\" android:textSize=\\\"14sp\\\" android:minHeight=\\\"48dp\\\" android:layout_height=\\\"wrap_content\\\" id=\\\"button2\\\"></button>\\n            <button android:layout_width=\\\"wrap_content\\\" android:layout_gravity=\\\"center_horizontal\\\" android:layout_weight=\\\"1\\\" android:maxLines=\\\"2\\\" android:paddingStart=\\\"4dp\\\" android:paddingEnd=\\\"4dp\\\" android:background=\\\"@android:drawable/item_background\\\" android:textSize=\\\"14sp\\\" android:minHeight=\\\"48dp\\\" android:layout_height=\\\"wrap_content\\\" id=\\\"button3\\\"></button>\\n            <button android:layout_width=\\\"wrap_content\\\" android:layout_gravity=\\\"end\\\" android:layout_weight=\\\"1\\\" android:maxLines=\\\"2\\\" android:paddingStart=\\\"4dp\\\" android:paddingEnd=\\\"4dp\\\" android:background=\\\"@android:drawable/item_background\\\" android:textSize=\\\"14sp\\\" android:minHeight=\\\"48dp\\\" android:layout_height=\\\"wrap_content\\\" id=\\\"button1\\\"></button>\\n        </linearlayout>\\n     </linearlayout>\\n</linearlayout>\",\n        \"alert_dialog_progress\": \"<relativelayout android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"match_parent\\\">\\n    <progressbar style=\\\"@android:attr/progressBarStyleHorizontal\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:layout_marginTop=\\\"16dip\\\" android:layout_marginBottom=\\\"1dip\\\" android:layout_marginStart=\\\"16dip\\\" android:layout_marginEnd=\\\"16dip\\\" android:layout_centerHorizontal=\\\"true\\\" id=\\\"progress\\\"></progressbar>\\n    <textview android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:paddingBottom=\\\"16dip\\\" android:layout_marginStart=\\\"16dip\\\" android:layout_marginEnd=\\\"16dip\\\" android:layout_alignParentStart=\\\"true\\\" android:layout_below=\\\"progress\\\" id=\\\"progress_percent\\\"></textview>\\n    <textview android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:paddingBottom=\\\"16dip\\\" android:layout_marginStart=\\\"16dip\\\" android:layout_marginEnd=\\\"16dip\\\" android:layout_alignParentEnd=\\\"true\\\" android:layout_below=\\\"progress\\\" id=\\\"progress_number\\\"></textview>\\n</relativelayout>\",\n        \"popup_menu_item_layout\": \"<linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"48dp\\\" android:minWidth=\\\"196dip\\\" android:paddingEnd=\\\"16dip\\\">\\n\\n    <imageview android:visibility=\\\"gone\\\" android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:layout_gravity=\\\"center_vertical\\\" android:layout_marginStart=\\\"8dip\\\" android:layout_marginEnd=\\\"-8dip\\\" android:layout_marginTop=\\\"8dip\\\" android:layout_marginBottom=\\\"8dip\\\" android:scaleType=\\\"centerInside\\\" android:duplicateParentState=\\\"true\\\" id=\\\"icon\\\"></imageview>\\n    \\n    <!-- The title and summary have some gap between them, and this 'group' should be centered vertically. -->\\n    <relativelayout android:layout_width=\\\"0dip\\\" android:layout_weight=\\\"1\\\" android:layout_height=\\\"wrap_content\\\" android:layout_gravity=\\\"center_vertical\\\" android:layout_marginStart=\\\"16dip\\\" android:duplicateParentState=\\\"true\\\">\\n\\n        <textview android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:layout_alignParentTop=\\\"true\\\" android:layout_alignParentStart=\\\"true\\\" android:textColor=\\\"@android:color/primary_text_dark_disable_only\\\" android:textSize=\\\"18sp\\\" android:singleLine=\\\"true\\\" android:duplicateParentState=\\\"true\\\" android:ellipsize=\\\"marquee\\\" android:fadingEdge=\\\"horizontal\\\" android:textAlignment=\\\"viewStart\\\" id=\\\"title\\\"></textview>\\n\\n        <textview android:visibility=\\\"gone\\\" android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:layout_below=\\\"title\\\" android:layout_alignParentStart=\\\"true\\\" android:textColor=\\\"@android:color/primary_text_dark_disable_only\\\" android:textSize=\\\"12sp\\\" android:singleLine=\\\"true\\\" android:duplicateParentState=\\\"true\\\" android:textAlignment=\\\"viewStart\\\" id=\\\"shortcut\\\"></textview>\\n\\n    </relativelayout>\\n\\n    <!-- Checkbox, and/or radio button will be inserted here. -->\\n    \\n</linearlayout>\",\n        \"select_dialog\": \"<view class=\\\"android.app.AlertController.RecycleListView\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"match_parent\\\" android:cacheColorHint=\\\"@null\\\" android:divider=\\\"@android:drawable/list_divider\\\" android:scrollbars=\\\"vertical\\\" android:overScrollMode=\\\"ifContentScrolls\\\" android:textAlignment=\\\"viewStart\\\" id=\\\"select_dialog_listview\\\"></view>\",\n        \"select_dialog_item\": \"<textview android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:minHeight=\\\"48dp\\\" android:textSize=\\\"18sp\\\" android:gravity=\\\"center_vertical\\\" android:paddingStart=\\\"16dip\\\" android:paddingEnd=\\\"16dip\\\" android:ellipsize=\\\"end\\\" id=\\\"text1\\\"></textview>\",\n        \"select_dialog_multichoice\": \"<checkedtextview android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:minHeight=\\\"48dp\\\" android:textSize=\\\"18sp\\\" android:gravity=\\\"center_vertical\\\" android:paddingStart=\\\"16dip\\\" android:paddingEnd=\\\"16dip\\\" android:checkMark=\\\"@android:drawable/btn_check\\\" android:ellipsize=\\\"end\\\" id=\\\"text1\\\"></checkedtextview>\",\n        \"select_dialog_singlechoice\": \"<checkedtextview android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:minHeight=\\\"48dp\\\" android:textSize=\\\"18sp\\\" android:gravity=\\\"center_vertical\\\" android:paddingStart=\\\"16dip\\\" android:paddingEnd=\\\"16dip\\\" android:checkMark=\\\"@android:drawable/btn_radio\\\" android:ellipsize=\\\"end\\\" id=\\\"text1\\\"></checkedtextview>\",\n        \"simple_spinner_dropdown_item\": \"<checkedtextview android:paddingStart=\\\"8dp\\\" android:paddingEnd=\\\"8dp\\\" android:textColor=\\\"@android:color/primary_text_light_disable_only\\\" android:gravity=\\\"center_vertical\\\" android:singleLine=\\\"true\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"48dp\\\" android:ellipsize=\\\"end\\\" android:textAlignment=\\\"inherit\\\" id=\\\"text1\\\"></checkedtextview>\",\n        \"simple_spinner_item\": \"<textview android:paddingStart=\\\"8dp\\\" android:paddingEnd=\\\"8dp\\\" android:textColor=\\\"@android:color/primary_text_light_disable_only\\\" android:gravity=\\\"center_vertical\\\" android:singleLine=\\\"true\\\" android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"wrap_content\\\" android:ellipsize=\\\"end\\\" android:textAlignment=\\\"inherit\\\" id=\\\"text1\\\"></textview>\",\n        \"transient_notification\": \"<linearlayout android:layout_width=\\\"match_parent\\\" android:layout_height=\\\"match_parent\\\" android:orientation=\\\"vertical\\\" android:background=\\\"@android:drawable/toast_frame\\\">\\n\\n    <textview android:layout_width=\\\"wrap_content\\\" android:layout_height=\\\"wrap_content\\\" android:layout_weight=\\\"1\\\" android:layout_gravity=\\\"center_horizontal\\\" android:textColor=\\\"white\\\" android:shadowColor=\\\"#BB000000\\\" android:shadowRadius=\\\"2.75\\\" id=\\\"message\\\"></textview>\\n\\n</linearlayout>\"\n};\n    const _tempDiv = document.createElement('div');\n\n    export class layout{\n        static getLayoutData(layoutName:string):HTMLElement{\n            if(!layoutName) return null;\n            if(!_layout_data[layoutName]) return null;\n            _tempDiv.innerHTML = _layout_data[layoutName];\n            let data = <HTMLElement>_tempDiv.firstElementChild;\n            _tempDiv.removeChild(data);\n            return data;\n        }\n        \n        static action_bar = '@android:layout/action_bar';\n        static alert_dialog = '@android:layout/alert_dialog';\n        static alert_dialog_progress = '@android:layout/alert_dialog_progress';\n        static popup_menu_item_layout = '@android:layout/popup_menu_item_layout';\n        static select_dialog = '@android:layout/select_dialog';\n        static select_dialog_item = '@android:layout/select_dialog_item';\n        static select_dialog_multichoice = '@android:layout/select_dialog_multichoice';\n        static select_dialog_singlechoice = '@android:layout/select_dialog_singlechoice';\n        static simple_spinner_dropdown_item = '@android:layout/simple_spinner_dropdown_item';\n        static simple_spinner_item = '@android:layout/simple_spinner_item';\n        static transient_notification = '@android:layout/transient_notification';\n    }\n}"
  },
  {
    "path": "src/android/R/string.ts",
    "content": "/**\n * Created by linfaxin on 15/11/21.\n */\nmodule android.R{\n    export class string_{\n        static ok = 'OK';\n        static cancel = 'Cancel';\n        static close = 'Close';\n        static back = 'Back';\n        static crash_catch_alert = 'Some error happen, will refresh page:';\n\n        static prll_header_state_normal = 'Pull to refresh';\n        static prll_header_state_ready = 'Release to refresh';\n        static prll_header_state_loading = 'Loading';\n        static prll_header_state_fail = 'Refresh fail';\n        static prll_footer_state_normal = 'Load more';\n        static prll_footer_state_loading = 'Loading';\n        static prll_footer_state_ready = 'Pull to load more';\n        static prll_footer_state_fail = 'Click to reload';\n        static prll_footer_state_no_more = 'Load Finish';\n\n        private static zh(){\n            this.ok = '确定';\n            this.cancel = '取消';\n            this.close = '关闭';\n            this.back = '返回';\n            this.crash_catch_alert = '程序发生错误, 即将重载网页:';\n\n            this.prll_header_state_normal = '下拉以刷新';\n            this.prll_header_state_ready = '松开马上刷新';\n            this.prll_header_state_loading = '正在刷新...';\n            this.prll_header_state_fail = '刷新失败';\n            this.prll_footer_state_normal = '点击加载更多';\n            this.prll_footer_state_loading = '正在加载...';\n            this.prll_footer_state_ready = '松开加载更多';\n            this.prll_footer_state_no_more = '加载完毕';\n            this.prll_footer_state_fail = '加载失败,点击重试';\n        }\n    }\n\n    //merge language special to main\n    const lang = navigator.language.split('-')[0].toLowerCase();\n    if(typeof string_[lang] === 'function') string_[lang].call(string_);\n}"
  },
  {
    "path": "src/android/app/ActionBar.ts",
    "content": "/*\n * Copyright (C) 2010 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/view/Window.ts\"/>\n///<reference path=\"../../android/widget/SpinnerAdapter.ts\"/>\n///<reference path=\"../../android/widget/FrameLayout.ts\"/>\n///<reference path=\"../../android/widget/TextView.ts\"/>\n///<reference path=\"../../android/app/Activity.ts\"/>\n///<reference path=\"../../android/app/Application.ts\"/>\n///<reference path=\"../../android/R/attr.ts\"/>\n///<reference path=\"../../android/R/layout.ts\"/>\n\nmodule android.app {\nimport Drawable = android.graphics.drawable.Drawable;\nimport Gravity = android.view.Gravity;\nimport View = android.view.View;\nimport ViewGroup = android.view.ViewGroup;\nimport MarginLayoutParams = android.view.ViewGroup.MarginLayoutParams;\nimport Window = android.view.Window;\nimport SpinnerAdapter = android.widget.SpinnerAdapter;\nimport FrameLayout = android.widget.FrameLayout;\nimport TextView = android.widget.TextView;\nimport Activity = android.app.Activity;\nimport Application = android.app.Application;\n/**\n * A window feature at the top of the activity that may display the activity title, navigation\n * modes, and other interactive items.\n * <p>Beginning with Android 3.0 (API level 11), the action bar appears at the top of an\n * activity's window when the activity uses the system's {@link\n * android.R.style#Theme_Holo Holo} theme (or one of its descendant themes), which is the default.\n * You may otherwise add the action bar by calling {@link\n * android.view.Window#requestFeature requestFeature(FEATURE_ACTION_BAR)} or by declaring it in a\n * custom theme with the {@link android.R.styleable#Theme_windowActionBar windowActionBar} property.\n * <p>By default, the action bar shows the application icon on\n * the left, followed by the activity title. If your activity has an options menu, you can make\n * select items accessible directly from the action bar as \"action items\". You can also\n * modify various characteristics of the action bar or remove it completely.</p>\n * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link\n * android.app.Activity#getActionBar getActionBar()}.</p>\n * <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions,\n * using an {@link android.view.ActionMode}. For example, when the user selects one or more items in\n * your activity, you can enable an action mode that offers actions specific to the selected\n * items, with a UI that temporarily replaces the action bar. Although the UI may occupy the\n * same space, the {@link android.view.ActionMode} APIs are distinct and independent from those for\n * {@link ActionBar}.\n * <div class=\"special reference\">\n * <h3>Developer Guides</h3>\n * <p>For information about how to use the action bar, including how to add action items, navigation\n * modes and more, read the <a href=\"{@docRoot}guide/topics/ui/actionbar.html\">Action\n * Bar</a> developer guide.</p>\n * </div>\n *\n * AndroidUI:\n * NOTE: AndroidUI's ActionBar was not same as Android's.\n */\nexport class ActionBar extends FrameLayout {\n\n    ///**\n    // * Standard navigation mode. Consists of either a logo or icon\n    // * and title text with an optional subtitle. Clicking any of these elements\n    // * will dispatch onOptionsItemSelected to the host Activity with\n    // * a MenuItem with item ID android.R.id.home.\n    // */\n    //static NAVIGATION_MODE_STANDARD:number = 0;\n    //\n    ///**\n    // * List navigation mode. Instead of static title text this mode\n    // * presents a list menu for navigation within the activity.\n    // * e.g. this might be presented to the user as a dropdown list.\n    // */\n    //static NAVIGATION_MODE_LIST:number = 1;\n    //\n    ///**\n    // * Tab navigation mode. Instead of static title text this mode\n    // * presents a series of tabs for navigation within the activity.\n    // */\n    //static NAVIGATION_MODE_TABS:number = 2;\n    //\n    ///**\n    // * Use logo instead of icon if available. This flag will cause appropriate\n    // * navigation modes to use a wider logo in place of the standard icon.\n    // *\n    // * @see #setDisplayOptions(int)\n    // * @see #setDisplayOptions(int, int)\n    // */\n    //static DISPLAY_USE_LOGO:number = 0x1;\n    //\n    ///**\n    // * Show 'home' elements in this action bar, leaving more space for other\n    // * navigation elements. This includes logo and icon.\n    // *\n    // * @see #setDisplayOptions(int)\n    // * @see #setDisplayOptions(int, int)\n    // */\n    //static DISPLAY_SHOW_HOME:number = 0x2;\n    //\n    ///**\n    // * Display the 'home' element such that it appears as an 'up' affordance.\n    // * e.g. show an arrow to the left indicating the action that will be taken.\n    // *\n    // * Set this flag if selecting the 'home' button in the action bar to return\n    // * up by a single level in your UI rather than back to the top level or front page.\n    // *\n    // * <p>Setting this option will implicitly enable interaction with the home/up\n    // * button. See {@link #setHomeButtonEnabled(boolean)}.\n    // *\n    // * @see #setDisplayOptions(int)\n    // * @see #setDisplayOptions(int, int)\n    // */\n    //static DISPLAY_HOME_AS_UP:number = 0x4;\n    //\n    ///**\n    // * Show the activity title and subtitle, if present.\n    // *\n    // * @see #setTitle(CharSequence)\n    // * @see #setTitle(int)\n    // * @see #setSubtitle(CharSequence)\n    // * @see #setSubtitle(int)\n    // * @see #setDisplayOptions(int)\n    // * @see #setDisplayOptions(int, int)\n    // */\n    //static DISPLAY_SHOW_TITLE:number = 0x8;\n    //\n    ///**\n    // * Show the custom view if one has been set.\n    // * @see #setCustomView(View)\n    // * @see #setDisplayOptions(int)\n    // * @see #setDisplayOptions(int, int)\n    // */\n    //static DISPLAY_SHOW_CUSTOM:number = 0x10;\n    //\n    ///**\n    // * Allow the title to wrap onto multiple lines if space is available\n    // * @hide pending API approval\n    // */\n    //static DISPLAY_TITLE_MULTIPLE_LINES:number = 0x20;\n\n    private mCenterLayout:ViewGroup;\n    private mCustomView:View;\n    private mTitleView:TextView;\n    private mSubTitleView:TextView;\n    private mActionLeft:TextView;\n    private mActionRight:TextView;\n\n    constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle:any=android.R.attr.actionBarStyle) {\n        super(context, bindElement, defStyle);\n        context.getLayoutInflater().inflate(android.R.layout.action_bar, this);\n        this.mCenterLayout = <ViewGroup>this.findViewById('action_bar_center_layout');\n        this.mTitleView = <TextView>this.findViewById('action_bar_title');\n        this.mSubTitleView = <TextView>this.findViewById('action_bar_sub_title');\n        this.mActionLeft = <TextView>this.findViewById('action_bar_left');\n        this.mActionRight = <TextView>this.findViewById('action_bar_right');\n\n    }\n\n//    /**\n//     * Set the action bar into custom navigation mode, supplying a view\n//     * for custom navigation.\n//     *\n//     * Custom navigation views appear between the application icon and\n//     * any action buttons and may use any space available there. Common\n//     * use cases for custom navigation views might include an auto-suggesting\n//     * address bar for a browser or other navigation mechanisms that do not\n//     * translate well to provided navigation modes.\n//     *\n//     * @param view Custom navigation view to place in the ActionBar.\n//     */\n//    abstract setCustomView(view:View):void ;\n\n    /**\n     * Set the action bar into custom navigation mode, supplying a view\n     * for custom navigation.\n     * \n     * <p>Custom navigation views appear between the application icon and\n     * any action buttons and may use any space available there. Common\n     * use cases for custom navigation views might include an auto-suggesting\n     * address bar for a browser or other navigation mechanisms that do not\n     * translate well to provided navigation modes.</p>\n     *\n     * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for\n     * the custom view to be displayed.</p>\n     * \n     * @param view Custom navigation view to place in the ActionBar.\n     * @param layoutParams How this custom view should layout in the bar.\n     *\n     * @see #setDisplayOptions(int, int)\n     */\n    setCustomView(view:View, layoutParams?:ViewGroup.MarginLayoutParams):void{\n        this.mCenterLayout.removeAllViews();\n        this.mCustomView = view;\n        if(layoutParams) this.mCenterLayout.addView(view, layoutParams);\n        else this.mCenterLayout.addView(view);\n\n    }\n\n    ///**\n    // * Set the action bar into custom navigation mode, supplying a view\n    // * for custom navigation.\n    // *\n    // * <p>Custom navigation views appear between the application icon and\n    // * any action buttons and may use any space available there. Common\n    // * use cases for custom navigation views might include an auto-suggesting\n    // * address bar for a browser or other navigation mechanisms that do not\n    // * translate well to provided navigation modes.</p>\n    // *\n    // * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for\n    // * the custom view to be displayed.</p>\n    // *\n    // * @param resId Resource ID of a layout to inflate into the ActionBar.\n    // *\n    // * @see #setDisplayOptions(int, int)\n    // */\n    //setCustomView(resId:number):void ;\n\n//    /**\n//     * Set the icon to display in the 'home' section of the action bar.\n//     * The action bar will use an icon specified by its style or the\n//     * activity icon by default.\n//     *\n//     * Whether the home section shows an icon or logo is controlled\n//     * by the display option {@link #DISPLAY_USE_LOGO}.\n//     *\n//     * @param resId Resource ID of a drawable to show as an icon.\n//     *\n//     * @see #setDisplayUseLogoEnabled(boolean)\n//     * @see #setDisplayShowHomeEnabled(boolean)\n//     */\n//    abstract\n//setIcon(resId:number):void ;\n\n    /**\n     * Set the icon to display in the 'home' section of the action bar.\n     * The action bar will use an icon specified by its style or the\n     * activity icon by default.\n     *\n     * Whether the home section shows an icon or logo is controlled\n     * by the display option {@link #DISPLAY_USE_LOGO}.\n     *\n     * @param icon Drawable to show as an icon.\n     *\n     * @see #setDisplayUseLogoEnabled(boolean)\n     * @see #setDisplayShowHomeEnabled(boolean)\n     */\n    setIcon(icon:Drawable):void{\n        icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());\n        let drawables = this.mTitleView.getCompoundDrawables();\n        this.mTitleView.setCompoundDrawables(icon, drawables[1], drawables[2], drawables[3]);\n    }\n\n//    /**\n//     * Set the logo to display in the 'home' section of the action bar.\n//     * The action bar will use a logo specified by its style or the\n//     * activity logo by default.\n//     *\n//     * Whether the home section shows an icon or logo is controlled\n//     * by the display option {@link #DISPLAY_USE_LOGO}.\n//     *\n//     * @param resId Resource ID of a drawable to show as a logo.\n//     *\n//     * @see #setDisplayUseLogoEnabled(boolean)\n//     * @see #setDisplayShowHomeEnabled(boolean)\n//     */\n//    abstract\n//setLogo(resId:number):void ;\n\n    /**\n     * Set the logo to display in the 'home' section of the action bar.\n     * The action bar will use a logo specified by its style or the\n     * activity logo by default.\n     *\n     * Whether the home section shows an icon or logo is controlled\n     * by the display option {@link #DISPLAY_USE_LOGO}.\n     *\n     * @param logo Drawable to show as a logo.\n     *\n     * @see #setDisplayUseLogoEnabled(boolean)\n     * @see #setDisplayShowHomeEnabled(boolean)\n     */\n    setLogo(logo:Drawable):void{\n        this.setIcon(logo);\n    }\n\n//    /**\n//     * Set the adapter and navigation callback for list navigation mode.\n//     *\n//     * The supplied adapter will provide views for the expanded list as well as\n//     * the currently selected item. (These may be displayed differently.)\n//     *\n//     * The supplied OnNavigationListener will alert the application when the user\n//     * changes the current list selection.\n//     *\n//     * @param adapter An adapter that will provide views both to display\n//     *                the current navigation selection and populate views\n//     *                within the dropdown navigation menu.\n//     * @param callback An OnNavigationListener that will receive events when the user\n//     *                 selects a navigation item.\n//     */\n//    abstract\n//setListNavigationCallbacks(adapter:SpinnerAdapter, callback:ActionBar.OnNavigationListener):void ;\n//\n//    /**\n//     * Set the selected navigation item in list or tabbed navigation modes.\n//     *\n//     * @param position Position of the item to select.\n//     */\n//    abstract\n//setSelectedNavigationItem(position:number):void ;\n//\n//    /**\n//     * Get the position of the selected navigation item in list or tabbed navigation modes.\n//     *\n//     * @return Position of the selected item.\n//     */\n//    abstract\n//getSelectedNavigationIndex():number ;\n//\n//    /**\n//     * Get the number of navigation items present in the current navigation mode.\n//     *\n//     * @return Number of navigation items.\n//     */\n//    abstract\n//getNavigationItemCount():number ;\n\n    /**\n     * Set the action bar's title. This will only be displayed if\n     * {@link #DISPLAY_SHOW_TITLE} is set.\n     *\n     * @param title Title to set\n     *\n     * @see #setTitle(int)\n     * @see #setDisplayOptions(int, int)\n     */\n    setTitle(title:string):void{\n        this.mTitleView.setText(title);\n    }\n\n//    /**\n//     * Set the action bar's title. This will only be displayed if\n//     * {@link #DISPLAY_SHOW_TITLE} is set.\n//     *\n//     * @param resId Resource ID of title string to set\n//     *\n//     * @see #setTitle(CharSequence)\n//     * @see #setDisplayOptions(int, int)\n//     */\n//    abstract\n//setTitle(resId:number):void ;\n\n    /**\n     * Set the action bar's subtitle. This will only be displayed if\n     * {@link #DISPLAY_SHOW_TITLE} is set. Set to null to disable the\n     * subtitle entirely.\n     *\n     * @param subtitle Subtitle to set\n     *\n     * @see #setSubtitle(int)\n     * @see #setDisplayOptions(int, int)\n     */\n    setSubtitle(subtitle:string):void {\n        this.mSubTitleView.setText(subtitle);\n        let empty = subtitle == null || subtitle.length == 0;\n        this.mSubTitleView.setVisibility(empty ? View.GONE : View.VISIBLE);\n    }\n\n//    /**\n//     * Set the action bar's subtitle. This will only be displayed if\n//     * {@link #DISPLAY_SHOW_TITLE} is set.\n//     *\n//     * @param resId Resource ID of subtitle string to set\n//     *\n//     * @see #setSubtitle(CharSequence)\n//     * @see #setDisplayOptions(int, int)\n//     */\n//    abstract\n//setSubtitle(resId:number):void ;\n//\n//    /**\n//     * Set display options. This changes all display option bits at once. To change\n//     * a limited subset of display options, see {@link #setDisplayOptions(int, int)}.\n//     *\n//     * @param options A combination of the bits defined by the DISPLAY_ constants\n//     *                defined in ActionBar.\n//     */\n//    abstract\n//setDisplayOptions(options:number):void ;\n//\n//    /**\n//     * Set selected display options. Only the options specified by mask will be changed.\n//     * To change all display option bits at once, see {@link #setDisplayOptions(int)}.\n//     *\n//     * <p>Example: setDisplayOptions(0, DISPLAY_SHOW_HOME) will disable the\n//     * {@link #DISPLAY_SHOW_HOME} option.\n//     * setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | DISPLAY_USE_LOGO)\n//     * will enable {@link #DISPLAY_SHOW_HOME} and disable {@link #DISPLAY_USE_LOGO}.\n//     *\n//     * @param options A combination of the bits defined by the DISPLAY_ constants\n//     *                defined in ActionBar.\n//     * @param mask A bit mask declaring which display options should be changed.\n//     */\n//    abstract\n//setDisplayOptions(options:number, mask:number):void ;\n//\n//    /**\n//     * Set whether to display the activity logo rather than the activity icon.\n//     * A logo is often a wider, more detailed image.\n//     *\n//     * <p>To set several display options at once, see the setDisplayOptions methods.\n//     *\n//     * @param useLogo true to use the activity logo, false to use the activity icon.\n//     *\n//     * @see #setDisplayOptions(int)\n//     * @see #setDisplayOptions(int, int)\n//     */\n//    abstract\n//setDisplayUseLogoEnabled(useLogo:boolean):void ;\n//\n//    /**\n//     * Set whether to include the application home affordance in the action bar.\n//     * Home is presented as either an activity icon or logo.\n//     *\n//     * <p>To set several display options at once, see the setDisplayOptions methods.\n//     *\n//     * @param showHome true to show home, false otherwise.\n//     *\n//     * @see #setDisplayOptions(int)\n//     * @see #setDisplayOptions(int, int)\n//     */\n//    abstract\n//setDisplayShowHomeEnabled(showHome:boolean):void ;\n//\n//    /**\n//     * Set whether home should be displayed as an \"up\" affordance.\n//     * Set this to true if selecting \"home\" returns up by a single level in your UI\n//     * rather than back to the top level or front page.\n//     *\n//     * <p>To set several display options at once, see the setDisplayOptions methods.\n//     *\n//     * @param showHomeAsUp true to show the user that selecting home will return one\n//     *                     level up rather than to the top level of the app.\n//     *\n//     * @see #setDisplayOptions(int)\n//     * @see #setDisplayOptions(int, int)\n//     */\n//    abstract\n//setDisplayHomeAsUpEnabled(showHomeAsUp:boolean):void ;\n//\n//    /**\n//     * Set whether an activity title/subtitle should be displayed.\n//     *\n//     * <p>To set several display options at once, see the setDisplayOptions methods.\n//     *\n//     * @param showTitle true to display a title/subtitle if present.\n//     *\n//     * @see #setDisplayOptions(int)\n//     * @see #setDisplayOptions(int, int)\n//     */\n//    abstract\n//setDisplayShowTitleEnabled(showTitle:boolean):void ;\n//\n//    /**\n//     * Set whether a custom view should be displayed, if set.\n//     *\n//     * <p>To set several display options at once, see the setDisplayOptions methods.\n//     *\n//     * @param showCustom true if the currently set custom view should be displayed, false otherwise.\n//     *\n//     * @see #setDisplayOptions(int)\n//     * @see #setDisplayOptions(int, int)\n//     */\n//    abstract\n//setDisplayShowCustomEnabled(showCustom:boolean):void ;\n//\n//    /**\n//     * Set the ActionBar's background. This will be used for the primary\n//     * action bar.\n//     *\n//     * @param d Background drawable\n//     * @see #setStackedBackgroundDrawable(Drawable)\n//     * @see #setSplitBackgroundDrawable(Drawable)\n//     */\n//    setBackgroundDrawable(d:Drawable):void ;\n//\n//    /**\n//     * Set the ActionBar's stacked background. This will appear\n//     * in the second row/stacked bar on some devices and configurations.\n//     *\n//     * @param d Background drawable for the stacked row\n//     */\n//    setStackedBackgroundDrawable(d:Drawable):void  {\n//    }\n//\n//    /**\n//     * Set the ActionBar's split background. This will appear in\n//     * the split action bar containing menu-provided action buttons\n//     * on some devices and configurations.\n//     * <p>You can enable split action bar with {@link android.R.attr#uiOptions}\n//     *\n//     * @param d Background drawable for the split bar\n//     */\n//    setSplitBackgroundDrawable(d:Drawable):void  {\n//    }\n\n    /**\n     * @return The current custom view.\n     */\n    getCustomView():View{\n        return this.mCustomView;\n    }\n\n    /**\n     * Returns the current ActionBar title in standard mode.\n     * Returns null if {@link #getNavigationMode()} would not return\n     * {@link #NAVIGATION_MODE_STANDARD}. \n     *\n     * @return The current ActionBar title or null.\n     */\n    getTitle():string{\n        return this.mTitleView.getText().toString();\n    }\n\n    /**\n     * Returns the current ActionBar subtitle in standard mode.\n     * Returns null if {@link #getNavigationMode()} would not return\n     * {@link #NAVIGATION_MODE_STANDARD}. \n     *\n     * @return The current ActionBar subtitle or null.\n     */\n    getSubtitle():string{\n        return this.mSubTitleView.getText().toString();\n    }\n\n//    /**\n//     * Returns the current navigation mode. The result will be one of:\n//     * <ul>\n//     * <li>{@link #NAVIGATION_MODE_STANDARD}</li>\n//     * <li>{@link #NAVIGATION_MODE_LIST}</li>\n//     * <li>{@link #NAVIGATION_MODE_TABS}</li>\n//     * </ul>\n//     *\n//     * @return The current navigation mode.\n//     */\n//    abstract\n//getNavigationMode():number ;\n//\n//    /**\n//     * Set the current navigation mode.\n//     *\n//     * @param mode The new mode to set.\n//     * @see #NAVIGATION_MODE_STANDARD\n//     * @see #NAVIGATION_MODE_LIST\n//     * @see #NAVIGATION_MODE_TABS\n//     */\n//    abstract\n//setNavigationMode(mode:number):void ;\n//\n//    /**\n//     * @return The current set of display options.\n//     */\n//    abstract\n//getDisplayOptions():number ;\n//\n//    /**\n//     * Create and return a new {@link Tab}.\n//     * This tab will not be included in the action bar until it is added.\n//     *\n//     * <p>Very often tabs will be used to switch between {@link Fragment}\n//     * objects.  Here is a typical implementation of such tabs:</p>\n//     *\n//     * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.java\n//     *      complete}\n//     *\n//     * @return A new Tab\n//     *\n//     * @see #addTab(Tab)\n//     */\n//    abstract\n//newTab():ActionBar.Tab ;\n//\n//    /**\n//     * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list.\n//     * If this is the first tab to be added it will become the selected tab.\n//     *\n//     * @param tab Tab to add\n//     */\n//    abstract\n//addTab(tab:ActionBar.Tab):void ;\n//\n//    /**\n//     * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list.\n//     *\n//     * @param tab Tab to add\n//     * @param setSelected True if the added tab should become the selected tab.\n//     */\n//    abstract\n//addTab(tab:ActionBar.Tab, setSelected:boolean):void ;\n//\n//    /**\n//     * Add a tab for use in tabbed navigation mode. The tab will be inserted at\n//     * <code>position</code>. If this is the first tab to be added it will become\n//     * the selected tab.\n//     *\n//     * @param tab The tab to add\n//     * @param position The new position of the tab\n//     */\n//    abstract\n//addTab(tab:ActionBar.Tab, position:number):void ;\n//\n//    /**\n//     * Add a tab for use in tabbed navigation mode. The tab will be insterted at\n//     * <code>position</code>.\n//     *\n//     * @param tab The tab to add\n//     * @param position The new position of the tab\n//     * @param setSelected True if the added tab should become the selected tab.\n//     */\n//    abstract\n//addTab(tab:ActionBar.Tab, position:number, setSelected:boolean):void ;\n//\n//    /**\n//     * Remove a tab from the action bar. If the removed tab was selected it will be deselected\n//     * and another tab will be selected if present.\n//     *\n//     * @param tab The tab to remove\n//     */\n//    abstract\n//removeTab(tab:ActionBar.Tab):void ;\n//\n//    /**\n//     * Remove a tab from the action bar. If the removed tab was selected it will be deselected\n//     * and another tab will be selected if present.\n//     *\n//     * @param position Position of the tab to remove\n//     */\n//    abstract\n//removeTabAt(position:number):void ;\n//\n//    /**\n//     * Remove all tabs from the action bar and deselect the current tab.\n//     */\n//    abstract\n//removeAllTabs():void ;\n//\n//    /**\n//     * Select the specified tab. If it is not a child of this action bar it will be added.\n//     *\n//     * <p>Note: If you want to select by index, use {@link #setSelectedNavigationItem(int)}.</p>\n//     *\n//     * @param tab Tab to select\n//     */\n//    abstract\n//selectTab(tab:ActionBar.Tab):void ;\n//\n//    /**\n//     * Returns the currently selected tab if in tabbed navigation mode and there is at least\n//     * one tab present.\n//     *\n//     * @return The currently selected tab or null\n//     */\n//    abstract\n//getSelectedTab():ActionBar.Tab ;\n//\n//    /**\n//     * Returns the tab at the specified index.\n//     *\n//     * @param index Index value in the range 0-get\n//     * @return\n//     */\n//    abstract\n//getTabAt(index:number):ActionBar.Tab ;\n//\n//    /**\n//     * Returns the number of tabs currently registered with the action bar.\n//     * @return Tab count\n//     */\n//    abstract\n//getTabCount():number ;\n//\n//    /**\n//     * Retrieve the current height of the ActionBar.\n//     *\n//     * @return The ActionBar's height\n//     */\n//    abstract\n//getHeight():number ;\n\n    /**\n     * Show the ActionBar if it is not currently showing.\n     * If the window hosting the ActionBar does not have the feature\n     * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application\n     * content to fit the new space available.\n     *\n     * <p>If you are hiding the ActionBar through\n     * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN},\n     * you should not call this function directly.\n     */\n    show():void {\n        this.setVisibility(View.VISIBLE);\n    }\n\n    /**\n     * Hide the ActionBar if it is currently showing.\n     * If the window hosting the ActionBar does not have the feature\n     * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application\n     * content to fit the new space available.\n     *\n     * <p>Instead of calling this function directly, you can also cause an\n     * ActionBar using the overlay feature to hide through\n     * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}.\n     * Hiding the ActionBar through this system UI flag allows you to more\n     * seamlessly hide it in conjunction with other screen decorations.\n     */\n    hide():void {\n        this.setVisibility(View.GONE);\n    }\n\n    /**\n     * @return <code>true</code> if the ActionBar is showing, <code>false</code> otherwise.\n     */\n    isShowing():boolean{\n        return this.isShown();\n    }\n\n//    /**\n//     * Add a listener that will respond to menu visibility change events.\n//     *\n//     * @param listener The new listener to add\n//     */\n//    abstract\n//addOnMenuVisibilityListener(listener:ActionBar.OnMenuVisibilityListener):void ;\n//\n//    /**\n//     * Remove a menu visibility listener. This listener will no longer receive menu\n//     * visibility change events.\n//     *\n//     * @param listener A listener to remove that was previously added\n//     */\n//    abstract\n//removeOnMenuVisibilityListener(listener:ActionBar.OnMenuVisibilityListener):void ;\n//\n//    /**\n//     * Enable or disable the \"home\" button in the corner of the action bar. (Note that this\n//     * is the application home/up affordance on the action bar, not the systemwide home\n//     * button.)\n//     *\n//     * <p>This defaults to true for packages targeting &lt; API 14. For packages targeting\n//     * API 14 or greater, the application should call this method to enable interaction\n//     * with the home/up affordance.\n//     *\n//     * <p>Setting the {@link #DISPLAY_HOME_AS_UP} display option will automatically enable\n//     * the home button.\n//     *\n//     * @param enabled true to enable the home button, false to disable the home button.\n//     */\n//    setHomeButtonEnabled(enabled:boolean):void  {\n//    }\n//\n//    /**\n//     * Returns a {@link Context} with an appropriate theme for creating views that\n//     * will appear in the action bar. If you are inflating or instantiating custom views\n//     * that will appear in an action bar, you should use the Context returned by this method.\n//     * (This includes adapters used for list navigation mode.)\n//     * This will ensure that views contrast properly against the action bar.\n//     *\n//     * @return A themed Context for creating views\n//     */\n//    getThemedContext():Context  {\n//        return null;\n//    }\n//\n//    /**\n//     * Returns true if the Title field has been truncated during layout for lack\n//     * of available space.\n//     *\n//     * @return true if the Title field has been truncated\n//     * @hide pending API approval\n//     */\n//    isTitleTruncated():boolean  {\n//        return false;\n//    }\n//\n//    /**\n//     * Set an alternate drawable to display next to the icon/logo/title\n//     * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using\n//     * this mode to display an alternate selection for up navigation, such as a sliding drawer.\n//     *\n//     * <p>If you pass <code>null</code> to this method, the default drawable from the theme\n//     * will be used.</p>\n//     *\n//     * <p>If you implement alternate or intermediate behavior around Up, you should also\n//     * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()}\n//     * to provide a correct description of the action for accessibility support.</p>\n//     *\n//     * @param indicator A drawable to use for the up indicator, or null to use the theme's default\n//     *\n//     * @see #setDisplayOptions(int, int)\n//     * @see #setDisplayHomeAsUpEnabled(boolean)\n//     * @see #setHomeActionContentDescription(int)\n//     */\n//    setHomeAsUpIndicator(indicator:Drawable):void  {\n//    }\n//\n//    /**\n//     * Set an alternate drawable to display next to the icon/logo/title\n//     * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using\n//     * this mode to display an alternate selection for up navigation, such as a sliding drawer.\n//     *\n//     * <p>If you pass <code>0</code> to this method, the default drawable from the theme\n//     * will be used.</p>\n//     *\n//     * <p>If you implement alternate or intermediate behavior around Up, you should also\n//     * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()}\n//     * to provide a correct description of the action for accessibility support.</p>\n//     *\n//     * @param resId Resource ID of a drawable to use for the up indicator, or null\n//     *              to use the theme's default\n//     *\n//     * @see #setDisplayOptions(int, int)\n//     * @see #setDisplayHomeAsUpEnabled(boolean)\n//     * @see #setHomeActionContentDescription(int)\n//     */\n//    setHomeAsUpIndicator(resId:number):void  {\n//    }\n//\n//    /**\n//     * Set an alternate description for the Home/Up action, when enabled.\n//     *\n//     * <p>This description is commonly used for accessibility/screen readers when\n//     * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.)\n//     * Examples of this are, \"Navigate Home\" or \"Navigate Up\" depending on the\n//     * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up\n//     * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific\n//     * functionality such as a sliding drawer, you should also set this to accurately\n//     * describe the action.</p>\n//     *\n//     * <p>Setting this to <code>null</code> will use the system default description.</p>\n//     *\n//     * @param description New description for the Home action when enabled\n//     * @see #setHomeAsUpIndicator(int)\n//     * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable)\n//     */\n//    setHomeActionContentDescription(description:string):void  {\n//    }\n//\n//    /**\n//     * Set an alternate description for the Home/Up action, when enabled.\n//     *\n//     * <p>This description is commonly used for accessibility/screen readers when\n//     * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.)\n//     * Examples of this are, \"Navigate Home\" or \"Navigate Up\" depending on the\n//     * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up\n//     * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific\n//     * functionality such as a sliding drawer, you should also set this to accurately\n//     * describe the action.</p>\n//     *\n//     * <p>Setting this to <code>0</code> will use the system default description.</p>\n//     *\n//     * @param resId Resource ID of a string to use as the new description\n//     *              for the Home action when enabled\n//     * @see #setHomeAsUpIndicator(int)\n//     * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable)\n//     */\n//    setHomeActionContentDescription(resId:number):void  {\n//    }\n\n        //androidui add.\n        setActionLeft(name:string, icon:Drawable, listener:View.OnClickListener):void {\n            this.mActionLeft.setText(name);\n            this.mActionLeft.setVisibility(View.VISIBLE);\n            let drawables = this.mActionLeft.getCompoundDrawables();\n            icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());\n            this.mActionLeft.setCompoundDrawables(icon, drawables[1], drawables[2], drawables[3]);\n            this.mActionLeft.setOnClickListener(listener);\n        }\n        hideActionLeft():void {\n            this.mActionLeft.setVisibility(View.GONE);\n        }\n\n        setActionRight(name:string, icon:Drawable, listener:View.OnClickListener):void {\n            this.mActionRight.setText(name);\n            this.mActionRight.setVisibility(View.VISIBLE);\n            let drawables = this.mActionRight.getCompoundDrawables();\n            if(icon) icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());\n            this.mActionRight.setCompoundDrawables(drawables[0], drawables[1], icon, drawables[3]);\n            this.mActionRight.setOnClickListener(listener);\n        }\n        hideActionRight():void {\n            this.mActionRight.setVisibility(View.GONE);\n        }\n}\n\nexport module ActionBar{\n///**\n//     * Listener interface for ActionBar navigation events.\n//     */\n//export interface OnNavigationListener {\n//\n//    /**\n//         * This method is called whenever a navigation item in your action bar\n//         * is selected.\n//         *\n//         * @param itemPosition Position of the item clicked.\n//         * @param itemId ID of the item clicked.\n//         * @return True if the event was handled, false otherwise.\n//         */\n//    onNavigationItemSelected(itemPosition:number, itemId:number):boolean ;\n//}\n///**\n//     * Listener for receiving events when action bar menus are shown or hidden.\n//     */\n//export interface OnMenuVisibilityListener {\n//\n//    /**\n//         * Called when an action bar menu is shown or hidden. Applications may want to use\n//         * this to tune auto-hiding behavior for the action bar or pause/resume video playback,\n//         * gameplay, or other activity within the main content area.\n//         *\n//         * @param isVisible True if an action bar menu is now visible, false if no action bar\n//         *                  menus are visible.\n//         */\n//    onMenuVisibilityChanged(isVisible:boolean):void ;\n//}\n///**\n//     * A tab in the action bar.\n//     *\n//     * <p>Tabs manage the hiding and showing of {@link Fragment}s.\n//     */\n//export abstract\n//\n//class Tab {\n//\n//    /**\n//         * An invalid position for a tab.\n//         *\n//         * @see #getPosition()\n//         */\n//    static INVALID_POSITION:number = -1;\n//\n//    /**\n//         * Return the current position of this tab in the action bar.\n//         *\n//         * @return Current position, or {@link #INVALID_POSITION} if this tab is not currently in\n//         *         the action bar.\n//         */\n//    abstract\n//getPosition():number ;\n//\n//    /**\n//         * Return the icon associated with this tab.\n//         *\n//         * @return The tab's icon\n//         */\n//    abstract\n//getIcon():Drawable ;\n//\n//    /**\n//         * Return the text of this tab.\n//         *\n//         * @return The tab's text\n//         */\n//    abstract\n//getText():string ;\n//\n//    /**\n//         * Set the icon displayed on this tab.\n//         *\n//         * @param icon The drawable to use as an icon\n//         * @return The current instance for call chaining\n//         */\n//    abstract\n//setIcon(icon:Drawable):Tab ;\n//\n//    /**\n//         * Set the icon displayed on this tab.\n//         *\n//         * @param resId Resource ID referring to the drawable to use as an icon\n//         * @return The current instance for call chaining\n//         */\n//    abstract\n//setIcon(resId:number):Tab ;\n//\n//    /**\n//         * Set the text displayed on this tab. Text may be truncated if there is not\n//         * room to display the entire string.\n//         *\n//         * @param text The text to display\n//         * @return The current instance for call chaining\n//         */\n//    abstract\n//setText(text:string):Tab ;\n//\n//    /**\n//         * Set the text displayed on this tab. Text may be truncated if there is not\n//         * room to display the entire string.\n//         *\n//         * @param resId A resource ID referring to the text that should be displayed\n//         * @return The current instance for call chaining\n//         */\n//    abstract\n//setText(resId:number):Tab ;\n//\n//    /**\n//         * Set a custom view to be used for this tab. This overrides values set by\n//         * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}.\n//         *\n//         * @param view Custom view to be used as a tab.\n//         * @return The current instance for call chaining\n//         */\n//    abstract\n//setCustomView(view:View):Tab ;\n//\n//    /**\n//         * Set a custom view to be used for this tab. This overrides values set by\n//         * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}.\n//         *\n//         * @param layoutResId A layout resource to inflate and use as a custom tab view\n//         * @return The current instance for call chaining\n//         */\n//    abstract\n//setCustomView(layoutResId:number):Tab ;\n//\n//    /**\n//         * Retrieve a previously set custom view for this tab.\n//         *\n//         * @return The custom view set by {@link #setCustomView(View)}.\n//         */\n//    abstract\n//getCustomView():View ;\n//\n//    /**\n//         * Give this Tab an arbitrary object to hold for later use.\n//         *\n//         * @param obj Object to store\n//         * @return The current instance for call chaining\n//         */\n//    abstract\n//setTag(obj:any):Tab ;\n//\n//    /**\n//         * @return This Tab's tag object.\n//         */\n//    abstract\n//getTag():any ;\n//\n//    /**\n//         * Set the {@link TabListener} that will handle switching to and from this tab.\n//         * All tabs must have a TabListener set before being added to the ActionBar.\n//         *\n//         * @param listener Listener to handle tab selection events\n//         * @return The current instance for call chaining\n//         */\n//    abstract\n//setTabListener(listener:ActionBar.TabListener):Tab ;\n//\n//    /**\n//         * Select this tab. Only valid if the tab has been added to the action bar.\n//         */\n//    abstract\n//select():void ;\n//\n//    /**\n//         * Set a description of this tab's content for use in accessibility support.\n//         * If no content description is provided the title will be used.\n//         *\n//         * @param resId A resource ID referring to the description text\n//         * @return The current instance for call chaining\n//         * @see #setContentDescription(CharSequence)\n//         * @see #getContentDescription()\n//         */\n//    abstract\n//setContentDescription(resId:number):Tab ;\n//\n//    /**\n//         * Set a description of this tab's content for use in accessibility support.\n//         * If no content description is provided the title will be used.\n//         *\n//         * @param contentDesc Description of this tab's content\n//         * @return The current instance for call chaining\n//         * @see #setContentDescription(int)\n//         * @see #getContentDescription()\n//         */\n//    abstract\n//setContentDescription(contentDesc:string):Tab ;\n//\n//    /**\n//         * Gets a brief description of this tab's content for use in accessibility support.\n//         *\n//         * @return Description of this tab's content\n//         * @see #setContentDescription(CharSequence)\n//         * @see #setContentDescription(int)\n//         */\n//    abstract\n//getContentDescription():string ;\n//}\n///**\n//     * Callback interface invoked when a tab is focused, unfocused, added, or removed.\n//     */\n//export interface TabListener {\n//\n//    /**\n//         * Called when a tab enters the selected state.\n//         *\n//         * @param tab The tab that was selected\n//         * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute\n//         *        during a tab switch. The previous tab's unselect and this tab's select will be\n//         *        executed in a single transaction. This FragmentTransaction does not support\n//         *        being added to the back stack.\n//         */\n//    onTabSelected(tab:ActionBar.Tab, ft:FragmentTransaction):void ;\n//\n//    /**\n//         * Called when a tab exits the selected state.\n//         *\n//         * @param tab The tab that was unselected\n//         * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute\n//         *        during a tab switch. This tab's unselect and the newly selected tab's select\n//         *        will be executed in a single transaction. This FragmentTransaction does not\n//         *        support being added to the back stack.\n//         */\n//    onTabUnselected(tab:ActionBar.Tab, ft:FragmentTransaction):void ;\n//\n//    /**\n//         * Called when a tab that is already selected is chosen again by the user.\n//         * Some applications may use this action to return to the top level of a category.\n//         *\n//         * @param tab The tab that was reselected.\n//         * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute\n//         *        once this method returns. This FragmentTransaction does not support\n//         *        being added to the back stack.\n//         */\n//    onTabReselected(tab:ActionBar.Tab, ft:FragmentTransaction):void ;\n//}\n///**\n//     * Per-child layout information associated with action bar custom views.\n//     *\n//     * @attr ref android.R.styleable#ActionBar_LayoutParams_layout_gravity\n//     */\n//export class LayoutParams extends MarginLayoutParams {\n//\n//    /**\n//         * Gravity for the view associated with these LayoutParams.\n//         *\n//         * @see android.view.Gravity\n//         */\n//    gravity:number = Gravity.NO_GRAVITY;\n//\n//    //constructor( c:Context, attrs:AttributeSet) {\n//    //    super(c, attrs);\n//    //    let a:TypedArray = c.obtainStyledAttributes(attrs, com.android.internal.R.styleable.ActionBar_LayoutParams);\n//    //    gravity = a.getInt(com.android.internal.R.styleable.ActionBar_LayoutParams_layout_gravity, Gravity.NO_GRAVITY);\n//    //    a.recycle();\n//    //}\n//\n//    constructor( width:number, height:number) {\n//        super(width, height);\n//        this.gravity = Gravity.CENTER_VERTICAL | Gravity.START;\n//    }\n//\n//    constructor( width:number, height:number, gravity:number) {\n//        super(width, height);\n//        this.gravity = gravity;\n//    }\n//\n//    constructor( gravity:number) {\n//        this(WRAP_CONTENT, MATCH_PARENT, gravity);\n//    }\n//\n//    constructor( source:LayoutParams) {\n//        super(source);\n//        this.gravity = source.gravity;\n//    }\n//\n//    constructor( source:ViewGroup.LayoutParams) {\n//        super(source);\n//    }\n//}\n}\n\n}"
  },
  {
    "path": "src/android/app/ActionBarActivity.ts",
    "content": "/**\n * Created by linfaxin on 16/1/21.\n * androidui NOTE: ActionBarActivity is not same style as android's\n */\n///<reference path=\"Activity.ts\"/>\n///<reference path=\"ActionBar.ts\"/>\n\n\nmodule android.app {\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import MarginLayoutParams = android.view.ViewGroup.MarginLayoutParams;\n\n    export class ActionBarActivity extends Activity {\n        private mActionBar:ActionBar;\n\n        protected onCreate(savedInstanceState?:android.os.Bundle):void {\n            super.onCreate(savedInstanceState);\n            this.initActionBar();\n        }\n\n        private initActionBar(){\n            this.setActionBar(new ActionBar(this));\n            this.initDefaultBackFinish();\n        }\n\n        private initDefaultBackFinish(){\n            if(this.androidUI.mActivityThread.mLaunchedActivities.size === 0) return;//xxx not do check here\n            const activity = this;\n            this.mActionBar.setActionLeft(android.R.string_.back, android.R.image.actionbar_ic_back_white, {\n                onClick(view:View){\n                    activity.finish();\n                }\n            });\n        }\n\n        setActionBar(actionBar:ActionBar){\n            const activity = this;\n            let w = this.getWindow();\n            let decorView:ViewGroup = w.mDecor;\n            this.mActionBar = actionBar;\n            decorView.addView(actionBar, -1, -2);\n            const onMeasure = decorView.onMeasure;\n            decorView.onMeasure = (widthMeasureSpec:number, heightMeasureSpec:number)=>{\n                onMeasure.call(decorView, widthMeasureSpec, heightMeasureSpec);\n                if(activity.mActionBar === actionBar){\n                    let params = <MarginLayoutParams>w.mContentParent.getLayoutParams();\n                    if(params.topMargin != actionBar.getMeasuredHeight()){\n                        params.topMargin = actionBar.getMeasuredHeight();\n                        onMeasure.call(decorView, widthMeasureSpec, heightMeasureSpec);\n                    }\n                }\n            };\n        }\n\n\n        protected invalidateOptionsMenuPopupHelper(menu:android.view.Menu):android.view.menu.MenuPopupHelper {\n            let menuPopuoHelper = new android.view.menu.MenuPopupHelper(this, menu, this.getActionBar().mActionRight);\n            if(menu.hasVisibleItems()){\n                this.getActionBar().setActionRight('', android.R.image.ic_menu_moreoverflow_normal_holo_dark, {\n                    onClick: function (view) {\n                        menuPopuoHelper.show();\n                    }\n                });\n            }\n            return menuPopuoHelper;\n        }\n\n        getActionBar():ActionBar {\n            return this.mActionBar;\n        }\n\n        protected onTitleChanged(title:string, color:number):void {\n            super.onTitleChanged(title, color);\n            this.mActionBar.setTitle(title);\n        }\n    }\n}"
  },
  {
    "path": "src/android/app/Activity.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../view/Window.ts\"/>\n///<reference path=\"../view/WindowManager.ts\"/>\n///<reference path=\"../content/Context.ts\"/>\n///<reference path=\"../view/View.ts\"/>\n///<reference path=\"../view/ViewGroup.ts\"/>\n///<reference path=\"../view/ViewRootImpl.ts\"/>\n///<reference path=\"../view/KeyEvent.ts\"/>\n///<reference path=\"../view/animation/Animation.ts\"/>\n///<reference path=\"../widget/FrameLayout.ts\"/>\n///<reference path=\"../view/MotionEvent.ts\"/>\n///<reference path=\"../view/LayoutInflater.ts\"/>\n///<reference path=\"../os/Bundle.ts\"/>\n///<reference path=\"../os/Handler.ts\"/>\n///<reference path=\"../util/Log.ts\"/>\n///<reference path=\"../content/Intent.ts\"/>\n///<reference path=\"../../androidui/AndroidUI.ts\"/>\n///<reference path=\"../../java/lang/Runnable.ts\"/>\n\nmodule android.app{\n    import AndroidUI = androidui.AndroidUI;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import ViewRootImpl = android.view.ViewRootImpl;\n    import KeyEvent = android.view.KeyEvent;\n    import Animation = android.view.animation.Animation;\n    import FrameLayout = android.widget.FrameLayout;\n    import MotionEvent = android.view.MotionEvent;\n    import Window = android.view.Window;\n    import WindowManager = android.view.WindowManager;\n    import LayoutInflater = android.view.LayoutInflater;\n    import Bundle = android.os.Bundle;\n    import Handler = android.os.Handler;\n    import Log = android.util.Log;\n    import Context = android.content.Context;\n    import Intent = android.content.Intent;\n    import Runnable = java.lang.Runnable;\n\n    export class Activity extends Context implements Window.Callback, KeyEvent.Callback{\n\n        private static TAG:string = \"Activity\";\n\n        private static DEBUG_LIFECYCLE:boolean = false;\n\n        /** Standard activity result: operation canceled. */\n        static RESULT_CANCELED:number = 0;\n\n        /** Standard activity result: operation succeeded. */\n        static RESULT_OK:number = -1;\n\n        /** Start of user-defined activity results. */\n        static RESULT_FIRST_USER:number = 1;\n\n        private mCallActivity:Activity;//activity that launch the activity (will null if restore)\n\n        private mIntent:Intent;\n\n        private mCalled:boolean;\n\n        private mResumed:boolean;\n\n        private mStopped:boolean;\n\n        private mFinished:boolean;\n\n        private mStartedActivity:boolean;\n\n        private mDestroyed:boolean;\n\n        private mWindow:Window;\n\n        private mWindowAdded:boolean = false;\n\n        private mVisibleFromClient:boolean = true;\n\n        private mResultCode:number = Activity.RESULT_CANCELED;\n\n        private mResultData:Intent = null;\n\n        private mMenu:android.view.Menu;\n        private mMenuPopuoHelper:android.view.menu.MenuPopupHelper;\n\n        //mHandler:Handler = new Handler();\n\n        /** Return the intent that started this activity. */\n        getIntent():Intent  {\n            return this.mIntent;\n        }\n\n        /**\n         * Change the intent returned by {@link #getIntent}.  This holds a\n         * reference to the given intent; it does not copy it.  Often used in\n         * conjunction with {@link #onNewIntent}.\n         *\n         * @param newIntent The new Intent object to return from getIntent\n         *\n         * @see #getIntent\n         * @see #onNewIntent\n         */\n        setIntent(newIntent:Intent):void  {\n            this.mIntent = newIntent;\n        }\n\n        /** Return the application that owns this activity. */\n        getApplication():android.app.Application  {\n            return this.getApplicationContext();\n        }\n\n        /**\n         * Retrieve the window manager for showing custom windows.\n         * NOTE: all windows will add to this activity's window.\n         * @see getGlobalWindowManager\n         */\n        getWindowManager():android.view.WindowManager{\n            return this.mWindow.getChildWindowManager();\n        }\n\n        /**\n         * Retrieve the window manager for application\n         * NOTE: all windows will add to application level, same as activity\n         * @see getWindowManager\n         */\n        getGlobalWindowManager():android.view.WindowManager{\n            return this.getApplicationContext().getWindowManager();\n        }\n\n        /**\n         * Retrieve the current {@link android.view.Window} for the activity.\n         * This can be used to directly access parts of the Window API that\n         * are not available through Activity/Screen.\n         *\n         * @return Window The current window, or null if the activity is not\n         *         visual.\n         */\n        getWindow():Window  {\n            return this.mWindow;\n        }\n\n        /**\n         * Calls {@link android.view.Window#getCurrentFocus} on the\n         * Window of this Activity to return the currently focused view.\n         *\n         * @return View The current View with focus or null.\n         *\n         * @see #getWindow\n         * @see android.view.Window#getCurrentFocus\n         */\n        getCurrentFocus():View  {\n            return this.mWindow != null ? this.mWindow.getCurrentFocus() : null;\n        }\n\n\n        /**\n         * Called when the activity is starting.  This is where most initialization\n         * should go: calling {@link #setContentView(int)} to inflate the\n         * activity's UI, using {@link #findViewById} to programmatically interact\n         * with widgets in the UI, calling\n         * {@link #managedQuery(android.net.Uri , String[], String, String[], String)} to retrieve\n         * cursors for data being displayed, etc.\n         *\n         * <p>You can call {@link #finish} from within this function, in\n         * which case onDestroy() will be immediately called without any of the rest\n         * of the activity lifecycle ({@link #onStart}, {@link #onResume},\n         * {@link #onPause}, etc) executing.\n         *\n         * <p><em>Derived classes must call through to the super class's\n         * implementation of this method.  If they do not, an exception will be\n         * thrown.</em></p>\n         *\n         * @param savedInstanceState If the activity is being re-initialized after\n         *     previously being shut down then this Bundle contains the data it most\n         *     recently supplied in {@link #onSaveInstanceState}.  <b><i>Note: Otherwise it is null.</i></b>\n         *\n         * @see #onStart\n         * @see #onSaveInstanceState\n         * @see #onRestoreInstanceState\n         * @see #onPostCreate\n         */\n        protected onCreate(savedInstanceState?:Bundle):void  {\n            if (Activity.DEBUG_LIFECYCLE) Log.v(Activity.TAG, \"onCreate \" + this + \": \" + savedInstanceState);\n            //if (this.mLastNonConfigurationInstances != null) {\n            //    this.mAllLoaderManagers = this.mLastNonConfigurationInstances.loaders;\n            //}\n            //if (this.mActivityInfo.parentActivityName != null) {\n            //    if (this.mActionBar == null) {\n            //        this.mEnableDefaultActionBarUp = true;\n            //    } else {\n            //        this.mActionBar.setDefaultDisplayHomeAsUpEnabled(true);\n            //    }\n            //}\n            //if (savedInstanceState != null) {\n            //    let p:Parcelable = savedInstanceState.getParcelable(Activity.FRAGMENTS_TAG);\n            //    this.mFragments.restoreAllState(p, this.mLastNonConfigurationInstances != null ? this.mLastNonConfigurationInstances.fragments : null);\n            //}\n            //this.mFragments.dispatchCreate();\n            this.getApplication().dispatchActivityCreated(this, savedInstanceState);\n            this.mCalled = true;\n        }\n\n        /**\n         * The hook for {@link ActivityThread} to restore the state of this activity.\n         *\n         * Calls {@link #onSaveInstanceState(android.os.Bundle)} and\n         * {@link #restoreManagedDialogs(android.os.Bundle)}.\n         *\n         * @param savedInstanceState contains the saved state\n         */\n        performRestoreInstanceState(savedInstanceState:Bundle):void  {\n            this.onRestoreInstanceState(savedInstanceState);\n            //this.restoreManagedDialogs(savedInstanceState);\n        }\n\n        /**\n         * This method is called after {@link #onStart} when the activity is\n         * being re-initialized from a previously saved state, given here in\n         * <var>savedInstanceState</var>.  Most implementations will simply use {@link #onCreate}\n         * to restore their state, but it is sometimes convenient to do it here\n         * after all of the initialization has been done or to allow subclasses to\n         * decide whether to use your default implementation.  The default\n         * implementation of this method performs a restore of any view state that\n         * had previously been frozen by {@link #onSaveInstanceState}.\n         *\n         * <p>This method is called between {@link #onStart} and\n         * {@link #onPostCreate}.\n         *\n         * @param savedInstanceState the data most recently supplied in {@link #onSaveInstanceState}.\n         *\n         * @see #onCreate\n         * @see #onPostCreate\n         * @see #onResume\n         * @see #onSaveInstanceState\n         */\n        protected onRestoreInstanceState(savedInstanceState:Bundle):void  {\n            //TODO restoreHierarchyState?\n            //if (this.mWindow != null) {\n            //    let windowState:Bundle = savedInstanceState.getBundle(Activity.WINDOW_HIERARCHY_TAG);\n            //    if (windowState != null) {\n            //        this.mWindow.restoreHierarchyState(windowState);\n            //    }\n            //}\n        }\n\n\n        /**\n         * Called when activity start-up is complete (after {@link #onStart}\n         * and {@link #onRestoreInstanceState} have been called).  Applications will\n         * generally not implement this method; it is intended for system\n         * classes to do final initialization after application code has run.\n         *\n         * <p><em>Derived classes must call through to the super class's\n         * implementation of this method.  If they do not, an exception will be\n         * thrown.</em></p>\n         *\n         * @param savedInstanceState If the activity is being re-initialized after\n         *     previously being shut down then this Bundle contains the data it most\n         *     recently supplied in {@link #onSaveInstanceState}.  <b><i>Note: Otherwise it is null.</i></b>\n         * @see #onCreate\n         */\n        protected onPostCreate(savedInstanceState:Bundle):void  {\n            //if (!this.isChild()) {\n            //    this.mTitleReady = true;\n                this.onTitleChanged(this.getTitle());\n            //}\n            this.mCalled = true;\n        }\n\n        /**\n         * Called after {@link #onCreate} &mdash; or after {@link #onRestart} when\n         * the activity had been stopped, but is now again being displayed to the\n         * user.  It will be followed by {@link #onResume}.\n         *\n         * <p><em>Derived classes must call through to the super class's\n         * implementation of this method.  If they do not, an exception will be\n         * thrown.</em></p>\n         *\n         * @see #onCreate\n         * @see #onStop\n         * @see #onResume\n         */\n        protected onStart():void  {\n            if (Activity.DEBUG_LIFECYCLE) Log.v(Activity.TAG, \"onStart \" + this);\n            this.mCalled = true;\n            //if (!this.mLoadersStarted) {\n            //    this.mLoadersStarted = true;\n            //    if (this.mLoaderManager != null) {\n            //        this.mLoaderManager.doStart();\n            //    } else if (!this.mCheckedForLoaderManager) {\n            //        this.mLoaderManager = this.getLoaderManager(\"(root)\", this.mLoadersStarted, false);\n            //    }\n            //    this.mCheckedForLoaderManager = true;\n            //}\n            this.getApplication().dispatchActivityStarted(this);\n        }\n\n        /**\n         * Called after {@link #onStop} when the current activity is being\n         * re-displayed to the user (the user has navigated back to it).  It will\n         * be followed by {@link #onStart} and then {@link #onResume}.\n         *\n         * <p>For activities that are using raw {@link Cursor} objects (instead of\n         * creating them through\n         * {@link #managedQuery(android.net.Uri , String[], String, String[], String)},\n         * this is usually the place\n         * where the cursor should be requeried (because you had deactivated it in\n         * {@link #onStop}.\n         *\n         * <p><em>Derived classes must call through to the super class's\n         * implementation of this method.  If they do not, an exception will be\n         * thrown.</em></p>\n         *\n         * @see #onStop\n         * @see #onStart\n         * @see #onResume\n         */\n        protected onRestart():void  {\n            this.mCalled = true;\n        }\n\n\n        /**\n         * Called after {@link #onRestoreInstanceState}, {@link #onRestart}, or\n         * {@link #onPause}, for your activity to start interacting with the user.\n         * This is a good place to begin animations, open exclusive-access devices\n         * (such as the camera), etc.\n         *\n         * <p>Keep in mind that onResume is not the best indicator that your activity\n         * is visible to the user; a system window such as the keyguard may be in\n         * front.  Use {@link #onWindowFocusChanged} to know for certain that your\n         * activity is visible to the user (for example, to resume a game).\n         *\n         * <p><em>Derived classes must call through to the super class's\n         * implementation of this method.  If they do not, an exception will be\n         * thrown.</em></p>\n         *\n         * @see #onRestoreInstanceState\n         * @see #onRestart\n         * @see #onPostResume\n         * @see #onPause\n         */\n        protected onResume():void  {\n            if (Activity.DEBUG_LIFECYCLE) Log.v(Activity.TAG, \"onResume \" + this);\n            this.getApplication().dispatchActivityResumed(this);\n            this.mCalled = true;\n        }\n\n\n        /**\n         * Called when activity resume is complete (after {@link #onResume} has\n         * been called). Applications will generally not implement this method;\n         * it is intended for system classes to do final setup after application\n         * resume code has run.\n         *\n         * <p><em>Derived classes must call through to the super class's\n         * implementation of this method.  If they do not, an exception will be\n         * thrown.</em></p>\n         *\n         * @see #onResume\n         */\n        protected onPostResume():void  {\n            const win:Window = this.getWindow();\n            if (win != null) win.makeActive();\n            //if (this.mActionBar != null) this.mActionBar.setShowHideAnimationEnabled(true);\n            this.mCalled = true;\n        }\n\n        /**\n         * This is called for activities that set launchMode to \"singleTop\" in\n         * their package, or if a client used the {@link Intent#FLAG_ACTIVITY_SINGLE_TOP}\n         * flag when calling {@link #startActivity}.  In either case, when the\n         * activity is re-launched while at the top of the activity stack instead\n         * of a new instance of the activity being started, onNewIntent() will be\n         * called on the existing instance with the Intent that was used to\n         * re-launch it.\n         *\n         * <p>An activity will always be paused before receiving a new intent, so\n         * you can count on {@link #onResume} being called after this method.\n         *\n         * <p>Note that {@link #getIntent} still returns the original Intent.  You\n         * can use {@link #setIntent} to update it to this new Intent.\n         *\n         * @param intent The new intent that was started for the activity.\n         *\n         * @see #getIntent\n         * @see #setIntent\n         * @see #onResume\n         */\n        protected onNewIntent(intent:Intent):void  {\n        }\n\n        /**\n         * The hook for {@link ActivityThread} to save the state of this activity.\n         *\n         * Calls {@link #onSaveInstanceState(android.os.Bundle)}\n         * and {@link #saveManagedDialogs(android.os.Bundle)}.\n         *\n         * @param outState The bundle to save the state to.\n         */\n        performSaveInstanceState(outState:Bundle):void  {\n            this.onSaveInstanceState(outState);\n            //this.saveManagedDialogs(outState);\n            if (Activity.DEBUG_LIFECYCLE) Log.v(Activity.TAG, \"onSaveInstanceState \" + this + \": \" + outState);\n        }\n\n\n        /**\n         * Called to retrieve per-instance state from an activity before being killed\n         * so that the state can be restored in {@link #onCreate} or\n         * {@link #onRestoreInstanceState} (the {@link Bundle} populated by this method\n         * will be passed to both).\n         *\n         * <p>This method is called before an activity may be killed so that when it\n         * comes back some time in the future it can restore its state.  For example,\n         * if activity B is launched in front of activity A, and at some point activity\n         * A is killed to reclaim resources, activity A will have a chance to save the\n         * current state of its user interface via this method so that when the user\n         * returns to activity A, the state of the user interface can be restored\n         * via {@link #onCreate} or {@link #onRestoreInstanceState}.\n         *\n         * <p>Do not confuse this method with activity lifecycle callbacks such as\n         * {@link #onPause}, which is always called when an activity is being placed\n         * in the background or on its way to destruction, or {@link #onStop} which\n         * is called before destruction.  One example of when {@link #onPause} and\n         * {@link #onStop} is called and not this method is when a user navigates back\n         * from activity B to activity A: there is no need to call {@link #onSaveInstanceState}\n         * on B because that particular instance will never be restored, so the\n         * system avoids calling it.  An example when {@link #onPause} is called and\n         * not {@link #onSaveInstanceState} is when activity B is launched in front of activity A:\n         * the system may avoid calling {@link #onSaveInstanceState} on activity A if it isn't\n         * killed during the lifetime of B since the state of the user interface of\n         * A will stay intact.\n         *\n         * <p>The default implementation takes care of most of the UI per-instance\n         * state for you by calling {@link android.view.View#onSaveInstanceState()} on each\n         * view in the hierarchy that has an id, and by saving the id of the currently\n         * focused view (all of which is restored by the default implementation of\n         * {@link #onRestoreInstanceState}).  If you override this method to save additional\n         * information not captured by each individual view, you will likely want to\n         * call through to the default implementation, otherwise be prepared to save\n         * all of the state of each view yourself.\n         *\n         * <p>If called, this method will occur before {@link #onStop}.  There are\n         * no guarantees about whether it will occur before or after {@link #onPause}.\n         *\n         * @param outState Bundle in which to place your saved state.\n         *\n         * @see #onCreate\n         * @see #onRestoreInstanceState\n         * @see #onPause\n         */\n        protected onSaveInstanceState(outState:Bundle):void  {\n            //outState.putBundle(Activity.WINDOW_HIERARCHY_TAG, this.mWindow.saveHierarchyState());\n            //let p:Parcelable = this.mFragments.saveAllState();\n            //if (p != null) {\n            //    outState.putParcelable(Activity.FRAGMENTS_TAG, p);\n            //}\n            this.getApplication().dispatchActivitySaveInstanceState(this, outState);\n        }\n\n\n        /**\n         * Called as part of the activity lifecycle when an activity is going into\n         * the background, but has not (yet) been killed.  The counterpart to\n         * {@link #onResume}.\n         *\n         * <p>When activity B is launched in front of activity A, this callback will\n         * be invoked on A.  B will not be created until A's {@link #onPause} returns,\n         * so be sure to not do anything lengthy here.\n         *\n         * <p>This callback is mostly used for saving any persistent state the\n         * activity is editing, to present a \"edit in place\" model to the user and\n         * making sure nothing is lost if there are not enough resources to start\n         * the new activity without first killing this one.  This is also a good\n         * place to do things like stop animations and other things that consume a\n         * noticeable amount of CPU in order to make the switch to the next activity\n         * as fast as possible, or to close resources that are exclusive access\n         * such as the camera.\n         *\n         * <p>In situations where the system needs more memory it may kill paused\n         * processes to reclaim resources.  Because of this, you should be sure\n         * that all of your state is saved by the time you return from\n         * this function.  In general {@link #onSaveInstanceState} is used to save\n         * per-instance state in the activity and this method is used to store\n         * global persistent data (in content providers, files, etc.)\n         *\n         * <p>After receiving this call you will usually receive a following call\n         * to {@link #onStop} (after the next activity has been resumed and\n         * displayed), however in some cases there will be a direct call back to\n         * {@link #onResume} without going through the stopped state.\n         *\n         * <p><em>Derived classes must call through to the super class's\n         * implementation of this method.  If they do not, an exception will be\n         * thrown.</em></p>\n         *\n         * @see #onResume\n         * @see #onSaveInstanceState\n         * @see #onStop\n         */\n        protected onPause():void  {\n            if (Activity.DEBUG_LIFECYCLE) Log.v(Activity.TAG, \"onPause \" + this);\n            this.getApplication().dispatchActivityPaused(this);\n            this.mCalled = true;\n        }\n\n        /**\n         * AndroidUI:call when app into the background\n         */\n        protected onUserLeaveHint():void  {\n        }\n\n        /**\n         * Called when you are no longer visible to the user.  You will next\n         * receive either {@link #onRestart}, {@link #onDestroy}, or nothing,\n         * depending on later user activity.\n         *\n         * <p>Note that this method may never be called, in low memory situations\n         * where the system does not have enough memory to keep your activity's\n         * process running after its {@link #onPause} method is called.\n         *\n         * <p><em>Derived classes must call through to the super class's\n         * implementation of this method.  If they do not, an exception will be\n         * thrown.</em></p>\n         *\n         * @see #onRestart\n         * @see #onResume\n         * @see #onSaveInstanceState\n         * @see #onDestroy\n         */\n        protected onStop():void  {\n            if (Activity.DEBUG_LIFECYCLE) Log.v(Activity.TAG, \"onStop \" + this);\n            //if (this.mActionBar != null) this.mActionBar.setShowHideAnimationEnabled(false);\n            this.getApplication().dispatchActivityStopped(this);\n            //this.mTranslucentCallback = null;\n            this.mCalled = true;\n        }\n\n\n        /**\n         * Perform any final cleanup before an activity is destroyed.  This can\n         * happen either because the activity is finishing (someone called\n         * {@link #finish} on it, or because the system is temporarily destroying\n         * this instance of the activity to save space.  You can distinguish\n         * between these two scenarios with the {@link #isFinishing} method.\n         *\n         * <p><em>Note: do not count on this method being called as a place for\n         * saving data! For example, if an activity is editing data in a content\n         * provider, those edits should be committed in either {@link #onPause} or\n         * {@link #onSaveInstanceState}, not here.</em> This method is usually implemented to\n         * free resources like threads that are associated with an activity, so\n         * that a destroyed activity does not leave such things around while the\n         * rest of its application is still running.  There are situations where\n         * the system will simply kill the activity's hosting process without\n         * calling this method (or any others) in it, so it should not be used to\n         * do things that are intended to remain around after the process goes\n         * away.\n         *\n         * <p><em>Derived classes must call through to the super class's\n         * implementation of this method.  If they do not, an exception will be\n         * thrown.</em></p>\n         *\n         * @see #onPause\n         * @see #onStop\n         * @see #finish\n         * @see #isFinishing\n         */\n        protected onDestroy():void  {\n            if (Activity.DEBUG_LIFECYCLE) Log.v(Activity.TAG, \"onDestroy \" + this);\n            this.mCalled = true;\n            //// dismiss any dialogs we are managing.\n            //if (this.mManagedDialogs != null) {\n            //    const numDialogs:number = this.mManagedDialogs.size();\n            //    for (let i:number = 0; i < numDialogs; i++) {\n            //        const md:Activity.ManagedDialog = this.mManagedDialogs.valueAt(i);\n            //        if (md.mDialog.isShowing()) {\n            //            md.mDialog.dismiss();\n            //        }\n            //    }\n            //    this.mManagedDialogs = null;\n            //}\n            //// close any cursors we are managing.\n            //{\n            //    let numCursors:number = this.mManagedCursors.size();\n            //    for (let i:number = 0; i < numCursors; i++) {\n            //        let c:Activity.ManagedCursor = this.mManagedCursors.get(i);\n            //        if (c != null) {\n            //            c.mCursor.close();\n            //        }\n            //    }\n            //    this.mManagedCursors.clear();\n            //}\n            //// Close any open search dialog\n            //if (this.mSearchManager != null) {\n            //    this.mSearchManager.stopSearch();\n            //}\n            this.getApplication().dispatchActivityDestroyed(this);\n        }\n\n        /**\n         * Finds a view that was identified by the id attribute from the XML that\n         * was processed in {@link #onCreate}.\n         *\n         * @return The view if found or null otherwise.\n         */\n        findViewById(id:string):View  {\n            return this.getWindow().findViewById(id);\n        }\n\n        /**\n         * Set the activity content to an explicit view.  This view is placed\n         * directly into the activity's view hierarchy.  It can itself be a complex\n         * view hierarchy.  When calling this method, the layout parameters of the\n         * specified view are ignored.  Both the width and the height of the view are\n         * set by default to {@link ViewGroup.LayoutParams#MATCH_PARENT}. To use\n         * your own layout parameters, invoke\n         * {@link #setContentView(android.view.View, android.view.ViewGroup.LayoutParams)}\n         * instead.\n         *\n         * @param view The desired content to display.\n         *\n         * @see #setContentView(int)\n         * @see #setContentView(android.view.View, android.view.ViewGroup.LayoutParams)\n         */\n        setContentView(view:View|HTMLElement|string, params?:ViewGroup.LayoutParams){\n            if(!(view instanceof View)){\n                view = this.getLayoutInflater().inflate(<HTMLElement|string>view);\n            }\n            this.getWindow().setContentView(<View>view, params);\n            //this.initActionBar();\n        }\n\n        addContentView(view:View, params:ViewGroup.LayoutParams){\n            this.mWindow.addContentView(view, params);\n        }\n\n        /**\n         * Sets whether this activity is finished when touched outside its window's\n         * bounds.\n         */\n        setFinishOnTouchOutside(finish:boolean):void  {\n            this.mWindow.setCloseOnTouchOutside(finish);\n        }\n\n\n        /**\n         * Called when a key was pressed down and not handled by any of the views\n         * inside of the activity. So, for example, key presses while the cursor\n         * is inside a TextView will not trigger the event (unless it is a navigation\n         * to another object) because TextView handles its own key presses.\n         *\n         * <p>If the focused view didn't want this event, this method is called.\n         *\n         * <p>The default implementation takes care of {@link KeyEvent#KEYCODE_BACK}\n         * by calling {@link #onBackPressed()}, though the behavior varies based\n         * on the application compatibility mode: for\n         * {@link android.os.Build.VERSION_CODES#ECLAIR} or later applications,\n         * it will set up the dispatch to call {@link #onKeyUp} where the action\n         * will be performed; for earlier applications, it will perform the\n         * action immediately in on-down, as those versions of the platform\n         * behaved.\n         *\n         * <p>Other additional default key handling may be performed\n         * if configured with {@link #setDefaultKeyMode}.\n         *\n         * @return Return <code>true</code> to prevent this event from being propagated\n         * further, or <code>false</code> to indicate that you have not handled\n         * this event and it should continue to be propagated.\n         * @see #onKeyUp\n         * @see android.view.KeyEvent\n         */\n        onKeyDown(keyCode:number, event:KeyEvent):boolean  {\n            if (keyCode == KeyEvent.KEYCODE_BACK) {\n                event.startTracking();\n                return true;\n            }\n            //if (this.mDefaultKeyMode == Activity.DEFAULT_KEYS_DISABLE) {\n            //    return false;\n            //} else if (this.mDefaultKeyMode == Activity.DEFAULT_KEYS_SHORTCUT) {\n            //    if (this.getWindow().performPanelShortcut(Window.FEATURE_OPTIONS_PANEL, keyCode, event, Menu.FLAG_ALWAYS_PERFORM_CLOSE)) {\n            //        return true;\n            //    }\n            //    return false;\n            //} else {\n            //    // Common code for DEFAULT_KEYS_DIALER & DEFAULT_KEYS_SEARCH_*\n            //    let clearSpannable:boolean = false;\n            //    let handled:boolean;\n            //    if ((event.getRepeatCount() != 0) || event.isSystem()) {\n            //        clearSpannable = true;\n            //        handled = false;\n            //    } else {\n            //        handled = TextKeyListener.getInstance().onKeyDown(null, this.mDefaultKeySsb, keyCode, event);\n            //        if (handled && this.mDefaultKeySsb.length() > 0) {\n            //            // something useable has been typed - dispatch it now.\n            //            const str:string = this.mDefaultKeySsb.toString();\n            //            clearSpannable = true;\n            //            switch(this.mDefaultKeyMode) {\n            //                case Activity.DEFAULT_KEYS_DIALER:\n            //                    let intent:Intent = new Intent(Intent.ACTION_DIAL, Uri.parse(\"tel:\" + str));\n            //                    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\n            //                    this.startActivity(intent);\n            //                    break;\n            //                case Activity.DEFAULT_KEYS_SEARCH_LOCAL:\n            //                    this.startSearch(str, false, null, false);\n            //                    break;\n            //                case Activity.DEFAULT_KEYS_SEARCH_GLOBAL:\n            //                    this.startSearch(str, false, null, true);\n            //                    break;\n            //            }\n            //        }\n            //    }\n            //    if (clearSpannable) {\n            //        this.mDefaultKeySsb.clear();\n            //        this.mDefaultKeySsb.clearSpans();\n            //        Selection.setSelection(this.mDefaultKeySsb, 0);\n            //    }\n            //    return handled;\n            //}\n            return false;\n        }\n\n        /**\n         * Default implementation of {@link KeyEvent.Callback#onKeyLongPress(int, KeyEvent)\n         * KeyEvent.Callback.onKeyLongPress()}: always returns false (doesn't handle\n         * the event).\n         */\n        onKeyLongPress(keyCode:number, event:KeyEvent):boolean  {\n            return false;\n        }\n\n        /**\n         * Called when a key was released and not handled by any of the views\n         * inside of the activity. So, for example, key presses while the cursor\n         * is inside a TextView will not trigger the event (unless it is a navigation\n         * to another object) because TextView handles its own key presses.\n         *\n         * <p>The default implementation handles KEYCODE_BACK to stop the activity\n         * and go back.\n         *\n         * @return Return <code>true</code> to prevent this event from being propagated\n         * further, or <code>false</code> to indicate that you have not handled\n         * this event and it should continue to be propagated.\n         * @see #onKeyDown\n         * @see KeyEvent\n         */\n        onKeyUp(keyCode:number, event:KeyEvent):boolean  {\n            if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() && !event.isCanceled()) {\n                this.onBackPressed();\n                return true;\n            }\n            return false;\n        }\n\n        /**\n         * Called when the activity has detected the user's press of the back\n         * key.  The default implementation simply finishes the current activity,\n         * but you can override this to do whatever you want.\n         */\n        onBackPressed():void  {\n            //if (!this.mFragments.popBackStackImmediate()) {\n                this.finish();\n            //}\n        }\n\n        /**\n         * Called when a touch screen event was not handled by any of the views\n         * under it.  This is most useful to process touch events that happen\n         * outside of your window bounds, where there is no view to receive it.\n         *\n         * @param event The touch screen event being processed.\n         *\n         * @return Return true if you have consumed the event, false if you haven't.\n         * The default implementation always returns false.\n         */\n        onTouchEvent(event:MotionEvent):boolean  {\n            if (this.mWindow.shouldCloseOnTouch(this, event)) {\n                this.finish();\n                return true;\n            }\n            return false;\n        }\n\n        /**\n         * Called when a generic motion event was not handled by any of the\n         * views inside of the activity.\n         * <p>\n         * Generic motion events describe joystick movements, mouse hovers, track pad\n         * touches, scroll wheel movements and other input events.  The\n         * {@link MotionEvent#getSource() source} of the motion event specifies\n         * the class of input that was received.  Implementations of this method\n         * must examine the bits in the source before processing the event.\n         * The following code example shows how this is done.\n         * </p><p>\n         * Generic motion events with source class\n         * {@link android.view.InputDevice#SOURCE_CLASS_POINTER}\n         * are delivered to the view under the pointer.  All other generic motion events are\n         * delivered to the focused view.\n         * </p><p>\n         * See {@link View#onGenericMotionEvent(MotionEvent)} for an example of how to\n         * handle this event.\n         * </p>\n         *\n         * @param event The generic motion event being processed.\n         *\n         * @return Return true if you have consumed the event, false if you haven't.\n         * The default implementation always returns false.\n         */\n        onGenericMotionEvent(event:MotionEvent):boolean  {\n            return false;\n        }\n        /**\n         * Called whenever a key, touch, or trackball event is dispatched to the\n         * activity.  Implement this method if you wish to know that the user has\n         * interacted with the device in some way while your activity is running.\n         * This callback and {@link #onUserLeaveHint} are intended to help\n         * activities manage status bar notifications intelligently; specifically,\n         * for helping activities determine the proper time to cancel a notfication.\n         *\n         * <p>All calls to your activity's {@link #onUserLeaveHint} callback will\n         * be accompanied by calls to {@link #onUserInteraction}.  This\n         * ensures that your activity will be told of relevant user activity such\n         * as pulling down the notification pane and touching an item there.\n         *\n         * <p>Note that this callback will be invoked for the touch down action\n         * that begins a touch gesture, but may not be invoked for the touch-moved\n         * and touch-up actions that follow.\n         *\n         * @see #onUserLeaveHint()\n         */\n        onUserInteraction():void  {\n        }\n\n        onWindowAttributesChanged(params:WindowManager.LayoutParams):void  {\n            // this activity is not embedded.\n            //if (this.mParent == null) {\n                let decor:View = this.getWindow().getDecorView();\n                if (decor != null && decor.getParent() != null) {\n                    this.getWindowManager().updateWindowLayout(this.getWindow(), params);\n                }\n            //}\n        }\n\n        onContentChanged():void  {\n        }\n\n        /**\n         * Called when the current {@link Window} of the activity gains or loses\n         * focus.  This is the best indicator of whether this activity is visible\n         * to the user.  The default implementation clears the key tracking\n         * state, so should always be called.\n         *\n         * <p>Note that this provides information about global focus state, which\n         * is managed independently of activity lifecycles.  As such, while focus\n         * changes will generally have some relation to lifecycle changes (an\n         * activity that is stopped will not generally get window focus), you\n         * should not rely on any particular order between the callbacks here and\n         * those in the other lifecycle methods such as {@link #onResume}.\n         *\n         * <p>As a general rule, however, a resumed activity will have window\n         * focus...  unless it has displayed other dialogs or popups that take\n         * input focus, in which case the activity itself will not have focus\n         * when the other windows have it.  Likewise, the system may display\n         * system-level windows (such as the status bar notification panel or\n         * a system alert) which will temporarily take window input focus without\n         * pausing the foreground activity.\n         *\n         * @param hasFocus Whether the window of this activity has focus.\n         *\n         * @see #hasWindowFocus()\n         * @see #onResume\n         * @see View#onWindowFocusChanged(boolean)\n         */\n        onWindowFocusChanged(hasFocus:boolean):void  {\n        }\n\n        /**\n         * Called when the main window associated with the activity has been\n         * attached to the window manager.\n         * See {@link View#onAttachedToWindow() View.onAttachedToWindow()}\n         * for more information.\n         * @see View#onAttachedToWindow\n         */\n        onAttachedToWindow():void  {\n        }\n\n        /**\n         * Called when the main window associated with the activity has been\n         * detached from the window manager.\n         * See {@link View#onDetachedFromWindow() View.onDetachedFromWindow()}\n         * for more information.\n         * @see View#onDetachedFromWindow\n         */\n        onDetachedFromWindow():void  {\n        }\n\n        /**\n         * Returns true if this activity's <em>main</em> window currently has window focus.\n         * Note that this is not the same as the view itself having focus.\n         *\n         * @return True if this activity's main window currently has window focus.\n         *\n         * @see #onWindowAttributesChanged(android.view.WindowManager.LayoutParams)\n         */\n        hasWindowFocus():boolean  {\n            let w:Window = this.getWindow();\n            if (w != null) {\n                let d:View = w.getDecorView();\n                if (d != null) {\n                    return d.hasWindowFocus();\n                }\n            }\n            return false;\n        }\n\n        /**\n         * Called to process key events.  You can override this to intercept all\n         * key events before they are dispatched to the window.  Be sure to call\n         * this implementation for key events that should be handled normally.\n         *\n         * @param event The key event.\n         *\n         * @return boolean Return true if this event was consumed.\n         */\n        dispatchKeyEvent(event:KeyEvent):boolean  {\n            this.onUserInteraction();\n            let win:Window = this.getWindow();\n            if (win.superDispatchKeyEvent(event)) {\n                return true;\n            }\n            let decor:View = win.getDecorView();\n            return event.dispatch(this, decor != null ? decor.getKeyDispatcherState() : null, this);\n        }\n\n        /**\n         * Called to process touch screen events.  You can override this to\n         * intercept all touch screen events before they are dispatched to the\n         * window.  Be sure to call this implementation for touch screen events\n         * that should be handled normally.\n         *\n         * @param ev The touch screen event.\n         *\n         * @return boolean Return true if this event was consumed.\n         */\n        dispatchTouchEvent(ev:MotionEvent):boolean  {\n            if (ev.getAction() == MotionEvent.ACTION_DOWN) {\n                this.onUserInteraction();\n            }\n            if (this.getWindow().superDispatchTouchEvent(ev)) {\n                return true;\n            }\n            return this.onTouchEvent(ev);\n        }\n\n        /**\n         * Called to process generic motion events.  You can override this to\n         * intercept all generic motion events before they are dispatched to the\n         * window.  Be sure to call this implementation for generic motion events\n         * that should be handled normally.\n         *\n         * @param ev The generic motion event.\n         *\n         * @return boolean Return true if this event was consumed.\n         */\n        dispatchGenericMotionEvent(ev:MotionEvent):boolean  {\n            this.onUserInteraction();\n            if (this.getWindow().superDispatchGenericMotionEvent(ev)) {\n                return true;\n            }\n            return this.onGenericMotionEvent(ev);\n        }\n\n        /**\n         * Request that key events come to this activity. Use this if your\n         * activity has no views with focus, but the activity still wants\n         * a chance to process key events.\n         *\n         * @see android.view.Window#takeKeyEvents\n         */\n        takeKeyEvents(_get:boolean):void  {\n            this.getWindow().takeKeyEvents(_get);\n        }\n\n\n        /**\n         * Declare that the options menu has changed, so should be recreated.\n         * The {@link #onCreateOptionsMenu(Menu)} method will be called the next\n         * time it needs to be displayed.\n         */\n        private invalidateOptionsMenu():void {\n            let menu = new android.view.Menu(this);\n            if(this.onCreateOptionsMenu(menu)){\n                menu.setCallback({\n                    onMenuItemSelected : (menu, item)=>{\n                        let handle = this.onOptionsItemSelected(item);\n                        this.onOptionsMenuClosed(menu);\n                        return handle;\n                    }\n                });\n                this.mMenu = menu;\n                this.mMenuPopuoHelper = this.invalidateOptionsMenuPopupHelper(menu);\n            }\n        }\n\n        protected invalidateOptionsMenuPopupHelper(menu:android.view.Menu):android.view.menu.MenuPopupHelper {\n            //TODO support menu for fullscreen activity\n            return null;\n            // this.mMenuPopuoHelper = new android.view.menu.MenuPopupHelper(this, menu, this.getActionBar().mActionRight);\n        }\n\n        /**\n         * Initialize the contents of the Activity's standard options menu.  You\n         * should place your menu items in to <var>menu</var>.\n         *\n         * <p>This is only called once, the first time the options menu is\n         * displayed.  To update the menu every time it is displayed, see\n         * {@link #onPrepareOptionsMenu}.\n         *\n         * <p>The default implementation populates the menu with standard system\n         * menu items.  These are placed in the {@link Menu#CATEGORY_SYSTEM} group so that\n         * they will be correctly ordered with application-defined menu items.\n         * Deriving classes should always call through to the base implementation.\n         *\n         * <p>You can safely hold on to <var>menu</var> (and any items created\n         * from it), making modifications to it as desired, until the next\n         * time onCreateOptionsMenu() is called.\n         *\n         * <p>When you add items to the menu, you can implement the Activity's\n         * {@link #onOptionsItemSelected} method to handle them there.\n         *\n         * @param menu The options menu in which you place your items.\n         *\n         * @return You must return true for the menu to be displayed;\n         *         if you return false it will not be shown.\n         *\n         * @see #onPrepareOptionsMenu\n         * @see #onOptionsItemSelected\n         */\n        onCreateOptionsMenu(menu:android.view.Menu):boolean  {\n            return true;\n        }\n\n        /**\n         * Prepare the Screen's standard options menu to be displayed.  This is\n         * called right before the menu is shown, every time it is shown.  You can\n         * use this method to efficiently enable/disable items or otherwise\n         * dynamically modify the contents.\n         *\n         * <p>The default implementation updates the system menu items based on the\n         * activity's state.  Deriving classes should always call through to the\n         * base class implementation.\n         *\n         * @param menu The options menu as last shown or first initialized by\n         *             onCreateOptionsMenu().\n         *\n         * @return You must return true for the menu to be displayed;\n         *         if you return false it will not be shown.\n         *\n         * @see #onCreateOptionsMenu\n         */\n        onPrepareOptionsMenu(menu:android.view.Menu):boolean  {\n            return true;\n        }\n\n        /**\n         * This hook is called whenever an item in your options menu is selected.\n         * The default implementation simply returns false to have the normal\n         * processing happen (calling the item's Runnable or sending a message to\n         * its Handler as appropriate).  You can use this method for any items\n         * for which you would like to do processing without those other\n         * facilities.\n         *\n         * <p>Derived classes should call through to the base class for it to\n         * perform the default menu handling.</p>\n         *\n         * @param item The menu item that was selected.\n         *\n         * @return boolean Return false to allow normal menu processing to\n         *         proceed, true to consume it here.\n         *\n         * @see #onCreateOptionsMenu\n         */\n        onOptionsItemSelected(item:android.view.MenuItem):boolean  {\n            return false;\n        }\n\n        /**\n         * This hook is called whenever the options menu is being closed (either by the user canceling\n         * the menu with the back/menu button, or when an item is selected).\n         *\n         * @param menu The options menu as last shown or first initialized by\n         *             onCreateOptionsMenu().\n         */\n        onOptionsMenuClosed(menu:android.view.Menu):void  {\n        }\n\n        /**\n         * Programmatically opens the options menu. If the options menu is already\n         * open, this method does nothing.\n         */\n        openOptionsMenu():void {\n            if(this.mMenuPopuoHelper) this.mMenuPopuoHelper.show();\n        }\n\n        /**\n         * Progammatically closes the options menu. If the options menu is already\n         * closed, this method does nothing.\n         */\n        closeOptionsMenu():void  {\n            if(this.mMenuPopuoHelper) this.mMenuPopuoHelper.dismiss();\n        }\n\n        /**\n         * Launch an activity for which you would like a result when it finished.\n         * When this activity exits, your\n         * onActivityResult() method will be called with the given requestCode.\n         * Using a negative requestCode is the same as calling\n         * {@link #startActivity} (the activity is not launched as a sub-activity).\n         *\n         * <p>Note that this method should only be used with Intent protocols\n         * that are defined to return a result.  In other protocols (such as\n         * {@link Intent#ACTION_MAIN} or {@link Intent#ACTION_VIEW}), you may\n         * not get the result when you expect.  For example, if the activity you\n         * are launching uses the singleTask launch mode, it will not run in your\n         * task and thus you will immediately receive a cancel result.\n         *\n         * <p>As a special case, if you call startActivityForResult() with a requestCode\n         * >= 0 during the initial onCreate(Bundle savedInstanceState)/onResume() of your\n         * activity, then your window will not be displayed until a result is\n         * returned back from the started activity.  This is to avoid visible\n         * flickering when redirecting to another activity.\n         *\n         * <p>This method throws {@link android.content.ActivityNotFoundException}\n         * if there was no Activity found to run the given Intent.\n         *\n         * @param intent The intent to start.\n         * @param requestCode If >= 0, this code will be returned in\n         *                    onActivityResult() when the activity exits.\n         * @param options Additional options for how the Activity should be started.\n         * See {@link android.content.Context#startActivity(Intent, Bundle)\n         * Context.startActivity(Intent, Bundle)} for more details.\n         *\n         * @throws android.content.ActivityNotFoundException\n         *\n         * @see #startActivity\n         */\n        startActivityForResult(intent:Intent|string, requestCode:number, options?:Bundle):void  {\n            if(typeof intent === 'string') intent = new Intent(<string>intent);\n            if(requestCode>=0) (<Intent>intent).mRequestCode = requestCode;\n\n            this.androidUI.mActivityThread.execStartActivity(this, <Intent>intent, options);\n\n            //    let ar:Instrumentation.ActivityResult = this.mInstrumentation.execStartActivity(this, this.mMainThread.getApplicationThread(), this.mToken, this, intent, requestCode, options);\n            //    if (ar != null) {\n            //        this.mMainThread.sendActivityResult(this.mToken, this.mEmbeddedID, requestCode, ar.getResultCode(), ar.getResultData());\n            //    }\n\n            if (requestCode >= 0) {\n                // If this start is requesting a result, we can avoid making\n                // the activity visible until the result is received.  Setting\n                // this code during onCreate(Bundle savedInstanceState) or onResume() will keep the\n                // activity hidden during this time, to avoid flickering.\n                // This can only be done when a result is requested because\n                // that guarantees we will get information back when the\n                // activity is finished, no matter what happens to it.\n                this.mStartedActivity = true;\n            }\n            const decor:View = this.mWindow != null ? this.mWindow.peekDecorView() : null;\n            if (decor != null) {\n                decor.cancelPendingInputEvents();\n            }\n            // TODO Consider clearing/flushing other event sources and events for child windows.\n        }\n\n        /**\n         * Launch a new activity.  You will not receive any information about when\n         * the activity exits.  This implementation overrides the base version,\n         * providing information about\n         * the activity performing the launch.  Because of this additional\n         * information, the {@link Intent#FLAG_ACTIVITY_NEW_TASK} launch flag is not\n         * required; if not specified, the new activity will be added to the\n         * task of the caller.\n         *\n         * <p>This method throws {@link android.content.ActivityNotFoundException}\n         * if there was no Activity found to run the given Intent.\n         *\n         * @param intents The intents to start.\n         * @param options Additional options for how the Activity should be started.\n         * See {@link android.content.Context#startActivity(Intent, Bundle)\n         * Context.startActivity(Intent, Bundle)} for more details.\n         *\n         * @throws android.content.ActivityNotFoundException\n         *\n         * @see {@link #startActivities(Intent[])}\n         * @see #startActivityForResult\n         */\n        startActivities(intents:Intent[], options?:Bundle):void  {\n            for(let intent of intents){\n                this.startActivity(intent, options);\n            }\n        }\n\n\n        /**\n         * Launch a new activity.  You will not receive any information about when\n         * the activity exits.  This implementation overrides the base version,\n         * providing information about\n         * the activity performing the launch.  Because of this additional\n         * information, the {@link Intent#FLAG_ACTIVITY_NEW_TASK} launch flag is not\n         * required; if not specified, the new activity will be added to the\n         * task of the caller.\n         *\n         * <p>This method throws {@link android.content.ActivityNotFoundException}\n         * if there was no Activity found to run the given Intent.\n         *\n         * @param intent The intent to start.\n         * @param options Additional options for how the Activity should be started.\n         * See {@link android.content.Context#startActivity(Intent, Bundle)\n         * Context.startActivity(Intent, Bundle)} for more details.\n         *\n         * @throws android.content.ActivityNotFoundException\n         *\n         * @see {@link #startActivity(Intent)}\n         * @see #startActivityForResult\n         */\n        startActivity(intent:Intent|string, options?:Bundle):void  {\n            if (options != null) {\n                this.startActivityForResult(intent, -1, options);\n            } else {\n                // Note we want to go through this call for compatibility with\n                // applications that may have overridden the method.\n                this.startActivityForResult(intent, -1);\n            }\n        }\n\n\n        /**\n         * A special variation to launch an activity only if a new activity\n         * instance is needed to handle the given Intent.  In other words, this is\n         * just like {@link #startActivityForResult(Intent, int)} except: if you are\n         * using the {@link Intent#FLAG_ACTIVITY_SINGLE_TOP} flag, or\n         * singleTask or singleTop\n         * {@link android.R.styleable#AndroidManifestActivity_launchMode launchMode},\n         * and the activity\n         * that handles <var>intent</var> is the same as your currently running\n         * activity, then a new instance is not needed.  In this case, instead of\n         * the normal behavior of calling {@link #onNewIntent} this function will\n         * return and you can handle the Intent yourself.\n         *\n         * <p>This function can only be called from a top-level activity; if it is\n         * called from a child activity, a runtime exception will be thrown.\n         *\n         * @param intent The intent to start.\n         * @param requestCode If >= 0, this code will be returned in\n         *         onActivityResult() when the activity exits, as described in\n         *         {@link #startActivityForResult}.\n         * @param options Additional options for how the Activity should be started.\n         * See {@link android.content.Context#startActivity(Intent, Bundle)\n         * Context.startActivity(Intent, Bundle)} for more details.\n         *\n         * @return If a new activity was launched then true is returned; otherwise\n         *         false is returned and you must handle the Intent yourself.\n         *\n         * @see #startActivity\n         * @see #startActivityForResult\n         */\n        startActivityIfNeeded(intent:Intent, requestCode:number, options?:Bundle):boolean  {\n            if(this.androidUI.mActivityThread.canBackTo(intent)){\n                return false;\n            }\n            this.startActivityForResult(intent, requestCode, options);\n            return true;\n            //let result:number = ActivityManager.START_RETURN_INTENT_TO_CALLER;\n            //try {\n            //    intent.migrateExtraStreamToClipData();\n            //    intent.prepareToLeaveProcess();\n            //    result = ActivityManagerNative.getDefault().startActivity(this.mMainThread.getApplicationThread(), this.getBasePackageName(), intent, intent.resolveTypeIfNeeded(this.getContentResolver()), this.mToken, this.mEmbeddedID, requestCode, ActivityManager.START_FLAG_ONLY_IF_NEEDED, null, null, options);\n            //} catch (e){\n            //}\n            //Instrumentation.checkStartActivityResult(result, intent);\n            //if (requestCode >= 0) {\n            //    // If this start is requesting a result, we can avoid making\n            //    // the activity visible until the result is received.  Setting\n            //    // this code during onCreate(Bundle savedInstanceState) or onResume() will keep the\n            //    // activity hidden during this time, to avoid flickering.\n            //    // This can only be done when a result is requested because\n            //    // that guarantees we will get information back when the\n            //    // activity is finished, no matter what happens to it.\n            //    this.mStartedActivity = true;\n            //}\n            //return result != ActivityManager.START_RETURN_INTENT_TO_CALLER;\n        }\n\n        /**\n         * Call before one of the flavors of {@link #startActivity(Intent)}\n         * or {@link #finish} to specify an explicit transition animation to\n         * perform next.\n         */\n        overrideNextTransition(enterAnimation:Animation, exitAnimation:Animation, resumeAnimation:Animation, hideAnimation:Animation):void {\n            this.androidUI.mActivityThread.overrideNextWindowAnimation(enterAnimation, exitAnimation, resumeAnimation, hideAnimation);\n        }\n\n        /**\n         * Call this to set the result that your activity will return to its\n         * caller.\n         *\n         * <p>As of {@link android.os.Build.VERSION_CODES#GINGERBREAD}, the Intent\n         * you supply here can have {@link Intent#FLAG_GRANT_READ_URI_PERMISSION\n         * Intent.FLAG_GRANT_READ_URI_PERMISSION} and/or {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION\n         * Intent.FLAG_GRANT_WRITE_URI_PERMISSION} set.  This will grant the\n         * Activity receiving the result access to the specific URIs in the Intent.\n         * Access will remain until the Activity has finished (it will remain across the hosting\n         * process being killed and other temporary destruction) and will be added\n         * to any existing set of URI permissions it already holds.\n         *\n         * @param resultCode The result code to propagate back to the originating\n         *                   activity, often RESULT_CANCELED or RESULT_OK\n         * @param data The data to propagate back to the originating activity.\n         *\n         * @see #RESULT_CANCELED\n         * @see #RESULT_OK\n         * @see #RESULT_FIRST_USER\n         * @see #setResult(int)\n         */\n        setResult(resultCode:number, data?:Intent):void  {\n            {\n                this.mResultCode = resultCode;\n                this.mResultData = data;\n            }\n        }\n\n        /**\n         * Return the name of the activity that invoked this activity.  This is\n         * who the data in {@link #setResult setResult()} will be sent to.  You\n         * can use this information to validate that the recipient is allowed to\n         * receive the data.\n         *\n         * <p class=\"note\">Note: if the calling activity is not expecting a result (that is it\n         * did not use the {@link #startActivityForResult}\n         * form that includes a request code), then the calling package will be\n         * null.\n         *\n         * @return The className of the activity that will receive your\n         *         reply, or null if none.\n         */\n        getCallingActivity():string  {\n            //FIXME not support yet\n            return null;\n        }\n\n\n        /**\n         * Control whether this activity's main window is visible.  This is intended\n         * only for the special case of an activity that is not going to show a\n         * UI itself, but can't just finish prior to onResume() because it needs\n         * to wait for a service binding or such.  Setting this to false allows\n         * you to prevent your UI from being shown during that time.\n         *\n         * <p>The default value for this is taken from the\n         * {@link android.R.attr#windowNoDisplay} attribute of the activity's theme.\n         */\n        setVisible(visible:boolean):void  {\n            if (this.mVisibleFromClient != visible) {\n                this.mVisibleFromClient = visible;\n                //if (this.mVisibleFromServer) {\n                //    if (visible)\n                //        this.makeVisible();\n                //    else\n                //        this.getWindow().getDecorView().setVisibility(View.INVISIBLE);\n                //}\n            }\n        }\n\n        makeVisible():void  {\n            if (!this.mWindowAdded) {\n                let wm:WindowManager = this.getGlobalWindowManager();\n                wm.addWindow(this.getWindow());\n                this.mWindowAdded = true;\n            }\n            this.getWindow().getDecorView().setVisibility(View.VISIBLE);\n        }\n\n        /**\n         * Check to see whether this activity is in the process of finishing,\n         * either because you called {@link #finish} on it or someone else\n         * has requested that it finished.  This is often used in\n         * {@link #onPause} to determine whether the activity is simply pausing or\n         * completely finishing.\n         *\n         * @return If the activity is finishing, returns true; else returns false.\n         *\n         * @see #finish\n         */\n        isFinishing():boolean  {\n            return this.mFinished;\n        }\n\n        /**\n         * Returns true if the final {@link #onDestroy()} call has been made\n         * on the Activity, so this instance is now dead.\n         */\n        isDestroyed():boolean  {\n            return this.mDestroyed;\n        }\n\n        /**\n         * Call this when your activity is done and should be closed.  The\n         * ActivityResult is propagated back to whoever launched you via\n         * onActivityResult().\n         */\n        finish():void  {\n            let resultCode:number = this.mResultCode;\n            let resultData:Intent = this.mResultData;\n            try {\n                this.androidUI.mActivityThread.scheduleDestroyActivity(this);\n                //if (resultData != null) {\n                //    resultData.prepareToLeaveProcess();\n                //}\n                //if (ActivityManagerNative.getDefault().finishActivity(this.mToken, resultCode, resultData)) {\n                //    this.mFinished = true;\n                //}\n            } catch (e){\n            }\n        }\n\n        /**\n         * Force finish another activity that you had previously started with\n         * {@link #startActivityForResult}.\n         *\n         * @param requestCode The request code of the activity that you had\n         *                    given to startActivityForResult().  If there are multiple\n         *                    activities started with this request code, they\n         *                    will all be finished.\n         */\n        finishActivity(requestCode:number):void  {\n            this.androidUI.mActivityThread.scheduleDestroyActivityByRequestCode(requestCode);\n        }\n\n        /**\n         * Called when an activity you launched exits, giving you the requestCode\n         * you started it with, the resultCode it returned, and any additional\n         * data from it.  The <var>resultCode</var> will be\n         * {@link #RESULT_CANCELED} if the activity explicitly returned that,\n         * didn't return any result, or crashed during its operation.\n         *\n         * <p>You will receive this call immediately before onResume() when your\n         * activity is re-starting.\n         *\n         * @param requestCode The integer request code originally supplied to\n         *                    startActivityForResult(), allowing you to identify who this\n         *                    result came from.\n         * @param resultCode The integer result code returned by the child activity\n         *                   through its setResult().\n         * @param data An Intent, which can return result data to the caller\n         *               (various data can be attached to Intent \"extras\").\n         *\n         * @see #startActivityForResult\n         * @see #createPendingResult\n         * @see #setResult(int)\n         */\n        protected onActivityResult(requestCode:number, resultCode:number, data:Intent):void  {\n        }\n\n        /**\n         * Change the title associated with this activity.  If this is a\n         * top-level activity, the title for its window will change.  If it\n         * is an embedded activity, the parent can do whatever it wants\n         * with it.\n         */\n        setTitle(title:string):void  {\n            this.getWindow().setTitle(title);\n            this.onTitleChanged(title);\n        }\n\n        getTitle():string  {\n            return this.getWindow().getAttributes().getTitle();\n        }\n\n        protected onTitleChanged(title:string, color?:number):void  {\n            //if (this.mTitleReady) {\n                const win:Window = this.getWindow();\n                if (win != null) {\n                    win.setTitle(title);\n                    //if (color != 0) {\n                    //    win.setTitleColor(color);\n                    //}\n                }\n            //}\n        }\n\n        /**\n         * Runs the specified action on the UI thread. If the current thread is the UI\n         * thread, then the action is executed immediately. If the current thread is\n         * not the UI thread, the action is posted to the event queue of the UI thread.\n         *\n         * @param action the action to run on the UI thread\n         */\n        runOnUiThread(action:Runnable):void {\n            action.run();\n        }\n\n\n        /**\n         * Navigate from this activity to the activity specified by upIntent, finishing this activity\n         * in the process. If the activity indicated by upIntent already exists in the task's history,\n         * this activity and all others before the indicated activity in the history stack will be\n         * finished.\n         *\n         * <p>If the indicated activity does not appear in the history stack, this will finish\n         * each activity in this task until the root activity of the task is reached, resulting in\n         * an \"in-app home\" behavior. This can be useful in apps with a complex navigation hierarchy\n         * when an activity may be reached by a path not passing through a canonical parent\n         * activity.</p>\n         *\n         * <p>This method should be used when performing up navigation from within the same task\n         * as the destination. If up navigation should cross tasks in some cases, see\n         * {@link #shouldUpRecreateTask(Intent)}.</p>\n         *\n         * @param upIntent An intent representing the target destination for up navigation\n         *\n         * @return true if up navigation successfully reached the activity indicated by upIntent and\n         *         upIntent was delivered to it. false if an instance of the indicated activity could\n         *         not be found and this activity was simply finished normally.\n         */\n        navigateUpTo(upIntent:Intent, upToRootIfNotFound=true):boolean  {\n            if(this.androidUI.mActivityThread.scheduleBackTo(upIntent)){\n                return true;\n            }\n            if(upToRootIfNotFound) this.androidUI.mActivityThread.scheduleBackToRoot();\n            return false;\n        //    //let destInfo:ComponentName = upIntent.getComponent();\n        //    //if (destInfo == null) {\n        //    //    destInfo = upIntent.resolveActivity(this.getPackageManager());\n        //    //    if (destInfo == null) {\n        //    //        return false;\n        //    //    }\n        //    //    upIntent = new Intent(upIntent);\n        //    //    upIntent.setComponent(destInfo);\n        //    //}\n        //    let resultCode:number = this.mResultCode;\n        //    let resultData:Intent = this.mResultData;\n        //    //if (resultData != null) {\n        //        //resultData.prepareToLeaveProcess();\n        //    //}\n        //    //try {\n        //    //    upIntent.prepareToLeaveProcess();\n        //    //    return ActivityManagerNative.getDefault().navigateUpTo(this.mToken, upIntent, resultCode, resultData);\n        //    //} catch (e){\n        //    //    return false;\n        //    //}\n        //\n        //    return false;\n        }\n\n        constructor(androidUI:androidui.AndroidUI) {\n            super(androidUI);\n\n            this.mWindow = new Window(this);\n            this.mWindow.setWindowAnimations(android.R.anim.activity_open_enter_ios, android.R.anim.activity_close_exit_ios,\n                android.R.anim.activity_close_enter_ios, android.R.anim.activity_open_exit_ios);\n            this.mWindow.setDimAmount(0.7);\n            this.mWindow.getAttributes().flags |= WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;\n            this.mWindow.setCallback(this);\n        }\n\n\n        private performCreate(icicle:Bundle):void  {\n            this.onCreate(icicle);\n            this.invalidateOptionsMenu();\n            //this.mVisibleFromClient = !this.mWindow.getWindowStyle().getBoolean(com.android.internal.R.styleable.Window_windowNoDisplay, false);\n            //this.mFragments.dispatchActivityCreated();\n        }\n\n\n        private performStart():void  {\n            //this.mFragments.noteStateNotSaved();\n            this.mCalled = false;\n            //this.mFragments.execPendingActions();\n            this.onStart();//this.mInstrumentation.callActivityOnStart(this);\n            if (!this.mCalled) {\n                throw Error(`new SuperNotCalledException(\"Activity \" + this.mComponent.toShortString() + \" did not call through to super.onStart()\")`);\n            }\n            //this.mFragments.dispatchStart();\n            //if (this.mAllLoaderManagers != null) {\n            //    const N:number = this.mAllLoaderManagers.size();\n            //    let loaders:LoaderManagerImpl = new Array<LoaderManagerImpl>(N);\n            //    for (let i:number = N - 1; i >= 0; i--) {\n            //        loaders[i] = this.mAllLoaderManagers.valueAt(i);\n            //    }\n            //    for (let i:number = 0; i < N; i++) {\n            //        let lm:LoaderManagerImpl = loaders[i];\n            //        lm.finishRetain();\n            //        lm.doReportStart();\n            //    }\n            //}\n        }\n\n        private performRestart():void  {\n            //this.mFragments.noteStateNotSaved();\n            if (this.mStopped) {\n                this.mStopped = false;\n                //if (this.mToken != null && this.mParent == null) {\n                //    WindowManagerGlobal.getInstance().setStoppedState(this.mToken, false);\n                //}\n                //{\n                //    const N:number = this.mManagedCursors.size();\n                //    for (let i:number = 0; i < N; i++) {\n                //        let mc:Activity.ManagedCursor = this.mManagedCursors.get(i);\n                //        if (mc.mReleased || mc.mUpdated) {\n                //            if (!mc.mCursor.requery()) {\n                //                if (this.getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {\n                //                    throw Error(`new IllegalStateException(\"trying to requery an already closed cursor  \" + mc.mCursor)`);\n                //                }\n                //            }\n                //            mc.mReleased = false;\n                //            mc.mUpdated = false;\n                //        }\n                //    }\n                //}\n                this.mCalled = false;\n                this.onRestart();//this.mInstrumentation.callActivityOnRestart(this);\n                if (!this.mCalled) {\n                    throw Error(`new SuperNotCalledException(\"Activity \" + this.mComponent.toShortString() + \" did not call through to super.onRestart()\")`);\n                }\n                this.performStart();\n            }\n        }\n\n        private performResume():void  {\n            this.performRestart();\n            //this.mFragments.execPendingActions();\n            //this.mLastNonConfigurationInstances = null;\n            this.mCalled = false;\n            // mResumed is set by the instrumentation\n            this.mResumed = true;\n            this.onResume();//this.mInstrumentation.callActivityOnResume(this);\n            if (!this.mCalled) {\n                throw Error(`new SuperNotCalledException(\"Activity \" + this.mComponent.toShortString() + \" did not call through to super.onResume()\")`);\n            }\n            // Now really resume, and install the current status bar and menu.\n            this.mCalled = false;\n            //this.mFragments.dispatchResume();\n            //this.mFragments.execPendingActions();\n            this.onPostResume();\n            if (!this.mCalled) {\n                throw Error(`new SuperNotCalledException(\"Activity \" + this.mComponent.toShortString() + \" did not call through to super.onPostResume()\")`);\n            }\n        }\n\n\n        private performPause():void {\n            if(this.mResumed) {\n                //this.mDoReportFullyDrawn = false;\n                //this.mFragments.dispatchPause();\n                this.mCalled = false;\n                this.onPause();\n                this.mResumed = false;\n                if (!this.mCalled) {\n                    throw Error(`new SuperNotCalledException(\"Activity ${this.constructor.name} did not call through to super.onPause()\")`);\n                }\n                this.mResumed = false;\n            }\n        }\n\n        private performUserLeaving():void  {\n            this.onUserInteraction();\n            this.onUserLeaveHint();\n        }\n\n        private performStop():void  {\n            //this.mDoReportFullyDrawn = false;\n            //if (this.mLoadersStarted) {\n            //    this.mLoadersStarted = false;\n            //    if (this.mLoaderManager != null) {\n            //        if (!this.mChangingConfigurations) {\n            //            this.mLoaderManager.doStop();\n            //        } else {\n            //            this.mLoaderManager.doRetain();\n            //        }\n            //    }\n            //}\n            if (!this.mStopped) {\n                //if (this.mWindow != null) {\n                //    this.mWindow.closeAllPanels();\n                //}\n                //if (this.mToken != null && this.mParent == null) {\n                //    WindowManagerGlobal.getInstance().setStoppedState(this.mToken, true);\n                //}\n                //this.mFragments.dispatchStop();\n                this.mCalled = false;\n                this.onStop();//this.mInstrumentation.callActivityOnStop(this);\n                if (!this.mCalled) {\n                    throw Error(`new SuperNotCalledException(\"Activity \" + this.mComponent.toShortString() + \" did not call through to super.onStop()\")`);\n                }\n                //{\n                //    const N:number = this.mManagedCursors.size();\n                //    for (let i:number = 0; i < N; i++) {\n                //        let mc:Activity.ManagedCursor = this.mManagedCursors.get(i);\n                //        if (!mc.mReleased) {\n                //            mc.mCursor.deactivate();\n                //            mc.mReleased = true;\n                //        }\n                //    }\n                //}\n                this.mStopped = true;\n            }\n            this.mResumed = false;\n        }\n        private performDestroy():void  {\n            this.mDestroyed = true;\n            this.mWindow.destroy();\n            //this.mFragments.dispatchDestroy();\n            this.onDestroy();\n            //if (this.mLoaderManager != null) {\n            //    this.mLoaderManager.doDestroy();\n            //}\n        }\n\n        isResumed():boolean  {\n            return this.mResumed;\n        }\n\n        dispatchActivityResult(who:string, requestCode:number, resultCode:number, data:Intent):void  {\n            // if (false) Log.v(Activity.TAG, \"Dispatching result: who=\" + who + \", reqCode=\" + requestCode + \", resCode=\" + resultCode + \", data=\" + data);\n            //this.mFragments.noteStateNotSaved();\n            //if (who == null) {\n                this.onActivityResult(requestCode, resultCode, data);\n            //} else {\n                //let frag:Fragment = this.mFragments.findFragmentByWho(who);\n                //if (frag != null) {\n                //    frag.onActivityResult(requestCode, resultCode, data);\n                //}\n            //}\n        }\n    }\n}"
  },
  {
    "path": "src/android/app/ActivityThread.ts",
    "content": "/**\n * Created by linfaxin on 16/1/5.\n * androidui's impl of android's ActivityThread\n */\n\n///<reference path=\"Activity.ts\"/>\n///<reference path=\"../content/Intent.ts\"/>\n///<reference path=\"../os/Bundle.ts\"/>\n///<reference path=\"../view/ViewGroup.ts\"/>\n///<reference path=\"../view/KeyEvent.ts\"/>\n///<reference path=\"../view/animation/Animation.ts\"/>\n///<reference path=\"../../androidui/AndroidUI.ts\"/>\n///<reference path=\"../../androidui/util/PageStack.ts\"/>\n\nmodule android.app{\n    import Bundle = android.os.Bundle;\n    import Intent = android.content.Intent;\n    import ViewGroup = android.view.ViewGroup;\n    import View = android.view.View;\n    import Animation = android.view.animation.Animation;\n\n\n    /**\n     * This manages the execution of the main thread in an\n     * application process, scheduling and executing activities,\n     * broadcasts, and other operations on it as the activity\n     * manager requests.\n     *\n     * {@hide}\n     */\n    export class ActivityThread {\n        androidUI: androidui.AndroidUI;\n        mLaunchedActivities = new Set<Activity>();\n\n        overrideExitAnimation:Animation;\n        overrideEnterAnimation:Animation;\n        overrideResumeAnimation:Animation;\n        overrideHideAnimation:Animation;//null mean no animation, undefined mean not override\n\n        constructor(androidUI:androidui.AndroidUI) {\n            this.androidUI = androidUI;\n        }\n\n        private initWithPageStack(){\n            let backKeyDownEvent = android.view.KeyEvent.obtain(android.view.KeyEvent.ACTION_DOWN, android.view.KeyEvent.KEYCODE_BACK);\n            let backKeyUpEvent = android.view.KeyEvent.obtain(android.view.KeyEvent.ACTION_UP, android.view.KeyEvent.KEYCODE_BACK);\n            PageStack.backListener = ():boolean=>{\n                let handleDown = this.androidUI._viewRootImpl.dispatchInputEvent(backKeyDownEvent);\n                let handleUp = this.androidUI._viewRootImpl.dispatchInputEvent(backKeyUpEvent);\n                return handleDown || handleUp;\n            };\n            PageStack.pageOpenHandler = (pageId:string, pageExtra?:Intent, isRestore?:boolean):boolean=>{\n                let intent = new Intent(pageId);\n                if(pageExtra) intent.mExtras = new Bundle(pageExtra.mExtras);\n                if(isRestore) this.overrideNextWindowAnimation(null, null, null, null);\n                let activity = this.handleLaunchActivity(intent);\n                return activity && !activity.mFinished;\n            };\n            PageStack.pageCloseHandler = (pageId:string, pageExtra?:Intent):boolean=>{\n                //check is root activity\n                if(this.mLaunchedActivities.size === 1){\n                    let rootActivity = Array.from(this.mLaunchedActivities)[0];\n                    if(pageId==null || rootActivity.getIntent().activityName == pageId){\n                        this.handleDestroyActivity(rootActivity, true);\n                        return true;\n                    }\n                    return false;\n                }\n\n                for(let activity of Array.from(this.mLaunchedActivities).reverse()){\n                    let intent = activity.getIntent();\n                    if(intent.activityName == pageId){\n                        this.handleDestroyActivity(activity, true);\n                        return true;\n                    }\n                }\n            };\n            PageStack.init();\n        }\n\n\n        overrideNextWindowAnimation(enterAnimation:Animation, exitAnimation:Animation, resumeAnimation:Animation, hideAnimation:Animation):void {\n            this.overrideEnterAnimation = enterAnimation;\n            this.overrideExitAnimation = exitAnimation;\n            this.overrideResumeAnimation = resumeAnimation;\n            this.overrideHideAnimation = hideAnimation;\n        }\n        getOverrideEnterAnimation():Animation {\n            return this.overrideEnterAnimation;\n        }\n        getOverrideExitAnimation():Animation {\n            return this.overrideExitAnimation;\n        }\n        getOverrideResumeAnimation():Animation {\n            return this.overrideResumeAnimation;\n        }\n        getOverrideHideAnimation():Animation {\n            return this.overrideHideAnimation;\n        }\n\n        private scheduleApplicationHideTimeout;\n        scheduleApplicationHide():void {\n            if(this.scheduleApplicationHideTimeout) clearTimeout(this.scheduleApplicationHideTimeout);\n            this.scheduleApplicationHideTimeout = setTimeout(()=>{\n                let visibleActivities = this.getVisibleToUserActivities();\n                if(visibleActivities.length==0) return;\n\n                this.handlePauseActivity(visibleActivities[visibleActivities.length - 1]);\n                for(let visibleActivity of visibleActivities){\n                    this.handleStopActivity(visibleActivity, true);\n                }\n            }, 0);\n        }\n\n        scheduleApplicationShow():void {\n            this.scheduleActivityResume();\n        }\n\n        execStartActivity(callActivity:Activity, intent:Intent, options?:android.os.Bundle):void {\n            if((intent.getFlags() & Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0){\n                if(this.scheduleBackTo(intent)) return;\n            }\n            this.scheduleLaunchActivity(callActivity, intent, options);\n        }\n\n        private activityResumeTimeout;\n        scheduleActivityResume():void {\n            if(this.activityResumeTimeout) clearTimeout(this.activityResumeTimeout);\n            this.activityResumeTimeout = setTimeout(()=>{\n                let visibleActivities = this.getVisibleToUserActivities();\n                if(visibleActivities.length==0) return;\n                for(let visibleActivity of visibleActivities){\n                    visibleActivity.performRestart();\n                }\n\n                let activity = visibleActivities.pop();\n                this.handleResumeActivity(activity, false);\n\n                //show activity behind the activity\n                if(activity.getWindow().isFloating()) {\n                    for (let visibleActivity of visibleActivities.reverse()) {\n                        if (visibleActivity.mVisibleFromClient) {\n                            visibleActivity.makeVisible();\n                            if(!visibleActivity.getWindow().isFloating()){\n                                break;\n                            }\n                        }\n                    }\n                }\n            }, 0);\n        }\n\n        scheduleLaunchActivity(callActivity:Activity, intent:Intent, options?:android.os.Bundle):void {\n            let activity = this.handleLaunchActivity(intent);\n            activity.mCallActivity = callActivity;\n            if(activity && !activity.mFinished){\n                PageStack.notifyNewPageOpened(intent.activityName, intent);\n            }\n        }\n\n        scheduleDestroyActivityByRequestCode(requestCode:number):void {\n            for(let activity of Array.from(this.mLaunchedActivities).reverse()){\n                if(activity.getIntent() && requestCode == activity.getIntent().mRequestCode){\n                    this.scheduleDestroyActivity(activity);\n                }\n            }\n        }\n\n        scheduleDestroyActivity(activity:Activity, finishing = true):void {\n            //delay destroy ensure activity call all start/resume life circle.\n            setTimeout(()=>{\n                let isCreateSuc = this.mLaunchedActivities.has(activity);//common case it's true, finish() in onCreate() will false here\n\n                if(activity.mCallActivity && activity.getIntent() && activity.getIntent().mRequestCode>=0){\n                    activity.mCallActivity.dispatchActivityResult(null, activity.getIntent().mRequestCode, activity.mResultCode, activity.mResultData)\n                }\n\n\n                this.handleDestroyActivity(activity, finishing);\n\n                if(!isCreateSuc) return;\n\n                if(this.mLaunchedActivities.size == 0){\n                    if(history.length<=2){\n                        this.androidUI.showAppClosed();\n                    }else{\n                        PageStack.back(true);\n                    }\n\n                }else if(activity.getIntent()){\n                    PageStack.notifyPageClosed(activity.getIntent().activityName);\n                }\n            }, 0);\n        }\n\n        scheduleBackTo(intent:Intent):boolean {\n            let destroyList = [];\n            let findActivity = false;\n            for(let activity of Array.from(this.mLaunchedActivities).reverse()){\n                if(activity.getIntent() && activity.getIntent().activityName == intent.activityName){\n                    findActivity = true;\n                    break;\n                }\n                destroyList.push(activity);\n            }\n            if(findActivity){\n                for(let activity of destroyList){\n                    this.scheduleDestroyActivity(activity);\n                }\n                return true;\n            }\n            return false;\n        }\n\n        canBackTo(intent:Intent):boolean {\n            for(let activity of this.mLaunchedActivities){\n                if(activity.getIntent().activityName == intent.activityName){\n                    return true;\n                }\n            }\n            return false;\n        }\n\n        scheduleBackToRoot():void {\n            let destroyList = Array.from(this.mLaunchedActivities).reverse();\n            destroyList.shift();//remove root\n            for(let activity of destroyList){\n                this.scheduleDestroyActivity(activity);\n            }\n        }\n\n        private handlePauseActivity(activity:Activity){\n            this.performPauseActivity(activity);\n        }\n\n        private performPauseActivity(activity:Activity):void {\n            //if (finished) {\n            //    activity.mFinished = true;\n            //}\n\n            // Now we are idle.\n            activity.performPause();\n        }\n\n        private handleStopActivity(activity:Activity, show=false):void {\n            this.performStopActivity(activity, true);\n            this.updateVisibility(activity, show);\n\n        }\n\n        private performStopActivity(activity:Activity, saveState:boolean):void {\n            // Next have the activity save its current state and managed dialogs...\n            if (!activity.mFinished && saveState) {\n                let state = new Bundle();\n                //state.setAllowFds(false);\n                activity.performSaveInstanceState(state);\n            }\n\n            // Now we are idle.\n            activity.performStop();\n        }\n\n\n        private handleResumeActivity(a:Activity, launching:boolean){\n            this.performResumeActivity(a, launching);\n\n            // If the window hasn't yet been added to the window manager,\n            // and this guy didn't finish itself or start another activity,\n            // then go ahead and add the window.\n            let willBeVisible = !a.mStartedActivity && !a.mFinished;\n\n            if (willBeVisible && a.mVisibleFromClient) {\n                a.makeVisible();\n\n                //reset override Animation\n                this.overrideEnterAnimation = undefined;\n                this.overrideExitAnimation = undefined;\n                this.overrideResumeAnimation = undefined;\n                this.overrideHideAnimation = undefined;\n            }\n        }\n\n        private performResumeActivity(a:Activity, launching:boolean){\n            if(!launching){//clear mStartedActivity after onPause/onStop\n                a.mStartedActivity = false;\n            }\n            a.performResume();\n        }\n\n\n        private handleLaunchActivity(intent:Intent):Activity {\n            let visibleActivities = this.getVisibleToUserActivities();\n\n            let a = this.performLaunchActivity(intent);\n            if(a){\n                this.handleResumeActivity(a, true);\n\n                if(!a.mFinished && visibleActivities.length>0) {\n                    //pause\n                    this.handlePauseActivity(visibleActivities[visibleActivities.length - 1]);\n\n                    if (!a.getWindow().getAttributes().isFloating()) {\n                        //stop all visible activities\n                        for (let visibleActivity of visibleActivities) {\n                            this.handleStopActivity(visibleActivity);\n                        }\n                    }\n                }\n            }\n            return a;\n        }\n\n        private performLaunchActivity(intent:Intent):Activity {\n            let activity:Activity;\n            let clazz:any = intent.activityName;\n\n            try {\n                if(typeof clazz === 'string') clazz = eval(clazz);\n            } catch (e) {}\n            if(typeof clazz === 'function') activity = new clazz(this.androidUI);\n\n\n            if(activity instanceof Activity){\n                try {\n                    let savedInstanceState = null;//TODO saved state\n\n                    activity.mIntent = intent;\n                    activity.mStartedActivity = false;\n\n\n                    activity.mCalled = false;\n                    activity.performCreate(savedInstanceState);\n                    if (!activity.mCalled) {\n                        throw new Error(\"Activity \" + intent.activityName + \" did not call through to super.onCreate()\");\n                    }\n\n                    if (!activity.mFinished) {\n                        activity.performStart();\n                        activity.performRestoreInstanceState(savedInstanceState);\n                        activity.mCalled = false;\n                        activity.onPostCreate(savedInstanceState);\n                        if (!activity.mCalled) {\n                            throw new Error(\"Activity \" + intent.activityName + \" did not call through to super.onPostCreate()\");\n                        }\n                    }\n                } catch (e) {\n                    //launch Activity error\n                    console.error(e);\n                    return null;\n                }\n\n                if(!activity.mFinished){\n                    this.mLaunchedActivities.add(activity);\n                }\n\n                return <Activity>activity;\n            }\n            return null;\n        }\n\n        private handleDestroyActivity(activity:Activity, finishing:boolean):void {\n            let visibleActivities = this.getVisibleToUserActivities();\n            let isTopVisibleActivity = activity == visibleActivities[visibleActivities.length - 1];\n            let isRootActivity = this.isRootActivity(activity);\n\n            this.performDestroyActivity(activity, finishing);\n\n            if(isRootActivity) activity.getWindow().setWindowAnimations(null, null);//clear animation if root activity.\n            this.androidUI.windowManager.removeWindow(activity.getWindow());\n\n            if(isTopVisibleActivity && !isRootActivity){\n                this.scheduleActivityResume();\n            }\n        }\n\n        private performDestroyActivity(activity:Activity, finishing:boolean):void {\n            if (finishing) {\n                activity.mFinished = true;\n            }\n            //pause\n            activity.performPause();\n            //stop\n            activity.performStop();\n\n            //destory\n            activity.mCalled = false;\n            activity.performDestroy();\n            if (!activity.mCalled) {\n                throw new Error(\n                    \"Activity \" + ActivityThread.getActivityName(activity) + \" did not call through to super.onDestroy()\");\n            }\n            this.mLaunchedActivities.delete(activity);\n        }\n\n\n        private updateVisibility(activity:Activity, show:boolean):void {\n            if(show){\n                if (activity.mVisibleFromClient) {\n                    activity.makeVisible();\n                }\n            }else{\n                activity.getWindow().getDecorView().setVisibility(View.INVISIBLE);\n            }\n        }\n\n        private getVisibleToUserActivities():Activity[]{\n            let list = [];\n            for(let activity of Array.from(this.mLaunchedActivities).reverse()){\n                list.push(activity);\n                if(!activity.getWindow().getAttributes().isFloating()) break;\n            }\n            list.reverse();\n            return list;\n        }\n\n        private isRootActivity(activity:Activity):boolean {\n            return this.mLaunchedActivities.values().next().value == activity;\n        }\n\n        private static getActivityName(activity:Activity){\n            if(activity.getIntent()) return activity.getIntent().activityName;\n            return activity.constructor.name;\n        }\n    }\n}"
  },
  {
    "path": "src/android/app/AlertController.ts",
    "content": "/*\n * Copyright (C) 2008 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/app/AlertDialog.ts\"/>\n///<reference path=\"../../android/content/DialogInterface.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/graphics/drawable/ColorDrawable.ts\"/>\n///<reference path=\"../../android/graphics/Color.ts\"/>\n///<reference path=\"../../android/os/Handler.ts\"/>\n///<reference path=\"../../android/os/Message.ts\"/>\n///<reference path=\"../../android/text/TextUtils.ts\"/>\n///<reference path=\"../../android/util/TypedValue.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../android/view/LayoutInflater.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/view/Window.ts\"/>\n///<reference path=\"../../android/view/WindowManager.ts\"/>\n///<reference path=\"../../android/widget/AdapterView.ts\"/>\n///<reference path=\"../../android/widget/ArrayAdapter.ts\"/>\n///<reference path=\"../../android/widget/Button.ts\"/>\n///<reference path=\"../../android/widget/FrameLayout.ts\"/>\n///<reference path=\"../../android/widget/ImageView.ts\"/>\n///<reference path=\"../../android/widget/LinearLayout.ts\"/>\n///<reference path=\"../../android/widget/ListAdapter.ts\"/>\n///<reference path=\"../../android/widget/ListView.ts\"/>\n///<reference path=\"../../android/widget/ScrollView.ts\"/>\n///<reference path=\"../../android/widget/TextView.ts\"/>\n///<reference path=\"../../java/lang/ref/WeakReference.ts\"/>\n///<reference path=\"../../android/app/AlertDialog.ts\"/>\n///<reference path=\"../../android/app/Dialog.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n///<reference path=\"../../android/R/layout.ts\"/>\n///<reference path=\"../../android/R/id.ts\"/>\n\nmodule android.app {\n    const MATCH_PARENT = android.view.ViewGroup.LayoutParams.MATCH_PARENT;\n    import R = android.R;\n    import AlertDialog = android.app.AlertDialog;\n    import DialogInterface = android.content.DialogInterface;\n    import Drawable = android.graphics.drawable.Drawable;\n    import ColorDrawable = android.graphics.drawable.ColorDrawable;\n    import Color = android.graphics.Color;\n    import Handler = android.os.Handler;\n    import Message = android.os.Message;\n    import TextUtils = android.text.TextUtils;\n    import TypedValue = android.util.TypedValue;\n    import Gravity = android.view.Gravity;\n    import KeyEvent = android.view.KeyEvent;\n    import LayoutInflater = android.view.LayoutInflater;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import LayoutParams = android.view.ViewGroup.LayoutParams;\n    import Window = android.view.Window;\n    import WindowManager = android.view.WindowManager;\n    import AdapterView = android.widget.AdapterView;\n    import OnItemClickListener = android.widget.AdapterView.OnItemClickListener;\n    import ArrayAdapter = android.widget.ArrayAdapter;\n    import Button = android.widget.Button;\n    import FrameLayout = android.widget.FrameLayout;\n    import ImageView = android.widget.ImageView;\n    import LinearLayout = android.widget.LinearLayout;\n    import ListAdapter = android.widget.ListAdapter;\n    import ListView = android.widget.ListView;\n    import ScrollView = android.widget.ScrollView;\n    import TextView = android.widget.TextView;\n    import WeakReference = java.lang.ref.WeakReference;\n    import Dialog = android.app.Dialog;\n    import Context = android.content.Context;\n\n    export class AlertController {\n\n        private mContext:Context;\n\n        private mDialogInterface:DialogInterface;\n\n        private mWindow:Window;\n\n        private mTitle:string;\n\n        private mMessage:string;\n\n        private mListView:ListView;\n\n        private mView:View;\n\n        private mViewSpacingLeft:number = 0;\n\n        private mViewSpacingTop:number = 0;\n\n        private mViewSpacingRight:number = 0;\n\n        private mViewSpacingBottom:number = 0;\n\n        private mViewSpacingSpecified:boolean = false;\n\n        private mButtonPositive:Button;\n\n        private mButtonPositiveText:string;\n\n        private mButtonPositiveMessage:Message;\n\n        private mButtonNegative:Button;\n\n        private mButtonNegativeText:string;\n\n        private mButtonNegativeMessage:Message;\n\n        private mButtonNeutral:Button;\n\n        private mButtonNeutralText:string;\n\n        private mButtonNeutralMessage:Message;\n\n        private mScrollView:ScrollView;\n\n        //private mIconId:number = -1;\n\n        private mIcon:Drawable;\n\n        private mIconView:ImageView;\n\n        private mTitleView:TextView;\n\n        private mMessageView:TextView;\n\n        private mCustomTitleView:View;\n\n        private mForceInverseBackground:boolean;\n\n        private mAdapter:ListAdapter;\n\n        private mCheckedItem:number = -1;\n\n        private mAlertDialogLayout:string;\n\n        private mListLayout:string;\n\n        private mMultiChoiceItemLayout:string;\n\n        private mSingleChoiceItemLayout:string;\n\n        private mListItemLayout:string;\n\n        private mHandler:Handler;\n\n        mButtonHandler:View.OnClickListener = (()=> {\n            const inner_this = this;\n            class _Inner implements View.OnClickListener {\n\n                onClick(v:View):void {\n                    let m:Message = null;\n                    if (v == inner_this.mButtonPositive && inner_this.mButtonPositiveMessage != null) {\n                        m = Message.obtain(inner_this.mButtonPositiveMessage);\n                    } else if (v == inner_this.mButtonNegative && inner_this.mButtonNegativeMessage != null) {\n                        m = Message.obtain(inner_this.mButtonNegativeMessage);\n                    } else if (v == inner_this.mButtonNeutral && inner_this.mButtonNeutralMessage != null) {\n                        m = Message.obtain(inner_this.mButtonNeutralMessage);\n                    }\n                    if (m != null) {\n                        m.sendToTarget();\n                    }\n                    // Post a message so we dismiss after the above handlers are executed\n                    inner_this.mHandler.obtainMessage(AlertController.ButtonHandler.MSG_DISMISS_DIALOG, inner_this.mDialogInterface).sendToTarget();\n                }\n            }\n            return new _Inner();\n        })();\n\n\n        private static shouldCenterSingleButton(context:Context):boolean {\n            return true;\n            //let outValue:TypedValue = new TypedValue();\n            //context.getTheme().resolveAttribute(android.R.attr.alertDialogCenterButtons, outValue, true);\n            //return outValue.data != 0;\n        }\n\n        constructor(context:Context, di:DialogInterface, window:Window) {\n            this.mContext = context;\n            this.mDialogInterface = di;\n            this.mWindow = window;\n            this.mHandler = new AlertController.ButtonHandler(di);\n            //let a:TypedArray = context.obtainStyledAttributes(null, com.android.internal.R.styleable.AlertDialog, com.android.internal.R.attr.alertDialogStyle, 0);\n            this.mAlertDialogLayout = R.layout.alert_dialog;\n            this.mListLayout = R.layout.select_dialog;\n            this.mMultiChoiceItemLayout = R.layout.select_dialog_multichoice;\n            this.mSingleChoiceItemLayout = R.layout.select_dialog_singlechoice;\n            this.mListItemLayout = R.layout.select_dialog_item;\n            //a.recycle();\n        }\n\n        //static canTextInput(v:View):boolean  {\n        //    if (v.onCheckIsTextEditor()) {\n        //        return true;\n        //    }\n        //    if (!(v instanceof ViewGroup)) {\n        //        return false;\n        //    }\n        //    let vg:ViewGroup = <ViewGroup> v;\n        //    let i:number = vg.getChildCount();\n        //    while (i > 0) {\n        //        i--;\n        //        v = vg.getChildAt(i);\n        //        if (AlertController.canTextInput(v)) {\n        //            return true;\n        //        }\n        //    }\n        //    return false;\n        //}\n\n        installContent():void {\n            /* We use a custom title so never request a window title */\n            //this.mWindow.requestFeature(Window.FEATURE_NO_TITLE);\n            //if (this.mView == null || !AlertController.canTextInput(this.mView)) {\n            //    this.mWindow.setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);\n            //}\n            let layout = this.mContext.getLayoutInflater().inflate(this.mAlertDialogLayout, this.mWindow.getContentParent(), false);\n            this.mWindow.setContentView(layout);\n            this.setupView();\n        }\n\n        setTitle(title:string):void {\n            this.mTitle = title;\n            if (this.mTitleView != null) {\n                this.mTitleView.setText(title);\n            }\n        }\n\n        /**\n         * @see AlertDialog.Builder#setCustomTitle(View)\n         */\n        setCustomTitle(customTitleView:View):void {\n            this.mCustomTitleView = customTitleView;\n        }\n\n        setMessage(message:string):void {\n            this.mMessage = message;\n            if (this.mMessageView != null) {\n                this.mMessageView.setText(message);\n            }\n        }\n\n        ///**\n        // * Set the view to display in the dialog.\n        // */\n        //setView(view:View):void  {\n        //    this.mView = view;\n        //    this.mViewSpacingSpecified = false;\n        //}\n\n        /**\n         * Set the view to display in the dialog along with the spacing around that view\n         */\n        setView(view:View, viewSpacingLeft = 0, viewSpacingTop = 0, viewSpacingRight = 0, viewSpacingBottom = 0):void {\n            this.mView = view;\n            if (!viewSpacingLeft && !viewSpacingTop && !viewSpacingRight && !viewSpacingBottom) {\n                this.mViewSpacingSpecified = false;\n            } else {\n                this.mViewSpacingSpecified = true;\n                this.mViewSpacingLeft = viewSpacingLeft;\n                this.mViewSpacingTop = viewSpacingTop;\n                this.mViewSpacingRight = viewSpacingRight;\n                this.mViewSpacingBottom = viewSpacingBottom;\n            }\n        }\n\n        /**\n         * Sets a click listener or a message to be sent when the button is clicked.\n         * You only need to pass one of {@code listener} or {@code msg}.\n         *\n         * @param whichButton Which button, can be one of\n         *            {@link DialogInterface#BUTTON_POSITIVE},\n         *            {@link DialogInterface#BUTTON_NEGATIVE}, or\n         *            {@link DialogInterface#BUTTON_NEUTRAL}\n         * @param text The text to display in positive button.\n         * @param listener The {@link DialogInterface.OnClickListener} to use.\n         * @param msg The {@link Message} to be sent when clicked.\n         */\n        setButton(whichButton:number, text:string, listener:DialogInterface.OnClickListener, msg:Message):void {\n            if (msg == null && listener != null) {\n                msg = this.mHandler.obtainMessage(whichButton, listener);\n            }\n            switch (whichButton) {\n                case DialogInterface.BUTTON_POSITIVE:\n                    this.mButtonPositiveText = text;\n                    this.mButtonPositiveMessage = msg;\n                    break;\n                case DialogInterface.BUTTON_NEGATIVE:\n                    this.mButtonNegativeText = text;\n                    this.mButtonNegativeMessage = msg;\n                    break;\n                case DialogInterface.BUTTON_NEUTRAL:\n                    this.mButtonNeutralText = text;\n                    this.mButtonNeutralMessage = msg;\n                    break;\n                default:\n                    throw Error(`new IllegalArgumentException(\"Button does not exist\")`);\n            }\n        }\n\n        /**\n         * Set resId to 0 if you don't want an icon.\n         * @param resId the resourceId of the drawable to use as the icon or 0\n         * if you don't want an icon.\n         */\n        //setIcon(resId:number):void  {\n        //    this.mIconId = resId;\n        //    if (this.mIconView != null) {\n        //        if (resId > 0) {\n        //            this.mIconView.setImageResource(this.mIconId);\n        //        } else if (resId == 0) {\n        //            this.mIconView.setVisibility(View.GONE);\n        //        }\n        //    }\n        //}\n        setIcon(icon:Drawable):void {\n            this.mIcon = icon;\n            if ((this.mIconView != null) && (this.mIcon != null)) {\n                this.mIconView.setImageDrawable(icon);\n            }\n        }\n\n        ///**\n        // * @param attrId the attributeId of the theme-specific drawable\n        // * to resolve the resourceId for.\n        // *\n        // * @return resId the resourceId of the theme-specific drawable\n        // */\n        //getIconAttributeResId(attrId:number):number  {\n        //    let out:TypedValue = new TypedValue();\n        //    this.mContext.getTheme().resolveAttribute(attrId, out, true);\n        //    return out.resourceId;\n        //}\n\n        setInverseBackgroundForced(forceInverseBackground:boolean):void {\n            this.mForceInverseBackground = forceInverseBackground;\n        }\n\n        getListView():ListView {\n            return this.mListView;\n        }\n\n        getButton(whichButton:number):Button {\n            switch (whichButton) {\n                case DialogInterface.BUTTON_POSITIVE:\n                    return this.mButtonPositive;\n                case DialogInterface.BUTTON_NEGATIVE:\n                    return this.mButtonNegative;\n                case DialogInterface.BUTTON_NEUTRAL:\n                    return this.mButtonNeutral;\n                default:\n                    return null;\n            }\n        }\n\n        onKeyDown(keyCode:number, event:KeyEvent):boolean {\n            return this.mScrollView != null && this.mScrollView.executeKeyEvent(event);\n        }\n\n        onKeyUp(keyCode:number, event:KeyEvent):boolean {\n            return this.mScrollView != null && this.mScrollView.executeKeyEvent(event);\n        }\n\n        private setupView():void {\n            let contentPanel:LinearLayout = <LinearLayout> this.mWindow.findViewById(R.id.contentPanel);\n            this.setupContent(contentPanel);\n            let hasButtons:boolean = this.setupButtons();\n            let topPanel:LinearLayout = <LinearLayout> this.mWindow.findViewById(R.id.topPanel);\n            //let a:TypedArray = this.mContext.obtainStyledAttributes(null, com.android.internal.R.styleable.AlertDialog, com.android.internal.R.attr.alertDialogStyle, 0);\n            let hasTitle:boolean = this.setupTitle(topPanel);\n            let buttonPanel:View = this.mWindow.findViewById(R.id.buttonPanel);\n            if (!hasButtons) {\n                buttonPanel.setVisibility(View.GONE);\n                this.mWindow.setCloseOnTouchOutsideIfNotSet(true);\n            }\n            let customPanel:FrameLayout = null;\n            if (this.mView != null) {\n                customPanel = <FrameLayout> this.mWindow.findViewById(R.id.customPanel);\n                let custom:FrameLayout = <FrameLayout> this.mWindow.findViewById(R.id.custom);\n                custom.addView(this.mView, new LayoutParams(MATCH_PARENT, MATCH_PARENT));\n                if (this.mViewSpacingSpecified) {\n                    custom.setPadding(this.mViewSpacingLeft, this.mViewSpacingTop, this.mViewSpacingRight, this.mViewSpacingBottom);\n                }\n                if (this.mListView != null) {\n                    (<LinearLayout.LayoutParams> customPanel.getLayoutParams()).weight = 0;\n                }\n            } else {\n                this.mWindow.findViewById(R.id.customPanel).setVisibility(View.GONE);\n            }\n            /* Only display the divider if we have a title and a\n             * custom view or a message.\n             */\n            if (hasTitle) {\n                let divider:View = null;\n                if (this.mMessage != null || this.mView != null || this.mListView != null) {\n                    divider = this.mWindow.findViewById(R.id.titleDivider);\n                } else {\n                    divider = this.mWindow.findViewById(R.id.titleDividerTop);\n                }\n                if (divider != null) {\n                    divider.setVisibility(View.VISIBLE);\n                }\n            }\n            this.setBackground(topPanel, contentPanel, customPanel, hasButtons, hasTitle, buttonPanel);\n            //a.recycle();\n        }\n\n        private setupTitle(topPanel:LinearLayout):boolean {\n            let hasTitle:boolean = true;\n            if (this.mCustomTitleView != null) {\n                // Add the custom title view directly to the topPanel layout\n                let lp:LinearLayout.LayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);\n                topPanel.addView(this.mCustomTitleView, 0, lp);\n                // Hide the title template\n                let titleTemplate:View = this.mWindow.findViewById(R.id.title_template);\n                titleTemplate.setVisibility(View.GONE);\n            } else {\n                const hasTextTitle:boolean = !TextUtils.isEmpty(this.mTitle);\n                this.mIconView = <ImageView> this.mWindow.findViewById(R.id.icon);\n                if (hasTextTitle) {\n                    /* Display the title if a title is supplied, else hide it */\n                    this.mTitleView = <TextView> this.mWindow.findViewById(R.id.alertTitle);\n                    this.mTitleView.setText(this.mTitle);\n                    /* Do this last so that if the user has supplied any\n                     * icons we use them instead of the default ones. If the\n                     * user has specified 0 then make it disappear.\n                     */\n                    //if (this.mIconId > 0) {\n                    //    this.mIconView.setImageResource(this.mIconId);\n                    //} else\n                    if (this.mIcon != null) {\n                        this.mIconView.setImageDrawable(this.mIcon);\n                    } else\n                    //if (this.mIconId == 0)\n                    {\n                        /* Apply the padding from the icon to ensure the\n                         * title is aligned correctly.\n                         */\n                        this.mTitleView.setPadding(this.mIconView.getPaddingLeft(), this.mIconView.getPaddingTop(), this.mIconView.getPaddingRight(), this.mIconView.getPaddingBottom());\n                        this.mIconView.setVisibility(View.GONE);\n                    }\n                } else {\n                    // Hide the title template\n                    let titleTemplate:View = this.mWindow.findViewById(R.id.title_template);\n                    titleTemplate.setVisibility(View.GONE);\n                    this.mIconView.setVisibility(View.GONE);\n                    topPanel.setVisibility(View.GONE);\n                    hasTitle = false;\n                }\n            }\n            return hasTitle;\n        }\n\n        private setupContent(contentPanel:LinearLayout):void {\n            this.mScrollView = <ScrollView> this.mWindow.findViewById(R.id.scrollView);\n            this.mScrollView.setFocusable(false);\n            // Special case for users that only want to display a String\n            this.mMessageView = <TextView> this.mWindow.findViewById(R.id.message);\n            if (this.mMessageView == null) {\n                return;\n            }\n            if (this.mMessage != null) {\n                this.mMessageView.setText(this.mMessage);\n            } else {\n                this.mMessageView.setVisibility(View.GONE);\n                this.mScrollView.removeView(this.mMessageView);\n                if (this.mListView != null) {\n                    contentPanel.removeView(this.mWindow.findViewById(R.id.scrollView));\n                    contentPanel.addView(this.mListView, new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));\n                    contentPanel.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, 0, 1.0));\n                } else {\n                    contentPanel.setVisibility(View.GONE);\n                }\n            }\n        }\n\n        private setupButtons():boolean {\n            let BIT_BUTTON_POSITIVE:number = 1;\n            let BIT_BUTTON_NEGATIVE:number = 2;\n            let BIT_BUTTON_NEUTRAL:number = 4;\n            let whichButtons:number = 0;\n            this.mButtonPositive = <Button> this.mWindow.findViewById(R.id.button1);\n            this.mButtonPositive.setOnClickListener(this.mButtonHandler);\n            if (TextUtils.isEmpty(this.mButtonPositiveText)) {\n                this.mButtonPositive.setVisibility(View.GONE);\n            } else {\n                this.mButtonPositive.setText(this.mButtonPositiveText);\n                this.mButtonPositive.setVisibility(View.VISIBLE);\n                whichButtons = whichButtons | BIT_BUTTON_POSITIVE;\n            }\n            this.mButtonNegative = <Button> this.mWindow.findViewById(R.id.button2);\n            this.mButtonNegative.setOnClickListener(this.mButtonHandler);\n            if (TextUtils.isEmpty(this.mButtonNegativeText)) {\n                this.mButtonNegative.setVisibility(View.GONE);\n            } else {\n                this.mButtonNegative.setText(this.mButtonNegativeText);\n                this.mButtonNegative.setVisibility(View.VISIBLE);\n                whichButtons = whichButtons | BIT_BUTTON_NEGATIVE;\n            }\n            this.mButtonNeutral = <Button> this.mWindow.findViewById(R.id.button3);\n            this.mButtonNeutral.setOnClickListener(this.mButtonHandler);\n            if (TextUtils.isEmpty(this.mButtonNeutralText)) {\n                this.mButtonNeutral.setVisibility(View.GONE);\n            } else {\n                this.mButtonNeutral.setText(this.mButtonNeutralText);\n                this.mButtonNeutral.setVisibility(View.VISIBLE);\n                whichButtons = whichButtons | BIT_BUTTON_NEUTRAL;\n            }\n            if (AlertController.shouldCenterSingleButton(this.mContext)) {\n                /*\n                 * If we only have 1 button it should be centered on the layout and\n                 * expand to fill 50% of the available space.\n                 */\n                if (whichButtons == BIT_BUTTON_POSITIVE) {\n                    this.centerButton(this.mButtonPositive);\n                } else if (whichButtons == BIT_BUTTON_NEGATIVE) {\n                    this.centerButton(this.mButtonNegative);\n                } else if (whichButtons == BIT_BUTTON_NEUTRAL) {\n                    this.centerButton(this.mButtonNeutral);\n                }\n            }\n            return whichButtons != 0;\n        }\n\n        private centerButton(button:Button):void {\n            let params:LinearLayout.LayoutParams = <LinearLayout.LayoutParams> button.getLayoutParams();\n            params.gravity = Gravity.CENTER_HORIZONTAL;\n            params.weight = 0.5;\n            button.setLayoutParams(params);\n            let leftSpacer:View = this.mWindow.findViewById(R.id.leftSpacer);\n            if (leftSpacer != null) {\n                leftSpacer.setVisibility(View.VISIBLE);\n            }\n            let rightSpacer:View = this.mWindow.findViewById(R.id.rightSpacer);\n            if (rightSpacer != null) {\n                rightSpacer.setVisibility(View.VISIBLE);\n            }\n        }\n\n        private setBackground(topPanel:LinearLayout, contentPanel:LinearLayout, customPanel:View, hasButtons:boolean, hasTitle:boolean, buttonPanel:View):void {\n            /* Get all the different background required */\n            let fullDark:Drawable = R.image.popup_full_bright;//R.drawable.popup_full_dark;\n            let topDark:Drawable = R.image.popup_top_bright;//R.drawable.popup_top_dark;\n            let centerDark:Drawable = R.image.popup_center_bright;//R.drawable.popup_center_dark;\n            let bottomDark:Drawable = R.image.popup_bottom_bright;//R.drawable.popup_bottom_dark;\n            let fullBright:Drawable = R.image.popup_full_bright;\n            let topBright:Drawable = R.image.popup_top_bright;\n            let centerBright:Drawable = R.image.popup_center_bright;\n            let bottomBright:Drawable = R.image.popup_bottom_bright;\n            let bottomMedium:Drawable = R.image.popup_bottom_bright;//R.drawable.popup_bottom_medium;\n            /*\n             * We now set the background of all of the sections of the alert.\n             * First collect together each section that is being displayed along\n             * with whether it is on a light or dark background, then run through\n             * them setting their backgrounds.  This is complicated because we need\n             * to correctly use the full, top, middle, and bottom graphics depending\n             * on how many views they are and where they appear.\n             */\n            let views:View[] = new Array<View>(4);\n            let light:boolean[] = new Array<boolean>(4);\n            let lastView:View = null;\n            let lastLight:boolean = false;\n            let pos:number = 0;\n            if (hasTitle) {\n                views[pos] = topPanel;\n                light[pos] = false;\n                pos++;\n            }\n            /* The contentPanel displays either a custom text message or\n             * a ListView. If it's text we should use the dark background\n             * for ListView we should use the light background. If neither\n             * are there the contentPanel will be hidden so set it as null.\n             */\n            views[pos] = (contentPanel.getVisibility() == View.GONE) ? null : contentPanel;\n            light[pos] = this.mListView != null;\n            pos++;\n            if (customPanel != null) {\n                views[pos] = customPanel;\n                light[pos] = this.mForceInverseBackground;\n                pos++;\n            }\n            if (hasButtons) {\n                views[pos] = buttonPanel;\n                light[pos] = true;\n            }\n            let setView:boolean = false;\n            for (pos = 0; pos < views.length; pos++) {\n                let v:View = views[pos];\n                if (v == null) {\n                    continue;\n                }\n                if (lastView != null) {\n                    if (!setView) {\n                        lastView.setBackground(lastLight ? topBright : topDark);\n                    } else {\n                        lastView.setBackground(lastLight ? centerBright : centerDark);\n                    }\n                    setView = true;\n                }\n                lastView = v;\n                lastLight = light[pos];\n            }\n            if (lastView != null) {\n                if (setView) {\n                    /* ListViews will use the Bright background but buttons use\n                     * the Medium background.\n                     */\n                    lastView.setBackground(lastLight ? (hasButtons ? bottomMedium : bottomBright) : bottomDark);\n                } else {\n                    lastView.setBackground(lastLight ? fullBright : fullDark);\n                }\n            }\n            if ((this.mListView != null) && (this.mAdapter != null)) {\n                this.mListView.setAdapter(this.mAdapter);\n                if (this.mCheckedItem > -1) {\n                    this.mListView.setItemChecked(this.mCheckedItem, true);\n                    this.mListView.setSelection(this.mCheckedItem);\n                }\n            }\n        }\n\n\n    }\n\n    export module AlertController {\n        export class ButtonHandler extends Handler {\n\n            // Button clicks have Message.what as the BUTTON{1,2,3} constant\n            private static MSG_DISMISS_DIALOG:number = 1;\n\n            private mDialog:WeakReference<DialogInterface>;\n\n            constructor(dialog:DialogInterface) {\n                super();\n                this.mDialog = new WeakReference<DialogInterface>(dialog);\n            }\n\n            handleMessage(msg:Message):void {\n                switch (msg.what) {\n                    case DialogInterface.BUTTON_POSITIVE:\n                    case DialogInterface.BUTTON_NEGATIVE:\n                    case DialogInterface.BUTTON_NEUTRAL:\n                        (<DialogInterface.OnClickListener> msg.obj).onClick(this.mDialog.get(), msg.what);\n                        break;\n                    case ButtonHandler.MSG_DISMISS_DIALOG:\n                        (<DialogInterface> msg.obj).dismiss();\n                }\n            }\n        }\n        export class RecycleListView extends ListView {\n\n            mRecycleOnMeasure:boolean = true;\n\n            constructor(context:Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n                super(context, bindElement, defStyle);\n            }\n\n            protected recycleOnMeasure():boolean {\n                return this.mRecycleOnMeasure;\n            }\n        }\n        export class AlertParams {\n\n            mContext:Context;\n\n            mInflater:LayoutInflater;\n\n            mIconId:number = 0;\n\n            mIcon:Drawable;\n\n            //mIconAttrId:number = 0;\n\n            mTitle:string;\n\n            mCustomTitleView:View;\n\n            mMessage:string;\n\n            mPositiveButtonText:string;\n\n            mPositiveButtonListener:DialogInterface.OnClickListener;\n\n            mNegativeButtonText:string;\n\n            mNegativeButtonListener:DialogInterface.OnClickListener;\n\n            mNeutralButtonText:string;\n\n            mNeutralButtonListener:DialogInterface.OnClickListener;\n\n            mCancelable:boolean;\n\n            mOnCancelListener:DialogInterface.OnCancelListener;\n\n            mOnDismissListener:DialogInterface.OnDismissListener;\n\n            mOnKeyListener:DialogInterface.OnKeyListener;\n\n            mItems:string[];\n\n            mAdapter:ListAdapter;\n\n            mOnClickListener:DialogInterface.OnClickListener;\n\n            mView:View;\n\n            mViewSpacingLeft:number = 0;\n\n            mViewSpacingTop:number = 0;\n\n            mViewSpacingRight:number = 0;\n\n            mViewSpacingBottom:number = 0;\n\n            mViewSpacingSpecified:boolean = false;\n\n            mCheckedItems:boolean[];\n\n            mIsMultiChoice:boolean;\n\n            mIsSingleChoice:boolean;\n\n            mCheckedItem:number = -1;\n\n            mOnCheckboxClickListener:DialogInterface.OnMultiChoiceClickListener;\n\n            //mCursor:Cursor;\n\n            mLabelColumn:string;\n\n            mIsCheckedColumn:string;\n\n            mForceInverseBackground:boolean;\n\n            mOnItemSelectedListener:AdapterView.OnItemSelectedListener;\n\n            mOnPrepareListViewListener:AlertParams.OnPrepareListViewListener;\n\n            mRecycleOnMeasure:boolean = true;\n\n\n            constructor(context:Context) {\n                this.mContext = context;\n                this.mCancelable = true;\n                this.mInflater = context.getLayoutInflater();//<LayoutInflater> context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n            }\n\n            apply(dialog:AlertController):void {\n                if (this.mCustomTitleView != null) {\n                    dialog.setCustomTitle(this.mCustomTitleView);\n                } else {\n                    if (this.mTitle != null) {\n                        dialog.setTitle(this.mTitle);\n                    }\n                    if (this.mIcon != null) {\n                        dialog.setIcon(this.mIcon);\n                    }\n                    //if (this.mIconId >= 0) {\n                    //    dialog.setIcon(this.mIconId);\n                    //}\n                    //if (this.mIconAttrId > 0) {\n                    //    dialog.setIcon(dialog.getIconAttributeResId(this.mIconAttrId));\n                    //}\n                }\n                if (this.mMessage != null) {\n                    dialog.setMessage(this.mMessage);\n                }\n                if (this.mPositiveButtonText != null) {\n                    dialog.setButton(DialogInterface.BUTTON_POSITIVE, this.mPositiveButtonText, this.mPositiveButtonListener, null);\n                }\n                if (this.mNegativeButtonText != null) {\n                    dialog.setButton(DialogInterface.BUTTON_NEGATIVE, this.mNegativeButtonText, this.mNegativeButtonListener, null);\n                }\n                if (this.mNeutralButtonText != null) {\n                    dialog.setButton(DialogInterface.BUTTON_NEUTRAL, this.mNeutralButtonText, this.mNeutralButtonListener, null);\n                }\n                if (this.mForceInverseBackground) {\n                    dialog.setInverseBackgroundForced(true);\n                }\n                // adapter or a cursor\n                if ((this.mItems != null) /*|| (this.mCursor != null)*/ || (this.mAdapter != null)) {\n                    this.createListView(dialog);\n                }\n                if (this.mView != null) {\n                    if (this.mViewSpacingSpecified) {\n                        dialog.setView(this.mView, this.mViewSpacingLeft, this.mViewSpacingTop, this.mViewSpacingRight, this.mViewSpacingBottom);\n                    } else {\n                        dialog.setView(this.mView);\n                    }\n                }\n                /*\n                 dialog.setCancelable(mCancelable);\n                 dialog.setOnCancelListener(mOnCancelListener);\n                 if (mOnKeyListener != null) {\n                 dialog.setOnKeyListener(mOnKeyListener);\n                 }\n                 */\n            }\n\n            private createListView(dialog:AlertController):void {\n                const listView:AlertController.RecycleListView = <AlertController.RecycleListView> this.mInflater.inflate(dialog.mListLayout, null);\n                let adapter:ListAdapter;\n                if (this.mIsMultiChoice) {\n                    //if (this.mCursor == null) {\n                    adapter = (()=> {\n                        const inner_this = this;\n                        class _Inner extends ArrayAdapter<string> {\n                            getView(position:number, convertView:View, parent:ViewGroup):View {\n                                let view:View = super.getView(position, convertView, parent);\n                                if (inner_this.mCheckedItems != null) {\n                                    let isItemChecked:boolean = inner_this.mCheckedItems[position];\n                                    if (isItemChecked) {\n                                        listView.setItemChecked(position, true);\n                                    }\n                                }\n                                return view;\n                            }\n                        }\n                        return new _Inner(this.mContext, dialog.mMultiChoiceItemLayout, R.id.text1, this.mItems);\n                    })();\n                    //} else {\n                    //    adapter = (()=>{\n                    //        const inner_this=this;\n                    //        class _Inner extends CursorAdapter {\n                    //\n                    //            private mLabelIndex:number = 0;\n                    //\n                    //            private mIsCheckedIndex:number = 0;\n                    //\n                    //            {\n                    //                const cursor:Cursor = this.getCursor();\n                    //                mLabelIndex = cursor.getColumnIndexOrThrow(inner_this.mLabelColumn);\n                    //                mIsCheckedIndex = cursor.getColumnIndexOrThrow(inner_this.mIsCheckedColumn);\n                    //            }\n                    //\n                    //            bindView(view:View, context:Context, cursor:Cursor):void  {\n                    //                let text:CheckedTextView = <CheckedTextView> view.findViewById(R.id.text1);\n                    //                text.setText(cursor.getString(mLabelIndex));\n                    //                listView.setItemChecked(cursor.getPosition(), cursor.getInt(mIsCheckedIndex) == 1);\n                    //            }\n                    //\n                    //            newView(context:Context, cursor:Cursor, parent:ViewGroup):View  {\n                    //                return inner_this.mInflater.inflate(dialog.mMultiChoiceItemLayout, parent, false);\n                    //            }\n                    //        }\n                    //        return new _Inner(this.mContext, this.mCursor, false);\n                    //    })();\n                    //}\n                } else {\n                    let layout:string = this.mIsSingleChoice ? dialog.mSingleChoiceItemLayout : dialog.mListItemLayout;\n                    //if (this.mCursor == null) {\n                    adapter = (this.mAdapter != null) ? this.mAdapter : new ArrayAdapter<string>(this.mContext, layout, R.id.text1, this.mItems);\n                    //} else {\n                    //    adapter = new SimpleCursorAdapter(this.mContext, layout, this.mCursor,  [ this.mLabelColumn ],  [ R.id.text1 ]);\n                    //}\n                }\n                if (this.mOnPrepareListViewListener != null) {\n                    this.mOnPrepareListViewListener.onPrepareListView(listView);\n                }\n                /* Don't directly set the adapter on the ListView as we might\n                 * want to add a footer to the ListView later.\n                 */\n                dialog.mAdapter = adapter;\n                dialog.mCheckedItem = this.mCheckedItem;\n                const inner_this = this;\n                if (this.mOnClickListener != null) {\n                    listView.setOnItemClickListener({\n                        onItemClick(parent:AdapterView<any>, v:View, position:number, id:number):void {\n                            inner_this.mOnClickListener.onClick(dialog.mDialogInterface, position);\n                            if (!inner_this.mIsSingleChoice) {\n                                dialog.mDialogInterface.dismiss();\n                            }\n                        }\n                    });\n                } else if (this.mOnCheckboxClickListener != null) {\n                    listView.setOnItemClickListener({\n                        onItemClick(parent:AdapterView<any>, v:View, position:number, id:number):void {\n                            if (inner_this.mCheckedItems != null) {\n                                inner_this.mCheckedItems[position] = listView.isItemChecked(position);\n                            }\n                            inner_this.mOnCheckboxClickListener.onClick(dialog.mDialogInterface, position, listView.isItemChecked(position));\n                        }\n                    });\n                }\n                // Attach a given OnItemSelectedListener to the ListView\n                if (this.mOnItemSelectedListener != null) {\n                    listView.setOnItemSelectedListener(this.mOnItemSelectedListener);\n                }\n                if (this.mIsSingleChoice) {\n                    listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);\n                } else if (this.mIsMultiChoice) {\n                    listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);\n                }\n                listView.mRecycleOnMeasure = this.mRecycleOnMeasure;\n                dialog.mListView = listView;\n            }\n        }\n\n        export module AlertParams {\n            /**\n             * Interface definition for a callback to be invoked before the ListView\n             * will be bound to an adapter.\n             */\n            export interface OnPrepareListViewListener {\n\n                /**\n                 * Called before the ListView is bound to an adapter.\n                 * @param listView The ListView that will be shown in the dialog.\n                 */\n                onPrepareListView(listView:ListView):void ;\n            }\n        }\n\n    }\n\n}"
  },
  {
    "path": "src/android/app/AlertDialog.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/content/DialogInterface.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/os/Bundle.ts\"/>\n///<reference path=\"../../android/os/Message.ts\"/>\n///<reference path=\"../../android/util/TypedValue.ts\"/>\n///<reference path=\"../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/WindowManager.ts\"/>\n///<reference path=\"../../android/widget/AdapterView.ts\"/>\n///<reference path=\"../../android/widget/Button.ts\"/>\n///<reference path=\"../../android/widget/ListAdapter.ts\"/>\n///<reference path=\"../../android/widget/ListView.ts\"/>\n///<reference path=\"../../android/app/Application.ts\"/>\n///<reference path=\"../../android/app/Dialog.ts\"/>\n///<reference path=\"../../android/app/AlertController.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n\nmodule android.app {\nimport DialogInterface = android.content.DialogInterface;\nimport Drawable = android.graphics.drawable.Drawable;\nimport Bundle = android.os.Bundle;\nimport Message = android.os.Message;\nimport TypedValue = android.util.TypedValue;\nimport KeyEvent = android.view.KeyEvent;\nimport MotionEvent = android.view.MotionEvent;\nimport View = android.view.View;\nimport WindowManager = android.view.WindowManager;\nimport AdapterView = android.widget.AdapterView;\nimport Button = android.widget.Button;\nimport ListAdapter = android.widget.ListAdapter;\nimport ListView = android.widget.ListView;\nimport Application = android.app.Application;\nimport Dialog = android.app.Dialog;\nimport Context = android.content.Context;\n/**\n * A subclass of Dialog that can display one, two or three buttons. If you only want to\n * display a String in this dialog box, use the setMessage() method.  If you\n * want to display a more complex view, look up the FrameLayout called \"custom\"\n * and add your view to it:\n *\n * <pre>\n * FrameLayout fl = (FrameLayout) findViewById(android.R.id.custom);\n * fl.addView(myView, new LayoutParams(MATCH_PARENT, WRAP_CONTENT));\n * </pre>\n * \n * <p>The AlertDialog class takes care of automatically setting\n * {@link WindowManager.LayoutParams#FLAG_ALT_FOCUSABLE_IM\n * WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM} for you based on whether\n * any views in the dialog return true from {@link View#onCheckIsTextEditor()\n * View.onCheckIsTextEditor()}.  Generally you want this set for a Dialog\n * without text editors, so that it will be placed on top of the current\n * input method UI.  You can modify this behavior by forcing the flag to your\n * desired mode after calling {@link #onCreate}.\n *\n * <div class=\"special reference\">\n * <h3>Developer Guides</h3>\n * <p>For more information about creating dialogs, read the\n * <a href=\"{@docRoot}guide/topics/ui/dialogs.html\">Dialogs</a> developer guide.</p>\n * </div>\n */\nexport class AlertDialog extends Dialog implements DialogInterface {\n\n    private mAlert:AlertController;\n\n    /**\n     * Special theme constant for {@link #AlertDialog(Context, int)}: use\n     * the traditional (pre-Holo) alert dialog theme.\n     */\n    static THEME_TRADITIONAL:number = 1;\n\n    /**\n     * Special theme constant for {@link #AlertDialog(Context, int)}: use\n     * the holographic alert theme with a dark background.\n     */\n    static THEME_HOLO_DARK:number = 2;\n\n    /**\n     * Special theme constant for {@link #AlertDialog(Context, int)}: use\n     * the holographic alert theme with a light background.\n     */\n    static THEME_HOLO_LIGHT:number = 3;\n\n    /**\n     * Special theme constant for {@link #AlertDialog(Context, int)}: use\n     * the device's default alert theme with a dark background.\n     */\n    static THEME_DEVICE_DEFAULT_DARK:number = 4;\n\n    /**\n     * Special theme constant for {@link #AlertDialog(Context, int)}: use\n     * the device's default alert theme with a light background.\n     */\n    static THEME_DEVICE_DEFAULT_LIGHT:number = 5;\n\n    /**\n     * Construct an AlertDialog that uses an explicit theme.  The actual style\n     * that an AlertDialog uses is a private implementation, however you can\n     * here supply either the name of an attribute in the theme from which\n     * to get the dialog's style (such as {@link android.R.attr#alertDialogTheme}\n     * or one of the constants {@link #THEME_TRADITIONAL},\n     * {@link #THEME_HOLO_DARK}, or {@link #THEME_HOLO_LIGHT}.\n     */\n    constructor(context:Context, cancelable?:boolean, cancelListener?:DialogInterface.OnCancelListener) {\n        super(context);\n        //this.mWindow.alwaysReadCloseOnTouchAttr();\n        this.setCancelable(cancelable);\n        this.setOnCancelListener(cancelListener);\n        this.mAlert = new AlertController(context, this, this.getWindow());\n    }\n\n    //static resolveDialogTheme(context:Context, resid:number):number  {\n    //    if (resid == AlertDialog.THEME_TRADITIONAL) {\n    //        return com.android.internal.R.style.Theme_Dialog_Alert;\n    //    } else if (resid == AlertDialog.THEME_HOLO_DARK) {\n    //        return com.android.internal.R.style.Theme_Holo_Dialog_Alert;\n    //    } else if (resid == AlertDialog.THEME_HOLO_LIGHT) {\n    //        return com.android.internal.R.style.Theme_Holo_Light_Dialog_Alert;\n    //    } else if (resid == AlertDialog.THEME_DEVICE_DEFAULT_DARK) {\n    //        return com.android.internal.R.style.Theme_DeviceDefault_Dialog_Alert;\n    //    } else if (resid == AlertDialog.THEME_DEVICE_DEFAULT_LIGHT) {\n    //        return com.android.internal.R.style.Theme_DeviceDefault_Light_Dialog_Alert;\n    //    } else if (resid >= 0x01000000) {\n    //        // start of real resource IDs.\n    //        return resid;\n    //    } else {\n    //        let outValue:TypedValue = new TypedValue();\n    //        context.getTheme().resolveAttribute(com.android.internal.R.attr.alertDialogTheme, outValue, true);\n    //        return outValue.resourceId;\n    //    }\n    //}\n\n    /**\n     * Gets one of the buttons used in the dialog.\n     * <p>\n     * If a button does not exist in the dialog, null will be returned.\n     * \n     * @param whichButton The identifier of the button that should be returned.\n     *            For example, this can be\n     *            {@link DialogInterface#BUTTON_POSITIVE}.\n     * @return The button from the dialog, or null if a button does not exist.\n     */\n    getButton(whichButton:number):Button  {\n        return this.mAlert.getButton(whichButton);\n    }\n\n    /**\n     * Gets the list view used in the dialog.\n     *  \n     * @return The {@link ListView} from the dialog.\n     */\n    getListView():ListView  {\n        return this.mAlert.getListView();\n    }\n\n    setTitle(title:string):void  {\n        super.setTitle(title);\n        this.mAlert.setTitle(title);\n    }\n\n    /**\n     * @see Builder#setCustomTitle(View)\n     */\n    setCustomTitle(customTitleView:View):void  {\n        this.mAlert.setCustomTitle(customTitleView);\n    }\n\n    setMessage(message:string):void  {\n        this.mAlert.setMessage(message);\n    }\n\n    /**\n     * Set the view to display in that dialog, specifying the spacing to appear around that \n     * view.\n     *\n     * @param view The view to show in the content area of the dialog\n     * @param viewSpacingLeft Extra space to appear to the left of {@code view}\n     * @param viewSpacingTop Extra space to appear above {@code view}\n     * @param viewSpacingRight Extra space to appear to the right of {@code view}\n     * @param viewSpacingBottom Extra space to appear below {@code view}\n     */\n    setView(view:View, viewSpacingLeft=0, viewSpacingTop=0, viewSpacingRight=0, viewSpacingBottom=0):void  {\n        this.mAlert.setView(view, viewSpacingLeft, viewSpacingTop, viewSpacingRight, viewSpacingBottom);\n    }\n\n    ///**\n    // * Set a message to be sent when a button is pressed.\n    // *\n    // * @param whichButton Which button to set the message for, can be one of\n    // *            {@link DialogInterface#BUTTON_POSITIVE},\n    // *            {@link DialogInterface#BUTTON_NEGATIVE}, or\n    // *            {@link DialogInterface#BUTTON_NEUTRAL}\n    // * @param text The text to display in positive button.\n    // * @param msg The {@link Message} to be sent when clicked.\n    // */\n    //setButton(whichButton:number, text:CharSequence, msg:Message):void  {\n    //    this.mAlert.setButton(whichButton, text, null, msg);\n    //}\n\n    /**\n     * Set a listener to be invoked when the positive button of the dialog is pressed.\n     * \n     * @param whichButton Which button to set the listener on, can be one of\n     *            {@link DialogInterface#BUTTON_POSITIVE},\n     *            {@link DialogInterface#BUTTON_NEGATIVE}, or\n     *            {@link DialogInterface#BUTTON_NEUTRAL}\n     * @param text The text to display in positive button.\n     * @param listener The {@link DialogInterface.OnClickListener} to use.\n     */\n    setButton(whichButton:number, text:string, listener:DialogInterface.OnClickListener):void  {\n        this.mAlert.setButton(whichButton, text, listener, null);\n    }\n\n    ///**\n    // * @deprecated Use {@link #setButton(int, CharSequence, Message)} with\n    // *             {@link DialogInterface#BUTTON_POSITIVE}.\n    // */\n    //setButton(text:CharSequence, msg:Message):void  {\n    //    this.setButton(BUTTON_POSITIVE, text, msg);\n    //}\n    //\n    ///**\n    // * @deprecated Use {@link #setButton(int, CharSequence, Message)} with\n    // *             {@link DialogInterface#BUTTON_NEGATIVE}.\n    // */\n    //setButton2(text:CharSequence, msg:Message):void  {\n    //    this.setButton(BUTTON_NEGATIVE, text, msg);\n    //}\n    //\n    ///**\n    // * @deprecated Use {@link #setButton(int, CharSequence, Message)} with\n    // *             {@link DialogInterface#BUTTON_NEUTRAL}.\n    // */\n    //setButton3(text:CharSequence, msg:Message):void  {\n    //    this.setButton(BUTTON_NEUTRAL, text, msg);\n    //}\n    //\n    ///**\n    // * Set a listener to be invoked when button 1 of the dialog is pressed.\n    // *\n    // * @param text The text to display in button 1.\n    // * @param listener The {@link DialogInterface.OnClickListener} to use.\n    // * @deprecated Use\n    // *             {@link #setButton(int, CharSequence, android.content.DialogInterface.OnClickListener)}\n    // *             with {@link DialogInterface#BUTTON_POSITIVE}\n    // */\n    //setButton(text:CharSequence, listener:OnClickListener):void  {\n    //    this.setButton(BUTTON_POSITIVE, text, listener);\n    //}\n    //\n    ///**\n    // * Set a listener to be invoked when button 2 of the dialog is pressed.\n    // * @param text The text to display in button 2.\n    // * @param listener The {@link DialogInterface.OnClickListener} to use.\n    // * @deprecated Use\n    // *             {@link #setButton(int, CharSequence, android.content.DialogInterface.OnClickListener)}\n    // *             with {@link DialogInterface#BUTTON_NEGATIVE}\n    // */\n    //setButton2(text:CharSequence, listener:OnClickListener):void  {\n    //    this.setButton(BUTTON_NEGATIVE, text, listener);\n    //}\n    //\n    ///**\n    // * Set a listener to be invoked when button 3 of the dialog is pressed.\n    // * @param text The text to display in button 3.\n    // * @param listener The {@link DialogInterface.OnClickListener} to use.\n    // * @deprecated Use\n    // *             {@link #setButton(int, CharSequence, android.content.DialogInterface.OnClickListener)}\n    // *             with {@link DialogInterface#BUTTON_POSITIVE}\n    // */\n    //setButton3(text:CharSequence, listener:OnClickListener):void  {\n    //    this.setButton(BUTTON_NEUTRAL, text, listener);\n    //}\n    //\n    ///**\n    // * Set resId to 0 if you don't want an icon.\n    // * @param resId the resourceId of the drawable to use as the icon or 0\n    // * if you don't want an icon.\n    // */\n    //setIcon(resId:number):void  {\n    //    this.mAlert.setIcon(resId);\n    //}\n\n    setIcon(icon:Drawable):void  {\n        this.mAlert.setIcon(icon);\n    }\n\n    ///**\n    // * Set an icon as supplied by a theme attribute. e.g. android.R.attr.alertDialogIcon\n    // *\n    // * @param attrId ID of a theme attribute that points to a drawable resource.\n    // */\n    //setIconAttribute(attrId:number):void  {\n    //    let out:TypedValue = new TypedValue();\n    //    this.mContext.getTheme().resolveAttribute(attrId, out, true);\n    //    this.mAlert.setIcon(out.resourceId);\n    //}\n    //\n    //setInverseBackgroundForced(forceInverseBackground:boolean):void  {\n    //    this.mAlert.setInverseBackgroundForced(forceInverseBackground);\n    //}\n\n    protected onCreate(savedInstanceState:Bundle):void  {\n        super.onCreate(savedInstanceState);\n        this.mAlert.installContent();\n    }\n\n    onKeyDown(keyCode:number, event:KeyEvent):boolean  {\n        if (this.mAlert.onKeyDown(keyCode, event))\n            return true;\n        return super.onKeyDown(keyCode, event);\n    }\n\n    onKeyUp(keyCode:number, event:KeyEvent):boolean  {\n        if (this.mAlert.onKeyUp(keyCode, event))\n            return true;\n        return super.onKeyUp(keyCode, event);\n    }\n\n\n}\n\nexport module AlertDialog{\nexport class Builder {\n\n    private P:AlertController.AlertParams;\n\n    //private mTheme:number = 0;\n\n    /**\n         * Constructor using a context and theme for this builder and\n         * the {@link AlertDialog} it creates.  The actual theme\n         * that an AlertDialog uses is a private implementation, however you can\n         * here supply either the name of an attribute in the theme from which\n         * to get the dialog's style (such as {@link android.R.attr#alertDialogTheme}\n         * or one of the constants\n         * {@link AlertDialog#THEME_TRADITIONAL AlertDialog.THEME_TRADITIONAL},\n         * {@link AlertDialog#THEME_HOLO_DARK AlertDialog.THEME_HOLO_DARK}, or\n         * {@link AlertDialog#THEME_HOLO_LIGHT AlertDialog.THEME_HOLO_LIGHT}.\n         */\n    constructor(context:Context) {\n        this.P = new AlertController.AlertParams(context);\n        //this.mTheme = theme;\n    }\n\n    /**\n         * Returns a {@link Context} with the appropriate theme for dialogs created by this Builder.\n         * Applications should use this Context for obtaining LayoutInflaters for inflating views\n         * that will be used in the resulting dialogs, as it will cause views to be inflated with\n         * the correct theme.\n         *\n         * @return A Context for built Dialogs.\n         */\n    getContext():Context  {\n        return this.P.mContext;\n    }\n\n    ///**\n    //     * Set the title using the given resource id.\n    //     *\n    //     * @return This Builder object to allow for chaining of calls to set methods\n    //     */\n    //setTitle(titleId:number):Builder  {\n    //    this.P.mTitle = this.P.mContext.getText(titleId);\n    //    return this;\n    //}\n\n    /**\n         * Set the title displayed in the {@link Dialog}.\n         *\n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setTitle(title:string):Builder  {\n        this.P.mTitle = title;\n        return this;\n    }\n\n    /**\n         * Set the title using the custom view {@code customTitleView}. The\n         * methods {@link #setTitle(int)} and {@link #setIcon(int)} should be\n         * sufficient for most titles, but this is provided if the title needs\n         * more customization. Using this will replace the title and icon set\n         * via the other methods.\n         * \n         * @param customTitleView The custom view to use as the title.\n         *\n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setCustomTitle(customTitleView:View):Builder  {\n        this.P.mCustomTitleView = customTitleView;\n        return this;\n    }\n\n    ///**\n    //     * Set the message to display using the given resource id.\n    //     *\n    //     * @return This Builder object to allow for chaining of calls to set methods\n    //     */\n    //setMessage(messageId:number):Builder  {\n    //    this.P.mMessage = this.P.mContext.getText(messageId);\n    //    return this;\n    //}\n\n    /**\n         * Set the message to display.\n          *\n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setMessage(message:string):Builder  {\n        this.P.mMessage = message;\n        return this;\n    }\n\n    ///**\n    //     * Set the resource id of the {@link Drawable} to be used in the title.\n    //     *\n    //     * @return This Builder object to allow for chaining of calls to set methods\n    //     */\n    //setIcon(iconId:number):Builder  {\n    //    this.P.mIconId = iconId;\n    //    return this;\n    //}\n\n    /**\n         * Set the {@link Drawable} to be used in the title.\n          *\n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setIcon(icon:Drawable):Builder  {\n        this.P.mIcon = icon;\n        return this;\n    }\n\n    ///**\n    //     * Set an icon as supplied by a theme attribute. e.g. android.R.attr.alertDialogIcon\n    //     *\n    //     * @param attrId ID of a theme attribute that points to a drawable resource.\n    //     */\n    //setIconAttribute(attrId:number):Builder  {\n    //    let out:TypedValue = new TypedValue();\n    //    this.P.mContext.getTheme().resolveAttribute(attrId, out, true);\n    //    this.P.mIconId = out.resourceId;\n    //    return this;\n    //}\n\n    ///**\n    //     * Set a listener to be invoked when the positive button of the dialog is pressed.\n    //     * @param textId The resource id of the text to display in the positive button\n    //     * @param listener The {@link DialogInterface.OnClickListener} to use.\n    //     *\n    //     * @return This Builder object to allow for chaining of calls to set methods\n    //     */\n    //setPositiveButton(textId:number, listener:OnClickListener):Builder  {\n    //    this.P.mPositiveButtonText = this.P.mContext.getText(textId);\n    //    this.P.mPositiveButtonListener = listener;\n    //    return this;\n    //}\n\n    /**\n         * Set a listener to be invoked when the positive button of the dialog is pressed.\n         * @param text The text to display in the positive button\n         * @param listener The {@link DialogInterface.OnClickListener} to use.\n         *\n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setPositiveButton(text:string, listener:DialogInterface.OnClickListener):Builder  {\n        this.P.mPositiveButtonText = text;\n        this.P.mPositiveButtonListener = listener;\n        return this;\n    }\n\n    ///**\n    //     * Set a listener to be invoked when the negative button of the dialog is pressed.\n    //     * @param textId The resource id of the text to display in the negative button\n    //     * @param listener The {@link DialogInterface.OnClickListener} to use.\n    //     *\n    //     * @return This Builder object to allow for chaining of calls to set methods\n    //     */\n    //setNegativeButton(textId:number, listener:OnClickListener):Builder  {\n    //    this.P.mNegativeButtonText = this.P.mContext.getText(textId);\n    //    this.P.mNegativeButtonListener = listener;\n    //    return this;\n    //}\n\n    /**\n         * Set a listener to be invoked when the negative button of the dialog is pressed.\n         * @param text The text to display in the negative button\n         * @param listener The {@link DialogInterface.OnClickListener} to use.\n         *\n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setNegativeButton(text:string, listener:DialogInterface.OnClickListener):Builder  {\n        this.P.mNegativeButtonText = text;\n        this.P.mNegativeButtonListener = listener;\n        return this;\n    }\n\n    ///**\n    //     * Set a listener to be invoked when the neutral button of the dialog is pressed.\n    //     * @param textId The resource id of the text to display in the neutral button\n    //     * @param listener The {@link DialogInterface.OnClickListener} to use.\n    //     *\n    //     * @return This Builder object to allow for chaining of calls to set methods\n    //     */\n    //setNeutralButton(textId:number, listener:OnClickListener):Builder  {\n    //    this.P.mNeutralButtonText = this.P.mContext.getText(textId);\n    //    this.P.mNeutralButtonListener = listener;\n    //    return this;\n    //}\n\n    /**\n         * Set a listener to be invoked when the neutral button of the dialog is pressed.\n         * @param text The text to display in the neutral button\n         * @param listener The {@link DialogInterface.OnClickListener} to use.\n         *\n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setNeutralButton(text:string, listener:DialogInterface.OnClickListener):Builder  {\n        this.P.mNeutralButtonText = text;\n        this.P.mNeutralButtonListener = listener;\n        return this;\n    }\n\n    /**\n         * Sets whether the dialog is cancelable or not.  Default is true.\n         *\n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setCancelable(cancelable:boolean):Builder  {\n        this.P.mCancelable = cancelable;\n        return this;\n    }\n\n    /**\n         * Sets the callback that will be called if the dialog is canceled.\n         *\n         * <p>Even in a cancelable dialog, the dialog may be dismissed for reasons other than\n         * being canceled or one of the supplied choices being selected.\n         * If you are interested in listening for all cases where the dialog is dismissed\n         * and not just when it is canceled, see\n         * {@link #setOnDismissListener(android.content.DialogInterface.OnDismissListener) setOnDismissListener}.</p>\n         * @see #setCancelable(boolean)\n         * @see #setOnDismissListener(android.content.DialogInterface.OnDismissListener)\n         *\n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setOnCancelListener(onCancelListener:DialogInterface.OnCancelListener):Builder  {\n        this.P.mOnCancelListener = onCancelListener;\n        return this;\n    }\n\n    /**\n         * Sets the callback that will be called when the dialog is dismissed for any reason.\n         *\n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setOnDismissListener(onDismissListener:DialogInterface.OnDismissListener):Builder  {\n        this.P.mOnDismissListener = onDismissListener;\n        return this;\n    }\n\n    /**\n         * Sets the callback that will be called if a key is dispatched to the dialog.\n         *\n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setOnKeyListener(onKeyListener:DialogInterface.OnKeyListener):Builder  {\n        this.P.mOnKeyListener = onKeyListener;\n        return this;\n    }\n\n    ///**\n    //     * Set a list of items to be displayed in the dialog as the content, you will be notified of the\n    //     * selected item via the supplied listener. This should be an array type i.e. R.array.foo\n    //     *\n    //     * @return This Builder object to allow for chaining of calls to set methods\n    //     */\n    //setItems(itemsId:number, listener:OnClickListener):Builder  {\n    //    this.P.mItems = this.P.mContext.getResources().getTextArray(itemsId);\n    //    this.P.mOnClickListener = listener;\n    //    return this;\n    //}\n\n    /**\n         * Set a list of items to be displayed in the dialog as the content, you will be notified of the\n         * selected item via the supplied listener.\n         *\n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setItems(items:string[], listener:DialogInterface.OnClickListener):Builder  {\n        this.P.mItems = items;\n        this.P.mOnClickListener = listener;\n        return this;\n    }\n\n    /**\n         * Set a list of items, which are supplied by the given {@link ListAdapter}, to be\n         * displayed in the dialog as the content, you will be notified of the\n         * selected item via the supplied listener.\n         * \n         * @param adapter The {@link ListAdapter} to supply the list of items\n         * @param listener The listener that will be called when an item is clicked.\n         *\n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setAdapter(adapter:ListAdapter, listener:DialogInterface.OnClickListener):Builder  {\n        this.P.mAdapter = adapter;\n        this.P.mOnClickListener = listener;\n        return this;\n    }\n\n    ///**\n    //     * Set a list of items, which are supplied by the given {@link Cursor}, to be\n    //     * displayed in the dialog as the content, you will be notified of the\n    //     * selected item via the supplied listener.\n    //     *\n    //     * @param cursor The {@link Cursor} to supply the list of items\n    //     * @param listener The listener that will be called when an item is clicked.\n    //     * @param labelColumn The column name on the cursor containing the string to display\n    //     *          in the label.\n    //     *\n    //     * @return This Builder object to allow for chaining of calls to set methods\n    //     */\n    //setCursor(cursor:Cursor, listener:OnClickListener, labelColumn:string):Builder  {\n    //    this.P.mCursor = cursor;\n    //    this.P.mLabelColumn = labelColumn;\n    //    this.P.mOnClickListener = listener;\n    //    return this;\n    //}\n    //\n    ///**\n    //     * Set a list of items to be displayed in the dialog as the content,\n    //     * you will be notified of the selected item via the supplied listener.\n    //     * This should be an array type, e.g. R.array.foo. The list will have\n    //     * a check mark displayed to the right of the text for each checked\n    //     * item. Clicking on an item in the list will not dismiss the dialog.\n    //     * Clicking on a button will dismiss the dialog.\n    //     *\n    //     * @param itemsId the resource id of an array i.e. R.array.foo\n    //     * @param checkedItems specifies which items are checked. It should be null in which case no\n    //     *        items are checked. If non null it must be exactly the same length as the array of\n    //     *        items.\n    //     * @param listener notified when an item on the list is clicked. The dialog will not be\n    //     *        dismissed when an item is clicked. It will only be dismissed if clicked on a\n    //     *        button, if no buttons are supplied it's up to the user to dismiss the dialog.\n    //     *\n    //     * @return This Builder object to allow for chaining of calls to set methods\n    //     */\n    //setMultiChoiceItems(itemsId:number, checkedItems:boolean[], listener:OnMultiChoiceClickListener):Builder  {\n    //    this.P.mItems = this.P.mContext.getResources().getTextArray(itemsId);\n    //    this.P.mOnCheckboxClickListener = listener;\n    //    this.P.mCheckedItems = checkedItems;\n    //    this.P.mIsMultiChoice = true;\n    //    return this;\n    //}\n\n    /**\n         * Set a list of items to be displayed in the dialog as the content,\n         * you will be notified of the selected item via the supplied listener.\n         * The list will have a check mark displayed to the right of the text\n         * for each checked item. Clicking on an item in the list will not\n         * dismiss the dialog. Clicking on a button will dismiss the dialog.\n         * \n         * @param items the text of the items to be displayed in the list.\n         * @param checkedItems specifies which items are checked. It should be null in which case no\n         *        items are checked. If non null it must be exactly the same length as the array of\n         *        items.\n         * @param listener notified when an item on the list is clicked. The dialog will not be\n         *        dismissed when an item is clicked. It will only be dismissed if clicked on a\n         *        button, if no buttons are supplied it's up to the user to dismiss the dialog.\n         *\n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setMultiChoiceItems(items:string[], checkedItems:boolean[], listener:DialogInterface.OnMultiChoiceClickListener):Builder  {\n        this.P.mItems = items;\n        this.P.mOnCheckboxClickListener = listener;\n        this.P.mCheckedItems = checkedItems;\n        this.P.mIsMultiChoice = true;\n        return this;\n    }\n\n    ///**\n    //     * Set a list of items to be displayed in the dialog as the content,\n    //     * you will be notified of the selected item via the supplied listener.\n    //     * The list will have a check mark displayed to the right of the text\n    //     * for each checked item. Clicking on an item in the list will not\n    //     * dismiss the dialog. Clicking on a button will dismiss the dialog.\n    //     *\n    //     * @param cursor the cursor used to provide the items.\n    //     * @param isCheckedColumn specifies the column name on the cursor to use to determine\n    //     *        whether a checkbox is checked or not. It must return an integer value where 1\n    //     *        means checked and 0 means unchecked.\n    //     * @param labelColumn The column name on the cursor containing the string to display in the\n    //     *        label.\n    //     * @param listener notified when an item on the list is clicked. The dialog will not be\n    //     *        dismissed when an item is clicked. It will only be dismissed if clicked on a\n    //     *        button, if no buttons are supplied it's up to the user to dismiss the dialog.\n    //     *\n    //     * @return This Builder object to allow for chaining of calls to set methods\n    //     */\n    //setMultiChoiceItems(cursor:Cursor, isCheckedColumn:string, labelColumn:string, listener:OnMultiChoiceClickListener):Builder  {\n    //    this.P.mCursor = cursor;\n    //    this.P.mOnCheckboxClickListener = listener;\n    //    this.P.mIsCheckedColumn = isCheckedColumn;\n    //    this.P.mLabelColumn = labelColumn;\n    //    this.P.mIsMultiChoice = true;\n    //    return this;\n    //}\n    //\n    ///**\n    //     * Set a list of items to be displayed in the dialog as the content, you will be notified of\n    //     * the selected item via the supplied listener. This should be an array type i.e.\n    //     * R.array.foo The list will have a check mark displayed to the right of the text for the\n    //     * checked item. Clicking on an item in the list will not dismiss the dialog. Clicking on a\n    //     * button will dismiss the dialog.\n    //     *\n    //     * @param itemsId the resource id of an array i.e. R.array.foo\n    //     * @param checkedItem specifies which item is checked. If -1 no items are checked.\n    //     * @param listener notified when an item on the list is clicked. The dialog will not be\n    //     *        dismissed when an item is clicked. It will only be dismissed if clicked on a\n    //     *        button, if no buttons are supplied it's up to the user to dismiss the dialog.\n    //     *\n    //     * @return This Builder object to allow for chaining of calls to set methods\n    //     */\n    //setSingleChoiceItems(itemsId:number, checkedItem:number, listener:OnClickListener):Builder  {\n    //    this.P.mItems = this.P.mContext.getResources().getTextArray(itemsId);\n    //    this.P.mOnClickListener = listener;\n    //    this.P.mCheckedItem = checkedItem;\n    //    this.P.mIsSingleChoice = true;\n    //    return this;\n    //}\n    //\n    ///**\n    //     * Set a list of items to be displayed in the dialog as the content, you will be notified of\n    //     * the selected item via the supplied listener. The list will have a check mark displayed to\n    //     * the right of the text for the checked item. Clicking on an item in the list will not\n    //     * dismiss the dialog. Clicking on a button will dismiss the dialog.\n    //     *\n    //     * @param cursor the cursor to retrieve the items from.\n    //     * @param checkedItem specifies which item is checked. If -1 no items are checked.\n    //     * @param labelColumn The column name on the cursor containing the string to display in the\n    //     *        label.\n    //     * @param listener notified when an item on the list is clicked. The dialog will not be\n    //     *        dismissed when an item is clicked. It will only be dismissed if clicked on a\n    //     *        button, if no buttons are supplied it's up to the user to dismiss the dialog.\n    //     *\n    //     * @return This Builder object to allow for chaining of calls to set methods\n    //     */\n    //setSingleChoiceItems(cursor:Cursor, checkedItem:number, labelColumn:string, listener:OnClickListener):Builder  {\n    //    this.P.mCursor = cursor;\n    //    this.P.mOnClickListener = listener;\n    //    this.P.mCheckedItem = checkedItem;\n    //    this.P.mLabelColumn = labelColumn;\n    //    this.P.mIsSingleChoice = true;\n    //    return this;\n    //}\n\n    /**\n         * Set a list of items to be displayed in the dialog as the content, you will be notified of\n         * the selected item via the supplied listener. The list will have a check mark displayed to\n         * the right of the text for the checked item. Clicking on an item in the list will not\n         * dismiss the dialog. Clicking on a button will dismiss the dialog.\n         * \n         * @param items the items to be displayed.\n         * @param checkedItem specifies which item is checked. If -1 no items are checked.\n         * @param listener notified when an item on the list is clicked. The dialog will not be\n         *        dismissed when an item is clicked. It will only be dismissed if clicked on a\n         *        button, if no buttons are supplied it's up to the user to dismiss the dialog.\n         *\n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setSingleChoiceItems(items:string[], checkedItem:number, listener:DialogInterface.OnClickListener):Builder  {\n        this.P.mItems = items;\n        this.P.mOnClickListener = listener;\n        this.P.mCheckedItem = checkedItem;\n        this.P.mIsSingleChoice = true;\n        return this;\n    }\n\n    /**\n         * Set a list of items to be displayed in the dialog as the content, you will be notified of\n         * the selected item via the supplied listener. The list will have a check mark displayed to\n         * the right of the text for the checked item. Clicking on an item in the list will not\n         * dismiss the dialog. Clicking on a button will dismiss the dialog.\n         * \n         * @param adapter The {@link ListAdapter} to supply the list of items\n         * @param checkedItem specifies which item is checked. If -1 no items are checked.\n         * @param listener notified when an item on the list is clicked. The dialog will not be\n         *        dismissed when an item is clicked. It will only be dismissed if clicked on a\n         *        button, if no buttons are supplied it's up to the user to dismiss the dialog.\n         *\n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setSingleChoiceItemsWithAdapter(adapter:ListAdapter, checkedItem:number, listener:DialogInterface.OnClickListener):Builder  {\n        this.P.mAdapter = adapter;\n        this.P.mOnClickListener = listener;\n        this.P.mCheckedItem = checkedItem;\n        this.P.mIsSingleChoice = true;\n        return this;\n    }\n\n    /**\n         * Sets a listener to be invoked when an item in the list is selected.\n         * \n         * @param listener The listener to be invoked.\n         * @see AdapterView#setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener)\n         *\n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setOnItemSelectedListener(listener:AdapterView.OnItemSelectedListener):Builder  {\n        this.P.mOnItemSelectedListener = listener;\n        return this;\n    }\n\n    ///**\n    //     * Set a custom view to be the contents of the Dialog. If the supplied view is an instance\n    //     * of a {@link ListView} the light background will be used.\n    //     *\n    //     * @param view The view to use as the contents of the Dialog.\n    //     *\n    //     * @return This Builder object to allow for chaining of calls to set methods\n    //     */\n    //setView(view:View):Builder  {\n    //    this.P.mView = view;\n    //    this.P.mViewSpacingSpecified = false;\n    //    return this;\n    //}\n\n    /**\n         * Set a custom view to be the contents of the Dialog, specifying the\n         * spacing to appear around that view. If the supplied view is an\n         * instance of a {@link ListView} the light background will be used.\n         * \n         * @param view The view to use as the contents of the Dialog.\n         * @param viewSpacingLeft Spacing between the left edge of the view and\n         *        the dialog frame\n         * @param viewSpacingTop Spacing between the top edge of the view and\n         *        the dialog frame\n         * @param viewSpacingRight Spacing between the right edge of the view\n         *        and the dialog frame\n         * @param viewSpacingBottom Spacing between the bottom edge of the view\n         *        and the dialog frame\n         * @return This Builder object to allow for chaining of calls to set\n         *         methods\n         *         \n         * \n         * This is currently hidden because it seems like people should just\n         * be able to put padding around the view.\n         * @hide\n         */\n    setView(view:View, viewSpacingLeft=0, viewSpacingTop=0, viewSpacingRight=0, viewSpacingBottom=0):Builder  {\n        this.P.mView = view;\n        if(!viewSpacingLeft && !viewSpacingTop && !viewSpacingRight && !viewSpacingBottom){\n            this.P.mViewSpacingSpecified = false;\n        }else{\n            this.P.mViewSpacingSpecified = true;\n            this.P.mViewSpacingLeft = viewSpacingLeft;\n            this.P.mViewSpacingTop = viewSpacingTop;\n            this.P.mViewSpacingRight = viewSpacingRight;\n            this.P.mViewSpacingBottom = viewSpacingBottom;\n        }\n        return this;\n    }\n\n    /**\n         * Sets the Dialog to use the inverse background, regardless of what the\n         * contents is.\n         * \n         * @param useInverseBackground Whether to use the inverse background\n         * \n         * @return This Builder object to allow for chaining of calls to set methods\n         */\n    setInverseBackgroundForced(useInverseBackground:boolean):Builder  {\n        this.P.mForceInverseBackground = useInverseBackground;\n        return this;\n    }\n\n    /**\n         * @hide\n         */\n    setRecycleOnMeasureEnabled(enabled:boolean):Builder  {\n        this.P.mRecycleOnMeasure = enabled;\n        return this;\n    }\n\n    /**\n         * Creates a {@link AlertDialog} with the arguments supplied to this builder. It does not\n         * {@link Dialog#show()} the dialog. This allows the user to do any extra processing\n         * before displaying the dialog. Use {@link #show()} if you don't have any other processing\n         * to do and want this to be created and displayed.\n         */\n    create():AlertDialog  {\n        const dialog:AlertDialog = new AlertDialog(this.P.mContext);\n        this.P.apply(dialog.mAlert);\n        dialog.setCancelable(this.P.mCancelable);\n        if (this.P.mCancelable) {\n            dialog.setCanceledOnTouchOutside(true);\n        }\n        dialog.setOnCancelListener(this.P.mOnCancelListener);\n        dialog.setOnDismissListener(this.P.mOnDismissListener);\n        if (this.P.mOnKeyListener != null) {\n            dialog.setOnKeyListener(this.P.mOnKeyListener);\n        }\n        return dialog;\n    }\n\n    /**\n         * Creates a {@link AlertDialog} with the arguments supplied to this builder and\n         * {@link Dialog#show()}'s the dialog.\n         */\n    show():AlertDialog  {\n        let dialog:AlertDialog = this.create();\n        dialog.show();\n        return dialog;\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/app/Application.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../java/util/ArrayList.ts\"/>\n///<reference path=\"../../android/os/Bundle.ts\"/>\n///<reference path=\"../../android/app/Activity.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n\nmodule android.app {\nimport ArrayList = java.util.ArrayList;\nimport Bundle = android.os.Bundle;\nimport Context = android.content.Context;\nimport Activity = android.app.Activity;\n\n/**\n * Base class for those who need to maintain global application state. You can\n * provide your own implementation by specifying its name in your\n * AndroidManifest.xml's &lt;application&gt; tag, which will cause that class\n * to be instantiated for you when the process for your application/package is\n * created.\n * \n * <p class=\"note\">There is normally no need to subclass Application.  In\n * most situation, static singletons can provide the same functionality in a\n * more modular way.  If your singleton needs a global context (for example\n * to register broadcast receivers), the function to retrieve it can be\n * given a {@link android.content.Context} which internally uses\n * {@link android.content.Context#getApplicationContext() Context.getApplicationContext()}\n * when first constructing the singleton.</p>\n */\nexport class Application extends Context{\n\n    private mActivityLifecycleCallbacks:ArrayList<Application.ActivityLifecycleCallbacks> = new ArrayList<Application.ActivityLifecycleCallbacks>();\n    private mWindowManager:android.view.WindowManager;\n\n\n    /**\n     * Called when the application is starting, before any activity, service,\n     * or receiver objects (excluding content providers) have been created.\n     * Implementations should be as quick as possible (for example using \n     * lazy initialization of state) since the time spent in this function\n     * directly impacts the performance of starting the first activity,\n     * service, or receiver in a process.\n     * If you override this method, be sure to call super.onCreate().\n     */\n    onCreate():void  {\n    }\n\n    getWindowManager():android.view.WindowManager{\n        if(!this.mWindowManager) this.mWindowManager = new android.view.WindowManager(this);\n        return this.mWindowManager;\n    }\n\n    registerActivityLifecycleCallbacks(callback:Application.ActivityLifecycleCallbacks):void  {\n        {\n            this.mActivityLifecycleCallbacks.add(callback);\n        }\n    }\n\n    unregisterActivityLifecycleCallbacks(callback:Application.ActivityLifecycleCallbacks):void  {\n        {\n            this.mActivityLifecycleCallbacks.remove(callback);\n        }\n    }\n\n    // ------------------ Internal API ------------------\n\n    /* package */\n    dispatchActivityCreated(activity:Activity, savedInstanceState:Bundle):void  {\n        let callbacks:any[] = this.collectActivityLifecycleCallbacks();\n        if (callbacks != null) {\n            for (let i:number = 0; i < callbacks.length; i++) {\n                (<Application.ActivityLifecycleCallbacks> callbacks[i]).onActivityCreated(activity, savedInstanceState);\n            }\n        }\n    }\n\n    /* package */\n    dispatchActivityStarted(activity:Activity):void  {\n        let callbacks:any[] = this.collectActivityLifecycleCallbacks();\n        if (callbacks != null) {\n            for (let i:number = 0; i < callbacks.length; i++) {\n                (<Application.ActivityLifecycleCallbacks> callbacks[i]).onActivityStarted(activity);\n            }\n        }\n    }\n\n    /* package */\n    dispatchActivityResumed(activity:Activity):void  {\n        let callbacks:any[] = this.collectActivityLifecycleCallbacks();\n        if (callbacks != null) {\n            for (let i:number = 0; i < callbacks.length; i++) {\n                (<Application.ActivityLifecycleCallbacks> callbacks[i]).onActivityResumed(activity);\n            }\n        }\n    }\n\n    /* package */\n    dispatchActivityPaused(activity:Activity):void  {\n        let callbacks:any[] = this.collectActivityLifecycleCallbacks();\n        if (callbacks != null) {\n            for (let i:number = 0; i < callbacks.length; i++) {\n                (<Application.ActivityLifecycleCallbacks> callbacks[i]).onActivityPaused(activity);\n            }\n        }\n    }\n\n    /* package */\n    dispatchActivityStopped(activity:Activity):void  {\n        let callbacks:any[] = this.collectActivityLifecycleCallbacks();\n        if (callbacks != null) {\n            for (let i:number = 0; i < callbacks.length; i++) {\n                (<Application.ActivityLifecycleCallbacks> callbacks[i]).onActivityStopped(activity);\n            }\n        }\n    }\n\n    /* package */\n    dispatchActivitySaveInstanceState(activity:Activity, outState:Bundle):void  {\n        let callbacks:any[] = this.collectActivityLifecycleCallbacks();\n        if (callbacks != null) {\n            for (let i:number = 0; i < callbacks.length; i++) {\n                (<Application.ActivityLifecycleCallbacks> callbacks[i]).onActivitySaveInstanceState(activity, outState);\n            }\n        }\n    }\n\n    /* package */\n    dispatchActivityDestroyed(activity:Activity):void  {\n        let callbacks:any[] = this.collectActivityLifecycleCallbacks();\n        if (callbacks != null) {\n            for (let i:number = 0; i < callbacks.length; i++) {\n                (<Application.ActivityLifecycleCallbacks> callbacks[i]).onActivityDestroyed(activity);\n            }\n        }\n    }\n\n    private collectActivityLifecycleCallbacks():any[]  {\n        let callbacks:any[] = null;\n        {\n            if (this.mActivityLifecycleCallbacks.size() > 0) {\n                callbacks = this.mActivityLifecycleCallbacks.toArray();\n            }\n        }\n        return callbacks;\n    }\n}\n\nexport module Application{\nexport interface ActivityLifecycleCallbacks {\n\n    onActivityCreated(activity:Activity, savedInstanceState:Bundle):void ;\n\n    onActivityStarted(activity:Activity):void ;\n\n    onActivityResumed(activity:Activity):void ;\n\n    onActivityPaused(activity:Activity):void ;\n\n    onActivityStopped(activity:Activity):void ;\n\n    onActivitySaveInstanceState(activity:Activity, outState:Bundle):void ;\n\n    onActivityDestroyed(activity:Activity):void ;\n}\n}\n\n}"
  },
  {
    "path": "src/android/app/Dialog.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/content/DialogInterface.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/os/Bundle.ts\"/>\n///<reference path=\"../../android/os/Handler.ts\"/>\n///<reference path=\"../../android/os/Message.ts\"/>\n///<reference path=\"../../android/util/Log.ts\"/>\n///<reference path=\"../../android/util/TypedValue.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../android/view/LayoutInflater.ts\"/>\n///<reference path=\"../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/view/Window.ts\"/>\n///<reference path=\"../../android/view/WindowManager.ts\"/>\n///<reference path=\"../../java/lang/ref/WeakReference.ts\"/>\n///<reference path=\"../../android/app/Activity.ts\"/>\n///<reference path=\"../../android/app/Application.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n\nmodule android.app {\n    import DialogInterface = android.content.DialogInterface;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Bundle = android.os.Bundle;\n    import Handler = android.os.Handler;\n    import Message = android.os.Message;\n    import Log = android.util.Log;\n    import TypedValue = android.util.TypedValue;\n    import Gravity = android.view.Gravity;\n    import KeyEvent = android.view.KeyEvent;\n    import LayoutInflater = android.view.LayoutInflater;\n    import MotionEvent = android.view.MotionEvent;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import LayoutParams = android.view.ViewGroup.LayoutParams;\n    import Window = android.view.Window;\n    import WindowManager = android.view.WindowManager;\n    import WeakReference = java.lang.ref.WeakReference;\n    import Activity = android.app.Activity;\n    import Application = android.app.Application;\n    import Context = android.content.Context;\n    import Runnable = java.lang.Runnable;\n\n    /**\n     * Base class for Dialogs.\n     *\n     * <p>Note: Activities provide a facility to manage the creation, saving and\n     * restoring of dialogs. See {@link Activity#onCreateDialog(int)},\n     * {@link Activity#onPrepareDialog(int, Dialog)},\n     * {@link Activity#showDialog(int)}, and {@link Activity#dismissDialog(int)}. If\n     * these methods are used, {@link #getOwnerActivity()} will return the Activity\n     * that managed this dialog.\n     *\n     * <p>Often you will want to have a Dialog display on top of the current\n     * input method, because there is no reason for it to accept text.  You can\n     * do this by setting the {@link WindowManager.LayoutParams#FLAG_ALT_FOCUSABLE_IM\n * WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM} window flag (assuming\n     * your Dialog takes input focus, as it the default) with the following code:\n     *\n     * <pre>\n     * getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,\n     *         WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);</pre>\n     *\n     * <div class=\"special reference\">\n     * <h3>Developer Guides</h3>\n     * <p>For more information about creating dialogs, read the\n     * <a href=\"{@docRoot}guide/topics/ui/dialogs.html\">Dialogs</a> developer guide.</p>\n     * </div>\n     */\n    export class Dialog implements DialogInterface, Window.Callback, KeyEvent.Callback {\n\n        private static TAG:string = \"Dialog\";\n\n        //private mOwnerActivity:Activity;\n\n        mContext:Context;\n\n        mWindowManager:WindowManager;\n\n        mWindow:Window;\n\n        mDecor:View;\n\n        //private mActionBar:ActionBarImpl;\n\n        /**\n         * This field should be made private, so it is hidden from the SDK.\n         * {@hide}\n         */\n        protected mCancelable:boolean = true;\n\n        private mCancelAndDismissTaken:string;\n\n        private mCancelMessage:Message;\n\n        private mDismissMessage:Message;\n\n        private mShowMessage:Message;\n\n        private mOnKeyListener:DialogInterface.OnKeyListener;\n\n        private mCreated:boolean = false;\n\n        private mShowing:boolean = false;\n\n        private mCanceled:boolean = false;\n\n        private mHandler:Handler = new Handler();\n\n        private static DISMISS:number = 0x43;\n\n        private static CANCEL:number = 0x44;\n\n        private static SHOW:number = 0x45;\n\n        private mListenersHandler:Handler;\n\n        //private mActionMode:ActionMode;\n\n        private mDismissAction:Runnable = (()=> {\n            const inner_this = this;\n            class _Inner implements Runnable {\n\n                run():void {\n                    inner_this.dismissDialog();\n                }\n            }\n            return new _Inner();\n        })();\n\n        /**\n         * Create a Dialog window that uses the default dialog frame style.\n         *\n         * @param context The Context the Dialog is to run it.  In particular, it\n         *                uses the window manager and theme in this context to\n         *                present its UI.\n         */\n        constructor(context:Context, cancelable?:boolean, cancelListener?:DialogInterface.OnCancelListener) {\n            //if (createContextThemeWrapper) {\n            //    if (theme == 0) {\n            //        let outValue:TypedValue = new TypedValue();\n            //        context.getTheme().resolveAttribute(com.android.internal.R.attr.dialogTheme, outValue, true);\n            //        theme = outValue.resourceId;\n            //    }\n            //    this.mContext = new ContextThemeWrapper(context, theme);\n            //} else {\n            this.mContext = context;\n            //}\n            this.mWindowManager = (<android.app.Activity>context).getWindowManager();\n            let w:Window = new Window(context);\n            w.setFloating(true);\n            w.setDimAmount(0.7);\n            w.setBackgroundColor(android.graphics.Color.TRANSPARENT);\n            this.mWindow = w;\n\n            let dm = context.getResources().getDisplayMetrics();\n            let decor = w.getDecorView();\n            decor.setMinimumWidth(dm.density * 280);\n            decor.setMinimumHeight(dm.density * 20);\n            const onMeasure = decor.onMeasure;\n            decor.onMeasure = (widthMeasureSpec:number, heightMeasureSpec:number)=>{\n                onMeasure.call(decor, widthMeasureSpec, heightMeasureSpec);\n                let width = decor.getMeasuredWidth();\n                if(width > 360 * dm.density){//max 360dp\n                    let widthSpec = View.MeasureSpec.makeMeasureSpec(360 * dm.density, View.MeasureSpec.EXACTLY);\n                    onMeasure.call(decor, widthSpec, heightMeasureSpec);\n                }\n            }\n\n            let wp = w.getAttributes();\n            wp.flags |= WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;\n            wp.height = wp.width = ViewGroup.LayoutParams.WRAP_CONTENT;\n            wp.leftMargin = wp.rightMargin = wp.topMargin = wp.bottomMargin = dm.density * 16;\n            w.setWindowAnimations(android.R.anim.dialog_enter, android.R.anim.dialog_exit, null, null);\n\n            w.setChildWindowManager(this.mWindowManager);\n            w.setGravity(Gravity.CENTER);\n            w.setCallback(this);\n\n\n            this.mListenersHandler = new Dialog.ListenersHandler(this);\n\n            this.mCancelable = cancelable;\n            this.setOnCancelListener(cancelListener);\n        }\n\n        /**\n         * Retrieve the Context this Dialog is running in.\n         *\n         * @return Context The Context used by the Dialog.\n         */\n        getContext():Context {\n            return this.mContext;\n        }\n\n        ///**\n        // * Retrieve the {@link ActionBar} attached to this dialog, if present.\n        // *\n        // * @return The ActionBar attached to the dialog or null if no ActionBar is present.\n        // */\n        //getActionBar():ActionBar  {\n        //    return this.mActionBar;\n        //}\n        //\n        ///**\n        // * Sets the Activity that owns this dialog. An example use: This Dialog will\n        // * use the suggested volume control stream of the Activity.\n        // *\n        // * @param activity The Activity that owns this dialog.\n        // */\n        //setOwnerActivity(activity:Activity):void  {\n        //    this.mOwnerActivity = activity;\n        //    this.getWindow().setVolumeControlStream(this.mOwnerActivity.getVolumeControlStream());\n        //}\n        //\n        ///**\n        // * Returns the Activity that owns this Dialog. For example, if\n        // * {@link Activity#showDialog(int)} is used to show this Dialog, that\n        // * Activity will be the owner (by default). Depending on how this dialog was\n        // * created, this may return null.\n        // *\n        // * @return The Activity that owns this Dialog.\n        // */\n        //getOwnerActivity():Activity  {\n        //    return this.mOwnerActivity;\n        //}\n\n        /**\n         * @return Whether the dialog is currently showing.\n         */\n        isShowing():boolean {\n            return this.mShowing;\n        }\n\n        /**\n         * Start the dialog and display it on screen.  The window is placed in the\n         * application layer and opaque.  Note that you should not override this\n         * method to do initialization when the dialog is shown, instead implement\n         * that in {@link #onStart}.\n         */\n        show():void {\n            if (this.mShowing) {\n                if (this.mDecor != null) {\n                    //if (this.mWindow.hasFeature(Window.FEATURE_ACTION_BAR)) {\n                    //    this.mWindow.invalidatePanelMenu(Window.FEATURE_ACTION_BAR);\n                    //}\n                    this.mDecor.setVisibility(View.VISIBLE);\n                }\n                return;\n            }\n            this.mCanceled = false;\n            if (!this.mCreated) {\n                this.dispatchOnCreate(null);\n            }\n            this.onStart();\n            this.mDecor = this.mWindow.getDecorView();\n            //if (this.mActionBar == null && this.mWindow.hasFeature(Window.FEATURE_ACTION_BAR)) {\n            //const info:ApplicationInfo = this.mContext.getApplicationInfo();\n            //this.mWindow.setDefaultIcon(info.icon);\n            //this.mWindow.setDefaultLogo(info.logo);\n            //this.mActionBar = new ActionBarImpl(this);\n            //}\n            //let l:WindowManager.LayoutParams = this.mWindow.getAttributes();\n            //if ((l.softInputMode & WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) == 0) {\n            //    let nl:WindowManager.LayoutParams = new WindowManager.LayoutParams();\n            //    nl.copyFrom(l);\n            //    nl.softInputMode |= WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION;\n            //    l = nl;\n            //}\n            try {\n                this.mWindowManager.addWindow(this.mWindow);\n                this.mShowing = true;\n                this.sendShowMessage();\n            } finally {\n            }\n        }\n\n        /**\n         * Hide the dialog, but do not dismiss it.\n         */\n        hide():void {\n            if (this.mDecor != null) {\n                this.mDecor.setVisibility(View.GONE);\n            }\n        }\n\n        /**\n         * Dismiss this dialog, removing it from the screen. This method can be\n         * invoked safely from any thread.  Note that you should not override this\n         * method to do cleanup when the dialog is dismissed, instead implement\n         * that in {@link #onStop}.\n         */\n        dismiss():void {\n            //if (Looper.myLooper() == this.mHandler.getLooper()) {\n            this.dismissDialog();\n            //} else {\n            //    this.mHandler.post(this.mDismissAction);\n            //}\n        }\n\n        dismissDialog():void {\n            if (this.mDecor == null || !this.mShowing) {\n                return;\n            }\n            if (this.mWindow.isDestroyed()) {\n                Log.e(Dialog.TAG, \"Tried to dismissDialog() but the Dialog's window was already destroyed!\");\n                return;\n            }\n            try {\n                this.mWindowManager.removeWindow(this.mWindow);\n            } finally {\n                //if (this.mActionMode != null) {\n                //    this.mActionMode.finish();\n                //}\n                this.mDecor = null;\n                //this.mWindow.closeAllPanels();\n                this.onStop();\n                this.mShowing = false;\n                this.sendDismissMessage();\n            }\n        }\n\n        private sendDismissMessage():void {\n            if (this.mDismissMessage != null) {\n                // Obtain a new message so this dialog can be re-used\n                Message.obtain(this.mDismissMessage).sendToTarget();\n            }\n        }\n\n        private sendShowMessage():void {\n            if (this.mShowMessage != null) {\n                // Obtain a new message so this dialog can be re-used\n                Message.obtain(this.mShowMessage).sendToTarget();\n            }\n        }\n\n        // internal method to make sure mcreated is set properly without requiring\n        // users to call through to super in onCreate\n        dispatchOnCreate(savedInstanceState:Bundle):void {\n            if (!this.mCreated) {\n                this.onCreate(savedInstanceState);\n                this.mCreated = true;\n            }\n        }\n\n        /**\n         * Similar to {@link Activity#onCreate}, you should initialize your dialog\n         * in this method, including calling {@link #setContentView}.\n         * @param savedInstanceState If this dialog is being reinitalized after a\n         *     the hosting activity was previously shut down, holds the result from\n         *     the most recent call to {@link #onSaveInstanceState}, or null if this\n         *     is the first time.\n         */\n        protected onCreate(savedInstanceState:Bundle):void {\n        }\n\n        /**\n         * Called when the dialog is starting.\n         */\n        protected onStart():void {\n            //if (this.mActionBar != null)\n            //    this.mActionBar.setShowHideAnimationEnabled(true);\n        }\n\n        /**\n         * Called to tell you that you're stopping.\n         */\n        protected onStop():void {\n            //if (this.mActionBar != null)\n            //    this.mActionBar.setShowHideAnimationEnabled(false);\n        }\n\n        private static DIALOG_SHOWING_TAG:string = \"android:dialogShowing\";\n\n        private static DIALOG_HIERARCHY_TAG:string = \"android:dialogHierarchy\";\n\n        ///**\n        // * Saves the state of the dialog into a bundle.\n        // *\n        // * The default implementation saves the state of its view hierarchy, so you'll\n        // * likely want to call through to super if you override this to save additional\n        // * state.\n        // * @return A bundle with the state of the dialog.\n        // */\n        //onSaveInstanceState():Bundle  {\n        //    let bundle:Bundle = new Bundle();\n        //    bundle.putBoolean(Dialog.DIALOG_SHOWING_TAG, this.mShowing);\n        //    if (this.mCreated) {\n        //        bundle.putBundle(Dialog.DIALOG_HIERARCHY_TAG, this.mWindow.saveHierarchyState());\n        //    }\n        //    return bundle;\n        //}\n        //\n        ///**\n        // * Restore the state of the dialog from a previously saved bundle.\n        // *\n        // * The default implementation restores the state of the dialog's view\n        // * hierarchy that was saved in the default implementation of {@link #onSaveInstanceState()},\n        // * so be sure to call through to super when overriding unless you want to\n        // * do all restoring of state yourself.\n        // * @param savedInstanceState The state of the dialog previously saved by\n        // *     {@link #onSaveInstanceState()}.\n        // */\n        //onRestoreInstanceState(savedInstanceState:Bundle):void  {\n        //    const dialogHierarchyState:Bundle = savedInstanceState.getBundle(Dialog.DIALOG_HIERARCHY_TAG);\n        //    if (dialogHierarchyState == null) {\n        //        // dialog has never been shown, or onCreated, nothing to restore.\n        //        return;\n        //    }\n        //    this.dispatchOnCreate(savedInstanceState);\n        //    this.mWindow.restoreHierarchyState(dialogHierarchyState);\n        //    if (savedInstanceState.getBoolean(Dialog.DIALOG_SHOWING_TAG)) {\n        //        this.show();\n        //    }\n        //}\n\n        /**\n         * Retrieve the current Window for the activity.  This can be used to\n         * directly access parts of the Window API that are not available\n         * through Activity/Screen.\n         *\n         * @return Window The current window, or null if the activity is not\n         *         visual.\n         */\n        getWindow():Window {\n            return this.mWindow;\n        }\n\n        /**\n         * Call {@link android.view.Window#getCurrentFocus} on the\n         * Window if this Activity to return the currently focused view.\n         *\n         * @return View The current View with focus or null.\n         *\n         * @see #getWindow\n         * @see android.view.Window#getCurrentFocus\n         */\n        getCurrentFocus():View {\n            return this.mWindow != null ? this.mWindow.getCurrentFocus() : null;\n        }\n\n        /**\n         * Finds a view that was identified by the id attribute from the XML that\n         * was processed in {@link #onStart}.\n         *\n         * @param id the identifier of the view to find\n         * @return The view if found or null otherwise.\n         */\n        findViewById(id:string):View {\n            return this.mWindow.findViewById(id);\n        }\n\n        ///**\n        // * Set the screen content from a layout resource.  The resource will be\n        // * inflated, adding all top-level views to the screen.\n        // *\n        // * @param layoutResID Resource ID to be inflated.\n        // */\n        //setContentView(layoutResID:number):void  {\n        //    this.mWindow.setContentView(layoutResID);\n        //}\n\n        ///**\n        // * Set the screen content to an explicit view.  This view is placed\n        // * directly into the screen's view hierarchy.  It can itself be a complex\n        // * view hierarhcy.\n        // *\n        // * @param view The desired content to display.\n        // */\n        //setContentView(view:View):void  {\n        //    this.mWindow.setContentView(view);\n        //}\n\n        /**\n         * Set the screen content to an explicit view.  This view is placed\n         * directly into the screen's view hierarchy.  It can itself be a complex\n         * view hierarhcy.\n         *\n         * @param view The desired content to display.\n         * @param params Layout parameters for the view.\n         */\n        setContentView(view:View, params?:ViewGroup.LayoutParams):void {\n            this.mWindow.setContentView(view, params);\n        }\n\n        /**\n         * Add an additional content view to the screen.  Added after any existing\n         * ones in the screen -- existing views are NOT removed.\n         *\n         * @param view The desired content to display.\n         * @param params Layout parameters for the view.\n         */\n        addContentView(view:View, params:ViewGroup.LayoutParams):void {\n            this.mWindow.addContentView(view, params);\n        }\n\n        /**\n         * Set the title text for this dialog's window.\n         *\n         * @param title The new text to display in the title.\n         */\n        setTitle(title:string):void {\n            this.mWindow.setTitle(title);\n            this.mWindow.getAttributes().setTitle(title);\n        }\n\n        ///**\n        // * Set the title text for this dialog's window. The text is retrieved\n        // * from the resources with the supplied identifier.\n        // *\n        // * @param titleId the title's text resource identifier\n        // */\n        //setTitle(titleId:number):void  {\n        //    this.setTitle(this.mContext.getText(titleId));\n        //}\n\n        /**\n         * A key was pressed down.\n         *\n         * <p>If the focused view didn't want this event, this method is called.\n         *\n         * <p>The default implementation consumed the KEYCODE_BACK to later\n         * handle it in {@link #onKeyUp}.\n         *\n         * @see #onKeyUp\n         * @see android.view.KeyEvent\n         */\n        onKeyDown(keyCode:number, event:KeyEvent):boolean {\n            if (keyCode == KeyEvent.KEYCODE_BACK) {\n                event.startTracking();\n                return true;\n            }\n            return false;\n        }\n\n        /**\n         * Default implementation of {@link KeyEvent.Callback#onKeyLongPress(int, KeyEvent)\n     * KeyEvent.Callback.onKeyLongPress()}: always returns false (doesn't handle\n         * the event).\n         */\n        onKeyLongPress(keyCode:number, event:KeyEvent):boolean {\n            return false;\n        }\n\n        /**\n         * A key was released.\n         *\n         * <p>The default implementation handles KEYCODE_BACK to close the\n         * dialog.\n         *\n         * @see #onKeyDown\n         * @see KeyEvent\n         */\n        onKeyUp(keyCode:number, event:KeyEvent):boolean {\n            if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() && !event.isCanceled()) {\n                this.onBackPressed();\n                return true;\n            }\n            return false;\n        }\n\n        /**\n         * Default implementation of {@link KeyEvent.Callback#onKeyMultiple(int, int, KeyEvent)\n     * KeyEvent.Callback.onKeyMultiple()}: always returns false (doesn't handle\n         * the event).\n         */\n        onKeyMultiple(keyCode:number, repeatCount:number, event:KeyEvent):boolean {\n            return false;\n        }\n\n        /**\n         * Called when the dialog has detected the user's press of the back\n         * key.  The default implementation simply cancels the dialog (only if\n         * it is cancelable), but you can override this to do whatever you want.\n         */\n        onBackPressed():void {\n            if (this.mCancelable) {\n                this.cancel();\n            }\n        }\n\n        ///**\n        // * Called when a key shortcut event is not handled by any of the views in the Dialog.\n        // * Override this method to implement global key shortcuts for the Dialog.\n        // * Key shortcuts can also be implemented by setting the\n        // * {@link MenuItem#setShortcut(char, char) shortcut} property of menu items.\n        // *\n        // * @param keyCode The value in event.getKeyCode().\n        // * @param event Description of the key event.\n        // * @return True if the key shortcut was handled.\n        // */\n        //onKeyShortcut(keyCode:number, event:KeyEvent):boolean  {\n        //    return false;\n        //}\n\n        /**\n         * Called when a touch screen event was not handled by any of the views\n         * under it. This is most useful to process touch events that happen outside\n         * of your window bounds, where there is no view to receive it.\n         *\n         * @param event The touch screen event being processed.\n         * @return Return true if you have consumed the event, false if you haven't.\n         *         The default implementation will cancel the dialog when a touch\n         *         happens outside of the window bounds.\n         */\n        onTouchEvent(event:MotionEvent):boolean {\n            if (this.mCancelable && this.mShowing && this.mWindow.shouldCloseOnTouch(this.mContext, event)) {\n                this.cancel();\n                return true;\n            }\n            return false;\n        }\n\n        /**\n         * Called when the trackball was moved and not handled by any of the\n         * views inside of the activity.  So, for example, if the trackball moves\n         * while focus is on a button, you will receive a call here because\n         * buttons do not normally do anything with trackball events.  The call\n         * here happens <em>before</em> trackball movements are converted to\n         * DPAD key events, which then get sent back to the view hierarchy, and\n         * will be processed at the point for things like focus navigation.\n         *\n         * @param event The trackball event being processed.\n         *\n         * @return Return true if you have consumed the event, false if you haven't.\n         * The default implementation always returns false.\n         */\n        onTrackballEvent(event:MotionEvent):boolean {\n            return false;\n        }\n\n        /**\n         * Called when a generic motion event was not handled by any of the\n         * views inside of the dialog.\n         * <p>\n         * Generic motion events describe joystick movements, mouse hovers, track pad\n         * touches, scroll wheel movements and other input events.  The\n         * {@link MotionEvent#getSource() source} of the motion event specifies\n         * the class of input that was received.  Implementations of this method\n         * must examine the bits in the source before processing the event.\n         * The following code example shows how this is done.\n         * </p><p>\n         * Generic motion events with source class\n         * {@link android.view.InputDevice#SOURCE_CLASS_POINTER}\n         * are delivered to the view under the pointer.  All other generic motion events are\n         * delivered to the focused view.\n         * </p><p>\n         * See {@link View#onGenericMotionEvent(MotionEvent)} for an example of how to\n         * handle this event.\n         * </p>\n         *\n         * @param event The generic motion event being processed.\n         *\n         * @return Return true if you have consumed the event, false if you haven't.\n         * The default implementation always returns false.\n         */\n        onGenericMotionEvent(event:MotionEvent):boolean {\n            return false;\n        }\n\n        onWindowAttributesChanged(params:WindowManager.LayoutParams):void {\n            if (this.mDecor != null) {\n                this.mWindowManager.updateWindowLayout(this.mWindow, params);\n            }\n        }\n\n        onContentChanged():void {\n        }\n\n        onWindowFocusChanged(hasFocus:boolean):void {\n        }\n\n        onAttachedToWindow():void {\n        }\n\n        onDetachedFromWindow():void {\n        }\n\n        /**\n         * Called to process key events.  You can override this to intercept all\n         * key events before they are dispatched to the window.  Be sure to call\n         * this implementation for key events that should be handled normally.\n         *\n         * @param event The key event.\n         *\n         * @return boolean Return true if this event was consumed.\n         */\n        dispatchKeyEvent(event:KeyEvent):boolean {\n            if ((this.mOnKeyListener != null) && (this.mOnKeyListener.onKey(this, event.getKeyCode(), event))) {\n                return true;\n            }\n            if (this.mWindow.superDispatchKeyEvent(event)) {\n                return true;\n            }\n            return event.dispatch(this, this.mDecor != null ? this.mDecor.getKeyDispatcherState() : null, this);\n        }\n\n        ///**\n        // * Called to process a key shortcut event.\n        // * You can override this to intercept all key shortcut events before they are\n        // * dispatched to the window.  Be sure to call this implementation for key shortcut\n        // * events that should be handled normally.\n        // *\n        // * @param event The key shortcut event.\n        // * @return True if this event was consumed.\n        // */\n        //dispatchKeyShortcutEvent(event:KeyEvent):boolean  {\n        //    if (this.mWindow.superDispatchKeyShortcutEvent(event)) {\n        //        return true;\n        //    }\n        //    return this.onKeyShortcut(event.getKeyCode(), event);\n        //}\n\n        /**\n         * Called to process touch screen events.  You can override this to\n         * intercept all touch screen events before they are dispatched to the\n         * window.  Be sure to call this implementation for touch screen events\n         * that should be handled normally.\n         *\n         * @param ev The touch screen event.\n         *\n         * @return boolean Return true if this event was consumed.\n         */\n        dispatchTouchEvent(ev:MotionEvent):boolean {\n            if (this.mWindow.superDispatchTouchEvent(ev)) {\n                return true;\n            }\n            return this.onTouchEvent(ev);\n        }\n\n        ///**\n        // * Called to process trackball events.  You can override this to\n        // * intercept all trackball events before they are dispatched to the\n        // * window.  Be sure to call this implementation for trackball events\n        // * that should be handled normally.\n        // *\n        // * @param ev The trackball event.\n        // *\n        // * @return boolean Return true if this event was consumed.\n        // */\n        //dispatchTrackballEvent(ev:MotionEvent):boolean  {\n        //    if (this.mWindow.superDispatchTrackballEvent(ev)) {\n        //        return true;\n        //    }\n        //    return this.onTrackballEvent(ev);\n        //}\n\n        /**\n         * Called to process generic motion events.  You can override this to\n         * intercept all generic motion events before they are dispatched to the\n         * window.  Be sure to call this implementation for generic motion events\n         * that should be handled normally.\n         *\n         * @param ev The generic motion event.\n         *\n         * @return boolean Return true if this event was consumed.\n         */\n        dispatchGenericMotionEvent(ev:MotionEvent):boolean {\n            if (this.mWindow.superDispatchGenericMotionEvent(ev)) {\n                return true;\n            }\n            return this.onGenericMotionEvent(ev);\n        }\n\n        //dispatchPopulateAccessibilityEvent(event:AccessibilityEvent):boolean  {\n        //    event.setClassName(this.getClass().getName());\n        //    event.setPackageName(this.mContext.getPackageName());\n        //    let params:LayoutParams = this.getWindow().getAttributes();\n        //    let isFullScreen:boolean = (params.width == LayoutParams.MATCH_PARENT) && (params.height == LayoutParams.MATCH_PARENT);\n        //    event.setFullScreen(isFullScreen);\n        //    return false;\n        //}\n        //\n        ///**\n        // * @see Activity#onCreatePanelView(int)\n        // */\n        //onCreatePanelView(featureId:number):View  {\n        //    return null;\n        //}\n        //\n        ///**\n        // * @see Activity#onCreatePanelMenu(int, Menu)\n        // */\n        //onCreatePanelMenu(featureId:number, menu:Menu):boolean  {\n        //    if (featureId == Window.FEATURE_OPTIONS_PANEL) {\n        //        return this.onCreateOptionsMenu(menu);\n        //    }\n        //    return false;\n        //}\n        //\n        ///**\n        // * @see Activity#onPreparePanel(int, View, Menu)\n        // */\n        //onPreparePanel(featureId:number, view:View, menu:Menu):boolean  {\n        //    if (featureId == Window.FEATURE_OPTIONS_PANEL && menu != null) {\n        //        let goforit:boolean = this.onPrepareOptionsMenu(menu);\n        //        return goforit && menu.hasVisibleItems();\n        //    }\n        //    return true;\n        //}\n        //\n        ///**\n        // * @see Activity#onMenuOpened(int, Menu)\n        // */\n        //onMenuOpened(featureId:number, menu:Menu):boolean  {\n        //    if (featureId == Window.FEATURE_ACTION_BAR) {\n        //        this.mActionBar.dispatchMenuVisibilityChanged(true);\n        //    }\n        //    return true;\n        //}\n        //\n        ///**\n        // * @see Activity#onMenuItemSelected(int, MenuItem)\n        // */\n        //onMenuItemSelected(featureId:number, item:MenuItem):boolean  {\n        //    return false;\n        //}\n        //\n        ///**\n        // * @see Activity#onPanelClosed(int, Menu)\n        // */\n        //onPanelClosed(featureId:number, menu:Menu):void  {\n        //    if (featureId == Window.FEATURE_ACTION_BAR) {\n        //        this.mActionBar.dispatchMenuVisibilityChanged(false);\n        //    }\n        //}\n        //\n        ///**\n        // * It is usually safe to proxy this call to the owner activity's\n        // * {@link Activity#onCreateOptionsMenu(Menu)} if the client desires the same\n        // * menu for this Dialog.\n        // *\n        // * @see Activity#onCreateOptionsMenu(Menu)\n        // * @see #getOwnerActivity()\n        // */\n        //onCreateOptionsMenu(menu:Menu):boolean  {\n        //    return true;\n        //}\n        //\n        ///**\n        // * It is usually safe to proxy this call to the owner activity's\n        // * {@link Activity#onPrepareOptionsMenu(Menu)} if the client desires the\n        // * same menu for this Dialog.\n        // *\n        // * @see Activity#onPrepareOptionsMenu(Menu)\n        // * @see #getOwnerActivity()\n        // */\n        //onPrepareOptionsMenu(menu:Menu):boolean  {\n        //    return true;\n        //}\n        //\n        ///**\n        // * @see Activity#onOptionsItemSelected(MenuItem)\n        // */\n        //onOptionsItemSelected(item:MenuItem):boolean  {\n        //    return false;\n        //}\n        //\n        ///**\n        // * @see Activity#onOptionsMenuClosed(Menu)\n        // */\n        //onOptionsMenuClosed(menu:Menu):void  {\n        //}\n        //\n        ///**\n        // * @see Activity#openOptionsMenu()\n        // */\n        //openOptionsMenu():void  {\n        //    this.mWindow.openPanel(Window.FEATURE_OPTIONS_PANEL, null);\n        //}\n        //\n        ///**\n        // * @see Activity#closeOptionsMenu()\n        // */\n        //closeOptionsMenu():void  {\n        //    this.mWindow.closePanel(Window.FEATURE_OPTIONS_PANEL);\n        //}\n        //\n        ///**\n        // * @see Activity#invalidateOptionsMenu()\n        // */\n        //invalidateOptionsMenu():void  {\n        //    this.mWindow.invalidatePanelMenu(Window.FEATURE_OPTIONS_PANEL);\n        //}\n        //\n        ///**\n        // * @see Activity#onCreateContextMenu(ContextMenu, View, ContextMenuInfo)\n        // */\n        //onCreateContextMenu(menu:ContextMenu, v:View, menuInfo:ContextMenuInfo):void  {\n        //}\n        //\n        ///**\n        // * @see Activity#registerForContextMenu(View)\n        // */\n        //registerForContextMenu(view:View):void  {\n        //    view.setOnCreateContextMenuListener(this);\n        //}\n        //\n        ///**\n        // * @see Activity#unregisterForContextMenu(View)\n        // */\n        //unregisterForContextMenu(view:View):void  {\n        //    view.setOnCreateContextMenuListener(null);\n        //}\n        //\n        ///**\n        // * @see Activity#openContextMenu(View)\n        // */\n        //openContextMenu(view:View):void  {\n        //    view.showContextMenu();\n        //}\n        //\n        ///**\n        // * @see Activity#onContextItemSelected(MenuItem)\n        // */\n        //onContextItemSelected(item:MenuItem):boolean  {\n        //    return false;\n        //}\n        //\n        ///**\n        // * @see Activity#onContextMenuClosed(Menu)\n        // */\n        //onContextMenuClosed(menu:Menu):void  {\n        //}\n        //\n        ///**\n        // * This hook is called when the user signals the desire to start a search.\n        // */\n        //onSearchRequested():boolean  {\n        //    const searchManager:SearchManager = <SearchManager> this.mContext.getSystemService(Context.SEARCH_SERVICE);\n        //    // associate search with owner activity\n        //    const appName:ComponentName = this.getAssociatedActivity();\n        //    if (appName != null && searchManager.getSearchableInfo(appName) != null) {\n        //        searchManager.startSearch(null, false, appName, null, false);\n        //        this.dismiss();\n        //        return true;\n        //    } else {\n        //        return false;\n        //    }\n        //}\n        //\n        //onWindowStartingActionMode(callback:ActionMode.Callback):ActionMode  {\n        //    if (this.mActionBar != null) {\n        //        return this.mActionBar.startActionMode(callback);\n        //    }\n        //    return null;\n        //}\n        //\n        ///**\n        // * {@inheritDoc}\n        // *\n        // * Note that if you override this method you should always call through\n        // * to the superclass implementation by calling super.onActionModeStarted(mode).\n        // */\n        //onActionModeStarted(mode:ActionMode):void  {\n        //    this.mActionMode = mode;\n        //}\n        //\n        ///**\n        // * {@inheritDoc}\n        // *\n        // * Note that if you override this method you should always call through\n        // * to the superclass implementation by calling super.onActionModeFinished(mode).\n        // */\n        //onActionModeFinished(mode:ActionMode):void  {\n        //    if (mode == this.mActionMode) {\n        //        this.mActionMode = null;\n        //    }\n        //}\n        //\n        ///**\n        // * @return The activity associated with this dialog, or null if there is no associated activity.\n        // */\n        //private getAssociatedActivity():ComponentName  {\n        //    let activity:Activity = this.mOwnerActivity;\n        //    let context:Context = this.getContext();\n        //    while (activity == null && context != null) {\n        //        if (context instanceof Activity) {\n        //            // found it!\n        //            activity = <Activity> context;\n        //        } else {\n        //            context = (context instanceof ContextWrapper) ? // unwrap one level\n        //            (<ContextWrapper> context).getBaseContext() : // done\n        //            null;\n        //        }\n        //    }\n        //    return activity == null ? null : activity.getComponentName();\n        //}\n\n        /**\n         * Request that key events come to this dialog. Use this if your\n         * dialog has no views with focus, but the dialog still wants\n         * a chance to process key events.\n         *\n         * @param get true if the dialog should receive key events, false otherwise\n         * @see android.view.Window#takeKeyEvents\n         */\n        takeKeyEvents(get:boolean):void {\n            this.mWindow.takeKeyEvents(get);\n        }\n\n        ///**\n        // * Enable extended window features.  This is a convenience for calling\n        // * {@link android.view.Window#requestFeature getWindow().requestFeature()}.\n        // *\n        // * @param featureId The desired feature as defined in\n        // *                  {@link android.view.Window}.\n        // * @return Returns true if the requested feature is supported and now\n        // *         enabled.\n        // *\n        // * @see android.view.Window#requestFeature\n        // */\n        //requestWindowFeature(featureId:number):boolean  {\n        //    return this.getWindow().requestFeature(featureId);\n        //}\n        //\n        ///**\n        // * Convenience for calling\n        // * {@link android.view.Window#setFeatureDrawableResource}.\n        // */\n        //setFeatureDrawableResource(featureId:number, resId:number):void  {\n        //    this.getWindow().setFeatureDrawableResource(featureId, resId);\n        //}\n        //\n        ///**\n        // * Convenience for calling\n        // * {@link android.view.Window#setFeatureDrawableUri}.\n        // */\n        //setFeatureDrawableUri(featureId:number, uri:Uri):void  {\n        //    this.getWindow().setFeatureDrawableUri(featureId, uri);\n        //}\n        //\n        ///**\n        // * Convenience for calling\n        // * {@link android.view.Window#setFeatureDrawable(int, Drawable)}.\n        // */\n        //setFeatureDrawable(featureId:number, drawable:Drawable):void  {\n        //    this.getWindow().setFeatureDrawable(featureId, drawable);\n        //}\n        //\n        ///**\n        // * Convenience for calling\n        // * {@link android.view.Window#setFeatureDrawableAlpha}.\n        // */\n        //setFeatureDrawableAlpha(featureId:number, alpha:number):void  {\n        //    this.getWindow().setFeatureDrawableAlpha(featureId, alpha);\n        //}\n\n        getLayoutInflater():LayoutInflater {\n            return this.getWindow().getLayoutInflater();\n        }\n\n        /**\n         * Sets whether this dialog is cancelable with the\n         * {@link KeyEvent#KEYCODE_BACK BACK} key.\n         */\n        setCancelable(flag:boolean):void {\n            this.mCancelable = flag;\n        }\n\n        /**\n         * Sets whether this dialog is canceled when touched outside the window's\n         * bounds. If setting to true, the dialog is set to be cancelable if not\n         * already set.\n         *\n         * @param cancel Whether the dialog should be canceled when touched outside\n         *            the window.\n         */\n        setCanceledOnTouchOutside(cancel:boolean):void {\n            if (cancel && !this.mCancelable) {\n                this.mCancelable = true;\n            }\n            this.mWindow.setCloseOnTouchOutside(cancel);\n        }\n\n        /**\n         * Cancel the dialog.  This is essentially the same as calling {@link #dismiss()}, but it will\n         * also call your {@link DialogInterface.OnCancelListener} (if registered).\n         */\n        cancel():void {\n            if (!this.mCanceled && this.mCancelMessage != null) {\n                this.mCanceled = true;\n                // Obtain a new message so this dialog can be re-used\n                Message.obtain(this.mCancelMessage).sendToTarget();\n            }\n            this.dismiss();\n        }\n\n        /**\n         * Set a listener to be invoked when the dialog is canceled.\n         *\n         * <p>This will only be invoked when the dialog is canceled.\n         * Cancel events alone will not capture all ways that\n         * the dialog might be dismissed. If the creator needs\n         * to know when a dialog is dismissed in general, use\n         * {@link #setOnDismissListener}.</p>\n         *\n         * @param listener The {@link DialogInterface.OnCancelListener} to use.\n         */\n        setOnCancelListener(listener:DialogInterface.OnCancelListener):void {\n            if (this.mCancelAndDismissTaken != null) {\n                throw Error(`new IllegalStateException(\"OnCancelListener is already taken by \" + this.mCancelAndDismissTaken + \" and can not be replaced.\")`);\n            }\n            if (listener != null) {\n                this.mCancelMessage = this.mListenersHandler.obtainMessage(Dialog.CANCEL, listener);\n            } else {\n                this.mCancelMessage = null;\n            }\n        }\n\n        /**\n         * Set a message to be sent when the dialog is canceled.\n         * @param msg The msg to send when the dialog is canceled.\n         * @see #setOnCancelListener(android.content.DialogInterface.OnCancelListener)\n         */\n        setCancelMessage(msg:Message):void {\n            this.mCancelMessage = msg;\n        }\n\n        /**\n         * Set a listener to be invoked when the dialog is dismissed.\n         * @param listener The {@link DialogInterface.OnDismissListener} to use.\n         */\n        setOnDismissListener(listener:DialogInterface.OnDismissListener):void {\n            if (this.mCancelAndDismissTaken != null) {\n                throw Error(`new IllegalStateException(\"OnDismissListener is already taken by \" + this.mCancelAndDismissTaken + \" and can not be replaced.\")`);\n            }\n            if (listener != null) {\n                this.mDismissMessage = this.mListenersHandler.obtainMessage(Dialog.DISMISS, listener);\n            } else {\n                this.mDismissMessage = null;\n            }\n        }\n\n        /**\n         * Sets a listener to be invoked when the dialog is shown.\n         * @param listener The {@link DialogInterface.OnShowListener} to use.\n         */\n        setOnShowListener(listener:DialogInterface.OnShowListener):void {\n            if (listener != null) {\n                this.mShowMessage = this.mListenersHandler.obtainMessage(Dialog.SHOW, listener);\n            } else {\n                this.mShowMessage = null;\n            }\n        }\n\n        /**\n         * Set a message to be sent when the dialog is dismissed.\n         * @param msg The msg to send when the dialog is dismissed.\n         */\n        setDismissMessage(msg:Message):void {\n            this.mDismissMessage = msg;\n        }\n\n        /** @hide */\n        takeCancelAndDismissListeners(msg:string, cancel:DialogInterface.OnCancelListener, dismiss:DialogInterface.OnDismissListener):boolean {\n            if (this.mCancelAndDismissTaken != null) {\n                this.mCancelAndDismissTaken = null;\n            } else if (this.mCancelMessage != null || this.mDismissMessage != null) {\n                return false;\n            }\n            this.setOnCancelListener(cancel);\n            this.setOnDismissListener(dismiss);\n            this.mCancelAndDismissTaken = msg;\n            return true;\n        }\n\n        ///**\n        // * By default, this will use the owner Activity's suggested stream type.\n        // *\n        // * @see Activity#setVolumeControlStream(int)\n        // * @see #setOwnerActivity(Activity)\n        // */\n        //setVolumeControlStream(streamType:number):void  {\n        //    this.getWindow().setVolumeControlStream(streamType);\n        //}\n        //\n        ///**\n        // * @see Activity#getVolumeControlStream()\n        // */\n        //getVolumeControlStream():number  {\n        //    return this.getWindow().getVolumeControlStream();\n        //}\n\n        /**\n         * Sets the callback that will be called if a key is dispatched to the dialog.\n         */\n        setOnKeyListener(onKeyListener:DialogInterface.OnKeyListener):void {\n            this.mOnKeyListener = onKeyListener;\n        }\n\n\n    }\n\n    export module Dialog {\n        export class ListenersHandler extends Handler {\n\n            private mDialog:WeakReference<DialogInterface>;\n\n            constructor(dialog:Dialog) {\n                super();\n                this.mDialog = new WeakReference<DialogInterface>(dialog);\n            }\n\n            handleMessage(msg:Message):void {\n                switch (msg.what) {\n                    case Dialog.DISMISS:\n                        (<DialogInterface.OnDismissListener> msg.obj).onDismiss(this.mDialog.get());\n                        break;\n                    case Dialog.CANCEL:\n                        (<DialogInterface.OnCancelListener> msg.obj).onCancel(this.mDialog.get());\n                        break;\n                    case Dialog.SHOW:\n                        (<DialogInterface.OnShowListener> msg.obj).onShow(this.mDialog.get());\n                        break;\n                }\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "src/android/content/Context.ts",
    "content": "/**\n * Created by linfaxin on 16/1/4.\n * lite impl of Android's Content\n */\n///<reference path=\"../view/WindowManager.ts\"/>\n///<reference path=\"res/Resources.ts\"/>\n///<reference path=\"../app/Application.ts\"/>\n///<reference path=\"../content/Intent.ts\"/>\n///<reference path=\"../os/Bundle.ts\"/>\n///<reference path=\"../view/LayoutInflater.ts\"/>\n\n\nmodule android.content {\n    import Intent = android.content.Intent;\n    import Bundle = android.os.Bundle;\n    import LayoutInflater = android.view.LayoutInflater;\n\n    export abstract class Context {\n        androidUI: androidui.AndroidUI;\n        private mLayoutInflater:LayoutInflater;\n        private mResources:android.content.res.Resources;\n\n        constructor(androidUI:androidui.AndroidUI) {\n            this.androidUI = androidUI;\n            this.mLayoutInflater = new LayoutInflater(this);\n            this.mResources = new android.content.res.Resources(this);\n        }\n\n        abstract getWindowManager():android.view.WindowManager;\n\n        getApplicationContext():android.app.Application{\n            return this.androidUI.mApplication;\n        }\n\n        /** Return a Resources instance for your application's package. */\n        getResources():android.content.res.Resources{\n            return this.mResources;\n        }\n\n        getLayoutInflater():LayoutInflater{\n            return this.mLayoutInflater;\n        }\n\n        /**\n         * Retrieve styled attribute information.\n         */\n        public obtainStyledAttributes(attrs:HTMLElement, defStyleAttr?:Map<string, string>):res.TypedArray {\n            return res.TypedArray.obtain(this.mResources, attrs, defStyleAttr);\n        }\n\n    }\n}"
  },
  {
    "path": "src/android/content/DialogInterface.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/view/KeyEvent.ts\"/>\n\nmodule android.content {\n    import KeyEvent = android.view.KeyEvent;\n\n    export interface DialogInterface {\n        cancel():void ;\n        dismiss():void ;\n    }\n\n    export module DialogInterface {\n        /**\n         * Interface used to allow the creator of a dialog to run some code when the\n         * dialog is canceled.\n         * <p>\n         * This will only be called when the dialog is canceled, if the creator\n         * needs to know when it is dismissed in general, use\n         * {@link DialogInterface.OnDismissListener}.\n         */\n        export interface OnCancelListener {\n\n            /**\n             * This method will be invoked when the dialog is canceled.\n             *\n             * @param dialog The dialog that was canceled will be passed into the\n             *            method.\n             */\n            onCancel(dialog:DialogInterface):void ;\n        }\n        /**\n         * Interface used to allow the creator of a dialog to run some code when the\n         * dialog is dismissed.\n         */\n        export interface OnDismissListener {\n\n            /**\n             * This method will be invoked when the dialog is dismissed.\n             *\n             * @param dialog The dialog that was dismissed will be passed into the\n             *            method.\n             */\n            onDismiss(dialog:DialogInterface):void ;\n        }\n        /**\n         * Interface used to allow the creator of a dialog to run some code when the\n         * dialog is shown.\n         */\n        export interface OnShowListener {\n\n            /**\n             * This method will be invoked when the dialog is shown.\n             *\n             * @param dialog The dialog that was shown will be passed into the\n             *            method.\n             */\n            onShow(dialog:DialogInterface):void ;\n        }\n        /**\n         * Interface used to allow the creator of a dialog to run some code when an\n         * item on the dialog is clicked..\n         */\n        export interface OnClickListener {\n\n            /**\n             * This method will be invoked when a button in the dialog is clicked.\n             *\n             * @param dialog The dialog that received the click.\n             * @param which The button that was clicked (e.g.\n             *            {@link DialogInterface#BUTTON1}) or the position\n             *            of the item clicked.\n             */\n            /* TODO: Change to use BUTTON_POSITIVE after API council */\n            onClick(dialog:DialogInterface, which:number):void ;\n        }\n        /**\n         * Interface used to allow the creator of a dialog to run some code when an\n         * item in a multi-choice dialog is clicked.\n         */\n        export interface OnMultiChoiceClickListener {\n\n            /**\n             * This method will be invoked when an item in the dialog is clicked.\n             *\n             * @param dialog The dialog where the selection was made.\n             * @param which The position of the item in the list that was clicked.\n             * @param isChecked True if the click checked the item, else false.\n             */\n            onClick(dialog:DialogInterface, which:number, isChecked:boolean):void ;\n        }\n        /**\n         * Interface definition for a callback to be invoked when a key event is\n         * dispatched to this dialog. The callback will be invoked before the key\n         * event is given to the dialog.\n         */\n        export interface OnKeyListener {\n\n            /**\n             * Called when a key is dispatched to a dialog. This allows listeners to\n             * get a chance to respond before the dialog.\n             *\n             * @param dialog The dialog the key has been dispatched to.\n             * @param keyCode The code for the physical key that was pressed\n             * @param event The KeyEvent object containing full information about\n             *            the event.\n             * @return True if the listener has consumed the event, false otherwise.\n             */\n            onKey(dialog:DialogInterface, keyCode:number, event:KeyEvent):boolean ;\n        }\n        /**\n         * The identifier for the positive button.\n         */\n        export var BUTTON_POSITIVE:number = -1;\n        /**\n         * The identifier for the negative button.\n         */\n        export var BUTTON_NEGATIVE:number = -2;\n        /**\n         * The identifier for the neutral button.\n         */\n        export var BUTTON_NEUTRAL:number = -3;\n        /**\n         * @deprecated Use {@link #BUTTON_POSITIVE}\n         */\n        export var BUTTON1:number = DialogInterface.BUTTON_POSITIVE;\n        /**\n         * @deprecated Use {@link #BUTTON_NEGATIVE}\n         */\n        export var BUTTON2:number = DialogInterface.BUTTON_NEGATIVE;\n        /**\n         * @deprecated Use {@link #BUTTON_NEUTRAL}\n         */\n        export var BUTTON3:number = DialogInterface.BUTTON_NEUTRAL;\n    }\n\n}"
  },
  {
    "path": "src/android/content/Intent.ts",
    "content": "/**\n * Created by linfaxin on 16/1/4.\n * lite impl of Android's Intent.\n */\n///<reference path=\"../os/Bundle.ts\"/>\n\n\nmodule android.content{\n    import Bundle = android.os.Bundle;\n\n    export class Intent{\n        private mExtras:Bundle;\n        private mRequestCode = -1;\n        private mFlags = 0;\n        private activityName:string;\n\n        /**\n         * If set, and the activity being launched is already running in the\n         * current task, then instead of launching a new instance of that activity,\n         * all of the other activities on top of it will be closed and this Intent\n         * will be delivered to the (now on top) old activity as a new Intent.\n         *\n         * <p>For example, consider a task consisting of the activities: A, B, C, D.\n         * If D calls startActivity() with an Intent that resolves to the component\n         * of activity B, then C and D will be finished and B receive the given\n         * Intent, resulting in the stack now being: A, B.\n         *\n         * <p>The currently running instance of activity B in the above example will\n         * either receive the new intent you are starting here in its\n         * onNewIntent() method, or be itself finished and restarted with the\n         * new intent.  If it has declared its launch mode to be \"multiple\" (the\n         * default) and you have not set {@link #FLAG_ACTIVITY_SINGLE_TOP} in\n         * the same intent, then it will be finished and re-created; for all other\n         * launch modes or if {@link #FLAG_ACTIVITY_SINGLE_TOP} is set then this\n         * Intent will be delivered to the current instance's onNewIntent().\n         *\n         * <p>This launch mode can also be used to good effect in conjunction with\n         * {@link #FLAG_ACTIVITY_NEW_TASK}: if used to start the root activity\n         * of a task, it will bring any currently running instance of that task\n         * to the foreground, and then clear it to its root state.  This is\n         * especially useful, for example, when launching an activity from the\n         * notification manager.\n         *\n         * <p>See\n         * <a href=\"{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html\">Tasks and Back\n         * Stack</a> for more information about tasks.\n         */\n        public static FLAG_ACTIVITY_CLEAR_TOP = 0x04000000;\n\n        constructor(activityName?:string) {\n            this.activityName = activityName;\n        }\n\n        getBooleanExtra(name:string, defaultValue:boolean):boolean {\n            return this.mExtras == null ? defaultValue : <boolean>this.mExtras.get(name, defaultValue);\n        }\n        getIntExtra(name:string, defaultValue:number):number {\n            return this.mExtras == null ? defaultValue : <number>this.mExtras.get(name, defaultValue);\n        }\n        getLongExtra(name:string, defaultValue:number):number {\n            return this.mExtras == null ? defaultValue : <number>this.mExtras.get(name, defaultValue);\n        }\n        getFloatExtra(name:string, defaultValue:number):number {\n            return this.mExtras == null ? defaultValue : <number>this.mExtras.get(name, defaultValue);\n        }\n        getDoubleExtra(name:string, defaultValue:number):number {\n            return this.mExtras == null ? defaultValue : <number>this.mExtras.get(name, defaultValue);\n        }\n        getStringExtra(name:string, defaultValue?:string):string {\n            return this.mExtras == null ? defaultValue : <string>this.mExtras.get(name, defaultValue);\n        }\n        getStringArrayExtra(name:string, defaultValue?:string[]):string[] {\n            return this.mExtras == null ? defaultValue : <string[]>this.mExtras.get(name, defaultValue);\n        }\n        getIntegerArrayExtra(name:string, defaultValue?:number[]):number[] {\n            return this.mExtras == null ? defaultValue : <number[]>this.mExtras.get(name, defaultValue);\n        }\n        getLongArrayExtra(name:string, defaultValue?:number[]):number[] {\n            return this.mExtras == null ? defaultValue : <number[]>this.mExtras.get(name, defaultValue);\n        }\n        getFloatArrayExtra(name:string, defaultValue?:number[]):number[] {\n            return this.mExtras == null ? defaultValue : <number[]>this.mExtras.get(name, defaultValue);\n        }\n        getDoubleArrayExtra(name:string, defaultValue?:number[]):number[] {\n            return this.mExtras == null ? defaultValue : <number[]>this.mExtras.get(name, defaultValue);\n        }\n        getBooleanArrayExtra(name:string, defaultValue?:boolean[]):boolean[] {\n            return this.mExtras == null ? defaultValue : <boolean[]>this.mExtras.get(name, defaultValue);\n        }\n\n        hasExtra(name:string){\n            return this.mExtras != null && this.mExtras.containsKey(name);\n        }\n\n        putExtra(name:string, value:any):Intent {\n            if (this.mExtras == null) {\n                this.mExtras = new Bundle();\n            }\n            this.mExtras.put(name, value);\n            return this;\n        }\n        getExtras():Bundle {\n            return (this.mExtras != null) ? new Bundle(this.mExtras) : null;\n        }\n\n\n        /**\n         * Retrieve any special flags associated with this intent.  You will\n         * normally just set them with {@link #setFlags} and let the system\n         * take the appropriate action with them.\n         *\n         * @return int The currently set flags.\n         *\n         * @see #setFlags\n         */\n        getFlags():number {\n            return this.mFlags;\n        }\n\n        /**\n         * Set special flags controlling how this intent is handled.  Most values\n         * here depend on the type of component being executed by the Intent,\n         * specifically the FLAG_ACTIVITY_* flags are all for use with\n         * {@link Context#startActivity Context.startActivity()} and the\n         * FLAG_RECEIVER_* flags are all for use with\n         * {@link Context#sendBroadcast(Intent) Context.sendBroadcast()}.\n         *\n         * <p>See the\n         * <a href=\"{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html\">Tasks and Back\n         * Stack</a> documentation for important information on how some of these options impact\n         * the behavior of your application.\n         *\n         * @param flags The desired flags.\n         *\n         * @return Returns the same Intent object, for chaining multiple calls\n         * into a single statement.\n         *\n         * @see #getFlags\n         * @see #addFlags\n         *\n         * @see #FLAG_GRANT_READ_URI_PERMISSION\n         * @see #FLAG_GRANT_WRITE_URI_PERMISSION\n         * @see #FLAG_GRANT_PERSISTABLE_URI_PERMISSION\n         * @see #FLAG_GRANT_PREFIX_URI_PERMISSION\n         * @see #FLAG_DEBUG_LOG_RESOLUTION\n         * @see #FLAG_FROM_BACKGROUND\n         * @see #FLAG_ACTIVITY_BROUGHT_TO_FRONT\n         * @see #FLAG_ACTIVITY_CLEAR_TASK\n         * @see #FLAG_ACTIVITY_CLEAR_TOP\n         * @see #FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET\n         * @see #FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS\n         * @see #FLAG_ACTIVITY_FORWARD_RESULT\n         * @see #FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY\n         * @see #FLAG_ACTIVITY_MULTIPLE_TASK\n         * @see #FLAG_ACTIVITY_NEW_DOCUMENT\n         * @see #FLAG_ACTIVITY_NEW_TASK\n         * @see #FLAG_ACTIVITY_NO_ANIMATION\n         * @see #FLAG_ACTIVITY_NO_HISTORY\n         * @see #FLAG_ACTIVITY_NO_USER_ACTION\n         * @see #FLAG_ACTIVITY_PREVIOUS_IS_TOP\n         * @see #FLAG_ACTIVITY_RESET_TASK_IF_NEEDED\n         * @see #FLAG_ACTIVITY_REORDER_TO_FRONT\n         * @see #FLAG_ACTIVITY_SINGLE_TOP\n         * @see #FLAG_ACTIVITY_TASK_ON_HOME\n         * @see #FLAG_RECEIVER_REGISTERED_ONLY\n         */\n        setFlags(flags:number):Intent {\n            this.mFlags = flags;\n            return this;\n        }\n\n        /**\n         * Add additional flags to the intent (or with existing flags\n         * value).\n         *\n         * @param flags The new flags to set.\n         *\n         * @return Returns the same Intent object, for chaining multiple calls\n         * into a single statement.\n         *\n         * @see #setFlags\n         */\n        addFlags(flags:number):Intent {\n            this.mFlags |= flags;\n            return this;\n        }\n    }\n}"
  },
  {
    "path": "src/android/content/res/ColorStateList.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../util/SparseArray.ts\"/>\n///<reference path=\"../../../java/lang/ref/WeakReference.ts\"/>\n///<reference path=\"../../util/StateSet.ts\"/>\n///<reference path=\"../../../androidui/util/ArrayCreator.ts\"/>\n\n\nmodule android.content.res{\n    import SparseArray = android.util.SparseArray;\n    import StateSet = android.util.StateSet;\n    import WeakReference = java.lang.ref.WeakReference;\n    import Color = android.graphics.Color;\n\n    /**\n     *\n     * Lets you map {@link android.view.View} state sets to colors.\n     *\n     * {@link android.content.res.ColorStateList}s are created from XML resource files defined in the\n     * \"color\" subdirectory directory of an application's resource directory.  The XML file contains\n     * a single \"selector\" element with a number of \"item\" elements inside.  For example:\n     *\n     * <pre>\n     * &lt;selector xmlns:android=\"http://schemas.android.com/apk/res/android\"&gt;\n     *   &lt;item android:state_focused=\"true\" android:color=\"@color/testcolor1\"/&gt;\n     *   &lt;item android:state_pressed=\"true\" android:state_enabled=\"false\" android:color=\"@color/testcolor2\" /&gt;\n     *   &lt;item android:state_enabled=\"false\" android:color=\"@color/testcolor3\" /&gt;\n     *   &lt;item android:color=\"@color/testcolor5\"/&gt;\n     * &lt;/selector&gt;\n     * </pre>\n     *\n     * This defines a set of state spec / color pairs where each state spec specifies a set of\n     * states that a view must either be in or not be in and the color specifies the color associated\n     * with that spec.  The list of state specs will be processed in order of the items in the XML file.\n     * An item with no state spec is considered to match any set of states and is generally useful as\n     * a final item to be used as a default.  Note that if you have such an item before any other items\n     * in the list then any subsequent items will end up being ignored.\n     * <p>For more information, see the guide to <a\n     * href=\"{@docRoot}guide/topics/resources/color-list-resource.html\">Color State\n     * List Resource</a>.</p>\n     */\n    export class ColorStateList{\n        mStateSpecs:Array<Array<number>>;// must be parallel to mColors\n        mColors:Array<number>;// must be parallel to mStateSpecs\n        mDefaultColor = 0xffff0000;\n\n        private static EMPTY:Array<Array<number>> = [[]];\n        private static sCache = new SparseArray<WeakReference<ColorStateList>>();\n\n        /**\n         * Creates a ColorStateList that returns the specified mapping from\n         * states to colors.\n         */\n        constructor(states:Array<Array<number>>, colors:Array<number>){\n            this.mStateSpecs = states;\n            this.mColors = colors;\n\n            if (states && states.length > 0) {\n                this.mDefaultColor = colors[0];\n\n                for (let i = 0; i < states.length; i++) {\n                    if (states[i].length == 0) {\n                        this.mDefaultColor = colors[i];\n                    }\n                }\n            }\n        }\n\n        /**\n         * Creates or retrieves a ColorStateList that always returns a single color.\n         */\n        static valueOf(color:number):ColorStateList {\n            let ref = ColorStateList.sCache.get(color);\n            let csl = ref != null ? ref.get() : null;\n\n            if (csl != null) {\n                return csl;\n            }\n\n            csl = new ColorStateList(ColorStateList.EMPTY, [color]);\n            ColorStateList.sCache.put(color, new WeakReference<ColorStateList>(csl));\n            return csl;\n        }\n\n        /**\n         * Create a ColorStateList from an XML document, given a set of {@link Resources}.\n         */\n        static createFromXml(r:Resources, parser:HTMLElement):ColorStateList {\n            let colorStateList:ColorStateList;\n            let name = parser.tagName.toLowerCase();\n            if (name == \"selector\") {\n                //Fill in this object based on the contents of an XML \"selector\" element.\n                const stateSpecList:Array<Array<number>> = [];\n                const colorList:Array<number> = [];\n\n                for(let child of Array.from(parser.children)){\n                    let item = <HTMLElement>child;\n                    if(item.tagName.toLowerCase() !== 'item'){\n                        continue;\n                    }\n                    let alpha = 1.0;\n                    let color = 0xffff0000;\n                    let haveColor = false;\n                    let stateSpec:number[] = [];\n\n                    let typedArray = r.obtainAttributes(item);\n                    for(let attr of Array.from(item.attributes)){\n                        let attrName = attr.name;\n                        if(attrName === 'android:alpha'){\n                            alpha = typedArray.getFloat(attrName, alpha);\n\n                        }else if(attrName === 'android:color'){\n                            color = typedArray.getColor(attrName, color);\n                            haveColor = true;\n\n                        }else if(attrName.startsWith('android:state_')){\n                            let state = attrName.substring('android:state_'.length);\n                            let stateValue = android.view.View['VIEW_STATE_' + state.toUpperCase()];\n                            if(typeof stateValue === \"number\"){\n                                stateSpec.push(typedArray.getBoolean(attrName, true) ? stateValue : -stateValue);\n                            }\n                        }\n                    }\n\n                    if (!haveColor) {\n                        throw new Error(`<item> tag requires a 'android:color' attribute.`);\n                    }\n\n                    // Apply alpha modulation.\n                    let alphaMod = Math.floor(Color.alpha(color) * alpha);\n                    alphaMod = Math.min(alphaMod, 255);\n                    alphaMod = Math.max(alphaMod, 0);\n                    color = (color & 0xFFFFFF) | (alphaMod << 24);\n\n                    colorList.push(color);\n                    stateSpecList.push(stateSpec);\n                }\n                colorStateList = new ColorStateList(stateSpecList, colorList);\n\n            } else {\n                throw new Error(`XmlPullParserException(invalid drawable tag: ${name}`);\n            }\n\n            return colorStateList;\n        }\n\n        /**\n         * Creates a new ColorStateList that has the same states and\n         * colors as this one but where each color has the specified alpha value\n         * (0-255).\n         */\n        withAlpha(alpha:number):ColorStateList {\n            let colors = androidui.util.ArrayCreator.newNumberArray(this.mColors.length);\n\n            let len = colors.length;\n            for (let i = 0; i < len; i++) {\n                colors[i] = (this.mColors[i] & 0xFFFFFF) | (alpha << 24);\n            }\n\n            return new ColorStateList(this.mStateSpecs, colors);\n        }\n\n        isStateful():boolean {\n            return this.mStateSpecs.length > 1;\n        }\n\n        /**\n         * Return the color associated with the given set of {@link android.view.View} states.\n         *\n         * @param stateSet an array of {@link android.view.View} states\n         * @param defaultColor the color to return if there's not state spec in this\n         * {@link ColorStateList} that matches the stateSet.\n         *\n         * @return the color associated with that set of states in this {@link ColorStateList}.\n         */\n        getColorForState(stateSet:Array<number>, defaultColor:number):number {\n            const setLength = this.mStateSpecs.length;\n            for (let i = 0; i < setLength; i++) {\n                let stateSpec = this.mStateSpecs[i];\n                if (StateSet.stateSetMatches(stateSpec, stateSet)) {\n                    return this.mColors[i];\n                }\n            }\n            return defaultColor;\n        }\n\n        /**\n         * Return the default color in this {@link ColorStateList}.\n         *\n         * @return the default color in this {@link ColorStateList}.\n         */\n        getDefaultColor() {\n            return this.mDefaultColor;\n        }\n\n        toString() {\n            return \"ColorStateList{\" +\n                \"mStateSpecs=\" + JSON.stringify(this.mStateSpecs) +\n                \"mColors=\" + JSON.stringify(this.mColors) +\n                \"mDefaultColor=\" + this.mDefaultColor + '}';\n        }\n\n\n    }\n}"
  },
  {
    "path": "src/android/content/res/Resources.ts",
    "content": "/**\n * Created by linfaxin on 15/10/5.\n * Androidui's impl\n */\n///<reference path=\"../../util/DisplayMetrics.ts\"/>\n///<reference path=\"../../content/Context.ts\"/>\n///<reference path=\"../../graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../R/layout.ts\"/>\n///<reference path=\"TypedArray.ts\"/>\n\nmodule android.content.res{\n    import DisplayMetrics = android.util.DisplayMetrics;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Color = android.graphics.Color;\n    import SynchronizedPool = android.util.Pools.SynchronizedPool;\n    import ColorDrawable = android.graphics.drawable.ColorDrawable;\n\n    export class Resources{\n        private static instance = new Resources();\n        // Pool of TypedArrays targeted to this Resources object.\n        mTypedArrayPool:SynchronizedPool<TypedArray> = new SynchronizedPool<TypedArray>(5);\n\n        private displayMetrics:DisplayMetrics;\n        private context:Context;\n\n        //value set in app's R.ts\n        static _AppBuildImageFileFinder: (refString:string)=>Drawable = null;\n        static _AppBuildXmlFinder: (refString:string)=>HTMLElement = null;\n        static _AppBuildValueFinder: (refString:string)=>HTMLElement = null;\n\n        constructor(context?:Context) {\n            this.context = context;\n\n            // FIXME will memory leak (Activity ref with window)\n            window.addEventListener('resize', ()=>{\n                if(this.displayMetrics){\n                    this.fillDisplayMetrics(this.displayMetrics);\n                }\n            });\n        }\n\n        static getSystem():Resources {\n            return Resources.instance;\n        }\n\n        private static from(context:Context){\n            return context.getResources();\n        }\n\n        static getDisplayMetrics():DisplayMetrics {\n            return Resources.instance.getDisplayMetrics();\n        }\n\n        getDisplayMetrics():DisplayMetrics {\n            if(this.displayMetrics) return this.displayMetrics;\n            this.displayMetrics = new DisplayMetrics();\n            this.fillDisplayMetrics(this.displayMetrics);\n            return this.displayMetrics;\n        }\n        private fillDisplayMetrics(displayMetrics:DisplayMetrics){\n            let density = window.devicePixelRatio;\n\n            displayMetrics.xdpi = window.screen.deviceXDPI || DisplayMetrics.DENSITY_DEFAULT;\n            displayMetrics.ydpi = window.screen.deviceYDPI || DisplayMetrics.DENSITY_DEFAULT;\n            displayMetrics.density = density;\n            displayMetrics.densityDpi = density * DisplayMetrics.DENSITY_DEFAULT;\n            displayMetrics.scaledDensity = density;\n\n            let contentEle = this.context ? this.context.androidUI.androidUIElement : document.documentElement;\n            displayMetrics.widthPixels = contentEle.offsetWidth * density;\n            displayMetrics.heightPixels = contentEle.offsetHeight * density;\n        }\n\n        getDefStyle(refString:string):any {\n            if (refString === '@null') return null;\n            if(refString.startsWith('@android:attr/')){\n                refString = refString.substring('@android:attr/'.length);\n                return android.R.attr[refString];\n            }\n        }\n\n        /**\n         * @param refString @drawable/xxx, @android:drawable/xxx\n         */\n        getDrawable(refString:string):Drawable {\n            if (refString === '@null') return null;\n            if(refString.startsWith('@android:drawable/')){\n                refString = refString.substring('@android:drawable/'.length);\n                return android.R.drawable[refString] || android.R.image[refString];\n            }\n            if(refString.startsWith('@android:color/')){\n                refString = refString.substring('@android:color/'.length);\n                let color = android.R.color[refString];\n                if(color instanceof ColorStateList){\n                    color = (<ColorStateList>color).getDefaultColor();\n                }\n                return new ColorDrawable(color);\n            }\n\n            if(Resources._AppBuildImageFileFinder){\n                let drawable = Resources._AppBuildImageFileFinder(refString);\n                if(drawable) return drawable;\n            }\n\n            if(!refString.startsWith('@')){\n                refString = '@drawable/' + refString;\n            }\n            let ele = this.getXml(refString);\n            if(ele){\n                return Drawable.createFromXml(this, ele);\n            }\n            ele = this.getValue(refString);\n            if(ele){\n                let text = ele.innerText;\n                if(text.startsWith('@android:drawable/') || text.startsWith('@drawable/')) {\n                    return this.getDrawable(text);\n                }\n                if(text.startsWith('@android:color/') || text.startsWith('@color/')) {\n                    let color = this.getColor(text);\n                    return new ColorDrawable(color);\n                }\n                return Drawable.createFromXml(this, ele);\n            }\n\n            throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n        }\n\n\n        /**\n         * @param refString @color/xxx @android:color/xxx\n         */\n        getColor(refString:string):number {\n            if(refString.startsWith('@android:color/')){\n                refString = refString.substring('@android:color/'.length);\n                let color = android.R.color[refString];\n                if(color instanceof ColorStateList){\n                    color = (<ColorStateList>color).getDefaultColor();\n                }\n                return color;\n\n            }else{\n                if(!refString.startsWith('@color/')){\n                    refString = '@color/' + refString;\n                }\n                let ele = this.getValue(refString);\n                if(ele){\n                    let text = ele.innerText;\n                    if(text.startsWith('@android:color/') || text.startsWith('@color/')){\n                        return this.getColor(text);\n                    }\n                    return Color.parseColor(text);\n                }\n                ele = this.getXml(refString);\n                if(ele){\n                    let colorList = ColorStateList.createFromXml(this, ele);\n                    if(colorList) return colorList.getDefaultColor();\n                }\n            }\n\n            throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n        }\n\n        /**\n         * @param refString @color/xxx @android:color/xxx\n         */\n        getColorStateList(refString:string):ColorStateList {\n            if (refString === '@null') return null;\n            if(refString.startsWith('@android:color/')){\n                refString = refString.substring('@android:color/'.length);\n                let color = android.R.color[refString];\n                if(typeof color === \"number\"){\n                    color = ColorStateList.valueOf(color);\n                }\n                return color;\n\n            } else {\n                if(!refString.startsWith('@color/')){\n                    refString = '@color/' + refString;\n                }\n                let ele = this.getXml(refString);\n                if(ele){\n                    return ColorStateList.createFromXml(this, ele);\n                }\n                ele = this.getValue(refString);\n                if(ele){\n                    let text = ele.innerText;\n                    if(text.startsWith('@android:color/') || text.startsWith('@color/')){\n                        return this.getColorStateList(text);\n                    }\n                    return ColorStateList.valueOf(Color.parseColor(text));\n                }\n            }\n\n            throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n        }\n\n        /**\n         * Retrieve a dimensional for a particular resource reference.  Unit\n         * conversions are based on the current {@link DisplayMetrics} associated\n         * with the resources.\n         *\n         * @return Resource dimension value multiplied by the appropriate\n         * metric.\n         *\n         * @throws NotFoundException Throws NotFoundException if the given ID does not exist.\n         *\n         * @see #getDimensionPixelOffset\n         * @see #getDimensionPixelSize\n         */\n        getDimension(refString:string, baseValue=0): number {\n            if(!refString.startsWith('@dimen/')) refString = '@dimen/' + refString;\n            let ele = this.getValue(refString);\n            if(ele){\n                let text = ele.innerText;\n                return android.util.TypedValue.complexToDimension(text, baseValue, this.getDisplayMetrics());\n            }\n            throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n        }\n\n        /**\n         * Retrieve a dimensional for a particular resource reference for use\n         * as an offset in raw pixels.  This is the same as\n         * {@link #getDimension}, except the returned value is converted to\n         * integer pixels for you.  An offset conversion involves simply\n         * truncating the base value to an integer.\n         *\n         * @return Resource dimension value multiplied by the appropriate\n         * metric and truncated to integer pixels.\n         *\n         * @throws NotFoundException Throws NotFoundException if the given ID does not exist.\n         *\n         * @see #getDimension\n         * @see #getDimensionPixelSize\n         */\n        getDimensionPixelOffset(refString:string, baseValue=0): number {\n            if(!refString.startsWith('@dimen/')) refString = '@dimen/' + refString;\n            let ele = this.getValue(refString);\n            if(ele){\n                let text = ele.innerText;\n                return android.util.TypedValue.complexToDimensionPixelOffset(text, baseValue, this.getDisplayMetrics());\n            }\n            throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n        }\n\n        getDimensionPixelSize(refString:string, baseValue=0): number {\n            if(!refString.startsWith('@dimen/')) refString = '@dimen/' + refString;\n            let ele = this.getValue(refString);\n            if(ele){\n                let text = ele.innerText;\n                return android.util.TypedValue.complexToDimensionPixelSize(text, baseValue, this.getDisplayMetrics());\n            }\n            throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n        }\n\n        getBoolean(refString:string):boolean {\n            if(!refString.startsWith('@bool/')) refString = '@bool/' + refString;\n            let ele = this.getValue(refString);\n            if(ele){\n                let text = ele.innerText;\n                return text == 'true'\n            }\n            throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n        }\n\n        getInteger(refString:string):number {\n            if(!refString.startsWith('@integer/')) refString = '@integer/' + refString;\n            let ele = this.getValue(refString);\n            if(ele){\n                return parseInt(ele.innerText);\n            }\n            throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n        }\n\n        getIntArray(refString:string):number[] {\n            if(!refString.startsWith('@array/')) refString = '@array/' + refString;\n            let ele = this.getValue(refString);\n            if(ele){\n                let intArray:number[] = [];\n                for(let child of Array.from(ele.children)){\n                    intArray.push(parseInt((<HTMLElement>child).innerText));\n                }\n                return intArray;\n            }\n            throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n        }\n\n        getFloat(refString:string):number {\n            return this.getDimension(refString);\n        }\n\n        /**\n         * @param refString @string/xxx @android:string/xxx\n         */\n        getString(refString:string):string {\n            if(refString.startsWith('@android:string/')){\n                refString = refString.substring('@android:string/'.length);\n                return android.R.string_[refString];\n            }\n\n            if(!refString.startsWith('@string/')) refString = '@string/' + refString;\n            let ele = this.getValue(refString);\n            if(ele){\n                return ele.innerText;\n            }\n            throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n        }\n\n        /**\n         * @param refString @array/xxx @android:array/xxx\n         */\n        getStringArray(refString:string):string[] {\n            if(!refString.startsWith('@array/')) refString = '@array/' + refString;\n            let ele = this.getValue(refString);\n            if(ele){\n                let stringArray:string[] = [];\n                for(let child of Array.from(ele.children)){\n                    stringArray.push((<HTMLElement>child).innerText);\n                }\n                return stringArray;\n            }\n            throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n        }\n\n        /**\n         * @param refString @layout/xxx, @android:layout/xxx\n         */\n        getLayout(refString:string):HTMLElement {\n            if(!refString || !refString.trim().startsWith('@')) return null;\n            if (refString === '@null') return null;\n\n            if(refString.startsWith('@android:layout/')){\n                refString = refString.substring('@android:layout/'.length);\n                return android.R.layout.getLayoutData(refString);\n\n            }\n\n            if(!refString.startsWith('@layout/')) refString = '@layout/' + refString;\n            let ele = this.getXml(refString);\n            if(ele) return ele;\n            throw new Error(\"NotFoundException: Resource \" + refString + \" is not found\");\n        }\n\n        /**\n         * @param refString @anim/xxx, @android:anim/xxx\n         */\n        getAnimation(refString:string):android.view.animation.Animation {\n            if (refString === '@null') return null;\n            if(!refString || !refString.trim().startsWith('@')) return null;\n            if(refString.startsWith('@android:anim/')){\n                refString = refString.substring('@android:anim/'.length);\n                return android.R.anim[refString];\n            }\n            // if(refString.startsWith('@anim/')){\n            //     refString = refString.substring('@anim/'.length);\n            //     return window.R.anim[refString];\n            // }\n        }\n\n        private getStyleAsMap(refString:string):Map<string, string>{\n            if (refString === '@null') return null;\n            if(!refString.startsWith('@style/')){\n                refString = '@style/' + refString;\n            }\n            let styleMap = new Map<string, string>();\n\n            const parseStyle = (refString:string)=>{\n                let styleXml = this.getValue(refString);\n                if(!styleXml) return;\n                //merge attr 'parent'\n                let parent = styleXml.getAttribute('parent');\n                if(parent){\n                    if(!parent.startsWith('@style/')){\n                        parent = '@style/' + parent;\n                    }\n                    parseStyle(parent);\n                }\n\n                //merge attr name's parent\n                let styleName = refString.substring('@style/'.length);\n                if(styleName.includes('.')){\n                    let parts = styleName.split('.');\n                    parts.shift();\n                    let nameParent = parts.join('.');\n                    parseStyle('@style/' + nameParent);\n                }\n\n                for(let item of Array.from(styleXml.children)){\n                    let name = (<Element>item).getAttribute('name');\n                    if(name){\n                        styleMap.set(name, (<HTMLElement>item).innerText);\n                    }\n                }\n            };\n\n            parseStyle(refString);\n            return styleMap;\n        }\n\n        /**\n         * Return an Xml file through which you can read a generic XML\n         * resource for the given resource.\n         * @param refString @layout/xxx, @drawable/xxx, @color/xxx\n         */\n        getXml(refString:string):HTMLElement {\n            if (refString === '@null') return null;\n            if(Resources._AppBuildXmlFinder) return Resources._AppBuildXmlFinder(refString);\n        }\n\n        /**\n         * Return the raw data associated with a resource reference string.\n         * @param refString @string/xxx, @color/xxx, @array/xxx, ...\n         * @param resolveRefs If true, a resource that is a reference to another\n         *                    resource will be followed so that you receive the\n         *                    actual final resource data.  If false, the TypedValue\n         *                    will be filled in with the reference itself.\n         */\n        getValue(refString:string, resolveRefs=true):HTMLElement {\n            if (refString === '@null') return null;\n            if(Resources._AppBuildValueFinder){\n                let ele = Resources._AppBuildValueFinder(refString);\n                if(!ele) return null;\n                if(resolveRefs && ele.children.length==0){\n                    let str = ele.innerText;\n                    if(str.startsWith('@')){\n                        return this.getValue(refString, true) || ele;\n                    }\n                }\n                return ele;\n            }\n        }\n\n\n\n        /**\n         * Retrieve a set of basic attribute values from an AttributeSet, not\n         * performing styling of them using a theme and/or style resources.\n         *\n         * @param attrs The specific attributes to be retrieved.\n         * @return Returns a TypedArray holding an array of the attribute values.\n         * Be sure to call {@link TypedArray#recycle() TypedArray.recycle()}\n         * when done with it.\n         *\n         * @see Theme#obtainStyledAttributes(AttributeSet, int[], int, int)\n         */\n        public obtainAttributes(attrs:HTMLElement):TypedArray {\n            return TypedArray.obtain(this, attrs);\n        }\n        /**\n         * Retrieve styled attribute information.\n         */\n        public obtainStyledAttributes(attrs:HTMLElement, defStyleAttr:Map<string, string>):TypedArray {\n            return TypedArray.obtain(this, attrs, defStyleAttr);\n        }\n\n    }\n}"
  },
  {
    "path": "src/android/content/res/TypedArray.ts",
    "content": "/*\n * Copyright (C) 2008 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../androidui/attr/AttrValueParser.ts\"/>\n\nmodule android.content.res {\n\n    import DisplayMetrics = android.util.DisplayMetrics;\n    import Color = android.graphics.Color;\n    import TypedValue = android.util.TypedValue;\n    import Drawable = android.graphics.drawable.Drawable;\n    import ColorDrawable = android.graphics.drawable.ColorDrawable;\n    import AttrValueParser = androidui.attr.AttrValueParser;\n\n    /**\n     * Container for an array of values that were retrieved with\n     * {@link Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int)}\n     * or {@link Resources#obtainAttributes}.  Be\n     * sure to call {@link #recycle} when done with them.\n     *\n     * The indices used to retrieve values from this structure correspond to\n     * the positions of the attributes given to obtainStyledAttributes.\n     */\n    export class TypedArray {\n\n        static obtain(res:android.content.res.Resources, xml:HTMLElement, defStyleAttr?:Map<string, string>):TypedArray {\n            const attrMap = new Map<string, string>();\n            if (defStyleAttr) {\n                for(let [key, value] of defStyleAttr.entries()) {\n                    attrMap.set(key.toLowerCase(), value); // lower case like dom's attribute\n                }\n            }\n            if (xml) {\n                const refStyleString = xml.getAttribute('android:style');\n                if (refStyleString) {\n                    const map = res.getStyleAsMap(refStyleString);\n                    if (map) {\n                        for(let [key, value] of map.entries()) {\n                            attrMap.set(key.toLowerCase(), value);\n                        }\n                    }\n                }\n                for (let attr of Array.from(xml.attributes)) {\n                    const name = attr.name;\n                    if (name === 'android:style' || name === 'style') continue;\n                    attrMap.set(name, attr.value);\n                }\n            }\n\n            const attrs = res.mTypedArrayPool.acquire();\n            if (attrs != null) {\n                attrs.mRecycled = false;\n                attrs.attrMap = attrMap;\n                attrs.attrMapKeysCache = [];\n                return attrs;\n            }\n            return new TypedArray(res, attrMap);\n        }\n\n        private mResources:android.content.res.Resources;\n        private attrMap:Map<string, string>;\n        private attrMapKeysCache:string[];\n        private mRecycled:boolean;\n\n        constructor(res:android.content.res.Resources, attrMap:Map<string, string>) {\n            this.mResources = res;\n            this.attrMap = attrMap;\n        }\n\n        private checkRecycled():void {\n            if (this.mRecycled) {\n                throw new Error(\"RuntimeException : Cannot make calls to a recycled instance!\");\n            }\n        }\n\n        /**\n         * Return the number of values in this array.\n         */\n        public length():number {\n            this.checkRecycled();\n            if (!this.attrMap) return 0;\n            return this.attrMap.size;\n        }\n\n        /**\n         * Return the attrName for the the index in this array.\n         * AndroidUIX Deprecated: please use {@link #getLowerCaseNoNamespaceAttrNames} to traverse the attrNames\n         * @deprecated\n         */\n        public getIndex(keyIndex:number):string {\n            if (!this.attrMapKeysCache) {\n                this.attrMapKeysCache = Array.from(this.attrMap.keys());\n            }\n            return this.attrMapKeysCache[keyIndex];\n        }\n\n        public getLowerCaseNoNamespaceAttrNames():Array<string> {\n            const keys = [];\n            for(let key of this.attrMap.keys()) {\n                keys.push(key.split(':').pop());\n            }\n            return keys;\n        }\n\n        /**\n         * Return the Resources object this array was loaded from.\n         */\n        public getResources():android.content.res.Resources {\n            return this.mResources;\n        }\n\n        public getAttrValue(attrName:string):string {\n            const name = attrName.toLowerCase();\n            return this.attrMap && (this.attrMap.get(name) || this.attrMap.get('android:' + name));\n        }\n\n        public getResourceId(attrName:string, defaultResourceId:string):string {\n            if (this.hasValueOrEmpty(attrName)) {\n                return this.getAttrValue(attrName);\n            }\n            return defaultResourceId;\n        }\n\n        /**\n         * Retrieve the styled string value for the attribute at <var>index</var>.\n         *\n         * @param attrName attr name.\n         *\n         * @return CharSequence holding string data.  May be styled.  Returns\n         *         null if the attribute is not defined.\n         */\n        public getText(attrName:string):string {\n            return this.getString(attrName);\n        }\n\n        /**\n         * Retrieve the string value for the attribute at <var>index</var>.\n         *\n         * @param attrName attr name.\n         *\n         * @return String holding string data.  Any styling information is\n         * removed.  Returns null if the attribute is not defined.\n         */\n        public getString(attrName:string):string {\n            this.checkRecycled();\n            let value = this.getAttrValue(attrName);\n            return AttrValueParser.parseString(this.mResources, value, value);\n        }\n\n\n        /**\n         * Retrieve the boolean value for the attribute at <var>index</var>.\n         *\n         * @param attrName attr name.\n         * @param defValue Value to return if the attribute is not defined.\n         *\n         * @return Attribute boolean value, or defValue if not defined.\n         */\n        public getBoolean(attrName:string, defValue:boolean):boolean {\n            this.checkRecycled();\n            let value = this.getAttrValue(attrName);\n            return AttrValueParser.parseBoolean(this.mResources, value, defValue);\n        }\n\n        /**\n         * Retrieve the integer value for the attribute at <var>index</var>.\n         *\n         * @param attrName attr name.\n         * @param defValue Value to return if the attribute is not defined.\n         *\n         * @return Attribute int value, or defValue if not defined.\n         */\n        public getInt(attrName:string, defValue:number):number {\n            this.checkRecycled();\n            let value = this.getAttrValue(attrName);\n            return AttrValueParser.parseInt(this.mResources, value, defValue);\n        }\n\n\n        /**\n         * Retrieve the float value for the attribute at <var>index</var>.\n         *\n         * @param attrName attr name.\n         * @param defValue Value to return if the attribute is not defined.\n         *\n         * @return Attribute float value, or defValue if not defined..\n         */\n        public getFloat(attrName:string, defValue:number):number {\n            this.checkRecycled();\n            let value = this.getAttrValue(attrName);\n            return AttrValueParser.parseFloat(this.mResources, value, defValue);\n        }\n\n        /**\n         * Retrieve the color value for the attribute at <var>index</var>.  If\n         * the attribute references a color resource holding a complex\n         * {@link android.content.res.ColorStateList}, then the default color from\n         * the set is returned.\n         *\n         * @param attrName attr name.\n         * @param defValue Value to return if the attribute is not defined or\n         *                 not a resource.\n         *\n         * @return Attribute color value, or defValue if not defined.\n         */\n        public getColor(attrName:string, defValue:number):number {\n            this.checkRecycled();\n            let value = this.getAttrValue(attrName);\n            return AttrValueParser.parseColor(this.mResources, value, defValue);\n        }\n\n        /**\n         * Retrieve the ColorStateList for the attribute at <var>index</var>.\n         * The value may be either a single solid color or a reference to\n         * a color or complex {@link android.content.res.ColorStateList} description.\n         *\n         * @param attrName attr name.\n         *\n         * @return ColorStateList for the attribute, or null if not defined.\n         */\n        public getColorStateList(attrName:string):android.content.res.ColorStateList {\n            this.checkRecycled();\n            let value = this.getAttrValue(attrName);\n            return AttrValueParser.parseColorStateList(this.mResources, value);\n        }\n\n        /**\n         * Retrieve the integer value for the attribute at <var>index</var>.\n         *\n         * @param attrName attr name.\n         * @param defValue Value to return if the attribute is not defined.\n         *\n         * @return Attribute int value, or defValue if not defined.\n         */\n        public getInteger(attrName:string, defValue:number):number {\n            return this.getInt(attrName, defValue);\n        }\n\n        public getLayoutDimension(attrName:string, defValue:number):number {\n            this.checkRecycled();\n            let value = this.getAttrValue(attrName);\n            if (value === 'wrap_content') return -2;\n            if (value === 'fill_parent' || value === 'match_parent') return -1;\n            return AttrValueParser.parseDimension(this.mResources, value, defValue);\n        }\n\n        /**\n         * Retrieve a dimensional unit attribute at <var>index</var>.  Unit\n         * conversions are based on the current {@link DisplayMetrics}\n         * associated with the resources this {@link TypedArray} object\n         * came from.\n         *\n         * @param attrName attr name.\n         * @param defValue Value to return if the attribute is not defined or\n         *                 not a resource.\n         *\n         * @return Attribute dimension value multiplied by the appropriate\n         * metric, or defValue if not defined.\n         *\n         * @see #getDimensionPixelOffset\n         * @see #getDimensionPixelSize\n         */\n        public getDimension(attrName:string, defValue:number):number {\n            this.checkRecycled();\n            let value = this.getAttrValue(attrName);\n            return AttrValueParser.parseDimension(this.mResources, value, defValue);\n        }\n\n        /**\n         * Retrieve a dimensional unit attribute at <var>index</var> for use\n         * as an offset in raw pixels.  This is the same as\n         * {@link #getDimension}, except the returned value is converted to\n         * integer pixels for you.  An offset conversion involves simply\n         * truncating the base value to an integer.\n         *\n         * @param attrName attr name.\n         * @param defValue Value to return if the attribute is not defined or\n         *                 not a resource.\n         *\n         * @return Attribute dimension value multiplied by the appropriate\n         * metric and truncated to integer pixels, or defValue if not defined.\n         *\n         * @see #getDimension\n         * @see #getDimensionPixelSize\n         */\n        public getDimensionPixelOffset(attrName:string, defValue:number):number {\n            this.checkRecycled();\n            let value = this.getAttrValue(attrName);\n            return AttrValueParser.parseDimensionPixelOffset(this.mResources, value, defValue);\n        }\n\n\n        /**\n         * Retrieve a dimensional unit attribute at <var>index</var> for use\n         * as a size in raw pixels.  This is the same as\n         * {@link #getDimension}, except the returned value is converted to\n         * integer pixels for use as a size.  A size conversion involves\n         * rounding the base value, and ensuring that a non-zero base value\n         * is at least one pixel in size.\n         *\n         * @param attrName attr name.\n         * @param defValue Value to return if the attribute is not defined or\n         *                 not a resource.\n         *\n         * @return Attribute dimension value multiplied by the appropriate\n         * metric and truncated to integer pixels, or defValue if not defined.\n         *\n         * @see #getDimension\n         * @see #getDimensionPixelOffset\n         */\n        public getDimensionPixelSize(attrName:string, defValue:number):number {\n            this.checkRecycled();\n            let value = this.getAttrValue(attrName);\n            return AttrValueParser.parseDimensionPixelSize(this.mResources, value, defValue);\n        }\n\n        /**\n         * Retrieve the Drawable for the attribute at <var>index</var>.\n         *\n         * @param attrName attr name.\n         *\n         * @return Drawable for the attribute, or null if not defined.\n         */\n        public getDrawable(attrName:string):Drawable {\n            this.checkRecycled();\n            let value = this.getAttrValue(attrName);\n            return AttrValueParser.parseDrawable(this.mResources, value);\n        }\n\n        /**\n         * Retrieve the CharSequence[] for the attribute at <var>index</var>.\n         * This gets the resource ID of the selected attribute, and uses\n         * {@link Resources#getTextArray Resources.getTextArray} of the owning\n         * Resources object to retrieve its String[].\n         *\n         * @param attrName attr name.\n         *\n         * @return CharSequence[] for the attribute, or null if not defined.\n         */\n        public getTextArray(attrName:string):string[] {\n            this.checkRecycled();\n            let value = this.getAttrValue(attrName);\n            return AttrValueParser.parseTextArray(this.mResources, value);\n        }\n\n        /**\n         * Determines whether there is an attribute at <var>index</var>.\n         * <p>\n         * <strong>Note:</strong> If the attribute was set to {@code @empty} or\n         * {@code @undefined}, this method returns {@code false}.\n         *\n         * @param attrName attr name.\n         *\n         * @return True if the attribute has a value, false otherwise.\n         */\n        public hasValue(attrName:string):boolean {\n            this.checkRecycled();\n            return this.getAttrValue(attrName) != null;\n        }\n\n\n        /**\n         * Determines whether there is an attribute at <var>index</var>, returning\n         * {@code true} if the attribute was explicitly set to {@code @empty} and\n         * {@code false} only if the attribute was undefined.\n         *\n         * @param attrName attr name.\n         *\n         * @return True if the attribute has a value or is empty, false otherwise.\n         */\n        public hasValueOrEmpty(attrName:string):boolean {\n            this.checkRecycled();\n            const name = attrName.toLowerCase();\n            return this.attrMap && (this.attrMap.has(name) || this.attrMap.has('android:' + name));\n        }\n\n\n        /**\n         * Recycle the TypedArray, to be re-used by a later caller. After calling\n         * this function you must not ever touch the typed array again.\n         */\n        public recycle():void {\n            this.mRecycled = true;\n            this.attrMap = null;\n            this.attrMapKeysCache = null;\n            this.mResources.mTypedArrayPool.release(this);\n        }\n\n    }\n}"
  },
  {
    "path": "src/android/database/DataSetObservable.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"Observable.ts\"/>\n///<reference path=\"DataSetObserver.ts\"/>\n///<reference path=\"../../java/util/ArrayList.ts\"/>\n\nmodule android.database{\n    import ArrayList = java.util.ArrayList;\n    import Observable = android.database.Observable;\n    import DataSetObserver = android.database.DataSetObserver;\n\n    /**\n     * A specialization of {@link Observable} for {@link DataSetObserver}\n     * that provides methods for sending notifications to a list of\n     * {@link DataSetObserver} objects.\n     */\n    export class DataSetObservable extends Observable<DataSetObserver>{\n        /**\n         * Invokes {@link DataSetObserver#onChanged} on each observer.\n         * Called when the contents of the data set have changed.  The recipient\n         * will obtain the new contents the next time it queries the data set.\n         */\n        notifyChanged():void {\n            // to avoid such problems, just march thru the list in the reverse order.\n            for (let i = this.mObservers.size() - 1; i >= 0; i--) {\n                this.mObservers.get(i).onChanged();\n            }\n        }\n        /**\n         * Invokes {@link DataSetObserver#onInvalidated} on each observer.\n         * Called when the data set is no longer valid and cannot be queried again,\n         * such as when the data set has been closed.\n         */\n        notifyInvalidated():void {\n            for (let i = this.mObservers.size() - 1; i >= 0; i--) {\n                this.mObservers.get(i).onInvalidated();\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/android/database/DataSetObserver.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule android.database{\n    export class DataSetObserver {\n        /**\n         * This method is called when the entire data set has changed,\n         * most likely through a call to {@link Cursor#requery()} on a {@link Cursor}.\n         */\n        onChanged():void {\n            // Do nothing\n        }\n\n        /**\n         * This method is called when the entire data becomes invalid,\n         * most likely through a call to {@link Cursor#deactivate()} or {@link Cursor#close()} on a\n         * {@link Cursor}.\n         */\n        onInvalidated():void {\n            // Do nothing\n        }\n    }\n}"
  },
  {
    "path": "src/android/database/Observable.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../java/util/ArrayList.ts\"/>\n\nmodule android.database{\n    import ArrayList = java.util.ArrayList;\n\n    /**\n     * Provides methods for registering or unregistering arbitrary observers in an {@link ArrayList}.\n     *\n     * This abstract class is intended to be subclassed and specialized to maintain\n     * a registry of observers of specific types and dispatch notifications to them.\n     *\n     * @param T The observer type.\n     */\n    export abstract class Observable<T>{\n        /**\n         * The list of observers.  An observer can be in the list at most\n         * once and will never be null.\n         */\n        protected mObservers = new ArrayList<T>()\n\n        /**\n         * Adds an observer to the list. The observer cannot be null and it must not already\n         * be registered.\n         * @param observer the observer to register\n         * @throws IllegalArgumentException the observer is null\n         * @throws IllegalStateException the observer is already registered\n         */\n        registerObserver(observer:T):void {\n            if (observer == null) {\n                throw new Error(\"The observer is null.\");\n            }\n            if (this.mObservers.contains(observer)) {\n                throw new Error(\"Observer \" + observer + \" is already registered.\");\n            }\n            this.mObservers.add(observer);\n        }\n\n        /**\n         * Removes a previously registered observer. The observer must not be null and it\n         * must already have been registered.\n         * @param observer the observer to unregister\n         * @throws IllegalArgumentException the observer is null\n         * @throws IllegalStateException the observer is not yet registered\n         */\n        unregisterObserver(observer:T) {\n            if (observer == null) {\n                throw new Error(\"The observer is null.\");\n            }\n            let index = this.mObservers.indexOf(observer);\n            if (index == -1) {\n                throw new Error(\"Observer \" + observer + \" was not registered.\");\n            }\n            this.mObservers.remove(index);\n        }\n\n        /**\n         * Remove all registered observers.\n         */\n        unregisterAll():void {\n            this.mObservers.clear();\n        }\n    }\n}"
  },
  {
    "path": "src/android/graphics/Canvas.ts",
    "content": "/**\n * Created by linfaxin on 15/10/13.\n * AndroidUI's Canvas impl. will draw to web <canvas> in browser, and will replace by NativeCanvas in native.\n */\n\n///<reference path=\"../util/Pools.ts\"/>\n///<reference path=\"../util/Log.ts\"/>\n///<reference path=\"Rect.ts\"/>\n///<reference path=\"Color.ts\"/>\n///<reference path=\"Paint.ts\"/>\n///<reference path=\"Path.ts\"/>\n///<reference path=\"Matrix.ts\"/>\n///<reference path=\"../../androidui/image/NetImage.ts\"/>\n\nmodule android.graphics {\n    import Pools = android.util.Pools;\n    import Log = android.util.Log;\n    import Rect = android.graphics.Rect;\n    import Color = android.graphics.Color;\n    import NetImage = androidui.image.NetImage;\n\n    /**\n     * The Canvas class holds the \"draw\" calls. To draw something, you need\n     * 4 basic components: A Bitmap to hold the pixels, a Canvas to host\n     * the draw calls (writing into the bitmap), a drawing primitive (e.g. Rect,\n     * Path, text, Bitmap), and a paint (to describe the colors and styles for the\n     * drawing).\n     *\n     * <div class=\"special reference\">\n     * <h3>Developer Guides</h3>\n     * <p>For more information about how to use Canvas, read the\n     * <a href=\"{@docRoot}guide/topics/graphics/2d-graphics.html\">\n     * Canvas and Drawables</a> developer guide.</p></div>\n     */\n    export class Canvas {\n        protected mCanvasElement:HTMLCanvasElement;\n        private mWidth = 0;\n        private mHeight = 0;\n        private _mCanvasContent:CanvasRenderingContext2D;\n        private _saveCount = 0;\n        protected mCurrentClip:Rect;\n        private mClipStateMap = new Map<number, Rect>();\n        protected static TempMatrixValue = androidui.util.ArrayCreator.newNumberArray(9);\n\n\n        /**\n         * Flag for drawTextRun indicating left-to-right run direction.\n         * @hide\n         */\n        static DIRECTION_LTR = 0;\n\n        /**\n         * Flag for drawTextRun indicating right-to-left run direction.\n         * @hide\n         */\n        static DIRECTION_RTL = 1;\n\n\n        private static sRectPool = new Pools.SynchronizedPool<Rect>(20);\n        private static obtainRect(copy?:Rect):Rect {\n            let rect = Canvas.sRectPool.acquire();\n            if(!rect) rect = new Rect();\n            if(copy) rect.set(copy);\n            return rect;\n        }\n        private static recycleRect(rect:Rect) {\n                rect.setEmpty();\n                Canvas.sRectPool.release(rect);\n        }\n\n        constructor(width:number, height:number) {\n            this.mWidth = width;\n            this.mHeight = height;\n            this.mCurrentClip = Canvas.obtainRect();\n            this.mCurrentClip.set(0, 0, this.mWidth, this.mHeight);\n            this.initCanvasImpl();\n        }\n\n        protected initCanvasImpl():void {\n            this.mCanvasElement = document.createElement(\"canvas\");\n            this.mCanvasElement.width = this.mWidth;\n            this.mCanvasElement.height = this.mHeight;\n            this._mCanvasContent = this.mCanvasElement.getContext(\"2d\");\n            this.save();//is need?\n        }\n\n        recycle():void {\n            Canvas.recycleRect(this.mCurrentClip);\n            for(let rect of this.mClipStateMap.values()) {\n                Canvas.recycleRect(rect);\n            }\n            this.recycleImpl();\n        }\n        protected recycleImpl():void {\n            if(this.mCanvasElement) this.mCanvasElement.width = this.mCanvasElement.height = 0;\n        }\n\n        public getHeight():number {\n            return this.mHeight;\n        }\n\n        public getWidth():number {\n            return this.mWidth;\n        }\n\n        public isNativeAccelerated():boolean{\n            return false;\n        }\n\n        translate(dx:number, dy:number):void {\n            if(dx==0 && dy==0) return;\n            if(this.mCurrentClip) this.mCurrentClip.offset(-dx, -dy);\n            this.translateImpl(dx, dy);\n        }\n        protected translateImpl(dx:number, dy:number):void {\n            this._mCanvasContent.translate(dx, dy);\n        }\n\n\n        scale(sx:number, sy:number, px?:number, py?:number):void {\n            //TODO effect mCurrentClip\n            if (px || py) this.translate(px, py);\n            this.scaleImpl(sx, sy);\n            if (px || py) this.translate(-px, -py);\n        }\n\n        protected scaleImpl(sx:number, sy:number):void {\n            this._mCanvasContent.scale(sx, sy);\n        }\n\n        rotate(degrees:number, px?:number, py?:number):void {\n            //TODO effect mCurrentClip\n            if (px || py) this.translate(px, py);\n            this.rotateImpl(degrees);\n            if (px || py) this.translate(-px, -py);\n        }\n\n        protected rotateImpl(degrees:number):void {\n            this._mCanvasContent.rotate(degrees*Math.PI/180);\n        }\n\n        concat(m:android.graphics.Matrix):void {\n            //TODO effect mCurrentClip\n            let v = Canvas.TempMatrixValue;\n            m.getValues(v);\n            this.concatImpl(v[Matrix.MSCALE_X], v[Matrix.MSKEW_X], v[Matrix.MTRANS_X], v[Matrix.MSKEW_Y], v[Matrix.MSCALE_Y],\n                v[Matrix.MTRANS_Y], v[Matrix.MPERSP_0], v[Matrix.MPERSP_1], v[Matrix.MPERSP_2]);\n        }\n        protected concatImpl(MSCALE_X:number, MSKEW_X:number, MTRANS_X:number, MSKEW_Y:number, MSCALE_Y:number,\n                             MTRANS_Y:number, MPERSP_0:number, MPERSP_1:number, MPERSP_2:number){\n            this._mCanvasContent.transform(MSCALE_X, -MSKEW_X, -MSKEW_Y, MSCALE_Y, MTRANS_X, MTRANS_Y);\n        }\n\n        drawRGB(r:number, g:number, b:number):void {\n            this.drawARGB(255, r, g, b);\n        }\n\n        drawARGB(a:number, r:number, g:number, b:number):void {\n            this.drawARGBImpl(a, r, g, b);\n        }\n\n        drawColor(color:number){\n            this.drawARGB(Color.alpha(color), Color.red(color), Color.green(color), Color.blue(color));\n        }\n\n        protected drawARGBImpl(a:number, r:number, g:number, b:number):void {\n            let preStyle = this._mCanvasContent.fillStyle;\n            this._mCanvasContent.fillStyle = `rgba(${r},${g},${b},${a/255})`;\n            this._mCanvasContent.fillRect(this.mCurrentClip.left, this.mCurrentClip.top, this.mCurrentClip.width(), this.mCurrentClip.height());\n            this._mCanvasContent.fillStyle = preStyle;\n        }\n\n        clearColor():void {\n            this.clearColorImpl();\n        }\n\n        protected clearColorImpl():void {\n            this._mCanvasContent.clearRect(this.mCurrentClip.left, this.mCurrentClip.top, this.mCurrentClip.width(), this.mCurrentClip.height());\n        }\n\n        save():number {\n            this.saveImpl();\n            if(this.mCurrentClip) this.mClipStateMap.set(this._saveCount, Canvas.obtainRect(this.mCurrentClip));\n            this._saveCount++;\n\n            return this._saveCount;\n        }\n\n        protected saveImpl():void {\n            this._mCanvasContent.save();\n        }\n\n        restore() {\n            this._saveCount--;\n            this.restoreImpl();\n            let savedClip = this.mClipStateMap.get(this._saveCount);\n            if(savedClip){\n                this.mClipStateMap.delete(this._saveCount);\n                this.mCurrentClip.set(savedClip);\n                Canvas.recycleRect(savedClip);\n            }\n        }\n        protected restoreImpl():void {\n            this._mCanvasContent.restore();\n        }\n\n        restoreToCount(saveCount:number) {\n            if (saveCount <= 0) throw Error('saveCount can\\'t <= 0');\n            while (saveCount <= this._saveCount) {\n                this.restore();\n            }\n        }\n\n        getSaveCount():number {\n            return this._saveCount;\n        }\n\n        clipRect(rect:Rect):boolean;\n        clipRect(left:number, top:number, right:number, bottom:number):boolean;\n        clipRect(left:number, top:number, right:number, bottom:number, radiusTopLeft:number, radiusTopRight:number, radiusBottomRight:number, radiusBottomLeft:number):boolean;\n        clipRect(...args):boolean {\n            let rect = Canvas.obtainRect();\n\n            if (args.length === 1) {\n                rect.set(args[0]);\n\n            }else {\n                let [left=0, t=0, right=0, bottom=0] = args;\n                rect.set(left, t, right, bottom);\n            }\n\n            if(args.length === 4 || (!args[4] && !args[5] && !args[6] && !args[7])){\n                this.clipRectImpl(Math.floor(rect.left), Math.floor(rect.top), Math.ceil(rect.width()), Math.ceil(rect.height()));\n\n            }else if(args.length===8 && (args[4]!=0 || args[5]!= 0 || args[6]!=0 || args[7]!=0)){\n                this.clipRoundRectImpl(Math.floor(rect.left), Math.floor(rect.top), Math.ceil(rect.width()), Math.ceil(rect.height()),\n                    args[4], args[5], args[6], args[7]);\n            }\n\n            this.mCurrentClip.intersect(rect);\n\n            let r = rect.isEmpty();\n            Canvas.recycleRect(rect);\n            return r;\n        }\n\n        protected clipRectImpl(left:number, top:number, width:number, height:number):void {\n            this._mCanvasContent.beginPath();\n            this._mCanvasContent.rect(left, top, width, height);\n            this._mCanvasContent.clip();\n        }\n\n        clipRoundRect(r:Rect, radiusTopLeft:number, radiusTopRight:number, radiusBottomRight:number, radiusBottomLeft:number):boolean{\n            let rect = Canvas.obtainRect(r);\n\n            this.clipRoundRectImpl(Math.floor(rect.left), Math.floor(rect.top), Math.ceil(rect.width()), Math.ceil(rect.height()),\n                radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft);\n            this.mCurrentClip.intersect(rect);\n\n            let empty = rect.isEmpty();\n            Canvas.recycleRect(rect);\n            return empty;\n\n        }\n        protected clipRoundRectImpl(left:number, top:number, width:number, height:number, radiusTopLeft:number,\n                                    radiusTopRight:number, radiusBottomRight:number, radiusBottomLeft:number):void {\n            this.doRoundRectPath(left, top, width, height, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft);\n            this._mCanvasContent.clip();\n        }\n\n        private doRoundRectPath(left:number, top:number, width:number, height:number, radiusTopLeft:number,\n                                radiusTopRight:number, radiusBottomRight:number, radiusBottomLeft:number):void{\n\n            let scale1 = height / (radiusTopLeft + radiusBottomLeft);\n            let scale2 = height / (radiusTopRight + radiusBottomRight);\n            let scale3 = width / (radiusTopLeft + radiusTopRight);\n            let scale4 = width / (radiusBottomLeft + radiusBottomRight);\n            let scale = Math.min(scale1, scale2, scale3, scale4);\n            if(scale<1) {\n                radiusTopLeft *= scale;\n                radiusTopRight *= scale;\n                radiusBottomRight *= scale;\n                radiusBottomLeft *= scale;\n            }\n\n            let ctx = this._mCanvasContent;\n            ctx.beginPath();\n            ctx.moveTo(left+radiusTopLeft, top);\n            ctx.arcTo(left+width, top, left+width, top+radiusTopRight, radiusTopRight);\n            ctx.arcTo(left+width, top+height, left+width-radiusBottomRight, top+height, radiusBottomRight);\n            ctx.arcTo(left, top+height, left, top+height-radiusBottomLeft, radiusBottomLeft);\n            ctx.arcTo(left, top, left+radiusTopLeft, top, radiusTopLeft);\n\n            ctx.closePath();\n        }\n\n\n        getClipBounds(bounds?:Rect):Rect {\n            if (!this.mCurrentClip) this.mCurrentClip = Canvas.obtainRect();\n            let rect = bounds || Canvas.obtainRect();\n            rect.set(this.mCurrentClip);\n            return rect;\n        }\n\n        quickReject(rect:Rect):boolean;\n        quickReject(left:number, top:number, right:number, bottom:number):boolean;\n        quickReject(...args):boolean {\n            if (!this.mCurrentClip) return false;\n            if (args.length == 1) {\n                return !this.mCurrentClip.intersects(<Rect>args[0]);\n            } else {\n                let [left=0, t=0, right=0, bottom=0] = args;\n                return !this.mCurrentClip.intersects(left, t, right, bottom);\n            }\n        }\n\n        drawCanvas(canvas:Canvas, offsetX=0, offsetY=0):void {\n            this.drawCanvasImpl(canvas, offsetX, offsetY);\n        }\n\n        protected drawCanvasImpl(canvas:Canvas, offsetX:number, offsetY:number):void {\n            this._mCanvasContent.drawImage(canvas.mCanvasElement, offsetX, offsetY);\n        }\n\n        drawImage(image:NetImage, srcRect?:Rect, dstRect?:Rect, paint?:Paint):void {\n            let paintEmpty = !paint || paint.isEmpty();\n            if(!paintEmpty){\n                this.saveImpl();\n                paint.applyToCanvas(this);\n            }\n\n            this.drawImageImpl(image, srcRect, dstRect);\n\n            if(!paintEmpty) this.restoreImpl();\n        }\n\n        protected drawImageImpl(image:NetImage, srcRect?:Rect, dstRect?:Rect):void {\n            if(!dstRect){\n                if(!srcRect){\n                    this._mCanvasContent.drawImage(image.browserImage, 0, 0);\n                }else{\n                    this._mCanvasContent.drawImage(image.browserImage,\n                        srcRect.left, srcRect.top, srcRect.width(), srcRect.height(),\n                        0, 0, srcRect.width(), srcRect.height()\n                        // 0, 0, image.browserImage.width, image.browserImage.height\n                    );\n                }\n\n            }else{\n                if(dstRect.isEmpty()) return;\n                if(!srcRect){\n                    this._mCanvasContent.drawImage(image.browserImage, dstRect.left, dstRect.top, dstRect.width(), dstRect.height());\n                }else{\n                    this._mCanvasContent.drawImage(image.browserImage,\n                        srcRect.left, srcRect.top, srcRect.width(), srcRect.height(),\n                        dstRect.left, dstRect.top, dstRect.width(), dstRect.height()\n                    );\n                }\n            }\n        }\n\n        drawRect(rect:Rect, paint:Paint);\n        drawRect(left:number, top:number, right:number, bottom:number, paint:Paint);\n        drawRect(...args) {\n            if (args.length == 2) {\n                let rect:Rect = args[0];\n                this.drawRect(rect.left, rect.top, rect.right, rect.bottom, args[1]);\n            } else {\n                let [left, top, right, bottom, paint] = args;\n                let paintEmpty = !paint || paint.isEmpty();\n                if(!paintEmpty){\n                    this.saveImpl();\n                    paint.applyToCanvas(this);\n                }\n                let style = paint ? paint.getStyle() : Paint.Style.FILL;\n                this.drawRectImpl(left, top, right-left, bottom-top, style);\n                if(!paintEmpty) this.restoreImpl();\n            }\n        }\n\n        protected drawRectImpl(left:number, top:number, width:number, height:number, style:Paint.Style){\n            switch (style){\n                case Paint.Style.STROKE:\n                    this._mCanvasContent.strokeRect(left, top, width, height);\n                    break;\n                case Paint.Style.FILL_AND_STROKE:\n                    this._mCanvasContent.fillRect(left, top, width, height);\n                    this._mCanvasContent.strokeRect(left, top, width, height);\n                    break;\n                case Paint.Style.FILL:\n                default :\n                    this._mCanvasContent.fillRect(left, top, width, height);\n                    break;\n            }\n        }\n\n        private applyFillOrStrokeToContent(style:Paint.Style){\n            switch (style){\n                case Paint.Style.STROKE:\n                    this._mCanvasContent.stroke();\n                    break;\n                case Paint.Style.FILL_AND_STROKE:\n                    this._mCanvasContent.fill();\n                    this._mCanvasContent.stroke();\n                    break;\n                case Paint.Style.FILL:\n                default :\n                    this._mCanvasContent.fill();\n                    break;\n            }\n        }\n\n        /**\n         * Draw the specified oval using the specified paint. The oval will be\n         * filled or framed based on the Style in the paint.\n         *\n         * @param oval The rectangle bounds of the oval to be drawn\n         */\n        drawOval(oval:RectF, paint:Paint):void {\n            if (oval == null) {\n                throw Error(`new NullPointerException()`);\n            }\n            let paintEmpty = !paint || paint.isEmpty();\n            if(!paintEmpty){\n                this.saveImpl();\n                paint.applyToCanvas(this);\n            }\n            let style = paint ? paint.getStyle() : Paint.Style.FILL;\n            this.drawOvalImpl(oval, style);\n            if(!paintEmpty) this.restoreImpl();\n        }\n\n        protected drawOvalImpl(oval:RectF, style:Paint.Style):void {\n            let ctx = this._mCanvasContent;\n            ctx.beginPath();\n            let cx = oval.centerX();\n            let cy = oval.centerY();\n            let rx = oval.width()/2;\n            let ry = oval.height()/2;\n            ctx.save();\n            ctx.translate(cx-rx, cy-ry);\n            ctx.scale(rx, ry);\n            ctx.arc(1, 1, 1, 0, 2 * Math.PI, false);\n            ctx.restore();\n            this.applyFillOrStrokeToContent(style);\n        }\n\n\n        /**\n         * Draw the specified circle using the specified paint. If radius is <= 0,\n         * then nothing will be drawn. The circle will be filled or framed based\n         * on the Style in the paint.\n         *\n         * @param cx     The x-coordinate of the center of the cirle to be drawn\n         * @param cy     The y-coordinate of the center of the cirle to be drawn\n         * @param radius The radius of the cirle to be drawn\n         * @param paint  The paint used to draw the circle\n         */\n        drawCircle(cx:number, cy:number, radius:number, paint:Paint):void  {\n            let paintEmpty = !paint || paint.isEmpty();\n            if(!paintEmpty){\n                this.saveImpl();\n                paint.applyToCanvas(this);\n            }\n            let style = paint ? paint.getStyle() : Paint.Style.FILL;\n            this.drawCircleImpl(cx, cy, radius, style);\n            if(!paintEmpty) this.restoreImpl();\n        }\n\n        protected drawCircleImpl(cx:number, cy:number, radius:number, style:Paint.Style):void  {\n            let ctx = this._mCanvasContent;\n            ctx.beginPath();\n            ctx.arc(cx, cy, radius, 0, 2 * Math.PI, false);\n            this.applyFillOrStrokeToContent(style);\n\n        }\n\n        /**\n         * <p>Draw the specified arc, which will be scaled to fit inside the\n         * specified oval.</p>\n         *\n         * <p>If the start angle is negative or >= 360, the start angle is treated\n         * as start angle modulo 360.</p>\n         *\n         * <p>If the sweep angle is >= 360, then the oval is drawn\n         * completely. Note that this differs slightly from SkPath::arcTo, which\n         * treats the sweep angle modulo 360. If the sweep angle is negative,\n         * the sweep angle is treated as sweep angle modulo 360</p>\n         *\n         * <p>The arc is drawn clockwise. An angle of 0 degrees correspond to the\n         * geometric angle of 0 degrees (3 o'clock on a watch.)</p>\n         *\n         * @param oval       The bounds of oval used to define the shape and size\n         *                   of the arc\n         * @param startAngle Starting angle (in degrees) where the arc begins\n         * @param sweepAngle Sweep angle (in degrees) measured clockwise\n         * @param useCenter If true, include the center of the oval in the arc, and\n         close it if it is being stroked. This will draw a wedge\n         * @param paint      The paint used to draw the arc\n         */\n        drawArc(oval:RectF, startAngle:number, sweepAngle:number, useCenter:boolean, paint:Paint):void  {\n            if (oval == null) {\n                throw Error(`new NullPointerException()`);\n            }\n            let paintEmpty = !paint || paint.isEmpty();\n            if(!paintEmpty){\n                this.saveImpl();\n                paint.applyToCanvas(this);\n            }\n            let style = paint ? paint.getStyle() : Paint.Style.FILL;\n            this.drawArcImpl(oval, startAngle, sweepAngle, useCenter, style);\n            if(!paintEmpty) this.restoreImpl();\n        }\n\n        protected drawArcImpl(oval:RectF, startAngle:number, sweepAngle:number, useCenter:boolean, style:Paint.Style):void  {\n            let ctx = this._mCanvasContent;\n            ctx.save();\n            ctx.beginPath();\n            let cx = oval.centerX();\n            let cy = oval.centerY();\n            let rx = oval.width()/2;\n            let ry = oval.height()/2;\n\n            ctx.translate(cx-rx, cy-ry);\n            ctx.scale(rx, ry);\n            ctx.arc(1, 1, 1, startAngle / 180 * Math.PI, (sweepAngle+startAngle) / 180 * Math.PI, false);\n            if(useCenter){\n                ctx.lineTo(1, 1);\n                ctx.closePath();\n            }\n            ctx.restore();\n            this.applyFillOrStrokeToContent(style);\n        }\n\n        /**\n         * Draw the specified round-rect using the specified paint. The roundrect\n         * will be filled or framed based on the Style in the paint.\n         *\n         * @param rect  The rectangular bounds of the roundRect to be drawn\n         * @param rx    The x-radius of the oval used to round the corners\n         * @param ry    The y-radius of the oval used to round the corners\n         * @param paint The paint used to draw the roundRect\n         */\n        drawRoundRect(rect:RectF, radiusTopLeft:number,\n                      radiusTopRight:number, radiusBottomRight:number, radiusBottomLeft:number, paint:Paint):void {\n            if (rect == null) {\n                throw Error(`new NullPointerException()`);\n            }\n            let paintEmpty = !paint || paint.isEmpty();\n            if(!paintEmpty){\n                this.saveImpl();\n                paint.applyToCanvas(this);\n            }\n            let style = paint ? paint.getStyle() : Paint.Style.FILL;\n            this.drawRoundRectImpl(rect, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft, style);\n            if(!paintEmpty) this.restoreImpl();\n        }\n\n        protected drawRoundRectImpl(rect:RectF, radiusTopLeft:number,\n                                    radiusTopRight:number, radiusBottomRight:number, radiusBottomLeft:number, style:Paint.Style):void  {\n            this.doRoundRectPath(rect.left, rect.top, rect.width(), rect.height(), radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft);\n            this.applyFillOrStrokeToContent(style);\n        }\n\n\n        /**\n         * Draw the specified path using the specified paint. The path will be\n         * filled or framed based on the Style in the paint.\n         *\n         * @param path  The path to be drawn\n         * @param paint The paint used to draw the path\n         */\n        drawPath(path:Path, paint:Paint):void  {\n            //TODO set path\n        }\n\n\n        /**\n         * Draw the text, with origin at (x,y), using the specified paint. The\n         * origin is interpreted based on the Align setting in the paint.\n         *\n         * @param text  The text to be drawn\n         * @param x     The x-coordinate of the origin of the text being drawn\n         * @param y     The y-coordinate of the origin of the text being drawn\n         * @param paint The paint used for the text (e.g. color, size, style)\n         */\n        drawText_count(text:string, index:number, count:number, x:number, y:number, paint:Paint):void  {\n            if ((index | count | (index + count) | (text.length - index - count)) < 0) {\n                throw Error(`new IndexOutOfBoundsException()`);\n            }\n            this.drawText(text.substr(index, count), x, y, paint);\n        }\n\n        /**\n         * Draw the text, with origin at (x,y), using the specified paint.\n         * The origin is interpreted based on the Align setting in the paint.\n         *\n         * @param text  The text to be drawn\n         * @param start The index of the first character in text to draw\n         * @param end   (end - 1) is the index of the last character in text to draw\n         * @param x     The x-coordinate of the origin of the text being drawn\n         * @param y     The y-coordinate of the origin of the text being drawn\n         * @param paint The paint used for the text (e.g. color, size, style)\n         */\n        drawText_end(text:string, start:number, end:number, x:number, y:number, paint:Paint):void  {\n            if ((start | end | (end - start) | (text.length - end)) < 0) {\n                throw Error(`new IndexOutOfBoundsException()`);\n            }\n            this.drawText(text.substring(start, end), x, y, paint);\n        }\n\n        /**\n         * Draw the text, with origin at (x,y), using the specified paint. The\n         * origin is interpreted based on the Align setting in the paint.\n         *\n         * @param text  The text to be drawn\n         * @param x     The x-coordinate of the origin of the text being drawn\n         * @param y     The y-coordinate of the origin of the text being drawn\n         * @param paint The paint used for the text (e.g. color, size, style)\n         */\n        drawText(text:string, x:number, y:number, paint:Paint):void {\n            let paintEmpty = !paint || paint.isEmpty();\n            if(!paintEmpty){\n                this.saveImpl();\n                paint.applyToCanvas(this);\n            }\n\n            this.drawTextImpl(text, x, y, paint ? paint.getStyle() : null);\n\n            if(!paintEmpty) this.restoreImpl();\n        }\n\n\n        protected drawTextImpl(text:string, x:number, y:number, style:Paint.Style):void {\n            switch (style){\n                case Paint.Style.STROKE:\n                    this._mCanvasContent.strokeText(text, x, y);\n                    break;\n                case Paint.Style.FILL_AND_STROKE:\n                    this._mCanvasContent.strokeText(text, x, y);\n                    this._mCanvasContent.fillText(text, x, y);\n                    break;\n                case Paint.Style.FILL:\n                default :\n                    this._mCanvasContent.fillText(text, x, y);\n                    break;\n            }\n        }\n\n        /**\n         * Render a run of all LTR or all RTL text, with shaping. This does not run\n         * bidi on the provided text, but renders it as a uniform right-to-left or\n         * left-to-right run, as indicated by dir. Alignment of the text is as\n         * determined by the Paint's TextAlign value.\n         *\n         * @param text the text to render\n         * @param index the start of the text to render\n         * @param count the count of chars to render\n         * @param contextIndex the start of the context for shaping.  Must be\n         *         no greater than index.\n         * @param contextCount the number of characters in the context for shaping.\n         *         ContexIndex + contextCount must be no less than index\n         *         + count.\n         * @param x the x position at which to draw the text\n         * @param y the y position at which to draw the text\n         * @param dir the run direction, either {@link #DIRECTION_LTR} or\n         *         {@link #DIRECTION_RTL}.\n         * @param paint the paint\n         * @hide\n         */\n        drawTextRun_count(text:string, index:number, count:number, contextIndex:number, contextCount:number, x:number, y:number, dir:number, paint:Paint):void  {\n            //if (text == null) {\n            //    throw Error(`new NullPointerException(\"text is null\")`);\n            //}\n            //if (paint == null) {\n            //    throw Error(`new NullPointerException(\"paint is null\")`);\n            //}\n            //if ((index | count | text.length - index - count) < 0) {\n            //    throw Error(`new IndexOutOfBoundsException()`);\n            //}\n            //if (dir != Canvas.DIRECTION_LTR && dir != Canvas.DIRECTION_RTL) {\n            //    throw Error(`new IllegalArgumentException(\"unknown dir: \" + dir)`);\n            //}\n            this.drawText_count(text, index, count, x, y, paint);\n        }\n\n        /**\n         * Render a run of all LTR or all RTL text, with shaping. This does not run\n         * bidi on the provided text, but renders it as a uniform right-to-left or\n         * left-to-right run, as indicated by dir. Alignment of the text is as\n         * determined by the Paint's TextAlign value.\n         *\n         * @param text the text to render\n         * @param start the start of the text to render. Data before this position\n         *            can be used for shaping context.\n         * @param end the end of the text to render. Data at or after this\n         *            position can be used for shaping context.\n         * @param x the x position at which to draw the text\n         * @param y the y position at which to draw the text\n         * @param dir the run direction, either 0 for LTR or 1 for RTL.\n         * @param paint the paint\n         * @hide\n         */\n        drawTextRun_end(text:string, start:number, end:number, contextStart:number, contextEnd:number, x:number, y:number, dir:number, paint:Paint):void  {\n            //if (text == null) {\n            //    throw Error(`new NullPointerException(\"text is null\")`);\n            //}\n            //if (paint == null) {\n            //    throw Error(`new NullPointerException(\"paint is null\")`);\n            //}\n            //if ((start | end | end - start | text.length() - end) < 0) {\n            //    throw Error(`new IndexOutOfBoundsException()`);\n            //}\n            //let flags:number = dir == 0 ? 0 : 1;\n            //if (text instanceof string || text instanceof SpannedString || text instanceof SpannableString) {\n            //    Canvas.native_drawTextRun(this.mNativeCanvas, text.toString(), start, end, contextStart, contextEnd, x, y, flags, paint.mNativePaint);\n            //} else if (text instanceof GraphicsOperations) {\n            //    (<GraphicsOperations> text).drawTextRun(this, start, end, contextStart, contextEnd, x, y, flags, paint);\n            //} else {\n            //    let contextLen:number = contextEnd - contextStart;\n            //    let len:number = end - start;\n            //    let buf:char[] = TemporaryBuffer.obtain(contextLen);\n            //    TextUtils.getChars(text, contextStart, contextEnd, buf, 0);\n            //    Canvas.native_drawTextRun(this.mNativeCanvas, buf, start - contextStart, len, 0, contextLen, x, y, flags, paint.mNativePaint);\n            //    TemporaryBuffer.recycle(buf);\n            //}\n            this.drawText_end(text, start, end, x, y, paint);\n        }\n\n        static measureText(text:string, textSize:number):number {\n            if(textSize==null || textSize===0) return 0;\n            return Canvas.measureTextImpl(text, textSize);\n        }\n\n        private static _measureTextContext:CanvasRenderingContext2D = document.createElement('canvas').getContext('2d');\n        private static _measureCacheTextSize = 1000;\n        private static _static = (()=>{\n            Canvas._measureTextContext.font = Canvas._measureCacheTextSize + 'px ' + Canvas.getMeasureTextFontFamily();\n        })();\n        private static _measureCacheMap = new Map<number, number>();//<char, width>;\n        protected static measureTextImpl(text:string, textSize:number):number {\n            let width = 0;\n            for(let i=0,length=text.length; i<length; i++){\n                let c = text.charCodeAt(i);\n\n                let cWidth:number = Canvas._measureCacheMap.get(c);\n                if(cWidth == null){\n                    cWidth = Canvas._measureTextContext.measureText(text[i]).width;\n                    Canvas._measureCacheMap.set(c, cWidth);\n                }\n                width += (cWidth * textSize / Canvas._measureCacheTextSize);\n            }\n            return width;\n        }\n        protected static getMeasureTextFontFamily():string {\n            let fontParts = Canvas._measureTextContext.font.split(' ');\n            return fontParts[fontParts.length - 1];\n        }\n\n\n        setColor(color:number, style?:Paint.Style):void {\n            if(color != null){\n                this.setColorImpl(color, style);\n            }\n        }\n\n        protected setColorImpl(color:number, style?:Paint.Style):void {\n            let colorS = Color.toRGBAFunc(color);\n            switch (style){\n                case Paint.Style.STROKE:\n                    if(Color.parseColor(this._mCanvasContent.strokeStyle+'', 0)!=color){\n                        this._mCanvasContent.strokeStyle = colorS;\n                    }\n                    break;\n                case Paint.Style.FILL:\n                    if(Color.parseColor(this._mCanvasContent.fillStyle+'', 0)!=color){\n                        this._mCanvasContent.fillStyle = colorS;\n                    }\n                    break;\n                default :\n                case Paint.Style.FILL_AND_STROKE:\n                    if(Color.parseColor(this._mCanvasContent.fillStyle+'', 0)!=color){\n                        this._mCanvasContent.fillStyle = colorS;\n                    }\n                    if(Color.parseColor(this._mCanvasContent.strokeStyle+'', 0)!=color){\n                        this._mCanvasContent.strokeStyle = colorS;\n                    }\n                    break;\n            }\n        }\n\n        /**\n         * @param alpha [0, 1]\n         */\n        multiplyGlobalAlpha(alpha:number):void {\n            if(typeof alpha === 'number' && alpha < 1){\n                this.multiplyGlobalAlphaImpl(alpha);\n            }\n        }\n\n        protected multiplyGlobalAlphaImpl(alpha:number):void {\n            this._mCanvasContent.globalAlpha *= alpha;\n        }\n\n        /**\n         * @param alpha [0, 1]\n         */\n        setGlobalAlpha(alpha:number):void {\n            if(typeof alpha === 'number'){\n                this.setGlobalAlphaImpl(alpha);\n            }\n        }\n\n        protected setGlobalAlphaImpl(alpha:number):void {\n            this._mCanvasContent.globalAlpha = alpha;\n        }\n\n        setTextAlign(align:string):void {\n            if(align!=null) this.setTextAlignImpl(align);\n        }\n\n        protected setTextAlignImpl(align:string):void {\n            this._mCanvasContent.textAlign = align;\n        }\n\n        setLineWidth(width:number):void {\n            if(width!=null) this.setLineWidthImpl(width);\n        }\n\n        protected setLineWidthImpl(width:number):void {\n            this._mCanvasContent.lineWidth = width;\n        }\n\n        setLineCap(lineCap:string):void {\n            if(lineCap!=null) this.setLineCapImpl(lineCap);\n        }\n\n        protected setLineCapImpl(lineCap:string):void {\n            this._mCanvasContent.lineCap = lineCap;\n        }\n\n        setLineJoin(lineJoin:string):void {\n            if(lineJoin!=null) this.setLineJoinImpl(lineJoin);\n        }\n\n        protected setLineJoinImpl(lineJoin:string):void {\n            this._mCanvasContent.lineJoin = lineJoin;\n        }\n\n        setShadow(radius:number, dx:number, dy:number, color:number):void {\n            if(radius>0){\n                this.setShadowImpl(radius, dx, dy, color);\n            }\n        }\n\n        protected setShadowImpl(radius:number, dx:number, dy:number, color:number):void {\n            this._mCanvasContent.shadowBlur = radius;\n            this._mCanvasContent.shadowOffsetX = dx;\n            this._mCanvasContent.shadowOffsetY = dy;\n            this._mCanvasContent.shadowColor = Color.toRGBAFunc(color);\n        }\n\n        setFontSize(size:number):void {\n            if(size != null){\n                this.setFontSizeImpl(size);\n            }\n        }\n\n        protected setFontSizeImpl(size:number):void {\n            let cFont = this._mCanvasContent.font;\n            let fontParts = cFont.split(' ');\n            if(Number.parseFloat(fontParts[fontParts.length-2]) == size) return;\n            fontParts[fontParts.length-2] = size + 'px';\n            this._mCanvasContent.font = fontParts.join(' ');\n        }\n\n        setFont(fontName:string):void {\n            if(fontName!=null){\n                this.setFontImpl(fontName);\n            }\n        }\n        protected setFontImpl(fontName:string):void {\n            let cFont = this._mCanvasContent.font;\n            let fontParts = cFont.split(' ');\n            fontParts[fontParts.length - 1] = fontName;//font family\n            let font = fontParts.join(' ');\n            if(font!=cFont) this._mCanvasContent.font = font;\n        }\n\n        isImageSmoothingEnabled():boolean {\n            return this.isImageSmoothingEnabledImpl();\n        }\n        protected isImageSmoothingEnabledImpl():boolean {\n            return this._mCanvasContent['imageSmoothingEnabled'] || this._mCanvasContent['webkitImageSmoothingEnabled'];\n        }\n        setImageSmoothingEnabled(enable:boolean):void {\n            this.setImageSmoothingEnabledImpl(enable);\n        }\n        protected setImageSmoothingEnabledImpl(enable:boolean):void {\n            if('imageSmoothingEnabled' in this._mCanvasContent){\n                this._mCanvasContent['imageSmoothingEnabled'] = enable;\n            }else if('webkitImageSmoothingEnabled' in this._mCanvasContent){\n                this._mCanvasContent['webkitImageSmoothingEnabled'] = enable;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/android/graphics/Color.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule android.graphics{\n    /**\n     * The Color class defines methods for creating and converting color ints.\n     * Colors are represented as packed ints, made up of 4 bytes: alpha, red,\n     * green, blue. The values are unpremultiplied, meaning any transparency is\n     * stored solely in the alpha component, and not in the color components. The\n     * components are stored as follows (alpha << 24) | (red << 16) |\n     * (green << 8) | blue. Each component ranges between 0..255 with 0\n     * meaning no contribution for that component, and 255 meaning 100%\n     * contribution. Thus opaque-black would be 0xFF000000 (100% opaque but\n     * no contributions from red, green, or blue), and opaque-white would be\n     * 0xFFFFFFFF\n     */\n    export class Color {\n        static BLACK = 0xFF000000;\n        static DKGRAY = 0xFF444444;\n        static GRAY = 0xFF888888;\n        static LTGRAY = 0xFFCCCCCC;\n        static WHITE = 0xFFFFFFFF;\n        static RED = 0xFFFF0000;\n        static GREEN = 0xFF00FF00;\n        static BLUE = 0xFF0000FF;\n        static YELLOW = 0xFFFFFF00;\n        static CYAN = 0xFF00FFFF;\n        static MAGENTA = 0xFFFF00FF;\n        static TRANSPARENT = 0;\n\n        /**\n         * Return the alpha component of a color int. This is the same as saying\n         * color >>> 24\n         */\n        static alpha(color:number):number {\n            return color >>> 24;\n        }\n\n        /**\n         * Return the red component of a color int. This is the same as saying\n         * (color >> 16) & 0xFF\n         */\n        static red(color:number):number {\n            return (color >> 16) & 0xFF;\n        }\n\n        /**\n         * Return the green component of a color int. This is the same as saying\n         * (color >> 8) & 0xFF\n         */\n        static green(color:number):number {\n            return (color >> 8) & 0xFF;\n        }\n\n        /**\n         * Return the blue component of a color int. This is the same as saying\n         * color & 0xFF\n         */\n        static blue(color:number):number {\n            return color & 0xFF;\n        }\n\n        /**\n         * Return a color-int from red, green, blue components.\n         * The alpha component is implicity 255 (fully opaque).\n         * These component values should be [0..255], but there is no\n         * range check performed, so if they are out of range, the\n         * returned color is undefined.\n         * @param red  Red component [0..255] of the color\n         * @param green Green component [0..255] of the color\n         * @param blue  Blue component [0..255] of the color\n         */\n        static rgb(red:number, green:number, blue:number):number {\n            return (0xFF << 24) | (red << 16) | (green << 8) | blue;\n        }\n\n        /**\n         * Return a color-int from alpha, red, green, blue components.\n         * These component values should be [0..255], but there is no\n         * range check performed, so if they are out of range, the\n         * returned color is undefined.\n         * @param alpha Alpha component [0..255] of the color\n         * @param red   Red component [0..255] of the color\n         * @param green Green component [0..255] of the color\n         * @param blue  Blue component [0..255] of the color\n         */\n        static argb(alpha:number, red:number, green:number, blue:number):number {\n            return (alpha << 24) | (red << 16) | (green << 8) | blue;\n        }\n\n        /**\n         * Return a color-int from alpha, red, green, blue components.\n         * These component values should be [0..255], but there is no\n         * range check performed, so if they are out of range, the\n         * returned color is undefined.\n         * @param red   Red component [0..255] of the color\n         * @param green Green component [0..255] of the color\n         * @param blue  Blue component [0..255] of the color\n         * @param alpha Alpha component [0..255] of the color\n         */\n        static rgba(red:number, green:number, blue:number, alpha:number):number {\n            return (alpha << 24) | (red << 16) | (green << 8) | blue;\n        }\n\n        /**\n         * Parse the color string, and return the corresponding color-int.\n         * If the string cannot be parsed, throws an IllegalArgumentException\n         * exception. Supported formats are:\n         * #RGB\n         * #RRGGBB\n         * #AARRGGBB\n         * rgb(r, g, b)\n         * rgba(r, g, b)\n         * 'red', 'blue', 'green', 'black', 'white', 'gray', 'cyan', 'magenta',\n         * 'yellow', 'lightgray', 'darkgray', 'grey', 'lightgrey', 'darkgrey',\n         * 'aqua', 'fuschia', 'lime', 'maroon', 'navy', 'olive', 'purple',\n         * 'silver', 'teal', 'transparent'\n         */\n        static parseColor(colorString:string, defaultColor?:number):number {\n            if (colorString.charAt(0) == '#') {\n                if (colorString.length === 4) {//support parse #333\n                    colorString = '#' + colorString[1] + colorString[1] + colorString[2] + colorString[2] + colorString[3] + colorString[3];\n                }\n                // Use a long to avoid rollovers on #ffXXXXXX\n                let color = parseInt(colorString.substring(1), 16);\n                if (colorString.length == 7) {\n                    // Set the alpha value\n                    color |= 0x00000000ff000000;\n                } else if (colorString.length != 9) {\n                    if(defaultColor!=null) return defaultColor;\n                    throw new Error(\"Unknown color : \" + colorString);\n                }\n                return color;\n\n            } else if (colorString.startsWith('rgb(')) {\n                colorString = colorString.substring(colorString.indexOf('(')+1, colorString.lastIndexOf(')'));\n                let parts = colorString.split(',');\n                return Color.rgb(Number.parseInt(parts[0]), Number.parseInt(parts[1]), Number.parseInt(parts[2]));\n\n            } else if (colorString.startsWith('rgba(')) {\n                colorString = colorString.substring(colorString.indexOf('(')+1, colorString.lastIndexOf(')'));\n                let parts = colorString.split(',');\n                return Color.rgba(Number.parseInt(parts[0]), Number.parseInt(parts[1]),\n                    Number.parseInt(parts[2]), Number.parseFloat(parts[3]) * 255);\n\n            } else {\n                let color = Color.sColorNameMap.get(colorString.toLowerCase());\n                if (color != null) {\n                    return color;\n                }\n            }\n            if(defaultColor!=null) return defaultColor;\n            throw new Error(\"Unknown color : \" + colorString);\n        }\n\n        /**\n         * convert color value to hex color string (#xxxxxxxx)\n         * @param color c\n         * @returns {string} #xxxxxxxx\n         */\n        static toARGBHex(color:number):string {\n            let r = Color.red(color);\n            let g = Color.green(color);\n            let b = Color.blue(color);\n            let a = Color.alpha(color);\n            let hR = r<16 ? '0'+r.toString(16) : r.toString(16);\n            let hG = g<16 ? '0'+g.toString(16) : g.toString(16);\n            let hB = b<16 ? '0'+b.toString(16) : b.toString(16);\n            let hA = a<16 ? '0'+a.toString(16) : a.toString(16);\n            return \"#\"+hA+hR+hG+hB;\n        }\n        /**\n         * convert color value to css color func string rgba(xx,xx,xx,x)\n         * @param color c\n         * @returns {string} rgba(xx,xx,xx,x)\n         */\n        static toRGBAFunc(color:number):string {\n            let r = Color.red(color);\n            let g = Color.green(color);\n            let b = Color.blue(color);\n            let a = Color.alpha(color);\n            return`rgba(${r},${g},${b},${a/255})`;\n        }\n\n\n        /**\n         * Converts an HTML color (named or numeric) to an integer RGB value.\n         *\n         * @param color Non-null color string.\n         *\n         * @return A color value, or {@code -1} if the color string could not be interpreted.\n         *\n         * @hide\n         */\n        static getHtmlColor(color:string):number {\n            let i = Color.sColorNameMap.get(color.toLowerCase());\n            return i;\n        }\n\n        static sColorNameMap:Map<String, number> = new Map();\n    }\n\n    Color.sColorNameMap = new Map<String, number>();\n    Color.sColorNameMap.set(\"black\", Color.BLACK);\n    Color.sColorNameMap.set(\"darkgray\", Color.DKGRAY);\n    Color.sColorNameMap.set(\"gray\", Color.GRAY);\n    Color.sColorNameMap.set(\"lightgray\", Color.LTGRAY);\n    Color.sColorNameMap.set(\"white\", Color.WHITE);\n    Color.sColorNameMap.set(\"red\", Color.RED);\n    Color.sColorNameMap.set(\"green\", Color.GREEN);\n    Color.sColorNameMap.set(\"blue\", Color.BLUE);\n    Color.sColorNameMap.set(\"yellow\", Color.YELLOW);\n    Color.sColorNameMap.set(\"cyan\", Color.CYAN);\n    Color.sColorNameMap.set(\"magenta\", Color.MAGENTA);\n    Color.sColorNameMap.set(\"aqua\", 0xFF00FFFF);\n    Color.sColorNameMap.set(\"fuchsia\", 0xFFFF00FF);\n    Color.sColorNameMap.set(\"darkgrey\", Color.DKGRAY);\n    Color.sColorNameMap.set(\"grey\", Color.GRAY);\n    Color.sColorNameMap.set(\"lightgrey\", Color.LTGRAY);\n    Color.sColorNameMap.set(\"lime\", 0xFF00FF00);\n    Color.sColorNameMap.set(\"maroon\", 0xFF800000);\n    Color.sColorNameMap.set(\"navy\", 0xFF000080);\n    Color.sColorNameMap.set(\"olive\", 0xFF808000);\n    Color.sColorNameMap.set(\"purple\", 0xFF800080);\n    Color.sColorNameMap.set(\"silver\", 0xFFC0C0C0);\n    Color.sColorNameMap.set(\"teal\", 0xFF008080);\n    //androidui add\n    Color.sColorNameMap.set(\"transparent\", Color.TRANSPARENT);\n}"
  },
  {
    "path": "src/android/graphics/Matrix.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/util/Log.ts\"/>\n///<reference path=\"../../java/lang/System.ts\"/>\n///<reference path=\"../../java/lang/StringBuilder.ts\"/>\n///<reference path=\"../../android/graphics/Point.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/graphics/RectF.ts\"/>\n///<reference path=\"../../androidui/util/ArrayCreator.ts\"/>\n\nmodule android.graphics {\nimport Log = android.util.Log;\nimport System = java.lang.System;\nimport StringBuilder = java.lang.StringBuilder;\nimport Point = android.graphics.Point;\nimport Rect = android.graphics.Rect;\nimport RectF = android.graphics.RectF;\n/**\n * The Matrix class holds a 3x3 matrix for transforming coordinates.\n * FIXME recycle Array or share Array: new Array<number>(9)\n */\nexport class Matrix {\n\n    //!< use with getValues/setValues\n    static MSCALE_X:number = 0;\n\n    //!< use with getValues/setValues\n    static MSKEW_X:number = 1;\n\n    //!< use with getValues/setValues\n    static MTRANS_X:number = 2;\n\n    //!< use with getValues/setValues\n    static MSKEW_Y:number = 3;\n\n    //!< use with getValues/setValues\n    static MSCALE_Y:number = 4;\n\n    //!< use with getValues/setValues\n    static MTRANS_Y:number = 5;\n\n    //!< use with getValues/setValues\n    static MPERSP_0:number = 6;\n\n    //!< use with getValues/setValues\n    static MPERSP_1:number = 7;\n\n    //!< use with getValues/setValues\n    static MPERSP_2:number = 8;\n\n    private static MATRIX_SIZE:number = 9;\n\n    private mValues = androidui.util.ArrayCreator.newNumberArray(Matrix.MATRIX_SIZE);\n\n    /** @hide */\n    static IDENTITY_MATRIX:Matrix = (()=>{\n        class _Inner extends Matrix {\n\n            oops():void  {\n                throw Error(`new IllegalStateException(\"Matrix can not be modified\")`);\n            }\n\n            set(src:Matrix):void  {\n                this.oops();\n            }\n\n            reset():void  {\n                this.oops();\n            }\n\n            setTranslate(dx:number, dy:number):void  {\n                this.oops();\n            }\n\n            setScale(sx:number, sy:number, px?:number, py?:number):void  {\n                this.oops();\n            }\n\n            setRotate(degrees:number, px?:number, py?:number):void  {\n                this.oops();\n            }\n\n            setSinCos(sinValue:number, cosValue:number, px?:number, py?:number):void  {\n                this.oops();\n            }\n\n            setSkew(kx:number, ky:number, px?:number, py?:number):void  {\n                this.oops();\n            }\n\n            setConcat(a:Matrix, b:Matrix):boolean  {\n                this.oops();\n                return false;\n            }\n\n            preTranslate(dx:number, dy:number):boolean  {\n                this.oops();\n                return false;\n            }\n\n            preScale(sx:number, sy:number, px?:number, py?:number):boolean  {\n                this.oops();\n                return false;\n            }\n\n            preRotate(degrees:number, px?:number, py?:number):boolean  {\n                this.oops();\n                return false;\n            }\n\n            preSkew(kx:number, ky:number, px?:number, py?:number):boolean  {\n                this.oops();\n                return false;\n            }\n\n            preConcat(other:Matrix):boolean  {\n                this.oops();\n                return false;\n            }\n\n            postTranslate(dx:number, dy:number):boolean  {\n                this.oops();\n                return false;\n            }\n\n            postScale(sx:number, sy:number, px?:number, py?:number):boolean  {\n                this.oops();\n                return false;\n            }\n\n            postRotate(degrees:number, px?:number, py?:number):boolean  {\n                this.oops();\n                return false;\n            }\n\n            postSkew(kx:number, ky:number, px?:number, py?:number):boolean  {\n                this.oops();\n                return false;\n            }\n\n            postConcat(other:Matrix):boolean  {\n                this.oops();\n                return false;\n            }\n\n            setRectToRect(src:RectF, dst:RectF, stf:Matrix.ScaleToFit):boolean  {\n                this.oops();\n                return false;\n            }\n\n            setPolyToPoly(src:number[], srcIndex:number, dst:number[], dstIndex:number, pointCount:number):boolean  {\n                this.oops();\n                return false;\n            }\n\n            setValues(values:number[]):void  {\n                this.oops();\n            }\n        }\n        return new _Inner();\n    })();\n\n    /**\n     * Create an identity matrix\n     */\n    constructor();\n    /**\n     * Create a matrix that is a (deep) copy of src\n     * @param src The matrix to copy into this matrix\n     */\n    constructor(src:Matrix);\n    /**\n     * Create a matrix that is a (deep) copy of src\n     * @param values The matrix values to copy into this matrix\n     */\n    constructor(values:number[]);\n    constructor(values?:Matrix|number[]) {\n        if(values instanceof Matrix) this.set(values);\n        else if(values instanceof Array){\n            System.arraycopy(values, 0, this.mValues, 0, Matrix.MATRIX_SIZE);\n        }else{\n            Matrix.reset(this.mValues);\n        }\n    }\n\n    /**\n     * Returns true if the matrix is identity.\n     * This maybe faster than testing if (getType() == 0)\n     */\n    isIdentity():boolean  {\n        for (let i:number = 0, k:number = 0; i < 3; i++) {\n            for (let j:number = 0; j < 3; j++, k++) {\n                if (this.mValues[k] != ((i == j) ? 1 : 0)) {\n                    return false;\n                }\n            }\n        }\n        return true;\n    }\n\n    hasPerspective():boolean  {\n        return (this.mValues[6] != 0 || this.mValues[7] != 0 || this.mValues[8] != 1);\n    }\n\n    /**\n     * Returns true if will map a rectangle to another rectangle. This can be\n     * true if the matrix is identity, scale-only, or rotates a multiple of 90\n     * degrees.\n     */\n    rectStaysRect():boolean  {\n        return (this.computeTypeMask() & Matrix.kRectStaysRect_Mask) != 0;\n    }\n\n    /**\n     * (deep) copy the src matrix into this matrix. If src is null, reset this\n     * matrix to the identity matrix.\n     */\n    set(src:Matrix):void  {\n        if (src == null) {\n            this.reset();\n        } else {\n            System.arraycopy(src.mValues, 0, this.mValues, 0, Matrix.MATRIX_SIZE);\n        }\n    }\n\n    /** Returns true iff obj is a Matrix and its values equal our values.\n    */\n    equals(obj:any):boolean  {\n        //if (obj == this) return true;     -- NaN value would mean matrix != itself\n        if (!(obj instanceof Matrix))\n            return false;\n        let another:Matrix = <Matrix> obj;\n        for (let i:number = 0; i < Matrix.MATRIX_SIZE; i++) {\n            if (this.mValues[i] != another.mValues[i]) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    hashCode():number  {\n        // really using this at the moment, so we take the easy way out.\n        return 44;\n    }\n\n    /** Set the matrix to identity */\n    reset():void  {\n        Matrix.reset(this.mValues);\n    }\n\n    /** Set the matrix to translate by (dx, dy). */\n    setTranslate(dx:number, dy:number):void  {\n        Matrix.setTranslate(this.mValues, dx, dy);\n    }\n\n    /**\n     * Set the matrix to scale by sx and sy, with a pivot point at (px, py).\n     * The pivot point is the coordinate that should remain unchanged by the\n     * specified transformation.\n     */\n    setScale(sx:number, sy:number, px?:number, py?:number):void  {\n        if(px==null || py==null){\n            this.mValues[0] = sx;\n            this.mValues[1] = 0;\n            this.mValues[2] = 0;\n            this.mValues[3] = 0;\n            this.mValues[4] = sy;\n            this.mValues[5] = 0;\n            this.mValues[6] = 0;\n            this.mValues[7] = 0;\n            this.mValues[8] = 1;\n\n        }else{\n            this.mValues = Matrix.getScale(sx, sy, px, py);\n        }\n    }\n\n    /**\n     * Set the matrix to rotate by the specified number of degrees, with a pivot\n     * point at (px, py). The pivot point is the coordinate that should remain\n     * unchanged by the specified transformation.\n     */\n    setRotate(degrees:number, px?:number, py?:number):void  {\n        if(px==null || py==null){\n            Matrix.setRotate_1(this.mValues, degrees);\n\n        }else{\n            this.mValues = Matrix.getRotate_3(degrees, px, py);\n        }\n    }\n\n    /**\n     * Set the matrix to rotate by the specified sine and cosine values, with a\n     * pivot point at (px, py). The pivot point is the coordinate that should\n     * remain unchanged by the specified transformation.\n     */\n    setSinCos(sinValue:number, cosValue:number, px?:number, py?:number):void  {\n        if(px==null || py==null){\n            Matrix.setRotate_2(this.mValues, sinValue, cosValue);\n\n        }else {\n            // translate so that the pivot is in 0,0\n            Matrix.setTranslate(this.mValues, -px, -py);\n            // scale\n            this.postTransform(Matrix.getRotate_2(sinValue, cosValue));\n            // translate back the pivot\n            this.postTransform(Matrix.getTranslate(px, py));\n        }\n    }\n\n    /**\n     * Set the matrix to skew by sx and sy, with a pivot point at (px, py).\n     * The pivot point is the coordinate that should remain unchanged by the\n     * specified transformation.\n     */\n    setSkew(kx:number, ky:number, px?:number, py?:number):void  {\n        if(px==null || py==null){\n            this.mValues[0] = 1;\n            this.mValues[1] = kx;\n            this.mValues[2] = -0;\n            this.mValues[3] = ky;\n            this.mValues[4] = 1;\n            this.mValues[5] = 0;\n            this.mValues[6] = 0;\n            this.mValues[7] = 0;\n            this.mValues[8] = 1;\n\n        }else{\n            this.mValues = Matrix.getSkew(kx, ky, px, py);\n        }\n    }\n\n    /**\n     * Set the matrix to the concatenation of the two specified matrices,\n     * returning true if the the result can be represented. Either of the two\n     * matrices may also be the target matrix. this = a * b\n     */\n    setConcat(a:Matrix, b:Matrix):boolean  {\n        Matrix.multiply(this.mValues, a.mValues, b.mValues);\n        return true;\n    }\n\n    /**\n     * Preconcats the matrix with the specified translation.\n     * M' = M * T(dx, dy)\n     */\n    preTranslate(dx:number, dy:number):boolean  {\n        this.preTransform(Matrix.getTranslate(dx, dy));\n        return true;\n    }\n\n    /**\n     * Preconcats the matrix with the specified scale.\n     * M' = M * S(sx, sy, px, py)\n     */\n    preScale(sx:number, sy:number, px?:number, py?:number):boolean  {\n        this.preTransform(Matrix.getScale(sx, sy, px, py));\n        return true;\n    }\n\n\n    /**\n     * Preconcats the matrix with the specified rotation.\n     * M' = M * R(degrees)\n     * M' = M * R(degrees, px, py)\n     */\n    preRotate(degrees:number, px?:number, py?:number):boolean  {\n        if(px==null || py==null){\n            let rad:number = Math_toRadians(degrees);\n            let sin:number = <number> Math.sin(rad);\n            let cos:number = <number> Math.cos(rad);\n            this.preTransform(Matrix.getRotate_2(sin, cos));\n            return true;\n        }\n\n        this.preTransform(Matrix.getRotate_3(degrees, px, py));\n        return true;\n    }\n\n\n    /**\n     * Preconcats the matrix with the specified skew.\n     * M' = M * K(kx, ky)\n     * M' = M * K(kx, ky, px, py)\n     */\n    preSkew(kx:number, ky:number, px?:number, py?:number):boolean  {\n        this.preTransform(Matrix.getSkew(kx, ky, px, py));\n        return true;\n    }\n\n    /**\n     * Preconcats the matrix with the specified matrix.\n     * M' = M * other\n     */\n    preConcat(other:Matrix):boolean  {\n        this.preTransform(other.mValues);\n        return true;\n    }\n\n    /**\n     * Postconcats the matrix with the specified translation.\n     * M' = T(dx, dy) * M\n     */\n    postTranslate(dx:number, dy:number):boolean  {\n        this.postTransform(Matrix.getTranslate(dx, dy));\n        return true;\n    }\n\n    /**\n     * Postconcats the matrix with the specified scale.\n     * M' = S(sx, sy) * M\n     * M' = S(sx, sy, px, py) * M\n     */\n    postScale(sx:number, sy:number, px?:number, py?:number):boolean  {\n        this.postTransform(Matrix.getScale(sx, sy, px, py));\n        return true;\n    }\n\n    /**\n     * Postconcats the matrix with the specified rotation.\n     * M' = R(degrees) * M\n     * M' = R(degrees, px, py) * M\n     */\n    postRotate(degrees:number, px?:number, py?:number):boolean  {\n        this.postTransform(Matrix.getRotate_3(degrees, px, py));\n        return true;\n    }\n\n    /**\n     * Postconcats the matrix with the specified skew.\n     * M' = K(kx, ky) * M\n     * M' = K(kx, ky, px, py) * M\n     */\n    postSkew(kx:number, ky:number, px?:number, py?:number):boolean  {\n        this.postTransform(Matrix.getSkew(kx, ky, px, py));\n        return true;\n    }\n\n    /**\n     * Postconcats the matrix with the specified matrix.\n     * M' = other * M\n     */\n    postConcat(other:Matrix):boolean  {\n        this.postTransform(other.mValues);\n        return true;\n    }\n\n\n\n    /**\n     * Set the matrix to the scale and translate values that map the source\n     * rectangle to the destination rectangle, returning true if the the result\n     * can be represented.\n     *\n     * @param src the source rectangle to map from.\n     * @param dst the destination rectangle to map to.\n     * @param stf the ScaleToFit option\n     * @return true if the matrix can be represented by the rectangle mapping.\n     */\n    setRectToRect(src:RectF, dst:RectF, stf:Matrix.ScaleToFit):boolean  {\n        if (dst == null || src == null) {\n            throw Error(`new NullPointerException()`);\n        }\n        let d:Matrix = this;\n        if (src.isEmpty()) {\n            Matrix.reset(d.mValues);\n            return false;\n        }\n        if (dst.isEmpty()) {\n            d.mValues[0] = d.mValues[1] = d.mValues[2] = d.mValues[3] = d.mValues[4] = d.mValues[5] = d.mValues[6] = d.mValues[7] = 0;\n            d.mValues[8] = 1;\n        } else {\n            let tx:number, sx:number = dst.width() / src.width();\n            let ty:number, sy:number = dst.height() / src.height();\n            let xLarger:boolean = false;\n            if (stf != Matrix.ScaleToFit.FILL) {\n                if (sx > sy) {\n                    xLarger = true;\n                    sx = sy;\n                } else {\n                    sy = sx;\n                }\n            }\n            tx = dst.left - src.left * sx;\n            ty = dst.top - src.top * sy;\n            if (stf == Matrix.ScaleToFit.CENTER || stf == Matrix.ScaleToFit.END) {\n                let diff:number;\n                if (xLarger) {\n                    diff = dst.width() - src.width() * sy;\n                } else {\n                    diff = dst.height() - src.height() * sy;\n                }\n                if (stf == Matrix.ScaleToFit.CENTER) {\n                    diff = diff / 2;\n                }\n                if (xLarger) {\n                    tx += diff;\n                } else {\n                    ty += diff;\n                }\n            }\n            d.mValues[0] = sx;\n            d.mValues[4] = sy;\n            d.mValues[2] = tx;\n            d.mValues[5] = ty;\n            d.mValues[1] = d.mValues[3] = d.mValues[6] = d.mValues[7] = 0;\n        }\n        // shared cleanup\n        d.mValues[8] = 1;\n        return true;\n    }\n\n    // private helper to perform range checks on arrays of \"points\"\n    private static checkPointArrays(src:number[], srcIndex:number, dst:number[], dstIndex:number, pointCount:number):void  {\n        // check for too-small and too-big indices\n        let srcStop:number = srcIndex + (pointCount << 1);\n        let dstStop:number = dstIndex + (pointCount << 1);\n        if ((pointCount | srcIndex | dstIndex | srcStop | dstStop) < 0 || srcStop > src.length || dstStop > dst.length) {\n            throw Error(`new ArrayIndexOutOfBoundsException()`);\n        }\n    }\n\n    ///**\n    // * Set the matrix such that the specified src points would map to the\n    // * specified dst points. The \"points\" are represented as an array of floats,\n    // * order [x0, y0, x1, y1, ...], where each \"point\" is 2 float values.\n    // *\n    // * @param src   The array of src [x,y] pairs (points)\n    // * @param srcIndex Index of the first pair of src values\n    // * @param dst   The array of dst [x,y] pairs (points)\n    // * @param dstIndex Index of the first pair of dst values\n    // * @param pointCount The number of pairs/points to be used. Must be [0..4]\n    // * @return true if the matrix was set to the specified transformation\n    // */\n    //setPolyToPoly(src:number[], srcIndex:number, dst:number[], dstIndex:number, pointCount:number):boolean  {\n    //    Log.e('Matrix', \"Matrix.setPolyToPoly is not supported\");\n    //    return false;\n    //}\n\n\n    ///**\n    // * If this matrix can be inverted, return true and if inverse is not null,\n    // * set inverse to be the inverse of this matrix. If this matrix cannot be\n    // * inverted, ignore inverse and return false.\n    // */\n    //invert(inverse:Matrix):boolean  {\n    //    try {\n    //        let matrixInverter:MatrixInverter = this.getAffineTransform();\n    //        let inverseTransform:MatrixInverter = matrixInverter.createInverse();\n    //        inverse.mValues[0] = <number> inverseTransform.getScaleX();\n    //        inverse.mValues[1] = <number> inverseTransform.getShearX();\n    //        inverse.mValues[2] = <number> inverseTransform.getTranslateX();\n    //        inverse.mValues[3] = <number> inverseTransform.getScaleX();\n    //        inverse.mValues[4] = <number> inverseTransform.getShearY();\n    //        inverse.mValues[5] = <number> inverseTransform.getTranslateY();\n    //        return true;\n    //    } catch (e){\n    //        return false;\n    //    }\n    //}\n\n    /**\n    * Apply this matrix to the array of 2D points specified by src, and write\n     * the transformed points into the array of points specified by dst. The\n     * two arrays represent their \"points\" as pairs of floats [x, y].\n     *\n     * @param dst   The array of dst points (x,y pairs)\n     * @param dstIndex The index of the first [x,y] pair of dst floats\n     * @param src   The array of src points (x,y pairs)\n     * @param srcIndex The index of the first [x,y] pair of src floats\n     * @param pointCount The number of points (x,y pairs) to transform\n     */\n    mapPoints(dst:number[], dstIndex=0, src=dst, srcIndex=0, pointCount=dst.length >> 1):void  {\n        Matrix.checkPointArrays(src, srcIndex, dst, dstIndex, pointCount);\n        const count:number = pointCount * 2;\n        let tmpDest:number[] = dst;\n        let inPlace:boolean = dst == src;\n        if (inPlace) {\n            tmpDest = androidui.util.ArrayCreator.newNumberArray(dstIndex + count);\n        }\n        for (let i:number = 0; i < count; i += 2) {\n            // just in case we are doing in place, we better put this in temp vars\n            let x:number = this.mValues[0] * src[i + srcIndex] + this.mValues[1] * src[i + srcIndex + 1] + this.mValues[2];\n            let y:number = this.mValues[3] * src[i + srcIndex] + this.mValues[4] * src[i + srcIndex + 1] + this.mValues[5];\n            tmpDest[i + dstIndex] = x;\n            tmpDest[i + dstIndex + 1] = y;\n        }\n        if (inPlace) {\n            System.arraycopy(tmpDest, dstIndex, dst, dstIndex, count);\n        }\n    }\n\n    /**\n    * Apply this matrix to the array of 2D vectors specified by src, and write\n     * the transformed vectors into the array of vectors specified by dst. The\n     * two arrays represent their \"vectors\" as pairs of floats [x, y].\n     *\n     * Note: this method does not apply the translation associated with the matrix. Use\n     * {@link Matrix#mapPoints(float[], int, float[], int, int)} if you want the translation\n     * to be applied.\n     *\n     * @param dst   The array of dst vectors (x,y pairs)\n     * @param dstIndex The index of the first [x,y] pair of dst floats\n     * @param src   The array of src vectors (x,y pairs)\n     * @param srcIndex The index of the first [x,y] pair of src floats\n     * @param ptCount The number of vectors (x,y pairs) to transform\n     */\n    mapVectors(dst:number[], dstIndex=0, src=dst, srcIndex=0, ptCount=dst.length >> 1):void  {\n        Matrix.checkPointArrays(src, srcIndex, dst, dstIndex, ptCount);\n        if (this.hasPerspective()) {\n            // transform the (0,0) point\n            let origin:number[] =  [ 0., 0. ];\n            this.mapPoints(origin);\n            // translate the vector data as points\n            this.mapPoints(dst, dstIndex, src, srcIndex, ptCount);\n            // then substract the transformed origin.\n            const count:number = ptCount * 2;\n            for (let i:number = 0; i < count; i += 2) {\n                dst[dstIndex + i] = dst[dstIndex + i] - origin[0];\n                dst[dstIndex + i + 1] = dst[dstIndex + i + 1] - origin[1];\n            }\n        } else {\n            // make a copy of the matrix\n            let copy:Matrix = new Matrix(this.mValues);\n            // remove the translation\n            Matrix.setTranslate(copy.mValues, 0, 0);\n            // map the content as points.\n            copy.mapPoints(dst, dstIndex, src, srcIndex, ptCount);\n        }\n    }\n\n    /**\n     * Apply this matrix to the src rectangle, and write the transformed\n     * rectangle into dst. This is accomplished by transforming the 4 corners of\n     * src, and then setting dst to the bounds of those points.\n     *\n     * @param dst Where the transformed rectangle is written.\n     * @param src The original rectangle to be transformed.\n     * @return the result of calling rectStaysRect()\n     */\n    mapRect(dst:RectF, src=dst):boolean  {\n        if (dst == null || src == null) {\n            throw Error(`new NullPointerException()`);\n        }\n        // array with 4 corners\n        let corners:number[] =  [ src.left, src.top, src.right, src.top, src.right, src.bottom, src.left, src.bottom ];\n        // apply the transform to them.\n        this.mapPoints(corners);\n        // now put the result in the rect. We take the min/max of Xs and min/max of Ys\n        dst.left = Math.min(Math.min(corners[0], corners[2]), Math.min(corners[4], corners[6]));\n        dst.right = Math.max(Math.max(corners[0], corners[2]), Math.max(corners[4], corners[6]));\n        dst.top = Math.min(Math.min(corners[1], corners[3]), Math.min(corners[5], corners[7]));\n        dst.bottom = Math.max(Math.max(corners[1], corners[3]), Math.max(corners[5], corners[7]));\n        return (this.computeTypeMask() & Matrix.kRectStaysRect_Mask) != 0;\n    }\n\n    /**\n     * Return the mean radius of a circle after it has been mapped by\n     * this matrix. NOTE: in perspective this value assumes the circle\n     * has its center at the origin.\n     */\n    mapRadius(radius:number):number  {\n        let src:number[] =  [ radius, 0., 0., radius ];\n        this.mapVectors(src, 0, src, 0, 2);\n        let l1:number = Matrix.getPointLength(src, 0);\n        let l2:number = Matrix.getPointLength(src, 2);\n        return <number> Math.sqrt(l1 * l2);\n    }\n\n    /** Copy 9 values from the matrix into the array.\n    */\n    getValues(values:number[]):void  {\n        if (values.length < 9) {\n            throw Error(`new ArrayIndexOutOfBoundsException()`);\n        }\n        System.arraycopy(this.mValues, 0, values, 0, Matrix.MATRIX_SIZE);\n    }\n\n    /** Copy 9 values from the array into the matrix.\n        Depending on the implementation of Matrix, these may be\n        transformed into 16.16 integers in the Matrix, such that\n        a subsequent call to getValues() will not yield exactly\n        the same values.\n    */\n    setValues(values:number[]):void  {\n        if (values.length < 9) {\n            throw Error(`new ArrayIndexOutOfBoundsException()`);\n        }\n        System.arraycopy(values, 0, this.mValues, 0, Matrix.MATRIX_SIZE);\n    }\n\n    toString():string  {\n        let sb:StringBuilder = new StringBuilder(64);\n        sb.append(\"Matrix{\");\n        this.toShortString(sb);\n        sb.append('}');\n        return sb.toString();\n    }\n\n    /**\n     * @hide\n     */\n    toShortString(sb:StringBuilder):void  {\n        let values:number[] = androidui.util.ArrayCreator.newNumberArray(9);\n        this.getValues(values);\n        sb.append('[');\n        sb.append(values[0]);\n        sb.append(\", \");\n        sb.append(values[1]);\n        sb.append(\", \");\n        sb.append(values[2]);\n        sb.append(\"][\");\n        sb.append(values[3]);\n        sb.append(\", \");\n        sb.append(values[4]);\n        sb.append(\", \");\n        sb.append(values[5]);\n        sb.append(\"][\");\n        sb.append(values[6]);\n        sb.append(\", \");\n        sb.append(values[7]);\n        sb.append(\", \");\n        sb.append(values[8]);\n        sb.append(']');\n    }\n\n    /**\n     * Adds the given transformation to the current Matrix\n     * <p/>This in effect does this = this*matrix\n     * @param matrix\n     */\n    private postTransform(matrix:number[]):void  {\n        let tmp:number[] = androidui.util.ArrayCreator.newNumberArray(9);\n        Matrix.multiply(tmp, this.mValues, matrix);\n        this.mValues = tmp;\n    }\n\n    /**\n     * Adds the given transformation to the current Matrix\n     * <p/>This in effect does this = matrix*this\n     * @param matrix\n     */\n    private preTransform(matrix:number[]):void  {\n        let tmp:number[] = androidui.util.ArrayCreator.newNumberArray(9);\n        Matrix.multiply(tmp, matrix, this.mValues);\n        this.mValues = tmp;\n    }\n\n    private static getPointLength(src:number[], index:number):number  {\n        return <number> Math.sqrt(src[index] * src[index] + src[index + 1] * src[index + 1]);\n    }\n\n    /**\n     * multiply two matrices and store them in a 3rd.\n     * <p/>This in effect does dest = a*b\n     * dest cannot be the same as a or b.\n     */\n    /*package*/\n    static multiply(dest:number[], a:number[], b:number[]):void  {\n        // first row\n        dest[0] = b[0] * a[0] + b[1] * a[3] + b[2] * a[6];\n        dest[1] = b[0] * a[1] + b[1] * a[4] + b[2] * a[7];\n        dest[2] = b[0] * a[2] + b[1] * a[5] + b[2] * a[8];\n        // 2nd row\n        dest[3] = b[3] * a[0] + b[4] * a[3] + b[5] * a[6];\n        dest[4] = b[3] * a[1] + b[4] * a[4] + b[5] * a[7];\n        dest[5] = b[3] * a[2] + b[4] * a[5] + b[5] * a[8];\n        // 3rd row\n        dest[6] = b[6] * a[0] + b[7] * a[3] + b[8] * a[6];\n        dest[7] = b[6] * a[1] + b[7] * a[4] + b[8] * a[7];\n        dest[8] = b[6] * a[2] + b[7] * a[5] + b[8] * a[8];\n    }\n\n    /**\n     * Returns a matrix that represents a given translate\n     * @param dx\n     * @param dy\n     * @return\n     */\n    /*package*/\n    static getTranslate(dx:number, dy:number):number[]  {\n        return this.setTranslate(androidui.util.ArrayCreator.newNumberArray(9), dx, dy);\n    }\n\n    /*package*/\n    static setTranslate(dest:number[], dx:number, dy:number):number[]  {\n        dest[0] = 1;\n        dest[1] = 0;\n        dest[2] = dx;\n        dest[3] = 0;\n        dest[4] = 1;\n        dest[5] = dy;\n        dest[6] = 0;\n        dest[7] = 0;\n        dest[8] = 1;\n        return dest;\n    }\n\n    /**\n     * Returns a matrix that represents the given scale info.\n     * @param sx\n     * @param sy\n     * @param px\n     * @param py\n     */\n    /*package*/\n    static getScale(sx:number, sy:number, px?:number, py?:number):number[]  {\n        if(px==null || py==null){\n            return  [ sx, 0, 0, 0, sy, 0, 0, 0, 1 ];\n        }\n        let tmp:number[] = androidui.util.ArrayCreator.newNumberArray(9);\n        let tmp2:number[] = androidui.util.ArrayCreator.newNumberArray(9);\n        // TODO: do it in one pass\n        // translate tmp so that the pivot is in 0,0\n        this.setTranslate(tmp, -px, -py);\n        // scale into tmp2\n        Matrix.multiply(tmp2, tmp, Matrix.getScale(sx, sy));\n        // translate back the pivot back into tmp\n        Matrix.multiply(tmp, tmp2, Matrix.getTranslate(px, py));\n        return tmp;\n    }\n\n    /*package*/\n    static getRotate_1(degrees:number):number[]  {\n        let rad:number = Math_toRadians(degrees);\n        let sin:number = Math.sin(rad);\n        let cos:number = Math.cos(rad);\n        return Matrix.getRotate_2(sin, cos);\n    }\n\n    /*package*/\n    static getRotate_2(sin:number, cos:number):number[]  {\n        return this.setRotate_2(androidui.util.ArrayCreator.newNumberArray(9), sin, cos);\n    }\n\n    /*package*/\n    static setRotate_1(dest:number[], degrees:number):number[]  {\n        let rad:number = Math_toRadians(degrees);\n        let sin:number = <number> Math.sin(rad);\n        let cos:number = <number> Math.cos(rad);\n        return Matrix.setRotate_2(dest, sin, cos);\n    }\n\n    /*package*/\n    static setRotate_2(dest:number[], sin:number, cos:number):number[]  {\n        dest[0] = cos;\n        dest[1] = -sin;\n        dest[2] = 0;\n        dest[3] = sin;\n        dest[4] = cos;\n        dest[5] = 0;\n        dest[6] = 0;\n        dest[7] = 0;\n        dest[8] = 1;\n        return dest;\n    }\n\n    /*package*/\n    static getRotate_3(degrees:number, px:number, py:number):number[]  {\n        let tmp:number[] = androidui.util.ArrayCreator.newNumberArray(9);\n        let tmp2:number[] = androidui.util.ArrayCreator.newNumberArray(9);\n        // TODO: do it in one pass\n        // translate so that the pivot is in 0,0\n        this.setTranslate(tmp, -px, -py);\n        // rotate into tmp2\n        let rad:number = Math_toRadians(degrees);\n        let cos:number = <number> Math.cos(rad);\n        let sin:number = <number> Math.sin(rad);\n        Matrix.multiply(tmp2, tmp, Matrix.getRotate_2(sin, cos));\n        // translate back the pivot back into tmp\n        Matrix.multiply(tmp, tmp2, Matrix.getTranslate(px, py));\n        return tmp;\n    }\n\n    /*package*/\n    static getSkew(kx:number, ky:number, px?:number, py?:number):number[]  {\n        if(px==null || py==null){\n            return  [ 1, kx, 0, ky, 1, 0, 0, 0, 1 ];\n        }\n\n        let tmp:number[] = androidui.util.ArrayCreator.newNumberArray(9);\n        let tmp2:number[] = androidui.util.ArrayCreator.newNumberArray(9);\n        // TODO: do it in one pass\n        // translate so that the pivot is in 0,0\n        this.setTranslate(tmp, -px, -py);\n        // skew into tmp2\n        Matrix.multiply(tmp2, tmp,  [ 1, kx, 0, ky, 1, 0, 0, 0, 1 ]);\n        // translate back the pivot back into tmp\n        Matrix.multiply(tmp, tmp2, Matrix.getTranslate(px, py));\n        return tmp;\n    }\n\n    // ---- Private helper methods ----\n    ///**\n    // * Returns an {@link java.awt.geom.AffineTransform} matching the matrix.\n    // */\n    //getAffineTransform():MatrixInverter  {\n    //    return this.getAffineTransform(this.mValues);\n    //}\n    //\n    ///*package*/\n    //static getAffineTransform(matrix:number[]):MatrixInverter  {\n    //    // the order is 0, 3, 1, 4, 2, 5...\n    //    return new MatrixInverter(matrix[0], matrix[3], matrix[1], matrix[4], matrix[2], matrix[5]);\n    //}\n\n    /**\n     * Reset a matrix to the identity\n     */\n    private static reset(mtx:number[]):void  {\n        mtx[0] = 1;\n        mtx[1] = 0;\n        mtx[2] = 0;\n\n        mtx[3] = 0;\n        mtx[4] = 1;\n        mtx[5] = 0;\n\n        mtx[6] = 0;\n        mtx[7] = 0;\n        mtx[8] = 1;\n    }\n\n    private static kIdentity_Mask:number = 0;\n\n    //!< set if the matrix has translation\n    private static kTranslate_Mask:number = 0x01;\n\n    //!< set if the matrix has X or Y scale\n    private static kScale_Mask:number = 0x02;\n\n    //!< set if the matrix skews or rotates\n    private static kAffine_Mask:number = 0x04;\n\n    //!< set if the matrix is in perspective\n    private static kPerspective_Mask:number = 0x08;\n\n    private static kRectStaysRect_Mask:number = 0x10;\n\n    private static kUnknown_Mask:number = 0x80;\n\n    private static kAllMasks:number = Matrix.kTranslate_Mask | Matrix.kScale_Mask | Matrix.kAffine_Mask | Matrix.kPerspective_Mask | Matrix.kRectStaysRect_Mask;\n\n    // these guys align with the masks, so we can compute a mask from a variable 0/1\n    private static kTranslate_Shift:number = 0;\n\n    private static kScale_Shift:number = 1;\n\n    private static kAffine_Shift:number = 2;\n\n    private static kPerspective_Shift:number = 3;\n\n    private static kRectStaysRect_Shift:number = 4;\n\n    private computeTypeMask():number  {\n        let mask:number = 0;\n        if (this.mValues[6] != 0. || this.mValues[7] != 0. || this.mValues[8] != 1.) {\n            mask |= Matrix.kPerspective_Mask;\n        }\n        if (this.mValues[2] != 0. || this.mValues[5] != 0.) {\n            mask |= Matrix.kTranslate_Mask;\n        }\n        let m00:number = this.mValues[0];\n        let m01:number = this.mValues[1];\n        let m10:number = this.mValues[3];\n        let m11:number = this.mValues[4];\n        if (m01 != 0. || m10 != 0.) {\n            mask |= Matrix.kAffine_Mask;\n        }\n        if (m00 != 1. || m11 != 1.) {\n            mask |= Matrix.kScale_Mask;\n        }\n        if ((mask & Matrix.kPerspective_Mask) == 0) {\n            // map non-zero to 1\n            let im00:number = m00 != 0 ? 1 : 0;\n            let im01:number = m01 != 0 ? 1 : 0;\n            let im10:number = m10 != 0 ? 1 : 0;\n            let im11:number = m11 != 0 ? 1 : 0;\n            // record if the (p)rimary and (s)econdary diagonals are all 0 or\n            // all non-zero (answer is 0 or 1)\n            // true if both are 0\n            let dp0:number = (im00 | im11) ^ 1;\n            // true if both are 1\n            let dp1:number = im00 & im11;\n            // true if both are 0\n            let ds0:number = (im01 | im10) ^ 1;\n            // true if both are 1\n            let ds1:number = im01 & im10;\n            // return 1 if primary is 1 and secondary is 0 or\n            // primary is 0 and secondary is 1\n            mask |= ((dp0 & ds1) | (dp1 & ds0)) << Matrix.kRectStaysRect_Shift;\n        }\n        return mask;\n    }\n}\n\nexport module Matrix{\n/** Controlls how the src rect should align into the dst rect for\n        setRectToRect().\n    */\nexport enum ScaleToFit {\n\n    /**\n         * Scale in X and Y independently, so that src matches dst exactly.\n         * This may change the aspect ratio of the src.\n         */\n    FILL /*() {\n    }\n     */, /**\n         * Compute a scale that will maintain the original src aspect ratio,\n         * but will also ensure that src fits entirely inside dst. At least one\n         * axis (X or Y) will fit exactly. START aligns the result to the\n         * left and top edges of dst.\n         */\n    START /*() {\n    }\n     */, /**\n         * Compute a scale that will maintain the original src aspect ratio,\n         * but will also ensure that src fits entirely inside dst. At least one\n         * axis (X or Y) will fit exactly. The result is centered inside dst.\n         */\n    CENTER /*() {\n    }\n     */, /**\n         * Compute a scale that will maintain the original src aspect ratio,\n         * but will also ensure that src fits entirely inside dst. At least one\n         * axis (X or Y) will fit exactly. END aligns the result to the\n         * right and bottom edges of dst.\n         */\n    END /*() {\n    }\n     */ /*;\n     */}}\n\n    function Math_toRadians(angdeg:number):number {\n        return angdeg / 180.0 * Math.PI;\n    }\n}"
  },
  {
    "path": "src/android/graphics/Paint.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"Canvas.ts\"/>\n\nmodule android.graphics{\n    /**\n     * The Paint class holds the style and color information about how to draw\n     * geometries, text and bitmaps.\n     */\n    export class Paint{\n\n        private static FontMetrics_Size_Ascent = -0.9277344;\n        private static FontMetrics_Size_Bottom = 0.2709961;\n        private static FontMetrics_Size_Descent = 0.24414062;\n        private static FontMetrics_Size_Leading = 0;\n        private static FontMetrics_Size_Top = -1.05615234;\n\n        static DIRECTION_LTR:number = 0;\n        static DIRECTION_RTL:number = 1;\n\n        /**\n         * Option for getTextRunCursor to compute the valid cursor after\n         * offset or the limit of the context, whichever is less.\n         * @hide\n         */\n        static CURSOR_AFTER:number = 0;\n\n        /**\n         * Option for getTextRunCursor to compute the valid cursor at or after\n         * the offset or the limit of the context, whichever is less.\n         * @hide\n         */\n        static CURSOR_AT_OR_AFTER:number = 1;\n\n        /**\n         * Option for getTextRunCursor to compute the valid cursor before\n         * offset or the start of the context, whichever is greater.\n         * @hide\n         */\n        static CURSOR_BEFORE:number = 2;\n\n        /**\n         * Option for getTextRunCursor to compute the valid cursor at or before\n         * offset or the start of the context, whichever is greater.\n         * @hide\n         */\n        static CURSOR_AT_OR_BEFORE:number = 3;\n\n        /**\n         * Option for getTextRunCursor to return offset if the cursor at offset\n         * is valid, or -1 if it isn't.\n         * @hide\n         */\n        static CURSOR_AT:number = 4;\n\n        /**\n         * Maximum cursor option value.\n         */\n        private static CURSOR_OPT_MAX_VALUE:number = Paint.CURSOR_AT;\n\n\n        /**\n         * Paint flag that enables antialiasing when drawing.\n         *\n         * <p>Enabling this flag will cause all draw operations that support\n         * antialiasing to use it.</p>\n         *\n         * @see #Paint(int)\n         * @see #setFlags(int)\n         */\n        static ANTI_ALIAS_FLAG:number = 0x01;\n\n        /**\n         * Paint flag that enables bilinear sampling on scaled bitmaps.\n         *\n         * <p>If cleared, scaled bitmaps will be drawn with nearest neighbor\n         * sampling, likely resulting in artifacts. This should generally be on\n         * when drawing bitmaps, unless performance-bound (rendering to software\n         * canvas) or preferring pixelation artifacts to blurriness when scaling\n         * significantly.</p>\n         *\n         * <p>If bitmaps are scaled for device density at creation time (as\n         * resource bitmaps often are) the filtering will already have been\n         * done.</p>\n         *\n         * @see #Paint(int)\n         * @see #setFlags(int)\n         */\n        static FILTER_BITMAP_FLAG:number = 0x02;\n\n        /**\n         * Paint flag that enables dithering when blitting.\n         *\n         * <p>Enabling this flag applies a dither to any blit operation where the\n         * target's colour space is more constrained than the source.\n         *\n         * @see #Paint(int)\n         * @see #setFlags(int)\n         */\n        static DITHER_FLAG:number = 0x04;\n\n        /**\n         * Paint flag that applies an underline decoration to drawn text.\n         *\n         * @see #Paint(int)\n         * @see #setFlags(int)\n         */\n        static UNDERLINE_TEXT_FLAG:number = 0x08;\n\n        /**\n         * Paint flag that applies a strike-through decoration to drawn text.\n         *\n         * @see #Paint(int)\n         * @see #setFlags(int)\n         */\n        static STRIKE_THRU_TEXT_FLAG:number = 0x10;\n\n        /**\n         * Paint flag that applies a synthetic bolding effect to drawn text.\n         *\n         * <p>Enabling this flag will cause text draw operations to apply a\n         * simulated bold effect when drawing a {@link Typeface} that is not\n         * already bold.</p>\n         *\n         * @see #Paint(int)\n         * @see #setFlags(int)\n         */\n        static FAKE_BOLD_TEXT_FLAG:number = 0x20;\n\n        /**\n         * Paint flag that enables smooth linear scaling of text.\n         *\n         * <p>Enabling this flag does not actually scale text, but rather adjusts\n         * text draw operations to deal gracefully with smooth adjustment of scale.\n         * When this flag is enabled, font hinting is disabled to prevent shape\n         * deformation between scale factors, and glyph caching is disabled due to\n         * the large number of glyph images that will be generated.</p>\n         *\n         * <p>{@link #SUBPIXEL_TEXT_FLAG} should be used in conjunction with this\n         * flag to prevent glyph positions from snapping to whole pixel values as\n         * scale factor is adjusted.</p>\n         *\n         * @see #Paint(int)\n         * @see #setFlags(int)\n         */\n        static LINEAR_TEXT_FLAG:number = 0x40;\n\n        /**\n         * Paint flag that enables subpixel positioning of text.\n         *\n         * <p>Enabling this flag causes glyph advances to be computed with subpixel\n         * accuracy.</p>\n         *\n         * <p>This can be used with {@link #LINEAR_TEXT_FLAG} to prevent text from\n         * jittering during smooth scale transitions.</p>\n         *\n         * @see #Paint(int)\n         * @see #setFlags(int)\n         */\n        static SUBPIXEL_TEXT_FLAG:number = 0x80;\n\n        /** Legacy Paint flag, no longer used. */\n        static DEV_KERN_TEXT_FLAG:number = 0x100;\n\n        /** @hide bit mask for the flag enabling subpixel glyph rendering for text */\n        static LCD_RENDER_TEXT_FLAG:number = 0x200;\n\n        /**\n         * Paint flag that enables the use of bitmap fonts when drawing text.\n         *\n         * <p>Disabling this flag will prevent text draw operations from using\n         * embedded bitmap strikes in fonts, causing fonts with both scalable\n         * outlines and bitmap strikes to draw only the scalable outlines, and\n         * fonts with only bitmap strikes to not draw at all.</p>\n         *\n         * @see #Paint(int)\n         * @see #setFlags(int)\n         */\n        static EMBEDDED_BITMAP_TEXT_FLAG:number = 0x400;\n\n        /** @hide bit mask for the flag forcing freetype's autohinter on for text */\n        static AUTO_HINTING_TEXT_FLAG:number = 0x800;\n\n        /** @hide bit mask for the flag enabling vertical rendering for text */\n        static VERTICAL_TEXT_FLAG:number = 0x1000;\n\n        // we use this when we first create a paint\n        static DEFAULT_PAINT_FLAGS:number = Paint.DEV_KERN_TEXT_FLAG | Paint.EMBEDDED_BITMAP_TEXT_FLAG;\n\n\n\n        private mTextStyle = Paint.Style.FILL;\n        private mColor:number;\n        private mStrokeWidth:number;\n        private align:Paint.Align;\n        private mStrokeCap:Paint.Cap;\n        private mStrokeJoin:Paint.Join;\n        private textSize:number;\n        private textScaleX = 1;\n\n        private mFlag = 0;\n\n        /**\n         * @hide\n         */\n        hasShadow:boolean;\n\n        /**\n         * @hide\n         */\n        shadowDx:number = 0;\n\n        /**\n         * @hide\n         */\n        shadowDy:number = 0;\n\n        /**\n         * @hide\n         */\n        shadowRadius:number = 0;\n\n        /**\n         * @hide\n         */\n        shadowColor:number = 0;\n\n        drawableState:number[];\n\n\n        constructor(flag=0){\n            this.mFlag = flag;\n        }\n\n        /**\n         * Copy the fields from src into this paint. This is equivalent to calling\n         * get() on all of the src fields, and calling the corresponding set()\n         * methods on this.\n         */\n        set(src:Paint):void  {\n            if (this != src) {\n                // copy over the native settings\n                this.setClassVariablesFrom(src);\n            }\n        }\n        /**\n         * Set all class variables using current values from the given\n         * {@link Paint}.\n         */\n        private setClassVariablesFrom(paint:Paint):void  {\n            this.mTextStyle = paint.mTextStyle;\n            this.mColor = paint.mColor;\n            this.mStrokeWidth = paint.mStrokeWidth;\n            this.align = paint.align;\n            this.mStrokeCap = paint.mStrokeCap;\n            this.mStrokeJoin = paint.mStrokeJoin;\n            this.textSize = paint.textSize;\n            this.textScaleX = paint.textScaleX;\n            this.mFlag = paint.mFlag;\n            this.hasShadow = paint.hasShadow;\n            this.shadowDx = paint.shadowDx;\n            this.shadowDy = paint.shadowDy;\n            this.shadowRadius = paint.shadowRadius;\n            this.shadowColor = paint.shadowColor;\n            this.drawableState = paint.drawableState;\n            //Object.assign(this, paint);\n        }\n\n        /**\n         * Return the paint's style, used for controlling how primitives'\n         * geometries are interpreted (except for drawBitmap, which always assumes\n         * FILL_STYLE).\n         *\n         * @return the paint's style setting (Fill, Stroke, StrokeAndFill)\n         */\n        getStyle():Paint.Style  {\n            return this.mTextStyle;\n        }\n\n        /**\n         * Set the paint's style, used for controlling how primitives'\n         * geometries are interpreted (except for drawBitmap, which always assumes\n         * Fill).\n         *\n         * @param style The new style to set in the paint\n         */\n        setStyle(style:Paint.Style):void  {\n            this.mTextStyle = style;\n        }\n\n        /**\n         * Return the paint's flags. Use the Flag enum to test flag values.\n         *\n         * @return the paint's flags (see enums ending in _Flag for bit masks)\n         */\n        getFlags():number{\n            return this.mFlag;\n        }\n\n        /**\n         * Set the paint's flags. Use the Flag enum to specific flag values.\n         *\n         * @param flags The new flag bits for the paint\n         */\n        setFlags(flags:number):void{\n            this.mFlag = flags;\n        }\n\n        getTextScaleX():number {\n            return this.textScaleX;\n        }\n        setTextScaleX(scaleX:number):void {\n            this.textScaleX = scaleX;\n        }\n\n        /**\n         * Return the paint's color. Note that the color is a 32bit value\n         * containing alpha as well as r,g,b. This 32bit value is not premultiplied,\n         * meaning that its alpha can be any value, regardless of the values of\n         * r,g,b. See the Color class for more details.\n         *\n         * @return the paint's color (and alpha).\n         */\n        getColor():number{\n            return this.mColor;\n        }\n\n        /**\n         * Set the paint's color. Note that the color is an int containing alpha\n         * as well as r,g,b. This 32bit value is not premultiplied, meaning that\n         * its alpha can be any value, regardless of the values of r,g,b.\n         * See the Color class for more details.\n         *\n         * @param color The new color (including alpha) to set in the paint.\n         */\n        setColor(color:number){\n            this.mColor = color;\n        }\n\n        /**\n         * Helper to setColor(), that takes a,r,g,b and constructs the color int\n         *\n         * @param a The new alpha component (0..255) of the paint's color.\n         * @param r The new red component (0..255) of the paint's color.\n         * @param g The new green component (0..255) of the paint's color.\n         * @param b The new blue component (0..255) of the paint's color.\n         */\n        setARGB(a:number, r:number, g:number, b:number):void  {\n            this.setColor((a << 24) | (r << 16) | (g << 8) | b);\n        }\n\n        /**\n         * Helper to getColor() that just returns the color's alpha value. This is\n         * the same as calling getColor() >>> 24. It always returns a value between\n         * 0 (completely transparent) and 255 (completely opaque).\n         *\n         * @return the alpha component of the paint's color.\n         */\n        getAlpha():number{\n            return Color.alpha(this.mColor);\n        }\n\n        /**\n         * Helper to setColor(), that only assigns the color's alpha value,\n         * leaving its r,g,b values unchanged. Results are undefined if the alpha\n         * value is outside of the range [0..255]\n         *\n         * @param alpha set the alpha component [0..255] of the paint's color.\n         */\n        setAlpha(alpha:number){\n            this.setColor(Color.argb(alpha, Color.red(this.mColor), Color.green(this.mColor), Color.blue(this.mColor)));\n        }\n\n        /**\n         * Return the width for stroking.\n         * <p />\n         * A value of 0 strokes in hairline mode.\n         * Hairlines always draws a single pixel independent of the canva's matrix.\n         *\n         * @return the paint's stroke width, used whenever the paint's style is\n         *         Stroke or StrokeAndFill.\n         */\n        getStrokeWidth():number{\n            return this.mStrokeWidth;\n        }\n\n        /**\n         * Set the width for stroking.\n         * Pass 0 to stroke in hairline mode.\n         * Hairlines always draws a single pixel independent of the canva's matrix.\n         *\n         * @param width set the paint's stroke width, used whenever the paint's\n         *              style is Stroke or StrokeAndFill.\n         */\n        setStrokeWidth(width:number):void{\n            this.mStrokeWidth = width;\n        }\n\n        /**\n         * Return the paint's Cap, controlling how the start and end of stroked\n         * lines and paths are treated.\n         *\n         * @return the line cap style for the paint, used whenever the paint's\n         *         style is Stroke or StrokeAndFill.\n         */\n        getStrokeCap():Paint.Cap  {\n            return this.mStrokeCap;\n        }\n\n        /**\n         * Set the paint's Cap.\n         *\n         * @param cap set the paint's line cap style, used whenever the paint's\n         *            style is Stroke or StrokeAndFill.\n         */\n        setStrokeCap(cap:Paint.Cap):void  {\n            this.mStrokeCap = cap;\n        }\n\n        /**\n         * Return the paint's stroke join type.\n         *\n         * @return the paint's Join.\n         */\n        getStrokeJoin():Paint.Join  {\n            return this.mStrokeJoin\n        }\n\n        /**\n         * Set the paint's Join.\n         *\n         * @param join set the paint's Join, used whenever the paint's style is\n         *             Stroke or StrokeAndFill.\n         */\n        setStrokeJoin(join:Paint.Join):void  {\n            this.mStrokeJoin = join;\n        }\n\n\n\n        setAntiAlias(enable:boolean){\n            //no effect on web canvas\n            //http://stackoverflow.com/questions/4261090/html5-canvas-and-anti-aliasing\n        }\n        isAntiAlias():boolean {\n            //default true on web canvas\n            return true;\n        }\n\n        /**\n         * This draws a shadow layer below the main layer, with the specified\n         * offset and color, and blur radius. If radius is 0, then the shadow\n         * layer is removed.\n         */\n        setShadowLayer(radius:number, dx:number, dy:number, color:number):void  {\n            this.hasShadow = radius > 0.0;\n            this.shadowRadius = radius;\n            this.shadowDx = dx;\n            this.shadowDy = dy;\n            this.shadowColor = color;\n        }\n\n        /**\n         * Clear the shadow layer.\n         */\n        clearShadowLayer():void  {\n            this.hasShadow = false;\n        }\n\n        /**\n         * Return the paint's Align value for drawing text. This controls how the\n         * text is positioned relative to its origin. LEFT align means that all of\n         * the text will be drawn to the right of its origin (i.e. the origin\n         * specifieds the LEFT edge of the text) and so on.\n         *\n         * @return the paint's Align value for drawing text.\n         */\n        getTextAlign():Paint.Align  {\n            return this.align;\n        }\n\n        /**\n         * Set the paint's text alignment. This controls how the\n         * text is positioned relative to its origin. LEFT align means that all of\n         * the text will be drawn to the right of its origin (i.e. the origin\n         * specifieds the LEFT edge of the text) and so on.\n         *\n         * @param align set the paint's Align value for drawing text.\n         */\n        setTextAlign(align:Paint.Align){\n            this.align = align;\n        }\n\n        /**\n         * Return the paint's text size.\n         *\n         * @return the paint's text size.\n         */\n        getTextSize():number{\n            return this.textSize;\n        }\n\n        /**\n         * Set the paint's text size. This value must be > 0\n         *\n         * @param textSize set the paint's text size.\n         */\n        setTextSize(textSize:number){\n            this.textSize = textSize;\n        }\n\n\n        /**\n         * Return the distance above (negative) the baseline (ascent) based on the\n         * current typeface and text size.\n         *\n         * @return the distance above (negative) the baseline (ascent) based on the\n         *         current typeface and text size.\n         */\n        ascent():number {\n            return this.textSize * Paint.FontMetrics_Size_Ascent;\n        }\n\n        /**\n         * Return the distance below (positive) the baseline (descent) based on the\n         * current typeface and text size.\n         *\n         * @return the distance below (positive) the baseline (descent) based on\n         *         the current typeface and text size.\n         */\n        descent():number {\n            return this.textSize * Paint.FontMetrics_Size_Descent;\n        }\n\n        /**\n         * Return the font's interline spacing, given the Paint's settings for\n         * typeface, textSize, etc. If metrics is not null, return the fontmetric\n         * values in it. Note: all values have been converted to integers from\n         * floats, in such a way has to make the answers useful for both spacing\n         * and clipping. If you want more control over the rounding, call\n         * getFontMetrics().\n         *\n         * @return the font's interline spacing.\n         */\n        getFontMetricsInt(fmi:Paint.FontMetricsInt):number {\n            if(this.textSize==null){\n                console.warn('call Paint.getFontMetricsInt but textSize not init');\n                return 0;\n            }\n            if(fmi==null){\n                return Math.floor((Paint.FontMetrics_Size_Descent - Paint.FontMetrics_Size_Ascent) * this.textSize);\n            }\n            fmi.ascent = Math.floor(Paint.FontMetrics_Size_Ascent * this.textSize);\n            fmi.bottom = Math.floor(Paint.FontMetrics_Size_Bottom * this.textSize);\n            fmi.descent = Math.floor(Paint.FontMetrics_Size_Descent * this.textSize);\n            fmi.leading = Math.floor(Paint.FontMetrics_Size_Leading * this.textSize);\n            fmi.top = Math.floor(Paint.FontMetrics_Size_Top * this.textSize);\n            return fmi.descent - fmi.ascent;\n        }\n\n        /**\n         * Return the font's recommended interline spacing, given the Paint's\n         * settings for typeface, textSize, etc. If metrics is not null, return the\n         * fontmetric values in it.\n         *\n         * @param metrics If this object is not null, its fields are filled with\n         *                the appropriate values given the paint's text attributes.\n         * @return the font's recommended interline spacing.\n         */\n        getFontMetrics(metrics:Paint.FontMetrics):number {\n            if(this.textSize==null){\n                console.warn('call Paint.getFontMetrics but textSize not init');\n                return 0;\n            }\n            if(metrics==null){\n                return (Paint.FontMetrics_Size_Descent - Paint.FontMetrics_Size_Ascent) * this.textSize;\n            }\n            metrics.ascent = Paint.FontMetrics_Size_Ascent * this.textSize;\n            metrics.bottom = Paint.FontMetrics_Size_Bottom * this.textSize;\n            metrics.descent = Paint.FontMetrics_Size_Descent * this.textSize;\n            metrics.leading = Paint.FontMetrics_Size_Leading * this.textSize;\n            metrics.top = Paint.FontMetrics_Size_Top * this.textSize;\n            return metrics.descent - metrics.ascent;\n        }\n\n        /**\n         * Return the width of the text.\n         *\n         * @param text  The text to measure. Cannot be null.\n         * @param index The index of the first character to start measuring\n         * @param count THe number of characters to measure, beginning with start\n         * @return      The width of the text\n         */\n        measureText(text:string, index=0, count=text.length):number  {\n            return Canvas.measureText(text.substr(index, count), this.textSize) * this.textScaleX;\n        }\n\n        /**\n         * Return the advance widths for the characters in the string.\n         *\n         * @param text     The text to measure. Cannot be null.\n         * @param index    The index of the first char to to measure\n         * @param count    The number of chars starting with index to measure\n         * @param widths   array to receive the advance widths of the characters.\n         *                 Must be at least a large as count.\n         * @return         the actual number of widths returned.\n         */\n        getTextWidths_count(text:string, index:number, count:number, widths:number[]):number  {\n            return this.getTextWidths_end(text, index, index+count, widths);\n        }\n        /**\n         * Return the advance widths for the characters in the string.\n         *\n         * @param text   The text to measure. Cannot be null.\n         * @param start  The index of the first char to to measure\n         * @param end    The end of the text slice to measure\n         * @param widths array to receive the advance widths of the characters.\n         *               Must be at least a large as the text.\n         * @return       the number of unichars in the specified text.\n         */\n        getTextWidths_end(text:string, start:number, end:number, widths:number[]):number  {\n            if (text == null) {\n                throw Error(`new IllegalArgumentException(\"text cannot be null\")`);\n            }\n            if ((start | end | (end - start) | (text.length - end)) < 0) {\n                throw Error(`new IndexOutOfBoundsException()`);\n            }\n            if (end - start > widths.length) {\n                throw Error(`new ArrayIndexOutOfBoundsException()`);\n            }\n            if (text.length == 0 || start == end) {\n                return 0;\n            }\n\n            for (let i = start; i < end; i++) {\n                widths[i-start] = this.measureText(text[i]);\n            }\n            return end - start;\n        }\n\n        /**\n         * Return the advance widths for the characters in the string.\n         *\n         * @param text   The text to measure\n         * @param widths array to receive the advance widths of the characters.\n         *               Must be at least a large as the text.\n         * @return       the number of unichars in the specified text.\n         */\n        getTextWidths_2(text:string, widths:number[]):number  {\n            return this.getTextWidths_end(text, 0, text.length, widths);\n        }\n\n        /**\n         * @hide\n         */\n        getTextRunAdvances_count(chars:string, index:number, count:number, contextIndex:number, contextCount:number,\n                           flags:number, advances:number[], advancesIndex:number):number  {\n            return this.getTextRunAdvances_end(chars, index, index+count, contextIndex, contextCount, flags, advances, advancesIndex);\n        }\n\n        /**\n         * @hide\n         */\n        getTextRunAdvances_end(text:string, start:number, end:number, contextStart:number, contextEnd:number,\n                               flags:number, advances:number[], advancesIndex:number):number  {\n            if (text == null) {\n                throw Error(`new IllegalArgumentException(\"text cannot be null\")`);\n            }\n            if (flags != Paint.DIRECTION_LTR && flags != Paint.DIRECTION_RTL) {\n                throw Error(`new IllegalArgumentException(\"unknown flags value: \" + flags)`);\n            }\n            if ((start | end | contextStart | contextEnd | advancesIndex | (end - start)\n                | (start - contextStart) | (contextEnd - end) | (text.length - contextEnd)\n                | (advances == null ? 0 : (advances.length - advancesIndex - (end - start)))) < 0) {\n                throw Error(`new IndexOutOfBoundsException()`);\n            }\n            if (text.length == 0 || start == end) {\n                return 0;\n            }\n\n            let totalAdvance = 0;\n            for (let i = start; i < end; i++) {\n                let width = this.measureText(text[i]);\n                if(advances) advances[i-start+advancesIndex] = width;\n                totalAdvance += width;\n            }\n            return totalAdvance;\n        }\n\n\n        /**\n         * Returns the next cursor position in the run.  This avoids placing the\n         * cursor between surrogates, between characters that form conjuncts,\n         * between base characters and combining marks, or within a reordering\n         * cluster.\n         *\n         * <p>ContextStart and offset are relative to the start of text.\n         * The context is the shaping context for cursor movement, generally\n         * the bounds of the metric span enclosing the cursor in the direction of\n         * movement.\n         *\n         * <p>If cursorOpt is {@link #CURSOR_AT} and the offset is not a valid\n         * cursor position, this returns -1.  Otherwise this will never return a\n         * value before contextStart or after contextStart + contextLength.\n         *\n         * @param text the text\n         * @param contextStart the start of the context\n         * @param contextLength the length of the context\n         * @param flags either {@link #DIRECTION_RTL} or {@link #DIRECTION_LTR}\n         * @param offset the cursor position to move from\n         * @param cursorOpt how to move the cursor, one of {@link #CURSOR_AFTER},\n         * {@link #CURSOR_AT_OR_AFTER}, {@link #CURSOR_BEFORE},\n         * {@link #CURSOR_AT_OR_BEFORE}, or {@link #CURSOR_AT}\n         * @return the offset of the next position, or -1\n         * @hide\n         */\n        getTextRunCursor_len(text:string, contextStart:number, contextLength:number, flags:number, offset:number, cursorOpt:number):number {\n            let contextEnd:number = contextStart + contextLength;\n            if (((contextStart | contextEnd | offset | (contextEnd - contextStart) | (offset - contextStart) | (contextEnd - offset)\n                | (text.length - contextEnd) | cursorOpt) < 0) || cursorOpt > Paint.CURSOR_OPT_MAX_VALUE) {\n                throw Error(`new IndexOutOfBoundsException()`);\n            }\n            const scalarArray = androidui.util.ArrayCreator.newNumberArray(contextLength);\n            this.getTextRunAdvances_count(text, contextStart, contextLength, contextStart, contextLength, flags, scalarArray, 0);\n            let pos = offset - contextStart;\n            switch (cursorOpt) {\n                case Paint.CURSOR_AFTER:\n                    if (pos < contextLength) {\n                        pos += 1;\n                    }\n                // fall through\n                case Paint.CURSOR_AT_OR_AFTER:\n                    while (pos < contextLength && scalarArray[pos] == 0) {\n                        ++pos;\n                    }\n                    break;\n                case Paint.CURSOR_BEFORE:\n                    if (pos > 0) {\n                        --pos;\n                    }\n                // fall through\n                case Paint.CURSOR_AT_OR_BEFORE:\n                    while (pos > 0 && scalarArray[pos] == 0) {\n                        --pos;\n                    }\n                    break;\n                case Paint.CURSOR_AT:\n                default:\n                    if (scalarArray[pos] == 0) {\n                        pos = -1;\n                    }\n                    break;\n            }\n\n            if (pos != -1) {\n                pos += contextStart;\n            }\n\n            return pos;\n        }\n\n        /**\n         * Returns the next cursor position in the run.  This avoids placing the\n         * cursor between surrogates, between characters that form conjuncts,\n         * between base characters and combining marks, or within a reordering\n         * cluster.\n         *\n         * <p>ContextStart, contextEnd, and offset are relative to the start of\n         * text.  The context is the shaping context for cursor movement, generally\n         * the bounds of the metric span enclosing the cursor in the direction of\n         * movement.\n         *\n         * <p>If cursorOpt is {@link #CURSOR_AT} and the offset is not a valid\n         * cursor position, this returns -1.  Otherwise this will never return a\n         * value before contextStart or after contextEnd.\n         *\n         * @param text the text\n         * @param contextStart the start of the context\n         * @param contextEnd the end of the context\n         * @param flags either {@link #DIRECTION_RTL} or {@link #DIRECTION_LTR}\n         * @param offset the cursor position to move from\n         * @param cursorOpt how to move the cursor, one of {@link #CURSOR_AFTER},\n         * {@link #CURSOR_AT_OR_AFTER}, {@link #CURSOR_BEFORE},\n         * {@link #CURSOR_AT_OR_BEFORE}, or {@link #CURSOR_AT}\n         * @return the offset of the next position, or -1\n         * @hide\n         */\n        getTextRunCursor_end(text:string, contextStart:number, contextEnd:number, flags:number, offset:number, cursorOpt:number):number  {\n            if (((contextStart | contextEnd | offset | (contextEnd - contextStart) | (offset - contextStart) | (contextEnd - offset)\n                | (text.length - contextEnd) | cursorOpt) < 0) || cursorOpt > Paint.CURSOR_OPT_MAX_VALUE) {\n                throw Error(`new IndexOutOfBoundsException()`);\n            }\n            let contextLen:number = contextEnd - contextStart;\n            return this.getTextRunCursor_len(text, 0, contextLen, flags, offset - contextStart, cursorOpt);\n        }\n\n        isEmpty():boolean {\n            return this.mColor==null\n                && this.align==null\n                && this.mStrokeWidth==null\n                && this.mStrokeCap==null\n                && this.mStrokeJoin==null\n                && !this.hasShadow\n                && this.textSize==null\n            ;\n        }\n\n        applyToCanvas(canvas:Canvas):void {\n\n            if(this.mColor!=null) {\n                canvas.setColor(this.mColor, this.getStyle());\n            }\n\n            if(this.align!=null){\n                canvas.setTextAlign(Paint.Align[this.align].toLowerCase());\n            }\n            if(this.mStrokeWidth!=null){\n                canvas.setLineWidth(this.mStrokeWidth);\n            }\n            if(this.mStrokeCap!=null){\n                canvas.setLineCap(Paint.Cap[this.mStrokeCap].toLowerCase());\n            }\n            if(this.mStrokeJoin!=null){\n                canvas.setLineJoin(Paint.Join[this.mStrokeJoin].toLowerCase());\n            }\n\n            if(this.hasShadow){\n                canvas.setShadow(this.shadowRadius, this.shadowDx, this.shadowDy, this.shadowColor);\n            }\n\n            if(this.textSize!=null){\n                canvas.setFontSize(this.textSize);\n            }\n\n            if(this.textScaleX!=1){\n                canvas.scale(this.textScaleX, 1);\n            }\n        }\n    }\n\n    export module Paint{\n\n        export enum Align{\n            LEFT,\n            CENTER,\n            RIGHT,\n        }\n\n        /**\n         * Class that describes the various metrics for a font at a given text size.\n         * Remember, Y values increase going down, so those values will be positive,\n         * and values that measure distances going up will be negative. This class\n         * is returned by getFontMetrics().\n         */\n        export class FontMetrics {\n\n            /**\n             * The maximum distance above the baseline for the tallest glyph in\n             * the font at a given text size.\n             */\n            top:number = 0;\n\n            /**\n             * The recommended distance above the baseline for singled spaced text.\n             */\n            ascent:number = 0;\n\n            /**\n             * The recommended distance below the baseline for singled spaced text.\n             */\n            descent:number = 0;\n\n            /**\n             * The maximum distance below the baseline for the lowest glyph in\n             * the font at a given text size.\n             */\n            bottom:number = 0;\n\n            /**\n             * The recommended additional space to add between lines of text.\n             */\n            leading:number = 0;\n        }\n\n        /**\n         * Convenience method for callers that want to have FontMetrics values as\n         * integers.\n         */\n        export class FontMetricsInt {\n\n            top:number = 0;\n\n            ascent:number = 0;\n\n            descent:number = 0;\n\n            bottom:number = 0;\n\n            leading:number = 0;\n\n            toString():string  {\n                return \"FontMetricsInt: top=\" + this.top + \" ascent=\" + this.ascent + \" descent=\" + this.descent + \" bottom=\" + this.bottom + \" leading=\" + this.leading;\n            }\n        }\n\n        /**\n         * The Style specifies if the primitive being drawn is filled, stroked, or\n         * both (in the same color). The default is FILL.\n         */\n        export enum Style {\n\n            /**\n             * Geometry and text drawn with this style will be filled, ignoring all\n             * stroke-related settings in the paint.\n             */\n            FILL,\n            /**\n             * Geometry and text drawn with this style will be stroked, respecting\n             * the stroke-related fields on the paint.\n             */\n            STROKE,\n            /**\n             * Geometry and text drawn with this style will be both filled and\n             * stroked at the same time, respecting the stroke-related fields on\n             * the paint. This mode can give unexpected results if the geometry\n             * is oriented counter-clockwise. This restriction does not apply to\n             * either FILL or STROKE.\n             */\n            FILL_AND_STROKE\n        }\n\n            /**\n             * The Cap specifies the treatment for the beginning and ending of\n             * stroked lines and paths. The default is BUTT.\n             */\n        export enum Cap {\n\n            /**\n             * The stroke ends with the path, and does not project beyond it.\n             */\n            BUTT,\n            /**\n             * The stroke projects out as a semicircle, with the center at the\n             * end of the path.\n             */\n            ROUND,\n            /**\n             * The stroke projects out as a square, with the center at the end\n             * of the path.\n             */\n            SQUARE\n        }\n\n            /**\n             * The Join specifies the treatment where lines and curve segments\n             * join on a stroked path. The default is MITER.\n             */\n        export enum Join {\n\n            /**\n             * The outer edges of a join meet at a sharp angle\n             */\n            MITER,\n            /**\n             * The outer edges of a join meet in a circular arc.\n             */\n            ROUND,\n            /**\n             * The outer edges of a join meet with a straight line\n             */\n            BEVEL\n\n        }\n    }\n}"
  },
  {
    "path": "src/android/graphics/Path.ts",
    "content": "/**\n * Created by linfaxin on 15/12/6.\n * empty class: not support draw/clip path now.\n */\nmodule android.graphics{\n    export class Path{\n\n        reset(){\n\n        }\n    }\n}"
  },
  {
    "path": "src/android/graphics/PixelFormat.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule android.graphics {\n    export class PixelFormat {\n        static UNKNOWN = 0;\n        static TRANSLUCENT = -3;\n        static TRANSPARENT = -2;\n        static OPAQUE = -1;\n        static RGBA_8888 = 1;\n        static RGBX_8888 = 2;\n        static RGB_888 = 3;\n        static RGB_565 = 4;\n    }\n}\n"
  },
  {
    "path": "src/android/graphics/Point.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule android.graphics {\n    /**\n     * Point holds two integer coordinates\n     */\n    export class Point {\n        x:number = 0;\n        y:number = 0;\n\n        constructor();\n        constructor(x:number, y:number);\n        constructor(src:Point);\n        constructor(...args) {\n            if (args.length === 1) {\n                let src:Point = args[0];\n                this.x = src.x;\n                this.y = src.y;\n            } else {\n                let [x=0, y=0] = args;\n                this.x = x;\n                this.y = y;\n            }\n        }\n\n        /**\n         * Set the point's x and y coordinates\n         */\n        set(x:number, y:number) {\n            this.x = x;\n            this.y = y;\n        }\n\n        /**\n         * Negate the point's coordinates\n         */\n        negate() {\n            this.x = -this.x;\n            this.y = -this.y;\n        }\n\n        /**\n         * Offset the point's coordinates by dx, dy\n         */\n        offset(dx:number, dy:number) {\n            this.x += dx;\n            this.y += dy;\n        }\n\n        /**\n         * Returns true if the point's coordinates equal (x,y)\n         */\n        equals(x:number, y:number):boolean ;\n        equals(o:any):boolean;\n        equals(...args):boolean {\n            if (args.length === 2) {\n                let [x=0,y=0] = args;\n                return this.x == x && this.y == y\n            } else {\n                let o = args[0];\n                if (this === o) return true;\n                if (!o || !(o instanceof Point)) return false;\n                let point = o;\n                if (this.x != point.x) return false;\n                if (this.y != point.y) return false;\n                return true;\n            }\n        }\n\n        toString():String {\n            return \"Point(\" + this.x + \", \" + this.y + \")\";\n        }\n    }\n}"
  },
  {
    "path": "src/android/graphics/Rect.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../java/lang/StringBuilder.ts\"/>\nmodule android.graphics{\n    import StringBuilder = java.lang.StringBuilder;\n    /**\n     * Rect holds four integer coordinates for a rectangle. The rectangle is\n     * represented by the coordinates of its 4 edges (left, top, right bottom).\n     * These fields can be accessed directly. Use width() and height() to retrieve\n     * the rectangle's width and height. Note: most methods do not check to see that\n     * the coordinates are sorted correctly (i.e. left <= right and top <= bottom).\n     * AndroidUI NOTE: current impl not limit integer to set.\n     */\n    export class Rect {\n        left : number = 0;\n        top : number = 0;\n        right : number = 0;\n        bottom : number = 0;\n\n        /**\n         * Create a new empty Rect. All coordinates are initialized to 0.\n         */\n        constructor();\n        /**\n         * Create a new rectangle, initialized with the values in the specified\n         * rectangle (which is left unmodified).\n         *\n         * @param r The rectangle whose coordinates are copied into the new\n         *          rectangle.\n         */\n        constructor(r : Rect);\n        /**\n         * Create a new rectangle with the specified coordinates. Note: no range\n         * checking is performed, so the caller must ensure that left <= right and\n         * top <= bottom.\n         *\n         * @param left   The X coordinate of the left side of the rectangle\n         * @param top    The Y coordinate of the top of the rectangle\n         * @param right  The X coordinate of the right side of the rectangle\n         * @param bottom The Y coordinate of the bottom of the rectangle\n         */\n        constructor(left : number, top : number, right : number, bottom : number);\n        constructor(...args){\n            if(args.length===1){\n                let rect : Rect = args[0];\n                this.left = rect.left;\n                this.top = rect.top;\n                this.right = rect.right;\n                this.bottom = rect.bottom;\n            }else if(args.length === 4 || args.length === 0){\n                let [left = 0, t = 0, right = 0, bottom = 0] = args;\n                this.left = left || 0;\n                this.top = t || 0;\n                this.right = right || 0;\n                this.bottom = bottom || 0;\n            }\n        }\n\n        equals(r : Rect) : boolean{\n            if (this === r) return true;\n            if (!r || !(r instanceof Rect)) return false;\n\n            return this.left === r.left && this.top === r.top\n                && this.right === r.right && this.bottom === r.bottom;\n        }\n\n        toString() : string {\n            let sb = new StringBuilder();\n            sb.append(\"Rect(\"); sb.append(this.left); sb.append(\", \");\n            sb.append(this.top); sb.append(\" - \"); sb.append(this.right);\n            sb.append(\", \"); sb.append(this.bottom); sb.append(\")\");\n            return sb.toString();\n        }\n\n        /**\n         * Return a string representation of the rectangle in a compact form.\n         */\n        toShortString(sb = new StringBuilder()) : string {\n            sb.setLength(0);\n            sb.append('['); sb.append(this.left); sb.append(',');\n            sb.append(this.top); sb.append(\"][\"); sb.append(this.right);\n            sb.append(','); sb.append(this.bottom); sb.append(']');\n            return sb.toString();\n        }\n\n        /**\n         * Return a string representation of the rectangle in a well-defined format.\n         *\n         * <p>You can later recover the Rect from this string through\n         * {@link #unflattenFromString(String)}.\n         *\n         * @return Returns a new String of the form \"left top right bottom\"\n         */\n        flattenToString() : string {\n            let sb = new StringBuilder(32);\n            // WARNING: Do not change the format of this string, it must be\n            // preserved because Rects are saved in this flattened format.\n            sb.append(this.left);\n            sb.append(' ');\n            sb.append(this.top);\n            sb.append(' ');\n            sb.append(this.right);\n            sb.append(' ');\n            sb.append(this.bottom);\n            return sb.toString();\n        }\n\n        /**\n         * Returns a Rect from a string of the form returned by {@link #flattenToString},\n         * or null if the string is not of that form.\n         */\n        static unflattenFromString(str : string) : Rect {\n            let parts = str.split(\" \");\n            return new Rect(Number.parseInt(parts[0]),\n                Number.parseInt(parts[1]),\n                Number.parseInt(parts[2]),\n                Number.parseInt(parts[3]));\n        }\n\n        /**\n         * Returns true if the rectangle is empty (left >= right or top >= bottom)\n         */\n        isEmpty() : boolean {\n            return this.left >= this.right || this.top >= this.bottom;\n        }\n\n        /**\n         * @return the rectangle's width. This does not check for a valid rectangle\n         * (i.e. left <= right) so the result may be negative.\n         */\n        width() : number {\n            return this.right - this.left;\n        }\n\n        /**\n         * @return the rectangle's height. This does not check for a valid rectangle\n         * (i.e. top <= bottom) so the result may be negative.\n         */\n        height() : number {\n            return this.bottom - this.top;\n        }\n\n        /**\n         * @return the horizontal center of the rectangle. If the computed value\n         *         is fractional, this method returns the largest integer that is\n         *         less than the computed value.\n         */\n        centerX() : number {\n            return (this.left + this.right) >> 1;\n        }\n\n        /**\n         * @return the vertical center of the rectangle. If the computed value\n         *         is fractional, this method returns the largest integer that is\n         *         less than the computed value.\n         */\n        centerY() : number {\n            return (this.top + this.bottom) >> 1;\n        }\n\n        /**\n         * @return the exact horizontal center of the rectangle as a float.\n         */\n        exactCenterX() : number {\n            return (this.left + this.right) * 0.5;\n        }\n\n        /**\n         * @return the exact vertical center of the rectangle as a float.\n         */\n        exactCenterY() : number {\n            return (this.top + this.bottom) * 0.5;\n        }\n\n        /**\n         * Set the rectangle to (0,0,0,0)\n         */\n        setEmpty() {\n            this.left = this.right = this.top = this.bottom = 0;\n        }\n        /**\n         * Copy the coordinates from src into this rectangle.\n         *\n         * @param src The rectangle whose coordinates are copied into this\n         *           rectangle.\n         */\n        set(src : Rect);\n        /**\n         * Set the rectangle's coordinates to the specified values. Note: no range\n         * checking is performed, so it is up to the caller to ensure that\n         * left <= right and top <= bottom.\n         *\n         * @param left   The X coordinate of the left side of the rectangle\n         * @param top    The Y coordinate of the top of the rectangle\n         * @param right  The X coordinate of the right side of the rectangle\n         * @param bottom The Y coordinate of the bottom of the rectangle\n         */\n        set(left, top, right, bottom);\n        set(...args){\n            if (args.length === 1) {\n                let rect : Rect = args[0];\n                [this.left, this.top, this.right, this.bottom] = [rect.left, rect.top, rect.right, rect.bottom];\n            }else {\n                let [left = 0, t = 0, right = 0, bottom = 0] = args;\n                this.left = left || 0;\n                this.top = t || 0;\n                this.right = right || 0;\n                this.bottom = bottom || 0;\n            }\n        }\n\n        /**\n         * Offset the rectangle by adding dx to its left and right coordinates, and\n         * adding dy to its top and bottom coordinates.\n         *\n         * @param dx The amount to add to the rectangle's left and right coordinates\n         * @param dy The amount to add to the rectangle's top and bottom coordinates\n         */\n        offset(dx, dy) {\n            this.left += dx;\n            this.top += dy;\n            this.right += dx;\n            this.bottom += dy;\n        }\n\n        /**\n         * Offset the rectangle to a specific (left, top) position,\n         * keeping its width and height the same.\n         *\n         * @param newLeft   The new \"left\" coordinate for the rectangle\n         * @param newTop    The new \"top\" coordinate for the rectangle\n         */\n        offsetTo(newLeft, newTop) {\n            this.right += newLeft - this.left;\n            this.bottom += newTop - this.top;\n            this.left = newLeft;\n            this.top = newTop;\n        }\n\n        /**\n         * Inset the rectangle by (dx,dy). If dx is positive, then the sides are\n         * moved inwards, making the rectangle narrower. If dx is negative, then the\n         * sides are moved outwards, making the rectangle wider. The same holds true\n         * for dy and the top and bottom.\n         *\n         * @param dx The amount to add(subtract) from the rectangle's left(right)\n         * @param dy The amount to add(subtract) from the rectangle's top(bottom)\n         */\n        inset(dx, dy) {\n            this.left += dx;\n            this.top += dy;\n            this.right -= dx;\n            this.bottom -= dy;\n        }\n\n        /**\n         * Returns true if (x,y) is inside the rectangle. The left and top are\n         * considered to be inside, while the right and bottom are not. This means\n         * that for a x,y to be contained: left <= x < right and top <= y < bottom.\n         * An empty rectangle never contains any point.\n         *\n         * @param x The X coordinate of the point being tested for containment\n         * @param y The Y coordinate of the point being tested for containment\n         * @return true iff (x,y) are contained by the rectangle, where containment\n         *              means left <= x < right and top <= y < bottom\n         */\n        contains(x : number , y : number) : boolean;\n        /**\n         * Returns true iff the 4 specified sides of a rectangle are inside or equal\n         * to this rectangle. i.e. is this rectangle a superset of the specified\n         * rectangle. An empty rectangle never contains another rectangle.\n         *\n         * @param left The left side of the rectangle being tested for containment\n         * @param top The top of the rectangle being tested for containment\n         * @param right The right side of the rectangle being tested for containment\n         * @param bottom The bottom of the rectangle being tested for containment\n         * @return true iff the the 4 specified sides of a rectangle are inside or\n         *              equal to this rectangle\n         */\n        contains(left : number, top : number, right : number, bottom : number) :boolean;\n        /**\n         * Returns true iff the specified rectangle r is inside or equal to this\n         * rectangle. An empty rectangle never contains another rectangle.\n         *\n         * @param r The rectangle being tested for containment.\n         * @return true iff the specified rectangle r is inside or equal to this\n         *              rectangle\n         */\n        contains(r:Rect) : boolean;\n        contains(...args) : boolean{\n            if(args.length === 1){\n                let r : Rect = args[0];\n                // check for empty first\n                return this.left < this.right && this.top < this.bottom\n                        // now check for containment\n                    && this.left <= r.left && this.top <= r.top && this.right >= r.right && this.bottom >= r.bottom;\n\n            }else if(args.length === 2){\n                let [x, y] = args;\n                return this.left < this.right && this.top < this.bottom  // check for empty first\n                    && x >= this.left && x < this.right && y >= this.top && y < this.bottom;\n\n            }else{\n                let [left = 0, t = 0, right = 0, bottom = 0] = args;\n                // check for empty first\n                return this.left < this.right && this.top < this.bottom\n                        // now check for containment\n                    && this.left <= left && this.top <= t\n                    && this.right >= right && this.bottom >= bottom;\n            }\n        }\n\n        /**\n         * If the specified rectangle intersects this rectangle, return true and set\n         * this rectangle to that intersection, otherwise return false and do not\n         * change this rectangle. No check is performed to see if either rectangle\n         * is empty. To just test for intersection, use intersects()\n         *\n         * @param r The rectangle being intersected with this rectangle.\n         * @return true if the specified rectangle and this rectangle intersect\n         *              (and this rectangle is then set to that intersection) else\n         *              return false and do not change this rectangle.\n         */\n        intersect(r : Rect) : boolean;\n        /**\n         * If the rectangle specified by left,top,right,bottom intersects this\n         * rectangle, return true and set this rectangle to that intersection,\n         * otherwise return false and do not change this rectangle. No check is\n         * performed to see if either rectangle is empty. Note: To just test for\n         * intersection, use {@link #intersects(Rect, Rect)}.\n         *\n         * @param left The left side of the rectangle being intersected with this\n         *             rectangle\n         * @param top The top of the rectangle being intersected with this rectangle\n         * @param right The right side of the rectangle being intersected with this\n         *              rectangle.\n         * @param bottom The bottom of the rectangle being intersected with this\n         *             rectangle.\n         * @return true if the specified rectangle and this rectangle intersect\n         *              (and this rectangle is then set to that intersection) else\n         *              return false and do not change this rectangle.\n         */\n        intersect(left : number, top : number, right : number, bottom : number) : boolean;\n        intersect(...args) : boolean{\n            if(args.length===1){\n                let rect : Rect = args[0];\n                return this.intersect(rect.left, rect.top, rect.right, rect.bottom);\n            }else{\n                let [left = 0, t = 0, right = 0, bottom = 0] = args;\n                if (this.left < right && left < this.right && this.top < bottom && t < this.bottom) {\n                    if (this.left < left) this.left = left;\n                    if (this.top < t) this.top = t;\n                    if (this.right > right) this.right = right;\n                    if (this.bottom > bottom) this.bottom = bottom;\n                    return true;\n                }\n                return false;\n            }\n        }\n\n        /**\n         * If rectangles a and b intersect, return true and set this rectangle to\n         * that intersection, otherwise return false and do not change this\n         * rectangle. No check is performed to see if either rectangle is empty.\n         * To just test for intersection, use intersects()\n         *\n         * @param a The first rectangle being intersected with\n         * @param b The second rectangle being intersected with\n         * @return true iff the two specified rectangles intersect. If they do, set\n         *              this rectangle to that intersection. If they do not, return\n         *              false and do not change this rectangle.\n         */\n        public setIntersect(a:Rect, b:Rect):boolean {\n            if (a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom) {\n                this.left = Math.max(a.left, b.left);\n                this.top = Math.max(a.top, b.top);\n                this.right = Math.min(a.right, b.right);\n                this.bottom = Math.min(a.bottom, b.bottom);\n                return true;\n            }\n            return false;\n        }\n\n        /**\n         * Returns true if this rectangle intersects the specified rectangle.\n         * In no event is this rectangle modified. No check is performed to see\n         * if either rectangle is empty. To record the intersection, use intersect()\n         * or setIntersect().\n         *\n         * @param rect the rect\n         * @return true iff the specified rectangle intersects this rectangle. In\n         *              no event is this rectangle modified.\n         */\n        intersects(rect : Rect) : boolean;\n        /**\n         * Returns true if this rectangle intersects the specified rectangle.\n         * In no event is this rectangle modified. No check is performed to see\n         * if either rectangle is empty. To record the intersection, use intersect()\n         * or setIntersect().\n         *\n         * @param left The left side of the rectangle being tested for intersection\n         * @param top The top of the rectangle being tested for intersection\n         * @param right The right side of the rectangle being tested for\n         *              intersection\n         * @param bottom The bottom of the rectangle being tested for intersection\n         * @return true iff the specified rectangle intersects this rectangle. In\n         *              no event is this rectangle modified.\n         */\n        intersects(left : number, top : number, right : number, bottom : number) : boolean;\n        intersects(...args) : boolean{\n            if(args.length===1){\n                let rect : Rect = args[0];\n                return this.intersects(rect.left, rect.top, rect.right, rect.bottom);\n            }else{\n                let [left = 0, t = 0, right = 0, bottom = 0] = args;\n                return this.left < right && left < this.right && this.top < bottom && t < this.bottom;\n            }\n        }\n\n        /**\n         * Returns true iff the two specified rectangles intersect. In no event are\n         * either of the rectangles modified. To record the intersection,\n         * use {@link #intersect(Rect)} or {@link #setIntersect(Rect, Rect)}.\n         *\n         * @param a The first rectangle being tested for intersection\n         * @param b The second rectangle being tested for intersection\n         * @return true iff the two specified rectangles intersect. In no event are\n         *              either of the rectangles modified.\n         */\n        public static intersects(a:Rect, b:Rect):boolean {\n            return a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom;\n        }\n\n\n        /**\n         * Update this Rect to enclose itself and the specified rectangle. If the\n         * specified rectangle is empty, nothing is done. If this rectangle is empty\n         * it is set to the specified rectangle.\n         *\n         * @param r The rectangle being unioned with this rectangle\n         */\n        union(r : Rect);\n        /**\n         * Update this Rect to enclose itself and the [x,y] coordinate. There is no\n         * check to see that this rectangle is non-empty.\n         *\n         * @param x The x coordinate of the point to add to the rectangle\n         * @param y The y coordinate of the point to add to the rectangle\n         */\n        union(x : number, y : number);\n        /**\n         * Update this Rect to enclose itself and the specified rectangle. If the\n         * specified rectangle is empty, nothing is done. If this rectangle is empty\n         * it is set to the specified rectangle.\n         *\n         * @param left The left edge being unioned with this rectangle\n         * @param top The top edge being unioned with this rectangle\n         * @param right The right edge being unioned with this rectangle\n         * @param bottom The bottom edge being unioned with this rectangle\n         */\n        union(left : number, top : number, right : number, bottom :number);\n        union(...args) {\n            if(arguments.length === 1){\n                let rect : Rect = args[0];\n                this.union(rect.left, rect.top, rect.right, rect.bottom);\n\n            }else if(arguments.length === 2){\n                let [x=0, y=0] = args;\n                if (x < this.left) {\n                    this.left = x;\n                } else if (x > this.right) {\n                    this.right = x;\n                }\n                if (y < this.top) {\n                    this.top = y;\n                } else if (y > this.bottom) {\n                    this.bottom = y;\n                }\n            }else{\n                let left = args[0];\n                let top = args[1];\n                let right = args[2];\n                let bottom = args[3];\n\n                if ((left < right) && (top < bottom)) {\n                    if ((this.left < this.right) && (this.top < this.bottom)) {\n                        if (this.left > left) this.left = left;\n                        if (this.top > top) this.top = top;\n                        if (this.right < right) this.right = right;\n                        if (this.bottom < bottom) this.bottom = bottom;\n                    } else {\n                        this.left = left;\n                        this.top = top;\n                        this.right = right;\n                        this.bottom = bottom;\n                    }\n                }\n            }\n        }\n\n        /**\n         * Swap top/bottom or left/right if there are flipped (i.e. left > right\n         * and/or top > bottom). This can be called if\n         * the edges are computed separately, and may have crossed over each other.\n         * If the edges are already correct (i.e. left <= right and top <= bottom)\n         * then nothing is done.\n         */\n        sort() {\n            if (this.left > this.right) {\n                [this.left, this.right] = [this.right, this.left];\n            }\n            if (this.top > this.bottom) {\n                [this.top, this.bottom] = [this.bottom, this.top];\n            }\n        }\n\n        /**\n         * Scales up the rect by the given scale.\n         * @hide\n         */\n        scale(scale : number) {\n            if (scale != 1) {\n                this.left = this.left * scale;\n                this.top = this.top * scale;\n                this.right = this.right * scale;\n                this.bottom = this.bottom * scale;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/android/graphics/RectF.ts",
    "content": "/**\n * Created by linfaxin on 15/12/6.\n * NOTE: only extends Rect, Rect no integer vale limit now.\n */\n///<reference path=\"Rect.ts\"/>\n\nmodule android.graphics{\n    export class RectF extends Rect{\n    }\n}"
  },
  {
    "path": "src/android/graphics/drawable/Animatable.ts",
    "content": "/*\n * Copyright (C) 2009 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\nmodule android.graphics.drawable {\n/**\n * Interface that drawables suporting animations should implement.\n */\nexport interface Animatable {\n\n    /**\n     * Starts the drawable's animation.\n     */\n    start():void ;\n\n    /**\n     * Stops the drawable's animation.\n     */\n    stop():void ;\n\n    /**\n     * Indicates whether the animation is running.\n     * \n     * @return True if the animation is running, false otherwise.\n     */\n    isRunning():boolean ;\n}\n    export module Animatable{\n        export function isImpl(obj){\n            return obj && obj['start'] && obj['stop'] && obj['isRunning'];\n        }\n    }\n}"
  },
  {
    "path": "src/android/graphics/drawable/AnimationDrawable.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/content/res/Resources.ts\"/>\n///<reference path=\"../../../android/os/SystemClock.ts\"/>\n///<reference path=\"../../../java/lang/System.ts\"/>\n///<reference path=\"../../../java/lang/Runnable.ts\"/>\n///<reference path=\"../../../android/graphics/drawable/Animatable.ts\"/>\n///<reference path=\"../../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../../android/graphics/drawable/DrawableContainer.ts\"/>\n\nmodule android.graphics.drawable {\n    import Resources = android.content.res.Resources;\n    import SystemClock = android.os.SystemClock;\n    import System = java.lang.System;\n    import Runnable = java.lang.Runnable;\n    import Animatable = android.graphics.drawable.Animatable;\n    import Drawable = android.graphics.drawable.Drawable;\n    import DrawableContainer = android.graphics.drawable.DrawableContainer;\n    import TypedArray = android.content.res.TypedArray;\n    /**\n     *\n     * An object used to create frame-by-frame animations, defined by a series of Drawable objects,\n     * which can be used as a View object's background.\n     * <p>\n     * The simplest way to create a frame-by-frame animation is to define the animation in an XML\n     * file, placed in the res/drawable/ folder, and set it as the background to a View object. Then, call\n     * {@link #start()} to run the animation.\n     * <p>\n     * An AnimationDrawable defined in XML consists of a single <code>&lt;animation-list></code> element,\n     * and a series of nested <code>&lt;item></code> tags. Each item defines a frame of the animation.\n     * See the example below.\n     * </p>\n     * <p>spin_animation.xml file in res/drawable/ folder:</p>\n     * <pre>&lt;!-- Animation frames are wheel0.png -- wheel5.png files inside the\n     * res/drawable/ folder --&gt;\n     * &lt;animation-list android:id=&quot;@+id/selected&quot; android:oneshot=&quot;false&quot;&gt;\n     *    &lt;item android:drawable=&quot;@drawable/wheel0&quot; android:duration=&quot;50&quot; /&gt;\n     *    &lt;item android:drawable=&quot;@drawable/wheel1&quot; android:duration=&quot;50&quot; /&gt;\n     *    &lt;item android:drawable=&quot;@drawable/wheel2&quot; android:duration=&quot;50&quot; /&gt;\n     *    &lt;item android:drawable=&quot;@drawable/wheel3&quot; android:duration=&quot;50&quot; /&gt;\n     *    &lt;item android:drawable=&quot;@drawable/wheel4&quot; android:duration=&quot;50&quot; /&gt;\n     *    &lt;item android:drawable=&quot;@drawable/wheel5&quot; android:duration=&quot;50&quot; /&gt;\n     * &lt;/animation-list&gt;</pre>\n     *\n     * <p>Here is the code to load and play this animation.</p>\n     * <pre>\n     * // Load the ImageView that will host the animation and\n     * // set its background to our AnimationDrawable XML resource.\n     * ImageView img = (ImageView)findViewById(R.id.spinning_wheel_image);\n     * img.setBackgroundResource(R.drawable.spin_animation);\n     *\n     * // Get the background, which has been compiled to an AnimationDrawable object.\n     * AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground();\n     *\n     * // Start the animation (looped playback by default).\n     * frameAnimation.start();\n     * </pre>\n     *\n     * <div class=\"special reference\">\n     * <h3>Developer Guides</h3>\n     * <p>For more information about animating with {@code AnimationDrawable}, read the\n     * <a href=\"{@docRoot}guide/topics/graphics/drawable-animation.html\">Drawable Animation</a>\n     * developer guide.</p>\n     * </div>\n     *\n     * @attr ref android.R.styleable#AnimationDrawable_visible\n     * @attr ref android.R.styleable#AnimationDrawable_variablePadding\n     * @attr ref android.R.styleable#AnimationDrawable_oneshot\n     * @attr ref android.R.styleable#AnimationDrawableItem_duration\n     * @attr ref android.R.styleable#AnimationDrawableItem_drawable\n     */\n    export class AnimationDrawable extends DrawableContainer implements Runnable, Animatable {\n\n        private mAnimationState:AnimationDrawable.AnimationState;\n\n        private mCurFrame:number = -1;\n\n        //private mMutated:boolean;\n\n        constructor(state?:AnimationDrawable.AnimationState) {\n            super();\n            let _as:AnimationDrawable.AnimationState = new AnimationDrawable.AnimationState(state, this);\n            this.mAnimationState = _as;\n            this.setConstantState(_as);\n            if (state != null) {\n                this.setFrame(0, true, false);\n            }\n        }\n\n        setVisible(visible:boolean, restart:boolean):boolean {\n            let changed:boolean = super.setVisible(visible, restart);\n            if (visible) {\n                if (changed || restart) {\n                    this.setFrame(0, true, true);\n                }\n            } else {\n                this.unscheduleSelf(this);\n            }\n            return changed;\n        }\n\n        /**\n         * <p>Starts the animation, looping if necessary. This method has no effect\n         * if the animation is running. Do not call this in the {@link android.app.Activity#onCreate}\n         * method of your activity, because the {@link android.graphics.drawable.AnimationDrawable} is\n         * not yet fully attached to the window. If you want to play\n         * the animation immediately, without requiring interaction, then you might want to call it\n         * from the {@link android.app.Activity#onWindowFocusChanged} method in your activity,\n         * which will get called when Android brings your window into focus.</p>\n         *\n         * @see #isRunning()\n         * @see #stop()\n         */\n        start():void {\n            if (!this.isRunning()) {\n                this.run();\n            }\n        }\n\n        /**\n         * <p>Stops the animation. This method has no effect if the animation is\n         * not running.</p>\n         *\n         * @see #isRunning()\n         * @see #start()\n         */\n        stop():void {\n            if (this.isRunning()) {\n                this.unscheduleSelf(this);\n            }\n        }\n\n        /**\n         * <p>Indicates whether the animation is currently running or not.</p>\n         *\n         * @return true if the animation is running, false otherwise\n         */\n        isRunning():boolean {\n            return this.mCurFrame > -1;\n        }\n\n        /**\n         * <p>This method exists for implementation purpose only and should not be\n         * called directly. Invoke {@link #start()} instead.</p>\n         *\n         * @see #start()\n         */\n        run():void {\n            this.nextFrame(false);\n        }\n\n        unscheduleSelf(what:Runnable):void {\n            this.mCurFrame = -1;\n            super.unscheduleSelf(what);\n        }\n\n        /**\n         * @return The number of frames in the animation\n         */\n        getNumberOfFrames():number {\n            return this.mAnimationState.getChildCount();\n        }\n\n        /**\n         * @return The Drawable at the specified frame index\n         */\n        getFrame(index:number):Drawable {\n            return this.mAnimationState.getChild(index);\n        }\n\n        /**\n         * @return The duration in milliseconds of the frame at the\n         * specified index\n         */\n        getDuration(i:number):number {\n            return this.mAnimationState.mDurations[i];\n        }\n\n        /**\n         * @return True of the animation will play once, false otherwise\n         */\n        isOneShot():boolean {\n            return this.mAnimationState.mOneShot;\n        }\n\n        /**\n         * Sets whether the animation should play once or repeat.\n         *\n         * @param oneShot Pass true if the animation should only play once\n         */\n        setOneShot(oneShot:boolean):void {\n            this.mAnimationState.mOneShot = oneShot;\n        }\n\n        /**\n         * Add a frame to the animation\n         *\n         * @param frame The frame to add\n         * @param duration How long in milliseconds the frame should appear\n         */\n        addFrame(frame:Drawable, duration:number):void {\n            this.mAnimationState.addFrame(frame, duration);\n            if (this.mCurFrame < 0) {\n                this.setFrame(0, true, false);\n            }\n        }\n\n        private nextFrame(unschedule:boolean):void {\n            let next:number = this.mCurFrame + 1;\n            const N:number = this.mAnimationState.getChildCount();\n            if (next >= N) {\n                next = 0;\n            }\n            this.setFrame(next, unschedule, !this.mAnimationState.mOneShot || next < (N - 1));\n        }\n\n        private setFrame(frame:number, unschedule:boolean, animate:boolean):void {\n            if (frame >= this.mAnimationState.getChildCount()) {\n                return;\n            }\n            this.mCurFrame = frame;\n            this.selectDrawable(frame);\n            if (unschedule) {\n                this.unscheduleSelf(this);\n            }\n            if (animate) {\n                // Unscheduling may have clobbered this value; restore it to record that we're animating\n                this.mCurFrame = frame;\n                this.scheduleSelf(this, SystemClock.uptimeMillis() + this.mAnimationState.mDurations[frame]);\n            }\n        }\n\n        inflate(r:Resources, parser:HTMLElement):void {\n            super.inflate(r, parser);\n            let a:TypedArray = r.obtainAttributes(parser);\n            this.mAnimationState.setVariablePadding(a.getBoolean(\"android:variablePadding\", false));\n            this.mAnimationState.mOneShot = a.getBoolean(\"android:oneshot\", false);\n            a.recycle();\n\n            //parse children\n            for (let child of Array.from(parser.children)) {\n                let item = <HTMLElement>child;\n                if (item.tagName.toLowerCase() !== 'item') {\n                    continue;\n                }\n                a = r.obtainAttributes(item);\n\n                let duration:number = a.getInt(\"android:duration\", -1);\n                if (duration < 0) {\n                    throw Error(`new XmlPullParserException(parser.getPositionDescription() + \": <item> tag requires a 'duration' attribute\")`);\n                }\n                let dr:Drawable = a.getDrawable(\"android:drawable\");\n                a.recycle();\n                if (!dr && item.children[0] instanceof HTMLElement) {\n                    dr = Drawable.createFromXml(r, <HTMLElement>item.children[0]);\n                }\n                if (!dr) {\n                    throw Error(`new XmlPullParserException(<item> tag requires a 'drawable' attribute or child tag defining a drawable)`);\n                }\n                this.mAnimationState.addFrame(dr, duration);\n                if (dr != null) {\n                    dr.setCallback(this);\n                }\n            }\n            this.setFrame(0, true, false);\n        }\n\n        mutate():Drawable {\n            if (!this.mMutated && super.mutate() == this) {\n                this.mAnimationState.mDurations = [...this.mAnimationState.mDurations];\n                this.mMutated = true;\n            }\n            return this;\n        }\n\n\n    }\n\n    export module AnimationDrawable {\n        export class AnimationState extends DrawableContainer.DrawableContainerState {\n\n            private mDurations:number[];\n\n            private mOneShot:boolean;\n\n            constructor(orig:AnimationState, owner:AnimationDrawable) {\n                super(orig, owner);\n                if (orig != null) {\n                    this.mDurations = orig.mDurations;\n                    this.mOneShot = orig.mOneShot;\n                } else {\n                    this.mDurations = androidui.util.ArrayCreator.newNumberArray(this.getCapacity());\n                    this.mOneShot = true;\n                }\n            }\n\n            newDrawable():Drawable {\n                return new AnimationDrawable(this);\n            }\n\n            addFrame(dr:Drawable, dur:number):void {\n                // Do not combine the following. The array index must be evaluated before\n                // the array is accessed because super.addChild(dr) has a side effect on mDurations.\n                let pos:number = super.addChild(dr);\n                this.mDurations[pos] = dur;\n            }\n\n            //growArray(oldSize:number, newSize:number):void  {\n            //    super.growArray(oldSize, newSize);\n            //    let newDurations:number[] = androidui.util.ArrayCreator.newNumberArray(newSize);\n            //    System.arraycopy(this.mDurations, 0, newDurations, 0, oldSize);\n            //    this.mDurations = newDurations;\n            //}\n        }\n    }\n\n}"
  },
  {
    "path": "src/android/graphics/drawable/ClipDrawable.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../../android/content/res/Resources.ts\"/>\n///<reference path=\"../../../android/view/Gravity.ts\"/>\n///<reference path=\"../../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../../java/lang/Runnable.ts\"/>\n\nmodule android.graphics.drawable {\nimport Canvas = android.graphics.Canvas;\nimport Rect = android.graphics.Rect;\nimport Resources = android.content.res.Resources;\nimport Gravity = android.view.Gravity;\nimport Drawable = android.graphics.drawable.Drawable;\nimport Runnable = java.lang.Runnable;\n    import TypedArray = android.content.res.TypedArray;\n/**\n * A Drawable that clips another Drawable based on this Drawable's current\n * level value.  You can control how much the child Drawable gets clipped in width\n * and height based on the level, as well as a gravity to control where it is\n * placed in its overall container.  Most often used to implement things like\n * progress bars, by increasing the drawable's level with {@link\n * android.graphics.drawable.Drawable#setLevel(int) setLevel()}.\n * <p class=\"note\"><strong>Note:</strong> The drawable is clipped completely and not visible when\n * the level is 0 and fully revealed when the level is 10,000.</p>\n *\n * <p>It can be defined in an XML file with the <code>&lt;clip></code> element.  For more\n * information, see the guide to <a\n * href=\"{@docRoot}guide/topics/resources/drawable-resource.html\">Drawable Resources</a>.</p>\n *\n * @attr ref android.R.styleable#ClipDrawable_clipOrientation\n * @attr ref android.R.styleable#ClipDrawable_gravity\n * @attr ref android.R.styleable#ClipDrawable_drawable\n */\nexport class ClipDrawable extends Drawable implements Drawable.Callback {\n\n    private mClipState:ClipDrawable.ClipState;\n\n    private mTmpRect:Rect = new Rect();\n\n    static HORIZONTAL:number = 1;\n\n    static VERTICAL:number = 2;\n\n\n    constructor(state?:ClipDrawable.ClipState);\n    /**\n     * @param orientation Bitwise-or of {@link #HORIZONTAL} and/or {@link #VERTICAL}\n     */\n    constructor(drawable:Drawable, gravity:number, orientation:number);\n    constructor(...args) {\n        super();\n        if(args.length<=1){\n            this.mClipState = new ClipDrawable.ClipState(args[0], this);\n        }else{\n            this.mClipState = new ClipDrawable.ClipState(null, this);\n\n            let drawable:Drawable = args[0];\n            let gravity:number = args[1];\n            let orientation:number = args[2];\n\n            this.mClipState.mDrawable = drawable;\n            this.mClipState.mGravity = gravity;\n            this.mClipState.mOrientation = orientation;\n            if (drawable != null) {\n                drawable.setCallback(this);\n            }\n        }\n    }\n\n    inflate(r:Resources, parser:HTMLElement):void  {\n       super.inflate(r, parser);\n       let a:TypedArray = r.obtainAttributes(parser);\n       let orientation:number = a.getInt(\"android:clipOrientation\", ClipDrawable.HORIZONTAL);\n        let gStr:string = a.getString(\"android:gravity\");\n        let g = Gravity.parseGravity(gStr, Gravity.LEFT);\n       let dr:Drawable = a.getDrawable(\"android:drawable\");\n       a.recycle();\n        if (!dr && parser.children[0] instanceof HTMLElement) {\n            dr = Drawable.createFromXml(r, <HTMLElement>parser.children[0]);\n        }\n       if (dr == null) {\n           throw Error(`new IllegalArgumentException(\"No drawable specified for <clip>\")`);\n       }\n       this.mClipState.mDrawable = dr;\n       this.mClipState.mOrientation = orientation;\n       this.mClipState.mGravity = g;\n       dr.setCallback(this);\n    }\n\n\n    drawableSizeChange(who:android.graphics.drawable.Drawable):void {\n        const callback = this.getCallback();\n        if (callback != null && callback.drawableSizeChange) {\n            callback.drawableSizeChange(this);\n        }\n    }\n\n\n    // overrides from Drawable.Callback\n    invalidateDrawable(who:Drawable):void  {\n        const callback:Drawable.Callback = this.getCallback();\n        if (callback != null) {\n            callback.invalidateDrawable(this);\n        }\n    }\n\n    scheduleDrawable(who:Drawable, what:Runnable, when:number):void  {\n        const callback:Drawable.Callback = this.getCallback();\n        if (callback != null) {\n            callback.scheduleDrawable(this, what, when);\n        }\n    }\n\n    unscheduleDrawable(who:Drawable, what:Runnable):void  {\n        const callback:Drawable.Callback = this.getCallback();\n        if (callback != null) {\n            callback.unscheduleDrawable(this, what);\n        }\n    }\n\n    //// overrides from Drawable\n    //getChangingConfigurations():number  {\n    //    return super.getChangingConfigurations() | this.mClipState.mChangingConfigurations | this.mClipState.mDrawable.getChangingConfigurations();\n    //}\n\n    getPadding(padding:Rect):boolean  {\n        // XXX need to adjust padding!\n        return this.mClipState.mDrawable.getPadding(padding);\n    }\n\n    setVisible(visible:boolean, restart:boolean):boolean  {\n        this.mClipState.mDrawable.setVisible(visible, restart);\n        return super.setVisible(visible, restart);\n    }\n\n    setAlpha(alpha:number):void  {\n        this.mClipState.mDrawable.setAlpha(alpha);\n    }\n\n    getAlpha():number  {\n        return this.mClipState.mDrawable.getAlpha();\n    }\n\n    //setColorFilter(cf:ColorFilter):void  {\n    //    this.mClipState.mDrawable.setColorFilter(cf);\n    //}\n\n    getOpacity():number  {\n        return this.mClipState.mDrawable.getOpacity();\n    }\n\n    isStateful():boolean  {\n        return this.mClipState.mDrawable.isStateful();\n    }\n\n    protected onStateChange(state:number[]):boolean  {\n        return this.mClipState.mDrawable.setState(state);\n    }\n\n    protected onLevelChange(level:number):boolean  {\n        this.mClipState.mDrawable.setLevel(level);\n        this.invalidateSelf();\n        return true;\n    }\n\n    protected onBoundsChange(bounds:Rect):void  {\n        this.mClipState.mDrawable.setBounds(bounds);\n    }\n\n    draw(canvas:Canvas):void  {\n        if (this.mClipState.mDrawable.getLevel() == 0) {\n            return;\n        }\n        const r:Rect = this.mTmpRect;\n        const bounds:Rect = this.getBounds();\n        let level:number = this.getLevel();\n        let w:number = bounds.width();\n        //mClipState.mDrawable.getIntrinsicWidth();\n        const iw:number = 0;\n        if ((this.mClipState.mOrientation & ClipDrawable.HORIZONTAL) != 0) {\n            w -= (w - iw) * (10000 - level) / 10000;\n        }\n        let h:number = bounds.height();\n        //mClipState.mDrawable.getIntrinsicHeight();\n        const ih:number = 0;\n        if ((this.mClipState.mOrientation & ClipDrawable.VERTICAL) != 0) {\n            h -= (h - ih) * (10000 - level) / 10000;\n        }\n        //const layoutDirection:number = this.getLayoutDirection();\n        Gravity.apply(this.mClipState.mGravity, w, h, bounds, r);//, layoutDirection);\n        if (w > 0 && h > 0) {\n            canvas.save();\n            canvas.clipRect(r);\n            this.mClipState.mDrawable.draw(canvas);\n            canvas.restore();\n        }\n    }\n\n    getIntrinsicWidth():number  {\n        return this.mClipState.mDrawable.getIntrinsicWidth();\n    }\n\n    getIntrinsicHeight():number  {\n        return this.mClipState.mDrawable.getIntrinsicHeight();\n    }\n\n    getConstantState():Drawable.ConstantState  {\n        if (this.mClipState.canConstantState()) {\n            //this.mClipState.mChangingConfigurations = this.getChangingConfigurations();\n            return this.mClipState;\n        }\n        return null;\n    }\n\n    ///** @hide */\n    //setLayoutDirection(layoutDirection:number):void  {\n    //    this.mClipState.mDrawable.setLayoutDirection(layoutDirection);\n    //    super.setLayoutDirection(layoutDirection);\n    //}\n\n}\n\nexport module ClipDrawable{\nexport class ClipState implements Drawable.ConstantState {\n\n    mDrawable:Drawable;\n\n    //mChangingConfigurations:number = 0;\n\n    mOrientation:number = 0;\n\n    mGravity:number = 0;\n\n    private mCheckedConstantState:boolean;\n\n    private mCanConstantState:boolean;\n\n    constructor( orig:ClipState, owner:ClipDrawable) {\n        if (orig != null) {\n            this.mDrawable = orig.mDrawable.getConstantState().newDrawable();\n            this.mDrawable.setCallback(owner);\n            //this.mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection());\n            this.mOrientation = orig.mOrientation;\n            this.mGravity = orig.mGravity;\n            this.mCheckedConstantState = this.mCanConstantState = true;\n        }\n    }\n\n    newDrawable():Drawable  {\n        return new ClipDrawable(this);\n    }\n\n    //getChangingConfigurations():number  {\n    //    return this.mChangingConfigurations;\n    //}\n\n    canConstantState():boolean  {\n        if (!this.mCheckedConstantState) {\n            this.mCanConstantState = this.mDrawable.getConstantState() != null;\n            this.mCheckedConstantState = true;\n        }\n        return this.mCanConstantState;\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/graphics/drawable/ClipRoundRectDrawable.ts",
    "content": "/**\n * Created by linfaxin on 16/1/3.\n * AndroidUI drawable\n */\n///<reference path=\"Drawable.ts\"/>\n///<reference path=\"../Canvas.ts\"/>\n\n//TODO move to androidui/drawable dir\nmodule android.graphics.drawable{\n    import Canvas = android.graphics.Canvas;\n\n    export class ClipRoundRectDrawable extends Drawable implements Drawable.Callback{\n        private mState:DrawableState;\n        private mMutated = false;\n\n        constructor(drawable:Drawable, radiusTopLeft:number, radiusTopRight=radiusTopLeft, radiusBottomRight=radiusTopRight, radiusBottomLeft=radiusBottomRight) {\n            super();\n            this.mState = new DrawableState(null, this);\n            this.mState.mDrawable = drawable;\n            this.mState.mRadiusTopLeft = radiusTopLeft;\n            this.mState.mRadiusTopRight = radiusTopRight;\n            this.mState.mRadiusBottomRight = radiusBottomRight;\n            this.mState.mRadiusBottomLeft = radiusBottomLeft;\n\n            if (drawable != null) {\n                drawable.setCallback(this);\n            }\n        }\n\n        drawableSizeChange(who:android.graphics.drawable.Drawable):any {\n            const callback = this.getCallback();\n            if (callback != null && callback.drawableSizeChange) {\n                callback.drawableSizeChange(this);\n            }\n        }\n\n        invalidateDrawable(who:android.graphics.drawable.Drawable):void {\n            const callback = this.getCallback();\n            if (callback != null) {\n                callback.invalidateDrawable(this);\n            }\n        }\n\n        scheduleDrawable(who:android.graphics.drawable.Drawable, what:java.lang.Runnable, when:number):void {\n            const callback = this.getCallback();\n            if (callback != null) {\n                callback.scheduleDrawable(this, what, when);\n            }\n        }\n\n        unscheduleDrawable(who:android.graphics.drawable.Drawable, what:java.lang.Runnable):void {\n            const callback = this.getCallback();\n            if (callback != null) {\n                callback.unscheduleDrawable(this, what);\n            }\n        }\n\n        draw(canvas:Canvas) {\n            if(!this.mState.mRadiusTopLeft && !this.mState.mRadiusBottomRight && !this.mState.mRadiusTopRight && !this.mState.mRadiusBottomLeft){\n                this.mState.mDrawable.draw(canvas);\n                return;\n            }\n            let saveCount:number = canvas.save();\n            canvas.clipRoundRect(this.getBounds(), this.mState.mRadiusTopLeft, this.mState.mRadiusBottomRight,\n                this.mState.mRadiusTopRight, this.mState.mRadiusBottomLeft);\n            this.mState.mDrawable.draw(canvas);\n            canvas.restoreToCount(saveCount);\n        }\n\n\n        getPadding(padding:Rect):boolean  {\n            return this.mState.mDrawable.getPadding(padding);\n        }\n\n        setVisible(visible:boolean, restart:boolean):boolean {\n            this.mState.mDrawable.setVisible(visible, restart);\n            return super.setVisible(visible, restart);\n        }\n\n\n        setAlpha(alpha:number) {\n            this.mState.mDrawable.setAlpha(alpha);\n        }\n\n        getAlpha():number {\n            return this.mState.mDrawable.getAlpha();\n        }\n\n        getOpacity():number {\n            return this.mState.mDrawable.getOpacity();\n        }\n\n        isStateful():boolean {\n            return this.mState.mDrawable.isStateful();\n        }\n\n        protected onStateChange(state:Array<number>):boolean {\n            let changed = this.mState.mDrawable.setState(state);\n            this.onBoundsChange(this.getBounds());\n            return changed;\n        }\n\n        protected onBoundsChange(bounds:android.graphics.Rect):void  {\n            this.mState.mDrawable.setBounds(bounds.left, bounds.top, bounds.right, bounds.bottom);\n        }\n\n        getIntrinsicWidth():number {\n            return this.mState.mDrawable.getIntrinsicWidth();\n        }\n\n        getIntrinsicHeight():number {\n            return this.mState.mDrawable.getIntrinsicHeight();\n        }\n        getConstantState():Drawable.ConstantState {\n            if (this.mState.canConstantState()) {\n                //this.mState.mChangingConfigurations = getChangingConfigurations();\n                return this.mState;\n            }\n            return null;\n        }\n        mutate():Drawable {\n            if (!this.mMutated && super.mutate() == this) {\n                this.mState.mDrawable.mutate();\n                this.mMutated = true;\n            }\n            return this;\n        }\n        getDrawable():Drawable {\n            return this.mState.mDrawable;\n        }\n    }\n\n    class DrawableState implements Drawable.ConstantState{\n        mDrawable:Drawable;\n        mRadiusTopLeft = 0;\n        mRadiusTopRight = 0;\n        mRadiusBottomRight = 0;\n        mRadiusBottomLeft = 0;\n        mCheckedConstantState:boolean;\n        mCanConstantState:boolean;\n\n        constructor(orig:DrawableState, owner:ClipRoundRectDrawable) {\n            if (orig != null) {\n                this.mDrawable = orig.mDrawable.getConstantState().newDrawable();\n                this.mDrawable.setCallback(owner);\n                //this.mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection());\n                this.mRadiusTopLeft = orig.mRadiusTopLeft;\n                this.mRadiusTopRight = orig.mRadiusTopRight;\n                this.mRadiusBottomRight = orig.mRadiusBottomRight;\n                this.mRadiusBottomLeft = orig.mRadiusBottomLeft;\n                this.mCheckedConstantState = this.mCanConstantState = true;\n            }\n        }\n\n        newDrawable():Drawable {\n            let drawable = new ClipRoundRectDrawable(null, 0);\n            (<any>drawable).mState = new DrawableState(this, drawable);\n            return drawable;\n        }\n\n        canConstantState():boolean {\n            if (!this.mCheckedConstantState) {\n                this.mCanConstantState = this.mDrawable.getConstantState() != null;\n                this.mCheckedConstantState = true;\n            }\n\n            return this.mCanConstantState;\n        }\n\n    }\n}"
  },
  {
    "path": "src/android/graphics/drawable/ColorDrawable.ts",
    "content": "/*\n * Copyright (C) 2008 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"Drawable.ts\"/>\n///<reference path=\"../Canvas.ts\"/>\n///<reference path=\"../Paint.ts\"/>\n\nmodule android.graphics.drawable{\n    /**\n     * A specialized Drawable that fills the Canvas with a specified color.\n     * Note that a ColorDrawable ignores the ColorFilter.\n     *\n     * <p>It can be defined in an XML file with the <code>&lt;color></code> element.</p>\n     *\n     * @attr ref android.R.styleable#ColorDrawable_color\n     */\n    export class ColorDrawable extends Drawable{\n        private mState:ColorState;\n        private mMutated = false;\n        private mPaint = new Paint();\n\n        /**\n         * Creates a new ColorDrawable with the specified color.\n         *\n         * @param color The color to draw.\n         */\n        constructor(color?:number){\n            super();\n            this.mState = new ColorState();\n            if(color!==undefined){\n                this.setColor(color);\n            }\n        }\n        _setStateCopyFrom(state:any){\n            this.mState = new ColorState(<ColorState>state);\n        }\n        /**\n         * A mutable BitmapDrawable still shares its Bitmap with any other Drawable\n         * that comes from the same resource.\n         *\n         * @return This drawable.\n         */\n        mutate():Drawable {\n            if (!this.mMutated && super.mutate() == this) {\n                this.mState = new ColorState(this.mState);\n                this.mMutated = true;\n            }\n            return this;\n        }\n        draw(canvas:Canvas) {\n            if ((this.mState.mUseColor >>> 24) != 0) {\n                this.mPaint.setColor(this.mState.mUseColor);\n                canvas.drawRect(this.getBounds(), this.mPaint);\n            }\n        }\n\n        /**\n         * Gets the drawable's color value.\n         *\n         * @return int The color to draw.\n         */\n        getColor():number {\n            return this.mState.mUseColor;\n        }\n\n        /**\n         * Sets the drawable's color value. This action will clobber the results of prior calls to\n         * {@link #setAlpha(int)} on this object, which side-affected the underlying color.\n         *\n         * @param color The color to draw.\n         */\n        setColor(color:number) {\n            if (this.mState.mBaseColor != color || this.mState.mUseColor != color) {\n                this.invalidateSelf();\n                this.mState.mBaseColor = this.mState.mUseColor = color;\n            }\n        }\n\n        /**\n         * Returns the alpha value of this drawable's color.\n         *\n         * @return A value between 0 and 255.\n         */\n        getAlpha():number {\n            return this.mState.mUseColor >>> 24;\n        }\n\n        /**\n         * Sets the color's alpha value.\n         *\n         * @param alpha The alpha value to set, between 0 and 255.\n         */\n        setAlpha(alpha:number) {\n            alpha += alpha >> 7;   // make it 0..256\n            let baseAlpha = this.mState.mBaseColor >>> 24;\n            let useAlpha = baseAlpha * alpha >> 8;\n            let oldUseColor = this.mState.mUseColor;\n            this.mState.mUseColor = (this.mState.mBaseColor << 8 >>> 8) | (useAlpha << 24);\n            if (oldUseColor != this.mState.mUseColor) {\n                this.invalidateSelf();\n            }\n        }\n        getOpacity():number {\n            switch (this.mState.mUseColor >>> 24) {\n                case 255:\n                    return PixelFormat.OPAQUE;\n                case 0:\n                    return PixelFormat.TRANSPARENT;\n            }\n            return PixelFormat.TRANSLUCENT;\n        }\n\n\n        inflate(r:android.content.res.Resources, parser:HTMLElement):void {\n            super.inflate(r, parser);\n\n            let state = this.mState;\n            state.mBaseColor = androidui.attr.AttrValueParser.parseColor(r, parser.innerText, state.mBaseColor);\n            state.mUseColor = state.mBaseColor;\n        }\n\n        getConstantState():Drawable.ConstantState {\n            return this.mState;\n        }\n\n    }\n\n\n    class ColorState implements Drawable.ConstantState{\n\n        mBaseColor = 0;\n        mUseColor = 0;\n        constructor(state?:ColorState){\n            if (state != null) {\n                this.mBaseColor = state.mBaseColor;\n                this.mUseColor = state.mUseColor;\n            }\n        }\n\n        newDrawable():Drawable {\n            let c =  new ColorDrawable();\n            c._setStateCopyFrom(this);\n            return c;\n        }\n    }\n}"
  },
  {
    "path": "src/android/graphics/drawable/Drawable.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../Rect.ts\"/>\n///<reference path=\"../PixelFormat.ts\"/>\n///<reference path=\"../../../java/lang/ref/WeakReference.ts\"/>\n///<reference path=\"../../../java/lang/Runnable.ts\"/>\n///<reference path=\"../../util/StateSet.ts\"/>\n///<reference path=\"../Canvas.ts\"/>\n\nmodule android.graphics.drawable {\n\n    import Rect = android.graphics.Rect;\n    import PixelFormat = android.graphics.PixelFormat;\n    import WeakReference = java.lang.ref.WeakReference;\n    import Runnable = java.lang.Runnable;\n    import StateSet = android.util.StateSet;\n    import Canvas = android.graphics.Canvas;\n    import Resources = android.content.res.Resources;\n    import NetDrawable = androidui.image.NetDrawable;\n\n    /**\n     * A Drawable is a general abstraction for \"something that can be drawn.\"  Most\n     * often you will deal with Drawable as the type of resource retrieved for\n     * drawing things to the screen; the Drawable class provides a generic API for\n     * dealing with an underlying visual resource that may take a variety of forms.\n     * Unlike a {@link android.view.View}, a Drawable does not have any facility to\n     * receive events or otherwise interact with the user.\n     *\n     * <p>In addition to simple drawing, Drawable provides a number of generic\n     * mechanisms for its client to interact with what is being drawn:\n     *\n     * <ul>\n     *     <li> The {@link #setBounds} method <var>must</var> be called to tell the\n     *     Drawable where it is drawn and how large it should be.  All Drawables\n     *     should respect the requested size, often simply by scaling their\n     *     imagery.  A client can find the preferred size for some Drawables with\n     *     the {@link #getIntrinsicHeight} and {@link #getIntrinsicWidth} methods.\n     *\n     *     <li> The {@link #getPadding} method can return from some Drawables\n     *     information about how to frame content that is placed inside of them.\n     *     For example, a Drawable that is intended to be the frame for a button\n     *     widget would need to return padding that correctly places the label\n     *     inside of itself.\n     *\n     *     <li> The {@link #setState} method allows the client to tell the Drawable\n     *     in which state it is to be drawn, such as \"focused\", \"selected\", etc.\n     *     Some drawables may modify their imagery based on the selected state.\n     *\n     *     <li> The {@link #setLevel} method allows the client to supply a single\n     *     continuous controller that can modify the Drawable is displayed, such as\n     *     a battery level or progress level.  Some drawables may modify their\n     *     imagery based on the current level.\n     *\n     *     <li> A Drawable can perform animations by calling back to its client\n     *     through the {@link Callback} interface.  All clients should support this\n     *     interface (via {@link #setCallback}) so that animations will work.  A\n     *     simple way to do this is through the system facilities such as\n     *     {@link android.view.View#setBackgroundDrawable(Drawable)} and\n     *     {@link android.widget.ImageView}.\n     * </ul>\n     *\n     * Though usually not visible to the application, Drawables may take a variety\n     * of forms:\n     *\n     * <ul>\n     *     <li> <b>Bitmap</b>: the simplest Drawable, a PNG or JPEG image.\n     *     <li> <b>Nine Patch</b>: an extension to the PNG format allows it to\n     *     specify information about how to stretch it and place things inside of\n     *     it.\n     *     <li> <b>Shape</b>: contains simple drawing commands instead of a raw\n     *     bitmap, allowing it to resize better in some cases.\n     *     <li> <b>Layers</b>: a compound drawable, which draws multiple underlying\n     *     drawables on top of each other.\n     *     <li> <b>States</b>: a compound drawable that selects one of a set of\n     *     drawables based on its state.\n     *     <li> <b>Levels</b>: a compound drawable that selects one of a set of\n     *     drawables based on its level.\n     *     <li> <b>Scale</b>: a compound drawable with a single child drawable,\n     *     whose overall size is modified based on the current level.\n     * </ul>\n     *\n     * <div class=\"special reference\">\n     * <h3>Developer Guides</h3>\n     * <p>For more information about how to use drawables, read the\n     * <a href=\"{@docRoot}guide/topics/graphics/2d-graphics.html\">Canvas and Drawables</a> developer\n     * guide. For information and examples of creating drawable resources (XML or bitmap files that\n     * can be loaded in code), read the\n     * <a href=\"{@docRoot}guide/topics/resources/drawable-resource.html\">Drawable Resources</a>\n     * document.</p></div>\n     */\n    export abstract class Drawable {\n        private static ZERO_BOUNDS_RECT = new Rect();\n\n        mBounds:Rect = Drawable.ZERO_BOUNDS_RECT;// lazily becomes a new Rect()\n        mStateSet = StateSet.WILD_CARD;\n        mLevel = 0;\n        mVisible = true;\n        mCallback:WeakReference<Drawable.Callback>;\n\n        private mIgnoreNotifySizeChange = false;\n\n        constructor() {\n        }\n\n        /**\n         * Draw in its bounds (set via setBounds) respecting optional effects such\n         * as alpha (set via setAlpha) and color filter (set via setColorFilter).\n         *\n         * @param canvas The canvas to draw into\n         */\n        abstract draw(canvas:Canvas);\n\n        /**\n         * Specify a bounding rectangle for the Drawable. This is where the drawable\n         * will draw when its draw() method is called.\n         */\n        setBounds(rect:Rect);\n        /**\n         * Specify a bounding rectangle for the Drawable. This is where the drawable\n         * will draw when its draw() method is called.\n         */\n        setBounds(left, top, right, bottom);\n        setBounds(...args) {\n            if (args.length === 1) {\n                let rect = args[0];\n                return this.setBounds(rect.left, rect.top, rect.right, rect.bottom);\n            } else {\n                let [left=0, top=0, right=0, bottom=0] = args;\n                let oldBounds = this.mBounds;\n\n                if (oldBounds == Drawable.ZERO_BOUNDS_RECT) {\n                    oldBounds = this.mBounds = new Rect();\n                }\n\n                if (oldBounds.left != left || oldBounds.top != top ||\n                    oldBounds.right != right || oldBounds.bottom != bottom) {\n                    if (!oldBounds.isEmpty()) {\n                        // first invalidate the previous bounds\n                        this.invalidateSelf();\n                    }\n                    this.mBounds.set(left, top, right, bottom);\n                    this.onBoundsChange(this.mBounds);\n                }\n            }\n        }\n\n        /**\n         * Return a copy of the drawable's bounds in the specified Rect (allocated\n         * by the caller). The bounds specify where this will draw when its draw()\n         * method is called.\n         *\n         * @param bounds Rect to receive the drawable's bounds (allocated by the\n         *               caller).\n         */\n        copyBounds(bounds = new Rect()) {\n            bounds.set(this.mBounds);\n            return bounds;\n        }\n\n        /**\n         * Return the drawable's bounds Rect. Note: for efficiency, the returned\n         * object may be the same object stored in the drawable (though this is not\n         * guaranteed), so if a persistent copy of the bounds is needed, call\n         * copyBounds(rect) instead.\n         * You should also not change the object returned by this method as it may\n         * be the same object stored in the drawable.\n         *\n         * @return The bounds of the drawable (which may change later, so caller\n         *         beware). DO NOT ALTER the returned object as it may change the\n         *         stored bounds of this drawable.\n         *\n         * @see #copyBounds()\n         * @see #copyBounds(android.graphics.Rect)\n         */\n        getBounds():Rect {\n            if (this.mBounds == Drawable.ZERO_BOUNDS_RECT) {\n                this.mBounds = new Rect();\n            }\n\n            return this.mBounds;\n        }\n\n        /**\n         * Set to true to have the drawable dither its colors when drawn to a device\n         * with fewer than 8-bits per color component. This can improve the look on\n         * those devices, but can also slow down the drawing a little.\n         */\n        setDither(dither:boolean) {}\n\n        /**\n         * Bind a {@link Callback} object to this Drawable.  Required for clients\n         * that want to support animated drawables.\n         *\n         * @param cb The client's Callback implementation.\n         *\n         * @see #getCallback()\n         */\n        setCallback(cb:Drawable.Callback) {\n            this.mCallback = new WeakReference(cb);\n        }\n\n        /**\n         * Return the current {@link Callback} implementation attached to this\n         * Drawable.\n         *\n         * @return A {@link Callback} instance or null if no callback was set.\n         *\n         * @see #setCallback(android.graphics.drawable.Drawable.Callback)\n         */\n        getCallback():Drawable.Callback {\n            if (this.mCallback != null) {\n                return this.mCallback.get();\n            }\n            return null;\n        }\n\n        /**\n         * by default, NetDrawable will change it's bound when load image finish.\n         * If you wan lock a bound to a NetDrawable, you shound call this method to ignore it.\n         */\n        setIgnoreNotifySizeChange(isIgnore:boolean):void {\n            this.mIgnoreNotifySizeChange = isIgnore;\n        }\n\n        /**\n         * AndroidUI add: notity size change\n         */\n        notifySizeChangeSelf() {\n            if(this.mIgnoreNotifySizeChange) return;\n            let callback = this.getCallback();\n            if (callback != null && callback.drawableSizeChange) {\n                callback.drawableSizeChange(this);\n            }\n        }\n\n        /**\n         * Use the current {@link Callback} implementation to have this Drawable\n         * redrawn.  Does nothing if there is no Callback attached to the\n         * Drawable.\n         *\n         * @see Callback#invalidateDrawable\n         * @see #getCallback()\n         * @see #setCallback(android.graphics.drawable.Drawable.Callback)\n         */\n        invalidateSelf() {\n            let callback = this.getCallback();\n            if (callback != null) {\n                callback.invalidateDrawable(this);\n            }\n        }\n\n        /**\n         * Use the current {@link Callback} implementation to have this Drawable\n         * scheduled.  Does nothing if there is no Callback attached to the\n         * Drawable.\n         *\n         * @param what The action being scheduled.\n         * @param when The time (in milliseconds) to run.\n         *\n         * @see Callback#scheduleDrawable\n         */\n        scheduleSelf(what, when) {\n            let callback = this.getCallback();\n            if (callback != null) {\n                callback.scheduleDrawable(this, what, when);\n            }\n        }\n\n        /**\n         * Use the current {@link Callback} implementation to have this Drawable\n         * unscheduled.  Does nothing if there is no Callback attached to the\n         * Drawable.\n         *\n         * @param what The runnable that you no longer want called.\n         *\n         * @see Callback#unscheduleDrawable\n         */\n        unscheduleSelf(what) {\n            let callback = this.getCallback();\n            if (callback != null) {\n                callback.unscheduleDrawable(this, what);\n            }\n        }\n\n        /**\n         * Specify an alpha value for the drawable. 0 means fully transparent, and\n         * 255 means fully opaque.\n         */\n        abstract setAlpha(alpha:number):void;\n\n        /**\n         * Gets the current alpha value for the drawable. 0 means fully transparent,\n         * 255 means fully opaque. This method is implemented by\n         * Drawable subclasses and the value returned is specific to how that class treats alpha.\n         * The default return value is 255 if the class does not override this method to return a value\n         * specific to its use of alpha.\n         */\n        getAlpha():number {\n            return 0xFF;\n        }\n\n        /**\n         * Indicates whether this view will change its appearance based on state.\n         * Clients can use this to determine whether it is necessary to calculate\n         * their state and call setState.\n         *\n         * @return True if this view changes its appearance based on state, false\n         *         otherwise.\n         *\n         * @see #setState(int[])\n         */\n        isStateful():boolean {\n            return false;\n        }\n\n        /**\n         * Specify a set of states for the drawable. These are use-case specific,\n         * so see the relevant documentation. As an example, the background for\n         * widgets like Button understand the following states:\n         * [{@link android.R.attr#state_focused},\n         *  {@link android.R.attr#state_pressed}].\n         *\n         * <p>If the new state you are supplying causes the appearance of the\n         * Drawable to change, then it is responsible for calling\n         * {@link #invalidateSelf} in order to have itself redrawn, <em>and</em>\n         * true will be returned from this function.\n         *\n         * <p>Note: The Drawable holds a reference on to <var>stateSet</var>\n         * until a new state array is given to it, so you must not modify this\n         * array during that time.</p>\n         *\n         * @param stateSet The new set of states to be displayed.\n         *\n         * @return Returns true if this change in state has caused the appearance\n         * of the Drawable to change (hence requiring an invalidate), otherwise\n         * returns false.\n         */\n        setState(stateSet:Array<number>) {\n            if (this.mStateSet+'' !== stateSet+'') {\n                this.mStateSet = stateSet;\n                return this.onStateChange(stateSet);\n            }\n            return false;\n        }\n\n        /**\n         * Describes the current state, as a union of primitve states, such as\n         * {@link android.R.attr#state_focused},\n         * {@link android.R.attr#state_selected}, etc.\n         * Some drawables may modify their imagery based on the selected state.\n         * @return An array of resource Ids describing the current state.\n         */\n        getState():Array<number> {\n            return this.mStateSet;\n        }\n\n        /**\n         * If this Drawable does transition animations between states, ask that\n         * it immediately jump to the current state and skip any active animations.\n         */\n        jumpToCurrentState() {\n        }\n\n        /**\n         * @return The current drawable that will be used by this drawable. For simple drawables, this\n         *         is just the drawable itself. For drawables that change state like\n         *         {@link StateListDrawable} and {@link LevelListDrawable} this will be the child drawable\n         *         currently in use.\n         */\n        getCurrent():Drawable {\n            return this;\n        }\n\n        /**\n         * Specify the level for the drawable.  This allows a drawable to vary its\n         * imagery based on a continuous controller, for example to show progress\n         * or volume level.\n         *\n         * <p>If the new level you are supplying causes the appearance of the\n         * Drawable to change, then it is responsible for calling\n         * {@link #invalidateSelf} in order to have itself redrawn, <em>and</em>\n         * true will be returned from this function.\n         *\n         * @param level The new level, from 0 (minimum) to 10000 (maximum).\n         *\n         * @return Returns true if this change in level has caused the appearance\n         * of the Drawable to change (hence requiring an invalidate), otherwise\n         * returns false.\n         */\n        setLevel(level:number):boolean {\n            if (this.mLevel != level) {\n                this.mLevel = level;\n                return this.onLevelChange(level);\n            }\n            return false;\n        }\n\n        /**\n         * Retrieve the current level.\n         *\n         * @return int Current level, from 0 (minimum) to 10000 (maximum).\n         */\n        getLevel():number {\n            return this.mLevel;\n        }\n\n        /**\n         * Set whether this Drawable is visible.  This generally does not impact\n         * the Drawable's behavior, but is a hint that can be used by some\n         * Drawables, for example, to decide whether run animations.\n         *\n         * @param visible Set to true if visible, false if not.\n         * @param restart You can supply true here to force the drawable to behave\n         *                as if it has just become visible, even if it had last\n         *                been set visible.  Used for example to force animations\n         *                to restart.\n         *\n         * @return boolean Returns true if the new visibility is different than\n         *         its previous state.\n         */\n        setVisible(visible:boolean, restart:boolean) {\n            let changed = this.mVisible != visible;\n            if (changed) {\n                this.mVisible = visible;\n                this.invalidateSelf();\n            }\n            return changed;\n        }\n\n        isVisible():boolean {\n            return this.mVisible;\n        }\n\n        /**\n         * Set whether this Drawable is automatically mirrored when its layout direction is RTL\n         * (right-to left). See {@link android.util.LayoutDirection}.\n         *\n         * @param mirrored Set to true if the Drawable should be mirrored, false if not.\n         */\n        setAutoMirrored(mirrored:boolean) {\n        }\n\n        /**\n         * Tells if this Drawable will be automatically mirrored  when its layout direction is RTL\n         * right-to-left. See {@link android.util.LayoutDirection}.\n         *\n         * @return boolean Returns true if this Drawable will be automatically mirrored.\n         */\n        isAutoMirrored():boolean {\n            return false;\n        }\n\n        /**\n         * Return the opacity/transparency of this Drawable.  The returned value is\n         * one of the abstract format constants in\n         * {@link android.graphics.PixelFormat}:\n         * {@link android.graphics.PixelFormat#UNKNOWN},\n         * {@link android.graphics.PixelFormat#TRANSLUCENT},\n         * {@link android.graphics.PixelFormat#TRANSPARENT}, or\n         * {@link android.graphics.PixelFormat#OPAQUE}.\n         *\n         * <p>Generally a Drawable should be as conservative as possible with the\n         * value it returns.  For example, if it contains multiple child drawables\n         * and only shows one of them at a time, if only one of the children is\n         * TRANSLUCENT and the others are OPAQUE then TRANSLUCENT should be\n         * returned.  You can use the method {@link #resolveOpacity} to perform a\n         * standard reduction of two opacities to the appropriate single output.\n         *\n         * <p>Note that the returned value does <em>not</em> take into account a\n         * custom alpha or color filter that has been applied by the client through\n         * the {@link #setAlpha} or {@link #setColorFilter} methods.\n         *\n         * @return int The opacity class of the Drawable.\n         *\n         * @see android.graphics.PixelFormat\n         */\n        //abstract\n        getOpacity():number {\n            return PixelFormat.TRANSLUCENT;\n        }\n\n        /**\n         * Return the appropriate opacity value for two source opacities.  If\n         * either is UNKNOWN, that is returned; else, if either is TRANSLUCENT,\n         * that is returned; else, if either is TRANSPARENT, that is returned;\n         * else, OPAQUE is returned.\n         *\n         * <p>This is to help in implementing {@link #getOpacity}.\n         *\n         * @param op1 One opacity value.\n         * @param op2 Another opacity value.\n         *\n         * @return int The combined opacity value.\n         *\n         * @see #getOpacity\n         */\n        static resolveOpacity(op1:number, op2:number) {\n            if (op1 == op2) {\n                return op1;\n            }\n            if (op1 == PixelFormat.UNKNOWN || op2 == PixelFormat.UNKNOWN) {\n                return PixelFormat.UNKNOWN;\n            }\n            if (op1 == PixelFormat.TRANSLUCENT || op2 == PixelFormat.TRANSLUCENT) {\n                return PixelFormat.TRANSLUCENT;\n            }\n            if (op1 == PixelFormat.TRANSPARENT || op2 == PixelFormat.TRANSPARENT) {\n                return PixelFormat.TRANSPARENT;\n            }\n            return PixelFormat.OPAQUE;\n        }\n\n        /**\n         * Override this in your subclass to change appearance if you recognize the\n         * specified state.\n         *\n         * @return Returns true if the state change has caused the appearance of\n         * the Drawable to change (that is, it needs to be drawn), else false\n         * if it looks the same and there is no need to redraw it since its\n         * last state.\n         */\n        protected onStateChange(state:Array<number>):boolean {\n            return false;\n        }\n\n        /** Override this in your subclass to change appearance if you vary based\n         *  on level.\n         * @return Returns true if the level change has caused the appearance of\n         * the Drawable to change (that is, it needs to be drawn), else false\n         * if it looks the same and there is no need to redraw it since its\n         * last level.\n         */\n        protected onLevelChange(level:number):boolean {\n            return false;\n        }\n\n        /**\n         * Override this in your subclass to change appearance if you recognize the\n         * specified state.\n         */\n        protected onBoundsChange(bounds:Rect):void {\n        }\n\n        /**\n         * Return the intrinsic width of the underlying drawable object.  Returns\n         * -1 if it has no intrinsic width, such as with a solid color.\n         */\n        getIntrinsicWidth():number {\n            return -1;\n        }\n\n        /**\n         * Return the intrinsic height of the underlying drawable object. Returns\n         * -1 if it has no intrinsic height, such as with a solid color.\n         */\n        getIntrinsicHeight():number {\n            return -1;\n        }\n\n        /**\n         * Returns the minimum width suggested by this Drawable. If a View uses this\n         * Drawable as a background, it is suggested that the View use at least this\n         * value for its width. (There will be some scenarios where this will not be\n         * possible.) This value should INCLUDE any padding.\n         *\n         * @return The minimum width suggested by this Drawable. If this Drawable\n         *         doesn't have a suggested minimum width, 0 is returned.\n         */\n        getMinimumWidth() {\n            let intrinsicWidth = this.getIntrinsicWidth();\n            return intrinsicWidth > 0 ? intrinsicWidth : 0;\n        }\n\n        /**\n         * Returns the minimum height suggested by this Drawable. If a View uses this\n         * Drawable as a background, it is suggested that the View use at least this\n         * value for its height. (There will be some scenarios where this will not be\n         * possible.) This value should INCLUDE any padding.\n         *\n         * @return The minimum height suggested by this Drawable. If this Drawable\n         *         doesn't have a suggested minimum height, 0 is returned.\n         */\n        getMinimumHeight() {\n            let intrinsicHeight = this.getIntrinsicHeight();\n            return intrinsicHeight > 0 ? intrinsicHeight : 0;\n        }\n\n        /**\n         * Return in padding the insets suggested by this Drawable for placing\n         * content inside the drawable's bounds. Positive values move toward the\n         * center of the Drawable (set Rect.inset). Returns true if this drawable\n         * actually has a padding, else false. When false is returned, the padding\n         * is always set to 0.\n         */\n        getPadding(padding:Rect):boolean {\n            padding.set(0, 0, 0, 0);\n            return false;\n        }\n\n        /**\n         * Make this drawable mutable. This operation cannot be reversed. A mutable\n         * drawable is guaranteed to not share its state with any other drawable.\n         * This is especially useful when you need to modify properties of drawables\n         * loaded from resources. By default, all drawables instances loaded from\n         * the same resource share a common state; if you modify the state of one\n         * instance, all the other instances will receive the same modification.\n         *\n         * Calling this method on a mutable Drawable will have no effect.\n         *\n         * @return This drawable.\n         * @see ConstantState\n         * @see #getConstantState()\n         */\n        mutate(): Drawable {\n            return this;\n        }\n\n        /**\n         * Return a {@link ConstantState} instance that holds the shared state of this Drawable.\n         *q\n         * @return The ConstantState associated to that Drawable.\n         * @see ConstantState\n         * @see Drawable#mutate()\n         */\n        getConstantState():Drawable.ConstantState {\n            return null;\n        }\n\n        /**\n         * Create a drawable from an XML document. For more information on how to\n         * create resources in XML, see\n         * <a href=\"{@docRoot}guide/topics/resources/drawable-resource.html\">Drawable Resources</a>.\n         */\n        static createFromXml(r:Resources, parser:HTMLElement):Drawable {\n            let drawable:Drawable;\n            let name = parser.tagName.toLowerCase();\n            switch (name) {\n                case \"selector\":\n                    drawable = new StateListDrawable();\n                    break;\n                // case \"animated-selector\":\n                //     drawable = new AnimatedStateListDrawable();\n                //     break;\n                // case \"level-list\":\n                //     drawable = new LevelListDrawable();\n                //     break;\n                case \"layer-list\":\n                    drawable = new LayerDrawable(null);\n                    break;\n                // case \"transition\":\n                //     drawable = new TransitionDrawable();\n                //     break;\n                // case \"ripple\":\n                //     drawable = new RippleDrawable();\n                //     break;\n                case \"color\":\n                    drawable = new ColorDrawable();\n                    break;\n                // case \"shape\":\n                //     drawable = new GradientDrawable();\n                //     break;\n                // case \"vector\":\n                //     drawable = new VectorDrawable();\n                //     break;\n                // case \"animated-vector\":\n                //     drawable = new AnimatedVectorDrawable();\n                //     break;\n                case \"scale\":\n                    drawable = new ScaleDrawable();\n                    break;\n                case \"clip\":\n                    drawable = new ClipDrawable();\n                    break;\n                case \"rotate\":\n                    drawable = new RotateDrawable();\n                    break;\n                // case \"animated-rotate\":\n                //     drawable = new AnimatedRotateDrawable();\n                //     break;\n                case \"animation-list\":\n                    drawable = new AnimationDrawable();\n                    break;\n                case \"inset\":\n                    drawable = new InsetDrawable(null, 0);\n                    break;\n                case \"bitmap\":\n                    let srcAttr = parser.getAttribute('src');\n                    if(!srcAttr) throw Error(\"XmlPullParserException: bitmap tag must have 'src' attribute\");\n                    drawable = r.getDrawable(srcAttr);\n                    break;\n                // case \"bitmap\":\n                //     drawable = new BitmapDrawable(r);\n                //     if (r != null) {\n                //         ((BitmapDrawable) drawable).setTargetDensity(r.getDisplayMetrics());\n                //     }\n                //     break;\n                // case \"nine-patch\":\n                //     drawable = new NinePatchDrawable();\n                //     if (r != null) {\n                //         ((NinePatchDrawable) drawable).setTargetDensity(r.getDisplayMetrics());\n                //     }\n                //     break;\n                default:\n                    throw Error(\"XmlPullParserException: invalid drawable tag \" + name);\n\n            }\n            drawable.inflate(r, parser);\n            return drawable;\n        }\n\n        inflate(r:Resources, parser:HTMLElement):void {\n            this.mVisible = (parser.getAttribute('android:visible') !== 'false');\n        }\n\n    }\n\n    export module Drawable{\n        /**\n         * Implement this interface if you want to create an animated drawable that\n         * extends {@link android.graphics.drawable.Drawable Drawable}.\n         * Upon retrieving a drawable, use\n         * {@link Drawable#setCallback(android.graphics.drawable.Drawable.Callback)}\n         * to supply your implementation of the interface to the drawable; it uses\n         * this interface to schedule and execute animation changes.\n         */\n        export interface Callback{\n            /**\n             * Called when the drawable needs to be redrawn.  A view at this point\n             * should invalidate itself (or at least the part of itself where the\n             * drawable appears).\n             *\n             * @param who The drawable that is requesting the update.\n             */\n            invalidateDrawable(who : Drawable):void;\n            /**\n             * androidui add: when drawable size change, view's size may change\n             */\n            drawableSizeChange?(who : Drawable):void;\n            /**\n             * A Drawable can call this to schedule the next frame of its\n             * animation.  An implementation can generally simply call\n             * {@link android.os.Handler#postAtTime(Runnable, Object, long)} with\n             * the parameters <var>(what, who, when)</var> to perform the\n             * scheduling.\n             *\n             * @param who The drawable being scheduled.\n             * @param what The action to execute.\n             * @param when The time (in milliseconds) to run.  The timebase is\n             *             {@link android.os.SystemClock#uptimeMillis}\n             */\n            scheduleDrawable(who : Drawable, what:Runnable, when:number):void;\n\n            /**\n             * A Drawable can call this to unschedule an action previously\n             * scheduled with {@link #scheduleDrawable}.  An implementation can\n             * generally simply call\n             * {@link android.os.Handler#removeCallbacks(Runnable, Object)} with\n             * the parameters <var>(what, who)</var> to unschedule the drawable.\n             *\n             * @param who The drawable being unscheduled.\n             * @param what The action being unscheduled.\n             */\n            unscheduleDrawable(who: Drawable, what:Runnable):void;\n        }\n\n        /**\n         * This abstract class is used by {@link Drawable}s to store shared constant state and data\n         * between Drawables. {@link BitmapDrawable}s created from the same resource will for instance\n         * share a unique bitmap stored in their ConstantState.\n         *\n         * <p>\n         * {@link #newDrawable(Resources)} can be used as a factory to create new Drawable instances\n         * from this ConstantState.\n         * </p>\n         *\n         * Use {@link Drawable#getConstantState()} to retrieve the ConstantState of a Drawable. Calling\n         * {@link Drawable#mutate()} on a Drawable should typically create a new ConstantState for that\n         * Drawable.\n         */\n        export interface ConstantState{\n            /**\n             * Create a new drawable without supplying resources the caller\n             * is running in.  Note that using this means the density-dependent\n             * drawables (like bitmaps) will not be able to update their target\n             * density correctly. One should use {@link #newDrawable(Resources)}\n             * instead to provide a resource.\n             */\n            newDrawable():Drawable;\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/android/graphics/drawable/DrawableContainer.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"Drawable.ts\"/>\n///<reference path=\"../Canvas.ts\"/>\n///<reference path=\"../Rect.ts\"/>\n///<reference path=\"../PixelFormat.ts\"/>\n///<reference path=\"../../../java/lang/ref/WeakReference.ts\"/>\n///<reference path=\"../../../java/lang/Runnable.ts\"/>\n///<reference path=\"../../util/StateSet.ts\"/>\n///<reference path=\"../../util/Log.ts\"/>\n///<reference path=\"../../util/SparseArray.ts\"/>\n///<reference path=\"../../os/SystemClock.ts\"/>\n\nmodule android.graphics.drawable{\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n    import PixelFormat = android.graphics.PixelFormat;\n    import WeakReference = java.lang.ref.WeakReference;\n    import Runnable = java.lang.Runnable;\n    import StateSet = android.util.StateSet;\n    import Log = android.util.Log;\n    import SparseArray = android.util.SparseArray;\n    import SystemClock = android.os.SystemClock;\n\n    /**\n     * A helper class that contains several {@link Drawable}s and selects which one to use.\n     *\n     * You can subclass it to create your own DrawableContainers or directly use one its child classes.\n     */\n    export class DrawableContainer extends Drawable implements Drawable.Callback {\n        private static DEBUG = Log.DBG_DrawableContainer;\n        private static TAG = \"DrawableContainer\";\n        /**\n         * To be proper, we should have a getter for dither (and alpha, etc.)\n         * so that proxy classes like this can save/restore their delegates'\n         * values, but we don't have getters. Since we do have setters\n         * (e.g. setDither), which this proxy forwards on, we have to have some\n         * default/initial setting.\n         *\n         * The initial setting for dither is now true, since it almost always seems\n         * to improve the quality at negligible cost.\n         */\n        static DEFAULT_DITHER = true;\n        private mDrawableContainerState:DrawableContainer.DrawableContainerState;\n        private mCurrDrawable:Drawable;\n        private mAlpha = 0xFF;\n\n        private mCurIndex = -1;\n        mMutated=false;\n\n        // Animations.\n        private mAnimationRunnable:Runnable;\n        private mEnterAnimationEnd=0;\n        private mExitAnimationEnd=0;\n        private mLastDrawable:Drawable;\n\n        // overrides from Drawable\n        draw(canvas:Canvas) {\n            if (this.mCurrDrawable != null) {\n                this.mCurrDrawable.draw(canvas);\n            }\n            if (this.mLastDrawable != null) {\n                this.mLastDrawable.draw(canvas);\n            }\n        }\n\n        private needsMirroring():boolean{\n            return false && this.isAutoMirrored();\n        }\n\n        getPadding(padding:android.graphics.Rect):boolean {\n            const r = this.mDrawableContainerState.getConstantPadding();\n            let result;\n            if (r != null) {\n                padding.set(r);\n                result = (r.left | r.top | r.bottom | r.right) != 0;\n            } else {\n                if (this.mCurrDrawable != null) {\n                    result = this.mCurrDrawable.getPadding(padding);\n                } else {\n                    result = super.getPadding(padding);\n                }\n            }\n            if (this.needsMirroring()) {\n                const left = padding.left;\n                const right = padding.right;\n                padding.left = right;\n                padding.right = left;\n            }\n            return result;\n        }\n        setAlpha(alpha:number) {\n            if (this.mAlpha != alpha) {\n                this.mAlpha = alpha;\n                if (this.mCurrDrawable != null) {\n                    if (this.mEnterAnimationEnd == 0) {\n                        this.mCurrDrawable.mutate().setAlpha(alpha);\n                    } else {\n                        this.animate(false);\n                    }\n                }\n            }\n        }\n\n        getAlpha():number {\n            return this.mAlpha;\n        }\n\n        setDither(dither:boolean) {\n            if (this.mDrawableContainerState.mDither != dither) {\n                this.mDrawableContainerState.mDither = dither;\n                if (this.mCurrDrawable != null) {\n                    this.mCurrDrawable.mutate().setDither(this.mDrawableContainerState.mDither);\n                }\n            }\n        }\n\n        /**\n         * Change the global fade duration when a new drawable is entering\n         * the scene.\n         * @param ms The amount of time to fade in milliseconds.\n         */\n        setEnterFadeDuration(ms:number) {\n            this.mDrawableContainerState.mEnterFadeDuration = ms;\n        }\n\n        /**\n         * Change the global fade duration when a new drawable is leaving\n         * the scene.\n         * @param ms The amount of time to fade in milliseconds.\n         */\n        setExitFadeDuration(ms:number) {\n            this.mDrawableContainerState.mExitFadeDuration = ms;\n        }\n\n        protected onBoundsChange(bounds:android.graphics.Rect):void {\n            if (this.mLastDrawable != null) {\n                this.mLastDrawable.setBounds(bounds);\n            }\n            if (this.mCurrDrawable != null) {\n                this.mCurrDrawable.setBounds(bounds);\n            }\n        }\n        isStateful():boolean {\n            return this.mDrawableContainerState.isStateful();\n        }\n        setAutoMirrored(mirrored:boolean) {\n            this.mDrawableContainerState.mAutoMirrored = mirrored;\n            if (this.mCurrDrawable != null) {\n                this.mCurrDrawable.mutate().setAutoMirrored(this.mDrawableContainerState.mAutoMirrored);\n            }\n        }\n        isAutoMirrored():boolean {\n            return this.mDrawableContainerState.mAutoMirrored;\n        }\n        jumpToCurrentState() {\n            let changed = false;\n            if (this.mLastDrawable != null) {\n                this.mLastDrawable.jumpToCurrentState();\n                this.mLastDrawable = null;\n                changed = true;\n            }\n            if (this.mCurrDrawable != null) {\n                this.mCurrDrawable.jumpToCurrentState();\n                this.mCurrDrawable.mutate().setAlpha(this.mAlpha);\n            }\n            if (this.mExitAnimationEnd != 0) {\n                this.mExitAnimationEnd = 0;\n                changed = true;\n            }\n            if (this.mEnterAnimationEnd != 0) {\n                this.mEnterAnimationEnd = 0;\n                changed = true;\n            }\n            if (changed) {\n                this.invalidateSelf();\n            }\n        }\n        protected onStateChange(state:Array<number>):boolean {\n            if (this.mLastDrawable != null) {\n                return this.mLastDrawable.setState(state);\n            }\n            if (this.mCurrDrawable != null) {\n                return this.mCurrDrawable.setState(state);\n            }\n            return false;\n        }\n\n        protected onLevelChange(level:number):boolean {\n            if (this.mLastDrawable != null) {\n                return this.mLastDrawable.setLevel(level);\n            }\n            if (this.mCurrDrawable != null) {\n                return this.mCurrDrawable.setLevel(level);\n            }\n            return false;\n        }\n\n        getIntrinsicWidth():number {\n            if (this.mDrawableContainerState.isConstantSize()) {\n                return this.mDrawableContainerState.getConstantWidth();\n            }\n            return this.mCurrDrawable != null ? this.mCurrDrawable.getIntrinsicWidth() : -1;\n        }\n\n        getIntrinsicHeight():number {\n            if (this.mDrawableContainerState.isConstantSize()) {\n                return this.mDrawableContainerState.getConstantHeight();\n            }\n            return this.mCurrDrawable != null ? this.mCurrDrawable.getIntrinsicHeight() : -1;\n        }\n\n        getMinimumWidth():number {\n            if (this.mDrawableContainerState.isConstantSize()) {\n                return this.mDrawableContainerState.getConstantMinimumWidth();\n            }\n            return this.mCurrDrawable != null ? this.mCurrDrawable.getMinimumWidth() : 0;\n        }\n        getMinimumHeight():number {\n            if (this.mDrawableContainerState.isConstantSize()) {\n                return this.mDrawableContainerState.getConstantMinimumHeight();\n            }\n            return this.mCurrDrawable != null ? this.mCurrDrawable.getMinimumHeight() : 0;\n        }\n\n        drawableSizeChange(who:android.graphics.drawable.Drawable):void {\n            let callback = this.getCallback();\n            if (who == this.mCurrDrawable && callback != null && callback.drawableSizeChange) {\n                callback.drawableSizeChange(this);\n            }\n        }\n\n        invalidateDrawable(who:android.graphics.drawable.Drawable):void {\n            if (who == this.mCurrDrawable && this.getCallback() != null) {\n                this.getCallback().invalidateDrawable(this);\n            }\n        }\n\n        scheduleDrawable(who:android.graphics.drawable.Drawable, what:java.lang.Runnable, when:number):void {\n            if (who == this.mCurrDrawable && this.getCallback() != null) {\n                this.getCallback().scheduleDrawable(this, what, when);\n            }\n        }\n\n        unscheduleDrawable(who:android.graphics.drawable.Drawable, what:java.lang.Runnable):void {\n            if (who == this.mCurrDrawable && this.getCallback() != null) {\n                this.getCallback().unscheduleDrawable(this, what);\n            }\n        }\n\n        setVisible(visible:boolean, restart:boolean):boolean {\n            let changed = super.setVisible(visible, restart);\n            if (this.mLastDrawable != null) {\n                this.mLastDrawable.setVisible(visible, restart);\n            }\n            if (this.mCurrDrawable != null) {\n                this.mCurrDrawable.setVisible(visible, restart);\n            }\n            return changed;\n        }\n\n        getOpacity():number {\n            return this.mCurrDrawable == null || !this.mCurrDrawable.isVisible() ? PixelFormat.TRANSPARENT :\n                this.mDrawableContainerState.getOpacity();\n        }\n\n        selectDrawable(idx:number):boolean {\n            if (idx == this.mCurIndex) {\n                return false;\n            }\n\n            const now = SystemClock.uptimeMillis();\n\n            if (DrawableContainer.DEBUG) android.util.Log.i(DrawableContainer.TAG, toString() + \" from \" + this.mCurIndex + \" to \" + idx\n                + \": exit=\" + this.mDrawableContainerState.mExitFadeDuration\n                + \" enter=\" + this.mDrawableContainerState.mEnterFadeDuration);\n\n            if (this.mDrawableContainerState.mExitFadeDuration > 0) {\n                if (this.mLastDrawable != null) {\n                    this.mLastDrawable.setVisible(false, false);\n                }\n                if (this.mCurrDrawable != null) {\n                    this.mLastDrawable = this.mCurrDrawable;\n                    this.mExitAnimationEnd = now + this.mDrawableContainerState.mExitFadeDuration;\n                } else {\n                    this.mLastDrawable = null;\n                    this.mExitAnimationEnd = 0;\n                }\n            } else if (this.mCurrDrawable != null) {\n                this.mCurrDrawable.setVisible(false, false);\n            }\n\n            if (idx >= 0 && idx < this.mDrawableContainerState.mNumChildren) {\n                const d = this.mDrawableContainerState.getChild(idx);\n                this.mCurrDrawable = d;\n                this.mCurIndex = idx;\n                if (d != null) {\n                    //this.mInsets = d.getOpticalInsets();\n                    d.mutate();\n                    if (this.mDrawableContainerState.mEnterFadeDuration > 0) {\n                        this.mEnterAnimationEnd = now + this.mDrawableContainerState.mEnterFadeDuration;\n                    } else {\n                        d.setAlpha(this.mAlpha);\n                    }\n                    d.setVisible(this.isVisible(), true);\n                    d.setDither(this.mDrawableContainerState.mDither);\n                    //d.setColorFilter(this.mColorFilter);\n                    d.setState(this.getState());\n                    d.setLevel(this.getLevel());\n                    d.setBounds(this.getBounds());\n                    //d.setLayoutDirection(this.getLayoutDirection());\n                    d.setAutoMirrored(this.mDrawableContainerState.mAutoMirrored);\n                } else {\n                    //this.mInsets = Insets.NONE;\n                }\n            } else {\n                this.mCurrDrawable = null;\n                //this.mInsets = Insets.NONE;\n                this.mCurIndex = -1;\n            }\n\n            if (this.mEnterAnimationEnd != 0 || this.mExitAnimationEnd != 0) {\n                if (this.mAnimationRunnable == null) {\n                    let t = this;\n                    this.mAnimationRunnable = {\n                        run() {\n                            t.animate(true);\n                            t.invalidateSelf();\n                        }\n                    };\n                } else {\n                    this.unscheduleSelf(this.mAnimationRunnable);\n                }\n                // Compute first frame and schedule next animation.\n                this.animate(true);\n            }\n\n            this.invalidateSelf();\n\n            return true;\n        }\n\n        animate(schedule:boolean) {\n            const now = SystemClock.uptimeMillis();\n            let animating = false;\n            if (this.mCurrDrawable != null) {\n                if (this.mEnterAnimationEnd != 0) {\n                    if (this.mEnterAnimationEnd <= now) {\n                        this.mCurrDrawable.mutate().setAlpha(this.mAlpha);\n                        this.mEnterAnimationEnd = 0;\n                    } else {\n                        let animAlpha = ((this.mEnterAnimationEnd-now)*255)\n                            / this.mDrawableContainerState.mEnterFadeDuration;\n                        if (DrawableContainer.DEBUG) android.util.Log.i(DrawableContainer.TAG, toString() + \" cur alpha \" + animAlpha);\n                        this.mCurrDrawable.mutate().setAlpha(((255-animAlpha)*this.mAlpha)/255);\n                        animating = true;\n                    }\n                }\n            } else {\n                this.mEnterAnimationEnd = 0;\n            }\n            if (this.mLastDrawable != null) {\n                if (this.mExitAnimationEnd != 0) {\n                    if (this.mExitAnimationEnd <= now) {\n                        this.mLastDrawable.setVisible(false, false);\n                        this.mLastDrawable = null;\n                        this.mExitAnimationEnd = 0;\n                    } else {\n                        let animAlpha = ((this.mExitAnimationEnd-now)*255)\n                            / this.mDrawableContainerState.mExitFadeDuration;\n                        if (DrawableContainer.DEBUG) android.util.Log.i(DrawableContainer.TAG, toString() + \" last alpha \" + animAlpha);\n                        this.mLastDrawable.mutate().setAlpha((animAlpha*this.mAlpha)/255);\n                        animating = true;\n                    }\n                }\n            } else {\n                this.mExitAnimationEnd = 0;\n            }\n\n            if (schedule && animating) {\n                this.scheduleSelf(this.mAnimationRunnable, now + 1000/60);\n            }\n\n        }\n        getCurrent():Drawable {\n            return this.mCurrDrawable;\n        }\n        getConstantState():Drawable.ConstantState {\n            if (this.mDrawableContainerState.canConstantState()) {\n                //this.mDrawableContainerState.mChangingConfigurations = this.getChangingConfigurations();\n                return this.mDrawableContainerState;\n            }\n            return null;\n        }\n        mutate():Drawable {\n            if (!this.mMutated && super.mutate() == this) {\n                this.mDrawableContainerState.mutate();\n                this.mMutated = true;\n            }\n            return this;\n        }\n\n        setConstantState(state:DrawableContainer.DrawableContainerState) {\n            this.mDrawableContainerState = state;\n        }\n    }\n\n    export module DrawableContainer{\n\n        /**\n         * A ConstantState that can contain several {@link Drawable}s.\n         *\n         * This class was made public to enable testing, and its visibility may change in a future\n         * release.\n         */\n        export class DrawableContainerState implements Drawable.ConstantState{\n            mOwner:DrawableContainer;\n            private mDrawableFutures:SparseArray<ConstantStateFuture>;\n\n            mDrawables:Array<Drawable>;\n            get mNumChildren():number{\n                return this.mDrawables.length;\n            }\n\n            mVariablePadding=false;\n            mPaddingChecked=false;\n            mConstantPadding:Rect;\n\n            mConstantSize=false;\n            mComputedConstantSize=false;\n            mConstantWidth=0;\n            mConstantHeight=0;\n            mConstantMinimumWidth=0;\n            mConstantMinimumHeight=0;\n\n            mCheckedOpacity=false;\n            mOpacity=0;\n\n            mCheckedStateful=false;\n            mStateful=false;\n\n            mCheckedConstantState=false;\n            mCanConstantState=false;\n\n            mDither = DrawableContainer.DEFAULT_DITHER;\n\n            mMutated=false;\n            mEnterFadeDuration=0;\n            mExitFadeDuration=0;\n\n            mAutoMirrored=false;\n\n            constructor(orig:DrawableContainerState, owner:DrawableContainer){\n                this.mOwner = owner;\n                //mRes = res;\n\n                if (orig != null) {\n                    //mChangingConfigurations = orig.mChangingConfigurations;\n                    //mChildrenChangingConfigurations = orig.mChildrenChangingConfigurations;\n\n                    this.mCheckedConstantState = true;\n                    this.mCanConstantState = true;\n\n                    this.mVariablePadding = orig.mVariablePadding;\n                    this.mConstantSize = orig.mConstantSize;\n                    this.mDither = orig.mDither;\n                    this.mMutated = orig.mMutated;\n                    //this.mLayoutDirection = orig.mLayoutDirection;\n                    this.mEnterFadeDuration = orig.mEnterFadeDuration;\n                    this.mExitFadeDuration = orig.mExitFadeDuration;\n                    this.mAutoMirrored = orig.mAutoMirrored;\n\n                    // Cloning the following values may require creating futures.\n                    this.mConstantPadding = orig.getConstantPadding();\n                    this.mPaddingChecked = true;\n\n                    this.mConstantWidth = orig.getConstantWidth();\n                    this.mConstantHeight = orig.getConstantHeight();\n                    this.mConstantMinimumWidth = orig.getConstantMinimumWidth();\n                    this.mConstantMinimumHeight = orig.getConstantMinimumHeight();\n                    this.mComputedConstantSize = true;\n\n                    this.mOpacity = orig.getOpacity();\n                    this.mCheckedOpacity = true;\n\n                    this.mStateful = orig.isStateful();\n                    this.mCheckedStateful = true;\n\n                    // Postpone cloning children and futures until we're absolutely\n                    // sure that we're done computing values for the original state.\n                    const origDr = orig.mDrawables;\n                    this.mDrawables = new Array<Drawable>(0);\n                    //this.mNumChildren = orig.mNumChildren;\n\n                    const origDf = orig.mDrawableFutures;\n                    if (origDf != null) {\n                        this.mDrawableFutures = origDf.clone();\n                    } else {\n                        this.mDrawableFutures = new SparseArray<ConstantStateFuture>(this.mNumChildren);\n                    }\n\n                    const N = this.mNumChildren;\n                    for (let i = 0; i < N; i++) {\n                        if (origDr[i] != null) {\n                            this.mDrawableFutures.put(i, new ConstantStateFuture(origDr[i]));\n                        }\n                    }\n                } else {\n                    this.mDrawables = new Array<Drawable>(0);\n                    //this.mNumChildren = 0;\n                }\n            }\n            addChild(dr:Drawable):number {\n                const pos = this.mNumChildren;\n\n                //if (pos >= this.mDrawables.length) {\n                //    this.growArray(pos, pos+10);\n                //}\n\n                dr.setVisible(false, true);\n                dr.setCallback(this.mOwner);\n\n                //this.mDrawables[pos] = dr;\n                //this.mNumChildren++;\n                this.mDrawables.push(dr);\n\n                //this.mChildrenChangingConfigurations |= dr.getChangingConfigurations();\n                this.mCheckedStateful = false;\n                this.mCheckedOpacity = false;\n\n                this.mConstantPadding = null;\n                this.mPaddingChecked = false;\n                this.mComputedConstantSize = false;\n\n                return pos;\n            }\n            getCapacity():number {\n                return this.mDrawables.length;\n            }\n            private createAllFutures() {\n                if (this.mDrawableFutures != null) {\n                    const futureCount = this.mDrawableFutures.size();\n                    for (let keyIndex = 0; keyIndex < futureCount; keyIndex++) {\n                        const index = this.mDrawableFutures.keyAt(keyIndex);\n                        this.mDrawables[index] = this.mDrawableFutures.valueAt(keyIndex).get(this);\n                    }\n\n                    this.mDrawableFutures = null;\n                }\n            }\n            getChildCount() {\n                return this.mNumChildren;\n            }\n\n            /*\n             * @deprecated Use {@link #getChild} instead.\n             */\n            getChildren():Array<Drawable> {\n                // Create all futures for backwards compatibility.\n                this.createAllFutures();\n\n                return this.mDrawables;\n            }\n            getChild(index:number):Drawable {\n                const result = this.mDrawables[index];\n                if (result != null) {\n                    return result;\n                }\n\n                // Prepare future drawable if necessary.\n                if (this.mDrawableFutures != null) {\n                    const keyIndex = this.mDrawableFutures.indexOfKey(index);\n                    if (keyIndex >= 0) {\n                        const prepared = this.mDrawableFutures.valueAt(keyIndex).get(this);\n                        this.mDrawables[index] = prepared;\n                        this.mDrawableFutures.removeAt(keyIndex);\n                        return prepared;\n                    }\n                }\n\n                return null;\n            }\n            mutate() {\n                // No need to call createAllFutures, since future drawables will\n                // mutate when they are prepared.\n                const N = this.mNumChildren;\n                const drawables = this.mDrawables;\n                for (let i = 0; i < N; i++) {\n                    if (drawables[i] != null) {\n                        drawables[i].mutate();\n                    }\n                }\n\n                this.mMutated = true;\n            }\n            /**\n             * A boolean value indicating whether to use the maximum padding value\n             * of all frames in the set (false), or to use the padding value of the\n             * frame being shown (true). Default value is false.\n             */\n            setVariablePadding(variable:boolean) {\n                this.mVariablePadding = variable;\n            }\n            getConstantPadding():Rect {\n                if (this.mVariablePadding) {\n                    return null;\n                }\n\n                if ((this.mConstantPadding != null) || this.mPaddingChecked) {\n                    return this.mConstantPadding;\n                }\n\n                this.createAllFutures();\n\n                let r = null;\n                const t = new Rect();\n                const N = this.mNumChildren;\n                const drawables = this.mDrawables;\n                for (let i = 0; i < N; i++) {\n                    if (drawables[i].getPadding(t)) {\n                        if (r == null) r = new Rect(0, 0, 0, 0);\n                        if (t.left > r.left) r.left = t.left;\n                        if (t.top > r.top) r.top = t.top;\n                        if (t.right > r.right) r.right = t.right;\n                        if (t.bottom > r.bottom) r.bottom = t.bottom;\n                    }\n                }\n\n                this.mPaddingChecked = true;\n                return (this.mConstantPadding = r);\n            }\n            setConstantSize(constant:boolean) {\n                this.mConstantSize = constant;\n            }\n            isConstantSize():boolean {\n                return this.mConstantSize;\n            }\n            getConstantWidth():number {\n                if (!this.mComputedConstantSize) {\n                    this.computeConstantSize();\n                }\n\n                return this.mConstantWidth;\n            }\n            getConstantHeight():number {\n                if (!this.mComputedConstantSize) {\n                    this.computeConstantSize();\n                }\n\n                return this.mConstantHeight;\n            }\n            getConstantMinimumWidth():number {\n                if (!this.mComputedConstantSize) {\n                    this.computeConstantSize();\n                }\n\n                return this.mConstantMinimumWidth;\n            }\n            getConstantMinimumHeight():number {\n                if (!this.mComputedConstantSize) {\n                    this.computeConstantSize();\n                }\n\n                return this.mConstantMinimumHeight;\n            }\n            computeConstantSize() {\n                this.mComputedConstantSize = true;\n\n                this.createAllFutures();\n\n                const N = this.mNumChildren;\n                const drawables = this.mDrawables;\n                this.mConstantWidth = this.mConstantHeight = -1;\n                this.mConstantMinimumWidth = this.mConstantMinimumHeight = 0;\n                for (let i = 0; i < N; i++) {\n                    const dr = drawables[i];\n                    let s = dr.getIntrinsicWidth();\n                    if (s > this.mConstantWidth) this.mConstantWidth = s;\n                    s = dr.getIntrinsicHeight();\n                    if (s > this.mConstantHeight) this.mConstantHeight = s;\n                    s = dr.getMinimumWidth();\n                    if (s > this.mConstantMinimumWidth) this.mConstantMinimumWidth = s;\n                    s = dr.getMinimumHeight();\n                    if (s > this.mConstantMinimumHeight) this.mConstantMinimumHeight = s;\n                }\n            }\n            setEnterFadeDuration(duration:number) {\n                this.mEnterFadeDuration = duration;\n            }\n            getEnterFadeDuration():number {\n                return this.mEnterFadeDuration;\n            }\n            setExitFadeDuration(duration:number) {\n                this.mExitFadeDuration = duration;\n            }\n            getExitFadeDuration():number {\n                return this.mExitFadeDuration;\n            }\n            getOpacity():number {\n                if (this.mCheckedOpacity) {\n                    return this.mOpacity;\n                }\n\n                this.createAllFutures();\n\n                this.mCheckedOpacity = true;\n\n                const N = this.mNumChildren;\n                const drawables = this.mDrawables;\n                let op = (N > 0) ? drawables[0].getOpacity() : PixelFormat.TRANSPARENT;\n                for (let i = 1; i < N; i++) {\n                    op = Drawable.resolveOpacity(op, drawables[i].getOpacity());\n                }\n\n                this.mOpacity = op;\n                return op;\n            }\n            isStateful():boolean {\n                if (this.mCheckedStateful) {\n                    return this.mStateful;\n                }\n\n                this.createAllFutures();\n\n                this.mCheckedStateful = true;\n\n                const N = this.mNumChildren;\n                const drawables = this.mDrawables;\n                for (let i = 0; i < N; i++) {\n                    if (drawables[i].isStateful()) {\n                        this.mStateful = true;\n                        return true;\n                    }\n                }\n\n                this.mStateful = false;\n                return false;\n            }\n            canConstantState():boolean {\n                if (this.mCheckedConstantState) {\n                    return this.mCanConstantState;\n                }\n\n                this.createAllFutures();\n\n                this.mCheckedConstantState = true;\n\n                const N = this.mNumChildren;\n                const drawables = this.mDrawables;\n                for (let i = 0; i < N; i++) {\n                    if (drawables[i].getConstantState() == null) {\n                        this.mCanConstantState = false;\n                        return false;\n                    }\n                }\n\n                this.mCanConstantState = true;\n                return true;\n            }\n\n            //abstract\n            newDrawable():android.graphics.drawable.Drawable {\n                return undefined;\n            }\n\n        }\n\n        /**\n         * Class capable of cloning a Drawable from another Drawable's\n         * ConstantState.\n         */\n        class ConstantStateFuture{\n            private mConstantState:Drawable.ConstantState;\n            constructor(source:Drawable) {\n                this.mConstantState = source.getConstantState();\n            }\n            /**\n             * Obtains and prepares the Drawable represented by this future.\n             *\n             * @param state the container into which this future will be placed\n             * @return a prepared Drawable\n             */\n            get(state:DrawableContainerState):Drawable {\n                const result = this.mConstantState.newDrawable();\n                //result.setLayoutDirection(state.mLayoutDirection);\n                result.setCallback(state.mOwner);\n\n                if (state.mMutated) {\n                    result.mutate();\n                }\n\n                return result;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/android/graphics/drawable/InsetDrawable.ts",
    "content": "/*\n * Copyright (C) 2008 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n///<reference path=\"Drawable.ts\"/>\n///<reference path=\"../Canvas.ts\"/>\n\n\nmodule android.graphics.drawable {\n    import Canvas = android.graphics.Canvas;\n    import Integer = java.lang.Integer;\n\n    /**\n     * A Drawable that insets another Drawable by a specified distance.\n     * This is used when a View needs a background that is smaller than\n     * the View's actual bounds.\n     *\n     * <p>It can be defined in an XML file with the <code>&lt;inset></code> element. For more\n     * information, see the guide to <a\n     * href=\"{@docRoot}guide/topics/resources/drawable-resource.html\">Drawable Resources</a>.</p>\n     *\n     * @attr ref android.R.styleable#InsetDrawable_visible\n     * @attr ref android.R.styleable#InsetDrawable_drawable\n     * @attr ref android.R.styleable#InsetDrawable_insetLeft\n     * @attr ref android.R.styleable#InsetDrawable_insetRight\n     * @attr ref android.R.styleable#InsetDrawable_insetTop\n     * @attr ref android.R.styleable#InsetDrawable_insetBottom\n     */\n    export class InsetDrawable extends Drawable implements Drawable.Callback {\n        // Most of this is copied from ScaleDrawable.\n        private mInsetState:InsetState;\n        private mTmpRect = new Rect();\n        private mMutated = false;\n\n        constructor(drawable:Drawable, insetLeft:number, insetTop = insetLeft, insetRight = insetTop, insetBottom = insetRight) {\n            super();\n            this.mInsetState = new InsetState(null, this);\n            this.mInsetState.mDrawable = drawable;\n            this.mInsetState.mInsetLeft = insetLeft;\n            this.mInsetState.mInsetTop = insetTop;\n            this.mInsetState.mInsetRight = insetRight;\n            this.mInsetState.mInsetBottom = insetBottom;\n\n            if (drawable != null) {\n                drawable.setCallback(this);\n            }\n        }\n\n\n        inflate(r:android.content.res.Resources, parser:HTMLElement):void {\n            super.inflate(r, parser);\n\n            // Reset mDrawable to preserve old multiple-inflate behavior. This is\n            // silly, but we have CTS tests that rely on it.\n            this.mInsetState.mDrawable = null;\n            let state = this.mInsetState;\n\n            let a = r.obtainAttributes(parser);\n            let dr = a.getDrawable(\"android:drawable\");\n            if (!dr && parser.children[0] instanceof HTMLElement) {\n                dr = Drawable.createFromXml(r, <HTMLElement>parser.children[0]);\n            }\n            if (!dr) {\n                throw Error(\"<inset> tag requires a 'drawable' attribute or child tag defining a drawable\");\n            }\n\n            let inset = a.getDimensionPixelOffset(\"android:inset\", Integer.MIN_VALUE);\n            if (inset != Integer.MIN_VALUE) {\n                state.mInsetLeft = inset;\n                state.mInsetTop = inset;\n                state.mInsetRight = inset;\n                state.mInsetBottom = inset;\n            }\n            state.mInsetLeft = a.getDimensionPixelOffset(\"android:insetLeft\", state.mInsetLeft);\n            state.mInsetTop = a.getDimensionPixelOffset(\"android:insetTop\", state.mInsetTop);\n            state.mInsetRight = a.getDimensionPixelOffset(\"android:insetRight\", state.mInsetRight);\n            state.mInsetBottom = a.getDimensionPixelOffset(\"android:insetBottom\", state.mInsetBottom);\n        }\n\n        drawableSizeChange(who:android.graphics.drawable.Drawable):any {\n            const callback = this.getCallback();\n            if (callback != null && callback.drawableSizeChange) {\n                callback.drawableSizeChange(this);\n            }\n        }\n\n        invalidateDrawable(who:android.graphics.drawable.Drawable):void {\n            const callback = this.getCallback();\n            if (callback != null) {\n                callback.invalidateDrawable(this);\n            }\n        }\n\n        scheduleDrawable(who:android.graphics.drawable.Drawable, what:java.lang.Runnable, when:number):void {\n            const callback = this.getCallback();\n            if (callback != null) {\n                callback.scheduleDrawable(this, what, when);\n            }\n        }\n\n        unscheduleDrawable(who:android.graphics.drawable.Drawable, what:java.lang.Runnable):void {\n            const callback = this.getCallback();\n            if (callback != null) {\n                callback.unscheduleDrawable(this, what);\n            }\n        }\n\n        draw(canvas:Canvas) {\n            this.mInsetState.mDrawable.draw(canvas);\n        }\n\n\n        getPadding(padding:android.graphics.Rect):boolean {\n            let pad = this.mInsetState.mDrawable.getPadding(padding);\n\n            padding.left += this.mInsetState.mInsetLeft;\n            padding.right += this.mInsetState.mInsetRight;\n            padding.top += this.mInsetState.mInsetTop;\n            padding.bottom += this.mInsetState.mInsetBottom;\n\n            if (pad || (this.mInsetState.mInsetLeft | this.mInsetState.mInsetRight |\n                this.mInsetState.mInsetTop | this.mInsetState.mInsetBottom) != 0) {\n                return true;\n            } else {\n                return false;\n            }\n        }\n\n        setVisible(visible:boolean, restart:boolean):boolean {\n            this.mInsetState.mDrawable.setVisible(visible, restart);\n            return super.setVisible(visible, restart);\n        }\n\n\n        setAlpha(alpha:number) {\n            this.mInsetState.mDrawable.setAlpha(alpha);\n        }\n\n        getAlpha():number {\n            return this.mInsetState.mDrawable.getAlpha();\n        }\n\n        getOpacity():number {\n            return this.mInsetState.mDrawable.getOpacity();\n        }\n\n        isStateful():boolean {\n            return this.mInsetState.mDrawable.isStateful();\n        }\n\n        protected onStateChange(state:Array<number>):boolean {\n            let changed = this.mInsetState.mDrawable.setState(state);\n            this.onBoundsChange(this.getBounds());\n            return changed;\n        }\n\n        protected onBoundsChange(bounds:android.graphics.Rect):void {\n            const r = this.mTmpRect;\n            r.set(bounds);\n\n            r.left += this.mInsetState.mInsetLeft;\n            r.top += this.mInsetState.mInsetTop;\n            r.right -= this.mInsetState.mInsetRight;\n            r.bottom -= this.mInsetState.mInsetBottom;\n\n            this.mInsetState.mDrawable.setBounds(r.left, r.top, r.right, r.bottom);\n        }\n\n        getIntrinsicWidth():number {\n            return this.mInsetState.mDrawable.getIntrinsicWidth();\n        }\n\n        getIntrinsicHeight():number {\n            return this.mInsetState.mDrawable.getIntrinsicHeight();\n        }\n\n        getConstantState():Drawable.ConstantState {\n            if (this.mInsetState.canConstantState()) {\n                //this.mInsetState.mChangingConfigurations = getChangingConfigurations();\n                return this.mInsetState;\n            }\n            return null;\n        }\n\n        mutate():Drawable {\n            if (!this.mMutated && super.mutate() == this) {\n                this.mInsetState.mDrawable.mutate();\n                this.mMutated = true;\n            }\n            return this;\n        }\n\n        /**\n         * Returns the drawable wrapped by this InsetDrawable. May be null.\n         */\n        getDrawable():Drawable {\n            return this.mInsetState.mDrawable;\n        }\n    }\n\n    class InsetState implements Drawable.ConstantState {\n        mDrawable:Drawable;\n        mInsetLeft = 0;\n        mInsetTop = 0;\n        mInsetRight = 0;\n        mInsetBottom = 0;\n        mCheckedConstantState:boolean;\n        mCanConstantState:boolean;\n\n        constructor(orig:InsetState, owner:InsetDrawable) {\n            if (orig != null) {\n                this.mDrawable = orig.mDrawable.getConstantState().newDrawable();\n                this.mDrawable.setCallback(owner);\n                //this.mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection());\n                this.mInsetLeft = orig.mInsetLeft;\n                this.mInsetTop = orig.mInsetTop;\n                this.mInsetRight = orig.mInsetRight;\n                this.mInsetBottom = orig.mInsetBottom;\n                this.mCheckedConstantState = this.mCanConstantState = true;\n            }\n        }\n\n        newDrawable():Drawable {\n            let drawable = new InsetDrawable(null, 0);\n            (<any>drawable).mInsetState = new InsetState(this, drawable);\n            return drawable;\n        }\n\n        canConstantState():boolean {\n            if (!this.mCheckedConstantState) {\n                this.mCanConstantState = this.mDrawable.getConstantState() != null;\n                this.mCheckedConstantState = true;\n            }\n\n            return this.mCanConstantState;\n        }\n\n    }\n}"
  },
  {
    "path": "src/android/graphics/drawable/LayerDrawable.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/content/res/Resources.ts\"/>\n///<reference path=\"../../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../../android/graphics/PixelFormat.ts\"/>\n///<reference path=\"../../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../../android/view/View.ts\"/>\n///<reference path=\"../../../java/lang/System.ts\"/>\n///<reference path=\"../../../java/lang/Runnable.ts\"/>\n///<reference path=\"../../../android/graphics/drawable/Drawable.ts\"/>\n\nmodule android.graphics.drawable {\n    import Resources = android.content.res.Resources;\n    import Canvas = android.graphics.Canvas;\n    import PixelFormat = android.graphics.PixelFormat;\n    import Rect = android.graphics.Rect;\n    import View = android.view.View;\n    import System = java.lang.System;\n    import Runnable = java.lang.Runnable;\n    import Drawable = android.graphics.drawable.Drawable;\n    import TypedArray = android.content.res.TypedArray;\n    /**\n     * A Drawable that manages an array of other Drawables. These are drawn in array\n     * order, so the element with the largest index will be drawn on top.\n     * <p>\n     * It can be defined in an XML file with the <code>&lt;layer-list></code> element.\n     * Each Drawable in the layer is defined in a nested <code>&lt;item></code>. For more\n     * information, see the guide to <a\n     * href=\"{@docRoot}guide/topics/resources/drawable-resource.html\">Drawable Resources</a>.</p>\n     *\n     * @attr ref android.R.styleable#LayerDrawableItem_left\n     * @attr ref android.R.styleable#LayerDrawableItem_top\n     * @attr ref android.R.styleable#LayerDrawableItem_right\n     * @attr ref android.R.styleable#LayerDrawableItem_bottom\n     * @attr ref android.R.styleable#LayerDrawableItem_drawable\n     * @attr ref android.R.styleable#LayerDrawableItem_id\n     */\n    export class LayerDrawable extends Drawable implements Drawable.Callback {\n\n        mLayerState:LayerDrawable.LayerState;\n\n        private mOpacityOverride:number = PixelFormat.UNKNOWN;\n\n        private mPaddingL:number[];\n\n        private mPaddingT:number[];\n\n        private mPaddingR:number[];\n\n        private mPaddingB:number[];\n\n        private mTmpRect:Rect = new Rect();\n\n        private mMutated:boolean;\n\n        /**\n         * Create a new layer drawable with the specified list of layers and the specified\n         * constant state.\n         *\n         * @param layers The list of layers to add to this drawable.\n         * @param state The constant drawable state.\n         */\n        constructor(layers:Drawable[], state:LayerDrawable.LayerState = null) {\n            super();\n            let _as:LayerDrawable.LayerState = this.createConstantState(state);\n            this.mLayerState = _as;\n            if (_as.mNum > 0) {\n                this.ensurePadding();\n            }\n\n            if (layers != null) {\n                let length:number = layers.length;\n                let r:LayerDrawable.ChildDrawable[] = new Array<LayerDrawable.ChildDrawable>(length);\n                for (let i:number = 0; i < length; i++) {\n                    r[i] = new LayerDrawable.ChildDrawable();\n                    r[i].mDrawable = layers[i];\n                    layers[i].setCallback(this);\n                    //this.mLayerState.mChildrenChangingConfigurations |= layers[i].getChangingConfigurations();\n                }\n                this.mLayerState.mNum = length;\n                this.mLayerState.mChildren = r;\n                this.ensurePadding();\n            }\n        }\n\n        createConstantState(state:LayerDrawable.LayerState):LayerDrawable.LayerState {\n            return new LayerDrawable.LayerState(state, this);\n        }\n\n        inflate(r:Resources, parser:HTMLElement):void {\n            super.inflate(r, parser);\n            let a:TypedArray = r.obtainAttributes(parser);\n            this.mOpacityOverride = a.getInt(\"android:opacity\", PixelFormat.UNKNOWN);\n            this.setAutoMirrored(a.getBoolean(\"android:autoMirrored\", false));\n            a.recycle();\n\n            //parse children\n            for(let child of Array.from(parser.children)) {\n                let item = <HTMLElement>child;\n                if (item.tagName.toLowerCase() !== 'item') {\n                    continue;\n                }\n                a = r.obtainAttributes(item);\n                let left:number = a.getDimensionPixelOffset(\"android:left\", 0);\n                let top:number = a.getDimensionPixelOffset(\"android:top\", 0);\n                let right:number = a.getDimensionPixelOffset(\"android:right\", 0);\n                let bottom:number = a.getDimensionPixelOffset(\"android:bottom\", 0);\n                let dr:Drawable = a.getDrawable(\"android:drawable\");\n                let id:string = a.getString(\"android:id\");\n                a.recycle();\n                if(!dr && item.children[0] instanceof HTMLElement){\n                    dr = Drawable.createFromXml(r, <HTMLElement>item.children[0]);\n                }\n                if (!dr) {\n                    throw Error(`new XmlPullParserException(<item> tag requires a 'drawable' attribute or child tag defining a drawable)`);\n                }\n                this.addLayer(dr, id, left, top, right, bottom);\n            }\n            this.ensurePadding();\n            this.onStateChange(this.getState());\n        }\n\n        /**\n         * Add a new layer to this drawable. The new layer is identified by an id.\n         *\n         * @param layer The drawable to add as a layer.\n         * @param id The id of the new layer.\n         * @param left The left padding of the new layer.\n         * @param top The top padding of the new layer.\n         * @param right The right padding of the new layer.\n         * @param bottom The bottom padding of the new layer.\n         */\n        private addLayer(layer:Drawable, id:string, left = 0, top = 0, right = 0, bottom = 0):void {\n            const st:LayerDrawable.LayerState = this.mLayerState;\n            let N:number = st.mChildren != null ? st.mChildren.length : 0;\n            let i:number = st.mNum;\n            if (i >= N) {\n                let nu:LayerDrawable.ChildDrawable[] = new Array<LayerDrawable.ChildDrawable>(N + 10);\n                if (i > 0) {\n                    System.arraycopy(st.mChildren, 0, nu, 0, i);\n                }\n                st.mChildren = nu;\n            }\n            //this.mLayerState.mChildrenChangingConfigurations |= layer.getChangingConfigurations();\n            let childDrawable:LayerDrawable.ChildDrawable = new LayerDrawable.ChildDrawable();\n            st.mChildren[i] = childDrawable;\n            childDrawable.mId = id;\n            childDrawable.mDrawable = layer;\n            childDrawable.mDrawable.setAutoMirrored(this.isAutoMirrored());\n            childDrawable.mInsetL = left;\n            childDrawable.mInsetT = top;\n            childDrawable.mInsetR = right;\n            childDrawable.mInsetB = bottom;\n            st.mNum++;\n            layer.setCallback(this);\n        }\n\n        /**\n         * Look for a layer with the given id, and returns its {@link Drawable}.\n         *\n         * @param id The layer ID to search for.\n         * @return The {@link Drawable} of the layer that has the given id in the hierarchy or null.\n         */\n        findDrawableByLayerId(id:string):Drawable {\n            const layers:LayerDrawable.ChildDrawable[] = this.mLayerState.mChildren;\n            for (let i:number = this.mLayerState.mNum - 1; i >= 0; i--) {\n                if (layers[i].mId == id) {\n                    return layers[i].mDrawable;\n                }\n            }\n            return null;\n        }\n\n        /**\n         * Sets the ID of a layer.\n         *\n         * @param index The index of the layer which will received the ID.\n         * @param id The ID to assign to the layer.\n         */\n        setId(index:number, id:string):void {\n            this.mLayerState.mChildren[index].mId = id;\n        }\n\n        /**\n         * Returns the number of layers contained within this.\n         * @return The number of layers.\n         */\n        getNumberOfLayers():number {\n            return this.mLayerState.mNum;\n        }\n\n        /**\n         * Returns the drawable at the specified layer index.\n         *\n         * @param index The layer index of the drawable to retrieve.\n         *\n         * @return The {@link android.graphics.drawable.Drawable} at the specified layer index.\n         */\n        getDrawable(index:number):Drawable {\n            return this.mLayerState.mChildren[index].mDrawable;\n        }\n\n        /**\n         * Returns the id of the specified layer.\n         *\n         * @param index The index of the layer.\n         *\n         * @return The id of the layer or {@link android.view.View#NO_ID} if the layer has no id.\n         */\n        getId(index:number):string {\n            return this.mLayerState.mChildren[index].mId;\n        }\n\n        /**\n         * Sets (or replaces) the {@link Drawable} for the layer with the given id.\n         *\n         * @param id The layer ID to search for.\n         * @param drawable The replacement {@link Drawable}.\n         * @return Whether the {@link Drawable} was replaced (could return false if\n         *         the id was not found).\n         */\n        setDrawableByLayerId(id:string, drawable:Drawable):boolean {\n            const layers:LayerDrawable.ChildDrawable[] = this.mLayerState.mChildren;\n            for (let i:number = this.mLayerState.mNum - 1; i >= 0; i--) {\n                if (layers[i].mId == id) {\n                    if (layers[i].mDrawable != null) {\n                        if (drawable != null) {\n                            let bounds:Rect = layers[i].mDrawable.getBounds();\n                            drawable.setBounds(bounds);\n                        }\n                        layers[i].mDrawable.setCallback(null);\n                    }\n                    if (drawable != null) {\n                        drawable.setCallback(this);\n                    }\n                    layers[i].mDrawable = drawable;\n                    return true;\n                }\n            }\n            return false;\n        }\n\n        /** Specify modifiers to the bounds for the drawable[index].\n         left += l\n         top += t;\n         right -= r;\n         bottom -= b;\n         */\n        setLayerInset(index:number, l:number, t:number, r:number, b:number):void {\n            let childDrawable:LayerDrawable.ChildDrawable = this.mLayerState.mChildren[index];\n            childDrawable.mInsetL = l;\n            childDrawable.mInsetT = t;\n            childDrawable.mInsetR = r;\n            childDrawable.mInsetB = b;\n        }\n\n        drawableSizeChange(who:android.graphics.drawable.Drawable):void {\n            let callback = this.getCallback();\n            if (callback != null && callback.drawableSizeChange) {\n                callback.drawableSizeChange(this);\n            }\n        }\n\n        // overrides from Drawable.Callback\n        invalidateDrawable(who:Drawable):void {\n            const callback:Drawable.Callback = this.getCallback();\n            if (callback != null) {\n                callback.invalidateDrawable(this);\n            }\n        }\n\n        scheduleDrawable(who:Drawable, what:Runnable, when:number):void {\n            const callback:Drawable.Callback = this.getCallback();\n            if (callback != null) {\n                callback.scheduleDrawable(this, what, when);\n            }\n        }\n\n        unscheduleDrawable(who:Drawable, what:Runnable):void {\n            const callback:Drawable.Callback = this.getCallback();\n            if (callback != null) {\n                callback.unscheduleDrawable(this, what);\n            }\n        }\n\n        // overrides from Drawable\n        draw(canvas:Canvas):void {\n            const array:LayerDrawable.ChildDrawable[] = this.mLayerState.mChildren;\n            const N:number = this.mLayerState.mNum;\n            for (let i:number = 0; i < N; i++) {\n                array[i].mDrawable.draw(canvas);\n            }\n        }\n\n        //getChangingConfigurations():number  {\n        //    return super.getChangingConfigurations() | this.mLayerState.mChangingConfigurations | this.mLayerState.mChildrenChangingConfigurations;\n        //}\n\n        getPadding(padding:Rect):boolean {\n            // Arbitrarily get the padding from the first image.\n            // Technically we should maybe do something more intelligent,\n            // like take the max padding of all the images.\n            padding.left = 0;\n            padding.top = 0;\n            padding.right = 0;\n            padding.bottom = 0;\n            const array:LayerDrawable.ChildDrawable[] = this.mLayerState.mChildren;\n            const N:number = this.mLayerState.mNum;\n            for (let i:number = 0; i < N; i++) {\n                this.reapplyPadding(i, array[i]);\n                padding.left += this.mPaddingL[i];\n                padding.top += this.mPaddingT[i];\n                padding.right += this.mPaddingR[i];\n                padding.bottom += this.mPaddingB[i];\n            }\n            return true;\n        }\n\n        setVisible(visible:boolean, restart:boolean):boolean {\n            let changed:boolean = super.setVisible(visible, restart);\n            const array:LayerDrawable.ChildDrawable[] = this.mLayerState.mChildren;\n            const N:number = this.mLayerState.mNum;\n            for (let i:number = 0; i < N; i++) {\n                array[i].mDrawable.setVisible(visible, restart);\n            }\n            return changed;\n        }\n\n        setDither(dither:boolean):void {\n            const array:LayerDrawable.ChildDrawable[] = this.mLayerState.mChildren;\n            const N:number = this.mLayerState.mNum;\n            for (let i:number = 0; i < N; i++) {\n                array[i].mDrawable.setDither(dither);\n            }\n        }\n\n        setAlpha(alpha:number):void {\n            const array:LayerDrawable.ChildDrawable[] = this.mLayerState.mChildren;\n            const N:number = this.mLayerState.mNum;\n            for (let i:number = 0; i < N; i++) {\n                array[i].mDrawable.setAlpha(alpha);\n            }\n        }\n\n        getAlpha():number {\n            const array:LayerDrawable.ChildDrawable[] = this.mLayerState.mChildren;\n            if (this.mLayerState.mNum > 0) {\n                // All layers should have the same alpha set on them - just return the first one\n                return array[0].mDrawable.getAlpha();\n            } else {\n                return super.getAlpha();\n            }\n        }\n\n        //setColorFilter(cf:ColorFilter):void  {\n        //    const array:LayerDrawable.ChildDrawable[] = this.mLayerState.mChildren;\n        //    const N:number = this.mLayerState.mNum;\n        //    for (let i:number = 0; i < N; i++) {\n        //        array[i].mDrawable.setColorFilter(cf);\n        //    }\n        //}\n\n        /**\n         * Sets the opacity of this drawable directly, instead of collecting the states from\n         * the layers\n         *\n         * @param opacity The opacity to use, or {@link PixelFormat#UNKNOWN PixelFormat.UNKNOWN}\n         * for the default behavior\n         *\n         * @see PixelFormat#UNKNOWN\n         * @see PixelFormat#TRANSLUCENT\n         * @see PixelFormat#TRANSPARENT\n         * @see PixelFormat#OPAQUE\n         */\n        setOpacity(opacity:number):void {\n            this.mOpacityOverride = opacity;\n        }\n\n        getOpacity():number {\n            if (this.mOpacityOverride != PixelFormat.UNKNOWN) {\n                return this.mOpacityOverride;\n            }\n            return this.mLayerState.getOpacity();\n        }\n\n        setAutoMirrored(mirrored:boolean):void {\n            this.mLayerState.mAutoMirrored = mirrored;\n            const array:LayerDrawable.ChildDrawable[] = this.mLayerState.mChildren;\n            const N:number = this.mLayerState.mNum;\n            for (let i:number = 0; i < N; i++) {\n                array[i].mDrawable.setAutoMirrored(mirrored);\n            }\n        }\n\n        isAutoMirrored():boolean {\n            return this.mLayerState.mAutoMirrored;\n        }\n\n        isStateful():boolean {\n            return this.mLayerState.isStateful();\n        }\n\n        protected onStateChange(state:number[]):boolean {\n            const array:LayerDrawable.ChildDrawable[] = this.mLayerState.mChildren;\n            const N:number = this.mLayerState.mNum;\n            let paddingChanged:boolean = false;\n            let changed:boolean = false;\n            for (let i:number = 0; i < N; i++) {\n                const r:LayerDrawable.ChildDrawable = array[i];\n                if (r.mDrawable.setState(state)) {\n                    changed = true;\n                }\n                if (this.reapplyPadding(i, r)) {\n                    paddingChanged = true;\n                }\n            }\n            if (paddingChanged) {\n                this.onBoundsChange(this.getBounds());\n            }\n            return changed;\n        }\n\n        protected onLevelChange(level:number):boolean {\n            const array:LayerDrawable.ChildDrawable[] = this.mLayerState.mChildren;\n            const N:number = this.mLayerState.mNum;\n            let paddingChanged:boolean = false;\n            let changed:boolean = false;\n            for (let i:number = 0; i < N; i++) {\n                const r:LayerDrawable.ChildDrawable = array[i];\n                if (r.mDrawable.setLevel(level)) {\n                    changed = true;\n                }\n                if (this.reapplyPadding(i, r)) {\n                    paddingChanged = true;\n                }\n            }\n            if (paddingChanged) {\n                this.onBoundsChange(this.getBounds());\n            }\n            return changed;\n        }\n\n        protected onBoundsChange(bounds:Rect):void {\n            const array:LayerDrawable.ChildDrawable[] = this.mLayerState.mChildren;\n            const N:number = this.mLayerState.mNum;\n            let padL:number = 0, padT:number = 0, padR:number = 0, padB:number = 0;\n            for (let i:number = 0; i < N; i++) {\n                const r:LayerDrawable.ChildDrawable = array[i];\n                r.mDrawable.setBounds(bounds.left + r.mInsetL + padL, bounds.top + r.mInsetT + padT, bounds.right - r.mInsetR - padR, bounds.bottom - r.mInsetB - padB);\n                padL += this.mPaddingL[i];\n                padR += this.mPaddingR[i];\n                padT += this.mPaddingT[i];\n                padB += this.mPaddingB[i];\n            }\n        }\n\n        getIntrinsicWidth():number {\n            let width:number = -1;\n            const array:LayerDrawable.ChildDrawable[] = this.mLayerState.mChildren;\n            const N:number = this.mLayerState.mNum;\n            let padL:number = 0, padR:number = 0;\n            for (let i:number = 0; i < N; i++) {\n                const r:LayerDrawable.ChildDrawable = array[i];\n                let w:number = r.mDrawable.getIntrinsicWidth() + r.mInsetL + r.mInsetR + padL + padR;\n                if (w > width) {\n                    width = w;\n                }\n                padL += this.mPaddingL[i];\n                padR += this.mPaddingR[i];\n            }\n            return width;\n        }\n\n        getIntrinsicHeight():number {\n            let height:number = -1;\n            const array:LayerDrawable.ChildDrawable[] = this.mLayerState.mChildren;\n            const N:number = this.mLayerState.mNum;\n            let padT:number = 0, padB:number = 0;\n            for (let i:number = 0; i < N; i++) {\n                const r:LayerDrawable.ChildDrawable = array[i];\n                let h:number = r.mDrawable.getIntrinsicHeight() + r.mInsetT + r.mInsetB + padT + padB;\n                if (h > height) {\n                    height = h;\n                }\n                padT += this.mPaddingT[i];\n                padB += this.mPaddingB[i];\n            }\n            return height;\n        }\n\n        private reapplyPadding(i:number, r:LayerDrawable.ChildDrawable):boolean {\n            const rect:Rect = this.mTmpRect;\n            r.mDrawable.getPadding(rect);\n            if (rect.left != this.mPaddingL[i] || rect.top != this.mPaddingT[i] || rect.right != this.mPaddingR[i] || rect.bottom != this.mPaddingB[i]) {\n                this.mPaddingL[i] = rect.left;\n                this.mPaddingT[i] = rect.top;\n                this.mPaddingR[i] = rect.right;\n                this.mPaddingB[i] = rect.bottom;\n                return true;\n            }\n            return false;\n        }\n\n        private ensurePadding():void {\n            const N:number = this.mLayerState.mNum;\n            if (this.mPaddingL != null && this.mPaddingL.length >= N) {\n                return;\n            }\n            this.mPaddingL = androidui.util.ArrayCreator.newNumberArray(N);\n            this.mPaddingT = androidui.util.ArrayCreator.newNumberArray(N);\n            this.mPaddingR = androidui.util.ArrayCreator.newNumberArray(N);\n            this.mPaddingB = androidui.util.ArrayCreator.newNumberArray(N);\n            //androidui: fill 0 to new array (like java)\n            for (var i = 0; i < N; i++) {\n                this.mPaddingL[i] = 0;\n                this.mPaddingT[i] = 0;\n                this.mPaddingR[i] = 0;\n                this.mPaddingB[i] = 0;\n            }\n        }\n\n        getConstantState():Drawable.ConstantState {\n            if (this.mLayerState.canConstantState()) {\n                //this.mLayerState.mChangingConfigurations = this.getChangingConfigurations();\n                return this.mLayerState;\n            }\n            return null;\n        }\n\n        mutate():Drawable {\n            if (!this.mMutated && super.mutate() == this) {\n                this.mLayerState = this.createConstantState(this.mLayerState);\n                const array:LayerDrawable.ChildDrawable[] = this.mLayerState.mChildren;\n                const N:number = this.mLayerState.mNum;\n                for (let i:number = 0; i < N; i++) {\n                    array[i].mDrawable.mutate();\n                }\n                this.mMutated = true;\n            }\n            return this;\n        }\n\n        ///** @hide */\n        //setLayoutDirection(layoutDirection:number):void  {\n        //    const array:LayerDrawable.ChildDrawable[] = this.mLayerState.mChildren;\n        //    const N:number = this.mLayerState.mNum;\n        //    for (let i:number = 0; i < N; i++) {\n        //        array[i].mDrawable.setLayoutDirection(layoutDirection);\n        //    }\n        //    super.setLayoutDirection(layoutDirection);\n        //}\n\n\n    }\n\n    export module LayerDrawable {\n        export class ChildDrawable {\n\n            mDrawable:Drawable;\n\n            mInsetL:number = 0;\n            mInsetT:number = 0;\n            mInsetR:number = 0;\n            mInsetB:number = 0;\n\n            mId:string;\n        }\n        export class LayerState implements Drawable.ConstantState {\n\n            mNum:number = 0;\n\n            mChildren:LayerDrawable.ChildDrawable[];\n\n            //mChangingConfigurations:number = 0;\n\n            //mChildrenChangingConfigurations:number = 0;\n\n            private mHaveOpacity:boolean = false;\n\n            private mOpacity:number = 0;\n\n            private mHaveStateful:boolean = false;\n\n            private mStateful:boolean;\n\n            private mCheckedConstantState:boolean;\n\n            private mCanConstantState:boolean;\n\n            private mAutoMirrored:boolean;\n\n            constructor(orig:LayerState, owner:LayerDrawable) {\n                if (orig != null) {\n                    const origChildDrawable:LayerDrawable.ChildDrawable[] = orig.mChildren;\n                    const N:number = orig.mNum;\n                    this.mNum = N;\n                    this.mChildren = new Array<LayerDrawable.ChildDrawable>(N);\n                    //this.mChangingConfigurations = orig.mChangingConfigurations;\n                    //this.mChildrenChangingConfigurations = orig.mChildrenChangingConfigurations;\n                    for (let i:number = 0; i < N; i++) {\n                        const r:LayerDrawable.ChildDrawable = this.mChildren[i] = new LayerDrawable.ChildDrawable();\n                        const or:LayerDrawable.ChildDrawable = origChildDrawable[i];\n                        //if (res != null) {\n                        //    r.mDrawable = or.mDrawable.getConstantState().newDrawable(res);\n                        //} else {\n                        r.mDrawable = or.mDrawable.getConstantState().newDrawable();\n                        //}\n                        r.mDrawable.setCallback(owner);\n                        //r.mDrawable.setLayoutDirection(or.mDrawable.getLayoutDirection());\n                        r.mInsetL = or.mInsetL;\n                        r.mInsetT = or.mInsetT;\n                        r.mInsetR = or.mInsetR;\n                        r.mInsetB = or.mInsetB;\n                        r.mId = or.mId;\n                    }\n                    this.mHaveOpacity = orig.mHaveOpacity;\n                    this.mOpacity = orig.mOpacity;\n                    this.mHaveStateful = orig.mHaveStateful;\n                    this.mStateful = orig.mStateful;\n                    this.mCheckedConstantState = this.mCanConstantState = true;\n                    this.mAutoMirrored = orig.mAutoMirrored;\n                } else {\n                    this.mNum = 0;\n                    this.mChildren = null;\n                }\n            }\n\n            newDrawable():Drawable {\n                return new LayerDrawable(null, this);\n            }\n\n            //getChangingConfigurations():number  {\n            //    return this.mChangingConfigurations;\n            //}\n\n            getOpacity():number {\n                if (this.mHaveOpacity) {\n                    return this.mOpacity;\n                }\n                const N:number = this.mNum;\n                let op:number = N > 0 ? this.mChildren[0].mDrawable.getOpacity() : PixelFormat.TRANSPARENT;\n                for (let i:number = 1; i < N; i++) {\n                    op = Drawable.resolveOpacity(op, this.mChildren[i].mDrawable.getOpacity());\n                }\n                this.mOpacity = op;\n                this.mHaveOpacity = true;\n                return op;\n            }\n\n            isStateful():boolean {\n                if (this.mHaveStateful) {\n                    return this.mStateful;\n                }\n                let stateful:boolean = false;\n                const N:number = this.mNum;\n                for (let i:number = 0; i < N; i++) {\n                    if (this.mChildren[i].mDrawable.isStateful()) {\n                        stateful = true;\n                        break;\n                    }\n                }\n                this.mStateful = stateful;\n                this.mHaveStateful = true;\n                return stateful;\n            }\n\n            canConstantState():boolean {\n                if (!this.mCheckedConstantState && this.mChildren != null) {\n                    this.mCanConstantState = true;\n                    const N:number = this.mNum;\n                    for (let i:number = 0; i < N; i++) {\n                        if (this.mChildren[i].mDrawable.getConstantState() == null) {\n                            this.mCanConstantState = false;\n                            break;\n                        }\n                    }\n                    this.mCheckedConstantState = true;\n                }\n                return this.mCanConstantState;\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "src/android/graphics/drawable/RotateDrawable.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../../android/content/res/Resources.ts\"/>\n///<reference path=\"../../../android/util/TypedValue.ts\"/>\n///<reference path=\"../../../android/util/Log.ts\"/>\n///<reference path=\"../../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../../java/lang/Runnable.ts\"/>\n\nmodule android.graphics.drawable {\nimport Canvas = android.graphics.Canvas;\nimport Rect = android.graphics.Rect;\nimport Resources = android.content.res.Resources;\nimport TypedValue = android.util.TypedValue;\nimport Log = android.util.Log;\nimport Drawable = android.graphics.drawable.Drawable;\nimport Runnable = java.lang.Runnable;\n    import TypedArray = android.content.res.TypedArray;\n\n/**\n * <p>A Drawable that can rotate another Drawable based on the current level\n * value. The start and end angles of rotation can be controlled to map any\n * circular arc to the level values range.</p>\n *\n * <p>It can be defined in an XML file with the <code>&lt;rotate></code> element. For more\n * information, see the guide to <a\n * href=\"{@docRoot}guide/topics/resources/animation-resource.html\">Animation Resources</a>.</p>\n *\n * @attr ref android.R.styleable#RotateDrawable_visible\n * @attr ref android.R.styleable#RotateDrawable_fromDegrees\n * @attr ref android.R.styleable#RotateDrawable_toDegrees\n * @attr ref android.R.styleable#RotateDrawable_pivotX\n * @attr ref android.R.styleable#RotateDrawable_pivotY\n * @attr ref android.R.styleable#RotateDrawable_drawable\n */\nexport class RotateDrawable extends Drawable implements Drawable.Callback {\n\n    private static MAX_LEVEL:number = 10000.0;\n\n    private mState:RotateDrawable.RotateState;\n\n    private mMutated:boolean;\n\n\n    /**\n     * <p>Create a new rotating drawable with the specified state. A copy of\n     * this state is used as the internal state for the newly created\n     * drawable.</p>\n     *\n     * @param rotateState the state for this drawable\n     */\n    constructor(rotateState?:RotateDrawable.RotateState) {\n        super();\n        this.mState = new RotateDrawable.RotateState(rotateState, this);\n    }\n\n    draw(canvas:Canvas):void  {\n        let saveCount:number = canvas.save();\n        let bounds:Rect = this.mState.mDrawable.getBounds();\n        let w:number = bounds.right - bounds.left;\n        let h:number = bounds.bottom - bounds.top;\n        const st:RotateDrawable.RotateState = this.mState;\n        let px:number = st.mPivotXRel ? (w * st.mPivotX) : st.mPivotX;\n        let py:number = st.mPivotYRel ? (h * st.mPivotY) : st.mPivotY;\n        canvas.rotate(st.mCurrentDegrees, px + bounds.left, py + bounds.top);\n        st.mDrawable.draw(canvas);\n        canvas.restoreToCount(saveCount);\n    }\n\n    /**\n     * Returns the drawable rotated by this RotateDrawable.\n     */\n    getDrawable():Drawable  {\n        return this.mState.mDrawable;\n    }\n\n    //getChangingConfigurations():number  {\n    //    return super.getChangingConfigurations() | this.mState.mChangingConfigurations | this.mState.mDrawable.getChangingConfigurations();\n    //}\n\n    setAlpha(alpha:number):void  {\n        this.mState.mDrawable.setAlpha(alpha);\n    }\n\n    getAlpha():number  {\n        return this.mState.mDrawable.getAlpha();\n    }\n\n    //setColorFilter(cf:ColorFilter):void  {\n    //    this.mState.mDrawable.setColorFilter(cf);\n    //}\n\n    getOpacity():number  {\n        return this.mState.mDrawable.getOpacity();\n    }\n\n    drawableSizeChange(who:android.graphics.drawable.Drawable):void {\n        const callback = this.getCallback();\n        if (callback != null && callback.drawableSizeChange) {\n            callback.drawableSizeChange(this);\n        }\n    }\n\n    invalidateDrawable(who:Drawable):void  {\n        const callback:Drawable.Callback = this.getCallback();\n        if (callback != null) {\n            callback.invalidateDrawable(this);\n        }\n    }\n\n    scheduleDrawable(who:Drawable, what:Runnable, when:number):void  {\n        const callback:Drawable.Callback = this.getCallback();\n        if (callback != null) {\n            callback.scheduleDrawable(this, what, when);\n        }\n    }\n\n    unscheduleDrawable(who:Drawable, what:Runnable):void  {\n        const callback:Drawable.Callback = this.getCallback();\n        if (callback != null) {\n            callback.unscheduleDrawable(this, what);\n        }\n    }\n\n    getPadding(padding:Rect):boolean  {\n        return this.mState.mDrawable.getPadding(padding);\n    }\n\n    setVisible(visible:boolean, restart:boolean):boolean  {\n        this.mState.mDrawable.setVisible(visible, restart);\n        return super.setVisible(visible, restart);\n    }\n\n    isStateful():boolean  {\n        return this.mState.mDrawable.isStateful();\n    }\n\n    protected onStateChange(state:number[]):boolean  {\n        let changed:boolean = this.mState.mDrawable.setState(state);\n        this.onBoundsChange(this.getBounds());\n        return changed;\n    }\n\n    protected onLevelChange(level:number):boolean  {\n        this.mState.mDrawable.setLevel(level);\n        this.onBoundsChange(this.getBounds());\n        this.mState.mCurrentDegrees = this.mState.mFromDegrees + (this.mState.mToDegrees - this.mState.mFromDegrees) * (level / RotateDrawable.MAX_LEVEL);\n        this.invalidateSelf();\n        return true;\n    }\n\n    protected onBoundsChange(bounds:Rect):void  {\n        this.mState.mDrawable.setBounds(bounds.left, bounds.top, bounds.right, bounds.bottom);\n    }\n\n    getIntrinsicWidth():number  {\n        return this.mState.mDrawable.getIntrinsicWidth();\n    }\n\n    getIntrinsicHeight():number  {\n        return this.mState.mDrawable.getIntrinsicHeight();\n    }\n\n    getConstantState():Drawable.ConstantState  {\n        if (this.mState.canConstantState()) {\n            //this.mState.mChangingConfigurations = this.getChangingConfigurations();\n            return this.mState;\n        }\n        return null;\n    }\n\n\n    inflate(r:Resources, parser:HTMLElement):void  {\n        super.inflate(r, parser);\n        let a:TypedArray = r.obtainAttributes(parser);\n\n        let tv:string = a.getString(\"android:pivotX\");\n        let pivotXRel:boolean;\n        let pivotX:number;\n        if (tv == null) {\n            pivotXRel = true;\n            pivotX = 0.5;\n        } else {\n            pivotXRel = tv.endsWith('%');\n            pivotX = a.getFloat('android:pivotX', 0.5);\n        }\n        tv = a.getString(\"android:pivotY\");\n        let pivotYRel:boolean;\n        let pivotY:number;\n        if (tv == null) {\n            pivotYRel = true;\n            pivotY = 0.5;\n        } else {\n            pivotYRel = tv.endsWith('%');\n            pivotY = a.getFloat('android:pivotY', 0.5);\n        }\n        let fromDegrees:number = a.getFloat(\"android:fromDegrees\", 0.0);\n        let toDegrees:number = a.getFloat(\"android:toDegrees\", 360.0);\n        let drawable:Drawable = a.getDrawable(\"android:drawable\");\n        a.recycle();\n\n        if (!drawable && parser.children[0] instanceof HTMLElement) {\n            drawable = Drawable.createFromXml(r, <HTMLElement>parser.children[0]);\n        }\n        if (drawable == null) {\n            Log.w(\"drawable\", \"No drawable specified for <rotate>\");\n        }\n        this.mState.mDrawable = drawable;\n        this.mState.mPivotXRel = pivotXRel;\n        this.mState.mPivotX = pivotX;\n        this.mState.mPivotYRel = pivotYRel;\n        this.mState.mPivotY = pivotY;\n        this.mState.mFromDegrees = this.mState.mCurrentDegrees = fromDegrees;\n        this.mState.mToDegrees = toDegrees;\n        if (drawable != null) {\n            drawable.setCallback(this);\n        }\n    }\n\n\n    mutate():Drawable  {\n        if (!this.mMutated && super.mutate() == this) {\n            this.mState.mDrawable.mutate();\n            this.mMutated = true;\n        }\n        return this;\n    }\n\n\n}\n\nexport module RotateDrawable{\n/**\n     * <p>Represents the state of a rotation for a given drawable. The same\n     * rotate drawable can be invoked with different states to drive several\n     * rotations at the same time.</p>\n     */\nexport class RotateState implements Drawable.ConstantState {\n\n    mDrawable:Drawable;\n\n    //mChangingConfigurations:number = 0;\n\n    mPivotXRel:boolean;\n\n    mPivotX:number = 0;\n\n    mPivotYRel:boolean;\n\n    mPivotY:number = 0;\n\n    mFromDegrees:number = 0;\n\n    mToDegrees:number = 0;\n\n    mCurrentDegrees:number = 0;\n\n    private mCanConstantState:boolean;\n\n    private mCheckedConstantState:boolean;\n\n    constructor(source:RotateState, owner:RotateDrawable) {\n        if (source != null) {\n            //if (res != null) {\n            //    this.mDrawable = source.mDrawable.getConstantState().newDrawable(res);\n            //} else {\n                this.mDrawable = source.mDrawable.getConstantState().newDrawable();\n            //}\n            this.mDrawable.setCallback(owner);\n            //this.mDrawable.setLayoutDirection(source.mDrawable.getLayoutDirection());\n            this.mPivotXRel = source.mPivotXRel;\n            this.mPivotX = source.mPivotX;\n            this.mPivotYRel = source.mPivotYRel;\n            this.mPivotY = source.mPivotY;\n            this.mFromDegrees = this.mCurrentDegrees = source.mFromDegrees;\n            this.mToDegrees = source.mToDegrees;\n            this.mCanConstantState = this.mCheckedConstantState = true;\n        }\n    }\n\n    newDrawable():Drawable  {\n        return new RotateDrawable(this);\n    }\n\n    //getChangingConfigurations():number  {\n    //    return this.mChangingConfigurations;\n    //}\n\n    canConstantState():boolean  {\n        if (!this.mCheckedConstantState) {\n            this.mCanConstantState = this.mDrawable.getConstantState() != null;\n            this.mCheckedConstantState = true;\n        }\n        return this.mCanConstantState;\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/graphics/drawable/RoundRectDrawable.ts",
    "content": "/**\n * Created by linfaxin on 15/10/29.\n * AndroidUI drawable\n */\n///<reference path=\"Drawable.ts\"/>\n///<reference path=\"../Canvas.ts\"/>\n///<reference path=\"../Paint.ts\"/>\n\n//TODO move to androidui/drawable\nmodule android.graphics.drawable{\n\n    export class RoundRectDrawable extends Drawable{\n        private mState:State;\n        private mMutated = false;\n        private mPaint = new Paint();\n        constructor(color:number, radiusTopLeft:number, radiusTopRight=radiusTopLeft, radiusBottomRight=radiusTopRight, radiusBottomLeft=radiusBottomRight){\n            super();\n            this.mState = new State();\n            this.setColor(color);\n            this.mState.mRadiusTopLeft = radiusTopLeft;\n            this.mState.mRadiusTopRight = radiusTopRight;\n            this.mState.mRadiusBottomRight = radiusBottomRight;\n            this.mState.mRadiusBottomLeft = radiusBottomLeft;\n        }\n        mutate():Drawable {\n            if (!this.mMutated && super.mutate() == this) {\n                this.mState = new State(this.mState);\n                this.mMutated = true;\n            }\n            return this;\n        }\n        draw(canvas:Canvas) {\n            if ((this.mState.mUseColor >>> 24) != 0) {\n                this.mPaint.setColor(this.mState.mUseColor);\n                canvas.drawRoundRect(this.getBounds(), this.mState.mRadiusTopLeft, this.mState.mRadiusTopRight,\n                    this.mState.mRadiusBottomRight, this.mState.mRadiusBottomLeft, this.mPaint);\n            }\n        }\n        getColor():number {\n            return this.mState.mUseColor;\n        }\n        setColor(color:number) {\n            if (this.mState.mBaseColor != color || this.mState.mUseColor != color) {\n                this.invalidateSelf();\n                this.mState.mBaseColor = this.mState.mUseColor = color;\n            }\n        }\n        getAlpha():number {\n            return this.mState.mUseColor >>> 24;\n        }\n        setAlpha(alpha:number) {\n            alpha += alpha >> 7;   // make it 0..256\n            let baseAlpha = this.mState.mBaseColor >>> 24;\n            let useAlpha = baseAlpha * alpha >> 8;\n            let oldUseColor = this.mState.mUseColor;\n            this.mState.mUseColor = (this.mState.mBaseColor << 8 >>> 8) | (useAlpha << 24);\n            if (oldUseColor != this.mState.mUseColor) {\n                this.invalidateSelf();\n            }\n        }\n        getOpacity():number {\n            switch (this.mState.mUseColor >>> 24) {\n                case 255:\n                    return PixelFormat.OPAQUE;\n                case 0:\n                    return PixelFormat.TRANSPARENT;\n            }\n            return PixelFormat.TRANSLUCENT;\n        }\n\n        getConstantState():Drawable.ConstantState {\n            return this.mState;\n        }\n\n    }\n\n    class State implements Drawable.ConstantState{\n        mBaseColor = 0;\n        mUseColor = 0;\n\n        mRadiusTopLeft = 0;\n        mRadiusTopRight = 0;\n        mRadiusBottomRight = 0;\n        mRadiusBottomLeft = 0;\n\n        constructor(state?:State){\n            if (state != null) {\n                this.mBaseColor = state.mBaseColor;\n                this.mUseColor = state.mUseColor;\n\n                this.mRadiusTopLeft = state.mRadiusTopLeft;\n                this.mRadiusTopRight = state.mRadiusTopRight;\n                this.mRadiusBottomRight = state.mRadiusBottomRight;\n                this.mRadiusBottomLeft = state.mRadiusBottomLeft;\n            }\n        }\n\n        newDrawable():Drawable {\n            let c =  new RoundRectDrawable(0, 0, 0, 0, 0);\n            c.mState = new State(this);\n            return c;\n        }\n    }\n}"
  },
  {
    "path": "src/android/graphics/drawable/ScaleDrawable.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../../android/content/res/Resources.ts\"/>\n///<reference path=\"../../../android/util/TypedValue.ts\"/>\n///<reference path=\"../../../android/util/Log.ts\"/>\n///<reference path=\"../../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../../java/lang/Runnable.ts\"/>\n///<reference path=\"../../../android/view/Gravity.ts\"/>\n///<reference path=\"../../../java/lang/Float.ts\"/>\n\nmodule android.graphics.drawable {\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n    import TypedValue = android.util.TypedValue;\n    import Log = android.util.Log;\n    import Resources = android.content.res.Resources;\n    import Gravity = android.view.Gravity;\n    import Runnable = java.lang.Runnable;\n    import Float = java.lang.Float;\n    import Drawable = android.graphics.drawable.Drawable;\n    import TypedArray = android.content.res.TypedArray;\n    /**\n     * A Drawable that changes the size of another Drawable based on its current\n     * level value.  You can control how much the child Drawable changes in width\n     * and height based on the level, as well as a gravity to control where it is\n     * placed in its overall container.  Most often used to implement things like\n     * progress bars.\n     *\n     * <p>It can be defined in an XML file with the <code>&lt;scale></code> element. For more\n     * information, see the guide to <a\n     * href=\"{@docRoot}guide/topics/resources/drawable-resource.html\">Drawable Resources</a>.</p>\n     *\n     * @attr ref android.R.styleable#ScaleDrawable_scaleWidth\n     * @attr ref android.R.styleable#ScaleDrawable_scaleHeight\n     * @attr ref android.R.styleable#ScaleDrawable_scaleGravity\n     * @attr ref android.R.styleable#ScaleDrawable_drawable\n     */\n    export class ScaleDrawable extends Drawable implements Drawable.Callback {\n\n        private mScaleState:ScaleDrawable.ScaleState;\n\n        private mMutated:boolean;\n\n        private mTmpRect:Rect = new Rect();\n\n        constructor(drawable:Drawable, gravity:number, scaleWidth:number, scaleHeight:number);\n        constructor(state?:ScaleDrawable.ScaleState);\n        constructor(...args) {\n            super();\n            if (args.length <= 1) {\n                this.mScaleState = new ScaleDrawable.ScaleState(args[0], this);\n                return;\n            }\n            let drawable:Drawable = args[0];\n            let gravity:number = args[1];\n            let scaleWidth:number = args[2];\n            let scaleHeight:number = args[3];\n\n            this.mScaleState = new ScaleDrawable.ScaleState(null, this);\n\n            this.mScaleState.mDrawable = drawable;\n            this.mScaleState.mGravity = gravity;\n            this.mScaleState.mScaleWidth = scaleWidth;\n            this.mScaleState.mScaleHeight = scaleHeight;\n            if (drawable != null) {\n                drawable.setCallback(this);\n            }\n        }\n\n        /**\n         * Returns the drawable scaled by this ScaleDrawable.\n         */\n        getDrawable():Drawable {\n            return this.mScaleState.mDrawable;\n        }\n\n        //private static getPercent(a:TypedArray, name:number):number  {\n        //    let s:string = a.getString(name);\n        //    if (s != null) {\n        //        if (s.endsWith(\"%\")) {\n        //            let f:string = s.substring(0, s.length() - 1);\n        //            return Float.parseFloat(f) / 100.0;\n        //        }\n        //    }\n        //    return -1;\n        //}\n\n        inflate(r:Resources, parser:HTMLElement):void {\n            super.inflate(r, parser);\n            let a:TypedArray = r.obtainAttributes(parser);\n            let sw:number = a.getFloat(\"android:scaleWidth\", 1);\n            let sh:number = a.getFloat(\"android:scaleHeight\", 1);\n            let gStr:string = a.getString(\"android:scaleGravity\");\n            let g = Gravity.parseGravity(gStr, Gravity.LEFT);\n            let min:boolean = a.getBoolean(\"android:useIntrinsicSizeAsMinimum\", false);\n            let dr:Drawable = a.getDrawable(\"android:drawable\");\n            a.recycle();\n\n\n            if (!dr && parser.children[0] instanceof HTMLElement) {\n                dr = Drawable.createFromXml(r, <HTMLElement>parser.children[0]);\n            }\n            if (dr == null) {\n                throw Error(`new IllegalArgumentException(\"No drawable specified for <scale>\")`);\n            }\n            this.mScaleState.mDrawable = dr;\n            this.mScaleState.mScaleWidth = sw;\n            this.mScaleState.mScaleHeight = sh;\n            this.mScaleState.mGravity = g;\n            this.mScaleState.mUseIntrinsicSizeAsMin = min;\n            if (dr != null) {\n                dr.setCallback(this);\n            }\n        }\n\n        // overrides from Drawable.Callback\n\n        drawableSizeChange(who:android.graphics.drawable.Drawable):void {\n            const callback = this.getCallback();\n            if (callback != null && callback.drawableSizeChange) {\n                callback.drawableSizeChange(this);\n            }\n        }\n\n        invalidateDrawable(who:Drawable):void {\n            if (this.getCallback() != null) {\n                this.getCallback().invalidateDrawable(this);\n            }\n        }\n\n        scheduleDrawable(who:Drawable, what:Runnable, when:number):void {\n            if (this.getCallback() != null) {\n                this.getCallback().scheduleDrawable(this, what, when);\n            }\n        }\n\n        unscheduleDrawable(who:Drawable, what:Runnable):void {\n            if (this.getCallback() != null) {\n                this.getCallback().unscheduleDrawable(this, what);\n            }\n        }\n\n        // overrides from Drawable\n        draw(canvas:Canvas):void {\n            if (this.mScaleState.mDrawable.getLevel() != 0)\n                this.mScaleState.mDrawable.draw(canvas);\n        }\n\n        //getChangingConfigurations():number  {\n        //    return super.getChangingConfigurations() | this.mScaleState.mChangingConfigurations | this.mScaleState.mDrawable.getChangingConfigurations();\n        //}\n\n        getPadding(padding:Rect):boolean {\n            // XXX need to adjust padding!\n            return this.mScaleState.mDrawable.getPadding(padding);\n        }\n\n        setVisible(visible:boolean, restart:boolean):boolean {\n            this.mScaleState.mDrawable.setVisible(visible, restart);\n            return super.setVisible(visible, restart);\n        }\n\n        setAlpha(alpha:number):void {\n            this.mScaleState.mDrawable.setAlpha(alpha);\n        }\n\n        getAlpha():number {\n            return this.mScaleState.mDrawable.getAlpha();\n        }\n\n        //setColorFilter(cf:ColorFilter):void  {\n        //    this.mScaleState.mDrawable.setColorFilter(cf);\n        //}\n\n        getOpacity():number {\n            return this.mScaleState.mDrawable.getOpacity();\n        }\n\n        isStateful():boolean {\n            return this.mScaleState.mDrawable.isStateful();\n        }\n\n        protected onStateChange(state:number[]):boolean {\n            let changed:boolean = this.mScaleState.mDrawable.setState(state);\n            this.onBoundsChange(this.getBounds());\n            return changed;\n        }\n\n        protected onLevelChange(level:number):boolean {\n            this.mScaleState.mDrawable.setLevel(level);\n            this.onBoundsChange(this.getBounds());\n            this.invalidateSelf();\n            return true;\n        }\n\n        protected onBoundsChange(bounds:Rect):void {\n            const r:Rect = this.mTmpRect;\n            const min:boolean = this.mScaleState.mUseIntrinsicSizeAsMin;\n            let level:number = this.getLevel();\n            let w:number = bounds.width();\n            if (this.mScaleState.mScaleWidth > 0) {\n                const iw:number = min ? this.mScaleState.mDrawable.getIntrinsicWidth() : 0;\n                w -= Math.floor(((w - iw) * (10000 - level) * this.mScaleState.mScaleWidth / 10000));\n            }\n            let h:number = bounds.height();\n            if (this.mScaleState.mScaleHeight > 0) {\n                const ih:number = min ? this.mScaleState.mDrawable.getIntrinsicHeight() : 0;\n                h -= Math.floor(((h - ih) * (10000 - level) * this.mScaleState.mScaleHeight / 10000));\n            }\n            //const layoutDirection:number = this.getLayoutDirection();\n            Gravity.apply(this.mScaleState.mGravity, w, h, bounds, r);//, layoutDirection);\n            if (w > 0 && h > 0) {\n                this.mScaleState.mDrawable.setBounds(r.left, r.top, r.right, r.bottom);\n            }\n        }\n\n        getIntrinsicWidth():number {\n            return this.mScaleState.mDrawable.getIntrinsicWidth();\n        }\n\n        getIntrinsicHeight():number {\n            return this.mScaleState.mDrawable.getIntrinsicHeight();\n        }\n\n        getConstantState():Drawable.ConstantState {\n            if (this.mScaleState.canConstantState()) {\n                //this.mScaleState.mChangingConfigurations = this.getChangingConfigurations();\n                return this.mScaleState;\n            }\n            return null;\n        }\n\n        mutate():Drawable {\n            if (!this.mMutated && super.mutate() == this) {\n                this.mScaleState.mDrawable.mutate();\n                this.mMutated = true;\n            }\n            return this;\n        }\n\n\n    }\n\n    export module ScaleDrawable {\n        export class ScaleState implements Drawable.ConstantState {\n\n            mDrawable:Drawable;\n\n            //mChangingConfigurations:number = 0;\n\n            mScaleWidth:number = 0;\n\n            mScaleHeight:number = 0;\n\n            mGravity:number = 0;\n\n            mUseIntrinsicSizeAsMin:boolean;\n\n            private mCheckedConstantState:boolean;\n\n            private mCanConstantState:boolean;\n\n            constructor(orig:ScaleState, owner:ScaleDrawable) {\n                if (orig != null) {\n                    this.mDrawable = orig.mDrawable.getConstantState().newDrawable();\n                    this.mDrawable.setCallback(owner);\n                    //this.mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection());\n                    this.mScaleWidth = orig.mScaleWidth;\n                    this.mScaleHeight = orig.mScaleHeight;\n                    this.mGravity = orig.mGravity;\n                    this.mUseIntrinsicSizeAsMin = orig.mUseIntrinsicSizeAsMin;\n                    this.mCheckedConstantState = this.mCanConstantState = true;\n                }\n            }\n\n            newDrawable():Drawable {\n                return new ScaleDrawable(this);\n            }\n\n            //getChangingConfigurations():number  {\n            //    return this.mChangingConfigurations;\n            //}\n\n            canConstantState():boolean {\n                if (!this.mCheckedConstantState) {\n                    this.mCanConstantState = this.mDrawable.getConstantState() != null;\n                    this.mCheckedConstantState = true;\n                }\n                return this.mCanConstantState;\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "src/android/graphics/drawable/ScrollBarDrawable.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"Drawable.ts\"/>\n///<reference path=\"../Canvas.ts\"/>\n\nmodule android.graphics.drawable{\n    import Drawable = android.graphics.drawable.Drawable;\n    import Canvas = android.graphics.Canvas;\n\n    export class ScrollBarDrawable extends Drawable {\n        private mVerticalTrack:Drawable;\n        private mHorizontalTrack:Drawable;\n        private mVerticalThumb:Drawable;\n        private mHorizontalThumb:Drawable;\n\n        private mRange = 0;\n        private mOffset = 0;\n        private mExtent = 0;\n        private mVertical = false;\n        private mChanged = false;\n        private mRangeChanged = false;\n        private mTempBounds = new Rect();\n        private mAlwaysDrawHorizontalTrack= false;\n        private mAlwaysDrawVerticalTrack= false;\n\n        /**\n         * Indicate whether the horizontal scrollbar track should always be drawn regardless of the\n         * extent. Defaults to false.\n         *\n         * @param alwaysDrawTrack Set to true if the track should always be drawn\n         */\n        setAlwaysDrawHorizontalTrack(alwaysDrawTrack:boolean) {\n            this.mAlwaysDrawHorizontalTrack = alwaysDrawTrack;\n        }\n        /**\n         * Indicate whether the vertical scrollbar track should always be drawn regardless of the\n         * extent. Defaults to false.\n         *\n         * @param alwaysDrawTrack Set to true if the track should always be drawn\n         */\n        setAlwaysDrawVerticalTrack(alwaysDrawTrack:boolean) {\n            this.mAlwaysDrawVerticalTrack = alwaysDrawTrack;\n        }\n        /**\n         * Indicates whether the vertical scrollbar track should always be drawn regardless of the\n         * extent.\n         */\n        getAlwaysDrawVerticalTrack() {\n            return this.mAlwaysDrawVerticalTrack;\n        }\n        /**\n         * Indicates whether the horizontal scrollbar track should always be drawn regardless of the\n         * extent.\n         */\n        getAlwaysDrawHorizontalTrack() {\n            return this.mAlwaysDrawHorizontalTrack;\n        }\n        setParameters(range:number, offset:number, extent:number, vertical:boolean) {\n            if (this.mVertical != vertical) {\n                this.mChanged = true;\n            }\n\n            if (this.mRange != range || this.mOffset != offset || this.mExtent != extent) {\n                this.mRangeChanged = true;\n            }\n\n            this.mRange = range;\n            this.mOffset = offset;\n            this.mExtent = extent;\n            this.mVertical = vertical;\n        }\n\n\n        draw(canvas) {\n            const vertical = this.mVertical;\n            const extent = this.mExtent;\n            const range = this.mRange;\n\n            let drawTrack = true;\n            let drawThumb = true;\n            if (extent <= 0 || range <= extent) {\n                drawTrack = vertical ? this.mAlwaysDrawVerticalTrack : this.mAlwaysDrawHorizontalTrack;\n                drawThumb = false;\n            }\n\n            let r = this.getBounds();\n            //if (canvas.quickReject(r.left, r.top, r.right, r.bottom, Canvas.EdgeType.AA)) {\n            //    return;\n            //}\n            if (drawTrack) {\n                this.drawTrack(canvas, r, vertical);\n            }\n\n            if (drawThumb) {\n                let size = vertical ? r.height() : r.width();\n                let thickness = vertical ? r.width() : r.height();\n                let length = Math.round( size * extent / range);\n                let offset = Math.round( (size - length) * this.mOffset / (range - extent));\n\n                // avoid the tiny thumb\n                let minLength = thickness * 2;\n                if (length < minLength) {\n                    length = minLength;\n                }\n                // avoid the too-big thumb\n                if (offset + length > size) {\n                    offset = size - length;\n                }\n\n                this.drawThumb(canvas, r, offset, length, vertical);\n            }\n        }\n\n        protected onBoundsChange(bounds:android.graphics.Rect) {\n            super.onBoundsChange(bounds);\n            this.mChanged = true;\n        }\n\n        drawTrack(canvas:Canvas, bounds:Rect, vertical:boolean) {\n            let track:Drawable;\n            if (vertical) {\n                track = this.mVerticalTrack;\n            } else {\n                track = this.mHorizontalTrack;\n            }\n            if (track != null) {\n                if (this.mChanged) {\n                    track.setBounds(bounds);\n                }\n                track.draw(canvas);\n            }\n        }\n\n        drawThumb(canvas:Canvas, bounds:Rect, offset:number, length:number, vertical:boolean) {\n            const thumbRect = this.mTempBounds;\n            const changed = this.mRangeChanged || this.mChanged;\n            if (changed) {\n                if (vertical) {\n                    thumbRect.set(bounds.left,  bounds.top + offset,\n                        bounds.right, bounds.top + offset + length);\n                } else {\n                    thumbRect.set(bounds.left + offset, bounds.top,\n                        bounds.left + offset + length, bounds.bottom);\n                }\n            }\n\n            if (vertical) {\n                const thumb = this.mVerticalThumb;\n                if (changed) thumb.setBounds(thumbRect);\n                thumb.draw(canvas);\n            } else {\n                const thumb = this.mHorizontalThumb;\n                if (changed) thumb.setBounds(thumbRect);\n                thumb.draw(canvas);\n            }\n        }\n\n        setVerticalThumbDrawable(thumb:Drawable) {\n            if (thumb != null) {\n                this.mVerticalThumb = thumb;\n            }\n        }\n\n        setVerticalTrackDrawable(track:Drawable) {\n            this.mVerticalTrack = track;\n        }\n\n        setHorizontalThumbDrawable(thumb:Drawable) {\n            if (thumb != null) {\n                this.mHorizontalThumb = thumb;\n            }\n        }\n\n        setHorizontalTrackDrawable(track:Drawable) {\n            this.mHorizontalTrack = track;\n        }\n\n        getSize(vertical:boolean):number {\n            if (vertical) {\n                return (this.mVerticalTrack != null ?\n                    this.mVerticalTrack : this.mVerticalThumb).getIntrinsicWidth();\n            } else {\n                return (this.mHorizontalTrack != null ?\n                    this.mHorizontalTrack : this.mHorizontalThumb).getIntrinsicHeight();\n            }\n        }\n\n        setAlpha(alpha:number) {\n            if (this.mVerticalTrack != null) {\n                this.mVerticalTrack.setAlpha(alpha);\n            }\n            this.mVerticalThumb.setAlpha(alpha);\n            if (this.mHorizontalTrack != null) {\n                this.mHorizontalTrack.setAlpha(alpha);\n            }\n            this.mHorizontalThumb.setAlpha(alpha);\n        }\n\n        getAlpha():number {\n            // All elements should have same alpha, just return one of them\n            return this.mVerticalThumb.getAlpha();\n        }\n\n        getOpacity():number {\n            return PixelFormat.TRANSLUCENT;\n        }\n\n        toString() {\n            return \"ScrollBarDrawable: range=\" + this.mRange + \" offset=\" + this.mOffset +\n                \" extent=\" + this.mExtent + (this.mVertical ? \" V\" : \" H\");\n        }\n\n    }\n}"
  },
  {
    "path": "src/android/graphics/drawable/ShadowDrawable.ts",
    "content": "/**\n * Created by linfaxin on 16/1/13.\n * androidui drawable\n */\n///<reference path=\"Drawable.ts\"/>\n///<reference path=\"../Canvas.ts\"/>\n///<reference path=\"../Paint.ts\"/>\n\n//TODO move to androidui/drawable package\nmodule android.graphics.drawable{\n\n    /**\n     * Shadow is very expensive\n     */\n    export class ShadowDrawable extends Drawable{\n        private mState:DrawableState;\n        private mMutated = false;\n        constructor(drawable:Drawable, radius:number, dx:number, dy:number, color:number){\n            super();\n            this.mState = new DrawableState(null, this);\n\n            this.mState.mDrawable = drawable;\n            this.mState.shadowDx = dx;\n            this.mState.shadowDy = dy;\n            this.mState.shadowRadius = radius;\n            this.mState.shadowColor = color;\n            if (drawable != null) {\n                drawable.setCallback(this);\n            }\n        }\n        setShadow(radius:number, dx:number, dy:number, color:number):void {\n            this.mState.shadowDx = dx;\n            this.mState.shadowDy = dy;\n            this.mState.shadowRadius = radius;\n            this.mState.shadowColor = color;\n        }\n        \n        drawableSizeChange(who:android.graphics.drawable.Drawable):any {\n            const callback = this.getCallback();\n            if (callback != null && callback.drawableSizeChange) {\n                callback.drawableSizeChange(this);\n            }\n        }\n\n        invalidateDrawable(who:android.graphics.drawable.Drawable):void {\n            const callback = this.getCallback();\n            if (callback != null) {\n                callback.invalidateDrawable(this);\n            }\n        }\n\n        scheduleDrawable(who:android.graphics.drawable.Drawable, what:java.lang.Runnable, when:number):void {\n            const callback = this.getCallback();\n            if (callback != null) {\n                callback.scheduleDrawable(this, what, when);\n            }\n        }\n\n        unscheduleDrawable(who:android.graphics.drawable.Drawable, what:java.lang.Runnable):void {\n            const callback = this.getCallback();\n            if (callback != null) {\n                callback.unscheduleDrawable(this, what);\n            }\n        }\n        draw(canvas:Canvas) {\n            if(!this.mState.shadowRadius || Color.alpha(this.mState.shadowColor) === 0){\n                this.mState.mDrawable.draw(canvas);\n                return;\n            }\n            let saveCount:number = canvas.save();\n            canvas.setShadow(this.mState.shadowRadius, this.mState.shadowDx, this.mState.shadowDy, this.mState.shadowColor);\n            this.mState.mDrawable.draw(canvas);\n            canvas.restoreToCount(saveCount);\n        }\n\n        getPadding(padding:Rect):boolean  {\n            return this.mState.mDrawable.getPadding(padding);\n        }\n\n        setVisible(visible:boolean, restart:boolean):boolean {\n            this.mState.mDrawable.setVisible(visible, restart);\n            return super.setVisible(visible, restart);\n        }\n        setAlpha(alpha:number) {\n            this.mState.mDrawable.setAlpha(alpha);\n        }\n\n        getAlpha():number {\n            return this.mState.mDrawable.getAlpha();\n        }\n        getOpacity():number {\n            return PixelFormat.TRANSPARENT;\n        }\n        isStateful():boolean {\n            return this.mState.mDrawable.isStateful();\n        }\n\n        protected onStateChange(state:Array<number>):boolean {\n            let changed = this.mState.mDrawable.setState(state);\n            this.onBoundsChange(this.getBounds());\n            return changed;\n        }\n\n        protected onBoundsChange(bounds:android.graphics.Rect):void  {\n            this.mState.mDrawable.setBounds(bounds.left, bounds.top, bounds.right, bounds.bottom);\n        }\n\n        getIntrinsicWidth():number {\n            return this.mState.mDrawable.getIntrinsicWidth();\n        }\n\n        getIntrinsicHeight():number {\n            return this.mState.mDrawable.getIntrinsicHeight();\n        }\n        getConstantState():Drawable.ConstantState {\n            if (this.mState.canConstantState()) {\n                //this.mState.mChangingConfigurations = getChangingConfigurations();\n                return this.mState;\n            }\n            return null;\n        }\n        mutate():Drawable {\n            if (!this.mMutated && super.mutate() == this) {\n                this.mState.mDrawable.mutate();\n                this.mMutated = true;\n            }\n            return this;\n        }\n        getDrawable():Drawable {\n            return this.mState.mDrawable;\n        }\n\n    }\n\n    class DrawableState implements Drawable.ConstantState{\n        mDrawable:Drawable;\n\n        shadowDx:number = 0;\n        shadowDy:number = 0;\n        shadowRadius:number = 0;\n        shadowColor:number = 0;\n\n        mCheckedConstantState:boolean;\n        mCanConstantState:boolean;\n\n        constructor(orig:DrawableState, owner:ShadowDrawable) {\n            if (orig != null) {\n                this.mDrawable = orig.mDrawable.getConstantState().newDrawable();\n                this.mDrawable.setCallback(owner);\n                this.shadowDx = orig.shadowDx;\n                this.shadowDy = orig.shadowDy;\n                this.shadowRadius = orig.shadowRadius;\n                this.shadowColor = orig.shadowColor;\n            }\n        }\n\n        newDrawable():Drawable {\n            let drawable = new ShadowDrawable(null, 0, 0, 0, 0);\n            drawable.mState = new DrawableState(this, drawable);\n            return drawable;\n        }\n\n        canConstantState():boolean {\n            if (!this.mCheckedConstantState) {\n                this.mCanConstantState = this.mDrawable.getConstantState() != null;\n                this.mCheckedConstantState = true;\n            }\n\n            return this.mCanConstantState;\n        }\n    }\n}"
  },
  {
    "path": "src/android/graphics/drawable/StateListDrawable.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n///<reference path=\"DrawableContainer.ts\"/>\n\nmodule android.graphics.drawable{\n\n\n    const DEBUG = android.util.Log.DBG_StateListDrawable;\n    const TAG = \"StateListDrawable\";\n    /**\n     * To be proper, we should have a getter for dither (and alpha, etc.)\n     * so that proxy classes like this can save/restore their delegates'\n     * values, but we don't have getters. Since we do have setters\n     * (e.g. setDither), which this proxy forwards on, we have to have some\n     * default/initial setting.\n     *\n     * The initial setting for dither is now true, since it almost always seems\n     * to improve the quality at negligible cost.\n     */\n    const DEFAULT_DITHER = true;\n\n    /**\n     * Lets you assign a number of graphic images to a single Drawable and swap out the visible item by a string\n     * ID value.\n     * <p/>\n     * <p>It can be defined in an XML file with the <code>&lt;selector></code> element.\n     * Each state Drawable is defined in a nested <code>&lt;item></code> element. For more\n     * information, see the guide to <a\n     * href=\"{@docRoot}guide/topics/resources/drawable-resource.html\">Drawable Resources</a>.</p>\n     *\n     * @attr ref android.R.styleable#StateListDrawable_visible\n     * @attr ref android.R.styleable#StateListDrawable_variablePadding\n     * @attr ref android.R.styleable#StateListDrawable_constantSize\n     * @attr ref android.R.styleable#DrawableStates_state_focused\n     * @attr ref android.R.styleable#DrawableStates_state_window_focused\n     * @attr ref android.R.styleable#DrawableStates_state_enabled\n     * @attr ref android.R.styleable#DrawableStates_state_checkable\n     * @attr ref android.R.styleable#DrawableStates_state_checked\n     * @attr ref android.R.styleable#DrawableStates_state_selected\n     * @attr ref android.R.styleable#DrawableStates_state_activated\n     * @attr ref android.R.styleable#DrawableStates_state_active\n     * @attr ref android.R.styleable#DrawableStates_state_single\n     * @attr ref android.R.styleable#DrawableStates_state_first\n     * @attr ref android.R.styleable#DrawableStates_state_middle\n     * @attr ref android.R.styleable#DrawableStates_state_last\n     * @attr ref android.R.styleable#DrawableStates_state_pressed\n     */\n    export class StateListDrawable extends DrawableContainer {\n        private mStateListState:StateListState;\n\n        constructor() {\n            super();\n            this.initWithState(null);\n        }\n\n        private initWithState(state:StateListState){\n            let _as = new StateListState(state, this);\n            this.mStateListState = _as;\n            this.setConstantState(_as);\n            this.onStateChange(this.getState());\n        }\n        /**\n         * Add a new image/string ID to the set of images.\n         *\n         * @param stateSet - An array of resource Ids to associate with the image.\n         *                 Switch to this image by calling setState().\n         * @param drawable -The image to show.\n         */\n        addState(stateSet:Array<number>, drawable:Drawable) {\n            if (drawable != null) {\n                this.mStateListState.addStateSet(stateSet, drawable);\n                // in case the new state matches our current state...\n                this.onStateChange(this.getState());\n            }\n        }\n        isStateful():boolean {\n            return true;\n        }\n        protected onStateChange(stateSet:Array<number>):boolean {\n            let idx = this.mStateListState.indexOfStateSet(stateSet);\n            if (DEBUG) android.util.Log.i(TAG, \"onStateChange \" + this + \" states \"\n                + stateSet + \" found \" + idx);\n            if (idx < 0) {\n                idx = this.mStateListState.indexOfStateSet(android.util.StateSet.WILD_CARD);\n            }\n            if (this.selectDrawable(idx)) {\n                return true;\n            }\n            return super.onStateChange(stateSet);\n        }\n\n        inflate(r:android.content.res.Resources, parser:HTMLElement):void {\n            super.inflate(r, parser);\n            let a = r.obtainAttributes(parser);\n\n            const state = this.mStateListState;\n            //parse attribute\n            state.mVariablePadding = a.getBoolean(\"android:variablePadding\", state.mVariablePadding);\n            state.mConstantSize = a.getBoolean(\"android:constantSize\", state.mConstantSize);\n            state.mEnterFadeDuration = a.getInt(\"android:enterFadeDuration\", state.mEnterFadeDuration);\n            state.mExitFadeDuration = a.getInt(\"android:exitFadeDuration\", state.mExitFadeDuration);\n            state.mDither = a.getBoolean(\"android:dither\", state.mDither);\n            state.mAutoMirrored = a.getBoolean(\"android:autoMirrored\", state.mAutoMirrored);\n            a.recycle();\n\n            //parse children\n            for(let child of Array.from(parser.children)){\n                let item = <HTMLElement>child;\n                if(item.tagName.toLowerCase() !== 'item'){\n                    continue;\n                }\n                let dr:Drawable;\n                let stateSpec:number[] = [];\n                let typedArray = r.obtainAttributes(item);\n                for(let attrName of typedArray.getLowerCaseNoNamespaceAttrNames()) {\n                    if(attrName === 'drawable'){\n                        dr = typedArray.getDrawable(attrName);\n\n                    }else if(attrName.startsWith('state_')){\n                        let state = attrName.substring('state_'.length);\n                        let stateValue = android.view.View['VIEW_STATE_' + state.toUpperCase()];\n                        if(typeof stateValue === \"number\"){\n                            stateSpec.push(typedArray.getBoolean(attrName, true) ? stateValue : -stateValue);\n                        }\n                    }\n                }\n                if(!dr && item.children[0] instanceof HTMLElement){\n                    dr = Drawable.createFromXml(r, <HTMLElement>item.children[0]);\n                }\n                if(!dr){\n                    throw new Error(\": <item> tag requires a 'drawable' attribute or child tag defining a drawable\");\n                }\n                state.addStateSet(stateSpec, dr);\n            }\n\n            this.onStateChange(this.getState());\n        }\n\n        private getStateListState():StateListState {\n           return this.mStateListState;\n        }\n        /**\n         * Gets the number of states contained in this drawable.\n         *\n         * @return The number of states contained in this drawable.\n         * @hide pending API council\n         * @see #getStateSet(int)\n         * @see #getStateDrawable(int)\n         */\n        getStateCount():number {\n            return this.mStateListState.getChildCount();\n        }\n        /**\n         * Gets the state set at an index.\n         *\n         * @param index The index of the state set.\n         * @return The state set at the index.\n         * @hide pending API council\n         * @see #getStateCount()\n         * @see #getStateDrawable(int)\n         */\n        getStateSet(index:number):Array<number> {\n            return this.mStateListState.mStateSets[index];\n        }\n        /**\n         * Gets the drawable at an index.\n         *\n         * @param index The index of the drawable.\n         * @return The drawable at the index.\n         * @hide pending API council\n         * @see #getStateCount()\n         * @see #getStateSet(int)\n         */\n        getStateDrawable(index:number):Drawable {\n            return this.mStateListState.getChild(index);\n        }\n        /**\n         * Gets the index of the drawable with the provided state set.\n         *\n         * @param stateSet the state set to look up\n         * @return the index of the provided state set, or -1 if not found\n         * @hide pending API council\n         * @see #getStateDrawable(int)\n         * @see #getStateSet(int)\n         */\n        getStateDrawableIndex(stateSet:Array<number>):number {\n            return this.mStateListState.indexOfStateSet(stateSet);\n        }\n        mutate():Drawable {\n            if (!this.mMutated && super.mutate() == this) {\n                const sets = this.mStateListState.mStateSets;\n                const count = sets.length;\n                this.mStateListState.mStateSets = new Array<Array<number>>(count);\n                for (let i = 0; i < count; i++) {\n                    const _set = sets[i];\n                    if (_set != null) {\n                        this.mStateListState.mStateSets[i] = _set.concat();\n                    }\n                }\n                this.mMutated = true;\n            }\n            return this;\n        }\n    }\n\n    class StateListState extends DrawableContainer.DrawableContainerState{\n        mStateSets:Array<Array<number>>;\n        constructor(orig:StateListState, owner:StateListDrawable){\n            super(orig, owner);\n            if (orig != null) {\n                this.mStateSets = orig.mStateSets.concat();\n            } else {\n                this.mStateSets = new Array<Array<number>>(this.getCapacity());\n            }\n        }\n        addStateSet(stateSet:Array<number>, drawable:Drawable) {\n            let pos = this.addChild(drawable);\n            this.mStateSets[pos] = stateSet;\n            return pos;\n        }\n        indexOfStateSet(stateSet:Array<number>):number {\n            const stateSets = this.mStateSets;\n            const N = this.getChildCount();\n            for (let i = 0; i < N; i++) {\n                if (android.util.StateSet.stateSetMatches(stateSets[i], stateSet)) {\n                    return i;\n                }\n            }\n            return -1;\n        }\n        newDrawable():Drawable {\n            let drawable = new StateListDrawable();\n            (<any>drawable).initWithState(this);\n            return drawable;\n        }\n\n    }\n}"
  },
  {
    "path": "src/android/os/Bundle.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\nmodule android.os{\n    /**\n     * A mapping from String values to various Parcelable types.\n     * NOTE: lite impl of Android Bundle\n     */\n    export class Bundle{\n        constructor(copy?:Bundle){\n            if(copy) Object.assign(this, copy);\n        }\n\n        get(key:string, defaultValue:any){\n            if(this.containsKey(key)){\n                return this[key];\n            }\n            return defaultValue;\n        }\n\n        put(key:string, value:any){\n            this[key] = value;\n        }\n\n        containsKey(key:string){\n            return key in this;\n        }\n    }\n}"
  },
  {
    "path": "src/android/os/Handler.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"Message.ts\"/>\n///<reference path=\"MessageQueue.ts\"/>\n///<reference path=\"../../java/lang/Runnable.ts\"/>\n///<reference path=\"SystemClock.ts\"/>\n\nmodule android.os {\n    import Runnable = java.lang.Runnable;\n\n    /**\n     * A Handler allows you to send and process {@link Message} and Runnable\n     * objects associated with a thread's {@link MessageQueue}.  Each Handler\n     * instance is associated with a single thread and that thread's message\n     * queue.  When you create a new Handler, it is bound to the thread /\n     * message queue of the thread that is creating it -- from that point on,\n     * it will deliver messages and runnables to that message queue and execute\n     * them as they come out of the message queue.\n     *\n     * <p>There are two main uses for a Handler: (1) to schedule messages and\n     * runnables to be executed as some point in the future; and (2) to enqueue\n     * an action to be performed on a different thread than your own.\n     *\n     * <p>Scheduling messages is accomplished with the\n     * {@link #post}, {@link #postAtTime(Runnable, long)},\n     * {@link #postDelayed}, {@link #sendEmptyMessage},\n     * {@link #sendMessage}, {@link #sendMessageAtTime}, and\n     * {@link #sendMessageDelayed} methods.  The <em>post</em> versions allow\n     * you to enqueue Runnable objects to be called by the message queue when\n     * they are received; the <em>sendMessage</em> versions allow you to enqueue\n     * a {@link Message} object containing a bundle of data that will be\n     * processed by the Handler's {@link #handleMessage} method (requiring that\n     * you implement a subclass of Handler).\n     *\n     * <p>When posting or sending to a Handler, you can either\n     * allow the item to be processed as soon as the message queue is ready\n     * to do so, or specify a delay before it gets processed or absolute time for\n     * it to be processed.  The latter two allow you to implement timeouts,\n     * ticks, and other timing-based behavior.\n     *\n     * <p>When a\n     * process is created for your application, its main thread is dedicated to\n     * running a message queue that takes care of managing the top-level\n     * application objects (activities, broadcast receivers, etc) and any windows\n     * they create.  You can create your own threads, and communicate back with\n     * the main application thread through a Handler.  This is done by calling\n     * the same <em>post</em> or <em>sendMessage</em> methods as before, but from\n     * your new thread.  The given Runnable or Message will then be scheduled\n     * in the Handler's message queue and processed when appropriate.\n     */\n    export class Handler {\n        mCallback:Handler.Callback;\n\n        /**\n         * Constructor associates this handler with the {@link Looper} for the\n         * current thread and takes a callback interface in which you can handle\n         * messages.\n         *\n         * If this thread does not have a looper, this handler won't be able to receive messages\n         * so an exception is thrown.\n         *\n         * @param callback The callback interface in which to handle messages, or null.\n         */\n        constructor(callback?:Handler.Callback) {\n            this.mCallback = callback;\n        }\n\n        /**\n         * Subclasses must implement this to receive messages.\n         */\n        handleMessage(msg:Message):void {\n        }\n\n        /**\n         * Handle system messages here.\n         */\n        dispatchMessage(msg:Message) {\n            if (msg.callback != null) {\n                msg.callback.run();\n            } else {\n                if (this.mCallback != null) {\n                    if (this.mCallback.handleMessage(msg)) {\n                        return;\n                    }\n                }\n                this.handleMessage(msg);\n            }\n        }\n\n        /**\n         * Returns a new {@link android.os.Message Message} from the global message pool. More efficient than\n         * creating and allocating new instances. The retrieved message has its handler set to this instance (Message.target == this).\n         *  If you don't want that facility, just call Message.obtain() instead.\n         */\n        obtainMessage():Message;\n        /**\n         * Same as {@link #obtainMessage()}, except that it also sets the what member of the returned Message.\n         *\n         * @param what Value to assign to the returned Message.what field.\n         * @return A Message from the global message pool.\n         */\n        obtainMessage(what:number):Message;\n        /**\n         *\n         * Same as {@link #obtainMessage()}, except that it also sets the what and obj members\n         * of the returned Message.\n         *\n         * @param what Value to assign to the returned Message.what field.\n         * @param obj Value to assign to the returned Message.obj field.\n         * @return A Message from the global message pool.\n         */\n        obtainMessage(what:number, obj:any):Message;\n        /**\n         *\n         * Same as {@link #obtainMessage()}, except that it also sets the what, arg1 and arg2 members of the returned\n         * Message.\n         * @param what Value to assign to the returned Message.what field.\n         * @param arg1 Value to assign to the returned Message.arg1 field.\n         * @param arg2 Value to assign to the returned Message.arg2 field.\n         * @return A Message from the global message pool.\n         */\n        obtainMessage(what:number, arg1:number, arg2:number):Message;\n        /**\n         *\n         * Same as {@link #obtainMessage()}, except that it also sets the what, obj, arg1,and arg2 values on the\n         * returned Message.\n         * @param what Value to assign to the returned Message.what field.\n         * @param arg1 Value to assign to the returned Message.arg1 field.\n         * @param arg2 Value to assign to the returned Message.arg2 field.\n         * @param obj Value to assign to the returned Message.obj field.\n         * @return A Message from the global message pool.\n         */\n        obtainMessage(what:number, arg1:number, arg2:number, obj:any):Message;\n        obtainMessage(...args):Message {\n            if (args.length === 2) {\n                let [what, obj] = args;\n                return Message.obtain(this, what, obj);\n            } else {\n                let [what, arg1, arg2, obj] = args;\n                return Message.obtain(this, what, arg1, arg2, obj);\n            }\n        }\n\n        /**\n         * Causes the Runnable r to be added to the message queue.\n         * The runnable will be run on the thread to which this handler is\n         * attached.\n         *\n         * @param r The Runnable that will be executed.\n         *\n         * @return Returns true if the Runnable was successfully placed in to the\n         *         message queue.  Returns false on failure, usually because the\n         *         looper processing the message queue is exiting.\n         */\n        post(r:Runnable):boolean {\n            return this.sendMessageDelayed(Handler.getPostMessage(r), 0);\n        }\n\n        protected postAsTraversal(r:Runnable):boolean {\n            let msg = Handler.getPostMessage(r);\n            msg.mType = Message.Type_Traversal;\n            return this.sendMessageDelayed(msg, 0);\n        }\n\n        /**\n         * Causes the Runnable r to be added to the message queue, to be run\n         * at a specific time given by <var>uptimeMillis</var>.\n         * <b>The time-base is {@link android.os.SystemClock#uptimeMillis}.</b>\n         * The runnable will be run on the thread to which this handler is attached.\n         *\n         * @param r The Runnable that will be executed.\n         * @param uptimeMillis The absolute time at which the callback should run,\n         *         using the {@link android.os.SystemClock#uptimeMillis} time-base.\n         *\n         * @return Returns true if the Runnable was successfully placed in to the\n         *         message queue.  Returns false on failure, usually because the\n         *         looper processing the message queue is exiting.  Note that a\n         *         result of true does not mean the Runnable will be processed -- if\n         *         the looper is quit before the delivery time of the message\n         *         occurs then the message will be dropped.\n         */\n        postAtTime(r:Runnable, uptimeMillis:number):boolean;\n        /**\n         * Causes the Runnable r to be added to the message queue, to be run\n         * at a specific time given by <var>uptimeMillis</var>.\n         * <b>The time-base is {@link android.os.SystemClock#uptimeMillis}.</b>\n         * The runnable will be run on the thread to which this handler is attached.\n         *\n         * @param r The Runnable that will be executed.\n         * @param uptimeMillis The absolute time at which the callback should run,\n         *         using the {@link android.os.SystemClock#uptimeMillis} time-base.\n         *\n         * @return Returns true if the Runnable was successfully placed in to the\n         *         message queue.  Returns false on failure, usually because the\n         *         looper processing the message queue is exiting.  Note that a\n         *         result of true does not mean the Runnable will be processed -- if\n         *         the looper is quit before the delivery time of the message\n         *         occurs then the message will be dropped.\n         *\n         * @see android.os.SystemClock#uptimeMillis\n         */\n        postAtTime(r:Runnable, token:any, uptimeMillis:number):boolean;\n        postAtTime(...args):boolean {\n            if (args.length === 2) {\n                let [r, uptimeMillis] = args;\n                return this.sendMessageAtTime(Handler.getPostMessage(r), uptimeMillis);\n            } else {\n                let [r, token, uptimeMillis] = args;\n                return this.sendMessageAtTime(Handler.getPostMessage(r, token), uptimeMillis);\n            }\n        }\n\n        /**\n         * Causes the Runnable r to be added to the message queue, to be run\n         * after the specified amount of time elapses.\n         * The runnable will be run on the thread to which this handler\n         * is attached.\n         *\n         * @param r The Runnable that will be executed.\n         * @param delayMillis The delay (in milliseconds) until the Runnable\n         *        will be executed.\n         *\n         * @return Returns true if the Runnable was successfully placed in to the\n         *         message queue.  Returns false on failure, usually because the\n         *         looper processing the message queue is exiting.  Note that a\n         *         result of true does not mean the Runnable will be processed --\n         *         if the looper is quit before the delivery time of the message\n         *         occurs then the message will be dropped.\n         */\n        postDelayed(r:Runnable, delayMillis:number):boolean {\n            return this.sendMessageDelayed(Handler.getPostMessage(r), delayMillis);\n        }\n\n        /**\n         * Posts a message to an object that implements Runnable.\n         * Causes the Runnable r to executed on the next iteration through the\n         * message queue. The runnable will be run on the thread to which this\n         * handler is attached.\n         * <b>This method is only for use in very special circumstances -- it\n         * can easily starve the message queue, cause ordering problems, or have\n         * other unexpected side-effects.</b>\n         *\n         * @param r The Runnable that will be executed.\n         *\n         * @return Returns true if the message was successfully placed in to the\n         *         message queue.  Returns false on failure, usually because the\n         *         looper processing the message queue is exiting.\n         */\n        postAtFrontOfQueue(r:Runnable):boolean {\n            return this.post(r);\n        }\n\n        /**\n         * Remove any pending posts of Runnable <var>r</var> with Object\n         * <var>token</var> that are in the message queue.  If <var>token</var> is null,\n         * all callbacks will be removed.\n         */\n        removeCallbacks(r:Runnable, token?:any) {\n            MessageQueue.removeMessages(this, r, token);\n        }\n\n        /**\n         * Pushes a message onto the end of the message queue after all pending messages\n         * before the current time. It will be received in {@link #handleMessage},\n         * in the thread attached to this handler.\n         *\n         * @return Returns true if the message was successfully placed in to the\n         *         message queue.  Returns false on failure, usually because the\n         *         looper processing the message queue is exiting.\n         */\n        sendMessage(msg:Message):boolean {\n            return this.sendMessageDelayed(msg, 0);\n        }\n\n        /**\n         * Sends a Message containing only the what value.\n         *\n         * @return Returns true if the message was successfully placed in to the\n         *         message queue.  Returns false on failure, usually because the\n         *         looper processing the message queue is exiting.\n         */\n        sendEmptyMessage(what:number):boolean {\n            return this.sendEmptyMessageDelayed(what, 0);\n        }\n\n        /**\n         * Sends a Message containing only the what value, to be delivered\n         * after the specified amount of time elapses.\n         * @see #sendMessageDelayed(android.os.Message, long)\n         *\n         * @return Returns true if the message was successfully placed in to the\n         *         message queue.  Returns false on failure, usually because the\n         *         looper processing the message queue is exiting.\n         */\n        sendEmptyMessageDelayed(what:number, delayMillis:number):boolean {\n            let msg = Message.obtain();\n            msg.what = what;\n            return this.sendMessageDelayed(msg, delayMillis);\n        }\n\n        /**\n         * Sends a Message containing only the what value, to be delivered\n         * at a specific time.\n         * @see #sendMessageAtTime(android.os.Message, long)\n         *\n         * @return Returns true if the message was successfully placed in to the\n         *         message queue.  Returns false on failure, usually because the\n         *         looper processing the message queue is exiting.\n         */\n        sendEmptyMessageAtTime(what:number, uptimeMillis:number):boolean {\n            let msg = Message.obtain();\n            msg.what = what;\n            return this.sendMessageAtTime(msg, uptimeMillis);\n        }\n\n        /**\n         * Enqueue a message into the message queue after all pending messages\n         * before (current time + delayMillis). You will receive it in\n         * {@link #handleMessage}, in the thread attached to this handler.\n         *\n         * @return Returns true if the message was successfully placed in to the\n         *         message queue.  Returns false on failure, usually because the\n         *         looper processing the message queue is exiting.  Note that a\n         *         result of true does not mean the message will be processed -- if\n         *         the looper is quit before the delivery time of the message\n         *         occurs then the message will be dropped.\n         */\n        sendMessageDelayed(msg:Message, delayMillis:number):boolean {\n            if (delayMillis < 0) {\n                delayMillis = 0;\n            }\n            return this.sendMessageAtTime(msg, SystemClock.uptimeMillis() + delayMillis);\n        }\n\n        /**\n         * Enqueue a message into the message queue after all pending messages\n         * before the absolute time (in milliseconds) <var>uptimeMillis</var>.\n         * <b>The time-base is {@link android.os.SystemClock#uptimeMillis}.</b>\n         * You will receive it in {@link #handleMessage}, in the thread attached\n         * to this handler.\n         *\n         * @param uptimeMillis The absolute time at which the message should be\n         *         delivered, using the\n         *         {@link android.os.SystemClock#uptimeMillis} time-base.\n         *\n         * @return Returns true if the message was successfully placed in to the\n         *         message queue.  Returns false on failure, usually because the\n         *         looper processing the message queue is exiting.  Note that a\n         *         result of true does not mean the message will be processed -- if\n         *         the looper is quit before the delivery time of the message\n         *         occurs then the message will be dropped.\n         */\n        sendMessageAtTime(msg:Message, uptimeMillis:number) {\n            msg.target = this;\n            return MessageQueue.enqueueMessage(msg, uptimeMillis);\n        }\n\n        /**\n         * Enqueue a message at the front of the message queue, to be processed on\n         * the next iteration of the message loop.  You will receive it in\n         * {@link #handleMessage}, in the thread attached to this handler.\n         * <b>This method is only for use in very special circumstances -- it\n         * can easily starve the message queue, cause ordering problems, or have\n         * other unexpected side-effects.</b>\n         *\n         * @return Returns true if the message was successfully placed in to the\n         *         message queue.  Returns false on failure, usually because the\n         *         looper processing the message queue is exiting.\n         */\n        sendMessageAtFrontOfQueue(msg:Message) {\n            return this.sendMessage(msg);\n        }\n\n        /**\n         * Remove any pending posts of messages with code 'what' and whose obj is\n         * 'object' that are in the message queue.  If <var>object</var> is null,\n         * all messages will be removed.\n         */\n        removeMessages(what:number, object?:any) {\n            MessageQueue.removeMessages(this, what, object);\n        }\n\n        /**\n         * Remove any pending posts of callbacks and sent messages whose\n         * <var>obj</var> is <var>token</var>.  If <var>token</var> is null,\n         * all callbacks and messages will be removed.\n         */\n        removeCallbacksAndMessages(token?:any) {\n            MessageQueue.removeCallbacksAndMessages(this, token);\n        }\n\n        /**\n         * Check if there are any pending posts of messages with code 'what' in\n         * the message queue.\n         */\n        hasMessages(what:number, object?:any):boolean {\n            return MessageQueue.hasMessages(this, what, object);\n        }\n\n        private static getPostMessage(r:Runnable, token?:any):Message {\n            let m = Message.obtain();\n            m.obj = token;\n            m.callback = r;\n            return m;\n        }\n    }\n\n    export module Handler {\n        /**\n         * Callback interface you can use when instantiating a Handler to avoid\n         * having to implement your own subclass of Handler.\n         *\n         * @param msg A {@link android.os.Message Message} object\n         * @return True if no further handling is desired\n         */\n        export interface Callback {\n            handleMessage(msg:Message):boolean;\n        }\n\n    }\n}"
  },
  {
    "path": "src/android/os/Message.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"Handler.ts\"/>\n///<reference path=\"../../java/lang/Runnable.ts\"/>\n///<reference path=\"../../java/lang/StringBuilder.ts\"/>\n///<reference path=\"../util/Pools.ts\"/>\n///<reference path=\"SystemClock.ts\"/>\n\nmodule android.os {\n    import StringBuilder = java.lang.StringBuilder;\n    import Runnable = java.lang.Runnable;\n    import Pools = android.util.Pools;\n\n    /**\n     *\n     * Defines a message containing a description and arbitrary data object that can be\n     * sent to a {@link Handler}.  This object contains two extra int fields and an\n     * extra object field that allow you to not do allocations in many cases.\n     *\n     * <p class=\"note\">While the constructor of Message is public, the best way to get\n     * one of these is to call {@link #obtain Message.obtain()} or one of the\n     * {@link Handler#obtainMessage Handler.obtainMessage()} methods, which will pull\n     * them from a pool of recycled objects.</p>\n     */\n    export class Message {\n        protected static Type_Normal = 0;\n        protected static Type_Traversal = 1;\n        private mType:number = Message.Type_Normal;\n\n        /**\n         * User-defined message code so that the recipient can identify\n         * what this message is about. Each {@link Handler} has its own name-space\n         * for message codes, so you do not need to worry about yours conflicting\n         * with other handlers.\n         */\n        what:number = 0;\n        /**\n         * arg1 and arg2 are lower-cost alternatives to using\n         * {@link #setData(Bundle) setData()} if you only need to store a\n         * few integer values.\n         */\n        arg1:number = 0;\n        /**\n         * arg1 and arg2 are lower-cost alternatives to using\n         * {@link #setData(Bundle) setData()} if you only need to store a\n         * few integer values.\n         */\n        arg2:number = 0;\n        /**\n         * An arbitrary object to send to the recipient.  When using\n         * {@link Messenger} to send the message across processes this can only\n         * be non-null if it contains a Parcelable of a framework class (not one\n         * implemented by the application).   For other data transfer use\n         * {@link #setData}.\n         *\n         * <p>Note that Parcelable objects here are not supported prior to\n         * the {@link android.os.Build.VERSION_CODES#FROYO} release.\n         */\n        obj:any;\n        protected when:number = 0;\n        protected target:Handler;\n        protected callback:Runnable;\n\n        private static sPool = new Pools.SynchronizedPool<Message>(10);\n\n\n        /**\n         * Return a new Message instance from the global pool. Allows us to\n         * avoid allocating new objects in many cases.\n         */\n        static obtain():Message;\n        static obtain(orig:Message):Message;\n        /**\n         * Same as {@link #obtain()}, but sets the value for the <em>target</em> member on the Message returned.\n         * @param h  Handler to assign to the returned Message object's <em>target</em> member.\n         * @return A Message object from the global pool.\n         */\n        static obtain(h:Handler):Message;\n        /**\n         * Same as {@link #obtain(Handler)}, but assigns a callback Runnable on\n         * the Message that is returned.\n         * @param h  Handler to assign to the returned Message object's <em>target</em> member.\n         * @param callback Runnable that will execute when the message is handled.\n         * @return A Message object from the global pool.\n         */\n        static obtain(h:Handler, callback:Runnable):Message;\n        /**\n         * Same as {@link #obtain()}, but sets the values for both <em>target</em> and\n         * <em>what</em> members on the Message.\n         * @param h  Value to assign to the <em>target</em> member.\n         * @param what  Value to assign to the <em>what</em> member.\n         * @return A Message object from the global pool.\n         */\n        static obtain(h:Handler, what:number):Message;\n        /**\n         * Same as {@link #obtain()}, but sets the values of the <em>target</em>, <em>what</em>, and <em>obj</em>\n         * members.\n         * @param h  The <em>target</em> value to set.\n         * @param what  The <em>what</em> value to set.\n         * @param obj  The <em>object</em> method to set.\n         * @return  A Message object from the global pool.\n         */\n        static obtain(h:Handler, what:number, obj:any):Message;\n        /**\n         * Same as {@link #obtain()}, but sets the values of the <em>target</em>, <em>what</em>,\n         * <em>arg1</em>, and <em>arg2</em> members.\n         *\n         * @param h  The <em>target</em> value to set.\n         * @param what  The <em>what</em> value to set.\n         * @param arg1  The <em>arg1</em> value to set.\n         * @param arg2  The <em>arg2</em> value to set.\n         * @return  A Message object from the global pool.\n         */\n        static obtain(h:Handler, what:number, arg1:number, arg2:number):Message;\n        /**\n         * Same as {@link #obtain()}, but sets the values of the <em>target</em>, <em>what</em>,\n         * <em>arg1</em>, <em>arg2</em>, and <em>obj</em> members.\n         *\n         * @param h  The <em>target</em> value to set.\n         * @param what  The <em>what</em> value to set.\n         * @param arg1  The <em>arg1</em> value to set.\n         * @param arg2  The <em>arg2</em> value to set.\n         * @param obj  The <em>obj</em> value to set.\n         * @return  A Message object from the global pool.\n         */\n        static obtain(h:Handler, what:number, arg1:number, arg2:number, obj:any):Message;\n        static obtain(...args){\n            let m = Message.sPool.acquire();\n            m = m || new Message();\n            if(args.length === 1){\n                if(args[0] instanceof Message){\n                    let orig = args[0];\n                    [m.target, m.what, m.arg1, m.arg2, m.obj, m.callback] =\n                        [orig.target, orig.what, orig.arg1, orig.arg2, orig.obj, orig.callback];\n                }else if(args[0] instanceof Handler){\n                    m.target = args[0];\n                }else{\n                    throw new Error('unknown args');\n                }\n\n            } else if(args.length===2){\n                m.target = args[0];\n                if(typeof args[1] === 'number') m.what = args[1];\n                else m.callback = args[1];\n\n            } else if(args.length===3){\n                [m.target, m.what, m.obj] = args;\n\n            } else if(args.length===4){\n                [m.target, m.what, m.arg1, m.arg2] = args;\n\n            } else {\n                [m.target, m.what, m.arg1=0, m.arg2, m.obj, m.callback] = args;\n            }\n\n            return m;\n        }\n\n        /**\n         * Return a Message instance to the global pool.  You MUST NOT touch\n         * the Message after calling this function -- it has effectively been\n         * freed.\n         */\n        recycle() {\n            this.clearForRecycle();\n            Message.sPool.release(this);\n        }\n\n        /**\n         * Make this message like o.  Performs a shallow copy of the data field.\n         * Does not copy the linked list fields, nor the timestamp or\n         * target/callback of the original message.\n         */\n        copyFrom(o:Message) {\n            this.mType = o.mType;\n            this.what = o.what;\n            this.arg1 = o.arg1;\n            this.arg2 = o.arg2;\n            this.obj = o.obj;\n        }\n\n        setTarget(target:Handler):void  {\n            this.target = target;\n        }\n\n        /**\n         * Retrieve the a {@link android.os.Handler Handler} implementation that\n         * will receive this message. The object must implement\n         * {@link android.os.Handler#handleMessage(android.os.Message)\n         * Handler.handleMessage()}. Each Handler has its own name-space for\n         * message codes, so you do not need to\n         * worry about yours conflicting with other handlers.\n         */\n        getTarget():Handler  {\n            return this.target;\n        }\n\n        /**\n         * Sends this Message to the Handler specified by {@link #getTarget}.\n         * Throws a null pointer exception if this field has not been set.\n         */\n        sendToTarget() {\n            this.target.sendMessage(this);\n        }\n\n        protected clearForRecycle() {\n            this.mType = Message.Type_Normal;\n            this.what = 0;\n            this.arg1 = 0;\n            this.arg2 = 0;\n            this.obj = null;\n            this.when = 0;\n            this.target = null;\n            this.callback = null;\n        }\n\n        toString(now = SystemClock.uptimeMillis()):string {\n            let b = new StringBuilder();\n            b.append(\"{ what=\");\n            b.append(this.what);\n            b.append(\" when=\");\n            b.append(this.when - now).append(\"ms\");\n            //TimeUtils.formatDuration(this.when - now, b);\n            if (this.arg1 != 0) {\n                b.append(\" arg1=\");\n                b.append(this.arg1);\n            }\n            if (this.arg2 != 0) {\n                b.append(\" arg2=\");\n                b.append(this.arg2);\n            }\n            if (this.obj != null) {\n                b.append(\" obj=\");\n                b.append(this.obj);\n            }\n            b.append(\" }\");\n            return b.toString()\n        }\n    }\n}"
  },
  {
    "path": "src/android/os/MessageQueue.ts",
    "content": "/**\n * Created by linfaxin on 15/10/5.\n * AndroidUI's impl.\n */\n///<reference path=\"Message.ts\"/>\n///<reference path=\"Handler.ts\"/>\n///<reference path=\"../util/Log.ts\"/>\n///<reference path=\"../../java/lang/Runnable.ts\"/>\n\nmodule android.os {\n    import Runnable = java.lang.Runnable;\n    import Log = android.util.Log;\n\n\n    var requestAnimationFrame = window[\"requestAnimationFrame\"] ||\n        window[\"webkitRequestAnimationFrame\"] ||\n        window[\"mozRequestAnimationFrame\"] ||\n        window[\"oRequestAnimationFrame\"] ||\n        window[\"msRequestAnimationFrame\"];\n    if (!requestAnimationFrame) {\n        requestAnimationFrame = function (callback) {\n            return window.setTimeout(callback, 1000 / 60);\n        };\n    }\n    if (!window.requestAnimationFrame) window.requestAnimationFrame = requestAnimationFrame;\n\n    export class MessageQueue {\n\n        static messages = new Set<Message>();\n\n        static getMessages(h:Handler, r:Runnable, object:any):Array<Message>;\n        static getMessages(h:Handler, what:number, object:any):Array<Message>;\n        static getMessages(h:Handler, args, object:any):Array<Message> {\n            let msgs = [];\n            if (h == null) {\n                return msgs;\n            }\n\n            if (typeof args === \"number\") {\n                let what:number = args;\n                for (let p of MessageQueue.messages) {\n                    if (p.target == h && p.what == what && (object == null || p.obj == object)) {\n                        msgs.push(p);\n                    }\n                }\n\n            } else {\n                let r = args;\n                for (let p of MessageQueue.messages) {\n                    if (p.target == h && p.callback == r && (object == null || p.obj == object)) {\n                        msgs.push(p);\n                    }\n                }\n\n            }\n            return msgs;\n        }\n\n        static hasMessages(h:Handler, r:Runnable, object:any):boolean;\n        static hasMessages(h:Handler, what:number, object:any):boolean;\n        static hasMessages(h:Handler, args, object:any):boolean {\n            return MessageQueue.getMessages(h, args, object).length > 0;\n        }\n\n        static enqueueMessage(msg:Message, when:number):boolean{\n            if (msg.target == null) {\n                throw new Error(\"Message must have a target.\");\n            }\n            msg.when = when;\n            MessageQueue.messages.add(msg);\n            MessageQueue.checkLoop();\n            return true;\n        }\n\n        static recycleMessage(handler:Handler, message:Message) {\n            message.recycle();\n            MessageQueue.messages.delete(message);\n        }\n\n        static removeMessages(h:Handler, what:number, object:any);\n        static removeMessages(h:Handler, r:Runnable, object:any);\n        static removeMessages(h:Handler, args, object:any) {\n            let p = MessageQueue.getMessages(h, args, object);\n            if (p && p.length > 0) {\n                for(let item of p){\n                    MessageQueue.recycleMessage(h, item);\n                }\n            }\n        }\n\n        static removeCallbacksAndMessages(h:Handler, object:any) {\n            if (h == null) {\n                return;\n            }\n            for (let p of MessageQueue.messages) {\n                if (p != null && p.target == h && (object == null || p.obj == object)) {\n                    MessageQueue.recycleMessage(h, p);\n                }\n            }\n        }\n\n        private static _loopActive = false;\n        private static checkLoop(){\n            if(!MessageQueue._loopActive){\n                MessageQueue._loopActive = true;\n\n                MessageQueue.requestNextLoop();\n            }\n        }\n        private static requestNextLoop(){\n            requestAnimationFrame(MessageQueue.loop);\n        }\n\n        private static loop(){\n            let normalMessages:Message[] = [];\n            let traversalMessages:Message[] = [];\n            const now = SystemClock.uptimeMillis();\n            for(let msg of MessageQueue.messages){\n                if(msg.when<=now){\n                    if(msg.mType === Message.Type_Traversal) traversalMessages.push(msg);\n                    else normalMessages.push(msg);\n                }\n            }\n            //dispatch normal messages first.\n            for(let i = 0, length=normalMessages.length; i<length; i++){\n                MessageQueue.dispatchMessage(normalMessages[i]);\n            }\n            //then dispatch traversal messages\n            for(let i = 0, length=traversalMessages.length; i<length; i++){\n                MessageQueue.dispatchMessage(traversalMessages[i]);\n            }\n\n            if(MessageQueue.messages.size>0) MessageQueue.requestNextLoop();\n            else MessageQueue._loopActive = false;\n        }\n\n        private static dispatchMessage(msg:Message){\n            if(MessageQueue.messages.has(msg)){\n                MessageQueue.messages.delete(msg);\n                msg.target.dispatchMessage(msg);\n                MessageQueue.recycleMessage(msg.target, msg);\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/android/os/SystemClock.ts",
    "content": "/**\n * Created by linfaxin on 15/10/5.\n * AndroidUI's impl.\n */\nmodule android.os{\n    export class SystemClock{\n        static uptimeMillis() : number{\n            return new Date().getTime();\n        }\n    }\n}"
  },
  {
    "path": "src/android/os/Trace.ts",
    "content": "/*\n * Copyright (C) 2012 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/util/Log.ts\"/>\n\nmodule android.os {\nimport Log = android.util.Log;\n/**\n * Writes trace events to the system trace buffer.  These trace events can be\n * collected and visualized using the Systrace tool.\n *\n * This tracing mechanism is independent of the method tracing mechanism\n * offered by {@link Debug#startMethodTracing}.  In particular, it enables\n * tracing of events that occur across multiple processes.\n */\nexport class Trace {\n\n    /*\n     * Writes trace events to the kernel trace buffer.  These trace events can be\n     * collected using the \"atrace\" program for offline analysis.\n     */\n    private static TAG:string = \"Trace\";\n\n    // These tags must be kept in sync with system/core/include/cutils/trace.h.\n    /** @hide */\n    static TRACE_TAG_NEVER:number = 0;\n\n    /** @hide */\n    static TRACE_TAG_ALWAYS:number = 1 << 0;\n\n    /** @hide */\n    static TRACE_TAG_GRAPHICS:number = 1 << 1;\n\n    /** @hide */\n    static TRACE_TAG_INPUT:number = 1 << 2;\n\n    /** @hide */\n    static TRACE_TAG_VIEW:number = 1 << 3;\n\n    /** @hide */\n    static TRACE_TAG_WEBVIEW:number = 1 << 4;\n\n    /** @hide */\n    static TRACE_TAG_WINDOW_MANAGER:number = 1 << 5;\n\n    /** @hide */\n    static TRACE_TAG_ACTIVITY_MANAGER:number = 1 << 6;\n\n    /** @hide */\n    static TRACE_TAG_SYNC_MANAGER:number = 1 << 7;\n\n    /** @hide */\n    static TRACE_TAG_AUDIO:number = 1 << 8;\n\n    /** @hide */\n    static TRACE_TAG_VIDEO:number = 1 << 9;\n\n    /** @hide */\n    static TRACE_TAG_CAMERA:number = 1 << 10;\n\n    /** @hide */\n    static TRACE_TAG_HAL:number = 1 << 11;\n\n    /** @hide */\n    static TRACE_TAG_APP:number = 1 << 12;\n\n    /** @hide */\n    static TRACE_TAG_RESOURCES:number = 1 << 13;\n\n    /** @hide */\n    static TRACE_TAG_DALVIK:number = 1 << 14;\n\n    /** @hide */\n    static TRACE_TAG_RS:number = 1 << 15;\n\n    private static TRACE_TAG_NOT_READY:number = 1 << 63;\n\n    private static MAX_SECTION_NAME_LEN:number = 127;\n\n    // Must be volatile to avoid word tearing.\n    private static sEnabledTags:number = Trace.TRACE_TAG_NOT_READY;\n\n    private static nativeGetEnabledTags():number {\n        return Trace.TRACE_TAG_ALWAYS;\n    }\n\n    private static nativeTraceCounter(tag:number, name:string, value:number):void {\n    }\n\n    private static nativeTraceBegin(tag:number, name:string):void {}\n\n    private static nativeTraceEnd(tag:number):void {}\n\n    private static nativeAsyncTraceBegin(tag:number, name:string, cookie:number):void {}\n\n    private static nativeAsyncTraceEnd(tag:number, name:string, cookie:number):void {}\n\n    private static nativeSetAppTracingAllowed(allowed:boolean):void {}\n\n    private static nativeSetTracingEnabled(allowed:boolean):void {}\n\n\n    /**\n     * Caches a copy of the enabled-tag bits.  The \"master\" copy is held by the native code,\n     * and comes from the PROPERTY_TRACE_TAG_ENABLEFLAGS property.\n     * <p>\n     * If the native code hasn't yet read the property, we will cause it to do one-time\n     * initialization.  We don't want to do this during class init, because this class is\n     * preloaded, so all apps would be stuck with whatever the zygote saw.  (The zygote\n     * doesn't see the system-property update broadcasts.)\n     * <p>\n     * We want to defer initialization until the first use by an app, post-zygote.\n     * <p>\n     * We're okay if multiple threads call here simultaneously -- the native state is\n     * synchronized, and sEnabledTags is volatile (prevents word tearing).\n     */\n    private static cacheEnabledTags():number  {\n        let tags:number = Trace.nativeGetEnabledTags();\n        Trace.sEnabledTags = tags;\n        return tags;\n    }\n\n    /**\n     * Returns true if a trace tag is enabled.\n     *\n     * @param traceTag The trace tag to check.\n     * @return True if the trace tag is valid.\n     *\n     * @hide\n     */\n    static isTagEnabled(traceTag:number):boolean  {\n        let tags:number = Trace.sEnabledTags;\n        if (tags == Trace.TRACE_TAG_NOT_READY) {\n            tags = Trace.cacheEnabledTags();\n        }\n        return (tags & traceTag) != 0;\n    }\n\n    /**\n     * Writes trace message to indicate the value of a given counter.\n     *\n     * @param traceTag The trace tag.\n     * @param counterName The counter name to appear in the trace.\n     * @param counterValue The counter value.\n     *\n     * @hide\n     */\n    static traceCounter(traceTag:number, counterName:string, counterValue:number):void  {\n        if (Trace.isTagEnabled(traceTag)) {\n            Trace.nativeTraceCounter(traceTag, counterName, counterValue);\n        }\n    }\n\n    /**\n     * Set whether application tracing is allowed for this process.  This is intended to be set\n     * once at application start-up time based on whether the application is debuggable.\n     *\n     * @hide\n     */\n    static setAppTracingAllowed(allowed:boolean):void  {\n        Trace.nativeSetAppTracingAllowed(allowed);\n        // Setting whether app tracing is allowed may change the tags, so we update the cached\n        // tags here.\n        Trace.cacheEnabledTags();\n    }\n\n    /**\n     * Set whether tracing is enabled in this process.  Tracing is disabled shortly after Zygote\n     * initializes and re-enabled after processes fork from Zygote.  This is done because Zygote\n     * has no way to be notified about changes to the tracing tags, and if Zygote ever reads and\n     * caches the tracing tags, forked processes will inherit those stale tags.\n     *\n     * @hide\n     */\n    static setTracingEnabled(enabled:boolean):void  {\n        Trace.nativeSetTracingEnabled(enabled);\n        // Setting whether tracing is enabled may change the tags, so we update the cached tags\n        // here.\n        Trace.cacheEnabledTags();\n    }\n\n    /**\n     * Writes a trace message to indicate that a given section of code has\n     * begun. Must be followed by a call to {@link #traceEnd} using the same\n     * tag.\n     *\n     * @param traceTag The trace tag.\n     * @param methodName The method name to appear in the trace.\n     *\n     * @hide\n     */\n    static traceBegin(traceTag:number, methodName:string):void  {\n        if (Trace.isTagEnabled(traceTag)) {\n            Trace.nativeTraceBegin(traceTag, methodName);\n        }\n    }\n\n    /**\n     * Writes a trace message to indicate that the current method has ended.\n     * Must be called exactly once for each call to {@link #traceBegin} using the same tag.\n     *\n     * @param traceTag The trace tag.\n     *\n     * @hide\n     */\n    static traceEnd(traceTag:number):void  {\n        if (Trace.isTagEnabled(traceTag)) {\n            Trace.nativeTraceEnd(traceTag);\n        }\n    }\n\n    /**\n     * Writes a trace message to indicate that a given section of code has\n     * begun. Must be followed by a call to {@link #asyncTraceEnd} using the same\n     * tag. Unlike {@link #traceBegin(long, String)} and {@link #traceEnd(long)},\n     * asynchronous events do not need to be nested. The name and cookie used to\n     * begin an event must be used to end it.\n     *\n     * @param traceTag The trace tag.\n     * @param methodName The method name to appear in the trace.\n     * @param cookie Unique identifier for distinguishing simultaneous events\n     *\n     * @hide\n     */\n    static asyncTraceBegin(traceTag:number, methodName:string, cookie:number):void  {\n        if (Trace.isTagEnabled(traceTag)) {\n            Trace.nativeAsyncTraceBegin(traceTag, methodName, cookie);\n        }\n    }\n\n    /**\n     * Writes a trace message to indicate that the current method has ended.\n     * Must be called exactly once for each call to {@link #asyncTraceBegin(long, String, int)}\n     * using the same tag, name and cookie.\n     *\n     * @param traceTag The trace tag.\n     * @param methodName The method name to appear in the trace.\n     * @param cookie Unique identifier for distinguishing simultaneous events\n     *\n     * @hide\n     */\n    static asyncTraceEnd(traceTag:number, methodName:string, cookie:number):void  {\n        if (Trace.isTagEnabled(traceTag)) {\n            Trace.nativeAsyncTraceEnd(traceTag, methodName, cookie);\n        }\n    }\n\n    /**\n     * Writes a trace message to indicate that a given section of code has begun. This call must\n     * be followed by a corresponding call to {@link #endSection()} on the same thread.\n     *\n     * <p class=\"note\"> At this time the vertical bar character '|', newline character '\\n', and\n     * null character '\\0' are used internally by the tracing mechanism.  If sectionName contains\n     * these characters they will be replaced with a space character in the trace.\n     *\n     * @param sectionName The name of the code section to appear in the trace.  This may be at\n     * most 127 Unicode code units long.\n     */\n    static beginSection(sectionName:string):void  {\n        if (Trace.isTagEnabled(Trace.TRACE_TAG_APP)) {\n            if (sectionName.length > Trace.MAX_SECTION_NAME_LEN) {\n                throw Error(`new IllegalArgumentException(\"sectionName is too long\")`);\n            }\n            Trace.nativeTraceBegin(Trace.TRACE_TAG_APP, sectionName);\n        }\n    }\n\n    /**\n     * Writes a trace message to indicate that a given section of code has ended. This call must\n     * be preceeded by a corresponding call to {@link #beginSection(String)}. Calling this method\n     * will mark the end of the most recently begun section of code, so care must be taken to\n     * ensure that beginSection / endSection pairs are properly nested and called from the same\n     * thread.\n     */\n    static endSection():void  {\n        if (Trace.isTagEnabled(Trace.TRACE_TAG_APP)) {\n            Trace.nativeTraceEnd(Trace.TRACE_TAG_APP);\n        }\n    }\n}\n}"
  },
  {
    "path": "src/android/support/v4/view/PagerAdapter.ts",
    "content": "/*\n * Copyright (C) 2011 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../database/DataSetObservable.ts\"/>\n///<reference path=\"../../../database/Observable.ts\"/>\n///<reference path=\"../../../database/DataSetObserver.ts\"/>\n///<reference path=\"../../../view/ViewGroup.ts\"/>\n\nmodule android.support.v4.view {\n\nimport Observable = android.database.Observable;\nimport DataSetObservable = android.database.DataSetObservable;\nimport DataSetObserver = android.database.DataSetObserver;\nimport ViewGroup = android.view.ViewGroup;\nimport View = android.view.View;\n\n    /**\n     * Base class providing the adapter to populate pages inside of\n     * a {@link ViewPager}.  You will most likely want to use a more\n     * specific implementation of this, such as\n     * {@link android.support.v4.app.FragmentPagerAdapter} or\n     * {@link android.support.v4.app.FragmentStatePagerAdapter}.\n     *\n     * <p>When you implement a PagerAdapter, you must override the following methods\n     * at minimum:</p>\n     * <ul>\n     * <li>{@link #instantiateItem(ViewGroup, int)}</li>\n     * <li>{@link #destroyItem(ViewGroup, int, Object)}</li>\n     * <li>{@link #getCount()}</li>\n     * <li>{@link #isViewFromObject(View, Object)}</li>\n     * </ul>\n     *\n     * <p>PagerAdapter is more general than the adapters used for\n     * {@link android.widget.AdapterView AdapterViews}. Instead of providing a\n     * View recycling mechanism directly ViewPager uses callbacks to indicate the\n     * steps taken during an update. A PagerAdapter may implement a form of View\n     * recycling if desired or use a more sophisticated method of managing page\n     * Views such as Fragment transactions where each page is represented by its\n     * own Fragment.</p>\n     *\n     * <p>ViewPager associates each page with a key Object instead of working with\n     * Views directly. This key is used to track and uniquely identify a given page\n     * independent of its position in the adapter. A call to the PagerAdapter method\n     * {@link #startUpdate(ViewGroup)} indicates that the contents of the ViewPager\n     * are about to change. One or more calls to {@link #instantiateItem(ViewGroup, int)}\n     * and/or {@link #destroyItem(ViewGroup, int, Object)} will follow, and the end\n     * of an update will be signaled by a call to {@link #finishUpdate(ViewGroup)}.\n     * By the time {@link #finishUpdate(ViewGroup) finishUpdate} returns the views\n     * associated with the key objects returned by\n     * {@link #instantiateItem(ViewGroup, int) instantiateItem} should be added to\n     * the parent ViewGroup passed to these methods and the views associated with\n     * the keys passed to {@link #destroyItem(ViewGroup, int, Object) destroyItem}\n     * should be removed. The method {@link #isViewFromObject(View, Object)} identifies\n     * whether a page View is associated with a given key object.</p>\n     *\n     * <p>A very simple PagerAdapter may choose to use the page Views themselves\n     * as key objects, returning them from {@link #instantiateItem(ViewGroup, int)}\n     * after creation and adding them to the parent ViewGroup. A matching\n     * {@link #destroyItem(ViewGroup, int, Object)} implementation would remove the\n     * View from the parent ViewGroup and {@link #isViewFromObject(View, Object)}\n     * could be implemented as <code>return view == object;</code>.</p>\n     *\n     * <p>PagerAdapter supports data set changes. Data set changes must occur on the\n     * main thread and must end with a call to {@link #notifyDataSetChanged()} similar\n     * to AdapterView adapters derived from {@link android.widget.BaseAdapter}. A data\n     * set change may involve pages being added, removed, or changing position. The\n     * ViewPager will keep the current page active provided the adapter implements\n     * the method {@link #getItemPosition(Object)}.</p>\n     */\n    export abstract class PagerAdapter {\n        private mObservable = new DataSetObservable();\n        static POSITION_UNCHANGED = -1;\n        static POSITION_NONE = -2;\n\n        /**\n         * Return the number of views available.\n         */\n        abstract getCount():number;\n\n        /**\n         * Called when a change in the shown pages is going to start being made.\n         * @param container The containing View which is displaying this adapter's\n         * * page views.\n         */\n        startUpdate(container:ViewGroup) {\n        }\n\n        /**\n         * Create the page for the given position.  The adapter is responsible\n         * for adding the view to the container given here, although it only\n         * must ensure this is done by the time it returns from\n         * [.finishUpdate].\n\n         * @param container The containing View in which the page will be shown.\n         * *\n         * @param position The page position to be instantiated.\n         * *\n         * @return Returns an Object representing the new page.  This does not\n         * * need to be a View, but can be some other container of the page.\n         */\n        instantiateItem(container:ViewGroup, position:number):any {\n            throw new Error(\n                \"Required method instantiateItem was not overridden\");\n        }\n\n        /**\n         * Remove a page for the given position.  The adapter is responsible\n         * for removing the view from its container, although it only must ensure\n         * this is done by the time it returns from [.finishUpdate].\n\n         * @param container The containing View from which the page will be removed.\n         * *\n         * @param position The page position to be removed.\n         * *\n         * @param object The same object that was returned by\n         * * [.instantiateItem].\n         */\n        destroyItem(container:ViewGroup, position:number, object:any) {\n            throw new Error(\"Required method destroyItem was not overridden\");\n        }\n\n        /**\n         * Called to inform the adapter of which item is currently considered to\n         * be the \"primary\", that is the one show to the user as the current page.\n\n         * @param container The containing View from which the page will be removed.\n         * *\n         * @param position The page position that is now the primary.\n         * *\n         * @param object The same object that was returned by\n         * * [.instantiateItem].\n         */\n        setPrimaryItem(container:ViewGroup, position:number, object:any) {\n        }\n\n        /**\n         * Called when the a change in the shown pages has been completed.  At this\n         * point you must ensure that all of the pages have actually been added or\n         * removed from the container as appropriate.\n         * @param container The containing View which is displaying this adapter's\n         * * page views.\n         */\n        finishUpdate(container:ViewGroup) {\n        }\n\n\n        /**\n         * Determines whether a page View is associated with a specific key object\n         * as returned by [.instantiateItem]. This method is\n         * required for a PagerAdapter to function properly.\n\n         * @param view Page View to check for association with object\n         * *\n         * @param object Object to check for association with `view`\n         * *\n         * @return return true if `view` is associated with the key object object\n         */\n        abstract isViewFromObject(view:View, object:any):boolean ;\n\n\n        /**\n         * Called when the host view is attempting to determine if an item's position\n         * has changed. Returns [.POSITION_UNCHANGED] if the position of the given\n         * item has not changed or [.POSITION_NONE] if the item is no longer present\n         * in the adapter.\n\n         *\n         * The default implementation assumes that items will never\n         * change position and always returns [.POSITION_UNCHANGED].\n\n         * @param object Object representing an item, previously returned by a call to\n         * *               [.instantiateItem].\n         * *\n         * @return object's new position index from [0, [.getCount]),\n         * *         [.POSITION_UNCHANGED] if the object's position has not changed,\n         * *         or [.POSITION_NONE] if the item is no longer present.\n         */\n        getItemPosition(object:any):number {\n            return PagerAdapter.POSITION_UNCHANGED\n        }\n\n        /**\n         * This method should be called by the application if the data backing this adapter has changed\n         * and associated views should update.\n         */\n        notifyDataSetChanged() {\n            this.mObservable.notifyChanged()\n        }\n\n        /**\n         * Register an observer to receive callbacks related to the adapter's data changing.\n\n         * @param observer The [android.database.DataSetObserver] which will receive callbacks.\n         */\n        registerDataSetObserver(observer:DataSetObserver) {\n            this.mObservable.registerObserver(observer)\n        }\n\n        /**\n         * Unregister an observer from callbacks related to the adapter's data changing.\n\n         * @param observer The [android.database.DataSetObserver] which will be unregistered.\n         */\n        unregisterDataSetObserver(observer:DataSetObserver) {\n            this.mObservable.unregisterObserver(observer)\n        }\n\n        /**\n         * This method may be called by the ViewPager to obtain a title string\n         * to describe the specified page. This method may return null\n         * indicating no title for this page. The default implementation returns\n         * null.\n\n         * @param position The position of the title requested\n         * *\n         * @return A title for the requested page\n         */\n        getPageTitle(position:number):string {\n            return null\n        }\n\n        /**\n         * Returns the proportional width of a given page as a percentage of the\n         * ViewPager's measured width from (0.f-1.f]\n\n         * @param position The position of the page requested\n         * *\n         * @return Proportional width for the given page position\n         */\n        getPageWidth(position:number):number {\n            return 1;\n        }\n    }\n}"
  },
  {
    "path": "src/android/support/v4/view/ViewPager.ts",
    "content": "/*\n * Copyright (C) 2011 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../view/View.ts\"/>\n///<reference path=\"../../../view/VelocityTracker.ts\"/>\n///<reference path=\"../../../widget/OverScroller.ts\"/>\n///<reference path=\"../../../view/ViewGroup.ts\"/>\n///<reference path=\"../../../view/MotionEvent.ts\"/>\n///<reference path=\"../../../view/animation/Interpolator.ts\"/>\n///<reference path=\"../../../../java/util/ArrayList.ts\"/>\n///<reference path=\"../../../database/DataSetObservable.ts\"/>\n///<reference path=\"../../../database/Observable.ts\"/>\n///<reference path=\"../../../database/DataSetObserver.ts\"/>\n///<reference path=\"PagerAdapter.ts\"/>\n\n\n//support v4 23.1.0\nmodule android.support.v4.view {\n    import View = android.view.View;\n    import Gravity = android.view.Gravity;\n    import MeasureSpec = View.MeasureSpec;\n    import OverScroller = android.widget.OverScroller;\n    import ViewGroup = android.view.ViewGroup;\n    import Interpolator = android.view.animation.Interpolator;\n    import ArrayList = java.util.ArrayList;\n    import Rect = android.graphics.Rect;\n    import PagerAdapter = android.support.v4.view.PagerAdapter;\n    import Observable = android.database.Observable;\n    import DataSetObservable = android.database.DataSetObservable;\n    import DataSetObserver = android.database.DataSetObserver;\n    import Drawable = android.graphics.drawable.Drawable;\n    import VelocityTracker = android.view.VelocityTracker;\n    import ViewConfiguration = android.view.ViewConfiguration;\n    import Runnable = java.lang.Runnable;\n    import Resources = android.content.res.Resources;\n    import Log = android.util.Log;\n    import MotionEvent = android.view.MotionEvent;\n    import KeyEvent = android.view.KeyEvent;\n\n    const TAG = \"ViewPager\";\n    const DEBUG = false;\n\n    const SymbolDecor = Symbol();\n\n    /**\n     * Layout manager that allows the user to flip left and right\n     * through pages of data.  You supply an implementation of a\n     * {@link PagerAdapter} to generate the pages that the view shows.\n     *\n     * <p>Note this class is currently under early design and\n     * development.  The API will likely change in later updates of\n     * the compatibility library, requiring changes to the source code\n     * of apps when they are compiled against the newer version.</p>\n     *\n     * <p>ViewPager is most often used in conjunction with {@link android.app.Fragment},\n     * which is a convenient way to supply and manage the lifecycle of each page.\n     * There are standard adapters implemented for using fragments with the ViewPager,\n     * which cover the most common use cases.  These are\n     * {@link android.support.v4.app.FragmentPagerAdapter} and\n     * {@link android.support.v4.app.FragmentStatePagerAdapter}; each of these\n     * classes have simple code showing how to build a full user interface\n     * with them.\n     *\n     * <p>Here is a more complicated example of ViewPager, using it in conjuction\n     * with {@link android.app.ActionBar} tabs.  You can find other examples of using\n     * ViewPager in the API 4+ Support Demos and API 13+ Support Demos sample code.\n     *\n     * {@sample development/samples/Support13Demos/src/com/example/android/supportv13/app/ActionBarTabsPager.java\n     *      complete}\n     */\n    export class ViewPager extends ViewGroup {\n        /**\n         * Used to track what the expected number of items in the adapter should be.\n         * If the app changes this when we don't expect it, we'll throw a big obnoxious exception.\n         */\n        private mExpectedAdapterCount = 0;\n        private static COMPARATOR = (lhs:ItemInfo, rhs:ItemInfo):number=> {\n            return lhs.position - rhs.position;\n        };\n\n        private static USE_CACHE = false;\n\n        private static DEFAULT_OFFSCREEN_PAGES = 1;\n        private static MAX_SETTLE_DURATION = 600; // ms\n        private static MIN_DISTANCE_FOR_FLING = 25; // dips\n        private static DEFAULT_GUTTER_SIZE = 16; // dips\n        private static MIN_FLING_VELOCITY = 400; // dips\n\n        private static sInterpolator:Interpolator = {\n            getInterpolation(t:number):number {\n                t -= 1.0;\n                return t * t * t * t * t + 1.0;\n            }\n        };\n        private mItems = new ArrayList<ItemInfo>();\n        private mTempItem = new ItemInfo();\n        private mTempRect = new Rect();\n\n        private mAdapter:PagerAdapter;\n        private mCurItem:number = 0;// Index of currently displayed page.\n\n        private mRestoredCurItem = -1;\n        private mScroller:OverScroller;\n        private mObserver:PagerObserver;\n\n        private mPageMargin:number = 0;\n        private mMarginDrawable:Drawable;\n        private mTopPageBounds:number = 0;\n        private mBottomPageBounds:number = 0;\n\n        // Offsets of the first and last items, if known.\n        // Set during population, used to determine if we are at the beginning\n        // or end of the pager data set during touch scrolling.\n        private mFirstOffset = -Number.MAX_VALUE;\n        private mLastOffset = Number.MAX_VALUE;\n\n        private mChildWidthMeasureSpec:number = 0;\n        private mChildHeightMeasureSpec:number = 0;\n        private mInLayout = false;\n\n        private mScrollingCacheEnabled = false;\n\n        private mPopulatePending = false;\n        private mOffscreenPageLimit = ViewPager.DEFAULT_OFFSCREEN_PAGES;\n\n        private mIsBeingDragged = false;\n        private mIsUnableToDrag = false;\n        private mDefaultGutterSize:number = 0;\n        private mGutterSize:number = 0;\n        //private mTouchSlop: number = 0;\n        /**\n         * Position of the last motion event.\n         */\n        private mLastMotionX = 0;\n        private mLastMotionY = 0;\n        private mInitialMotionX = 0;\n        private mInitialMotionY = 0;\n\n        private static INVALID_POINTER = -1;\n        /**\n         * ID of the active pointer. This is used to retain consistency during\n         * drags/flings if multiple pointers are used.\n         */\n        private mActivePointerId = ViewPager.INVALID_POINTER;\n\n        /**\n         * Determines speed during touch scrolling\n         */\n        private mVelocityTracker:VelocityTracker;\n        private mMinimumVelocity:number = 0;\n        private mMaximumVelocity:number = 0;\n        private mFlingDistance:number = 0;\n        private mCloseEnough:number = 0;\n\n        // If the pager is at least this close to its final position, complete the scroll\n        // on touch down and let the user interact with the content inside instead of\n        // \"catching\" the flinging pager.\n        private static CLOSE_ENOUGH = 2; // dp\n\n        private mFakeDragging = false;\n        private mFakeDragBeginTime = 0;\n\n        //private mLeftEdge: EdgeEffectCompat;\n        //private mRightEdge: EdgeEffectCompat;\n\n        private mFirstLayout = true;\n        private mNeedCalculatePageOffsets = false;\n        private mCalledSuper = false;\n        private mDecorChildCount:number = 0;\n\n        private mOnPageChangeListeners:ArrayList<ViewPager.OnPageChangeListener>;\n        private mOnPageChangeListener:ViewPager.OnPageChangeListener;\n        private mInternalPageChangeListener:ViewPager.OnPageChangeListener;\n        private mAdapterChangeListener:ViewPager.OnAdapterChangeListener;\n        private mPageTransformer:ViewPager.PageTransformer;\n\n        //private mSetChildrenDrawingOrderEnabled: Method;\n\n        private static DRAW_ORDER_DEFAULT = 0;\n        private static DRAW_ORDER_FORWARD = 1;\n        private static DRAW_ORDER_REVERSE = 2;\n        private mDrawingOrder:number = 0;\n        private mDrawingOrderedChildren:ArrayList<View>;\n        private static sPositionComparator = (lhs:View, rhs:View):number=> {\n            let llp = <ViewPager.LayoutParams>lhs.getLayoutParams();\n            let rlp = <ViewPager.LayoutParams>rhs.getLayoutParams();\n            if (llp.isDecor != rlp.isDecor) {\n                return llp.isDecor ? 1 : -1;\n            }\n            return llp.position - rlp.position\n        };\n\n        /**\n         * Indicates that the pager is in an idle, settled state. The current page\n         * is fully in view and no animation is in progress.\n         */\n        static SCROLL_STATE_IDLE = 0\n\n        /**\n         * Indicates that the pager is currently being dragged by the user.\n         */\n        static SCROLL_STATE_DRAGGING = 1\n\n        /**\n         * Indicates that the pager is in the process of settling to a final position.\n         */\n        static SCROLL_STATE_SETTLING = 2\n\n        private mEndScrollRunnable = (()=>{\n            let ViewPager_this = this;\n            class InnerClass implements Runnable{\n                run() {\n                    (<any>ViewPager_this).setScrollState(ViewPager.SCROLL_STATE_IDLE);\n                    (<any>ViewPager_this).populate();\n                }\n            }\n            return new InnerClass();\n        })();\n\n        private mScrollState = ViewPager.SCROLL_STATE_IDLE;\n\n        constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?){\n            super(context, bindElement, defStyle);\n            this.initViewPager();\n        }\n\n        private initViewPager() {\n            this.setWillNotDraw(false)\n            this.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);\n            this.setFocusable(true);\n            //let context = getContext()\n            this.mScroller = new OverScroller(ViewPager.sInterpolator)\n            //let configuration = ViewConfiguration.get(context)\n            let density = Resources.getDisplayMetrics().density\n\n            this.mTouchSlop = ViewConfiguration.get().getScaledPagingTouchSlop()\n            this.mMinimumVelocity = Math.floor(ViewPager.MIN_FLING_VELOCITY * density);\n            this.mMaximumVelocity = ViewConfiguration.get().getScaledMaximumFlingVelocity()\n            //this.mLeftEdge = EdgeEffectCompat(context)\n            //this.mRightEdge = EdgeEffectCompat(context)\n\n            this.mFlingDistance = Math.floor(ViewPager.MIN_DISTANCE_FOR_FLING * density)\n            this.mCloseEnough = Math.floor(ViewPager.CLOSE_ENOUGH * density)\n            this.mDefaultGutterSize = Math.floor(ViewPager.DEFAULT_GUTTER_SIZE * density)\n\n            //ViewCompat.setAccessibilityDelegate(this, MyAccessibilityDelegate())\n\n            //if (ViewCompat.getImportantForAccessibility(this) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {\n            //    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES)\n            //}\n        }\n\n        protected onDetachedFromWindow():void {\n            this.removeCallbacks(this.mEndScrollRunnable);\n            super.onDetachedFromWindow();\n        }\n\n        private setScrollState(newState:number) {\n            if (this.mScrollState == newState) {\n                return;\n            }\n\n            this.mScrollState = newState;\n            if (this.mPageTransformer != null) {\n                // PageTransformers can do complex things that benefit from hardware layers.\n                this.enableLayers(newState != ViewPager.SCROLL_STATE_IDLE);\n            }\n            this.dispatchOnScrollStateChanged(newState);\n        }\n\n\n        /**\n         * Set a PagerAdapter that will supply views for this pager as needed.\n\n         * @param adapter Adapter to use\n         */\n        setAdapter(adapter:PagerAdapter):void {\n            if (this.mAdapter != null) {\n                this.mAdapter.unregisterDataSetObserver(this.mObserver);\n                this.mAdapter.startUpdate(this);\n                for (let i = 0; i < this.mItems.size(); i++) {\n                    const ii = this.mItems.get(i);\n                    this.mAdapter.destroyItem(this, ii.position, ii.object);\n                }\n                this.mAdapter.finishUpdate(this);\n                this.mItems.clear();\n                this.removeNonDecorViews();\n                this.mCurItem = 0;\n                this.scrollTo(0, 0);\n            }\n\n            const oldAdapter = this.mAdapter;\n            this.mAdapter = adapter;\n            this.mExpectedAdapterCount = 0;\n\n            if (this.mAdapter != null) {\n                if (this.mObserver == null) {\n                    this.mObserver = new PagerObserver(this);\n                }\n                this.mAdapter.registerDataSetObserver(this.mObserver);\n                this.mPopulatePending = false;\n                const wasFirstLayout = this.mFirstLayout;\n                this.mFirstLayout = true;\n                this.mExpectedAdapterCount = this.mAdapter.getCount();\n                if (this.mRestoredCurItem >= 0) {\n                    //this.mAdapter.restoreState(this.mRestoredAdapterState, this.mRestoredClassLoader);\n                    this.setCurrentItemInternal(this.mRestoredCurItem, false, true);\n                    this.mRestoredCurItem = -1;\n                    //this.mRestoredAdapterState = null;\n                    //this.mRestoredClassLoader = null;\n                } else if (!wasFirstLayout) {\n                    this.populate();\n                } else {\n                    this.requestLayout();\n                }\n            }\n\n            if (this.mAdapterChangeListener != null && oldAdapter != adapter) {\n                this.mAdapterChangeListener.onAdapterChanged(oldAdapter, adapter);\n            }\n        }\n\n        private removeNonDecorViews() {\n            for (let i = 0; i < this.getChildCount(); i++) {\n                const child = this.getChildAt(i);\n                const lp = <ViewPager.LayoutParams>child.getLayoutParams();\n                if (!lp.isDecor) {\n                    this.removeViewAt(i);\n                    i--;\n                }\n            }\n        }\n\n        /**\n         * Retrieve the current adapter supplying pages.\n         *\n         * @return The currently registered PagerAdapter\n         */\n        public getAdapter():PagerAdapter {\n            return this.mAdapter;\n        }\n\n        setOnAdapterChangeListener(listener:ViewPager.OnAdapterChangeListener):void {\n            this.mAdapterChangeListener = listener;\n        }\n\n        private getClientWidth() {\n            return this.getMeasuredWidth() - this.getPaddingLeft() - this.getPaddingRight();\n        }\n\n\n        /**\n         * Set the currently selected page.\n         *\n         * @param item Item index to select\n         * @param smoothScroll True to smoothly scroll to the new item, false to transition immediately\n         */\n        public setCurrentItem(item:number, smoothScroll = !this.mFirstLayout):void {\n            this.mPopulatePending = false;\n            this.setCurrentItemInternal(item, smoothScroll, false);\n        }\n\n        getCurrentItem():number {\n            return this.mCurItem;\n        }\n\n        setCurrentItemInternal(item:number, smoothScroll:boolean, always:boolean, velocity = 0) {\n            if (this.mAdapter == null || this.mAdapter.getCount() <= 0) {\n                this.setScrollingCacheEnabled(false);\n                return;\n            }\n            if (!always && this.mCurItem == item && this.mItems.size() != 0) {\n                this.setScrollingCacheEnabled(false);\n                return;\n            }\n\n            if (item < 0) {\n                item = 0;\n            } else if (item >= this.mAdapter.getCount()) {\n                item = this.mAdapter.getCount() - 1;\n            }\n            const pageLimit = this.mOffscreenPageLimit;\n            if (item > (this.mCurItem + pageLimit) || item < (this.mCurItem - pageLimit)) {\n                // We are doing a jump by more than one page.  To avoid\n                // glitches, we want to keep all current pages in the view\n                // until the scroll ends.\n                for (let i = 0; i < this.mItems.size(); i++) {\n                    this.mItems.get(i).scrolling = true;\n                }\n            }\n            const dispatchSelected = this.mCurItem != item;\n\n            if (this.mFirstLayout) {\n                // We don't have any idea how big we are yet and shouldn't have any pages either.\n                // Just set things up and let the pending layout handle things.\n                this.mCurItem = item;\n                if (dispatchSelected) {\n                    this.dispatchOnPageSelected(item);\n                }\n                this.requestLayout();\n            } else {\n                this.populate(item);\n                this.scrollToItem(item, smoothScroll, velocity, dispatchSelected);\n            }\n        }\n\n        private scrollToItem(item:number, smoothScroll:boolean, velocity:number, dispatchSelected:boolean) {\n            const curInfo = this.infoForPosition(item);\n            let destX = 0;\n            if (curInfo != null) {\n                const width = this.getClientWidth();\n                destX = Math.floor(width * Math.max(this.mFirstOffset,\n                        Math.min(curInfo.offset, this.mLastOffset)));\n            }\n            if (smoothScroll) {\n                this.smoothScrollTo(destX, 0, velocity);\n                if (dispatchSelected) {\n                    this.dispatchOnPageSelected(item);\n                }\n            } else {\n                if (dispatchSelected) {\n                    this.dispatchOnPageSelected(item);\n                }\n                this.completeScroll(false);\n                this.scrollTo(destX, 0);\n                this.pageScrolled(destX);\n            }\n        }\n\n\n        /**\n         * Set a listener that will be invoked whenever the page changes or is incrementally\n         * scrolled. See {@link OnPageChangeListener}.\n         *\n         * @param listener Listener to set\n         *\n         * @deprecated Use {@link #addOnPageChangeListener(OnPageChangeListener)}\n         * and {@link #removeOnPageChangeListener(OnPageChangeListener)} instead.\n         */\n        setOnPageChangeListener(listener:ViewPager.OnPageChangeListener) {\n            this.mOnPageChangeListener = listener;\n        }\n\n\n        /**\n         * Add a listener that will be invoked whenever the page changes or is incrementally\n         * scrolled. See {@link OnPageChangeListener}.\n         *\n         * <p>Components that add a listener should take care to remove it when finished.\n         * Other components that take ownership of a view may call {@link #clearOnPageChangeListeners()}\n         * to remove all attached listeners.</p>\n         *\n         * @param listener listener to add\n         */\n        addOnPageChangeListener(listener:ViewPager.OnPageChangeListener) {\n            if (this.mOnPageChangeListeners == null) {\n                this.mOnPageChangeListeners = new ArrayList<ViewPager.OnPageChangeListener>();\n            }\n            this.mOnPageChangeListeners.add(listener);\n        }\n\n        /**\n         * Remove a listener that was previously added via\n         * {@link #addOnPageChangeListener(OnPageChangeListener)}.\n         *\n         * @param listener listener to remove\n         */\n        removeOnPageChangeListener(listener:ViewPager.OnPageChangeListener) {\n            if (this.mOnPageChangeListeners != null) {\n                this.mOnPageChangeListeners.remove(listener);\n            }\n        }\n\n\n        /**\n         * Remove all listeners that are notified of any changes in scroll state or position.\n         */\n        clearOnPageChangeListeners() {\n            if (this.mOnPageChangeListeners != null) {\n                this.mOnPageChangeListeners.clear();\n            }\n        }\n\n\n        /**\n         * Set a {@link PageTransformer} that will be called for each attached page whenever\n         * the scroll position is changed. This allows the application to apply custom property\n         * transformations to each page, overriding the default sliding look and feel.\n         *\n         * <p><em>Note:</em> Prior to Android 3.0 the property animation APIs did not exist.\n         * As a result, setting a PageTransformer prior to Android 3.0 (API 11) will have no effect.</p>\n         *\n         * @param reverseDrawingOrder true if the supplied PageTransformer requires page views\n         *                            to be drawn from last to first instead of first to last.\n         * @param transformer PageTransformer that will modify each page's animation properties\n         */\n        setPageTransformer(reverseDrawingOrder:boolean, transformer:ViewPager.PageTransformer) {\n            const hasTransformer = transformer != null;\n            const needsPopulate = hasTransformer != (this.mPageTransformer != null);\n            this.mPageTransformer = transformer;\n            this.setChildrenDrawingOrderEnabledCompat(hasTransformer);\n            if (hasTransformer) {\n                this.mDrawingOrder = reverseDrawingOrder ? ViewPager.DRAW_ORDER_REVERSE : ViewPager.DRAW_ORDER_FORWARD;\n            } else {\n                this.mDrawingOrder = ViewPager.DRAW_ORDER_DEFAULT;\n            }\n            if (needsPopulate) this.populate();\n        }\n\n        setChildrenDrawingOrderEnabledCompat(enable=true) {\n            this.setChildrenDrawingOrderEnabled(enable);\n        }\n\n        getChildDrawingOrder(childCount:number, i:number):number {\n            const index = this.mDrawingOrder == ViewPager.DRAW_ORDER_REVERSE ? childCount - 1 - i : i;\n            const result = (<ViewPager.LayoutParams>this.mDrawingOrderedChildren.get(index).getLayoutParams()).childIndex;\n            return result;\n        }\n\n\n        /**\n         * Set a separate OnPageChangeListener for internal use by the support library.\n         *\n         * @param listener Listener to set\n         * @return The old listener that was set, if any.\n         */\n        setInternalPageChangeListener(listener:ViewPager.OnPageChangeListener):ViewPager.OnPageChangeListener {\n            let oldListener = this.mInternalPageChangeListener;\n            this.mInternalPageChangeListener = listener;\n            return oldListener;\n        }\n\n\n        /**\n         * Returns the number of pages that will be retained to either side of the\n         * current page in the view hierarchy in an idle state. Defaults to 1.\n         *\n         * @return How many pages will be kept offscreen on either side\n         * @see #setOffscreenPageLimit(int)\n         */\n        getOffscreenPageLimit():number {\n            return this.mOffscreenPageLimit;\n        }\n\n\n        /**\n         * Set the number of pages that should be retained to either side of the\n         * current page in the view hierarchy in an idle state. Pages beyond this\n         * limit will be recreated from the adapter when needed.\n         *\n         * <p>This is offered as an optimization. If you know in advance the number\n         * of pages you will need to support or have lazy-loading mechanisms in place\n         * on your pages, tweaking this setting can have benefits in perceived smoothness\n         * of paging animations and interaction. If you have a small number of pages (3-4)\n         * that you can keep active all at once, less time will be spent in layout for\n         * newly created view subtrees as the user pages back and forth.</p>\n         *\n         * <p>You should keep this limit low, especially if your pages have complex layouts.\n         * This setting defaults to 1.</p>\n         *\n         * @param limit How many pages will be kept offscreen in an idle state.\n         */\n        setOffscreenPageLimit(limit:number):void {\n            if (limit < ViewPager.DEFAULT_OFFSCREEN_PAGES) {\n                Log.w(TAG, \"Requested offscreen page limit \" + limit + \" too small; defaulting to \" +\n                    ViewPager.DEFAULT_OFFSCREEN_PAGES);\n                limit = ViewPager.DEFAULT_OFFSCREEN_PAGES;\n            }\n            if (limit != this.mOffscreenPageLimit) {\n                this.mOffscreenPageLimit = limit;\n                this.populate();\n            }\n        }\n\n        /**\n         * Set the margin between pages.\n         *\n         * @param marginPixels Distance between adjacent pages in pixels\n         * @see #getPageMargin()\n         * @see #setPageMarginDrawable(Drawable)\n         * @see #setPageMarginDrawable(int)\n         */\n        setPageMargin(marginPixels:number):void {\n            const oldMargin = this.mPageMargin;\n            this.mPageMargin = marginPixels;\n\n            const width = this.getWidth();\n            this.recomputeScrollPosition(width, width, marginPixels, oldMargin);\n\n            this.requestLayout();\n        }\n\n        /**\n         * Return the margin between pages.\n         *\n         * @return The size of the margin in pixels\n         */\n        getPageMargin():number {\n            return this.mPageMargin;\n        }\n\n\n        /**\n         * Set a drawable that will be used to fill the margin between pages.\n         *\n         * @param d Drawable to display between pages\n         */\n        setPageMarginDrawable(d:Drawable):void {\n            this.mMarginDrawable = d;\n            if (d != null) this.refreshDrawableState();\n            this.setWillNotDraw(d == null);\n            this.invalidate();\n        }\n\n\n        protected verifyDrawable(who:Drawable):boolean{\n            return super.verifyDrawable(who) || who == this.mMarginDrawable;\n        }\n\n        protected drawableStateChanged():void {\n            super.drawableStateChanged();\n            const d = this.mMarginDrawable;\n            if (d != null && d.isStateful()) {\n                d.setState(this.getDrawableState());\n            }\n        }\n\n\n        // We want the duration of the page snap animation to be influenced by the distance that\n        // the screen has to travel, however, we don't want this duration to be effected in a\n        // purely linear fashion. Instead, we use this method to moderate the effect that the distance\n        // of travel has on the overall snap duration.\n        distanceInfluenceForSnapDuration(f:number):number {\n            f -= 0.5; // center the values about 0.\n            f *= 0.3 * Math.PI / 2.0;\n            return Math.sin(f);\n        }\n\n\n        /**\n         * Like {@link View#scrollBy}, but scroll smoothly instead of immediately.\n         *\n         * @param x the number of pixels to scroll by on the X axis\n         * @param y the number of pixels to scroll by on the Y axis\n         */\n        smoothScrollTo(x:number, y:number, velocity=0):void {\n            if (this.getChildCount() == 0) {\n                // Nothing to do.\n                this.setScrollingCacheEnabled(false);\n                return;\n            }\n            let sx = this.getScrollX();\n            let sy = this.getScrollY();\n            let dx = x - sx;\n            let dy = y - sy;\n            if (dx == 0 && dy == 0) {\n                this.completeScroll(false);\n                this.populate();\n                this.setScrollState(ViewPager.SCROLL_STATE_IDLE);\n                return;\n            }\n\n            this.setScrollingCacheEnabled(true);\n            this.setScrollState(ViewPager.SCROLL_STATE_SETTLING);\n\n            const width = this.getClientWidth();\n            const halfWidth = width / 2;\n            const distanceRatio = Math.min(1, 1.0 * Math.abs(dx) / width);\n            const distance = halfWidth + halfWidth *\n                this.distanceInfluenceForSnapDuration(distanceRatio);\n\n            let duration = 0;\n            velocity = Math.abs(velocity);\n            if (velocity > 0) {\n                duration = 4 * Math.round(1000 * Math.abs(distance / velocity));\n            } else {\n                const pageWidth = width * this.mAdapter.getPageWidth(this.mCurItem);\n                const pageDelta = Math.abs(dx) / (pageWidth + this.mPageMargin);\n                duration = Math.floor((pageDelta + 1) * 100);\n            }\n            duration = Math.min(duration, ViewPager.MAX_SETTLE_DURATION);\n\n            this.mScroller.startScroll(sx, sy, dx, dy, duration);\n            this.postInvalidateOnAnimation();\n        }\n\n        private addNewItem(position:number, index:number):ItemInfo {\n            let ii = new ItemInfo();\n            ii.position = position;\n            ii.object = this.mAdapter.instantiateItem(this, position);\n            ii.widthFactor = this.mAdapter.getPageWidth(position);\n            if (index < 0 || index >= this.mItems.size()) {\n                this.mItems.add(ii);\n            } else {\n                this.mItems.add(index, ii);\n            }\n            return ii;\n        }\n\n        dataSetChanged() {\n            // This method only gets called if our observer is attached, so mAdapter is non-null.\n\n            const adapterCount = this.mAdapter.getCount();\n            this.mExpectedAdapterCount = adapterCount;\n            let needPopulate = this.mItems.size() < this.mOffscreenPageLimit * 2 + 1 &&\n                this.mItems.size() < adapterCount;\n            let newCurrItem = this.mCurItem;\n\n            let isUpdating = false;\n            for (let i = 0; i < this.mItems.size(); i++) {\n                const ii = this.mItems.get(i);\n                const newPos = this.mAdapter.getItemPosition(ii.object);\n\n                if (newPos == PagerAdapter.POSITION_UNCHANGED) {\n                    continue;\n                }\n\n                if (newPos == PagerAdapter.POSITION_NONE) {\n                    this.mItems.remove(i);\n                    i--;\n\n                    if (!isUpdating) {\n                        this.mAdapter.startUpdate(this);\n                        isUpdating = true;\n                    }\n\n                    this.mAdapter.destroyItem(this, ii.position, ii.object);\n                    needPopulate = true;\n\n                    if (this.mCurItem == ii.position) {\n                        // Keep the current item in the valid range\n                        newCurrItem = Math.max(0, Math.min(this.mCurItem, adapterCount - 1));\n                        needPopulate = true;\n                    }\n                    continue;\n                }\n\n                if (ii.position != newPos) {\n                    if (ii.position == this.mCurItem) {\n                        // Our current item changed position. Follow it.\n                        newCurrItem = newPos;\n                    }\n\n                    ii.position = newPos;\n                    needPopulate = true;\n                }\n            }\n\n            if (isUpdating) {\n                this.mAdapter.finishUpdate(this);\n            }\n\n            this.mItems.sort(ViewPager.COMPARATOR);\n            //Collections.sort(mItems, COMPARATOR);\n\n            if (needPopulate) {\n                // Reset our known page widths; populate will recompute them.\n                const childCount = this.getChildCount();\n                for (let i = 0; i < childCount; i++) {\n                    const child = this.getChildAt(i);\n                    const lp = <ViewPager.LayoutParams>child.getLayoutParams();\n                    if (!lp.isDecor) {\n                        lp.widthFactor = 0;\n                    }\n                }\n\n                this.setCurrentItemInternal(newCurrItem, false, true);\n                this.requestLayout();\n            }\n        }\n\n        populate(newCurrentItem = this.mCurItem) {\n            let oldCurInfo:ItemInfo = null;\n            let focusDirection = View.FOCUS_FORWARD;\n            if (this.mCurItem != newCurrentItem) {\n                focusDirection = this.mCurItem < newCurrentItem ? View.FOCUS_RIGHT : View.FOCUS_LEFT;\n                oldCurInfo = this.infoForPosition(this.mCurItem);\n                this.mCurItem = newCurrentItem;\n            }\n\n            if (this.mAdapter == null) {\n                this.sortChildDrawingOrder();\n                return;\n            }\n\n            // Bail now if we are waiting to populate.  This is to hold off\n            // on creating views from the time the user releases their finger to\n            // fling to a new position until we have finished the scroll to\n            // that position, avoiding glitches from happening at that point.\n            if (this.mPopulatePending) {\n                if (DEBUG) Log.i(TAG, \"populate is pending, skipping for now...\");\n                this.sortChildDrawingOrder();\n                return;\n            }\n\n            // Also, don't populate until we are attached to a window.  This is to\n            // avoid trying to populate before we have restored our view hierarchy\n            // state and conflicting with what is restored.\n            if (!this.isAttachedToWindow()) {\n                return;\n            }\n\n            this.mAdapter.startUpdate(this);\n\n            const pageLimit = this.mOffscreenPageLimit;\n            const startPos = Math.max(0, this.mCurItem - pageLimit);\n            const N = this.mAdapter.getCount();\n            const endPos = Math.min(N-1, this.mCurItem + pageLimit);\n\n            if (N != this.mExpectedAdapterCount) {\n                throw new Error(\"The application's PagerAdapter changed the adapter's\" +\n                    \" contents without calling PagerAdapter#notifyDataSetChanged!\" +\n                    \" Expected adapter item count: \" + this.mExpectedAdapterCount + \", found: \" + N +\n                    \" Pager id: \" + this.getId() +\n                    \" Pager class: \" + this.constructor.name +\n                    \" Problematic adapter: \" + this.mAdapter.constructor.name);\n            }\n\n            // Locate the currently focused item or add it if needed.\n            let curIndex = -1;\n            let curItem:ItemInfo = null;\n            for (curIndex = 0; curIndex < this.mItems.size(); curIndex++) {\n                const ii = this.mItems.get(curIndex);\n                if (ii.position >= this.mCurItem) {\n                    if (ii.position == this.mCurItem) curItem = ii;\n                    break;\n                }\n            }\n\n            if (curItem == null && N > 0) {\n                curItem = this.addNewItem(this.mCurItem, curIndex);\n            }\n\n            // Fill 3x the available width or up to the number of offscreen\n            // pages requested to either side, whichever is larger.\n            // If we have no current item we have no work to do.\n            if (curItem != null) {\n                let extraWidthLeft = 0;\n                let itemIndex = curIndex - 1;\n                let ii = itemIndex >= 0 ? this.mItems.get(itemIndex) : null;\n                const clientWidth = this.getClientWidth();\n                const leftWidthNeeded = clientWidth <= 0 ? 0 :\n                    2 - curItem.widthFactor + this.getPaddingLeft() / clientWidth;\n                for (let pos = this.mCurItem - 1; pos >= 0; pos--) {\n                    if (extraWidthLeft >= leftWidthNeeded && pos < startPos) {\n                        if (ii == null) {\n                            break;\n                        }\n                        if (pos == ii.position && !ii.scrolling) {\n                            this.mItems.remove(itemIndex);\n                            this.mAdapter.destroyItem(this, pos, ii.object);\n                            if (DEBUG) {\n                                Log.i(TAG, \"populate() - destroyItem() with pos: \" + pos +\n                                    \" view: \" + (<View>ii.object));\n                            }\n                            itemIndex--;\n                            curIndex--;\n                            ii = itemIndex >= 0 ? this.mItems.get(itemIndex) : null;\n                        }\n                    } else if (ii != null && pos == ii.position) {\n                        extraWidthLeft += ii.widthFactor;\n                        itemIndex--;\n                        ii = itemIndex >= 0 ? this.mItems.get(itemIndex) : null;\n                    } else {\n                        ii = this.addNewItem(pos, itemIndex + 1);\n                        extraWidthLeft += ii.widthFactor;\n                        curIndex++;\n                        ii = itemIndex >= 0 ? this.mItems.get(itemIndex) : null;\n                    }\n                }\n\n                let extraWidthRight = curItem.widthFactor;\n                itemIndex = curIndex + 1;\n                if (extraWidthRight < 2) {\n                    ii = itemIndex < this.mItems.size() ? this.mItems.get(itemIndex) : null;\n                    const rightWidthNeeded = clientWidth <= 0 ? 0 :\n                    this.getPaddingRight() / clientWidth + 2;\n                    for (let pos = this.mCurItem + 1; pos < N; pos++) {\n                        if (extraWidthRight >= rightWidthNeeded && pos > endPos) {\n                            if (ii == null) {\n                                break;\n                            }\n                            if (pos == ii.position && !ii.scrolling) {\n                                this.mItems.remove(itemIndex);\n                                this.mAdapter.destroyItem(this, pos, ii.object);\n                                if (DEBUG) {\n                                    Log.i(TAG, \"populate() - destroyItem() with pos: \" + pos +\n                                        \" view: \" + (<View>ii.object));\n                                }\n                                ii = itemIndex < this.mItems.size() ? this.mItems.get(itemIndex) : null;\n                            }\n                        } else if (ii != null && pos == ii.position) {\n                            extraWidthRight += ii.widthFactor;\n                            itemIndex++;\n                            ii = itemIndex < this.mItems.size() ? this.mItems.get(itemIndex) : null;\n                        } else {\n                            ii = this.addNewItem(pos, itemIndex);\n                            itemIndex++;\n                            extraWidthRight += ii.widthFactor;\n                            ii = itemIndex < this.mItems.size() ? this.mItems.get(itemIndex) : null;\n                        }\n                    }\n                }\n\n                this.calculatePageOffsets(curItem, curIndex, oldCurInfo);\n            }\n\n            if (DEBUG) {\n                Log.i(TAG, \"Current page list:\");\n                for (let i=0; i<this.mItems.size(); i++) {\n                    Log.i(TAG, \"#\" + i + \": page \" + this.mItems.get(i).position);\n                }\n            }\n\n            this.mAdapter.setPrimaryItem(this, this.mCurItem, curItem != null ? curItem.object : null);\n\n            this.mAdapter.finishUpdate(this);\n\n            // Check width measurement of current pages and drawing sort order.\n            // Update LayoutParams as needed.\n            const childCount = this.getChildCount();\n            for (let i = 0; i < childCount; i++) {\n                const child = this.getChildAt(i);\n                const lp = <ViewPager.LayoutParams>child.getLayoutParams();\n                lp.childIndex = i;\n                if (!lp.isDecor && lp.widthFactor == 0) {\n                    // 0 means requery the adapter for this, it doesn't have a valid width.\n                    const ii = this.infoForChild(child);\n                    if (ii != null) {\n                        lp.widthFactor = ii.widthFactor;\n                        lp.position = ii.position;\n                    }\n                }\n            }\n            this.sortChildDrawingOrder();\n\n            if (this.hasFocus()) {\n                let currentFocused = this.findFocus();\n                let ii = currentFocused != null ? this.infoForAnyChild(currentFocused) : null;\n                if (ii == null || ii.position != this.mCurItem) {\n                    for (let i=0; i<this.getChildCount(); i++) {\n                        let child = this.getChildAt(i);\n                        ii = this.infoForChild(child);\n                        if (ii != null && ii.position == this.mCurItem) {\n                            if (child.requestFocus(focusDirection)) {\n                                break;\n                            }\n                        }\n                    }\n                }\n            }\n        }\n\n        private sortChildDrawingOrder() {\n            if (this.mDrawingOrder != ViewPager.DRAW_ORDER_DEFAULT) {\n                if (this.mDrawingOrderedChildren == null) {\n                    this.mDrawingOrderedChildren = new ArrayList<View>();\n                } else {\n                    this.mDrawingOrderedChildren.clear();\n                }\n                const childCount = this.getChildCount();\n                for (let i = 0; i < childCount; i++) {\n                    const child = this.getChildAt(i);\n                    this.mDrawingOrderedChildren.add(child);\n                }\n                this.mDrawingOrderedChildren.sort(ViewPager.sPositionComparator);\n                //Collections.sort(mDrawingOrderedChildren, sPositionComparator);\n            }\n        }\n\n        private calculatePageOffsets(curItem:ItemInfo, curIndex:number, oldCurInfo:ItemInfo) {\n            const N = this.mAdapter.getCount();\n            const width = this.getClientWidth();\n            const marginOffset = width > 0 ? this.mPageMargin / width : 0;\n            // Fix up offsets for later layout.\n            if (oldCurInfo != null) {\n                const oldCurPosition = oldCurInfo.position;\n                // Base offsets off of oldCurInfo.\n                if (oldCurPosition < curItem.position) {\n                    let itemIndex = 0;\n                    let ii:ItemInfo = null;\n                    let offset = oldCurInfo.offset + oldCurInfo.widthFactor + marginOffset;\n                    for (let pos = oldCurPosition + 1; pos <= curItem.position && itemIndex < this.mItems.size(); pos++) {\n                        ii = this.mItems.get(itemIndex);\n                        while (pos > ii.position && itemIndex < this.mItems.size() - 1) {\n                            itemIndex++;\n                            ii = this.mItems.get(itemIndex);\n                        }\n                        while (pos < ii.position) {\n                            // We don't have an item populated for this,\n                            // ask the adapter for an offset.\n                            offset += this.mAdapter.getPageWidth(pos) + marginOffset;\n                            pos++;\n                        }\n                        ii.offset = offset;\n                        offset += ii.widthFactor + marginOffset;\n                    }\n                } else if (oldCurPosition > curItem.position) {\n                    let itemIndex = this.mItems.size() - 1;\n                    let ii:ItemInfo = null;\n                    let offset = oldCurInfo.offset;\n                    for (let pos = oldCurPosition - 1; pos >= curItem.position && itemIndex >= 0; pos--) {\n                        ii = this.mItems.get(itemIndex);\n                        while (pos < ii.position && itemIndex > 0) {\n                            itemIndex--;\n                            ii = this.mItems.get(itemIndex);\n                        }\n                        while (pos > ii.position) {\n                            // We don't have an item populated for this,\n                            // ask the adapter for an offset.\n                            offset -= this.mAdapter.getPageWidth(pos) + marginOffset;\n                            pos--;\n                        }\n                        offset -= ii.widthFactor + marginOffset;\n                        ii.offset = offset;\n                    }\n                }\n            }\n\n            // Base all offsets off of curItem.\n            const itemCount = this.mItems.size();\n            let offset = curItem.offset;\n            let pos = curItem.position - 1;\n            this.mFirstOffset = curItem.position == 0 ? curItem.offset : -Number.MAX_VALUE;\n            this.mLastOffset = curItem.position == N - 1 ?\n            curItem.offset + curItem.widthFactor - 1 : Number.MAX_VALUE;\n            // Previous pages\n            for (let i = curIndex - 1; i >= 0; i--, pos--) {\n                const ii = this.mItems.get(i);\n                while (pos > ii.position) {\n                    offset -= this.mAdapter.getPageWidth(pos--) + marginOffset;\n                }\n                offset -= ii.widthFactor + marginOffset;\n                ii.offset = offset;\n                if (ii.position == 0) this.mFirstOffset = offset;\n            }\n            offset = curItem.offset + curItem.widthFactor + marginOffset;\n            pos = curItem.position + 1;\n            // Next pages\n            for (let i = curIndex + 1; i < itemCount; i++, pos++) {\n                const ii = this.mItems.get(i);\n                while (pos < ii.position) {\n                    offset += this.mAdapter.getPageWidth(pos++) + marginOffset;\n                }\n                if (ii.position == N - 1) {\n                    this.mLastOffset = offset + ii.widthFactor - 1;\n                }\n                ii.offset = offset;\n                offset += ii.widthFactor + marginOffset;\n            }\n\n            this.mNeedCalculatePageOffsets = false;\n        }\n\n        addView(view: View): any;\n        addView(view: View, index: number): any;\n        addView(view: View, params: ViewGroup.LayoutParams): any;\n        addView(view: View, index: number, params: ViewGroup.LayoutParams): any;\n        addView(view: View, width: number, height: number): any;\n        addView(...args: any[]){\n            if(args.length===3 && args[2] instanceof ViewGroup.LayoutParams){\n                this._addViewOverride(args[0], args[1], args[2]);\n            }else{\n                super.addView(...args);\n            }\n        }\n        private _addViewOverride(child: View, index: number, params: ViewGroup.LayoutParams): any{\n            if (!this.checkLayoutParams(params)) {\n                params = this.generateLayoutParams(params);\n            }\n            const lp = <ViewPager.LayoutParams>params;\n            lp.isDecor = lp.isDecor || ViewPager.isImplDecor(child);\n            if (this.mInLayout) {\n                if (lp != null && lp.isDecor) {\n                    throw new Error(\"Cannot add pager decor view during layout\");\n                }\n                lp.needsMeasure = true;\n                this.addViewInLayout(child, index, params);\n            } else {\n                super.addView(child, index, params);\n            }\n\n            if (ViewPager.USE_CACHE) {\n                if (child.getVisibility() != View.GONE) {\n                    child.setDrawingCacheEnabled(this.mScrollingCacheEnabled);\n                } else {\n                    child.setDrawingCacheEnabled(false);\n                }\n            }\n        }\n\n        removeView(view:android.view.View):void {\n            if (this.mInLayout) {\n                this.removeViewInLayout(view);\n            } else {\n                super.removeView(view);\n            }\n        }\n\n        private infoForChild(child:View):ItemInfo {\n            for (let i=0; i<this.mItems.size(); i++) {\n                let ii = this.mItems.get(i);\n                if (this.mAdapter.isViewFromObject(child, ii.object)) {\n                    return ii;\n                }\n            }\n            return null;\n        }\n\n        private infoForAnyChild(child:View):ItemInfo {\n            let parent;\n            while ((parent=child.getParent()) != this) {\n                if (parent == null || !(parent instanceof View)) {\n                    return null;\n                }\n                child = <View>parent;\n            }\n            return this.infoForChild(child);\n        }\n\n        private infoForPosition(position:number):ItemInfo {\n            for (let i = 0; i < this.mItems.size(); i++) {\n                let ii = this.mItems.get(i);\n                if (ii.position == position) {\n                    return ii;\n                }\n            }\n            return null;\n        }\n\n        protected onAttachedToWindow():void {\n            super.onAttachedToWindow();\n            this.mFirstLayout = true;\n        }\n\n        protected onMeasure(widthMeasureSpec, heightMeasureSpec):void {\n            // For simple implementation, our internal size is always 0.\n            // We depend on the container to specify the layout size of\n            // our view.  We can't really know what it is since we will be\n            // adding and removing different arbitrary views and do not\n            // want the layout to change as this happens.\n            this.setMeasuredDimension(ViewPager.getDefaultSize(0, widthMeasureSpec),\n                ViewPager.getDefaultSize(0, heightMeasureSpec));\n\n            const measuredWidth = this.getMeasuredWidth();\n            const maxGutterSize = measuredWidth / 10;\n            this.mGutterSize = Math.min(maxGutterSize, this.mDefaultGutterSize);\n\n            // Children are just made to fill our space.\n            let childWidthSize = measuredWidth - this.getPaddingLeft() - this.getPaddingRight();\n            let childHeightSize = this.getMeasuredHeight() - this.getPaddingTop() - this.getPaddingBottom();\n\n            /*\n             * Make sure all children have been properly measured. Decor views first.\n             * Right now we cheat and make this less complicated by assuming decor\n             * views won't intersect. We will pin to edges based on gravity.\n             */\n            let size = this.getChildCount();\n            for (let i = 0; i < size; ++i) {\n                const child = this.getChildAt(i);\n                if (child.getVisibility() != View.GONE) {\n                    const lp = <ViewPager.LayoutParams>child.getLayoutParams();\n                    if (lp != null && lp.isDecor) {\n                        const hgrav = lp.gravity & Gravity.HORIZONTAL_GRAVITY_MASK;\n                        const vgrav = lp.gravity & Gravity.VERTICAL_GRAVITY_MASK;\n                        let widthMode = MeasureSpec.AT_MOST;\n                        let heightMode = MeasureSpec.AT_MOST;\n                        let consumeVertical = vgrav == Gravity.TOP || vgrav == Gravity.BOTTOM;\n                        let consumeHorizontal = hgrav == Gravity.LEFT || hgrav == Gravity.RIGHT;\n\n                        if (consumeVertical) {\n                            widthMode = MeasureSpec.EXACTLY;\n                        } else if (consumeHorizontal) {\n                            heightMode = MeasureSpec.EXACTLY;\n                        }\n\n                        let widthSize = childWidthSize;\n                        let heightSize = childHeightSize;\n                        if (lp.width != ViewPager.LayoutParams.WRAP_CONTENT) {\n                            widthMode = MeasureSpec.EXACTLY;\n                            if (lp.width != ViewPager.LayoutParams.FILL_PARENT) {\n                                widthSize = lp.width;\n                            }\n                        }\n                        if (lp.height != ViewPager.LayoutParams.WRAP_CONTENT) {\n                            heightMode = MeasureSpec.EXACTLY;\n                            if (lp.height != ViewPager.LayoutParams.FILL_PARENT) {\n                                heightSize = lp.height;\n                            }\n                        }\n                        const widthSpec = MeasureSpec.makeMeasureSpec(widthSize, widthMode);\n                        const heightSpec = MeasureSpec.makeMeasureSpec(heightSize, heightMode);\n                        child.measure(widthSpec, heightSpec);\n\n                        if (consumeVertical) {\n                            childHeightSize -= child.getMeasuredHeight();\n                        } else if (consumeHorizontal) {\n                            childWidthSize -= child.getMeasuredWidth();\n                        }\n                    }\n                }\n            }\n\n            this.mChildWidthMeasureSpec = MeasureSpec.makeMeasureSpec(childWidthSize, MeasureSpec.EXACTLY);\n            this.mChildHeightMeasureSpec = MeasureSpec.makeMeasureSpec(childHeightSize, MeasureSpec.EXACTLY);\n\n            // Make sure we have created all fragments that we need to have shown.\n            this.mInLayout = true;\n            this.populate();\n            this.mInLayout = false;\n\n            // Page views next.\n            size = this.getChildCount();\n            for (let i = 0; i < size; ++i) {\n                const child = this.getChildAt(i);\n                if (child.getVisibility() != View.GONE) {\n                    if (DEBUG) Log.v(TAG, \"Measuring #\" + i + \" \" + child\n                        + \": \" + this.mChildWidthMeasureSpec);\n\n                    const lp = <ViewPager.LayoutParams>child.getLayoutParams();\n                    if (lp == null || !lp.isDecor) {\n                        const widthSpec = MeasureSpec.makeMeasureSpec((childWidthSize * lp.widthFactor), MeasureSpec.EXACTLY);\n                        child.measure(widthSpec, this.mChildHeightMeasureSpec);\n                    }\n                }\n            }\n        }\n\n        protected onSizeChanged(w:number, h:number, oldw:number, oldh:number):void {\n            super.onSizeChanged(w, h, oldw, oldh);\n            // Make sure scroll position is set correctly.\n            if (w != oldw) {\n                this.recomputeScrollPosition(w, oldw, this.mPageMargin, this.mPageMargin);\n            }\n        }\n\n        private recomputeScrollPosition(width:number, oldWidth:number, margin:number, oldMargin:number):void {\n            if (oldWidth > 0 && !this.mItems.isEmpty()) {\n                const widthWithMargin = width - this.getPaddingLeft() - this.getPaddingRight() + margin;\n                const oldWidthWithMargin = oldWidth - this.getPaddingLeft() - this.getPaddingRight()\n                    + oldMargin;\n                const xpos = this.getScrollX();\n                const pageOffset = xpos / oldWidthWithMargin;\n                const newOffsetPixels = Math.floor(pageOffset * widthWithMargin);\n\n                this.scrollTo(newOffsetPixels, this.getScrollY());\n                if (!this.mScroller.isFinished()) {\n                    // We now return to your regularly scheduled scroll, already in progress.\n                    const newDuration = this.mScroller.getDuration() - this.mScroller.timePassed();\n                    let targetInfo = this.infoForPosition(this.mCurItem);\n                    this.mScroller.startScroll(newOffsetPixels, 0, Math.floor(targetInfo.offset * width), 0, newDuration);\n                }\n            } else {\n                const ii = this.infoForPosition(this.mCurItem);\n                const scrollOffset = ii != null ? Math.min(ii.offset, this.mLastOffset) : 0;\n                const scrollPos = Math.floor(scrollOffset *\n                    (width - this.getPaddingLeft() - this.getPaddingRight()));\n                if (scrollPos != this.getScrollX()) {\n                    this.completeScroll(false);\n                    this.scrollTo(scrollPos, this.getScrollY());\n                }\n            }\n        }\n\n        protected onLayout(changed:boolean, l:number, t:number, r:number, b:number):void {\n            const count = this.getChildCount();\n            let width = r - l;\n            let height = b - t;\n            let paddingLeft = this.getPaddingLeft();\n            let paddingTop = this.getPaddingTop();\n            let paddingRight = this.getPaddingRight();\n            let paddingBottom = this.getPaddingBottom();\n            const scrollX = this.getScrollX();\n\n            let decorCount = 0;\n\n            // First pass - decor views. We need to do this in two passes so that\n            // we have the proper offsets for non-decor views later.\n            for (let i = 0; i < count; i++) {\n                const child = this.getChildAt(i);\n                if (child.getVisibility() != View.GONE) {\n                    const lp = <ViewPager.LayoutParams>child.getLayoutParams();\n                    let childLeft = 0;\n                    let childTop = 0;\n                    if (lp.isDecor) {\n                        const hgrav = lp.gravity & Gravity.HORIZONTAL_GRAVITY_MASK;\n                        const vgrav = lp.gravity & Gravity.VERTICAL_GRAVITY_MASK;\n                        switch (hgrav) {\n                            default:\n                                childLeft = paddingLeft;\n                                break;\n                            case Gravity.LEFT:\n                                childLeft = paddingLeft;\n                                paddingLeft += child.getMeasuredWidth();\n                                break;\n                            case Gravity.CENTER_HORIZONTAL:\n                                childLeft = Math.max((width - child.getMeasuredWidth()) / 2,\n                                    paddingLeft);\n                                break;\n                            case Gravity.RIGHT:\n                                childLeft = width - paddingRight - child.getMeasuredWidth();\n                                paddingRight += child.getMeasuredWidth();\n                                break;\n                        }\n                        switch (vgrav) {\n                            default:\n                                childTop = paddingTop;\n                                break;\n                            case Gravity.TOP:\n                                childTop = paddingTop;\n                                paddingTop += child.getMeasuredHeight();\n                                break;\n                            case Gravity.CENTER_VERTICAL:\n                                childTop = Math.max((height - child.getMeasuredHeight()) / 2,\n                                    paddingTop);\n                                break;\n                            case Gravity.BOTTOM:\n                                childTop = height - paddingBottom - child.getMeasuredHeight();\n                                paddingBottom += child.getMeasuredHeight();\n                                break;\n                        }\n                        childLeft += scrollX;\n                        child.layout(childLeft, childTop,\n                            childLeft + child.getMeasuredWidth(),\n                            childTop + child.getMeasuredHeight());\n                        decorCount++;\n                    }\n                }\n            }\n\n            const childWidth = width - paddingLeft - paddingRight;\n            // Page views. Do this once we have the right padding offsets from above.\n            for (let i = 0; i < count; i++) {\n                const child = this.getChildAt(i);\n                if (child.getVisibility() != View.GONE) {\n                    const lp = <ViewPager.LayoutParams>child.getLayoutParams();\n                    let ii;\n                    if (!lp.isDecor && (ii = this.infoForChild(child)) != null) {\n                        let loff = Math.floor(childWidth * ii.offset);\n                        let childLeft = paddingLeft + loff;\n                        let childTop = paddingTop;\n                        if (lp.needsMeasure) {\n                            // This was added during layout and needs measurement.\n                            // Do it now that we know what we're working with.\n                            lp.needsMeasure = false;\n                            const widthSpec = MeasureSpec.makeMeasureSpec(\n                                Math.floor(childWidth * lp.widthFactor),\n                                MeasureSpec.EXACTLY);\n                            const heightSpec = MeasureSpec.makeMeasureSpec(\n                                Math.floor(height - paddingTop - paddingBottom),\n                                MeasureSpec.EXACTLY);\n                            child.measure(widthSpec, heightSpec);\n                        }\n                        if (DEBUG) Log.v(TAG, \"Positioning #\" + i + \" \" + child + \" f=\" + ii.object\n                            + \":\" + childLeft + \",\" + childTop + \" \" + child.getMeasuredWidth()\n                            + \"x\" + child.getMeasuredHeight());\n                        child.layout(childLeft, childTop,\n                            childLeft + child.getMeasuredWidth(),\n                            childTop + child.getMeasuredHeight());\n                    }\n                }\n            }\n            this.mTopPageBounds = paddingTop;\n            this.mBottomPageBounds = height - paddingBottom;\n            this.mDecorChildCount = decorCount;\n\n            if (this.mFirstLayout) {\n                this.scrollToItem(this.mCurItem, false, 0, false);\n            }\n            this.mFirstLayout = false;\n        }\n\n        computeScroll() {\n            if (!this.mScroller.isFinished() && this.mScroller.computeScrollOffset()) {\n                let oldX = this.getScrollX();\n                let oldY = this.getScrollY();\n                let x = this.mScroller.getCurrX();\n                let y = this.mScroller.getCurrY();\n\n                if (oldX != x || oldY != y) {\n                    this.scrollTo(x, y);\n                    if (!this.pageScrolled(x)) {\n                        this.mScroller.abortAnimation();\n                        this.scrollTo(0, y);\n                    }\n                }\n\n                // Keep on drawing until the animation has finished.\n                this.postInvalidateOnAnimation();\n                return;\n            }\n\n            // Done with scroll, clean up state.\n            this.completeScroll(true);\n        }\n\n        private pageScrolled(xpos:number):boolean {\n            if (this.mItems.size() == 0) {\n                this.mCalledSuper = false;\n                this.onPageScrolled(0, 0, 0);\n                if (!this.mCalledSuper) {\n                    throw new Error(\n                        \"onPageScrolled did not call superclass implementation\");\n                }\n                return false;\n            }\n            const ii = this.infoForCurrentScrollPosition();\n            const width = this.getClientWidth();\n            const widthWithMargin = width + this.mPageMargin;\n            const marginOffset = this.mPageMargin / width;\n            const currentPage = ii.position;\n            const pageOffset = ((xpos / width) - ii.offset) / (ii.widthFactor + marginOffset);\n            const offsetPixels = Math.floor(pageOffset * widthWithMargin);\n\n            this.mCalledSuper = false;\n            this.onPageScrolled(currentPage, pageOffset, offsetPixels);\n            if (!this.mCalledSuper) {\n                throw new Error(\n                    \"onPageScrolled did not call superclass implementation\");\n            }\n            return true;\n        }\n\n\n        /**\n         * This method will be invoked when the current page is scrolled, either as part\n         * of a programmatically initiated smooth scroll or a user initiated touch scroll.\n         * If you override this method you must call through to the superclass implementation\n         * (e.g. super.onPageScrolled(position, offset, offsetPixels)) before onPageScrolled\n         * returns.\n         *\n         * @param position Position index of the first page currently being displayed.\n         *                 Page position+1 will be visible if positionOffset is nonzero.\n         * @param offset Value from [0, 1) indicating the offset from the page at position.\n         * @param offsetPixels Value in pixels indicating the offset from position.\n         */\n        onPageScrolled(position:number, offset:number, offsetPixels:number):void {\n            // Offset any decor views if needed - keep them on-screen at all times.\n            if (this.mDecorChildCount > 0) {\n                const scrollX = this.getScrollX();\n                let paddingLeft = this.getPaddingLeft();\n                let paddingRight = this.getPaddingRight();\n                const width = this.getWidth();\n                const childCount = this.getChildCount();\n                for (let i = 0; i < childCount; i++) {\n                    const child = this.getChildAt(i);\n                    const lp = <ViewPager.LayoutParams>child.getLayoutParams();\n                    if (!lp.isDecor) continue;\n\n                    const hgrav = lp.gravity & Gravity.HORIZONTAL_GRAVITY_MASK;\n                    let childLeft = 0;\n                    switch (hgrav) {\n                        default:\n                            childLeft = paddingLeft;\n                            break;\n                        case Gravity.LEFT:\n                            childLeft = paddingLeft;\n                            paddingLeft += child.getWidth();\n                            break;\n                        case Gravity.CENTER_HORIZONTAL:\n                            childLeft = Math.max((width - child.getMeasuredWidth()) / 2,\n                                paddingLeft);\n                            break;\n                        case Gravity.RIGHT:\n                            childLeft = width - paddingRight - child.getMeasuredWidth();\n                            paddingRight += child.getMeasuredWidth();\n                            break;\n                    }\n                    childLeft += scrollX;\n\n                    const childOffset = childLeft - child.getLeft();\n                    if (childOffset != 0) {\n                        child.offsetLeftAndRight(childOffset);\n                    }\n                }\n            }\n\n            this.dispatchOnPageScrolled(position, offset, offsetPixels);\n\n            if (this.mPageTransformer != null) {\n                const scrollX = this.getScrollX();\n                const childCount = this.getChildCount();\n                for (let i = 0; i < childCount; i++) {\n                    const child = this.getChildAt(i);\n                    const lp = <ViewPager.LayoutParams>child.getLayoutParams();\n\n                    if (lp.isDecor) continue;\n\n                    const transformPos = (child.getLeft() - scrollX) / this.getClientWidth();\n                    this.mPageTransformer.transformPage(child, transformPos);\n                }\n            }\n\n            this.mCalledSuper = true;\n        }\n\n        private dispatchOnPageScrolled(position:number, offset:number, offsetPixels:number) {\n            if (this.mOnPageChangeListener != null) {\n                this.mOnPageChangeListener.onPageScrolled(position, offset, offsetPixels);\n            }\n            if (this.mOnPageChangeListeners != null) {\n                for (let i = 0, z = this.mOnPageChangeListeners.size(); i < z; i++) {\n                    let listener = this.mOnPageChangeListeners.get(i);\n                    if (listener != null) {\n                        listener.onPageScrolled(position, offset, offsetPixels);\n                    }\n                }\n            }\n            if (this.mInternalPageChangeListener != null) {\n                this.mInternalPageChangeListener.onPageScrolled(position, offset, offsetPixels);\n            }\n        }\n\n        private dispatchOnPageSelected(position:number):void {\n            if (this.mOnPageChangeListener != null) {\n                this.mOnPageChangeListener.onPageSelected(position);\n            }\n            if (this.mOnPageChangeListeners != null) {\n                for (let i = 0, z = this.mOnPageChangeListeners.size(); i < z; i++) {\n                    let listener = this.mOnPageChangeListeners.get(i);\n                    if (listener != null) {\n                        listener.onPageSelected(position);\n                    }\n                }\n            }\n            if (this.mInternalPageChangeListener != null) {\n                this.mInternalPageChangeListener.onPageSelected(position);\n            }\n        }\n\n        private dispatchOnScrollStateChanged(state:number):void {\n            if (this.mOnPageChangeListener != null) {\n                this.mOnPageChangeListener.onPageScrollStateChanged(state);\n            }\n            if (this.mOnPageChangeListeners != null) {\n                for (let i = 0, z = this.mOnPageChangeListeners.size(); i < z; i++) {\n                    let listener = this.mOnPageChangeListeners.get(i);\n                    if (listener != null) {\n                        listener.onPageScrollStateChanged(state);\n                    }\n                }\n            }\n            if (this.mInternalPageChangeListener != null) {\n                this.mInternalPageChangeListener.onPageScrollStateChanged(state);\n            }\n        }\n\n        private completeScroll(postEvents:boolean) {\n            let needPopulate = this.mScrollState == ViewPager.SCROLL_STATE_SETTLING;\n            if (needPopulate) {\n                // Done with scroll, no longer want to cache view drawing.\n                this.setScrollingCacheEnabled(false);\n                this.mScroller.abortAnimation();\n                let oldX = this.getScrollX();\n                let oldY = this.getScrollY();\n                let x = this.mScroller.getCurrX();\n                let y = this.mScroller.getCurrY();\n                if (oldX != x || oldY != y) {\n                    this.scrollTo(x, y);\n                    if (x != oldX) {\n                        this.pageScrolled(x);\n                    }\n                }\n            }\n            this.mPopulatePending = false;\n            for (let i=0; i<this.mItems.size(); i++) {\n                let ii = this.mItems.get(i);\n                if (ii.scrolling) {\n                    needPopulate = true;\n                    ii.scrolling = false;\n                }\n            }\n            if (needPopulate) {\n                if (postEvents) {\n                    this.postOnAnimation(this.mEndScrollRunnable);\n                } else {\n                    this.mEndScrollRunnable.run();\n                }\n            }\n        }\n\n        private isGutterDrag(x:number, dx:number):boolean {\n            return (x < this.mGutterSize && dx > 0) || (x > this.getWidth() - this.mGutterSize && dx < 0);\n        }\n\n        private enableLayers(enable:boolean) {\n            //nothing\n            //const childCount = this.getChildCount();\n            //for (let i = 0; i < childCount; i++) {\n            //    const layerType = enable ?\n            //        View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE;\n            //    this.getChildAt(i).setLayerType(layerType, null);\n            //}\n        }\n\n        onInterceptTouchEvent(ev:MotionEvent):boolean {\n            /*\n             * This method JUST determines whether we want to intercept the motion.\n             * If we return true, onMotionEvent will be called and we do the actual\n             * scrolling there.\n             */\n\n            const action = ev.getAction() & MotionEvent.ACTION_MASK;\n\n            // Always take care of the touch gesture being complete.\n            if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP) {\n                // Release the drag.\n                if (DEBUG) Log.v(TAG, \"Intercept done!\");\n                this.resetTouch();\n                return false;\n            }\n\n            // Nothing more to do here if we have decided whether or not we\n            // are dragging.\n            if (action != MotionEvent.ACTION_DOWN) {\n                if (this.mIsBeingDragged) {\n                    if (DEBUG) Log.v(TAG, \"Intercept returning true!\");\n                    return true;\n                }\n                if (this.mIsUnableToDrag) {\n                    if (DEBUG) Log.v(TAG, \"Intercept returning false!\");\n                    return false;\n                }\n            }\n\n            switch (action) {\n                case MotionEvent.ACTION_MOVE: {\n                    /*\n                     * mIsBeingDragged == false, otherwise the shortcut would have caught it. Check\n                     * whether the user has moved far enough from his original down touch.\n                     */\n\n                    /*\n                     * Locally do absolute value. mLastMotionY is set to the y value\n                     * of the down event.\n                     */\n                    const activePointerId = this.mActivePointerId;\n                    if (activePointerId == ViewPager.INVALID_POINTER) {\n                        // If we don't have a valid id, the touch down wasn't on content.\n                        break;\n                    }\n\n                    const pointerIndex = ev.findPointerIndex(activePointerId);\n                    const x = ev.getX(pointerIndex);\n                    const dx = x - this.mLastMotionX;\n                    const xDiff = Math.abs(dx);\n                    const y = ev.getY(pointerIndex);\n                    const yDiff = Math.abs(y - this.mInitialMotionY);\n                    if (DEBUG) Log.v(TAG, \"Moved x to \" + x + \",\" + y + \" diff=\" + xDiff + \",\" + yDiff);\n\n                    if (dx != 0 && !this.isGutterDrag(this.mLastMotionX, dx) &&\n                        this.canScroll(this, false, Math.floor(dx), Math.floor(x), Math.floor(y))) {\n                        // Nested view has scrollable area under this point. Let it be handled there.\n                        this.mLastMotionX = x;\n                        this.mLastMotionY = y;\n                        this.mIsUnableToDrag = true;\n                        return false;\n                    }\n                    if (xDiff > this.mTouchSlop && xDiff * 0.5 > yDiff) {\n                        if (DEBUG) Log.v(TAG, \"Starting drag!\");\n                        this.mIsBeingDragged = true;\n                        this.requestParentDisallowInterceptTouchEvent(true);\n                        this.setScrollState(ViewPager.SCROLL_STATE_DRAGGING);\n                        this.mLastMotionX = dx > 0 ? this.mInitialMotionX + this.mTouchSlop :\n                        this.mInitialMotionX - this.mTouchSlop;\n                        this.mLastMotionY = y;\n                        this.setScrollingCacheEnabled(true);\n                    } else if (yDiff > this.mTouchSlop) {\n                        // The finger has moved enough in the vertical\n                        // direction to be counted as a drag...  abort\n                        // any attempt to drag horizontally, to work correctly\n                        // with children that have scrolling containers.\n                        if (DEBUG) Log.v(TAG, \"Starting unable to drag!\");\n                        this.mIsUnableToDrag = true;\n                    }\n                    if (this.mIsBeingDragged) {\n                        // Scroll to follow the motion event\n                        if (this.performDrag(x)) {\n                            this.postInvalidateOnAnimation();\n                        }\n                    }\n                    break;\n                }\n\n                case MotionEvent.ACTION_DOWN: {\n                    /*\n                     * Remember location of down touch.\n                     * ACTION_DOWN always refers to pointer index 0.\n                     */\n                    this.mLastMotionX = this.mInitialMotionX = ev.getX();\n                    this.mLastMotionY = this.mInitialMotionY = ev.getY();\n                    this.mActivePointerId = ev.getPointerId(0);\n                    this.mIsUnableToDrag = false;\n\n                    this.mScroller.computeScrollOffset();\n\n                    if (this.mScrollState == ViewPager.SCROLL_STATE_SETTLING &&\n                        Math.abs(this.mScroller.getFinalX() - this.mScroller.getCurrX()) > this.mCloseEnough) {\n                        // Let the user 'catch' the pager as it animates.\n                        this.mScroller.abortAnimation();\n                        this.mPopulatePending = false;\n                        this.populate();\n                        this.mIsBeingDragged = true;\n                        this.requestParentDisallowInterceptTouchEvent(true);\n                        this.setScrollState(ViewPager.SCROLL_STATE_DRAGGING);\n                    } else {\n                        this.completeScroll(false);\n                        this.mIsBeingDragged = false;\n                    }\n\n                    if (DEBUG) Log.v(TAG, \"Down at \" + this.mLastMotionX + \",\" + this.mLastMotionY\n                        + \" mIsBeingDragged=\" + this.mIsBeingDragged\n                        + \"mIsUnableToDrag=\" + this.mIsUnableToDrag);\n                    break;\n                }\n\n                case MotionEvent.ACTION_POINTER_UP:\n                    this.onSecondaryPointerUp(ev);\n                    break;\n            }\n\n            if (this.mVelocityTracker == null) {\n                this.mVelocityTracker = VelocityTracker.obtain();\n            }\n            this.mVelocityTracker.addMovement(ev);\n\n            /*\n             * The only time we want to intercept motion events is if we are in the\n             * drag mode.\n             */\n            return this.mIsBeingDragged;\n        }\n\n\n        onTouchEvent(ev:android.view.MotionEvent):boolean {\n            if (this.mFakeDragging) {\n                // A fake drag is in progress already, ignore this real one\n                // but still eat the touch events.\n                // (It is likely that the user is multi-touching the screen.)\n                return true;\n            }\n\n            if (ev.getAction() == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0) {\n                // Don't handle edge touches immediately -- they may actually belong to one of our\n                // descendants.\n                return false;\n            }\n\n            if (this.mAdapter == null || this.mAdapter.getCount() == 0) {\n                // Nothing to present or scroll; nothing to touch.\n                return false;\n            }\n\n            if (this.mVelocityTracker == null) {\n                this.mVelocityTracker = VelocityTracker.obtain();\n            }\n            this.mVelocityTracker.addMovement(ev);\n\n            const action = ev.getAction();\n            let needsInvalidate = false;\n\n            switch (action & MotionEvent.ACTION_MASK) {\n                case MotionEvent.ACTION_DOWN: {\n                    this.mScroller.abortAnimation();\n                    this.mPopulatePending = false;\n                    this.populate();\n\n                    // Remember where the motion event started\n                    this.mLastMotionX = this.mInitialMotionX = ev.getX();\n                    this.mLastMotionY = this.mInitialMotionY = ev.getY();\n                    this.mActivePointerId = ev.getPointerId(0);\n                    break;\n                }\n                case MotionEvent.ACTION_MOVE:\n                    if (!this.mIsBeingDragged) {\n                        const pointerIndex = ev.findPointerIndex(this.mActivePointerId);\n                        if (pointerIndex == -1) {\n                            // A child has consumed some touch events and put us into an inconsistent state.\n                            needsInvalidate = this.resetTouch();\n                            break;\n                        }\n                        const x = ev.getX(pointerIndex);\n                        const xDiff = Math.abs(x - this.mLastMotionX);\n                        const y = ev.getY(pointerIndex);\n                        const yDiff = Math.abs(y - this.mLastMotionY);\n                        if (DEBUG) Log.v(TAG, \"Moved x to \" + x + \",\" + y + \" diff=\" + xDiff + \",\" + yDiff);\n                        if (xDiff > this.mTouchSlop && xDiff > yDiff) {\n                            if (DEBUG) Log.v(TAG, \"Starting drag!\");\n                            this.mIsBeingDragged = true;\n                            this.requestParentDisallowInterceptTouchEvent(true);\n                            this.mLastMotionX = x - this.mInitialMotionX > 0 ? this.mInitialMotionX + this.mTouchSlop :\n                            this.mInitialMotionX - this.mTouchSlop;\n                            this.mLastMotionY = y;\n                            this.setScrollState(ViewPager.SCROLL_STATE_DRAGGING);\n                            this.setScrollingCacheEnabled(true);\n\n                            // Disallow Parent Intercept, just in case\n                            let parent = this.getParent();\n                            if (parent != null) {\n                                parent.requestDisallowInterceptTouchEvent(true);\n                            }\n                        }\n                    }\n                    // Not else! Note that mIsBeingDragged can be set above.\n                    if (this.mIsBeingDragged) {\n                        // Scroll to follow the motion event\n                        const activePointerIndex = ev.findPointerIndex(this.mActivePointerId);\n                        const x = ev.getX(activePointerIndex);\n                        needsInvalidate = needsInvalidate || this.performDrag(x);\n                    }\n                    break;\n                case MotionEvent.ACTION_UP:\n                    if (this.mIsBeingDragged) {\n                        const velocityTracker = this.mVelocityTracker;\n                        velocityTracker.computeCurrentVelocity(1000, this.mMaximumVelocity);\n                        let initialVelocity = velocityTracker.getXVelocity(this.mActivePointerId);\n                        this.mPopulatePending = true;\n                        const width = this.getClientWidth();\n                        const scrollX = this.getScrollX();\n                        const ii = this.infoForCurrentScrollPosition();\n                        const currentPage = ii.position;\n                        const pageOffset = ((scrollX / width) - ii.offset) / ii.widthFactor;\n                        const activePointerIndex = ev.findPointerIndex(this.mActivePointerId);\n                        const x = ev.getX(activePointerIndex);\n                        const totalDelta = (x - this.mInitialMotionX);\n                        let nextPage = this.determineTargetPage(currentPage, pageOffset, initialVelocity,\n                            totalDelta);\n                        this.setCurrentItemInternal(nextPage, true, true, initialVelocity);\n\n                        needsInvalidate = this.resetTouch();\n                    }\n                    break;\n                case MotionEvent.ACTION_CANCEL:\n                    if (this.mIsBeingDragged) {\n                        this.scrollToItem(this.mCurItem, true, 0, false);\n                        needsInvalidate = this.resetTouch();\n                    }\n                    break;\n                case MotionEvent.ACTION_POINTER_DOWN: {\n                    const index = ev.getActionIndex();\n                    const x = ev.getX(index);\n                    this.mLastMotionX = x;\n                    this.mActivePointerId = ev.getPointerId(index);\n                    break;\n                }\n                case MotionEvent.ACTION_POINTER_UP:\n                    this.onSecondaryPointerUp(ev);\n                    this.mLastMotionX = ev.getX(ev.findPointerIndex(this.mActivePointerId));\n                    break;\n            }\n            if (needsInvalidate) {\n                this.postInvalidateOnAnimation();\n            }\n            return true;\n        }\n        private resetTouch():boolean {\n            let needsInvalidate = false;\n            this.mActivePointerId = ViewPager.INVALID_POINTER;\n            this.endDrag();\n            //needsInvalidate = mLeftEdge.onRelease() | mRightEdge.onRelease();\n            return needsInvalidate;\n        }\n        private requestParentDisallowInterceptTouchEvent(disallowIntercept:boolean){\n            const parent = this.getParent();\n            if (parent != null) {\n                parent.requestDisallowInterceptTouchEvent(disallowIntercept);\n            }\n        }\n        private performDrag(x:number):boolean {\n            let needsInvalidate = false;\n\n            const deltaX = this.mLastMotionX - x;\n            this.mLastMotionX = x;\n\n            let oldScrollX = this.getScrollX();\n            let scrollX = oldScrollX + deltaX;\n            const width = this.getClientWidth();\n\n            let leftBound = width * this.mFirstOffset;\n            let rightBound = width * this.mLastOffset;\n            let leftAbsolute = true;\n            let rightAbsolute = true;\n\n            const firstItem = this.mItems.get(0);\n            const lastItem = this.mItems.get(this.mItems.size() - 1);\n            if (firstItem.position != 0) {\n                leftAbsolute = false;\n                leftBound = firstItem.offset * width;\n            }\n            if (lastItem.position != this.mAdapter.getCount() - 1) {\n                rightAbsolute = false;\n                rightBound = lastItem.offset * width;\n            }\n\n            if (scrollX < leftBound) {\n                if (leftAbsolute) {\n                    let over = leftBound - scrollX;\n                    needsInvalidate = false;//this.mLeftEdge.onPull(Math.abs(over) / width);\n                }\n                scrollX -= deltaX/2;//leftBound;\n            } else if (scrollX > rightBound) {\n                if (rightAbsolute) {\n                    let over = scrollX - rightBound;\n                    needsInvalidate = false;//this.mRightEdge.onPull(Math.abs(over) / width);\n                }\n                scrollX -= deltaX/2;//rightBound;\n            }\n            // Don't lose the rounded component\n            this.mLastMotionX += scrollX - Math.floor(scrollX);\n            this.scrollTo(scrollX, this.getScrollY());\n            this.pageScrolled(scrollX);\n\n            return needsInvalidate;\n        }\n\n        private infoForCurrentScrollPosition():ItemInfo {\n            const width = this.getClientWidth();\n            const scrollOffset = width > 0 ? this.getScrollX() / width : 0;\n            const marginOffset = width > 0 ? this.mPageMargin / width : 0;\n            let lastPos = -1;\n            let lastOffset = 0;\n            let lastWidth = 0;\n            let first = true;\n\n            let lastItem = null;\n            for (let i = 0; i < this.mItems.size(); i++) {\n                let ii = this.mItems.get(i);\n                let offset;\n                if (!first && ii.position != lastPos + 1) {\n                    // Create a synthetic item for a missing page.\n                    ii = this.mTempItem;\n                    ii.offset = lastOffset + lastWidth + marginOffset;\n                    ii.position = lastPos + 1;\n                    ii.widthFactor = this.mAdapter.getPageWidth(ii.position);\n                    i--;\n                }\n                offset = ii.offset;\n\n                const leftBound = offset;\n                const rightBound = offset + ii.widthFactor + marginOffset;\n                if (first || scrollOffset >= leftBound) {\n                    if (scrollOffset < rightBound || i == this.mItems.size() - 1) {\n                        return ii;\n                    }\n                } else {\n                    return lastItem;\n                }\n                first = false;\n                lastPos = ii.position;\n                lastOffset = offset;\n                lastWidth = ii.widthFactor;\n                lastItem = ii;\n            }\n\n            return lastItem;\n        }\n\n        private determineTargetPage(currentPage:number, pageOffset:number, velocity:number, deltaX:number):number {\n            let targetPage;\n            if (Math.abs(deltaX) > this.mFlingDistance && Math.abs(velocity) > this.mMinimumVelocity) {\n                targetPage = velocity > 0 ? currentPage : currentPage + 1;\n            } else {\n                const truncator = currentPage >= this.mCurItem ? 0.4 : 0.6;\n                targetPage = Math.floor(currentPage + pageOffset + truncator);\n            }\n\n            if (this.mItems.size() > 0) {\n                const firstItem = this.mItems.get(0);\n                const lastItem = this.mItems.get(this.mItems.size() - 1);\n\n                // Only let the user target pages we have items for\n                targetPage = Math.max(firstItem.position, Math.min(targetPage, lastItem.position));\n            }\n\n            return targetPage;\n        }\n\n\n        draw(canvas:android.graphics.Canvas):void {\n            super.draw(canvas);\n            let needsInvalidate = false;\n\n            //no need draw overscroll Edge\n            //const overScrollMode = this.getOverScrollMode();\n            //if (overScrollMode == View.OVER_SCROLL_ALWAYS ||\n            //    (overScrollMode == View.OVER_SCROLL_IF_CONTENT_SCROLLS &&\n            //    this.mAdapter != null && this.mAdapter.getCount() > 1)) {\n            //    if (!mLeftEdge.isFinished()) {\n            //        const restoreCount = canvas.save();\n            //        const height = getHeight() - getPaddingTop() - getPaddingBottom();\n            //        const width = getWidth();\n            //\n            //        canvas.rotate(270);\n            //        canvas.translate(-height + getPaddingTop(), mFirstOffset * width);\n            //        mLeftEdge.setSize(height, width);\n            //        needsInvalidate |= mLeftEdge.draw(canvas);\n            //        canvas.restoreToCount(restoreCount);\n            //    }\n            //    if (!mRightEdge.isFinished()) {\n            //        const restoreCount = canvas.save();\n            //        const width = getWidth();\n            //        const height = getHeight() - getPaddingTop() - getPaddingBottom();\n            //\n            //        canvas.rotate(90);\n            //        canvas.translate(-getPaddingTop(), -(mLastOffset + 1) * width);\n            //        mRightEdge.setSize(height, width);\n            //        needsInvalidate |= mRightEdge.draw(canvas);\n            //        canvas.restoreToCount(restoreCount);\n            //    }\n            //} else {\n            //    mLeftEdge.finish();\n            //    mRightEdge.finish();\n            //}\n\n            if (needsInvalidate) {\n                // Keep animating\n                this.postInvalidateOnAnimation();\n            }\n        }\n\n\n        protected onDraw(canvas:android.graphics.Canvas) {\n            super.onDraw(canvas);\n\n            // Draw the margin drawable between pages if needed.\n            if (this.mPageMargin > 0 && this.mMarginDrawable != null && this.mItems.size() > 0 && this.mAdapter != null) {\n                const scrollX = this.getScrollX();\n                const width = this.getWidth();\n\n                const marginOffset = this.mPageMargin / width;\n                let itemIndex = 0;\n                let ii = this.mItems.get(0);\n                let offset = ii.offset;\n                const itemCount = this.mItems.size();\n                const firstPos = ii.position;\n                const lastPos = this.mItems.get(itemCount - 1).position;\n                for (let pos = firstPos; pos < lastPos; pos++) {\n                    while (pos > ii.position && itemIndex < itemCount) {\n                        ii = this.mItems.get(++itemIndex);\n                    }\n\n                    let drawAt;\n                    if (pos == ii.position) {\n                        drawAt = (ii.offset + ii.widthFactor) * width;\n                        offset = ii.offset + ii.widthFactor + marginOffset;\n                    } else {\n                        let widthFactor = this.mAdapter.getPageWidth(pos);\n                        drawAt = (offset + widthFactor) * width;\n                        offset += widthFactor + marginOffset;\n                    }\n\n                    if (drawAt + this.mPageMargin > scrollX) {\n                        this.mMarginDrawable.setBounds(drawAt, this.mTopPageBounds,\n                            drawAt + this.mPageMargin, this.mBottomPageBounds);\n                        this.mMarginDrawable.draw(canvas);\n                    }\n\n                    if (drawAt > scrollX + width) {\n                        break; // No more visible, no sense in continuing\n                    }\n                }\n            }\n        }\n\n\n        /**\n         * Start a fake drag of the pager.\n         *\n         * <p>A fake drag can be useful if you want to synchronize the motion of the ViewPager\n         * with the touch scrolling of another view, while still letting the ViewPager\n         * control the snapping motion and fling behavior. (e.g. parallax-scrolling tabs.)\n         * Call {@link #fakeDragBy(float)} to simulate the actual drag motion. Call\n         * {@link #endFakeDrag()} to complete the fake drag and fling as necessary.\n         *\n         * <p>During a fake drag the ViewPager will ignore all touch events. If a real drag\n         * is already in progress, this method will return false.\n         *\n         * @return true if the fake drag began successfully, false if it could not be started.\n         *\n         * @see #fakeDragBy(float)\n         * @see #endFakeDrag()\n         */\n        beginFakeDrag():boolean {\n            if (this.mIsBeingDragged) {\n                return false;\n            }\n            this.mFakeDragging = true;\n            this.setScrollState(ViewPager.SCROLL_STATE_DRAGGING);\n            this.mInitialMotionX = this.mLastMotionX = 0;\n            if (this.mVelocityTracker == null) {\n                this.mVelocityTracker = VelocityTracker.obtain();\n            } else {\n                this.mVelocityTracker.clear();\n            }\n            const time = android.os.SystemClock.uptimeMillis();\n            const ev = MotionEvent.obtainWithAction(time, time, MotionEvent.ACTION_DOWN, 0, 0, 0);\n            this.mVelocityTracker.addMovement(ev);\n            ev.recycle();\n            this.mFakeDragBeginTime = time;\n            return true;\n        }\n\n\n        /**\n         * End a fake drag of the pager.\n         *\n         * @see #beginFakeDrag()\n         * @see #fakeDragBy(float)\n         */\n        endFakeDrag():void {\n            if (!this.mFakeDragging) {\n                throw new Error(\"No fake drag in progress. Call beginFakeDrag first.\");\n            }\n\n            const velocityTracker = this.mVelocityTracker;\n            velocityTracker.computeCurrentVelocity(1000, this.mMaximumVelocity);\n            let initialVelocity = Math.floor(velocityTracker.getXVelocity(this.mActivePointerId));\n            this.mPopulatePending = true;\n            const width = this.getClientWidth();\n            const scrollX = this.getScrollX();\n            const ii = this.infoForCurrentScrollPosition();\n            const currentPage = ii.position;\n            const pageOffset = ((scrollX / width) - ii.offset) / ii.widthFactor;\n            const totalDelta = Math.floor(this.mLastMotionX - this.mInitialMotionX);\n            let nextPage = this.determineTargetPage(currentPage, pageOffset, initialVelocity,\n                totalDelta);\n            this.setCurrentItemInternal(nextPage, true, true, initialVelocity);\n            this.endDrag();\n\n            this.mFakeDragging = false;\n        }\n\n\n        /**\n         * Fake drag by an offset in pixels. You must have called {@link #beginFakeDrag()} first.\n         *\n         * @param xOffset Offset in pixels to drag by.\n         * @see #beginFakeDrag()\n         * @see #endFakeDrag()\n         */\n        fakeDragBy(xOffset:number):void {\n            if (!this.mFakeDragging) {\n                throw new Error(\"No fake drag in progress. Call beginFakeDrag first.\");\n            }\n\n            this.mLastMotionX += xOffset;\n\n            let oldScrollX = this.getScrollX();\n            let scrollX = oldScrollX - xOffset;\n            const width = this.getClientWidth();\n\n            let leftBound = width * this.mFirstOffset;\n            let rightBound = width * this.mLastOffset;\n\n            const firstItem = this.mItems.get(0);\n            const lastItem = this.mItems.get(this.mItems.size() - 1);\n            if (firstItem.position != 0) {\n                leftBound = firstItem.offset * width;\n            }\n            if (lastItem.position != this.mAdapter.getCount() - 1) {\n                rightBound = lastItem.offset * width;\n            }\n\n            if (scrollX < leftBound) {\n                scrollX = leftBound;\n            } else if (scrollX > rightBound) {\n                scrollX = rightBound;\n            }\n            // Don't lose the rounded component\n            this.mLastMotionX += scrollX - Math.floor(scrollX);\n            this.scrollTo(Math.floor(scrollX), this.getScrollY());\n            this.pageScrolled(Math.floor(scrollX));\n\n            // Synthesize an event for the VelocityTracker.\n            const time = android.os.SystemClock.uptimeMillis();\n            const ev = MotionEvent.obtainWithAction(this.mFakeDragBeginTime, time, MotionEvent.ACTION_MOVE,\n                this.mLastMotionX, 0, 0);\n            this.mVelocityTracker.addMovement(ev);\n            ev.recycle();\n        }\n\n\n        /**\n         * Returns true if a fake drag is in progress.\n         *\n         * @return true if currently in a fake drag, false otherwise.\n         *\n         * @see #beginFakeDrag()\n         * @see #fakeDragBy(float)\n         * @see #endFakeDrag()\n         */\n        isFakeDragging():boolean {\n            return this.mFakeDragging;\n        }\n\n        private onSecondaryPointerUp(ev:MotionEvent) {\n            const pointerIndex = ev.getActionIndex();\n            const pointerId = ev.getPointerId(pointerIndex);\n            if (pointerId == this.mActivePointerId) {\n                // This was our active pointer going up. Choose a new\n                // active pointer and adjust accordingly.\n                const newPointerIndex = pointerIndex == 0 ? 1 : 0;\n                this.mLastMotionX = ev.getX(newPointerIndex);\n                this.mActivePointerId = ev.getPointerId(newPointerIndex);\n                if (this.mVelocityTracker != null) {\n                    this.mVelocityTracker.clear();\n                }\n            }\n        }\n        private endDrag() {\n            this.mIsBeingDragged = false;\n            this.mIsUnableToDrag = false;\n\n            if (this.mVelocityTracker != null) {\n                this.mVelocityTracker.recycle();\n                this.mVelocityTracker = null;\n            }\n        }\n\n        private setScrollingCacheEnabled(enabled:boolean) {\n            if (this.mScrollingCacheEnabled != enabled) {\n                this.mScrollingCacheEnabled = enabled;\n                if (ViewPager.USE_CACHE) {\n                    const size = this.getChildCount();\n                    for (let i = 0; i < size; ++i) {\n                        const child = this.getChildAt(i);\n                        if (child.getVisibility() != View.GONE) {\n                            child.setDrawingCacheEnabled(enabled);\n                        }\n                    }\n                }\n            }\n        }\n\n\n        canScrollHorizontally(direction:number):boolean {\n            if (this.mAdapter == null) {\n                return false;\n            }\n\n            const width = this.getClientWidth();\n            const scrollX = this.getScrollX();\n            if (direction < 0) {\n                return (scrollX > (width * this.mFirstOffset));\n            } else if (direction > 0) {\n                return (scrollX < (width * this.mLastOffset));\n            } else {\n                return false;\n            }\n        }\n\n\n        /**\n         * Tests scrollability within child views of v given a delta of dx.\n         *\n         * @param v View to test for horizontal scrollability\n         * @param checkV Whether the view v passed should itself be checked for scrollability (true),\n         *               or just its children (false).\n         * @param dx Delta scrolled in pixels\n         * @param x X coordinate of the active touch point\n         * @param y Y coordinate of the active touch point\n         * @return true if child views of v can be scrolled by delta of dx.\n         */\n        canScroll(v:View, checkV:boolean, dx:number, x:number, y:number):boolean {\n            if (v instanceof ViewGroup) {\n                const group = <ViewGroup>v;\n                const scrollX = v.getScrollX();\n                const scrollY = v.getScrollY();\n                const count = group.getChildCount();\n                // Count backwards - let topmost views consume scroll distance first.\n                for (let i = count - 1; i >= 0; i--) {\n                    // TODO: Add versioned support here for transformed views.\n                    // This will not work for transformed views in Honeycomb+\n                    const child = group.getChildAt(i);\n                    if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight() &&\n                        y + scrollY >= child.getTop() && y + scrollY < child.getBottom() &&\n                        this.canScroll(child, true, dx, x + scrollX - child.getLeft(),\n                            y + scrollY - child.getTop())) {\n                        return true;\n                    }\n                }\n            }\n\n            return checkV && v.canScrollHorizontally(-dx);\n        }\n\n\n        dispatchKeyEvent(event:android.view.KeyEvent):boolean {\n            // Let the focused view and/or our descendants get the key first\n            return super.dispatchKeyEvent(event) || this.executeKeyEvent(event);\n        }\n\n\n        /**\n         * You can call this function yourself to have the scroll view perform\n         * scrolling from a key event, just as if the event had been dispatched to\n         * it by the view hierarchy.\n         *\n         * @param event The key event to execute.\n         * @return Return true if the event was handled, else false.\n         */\n        executeKeyEvent(event:KeyEvent):boolean {\n            let handled = false;\n            if (event.getAction() == KeyEvent.ACTION_DOWN) {\n                switch (event.getKeyCode()) {\n                    case KeyEvent.KEYCODE_DPAD_LEFT:\n                        handled = this.arrowScroll(View.FOCUS_LEFT);\n                        break;\n                    case KeyEvent.KEYCODE_DPAD_RIGHT:\n                        handled = this.arrowScroll(View.FOCUS_RIGHT);\n                        break;\n                    case KeyEvent.KEYCODE_TAB:\n                        // The focus finder had a bug handling FOCUS_FORWARD and FOCUS_BACKWARD\n                        // before Android 3.0. Ignore the tab key on those devices.\n                        if (event.isShiftPressed()) {\n                            handled = this.arrowScroll(View.FOCUS_BACKWARD);\n                        }else{\n                            handled = this.arrowScroll(View.FOCUS_FORWARD);\n                        }\n                        break;\n                }\n            }\n            return handled;\n        }\n\n        arrowScroll(direction:number):boolean {\n            let currentFocused = this.findFocus();\n            if (currentFocused == this) {\n                currentFocused = null;\n            } else if (currentFocused != null) {\n                let isChild = false;\n                for (let parent = currentFocused.getParent(); parent instanceof ViewGroup; parent = parent.getParent()) {\n                    if (parent == this) {\n                        isChild = true;\n                        break;\n                    }\n                }\n                if (!isChild) {\n                    // This would cause the focus search down below to fail in fun ways.\n                    const sb = new java.lang.StringBuilder();\n                    sb.append(currentFocused.toString());\n                    for (let parent = currentFocused.getParent(); parent instanceof ViewGroup; parent = parent.getParent()) {\n                        sb.append(\" => \").append(parent.toString());\n                    }\n                    Log.e(TAG, \"arrowScroll tried to find focus based on non-child \" +\n                        \"current focused view \" + sb.toString());\n                    currentFocused = null;\n                }\n            }\n\n            let handled = false;\n\n            let nextFocused = android.view.FocusFinder.getInstance().findNextFocus(this, currentFocused, direction);\n            if (nextFocused != null && nextFocused != currentFocused) {\n                if (direction == View.FOCUS_LEFT) {\n                    // If there is nothing to the left, or this is causing us to\n                    // jump to the right, then what we really want to do is page left.\n                    const nextLeft = this.getChildRectInPagerCoordinates(this.mTempRect, nextFocused).left;\n                    const currLeft = this.getChildRectInPagerCoordinates(this.mTempRect, currentFocused).left;\n                    if (currentFocused != null && nextLeft >= currLeft) {\n                        handled = this.pageLeft();\n                    } else {\n                        handled = nextFocused.requestFocus();\n                    }\n                } else if (direction == View.FOCUS_RIGHT) {\n                    // If there is nothing to the right, or this is causing us to\n                    // jump to the left, then what we really want to do is page right.\n                    const nextLeft = this.getChildRectInPagerCoordinates(this.mTempRect, nextFocused).left;\n                    const currLeft = this.getChildRectInPagerCoordinates(this.mTempRect, currentFocused).left;\n                    if (currentFocused != null && nextLeft <= currLeft) {\n                        handled = this.pageRight();\n                    } else {\n                        handled = nextFocused.requestFocus();\n                    }\n                }\n            } else if (direction == View.FOCUS_LEFT || direction == View.FOCUS_BACKWARD) {\n                // Trying to move left and nothing there; try to page.\n                handled = this.pageLeft();\n            } else if (direction == View.FOCUS_RIGHT || direction == View.FOCUS_FORWARD) {\n                // Trying to move right and nothing there; try to page.\n                handled = this.pageRight();\n            }\n            //if (handled) {\n            //    playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));\n            //}\n            return handled;\n        }\n        private getChildRectInPagerCoordinates(outRect:Rect, child:View):Rect {\n            if (outRect == null) {\n                outRect = new Rect();\n            }\n            if (child == null) {\n                outRect.set(0, 0, 0, 0);\n                return outRect;\n            }\n            outRect.left = child.getLeft();\n            outRect.right = child.getRight();\n            outRect.top = child.getTop();\n            outRect.bottom = child.getBottom();\n\n            let parent = child.getParent();\n            while (parent instanceof ViewGroup && parent != this) {\n                const group = <ViewGroup>parent;\n                outRect.left += group.getLeft();\n                outRect.right += group.getRight();\n                outRect.top += group.getTop();\n                outRect.bottom += group.getBottom();\n\n                parent = group.getParent();\n            }\n            return outRect;\n        }\n        pageLeft():boolean {\n            if (this.mCurItem > 0) {\n                this.setCurrentItem(this.mCurItem-1, true);\n                return true;\n            }\n            return false;\n        }\n        pageRight():boolean {\n            if (this.mAdapter != null && this.mCurItem < (this.mAdapter.getCount()-1)) {\n                this.setCurrentItem(this.mCurItem+1, true);\n                return true;\n            }\n            return false;\n        }\n\n\n        addFocusables(views:ArrayList<View>, direction:number, focusableMode:number):void {\n            const focusableCount = views.size();\n\n            const descendantFocusability = this.getDescendantFocusability();\n\n            if (descendantFocusability != ViewGroup.FOCUS_BLOCK_DESCENDANTS) {\n                for (let i = 0; i < this.getChildCount(); i++) {\n                    const child = this.getChildAt(i);\n                    if (child.getVisibility() == View.VISIBLE) {\n                        let ii = this.infoForChild(child);\n                        if (ii != null && ii.position == this.mCurItem) {\n                            child.addFocusables(views, direction, focusableMode);\n                        }\n                    }\n                }\n            }\n\n            // we add ourselves (if focusable) in all cases except for when we are\n            // FOCUS_AFTER_DESCENDANTS and there are some descendants focusable.  this is\n            // to avoid the focus search finding layouts when a more precise search\n            // among the focusable children would be more interesting.\n            if (\n                descendantFocusability != ViewGroup.FOCUS_AFTER_DESCENDANTS ||\n                    // No focusable descendants\n                (focusableCount == views.size())) {\n                // Note that we can't call the superclass here, because it will\n                // add all views in.  So we need to do the same thing View does.\n                if (!this.isFocusable()) {\n                    return;\n                }\n                if ((focusableMode & ViewGroup.FOCUSABLES_TOUCH_MODE) == ViewGroup.FOCUSABLES_TOUCH_MODE &&\n                    this.isInTouchMode() && !this.isFocusableInTouchMode()) {\n                    return;\n                }\n                if (views != null) {\n                    views.add(this);\n                }\n            }\n        }\n\n        /**\n         * We only want the current page that is being shown to be touchable.\n         */\n        addTouchables(views:java.util.ArrayList<android.view.View>):void {\n            // Note that we don't call super.addTouchables(), which means that\n            // we don't call View.addTouchables().  This is okay because a ViewPager\n            // is itself not touchable.\n            for (let i = 0; i < this.getChildCount(); i++) {\n                const child = this.getChildAt(i);\n                if (child.getVisibility() == View.VISIBLE) {\n                    let ii = this.infoForChild(child);\n                    if (ii != null && ii.position == this.mCurItem) {\n                        child.addTouchables(views);\n                    }\n                }\n            }\n        }\n\n        protected onRequestFocusInDescendants(direction:number, previouslyFocusedRect:Rect):boolean {\n            let index;\n            let increment;\n            let end;\n            let count = this.getChildCount();\n            if ((direction & View.FOCUS_FORWARD) != 0) {\n                index = 0;\n                increment = 1;\n                end = count;\n            } else {\n                index = count - 1;\n                increment = -1;\n                end = -1;\n            }\n            for (let i = index; i != end; i += increment) {\n                let child = this.getChildAt(i);\n                if (child.getVisibility() == View.VISIBLE) {\n                    let ii = this.infoForChild(child);\n                    if (ii != null && ii.position == this.mCurItem) {\n                        if (child.requestFocus(direction, previouslyFocusedRect)) {\n                            return true;\n                        }\n                    }\n                }\n            }\n            return false;\n        }\n\n\n        protected generateDefaultLayoutParams():android.view.ViewGroup.LayoutParams {\n            return new ViewPager.LayoutParams();\n        }\n\n\n        protected generateLayoutParams(p:android.view.ViewGroup.LayoutParams):android.view.ViewGroup.LayoutParams {\n            return this.generateDefaultLayoutParams();\n        }\n\n        protected checkLayoutParams(p:android.view.ViewGroup.LayoutParams):boolean {\n            return p instanceof ViewPager.LayoutParams && super.checkLayoutParams(p);\n        }\n\n        public generateLayoutParamsFromAttr(attrs: HTMLElement): android.view.ViewGroup.LayoutParams {\n            return new ViewPager.LayoutParams(this.getContext(), attrs);\n        }\n\n        private static isImplDecor(view:View):boolean {\n            return view[SymbolDecor] || view.constructor[SymbolDecor];\n        }\n        static setClassImplDecor(clazz:Function){\n            clazz[SymbolDecor] = true;\n        }\n    }\n\n    export module ViewPager {\n\n        import AttrBinder = androidui.attr.AttrBinder;\n        /**\n         * Callback interface for responding to changing state of the selected page.\n         */\n        export interface OnPageChangeListener {\n\n            /**\n             * This method will be invoked when the current page is scrolled, either as part\n             * of a programmatically initiated smooth scroll or a user initiated touch scroll.\n\n             * @param position Position index of the first page currently being displayed.\n             * *                 Page position+1 will be visible if positionOffset is nonzero.\n             * *\n             * @param positionOffset Value from [0, 1) indicating the offset from the page at position.\n             * *\n             * @param positionOffsetPixels Value in pixels indicating the offset from position.\n             */\n            onPageScrolled(position:number, positionOffset:number, positionOffsetPixels:number):void;\n\n            /**\n             * This method will be invoked when a new page becomes selected. Animation is not\n             * necessarily complete.\n\n             * @param position Position index of the new selected page.\n             */\n            onPageSelected(position:number):void;\n\n            /**\n             * Called when the scroll state changes. Useful for discovering when the user\n             * begins dragging, when the pager is automatically settling to the current page,\n             * or when it is fully stopped/idle.\n\n             * @param state The new scroll state.\n             * *\n             * @see ViewPager.SCROLL_STATE_IDLE\n\n             * @see ViewPager.SCROLL_STATE_DRAGGING\n\n             * @see ViewPager.SCROLL_STATE_SETTLING\n             */\n            onPageScrollStateChanged(state:number):void;\n        }\n\n        /**\n         * Simple implementation of the [OnPageChangeListener] interface with stub\n         * implementations of each method. Extend this if you do not intend to override\n         * every method of [OnPageChangeListener].\n         */\n        export class SimpleOnPageChangeListener implements OnPageChangeListener {\n            onPageScrolled(position:number, positionOffset:number, positionOffsetPixels:number) {\n                // This space for rent\n            }\n\n            onPageSelected(position:number) {\n                // This space for rent\n            }\n\n            onPageScrollStateChanged(state:number) {\n                // This space for rent\n            }\n        }\n\n\n        /**\n         * A PageTransformer is invoked whenever a visible/attached page is scrolled.\n         * This offers an opportunity for the application to apply a custom transformation\n         * to the page views using animation properties.\n\n         *\n         * As property animation is only supported as of Android 3.0 and forward,\n         * setting a PageTransformer on a ViewPager on earlier platform versions will\n         * be ignored.\n         */\n        export interface PageTransformer {\n            /**\n             * Apply a property transformation to the given page.\n\n             * @param page Apply the transformation to this page\n             * *\n             * @param position Position of page relative to the current front-and-center\n             * *                 position of the pager. 0 is front and center. 1 is one full\n             * *                 page position to the right, and -1 is one page position to the left.\n             */\n            transformPage(page:View, position:number):void;\n        }\n\n\n        /**\n         * Used internally to monitor when adapters are switched.\n         */\n        export interface OnAdapterChangeListener {\n            onAdapterChanged(oldAdapter:PagerAdapter, newAdapter:PagerAdapter):void;\n        }\n\n\n\n\n        /**\n         * Layout parameters that should be supplied for views added to a\n         * ViewPager.\n         */\n        export class LayoutParams extends ViewGroup.LayoutParams{\n            /**\n             * true if this view is a decoration on the pager itself and not\n             * a view supplied by the adapter.\n             */\n            isDecor = false;\n\n            /**\n             * Gravity setting for use on decor views only:\n             * Where to position the view page within the overall ViewPager\n             * container; constants are defined in {@link android.view.Gravity}.\n             */\n            gravity = 0;\n\n            /**\n             * Width as a 0-1 multiplier of the measured pager width\n             */\n            widthFactor = 0;\n\n            /**\n             * true if this view was added during layout and needs to be measured\n             * before being positioned.\n             */\n            needsMeasure = false;\n\n            /**\n             * Adapter position this view is for if !isDecor\n             */\n            position = 0;\n\n            /**\n             * Current child index within the ViewPager that this view occupies\n             */\n            childIndex = 0;\n\n            constructor();\n            constructor(context:android.content.Context, attrs:HTMLElement);\n            constructor(...args) {\n                super(...(() => {\n                    if (args[0] instanceof android.content.Context && args[1] instanceof HTMLElement) return [args[0], args[1]];\n                    else if (args.length === 0)  return [ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT];\n                })());\n                if (args[0] instanceof android.content.Context && args[1] instanceof HTMLElement) {\n                    const c = <android.content.Context>args[0];\n                    const attrs = <HTMLElement>args[1];\n                    const a = c.obtainStyledAttributes(attrs);\n                    this.gravity = Gravity.parseGravity(a.getAttrValue('layout_gravity'), Gravity.TOP);\n                    a.recycle();\n                } else if (args.length === 0) {\n                }\n            }\n\n            protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n                return super.createClassAttrBinder().set('layout_gravity', {\n                    setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                        param.gravity = attrBinder.parseGravity(value, param.gravity);\n                    }, getter(param:LayoutParams) {\n                        return param.gravity;\n                    }\n                });\n            }\n        }\n    }\n\n    class ItemInfo {\n        object:any;\n        position = 0;\n        scrolling = false;\n        widthFactor = 0;\n        offset = 0;\n    }\n\n    class PagerObserver extends DataSetObserver {\n        ViewPager_this:ViewPager;\n\n        constructor(viewPager:ViewPager) {\n            super();\n            this.ViewPager_this = viewPager;\n        }\n\n        onChanged() {\n            this.ViewPager_this.dataSetChanged();\n        }\n\n        onInvalidated() {\n            this.ViewPager_this.dataSetChanged();\n        }\n    }\n}"
  },
  {
    "path": "src/android/support/v4/widget/DrawerLayout.ts",
    "content": "/*\n * Copyright (C) 2013 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../../../android/graphics/PixelFormat.ts\"/>\n///<reference path=\"../../../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../../../android/os/SystemClock.ts\"/>\n///<reference path=\"../../../../android/view/Gravity.ts\"/>\n///<reference path=\"../../../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../../../android/view/View.ts\"/>\n///<reference path=\"../../../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../../../android/view/ViewParent.ts\"/>\n///<reference path=\"../../../../java/lang/Integer.ts\"/>\n///<reference path=\"../../../../java/lang/Runnable.ts\"/>\n///<reference path=\"../../../../android/support/v4/widget/ViewDragHelper.ts\"/>\n\nmodule android.support.v4.widget {\nimport Canvas = android.graphics.Canvas;\nimport Paint = android.graphics.Paint;\nimport PixelFormat = android.graphics.PixelFormat;\nimport Rect = android.graphics.Rect;\nimport Drawable = android.graphics.drawable.Drawable;\nimport SystemClock = android.os.SystemClock;\nimport Gravity = android.view.Gravity;\nimport KeyEvent = android.view.KeyEvent;\nimport MotionEvent = android.view.MotionEvent;\nimport View = android.view.View;\nimport ViewGroup = android.view.ViewGroup;\nimport ViewParent = android.view.ViewParent;\nimport Integer = java.lang.Integer;\nimport Runnable = java.lang.Runnable;\nimport ViewDragHelper = android.support.v4.widget.ViewDragHelper;\nimport AttrBinder = androidui.attr.AttrBinder;\nimport Context = android.content.Context;\n\n/**\n * DrawerLayout acts as a top-level container for window content that allows for\n * interactive \"drawer\" views to be pulled out from the edge of the window.\n *\n * <p>Drawer positioning and layout is controlled using the <code>android:layout_gravity</code>\n * attribute on child views corresponding to which side of the view you want the drawer\n * to emerge from: left or right. (Or start/end on platform versions that support layout direction.)\n * </p>\n *\n * <p>To use a DrawerLayout, position your primary content view as the first child with\n * a width and height of <code>match_parent</code>. Add drawers as child views after the main\n * content view and set the <code>layout_gravity</code> appropriately. Drawers commonly use\n * <code>match_parent</code> for height with a fixed width.</p>\n *\n * <p>{@link DrawerListener} can be used to monitor the state and motion of drawer views.\n * Avoid performing expensive operations such as layout during animation as it can cause\n * stuttering; try to perform expensive operations during the {@link #STATE_IDLE} state.\n * {@link SimpleDrawerListener} offers default/no-op implementations of each callback method.</p>\n *\n * <p>As per the Android Design guide, any drawers positioned to the left/start should\n * always contain content for navigating around the application, whereas any drawers\n * positioned to the right/end should always contain actions to take on the current content.\n * This preserves the same navigation left, actions right structure present in the Action Bar\n * and elsewhere.</p>\n */\nexport class DrawerLayout extends ViewGroup {\n\n    private static TAG:string = \"DrawerLayout\";\n\n    /**\n     * Indicates that any drawers are in an idle, settled state. No animation is in progress.\n     */\n    static STATE_IDLE:number = ViewDragHelper.STATE_IDLE;\n\n    /**\n     * Indicates that a drawer is currently being dragged by the user.\n     */\n    static STATE_DRAGGING:number = ViewDragHelper.STATE_DRAGGING;\n\n    /**\n     * Indicates that a drawer is in the process of settling to a final position.\n     */\n    static STATE_SETTLING:number = ViewDragHelper.STATE_SETTLING;\n\n    /**\n     * The drawer is unlocked.\n     */\n    static LOCK_MODE_UNLOCKED:number = 0;\n\n    /**\n     * The drawer is locked closed. The user may not open it, though\n     * the app may open it programmatically.\n     */\n    static LOCK_MODE_LOCKED_CLOSED:number = 1;\n\n    /**\n     * The drawer is locked open. The user may not close it, though the app\n     * may close it programmatically.\n     */\n    static LOCK_MODE_LOCKED_OPEN:number = 2;\n\n    // dp\n    private static MIN_DRAWER_MARGIN:number = 64;\n\n    private static DEFAULT_SCRIM_COLOR:number = 0x99000000;\n\n    /**\n     * Length of time to delay before peeking the drawer.\n     */\n    // ms\n    static PEEK_DELAY:number = 160;\n\n    /**\n     * Minimum velocity that will be detected as a fling\n     */\n    // dips per second\n    private static MIN_FLING_VELOCITY:number = 400;\n\n    /**\n     * Experimental feature.\n     */\n    static ALLOW_EDGE_LOCK:boolean = false;\n\n    private static CHILDREN_DISALLOW_INTERCEPT:boolean = true;\n\n    private static TOUCH_SLOP_SENSITIVITY:number = 1.;\n\n    private mMinDrawerMargin:number = 0;\n\n    private mScrimColor:number = DrawerLayout.DEFAULT_SCRIM_COLOR;\n\n    private mScrimOpacity:number = 0;\n\n    private mScrimPaint:Paint = new Paint();\n\n    private mLeftDragger:ViewDragHelper;\n\n    private mRightDragger:ViewDragHelper;\n\n    private mLeftCallback:DrawerLayout.ViewDragCallback;\n\n    private mRightCallback:DrawerLayout.ViewDragCallback;\n\n    private mDrawerState:number = 0;\n\n    private mInLayout:boolean;\n\n    private mFirstLayout:boolean = true;\n\n    private mLockModeLeft:number = 0;\n\n    private mLockModeRight:number = 0;\n\n    private mDisallowInterceptRequested:boolean;\n\n    private mChildrenCanceledTouch:boolean;\n\n    private mListener:DrawerLayout.DrawerListener;\n\n    private mInitialMotionX:number = 0;\n\n    private mInitialMotionY:number = 0;\n\n    private mShadowLeft:Drawable;\n\n    private mShadowRight:Drawable;\n\n\n    constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n        super(context, bindElement, defStyle);\n\n        const density:number = this.getResources().getDisplayMetrics().density;\n        this.mMinDrawerMargin = Math.floor((DrawerLayout.MIN_DRAWER_MARGIN * density + 0.5));\n        const minVel:number = DrawerLayout.MIN_FLING_VELOCITY * density;\n        this.mLeftCallback = new DrawerLayout.ViewDragCallback(this, Gravity.LEFT);\n        this.mRightCallback = new DrawerLayout.ViewDragCallback(this, Gravity.RIGHT);\n        this.mLeftDragger = ViewDragHelper.create(this, DrawerLayout.TOUCH_SLOP_SENSITIVITY, this.mLeftCallback);\n        this.mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);\n        this.mLeftDragger.setMinVelocity(minVel);\n        this.mLeftCallback.setDragger(this.mLeftDragger);\n        this.mRightDragger = ViewDragHelper.create(this, DrawerLayout.TOUCH_SLOP_SENSITIVITY, this.mRightCallback);\n        this.mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);\n        this.mRightDragger.setMinVelocity(minVel);\n        this.mRightCallback.setDragger(this.mRightDragger);\n        // So that we can catch the back button\n        this.setFocusableInTouchMode(true);\n        //ViewCompat.setAccessibilityDelegate(this, new DrawerLayout.AccessibilityDelegate(this));\n        this.setMotionEventSplittingEnabled(false);\n    }\n\n    /**\n     * Set a simple drawable used for the left or right shadow.\n     * The drawable provided must have a nonzero intrinsic width.\n     *\n     * @param shadowDrawable Shadow drawable to use at the edge of a drawer\n     * @param gravity Which drawer the shadow should apply to\n     */\n    setDrawerShadow(shadowDrawable:Drawable, gravity:number):void  {\n        /*\n         * TODO Someone someday might want to set more complex drawables here.\n         * They're probably nuts, but we might want to consider registering callbacks,\n         * setting states, etc. properly.\n         */\n        const absGravity:number = Gravity.getAbsoluteGravity(gravity, this.getLayoutDirection());\n        if ((absGravity & Gravity.LEFT) == Gravity.LEFT) {\n            this.mShadowLeft = shadowDrawable;\n            this.invalidate();\n        }\n        if ((absGravity & Gravity.RIGHT) == Gravity.RIGHT) {\n            this.mShadowRight = shadowDrawable;\n            this.invalidate();\n        }\n    }\n\n    ///**\n    // * Set a simple drawable used for the left or right shadow.\n    // * The drawable provided must have a nonzero intrinsic width.\n    // *\n    // * @param resId Resource id of a shadow drawable to use at the edge of a drawer\n    // * @param gravity Which drawer the shadow should apply to\n    // */\n    //setDrawerShadow(resId:number, gravity:number):void  {\n    //    this.setDrawerShadow(this.getResources().getDrawable(resId), gravity);\n    //}\n\n    /**\n     * Set a color to use for the scrim that obscures primary content while a drawer is open.\n     *\n     * @param color Color to use in 0xAARRGGBB format.\n     */\n    setScrimColor(color:number):void  {\n        this.mScrimColor = color;\n        this.invalidate();\n    }\n\n    /**\n     * Set a listener to be notified of drawer events.\n     *\n     * @param listener Listener to notify when drawer events occur\n     * @see DrawerListener\n     */\n    setDrawerListener(listener:DrawerLayout.DrawerListener):void  {\n        this.mListener = listener;\n    }\n\n    ///**\n    // * Enable or disable interaction with all drawers.\n    // *\n    // * <p>This allows the application to restrict the user's ability to open or close\n    // * any drawer within this layout. DrawerLayout will still respond to calls to\n    // * {@link #openDrawer(int)}, {@link #closeDrawer(int)} and friends if a drawer is locked.</p>\n    // *\n    // * <p>Locking drawers open or closed will implicitly open or close\n    // * any drawers as appropriate.</p>\n    // *\n    // * @param lockMode The new lock mode for the given drawer. One of {@link #LOCK_MODE_UNLOCKED},\n    // *                 {@link #LOCK_MODE_LOCKED_CLOSED} or {@link #LOCK_MODE_LOCKED_OPEN}.\n    // */\n    //setDrawerLockMode(lockMode:number):void  {\n    //    this.setDrawerLockMode(lockMode, Gravity.LEFT);\n    //    this.setDrawerLockMode(lockMode, Gravity.RIGHT);\n    //}\n\n    /**\n     * Enable or disable interaction with the given drawer.\n     *\n     * <p>This allows the application to restrict the user's ability to open or close\n     * the given drawer. DrawerLayout will still respond to calls to {@link #openDrawer(int)},\n     * {@link #closeDrawer(int)} and friends if a drawer is locked.</p>\n     *\n     * <p>Locking a drawer open or closed will implicitly open or close\n     * that drawer as appropriate.</p>\n     *\n     * @param lockMode The new lock mode for the given drawer. One of {@link #LOCK_MODE_UNLOCKED},\n     *                 {@link #LOCK_MODE_LOCKED_CLOSED} or {@link #LOCK_MODE_LOCKED_OPEN}.\n     * @param edgeGravity Gravity.LEFT, RIGHT, START or END.\n     *                    Expresses which drawer to change the mode for.\n     *\n     * @see #LOCK_MODE_UNLOCKED\n     * @see #LOCK_MODE_LOCKED_CLOSED\n     * @see #LOCK_MODE_LOCKED_OPEN\n     */\n    setDrawerLockMode(lockMode:number, edgeGravityOrView?:number|View):void  {\n        if(edgeGravityOrView==null){\n            this.setDrawerLockMode(lockMode, Gravity.LEFT);\n            this.setDrawerLockMode(lockMode, Gravity.RIGHT);\n            return;\n        }\n        if(edgeGravityOrView instanceof View){\n            if (!this.isDrawerView(edgeGravityOrView)) {\n                throw Error(`new IllegalArgumentException(\"View \" + drawerView + \" is not a \" + \"drawer with appropriate layout_gravity\")`);\n            }\n            const gravity:number = (<DrawerLayout.LayoutParams> edgeGravityOrView.getLayoutParams()).gravity;\n            this.setDrawerLockMode(lockMode, gravity);\n            return;\n        }\n        let edgeGravity = <number>edgeGravityOrView;\n        const absGravity:number = Gravity.getAbsoluteGravity(edgeGravity, this.getLayoutDirection());\n        if (absGravity == Gravity.LEFT) {\n            this.mLockModeLeft = lockMode;\n        } else if (absGravity == Gravity.RIGHT) {\n            this.mLockModeRight = lockMode;\n        }\n        if (lockMode != DrawerLayout.LOCK_MODE_UNLOCKED) {\n            // Cancel interaction in progress\n            const helper:ViewDragHelper = absGravity == Gravity.LEFT ? this.mLeftDragger : this.mRightDragger;\n            helper.cancel();\n        }\n        switch(lockMode) {\n            case DrawerLayout.LOCK_MODE_LOCKED_OPEN:\n                const toOpen:View = this.findDrawerWithGravity(absGravity);\n                if (toOpen != null) {\n                    this.openDrawer(toOpen);\n                }\n                break;\n            case DrawerLayout.LOCK_MODE_LOCKED_CLOSED:\n                const toClose:View = this.findDrawerWithGravity(absGravity);\n                if (toClose != null) {\n                    this.closeDrawer(toClose);\n                }\n                break;\n        }\n    }\n\n    ///**\n    // * Enable or disable interaction with the given drawer.\n    // *\n    // * <p>This allows the application to restrict the user's ability to open or close\n    // * the given drawer. DrawerLayout will still respond to calls to {@link #openDrawer(int)},\n    // * {@link #closeDrawer(int)} and friends if a drawer is locked.</p>\n    // *\n    // * <p>Locking a drawer open or closed will implicitly open or close\n    // * that drawer as appropriate.</p>\n    // *\n    // * @param lockMode The new lock mode for the given drawer. One of {@link #LOCK_MODE_UNLOCKED},\n    // *                 {@link #LOCK_MODE_LOCKED_CLOSED} or {@link #LOCK_MODE_LOCKED_OPEN}.\n    // * @param drawerView The drawer view to change the lock mode for\n    // *\n    // * @see #LOCK_MODE_UNLOCKED\n    // * @see #LOCK_MODE_LOCKED_CLOSED\n    // * @see #LOCK_MODE_LOCKED_OPEN\n    // */\n    //setDrawerLockMode(lockMode:number, drawerView:View):void  {\n    //    if (!this.isDrawerView(drawerView)) {\n    //        throw Error(`new IllegalArgumentException(\"View \" + drawerView + \" is not a \" + \"drawer with appropriate layout_gravity\")`);\n    //    }\n    //    const gravity:number = (<DrawerLayout.LayoutParams> drawerView.getLayoutParams()).gravity;\n    //    this.setDrawerLockMode(lockMode, gravity);\n    //}\n\n    /**\n     * Check the lock mode of the drawer with the given gravity.\n     *\n     * @param edgeGravityOrView Gravity of the drawer to check / Drawer view to check lock mode\n     * @return one of {@link #LOCK_MODE_UNLOCKED}, {@link #LOCK_MODE_LOCKED_CLOSED} or\n     *         {@link #LOCK_MODE_LOCKED_OPEN}.\n     */\n    getDrawerLockMode(edgeGravityOrView:number|View):number  {\n        if(edgeGravityOrView instanceof View){\n            let drawerView = edgeGravityOrView;\n            const absGravity:number = this.getDrawerViewAbsoluteGravity(drawerView);\n            if (absGravity == Gravity.LEFT) {\n                return this.mLockModeLeft;\n            } else if (absGravity == Gravity.RIGHT) {\n                return this.mLockModeRight;\n            }\n            return DrawerLayout.LOCK_MODE_UNLOCKED;\n\n        }else{\n            let edgeGravity = <number>edgeGravityOrView;\n            const absGravity:number = Gravity.getAbsoluteGravity(edgeGravity, this.getLayoutDirection());\n            if (absGravity == Gravity.LEFT) {\n                return this.mLockModeLeft;\n            } else if (absGravity == Gravity.RIGHT) {\n                return this.mLockModeRight;\n            }\n            return DrawerLayout.LOCK_MODE_UNLOCKED;\n        }\n    }\n\n    /**\n     * Resolve the shared state of all drawers from the component ViewDragHelpers.\n     * Should be called whenever a ViewDragHelper's state changes.\n     */\n    updateDrawerState(forGravity:number, activeState:number, activeDrawer:View):void  {\n        const leftState:number = this.mLeftDragger.getViewDragState();\n        const rightState:number = this.mRightDragger.getViewDragState();\n        let state:number;\n        if (leftState == DrawerLayout.STATE_DRAGGING || rightState == DrawerLayout.STATE_DRAGGING) {\n            state = DrawerLayout.STATE_DRAGGING;\n        } else if (leftState == DrawerLayout.STATE_SETTLING || rightState == DrawerLayout.STATE_SETTLING) {\n            state = DrawerLayout.STATE_SETTLING;\n        } else {\n            state = DrawerLayout.STATE_IDLE;\n        }\n        if (activeDrawer != null && activeState == DrawerLayout.STATE_IDLE) {\n            const lp:DrawerLayout.LayoutParams = <DrawerLayout.LayoutParams> activeDrawer.getLayoutParams();\n            if (lp.onScreen == 0) {\n                this.dispatchOnDrawerClosed(activeDrawer);\n            } else if (lp.onScreen == 1) {\n                this.dispatchOnDrawerOpened(activeDrawer);\n            }\n        }\n        if (state != this.mDrawerState) {\n            this.mDrawerState = state;\n            if (this.mListener != null) {\n                this.mListener.onDrawerStateChanged(state);\n            }\n        }\n    }\n\n    dispatchOnDrawerClosed(drawerView:View):void  {\n        const lp:DrawerLayout.LayoutParams = <DrawerLayout.LayoutParams> drawerView.getLayoutParams();\n        if (lp.knownOpen) {\n            lp.knownOpen = false;\n            if (this.mListener != null) {\n                this.mListener.onDrawerClosed(drawerView);\n            }\n            //this.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);\n        }\n    }\n\n    dispatchOnDrawerOpened(drawerView:View):void  {\n        const lp:DrawerLayout.LayoutParams = <DrawerLayout.LayoutParams> drawerView.getLayoutParams();\n        if (!lp.knownOpen) {\n            lp.knownOpen = true;\n            if (this.mListener != null) {\n                this.mListener.onDrawerOpened(drawerView);\n            }\n            //drawerView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);\n        }\n    }\n\n    dispatchOnDrawerSlide(drawerView:View, slideOffset:number):void  {\n        if (this.mListener != null) {\n            this.mListener.onDrawerSlide(drawerView, slideOffset);\n        }\n    }\n\n    setDrawerViewOffset(drawerView:View, slideOffset:number):void  {\n        const lp:DrawerLayout.LayoutParams = <DrawerLayout.LayoutParams> drawerView.getLayoutParams();\n        if (slideOffset == lp.onScreen) {\n            return;\n        }\n        lp.onScreen = slideOffset;\n        this.dispatchOnDrawerSlide(drawerView, slideOffset);\n    }\n\n    getDrawerViewOffset(drawerView:View):number  {\n        return (<DrawerLayout.LayoutParams> drawerView.getLayoutParams()).onScreen;\n    }\n\n    /**\n     * @return the absolute gravity of the child drawerView, resolved according\n     *         to the current layout direction\n     */\n    getDrawerViewAbsoluteGravity(drawerView:View):number  {\n        const gravity:number = (<DrawerLayout.LayoutParams> drawerView.getLayoutParams()).gravity;\n        return Gravity.getAbsoluteGravity(gravity, this.getLayoutDirection());\n    }\n\n    checkDrawerViewAbsoluteGravity(drawerView:View, checkFor:number):boolean  {\n        const absGravity:number = this.getDrawerViewAbsoluteGravity(drawerView);\n        return (absGravity & checkFor) == checkFor;\n    }\n\n    findOpenDrawer():View  {\n        const childCount:number = this.getChildCount();\n        for (let i:number = 0; i < childCount; i++) {\n            const child:View = this.getChildAt(i);\n            if ((<DrawerLayout.LayoutParams> child.getLayoutParams()).knownOpen) {\n                return child;\n            }\n        }\n        return null;\n    }\n\n    moveDrawerToOffset(drawerView:View, slideOffset:number):void  {\n        const oldOffset:number = this.getDrawerViewOffset(drawerView);\n        const width:number = drawerView.getWidth();\n        const oldPos:number = Math.floor((width * oldOffset));\n        const newPos:number = Math.floor((width * slideOffset));\n        const dx:number = newPos - oldPos;\n        drawerView.offsetLeftAndRight(this.checkDrawerViewAbsoluteGravity(drawerView, Gravity.LEFT) ? dx : -dx);\n        this.setDrawerViewOffset(drawerView, slideOffset);\n    }\n\n    /**\n     * @param gravity the gravity of the child to return. If specified as a\n     *            relative value, it will be resolved according to the current\n     *            layout direction.\n     * @return the drawer with the specified gravity\n     */\n    findDrawerWithGravity(gravity:number):View  {\n        const absHorizGravity:number = Gravity.getAbsoluteGravity(gravity, this.getLayoutDirection()) & Gravity.HORIZONTAL_GRAVITY_MASK;\n        const childCount:number = this.getChildCount();\n        for (let i:number = 0; i < childCount; i++) {\n            const child:View = this.getChildAt(i);\n            const childAbsGravity:number = this.getDrawerViewAbsoluteGravity(child);\n            if ((childAbsGravity & Gravity.HORIZONTAL_GRAVITY_MASK) == absHorizGravity) {\n                return child;\n            }\n        }\n        return null;\n    }\n\n    /**\n     * Simple gravity to string - only supports LEFT and RIGHT for debugging output.\n     *\n     * @param gravity Absolute gravity value\n     * @return LEFT or RIGHT as appropriate, or a hex string\n     */\n    static gravityToString(gravity:number):string  {\n        if ((gravity & Gravity.LEFT) == Gravity.LEFT) {\n            return \"LEFT\";\n        }\n        if ((gravity & Gravity.RIGHT) == Gravity.RIGHT) {\n            return \"RIGHT\";\n        }\n        return ''+gravity;\n    }\n\n    protected onDetachedFromWindow():void  {\n        super.onDetachedFromWindow();\n        this.mFirstLayout = true;\n    }\n\n    protected onAttachedToWindow():void  {\n        super.onAttachedToWindow();\n        this.mFirstLayout = true;\n    }\n\n    protected onMeasure(widthMeasureSpec:number, heightMeasureSpec:number):void  {\n        let widthMode:number = View.MeasureSpec.getMode(widthMeasureSpec);\n        let heightMode:number = View.MeasureSpec.getMode(heightMeasureSpec);\n        let widthSize:number = View.MeasureSpec.getSize(widthMeasureSpec);\n        let heightSize:number = View.MeasureSpec.getSize(heightMeasureSpec);\n        if (widthMode != View.MeasureSpec.EXACTLY || heightMode != View.MeasureSpec.EXACTLY) {\n            if (this.isInEditMode()) {\n                // It will crash on a real device.\n                if (widthMode == View.MeasureSpec.AT_MOST) {\n                    widthMode = View.MeasureSpec.EXACTLY;\n                } else if (widthMode == View.MeasureSpec.UNSPECIFIED) {\n                    widthMode = View.MeasureSpec.EXACTLY;\n                    widthSize = 300;\n                }\n                if (heightMode == View.MeasureSpec.AT_MOST) {\n                    heightMode = View.MeasureSpec.EXACTLY;\n                } else if (heightMode == View.MeasureSpec.UNSPECIFIED) {\n                    heightMode = View.MeasureSpec.EXACTLY;\n                    heightSize = 300;\n                }\n            } else {\n                throw Error(`new IllegalArgumentException(\"DrawerLayout must be measured with MeasureSpec.EXACTLY.\")`);\n            }\n        }\n        this.setMeasuredDimension(widthSize, heightSize);\n        // Gravity value for each drawer we've seen. Only one of each permitted.\n        let foundDrawers:number = 0;\n        const childCount:number = this.getChildCount();\n        for (let i:number = 0; i < childCount; i++) {\n            const child:View = this.getChildAt(i);\n            if (child.getVisibility() == DrawerLayout.GONE) {\n                continue;\n            }\n            const lp:DrawerLayout.LayoutParams = <DrawerLayout.LayoutParams> child.getLayoutParams();\n            if (this.isContentView(child)) {\n                // Content views get measured at exactly the layout's size.\n                const contentWidthSpec:number = View.MeasureSpec.makeMeasureSpec(widthSize - lp.leftMargin - lp.rightMargin, View.MeasureSpec.EXACTLY);\n                const contentHeightSpec:number = View.MeasureSpec.makeMeasureSpec(heightSize - lp.topMargin - lp.bottomMargin, View.MeasureSpec.EXACTLY);\n                child.measure(contentWidthSpec, contentHeightSpec);\n            } else if (this.isDrawerView(child)) {\n                const childGravity:number = this.getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;\n                if ((foundDrawers & childGravity) != 0) {\n                    throw Error(`new IllegalStateException(\"Child drawer has absolute gravity \" + DrawerLayout.gravityToString(childGravity) + \" but this \" + DrawerLayout.TAG + \" already has a \" + \"drawer view along that edge\")`);\n                }\n                const drawerWidthSpec:number = DrawerLayout.getChildMeasureSpec(widthMeasureSpec, this.mMinDrawerMargin + lp.leftMargin + lp.rightMargin, lp.width);\n                const drawerHeightSpec:number = DrawerLayout.getChildMeasureSpec(heightMeasureSpec, lp.topMargin + lp.bottomMargin, lp.height);\n                child.measure(drawerWidthSpec, drawerHeightSpec);\n            } else {\n                throw Error(`new IllegalStateException(\"Child \" + child + \" at index \" + i + \" does not have a valid layout_gravity - must be Gravity.LEFT, \" + \"Gravity.RIGHT or Gravity.NO_GRAVITY\")`);\n            }\n        }\n    }\n\n    protected onLayout(changed:boolean, l:number, t:number, r:number, b:number):void  {\n        this.mInLayout = true;\n        const width:number = r - l;\n        const childCount:number = this.getChildCount();\n        for (let i:number = 0; i < childCount; i++) {\n            const child:View = this.getChildAt(i);\n            if (child.getVisibility() == DrawerLayout.GONE) {\n                continue;\n            }\n            const lp:DrawerLayout.LayoutParams = <DrawerLayout.LayoutParams> child.getLayoutParams();\n            if (this.isContentView(child)) {\n                child.layout(lp.leftMargin, lp.topMargin, lp.leftMargin + child.getMeasuredWidth(), lp.topMargin + child.getMeasuredHeight());\n            } else {\n                // Drawer, if it wasn't onMeasure would have thrown an exception.\n                const childWidth:number = child.getMeasuredWidth();\n                const childHeight:number = child.getMeasuredHeight();\n                let childLeft:number;\n                let newOffset:number;\n                if (this.checkDrawerViewAbsoluteGravity(child, Gravity.LEFT)) {\n                    childLeft = -childWidth + Math.floor((childWidth * lp.onScreen));\n                    newOffset = <number> (childWidth + childLeft) / childWidth;\n                } else {\n                    // Right; onMeasure checked for us.\n                    childLeft = width - Math.floor((childWidth * lp.onScreen));\n                    newOffset = <number> (width - childLeft) / childWidth;\n                }\n                const changeOffset:boolean = newOffset != lp.onScreen;\n                const vgrav:number = lp.gravity & Gravity.VERTICAL_GRAVITY_MASK;\n                switch(vgrav) {\n                    default:\n                    case Gravity.TOP:\n                        {\n                            child.layout(childLeft, lp.topMargin, childLeft + childWidth, lp.topMargin + childHeight);\n                            break;\n                        }\n                    case Gravity.BOTTOM:\n                        {\n                            const height:number = b - t;\n                            child.layout(childLeft, height - lp.bottomMargin - child.getMeasuredHeight(), childLeft + childWidth, height - lp.bottomMargin);\n                            break;\n                        }\n                    case Gravity.CENTER_VERTICAL:\n                        {\n                            const height:number = b - t;\n                            let childTop:number = (height - childHeight) / 2;\n                            // bad measurement before, oh well.\n                            if (childTop < lp.topMargin) {\n                                childTop = lp.topMargin;\n                            } else if (childTop + childHeight > height - lp.bottomMargin) {\n                                childTop = height - lp.bottomMargin - childHeight;\n                            }\n                            child.layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight);\n                            break;\n                        }\n                }\n                if (changeOffset) {\n                    this.setDrawerViewOffset(child, newOffset);\n                }\n                const newVisibility:number = lp.onScreen > 0 ? DrawerLayout.VISIBLE : DrawerLayout.INVISIBLE;\n                if (child.getVisibility() != newVisibility) {\n                    child.setVisibility(newVisibility);\n                }\n            }\n        }\n        this.mInLayout = false;\n        this.mFirstLayout = false;\n    }\n\n    requestLayout():void  {\n        if (!this.mInLayout) {\n            super.requestLayout();\n        }\n    }\n\n    computeScroll():void  {\n        const childCount:number = this.getChildCount();\n        let scrimOpacity:number = 0;\n        for (let i:number = 0; i < childCount; i++) {\n            const onscreen:number = (<DrawerLayout.LayoutParams> this.getChildAt(i).getLayoutParams()).onScreen;\n            scrimOpacity = Math.max(scrimOpacity, onscreen);\n        }\n        this.mScrimOpacity = scrimOpacity;\n\n        let leftContinue = this.mLeftDragger.continueSettling(true);\n        let rightContinue = this.mRightDragger.continueSettling(true);\n        if (leftContinue || rightContinue) {\n            this.postInvalidateOnAnimation();\n        }\n    }\n\n    private static hasOpaqueBackground(v:View):boolean  {\n        const bg:Drawable = v.getBackground();\n        if (bg != null) {\n            return bg.getOpacity() == PixelFormat.OPAQUE;\n        }\n        return false;\n    }\n\n    protected drawChild(canvas:Canvas, child:View, drawingTime:number):boolean  {\n        const height:number = this.getHeight();\n        const drawingContent:boolean = this.isContentView(child);\n        let clipLeft:number = 0, clipRight:number = this.getWidth();\n        const restoreCount:number = canvas.save();\n        if (drawingContent) {\n            const childCount:number = this.getChildCount();\n            for (let i:number = 0; i < childCount; i++) {\n                const v:View = this.getChildAt(i);\n                if (v == child || v.getVisibility() != DrawerLayout.VISIBLE || !DrawerLayout.hasOpaqueBackground(v) || !this.isDrawerView(v) || v.getHeight() < height) {\n                    continue;\n                }\n                if (this.checkDrawerViewAbsoluteGravity(v, Gravity.LEFT)) {\n                    const vright:number = v.getRight();\n                    if (vright > clipLeft)\n                        clipLeft = vright;\n                } else {\n                    const vleft:number = v.getLeft();\n                    if (vleft < clipRight)\n                        clipRight = vleft;\n                }\n            }\n            canvas.clipRect(clipLeft, 0, clipRight, this.getHeight());\n        }\n        const result:boolean = super.drawChild(canvas, child, drawingTime);\n        canvas.restoreToCount(restoreCount);\n        if (this.mScrimOpacity > 0 && drawingContent) {\n            const baseAlpha:number = (this.mScrimColor & 0xff000000) >>> 24;\n            const imag:number = Math.floor((baseAlpha * this.mScrimOpacity));\n            const color:number = imag << 24 | (this.mScrimColor & 0xffffff);\n            this.mScrimPaint.setColor(color);\n            canvas.drawRect(clipLeft, 0, clipRight, this.getHeight(), this.mScrimPaint);\n        } else if (this.mShadowLeft != null && this.checkDrawerViewAbsoluteGravity(child, Gravity.LEFT)) {\n            const shadowWidth:number = this.mShadowLeft.getIntrinsicWidth();\n            const childRight:number = child.getRight();\n            const drawerPeekDistance:number = this.mLeftDragger.getEdgeSize();\n            const alpha:number = Math.max(0, Math.min(<number> childRight / drawerPeekDistance, 1.));\n            this.mShadowLeft.setBounds(childRight, child.getTop(), childRight + shadowWidth, child.getBottom());\n            this.mShadowLeft.setAlpha(Math.floor((0xff * alpha)));\n            this.mShadowLeft.draw(canvas);\n        } else if (this.mShadowRight != null && this.checkDrawerViewAbsoluteGravity(child, Gravity.RIGHT)) {\n            const shadowWidth:number = this.mShadowRight.getIntrinsicWidth();\n            const childLeft:number = child.getLeft();\n            const showing:number = this.getWidth() - childLeft;\n            const drawerPeekDistance:number = this.mRightDragger.getEdgeSize();\n            const alpha:number = Math.max(0, Math.min(<number> showing / drawerPeekDistance, 1.));\n            this.mShadowRight.setBounds(childLeft - shadowWidth, child.getTop(), childLeft, child.getBottom());\n            this.mShadowRight.setAlpha(Math.floor((0xff * alpha)));\n            this.mShadowRight.draw(canvas);\n        }\n        return result;\n    }\n\n    isContentView(child:View):boolean  {\n        return (<DrawerLayout.LayoutParams> child.getLayoutParams()).gravity == Gravity.NO_GRAVITY;\n    }\n\n    isDrawerView(child:View):boolean  {\n        const gravity:number = (<DrawerLayout.LayoutParams> child.getLayoutParams()).gravity;\n        const absGravity:number = Gravity.getAbsoluteGravity(gravity, child.getLayoutDirection());\n        return (absGravity & (Gravity.LEFT | Gravity.RIGHT)) != 0;\n    }\n\n    onInterceptTouchEvent(ev:MotionEvent):boolean  {\n        const action:number = ev.getActionMasked();\n\n        const leftIntercept = this.mLeftDragger.shouldInterceptTouchEvent(ev);\n        const rightIntercept = this.mRightDragger.shouldInterceptTouchEvent(ev);\n        const interceptForDrag:boolean = leftIntercept || rightIntercept;\n        let interceptForTap:boolean = false;\n        switch(action) {\n            case MotionEvent.ACTION_DOWN:\n                {\n                    const x:number = ev.getX();\n                    const y:number = ev.getY();\n                    this.mInitialMotionX = x;\n                    this.mInitialMotionY = y;\n                    if (this.mScrimOpacity > 0 && this.isContentView(this.mLeftDragger.findTopChildUnder(Math.floor(x), Math.floor(y)))) {\n                        interceptForTap = true;\n                    }\n                    this.mDisallowInterceptRequested = false;\n                    this.mChildrenCanceledTouch = false;\n                    break;\n                }\n            case MotionEvent.ACTION_MOVE:\n                {\n                    // If we cross the touch slop, don't perform the delayed peek for an edge touch.\n                    if (this.mLeftDragger.checkTouchSlop(ViewDragHelper.DIRECTION_ALL)) {\n                        this.mLeftCallback.removeCallbacks();\n                        this.mRightCallback.removeCallbacks();\n                    }\n                    break;\n                }\n            case MotionEvent.ACTION_CANCEL:\n            case MotionEvent.ACTION_UP:\n                {\n                    this.closeDrawers(true);\n                    this.mDisallowInterceptRequested = false;\n                    this.mChildrenCanceledTouch = false;\n                }\n        }\n        return interceptForDrag || interceptForTap || this.hasPeekingDrawer() || this.mChildrenCanceledTouch;\n    }\n\n    onTouchEvent(ev:MotionEvent):boolean  {\n        this.mLeftDragger.processTouchEvent(ev);\n        this.mRightDragger.processTouchEvent(ev);\n        const action:number = ev.getAction();\n        let wantTouchEvents:boolean = true;\n        switch(action & MotionEvent.ACTION_MASK) {\n            case MotionEvent.ACTION_DOWN:\n                {\n                    const x:number = ev.getX();\n                    const y:number = ev.getY();\n                    this.mInitialMotionX = x;\n                    this.mInitialMotionY = y;\n                    this.mDisallowInterceptRequested = false;\n                    this.mChildrenCanceledTouch = false;\n                    break;\n                }\n            case MotionEvent.ACTION_UP:\n                {\n                    const x:number = ev.getX();\n                    const y:number = ev.getY();\n                    let peekingOnly:boolean = true;\n                    const touchedView:View = this.mLeftDragger.findTopChildUnder(Math.floor(x), Math.floor(y));\n                    if (touchedView != null && this.isContentView(touchedView)) {\n                        const dx:number = x - this.mInitialMotionX;\n                        const dy:number = y - this.mInitialMotionY;\n                        const slop:number = this.mLeftDragger.getTouchSlop();\n                        if (dx * dx + dy * dy < slop * slop) {\n                            // Taps close a dimmed open drawer but only if it isn't locked open.\n                            const openDrawer:View = this.findOpenDrawer();\n                            if (openDrawer != null) {\n                                peekingOnly = this.getDrawerLockMode(openDrawer) == DrawerLayout.LOCK_MODE_LOCKED_OPEN;\n                            }\n                        }\n                    }\n                    this.closeDrawers(peekingOnly);\n                    this.mDisallowInterceptRequested = false;\n                    break;\n                }\n            case MotionEvent.ACTION_CANCEL:\n                {\n                    this.closeDrawers(true);\n                    this.mDisallowInterceptRequested = false;\n                    this.mChildrenCanceledTouch = false;\n                    break;\n                }\n        }\n        return wantTouchEvents;\n    }\n\n    requestDisallowInterceptTouchEvent(disallowIntercept:boolean):void  {\n        if (DrawerLayout.CHILDREN_DISALLOW_INTERCEPT || (!this.mLeftDragger.isEdgeTouched(ViewDragHelper.EDGE_LEFT) && !this.mRightDragger.isEdgeTouched(ViewDragHelper.EDGE_RIGHT))) {\n            // If we have an edge touch we want to skip this and track it for later instead.\n            super.requestDisallowInterceptTouchEvent(disallowIntercept);\n        }\n        this.mDisallowInterceptRequested = disallowIntercept;\n        if (disallowIntercept) {\n            this.closeDrawers(true);\n        }\n    }\n\n    /**\n     * Close all currently open drawer views by animating them out of view.\n     */\n    closeDrawers(peekingOnly = false):void  {\n        let needsInvalidate:boolean = false;\n        const childCount:number = this.getChildCount();\n        for (let i:number = 0; i < childCount; i++) {\n            const child:View = this.getChildAt(i);\n            const lp:DrawerLayout.LayoutParams = <DrawerLayout.LayoutParams> child.getLayoutParams();\n            if (!this.isDrawerView(child) || (peekingOnly && !lp.isPeeking)) {\n                continue;\n            }\n            const childWidth:number = child.getWidth();\n            if (this.checkDrawerViewAbsoluteGravity(child, Gravity.LEFT)) {\n                needsInvalidate = this.mLeftDragger.smoothSlideViewTo(child, -childWidth, child.getTop()) || needsInvalidate;\n            } else {\n                needsInvalidate = this.mRightDragger.smoothSlideViewTo(child, this.getWidth(), child.getTop()) || needsInvalidate;\n            }\n            lp.isPeeking = false;\n        }\n        this.mLeftCallback.removeCallbacks();\n        this.mRightCallback.removeCallbacks();\n        if (needsInvalidate) {\n            this.invalidate();\n        }\n    }\n\n    /**\n     * Open the specified drawer view by animating it into view.\n     *\n     * @param drawerView Drawer view to open\n     */\n    openDrawer(drawerView:View):void;\n\n    /**\n     * Open the specified drawer by animating it out of view.\n     *\n     * @param gravity Gravity.LEFT to move the left drawer or Gravity.RIGHT for the right.\n     *                Gravity.START or Gravity.END may also be used.\n     */\n    openDrawer(gravity:number):void;\n\n    openDrawer(arg:View|number):void{\n        if(arg instanceof View){\n            this._openDrawer_view(<View>arg);\n        }else{\n            this._openDrawer_gravity(<number>arg);\n        }\n    }\n    private _openDrawer_view(drawerView:View):void  {\n        if (!this.isDrawerView(drawerView)) {\n            throw Error(`new IllegalArgumentException(\"View \" + drawerView + \" is not a sliding drawer\")`);\n        }\n        if (this.mFirstLayout) {\n            const lp:DrawerLayout.LayoutParams = <DrawerLayout.LayoutParams> drawerView.getLayoutParams();\n            lp.onScreen = 1.;\n            lp.knownOpen = true;\n        } else {\n            if (this.checkDrawerViewAbsoluteGravity(drawerView, Gravity.LEFT)) {\n                this.mLeftDragger.smoothSlideViewTo(drawerView, 0, drawerView.getTop());\n            } else {\n                this.mRightDragger.smoothSlideViewTo(drawerView, this.getWidth() - drawerView.getWidth(), drawerView.getTop());\n            }\n        }\n        this.invalidate();\n    }\n\n    private _openDrawer_gravity(gravity:number):void  {\n        const drawerView:View = this.findDrawerWithGravity(gravity);\n        if (drawerView == null) {\n            throw Error(`new IllegalArgumentException(\"No drawer view found with gravity \" + DrawerLayout.gravityToString(gravity))`);\n        }\n        this.openDrawer(drawerView);\n    }\n\n    /**\n     * Close the specified drawer view by animating it into view.\n     *\n     * @param drawerView Drawer view to close\n     */\n    closeDrawer(drawerView:View):void;\n    /**\n     * Close the specified drawer by animating it out of view.\n     *\n     * @param gravity Gravity.LEFT to move the left drawer or Gravity.RIGHT for the right.\n     *                Gravity.START or Gravity.END may also be used.\n     */\n    closeDrawer(gravity:number):void;\n    closeDrawer(arg:View|number){\n        if(arg instanceof View){\n            this._closeDrawer_view(<View>arg);\n        }else{\n            this._closeDrawer_gravity(<number>arg);\n        }\n    }\n    private _closeDrawer_view(drawerView:View):void  {\n        if (!this.isDrawerView(drawerView)) {\n            throw Error(`new IllegalArgumentException(\"View \" + drawerView + \" is not a sliding drawer\")`);\n        }\n        if (this.mFirstLayout) {\n            const lp:DrawerLayout.LayoutParams = <DrawerLayout.LayoutParams> drawerView.getLayoutParams();\n            lp.onScreen = 0.;\n            lp.knownOpen = false;\n        } else {\n            if (this.checkDrawerViewAbsoluteGravity(drawerView, Gravity.LEFT)) {\n                this.mLeftDragger.smoothSlideViewTo(drawerView, -drawerView.getWidth(), drawerView.getTop());\n            } else {\n                this.mRightDragger.smoothSlideViewTo(drawerView, this.getWidth(), drawerView.getTop());\n            }\n        }\n        this.invalidate();\n    }\n\n    private _closeDrawer_gravity(gravity:number):void  {\n        const drawerView:View = this.findDrawerWithGravity(gravity);\n        if (drawerView == null) {\n            throw Error(`new IllegalArgumentException(\"No drawer view found with gravity \" + DrawerLayout.gravityToString(gravity))`);\n        }\n        this.closeDrawer(drawerView);\n    }\n\n    /**\n     * Check if the given drawer view is currently in an open state.\n     * To be considered \"open\" the drawer must have settled into its fully\n     * visible state. To check for partial visibility use\n     * {@link #isDrawerVisible(android.view.View)}.\n     *\n     * @param drawer Drawer view to check\n     * @return true if the given drawer view is in an open state\n     * @see #isDrawerVisible(android.view.View)\n     */\n    isDrawerOpen(drawer:View):boolean;\n    /**\n     * Check if the given drawer view is currently in an open state.\n     * To be considered \"open\" the drawer must have settled into its fully\n     * visible state. If there is no drawer with the given gravity this method\n     * will return false.\n     *\n     * @param drawerGravity Gravity of the drawer to check\n     * @return true if the given drawer view is in an open state\n     */\n    isDrawerOpen(drawerGravity:number):boolean;\n    isDrawerOpen(arg:View|number):boolean{\n        if(arg instanceof View){\n            return this._isDrawerOpen_view(<View>arg);\n        }else{\n            return this._isDrawerOpen_gravity(<number>arg);\n        }\n    }\n\n    private _isDrawerOpen_view(drawer:View):boolean  {\n        if (!this.isDrawerView(drawer)) {\n            throw Error(`new IllegalArgumentException(\"View \" + drawer + \" is not a drawer\")`);\n        }\n        return (<DrawerLayout.LayoutParams> drawer.getLayoutParams()).knownOpen;\n    }\n    private _isDrawerOpen_gravity(drawerGravity:number):boolean  {\n        const drawerView:View = this.findDrawerWithGravity(drawerGravity);\n        if (drawerView != null) {\n            return this.isDrawerOpen(drawerView);\n        }\n        return false;\n    }\n\n    /**\n     * Check if a given drawer view is currently visible on-screen. The drawer\n     * may be only peeking onto the screen, fully extended, or anywhere inbetween.\n     *\n     * @param drawer Drawer view to check\n     * @return true if the given drawer is visible on-screen\n     * @see #isDrawerOpen(android.view.View)\n     */\n    isDrawerVisible(drawer:View):boolean;\n\n    /**\n     * Check if a given drawer view is currently visible on-screen. The drawer\n     * may be only peeking onto the screen, fully extended, or anywhere inbetween.\n     * If there is no drawer with the given gravity this method will return false.\n     *\n     * @param drawerGravity Gravity of the drawer to check\n     * @return true if the given drawer is visible on-screen\n     */\n    isDrawerVisible(drawerGravity:number):boolean;\n    isDrawerVisible(arg:View|number):boolean{\n        if(arg instanceof View){\n            return this._isDrawerVisible_view(<View>arg);\n        }else{\n            return this._isDrawerVisible_gravity(<number>arg);\n        }\n    }\n\n    private _isDrawerVisible_view(drawer:View):boolean  {\n        if (!this.isDrawerView(drawer)) {\n            throw Error(`new IllegalArgumentException(\"View \" + drawer + \" is not a drawer\")`);\n        }\n        return (<DrawerLayout.LayoutParams> drawer.getLayoutParams()).onScreen > 0;\n    }\n    private _isDrawerVisible_gravity(drawerGravity:number):boolean  {\n        const drawerView:View = this.findDrawerWithGravity(drawerGravity);\n        if (drawerView != null) {\n            return this.isDrawerVisible(drawerView);\n        }\n        return false;\n    }\n\n    private hasPeekingDrawer():boolean  {\n        const childCount:number = this.getChildCount();\n        for (let i:number = 0; i < childCount; i++) {\n            const lp:DrawerLayout.LayoutParams = <DrawerLayout.LayoutParams> this.getChildAt(i).getLayoutParams();\n            if (lp.isPeeking) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    protected generateDefaultLayoutParams():ViewGroup.LayoutParams  {\n        return new DrawerLayout.LayoutParams(DrawerLayout.LayoutParams.FILL_PARENT, DrawerLayout.LayoutParams.FILL_PARENT);\n    }\n\n    protected generateLayoutParams(p:ViewGroup.LayoutParams):ViewGroup.LayoutParams  {\n        return p instanceof DrawerLayout.LayoutParams ? new DrawerLayout.LayoutParams(<DrawerLayout.LayoutParams> p)\n            : p instanceof ViewGroup.MarginLayoutParams ? new DrawerLayout.LayoutParams(<ViewGroup.MarginLayoutParams> p)\n            : new DrawerLayout.LayoutParams(p);\n    }\n\n    protected checkLayoutParams(p:ViewGroup.LayoutParams):boolean  {\n        return p instanceof DrawerLayout.LayoutParams && super.checkLayoutParams(p);\n    }\n\n    public generateLayoutParamsFromAttr(attrs: HTMLElement): android.view.ViewGroup.LayoutParams {\n        return new DrawerLayout.LayoutParams(this.getContext(), attrs);\n    }\n\n    private hasVisibleDrawer():boolean  {\n        return this.findVisibleDrawer() != null;\n    }\n\n    private findVisibleDrawer():View  {\n        const childCount:number = this.getChildCount();\n        for (let i:number = 0; i < childCount; i++) {\n            const child:View = this.getChildAt(i);\n            if (this.isDrawerView(child) && this.isDrawerVisible(child)) {\n                return child;\n            }\n        }\n        return null;\n    }\n\n    cancelChildViewTouch():void  {\n        // Cancel child touches\n        if (!this.mChildrenCanceledTouch) {\n            const now:number = SystemClock.uptimeMillis();\n            const cancelEvent:MotionEvent = MotionEvent.obtainWithAction(now, now, MotionEvent.ACTION_CANCEL, 0.0, 0.0, 0);\n            const childCount:number = this.getChildCount();\n            for (let i:number = 0; i < childCount; i++) {\n                this.getChildAt(i).dispatchTouchEvent(cancelEvent);\n            }\n            cancelEvent.recycle();\n            this.mChildrenCanceledTouch = true;\n        }\n    }\n\n    onKeyDown(keyCode:number, event:KeyEvent):boolean  {\n        if (keyCode == KeyEvent.KEYCODE_BACK && this.hasVisibleDrawer()) {\n            event.startTracking();\n            return true;\n        }\n        return super.onKeyDown(keyCode, event);\n    }\n\n    onKeyUp(keyCode:number, event:KeyEvent):boolean  {\n        if (keyCode == KeyEvent.KEYCODE_BACK) {\n            const visibleDrawer:View = this.findVisibleDrawer();\n            if (visibleDrawer != null && this.getDrawerLockMode(visibleDrawer) == DrawerLayout.LOCK_MODE_UNLOCKED) {\n                this.closeDrawers();\n            }\n            return visibleDrawer != null;\n        }\n        return super.onKeyUp(keyCode, event);\n    }\n\n}\n\nexport module DrawerLayout{\n    /**\n     * Listener for monitoring events about drawers.\n     */\nexport interface DrawerListener {\n\n    /**\n         * Called when a drawer's position changes.\n         * @param drawerView The child view that was moved\n         * @param slideOffset The new offset of this drawer within its range, from 0-1\n         */\n    onDrawerSlide(drawerView:View, slideOffset:number):void ;\n\n    /**\n         * Called when a drawer has settled in a completely open state.\n         * The drawer is interactive at this point.\n         *\n         * @param drawerView Drawer view that is now open\n         */\n    onDrawerOpened(drawerView:View):void ;\n\n    /**\n         * Called when a drawer has settled in a completely closed state.\n         *\n         * @param drawerView Drawer view that is now closed\n         */\n    onDrawerClosed(drawerView:View):void ;\n\n    /**\n         * Called when the drawer motion state changes. The new state will\n         * be one of {@link #STATE_IDLE}, {@link #STATE_DRAGGING} or {@link #STATE_SETTLING}.\n         *\n         * @param newState The new drawer motion state\n         */\n    onDrawerStateChanged(newState:number):void ;\n}\n/**\n     * Stub/no-op implementations of all methods of {@link DrawerListener}.\n     * Override this if you only care about a few of the available callback methods.\n     */\nexport class SimpleDrawerListener implements DrawerLayout.DrawerListener {\n\n    onDrawerSlide(drawerView:View, slideOffset:number):void  {\n    }\n\n    onDrawerOpened(drawerView:View):void  {\n    }\n\n    onDrawerClosed(drawerView:View):void  {\n    }\n\n    onDrawerStateChanged(newState:number):void  {\n    }\n}\nexport class ViewDragCallback extends ViewDragHelper.Callback {\n    _DrawerLayout_this:DrawerLayout;\n    constructor(arg:DrawerLayout, gravity:number){\n        super();\n        this._DrawerLayout_this = arg;\n        this.mAbsGravity = gravity;\n    }\n\n    private mAbsGravity:number = 0;\n\n    private mDragger:ViewDragHelper;\n\n    private mPeekRunnable:Runnable = (()=>{\n        const inner_this=this;\n        class _Inner implements Runnable {\n\n            run():void  {\n                inner_this.peekDrawer();\n            }\n        }\n        return new _Inner();\n    })();\n\n\n    setDragger(dragger:ViewDragHelper):void  {\n        this.mDragger = dragger;\n    }\n\n    removeCallbacks():void  {\n        this._DrawerLayout_this.removeCallbacks(this.mPeekRunnable);\n    }\n\n    tryCaptureView(child:View, pointerId:number):boolean  {\n        // This lets us use two ViewDragHelpers, one for each side drawer.\n        return this._DrawerLayout_this.isDrawerView(child) && this._DrawerLayout_this.checkDrawerViewAbsoluteGravity(child, this.mAbsGravity) && this._DrawerLayout_this.getDrawerLockMode(child) == DrawerLayout.LOCK_MODE_UNLOCKED;\n    }\n\n    onViewDragStateChanged(state:number):void  {\n        this._DrawerLayout_this.updateDrawerState(this.mAbsGravity, state, this.mDragger.getCapturedView());\n    }\n\n    onViewPositionChanged(changedView:View, left:number, top:number, dx:number, dy:number):void  {\n        let offset:number;\n        const childWidth:number = changedView.getWidth();\n        // This reverses the positioning shown in onLayout.\n        if (this._DrawerLayout_this.checkDrawerViewAbsoluteGravity(changedView, Gravity.LEFT)) {\n            offset = <number> (childWidth + left) / childWidth;\n        } else {\n            const width:number = this._DrawerLayout_this.getWidth();\n            offset = <number> (width - left) / childWidth;\n        }\n        this._DrawerLayout_this.setDrawerViewOffset(changedView, offset);\n        changedView.setVisibility(offset == 0 ? DrawerLayout.INVISIBLE : DrawerLayout.VISIBLE);\n        this._DrawerLayout_this.invalidate();\n    }\n\n    onViewCaptured(capturedChild:View, activePointerId:number):void  {\n        const lp:DrawerLayout.LayoutParams = <DrawerLayout.LayoutParams> capturedChild.getLayoutParams();\n        lp.isPeeking = false;\n        this.closeOtherDrawer();\n    }\n\n    private closeOtherDrawer():void  {\n        const otherGrav:number = this.mAbsGravity == Gravity.LEFT ? Gravity.RIGHT : Gravity.LEFT;\n        const toClose:View = this._DrawerLayout_this.findDrawerWithGravity(otherGrav);\n        if (toClose != null) {\n            this._DrawerLayout_this.closeDrawer(toClose);\n        }\n    }\n\n    onViewReleased(releasedChild:View, xvel:number, yvel:number):void  {\n        // Offset is how open the drawer is, therefore left/right values\n        // are reversed from one another.\n        const offset:number = this._DrawerLayout_this.getDrawerViewOffset(releasedChild);\n        const childWidth:number = releasedChild.getWidth();\n        let left:number;\n        if (this._DrawerLayout_this.checkDrawerViewAbsoluteGravity(releasedChild, Gravity.LEFT)) {\n            left = xvel > 0 || xvel == 0 && offset > 0.5 ? 0 : -childWidth;\n        } else {\n            const width:number = this._DrawerLayout_this.getWidth();\n            left = xvel < 0 || xvel == 0 && offset > 0.5 ? width - childWidth : width;\n        }\n        this.mDragger.settleCapturedViewAt(left, releasedChild.getTop());\n        this._DrawerLayout_this.invalidate();\n    }\n\n    onEdgeTouched(edgeFlags:number, pointerId:number):void  {\n        this._DrawerLayout_this.postDelayed(this.mPeekRunnable, DrawerLayout.PEEK_DELAY);\n    }\n\n    private peekDrawer():void  {\n        let toCapture:View;\n        let childLeft:number;\n        const peekDistance:number = this.mDragger.getEdgeSize();\n        const leftEdge:boolean = this.mAbsGravity == Gravity.LEFT;\n        if (leftEdge) {\n            toCapture = this._DrawerLayout_this.findDrawerWithGravity(Gravity.LEFT);\n            childLeft = (toCapture != null ? -toCapture.getWidth() : 0) + peekDistance;\n        } else {\n            toCapture = this._DrawerLayout_this.findDrawerWithGravity(Gravity.RIGHT);\n            childLeft = this._DrawerLayout_this.getWidth() - peekDistance;\n        }\n        // Only peek if it would mean making the drawer more visible and the drawer isn't locked\n        if (toCapture != null && ((leftEdge && toCapture.getLeft() < childLeft) || (!leftEdge && toCapture.getLeft() > childLeft)) && this._DrawerLayout_this.getDrawerLockMode(toCapture) == DrawerLayout.LOCK_MODE_UNLOCKED) {\n            const lp:DrawerLayout.LayoutParams = <DrawerLayout.LayoutParams> toCapture.getLayoutParams();\n            this.mDragger.smoothSlideViewTo(toCapture, childLeft, toCapture.getTop());\n            lp.isPeeking = true;\n            this._DrawerLayout_this.invalidate();\n            this.closeOtherDrawer();\n            this._DrawerLayout_this.cancelChildViewTouch();\n        }\n    }\n\n    onEdgeLock(edgeFlags:number):boolean  {\n        if (DrawerLayout.ALLOW_EDGE_LOCK) {\n            const drawer:View = this._DrawerLayout_this.findDrawerWithGravity(this.mAbsGravity);\n            if (drawer != null && !this._DrawerLayout_this.isDrawerOpen(drawer)) {\n                this._DrawerLayout_this.closeDrawer(drawer);\n            }\n            return true;\n        }\n        return false;\n    }\n\n    onEdgeDragStarted(edgeFlags:number, pointerId:number):void  {\n        let toCapture:View;\n        if ((edgeFlags & ViewDragHelper.EDGE_LEFT) == ViewDragHelper.EDGE_LEFT) {\n            toCapture = this._DrawerLayout_this.findDrawerWithGravity(Gravity.LEFT);\n        } else {\n            toCapture = this._DrawerLayout_this.findDrawerWithGravity(Gravity.RIGHT);\n        }\n        if (toCapture != null && this._DrawerLayout_this.getDrawerLockMode(toCapture) == DrawerLayout.LOCK_MODE_UNLOCKED) {\n            this.mDragger.captureChildView(toCapture, pointerId);\n        }\n    }\n\n    getViewHorizontalDragRange(child:View):number  {\n        return child.getWidth();\n    }\n\n    clampViewPositionHorizontal(child:View, left:number, dx:number):number  {\n        if (this._DrawerLayout_this.checkDrawerViewAbsoluteGravity(child, Gravity.LEFT)) {\n            return Math.max(-child.getWidth(), Math.min(left, 0));\n        } else {\n            const width:number = this._DrawerLayout_this.getWidth();\n            return Math.max(width - child.getWidth(), Math.min(left, width));\n        }\n    }\n\n    clampViewPositionVertical(child:View, top:number, dy:number):number  {\n        return child.getTop();\n    }\n}\nexport class LayoutParams extends ViewGroup.MarginLayoutParams {\n\n    gravity:number = Gravity.NO_GRAVITY;\n\n    onScreen:number = 0;\n\n    isPeeking:boolean;\n\n    knownOpen:boolean;\n\n    constructor(context:Context, attrs:HTMLElement);\n    constructor(width:number, height:number);\n    constructor(width:number, height:number, gravity:number);\n    constructor(source:ViewGroup.LayoutParams);\n    constructor(source:ViewGroup.MarginLayoutParams);\n    constructor(source:LayoutParams);\n    constructor(...args){\n        super(...(() => {\n            if (args[0] instanceof android.content.Context && args[1] instanceof HTMLElement) return [args[0], args[1]];\n            else if (typeof args[0] === 'number' && typeof args[1] === 'number' && typeof args[2] === 'number') return [args[0], args[1]];\n            else if (typeof args[0] === 'number' && typeof args[1] === 'number') return [args[0], args[1]];\n            else if (args[0] instanceof DrawerLayout.LayoutParams) return [args[0]];\n            else if (args[0] instanceof ViewGroup.MarginLayoutParams) return [args[0]];\n            else if (args[0] instanceof ViewGroup.LayoutParams) return [args[0]];\n        })());\n        if (args[0] instanceof Context && args[1] instanceof HTMLElement) {\n            const c = <Context>args[0];\n            const attrs = <HTMLElement>args[1];\n            const a = c.obtainStyledAttributes(attrs);\n            this.gravity = Gravity.parseGravity(a.getAttrValue('layout_gravity'), Gravity.NO_GRAVITY);\n            a.recycle();\n        } else if (typeof args[0] === 'number' && typeof args[1] === 'number' && typeof args[2] == 'number') {\n            this.gravity = args[2];\n        } else if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n        } else if (args[0] instanceof DrawerLayout.LayoutParams) {\n            const source = <DrawerLayout.LayoutParams>args[0];\n            this.gravity = source.gravity;\n        } else if (args[0] instanceof ViewGroup.MarginLayoutParams) {\n        } else if (args[0] instanceof ViewGroup.LayoutParams) {\n        }\n    }\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder().set('layout_gravity', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                param.gravity = attrBinder.parseGravity(value, param.gravity);\n            }, getter(param:LayoutParams) {\n                return param.gravity;\n            }\n        });\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/support/v4/widget/ViewDragHelper.ts",
    "content": "/*\n * Copyright (C) 2013 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../../../android/view/VelocityTracker.ts\"/>\n///<reference path=\"../../../../android/view/View.ts\"/>\n///<reference path=\"../../../../android/view/ViewConfiguration.ts\"/>\n///<reference path=\"../../../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../../../android/widget/OverScroller.ts\"/>\n///<reference path=\"../../../../android/view/animation/Interpolator.ts\"/>\n///<reference path=\"../../../../java/lang/System.ts\"/>\n\nmodule android.support.v4.widget {\nimport MotionEvent = android.view.MotionEvent;\nimport VelocityTracker = android.view.VelocityTracker;\nimport View = android.view.View;\nimport ViewConfiguration = android.view.ViewConfiguration;\nimport ViewGroup = android.view.ViewGroup;\nimport OverScroller = android.widget.OverScroller;\nimport Interpolator = android.view.animation.Interpolator;\nimport System = java.lang.System;\nimport Runnable = java.lang.Runnable;\n/**\n * ViewDragHelper is a utility class for writing custom ViewGroups. It offers a number\n * of useful operations and state tracking for allowing a user to drag and reposition\n * views within their parent ViewGroup.\n */\nexport class ViewDragHelper {\n\n    private static TAG:string = \"ViewDragHelper\";\n\n    /**\n     * A null/invalid pointer ID.\n     */\n    static INVALID_POINTER:number = -1;\n\n    /**\n     * A view is not currently being dragged or animating as a result of a fling/snap.\n     */\n    static STATE_IDLE:number = 0;\n\n    /**\n     * A view is currently being dragged. The position is currently changing as a result\n     * of user input or simulated user input.\n     */\n    static STATE_DRAGGING:number = 1;\n\n    /**\n     * A view is currently settling into place as a result of a fling or\n     * predefined non-interactive motion.\n     */\n    static STATE_SETTLING:number = 2;\n\n    /**\n     * Edge flag indicating that the left edge should be affected.\n     */\n    static EDGE_LEFT:number = 1 << 0;\n\n    /**\n     * Edge flag indicating that the right edge should be affected.\n     */\n    static EDGE_RIGHT:number = 1 << 1;\n\n    /**\n     * Edge flag indicating that the top edge should be affected.\n     */\n    static EDGE_TOP:number = 1 << 2;\n\n    /**\n     * Edge flag indicating that the bottom edge should be affected.\n     */\n    static EDGE_BOTTOM:number = 1 << 3;\n\n    /**\n     * Edge flag set indicating all edges should be affected.\n     */\n    static EDGE_ALL:number = ViewDragHelper.EDGE_LEFT | ViewDragHelper.EDGE_TOP | ViewDragHelper.EDGE_RIGHT | ViewDragHelper.EDGE_BOTTOM;\n\n    /**\n     * Indicates that a check should occur along the horizontal axis\n     */\n    static DIRECTION_HORIZONTAL:number = 1 << 0;\n\n    /**\n     * Indicates that a check should occur along the vertical axis\n     */\n    static DIRECTION_VERTICAL:number = 1 << 1;\n\n    /**\n     * Indicates that a check should occur along all axes\n     */\n    static DIRECTION_ALL:number = ViewDragHelper.DIRECTION_HORIZONTAL | ViewDragHelper.DIRECTION_VERTICAL;\n\n    // dp\n    private static EDGE_SIZE:number = 20;\n\n    // ms\n    private static BASE_SETTLE_DURATION:number = 256;\n\n    // ms\n    private static MAX_SETTLE_DURATION:number = 600;\n\n    // Current drag state; idle, dragging or settling\n    private mDragState:number = 0;\n\n    // Distance to travel before a drag may begin\n    private mTouchSlop:number = 0;\n\n    // Last known position/pointer tracking\n    private mActivePointerId:number = ViewDragHelper.INVALID_POINTER;\n\n    private mInitialMotionX:number[];\n\n    private mInitialMotionY:number[];\n\n    private mLastMotionX:number[];\n\n    private mLastMotionY:number[];\n\n    private mInitialEdgesTouched:number[];\n\n    private mEdgeDragsInProgress:number[];\n\n    private mEdgeDragsLocked:number[];\n\n    private mPointersDown:number = 0;\n\n    private mVelocityTracker:VelocityTracker;\n\n    private mMaxVelocity:number = 0;\n\n    private mMinVelocity:number = 0;\n\n    private mEdgeSize:number = 0;\n\n    private mTrackingEdges:number = 0;\n\n    private mScroller:OverScroller;\n\n    private mCallback:ViewDragHelper.Callback;\n\n    private mCapturedView:View;\n\n    private mReleaseInProgress:boolean;\n\n    private mParentView:ViewGroup;\n\n\n\n    /**\n     * Interpolator defining the animation curve for mScroller\n     */\n    private static sInterpolator:Interpolator = (()=>{\n        class _Inner implements Interpolator {\n            getInterpolation(t:number):number  {\n                t -= 1.0;\n                return t * t * t * t * t + 1.0;\n            }\n        }\n        return new _Inner();\n    })();\n\n    private mSetIdleRunnable:Runnable = (()=>{\n        const inner_this=this;\n        class _Inner implements Runnable {\n            run():void  {\n                inner_this.setDragState(ViewDragHelper.STATE_IDLE);\n            }\n        }\n        return new _Inner();\n    })();\n\n    /**\n     * Factory method to create a new ViewDragHelper.\n     *\n     * @param forParent Parent view to monitor\n     * @param cb Callback to provide information and receive events\n     * @param sensitivity Multiplier for how sensitive the helper should be about detecting\n     *                    the start of a drag. Larger values are more sensitive. 1.0f is normal.\n     * @return a new ViewDragHelper instance\n     */\n    static create(forParent:ViewGroup, cb:ViewDragHelper.Callback):ViewDragHelper;\n    static create(forParent:ViewGroup, sensitivity:number, cb:ViewDragHelper.Callback):ViewDragHelper;\n    static create(...args):ViewDragHelper {\n        if(args.length===2) return new ViewDragHelper(args[0], args[1]);\n        else if(args.length===3){\n            let [forParent, sensitivity, cb] = args;\n            const helper:ViewDragHelper = ViewDragHelper.create(forParent, cb);\n            helper.mTouchSlop = Math.floor((helper.mTouchSlop * (1 / sensitivity)));\n            return helper;\n        }\n    }\n\n    /**\n     * Apps should use ViewDragHelper.create() to get a new instance.\n     * This will allow VDH to use internal compatibility implementations for different\n     * platform versions.\n     *\n     * @param forParent Parent view to monitor\n     * @param cb Callback to provide information and receive events\n     */\n    constructor(forParent:ViewGroup, cb:ViewDragHelper.Callback) {\n        if (forParent == null) {\n            throw Error(`new IllegalArgumentException(\"Parent view may not be null\")`);\n        }\n        if (cb == null) {\n            throw Error(`new IllegalArgumentException(\"Callback may not be null\")`);\n        }\n        this.mParentView = forParent;\n        this.mCallback = cb;\n        const vc:ViewConfiguration = ViewConfiguration.get();\n        const density:number = android.content.res.Resources.getDisplayMetrics().density;\n        this.mEdgeSize = Math.floor((ViewDragHelper.EDGE_SIZE * density + 0.5));\n        this.mTouchSlop = vc.getScaledTouchSlop();\n        this.mMaxVelocity = vc.getScaledMaximumFlingVelocity();\n        this.mMinVelocity = vc.getScaledMinimumFlingVelocity();\n        this.mScroller = new OverScroller(ViewDragHelper.sInterpolator);\n    }\n\n    /**\n     * Set the minimum velocity that will be detected as having a magnitude greater than zero\n     * in pixels per second. Callback methods accepting a velocity will be clamped appropriately.\n     *\n     * @param minVel Minimum velocity to detect\n     */\n    setMinVelocity(minVel:number):void  {\n        this.mMinVelocity = minVel;\n    }\n\n    /**\n     * Return the currently configured minimum velocity. Any flings with a magnitude less\n     * than this value in pixels per second. Callback methods accepting a velocity will receive\n     * zero as a velocity value if the real detected velocity was below this threshold.\n     *\n     * @return the minimum velocity that will be detected\n     */\n    getMinVelocity():number  {\n        return this.mMinVelocity;\n    }\n\n    /**\n     * Retrieve the current drag state of this helper. This will return one of\n     * {@link #STATE_IDLE}, {@link #STATE_DRAGGING} or {@link #STATE_SETTLING}.\n     * @return The current drag state\n     */\n    getViewDragState():number  {\n        return this.mDragState;\n    }\n\n    /**\n     * Enable edge tracking for the selected edges of the parent view.\n     * The callback's {@link Callback#onEdgeTouched(int, int)} and\n     * {@link Callback#onEdgeDragStarted(int, int)} methods will only be invoked\n     * for edges for which edge tracking has been enabled.\n     *\n     * @param edgeFlags Combination of edge flags describing the edges to watch\n     * @see #EDGE_LEFT\n     * @see #EDGE_TOP\n     * @see #EDGE_RIGHT\n     * @see #EDGE_BOTTOM\n     */\n    setEdgeTrackingEnabled(edgeFlags:number):void  {\n        this.mTrackingEdges = edgeFlags;\n    }\n\n    /**\n     * Return the size of an edge. This is the range in pixels along the edges of this view\n     * that will actively detect edge touches or drags if edge tracking is enabled.\n     *\n     * @return The size of an edge in pixels\n     * @see #setEdgeTrackingEnabled(int)\n     */\n    getEdgeSize():number  {\n        return this.mEdgeSize;\n    }\n\n    /**\n     * Capture a specific child view for dragging within the parent. The callback will be notified\n     * but {@link Callback#tryCaptureView(android.view.View, int)} will not be asked permission to\n     * capture this view.\n     *\n     * @param childView Child view to capture\n     * @param activePointerId ID of the pointer that is dragging the captured child view\n     */\n    captureChildView(childView:View, activePointerId:number):void  {\n        if (childView.getParent() != this.mParentView) {\n            throw Error(`new IllegalArgumentException(\"captureChildView: parameter must be a descendant \" + \"of the ViewDragHelper's tracked parent view (\" + this.mParentView + \")\")`);\n        }\n        this.mCapturedView = childView;\n        this.mActivePointerId = activePointerId;\n        this.mCallback.onViewCaptured(childView, activePointerId);\n        this.setDragState(ViewDragHelper.STATE_DRAGGING);\n    }\n\n    /**\n     * @return The currently captured view, or null if no view has been captured.\n     */\n    getCapturedView():View  {\n        return this.mCapturedView;\n    }\n\n    /**\n     * @return The ID of the pointer currently dragging the captured view,\n     *         or {@link #INVALID_POINTER}.\n     */\n    getActivePointerId():number  {\n        return this.mActivePointerId;\n    }\n\n    /**\n     * @return The minimum distance in pixels that the user must travel to initiate a drag\n     */\n    getTouchSlop():number  {\n        return this.mTouchSlop;\n    }\n\n    /**\n     * The result of a call to this method is equivalent to\n     * {@link #processTouchEvent(android.view.MotionEvent)} receiving an ACTION_CANCEL event.\n     */\n    cancel():void  {\n        this.mActivePointerId = ViewDragHelper.INVALID_POINTER;\n        this.clearMotionHistory();\n        if (this.mVelocityTracker != null) {\n            this.mVelocityTracker.recycle();\n            this.mVelocityTracker = null;\n        }\n    }\n\n    /**\n     * {@link #cancel()}, but also abort all motion in progress and snap to the end of any\n     * animation.\n     */\n    abort():void  {\n        this.cancel();\n        if (this.mDragState == ViewDragHelper.STATE_SETTLING) {\n            const oldX:number = this.mScroller.getCurrX();\n            const oldY:number = this.mScroller.getCurrY();\n            this.mScroller.abortAnimation();\n            const newX:number = this.mScroller.getCurrX();\n            const newY:number = this.mScroller.getCurrY();\n            this.mCallback.onViewPositionChanged(this.mCapturedView, newX, newY, newX - oldX, newY - oldY);\n        }\n        this.setDragState(ViewDragHelper.STATE_IDLE);\n    }\n\n    /**\n     * Animate the view <code>child</code> to the given (left, top) position.\n     * If this method returns true, the caller should invoke {@link #continueSettling(boolean)}\n     * on each subsequent frame to continue the motion until it returns false. If this method\n     * returns false there is no further work to do to complete the movement.\n     *\n     * <p>This operation does not count as a capture event, though {@link #getCapturedView()}\n     * will still report the sliding view while the slide is in progress.</p>\n     *\n     * @param child Child view to capture and animate\n     * @param finalLeft Final left position of child\n     * @param finalTop Final top position of child\n     * @return true if animation should continue through {@link #continueSettling(boolean)} calls\n     */\n    smoothSlideViewTo(child:View, finalLeft:number, finalTop:number):boolean  {\n        this.mCapturedView = child;\n        this.mActivePointerId = ViewDragHelper.INVALID_POINTER;\n        return this.forceSettleCapturedViewAt(finalLeft, finalTop, 0, 0);\n    }\n\n    /**\n     * Settle the captured view at the given (left, top) position.\n     * The appropriate velocity from prior motion will be taken into account.\n     * If this method returns true, the caller should invoke {@link #continueSettling(boolean)}\n     * on each subsequent frame to continue the motion until it returns false. If this method\n     * returns false there is no further work to do to complete the movement.\n     *\n     * @param finalLeft Settled left edge position for the captured view\n     * @param finalTop Settled top edge position for the captured view\n     * @return true if animation should continue through {@link #continueSettling(boolean)} calls\n     */\n    settleCapturedViewAt(finalLeft:number, finalTop:number):boolean  {\n        if (!this.mReleaseInProgress) {\n            throw Error(`new IllegalStateException(\"Cannot settleCapturedViewAt outside of a call to \" + \"Callback#onViewReleased\")`);\n        }\n        return this.forceSettleCapturedViewAt(finalLeft, finalTop, Math.floor(this.mVelocityTracker.getXVelocity(this.mActivePointerId)), Math.floor(this.mVelocityTracker.getYVelocity(this.mActivePointerId)));\n    }\n\n    /**\n     * Settle the captured view at the given (left, top) position.\n     *\n     * @param finalLeft Target left position for the captured view\n     * @param finalTop Target top position for the captured view\n     * @param xvel Horizontal velocity\n     * @param yvel Vertical velocity\n     * @return true if animation should continue through {@link #continueSettling(boolean)} calls\n     */\n    private forceSettleCapturedViewAt(finalLeft:number, finalTop:number, xvel:number, yvel:number):boolean  {\n        const startLeft:number = this.mCapturedView.getLeft();\n        const startTop:number = this.mCapturedView.getTop();\n        const dx:number = finalLeft - startLeft;\n        const dy:number = finalTop - startTop;\n        if (dx == 0 && dy == 0) {\n            // Nothing to do. Send callbacks, be done.\n            this.mScroller.abortAnimation();\n            this.setDragState(ViewDragHelper.STATE_IDLE);\n            return false;\n        }\n        const duration:number = this.computeSettleDuration(this.mCapturedView, dx, dy, xvel, yvel);\n        this.mScroller.startScroll(startLeft, startTop, dx, dy, duration);\n        this.setDragState(ViewDragHelper.STATE_SETTLING);\n        return true;\n    }\n\n    private computeSettleDuration(child:View, dx:number, dy:number, xvel:number, yvel:number):number  {\n        xvel = this.clampMag(xvel, Math.floor(this.mMinVelocity), Math.floor(this.mMaxVelocity));\n        yvel = this.clampMag(yvel, Math.floor(this.mMinVelocity), Math.floor(this.mMaxVelocity));\n        const absDx:number = Math.abs(dx);\n        const absDy:number = Math.abs(dy);\n        const absXVel:number = Math.abs(xvel);\n        const absYVel:number = Math.abs(yvel);\n        const addedVel:number = absXVel + absYVel;\n        const addedDistance:number = absDx + absDy;\n        const xweight:number = xvel != 0 ? <number> absXVel / addedVel : <number> absDx / addedDistance;\n        const yweight:number = yvel != 0 ? <number> absYVel / addedVel : <number> absDy / addedDistance;\n        let xduration:number = this.computeAxisDuration(dx, xvel, this.mCallback.getViewHorizontalDragRange(child));\n        let yduration:number = this.computeAxisDuration(dy, yvel, this.mCallback.getViewVerticalDragRange(child));\n        return Math.floor((xduration * xweight + yduration * yweight));\n    }\n\n    private computeAxisDuration(delta:number, velocity:number, motionRange:number):number  {\n        if (delta == 0) {\n            return 0;\n        }\n        const width:number = this.mParentView.getWidth();\n        const halfWidth:number = width / 2;\n        const distanceRatio:number = Math.min(1, <number> Math.abs(delta) / width);\n        const distance:number = halfWidth + halfWidth * this.distanceInfluenceForSnapDuration(distanceRatio);\n        let duration:number;\n        velocity = Math.abs(velocity);\n        if (velocity > 0) {\n            duration = 4 * Math.round(1000 * Math.abs(distance / velocity));\n        } else {\n            const range:number = <number> Math.abs(delta) / motionRange;\n            duration = Math.floor(((range + 1) * ViewDragHelper.BASE_SETTLE_DURATION));\n        }\n        return Math.min(duration, ViewDragHelper.MAX_SETTLE_DURATION);\n    }\n\n    /**\n     * Clamp the magnitude of value for absMin and absMax.\n     * If the value is below the minimum, it will be clamped to zero.\n     * If the value is above the maximum, it will be clamped to the maximum.\n     *\n     * @param value Value to clamp\n     * @param absMin Absolute value of the minimum significant value to return\n     * @param absMax Absolute value of the maximum value to return\n     * @return The clamped value with the same sign as <code>value</code>\n     */\n    private clampMag(value:number, absMin:number, absMax:number):number  {\n        const absValue:number = Math.abs(value);\n        if (absValue < absMin)\n            return 0;\n        if (absValue > absMax)\n            return value > 0 ? absMax : -absMax;\n        return value;\n    }\n\n    private distanceInfluenceForSnapDuration(f:number):number  {\n        // center the values about 0.\n        f -= 0.5;\n        f *= 0.3 * Math.PI / 2.0;\n        return <number> Math.sin(f);\n    }\n\n    /**\n     * Settle the captured view based on standard free-moving fling behavior.\n     * The caller should invoke {@link #continueSettling(boolean)} on each subsequent frame\n     * to continue the motion until it returns false.\n     *\n     * @param minLeft Minimum X position for the view's left edge\n     * @param minTop Minimum Y position for the view's top edge\n     * @param maxLeft Maximum X position for the view's left edge\n     * @param maxTop Maximum Y position for the view's top edge\n     */\n    flingCapturedView(minLeft:number, minTop:number, maxLeft:number, maxTop:number):void  {\n        if (!this.mReleaseInProgress) {\n            throw Error(`new IllegalStateException(\"Cannot flingCapturedView outside of a call to \" + \"Callback#onViewReleased\")`);\n        }\n        this.mScroller.fling(this.mCapturedView.getLeft(), this.mCapturedView.getTop(),\n            Math.floor(this.mVelocityTracker.getXVelocity(this.mActivePointerId)),\n            Math.floor(this.mVelocityTracker.getYVelocity(this.mActivePointerId)), minLeft, maxLeft, minTop, maxTop);\n        this.setDragState(ViewDragHelper.STATE_SETTLING);\n    }\n\n    /**\n     * Move the captured settling view by the appropriate amount for the current time.\n     * If <code>continueSettling</code> returns true, the caller should call it again\n     * on the next frame to continue.\n     *\n     * @param deferCallbacks true if state callbacks should be deferred via posted message.\n     *                       Set this to true if you are calling this method from\n     *                       {@link android.view.View#computeScroll()} or similar methods\n     *                       invoked as part of layout or drawing.\n     * @return true if settle is still in progress\n     */\n    continueSettling(deferCallbacks:boolean):boolean  {\n        if (this.mDragState == ViewDragHelper.STATE_SETTLING) {\n            let keepGoing:boolean = this.mScroller.computeScrollOffset();\n            const x:number = this.mScroller.getCurrX();\n            const y:number = this.mScroller.getCurrY();\n            const dx:number = x - this.mCapturedView.getLeft();\n            const dy:number = y - this.mCapturedView.getTop();\n            if (dx != 0) {\n                this.mCapturedView.offsetLeftAndRight(dx);\n            }\n            if (dy != 0) {\n                this.mCapturedView.offsetTopAndBottom(dy);\n            }\n            if (dx != 0 || dy != 0) {\n                this.mCallback.onViewPositionChanged(this.mCapturedView, x, y, dx, dy);\n            }\n            if (keepGoing && x == this.mScroller.getFinalX() && y == this.mScroller.getFinalY()) {\n                // Close enough. The interpolator/scroller might think we're still moving\n                // but the user sure doesn't.\n                this.mScroller.abortAnimation();\n                keepGoing = this.mScroller.isFinished();\n            }\n            if (!keepGoing) {\n                if (deferCallbacks) {\n                    this.mParentView.post(this.mSetIdleRunnable);\n                } else {\n                    this.setDragState(ViewDragHelper.STATE_IDLE);\n                }\n            }\n        }\n        return this.mDragState == ViewDragHelper.STATE_SETTLING;\n    }\n\n    /**\n     * Like all callback events this must happen on the UI thread, but release\n     * involves some extra semantics. During a release (mReleaseInProgress)\n     * is the only time it is valid to call {@link #settleCapturedViewAt(int, int)}\n     * or {@link #flingCapturedView(int, int, int, int)}.\n     */\n    private dispatchViewReleased(xvel:number, yvel:number):void  {\n        this.mReleaseInProgress = true;\n        this.mCallback.onViewReleased(this.mCapturedView, xvel, yvel);\n        this.mReleaseInProgress = false;\n        if (this.mDragState == ViewDragHelper.STATE_DRAGGING) {\n            // onViewReleased didn't call a method that would have changed this. Go idle.\n            this.setDragState(ViewDragHelper.STATE_IDLE);\n        }\n    }\n\n    private clearMotionHistory(pointerId?:number):void  {\n        if (this.mInitialMotionX == null) {\n            return;\n        }\n        if(pointerId==null){\n            this.mInitialMotionX = [];\n            this.mInitialMotionY = [];\n            this.mLastMotionX = [];\n            this.mLastMotionY = [];\n            this.mInitialEdgesTouched = [];\n            this.mEdgeDragsInProgress = [];\n            this.mEdgeDragsLocked = [];\n            //for(let i=0,count=this.mInitialMotionX.length; i<count; i++) this.mInitialMotionX[i] = 0;\n            //for(let i=0,count=this.mInitialMotionY.length; i<count; i++) this.mInitialMotionY[i] = 0;\n            //for(let i=0,count=this.mLastMotionX.length; i<count; i++) this.mLastMotionX[i] = 0;\n            //for(let i=0,count=this.mLastMotionY.length; i<count; i++) this.mLastMotionY[i] = 0;\n            //for(let i=0,count=this.mInitialEdgesTouched.length; i<count; i++) this.mInitialEdgesTouched[i] = 0;\n            //for(let i=0,count=this.mEdgeDragsInProgress.length; i<count; i++) this.mEdgeDragsInProgress[i] = 0;\n            //for(let i=0,count=this.mEdgeDragsLocked.length; i<count; i++) this.mEdgeDragsLocked[i] = 0;\n            this.mPointersDown = 0;\n        }else {\n            this.mInitialMotionX[pointerId] = 0;\n            this.mInitialMotionY[pointerId] = 0;\n            this.mLastMotionX[pointerId] = 0;\n            this.mLastMotionY[pointerId] = 0;\n            this.mInitialEdgesTouched[pointerId] = 0;\n            this.mEdgeDragsInProgress[pointerId] = 0;\n            this.mEdgeDragsLocked[pointerId] = 0;\n            this.mPointersDown &= ~(1 << pointerId);\n        }\n    }\n\n    private ensureMotionHistorySizeForId(pointerId:number):void  {\n        if (this.mInitialMotionX == null || this.mInitialMotionX.length <= pointerId) {\n            let imx:number[] = androidui.util.ArrayCreator.newNumberArray(pointerId + 1);\n            let imy:number[] = androidui.util.ArrayCreator.newNumberArray(pointerId + 1);\n            let lmx:number[] = androidui.util.ArrayCreator.newNumberArray(pointerId + 1);\n            let lmy:number[] = androidui.util.ArrayCreator.newNumberArray(pointerId + 1);\n            let iit:number[] = androidui.util.ArrayCreator.newNumberArray(pointerId + 1);\n            let edip:number[] = androidui.util.ArrayCreator.newNumberArray(pointerId + 1);\n            let edl:number[] = androidui.util.ArrayCreator.newNumberArray(pointerId + 1);\n            if (this.mInitialMotionX != null) {\n                System.arraycopy(this.mInitialMotionX, 0, imx, 0, this.mInitialMotionX.length);\n                System.arraycopy(this.mInitialMotionY, 0, imy, 0, this.mInitialMotionY.length);\n                System.arraycopy(this.mLastMotionX, 0, lmx, 0, this.mLastMotionX.length);\n                System.arraycopy(this.mLastMotionY, 0, lmy, 0, this.mLastMotionY.length);\n                System.arraycopy(this.mInitialEdgesTouched, 0, iit, 0, this.mInitialEdgesTouched.length);\n                System.arraycopy(this.mEdgeDragsInProgress, 0, edip, 0, this.mEdgeDragsInProgress.length);\n                System.arraycopy(this.mEdgeDragsLocked, 0, edl, 0, this.mEdgeDragsLocked.length);\n            }\n            this.mInitialMotionX = imx;\n            this.mInitialMotionY = imy;\n            this.mLastMotionX = lmx;\n            this.mLastMotionY = lmy;\n            this.mInitialEdgesTouched = iit;\n            this.mEdgeDragsInProgress = edip;\n            this.mEdgeDragsLocked = edl;\n        }\n    }\n\n    private saveInitialMotion(x:number, y:number, pointerId:number):void  {\n        this.ensureMotionHistorySizeForId(pointerId);\n        this.mInitialMotionX[pointerId] = this.mLastMotionX[pointerId] = x;\n        this.mInitialMotionY[pointerId] = this.mLastMotionY[pointerId] = y;\n        this.mInitialEdgesTouched[pointerId] = this.getEdgesTouched(Math.floor(x), Math.floor(y));\n        this.mPointersDown |= 1 << pointerId;\n    }\n\n    private saveLastMotion(ev:MotionEvent):void  {\n        const pointerCount:number = ev.getPointerCount();\n        for (let i:number = 0; i < pointerCount; i++) {\n            const pointerId:number = ev.getPointerId(i);\n            const x:number = ev.getX(i);\n            const y:number = ev.getY(i);\n            this.mLastMotionX[pointerId] = x;\n            this.mLastMotionY[pointerId] = y;\n        }\n    }\n\n    /**\n     * Check if the given pointer ID represents a pointer that is currently down (to the best\n     * of the ViewDragHelper's knowledge).\n     *\n     * <p>The state used to report this information is populated by the methods\n     * {@link #shouldInterceptTouchEvent(android.view.MotionEvent)} or\n     * {@link #processTouchEvent(android.view.MotionEvent)}. If one of these methods has not\n     * been called for all relevant MotionEvents to track, the information reported\n     * by this method may be stale or incorrect.</p>\n     *\n     * @param pointerId pointer ID to check; corresponds to IDs provided by MotionEvent\n     * @return true if the pointer with the given ID is still down\n     */\n    isPointerDown(pointerId:number):boolean  {\n        return (this.mPointersDown & 1 << pointerId) != 0;\n    }\n\n    setDragState(state:number):void  {\n        if (this.mDragState != state) {\n            this.mDragState = state;\n            this.mCallback.onViewDragStateChanged(state);\n            if (state == ViewDragHelper.STATE_IDLE) {\n                this.mCapturedView = null;\n            }\n        }\n    }\n\n    /**\n     * Attempt to capture the view with the given pointer ID. The callback will be involved.\n     * This will put us into the \"dragging\" state. If we've already captured this view with\n     * this pointer this method will immediately return true without consulting the callback.\n     *\n     * @param toCapture View to capture\n     * @param pointerId Pointer to capture with\n     * @return true if capture was successful\n     */\n    tryCaptureViewForDrag(toCapture:View, pointerId:number):boolean  {\n        if (toCapture == this.mCapturedView && this.mActivePointerId == pointerId) {\n            // Already done!\n            return true;\n        }\n        if (toCapture != null && this.mCallback.tryCaptureView(toCapture, pointerId)) {\n            this.mActivePointerId = pointerId;\n            this.captureChildView(toCapture, pointerId);\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * Tests scrollability within child views of v given a delta of dx.\n     *\n     * @param v View to test for horizontal scrollability\n     * @param checkV Whether the view v passed should itself be checked for scrollability (true),\n     *               or just its children (false).\n     * @param dx Delta scrolled in pixels along the X axis\n     * @param dy Delta scrolled in pixels along the Y axis\n     * @param x X coordinate of the active touch point\n     * @param y Y coordinate of the active touch point\n     * @return true if child views of v can be scrolled by delta of dx.\n     */\n    protected canScroll(v:View, checkV:boolean, dx:number, dy:number, x:number, y:number):boolean  {\n        if (v instanceof ViewGroup) {\n            const group:ViewGroup = <ViewGroup> v;\n            const scrollX:number = v.getScrollX();\n            const scrollY:number = v.getScrollY();\n            const count:number = group.getChildCount();\n            // Count backwards - let topmost views consume scroll distance first.\n            for (let i:number = count - 1; i >= 0; i--) {\n                // TODO: Add versioned support here for transformed views.\n                // This will not work for transformed views in Honeycomb+\n                const child:View = group.getChildAt(i);\n                if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight()\n                    && y + scrollY >= child.getTop() && y + scrollY < child.getBottom()\n                    && this.canScroll(child, true, dx, dy, x + scrollX - child.getLeft(), y + scrollY - child.getTop())) {\n                    return true;\n                }\n            }\n        }\n        return checkV && (v.canScrollHorizontally(-dx) || v.canScrollVertically(-dy));\n    }\n\n    /**\n     * Check if this event as provided to the parent view's onInterceptTouchEvent should\n     * cause the parent to intercept the touch event stream.\n     *\n     * @param ev MotionEvent provided to onInterceptTouchEvent\n     * @return true if the parent view should return true from onInterceptTouchEvent\n     */\n    shouldInterceptTouchEvent(ev:MotionEvent):boolean  {\n        const action:number = ev.getActionMasked();\n        const actionIndex:number = ev.getActionIndex();\n        if (action == MotionEvent.ACTION_DOWN) {\n            // Reset things for a new event stream, just in case we didn't get\n            // the whole previous stream.\n            this.cancel();\n        }\n        if (this.mVelocityTracker == null) {\n            this.mVelocityTracker = VelocityTracker.obtain();\n        }\n        this.mVelocityTracker.addMovement(ev);\n        switch(action) {\n            case MotionEvent.ACTION_DOWN:\n                {\n                    const x:number = ev.getX();\n                    const y:number = ev.getY();\n                    const pointerId:number = ev.getPointerId(0);\n                    this.saveInitialMotion(x, y, pointerId);\n                    const toCapture:View = this.findTopChildUnder(Math.floor(x), Math.floor(y));\n                    // Catch a settling view if possible.\n                    if (toCapture == this.mCapturedView && this.mDragState == ViewDragHelper.STATE_SETTLING) {\n                        this.tryCaptureViewForDrag(toCapture, pointerId);\n                    }\n                    const edgesTouched:number = this.mInitialEdgesTouched[pointerId];\n                    if ((edgesTouched & this.mTrackingEdges) != 0) {\n                        this.mCallback.onEdgeTouched(edgesTouched & this.mTrackingEdges, pointerId);\n                    }\n                    break;\n                }\n            case MotionEvent.ACTION_POINTER_DOWN:\n                {\n                    const pointerId:number = ev.getPointerId(actionIndex);\n                    const x:number = ev.getX(actionIndex);\n                    const y:number = ev.getY(actionIndex);\n                    this.saveInitialMotion(x, y, pointerId);\n                    // A ViewDragHelper can only manipulate one view at a time.\n                    if (this.mDragState == ViewDragHelper.STATE_IDLE) {\n                        const edgesTouched:number = this.mInitialEdgesTouched[pointerId];\n                        if ((edgesTouched & this.mTrackingEdges) != 0) {\n                            this.mCallback.onEdgeTouched(edgesTouched & this.mTrackingEdges, pointerId);\n                        }\n                    } else if (this.mDragState == ViewDragHelper.STATE_SETTLING) {\n                        // Catch a settling view if possible.\n                        const toCapture:View = this.findTopChildUnder(Math.floor(x), Math.floor(y));\n                        if (toCapture == this.mCapturedView) {\n                            this.tryCaptureViewForDrag(toCapture, pointerId);\n                        }\n                    }\n                    break;\n                }\n            case MotionEvent.ACTION_MOVE:\n                {\n                    // First to cross a touch slop over a draggable view wins. Also report edge drags.\n                    const pointerCount:number = ev.getPointerCount();\n                    for (let i:number = 0; i < pointerCount; i++) {\n                        const pointerId:number = ev.getPointerId(i);\n                        const x:number = ev.getX(i);\n                        const y:number = ev.getY(i);\n                        const dx:number = x - this.mInitialMotionX[pointerId];\n                        const dy:number = y - this.mInitialMotionY[pointerId];\n                        this.reportNewEdgeDrags(dx, dy, pointerId);\n                        if (this.mDragState == ViewDragHelper.STATE_DRAGGING) {\n                            // Callback might have started an edge drag\n                            break;\n                        }\n                        const toCapture:View = this.findTopChildUnder(Math.floor(x), Math.floor(y));\n                        if (toCapture != null && this.checkTouchSlop(toCapture, dx, dy) && this.tryCaptureViewForDrag(toCapture, pointerId)) {\n                            break;\n                        }\n                    }\n                    this.saveLastMotion(ev);\n                    break;\n                }\n            case MotionEvent.ACTION_POINTER_UP:\n                {\n                    const pointerId:number = ev.getPointerId(actionIndex);\n                    this.clearMotionHistory(pointerId);\n                    break;\n                }\n            case MotionEvent.ACTION_UP:\n            case MotionEvent.ACTION_CANCEL:\n                {\n                    this.cancel();\n                    break;\n                }\n        }\n        return this.mDragState == ViewDragHelper.STATE_DRAGGING;\n    }\n\n    /**\n     * Process a touch event received by the parent view. This method will dispatch callback events\n     * as needed before returning. The parent view's onTouchEvent implementation should call this.\n     *\n     * @param ev The touch event received by the parent view\n     */\n    processTouchEvent(ev:MotionEvent):void  {\n        const action:number = ev.getActionMasked();\n        const actionIndex:number = ev.getActionIndex();\n        if (action == MotionEvent.ACTION_DOWN) {\n            // Reset things for a new event stream, just in case we didn't get\n            // the whole previous stream.\n            this.cancel();\n        }\n        if (this.mVelocityTracker == null) {\n            this.mVelocityTracker = VelocityTracker.obtain();\n        }\n        this.mVelocityTracker.addMovement(ev);\n        switch(action) {\n            case MotionEvent.ACTION_DOWN:\n                {\n                    const x:number = ev.getX();\n                    const y:number = ev.getY();\n                    const pointerId:number = ev.getPointerId(0);\n                    const toCapture:View = this.findTopChildUnder(Math.floor(x), Math.floor(y));\n                    this.saveInitialMotion(x, y, pointerId);\n                    // Since the parent is already directly processing this touch event,\n                    // there is no reason to delay for a slop before dragging.\n                    // Start immediately if possible.\n                    this.tryCaptureViewForDrag(toCapture, pointerId);\n                    const edgesTouched:number = this.mInitialEdgesTouched[pointerId];\n                    if ((edgesTouched & this.mTrackingEdges) != 0) {\n                        this.mCallback.onEdgeTouched(edgesTouched & this.mTrackingEdges, pointerId);\n                    }\n                    break;\n                }\n            case MotionEvent.ACTION_POINTER_DOWN:\n                {\n                    const pointerId:number = ev.getPointerId(actionIndex);\n                    const x:number = ev.getX(actionIndex);\n                    const y:number = ev.getY(actionIndex);\n                    this.saveInitialMotion(x, y, pointerId);\n                    // A ViewDragHelper can only manipulate one view at a time.\n                    if (this.mDragState == ViewDragHelper.STATE_IDLE) {\n                        // If we're idle we can do anything! Treat it like a normal down event.\n                        const toCapture:View = this.findTopChildUnder(Math.floor(x), Math.floor(y));\n                        this.tryCaptureViewForDrag(toCapture, pointerId);\n                        const edgesTouched:number = this.mInitialEdgesTouched[pointerId];\n                        if ((edgesTouched & this.mTrackingEdges) != 0) {\n                            this.mCallback.onEdgeTouched(edgesTouched & this.mTrackingEdges, pointerId);\n                        }\n                    } else if (this.isCapturedViewUnder(Math.floor(x), Math.floor(y))) {\n                        // We're still tracking a captured view. If the same view is under this\n                        // point, we'll swap to controlling it with this pointer instead.\n                        // (This will still work if we're \"catching\" a settling view.)\n                        this.tryCaptureViewForDrag(this.mCapturedView, pointerId);\n                    }\n                    break;\n                }\n            case MotionEvent.ACTION_MOVE:\n                {\n                    if (this.mDragState == ViewDragHelper.STATE_DRAGGING) {\n                        const index:number = ev.findPointerIndex(this.mActivePointerId);\n                        const x:number = ev.getX(index);\n                        const y:number = ev.getY(index);\n                        const idx:number = Math.floor((x - this.mLastMotionX[this.mActivePointerId]));\n                        const idy:number = Math.floor((y - this.mLastMotionY[this.mActivePointerId]));\n                        this.dragTo(this.mCapturedView.getLeft() + idx, this.mCapturedView.getTop() + idy, idx, idy);\n                        this.saveLastMotion(ev);\n                    } else {\n                        // Check to see if any pointer is now over a draggable view.\n                        const pointerCount:number = ev.getPointerCount();\n                        for (let i:number = 0; i < pointerCount; i++) {\n                            const pointerId:number = ev.getPointerId(i);\n                            const x:number = ev.getX(i);\n                            const y:number = ev.getY(i);\n                            const dx:number = x - this.mInitialMotionX[pointerId];\n                            const dy:number = y - this.mInitialMotionY[pointerId];\n                            this.reportNewEdgeDrags(dx, dy, pointerId);\n                            if (this.mDragState == ViewDragHelper.STATE_DRAGGING) {\n                                // Callback might have started an edge drag.\n                                break;\n                            }\n                            const toCapture:View = this.findTopChildUnder(Math.floor(x), Math.floor(y));\n                            if (this.checkTouchSlop(toCapture, dx, dy) && this.tryCaptureViewForDrag(toCapture, pointerId)) {\n                                break;\n                            }\n                        }\n                        this.saveLastMotion(ev);\n                    }\n                    break;\n                }\n            case MotionEvent.ACTION_POINTER_UP:\n                {\n                    const pointerId:number = ev.getPointerId(actionIndex);\n                    if (this.mDragState == ViewDragHelper.STATE_DRAGGING && pointerId == this.mActivePointerId) {\n                        // Try to find another pointer that's still holding on to the captured view.\n                        let newActivePointer:number = ViewDragHelper.INVALID_POINTER;\n                        const pointerCount:number = ev.getPointerCount();\n                        for (let i:number = 0; i < pointerCount; i++) {\n                            const id:number = ev.getPointerId(i);\n                            if (id == this.mActivePointerId) {\n                                // This one's going away, skip.\n                                continue;\n                            }\n                            const x:number = ev.getX(i);\n                            const y:number = ev.getY(i);\n                            if (this.findTopChildUnder(Math.floor(x), Math.floor(y)) == this.mCapturedView && this.tryCaptureViewForDrag(this.mCapturedView, id)) {\n                                newActivePointer = this.mActivePointerId;\n                                break;\n                            }\n                        }\n                        if (newActivePointer == ViewDragHelper.INVALID_POINTER) {\n                            // We didn't find another pointer still touching the view, release it.\n                            this.releaseViewForPointerUp();\n                        }\n                    }\n                    this.clearMotionHistory(pointerId);\n                    break;\n                }\n            case MotionEvent.ACTION_UP:\n                {\n                    if (this.mDragState == ViewDragHelper.STATE_DRAGGING) {\n                        this.releaseViewForPointerUp();\n                    }\n                    this.cancel();\n                    break;\n                }\n            case MotionEvent.ACTION_CANCEL:\n                {\n                    if (this.mDragState == ViewDragHelper.STATE_DRAGGING) {\n                        this.dispatchViewReleased(0, 0);\n                    }\n                    this.cancel();\n                    break;\n                }\n        }\n    }\n\n    private reportNewEdgeDrags(dx:number, dy:number, pointerId:number):void  {\n        let dragsStarted:number = 0;\n        if (this.checkNewEdgeDrag(dx, dy, pointerId, ViewDragHelper.EDGE_LEFT)) {\n            dragsStarted |= ViewDragHelper.EDGE_LEFT;\n        }\n        if (this.checkNewEdgeDrag(dy, dx, pointerId, ViewDragHelper.EDGE_TOP)) {\n            dragsStarted |= ViewDragHelper.EDGE_TOP;\n        }\n        if (this.checkNewEdgeDrag(dx, dy, pointerId, ViewDragHelper.EDGE_RIGHT)) {\n            dragsStarted |= ViewDragHelper.EDGE_RIGHT;\n        }\n        if (this.checkNewEdgeDrag(dy, dx, pointerId, ViewDragHelper.EDGE_BOTTOM)) {\n            dragsStarted |= ViewDragHelper.EDGE_BOTTOM;\n        }\n        if (dragsStarted != 0) {\n            this.mEdgeDragsInProgress[pointerId] |= dragsStarted;\n            this.mCallback.onEdgeDragStarted(dragsStarted, pointerId);\n        }\n    }\n\n    private checkNewEdgeDrag(delta:number, odelta:number, pointerId:number, edge:number):boolean  {\n        const absDelta:number = Math.abs(delta);\n        const absODelta:number = Math.abs(odelta);\n        if ((this.mInitialEdgesTouched[pointerId] & edge) != edge || (this.mTrackingEdges & edge) == 0 || (this.mEdgeDragsLocked[pointerId] & edge) == edge || (this.mEdgeDragsInProgress[pointerId] & edge) == edge || (absDelta <= this.mTouchSlop && absODelta <= this.mTouchSlop)) {\n            return false;\n        }\n        if (absDelta < absODelta * 0.5 && this.mCallback.onEdgeLock(edge)) {\n            this.mEdgeDragsLocked[pointerId] |= edge;\n            return false;\n        }\n        return (this.mEdgeDragsInProgress[pointerId] & edge) == 0 && absDelta > this.mTouchSlop;\n    }\n\n\n    checkTouchSlop(child:View, dx:number, dy:number):boolean;\n    checkTouchSlop(directions:number):boolean;\n    checkTouchSlop(directions:number, pointerId:number):boolean;\n    checkTouchSlop(...args):boolean {\n        if(args.length===1) return this._checkTouchSlop_1(args[0]);\n        if(args.length===2) return this._checkTouchSlop_2(args[0], args[1]);\n        if(args.length===3) return this._checkTouchSlop_3(args[0], args[1], args[2]);\n        return false;\n    }\n    /**\n     * Check if we've crossed a reasonable touch slop for the given child view.\n     * If the child cannot be dragged along the horizontal or vertical axis, motion\n     * along that axis will not count toward the slop check.\n     *\n     * @param child Child to check\n     * @param dx Motion since initial position along X axis\n     * @param dy Motion since initial position along Y axis\n     * @return true if the touch slop has been crossed\n     */\n    private _checkTouchSlop_3(child:View, dx:number, dy:number):boolean  {\n        if (child == null) {\n            return false;\n        }\n        const checkHorizontal:boolean = this.mCallback.getViewHorizontalDragRange(child) > 0;\n        const checkVertical:boolean = this.mCallback.getViewVerticalDragRange(child) > 0;\n        if (checkHorizontal && checkVertical) {\n            return dx * dx + dy * dy > this.mTouchSlop * this.mTouchSlop;\n        } else if (checkHorizontal) {\n            return Math.abs(dx) > this.mTouchSlop;\n        } else if (checkVertical) {\n            return Math.abs(dy) > this.mTouchSlop;\n        }\n        return false;\n    }\n\n    /**\n     * Check if any pointer tracked in the current gesture has crossed\n     * the required slop threshold.\n     *\n     * <p>This depends on internal state populated by\n     * {@link #shouldInterceptTouchEvent(android.view.MotionEvent)} or\n     * {@link #processTouchEvent(android.view.MotionEvent)}. You should only rely on\n     * the results of this method after all currently available touch data\n     * has been provided to one of these two methods.</p>\n     *\n     * @param directions Combination of direction flags, see {@link #DIRECTION_HORIZONTAL},\n     *                   {@link #DIRECTION_VERTICAL}, {@link #DIRECTION_ALL}\n     * @return true if the slop threshold has been crossed, false otherwise\n     */\n    private _checkTouchSlop_1(directions:number):boolean  {\n        const count:number = this.mInitialMotionX.length;\n        for (let i:number = 0; i < count; i++) {\n            if (this.checkTouchSlop(directions, i)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    /**\n     * Check if the specified pointer tracked in the current gesture has crossed\n     * the required slop threshold.\n     *\n     * <p>This depends on internal state populated by\n     * {@link #shouldInterceptTouchEvent(android.view.MotionEvent)} or\n     * {@link #processTouchEvent(android.view.MotionEvent)}. You should only rely on\n     * the results of this method after all currently available touch data\n     * has been provided to one of these two methods.</p>\n     *\n     * @param directions Combination of direction flags, see {@link #DIRECTION_HORIZONTAL},\n     *                   {@link #DIRECTION_VERTICAL}, {@link #DIRECTION_ALL}\n     * @param pointerId ID of the pointer to slop check as specified by MotionEvent\n     * @return true if the slop threshold has been crossed, false otherwise\n     */\n    private _checkTouchSlop_2(directions:number, pointerId:number):boolean  {\n        if (!this.isPointerDown(pointerId)) {\n            return false;\n        }\n        const checkHorizontal:boolean = (directions & ViewDragHelper.DIRECTION_HORIZONTAL) == ViewDragHelper.DIRECTION_HORIZONTAL;\n        const checkVertical:boolean = (directions & ViewDragHelper.DIRECTION_VERTICAL) == ViewDragHelper.DIRECTION_VERTICAL;\n        const dx:number = this.mLastMotionX[pointerId] - this.mInitialMotionX[pointerId];\n        const dy:number = this.mLastMotionY[pointerId] - this.mInitialMotionY[pointerId];\n        if (checkHorizontal && checkVertical) {\n            return dx * dx + dy * dy > this.mTouchSlop * this.mTouchSlop;\n        } else if (checkHorizontal) {\n            return Math.abs(dx) > this.mTouchSlop;\n        } else if (checkVertical) {\n            return Math.abs(dy) > this.mTouchSlop;\n        }\n        return false;\n    }\n\n    /**\n     * Check if any of the edges specified were initially touched by the pointer with\n     * the specified ID. If there is no currently active gesture or if there is no pointer with\n     * the given ID currently down this method will return false.\n     *\n     * @param edges Edges to check for an initial edge touch. See {@link #EDGE_LEFT},\n     *              {@link #EDGE_TOP}, {@link #EDGE_RIGHT}, {@link #EDGE_BOTTOM} and\n     *              {@link #EDGE_ALL}\n     * @return true if any of the edges specified were initially touched in the current gesture\n     */\n    isEdgeTouched(edges:number, pointerId?:number):boolean  {\n        if(pointerId==null) {\n            const count:number = this.mInitialEdgesTouched.length;\n            for (let i:number = 0; i < count; i++) {\n                if (this.isEdgeTouched(edges, i)) {\n                    return true;\n                }\n            }\n        }\n        return this.isPointerDown(pointerId) && (this.mInitialEdgesTouched[pointerId] & edges) != 0;\n    }\n\n    private releaseViewForPointerUp():void  {\n        this.mVelocityTracker.computeCurrentVelocity(1000, this.mMaxVelocity);\n        const xvel:number = this.clampMag(this.mVelocityTracker.getXVelocity(this.mActivePointerId), this.mMinVelocity, this.mMaxVelocity);\n        const yvel:number = this.clampMag(this.mVelocityTracker.getYVelocity(this.mActivePointerId), this.mMinVelocity, this.mMaxVelocity);\n        this.dispatchViewReleased(xvel, yvel);\n    }\n\n    private dragTo(left:number, top:number, dx:number, dy:number):void  {\n        let clampedX:number = left;\n        let clampedY:number = top;\n        const oldLeft:number = this.mCapturedView.getLeft();\n        const oldTop:number = this.mCapturedView.getTop();\n        if (dx != 0) {\n            clampedX = this.mCallback.clampViewPositionHorizontal(this.mCapturedView, left, dx);\n            this.mCapturedView.offsetLeftAndRight(clampedX - oldLeft);\n        }\n        if (dy != 0) {\n            clampedY = this.mCallback.clampViewPositionVertical(this.mCapturedView, top, dy);\n            this.mCapturedView.offsetTopAndBottom(clampedY - oldTop);\n        }\n        if (dx != 0 || dy != 0) {\n            const clampedDx:number = clampedX - oldLeft;\n            const clampedDy:number = clampedY - oldTop;\n            this.mCallback.onViewPositionChanged(this.mCapturedView, clampedX, clampedY, clampedDx, clampedDy);\n        }\n    }\n\n    /**\n     * Determine if the currently captured view is under the given point in the\n     * parent view's coordinate system. If there is no captured view this method\n     * will return false.\n     *\n     * @param x X position to test in the parent's coordinate system\n     * @param y Y position to test in the parent's coordinate system\n     * @return true if the captured view is under the given point, false otherwise\n     */\n    isCapturedViewUnder(x:number, y:number):boolean  {\n        return this.isViewUnder(this.mCapturedView, x, y);\n    }\n\n    /**\n     * Determine if the supplied view is under the given point in the\n     * parent view's coordinate system.\n     *\n     * @param view Child view of the parent to hit test\n     * @param x X position to test in the parent's coordinate system\n     * @param y Y position to test in the parent's coordinate system\n     * @return true if the supplied view is under the given point, false otherwise\n     */\n    isViewUnder(view:View, x:number, y:number):boolean  {\n        if (view == null) {\n            return false;\n        }\n        return x >= view.getLeft() && x < view.getRight() && y >= view.getTop() && y < view.getBottom();\n    }\n\n    /**\n     * Find the topmost child under the given point within the parent view's coordinate system.\n     * The child order is determined using {@link Callback#getOrderedChildIndex(int)}.\n     *\n     * @param x X position to test in the parent's coordinate system\n     * @param y Y position to test in the parent's coordinate system\n     * @return The topmost child view under (x, y) or null if none found.\n     */\n    findTopChildUnder(x:number, y:number):View  {\n        const childCount:number = this.mParentView.getChildCount();\n        for (let i:number = childCount - 1; i >= 0; i--) {\n            const child:View = this.mParentView.getChildAt(this.mCallback.getOrderedChildIndex(i));\n            if (x >= child.getLeft() && x < child.getRight() && y >= child.getTop() && y < child.getBottom()) {\n                return child;\n            }\n        }\n        return null;\n    }\n\n    private getEdgesTouched(x:number, y:number):number  {\n        let result:number = 0;\n        if (x < this.mParentView.getLeft() + this.mEdgeSize)\n            result |= ViewDragHelper.EDGE_LEFT;\n        if (y < this.mParentView.getTop() + this.mEdgeSize)\n            result |= ViewDragHelper.EDGE_TOP;\n        if (x > this.mParentView.getRight() - this.mEdgeSize)\n            result |= ViewDragHelper.EDGE_RIGHT;\n        if (y > this.mParentView.getBottom() - this.mEdgeSize)\n            result |= ViewDragHelper.EDGE_BOTTOM;\n        return result;\n    }\n}\n\nexport module ViewDragHelper{\n/**\n     * A Callback is used as a communication channel with the ViewDragHelper back to the\n     * parent view using it. <code>on*</code>methods are invoked on siginficant events and several\n     * accessor methods are expected to provide the ViewDragHelper with more information\n     * about the state of the parent view upon request. The callback also makes decisions\n     * governing the range and draggability of child views.\n     */\nexport abstract class Callback {\n\n    /**\n         * Called when the drag state changes. See the <code>STATE_*</code> constants\n         * for more information.\n         *\n         * @param state The new drag state\n         *\n         * @see #STATE_IDLE\n         * @see #STATE_DRAGGING\n         * @see #STATE_SETTLING\n         */\n    onViewDragStateChanged(state:number):void  {\n    }\n\n    /**\n         * Called when the captured view's position changes as the result of a drag or settle.\n         *\n         * @param changedView View whose position changed\n         * @param left New X coordinate of the left edge of the view\n         * @param top New Y coordinate of the top edge of the view\n         * @param dx Change in X position from the last call\n         * @param dy Change in Y position from the last call\n         */\n    onViewPositionChanged(changedView:View, left:number, top:number, dx:number, dy:number):void  {\n    }\n\n    /**\n         * Called when a child view is captured for dragging or settling. The ID of the pointer\n         * currently dragging the captured view is supplied. If activePointerId is\n         * identified as {@link #INVALID_POINTER} the capture is programmatic instead of\n         * pointer-initiated.\n         *\n         * @param capturedChild Child view that was captured\n         * @param activePointerId Pointer id tracking the child capture\n         */\n    onViewCaptured(capturedChild:View, activePointerId:number):void  {\n    }\n\n    /**\n         * Called when the child view is no longer being actively dragged.\n         * The fling velocity is also supplied, if relevant. The velocity values may\n         * be clamped to system minimums or maximums.\n         *\n         * <p>Calling code may decide to fling or otherwise release the view to let it\n         * settle into place. It should do so using {@link #settleCapturedViewAt(int, int)}\n         * or {@link #flingCapturedView(int, int, int, int)}. If the Callback invokes\n         * one of these methods, the ViewDragHelper will enter {@link #STATE_SETTLING}\n         * and the view capture will not fully end until it comes to a complete stop.\n         * If neither of these methods is invoked before <code>onViewReleased</code> returns,\n         * the view will stop in place and the ViewDragHelper will return to\n         * {@link #STATE_IDLE}.</p>\n         *\n         * @param releasedChild The captured child view now being released\n         * @param xvel X velocity of the pointer as it left the screen in pixels per second.\n         * @param yvel Y velocity of the pointer as it left the screen in pixels per second.\n         */\n    onViewReleased(releasedChild:View, xvel:number, yvel:number):void  {\n    }\n\n    /**\n         * Called when one of the subscribed edges in the parent view has been touched\n         * by the user while no child view is currently captured.\n         *\n         * @param edgeFlags A combination of edge flags describing the edge(s) currently touched\n         * @param pointerId ID of the pointer touching the described edge(s)\n         * @see #EDGE_LEFT\n         * @see #EDGE_TOP\n         * @see #EDGE_RIGHT\n         * @see #EDGE_BOTTOM\n         */\n    onEdgeTouched(edgeFlags:number, pointerId:number):void  {\n    }\n\n    /**\n         * Called when the given edge may become locked. This can happen if an edge drag\n         * was preliminarily rejected before beginning, but after {@link #onEdgeTouched(int, int)}\n         * was called. This method should return true to lock this edge or false to leave it\n         * unlocked. The default behavior is to leave edges unlocked.\n         *\n         * @param edgeFlags A combination of edge flags describing the edge(s) locked\n         * @return true to lock the edge, false to leave it unlocked\n         */\n    onEdgeLock(edgeFlags:number):boolean  {\n        return false;\n    }\n\n    /**\n         * Called when the user has started a deliberate drag away from one\n         * of the subscribed edges in the parent view while no child view is currently captured.\n         *\n         * @param edgeFlags A combination of edge flags describing the edge(s) dragged\n         * @param pointerId ID of the pointer touching the described edge(s)\n         * @see #EDGE_LEFT\n         * @see #EDGE_TOP\n         * @see #EDGE_RIGHT\n         * @see #EDGE_BOTTOM\n         */\n    onEdgeDragStarted(edgeFlags:number, pointerId:number):void  {\n    }\n\n    /**\n         * Called to determine the Z-order of child views.\n         *\n         * @param index the ordered position to query for\n         * @return index of the view that should be ordered at position <code>index</code>\n         */\n    getOrderedChildIndex(index:number):number  {\n        return index;\n    }\n\n    /**\n         * Return the magnitude of a draggable child view's horizontal range of motion in pixels.\n         * This method should return 0 for views that cannot move horizontally.\n         *\n         * @param child Child view to check\n         * @return range of horizontal motion in pixels\n         */\n    getViewHorizontalDragRange(child:View):number  {\n        return 0;\n    }\n\n    /**\n         * Return the magnitude of a draggable child view's vertical range of motion in pixels.\n         * This method should return 0 for views that cannot move vertically.\n         *\n         * @param child Child view to check\n         * @return range of vertical motion in pixels\n         */\n    getViewVerticalDragRange(child:View):number  {\n        return 0;\n    }\n\n    /**\n         * Called when the user's input indicates that they want to capture the given child view\n         * with the pointer indicated by pointerId. The callback should return true if the user\n         * is permitted to drag the given view with the indicated pointer.\n         *\n         * <p>ViewDragHelper may call this method multiple times for the same view even if\n         * the view is already captured; this indicates that a new pointer is trying to take\n         * control of the view.</p>\n         *\n         * <p>If this method returns true, a call to {@link #onViewCaptured(android.view.View, int)}\n         * will follow if the capture is successful.</p>\n         *\n         * @param child Child the user is attempting to capture\n         * @param pointerId ID of the pointer attempting the capture\n         * @return true if capture should be allowed, false otherwise\n         */\n    abstract tryCaptureView(child:View, pointerId:number):boolean ;\n\n    /**\n         * Restrict the motion of the dragged child view along the horizontal axis.\n         * The default implementation does not allow horizontal motion; the extending\n         * class must override this method and provide the desired clamping.\n         *\n         *\n         * @param child Child view being dragged\n         * @param left Attempted motion along the X axis\n         * @param dx Proposed change in position for left\n         * @return The new clamped position for left\n         */\n    clampViewPositionHorizontal(child:View, left:number, dx:number):number  {\n        return 0;\n    }\n\n    /**\n         * Restrict the motion of the dragged child view along the vertical axis.\n         * The default implementation does not allow vertical motion; the extending\n         * class must override this method and provide the desired clamping.\n         *\n         *\n         * @param child Child view being dragged\n         * @param top Attempted motion along the Y axis\n         * @param dy Proposed change in position for top\n         * @return The new clamped position for top\n         */\n    clampViewPositionVertical(child:View, top:number, dy:number):number  {\n        return 0;\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/text/BoringLayout.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../android/graphics/Path.ts\"/>\n///<reference path=\"../../android/text/style/ParagraphStyle.ts\"/>\n///<reference path=\"../../android/text/Layout.ts\"/>\n///<reference path=\"../../android/text/Spanned.ts\"/>\n///<reference path=\"../../android/text/TextDirectionHeuristic.ts\"/>\n///<reference path=\"../../android/text/TextDirectionHeuristics.ts\"/>\n///<reference path=\"../../android/text/TextLine.ts\"/>\n///<reference path=\"../../android/text/TextPaint.ts\"/>\n///<reference path=\"../../android/text/TextUtils.ts\"/>\n\nmodule android.text {\nimport Canvas = android.graphics.Canvas;\nimport Paint = android.graphics.Paint;\nimport Path = android.graphics.Path;\nimport ParagraphStyle = android.text.style.ParagraphStyle;\nimport Layout = android.text.Layout;\nimport Spanned = android.text.Spanned;\nimport TextDirectionHeuristic = android.text.TextDirectionHeuristic;\nimport TextDirectionHeuristics = android.text.TextDirectionHeuristics;\nimport TextLine = android.text.TextLine;\nimport TextPaint = android.text.TextPaint;\nimport TextUtils = android.text.TextUtils;\n/**\n * A BoringLayout is a very simple Layout implementation for text that\n * fits on a single line and is all left-to-right characters.\n * You will probably never want to make one of these yourself;\n * if you do, be sure to call {@link #isBoring} first to make sure\n * the text meets the criteria.\n * <p>This class is used by widgets to control text layout. You should not need\n * to use this class directly unless you are implementing your own widget\n * or custom display object, in which case\n * you are encouraged to use a Layout instead of calling\n * {@link android.graphics.Canvas#drawText(java.lang.CharSequence, int, int, float, float, android.graphics.Paint)\n *  Canvas.drawText()} directly.</p>\n */\nexport class BoringLayout extends Layout implements TextUtils.EllipsizeCallback {\n\n    static make(source:String, paint:TextPaint, outerwidth:number, align:Layout.Alignment, spacingmult:number, spacingadd:number,\n                metrics:BoringLayout.Metrics, includepad:boolean, ellipsize:TextUtils.TruncateAt=null, ellipsizedWidth:number=outerwidth):BoringLayout  {\n        return new BoringLayout(source, paint, outerwidth, align, spacingmult, spacingadd, metrics, includepad, ellipsize, ellipsizedWidth);\n    }\n\n    /**\n     * Returns a BoringLayout for the specified text, potentially reusing\n     * this one if it is already suitable.  The caller must make sure that\n     * no one is still using this Layout.\n     */\n    replaceOrMake(source:String, paint:TextPaint, outerwidth:number, align:Layout.Alignment, spacingmult:number, spacingadd:number,\n                  metrics:BoringLayout.Metrics, includepad:boolean, ellipsize:TextUtils.TruncateAt=null, ellipsizedWidth:number=outerwidth):BoringLayout  {\n        let trust:boolean;\n        if (ellipsize == null || ellipsize == TextUtils.TruncateAt.MARQUEE) {\n            this.replaceWith(source, paint, outerwidth, align, spacingmult, spacingadd);\n            this.mEllipsizedWidth = outerwidth;\n            this.mEllipsizedStart = 0;\n            this.mEllipsizedCount = 0;\n            trust = true;\n        } else {\n            this.replaceWith(TextUtils.ellipsize(source, paint, ellipsizedWidth, ellipsize, true, this), paint, outerwidth, align, spacingmult, spacingadd);\n            this.mEllipsizedWidth = ellipsizedWidth;\n            trust = false;\n        }\n        this.init(this.getText(), paint, outerwidth, align, spacingmult, spacingadd, metrics, includepad, trust);\n        return this;\n    }\n\n    constructor( source:String, paint:TextPaint, outerwidth:number, align:Layout.Alignment, spacingmult:number, spacingadd:number,\n                 metrics:BoringLayout.Metrics, includepad:boolean, ellipsize:TextUtils.TruncateAt=null, ellipsizedWidth:number=outerwidth) {\n        /*\n         * It is silly to have to call super() and then replaceWith(),\n         * but we can't use \"this\" for the callback until the call to\n         * super() finishes.\n         */\n        super(source, paint, outerwidth, align, TextDirectionHeuristics.FIRSTSTRONG_LTR, spacingmult, spacingadd);\n        let trust:boolean;\n        if (ellipsize == null || ellipsize == TextUtils.TruncateAt.MARQUEE) {\n            this.mEllipsizedWidth = outerwidth;\n            this.mEllipsizedStart = 0;\n            this.mEllipsizedCount = 0;\n            trust = true;\n        } else {\n            this.replaceWith(TextUtils.ellipsize(source, paint, ellipsizedWidth, ellipsize, true, this), paint, outerwidth, align, spacingmult, spacingadd);\n            this.mEllipsizedWidth = ellipsizedWidth;\n            trust = false;\n        }\n        this.init(this.getText(), paint, outerwidth, align, spacingmult, spacingadd, metrics, includepad, trust);\n    }\n\n    /* package */\n    init(source:String, paint:TextPaint, outerwidth:number, align:Layout.Alignment, spacingmult:number,\n         spacingadd:number, metrics:BoringLayout.Metrics, includepad:boolean, trustWidth:boolean):void  {\n        let spacing:number;\n        if (Object.getPrototypeOf(source) === String.prototype && align == Layout.Alignment.ALIGN_NORMAL) {\n            this.mDirect = source.toString();\n        } else {\n            this.mDirect = null;\n        }\n        this.mPaint = paint;\n        if (includepad) {\n            spacing = metrics.bottom - metrics.top;\n        } else {\n            spacing = metrics.descent - metrics.ascent;\n        }\n        if (spacingmult != 1 || spacingadd != 0) {\n            spacing = Math.floor((spacing * spacingmult + spacingadd + 0.5));\n        }\n        this.mBottom = spacing;\n        if (includepad) {\n            this.mDesc = spacing + metrics.top;\n        } else {\n            this.mDesc = spacing + metrics.ascent;\n        }\n        if (trustWidth) {\n            this.mMax = metrics.width;\n        } else {\n            /*\n             * If we have ellipsized, we have to actually calculate the\n             * width because the width that was passed in was for the\n             * full text, not the ellipsized form.\n             */\n            let line:TextLine = TextLine.obtain();\n            line.set(paint, source, 0, source.length, Layout.DIR_LEFT_TO_RIGHT, Layout.DIRS_ALL_LEFT_TO_RIGHT, false, null);\n            this.mMax = Math.floor(Math.ceil(line.metrics(null)));\n            TextLine.recycle(line);\n        }\n        if (includepad) {\n            this.mTopPadding = metrics.top - metrics.ascent;\n            this.mBottomPadding = metrics.bottom - metrics.descent;\n        }\n    }\n\n    /**\n     * Returns null if not boring; the width, ascent, and descent in the\n     * provided Metrics object (or a new one if the provided one was null)\n     * if boring.\n     * @hide\n     */\n    static isBoring(text:String, paint:TextPaint, textDir:TextDirectionHeuristic=TextDirectionHeuristics.FIRSTSTRONG_LTR,\n                    metrics:BoringLayout.Metrics=null):BoringLayout.Metrics  {\n        let temp:string;\n        let length:number = text.length;\n        let boring:boolean = true;\n        outer: for (let i:number = 0; i < length; i += 500) {\n            let j:number = i + 500;\n            if (j > length) j = length;\n            temp = text.substring(i, j);\n            let n:number = j - i;\n            for (let a:number = 0; a < n; a++) {\n                let c:string = temp[a];\n                if (c == '\\n' || c == '\\t') { // || c.codePointAt(0) >= BoringLayout.FIRST_RIGHT_TO_LEFT) {\n                    boring = false;\n                    break outer;\n                }\n            }\n            if (textDir != null && textDir.isRtl(temp, 0, n)) {\n                boring = false;\n                break outer;\n            }\n        }\n        //TextUtils.recycle(temp);\n        if (boring && Spanned.isImplements(text) ) {\n            let sp:Spanned = <Spanned> text;\n            let styles:any[] = sp.getSpans(0, length, ParagraphStyle.type);\n            if (styles.length > 0) {\n                boring = false;\n            }\n        }\n        if (boring) {\n            let fm:BoringLayout.Metrics = metrics;\n            if (fm == null) {\n                fm = new BoringLayout.Metrics();\n            }\n            let line:TextLine = TextLine.obtain();\n            line.set(paint, text, 0, length, Layout.DIR_LEFT_TO_RIGHT, Layout.DIRS_ALL_LEFT_TO_RIGHT, false, null);\n            fm.width = Math.floor(Math.ceil(line.metrics(fm)));\n            TextLine.recycle(line);\n            return fm;\n        } else {\n            return null;\n        }\n    }\n\n    getHeight():number  {\n        return this.mBottom;\n    }\n\n    getLineCount():number  {\n        return 1;\n    }\n\n    getLineTop(line:number):number  {\n        if (line == 0)\n            return 0;\n        else\n            return this.mBottom;\n    }\n\n    getLineDescent(line:number):number  {\n        return this.mDesc;\n    }\n\n    getLineStart(line:number):number  {\n        if (line == 0)\n            return 0;\n        else\n            return this.getText().length;\n    }\n\n    getParagraphDirection(line:number):number  {\n        return BoringLayout.DIR_LEFT_TO_RIGHT;\n    }\n\n    getLineContainsTab(line:number):boolean  {\n        return false;\n    }\n\n    getLineMax(line:number):number  {\n        return this.mMax;\n    }\n\n    getLineDirections(line:number):Layout.Directions  {\n        return Layout.DIRS_ALL_LEFT_TO_RIGHT;\n    }\n\n    getTopPadding():number  {\n        return this.mTopPadding;\n    }\n\n    getBottomPadding():number  {\n        return this.mBottomPadding;\n    }\n\n    getEllipsisCount(line:number):number  {\n        return this.mEllipsizedCount;\n    }\n\n    getEllipsisStart(line:number):number  {\n        return this.mEllipsizedStart;\n    }\n\n    getEllipsizedWidth():number  {\n        return this.mEllipsizedWidth;\n    }\n\n    // Override draw so it will be faster.\n    draw(c:Canvas, highlight:Path, highlightpaint:Paint, cursorOffset:number):void  {\n        if (this.mDirect != null && highlight == null) {\n            c.drawText(this.mDirect, 0, this.mBottom - this.mDesc, this.mPaint);\n        } else {\n            super.draw(c, highlight, highlightpaint, cursorOffset);\n        }\n    }\n\n    /**\n     * Callback for the ellipsizer to report what region it ellipsized.\n     */\n    ellipsized(start:number, end:number):void  {\n        this.mEllipsizedStart = start;\n        this.mEllipsizedCount = end - start;\n    }\n\n    private static FIRST_RIGHT_TO_LEFT = '֐'.codePointAt(0);\n\n    private mDirect:string;\n\n    //private mPaint:Paint;\n\n    /* package */\n    // for Direct\n    mBottom:number = 0;\n    mDesc:number = 0;\n\n    private mTopPadding:number = 0\n    private mBottomPadding:number = 0;\n\n    private mMax:number = 0;\n\n    private mEllipsizedWidth:number = 0;\n    private mEllipsizedStart:number = 0;\n    private mEllipsizedCount:number = 0;\n\n    private static sTemp:TextPaint = new TextPaint();\n\n\n}\n\nexport module BoringLayout{\nexport class Metrics extends Paint.FontMetricsInt {\n\n    width:number = 0;\n\n    toString():string  {\n        return super.toString() + \" width=\" + this.width;\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/text/DynamicLayout.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../android/text/style/UpdateLayout.ts\"/>\n///<reference path=\"../../android/text/style/WrapTogetherSpan.ts\"/>\n///<reference path=\"../../java/lang/ref/WeakReference.ts\"/>\n///<reference path=\"../../java/lang/System.ts\"/>\n///<reference path=\"../../android/text/Layout.ts\"/>\n///<reference path=\"../../android/text/PackedIntVector.ts\"/>\n///<reference path=\"../../android/text/PackedObjectVector.ts\"/>\n///<reference path=\"../../android/text/Spannable.ts\"/>\n///<reference path=\"../../android/text/Spanned.ts\"/>\n///<reference path=\"../../android/text/StaticLayout.ts\"/>\n///<reference path=\"../../android/text/TextDirectionHeuristic.ts\"/>\n///<reference path=\"../../android/text/TextDirectionHeuristics.ts\"/>\n///<reference path=\"../../android/text/TextPaint.ts\"/>\n///<reference path=\"../../android/text/TextUtils.ts\"/>\n///<reference path=\"../../android/text/TextWatcher.ts\"/>\n\nmodule android.text {\nimport Paint = android.graphics.Paint;\nimport UpdateLayout = android.text.style.UpdateLayout;\nimport WrapTogetherSpan = android.text.style.WrapTogetherSpan;\nimport WeakReference = java.lang.ref.WeakReference;\nimport System = java.lang.System;\nimport Layout = android.text.Layout;\nimport PackedIntVector = android.text.PackedIntVector;\nimport PackedObjectVector = android.text.PackedObjectVector;\nimport Spannable = android.text.Spannable;\nimport Spanned = android.text.Spanned;\nimport StaticLayout = android.text.StaticLayout;\nimport TextDirectionHeuristic = android.text.TextDirectionHeuristic;\nimport TextDirectionHeuristics = android.text.TextDirectionHeuristics;\nimport TextPaint = android.text.TextPaint;\nimport TextUtils = android.text.TextUtils;\nimport TextWatcher = android.text.TextWatcher;\n/**\n * DynamicLayout is a text layout that updates itself as the text is edited.\n * <p>This is used by widgets to control text layout. You should not need\n * to use this class directly unless you are implementing your own widget\n * or custom display object, or need to call\n * {@link android.graphics.Canvas#drawText(java.lang.CharSequence, int, int, float, float, android.graphics.Paint)\n *  Canvas.drawText()} directly.</p>\n */\nexport class DynamicLayout extends Layout {\n\n    private static PRIORITY:number = 128;\n\n    private static BLOCK_MINIMUM_CHARACTER_LENGTH:number = 400;\n\n    /**\n     * Make a layout for the transformed text (password transformation\n     * being the primary example of a transformation)\n     * that will be updated as the base text is changed.\n     * If ellipsize is non-null, the Layout will ellipsize the text\n     * down to ellipsizedWidth.\n     * *\n     * *@hide\n     */\n    constructor( base:String, display:String, paint:TextPaint, width:number, align:Layout.Alignment,\n                 textDir:TextDirectionHeuristic, spacingmult:number, spacingadd:number, includepad:boolean,\n                 ellipsize:TextUtils.TruncateAt=null, ellipsizedWidth=0) {\n        super((ellipsize == null) ? display : (Spanned.isImplements(display)) ? new Layout.SpannedEllipsizer(display) : new Layout.Ellipsizer(display),\n            paint, width, align, textDir, spacingmult, spacingadd);\n        this.mBase = base;\n        this.mDisplay = display;\n        if (ellipsize != null) {\n            this.mInts = new PackedIntVector(DynamicLayout.COLUMNS_ELLIPSIZE);\n            this.mEllipsizedWidth = ellipsizedWidth;\n            this.mEllipsizeAt = ellipsize;\n        } else {\n            this.mInts = new PackedIntVector(DynamicLayout.COLUMNS_NORMAL);\n            this.mEllipsizedWidth = width;\n            this.mEllipsizeAt = null;\n        }\n        this.mObjects = new PackedObjectVector<Layout.Directions>(1);\n        this.mIncludePad = includepad;\n        /*\n         * This is annoying, but we can't refer to the layout until\n         * superclass construction is finished, and the superclass\n         * constructor wants the reference to the display text.\n         *\n         * This will break if the superclass constructor ever actually\n         * cares about the content instead of just holding the reference.\n         */\n        if (ellipsize != null) {\n            let e:Layout.Ellipsizer = <Layout.Ellipsizer> this.getText();\n            e.mLayout = this;\n            e.mWidth = ellipsizedWidth;\n            e.mMethod = ellipsize;\n            this.mEllipsize = true;\n        }\n        // Initial state is a single line with 0 characters (0 to 0),\n        // with top at 0 and bottom at whatever is natural, and\n        // undefined ellipsis.\n        let start:number[];\n        if (ellipsize != null) {\n            start = androidui.util.ArrayCreator.newNumberArray(DynamicLayout.COLUMNS_ELLIPSIZE);\n            start[DynamicLayout.ELLIPSIS_START] = DynamicLayout.ELLIPSIS_UNDEFINED;\n        } else {\n            start = androidui.util.ArrayCreator.newNumberArray(DynamicLayout.COLUMNS_NORMAL);\n        }\n        let dirs:Layout.Directions[] =  [ DynamicLayout.DIRS_ALL_LEFT_TO_RIGHT ];\n        let fm = new Paint.FontMetricsInt();\n        paint.getFontMetricsInt(fm);\n        let asc:number = fm.ascent;\n        let desc:number = fm.descent;\n        start[DynamicLayout.DIR] = DynamicLayout.DIR_LEFT_TO_RIGHT << DynamicLayout.DIR_SHIFT;\n        start[DynamicLayout.TOP] = 0;\n        start[DynamicLayout.DESCENT] = desc;\n        this.mInts.insertAt(0, start);\n        start[DynamicLayout.TOP] = desc - asc;\n        this.mInts.insertAt(1, start);\n        this.mObjects.insertAt(0, dirs);\n        // Update from 0 characters to whatever the real text is\n        this.reflow(base, 0, 0, base.length);\n        //if (base instanceof Spannable) {\n        //    if (this.mWatcher == null)\n        //        this.mWatcher = new DynamicLayout.ChangeWatcher(this);\n        //    // Strip out any watchers for other DynamicLayouts.\n        //    let sp:Spannable = <Spannable> base;\n        //    let spans:DynamicLayout.ChangeWatcher[] = sp.getSpans(0, sp.length(), DynamicLayout.ChangeWatcher.class);\n        //    for (let i:number = 0; i < spans.length; i++) sp.removeSpan(spans[i]);\n        //    sp.setSpan(this.mWatcher, 0, base.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE | (DynamicLayout.PRIORITY << Spannable.SPAN_PRIORITY_SHIFT));\n        //}\n    }\n\n    private reflow(s:String, where:number, before:number, after:number):void  {\n        if (s != this.mBase)\n            return;\n        let text:String = this.mDisplay;\n        let len:number = text.length;\n        // seek back to the start of the paragraph\n        let find:number = text.lastIndexOf('\\n', where - 1);\n        if (find < 0)\n            find = 0;\n        else\n            find = find + 1;\n        {\n            let diff:number = where - find;\n            before += diff;\n            after += diff;\n            where -= diff;\n        }\n        // seek forward to the end of the paragraph\n        let look:number = text.indexOf('\\n', where + after);\n        if (look < 0)\n            look = len;\n        else\n            // we want the index after the \\n\n            look++;\n        let change:number = look - (where + after);\n        before += change;\n        after += change;\n        //if (Spanned.isImplements(text)) {\n        //    let sp:Spanned = <Spanned> text;\n        //    let again:boolean;\n        //    do {\n        //        again = false;\n        //        let force:any[] = sp.getSpans(where, where + after, WrapTogetherSpan.class);\n        //        for (let i:number = 0; i < force.length; i++) {\n        //            let st:number = sp.getSpanStart(force[i]);\n        //            let en:number = sp.getSpanEnd(force[i]);\n        //            if (st < where) {\n        //                again = true;\n        //                let diff:number = where - st;\n        //                before += diff;\n        //                after += diff;\n        //                where -= diff;\n        //            }\n        //            if (en > where + after) {\n        //                again = true;\n        //                let diff:number = en - (where + after);\n        //                before += diff;\n        //                after += diff;\n        //            }\n        //        }\n        //    } while (again);\n        //}\n        // find affected region of old layout\n        let startline:number = this.getLineForOffset(where);\n        let startv:number = this.getLineTop(startline);\n        let endline:number = this.getLineForOffset(where + before);\n        if (where + after == len)\n            endline = this.getLineCount();\n        let endv:number = this.getLineTop(endline);\n        let islast:boolean = (endline == this.getLineCount());\n        // generate new layout for affected text\n        let reflowed:StaticLayout;\n        {\n            reflowed = DynamicLayout.sStaticLayout;\n            DynamicLayout.sStaticLayout = null;\n        }\n        if (reflowed == null) {\n            reflowed = new StaticLayout(null, 0, 0, null, 0, null, null, 0, 1, true);\n        } else {\n            reflowed.prepare();\n        }\n        reflowed.generate(text, where, where + after, this.getPaint(), this.getWidth(), this.getTextDirectionHeuristic(), this.getSpacingMultiplier(), this.getSpacingAdd(), false, true, this.mEllipsizedWidth, this.mEllipsizeAt);\n        let n:number = reflowed.getLineCount();\n        if (where + after != len && reflowed.getLineStart(n - 1) == where + after)\n            n--;\n        // remove affected lines from old layout\n        this.mInts.deleteAt(startline, endline - startline);\n        this.mObjects.deleteAt(startline, endline - startline);\n        // adjust offsets in layout for new height and offsets\n        let ht:number = reflowed.getLineTop(n);\n        let toppad:number = 0, botpad:number = 0;\n        if (this.mIncludePad && startline == 0) {\n            toppad = reflowed.getTopPadding();\n            this.mTopPadding = toppad;\n            ht -= toppad;\n        }\n        if (this.mIncludePad && islast) {\n            botpad = reflowed.getBottomPadding();\n            this.mBottomPadding = botpad;\n            ht += botpad;\n        }\n        this.mInts.adjustValuesBelow(startline, DynamicLayout.START, after - before);\n        this.mInts.adjustValuesBelow(startline, DynamicLayout.TOP, startv - endv + ht);\n        // insert new layout\n        let ints:number[];\n        if (this.mEllipsize) {\n            ints = androidui.util.ArrayCreator.newNumberArray(DynamicLayout.COLUMNS_ELLIPSIZE);\n            ints[DynamicLayout.ELLIPSIS_START] = DynamicLayout.ELLIPSIS_UNDEFINED;\n        } else {\n            ints = androidui.util.ArrayCreator.newNumberArray(DynamicLayout.COLUMNS_NORMAL);\n        }\n        let objects:Layout.Directions[] = new Array<Layout.Directions>(1);\n        for (let i:number = 0; i < n; i++) {\n            ints[DynamicLayout.START] = reflowed.getLineStart(i) | (reflowed.getParagraphDirection(i) << DynamicLayout.DIR_SHIFT) | (reflowed.getLineContainsTab(i) ? DynamicLayout.TAB_MASK : 0);\n            let top:number = reflowed.getLineTop(i) + startv;\n            if (i > 0)\n                top -= toppad;\n            ints[DynamicLayout.TOP] = top;\n            let desc:number = reflowed.getLineDescent(i);\n            if (i == n - 1)\n                desc += botpad;\n            ints[DynamicLayout.DESCENT] = desc;\n            objects[0] = reflowed.getLineDirections(i);\n            if (this.mEllipsize) {\n                ints[DynamicLayout.ELLIPSIS_START] = reflowed.getEllipsisStart(i);\n                ints[DynamicLayout.ELLIPSIS_COUNT] = reflowed.getEllipsisCount(i);\n            }\n            this.mInts.insertAt(startline + i, ints);\n            this.mObjects.insertAt(startline + i, objects);\n        }\n        this.updateBlocks(startline, endline - 1, n);\n        {\n            DynamicLayout.sStaticLayout = reflowed;\n            reflowed.finish();\n        }\n    }\n\n    /**\n     * Create the initial block structure, cutting the text into blocks of at least\n     * BLOCK_MINIMUM_CHARACTER_SIZE characters, aligned on the ends of paragraphs.\n     */\n    private createBlocks():void  {\n        let offset:number = DynamicLayout.BLOCK_MINIMUM_CHARACTER_LENGTH;\n        this.mNumberOfBlocks = 0;\n        const text:String = this.mDisplay;\n        while (true) {\n            offset = text.indexOf('\\n', offset);\n            if (offset < 0) {\n                this.addBlockAtOffset(text.length);\n                break;\n            } else {\n                this.addBlockAtOffset(offset);\n                offset += DynamicLayout.BLOCK_MINIMUM_CHARACTER_LENGTH;\n            }\n        }\n        // mBlockIndices and mBlockEndLines should have the same length\n        this.mBlockIndices = androidui.util.ArrayCreator.newNumberArray(this.mBlockEndLines.length);\n        for (let i:number = 0; i < this.mBlockEndLines.length; i++) {\n            this.mBlockIndices[i] = DynamicLayout.INVALID_BLOCK_INDEX;\n        }\n    }\n\n    /**\n     * Create a new block, ending at the specified character offset.\n     * A block will actually be created only if has at least one line, i.e. this offset is\n     * not on the end line of the previous block.\n     */\n    private addBlockAtOffset(offset:number):void  {\n        const line:number = this.getLineForOffset(offset);\n        if (this.mBlockEndLines == null) {\n            // Initial creation of the array, no test on previous block ending line\n            this.mBlockEndLines = androidui.util.ArrayCreator.newNumberArray((1));\n            this.mBlockEndLines[this.mNumberOfBlocks] = line;\n            this.mNumberOfBlocks++;\n            return;\n        }\n        const previousBlockEndLine:number = this.mBlockEndLines[this.mNumberOfBlocks - 1];\n        if (line > previousBlockEndLine) {\n            if (this.mNumberOfBlocks == this.mBlockEndLines.length) {\n                // Grow the array if needed\n                let blockEndLines:number[] = androidui.util.ArrayCreator.newNumberArray((this.mNumberOfBlocks + 1));\n                System.arraycopy(this.mBlockEndLines, 0, blockEndLines, 0, this.mNumberOfBlocks);\n                this.mBlockEndLines = blockEndLines;\n            }\n            this.mBlockEndLines[this.mNumberOfBlocks] = line;\n            this.mNumberOfBlocks++;\n        }\n    }\n\n    /**\n     * This method is called every time the layout is reflowed after an edition.\n     * It updates the internal block data structure. The text is split in blocks\n     * of contiguous lines, with at least one block for the entire text.\n     * When a range of lines is edited, new blocks (from 0 to 3 depending on the\n     * overlap structure) will replace the set of overlapping blocks.\n     * Blocks are listed in order and are represented by their ending line number.\n     * An index is associated to each block (which will be used by display lists),\n     * this class simply invalidates the index of blocks overlapping a modification.\n     *\n     * This method is package private and not private so that it can be tested.\n     *\n     * @param startLine the first line of the range of modified lines\n     * @param endLine the last line of the range, possibly equal to startLine, lower\n     * than getLineCount()\n     * @param newLineCount the number of lines that will replace the range, possibly 0\n     *\n     * @hide\n     */\n    updateBlocks(startLine:number, endLine:number, newLineCount:number):void  {\n        if (this.mBlockEndLines == null) {\n            this.createBlocks();\n            return;\n        }\n        let firstBlock:number = -1;\n        let lastBlock:number = -1;\n        for (let i:number = 0; i < this.mNumberOfBlocks; i++) {\n            if (this.mBlockEndLines[i] >= startLine) {\n                firstBlock = i;\n                break;\n            }\n        }\n        for (let i:number = firstBlock; i < this.mNumberOfBlocks; i++) {\n            if (this.mBlockEndLines[i] >= endLine) {\n                lastBlock = i;\n                break;\n            }\n        }\n        const lastBlockEndLine:number = this.mBlockEndLines[lastBlock];\n        let createBlockBefore:boolean = startLine > (firstBlock == 0 ? 0 : this.mBlockEndLines[firstBlock - 1] + 1);\n        let createBlock:boolean = newLineCount > 0;\n        let createBlockAfter:boolean = endLine < this.mBlockEndLines[lastBlock];\n        let numAddedBlocks:number = 0;\n        if (createBlockBefore)\n            numAddedBlocks++;\n        if (createBlock)\n            numAddedBlocks++;\n        if (createBlockAfter)\n            numAddedBlocks++;\n        const numRemovedBlocks:number = lastBlock - firstBlock + 1;\n        const newNumberOfBlocks:number = this.mNumberOfBlocks + numAddedBlocks - numRemovedBlocks;\n        if (newNumberOfBlocks == 0) {\n            // Even when text is empty, there is actually one line and hence one block\n            this.mBlockEndLines[0] = 0;\n            this.mBlockIndices[0] = DynamicLayout.INVALID_BLOCK_INDEX;\n            this.mNumberOfBlocks = 1;\n            return;\n        }\n        if (newNumberOfBlocks > this.mBlockEndLines.length) {\n            const newSize:number = (newNumberOfBlocks);\n            let blockEndLines:number[] = androidui.util.ArrayCreator.newNumberArray(newSize);\n            let blockIndices:number[] = androidui.util.ArrayCreator.newNumberArray(newSize);\n            System.arraycopy(this.mBlockEndLines, 0, blockEndLines, 0, firstBlock);\n            System.arraycopy(this.mBlockIndices, 0, blockIndices, 0, firstBlock);\n            System.arraycopy(this.mBlockEndLines, lastBlock + 1, blockEndLines, firstBlock + numAddedBlocks, this.mNumberOfBlocks - lastBlock - 1);\n            System.arraycopy(this.mBlockIndices, lastBlock + 1, blockIndices, firstBlock + numAddedBlocks, this.mNumberOfBlocks - lastBlock - 1);\n            this.mBlockEndLines = blockEndLines;\n            this.mBlockIndices = blockIndices;\n        } else {\n            System.arraycopy(this.mBlockEndLines, lastBlock + 1, this.mBlockEndLines, firstBlock + numAddedBlocks, this.mNumberOfBlocks - lastBlock - 1);\n            System.arraycopy(this.mBlockIndices, lastBlock + 1, this.mBlockIndices, firstBlock + numAddedBlocks, this.mNumberOfBlocks - lastBlock - 1);\n        }\n        this.mNumberOfBlocks = newNumberOfBlocks;\n        let newFirstChangedBlock:number;\n        const deltaLines:number = newLineCount - (endLine - startLine + 1);\n        if (deltaLines != 0) {\n            // Display list whose index is >= mIndexFirstChangedBlock is valid\n            // but it needs to update its drawing location.\n            newFirstChangedBlock = firstBlock + numAddedBlocks;\n            for (let i:number = newFirstChangedBlock; i < this.mNumberOfBlocks; i++) {\n                this.mBlockEndLines[i] += deltaLines;\n            }\n        } else {\n            newFirstChangedBlock = this.mNumberOfBlocks;\n        }\n        this.mIndexFirstChangedBlock = Math.min(this.mIndexFirstChangedBlock, newFirstChangedBlock);\n        let blockIndex:number = firstBlock;\n        if (createBlockBefore) {\n            this.mBlockEndLines[blockIndex] = startLine - 1;\n            this.mBlockIndices[blockIndex] = DynamicLayout.INVALID_BLOCK_INDEX;\n            blockIndex++;\n        }\n        if (createBlock) {\n            this.mBlockEndLines[blockIndex] = startLine + newLineCount - 1;\n            this.mBlockIndices[blockIndex] = DynamicLayout.INVALID_BLOCK_INDEX;\n            blockIndex++;\n        }\n        if (createBlockAfter) {\n            this.mBlockEndLines[blockIndex] = lastBlockEndLine + deltaLines;\n            this.mBlockIndices[blockIndex] = DynamicLayout.INVALID_BLOCK_INDEX;\n        }\n    }\n\n    /**\n     * This package private method is used for test purposes only\n     * @hide\n     */\n    setBlocksDataForTest(blockEndLines:number[], blockIndices:number[], numberOfBlocks:number):void  {\n        this.mBlockEndLines = androidui.util.ArrayCreator.newNumberArray(blockEndLines.length);\n        this.mBlockIndices = androidui.util.ArrayCreator.newNumberArray(blockIndices.length);\n        System.arraycopy(blockEndLines, 0, this.mBlockEndLines, 0, blockEndLines.length);\n        System.arraycopy(blockIndices, 0, this.mBlockIndices, 0, blockIndices.length);\n        this.mNumberOfBlocks = numberOfBlocks;\n    }\n\n    /**\n     * @hide\n     */\n    getBlockEndLines():number[]  {\n        return this.mBlockEndLines;\n    }\n\n    /**\n     * @hide\n     */\n    getBlockIndices():number[]  {\n        return this.mBlockIndices;\n    }\n\n    /**\n     * @hide\n     */\n    getNumberOfBlocks():number  {\n        return this.mNumberOfBlocks;\n    }\n\n    /**\n     * @hide\n     */\n    getIndexFirstChangedBlock():number  {\n        return this.mIndexFirstChangedBlock;\n    }\n\n    /**\n     * @hide\n     */\n    setIndexFirstChangedBlock(i:number):void  {\n        this.mIndexFirstChangedBlock = i;\n    }\n\n    getLineCount():number  {\n        return this.mInts.size() - 1;\n    }\n\n    getLineTop(line:number):number  {\n        return this.mInts.getValue(line, DynamicLayout.TOP);\n    }\n\n    getLineDescent(line:number):number  {\n        return this.mInts.getValue(line, DynamicLayout.DESCENT);\n    }\n\n    getLineStart(line:number):number  {\n        return this.mInts.getValue(line, DynamicLayout.START) & DynamicLayout.START_MASK;\n    }\n\n    getLineContainsTab(line:number):boolean  {\n        return (this.mInts.getValue(line, DynamicLayout.TAB) & DynamicLayout.TAB_MASK) != 0;\n    }\n\n    getParagraphDirection(line:number):number  {\n        return this.mInts.getValue(line, DynamicLayout.DIR) >> DynamicLayout.DIR_SHIFT;\n    }\n\n    getLineDirections(line:number):Layout.Directions  {\n        return this.mObjects.getValue(line, 0);\n    }\n\n    getTopPadding():number  {\n        return this.mTopPadding;\n    }\n\n    getBottomPadding():number  {\n        return this.mBottomPadding;\n    }\n\n    getEllipsizedWidth():number  {\n        return this.mEllipsizedWidth;\n    }\n\n\n\n    getEllipsisStart(line:number):number  {\n        if (this.mEllipsizeAt == null) {\n            return 0;\n        }\n        return this.mInts.getValue(line, DynamicLayout.ELLIPSIS_START);\n    }\n\n    getEllipsisCount(line:number):number  {\n        if (this.mEllipsizeAt == null) {\n            return 0;\n        }\n        return this.mInts.getValue(line, DynamicLayout.ELLIPSIS_COUNT);\n    }\n\n    private mBase:String;\n\n    private mDisplay:String;\n\n    private mWatcher;//:DynamicLayout.ChangeWatcher;\n\n    private mIncludePad:boolean;\n\n    private mEllipsize:boolean;\n\n    private mEllipsizedWidth:number = 0;\n\n    private mEllipsizeAt:TextUtils.TruncateAt;\n\n    private mInts:PackedIntVector;\n\n    private mObjects:PackedObjectVector<Layout.Directions>;\n\n    /**\n     * Value used in mBlockIndices when a block has been created or recycled and indicating that its\n     * display list needs to be re-created.\n     * @hide\n     */\n    static INVALID_BLOCK_INDEX:number = -1;\n\n    // Stores the line numbers of the last line of each block (inclusive)\n    private mBlockEndLines:number[];\n\n    // The indices of this block's display list in TextView's internal display list array or\n    // INVALID_BLOCK_INDEX if this block has been invalidated during an edition\n    private mBlockIndices:number[];\n\n    // Number of items actually currently being used in the above 2 arrays\n    private mNumberOfBlocks:number = 0;\n\n    // The first index of the blocks whose locations are changed\n    private mIndexFirstChangedBlock:number = 0;\n\n    private mTopPadding:number = 0\n    private mBottomPadding:number = 0;\n\n    private static sStaticLayout:StaticLayout = new StaticLayout(null, 0, 0, null, 0, null, null, 1, 0, true);\n\n    private static sLock:any[] = new Array<any>(0);\n\n    private static START:number = 0;\n\n    private static DIR:number = DynamicLayout.START;\n\n    private static TAB:number = DynamicLayout.START;\n\n    private static TOP:number = 1;\n\n    private static DESCENT:number = 2;\n\n    private static COLUMNS_NORMAL:number = 3;\n\n    private static ELLIPSIS_START:number = 3;\n\n    private static ELLIPSIS_COUNT:number = 4;\n\n    private static COLUMNS_ELLIPSIZE:number = 5;\n\n    private static START_MASK:number = 0x1FFFFFFF;\n\n    private static DIR_SHIFT:number = 30;\n\n    private static TAB_MASK:number = 0x20000000;\n\n    private static ELLIPSIS_UNDEFINED:number = 0x80000000;\n}\n\nexport module DynamicLayout{\n//export class ChangeWatcher implements TextWatcher, SpanWatcher {\n//\n//    constructor( layout:DynamicLayout) {\n//        this.mLayout = new WeakReference<DynamicLayout>(layout);\n//    }\n//\n//    private reflow(s:CharSequence, where:number, before:number, after:number):void  {\n//        let ml:DynamicLayout = this.mLayout.get();\n//        if (ml != null)\n//            ml.reflow(s, where, before, after);\n//        else if (s instanceof Spannable)\n//            (<Spannable> s).removeSpan(this);\n//    }\n//\n//    beforeTextChanged(s:CharSequence, where:number, before:number, after:number):void  {\n//    // Intentionally empty\n//    }\n//\n//    onTextChanged(s:CharSequence, where:number, before:number, after:number):void  {\n//        this.reflow(s, where, before, after);\n//    }\n//\n//    afterTextChanged(s:Editable):void  {\n//    // Intentionally empty\n//    }\n//\n//    onSpanAdded(s:Spannable, o:any, start:number, end:number):void  {\n//        if (o instanceof UpdateLayout)\n//            this.reflow(s, start, end - start, end - start);\n//    }\n//\n//    onSpanRemoved(s:Spannable, o:any, start:number, end:number):void  {\n//        if (o instanceof UpdateLayout)\n//            this.reflow(s, start, end - start, end - start);\n//    }\n//\n//    onSpanChanged(s:Spannable, o:any, start:number, end:number, nstart:number, nend:number):void  {\n//        if (o instanceof UpdateLayout) {\n//            this.reflow(s, start, end - start, end - start);\n//            this.reflow(s, nstart, nend - nstart, nend - nstart);\n//        }\n//    }\n//\n//    private mLayout:WeakReference<DynamicLayout>;\n//}\n}\n\n}"
  },
  {
    "path": "src/android/text/InputType.ts",
    "content": "///<reference path=\"../view/KeyEvent.ts\"/>\n\nmodule android.text {\n    import KeyEvent = android.view.KeyEvent;\n\n    export class InputType {\n        /**\n         * Mask of bits that determine the overall class\n         * of text being given.  Currently supported classes are:\n         * {@link #TYPE_CLASS_TEXT}, {@link #TYPE_CLASS_NUMBER},\n         * {@link #TYPE_CLASS_PHONE}, {@link #TYPE_CLASS_DATETIME}.\n         * <p>IME authors: If the class is not one you\n         * understand, assume {@link #TYPE_CLASS_TEXT} with NO variation\n         * or flags.<p>\n         */\n        static TYPE_MASK_CLASS:number = 0x0000000f;\n        /**\n         * Mask of bits that determine the variation of\n         * the base content class.\n         */\n        static TYPE_MASK_VARIATION:number = 0x00000ff0;\n        /**\n         * Mask of bits that provide addition bit flags\n         * of options.\n         */\n        static TYPE_MASK_FLAGS:number = 0x00fff000;\n        /**\n         * Special content type for when no explicit type has been specified.\n         * This should be interpreted to mean that the target input connection\n         * is not rich, it can not process and show things like candidate text nor\n         * retrieve the current text, so the input method will need to run in a\n         * limited \"generate key events\" mode, if it supports it. Note that some\n         * input methods may not support it, for example a voice-based input\n         * method will likely not be able to generate key events even if this\n         * flag is set.\n         */\n        static TYPE_NULL:number = 0x00000000;\n        // ----------------------------------------------------------------------\n        // ----------------------------------------------------------------------\n        // ----------------------------------------------------------------------\n        /**\n         * Class for normal text.  This class supports the following flags (only\n         * one of which should be set):\n         * {@link #TYPE_TEXT_FLAG_CAP_CHARACTERS},\n         * {@link #TYPE_TEXT_FLAG_CAP_WORDS}, and.\n         * {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}.  It also supports the\n         * following variations:\n         * {@link #TYPE_TEXT_VARIATION_NORMAL}, and\n         * {@link #TYPE_TEXT_VARIATION_URI}.  If you do not recognize the\n         * variation, normal should be assumed.\n         */\n        static TYPE_CLASS_TEXT:number = 0x00000001;\n        /**\n         * Flag for {@link #TYPE_CLASS_TEXT}: capitalize all characters.  Overrides\n         * {@link #TYPE_TEXT_FLAG_CAP_WORDS} and\n         * {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}.  This value is explicitly defined\n         * to be the same as {@link TextUtils#CAP_MODE_CHARACTERS}. Of course,\n         * this only affects languages where there are upper-case and lower-case letters.\n         */\n        static TYPE_TEXT_FLAG_CAP_CHARACTERS:number = 0x00001000;\n        /**\n         * Flag for {@link #TYPE_CLASS_TEXT}: capitalize the first character of\n         * every word.  Overrides {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}.  This\n         * value is explicitly defined\n         * to be the same as {@link TextUtils#CAP_MODE_WORDS}. Of course,\n         * this only affects languages where there are upper-case and lower-case letters.\n         */\n        static TYPE_TEXT_FLAG_CAP_WORDS:number = 0x00002000;\n        /**\n         * Flag for {@link #TYPE_CLASS_TEXT}: capitalize the first character of\n         * each sentence.  This value is explicitly defined\n         * to be the same as {@link TextUtils#CAP_MODE_SENTENCES}. For example\n         * in English it means to capitalize after a period and a space (note that other\n         * languages may have different characters for period, or not use spaces,\n         * or use different grammatical rules). Of course,\n         * this only affects languages where there are upper-case and lower-case letters.\n         */\n        static TYPE_TEXT_FLAG_CAP_SENTENCES:number = 0x00004000;\n        /**\n         * Flag for {@link #TYPE_CLASS_TEXT}: the user is entering free-form\n         * text that should have auto-correction applied to it. Without this flag,\n         * the IME will not try to correct typos. You should always set this flag\n         * unless you really expect users to type non-words in this field, for\n         * example to choose a name for a character in a game.\n         * Contrast this with {@link #TYPE_TEXT_FLAG_AUTO_COMPLETE} and\n         * {@link #TYPE_TEXT_FLAG_NO_SUGGESTIONS}:\n         * {@code TYPE_TEXT_FLAG_AUTO_CORRECT} means that the IME will try to\n         * auto-correct typos as the user is typing, but does not define whether\n         * the IME offers an interface to show suggestions.\n         */\n        static TYPE_TEXT_FLAG_AUTO_CORRECT:number = 0x00008000;\n        /**\n         * Flag for {@link #TYPE_CLASS_TEXT}: the text editor (which means\n         * the application) is performing auto-completion of the text being entered\n         * based on its own semantics, which it will present to the user as they type.\n         * This generally means that the input method should not be showing\n         * candidates itself, but can expect the editor to supply its own\n         * completions/candidates from\n         * {@link android.view.inputmethod.InputMethodSession#displayCompletions\n     * InputMethodSession.displayCompletions()} as a result of the editor calling\n         * {@link android.view.inputmethod.InputMethodManager#displayCompletions\n     * InputMethodManager.displayCompletions()}.\n         * Note the contrast with {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} and\n         * {@link #TYPE_TEXT_FLAG_NO_SUGGESTIONS}:\n         * {@code TYPE_TEXT_FLAG_AUTO_COMPLETE} means the editor should show an\n         * interface for displaying suggestions, but instead of supplying its own\n         * it will rely on the Editor to pass completions/corrections.\n         */\n        static TYPE_TEXT_FLAG_AUTO_COMPLETE:number = 0x00010000;\n        /**\n         * Flag for {@link #TYPE_CLASS_TEXT}: multiple lines of text can be\n         * entered into the field.  If this flag is not set, the text field\n         * will be constrained to a single line. The IME may also choose not to\n         * display an enter key when this flag is not set, as there should be no\n         * need to create new lines.\n         */\n        static TYPE_TEXT_FLAG_MULTI_LINE:number = 0x00020000;\n        /**\n         * Flag for {@link #TYPE_CLASS_TEXT}: the regular text view associated\n         * with this should not be multi-line, but when a fullscreen input method\n         * is providing text it should use multiple lines if it can.\n         */\n        static TYPE_TEXT_FLAG_IME_MULTI_LINE:number = 0x00040000;\n        /**\n         * Flag for {@link #TYPE_CLASS_TEXT}: the input method does not need to\n         * display any dictionary-based candidates. This is useful for text views that\n         * do not contain words from the language and do not benefit from any\n         * dictionary-based completions or corrections. It overrides the\n         * {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} value when set.\n         * Please avoid using this unless you are certain this is what you want.\n         * Many input methods need suggestions to work well, for example the ones\n         * based on gesture typing. Consider clearing\n         * {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} instead if you just do not\n         * want the IME to correct typos.\n         * Note the contrast with {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} and\n         * {@link #TYPE_TEXT_FLAG_AUTO_COMPLETE}:\n         * {@code TYPE_TEXT_FLAG_NO_SUGGESTIONS} means the IME should never\n         * show an interface to display suggestions. Most IMEs will also take this to\n         * mean they should not try to auto-correct what the user is typing.\n         */\n        static TYPE_TEXT_FLAG_NO_SUGGESTIONS:number = 0x00080000;\n        // ----------------------------------------------------------------------\n        /**\n         * Default variation of {@link #TYPE_CLASS_TEXT}: plain old normal text.\n         */\n        static TYPE_TEXT_VARIATION_NORMAL:number = 0x00000000;\n        /**\n         * Variation of {@link #TYPE_CLASS_TEXT}: entering a URI.\n         */\n        static TYPE_TEXT_VARIATION_URI:number = 0x00000010;\n        /**\n         * Variation of {@link #TYPE_CLASS_TEXT}: entering an e-mail address.\n         */\n        static TYPE_TEXT_VARIATION_EMAIL_ADDRESS:number = 0x00000020;\n        /**\n         * Variation of {@link #TYPE_CLASS_TEXT}: entering the subject line of\n         * an e-mail.\n         */\n        static TYPE_TEXT_VARIATION_EMAIL_SUBJECT:number = 0x00000030;\n        /**\n         * Variation of {@link #TYPE_CLASS_TEXT}: entering a short, possibly informal\n         * message such as an instant message or a text message.\n         */\n        static TYPE_TEXT_VARIATION_SHORT_MESSAGE:number = 0x00000040;\n        /**\n         * Variation of {@link #TYPE_CLASS_TEXT}: entering the content of a long, possibly\n         * formal message such as the body of an e-mail.\n         */\n        static TYPE_TEXT_VARIATION_LONG_MESSAGE:number = 0x00000050;\n        /**\n         * Variation of {@link #TYPE_CLASS_TEXT}: entering the name of a person.\n         */\n        static TYPE_TEXT_VARIATION_PERSON_NAME:number = 0x00000060;\n        /**\n         * Variation of {@link #TYPE_CLASS_TEXT}: entering a postal mailing address.\n         */\n        static TYPE_TEXT_VARIATION_POSTAL_ADDRESS:number = 0x00000070;\n        /**\n         * Variation of {@link #TYPE_CLASS_TEXT}: entering a password.\n         */\n        static TYPE_TEXT_VARIATION_PASSWORD:number = 0x00000080;\n        /**\n         * Variation of {@link #TYPE_CLASS_TEXT}: entering a password, which should\n         * be visible to the user.\n         */\n        static TYPE_TEXT_VARIATION_VISIBLE_PASSWORD:number = 0x00000090;\n        /**\n         * Variation of {@link #TYPE_CLASS_TEXT}: entering text inside of a web form.\n         */\n        static TYPE_TEXT_VARIATION_WEB_EDIT_TEXT:number = 0x000000a0;\n        /**\n         * Variation of {@link #TYPE_CLASS_TEXT}: entering text to filter contents\n         * of a list etc.\n         */\n        static TYPE_TEXT_VARIATION_FILTER:number = 0x000000b0;\n        /**\n         * Variation of {@link #TYPE_CLASS_TEXT}: entering text for phonetic\n         * pronunciation, such as a phonetic name field in contacts. This is mostly\n         * useful for languages where one spelling may have several phonetic\n         * readings, like Japanese.\n         */\n        static TYPE_TEXT_VARIATION_PHONETIC:number = 0x000000c0;\n        /**\n         * Variation of {@link #TYPE_CLASS_TEXT}: entering e-mail address inside\n         * of a web form.  This was added in\n         * {@link android.os.Build.VERSION_CODES#HONEYCOMB}.  An IME must target\n         * this API version or later to see this input type; if it doesn't, a request\n         * for this type will be seen as {@link #TYPE_TEXT_VARIATION_EMAIL_ADDRESS}\n         * when passed through {@link android.view.inputmethod.EditorInfo#makeCompatible(int)\n     * EditorInfo.makeCompatible(int)}.\n         */\n        static TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS:number = 0x000000d0;\n        /**\n         * Variation of {@link #TYPE_CLASS_TEXT}: entering password inside\n         * of a web form.  This was added in\n         * {@link android.os.Build.VERSION_CODES#HONEYCOMB}.  An IME must target\n         * this API version or later to see this input type; if it doesn't, a request\n         * for this type will be seen as {@link #TYPE_TEXT_VARIATION_PASSWORD}\n         * when passed through {@link android.view.inputmethod.EditorInfo#makeCompatible(int)\n     * EditorInfo.makeCompatible(int)}.\n         */\n        static TYPE_TEXT_VARIATION_WEB_PASSWORD:number = 0x000000e0;\n        // ----------------------------------------------------------------------\n        // ----------------------------------------------------------------------\n        // ----------------------------------------------------------------------\n        /**\n         * Class for numeric text.  This class supports the following flags:\n         * {@link #TYPE_NUMBER_FLAG_SIGNED} and\n         * {@link #TYPE_NUMBER_FLAG_DECIMAL}.  It also supports the following\n         * variations: {@link #TYPE_NUMBER_VARIATION_NORMAL} and\n         * {@link #TYPE_NUMBER_VARIATION_PASSWORD}.\n         * <p>IME authors: If you do not recognize\n         * the variation, normal should be assumed.</p>\n         */\n        static TYPE_CLASS_NUMBER:number = 0x00000002;\n        /**\n         * Flag of {@link #TYPE_CLASS_NUMBER}: the number is signed, allowing\n         * a positive or negative sign at the start.\n         */\n        static TYPE_NUMBER_FLAG_SIGNED:number = 0x00001000;\n        /**\n         * Flag of {@link #TYPE_CLASS_NUMBER}: the number is decimal, allowing\n         * a decimal point to provide fractional values.\n         */\n        static TYPE_NUMBER_FLAG_DECIMAL:number = 0x00002000;// ----------------------------------------------------------------------\n        /**\n         * Default variation of {@link #TYPE_CLASS_NUMBER}: plain normal\n         * numeric text.  This was added in\n         * {@link android.os.Build.VERSION_CODES#HONEYCOMB}.  An IME must target\n         * this API version or later to see this input type; if it doesn't, a request\n         * for this type will be dropped when passed through\n         * {@link android.view.inputmethod.EditorInfo#makeCompatible(int)\n     * EditorInfo.makeCompatible(int)}.\n         */\n        static TYPE_NUMBER_VARIATION_NORMAL:number = 0x00000000;\n        /**\n         * Variation of {@link #TYPE_CLASS_NUMBER}: entering a numeric password.\n         * This was added in {@link android.os.Build.VERSION_CODES#HONEYCOMB}.  An\n         * IME must target this API version or later to see this input type; if it\n         * doesn't, a request for this type will be dropped when passed\n         * through {@link android.view.inputmethod.EditorInfo#makeCompatible(int)\n     * EditorInfo.makeCompatible(int)}.\n         */\n        static TYPE_NUMBER_VARIATION_PASSWORD:number = 0x00000010;\n        // ----------------------------------------------------------------------\n        // ----------------------------------------------------------------------\n        // ----------------------------------------------------------------------\n        /**\n         * Class for a phone number.  This class currently supports no variations\n         * or flags.\n         */\n        static TYPE_CLASS_PHONE:number = 0x00000003;\n        // ----------------------------------------------------------------------\n        // ----------------------------------------------------------------------\n        // ----------------------------------------------------------------------\n        /**\n         * Class for dates and times.  It supports the\n         * following variations:\n         * {@link #TYPE_DATETIME_VARIATION_NORMAL}\n         * {@link #TYPE_DATETIME_VARIATION_DATE}, and\n         * {@link #TYPE_DATETIME_VARIATION_TIME}.\n         */\n        static TYPE_CLASS_DATETIME:number = 0x00000004;\n        /**\n         * Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering\n         * both a date and time.\n         */\n        static TYPE_DATETIME_VARIATION_NORMAL:number = 0x00000000;\n        /**\n         * Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering\n         * only a date.\n         */\n        static TYPE_DATETIME_VARIATION_DATE:number = 0x00000010;\n        /**\n         * Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering\n         * only a time.\n         */\n        static TYPE_DATETIME_VARIATION_TIME:number = 0x00000020;\n    }\n    export module InputType {\n        export class LimitCode {\n            static TYPE_CLASS_NUMBER = [\n                KeyEvent.KEYCODE_Digit0,\n                KeyEvent.KEYCODE_Digit1,\n                KeyEvent.KEYCODE_Digit2,\n                KeyEvent.KEYCODE_Digit3,\n                KeyEvent.KEYCODE_Digit4,\n                KeyEvent.KEYCODE_Digit5,\n                KeyEvent.KEYCODE_Digit6,\n                KeyEvent.KEYCODE_Digit7,\n                KeyEvent.KEYCODE_Digit8,\n                KeyEvent.KEYCODE_Digit9,\n            ];\n            static TYPE_CLASS_PHONE = [\n                KeyEvent.KEYCODE_Comma,\n                KeyEvent.KEYCODE_Sharp,\n                KeyEvent.KEYCODE_Semicolon,\n                KeyEvent.KEYCODE_Asterisk,\n                KeyEvent.KEYCODE_Left_Parenthesis,\n                KeyEvent.KEYCODE_Right_Parenthesis,\n                KeyEvent.KEYCODE_Slash,\n                KeyEvent.KEYCODE_KeyN,\n                KeyEvent.KEYCODE_Period,\n                KeyEvent.KEYCODE_SPACE,\n                KeyEvent.KEYCODE_Add,\n                KeyEvent.KEYCODE_Minus,\n                KeyEvent.KEYCODE_Period,\n                KeyEvent.KEYCODE_Digit0,\n                KeyEvent.KEYCODE_Digit1,\n                KeyEvent.KEYCODE_Digit2,\n                KeyEvent.KEYCODE_Digit3,\n                KeyEvent.KEYCODE_Digit4,\n                KeyEvent.KEYCODE_Digit5,\n                KeyEvent.KEYCODE_Digit6,\n                KeyEvent.KEYCODE_Digit7,\n                KeyEvent.KEYCODE_Digit8,\n                KeyEvent.KEYCODE_Digit9,\n            ];\n        }\n    }\n}"
  },
  {
    "path": "src/android/text/Layout.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/graphics/Path.ts\"/>\n///<reference path=\"../../android/text/style/LeadingMarginSpan.ts\"/>\n///<reference path=\"../../android/text/style/LineBackgroundSpan.ts\"/>\n///<reference path=\"../../android/text/style/ParagraphStyle.ts\"/>\n///<reference path=\"../../android/text/style/ReplacementSpan.ts\"/>\n///<reference path=\"../../android/text/style/TabStopSpan.ts\"/>\n///<reference path=\"../../java/util/Arrays.ts\"/>\n///<reference path=\"../../java/lang/Float.ts\"/>\n///<reference path=\"../../java/lang/System.ts\"/>\n///<reference path=\"../../java/lang/StringBuilder.ts\"/>\n///<reference path=\"../../android/text/MeasuredText.ts\"/>\n///<reference path=\"../../android/text/Spanned.ts\"/>\n///<reference path=\"../../android/text/SpanSet.ts\"/>\n///<reference path=\"../../android/text/TextDirectionHeuristic.ts\"/>\n///<reference path=\"../../android/text/TextDirectionHeuristics.ts\"/>\n///<reference path=\"../../android/text/TextLine.ts\"/>\n///<reference path=\"../../android/text/TextPaint.ts\"/>\n///<reference path=\"../../android/text/TextUtils.ts\"/>\n///<reference path=\"../../android/text/TextWatcher.ts\"/>\n\nmodule android.text {\nimport Canvas = android.graphics.Canvas;\nimport Paint = android.graphics.Paint;\nimport Rect = android.graphics.Rect;\nimport Path = android.graphics.Path;\nimport LeadingMarginSpan = android.text.style.LeadingMarginSpan;\nimport LeadingMarginSpan2 = android.text.style.LeadingMarginSpan.LeadingMarginSpan2;\nimport LineBackgroundSpan = android.text.style.LineBackgroundSpan;\nimport ParagraphStyle = android.text.style.ParagraphStyle;\nimport ReplacementSpan = android.text.style.ReplacementSpan;\nimport TabStopSpan = android.text.style.TabStopSpan;\nimport Arrays = java.util.Arrays;\nimport Float = java.lang.Float;\nimport System = java.lang.System;\nimport StringBuilder = java.lang.StringBuilder;\nimport MeasuredText = android.text.MeasuredText;\nimport Spanned = android.text.Spanned;\nimport SpanSet = android.text.SpanSet;\nimport TextDirectionHeuristic = android.text.TextDirectionHeuristic;\nimport TextDirectionHeuristics = android.text.TextDirectionHeuristics;\nimport TextLine = android.text.TextLine;\nimport TextPaint = android.text.TextPaint;\nimport TextUtils = android.text.TextUtils;\nimport TextWatcher = android.text.TextWatcher;\n    window.addEventListener('AndroidUILoadFinish', ()=>{//real import now\n        eval(`TextUtils = android.text.TextUtils;\n              MeasuredText = android.text.MeasuredText;\n              `);\n    });\n\n/**\n * A base class that manages text layout in visual elements on\n * the screen.\n * <p>For text that will be edited, use a {@link DynamicLayout},\n * which will be updated as the text changes.\n * For text that will not change, use a {@link StaticLayout}.\n */\nexport abstract class Layout {\n\n    private static NO_PARA_SPANS:ParagraphStyle[] = [];\n\n\n    /**\n     * Return how wide a layout must be in order to display the\n     * specified text with one line per paragraph.\n     */\n    static getDesiredWidth(source:String, paint:TextPaint):number;\n    static getDesiredWidth(source:String, start:number, end:number, paint:TextPaint):number;\n    static getDesiredWidth(...args){\n        if(args.length==2) return (<any>Layout).getDesiredWidth_2(...args);\n        if(args.length==4) return (<any>Layout).getDesiredWidth_4(...args);\n    }\n    private static getDesiredWidth_2(source:String, paint:TextPaint):number  {\n        return Layout.getDesiredWidth(source, 0, source.length, paint);\n    }\n\n    /**\n     * Return how wide a layout must be in order to display the\n     * specified text slice with one line per paragraph.\n     */\n    private static getDesiredWidth_4(source:String, start:number, end:number, paint:TextPaint):number  {\n        let need:number = 0;\n        let next:number;\n        for (let i:number = start; i <= end; i = next) {\n            next = source.substring(0, end).indexOf('\\n', i);//TextUtils.indexOf(source, '\\n', i, end);\n            if (next < 0) next = end;\n            // note, omits trailing paragraph char\n            let w:number = Layout.measurePara(paint, source, i, next);\n            if (w > need)\n                need = w;\n            next++;\n        }\n        return need;\n    }\n\n    /**\n     * Subclasses of Layout use this constructor to set the display text,\n     * width, and other standard properties.\n     * @param text the text to render\n     * @param paint the default paint for the layout.  Styles can override\n     * various attributes of the paint.\n     * @param width the wrapping width for the text.\n     * @param align whether to left, right, or center the text.  Styles can\n     * override the alignment.\n     * @param textDir default FIRSTSTRONG_LTR\n     * @param spacingMult factor by which to scale the font size to get the\n     * default line spacing\n     * @param spacingAdd amount to add to the default line spacing\n     *\n     * @hide\n     */\n    constructor(text:String, paint:TextPaint, width:number, align:Layout.Alignment,\n                textDir:TextDirectionHeuristic = TextDirectionHeuristics.FIRSTSTRONG_LTR,\n                spacingMult:number = 1, spacingAdd:number = 0) {\n        if (width < 0)\n            throw Error(`new IllegalArgumentException(\"Layout: \" + width + \" < 0\")`);\n        // baselineShift and bgColor.  We probably should reevaluate bgColor.\n        if (paint != null) {\n            paint.bgColor = 0;\n            paint.baselineShift = 0;\n        }\n        this.mText = text;\n        this.mPaint = paint;\n        this.mWorkPaint = new TextPaint();\n        this.mWidth = width;\n        this.mAlignment = align;\n        this.mSpacingMult = spacingMult;\n        this.mSpacingAdd = spacingAdd;\n        this.mSpannedText = Spanned.isImplements(text);\n        this.mTextDir = textDir;\n    }\n\n    /**\n     * Replace constructor properties of this Layout with new ones.  Be careful.\n     */\n    /* package */\n    replaceWith(text:String, paint:TextPaint, width:number, align:Layout.Alignment, spacingmult:number, spacingadd:number):void  {\n        if (width < 0) {\n            throw Error(`new IllegalArgumentException(\"Layout: \" + width + \" < 0\")`);\n        }\n        this.mText = text;\n        this.mPaint = paint;\n        this.mWidth = width;\n        this.mAlignment = align;\n        this.mSpacingMult = spacingmult;\n        this.mSpacingAdd = spacingadd;\n        this.mSpannedText = Spanned.isImplements(text);\n    }\n\n\n    /**\n     * Draw this Layout on the specified canvas, with the highlight path drawn\n     * between the background and the text.\n     *\n     * @param canvas the canvas\n     * @param highlight the path of the highlight or cursor; can be null\n     * @param highlightPaint the paint for the highlight\n     * @param cursorOffsetVertical the amount to temporarily translate the\n     *        canvas while rendering the highlight\n     */\n    draw(canvas:Canvas, highlight:Path=null, highlightPaint:Paint=null, cursorOffsetVertical:number=0):void  {\n        const lineRange:number[] = this.getLineRangeForDraw(canvas);\n        let firstLine:number = TextUtils.unpackRangeStartFromLong(lineRange);\n        let lastLine:number = TextUtils.unpackRangeEndFromLong(lineRange);\n        if (lastLine < 0)\n            return;\n        this.drawBackground(canvas, highlight, highlightPaint, cursorOffsetVertical, firstLine, lastLine);\n        this.drawText(canvas, firstLine, lastLine);\n    }\n\n    /**\n     * @hide\n     */\n    drawText(canvas:Canvas, firstLine:number, lastLine:number):void  {\n        let previousLineBottom:number = this.getLineTop(firstLine);\n        let previousLineEnd:number = this.getLineStart(firstLine);\n        let spans:ParagraphStyle[] = Layout.NO_PARA_SPANS;\n        let spanEnd:number = 0;\n        let paint:TextPaint = this.mPaint;\n        let buf:String = this.mText;\n        let paraAlign:Layout.Alignment = this.mAlignment;\n        let tabStops:Layout.TabStops = null;\n        let tabStopsIsInitialized:boolean = false;\n        let tl:TextLine = TextLine.obtain();\n        // The baseline is the top of the following line minus the current line's descent.\n        for (let i:number = firstLine; i <= lastLine; i++) {\n            let start:number = previousLineEnd;\n            previousLineEnd = this.getLineStart(i + 1);\n            let end:number = this.getLineVisibleEnd(i, start, previousLineEnd);\n            let ltop:number = previousLineBottom;\n            let lbottom:number = this.getLineTop(i + 1);\n            previousLineBottom = lbottom;\n            let lbaseline:number = lbottom - this.getLineDescent(i);\n            let dir:number = this.getParagraphDirection(i);\n            let left:number = 0;\n            let right:number = this.mWidth;\n            if (this.mSpannedText) {\n                let sp:Spanned = <Spanned> buf;\n                let textLength:number = buf.length;\n                let isFirstParaLine:boolean = (start == 0 || buf.charAt(start - 1) == '\\n');\n                // our problem.\n                if (start >= spanEnd && (i == firstLine || isFirstParaLine)) {\n                    spanEnd = sp.nextSpanTransition(start, textLength, ParagraphStyle.type);\n                    spans = Layout.getParagraphSpans(sp, start, spanEnd, ParagraphStyle.type);\n                    paraAlign = this.mAlignment;\n                    //for (let n:number = spans.length - 1; n >= 0; n--) {\n                    //    if (spans[n] instanceof AlignmentSpan) {\n                    //        paraAlign = (<AlignmentSpan> spans[n]).getAlignment();\n                    //        break;\n                    //    }\n                    //}\n                    tabStopsIsInitialized = false;\n                }\n                // Draw all leading margin spans.  Adjust left or right according\n                // to the paragraph direction of the line.\n                const length:number = spans.length;\n                for (let n:number = 0; n < length; n++) {\n                    if (LeadingMarginSpan.isImpl(spans[n])) {\n                        let margin:LeadingMarginSpan = <LeadingMarginSpan> spans[n];\n                        let useFirstLineMargin:boolean = isFirstParaLine;\n                        if (LeadingMarginSpan2.isImpl(margin)) {\n                            let count:number = (<LeadingMarginSpan2> margin).getLeadingMarginLineCount();\n                            let startLine:number = this.getLineForOffset(sp.getSpanStart(margin));\n                            useFirstLineMargin = i < startLine + count;\n                        }\n                        if (dir == Layout.DIR_RIGHT_TO_LEFT) {\n                            margin.drawLeadingMargin(canvas, paint, right, dir, ltop, lbaseline, lbottom, buf, start, end, isFirstParaLine, this);\n                            right -= margin.getLeadingMargin(useFirstLineMargin);\n                        } else {\n                            margin.drawLeadingMargin(canvas, paint, left, dir, ltop, lbaseline, lbottom, buf, start, end, isFirstParaLine, this);\n                            left += margin.getLeadingMargin(useFirstLineMargin);\n                        }\n                    }\n                }\n            }\n            let hasTabOrEmoji:boolean = this.getLineContainsTab(i);\n            // Can't tell if we have tabs for sure, currently\n            if (hasTabOrEmoji && !tabStopsIsInitialized) {\n                if (tabStops == null) {\n                    tabStops = new Layout.TabStops(Layout.TAB_INCREMENT, spans);\n                } else {\n                    tabStops.reset(Layout.TAB_INCREMENT, spans);\n                }\n                tabStopsIsInitialized = true;\n            }\n            // Determine whether the line aligns to normal, opposite, or center.\n            let align:Layout.Alignment = paraAlign;\n            if (align == Layout.Alignment.ALIGN_LEFT) {\n                align = (dir == Layout.DIR_LEFT_TO_RIGHT) ? Layout.Alignment.ALIGN_NORMAL : Layout.Alignment.ALIGN_OPPOSITE;\n            } else if (align == Layout.Alignment.ALIGN_RIGHT) {\n                align = (dir == Layout.DIR_LEFT_TO_RIGHT) ? Layout.Alignment.ALIGN_OPPOSITE : Layout.Alignment.ALIGN_NORMAL;\n            }\n            let x:number;\n            if (align == Layout.Alignment.ALIGN_NORMAL) {\n                if (dir == Layout.DIR_LEFT_TO_RIGHT) {\n                    x = left;\n                } else {\n                    x = right;\n                }\n            } else {\n                let max:number = Math.floor(this.getLineExtent(i, tabStops, false));\n                if (align == Layout.Alignment.ALIGN_OPPOSITE) {\n                    if (dir == Layout.DIR_LEFT_TO_RIGHT) {\n                        x = right - max;\n                    } else {\n                        x = left - max;\n                    }\n                } else {\n                    // Layout.Alignment.ALIGN_CENTER\n                    max = max & ~1;\n                    x = (right + left - max) >> 1;\n                }\n            }\n            let directions:Layout.Directions = this.getLineDirections(i);\n            if (directions == Layout.DIRS_ALL_LEFT_TO_RIGHT && !this.mSpannedText && !hasTabOrEmoji) {\n                // XXX: assumes there's nothing additional to be done\n                canvas.drawText_end(buf.toString(), start, end, x, lbaseline, paint);\n            } else {\n                tl.set(paint, buf, start, end, dir, directions, hasTabOrEmoji, tabStops);\n                tl.draw(canvas, x, ltop, lbaseline, lbottom);\n            }\n        }\n        TextLine.recycle(tl);\n    }\n\n    /**\n     * @hide\n     */\n    drawBackground(canvas:Canvas, highlight:Path, highlightPaint:Paint, cursorOffsetVertical:number, firstLine:number, lastLine:number):void  {\n        // They are evaluated at each line.\n        if (this.mSpannedText) {\n            if (this.mLineBackgroundSpans == null) {\n                this.mLineBackgroundSpans = new SpanSet<LineBackgroundSpan>(LineBackgroundSpan.type);\n            }\n            let buffer:Spanned = <Spanned> this.mText;\n            let textLength:number = buffer.length;\n            this.mLineBackgroundSpans.init(buffer, 0, textLength);\n            if (this.mLineBackgroundSpans.numberOfSpans > 0) {\n                let previousLineBottom:number = this.getLineTop(firstLine);\n                let previousLineEnd:number = this.getLineStart(firstLine);\n                let spans:ParagraphStyle[] = Layout.NO_PARA_SPANS;\n                let spansLength:number = 0;\n                let paint:TextPaint = this.mPaint;\n                let spanEnd:number = 0;\n                const width:number = this.mWidth;\n                for (let i:number = firstLine; i <= lastLine; i++) {\n                    let start:number = previousLineEnd;\n                    let end:number = this.getLineStart(i + 1);\n                    previousLineEnd = end;\n                    let ltop:number = previousLineBottom;\n                    let lbottom:number = this.getLineTop(i + 1);\n                    previousLineBottom = lbottom;\n                    let lbaseline:number = lbottom - this.getLineDescent(i);\n                    if (start >= spanEnd) {\n                        // These should be infrequent, so we'll use this so that\n                        // we don't have to check as often.\n                        spanEnd = this.mLineBackgroundSpans.getNextTransition(start, textLength);\n                        // All LineBackgroundSpans on a line contribute to its background.\n                        spansLength = 0;\n                        // Duplication of the logic of getParagraphSpans\n                        if (start != end || start == 0) {\n                            // array instead to reduce memory allocation\n                            for (let j:number = 0; j < this.mLineBackgroundSpans.numberOfSpans; j++) {\n                                // construction\n                                if (this.mLineBackgroundSpans.spanStarts[j] >= end || this.mLineBackgroundSpans.spanEnds[j] <= start)\n                                    continue;\n                                if (spansLength == spans.length) {\n                                    // The spans array needs to be expanded\n                                    let newSize:number = (2 * spansLength);\n                                    let newSpans:ParagraphStyle[] = new Array<ParagraphStyle>(newSize);\n                                    System.arraycopy(spans, 0, newSpans, 0, spansLength);\n                                    spans = newSpans;\n                                }\n                                spans[spansLength++] = this.mLineBackgroundSpans.spans[j];\n                            }\n                        }\n                    }\n                    for (let n:number = 0; n < spansLength; n++) {\n                        let lineBackgroundSpan:LineBackgroundSpan = <LineBackgroundSpan> spans[n];\n                        lineBackgroundSpan.drawBackground(canvas, paint, 0, width, ltop, lbaseline, lbottom, buffer, start, end, i);\n                    }\n                }\n            }\n            this.mLineBackgroundSpans.recycle();\n        }\n        // a non-spanned transformation of a spanned editing buffer.\n        if (highlight != null) {\n            if (cursorOffsetVertical != 0)\n                canvas.translate(0, cursorOffsetVertical);\n            canvas.drawPath(highlight, highlightPaint);\n            if (cursorOffsetVertical != 0)\n                canvas.translate(0, -cursorOffsetVertical);\n        }\n    }\n\n    /**\n     * @param canvas\n     * @return The range of lines that need to be drawn, possibly empty.\n     * @hide\n     */\n    getLineRangeForDraw(canvas:Canvas):number[]  {\n        let dtop:number, dbottom:number;\n        {\n            if (!canvas.getClipBounds(Layout.sTempRect)) {\n                // Negative range end used as a special flag\n                return TextUtils.packRangeInLong(0, -1);\n            }\n            dtop = Layout.sTempRect.top;\n            dbottom = Layout.sTempRect.bottom;\n        }\n        const top:number = Math.max(dtop, 0);\n        const bottom:number = Math.min(this.getLineTop(this.getLineCount()), dbottom);\n        if (top >= bottom)\n            return TextUtils.packRangeInLong(0, -1);\n        return TextUtils.packRangeInLong(this.getLineForVertical(top), this.getLineForVertical(bottom));\n    }\n\n    /**\n     * Return the start position of the line, given the left and right bounds\n     * of the margins.\n     *\n     * @param line the line index\n     * @param left the left bounds (0, or leading margin if ltr para)\n     * @param right the right bounds (width, minus leading margin if rtl para)\n     * @return the start position of the line (to right of line if rtl para)\n     */\n    private getLineStartPos(line:number, left:number, right:number):number  {\n        // Adjust the point at which to start rendering depending on the\n        // alignment of the paragraph.\n        let align:Layout.Alignment = this.getParagraphAlignment(line);\n        let dir:number = this.getParagraphDirection(line);\n        if (align == Layout.Alignment.ALIGN_LEFT) {\n            align = (dir == Layout.DIR_LEFT_TO_RIGHT) ? Layout.Alignment.ALIGN_NORMAL : Layout.Alignment.ALIGN_OPPOSITE;\n        } else if (align == Layout.Alignment.ALIGN_RIGHT) {\n            align = (dir == Layout.DIR_LEFT_TO_RIGHT) ? Layout.Alignment.ALIGN_OPPOSITE : Layout.Alignment.ALIGN_NORMAL;\n        }\n        let x:number;\n        if (align == Layout.Alignment.ALIGN_NORMAL) {\n            if (dir == Layout.DIR_LEFT_TO_RIGHT) {\n                x = left;\n            } else {\n                x = right;\n            }\n        } else {\n            let tabStops:Layout.TabStops = null;\n            if (this.mSpannedText && this.getLineContainsTab(line)) {\n                let spanned:Spanned = <Spanned> this.mText;\n                let start:number = this.getLineStart(line);\n                let spanEnd:number = spanned.nextSpanTransition(start, spanned.length, TabStopSpan.type);\n                let tabSpans:TabStopSpan[] = Layout.getParagraphSpans<TabStopSpan>(spanned, start, spanEnd, TabStopSpan.type);\n                if (tabSpans.length > 0) {\n                    tabStops = new Layout.TabStops(Layout.TAB_INCREMENT, tabSpans);\n                }\n            }\n            let max:number = Math.floor(this.getLineExtent(line, tabStops, false));\n            if (align == Layout.Alignment.ALIGN_OPPOSITE) {\n                if (dir == Layout.DIR_LEFT_TO_RIGHT) {\n                    x = right - max;\n                } else {\n                    // max is negative here\n                    x = left - max;\n                }\n            } else {\n                // Layout.Alignment.ALIGN_CENTER\n                max = max & ~1;\n                x = (left + right - max) >> 1;\n            }\n        }\n        return x;\n    }\n\n    /**\n     * Return the text that is displayed by this Layout.\n     */\n    getText():String  {\n        return this.mText;\n    }\n\n    /**\n     * Return the base Paint properties for this layout.\n     * Do NOT change the paint, which may result in funny\n     * drawing for this layout.\n     */\n    getPaint():TextPaint  {\n        return this.mPaint;\n    }\n\n    /**\n     * Return the width of this layout.\n     */\n    getWidth():number  {\n        return this.mWidth;\n    }\n\n    /**\n     * Return the width to which this Layout is ellipsizing, or\n     * {@link #getWidth} if it is not doing anything special.\n     */\n    getEllipsizedWidth():number  {\n        return this.mWidth;\n    }\n\n    /**\n     * Increase the width of this layout to the specified width.\n     * Be careful to use this only when you know it is appropriate&mdash;\n     * it does not cause the text to reflow to use the full new width.\n     */\n    increaseWidthTo(wid:number):void  {\n        if (wid < this.mWidth) {\n            throw Error(`new RuntimeException(\"attempted to reduce Layout width\")`);\n        }\n        this.mWidth = wid;\n    }\n\n    /**\n     * Return the total height of this layout.\n     */\n    getHeight():number  {\n        return this.getLineTop(this.getLineCount());\n    }\n\n    /**\n     * Return the base alignment of this layout.\n     */\n    getAlignment():Layout.Alignment  {\n        return this.mAlignment;\n    }\n\n    /**\n     * Return what the text height is multiplied by to get the line height.\n     */\n    getSpacingMultiplier():number  {\n        return this.mSpacingMult;\n    }\n\n    /**\n     * Return the number of units of leading that are added to each line.\n     */\n    getSpacingAdd():number  {\n        return this.mSpacingAdd;\n    }\n\n    /**\n     * Return the heuristic used to determine paragraph text direction.\n     * @hide\n     */\n    getTextDirectionHeuristic():TextDirectionHeuristic  {\n        return this.mTextDir;\n    }\n\n    /**\n     * Return the number of lines of text in this layout.\n     */\n    abstract getLineCount():number ;\n\n    /**\n     * Return the baseline for the specified line (0&hellip;getLineCount() - 1)\n     * If bounds is not null, return the top, left, right, bottom extents\n     * of the specified line in it.\n     * @param line which line to examine (0..getLineCount() - 1)\n     * @param bounds Optional. If not null, it returns the extent of the line\n     * @return the Y-coordinate of the baseline\n     */\n    getLineBounds(line:number, bounds:Rect):number  {\n        if (bounds != null) {\n            // ???\n            bounds.left = 0;\n            bounds.top = this.getLineTop(line);\n            // ???\n            bounds.right = this.mWidth;\n            bounds.bottom = this.getLineTop(line + 1);\n        }\n        return this.getLineBaseline(line);\n    }\n\n    /**\n     * Return the vertical position of the top of the specified line\n     * (0&hellip;getLineCount()).\n     * If the specified line is equal to the line count, returns the\n     * bottom of the last line.\n     */\n    abstract getLineTop(line:number):number ;\n\n    /**\n     * Return the descent of the specified line(0&hellip;getLineCount() - 1).\n     */\n    abstract getLineDescent(line:number):number ;\n\n    /**\n     * Return the text offset of the beginning of the specified line (\n     * 0&hellip;getLineCount()). If the specified line is equal to the line\n     * count, returns the length of the text.\n     */\n    abstract getLineStart(line:number):number ;\n\n    /**\n     * Returns the primary directionality of the paragraph containing the\n     * specified line, either 1 for left-to-right lines, or -1 for right-to-left\n     * lines (see {@link #DIR_LEFT_TO_RIGHT}, {@link #DIR_RIGHT_TO_LEFT}).\n     */\n    abstract getParagraphDirection(line:number):number ;\n\n    /**\n     * Returns whether the specified line contains one or more\n     * characters that need to be handled specially, like tabs\n     * or emoji.\n     */\n    abstract getLineContainsTab(line:number):boolean ;\n\n    /**\n     * Returns the directional run information for the specified line.\n     * The array alternates counts of characters in left-to-right\n     * and right-to-left segments of the line.\n     *\n     * <p>NOTE: this is inadequate to support bidirectional text, and will change.\n     */\n    abstract getLineDirections(line:number):Layout.Directions ;\n\n    /**\n     * Returns the (negative) number of extra pixels of ascent padding in the\n     * top line of the Layout.\n     */\n    abstract getTopPadding():number ;\n\n    /**\n     * Returns the number of extra pixels of descent padding in the\n     * bottom line of the Layout.\n     */\n    abstract getBottomPadding():number ;\n\n    /**\n     * Returns true if the character at offset and the preceding character\n     * are at different run levels (and thus there's a split caret).\n     * @param offset the offset\n     * @return true if at a level boundary\n     * @hide\n     */\n    isLevelBoundary(offset:number):boolean  {\n        let line:number = this.getLineForOffset(offset);\n        let dirs:Layout.Directions = this.getLineDirections(line);\n        if (dirs == Layout.DIRS_ALL_LEFT_TO_RIGHT || dirs == Layout.DIRS_ALL_RIGHT_TO_LEFT) {\n            return false;\n        }\n        let runs:number[] = dirs.mDirections;\n        let lineStart:number = this.getLineStart(line);\n        let lineEnd:number = this.getLineEnd(line);\n        if (offset == lineStart || offset == lineEnd) {\n            let paraLevel:number = this.getParagraphDirection(line) == 1 ? 0 : 1;\n            let runIndex:number = offset == lineStart ? 0 : runs.length - 2;\n            return ((runs[runIndex + 1] >>> Layout.RUN_LEVEL_SHIFT) & Layout.RUN_LEVEL_MASK) != paraLevel;\n        }\n        offset -= lineStart;\n        for (let i:number = 0; i < runs.length; i += 2) {\n            if (offset == runs[i]) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    /**\n     * Returns true if the character at offset is right to left (RTL).\n     * @param offset the offset\n     * @return true if the character is RTL, false if it is LTR\n     */\n    isRtlCharAt(offset:number):boolean  {\n        let line:number = this.getLineForOffset(offset);\n        let dirs:Layout.Directions = this.getLineDirections(line);\n        if (dirs == Layout.DIRS_ALL_LEFT_TO_RIGHT) {\n            return false;\n        }\n        if (dirs == Layout.DIRS_ALL_RIGHT_TO_LEFT) {\n            return true;\n        }\n        let runs:number[] = dirs.mDirections;\n        let lineStart:number = this.getLineStart(line);\n        for (let i:number = 0; i < runs.length; i += 2) {\n            let start:number = lineStart + (runs[i] & Layout.RUN_LENGTH_MASK);\n            // corresponding of the last run\n            if (offset >= start) {\n                let level:number = (runs[i + 1] >>> Layout.RUN_LEVEL_SHIFT) & Layout.RUN_LEVEL_MASK;\n                return ((level & 1) != 0);\n            }\n        }\n        // Should happen only if the offset is \"out of bounds\"\n        return false;\n    }\n\n    private primaryIsTrailingPrevious(offset:number):boolean  {\n        let line:number = this.getLineForOffset(offset);\n        let lineStart:number = this.getLineStart(line);\n        let lineEnd:number = this.getLineEnd(line);\n        let runs:number[] = this.getLineDirections(line).mDirections;\n        let levelAt:number = -1;\n        for (let i:number = 0; i < runs.length; i += 2) {\n            let start:number = lineStart + runs[i];\n            let limit:number = start + (runs[i + 1] & Layout.RUN_LENGTH_MASK);\n            if (limit > lineEnd) {\n                limit = lineEnd;\n            }\n            if (offset >= start && offset < limit) {\n                if (offset > start) {\n                    // Previous character is at same level, so don't use trailing.\n                    return false;\n                }\n                levelAt = (runs[i + 1] >>> Layout.RUN_LEVEL_SHIFT) & Layout.RUN_LEVEL_MASK;\n                break;\n            }\n        }\n        if (levelAt == -1) {\n            // Offset was limit of line.\n            levelAt = this.getParagraphDirection(line) == 1 ? 0 : 1;\n        }\n        // At level boundary, check previous level.\n        let levelBefore:number = -1;\n        if (offset == lineStart) {\n            levelBefore = this.getParagraphDirection(line) == 1 ? 0 : 1;\n        } else {\n            offset -= 1;\n            for (let i:number = 0; i < runs.length; i += 2) {\n                let start:number = lineStart + runs[i];\n                let limit:number = start + (runs[i + 1] & Layout.RUN_LENGTH_MASK);\n                if (limit > lineEnd) {\n                    limit = lineEnd;\n                }\n                if (offset >= start && offset < limit) {\n                    levelBefore = (runs[i + 1] >>> Layout.RUN_LEVEL_SHIFT) & Layout.RUN_LEVEL_MASK;\n                    break;\n                }\n            }\n        }\n        return levelBefore < levelAt;\n    }\n\n    /**\n     * Get the primary horizontal position for the specified text offset, but\n     * optionally clamp it so that it doesn't exceed the width of the layout.\n     * @hide\n     */\n    getPrimaryHorizontal(offset:number, clamped=false):number  {\n        let trailing:boolean = this.primaryIsTrailingPrevious(offset);\n        return this.getHorizontal(offset, trailing, clamped);\n    }\n\n    /**\n     * Get the secondary horizontal position for the specified text offset, but\n     * optionally clamp it so that it doesn't exceed the width of the layout.\n     * @hide\n     */\n    getSecondaryHorizontal(offset:number, clamped=false):number  {\n        let trailing:boolean = this.primaryIsTrailingPrevious(offset);\n        return this.getHorizontal(offset, !trailing, clamped);\n    }\n\n    private getHorizontal(offset:number, trailing:boolean, clamped:boolean):number  {\n        let line:number = this.getLineForOffset(offset);\n        return this.getHorizontal_4(offset, trailing, line, clamped);\n    }\n\n    private getHorizontal_4(offset:number, trailing:boolean, line:number, clamped:boolean):number  {\n        let start:number = this.getLineStart(line);\n        let end:number = this.getLineEnd(line);\n        let dir:number = this.getParagraphDirection(line);\n        let hasTabOrEmoji:boolean = this.getLineContainsTab(line);\n        let directions:Layout.Directions = this.getLineDirections(line);\n        let tabStops:Layout.TabStops = null;\n        if (hasTabOrEmoji && Spanned.isImplements(this.mText)) {\n            // Just checking this line should be good enough, tabs should be\n            // consistent across all lines in a paragraph.\n            let tabs:TabStopSpan[] = Layout.getParagraphSpans<TabStopSpan>(<Spanned> this.mText, start, end, TabStopSpan.type);\n            if (tabs.length > 0) {\n                // XXX should reuse\n                tabStops = new Layout.TabStops(Layout.TAB_INCREMENT, tabs);\n            }\n        }\n        let tl:TextLine = TextLine.obtain();\n        tl.set(this.mPaint, this.mText, start, end, dir, directions, hasTabOrEmoji, tabStops);\n        let wid:number = tl.measure(offset - start, trailing, null);\n        TextLine.recycle(tl);\n        if (clamped && wid > this.mWidth) {\n            wid = this.mWidth;\n        }\n        let left:number = this.getParagraphLeft(line);\n        let right:number = this.getParagraphRight(line);\n        return this.getLineStartPos(line, left, right) + wid;\n    }\n\n    /**\n     * Get the leftmost position that should be exposed for horizontal\n     * scrolling on the specified line.\n     */\n    getLineLeft(line:number):number  {\n        let dir:number = this.getParagraphDirection(line);\n        let align:Layout.Alignment = this.getParagraphAlignment(line);\n        if (align == Layout.Alignment.ALIGN_LEFT) {\n            return 0;\n        } else if (align == Layout.Alignment.ALIGN_NORMAL) {\n            if (dir == Layout.DIR_RIGHT_TO_LEFT)\n                return this.getParagraphRight(line) - this.getLineMax(line);\n            else\n                return 0;\n        } else if (align == Layout.Alignment.ALIGN_RIGHT) {\n            return this.mWidth - this.getLineMax(line);\n        } else if (align == Layout.Alignment.ALIGN_OPPOSITE) {\n            if (dir == Layout.DIR_RIGHT_TO_LEFT)\n                return 0;\n            else\n                return this.mWidth - this.getLineMax(line);\n        } else {\n            /* align == Layout.Alignment.ALIGN_CENTER */\n            let left:number = this.getParagraphLeft(line);\n            let right:number = this.getParagraphRight(line);\n            let max:number = (Math.floor(this.getLineMax(line))) & ~1;\n            return left + ((right - left) - max) / 2;\n        }\n    }\n\n    /**\n     * Get the rightmost position that should be exposed for horizontal\n     * scrolling on the specified line.\n     */\n    getLineRight(line:number):number  {\n        let dir:number = this.getParagraphDirection(line);\n        let align:Layout.Alignment = this.getParagraphAlignment(line);\n        if (align == Layout.Alignment.ALIGN_LEFT) {\n            return this.getParagraphLeft(line) + this.getLineMax(line);\n        } else if (align == Layout.Alignment.ALIGN_NORMAL) {\n            if (dir == Layout.DIR_RIGHT_TO_LEFT)\n                return this.mWidth;\n            else\n                return this.getParagraphLeft(line) + this.getLineMax(line);\n        } else if (align == Layout.Alignment.ALIGN_RIGHT) {\n            return this.mWidth;\n        } else if (align == Layout.Alignment.ALIGN_OPPOSITE) {\n            if (dir == Layout.DIR_RIGHT_TO_LEFT)\n                return this.getLineMax(line);\n            else\n                return this.mWidth;\n        } else {\n            /* align == Layout.Alignment.ALIGN_CENTER */\n            let left:number = this.getParagraphLeft(line);\n            let right:number = this.getParagraphRight(line);\n            let max:number = (Math.floor(this.getLineMax(line))) & ~1;\n            return right - ((right - left) - max) / 2;\n        }\n    }\n\n    /**\n     * Gets the unsigned horizontal extent of the specified line, including\n     * leading margin indent, but excluding trailing whitespace.\n     */\n    getLineMax(line:number):number  {\n        let margin:number = this.getParagraphLeadingMargin(line);\n        let signedExtent:number = this.getLineExtent(line, false);\n        return margin + signedExtent >= 0 ? signedExtent : -signedExtent;\n    }\n\n    /**\n     * Gets the unsigned horizontal extent of the specified line, including\n     * leading margin indent and trailing whitespace.\n     */\n    getLineWidth(line:number):number  {\n        let margin:number = this.getParagraphLeadingMargin(line);\n        let signedExtent:number = this.getLineExtent(line, true);\n        return margin + signedExtent >= 0 ? signedExtent : -signedExtent;\n    }\n\n    private getLineExtent(line:number, full:boolean):number;\n    private getLineExtent(line:number, tabStops:Layout.TabStops, full:boolean):number;\n    private getLineExtent(...args):number{\n        if(args.length===2) return (<any>this).getLineExtent_2(...args);\n        if(args.length===3) return (<any>this).getLineExtent_3(...args);\n    }\n    /**\n     * Like {@link #getLineExtent(int,TabStops,boolean)} but determines the\n     * tab stops instead of using the ones passed in.\n     * @param line the index of the line\n     * @param full whether to include trailing whitespace\n     * @return the extent of the line\n     */\n    private getLineExtent_2(line:number, full:boolean):number  {\n        let start:number = this.getLineStart(line);\n        let end:number = full ? this.getLineEnd(line) : this.getLineVisibleEnd(line);\n        let hasTabsOrEmoji:boolean = this.getLineContainsTab(line);\n        let tabStops:Layout.TabStops = null;\n        if (hasTabsOrEmoji && Spanned.isImplements(this.mText)) {\n            // Just checking this line should be good enough, tabs should be\n            // consistent across all lines in a paragraph.\n            let tabs:TabStopSpan[] = Layout.getParagraphSpans<TabStopSpan>(<Spanned> this.mText, start, end, TabStopSpan.type);\n            if (tabs.length > 0) {\n                // XXX should reuse\n                tabStops = new Layout.TabStops(Layout.TAB_INCREMENT, tabs);\n            }\n        }\n        let directions:Layout.Directions = this.getLineDirections(line);\n        // Returned directions can actually be null\n        if (directions == null) {\n            return 0;\n        }\n        let dir:number = this.getParagraphDirection(line);\n        let tl:TextLine = TextLine.obtain();\n        tl.set(this.mPaint, this.mText, start, end, dir, directions, hasTabsOrEmoji, tabStops);\n        let width:number = tl.metrics(null);\n        TextLine.recycle(tl);\n        return width;\n    }\n\n    /**\n     * Returns the signed horizontal extent of the specified line, excluding\n     * leading margin.  If full is false, excludes trailing whitespace.\n     * @param line the index of the line\n     * @param tabStops the tab stops, can be null if we know they're not used.\n     * @param full whether to include trailing whitespace\n     * @return the extent of the text on this line\n     */\n    private getLineExtent_3(line:number, tabStops:Layout.TabStops, full:boolean):number  {\n        let start:number = this.getLineStart(line);\n        let end:number = full ? this.getLineEnd(line) : this.getLineVisibleEnd(line);\n        let hasTabsOrEmoji:boolean = this.getLineContainsTab(line);\n        let directions:Layout.Directions = this.getLineDirections(line);\n        let dir:number = this.getParagraphDirection(line);\n        let tl:TextLine = TextLine.obtain();\n        tl.set(this.mPaint, this.mText, start, end, dir, directions, hasTabsOrEmoji, tabStops);\n        let width:number = tl.metrics(null);\n        TextLine.recycle(tl);\n        return width;\n    }\n\n    /**\n     * Get the line number corresponding to the specified vertical position.\n     * If you ask for a position above 0, you get 0; if you ask for a position\n     * below the bottom of the text, you get the last line.\n     */\n    // FIXME: It may be faster to do a linear search for layouts without many lines.\n    getLineForVertical(vertical:number):number  {\n        let high:number = this.getLineCount(), low:number = -1, guess:number;\n        while (high - low > 1) {\n            guess = Math.floor((high + low) / 2);\n            if (this.getLineTop(guess) > vertical)\n                high = guess;\n            else\n                low = guess;\n        }\n        if (low < 0)\n            return 0;\n        else\n            return low;\n    }\n\n    /**\n     * Get the line number on which the specified text offset appears.\n     * If you ask for a position before 0, you get 0; if you ask for a position\n     * beyond the end of the text, you get the last line.\n     */\n    getLineForOffset(offset:number):number  {\n        let high:number = this.getLineCount(), low:number = -1, guess:number;\n        while (high - low > 1) {\n            guess = Math.floor((high + low) / 2);\n            if (this.getLineStart(guess) > offset)\n                high = guess;\n            else\n                low = guess;\n        }\n        if (low < 0)\n            return 0;\n        else\n            return low;\n    }\n\n    /**\n     * Get the character offset on the specified line whose position is\n     * closest to the specified horizontal position.\n     */\n    getOffsetForHorizontal(line:number, horiz:number):number  {\n        let max:number = this.getLineEnd(line) - 1;\n        let min:number = this.getLineStart(line);\n        let dirs:Layout.Directions = this.getLineDirections(line);\n        if (line == this.getLineCount() - 1)\n            max++;\n        let best:number = min;\n        let bestdist:number = Math.abs(this.getPrimaryHorizontal(best) - horiz);\n        for (let i:number = 0; i < dirs.mDirections.length; i += 2) {\n            let here:number = min + dirs.mDirections[i];\n            let there:number = here + (dirs.mDirections[i + 1] & Layout.RUN_LENGTH_MASK);\n            let swap:number = (dirs.mDirections[i + 1] & Layout.RUN_RTL_FLAG) != 0 ? -1 : 1;\n            if (there > max)\n                there = max;\n            let high:number = there - 1 + 1, low:number = here + 1 - 1, guess:number;\n            while (high - low > 1) {\n                guess = Math.floor((high + low) / 2);\n                let adguess:number = this.getOffsetAtStartOf(guess);\n                if (this.getPrimaryHorizontal(adguess) * swap >= horiz * swap)\n                    high = guess;\n                else\n                    low = guess;\n            }\n            if (low < here + 1)\n                low = here + 1;\n            if (low < there) {\n                low = this.getOffsetAtStartOf(low);\n                let dist:number = Math.abs(this.getPrimaryHorizontal(low) - horiz);\n                let aft:number = TextUtils.getOffsetAfter(this.mText, low);\n                if (aft < there) {\n                    let other:number = Math.abs(this.getPrimaryHorizontal(aft) - horiz);\n                    if (other < dist) {\n                        dist = other;\n                        low = aft;\n                    }\n                }\n                if (dist < bestdist) {\n                    bestdist = dist;\n                    best = low;\n                }\n            }\n            let dist:number = Math.abs(this.getPrimaryHorizontal(here) - horiz);\n            if (dist < bestdist) {\n                bestdist = dist;\n                best = here;\n            }\n        }\n        let dist:number = Math.abs(this.getPrimaryHorizontal(max) - horiz);\n        if (dist <= bestdist) {\n            bestdist = dist;\n            best = max;\n        }\n        return best;\n    }\n\n    /**\n     * Return the text offset after the last character on the specified line.\n     */\n    getLineEnd(line:number):number  {\n        return this.getLineStart(line + 1);\n    }\n\n    /**\n     * Return the text offset after the last visible character (so whitespace\n     * is not counted) on the specified line.\n     */\n    private getLineVisibleEnd(line:number, start:number=this.getLineStart(line), end:number=this.getLineStart(line + 1)):number  {\n        let text:String = this.mText;\n        let ch:string;\n        if (line == this.getLineCount() - 1) {\n            return end;\n        }\n        for (; end > start; end--) {\n            ch = text.charAt(end - 1);\n            if (ch == '\\n') {\n                return end - 1;\n            }\n            if (ch != ' ' && ch != '\\t') {\n                break;\n            }\n        }\n        return end;\n    }\n\n    /**\n     * Return the vertical position of the bottom of the specified line.\n     */\n    getLineBottom(line:number):number  {\n        return this.getLineTop(line + 1);\n    }\n\n    /**\n     * Return the vertical position of the baseline of the specified line.\n     */\n    getLineBaseline(line:number):number  {\n        // getLineTop(line+1) == getLineTop(line)\n        return this.getLineTop(line + 1) - this.getLineDescent(line);\n    }\n\n    /**\n     * Get the ascent of the text on the specified line.\n     * The return value is negative to match the Paint.ascent() convention.\n     */\n    getLineAscent(line:number):number  {\n        // getLineTop(line+1) - getLineDescent(line) == getLineBaseLine(line)\n        return this.getLineTop(line) - (this.getLineTop(line + 1) - this.getLineDescent(line));\n    }\n\n    getOffsetToLeftOf(offset:number):number  {\n        return this.getOffsetToLeftRightOf(offset, true);\n    }\n\n    getOffsetToRightOf(offset:number):number  {\n        return this.getOffsetToLeftRightOf(offset, false);\n    }\n\n    private getOffsetToLeftRightOf(caret:number, toLeft:boolean):number  {\n        let line:number = this.getLineForOffset(caret);\n        let lineStart:number = this.getLineStart(line);\n        let lineEnd:number = this.getLineEnd(line);\n        let lineDir:number = this.getParagraphDirection(line);\n        let lineChanged:boolean = false;\n        let advance:boolean = toLeft == (lineDir == Layout.DIR_RIGHT_TO_LEFT);\n        // if walking off line, look at the line we're headed to\n        if (advance) {\n            if (caret == lineEnd) {\n                if (line < this.getLineCount() - 1) {\n                    lineChanged = true;\n                    ++line;\n                } else {\n                    // at very end, don't move\n                    return caret;\n                }\n            }\n        } else {\n            if (caret == lineStart) {\n                if (line > 0) {\n                    lineChanged = true;\n                    --line;\n                } else {\n                    // at very start, don't move\n                    return caret;\n                }\n            }\n        }\n        if (lineChanged) {\n            lineStart = this.getLineStart(line);\n            lineEnd = this.getLineEnd(line);\n            let newDir:number = this.getParagraphDirection(line);\n            if (newDir != lineDir) {\n                // unusual case.  we want to walk onto the line, but it runs\n                // in a different direction than this one, so we fake movement\n                // in the opposite direction.\n                toLeft = !toLeft;\n                lineDir = newDir;\n            }\n        }\n        let directions:Layout.Directions = this.getLineDirections(line);\n        let tl:TextLine = TextLine.obtain();\n        // XXX: we don't care about tabs\n        tl.set(this.mPaint, this.mText, lineStart, lineEnd, lineDir, directions, false, null);\n        caret = lineStart + tl.getOffsetToLeftRightOf(caret - lineStart, toLeft);\n        tl = TextLine.recycle(tl);\n        return caret;\n    }\n\n    private getOffsetAtStartOf(offset:number):number  {\n        // zero-width characters, look at callers\n        if (offset == 0)\n            return 0;\n        let text:String = this.mText;\n        let c:number = text.codePointAt(offset);\n        let questionMark = '?'.codePointAt(0);\n        if (c >= questionMark && c <= questionMark) {\n            let c1:number = text.codePointAt(offset - 1);\n            if (c1 >= questionMark && c1 <= questionMark)\n                offset -= 1;\n        }\n        if (this.mSpannedText) {\n            let spans:ReplacementSpan[] = (<Spanned> text).getSpans<ReplacementSpan>(offset, offset, ReplacementSpan.type);\n            for (let i:number = 0; i < spans.length; i++) {\n                let start:number = (<Spanned> text).getSpanStart(spans[i]);\n                let end:number = (<Spanned> text).getSpanEnd(spans[i]);\n                if (start < offset && end > offset)\n                    offset = start;\n            }\n        }\n        return offset;\n    }\n\n    /**\n     * Determine whether we should clamp cursor position. Currently it's\n     * only robust for left-aligned displays.\n     * @hide\n     */\n    shouldClampCursor(line:number):boolean  {\n        // Only clamp cursor position in left-aligned displays.\n        switch(this.getParagraphAlignment(line)) {\n            case Layout.Alignment.ALIGN_LEFT:\n                return true;\n            case Layout.Alignment.ALIGN_NORMAL:\n                return this.getParagraphDirection(line) > 0;\n            default:\n                return false;\n        }\n    }\n\n    /**\n     * Fills in the specified Path with a representation of a cursor\n     * at the specified offset.  This will often be a vertical line\n     * but can be multiple discontinuous lines in text with multiple\n     * directionalities.\n     */\n    getCursorPath(point:number, dest:Path, editingBuffer:String):void  {\n        dest.reset();\n        //let line:number = this.getLineForOffset(point);\n        //let top:number = this.getLineTop(line);\n        //let bottom:number = this.getLineTop(line + 1);\n        //let clamped:boolean = this.shouldClampCursor(line);\n        //let h1:number = this.getPrimaryHorizontal(point, clamped) - 0.5;\n        //let h2:number = this.isLevelBoundary(point) ? this.getSecondaryHorizontal(point, clamped) - 0.5 : h1;\n        //let caps:number = TextKeyListener.getMetaState(editingBuffer, TextKeyListener.META_SHIFT_ON) | TextKeyListener.getMetaState(editingBuffer, TextKeyListener.META_SELECTING);\n        //let fn:number = TextKeyListener.getMetaState(editingBuffer, TextKeyListener.META_ALT_ON);\n        //let dist:number = 0;\n        //if (caps != 0 || fn != 0) {\n        //    dist = (bottom - top) >> 2;\n        //    if (fn != 0)\n        //        top += dist;\n        //    if (caps != 0)\n        //        bottom -= dist;\n        //}\n        //if (h1 < 0.5)\n        //    h1 = 0.5;\n        //if (h2 < 0.5)\n        //    h2 = 0.5;\n        //if (Float.compare(h1, h2) == 0) {\n        //    dest.moveTo(h1, top);\n        //    dest.lineTo(h1, bottom);\n        //} else {\n        //    dest.moveTo(h1, top);\n        //    dest.lineTo(h1, (top + bottom) >> 1);\n        //    dest.moveTo(h2, (top + bottom) >> 1);\n        //    dest.lineTo(h2, bottom);\n        //}\n        //if (caps == 2) {\n        //    dest.moveTo(h2, bottom);\n        //    dest.lineTo(h2 - dist, bottom + dist);\n        //    dest.lineTo(h2, bottom);\n        //    dest.lineTo(h2 + dist, bottom + dist);\n        //} else if (caps == 1) {\n        //    dest.moveTo(h2, bottom);\n        //    dest.lineTo(h2 - dist, bottom + dist);\n        //    dest.moveTo(h2 - dist, bottom + dist - 0.5);\n        //    dest.lineTo(h2 + dist, bottom + dist - 0.5);\n        //    dest.moveTo(h2 + dist, bottom + dist);\n        //    dest.lineTo(h2, bottom);\n        //}\n        //if (fn == 2) {\n        //    dest.moveTo(h1, top);\n        //    dest.lineTo(h1 - dist, top - dist);\n        //    dest.lineTo(h1, top);\n        //    dest.lineTo(h1 + dist, top - dist);\n        //} else if (fn == 1) {\n        //    dest.moveTo(h1, top);\n        //    dest.lineTo(h1 - dist, top - dist);\n        //    dest.moveTo(h1 - dist, top - dist + 0.5);\n        //    dest.lineTo(h1 + dist, top - dist + 0.5);\n        //    dest.moveTo(h1 + dist, top - dist);\n        //    dest.lineTo(h1, top);\n        //}\n    }\n\n    private addSelection(line:number, start:number, end:number, top:number, bottom:number, dest:Path):void  {\n        //TODO selection\n        //let linestart:number = this.getLineStart(line);\n        //let lineend:number = this.getLineEnd(line);\n        //let dirs:Layout.Directions = this.getLineDirections(line);\n        //if (lineend > linestart && this.mText.charAt(lineend - 1) == '\\n')\n        //    lineend--;\n        //for (let i:number = 0; i < dirs.mDirections.length; i += 2) {\n        //    let here:number = linestart + dirs.mDirections[i];\n        //    let there:number = here + (dirs.mDirections[i + 1] & Layout.RUN_LENGTH_MASK);\n        //    if (there > lineend)\n        //        there = lineend;\n        //    if (start <= there && end >= here) {\n        //        let st:number = Math.max(start, here);\n        //        let en:number = Math.min(end, there);\n        //        if (st != en) {\n        //            let h1:number = this.getHorizontal_4(st, false, line, false);\n        //            let h2:number = this.getHorizontal_4(en, true, line, false);\n        //            let left:number = Math.min(h1, h2);\n        //            let right:number = Math.max(h1, h2);\n        //            dest.addRect(left, top, right, bottom, Path.Direction.CW);\n        //        }\n        //    }\n        //}\n    }\n\n    /**\n     * Fills in the specified Path with a representation of a highlight\n     * between the specified offsets.  This will often be a rectangle\n     * or a potentially discontinuous set of rectangles.  If the start\n     * and end are the same, the returned path is empty.\n     */\n    getSelectionPath(start:number, end:number, dest:Path):void  {\n        dest.reset();\n        //TODO selection\n        //if (start == end)\n        //    return;\n        //if (end < start) {\n        //    let temp:number = end;\n        //    end = start;\n        //    start = temp;\n        //}\n        //let startline:number = this.getLineForOffset(start);\n        //let endline:number = this.getLineForOffset(end);\n        //let top:number = this.getLineTop(startline);\n        //let bottom:number = this.getLineBottom(endline);\n        //if (startline == endline) {\n        //    this.addSelection(startline, start, end, top, bottom, dest);\n        //} else {\n        //    const width:number = this.mWidth;\n        //    this.addSelection(startline, start, this.getLineEnd(startline), top, this.getLineBottom(startline), dest);\n        //    if (this.getParagraphDirection(startline) == Layout.DIR_RIGHT_TO_LEFT)\n        //        dest.addRect(this.getLineLeft(startline), top, 0, this.getLineBottom(startline), Path.Direction.CW);\n        //    else\n        //        dest.addRect(this.getLineRight(startline), top, width, this.getLineBottom(startline), Path.Direction.CW);\n        //    for (let i:number = startline + 1; i < endline; i++) {\n        //        top = this.getLineTop(i);\n        //        bottom = this.getLineBottom(i);\n        //        dest.addRect(0, top, width, bottom, Path.Direction.CW);\n        //    }\n        //    top = this.getLineTop(endline);\n        //    bottom = this.getLineBottom(endline);\n        //    this.addSelection(endline, this.getLineStart(endline), end, top, bottom, dest);\n        //    if (this.getParagraphDirection(endline) == Layout.DIR_RIGHT_TO_LEFT)\n        //        dest.addRect(width, top, this.getLineRight(endline), bottom, Path.Direction.CW);\n        //    else\n        //        dest.addRect(0, top, this.getLineLeft(endline), bottom, Path.Direction.CW);\n        //}\n    }\n\n    /**\n     * Get the alignment of the specified paragraph, taking into account\n     * markup attached to it.\n     */\n    getParagraphAlignment(line:number):Layout.Alignment  {\n        let align:Layout.Alignment = this.mAlignment;\n        //if (this.mSpannedText) {\n        //    let sp:Spanned = <Spanned> this.mText;\n        //    let spans:AlignmentSpan[] = Layout.getParagraphSpans(sp, this.getLineStart(line), this.getLineEnd(line), AlignmentSpan.class);\n        //    let spanLength:number = spans.length;\n        //    if (spanLength > 0) {\n        //        align = spans[spanLength - 1].getAlignment();\n        //    }\n        //}\n        return align;\n    }\n\n    /**\n     * Get the left edge of the specified paragraph, inset by left margins.\n     */\n    getParagraphLeft(line:number):number  {\n        let left:number = 0;\n        let dir:number = this.getParagraphDirection(line);\n        if (dir == Layout.DIR_RIGHT_TO_LEFT || !this.mSpannedText) {\n            // leading margin has no impact, or no styles\n            return left;\n        }\n        return this.getParagraphLeadingMargin(line);\n    }\n\n    /**\n     * Get the right edge of the specified paragraph, inset by right margins.\n     */\n    getParagraphRight(line:number):number  {\n        let right:number = this.mWidth;\n        let dir:number = this.getParagraphDirection(line);\n        if (dir == Layout.DIR_LEFT_TO_RIGHT || !this.mSpannedText) {\n            // leading margin has no impact, or no styles\n            return right;\n        }\n        return right - this.getParagraphLeadingMargin(line);\n    }\n\n    /**\n     * Returns the effective leading margin (unsigned) for this line,\n     * taking into account LeadingMarginSpan and LeadingMarginSpan2.\n     * @param line the line index\n     * @return the leading margin of this line\n     */\n    private getParagraphLeadingMargin(line:number):number  {\n        if (!this.mSpannedText) {\n            return 0;\n        }\n        let spanned:Spanned = <Spanned> this.mText;\n        let lineStart:number = this.getLineStart(line);\n        let lineEnd:number = this.getLineEnd(line);\n        let spanEnd:number = spanned.nextSpanTransition(lineStart, lineEnd, LeadingMarginSpan.type);\n        let spans:LeadingMarginSpan[] = Layout.getParagraphSpans<LeadingMarginSpan>(spanned, lineStart, spanEnd, LeadingMarginSpan.type);\n        if (spans.length == 0) {\n            // no leading margin span;\n            return 0;\n        }\n        let margin:number = 0;\n        let isFirstParaLine:boolean = lineStart == 0 || spanned.charAt(lineStart - 1) == '\\n';\n        for (let i:number = 0; i < spans.length; i++) {\n            let span:LeadingMarginSpan = spans[i];\n            let useFirstLineMargin:boolean = isFirstParaLine;\n            if (LeadingMarginSpan2.isImpl(span)) {\n                let spStart:number = spanned.getSpanStart(span);\n                let spanLine:number = this.getLineForOffset(spStart);\n                let count:number = (<LeadingMarginSpan2> span).getLeadingMarginLineCount();\n                useFirstLineMargin = line < spanLine + count;\n            }\n            margin += span.getLeadingMargin(useFirstLineMargin);\n        }\n        return margin;\n    }\n\n    /* package */\n    static measurePara(paint:TextPaint, text:String, start:number, end:number):number  {\n        let mt:MeasuredText = MeasuredText.obtain();\n        let tl:TextLine = TextLine.obtain();\n        try {\n            mt.setPara(text, start, end, TextDirectionHeuristics.LTR);\n            let directions:Layout.Directions;\n            let dir:number;\n            //if (mt.mEasy) {\n                directions = Layout.DIRS_ALL_LEFT_TO_RIGHT;\n                dir = Layout.DIR_LEFT_TO_RIGHT;\n            //} else {\n            //    directions = AndroidBidi.directions(mt.mDir, mt.mLevels, 0, mt.mChars, 0, mt.mLen);\n            //    dir = mt.mDir;\n            //}\n            let chars:string = mt.mChars;\n            let len:number = mt.mLen;\n            let hasTabs:boolean = false;\n            let tabStops:Layout.TabStops = null;\n            for (let i:number = 0; i < len; ++i) {\n                if (chars[i] == '\\t') {\n                    hasTabs = true;\n                    if (Spanned.isImplements(text)) {\n                        let spanned:Spanned = <Spanned> text;\n                        let spanEnd:number = spanned.nextSpanTransition(start, end, TabStopSpan.type);\n                        let spans:TabStopSpan[] = Layout.getParagraphSpans<TabStopSpan>(spanned, start, spanEnd, TabStopSpan.type);\n                        if (spans.length > 0) {\n                            tabStops = new Layout.TabStops(Layout.TAB_INCREMENT, spans);\n                        }\n                    }\n                    break;\n                }\n            }\n            tl.set(paint, text, start, end, dir, directions, hasTabs, tabStops);\n            return tl.metrics(null);\n        } finally {\n            TextLine.recycle(tl);\n            MeasuredText.recycle(mt);\n        }\n    }\n\n\n\n    /**\n     * Returns the position of the next tab stop after h on the line.\n     *\n     * @param text the text\n     * @param start start of the line\n     * @param end limit of the line\n     * @param h the current horizontal offset\n     * @param tabs the tabs, can be null.  If it is null, any tabs in effect\n     * on the line will be used.  If there are no tabs, a default offset\n     * will be used to compute the tab stop.\n     * @return the offset of the next tab stop.\n     */\n    /* package */\n    static nextTab(text:String, start:number, end:number, h:number, tabs:any[]):number  {\n        let nh:number = Float.MAX_VALUE;\n        let alltabs:boolean = false;\n        if (Spanned.isImplements(text)) {\n            if (tabs == null) {\n                tabs = Layout.getParagraphSpans(<Spanned> text, start, end, TabStopSpan.type);\n                alltabs = true;\n            }\n            for (let i:number = 0; i < tabs.length; i++) {\n                if (!alltabs) {\n                    if (!(TabStopSpan.isImpl(tabs[i])))\n                        continue;\n                }\n                let where:number = (<TabStopSpan> tabs[i]).getTabStop();\n                if (where < nh && where > h)\n                    nh = where;\n            }\n            if (nh != Float.MAX_VALUE)\n                return nh;\n        }\n        return (Math.floor(((h + Layout.TAB_INCREMENT) / Layout.TAB_INCREMENT))) * Layout.TAB_INCREMENT;\n    }\n\n    protected isSpanned():boolean  {\n        return this.mSpannedText;\n    }\n\n    /**\n     * Returns the same as <code>text.getSpans()</code>, except where\n     * <code>start</code> and <code>end</code> are the same and are not\n     * at the very beginning of the text, in which case an empty array\n     * is returned instead.\n     * <p>\n     * This is needed because of the special case that <code>getSpans()</code>\n     * on an empty range returns the spans adjacent to that range, which is\n     * primarily for the sake of <code>TextWatchers</code> so they will get\n     * notifications when text goes from empty to non-empty.  But it also\n     * has the unfortunate side effect that if the text ends with an empty\n     * paragraph, that paragraph accidentally picks up the styles of the\n     * preceding paragraph (even though those styles will not be picked up\n     * by new text that is inserted into the empty paragraph).\n     * <p>\n     * The reason it just checks whether <code>start</code> and <code>end</code>\n     * is the same is that the only time a line can contain 0 characters\n     * is if it is the final paragraph of the Layout; otherwise any line will\n     * contain at least one printing or newline character.  The reason for the\n     * additional check if <code>start</code> is greater than 0 is that\n     * if the empty paragraph is the entire content of the buffer, paragraph\n     * styles that are already applied to the buffer will apply to text that\n     * is inserted into it.\n     */\n    /* package */\n    static getParagraphSpans<T> (text:Spanned, start:number, end:number, type:any):T[]  {\n        if (start == end && start > 0) {\n            return [];\n        }\n        return text.getSpans<T>(start, end, type);\n    }\n\n    private getEllipsisChar(method:TextUtils.TruncateAt):string  {\n        return (method == TextUtils.TruncateAt.END_SMALL) ? Layout.ELLIPSIS_TWO_DOTS[0] : Layout.ELLIPSIS_NORMAL[0];\n    }\n\n    private ellipsize(start:number, end:number, line:number, dest:string[], destoff:number, method:TextUtils.TruncateAt):void  {\n        let ellipsisCount:number = this.getEllipsisCount(line);\n        if (ellipsisCount == 0) {\n            return;\n        }\n        let ellipsisStart:number = this.getEllipsisStart(line);\n        let linestart:number = this.getLineStart(line);\n        for (let i:number = ellipsisStart; i < ellipsisStart + ellipsisCount; i++) {\n            let c:string;\n            if (i == ellipsisStart) {\n                // ellipsis\n                c = this.getEllipsisChar(method);\n            } else {\n                // 0-width space\n                c = String.fromCharCode(20);// Java: ' '\n            }\n            let a:number = i + linestart;\n            if (a >= start && a < end) {\n                dest[destoff + a - start] = c;\n            }\n        }\n    }\n\n\n\n    /**\n     * Return the offset of the first character to be ellipsized away,\n     * relative to the start of the line.  (So 0 if the beginning of the\n     * line is ellipsized, not getLineStart().)\n     */\n    abstract getEllipsisStart(line:number):number ;\n\n    /**\n     * Returns the number of characters to be ellipsized away, or 0 if\n     * no ellipsis is to take place.\n     */\n    abstract getEllipsisCount(line:number):number ;\n\n\n\n\n\n    private mText:String;\n\n    private mPaint:TextPaint;\n\n    /* package */\n    mWorkPaint:TextPaint;\n\n    private mWidth:number = 0;\n\n    private mAlignment:Layout.Alignment = Layout.Alignment.ALIGN_NORMAL;\n\n    private mSpacingMult:number = 0;\n\n    private mSpacingAdd:number = 0;\n\n    private static sTempRect:Rect = new Rect();\n\n    private mSpannedText:boolean;\n\n    private mTextDir:TextDirectionHeuristic;\n\n    private mLineBackgroundSpans:SpanSet<LineBackgroundSpan>;\n\n    static DIR_LEFT_TO_RIGHT:number = 1;\n\n    static DIR_RIGHT_TO_LEFT:number = -1;\n\n    /* package */\n    static DIR_REQUEST_LTR:number = 1;\n\n    /* package */\n    static DIR_REQUEST_RTL:number = -1;\n\n    /* package */\n    static DIR_REQUEST_DEFAULT_LTR:number = 2;\n\n    /* package */\n    static DIR_REQUEST_DEFAULT_RTL:number = -2;\n\n    /* package */\n    static RUN_LENGTH_MASK:number = 0x03ffffff;\n\n    /* package */\n    static RUN_LEVEL_SHIFT:number = 26;\n\n    /* package */\n    static RUN_LEVEL_MASK:number = 0x3f;\n\n    /* package */\n    static RUN_RTL_FLAG:number = 1 << Layout.RUN_LEVEL_SHIFT;\n\n    private static TAB_INCREMENT:number = 20;\n\n    //init last\n    /* package */\n    static DIRS_ALL_LEFT_TO_RIGHT:Layout.Directions;\n    /* package */\n    static DIRS_ALL_RIGHT_TO_LEFT:Layout.Directions;\n\n    /* package */\n    // this is \"...\"\n    static ELLIPSIS_NORMAL:string[] = [ '…' ];\n\n    /* package */\n    // this is \"..\"\n    static ELLIPSIS_TWO_DOTS:string[] = [ '‥' ];\n}\n\nexport module Layout{\n/* package */\nexport class TabStops {\n\n    private mStops:number[];\n\n    private mNumStops:number = 0;\n\n    private mIncrement:number = 0;\n\n    constructor( increment:number, spans:any[]) {\n        this.reset(increment, spans);\n    }\n\n    reset(increment:number, spans:any[]):void  {\n        this.mIncrement = increment;\n        let ns:number = 0;\n        if (spans != null) {\n            let stops:number[] = this.mStops;\n            for (let o of spans) {\n                if (TabStopSpan.isImpl(o)) {\n                    if (stops == null) {\n                        stops = androidui.util.ArrayCreator.newNumberArray(10);\n                    } else if (ns == stops.length) {\n                        let nstops:number[] = androidui.util.ArrayCreator.newNumberArray(ns * 2);\n                        for (let i:number = 0; i < ns; ++i) {\n                            nstops[i] = stops[i];\n                        }\n                        stops = nstops;\n                    }\n                    stops[ns++] = (<TabStopSpan> o).getTabStop();\n                }\n            }\n            if (ns > 1) {\n                Arrays.sort(stops, 0, ns);\n            }\n            if (stops != this.mStops) {\n                this.mStops = stops;\n            }\n        }\n        this.mNumStops = ns;\n    }\n\n    nextTab(h:number):number  {\n        let ns:number = this.mNumStops;\n        if (ns > 0) {\n            let stops:number[] = this.mStops;\n            for (let i:number = 0; i < ns; ++i) {\n                let stop:number = stops[i];\n                if (stop > h) {\n                    return stop;\n                }\n            }\n        }\n        return TabStops.nextDefaultStop(h, this.mIncrement);\n    }\n\n    static nextDefaultStop(h:number, inc:number):number  {\n        return (Math.floor(((h + inc) / inc))) * inc;\n    }\n}\n/**\n     * Stores information about bidirectional (left-to-right or right-to-left)\n     * text within the layout of a line.\n     */\nexport class Directions {\n\n    // Directions represents directional runs within a line of text.\n    // Runs are pairs of ints listed in visual order, starting from the\n    // leading margin.  The first int of each pair is the offset from\n    // the first character of the line to the start of the run.  The\n    // second int represents both the length and level of the run.\n    // The length is in the lower bits, accessed by masking with\n    // DIR_LENGTH_MASK.  The level is in the higher bits, accessed\n    // by shifting by DIR_LEVEL_SHIFT and masking by DIR_LEVEL_MASK.\n    // To simply test for an RTL direction, test the bit using\n    // DIR_RTL_FLAG, if set then the direction is rtl.\n    /* package */\n    mDirections:number[];\n\n    /* package */\n    constructor( dirs:number[]) {\n        this.mDirections = dirs;\n    }\n}\n/* package */\nexport class Ellipsizer extends String {\n\n    /* package */\n    mText:String;\n\n    /* package */\n    mLayout:Layout;\n\n    /* package */\n    mWidth:number = 0;\n\n    /* package */\n    mMethod:TextUtils.TruncateAt;\n\n    constructor(s:String) {\n        super(s);\n        this.mText = s;\n    }\n\n    toString():string {\n        //let line1:number = this.mLayout.getLineForOffset(start);\n        //let line2:number = this.mLayout.getLineForOffset(end);\n        let line1:number = this.mLayout.getLineForOffset(0);\n        let line2:number = this.mLayout.getLineForOffset(this.mText.length);\n        let dest = this.mText.split('');\n        for (let i:number = line1; i <= line2; i++) {\n            this.mLayout.ellipsize(0, this.mText.length, i, dest, 0, this.mMethod);\n        }\n        return dest.join('');\n    }\n}\n/* package */\nexport class SpannedEllipsizer extends Layout.Ellipsizer implements Spanned {\n\n    //FIXME no impl span when ellipsizer\n\n    private mSpanned:Spanned;\n\n    constructor(display:String) {\n        super(display);\n        this.mSpanned = <Spanned> display;\n    }\n\n    getSpans<T> (start:number, end:number, type:any):T[]  {\n        return this.mSpanned.getSpans<T>(start, end, type);\n    }\n\n    getSpanStart(tag:any):number  {\n        return this.mSpanned.getSpanStart(tag);\n    }\n\n    getSpanEnd(tag:any):number  {\n        return this.mSpanned.getSpanEnd(tag);\n    }\n\n    getSpanFlags(tag:any):number  {\n        return this.mSpanned.getSpanFlags(tag);\n    }\n\n    nextSpanTransition(start:number, limit:number, type:any):number  {\n        return this.mSpanned.nextSpanTransition(start, limit, type);\n    }\n\n}\n    export enum Alignment {\n\n        ALIGN_NORMAL /*() {\n         }\n         */, ALIGN_OPPOSITE /*() {\n         }\n         */, ALIGN_CENTER /*() {\n         }\n         */, /** @hide */\n        ALIGN_LEFT /*() {\n         }\n         */, /** @hide */\n        ALIGN_RIGHT /*() {\n     }\n     */ /*;\n     */}\n}\n\n\n    //init after module loaded\n    /* package */\n    Layout.DIRS_ALL_LEFT_TO_RIGHT = new Layout.Directions( [ 0, Layout.RUN_LENGTH_MASK ]);\n    /* package */\n    Layout.DIRS_ALL_RIGHT_TO_LEFT = new Layout.Directions( [ 0, Layout.RUN_LENGTH_MASK | Layout.RUN_RTL_FLAG ]);\n\n}"
  },
  {
    "path": "src/android/text/MeasuredText.ts",
    "content": "/*\n * Copyright (C) 2010 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../android/text/style/MetricAffectingSpan.ts\"/>\n///<reference path=\"../../android/text/style/ReplacementSpan.ts\"/>\n///<reference path=\"../../android/util/Log.ts\"/>\n///<reference path=\"../../android/text/Layout.ts\"/>\n///<reference path=\"../../android/text/Spanned.ts\"/>\n///<reference path=\"../../android/text/TextDirectionHeuristic.ts\"/>\n///<reference path=\"../../android/text/TextPaint.ts\"/>\n///<reference path=\"../../android/text/TextUtils.ts\"/>\n\nmodule android.text {\nimport Canvas = android.graphics.Canvas;\nimport Paint = android.graphics.Paint;\nimport MetricAffectingSpan = android.text.style.MetricAffectingSpan;\nimport ReplacementSpan = android.text.style.ReplacementSpan;\nimport Log = android.util.Log;\nimport Spanned = android.text.Spanned;\nimport TextDirectionHeuristic = android.text.TextDirectionHeuristic;\nimport TextPaint = android.text.TextPaint;\nimport TextUtils = android.text.TextUtils;\n/**\n * @hide\n */\nexport class MeasuredText {\n\n    private static localLOGV:boolean = false;\n\n    mText:String;\n\n    mTextStart:number = 0;\n\n    mWidths:number[];\n\n    mChars:string;\n\n    mLevels:number[];\n\n    mDir:number = 0;\n\n    mEasy:boolean;\n\n    mLen:number = 0;\n\n    private mPos:number = 0;\n\n    private mWorkPaint:TextPaint;\n\n    constructor( ) {\n        this.mWorkPaint = new TextPaint();\n    }\n\n    private static sLock:any[] = new Array<any>(0);\n\n    private static sCached:MeasuredText[] = new Array<MeasuredText>(3);\n\n    static obtain():MeasuredText  {\n        let mt:MeasuredText;\n        {\n            for (let i:number = MeasuredText.sCached.length; --i >= 0; ) {\n                if (MeasuredText.sCached[i] != null) {\n                    mt = MeasuredText.sCached[i];\n                    MeasuredText.sCached[i] = null;\n                    return mt;\n                }\n            }\n        }\n        mt = new MeasuredText();\n        if (MeasuredText.localLOGV) {\n            Log.v(\"MEAS\", \"new: \" + mt);\n        }\n        return mt;\n    }\n\n    static recycle(mt:MeasuredText):MeasuredText  {\n        mt.mText = null;\n        if (mt.mLen < 1000) {\n            {\n                for (let i:number = 0; i < MeasuredText.sCached.length; ++i) {\n                    if (MeasuredText.sCached[i] == null) {\n                        MeasuredText.sCached[i] = mt;\n                        mt.mText = null;\n                        break;\n                    }\n                }\n            }\n        }\n        return null;\n    }\n\n    setPos(pos:number):void  {\n        this.mPos = pos - this.mTextStart;\n    }\n\n    /**\n     * Analyzes text for bidirectional runs.  Allocates working buffers.\n     */\n    setPara(text:String, start:number, end:number, textDir:TextDirectionHeuristic):void  {\n        this.mText = text;\n        this.mTextStart = start;\n        let len:number = end - start;\n        this.mLen = len;\n        this.mPos = 0;\n        if (this.mWidths == null || this.mWidths.length < len) {\n            this.mWidths = androidui.util.ArrayCreator.newNumberArray(len);\n        }\n        //if (this.mChars == null || this.mChars.length < len) {\n        //    this.mChars = new Array<string>(ArrayUtils.idealCharArraySize(len));\n        //}\n        //TextUtils.getChars(text, start, end, this.mChars, 0);\n        this.mChars = text.toString().substring(start, end);\n        if (Spanned.isImplements(text)) {\n            let spanned:Spanned = <Spanned> text;\n            let spans:ReplacementSpan[] = spanned.getSpans<ReplacementSpan>(start, end, ReplacementSpan.type);\n            for (let i:number = 0; i < spans.length; i++) {\n                let startInPara:number = spanned.getSpanStart(spans[i]) - start;\n                let endInPara:number = spanned.getSpanEnd(spans[i]) - start;\n                // The span interval may be larger and must be restricted to [start, end[\n                if (startInPara < 0)\n                    startInPara = 0;\n                if (endInPara > len)\n                    endInPara = len;\n                for (let j:number = startInPara; j < endInPara; j++) {\n                    // object replacement character\n                    // this.mChars[j] = '￼';\n                    this.mChars = this.mChars.substring(0, j) + ' ' + this.mChars.substring(j+1);\n                }\n            }\n        }\n        //if ((textDir == TextDirectionHeuristics.LTR || textDir == TextDirectionHeuristics.FIRSTSTRONG_LTR || textDir == TextDirectionHeuristics.ANYRTL_LTR) && TextUtils.doesNotNeedBidi(this.mChars, 0, len)) {\n            this.mDir = android.text.Layout.DIR_LEFT_TO_RIGHT;\n            this.mEasy = true;\n        //} else {\n        //    if (this.mLevels == null || this.mLevels.length < len) {\n        //        this.mLevels = new Array<byte>(ArrayUtils.idealByteArraySize(len));\n        //    }\n        //    let bidiRequest:number;\n        //    if (textDir == TextDirectionHeuristics.LTR) {\n        //        bidiRequest = android.text.Layout.DIR_REQUEST_LTR;\n        //    } else if (textDir == TextDirectionHeuristics.RTL) {\n        //        bidiRequest = android.text.Layout.DIR_REQUEST_RTL;\n        //    } else if (textDir == TextDirectionHeuristics.FIRSTSTRONG_LTR) {\n        //        bidiRequest = android.text.Layout.DIR_REQUEST_DEFAULT_LTR;\n        //    } else if (textDir == TextDirectionHeuristics.FIRSTSTRONG_RTL) {\n        //        bidiRequest = android.text.Layout.DIR_REQUEST_DEFAULT_RTL;\n        //    } else {\n        //        let isRtl:boolean = textDir.isRtl(this.mChars, 0, len);\n        //        bidiRequest = isRtl ? android.text.Layout.DIR_REQUEST_RTL : android.text.Layout.DIR_REQUEST_LTR;\n        //    }\n        //    this.mDir = AndroidBidi.bidi(bidiRequest, this.mChars, this.mLevels, len, false);\n        //    this.mEasy = false;\n        //}\n    }\n\n    addStyleRun(paint:TextPaint, len:number, fm:Paint.FontMetricsInt):number;\n    addStyleRun(paint:TextPaint, spans:MetricAffectingSpan[], len:number, fm:Paint.FontMetricsInt):number;\n    addStyleRun(...args):number{\n        if(args.length===3) return (<any>this).addStyleRun_3(...args);\n        if(args.length===4) return (<any>this).addStyleRun_4(...args);\n    }\n\n    private addStyleRun_3(paint:TextPaint, len:number, fm:Paint.FontMetricsInt):number  {\n        if (fm != null) {\n            paint.getFontMetricsInt(fm);\n        }\n        let p:number = this.mPos;\n        this.mPos = p + len;\n        if (this.mEasy) {\n            let flags:number = this.mDir == android.text.Layout.DIR_LEFT_TO_RIGHT ? Canvas.DIRECTION_LTR : Canvas.DIRECTION_RTL;\n            return paint.getTextRunAdvances_count(this.mChars, p, len, p, len, flags, this.mWidths, p);\n        }\n        let totalAdvance:number = 0;\n        let level:number = this.mLevels[p];\n        for (let q:number = p, i:number = p + 1, e:number = p + len; ; ++i) {\n            if (i == e || this.mLevels[i] != level) {\n                let flags:number = (level & 0x1) == 0 ? Canvas.DIRECTION_LTR : Canvas.DIRECTION_RTL;\n                totalAdvance += paint.getTextRunAdvances_count(this.mChars, q, i - q, q, i - q, flags, this.mWidths, q);\n                if (i == e) {\n                    break;\n                }\n                q = i;\n                level = this.mLevels[i];\n            }\n        }\n        return totalAdvance;\n    }\n\n    private addStyleRun_4(paint:TextPaint, spans:MetricAffectingSpan[], len:number, fm:Paint.FontMetricsInt):number  {\n        let workPaint:TextPaint = this.mWorkPaint;\n        workPaint.set(paint);\n        // XXX paint should not have a baseline shift, but...\n        workPaint.baselineShift = 0;\n        let replacement:ReplacementSpan = null;\n        for (let i:number = 0; i < spans.length; i++) {\n            let span:MetricAffectingSpan = spans[i];\n            if (span instanceof ReplacementSpan) {\n                replacement = <ReplacementSpan> span;\n            } else {\n                span.updateMeasureState(workPaint);\n            }\n        }\n        let wid:number;\n        if (replacement == null) {\n            wid = this.addStyleRun(workPaint, len, fm);\n        } else {\n            // Use original text.  Shouldn't matter.\n            wid = replacement.getSize(workPaint, this.mText, this.mTextStart + this.mPos, this.mTextStart + this.mPos + len, fm);\n            let w:number[] = this.mWidths;\n            w[this.mPos] = wid;\n            for (let i:number = this.mPos + 1, e:number = this.mPos + len; i < e; i++) w[i] = 0;\n            this.mPos += len;\n        }\n        if (fm != null) {\n            if (workPaint.baselineShift < 0) {\n                fm.ascent += workPaint.baselineShift;\n                fm.top += workPaint.baselineShift;\n            } else {\n                fm.descent += workPaint.baselineShift;\n                fm.bottom += workPaint.baselineShift;\n            }\n        }\n        return wid;\n    }\n\n    breakText(limit:number, forwards:boolean, width:number):number  {\n        let w:number[] = this.mWidths;\n        if (forwards) {\n            let i:number = 0;\n            while (i < limit) {\n                width -= w[i];\n                if (width < 0.0)\n                    break;\n                i++;\n            }\n            while (i > 0 && this.mChars[i - 1] == ' ') i--;\n            return i;\n        } else {\n            let i:number = limit - 1;\n            while (i >= 0) {\n                width -= w[i];\n                if (width < 0.0)\n                    break;\n                i--;\n            }\n            while (i < limit - 1 && this.mChars[i + 1] == ' ') i++;\n            return limit - i - 1;\n        }\n    }\n\n    measure(start:number, limit:number):number  {\n        let width:number = 0;\n        let w:number[] = this.mWidths;\n        for (let i:number = start; i < limit; ++i) {\n            width += w[i];\n        }\n        return width;\n    }\n}\n}"
  },
  {
    "path": "src/android/text/PackedIntVector.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../java/lang/System.ts\"/>\n\nmodule android.text {\nimport System = java.lang.System;\n/**\n * PackedIntVector stores a two-dimensional array of integers,\n * optimized for inserting and deleting rows and for\n * offsetting the values in segments of a given column.\n */\nexport class PackedIntVector {\n\n    private mColumns:number = 0;\n\n    private mRows:number = 0;\n\n    private mRowGapStart:number = 0;\n\n    private mRowGapLength:number = 0;\n\n    private mValues:number[];\n\n    // starts, followed by lengths\n    private mValueGap:number[];\n\n    /**\n     * Creates a new PackedIntVector with the specified width and\n     * a height of 0.\n     *\n     * @param columns the width of the PackedIntVector.\n     */\n    constructor( columns:number) {\n        this.mColumns = columns;\n        this.mRows = 0;\n        this.mRowGapStart = 0;\n        this.mRowGapLength = this.mRows;\n        this.mValues = null;\n        this.mValueGap = androidui.util.ArrayCreator.newNumberArray(2 * columns);\n    }\n\n    /**\n     * Returns the value at the specified row and column.\n     *\n     * @param row the index of the row to return.\n     * @param column the index of the column to return.\n     *\n     * @return the value stored at the specified position.\n     *\n     * @throws IndexOutOfBoundsException if the row is out of range\n     *         (row &lt; 0 || row >= size()) or the column is out of range\n     *         (column &lt; 0 || column >= width()).\n     */\n    getValue(row:number, column:number):number  {\n        const columns:number = this.mColumns;\n        if (((row | column) < 0) || (row >= this.size()) || (column >= columns)) {\n            throw Error(`new IndexOutOfBoundsException(row + \", \" + column)`);\n        }\n        if (row >= this.mRowGapStart) {\n            row += this.mRowGapLength;\n        }\n        let value:number = this.mValues[row * columns + column];\n        let valuegap:number[] = this.mValueGap;\n        if (row >= valuegap[column]) {\n            value += valuegap[column + columns];\n        }\n        return value;\n    }\n\n    /**\n     * Sets the value at the specified row and column.\n     *\n     * @param row the index of the row to set.\n     * @param column the index of the column to set.\n     *\n     * @throws IndexOutOfBoundsException if the row is out of range\n     *         (row &lt; 0 || row >= size()) or the column is out of range\n     *         (column &lt; 0 || column >= width()).\n     */\n    setValue(row:number, column:number, value:number):void  {\n        if (((row | column) < 0) || (row >= this.size()) || (column >= this.mColumns)) {\n            throw Error(`new IndexOutOfBoundsException(row + \", \" + column)`);\n        }\n        if (row >= this.mRowGapStart) {\n            row += this.mRowGapLength;\n        }\n        let valuegap:number[] = this.mValueGap;\n        if (row >= valuegap[column]) {\n            value -= valuegap[column + this.mColumns];\n        }\n        this.mValues[row * this.mColumns + column] = value;\n    }\n\n    /**\n     * Sets the value at the specified row and column.\n     * Private internal version: does not check args.\n     *\n     * @param row the index of the row to set.\n     * @param column the index of the column to set.\n     *\n     */\n    private setValueInternal(row:number, column:number, value:number):void  {\n        if (row >= this.mRowGapStart) {\n            row += this.mRowGapLength;\n        }\n        let valuegap:number[] = this.mValueGap;\n        if (row >= valuegap[column]) {\n            value -= valuegap[column + this.mColumns];\n        }\n        this.mValues[row * this.mColumns + column] = value;\n    }\n\n    /**\n     * Increments all values in the specified column whose row >= the\n     * specified row by the specified delta.\n     *\n     * @param startRow the row at which to begin incrementing.\n     *        This may be == size(), which case there is no effect.\n     * @param column the index of the column to set.\n     *\n     * @throws IndexOutOfBoundsException if the row is out of range\n     *         (startRow &lt; 0 || startRow > size()) or the column\n     *         is out of range (column &lt; 0 || column >= width()).\n     */\n    adjustValuesBelow(startRow:number, column:number, delta:number):void  {\n        if (((startRow | column) < 0) || (startRow > this.size()) || (column >= this.width())) {\n            throw Error(`new IndexOutOfBoundsException(startRow + \", \" + column)`);\n        }\n        if (startRow >= this.mRowGapStart) {\n            startRow += this.mRowGapLength;\n        }\n        this.moveValueGapTo(column, startRow);\n        this.mValueGap[column + this.mColumns] += delta;\n    }\n\n    /**\n     * Inserts a new row of values at the specified row offset.\n     *\n     * @param row the row above which to insert the new row.\n     *        This may be == size(), which case the new row is added\n     *        at the end.\n     * @param values the new values to be added.  If this is null,\n     *        a row of zeroes is added.\n     *\n     * @throws IndexOutOfBoundsException if the row is out of range\n     *         (row &lt; 0 || row > size()) or if the length of the\n     *         values array is too small (values.length < width()).\n     */\n    insertAt(row:number, values:number[]):void  {\n        if ((row < 0) || (row > this.size())) {\n            throw Error(`new IndexOutOfBoundsException(\"row \" + row)`);\n        }\n        if ((values != null) && (values.length < this.width())) {\n            throw Error(`new IndexOutOfBoundsException(\"value count \" + values.length)`);\n        }\n        this.moveRowGapTo(row);\n        if (this.mRowGapLength == 0) {\n            this.growBuffer();\n        }\n        this.mRowGapStart++;\n        this.mRowGapLength--;\n        if (values == null) {\n            for (let i:number = this.mColumns - 1; i >= 0; i--) {\n                this.setValueInternal(row, i, 0);\n            }\n        } else {\n            for (let i:number = this.mColumns - 1; i >= 0; i--) {\n                this.setValueInternal(row, i, values[i]);\n            }\n        }\n    }\n\n    /**\n     * Deletes the specified number of rows starting with the specified\n     * row.\n     *\n     * @param row the index of the first row to be deleted.\n     * @param count the number of rows to delete.\n     *\n     * @throws IndexOutOfBoundsException if any of the rows to be deleted\n     *         are out of range (row &lt; 0 || count &lt; 0 ||\n     *         row + count > size()).\n     */\n    deleteAt(row:number, count:number):void  {\n        if (((row | count) < 0) || (row + count > this.size())) {\n            throw Error(`new IndexOutOfBoundsException(row + \", \" + count)`);\n        }\n        this.moveRowGapTo(row + count);\n        this.mRowGapStart -= count;\n        this.mRowGapLength += count;\n    // TODO: Reclaim memory when the new height is much smaller\n    // than the allocated size.\n    }\n\n    /**\n     * Returns the number of rows in the PackedIntVector.  This number\n     * will change as rows are inserted and deleted.\n     *\n     * @return the number of rows.\n     */\n    size():number  {\n        return this.mRows - this.mRowGapLength;\n    }\n\n    /**\n     * Returns the width of the PackedIntVector.  This number is set\n     * at construction and will not change.\n     *\n     * @return the number of columns.\n     */\n    width():number  {\n        return this.mColumns;\n    }\n\n    /**\n     * Grows the value and gap arrays to be large enough to store at least\n     * one more than the current number of rows.\n     */\n    private growBuffer():void  {\n        const columns:number = this.mColumns;\n        let newsize:number = this.size() + 1;\n        newsize = (newsize * columns) / columns;\n        let newvalues:number[] = androidui.util.ArrayCreator.newNumberArray(newsize * columns);\n        const valuegap:number[] = this.mValueGap;\n        const rowgapstart:number = this.mRowGapStart;\n        let after:number = this.mRows - (rowgapstart + this.mRowGapLength);\n        if (this.mValues != null) {\n            System.arraycopy(this.mValues, 0, newvalues, 0, columns * rowgapstart);\n            System.arraycopy(this.mValues, (this.mRows - after) * columns, newvalues, (newsize - after) * columns, after * columns);\n        }\n        for (let i:number = 0; i < columns; i++) {\n            if (valuegap[i] >= rowgapstart) {\n                valuegap[i] += newsize - this.mRows;\n                if (valuegap[i] < rowgapstart) {\n                    valuegap[i] = rowgapstart;\n                }\n            }\n        }\n        this.mRowGapLength += newsize - this.mRows;\n        this.mRows = newsize;\n        this.mValues = newvalues;\n    }\n\n    /**\n     * Moves the gap in the values of the specified column to begin at\n     * the specified row.\n     */\n    private moveValueGapTo(column:number, where:number):void  {\n        const valuegap:number[] = this.mValueGap;\n        const values:number[] = this.mValues;\n        const columns:number = this.mColumns;\n        if (where == valuegap[column]) {\n            return;\n        } else if (where > valuegap[column]) {\n            for (let i:number = valuegap[column]; i < where; i++) {\n                values[i * columns + column] += valuegap[column + columns];\n            }\n        } else /* where < valuegap[column] */\n        {\n            for (let i:number = where; i < valuegap[column]; i++) {\n                values[i * columns + column] -= valuegap[column + columns];\n            }\n        }\n        valuegap[column] = where;\n    }\n\n    /**\n     * Moves the gap in the row indices to begin at the specified row.\n     */\n    private moveRowGapTo(where:number):void  {\n        if (where == this.mRowGapStart) {\n            return;\n        } else if (where > this.mRowGapStart) {\n            let moving:number = where + this.mRowGapLength - (this.mRowGapStart + this.mRowGapLength);\n            const columns:number = this.mColumns;\n            const valuegap:number[] = this.mValueGap;\n            const values:number[] = this.mValues;\n            const gapend:number = this.mRowGapStart + this.mRowGapLength;\n            for (let i:number = gapend; i < gapend + moving; i++) {\n                let destrow:number = i - gapend + this.mRowGapStart;\n                for (let j:number = 0; j < columns; j++) {\n                    let val:number = values[i * columns + j];\n                    if (i >= valuegap[j]) {\n                        val += valuegap[j + columns];\n                    }\n                    if (destrow >= valuegap[j]) {\n                        val -= valuegap[j + columns];\n                    }\n                    values[destrow * columns + j] = val;\n                }\n            }\n        } else /* where < mRowGapStart */\n        {\n            let moving:number = this.mRowGapStart - where;\n            const columns:number = this.mColumns;\n            const valuegap:number[] = this.mValueGap;\n            const values:number[] = this.mValues;\n            const gapend:number = this.mRowGapStart + this.mRowGapLength;\n            for (let i:number = where + moving - 1; i >= where; i--) {\n                let destrow:number = i - where + gapend - moving;\n                for (let j:number = 0; j < columns; j++) {\n                    let val:number = values[i * columns + j];\n                    if (i >= valuegap[j]) {\n                        val += valuegap[j + columns];\n                    }\n                    if (destrow >= valuegap[j]) {\n                        val -= valuegap[j + columns];\n                    }\n                    values[destrow * columns + j] = val;\n                }\n            }\n        }\n        this.mRowGapStart = where;\n    }\n}\n}"
  },
  {
    "path": "src/android/text/PackedObjectVector.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../java/lang/System.ts\"/>\n\nmodule android.text {\nimport System = java.lang.System;\nexport class PackedObjectVector<E> {\n\n    private mColumns:number = 0;\n\n    private mRows:number = 0;\n\n    private mRowGapStart:number = 0;\n\n    private mRowGapLength:number = 0;\n\n    private mValues:any[];\n\n    constructor( columns:number) {\n        this.mColumns = columns;\n        this.mRows = 1;//ArrayUtils.idealIntArraySize(0) / this.mColumns;\n        this.mRowGapStart = 0;\n        this.mRowGapLength = this.mRows;\n        this.mValues = new Array<any>(this.mRows * this.mColumns);\n    }\n\n    getValue(row:number, column:number):E  {\n        if (row >= this.mRowGapStart)\n            row += this.mRowGapLength;\n        let value:any = this.mValues[row * this.mColumns + column];\n        return <E> value;\n    }\n\n    setValue(row:number, column:number, value:E):void  {\n        if (row >= this.mRowGapStart)\n            row += this.mRowGapLength;\n        this.mValues[row * this.mColumns + column] = value;\n    }\n\n    insertAt(row:number, values:E[]):void  {\n        this.moveRowGapTo(row);\n        if (this.mRowGapLength == 0)\n            this.growBuffer();\n        this.mRowGapStart++;\n        this.mRowGapLength--;\n        if (values == null)\n            for (let i:number = 0; i < this.mColumns; i++) this.setValue(row, i, null);\n        else\n            for (let i:number = 0; i < this.mColumns; i++) this.setValue(row, i, values[i]);\n    }\n\n    deleteAt(row:number, count:number):void  {\n        this.moveRowGapTo(row + count);\n        this.mRowGapStart -= count;\n        this.mRowGapLength += count;\n        if (this.mRowGapLength > this.size() * 2) {\n        // dump();\n        // growBuffer();\n        }\n    }\n\n    size():number  {\n        return this.mRows - this.mRowGapLength;\n    }\n\n    width():number  {\n        return this.mColumns;\n    }\n\n    private growBuffer():void  {\n        let newsize:number = this.size() + 1;\n        newsize = (newsize * this.mColumns) / this.mColumns;\n        let newvalues:any[] = new Array<any>(newsize * this.mColumns);\n        let after:number = this.mRows - (this.mRowGapStart + this.mRowGapLength);\n        System.arraycopy(this.mValues, 0, newvalues, 0, this.mColumns * this.mRowGapStart);\n        System.arraycopy(this.mValues, (this.mRows - after) * this.mColumns, newvalues, (newsize - after) * this.mColumns, after * this.mColumns);\n        this.mRowGapLength += newsize - this.mRows;\n        this.mRows = newsize;\n        this.mValues = newvalues;\n    }\n\n    private moveRowGapTo(where:number):void  {\n        if (where == this.mRowGapStart)\n            return;\n        if (where > this.mRowGapStart) {\n            let moving:number = where + this.mRowGapLength - (this.mRowGapStart + this.mRowGapLength);\n            for (let i:number = this.mRowGapStart + this.mRowGapLength; i < this.mRowGapStart + this.mRowGapLength + moving; i++) {\n                let destrow:number = i - (this.mRowGapStart + this.mRowGapLength) + this.mRowGapStart;\n                for (let j:number = 0; j < this.mColumns; j++) {\n                    let val:any = this.mValues[i * this.mColumns + j];\n                    this.mValues[destrow * this.mColumns + j] = val;\n                }\n            }\n        } else /* where < mRowGapStart */\n        {\n            let moving:number = this.mRowGapStart - where;\n            for (let i:number = where + moving - 1; i >= where; i--) {\n                let destrow:number = i - where + this.mRowGapStart + this.mRowGapLength - moving;\n                for (let j:number = 0; j < this.mColumns; j++) {\n                    let val:any = this.mValues[i * this.mColumns + j];\n                    this.mValues[destrow * this.mColumns + j] = val;\n                }\n            }\n        }\n        this.mRowGapStart = where;\n    }\n\n    dump():// XXX\n    void  {\n        for (let i:number = 0; i < this.mRows; i++) {\n            for (let j:number = 0; j < this.mColumns; j++) {\n                let val:any = this.mValues[i * this.mColumns + j];\n                if (i < this.mRowGapStart || i >= this.mRowGapStart + this.mRowGapLength)\n                    System.out.print(val + \" \");\n                else\n                    System.out.print(\"(\" + val + \") \");\n            }\n            System.out.print(\" << \\n\");\n        }\n        System.out.print(\"-----\\n\\n\");\n    }\n}\n}"
  },
  {
    "path": "src/android/text/SpanSet.ts",
    "content": "/*\n * Copyright (C) 2012 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/text/Spanned.ts\"/>\n\nmodule android.text {\nimport Spanned = android.text.Spanned;\n/**\n * A cached set of spans. Caches the result of {@link Spanned#getSpans(int, int, Class)} and then\n * provides faster access to {@link Spanned#nextSpanTransition(int, int, Class)}.\n *\n * Fields are left public for a convenient direct access.\n *\n * Note that empty spans are ignored by this class.\n * @hide\n */\nexport class SpanSet<E> {\n\n    private classType:any;\n\n    numberOfSpans:number = 0;\n\n    spans:E[];\n\n    spanStarts:number[];\n\n    spanEnds:number[];\n\n    spanFlags:number[];\n\n    constructor(type:any) {\n        this.classType = type;\n        this.numberOfSpans = 0;\n    }\n\n    init(spanned:Spanned, start:number, limit:number):void  {\n        const allSpans:E[] = spanned.getSpans<E>(start, limit, this.classType);\n        const length:number = allSpans.length;\n        if (length > 0 && (this.spans == null || this.spans.length < length)) {\n            // These arrays may end up being too large because of the discarded empty spans\n            this.spans = new Array<E>(length);//<E[]> Array.newInstance(this.classType, length);\n            this.spanStarts = androidui.util.ArrayCreator.newNumberArray(length);\n            this.spanEnds = androidui.util.ArrayCreator.newNumberArray(length);\n            this.spanFlags = androidui.util.ArrayCreator.newNumberArray(length);\n        }\n        this.numberOfSpans = 0;\n        for (let i:number = 0; i < length; i++) {\n            const span:E = allSpans[i];\n            const spanStart:number = spanned.getSpanStart(span);\n            const spanEnd:number = spanned.getSpanEnd(span);\n            if (spanStart == spanEnd)\n                continue;\n            const spanFlag:number = spanned.getSpanFlags(span);\n            this.spans[this.numberOfSpans] = span;\n            this.spanStarts[this.numberOfSpans] = spanStart;\n            this.spanEnds[this.numberOfSpans] = spanEnd;\n            this.spanFlags[this.numberOfSpans] = spanFlag;\n            this.numberOfSpans++;\n        }\n    }\n\n    /**\n     * Returns true if there are spans intersecting the given interval.\n     * @param end must be strictly greater than start\n     */\n    hasSpansIntersecting(start:number, end:number):boolean  {\n        for (let i:number = 0; i < this.numberOfSpans; i++) {\n            // equal test is valid since both intervals are not empty by construction\n            if (this.spanStarts[i] >= end || this.spanEnds[i] <= start)\n                continue;\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * Similar to {@link Spanned#nextSpanTransition(int, int, Class)}\n     */\n    getNextTransition(start:number, limit:number):number  {\n        for (let i:number = 0; i < this.numberOfSpans; i++) {\n            const spanStart:number = this.spanStarts[i];\n            const spanEnd:number = this.spanEnds[i];\n            if (spanStart > start && spanStart < limit)\n                limit = spanStart;\n            if (spanEnd > start && spanEnd < limit)\n                limit = spanEnd;\n        }\n        return limit;\n    }\n\n    /**\n     * Removes all internal references to the spans to avoid memory leaks.\n     */\n    recycle():void  {\n        // The spans array is guaranteed to be not null when numberOfSpans is > 0\n        for (let i:number = 0; i < this.numberOfSpans; i++) {\n            // prevent a leak: no reference kept when TextLine is recycled\n            this.spans[i] = null;\n        }\n    }\n}\n}"
  },
  {
    "path": "src/android/text/SpanWatcher.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/text/Spannable.ts\"/>\n\nmodule android.text {\nimport Spannable = android.text.Spannable;\n/**\n * When an object of this type is attached to a Spannable, its methods\n * will be called to notify it that other markup objects have been\n * added, changed, or removed.\n */\nexport interface SpanWatcher {\n\n    /**\n     * This method is called to notify you that the specified object\n     * has been attached to the specified range of the text.\n     */\n    onSpanAdded(text:Spannable, what:any, start:number, end:number):void ;\n\n    /**\n     * This method is called to notify you that the specified object\n     * has been detached from the specified range of the text.\n     */\n    onSpanRemoved(text:Spannable, what:any, start:number, end:number):void ;\n\n    /**\n     * This method is called to notify you that the specified object\n     * has been relocated from the range <code>ostart&hellip;oend</code>\n     * to the new range <code>nstart&hellip;nend</code> of the text.\n     */\n    onSpanChanged(text:Spannable, what:any, ostart:number, oend:number, nstart:number, nend:number):void ;\n}\n}"
  },
  {
    "path": "src/android/text/Spannable.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/text/Spanned.ts\"/>\n///<reference path=\"../../android/text/TextWatcher.ts\"/>\n\nmodule android.text {\nimport Spanned = android.text.Spanned;\nimport TextWatcher = android.text.TextWatcher;\n/**\n * This is the interface for text to which markup objects can be\n * attached and detached.  Not all Spannable classes have mutable text;\n * see {@link Editable} for that.\n */\nexport interface Spannable extends Spanned {\n\n    /**\n     * Attach the specified markup object to the range <code>start&hellip;end</code>\n     * of the text, or move the object to that range if it was already\n     * attached elsewhere.  See {@link Spanned} for an explanation of\n     * what the flags mean.  The object can be one that has meaning only\n     * within your application, or it can be one that the text system will\n     * use to affect text display or behavior.  Some noteworthy ones are\n     * the subclasses of {@link android.text.style.CharacterStyle} and\n     * {@link android.text.style.ParagraphStyle}, and\n     * {@link android.text.TextWatcher} and\n     * {@link android.text.SpanWatcher}.\n     */\n    setSpan(what:any, start:number, end:number, flags:number):void ;\n\n    /**\n     * Remove the specified object from the range of text to which it\n     * was attached, if any.  It is OK to remove an object that was never\n     * attached in the first place.\n     */\n    removeSpan(what:any):void ;\n\n\n}\n\nexport module Spannable{\n    export function isImpl(obj):boolean {\n        return obj && obj['setSpan'] && obj['removeSpan'];\n    }\n/**\n     * Factory used by TextView to create new Spannables.  You can subclass\n     * it to provide something other than SpannableString.\n     */\nexport class Factory {\n\n    private static sInstance:Spannable.Factory = new Factory();\n\n    /**\n         * Returns the standard Spannable Factory.\n         */\n    static getInstance():Spannable.Factory  {\n        return Factory.sInstance;\n    }\n\n    /**\n         * Returns a new SpannableString from the specified CharSequence.\n         * You can override this to provide a different kind of Spannable.\n         */\n    newSpannable(source:String):Spannable  {\n        return <any>source;//FIXME when SpannableString impl\n        //return new SpannableString(source);\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/text/Spanned.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule android.text {\n/**\n * This is the interface for text that has markup objects attached to\n * ranges of it.  Not all text classes have mutable markup or text;\n * see {@link Spannable} for mutable markup and {@link Editable} for\n * mutable text.\n */\nexport interface Spanned extends String {\n\n    /**\n     * Return an array of the markup objects attached to the specified\n     * slice of this CharSequence and whose type is the specified type\n     * or a subclass of it.  Specify Object.class for the type if you\n     * want all the objects regardless of type.\n     */\n    getSpans<T> (start:number, end:number, type:any):T[] ;\n\n    /**\n     * Return the beginning of the range of text to which the specified\n     * markup object is attached, or -1 if the object is not attached.\n     */\n    getSpanStart(tag:any):number ;\n\n    /**\n     * Return the end of the range of text to which the specified\n     * markup object is attached, or -1 if the object is not attached.\n     */\n    getSpanEnd(tag:any):number ;\n\n    /**\n     * Return the flags that were specified when {@link Spannable#setSpan} was\n     * used to attach the specified markup object, or 0 if the specified\n     * object has not been attached.\n     */\n    getSpanFlags(tag:any):number ;\n\n    /**\n     * Return the first offset greater than or equal to <code>start</code>\n     * where a markup object of class <code>type</code> begins or ends,\n     * or <code>limit</code> if there are no starts or ends greater than or\n     * equal to <code>start</code> but less than <code>limit</code>.  Specify\n     * <code>null</code> or Object.class for the type if you want every\n     * transition regardless of type.\n     */\n    nextSpanTransition(start:number, limit:number, type:any):number ;\n}\n\nexport module Spanned{\n    export function isImplements(obj){\n        return obj && obj['getSpans'] && obj['getSpanStart'] && obj['getSpanEnd']\n            && obj['getSpanFlags'] && obj['nextSpanTransition'];\n    }\n    /**\n     * Bitmask of bits that are relevent for controlling point/mark behavior\n     * of spans.\n     *\n     * MARK and POINT are conceptually located <i>between</i> two adjacent characters.\n     * A MARK is \"attached\" to the character before, while a POINT will stick to the character\n     * after. The insertion cursor is conceptually located between the MARK and the POINT.\n     *\n     * As a result, inserting a new character between a MARK and a POINT will leave the MARK\n     * unchanged, while the POINT will be shifted, now located after the inserted character and\n     * still glued to the same character after it.\n     *\n     * Depending on whether the insertion happens at the beginning or the end of a span, the span\n     * will hence be expanded to <i>include</i> the new character (when the span is using a MARK at\n     * its beginning or a POINT at its end) or it will be <i>excluded</i>.\n     *\n     * Note that <i>before</i> and <i>after</i> here refer to offsets in the String, which are\n     * independent from the visual representation of the text (left-to-right or right-to-left).\n     */\nexport var SPAN_POINT_MARK_MASK:number = 0x33;/**\n     * 0-length spans with type SPAN_MARK_MARK behave like text marks:\n     * they remain at their original offset when text is inserted\n     * at that offset. Conceptually, the text is added after the mark.\n     */\nexport var SPAN_MARK_MARK:number = 0x11;/**\n     * SPAN_MARK_POINT is a synonym for {@link #SPAN_INCLUSIVE_INCLUSIVE}.\n     */\nexport var SPAN_MARK_POINT:number = 0x12;/**\n     * SPAN_POINT_MARK is a synonym for {@link #SPAN_EXCLUSIVE_EXCLUSIVE}.\n     */\nexport var SPAN_POINT_MARK:number = 0x21;/**\n     * 0-length spans with type SPAN_POINT_POINT behave like cursors:\n     * they are pushed forward by the length of the insertion when text\n     * is inserted at their offset.\n     * The text is conceptually inserted before the point.\n     */\nexport var SPAN_POINT_POINT:number = 0x22;/**\n     * SPAN_PARAGRAPH behaves like SPAN_INCLUSIVE_EXCLUSIVE\n     * (SPAN_MARK_MARK), except that if either end of the span is\n     * at the end of the buffer, that end behaves like _POINT\n     * instead (so SPAN_INCLUSIVE_INCLUSIVE if it starts in the\n     * middle and ends at the end, or SPAN_EXCLUSIVE_INCLUSIVE\n     * if it both starts and ends at the end).\n     * <p>\n     * Its endpoints must be the start or end of the buffer or\n     * immediately after a \\n character, and if the \\n\n     * that anchors it is deleted, the endpoint is pulled to the\n     * next \\n that follows in the buffer (or to the end of\n     * the buffer).\n     */\nexport var SPAN_PARAGRAPH:number = 0x33;/**\n     * Non-0-length spans of type SPAN_INCLUSIVE_EXCLUSIVE expand\n     * to include text inserted at their starting point but not at their\n     * ending point.  When 0-length, they behave like marks.\n     */\nexport var SPAN_INCLUSIVE_EXCLUSIVE:number = Spanned.SPAN_MARK_MARK;/**\n     * Spans of type SPAN_INCLUSIVE_INCLUSIVE expand\n     * to include text inserted at either their starting or ending point.\n     */\nexport var SPAN_INCLUSIVE_INCLUSIVE:number = Spanned.SPAN_MARK_POINT;/**\n     * Spans of type SPAN_EXCLUSIVE_EXCLUSIVE do not expand\n     * to include text inserted at either their starting or ending point.\n     * They can never have a length of 0 and are automatically removed\n     * from the buffer if all the text they cover is removed.\n     */\nexport var SPAN_EXCLUSIVE_EXCLUSIVE:number = Spanned.SPAN_POINT_MARK;/**\n     * Non-0-length spans of type SPAN_EXCLUSIVE_INCLUSIVE expand\n     * to include text inserted at their ending point but not at their\n     * starting point.  When 0-length, they behave like points.\n     */\nexport var SPAN_EXCLUSIVE_INCLUSIVE:number = Spanned.SPAN_POINT_POINT;/**\n     * This flag is set on spans that are being used to apply temporary\n     * styling information on the composing text of an input method, so that\n     * they can be found and removed when the composing text is being\n     * replaced.\n     */\nexport var SPAN_COMPOSING:number = 0x100;/**\n     * This flag will be set for intermediate span changes, meaning there\n     * is guaranteed to be another change following it.  Typically it is\n     * used for {@link Selection} which automatically uses this with the first\n     * offset it sets when updating the selection.\n     */\nexport var SPAN_INTERMEDIATE:number = 0x200;/**\n     * The bits numbered SPAN_USER_SHIFT and above are available\n     * for callers to use to store scalar data associated with their\n     * span object.\n     */\nexport var SPAN_USER_SHIFT:number = 24;/**\n     * The bits specified by the SPAN_USER bitfield are available\n     * for callers to use to store scalar data associated with their\n     * span object.\n     */\nexport var SPAN_USER:number = 0xFFFFFFFF << Spanned.SPAN_USER_SHIFT;/**\n     * The bits numbered just above SPAN_PRIORITY_SHIFT determine the order\n     * of change notifications -- higher numbers go first.  You probably\n     * don't need to set this; it is used so that when text changes, the\n     * text layout gets the chance to update itself before any other\n     * callbacks can inquire about the layout of the text.\n     */\nexport var SPAN_PRIORITY_SHIFT:number = 16;/**\n     * The bits specified by the SPAN_PRIORITY bitmap determine the order\n     * of change notifications -- higher numbers go first.  You probably\n     * don't need to set this; it is used so that when text changes, the\n     * text layout gets the chance to update itself before any other\n     * callbacks can inquire about the layout of the text.\n     */\nexport var SPAN_PRIORITY:number = 0xFF << Spanned.SPAN_PRIORITY_SHIFT;}\n\n}"
  },
  {
    "path": "src/android/text/StaticLayout.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../android/text/style/LeadingMarginSpan.ts\"/>\n///<reference path=\"../../android/text/style/LineHeightSpan.ts\"/>\n///<reference path=\"../../android/text/style/MetricAffectingSpan.ts\"/>\n///<reference path=\"../../android/text/style/TabStopSpan.ts\"/>\n///<reference path=\"../../android/util/Log.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../java/lang/System.ts\"/>\n///<reference path=\"../../android/text/Layout.ts\"/>\n///<reference path=\"../../android/text/MeasuredText.ts\"/>\n///<reference path=\"../../android/text/Spanned.ts\"/>\n///<reference path=\"../../android/text/TextDirectionHeuristic.ts\"/>\n///<reference path=\"../../android/text/TextDirectionHeuristics.ts\"/>\n///<reference path=\"../../android/text/TextPaint.ts\"/>\n///<reference path=\"../../android/text/TextUtils.ts\"/>\n\nmodule android.text {\nimport Paint = android.graphics.Paint;\nimport LeadingMarginSpan = android.text.style.LeadingMarginSpan;\nimport LeadingMarginSpan2 = android.text.style.LeadingMarginSpan.LeadingMarginSpan2;\nimport LineHeightSpan = android.text.style.LineHeightSpan;\nimport MetricAffectingSpan = android.text.style.MetricAffectingSpan;\nimport TabStopSpan = android.text.style.TabStopSpan;\nimport Log = android.util.Log;\nimport Integer = java.lang.Integer;\nimport System = java.lang.System;\nimport Layout = android.text.Layout;\nimport MeasuredText = android.text.MeasuredText;\nimport Spanned = android.text.Spanned;\nimport TextDirectionHeuristic = android.text.TextDirectionHeuristic;\nimport TextDirectionHeuristics = android.text.TextDirectionHeuristics;\nimport TextPaint = android.text.TextPaint;\nimport TextUtils = android.text.TextUtils;\n/**\n * StaticLayout is a Layout for text that will not be edited after it\n * is laid out.  Use {@link DynamicLayout} for text that may change.\n * <p>This is used by widgets to control text layout. You should not need\n * to use this class directly unless you are implementing your own widget\n * or custom display object, or would be tempted to call\n * {@link android.graphics.Canvas#drawText(java.lang.CharSequence, int, int,\n * float, float, android.graphics.Paint)\n * Canvas.drawText()} directly.</p>\n */\nexport class StaticLayout extends Layout {\n\n    static TAG:string = \"StaticLayout\";\n\n    /**\n     * @hide\n     */\n    constructor(source:String, bufstart:number, bufend:number, paint:TextPaint, outerwidth:number, align:Layout.Alignment,\n                 textDir:TextDirectionHeuristic, spacingmult:number, spacingadd:number, includepad:boolean,\n                 ellipsize:TextUtils.TruncateAt=null, ellipsizedWidth=0, maxLines=Integer.MAX_VALUE) {\n        super((ellipsize == null) ? source : (Spanned.isImplements(source)) ? new Layout.SpannedEllipsizer(source) : new Layout.Ellipsizer(source),\n            paint, outerwidth, align, textDir, spacingmult, spacingadd);\n\n\n        /* package */\n        //constructor( text:CharSequence) {\n        //    super(text, null, 0, null, 0, 0);\n        //    this.mColumns = StaticLayout.COLUMNS_ELLIPSIZE;\n        //    this.mLines = androidui.util.ArrayCreator.newNumberArray(ArrayUtils.idealIntArraySize(2 * this.mColumns));\n        //    this.mLineDirections = new Array<Layout.Directions>(ArrayUtils.idealIntArraySize(2 * this.mColumns));\n        //    // FIXME This is never recycled\n        //    this.mMeasured = MeasuredText.obtain();\n        //}\n        if(source==null){\n            this.mColumns = StaticLayout.COLUMNS_ELLIPSIZE;\n            this.mLines = androidui.util.ArrayCreator.newNumberArray((2 * this.mColumns));\n            this.mLineDirections = new Array<Layout.Directions>((2 * this.mColumns));\n            // FIXME This is never recycled\n            this.mMeasured = MeasuredText.obtain();\n            return;\n        }\n        /*\n         * This is annoying, but we can't refer to the layout until\n         * superclass construction is finished, and the superclass\n         * constructor wants the reference to the display text.\n         *\n         * This will break if the superclass constructor ever actually\n         * cares about the content instead of just holding the reference.\n         */\n        if (ellipsize != null) {\n            let e:Layout.Ellipsizer = <Layout.Ellipsizer> this.getText();\n            e.mLayout = this;\n            e.mWidth = ellipsizedWidth;\n            e.mMethod = ellipsize;\n            this.mEllipsizedWidth = ellipsizedWidth;\n            this.mColumns = StaticLayout.COLUMNS_ELLIPSIZE;\n        } else {\n            this.mColumns = StaticLayout.COLUMNS_NORMAL;\n            this.mEllipsizedWidth = outerwidth;\n        }\n        this.mLines = androidui.util.ArrayCreator.newNumberArray(2 * this.mColumns);\n        this.mLineDirections = new Array<Layout.Directions>(2 * this.mColumns);\n        this.mMaximumVisibleLineCount = maxLines;\n        this.mMeasured = MeasuredText.obtain();\n        this.generate(source, bufstart, bufend, paint, outerwidth, textDir, spacingmult, spacingadd, includepad, includepad, ellipsizedWidth, ellipsize);\n        this.mMeasured = MeasuredText.recycle(this.mMeasured);\n        this.mFontMetricsInt = null;\n    }\n\n\n    /* package */\n    generate(source:String, bufStart:number, bufEnd:number, paint:TextPaint, outerWidth:number,\n                textDir:TextDirectionHeuristic, spacingmult:number, spacingadd:number, includepad:boolean,\n                trackpad:boolean, ellipsizedWidth:number, ellipsize:TextUtils.TruncateAt):void  {\n        this.mLineCount = 0;\n        let v:number = 0;\n        let needMultiply:boolean = (spacingmult != 1 || spacingadd != 0);\n        let fm:Paint.FontMetricsInt = this.mFontMetricsInt;\n        let chooseHtv:number[] = null;\n        let measured:MeasuredText = this.mMeasured;\n        let spanned:Spanned = null;\n        if (Spanned.isImplements(source))\n            spanned = <Spanned> source;\n        // XXX\n        let DEFAULT_DIR:number = StaticLayout.DIR_LEFT_TO_RIGHT;\n        let paraEnd:number;\n        for (let paraStart:number = bufStart; paraStart <= bufEnd; paraStart = paraEnd) {\n            paraEnd = source.substring(0, bufEnd).indexOf(StaticLayout.CHAR_NEW_LINE, paraStart);\n            if (paraEnd < 0)\n                paraEnd = bufEnd;\n            else\n                paraEnd++;\n            let firstWidthLineLimit:number = this.mLineCount + 1;\n            let firstWidth:number = outerWidth;\n            let restWidth:number = outerWidth;\n            let chooseHt:LineHeightSpan[] = null;\n            if (spanned != null) {\n                let sp:LeadingMarginSpan[] = StaticLayout.getParagraphSpans<LeadingMarginSpan>(spanned, paraStart, paraEnd, LeadingMarginSpan.type);\n                for (let i:number = 0; i < sp.length; i++) {\n                    let lms:LeadingMarginSpan = sp[i];\n                    firstWidth -= sp[i].getLeadingMargin(true);\n                    restWidth -= sp[i].getLeadingMargin(false);\n                    // paragraph.\n                    if (LeadingMarginSpan2.isImpl(lms)) {\n                        let lms2:LeadingMarginSpan2 = <LeadingMarginSpan2> lms;\n                        let lmsFirstLine:number = this.getLineForOffset(spanned.getSpanStart(lms2));\n                        firstWidthLineLimit = lmsFirstLine + lms2.getLeadingMarginLineCount();\n                    }\n                }\n                chooseHt = StaticLayout.getParagraphSpans<LineHeightSpan>(spanned, paraStart, paraEnd, LineHeightSpan.type);\n                if (chooseHt.length != 0) {\n                    if (chooseHtv == null || chooseHtv.length < chooseHt.length) {\n                        chooseHtv = androidui.util.ArrayCreator.newNumberArray(chooseHt.length);\n                    }\n                    for (let i:number = 0; i < chooseHt.length; i++) {\n                        let o:number = spanned.getSpanStart(chooseHt[i]);\n                        if (o < paraStart) {\n                            // starts in this layout, before the\n                            // current paragraph\n                            chooseHtv[i] = this.getLineTop(this.getLineForOffset(o));\n                        } else {\n                            // starts in this paragraph\n                            chooseHtv[i] = v;\n                        }\n                    }\n                }\n            }\n            measured.setPara(source, paraStart, paraEnd, textDir);\n            let chs:string = measured.mChars;\n            let widths:number[] = measured.mWidths;\n            let chdirs:number[] = measured.mLevels;\n            let dir:number = measured.mDir;\n            let easy:boolean = measured.mEasy;\n            let width:number = firstWidth;\n            let w:number = 0;\n            // here is the offset of the starting character of the line we are currently measuring\n            let here:number = paraStart;\n            // ok is a character offset located after a word separator (space, tab, number...) where\n            // we would prefer to cut the current line. Equals to here when no such break was found.\n            let ok:number = paraStart;\n            let okWidth:number = w;\n            let okAscent:number = 0, okDescent:number = 0, okTop:number = 0, okBottom:number = 0;\n            // fit is a character offset such that the [here, fit[ range fits in the allowed width.\n            // We will cut the line there if no ok position is found.\n            let fit:number = paraStart;\n            let fitWidth:number = w;\n            let fitAscent:number = 0, fitDescent:number = 0, fitTop:number = 0, fitBottom:number = 0;\n            let hasTabOrEmoji:boolean = false;\n            let hasTab:boolean = false;\n            let tabStops:Layout.TabStops = null;\n            for (let spanStart:number = paraStart, spanEnd:number; spanStart < paraEnd; spanStart = spanEnd) {\n                if (spanned == null) {\n                    spanEnd = paraEnd;\n                    let spanLen:number = spanEnd - spanStart;\n                    measured.addStyleRun(paint, spanLen, fm);\n                } else {\n                    spanEnd = spanned.nextSpanTransition(spanStart, paraEnd, MetricAffectingSpan.type);\n                    let spanLen:number = spanEnd - spanStart;\n                    let spans:MetricAffectingSpan[] = spanned.getSpans<MetricAffectingSpan>(spanStart, spanEnd, MetricAffectingSpan.type);\n                    spans = TextUtils.removeEmptySpans(spans, spanned, MetricAffectingSpan.type);\n                    measured.addStyleRun(paint, spans, spanLen, fm);\n                }\n                let fmTop:number = fm.top;\n                let fmBottom:number = fm.bottom;\n                let fmAscent:number = fm.ascent;\n                let fmDescent:number = fm.descent;\n                for (let j:number = spanStart; j < spanEnd; j++) {\n                    let c:string = chs[j - paraStart];\n                    if (c == StaticLayout.CHAR_NEW_LINE) {\n                    // intentionally left empty\n                    } else if (c == StaticLayout.CHAR_TAB) {\n                        if (hasTab == false) {\n                            hasTab = true;\n                            hasTabOrEmoji = true;\n                            if (spanned != null) {\n                                // First tab this para, check for tabstops\n                                let spans:TabStopSpan[] = StaticLayout.getParagraphSpans<TabStopSpan>(spanned, paraStart, paraEnd, TabStopSpan.type);\n                                if (spans.length > 0) {\n                                    tabStops = new Layout.TabStops(StaticLayout.TAB_INCREMENT, spans);\n                                }\n                            }\n                        }\n                        if (tabStops != null) {\n                            w = tabStops.nextTab(w);\n                        } else {\n                            w = StaticLayout.TabStops.nextDefaultStop(w, StaticLayout.TAB_INCREMENT);\n                        }\n                    } else if (c.codePointAt(0) >= StaticLayout.CHAR_FIRST_HIGH_SURROGATE\n                        && c.codePointAt(0) <= StaticLayout.CHAR_LAST_LOW_SURROGATE && j + 1 < spanEnd) {\n                        let emoji:number = chs.codePointAt(j - paraStart);\n                        //if (emoji >= StaticLayout.MIN_EMOJI && emoji <= StaticLayout.MAX_EMOJI) {\n                        //    let bm:Bitmap = StaticLayout.EMOJI_FACTORY.getBitmapFromAndroidPua(emoji);\n                        //    if (bm != null) {\n                        //        let whichPaint:Paint;\n                        //        if (spanned == null) {\n                        //            whichPaint = paint;\n                        //        } else {\n                        //            whichPaint = this.mWorkPaint;\n                        //        }\n                        //        let wid:number = bm.getWidth() * -whichPaint.ascent() / bm.getHeight();\n                        //        w += wid;\n                        //        hasTabOrEmoji = true;\n                        //        j++;\n                        //    } else {\n                        //        w += widths[j - paraStart];\n                        //    }\n                        //} else {\n                            w += widths[j - paraStart];\n                        //}\n                    } else {\n                        w += widths[j - paraStart];\n                    }\n                    let isSpaceOrTab:boolean = c == StaticLayout.CHAR_SPACE || c == StaticLayout.CHAR_TAB || c == StaticLayout.CHAR_ZWSP;\n                    if (w <= width || isSpaceOrTab) {\n                        fitWidth = w;\n                        fit = j + 1;\n                        if (fmTop < fitTop)\n                            fitTop = fmTop;\n                        if (fmAscent < fitAscent)\n                            fitAscent = fmAscent;\n                        if (fmDescent > fitDescent)\n                            fitDescent = fmDescent;\n                        if (fmBottom > fitBottom)\n                            fitBottom = fmBottom;\n                        // From the Unicode Line Breaking Algorithm (at least approximately)\n                        let isLineBreak:boolean = isSpaceOrTab || // / is class SY and - is class HY, except when followed by a digit\n                        ((c == StaticLayout.CHAR_SLASH || c == StaticLayout.CHAR_HYPHEN) && (j + 1 >= spanEnd ||\n                        !Number.isInteger(Number.parseInt(chs[j + 1 - paraStart])))) || // (non-starters), which can be broken after but not before\n                        (c.codePointAt(0) >= StaticLayout.CHAR_FIRST_CJK.codePointAt(0) && StaticLayout.isIdeographic(c, true) && j + 1 < spanEnd && StaticLayout.isIdeographic(chs[j + 1 - paraStart], false));\n                        if (isLineBreak) {\n                            okWidth = w;\n                            ok = j + 1;\n                            if (fitTop < okTop)\n                                okTop = fitTop;\n                            if (fitAscent < okAscent)\n                                okAscent = fitAscent;\n                            if (fitDescent > okDescent)\n                                okDescent = fitDescent;\n                            if (fitBottom > okBottom)\n                                okBottom = fitBottom;\n                        }\n                    } else {\n                        const moreChars:boolean = (j + 1 < spanEnd);\n                        let endPos:number;\n                        let above:number, below:number, top:number, bottom:number;\n                        let currentTextWidth:number;\n                        if (ok != here) {\n                            endPos = ok;\n                            above = okAscent;\n                            below = okDescent;\n                            top = okTop;\n                            bottom = okBottom;\n                            currentTextWidth = okWidth;\n                        } else if (fit != here) {\n                            endPos = fit;\n                            above = fitAscent;\n                            below = fitDescent;\n                            top = fitTop;\n                            bottom = fitBottom;\n                            currentTextWidth = fitWidth;\n                        } else {\n                            endPos = here + 1;\n                            above = fm.ascent;\n                            below = fm.descent;\n                            top = fm.top;\n                            bottom = fm.bottom;\n                            currentTextWidth = widths[here - paraStart];\n                        }\n                        v = this.out(source, here, endPos, above, below, top, bottom, v, spacingmult, spacingadd, chooseHt, chooseHtv, fm, hasTabOrEmoji, needMultiply, chdirs, dir, easy, bufEnd, includepad, trackpad, chs, widths, paraStart, ellipsize, ellipsizedWidth, currentTextWidth, paint, moreChars);\n                        here = endPos;\n                        // restart j-span loop from here, compensating for the j++\n                        j = here - 1;\n                        ok = fit = here;\n                        w = 0;\n                        fitAscent = fitDescent = fitTop = fitBottom = 0;\n                        okAscent = okDescent = okTop = okBottom = 0;\n                        if (--firstWidthLineLimit <= 0) {\n                            width = restWidth;\n                        }\n                        if (here < spanStart) {\n                            // The text was cut before the beginning of the current span range.\n                            // Exit the span loop, and get spanStart to start over from here.\n                            measured.setPos(here);\n                            spanEnd = here;\n                            break;\n                        }\n                        if (this.mLineCount >= this.mMaximumVisibleLineCount) {\n                            break;\n                        }\n                    }\n                }\n            }\n            if (paraEnd != here && this.mLineCount < this.mMaximumVisibleLineCount) {\n                if ((fitTop | fitBottom | fitDescent | fitAscent) == 0) {\n                    paint.getFontMetricsInt(fm);\n                    fitTop = fm.top;\n                    fitBottom = fm.bottom;\n                    fitAscent = fm.ascent;\n                    fitDescent = fm.descent;\n                }\n                // Log.e(\"text\", \"output rest \" + here + \" to \" + end);\n                v = this.out(source, here, paraEnd, fitAscent, fitDescent, fitTop, fitBottom, v, spacingmult, spacingadd, chooseHt, chooseHtv, fm, hasTabOrEmoji, needMultiply, chdirs, dir, easy, bufEnd, includepad, trackpad, chs, widths, paraStart, ellipsize, ellipsizedWidth, w, paint, paraEnd != bufEnd);\n            }\n            paraStart = paraEnd;\n            if (paraEnd == bufEnd)\n                break;\n        }\n        if ((bufEnd == bufStart || source.charAt(bufEnd - 1) == StaticLayout.CHAR_NEW_LINE) && this.mLineCount < this.mMaximumVisibleLineCount) {\n            // Log.e(\"text\", \"output last \" + bufEnd);\n            measured.setPara(source, bufStart, bufEnd, textDir);\n            paint.getFontMetricsInt(fm);\n            v = this.out(source, bufEnd, bufEnd, fm.ascent, fm.descent, fm.top, fm.bottom, v, spacingmult, spacingadd, null, null, fm, false, needMultiply, measured.mLevels, measured.mDir, measured.mEasy, bufEnd, includepad, trackpad, null, null, bufStart, ellipsize, ellipsizedWidth, 0, paint, false);\n        }\n    }\n\n    /**\n     * Returns true if the specified character is one of those specified\n     * as being Ideographic (class ID) by the Unicode Line Breaking Algorithm\n     * (http://www.unicode.org/unicode/reports/tr14/), and is therefore OK\n     * to break between a pair of.\n     *\n     * @param includeNonStarters also return true for category NS\n     *                           (non-starters), which can be broken\n     *                           after but not before.\n     */\n    private static isIdeographic(c:string, includeNonStarters:boolean):boolean  {\n        let code = c.codePointAt(0);\n        if (code >= '⺀'.codePointAt(0) && code <= '⿿'.codePointAt(0)) {\n            // CJK, KANGXI RADICALS, DESCRIPTION SYMBOLS\n            return true;\n        }\n        if (c == '　') {\n            // IDEOGRAPHIC SPACE\n            return true;\n        }\n        if (code >= '぀'.codePointAt(0) && code <= 'ゟ'.codePointAt(0)) {\n            if (!includeNonStarters) {\n                switch(c) {\n                    //  # HIRAGANA LETTER SMALL A\n                    case 'ぁ':\n                    //  # HIRAGANA LETTER SMALL I\n                    case 'ぃ':\n                    //  # HIRAGANA LETTER SMALL U\n                    case 'ぅ':\n                    //  # HIRAGANA LETTER SMALL E\n                    case 'ぇ':\n                    //  # HIRAGANA LETTER SMALL O\n                    case 'ぉ':\n                    //  # HIRAGANA LETTER SMALL TU\n                    case 'っ':\n                    //  # HIRAGANA LETTER SMALL YA\n                    case 'ゃ':\n                    //  # HIRAGANA LETTER SMALL YU\n                    case 'ゅ':\n                    //  # HIRAGANA LETTER SMALL YO\n                    case 'ょ':\n                    //  # HIRAGANA LETTER SMALL WA\n                    case 'ゎ':\n                    //  # HIRAGANA LETTER SMALL KA\n                    case 'ゕ':\n                    //  # HIRAGANA LETTER SMALL KE\n                    case 'ゖ':\n                    //  # KATAKANA-HIRAGANA VOICED SOUND MARK\n                    case '゛':\n                    //  # KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK\n                    case '゜':\n                    //  # HIRAGANA ITERATION MARK\n                    case 'ゝ':\n                    case //  # HIRAGANA VOICED ITERATION MARK\n                    'ゞ':\n                        return false;\n                }\n            }\n            // Hiragana (except small characters)\n            return true;\n        }\n        if (code >= '゠'.codePointAt(0) && code <= 'ヿ'.codePointAt(0)) {\n            if (!includeNonStarters) {\n                switch(c) {\n                    //  # KATAKANA-HIRAGANA DOUBLE HYPHEN\n                    case '゠':\n                    //  # KATAKANA LETTER SMALL A\n                    case 'ァ':\n                    //  # KATAKANA LETTER SMALL I\n                    case 'ィ':\n                    //  # KATAKANA LETTER SMALL U\n                    case 'ゥ':\n                    //  # KATAKANA LETTER SMALL E\n                    case 'ェ':\n                    //  # KATAKANA LETTER SMALL O\n                    case 'ォ':\n                    //  # KATAKANA LETTER SMALL TU\n                    case 'ッ':\n                    //  # KATAKANA LETTER SMALL YA\n                    case 'ャ':\n                    //  # KATAKANA LETTER SMALL YU\n                    case 'ュ':\n                    //  # KATAKANA LETTER SMALL YO\n                    case 'ョ':\n                    //  # KATAKANA LETTER SMALL WA\n                    case 'ヮ':\n                    //  # KATAKANA LETTER SMALL KA\n                    case 'ヵ':\n                    //  # KATAKANA LETTER SMALL KE\n                    case 'ヶ':\n                    //  # KATAKANA MIDDLE DOT\n                    case '・':\n                    //  # KATAKANA-HIRAGANA PROLONGED SOUND MARK\n                    case 'ー':\n                    //  # KATAKANA ITERATION MARK\n                    case 'ヽ':\n                    case //  # KATAKANA VOICED ITERATION MARK\n                    'ヾ':\n                        return false;\n                }\n            }\n            // Katakana (except small characters)\n            return true;\n        }\n        if (code >= '㐀'.codePointAt(0) && code <= '䶵'.codePointAt(0)) {\n            // CJK UNIFIED IDEOGRAPHS EXTENSION A\n            return true;\n        }\n        if (code >= '一'.codePointAt(0) && code <= '龻'.codePointAt(0)) {\n            // CJK UNIFIED IDEOGRAPHS\n            return true;\n        }\n        if (code >= '豈'.codePointAt(0) && code <= '龎'.codePointAt(0)) {\n            // CJK COMPATIBILITY IDEOGRAPHS\n            return true;\n        }\n        if (code >= 'ꀀ'.codePointAt(0) && code <= '꒏'.codePointAt(0)) {\n            // YI SYLLABLES\n            return true;\n        }\n        if (code >= '꒐'.codePointAt(0) && code <= '꓏'.codePointAt(0)) {\n            // YI RADICALS\n            return true;\n        }\n        if (code >= '﹢'.codePointAt(0) && code <= '﹦'.codePointAt(0)) {\n            // SMALL PLUS SIGN to SMALL EQUALS SIGN\n            return true;\n        }\n        if (code >= '０'.codePointAt(0) && code <= '９'.codePointAt(0)) {\n            // WIDE DIGITS\n            return true;\n        }\n        return false;\n    }\n\n    private out(text:String, start:number, end:number, above:number, below:number, top:number, bottom:number, v:number,\n                spacingmult:number, spacingadd:number, chooseHt:LineHeightSpan[], chooseHtv:number[], fm:Paint.FontMetricsInt,\n                hasTabOrEmoji:boolean, needMultiply:boolean, chdirs:number[], dir:number, easy:boolean, bufEnd:number,\n                includePad:boolean, trackPad:boolean, chs:string, widths:number[], widthStart:number, ellipsize:TextUtils.TruncateAt,\n                ellipsisWidth:number, textWidth:number, paint:TextPaint, moreChars:boolean):number  {\n        let j:number = this.mLineCount;\n        let off:number = j * this.mColumns;\n        let want:number = off + this.mColumns + StaticLayout.TOP;\n        let lines:number[] = this.mLines;\n        if (want >= lines.length) {\n            let nlen:number = (want + 1);\n            let grow:number[] = androidui.util.ArrayCreator.newNumberArray(nlen);\n            System.arraycopy(lines, 0, grow, 0, lines.length);\n            this.mLines = grow;\n            lines = grow;\n            let grow2:Layout.Directions[] = new Array<Layout.Directions>(nlen);\n            System.arraycopy(this.mLineDirections, 0, grow2, 0, this.mLineDirections.length);\n            this.mLineDirections = grow2;\n        }\n        if (chooseHt != null) {\n            fm.ascent = above;\n            fm.descent = below;\n            fm.top = top;\n            fm.bottom = bottom;\n            for (let i:number = 0; i < chooseHt.length; i++) {\n                //if (chooseHt[i] instanceof LineHeightSpan.WithDensity) {\n                    (<LineHeightSpan.WithDensity> chooseHt[i]).chooseHeight(text, start, end, chooseHtv[i], v, fm, paint);\n                //} else {\n                //    chooseHt[i].chooseHeight(text, start, end, chooseHtv[i], v, fm);\n                //}\n            }\n            above = fm.ascent;\n            below = fm.descent;\n            top = fm.top;\n            bottom = fm.bottom;\n        }\n        if (j == 0) {\n            if (trackPad) {\n                this.mTopPadding = top - above;\n            }\n            if (includePad) {\n                above = top;\n            }\n        }\n        if (end == bufEnd) {\n            if (trackPad) {\n                this.mBottomPadding = bottom - below;\n            }\n            if (includePad) {\n                below = bottom;\n            }\n        }\n        let extra:number;\n        if (needMultiply) {\n            let ex:number = (below - above) * (spacingmult - 1) + spacingadd;\n            if (ex >= 0) {\n                extra = Math.floor((ex + StaticLayout.EXTRA_ROUNDING));\n            } else {\n                extra = -Math.floor((-ex + StaticLayout.EXTRA_ROUNDING));\n            }\n        } else {\n            extra = 0;\n        }\n        lines[off + StaticLayout.START] = start;\n        lines[off + StaticLayout.TOP] = v;\n        lines[off + StaticLayout.DESCENT] = below + extra;\n        v += (below - above) + extra;\n        lines[off + this.mColumns + StaticLayout.START] = end;\n        lines[off + this.mColumns + StaticLayout.TOP] = v;\n        if (hasTabOrEmoji)\n            lines[off + StaticLayout.TAB] |= StaticLayout.TAB_MASK;\n        lines[off + StaticLayout.DIR] |= dir << StaticLayout.DIR_SHIFT;\n        let linedirs:Layout.Directions = StaticLayout.DIRS_ALL_LEFT_TO_RIGHT;\n        // RTL paragraph.  Make sure easy is false if this is the case.\n        //if (easy) {\n            this.mLineDirections[j] = linedirs;\n        //} else {\n        //    this.mLineDirections[j] = AndroidBidi.directions(dir, chdirs, start - widthStart, chs, start - widthStart, end - start);\n        //}\n        if (ellipsize != null) {\n            // If there is only one line, then do any type of ellipsis except when it is MARQUEE\n            // if there are multiple lines, just allow END ellipsis on the last line\n            let firstLine:boolean = (j == 0);\n            let currentLineIsTheLastVisibleOne:boolean = (j + 1 == this.mMaximumVisibleLineCount);\n            let forceEllipsis:boolean = moreChars && (this.mLineCount + 1 == this.mMaximumVisibleLineCount);\n            let doEllipsis:boolean = (((this.mMaximumVisibleLineCount == 1 && moreChars) || (firstLine && !moreChars)) && ellipsize != TextUtils.TruncateAt.MARQUEE) || (!firstLine && (currentLineIsTheLastVisibleOne || !moreChars) && ellipsize == TextUtils.TruncateAt.END);\n            if (doEllipsis) {\n                this.calculateEllipsis(start, end, widths, widthStart, ellipsisWidth, ellipsize, j, textWidth, paint, forceEllipsis);\n            }\n        }\n        this.mLineCount++;\n        return v;\n    }\n\n    private calculateEllipsis(lineStart:number, lineEnd:number, widths:number[], widthStart:number, avail:number, where:TextUtils.TruncateAt, line:number, textWidth:number, paint:TextPaint, forceEllipsis:boolean):void  {\n        if (textWidth <= avail && !forceEllipsis) {\n            // Everything fits!\n            this.mLines[this.mColumns * line + StaticLayout.ELLIPSIS_START] = 0;\n            this.mLines[this.mColumns * line + StaticLayout.ELLIPSIS_COUNT] = 0;\n            return;\n        }\n        let ellipsisWidth:number = paint.measureText(\n            (where == TextUtils.TruncateAt.END_SMALL) ? StaticLayout.ELLIPSIS_TWO_DOTS[0] : StaticLayout.ELLIPSIS_NORMAL[0], 0, 1);\n        let ellipsisStart:number = 0;\n        let ellipsisCount:number = 0;\n        let len:number = lineEnd - lineStart;\n        // We only support start ellipsis on a single line\n        if (where == TextUtils.TruncateAt.START) {\n            if (this.mMaximumVisibleLineCount == 1) {\n                let sum:number = 0;\n                let i:number;\n                for (i = len; i >= 0; i--) {\n                    let w:number = widths[i - 1 + lineStart - widthStart];\n                    if (w + sum + ellipsisWidth > avail) {\n                        break;\n                    }\n                    sum += w;\n                }\n                ellipsisStart = 0;\n                ellipsisCount = i;\n            } else {\n                //if (Log.isLoggable(StaticLayout.TAG, Log.WARN)) {\n                //    Log.w(StaticLayout.TAG, \"Start Ellipsis only supported with one line\");\n                //}\n            }\n        } else if (where == TextUtils.TruncateAt.END || where == TextUtils.TruncateAt.MARQUEE || where == TextUtils.TruncateAt.END_SMALL) {\n            let sum:number = 0;\n            let i:number;\n            for (i = 0; i < len; i++) {\n                let w:number = widths[i + lineStart - widthStart];\n                if (w + sum + ellipsisWidth > avail) {\n                    break;\n                }\n                sum += w;\n            }\n            ellipsisStart = i;\n            ellipsisCount = len - i;\n            if (forceEllipsis && ellipsisCount == 0 && len > 0) {\n                ellipsisStart = len - 1;\n                ellipsisCount = 1;\n            }\n        } else {\n            // where = TextUtils.TruncateAt.MIDDLE We only support middle ellipsis on a single line\n            if (this.mMaximumVisibleLineCount == 1) {\n                let lsum:number = 0, rsum:number = 0;\n                let left:number = 0, right:number = len;\n                let ravail:number = (avail - ellipsisWidth) / 2;\n                for (right = len; right >= 0; right--) {\n                    let w:number = widths[right - 1 + lineStart - widthStart];\n                    if (w + rsum > ravail) {\n                        break;\n                    }\n                    rsum += w;\n                }\n                let lavail:number = avail - ellipsisWidth - rsum;\n                for (left = 0; left < right; left++) {\n                    let w:number = widths[left + lineStart - widthStart];\n                    if (w + lsum > lavail) {\n                        break;\n                    }\n                    lsum += w;\n                }\n                ellipsisStart = left;\n                ellipsisCount = right - left;\n            } else {\n                //if (Log.isLoggable(StaticLayout.TAG, Log.WARN)) {\n                //    Log.w(StaticLayout.TAG, \"Middle Ellipsis only supported with one line\");\n                //}\n            }\n        }\n        this.mLines[this.mColumns * line + StaticLayout.ELLIPSIS_START] = ellipsisStart;\n        this.mLines[this.mColumns * line + StaticLayout.ELLIPSIS_COUNT] = ellipsisCount;\n    }\n\n    // Override the base class so we can directly access our members,\n    // rather than relying on member functions.\n    // The logic mirrors that of Layout.getLineForVertical\n    // FIXME: It may be faster to do a linear search for layouts without many lines.\n    getLineForVertical(vertical:number):number  {\n        let high:number = this.mLineCount;\n        let low:number = -1;\n        let guess:number;\n        let lines:number[] = this.mLines;\n        while (high - low > 1) {\n            guess = (high + low) >> 1;\n            if (lines[this.mColumns * guess + StaticLayout.TOP] > vertical) {\n                high = guess;\n            } else {\n                low = guess;\n            }\n        }\n        if (low < 0) {\n            return 0;\n        } else {\n            return low;\n        }\n    }\n\n    getLineCount():number  {\n        return this.mLineCount;\n    }\n\n    getLineTop(line:number):number  {\n        let top:number = this.mLines[this.mColumns * line + StaticLayout.TOP];\n        if (this.mMaximumVisibleLineCount > 0 && line >= this.mMaximumVisibleLineCount && line != this.mLineCount) {\n            top += this.getBottomPadding();\n        }\n        return top;\n    }\n\n    getLineDescent(line:number):number  {\n        let descent:number = this.mLines[this.mColumns * line + StaticLayout.DESCENT];\n        if (// -1 intended\n        this.mMaximumVisibleLineCount > 0 && line >= this.mMaximumVisibleLineCount - 1 && line != this.mLineCount) {\n            descent += this.getBottomPadding();\n        }\n        return descent;\n    }\n\n    getLineStart(line:number):number  {\n        return this.mLines[this.mColumns * line + StaticLayout.START] & StaticLayout.START_MASK;\n    }\n\n    getParagraphDirection(line:number):number  {\n        return this.mLines[this.mColumns * line + StaticLayout.DIR] >> StaticLayout.DIR_SHIFT;\n    }\n\n    getLineContainsTab(line:number):boolean  {\n        return (this.mLines[this.mColumns * line + StaticLayout.TAB] & StaticLayout.TAB_MASK) != 0;\n    }\n\n    getLineDirections(line:number):Layout.Directions  {\n        return this.mLineDirections[line];\n    }\n\n    getTopPadding():number  {\n        return this.mTopPadding;\n    }\n\n    getBottomPadding():number  {\n        return this.mBottomPadding;\n    }\n\n    getEllipsisCount(line:number):number  {\n        if (this.mColumns < StaticLayout.COLUMNS_ELLIPSIZE) {\n            return 0;\n        }\n        return this.mLines[this.mColumns * line + StaticLayout.ELLIPSIS_COUNT];\n    }\n\n    getEllipsisStart(line:number):number  {\n        if (this.mColumns < StaticLayout.COLUMNS_ELLIPSIZE) {\n            return 0;\n        }\n        return this.mLines[this.mColumns * line + StaticLayout.ELLIPSIS_START];\n    }\n\n    getEllipsizedWidth():number  {\n        return this.mEllipsizedWidth;\n    }\n\n    prepare():void  {\n        this.mMeasured = MeasuredText.obtain();\n    }\n\n    finish():void  {\n        this.mMeasured = MeasuredText.recycle(this.mMeasured);\n    }\n\n    private mLineCount:number = 0;\n\n    private mTopPadding:number = 0;\n    private mBottomPadding:number = 0;\n\n    private mColumns:number = 0;\n\n    private mEllipsizedWidth:number = 0;\n\n    private static COLUMNS_NORMAL:number = 3;\n\n    private static COLUMNS_ELLIPSIZE:number = 5;\n\n    private static START:number = 0;\n\n    private static DIR:number = StaticLayout.START;\n\n    private static TAB:number = StaticLayout.START;\n\n    private static TOP:number = 1;\n\n    private static DESCENT:number = 2;\n\n    private static ELLIPSIS_START:number = 3;\n\n    private static ELLIPSIS_COUNT:number = 4;\n\n    private mLines:number[];\n\n    private mLineDirections:Layout.Directions[];\n\n    private mMaximumVisibleLineCount:number = Integer.MAX_VALUE;\n\n    private static START_MASK:number = 0x1FFFFFFF;\n\n    private static DIR_SHIFT:number = 30;\n\n    private static TAB_MASK:number = 0x20000000;\n\n    // same as Layout, but that's private\n    //private static TAB_INCREMENT:number = 20;\n\n    private static CHAR_FIRST_CJK = '⺀';\n\n    private static CHAR_NEW_LINE = '\\n';\n\n    private static CHAR_TAB = '\\t';\n\n    private static CHAR_SPACE = ' ';\n\n    private static CHAR_SLASH = '/';\n\n    private static CHAR_HYPHEN = '-';\n\n    private static CHAR_ZWSP = '​';\n\n    private static EXTRA_ROUNDING:number = 0.5;\n\n    private static CHAR_FIRST_HIGH_SURROGATE:number = 0xD800;\n\n    private static CHAR_LAST_LOW_SURROGATE:number = 0xDFFF;\n\n    /*\n     * This is reused across calls to generate()\n     */\n    private mMeasured:MeasuredText;\n\n    private mFontMetricsInt:Paint.FontMetricsInt = new Paint.FontMetricsInt();\n}\n}"
  },
  {
    "path": "src/android/text/TextDirectionHeuristic.ts",
    "content": "/*\n * Copyright (C) 2011 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\nmodule android.text {\n/**\n * Interface for objects that use a heuristic for guessing at the paragraph direction by examining text.\n */\nexport interface TextDirectionHeuristic {\n\n    /**\n     * Guess if a {@code CharSequence} is in the RTL direction or not.\n     *\n     * @param cs the CharSequence.\n     * @param start start index, inclusive.\n     * @param count the length to check, must not be negative and not greater than\n     *            {@code CharSequence.length() - start}.\n     * @return true if all chars in the range are to be considered in a RTL direction,\n     *          false otherwise.\n     */\n    isRtl(cs:string, start:number, count:number):boolean ;\n}\n}"
  },
  {
    "path": "src/android/text/TextDirectionHeuristics.ts",
    "content": "/*\n * Copyright (C) 2011 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/text/Layout.ts\"/>\n///<reference path=\"../../android/text/TextDirectionHeuristic.ts\"/>\n///<reference path=\"../../android/text/TextUtils.ts\"/>\n\nmodule android.text {\n    import View = android.view.View;\n    import Layout = android.text.Layout;\n    import TextDirectionHeuristic = android.text.TextDirectionHeuristic;\n    import TextUtils = android.text.TextUtils;\n\n    /**\n     * Some objects that implement {@link TextDirectionHeuristic}. Use these with\n     * the {@link BidiFormatter#unicodeWrap unicodeWrap()} methods in {@link BidiFormatter}.\n     * Also notice that these direction heuristics correspond to the same types of constants\n     * provided in the {@link android.view.View} class for {@link android.view.View#setTextDirection\n     * setTextDirection()}, such as {@link android.view.View#TEXT_DIRECTION_RTL}.\n     * <p>To support versions lower than {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2},\n     * you can use the support library's {@link android.support.v4.text.TextDirectionHeuristicsCompat}\n     * class.\n     *\n     */\n    export class TextDirectionHeuristics {\n\n        /**\n         * Always decides that the direction is left to right.\n         */\n        static LTR:TextDirectionHeuristic;\n\n        /**\n         * Always decides that the direction is right to left.\n         */\n        static RTL:TextDirectionHeuristic;\n\n        /**\n         * Determines the direction based on the first strong directional character, including bidi\n         * format chars, falling back to left to right if it finds none. This is the default behavior\n         * of the Unicode Bidirectional Algorithm.\n         */\n        static FIRSTSTRONG_LTR:TextDirectionHeuristic;\n\n        /**\n         * Determines the direction based on the first strong directional character, including bidi\n         * format chars, falling back to right to left if it finds none. This is similar to the default\n         * behavior of the Unicode Bidirectional Algorithm, just with different fallback behavior.\n         */\n        static FIRSTSTRONG_RTL:TextDirectionHeuristic;\n\n        /**\n         * If the text contains any strong right to left non-format character, determines that the\n         * direction is right to left, falling back to left to right if it finds none.\n         */\n        static ANYRTL_LTR:TextDirectionHeuristic;\n\n        /**\n         * Force the paragraph direction to the Locale direction. Falls back to left to right.\n         */\n        static LOCALE:TextDirectionHeuristic;\n\n        /**\n         * State constants for taking care about true / false / unknown\n         */\n        private static STATE_TRUE:number = 0;\n\n        private static STATE_FALSE:number = 1;\n\n        private static STATE_UNKNOWN:number = 2;\n\n        private static isRtlText(directionality:number):number {\n            return TextDirectionHeuristics.STATE_FALSE;\n            //switch(directionality) {\n            //    case Character.DIRECTIONALITY_LEFT_TO_RIGHT:\n            //        return TextDirectionHeuristics.STATE_FALSE;\n            //    case Character.DIRECTIONALITY_RIGHT_TO_LEFT:\n            //    case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:\n            //        return TextDirectionHeuristics.STATE_TRUE;\n            //    default:\n            //        return TextDirectionHeuristics.STATE_UNKNOWN;\n            //}\n        }\n\n        private static isRtlTextOrFormat(directionality:number):number {\n            return TextDirectionHeuristics.STATE_FALSE;\n            //switch(directionality) {\n            //    case Character.DIRECTIONALITY_LEFT_TO_RIGHT:\n            //    case Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING:\n            //    case Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE:\n            //        return TextDirectionHeuristics.STATE_FALSE;\n            //    case Character.DIRECTIONALITY_RIGHT_TO_LEFT:\n            //    case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:\n            //    case Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING:\n            //    case Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE:\n            //        return TextDirectionHeuristics.STATE_TRUE;\n            //    default:\n            //        return TextDirectionHeuristics.STATE_UNKNOWN;\n            //}\n        }\n    }\n\n    export module TextDirectionHeuristics {\n        /**\n         * Computes the text direction based on an algorithm.  Subclasses implement\n         * {@link #defaultIsRtl} to handle cases where the algorithm cannot determine the\n         * direction from the text alone.\n         */\n    export abstract class TextDirectionHeuristicImpl implements TextDirectionHeuristic {\n\n            private mAlgorithm:TextDirectionHeuristics.TextDirectionAlgorithm;\n\n            constructor(algorithm:TextDirectionHeuristics.TextDirectionAlgorithm) {\n                this.mAlgorithm = algorithm;\n            }\n\n            /**\n             * Return true if the default text direction is rtl.\n             */\n            protected abstract defaultIsRtl():boolean ;\n\n            isRtl(cs:string, start:number, count:number):boolean {\n                if (cs == null || start < 0 || count < 0 || cs.length - count < start) {\n                    throw Error(`new IllegalArgumentException()`);\n                }\n                if (this.mAlgorithm == null) {\n                    return this.defaultIsRtl();\n                }\n                return this.doCheck(cs, start, count);\n            }\n\n            private doCheck(cs:string, start:number, count:number):boolean {\n                switch (this.mAlgorithm.checkRtl(cs, start, count)) {\n                    case TextDirectionHeuristics.STATE_TRUE:\n                        return true;\n                    case TextDirectionHeuristics.STATE_FALSE:\n                        return false;\n                    default:\n                        return this.defaultIsRtl();\n                }\n            }\n        }\n        export class TextDirectionHeuristicInternal extends TextDirectionHeuristics.TextDirectionHeuristicImpl {\n\n            private mDefaultIsRtl:boolean;\n\n            constructor(algorithm:TextDirectionHeuristics.TextDirectionAlgorithm, defaultIsRtl:boolean) {\n                super(algorithm);\n                this.mDefaultIsRtl = defaultIsRtl;\n            }\n\n            protected defaultIsRtl():boolean {\n                return this.mDefaultIsRtl;\n            }\n        }\n        /**\n         * Interface for an algorithm to guess the direction of a paragraph of text.\n         */\n        export interface TextDirectionAlgorithm {\n\n            /**\n             * Returns whether the range of text is RTL according to the algorithm.\n             */\n            checkRtl(cs:string, start:number, count:number):number ;\n        }\n        /**\n         * Algorithm that uses the first strong directional character to determine the paragraph\n         * direction. This is the standard Unicode Bidirectional algorithm.\n         */\n        export class FirstStrong implements TextDirectionHeuristics.TextDirectionAlgorithm {\n\n            checkRtl(cs:string, start:number, count:number):number {\n                let result:number = TextDirectionHeuristics.STATE_UNKNOWN;\n                for (let i:number = start, e:number = start + count; i < e && result == TextDirectionHeuristics.STATE_UNKNOWN; ++i) {\n                    result = TextDirectionHeuristics.STATE_FALSE;\n                    //result = TextDirectionHeuristics.isRtlTextOrFormat(Character.getDirectionality(cs.charAt(i)));\n                }\n                return result;\n            }\n\n            constructor() {\n            }\n\n            static INSTANCE:FirstStrong = new FirstStrong();\n        }\n        /**\n         * Algorithm that uses the presence of any strong directional non-format\n         * character (e.g. excludes LRE, LRO, RLE, RLO) to determine the\n         * direction of text.\n         */\n        export class AnyStrong implements TextDirectionHeuristics.TextDirectionAlgorithm {\n\n            private mLookForRtl:boolean;\n\n            checkRtl(cs:string, start:number, count:number):number {\n                let haveUnlookedFor:boolean = false;\n                for (let i:number = start, e:number = start + count; i < e; ++i) {\n                    switch (TextDirectionHeuristics.isRtlText(0/*Character.getDirectionality(cs.charAt(i))*/)) {\n                        case TextDirectionHeuristics.STATE_TRUE:\n                            if (this.mLookForRtl) {\n                                return TextDirectionHeuristics.STATE_TRUE;\n                            }\n                            haveUnlookedFor = true;\n                            break;\n                        case TextDirectionHeuristics.STATE_FALSE:\n                            if (!this.mLookForRtl) {\n                                return TextDirectionHeuristics.STATE_FALSE;\n                            }\n                            haveUnlookedFor = true;\n                            break;\n                        default:\n                            break;\n                    }\n                }\n                if (haveUnlookedFor) {\n                    return this.mLookForRtl ? TextDirectionHeuristics.STATE_FALSE : TextDirectionHeuristics.STATE_TRUE;\n                }\n                return TextDirectionHeuristics.STATE_UNKNOWN;\n            }\n\n            constructor(lookForRtl:boolean) {\n                this.mLookForRtl = lookForRtl;\n            }\n\n            static INSTANCE_RTL:AnyStrong = new AnyStrong(true);\n\n            static INSTANCE_LTR:AnyStrong = new AnyStrong(false);\n        }\n        /**\n         * Algorithm that uses the Locale direction to force the direction of a paragraph.\n         */\n        export class TextDirectionHeuristicLocale extends TextDirectionHeuristics.TextDirectionHeuristicImpl {\n\n            constructor() {\n                super(null);\n            }\n\n            protected defaultIsRtl():boolean {\n                return false;\n                //const dir:number = TextUtils.getLayoutDirectionFromLocale(java.util.Locale.getDefault());\n                //return (dir == View.LAYOUT_DIRECTION_RTL);\n            }\n\n            static INSTANCE:TextDirectionHeuristicLocale = new TextDirectionHeuristicLocale();\n        }\n\n\n    }\n\n    //delay init\n    TextDirectionHeuristics.LTR = new TextDirectionHeuristics.TextDirectionHeuristicInternal(null, /* no algorithm */false);\n    TextDirectionHeuristics.RTL = new TextDirectionHeuristics.TextDirectionHeuristicInternal(null, /* no algorithm */true);\n    TextDirectionHeuristics.FIRSTSTRONG_LTR = new TextDirectionHeuristics.TextDirectionHeuristicInternal(TextDirectionHeuristics.FirstStrong.INSTANCE, false);\n    TextDirectionHeuristics.FIRSTSTRONG_RTL = new TextDirectionHeuristics.TextDirectionHeuristicInternal(TextDirectionHeuristics.FirstStrong.INSTANCE, true);\n    TextDirectionHeuristics.ANYRTL_LTR = new TextDirectionHeuristics.TextDirectionHeuristicInternal(TextDirectionHeuristics.AnyStrong.INSTANCE_RTL, false);\n    TextDirectionHeuristics.LOCALE = TextDirectionHeuristics.TextDirectionHeuristicLocale.INSTANCE;\n\n\n}"
  },
  {
    "path": "src/android/text/TextLine.ts",
    "content": "/*\n * Copyright (C) 2010 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../android/graphics/RectF.ts\"/>\n///<reference path=\"../../android/text/style/CharacterStyle.ts\"/>\n///<reference path=\"../../android/text/style/MetricAffectingSpan.ts\"/>\n///<reference path=\"../../android/text/style/ReplacementSpan.ts\"/>\n///<reference path=\"../../android/util/Log.ts\"/>\n///<reference path=\"../../android/text/Layout.ts\"/>\n///<reference path=\"../../android/text/Spanned.ts\"/>\n///<reference path=\"../../android/text/SpanSet.ts\"/>\n///<reference path=\"../../android/text/TextPaint.ts\"/>\n///<reference path=\"../../android/text/TextUtils.ts\"/>\n\nmodule android.text {\nimport Canvas = android.graphics.Canvas;\nimport Paint = android.graphics.Paint;\nimport FontMetricsInt = android.graphics.Paint.FontMetricsInt;\nimport RectF = android.graphics.RectF;\nimport CharacterStyle = android.text.style.CharacterStyle;\nimport MetricAffectingSpan = android.text.style.MetricAffectingSpan;\nimport ReplacementSpan = android.text.style.ReplacementSpan;\nimport Log = android.util.Log;\nimport Spanned = android.text.Spanned;\nimport SpanSet = android.text.SpanSet;\nimport TextPaint = android.text.TextPaint;\nimport TextUtils = android.text.TextUtils;\nimport Layout = android.text.Layout;\nwindow.addEventListener('AndroidUILoadFinish', ()=>{\n    eval('Layout = android.text.Layout;');//real import now\n});\n\n/**\n * Represents a line of styled text, for measuring in visual order and\n * for rendering.\n *\n * <p>Get a new instance using obtain(), and when finished with it, return it\n * to the pool using recycle().\n *\n * <p>Call set to prepare the instance for use, then either draw, measure,\n * metrics, or caretToLeftRightOf.\n *\n * @hide\n */\nexport class TextLine {\n\n    private static DEBUG:boolean = false;\n\n    private mPaint:TextPaint;\n\n    private mText:String;\n\n    private mStart:number = 0;\n\n    private mLen:number = 0;\n\n    private mDir:number = 0;\n\n    private mDirections:Layout.Directions;\n\n    private mHasTabs:boolean;\n\n    private mTabs:Layout.TabStops;\n\n    private mChars:String;\n\n    private mCharsValid:boolean;\n\n    private mSpanned:Spanned;\n\n    private mWorkPaint:TextPaint = new TextPaint();\n\n    private mMetricAffectingSpanSpanSet:SpanSet<MetricAffectingSpan> = new SpanSet<MetricAffectingSpan>(MetricAffectingSpan.type);\n\n    private mCharacterStyleSpanSet:SpanSet<CharacterStyle> = new SpanSet<CharacterStyle>(CharacterStyle.type);\n\n    private mReplacementSpanSpanSet:SpanSet<ReplacementSpan> = new SpanSet<ReplacementSpan>(ReplacementSpan.type);\n\n    private static sCached:TextLine[] = new Array<TextLine>(3);\n\n    /**\n     * Returns a new TextLine from the shared pool.\n     *\n     * @return an uninitialized TextLine\n     */\n    static obtain():TextLine  {\n        let tl:TextLine;\n        {\n            for (let i:number = TextLine.sCached.length; --i >= 0; ) {\n                if (TextLine.sCached[i] != null) {\n                    tl = TextLine.sCached[i];\n                    TextLine.sCached[i] = null;\n                    return tl;\n                }\n            }\n        }\n        tl = new TextLine();\n        if (TextLine.DEBUG) {\n            Log.v(\"TLINE\", \"new: \" + tl);\n        }\n        return tl;\n    }\n\n    /**\n     * Puts a TextLine back into the shared pool. Do not use this TextLine once\n     * it has been returned.\n     * @param tl the textLine\n     * @return null, as a convenience from clearing references to the provided\n     * TextLine\n     */\n    static recycle(tl:TextLine):TextLine  {\n        tl.mText = null;\n        tl.mPaint = null;\n        tl.mDirections = null;\n        tl.mMetricAffectingSpanSpanSet.recycle();\n        tl.mCharacterStyleSpanSet.recycle();\n        tl.mReplacementSpanSpanSet.recycle();\n        {\n            for (let i:number = 0; i < TextLine.sCached.length; ++i) {\n                if (TextLine.sCached[i] == null) {\n                    TextLine.sCached[i] = tl;\n                    break;\n                }\n            }\n        }\n        return null;\n    }\n\n    /**\n     * Initializes a TextLine and prepares it for use.\n     *\n     * @param paint the base paint for the line\n     * @param text the text, can be Styled\n     * @param start the start of the line relative to the text\n     * @param limit the limit of the line relative to the text\n     * @param dir the paragraph direction of this line\n     * @param directions the directions information of this line\n     * @param hasTabs true if the line might contain tabs or emoji\n     * @param tabStops the tabStops. Can be null.\n     */\n    set(paint:TextPaint, text:String, start:number, limit:number, dir:number, directions:Layout.Directions, hasTabs:boolean, tabStops:Layout.TabStops):void  {\n        this.mPaint = paint;\n        this.mText = text;\n        this.mStart = start;\n        this.mLen = limit - start;\n        this.mDir = dir;\n        this.mDirections = directions;\n        if (this.mDirections == null) {\n            throw Error(`new IllegalArgumentException(\"Directions cannot be null\")`);\n        }\n        this.mHasTabs = hasTabs;\n        this.mSpanned = null;\n        let hasReplacement:boolean = false;\n        if (Spanned.isImplements(text)) {\n            this.mSpanned = <Spanned> text;\n            this.mReplacementSpanSpanSet.init(this.mSpanned, start, limit);\n            hasReplacement = this.mReplacementSpanSpanSet.numberOfSpans > 0;\n        }\n        this.mCharsValid = hasReplacement || hasTabs || directions != Layout.DIRS_ALL_LEFT_TO_RIGHT;\n        if (this.mCharsValid) {\n            //if (this.mChars == null || this.mChars.length < this.mLen) {\n            //    this.mChars = new Array<char>(ArrayUtils.idealCharArraySize(this.mLen));\n            //}\n            //TextUtils.getChars(text, start, limit, this.mChars, 0);\n            this.mChars = text;\n            if (hasReplacement) {\n                // Handle these all at once so we don't have to do it as we go.\n                // Replace the first character of each replacement run with the\n                // object-replacement character and the remainder with zero width\n                // non-break space aka BOM.  Cursor movement code skips these\n                // zero-width characters.\n                let chars = this.mChars.split('');\n                for (let i:number = start, inext:number; i < limit; i = inext) {\n                    inext = this.mReplacementSpanSpanSet.getNextTransition(i, limit);\n                    if (this.mReplacementSpanSpanSet.hasSpansIntersecting(i, inext)) {\n                        // transition into a span\n                        chars[i - start] = '￼';\n                        for (let j:number = i - start + 1, e:number = inext - start; j < e; ++j) {\n                            // used as ZWNBS, marks positions to skip\n                            chars[j] = '﻿';\n                        }\n                    }\n                }\n                this.mChars = chars.join('');\n            }\n        }\n        this.mTabs = tabStops;\n    }\n\n    /**\n     * Renders the TextLine.\n     *\n     * @param c the canvas to render on\n     * @param x the leading margin position\n     * @param top the top of the line\n     * @param y the baseline\n     * @param bottom the bottom of the line\n     */\n    draw(c:Canvas, x:number, top:number, y:number, bottom:number):void  {\n        if (!this.mHasTabs) {\n            if (this.mDirections == Layout.DIRS_ALL_LEFT_TO_RIGHT) {\n                this.drawRun(c, 0, this.mLen, false, x, top, y, bottom, false);\n                return;\n            }\n            if (this.mDirections == Layout.DIRS_ALL_RIGHT_TO_LEFT) {\n                this.drawRun(c, 0, this.mLen, true, x, top, y, bottom, false);\n                return;\n            }\n        }\n        let h:number = 0;\n        let runs:number[] = this.mDirections.mDirections;\n        let emojiRect:RectF = null;\n        let lastRunIndex:number = runs.length - 2;\n        for (let i:number = 0; i < runs.length; i += 2) {\n            let runStart:number = runs[i];\n            let runLimit:number = runStart + (runs[i + 1] & Layout.RUN_LENGTH_MASK);\n            if (runLimit > this.mLen) {\n                runLimit = this.mLen;\n            }\n            let runIsRtl:boolean = (runs[i + 1] & Layout.RUN_RTL_FLAG) != 0;\n            let segstart:number = runStart;\n            for (let j:number = this.mHasTabs ? runStart : runLimit; j <= runLimit; j++) {\n                let codept:number = 0;\n                //let bm:Bitmap = null;\n                if (this.mHasTabs && j < runLimit) {\n                    codept = this.mChars.codePointAt(j);\n                    if (codept >= 0xd800 && codept < 0xdc00 && j + 1 < runLimit) {\n                        codept = this.mChars.codePointAt(j);\n                        //if (codept >= Layout.MIN_EMOJI && codept <= Layout.MAX_EMOJI) {\n                        //    bm = Layout.EMOJI_FACTORY.getBitmapFromAndroidPua(codept);\n                        //} else\n                        if (codept > 0xffff) {\n                            ++j;\n                            continue;\n                        }\n                    }\n                }\n                if (j == runLimit || codept == '\\t'.codePointAt(0)\n                    //|| bm != null\n                ) {\n                    h += this.drawRun(c, segstart, j, runIsRtl, x + h, top, y, bottom, i != lastRunIndex || j != this.mLen);\n                    if (codept == '\\t'.codePointAt(0)) {\n                        h = this.mDir * this.nextTab(h * this.mDir);\n                    }\n                    //else if (bm != null) {\n                    //    let bmAscent:number = this.ascent(j);\n                    //    let bitmapHeight:number = bm.getHeight();\n                    //    let scale:number = -bmAscent / bitmapHeight;\n                    //    let width:number = bm.getWidth() * scale;\n                    //    if (emojiRect == null) {\n                    //        emojiRect = new RectF();\n                    //    }\n                    //    emojiRect.set(x + h, y + bmAscent, x + h + width, y);\n                    //    c.drawBitmap(bm, null, emojiRect, this.mPaint);\n                    //    h += width;\n                    //    j++;\n                    //}\n                    segstart = j + 1;\n                }\n            }\n        }\n    }\n\n    /**\n     * Returns metrics information for the entire line.\n     *\n     * @param fmi receives font metrics information, can be null\n     * @return the signed width of the line\n     */\n    metrics(fmi:FontMetricsInt):number  {\n        return this.measure(this.mLen, false, fmi);\n    }\n\n    /**\n     * Returns information about a position on the line.\n     *\n     * @param offset the line-relative character offset, between 0 and the\n     * line length, inclusive\n     * @param trailing true to measure the trailing edge of the character\n     * before offset, false to measure the leading edge of the character\n     * at offset.\n     * @param fmi receives metrics information about the requested\n     * character, can be null.\n     * @return the signed offset from the leading margin to the requested\n     * character edge.\n     */\n    measure(offset:number, trailing:boolean, fmi:FontMetricsInt):number  {\n        let target:number = trailing ? offset - 1 : offset;\n        if (target < 0) {\n            return 0;\n        }\n        let h:number = 0;\n        if (!this.mHasTabs) {\n            if (this.mDirections == Layout.DIRS_ALL_LEFT_TO_RIGHT) {\n                return this.measureRun(0, offset, this.mLen, false, fmi);\n            }\n            if (this.mDirections == Layout.DIRS_ALL_RIGHT_TO_LEFT) {\n                return this.measureRun(0, offset, this.mLen, true, fmi);\n            }\n        }\n        let chars = this.mChars;\n        let runs:number[] = this.mDirections.mDirections;\n        for (let i:number = 0; i < runs.length; i += 2) {\n            let runStart:number = runs[i];\n            let runLimit:number = runStart + (runs[i + 1] & Layout.RUN_LENGTH_MASK);\n            if (runLimit > this.mLen) {\n                runLimit = this.mLen;\n            }\n            let runIsRtl:boolean = (runs[i + 1] & Layout.RUN_RTL_FLAG) != 0;\n            let segstart:number = runStart;\n            for (let j:number = this.mHasTabs ? runStart : runLimit; j <= runLimit; j++) {\n                let codept:number = 0;\n                //let bm:Bitmap = null;\n                if (this.mHasTabs && j < runLimit) {\n                    codept = chars.codePointAt(j);\n                    if (codept >= 0xd800 && codept < 0xdc00 && j + 1 < runLimit) {\n                        codept = chars.codePointAt(j);\n                        //if (codept >= Layout.MIN_EMOJI && codept <= Layout.MAX_EMOJI) {\n                        //    bm = Layout.EMOJI_FACTORY.getBitmapFromAndroidPua(codept);\n                        //} else\n                        if (codept > 0xffff) {\n                            ++j;\n                            continue;\n                        }\n                    }\n                }\n                if (j == runLimit || codept == '\\t'.codePointAt(0)\n                    //|| bm != null\n                ) {\n                    let inSegment:boolean = target >= segstart && target < j;\n                    let advance:boolean = (this.mDir == Layout.DIR_RIGHT_TO_LEFT) == runIsRtl;\n                    if (inSegment && advance) {\n                        return h += this.measureRun(segstart, offset, j, runIsRtl, fmi);\n                    }\n                    let w:number = this.measureRun(segstart, j, j, runIsRtl, fmi);\n                    h += advance ? w : -w;\n                    if (inSegment) {\n                        return h += this.measureRun(segstart, offset, j, runIsRtl, null);\n                    }\n                    if (codept == '\\t'.codePointAt(0)) {\n                        if (offset == j) {\n                            return h;\n                        }\n                        h = this.mDir * this.nextTab(h * this.mDir);\n                        if (target == j) {\n                            return h;\n                        }\n                    }\n                    //if (bm != null) {\n                    //    let bmAscent:number = this.ascent(j);\n                    //    let wid:number = bm.getWidth() * -bmAscent / bm.getHeight();\n                    //    h += this.mDir * wid;\n                    //    j++;\n                    //}\n                    segstart = j + 1;\n                }\n            }\n        }\n        return h;\n    }\n\n    /**\n     * Draws a unidirectional (but possibly multi-styled) run of text.\n     *\n     *\n     * @param c the canvas to draw on\n     * @param start the line-relative start\n     * @param limit the line-relative limit\n     * @param runIsRtl true if the run is right-to-left\n     * @param x the position of the run that is closest to the leading margin\n     * @param top the top of the line\n     * @param y the baseline\n     * @param bottom the bottom of the line\n     * @param needWidth true if the width value is required.\n     * @return the signed width of the run, based on the paragraph direction.\n     * Only valid if needWidth is true.\n     */\n    private drawRun(c:Canvas, start:number, limit:number, runIsRtl:boolean, x:number, top:number, y:number, bottom:number, needWidth:boolean):number  {\n        if ((this.mDir == Layout.DIR_LEFT_TO_RIGHT) == runIsRtl) {\n            let w:number = -this.measureRun(start, limit, limit, runIsRtl, null);\n            this.handleRun(start, limit, limit, runIsRtl, c, x + w, top, y, bottom, null, false);\n            return w;\n        }\n        return this.handleRun(start, limit, limit, runIsRtl, c, x, top, y, bottom, null, needWidth);\n    }\n\n    /**\n     * Measures a unidirectional (but possibly multi-styled) run of text.\n     *\n     *\n     * @param start the line-relative start of the run\n     * @param offset the offset to measure to, between start and limit inclusive\n     * @param limit the line-relative limit of the run\n     * @param runIsRtl true if the run is right-to-left\n     * @param fmi receives metrics information about the requested\n     * run, can be null.\n     * @return the signed width from the start of the run to the leading edge\n     * of the character at offset, based on the run (not paragraph) direction\n     */\n    private measureRun(start:number, offset:number, limit:number, runIsRtl:boolean, fmi:FontMetricsInt):number  {\n        return this.handleRun(start, offset, limit, runIsRtl, null, 0, 0, 0, 0, fmi, true);\n    }\n\n    /**\n     * Walk the cursor through this line, skipping conjuncts and\n     * zero-width characters.\n     *\n     * <p>This function cannot properly walk the cursor off the ends of the line\n     * since it does not know about any shaping on the previous/following line\n     * that might affect the cursor position. Callers must either avoid these\n     * situations or handle the result specially.\n     *\n     * @param cursor the starting position of the cursor, between 0 and the\n     * length of the line, inclusive\n     * @param toLeft true if the caret is moving to the left.\n     * @return the new offset.  If it is less than 0 or greater than the length\n     * of the line, the previous/following line should be examined to get the\n     * actual offset.\n     */\n    getOffsetToLeftRightOf(cursor:number, toLeft:boolean):number  {\n        // 1) The caret marks the leading edge of a character. The character\n        // logically before it might be on a different level, and the active caret\n        // position is on the character at the lower level. If that character\n        // was the previous character, the caret is on its trailing edge.\n        // 2) Take this character/edge and move it in the indicated direction.\n        // This gives you a new character and a new edge.\n        // 3) This position is between two visually adjacent characters.  One of\n        // these might be at a lower level.  The active position is on the\n        // character at the lower level.\n        // 4) If the active position is on the trailing edge of the character,\n        // the new caret position is the following logical character, else it\n        // is the character.\n        let lineStart:number = 0;\n        let lineEnd:number = this.mLen;\n        let paraIsRtl:boolean = this.mDir == -1;\n        let runs:number[] = this.mDirections.mDirections;\n        let runIndex:number, runLevel:number = 0, runStart:number = lineStart, runLimit:number = lineEnd, newCaret:number = -1;\n        let trailing:boolean = false;\n        if (cursor == lineStart) {\n            runIndex = -2;\n        } else if (cursor == lineEnd) {\n            runIndex = runs.length;\n        } else {\n            // the active caret.\n            for (runIndex = 0; runIndex < runs.length; runIndex += 2) {\n                runStart = lineStart + runs[runIndex];\n                if (cursor >= runStart) {\n                    runLimit = runStart + (runs[runIndex + 1] & Layout.RUN_LENGTH_MASK);\n                    if (runLimit > lineEnd) {\n                        runLimit = lineEnd;\n                    }\n                    if (cursor < runLimit) {\n                        runLevel = (runs[runIndex + 1] >>> Layout.RUN_LEVEL_SHIFT) & Layout.RUN_LEVEL_MASK;\n                        if (cursor == runStart) {\n                            // The caret is on a run boundary, see if we should\n                            // use the position on the trailing edge of the previous\n                            // logical character instead.\n                            let prevRunIndex:number, prevRunLevel:number, prevRunStart:number, prevRunLimit:number;\n                            let pos:number = cursor - 1;\n                            for (prevRunIndex = 0; prevRunIndex < runs.length; prevRunIndex += 2) {\n                                prevRunStart = lineStart + runs[prevRunIndex];\n                                if (pos >= prevRunStart) {\n                                    prevRunLimit = prevRunStart + (runs[prevRunIndex + 1] & Layout.RUN_LENGTH_MASK);\n                                    if (prevRunLimit > lineEnd) {\n                                        prevRunLimit = lineEnd;\n                                    }\n                                    if (pos < prevRunLimit) {\n                                        prevRunLevel = (runs[prevRunIndex + 1] >>> Layout.RUN_LEVEL_SHIFT) & Layout.RUN_LEVEL_MASK;\n                                        if (prevRunLevel < runLevel) {\n                                            // Start from logically previous character.\n                                            runIndex = prevRunIndex;\n                                            runLevel = prevRunLevel;\n                                            runStart = prevRunStart;\n                                            runLimit = prevRunLimit;\n                                            trailing = true;\n                                            break;\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                        break;\n                    }\n                }\n            }\n            // we are at a run boundary so we skip the below test.\n            if (runIndex != runs.length) {\n                let runIsRtl:boolean = (runLevel & 0x1) != 0;\n                let advance:boolean = toLeft == runIsRtl;\n                if (cursor != (advance ? runLimit : runStart) || advance != trailing) {\n                    // Moving within or into the run, so we can move logically.\n                    newCaret = this.getOffsetBeforeAfter(runIndex, runStart, runLimit, runIsRtl, cursor, advance);\n                    // position already so we're finished.\n                    if (newCaret != (advance ? runLimit : runStart)) {\n                        return newCaret;\n                    }\n                }\n            }\n        }\n        // another run boundary.\n        while (true) {\n            let advance:boolean = toLeft == paraIsRtl;\n            let otherRunIndex:number = runIndex + (advance ? 2 : -2);\n            if (otherRunIndex >= 0 && otherRunIndex < runs.length) {\n                let otherRunStart:number = lineStart + runs[otherRunIndex];\n                let otherRunLimit:number = otherRunStart + (runs[otherRunIndex + 1] & Layout.RUN_LENGTH_MASK);\n                if (otherRunLimit > lineEnd) {\n                    otherRunLimit = lineEnd;\n                }\n                let otherRunLevel:number = (runs[otherRunIndex + 1] >>> Layout.RUN_LEVEL_SHIFT) & Layout.RUN_LEVEL_MASK;\n                let otherRunIsRtl:boolean = (otherRunLevel & 1) != 0;\n                advance = toLeft == otherRunIsRtl;\n                if (newCaret == -1) {\n                    newCaret = this.getOffsetBeforeAfter(otherRunIndex, otherRunStart, otherRunLimit, otherRunIsRtl, advance ? otherRunStart : otherRunLimit, advance);\n                    if (newCaret == (advance ? otherRunLimit : otherRunStart)) {\n                        // Crossed and ended up at a new boundary,\n                        // repeat a second and final time.\n                        runIndex = otherRunIndex;\n                        runLevel = otherRunLevel;\n                        continue;\n                    }\n                    break;\n                }\n                // The new caret is at a boundary.\n                if (otherRunLevel < runLevel) {\n                    // The strong character is in the other run.\n                    newCaret = advance ? otherRunStart : otherRunLimit;\n                }\n                break;\n            }\n            if (newCaret == -1) {\n                // We're walking off the end of the line.  The paragraph\n                // level is always equal to or lower than any internal level, so\n                // the boundaries get the strong caret.\n                newCaret = advance ? this.mLen + 1 : -1;\n                break;\n            }\n            // the lineStart.\n            if (newCaret <= lineEnd) {\n                newCaret = advance ? lineEnd : lineStart;\n            }\n            break;\n        }\n        return newCaret;\n    }\n\n    /**\n     * Returns the next valid offset within this directional run, skipping\n     * conjuncts and zero-width characters.  This should not be called to walk\n     * off the end of the line, since the returned values might not be valid\n     * on neighboring lines.  If the returned offset is less than zero or\n     * greater than the line length, the offset should be recomputed on the\n     * preceding or following line, respectively.\n     *\n     * @param runIndex the run index\n     * @param runStart the start of the run\n     * @param runLimit the limit of the run\n     * @param runIsRtl true if the run is right-to-left\n     * @param offset the offset\n     * @param after true if the new offset should logically follow the provided\n     * offset\n     * @return the new offset\n     */\n    private getOffsetBeforeAfter(runIndex:number, runStart:number, runLimit:number, runIsRtl:boolean, offset:number, after:boolean):number  {\n        if (runIndex < 0 || offset == (after ? this.mLen : 0)) {\n            // return accurate values.  These are a guess.\n            if (after) {\n                return TextUtils.getOffsetAfter(this.mText, offset + this.mStart) - this.mStart;\n            }\n            return TextUtils.getOffsetBefore(this.mText, offset + this.mStart) - this.mStart;\n        }\n        let wp:TextPaint = this.mWorkPaint;\n        wp.set(this.mPaint);\n        let spanStart:number = runStart;\n        let spanLimit:number;\n        if (this.mSpanned == null) {\n            spanLimit = runLimit;\n        } else {\n            let target:number = after ? offset + 1 : offset;\n            let limit:number = this.mStart + runLimit;\n            while (true) {\n                spanLimit = this.mSpanned.nextSpanTransition(this.mStart + spanStart, limit, MetricAffectingSpan.type) - this.mStart;\n                if (spanLimit >= target) {\n                    break;\n                }\n                spanStart = spanLimit;\n            }\n            let spans:MetricAffectingSpan[] = this.mSpanned.getSpans<MetricAffectingSpan>(this.mStart + spanStart, this.mStart + spanLimit, MetricAffectingSpan.type);\n            spans = TextUtils.removeEmptySpans(spans, this.mSpanned, MetricAffectingSpan.type);\n            if (spans.length > 0) {\n                let replacement:ReplacementSpan = null;\n                for (let j:number = 0; j < spans.length; j++) {\n                    let span:MetricAffectingSpan = spans[j];\n                    if (span instanceof ReplacementSpan) {\n                        replacement = <ReplacementSpan> span;\n                    } else {\n                        span.updateMeasureState(wp);\n                    }\n                }\n                if (replacement != null) {\n                    // the start or end of this span.\n                    return after ? spanLimit : spanStart;\n                }\n            }\n        }\n        let flags:number = runIsRtl ? Paint.DIRECTION_RTL : Paint.DIRECTION_LTR;\n        let cursorOpt:number = after ? Paint.CURSOR_AFTER : Paint.CURSOR_BEFORE;\n        if (this.mCharsValid) {\n            return wp.getTextRunCursor_len(this.mChars.toString(), spanStart, spanLimit - spanStart, flags, offset, cursorOpt);\n        } else {\n            return wp.getTextRunCursor_end(this.mText.toString(), this.mStart + spanStart, this.mStart + spanLimit, flags, this.mStart + offset, cursorOpt) - this.mStart;\n        }\n    }\n\n    /**\n     * @param wp\n     */\n    private static expandMetricsFromPaint(fmi:FontMetricsInt, wp:TextPaint):void  {\n        const previousTop:number = fmi.top;\n        const previousAscent:number = fmi.ascent;\n        const previousDescent:number = fmi.descent;\n        const previousBottom:number = fmi.bottom;\n        const previousLeading:number = fmi.leading;\n        wp.getFontMetricsInt(fmi);\n        TextLine.updateMetrics(fmi, previousTop, previousAscent, previousDescent, previousBottom, previousLeading);\n    }\n\n    static updateMetrics(fmi:FontMetricsInt, previousTop:number, previousAscent:number, previousDescent:number, previousBottom:number, previousLeading:number):void  {\n        fmi.top = Math.min(fmi.top, previousTop);\n        fmi.ascent = Math.min(fmi.ascent, previousAscent);\n        fmi.descent = Math.max(fmi.descent, previousDescent);\n        fmi.bottom = Math.max(fmi.bottom, previousBottom);\n        fmi.leading = Math.max(fmi.leading, previousLeading);\n    }\n\n    /**\n     * Utility function for measuring and rendering text.  The text must\n     * not include a tab or emoji.\n     *\n     * @param wp the working paint\n     * @param start the start of the text\n     * @param end the end of the text\n     * @param runIsRtl true if the run is right-to-left\n     * @param c the canvas, can be null if rendering is not needed\n     * @param x the edge of the run closest to the leading margin\n     * @param top the top of the line\n     * @param y the baseline\n     * @param bottom the bottom of the line\n     * @param fmi receives metrics information, can be null\n     * @param needWidth true if the width of the run is needed\n     * @return the signed width of the run based on the run direction; only\n     * valid if needWidth is true\n     */\n    private handleText(wp:TextPaint, start:number, end:number, contextStart:number, contextEnd:number, runIsRtl:boolean, c:Canvas, x:number, top:number, y:number, bottom:number, fmi:FontMetricsInt, needWidth:boolean):number  {\n        // Get metrics first (even for empty strings or \"0\" width runs)\n        if (fmi != null) {\n            TextLine.expandMetricsFromPaint(fmi, wp);\n        }\n        let runLen:number = end - start;\n        // No need to do anything if the run width is \"0\"\n        if (runLen == 0) {\n            return 0;\n        }\n        let ret:number = 0;\n        let contextLen:number = contextEnd - contextStart;\n        if (needWidth || (c != null && (wp.bgColor != 0 || wp.underlineColor != 0 || runIsRtl))) {\n            let flags:number = runIsRtl ? Paint.DIRECTION_RTL : Paint.DIRECTION_LTR;\n            if (this.mCharsValid) {\n                ret = wp.getTextRunAdvances_count(this.mChars.toString(), start, runLen, contextStart, contextLen, flags, null, 0);\n            } else {\n                let delta:number = this.mStart;\n                ret = wp.getTextRunAdvances_end(this.mText.toString(), delta + start, delta + end, delta + contextStart, delta + contextEnd, flags, null, 0);\n            }\n        }\n        if (c != null) {\n            if (runIsRtl) {\n                x -= ret;\n            }\n            if (wp.bgColor != 0) {\n                let previousColor:number = wp.getColor();\n                let previousStyle:Paint.Style = wp.getStyle();\n                wp.setColor(wp.bgColor);\n                wp.setStyle(Paint.Style.FILL);\n                c.drawRect(x, top, x + ret, bottom, wp);\n                wp.setStyle(previousStyle);\n                wp.setColor(previousColor);\n            }\n            if (wp.underlineColor != 0) {\n                // kStdUnderline_Offset = 1/9, defined in SkTextFormatParams.h\n                let underlineTop:number = y + wp.baselineShift + (1.0 / 9.0) * wp.getTextSize();\n                let previousColor:number = wp.getColor();\n                let previousStyle:Paint.Style = wp.getStyle();\n                let previousAntiAlias:boolean = wp.isAntiAlias();\n                wp.setStyle(Paint.Style.FILL);\n                wp.setAntiAlias(true);\n                wp.setColor(wp.underlineColor);\n                c.drawRect(x, underlineTop, x + ret, underlineTop + wp.underlineThickness, wp);\n                wp.setStyle(previousStyle);\n                wp.setColor(previousColor);\n                wp.setAntiAlias(previousAntiAlias);\n            }\n            this.drawTextRun(c, wp, start, end, contextStart, contextEnd, runIsRtl, x, y + wp.baselineShift);\n        }\n        return runIsRtl ? -ret : ret;\n    }\n\n    /**\n     * Utility function for measuring and rendering a replacement.\n     *\n     *\n     * @param replacement the replacement\n     * @param wp the work paint\n     * @param start the start of the run\n     * @param limit the limit of the run\n     * @param runIsRtl true if the run is right-to-left\n     * @param c the canvas, can be null if not rendering\n     * @param x the edge of the replacement closest to the leading margin\n     * @param top the top of the line\n     * @param y the baseline\n     * @param bottom the bottom of the line\n     * @param fmi receives metrics information, can be null\n     * @param needWidth true if the width of the replacement is needed\n     * @return the signed width of the run based on the run direction; only\n     * valid if needWidth is true\n     */\n    private handleReplacement(replacement:ReplacementSpan, wp:TextPaint, start:number, limit:number, runIsRtl:boolean, c:Canvas, x:number, top:number, y:number, bottom:number, fmi:FontMetricsInt, needWidth:boolean):number  {\n        let ret:number = 0;\n        let textStart:number = this.mStart + start;\n        let textLimit:number = this.mStart + limit;\n        if (needWidth || (c != null && runIsRtl)) {\n            let previousTop:number = 0;\n            let previousAscent:number = 0;\n            let previousDescent:number = 0;\n            let previousBottom:number = 0;\n            let previousLeading:number = 0;\n            let needUpdateMetrics:boolean = (fmi != null);\n            if (needUpdateMetrics) {\n                previousTop = fmi.top;\n                previousAscent = fmi.ascent;\n                previousDescent = fmi.descent;\n                previousBottom = fmi.bottom;\n                previousLeading = fmi.leading;\n            }\n            ret = replacement.getSize(wp, this.mText, textStart, textLimit, fmi);\n            if (needUpdateMetrics) {\n                TextLine.updateMetrics(fmi, previousTop, previousAscent, previousDescent, previousBottom, previousLeading);\n            }\n        }\n        if (c != null) {\n            if (runIsRtl) {\n                x -= ret;\n            }\n            replacement.draw(c, this.mText, textStart, textLimit, x, top, y, bottom, wp);\n        }\n        return runIsRtl ? -ret : ret;\n    }\n\n    /**\n     * Utility function for handling a unidirectional run.  The run must not\n     * contain tabs or emoji but can contain styles.\n     *\n     *\n     * @param start the line-relative start of the run\n     * @param measureLimit the offset to measure to, between start and limit inclusive\n     * @param limit the limit of the run\n     * @param runIsRtl true if the run is right-to-left\n     * @param c the canvas, can be null\n     * @param x the end of the run closest to the leading margin\n     * @param top the top of the line\n     * @param y the baseline\n     * @param bottom the bottom of the line\n     * @param fmi receives metrics information, can be null\n     * @param needWidth true if the width is required\n     * @return the signed width of the run based on the run direction; only\n     * valid if needWidth is true\n     */\n    private handleRun(start:number, measureLimit:number, limit:number, runIsRtl:boolean, c:Canvas, x:number, top:number, y:number, bottom:number, fmi:FontMetricsInt, needWidth:boolean):number  {\n        // Case of an empty line, make sure we update fmi according to mPaint\n        if (start == measureLimit) {\n            let wp:TextPaint = this.mWorkPaint;\n            wp.set(this.mPaint);\n            if (fmi != null) {\n                TextLine.expandMetricsFromPaint(fmi, wp);\n            }\n            return 0;\n        }\n        if (this.mSpanned == null) {\n            let wp:TextPaint = this.mWorkPaint;\n            wp.set(this.mPaint);\n            const mlimit:number = measureLimit;\n            return this.handleText(wp, start, mlimit, start, limit, runIsRtl, c, x, top, y, bottom, fmi, needWidth || mlimit < measureLimit);\n        }\n        this.mMetricAffectingSpanSpanSet.init(this.mSpanned, this.mStart + start, this.mStart + limit);\n        this.mCharacterStyleSpanSet.init(this.mSpanned, this.mStart + start, this.mStart + limit);\n        // Shaping needs to take into account context up to metric boundaries,\n        // but rendering needs to take into account character style boundaries.\n        // So we iterate through metric runs to get metric bounds,\n        // then within each metric run iterate through character style runs\n        // for the run bounds.\n        const originalX:number = x;\n        for (let i:number = start, inext:number; i < measureLimit; i = inext) {\n            let wp:TextPaint = this.mWorkPaint;\n            wp.set(this.mPaint);\n            inext = this.mMetricAffectingSpanSpanSet.getNextTransition(this.mStart + i, this.mStart + limit) - this.mStart;\n            let mlimit:number = Math.min(inext, measureLimit);\n            let replacement:ReplacementSpan = null;\n            for (let j:number = 0; j < this.mMetricAffectingSpanSpanSet.numberOfSpans; j++) {\n                // empty by construction. This special case in getSpans() explains the >= & <= tests\n                if ((this.mMetricAffectingSpanSpanSet.spanStarts[j] >= this.mStart + mlimit) || (this.mMetricAffectingSpanSpanSet.spanEnds[j] <= this.mStart + i))\n                    continue;\n                let span:MetricAffectingSpan = this.mMetricAffectingSpanSpanSet.spans[j];\n                if (span instanceof ReplacementSpan) {\n                    replacement = <ReplacementSpan> span;\n                } else {\n                    // We might have a replacement that uses the draw\n                    // state, otherwise measure state would suffice.\n                    span.updateDrawState(wp);\n                }\n            }\n            if (replacement != null) {\n                x += this.handleReplacement(replacement, wp, i, mlimit, runIsRtl, c, x, top, y, bottom, fmi, needWidth || mlimit < measureLimit);\n                continue;\n            }\n            for (let j:number = i, jnext:number; j < mlimit; j = jnext) {\n                jnext = this.mCharacterStyleSpanSet.getNextTransition(this.mStart + j, this.mStart + mlimit) - this.mStart;\n                wp.set(this.mPaint);\n                for (let k:number = 0; k < this.mCharacterStyleSpanSet.numberOfSpans; k++) {\n                    // Intentionally using >= and <= as explained above\n                    if ((this.mCharacterStyleSpanSet.spanStarts[k] >= this.mStart + jnext) || (this.mCharacterStyleSpanSet.spanEnds[k] <= this.mStart + j))\n                        continue;\n                    let span:CharacterStyle = this.mCharacterStyleSpanSet.spans[k];\n                    span.updateDrawState(wp);\n                }\n                x += this.handleText(wp, j, jnext, i, inext, runIsRtl, c, x, top, y, bottom, fmi, needWidth || jnext < measureLimit);\n            }\n        }\n        return x - originalX;\n    }\n\n    /**\n     * Render a text run with the set-up paint.\n     *\n     * @param c the canvas\n     * @param wp the paint used to render the text\n     * @param start the start of the run\n     * @param end the end of the run\n     * @param contextStart the start of context for the run\n     * @param contextEnd the end of the context for the run\n     * @param runIsRtl true if the run is right-to-left\n     * @param x the x position of the left edge of the run\n     * @param y the baseline of the run\n     */\n    private drawTextRun(c:Canvas, wp:TextPaint, start:number, end:number, contextStart:number, contextEnd:number, runIsRtl:boolean, x:number, y:number):void  {\n        let flags:number = runIsRtl ? Canvas.DIRECTION_RTL : Canvas.DIRECTION_LTR;\n        if (this.mCharsValid) {\n            let count:number = end - start;\n            let contextCount:number = contextEnd - contextStart;\n            c.drawTextRun_count(this.mChars.toString(), start, count, contextStart, contextCount, x, y, flags, wp);\n        } else {\n            let delta:number = this.mStart;\n            c.drawTextRun_end(this.mText.toString(), delta + start, delta + end, delta + contextStart, delta + contextEnd, x, y, flags, wp);\n        }\n    }\n\n    /**\n     * Returns the ascent of the text at start.  This is used for scaling\n     * emoji.\n     *\n     * @param pos the line-relative position\n     * @return the ascent of the text at start\n     */\n    ascent(pos:number):number  {\n        if (this.mSpanned == null) {\n            return this.mPaint.ascent();\n        }\n        pos += this.mStart;\n        let spans:MetricAffectingSpan[] = this.mSpanned.getSpans<MetricAffectingSpan>(pos, pos + 1, MetricAffectingSpan.type);\n        if (spans.length == 0) {\n            return this.mPaint.ascent();\n        }\n        let wp:TextPaint = this.mWorkPaint;\n        wp.set(this.mPaint);\n        for (let span of spans) {\n            span.updateMeasureState(wp);\n        }\n        return wp.ascent();\n    }\n\n    /**\n     * Returns the next tab position.\n     *\n     * @param h the (unsigned) offset from the leading margin\n     * @return the (unsigned) tab position after this offset\n     */\n    nextTab(h:number):number  {\n        if (this.mTabs != null) {\n            return this.mTabs.nextTab(h);\n        }\n        return Layout.TabStops.nextDefaultStop(h, TextLine.TAB_INCREMENT);\n    }\n\n    private static TAB_INCREMENT:number = 20;\n}\n}"
  },
  {
    "path": "src/android/text/TextPaint.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n///<reference path=\"../graphics/Paint.ts\"/>\n\nmodule android.text{\n\n    /**\n     * TextPaint is an extension of Paint that leaves room for some extra\n     * data used during text measuring and drawing.\n     */\n    export class TextPaint extends android.graphics.Paint{\n        baselineShift = 0;\n        // Special value 0 means no background paint\n        bgColor = 0;\n        linkColor:number = 0;\n\n        /**\n         * Special value 0 means no custom underline\n         * @hide\n         */\n        underlineColor = 0;\n        /**\n         * Defined as a multiplier of the default underline thickness. Use 1.0f for default thickness.\n         * @hide\n         */\n        underlineThickness:number = 0;\n\n\n        /**\n         * Copy the fields from tp into this TextPaint, including the\n         * fields inherited from Paint.\n         */\n        set(tp:TextPaint):void  {\n            super.set(tp);\n            this.bgColor = tp.bgColor;\n            this.baselineShift = tp.baselineShift;\n            this.linkColor = tp.linkColor;\n            //this.drawableState = tp.drawableState;\n            //this.density = tp.density;\n            this.underlineColor = tp.underlineColor;\n            this.underlineThickness = tp.underlineThickness;\n        }\n\n        /**\n         * Defines a custom underline for this Paint.\n         * @param color underline solid color\n         * @param thickness underline thickness\n         * @hide\n         */\n        setUnderlineText(color:number, thickness:number):void  {\n            this.underlineColor = color;\n            this.underlineThickness = thickness;\n        }\n    }\n}"
  },
  {
    "path": "src/android/text/TextUtils.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"Spanned.ts\"/>\n///<reference path=\"style/ReplacementSpan.ts\"/>\n///<reference path=\"../../java/lang/System.ts\"/>\n///<reference path=\"../../java/lang/StringBuilder.ts\"/>\n///<reference path=\"../../android/text/MeasuredText.ts\"/>\n///<reference path=\"../../android/text/Spanned.ts\"/>\n///<reference path=\"../../android/text/style/MetricAffectingSpan.ts\"/>\n///<reference path=\"../../android/text/TextDirectionHeuristic.ts\"/>\n///<reference path=\"../../android/text/TextDirectionHeuristics.ts\"/>\n///<reference path=\"../../android/text/TextPaint.ts\"/>\n\n\nmodule android.text{\n    import System = java.lang.System;\n    import StringBuilder = java.lang.StringBuilder;\n    import MeasuredText = android.text.MeasuredText;\n    import Spanned = android.text.Spanned;\n    import TextDirectionHeuristic = android.text.TextDirectionHeuristic;\n    import TextDirectionHeuristics = android.text.TextDirectionHeuristics;\n    import TextPaint = android.text.TextPaint;\n\n    export class TextUtils{\n\n        /**\n         * Returns true if the string is null or 0-length.\n         * @param str the string to be examined\n         * @return true if str is null or zero length\n         */\n        static isEmpty(str:string|String):boolean  {\n            if (str == null || str.length == 0)\n                return true;\n            else\n                return false;\n        }\n\n\n        /** @hide */\n        static ALIGNMENT_SPAN:number = 1;\n\n        /** @hide */\n        static FIRST_SPAN:number = TextUtils.ALIGNMENT_SPAN;\n\n        /** @hide */\n        static FOREGROUND_COLOR_SPAN:number = 2;\n\n        /** @hide */\n        static RELATIVE_SIZE_SPAN:number = 3;\n\n        /** @hide */\n        static SCALE_X_SPAN:number = 4;\n\n        /** @hide */\n        static STRIKETHROUGH_SPAN:number = 5;\n\n        /** @hide */\n        static UNDERLINE_SPAN:number = 6;\n\n        /** @hide */\n        static STYLE_SPAN:number = 7;\n\n        /** @hide */\n        static BULLET_SPAN:number = 8;\n\n        /** @hide */\n        static QUOTE_SPAN:number = 9;\n\n        /** @hide */\n        static LEADING_MARGIN_SPAN:number = 10;\n\n        /** @hide */\n        static URL_SPAN:number = 11;\n\n        /** @hide */\n        static BACKGROUND_COLOR_SPAN:number = 12;\n\n        /** @hide */\n        static TYPEFACE_SPAN:number = 13;\n\n        /** @hide */\n        static SUPERSCRIPT_SPAN:number = 14;\n\n        /** @hide */\n        static SUBSCRIPT_SPAN:number = 15;\n\n        /** @hide */\n        static ABSOLUTE_SIZE_SPAN:number = 16;\n\n        /** @hide */\n        static TEXT_APPEARANCE_SPAN:number = 17;\n\n        /** @hide */\n        static ANNOTATION:number = 18;\n\n        /** @hide */\n        static SUGGESTION_SPAN:number = 19;\n\n        /** @hide */\n        static SPELL_CHECK_SPAN:number = 20;\n\n        /** @hide */\n        static SUGGESTION_RANGE_SPAN:number = 21;\n\n        /** @hide */\n        static EASY_EDIT_SPAN:number = 22;\n\n        /** @hide */\n        static LOCALE_SPAN:number = 23;\n\n        /** @hide */\n        static LAST_SPAN:number = TextUtils.LOCALE_SPAN;\n\n\n        private static EMPTY_STRING_ARRAY:string[] =  [];\n\n        private static ZWNBS_CHAR = String.fromCodePoint(20);\n\n        private static ARAB_SCRIPT_SUBTAG:string = \"Arab\";\n\n        private static HEBR_SCRIPT_SUBTAG:string = \"Hebr\";\n\n\n        static getOffsetBefore(text:String, offset:number):number  {\n            if (offset == 0)\n                return 0;\n            if (offset == 1)\n                return 0;\n            let c = text.codePointAt(offset - 1);\n            if (c >= '?'.codePointAt(0) && c <= '?'.codePointAt(0)) {\n                let c1 = text.codePointAt(offset - 2);\n                if (c1 >= '?'.codePointAt(0) && c1 <= '?'.codePointAt(0))\n                    offset -= 2;\n                else\n                    offset -= 1;\n            } else {\n                offset -= 1;\n            }\n            if (Spanned.isImplements(text)) {\n                let spans:android.text.style.ReplacementSpan[] = (<Spanned> text).getSpans<android.text.style.ReplacementSpan>(offset, offset, android.text.style.ReplacementSpan.type);\n                for (let i:number = 0; i < spans.length; i++) {\n                    let start:number = (<Spanned> text).getSpanStart(spans[i]);\n                    let end:number = (<Spanned> text).getSpanEnd(spans[i]);\n                    if (start < offset && end > offset)\n                        offset = start;\n                }\n            }\n            return offset;\n        }\n\n        static getOffsetAfter(text:String, offset:number):number  {\n            let len:number = text.length;\n            if (offset == len)\n                return len;\n            if (offset == len - 1)\n                return len;\n            let c = text.codePointAt(offset);\n            if (c >= '?'.codePointAt(0) && c <= '?'.codePointAt(0)) {\n                let c1 = text.codePointAt(offset + 1);\n                if (c1 >= '?'.codePointAt(0) && c1 <= '?'.codePointAt(0))\n                    offset += 2;\n                else\n                    offset += 1;\n            } else {\n                offset += 1;\n            }\n            if (Spanned.isImplements(text)) {\n                let spans:android.text.style.ReplacementSpan[] = (<Spanned> text).getSpans<android.text.style.ReplacementSpan>(offset, offset, android.text.style.ReplacementSpan.type);\n                for (let i:number = 0; i < spans.length; i++) {\n                    let start:number = (<Spanned> text).getSpanStart(spans[i]);\n                    let end:number = (<Spanned> text).getSpanEnd(spans[i]);\n                    if (start < offset && end > offset)\n                        offset = end;\n                }\n            }\n            return offset;\n        }\n\n\n        /**\n         * Returns the original text if it fits in the specified width\n         * given the properties of the specified Paint,\n         * or, if it does not fit, a copy with ellipsis character added\n         * at the specified edge or center.\n         * If <code>preserveLength</code> is specified, the returned copy\n         * will be padded with zero-width spaces to preserve the original\n         * length and offsets instead of truncating.\n         * If <code>callback</code> is non-null, it will be called to\n         * report the start and end of the ellipsized range.\n         *\n         * @hide\n         */\n        static ellipsize(text:String, paint:TextPaint, avail:number, where:TextUtils.TruncateAt, preserveLength=false,\n                         callback:TextUtils.EllipsizeCallback=null, textDir=TextDirectionHeuristics.FIRSTSTRONG_LTR,\n                         ellipsis = undefined):String  {\n            ellipsis = ellipsis || (where == TextUtils.TruncateAt.END_SMALL? android.text.Layout.ELLIPSIS_TWO_DOTS[0] : android.text.Layout.ELLIPSIS_NORMAL[0]);\n            let len:number = text.length;\n            let mt:MeasuredText = MeasuredText.obtain();\n            try {\n                let width:number = TextUtils.setPara(mt, paint, text, 0, text.length, textDir);\n                if (width <= avail) {\n                    if (callback != null) {\n                        callback.ellipsized(0, 0);\n                    }\n                    return text;\n                }\n                // XXX assumes ellipsis string does not require shaping and\n                // is unaffected by style\n                let ellipsiswid:number = paint.measureText(ellipsis);\n                avail -= ellipsiswid;\n                let left:number = 0;\n                let right:number = len;\n                if (avail < 0) {\n                    // it all goes\n                } else if (where == TextUtils.TruncateAt.START) {\n                    right = len - mt.breakText(len, false, avail);\n                } else if (where == TextUtils.TruncateAt.END || where == TextUtils.TruncateAt.END_SMALL) {\n                    left = mt.breakText(len, true, avail);\n                } else {\n                    right = len - mt.breakText(len, false, avail / 2);\n                    avail -= mt.measure(right, len);\n                    left = mt.breakText(right, true, avail);\n                }\n                if (callback != null) {\n                    callback.ellipsized(left, right);\n                }\n                let buf:string[] = mt.mChars.split('');\n                let sp:Spanned = Spanned.isImplements(text) ? <Spanned> text : null;\n                let remaining:number = len - (right - left);\n                if (preserveLength) {\n                    if (remaining > 0) {\n                        // else eliminate the ellipsis too\n                        buf[left++] = ellipsis.charAt(0);\n                    }\n                    for (let i:number = left; i < right; i++) {\n                        buf[i] = TextUtils.ZWNBS_CHAR;\n                    }\n                    let s:string = buf.join('');\n                    //if (sp == null) {//TODO when span impl\n                        return s;\n                    //}\n                    //let ss:SpannableString = new SpannableString(s);\n                    //TextUtils.copySpansFrom(sp, 0, len, any.class, ss, 0);\n                    //return ss;\n                }\n                if (remaining == 0) {\n                    return \"\";\n                }\n                //if (sp == null) {//TODO when span impl\n                    let sb:StringBuilder = new StringBuilder(remaining + ellipsis.length());\n                    sb.append(buf.join('').substr(0, left));\n                    sb.append(ellipsis);\n                    sb.append(buf.join('').substr(right, len - right));\n                    return sb.toString();\n                //}\n                //let ssb:SpannableStringBuilder = new SpannableStringBuilder();\n                //ssb.append(text, 0, left);\n                //ssb.append(ellipsis);\n                //ssb.append(text, right, len);\n                //return ssb;\n            } finally {\n                MeasuredText.recycle(mt);\n            }\n        }\n\n\n        private static setPara(mt:MeasuredText, paint:TextPaint, text:String, start:number, end:number, textDir:TextDirectionHeuristic):number  {\n            mt.setPara(text, start, end, textDir);\n            let width:number;\n            let sp:Spanned = Spanned.isImplements(text) ? <Spanned> text : null;\n            let len:number = end - start;\n            if (sp == null) {\n                width = mt.addStyleRun(paint, len, null);\n            } else {\n                width = 0;\n                let spanEnd:number;\n                for (let spanStart:number = 0; spanStart < len; spanStart = spanEnd) {\n                    spanEnd = sp.nextSpanTransition(spanStart, len, android.text.style.MetricAffectingSpan.type);\n                    let spans:android.text.style.MetricAffectingSpan[] = sp.getSpans<android.text.style.MetricAffectingSpan>(spanStart, spanEnd, android.text.style.MetricAffectingSpan.type);\n                    spans = TextUtils.removeEmptySpans(spans, sp, android.text.style.MetricAffectingSpan.type);\n                    width += mt.addStyleRun(paint, spans, spanEnd - spanStart, null);\n                }\n            }\n            return width;\n        }\n\n        /**\n         * Removes empty spans from the <code>spans</code> array.\n         *\n         * When parsing a Spanned using {@link Spanned#nextSpanTransition(int, int, Class)}, empty spans\n         * will (correctly) create span transitions, and calling getSpans on a slice of text bounded by\n         * one of these transitions will (correctly) include the empty overlapping span.\n         *\n         * However, these empty spans should not be taken into account when layouting or rendering the\n         * string and this method provides a way to filter getSpans' results accordingly.\n         *\n         * @param spans A list of spans retrieved using {@link Spanned#getSpans(int, int, Class)} from\n         * the <code>spanned</code>\n         * @param spanned The Spanned from which spans were extracted\n         * @return A subset of spans where empty spans ({@link Spanned#getSpanStart(Object)}  ==\n         * {@link Spanned#getSpanEnd(Object)} have been removed. The initial order is preserved\n         * @hide\n         */\n        static removeEmptySpans<T> (spans:T[], spanned:Spanned, klass:any):T[]  {\n            let copy:T[] = null;\n            let count:number = 0;\n            for (let i:number = 0; i < spans.length; i++) {\n                const span:T = spans[i];\n                const start:number = spanned.getSpanStart(span);\n                const end:number = spanned.getSpanEnd(span);\n                if (start == end) {\n                    if (copy == null) {\n                        copy = new Array<T>(spans.length - 1);\n                        System.arraycopy(spans, 0, copy, 0, i);\n                        count = i;\n                    }\n                } else {\n                    if (copy != null) {\n                        copy[count] = span;\n                        count++;\n                    }\n                }\n            }\n            if (copy != null) {\n                let result:T[] = new Array<T>(count);\n                System.arraycopy(copy, 0, result, 0, count);\n                return result;\n            } else {\n                return spans;\n            }\n        }\n\n        /**\n         * pack to a array, because javascript will do '<<' as int range\n         * (Pack 2 int values into a long, useful as a return value for a range)\n         * @see #unpackRangeStartFromLong(long)\n         * @see #unpackRangeEndFromLong(long)\n         * @hide\n         */\n        static packRangeInLong(start:number, end:number):number[]  {\n            return [start, end];\n        }\n\n        /**\n         * Get the start value from a range packed in a long by {@link #packRangeInLong(int, int)}\n         * @see #unpackRangeEndFromLong(long)\n         * @see #packRangeInLong(int, int)\n         * @hide\n         */\n        static unpackRangeStartFromLong(range:number[]):number  {\n            return range[0] || 0;\n        }\n\n        /**\n         * Get the end value from a range packed in a long by {@link #packRangeInLong(int, int)}\n         * @see #unpackRangeStartFromLong(long)\n         * @see #packRangeInLong(int, int)\n         * @hide\n         */\n        static unpackRangeEndFromLong(range:number[]):number  {\n            return range[1] || 0;\n        }\n    }\n\n    export module TextUtils{\n\n        export enum TruncateAt {\n\n            START /*() {\n             }\n             */, MIDDLE /*() {\n             }\n             */, END /*() {\n             }\n             */, MARQUEE /*() {\n             }\n             */, /**\n             * @hide\n             */\n            END_SMALL /*() {\n         }\n         */ /*;\n         */}\n\n\n        export interface EllipsizeCallback {\n\n            /**\n             * This method is called to report that the specified region of\n             * text was ellipsized away by a call to {@link #ellipsize}.\n             */\n            ellipsized(start:number, end:number):void ;\n        }\n    }\n}"
  },
  {
    "path": "src/android/text/TextWatcher.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\nmodule android.text {\n/**\n * When an object of a type is attached to an Editable, its methods will\n * be called when the text is changed.\n */\nexport interface TextWatcher {\n\n    /**\n     * This method is called to notify you that, within <code>s</code>,\n     * the <code>count</code> characters beginning at <code>start</code>\n     * are about to be replaced by new text with length <code>after</code>.\n     * It is an error to attempt to make changes to <code>s</code> from\n     * this callback.\n     */\n    beforeTextChanged(s:String, start:number, count:number, after:number):void ;\n\n    /**\n     * This method is called to notify you that, within <code>s</code>,\n     * the <code>count</code> characters beginning at <code>start</code>\n     * have just replaced old text that had length <code>before</code>.\n     * It is an error to attempt to make changes to <code>s</code> from\n     * this callback.\n     */\n    onTextChanged(s:String, start:number, before:number, count:number):void ;\n\n    /**\n     * This method is called to notify you that, somewhere within\n     * <code>s</code>, the text has been changed.\n     * It is legitimate to make further changes to <code>s</code> from\n     * this callback, but be careful not to get yourself into an infinite\n     * loop, because any changes you make will cause this method to be\n     * called again recursively.\n     * (You are not told where the change took place because other\n     * afterTextChanged() methods may already have made other changes\n     * and invalidated the offsets.  But if you need to know here,\n     * you can use {@link Spannable#setSpan} in {@link #onTextChanged}\n     * to mark your place and then look up from here where the span\n     * ended up.\n     */\n    afterTextChanged(s:String):void ;//Editable\n}\n}"
  },
  {
    "path": "src/android/text/method/AllCapsTransformationMethod.ts",
    "content": "/*\n * Copyright (C) 2011 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../../android/util/Log.ts\"/>\n///<reference path=\"../../../android/view/View.ts\"/>\n///<reference path=\"../../../android/text/method/TransformationMethod.ts\"/>\n///<reference path=\"../../../android/text/method/TransformationMethod2.ts\"/>\n\nmodule android.text.method {\nimport Rect = android.graphics.Rect;\nimport Log = android.util.Log;\nimport View = android.view.View;\nimport TransformationMethod = android.text.method.TransformationMethod;\nimport TransformationMethod2 = android.text.method.TransformationMethod2;\n/**\n * Transforms source text into an ALL CAPS string, locale-aware.\n *\n * @hide\n */\nexport class AllCapsTransformationMethod implements TransformationMethod2 {\n\n    private static TAG:string = \"AllCapsTransformationMethod\";\n\n    private mEnabled:boolean;\n\n\n    constructor(context?:any) {\n    }\n\n    getTransformation(source:String, view:View):String  {\n        if (this.mEnabled) {\n            return source != null ? source.toLocaleUpperCase() : null;\n        }\n        Log.w(AllCapsTransformationMethod.TAG, \"Caller did not enable length changes; not transforming text\");\n        return source;\n    }\n\n    onFocusChanged(view:View, sourceText:String, focused:boolean, direction:number, previouslyFocusedRect:Rect):void  {\n    }\n\n    setLengthChangesAllowed(allowLengthChanges:boolean):void  {\n        this.mEnabled = allowLengthChanges;\n    }\n}\n}"
  },
  {
    "path": "src/android/text/method/MovementMethod.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/widget/TextView.ts\"/>\n///<reference path=\"../../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../../android/text/Spannable.ts\"/>\n\nmodule android.text.method {\nimport TextView = android.widget.TextView;\nimport KeyEvent = android.view.KeyEvent;\nimport MotionEvent = android.view.MotionEvent;\nimport Spannable = android.text.Spannable;\n/**\n * Provides cursor positioning, scrolling and text selection functionality in a {@link TextView}.\n * <p>\n * The {@link TextView} delegates handling of key events, trackball motions and touches to\n * the movement method for purposes of content navigation.  The framework automatically\n * selects an appropriate movement method based on the content of the {@link TextView}.\n * </p><p>\n * This interface is intended for use by the framework; it should not be implemented\n * directly by applications.\n * </p>\n */\nexport interface MovementMethod {\n\n    initialize(widget:TextView, text:Spannable):void ;\n\n    onKeyDown(widget:TextView, text:Spannable, keyCode:number, event:KeyEvent):boolean ;\n\n    onKeyUp(widget:TextView, text:Spannable, keyCode:number, event:KeyEvent):boolean ;\n\n    /**\n     * If the key listener wants to other kinds of key events, return true,\n     * otherwise return false and the caller (i.e. the widget host)\n     * will handle the key.\n     */\n    onKeyOther(view:TextView, text:Spannable, event:KeyEvent):boolean ;\n\n    onTakeFocus(widget:TextView, text:Spannable, direction:number):void ;\n\n    onTrackballEvent(widget:TextView, text:Spannable, event:MotionEvent):boolean ;\n\n    onTouchEvent(widget:TextView, text:Spannable, event:MotionEvent):boolean ;\n\n    onGenericMotionEvent(widget:TextView, text:Spannable, event:MotionEvent):boolean ;\n\n    /**\n     * Returns true if this movement method allows arbitrary selection\n     * of any text; false if it has no selection (like a movement method\n     * that only scrolls) or a constrained selection (for example\n     * limited to links.  The \"Select All\" menu item is disabled\n     * if arbitrary selection is not allowed.\n     */\n    canSelectArbitrarily():boolean ;\n}\n}"
  },
  {
    "path": "src/android/text/method/PasswordTransformationMethod.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"SingleLineTransformationMethod.ts\"/>\n\nmodule android.text.method {\n    export class PasswordTransformationMethod extends SingleLineTransformationMethod {\n        private static instance:PasswordTransformationMethod;\n\n        getTransformation(source:String, v:android.view.View):String {\n            let transform = super.getTransformation(source, v);\n            if(transform) transform = new Array(transform.length+1).join('•');\n            return transform;\n        }\n\n        static getInstance():PasswordTransformationMethod  {\n            if (PasswordTransformationMethod.instance != null) return PasswordTransformationMethod.instance;\n            PasswordTransformationMethod.instance = new PasswordTransformationMethod();\n            return PasswordTransformationMethod.instance;\n        }\n    }\n}"
  },
  {
    "path": "src/android/text/method/ReplacementTransformationMethod.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../../android/text/Spannable.ts\"/>\n///<reference path=\"../../../android/text/Spanned.ts\"/>\n///<reference path=\"../../../android/text/TextUtils.ts\"/>\n///<reference path=\"../../../android/view/View.ts\"/>\n///<reference path=\"../../../android/text/method/TransformationMethod.ts\"/>\n\nmodule android.text.method {\nimport Rect = android.graphics.Rect;\nimport Spannable = android.text.Spannable;\nimport Spanned = android.text.Spanned;\nimport TextUtils = android.text.TextUtils;\nimport View = android.view.View;\nimport TransformationMethod = android.text.method.TransformationMethod;\n/**\n * This transformation method causes the characters in the {@link #getOriginal}\n * array to be replaced by the corresponding characters in the\n * {@link #getReplacement} array.\n */\nexport abstract class ReplacementTransformationMethod implements TransformationMethod {\n\n    /**\n     * Returns the list of characters that are to be replaced by other\n     * characters when displayed.\n     */\n    protected abstract getOriginal():string[] ;\n\n    /**\n     * Returns a parallel array of replacement characters for the ones\n     * that are to be replaced.\n     */\n    protected abstract getReplacement():string[] ;\n\n    /**\n     * Returns a CharSequence that will mirror the contents of the\n     * source CharSequence but with the characters in {@link #getOriginal}\n     * replaced by ones from {@link #getReplacement}.\n     */\n    getTransformation(source:String, v:View):String  {\n        let original:string[] = this.getOriginal();\n        let replacement:string[] = this.getReplacement();\n        /*\n         * Short circuit for faster display if the text will never change.\n         */\n        //if (!(source instanceof Editable)) {\n            /*\n             * Check whether the text does not contain any of the\n             * source characters so can be used unchanged.\n             */\n            let doNothing:boolean = true;\n            let n:number = original.length;\n            for (let i:number = 0; i < n; i++) {\n                if (source.indexOf(original[i]) >= 0) {\n                    doNothing = false;\n                    break;\n                }\n            }\n            if (doNothing) {\n                return source;\n            }\n            //if (!(source instanceof Spannable)) {\n                /*\n                 * The text contains some of the source characters,\n                 * but they can be flattened out now instead of\n                 * at display time.\n                 */\n                //if (source instanceof Spanned) {\n                //    return new SpannedString(new ReplacementTransformationMethod.SpannedReplacementCharSequence(<Spanned> source, original, replacement));\n                //} else {\n                    return new ReplacementTransformationMethod.ReplacementCharSequence(source, original, replacement).toString();\n                //}\n            //}\n        //}\n        //if (source instanceof Spanned) {\n        //    return new ReplacementTransformationMethod.SpannedReplacementCharSequence(<Spanned> source, original, replacement);\n        //} else {\n\n            //return new ReplacementTransformationMethod.ReplacementCharSequence(source, original, replacement);\n\n        //}\n    }\n\n    onFocusChanged(view:View, sourceText:String, focused:boolean, direction:number, previouslyFocusedRect:Rect):void  {\n    // This callback isn't used.\n    }\n\n\n\n\n}\n\nexport module ReplacementTransformationMethod{\nexport class ReplacementCharSequence extends String {\n\n    private mOriginal:string[];\n    private mReplacement:string[];\n\n    constructor(source:String, original:string[], replacement:string[]) {\n        super(source);\n        this.mSource = source;\n        this.mOriginal = original;\n        this.mReplacement = replacement;\n    }\n\n    charAt(i:number):string  {\n        let c:string = this.mSource.charAt(i);\n        let n:number = this.mOriginal.length;\n        for (let j:number = 0; j < n; j++) {\n            if (c == this.mOriginal[j]) {\n                c = this.mReplacement[j];\n            }\n        }\n        return c;\n    }\n\n    toString():string  {\n        return this.startReplace(0, this.length);\n    }\n\n\n    substr(from:number, length:number):string {\n        return this.startReplace(from, from+length);\n    }\n\n    substring(start:number, end:number):string {\n        return this.startReplace(start, end);\n    }\n\n    startReplace(start:number, end:number):string  {\n        let dest:string[] = this.mSource.substring(start, end).split('');\n        let offend:number = end - start;\n        let n:number = this.mOriginal.length;\n        for (let i = 0; i < offend; i++) {\n            let c:string = dest[i];\n            for (let j:number = 0; j < n; j++) {\n                if (c == this.mOriginal[j]) {\n                    dest[i] = this.mReplacement[j];\n                }\n            }\n        }\n        return dest.join('');\n    }\n\n    private mSource:String;\n}\n}\n\n}"
  },
  {
    "path": "src/android/text/method/SingleLineTransformationMethod.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../../android/text/Spannable.ts\"/>\n///<reference path=\"../../../android/text/Spanned.ts\"/>\n///<reference path=\"../../../android/text/TextUtils.ts\"/>\n///<reference path=\"../../../android/view/View.ts\"/>\n///<reference path=\"../../../android/text/method/ReplacementTransformationMethod.ts\"/>\n///<reference path=\"../../../android/text/method/TransformationMethod.ts\"/>\n\nmodule android.text.method {\nimport Rect = android.graphics.Rect;\nimport Spannable = android.text.Spannable;\nimport Spanned = android.text.Spanned;\nimport TextUtils = android.text.TextUtils;\nimport View = android.view.View;\nimport ReplacementTransformationMethod = android.text.method.ReplacementTransformationMethod;\nimport TransformationMethod = android.text.method.TransformationMethod;\n/**\n * This transformation method causes any newline characters (\\n) to be\n * displayed as spaces instead of causing line breaks, and causes\n * carriage return characters (\\r) to have no appearance.\n */\nexport class SingleLineTransformationMethod extends ReplacementTransformationMethod {\n\n    private static ORIGINAL:string[] =  [ '\\n', '\\r' ];\n\n    private static REPLACEMENT:string[] =  [ ' ', '﻿' ];\n\n    /**\n     * The characters to be replaced are \\n and \\r.\n     */\n    protected getOriginal():string[]  {\n        return SingleLineTransformationMethod.ORIGINAL;\n    }\n\n    /**\n     * The character \\n is replaced with is space;\n     * the character \\r is replaced with is FEFF (zero width space).\n     */\n    protected getReplacement():string[]  {\n        return SingleLineTransformationMethod.REPLACEMENT;\n    }\n\n    static getInstance():SingleLineTransformationMethod  {\n        if (SingleLineTransformationMethod.sInstance != null)\n            return SingleLineTransformationMethod.sInstance;\n        SingleLineTransformationMethod.sInstance = new SingleLineTransformationMethod();\n        return SingleLineTransformationMethod.sInstance;\n    }\n\n    private static sInstance:SingleLineTransformationMethod;\n}\n}"
  },
  {
    "path": "src/android/text/method/TransformationMethod.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../../android/view/View.ts\"/>\n\nmodule android.text.method {\nimport Rect = android.graphics.Rect;\nimport View = android.view.View;\n/**\n * TextView uses TransformationMethods to do things like replacing the\n * characters of passwords with dots, or keeping the newline characters\n * from causing line breaks in single-line text fields.\n */\nexport interface TransformationMethod {\n\n    /**\n     * Returns a CharSequence that is a transformation of the source text --\n     * for example, replacing each character with a dot in a password field.\n     * Beware that the returned text must be exactly the same length as\n     * the source text, and that if the source text is Editable, the returned\n     * text must mirror it dynamically instead of doing a one-time copy.\n     */\n    getTransformation(source:String, view:View):String ;\n\n    /**\n     * This method is called when the TextView that uses this\n     * TransformationMethod gains or loses focus.\n     */\n    onFocusChanged(view:View, sourceText:String, focused:boolean, direction:number, previouslyFocusedRect:Rect):void ;\n}\n    export module TransformationMethod{\n        export function isImpl(obj):boolean {\n            return obj && obj['getTransformation'] && obj['onFocusChanged'];\n        }\n    }\n}"
  },
  {
    "path": "src/android/text/method/TransformationMethod2.ts",
    "content": "/*\n * Copyright (C) 2011 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/text/method/TransformationMethod.ts\"/>\n\nmodule android.text.method {\n    import TransformationMethod = android.text.method.TransformationMethod;\n    /**\n     * TransformationMethod2 extends the TransformationMethod interface\n     * and adds the ability to relax restrictions of TransformationMethod.\n     *\n     * @hide\n     */\n    export interface TransformationMethod2 extends TransformationMethod {\n\n        /**\n         * Relax the contract of TransformationMethod to allow length changes,\n         * or revert to the length-restricted behavior.\n         *\n         * @param allowLengthChanges true to allow the transformation to change the length\n         *                           of the input string.\n         */\n        setLengthChangesAllowed(allowLengthChanges:boolean):void ;\n    }\n    export module TransformationMethod2 {\n        export function isImpl(obj):boolean {\n            return TransformationMethod.isImpl(obj) && obj['setLengthChangesAllowed'];\n        }\n    }\n}"
  },
  {
    "path": "src/android/text/style/CharacterStyle.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/text/TextPaint.ts\"/>\n///<reference path=\"../../../android/text/style/MetricAffectingSpan.ts\"/>\n///<reference path=\"../../../android/text/style/UpdateAppearance.ts\"/>\n\nmodule android.text.style {\n    import TextPaint = android.text.TextPaint;\n    import MetricAffectingSpan = android.text.style.MetricAffectingSpan;\n    import UpdateAppearance = android.text.style.UpdateAppearance;\n    /**\n     * The classes that affect character-level text formatting extend this\n     * class.  Most extend its subclass {@link MetricAffectingSpan}, but simple\n     * ones may just implement {@link UpdateAppearance}.\n     */\nexport abstract class CharacterStyle {\n        static type = Symbol();\n        mType = CharacterStyle.type;\n\n        abstract updateDrawState(tp:TextPaint):void;\n\n        /**\n         * A given CharacterStyle can only applied to a single region of a given\n         * Spanned.  If you need to attach the same CharacterStyle to multiple\n         * regions, you can use this method to wrap it with a new object that\n         * will have the same effect but be a distinct object so that it can\n         * also be attached without conflict.\n         */\n        static wrap(cs:CharacterStyle):CharacterStyle {\n            if (cs instanceof MetricAffectingSpan) {\n                return new MetricAffectingSpan.Passthrough_MetricAffectingSpan(<MetricAffectingSpan> cs);\n            } else {\n                return new CharacterStyle.Passthrough_CharacterStyle(cs);\n            }\n        }\n\n        /**\n         * Returns \"this\" for most CharacterStyles, but for CharacterStyles\n         * that were generated by {@link #wrap}, returns the underlying\n         * CharacterStyle.\n         */\n        getUnderlying():CharacterStyle {\n            return this;\n        }\n\n\n    }\n\n    export module CharacterStyle {\n        /**\n         * A Passthrough CharacterStyle is one that\n         * passes {@link #updateDrawState} calls through to the\n         * specified CharacterStyle while still being a distinct object,\n         * and is therefore able to be attached to the same Spannable\n         * to which the specified CharacterStyle is already attached.\n         */\n        export class Passthrough_CharacterStyle extends CharacterStyle {\n\n            private mStyle:CharacterStyle;\n\n            /**\n             * Creates a new Passthrough of the specfied CharacterStyle.\n             */\n            constructor(cs:CharacterStyle) {\n                super();\n                this.mStyle = cs;\n            }\n\n            /**\n             * Passes updateDrawState through to the underlying CharacterStyle.\n             */\n            updateDrawState(tp:TextPaint):void {\n                this.mStyle.updateDrawState(tp);\n            }\n\n            /**\n             * Returns the CharacterStyle underlying this one, or the one\n             * underlying it if it too is a Passthrough.\n             */\n            getUnderlying():CharacterStyle {\n                return this.mStyle.getUnderlying();\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "src/android/text/style/LeadingMarginSpan.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../../android/text/Layout.ts\"/>\n///<reference path=\"../../../android/text/TextUtils.ts\"/>\n///<reference path=\"../../../android/text/style/ParagraphStyle.ts\"/>\n///<reference path=\"../../../android/text/style/WrapTogetherSpan.ts\"/>\n\nmodule android.text.style {\n    import Paint = android.graphics.Paint;\n    import Canvas = android.graphics.Canvas;\n    import Layout = android.text.Layout;\n    import TextUtils = android.text.TextUtils;\n    import ParagraphStyle = android.text.style.ParagraphStyle;\n    import WrapTogetherSpan = android.text.style.WrapTogetherSpan;\n    /**\n     * A paragraph style affecting the leading margin. There can be multiple leading\n     * margin spans on a single paragraph; they will be rendered in order, each\n     * adding its margin to the ones before it. The leading margin is on the right\n     * for lines in a right-to-left paragraph.\n     */\n    export interface LeadingMarginSpan extends ParagraphStyle {\n\n        /**\n         * Returns the amount by which to adjust the leading margin. Positive values\n         * move away from the leading edge of the paragraph, negative values move\n         * towards it.\n         *\n         * @param first true if the request is for the first line of a paragraph,\n         * false for subsequent lines\n         * @return the offset for the margin.\n         */\n        getLeadingMargin(first:boolean):number ;\n\n        /**\n         * Renders the leading margin.  This is called before the margin has been\n         * adjusted by the value returned by {@link #getLeadingMargin(boolean)}.\n         *\n         * @param c the canvas\n         * @param p the paint. The this should be left unchanged on exit.\n         * @param x the current position of the margin\n         * @param dir the base direction of the paragraph; if negative, the margin\n         * is to the right of the text, otherwise it is to the left.\n         * @param top the top of the line\n         * @param baseline the baseline of the line\n         * @param bottom the bottom of the line\n         * @param text the text\n         * @param start the start of the line\n         * @param end the end of the line\n         * @param first true if this is the first line of its paragraph\n         * @param layout the layout containing this line\n         */\n        drawLeadingMargin(c:Canvas, p:Paint, x:number, dir:number, top:number, baseline:number, bottom:number, text:String, start:number, end:number, first:boolean, layout:Layout):void ;\n\n    }\n\n    export module LeadingMarginSpan{\n        export function isImpl(obj):boolean {\n            return obj && obj['getLeadingMargin'] && obj['drawLeadingMargin'];\n        }\n        export var type = Symbol();\n\n        /**\n         * An extended version of {@link LeadingMarginSpan}, which allows\n         * the implementor to specify the number of lines of text to which\n         * this object is attached that the \"first line of paragraph\" margin\n         * width will be applied to.\n         */\n        export interface LeadingMarginSpan2 extends LeadingMarginSpan, WrapTogetherSpan {\n\n            /**\n             * Returns the number of lines of text to which this object is\n             * attached that the \"first line\" margin will apply to.\n             * Note that if this returns N, the first N lines of the region,\n             * not the first N lines of each paragraph, will be given the\n             * special margin width.\n             */\n            getLeadingMarginLineCount():number ;\n        }\n        export module LeadingMarginSpan2{\n            export function isImpl(obj):boolean {\n                return obj['getLeadingMarginLineCount'];\n            }\n        }\n\n        /**\n         * The standard implementation of LeadingMarginSpan, which adjusts the\n         * margin but does not do any rendering.\n         */\n        export class Standard implements LeadingMarginSpan {\n\n            private mFirst:number = 0;\n            private mRest:number = 0;\n\n            /**\n             * Constructor taking separate indents for the first and subsequent\n             * lines.\n             *\n             * @param first the indent for the first line of the paragraph\n             * @param rest the indent for the remaining lines of the paragraph\n             */\n            constructor( first:number, rest=first) {\n                this.mFirst = first;\n                this.mRest = rest;\n            }\n\n            getSpanTypeId():number  {\n                return TextUtils.LEADING_MARGIN_SPAN;\n            }\n\n            describeContents():number  {\n                return 0;\n            }\n\n            getLeadingMargin(first:boolean):number  {\n                return first ? this.mFirst : this.mRest;\n            }\n\n            drawLeadingMargin(c:Canvas, p:Paint, x:number, dir:number, top:number, baseline:number, bottom:number, text:String, start:number, end:number, first:boolean, layout:Layout):void  {\n                ;\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "src/android/text/style/LineBackgroundSpan.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../../android/text/style/ParagraphStyle.ts\"/>\n\nmodule android.text.style {\n    import Paint = android.graphics.Paint;\n    import Canvas = android.graphics.Canvas;\n    import ParagraphStyle = android.text.style.ParagraphStyle;\n    export interface LineBackgroundSpan extends ParagraphStyle {\n\n        drawBackground(c:Canvas, p:Paint, left:number, right:number, top:number, baseline:number, bottom:number,\n                       text:String, start:number, end:number, lnum:number):void ;\n    }\n\n    export module LineBackgroundSpan{\n        export var type = Symbol();\n    }\n}"
  },
  {
    "path": "src/android/text/style/LineHeightSpan.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../../android/text/Layout.ts\"/>\n///<reference path=\"../../../android/text/TextPaint.ts\"/>\n///<reference path=\"../../../android/text/style/ParagraphStyle.ts\"/>\n///<reference path=\"../../../android/text/style/WrapTogetherSpan.ts\"/>\n\nmodule android.text.style {\n    import Paint = android.graphics.Paint;\n    import Canvas = android.graphics.Canvas;\n    import Layout = android.text.Layout;\n    import TextPaint = android.text.TextPaint;\n    import ParagraphStyle = android.text.style.ParagraphStyle;\n    import WrapTogetherSpan = android.text.style.WrapTogetherSpan;\n\n    export interface LineHeightSpan extends ParagraphStyle, WrapTogetherSpan {\n        chooseHeight(text:String, start:number, end:number, spanstartv:number, v:number, fm:Paint.FontMetricsInt):void ;\n    }\n\n    export module LineHeightSpan {\n        export var type = Symbol();\n        export interface WithDensity extends LineHeightSpan {\n            chooseHeight(text:String, start:number, end:number, spanstartv:number, v:number, fm:Paint.FontMetricsInt, paint?:TextPaint):void ;\n        }\n    }\n\n}"
  },
  {
    "path": "src/android/text/style/MetricAffectingSpan.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../../android/text/TextPaint.ts\"/>\n///<reference path=\"../../../android/text/style/CharacterStyle.ts\"/>\n///<reference path=\"../../../android/text/style/UpdateLayout.ts\"/>\n\nmodule android.text.style {\n    import Paint = android.graphics.Paint;\n    import TextPaint = android.text.TextPaint;\n    import CharacterStyle = android.text.style.CharacterStyle;\n    import UpdateLayout = android.text.style.UpdateLayout;\n    /**\n     * The classes that affect character-level text formatting in a way that\n     * changes the width or height of characters extend this class.\n     */\nexport abstract class MetricAffectingSpan extends CharacterStyle implements UpdateLayout {\n        static type = Symbol();\n        mType = MetricAffectingSpan.type;\n\n        abstract updateMeasureState(p:TextPaint):void;\n\n        /**\n         * Returns \"this\" for most MetricAffectingSpans, but for\n         * MetricAffectingSpans that were generated by {@link #wrap},\n         * returns the underlying MetricAffectingSpan.\n         */\n        getUnderlying():MetricAffectingSpan {\n            return this;\n        }\n\n\n    }\n\n    export module MetricAffectingSpan {\n        /* package */\n        export class Passthrough_MetricAffectingSpan extends MetricAffectingSpan {\n\n            private mStyle:MetricAffectingSpan;\n\n            /**\n             * Creates a new Passthrough of the specfied MetricAffectingSpan.\n             */\n            constructor(cs:MetricAffectingSpan) {\n                super();\n                this.mStyle = cs;\n            }\n\n            /**\n             * Passes updateDrawState through to the underlying MetricAffectingSpan.\n             */\n            updateDrawState(tp:TextPaint):void {\n                this.mStyle.updateDrawState(tp);\n            }\n\n            /**\n             * Passes updateMeasureState through to the underlying MetricAffectingSpan.\n             */\n            updateMeasureState(tp:TextPaint):void {\n                this.mStyle.updateMeasureState(tp);\n            }\n\n            /**\n             * Returns the MetricAffectingSpan underlying this one, or the one\n             * underlying it if it too is a Passthrough.\n             */\n            getUnderlying():MetricAffectingSpan {\n                return this.mStyle.getUnderlying();\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "src/android/text/style/ParagraphStyle.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\nmodule android.text.style {\n/**\n * The classes that affect paragraph-level text formatting implement\n * this interface.\n */\nexport interface ParagraphStyle {\n}\n    export module ParagraphStyle{\n        export var type = Symbol();\n    }\n}"
  },
  {
    "path": "src/android/text/style/ReplacementSpan.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../../android/text/TextPaint.ts\"/>\n///<reference path=\"../../../android/text/style/MetricAffectingSpan.ts\"/>\n\nmodule android.text.style {\nimport Paint = android.graphics.Paint;\nimport Canvas = android.graphics.Canvas;\nimport TextPaint = android.text.TextPaint;\nimport MetricAffectingSpan = android.text.style.MetricAffectingSpan;\n\nexport abstract class ReplacementSpan extends MetricAffectingSpan {\n    static type = Symbol();\n    mType = ReplacementSpan.type;\n\n    abstract getSize(paint:Paint, text:String, start:number, end:number, fm:Paint.FontMetricsInt):number ;\n\n    abstract draw(canvas:Canvas, text:String, start:number, end:number, x:number, top:number, y:number, bottom:number, paint:Paint):void ;\n\n    /**\n     * This method does nothing, since ReplacementSpans are measured\n     * explicitly instead of affecting Paint properties.\n     */\n    updateMeasureState(p:TextPaint):void  {\n    }\n\n    /**\n     * This method does nothing, since ReplacementSpans are drawn\n     * explicitly instead of affecting Paint properties.\n     */\n    updateDrawState(ds:TextPaint):void  {\n    }\n}\n}"
  },
  {
    "path": "src/android/text/style/TabStopSpan.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/text/style/ParagraphStyle.ts\"/>\n\nmodule android.text.style {\n    import ParagraphStyle = android.text.style.ParagraphStyle;\n    /**\n     * Represents a single tab stop on a line.\n     */\n    export interface TabStopSpan extends ParagraphStyle {\n\n        /**\n         * Returns the offset of the tab stop from the leading margin of the\n         * line.\n         * @return the offset\n         */\n        getTabStop():number ;\n\n\n    }\n\n    export module TabStopSpan {\n        export var type = Symbol();\n        export function isImpl(obj):boolean{\n            return obj && obj['getTabStop'];\n        }\n\n        /**\n         * The default implementation of TabStopSpan.\n         */\n        export class Standard implements TabStopSpan {\n\n            /**\n             * Constructor.\n             *\n             * @param where the offset of the tab stop from the leading margin of\n             *        the line\n             */\n            constructor(where:number) {\n                this.mTab = where;\n            }\n\n            getTabStop():number {\n                return this.mTab;\n            }\n\n            private mTab:number = 0;\n        }\n    }\n\n}"
  },
  {
    "path": "src/android/text/style/UpdateAppearance.ts",
    "content": "/*\n * Copyright (C) 2008 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/text/style/UpdateLayout.ts\"/>\n\nmodule android.text.style {\nimport UpdateLayout = android.text.style.UpdateLayout;\n/**\n * The classes that affect character-level text in a way that modifies their\n * appearance when one is added or removed must implement this interface.  Note\n * that if the class also impacts size or other metrics, it should instead\n * implement {@link UpdateLayout}.\n */\nexport interface UpdateAppearance {\n}\n}"
  },
  {
    "path": "src/android/text/style/UpdateLayout.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/text/style/UpdateAppearance.ts\"/>\n\nmodule android.text.style {\nimport UpdateAppearance = android.text.style.UpdateAppearance;\n/**\n * The classes that affect character-level text formatting in a way that\n * triggers a text layout update when one is added or removed must implement\n * this interface.  This interface also includes {@link UpdateAppearance}\n * since such a change implicitly also impacts the appearance.\n */\nexport interface UpdateLayout extends UpdateAppearance {\n}\n}"
  },
  {
    "path": "src/android/text/style/WrapTogetherSpan.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/text/style/ParagraphStyle.ts\"/>\n\nmodule android.text.style {\nimport ParagraphStyle = android.text.style.ParagraphStyle;\nexport interface WrapTogetherSpan extends ParagraphStyle {\n}\n}"
  },
  {
    "path": "src/android/util/ArrayMap.ts",
    "content": "/**\n * Created by linfaxin on 15/12/12.\n * AndroidUI's impl.\n */\nmodule android.util{\n    export class ArrayMap<K, V>{\n        private map = new Map<K, V>();\n\n        constructor(capacity?:number){\n        }\n        clear() {\n            this.map.clear();\n        }\n        erase() {\n            this.map.clear();\n        }\n\n\n        ensureCapacity(minimumCapacity:number):void  {\n            //do nothing\n        }\n\n        containsKey(key:K):boolean  {\n            return this.map.has(key);\n        }\n\n\n        indexOfValue(value:V):number  {\n            return [...this.map.values()].indexOf(value);\n        }\n\n        containsValue(value:V):boolean  {\n            return this.indexOfValue(value) >= 0;\n        }\n        get(key:K):V {\n            return this.map.get(key);\n        }\n\n        keyAt(index:number):K  {\n            return [...this.map.keys()][index];\n        }\n\n        valueAt(index:number):V  {\n            return [...this.map.values()][index];\n        }\n\n        setValueAt(index:number, value:V):V  {\n            let key = this.keyAt(index);\n            if(key==null) throw Error('index error');\n            let oldV = this.get(key);\n            this.map.set(key, value);\n            return oldV;\n        }\n\n        isEmpty():boolean {\n            return this.map.size <= 0;\n        }\n\n        put(key:K, value:V):V  {\n            let oldV = this.get(key);\n            this.map.set(key, value);\n            return oldV;\n        }\n\n        append(key:K, value:V):void  {\n            this.map.set(key, value);\n        }\n\n        remove(key:K):V  {\n            let oldV = this.get(key);\n            this.map.delete(key);\n            return oldV;\n        }\n\n        removeAt(index:number):V  {\n            let key = this.keyAt(index);\n            if(key==null) throw Error('index error');\n            let oldV = this.get(key);\n            this.map.delete(key);\n            return oldV;\n        }\n\n        keySet():Set<K>  {\n            return new Set(this.map.keys());\n        }\n        size() {\n            return this.map.size;\n        }\n\n\n    }\n}"
  },
  {
    "path": "src/android/util/CopyOnWriteArray.ts",
    "content": "/**\n * Created by linfaxin on 15/10/6.\n * AndroidUI's impl.\n */\nmodule android.util {\n\n    class Access<T>{\n        mData:Array<T>;\n        mSize:number;\n\n        get(index:number):T {\n            return this.mData[index];\n        }\n\n        size():number {\n            return this.mSize;\n        }\n\n    }\n    export class CopyOnWriteArray<T> {\n        private mData:Array<T> = [];\n        private mDataCopy:Array<T>;\n        private mAccess = new Access<T>();\n\n        private mStart:boolean;\n\n        private getArray():Array<T> {\n            if (this.mStart) {\n                if (this.mDataCopy == null) this.mDataCopy = [...this.mData];\n                return this.mDataCopy;\n            }\n            return this.mData;\n        }\n\n        start():Array<T> {\n            if (this.mStart) throw new Error(\"Iteration already started\");\n            this.mStart = true;\n            this.mDataCopy = null;\n            this.mAccess.mData = this.mData;\n            this.mAccess.mSize = this.mData.length;\n\n            return this.mAccess.mData;\n        }\n        end() {\n            if (!this.mStart) throw new Error(\"Iteration not started\");\n            this.mStart = false;\n            if (this.mDataCopy != null) {\n                this.mData = this.mDataCopy;\n                this.mAccess.mData = [];\n                this.mAccess.mSize = 0;\n            }\n            this.mDataCopy = null;\n        }\n\n        //[Symbol.iterator](){\n        //    return this.start()[Symbol.iterator]();\n        //}\n\n        size():number {\n            return this.getArray().length;\n        }\n        add(...items: T[]) {\n            this.getArray().push(...items);\n        }\n        addAll(array:CopyOnWriteArray<T>) {\n            this.getArray().push(...array.mData);\n        }\n        remove(item:T ) {\n            this.getArray().splice(this.getArray().indexOf(item), 1);\n        }\n\n    }\n}"
  },
  {
    "path": "src/android/util/DisplayMetrics.ts",
    "content": "/**\n * Created by linfaxin on 15/10/5.\n * AndroidUI's impl.\n */\nmodule android.util{\n    export class DisplayMetrics{\n        static DENSITY_LOW = 120;\n        static DENSITY_MEDIUM = 160;\n        static DENSITY_HIGH = 240;\n        static DENSITY_XHIGH = 320;\n        static DENSITY_XXHIGH = 480;\n        static DENSITY_XXXHIGH = 640;\n        static DENSITY_DEFAULT = DisplayMetrics.DENSITY_MEDIUM;\n\n        widthPixels:number;\n        heightPixels:number;\n        density:number;\n        densityDpi:number;\n        scaledDensity:number;\n        xdpi:number;\n        ydpi:number;\n    }\n}"
  },
  {
    "path": "src/android/util/LayoutDirection.ts",
    "content": "/*\n * Copyright (C) 2013 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\nmodule android.util {\n/**\n * A class for defining layout directions. A layout direction can be left-to-right (LTR)\n * or right-to-left (RTL). It can also be inherited (from a parent) or deduced from the default\n * language script of a locale.\n */\nexport class LayoutDirection {\n\n    /**\n     * Horizontal layout direction is from Left to Right.\n     */\n    static LTR:number = 0;\n\n    /**\n     * Horizontal layout direction is from Right to Left.\n     */\n    static RTL:number = 1;\n\n    /**\n     * Horizontal layout direction is inherited.\n     */\n    static INHERIT:number = 2;\n\n    /**\n     * Horizontal layout direction is deduced from the default language script for the locale.\n     */\n    static LOCALE:number = 3;\n}\n}"
  },
  {
    "path": "src/android/util/Log.ts",
    "content": "/**\n * Created by linfaxin on 15/10/5.\n * AndrodUI's impl.\n */\nmodule android.util {\n    export class Log {\n        static View_DBG = false;\n        static VelocityTracker_DBG = false;\n        static DBG_DrawableContainer = false;\n        static DBG_StateListDrawable = false;\n\n        /**\n         * Priority constant for the getLogMsg method; use Log.v.\n         */\n        static VERBOSE = 2;\n        /**\n         * Priority constant for the getLogMsg method; use Log.d.\n         */\n        static DEBUG = 3;\n        /**\n         * Priority constant for the getLogMsg method; use Log.i.\n         */\n        static INFO = 4;\n        /**\n         * Priority constant for the getLogMsg method; use Log.w.\n         */\n        static WARN = 5;\n        /**\n         * Priority constant for the getLogMsg method; use Log.e.\n         */\n        static ERROR = 6;\n        /**\n         * Priority constant for the getLogMsg method.\n         */\n        static ASSERT = 7;\n        static PriorityString = [\"VERBOSE\", \"DEBUG\", \"INFO\", \"WARN\", \"ERROR\", \"ASSERT\"];\n\n        static getPriorityString(priority:number):string {\n            if (priority > Log.PriorityString.length) return \"\";\n            return Log.PriorityString[priority - 2]\n        }\n\n\n        /**\n         * Send a {@link #VERBOSE} log message and log the exception.\n         * @param tag Used to identify the source of a log message. It usually identifies\n         * the class or activity where the log call occurs.\n         * @param msg The message you would like logged.\n         * @param tr An exception to log\n         */\n        static v(tag:string, msg:string, tr?:Error) {\n            console.log(Log.getLogMsg(Log.VERBOSE, tag, msg));\n            if (tr) console.log(tr);\n        }\n\n        /**\n         * Send a {@link #DEBUG} log message and log the exception.\n         * @param tag Used to identify the source of a log message. It usually identifies\n         * the class or activity where the log call occurs.\n         * @param msg The message you would like logged.\n         * @param tr An exception to log\n         */\n        static d(tag:string, msg:string) {\n            console.debug(Log.getLogMsg(Log.DEBUG, tag, msg));\n        }\n\n        /**\n         * Send a {@link #INFO} log message and log the exception.\n         * @param tag Used to identify the source of a log message. It usually identifies\n         * the class or activity where the log call occurs.\n         * @param msg The message you would like logged.\n         * @param tr An exception to log\n         */\n        static i(tag:string, msg:string, tr?:Error) {\n            console.info(Log.getLogMsg(Log.INFO, tag, msg));\n            if (tr) console.info(tr);\n        }\n\n        /**\n         * Send a {@link #WARN} log message and log the exception.\n         * @param tag Used to identify the source of a log message. It usually identifies\n         * the class or activity where the log call occurs.\n         * @param msg The message you would like logged.\n         * @param tr An exception to log\n         */\n        static w(tag:string, msg:string, tr?:Error) {\n            console.warn(Log.getLogMsg(Log.WARN, tag, msg));\n            if (tr) console.warn(tr);\n        }\n\n\n        /**\n         * Send a {@link #ERROR} log message and log the exception.\n         * @param tag Used to identify the source of a log message. It usually identifies\n         * the class or activity where the log call occurs.\n         * @param msg The message you would like logged.\n         * @param tr An exception to log\n         */\n        static e(tag:string, msg:string, tr?:Error) {\n            console.error(Log.getLogMsg(Log.ERROR, tag, msg));\n            if (tr) console.error(tr);\n        }\n\n        private static getLogMsg(priority:number, tag:string, msg:string):string {\n            let d = new Date();\n            let dateFormat = d.toLocaleTimeString() + '.' + d.getUTCMilliseconds();\n            return \"[\" + Log.getPriorityString(priority) + \"] \" + dateFormat + \" \\t \" + tag + \" \\t \" + msg;\n        }\n    }\n}"
  },
  {
    "path": "src/android/util/LongSparseArray.ts",
    "content": "/**\n * Created by linfaxin on 15/10/3.\n * AndroidUI's impl\n */\n///<reference path=\"SparseArray.ts\"/>\n\nmodule android.util {\n    export class LongSparseArray<T> extends SparseArray<T>{\n    }\n}"
  },
  {
    "path": "src/android/util/MathUtils.ts",
    "content": "/*\n * Copyright (C) 2009 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule android.util {\n/**\n * A class that contains utility methods related to numbers.\n * \n * @hide Pending API council approval\n */\nexport class MathUtils {\n\n    private static DEG_TO_RAD:number = 3.1415926 / 180.0;\n\n    private static RAD_TO_DEG:number = 180.0 / 3.1415926;\n\n     constructor() {\n    }\n\n    static abs(v:number):number  {\n        return v > 0 ? v : -v;\n    }\n\n    static constrain(amount:number, low:number, high:number):number  {\n        return amount < low ? low : (amount > high ? high : amount);\n    }\n\n    static log(a:number):number  {\n        return <number> Math.log(a);\n    }\n\n    static exp(a:number):number  {\n        return <number> Math.exp(a);\n    }\n\n    static pow(a:number, b:number):number  {\n        return <number> Math.pow(a, b);\n    }\n\n    static max(a:number, b:number, c?:number):number  {\n        if(c==null) return a > b ? a : b;\n        return a > b ? (a > c ? a : c) : (b > c ? b : c);\n    }\n\n    static min(a:number, b:number, c?:number):number  {\n        if(c==null) return a < b ? a : b;\n        return a < b ? (a < c ? a : c) : (b < c ? b : c);\n    }\n\n    static dist(x1:number, y1:number, x2:number, y2:number):number  {\n        const x:number = (x2 - x1);\n        const y:number = (y2 - y1);\n        return <number> Math.sqrt(x * x + y * y);\n    }\n\n    static dist3(x1:number, y1:number, z1:number, x2:number, y2:number, z2:number):number  {\n        const x:number = (x2 - x1);\n        const y:number = (y2 - y1);\n        const z:number = (z2 - z1);\n        return <number> Math.sqrt(x * x + y * y + z * z);\n    }\n\n    static mag(a:number, b:number, c?:number):number  {\n        if(c==null) return <number> Math.sqrt(a * a + b * b);\n        return <number> Math.sqrt(a * a + b * b + c * c);\n    }\n\n    static sq(v:number):number  {\n        return v * v;\n    }\n\n    static radians(degrees:number):number  {\n        return degrees * MathUtils.DEG_TO_RAD;\n    }\n\n    static degrees(radians:number):number  {\n        return radians * MathUtils.RAD_TO_DEG;\n    }\n\n    static acos(value:number):number  {\n        return <number> Math.acos(value);\n    }\n\n    static asin(value:number):number  {\n        return <number> Math.asin(value);\n    }\n\n    static atan(value:number):number  {\n        return <number> Math.atan(value);\n    }\n\n    static atan2(a:number, b:number):number  {\n        return <number> Math.atan2(a, b);\n    }\n\n    static tan(angle:number):number  {\n        return <number> Math.tan(angle);\n    }\n\n    static lerp(start:number, stop:number, amount:number):number  {\n        return start + (stop - start) * amount;\n    }\n\n    static norm(start:number, stop:number, value:number):number  {\n        return (value - start) / (stop - start);\n    }\n\n    static map(minStart:number, minStop:number, maxStart:number, maxStop:number, value:number):number  {\n        return maxStart + (maxStart - maxStop) * ((value - minStart) / (minStop - minStart));\n    }\n\n    static random(howbig:number):number ;\n    static random(howsmall:number, howbig:number):number;\n    static random(...args):number  {\n        if(args.length==1) return Math.random() * args[0];\n        let [howsmall, howbig] = args;\n        if (howsmall >= howbig) return howsmall;\n        return Math.random() * (howbig - howsmall) + howsmall;\n    }\n\n}\n}"
  },
  {
    "path": "src/android/util/Pools.ts",
    "content": "/*\n * Copyright (C) 2009 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule android.util {\n\n    /**\n     * Helper class for crating pools of objects. An example use looks like this:\n     * <pre>\n     * public class MyPooledClass {\n     *\n     *     private static final SynchronizedPool<MyPooledClass> sPool =\n     *             new SynchronizedPool<MyPooledClass>(10);\n     *\n     *     public static MyPooledClass obtain() {\n     *         MyPooledClass instance = sPool.acquire();\n     *         return (instance != null) ? instance : new MyPooledClass();\n     *     }\n     *\n     *     public void recycle() {\n     *          // Clear state if needed.\n     *          sPool.release(this);\n     *     }\n     *\n     *     . . .\n     * }\n     * </pre>\n     *\n     * @hide\n     */\n    export class Pools {\n        a : Pools.SimplePool<string>;\n    }\n\n    export module Pools {\n\n        /**\n         * Interface for managing a pool of objects.\n         *\n         * @param <T> The pooled type.\n         */\n        export interface Pool<T> {\n\n            /**\n             * @return An instance from the pool if such, null otherwise.\n             */\n            acquire() : T;\n\n            /**\n             * Release an instance to the pool.\n             *\n             * @param instance The instance to release.\n             * @return Whether the instance was put in the pool.\n             *\n             * @throws IllegalStateException If the instance is already in the pool.\n             */\n            release(instance:T) : boolean;\n        }\n\n        /**\n         * Simple (non-synchronized) pool of objects.\n         *\n         * @param <T> The pooled type.\n         */\n        export class SimplePool<T> implements Pools.Pool<T> {\n            mPool:Array<T>;\n            mPoolSize:number = 0;\n\n            /**\n             * Creates a new instance.\n             *\n             * @param maxPoolSize The max pool size.\n             *\n             * @throws IllegalArgumentException If the max pool size is less than zero.\n             */\n            constructor(maxPoolSize:number) {\n                if (maxPoolSize <= 0) {\n                    throw new Error(\"The max pool size must be > 0\");\n                }\n                this.mPool = new Array<T>(maxPoolSize);\n            }\n\n            acquire():T {\n                if (this.mPoolSize > 0) {\n                    const lastPooledIndex = this.mPoolSize - 1;\n                    let instance:T = this.mPool[lastPooledIndex];\n                    this.mPool[lastPooledIndex] = null;\n                    this.mPoolSize--;\n                    return instance;\n                }\n                return null;\n            }\n\n            release(instance:T):boolean {\n                if (this.isInPool(instance)) {\n                    throw new Error(\"Already in the pool!\");\n                }\n                if (this.mPoolSize < this.mPool.length) {\n                    this.mPool[this.mPoolSize] = instance;\n                    this.mPoolSize++;\n                    return true;\n                }\n                return false;\n            }\n\n            private isInPool(instance:T):boolean {\n                for (let i = 0; i < this.mPoolSize; i++) {\n                    if (this.mPool[i] == instance) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n        }\n\n        /**\n         * Synchronized) pool of objects.\n         *\n         * @param <T> The pooled type.\n         */\n        export class SynchronizedPool<T> extends SimplePool<T>{\n            //no need to impl Synchronized\n        }\n    }\n}"
  },
  {
    "path": "src/android/util/SparseArray.ts",
    "content": "/**\n * Created by linfaxin on 15/10/3.\n * AndroidUI's impl.\n */\n///<reference path=\"SparseMap.ts\"/>\n\nmodule android.util {\n\n    export class SparseArray<T> extends SparseMap<number, T> {\n\n    }\n}"
  },
  {
    "path": "src/android/util/SparseBooleanArray.ts",
    "content": "/**\n * Created by linfaxin on 15/10/3.\n * AndroidUI's impl.\n */\n///<reference path=\"SparseArray.ts\"/>\n\nmodule android.util {\n    export class SparseBooleanArray extends SparseArray<boolean>{\n    }\n}"
  },
  {
    "path": "src/android/util/SparseMap.ts",
    "content": "/**\n * Created by linfaxin on 15/10/3.\n * AndroidUI's impl.\n */\nmodule android.util {\n\n    //AndroidUI only.\n    export class SparseMap<K, T> {\n        map:Map<K, T>;\n\n        constructor(initialCapacity?:number) {\n            this.map = new Map();\n        }\n\n        clone():SparseMap<K ,T> {\n            let clone = new SparseMap<K, T>();\n            clone.map = new Map(this.map);\n            return clone;\n        }\n\n        get(key:K, valueIfKeyNotFound:T=null) {\n            let value = this.map.get(key);\n            if(value===undefined) return valueIfKeyNotFound;\n            return  value;\n        }\n\n        delete(key:K) {\n            this.map.delete(key);\n        }\n\n        remove(key:K) {\n            this.delete(key);\n        }\n\n        removeAt(index:number) {\n            this.removeAtRange(index);\n        }\n\n        removeAtRange(index:number, size = 1) {\n            let keys = [...this.map.keys()];\n            let end = Math.min(this.map.size, index + size);\n            for (let i = index; i < end; i++) {\n                this.map.delete(keys[i]);\n            }\n        }\n\n        put(key:K, value:T) {\n            this.map.set(key, value);\n        }\n\n        size():number {\n            return this.map.size;\n        }\n\n        keyAt(index:number):K {\n            return [...this.map.keys()][index];\n        }\n\n        valueAt(index:number):T {\n            return [...this.map.values()][index];\n        }\n\n        setValueAt(index:number, value:T) {\n            let key = this.keyAt(index);\n            this.map.set(key, value);\n        }\n\n        indexOfKey(key:K):number {\n            return [...this.map.keys()].indexOf(key);\n        }\n\n        indexOfValue(value:T):number {\n            return [...this.map.values()].indexOf(value);\n        }\n\n        clear() {\n            this.map.clear();\n        }\n\n        append(key, value) {\n            this.put(key, value);\n        }\n    }\n}"
  },
  {
    "path": "src/android/util/StateSet.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../java/lang/System.ts\"/>\n///<reference path=\"../../androidui/util/ArrayCreator.ts\"/>\n\nmodule android.util{\n    import System = java.lang.System;\n\n    /**\n     * State sets are arrays of positive ints where each element\n     * represents the state of a {@link android.view.View} (e.g. focused,\n     * selected, visible, etc.).  A {@link android.view.View} may be in\n     * one or more of those states.\n     *\n     * A state spec is an array of signed ints where each element\n     * represents a required (if positive) or an undesired (if negative)\n     * {@link android.view.View} state.\n     *\n     * Utils dealing with state sets.\n     *\n     * In theory we could encapsulate the state set and state spec arrays\n     * and not have static methods here but there is some concern about\n     * performance since these methods are called during view drawing.\n     */\n    export class StateSet{\n        static WILD_CARD:Array<number> = [];\n        static NOTHING:Array<number> = [0];\n\n        /**\n         * Return whether the stateSetOrSpec is matched by all StateSets.\n         *\n         * @param stateSetOrSpec a state set or state spec.\n         */\n        static isWildCard(stateSetOrSpec:Array<number>):boolean{\n            return stateSetOrSpec.length == 0 || stateSetOrSpec[0] == 0;\n        }\n\n        /**\n         * Return whether the stateSet matches the desired stateSpec.\n         *\n         * @param stateSpec an array of required (if positive) or\n         *        prohibited (if negative) {@link android.view.View} states.\n         * @param stateSet an array of {@link android.view.View} states\n         */\n        static stateSetMatches(stateSpec:Array<number>, stateSetOrState:Array<number>|number):boolean{\n            if(Number.isInteger(<number>stateSetOrState)){\n                return StateSet._stateSetMatches_single(stateSpec, <number>stateSetOrState);\n            }\n            let stateSet = <Array<number>>stateSetOrState;\n            if (stateSet == null) {\n                return (stateSpec == null || this.isWildCard(stateSpec));\n            }\n            let stateSpecSize = stateSpec.length;\n            let stateSetSize = stateSet.length;\n            for (let i = 0; i < stateSpecSize; i++) {\n                let stateSpecState = stateSpec[i];\n                if (stateSpecState == 0) {\n                    // We've reached the end of the cases to match against.\n                    return true;\n                }\n                let mustMatch;\n                if (stateSpecState > 0) {\n                    mustMatch = true;\n                } else {\n                    // We use negative values to indicate must-NOT-match states.\n                    mustMatch = false;\n                    stateSpecState = -stateSpecState;\n                }\n                let found = false;\n                for (let j = 0; j < stateSetSize; j++) {\n                    const state = stateSet[j];\n                    if (state == 0) {\n                        // We've reached the end of states to match.\n                        if (mustMatch) {\n                            // We didn't find this must-match state.\n                            return false;\n                        } else {\n                            // Continue checking other must-not-match states.\n                            break;\n                        }\n                    }\n                    if (state == stateSpecState) {\n                        if (mustMatch) {\n                            found = true;\n                            // Continue checking other other must-match states.\n                            break;\n                        } else {\n                            // Any match of a must-not-match state returns false.\n                            return false;\n                        }\n                    }\n                }\n                if (mustMatch && !found) {\n                    // We've reached the end of states to match and we didn't\n                    // find a must-match state.\n                    return false;\n                }\n            }\n            return true;\n        }\n\n        private static _stateSetMatches_single(stateSpec:Array<number>, state:number):boolean{\n            let stateSpecSize = stateSpec.length;\n            for (let i = 0; i < stateSpecSize; i++) {\n                let stateSpecState = stateSpec[i];\n                if (stateSpecState == 0) {\n                    // We've reached the end of the cases to match against.\n                    return true;\n                }\n                if (stateSpecState > 0) {\n                    if (state != stateSpecState) {\n                        return false;\n                    }\n                } else {\n                    // We use negative values to indicate must-NOT-match states.\n                    if (state == -stateSpecState) {\n                        // We matched a must-not-match case.\n                        return false;\n                    }\n                }\n            }\n            return true;\n        }\n\n        static trimStateSet(states:Array<number>, newSize:number):Array<number>{\n            if (states.length == newSize) {\n                return states;\n            }\n            let trimmedStates = androidui.util.ArrayCreator.newNumberArray(newSize);\n            System.arraycopy(states, 0, trimmedStates, 0, newSize);\n            return trimmedStates;\n        }\n\n    }\n}"
  },
  {
    "path": "src/android/util/TypedValue.ts",
    "content": "/**\n * Created by linfaxin on 15/10/27.\n * AndroidUI's impl: converted TypedValue to pixel value.\n */\n///<reference path=\"DisplayMetrics.ts\"/>\n///<reference path=\"../content/res/Resources.ts\"/>\n\nmodule android.util{\n\n    export class TypedValue{\n        static COMPLEX_UNIT_PX = 'px';\n        static COMPLEX_UNIT_DP = 'dp';\n        static COMPLEX_UNIT_DIP = 'dip';\n        static COMPLEX_UNIT_SP = 'sp';\n        static COMPLEX_UNIT_PT = 'pt';\n        static COMPLEX_UNIT_IN = 'in';\n        static COMPLEX_UNIT_MM = 'mm';\n        static COMPLEX_UNIT_EM = 'em';\n        static COMPLEX_UNIT_REM = 'rem';\n        static COMPLEX_UNIT_VH = 'vh';\n        static COMPLEX_UNIT_VW = 'vw';\n        static COMPLEX_UNIT_FRACTION = '%';\n\n        private static UNIT_SCALE_MAP = new Map<string, number>();\n\n        private static initUnit(){\n            this.initUnit = null;\n            let temp = document.createElement('div');\n            document.body.appendChild(temp);\n\n            temp.style.height = 100 + TypedValue.COMPLEX_UNIT_PT;\n            TypedValue.UNIT_SCALE_MAP.set(TypedValue.COMPLEX_UNIT_PT, temp.offsetHeight / 100);\n            temp.style.height = 1 + TypedValue.COMPLEX_UNIT_IN;\n            TypedValue.UNIT_SCALE_MAP.set(TypedValue.COMPLEX_UNIT_IN, temp.offsetHeight);\n            temp.style.height = 100 + TypedValue.COMPLEX_UNIT_MM;\n            TypedValue.UNIT_SCALE_MAP.set(TypedValue.COMPLEX_UNIT_MM, temp.offsetHeight / 100);\n            temp.style.height = 10 + TypedValue.COMPLEX_UNIT_EM;\n            TypedValue.UNIT_SCALE_MAP.set(TypedValue.COMPLEX_UNIT_EM, temp.offsetHeight / 10);\n            temp.style.height = 10 + TypedValue.COMPLEX_UNIT_REM;\n            TypedValue.UNIT_SCALE_MAP.set(TypedValue.COMPLEX_UNIT_REM, temp.offsetHeight / 10);\n\n            document.body.removeChild(temp);\n        }\n\n        static applyDimension(unit:string, size:number, dm:DisplayMetrics):number {\n            let scale = 1;\n            if(unit===TypedValue.COMPLEX_UNIT_DP || unit===TypedValue.COMPLEX_UNIT_DIP || unit===TypedValue.COMPLEX_UNIT_SP){\n                scale = dm.density;\n            }else{\n                scale = TypedValue.UNIT_SCALE_MAP.get(unit) || 1;\n            }\n            return size * scale;\n        }\n\n        static isDynamicUnitValue(valueWithUnit:string):boolean {\n            if(typeof valueWithUnit != \"string\") return false;\n            return valueWithUnit.match(`${TypedValue.COMPLEX_UNIT_VH}$|${TypedValue.COMPLEX_UNIT_VW}$|${TypedValue.COMPLEX_UNIT_FRACTION}$`)!=null;\n\n        }\n\n        /**\n         * Converts a complex data value holding a dimension to its final floating\n         * point value. The given <var>data</var> must be structured as a\n         * {@link #TYPE_DIMENSION}.\n         *\n         * @return The complex floating point value multiplied by the appropriate\n         * metrics depending on its unit.\n         */\n        static complexToDimension(valueWithUnit:string, baseValue = 0, metrics = android.content.res.Resources.getDisplayMetrics()):number {\n            if(this.initUnit) this.initUnit();\n            if(valueWithUnit===undefined || valueWithUnit===null){\n                throw Error('complexToDimensionPixelSize error: valueWithUnit is '+valueWithUnit);\n            }\n            if(valueWithUnit === ''+(Number.parseFloat(valueWithUnit))) return Number.parseFloat(valueWithUnit);\n\n            if(typeof valueWithUnit !== 'string') valueWithUnit = valueWithUnit+\"\";\n            let scale = 1;\n            if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_PX)){\n                valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_PX, \"\");\n\n            }else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_DP)){\n                valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_DP, \"\");\n                scale = metrics.density;\n\n            }else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_DIP)){\n                valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_DIP, \"\");\n                scale = metrics.density;\n\n            }else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_SP)){\n                valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_SP, \"\");\n                scale = metrics.density * (TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_SP) || 1);\n\n            }else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_PT)){\n                valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_PT, \"\");\n                scale = TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_PT) || 1;\n\n            }else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_IN)){\n                valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_IN, \"\");\n                scale = TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_IN) || 1;\n\n            }else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_MM)){\n                valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_MM, \"\");\n                scale = TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_MM) || 1;\n\n            }else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_EM)){\n                valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_EM, \"\");\n                scale = TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_EM) || 1;\n\n            }else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_REM)){\n                valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_REM, \"\");\n                scale = TypedValue.UNIT_SCALE_MAP.get(TypedValue.COMPLEX_UNIT_REM) || 1;\n\n            }else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_VH)){\n                valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_VH, \"\");\n                scale = metrics.heightPixels / 100;\n\n            }else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_VW)){\n                valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_VW, \"\");\n                scale = metrics.widthPixels / 100;\n\n            }else if(valueWithUnit.endsWith(TypedValue.COMPLEX_UNIT_FRACTION)){\n                valueWithUnit = valueWithUnit.replace(TypedValue.COMPLEX_UNIT_FRACTION, \"\");\n                scale = Number.parseFloat(valueWithUnit) / 100;\n                if(Number.isNaN(scale)) return 0;\n                valueWithUnit = <any>baseValue;\n\n            }\n            let value = Number.parseFloat(valueWithUnit);\n            if(Number.isNaN(value)) throw Error('complexToDimensionPixelSize error: '+valueWithUnit);\n            return value * scale;\n        }\n\n        /**\n         * Converts a complex data value holding a dimension to its final value\n         * as an integer pixel offset.  This is the same as\n         * {@link #complexToDimension}, except the raw floating point value is\n         * truncated to an integer (pixel) value.\n         * The given <var>data</var> must be structured as a\n         * {@link #TYPE_DIMENSION}.\n         *\n         * @return The number of pixels specified by the data and its desired\n         * multiplier and units.\n         */\n        static complexToDimensionPixelOffset(valueWithUnit:string, baseValue = 0, metrics = android.content.res.Resources.getDisplayMetrics()):number {\n            let value = this.complexToDimension(valueWithUnit, baseValue, metrics);\n            return Math.floor(value);\n        }\n\n        /**\n         * Converts a complex data value holding a dimension to its final value\n         * as an integer pixel size.  This is the same as\n         * {@link #complexToDimension}, except the raw floating point value is\n         * converted to an integer (pixel) value for use as a size.  A size\n         * conversion involves rounding the base value, and ensuring that a\n         * non-zero base value is at least one pixel in size.\n         * The given <var>data</var> must be structured as a\n         * {@link #TYPE_DIMENSION}.\n         *\n         * @return The number of pixels specified by the data and its desired\n         * multiplier and units.\n         */\n        static complexToDimensionPixelSize(valueWithUnit:string, baseValue = 0, metrics = android.content.res.Resources.getDisplayMetrics()):number {\n            let value = this.complexToDimension(valueWithUnit, baseValue, metrics);\n            let res = Math.ceil(value);\n            if (res != 0) return res;\n            if (value == 0) return 0;\n            if (value > 0) return 1;\n            return -1;\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/FocusFinder.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"View.ts\"/>\n///<reference path=\"ViewGroup.ts\"/>\n\nmodule android.view{\n    import View = android.view.View;\n    import Rect = android.graphics.Rect;\n    import ArrayList = java.util.ArrayList;\n\n\n    /**\n     * The algorithm used for finding the next focusable view in a given direction\n     * from a view that currently has focus.\n     */\n    export class FocusFinder{\n        private static sFocusFinder:FocusFinder;\n        /**\n         * Get the focus finder for this thread.\n         */\n        static getInstance():FocusFinder{\n            if(!FocusFinder.sFocusFinder){\n                FocusFinder.sFocusFinder = new FocusFinder();\n            }\n            return FocusFinder.sFocusFinder;\n        }\n\n        mFocusedRect = new Rect();\n        mOtherRect = new Rect();\n        mBestCandidateRect = new Rect();\n        private mSequentialFocusComparator = new SequentialFocusComparator();\n        private mTempList = new ArrayList<View>();\n\n        /**\n         * Find the next view to take focus in root's descendants, starting from the view\n         * that currently is focused.\n         * @param root Contains focused. Cannot be null.\n         * @param focused Has focus now.\n         * @param direction Direction to look.\n         * @return The next focusable view, or null if none exists.\n         */\n        findNextFocus(root:ViewGroup, focused:View, direction:number):View{\n            return this._findNextFocus(root, focused, null, direction);\n        }\n\n        /**\n         * Find the next view to take focus in root's descendants, searching from\n         * a particular rectangle in root's coordinates.\n         * @param root Contains focusedRect. Cannot be null.\n         * @param focusedRect The starting point of the search.\n         * @param direction Direction to look.\n         * @return The next focusable view, or null if none exists.\n         */\n        findNextFocusFromRect(root:ViewGroup, focusedRect:Rect, direction:number) {\n            this.mFocusedRect.set(focusedRect);\n            return this._findNextFocus(root, null, this.mFocusedRect, direction);\n        }\n        private _findNextFocus(root:ViewGroup, focused:View, focusedRect:android.graphics.Rect,\n                               direction:number):View {\n            let next = null;\n            if (focused != null) {\n                next = this.findNextUserSpecifiedFocus(root, focused, direction);\n            }\n            if (next != null) {\n                return next;\n            }\n            let focusables = this.mTempList;\n            try {\n                focusables.clear();\n                root.addFocusables(focusables, direction);\n                if (!focusables.isEmpty()) {\n                    next = this.__findNextFocus(root, focused, focusedRect, direction, focusables);\n                }\n            } finally {\n                focusables.clear();\n            }\n            return next;\n        }\n        private findNextUserSpecifiedFocus(root:ViewGroup, focused:View, direction:number):View {\n            // check for user specified next focus\n            let userSetNextFocus = focused.findUserSetNextFocus(root, direction);\n            if (userSetNextFocus != null && userSetNextFocus.isFocusable()\n                && (!userSetNextFocus.isInTouchMode()\n                || userSetNextFocus.isFocusableInTouchMode())) {\n                return userSetNextFocus;\n            }\n            return null;\n        }\n\n        private __findNextFocus(root:ViewGroup, focused:View, focusedRect:android.graphics.Rect,\n                               direction:number, focusables:ArrayList<View>):View {\n            if (focused != null) {\n                if (focusedRect == null) {\n                    focusedRect = this.mFocusedRect;\n                }\n                // fill in interesting rect from focused\n                focused.getFocusedRect(focusedRect);\n                root.offsetDescendantRectToMyCoords(focused, focusedRect);\n            } else {\n                if (focusedRect == null) {\n                    focusedRect = this.mFocusedRect;\n                    // make up a rect at top left or bottom right of root\n                    switch (direction) {\n                        case View.FOCUS_RIGHT:\n                        case View.FOCUS_DOWN:\n                            this.setFocusTopLeft(root, focusedRect);\n                            break;\n                        case View.FOCUS_FORWARD:\n                            this.setFocusTopLeft(root, focusedRect);\n                            break;\n\n                        case View.FOCUS_LEFT:\n                        case View.FOCUS_UP:\n                            this.setFocusBottomRight(root, focusedRect);\n                            break;\n                        case View.FOCUS_BACKWARD:\n                            this.setFocusBottomRight(root, focusedRect);\n                    }\n                }\n            }\n\n            switch (direction) {\n                case View.FOCUS_FORWARD:\n                case View.FOCUS_BACKWARD:\n                    return this.findNextFocusInRelativeDirection(focusables, root, focused, focusedRect, direction);\n                case View.FOCUS_UP:\n                case View.FOCUS_DOWN:\n                case View.FOCUS_LEFT:\n                case View.FOCUS_RIGHT:\n                    return this.findNextFocusInAbsoluteDirection(focusables, root, focused, focusedRect, direction);\n                default:\n                    throw new Error(\"Unknown direction: \" + direction);\n            }\n\n        }\n        private findNextFocusInRelativeDirection(focusables:ArrayList<View>, root:ViewGroup, focused:View,\n                                         focusedRect:Rect, direction:number) {\n            try {\n                // Note: This sort is stable.\n                this.mSequentialFocusComparator.setRoot(root);\n                //this.mSequentialFocusComparator.setIsLayoutRtl(root.isLayoutRtl());\n                this.mSequentialFocusComparator.sort(focusables);\n                //Collections.sort(focusables, mSequentialFocusComparator);\n            } finally {\n                this.mSequentialFocusComparator.recycle();\n            }\n\n            const count = focusables.size();\n            switch (direction) {\n                case View.FOCUS_FORWARD:\n                    return FocusFinder.getNextFocusable(focused, focusables, count);\n                case View.FOCUS_BACKWARD:\n                    return FocusFinder.getPreviousFocusable(focused, focusables, count);\n            }\n            return focusables.get(count - 1);\n        }\n\n        private setFocusBottomRight(root:ViewGroup, focusedRect:Rect) {\n            const rootBottom = root.getScrollY() + root.getHeight();\n            const rootRight = root.getScrollX() + root.getWidth();\n            focusedRect.set(rootRight, rootBottom, rootRight, rootBottom);\n        }\n        private setFocusTopLeft(root:ViewGroup, focusedRect:Rect) {\n            const rootTop = root.getScrollY();\n            const rootLeft = root.getScrollX();\n            focusedRect.set(rootLeft, rootTop, rootLeft, rootTop);\n        }\n        private findNextFocusInAbsoluteDirection(focusables:ArrayList<View>, root:ViewGroup, focused:View,\n                                                 focusedRect:Rect, direction:number) {\n            // initialize the best candidate to something impossible\n            // (so the first plausible view will become the best choice)\n            this.mBestCandidateRect.set(focusedRect);\n            switch(direction) {\n                case View.FOCUS_LEFT:\n                    this.mBestCandidateRect.offset(focusedRect.width() + 1, 0);\n                    break;\n                case View.FOCUS_RIGHT:\n                    this.mBestCandidateRect.offset(-(focusedRect.width() + 1), 0);\n                    break;\n                case View.FOCUS_UP:\n                    this.mBestCandidateRect.offset(0, focusedRect.height() + 1);\n                    break;\n                case View.FOCUS_DOWN:\n                    this.mBestCandidateRect.offset(0, -(focusedRect.height() + 1));\n            }\n\n            let closest:View = null;\n\n            let numFocusables = focusables.size();\n            for (let i = 0; i < numFocusables; i++) {\n                let focusable = focusables.get(i);\n\n                // only interested in other non-root views\n                if (focusable == focused || focusable == root) continue;\n\n                // get focus bounds of other view in same coordinate system\n                focusable.getFocusedRect(this.mOtherRect);\n                root.offsetDescendantRectToMyCoords(focusable, this.mOtherRect);\n\n                if (this.isBetterCandidate(direction, focusedRect, this.mOtherRect, this.mBestCandidateRect)) {\n                    this.mBestCandidateRect.set(this.mOtherRect);\n                    closest = focusable;\n                }\n            }\n            return closest;\n        }\n\n        private static getNextFocusable(focused:View, focusables:ArrayList<View>, count:number):View {\n            if (focused != null) {\n                let position = focusables.lastIndexOf(focused);\n                if (position >= 0 && position + 1 < count) {\n                    return focusables.get(position + 1);\n                }\n            }\n            if (!focusables.isEmpty()) {\n                return focusables.get(0);\n            }\n            return null;\n        }\n\n\n        private static getPreviousFocusable(focused:View, focusables:ArrayList<View>, count:number):View {\n            if (focused != null) {\n                let position = focusables.indexOf(focused);\n                if (position > 0) {\n                    return focusables.get(position - 1);\n                }\n            }\n            if (!focusables.isEmpty()) {\n                return focusables.get(count - 1);\n            }\n            return null;\n        }\n\n        /**\n         * Is rect1 a better candidate than rect2 for a focus search in a particular\n         * direction from a source rect?  This is the core routine that determines\n         * the order of focus searching.\n         * @param direction the direction (up, down, left, right)\n         * @param source The source we are searching from\n         * @param rect1 The candidate rectangle\n         * @param rect2 The current best candidate.\n         * @return Whether the candidate is the new best.\n         */\n        isBetterCandidate(direction:number, source:Rect, rect1:Rect, rect2:Rect):boolean {\n\n            // to be a better candidate, need to at least be a candidate in the first\n            // place :)\n            if (!this.isCandidate(source, rect1, direction)) {\n                return false;\n            }\n\n            // we know that rect1 is a candidate.. if rect2 is not a candidate,\n            // rect1 is better\n            if (!this.isCandidate(source, rect2, direction)) {\n                return true;\n            }\n\n            // if rect1 is better by beam, it wins\n            if (this.beamBeats(direction, source, rect1, rect2)) {\n                return true;\n            }\n\n            // if rect2 is better, then rect1 cant' be :)\n            if (this.beamBeats(direction, source, rect2, rect1)) {\n                return false;\n            }\n\n            // otherwise, do fudge-tastic comparison of the major and minor axis\n            return (this.getWeightedDistanceFor(\n                FocusFinder.majorAxisDistance(direction, source, rect1),\n                FocusFinder.minorAxisDistance(direction, source, rect1))\n            < this.getWeightedDistanceFor(\n                FocusFinder.majorAxisDistance(direction, source, rect2),\n                FocusFinder.minorAxisDistance(direction, source, rect2)));\n        }\n\n        /**\n         * One rectangle may be another candidate than another by virtue of being\n         * exclusively in the beam of the source rect.\n         * @return Whether rect1 is a better candidate than rect2 by virtue of it being in src's\n         *      beam\n         */\n        beamBeats(direction:number, source:Rect, rect1:Rect, rect2:Rect):boolean {\n            const rect1InSrcBeam = this.beamsOverlap(direction, source, rect1);\n            const rect2InSrcBeam = this.beamsOverlap(direction, source, rect2);\n\n            // if rect1 isn't exclusively in the src beam, it doesn't win\n            if (rect2InSrcBeam || !rect1InSrcBeam) {\n                return false;\n            }\n\n            // we know rect1 is in the beam, and rect2 is not\n\n            // if rect1 is to the direction of, and rect2 is not, rect1 wins.\n            // for example, for direction left, if rect1 is to the left of the source\n            // and rect2 is below, then we always prefer the in beam rect1, since rect2\n            // could be reached by going down.\n            if (!this.isToDirectionOf(direction, source, rect2)) {\n                return true;\n            }\n\n            // for horizontal directions, being exclusively in beam always wins\n            if ((direction == View.FOCUS_LEFT || direction == View.FOCUS_RIGHT)) {\n                return true;\n            }\n\n            // for vertical directions, beams only beat up to a point:\n            // now, as long as rect2 isn't completely closer, rect1 wins\n            // e.g for direction down, completely closer means for rect2's top\n            // edge to be closer to the source's top edge than rect1's bottom edge.\n            return (FocusFinder.majorAxisDistance(direction, source, rect1)\n            < FocusFinder.majorAxisDistanceToFarEdge(direction, source, rect2));\n        }\n\n        /**\n         * Fudge-factor opportunity: how to calculate distance given major and minor\n         * axis distances.  Warning: this fudge factor is finely tuned, be sure to\n         * run all focus tests if you dare tweak it.\n         */\n        getWeightedDistanceFor(majorAxisDistance:number, minorAxisDistance:number):number {\n            return 13 * majorAxisDistance * majorAxisDistance\n                + minorAxisDistance * minorAxisDistance;\n        }\n\n        /**\n         * Is destRect a candidate for the next focus given the direction?  This\n         * checks whether the dest is at least partially to the direction of (e.g left of)\n         * from source.\n         *\n         * Includes an edge case for an empty rect (which is used in some cases when\n         * searching from a point on the screen).\n         */\n        isCandidate(srcRect:Rect, destRect:Rect, direction:number):boolean {\n            switch (direction) {\n                case View.FOCUS_LEFT:\n                    return (srcRect.right > destRect.right || srcRect.left >= destRect.right)\n                        && srcRect.left > destRect.left;\n                case View.FOCUS_RIGHT:\n                    return (srcRect.left < destRect.left || srcRect.right <= destRect.left)\n                        && srcRect.right < destRect.right;\n                case View.FOCUS_UP:\n                    return (srcRect.bottom > destRect.bottom || srcRect.top >= destRect.bottom)\n                        && srcRect.top > destRect.top;\n                case View.FOCUS_DOWN:\n                    return (srcRect.top < destRect.top || srcRect.bottom <= destRect.top)\n                        && srcRect.bottom < destRect.bottom;\n            }\n            throw new Error(\"direction must be one of \"\n                + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");\n        }\n\n        /**\n         * Do the \"beams\" w.r.t the given direction's axis of rect1 and rect2 overlap?\n         * @param direction the direction (up, down, left, right)\n         * @param rect1 The first rectangle\n         * @param rect2 The second rectangle\n         * @return whether the beams overlap\n         */\n        beamsOverlap(direction:number, rect1:Rect, rect2:Rect):boolean {\n            switch (direction) {\n                case View.FOCUS_LEFT:\n                case View.FOCUS_RIGHT:\n                    return (rect2.bottom >= rect1.top) && (rect2.top <= rect1.bottom);\n                case View.FOCUS_UP:\n                case View.FOCUS_DOWN:\n                    return (rect2.right >= rect1.left) && (rect2.left <= rect1.right);\n            }\n            throw new Error(\"direction must be one of \"\n                + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");\n        }\n\n        /**\n         * e.g for left, is 'to left of'\n         */\n        isToDirectionOf(direction:number, src:Rect, dest:Rect):boolean {\n            switch (direction) {\n                case View.FOCUS_LEFT:\n                    return src.left >= dest.right;\n                case View.FOCUS_RIGHT:\n                    return src.right <= dest.left;\n                case View.FOCUS_UP:\n                    return src.top >= dest.bottom;\n                case View.FOCUS_DOWN:\n                    return src.bottom <= dest.top;\n            }\n            throw new Error(\"direction must be one of \"\n                + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");\n        }\n        /**\n         * @return The distance from the edge furthest in the given direction\n         *   of source to the edge nearest in the given direction of dest.  If the\n         *   dest is not in the direction from source, return 0.\n         */\n        static majorAxisDistance(direction:number, source:Rect, dest:Rect):number {\n            return Math.max(0, FocusFinder.majorAxisDistanceRaw(direction, source, dest));\n        }\n        static majorAxisDistanceRaw(direction:number, source:Rect, dest:Rect):number {\n            switch (direction) {\n                case View.FOCUS_LEFT:\n                    return source.left - dest.right;\n                case View.FOCUS_RIGHT:\n                    return dest.left - source.right;\n                case View.FOCUS_UP:\n                    return source.top - dest.bottom;\n                case View.FOCUS_DOWN:\n                    return dest.top - source.bottom;\n            }\n            throw new Error(\"direction must be one of \"\n                + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");\n        }\n        /**\n         * @return The distance along the major axis w.r.t the direction from the\n         *   edge of source to the far edge of dest. If the\n         *   dest is not in the direction from source, return 1 (to break ties with\n         *   {@link #majorAxisDistance}).\n         */\n        static majorAxisDistanceToFarEdge(direction:number, source:Rect, dest:Rect):number {\n            return Math.max(1, FocusFinder.majorAxisDistanceToFarEdgeRaw(direction, source, dest));\n        }\n        static majorAxisDistanceToFarEdgeRaw(direction:number, source:Rect, dest:Rect):number {\n            switch (direction) {\n                case View.FOCUS_LEFT:\n                    return source.left - dest.left;\n                case View.FOCUS_RIGHT:\n                    return dest.right - source.right;\n                case View.FOCUS_UP:\n                    return source.top - dest.top;\n                case View.FOCUS_DOWN:\n                    return dest.bottom - source.bottom;\n            }\n            throw new Error(\"direction must be one of \"\n                + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");\n        }\n        /**\n         * Find the distance on the minor axis w.r.t the direction to the nearest\n         * edge of the destination rectangle.\n         * @param direction the direction (up, down, left, right)\n         * @param source The source rect.\n         * @param dest The destination rect.\n         * @return The distance.\n         */\n        static minorAxisDistance(direction:number, source:Rect, dest:Rect):number {\n            switch (direction) {\n                case View.FOCUS_LEFT:\n                case View.FOCUS_RIGHT:\n                    // the distance between the center verticals\n                    return Math.abs(\n                        ((source.top + source.height() / 2) -\n                        ((dest.top + dest.height() / 2))));\n                case View.FOCUS_UP:\n                case View.FOCUS_DOWN:\n                    // the distance between the center horizontals\n                    return Math.abs(\n                        ((source.left + source.width() / 2) -\n                        ((dest.left + dest.width() / 2))));\n            }\n            throw new Error(\"direction must be one of \"\n                + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");\n        }\n\n        /**\n         * Find the nearest touchable view to the specified view.\n         *\n         * @param root The root of the tree in which to search\n         * @param x X coordinate from which to start the search\n         * @param y Y coordinate from which to start the search\n         * @param direction Direction to look\n         * @param deltas Offset from the <x, y> to the edge of the nearest view. Note that this array\n         *        may already be populated with values.\n         * @return The nearest touchable view, or null if none exists.\n         */\n        findNearestTouchable(root:ViewGroup, x:number, y:number, direction:number, deltas:number[]):View {\n            let touchables = root.getTouchables();\n            let minDistance = Number.MAX_SAFE_INTEGER;\n            let closest = null;\n\n            let numTouchables = touchables.size();\n\n            let edgeSlop = ViewConfiguration.get().getScaledEdgeSlop();\n\n            let closestBounds = new Rect();\n            let touchableBounds = this.mOtherRect;\n\n            for (let i = 0; i < numTouchables; i++) {\n                let touchable = touchables.get(i);\n\n                // get visible bounds of other view in same coordinate system\n                touchable.getDrawingRect(touchableBounds);\n\n                root.offsetRectBetweenParentAndChild(touchable, touchableBounds, true, true);\n\n                if (!this.isTouchCandidate(x, y, touchableBounds, direction)) {\n                    continue;\n                }\n\n                let distance = Number.MAX_SAFE_INTEGER;\n\n                switch (direction) {\n                    case View.FOCUS_LEFT:\n                        distance = x - touchableBounds.right + 1;\n                        break;\n                    case View.FOCUS_RIGHT:\n                        distance = touchableBounds.left;\n                        break;\n                    case View.FOCUS_UP:\n                        distance = y - touchableBounds.bottom + 1;\n                        break;\n                    case View.FOCUS_DOWN:\n                        distance = touchableBounds.top;\n                        break;\n                }\n\n                if (distance < edgeSlop) {\n                    // Give preference to innermost views\n                    if (closest == null ||\n                        closestBounds.contains(touchableBounds) ||\n                        (!touchableBounds.contains(closestBounds) && distance < minDistance)) {\n                        minDistance = distance;\n                        closest = touchable;\n                        closestBounds.set(touchableBounds);\n                        switch (direction) {\n                            case View.FOCUS_LEFT:\n                                deltas[0] = -distance;\n                                break;\n                            case View.FOCUS_RIGHT:\n                                deltas[0] = distance;\n                                break;\n                            case View.FOCUS_UP:\n                                deltas[1] = -distance;\n                                break;\n                            case View.FOCUS_DOWN:\n                                deltas[1] = distance;\n                                break;\n                        }\n                    }\n                }\n            }\n            return closest;\n        }\n\n\n        /**\n         * Is destRect a candidate for the next touch given the direction?\n         */\n        private isTouchCandidate(x:number, y:number, destRect:Rect, direction:number):boolean {\n            switch (direction) {\n                case View.FOCUS_LEFT:\n                    return destRect.left <= x && destRect.top <= y && y <= destRect.bottom;\n                case View.FOCUS_RIGHT:\n                    return destRect.left >= x && destRect.top <= y && y <= destRect.bottom;\n                case View.FOCUS_UP:\n                    return destRect.top <= y && destRect.left <= x && x <= destRect.right;\n                case View.FOCUS_DOWN:\n                    return destRect.top >= y && destRect.left <= x && x <= destRect.right;\n            }\n            throw new Error(\"direction must be one of \"\n                + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.\");\n        }\n\n\n    }\n\n\n    /**\n     * Sorts views according to their visual layout and geometry for default tab order.\n     * This is used for sequential focus traversal.\n     */\n    class SequentialFocusComparator {\n        mFirstRect = new Rect();\n        mSecondRect = new Rect();\n        mRoot:ViewGroup;\n        private mIsLayoutRtl = false;\n\n        recycle() {\n            this.mRoot = null;\n        }\n        setRoot(root:ViewGroup) {\n            this.mRoot = root;\n        }\n        private getRect(view:View, rect:Rect) {\n            view.getDrawingRect(rect);\n            this.mRoot.offsetDescendantRectToMyCoords(view, rect);\n        }\n\n        private compareFn = (first:View, second:View):number=>{\n            if (first == second) {\n                return 0;\n            }\n\n            this.getRect(first, this.mFirstRect);\n            this.getRect(second, this.mSecondRect);\n\n            if (this.mFirstRect.top < this.mSecondRect.top) {\n                return -1;\n            } else if (this.mFirstRect.top > this.mSecondRect.top) {\n                return 1;\n            } else if (this.mFirstRect.left < this.mSecondRect.left) {\n                return this.mIsLayoutRtl ? 1 : -1;\n            } else if (this.mFirstRect.left > this.mSecondRect.left) {\n                return this.mIsLayoutRtl ? -1 : 1;\n            } else if (this.mFirstRect.bottom < this.mSecondRect.bottom) {\n                return -1;\n            } else if (this.mFirstRect.bottom > this.mSecondRect.bottom) {\n                return 1;\n            } else if (this.mFirstRect.right < this.mSecondRect.right) {\n                return this.mIsLayoutRtl ? 1 : -1;\n            } else if (this.mFirstRect.right > this.mSecondRect.right) {\n                return this.mIsLayoutRtl ? -1 : 1;\n            } else {\n                // The view are distinct but completely coincident so we consider\n                // them equal for our purposes.  Since the sort is stable, this\n                // means that the views will retain their layout order relative to one another.\n                return 0;\n            }\n        }\n        sort(array:ArrayList<View>){\n            array.sort(this.compareFn);\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/GestureDetector.ts",
    "content": "/*\n * Copyright (C) 2008 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/os/Handler.ts\"/>\n///<reference path=\"../../android/os/Message.ts\"/>\n///<reference path=\"../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../android/view/VelocityTracker.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewConfiguration.ts\"/>\n///<reference path=\"ScaleGestureDetector.ts\"/>\n\n\nmodule android.view {\nimport Handler = android.os.Handler;\nimport Message = android.os.Message;\nimport MotionEvent = android.view.MotionEvent;\nimport VelocityTracker = android.view.VelocityTracker;\nimport View = android.view.View;\nimport ViewConfiguration = android.view.ViewConfiguration;\n/**\n * Detects various gestures and events using the supplied {@link MotionEvent}s.\n * The {@link OnGestureListener} callback will notify users when a particular\n * motion event has occurred. This class should only be used with {@link MotionEvent}s\n * reported via touch (don't use for trackball events).\n *\n * To use this class:\n * <ul>\n *  <li>Create an instance of the {@code GestureDetector} for your {@link View}\n *  <li>In the {@link View#onTouchEvent(MotionEvent)} method ensure you call\n *          {@link #onTouchEvent(MotionEvent)}. The methods defined in your callback\n *          will be executed when the events occur.\n * </ul>\n */\nexport class GestureDetector {\n\n\n\n\n\n\n\n    private mTouchSlopSquare:number = 0;\n\n    private mDoubleTapTouchSlopSquare:number = 0;\n\n    private mDoubleTapSlopSquare:number = 0;\n\n    private mMinimumFlingVelocity:number = 0;\n\n    private mMaximumFlingVelocity:number = 0;\n\n    private static LONGPRESS_TIMEOUT:number = ViewConfiguration.getLongPressTimeout();\n\n    private static TAP_TIMEOUT:number = ViewConfiguration.getTapTimeout();\n\n    private static DOUBLE_TAP_TIMEOUT:number = ViewConfiguration.getDoubleTapTimeout();\n\n    private static DOUBLE_TAP_MIN_TIME:number = ViewConfiguration.getDoubleTapMinTime();\n\n    // constants for Message.what used by GestureHandler below\n    private static SHOW_PRESS:number = 1;\n\n    private static LONG_PRESS:number = 2;\n\n    private static TAP:number = 3;\n\n    private mHandler:Handler;\n\n    private mListener:GestureDetector.OnGestureListener;\n\n    private mDoubleTapListener:GestureDetector.OnDoubleTapListener;\n\n    private mStillDown:boolean;\n\n    private mDeferConfirmSingleTap:boolean;\n\n    private mInLongPress:boolean;\n\n    private mAlwaysInTapRegion:boolean;\n\n    private mAlwaysInBiggerTapRegion:boolean;\n\n    private mCurrentDownEvent:MotionEvent;\n\n    private mPreviousUpEvent:MotionEvent;\n\n    /**\n     * True when the user is still touching for the second tap (down, move, and\n     * up events). Can only be true if there is a double tap listener attached.\n     */\n    private mIsDoubleTapping:boolean;\n\n    private mLastFocusX:number = 0;\n\n    private mLastFocusY:number = 0;\n\n    private mDownFocusX:number = 0;\n\n    private mDownFocusY:number = 0;\n\n    private mIsLongpressEnabled:boolean;\n\n    /**\n     * Determines speed during touch scrolling\n     */\n    private mVelocityTracker:VelocityTracker;\n\n    /**\n     * Consistency verifier for debugging purposes.\n     */\n    //private mInputEventConsistencyVerifier:InputEventConsistencyVerifier\n    // = InputEventConsistencyVerifier.isInstrumentationEnabled() ? new InputEventConsistencyVerifier(this, 0) : null;\n\n\n    /**\n     * Creates a GestureDetector with the supplied listener that runs deferred events on the\n     * thread associated with the supplied {@link android.os.Handler}.\n     * @see android.os.Handler#Handler()\n     *\n     * @param listener the listener invoked for all the callbacks, this must\n     * not be null.\n     * @param handler the handler to use for running deferred listener events.\n     *\n     * @throws NullPointerException if {@code listener} is null.\n     */\n    constructor(listener:GestureDetector.OnGestureListener, handler?) {\n        this.mHandler = new GestureDetector.GestureHandler(this);\n        this.mListener = listener;\n        if (listener['setOnDoubleTapListener']) {\n            this.setOnDoubleTapListener(<GestureDetector.OnDoubleTapListener><any>listener);\n        }\n        this.init();\n    }\n\n    private init():void  {\n        if (this.mListener == null) {\n            throw Error(`new NullPointerException(\"OnGestureListener must not be null\")`);\n        }\n        this.mIsLongpressEnabled = true;\n        // Fallback to support pre-donuts releases\n        let touchSlop:number, doubleTapSlop:number, doubleTapTouchSlop:number;\n        const configuration:ViewConfiguration = ViewConfiguration.get();\n        touchSlop = configuration.getScaledTouchSlop();\n        doubleTapTouchSlop = configuration.getScaledDoubleTapTouchSlop();\n        doubleTapSlop = configuration.getScaledDoubleTapSlop();\n        this.mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();\n        this.mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();\n        this.mTouchSlopSquare = touchSlop * touchSlop;\n        this.mDoubleTapTouchSlopSquare = doubleTapTouchSlop * doubleTapTouchSlop;\n        this.mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;\n    }\n\n    /**\n     * Sets the listener which will be called for double-tap and related\n     * gestures.\n     * \n     * @param onDoubleTapListener the listener invoked for all the callbacks, or\n     *        null to stop listening for double-tap gestures.\n     */\n    setOnDoubleTapListener(onDoubleTapListener:GestureDetector.OnDoubleTapListener):void  {\n        this.mDoubleTapListener = onDoubleTapListener;\n    }\n\n    /**\n     * Set whether longpress is enabled, if this is enabled when a user\n     * presses and holds down you get a longpress event and nothing further.\n     * If it's disabled the user can press and hold down and then later\n     * moved their finger and you will get scroll events. By default\n     * longpress is enabled.\n     *\n     * @param isLongpressEnabled whether longpress should be enabled.\n     */\n    setIsLongpressEnabled(isLongpressEnabled:boolean):void  {\n        this.mIsLongpressEnabled = isLongpressEnabled;\n    }\n\n    /**\n     * @return true if longpress is enabled, else false.\n     */\n    isLongpressEnabled():boolean  {\n        return this.mIsLongpressEnabled;\n    }\n\n    /**\n     * Analyzes the given motion event and if applicable triggers the\n     * appropriate callbacks on the {@link OnGestureListener} supplied.\n     *\n     * @param ev The current motion event.\n     * @return true if the {@link OnGestureListener} consumed the event,\n     *              else false.\n     */\n    onTouchEvent(ev:MotionEvent):boolean  {\n        //if (this.mInputEventConsistencyVerifier != null) {\n        //    this.mInputEventConsistencyVerifier.onTouchEvent(ev, 0);\n        //}\n        const action:number = ev.getAction();\n        if (this.mVelocityTracker == null) {\n            this.mVelocityTracker = VelocityTracker.obtain();\n        }\n        this.mVelocityTracker.addMovement(ev);\n        const pointerUp:boolean = (action & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP;\n        const skipIndex:number = pointerUp ? ev.getActionIndex() : -1;\n        // Determine focal point\n        let sumX:number = 0, sumY:number = 0;\n        const count:number = ev.getPointerCount();\n        for (let i:number = 0; i < count; i++) {\n            if (skipIndex == i)\n                continue;\n            sumX += ev.getX(i);\n            sumY += ev.getY(i);\n        }\n        const div:number = pointerUp ? count - 1 : count;\n        const focusX:number = sumX / div;\n        const focusY:number = sumY / div;\n        let handled:boolean = false;\n        switch(action & MotionEvent.ACTION_MASK) {\n            case MotionEvent.ACTION_POINTER_DOWN:\n                this.mDownFocusX = this.mLastFocusX = focusX;\n                this.mDownFocusY = this.mLastFocusY = focusY;\n                // Cancel long press and taps\n                this.cancelTaps();\n                break;\n            case MotionEvent.ACTION_POINTER_UP:\n                this.mDownFocusX = this.mLastFocusX = focusX;\n                this.mDownFocusY = this.mLastFocusY = focusY;\n                // Check the dot product of current velocities.\n                // If the pointer that left was opposing another velocity vector, clear.\n                this.mVelocityTracker.computeCurrentVelocity(1000, this.mMaximumFlingVelocity);\n                const upIndex:number = ev.getActionIndex();\n                const id1:number = ev.getPointerId(upIndex);\n                const x1:number = this.mVelocityTracker.getXVelocity(id1);\n                const y1:number = this.mVelocityTracker.getYVelocity(id1);\n                for (let i:number = 0; i < count; i++) {\n                    if (i == upIndex)\n                        continue;\n                    const id2:number = ev.getPointerId(i);\n                    const x:number = x1 * this.mVelocityTracker.getXVelocity(id2);\n                    const y:number = y1 * this.mVelocityTracker.getYVelocity(id2);\n                    const dot:number = x + y;\n                    if (dot < 0) {\n                        this.mVelocityTracker.clear();\n                        break;\n                    }\n                }\n                break;\n            case MotionEvent.ACTION_DOWN:\n                if (this.mDoubleTapListener != null) {\n                    let hadTapMessage:boolean = this.mHandler.hasMessages(GestureDetector.TAP);\n                    if (hadTapMessage)\n                        this.mHandler.removeMessages(GestureDetector.TAP);\n                    if ((this.mCurrentDownEvent != null) && (this.mPreviousUpEvent != null) && hadTapMessage && this.isConsideredDoubleTap(this.mCurrentDownEvent, this.mPreviousUpEvent, ev)) {\n                        // This is a second tap\n                        this.mIsDoubleTapping = true;\n                        // Give a callback with the first tap of the double-tap\n                        handled = this.mDoubleTapListener.onDoubleTap(this.mCurrentDownEvent) || handled;\n                        // Give a callback with down event of the double-tap\n                        handled = this.mDoubleTapListener.onDoubleTapEvent(ev) || handled;\n                    } else {\n                        // This is a first tap\n                        this.mHandler.sendEmptyMessageDelayed(GestureDetector.TAP, GestureDetector.DOUBLE_TAP_TIMEOUT);\n                    }\n                }\n                this.mDownFocusX = this.mLastFocusX = focusX;\n                this.mDownFocusY = this.mLastFocusY = focusY;\n                if (this.mCurrentDownEvent != null) {\n                    this.mCurrentDownEvent.recycle();\n                }\n                this.mCurrentDownEvent = MotionEvent.obtain(ev);\n                this.mAlwaysInTapRegion = true;\n                this.mAlwaysInBiggerTapRegion = true;\n                this.mStillDown = true;\n                this.mInLongPress = false;\n                this.mDeferConfirmSingleTap = false;\n                if (this.mIsLongpressEnabled) {\n                    this.mHandler.removeMessages(GestureDetector.LONG_PRESS);\n                    this.mHandler.sendEmptyMessageAtTime(GestureDetector.LONG_PRESS, this.mCurrentDownEvent.getDownTime() + GestureDetector.TAP_TIMEOUT + GestureDetector.LONGPRESS_TIMEOUT);\n                }\n                this.mHandler.sendEmptyMessageAtTime(GestureDetector.SHOW_PRESS, this.mCurrentDownEvent.getDownTime() + GestureDetector.TAP_TIMEOUT);\n                handled = this.mListener.onDown(ev) || handled;\n                break;\n            case MotionEvent.ACTION_MOVE:\n                if (this.mInLongPress) {\n                    break;\n                }\n                const scrollX:number = this.mLastFocusX - focusX;\n                const scrollY:number = this.mLastFocusY - focusY;\n                if (this.mIsDoubleTapping) {\n                    // Give the move events of the double-tap\n                    handled = this.mDoubleTapListener.onDoubleTapEvent(ev) || handled;\n                } else if (this.mAlwaysInTapRegion) {\n                    const deltaX:number = Math.floor((focusX - this.mDownFocusX));\n                    const deltaY:number = Math.floor((focusY - this.mDownFocusY));\n                    let distance:number = (deltaX * deltaX) + (deltaY * deltaY);\n                    if (distance > this.mTouchSlopSquare) {\n                        handled = this.mListener.onScroll(this.mCurrentDownEvent, ev, scrollX, scrollY);\n                        this.mLastFocusX = focusX;\n                        this.mLastFocusY = focusY;\n                        this.mAlwaysInTapRegion = false;\n                        this.mHandler.removeMessages(GestureDetector.TAP);\n                        this.mHandler.removeMessages(GestureDetector.SHOW_PRESS);\n                        this.mHandler.removeMessages(GestureDetector.LONG_PRESS);\n                    }\n                    if (distance > this.mDoubleTapTouchSlopSquare) {\n                        this.mAlwaysInBiggerTapRegion = false;\n                    }\n                } else if ((Math.abs(scrollX) >= 1) || (Math.abs(scrollY) >= 1)) {\n                    handled = this.mListener.onScroll(this.mCurrentDownEvent, ev, scrollX, scrollY);\n                    this.mLastFocusX = focusX;\n                    this.mLastFocusY = focusY;\n                }\n                break;\n            case MotionEvent.ACTION_UP:\n                this.mStillDown = false;\n                let currentUpEvent:MotionEvent = MotionEvent.obtain(ev);\n                if (this.mIsDoubleTapping) {\n                    // Finally, give the up event of the double-tap\n                    handled = this.mDoubleTapListener.onDoubleTapEvent(ev) || handled;\n                } else if (this.mInLongPress) {\n                    this.mHandler.removeMessages(GestureDetector.TAP);\n                    this.mInLongPress = false;\n                } else if (this.mAlwaysInTapRegion) {\n                    handled = this.mListener.onSingleTapUp(ev);\n                    if (this.mDeferConfirmSingleTap && this.mDoubleTapListener != null) {\n                        this.mDoubleTapListener.onSingleTapConfirmed(ev);\n                    }\n                } else {\n                    // A fling must travel the minimum tap distance\n                    const velocityTracker:VelocityTracker = this.mVelocityTracker;\n                    const pointerId:number = ev.getPointerId(0);\n                    velocityTracker.computeCurrentVelocity(1000, this.mMaximumFlingVelocity);\n                    const velocityY:number = velocityTracker.getYVelocity(pointerId);\n                    const velocityX:number = velocityTracker.getXVelocity(pointerId);\n                    if ((Math.abs(velocityY) > this.mMinimumFlingVelocity) || (Math.abs(velocityX) > this.mMinimumFlingVelocity)) {\n                        handled = this.mListener.onFling(this.mCurrentDownEvent, ev, velocityX, velocityY);\n                    }\n                }\n                if (this.mPreviousUpEvent != null) {\n                    this.mPreviousUpEvent.recycle();\n                }\n                // Hold the event we obtained above - listeners may have changed the original.\n                this.mPreviousUpEvent = currentUpEvent;\n                if (this.mVelocityTracker != null) {\n                    // This may have been cleared when we called out to the\n                    // application above.\n                    this.mVelocityTracker.recycle();\n                    this.mVelocityTracker = null;\n                }\n                this.mIsDoubleTapping = false;\n                this.mDeferConfirmSingleTap = false;\n                this.mHandler.removeMessages(GestureDetector.SHOW_PRESS);\n                this.mHandler.removeMessages(GestureDetector.LONG_PRESS);\n                break;\n            case MotionEvent.ACTION_CANCEL:\n                this.cancel();\n                break;\n        }\n        //if (!handled && this.mInputEventConsistencyVerifier != null) {\n        //    this.mInputEventConsistencyVerifier.onUnhandledEvent(ev, 0);\n        //}\n        return handled;\n    }\n\n    private cancel():void  {\n        this.mHandler.removeMessages(GestureDetector.SHOW_PRESS);\n        this.mHandler.removeMessages(GestureDetector.LONG_PRESS);\n        this.mHandler.removeMessages(GestureDetector.TAP);\n        this.mVelocityTracker.recycle();\n        this.mVelocityTracker = null;\n        this.mIsDoubleTapping = false;\n        this.mStillDown = false;\n        this.mAlwaysInTapRegion = false;\n        this.mAlwaysInBiggerTapRegion = false;\n        this.mDeferConfirmSingleTap = false;\n        if (this.mInLongPress) {\n            this.mInLongPress = false;\n        }\n    }\n\n    private cancelTaps():void  {\n        this.mHandler.removeMessages(GestureDetector.SHOW_PRESS);\n        this.mHandler.removeMessages(GestureDetector.LONG_PRESS);\n        this.mHandler.removeMessages(GestureDetector.TAP);\n        this.mIsDoubleTapping = false;\n        this.mAlwaysInTapRegion = false;\n        this.mAlwaysInBiggerTapRegion = false;\n        this.mDeferConfirmSingleTap = false;\n        if (this.mInLongPress) {\n            this.mInLongPress = false;\n        }\n    }\n\n    private isConsideredDoubleTap(firstDown:MotionEvent, firstUp:MotionEvent, secondDown:MotionEvent):boolean  {\n        if (!this.mAlwaysInBiggerTapRegion) {\n            return false;\n        }\n        const deltaTime:number = secondDown.getEventTime() - firstUp.getEventTime();\n        if (deltaTime > GestureDetector.DOUBLE_TAP_TIMEOUT || deltaTime < GestureDetector.DOUBLE_TAP_MIN_TIME) {\n            return false;\n        }\n        let deltaX:number = Math.floor(firstDown.getX()) - Math.floor(secondDown.getX());\n        let deltaY:number = Math.floor(firstDown.getY()) - Math.floor(secondDown.getY());\n        return (deltaX * deltaX + deltaY * deltaY < this.mDoubleTapSlopSquare);\n    }\n\n    private dispatchLongPress():void  {\n        this.mHandler.removeMessages(GestureDetector.TAP);\n        this.mDeferConfirmSingleTap = false;\n        this.mInLongPress = true;\n        this.mListener.onLongPress(this.mCurrentDownEvent);\n    }\n}\n\nexport module GestureDetector{\n/**\n     * The listener that is used to notify when gestures occur.\n     * If you want to listen for all the different gestures then implement\n     * this interface. If you only want to listen for a subset it might\n     * be easier to extend {@link SimpleOnGestureListener}.\n     */\nexport interface OnGestureListener {\n\n    /**\n         * Notified when a tap occurs with the down {@link MotionEvent}\n         * that triggered it. This will be triggered immediately for\n         * every down event. All other events should be preceded by this.\n         *\n         * @param e The down motion event.\n         */\n    onDown(e:MotionEvent):boolean ;\n\n    /**\n         * The user has performed a down {@link MotionEvent} and not performed\n         * a move or up yet. This event is commonly used to provide visual\n         * feedback to the user to let them know that their action has been\n         * recognized i.e. highlight an element.\n         *\n         * @param e The down motion event\n         */\n    onShowPress(e:MotionEvent):void ;\n\n    /**\n         * Notified when a tap occurs with the up {@link MotionEvent}\n         * that triggered it.\n         *\n         * @param e The up motion event that completed the first tap\n         * @return true if the event is consumed, else false\n         */\n    onSingleTapUp(e:MotionEvent):boolean ;\n\n    /**\n         * Notified when a scroll occurs with the initial on down {@link MotionEvent} and the\n         * current move {@link MotionEvent}. The distance in x and y is also supplied for\n         * convenience.\n         *\n         * @param e1 The first down motion event that started the scrolling.\n         * @param e2 The move motion event that triggered the current onScroll.\n         * @param distanceX The distance along the X axis that has been scrolled since the last\n         *              call to onScroll. This is NOT the distance between {@code e1}\n         *              and {@code e2}.\n         * @param distanceY The distance along the Y axis that has been scrolled since the last\n         *              call to onScroll. This is NOT the distance between {@code e1}\n         *              and {@code e2}.\n         * @return true if the event is consumed, else false\n         */\n    onScroll(e1:MotionEvent, e2:MotionEvent, distanceX:number, distanceY:number):boolean ;\n\n    /**\n         * Notified when a long press occurs with the initial on down {@link MotionEvent}\n         * that trigged it.\n         *\n         * @param e The initial on down motion event that started the longpress.\n         */\n    onLongPress(e:MotionEvent):void ;\n\n    /**\n         * Notified of a fling event when it occurs with the initial on down {@link MotionEvent}\n         * and the matching up {@link MotionEvent}. The calculated velocity is supplied along\n         * the x and y axis in pixels per second.\n         *\n         * @param e1 The first down motion event that started the fling.\n         * @param e2 The move motion event that triggered the current onFling.\n         * @param velocityX The velocity of this fling measured in pixels per second\n         *              along the x axis.\n         * @param velocityY The velocity of this fling measured in pixels per second\n         *              along the y axis.\n         * @return true if the event is consumed, else false\n         */\n    onFling(e1:MotionEvent, e2:MotionEvent, velocityX:number, velocityY:number):boolean ;\n}\n/**\n     * The listener that is used to notify when a double-tap or a confirmed\n     * single-tap occur.\n     */\nexport interface OnDoubleTapListener {\n\n    /**\n         * Notified when a single-tap occurs.\n         * <p>\n         * Unlike {@link OnGestureListener#onSingleTapUp(MotionEvent)}, this\n         * will only be called after the detector is confident that the user's\n         * first tap is not followed by a second tap leading to a double-tap\n         * gesture.\n         *\n         * @param e The down motion event of the single-tap.\n         * @return true if the event is consumed, else false\n         */\n    onSingleTapConfirmed(e:MotionEvent):boolean ;\n\n    /**\n         * Notified when a double-tap occurs.\n         *\n         * @param e The down motion event of the first tap of the double-tap.\n         * @return true if the event is consumed, else false\n         */\n    onDoubleTap(e:MotionEvent):boolean ;\n\n    /**\n         * Notified when an event within a double-tap gesture occurs, including\n         * the down, move, and up events.\n         *\n         * @param e The motion event that occurred during the double-tap gesture.\n         * @return true if the event is consumed, else false\n         */\n    onDoubleTapEvent(e:MotionEvent):boolean ;\n}\n/**\n     * A convenience class to extend when you only want to listen for a subset\n     * of all the gestures. This implements all methods in the\n     * {@link OnGestureListener} and {@link OnDoubleTapListener} but does\n     * nothing and return {@code false} for all applicable methods.\n     */\nexport class SimpleOnGestureListener implements GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener {\n\n    onSingleTapUp(e:MotionEvent):boolean  {\n        return false;\n    }\n\n    onLongPress(e:MotionEvent):void  {\n    }\n\n    onScroll(e1:MotionEvent, e2:MotionEvent, distanceX:number, distanceY:number):boolean  {\n        return false;\n    }\n\n    onFling(e1:MotionEvent, e2:MotionEvent, velocityX:number, velocityY:number):boolean  {\n        return false;\n    }\n\n    onShowPress(e:MotionEvent):void  {\n    }\n\n    onDown(e:MotionEvent):boolean  {\n        return false;\n    }\n\n    onDoubleTap(e:MotionEvent):boolean  {\n        return false;\n    }\n\n    onDoubleTapEvent(e:MotionEvent):boolean  {\n        return false;\n    }\n\n    onSingleTapConfirmed(e:MotionEvent):boolean  {\n        return false;\n    }\n}\nexport class GestureHandler extends Handler {\n    _GestureDetector_this:GestureDetector;\n    constructor(arg:GestureDetector){\n        super();\n        this._GestureDetector_this = arg;\n    }\n\n    handleMessage(msg:Message):void  {\n        switch(msg.what) {\n            case GestureDetector.SHOW_PRESS:\n                this._GestureDetector_this.mListener.onShowPress(this._GestureDetector_this.mCurrentDownEvent);\n                break;\n            case GestureDetector.LONG_PRESS:\n                this._GestureDetector_this.dispatchLongPress();\n                break;\n            case GestureDetector.TAP:\n                // If the user's finger is still down, do not count it as a tap\n                if (this._GestureDetector_this.mDoubleTapListener != null) {\n                    if (!this._GestureDetector_this.mStillDown) {\n                        this._GestureDetector_this.mDoubleTapListener.onSingleTapConfirmed(this._GestureDetector_this.mCurrentDownEvent);\n                    } else {\n                        this._GestureDetector_this.mDeferConfirmSingleTap = true;\n                    }\n                }\n                break;\n            default:\n                //never\n                throw Error(`new RuntimeException(\"Unknown message \" + msg)`);\n        }\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/view/Gravity.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../graphics/Rect.ts\"/>\n\nmodule android.view{\n    import Rect = android.graphics.Rect;\n\n    /**\n     * Standard constants and tools for placing an object within a potentially\n     * larger container.\n     */\n    export class Gravity{\n        /** Constant indicating that no gravity has been set **/\n        static NO_GRAVITY = 0x0000;\n\n        /** Raw bit indicating the gravity for an axis has been specified. */\n        static AXIS_SPECIFIED = 0x0001;\n\n        /** Raw bit controlling how the left/top edge is placed. */\n        static AXIS_PULL_BEFORE = 0x0002;\n        /** Raw bit controlling how the right/bottom edge is placed. */\n        static AXIS_PULL_AFTER = 0x0004;\n        /** Raw bit controlling whether the right/bottom edge is clipped to its\n         * container, based on the gravity direction being applied. */\n        static AXIS_CLIP = 0x0008;\n\n        /** Bits defining the horizontal axis. */\n        static AXIS_X_SHIFT = 0;\n        /** Bits defining the vertical axis. */\n        static AXIS_Y_SHIFT = 4;\n\n        /** Push object to the top of its container, not changing its size. */\n        static TOP = (Gravity.AXIS_PULL_BEFORE|Gravity.AXIS_SPECIFIED)<<Gravity.AXIS_Y_SHIFT;\n        /** Push object to the bottom of its container, not changing its size. */\n        static BOTTOM = (Gravity.AXIS_PULL_AFTER|Gravity.AXIS_SPECIFIED)<<Gravity.AXIS_Y_SHIFT;\n        /** Push object to the left of its container, not changing its size. */\n        static LEFT = (Gravity.AXIS_PULL_BEFORE|Gravity.AXIS_SPECIFIED)<<Gravity.AXIS_X_SHIFT;\n        /** Push object to the right of its container, not changing its size. */\n        static RIGHT = (Gravity.AXIS_PULL_AFTER|Gravity.AXIS_SPECIFIED)<<Gravity.AXIS_X_SHIFT;\n        static START = Gravity.LEFT;\n        static END = Gravity.RIGHT;\n\n        /** Place object in the vertical center of its container, not changing its\n         *  size. */\n        static CENTER_VERTICAL = Gravity.AXIS_SPECIFIED<<Gravity.AXIS_Y_SHIFT;\n        /** Grow the vertical size of the object if needed so it completely fills\n         *  its container. */\n        static FILL_VERTICAL = Gravity.TOP|Gravity.BOTTOM;\n\n        /** Place object in the horizontal center of its container, not changing its\n         *  size. */\n        static CENTER_HORIZONTAL = Gravity.AXIS_SPECIFIED<<Gravity.AXIS_X_SHIFT;\n        /** Grow the horizontal size of the object if needed so it completely fills\n         *  its container. */\n        static FILL_HORIZONTAL = Gravity.LEFT|Gravity.RIGHT;\n\n        /** Place the object in the center of its container in both the vertical\n         *  and horizontal axis, not changing its size. */\n        static CENTER = Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL;\n\n        /** Grow the horizontal and vertical size of the object if needed so it\n         *  completely fills its container. */\n        static FILL = Gravity.FILL_VERTICAL|Gravity.FILL_HORIZONTAL;\n\n        /** Flag to clip the edges of the object to its container along the\n         *  vertical axis. */\n        static CLIP_VERTICAL = Gravity.AXIS_CLIP<<Gravity.AXIS_Y_SHIFT;\n\n        /** Flag to clip the edges of the object to its container along the\n         *  horizontal axis. */\n        static CLIP_HORIZONTAL = Gravity.AXIS_CLIP<<Gravity.AXIS_X_SHIFT;\n\n        /** Raw bit controlling whether the layout direction is relative or not (Gravity.START/Gravity.END instead of\n         * absolute Gravity.LEFT/Gravity.RIGHT).\n         */\n        //static RELATIVE_LAYOUT_DIRECTION = 0x00800000;\n\n        /**\n         * Binary mask to get the absolute horizontal gravity of a gravity.\n         */\n        static HORIZONTAL_GRAVITY_MASK = (Gravity.AXIS_SPECIFIED |\n        Gravity.AXIS_PULL_BEFORE | Gravity.AXIS_PULL_AFTER) << Gravity.AXIS_X_SHIFT;\n        /**\n         * Binary mask to get the vertical gravity of a gravity.\n         */\n        static VERTICAL_GRAVITY_MASK = (Gravity.AXIS_SPECIFIED |\n            Gravity.AXIS_PULL_BEFORE | Gravity.AXIS_PULL_AFTER) << Gravity.AXIS_Y_SHIFT;\n\n        static RELATIVE_HORIZONTAL_GRAVITY_MASK = Gravity.HORIZONTAL_GRAVITY_MASK;\n\n        /** Special constant to enable clipping to an overall display along the\n         *  vertical dimension.  This is not applied by default by\n         *  {@link #apply(int, int, int, Rect, int, int, Rect)}; you must do so\n         *  yourself by calling {@link #applyDisplay}.\n         */\n        static DISPLAY_CLIP_VERTICAL = 0x10000000;\n\n        /** Special constant to enable clipping to an overall display along the\n         *  horizontal dimension.  This is not applied by default by\n         *  {@link #apply(int, int, int, Rect, int, int, Rect)}; you must do so\n         *  yourself by calling {@link #applyDisplay}.\n         */\n        static DISPLAY_CLIP_HORIZONTAL = 0x01000000;\n\n        /** Push object to x-axis position at the start of its container, not changing its size. */\n        //static START = Gravity.RELATIVE_LAYOUT_DIRECTION | Gravity.LEFT;\n\n        /** Push object to x-axis position at the end of its container, not changing its size. */\n        //static END = Gravity.RELATIVE_LAYOUT_DIRECTION | Gravity.RIGHT;\n\n        /**\n         * Binary mask for the horizontal gravity and script specific direction bit.\n         */\n        //static RELATIVE_HORIZONTAL_GRAVITY_MASK = Gravity.START | Gravity.END;\n\n        /**\n         * Apply a gravity constant to an object and take care if layout direction is RTL or not.\n         *\n         * @param gravity The desired placement of the object, as defined by the\n         *                constants in this class.\n         * @param w The horizontal size of the object.\n         * @param h The vertical size of the object.\n         * @param container The frame of the containing space, in which the object\n         *                  will be placed.  Should be large enough to contain the\n         *                  width and height of the object.\n         * @param outRect Receives the computed frame of the object in its\n         *                container.\n         * @param layoutDirection The layout direction.\n         *\n         * @see View#LAYOUT_DIRECTION_LTR\n         * @see View#LAYOUT_DIRECTION_RTL\n         */\n        static apply(gravity:number, w:number, h:number, container:Rect, outRect:Rect, layoutDirection?:number) {\n            let xAdj = 0, yAdj = 0;\n            if(layoutDirection!=null) gravity = Gravity.getAbsoluteGravity(gravity, layoutDirection);\n\n            switch (gravity & ((Gravity.AXIS_PULL_BEFORE | Gravity.AXIS_PULL_AFTER) << Gravity.AXIS_X_SHIFT)) {\n                case 0:\n                    outRect.left = container.left + ((container.right - container.left - w) / 2) + xAdj;\n                    outRect.right = outRect.left + w;\n                    if ((gravity & (Gravity.AXIS_CLIP << Gravity.AXIS_X_SHIFT)) == (Gravity.AXIS_CLIP << Gravity.AXIS_X_SHIFT)) {\n                        if (outRect.left < container.left) {\n                            outRect.left = container.left;\n                        }\n                        if (outRect.right > container.right) {\n                            outRect.right = container.right;\n                        }\n                    }\n                    break;\n                case Gravity.AXIS_PULL_BEFORE << Gravity.AXIS_X_SHIFT:\n                    outRect.left = container.left + xAdj;\n                    outRect.right = outRect.left + w;\n                    if ((gravity & (Gravity.AXIS_CLIP << Gravity.AXIS_X_SHIFT)) == (Gravity.AXIS_CLIP << Gravity.AXIS_X_SHIFT)) {\n                        if (outRect.right > container.right) {\n                            outRect.right = container.right;\n                        }\n                    }\n                    break;\n                case Gravity.AXIS_PULL_AFTER << Gravity.AXIS_X_SHIFT:\n                    outRect.right = container.right - xAdj;\n                    outRect.left = outRect.right - w;\n                    if ((gravity & (Gravity.AXIS_CLIP << Gravity.AXIS_X_SHIFT)) == (Gravity.AXIS_CLIP << Gravity.AXIS_X_SHIFT)) {\n                        if (outRect.left < container.left) {\n                            outRect.left = container.left;\n                        }\n                    }\n                    break;\n                default:\n                    outRect.left = container.left + xAdj;\n                    outRect.right = container.right + xAdj;\n                    break;\n            }\n            switch (gravity & ((Gravity.AXIS_PULL_BEFORE | Gravity.AXIS_PULL_AFTER) << Gravity.AXIS_Y_SHIFT)) {\n                case 0:\n                    outRect.top = container.top + ((container.bottom - container.top - h) / 2) + yAdj;\n                    outRect.bottom = outRect.top + h;\n                    if ((gravity & (Gravity.AXIS_CLIP << Gravity.AXIS_Y_SHIFT)) == (Gravity.AXIS_CLIP << Gravity.AXIS_Y_SHIFT)) {\n                        if (outRect.top < container.top) {\n                            outRect.top = container.top;\n                        }\n                        if (outRect.bottom > container.bottom) {\n                            outRect.bottom = container.bottom;\n                        }\n                    }\n                    break;\n                case Gravity.AXIS_PULL_BEFORE << Gravity.AXIS_Y_SHIFT:\n                    outRect.top = container.top + yAdj;\n                    outRect.bottom = outRect.top + h;\n                    if ((gravity & (Gravity.AXIS_CLIP << Gravity.AXIS_Y_SHIFT)) == (Gravity.AXIS_CLIP << Gravity.AXIS_Y_SHIFT)) {\n                        if (outRect.bottom > container.bottom) {\n                            outRect.bottom = container.bottom;\n                        }\n                    }\n                    break;\n                case Gravity.AXIS_PULL_AFTER << Gravity.AXIS_Y_SHIFT:\n                    outRect.bottom = container.bottom - yAdj;\n                    outRect.top = outRect.bottom - h;\n                    if ((gravity & (Gravity.AXIS_CLIP << Gravity.AXIS_Y_SHIFT)) == (Gravity.AXIS_CLIP << Gravity.AXIS_Y_SHIFT)) {\n                        if (outRect.top < container.top) {\n                            outRect.top = container.top;\n                        }\n                    }\n                    break;\n                default:\n                    outRect.top = container.top + yAdj;\n                    outRect.bottom = container.bottom + yAdj;\n                    break;\n            }\n        }\n\n        /**\n         * <p>Convert script specific gravity to absolute horizontal value.</p>\n         *\n         * if horizontal direction is LTR, then START will set LEFT and END will set RIGHT.\n         * if horizontal direction is RTL, then START will set RIGHT and END will set LEFT.\n         *\n         *\n         * @param gravity The gravity to convert to absolute (horizontal) values.\n         * @param layoutDirection The layout direction.\n         * @return gravity converted to absolute (horizontal) values.\n         */\n        static getAbsoluteGravity(gravity:number, layoutDirection?:number):number {\n            return gravity;//no need parse.\n        }\n\n        static parseGravity(gravityStr:string, defaultGravity=Gravity.NO_GRAVITY):number {\n            if(!gravityStr) return defaultGravity;\n            let gravity = null;\n            try {\n                let parts = gravityStr.split(\"|\");\n                for(let part of parts){\n                    let g = Gravity[part.toUpperCase()];\n                    if (Number.isInteger(g)) gravity |= g;\n                }\n            } catch (e) {\n                console.error(e);\n            }\n            if(Number.isNaN(gravity)) return defaultGravity;\n            return gravity;\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/HapticFeedbackConstants.ts",
    "content": "/*\n * Copyright (C) 2009 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/view/View.ts\"/>\n\nmodule android.view {\nimport View = android.view.View;\n/**\n * Constants to be used to perform haptic feedback effects via\n * {@link View#performHapticFeedback(int)} \n */\nexport class HapticFeedbackConstants {\n\n    /**\n     * The user has performed a long press on an object that is resulting\n     * in an action being performed.\n     */\n    static LONG_PRESS:number = 0;\n\n    /**\n     * The user has pressed on a virtual on-screen key.\n     */\n    static VIRTUAL_KEY:number = 1;\n\n    /**\n     * The user has pressed a soft keyboard key.\n     */\n    static KEYBOARD_TAP:number = 3;\n\n    /**\n     * This is a private constant.  Feel free to renumber as desired.\n     * @hide\n     */\n    static SAFE_MODE_DISABLED:number = 10000;\n\n    /**\n     * This is a private constant.  Feel free to renumber as desired.\n     * @hide\n     */\n    static SAFE_MODE_ENABLED:number = 10001;\n\n    /**\n     * Flag for {@link View#performHapticFeedback(int, int)\n     * View.performHapticFeedback(int, int)}: Ignore the setting in the\n     * view for whether to perform haptic feedback, do it always.\n     */\n    static FLAG_IGNORE_VIEW_SETTING:number = 0x0001;\n\n    /**\n     * Flag for {@link View#performHapticFeedback(int, int)\n     * View.performHapticFeedback(int, int)}: Ignore the global setting\n     * for whether to perform haptic feedback, do it always.\n     */\n    static FLAG_IGNORE_GLOBAL_SETTING:number = 0x0002;\n}\n}"
  },
  {
    "path": "src/android/view/KeyEvent.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../content/res/Resources.ts\"/>\n///<reference path=\"../graphics/Rect.ts\"/>\n///<reference path=\"../view/ViewConfiguration.ts\"/>\n///<reference path=\"../os/SystemClock.ts\"/>\n///<reference path=\"../util/Log.ts\"/>\n///<reference path=\"../../androidui/util/Platform.ts\"/>\n\nmodule android.view{\n    import Resources = android.content.res.Resources;\n    import Rect = android.graphics.Rect;\n    import ViewConfiguration = android.view.ViewConfiguration;\n    import SystemClock = android.os.SystemClock;\n    import Log = android.util.Log;\n    import Platform = androidui.util.Platform;\n\n    const DEBUG = false;\n    const TAG = \"KeyEvent\";\n\n\n    /**\n     * Object used to report key and button events.\n     * <p>\n     * Each key press is described by a sequence of key events.  A key press\n     * starts with a key event with {@link #ACTION_DOWN}.  If the key is held\n     * sufficiently long that it repeats, then the initial down is followed\n     * additional key events with {@link #ACTION_DOWN} and a non-zero value for\n     * {@link #getRepeatCount()}.  The last key event is a {@link #ACTION_UP}\n     * for the key up.  If the key press is canceled, the key up event will have the\n     * {@link #FLAG_CANCELED} flag set.\n     * </p><p>\n     * Key events are generally accompanied by a key code ({@link #getKeyCode()}),\n     * scan code ({@link #getScanCode()}) and meta state ({@link #getMetaState()}).\n     * Key code constants are defined in this class.  Scan code constants are raw\n     * device-specific codes obtained from the OS and so are not generally meaningful\n     * to applications unless interpreted using the {@link KeyCharacterMap}.\n     * Meta states describe the pressed state of key modifiers\n     * such as {@link #META_SHIFT_ON} or {@link #META_ALT_ON}.\n     * </p><p>\n     * Key codes typically correspond one-to-one with individual keys on an input device.\n     * Many keys and key combinations serve quite different functions on different\n     * input devices so care must be taken when interpreting them.  Always use the\n     * {@link KeyCharacterMap} associated with the input device when mapping keys\n     * to characters.  Be aware that there may be multiple key input devices active\n     * at the same time and each will have its own key character map.\n     * </p><p>\n     * As soft input methods can use multiple and inventive ways of inputting text,\n     * there is no guarantee that any key press on a soft keyboard will generate a key\n     * event: this is left to the IME's discretion, and in fact sending such events is\n     * discouraged.  You should never rely on receiving KeyEvents for any key on a soft\n     * input method.  In particular, the default software keyboard will never send any\n     * key event to any application targetting Jelly Bean or later, and will only send\n     * events for some presses of the delete and return keys to applications targetting\n     * Ice Cream Sandwich or earlier.  Be aware that other software input methods may\n     * never send key events regardless of the version.  Consider using editor actions\n     * like {@link android.view.inputmethod.EditorInfo#IME_ACTION_DONE} if you need\n     * specific interaction with the software keyboard, as it gives more visibility to\n     * the user as to how your application will react to key presses.\n     * </p><p>\n     * When interacting with an IME, the framework may deliver key events\n     * with the special action {@link #ACTION_MULTIPLE} that either specifies\n     * that single repeated key code or a sequence of characters to insert.\n     * </p><p>\n     * In general, the framework cannot guarantee that the key events it delivers\n     * to a view always constitute complete key sequences since some events may be dropped\n     * or modified by containing views before they are delivered.  The view implementation\n     * should be prepared to handle {@link #FLAG_CANCELED} and should tolerate anomalous\n     * situations such as receiving a new {@link #ACTION_DOWN} without first having\n     * received an {@link #ACTION_UP} for the prior key press.\n     * </p><p>\n     * Refer to {@link InputDevice} for more information about how different kinds of\n     * input devices and sources represent keys and buttons.\n     * </p>\n     * \n     * AndroidUI NOTE: some impl modified;\n     */\n    export class KeyEvent{\n        /** Key code constant: Directional Pad Up key.\n         * May also be synthesized from trackball motions. */\n        static KEYCODE_DPAD_UP         = 38;\n        /** Key code constant: Directional Pad Down key.\n         * May also be synthesized from trackball motions. */\n        static KEYCODE_DPAD_DOWN       = 40;\n        /** Key code constant: Directional Pad Left key.\n         * May also be synthesized from trackball motions. */\n        static KEYCODE_DPAD_LEFT       = 37;\n        /** Key code constant: Directional Pad Right key.\n         * May also be synthesized from trackball motions. */\n        static KEYCODE_DPAD_RIGHT      = 39;\n        /** Key code constant: Directional Pad Center key.\n         * May also be synthesized from trackball motions. */\n        static KEYCODE_DPAD_CENTER     = 13;\n        /** Key code constant: Enter key. */\n        static KEYCODE_ENTER           = 13;\n        /** Key code constant: Tab key. */\n        static KEYCODE_TAB             = 9;\n        /** Key code constant: Space key. */\n        static KEYCODE_SPACE           = 32;\n        /** Key code constant: Escape key. */\n        static KEYCODE_ESCAPE          = 27;\n        static KEYCODE_Backspace          = 8;\n        static KEYCODE_PAGE_UP          = 33;\n        static KEYCODE_PAGE_DOWN          = 34;\n        static KEYCODE_MOVE_HOME          = 36;\n        static KEYCODE_MOVE_END          = 35;\n\n\n        static KEYCODE_Digit0          = 48;//'0'\n        static KEYCODE_Digit1          = 49;//'1'\n        static KEYCODE_Digit2          = 50;//'2'\n        static KEYCODE_Digit3          = 51;//'3'\n        static KEYCODE_Digit4          = 52;//'4'\n        static KEYCODE_Digit5          = 53;//'5'\n        static KEYCODE_Digit6          = 54;//'6'\n        static KEYCODE_Digit7          = 55;//'7'\n        static KEYCODE_Digit8          = 56;//'8'\n        static KEYCODE_Digit9          = 57;//'9'\n\n        static KEYCODE_Key_a            = 65;//'a'\n        static KEYCODE_Key_b            = 66;//'b'\n        static KEYCODE_Key_c            = 67;//'c'\n        static KEYCODE_Key_d            = 68;//'d'\n        static KEYCODE_Key_e            = 69;//'e'\n        static KEYCODE_Key_f            = 70;//'f'\n        static KEYCODE_Key_g            = 71;//'g'\n        static KEYCODE_Key_h            = 72;//'h'\n        static KEYCODE_Key_i            = 73;//'i'\n        static KEYCODE_Key_j            = 74;//'j'\n        static KEYCODE_Key_k            = 75;//'k'\n        static KEYCODE_Key_l            = 76;//'l'\n        static KEYCODE_Key_m            = 77;//'m'\n        static KEYCODE_Key_n            = 78;//'n'\n        static KEYCODE_Key_o            = 79;//'o'\n        static KEYCODE_Key_p            = 80;//'p'\n        static KEYCODE_Key_q            = 81;//'q'\n        static KEYCODE_Key_r            = 82;//'r'\n        static KEYCODE_Key_s            = 83;//'s'\n        static KEYCODE_Key_t            = 84;//'t'\n        static KEYCODE_Key_u            = 85;//'u'\n        static KEYCODE_Key_v            = 86;//'v'\n        static KEYCODE_Key_w            = 87;//'w'\n        static KEYCODE_Key_x            = 88;//'x'\n        static KEYCODE_Key_y            = 89;//'y'\n        static KEYCODE_Key_z            = 90;//'z'\n        static KEYCODE_KeyA            = 0x41;//65 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'A'\n        static KEYCODE_KeyB            = 0x42;//66 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'B'\n        static KEYCODE_KeyC            = 0x43;//67 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'C'\n        static KEYCODE_KeyD            = 0x44;//68 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'D'\n        static KEYCODE_KeyE            = 0x45;//69 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'E'\n        static KEYCODE_KeyF            = 0x46;//70 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'F'\n        static KEYCODE_KeyG            = 0x47;//71 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'G'\n        static KEYCODE_KeyH            = 0x48;//72 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'H'\n        static KEYCODE_KeyI            = 0x49;//73 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'I'\n        static KEYCODE_KeyJ            = 0x4a;//74 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'J'\n        static KEYCODE_KeyK            = 0x4b;//75 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'K'\n        static KEYCODE_KeyL            = 0x4c;//76 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'L'\n        static KEYCODE_KeyM            = 0x4d;//77 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'M'\n        static KEYCODE_KeyN            = 0x4e;//78 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'N'\n        static KEYCODE_KeyO            = 0x4f;//79 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'O'\n        static KEYCODE_KeyP            = 0x50;//80 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'P'\n        static KEYCODE_KeyQ            = 0x51;//81 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'Q'\n        static KEYCODE_KeyR            = 0x52;//82 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'R'\n        static KEYCODE_KeyS            = 0x53;//83 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'S'\n        static KEYCODE_KeyT            = 0x54;//84 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'T'\n        static KEYCODE_KeyU            = 0x55;//85 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'U'\n        static KEYCODE_KeyV            = 0x56;//86 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'V'\n        static KEYCODE_KeyW            = 0x57;//87 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'W'\n        static KEYCODE_KeyX            = 0x58;//88 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'X'\n        static KEYCODE_KeyY            = 0x59;//89 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'Y'\n        static KEYCODE_KeyZ            = 0x5a;//90 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'Z'\n\n        static KEYCODE_Semicolon       = 0x3b;//';'\n        static KEYCODE_LessThan        = 0x3c;//'<'\n        static KEYCODE_Equal           = 0x3d;//'='\n        static KEYCODE_MoreThan        = 0x3e;//'>'\n        static KEYCODE_Question        = 0x3f;//'?'\n        static KEYCODE_Comma           = 0x2c;//','\n        static KEYCODE_Period          = 0x2e;//'.'\n        static KEYCODE_Slash           = 0x2f;//'/'\n        static KEYCODE_Quotation       = 0x27;//'''\n        static KEYCODE_LeftBracket     = 0x5b;//'['\n        static KEYCODE_Backslash       = 0x5c;//'\\'\n        static KEYCODE_RightBracket    = 0x5d;//']'\n        static KEYCODE_Minus           = 0x2d;//'-'\n        static KEYCODE_Colon           = 0x3a;//':'\n\n        static KEYCODE_Double_Quotation= 0x22;//'\"'\n        static KEYCODE_Backquote       = 0x60;//'`'\n        static KEYCODE_Tilde           = 0x7e;//'~'\n        static KEYCODE_Left_Brace      = 0x7b;//'{'\n        static KEYCODE_Or              = 0x7c;//'|'\n        static KEYCODE_Right_Brace     = 0x7d;//'}'\n        static KEYCODE_Del             = 0x7f;//'Del'\n\n        static KEYCODE_Exclamation      = 0x21;//KeyEvent.KEYCODE_Digit1 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'!'(shift + '1')\n        static KEYCODE_Right_Parenthesis= 0x29;//KeyEvent.KEYCODE_Digit0 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//')'(shift + '0')\n        static KEYCODE_AT               = 0x40;//KeyEvent.KEYCODE_Digit2 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'@'(shift + '2')\n        static KEYCODE_Sharp            = 0x23;//KeyEvent.KEYCODE_Digit3 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'#'(shift + '3')\n        static KEYCODE_Dollar           = 0x24;//KeyEvent.KEYCODE_Digit4 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'$'(shift + '4')\n        static KEYCODE_Percent          = 0x25;//KeyEvent.KEYCODE_Digit5 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'%'(shift + '5')\n        static KEYCODE_Power            = 0x5e;//KeyEvent.KEYCODE_Digit6 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'^'(shift + '6')\n        static KEYCODE_And              = 0x26;//KeyEvent.KEYCODE_Digit7 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'&'(shift + '7')\n        static KEYCODE_Asterisk         = 0x2a;//KeyEvent.KEYCODE_Digit8 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'*'(shift + '8')\n        static KEYCODE_Left_Parenthesis = 0x28;//KeyEvent.KEYCODE_Digit9 & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'('(shift + '9')\n        static KEYCODE_Underline        = 0x5f;//KeyEvent.KEYCODE_Minus & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'_'(shift + '－')\n        static KEYCODE_Add              = 0x2b;//KeyEvent.KEYCODE_Equal & (KeyEvent.META_SHIFT_ON << KeyEvent.META_MASK_SHIFT);//'+'(shift + '=')\n\n        //can't listen back on browser\n        static KEYCODE_BACK          = -1;\n        //can't listen menu on browser\n        static KEYCODE_MENU          = -2;\n\n        static KEYCODE_CHANGE_ANDROID_CHROME = {\n            noMeta : {\n                186: KeyEvent.KEYCODE_Semicolon,//';'\n                187: KeyEvent.KEYCODE_Equal,//'='\n                188: KeyEvent.KEYCODE_Comma,//','\n                189: KeyEvent.KEYCODE_Minus,//'-'\n                190: KeyEvent.KEYCODE_Period,//'.'\n                191: KeyEvent.KEYCODE_Slash,//'/'\n                192: KeyEvent.KEYCODE_Quotation,//'''\n                //192: KeyEvent.KEYCODE_Backquote,//'`'\n                219: KeyEvent.KEYCODE_LeftBracket,//'['\n                220: KeyEvent.KEYCODE_Backslash,//'\\'\n                221: KeyEvent.KEYCODE_RightBracket,//']'\n            },\n            shift : {\n                186: KeyEvent.KEYCODE_Colon,//':'\n                187: KeyEvent.KEYCODE_Add,//'+'\n                188: KeyEvent.KEYCODE_LessThan,//'<'\n                189: KeyEvent.KEYCODE_Underline,//'_'\n                190: KeyEvent.KEYCODE_MoreThan,//'>'\n                191: KeyEvent.KEYCODE_Question,//'?'\n                192: KeyEvent.KEYCODE_Double_Quotation,//'\"'\n                //192: KeyEvent.KEYCODE_Tilde,//'~'\n                219: KeyEvent.KEYCODE_Left_Brace,//'{'\n                220: KeyEvent.KEYCODE_Or,//'|'\n                221: KeyEvent.KEYCODE_Right_Brace,//'}'\n            },\n            ctrl : {},\n            alt : {}\n            //TODO more code\n        };\n\n        private static FIX_MAP_KEYCODE = {\n            186: KeyEvent.KEYCODE_Semicolon, // ;\n            187: KeyEvent.KEYCODE_Equal, // =\n            188: KeyEvent.KEYCODE_Comma, // ,\n            189: KeyEvent.KEYCODE_Minus, // -\n            190: KeyEvent.KEYCODE_Period, // .\n            191: KeyEvent.KEYCODE_Slash, // /\n            192: KeyEvent.KEYCODE_Backquote, // `\n            219: KeyEvent.KEYCODE_LeftBracket, // [\n            220: KeyEvent.KEYCODE_Backslash, // \\\n            221: KeyEvent.KEYCODE_RightBracket, // ]\n            222: KeyEvent.KEYCODE_Quotation, // '\n            //numeric keypad\n            96: KeyEvent.KEYCODE_Digit0,\n            97: KeyEvent.KEYCODE_Digit1,\n            98: KeyEvent.KEYCODE_Digit2,\n            99: KeyEvent.KEYCODE_Digit3,\n            100: KeyEvent.KEYCODE_Digit4,\n            101: KeyEvent.KEYCODE_Digit5,\n            102: KeyEvent.KEYCODE_Digit6,\n            103: KeyEvent.KEYCODE_Digit7,\n            104: KeyEvent.KEYCODE_Digit8,\n            105: KeyEvent.KEYCODE_Digit9\n        };\n\n\n\n        /**\n         * {@link #getAction} value: the key has been pressed down.\n         */\n        static ACTION_DOWN             = 0;\n        /**\n         * {@link #getAction} value: the key has been released.\n         */\n        static ACTION_UP               = 1;\n        /**\n         * {@link #getAction} value: multiple duplicate key events have\n         * occurred in a row, or a complex string is being delivered.  If the\n         * key code is not {#link {@link #KEYCODE_UNKNOWN} then the\n         * {#link {@link #getRepeatCount()} method returns the number of times\n         * the given key code should be executed.\n         * Otherwise, if the key code is {@link #KEYCODE_UNKNOWN}, then\n         * this is a sequence of characters as returned by {@link #getCharacters}.\n         */\n        //static ACTION_MULTIPLE         = 2;\n\n\n        static META_MASK_SHIFT:number = 16;\n        static META_ALT_ON:number = 0x02;\n        static META_SHIFT_ON:number = 0x1;\n        static META_CTRL_ON:number = 0x1000;\n        static META_META_ON:number = 0x10000;\n\n        static FLAG_CANCELED = 0x20;\n        static FLAG_CANCELED_LONG_PRESS = 0x100;\n        private static FLAG_LONG_PRESS = 0x80;\n        static FLAG_TRACKING = 0x200;\n        private static FLAG_START_TRACKING = 0x40000000;\n        mFlags:number;\n\n        private mAction : number;\n        private mKeyCode : number;\n        private mDownTime : number;\n        private mEventTime : number;\n        private mAltKey : boolean;\n        private mShiftKey : boolean;\n        private mCtrlKey : boolean;\n        private mMetaKey : boolean;\n\n\n        protected mIsTypingKey:boolean;\n        //private _activeKeyEvent : KeyboardEvent;\n        private _downingKeyEventMap = new Map<number, KeyboardEvent[]>();\n\n        static obtain(action:number, code:number):KeyEvent  {\n            let ev:KeyEvent = new KeyEvent();\n            ev.mDownTime = SystemClock.uptimeMillis();\n            ev.mEventTime = SystemClock.uptimeMillis();\n            ev.mAction = action;\n            ev.mKeyCode = code;\n            //ev.mRepeatCount = repeat;\n            //ev.mMetaState = metaState;\n            //ev.mDeviceId = deviceId;\n            //ev.mScanCode = scancode;\n            //ev.mFlags = flags;\n            //ev.mSource = source;\n            //ev.mCharacters = characters;\n            return ev;\n        }\n\n        initKeyEvent(keyEvent:KeyboardEvent, action:number){\n            this.mEventTime = SystemClock.uptimeMillis();\n            this.mKeyCode = keyEvent.keyCode;\n            this.mAltKey = keyEvent.altKey;\n            this.mShiftKey = keyEvent.shiftKey;\n            this.mCtrlKey = keyEvent.ctrlKey;\n            this.mMetaKey = keyEvent.metaKey;\n\n            let keyIdentifier = keyEvent['keyIdentifier']+'';\n            if(keyIdentifier){\n                this.mIsTypingKey = keyIdentifier.startsWith('U+');//use for check should level touch mode\n                if(this.mIsTypingKey){\n                    this.mKeyCode = Number.parseInt(keyIdentifier.substr(2), 16) || this.mKeyCode;\n                }\n            }\n\n            //TODO check caps lock\n            //a ==> A, b ==> B, ...\n            if(this.mKeyCode>=KeyEvent.KEYCODE_Key_a && this.mKeyCode<=KeyEvent.KEYCODE_Key_z\n                && this.mShiftKey && !this.mCtrlKey && !this.mAltKey && !this.mMetaKey){\n                this.mKeyCode -= 32;\n            }\n            //A ==> a, B ==> a, ...\n            if(this.mKeyCode>=KeyEvent.KEYCODE_KeyA && this.mKeyCode<=KeyEvent.KEYCODE_KeyZ\n                && !this.mShiftKey && !this.mCtrlKey && !this.mAltKey && !this.mMetaKey){\n                this.mKeyCode += 32;\n            }\n            //key code convert in android chrome\n            if(Platform.isAndroid){\n                if(!this.mShiftKey && !this.mCtrlKey && !this.mAltKey && !this.mMetaKey){\n                    this.mKeyCode = KeyEvent.KEYCODE_CHANGE_ANDROID_CHROME.noMeta[this.mKeyCode] || this.mKeyCode;\n\n                }else if(this.mShiftKey && !this.mCtrlKey && !this.mAltKey && !this.mMetaKey){\n                    this.mKeyCode = KeyEvent.KEYCODE_CHANGE_ANDROID_CHROME.shift[this.mKeyCode] || this.mKeyCode;\n\n                }else if(!this.mShiftKey && this.mCtrlKey && !this.mAltKey && !this.mMetaKey){\n                    this.mKeyCode = KeyEvent.KEYCODE_CHANGE_ANDROID_CHROME.ctrl[this.mKeyCode] || this.mKeyCode;\n\n                }else if(!this.mShiftKey && !this.mCtrlKey && this.mAltKey && !this.mMetaKey){\n                    this.mKeyCode = KeyEvent.KEYCODE_CHANGE_ANDROID_CHROME.alt[this.mKeyCode] || this.mKeyCode;\n\n                }\n            }\n\n            // fix map key code\n            this.mKeyCode = KeyEvent.FIX_MAP_KEYCODE[this.mKeyCode] || this.mKeyCode;\n\n            if(action === KeyEvent.ACTION_DOWN){\n                this.mDownTime = SystemClock.uptimeMillis();\n\n                let keyEvents = this._downingKeyEventMap.get(keyEvent.keyCode);\n                if(keyEvents == null){\n                    keyEvents = [];\n                    this._downingKeyEventMap.set(keyEvent.keyCode, keyEvents);\n                }\n                keyEvents.push(keyEvent);\n\n            }else if(action === KeyEvent.ACTION_UP){\n                this._downingKeyEventMap.delete(keyEvent.keyCode);\n            }\n\n            this.mAction = action;\n\n\n        }\n\n\n        /** Whether key will, by default, trigger a click on the focused view.\n         * @hide\n         */\n        static isConfirmKey(keyCode:number):boolean {\n            switch (keyCode) {\n            case KeyEvent.KEYCODE_DPAD_CENTER:\n            case KeyEvent.KEYCODE_ENTER:\n                return true;\n            default:\n                return false;\n            }\n        }\n\n        isAltPressed():boolean{\n            return this.mAltKey;\n        }\n\n        isShiftPressed():boolean{\n            return this.mShiftKey;\n        }\n\n        isCtrlPressed():boolean{\n            return this.mCtrlKey;\n        }\n\n        isMetaPressed():boolean{\n            return this.mMetaKey;\n        }\n\n        /**\n         * Retrieve the action of this key event.  May be either\n         * {@link #ACTION_DOWN}, {@link #ACTION_UP}\n         *\n         * @return The event action: ACTION_DOWN or ACTION_UP.\n         */\n        getAction():number {\n            return this.mAction;\n        }\n\n\n        /**\n         * Call this during {@link Callback#onKeyDown} to have the system track\n         * the key through its final up (possibly including a long press).  Note\n         * that only one key can be tracked at a time -- if another key down\n         * event is received while a previous one is being tracked, tracking is\n         * stopped on the previous event.\n         */\n        startTracking():void {\n            this.mFlags |= KeyEvent.FLAG_START_TRACKING;\n        }\n\n\n        /**\n         * For {@link #ACTION_UP} events, indicates that the event is still being\n         * tracked from its initial down event as per\n         * {@link #FLAG_TRACKING}.\n         */\n        isTracking():boolean {\n            return (this.mFlags&KeyEvent.FLAG_TRACKING) != 0;\n        }\n\n\n        /**\n         * For {@link #ACTION_DOWN} events, indicates that the event has been\n         * canceled as per {@link #FLAG_LONG_PRESS}.\n         */\n        isLongPress() {\n            return this.getRepeatCount()===1;\n        }\n\n        getKeyCode():number {\n            return this.mKeyCode;\n        }\n\n        /**\n         * Retrieve the repeat count of the event.  For both key up and key down\n         * events, this is the number of times the key has repeated with the first\n         * down starting at 0 and counting up from there.  For multiple key\n         * events, this is the number of down/up pairs that have occurred.\n         *\n         * @return The number of times the key has repeated.\n         */\n        getRepeatCount() {\n            let downArray = this._downingKeyEventMap.get(this.mKeyCode);\n            return downArray ? downArray.length-1 : 0;\n        }\n\n        /**\n         * Retrieve the time of the most recent key down event,\n         * in the {@link android.os.SystemClock#uptimeMillis} time base.  If this\n         * is a down event, this will be the same as {@link #getEventTime()}.\n         * Note that when chording keys, this value is the down time of the\n         * most recently pressed key, which may <em>not</em> be the same physical\n         * key of this event.\n         *\n         * @return Returns the most recent key down time, in the\n         * {@link android.os.SystemClock#uptimeMillis} time base\n         */\n        getDownTime():number {\n            return this.mDownTime;\n        }\n\n        /**\n         * Retrieve the time this event occurred,\n         * in the {@link android.os.SystemClock#uptimeMillis} time base.\n         *\n         * @return Returns the time this event occurred,\n         * in the {@link android.os.SystemClock#uptimeMillis} time base.\n         */\n        getEventTime():number {\n            return this.mEventTime;\n        }\n\n\n        /**\n         * Deliver this key event to a {@link Callback} interface.  If this is\n         * an ACTION_MULTIPLE event and it is not handled, then an attempt will\n         * be made to deliver a single normal event.\n         *\n         * @param receiver The Callback that will be given the event.\n         * @param state State information retained across events.\n         * @param target The target of the dispatch, for use in tracking.\n         *\n         * @return The return value from the Callback method that was called.\n         */\n        dispatch(receiver:KeyEvent.Callback, state?:KeyEvent.DispatcherState, target?:any):boolean{\n            switch (this.mAction) {\n                case KeyEvent.ACTION_DOWN: {\n                    this.mFlags &= ~KeyEvent.FLAG_START_TRACKING;\n                    if (DEBUG) Log.v(TAG, \"Key down to \" + target + \" in \" + state\n                        + \": \" + this);\n                    let res = receiver.onKeyDown(this.getKeyCode(), this);\n                    if (state != null) {\n                        if (res && this.getRepeatCount() == 0 && (this.mFlags&KeyEvent.FLAG_START_TRACKING) != 0) {\n                            if (DEBUG) Log.v(TAG, \"  Start tracking!\");\n                            state.startTracking(this, target);\n                        } else if (this.isLongPress() && state.isTracking(this)) {\n                            if (receiver.onKeyLongPress(this.getKeyCode(), this)) {\n                                if (DEBUG) Log.v(TAG, \"  Clear from long press!\");\n                                state.performedLongPress(this);\n                                res = true;\n                            }\n                        }\n                    }\n                    return res;\n                }\n                case KeyEvent.ACTION_UP:\n                    if (DEBUG) Log.v(TAG, \"Key up to \" + target + \" in \" + state\n                        + \": \" + this);\n                    if (state != null) {\n                        state.handleUpEvent(this);\n                    }\n                    return receiver.onKeyUp(this.getKeyCode(), this);\n                //case ACTION_MULTIPLE:\n                //    final int count = mRepeatCount;\n                //    final int code = mKeyCode;\n                //    if (receiver.onKeyMultiple(code, count, this)) {\n                //        return true;\n                //    }\n                //    if (code != KeyEvent.KEYCODE_UNKNOWN) {\n                //        mAction = ACTION_DOWN;\n                //        mRepeatCount = 0;\n                //        boolean handled = receiver.onKeyDown(code, this);\n                //        if (handled) {\n                //            mAction = ACTION_UP;\n                //            receiver.onKeyUp(code, this);\n                //        }\n                //        mAction = ACTION_MULTIPLE;\n                //        mRepeatCount = count;\n                //        return handled;\n                //    }\n                //    return false;\n            }\n            return false;\n        }\n\n        hasNoModifiers(){\n            if(this.isAltPressed()) return false;\n            if(this.isShiftPressed()) return false;\n            if(this.isCtrlPressed()) return false;\n            if(this.isMetaPressed()) return false;\n            return true;\n        }\n        hasModifiers(modifiers:number){\n            if( (modifiers & KeyEvent.META_ALT_ON)===KeyEvent.META_ALT_ON && this.isAltPressed()) return true;\n            if( (modifiers & KeyEvent.META_SHIFT_ON)===KeyEvent.META_SHIFT_ON && this.isShiftPressed()) return true;\n            if( (modifiers & KeyEvent.META_META_ON)===KeyEvent.META_META_ON && this.isMetaPressed()) return true;\n            if( (modifiers & KeyEvent.META_CTRL_ON)===KeyEvent.META_CTRL_ON && this.isCtrlPressed()) return true;\n        }\n        getMetaState():number {\n            let meta = 0;\n            if(this.isAltPressed()) meta |= KeyEvent.META_ALT_ON;\n            if(this.isShiftPressed()) meta |= KeyEvent.META_SHIFT_ON;\n            if(this.isCtrlPressed()) meta |= KeyEvent.META_CTRL_ON;\n            if(this.isMetaPressed()) meta |= KeyEvent.META_META_ON;\n            return meta;\n        }\n\n        toString() {\n            return JSON.stringify(this);\n        }\n\n        isCanceled():boolean {\n            return false;\n        }\n\n        static actionToString(action:number):string {\n            switch (action) {\n                case KeyEvent.ACTION_DOWN:\n                    return \"ACTION_DOWN\";\n                case KeyEvent.ACTION_UP:\n                    return \"ACTION_UP\";\n                //case ACTION_MULTIPLE:\n                //    return \"ACTION_MULTIPLE\";\n                default:\n                    return '' + (action);\n            }\n        }\n\n        static keyCodeToString(keyCode:number):string {\n            return String.fromCharCode(keyCode);\n        }\n\n    }\n\n    export module KeyEvent{\n        export interface Callback{\n            /**\n             * Called when a key down event has occurred.  If you return true,\n             * you can first call {@link KeyEvent#startTracking()\n         * KeyEvent.startTracking()} to have the framework track the event\n             * through its {@link #onKeyUp(int, KeyEvent)} and also call your\n             * {@link #onKeyLongPress(int, KeyEvent)} if it occurs.\n             *\n             * @param keyCode The value in event.getKeyCode().\n             * @param event Description of the key event.\n             *\n             * @return If you handled the event, return true.  If you want to allow\n             *         the event to be handled by the next receiver, return false.\n             */\n            onKeyDown(keyCode:number, event:KeyEvent):boolean;\n\n            /**\n             * Called when a long press has occurred.  If you return true,\n             * the final key up will have {@link KeyEvent#FLAG_CANCELED} and\n             * {@link KeyEvent#FLAG_CANCELED_LONG_PRESS} set.  Note that in\n             * order to receive this callback, someone in the event change\n             * <em>must</em> return true from {@link #onKeyDown} <em>and</em>\n             * call {@link KeyEvent#startTracking()} on the event.\n             *\n             * @param keyCode The value in event.getKeyCode().\n             * @param event Description of the key event.\n             *\n             * @return If you handled the event, return true.  If you want to allow\n             *         the event to be handled by the next receiver, return false.\n             */\n            onKeyLongPress(keyCode:number, event:KeyEvent):boolean;\n\n            /**\n             * Called when a key up event has occurred.\n             *\n             * @param keyCode The value in event.getKeyCode().\n             * @param event Description of the key event.\n             *\n             * @return If you handled the event, return true.  If you want to allow\n             *         the event to be handled by the next receiver, return false.\n             */\n            onKeyUp(keyCode:number, event:KeyEvent):boolean;\n        }\n\n        export class DispatcherState{\n            mDownKeyCode:number;\n            mDownTarget:any;\n            mActiveLongPresses = new android.util.SparseArray<number>();\n\n            /**\n             * Reset back to initial state.\n             * Stop any tracking associated with this target.\n             */\n            reset(target:any) {\n                if(target==null) {\n                    if (DEBUG) Log.v(TAG, \"Reset: \" + this);\n                    this.mDownKeyCode = 0;\n                    this.mDownTarget = null;\n                    this.mActiveLongPresses.clear();\n                }else{\n                    if (this.mDownTarget == target) {\n                        if (DEBUG) Log.v(TAG, \"Reset in \" + target + \": \" + this);\n                        this.mDownKeyCode = 0;\n                        this.mDownTarget = null;\n                    }\n                }\n            }\n\n\n            /**\n             * Start tracking the key code associated with the given event.  This\n             * can only be called on a key down.  It will allow you to see any\n             * long press associated with the key, and will result in\n             * {@link KeyEvent#isTracking} return true on the long press and up\n             * events.\n             *\n             * <p>This is only needed if you are directly dispatching events, rather\n             * than handling them in {@link Callback#onKeyDown}.\n             */\n            startTracking(event:KeyEvent , target:any) {\n                if (event.getAction() != KeyEvent.ACTION_DOWN) {\n                    throw new Error(\n                        \"Can only start tracking on a down event\");\n                }\n                if (DEBUG) Log.v(TAG, \"Start trackingt in \" + target + \": \" + this);\n                this.mDownKeyCode = event.getKeyCode();\n                this.mDownTarget = target;\n            }\n\n\n            /**\n             * Return true if the key event is for a key code that is currently\n             * being tracked by the dispatcher.\n             */\n            isTracking(event:KeyEvent):boolean {\n                return this.mDownKeyCode == event.getKeyCode();\n            }\n\n            /**\n             * Keep track of the given event's key code as having performed an\n             * action with a long press, so no action should occur on the up.\n             * <p>This is only needed if you are directly dispatching events, rather\n             * than handling them in {@link Callback#onKeyLongPress}.\n             */\n            performedLongPress(event:KeyEvent) {\n                this.mActiveLongPresses.put(event.getKeyCode(), 1);\n            }\n\n            /**\n             * Handle key up event to stop tracking.  This resets the dispatcher state,\n             * and updates the key event state based on it.\n             * <p>This is only needed if you are directly dispatching events, rather\n             * than handling them in {@link Callback#onKeyUp}.\n             */\n            handleUpEvent(event:KeyEvent) {\n                const keyCode = event.getKeyCode();\n                if (DEBUG) Log.v(TAG, \"Handle key up \" + event + \": \" + this);\n                let index = this.mActiveLongPresses.indexOfKey(keyCode);\n                if (index >= 0) {\n                    if (DEBUG) Log.v(TAG, \"  Index: \" + index);\n                    event.mFlags |= KeyEvent.FLAG_CANCELED | KeyEvent.FLAG_CANCELED_LONG_PRESS;\n                    this.mActiveLongPresses.removeAt(index);\n                }\n                if (this.mDownKeyCode == keyCode) {\n                    if (DEBUG) Log.v(TAG, \"  Tracking!\");\n                    event.mFlags |= KeyEvent.FLAG_TRACKING;\n                    this.mDownKeyCode = 0;\n                    this.mDownTarget = null;\n                }\n            }\n\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/LayoutInflater.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../content/Context.ts\"/>\n///<reference path=\"../../androidui/util/ClassFinder.ts\"/>\n///<reference path=\"../../androidui/widget/HtmlDataAdapter.ts\"/>\n\nmodule android.view{\n    import Context = android.content.Context;\n    import ClassFinder = androidui.util.ClassFinder;\n    import HtmlDataAdapter = androidui.widget.HtmlDataAdapter;\n\n    /**\n     * Instantiates a layout XML file into its corresponding {@link android.view.View}\n     * objects. It is never used directly. Instead, use\n     * {@link android.app.Activity#getLayoutInflater()} or\n     * {@link Context#getSystemService} to retrieve a standard LayoutInflater instance\n     * that is already hooked up to the current context and correctly configured\n     * for the device you are running on.  For example:\n     *\n     * <pre>LayoutInflater inflater = (LayoutInflater)context.getSystemService\n     *      (Context.LAYOUT_INFLATER_SERVICE);</pre>\n     *\n     * <p>\n     * To create a new LayoutInflater with an additional {@link Factory} for your\n     * own views, you can use {@link #cloneInContext} to clone an existing\n     * ViewFactory, and then call {@link #setFactory} on it to include your\n     * Factory.\n     *\n     * <p>\n     * For performance reasons, view inflation relies heavily on pre-processing of\n     * XML files that is done at build time. Therefore, it is not currently possible\n     * to use LayoutInflater with an XmlPullParser over a plain XML file at runtime;\n     * it only works with an XmlPullParser returned from a compiled resource\n     * (R.<em>something</em> file.)\n     *\n     * @see Context#getSystemService\n     */\n    export class LayoutInflater{\n        //private static TAG_MERGE:string = \"merge\";\n        //\n        //private static TAG_INCLUDE:string = \"include\";\n        //\n        //private static TAG_1995:string = \"blink\";\n        //\n        //private static TAG_REQUEST_FOCUS:string = \"requestFocus\";\n\n        protected mContext:Context;\n\n        /**\n         * Obtains the LayoutInflater from the given context.\n         */\n        static from(context:Context):LayoutInflater  {\n            return context.getLayoutInflater();\n        }\n\n        constructor( context:Context) {\n            this.mContext = context;\n        }\n\n        /**\n         * Return the context we are running in, for access to resources, class\n         * loader, etc.\n         */\n        getContext():Context  {\n            return this.mContext;\n        }\n\n\n        /**\n         * Inflate a new view hierarchy from the specified XML node. Throws\n         * {@link InflateException} if there is an error.\n         * <p>\n         * <em><strong>Important</strong></em>&nbsp;&nbsp;&nbsp;For performance\n         * reasons, view inflation relies heavily on pre-processing of XML files\n         * that is done at build time. Therefore, it is not currently possible to\n         * use LayoutInflater with an XmlPullParser over a plain XML file at runtime.\n         *\n         * @param layout XML dom node containing the description of the view\n         *        hierarchy.\n         * @param viewParent Optional view to be the parent of the generated hierarchy (if\n         *        <em>attachToRoot</em> is true), or else simply an object that\n         *        provides a set of LayoutParams values for root of the returned\n         *        hierarchy (if <em>attachToRoot</em> is false.)\n         * @param attachToRoot Whether the inflated hierarchy should be attached to\n         *        the root parameter? If false, root is only used to create the\n         *        correct subclass of LayoutParams for the root view in the XML.\n         * @return The root View of the inflated hierarchy. If root was supplied and\n         *         attachToRoot is true, this is root; otherwise it is the root of\n         *         the inflated XML file.\n         */\n        inflate(layout:HTMLElement|string, viewParent?:ViewGroup, attachToRoot = (viewParent != null)):View  {\n            let domtree:HTMLElement = layout instanceof HTMLElement ? layout : this.mContext.getResources().getLayout(<string>layout);\n            if(!domtree){\n                console.error('not find layout: '+layout);\n                return null;\n            }\n            let className = domtree.tagName;\n            if(className.startsWith('ANDROID-')){\n                className = className.substring('ANDROID-'.length);\n            }\n\n            if(className === 'LAYOUT'){// android-layout defined in resources tag\n                domtree = <HTMLElement>domtree.firstElementChild;\n            }\n\n\n            if(className === 'INCLUDE'){\n                let refLayoutId = domtree.getAttribute('layout');//@layout/xxx\n                if(!refLayoutId) return null;\n                let refEle = this.mContext.getResources().getLayout(refLayoutId);\n                //merge attr\n                for(let attr of Array.from(domtree.attributes)){\n                    let name = attr.name;\n                    if(name === 'layout') continue;\n                    refEle.setAttribute(name, attr.value);\n                }\n                return this.inflate(refEle, viewParent);\n\n            }else if(className === 'MERGE'){\n                if(!viewParent) throw Error('merge tag need ViewParent');\n                Array.from(domtree.children).forEach((item)=>{\n                    if(item instanceof HTMLElement){\n                        this.inflate(item, viewParent);\n                    }\n                });\n                return viewParent;\n\n            }else if(className === 'VIEW'){\n                let overrideClass = domtree.className || domtree.getAttribute('android:class');\n                if(overrideClass) className = overrideClass;\n            }\n\n            let rootViewClass = ClassFinder.findViewClass(className);\n            if(!rootViewClass){\n                return null;\n            }\n\n            let children = Array.from(domtree.children);//children may change when new the view\n            //parse default style\n            let defStyle;\n            let styleAttrValue = domtree.getAttribute('style');//@android:attr/textView\n            if(styleAttrValue){\n                defStyle = this.mContext.getResources().getDefStyle(styleAttrValue);\n            }\n\n            let rootView:View;\n            if(defStyle) rootView = new rootViewClass(this.mContext, domtree, defStyle);\n            else rootView = new rootViewClass(this.mContext, domtree);\n\n            // androidui add: support for HtmlDataAdapter\n            if(rootView['onInflateAdapter']){//inflate a adapter.\n                (<HtmlDataAdapter><any>rootView).onInflateAdapter(domtree, this.mContext, viewParent);\n                domtree.parentNode.removeChild(domtree);\n            }\n            if(!(rootView instanceof View)){//maybe a adapter\n                return rootView;\n            }\n\n            let params;\n            if(viewParent){\n                params = viewParent.generateLayoutParamsFromAttr(domtree);\n                rootView.setLayoutParams(params);\n            }\n\n            //parse children\n            if(rootView instanceof ViewGroup){\n                let parent = <ViewGroup><any>rootView;\n                children.forEach((item)=>{\n                    if(item instanceof HTMLElement){\n                        this.inflate(item, parent);\n                    }\n                });\n            }\n\n            rootView.onFinishInflate();\n            if(attachToRoot && viewParent) {\n                if (params) {\n                    viewParent.addView(rootView, params);\n                } else {\n                    viewParent.addView(rootView);\n                }\n            }\n\n            return rootView;\n        }\n\n\n    }\n}"
  },
  {
    "path": "src/android/view/Menu.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/app/Activity.ts\"/>\n///<reference path=\"../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../android/view/MenuItem.ts\"/>\n\nmodule android.view {\nimport Activity = android.app.Activity;\nimport KeyEvent = android.view.KeyEvent;\nimport MenuItem = android.view.MenuItem;\nimport ArrayList = java.util.ArrayList;\nimport Context = android.content.Context;\n\n/**\n * Interface for managing the items in a menu.\n * <p>\n * By default, every Activity supports an options menu of actions or options.\n * You can add items to this menu and handle clicks on your additions. The\n * easiest way of adding menu items is inflating an XML file into the\n * {@link Menu} via {@link MenuInflater}. The easiest way of attaching code to\n * clicks is via {@link Activity#onOptionsItemSelected(MenuItem)} and\n * {@link Activity#onContextItemSelected(MenuItem)}.\n * <p>\n * Different menu types support different features:\n * <ol>\n * <li><b>Context menus</b>: Do not support item shortcuts and item icons.\n * <li><b>Options menus</b>: The <b>icon menus</b> do not support item check\n * marks and only show the item's\n * {@link MenuItem#setTitleCondensed(CharSequence) condensed title}. The\n * <b>expanded menus</b> (only available if six or more menu items are visible,\n * reached via the 'More' item in the icon menu) do not show item icons, and\n * item check marks are discouraged.\n * <li><b>Sub menus</b>: Do not support item icons, or nested sub menus.\n * </ol>\n *\n * <div class=\"special reference\">\n * <h3>Developer Guides</h3>\n * <p>For more information about creating menus, read the\n * <a href=\"{@docRoot}guide/topics/ui/menus.html\">Menus</a> developer guide.</p>\n * </div>\n */\nexport class Menu {\n\n    /**\n     * Contains all of the items for this menu\n     */\n    private mItems = new ArrayList<MenuItem>();\n    private mVisibleItems = new ArrayList<MenuItem>();\n\n    /**\n     * Callback that will receive the various menu-related events generated by this class. Use\n     * getCallback to get a reference to the callback.\n     */\n    private mCallback:Menu.Callback;\n\n    private mContext:Context;\n\n    constructor(context:Context) {\n        this.mContext = context;\n    }\n\n    getContext():Context {\n        return this.mContext;\n    }\n\n    /**\n     * Add a new item to the menu. This item displays the given title for its\n     * label.\n     * \n     * @param title The text to display for the item.\n     * @return The newly added menu item.\n     */\n    add(title:string):MenuItem ;\n\n    /**\n     * Add a new item to the menu. This item displays the given title for its\n     * label.\n     *\n     * @param groupId The group identifier that this item should be part of.\n     *        This can be used to define groups of items for batch state\n     *        changes. Normally use {@link #NONE} if an item should not be in a\n     *        group.\n     * @param itemId Unique item ID. Use {@link #NONE} if you do not need a\n     *        unique ID.\n     * @param order The order for the item. Use {@link #NONE} if you do not care\n     *        about the order. See {@link MenuItem#getOrder()}.\n     * @param title The text to display for the item.\n     * @return The newly added menu item.\n     */\n    add(groupId:number, itemId:number, order:number, title:string):MenuItem ;\n    add(...args):MenuItem {\n        if(args.length==1) return this.addInternal(0, 0, 0, args[0]);\n        return this.addInternal(args[0], args[1], args[2], args[3]);\n    }\n\n    ///**\n    // * Add a new item to the menu. This item displays the given title for its\n    // * label.\n    // *\n    // * @param titleRes Resource identifier of title string.\n    // * @return The newly added menu item.\n    // */\n    //add(titleRes:number):MenuItem ;\n\n    ///**\n    // * Variation on {@link #add(int, int, int, CharSequence)} that takes a\n    // * string resource identifier instead of the string itself.\n    // *\n    // * @param groupId The group identifier that this item should be part of.\n    // *        This can also be used to define groups of items for batch state\n    // *        changes. Normally use {@link #NONE} if an item should not be in a\n    // *        group.\n    // * @param itemId Unique item ID. Use {@link #NONE} if you do not need a\n    // *        unique ID.\n    // * @param order The order for the item. Use {@link #NONE} if you do not care\n    // *        about the order. See {@link MenuItem#getOrder()}.\n    // * @param titleRes Resource identifier of title string.\n    // * @return The newly added menu item.\n    // */\n    //add(groupId:number, itemId:number, order:number, titleRes:number):MenuItem ;\n\n    /**\n     * Adds an item to the menu.  The other add methods funnel to this.\n     */\n    private addInternal(group:number, id:number, categoryOrder:number, title:string):MenuItem  {\n        const ordering:number = 0;//MenuBuilder.getOrdering(categoryOrder);\n        const item:MenuItem = new MenuItem(this, group, id, categoryOrder, ordering, title);\n        //if (this.mCurrentMenuInfo != null) {\n        //    // Pass along the current menu info\n        //    item.setMenuInfo(this.mCurrentMenuInfo);\n        //}\n        this.mItems.add(/*MenuBuilder.findInsertIndex(this.mItems, ordering), */item);\n        this.onItemsChanged(true);\n        return item;\n    }\n    ///**\n    // * Add a new sub-menu to the menu. This item displays the given title for\n    // * its label. To modify other attributes on the submenu's menu item, use\n    // * {@link SubMenu#getItem()}.\n    // *\n    // * @param title The text to display for the item.\n    // * @return The newly added sub-menu\n    // */\n    //addSubMenu(title:string):SubMenu ;\n    //\n    ///**\n    // * Add a new sub-menu to the menu. This item displays the given title for\n    // * its label. To modify other attributes on the submenu's menu item, use\n    // * {@link SubMenu#getItem()}.\n    // *\n    // * @param titleRes Resource identifier of title string.\n    // * @return The newly added sub-menu\n    // */\n    //addSubMenu(titleRes:number):SubMenu ;\n    //\n    ///**\n    // * Add a new sub-menu to the menu. This item displays the given\n    // * <var>title</var> for its label. To modify other attributes on the\n    // * submenu's menu item, use {@link SubMenu#getItem()}.\n    // *<p>\n    // * Note that you can only have one level of sub-menus, i.e. you cannnot add\n    // * a subMenu to a subMenu: An {@link UnsupportedOperationException} will be\n    // * thrown if you try.\n    // *\n    // * @param groupId The group identifier that this item should be part of.\n    // *        This can also be used to define groups of items for batch state\n    // *        changes. Normally use {@link #NONE} if an item should not be in a\n    // *        group.\n    // * @param itemId Unique item ID. Use {@link #NONE} if you do not need a\n    // *        unique ID.\n    // * @param order The order for the item. Use {@link #NONE} if you do not care\n    // *        about the order. See {@link MenuItem#getOrder()}.\n    // * @param title The text to display for the item.\n    // * @return The newly added sub-menu\n    // */\n    //addSubMenu(groupId:number, itemId:number, order:number, title:string):SubMenu ;\n    //\n    ///**\n    // * Variation on {@link #addSubMenu(int, int, int, CharSequence)} that takes\n    // * a string resource identifier for the title instead of the string itself.\n    // *\n    // * @param groupId The group identifier that this item should be part of.\n    // *        This can also be used to define groups of items for batch state\n    // *        changes. Normally use {@link #NONE} if an item should not be in a group.\n    // * @param itemId Unique item ID. Use {@link #NONE} if you do not need a unique ID.\n    // * @param order The order for the item. Use {@link #NONE} if you do not care about the\n    // *        order. See {@link MenuItem#getOrder()}.\n    // * @param titleRes Resource identifier of title string.\n    // * @return The newly added sub-menu\n    // */\n    //addSubMenu(groupId:number, itemId:number, order:number, titleRes:number):SubMenu ;\n    //\n    ///**\n    // * Add a group of menu items corresponding to actions that can be performed\n    // * for a particular Intent. The Intent is most often configured with a null\n    // * action, the data that the current activity is working with, and includes\n    // * either the {@link Intent#CATEGORY_ALTERNATIVE} or\n    // * {@link Intent#CATEGORY_SELECTED_ALTERNATIVE} to find activities that have\n    // * said they would like to be included as optional action. You can, however,\n    // * use any Intent you want.\n    // *\n    // * <p>\n    // * See {@link android.content.pm.PackageManager#queryIntentActivityOptions}\n    // * for more * details on the <var>caller</var>, <var>specifics</var>, and\n    // * <var>intent</var> arguments. The list returned by that function is used\n    // * to populate the resulting menu items.\n    // *\n    // * <p>\n    // * All of the menu items of possible options for the intent will be added\n    // * with the given group and id. You can use the group to control ordering of\n    // * the items in relation to other items in the menu. Normally this function\n    // * will automatically remove any existing items in the menu in the same\n    // * group and place a divider above and below the added items; this behavior\n    // * can be modified with the <var>flags</var> parameter. For each of the\n    // * generated items {@link MenuItem#setIntent} is called to associate the\n    // * appropriate Intent with the item; this means the activity will\n    // * automatically be started for you without having to do anything else.\n    // *\n    // * @param groupId The group identifier that the items should be part of.\n    // *        This can also be used to define groups of items for batch state\n    // *        changes. Normally use {@link #NONE} if the items should not be in\n    // *        a group.\n    // * @param itemId Unique item ID. Use {@link #NONE} if you do not need a\n    // *        unique ID.\n    // * @param order The order for the items. Use {@link #NONE} if you do not\n    // *        care about the order. See {@link MenuItem#getOrder()}.\n    // * @param caller The current activity component name as defined by\n    // *        queryIntentActivityOptions().\n    // * @param specifics Specific items to place first as defined by\n    // *        queryIntentActivityOptions().\n    // * @param intent Intent describing the kinds of items to populate in the\n    // *        list as defined by queryIntentActivityOptions().\n    // * @param flags Additional options controlling how the items are added.\n    // * @param outSpecificItems Optional array in which to place the menu items\n    // *        that were generated for each of the <var>specifics</var> that were\n    // *        requested. Entries may be null if no activity was found for that\n    // *        specific action.\n    // * @return The number of menu items that were added.\n    // *\n    // * @see #FLAG_APPEND_TO_GROUP\n    // * @see MenuItem#setIntent\n    // * @see android.content.pm.PackageManager#queryIntentActivityOptions\n    // */\n    //addIntentOptions(groupId:number, itemId:number, order:number, caller:ComponentName, specifics:Intent[], intent:Intent, flags:number, outSpecificItems:MenuItem[]):number ;\n\n    /**\n     * Remove the item with the given identifier.\n     *\n     * @param id The item to be removed.  If there is no item with this\n     *           identifier, nothing happens.\n     */\n    removeItem(id:number):void {\n        this.removeItemAtInt(this.findItemIndex(id), true);\n    }\n\n    /**\n     * Remove all items in the given group.\n     *\n     * @param groupId The group to be removed.  If there are no items in this\n     *           group, nothing happens.\n     */\n    removeGroup(groupId:number):void {\n        const i:number = this.findGroupIndex(groupId);\n        if (i >= 0) {\n            const maxRemovable:number = this.mItems.size() - i;\n            let numRemoved:number = 0;\n            while ((numRemoved++ < maxRemovable) && (this.mItems.get(i).getGroupId() == groupId)) {\n                // Don't force update for each one, this method will do it at the end\n                this.removeItemAtInt(i, false);\n            }\n            // Notify menu views\n            this.onItemsChanged(true);\n        }\n    }\n\n\n    /**\n     * Remove the item at the given index and optionally forces menu views to update.\n     *\n     * @param index                     The index of the item to be removed. If this index is\n     *                                  invalid an exception is thrown.\n     * @param updateChildrenOnMenuViews Whether to force update on menu views. Please make sure you\n     *                                  eventually call this after your batch of removals.\n     */\n    private removeItemAtInt(index:number, updateChildrenOnMenuViews:boolean):void  {\n        if ((index < 0) || (index >= this.mItems.size())) {\n            return;\n        }\n        this.mItems.remove(index);\n        if (updateChildrenOnMenuViews) {\n            this.onItemsChanged(true);\n        }\n    }\n\n    /**\n     * Remove all existing items from the menu, leaving it empty as if it had\n     * just been created.\n     */\n    clear():void {\n        this.mItems.clear();\n        this.onItemsChanged(true);\n    }\n\n    ///**\n    // * Control whether a particular group of items can show a check mark.  This\n    // * is similar to calling {@link MenuItem#setCheckable} on all of the menu items\n    // * with the given group identifier, but in addition you can control whether\n    // * this group contains a mutually-exclusive set items.  This should be called\n    // * after the items of the group have been added to the menu.\n    // *\n    // * @param group The group of items to operate on.\n    // * @param checkable Set to true to allow a check mark, false to\n    // *                  disallow.  The default is false.\n    // * @param exclusive If set to true, only one item in this group can be\n    // *                  checked at a time; checking an item will automatically\n    // *                  uncheck all others in the group.  If set to false, each\n    // *                  item can be checked independently of the others.\n    // *\n    // * @see MenuItem#setCheckable\n    // * @see MenuItem#setChecked\n    // */\n    //setGroupCheckable(group:number, checkable:boolean, exclusive:boolean):void ;\n\n    /**\n     * Show or hide all menu items that are in the given group.\n     *\n     * @param group The group of items to operate on.\n     * @param visible If true the items are visible, else they are hidden.\n     *\n     * @see MenuItem#setVisible\n     */\n    setGroupVisible(group:number, visible:boolean):void {\n        const N:number = this.mItems.size();\n        // We handle the notification of items being changed ourselves, so we use setVisibleInt\n        // rather than setVisible and at the end notify of items being changed\n        let changedAtLeastOneItem:boolean = false;\n        for (let i:number = 0; i < N; i++) {\n            let item:MenuItem = this.mItems.get(i);\n            if (item.getGroupId() == group) {\n                if (item.setVisible(visible)) {//androidui modify: setVisibleInt\n                    changedAtLeastOneItem = true;\n                }\n            }\n        }\n        if (changedAtLeastOneItem) {\n            this.onItemsChanged(true);\n        }\n    }\n\n    /**\n     * Enable or disable all menu items that are in the given group.\n     *\n     * @param group The group of items to operate on.\n     * @param enabled If true the items will be enabled, else they will be disabled.\n     *\n     * @see MenuItem#setEnabled\n     */\n    setGroupEnabled(group:number, enabled:boolean):void {\n        const N:number = this.mItems.size();\n        for (let i:number = 0; i < N; i++) {\n            let item:MenuItem = this.mItems.get(i);\n            if (item.getGroupId() == group) {\n                item.setEnabled(enabled);\n            }\n        }\n    }\n\n    /**\n     * Return whether the menu currently has item items that are visible.\n     *\n     * @return True if there is one or more item visible,\n     *         else false.\n     */\n    hasVisibleItems():boolean {\n        const size:number = this.size();\n        for (let i:number = 0; i < size; i++) {\n            let item:MenuItem = this.mItems.get(i);\n            if (item.isVisible()) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    /**\n     * Return the menu item with a particular identifier.\n     *\n     * @param id The identifier to find.\n     *\n     * @return The menu item object, or null if there is no item with\n     *         this identifier.\n     */\n    findItem(id:number):MenuItem {\n        const size:number = this.size();\n        for (let i:number = 0; i < size; i++) {\n            let item:MenuItem = this.mItems.get(i);\n            if (item.getItemId() == id) {\n                return item;\n            }\n            //else if (item.hasSubMenu()) {\n            //    let possibleItem:MenuItem = item.getSubMenu().findItem(id);\n            //    if (possibleItem != null) {\n            //        return possibleItem;\n            //    }\n            //}\n        }\n        return null;\n    }\n\n    findItemIndex(id:number):number  {\n        const size:number = this.size();\n        for (let i:number = 0; i < size; i++) {\n            let item:MenuItem = this.mItems.get(i);\n            if (item.getItemId() == id) {\n                return i;\n            }\n        }\n        return -1;\n    }\n\n    findGroupIndex(group:number, start=0):number  {\n        const size:number = this.size();\n        if (start < 0) {\n            start = 0;\n        }\n        for (let i:number = start; i < size; i++) {\n            const item:MenuItem = this.mItems.get(i);\n            if (item.getGroupId() == group) {\n                return i;\n            }\n        }\n        return -1;\n    }\n\n\n    /**\n     * Get the number of items in the menu.  Note that this will change any\n     * times items are added or removed from the menu.\n     *\n     * @return The item count.\n     */\n    size():number {\n        return this.mItems.size();\n    }\n\n    /**\n     * Gets the menu item at the given index.\n     * \n     * @param index The index of the menu item to return.\n     * @return The menu item.\n     * @exception IndexOutOfBoundsException\n     *                when {@code index < 0 || >= size()}\n     */\n    getItem(index:number):MenuItem {\n        return this.mItems.get(index);\n    }\n\n    ///**\n    // * Closes the menu, if open.\n    // */\n    //close():void ;\n    //\n    ///**\n    // * Execute the menu item action associated with the given shortcut\n    // * character.\n    // *\n    // * @param keyCode The keycode of the shortcut key.\n    // * @param event Key event message.\n    // * @param flags Additional option flags or 0.\n    // *\n    // * @return If the given shortcut exists and is shown, returns\n    // *         true; else returns false.\n    // *\n    // * @see #FLAG_PERFORM_NO_CLOSE\n    // */\n    //performShortcut(keyCode:number, event:KeyEvent, flags:number):boolean ;\n    //\n    ///**\n    // * Is a keypress one of the defined shortcut keys for this window.\n    // * @param keyCode the key code from {@link KeyEvent} to check.\n    // * @param event the {@link KeyEvent} to use to help check.\n    // */\n    //isShortcutKey(keyCode:number, event:KeyEvent):boolean ;\n    //\n    ///**\n    // * Execute the menu item action associated with the given menu identifier.\n    // *\n    // * @param id Identifier associated with the menu item.\n    // * @param flags Additional option flags or 0.\n    // *\n    // * @return If the given identifier exists and is shown, returns\n    // *         true; else returns false.\n    // *\n    // * @see #FLAG_PERFORM_NO_CLOSE\n    // */\n    //performIdentifierAction(id:number, flags:number):boolean ;\n    //\n    ///**\n    // * Control whether the menu should be running in qwerty mode (alphabetic\n    // * shortcuts) or 12-key mode (numeric shortcuts).\n    // *\n    // * @param isQwerty If true the menu will use alphabetic shortcuts; else it\n    // *                 will use numeric shortcuts.\n    // */\n    //setQwertyMode(isQwerty:boolean):void ;\n\n\n    /**\n     * Called when an item is added or removed.\n     *\n     * @param structureChanged true if the menu structure changed, false if only item properties\n     *                         changed. (Visibility is a structural property since it affects\n     *                         layout.)\n     */\n    onItemsChanged(structureChanged:boolean):void  {\n        //if (!this.mPreventDispatchingItemsChanged) {\n        //    if (structureChanged) {\n        //        this.mIsVisibleItemsStale = true;\n        //        this.mIsActionItemsStale = true;\n        //    }\n        //    this.dispatchPresenterUpdate(structureChanged);\n        //} else {\n        //    this.mItemsChangedWhileDispatchPrevented = true;\n        //}\n    }\n\n    /**\n     * Gets the root menu (if this is a submenu, find its root menu).\n     *\n     * @return The root menu.\n     */\n    getRootMenu():Menu {\n        return this;\n    }\n\n    setCallback(cb:Menu.Callback):void  {\n        this.mCallback = cb;\n    }\n\n    dispatchMenuItemSelected(menu:Menu, item:MenuItem):boolean  {\n        return this.mCallback != null && this.mCallback.onMenuItemSelected(menu, item);\n    }\n\n    getVisibleItems():ArrayList<MenuItem>  {\n        this.mVisibleItems.clear();\n        const itemsSize:number = this.mItems.size();\n        let item:MenuItem;\n        for (let i:number = 0; i < itemsSize; i++) {\n            item = this.mItems.get(i);\n            if (item.isVisible()) {\n                this.mVisibleItems.add(item);\n            }\n        }\n        return this.mVisibleItems;\n    }\n}\n\nexport module Menu{\n/**\n     * This is the part of an order integer that the user can provide.\n     * @hide\n     */\nexport var USER_MASK:number = 0x0000ffff;\n/**\n     * Bit shift of the user portion of the order integer.\n     * @hide\n     */\nexport var USER_SHIFT:number = 0;\n/**\n     * This is the part of an order integer that supplies the category of the\n     * item.\n     * @hide\n     */\nexport var CATEGORY_MASK:number = 0xffff0000;\n/**\n     * Bit shift of the category portion of the order integer.\n     * @hide\n     */\nexport var CATEGORY_SHIFT:number = 16;\n/**\n     * Value to use for group and item identifier integers when you don't care\n     * about them.\n     */\nexport var NONE:number = 0;\n/**\n     * First value for group and item identifier integers.\n     */\nexport var FIRST:number = 1;\n// Implementation note: Keep these CATEGORY_* in sync with the category enum\n// in attrs.xml\n/**\n     * Category code for the order integer for items/groups that are part of a\n     * container -- or/add this with your base value.\n     */\nexport var CATEGORY_CONTAINER:number = 0x00010000;\n/**\n     * Category code for the order integer for items/groups that are provided by\n     * the system -- or/add this with your base value.\n     */\nexport var CATEGORY_SYSTEM:number = 0x00020000;\n/**\n     * Category code for the order integer for items/groups that are\n     * user-supplied secondary (infrequently used) options -- or/add this with\n     * your base value.\n     */\nexport var CATEGORY_SECONDARY:number = 0x00030000;\n/**\n     * Category code for the order integer for items/groups that are \n     * alternative actions on the data that is currently displayed -- or/add\n     * this with your base value.\n     */\nexport var CATEGORY_ALTERNATIVE:number = 0x00040000;\n/**\n     * Flag for {@link #addIntentOptions}: if set, do not automatically remove\n     * any existing menu items in the same group.\n     */\nexport var FLAG_APPEND_TO_GROUP:number = 0x0001;\n/**\n     * Flag for {@link #performShortcut}: if set, do not close the menu after\n     * executing the shortcut.\n     */\nexport var FLAG_PERFORM_NO_CLOSE:number = 0x0001;\n/**\n     * Flag for {@link #performShortcut(int, KeyEvent, int)}: if set, always\n     * close the menu after executing the shortcut. Closing the menu also resets\n     * the prepared state.\n     */\nexport var FLAG_ALWAYS_PERFORM_CLOSE:number = 0x0002;\n\n        /**\n         * Called by menu to notify of close and selection changes.\n         * @hide\n         */\n        export interface Callback {\n\n            /**\n             * Called when a menu item is selected.\n             *\n             * @param menu The menu that is the parent of the item\n             * @param item The menu item that is selected\n             * @return whether the menu item selection was handled\n             */\n            onMenuItemSelected(menu:Menu, item:MenuItem):boolean ;\n\n            ///**\n            // * Called when the mode of the menu changes (for example, from icon to expanded).\n            // *\n            // * @param menu the menu that has changed modes\n            // */\n            //onMenuModeChange(menu:MenuBuilder):void ;\n        }\n}\n\n}"
  },
  {
    "path": "src/android/view/MenuItem.ts",
    "content": "/*\n * Copyright (C) 2008 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/app/Activity.ts\"/>\n///<reference path=\"../../android/content/Intent.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/view/Menu.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n\nmodule android.view {\nimport Activity = android.app.Activity;\nimport Intent = android.content.Intent;\nimport Drawable = android.graphics.drawable.Drawable;\nimport Menu = android.view.Menu;\nimport View = android.view.View;\n/**\n * Interface for direct access to a previously created menu item.\n * <p>\n * An Item is returned by calling one of the {@link android.view.Menu#add}\n * methods.\n * <p>\n * For a feature set of specific menu types, see {@link Menu}.\n *\n * <div class=\"special reference\">\n * <h3>Developer Guides</h3>\n * <p>For information about creating menus, read the\n * <a href=\"{@docRoot}guide/topics/ui/menus.html\">Menus</a> developer guide.</p>\n * </div>\n */\nexport class MenuItem {\n\n    private mId:number = 0;\n\n    private mGroup:number = 0;\n\n    private mCategoryOrder:number = 0;\n\n    private mOrdering:number = 0;\n\n    private mTitle:string;\n\n    private mIntent:Intent;\n\n    private mIconDrawable:Drawable;\n\n    private mVisible = true;\n\n    private mEnable = true;\n\n    private mClickListener:MenuItem.OnMenuItemClickListener;\n\n    private mActionView:View;\n\n    private mMenu:Menu;\n\n\n    /**\n     * Instantiates this menu item.\n     *\n     * @param group         Item ordering grouping control. The item will be added after all other\n     *                      items whose order is <= this number, and before any that are larger than\n     *                      it. This can also be used to define groups of items for batch state\n     *                      changes. Normally use 0.\n     * @param id            Unique item ID. Use 0 if you do not need a unique ID.\n     * @param categoryOrder The ordering for this item.\n     * @param title         The text to display for the item.\n     */\n    constructor(menu:Menu, group:number, id:number, categoryOrder:number, ordering:number, title:string) {\n        this.mMenu = menu;\n        this.mId = id;\n        this.mGroup = group;\n        this.mCategoryOrder = categoryOrder;\n        this.mOrdering = ordering;\n        this.mTitle = title;\n    }\n\n    /**\n     * Return the identifier for this menu item.  The identifier can not\n     * be changed after the menu is created.\n     *\n     * @return The menu item's identifier.\n     */\n    getItemId():number {\n        return this.mId;\n    }\n\n    /**\n     * Return the group identifier that this menu item is part of. The group\n     * identifier can not be changed after the menu is created.\n     * \n     * @return The menu item's group identifier.\n     */\n    getGroupId():number {\n        return this.mGroup;\n    }\n\n    /**\n     * Return the category and order within the category of this item. This\n     * item will be shown before all items (within its category) that have\n     * order greater than this value.\n     * <p>\n     * An order integer contains the item's category (the upper bits of the\n     * integer; set by or/add the category with the order within the\n     * category) and the ordering of the item within that category (the\n     * lower bits). Example categories are {@link Menu#CATEGORY_SYSTEM},\n     * {@link Menu#CATEGORY_SECONDARY}, {@link Menu#CATEGORY_ALTERNATIVE},\n     * {@link Menu#CATEGORY_CONTAINER}. See {@link Menu} for a full list.\n     * \n     * @return The order of this item.\n     */\n    getOrder():number {\n        return this.mOrdering;\n    }\n\n    /**\n     * Change the title associated with this item.\n     *\n     * @param title The new text to be displayed.\n     * @return This Item so additional setters can be called.\n     */\n    setTitle(title:string):MenuItem {\n        this.mTitle = title;\n        return this;\n    }\n\n    ///**\n    // * Change the title associated with this item.\n    // * <p>\n    // * Some menu types do not sufficient space to show the full title, and\n    // * instead a condensed title is preferred. See {@link Menu} for more\n    // * information.\n    // *\n    // * @param title The resource id of the new text to be displayed.\n    // * @return This Item so additional setters can be called.\n    // * @see #setTitleCondensed(CharSequence)\n    // */\n    //setTitle(title:number):MenuItem ;\n\n    /**\n     * Retrieve the current title of the item.\n     *\n     * @return The title.\n     */\n    getTitle():string {\n        return this.mTitle;\n    }\n\n    ///**\n    // * Change the condensed title associated with this item. The condensed\n    // * title is used in situations where the normal title may be too long to\n    // * be displayed.\n    // *\n    // * @param title The new text to be displayed as the condensed title.\n    // * @return This Item so additional setters can be called.\n    // */\n    //setTitleCondensed(title:string):MenuItem ;\n    //\n    ///**\n    // * Retrieve the current condensed title of the item. If a condensed\n    // * title was never set, it will return the normal title.\n    // *\n    // * @return The condensed title, if it exists.\n    // *         Otherwise the normal title.\n    // */\n    //getTitleCondensed():string ;\n\n    /**\n     * Change the icon associated with this item. This icon will not always be\n     * shown, so the title should be sufficient in describing this item. See\n     * {@link Menu} for the menu types that support icons.\n     * \n     * @param icon The new icon (as a Drawable) to be displayed.\n     * @return This Item so additional setters can be called.\n     */\n    setIcon(icon:Drawable):MenuItem {\n        this.mIconDrawable = icon;\n        return this;\n    }\n\n    ///**\n    // * Change the icon associated with this item. This icon will not always be\n    // * shown, so the title should be sufficient in describing this item. See\n    // * {@link Menu} for the menu types that support icons.\n    // * <p>\n    // * This method will set the resource ID of the icon which will be used to\n    // * lazily get the Drawable when this item is being shown.\n    // *\n    // * @param iconRes The new icon (as a resource ID) to be displayed.\n    // * @return This Item so additional setters can be called.\n    // */\n    //setIcon(iconRes:number):MenuItem ;\n\n    /**\n     * Returns the icon for this item as a Drawable (getting it from resources if it hasn't been\n     * loaded before).\n     * \n     * @return The icon as a Drawable.\n     */\n    getIcon():Drawable {\n        return this.mIconDrawable;\n    }\n\n    /**\n     * Change the Intent associated with this item.  By default there is no\n     * Intent associated with a menu item.  If you set one, and nothing\n     * else handles the item, then the default behavior will be to call\n     * {@link android.content.Context#startActivity} with the given Intent.\n     *\n     * <p>Note that setIntent() can not be used with the versions of\n     * {@link Menu#add} that take a Runnable, because {@link Runnable#run}\n     * does not return a value so there is no way to tell if it handled the\n     * item.  In this case it is assumed that the Runnable always handles\n     * the item, and the intent will never be started.\n     *\n     * @see #getIntent\n     * @param intent The Intent to associated with the item.  This Intent\n     *               object is <em>not</em> copied, so be careful not to\n     *               modify it later.\n     * @return This Item so additional setters can be called.\n     */\n    setIntent(intent:Intent):MenuItem {\n        this.mIntent = intent;\n        return this;\n    }\n\n    /**\n     * Return the Intent associated with this item.  This returns a\n     * reference to the Intent which you can change as desired to modify\n     * what the Item is holding.\n     *\n     * @see #setIntent\n     * @return Returns the last value supplied to {@link #setIntent}, or\n     *         null.\n     */\n    getIntent():Intent {\n        return this.mIntent;\n    }\n    //\n    ///**\n    // * Change both the numeric and alphabetic shortcut associated with this\n    // * item. Note that the shortcut will be triggered when the key that\n    // * generates the given character is pressed alone or along with with the alt\n    // * key. Also note that case is not significant and that alphabetic shortcut\n    // * characters will be displayed in lower case.\n    // * <p>\n    // * See {@link Menu} for the menu types that support shortcuts.\n    // *\n    // * @param numericChar The numeric shortcut key. This is the shortcut when\n    // *        using a numeric (e.g., 12-key) keyboard.\n    // * @param alphaChar The alphabetic shortcut key. This is the shortcut when\n    // *        using a keyboard with alphabetic keys.\n    // * @return This Item so additional setters can be called.\n    // */\n    //setShortcut(numericChar:string, alphaChar:string):MenuItem ;\n    //\n    ///**\n    // * Change the numeric shortcut associated with this item.\n    // * <p>\n    // * See {@link Menu} for the menu types that support shortcuts.\n    // *\n    // * @param numericChar The numeric shortcut key.  This is the shortcut when\n    // *                 using a 12-key (numeric) keyboard.\n    // * @return This Item so additional setters can be called.\n    // */\n    //setNumericShortcut(numericChar:string):MenuItem ;\n    //\n    ///**\n    // * Return the char for this menu item's numeric (12-key) shortcut.\n    // *\n    // * @return Numeric character to use as a shortcut.\n    // */\n    //getNumericShortcut():string ;\n    //\n    ///**\n    // * Change the alphabetic shortcut associated with this item. The shortcut\n    // * will be triggered when the key that generates the given character is\n    // * pressed alone or along with with the alt key. Case is not significant and\n    // * shortcut characters will be displayed in lower case. Note that menu items\n    // * with the characters '\\b' or '\\n' as shortcuts will get triggered by the\n    // * Delete key or Carriage Return key, respectively.\n    // * <p>\n    // * See {@link Menu} for the menu types that support shortcuts.\n    // *\n    // * @param alphaChar The alphabetic shortcut key. This is the shortcut when\n    // *        using a keyboard with alphabetic keys.\n    // * @return This Item so additional setters can be called.\n    // */\n    //setAlphabeticShortcut(alphaChar:string):MenuItem ;\n    //\n    ///**\n    // * Return the char for this menu item's alphabetic shortcut.\n    // *\n    // * @return Alphabetic character to use as a shortcut.\n    // */\n    //getAlphabeticShortcut():string ;\n    //\n    ///**\n    // * Control whether this item can display a check mark. Setting this does\n    // * not actually display a check mark (see {@link #setChecked} for that);\n    // * rather, it ensures there is room in the item in which to display a\n    // * check mark.\n    // * <p>\n    // * See {@link Menu} for the menu types that support check marks.\n    // *\n    // * @param checkable Set to true to allow a check mark, false to\n    // *            disallow. The default is false.\n    // * @see #setChecked\n    // * @see #isCheckable\n    // * @see Menu#setGroupCheckable\n    // * @return This Item so additional setters can be called.\n    // */\n    //setCheckable(checkable:boolean):MenuItem ;\n    //\n    ///**\n    // * Return whether the item can currently display a check mark.\n    // *\n    // * @return If a check mark can be displayed, returns true.\n    // *\n    // * @see #setCheckable\n    // */\n    //isCheckable():boolean ;\n    //\n    ///**\n    // * Control whether this item is shown with a check mark.  Note that you\n    // * must first have enabled checking with {@link #setCheckable} or else\n    // * the check mark will not appear.  If this item is a member of a group that contains\n    // * mutually-exclusive items (set via {@link Menu#setGroupCheckable(int, boolean, boolean)},\n    // * the other items in the group will be unchecked.\n    // * <p>\n    // * See {@link Menu} for the menu types that support check marks.\n    // *\n    // * @see #setCheckable\n    // * @see #isChecked\n    // * @see Menu#setGroupCheckable\n    // * @param checked Set to true to display a check mark, false to hide\n    // *                it.  The default value is false.\n    // * @return This Item so additional setters can be called.\n    // */\n    //setChecked(checked:boolean):MenuItem ;\n    //\n    ///**\n    // * Return whether the item is currently displaying a check mark.\n    // *\n    // * @return If a check mark is displayed, returns true.\n    // *\n    // * @see #setChecked\n    // */\n    //isChecked():boolean ;\n\n    /**\n     * Sets the visibility of the menu item. Even if a menu item is not visible,\n     * it may still be invoked via its shortcut (to completely disable an item,\n     * set it to invisible and {@link #setEnabled(boolean) disabled}).\n     * \n     * @param visible If true then the item will be visible; if false it is\n     *        hidden.\n     * @return This Item so additional setters can be called.\n     */\n    setVisible(visible:boolean):MenuItem {\n        this.mVisible = visible;\n        return this;\n    }\n\n    /**\n     * Return the visibility of the menu item.\n     *\n     * @return If true the item is visible; else it is hidden.\n     */\n    isVisible():boolean {\n        return this.mVisible;\n    }\n\n    /**\n     * Sets whether the menu item is enabled. Disabling a menu item will not\n     * allow it to be invoked via its shortcut. The menu item will still be\n     * visible.\n     * \n     * @param enabled If true then the item will be invokable; if false it is\n     *        won't be invokable.\n     * @return This Item so additional setters can be called.\n     */\n    setEnabled(enabled:boolean):MenuItem {\n        this.mEnable = enabled;\n        return this;\n    }\n\n    /**\n     * Return the enabled state of the menu item.\n     *\n     * @return If true the item is enabled and hence invokable; else it is not.\n     */\n    isEnabled():boolean {\n        return this.mEnable;\n    }\n\n    ///**\n    // * Check whether this item has an associated sub-menu.  I.e. it is a\n    // * sub-menu of another menu.\n    // *\n    // * @return If true this item has a menu; else it is a\n    // *         normal item.\n    // */\n    //hasSubMenu():boolean ;\n    //\n    ///**\n    // * Get the sub-menu to be invoked when this item is selected, if it has\n    // * one. See {@link #hasSubMenu()}.\n    // *\n    // * @return The associated menu if there is one, else null\n    // */\n    //getSubMenu():SubMenu ;\n\n    /**\n     * Set a custom listener for invocation of this menu item. In most\n     * situations, it is more efficient and easier to use\n     * {@link Activity#onOptionsItemSelected(MenuItem)} or\n     * {@link Activity#onContextItemSelected(MenuItem)}.\n     * \n     * @param menuItemClickListener The object to receive invokations.\n     * @return This Item so additional setters can be called.\n     * @see Activity#onOptionsItemSelected(MenuItem)\n     * @see Activity#onContextItemSelected(MenuItem)\n     */\n    setOnMenuItemClickListener(menuItemClickListener:MenuItem.OnMenuItemClickListener):MenuItem {\n        this.mClickListener = menuItemClickListener;\n        return this;\n    }\n\n\n    /**\n     * Set an action view for this menu item. An action view will be displayed in place\n     * of an automatically generated menu item element in the UI when this item is shown\n     * as an action within a parent.\n     * <p>\n     *   <strong>Note:</strong> Setting an action view overrides the action provider\n     *           set via {@link #setActionProvider(ActionProvider)}.\n     * </p>\n     *\n     * @param view View to use for presenting this item to the user.\n     * @return This Item so additional setters can be called.\n     *\n     * @see #setShowAsAction(int)\n     */\n    setActionView(view:View):MenuItem {\n        this.mActionView = view;\n        return this;\n    }\n\n    /**\n     * Returns the currently set action view for this menu item.\n     *\n     * @return This item's action view\n     *\n     * @see #setActionView(View)\n     * @see #setShowAsAction(int)\n     */\n    getActionView():View {\n        return this.mActionView;\n    }\n\n\n    /**\n     * Invokes the item by calling various listeners or callbacks.\n     *\n     * @return true if the invocation was handled, false otherwise\n     */\n    invoke():boolean  {\n        if (this.mClickListener != null && this.mClickListener.onMenuItemClick(this)) {\n            return true;\n        }\n        if (this.mMenu.dispatchMenuItemSelected(this.mMenu.getRootMenu(), this)) {\n            return true;\n        }\n        //if (this.mItemCallback != null) {\n        //    this.mItemCallback.run();\n        //    return true;\n        //}\n        if (this.mIntent != null) {\n            try {\n                (<android.app.Activity>this.mMenu.getContext()).startActivity(this.mIntent);\n                return true;\n            } catch (e){\n                android.util.Log.e(\"MenuItem\", \"Can't find activity to handle intent; ignoring\", e);\n            }\n        }\n        //if (this.mActionProvider != null && this.mActionProvider.onPerformDefaultAction()) {\n        //    return true;\n        //}\n        return false;\n    }\n}\n\nexport module MenuItem{\n/**\n     * Interface definition for a callback to be invoked when a menu item is\n     * clicked.\n     *\n     * @see Activity#onContextItemSelected(MenuItem)\n     * @see Activity#onOptionsItemSelected(MenuItem)\n     */\nexport interface OnMenuItemClickListener {\n\n    /**\n         * Called when a menu item has been invoked.  This is the first code\n         * that is executed; if it returns true, no other callbacks will be\n         * executed.\n         *\n         * @param item The menu item that was invoked.\n         *\n         * @return Return true to consume this click and prevent others from\n         *         executing.\n         */\n    onMenuItemClick(item:MenuItem):boolean ;\n}\n}\n\n}"
  },
  {
    "path": "src/android/view/MotionEvent.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../content/res/Resources.ts\"/>\n///<reference path=\"../graphics/Rect.ts\"/>\n///<reference path=\"../view/ViewConfiguration.ts\"/>\n///<reference path=\"../os/SystemClock.ts\"/>\n\n\nmodule android.view {\n    import Rect = android.graphics.Rect;\n    import ViewConfiguration = android.view.ViewConfiguration;\n\n\n    const tempBound = new Rect();\n\n    interface TouchEvent {\n        touches: TouchList;\n        changedTouches: TouchList;\n        type: string;\n        //targetTouches: TouchList;\n        //rotation: number;\n        //scale: number;\n    }\n    interface TouchList {\n        length: number;\n        [index: number]: Touch;\n    }\n    interface Touch {\n        //identifier: number;\n        id_fix:number;\n        target: EventTarget;\n        screenX: number;\n        screenY: number;\n        clientX: number;\n        clientY: number;\n        pageX: number;\n        pageY: number;\n\n        //add as history\n        mEventTime?:number;\n    }\n\n\n    const ID_FixID_Cache:Array<number> = [];\n    const tmpTouchEvent:TouchEvent = {\n        touches: null,\n        changedTouches: null,\n        type: null\n    };\n    /**\n     * identifier on iOS safari was not same as other platform\n     * http://stackoverflow.com/questions/25008690/javascript-ipad-touch-event-identifier-is-continually-incrementing\n     */\n    function fixEventId(e:TouchEvent):TouchEvent {\n        for (let i = 0, length = e.changedTouches.length; i < length; i++) {\n            fixTouchId(e.changedTouches[i]);\n        }\n        for (let i = 0, length = e.touches.length; i < length; i++) {\n            fixTouchId(e.touches[i]);\n        }\n        if(e.type == 'touchend' || e.type == 'touchcancel'){\n            ID_FixID_Cache[e.changedTouches[0].id_fix] = null;\n        }\n        tmpTouchEvent.type = e.type;\n        tmpTouchEvent.changedTouches = Array.from(e.changedTouches).map((touch) => fixTouchId(touch));\n        tmpTouchEvent.touches = Array.from(e.touches).map((touch) => fixTouchId(touch));\n        return tmpTouchEvent;\n    }\n    function fixTouchId(touch:Touch):Touch {\n        let originID = touch['identifier'];\n        let fix_id = ID_FixID_Cache.indexOf(originID);\n        if (fix_id < 0) {\n            for (let i = 0, length = ID_FixID_Cache.length + 1; i < length; i++) {\n                if(ID_FixID_Cache[i] == null){\n                    ID_FixID_Cache[i] = originID;\n                    fix_id = i;\n                    break;\n                }\n            }\n        }\n        return {\n            id_fix: fix_id,\n            target: touch.target,\n            screenX: touch.screenX,\n            screenY: touch.screenY,\n            clientX: touch.clientX,\n            clientY: touch.clientY,\n            pageX: touch.pageX,\n            pageY: touch.pageY,\n            mEventTime: touch.mEventTime,\n        };\n    }\n\n\n    /**\n     * Object used to report movement (mouse, pen, finger, trackball) events.\n     * Motion events may hold either absolute or relative movements and other data,\n     * depending on the type of device.\n     *\n     * <h3>Overview</h3>\n     * <p>\n     * Motion events describe movements in terms of an action code and a set of axis values.\n     * The action code specifies the state change that occurred such as a pointer going\n     * down or up.  The axis values describe the position and other movement properties.\n     * </p><p>\n     * For example, when the user first touches the screen, the system delivers a touch\n     * event to the appropriate {@link View} with the action code {@link #ACTION_DOWN}\n     * and a set of axis values that include the X and Y coordinates of the touch and\n     * information about the pressure, size and orientation of the contact area.\n     * </p><p>\n     * Some devices can report multiple movement traces at the same time.  Multi-touch\n     * screens emit one movement trace for each finger.  The individual fingers or\n     * other objects that generate movement traces are referred to as <em>pointers</em>.\n     * Motion events contain information about all of the pointers that are currently active\n     * even if some of them have not moved since the last event was delivered.\n     * </p><p>\n     * The number of pointers only ever changes by one as individual pointers go up and down,\n     * except when the gesture is canceled.\n     * </p><p>\n     * Each pointer has a unique id that is assigned when it first goes down\n     * (indicated by {@link #ACTION_DOWN} or {@link #ACTION_POINTER_DOWN}).  A pointer id\n     * remains valid until the pointer eventually goes up (indicated by {@link #ACTION_UP}\n     * or {@link #ACTION_POINTER_UP}) or when the gesture is canceled (indicated by\n     * {@link #ACTION_CANCEL}).\n     * </p><p>\n     * The MotionEvent class provides many methods to query the position and other properties of\n     * pointers, such as {@link #getX(int)}, {@link #getY(int)}, {@link #getAxisValue},\n     * {@link #getPointerId(int)}, {@link #getToolType(int)}, and many others.  Most of these\n     * methods accept the pointer index as a parameter rather than the pointer id.\n     * The pointer index of each pointer in the event ranges from 0 to one less than the value\n     * returned by {@link #getPointerCount()}.\n     * </p><p>\n     * The order in which individual pointers appear within a motion event is undefined.\n     * Thus the pointer index of a pointer can change from one event to the next but\n     * the pointer id of a pointer is guaranteed to remain constant as long as the pointer\n     * remains active.  Use the {@link #getPointerId(int)} method to obtain the\n     * pointer id of a pointer to track it across all subsequent motion events in a gesture.\n     * Then for successive motion events, use the {@link #findPointerIndex(int)} method\n     * to obtain the pointer index for a given pointer id in that motion event.\n     * </p><p>\n     * Mouse and stylus buttons can be retrieved using {@link #getButtonState()}.  It is a\n     * good idea to check the button state while handling {@link #ACTION_DOWN} as part\n     * of a touch event.  The application may choose to perform some different action\n     * if the touch event starts due to a secondary button click, such as presenting a\n     * context menu.\n     * </p>\n     *\n     * <h3>Batching</h3>\n     * <p>\n     * For efficiency, motion events with {@link #ACTION_MOVE} may batch together\n     * multiple movement samples within a single object.  The most current\n     * pointer coordinates are available using {@link #getX(int)} and {@link #getY(int)}.\n     * Earlier coordinates within the batch are accessed using {@link #getHistoricalX(int, int)}\n     * and {@link #getHistoricalY(int, int)}.  The coordinates are \"historical\" only\n     * insofar as they are older than the current coordinates in the batch; however,\n     * they are still distinct from any other coordinates reported in prior motion events.\n     * To process all coordinates in the batch in time order, first consume the historical\n     * coordinates then consume the current coordinates.\n     * </p><p>\n     * Example: Consuming all samples for all pointers in a motion event in time order.\n     * </p><p><pre><code>\n     * void printSamples(MotionEvent ev) {\n *     final int historySize = ev.getHistorySize();\n *     final int pointerCount = ev.getPointerCount();\n *     for (int h = 0; h &lt; historySize; h++) {\n *         System.out.printf(\"At time %d:\", ev.getHistoricalEventTime(h));\n *         for (int p = 0; p &lt; pointerCount; p++) {\n *             System.out.printf(\"  pointer %d: (%f,%f)\",\n *                 ev.getPointerId(p), ev.getHistoricalX(p, h), ev.getHistoricalY(p, h));\n *         }\n *     }\n *     System.out.printf(\"At time %d:\", ev.getEventTime());\n *     for (int p = 0; p &lt; pointerCount; p++) {\n *         System.out.printf(\"  pointer %d: (%f,%f)\",\n *             ev.getPointerId(p), ev.getX(p), ev.getY(p));\n *     }\n * }\n     * </code></pre></p>\n     *\n     * <h3>Device Types</h3>\n     * <p>\n     * The interpretation of the contents of a MotionEvent varies significantly depending\n     * on the source class of the device.\n     * </p><p>\n     * On pointing devices with source class {@link InputDevice#SOURCE_CLASS_POINTER}\n     * such as touch screens, the pointer coordinates specify absolute\n     * positions such as view X/Y coordinates.  Each complete gesture is represented\n     * by a sequence of motion events with actions that describe pointer state transitions\n     * and movements.  A gesture starts with a motion event with {@link #ACTION_DOWN}\n     * that provides the location of the first pointer down.  As each additional\n     * pointer that goes down or up, the framework will generate a motion event with\n     * {@link #ACTION_POINTER_DOWN} or {@link #ACTION_POINTER_UP} accordingly.\n     * Pointer movements are described by motion events with {@link #ACTION_MOVE}.\n     * Finally, a gesture end either when the final pointer goes up as represented\n     * by a motion event with {@link #ACTION_UP} or when gesture is canceled\n     * with {@link #ACTION_CANCEL}.\n     * </p><p>\n     * Some pointing devices such as mice may support vertical and/or horizontal scrolling.\n     * A scroll event is reported as a generic motion event with {@link #ACTION_SCROLL} that\n     * includes the relative scroll offset in the {@link #AXIS_VSCROLL} and\n     * {@link #AXIS_HSCROLL} axes.  See {@link #getAxisValue(int)} for information\n     * about retrieving these additional axes.\n     * </p><p>\n     * On trackball devices with source class {@link InputDevice#SOURCE_CLASS_TRACKBALL},\n     * the pointer coordinates specify relative movements as X/Y deltas.\n     * A trackball gesture consists of a sequence of movements described by motion\n     * events with {@link #ACTION_MOVE} interspersed with occasional {@link #ACTION_DOWN}\n     * or {@link #ACTION_UP} motion events when the trackball button is pressed or released.\n     * </p><p>\n     * On joystick devices with source class {@link InputDevice#SOURCE_CLASS_JOYSTICK},\n     * the pointer coordinates specify the absolute position of the joystick axes.\n     * The joystick axis values are normalized to a range of -1.0 to 1.0 where 0.0 corresponds\n     * to the center position.  More information about the set of available axes and the\n     * range of motion can be obtained using {@link InputDevice#getMotionRange}.\n     * Some common joystick axes are {@link #AXIS_X}, {@link #AXIS_Y},\n     * {@link #AXIS_HAT_X}, {@link #AXIS_HAT_Y}, {@link #AXIS_Z} and {@link #AXIS_RZ}.\n     * </p><p>\n     * Refer to {@link InputDevice} for more information about how different kinds of\n     * input devices and sources represent pointer coordinates.\n     * </p>\n     *\n     * <h3>Consistency Guarantees</h3>\n     * <p>\n     * Motion events are always delivered to views as a consistent stream of events.\n     * What constitutes a consistent stream varies depending on the type of device.\n     * For touch events, consistency implies that pointers go down one at a time,\n     * move around as a group and then go up one at a time or are canceled.\n     * </p><p>\n     * While the framework tries to deliver consistent streams of motion events to\n     * views, it cannot guarantee it.  Some events may be dropped or modified by\n     * containing views in the application before they are delivered thereby making\n     * the stream of events inconsistent.  Views should always be prepared to\n     * handle {@link #ACTION_CANCEL} and should tolerate anomalous\n     * situations such as receiving a new {@link #ACTION_DOWN} without first having\n     * received an {@link #ACTION_UP} for the prior gesture.\n     * </p>\n     */\n    export class MotionEvent {\n\n        /**\n         * An invalid pointer id.\n         *\n         * This value (-1) can be used as a placeholder to indicate that a pointer id\n         * has not been assigned or is not available.  It cannot appear as\n         * a pointer id inside a {@link MotionEvent}.\n         */\n        static INVALID_POINTER_ID:number = -1;\n\n        static ACTION_MASK = 0xff;\n        static ACTION_DOWN = 0;\n        static ACTION_UP = 1;\n        static ACTION_MOVE = 2;\n        static ACTION_CANCEL = 3;\n        static ACTION_OUTSIDE = 4;\n        static ACTION_POINTER_DOWN = 5;\n        static ACTION_POINTER_UP = 6;\n        static ACTION_HOVER_MOVE = 7;\n        static ACTION_SCROLL = 8;\n        static ACTION_HOVER_ENTER = 9;\n        static ACTION_HOVER_EXIT = 10;\n\n        static EDGE_TOP = 0x00000001;\n        static EDGE_BOTTOM = 0x00000002;\n        static EDGE_LEFT = 0x00000004;\n        static EDGE_RIGHT = 0x00000008;\n\n        static ACTION_POINTER_INDEX_MASK = 0xff00;\n        static ACTION_POINTER_INDEX_SHIFT = 8;\n\n        static AXIS_VSCROLL = 9;\n        static AXIS_HSCROLL = 10;\n\n        static HistoryMaxSize = 10;\n\n        private static TouchMoveRecord = new Map<number, Array<Touch>>();// (id, [])\n\n        mAction = 0;\n        mEdgeFlags = 0;\n        mDownTime = 0;\n        mEventTime = 0;\n        //mActiveActionIndex = 0;\n        mActivePointerId = 0;\n        private mTouchingPointers:Array<Touch>;\n        mXOffset = 0;\n        mYOffset = 0;\n\n        _activeTouch:any;\n        //_event:any;\n        private _axisValues = new Map<number, number>();\n\n        static obtainWithTouchEvent(e, action:number):MotionEvent {\n            let event = new MotionEvent();\n            event.initWithTouch(e, action);\n            return event;\n        }\n\n        static obtain(event:MotionEvent):MotionEvent {\n            let newEv = new MotionEvent();\n            Object.assign(newEv, event);\n            return newEv;\n        }\n        static obtainWithAction(downTime:number, eventTime:number, action:number, x:number, y:number, metaState=0):MotionEvent {\n            let newEv = new MotionEvent();\n            newEv.mAction = action;\n            newEv.mDownTime = downTime;\n            newEv.mEventTime = eventTime;\n            let touch:Touch = {\n                //identifier: 0,\n                id_fix: 0,\n                target: null,\n                screenX: x,\n                screenY: y,\n                clientX: x,\n                clientY: y,\n                pageX: x,\n                pageY: y\n            };\n            newEv.mTouchingPointers = [touch];\n            return newEv;\n        }\n\n        private static IdIndexCache = new Map<number, number>();\n\n        initWithTouch(event, baseAction:number, windowBound = new Rect() ) {\n            let e = fixEventId(event);\n\n            let now = android.os.SystemClock.uptimeMillis();\n            //get actionIndex\n            let action = baseAction;\n            let actionIndex = -1;\n            let activeTouch = e.changedTouches[0];\n            this._activeTouch = activeTouch;\n            let activePointerId = activeTouch.id_fix;\n            if (activePointerId == null) console.warn('activePointerId null, activeTouch.identifier: ' + activeTouch['identifier']);\n            for (let i = 0, length = e.touches.length; i < length; i++) {\n                if (e.touches[i].id_fix === activePointerId) {\n                    actionIndex = i;\n                    MotionEvent.IdIndexCache.set(activePointerId, i);//cache the index, action_up will use\n                    break;\n                }\n            }\n            if (actionIndex < 0 && (baseAction === MotionEvent.ACTION_UP||baseAction === MotionEvent.ACTION_CANCEL)) {\n                //if action is touchend, use last index (because it is not exist in webkit event.touches)\n                actionIndex = MotionEvent.IdIndexCache.get(activePointerId);\n            }\n            if (actionIndex < 0) throw Error('not find action index');\n\n\n\n            //touch move record\n            switch (baseAction) {\n                case MotionEvent.ACTION_DOWN:\n                case MotionEvent.ACTION_UP:\n                    MotionEvent.TouchMoveRecord.set(activePointerId, []);\n                    break;\n                case MotionEvent.ACTION_MOVE:\n                    let moveHistory = MotionEvent.TouchMoveRecord.get(activePointerId);\n                    if (moveHistory){\n                        activeTouch.mEventTime = now;\n                        moveHistory.push(activeTouch);\n                        if(moveHistory.length>MotionEvent.HistoryMaxSize) moveHistory.shift();\n                    }\n                    break;\n            }\n\n\n            this.mTouchingPointers = Array.from(e.touches);\n            if(baseAction === MotionEvent.ACTION_UP || baseAction === MotionEvent.ACTION_CANCEL){//add the touch end to touching list\n                this.mTouchingPointers.splice(actionIndex, 0, activeTouch);\n            }\n\n\n            //check if ACTION_POINTER_UP/ACTION_POINTER_DOWN, and mask the action\n            if (this.mTouchingPointers.length>1) {\n                //the event is not the first event on screen\n                switch (action) {\n                    case MotionEvent.ACTION_DOWN:\n                        action = MotionEvent.ACTION_POINTER_DOWN;\n                        action = actionIndex << MotionEvent.ACTION_POINTER_INDEX_SHIFT | action;\n                        break;\n                    case MotionEvent.ACTION_UP:\n                        action = MotionEvent.ACTION_POINTER_UP;\n                        action = actionIndex << MotionEvent.ACTION_POINTER_INDEX_SHIFT | action;\n                        break;\n                }\n            }\n\n\n            //let lastAction = this.mAction;\n            // index & id to action\n            this.mAction = action;\n            //this.mActiveActionIndex = actionIndex;\n            this.mActivePointerId = activePointerId;\n\n            if (action == MotionEvent.ACTION_DOWN) {\n                this.mDownTime = now;\n            }\n            this.mEventTime = now;\n            const density = android.content.res.Resources.getSystem().getDisplayMetrics().density;\n            this.mXOffset = this.mYOffset = 0;\n\n            //set edge flag\n            let edgeFlag = 0;\n            let unScaledX = activeTouch.pageX;\n            let unScaledY = activeTouch.pageY;\n            let edgeSlop = ViewConfiguration.EDGE_SLOP;\n\n            tempBound.set(windowBound);\n            tempBound.right = tempBound.left + edgeSlop;\n            if(tempBound.contains(unScaledX, unScaledY)){\n                edgeFlag |= MotionEvent.EDGE_LEFT;\n            }\n\n            tempBound.set(windowBound);\n            tempBound.bottom = tempBound.top + edgeSlop;\n            if(tempBound.contains(unScaledX, unScaledY)){\n                edgeFlag |= MotionEvent.EDGE_TOP;\n            }\n\n            tempBound.set(windowBound);\n            tempBound.left = tempBound.right - edgeSlop;\n            if(tempBound.contains(unScaledX, unScaledY)){\n                edgeFlag |= MotionEvent.EDGE_RIGHT;\n            }\n\n            tempBound.set(windowBound);\n            tempBound.top = tempBound.bottom - edgeSlop;\n            if(tempBound.contains(unScaledX, unScaledY)){\n                edgeFlag |= MotionEvent.EDGE_BOTTOM;\n            }\n            this.mEdgeFlags = edgeFlag;\n\n        }\n\n        initWithMouseWheel(e:WheelEvent){\n            this.mAction = MotionEvent.ACTION_SCROLL;\n            this.mActivePointerId = 0;\n            let touch:Touch = {\n                //identifier: 0,\n                id_fix: 0,\n                target: null,\n                screenX: e.screenX,\n                screenY: e.screenY,\n                clientX: e.clientX,\n                clientY: e.clientY,\n                pageX: e.pageX,\n                pageY: e.pageY\n            };\n            this.mTouchingPointers = [touch];\n            this.mDownTime = this.mEventTime = android.os.SystemClock.uptimeMillis();\n            this.mXOffset = this.mYOffset = 0;\n            this._axisValues.clear();\n            this._axisValues.set(MotionEvent.AXIS_VSCROLL, -e.deltaY);\n            this._axisValues.set(MotionEvent.AXIS_HSCROLL, -e.deltaX);\n        }\n\n        /**\n         * Recycle the MotionEvent, to be re-used by a later caller.  After calling\n         * this function you must not ever touch the event again.\n         */\n        recycle() {\n            //TODO recycle motionEvent\n        }\n\n        /**\n         * Return the kind of action being performed -- one of either\n         * {@link #ACTION_DOWN}, {@link #ACTION_MOVE}, {@link #ACTION_UP}, or\n         * {@link #ACTION_CANCEL}.  Consider using {@link #getActionMasked}\n         * and {@link #getActionIndex} to retrieve the separate masked action\n         * and pointer index.\n         */\n        getAction():number {\n            return this.mAction;\n        }\n\n        /**\n         * Return the masked action being performed, without pointer index\n         * information.  May be any of the actions: {@link #ACTION_DOWN},\n         * {@link #ACTION_MOVE}, {@link #ACTION_UP}, {@link #ACTION_CANCEL},\n         * {@link #ACTION_POINTER_DOWN}, or {@link #ACTION_POINTER_UP}.\n         * Use {@link #getActionIndex} to return the index associated with\n         * pointer actions.\n         */\n        getActionMasked():number {\n            return this.mAction & MotionEvent.ACTION_MASK;\n        }\n\n        getActionIndex():number {\n            return (this.mAction & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;\n        }\n\n        //return in ms(start time of event stream)\n        getDownTime():number {\n            return this.mDownTime;\n        }\n\n        //return in ms\n        getEventTime():number {\n            return this.mEventTime;\n        }\n\n        getX(pointerIndex = 0):number {\n            let density = android.content.res.Resources.getDisplayMetrics().density;\n            return (this.mTouchingPointers[pointerIndex].pageX) * density + this.mXOffset;\n        }\n\n        getY(pointerIndex = 0):number {\n            let density = android.content.res.Resources.getDisplayMetrics().density;\n            return (this.mTouchingPointers[pointerIndex].pageY) * density + this.mYOffset;\n        }\n\n        getPointerCount():number {\n            return this.mTouchingPointers.length;\n        }\n\n        getPointerId(pointerIndex:number):number {\n            return this.mTouchingPointers[pointerIndex].id_fix;\n        }\n\n\n        findPointerIndex(pointerId:number):number {\n            for (let i = 0, length = this.mTouchingPointers.length; i < length; i++) {\n                if (this.mTouchingPointers[i].id_fix === pointerId) {\n                    return i;\n                }\n            }\n            return -1;\n        }\n\n        getRawX():number {\n            let density = android.content.res.Resources.getDisplayMetrics().density;\n            return (this.mTouchingPointers[0].pageX) * density;\n        }\n\n        getRawY():number {\n            let density = android.content.res.Resources.getDisplayMetrics().density;\n            return (this.mTouchingPointers[0].pageY) * density;\n        }\n\n        getHistorySize(id=this.mActivePointerId):number {\n            let moveHistory = MotionEvent.TouchMoveRecord.get(id);\n            return moveHistory ? moveHistory.length : 0;\n        }\n\n        getHistoricalX(pointerIndex:number, pos:number):number {\n            let density = android.content.res.Resources.getDisplayMetrics().density;\n            let moveHistory = MotionEvent.TouchMoveRecord.get(this.mTouchingPointers[pointerIndex].id_fix);\n            return (moveHistory[pos].pageX) * density + this.mXOffset;\n        }\n\n        getHistoricalY(pointerIndex:number, pos:number):number {\n            let density = android.content.res.Resources.getDisplayMetrics().density;\n            let moveHistory = MotionEvent.TouchMoveRecord.get(this.mTouchingPointers[pointerIndex].id_fix);\n            return (moveHistory[pos].pageY) * density + this.mYOffset;\n        }\n\n        getHistoricalEventTime(pos:number):number;\n        getHistoricalEventTime(pointerIndex:number, pos:number):number;\n        getHistoricalEventTime(...args):number{\n            let pos, activePointerId;\n            if(args.length===1){\n                pos = args[0];\n                activePointerId = this.mActivePointerId;\n            }else{\n                pos = args[1];\n                activePointerId = this.getPointerId(args[0]);\n            }\n            let moveHistory = MotionEvent.TouchMoveRecord.get(activePointerId);\n            return moveHistory[pos].mEventTime;\n        }\n\n        getTouchMajor(pointerIndex?:number):number {\n            return Math.floor(android.content.res.Resources.getDisplayMetrics().density);//no touch major impl\n        }\n        getHistoricalTouchMajor(pointerIndex?:number, pos?:number):number {\n            return Math.floor(android.content.res.Resources.getDisplayMetrics().density);//no touch major impl\n        }\n\n        /**\n         * Returns a bitfield indicating which edges, if any, were touched by this\n         * MotionEvent. For touch events, clients can use this to determine if the\n         * user's finger was touching the edge of the display.\n         *\n         * @see #EDGE_LEFT\n         * @see #EDGE_TOP\n         * @see #EDGE_RIGHT\n         * @see #EDGE_BOTTOM\n         */\n        getEdgeFlags():number {\n            return this.mEdgeFlags;\n        }\n\n        /**\n         * Sets the bitfield indicating which edges, if any, were touched by this\n         * MotionEvent.\n         *\n         * @see #getEdgeFlags()\n         */\n        setEdgeFlags(flags:number) {\n            this.mEdgeFlags = flags;\n        }\n        setAction(action:number) {\n            this.mAction = action;\n        }\n        isTouchEvent():boolean{\n            let action = this.getActionMasked();\n            switch (action){\n                case MotionEvent.ACTION_DOWN:\n                case MotionEvent.ACTION_UP:\n                case MotionEvent.ACTION_MOVE:\n                case MotionEvent.ACTION_CANCEL:\n                case MotionEvent.ACTION_OUTSIDE:\n                case MotionEvent.ACTION_POINTER_DOWN:\n                case MotionEvent.ACTION_POINTER_UP:\n                    return true;\n            }\n            return false;\n        }\n        isPointerEvent():boolean{\n            return true;//all event was pointer event now\n        }\n\n        offsetLocation(deltaX:number, deltaY:number) {\n            this.mXOffset += deltaX;\n            this.mYOffset += deltaY;\n        }\n\n        setLocation(x:number, y:number) {\n            this.mXOffset = x - this.getRawX();\n            this.mYOffset = y - this.getRawY();\n        }\n\n        getPointerIdBits():number {\n            let idBits = 0;\n            let pointerCount = this.getPointerCount();\n            for (let i = 0; i < pointerCount; i++) {\n                idBits |= 1 << this.getPointerId(i);\n            }\n            return idBits;\n        }\n\n        split(idBits:number):MotionEvent {\n            let ev = MotionEvent.obtain(this);\n\n            let oldPointerCount = this.getPointerCount();\n            const oldAction = this.getAction();\n            const oldActionMasked = oldAction & MotionEvent.ACTION_MASK;\n\n            let newPointerIds = [];\n            for (let i = 0; i < oldPointerCount; i++) {\n                let pointerId = this.getPointerId(i);\n                let idBit = 1 << pointerId;\n                if ((idBit & idBits) != 0) {\n                    newPointerIds.push(pointerId);\n                }\n            }\n\n            let newActionPointerIndex = newPointerIds.indexOf(this.mActivePointerId);\n            let newPointerCount = newPointerIds.length;\n            let newAction;\n            if (oldActionMasked == MotionEvent.ACTION_POINTER_DOWN || oldActionMasked == MotionEvent.ACTION_POINTER_UP) {\n                if (newActionPointerIndex < 0) {\n                    // An unrelated pointer changed.\n                    newAction = MotionEvent.ACTION_MOVE;\n                } else if (newPointerCount == 1) {\n                    // The first/last pointer went down/up.\n                    newAction = oldActionMasked == MotionEvent.ACTION_POINTER_DOWN\n                        ? MotionEvent.ACTION_DOWN : MotionEvent.ACTION_UP;\n                } else {\n                    // A secondary pointer went down/up.\n                    newAction = oldActionMasked | (newActionPointerIndex << MotionEvent.ACTION_POINTER_INDEX_SHIFT);\n                }\n            } else {\n                // Simple up/down/cancel/move or other motion action.\n                newAction = oldAction;\n            }\n\n            ev.mAction = newAction;\n            ev.mTouchingPointers = this.mTouchingPointers.filter((item:Touch)=> {\n                return newPointerIds.indexOf(item.id_fix) >= 0;\n            });\n\n            return ev;\n        }\n\n        getAxisValue(axis:number):number{\n            let value = this._axisValues.get(axis);\n            return value ? value : 0;\n        }\n\n        toString() {\n            return \"MotionEvent{action=\" + this.getAction() + \" x=\" + this.getX()\n                + \" y=\" + this.getY() + \"}\";\n        }\n\n    }\n\n}"
  },
  {
    "path": "src/android/view/ScaleGestureDetector.ts",
    "content": "/*\n * Copyright (C) 2010 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/content/res/Resources.ts\"/>\n///<reference path=\"../../android/os/Handler.ts\"/>\n///<reference path=\"../../android/os/SystemClock.ts\"/>\n///<reference path=\"../../java/lang/Float.ts\"/>\n///<reference path=\"../../android/view/GestureDetector.ts\"/>\n///<reference path=\"../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewConfiguration.ts\"/>\n///<reference path=\"../../android/util/TypedValue.ts\"/>\n\nmodule android.view {\nimport Resources = android.content.res.Resources;\nimport Handler = android.os.Handler;\nimport SystemClock = android.os.SystemClock;\nimport Float = java.lang.Float;\nimport MotionEvent = android.view.MotionEvent;\nimport View = android.view.View;\nimport ViewConfiguration = android.view.ViewConfiguration;\nimport TypedValue = android.util.TypedValue;\n/**\n * Detects scaling transformation gestures using the supplied {@link MotionEvent}s.\n * The {@link OnScaleGestureListener} callback will notify users when a particular\n * gesture event has occurred.\n *\n * This class should only be used with {@link MotionEvent}s reported via touch.\n *\n * To use this class:\n * <ul>\n *  <li>Create an instance of the {@code ScaleGestureDetector} for your\n *      {@link View}\n *  <li>In the {@link View#onTouchEvent(MotionEvent)} method ensure you call\n *          {@link #onTouchEvent(MotionEvent)}. The methods defined in your\n *          callback will be executed when the events occur.\n * </ul>\n */\nexport class ScaleGestureDetector {\n\n    private static TAG:string = \"ScaleGestureDetector\";\n\n    //private mContext:Context;\n\n    private mListener:ScaleGestureDetector.OnScaleGestureListener;\n\n    private mFocusX:number = 0;\n\n    private mFocusY:number = 0;\n\n    private mQuickScaleEnabled:boolean;\n\n    private mCurrSpan:number = 0;\n\n    private mPrevSpan:number = 0;\n\n    private mInitialSpan:number = 0;\n\n    private mCurrSpanX:number = 0;\n\n    private mCurrSpanY:number = 0;\n\n    private mPrevSpanX:number = 0;\n\n    private mPrevSpanY:number = 0;\n\n    private mCurrTime:number = 0;\n\n    private mPrevTime:number = 0;\n\n    private mInProgress:boolean;\n\n    private mSpanSlop:number = 0;\n\n    private mMinSpan:number = 0;\n\n    // Bounds for recently seen values\n    private mTouchUpper:number = 0;\n\n    private mTouchLower:number = 0;\n\n    private mTouchHistoryLastAccepted:number = 0;\n\n    private mTouchHistoryDirection:number = 0;\n\n    private mTouchHistoryLastAcceptedTime:number = 0;\n\n    private mTouchMinMajor:number = 0;\n\n    private mDoubleTapEvent:MotionEvent;\n\n    private mDoubleTapMode:number = ScaleGestureDetector.DOUBLE_TAP_MODE_NONE;\n\n    private mHandler:any;\n\n    // ms\n    private static TOUCH_STABILIZE_TIME:number = 128;\n\n    private static DOUBLE_TAP_MODE_NONE:number = 0;\n\n    private static DOUBLE_TAP_MODE_IN_PROGRESS:number = 1;\n\n    private static SCALE_FACTOR:number = .5;\n\n    ///**\n    // * Consistency verifier for debugging purposes.\n    // */\n    //private mInputEventConsistencyVerifier:InputEventConsistencyVerifier = InputEventConsistencyVerifier.isInstrumentationEnabled() ? new InputEventConsistencyVerifier(this, 0) : null;\n\n    private mGestureDetector:GestureDetector;\n\n    private mEventBeforeOrAboveStartingGestureEvent:boolean;\n\n    /**\n     * Creates a ScaleGestureDetector with the supplied listener.\n     * @see android.os.Handler#Handler()\n     *\n     * @param context the application's context\n     * @param listener the listener invoked for all the callbacks, this must\n     * not be null.\n     * @param handler the handler to use for running deferred listener events.\n     *\n     * @throws NullPointerException if {@code listener} is null.\n     */\n    constructor(listener:ScaleGestureDetector.OnScaleGestureListener, handler?:any) {\n        //this.mContext = context;\n        this.mListener = listener;\n        this.mSpanSlop = ViewConfiguration.get().getScaledTouchSlop() * 2;\n        this.mTouchMinMajor = TypedValue.complexToDimensionPixelSize('48dp');//Resources.getDimensionPixelSize(com.android.internal.R.dimen.config_minScalingTouchMajor);\n        this.mMinSpan = TypedValue.complexToDimensionPixelSize('27mm');//Resources.getDimensionPixelSize(com.android.internal.R.dimen.config_minScalingSpan);\n        this.mHandler = handler;\n        // Quick scale is enabled by default after JB_MR2\n        this.setQuickScaleEnabled(true);\n    }\n\n    /**\n     * The touchMajor/touchMinor elements of a MotionEvent can flutter/jitter on\n     * some hardware/driver combos. Smooth it out to get kinder, gentler behavior.\n     * @param ev MotionEvent to add to the ongoing history\n     */\n    private addTouchHistory(ev:MotionEvent):void  {\n        const currentTime:number = SystemClock.uptimeMillis();\n        const count:number = ev.getPointerCount();\n        let accept:boolean = currentTime - this.mTouchHistoryLastAcceptedTime >= ScaleGestureDetector.TOUCH_STABILIZE_TIME;\n        let total:number = 0;\n        let sampleCount:number = 0;\n        for (let i:number = 0; i < count; i++) {\n            const hasLastAccepted:boolean = !Number.isNaN(this.mTouchHistoryLastAccepted);\n            const historySize:number = ev.getHistorySize();\n            const pointerSampleCount:number = historySize + 1;\n            for (let h:number = 0; h < pointerSampleCount; h++) {\n                let major:number;\n                if (h < historySize) {\n                    major = ev.getHistoricalTouchMajor(i, h);\n                } else {\n                    major = ev.getTouchMajor(i);\n                }\n                if (major < this.mTouchMinMajor)\n                    major = this.mTouchMinMajor;\n                total += major;\n                if (Number.isNaN(this.mTouchUpper) || major > this.mTouchUpper) {\n                    this.mTouchUpper = major;\n                }\n                if (Number.isNaN(this.mTouchLower) || major < this.mTouchLower) {\n                    this.mTouchLower = major;\n                }\n                if (hasLastAccepted) {\n                    function Math_signum(value:number):number{\n                        if(value === 0 || Number.isNaN(value)) return value;\n                        return Math.abs(value)===value ? 1 : -1;\n                    }\n                    const directionSig:number = Math.floor(Math_signum(major - this.mTouchHistoryLastAccepted));\n                    if (directionSig != this.mTouchHistoryDirection || (directionSig == 0 && this.mTouchHistoryDirection == 0)) {\n                        this.mTouchHistoryDirection = directionSig;\n                        const time:number = h < historySize ? ev.getHistoricalEventTime(h) : ev.getEventTime();\n                        this.mTouchHistoryLastAcceptedTime = time;\n                        accept = false;\n                    }\n                }\n            }\n            sampleCount += pointerSampleCount;\n        }\n        const avg:number = total / sampleCount;\n        if (accept) {\n            let newAccepted:number = (this.mTouchUpper + this.mTouchLower + avg) / 3;\n            this.mTouchUpper = (this.mTouchUpper + newAccepted) / 2;\n            this.mTouchLower = (this.mTouchLower + newAccepted) / 2;\n            this.mTouchHistoryLastAccepted = newAccepted;\n            this.mTouchHistoryDirection = 0;\n            this.mTouchHistoryLastAcceptedTime = ev.getEventTime();\n        }\n    }\n\n    /**\n     * Clear all touch history tracking. Useful in ACTION_CANCEL or ACTION_UP.\n     * @see #addTouchHistory(MotionEvent)\n     */\n    private clearTouchHistory():void  {\n        this.mTouchUpper = Number.NaN;\n        this.mTouchLower = Number.NaN;\n        this.mTouchHistoryLastAccepted = Number.NaN;\n        this.mTouchHistoryDirection = 0;\n        this.mTouchHistoryLastAcceptedTime = 0;\n    }\n\n    /**\n     * Accepts MotionEvents and dispatches events to a {@link OnScaleGestureListener}\n     * when appropriate.\n     *\n     * <p>Applications should pass a complete and consistent event stream to this method.\n     * A complete and consistent event stream involves all MotionEvents from the initial\n     * ACTION_DOWN to the final ACTION_UP or ACTION_CANCEL.</p>\n     *\n     * @param event The event to process\n     * @return true if the event was processed and the detector wants to receive the\n     *         rest of the MotionEvents in this event stream.\n     */\n    onTouchEvent(event:MotionEvent):boolean  {\n        //if (this.mInputEventConsistencyVerifier != null) {\n        //    this.mInputEventConsistencyVerifier.onTouchEvent(event, 0);\n        //}\n        this.mCurrTime = event.getEventTime();\n        const action:number = event.getActionMasked();\n        // Forward the event to check for double tap gesture\n        if (this.mQuickScaleEnabled) {\n            this.mGestureDetector.onTouchEvent(event);\n        }\n        const streamComplete:boolean = action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL;\n        if (action == MotionEvent.ACTION_DOWN || streamComplete) {\n            // This means the app probably didn't give us all the events. Shame on it.\n            if (this.mInProgress) {\n                this.mListener.onScaleEnd(this);\n                this.mInProgress = false;\n                this.mInitialSpan = 0;\n                this.mDoubleTapMode = ScaleGestureDetector.DOUBLE_TAP_MODE_NONE;\n            } else if (this.mDoubleTapMode == ScaleGestureDetector.DOUBLE_TAP_MODE_IN_PROGRESS && streamComplete) {\n                this.mInProgress = false;\n                this.mInitialSpan = 0;\n                this.mDoubleTapMode = ScaleGestureDetector.DOUBLE_TAP_MODE_NONE;\n            }\n            if (streamComplete) {\n                this.clearTouchHistory();\n                return true;\n            }\n        }\n        const configChanged:boolean = action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_POINTER_UP || action == MotionEvent.ACTION_POINTER_DOWN;\n        const pointerUp:boolean = action == MotionEvent.ACTION_POINTER_UP;\n        const skipIndex:number = pointerUp ? event.getActionIndex() : -1;\n        // Determine focal point\n        let sumX:number = 0, sumY:number = 0;\n        const count:number = event.getPointerCount();\n        const div:number = pointerUp ? count - 1 : count;\n        let focusX:number;\n        let focusY:number;\n        if (this.mDoubleTapMode == ScaleGestureDetector.DOUBLE_TAP_MODE_IN_PROGRESS) {\n            // In double tap mode, the focal pt is always where the double tap\n            // gesture started\n            focusX = this.mDoubleTapEvent.getX();\n            focusY = this.mDoubleTapEvent.getY();\n            if (event.getY() < focusY) {\n                this.mEventBeforeOrAboveStartingGestureEvent = true;\n            } else {\n                this.mEventBeforeOrAboveStartingGestureEvent = false;\n            }\n        } else {\n            for (let i:number = 0; i < count; i++) {\n                if (skipIndex == i)\n                    continue;\n                sumX += event.getX(i);\n                sumY += event.getY(i);\n            }\n            focusX = sumX / div;\n            focusY = sumY / div;\n        }\n        this.addTouchHistory(event);\n        // Determine average deviation from focal point\n        let devSumX:number = 0, devSumY:number = 0;\n        for (let i:number = 0; i < count; i++) {\n            if (skipIndex == i)\n                continue;\n            // Convert the resulting diameter into a radius.\n            const touchSize:number = this.mTouchHistoryLastAccepted / 2;\n            devSumX += Math.abs(event.getX(i) - focusX) + touchSize;\n            devSumY += Math.abs(event.getY(i) - focusY) + touchSize;\n        }\n        const devX:number = devSumX / div;\n        const devY:number = devSumY / div;\n        // Span is the average distance between touch points through the focal point;\n        // i.e. the diameter of the circle with a radius of the average deviation from\n        // the focal point.\n        const spanX:number = devX * 2;\n        const spanY:number = devY * 2;\n        let span:number;\n        if (this.inDoubleTapMode()) {\n            span = spanY;\n        } else {\n            span = Math.sqrt(spanX * spanX + spanY * spanY);\n        }\n        // Dispatch begin/end events as needed.\n        // If the configuration changes, notify the app to reset its current state by beginning\n        // a fresh scale event stream.\n        const wasInProgress:boolean = this.mInProgress;\n        this.mFocusX = focusX;\n        this.mFocusY = focusY;\n        if (!this.inDoubleTapMode() && this.mInProgress && (span < this.mMinSpan || configChanged)) {\n            this.mListener.onScaleEnd(this);\n            this.mInProgress = false;\n            this.mInitialSpan = span;\n            this.mDoubleTapMode = ScaleGestureDetector.DOUBLE_TAP_MODE_NONE;\n        }\n        if (configChanged) {\n            this.mPrevSpanX = this.mCurrSpanX = spanX;\n            this.mPrevSpanY = this.mCurrSpanY = spanY;\n            this.mInitialSpan = this.mPrevSpan = this.mCurrSpan = span;\n        }\n        const minSpan:number = this.inDoubleTapMode() ? this.mSpanSlop : this.mMinSpan;\n        if (!this.mInProgress && span >= minSpan && (wasInProgress || Math.abs(span - this.mInitialSpan) > this.mSpanSlop)) {\n            this.mPrevSpanX = this.mCurrSpanX = spanX;\n            this.mPrevSpanY = this.mCurrSpanY = spanY;\n            this.mPrevSpan = this.mCurrSpan = span;\n            this.mPrevTime = this.mCurrTime;\n            this.mInProgress = this.mListener.onScaleBegin(this);\n        }\n        // Handle motion; focal point and span/scale factor are changing.\n        if (action == MotionEvent.ACTION_MOVE) {\n            this.mCurrSpanX = spanX;\n            this.mCurrSpanY = spanY;\n            this.mCurrSpan = span;\n            let updatePrev:boolean = true;\n            if (this.mInProgress) {\n                updatePrev = this.mListener.onScale(this);\n            }\n            if (updatePrev) {\n                this.mPrevSpanX = this.mCurrSpanX;\n                this.mPrevSpanY = this.mCurrSpanY;\n                this.mPrevSpan = this.mCurrSpan;\n                this.mPrevTime = this.mCurrTime;\n            }\n        }\n        return true;\n    }\n\n    private inDoubleTapMode():boolean  {\n        return this.mDoubleTapMode == ScaleGestureDetector.DOUBLE_TAP_MODE_IN_PROGRESS;\n    }\n\n    /**\n     * Set whether the associated {@link OnScaleGestureListener} should receive onScale callbacks\n     * when the user performs a doubleTap followed by a swipe. Note that this is enabled by default\n     * if the app targets API 19 and newer.\n     * @param scales true to enable quick scaling, false to disable\n     */\n    setQuickScaleEnabled(scales:boolean):void  {\n        this.mQuickScaleEnabled = scales;\n        if (this.mQuickScaleEnabled && this.mGestureDetector == null) {\n            let gestureListener:GestureDetector.SimpleOnGestureListener = (()=>{\n                const inner_this=this;\n                class _Inner extends GestureDetector.SimpleOnGestureListener {\n\n                    onDoubleTap(e:MotionEvent):boolean  {\n                        // Double tap: start watching for a swipe\n                        inner_this.mDoubleTapEvent = e;\n                        inner_this.mDoubleTapMode = ScaleGestureDetector.DOUBLE_TAP_MODE_IN_PROGRESS;\n                        return true;\n                    }\n                }\n                return new _Inner();\n            })();\n            this.mGestureDetector = new GestureDetector(gestureListener, this.mHandler);\n        }\n    }\n\n    /**\n   * Return whether the quick scale gesture, in which the user performs a double tap followed by a\n   * swipe, should perform scaling. {@see #setQuickScaleEnabled(boolean)}.\n   */\n    isQuickScaleEnabled():boolean  {\n        return this.mQuickScaleEnabled;\n    }\n\n    /**\n     * Returns {@code true} if a scale gesture is in progress.\n     */\n    isInProgress():boolean  {\n        return this.mInProgress;\n    }\n\n    /**\n     * Get the X coordinate of the current gesture's focal point.\n     * If a gesture is in progress, the focal point is between\n     * each of the pointers forming the gesture.\n     *\n     * If {@link #isInProgress()} would return false, the result of this\n     * function is undefined.\n     *\n     * @return X coordinate of the focal point in pixels.\n     */\n    getFocusX():number  {\n        return this.mFocusX;\n    }\n\n    /**\n     * Get the Y coordinate of the current gesture's focal point.\n     * If a gesture is in progress, the focal point is between\n     * each of the pointers forming the gesture.\n     *\n     * If {@link #isInProgress()} would return false, the result of this\n     * function is undefined.\n     *\n     * @return Y coordinate of the focal point in pixels.\n     */\n    getFocusY():number  {\n        return this.mFocusY;\n    }\n\n    /**\n     * Return the average distance between each of the pointers forming the\n     * gesture in progress through the focal point.\n     *\n     * @return Distance between pointers in pixels.\n     */\n    getCurrentSpan():number  {\n        return this.mCurrSpan;\n    }\n\n    /**\n     * Return the average X distance between each of the pointers forming the\n     * gesture in progress through the focal point.\n     *\n     * @return Distance between pointers in pixels.\n     */\n    getCurrentSpanX():number  {\n        return this.mCurrSpanX;\n    }\n\n    /**\n     * Return the average Y distance between each of the pointers forming the\n     * gesture in progress through the focal point.\n     *\n     * @return Distance between pointers in pixels.\n     */\n    getCurrentSpanY():number  {\n        return this.mCurrSpanY;\n    }\n\n    /**\n     * Return the previous average distance between each of the pointers forming the\n     * gesture in progress through the focal point.\n     *\n     * @return Previous distance between pointers in pixels.\n     */\n    getPreviousSpan():number  {\n        return this.mPrevSpan;\n    }\n\n    /**\n     * Return the previous average X distance between each of the pointers forming the\n     * gesture in progress through the focal point.\n     *\n     * @return Previous distance between pointers in pixels.\n     */\n    getPreviousSpanX():number  {\n        return this.mPrevSpanX;\n    }\n\n    /**\n     * Return the previous average Y distance between each of the pointers forming the\n     * gesture in progress through the focal point.\n     *\n     * @return Previous distance between pointers in pixels.\n     */\n    getPreviousSpanY():number  {\n        return this.mPrevSpanY;\n    }\n\n    /**\n     * Return the scaling factor from the previous scale event to the current\n     * event. This value is defined as\n     * ({@link #getCurrentSpan()} / {@link #getPreviousSpan()}).\n     *\n     * @return The current scaling factor.\n     */\n    getScaleFactor():number  {\n        if (this.inDoubleTapMode()) {\n            // Drag is moving up; the further away from the gesture\n            // start, the smaller the span should be, the closer,\n            // the larger the span, and therefore the larger the scale\n            const scaleUp:boolean = (this.mEventBeforeOrAboveStartingGestureEvent && (this.mCurrSpan < this.mPrevSpan)) || (!this.mEventBeforeOrAboveStartingGestureEvent && (this.mCurrSpan > this.mPrevSpan));\n            const spanDiff:number = (Math.abs(1 - (this.mCurrSpan / this.mPrevSpan)) * ScaleGestureDetector.SCALE_FACTOR);\n            return this.mPrevSpan <= 0 ? 1 : scaleUp ? (1 + spanDiff) : (1 - spanDiff);\n        }\n        return this.mPrevSpan > 0 ? this.mCurrSpan / this.mPrevSpan : 1;\n    }\n\n    /**\n     * Return the time difference in milliseconds between the previous\n     * accepted scaling event and the current scaling event.\n     *\n     * @return Time difference since the last scaling event in milliseconds.\n     */\n    getTimeDelta():number  {\n        return this.mCurrTime - this.mPrevTime;\n    }\n\n    /**\n     * Return the event time of the current event being processed.\n     *\n     * @return Current event time in milliseconds.\n     */\n    getEventTime():number  {\n        return this.mCurrTime;\n    }\n}\n\nexport module ScaleGestureDetector{\n/**\n     * The listener for receiving notifications when gestures occur.\n     * If you want to listen for all the different gestures then implement\n     * this interface. If you only want to listen for a subset it might\n     * be easier to extend {@link SimpleOnScaleGestureListener}.\n     *\n     * An application will receive events in the following order:\n     * <ul>\n     *  <li>One {@link OnScaleGestureListener#onScaleBegin(ScaleGestureDetector)}\n     *  <li>Zero or more {@link OnScaleGestureListener#onScale(ScaleGestureDetector)}\n     *  <li>One {@link OnScaleGestureListener#onScaleEnd(ScaleGestureDetector)}\n     * </ul>\n     */\nexport interface OnScaleGestureListener {\n\n    /**\n         * Responds to scaling events for a gesture in progress.\n         * Reported by pointer motion.\n         *\n         * @param detector The detector reporting the event - use this to\n         *          retrieve extended info about event state.\n         * @return Whether or not the detector should consider this event\n         *          as handled. If an event was not handled, the detector\n         *          will continue to accumulate movement until an event is\n         *          handled. This can be useful if an application, for example,\n         *          only wants to update scaling factors if the change is\n         *          greater than 0.01.\n         */\n    onScale(detector:ScaleGestureDetector):boolean ;\n\n    /**\n         * Responds to the beginning of a scaling gesture. Reported by\n         * new pointers going down.\n         *\n         * @param detector The detector reporting the event - use this to\n         *          retrieve extended info about event state.\n         * @return Whether or not the detector should continue recognizing\n         *          this gesture. For example, if a gesture is beginning\n         *          with a focal point outside of a region where it makes\n         *          sense, onScaleBegin() may return false to ignore the\n         *          rest of the gesture.\n         */\n    onScaleBegin(detector:ScaleGestureDetector):boolean ;\n\n    /**\n         * Responds to the end of a scale gesture. Reported by existing\n         * pointers going up.\n         *\n         * Once a scale has ended, {@link ScaleGestureDetector#getFocusX()}\n         * and {@link ScaleGestureDetector#getFocusY()} will return focal point\n         * of the pointers remaining on the screen.\n         *\n         * @param detector The detector reporting the event - use this to\n         *          retrieve extended info about event state.\n         */\n    onScaleEnd(detector:ScaleGestureDetector):void ;\n}\n/**\n     * A convenience class to extend when you only want to listen for a subset\n     * of scaling-related events. This implements all methods in\n     * {@link OnScaleGestureListener} but does nothing.\n     * {@link OnScaleGestureListener#onScale(ScaleGestureDetector)} returns\n     * {@code false} so that a subclass can retrieve the accumulated scale\n     * factor in an overridden onScaleEnd.\n     * {@link OnScaleGestureListener#onScaleBegin(ScaleGestureDetector)} returns\n     * {@code true}.\n     */\nexport class SimpleOnScaleGestureListener implements ScaleGestureDetector.OnScaleGestureListener {\n\n    onScale(detector:ScaleGestureDetector):boolean  {\n        return false;\n    }\n\n    onScaleBegin(detector:ScaleGestureDetector):boolean  {\n        return true;\n    }\n\n    onScaleEnd(detector:ScaleGestureDetector):void  {\n    // Intentionally empty\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/view/SoundEffectConstants.ts",
    "content": "/*\n * Copyright (C) 2008 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n///<reference path=\"View.ts\"/>\n\n\nmodule android.view {\n/**\n * Constants to be used to play sound effects via {@link View#playSoundEffect(int)} \n */\nexport class SoundEffectConstants {\n\n    static CLICK:number = 0;\n\n    static NAVIGATION_LEFT:number = 1;\n\n    static NAVIGATION_UP:number = 2;\n\n    static NAVIGATION_RIGHT:number = 3;\n\n    static NAVIGATION_DOWN:number = 4;\n\n    /**\n     * Get the sonification constant for the focus directions.\n     * @param direction One of {@link View#FOCUS_UP}, {@link View#FOCUS_DOWN},\n     *     {@link View#FOCUS_LEFT}, {@link View#FOCUS_RIGHT}, {@link View#FOCUS_FORWARD}\n     *     or {@link View#FOCUS_BACKWARD}\n\n     * @return The appropriate sonification constant.\n     */\n    static getContantForFocusDirection(direction:number):number  {\n        switch(direction) {\n            case View.FOCUS_RIGHT:\n                return SoundEffectConstants.NAVIGATION_RIGHT;\n            case View.FOCUS_FORWARD:\n            case View.FOCUS_DOWN:\n                return SoundEffectConstants.NAVIGATION_DOWN;\n            case View.FOCUS_LEFT:\n                return SoundEffectConstants.NAVIGATION_LEFT;\n            case View.FOCUS_BACKWARD:\n            case View.FOCUS_UP:\n                return SoundEffectConstants.NAVIGATION_UP;\n        }\n        throw Error(`new IllegalArgumentException(\"direction must be one of \" + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_FORWARD, FOCUS_BACKWARD}.\")`);\n    }\n}\n}"
  },
  {
    "path": "src/android/view/Surface.ts",
    "content": "/**\n * Created by linfaxin on 15/10/13.\n * AndroidUI's impl\n */\n///<reference path=\"../graphics/Rect.ts\"/>\n///<reference path=\"../graphics/Canvas.ts\"/>\n///<reference path=\"../graphics/Canvas.ts\"/>\n///<reference path=\"../content/res/Resources.ts\"/>\n///<reference path=\"../view/ViewRootImpl.ts\"/>\n\nmodule android.view{\n    import Rect = android.graphics.Rect;\n    import Canvas = android.graphics.Canvas;\n    import ViewRootImpl = android.view.ViewRootImpl;\n\n\n    export class Surface{\n        static DrawToCacheFirstMode = false;\n        private mCanvasElement:HTMLCanvasElement;\n        private _showFPSNode:HTMLElement;\n        private viewRoot:ViewRootImpl;\n        private mLockedRect:Rect = new Rect();\n        protected mCanvasBound = new Rect();\n        protected mSupportDirtyDraw = true;\n        private mLockSaveCount = 1;\n\n        constructor(canvasElement:HTMLCanvasElement, viewRoot:ViewRootImpl) {\n            this.mCanvasElement = canvasElement;\n            this.viewRoot = viewRoot;\n            this.initImpl();\n        }\n\n        protected initImpl(){\n            this.initCanvasBound();\n\n        }\n\n        isValid():boolean {\n            return true;//always true\n        }\n\n        notifyBoundChange(){\n            this.initCanvasBound();\n        }\n\n        protected initCanvasBound(){\n            let density = android.content.res.Resources.getDisplayMetrics().density;\n            let clientRect = this.mCanvasElement.getBoundingClientRect();\n            this.mCanvasBound.set(clientRect.left * density, clientRect.top * density, clientRect.right*density, clientRect.bottom*density);\n        }\n\n        /**\n         * lock a canvas to draw\n         */\n        lockCanvas(dirty:Rect):Canvas{\n            let fullWidth = this.mCanvasBound.width();\n            let fullHeight = this.mCanvasBound.height();\n            if(!this.mSupportDirtyDraw) dirty.set(0, 0, fullWidth, fullHeight);\n\n            let rect:Rect = this.mLockedRect;\n            rect.set(Math.floor(dirty.left), Math.floor(dirty.top), Math.ceil(dirty.right), Math.ceil(dirty.bottom));\n            if(dirty.isEmpty()){\n                rect.set(0, 0, fullWidth, fullHeight);\n            }\n            if(rect.isEmpty()) return null;//may canvas bound not ready.\n\n            return this.lockCanvasImpl(rect.left, rect.top, rect.width(), rect.height());\n        }\n\n        protected lockCanvasImpl(left:number, top:number, width:number, height:number):Canvas {\n            let canvas:Canvas;\n            if(Surface.DrawToCacheFirstMode) {\n                canvas = new Canvas(width, height);\n                if (left != 0 || top != 0) canvas.translate(-left, -top);\n\n                //let mCanvasContent = this.mCanvasElement.getContext('2d');\n                //mCanvasContent.clearRect(left, top, width, height);\n\n            }else {\n                canvas = new SurfaceLockCanvas(this.mCanvasBound.width(), this.mCanvasBound.height(), this.mCanvasElement);\n                this.mLockSaveCount = canvas.save();\n                canvas.clipRect(left, top, left + width, top + height);\n                //canvas.clearColor();\n            }\n            return canvas;\n        }\n\n        /**\n         * draw the off-screen canvas to in-screen canvas\n         * @param canvas\n         */\n        unlockCanvasAndPost(canvas:Canvas):void {\n            if(Surface.DrawToCacheFirstMode) {\n                let mCanvasContent:CanvasRenderingContext2D = this.mCanvasElement.getContext('2d');\n                if(canvas.mCanvasElement) mCanvasContent.drawImage(canvas.mCanvasElement, this.mLockedRect.left, this.mLockedRect.top);\n                canvas.recycle();\n\n            }else{\n                canvas.restoreToCount(this.mLockSaveCount);\n            }\n\n        }\n\n        showFps(fps:number):void {\n            if(!this._showFPSNode){\n                this._showFPSNode = document.createElement('div');\n                this._showFPSNode.style.position = 'absolute';\n                this._showFPSNode.style.top = '0';\n                this._showFPSNode.style.left = '0';\n                this._showFPSNode.style.width = '60px';\n                this._showFPSNode.style.fontSize = '14px';\n                this._showFPSNode.style.background = 'black';\n                this._showFPSNode.style.color = 'white';\n                this._showFPSNode.style.opacity = '0.7';\n                this._showFPSNode.style.zIndex = '1';\n                this.mCanvasElement.parentNode.appendChild(this._showFPSNode);\n            }\n            this._showFPSNode.innerText = 'FPS:'+fps.toFixed(1);\n        }\n    }\n\n    class SurfaceLockCanvas extends Canvas{\n\n        constructor(width:number, height:number, canvasElement:HTMLCanvasElement) {\n            super(width, height);\n            this.mCanvasElement = canvasElement;\n            this._mCanvasContent = this.mCanvasElement.getContext(\"2d\");\n        }\n\n        protected initCanvasImpl():void {\n        }\n\n    }\n}"
  },
  {
    "path": "src/android/view/TouchDelegate.ts",
    "content": "/*\n * Copyright (C) 2008 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"View.ts\"/>\n///<reference path=\"../graphics/Rect.ts\"/>\n///<reference path=\"ViewConfiguration.ts\"/>\n\n\nmodule android.view{\n    import Rect = android.graphics.Rect;\n    /**\n     * Helper class to handle situations where you want a view to have a larger touch area than its\n     * actual view bounds. The view whose touch area is changed is called the delegate view. This\n     * class should be used by an ancestor of the delegate. To use a TouchDelegate, first create an\n     * instance that specifies the bounds that should be mapped to the delegate and the delegate\n     * view itself.\n     * <p>\n     * The ancestor should then forward all of its touch events received in its\n     * {@link android.view.View#onTouchEvent(MotionEvent)} to {@link #onTouchEvent(MotionEvent)}.\n     * </p>\n     */\n    export class TouchDelegate{\n        /**\n         * View that should receive forwarded touch events\n         */\n        private mDelegateView:View;\n        /**\n         * Bounds in local coordinates of the containing view that should be mapped to the delegate\n         * view. This rect is used for initial hit testing.\n         */\n        private mBounds:Rect;\n        /**\n         * mBounds inflated to include some slop. This rect is to track whether the motion events\n         * should be considered to be be within the delegate view.\n         */\n        private mSlopBounds:Rect;\n        /**\n         * True if the delegate had been targeted on a down event (intersected mBounds).\n         */\n        private mDelegateTargeted = false;\n        private mSlop = 0;\n\n        /**\n         * Constructor\n         *\n         * @param bounds Bounds in local coordinates of the containing view that should be mapped to\n         *        the delegate view\n         * @param delegateView The view that should receive motion events\n         */\n        constructor(bounds:Rect, delegateView:View) {\n            this.mBounds = bounds;\n\n            this.mSlop = ViewConfiguration.get().getScaledTouchSlop();\n            this.mSlopBounds = new Rect(bounds);\n            this.mSlopBounds.inset(-this.mSlop, -this.mSlop);\n            this.mDelegateView = delegateView;\n        }\n\n        /**\n         * Will forward touch events to the delegate view if the event is within the bounds\n         * specified in the constructor.\n         *\n         * @param event The touch event to forward\n         * @return True if the event was forwarded to the delegate, false otherwise.\n         */\n        onTouchEvent(event:MotionEvent) {\n            let x = event.getX();\n            let y = event.getY();\n            let sendToDelegate = false;\n            let hit = true;\n            let handled = false;\n\n            switch (event.getAction()) {\n                case MotionEvent.ACTION_DOWN:\n                    let bounds = this.mBounds;\n\n                    if (bounds.contains(x, y)) {\n                        this.mDelegateTargeted = true;\n                        sendToDelegate = true;\n                    }\n                    break;\n                case MotionEvent.ACTION_UP:\n                case MotionEvent.ACTION_MOVE:\n                    sendToDelegate = this.mDelegateTargeted;\n                    if (sendToDelegate) {\n                        let slopBounds = this.mSlopBounds;\n                        if (!slopBounds.contains(x, y)) {\n                            hit = false;\n                        }\n                    }\n                    break;\n                case MotionEvent.ACTION_CANCEL:\n                    sendToDelegate = this.mDelegateTargeted;\n                    this.mDelegateTargeted = false;\n                    break;\n            }\n            if (sendToDelegate) {\n                let delegateView = this.mDelegateView;\n\n                if (hit) {\n                    // Offset event coordinates to be inside the target view\n                    event.setLocation(delegateView.getWidth() / 2, delegateView.getHeight() / 2);\n                } else {\n                    // Offset event coordinates to be outside the target view (in case it does\n                    // something like tracking pressed state)\n                    let slop = this.mSlop;\n                    event.setLocation(-(slop * 2), -(slop * 2));\n                }\n                handled = delegateView.dispatchTouchEvent(event);\n            }\n            return handled;\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/VelocityTracker.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../util/Log.ts\"/>\n///<reference path=\"../util/Pools.ts\"/>\n///<reference path=\"MotionEvent.ts\"/>\n///<reference path=\"KeyEvent.ts\"/>\n\nmodule android.view{\n    import Log = android.util.Log;\n    import Pools = android.util.Pools;\n    import MotionEvent = android.view.MotionEvent;\n    import KeyEvent = android.view.KeyEvent;\n    /**\n     * Helper for tracking the velocity of touch events, for implementing\n     * flinging and other such gestures.\n     *\n     * Use {@link #obtain} to retrieve a new instance of the class when you are going\n     * to begin tracking.  Put the motion events you receive into it with\n     * {@link #addMovement(MotionEvent)}.  When you want to determine the velocity call\n     * {@link #computeCurrentVelocity(int)} and then call {@link #getXVelocity(int)}\n     * and {@link #getYVelocity(int)} to retrieve the velocity for each pointer id.\n     */\n    export class VelocityTracker{\n        private static TAG = \"VelocityTracker\";\n        private static DEBUG = Log.VelocityTracker_DBG;\n        private static localLOGV = VelocityTracker.DEBUG;\n\n        private static NUM_PAST = 10;\n        private static MAX_AGE_MILLISECONDS = 200;\n\n        private static POINTER_POOL_CAPACITY = 20;\n\n        private static sPool = new Pools.SynchronizedPool<VelocityTracker>(2);\n\n        private static sRecycledPointerListHead:Pointer;\n        private static sRecycledPointerCount = 0;\n\n\n        private mPointerListHead:Pointer;\n        private mLastTouchIndex = 0;\n        private mGeneration = 0;\n\n        private mNext:VelocityTracker;\n\n        /**\n         * Retrieve a new VelocityTracker object to watch the velocity of a\n         * motion.  Be sure to call {@link #recycle} when done.  You should\n         * generally only maintain an active object while tracking a movement,\n         * so that the VelocityTracker can be re-used elsewhere.\n         *\n         * @return Returns a new VelocityTracker.\n         */\n        static obtain():VelocityTracker {\n            let instance = VelocityTracker.sPool.acquire();\n            return (instance != null) ? instance : new VelocityTracker();\n        }\n        /**\n         * Return a VelocityTracker object back to be re-used by others.  You must\n         * not touch the object after calling this function.\n         */\n        recycle() {\n            this.clear();\n            VelocityTracker.sPool.release(this);\n        }\n        setNextPoolable(element:VelocityTracker) {\n            this.mNext = element;\n        }\n        getNextPoolable():VelocityTracker {\n            return this.mNext;\n        }\n        constructor(){\n            this.clear();\n        }\n\n        /**\n         * Reset the velocity tracker back to its initial state.\n         */\n        clear() {\n            VelocityTracker.releasePointerList(this.mPointerListHead);\n\n            this.mPointerListHead = null;\n            this.mLastTouchIndex = 0;\n        }\n\n        /**\n         * Add a user's movement to the tracker.  You should call this for the\n         * initial {@link MotionEvent#ACTION_DOWN}, the following\n         * {@link MotionEvent#ACTION_MOVE} events that you receive, and the\n         * final {@link MotionEvent#ACTION_UP}.  You can, however, call this\n         * for whichever events you desire.\n         *\n         * @param ev The MotionEvent you received and would like to track.\n         */\n        addMovement(ev:MotionEvent) {\n            let historySize = ev.getHistorySize();\n            const pointerCount = ev.getPointerCount();\n            const lastTouchIndex = this.mLastTouchIndex;\n            const nextTouchIndex = (lastTouchIndex + 1) % VelocityTracker.NUM_PAST;\n            const finalTouchIndex = (nextTouchIndex + historySize) % VelocityTracker.NUM_PAST;\n            const generation = this.mGeneration++;\n\n            this.mLastTouchIndex = finalTouchIndex;\n\n            // Update pointer data.\n            let previousPointer:Pointer = null;\n            for (let i = 0; i < pointerCount; i++){\n                const pointerId = ev.getPointerId(i);\n\n                // Find the pointer data for this pointer id.\n                // This loop is optimized for the common case where pointer ids in the event\n                // are in sorted order.  However, we check for this case explicitly and\n                // perform a full linear scan from the start if needed.\n                let nextPointer:Pointer;\n                if (previousPointer == null || pointerId < previousPointer.id) {\n                    previousPointer = null;\n                    nextPointer = this.mPointerListHead;\n                } else {\n                    nextPointer = previousPointer.next;\n                }\n\n                let pointer:Pointer;\n                for (;;) {\n                    if (nextPointer != null) {\n                        const nextPointerId = nextPointer.id;\n                        if (nextPointerId == pointerId) {\n                            pointer = nextPointer;\n                            break;\n                        }\n                        if (nextPointerId < pointerId) {\n                            nextPointer = nextPointer.next;\n                            continue;\n                        }\n                    }\n\n                    // Pointer went down.  Add it to the list.\n                    // Write a sentinel at the end of the pastTime trace so we will be able to\n                    // tell when the trace started.\n                    pointer = VelocityTracker.obtainPointer();\n                    pointer.id = pointerId;\n                    pointer.pastTime[lastTouchIndex] = Number.MIN_VALUE;\n                    pointer.next = nextPointer;\n                    if (previousPointer == null) {\n                        this.mPointerListHead = pointer;\n                    } else {\n                        previousPointer.next = pointer;\n                    }\n                    break;\n                }\n\n                pointer.generation = generation;\n                previousPointer = pointer;\n\n                const pastX = pointer.pastX;\n                const pastY = pointer.pastY;\n                const pastTime = pointer.pastTime;\n\n                historySize = ev.getHistorySize(pointerId);\n                for (let j = 0; j < historySize; j++) {\n                    const touchIndex = (nextTouchIndex + j) % VelocityTracker.NUM_PAST;\n                    pastX[touchIndex] = ev.getHistoricalX(i, j);\n                    pastY[touchIndex] = ev.getHistoricalY(i, j);\n                    pastTime[touchIndex] = ev.getHistoricalEventTime(i, j);\n                }\n                pastX[finalTouchIndex] = ev.getX(i);\n                pastY[finalTouchIndex] = ev.getY(i);\n                pastTime[finalTouchIndex] = ev.getEventTime();\n            }\n\n            // Find removed pointers.\n            previousPointer = null;\n            for (let pointer = this.mPointerListHead; pointer != null; ) {\n                const nextPointer = pointer.next;\n                if (pointer.generation != generation) {\n                    // Pointer went up.  Remove it from the list.\n                    if (previousPointer == null) {\n                        this.mPointerListHead = nextPointer;\n                    } else {\n                        previousPointer.next = nextPointer;\n                    }\n                    VelocityTracker.releasePointer(pointer);\n                } else {\n                    previousPointer = pointer;\n                }\n                pointer = nextPointer;\n            }\n        }\n        /**\n         * Compute the current velocity based on the points that have been\n         * collected.  Only call this when you actually want to retrieve velocity\n         * information, as it is relatively expensive.  You can then retrieve\n         * the velocity with {@link #getXVelocity()} and\n         * {@link #getYVelocity()}.\n         *\n         * @param units The units you would like the velocity in.  A value of 1\n         * provides pixels per millisecond, 1000 provides pixels per second, etc.\n         * @param maxVelocity The maximum velocity that can be computed by this method.\n         * This value must be declared in the same unit as the units parameter. This value\n         * must be positive.\n         */\n        computeCurrentVelocity(units:number, maxVelocity=Number.MAX_SAFE_INTEGER) {\n            const lastTouchIndex = this.mLastTouchIndex;\n\n            for (let pointer = this.mPointerListHead; pointer != null; pointer = pointer.next) {\n                const pastTime = pointer.pastTime;\n\n                // Search backwards in time for oldest acceptable time.\n                // Stop at the beginning of the trace as indicated by the sentinel time Long.MIN_VALUE.\n                let oldestTouchIndex = lastTouchIndex;\n                let numTouches = 1;\n                const minTime = pastTime[lastTouchIndex] - VelocityTracker.MAX_AGE_MILLISECONDS;\n                while (numTouches < VelocityTracker.NUM_PAST) {\n                    const nextOldestTouchIndex = (oldestTouchIndex + VelocityTracker.NUM_PAST - 1) % VelocityTracker.NUM_PAST;\n                    const nextOldestTime = pastTime[nextOldestTouchIndex];\n                    if (nextOldestTime < minTime) { // also handles end of trace sentinel\n                        break;\n                    }\n                    oldestTouchIndex = nextOldestTouchIndex;\n                    numTouches += 1;\n                }\n\n                // If we have a lot of samples, skip the last received sample since it is\n                // probably pretty noisy compared to the sum of all of the traces already acquired.\n                if (numTouches > 3) {\n                    numTouches -= 1;\n                }\n\n                // Kind-of stupid.\n                const pastX = pointer.pastX;\n                const pastY = pointer.pastY;\n\n                const oldestX = pastX[oldestTouchIndex];\n                const oldestY = pastY[oldestTouchIndex];\n                const oldestTime = pastTime[oldestTouchIndex];\n\n                let accumX = 0;\n                let accumY = 0;\n\n                for (let i = 1; i < numTouches; i++) {\n                    const touchIndex = (oldestTouchIndex + i) % VelocityTracker.NUM_PAST;\n                    const duration = (pastTime[touchIndex] - oldestTime);\n\n                    if (duration == 0) continue;\n\n                    let delta = pastX[touchIndex] - oldestX;\n                    let velocity = (delta / duration) * units; // pixels/frame.\n                    accumX = (accumX == 0) ? velocity : (accumX + velocity) * .5;\n\n                    delta = pastY[touchIndex] - oldestY;\n                    velocity = (delta / duration) * units; // pixels/frame.\n                    accumY = (accumY == 0) ? velocity : (accumY + velocity) * .5;\n                }\n\n                if (accumX < -maxVelocity) {\n                    accumX = - maxVelocity;\n                } else if (accumX > maxVelocity) {\n                    accumX = maxVelocity;\n                }\n\n                if (accumY < -maxVelocity) {\n                    accumY = - maxVelocity;\n                } else if (accumY > maxVelocity) {\n                    accumY = maxVelocity;\n                }\n\n                pointer.xVelocity = accumX;\n                pointer.yVelocity = accumY;\n\n                if (VelocityTracker.localLOGV) {\n                    Log.v(VelocityTracker.TAG, \"Pointer \" + pointer.id\n                        + \": Y velocity=\" + accumX +\" X velocity=\" + accumY + \" N=\" + numTouches);\n                }\n            }\n        }\n        /**\n         * Retrieve the last computed X velocity.  You must first call\n         * {@link #computeCurrentVelocity(int)} before calling this function.\n         *\n         * @param id Which pointer's velocity to return.\n         * @return The previously computed X velocity.\n         */\n        getXVelocity(id=0):number {\n            let pointer = this.getPointer(id);\n            return pointer != null ? pointer.xVelocity : 0;\n        }\n        /**\n         * Retrieve the last computed Y velocity.  You must first call\n         * {@link #computeCurrentVelocity(int)} before calling this function.\n         *\n         * @param id Which pointer's velocity to return.\n         * @return The previously computed Y velocity.\n         */\n        getYVelocity(id=0):number {\n            let pointer = this.getPointer(id);\n            return pointer != null ? pointer.yVelocity : 0;\n        }\n        private getPointer(id:number):Pointer {\n            for (let pointer = this.mPointerListHead; pointer != null; pointer = pointer.next) {\n                if (pointer.id == id) {\n                    return pointer;\n                }\n            }\n            return null;\n        }\n        private static obtainPointer():Pointer {\n            if (VelocityTracker.sRecycledPointerCount != 0) {\n                let element = VelocityTracker.sRecycledPointerListHead;\n                VelocityTracker.sRecycledPointerCount -= 1;\n                VelocityTracker.sRecycledPointerListHead = element.next;\n                element.next = null;\n                return element;\n            }\n            return new Pointer();\n        }\n\n        private static releasePointer(pointer:Pointer) {\n            if (VelocityTracker.sRecycledPointerCount < VelocityTracker.POINTER_POOL_CAPACITY) {\n                pointer.next = VelocityTracker.sRecycledPointerListHead;\n                VelocityTracker.sRecycledPointerCount += 1;\n                VelocityTracker.sRecycledPointerListHead = pointer;\n            }\n        }\n\n        private static releasePointerList(pointer:Pointer) {\n            if (pointer != null) {\n                let count = VelocityTracker.sRecycledPointerCount;\n                if (count >= VelocityTracker.POINTER_POOL_CAPACITY) {\n                    return;\n                }\n\n                let tail = pointer;\n                for (;;) {\n                    count += 1;\n                    if (count >= VelocityTracker.POINTER_POOL_CAPACITY) {\n                        break;\n                    }\n\n                    let next = tail.next;\n                    if (next == null) {\n                        break;\n                    }\n                    tail = next;\n                }\n\n                tail.next = VelocityTracker.sRecycledPointerListHead;\n                VelocityTracker.sRecycledPointerCount = count;\n                VelocityTracker.sRecycledPointerListHead = pointer;\n            }\n        }\n\n\n    }\n\n    class Pointer {\n        next:Pointer;\n\n        id=0;\n        xVelocity=0;\n        yVelocity=0;\n\n        pastX = androidui.util.ArrayCreator.newNumberArray((<any>VelocityTracker).NUM_PAST);\n        pastY = androidui.util.ArrayCreator.newNumberArray((<any>VelocityTracker).NUM_PAST);\n        pastTime = androidui.util.ArrayCreator.newNumberArray((<any>VelocityTracker).NUM_PAST);// uses Long.MIN_VALUE as a sentinel\n\n        generation = 0;\n    }\n}"
  },
  {
    "path": "src/android/view/View.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../util/SparseArray.ts\"/>\n///<reference path=\"../util/Log.ts\"/>\n///<reference path=\"../graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../graphics/drawable/ColorDrawable.ts\"/>\n///<reference path=\"../graphics/drawable/ScrollBarDrawable.ts\"/>\n///<reference path=\"../graphics/drawable/InsetDrawable.ts\"/>\n///<reference path=\"../graphics/drawable/ShadowDrawable.ts\"/>\n///<reference path=\"../graphics/drawable/RoundRectDrawable.ts\"/>\n///<reference path=\"../graphics/PixelFormat.ts\"/>\n///<reference path=\"../graphics/Matrix.ts\"/>\n///<reference path=\"../graphics/Color.ts\"/>\n///<reference path=\"../graphics/Paint.ts\"/>\n///<reference path=\"../../java/lang/StringBuilder.ts\"/>\n///<reference path=\"../../java/lang/Runnable.ts\"/>\n///<reference path=\"../../java/lang/Object.ts\"/>\n///<reference path=\"../../java/lang/util/concurrent/CopyOnWriteArrayList.ts\"/>\n///<reference path=\"../../java/util/ArrayList.ts\"/>\n///<reference path=\"ViewRootImpl.ts\"/>\n///<reference path=\"ViewParent.ts\"/>\n///<reference path=\"ViewGroup.ts\"/>\n///<reference path=\"ViewOverlay.ts\"/>\n///<reference path=\"ViewTreeObserver.ts\"/>\n///<reference path=\"MotionEvent.ts\"/>\n///<reference path=\"TouchDelegate.ts\"/>\n///<reference path=\"../os/Handler.ts\"/>\n///<reference path=\"../os/SystemClock.ts\"/>\n///<reference path=\"../content/Context.ts\"/>\n///<reference path=\"../content/res/Resources.ts\"/>\n///<reference path=\"../content/res/ColorStateList.ts\"/>\n///<reference path=\"../graphics/Rect.ts\"/>\n///<reference path=\"../graphics/RectF.ts\"/>\n///<reference path=\"../graphics/Canvas.ts\"/>\n///<reference path=\"../util/Pools.ts\"/>\n///<reference path=\"../util/TypedValue.ts\"/>\n///<reference path=\"Gravity.ts\"/>\n///<reference path=\"../view/animation/LinearInterpolator.ts\"/>\n///<reference path=\"../view/animation/AnimationUtils.ts\"/>\n///<reference path=\"../../android/util/LayoutDirection.ts\"/>\n///<reference path=\"../../java/lang/System.ts\"/>\n///<reference path=\"../../androidui/attr/StateAttrList.ts\"/>\n///<reference path=\"../../androidui/attr/AttrBinder.ts\"/>\n///<reference path=\"../../androidui/util/PerformanceAdjuster.ts\"/>\n///<reference path=\"../../androidui/image/NetDrawable.ts\"/>\n///<reference path=\"KeyEvent.ts\"/>\n///<reference path=\"../R/attr.ts\"/>\n///<reference path=\"animation/Animation.ts\"/>\n///<reference path=\"animation/Transformation.ts\"/>\n\n\nmodule android.view {\n    import SparseArray = android.util.SparseArray;\n    import LayoutDirection = android.util.LayoutDirection;\n    import Drawable = android.graphics.drawable.Drawable;\n    import ColorDrawable = android.graphics.drawable.ColorDrawable;\n    import ScrollBarDrawable = android.graphics.drawable.ScrollBarDrawable;\n    import InsetDrawable = android.graphics.drawable.InsetDrawable;\n    import ShadowDrawable = android.graphics.drawable.ShadowDrawable;\n    import RoundRectDrawable = android.graphics.drawable.RoundRectDrawable;\n    import PixelFormat = android.graphics.PixelFormat;\n    import Matrix = android.graphics.Matrix;\n    import Color = android.graphics.Color;\n    import Paint = android.graphics.Paint;\n    import StringBuilder = java.lang.StringBuilder;\n    import Runnable = java.lang.Runnable;\n    import JavaObject = java.lang.JavaObject;\n    import System = java.lang.System;\n    //import ViewRootImpl = android.view.ViewRootImpl;\n    import ViewParent = android.view.ViewParent;\n    import SystemClock = android.os.SystemClock;\n    import Handler = android.os.Handler;\n    import Log = android.util.Log;\n    import Rect = android.graphics.Rect;\n    import RectF = android.graphics.RectF;\n    import Point = android.graphics.Point;\n    import Canvas = android.graphics.Canvas;\n    import CopyOnWriteArrayList = java.lang.util.concurrent.CopyOnWriteArrayList;\n    import ArrayList = java.util.ArrayList;\n    import OnAttachStateChangeListener = View.OnAttachStateChangeListener;\n    import Context = android.content.Context;\n    import Resources = android.content.res.Resources;\n    import ColorStateList = android.content.res.ColorStateList;\n    import Pools = android.util.Pools;\n    import LinearInterpolator = android.view.animation.LinearInterpolator;\n    import AnimationUtils = android.view.animation.AnimationUtils;\n    import AttrBinder = androidui.attr.AttrBinder;\n    import PerformanceAdjuster = androidui.util.PerformanceAdjuster;\n    import NetDrawable = androidui.image.NetDrawable;\n    import KeyEvent = android.view.KeyEvent;\n    import Animation = android.view.animation.Animation;\n    import Transformation = android.view.animation.Transformation;\n    import TypedArray = android.content.res.TypedArray;\n\n\n    /**\n     * <p>\n     * This class represents the basic building block for user interface components. A View\n     * occupies a rectangular area on the screen and is responsible for drawing and\n     * event handling. View is the base class for <em>widgets</em>, which are\n     * used to create interactive UI components (buttons, text fields, etc.). The\n     * {@link android.view.ViewGroup} subclass is the base class for <em>layouts</em>, which\n     * are invisible containers that hold other Views (or other ViewGroups) and define\n     * their layout properties.\n     * </p>\n     *\n     * <div class=\"special reference\">\n     * <h3>Developer Guides</h3>\n     * <p>For information about using this class to develop your application's user interface,\n     * read the <a href=\"{@docRoot}guide/topics/ui/index.html\">User Interface</a> developer guide.\n     * </div>\n     *\n     * <a name=\"Using\"></a>\n     * <h3>Using Views</h3>\n     * <p>\n     * All of the views in a window are arranged in a single tree. You can add views\n     * either from code or by specifying a tree of views in one or more XML layout\n     * files. There are many specialized subclasses of views that act as controls or\n     * are capable of displaying text, images, or other content.\n     * </p>\n     * <p>\n     * Once you have created a tree of views, there are typically a few types of\n     * common operations you may wish to perform:\n     * <ul>\n     * <li><strong>Set properties:</strong> for example setting the text of a\n     * {@link android.widget.TextView}. The available properties and the methods\n     * that set them will vary among the different subclasses of views. Note that\n     * properties that are known at build time can be set in the XML layout\n     * files.</li>\n     * <li><strong>Set focus:</strong> The framework will handled moving focus in\n     * response to user input. To force focus to a specific view, call\n     * {@link #requestFocus}.</li>\n     * <li><strong>Set up listeners:</strong> Views allow clients to set listeners\n     * that will be notified when something interesting happens to the view. For\n     * example, all views will let you set a listener to be notified when the view\n     * gains or loses focus. You can register such a listener using\n     * {@link #setOnFocusChangeListener(android.view.View.OnFocusChangeListener)}.\n     * Other view subclasses offer more specialized listeners. For example, a Button\n     * exposes a listener to notify clients when the button is clicked.</li>\n     * <li><strong>Set visibility:</strong> You can hide or show views using\n     * {@link #setVisibility(int)}.</li>\n     * </ul>\n     * </p>\n     * <p><em>\n     * Note: The Android framework is responsible for measuring, laying out and\n     * drawing views. You should not call methods that perform these actions on\n     * views yourself unless you are actually implementing a\n     * {@link android.view.ViewGroup}.\n     * </em></p>\n     *\n     * <a name=\"Lifecycle\"></a>\n     * <h3>Implementing a Custom View</h3>\n     *\n     * <p>\n     * To implement a custom view, you will usually begin by providing overrides for\n     * some of the standard methods that the framework calls on all views. You do\n     * not need to override all of these methods. In fact, you can start by just\n     * overriding {@link #onDraw(android.graphics.Canvas)}.\n     * <table border=\"2\" width=\"85%\" align=\"center\" cellpadding=\"5\">\n     *     <thead>\n     *         <tr><th>Category</th> <th>Methods</th> <th>Description</th></tr>\n     *     </thead>\n     *\n     *     <tbody>\n     *     <tr>\n     *         <td rowspan=\"2\">Creation</td>\n     *         <td>Constructors</td>\n     *         <td>There is a form of the constructor that are called when the view\n     *         is created from code and a form that is called when the view is\n     *         inflated from a layout file. The second form should parse and apply\n     *         any attributes defined in the layout file.\n     *         </td>\n     *     </tr>\n     *     <tr>\n     *         <td><code>{@link #onFinishInflate()}</code></td>\n     *         <td>Called after a view and all of its children has been inflated\n     *         from XML.</td>\n     *     </tr>\n     *\n     *     <tr>\n     *         <td rowspan=\"3\">Layout</td>\n     *         <td><code>{@link #onMeasure(int, int)}</code></td>\n     *         <td>Called to determine the size requirements for this view and all\n     *         of its children.\n     *         </td>\n     *     </tr>\n     *     <tr>\n     *         <td><code>{@link #onLayout(boolean, int, int, int, int)}</code></td>\n     *         <td>Called when this view should assign a size and position to all\n     *         of its children.\n     *         </td>\n     *     </tr>\n     *     <tr>\n     *         <td><code>{@link #onSizeChanged(int, int, int, int)}</code></td>\n     *         <td>Called when the size of this view has changed.\n     *         </td>\n     *     </tr>\n     *\n     *     <tr>\n     *         <td>Drawing</td>\n     *         <td><code>{@link #onDraw(android.graphics.Canvas)}</code></td>\n     *         <td>Called when the view should render its content.\n     *         </td>\n     *     </tr>\n     *\n     *     <tr>\n     *         <td rowspan=\"4\">Event processing</td>\n     *         <td><code>{@link #onKeyDown(int, KeyEvent)}</code></td>\n     *         <td>Called when a new hardware key event occurs.\n     *         </td>\n     *     </tr>\n     *     <tr>\n     *         <td><code>{@link #onKeyUp(int, KeyEvent)}</code></td>\n     *         <td>Called when a hardware key up event occurs.\n     *         </td>\n     *     </tr>\n     *     <tr>\n     *         <td><code>{@link #onTrackballEvent(MotionEvent)}</code></td>\n     *         <td>Called when a trackball motion event occurs.\n     *         </td>\n     *     </tr>\n     *     <tr>\n     *         <td><code>{@link #onTouchEvent(MotionEvent)}</code></td>\n     *         <td>Called when a touch screen motion event occurs.\n     *         </td>\n     *     </tr>\n     *\n     *     <tr>\n     *         <td rowspan=\"2\">Focus</td>\n     *         <td><code>{@link #onFocusChanged(boolean, int, android.graphics.Rect)}</code></td>\n     *         <td>Called when the view gains or loses focus.\n     *         </td>\n     *     </tr>\n     *\n     *     <tr>\n     *         <td><code>{@link #onWindowFocusChanged(boolean)}</code></td>\n     *         <td>Called when the window containing the view gains or loses focus.\n     *         </td>\n     *     </tr>\n     *\n     *     <tr>\n     *         <td rowspan=\"3\">Attaching</td>\n     *         <td><code>{@link #onAttachedToWindow()}</code></td>\n     *         <td>Called when the view is attached to a window.\n     *         </td>\n     *     </tr>\n     *\n     *     <tr>\n     *         <td><code>{@link #onDetachedFromWindow}</code></td>\n     *         <td>Called when the view is detached from its window.\n     *         </td>\n     *     </tr>\n     *\n     *     <tr>\n     *         <td><code>{@link #onWindowVisibilityChanged(int)}</code></td>\n     *         <td>Called when the visibility of the window containing the view\n     *         has changed.\n     *         </td>\n     *     </tr>\n     *     </tbody>\n     *\n     * </table>\n     * </p>\n     *\n     * <a name=\"IDs\"></a>\n     * <h3>IDs</h3>\n     * Views may have an integer id associated with them. These ids are typically\n     * assigned in the layout XML files, and are used to find specific views within\n     * the view tree. A common pattern is to:\n     * <ul>\n     * <li>Define a Button in the layout file and assign it a unique ID.\n     * <pre>\n     * &lt;Button\n     *     android:id=\"@+id/my_button\"\n     *     android:layout_width=\"wrap_content\"\n     *     android:layout_height=\"wrap_content\"\n     *     android:text=\"@string/my_button_text\"/&gt;\n     * </pre></li>\n     * <li>From the onCreate method of an Activity, find the Button\n     * <pre class=\"prettyprint\">\n     *      Button myButton = (Button) findViewById(R.id.my_button);\n     * </pre></li>\n     * </ul>\n     * <p>\n     * View IDs need not be unique throughout the tree, but it is good practice to\n     * ensure that they are at least unique within the part of the tree you are\n     * searching.\n     * </p>\n     *\n     * <a name=\"Position\"></a>\n     * <h3>Position</h3>\n     * <p>\n     * The geometry of a view is that of a rectangle. A view has a location,\n     * expressed as a pair of <em>left</em> and <em>top</em> coordinates, and\n     * two dimensions, expressed as a width and a height. The unit for location\n     * and dimensions is the pixel.\n     * </p>\n     *\n     * <p>\n     * It is possible to retrieve the location of a view by invoking the methods\n     * {@link #getLeft()} and {@link #getTop()}. The former returns the left, or X,\n     * coordinate of the rectangle representing the view. The latter returns the\n     * top, or Y, coordinate of the rectangle representing the view. These methods\n     * both return the location of the view relative to its parent. For instance,\n     * when getLeft() returns 20, that means the view is located 20 pixels to the\n     * right of the left edge of its direct parent.\n     * </p>\n     *\n     * <p>\n     * In addition, several convenience methods are offered to avoid unnecessary\n     * computations, namely {@link #getRight()} and {@link #getBottom()}.\n     * These methods return the coordinates of the right and bottom edges of the\n     * rectangle representing the view. For instance, calling {@link #getRight()}\n     * is similar to the following computation: <code>getLeft() + getWidth()</code>\n     * (see <a href=\"#SizePaddingMargins\">Size</a> for more information about the width.)\n     * </p>\n     *\n     * <a name=\"SizePaddingMargins\"></a>\n     * <h3>Size, padding and margins</h3>\n     * <p>\n     * The size of a view is expressed with a width and a height. A view actually\n     * possess two pairs of width and height values.\n     * </p>\n     *\n     * <p>\n     * The first pair is known as <em>measured width</em> and\n     * <em>measured height</em>. These dimensions define how big a view wants to be\n     * within its parent (see <a href=\"#Layout\">Layout</a> for more details.) The\n     * measured dimensions can be obtained by calling {@link #getMeasuredWidth()}\n     * and {@link #getMeasuredHeight()}.\n     * </p>\n     *\n     * <p>\n     * The second pair is simply known as <em>width</em> and <em>height</em>, or\n     * sometimes <em>drawing width</em> and <em>drawing height</em>. These\n     * dimensions define the actual size of the view on screen, at drawing time and\n     * after layout. These values may, but do not have to, be different from the\n     * measured width and height. The width and height can be obtained by calling\n     * {@link #getWidth()} and {@link #getHeight()}.\n     * </p>\n     *\n     * <p>\n     * To measure its dimensions, a view takes into account its padding. The padding\n     * is expressed in pixels for the left, top, right and bottom parts of the view.\n     * Padding can be used to offset the content of the view by a specific amount of\n     * pixels. For instance, a left padding of 2 will push the view's content by\n     * 2 pixels to the right of the left edge. Padding can be set using the\n     * {@link #setPadding(int, int, int, int)} or {@link #setPaddingRelative(int, int, int, int)}\n     * method and queried by calling {@link #getPaddingLeft()}, {@link #getPaddingTop()},\n     * {@link #getPaddingRight()}, {@link #getPaddingBottom()}, {@link #getPaddingStart()},\n     * {@link #getPaddingEnd()}.\n     * </p>\n     *\n     * <p>\n     * Even though a view can define a padding, it does not provide any support for\n     * margins. However, view groups provide such a support. Refer to\n     * {@link android.view.ViewGroup} and\n     * {@link android.view.ViewGroup.MarginLayoutParams} for further information.\n     * </p>\n     *\n     * <a name=\"Layout\"></a>\n     * <h3>Layout</h3>\n     * <p>\n     * Layout is a two pass process: a measure pass and a layout pass. The measuring\n     * pass is implemented in {@link #measure(int, int)} and is a top-down traversal\n     * of the view tree. Each view pushes dimension specifications down the tree\n     * during the recursion. At the end of the measure pass, every view has stored\n     * its measurements. The second pass happens in\n     * {@link #layout(int,int,int,int)} and is also top-down. During\n     * this pass each parent is responsible for positioning all of its children\n     * using the sizes computed in the measure pass.\n     * </p>\n     *\n     * <p>\n     * When a view's measure() method returns, its {@link #getMeasuredWidth()} and\n     * {@link #getMeasuredHeight()} values must be set, along with those for all of\n     * that view's descendants. A view's measured width and measured height values\n     * must respect the constraints imposed by the view's parents. This guarantees\n     * that at the end of the measure pass, all parents accept all of their\n     * children's measurements. A parent view may call measure() more than once on\n     * its children. For example, the parent may measure each child once with\n     * unspecified dimensions to find out how big they want to be, then call\n     * measure() on them again with actual numbers if the sum of all the children's\n     * unconstrained sizes is too big or too small.\n     * </p>\n     *\n     * <p>\n     * The measure pass uses two classes to communicate dimensions. The\n     * {@link MeasureSpec} class is used by views to tell their parents how they\n     * want to be measured and positioned. The base LayoutParams class just\n     * describes how big the view wants to be for both width and height. For each\n     * dimension, it can specify one of:\n     * <ul>\n     * <li> an exact number\n     * <li>MATCH_PARENT, which means the view wants to be as big as its parent\n     * (minus padding)\n     * <li> WRAP_CONTENT, which means that the view wants to be just big enough to\n     * enclose its content (plus padding).\n     * </ul>\n     * There are subclasses of LayoutParams for different subclasses of ViewGroup.\n     * For example, AbsoluteLayout has its own subclass of LayoutParams which adds\n     * an X and Y value.\n     * </p>\n     *\n     * <p>\n     * MeasureSpecs are used to push requirements down the tree from parent to\n     * child. A MeasureSpec can be in one of three modes:\n     * <ul>\n     * <li>UNSPECIFIED: This is used by a parent to determine the desired dimension\n     * of a child view. For example, a LinearLayout may call measure() on its child\n     * with the height set to UNSPECIFIED and a width of EXACTLY 240 to find out how\n     * tall the child view wants to be given a width of 240 pixels.\n     * <li>EXACTLY: This is used by the parent to impose an exact size on the\n     * child. The child must use this size, and guarantee that all of its\n     * descendants will fit within this size.\n     * <li>AT_MOST: This is used by the parent to impose a maximum size on the\n     * child. The child must gurantee that it and all of its descendants will fit\n     * within this size.\n     * </ul>\n     * </p>\n     *\n     * <p>\n     * To intiate a layout, call {@link #requestLayout}. This method is typically\n     * called by a view on itself when it believes that is can no longer fit within\n     * its current bounds.\n     * </p>\n     *\n     * <a name=\"Drawing\"></a>\n     * <h3>Drawing</h3>\n     * <p>\n     * Drawing is handled by walking the tree and rendering each view that\n     * intersects the invalid region. Because the tree is traversed in-order,\n     * this means that parents will draw before (i.e., behind) their children, with\n     * siblings drawn in the order they appear in the tree.\n     * If you set a background drawable for a View, then the View will draw it for you\n     * before calling back to its <code>onDraw()</code> method.\n     * </p>\n     *\n     * <p>\n     * Note that the framework will not draw views that are not in the invalid region.\n     * </p>\n     *\n     * <p>\n     * To force a view to draw, call {@link #invalidate()}.\n     * </p>\n     *\n     * <a name=\"EventHandlingThreading\"></a>\n     * <h3>Event Handling and Threading</h3>\n     * <p>\n     * The basic cycle of a view is as follows:\n     * <ol>\n     * <li>An event comes in and is dispatched to the appropriate view. The view\n     * handles the event and notifies any listeners.</li>\n     * <li>If in the course of processing the event, the view's bounds may need\n     * to be changed, the view will call {@link #requestLayout()}.</li>\n     * <li>Similarly, if in the course of processing the event the view's appearance\n     * may need to be changed, the view will call {@link #invalidate()}.</li>\n     * <li>If either {@link #requestLayout()} or {@link #invalidate()} were called,\n     * the framework will take care of measuring, laying out, and drawing the tree\n     * as appropriate.</li>\n     * </ol>\n     * </p>\n     *\n     * <p><em>Note: The entire view tree is single threaded. You must always be on\n     * the UI thread when calling any method on any view.</em>\n     * If you are doing work on other threads and want to update the state of a view\n     * from that thread, you should use a {@link Handler}.\n     * </p>\n     *\n     * <a name=\"FocusHandling\"></a>\n     * <h3>Focus Handling</h3>\n     * <p>\n     * The framework will handle routine focus movement in response to user input.\n     * This includes changing the focus as views are removed or hidden, or as new\n     * views become available. Views indicate their willingness to take focus\n     * through the {@link #isFocusable} method. To change whether a view can take\n     * focus, call {@link #setFocusable(boolean)}.  When in touch mode (see notes below)\n     * views indicate whether they still would like focus via {@link #isFocusableInTouchMode}\n     * and can change this via {@link #setFocusableInTouchMode(boolean)}.\n     * </p>\n     * <p>\n     * Focus movement is based on an algorithm which finds the nearest neighbor in a\n     * given direction. In rare cases, the default algorithm may not match the\n     * intended behavior of the developer. In these situations, you can provide\n     * explicit overrides by using these XML attributes in the layout file:\n     * <pre>\n     * nextFocusDown\n     * nextFocusLeft\n     * nextFocusRight\n     * nextFocusUp\n     * </pre>\n     * </p>\n     *\n     *\n     * <p>\n     * To get a particular view to take focus, call {@link #requestFocus()}.\n     * </p>\n     *\n     * <a name=\"TouchMode\"></a>\n     * <h3>Touch Mode</h3>\n     * <p>\n     * When a user is navigating a user interface via directional keys such as a D-pad, it is\n     * necessary to give focus to actionable items such as buttons so the user can see\n     * what will take input.  If the device has touch capabilities, however, and the user\n     * begins interacting with the interface by touching it, it is no longer necessary to\n     * always highlight, or give focus to, a particular view.  This motivates a mode\n     * for interaction named 'touch mode'.\n     * </p>\n     * <p>\n     * For a touch capable device, once the user touches the screen, the device\n     * will enter touch mode.  From this point onward, only views for which\n     * {@link #isFocusableInTouchMode} is true will be focusable, such as text editing widgets.\n     * Other views that are touchable, like buttons, will not take focus when touched; they will\n     * only fire the on click listeners.\n     * </p>\n     * <p>\n     * Any time a user hits a directional key, such as a D-pad direction, the view device will\n     * exit touch mode, and find a view to take focus, so that the user may resume interacting\n     * with the user interface without touching the screen again.\n     * </p>\n     * <p>\n     * The touch mode state is maintained across {@link android.app.Activity}s.  Call\n     * {@link #isInTouchMode} to see whether the device is currently in touch mode.\n     * </p>\n     *\n     * <a name=\"Scrolling\"></a>\n     * <h3>Scrolling</h3>\n     * <p>\n     * The framework provides basic support for views that wish to internally\n     * scroll their content. This includes keeping track of the X and Y scroll\n     * offset as well as mechanisms for drawing scrollbars. See\n     * {@link #scrollBy(int, int)}, {@link #scrollTo(int, int)}, and\n     * {@link #awakenScrollBars()} for more details.\n     * </p>\n     *\n     * <a name=\"Tags\"></a>\n     * <h3>Tags</h3>\n     * <p>\n     * Unlike IDs, tags are not used to identify views. Tags are essentially an\n     * extra piece of information that can be associated with a view. They are most\n     * often used as a convenience to store data related to views in the views\n     * themselves rather than by putting them in a separate structure.\n     * </p>\n     *\n     * <a name=\"Properties\"></a>\n     * <h3>Properties</h3>\n     * <p>\n     * The View class exposes an {@link #ALPHA} property, as well as several transform-related\n     * properties, such as {@link #TRANSLATION_X} and {@link #TRANSLATION_Y}. These properties are\n     * available both in the {@link Property} form as well as in similarly-named setter/getter\n     * methods (such as {@link #setAlpha(float)} for {@link #ALPHA}). These properties can\n     * be used to set persistent state associated with these rendering-related properties on the view.\n     * The properties and methods can also be used in conjunction with\n     * {@link android.animation.Animator Animator}-based animations, described more in the\n     * <a href=\"#Animation\">Animation</a> section.\n     * </p>\n     *\n     * <a name=\"Animation\"></a>\n     * <h3>Animation</h3>\n     * <p>\n     * Starting with Android 3.0, the preferred way of animating views is to use the\n     * {@link android.animation} package APIs. These {@link android.animation.Animator Animator}-based\n     * classes change actual properties of the View object, such as {@link #setAlpha(float) alpha} and\n     * {@link #setTranslationX(float) translationX}. This behavior is contrasted to that of the pre-3.0\n     * {@link android.view.animation.Animation Animation}-based classes, which instead animate only\n     * how the view is drawn on the display. In particular, the {@link ViewPropertyAnimator} class\n     * makes animating these View properties particularly easy and efficient.\n     * </p>\n     * <p>\n     * Alternatively, you can use the pre-3.0 animation classes to animate how Views are rendered.\n     * You can attach an {@link Animation} object to a view using\n     * {@link #setAnimation(Animation)} or\n     * {@link #startAnimation(Animation)}. The animation can alter the scale,\n     * rotation, translation and alpha of a view over time. If the animation is\n     * attached to a view that has children, the animation will affect the entire\n     * subtree rooted by that node. When an animation is started, the framework will\n     * take care of redrawing the appropriate views until the animation completes.\n     * </p>\n     *\n     * <a name=\"Security\"></a>\n     * <h3>Security</h3>\n     * <p>\n     * Sometimes it is essential that an application be able to verify that an action\n     * is being performed with the full knowledge and consent of the user, such as\n     * granting a permission request, making a purchase or clicking on an advertisement.\n     * Unfortunately, a malicious application could try to spoof the user into\n     * performing these actions, unaware, by concealing the intended purpose of the view.\n     * As a remedy, the framework offers a touch filtering mechanism that can be used to\n     * improve the security of views that provide access to sensitive functionality.\n     * </p><p>\n     * To enable touch filtering, call {@link #setFilterTouchesWhenObscured(boolean)} or set the\n     * android:filterTouchesWhenObscured layout attribute to true.  When enabled, the framework\n     * will discard touches that are received whenever the view's window is obscured by\n     * another visible window.  As a result, the view will not receive touches whenever a\n     * toast, dialog or other window appears above the view's window.\n     * </p><p>\n     * For more fine-grained control over security, consider overriding the\n     * {@link #onFilterTouchEventForSecurity(MotionEvent)} method to implement your own\n     * security policy. See also {@link MotionEvent#FLAG_WINDOW_IS_OBSCURED}.\n     * </p>\n     *\n     * @attr ref android.R.styleable#View_alpha\n     * @attr ref android.R.styleable#View_background\n     * @attr ref android.R.styleable#View_clickable\n     * @attr ref android.R.styleable#View_contentDescription\n     * @attr ref android.R.styleable#View_drawingCacheQuality\n     * @attr ref android.R.styleable#View_duplicateParentState\n     * @attr ref android.R.styleable#View_id\n     * @attr ref android.R.styleable#View_requiresFadingEdge\n     * @attr ref android.R.styleable#View_fadeScrollbars\n     * @attr ref android.R.styleable#View_fadingEdgeLength\n     * @attr ref android.R.styleable#View_filterTouchesWhenObscured\n     * @attr ref android.R.styleable#View_fitsSystemWindows\n     * @attr ref android.R.styleable#View_isScrollContainer\n     * @attr ref android.R.styleable#View_focusable\n     * @attr ref android.R.styleable#View_focusableInTouchMode\n     * @attr ref android.R.styleable#View_hapticFeedbackEnabled\n     * @attr ref android.R.styleable#View_keepScreenOn\n     * @attr ref android.R.styleable#View_layerType\n     * @attr ref android.R.styleable#View_layoutDirection\n     * @attr ref android.R.styleable#View_longClickable\n     * @attr ref android.R.styleable#View_minHeight\n     * @attr ref android.R.styleable#View_minWidth\n     * @attr ref android.R.styleable#View_nextFocusDown\n     * @attr ref android.R.styleable#View_nextFocusLeft\n     * @attr ref android.R.styleable#View_nextFocusRight\n     * @attr ref android.R.styleable#View_nextFocusUp\n     * @attr ref android.R.styleable#View_onClick\n     * @attr ref android.R.styleable#View_padding\n     * @attr ref android.R.styleable#View_paddingBottom\n     * @attr ref android.R.styleable#View_paddingLeft\n     * @attr ref android.R.styleable#View_paddingRight\n     * @attr ref android.R.styleable#View_paddingTop\n     * @attr ref android.R.styleable#View_paddingStart\n     * @attr ref android.R.styleable#View_paddingEnd\n     * @attr ref android.R.styleable#View_saveEnabled\n     * @attr ref android.R.styleable#View_rotation\n     * @attr ref android.R.styleable#View_rotationX\n     * @attr ref android.R.styleable#View_rotationY\n     * @attr ref android.R.styleable#View_scaleX\n     * @attr ref android.R.styleable#View_scaleY\n     * @attr ref android.R.styleable#View_scrollX\n     * @attr ref android.R.styleable#View_scrollY\n     * @attr ref android.R.styleable#View_scrollbarSize\n     * @attr ref android.R.styleable#View_scrollbarStyle\n     * @attr ref android.R.styleable#View_scrollbars\n     * @attr ref android.R.styleable#View_scrollbarDefaultDelayBeforeFade\n     * @attr ref android.R.styleable#View_scrollbarFadeDuration\n     * @attr ref android.R.styleable#View_scrollbarTrackHorizontal\n     * @attr ref android.R.styleable#View_scrollbarThumbHorizontal\n     * @attr ref android.R.styleable#View_scrollbarThumbVertical\n     * @attr ref android.R.styleable#View_scrollbarTrackVertical\n     * @attr ref android.R.styleable#View_scrollbarAlwaysDrawHorizontalTrack\n     * @attr ref android.R.styleable#View_scrollbarAlwaysDrawVerticalTrack\n     * @attr ref android.R.styleable#View_soundEffectsEnabled\n     * @attr ref android.R.styleable#View_tag\n     * @attr ref android.R.styleable#View_textAlignment\n     * @attr ref android.R.styleable#View_textDirection\n     * @attr ref android.R.styleable#View_transformPivotX\n     * @attr ref android.R.styleable#View_transformPivotY\n     * @attr ref android.R.styleable#View_translationX\n     * @attr ref android.R.styleable#View_translationY\n     * @attr ref android.R.styleable#View_visibility\n     *\n     * @see android.view.ViewGroup\n     *\n     * AndroidUIX NOTE: something modified\n     */\n    export class View extends JavaObject implements Drawable.Callback, KeyEvent.Callback {\n        static DBG = Log.View_DBG;\n        static VIEW_LOG_TAG = \"View\";\n\n        static PFLAG_WANTS_FOCUS                   = 0x00000001;\n        static PFLAG_FOCUSED                       = 0x00000002;\n        static PFLAG_SELECTED                      = 0x00000004;\n        static PFLAG_IS_ROOT_NAMESPACE             = 0x00000008;\n        static PFLAG_HAS_BOUNDS                    = 0x00000010;\n        static PFLAG_DRAWN                         = 0x00000020;\n        static PFLAG_DRAW_ANIMATION                = 0x00000040;\n        static PFLAG_SKIP_DRAW                     = 0x00000080;\n        static PFLAG_ONLY_DRAWS_BACKGROUND         = 0x00000100;\n        static PFLAG_REQUEST_TRANSPARENT_REGIONS   = 0x00000200;\n        static PFLAG_DRAWABLE_STATE_DIRTY          = 0x00000400;\n        static PFLAG_MEASURED_DIMENSION_SET        = 0x00000800;\n        static PFLAG_FORCE_LAYOUT                  = 0x00001000;\n        static PFLAG_LAYOUT_REQUIRED               = 0x00002000;\n        static PFLAG_PRESSED                       = 0x00004000;\n        static PFLAG_DRAWING_CACHE_VALID           = 0x00008000;\n        static PFLAG_ANIMATION_STARTED             = 0x00010000;\n        static PFLAG_ALPHA_SET                     = 0x00040000;\n        static PFLAG_SCROLL_CONTAINER              = 0x00080000;\n        static PFLAG_SCROLL_CONTAINER_ADDED        = 0x00100000;\n        static PFLAG_DIRTY                         = 0x00200000;\n        static PFLAG_DIRTY_OPAQUE                  = 0x00400000;\n        static PFLAG_DIRTY_MASK                    = 0x00600000;\n        static PFLAG_OPAQUE_BACKGROUND             = 0x00800000;\n        static PFLAG_OPAQUE_SCROLLBARS             = 0x01000000;\n        static PFLAG_OPAQUE_MASK                   = 0x01800000;\n        static PFLAG_PREPRESSED                    = 0x02000000;\n        static PFLAG_CANCEL_NEXT_UP_EVENT          = 0x04000000;\n        static PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH  = 0x08000000;\n        static PFLAG_HOVERED                       = 0x10000000;\n        static PFLAG_PIVOT_EXPLICITLY_SET          = 0x20000000;\n        static PFLAG_ACTIVATED                     = 0x40000000;\n        static PFLAG_INVALIDATED                   = 0x80000000;\n\n        static PFLAG2_VIEW_QUICK_REJECTED = 0x10000000;\n        static PFLAG2_HAS_TRANSIENT_STATE = 0x80000000;\n\n        static PFLAG3_VIEW_IS_ANIMATING_TRANSFORM = 0x1;\n        static PFLAG3_VIEW_IS_ANIMATING_ALPHA = 0x2;\n        static PFLAG3_IS_LAID_OUT = 0x4;\n        static PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT = 0x8;\n        static PFLAG3_CALLED_SUPER = 0x10;\n\n        private static NOT_FOCUSABLE = 0x00000000;\n        private static FOCUSABLE = 0x00000001;\n        private static FOCUSABLE_MASK = 0x00000001;\n\n\n        static NO_ID;//undefined\n        static OVER_SCROLL_ALWAYS = 0;\n        static OVER_SCROLL_IF_CONTENT_SCROLLS = 1;\n        static OVER_SCROLL_NEVER = 2;\n\n        static MEASURED_SIZE_MASK                  = 0x00ffffff;\n        static MEASURED_STATE_MASK                 = 0xff000000;\n        static MEASURED_HEIGHT_STATE_SHIFT         = 16;\n        static MEASURED_STATE_TOO_SMALL            = 0x01000000;\n\n        static VISIBILITY_MASK = 0x0000000C;\n        static VISIBLE         = 0x00000000;\n        static INVISIBLE       = 0x00000004;\n        static GONE            = 0x00000008;\n\n        static ENABLED = 0x00000000;\n        static DISABLED = 0x00000020;\n        static ENABLED_MASK = 0x00000020;\n        static WILL_NOT_DRAW = 0x00000080;\n        static DRAW_MASK = 0x00000080;\n\n        static SCROLLBARS_NONE = 0x00000000;\n        static SCROLLBARS_HORIZONTAL = 0x00000100;\n        static SCROLLBARS_VERTICAL = 0x00000200;\n        static SCROLLBARS_MASK = 0x00000300;\n\n        static FOCUSABLES_ALL = 0x00000000;\n        static FOCUSABLES_TOUCH_MODE = 0x00000001;\n        static FOCUS_BACKWARD = 0x00000001;\n        static FOCUS_FORWARD = 0x00000002;\n        static FOCUS_LEFT = 0x00000011;\n        static FOCUS_UP = 0x00000021;\n        static FOCUS_RIGHT = 0x00000042;\n        static FOCUS_DOWN = 0x00000082;\n\n\n\n        /**\n         * Base View state sets\n         */\n        // Singles\n        /**\n         * Indicates the view has no states set. States are used with\n         * {@link android.graphics.drawable.Drawable} to change the drawing of the\n         * view depending on its state.\n         *\n         * @see android.graphics.drawable.Drawable\n         * @see #getDrawableState()\n         */\n        static EMPTY_STATE_SET:number[];\n\n        /**\n         * Indicates the view is enabled. States are used with\n         * {@link android.graphics.drawable.Drawable} to change the drawing of the\n         * view depending on its state.\n         *\n         * @see android.graphics.drawable.Drawable\n         * @see #getDrawableState()\n         */\n        static ENABLED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is focused. States are used with\n         * {@link android.graphics.drawable.Drawable} to change the drawing of the\n         * view depending on its state.\n         *\n         * @see android.graphics.drawable.Drawable\n         * @see #getDrawableState()\n         */\n        static FOCUSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is selected. States are used with\n         * {@link android.graphics.drawable.Drawable} to change the drawing of the\n         * view depending on its state.\n         *\n         * @see android.graphics.drawable.Drawable\n         * @see #getDrawableState()\n         */\n        static SELECTED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is pressed. States are used with\n         * {@link android.graphics.drawable.Drawable} to change the drawing of the\n         * view depending on its state.\n         *\n         * @see android.graphics.drawable.Drawable\n         * @see #getDrawableState()\n         */\n        static PRESSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view's window has focus. States are used with\n         * {@link android.graphics.drawable.Drawable} to change the drawing of the\n         * view depending on its state.\n         *\n         * @see android.graphics.drawable.Drawable\n         * @see #getDrawableState()\n         */\n        static WINDOW_FOCUSED_STATE_SET:number[];\n\n        // Doubles\n        /**\n         * Indicates the view is enabled and has the focus.\n         *\n         * @see #ENABLED_STATE_SET\n         * @see #FOCUSED_STATE_SET\n         */\n        static ENABLED_FOCUSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is enabled and selected.\n         *\n         * @see #ENABLED_STATE_SET\n         * @see #SELECTED_STATE_SET\n         */\n        static ENABLED_SELECTED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is enabled and that its window has focus.\n         *\n         * @see #ENABLED_STATE_SET\n         * @see #WINDOW_FOCUSED_STATE_SET\n         */\n        static ENABLED_WINDOW_FOCUSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is focused and selected.\n         *\n         * @see #FOCUSED_STATE_SET\n         * @see #SELECTED_STATE_SET\n         */\n        static FOCUSED_SELECTED_STATE_SET:number[];\n\n        /**\n         * Indicates the view has the focus and that its window has the focus.\n         *\n         * @see #FOCUSED_STATE_SET\n         * @see #WINDOW_FOCUSED_STATE_SET\n         */\n        static FOCUSED_WINDOW_FOCUSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is selected and that its window has the focus.\n         *\n         * @see #SELECTED_STATE_SET\n         * @see #WINDOW_FOCUSED_STATE_SET\n         */\n        static SELECTED_WINDOW_FOCUSED_STATE_SET:number[];\n\n        // Triples\n        /**\n         * Indicates the view is enabled, focused and selected.\n         *\n         * @see #ENABLED_STATE_SET\n         * @see #FOCUSED_STATE_SET\n         * @see #SELECTED_STATE_SET\n         */\n        static ENABLED_FOCUSED_SELECTED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is enabled, focused and its window has the focus.\n         *\n         * @see #ENABLED_STATE_SET\n         * @see #FOCUSED_STATE_SET\n         * @see #WINDOW_FOCUSED_STATE_SET\n         */\n        static ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is enabled, selected and its window has the focus.\n         *\n         * @see #ENABLED_STATE_SET\n         * @see #SELECTED_STATE_SET\n         * @see #WINDOW_FOCUSED_STATE_SET\n         */\n        static ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is focused, selected and its window has the focus.\n         *\n         * @see #FOCUSED_STATE_SET\n         * @see #SELECTED_STATE_SET\n         * @see #WINDOW_FOCUSED_STATE_SET\n         */\n        static FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is enabled, focused, selected and its window\n         * has the focus.\n         *\n         * @see #ENABLED_STATE_SET\n         * @see #FOCUSED_STATE_SET\n         * @see #SELECTED_STATE_SET\n         * @see #WINDOW_FOCUSED_STATE_SET\n         */\n        static ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is pressed and its window has the focus.\n         *\n         * @see #PRESSED_STATE_SET\n         * @see #WINDOW_FOCUSED_STATE_SET\n         */\n        static PRESSED_WINDOW_FOCUSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is pressed and selected.\n         *\n         * @see #PRESSED_STATE_SET\n         * @see #SELECTED_STATE_SET\n         */\n        static PRESSED_SELECTED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is pressed, selected and its window has the focus.\n         *\n         * @see #PRESSED_STATE_SET\n         * @see #SELECTED_STATE_SET\n         * @see #WINDOW_FOCUSED_STATE_SET\n         */\n        static PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is pressed and focused.\n         *\n         * @see #PRESSED_STATE_SET\n         * @see #FOCUSED_STATE_SET\n         */\n        static PRESSED_FOCUSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is pressed, focused and its window has the focus.\n         *\n         * @see #PRESSED_STATE_SET\n         * @see #FOCUSED_STATE_SET\n         * @see #WINDOW_FOCUSED_STATE_SET\n         */\n        static PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is pressed, focused and selected.\n         *\n         * @see #PRESSED_STATE_SET\n         * @see #SELECTED_STATE_SET\n         * @see #FOCUSED_STATE_SET\n         */\n        static PRESSED_FOCUSED_SELECTED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is pressed, focused, selected and its window has the focus.\n         *\n         * @see #PRESSED_STATE_SET\n         * @see #FOCUSED_STATE_SET\n         * @see #SELECTED_STATE_SET\n         * @see #WINDOW_FOCUSED_STATE_SET\n         */\n        static PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is pressed and enabled.\n         *\n         * @see #PRESSED_STATE_SET\n         * @see #ENABLED_STATE_SET\n         */\n        static PRESSED_ENABLED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is pressed, enabled and its window has the focus.\n         *\n         * @see #PRESSED_STATE_SET\n         * @see #ENABLED_STATE_SET\n         * @see #WINDOW_FOCUSED_STATE_SET\n         */\n        static PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is pressed, enabled and selected.\n         *\n         * @see #PRESSED_STATE_SET\n         * @see #ENABLED_STATE_SET\n         * @see #SELECTED_STATE_SET\n         */\n        static PRESSED_ENABLED_SELECTED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is pressed, enabled, selected and its window has the\n         * focus.\n         *\n         * @see #PRESSED_STATE_SET\n         * @see #ENABLED_STATE_SET\n         * @see #SELECTED_STATE_SET\n         * @see #WINDOW_FOCUSED_STATE_SET\n         */\n        static PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is pressed, enabled and focused.\n         *\n         * @see #PRESSED_STATE_SET\n         * @see #ENABLED_STATE_SET\n         * @see #FOCUSED_STATE_SET\n         */\n        static PRESSED_ENABLED_FOCUSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is pressed, enabled, focused and its window has the\n         * focus.\n         *\n         * @see #PRESSED_STATE_SET\n         * @see #ENABLED_STATE_SET\n         * @see #FOCUSED_STATE_SET\n         * @see #WINDOW_FOCUSED_STATE_SET\n         */\n        static PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is pressed, enabled, focused and selected.\n         *\n         * @see #PRESSED_STATE_SET\n         * @see #ENABLED_STATE_SET\n         * @see #SELECTED_STATE_SET\n         * @see #FOCUSED_STATE_SET\n         */\n        static PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET:number[];\n\n        /**\n         * Indicates the view is pressed, enabled, focused, selected and its window\n         * has the focus.\n         *\n         * @see #PRESSED_STATE_SET\n         * @see #ENABLED_STATE_SET\n         * @see #SELECTED_STATE_SET\n         * @see #FOCUSED_STATE_SET\n         * @see #WINDOW_FOCUSED_STATE_SET\n         */\n        static PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET:number[];\n\n        static VIEW_STATE_SETS:Array<Array<number>>;\n        static VIEW_STATE_WINDOW_FOCUSED = 1;\n        static VIEW_STATE_SELECTED = 1 << 1;\n        static VIEW_STATE_FOCUSED = 1 << 2;\n        static VIEW_STATE_ENABLED = 1 << 3;\n        static VIEW_STATE_PRESSED = 1 << 4;\n        static VIEW_STATE_ACTIVATED = 1 << 5;\n        //static VIEW_STATE_ACCELERATED = 1 << 6;\n        static VIEW_STATE_HOVERED = 1 << 7;\n        //static VIEW_STATE_DRAG_CAN_ACCEPT = 1 << 8;\n        //static VIEW_STATE_DRAG_HOVERED = 1 << 9;\n\n        //for CompoundButton\n        static VIEW_STATE_CHECKED = 1 << 10;\n        //for TextView\n        static VIEW_STATE_MULTILINE = 1 << 11;\n        //for ExpandableListView\n        static VIEW_STATE_EXPANDED = 1 << 12;\n        static VIEW_STATE_EMPTY = 1 << 13;\n        static VIEW_STATE_LAST = 1 << 14;\n\n        //android default use attr id, there use state value as id\n        static VIEW_STATE_IDS = [\n            View.VIEW_STATE_WINDOW_FOCUSED,    View.VIEW_STATE_WINDOW_FOCUSED,\n            View.VIEW_STATE_SELECTED,          View.VIEW_STATE_SELECTED,\n            View.VIEW_STATE_FOCUSED,           View.VIEW_STATE_FOCUSED,\n            View.VIEW_STATE_ENABLED,           View.VIEW_STATE_ENABLED,\n            View.VIEW_STATE_PRESSED,           View.VIEW_STATE_PRESSED,\n            View.VIEW_STATE_ACTIVATED,         View.VIEW_STATE_ACTIVATED,\n            //View.VIEW_STATE_ACCELERATED,       View.VIEW_STATE_ACCELERATED,\n            View.VIEW_STATE_HOVERED,           View.VIEW_STATE_HOVERED,\n            //View.VIEW_STATE_DRAG_CAN_ACCEPT,   View.VIEW_STATE_DRAG_CAN_ACCEPT,\n            //View.VIEW_STATE_DRAG_HOVERED,      View.VIEW_STATE_DRAG_HOVERED\n        ];\n        private static _static = (()=>{\n            function Integer_bitCount(i):number{\n                // HD, Figure 5-2\n                i = i - ((i >>> 1) & 0x55555555);\n                i = (i & 0x33333333) + ((i >>> 2) & 0x33333333);\n                i = (i + (i >>> 4)) & 0x0f0f0f0f;\n                i = i + (i >>> 8);\n                i = i + (i >>> 16);\n                return i & 0x3f;\n            }\n\n            let orderedIds = View.VIEW_STATE_IDS;\n            const NUM_BITS = View.VIEW_STATE_IDS.length / 2;\n            View.VIEW_STATE_SETS = new Array<Array<number>>(1 << NUM_BITS);\n            for (let i = 0; i < View.VIEW_STATE_SETS.length; i++) {\n                let numBits = Integer_bitCount(i);\n                const stataSet = androidui.util.ArrayCreator.newNumberArray(numBits);\n                let pos = 0;\n                for (let j = 0; j < orderedIds.length; j += 2) {\n                    if ((i & orderedIds[j+1]) != 0) {\n                        stataSet[pos++] = orderedIds[j];\n                    }\n                }\n                View.VIEW_STATE_SETS[i] = stataSet;\n            }\n            View.EMPTY_STATE_SET = View.VIEW_STATE_SETS[0];\n            View.WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED];\n            View.SELECTED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED];\n            View.SELECTED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_SELECTED];\n            View.FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_FOCUSED];\n            View.FOCUSED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_FOCUSED];\n            View.FOCUSED_SELECTED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED | View.VIEW_STATE_FOCUSED];\n            View.FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_SELECTED | View.VIEW_STATE_FOCUSED];\n            View.ENABLED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_ENABLED];\n            View.ENABLED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_ENABLED];\n            View.ENABLED_SELECTED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED | View.VIEW_STATE_ENABLED];\n            View.ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_SELECTED | View.VIEW_STATE_ENABLED];\n            View.ENABLED_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_FOCUSED | View.VIEW_STATE_ENABLED];\n            View.ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_ENABLED];\n            View.ENABLED_FOCUSED_SELECTED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_ENABLED];\n            View.ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_SELECTED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_ENABLED];\n            View.PRESSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_PRESSED];\n            View.PRESSED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_SELECTED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_SELECTED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_FOCUSED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_FOCUSED_SELECTED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_SELECTED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_ENABLED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_ENABLED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_ENABLED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_ENABLED_SELECTED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED | View.VIEW_STATE_ENABLED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_SELECTED | View.VIEW_STATE_ENABLED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_ENABLED_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_FOCUSED | View.VIEW_STATE_ENABLED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_ENABLED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_SELECTED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_ENABLED | View.VIEW_STATE_PRESSED];\n            View.PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET = View.VIEW_STATE_SETS[View.VIEW_STATE_WINDOW_FOCUSED | View.VIEW_STATE_SELECTED | View.VIEW_STATE_FOCUSED | View.VIEW_STATE_ENABLED | View.VIEW_STATE_PRESSED];\n        })();\n\n        static CLICKABLE = 0x00004000;\n        static DRAWING_CACHE_ENABLED = 0x00008000;\n        static WILL_NOT_CACHE_DRAWING = 0x000020000;\n        private static FOCUSABLE_IN_TOUCH_MODE = 0x00040000;\n        static LONG_CLICKABLE = 0x00200000;\n        static DUPLICATE_PARENT_STATE = 0x00400000;\n\n        static LAYER_TYPE_NONE = 0;\n        static LAYER_TYPE_SOFTWARE = 1;\n\n\n        /**\n         * Horizontal layout direction of this view is from Left to Right.\n         * Use with {@link #setLayoutDirection}.\n         */\n        static LAYOUT_DIRECTION_LTR:number = LayoutDirection.LTR;\n\n        /**\n         * Horizontal layout direction of this view is from Right to Left.\n         * Use with {@link #setLayoutDirection}.\n         */\n        static LAYOUT_DIRECTION_RTL:number = LayoutDirection.RTL;\n\n        /**\n         * Horizontal layout direction of this view is inherited from its parent.\n         * Use with {@link #setLayoutDirection}.\n         */\n        static LAYOUT_DIRECTION_INHERIT:number = LayoutDirection.INHERIT;\n\n        /**\n         * Horizontal layout direction of this view is from deduced from the default language\n         * script for the locale. Use with {@link #setLayoutDirection}.\n         */\n        static LAYOUT_DIRECTION_LOCALE:number = LayoutDirection.LOCALE;\n\n\n        /**\n         * Text direction is inherited thru {@link ViewGroup}\n         */\n        static TEXT_DIRECTION_INHERIT:number = 0;\n\n        /**\n         * Text direction is using \"first strong algorithm\". The first strong directional character\n         * determines the paragraph direction. If there is no strong directional character, the\n         * paragraph direction is the view's resolved layout direction.\n         */\n        static TEXT_DIRECTION_FIRST_STRONG:number = 1;\n\n        /**\n         * Text direction is using \"any-RTL\" algorithm. The paragraph direction is RTL if it contains\n         * any strong RTL character, otherwise it is LTR if it contains any strong LTR characters.\n         * If there are neither, the paragraph direction is the view's resolved layout direction.\n         */\n        static TEXT_DIRECTION_ANY_RTL:number = 2;\n\n        /**\n         * Text direction is forced to LTR.\n         */\n        static TEXT_DIRECTION_LTR:number = 3;\n\n        /**\n         * Text direction is forced to RTL.\n         */\n        static TEXT_DIRECTION_RTL:number = 4;\n\n        /**\n         * Text direction is coming from the system Locale.\n         */\n        static TEXT_DIRECTION_LOCALE:number = 5;\n\n        /**\n         * Default text direction is inherited\n         */\n        private static TEXT_DIRECTION_DEFAULT:number = View.TEXT_DIRECTION_INHERIT;\n\n        /**\n         * Default resolved text direction\n         * @hide\n         */\n        static TEXT_DIRECTION_RESOLVED_DEFAULT:number = View.TEXT_DIRECTION_FIRST_STRONG;\n\n\n        /*\n         * Default text alignment. The text alignment of this View is inherited from its parent.\n         * Use with {@link #setTextAlignment(int)}\n         */\n        static TEXT_ALIGNMENT_INHERIT:number = 0;\n\n        /**\n         * Default for the root view. The gravity determines the text alignment, ALIGN_NORMAL,\n         * ALIGN_CENTER, or ALIGN_OPPOSITE, which are relative to each paragraph’s text direction.\n         *\n         * Use with {@link #setTextAlignment(int)}\n         */\n        static TEXT_ALIGNMENT_GRAVITY:number = 1;\n\n        /**\n         * Align to the start of the paragraph, e.g. ALIGN_NORMAL.\n         *\n         * Use with {@link #setTextAlignment(int)}\n         */\n        static TEXT_ALIGNMENT_TEXT_START:number = 2;\n\n        /**\n         * Align to the end of the paragraph, e.g. ALIGN_OPPOSITE.\n         *\n         * Use with {@link #setTextAlignment(int)}\n         */\n        static TEXT_ALIGNMENT_TEXT_END:number = 3;\n\n        /**\n         * Center the paragraph, e.g. ALIGN_CENTER.\n         *\n         * Use with {@link #setTextAlignment(int)}\n         */\n        static TEXT_ALIGNMENT_CENTER:number = 4;\n\n        /**\n         * Align to the start of the view, which is ALIGN_LEFT if the view’s resolved\n         * layoutDirection is LTR, and ALIGN_RIGHT otherwise.\n         *\n         * Use with {@link #setTextAlignment(int)}\n         */\n        static TEXT_ALIGNMENT_VIEW_START:number = 5;\n\n        /**\n         * Align to the end of the view, which is ALIGN_RIGHT if the view’s resolved\n         * layoutDirection is LTR, and ALIGN_LEFT otherwise.\n         *\n         * Use with {@link #setTextAlignment(int)}\n         */\n        static TEXT_ALIGNMENT_VIEW_END:number = 6;\n\n        /**\n         * Default text alignment is inherited\n         */\n        private static TEXT_ALIGNMENT_DEFAULT:number = View.TEXT_ALIGNMENT_GRAVITY;\n\n        /**\n         * Default resolved text alignment\n         * @hide\n         */\n        static TEXT_ALIGNMENT_RESOLVED_DEFAULT:number = View.TEXT_ALIGNMENT_GRAVITY;\n\n\n        protected mID:string;\n        protected mTag:any;\n        protected mPrivateFlags = 0;\n        private mPrivateFlags2 = 0;\n        private mPrivateFlags3 = 0;\n\n        protected mContext:Context;\n\n        protected mCurrentAnimation:Animation = null;\n\n        private mOldWidthMeasureSpec = Number.MIN_SAFE_INTEGER;\n        private mOldHeightMeasureSpec = Number.MIN_SAFE_INTEGER;\n        private mMeasuredWidth = 0;\n        private mMeasuredHeight = 0;\n        private mBackground:Drawable;\n        private mBackgroundSizeChanged=false;\n        private mBackgroundWidth = 0;\n        private mBackgroundHeight = 0;\n        private mScrollCache:ScrollabilityCache;\n        private mDrawableState:Array<number>;\n\n        private mNextFocusLeftId:string;\n        private mNextFocusRightId:string;\n        private mNextFocusUpId:string;\n        private mNextFocusDownId:string;\n        mNextFocusForwardId:string;\n\n        private mPendingCheckForLongPress:CheckForLongPress;\n        private mPendingCheckForTap:CheckForTap;\n        private mPerformClick:PerformClick;\n        private mPerformClickAfterPressDraw:PerformClickAfterPressDraw;\n        private mUnsetPressedState:UnsetPressedState;\n        private mHasPerformedLongPress = false;\n        mMinWidth = 0;\n        mMinHeight = 0;\n        private mTouchDelegate : TouchDelegate;\n        private mFloatingTreeObserver : ViewTreeObserver;\n        /**\n         * Solid color to use as a background when creating the drawing cache. Enables\n         * the cache to use 16 bit bitmaps instead of 32 bit.\n         */\n        private mDrawingCacheBackgroundColor = 0;\n        private mUnscaledDrawingCache:Canvas;\n        mTouchSlop = 0;\n        private mVerticalScrollFactor = 0;\n        private mOverScrollMode = View.OVER_SCROLL_IF_CONTENT_SCROLLS;\n        mParent:ViewParent;\n        private mMeasureCache:Map<string, number[]>;\n        mAttachInfo:View.AttachInfo;\n        mLayoutParams:ViewGroup.LayoutParams;\n        mTransformationInfo:View.TransformationInfo;\n        mViewFlags=0;\n\n        mLayerType = View.LAYER_TYPE_NONE;\n        mLocalDirtyRect:Rect;\n\n        mCachingFailed = false;\n\n\n        private mOverlay:ViewOverlay;\n        private mWindowAttachCount=0;\n        private mTransientStateCount = 0;\n        private mListenerInfo:View.ListenerInfo;\n\n        private mClipBounds:Rect;\n        private mLastIsOpaque = false;\n        private mMatchIdPredicate : MatchIdPredicate;\n\n        private _mLeft = 0;\n        private _mRight = 0;\n        private _mTop = 0;\n        private _mBottom = 0;\n        get mLeft():number {\n            return this._mLeft;\n        }\n        set mLeft(value:number) {\n            this._mLeft = Math.floor(value);\n            this.requestSyncBoundToElement();\n        }\n        get mRight():number {\n            return this._mRight;\n        }\n        set mRight(value:number) {\n            this._mRight = Math.floor(value);\n            this.requestSyncBoundToElement();\n        }\n        get mTop():number {\n            return this._mTop;\n        }\n        set mTop(value:number) {\n            if (Number.isNaN(value)) {\n                debugger;\n            }\n            this._mTop = Math.floor(value);\n            this.requestSyncBoundToElement();\n        }\n        get mBottom():number {\n            return this._mBottom;\n        }\n        set mBottom(value:number) {\n            this._mBottom = Math.floor(value);\n            this.requestSyncBoundToElement();\n        }\n\n        private _mScrollX = 0;\n        private _mScrollY = 0;\n        get mScrollX():number {\n            return this._mScrollX;\n        }\n        set mScrollX(value:number) {\n            this._mScrollX = Math.floor(value);\n            this.requestSyncBoundToElement();\n        }\n        get mScrollY():number {\n            return this._mScrollY;\n        }\n        set mScrollY(value:number) {\n            this._mScrollY = Math.floor(value);\n            this.requestSyncBoundToElement();\n        }\n\n        protected mPaddingLeft = 0;\n        protected mPaddingRight = 0;\n        protected mPaddingTop = 0;\n        protected mPaddingBottom = 0;\n\n        //androidui add:\n        //clip with the cornerRadius:\n        private mCornerRadiusTopLeft = 0;\n        private mCornerRadiusTopRight = 0;\n        private mCornerRadiusBottomRight = 0;\n        private mCornerRadiusBottomLeft = 0;\n        //draw shadow with background:\n        private mShadowPaint:Paint;\n        private mShadowDrawable:Drawable;\n\n        constructor(context:Context, bindElement?:HTMLElement, defStyleAttr?:Map<string, string>) {\n            super();\n            this.mContext = context;\n            this.mTouchSlop = ViewConfiguration.get().getScaledTouchSlop();\n\n            // AndroidUI add logic:\n            this.initBindAttr();\n            this.initBindElement(bindElement);\n            // AndroidUI add end\n\n            const a:TypedArray = context.obtainStyledAttributes(bindElement, defStyleAttr);\n\n            let background:Drawable = null;\n\n            let leftPadding = -1;\n            let topPadding = -1;\n            let rightPadding = -1;\n            let bottomPadding = -1;\n            // let startPadding = -1;//View.UNDEFINED_PADDING;\n            // let endPadding = -1;//View.UNDEFINED_PADDING;\n\n            let padding = -1;\n\n            let viewFlagValues = 0;\n            let viewFlagMasks = 0;\n\n            let setScrollContainer = false;\n\n            let x = 0;\n            let y = 0;\n\n            let tx = 0;\n            let ty = 0;\n            let rotation = 0;\n            let rotationX = 0;\n            let rotationY = 0;\n            let sx = 1;\n            let sy = 1;\n            let transformSet = false;\n\n            // let scrollbarStyle = View.SCROLLBARS_INSIDE_OVERLAY;\n            let overScrollMode = this.mOverScrollMode;\n            let initializeScrollbars = false;\n\n            // let startPaddingDefined = false;\n            // let endPaddingDefined = false;\n            // let leftPaddingDefined = false;\n            // let rightPaddingDefined = false;\n\n            // const targetSdkVersion = context.getApplicationInfo().targetSdkVersion;\n            for (let attr of a.getLowerCaseNoNamespaceAttrNames()) {\n                switch (attr) {\n                    case 'background':\n                        background = a.getDrawable(attr);\n                        break;\n                    case 'padding':\n                        padding = a.getDimensionPixelSize(attr, -1);\n                        // this.mUserPaddingLeftInitial = padding;\n                        // this.mUserPaddingRightInitial = padding;\n                        // leftPaddingDefined = true;\n                        // rightPaddingDefined = true;\n                        break;\n                     case 'paddingleft':\n                        leftPadding = a.getDimensionPixelSize(attr, -1);\n                        // this.mUserPaddingLeftInitial = leftPadding;\n                        // leftPaddingDefined = true;\n                        break;\n                    case 'paddingtop':\n                        topPadding = a.getDimensionPixelSize(attr, -1);\n                        break;\n                    case 'paddingright':\n                        rightPadding = a.getDimensionPixelSize(attr, -1);\n                        // this.mUserPaddingRightInitial = rightPadding;\n                        // rightPaddingDefined = true;\n                        break;\n                    case 'paddingbottom':\n                        bottomPadding = a.getDimensionPixelSize(attr, -1);\n                        break;\n                    case 'paddingstart':\n                        leftPadding = a.getDimensionPixelSize(attr, -1);\n                        // leftPaddingDefined = true;\n                        // startPadding = a.getDimensionPixelSize(attr, UNDEFINED_PADDING);\n                        // startPaddingDefined = (startPadding != UNDEFINED_PADDING);\n                        break;\n                    case 'paddingend':\n                        rightPadding = a.getDimensionPixelSize(attr, -1);\n                        // rightPaddingDefined = true;\n                        // endPadding = a.getDimensionPixelSize(attr, UNDEFINED_PADDING);\n                        // endPaddingDefined = (endPadding != UNDEFINED_PADDING);\n                        break;\n                    case 'scrollx':\n                        x = a.getDimensionPixelOffset(attr, 0);\n                        break;\n                    case 'scrolly':\n                        y = a.getDimensionPixelOffset(attr, 0);\n                        break;\n                    case 'alpha':\n                        this.setAlpha(a.getFloat(attr, 1));\n                        break;\n                    case 'transformpivotx':\n                        this.setPivotX(a.getDimensionPixelOffset(attr, 0));\n                        break;\n                    case 'transformpivoty':\n                        this.setPivotY(a.getDimensionPixelOffset(attr, 0));\n                        break;\n                    case 'translationx':\n                        tx = a.getDimensionPixelOffset(attr, 0);\n                        transformSet = true;\n                        break;\n                    case 'translationy':\n                        ty = a.getDimensionPixelOffset(attr, 0);\n                        transformSet = true;\n                        break;\n                    case 'rotation':\n                        rotation = a.getFloat(attr, 0);\n                        transformSet = true;\n                        break;\n                    case 'rotationx':\n                        rotationX = a.getFloat(attr, 0);\n                        transformSet = true;\n                        break;\n                    case 'rotationy':\n                        rotationY = a.getFloat(attr, 0);\n                        transformSet = true;\n                        break;\n                    case 'scalex':\n                        sx = a.getFloat(attr, 1);\n                        transformSet = true;\n                        break;\n                    case 'scaley':\n                        sy = a.getFloat(attr, 1);\n                        transformSet = true;\n                        break;\n                    case 'id':\n                        this.mID = a.getString(attr);\n                        break;\n                    case 'tag':\n                        this.mTag = a.getText(attr);\n                        break;\n                    case 'fitssystemwindows':\n                        // if (a.getBoolean(attr, false)) {\n                        //     viewFlagValues |= FITS_SYSTEM_WINDOWS;\n                        //     viewFlagMasks |= FITS_SYSTEM_WINDOWS;\n                        // }\n                        break;\n                    case 'focusable':\n                        if (a.getBoolean(attr, false)) {\n                            viewFlagValues |= View.FOCUSABLE;\n                            viewFlagMasks |= View.FOCUSABLE_MASK;\n                        }\n                        break;\n                    case 'focusableintouchmode':\n                        if (a.getBoolean(attr, false)) {\n                            viewFlagValues |= View.FOCUSABLE_IN_TOUCH_MODE | View.FOCUSABLE;\n                            viewFlagMasks |= View.FOCUSABLE_IN_TOUCH_MODE | View.FOCUSABLE_MASK;\n                        }\n                        break;\n                    case 'clickable':\n                        if (a.getBoolean(attr, false)) {\n                            viewFlagValues |= View.CLICKABLE;\n                            viewFlagMasks |= View.CLICKABLE;\n                        }\n                        break;\n                    case 'longclickable':\n                        if (a.getBoolean(attr, false)) {\n                            viewFlagValues |= View.LONG_CLICKABLE;\n                            viewFlagMasks |= View.LONG_CLICKABLE;\n                        }\n                        break;\n                    case 'saveenabled':\n                        // if (!a.getBoolean(attr, true)) {\n                        //     viewFlagValues |= View.SAVE_DISABLED;\n                        //     viewFlagMasks |= View.SAVE_DISABLED_MASK;\n                        // }\n                        break;\n                    case 'duplicateparentstate':\n                        if (a.getBoolean(attr, false)) {\n                            viewFlagValues |= View.DUPLICATE_PARENT_STATE;\n                            viewFlagMasks |= View.DUPLICATE_PARENT_STATE;\n                        }\n                        break;\n                    case 'visibility':\n                        const visibility = a.getAttrValue(attr);\n                        if(visibility === 'gone') {\n                            viewFlagValues |= View.GONE;\n                            viewFlagMasks |= View.VISIBILITY_MASK;\n                        } else if(visibility === 'invisible') {\n                            viewFlagValues |= View.INVISIBLE;\n                            viewFlagMasks |= View.VISIBILITY_MASK;\n                        } else if(visibility === 'visible') {\n                            viewFlagValues |= View.VISIBLE;\n                            viewFlagMasks |= View.VISIBILITY_MASK;\n                        }\n                        break;\n                    case 'layoutdirection':\n                        // // Clear any layout direction flags (included resolved bits) already set\n                        // this.mPrivateFlags2 &=\n                        //         ~(PFLAG2_LAYOUT_DIRECTION_MASK | PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK);\n                        // // Set the layout direction flags depending on the value of the attribute\n                        // const layoutDirection = a.getInt(attr, -1);\n                        // const value = (layoutDirection != -1) ?\n                        //         LAYOUT_DIRECTION_FLAGS[layoutDirection] : LAYOUT_DIRECTION_DEFAULT;\n                        // this.mPrivateFlags2 |= (value << PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT);\n                        break;\n                    case 'drawingcachequality':\n                        // const cacheQuality = a.getInt(attr, 0);\n                        // if (cacheQuality != 0) {\n                        //     viewFlagValues |= View.DRAWING_CACHE_QUALITY_FLAGS[cacheQuality];\n                        //     viewFlagMasks |= View.DRAWING_CACHE_QUALITY_MASK;\n                        // }\n                        break;\n                    case 'contentdescription':\n                        // this.setContentDescription(a.getString(attr));\n                        break;\n                    case 'labelfor':\n                        // this.setLabelFor(a.getString(attr));\n                        break;\n                    case 'soundeffectsenabled':\n                        // if (!a.getBoolean(attr, true)) {\n                        //     viewFlagValues &= ~View.SOUND_EFFECTS_ENABLED;\n                        //     viewFlagMasks |= View.SOUND_EFFECTS_ENABLED;\n                        // }\n                        break;\n                    case 'hapticfeedbackenabled':\n                        // if (!a.getBoolean(attr, true)) {\n                        //     viewFlagValues &= ~View.HAPTIC_FEEDBACK_ENABLED;\n                        //     viewFlagMasks |= View.HAPTIC_FEEDBACK_ENABLED;\n                        // }\n                        break;\n                    case 'scrollbars':\n                        const scrollbars = a.getAttrValue(attr);\n                        if (scrollbars === 'horizontal') {\n                            viewFlagValues |= View.SCROLLBARS_HORIZONTAL;\n                            viewFlagMasks |= View.SCROLLBARS_MASK;\n                            initializeScrollbars = true;\n                        } else if (scrollbars === 'vertical') {\n                            viewFlagValues |= View.SCROLLBARS_VERTICAL;\n                            viewFlagMasks |= View.SCROLLBARS_MASK;\n                            initializeScrollbars = true;\n                        }\n                        break;\n                    //noinspection deprecation\n                    case 'fadingedge':\n                        // if (targetSdkVersion >= ICE_CREAM_SANDWICH) {\n                        //     // Ignore the attribute starting with ICS\n                        //     break;\n                        // }\n                        // With builds < ICS, fall through and apply fading edges\n                    case 'requiresfadingedge':\n                        // const fadingEdge = a.getInt(attr, FADING_EDGE_NONE);\n                        // if (fadingEdge != FADING_EDGE_NONE) {\n                        //     viewFlagValues |= fadingEdge;\n                        //     viewFlagMasks |= View.FADING_EDGE_MASK;\n                        //     this.initializeFadingEdge(a);\n                        // }\n                        break;\n                    case 'scrollbarstyle':\n                        // scrollbarStyle = a.getInt(attr, View.SCROLLBARS_INSIDE_OVERLAY);\n                        // if (scrollbarStyle != View.SCROLLBARS_INSIDE_OVERLAY) {\n                        //     viewFlagValues |= scrollbarStyle & View.SCROLLBARS_STYLE_MASK;\n                        //     viewFlagMasks |= View.SCROLLBARS_STYLE_MASK;\n                        // }\n                        break;\n                    case 'isscrollcontainer':\n                        setScrollContainer = true;\n                        if (a.getBoolean(attr, false)) {\n                            this.setScrollContainer(true);\n                        }\n                        break;\n                    case 'keepscreenon':\n                        // if (a.getBoolean(attr, false)) {\n                        //     viewFlagValues |= View.KEEP_SCREEN_ON;\n                        //     viewFlagMasks |= View.KEEP_SCREEN_ON;\n                        // }\n                        break;\n                    case 'filtertoucheswhenobscured':\n                        // if (a.getBoolean(attr, false)) {\n                        //     viewFlagValues |= View.FILTER_TOUCHES_WHEN_OBSCURED;\n                        //     viewFlagMasks |= View.FILTER_TOUCHES_WHEN_OBSCURED;\n                        // }\n                        break;\n                    case 'nextfocusleft':\n                        this.mNextFocusLeftId = a.getResourceId(attr, View.NO_ID);\n                        break;\n                    case 'nextfocusright':\n                        this.mNextFocusRightId = a.getResourceId(attr, View.NO_ID);\n                        break;\n                    case 'nextfocusup':\n                        this.mNextFocusUpId = a.getResourceId(attr, View.NO_ID);\n                        break;\n                    case 'nextfocusdown':\n                        this.mNextFocusDownId = a.getResourceId(attr, View.NO_ID);\n                        break;\n                    case 'nextfocusforward':\n                        this.mNextFocusForwardId = a.getResourceId(attr, View.NO_ID);\n                        break;\n                    case 'minwidth':\n                        this.mMinWidth = a.getDimensionPixelSize(attr, 0);\n                        break;\n                    case 'minheight':\n                        this.mMinHeight = a.getDimensionPixelSize(attr, 0);\n                        break;\n                    case 'onclick':\n                        this.setOnClickListenerByAttrValueString(a.getString(attr));\n                        break;\n                    case 'overscrollmode':\n                        let scrollMode = View[('OVER_SCROLL_'+a.getAttrValue(attr)).toUpperCase()];\n                        overScrollMode = scrollMode || View.OVER_SCROLL_IF_CONTENT_SCROLLS;\n                        break;\n                    case 'verticalscrollbarposition':\n                        // this.mVerticalScrollbarPosition = a.getInt(attr, SCROLLBAR_POSITION_DEFAULT);\n                        break;\n                    case 'layertype':\n                        if((a.getAttrValue(attr)+'').toLowerCase() == 'software') {\n                            this.setLayerType(View.LAYER_TYPE_SOFTWARE);\n                        }else{\n                            this.setLayerType(View.LAYER_TYPE_NONE);\n                        }\n                        break;\n                    case 'textdirection':\n                        // Clear any text direction flag already set\n                        // this.mPrivateFlags2 &= ~PFLAG2_TEXT_DIRECTION_MASK;\n                        // // Set the text direction flags depending on the value of the attribute\n                        // final int textDirection = a.getInt(attr, -1);\n                        // if (textDirection != -1) {\n                        //     this.mPrivateFlags2 |= PFLAG2_TEXT_DIRECTION_FLAGS[textDirection];\n                        // }\n                        break;\n                    case 'textalignment':\n                        // // Clear any text alignment flag already set\n                        // this.mPrivateFlags2 &= ~PFLAG2_TEXT_ALIGNMENT_MASK;\n                        // // Set the text alignment flag depending on the value of the attribute\n                        // final int textAlignment = a.getInt(attr, TEXT_ALIGNMENT_DEFAULT);\n                        // this.mPrivateFlags2 |= PFLAG2_TEXT_ALIGNMENT_FLAGS[textAlignment];\n                        break;\n                    case 'importantforaccessibility':\n                        // setImportantForAccessibility(a.getInt(attr, IMPORTANT_FOR_ACCESSIBILITY_DEFAULT));\n                        break;\n                    case 'accessibilityliveregion':\n                        // setAccessibilityLiveRegion(a.getInt(attr, ACCESSIBILITY_LIVE_REGION_DEFAULT));\n                        break;\n                    case 'cornerradius':\n                    case 'cornerradiustopleft':\n                    case 'cornerradiustopright':\n                    case 'cornerradiusbottomleft':\n                    case 'cornerradiusbottomright':\n                    case 'viewshadowcolor':\n                    case 'viewshadowdx':\n                    case 'viewshadowdy':\n                    case 'viewshadowradius':\n                        //AndroidUIX add: these cases, attr pass to attr Binder (let attr Binder parse and set these values).\n                        this._attrBinder.onAttrChange(attr, a.getAttrValue(attr), this.getContext());\n                        break;\n                    default:\n                        if (attr && attr.startsWith('state_')) {\n                            this._stateAttrList.addStatedAttr(attr, a.getAttrValue(attr));\n                        }\n                }\n            }\n\n            this.setOverScrollMode(overScrollMode);\n\n            // // Cache start/end user padding as we cannot fully resolve padding here (we dont have yet\n            // // the resolved layout direction). Those cached values will be used later during padding\n            // // resolution.\n            // this.mUserPaddingStart = startPadding;\n            // this.mUserPaddingEnd = endPadding;\n\n            if (background != null) {\n                this.setBackground(background);\n            }\n\n            // setBackground above will record that padding is currently provided by the background.\n            // If we have padding specified via xml, record that here instead and use it.\n            // this.mLeftPaddingDefined = leftPaddingDefined;\n            // this.mRightPaddingDefined = rightPaddingDefined;\n\n            if (padding >= 0) {\n                leftPadding = padding;\n                topPadding = padding;\n                rightPadding = padding;\n                bottomPadding = padding;\n                // this.mUserPaddingLeftInitial = padding;\n                // this.mUserPaddingRightInitial = padding;\n            }\n\n            // if (isRtlCompatibilityMode()) {\n            //     // RTL compatibility mode: pre Jelly Bean MR1 case OR no RTL support case.\n            //     // left / right padding are used if defined (meaning here nothing to do). If they are not\n            //     // defined and start / end padding are defined (e.g. in Frameworks resources), then we use\n            //     // start / end and resolve them as left / right (layout direction is not taken into account).\n            //     // Padding from the background drawable is stored at this point in mUserPaddingLeftInitial\n            //     // and mUserPaddingRightInitial) so drawable padding will be used as ultimate default if\n            //     // defined.\n            //     if (!mLeftPaddingDefined && startPaddingDefined) {\n            //         leftPadding = startPadding;\n            //     }\n            //     this.mUserPaddingLeftInitial = (leftPadding >= 0) ? leftPadding : this.mUserPaddingLeftInitial;\n            //     if (!mRightPaddingDefined && endPaddingDefined) {\n            //         rightPadding = endPadding;\n            //     }\n            //     this.mUserPaddingRightInitial = (rightPadding >= 0) ? rightPadding : this.mUserPaddingRightInitial;\n            // } else {\n            //     // Jelly Bean MR1 and after case: if start/end defined, they will override any left/right\n            //     // values defined. Otherwise, left /right values are used.\n            //     // Padding from the background drawable is stored at this point in mUserPaddingLeftInitial\n            //     // and mUserPaddingRightInitial) so drawable padding will be used as ultimate default if\n            //     // defined.\n            //     const hasRelativePadding = startPaddingDefined || endPaddingDefined;\n            //\n            //     if (mLeftPaddingDefined && !hasRelativePadding) {\n            //         this.mUserPaddingLeftInitial = leftPadding;\n            //     }\n            //     if (mRightPaddingDefined && !hasRelativePadding) {\n            //         this.mUserPaddingRightInitial = rightPadding;\n            //     }\n            // }\n\n            this.setPadding(leftPadding >= 0 ? leftPadding : this.mPaddingLeft, topPadding >= 0 ? topPadding : this.mPaddingTop,\n                rightPadding >= 0 ? rightPadding : this.mPaddingRight, bottomPadding >= 0 ? bottomPadding : this.mPaddingBottom);\n\n            if (viewFlagMasks != 0) {\n                this.setFlags(viewFlagValues, viewFlagMasks);\n            }\n\n            if (initializeScrollbars) {\n                this.initializeScrollbars(a);\n            }\n\n            a.recycle();\n\n            // // Needs to be called after mViewFlags is set\n            // if (scrollbarStyle != View.SCROLLBARS_INSIDE_OVERLAY) {\n            //     this.recomputePadding();\n            // }\n\n            if (x != 0 || y != 0) {\n                scrollTo(x, y);\n            }\n\n            if (transformSet) {\n                this.setTranslationX(tx);\n                this.setTranslationY(ty);\n                this.setRotation(rotation);\n                this.setRotationX(rotationX);\n                this.setRotationY(rotationY);\n                this.setScaleX(sx);\n                this.setScaleY(sy);\n            }\n\n            if (!setScrollContainer && (viewFlagValues&View.SCROLLBARS_VERTICAL) != 0) {\n                this.setScrollContainer(true);\n            }\n\n            this.computeOpaqueFlags();\n        }\n\n        getContext():Context {\n            return this.mContext;\n        }\n        getWidth():number {\n            return this.mRight - this.mLeft;\n        }\n        getHeight():number {\n            return this.mBottom - this.mTop;\n        }\n        getPaddingLeft():number{\n            return this.mPaddingLeft;\n        }\n        getPaddingTop():number{\n            return this.mPaddingTop;\n        }\n        getPaddingRight():number{\n            return this.mPaddingRight;\n        }\n        getPaddingBottom():number{\n            return this.mPaddingBottom;\n        }\n        setPaddingLeft(left:number):void{\n            if (this.mPaddingLeft != left) {\n                this.mPaddingLeft = left;\n                this.requestLayout();\n            }\n        }\n        setPaddingTop(top:number):void{\n            if (this.mPaddingTop != top) {\n                this.mPaddingTop = top;\n                this.requestLayout();\n            }\n        }\n        setPaddingRight(right:number):void{\n            if (this.mPaddingRight != right) {\n                this.mPaddingRight = right;\n                this.requestLayout();\n            }\n        }\n        setPaddingBottom(bottom:number):void{\n            if (this.mPaddingBottom != bottom) {\n                this.mPaddingBottom = bottom;\n                this.requestLayout();\n            }\n        }\n        setPadding(left:number, top:number, right:number, bottom:number){\n            let changed = false;\n\n            if (this.mPaddingLeft != left) {\n                changed = true;\n                this.mPaddingLeft = left;\n            }\n            if (this.mPaddingTop != top) {\n                changed = true;\n                this.mPaddingTop = top;\n            }\n            if (this.mPaddingRight != right) {\n                changed = true;\n                this.mPaddingRight = right;\n            }\n            if (this.mPaddingBottom != bottom) {\n                changed = true;\n                this.mPaddingBottom = bottom;\n            }\n            if (changed) {\n                this.requestLayout();\n            }\n        }\n\n        resolvePadding():void  {\n            //no need resolve padding.(not support RTL now)\n        }\n\n        setScrollX(value:number) {\n            this.scrollTo(value, this.mScrollY);\n        }\n        setScrollY(value:number) {\n            this.scrollTo(this.mScrollX, value);\n        }\n        getScrollX():number {\n            return this.mScrollX;\n        }\n        getScrollY():number {\n            return this.mScrollY;\n        }\n\n        /**\n         * Offset this view's vertical location by the specified number of pixels.\n         *\n         * @param offset the number of pixels to offset the view by\n         */\n        offsetTopAndBottom(offset:number):void {\n            if (offset != 0) {\n                this.updateMatrix();\n                const matrixIsIdentity = this.mTransformationInfo == null || this.mTransformationInfo.mMatrixIsIdentity;\n\n                if (matrixIsIdentity) {\n//                if (mDisplayList != null) {\n//                    invalidateViewProperty(false, false);\n//                } else {\n                    const p = this.mParent;\n                    if (p != null && this.mAttachInfo != null) {\n                        const r = this.mAttachInfo.mTmpInvalRect;\n                        let minTop;\n                        let maxBottom;\n                        let yLoc;\n                        if (offset < 0) {\n                            minTop = this.mTop + offset;\n                            maxBottom = this.mBottom;\n                            yLoc = offset;\n                        } else {\n                            minTop = this.mTop;\n                            maxBottom = this.mBottom + offset;\n                            yLoc = 0;\n                        }\n                        r.set(0, yLoc, this.mRight - this.mLeft, maxBottom - minTop);\n                        p.invalidateChild(this, r);\n                    }\n//                }\n                } else {\n                    this.invalidateViewProperty(false, false);\n                }\n\n                this.mTop += offset;\n                this.mBottom += offset;\n\n//            if (mDisplayList != null) {\n//                mDisplayList.offsetTopAndBottom(offset);\n//                invalidateViewProperty(false, false);\n//            } else {\n                if (!matrixIsIdentity) {\n                    this.invalidateViewProperty(false, true);\n                }\n                this.invalidateParentIfNeeded();\n//            }\n            }\n        }\n\n        /**\n         * Offset this view's horizontal location by the specified amount of pixels.\n         *\n         * @param offset the number of pixels to offset the view by\n         */\n        offsetLeftAndRight(offset:number) {\n            if (offset != 0) {\n                this.updateMatrix();\n                const matrixIsIdentity = this.mTransformationInfo == null || this.mTransformationInfo.mMatrixIsIdentity;\n\n                if (matrixIsIdentity) {\n//                if (mDisplayList != null) {\n//                    invalidateViewProperty(false, false);\n//                } else {\n                    const p = this.mParent;\n                    if (p != null && this.mAttachInfo != null) {\n                        const r = this.mAttachInfo.mTmpInvalRect;\n                        let minLeft;\n                        let maxRight;\n                        if (offset < 0) {\n                            minLeft = this.mLeft + offset;\n                            maxRight = this.mRight;\n                        } else {\n                            minLeft = this.mLeft;\n                            maxRight = this.mRight + offset;\n                        }\n                        r.set(0, 0, maxRight - minLeft, this.mBottom - this.mTop);\n                        p.invalidateChild(this, r);\n                    }\n//                }\n                } else {\n                    this.invalidateViewProperty(false, false);\n                }\n\n                this.mLeft += offset;\n                this.mRight += offset;\n//            if (mDisplayList != null) {\n//                mDisplayList.offsetLeftAndRight(offset);\n//                invalidateViewProperty(false, false);\n//            } else {\n                if (!matrixIsIdentity) {\n                    this.invalidateViewProperty(false, true);\n                }\n                this.invalidateParentIfNeeded();\n//            }\n            }\n        }\n\n        /**\n         * The transform matrix of this view, which is calculated based on the current\n         * roation, scale, and pivot properties.\n         *\n         * @see #getRotation()\n         * @see #getScaleX()\n         * @see #getScaleY()\n         * @see #getPivotX()\n         * @see #getPivotY()\n         * @return The current transform matrix for the view\n         */\n        getMatrix():Matrix  {\n            if (this.mTransformationInfo != null) {\n                this.updateMatrix();\n                return this.mTransformationInfo.mMatrix;\n            }\n            return Matrix.IDENTITY_MATRIX;\n        }\n\n        ///**\n        // * Utility function to determine if the value is far enough away from zero to be\n        // * considered non-zero.\n        // * @param value A floating point value to check for zero-ness\n        // * @return whether the passed-in value is far enough away from zero to be considered non-zero\n        // */\n        //private static nonzero(value:number):boolean  {\n        //    return (value < -View.NONZERO_EPSILON || value > View.NONZERO_EPSILON);\n        //}\n\n        /**\n         * Returns true if the transform matrix is the identity matrix.\n         * Recomputes the matrix if necessary.\n         *\n         * @return True if the transform matrix is the identity matrix, false otherwise.\n         */\n        hasIdentityMatrix():boolean  {\n            if (this.mTransformationInfo != null) {\n                this.updateMatrix();\n                return this.mTransformationInfo.mMatrixIsIdentity;\n            }\n            return true;\n        }\n\n        ensureTransformationInfo():void  {\n            if (this.mTransformationInfo == null) {\n                this.mTransformationInfo = new View.TransformationInfo();\n            }\n        }\n\n        /**\n         * Recomputes the transform matrix if necessary.\n         */\n        private updateMatrix():void  {\n            const info:View.TransformationInfo = this.mTransformationInfo;\n            if (info == null) {\n                this._syncMatrixToElement();\n                return;\n            }\n            if (info.mMatrixDirty) {\n                // Figure out if we need to update the pivot point\n                if ((this.mPrivateFlags & View.PFLAG_PIVOT_EXPLICITLY_SET) == 0) {\n                    if ((this.mRight - this.mLeft) != info.mPrevWidth || (this.mBottom - this.mTop) != info.mPrevHeight) {\n                        info.mPrevWidth = this.mRight - this.mLeft;\n                        info.mPrevHeight = this.mBottom - this.mTop;\n                        info.mPivotX = info.mPrevWidth / 2;\n                        info.mPivotY = info.mPrevHeight / 2;\n                    }\n                }\n                info.mMatrix.reset();\n                //if (!View.nonzero(info.mRotationX) && !View.nonzero(info.mRotationY)) {\n                    info.mMatrix.setTranslate(info.mTranslationX, info.mTranslationY);\n                    info.mMatrix.preRotate(info.mRotation, info.mPivotX, info.mPivotY);\n                    info.mMatrix.preScale(info.mScaleX, info.mScaleY, info.mPivotX, info.mPivotY);\n                //} else {\n                //    if (info.mCamera == null) {\n                //        info.mCamera = new Camera();\n                //        info.matrix3D = new Matrix();\n                //    }\n                //    info.mCamera.save();\n                //    info.mMatrix.preScale(info.mScaleX, info.mScaleY, info.mPivotX, info.mPivotY);\n                //    info.mCamera.rotate(info.mRotationX, info.mRotationY, -info.mRotation);\n                //    info.mCamera.getMatrix(info.matrix3D);\n                //    info.matrix3D.preTranslate(-info.mPivotX, -info.mPivotY);\n                //    info.matrix3D.postTranslate(info.mPivotX + info.mTranslationX, info.mPivotY + info.mTranslationY);\n                //    info.mMatrix.postConcat(info.matrix3D);\n                //    info.mCamera.restore();\n                //}\n                info.mMatrixDirty = false;\n                info.mMatrixIsIdentity = info.mMatrix.isIdentity();\n                info.mInverseMatrixDirty = true;\n            }\n            this._syncMatrixToElement();\n        }\n\n        ///**\n        // * Utility method to retrieve the inverse of the current mMatrix property.\n        // * We cache the matrix to avoid recalculating it when transform properties\n        // * have not changed.\n        // *\n        // * @return The inverse of the current matrix of this view.\n        // */\n        //getInverseMatrix():Matrix  {\n        //    const info:View.TransformationInfo = this.mTransformationInfo;\n        //    if (info != null) {\n        //        this.updateMatrix();\n        //        if (info.mInverseMatrixDirty) {\n        //            if (info.mInverseMatrix == null) {\n        //                info.mInverseMatrix = new Matrix();\n        //            }\n        //            info.mMatrix.invert(info.mInverseMatrix);\n        //            info.mInverseMatrixDirty = false;\n        //        }\n        //        return info.mInverseMatrix;\n        //    }\n        //    return Matrix.IDENTITY_MATRIX;\n        //}\n\n        ///**\n        // * Gets the distance along the Z axis from the camera to this view.\n        // *\n        // * @see #setCameraDistance(float)\n        // *\n        // * @return The distance along the Z axis.\n        // */\n        //getCameraDistance():number  {\n        //    this.ensureTransformationInfo();\n        //    const dpi:number = this.mResources.getDisplayMetrics().densityDpi;\n        //    const info:View.TransformationInfo = this.mTransformationInfo;\n        //    if (info.mCamera == null) {\n        //        info.mCamera = new Camera();\n        //        info.matrix3D = new Matrix();\n        //    }\n        //    return -(info.mCamera.getLocationZ() * dpi);\n        //}\n        //\n        ///**\n        // * <p>Sets the distance along the Z axis (orthogonal to the X/Y plane on which\n        // * views are drawn) from the camera to this view. The camera's distance\n        // * affects 3D transformations, for instance rotations around the X and Y\n        // * axis. If the rotationX or rotationY properties are changed and this view is\n        // * large (more than half the size of the screen), it is recommended to always\n        // * use a camera distance that's greater than the height (X axis rotation) or\n        // * the width (Y axis rotation) of this view.</p>\n        // *\n        // * <p>The distance of the camera from the view plane can have an affect on the\n        // * perspective distortion of the view when it is rotated around the x or y axis.\n        // * For example, a large distance will result in a large viewing angle, and there\n        // * will not be much perspective distortion of the view as it rotates. A short\n        // * distance may cause much more perspective distortion upon rotation, and can\n        // * also result in some drawing artifacts if the rotated view ends up partially\n        // * behind the camera (which is why the recommendation is to use a distance at\n        // * least as far as the size of the view, if the view is to be rotated.)</p>\n        // *\n        // * <p>The distance is expressed in \"depth pixels.\" The default distance depends\n        // * on the screen density. For instance, on a medium density display, the\n        // * default distance is 1280. On a high density display, the default distance\n        // * is 1920.</p>\n        // *\n        // * <p>If you want to specify a distance that leads to visually consistent\n        // * results across various densities, use the following formula:</p>\n        // * <pre>\n        // * float scale = context.getResources().getDisplayMetrics().density;\n        // * view.setCameraDistance(distance * scale);\n        // * </pre>\n        // *\n        // * <p>The density scale factor of a high density display is 1.5,\n        // * and 1920 = 1280 * 1.5.</p>\n        // *\n        // * @param distance The distance in \"depth pixels\", if negative the opposite\n        // *        value is used\n        // *\n        // * @see #setRotationX(float)\n        // * @see #setRotationY(float)\n        // */\n        //setCameraDistance(distance:number):void  {\n        //    this.invalidateViewProperty(true, false);\n        //    this.ensureTransformationInfo();\n        //    const dpi:number = this.mResources.getDisplayMetrics().densityDpi;\n        //    const info:View.TransformationInfo = this.mTransformationInfo;\n        //    if (info.mCamera == null) {\n        //        info.mCamera = new Camera();\n        //        info.matrix3D = new Matrix();\n        //    }\n        //    info.mCamera.setLocation(0.0, 0.0, -Math.abs(distance) / dpi);\n        //    info.mMatrixDirty = true;\n        //    this.invalidateViewProperty(false, false);\n        //    if (this.mDisplayList != null) {\n        //        this.mDisplayList.setCameraDistance(-Math.abs(distance) / dpi);\n        //    }\n        //    if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n        //        // View was rejected last time it was drawn by its parent; this may have changed\n        //        this.invalidateParentIfNeeded();\n        //    }\n        //}\n\n        /**\n         * The degrees that the view is rotated around the pivot point.\n         *\n         * @see #setRotation(float)\n         * @see #getPivotX()\n         * @see #getPivotY()\n         *\n         * @return The degrees of rotation.\n         */\n        getRotation():number  {\n            return this.mTransformationInfo != null ? this.mTransformationInfo.mRotation : 0;\n        }\n\n        /**\n         * Sets the degrees that the view is rotated around the pivot point. Increasing values\n         * result in clockwise rotation.\n         *\n         * @param rotation The degrees of rotation.\n         *\n         * @see #getRotation()\n         * @see #getPivotX()\n         * @see #getPivotY()\n         * @see #setRotationX(float)\n         * @see #setRotationY(float)\n         *\n         * @attr ref android.R.styleable#View_rotation\n         */\n        setRotation(rotation:number):void  {\n            this.ensureTransformationInfo();\n            const info:View.TransformationInfo = this.mTransformationInfo;\n            if (info.mRotation != rotation) {\n                // Double-invalidation is necessary to capture view's old and new areas\n                this.invalidateViewProperty(true, false);\n                info.mRotation = rotation;\n                info.mMatrixDirty = true;\n                this.invalidateViewProperty(false, true);\n                //if (this.mDisplayList != null) {\n                //    this.mDisplayList.setRotation(rotation);\n                //}\n                if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                    // View was rejected last time it was drawn by its parent; this may have changed\n                    this.invalidateParentIfNeeded();\n                }\n            }\n        }\n\n        /**\n        * The degrees that the view is rotated around the vertical axis through the pivot point.\n        *\n        * @see #getPivotX()\n        * @see #getPivotY()\n        * @see #setRotationY(float)\n        *\n        * @return The degrees of Y rotation.\n        */\n        getRotationY():number  {\n           return 0;//this.mTransformationInfo != null ? this.mTransformationInfo.mRotationY : 0;\n        }\n\n        /**\n        * Sets the degrees that the view is rotated around the vertical axis through the pivot point.\n        * Increasing values result in counter-clockwise rotation from the viewpoint of looking\n        * down the y axis.\n        *\n        * When rotating large views, it is recommended to adjust the camera distance\n        * accordingly. Refer to {@link #setCameraDistance(float)} for more information.\n        *\n        * @param rotationY The degrees of Y rotation.\n        *\n        * @see #getRotationY()\n        * @see #getPivotX()\n        * @see #getPivotY()\n        * @see #setRotation(float)\n        * @see #setRotationX(float)\n        * @see #setCameraDistance(float)\n        *\n        * @attr ref android.R.styleable#View_rotationY\n        */\n        setRotationY(rotationY:number):void  {\n           // this.ensureTransformationInfo();\n           // const info:View.TransformationInfo = this.mTransformationInfo;\n           // if (info.mRotationY != rotationY) {\n           //     this.invalidateViewProperty(true, false);\n           //     info.mRotationY = rotationY;\n           //     info.mMatrixDirty = true;\n           //     this.invalidateViewProperty(false, true);\n           //     if (this.mDisplayList != null) {\n           //         this.mDisplayList.setRotationY(rotationY);\n           //     }\n           //     if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n           //         // View was rejected last time it was drawn by its parent; this may have changed\n           //         this.invalidateParentIfNeeded();\n           //     }\n           // }\n        }\n\n        /**\n        * The degrees that the view is rotated around the horizontal axis through the pivot point.\n        *\n        * @see #getPivotX()\n        * @see #getPivotY()\n        * @see #setRotationX(float)\n        *\n        * @return The degrees of X rotation.\n        */\n        getRotationX():number  {\n           return 0;//this.mTransformationInfo != null ? this.mTransformationInfo.mRotationX : 0;\n        }\n\n        /**\n        * Sets the degrees that the view is rotated around the horizontal axis through the pivot point.\n        * Increasing values result in clockwise rotation from the viewpoint of looking down the\n        * x axis.\n        *\n        * When rotating large views, it is recommended to adjust the camera distance\n        * accordingly. Refer to {@link #setCameraDistance(float)} for more information.\n        *\n        * @param rotationX The degrees of X rotation.\n        *\n        * @see #getRotationX()\n        * @see #getPivotX()\n        * @see #getPivotY()\n        * @see #setRotation(float)\n        * @see #setRotationY(float)\n        * @see #setCameraDistance(float)\n        *\n        * @attr ref android.R.styleable#View_rotationX\n        */\n        setRotationX(rotationX:number):void  {\n           // this.ensureTransformationInfo();\n           // const info:View.TransformationInfo = this.mTransformationInfo;\n           // if (info.mRotationX != rotationX) {\n           //     this.invalidateViewProperty(true, false);\n           //     info.mRotationX = rotationX;\n           //     info.mMatrixDirty = true;\n           //     this.invalidateViewProperty(false, true);\n           //     if (this.mDisplayList != null) {\n           //         this.mDisplayList.setRotationX(rotationX);\n           //     }\n           //     if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n           //         // View was rejected last time it was drawn by its parent; this may have changed\n           //         this.invalidateParentIfNeeded();\n           //     }\n           // }\n        }\n\n        /**\n         * The amount that the view is scaled in x around the pivot point, as a proportion of\n         * the view's unscaled width. A value of 1, the default, means that no scaling is applied.\n         *\n         * <p>By default, this is 1.0f.\n         *\n         * @see #getPivotX()\n         * @see #getPivotY()\n         * @return The scaling factor.\n         */\n        getScaleX():number  {\n            return this.mTransformationInfo != null ? this.mTransformationInfo.mScaleX : 1;\n        }\n\n        /**\n         * Sets the amount that the view is scaled in x around the pivot point, as a proportion of\n         * the view's unscaled width. A value of 1 means that no scaling is applied.\n         *\n         * @param scaleX The scaling factor.\n         * @see #getPivotX()\n         * @see #getPivotY()\n         *\n         * @attr ref android.R.styleable#View_scaleX\n         */\n        setScaleX(scaleX:number):void  {\n            this.ensureTransformationInfo();\n            const info:View.TransformationInfo = this.mTransformationInfo;\n            if (info.mScaleX != scaleX) {\n                this.invalidateViewProperty(true, false);\n                info.mScaleX = scaleX;\n                info.mMatrixDirty = true;\n                this.invalidateViewProperty(false, true);\n                //if (this.mDisplayList != null) {\n                //    this.mDisplayList.setScaleX(scaleX);\n                //}\n                if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                    // View was rejected last time it was drawn by its parent; this may have changed\n                    this.invalidateParentIfNeeded();\n                }\n            }\n        }\n\n        /**\n         * The amount that the view is scaled in y around the pivot point, as a proportion of\n         * the view's unscaled height. A value of 1, the default, means that no scaling is applied.\n         *\n         * <p>By default, this is 1.0f.\n         *\n         * @see #getPivotX()\n         * @see #getPivotY()\n         * @return The scaling factor.\n         */\n        getScaleY():number  {\n            return this.mTransformationInfo != null ? this.mTransformationInfo.mScaleY : 1;\n        }\n\n        /**\n         * Sets the amount that the view is scaled in Y around the pivot point, as a proportion of\n         * the view's unscaled width. A value of 1 means that no scaling is applied.\n         *\n         * @param scaleY The scaling factor.\n         * @see #getPivotX()\n         * @see #getPivotY()\n         *\n         * @attr ref android.R.styleable#View_scaleY\n         */\n        setScaleY(scaleY:number):void  {\n            this.ensureTransformationInfo();\n            const info:View.TransformationInfo = this.mTransformationInfo;\n            if (info.mScaleY != scaleY) {\n                this.invalidateViewProperty(true, false);\n                info.mScaleY = scaleY;\n                info.mMatrixDirty = true;\n                this.invalidateViewProperty(false, true);\n                //if (this.mDisplayList != null) {\n                //    this.mDisplayList.setScaleY(scaleY);\n                //}\n                if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                    // View was rejected last time it was drawn by its parent; this may have changed\n                    this.invalidateParentIfNeeded();\n                }\n            }\n        }\n\n        /**\n         * The x location of the point around which the view is {@link #setRotation(float) rotated}\n         * and {@link #setScaleX(float) scaled}.\n         *\n         * @see #getRotation()\n         * @see #getScaleX()\n         * @see #getScaleY()\n         * @see #getPivotY()\n         * @return The x location of the pivot point.\n         *\n         * @attr ref android.R.styleable#View_transformPivotX\n         */\n        getPivotX():number  {\n            return this.mTransformationInfo != null ? this.mTransformationInfo.mPivotX : 0;\n        }\n\n        /**\n         * Sets the x location of the point around which the view is\n         * {@link #setRotation(float) rotated} and {@link #setScaleX(float) scaled}.\n         * By default, the pivot point is centered on the object.\n         * Setting this property disables this behavior and causes the view to use only the\n         * explicitly set pivotX and pivotY values.\n         *\n         * @param pivotX The x location of the pivot point.\n         * @see #getRotation()\n         * @see #getScaleX()\n         * @see #getScaleY()\n         * @see #getPivotY()\n         *\n         * @attr ref android.R.styleable#View_transformPivotX\n         */\n        setPivotX(pivotX:number):void  {\n            this.ensureTransformationInfo();\n            const info:View.TransformationInfo = this.mTransformationInfo;\n            let pivotSet:boolean = (this.mPrivateFlags & View.PFLAG_PIVOT_EXPLICITLY_SET) == View.PFLAG_PIVOT_EXPLICITLY_SET;\n            if (info.mPivotX != pivotX || !pivotSet) {\n                this.mPrivateFlags |= View.PFLAG_PIVOT_EXPLICITLY_SET;\n                this.invalidateViewProperty(true, false);\n                info.mPivotX = pivotX;\n                info.mMatrixDirty = true;\n                this.invalidateViewProperty(false, true);\n                //if (this.mDisplayList != null) {\n                //    this.mDisplayList.setPivotX(pivotX);\n                //}\n                if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                    // View was rejected last time it was drawn by its parent; this may have changed\n                    this.invalidateParentIfNeeded();\n                }\n            }\n        }\n\n        /**\n         * The y location of the point around which the view is {@link #setRotation(float) rotated}\n         * and {@link #setScaleY(float) scaled}.\n         *\n         * @see #getRotation()\n         * @see #getScaleX()\n         * @see #getScaleY()\n         * @see #getPivotY()\n         * @return The y location of the pivot point.\n         *\n         * @attr ref android.R.styleable#View_transformPivotY\n         */\n        getPivotY():number  {\n            return this.mTransformationInfo != null ? this.mTransformationInfo.mPivotY : 0;\n        }\n\n        /**\n         * Sets the y location of the point around which the view is {@link #setRotation(float) rotated}\n         * and {@link #setScaleY(float) scaled}. By default, the pivot point is centered on the object.\n         * Setting this property disables this behavior and causes the view to use only the\n         * explicitly set pivotX and pivotY values.\n         *\n         * @param pivotY The y location of the pivot point.\n         * @see #getRotation()\n         * @see #getScaleX()\n         * @see #getScaleY()\n         * @see #getPivotY()\n         *\n         * @attr ref android.R.styleable#View_transformPivotY\n         */\n        setPivotY(pivotY:number):void  {\n            this.ensureTransformationInfo();\n            const info:View.TransformationInfo = this.mTransformationInfo;\n            let pivotSet:boolean = (this.mPrivateFlags & View.PFLAG_PIVOT_EXPLICITLY_SET) == View.PFLAG_PIVOT_EXPLICITLY_SET;\n            if (info.mPivotY != pivotY || !pivotSet) {\n                this.mPrivateFlags |= View.PFLAG_PIVOT_EXPLICITLY_SET;\n                this.invalidateViewProperty(true, false);\n                info.mPivotY = pivotY;\n                info.mMatrixDirty = true;\n                this.invalidateViewProperty(false, true);\n                //if (this.mDisplayList != null) {\n                //    this.mDisplayList.setPivotY(pivotY);\n                //}\n                if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                    // View was rejected last time it was drawn by its parent; this may have changed\n                    this.invalidateParentIfNeeded();\n                }\n            }\n        }\n\n        /**\n         * The opacity of the view. This is a value from 0 to 1, where 0 means the view is\n         * completely transparent and 1 means the view is completely opaque.\n         *\n         * <p>By default this is 1.0f.\n         * @return The opacity of the view.\n         */\n        getAlpha():number  {\n            return this.mTransformationInfo != null ? this.mTransformationInfo.mAlpha : 1;\n        }\n\n        /**\n         * Returns whether this View has content which overlaps.\n         *\n         * <p>This function, intended to be overridden by specific View types, is an optimization when\n         * alpha is set on a view. If rendering overlaps in a view with alpha < 1, that view is drawn to\n         * an offscreen buffer and then composited into place, which can be expensive. If the view has\n         * no overlapping rendering, the view can draw each primitive with the appropriate alpha value\n         * directly. An example of overlapping rendering is a TextView with a background image, such as\n         * a Button. An example of non-overlapping rendering is a TextView with no background, or an\n         * ImageView with only the foreground image. The default implementation returns true; subclasses\n         * should override if they have cases which can be optimized.</p>\n         *\n         * <p>The current implementation of the saveLayer and saveLayerAlpha methods in {@link Canvas}\n         * necessitates that a View return true if it uses the methods internally without passing the\n         * {@link Canvas#CLIP_TO_LAYER_SAVE_FLAG}.</p>\n         *\n         * @return true if the content in this view might overlap, false otherwise.\n         */\n        hasOverlappingRendering():boolean  {\n            return true;\n        }\n\n        /**\n         * <p>Sets the opacity of the view. This is a value from 0 to 1, where 0 means the view is\n         * completely transparent and 1 means the view is completely opaque.</p>\n         *\n         * <p> Note that setting alpha to a translucent value (0 < alpha < 1) can have significant\n         * performance implications, especially for large views. It is best to use the alpha property\n         * sparingly and transiently, as in the case of fading animations.</p>\n         *\n         * <p>For a view with a frequently changing alpha, such as during a fading animation, it is\n         * strongly recommended for performance reasons to either override\n         * {@link #hasOverlappingRendering()} to return false if appropriate, or setting a\n         * {@link #setLayerType(int, android.graphics.Paint) layer type} on the view.</p>\n         *\n         * <p>If this view overrides {@link #onSetAlpha(int)} to return true, then this view is\n         * responsible for applying the opacity itself.</p>\n         *\n         * <p>Note that if the view is backed by a\n         * {@link #setLayerType(int, android.graphics.Paint) layer} and is associated with a\n         * {@link #setLayerPaint(android.graphics.Paint) layer paint}, setting an alpha value less than\n         * 1.0 will supercede the alpha of the layer paint.</p>\n         *\n         * @param alpha The opacity of the view.\n         *\n         * @see #hasOverlappingRendering()\n         * @see #setLayerType(int, android.graphics.Paint)\n         *\n         * @attr ref android.R.styleable#View_alpha\n         */\n        setAlpha(alpha:number):void  {\n            this.ensureTransformationInfo();\n            if (this.mTransformationInfo.mAlpha != alpha) {\n                this.mTransformationInfo.mAlpha = alpha;\n                if (this.onSetAlpha(Math.floor((alpha * 255)))) {\n                    this.mPrivateFlags |= View.PFLAG_ALPHA_SET;\n                    // subclass is handling alpha - don't optimize rendering cache invalidation\n                    this.invalidateParentCaches();\n                    this.invalidate(true);\n                } else {\n                    this.mPrivateFlags &= ~View.PFLAG_ALPHA_SET;\n                    this.invalidateViewProperty(true, false);\n                    //if (this.mDisplayList != null) {\n                    //    this.mDisplayList.setAlpha(this.getFinalAlpha());\n                    //}\n                }\n            }\n        }\n\n        /**\n         * Faster version of setAlpha() which performs the same steps except there are\n         * no calls to invalidate(). The caller of this function should perform proper invalidation\n         * on the parent and this object. The return value indicates whether the subclass handles\n         * alpha (the return value for onSetAlpha()).\n         *\n         * @param alpha The new value for the alpha property\n         * @return true if the View subclass handles alpha (the return value for onSetAlpha()) and\n         *         the new value for the alpha property is different from the old value\n         */\n        setAlphaNoInvalidation(alpha:number):boolean  {\n            this.ensureTransformationInfo();\n            if (this.mTransformationInfo.mAlpha != alpha) {\n                this.mTransformationInfo.mAlpha = alpha;\n                let subclassHandlesAlpha:boolean = this.onSetAlpha(Math.floor((alpha * 255)));\n                if (subclassHandlesAlpha) {\n                    this.mPrivateFlags |= View.PFLAG_ALPHA_SET;\n                    return true;\n                } else {\n                    this.mPrivateFlags &= ~View.PFLAG_ALPHA_SET;\n                    //if (this.mDisplayList != null) {\n                    //    this.mDisplayList.setAlpha(this.getFinalAlpha());\n                    //}\n                }\n            }\n            return false;\n        }\n\n        /**\n         * This property is hidden and intended only for use by the Fade transition, which\n         * animates it to produce a visual translucency that does not side-effect (or get\n         * affected by) the real alpha property. This value is composited with the other\n         * alpha value (and the AlphaAnimation value, when that is present) to produce\n         * a final visual translucency result, which is what is passed into the DisplayList.\n         *\n         * @hide\n         */\n        setTransitionAlpha(alpha:number):void  {\n            this.ensureTransformationInfo();\n            if (this.mTransformationInfo.mTransitionAlpha != alpha) {\n                this.mTransformationInfo.mTransitionAlpha = alpha;\n                this.mPrivateFlags &= ~View.PFLAG_ALPHA_SET;\n                this.invalidateViewProperty(true, false);\n                //if (this.mDisplayList != null) {\n                //    this.mDisplayList.setAlpha(this.getFinalAlpha());\n                //}\n            }\n        }\n\n        /**\n         * Calculates the visual alpha of this view, which is a combination of the actual\n         * alpha value and the transitionAlpha value (if set).\n         */\n        private getFinalAlpha():number  {\n            if (this.mTransformationInfo != null) {\n                return this.mTransformationInfo.mAlpha * this.mTransformationInfo.mTransitionAlpha;\n            }\n            return 1;\n        }\n\n        /**\n         * This property is hidden and intended only for use by the Fade transition, which\n         * animates it to produce a visual translucency that does not side-effect (or get\n         * affected by) the real alpha property. This value is composited with the other\n         * alpha value (and the AlphaAnimation value, when that is present) to produce\n         * a final visual translucency result, which is what is passed into the DisplayList.\n         *\n         * @hide\n         */\n        getTransitionAlpha():number  {\n            return this.mTransformationInfo != null ? this.mTransformationInfo.mTransitionAlpha : 1;\n        }\n\n        /**\n         * Top position of this view relative to its parent.\n         *\n         * @return The top of this view, in pixels.\n         */\n        getTop():number  {\n            return this.mTop;\n        }\n\n        /**\n         * Sets the top position of this view relative to its parent. This method is meant to be called\n         * by the layout system and should not generally be called otherwise, because the property\n         * may be changed at any time by the layout.\n         *\n         * @param top The top of this view, in pixels.\n         */\n        setTop(top:number):void  {\n            if (top != this.mTop) {\n                this.updateMatrix();\n                const matrixIsIdentity:boolean = this.mTransformationInfo == null || this.mTransformationInfo.mMatrixIsIdentity;\n                if (matrixIsIdentity) {\n                    if (this.mAttachInfo != null) {\n                        let minTop:number;\n                        let yLoc:number;\n                        if (top < this.mTop) {\n                            minTop = top;\n                            yLoc = top - this.mTop;\n                        } else {\n                            minTop = this.mTop;\n                            yLoc = 0;\n                        }\n                        this.invalidate(0, yLoc, this.mRight - this.mLeft, this.mBottom - minTop);\n                    }\n                } else {\n                    // Double-invalidation is necessary to capture view's old and new areas\n                    this.invalidate(true);\n                }\n                let width:number = this.mRight - this.mLeft;\n                let oldHeight:number = this.mBottom - this.mTop;\n                this.mTop = top;\n                //if (this.mDisplayList != null) {\n                //    this.mDisplayList.setTop(this.mTop);\n                //}\n                this.sizeChange(width, this.mBottom - this.mTop, width, oldHeight);\n                if (!matrixIsIdentity) {\n                    if ((this.mPrivateFlags & View.PFLAG_PIVOT_EXPLICITLY_SET) == 0) {\n                        // A change in dimension means an auto-centered pivot point changes, too\n                        this.mTransformationInfo.mMatrixDirty = true;\n                    }\n                    // force another invalidation with the new orientation\n                    this.mPrivateFlags |= View.PFLAG_DRAWN;\n                    this.invalidate(true);\n                }\n                this.mBackgroundSizeChanged = true;\n                this.invalidateParentIfNeeded();\n                if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                    // View was rejected last time it was drawn by its parent; this may have changed\n                    this.invalidateParentIfNeeded();\n                }\n            }\n        }\n\n        /**\n         * Bottom position of this view relative to its parent.\n         *\n         * @return The bottom of this view, in pixels.\n         */\n        getBottom():number  {\n            return this.mBottom;\n        }\n\n        /**\n         * True if this view has changed since the last time being drawn.\n         *\n         * @return The dirty state of this view.\n         */\n        isDirty():boolean  {\n            return (this.mPrivateFlags & View.PFLAG_DIRTY_MASK) != 0;\n        }\n\n        /**\n         * Sets the bottom position of this view relative to its parent. This method is meant to be\n         * called by the layout system and should not generally be called otherwise, because the\n         * property may be changed at any time by the layout.\n         *\n         * @param bottom The bottom of this view, in pixels.\n         */\n        setBottom(bottom:number):void  {\n            if (bottom != this.mBottom) {\n                this.updateMatrix();\n                const matrixIsIdentity:boolean = this.mTransformationInfo == null || this.mTransformationInfo.mMatrixIsIdentity;\n                if (matrixIsIdentity) {\n                    if (this.mAttachInfo != null) {\n                        let maxBottom:number;\n                        if (bottom < this.mBottom) {\n                            maxBottom = this.mBottom;\n                        } else {\n                            maxBottom = bottom;\n                        }\n                        this.invalidate(0, 0, this.mRight - this.mLeft, maxBottom - this.mTop);\n                    }\n                } else {\n                    // Double-invalidation is necessary to capture view's old and new areas\n                    this.invalidate(true);\n                }\n                let width:number = this.mRight - this.mLeft;\n                let oldHeight:number = this.mBottom - this.mTop;\n                this.mBottom = bottom;\n                //if (this.mDisplayList != null) {\n                //    this.mDisplayList.setBottom(this.mBottom);\n                //}\n                this.sizeChange(width, this.mBottom - this.mTop, width, oldHeight);\n                if (!matrixIsIdentity) {\n                    if ((this.mPrivateFlags & View.PFLAG_PIVOT_EXPLICITLY_SET) == 0) {\n                        // A change in dimension means an auto-centered pivot point changes, too\n                        this.mTransformationInfo.mMatrixDirty = true;\n                    }\n                    // force another invalidation with the new orientation\n                    this.mPrivateFlags |= View.PFLAG_DRAWN;\n                    this.invalidate(true);\n                }\n                this.mBackgroundSizeChanged = true;\n                this.invalidateParentIfNeeded();\n                if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                    // View was rejected last time it was drawn by its parent; this may have changed\n                    this.invalidateParentIfNeeded();\n                }\n            }\n        }\n\n        /**\n         * Left position of this view relative to its parent.\n         *\n         * @return The left edge of this view, in pixels.\n         */\n        getLeft():number  {\n            return this.mLeft;\n        }\n\n        /**\n         * Sets the left position of this view relative to its parent. This method is meant to be called\n         * by the layout system and should not generally be called otherwise, because the property\n         * may be changed at any time by the layout.\n         *\n         * @param left The bottom of this view, in pixels.\n         */\n        setLeft(left:number):void  {\n            if (left != this.mLeft) {\n                this.updateMatrix();\n                const matrixIsIdentity:boolean = this.mTransformationInfo == null || this.mTransformationInfo.mMatrixIsIdentity;\n                if (matrixIsIdentity) {\n                    if (this.mAttachInfo != null) {\n                        let minLeft:number;\n                        let xLoc:number;\n                        if (left < this.mLeft) {\n                            minLeft = left;\n                            xLoc = left - this.mLeft;\n                        } else {\n                            minLeft = this.mLeft;\n                            xLoc = 0;\n                        }\n                        this.invalidate(xLoc, 0, this.mRight - minLeft, this.mBottom - this.mTop);\n                    }\n                } else {\n                    // Double-invalidation is necessary to capture view's old and new areas\n                    this.invalidate(true);\n                }\n                let oldWidth:number = this.mRight - this.mLeft;\n                let height:number = this.mBottom - this.mTop;\n                this.mLeft = left;\n                //if (this.mDisplayList != null) {\n                //    this.mDisplayList.setLeft(left);\n                //}\n                this.sizeChange(this.mRight - this.mLeft, height, oldWidth, height);\n                if (!matrixIsIdentity) {\n                    if ((this.mPrivateFlags & View.PFLAG_PIVOT_EXPLICITLY_SET) == 0) {\n                        // A change in dimension means an auto-centered pivot point changes, too\n                        this.mTransformationInfo.mMatrixDirty = true;\n                    }\n                    // force another invalidation with the new orientation\n                    this.mPrivateFlags |= View.PFLAG_DRAWN;\n                    this.invalidate(true);\n                }\n                this.mBackgroundSizeChanged = true;\n                this.invalidateParentIfNeeded();\n                if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                    // View was rejected last time it was drawn by its parent; this may have changed\n                    this.invalidateParentIfNeeded();\n                }\n            }\n        }\n\n        /**\n         * Right position of this view relative to its parent.\n         *\n         * @return The right edge of this view, in pixels.\n         */\n        getRight():number  {\n            return this.mRight;\n        }\n\n        /**\n         * Sets the right position of this view relative to its parent. This method is meant to be called\n         * by the layout system and should not generally be called otherwise, because the property\n         * may be changed at any time by the layout.\n         *\n         * @param right The bottom of this view, in pixels.\n         */\n        setRight(right:number):void  {\n            if (right != this.mRight) {\n                this.updateMatrix();\n                const matrixIsIdentity:boolean = this.mTransformationInfo == null || this.mTransformationInfo.mMatrixIsIdentity;\n                if (matrixIsIdentity) {\n                    if (this.mAttachInfo != null) {\n                        let maxRight:number;\n                        if (right < this.mRight) {\n                            maxRight = this.mRight;\n                        } else {\n                            maxRight = right;\n                        }\n                        this.invalidate(0, 0, maxRight - this.mLeft, this.mBottom - this.mTop);\n                    }\n                } else {\n                    // Double-invalidation is necessary to capture view's old and new areas\n                    this.invalidate(true);\n                }\n                let oldWidth:number = this.mRight - this.mLeft;\n                let height:number = this.mBottom - this.mTop;\n                this.mRight = right;\n                //if (this.mDisplayList != null) {\n                //    this.mDisplayList.setRight(this.mRight);\n                //}\n                this.sizeChange(this.mRight - this.mLeft, height, oldWidth, height);\n                if (!matrixIsIdentity) {\n                    if ((this.mPrivateFlags & View.PFLAG_PIVOT_EXPLICITLY_SET) == 0) {\n                        // A change in dimension means an auto-centered pivot point changes, too\n                        this.mTransformationInfo.mMatrixDirty = true;\n                    }\n                    // force another invalidation with the new orientation\n                    this.mPrivateFlags |= View.PFLAG_DRAWN;\n                    this.invalidate(true);\n                }\n                this.mBackgroundSizeChanged = true;\n                this.invalidateParentIfNeeded();\n                if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                    // View was rejected last time it was drawn by its parent; this may have changed\n                    this.invalidateParentIfNeeded();\n                }\n            }\n        }\n\n        /**\n         * The visual x position of this view, in pixels. This is equivalent to the\n         * {@link #setTranslationX(float) translationX} property plus the current\n         * {@link #getLeft() left} property.\n         *\n         * @return The visual x position of this view, in pixels.\n         */\n        getX():number  {\n            return this.mLeft + (this.mTransformationInfo != null ? this.mTransformationInfo.mTranslationX : 0);\n        }\n\n        /**\n         * Sets the visual x position of this view, in pixels. This is equivalent to setting the\n         * {@link #setTranslationX(float) translationX} property to be the difference between\n         * the x value passed in and the current {@link #getLeft() left} property.\n         *\n         * @param x The visual x position of this view, in pixels.\n         */\n        setX(x:number):void  {\n            this.setTranslationX(x - this.mLeft);\n        }\n\n        /**\n         * The visual y position of this view, in pixels. This is equivalent to the\n         * {@link #setTranslationY(float) translationY} property plus the current\n         * {@link #getTop() top} property.\n         *\n         * @return The visual y position of this view, in pixels.\n         */\n        getY():number  {\n            return this.mTop + (this.mTransformationInfo != null ? this.mTransformationInfo.mTranslationY : 0);\n        }\n\n        /**\n         * Sets the visual y position of this view, in pixels. This is equivalent to setting the\n         * {@link #setTranslationY(float) translationY} property to be the difference between\n         * the y value passed in and the current {@link #getTop() top} property.\n         *\n         * @param y The visual y position of this view, in pixels.\n         */\n        setY(y:number):void  {\n            this.setTranslationY(y - this.mTop);\n        }\n\n        /**\n         * The horizontal location of this view relative to its {@link #getLeft() left} position.\n         * This position is post-layout, in addition to wherever the object's\n         * layout placed it.\n         *\n         * @return The horizontal position of this view relative to its left position, in pixels.\n         */\n        getTranslationX():number  {\n            return this.mTransformationInfo != null ? this.mTransformationInfo.mTranslationX : 0;\n        }\n\n        /**\n         * Sets the horizontal location of this view relative to its {@link #getLeft() left} position.\n         * This effectively positions the object post-layout, in addition to wherever the object's\n         * layout placed it.\n         *\n         * @param translationX The horizontal position of this view relative to its left position,\n         * in pixels.\n         *\n         * @attr ref android.R.styleable#View_translationX\n         */\n        setTranslationX(translationX:number):void  {\n            this.ensureTransformationInfo();\n            const info:View.TransformationInfo = this.mTransformationInfo;\n            if (info.mTranslationX != translationX) {\n                // Double-invalidation is necessary to capture view's old and new areas\n                this.invalidateViewProperty(true, false);\n                info.mTranslationX = translationX;\n                info.mMatrixDirty = true;\n                this.invalidateViewProperty(false, true);\n                //if (this.mDisplayList != null) {\n                //    this.mDisplayList.setTranslationX(translationX);\n                //}\n                if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                    // View was rejected last time it was drawn by its parent; this may have changed\n                    this.invalidateParentIfNeeded();\n                }\n            }\n        }\n\n        /**\n         * The horizontal location of this view relative to its {@link #getTop() top} position.\n         * This position is post-layout, in addition to wherever the object's\n         * layout placed it.\n         *\n         * @return The vertical position of this view relative to its top position,\n         * in pixels.\n         */\n        getTranslationY():number  {\n            return this.mTransformationInfo != null ? this.mTransformationInfo.mTranslationY : 0;\n        }\n\n        /**\n         * Sets the vertical location of this view relative to its {@link #getTop() top} position.\n         * This effectively positions the object post-layout, in addition to wherever the object's\n         * layout placed it.\n         *\n         * @param translationY The vertical position of this view relative to its top position,\n         * in pixels.\n         *\n         * @attr ref android.R.styleable#View_translationY\n         */\n        setTranslationY(translationY:number):void  {\n            this.ensureTransformationInfo();\n            const info:View.TransformationInfo = this.mTransformationInfo;\n            if (info.mTranslationY != translationY) {\n                this.invalidateViewProperty(true, false);\n                info.mTranslationY = translationY;\n                info.mMatrixDirty = true;\n                this.invalidateViewProperty(false, true);\n                //if (this.mDisplayList != null) {\n                //    this.mDisplayList.setTranslationY(translationY);\n                //}\n                if ((this.mPrivateFlags2 & View.PFLAG2_VIEW_QUICK_REJECTED) == View.PFLAG2_VIEW_QUICK_REJECTED) {\n                    // View was rejected last time it was drawn by its parent; this may have changed\n                    this.invalidateParentIfNeeded();\n                }\n            }\n        }\n\n        transformRect(rect:Rect){\n            if (!this.getMatrix().isIdentity()) {\n                let boundingRect = this.mAttachInfo.mTmpTransformRect;\n                boundingRect.set(rect);\n                this.getMatrix().mapRect(boundingRect);\n                rect.set(boundingRect);\n            }\n        }\n\n        pointInView(localX:number, localY:number, slop=0):boolean {\n            return localX >= -slop && localY >= -slop && localX < ((this.mRight - this.mLeft) + slop) &&\n            localY < ((this.mBottom - this.mTop) + slop);\n        }\n\n        getHandler():Handler {\n            let attachInfo = this.mAttachInfo;\n            if (attachInfo != null) {\n                return attachInfo.mHandler;\n            }\n            return null;\n        }\n        getViewRootImpl():ViewRootImpl{\n            if (this.mAttachInfo != null) {\n                return this.mAttachInfo.mViewRootImpl;\n            }\n            if(this.mContext!=null){\n                return this.mContext.androidUI._viewRootImpl;\n            }\n            return null;\n        }\n        post(action:Runnable):boolean {\n            let attachInfo = this.mAttachInfo;\n            if (attachInfo != null) {\n                return attachInfo.mHandler.post(action);\n            }\n            // Assume that post will succeed later\n            ViewRootImpl.getRunQueue().post(action);\n            return true;\n        }\n        postDelayed(action:Runnable, delayMillis:number):boolean {\n            let attachInfo = this.mAttachInfo;\n            if (attachInfo != null) {\n                return attachInfo.mHandler.postDelayed(action, delayMillis);\n            }\n            // Assume that post will succeed later\n            ViewRootImpl.getRunQueue().postDelayed(action, delayMillis);\n            return true;\n        }\n        postOnAnimation(action:Runnable):boolean {\n            return this.post(action);\n        }\n        postOnAnimationDelayed(action:Runnable, delayMillis:number):boolean {\n            return this.postDelayed(action, delayMillis);\n        }\n        removeCallbacks(action:Runnable):boolean {\n            if (action != null) {\n                let attachInfo = this.mAttachInfo;\n                if (attachInfo != null) {\n                    attachInfo.mHandler.removeCallbacks(action);\n                } else {\n                    // Assume that post will succeed later\n                    ViewRootImpl.getRunQueue().removeCallbacks(action);\n                }\n            }\n            return true;\n        }\n        getParent():ViewParent {\n            return this.mParent;\n        }\n        setFlags(flags:number , mask:number){\n            let old = this.mViewFlags;\n            this.mViewFlags = (this.mViewFlags & ~mask) | (flags & mask);\n\n            let changed = this.mViewFlags ^ old;\n            if (changed == 0) {\n                return;\n            }\n            let privateFlags = this.mPrivateFlags;\n\n            if (((changed & View.FOCUSABLE_MASK) != 0) &&\n                ((privateFlags & View.PFLAG_HAS_BOUNDS) !=0)) {\n                if (((old & View.FOCUSABLE_MASK) == View.FOCUSABLE)\n                    && ((privateFlags & View.PFLAG_FOCUSED) != 0)) {\n                    /* Give up focus if we are no longer focusable */\n                    this.clearFocus();\n                } else if (((old & View.FOCUSABLE_MASK) == View.NOT_FOCUSABLE)\n                    && ((privateFlags & View.PFLAG_FOCUSED) == 0)) {\n                    /*\n                     * Tell the view system that we are now available to take focus\n                     * if no one else already has it.\n                     */\n                    if (this.mParent != null) this.mParent.focusableViewAvailable(this);\n                }\n            }\n\n            const newVisibility = flags & View.VISIBILITY_MASK;\n            if (newVisibility == View.VISIBLE) {\n                if ((changed & View.VISIBILITY_MASK) != 0) {\n                    /*\n                     * If this view is becoming visible, invalidate it in case it changed while\n                     * it was not visible. Marking it drawn ensures that the invalidation will\n                     * go through.\n                     */\n                    this.mPrivateFlags |= View.PFLAG_DRAWN;\n                    this.invalidate(true);\n\n                    //needGlobalAttributesUpdate(true);\n\n                    // a view becoming visible is worth notifying the parent\n                    // about in case nothing has focus.  even if this specific view\n                    // isn't focusable, it may contain something that is, so let\n                    // the root view try to give this focus if nothing else does.\n                    if ((this.mParent != null) && (this.mBottom > this.mTop) && (this.mRight > this.mLeft)) {\n                        this.mParent.focusableViewAvailable(this);\n                    }\n                }\n            }\n\n            /* Check if the GONE bit has changed */\n            if ((changed & View.GONE) != 0) {\n                //needGlobalAttributesUpdate(false);\n                this.requestLayout();\n\n                if (((this.mViewFlags & View.VISIBILITY_MASK) == View.GONE)) {\n                    if (this.hasFocus()) this.clearFocus();\n                    this.destroyDrawingCache();\n                    if (this.mParent instanceof View) {\n                        // GONE views noop invalidation, so invalidate the parent\n                        (<any> this.mParent).invalidate(true);\n                    }\n                    // Mark the view drawn to ensure that it gets invalidated properly the next\n                    // time it is visible and gets invalidated\n                    this.mPrivateFlags |= View.PFLAG_DRAWN;\n                }\n                //if (this.mAttachInfo != null) {\n                //    this.mAttachInfo.mViewVisibilityChanged = true;\n                //}\n            }\n\n\n            /* Check if the VISIBLE bit has changed */\n            if ((changed & View.INVISIBLE) != 0) {\n                //needGlobalAttributesUpdate(false);\n                /*\n                 * If this view is becoming invisible, set the DRAWN flag so that\n                 * the next invalidate() will not be skipped.\n                 */\n                this.mPrivateFlags |= View.PFLAG_DRAWN;\n\n                if (((this.mViewFlags & View.VISIBILITY_MASK) == View.INVISIBLE)) {\n                    // root view becoming invisible shouldn't clear focus and accessibility focus\n                    if (this.getRootView() != this) {\n                        if (this.hasFocus()) this.clearFocus();\n                    }\n                }\n                //if (this.mAttachInfo != null) {\n                //    this.mAttachInfo.mViewVisibilityChanged = true;\n                //}\n            }\n            if ((changed & View.VISIBILITY_MASK) != 0) {\n                // If the view is invisible, cleanup its display list to free up resources\n                if (newVisibility != View.VISIBLE) {\n                    this.cleanupDraw();\n                }\n\n                if (this.mParent instanceof ViewGroup) {\n                    (<any>this.mParent).onChildVisibilityChanged(this, (changed & View.VISIBILITY_MASK), newVisibility);\n                    (<any>this.mParent).invalidate(true);\n                } else if (this.mParent != null) {\n                    this.mParent.invalidateChild(this, null);\n                }\n                this.dispatchVisibilityChanged(this, newVisibility);\n                this.syncVisibleToElement();\n            }\n\n            if ((changed & View.WILL_NOT_CACHE_DRAWING) != 0) {\n                this.destroyDrawingCache();\n            }\n\n\n            if ((changed & View.DRAWING_CACHE_ENABLED) != 0) {\n                this.destroyDrawingCache();\n                this.mPrivateFlags &= ~View.PFLAG_DRAWING_CACHE_VALID;\n                this.invalidateParentCaches();\n            }\n\n            //if ((changed & DRAWING_CACHE_QUALITY_MASK) != 0) {\n            //    destroyDrawingCache();\n            //    mPrivateFlags &= ~PFLAG_DRAWING_CACHE_VALID;\n            //}\n\n\n            if ((changed & View.DRAW_MASK) != 0) {\n                if ((this.mViewFlags & View.WILL_NOT_DRAW) != 0) {\n                    if (this.mBackground != null) {\n                        this.mPrivateFlags &= ~View.PFLAG_SKIP_DRAW;\n                        this.mPrivateFlags |= View.PFLAG_ONLY_DRAWS_BACKGROUND;\n                    } else {\n                        this.mPrivateFlags |= View.PFLAG_SKIP_DRAW;\n                    }\n                } else {\n                    this.mPrivateFlags &= ~View.PFLAG_SKIP_DRAW;\n                }\n                this.requestLayout();\n                this.invalidate(true);\n            }\n\n\n        }\n        bringToFront() {\n            if (this.mParent != null) {\n                this.mParent.bringChildToFront(this);\n            }\n        }\n        onScrollChanged(l:number, t:number, oldl:number, oldt:number) {\n            this.mBackgroundSizeChanged = true;\n\n            let rootImpl = this.getViewRootImpl();\n            if (rootImpl != null) {\n                rootImpl.mViewScrollChanged = true;\n            }\n        }\n        protected onSizeChanged(w:number, h:number, oldw:number, oldh:number):void {\n\n        }\n\n        /**\n         * Find and return all touchable views that are descendants of this view,\n         * possibly including this view if it is touchable itself.\n         *\n         * @return A list of touchable views\n         */\n        getTouchables():ArrayList<View> {\n            let result = new ArrayList<View>();\n            this.addTouchables(result);\n            return result;\n        }\n\n        /**\n         * Add any touchable views that are descendants of this view (possibly\n         * including this view if it is touchable itself) to views.\n         *\n         * @param views Touchable views found so far\n         */\n        addTouchables(views:ArrayList<View>):void {\n            const viewFlags = this.mViewFlags;\n\n            if (((viewFlags & View.CLICKABLE) == View.CLICKABLE || (viewFlags & View.LONG_CLICKABLE) == View.LONG_CLICKABLE)\n                && (viewFlags & View.ENABLED_MASK) == View.ENABLED) {\n                views.add(this);\n            }\n        }\n\n        /**\n         * Request that a rectangle of this view be visible on the screen,\n         * scrolling if necessary just enough.\n         *\n         * <p>A View should call this if it maintains some notion of which part\n         * of its content is interesting.  For example, a text editing view\n         * should call this when its cursor moves.\n         *\n         * <p>When <code>immediate</code> is set to true, scrolling will not be\n         * animated.\n         *\n         * @param rectangle The rectangle.\n         * @param immediate True to forbid animated scrolling, false otherwise\n         * @return Whether any parent scrolled.\n         */\n        requestRectangleOnScreen(rectangle:Rect, immediate=false):boolean  {\n            if (this.mParent == null) {\n                return false;\n            }\n            let child:View = this;\n            let position:RectF = (this.mAttachInfo != null) ? this.mAttachInfo.mTmpTransformRect : new RectF();\n            position.set(rectangle);\n            let parent:ViewParent = this.mParent;\n            let scrolled:boolean = false;\n            while (parent != null) {\n                rectangle.set(Math.floor(position.left), Math.floor(position.top), Math.floor(position.right), Math.floor(position.bottom));\n                scrolled = parent.requestChildRectangleOnScreen(child, rectangle, immediate) || scrolled;\n                if (!child.hasIdentityMatrix()) {\n                    child.getMatrix().mapRect(position);\n                }\n                position.offset(child.mLeft, child.mTop);\n                if (!(parent instanceof View)) {\n                    break;\n                }\n                let parentView:View = <View><any>parent;\n                position.offset(-parentView.getScrollX(), -parentView.getScrollY());\n                child = parentView;\n                parent = child.getParent();\n            }\n            return scrolled;\n        }\n        onFocusLost() {\n            this.resetPressedState();\n        }\n        resetPressedState() {\n            if ((this.mViewFlags & View.ENABLED_MASK) == View.DISABLED) {\n                return;\n            }\n\n            if (this.isPressed()) {\n                this.setPressed(false);\n\n                if (!this.mHasPerformedLongPress) {\n                    this.removeLongPressCallback();\n                }\n            }\n        }\n        isFocused():boolean {\n            return (this.mPrivateFlags & View.PFLAG_FOCUSED) != 0;\n        }\n        findFocus():View {\n            return (this.mPrivateFlags & View.PFLAG_FOCUSED) != 0 ? this : null;\n        }\n        getNextFocusLeftId():string {\n            return this.mNextFocusLeftId;\n        }\n        setNextFocusLeftId(nextFocusLeftId:string) {\n            this.mNextFocusLeftId = nextFocusLeftId;\n        }\n        getNextFocusRightId():string {\n            return this.mNextFocusRightId;\n        }\n        setNextFocusRightId(nextFocusRightId:string) {\n            this.mNextFocusRightId = nextFocusRightId;\n        }\n        getNextFocusUpId():string {\n            return this.mNextFocusUpId;\n        }\n        setNextFocusUpId(nextFocusUpId:string) {\n            this.mNextFocusUpId = nextFocusUpId;\n        }\n        getNextFocusDownId():string {\n            return this.mNextFocusDownId;\n        }\n        setNextFocusDownId(nextFocusDownId:string) {\n            this.mNextFocusDownId = nextFocusDownId;\n        }\n        getNextFocusForwardId():string {\n            return this.mNextFocusForwardId;\n        }\n        setNextFocusForwardId(nextFocusForwardId:string) {\n            this.mNextFocusForwardId = nextFocusForwardId;\n        }\n        setFocusable(focusable:boolean) {\n            if (!focusable) {\n                this.setFlags(0, View.FOCUSABLE_IN_TOUCH_MODE);\n            }\n            this.setFlags(focusable ? View.FOCUSABLE : View.NOT_FOCUSABLE, View.FOCUSABLE_MASK);\n        }\n        isFocusable():boolean {\n            return View.FOCUSABLE == (this.mViewFlags & View.FOCUSABLE_MASK);\n        }\n        setFocusableInTouchMode(focusableInTouchMode:boolean) {\n            // Focusable in touch mode should always be set before the focusable flag\n            // otherwise, setting the focusable flag will trigger a focusableViewAvailable()\n            // which, in touch mode, will not successfully request focus on this view\n            // because the focusable in touch mode flag is not set\n            this.setFlags(focusableInTouchMode ? View.FOCUSABLE_IN_TOUCH_MODE : 0, View.FOCUSABLE_IN_TOUCH_MODE);\n            if (focusableInTouchMode) {\n                this.setFlags(View.FOCUSABLE, View.FOCUSABLE_MASK);\n            }\n        }\n        isFocusableInTouchMode():boolean {\n            return View.FOCUSABLE_IN_TOUCH_MODE == (this.mViewFlags & View.FOCUSABLE_IN_TOUCH_MODE);\n        }\n        hasFocusable():boolean {\n            return (this.mViewFlags & View.VISIBILITY_MASK) == View.VISIBLE && this.isFocusable();\n        }\n        clearFocus() {\n            if (View.DBG) {\n                System.out.println(this + \" clearFocus()\");\n            }\n            this.clearFocusInternal(true, true);\n        }\n        clearFocusInternal(propagate:boolean, refocus:boolean) {\n            if ((this.mPrivateFlags & View.PFLAG_FOCUSED) != 0) {\n                this.mPrivateFlags &= ~View.PFLAG_FOCUSED;\n\n                if (propagate && this.mParent != null) {\n                    this.mParent.clearChildFocus(this);\n                }\n\n                this.onFocusChanged(false, 0, null);\n\n                this.refreshDrawableState();\n\n                if (propagate && (!refocus || !this.rootViewRequestFocus())) {\n                    this.notifyGlobalFocusCleared(this);\n                }\n            }\n        }\n        notifyGlobalFocusCleared(oldFocus:View) {\n            //if (oldFocus != null && this.mAttachInfo != null) {\n            //    this.mAttachInfo.mTreeObserver.dispatchOnGlobalFocusChange(oldFocus, null);\n            //}\n        }\n        rootViewRequestFocus() {\n            const root = this.getRootView();\n            return root != null && root.requestFocus();\n        }\n        unFocus() {\n            if (View.DBG) {\n                System.out.println(this + \" unFocus()\");\n            }\n            this.clearFocusInternal(false, false);\n        }\n        hasFocus():boolean{\n            return (this.mPrivateFlags & View.PFLAG_FOCUSED) != 0;\n        }\n        protected onFocusChanged(gainFocus:boolean, direction:number, previouslyFocusedRect:Rect) {\n            if (!gainFocus) {\n                if (this.isPressed()) {\n                    this.setPressed(false);\n                }\n                this.onFocusLost();\n            }\n            this.invalidate(true);\n            let li = this.mListenerInfo;\n            if (li != null && li.mOnFocusChangeListener != null) {\n                li.mOnFocusChangeListener.onFocusChange(this, gainFocus);\n            }\n\n            if (this.mAttachInfo != null) {\n                this.mAttachInfo.mKeyDispatchState.reset(this);\n            }\n        }\n\n        focusSearch(direction:number):View {\n            if (this.mParent != null) {\n                return this.mParent.focusSearch(this, direction);\n            } else {\n                return null;\n            }\n        }\n        dispatchUnhandledMove(focused:View, direction:number):boolean {\n            return false;\n        }\n        findUserSetNextFocus(root:View, direction:number):View {\n            switch (direction) {\n                case View.FOCUS_LEFT:\n                    if (!this.mNextFocusLeftId) return null;\n                    return this.findViewInsideOutShouldExist(root, this.mNextFocusLeftId);\n                case View.FOCUS_RIGHT:\n                    if (!this.mNextFocusRightId) return null;\n                    return this.findViewInsideOutShouldExist(root, this.mNextFocusRightId);\n                case View.FOCUS_UP:\n                    if (!this.mNextFocusUpId) return null;\n                    return this.findViewInsideOutShouldExist(root, this.mNextFocusUpId);\n                case View.FOCUS_DOWN:\n                    if (!this.mNextFocusDownId) return null;\n                    return this.findViewInsideOutShouldExist(root, this.mNextFocusDownId);\n                case View.FOCUS_FORWARD:\n                    if (!this.mNextFocusForwardId) return null;\n                    return this.findViewInsideOutShouldExist(root, this.mNextFocusForwardId);\n                case View.FOCUS_BACKWARD: {\n                    if (!this.mID) return null;\n                    let id = this.mID;\n                    return root.findViewByPredicateInsideOut(this, {\n                        apply(t:View):boolean {\n                            return t.mNextFocusForwardId == id;\n                        }\n                    });\n                }\n            }\n            return null;\n        }\n        private findViewInsideOutShouldExist(root:View, id:string):View {\n            if (this.mMatchIdPredicate == null) {\n                this.mMatchIdPredicate = new MatchIdPredicate();\n            }\n            this.mMatchIdPredicate.mId = id;\n            let result = root.findViewByPredicateInsideOut(this, this.mMatchIdPredicate);\n            if (result == null) {\n                Log.w(View.VIEW_LOG_TAG, \"couldn't find view with id \" + id);\n            }\n            return result;\n        }\n\n        getFocusables(direction:number):ArrayList<View> {\n            let result = new ArrayList<View>(24);\n            this.addFocusables(result, direction);\n            return result;\n        }\n        addFocusables(views:ArrayList<View>, direction:number, focusableMode=View.FOCUSABLES_TOUCH_MODE):void {\n            if (views == null) {\n                return;\n            }\n            if (!this.isFocusable()) {\n                return;\n            }\n            if ((focusableMode & View.FOCUSABLES_TOUCH_MODE) == View.FOCUSABLES_TOUCH_MODE\n                && this.isInTouchMode() && !this.isFocusableInTouchMode()) {\n                return;\n            }\n            views.add(this);\n        }\n        setOnFocusChangeListener(l:View.OnFocusChangeListener|((v:View, hasFocus:boolean)=>void)) {\n            if(typeof l == \"function\"){\n                l = View.OnFocusChangeListener.fromFunction(<(v:View, hasFocus:boolean)=>void>l);\n            }\n            this.getListenerInfo().mOnFocusChangeListener = <View.OnFocusChangeListener>l;\n        }\n        getOnFocusChangeListener():View.OnFocusChangeListener {\n            let li = this.mListenerInfo;\n            return li != null ? li.mOnFocusChangeListener : null;\n        }\n\n\n        requestFocus(direction=View.FOCUS_DOWN, previouslyFocusedRect=null):boolean{\n            return this.requestFocusNoSearch(direction, previouslyFocusedRect);\n        }\n\n        private requestFocusNoSearch(direction:number, previouslyFocusedRect:Rect):boolean {\n            // need to be focusable\n            if ((this.mViewFlags & View.FOCUSABLE_MASK) != View.FOCUSABLE ||\n                (this.mViewFlags & View.VISIBILITY_MASK) != View.VISIBLE) {\n                return false;\n            }\n\n            // need to be focusable in touch mode if in touch mode\n            if (this.isInTouchMode() &&\n                (View.FOCUSABLE_IN_TOUCH_MODE != (this.mViewFlags & View.FOCUSABLE_IN_TOUCH_MODE))) {\n                return false;\n            }\n\n            // need to not have any parents blocking us\n            if (this.hasAncestorThatBlocksDescendantFocus()) {\n                return false;\n            }\n\n            this.handleFocusGainInternal(direction, previouslyFocusedRect);\n            return true;\n        }\n        requestFocusFromTouch():boolean {\n            // Leave touch mode if we need to\n            if (this.isInTouchMode()) {\n                let viewRoot = this.getViewRootImpl();\n                if (viewRoot != null) {\n                    viewRoot.ensureTouchMode(false);\n                }\n            }\n            return this.requestFocus(View.FOCUS_DOWN);\n        }\n        private hasAncestorThatBlocksDescendantFocus():boolean {\n            let ancestor = this.mParent;\n            while (ancestor instanceof ViewGroup) {\n                const vgAncestor = <ViewGroup>ancestor;\n                if (vgAncestor.getDescendantFocusability() == ViewGroup.FOCUS_BLOCK_DESCENDANTS) {\n                    return true;\n                } else {\n                    ancestor = vgAncestor.getParent();\n                }\n            }\n            return false;\n        }\n        handleFocusGainInternal(direction:number, previouslyFocusedRect:Rect) {\n            if (View.DBG) {\n                System.out.println(this + \" requestFocus()\");\n            }\n\n            if ((this.mPrivateFlags & View.PFLAG_FOCUSED) == 0) {\n                this.mPrivateFlags |= View.PFLAG_FOCUSED;\n\n                let oldFocus = (this.mAttachInfo != null) ? this.getRootView().findFocus() : null;\n\n                if (this.mParent != null) {\n                    this.mParent.requestChildFocus(this, this);\n                }\n\n                //if (this.mAttachInfo != null) {\n                //    this.mAttachInfo.mTreeObserver.dispatchOnGlobalFocusChange(oldFocus, this);\n                //}\n\n                this.onFocusChanged(true, direction, previouslyFocusedRect);\n                this.refreshDrawableState();\n            }\n        }\n        hasTransientState():boolean {\n            return (this.mPrivateFlags2 & View.PFLAG2_HAS_TRANSIENT_STATE) == View.PFLAG2_HAS_TRANSIENT_STATE;\n        }\n        setHasTransientState(hasTransientState:boolean) {\n            this.mTransientStateCount = hasTransientState ? this.mTransientStateCount + 1 :\n            this.mTransientStateCount - 1;\n            if (this.mTransientStateCount < 0) {\n                this.mTransientStateCount = 0;\n                Log.e(View.VIEW_LOG_TAG, \"hasTransientState decremented below 0: \" +\n                    \"unmatched pair of setHasTransientState calls\");\n            } else if ((hasTransientState && this.mTransientStateCount == 1) ||\n                (!hasTransientState && this.mTransientStateCount == 0)) {\n                // update flag if we've just incremented up from 0 or decremented down to 0\n                this.mPrivateFlags2 = (this.mPrivateFlags2 & ~View.PFLAG2_HAS_TRANSIENT_STATE) |\n                    (hasTransientState ? View.PFLAG2_HAS_TRANSIENT_STATE : 0);\n                if (this.mParent != null) {\n                    this.mParent.childHasTransientStateChanged(this, hasTransientState);\n                }\n            }\n        }\n\n        /**\n         * Indicates whether this view is one of the set of scrollable containers in\n         * its window.\n         *\n         * @return whether this view is one of the set of scrollable containers in\n         * its window\n         *\n         * @attr ref android.R.styleable#View_isScrollContainer\n         */\n        isScrollContainer():boolean  {\n            return (this.mPrivateFlags & View.PFLAG_SCROLL_CONTAINER_ADDED) != 0;\n        }\n\n        /**\n         * Change whether this view is one of the set of scrollable containers in\n         * its window.  This will be used to determine whether the window can\n         * resize or must pan when a soft input area is open -- scrollable\n         * containers allow the window to use resize mode since the container\n         * will appropriately shrink.\n         *\n         * @attr ref android.R.styleable#View_isScrollContainer\n         */\n        setScrollContainer(isScrollContainer:boolean):void  {\n            if (isScrollContainer) {\n                if (this.mAttachInfo != null && (this.mPrivateFlags & View.PFLAG_SCROLL_CONTAINER_ADDED) == 0) {\n                    this.mAttachInfo.mScrollContainers.add(this);\n                    this.mPrivateFlags |= View.PFLAG_SCROLL_CONTAINER_ADDED;\n                }\n                this.mPrivateFlags |= View.PFLAG_SCROLL_CONTAINER;\n            } else {\n                if ((this.mPrivateFlags & View.PFLAG_SCROLL_CONTAINER_ADDED) != 0) {\n                    this.mAttachInfo.mScrollContainers.delete(this);\n                }\n                this.mPrivateFlags &= ~(View.PFLAG_SCROLL_CONTAINER | View.PFLAG_SCROLL_CONTAINER_ADDED);\n            }\n        }\n\n\n        isInTouchMode():boolean{\n            if (this.getViewRootImpl() != null) {\n                return this.getViewRootImpl().mInTouchMode;\n            } else {\n                return false;\n            }\n        }\n\n        isShown():boolean {\n            let current:View = this;\n            //noinspection ConstantConditions\n            do {\n                if ((current.mViewFlags & View.VISIBILITY_MASK) != View.VISIBLE) {\n                    return false;\n                }\n                let parent = current.mParent;\n                if (parent == null) {\n                    return false; // We are not attached to the view root\n                }\n                if (!(parent instanceof View)) {\n                    return true;\n                }\n                current = <View><any>parent;\n            } while (current != null);\n\n            return false;\n        }\n        getVisibility():number {\n            return this.mViewFlags & View.VISIBILITY_MASK;\n        }\n        setVisibility(visibility:number) {\n            this.setFlags(visibility, View.VISIBILITY_MASK);\n            if (this.mBackground != null) this.mBackground.setVisible(visibility == View.VISIBLE, false);\n        }\n        dispatchVisibilityChanged(changedView:View, visibility:number) {\n            this.onVisibilityChanged(changedView, visibility);\n        }\n        protected onVisibilityChanged(changedView:View, visibility:number):void {\n            if (visibility == View.VISIBLE) {\n                if (this.mAttachInfo != null) {\n                    this.initialAwakenScrollBars();\n                } else {\n                    this.mPrivateFlags |= View.PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH;\n                }\n            }\n        }\n\n        /**\n         * Dispatch a hint about whether this view is displayed. For instance, when\n         * a View moves out of the screen, it might receives a display hint indicating\n         * the view is not displayed. Applications should not <em>rely</em> on this hint\n         * as there is no guarantee that they will receive one.\n         *\n         * @param hint A hint about whether or not this view is displayed:\n         * {@link #VISIBLE} or {@link #INVISIBLE}.\n         */\n        dispatchDisplayHint(hint:number):void  {\n            this.onDisplayHint(hint);\n        }\n\n        /**\n         * Gives this view a hint about whether is displayed or not. For instance, when\n         * a View moves out of the screen, it might receives a display hint indicating\n         * the view is not displayed. Applications should not <em>rely</em> on this hint\n         * as there is no guarantee that they will receive one.\n         *\n         * @param hint A hint about whether or not this view is displayed:\n         * {@link #VISIBLE} or {@link #INVISIBLE}.\n         */\n        onDisplayHint(hint:number):void  {\n        }\n        dispatchWindowVisibilityChanged(visibility:number) {\n            this.onWindowVisibilityChanged(visibility);\n        }\n        onWindowVisibilityChanged(visibility:number) {\n            if (visibility == View.VISIBLE) {\n                this.initialAwakenScrollBars();\n            }\n        }\n        getWindowVisibility() {\n            return this.mAttachInfo != null ? this.mAttachInfo.mWindowVisibility : View.GONE;\n        }\n\n        isEnabled():boolean {\n            return (this.mViewFlags & View.ENABLED_MASK) == View.ENABLED;\n        }\n        setEnabled(enabled:boolean) {\n            if (enabled == this.isEnabled()) return;\n\n            this.setFlags(enabled ? View.ENABLED : View.DISABLED, View.ENABLED_MASK);\n\n            /*\n             * The View most likely has to change its appearance, so refresh\n             * the drawable state.\n             */\n            this.refreshDrawableState();\n\n            // Invalidate too, since the default behavior for views is to be\n            // be drawn at 50% alpha rather than to change the drawable.\n            this.invalidate(true);\n\n            //if (!enabled) {\n            //    cancelPendingInputEvents();\n            //}\n        }\n\n        dispatchGenericMotionEvent(event:MotionEvent):boolean{\n            if (event.isPointerEvent()) {\n                const action = event.getAction();\n                if (action == MotionEvent.ACTION_HOVER_ENTER\n                    || action == MotionEvent.ACTION_HOVER_MOVE\n                    || action == MotionEvent.ACTION_HOVER_EXIT) {\n                    //if (dispatchHoverEvent(event)) {//TODO when hover impl\n                    //    return true;\n                    //}\n                } else if (this.dispatchGenericPointerEvent(event)) {\n                    return true;\n                }\n            }\n            //else if (dispatchGenericFocusedEvent(event)) {\n            //    return true;\n            //}\n\n            if (this.dispatchGenericMotionEventInternal(event)) {\n                return true;\n            }\n            return false;\n        }\n        private dispatchGenericMotionEventInternal(event:MotionEvent):boolean {\n            //noinspection SimplifiableIfStatement\n            let li = this.mListenerInfo;\n            if (li != null && li.mOnGenericMotionListener != null\n                && (this.mViewFlags & View.ENABLED_MASK) == View.ENABLED\n                && li.mOnGenericMotionListener.onGenericMotion(this, event)) {\n                return true;\n            }\n\n            if (this.onGenericMotionEvent(event)) {\n                return true;\n            }\n\n            return false;\n        }\n\n        onGenericMotionEvent(event:MotionEvent):boolean {\n            return false;\n        }\n        dispatchGenericPointerEvent(event:MotionEvent):boolean{\n            return false;\n        }\n\n        dispatchKeyEvent(event:KeyEvent):boolean {\n\n            // Give any attached key listener a first crack at the event.\n            //noinspection SimplifiableIfStatement\n            let li = this.mListenerInfo;\n            if (li != null && li.mOnKeyListener != null && (this.mViewFlags & View.ENABLED_MASK) == View.ENABLED\n                && li.mOnKeyListener.onKey(this, event.getKeyCode(), event)) {\n                return true;\n            }\n\n            if (event.dispatch(this, this.mAttachInfo != null\n                    ? this.mAttachInfo.mKeyDispatchState : null, this)) {\n                return true;\n            }\n\n            return false;\n        }\n        setOnKeyListener(l:View.OnKeyListener|((v:View, keyCode:number, event:KeyEvent)=>void)) {\n            if(typeof l == \"function\"){\n                l = View.OnKeyListener.fromFunction(<(v:View, keyCode:number, event:KeyEvent)=>void>l);\n            }\n            this.getListenerInfo().mOnKeyListener = <View.OnKeyListener>l;\n        }\n        getKeyDispatcherState():KeyEvent.DispatcherState {\n            return this.mAttachInfo != null ? this.mAttachInfo.mKeyDispatchState : null;\n        }\n\n        onKeyDown(keyCode:number, event:android.view.KeyEvent):boolean {\n            let result = false;\n\n            if (KeyEvent.isConfirmKey(keyCode)) {\n                if ((this.mViewFlags & View.ENABLED_MASK) == View.DISABLED) {\n                    return true;\n                }\n                // Long clickable items don't necessarily have to be clickable\n                if (((this.mViewFlags & View.CLICKABLE) == View.CLICKABLE ||\n                    (this.mViewFlags & View.LONG_CLICKABLE) == View.LONG_CLICKABLE) &&\n                    (event.getRepeatCount() == 0)) {\n                    this.setPressed(true);\n                    this.checkForLongClick(0);\n                    return true;\n                }\n            }\n            return result;\n        }\n\n        onKeyLongPress(keyCode:number, event:android.view.KeyEvent):boolean {\n            return false;\n        }\n\n        onKeyUp(keyCode:number, event:android.view.KeyEvent):boolean {\n            if (KeyEvent.isConfirmKey(keyCode)) {\n                if ((this.mViewFlags & View.ENABLED_MASK) == View.DISABLED) {\n                    return true;\n                }\n                if ((this.mViewFlags & View.CLICKABLE) == View.CLICKABLE && this.isPressed()) {\n                    this.setPressed(false);\n\n                    if (!this.mHasPerformedLongPress) {\n                        // This is a tap, so remove the longpress check\n                        this.removeLongPressCallback();\n                        return this.performClick();\n                    }\n                }\n            }\n            return false;\n        }\n\n        dispatchTouchEvent(event:MotionEvent):boolean {\n            if (this.onFilterTouchEventForSecurity(event)) {\n                let li = this.mListenerInfo;\n                if (li != null && li.mOnTouchListener != null && (this.mViewFlags & View.ENABLED_MASK) == View.ENABLED\n                    && li.mOnTouchListener.onTouch(this, event)) {\n                    return true;\n                }\n\n                if (this.onTouchEvent(event)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        onFilterTouchEventForSecurity(event:MotionEvent):boolean {\n            return true;\n        }\n\n        onTouchEvent(event:MotionEvent):boolean {\n            let viewFlags = this.mViewFlags;\n\n            if ((viewFlags & View.ENABLED_MASK) == View.DISABLED) {\n                if (event.getAction() == MotionEvent.ACTION_UP && (this.mPrivateFlags & View.PFLAG_PRESSED) != 0) {\n                    this.setPressed(false);\n                }\n                // A disabled view that is clickable still consumes the touch\n                // events, it just doesn't respond to them.\n                return (((viewFlags & View.CLICKABLE) == View.CLICKABLE ||\n                (viewFlags & View.LONG_CLICKABLE) == View.LONG_CLICKABLE));\n            }\n\n            if (this.mTouchDelegate != null) {\n                if (this.mTouchDelegate.onTouchEvent(event)) {\n                    return true;\n                }\n            }\n\n            if (((viewFlags & View.CLICKABLE) == View.CLICKABLE ||\n                (viewFlags & View.LONG_CLICKABLE) == View.LONG_CLICKABLE)) {\n                switch (event.getAction()) {\n                    case MotionEvent.ACTION_UP:\n                        let prepressed = (this.mPrivateFlags & View.PFLAG_PREPRESSED) != 0;\n                        if ((this.mPrivateFlags & View.PFLAG_PRESSED) != 0 || prepressed) {\n                            // take focus if we don't have it already and we should in\n                            // touch mode.\n                            let focusTaken = false;\n                            if (this.isFocusable() && this.isFocusableInTouchMode() && !this.isFocused()) {\n                                focusTaken = this.requestFocus();\n                            }\n\n                            if (prepressed) {\n                                // The button is being released before we actually\n                                // showed it as pressed.  Make it show the pressed\n                                // state now (before scheduling the click) to ensure\n                                // the user sees it.\n                                this.setPressed(true);\n                            }\n\n                            if (!this.mHasPerformedLongPress) {\n                                // This is a tap, so remove the longpress check\n                                this.removeLongPressCallback();\n\n                                // Only perform take click actions if we were in the pressed state\n                                if (!focusTaken) {\n                                    // Use a Runnable and post this rather than calling\n                                    // performClick directly. This lets other visual state\n                                    // of the view update before click actions start.\n                                    if (this.mPerformClick == null) {\n                                        this.mPerformClick = new PerformClick(this);\n                                    }\n\n                                    if (prepressed) { // androidui add: do click actions after press state draw to canvas.\n                                        if (this.mPerformClickAfterPressDraw == null) {\n                                            this.mPerformClickAfterPressDraw = new PerformClickAfterPressDraw(this);\n                                        }\n                                        this.post(this.mPerformClickAfterPressDraw);\n\n                                    } else if (!this.post(this.mPerformClick)) {\n                                        this.performClick(event);\n                                    }\n                                }\n                            }\n\n                            if (this.mUnsetPressedState == null) {\n                                this.mUnsetPressedState = new UnsetPressedState(this);\n                            }\n\n                            if (prepressed) {\n                                this.postDelayed(this.mUnsetPressedState,\n                                    ViewConfiguration.getPressedStateDuration());\n                            } else if (!this.post(this.mUnsetPressedState)) {\n                                // If the post failed, unpress right now\n                                this.mUnsetPressedState.run();\n                            }\n                            this.removeTapCallback();\n                        }\n                        break;\n\n                    case MotionEvent.ACTION_DOWN:\n                        this.mHasPerformedLongPress = false;\n\n\n                        // Walk up the hierarchy to determine if we're inside a scrolling container.\n                        let isInScrollingContainer = this.isInScrollingContainer();\n\n                        // For views inside a scrolling container, delay the pressed feedback for\n                        // a short period in case this is a scroll.\n                        if (isInScrollingContainer) {\n                            this.mPrivateFlags |= View.PFLAG_PREPRESSED;\n                            if (this.mPendingCheckForTap == null) {\n                                this.mPendingCheckForTap = new CheckForTap(this);\n                            }\n                            this.postDelayed(this.mPendingCheckForTap, ViewConfiguration.getTapTimeout());\n                        } else {\n                            // Not inside a scrolling container, so show the feedback right away\n                            this.setPressed(true);\n                            this.checkForLongClick(0);\n                        }\n                        break;\n\n                    case MotionEvent.ACTION_CANCEL:\n                        this.setPressed(false);\n                        this.removeTapCallback();\n                        this.removeLongPressCallback();\n                        break;\n\n                    case MotionEvent.ACTION_MOVE:\n                        const x = event.getX();\n                        const y = event.getY();\n\n                        // Be lenient about moving outside of buttons\n                        if (!this.pointInView(x, y, this.mTouchSlop)) {\n                            // Outside button\n                            this.removeTapCallback();\n                            if ((this.mPrivateFlags & View.PFLAG_PRESSED) != 0) {\n                                // Remove any future long press/tap checks\n                                this.removeLongPressCallback();\n\n                                this.setPressed(false);\n                            }\n                        }\n                        break;\n                }\n                return true;\n            }\n\n            return false;\n        }\n        isInScrollingContainer():boolean {\n            let p = this.getParent();\n            while (p != null && p instanceof ViewGroup) {\n                if ((<ViewGroup> p).shouldDelayChildPressedState()) {\n                    return true;\n                }\n                p = p.getParent();\n            }\n            return false;\n        }\n\n        /**\n         * Cancel any deferred high-level input events that were previously posted to the event queue.\n         *\n         * <p>Many views post high-level events such as click handlers to the event queue\n         * to run deferred in order to preserve a desired user experience - clearing visible\n         * pressed states before executing, etc. This method will abort any events of this nature\n         * that are currently in flight.</p>\n         *\n         * <p>Custom views that generate their own high-level deferred input events should override\n         * {@link #onCancelPendingInputEvents()} and remove those pending events from the queue.</p>\n         *\n         * <p>This will also cancel pending input events for any child views.</p>\n         *\n         * <p>Note that this may not be sufficient as a debouncing strategy for clicks in all cases.\n         * This will not impact newer events posted after this call that may occur as a result of\n         * lower-level input events still waiting in the queue. If you are trying to prevent\n         * double-submitted  events for the duration of some sort of asynchronous transaction\n         * you should also take other steps to protect against unexpected double inputs e.g. calling\n         * {@link #setEnabled(boolean) setEnabled(false)} and re-enabling the view when\n         * the transaction completes, tracking already submitted transaction IDs, etc.</p>\n         */\n        cancelPendingInputEvents():void  {\n            this.dispatchCancelPendingInputEvents();\n        }\n\n        /**\n         * Called by {@link #cancelPendingInputEvents()} to cancel input events in flight.\n         * Overridden by ViewGroup to dispatch. Package scoped to prevent app-side meddling.\n         */\n        dispatchCancelPendingInputEvents():void  {\n            this.mPrivateFlags3 &= ~View.PFLAG3_CALLED_SUPER;\n            this.onCancelPendingInputEvents();\n            if ((this.mPrivateFlags3 & View.PFLAG3_CALLED_SUPER) != View.PFLAG3_CALLED_SUPER) {\n                throw Error(`new SuperNotCalledException(\"View \" + this.getClass().getSimpleName() + \" did not call through to super.onCancelPendingInputEvents()\")`);\n            }\n        }\n\n        /**\n         * Called as the result of a call to {@link #cancelPendingInputEvents()} on this view or\n         * a parent view.\n         *\n         * <p>This method is responsible for removing any pending high-level input events that were\n         * posted to the event queue to run later. Custom view classes that post their own deferred\n         * high-level events via {@link #post(Runnable)}, {@link #postDelayed(Runnable, long)} or\n         * {@link android.os.Handler} should override this method, call\n         * <code>super.onCancelPendingInputEvents()</code> and remove those callbacks as appropriate.\n         * </p>\n         */\n        onCancelPendingInputEvents():void  {\n            this.removePerformClickCallback();\n            this.cancelLongPress();\n            this.mPrivateFlags3 |= View.PFLAG3_CALLED_SUPER;\n        }\n\n        private removeLongPressCallback() {\n            if (this.mPendingCheckForLongPress != null) {\n                this.removeCallbacks(this.mPendingCheckForLongPress);\n            }\n        }\n        private removePerformClickCallback() {\n            if (this.mPerformClick != null) {\n                this.removeCallbacks(this.mPerformClick);\n            }\n            if (this.mPerformClickAfterPressDraw != null) {\n                this.removeCallbacks(this.mPerformClickAfterPressDraw);\n            }\n        }\n        private removeUnsetPressCallback() {\n            if ((this.mPrivateFlags & View.PFLAG_PRESSED) != 0 && this.mUnsetPressedState != null) {\n                this.setPressed(false);\n                this.removeCallbacks(this.mUnsetPressedState);\n            }\n        }\n        private removeTapCallback() {\n            if (this.mPendingCheckForTap != null) {\n                this.mPrivateFlags &= ~View.PFLAG_PREPRESSED;\n                this.removeCallbacks(this.mPendingCheckForTap);\n            }\n        }\n        cancelLongPress() {\n            this.removeLongPressCallback();\n\n            /*\n             * The prepressed state handled by the tap callback is a display\n             * construct, but the tap callback will post a long press callback\n             * less its own timeout. Remove it here.\n             */\n            this.removeTapCallback();\n        }\n        setTouchDelegate(delegate:TouchDelegate) {\n            this.mTouchDelegate = delegate;\n        }\n        getTouchDelegate() {\n            return this.mTouchDelegate;\n        }\n\n        getListenerInfo() {\n            if (this.mListenerInfo != null) {\n                return this.mListenerInfo;\n            }\n            this.mListenerInfo = new View.ListenerInfo();\n            return this.mListenerInfo;\n        }\n        addOnLayoutChangeListener(listener:View.OnLayoutChangeListener) {\n            let li = this.getListenerInfo();\n            if (li.mOnLayoutChangeListeners == null) {\n                li.mOnLayoutChangeListeners = new ArrayList<View.OnLayoutChangeListener>();\n            }\n            if (!li.mOnLayoutChangeListeners.contains(listener)) {\n                li.mOnLayoutChangeListeners.add(listener);\n            }\n        }\n        removeOnLayoutChangeListener(listener:View.OnLayoutChangeListener) {\n            let li = this.mListenerInfo;\n            if (li == null || li.mOnLayoutChangeListeners == null) {\n                return;\n            }\n            li.mOnLayoutChangeListeners.remove(listener);\n        }\n        addOnAttachStateChangeListener(listener:View.OnAttachStateChangeListener) {\n            let li = this.getListenerInfo();\n            if (li.mOnAttachStateChangeListeners == null) {\n                li.mOnAttachStateChangeListeners\n                    = new CopyOnWriteArrayList<View.OnAttachStateChangeListener>();\n            }\n            li.mOnAttachStateChangeListeners.add(listener);\n        }\n        removeOnAttachStateChangeListener(listener:View.OnAttachStateChangeListener) {\n            let li = this.mListenerInfo;\n            if (li == null || li.mOnAttachStateChangeListeners == null) {\n                return;\n            }\n            li.mOnAttachStateChangeListeners.remove(listener);\n        }\n        //AndroidUIX add: call for init view from xml / onclick attr value change\n        private setOnClickListenerByAttrValueString(onClickAttrString:string):void {\n            this.setOnClickListener((view:View) => {\n                if (!onClickAttrString) return;\n                // call activity method\n                let activityClickMethod = view.getContext()[onClickAttrString];\n                if (typeof activityClickMethod === 'function') {\n                    try {\n                        activityClickMethod.call(view.getContext(), view);\n                    } catch (e) {\n                        console.error(e);\n                        throw new Error(`Could not execute method '${onClickAttrString}' of the activity`);\n                    }\n                    return;\n                } else {\n                    // eval js code\n                    try {\n                        new Function(onClickAttrString).call(view);\n                    } catch (e) {\n                        console.error(e);\n                        throw new Error(\"Could not execute or find a method \" +\n                            onClickAttrString + \"(View) in the activity \"\n                            + view.getContext().constructor.name + \" for onClick handler\"\n                            + \" on view \" + view.getClass() + view.getId());\n                    }\n                }\n            });\n        }\n        setOnClickListener(l:View.OnClickListener|((v:View)=>void)) {\n            if (!this.isClickable()) {\n                this.setClickable(true);\n            }\n            if(typeof l == \"function\"){\n                l = View.OnClickListener.fromFunction(<(v:View)=>void>l);\n            }\n            this.getListenerInfo().mOnClickListener = <View.OnClickListener>l;\n        }\n        hasOnClickListeners():boolean {\n            let li = this.mListenerInfo;\n            return (li != null && li.mOnClickListener != null);\n        }\n\n\n        setOnLongClickListener(l:View.OnLongClickListener|((v:View)=>boolean)) {\n            if (!this.isLongClickable()) {\n                this.setLongClickable(true);\n            }\n            if(typeof l == \"function\"){\n                l = View.OnLongClickListener.fromFunction(<(v:View)=>boolean>l);\n            }\n            this.getListenerInfo().mOnLongClickListener = <View.OnLongClickListener>l;\n        }\n        playSoundEffect(soundConstant:number){\n            //no impl\n        }\n\n        performHapticFeedback(feedbackConstant:number):boolean  {\n            //no impl\n            return false;\n        }\n\n        performClick(event?:MotionEvent):boolean {\n            let li = this.mListenerInfo;\n            if (li != null && li.mOnClickListener != null) {\n                li.mOnClickListener.onClick(this);\n                return true;\n            }\n            return false;\n        }\n\n        callOnClick():boolean {\n            let li = this.mListenerInfo;\n            if (li != null && li.mOnClickListener != null) {\n                li.mOnClickListener.onClick(this);\n                return true;\n            }\n\n            return false;\n        }\n        performLongClick():boolean {\n            let handled = false;\n            let li = this.mListenerInfo;\n            if (li != null && li.mOnLongClickListener != null) {\n                handled = li.mOnLongClickListener.onLongClick(this);\n            }\n            return handled;\n        }\n        /**\n         * Performs button-related actions during a touch down event.\n         *\n         * @param event The event.\n         * @return True if the down was consumed.\n         *\n         * @hide\n         */\n        performButtonActionOnTouchDown(event:MotionEvent):boolean  {\n            //no impl\n            //if ((event.getButtonState() & MotionEvent.BUTTON_SECONDARY) != 0) {\n            //    if (this.showContextMenu(event.getX(), event.getY(), event.getMetaState())) {\n            //        return true;\n            //    }\n            //}\n            return false;\n        }\n\n        private checkForLongClick(delayOffset=0) {\n            if ((this.mViewFlags & View.LONG_CLICKABLE) == View.LONG_CLICKABLE) {\n                this.mHasPerformedLongPress = false;\n\n                if (this.mPendingCheckForLongPress == null) {\n                    this.mPendingCheckForLongPress = new CheckForLongPress(this);\n                }\n                this.mPendingCheckForLongPress.rememberWindowAttachCount();\n                this.postDelayed(this.mPendingCheckForLongPress,\n                    ViewConfiguration.getLongPressTimeout() - delayOffset);\n            }\n        }\n        setOnTouchListener(l:View.OnTouchListener|((v:View, event:MotionEvent)=>void)) {\n            if(typeof l == \"function\"){\n                l = View.OnTouchListener.fromFunction(<()=>void>l);\n            }\n            this.getListenerInfo().mOnTouchListener = <View.OnTouchListener>l;\n        }\n        isClickable() {\n            return (this.mViewFlags & View.CLICKABLE) == View.CLICKABLE;\n        }\n        setClickable(clickable:boolean) {\n            this.setFlags(clickable ? View.CLICKABLE : 0, View.CLICKABLE);\n        }\n        isLongClickable():boolean {\n            return (this.mViewFlags & View.LONG_CLICKABLE) == View.LONG_CLICKABLE;\n        }\n        setLongClickable(longClickable:boolean) {\n            this.setFlags(longClickable ? View.LONG_CLICKABLE : 0, View.LONG_CLICKABLE);\n        }\n        setPressed(pressed:boolean){\n            const needsRefresh = pressed != ((this.mPrivateFlags & View.PFLAG_PRESSED) == View.PFLAG_PRESSED);\n\n            if (pressed) {\n                this.mPrivateFlags |= View.PFLAG_PRESSED;\n            } else {\n                this.mPrivateFlags &= ~View.PFLAG_PRESSED;\n            }\n\n            if (needsRefresh) {\n                this.refreshDrawableState();\n            }\n            this.dispatchSetPressed(pressed);\n        }\n        dispatchSetPressed(pressed:boolean):void {\n        }\n        isPressed():boolean {\n            return (this.mPrivateFlags & View.PFLAG_PRESSED) == View.PFLAG_PRESSED;\n        }\n        setSelected(selected:boolean) {\n            if (((this.mPrivateFlags & View.PFLAG_SELECTED) != 0) != selected) {\n                this.mPrivateFlags = (this.mPrivateFlags & ~View.PFLAG_SELECTED) | (selected ? View.PFLAG_SELECTED : 0);\n                if (!selected) this.resetPressedState();\n                this.invalidate(true);\n                this.refreshDrawableState();\n                this.dispatchSetSelected(selected);\n            }\n        }\n        dispatchSetSelected(selected:boolean) {\n        }\n        isSelected() {\n            return (this.mPrivateFlags & View.PFLAG_SELECTED) != 0;\n        }\n        setActivated(activated:boolean) {\n            if (((this.mPrivateFlags & View.PFLAG_ACTIVATED) != 0) != activated) {\n                this.mPrivateFlags = (this.mPrivateFlags & ~View.PFLAG_ACTIVATED) | (activated ? View.PFLAG_ACTIVATED : 0);\n                this.invalidate(true);\n                this.refreshDrawableState();\n                this.dispatchSetActivated(activated);\n            }\n        }\n        dispatchSetActivated(activated:boolean) {\n        }\n        isActivated() {\n            return (this.mPrivateFlags & View.PFLAG_ACTIVATED) != 0;\n        }\n        getViewTreeObserver() {\n            if (this.mAttachInfo != null) {\n                return this.mAttachInfo.mViewRootImpl.mTreeObserver;\n            }\n            if (this.mFloatingTreeObserver == null) {\n                this.mFloatingTreeObserver = new ViewTreeObserver();\n            }\n            return this.mFloatingTreeObserver;\n        }\n\n        setLayoutDirection(layoutDirection:number):void  {\n        }\n        getLayoutDirection():number  {\n            return View.LAYOUT_DIRECTION_LTR;\n        }\n        isLayoutRtl():boolean  {\n            return (this.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL);\n        }\n\n        /**\n         * Return the resolved text direction.\n         *\n         * @return the resolved text direction. Returns one of:\n         *\n         * {@link #TEXT_DIRECTION_FIRST_STRONG}\n         * {@link #TEXT_DIRECTION_ANY_RTL},\n         * {@link #TEXT_DIRECTION_LTR},\n         * {@link #TEXT_DIRECTION_RTL},\n         * {@link #TEXT_DIRECTION_LOCALE}\n         *\n         * @attr ref android.R.styleable#View_textDirection\n         */\n        getTextDirection():number  {\n            return View.TEXT_DIRECTION_LTR;\n            //(this.mPrivateFlags2 & View.PFLAG2_TEXT_DIRECTION_RESOLVED_MASK) >> View.PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT;\n        }\n        setTextDirection(textDirection:number):void  {\n            //do nothing\n        }\n\n        /**\n         * Return the resolved text alignment.\n         *\n         * @return the resolved text alignment. Returns one of:\n         *\n         * {@link #TEXT_ALIGNMENT_GRAVITY},\n         * {@link #TEXT_ALIGNMENT_CENTER},\n         * {@link #TEXT_ALIGNMENT_TEXT_START},\n         * {@link #TEXT_ALIGNMENT_TEXT_END},\n         * {@link #TEXT_ALIGNMENT_VIEW_START},\n         * {@link #TEXT_ALIGNMENT_VIEW_END}\n         *\n         * @attr ref android.R.styleable#View_textAlignment\n         */\n        getTextAlignment():number  {\n            return View.TEXT_ALIGNMENT_DEFAULT;//(this.mPrivateFlags2 & View.PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK) >> View.PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT;\n        }\n        setTextAlignment(textAlignment:number):void  {\n            //do nothing\n        }\n\n\n        getBaseline():number {\n            return -1;\n        }\n        isLayoutRequested():boolean {\n            return (this.mPrivateFlags & View.PFLAG_FORCE_LAYOUT) == View.PFLAG_FORCE_LAYOUT;\n        }\n\n        getLayoutParams():ViewGroup.LayoutParams {\n            return this.mLayoutParams;\n        }\n        setLayoutParams(params:ViewGroup.LayoutParams) {\n            if (params == null) {\n                throw new Error(\"Layout parameters cannot be null\");\n            }\n            this.mLayoutParams = params;\n            //resolveLayoutParams();\n            let p = this.mParent;\n            if (p instanceof ViewGroup) {\n                p.onSetLayoutParams(this, params);\n            }\n            this.requestLayout();\n        }\n\n        isInLayout():boolean  {\n            let viewRoot:ViewRootImpl = this.getViewRootImpl();\n            return (viewRoot != null && viewRoot.isInLayout());\n        }\n        requestLayout():void {\n            if (this.mMeasureCache != null) this.mMeasureCache.clear();\n\n            if (this.mAttachInfo != null && this.mAttachInfo.mViewRequestingLayout == null) {\n                // Only trigger request-during-layout logic if this is the view requesting it,\n                // not the views in its parent hierarchy\n                let viewRoot = this.getViewRootImpl();\n                if (viewRoot != null && viewRoot.isInLayout()) {\n                    if (!viewRoot.requestLayoutDuringLayout(this)) {\n                        return;\n                    }\n                }\n                this.mAttachInfo.mViewRequestingLayout = this;\n            }\n\n            this.mPrivateFlags |= View.PFLAG_FORCE_LAYOUT;\n            this.mPrivateFlags |= View.PFLAG_INVALIDATED;\n\n            if (this.mParent != null && !this.mParent.isLayoutRequested()) {\n                this.mParent.requestLayout();\n            }\n            if (this.mAttachInfo != null && this.mAttachInfo.mViewRequestingLayout == this) {\n                this.mAttachInfo.mViewRequestingLayout = null;\n            }\n        }\n\n        forceLayout() {\n            if (this.mMeasureCache != null) this.mMeasureCache.clear();\n\n            this.mPrivateFlags |= View.PFLAG_FORCE_LAYOUT;\n            this.mPrivateFlags |= View.PFLAG_INVALIDATED;\n        }\n\n        isLaidOut():boolean {\n            return (this.mPrivateFlags3 & View.PFLAG3_IS_LAID_OUT) == View.PFLAG3_IS_LAID_OUT;\n        }\n\n        layout(l:number, t:number, r:number, b:number):void {\n            if ((this.mPrivateFlags3 & View.PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT) != 0) {\n                this.onMeasure(this.mOldWidthMeasureSpec, this.mOldHeightMeasureSpec);\n                this.mPrivateFlags3 &= ~View.PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT;\n            }\n\n            let oldL = this.mLeft;\n            let oldT = this.mTop;\n            let oldB = this.mBottom;\n            let oldR = this.mRight;\n\n            let changed = this.setFrame(l, t, r, b);\n\n            if (changed || (this.mPrivateFlags & View.PFLAG_LAYOUT_REQUIRED) == View.PFLAG_LAYOUT_REQUIRED) {\n\n                this.onLayout(changed, l, t, r, b);\n                this.mPrivateFlags &= ~View.PFLAG_LAYOUT_REQUIRED;\n\n                let li = this.mListenerInfo;\n                if (li != null && li.mOnLayoutChangeListeners != null) {\n                    let listenersCopy = li.mOnLayoutChangeListeners.clone();\n                    let numListeners = listenersCopy.size();\n                    for (let i = 0; i < numListeners; ++i) {\n                        listenersCopy.get(i).onLayoutChange(this, l, t, r, b, oldL, oldT, oldR, oldB);\n                    }\n                }\n            }\n\n            this.mPrivateFlags &= ~View.PFLAG_FORCE_LAYOUT;\n            this.mPrivateFlags3 |= View.PFLAG3_IS_LAID_OUT;\n        }\n        protected onLayout(changed:boolean, left:number, top:number, right:number, bottom:number):void {\n        }\n\n        protected setFrame(left:number, top:number, right:number, bottom:number) {\n            let changed = false;\n\n            if (View.DBG) {\n                Log.i(\"View\", this + \" View.setFrame(\" + left + \",\" + top + \",\"\n                    + right + \",\" + bottom + \")\");\n            }\n\n            if (this.mLeft != left || this.mRight != right || this.mTop != top || this.mBottom != bottom) {\n                changed = true;\n\n                // Remember our drawn bit\n                let drawn = this.mPrivateFlags & View.PFLAG_DRAWN;\n\n                let oldWidth = this.mRight - this.mLeft;\n                let oldHeight = this.mBottom - this.mTop;\n                let newWidth = right - left;\n                let newHeight = bottom - top;\n                let sizeChanged = (newWidth != oldWidth) || (newHeight != oldHeight);\n\n                // Invalidate our old position\n                this.invalidate(sizeChanged);\n\n                this.mLeft = left;\n                this.mTop = top;\n                this.mRight = right;\n                this.mBottom = bottom;\n\n                this.mPrivateFlags |= View.PFLAG_HAS_BOUNDS;\n\n\n                if (sizeChanged) {\n                    if ((this.mPrivateFlags & View.PFLAG_PIVOT_EXPLICITLY_SET) == 0) {\n                        // A change in dimension means an auto-centered pivot point changes, too\n                        if (this.mTransformationInfo != null) {\n                            this.mTransformationInfo.mMatrixDirty = true;\n                        }\n                    }\n                    this.sizeChange(newWidth, newHeight, oldWidth, oldHeight);\n                }\n\n                if ((this.mViewFlags & View.VISIBILITY_MASK) == View.VISIBLE) {\n                    // If we are visible, force the DRAWN bit to on so that\n                    // this invalidate will go through (at least to our parent).\n                    // This is because someone may have invalidated this view\n                    // before this call to setFrame came in, thereby clearing\n                    // the DRAWN bit.\n                    this.mPrivateFlags |= View.PFLAG_DRAWN;\n                    this.invalidate(sizeChanged);\n                    // parent display list may need to be recreated based on a change in the bounds\n                    // of any child\n                    //this.invalidateParentCaches();\n                }\n\n            // Reset drawn bit to original value (invalidate turns it off)\n            this.mPrivateFlags |= drawn;\n\n            this.mBackgroundSizeChanged = true;\n\n            }\n            return changed;\n        }\n\n        private sizeChange(newWidth:number, newHeight:number, oldWidth:number, oldHeight:number):void {\n            this.onSizeChanged(newWidth, newHeight, oldWidth, oldHeight);\n            if (this.mOverlay != null) {\n                this.mOverlay.getOverlayView().setRight(newWidth);\n                this.mOverlay.getOverlayView().setBottom(newHeight);\n            }\n        }\n\n        /**\n         * Hit rectangle in parent's coordinates\n         *\n         * @param outRect The hit rectangle of the view.\n         */\n        getHitRect(outRect:Rect):void  {\n            this.updateMatrix();\n            const info:View.TransformationInfo = this.mTransformationInfo;\n            if (info == null || info.mMatrixIsIdentity || this.mAttachInfo == null) {\n                outRect.set(this.mLeft, this.mTop, this.mRight, this.mBottom);\n            }\n            else {\n                const tmpRect:RectF = this.mAttachInfo.mTmpTransformRect;\n                tmpRect.set(0, 0, this.getWidth(), this.getHeight());\n                info.mMatrix.mapRect(tmpRect);\n                outRect.set(Math.floor(tmpRect.left) + this.mLeft, Math.floor(tmpRect.top) + this.mTop, Math.floor(tmpRect.right) + this.mLeft, Math.floor(tmpRect.bottom) + this.mTop);\n            }\n        }\n        getFocusedRect(r:Rect) {\n            this.getDrawingRect(r);\n        }\n        getDrawingRect(outRect:Rect) {\n            outRect.left = this.mScrollX;\n            outRect.top = this.mScrollY;\n            outRect.right = this.mScrollX + (this.mRight - this.mLeft);\n            outRect.bottom = this.mScrollY + (this.mBottom - this.mTop);\n        }\n\n        /**\n         * If some part of this view is not clipped by any of its parents, then\n         * return that area in r in global (root) coordinates. To convert r to local\n         * coordinates (without taking possible View rotations into account), offset\n         * it by -globalOffset (e.g. r.offset(-globalOffset.x, -globalOffset.y)).\n         * If the view is completely clipped or translated out, return false.\n         *\n         * @param r If true is returned, r holds the global coordinates of the\n         *        visible portion of this view.\n         * @param globalOffset If true is returned, globalOffset holds the dx,dy\n         *        between this view and its root. globalOffet may be null.\n         * @return true if r is non-empty (i.e. part of the view is visible at the\n         *         root level.\n         */\n        getGlobalVisibleRect(r:Rect, globalOffset:Point = null):boolean  {\n            let width:number = this.mRight - this.mLeft;\n            let height:number = this.mBottom - this.mTop;\n            if (width > 0 && height > 0) {\n                r.set(0, 0, width, height);\n                if (globalOffset != null) {\n                    globalOffset.set(-this.mScrollX, -this.mScrollY);\n                }\n                return this.mParent == null || this.mParent.getChildVisibleRect(this, r, globalOffset);\n            }\n            return false;\n        }\n\n        /**\n         * <p>Computes the coordinates of this view on the screen. The argument\n         * must be an array of two integers. After the method returns, the array\n         * contains the x and y location in that order.</p>\n         *\n         * @param location an array of two integers in which to hold the coordinates\n         */\n        getLocationOnScreen(location:number[]):void  {\n            this.getLocationInWindow(location);\n            const info:View.AttachInfo = this.mAttachInfo;\n            //if (info != null) {\n            //    location[0] += info.mWindowLeft;\n            //    location[1] += info.mWindowTop;\n            //}\n        }\n\n        /**\n         * <p>Computes the coordinates of this view in its window. The argument\n         * must be an array of two integers. After the method returns, the array\n         * contains the x and y location in that order.</p>\n         *\n         * @param location an array of two integers in which to hold the coordinates\n         */\n        getLocationInWindow(location:number[]):void  {\n            if (location == null || location.length < 2) {\n                throw Error(`new IllegalArgumentException(\"location must be an array of two integers\")`);\n            }\n            if (this.mAttachInfo == null) {\n                // When the view is not attached to a window, this method does not make sense\n                location[0] = location[1] = 0;\n                return;\n            }\n            let position:number[] = this.mAttachInfo.mTmpTransformLocation;\n            position[0] = position[1] = 0.0;\n            if (!this.hasIdentityMatrix()) {\n                this.getMatrix().mapPoints(position);\n            }\n            position[0] += this.mLeft;\n            position[1] += this.mTop;\n            let viewParent:ViewParent = this.mParent;\n            while (viewParent instanceof View) {\n                const view:View = <View><any>viewParent;\n                position[0] -= view.mScrollX;\n                position[1] -= view.mScrollY;\n                if (!view.hasIdentityMatrix()) {\n                    view.getMatrix().mapPoints(position);\n                }\n                position[0] += view.mLeft;\n                position[1] += view.mTop;\n                viewParent = view.mParent;\n            }\n            //if (viewParent instanceof ViewRootImpl) {\n            //    // *cough*\n            //    const vr:ViewRootImpl = <ViewRootImpl> viewParent;\n            //    position[1] -= vr.mCurScrollY;\n            //}\n            location[0] = Math.floor((position[0] + 0.5));\n            location[1] = Math.floor((position[1] + 0.5));\n        }\n\n        /**\n         * Retrieve the overall visible display size in which the window this view is\n         * attached to has been positioned in.  This takes into account screen\n         * decorations above the window, for both cases where the window itself\n         * is being position inside of them or the window is being placed under\n         * then and covered insets are used for the window to position its content\n         * inside.  In effect, this tells you the available area where content can\n         * be placed and remain visible to users.\n         *\n         * <p>This function requires an IPC back to the window manager to retrieve\n         * the requested information, so should not be used in performance critical\n         * code like drawing.\n         *\n         * @param outRect Filled in with the visible display frame.  If the view\n         * is not attached to a window, this is simply the raw display size.\n         */\n        getWindowVisibleDisplayFrame(outRect:Rect):void  {\n            if (this.mAttachInfo != null) {\n                let rootView = this.mAttachInfo.mRootView;\n                let xy = [0, 0];\n                rootView.getLocationOnScreen(xy);\n                outRect.set(xy[0], xy[1], rootView.getWidth()+xy[0], rootView.getHeight()+xy[1]);\n                return;\n            }\n\n            // The view is not attached to a display so we don't have a context.\n            // Make a best guess about the display size.\n            let dm = Resources.getSystem().getDisplayMetrics();\n            outRect.set(0, 0, dm.widthPixels, dm.heightPixels);\n        }\n\n        /**\n         * Computes whether the given portion of this view is visible to the user.\n         * Such a view is attached, visible, all its predecessors are visible,\n         * has an alpha greater than zero, and the specified portion is not\n         * clipped entirely by its predecessors.\n         *\n         * @param boundInView the portion of the view to test; coordinates should be relative; may be\n         *                    <code>null</code>, and the entire view will be tested in this case.\n         *                    When <code>true</code> is returned by the function, the actual visible\n         *                    region will be stored in this parameter; that is, if boundInView is fully\n         *                    contained within the view, no modification will be made, otherwise regions\n         *                    outside of the visible area of the view will be clipped.\n         *\n         * @return Whether the specified portion of the view is visible on the screen.\n         *\n         * @hide\n         */\n        protected isVisibleToUser(boundInView:Rect = null):boolean  {\n            if (this.mAttachInfo != null) {\n                // Attached to invisible window means this view is not visible.\n                if (this.mAttachInfo.mWindowVisibility != View.VISIBLE) {\n                    return false;\n                }\n                // An invisible predecessor or one with alpha zero means\n                // that this view is not visible to the user.\n                let current:any = this;\n                while (current instanceof View) {\n                    let view:View = <View> current;\n                    // need to check whether we reach to ViewRootImpl on the way up.\n                    if (view.getAlpha() <= 0 || view.getTransitionAlpha() <= 0 || view.getVisibility() != View.VISIBLE) {\n                        return false;\n                    }\n                    current = view.mParent;\n                }\n                // Check if the view is entirely covered by its predecessors.\n                let visibleRect:Rect = this.mAttachInfo.mTmpInvalRect;\n                let offset:Point = this.mAttachInfo.mPoint;\n                if (!this.getGlobalVisibleRect(visibleRect, offset)) {\n                    return false;\n                }\n                // Check if the visible portion intersects the rectangle of interest.\n                if (boundInView != null) {\n                    visibleRect.offset(-offset.x, -offset.y);\n                    return boundInView.intersect(visibleRect);\n                }\n                return true;\n            }\n            return false;\n        }\n\n        getMeasuredWidth():number {\n            return this.mMeasuredWidth & View.MEASURED_SIZE_MASK;\n        }\n        getMeasuredWidthAndState() {\n            return this.mMeasuredWidth;\n        }\n        getMeasuredHeight():number {\n            return this.mMeasuredHeight & View.MEASURED_SIZE_MASK;\n        }\n        getMeasuredHeightAndState():number {\n            return this.mMeasuredHeight;\n        }\n        getMeasuredState():number {\n            return (this.mMeasuredWidth&View.MEASURED_STATE_MASK)\n                | ((this.mMeasuredHeight>>View.MEASURED_HEIGHT_STATE_SHIFT)\n                & (View.MEASURED_STATE_MASK>>View.MEASURED_HEIGHT_STATE_SHIFT));\n        }\n        measure(widthMeasureSpec:number, heightMeasureSpec:number) {\n\n            // Suppress sign extension for the low bytes\n            let key = widthMeasureSpec + ',' + heightMeasureSpec;\n            if (this.mMeasureCache == null) this.mMeasureCache = new Map<string, number[]>();\n\n            if ((this.mPrivateFlags & View.PFLAG_FORCE_LAYOUT) == View.PFLAG_FORCE_LAYOUT ||\n                widthMeasureSpec != this.mOldWidthMeasureSpec ||\n                heightMeasureSpec != this.mOldHeightMeasureSpec) {\n\n                // first clears the measured dimension flag\n                this.mPrivateFlags &= ~View.PFLAG_MEASURED_DIMENSION_SET;\n\n                //resolveRtlPropertiesIfNeeded();\n\n                let cacheValue:number[] =\n                    (this.mPrivateFlags & View.PFLAG_FORCE_LAYOUT) == View.PFLAG_FORCE_LAYOUT ? null : this.mMeasureCache.get(key);\n                if (cacheValue==null) {\n                    // measure ourselves, this should set the measured dimension flag back\n                    this.onMeasure(widthMeasureSpec, heightMeasureSpec);\n                    this.mPrivateFlags3 &= ~View.PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT;\n                } else {\n                    // Casting a long to int drops the high 32 bits, no mask needed\n                    this.setMeasuredDimension(cacheValue[0], cacheValue[1]);\n                    this.mPrivateFlags3 |= View.PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT;\n                }\n\n                // flag not set, setMeasuredDimension() was not invoked, we raise\n                // an exception to warn the developer\n                if ((this.mPrivateFlags & View.PFLAG_MEASURED_DIMENSION_SET) != View.PFLAG_MEASURED_DIMENSION_SET) {\n                    throw new Error(\"onMeasure() did not set the\"\n                        + \" measured dimension by calling\"\n                        + \" setMeasuredDimension()\");\n                }\n\n                this.mPrivateFlags |= View.PFLAG_LAYOUT_REQUIRED;\n            }\n\n            this.mOldWidthMeasureSpec = widthMeasureSpec;\n            this.mOldHeightMeasureSpec = heightMeasureSpec;\n\n            this.mMeasureCache.set(key, [this.mMeasuredWidth, this.mMeasuredHeight]); // suppress sign extension\n        }\n\n        protected onMeasure(widthMeasureSpec:number, heightMeasureSpec:number):void {\n            this.setMeasuredDimension(View.getDefaultSize(this.getSuggestedMinimumWidth(), widthMeasureSpec),\n                View.getDefaultSize(this.getSuggestedMinimumHeight(), heightMeasureSpec));\n        }\n\n        setMeasuredDimension(measuredWidth, measuredHeight) {\n            this.mMeasuredWidth = measuredWidth;\n            this.mMeasuredHeight = measuredHeight;\n\n            this.mPrivateFlags |= View.PFLAG_MEASURED_DIMENSION_SET;\n        }\n\n        static combineMeasuredStates(curState, newState) {\n            return curState | newState;\n        }\n\n        static resolveSize(size, measureSpec) {\n            return View.resolveSizeAndState(size, measureSpec, 0) & View.MEASURED_SIZE_MASK;\n        }\n\n        static resolveSizeAndState(size, measureSpec, childMeasuredState) {\n            let MeasureSpec = View.MeasureSpec;\n            let result = size;\n            let specMode = MeasureSpec.getMode(measureSpec);\n            let specSize = MeasureSpec.getSize(measureSpec);\n            switch (specMode) {\n                case MeasureSpec.UNSPECIFIED:\n                    result = size;\n                    break;\n                case MeasureSpec.AT_MOST:\n                    if (specSize < size) {\n                        result = specSize | View.MEASURED_STATE_TOO_SMALL;\n                    } else {\n                        result = size;\n                    }\n                    break;\n                case MeasureSpec.EXACTLY:\n                    result = specSize;\n                    break;\n            }\n            return result | (childMeasuredState & View.MEASURED_STATE_MASK);\n        }\n\n        static getDefaultSize(size, measureSpec) {\n            let MeasureSpec = View.MeasureSpec;\n            let result = size;\n            let specMode = MeasureSpec.getMode(measureSpec);\n            let specSize = MeasureSpec.getSize(measureSpec);\n\n            switch (specMode) {\n                case MeasureSpec.UNSPECIFIED:\n                    result = size;\n                    break;\n                case MeasureSpec.AT_MOST:\n                case MeasureSpec.EXACTLY:\n                    result = specSize;\n                    break;\n            }\n            return result;\n        }\n\n        getSuggestedMinimumHeight() {\n            return (this.mBackground == null) ? this.mMinHeight :\n                Math.max(this.mMinHeight, this.mBackground.getMinimumHeight());\n        }\n\n        getSuggestedMinimumWidth() {\n            return (this.mBackground == null) ? this.mMinWidth :\n                Math.max(this.mMinWidth, this.mBackground.getMinimumWidth());\n        }\n\n        getMinimumHeight() {\n            return this.mMinHeight;\n        }\n\n        setMinimumHeight(minHeight) {\n            this.mMinHeight = minHeight;\n            this.requestLayout();\n        }\n\n        getMinimumWidth() {\n            return this.mMinWidth;\n        }\n\n        setMinimumWidth(minWidth) {\n            this.mMinWidth = minWidth;\n            this.requestLayout();\n        }\n\n        /**\n         * Get the animation currently associated with this view.\n         *\n         * @return The animation that is currently playing or\n         *         scheduled to play for this view.\n         */\n        getAnimation():Animation  {\n            return this.mCurrentAnimation;\n        }\n\n        /**\n         * Start the specified animation now.\n         *\n         * @param animation the animation to start now\n         */\n        startAnimation(animation:Animation):void  {\n            animation.setStartTime(Animation.START_ON_FIRST_FRAME);\n            this.setAnimation(animation);\n            this.invalidateParentCaches();\n            this.invalidate(true);\n        }\n\n        /**\n         * Cancels any animations for this view.\n         */\n        clearAnimation():void  {\n            if (this.mCurrentAnimation != null) {\n                this.mCurrentAnimation.detach();\n            }\n            this.mCurrentAnimation = null;\n            this.invalidateParentIfNeeded();\n        }\n\n        /**\n         * Sets the next animation to play for this view.\n         * If you want the animation to play immediately, use\n         * {@link #startAnimation(android.view.animation.Animation)} instead.\n         * This method provides allows fine-grained\n         * control over the start time and invalidation, but you\n         * must make sure that 1) the animation has a start time set, and\n         * 2) the view's parent (which controls animations on its children)\n         * will be invalidated when the animation is supposed to\n         * start.\n         *\n         * @param animation The next animation, or null.\n         */\n        setAnimation(animation:Animation):void  {\n            this.mCurrentAnimation = animation;\n            if (animation != null) {\n                // would cause the animation to start when the screen turns back on\n                //if (this.mAttachInfo != null\n                //    && !this.mAttachInfo.mScreenOn\n                //    && animation.getStartTime() == Animation.START_ON_FIRST_FRAME) {\n                //    animation.setStartTime(AnimationUtils.currentAnimationTimeMillis());\n                //}\n                animation.reset();\n            }\n        }\n\n        /**\n         * Invoked by a parent ViewGroup to notify the start of the animation\n         * currently associated with this view. If you override this method,\n         * always call super.onAnimationStart();\n         *\n         * @see #setAnimation(android.view.animation.Animation)\n         * @see #getAnimation()\n         */\n        protected onAnimationStart():void  {\n            this.mPrivateFlags |= View.PFLAG_ANIMATION_STARTED;\n        }\n\n        /**\n         * Invoked by a parent ViewGroup to notify the end of the animation\n         * currently associated with this view. If you override this method,\n         * always call super.onAnimationEnd();\n         *\n         * @see #setAnimation(android.view.animation.Animation)\n         * @see #getAnimation()\n         */\n        protected onAnimationEnd():void  {\n            this.mPrivateFlags &= ~View.PFLAG_ANIMATION_STARTED;\n        }\n\n        /**\n         * Invoked if there is a Transform that involves alpha. Subclass that can\n         * draw themselves with the specified alpha should return true, and then\n         * respect that alpha when their onDraw() is called. If this returns false\n         * then the view may be redirected to draw into an offscreen buffer to\n         * fulfill the request, which will look fine, but may be slower than if the\n         * subclass handles it internally. The default implementation returns false.\n         *\n         * @param alpha The alpha (0..255) to apply to the view's drawing\n         * @return true if the view can draw with the specified alpha.\n         */\n        protected onSetAlpha(alpha:number):boolean  {\n            return false;\n        }\n\n        private _invalidateRect(l:number, t:number, r:number, b:number){\n            if (this.skipInvalidate()) {\n                return;\n            }\n            if ((this.mPrivateFlags & (View.PFLAG_DRAWN | View.PFLAG_HAS_BOUNDS)) == (View.PFLAG_DRAWN | View.PFLAG_HAS_BOUNDS) ||\n                (this.mPrivateFlags & View.PFLAG_DRAWING_CACHE_VALID) == View.PFLAG_DRAWING_CACHE_VALID ||\n                (this.mPrivateFlags & View.PFLAG_INVALIDATED) != View.PFLAG_INVALIDATED) {\n                this.mPrivateFlags &= ~View.PFLAG_DRAWING_CACHE_VALID;\n                this.mPrivateFlags |= View.PFLAG_INVALIDATED;\n                this.mPrivateFlags |= View.PFLAG_DIRTY;\n                const p = this.mParent;\n                const ai = this.mAttachInfo;\n                //noinspection PointlessBooleanExpression,ConstantConditions\n//            if (!HardwareRenderer.RENDER_DIRTY_REGIONS) {\n//                if (p != null && ai != null && ai.mHardwareAccelerated) {\n//                    // fast-track for GL-enabled applications; just invalidate the whole hierarchy\n//                    // with a null dirty rect, which tells the ViewAncestor to redraw everything\n//                    p.invalidateChild(this, null);\n//                    return;\n//                }\n//            }\n                if (p != null && ai != null && l < r && t < b) {\n                    const scrollX = this.mScrollX;\n                    const scrollY = this.mScrollY;\n                    const tmpr = ai.mTmpInvalRect;\n                    tmpr.set(l - scrollX, t - scrollY, r - scrollX, b - scrollY);\n                    p.invalidateChild(this, tmpr);\n                }\n            }\n        }\n        private _invalidateCache(invalidateCache=true){\n            if (this.skipInvalidate()) {\n                return;\n            }\n            if ((this.mPrivateFlags & (View.PFLAG_DRAWN | View.PFLAG_HAS_BOUNDS)) == (View.PFLAG_DRAWN | View.PFLAG_HAS_BOUNDS) ||\n                (invalidateCache && (this.mPrivateFlags & View.PFLAG_DRAWING_CACHE_VALID) == View.PFLAG_DRAWING_CACHE_VALID) ||\n                (this.mPrivateFlags & View.PFLAG_INVALIDATED) != View.PFLAG_INVALIDATED || this.isOpaque() != this.mLastIsOpaque) {\n                this.mLastIsOpaque = this.isOpaque();\n                this.mPrivateFlags &= ~View.PFLAG_DRAWN;\n                this.mPrivateFlags |= View.PFLAG_DIRTY;\n                if (invalidateCache) {\n                    this.mPrivateFlags |= View.PFLAG_INVALIDATED;\n                    this.mPrivateFlags &= ~View.PFLAG_DRAWING_CACHE_VALID;\n                }\n                const ai = this.mAttachInfo;\n                const p = this.mParent;\n\n                if (p != null && ai != null) {\n                    const r = ai.mTmpInvalRect;\n                    r.set(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop);\n                    // Don't call invalidate -- we don't want to internally scroll\n                    // our own bounds\n                    p.invalidateChild(this, r);\n                }\n            }\n        }\n        invalidate();\n        invalidate(invalidateCache:boolean);\n        invalidate(dirty:Rect);\n        invalidate(l:number, t:number, r:number, b:number);\n        invalidate(...args){\n            if(args.length===0){\n                this._invalidateCache(true);\n\n            }else if(args.length===1 && args[0] instanceof Rect){\n                let rect:Rect = args[0];\n                this._invalidateRect(rect.left, rect.top, rect.right, rect.bottom);\n\n            }else if(args.length===1){\n                this._invalidateCache(args[0]);\n\n            }else if(args.length===4){\n                (<any>this)._invalidateRect(...args);\n            }\n        }\n        invalidateViewProperty(invalidateParent:boolean, forceRedraw:boolean){\n            if ((this.mPrivateFlags & View.PFLAG_DRAW_ANIMATION) == View.PFLAG_DRAW_ANIMATION) {\n                if (invalidateParent) {\n                    this.invalidateParentCaches();\n                }\n                if (forceRedraw) {\n                    this.mPrivateFlags |= View.PFLAG_DRAWN; // force another invalidation with the new orientation\n                }\n                this.invalidate(false);\n            } else {\n                const ai = this.mAttachInfo;\n                const p = this.mParent;\n                if (p != null && ai != null) {\n                    const r = ai.mTmpInvalRect;\n                    r.set(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop);\n                    if (this.mParent instanceof ViewGroup) {\n                        (<ViewGroup>this.mParent).invalidateChildFast(this, r);\n                    } else {\n                        this.mParent.invalidateChild(this, r);\n                    }\n                }\n            }\n        }\n        invalidateParentCaches(){\n            if (this.mParent instanceof View) {\n                (<any> this.mParent).mPrivateFlags |= View.PFLAG_INVALIDATED;\n            }\n        }\n        invalidateParentIfNeeded(){\n            //no HardwareAccelerated, no need\n            //if (isHardwareAccelerated() && mParent instanceof View) {\n            //    ((View) mParent).invalidate(true);\n            //}\n        }\n\n        postInvalidate(l?:number, t?:number, r?:number, b?:number){\n            this.postInvalidateDelayed(0, l, t, r, b);\n        }\n\n        postInvalidateDelayed(delayMilliseconds:number, left?:number, top?:number, right?:number, bottom?:number){\n            const attachInfo = this.mAttachInfo;\n            if (attachInfo != null) {\n                if(!Number.isInteger(left) || !Number.isInteger(top) || !Number.isInteger(right) || !Number.isInteger(bottom)){\n                    attachInfo.mViewRootImpl.dispatchInvalidateDelayed(this, delayMilliseconds);\n                }else{\n                    const info = View.AttachInfo.InvalidateInfo.obtain();\n                    info.target = this;\n                    info.left = left;\n                    info.top = top;\n                    info.right = right;\n                    info.bottom = bottom;\n\n                    attachInfo.mViewRootImpl.dispatchInvalidateRectDelayed(info, delayMilliseconds);\n                }\n            }\n\n\n        }\n        postInvalidateOnAnimation(left?:number, top?:number, right?:number, bottom?:number){\n            const attachInfo = this.mAttachInfo;\n            if (attachInfo != null) {\n                if(!Number.isInteger(left) || !Number.isInteger(top) || !Number.isInteger(right) || !Number.isInteger(bottom)){\n                    attachInfo.mViewRootImpl.dispatchInvalidateOnAnimation(this);\n                }else{\n                    const info = View.AttachInfo.InvalidateInfo.obtain();\n                    info.target = this;\n                    info.left = left;\n                    info.top = top;\n                    info.right = right;\n                    info.bottom = bottom;\n\n                    attachInfo.mViewRootImpl.dispatchInvalidateRectOnAnimation(info);\n                }\n            }\n        }\n        private skipInvalidate() {\n            return (this.mViewFlags & View.VISIBILITY_MASK) != View.VISIBLE\n                && this.mCurrentAnimation == null\n                //TODO when transition ok\n                //&&(!(mParent instanceof ViewGroup) ||\n                //!mParent.isViewTransitioning(this))\n                ;\n        }\n\n        isOpaque():boolean {\n            return (this.mPrivateFlags & View.PFLAG_OPAQUE_MASK) == View.PFLAG_OPAQUE_MASK &&\n                this.getFinalAlpha() >= 1;\n        }\n        private computeOpaqueFlags() {\n            // Opaque if:\n            //   - Has a background\n            //   - Background is opaque\n            //   - Doesn't have scrollbars or scrollbars overlay\n\n            if (this.mBackground != null && this.mBackground.getOpacity() == PixelFormat.OPAQUE) {\n                this.mPrivateFlags |= View.PFLAG_OPAQUE_BACKGROUND;\n            } else {\n                this.mPrivateFlags &= ~View.PFLAG_OPAQUE_BACKGROUND;\n            }\n\n            const flags = this.mViewFlags;\n            if (((flags & View.SCROLLBARS_VERTICAL) == 0 && (flags & View.SCROLLBARS_HORIZONTAL) == 0)\n                ////scroll bar is always inside_overlay\n                //||\n                //(flags & View.SCROLLBARS_STYLE_MASK) == View.SCROLLBARS_INSIDE_OVERLAY ||\n                //(flags & View.SCROLLBARS_STYLE_MASK) == View.SCROLLBARS_OUTSIDE_OVERLAY\n            ) {\n                this.mPrivateFlags |= View.PFLAG_OPAQUE_SCROLLBARS;\n            } else {\n                this.mPrivateFlags &= ~View.PFLAG_OPAQUE_SCROLLBARS;\n            }\n        }\n\n        setLayerType(layerType:number):void  {\n            if (layerType < View.LAYER_TYPE_NONE || layerType > View.LAYER_TYPE_SOFTWARE) {\n                throw Error(`new IllegalArgumentException(\"Layer type can only be one of: LAYER_TYPE_NONE, \" + \"LAYER_TYPE_SOFTWARE\")`);\n            }\n            if (layerType == this.mLayerType) {\n                return;\n            }\n            // Destroy any previous software drawing cache if needed\n            switch(this.mLayerType) {\n                //case View.LAYER_TYPE_HARDWARE:\n                //    this.destroyLayer(false);\n                // fall through - non-accelerated views may use software layer mechanism instead\n                case View.LAYER_TYPE_SOFTWARE:\n                    this.destroyDrawingCache();\n                    break;\n                default:\n                    break;\n            }\n            this.mLayerType = layerType;\n            const layerDisabled:boolean = this.mLayerType == View.LAYER_TYPE_NONE;\n            //this.mLayerPaint = layerDisabled ? null : (paint == null ? new Paint() : paint);\n            this.mLocalDirtyRect = layerDisabled ? null : new Rect();\n            this.invalidateParentCaches();\n            this.invalidate(true);\n        }\n\n        getLayerType():number {\n            return this.mLayerType;\n        }\n        setClipBounds(clipBounds:Rect) {\n            if (clipBounds != null) {\n                if (clipBounds.equals(this.mClipBounds)) {\n                    return;\n                }\n                if (this.mClipBounds == null) {\n                    this.invalidate();\n                    this.mClipBounds = new Rect(clipBounds);\n                } else {\n                    this.invalidate(Math.min(this.mClipBounds.left, clipBounds.left),\n                        Math.min(this.mClipBounds.top, clipBounds.top),\n                        Math.max(this.mClipBounds.right, clipBounds.right),\n                        Math.max(this.mClipBounds.bottom, clipBounds.bottom));\n                    this.mClipBounds.set(clipBounds);\n                }\n            } else {\n                if (this.mClipBounds != null) {\n                    this.invalidate();\n                    this.mClipBounds = null;\n                }\n            }\n        }\n        getClipBounds():Rect {\n            return (this.mClipBounds != null) ? new Rect(this.mClipBounds) : null;\n        }\n\n        setCornerRadius(radiusTopLeft:number, radiusTopRight=radiusTopLeft, radiusBottomRight=radiusTopRight, radiusBottomLeft=radiusBottomRight):void {\n            this.setCornerRadiusTopLeft(radiusTopLeft);\n            this.setCornerRadiusTopRight(radiusTopRight);\n            this.setCornerRadiusBottomRight(radiusBottomRight);\n            this.setCornerRadiusBottomLeft(radiusBottomLeft);\n        }\n\n        setCornerRadiusTopLeft(value:number):void {\n            if(this.mCornerRadiusTopLeft != value){\n                this.mCornerRadiusTopLeft = value;\n                this.mShadowDrawable = null;\n                this.invalidate();\n            }\n        }\n        getCornerRadiusTopLeft():number {\n            return this.mCornerRadiusTopLeft;\n        }\n\n        setCornerRadiusTopRight(value:number):void {\n            if(this.mCornerRadiusTopRight != value){\n                this.mCornerRadiusTopRight = value;\n                this.mShadowDrawable = null;\n                this.invalidate();\n            }\n        }\n        getCornerRadiusTopRight():number {\n            return this.mCornerRadiusTopRight;\n        }\n\n        setCornerRadiusBottomRight(value:number):void {\n            if(this.mCornerRadiusBottomRight != value){\n                this.mCornerRadiusBottomRight = value;\n                this.mShadowDrawable = null;\n                this.invalidate();\n            }\n        }\n        getCornerRadiusBottomRight():number {\n            return this.mCornerRadiusBottomRight;\n        }\n\n        setCornerRadiusBottomLeft(value:number):void {\n            if(this.mCornerRadiusBottomLeft != value){\n                this.mCornerRadiusBottomLeft = value;\n                this.mShadowDrawable = null;\n                this.invalidate();\n            }\n        }\n        getCornerRadiusBottomLeft():number {\n            return this.mCornerRadiusBottomLeft;\n        }\n\n        setShadowView(radius:number, dx:number, dy:number, color:number):void {\n            if(!this.mShadowPaint) this.mShadowPaint = new Paint();\n            this.mShadowPaint.setShadowLayer(radius, dx, dy, color);\n            this.invalidate();\n        }\n\n\n        getDrawingTime() {\n            return this.getViewRootImpl() != null ? this.getViewRootImpl().mDrawingTime : 0;\n        }\n\n        protected drawFromParent(canvas:Canvas, parent:ViewGroup, drawingTime:number):boolean {\n            let useDisplayListProperties = false;\n            let more = false;\n            let childHasIdentityMatrix = this.hasIdentityMatrix();\n            let flags = parent.mGroupFlags;\n            if ((flags & ViewGroup.FLAG_CLEAR_TRANSFORMATION) == ViewGroup.FLAG_CLEAR_TRANSFORMATION) {\n                parent.getChildTransformation().clear();\n                parent.mGroupFlags &= ~ViewGroup.FLAG_CLEAR_TRANSFORMATION;\n            }\n            let transformToApply:Transformation = null;\n            let concatMatrix = false;\n            let scalingRequired = false;\n            let caching = false;\n            let layerType = this.getLayerType();\n            const hardwareAccelerated = false;\n            const nativeAccelerated = canvas.isNativeAccelerated();\n\n            if ((flags & ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE) != 0 ||\n                (flags & ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE) != 0) {\n                caching = true;\n            } else {\n                caching = (layerType != View.LAYER_TYPE_NONE) || hardwareAccelerated || nativeAccelerated;\n            }\n\n            const a:Animation = this.getAnimation();\n            if (a != null) {\n                more = this.drawAnimation(parent, drawingTime, a, scalingRequired);\n                concatMatrix = a.willChangeTransformationMatrix();\n                if (concatMatrix) {\n                    this.mPrivateFlags3 |= View.PFLAG3_VIEW_IS_ANIMATING_TRANSFORM;\n                }\n                transformToApply = parent.getChildTransformation();\n            } else {\n                //if ((this.mPrivateFlags3 & View.PFLAG3_VIEW_IS_ANIMATING_TRANSFORM) == View.PFLAG3_VIEW_IS_ANIMATING_TRANSFORM && this.mDisplayList != null) {\n                //    // No longer animating: clear out old animation matrix\n                //    this.mDisplayList.setAnimationMatrix(null);\n                //    this.mPrivateFlags3 &= ~View.PFLAG3_VIEW_IS_ANIMATING_TRANSFORM;\n                //}\n                if (!useDisplayListProperties && (flags & ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) {\n                    const t:Transformation = parent.getChildTransformation();\n                    const hasTransform:boolean = parent.getChildStaticTransformation(this, t);\n                    if (hasTransform) {\n                        const transformType:number = t.getTransformationType();\n                        transformToApply = transformType != Transformation.TYPE_IDENTITY ? t : null;\n                        concatMatrix = (transformType & Transformation.TYPE_MATRIX) != 0;\n                    }\n                }\n            }\n            concatMatrix = !childHasIdentityMatrix || concatMatrix;\n\n            // Sets the flag as early as possible to allow draw() implementations\n            // to call invalidate() successfully when doing animations\n            this.mPrivateFlags |= View.PFLAG_DRAWN;\n\n            if (!concatMatrix &&\n                (flags & (ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS |\n                ViewGroup.FLAG_CLIP_CHILDREN)) == ViewGroup.FLAG_CLIP_CHILDREN &&\n                canvas.quickReject(this.mLeft, this.mTop, this.mRight, this.mBottom) &&\n                (this.mPrivateFlags & View.PFLAG_DRAW_ANIMATION) == 0) {\n                this.mPrivateFlags2 |= View.PFLAG2_VIEW_QUICK_REJECTED;\n                return more;\n            }\n            this.mPrivateFlags2 &= ~View.PFLAG2_VIEW_QUICK_REJECTED;\n            //if (hardwareAccelerated) {\n            //    // Clear INVALIDATED flag to allow invalidation to occur during rendering, but\n            //    // retain the flag's value temporarily in the mRecreateDisplayList flag\n            //    this.mRecreateDisplayList = (this.mPrivateFlags & View.PFLAG_INVALIDATED) == View.PFLAG_INVALIDATED;\n            //    this.mPrivateFlags &= ~View.PFLAG_INVALIDATED;\n            //}\n\n            let cache:Canvas = null;\n            if (caching) {\n                if (layerType != View.LAYER_TYPE_NONE) {\n                    layerType = View.LAYER_TYPE_SOFTWARE;\n                    this.buildDrawingCache(true);\n                }\n                cache = this.getDrawingCache(true);\n            }\n\n            this.computeScroll();\n            let sx = this.mScrollX;\n            let sy = this.mScrollY;\n\n            this.requestSyncBoundToElement();\n\n            let hasNoCache = cache == null;\n            let offsetForScroll = cache == null;\n            let restoreTo:number = canvas.save();\n            if (offsetForScroll) {\n                canvas.translate(this.mLeft - sx, this.mTop - sy);\n            }else{\n                canvas.translate(this.mLeft, this.mTop);\n            }\n\n            let alpha = this.getAlpha() * this.getTransitionAlpha();\n            if (transformToApply != null || alpha < 1 || !this.hasIdentityMatrix() || (this.mPrivateFlags3 & View.PFLAG3_VIEW_IS_ANIMATING_ALPHA) == View.PFLAG3_VIEW_IS_ANIMATING_ALPHA) {\n                if (transformToApply != null || !childHasIdentityMatrix) {\n                    let transX:number = 0;\n                    let transY:number = 0;\n                    if (offsetForScroll) {\n                        transX = -sx;\n                        transY = -sy;\n                    }\n                    if (transformToApply != null) {\n                        if (concatMatrix) {\n                            //if (useDisplayListProperties) {\n                            //    displayList.setAnimationMatrix(transformToApply.getMatrix());\n                            //} else {\n                                // Undo the scroll translation, apply the transformation matrix,\n                                // then redo the scroll translate to get the correct result.\n                                canvas.translate(-transX, -transY);\n                                canvas.concat(transformToApply.getMatrix());\n                                canvas.translate(transX, transY);\n                            //}\n                            parent.mGroupFlags |= ViewGroup.FLAG_CLEAR_TRANSFORMATION;\n                        }\n                        let transformAlpha:number = transformToApply.getAlpha();\n                        if (transformAlpha < 1) {\n                            alpha *= transformAlpha;\n                            parent.mGroupFlags |= ViewGroup.FLAG_CLEAR_TRANSFORMATION;\n                        }\n                    }\n                    if (!childHasIdentityMatrix && !useDisplayListProperties) {\n                        canvas.translate(-transX, -transY);\n                        canvas.concat(this.getMatrix());\n                        canvas.translate(transX, transY);\n                    }\n                }\n                // Deal with alpha if it is or used to be <1\n                if (alpha < 1 || (this.mPrivateFlags3 & View.PFLAG3_VIEW_IS_ANIMATING_ALPHA) == View.PFLAG3_VIEW_IS_ANIMATING_ALPHA) {\n                    if (alpha < 1) {\n                        this.mPrivateFlags3 |= View.PFLAG3_VIEW_IS_ANIMATING_ALPHA;\n                    } else {\n                        this.mPrivateFlags3 &= ~View.PFLAG3_VIEW_IS_ANIMATING_ALPHA;\n                    }\n                    parent.mGroupFlags |= ViewGroup.FLAG_CLEAR_TRANSFORMATION;\n                    if (hasNoCache) {\n                        const multipliedAlpha:number = Math.floor((255 * alpha));\n                        if (!this.onSetAlpha(multipliedAlpha)) {\n                            canvas.multiplyGlobalAlpha(alpha);\n                            //let layerFlags:number = Canvas.HAS_ALPHA_LAYER_SAVE_FLAG;\n                            //if ((flags & ViewGroup.FLAG_CLIP_CHILDREN) != 0 || layerType != View.LAYER_TYPE_NONE) {\n                            //    layerFlags |= Canvas.CLIP_TO_LAYER_SAVE_FLAG;\n                            //}\n                            //if (useDisplayListProperties) {\n                            //    displayList.setAlpha(alpha * this.getAlpha() * this.getTransitionAlpha());\n                            //} else\n                            //if (layerType == View.LAYER_TYPE_NONE) {\n                            //    const scrollX:number = hasDisplayList ? 0 : sx;\n                            //    const scrollY:number = hasDisplayList ? 0 : sy;\n                            //    canvas.saveLayerAlpha(scrollX, scrollY, scrollX + this.mRight - this.mLeft, scrollY + this.mBottom - this.mTop, multipliedAlpha, layerFlags);\n                            //}\n                        } else {\n                            // Alpha is handled by the child directly, clobber the layer's alpha\n                            this.mPrivateFlags |= View.PFLAG_ALPHA_SET;\n                        }\n                    }\n                }\n            } else if ((this.mPrivateFlags & View.PFLAG_ALPHA_SET) == View.PFLAG_ALPHA_SET) {\n                this.onSetAlpha(255);\n                this.mPrivateFlags &= ~View.PFLAG_ALPHA_SET;\n            }\n\n            //androidui add: draw shadow before clip\n            if(this.mShadowPaint!=null) this.drawShadow(canvas);\n\n            if ((flags & ViewGroup.FLAG_CLIP_CHILDREN) == ViewGroup.FLAG_CLIP_CHILDREN &&\n                !useDisplayListProperties && cache == null) {\n                if (offsetForScroll) {\n                    canvas.clipRect(sx, sy, sx + (this.mRight - this.mLeft), sy + (this.mBottom - this.mTop),\n                        this.mCornerRadiusTopLeft, this.mCornerRadiusTopRight, this.mCornerRadiusBottomRight, this.mCornerRadiusBottomLeft);\n                } else {\n                    //androidui always false here.\n                    if (!scalingRequired || cache == null) {\n                        canvas.clipRect(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop,\n                            this.mCornerRadiusTopLeft, this.mCornerRadiusTopRight, this.mCornerRadiusBottomRight, this.mCornerRadiusBottomLeft);\n                    } else {\n                        canvas.clipRect(0, 0, cache.getWidth(), cache.getHeight(),\n                            this.mCornerRadiusTopLeft, this.mCornerRadiusTopRight, this.mCornerRadiusBottomRight, this.mCornerRadiusBottomLeft);\n                    }\n                }\n            }\n\n            if (hasNoCache) {\n                // Fast path for layouts with no backgrounds\n                if ((this.mPrivateFlags & View.PFLAG_SKIP_DRAW) == View.PFLAG_SKIP_DRAW) {\n                    this.mPrivateFlags &= ~View.PFLAG_DIRTY_MASK;\n                    this.dispatchDraw(canvas);\n                } else {\n                    this.draw(canvas);\n                }\n            } else if (cache != null) {\n                this.mPrivateFlags &= ~View.PFLAG_DIRTY_MASK;\n                canvas.multiplyGlobalAlpha(alpha);\n                if (layerType == View.LAYER_TYPE_NONE) {\n                    if (alpha < 1) {\n                        parent.mGroupFlags |= ViewGroup.FLAG_ALPHA_LOWER_THAN_ONE;\n                    } else if ((flags & ViewGroup.FLAG_ALPHA_LOWER_THAN_ONE) != 0) {\n                        parent.mGroupFlags &= ~ViewGroup.FLAG_ALPHA_LOWER_THAN_ONE;\n                    }\n                }\n                //let cachePaint:Paint;\n                //if (layerType == View.LAYER_TYPE_NONE) {\n                //    cachePaint = parent.mCachePaint;\n                //    if (cachePaint == null) {\n                //        cachePaint = new Paint();\n                //        cachePaint.setDither(false);\n                //        parent.mCachePaint = cachePaint;\n                //    }\n                //    if (alpha < 1) {\n                //        cachePaint.setAlpha(Math.floor((alpha * 255)));\n                //        parent.mGroupFlags |= ViewGroup.FLAG_ALPHA_LOWER_THAN_ONE;\n                //    } else if ((flags & ViewGroup.FLAG_ALPHA_LOWER_THAN_ONE) != 0) {\n                //        cachePaint.setAlpha(255);\n                //        parent.mGroupFlags &= ~ViewGroup.FLAG_ALPHA_LOWER_THAN_ONE;\n                //    }\n                //} else {\n                //    cachePaint = this.mLayerPaint;\n                //    cachePaint.setAlpha(Math.floor((alpha * 255)));\n                //}\n\n                //androidui add\n                canvas.clipRect(0, 0, cache.getWidth(), cache.getHeight(),\n                    this.mCornerRadiusTopLeft, this.mCornerRadiusTopRight, this.mCornerRadiusBottomRight, this.mCornerRadiusBottomLeft);\n\n                canvas.drawCanvas(cache, 0, 0);\n            }\n\n\n            if (restoreTo >= 0) {\n                canvas.restoreToCount(restoreTo);\n            }\n\n            if (a != null && !more) {\n                if (!hardwareAccelerated && !a.getFillAfter()) {\n                    this.onSetAlpha(255);\n                }\n                parent.finishAnimatingView(this, a);\n            }\n\n            return more;\n        }\n\n        private drawShadow(canvas:Canvas):void {\n            let shadowPaint = this.mShadowPaint;\n            if(!shadowPaint || !shadowPaint.shadowRadius) return;\n            let color = shadowPaint.shadowColor;\n            if(!this.mShadowDrawable){\n                let drawable = new RoundRectDrawable(shadowPaint.shadowColor,\n                        this.mCornerRadiusTopLeft, this.mCornerRadiusTopRight, this.mCornerRadiusBottomLeft, this.mCornerRadiusBottomRight);\n                this.mShadowDrawable = new ShadowDrawable(drawable,\n                    shadowPaint.shadowRadius, shadowPaint.shadowDx, shadowPaint.shadowDy, shadowPaint.shadowColor);\n            }\n            this.mShadowDrawable.draw(canvas);\n        }\n\n        draw(canvas:Canvas):void {\n            if (this.mClipBounds != null) {\n                canvas.clipRect(this.mClipBounds);\n            }\n            let privateFlags = this.mPrivateFlags;\n            const dirtyOpaque = (privateFlags & View.PFLAG_DIRTY_MASK) == View.PFLAG_DIRTY_OPAQUE &&\n                (this.getViewRootImpl() == null || !this.getViewRootImpl().mIgnoreDirtyState);\n            this.mPrivateFlags = (privateFlags & ~View.PFLAG_DIRTY_MASK) | View.PFLAG_DRAWN;\n\n            // draw the background, if needed\n            if (!dirtyOpaque) {\n                let background = this.mBackground;\n                if (background != null) {\n                    let scrollX = this.mScrollX;\n                    let scrollY = this.mScrollY;\n\n                    if (this.mBackgroundSizeChanged) {\n                        background.setBounds(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop);\n                        this.mBackgroundSizeChanged = false;\n                    }\n\n                    if ((scrollX | scrollY) == 0) {\n                        background.draw(canvas);\n                    } else {\n                        canvas.translate(scrollX, scrollY);\n                        background.draw(canvas);\n                        canvas.translate(-scrollX, -scrollY);\n                    }\n                }\n            }\n            // draw the content\n            if (!dirtyOpaque) this.onDraw(canvas);\n\n            // draw the children\n            this.dispatchDraw(canvas);\n\n            //draw decorations (scrollbars)\n            this.onDrawScrollBars(canvas);\n\n            if (this.mOverlay != null && !this.mOverlay.isEmpty()) {\n                this.mOverlay.getOverlayView().dispatchDraw(canvas);\n            }\n\n        }\n        protected onDraw(canvas:Canvas):void {\n        }\n        protected dispatchDraw(canvas:Canvas):void {\n        }\n\n        private drawAnimation(parent:ViewGroup, drawingTime:number, a:Animation, scalingRequired?:boolean):boolean  {\n            let invalidationTransform:Transformation;\n            const flags:number = parent.mGroupFlags;\n            const initialized:boolean = a.isInitialized();\n            if (!initialized) {\n                a.initialize(this.mRight - this.mLeft, this.mBottom - this.mTop, parent.getWidth(), parent.getHeight());\n                a.initializeInvalidateRegion(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop);\n                if (this.mAttachInfo != null)\n                    a.setListenerHandler(this.mAttachInfo.mHandler);\n                this.onAnimationStart();\n            }\n            const t:Transformation = parent.getChildTransformation();\n            let more:boolean = a.getTransformation(drawingTime, t, 1);\n            //if (scalingRequired && this.mAttachInfo.mApplicationScale != 1) {\n            //    if (parent.mInvalidationTransformation == null) {\n            //        parent.mInvalidationTransformation = new Transformation();\n            //    }\n            //    invalidationTransform = parent.mInvalidationTransformation;\n            //    a.getTransformation(drawingTime, invalidationTransform, 1);\n            //} else {\n                invalidationTransform = t;\n            //}\n            if (more) {\n                if (!a.willChangeBounds()) {\n                    if ((flags & (ViewGroup.FLAG_OPTIMIZE_INVALIDATE | ViewGroup.FLAG_ANIMATION_DONE)) == ViewGroup.FLAG_OPTIMIZE_INVALIDATE) {\n                        parent.mGroupFlags |= ViewGroup.FLAG_INVALIDATE_REQUIRED;\n                    } else if ((flags & ViewGroup.FLAG_INVALIDATE_REQUIRED) == 0) {\n                        // The child need to draw an animation, potentially offscreen, so\n                        // make sure we do not cancel invalidate requests\n                        parent.mPrivateFlags |= View.PFLAG_DRAW_ANIMATION;\n                        parent.invalidate(this.mLeft, this.mTop, this.mRight, this.mBottom);\n                    }\n                } else {\n                    if (parent.mInvalidateRegion == null) {\n                        parent.mInvalidateRegion = new RectF();\n                    }\n                    const region:RectF = parent.mInvalidateRegion;\n                    a.getInvalidateRegion(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop, region, invalidationTransform);\n                    // The child need to draw an animation, potentially offscreen, so\n                    // make sure we do not cancel invalidate requests\n                    parent.mPrivateFlags |= View.PFLAG_DRAW_ANIMATION;\n                    const left:number = this.mLeft + Math.floor(region.left);\n                    const top:number = this.mTop + Math.floor(region.top);\n                    parent.invalidate(left, top, left + Math.floor((region.width() + .5)), top + Math.floor((region.height() + .5)));\n                }\n            }\n            return more;\n        }\n        onDrawScrollBars(canvas:Canvas) {\n            // scrollbars are drawn only when the animation is running\n            const cache = this.mScrollCache;\n            if (cache != null) {\n\n                let state = cache.state;\n\n                if (state == ScrollabilityCache.OFF) {\n                    return;\n                }\n\n                let invalidate = false;\n\n                if (state == ScrollabilityCache.FADING) {\n                    // We're fading -- get our fade interpolation\n                    //if (cache.interpolatorValues == null) {\n                    //    cache.interpolatorValues = androidui.util.ArrayCreator.newNumberArray(1);\n                    //}\n                    //let values = cache.interpolatorValues;\n\n                    // Stops the animation if we're done\n                    //if (cache.scrollBarInterpolator.timeToValues(values) ==\n                    //    Interpolator.Result.FREEZE_END) {\n                    //    cache.state = ScrollabilityCache.OFF;\n                    //} else {\n                    //    cache.scrollBar.setAlpha(Math.round(values[0]));\n                    //}\n\n                    cache._computeAlphaToScrollBar();\n\n                    // This will make the scroll bars inval themselves after\n                    // drawing. We only want this when we're fading so that\n                    // we prevent excessive redraws\n                    invalidate = true;\n                } else {\n                    // We're just on -- but we may have been fading before so\n                    // reset alpha\n                    cache.scrollBar.setAlpha(255);\n                }\n\n\n                const viewFlags = this.mViewFlags;\n\n                const drawHorizontalScrollBar =\n                    (viewFlags & View.SCROLLBARS_HORIZONTAL) == View.SCROLLBARS_HORIZONTAL;\n                const drawVerticalScrollBar =\n                    (viewFlags & View.SCROLLBARS_VERTICAL) == View.SCROLLBARS_VERTICAL\n                    && !this.isVerticalScrollBarHidden();\n\n                if (drawVerticalScrollBar || drawHorizontalScrollBar) {\n                    const width = this.mRight - this.mLeft;\n                    const height = this.mBottom - this.mTop;\n\n                    const scrollBar = cache.scrollBar;\n\n                    const scrollX = this.mScrollX;\n                    const scrollY = this.mScrollY;\n                    const inside = true;//(viewFlags & View.SCROLLBARS_OUTSIDE_MASK) == 0 ? ~0 : 0;\n\n                    let left;\n                    let top;\n                    let right;\n                    let bottom;\n\n                    if (drawHorizontalScrollBar) {\n                        let size = scrollBar.getSize(false);\n                        if (size <= 0) {\n                            size = cache.scrollBarSize;\n                        }\n\n                        scrollBar.setParameters(this.computeHorizontalScrollRange(),\n                            this.computeHorizontalScrollOffset(),\n                            this.computeHorizontalScrollExtent(), false);\n                        const verticalScrollBarGap = drawVerticalScrollBar ?\n                            this.getVerticalScrollbarWidth() : 0;\n                        top = scrollY + height - size;// - (this.mUserPaddingBottom & inside);\n                        left = scrollX + (this.mPaddingLeft);// & inside);\n                        right = scrollX + width - /*(this.mUserPaddingRight & inside)*/ - verticalScrollBarGap;\n                        bottom = top + size;\n                        this.onDrawHorizontalScrollBar(canvas, scrollBar, left, top, right, bottom);\n                        if (invalidate) {\n                            this.invalidate(left, top, right, bottom);\n                        }\n                    }\n\n                    if (drawVerticalScrollBar) {\n                        let size = scrollBar.getSize(true);\n                        if (size <= 0) {\n                            size = cache.scrollBarSize;\n                        }\n\n                        scrollBar.setParameters(this.computeVerticalScrollRange(),\n                            this.computeVerticalScrollOffset(),\n                            this.computeVerticalScrollExtent(), true);\n                        //let verticalScrollbarPosition = this.mVerticalScrollbarPosition;\n                        //if (verticalScrollbarPosition == View.SCROLLBAR_POSITION_DEFAULT) {\n                        //    verticalScrollbarPosition = isLayoutRtl() ?\n                        //        View.SCROLLBAR_POSITION_LEFT : View.SCROLLBAR_POSITION_RIGHT;\n                        //}\n                        //switch (verticalScrollbarPosition) {\n                        //    default:\n                        //    case View.SCROLLBAR_POSITION_RIGHT:\n                        //        left = scrollX + width - size - (this.mUserPaddingRight & inside);\n                        //        break;\n                        //    case View.SCROLLBAR_POSITION_LEFT:\n                        //        left = scrollX + (mUserPaddingLeft & inside);\n                        //        break;\n                        //}\n                        left = scrollX + width - size;// - (this.mUserPaddingRight & inside);\n                        top = scrollY + (this.mPaddingTop);// & inside);\n                        right = left + size;\n                        bottom = scrollY + height;// - (this.mUserPaddingBottom & inside);\n                        this.onDrawVerticalScrollBar(canvas, scrollBar, left, top, right, bottom);\n                        if (invalidate) {\n                            this.invalidate(left, top, right, bottom);\n                        }\n                    }\n                }\n            }\n        }\n\n        isVerticalScrollBarHidden():boolean {\n            return false;\n        }\n        onDrawHorizontalScrollBar(canvas:Canvas, scrollBar:Drawable, l:number, t:number, r:number, b:number) {\n            scrollBar.setBounds(l, t, r, b);\n            scrollBar.draw(canvas);\n        }\n\n        onDrawVerticalScrollBar(canvas:Canvas, scrollBar:Drawable, l:number, t:number, r:number, b:number) {\n            scrollBar.setBounds(l, t, r, b);\n            scrollBar.draw(canvas);\n        }\n\n        isHardwareAccelerated():boolean{\n            return false;//Hardware Accelerate not impl (may use webgl accelerate later?)\n        }\n\n        setDrawingCacheEnabled(enabled:boolean) {\n            this.mCachingFailed = false;\n            this.setFlags(enabled ? View.DRAWING_CACHE_ENABLED : 0, View.DRAWING_CACHE_ENABLED);\n        }\n        isDrawingCacheEnabled():boolean {\n            return (this.mViewFlags & View.DRAWING_CACHE_ENABLED) == View.DRAWING_CACHE_ENABLED;\n        }\n\n        /**\n         * <p>Returns the bitmap in which this view drawing is cached. The returned bitmap\n         * is null when caching is disabled. If caching is enabled and the cache is not ready,\n         * this method will create it. Calling {@link #draw(android.graphics.Canvas)} will not\n         * draw from the cache when the cache is enabled. To benefit from the cache, you must\n         * request the drawing cache by calling this method and draw it on screen if the\n         * returned bitmap is not null.</p>\n         *\n         * <p>Note about auto scaling in compatibility mode: When auto scaling is not enabled,\n         * this method will create a bitmap of the same size as this view. Because this bitmap\n         * will be drawn scaled by the parent ViewGroup, the result on screen might show\n         * scaling artifacts. To avoid such artifacts, you should call this method by setting\n         * the auto scaling to true. Doing so, however, will generate a bitmap of a different\n         * size than the view. This implies that your application must be able to handle this\n         * size.</p>\n         *\n         * @param autoScale Indicates whether the generated bitmap should be scaled based on\n         *        the current density of the screen when the application is in compatibility\n         *        mode.\n         *\n         * @return A bitmap representing this view or null if cache is disabled.\n         *\n         * @see #setDrawingCacheEnabled(boolean)\n         * @see #isDrawingCacheEnabled()\n         * @see #buildDrawingCache(boolean)\n         * @see #destroyDrawingCache()\n         */\n        getDrawingCache(autoScale=false):Canvas  {\n            if ((this.mViewFlags & View.WILL_NOT_CACHE_DRAWING) == View.WILL_NOT_CACHE_DRAWING) {\n                return null;\n            }\n            if ((this.mViewFlags & View.DRAWING_CACHE_ENABLED) == View.DRAWING_CACHE_ENABLED) {\n                this.buildDrawingCache(autoScale);\n            }\n            return this.mUnscaledDrawingCache;\n        }\n\n        /**\n         * Setting a solid background color for the drawing cache's bitmaps will improve\n         * performance and memory usage. Note, though that this should only be used if this\n         * view will always be drawn on top of a solid color.\n         *\n         * @param color The background color to use for the drawing cache's bitmap\n         *\n         * @see #setDrawingCacheEnabled(boolean)\n         * @see #buildDrawingCache()\n         * @see #getDrawingCache()\n         */\n        setDrawingCacheBackgroundColor(color:number):void  {\n            if (color != this.mDrawingCacheBackgroundColor) {\n                this.mDrawingCacheBackgroundColor = color;\n                this.mPrivateFlags &= ~View.PFLAG_DRAWING_CACHE_VALID;\n            }\n        }\n\n        /**\n         * @see #setDrawingCacheBackgroundColor(int)\n         *\n         * @return The background color to used for the drawing cache's bitmap\n         */\n        getDrawingCacheBackgroundColor():number  {\n            return this.mDrawingCacheBackgroundColor;\n        }\n        destroyDrawingCache() {\n            if (this.mUnscaledDrawingCache != null) {\n                this.mUnscaledDrawingCache.recycle();\n                this.mUnscaledDrawingCache = null;\n            }\n        }\n\n        /**\n         * <p>Forces the drawing cache to be built if the drawing cache is invalid.</p>\n         *\n         * <p>If you call {@link #buildDrawingCache()} manually without calling\n         * {@link #setDrawingCacheEnabled(boolean) setDrawingCacheEnabled(true)}, you\n         * should cleanup the cache by calling {@link #destroyDrawingCache()} afterwards.</p>\n         *\n         * <p>Note about auto scaling in compatibility mode: When auto scaling is not enabled,\n         * this method will create a bitmap of the same size as this view. Because this bitmap\n         * will be drawn scaled by the parent ViewGroup, the result on screen might show\n         * scaling artifacts. To avoid such artifacts, you should call this method by setting\n         * the auto scaling to true. Doing so, however, will generate a bitmap of a different\n         * size than the view. This implies that your application must be able to handle this\n         * size.</p>\n         *\n         * <p>You should avoid calling this method when hardware acceleration is enabled. If\n         * you do not need the drawing cache bitmap, calling this method will increase memory\n         * usage and cause the view to be rendered in software once, thus negatively impacting\n         * performance.</p>\n         *\n         * @see #getDrawingCache()\n         * @see #destroyDrawingCache()\n         */\n        buildDrawingCache(autoScale=false):void  {\n            if ((this.mPrivateFlags & View.PFLAG_DRAWING_CACHE_VALID) == 0 || this.mUnscaledDrawingCache == null){\n                this.mCachingFailed = false;\n                let width:number = this.mRight - this.mLeft;\n                let height:number = this.mBottom - this.mTop;\n                const attachInfo:View.AttachInfo = this.mAttachInfo;\n                const drawingCacheBackgroundColor:number = this.mDrawingCacheBackgroundColor;\n                const opaque:boolean = drawingCacheBackgroundColor != 0 || this.isOpaque();\n                //const use32BitCache:boolean = true;\n                const projectedBitmapSize:number = width * height * 4;//(opaque && !use32BitCache ? 2 : 4);\n                const drawingCacheSize:number = ViewConfiguration.get().getScaledMaximumDrawingCacheSize();\n                if (width <= 0 || height <= 0 || projectedBitmapSize > drawingCacheSize) {\n                    if (width > 0 && height > 0) {\n                        Log.w(View.VIEW_LOG_TAG, \"View too large to fit into drawing cache, needs \" + projectedBitmapSize + \" bytes, only \" + drawingCacheSize + \" available\");\n                    }\n                    this.destroyDrawingCache();\n                    this.mCachingFailed = true;\n                    return;\n                }\n\n                if(this.mUnscaledDrawingCache &&\n                    (this.mUnscaledDrawingCache.getWidth()!==width || this.mUnscaledDrawingCache.getHeight()!==height)){\n                    this.mUnscaledDrawingCache.recycle();\n                    this.mUnscaledDrawingCache = null;\n                }\n                if(this.mUnscaledDrawingCache){\n                    this.mUnscaledDrawingCache.clearColor();\n                } else{\n                    this.mUnscaledDrawingCache = new Canvas(width, height);\n                }\n\n                const canvas = this.mUnscaledDrawingCache;\n                this.computeScroll();\n                const restoreCount:number = canvas.save();\n                canvas.translate(-this.mScrollX, -this.mScrollY);\n                this.mPrivateFlags |= View.PFLAG_DRAWN;\n                if (this.mAttachInfo == null || /*!this.mAttachInfo.mHardwareAccelerated ||*/ this.mLayerType != View.LAYER_TYPE_NONE) {\n                    this.mPrivateFlags |= View.PFLAG_DRAWING_CACHE_VALID;\n                }\n\n                // Fast path for layouts with no backgrounds\n                if ((this.mPrivateFlags & View.PFLAG_SKIP_DRAW) == View.PFLAG_SKIP_DRAW) {\n                    this.mPrivateFlags &= ~View.PFLAG_DIRTY_MASK;\n                    this.dispatchDraw(canvas);\n                    if (this.mOverlay != null && !this.mOverlay.isEmpty()) {\n                        this.mOverlay.getOverlayView().draw(canvas);\n                    }\n                } else {\n                    this.draw(canvas);\n                }\n                canvas.restoreToCount(restoreCount);\n            }\n        }\n        setWillNotDraw(willNotDraw:boolean) {\n            this.setFlags(willNotDraw ? View.WILL_NOT_DRAW : 0, View.DRAW_MASK);\n        }\n        willNotDraw():boolean {\n            return (this.mViewFlags & View.DRAW_MASK) == View.WILL_NOT_DRAW;\n        }\n        setWillNotCacheDrawing(willNotCacheDrawing:boolean) {\n            this.setFlags(willNotCacheDrawing ? View.WILL_NOT_CACHE_DRAWING : 0, View.WILL_NOT_CACHE_DRAWING);\n        }\n        willNotCacheDrawing():boolean {\n            return (this.mViewFlags & View.WILL_NOT_CACHE_DRAWING) == View.WILL_NOT_CACHE_DRAWING;\n        }\n\n\n        drawableSizeChange(who : Drawable):void{\n            if(who === this.mBackground) {\n                let w:number = who.getIntrinsicWidth();\n                if (w < 0) w = this.mBackgroundWidth;\n                let h:number = who.getIntrinsicHeight();\n                if (h < 0) h = this.mBackgroundHeight;\n                if (w != this.mBackgroundWidth || h != this.mBackgroundHeight) {\n                    let padding = new Rect();\n                    //this.resetResolvedDrawables();\n                    //background.setLayoutDirection(getLayoutDirection());\n                    if (who.getPadding(padding)) {\n                        //this.resetResolvedPadding();\n                        this.setPadding(padding.left, padding.top, padding.right, padding.bottom);\n                    }\n\n                    this.mBackgroundWidth = w;\n                    this.mBackgroundHeight = h;\n                    this.requestLayout();\n                }\n            }else if(this.verifyDrawable(who)) {\n                //common case, child View should request Layout when drawable size change\n                this.requestLayout();\n            }\n        }\n\n        invalidateDrawable(drawable:Drawable):void{\n            if (this.verifyDrawable(drawable)) {\n                const dirty = drawable.getBounds();\n                const scrollX = this.mScrollX;\n                const scrollY = this.mScrollY;\n\n                this.invalidate(dirty.left + scrollX, dirty.top + scrollY,\n                    dirty.right + scrollX, dirty.bottom + scrollY);\n            }\n        }\n        scheduleDrawable(who:Drawable, what:Runnable, when:number):void{\n            if (this.verifyDrawable(who) && what != null) {\n                const delay = when - SystemClock.uptimeMillis();\n                if (this.mAttachInfo != null) {\n                    this.mAttachInfo.mHandler.postAtTime(what, who, when);\n                } else {\n                    ViewRootImpl.getRunQueue().postDelayed(what, delay);\n                }\n            }\n        }\n        unscheduleDrawable(who:Drawable, what?:Runnable){\n            if (this.verifyDrawable(who) && what != null) {\n                if (this.mAttachInfo != null) {\n                    this.mAttachInfo.mHandler.removeCallbacks(what, who);\n                } else {\n                    ViewRootImpl.getRunQueue().removeCallbacks(what);\n                }\n\n            }else if(what===null){\n                if (this.mAttachInfo != null && who != null) {\n                    this.mAttachInfo.mHandler.removeCallbacksAndMessages(who);\n                }\n            }\n        }\n\n        protected verifyDrawable(who:Drawable):boolean {\n            return who == this.mBackground;\n        }\n        protected drawableStateChanged() {\n            this.getDrawableState();//androidui: fire may state change to stateAttrList\n\n            let d = this.mBackground;\n            if (d != null && d.isStateful()) {\n                d.setState(this.getDrawableState());\n            }\n        }\n        resolveDrawables(){\n            //do nothing\n        }\n        refreshDrawableState() {\n            this.mPrivateFlags |= View.PFLAG_DRAWABLE_STATE_DIRTY;\n            this.drawableStateChanged();\n\n            let parent = this.mParent;\n            if (parent != null) {\n                parent.childDrawableStateChanged(this);\n            }\n        }\n        getDrawableState():Array<number> {\n            if ((this.mDrawableState != null) && ((this.mPrivateFlags & View.PFLAG_DRAWABLE_STATE_DIRTY) == 0)) {\n                return this.mDrawableState;\n            } else {\n                let oldDrawableState = this.mDrawableState;\n                this.mDrawableState = this.onCreateDrawableState(0);\n                this.mPrivateFlags &= ~View.PFLAG_DRAWABLE_STATE_DIRTY;\n                this._fireStateChangeToAttribute(oldDrawableState, this.mDrawableState);\n                return this.mDrawableState;\n            }\n        }\n        protected onCreateDrawableState(extraSpace:number):Array<number> {\n            if ((this.mViewFlags & View.DUPLICATE_PARENT_STATE) == View.DUPLICATE_PARENT_STATE &&\n                this.mParent instanceof View) {\n                return (<View><any>this.mParent).onCreateDrawableState(extraSpace);\n            }\n\n            let drawableState:Array<number>;\n\n            let privateFlags = this.mPrivateFlags;\n\n            let viewStateIndex = 0;\n            if ((privateFlags & View.PFLAG_PRESSED) != 0) viewStateIndex |= View.VIEW_STATE_PRESSED;\n            if ((this.mViewFlags & View.ENABLED_MASK) == View.ENABLED) viewStateIndex |= View.VIEW_STATE_ENABLED;\n            if (this.isFocused()) viewStateIndex |= View.VIEW_STATE_FOCUSED;\n            if ((privateFlags & View.PFLAG_SELECTED) != 0) viewStateIndex |= View.VIEW_STATE_SELECTED;\n            if (this.hasWindowFocus()) viewStateIndex |= View.VIEW_STATE_WINDOW_FOCUSED;\n            if ((privateFlags & View.PFLAG_ACTIVATED) != 0) viewStateIndex |= View.VIEW_STATE_ACTIVATED;\n//        if (mAttachInfo != null && mAttachInfo.mHardwareAccelerationRequested &&\n//                HardwareRenderer.isAvailable()) {\n//            // This is set if HW acceleration is requested, even if the current\n//            // process doesn't allow it.  This is just to allow app preview\n//            // windows to better match their app.\n//            viewStateIndex |= VIEW_STATE_ACCELERATED;\n//        }\n//            if ((privateFlags & View.PFLAG_HOVERED) != 0) viewStateIndex |= View.VIEW_STATE_HOVERED;\n\n            const privateFlags2 = this.mPrivateFlags2;\n            //if ((privateFlags2 & View.PFLAG2_DRAG_CAN_ACCEPT) != 0) viewStateIndex |= View.VIEW_STATE_DRAG_CAN_ACCEPT;//no drag state\n            //if ((privateFlags2 & View.PFLAG2_DRAG_HOVERED) != 0) viewStateIndex |= View.VIEW_STATE_DRAG_HOVERED;\n\n            drawableState = View.VIEW_STATE_SETS[viewStateIndex];\n\n            //noinspection ConstantIfStatement\n            //if (false) {\n            //    Log.i(\"View\", \"drawableStateIndex=\" + viewStateIndex);\n            //    Log.i(\"View\", toString()\n            //        + \" pressed=\" + ((privateFlags & PFLAG_PRESSED) != 0)\n            //        + \" en=\" + ((mViewFlags & ENABLED_MASK) == ENABLED)\n            //        + \" fo=\" + hasFocus()\n            //        + \" sl=\" + ((privateFlags & PFLAG_SELECTED) != 0)\n            //        + \" wf=\" + hasWindowFocus()\n            //        + \": \" + Arrays.toString(drawableState));\n            //}\n\n            if (extraSpace == 0) {\n                return drawableState;\n            }\n\n            let fullState:Array<number>;\n            if (drawableState != null) {\n                fullState = androidui.util.ArrayCreator.newNumberArray(drawableState.length + extraSpace);\n                System.arraycopy(drawableState, 0, fullState, 0, drawableState.length);\n            } else {\n                fullState = androidui.util.ArrayCreator.newNumberArray(extraSpace);\n            }\n\n            return fullState;\n        }\n        static mergeDrawableStates(baseState:Array<number>, additionalState:Array<number>) {\n            const N = baseState.length;\n            let i = N - 1;\n            while (i >= 0 && !baseState[i]) {// 0 or null\n                i--;\n            }\n            System.arraycopy(additionalState, 0, baseState, i + 1, additionalState.length);\n            return baseState;\n        }\n\n        jumpDrawablesToCurrentState() {\n            if (this.mBackground != null) {\n                this.mBackground.jumpToCurrentState();\n            }\n        }\n        setBackgroundColor(color:number) {\n            if (this.mBackground instanceof ColorDrawable) {\n                (<ColorDrawable>this.mBackground.mutate()).setColor(color);\n                this.computeOpaqueFlags();\n                //this.mBackgroundResource = 0;\n            } else {\n                this.setBackground(new ColorDrawable(color));\n            }\n        }\n        setBackground(background:Drawable) {\n            this.setBackgroundDrawable(background);\n        }\n        getBackground():Drawable {\n            return this.mBackground;\n        }\n        setBackgroundDrawable(background:Drawable) {\n            this.computeOpaqueFlags();\n\n            if (background == this.mBackground) {\n                return;\n            }\n\n            let requestLayout = false;\n\n            //this.mBackgroundResource = 0;\n\n            /*\n             * Regardless of whether we're setting a new background or not, we want\n             * to clear the previous drawable.\n             */\n            if (this.mBackground != null) {\n                this.mBackground.setCallback(null);\n                this.unscheduleDrawable(this.mBackground);\n            }\n\n            if (background != null) {\n                let padding = new Rect();\n                //this.resetResolvedDrawables();\n                //background.setLayoutDirection(getLayoutDirection());\n                if (background.getPadding(padding)) {\n                    //this.resetResolvedPadding();\n                    this.setPadding(padding.left, padding.top, padding.right, padding.bottom);\n                }\n\n                // Compare the minimum sizes of the old Drawable and the new.  If there isn't an old or\n                // if it has a different minimum size, we should layout again\n                if (this.mBackground == null || this.mBackground.getMinimumHeight() != background.getMinimumHeight() ||\n                    this.mBackground.getMinimumWidth() != background.getMinimumWidth()) {\n                    requestLayout = true;\n                }\n\n                background.setCallback(this);\n                if (background.isStateful()) {\n                    background.setState(this.getDrawableState());\n                }\n                background.setVisible(this.getVisibility() == View.VISIBLE, false);\n                this.mBackground = background;\n                this.mBackgroundWidth = background.getIntrinsicWidth();\n                this.mBackgroundHeight = background.getIntrinsicHeight();\n\n                if ((this.mPrivateFlags & View.PFLAG_SKIP_DRAW) != 0) {\n                    this.mPrivateFlags &= ~View.PFLAG_SKIP_DRAW;\n                    this.mPrivateFlags |= View.PFLAG_ONLY_DRAWS_BACKGROUND;\n                    requestLayout = true;\n                }\n\n            } else {\n                /* Remove the background */\n                this.mBackground = null;\n                this.mBackgroundWidth = this.mBackgroundHeight = -1;\n\n                if ((this.mPrivateFlags & View.PFLAG_ONLY_DRAWS_BACKGROUND) != 0) {\n                    /*\n                     * This view ONLY drew the background before and we're removing\n                     * the background, so now it won't draw anything\n                     * (hence we SKIP_DRAW)\n                     */\n                    this.mPrivateFlags &= ~View.PFLAG_ONLY_DRAWS_BACKGROUND;\n                    this.mPrivateFlags |= View.PFLAG_SKIP_DRAW;\n                }\n\n                /*\n                 * When the background is set, we try to apply its padding to this\n                 * View. When the background is removed, we don't touch this View's\n                 * padding. This is noted in the Javadocs. Hence, we don't need to\n                 * requestLayout(), the invalidate() below is sufficient.\n                 */\n\n                // The old background's minimum size could have affected this\n                // View's layout, so let's requestLayout\n                requestLayout = true;\n            }\n\n            this.computeOpaqueFlags();\n\n            if (requestLayout) {\n                this.requestLayout();\n            }\n\n            this.mBackgroundSizeChanged = true;\n            this.mShadowDrawable = null;\n            this.invalidate(true);\n        }\n\n        protected computeHorizontalScrollRange():number {\n            return this.getWidth();\n        }\n        protected computeHorizontalScrollOffset():number {\n            return this.mScrollX;\n        }\n        protected computeHorizontalScrollExtent():number {\n            return this.getWidth();\n        }\n        protected computeVerticalScrollRange():number {\n            return this.getHeight();\n        }\n        protected computeVerticalScrollOffset():number {\n            return this.mScrollY;\n        }\n        protected computeVerticalScrollExtent():number {\n            return this.getHeight();\n        }\n        canScrollHorizontally(direction:number):boolean {\n            const offset = this.computeHorizontalScrollOffset();\n            const range = this.computeHorizontalScrollRange() - this.computeHorizontalScrollExtent();\n            if (range == 0) return false;\n            if (direction < 0) {\n                return offset > 0;\n            } else {\n                return offset < range - 1;\n            }\n        }\n        canScrollVertically(direction:number):boolean {\n            const offset = this.computeVerticalScrollOffset();\n            const range = this.computeVerticalScrollRange() - this.computeVerticalScrollExtent();\n            if (range == 0) return false;\n            if (direction < 0) {\n                return offset > 0;\n            } else {\n                return offset < range - 1;\n            }\n        }\n\n        protected overScrollBy(deltaX:number, deltaY:number, scrollX:number, scrollY:number,\n                     scrollRangeX:number, scrollRangeY:number, maxOverScrollX:number, maxOverScrollY:number,\n                     isTouchEvent:boolean):boolean {\n            const overScrollMode = this.mOverScrollMode;\n            const canScrollHorizontal =\n                this.computeHorizontalScrollRange() > this.computeHorizontalScrollExtent();\n            const canScrollVertical =\n                this.computeVerticalScrollRange() > this.computeVerticalScrollExtent();\n            const overScrollHorizontal = overScrollMode == View.OVER_SCROLL_ALWAYS ||\n                (overScrollMode == View.OVER_SCROLL_IF_CONTENT_SCROLLS && canScrollHorizontal);\n            const overScrollVertical = overScrollMode == View.OVER_SCROLL_ALWAYS ||\n                (overScrollMode == View.OVER_SCROLL_IF_CONTENT_SCROLLS && canScrollVertical);\n\n\n            //over drag\n            if(isTouchEvent) {\n                if ((deltaX < 0 && scrollX <= 0) || (deltaX > 0 && scrollX >= scrollRangeX)) {\n                    deltaX /= 2;\n                }\n                if ((deltaY < 0 && scrollY <= 0) || (deltaY > 0 && scrollY >= scrollRangeY)) {\n                    deltaY /= 2;\n                }\n            }\n\n\n\n            let newScrollX = scrollX + deltaX;\n            if (!overScrollHorizontal) {\n                maxOverScrollX = 0;\n            }\n\n            let newScrollY = scrollY + deltaY;\n            if (!overScrollVertical) {\n                maxOverScrollY = 0;\n            }\n\n            // Clamp values if at the limits and record\n            const left = -maxOverScrollX;\n            const right = maxOverScrollX + scrollRangeX;\n            const top = -maxOverScrollY;\n            const bottom = maxOverScrollY + scrollRangeY;\n\n            let clampedX = false;\n            if (newScrollX > right) {\n                newScrollX = right;\n                clampedX = true;\n            } else if (newScrollX < left) {\n                newScrollX = left;\n                clampedX = true;\n            }\n\n            let clampedY = false;\n            if (newScrollY > bottom) {\n                newScrollY = bottom;\n                clampedY = true;\n            } else if (newScrollY < top) {\n                newScrollY = top;\n                clampedY = true;\n            }\n\n            this.onOverScrolled(newScrollX, newScrollY, clampedX, clampedY);\n\n            return clampedX || clampedY;\n        }\n        protected onOverScrolled(scrollX:number, scrollY:number, clampedX:boolean, clampedY:boolean) {\n            // Intentionally empty.\n        }\n        getOverScrollMode() {\n            return this.mOverScrollMode;\n        }\n        setOverScrollMode(overScrollMode:number) {\n            if (overScrollMode != View.OVER_SCROLL_ALWAYS &&\n                overScrollMode != View.OVER_SCROLL_IF_CONTENT_SCROLLS &&\n                overScrollMode != View.OVER_SCROLL_NEVER) {\n                throw new Error(\"Invalid overscroll mode \" + overScrollMode);\n            }\n            this.mOverScrollMode = overScrollMode;\n        }\n        getVerticalScrollFactor():number {\n            if (this.mVerticalScrollFactor == 0) {\n                this.mVerticalScrollFactor = Resources.getDisplayMetrics().density * 1;\n            }\n            return this.mVerticalScrollFactor;\n        }\n        getHorizontalScrollFactor():number {\n            // TODO: Should use something else.\n            return this.getVerticalScrollFactor();\n        }\n        computeScroll() {\n        }\n        scrollTo(x:number, y:number) {\n            if (this.mScrollX != x || this.mScrollY != y) {\n                let oldX = this.mScrollX;\n                let oldY = this.mScrollY;\n                this.mScrollX = x;\n                this.mScrollY = y;\n                this.invalidateParentCaches();\n                this.onScrollChanged(this.mScrollX, this.mScrollY, oldX, oldY);\n                if (!this.awakenScrollBars()) {\n                    this.postInvalidateOnAnimation();\n                }\n            }\n        }\n        scrollBy(x:number, y:number) {\n            this.scrollTo(this.mScrollX + x, this.mScrollY + y);\n        }\n\n        private initialAwakenScrollBars() {\n            return this.mScrollCache != null &&\n                this.awakenScrollBars(this.mScrollCache.scrollBarDefaultDelayBeforeFade * 4, true);\n        }\n\n        awakenScrollBars(startDelay?:number, invalidate=true):boolean{\n            const scrollCache = this.mScrollCache;\n            if(scrollCache==null) return false;\n            startDelay = startDelay || scrollCache.scrollBarDefaultDelayBeforeFade\n\n            if (scrollCache == null || !scrollCache.fadeScrollBars) {\n                return false;\n            }\n\n            if (scrollCache.scrollBar == null) {\n                scrollCache.scrollBar = new ScrollBarDrawable();\n            }\n\n            if (this.isHorizontalScrollBarEnabled() || this.isVerticalScrollBarEnabled()) {\n\n                if (invalidate) {\n                    // Invalidate to show the scrollbars\n                    this.postInvalidateOnAnimation();\n                }\n\n                if (scrollCache.state == ScrollabilityCache.OFF) {\n                    // FIX-ME: this is copied from WindowManagerService.\n                    // We should get this value from the system when it\n                    // is possible to do so.\n                    const KEY_REPEAT_FIRST_DELAY = 750;\n                    startDelay = Math.max(KEY_REPEAT_FIRST_DELAY, startDelay);\n                }\n\n                // Tell mScrollCache when we should start fading. This may\n                // extend the fade start time if one was already scheduled\n                let fadeStartTime = AnimationUtils.currentAnimationTimeMillis() + startDelay;\n                scrollCache.fadeStartTime = fadeStartTime;\n                scrollCache.state = ScrollabilityCache.ON;\n\n                // Schedule our fader to run, unscheduling any old ones first\n                if (this.mAttachInfo != null) {\n                    this.mAttachInfo.mHandler.removeCallbacks(scrollCache);\n                    this.mAttachInfo.mHandler.postAtTime(scrollCache, fadeStartTime);\n                }\n\n                return true;\n            }\n\n            return false;\n        }\n        getVerticalFadingEdgeLength():number{\n            return 0;\n        }\n        setVerticalFadingEdgeEnabled(enable:boolean){\n            //no need impl fade edge. use overscroll instead\n        }\n        setHorizontalFadingEdgeEnabled(enable:boolean){\n            //no need impl fade edge. use overscroll instead\n        }\n        setFadingEdgeLength(length:number){\n            //no need impl fade edge. use overscroll instead\n        }\n        getHorizontalFadingEdgeLength():number {\n            //no need impl fade edge. use overscroll instead\n            return 0;\n        }\n        getVerticalScrollbarWidth():number {\n            let cache = this.mScrollCache;\n            if (cache != null) {\n                let scrollBar = cache.scrollBar;\n                if (scrollBar != null) {\n                    let size = scrollBar.getSize(true);\n                    if (size <= 0) {\n                        size = cache.scrollBarSize;\n                    }\n                    return size;\n                }\n                return 0;\n            }\n            return 0;\n        }\n        getHorizontalScrollbarHeight():number {\n            let cache = this.mScrollCache;\n            if (cache != null) {\n                let scrollBar = cache.scrollBar;\n                if (scrollBar != null) {\n                    let size = scrollBar.getSize(false);\n                    if (size <= 0) {\n                        size = cache.scrollBarSize;\n                    }\n                    return size;\n                }\n                return 0;\n            }\n            return 0;\n        }\n\n        initializeScrollbars(a?:TypedArray):void {\n            this.initScrollCache();\n        }\n        initScrollCache() {\n            if (this.mScrollCache == null) {\n                this.mScrollCache = new ScrollabilityCache(this);\n            }\n        }\n        private getScrollCache():ScrollabilityCache {\n            this.initScrollCache();\n            return this.mScrollCache;\n        }\n\n        isHorizontalScrollBarEnabled():boolean {\n            return (this.mViewFlags & View.SCROLLBARS_HORIZONTAL) == View.SCROLLBARS_HORIZONTAL;\n        }\n        setHorizontalScrollBarEnabled(horizontalScrollBarEnabled:boolean) {\n            if (this.isHorizontalScrollBarEnabled() != horizontalScrollBarEnabled) {\n                this.mViewFlags ^= View.SCROLLBARS_HORIZONTAL;\n                this.computeOpaqueFlags();\n                //this.resolvePadding();\n            }\n        }\n        isVerticalScrollBarEnabled():boolean {\n            return (this.mViewFlags & View.SCROLLBARS_VERTICAL) == View.SCROLLBARS_VERTICAL;\n        }\n        setVerticalScrollBarEnabled(verticalScrollBarEnabled:boolean) {\n            if (this.isVerticalScrollBarEnabled() != verticalScrollBarEnabled) {\n                this.mViewFlags ^= View.SCROLLBARS_VERTICAL;\n                this.computeOpaqueFlags();\n                //this.resolvePadding();\n            }\n        }\n        setScrollbarFadingEnabled(fadeScrollbars:boolean) {\n            this.initScrollCache();\n            const scrollabilityCache = this.mScrollCache;\n            scrollabilityCache.fadeScrollBars = fadeScrollbars;\n            if (fadeScrollbars) {\n                scrollabilityCache.state = ScrollabilityCache.OFF;\n            } else {\n                scrollabilityCache.state = ScrollabilityCache.ON;\n            }\n        }\n        setVerticalScrollbarPosition(position:number){\n            //scrollbar position not impl\n        }\n        setHorizontalScrollbarPosition(position:number){\n            //scrollbar position not impl\n        }\n        setScrollBarStyle(position:number){\n            //scrollbar style not impl\n        }\n        protected getTopFadingEdgeStrength():number{\n            return 0;//no fading edge\n        }\n        protected getBottomFadingEdgeStrength():number{\n            return 0;//no fading edge\n        }\n        protected getLeftFadingEdgeStrength():number{\n            return 0;//no fading edge\n        }\n        protected getRightFadingEdgeStrength():number{\n            return 0;//no fading edge\n        }\n        isScrollbarFadingEnabled():boolean {\n            return this.mScrollCache != null && this.mScrollCache.fadeScrollBars;\n        }\n        getScrollBarDefaultDelayBeforeFade():number {\n            return this.mScrollCache == null ? ViewConfiguration.getScrollDefaultDelay() :\n                this.mScrollCache.scrollBarDefaultDelayBeforeFade;\n        }\n        setScrollBarDefaultDelayBeforeFade(scrollBarDefaultDelayBeforeFade:number) {\n            this.getScrollCache().scrollBarDefaultDelayBeforeFade = scrollBarDefaultDelayBeforeFade;\n        }\n        getScrollBarFadeDuration():number {\n            return this.mScrollCache == null ? ViewConfiguration.getScrollBarFadeDuration() :\n                this.mScrollCache.scrollBarFadeDuration;\n        }\n        setScrollBarFadeDuration(scrollBarFadeDuration:number) {\n            this.getScrollCache().scrollBarFadeDuration = scrollBarFadeDuration;\n        }\n        getScrollBarSize():number {\n            return this.mScrollCache == null ? ViewConfiguration.get().getScaledScrollBarSize() :\n                this.mScrollCache.scrollBarSize;\n        }\n        setScrollBarSize(scrollBarSize:number) {\n            this.getScrollCache().scrollBarSize = scrollBarSize;\n        }\n        hasOpaqueScrollbars():boolean{\n            return true;\n        }\n\n        /*\n         * Caller is responsible for calling requestLayout if necessary.\n         * (This allows addViewInLayout to not request a new layout.)\n         */\n        assignParent(parent:ViewParent) {\n            if (this.mParent == null) {\n                this.mParent = parent;\n            } else if (parent == null) {\n                this.mParent = null;\n            } else {\n                throw new Error(\"view \" + this + \" being added, but\"\n                    + \" it already has a parent\");\n            }\n        }\n\n        protected onFinishInflate():void {\n        }\n\n\n        /**\n         * @hide\n         */\n        dispatchStartTemporaryDetach():void  {\n            //this.clearDisplayList();\n            this.onStartTemporaryDetach();\n        }\n\n        /**\n         * This is called when a container is going to temporarily detach a child, with\n         * {@link ViewGroup#detachViewFromParent(View) ViewGroup.detachViewFromParent}.\n         * It will either be followed by {@link #onFinishTemporaryDetach()} or\n         * {@link #onDetachedFromWindow()} when the container is done.\n         */\n        onStartTemporaryDetach():void  {\n            this.removeUnsetPressCallback();\n            this.mPrivateFlags |= View.PFLAG_CANCEL_NEXT_UP_EVENT;\n        }\n\n        /**\n         * @hide\n         */\n        dispatchFinishTemporaryDetach():void  {\n            this.onFinishTemporaryDetach();\n        }\n\n        /**\n         * Called after {@link #onStartTemporaryDetach} when the container is done\n         * changing the view.\n         */\n        onFinishTemporaryDetach():void  {\n        }\n\n        /**\n         * Called when the window containing this view gains or loses window focus.\n         * ViewGroups should override to route to their children.\n         *\n         * @param hasFocus True if the window containing this view now has focus,\n         *        false otherwise.\n         */\n        dispatchWindowFocusChanged(hasFocus:boolean):void  {\n            this.onWindowFocusChanged(hasFocus);\n        }\n\n        /**\n         * Called when the window containing this view gains or loses focus.  Note\n         * that this is separate from view focus: to receive key events, both\n         * your view and its window must have focus.  If a window is displayed\n         * on top of yours that takes input focus, then your own window will lose\n         * focus but the view focus will remain unchanged.\n         *\n         * @param hasWindowFocus True if the window containing this view now has\n         *        focus, false otherwise.\n         */\n        onWindowFocusChanged(hasWindowFocus:boolean):void  {\n            //let imm:InputMethodManager = InputMethodManager.peekInstance();\n            if (!hasWindowFocus) {\n                if (this.isPressed()) {\n                    this.setPressed(false);\n                }\n                //if (imm != null && (this.mPrivateFlags & View.PFLAG_FOCUSED) != 0) {\n                //    imm.focusOut(this);\n                //}\n                this.removeLongPressCallback();\n                this.removeTapCallback();\n                this.onFocusLost();\n            }\n            //else if (imm != null && (this.mPrivateFlags & View.PFLAG_FOCUSED) != 0) {\n            //    imm.focusIn(this);\n            //}\n            this.refreshDrawableState();\n        }\n\n        /**\n         * Returns true if this view is in a window that currently has window focus.\n         * Note that this is not the same as the view itself having focus.\n         *\n         * @return True if this view is in a window that currently has window focus.\n         */\n        hasWindowFocus():boolean  {\n            return this.mAttachInfo != null && this.mAttachInfo.mHasWindowFocus;\n        }\n\n        /**\n         * @return The number of times this view has been attached to a window\n         */\n        getWindowAttachCount():number  {\n            return this.mWindowAttachCount;\n        }\n        /**\n         * Returns true if this view is currently attached to a window.\n         */\n        isAttachedToWindow():boolean {\n            return this.mAttachInfo != null;\n        }\n\n        dispatchAttachedToWindow(info: View.AttachInfo, visibility:number) {\n            //System.out.println(\"Attached! \" + this);\n            this.mAttachInfo = info;\n\n            if (this.mOverlay != null) {\n                this.mOverlay.getOverlayView().dispatchAttachedToWindow(info, visibility);\n            }\n            this.mWindowAttachCount++;\n            // We will need to evaluate the drawable state at least once.\n            this.mPrivateFlags |= View.PFLAG_DRAWABLE_STATE_DIRTY;\n            if (this.mFloatingTreeObserver != null) {\n                info.mViewRootImpl.mTreeObserver.merge(this.mFloatingTreeObserver);\n                this.mFloatingTreeObserver = null;\n            }\n            if ((this.mPrivateFlags&View.PFLAG_SCROLL_CONTAINER) != 0) {\n                this.mAttachInfo.mScrollContainers.add(this);\n                this.mPrivateFlags |= View.PFLAG_SCROLL_CONTAINER_ADDED;\n            }\n            //performCollectViewAttributes(mAttachInfo, visibility);\n            this.onAttachedToWindow();\n            \n            //AndroidUI: force show debug layout if the view depend on debug layout.\n            if(this.dependOnDebugLayout()){\n                this.getContext().androidUI.viewAttachedDependOnDebugLayout(this);\n            }\n\n            let li = this.mListenerInfo;\n            let listeners = li != null ? li.mOnAttachStateChangeListeners : null;\n            if (listeners != null && listeners.size() > 0) {\n                // NOTE: because of the use of CopyOnWriteArrayList, we *must* use an iterator to\n                // perform the dispatching. The iterator is a safe guard against listeners that\n                // could mutate the list by calling the various add/remove methods. This prevents\n                // the array from being modified while we iterate it.\n                for (let listener of listeners) {\n                    listener.onViewAttachedToWindow(this);\n                }\n            }\n\n            let vis = info.mWindowVisibility;\n            if (vis != View.GONE) {\n                this.onWindowVisibilityChanged(vis);\n            }\n\n            if ((this.mPrivateFlags&View.PFLAG_DRAWABLE_STATE_DIRTY) != 0) {\n                // If nobody has evaluated the drawable state yet, then do it now.\n                this.refreshDrawableState();\n            }\n            //needGlobalAttributesUpdate(false);\n        }\n        protected onAttachedToWindow():void {\n            //if ((this.mPrivateFlags & View.PFLAG_REQUEST_TRANSPARENT_REGIONS) != 0) {\n            //    this.mParent.requestTransparentRegion(this);\n            //}\n\n            if ((this.mPrivateFlags & View.PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH) != 0) {\n                this.initialAwakenScrollBars();\n                this.mPrivateFlags &= ~View.PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH;\n            }\n\n            this.mPrivateFlags3 &= ~View.PFLAG3_IS_LAID_OUT;\n\n            this.jumpDrawablesToCurrentState();\n        }\n\n        dispatchDetachedFromWindow():void {\n            let info = this.mAttachInfo;\n            if (info != null) {\n                let vis = info.mWindowVisibility;\n                if (vis != View.GONE) {\n                    this.onWindowVisibilityChanged(View.GONE);\n                }\n            }\n\n            this.onDetachedFromWindow();\n\n            //AndroidUI: notity debug layout the view depend on debug layout has detached.\n            if(this.dependOnDebugLayout()){\n                this.getContext().androidUI.viewDetachedDependOnDebugLayout(this);\n            }\n\n            let li = this.mListenerInfo;\n            let listeners = li != null ? li.mOnAttachStateChangeListeners : null;\n            if (listeners != null && listeners.size() > 0) {\n                // NOTE: because of the use of CopyOnWriteArrayList, we *must* use an iterator to\n                // perform the dispatching. The iterator is a safe guard against listeners that\n                // could mutate the list by calling the various add/remove methods. This prevents\n                // the array from being modified while we iterate it.\n                for (let listener of listeners) {\n                    listener.onViewDetachedFromWindow(this);\n                }\n            }\n\n            if ((this.mPrivateFlags & View.PFLAG_SCROLL_CONTAINER_ADDED) != 0) {\n                this.mAttachInfo.mScrollContainers.delete(this);\n                this.mPrivateFlags &= ~View.PFLAG_SCROLL_CONTAINER_ADDED;\n            }\n\n            this.mAttachInfo = null;\n            if (this.mOverlay != null) {\n                this.mOverlay.getOverlayView().dispatchDetachedFromWindow();\n            }\n        }\n        protected onDetachedFromWindow():void {\n            this.mPrivateFlags &= ~View.PFLAG_CANCEL_NEXT_UP_EVENT;\n            this.mPrivateFlags3 &= ~View.PFLAG3_IS_LAID_OUT;\n\n            this.removeUnsetPressCallback();\n            this.removeLongPressCallback();\n            this.removePerformClickCallback();\n\n            this.destroyDrawingCache();\n            //this.destroyLayer(false);\n\n            this.cleanupDraw();\n\n            this.mCurrentAnimation = null;\n        }\n        cleanupDraw():void {\n            if (this.mAttachInfo != null) {\n                this.mAttachInfo.mViewRootImpl.cancelInvalidate(this);\n            }\n        }\n        isInEditMode():boolean {\n            return false;//always false\n        }\n        debug(depth=0){\n            //androidui impl:\n            console.dir(this.bindElement);\n        }\n\n\n        toString():String{\n            return this.tagName();\n        }\n        getRootView():View {\n            if (this.mAttachInfo != null) {\n                let v = this.mAttachInfo.mRootView;\n                if (v != null) {\n                    return v;\n                }\n            }\n\n            let parent = this;\n\n            while (parent.mParent != null && parent.mParent instanceof View) {\n                parent = <any>parent.mParent;\n            }\n\n            return parent;\n        }\n        findViewById(id:string):View{\n            if(!id) return null;\n            return this.findViewTraversal(id);\n        }\n        findViewWithTag(tag:any):View{\n            if(!tag) return null;\n            return this.findViewWithTagTraversal(tag);\n        }\n        protected findViewTraversal(id:string):View  {\n            if (id == this.mID) {\n                return this;\n            }\n            return null;\n        }\n        protected findViewWithTagTraversal(tag:any):View{\n            if (tag != null && tag === this.mTag) {\n                return this;\n            }\n            return null;\n        }\n        findViewByPredicate(predicate:View.Predicate<View>) {\n            return this.findViewByPredicateTraversal(predicate, null);\n        }\n        protected findViewByPredicateTraversal(predicate:View.Predicate<View>, childToSkip:View):View {\n            if (predicate.apply(this)) {\n                return this;\n            }\n            return null;\n        }\n        findViewByPredicateInsideOut(start:View, predicate:View.Predicate<View>) {\n            let childToSkip = null;\n            for (;;) {\n                let view = start.findViewByPredicateTraversal(predicate, childToSkip);\n                if (view != null || start == this) {\n                    return view;\n                }\n\n                let parent = start.getParent();\n                if (parent == null || !(parent instanceof View)) {\n                    return null;\n                }\n\n                childToSkip = start;\n                start = <View><any>parent;\n            }\n        }\n        setId(id:string) {\n            this.mID = id;\n        }\n        getId():string {\n            return this.mID;\n        }\n        getTag():any  {\n            return this.mTag;\n        }\n        setTag(tag:any):void  {\n            this.mTag = tag;\n        }\n        setIsRootNamespace(isRoot:boolean) {\n            if (isRoot) {\n                this.mPrivateFlags |= View.PFLAG_IS_ROOT_NAMESPACE;\n            } else {\n                this.mPrivateFlags &= ~View.PFLAG_IS_ROOT_NAMESPACE;\n            }\n        }\n        isRootNamespace():boolean {\n            return (this.mPrivateFlags&View.PFLAG_IS_ROOT_NAMESPACE) != 0;\n        }\n\n        getResources():Resources {\n            let context = this.getContext();\n            if(context!=null){\n                return context.getResources();\n            }\n            return Resources.getSystem();\n        }\n\n        static inflate(context:Context, xml:HTMLElement|string, root?:ViewGroup):View{\n            return LayoutInflater.from(context).inflate(xml, root);\n        }\n\n\n        //bind Element show the layout and extra info\n        bindElement: HTMLElement;\n        private _AttrObserver:MutationObserver;\n        private _stateAttrList = new androidui.attr.StateAttrList(this);\n        private _attrBinder = new AttrBinder(this);\n        private static ViewClassAttrBinderClazzMap = new Map<java.lang.Class, AttrBinder.ClassBinderMap>();\n        static AndroidViewProperty = 'AndroidView';\n        private static _AttrObserverCallBack(arr: MutationRecord[], observer: MutationObserver) {\n            arr.forEach((record)=>{\n                let target = <Element>record.target;\n                let androidView:View = target[View.AndroidViewProperty];\n                if(!androidView) return;\n                let attrName = record.attributeName;\n                let newValue = target.getAttribute(attrName);\n                let oldValue = record.oldValue;\n                if(newValue === oldValue) return;\n                androidView.onBindElementAttributeChanged(attrName, record.oldValue, newValue);\n            });\n        }\n\n        protected initBindElement(bindElement?:HTMLElement):void{\n            if(this.bindElement){\n                this.bindElement[View.AndroidViewProperty] = null;\n            }\n            this.bindElement = bindElement || document.createElement(this.tagName());\n            this.bindElement.style.position = 'absolute';\n\n            let oldBindView:View = this.bindElement[View.AndroidViewProperty];\n            if(oldBindView){\n                if(oldBindView._AttrObserver) oldBindView._AttrObserver.disconnect();\n            }\n            this.bindElement[View.AndroidViewProperty]=this;\n\n            this._initAttrObserver();\n        }\n\n        protected initBindAttr():void {\n            let classAttrBinder = View.ViewClassAttrBinderClazzMap.get(this.getClass());\n            if (!classAttrBinder) {\n                classAttrBinder = this.createClassAttrBinder();\n                View.ViewClassAttrBinderClazzMap.set(this.getClass(), classAttrBinder);\n            }\n            this._attrBinder.setClassAttrBind(classAttrBinder);\n        }\n\n        /**\n         * AndroidUIX add:\n         * override this method to create the attr binder for current view class.\n         * this method will call once when the first view instance of the class create, later will use cache.\n         * Should call super.createClassAttrBinder() when override, so code will be like:\n         *     return super.createClassAttrBinder().set('xxx', {setter(v, value){}, getter(v){}});\n         *\n         * AttrBinder design for:\n         * 1. bind the xml's attr to view\n         * 2. stash stated attr value when change state_xxx attrs value in xml\n         * @returns created class attr binder\n         */\n        protected createClassAttrBinder(): AttrBinder.ClassBinderMap {\n            const classAttrBinder = new AttrBinder.ClassBinderMap()\n                    .set('background', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            v.setBackground(attrBinder.parseDrawable(value));\n                        },\n                        getter(v: View) {\n                            return v.mBackground;\n                        },\n                    }).set('padding', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (value == null) value = 0;\n                            let [top, right, bottom, left] = attrBinder.parsePaddingMarginTRBL(value);\n                            v.setPadding(left, top, right, bottom);\n                        },\n                        getter(v: View) {\n                            return v.mPaddingTop + ' ' + v.mPaddingRight + ' ' + v.mPaddingBottom + ' ' + v.mPaddingLeft;\n                        },\n                    }).set('paddingLeft', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (value == null) value = 0;\n                            v.setPadding(attrBinder.parseDimension(value, 0), v.mPaddingTop, v.mPaddingRight, v.mPaddingBottom);\n                        },\n                        getter(v: View) {\n                            return v.mPaddingLeft;\n                        },\n                    }).set('paddingTop', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (value == null) value = 0;\n                            v.setPadding(v.mPaddingLeft, attrBinder.parseDimension(value, 0), v.mPaddingRight, v.mPaddingBottom);\n                        },\n                        getter(v: View) {\n                            return v.mPaddingTop;\n                        },\n                    }).set('paddingRight', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (value == null) value = 0;\n                            v.setPadding(v.mPaddingLeft, v.mPaddingTop, attrBinder.parseDimension(value, 0), v.mPaddingBottom);\n                        },\n                        getter(v: View) {\n                            return v.mPaddingRight;\n                        },\n                    }).set('paddingBottom', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (value == null) value = 0;\n                            v.setPadding(v.mPaddingLeft, v.mPaddingTop, v.mPaddingRight, attrBinder.parseDimension(value, 0));\n                        },\n                        getter(v: View) {\n                            return v.mPaddingBottom;\n                        },\n                    }).set('scrollX', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            value = attrBinder.parseNumberPixelOffset(value);\n                            if (Number.isInteger(value)) v.scrollTo(value, v.mScrollY);\n                        },\n                        getter(v: View) {\n                            v.getScrollX();\n                        },\n                    }).set('scrollY', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            value = attrBinder.parseNumberPixelOffset(value);\n                            if (Number.isInteger(value)) v.scrollTo(v.mScrollX, value);\n                        },\n                        getter(v: View) {\n                            return v.getScrollY();\n                        },\n                    }).set('alpha', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            v.setAlpha(attrBinder.parseFloat(value, v.getAlpha()));\n                        },\n                        getter(v: View) {\n                            return v.getAlpha();\n                        },\n                    }).set('transformPivotX', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            v.setPivotX(attrBinder.parseNumberPixelOffset(value, v.getPivotX()));\n                        },\n                        getter(v: View) {\n                            return v.getPivotX();\n                        },\n                    }).set('transformPivotY', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            v.setPivotY(attrBinder.parseNumberPixelOffset(value, v.getPivotY()));\n                        },\n                        getter(v: View) {\n                            return v.getPivotY();\n                        },\n                    }).set('translationX', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            v.setTranslationX(attrBinder.parseNumberPixelOffset(value, v.getTranslationX()));\n                        },\n                        getter(v: View) {\n                            return v.getTranslationX();\n                        },\n                    }).set('translationY', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            v.setTranslationY(attrBinder.parseNumberPixelOffset(value, v.getTranslationY()));\n                        },\n                        getter(v: View) {\n                            return v.getTranslationY();\n                        },\n                    }).set('rotation', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            v.setRotation(attrBinder.parseFloat(value, v.getRotation()));\n                        },\n                        getter(v: View) {\n                            return v.getRotation();\n                        },\n                    }).set('scaleX', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            v.setScaleX(attrBinder.parseFloat(value, v.getScaleX()));\n                        },\n                        getter(v: View) {\n                            return v.getScaleX();\n                        },\n                    }).set('scaleY', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            v.setScaleY(attrBinder.parseFloat(value, v.getScaleY()));\n                        },\n                        getter(v: View) {\n                            return v.getScaleY();\n                        },\n                    }).set('tag', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            v.setTag(value);\n                        },\n                        getter(v: View) {\n                            return v.getTag();\n                        },\n                    }).set('id', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            v.setId(value);\n                        },\n                        getter(v: View) {\n                            return v.getId();\n                        },\n                    }).set('focusable', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (attrBinder.parseBoolean(value, false)) {\n                                v.setFlags(View.FOCUSABLE, View.FOCUSABLE_MASK);\n                            }\n                        },\n                        getter(v: View) {\n                            return v.isFocusable();\n                        },\n                    }).set('focusableInTouchMode', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (attrBinder.parseBoolean(value, false)) {\n                                v.setFlags(View.FOCUSABLE_IN_TOUCH_MODE | View.FOCUSABLE,\n                                    View.FOCUSABLE_IN_TOUCH_MODE | View.FOCUSABLE_MASK);\n                            }\n                        },\n                        getter(v: View) {\n                            return v.isFocusableInTouchMode();\n                        },\n                    }).set('clickable', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (attrBinder.parseBoolean(value, false)) {\n                                v.setFlags(View.CLICKABLE, View.CLICKABLE);\n                            }\n                        },\n                        getter(v: View) {\n                            return v.isClickable();\n                        },\n                    }).set('longClickable', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (attrBinder.parseBoolean(value, false)) {\n                                v.setFlags(View.LONG_CLICKABLE, View.LONG_CLICKABLE);\n                            }\n                        },\n                        getter(v: View) {\n                            return v.isLongClickable();\n                        },\n                    }).set('duplicateParentState', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (attrBinder.parseBoolean(value, false)) {\n                                v.setFlags(View.DUPLICATE_PARENT_STATE, View.DUPLICATE_PARENT_STATE);\n                            }\n                        },\n                        getter(v: View) {\n                            return (v.mViewFlags & View.DUPLICATE_PARENT_STATE) == View.DUPLICATE_PARENT_STATE;\n                        },\n                    }).set('visibility', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (value === 'gone') v.setVisibility(View.GONE);\n                            else if (value === 'invisible') v.setVisibility(View.INVISIBLE);\n                            else if (value === 'visible') v.setVisibility(View.VISIBLE);\n                        },\n                        getter(v: View) {\n                            return v.getVisibility();\n                        },\n                    }).set('scrollbars', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (value === 'none') {\n                                v.setHorizontalScrollBarEnabled(false);\n                                v.setVerticalScrollBarEnabled(false);\n                            } else if (value === 'horizontal') {\n                                v.setHorizontalScrollBarEnabled(true);\n                                v.setVerticalScrollBarEnabled(false);\n                            } else if (value === 'vertical') {\n                                v.setHorizontalScrollBarEnabled(false);\n                                v.setVerticalScrollBarEnabled(true);\n                            }\n                        },\n                    }).set('isScrollContainer', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (attrBinder.parseBoolean(value, false)) {\n                                v.setScrollContainer(true);\n                            }\n                        },\n                        getter(v: View) {\n                            return v.isScrollContainer();\n                        },\n                    }).set('minWidth', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            v.setMinimumWidth(attrBinder.parseNumberPixelSize(value, 0));\n                        },\n                        getter(v: View) {\n                            return v.mMinWidth;\n                        },\n                    }).set('minHeight', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            v.setMinimumHeight(attrBinder.parseNumberPixelSize(value, 0));\n                        },\n                        getter(v: View) {\n                            return v.mMinHeight;\n                        },\n                    }).set('onClick', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (value && typeof value === 'string') {\n                                v.setOnClickListenerByAttrValueString(value);\n                            }\n                            // remove attr to avoid when debug layout show dom to click again on safari.\n                            v.bindElement.removeAttribute('onclick');\n                        },\n                    }).set('overScrollMode', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            let scrollMode = View[('OVER_SCROLL_' + value).toUpperCase()];\n                            if (scrollMode === undefined) scrollMode = View.OVER_SCROLL_IF_CONTENT_SCROLLS;\n                            v.setOverScrollMode(scrollMode);\n                        }\n                    }).set('layerType', {\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if ((value + '').toLowerCase() == 'software') {\n                                v.setLayerType(View.LAYER_TYPE_SOFTWARE);\n                            } else {\n                                v.setLayerType(View.LAYER_TYPE_NONE);\n                            }\n                        }\n                    }).set('cornerRadius', { // androidui add\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            let [topRight, rightBottom, bottomLeft, leftTop] = attrBinder.parsePaddingMarginTRBL(value);\n                            v.setCornerRadius(leftTop, topRight, rightBottom, bottomLeft);\n                        },\n                        getter(v: View) {\n                            return v.mCornerRadiusTopRight + ' ' + v.mCornerRadiusBottomRight + ' ' + v.mCornerRadiusBottomLeft + ' ' + v.mCornerRadiusTopLeft;\n                        },\n                    }).set('cornerRadiusTopLeft', { // androidui add\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            v.setCornerRadiusTopLeft(attrBinder.parseNumberPixelSize(value, v.mCornerRadiusTopLeft));\n                        },\n                        getter(v: View) {\n                            return v.mCornerRadiusTopLeft;\n                        },\n                    }).set('cornerRadiusTopRight', { // androidui add\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            v.setCornerRadiusTopRight(attrBinder.parseNumberPixelSize(value, v.mCornerRadiusTopRight));\n                        },\n                        getter(v: View) {\n                            return v.mCornerRadiusTopRight;\n                        },\n                    }).set('cornerRadiusBottomLeft', { // androidui add\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            v.setCornerRadiusBottomLeft(attrBinder.parseNumberPixelSize(value, v.mCornerRadiusBottomLeft));\n                        },\n                        getter(v: View) {\n                            return v.mCornerRadiusBottomLeft;\n                        },\n                    }).set('cornerRadiusBottomRight', { // androidui add\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            v.setCornerRadiusBottomRight(attrBinder.parseNumberPixelSize(value, v.mCornerRadiusBottomRight));\n                        },\n                        getter(v: View) {\n                            return v.mCornerRadiusBottomRight;\n                        },\n                    }).set('viewShadowColor', { // androidui add\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (!v.mShadowPaint) v.mShadowPaint = new Paint();\n                            v.setShadowView(v.mShadowPaint.shadowRadius, v.mShadowPaint.shadowDx, v.mShadowPaint.shadowDy,\n                                attrBinder.parseColor(value, v.mShadowPaint.shadowColor));\n                        },\n                        getter(v: View) {\n                            if (v.mShadowPaint) return v.mShadowPaint.shadowColor;\n                        },\n                    }).set('viewShadowDx', { // androidui add\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (!v.mShadowPaint) v.mShadowPaint = new Paint();\n                            let dx = attrBinder.parseNumberPixelSize(value, v.mShadowPaint.shadowDx);\n                            v.setShadowView(v.mShadowPaint.shadowRadius, dx, v.mShadowPaint.shadowDy, v.mShadowPaint.shadowColor);\n                        },\n                        getter(v: View) {\n                            if (v.mShadowPaint) return v.mShadowPaint.shadowDx;\n                        },\n                    }).set('viewShadowDy', { // androidui add\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (!v.mShadowPaint) v.mShadowPaint = new Paint();\n                            let dy = attrBinder.parseNumberPixelSize(value, v.mShadowPaint.shadowDy);\n                            v.setShadowView(v.mShadowPaint.shadowRadius, v.mShadowPaint.shadowDx, dy, v.mShadowPaint.shadowColor);\n                        },\n                        getter(v: View) {\n                            if (v.mShadowPaint) return v.mShadowPaint.shadowDy;\n                        },\n                    }).set('viewShadowRadius', { // androidui add\n                        setter(v: View, value: any, attrBinder:AttrBinder) {\n                            if (!v.mShadowPaint) v.mShadowPaint = new Paint();\n                            let radius = attrBinder.parseNumberPixelSize(value, v.mShadowPaint.shadowRadius);\n                            v.setShadowView(radius, v.mShadowPaint.shadowDx, v.mShadowPaint.shadowDy, v.mShadowPaint.shadowColor);\n                        },\n                        getter(v: View) {\n                            if (v.mShadowPaint) return v.mShadowPaint.shadowRadius;\n                        },\n                    });\n            classAttrBinder.set('paddingStart', classAttrBinder.get('paddingLeft'));\n            classAttrBinder.set('paddingEnd', classAttrBinder.get('paddingRight'));\n            return classAttrBinder;\n        }\n\n        private _syncToElementLock:boolean;\n        private _syncToElementImmediatelyLock:boolean;\n        private _syncToElementRun: Runnable;\n\n        requestSyncBoundToElement(immediately=this.dependOnDebugLayout()):void {\n            let rootView = this.getRootView();\n            if(!rootView) return;\n\n            if(!rootView._syncToElementRun){\n                rootView._syncToElementRun = {\n                    run:()=>{\n                        rootView._syncToElementLock = false;\n                        rootView._syncToElementImmediatelyLock = false;\n                        rootView._syncBoundAndScrollToElement();\n                    }\n                };\n            }\n\n            if(immediately){\n                if(rootView._syncToElementImmediatelyLock) return;\n                rootView._syncToElementImmediatelyLock = true;\n                rootView._syncToElementLock = true;\n                rootView.removeCallbacks(rootView._syncToElementRun);\n                rootView.post(rootView._syncToElementRun);\n                return;\n            }\n            if(rootView._syncToElementLock) return;\n            rootView._syncToElementLock = true;\n            rootView.postDelayed(rootView._syncToElementRun, 1000);\n        }\n\n        private _lastSyncLeft:number;\n        private _lastSyncTop:number;\n        private _lastSyncWidth:number;\n        private _lastSyncHeight:number;\n        private _lastSyncScrollX:number;\n        private _lastSyncScrollY:number;\n        // sync bound to element from rootView\n        protected _syncBoundAndScrollToElement():void {\n            if(!this.isAttachedToWindow()){\n                return;\n            }\n            //bound\n            const left = this.mLeft;\n            const top = this.mTop;\n            const width = this.getWidth();\n            const height = this.getHeight();\n            const parent = this.getParent();\n            const pScrollX = parent instanceof View ? (<View><any>parent).mScrollX : 0;\n            const pScrollY = parent instanceof View ? (<View><any>parent).mScrollY : 0;\n\n            if(left !== this._lastSyncLeft || top !== this._lastSyncTop\n                || width !== this._lastSyncWidth || height !== this._lastSyncHeight\n                || pScrollX !== this._lastSyncScrollX || pScrollY !== this._lastSyncScrollY) {\n                this._lastSyncLeft = left;\n                this._lastSyncTop = top;\n                this._lastSyncWidth = width;\n                this._lastSyncHeight = height;\n                this._lastSyncScrollX = pScrollX;\n                this._lastSyncScrollY = pScrollY;\n\n\n                const density = this.getResources().getDisplayMetrics().density;\n                let bind = this.bindElement;\n\n                bind.style.width = width / density + 'px';\n                bind.style.height = height / density + 'px';\n\n                bind.style.left = (left-pScrollX)/density + 'px';\n                bind.style.top = (top-pScrollY)/density + 'px';\n\n                if (bind.parentElement) { // some case browser will do scroll to show input element. reset it.\n                    bind.parentElement.scrollTop = 0;\n                }\n\n                this.getMatrix(); // sync matrix to element\n            }\n\n            // children sync bound\n            if(this instanceof ViewGroup){\n                const group = <ViewGroup><View>this;\n                for (var i = 0 ,  count = group.getChildCount(); i<count; i++){\n                    group.getChildAt(i)._syncBoundAndScrollToElement();\n                }\n            }\n        }\n\n        private static TempMatrixValue = androidui.util.ArrayCreator.newNumberArray(9);\n        private _lastSyncTransform:string;\n        protected _syncMatrixToElement(){\n            let matrix = this.mTransformationInfo == null ? Matrix.IDENTITY_MATRIX : this.mTransformationInfo.mMatrix;\n            matrix = matrix || Matrix.IDENTITY_MATRIX;\n            let v = View.TempMatrixValue;\n            matrix.getValues(v);\n\n            let transfrom = `matrix(${v[Matrix.MSCALE_X]}, ${-v[Matrix.MSKEW_X]}, ${-v[Matrix.MSKEW_Y]}, ${v[Matrix.MSCALE_Y]}, ${v[Matrix.MTRANS_X]}, ${v[Matrix.MTRANS_Y]})`;\n            if(this._lastSyncTransform != transfrom){\n                this._lastSyncTransform = this.bindElement.style.transform = this.bindElement.style.webkitTransform = transfrom;\n            }\n        }\n\n        syncVisibleToElement(){\n            let visibility = this.getVisibility();\n            if(visibility === View.VISIBLE){\n                this.bindElement.style.display = '';\n                this.bindElement.style.visibility = '';\n\n            }else if(visibility === View.INVISIBLE){\n                this.bindElement.style.display = '';\n                this.bindElement.style.visibility = 'hidden';\n            }else{\n                this.bindElement.style.display = 'none';\n                this.bindElement.style.visibility = '';\n            }\n        }\n        \n        protected dependOnDebugLayout(){\n            return false;\n        }\n\n        private _initAttrObserver(){\n            if(!window['MutationObserver']) return;\n            if(!this._AttrObserver) this._AttrObserver = new MutationObserver(View._AttrObserverCallBack);\n            else this._AttrObserver.disconnect();\n            this._AttrObserver.observe(this.bindElement, {attributes : true, attributeOldValue : true});\n        }\n\n        private  _fireStateChangeToAttribute(oldState:number[], newState:number[]){\n            if(!this._stateAttrList) return;\n            if(java.util.Arrays.equals(oldState, newState)) return;\n\n            let oldMatchedAttr = this._stateAttrList.getMatchedStateAttr(oldState);\n            let matchedAttr = this._stateAttrList.getMatchedStateAttr(newState);\n\n            //let attrMap = matchedAttr.createDiffKeyAsNullValueAttrMap(oldMatchedAttr);\n            for(let [key, value] of matchedAttr.getAttrMap().entries()){\n                let attrValue = this._getBinderAttrValue(key);\n\n                //set the current value to oldStateAttr, so if state change back, current value will restore\n                if(oldMatchedAttr) {\n                    oldMatchedAttr.setAttr(key, attrValue);\n                }\n\n                if(value == attrValue) continue;\n\n                this.onBindElementAttributeChanged(key, null, value);\n            }\n        }\n\n        private _getBinderAttrValue(key:string):string {\n            if(!key) return null;\n            if(key.startsWith('layout_') || key.startsWith('android:layout_')) {\n                let params = this.getLayoutParams();\n                if(params){\n                    return params.getAttrBinder().getAttrValue(key);\n                }\n            }else{\n                return this._attrBinder.getAttrValue(key);\n            }\n        }\n\n        private onBindElementAttributeChanged(attributeName:string, oldVal:string, newVal:string):void {\n            //remove namespace 'android:'\n            let parts = attributeName.split(\":\");\n            let attrName = parts[parts.length-1].toLowerCase();\n            if(newVal === 'true') newVal = <any>true;\n            else if(newVal === 'false') newVal = <any>false;\n\n            //layout attr\n            if(attrName.startsWith('layout_')){\n                let params = this.getLayoutParams();\n                if(params){\n                    params.getAttrBinder().onAttrChange(attrName, newVal, this.getContext());\n                    this.requestLayout();\n                }\n                return;\n            }\n\n            this._attrBinder.onAttrChange(attrName, newVal, this.getContext());\n        }\n\n        tagName() : string{\n            return this.constructor.name;\n        }\n    }\n\n    export module View{\n\n        export class TransformationInfo {\n\n            /**\n             * The transform matrix for the View. This transform is calculated internally\n             * based on the rotation, scaleX, and scaleY properties. The identity matrix\n             * is used by default. Do *not* use this variable directly; instead call\n             * getMatrix(), which will automatically recalculate the matrix if necessary\n             * to get the correct matrix based on the latest rotation and scale properties.\n             */\n            mMatrix:Matrix = new Matrix();\n\n            /**\n             * The transform matrix for the View. This transform is calculated internally\n             * based on the rotation, scaleX, and scaleY properties. The identity matrix\n             * is used by default. Do *not* use this variable directly; instead call\n             * getInverseMatrix(), which will automatically recalculate the matrix if necessary\n             * to get the correct matrix based on the latest rotation and scale properties.\n             */\n            private mInverseMatrix:Matrix;\n\n            /**\n             * An internal variable that tracks whether we need to recalculate the\n             * transform matrix, based on whether the rotation or scaleX/Y properties\n             * have changed since the matrix was last calculated.\n             */\n            mMatrixDirty:boolean = false;\n\n            /**\n             * An internal variable that tracks whether we need to recalculate the\n             * transform matrix, based on whether the rotation or scaleX/Y properties\n             * have changed since the matrix was last calculated.\n             */\n            mInverseMatrixDirty:boolean = true;\n\n            /**\n             * A variable that tracks whether we need to recalculate the\n             * transform matrix, based on whether the rotation or scaleX/Y properties\n             * have changed since the matrix was last calculated. This variable\n             * is only valid after a call to updateMatrix() or to a function that\n             * calls it such as getMatrix(), hasIdentityMatrix() and getInverseMatrix().\n             */\n            mMatrixIsIdentity:boolean = true;\n\n            ///**\n            // * The Camera object is used to compute a 3D matrix when rotationX or rotationY are set.\n            // */\n            //private mCamera:Camera = null;\n            //\n            ///**\n            // * This matrix is used when computing the matrix for 3D rotations.\n            // */\n            //private matrix3D:Matrix = null;\n\n            /**\n             * These prev values are used to recalculate a centered pivot point when necessary. The\n             * pivot point is only used in matrix operations (when rotation, scale, or translation are\n             * set), so thes values are only used then as well.\n             */\n            mPrevWidth:number = -1;\n\n            mPrevHeight:number = -1;\n\n            ///**\n            // * The degrees rotation around the vertical axis through the pivot point.\n            // */\n            //mRotationY:number = 0;\n            //\n            ///**\n            // * The degrees rotation around the horizontal axis through the pivot point.\n            // */\n            //mRotationX:number = 0;\n\n            /**\n             * The degrees rotation around the pivot point.\n             */\n            mRotation:number = 0;\n\n            /**\n             * The amount of translation of the object away from its left property (post-layout).\n             */\n            mTranslationX:number = 0;\n\n            /**\n             * The amount of translation of the object away from its top property (post-layout).\n             */\n            mTranslationY:number = 0;\n\n            /**\n             * The amount of scale in the x direction around the pivot point. A\n             * value of 1 means no scaling is applied.\n             */\n            mScaleX:number = 1;\n\n            /**\n             * The amount of scale in the y direction around the pivot point. A\n             * value of 1 means no scaling is applied.\n             */\n            mScaleY:number = 1;\n\n            /**\n             * The x location of the point around which the view is rotated and scaled.\n             */\n            mPivotX:number = 0;\n\n            /**\n             * The y location of the point around which the view is rotated and scaled.\n             */\n            mPivotY:number = 0;\n\n            /**\n             * The opacity of the View. This is a value from 0 to 1, where 0 means\n             * completely transparent and 1 means completely opaque.\n             */\n            mAlpha:number = 1;\n\n            /**\n             * The opacity of the view as manipulated by the Fade transition. This is a hidden\n             * property only used by transitions, which is composited with the other alpha\n             * values to calculate the final visual alpha value.\n             */\n            mTransitionAlpha:number = 1;\n        }\n\n        export class MeasureSpec {\n            static MODE_SHIFT = 30;\n            static MODE_MASK = 0x3 << MeasureSpec.MODE_SHIFT;\n            static UNSPECIFIED = 0 << MeasureSpec.MODE_SHIFT;\n            static EXACTLY = 1 << MeasureSpec.MODE_SHIFT;\n            static AT_MOST = 2 << MeasureSpec.MODE_SHIFT;\n\n            static makeMeasureSpec(size, mode) {\n                return (size & ~MeasureSpec.MODE_MASK) | (mode & MeasureSpec.MODE_MASK);\n            }\n\n            static getMode(measureSpec) {\n                return (measureSpec & MeasureSpec.MODE_MASK);\n            }\n\n            static getSize(measureSpec) {\n                return (measureSpec & ~MeasureSpec.MODE_MASK);\n            }\n\n            static adjust(measureSpec, delta) {\n                return MeasureSpec.makeMeasureSpec(\n                    MeasureSpec.getSize(measureSpec + delta), MeasureSpec.getMode(measureSpec));\n            }\n\n            static toString(measureSpec) {\n                let mode = MeasureSpec.getMode(measureSpec);\n                let size = MeasureSpec.getSize(measureSpec);\n\n                let sb = new StringBuilder(\"MeasureSpec: \");\n\n                if (mode == MeasureSpec.UNSPECIFIED)\n                    sb.append(\"UNSPECIFIED \");\n                else if (mode == MeasureSpec.EXACTLY)\n                    sb.append(\"EXACTLY \");\n                else if (mode == MeasureSpec.AT_MOST)\n                    sb.append(\"AT_MOST \");\n                else\n                    sb.append(mode).append(\" \");\n\n                sb.append(size);\n                return sb.toString();\n            }\n        }\n        export class AttachInfo {\n            mRootView:View;//root view of window\n            //mWindowLeft = 0;\n            //mWindowTop = 0;\n            mKeyDispatchState = new KeyEvent.DispatcherState();\n            //mDrawingTime=0;\n            //mCanvas : Canvas;\n            mViewRootImpl : ViewRootImpl;\n            mHandler : Handler;\n            mTmpInvalRect = new Rect();\n            mTmpTransformRect = new Rect();\n            mPoint:Point = new Point();\n            /**\n             * Temporary for use in transforming invalidation rect\n             */\n            mTmpMatrix:Matrix = new Matrix();\n            /**\n             * Temporary for use in transforming invalidation rect\n             */\n            mTmpTransformation:Transformation = new Transformation();\n            mTmpTransformLocation:number[] = androidui.util.ArrayCreator.newNumberArray(2);\n            mScrollContainers = new Set<View>();\n            //mViewScrollChanged = false;\n            //mTreeObserver = new ViewTreeObserver();\n            mViewRequestingLayout:View;\n            //mViewVisibilityChanged = false;\n            mInvalidateChildLocation = androidui.util.ArrayCreator.newNumberArray(2);\n            mHasWindowFocus = false;\n            mWindowVisibility = 0;\n            //mInTouchMode = false;\n\n            constructor(mViewRootImpl:ViewRootImpl, mHandler:Handler) {\n                this.mViewRootImpl = mViewRootImpl;\n                this.mHandler = mHandler;\n            }\n\n        }\n\n        export class ListenerInfo{\n            mOnFocusChangeListener:OnFocusChangeListener;\n            mOnAttachStateChangeListeners:CopyOnWriteArrayList<OnAttachStateChangeListener>;\n            mOnLayoutChangeListeners:ArrayList<OnLayoutChangeListener>;\n            mOnClickListener:OnClickListener;\n            mOnLongClickListener:OnLongClickListener;\n            mOnTouchListener:OnTouchListener;\n            mOnKeyListener:OnKeyListener;\n            mOnGenericMotionListener:OnGenericMotionListener;\n\n        }\n\n        export interface OnAttachStateChangeListener{\n            onViewAttachedToWindow(v:View);\n            onViewDetachedFromWindow(v:View);\n        }\n        export interface OnLayoutChangeListener{\n            onLayoutChange(v:View, left:number , top:number, right:number, bottom:number,\n                           oldLeft:number, oldTop:number , oldRight:number , oldBottom:number):void;\n        }\n        export interface OnClickListener{\n            onClick(v:View):void;\n        }\n        export module OnClickListener{\n            export function fromFunction(func:(v:View)=>void):OnClickListener {\n                return {\n                    onClick : func\n                }\n            }\n        }\n        export interface OnLongClickListener{\n            onLongClick(v:View):boolean;\n        }\n        export module OnLongClickListener{\n            export function fromFunction(func:(v:View)=>boolean):OnLongClickListener {\n                return {\n                    onLongClick : func\n                }\n            }\n        }\n        export interface OnFocusChangeListener{\n            onFocusChange(v:View, hasFocus:boolean):void;\n        }\n        export module OnFocusChangeListener{\n            export function fromFunction(func:(v:View, hasFocus:boolean)=>void):OnFocusChangeListener {\n                return {\n                    onFocusChange : func\n                }\n            }\n        }\n        export interface OnTouchListener{\n            onTouch(v:View, event:MotionEvent):void;\n        }\n        export module OnTouchListener{\n            export function fromFunction(func:(v:View, event:MotionEvent)=>void):OnTouchListener {\n                return {\n                    onTouch : func\n                }\n            }\n        }\n        export interface OnKeyListener{\n            onKey(v:View, keyCode:number, event:KeyEvent):void;\n        }\n        export module OnKeyListener{\n            export function fromFunction(func:(v:View, keyCode:number, event:KeyEvent)=>void):OnKeyListener {\n                return {\n                    onKey : func\n                }\n            }\n        }\n        export interface OnGenericMotionListener{\n            onGenericMotion(v:View, event:MotionEvent);\n        }\n        export module OnGenericMotionListener{\n            export function fromFunction(func:(v:View, event:MotionEvent)=>void):OnGenericMotionListener {\n                return {\n                    onGenericMotion : func\n                }\n            }\n        }\n\n        export interface Predicate<T>{\n            apply(t:T):boolean;\n        }\n    }\n    export module View.AttachInfo{\n        export class InvalidateInfo{\n            private static POOL_LIMIT = 10;\n\n            private static sPool = new Pools.SynchronizedPool<InvalidateInfo>(InvalidateInfo.POOL_LIMIT);\n\n            target:View;\n\n            left = 0;\n            top = 0;\n            right = 0;\n            bottom = 0;\n\n            static obtain():InvalidateInfo {\n                let instance = InvalidateInfo.sPool.acquire();\n                return (instance != null) ? instance : new InvalidateInfo();\n            }\n\n            recycle():void {\n                this.target = null;\n                InvalidateInfo.sPool.release(this);\n            }\n        }\n    }\n\n\n    class CheckForLongPress implements Runnable{\n        private View_this : any;//don't check private\n        private mOriginalWindowAttachCount = 0;\n\n        constructor(View_this:View) {\n            this.View_this = View_this;\n        }\n\n        run() {\n            if (this.View_this.isPressed() && (this.View_this.mParent != null)\n                && this.mOriginalWindowAttachCount == this.View_this.mWindowAttachCount) {\n                if (this.View_this.performLongClick()) {\n                    this.View_this.mHasPerformedLongPress = true;\n                }\n            }\n        }\n\n        rememberWindowAttachCount() {\n            this.mOriginalWindowAttachCount = this.View_this.mWindowAttachCount;\n        }\n    }\n    class CheckForTap implements Runnable {\n        private View_this : any;\n        constructor(View_this:View) {\n            this.View_this = View_this;\n        }\n        run() {\n            this.View_this.mPrivateFlags &= ~View.PFLAG_PREPRESSED;\n            this.View_this.setPressed(true);\n            this.View_this.checkForLongClick(ViewConfiguration.getTapTimeout());\n        }\n    }\n    class PerformClick implements Runnable {\n        private View_this : any;\n        constructor(View_this:View) {\n            this.View_this = View_this;\n        }\n        run() {\n            this.View_this.performClick();\n        }\n    }\n    class PerformClickAfterPressDraw implements Runnable {\n        private View_this : any;\n        constructor(View_this:View) {\n            this.View_this = View_this;\n        }\n        run() {\n            this.View_this.post(this.View_this.mPerformClick);\n        }\n    }\n    class UnsetPressedState implements Runnable {\n        private View_this : any;\n        constructor(View_this:View) {\n            this.View_this = View_this;\n        }\n        run() {\n            this.View_this.setPressed(false);\n        }\n    }\n    class ScrollabilityCache implements Runnable {\n        static OFF = 0;\n        static ON = 1;\n        static FADING = 2;\n\n        fadeScrollBars = true;\n        fadingEdgeLength = ViewConfiguration.get().getScaledFadingEdgeLength();\n        scrollBarDefaultDelayBeforeFade = ViewConfiguration.getScrollDefaultDelay();\n        scrollBarFadeDuration = ViewConfiguration.getScrollBarFadeDuration();\n\n        scrollBarSize = ViewConfiguration.get().getScaledScrollBarSize();\n        scrollBar:ScrollBarDrawable;\n        //interpolatorValues:Array<number>;\n        private interpolator = new LinearInterpolator();\n        host:View;\n        paint:Paint;\n\n        fadeStartTime:number;\n        state = ScrollabilityCache.OFF;\n\n        constructor(host:View){\n            this.host = host;\n\n            this.scrollBar = new ScrollBarDrawable();\n\n\n            //no track\n            //let track = null;\n            //this.scrollBar.setHorizontalTrackDrawable(track);\n            //this.scrollBar.setVerticalTrackDrawable(track);\n\n            let thumbColor = new ColorDrawable(0x44000000);\n            let density = Resources.getDisplayMetrics().density;\n            let thumb = new InsetDrawable(thumbColor, 0, 2*density, ViewConfiguration.get().getScaledScrollBarSize()/2, 2*density);\n            this.scrollBar.setHorizontalThumbDrawable(thumb);\n            this.scrollBar.setVerticalThumbDrawable(thumb);\n        }\n\n        run() {\n            let now = AnimationUtils.currentAnimationTimeMillis();\n            if (now >= this.fadeStartTime) {\n\n                //TODO compute scroll bar optical\n\n                this.state = ScrollabilityCache.FADING;\n                // Kick off the fade animation\n                this.host.invalidate(true);\n            }\n        }\n\n        _computeAlphaToScrollBar(){\n            let now = AnimationUtils.currentAnimationTimeMillis();\n            let factor = (now - this.fadeStartTime) / this.scrollBarFadeDuration;\n            if(factor>=1){\n                this.state = ScrollabilityCache.OFF;\n                factor = 1;\n            }\n            let alpha = 1 - this.interpolator.getInterpolation(factor);\n            this.scrollBar.setAlpha(255 * alpha);\n        }\n\n    }\n    class MatchIdPredicate implements View.Predicate<View>{\n        mId:string;\n        apply(view:View):boolean {\n            return view.mID === this.mId;\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/ViewConfiguration.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../util/SparseArray.ts\"/>\n///<reference path=\"../content/res/Resources.ts\"/>\n\nmodule android.view{\n    import SparseArray = android.util.SparseArray;\n\n    /**\n     * Contains methods to standard constants used in the UI for timeouts, sizes, and distances.\n     */\n    export class ViewConfiguration{\n        /**\n         * Defines the width of the horizontal scrollbar and the height of the vertical scrollbar in\n         * dips\n         */\n        private static SCROLL_BAR_SIZE = 8;\n        /**\n         * Duration of the fade when scrollbars fade away in milliseconds\n         */\n        private static SCROLL_BAR_FADE_DURATION = 250;\n        /**\n         * Default delay before the scrollbars fade in milliseconds\n         */\n        private static SCROLL_BAR_DEFAULT_DELAY = 300;\n        /**\n         * Defines the length of the fading edges in dips\n         */\n        private static FADING_EDGE_LENGTH = 12;\n        /**\n         * Defines the duration in milliseconds of the pressed state in child\n         * components.\n         */\n        private static PRESSED_STATE_DURATION = 64;\n        /**\n         * Defines the default duration in milliseconds before a press turns into\n         * a long press\n         */\n        private static DEFAULT_LONG_PRESS_TIMEOUT = 500;\n        /**\n         * Defines the time between successive key repeats in milliseconds.\n         */\n        private static KEY_REPEAT_DELAY = 50;\n        /**\n         * Defines the duration in milliseconds a user needs to hold down the\n         * appropriate button to bring up the global actions dialog (power off,\n         * lock screen, etc).\n         */\n        private static GLOBAL_ACTIONS_KEY_TIMEOUT = 500;\n        /**\n         * Defines the duration in milliseconds we will wait to see if a touch event\n         * is a tap or a scroll. If the user does not move within this interval, it is\n         * considered to be a tap.\n         */\n        private static TAP_TIMEOUT = 180;\n        /**\n         * Defines the duration in milliseconds we will wait to see if a touch event\n         * is a jump tap. If the user does not complete the jump tap within this interval, it is\n         * considered to be a tap.\n         */\n        private static JUMP_TAP_TIMEOUT = 500;\n        /**\n         * Defines the duration in milliseconds between the first tap's up event and\n         * the second tap's down event for an interaction to be considered a\n         * double-tap.\n         */\n        private static DOUBLE_TAP_TIMEOUT = 300;\n        /**\n         * Defines the minimum duration in milliseconds between the first tap's up event and\n         * the second tap's down event for an interaction to be considered a\n         * double-tap.\n         */\n        private static DOUBLE_TAP_MIN_TIME = 40;\n        /**\n         * Defines the maximum duration in milliseconds between a touch pad\n         * touch and release for a given touch to be considered a tap (click) as\n         * opposed to a hover movement gesture.\n         */\n        private static HOVER_TAP_TIMEOUT = 150;\n        /**\n         * Defines the maximum distance in pixels that a touch pad touch can move\n         * before being released for it to be considered a tap (click) as opposed\n         * to a hover movement gesture.\n         */\n        private static HOVER_TAP_SLOP = 20;\n        /**\n         * Defines the duration in milliseconds we want to display zoom controls in response\n         * to a user panning within an application.\n         */\n        private static ZOOM_CONTROLS_TIMEOUT = 3000;\n        /**\n         * Inset in dips to look for touchable content when the user touches the edge of the screen\n         */\n        public static EDGE_SLOP = 12;\n        /**\n         * Distance a touch can wander before we think the user is scrolling in dips.\n         * Note that this value defined here is only used as a fallback by legacy/misbehaving\n         * applications that do not provide a Context for determining density/configuration-dependent\n         * values.\n         *\n         * To alter this value, see the configuration resource config_viewConfigurationTouchSlop\n         * in frameworks/base/core/res/res/values/config.xml or the appropriate device resource overlay.\n         * It may be appropriate to tweak this on a device-specific basis in an overlay based on\n         * the characteristics of the touch panel and firmware.\n         */\n        private static TOUCH_SLOP = 8;\n        /**\n         * Distance the first touch can wander before we stop considering this event a double tap\n         * (in dips)\n         */\n        private static DOUBLE_TAP_TOUCH_SLOP = ViewConfiguration.TOUCH_SLOP;\n        /**\n         * Distance a touch can wander before we think the user is attempting a paged scroll\n         * (in dips)\n         *\n         * Note that this value defined here is only used as a fallback by legacy/misbehaving\n         * applications that do not provide a Context for determining density/configuration-dependent\n         * values.\n         *\n         * See the note above on {@link #TOUCH_SLOP} regarding the dimen resource\n         * config_viewConfigurationTouchSlop. ViewConfiguration will report a paging touch slop of\n         * config_viewConfigurationTouchSlop * 2 when provided with a Context.\n         */\n        private static PAGING_TOUCH_SLOP = ViewConfiguration.TOUCH_SLOP * 2;\n        /**\n         * Distance in dips between the first touch and second touch to still be considered a double tap\n         */\n        private static DOUBLE_TAP_SLOP = 100;\n        /**\n         * Distance in dips a touch needs to be outside of a window's bounds for it to\n         * count as outside for purposes of dismissing the window.\n         */\n        private static WINDOW_TOUCH_SLOP = 16;\n        /**\n         * Minimum velocity to initiate a fling, as measured in dips per second\n         */\n        private static MINIMUM_FLING_VELOCITY = 50;\n        /**\n         * Maximum velocity to initiate a fling, as measured in dips per second\n         */\n        private static MAXIMUM_FLING_VELOCITY = 8000;\n\n        /**\n         * The maximum size of View's drawing cache, expressed in bytes. This size\n         * should be at least equal to the size of the screen in ARGB888 format.\n         */\n        //private static MAXIMUM_DRAWING_CACHE_SIZE:number = 480 * 800 * 4;\n\n        /**\n         * The coefficient of friction applied to flings/scrolls.\n         */\n        private static SCROLL_FRICTION = 0.015;\n        /**\n         * Max distance in dips to overscroll for edge effects\n         */\n        private static OVERSCROLL_DISTANCE = 800;//defaul 0\n        /**\n         * Max distance in dips to overfling for edge effects\n         */\n        private static OVERFLING_DISTANCE = 100;//default 6\n\n        static instance : ViewConfiguration;\n\n        /**\n         * Returns a configuration for the specified context. The configuration depends on\n         * various parameters of the context, like the dimension of the display or the\n         * density of the display.\n         *\n         * @param context The application context used to initialize the view configuration.\n         */\n        static get(arg?:any):ViewConfiguration{\n            if(!ViewConfiguration.instance){\n                ViewConfiguration.instance = new ViewConfiguration();\n            }\n            return ViewConfiguration.instance;\n        }\n\n        private density = android.content.res.Resources.getDisplayMetrics().density;\n        private sizeAndDensity = this.density;\n        mEdgeSlop:number = this.sizeAndDensity * ViewConfiguration.EDGE_SLOP;\n        mFadingEdgeLength:number = this.sizeAndDensity * ViewConfiguration.FADING_EDGE_LENGTH;\n        mMinimumFlingVelocity:number = this.density * ViewConfiguration.MINIMUM_FLING_VELOCITY;\n        mMaximumFlingVelocity:number = this.density * ViewConfiguration.MAXIMUM_FLING_VELOCITY;\n        mScrollbarSize:number = this.density * ViewConfiguration.SCROLL_BAR_SIZE;\n        mTouchSlop:number = this.density * ViewConfiguration.TOUCH_SLOP;\n        mDoubleTapTouchSlop:number = this.sizeAndDensity * ViewConfiguration.DOUBLE_TAP_TOUCH_SLOP;\n        mPagingTouchSlop:number = this.density * ViewConfiguration.PAGING_TOUCH_SLOP;\n        mDoubleTapSlop:number = this.density * ViewConfiguration.DOUBLE_TAP_SLOP;\n        mWindowTouchSlop:number = this.sizeAndDensity * ViewConfiguration.WINDOW_TOUCH_SLOP;\n        mOverscrollDistance:number = this.sizeAndDensity * ViewConfiguration.OVERSCROLL_DISTANCE;\n        mOverflingDistance:number = this.sizeAndDensity * ViewConfiguration.OVERFLING_DISTANCE;\n        mMaximumDrawingCacheSize:number = android.content.res.Resources.getDisplayMetrics().widthPixels\n            * android.content.res.Resources.getDisplayMetrics().heightPixels * 4 * 2;//android ui x2\n\n        /**\n         * @return The width of the horizontal scrollbar and the height of the vertical\n         *         scrollbar in pixels\n         */\n        getScaledScrollBarSize():number {\n            return this.mScrollbarSize;\n        }\n        /**\n         * @return Duration of the fade when scrollbars fade away in milliseconds\n         */\n        static getScrollBarFadeDuration():number {\n            return ViewConfiguration.SCROLL_BAR_FADE_DURATION;\n        }\n        /**\n         * @return Default delay before the scrollbars fade in milliseconds\n         */\n        static getScrollDefaultDelay():number {\n            return ViewConfiguration.SCROLL_BAR_DEFAULT_DELAY;\n        }\n        /**\n         * @return the length of the fading edges in pixels\n         */\n        getScaledFadingEdgeLength():number {\n            return this.mFadingEdgeLength;\n        }\n        /**\n         * @return the duration in milliseconds of the pressed state in child\n         * components.\n         */\n        static getPressedStateDuration():number {\n            return ViewConfiguration.PRESSED_STATE_DURATION;\n        }\n        /**\n         * @return the duration in milliseconds before a press turns into\n         * a long press\n         */\n        static getLongPressTimeout():number {\n            return ViewConfiguration.DEFAULT_LONG_PRESS_TIMEOUT;\n        }\n        /**\n         * @return the time between successive key repeats in milliseconds.\n         */\n        static getKeyRepeatDelay():number {\n            return ViewConfiguration.KEY_REPEAT_DELAY;\n        }\n        /**\n         * @return the duration in milliseconds we will wait to see if a touch event\n         * is a tap or a scroll. If the user does not move within this interval, it is\n         * considered to be a tap.\n         */\n        static getTapTimeout():number {\n            return ViewConfiguration.TAP_TIMEOUT;\n        }\n        /**\n         * @return the duration in milliseconds we will wait to see if a touch event\n         * is a jump tap. If the user does not move within this interval, it is\n         * considered to be a tap.\n         */\n        static getJumpTapTimeout():number {\n            return ViewConfiguration.JUMP_TAP_TIMEOUT;\n        }\n        /**\n         * @return the duration in milliseconds between the first tap's up event and\n         * the second tap's down event for an interaction to be considered a\n         * double-tap.\n         */\n        static getDoubleTapTimeout():number {\n            return ViewConfiguration.DOUBLE_TAP_TIMEOUT;\n        }\n        /**\n         * @return the minimum duration in milliseconds between the first tap's\n         * up event and the second tap's down event for an interaction to be considered a\n         * double-tap.\n         *\n         * @hide\n         */\n        static getDoubleTapMinTime():number {\n            return ViewConfiguration.DOUBLE_TAP_MIN_TIME;\n        }\n        /**\n         * @return Inset in pixels to look for touchable content when the user touches the edge of the\n         *         screen\n         */\n        getScaledEdgeSlop():number {\n            return this.mEdgeSlop;\n        }\n        /**\n         * @return Distance in pixels a touch can wander before we think the user is scrolling\n         */\n        getScaledTouchSlop():number {\n            return this.mTouchSlop;\n        }\n        /**\n         * @return Distance in pixels the first touch can wander before we do not consider this a\n         * potential double tap event\n         * @hide\n         */\n        getScaledDoubleTapTouchSlop():number {\n            return this.mDoubleTapTouchSlop;\n        }\n        /**\n         * @return Distance in pixels a touch can wander before we think the user is scrolling a full\n         * page\n         */\n        getScaledPagingTouchSlop() {\n            return this.mPagingTouchSlop;\n        }\n        /**\n         * @return Distance in pixels between the first touch and second touch to still be\n         *         considered a double tap\n         */\n        getScaledDoubleTapSlop() {\n            return this.mDoubleTapSlop;\n        }\n        /**\n         * @return Distance in pixels a touch must be outside the bounds of a window for it\n         * to be counted as outside the window for purposes of dismissing that window.\n         */\n        getScaledWindowTouchSlop() {\n            return this.mWindowTouchSlop;\n        }\n        /**\n         * @return Minimum velocity to initiate a fling, as measured in pixels per second.\n         */\n        getScaledMinimumFlingVelocity() {\n            return this.mMinimumFlingVelocity;\n        }\n        /**\n         * @return Maximum velocity to initiate a fling, as measured in pixels per second.\n         */\n        getScaledMaximumFlingVelocity() {\n            return this.mMaximumFlingVelocity;\n        }\n\n        /**\n         * The maximum drawing cache size expressed in bytes.\n         *\n         * @return the maximum size of View's drawing cache expressed in bytes\n         */\n        getScaledMaximumDrawingCacheSize():number  {\n            return this.mMaximumDrawingCacheSize;\n        }\n        /**\n         * @return The maximum distance a View should overscroll by when showing edge effects (in\n         * pixels).\n         */\n        getScaledOverscrollDistance() {\n            return this.mOverscrollDistance;\n        }\n        /**\n         * @return The maximum distance a View should overfling by when showing edge effects (in\n         * pixels).\n         */\n        getScaledOverflingDistance() {\n            return this.mOverflingDistance;\n        }\n        /**\n         * The amount of friction applied to scrolls and flings.\n         *\n         * @return A scalar dimensionless value representing the coefficient of\n         *         friction.\n         */\n        static getScrollFriction() {\n            return ViewConfiguration.SCROLL_FRICTION;\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/ViewGroup.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"ViewOverlay.ts\"/>\n///<reference path=\"ViewRootImpl.ts\"/>\n///<reference path=\"View.ts\"/>\n///<reference path=\"MotionEvent.ts\"/>\n///<reference path=\"ViewParent.ts\"/>\n///<reference path=\"../graphics/Canvas.ts\"/>\n///<reference path=\"../graphics/Point.ts\"/>\n///<reference path=\"../graphics/Matrix.ts\"/>\n///<reference path=\"../graphics/Rect.ts\"/>\n///<reference path=\"../graphics/RectF.ts\"/>\n///<reference path=\"../os/SystemClock.ts\"/>\n///<reference path=\"../util/TypedValue.ts\"/>\n///<reference path=\"../content/Context.ts\"/>\n///<reference path=\"FocusFinder.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"animation/Animation.ts\"/>\n///<reference path=\"animation/Transformation.ts\"/>\n\n\n\n\nmodule android.view {\n    import Canvas = android.graphics.Canvas;\n    import Point = android.graphics.Point;\n    import Rect = android.graphics.Rect;\n    import RectF = android.graphics.RectF;\n    import Matrix = android.graphics.Matrix;\n    import SystemClock = android.os.SystemClock;\n    import Context = android.content.Context;\n    import System = java.lang.System;\n    import ArrayList = java.util.ArrayList;\n    import Integer = java.lang.Integer;\n    import Animation = android.view.animation.Animation;\n    import Transformation = android.view.animation.Transformation;\n    import AttrBinder = androidui.attr.AttrBinder;\n    import ClassBinderMap = androidui.attr.AttrBinder.ClassBinderMap;\n\n    export abstract class ViewGroup extends View implements ViewParent {\n        static FLAG_CLIP_CHILDREN = 0x1;\n        static FLAG_CLIP_TO_PADDING = 0x2;\n        static FLAG_INVALIDATE_REQUIRED = 0x4;\n        static FLAG_RUN_ANIMATION = 0x8;\n        static FLAG_ANIMATION_DONE = 0x10;\n        static FLAG_PADDING_NOT_NULL = 0x20;\n        static FLAG_ANIMATION_CACHE = 0x40;\n        static FLAG_OPTIMIZE_INVALIDATE = 0x80;\n        static FLAG_CLEAR_TRANSFORMATION = 0x100;\n        static FLAG_NOTIFY_ANIMATION_LISTENER = 0x200;\n        static FLAG_USE_CHILD_DRAWING_ORDER = 0x400;\n        static FLAG_SUPPORT_STATIC_TRANSFORMATIONS = 0x800;\n        static FLAG_ALPHA_LOWER_THAN_ONE = 0x1000;\n        static FLAG_ADD_STATES_FROM_CHILDREN = 0x2000;\n        static FLAG_ALWAYS_DRAWN_WITH_CACHE = 0x4000;\n        static FLAG_CHILDREN_DRAWN_WITH_CACHE = 0x8000;\n        static FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE = 0x10000;\n        static FLAG_MASK_FOCUSABILITY = 0x60000;\n        static FOCUS_BEFORE_DESCENDANTS = 0x20000;\n        static FOCUS_AFTER_DESCENDANTS = 0x40000;\n        static FOCUS_BLOCK_DESCENDANTS = 0x60000;\n        static FLAG_DISALLOW_INTERCEPT = 0x80000;\n        static FLAG_SPLIT_MOTION_EVENTS = 0x200000;\n        static FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW = 0x400000;\n        static FLAG_LAYOUT_MODE_WAS_EXPLICITLY_SET = 0x800000;\n\n        /**\n         * Indicates which types of drawing caches are to be kept in memory.\n         * This field should be made private, so it is hidden from the SDK.\n         * {@hide}\n         */\n        mPersistentDrawingCache:number;\n\n        /**\n         * Used to indicate that no drawing cache should be kept in memory.\n         */\n        static PERSISTENT_NO_CACHE:number = 0x0;\n\n        /**\n         * Used to indicate that the animation drawing cache should be kept in memory.\n         */\n        static PERSISTENT_ANIMATION_CACHE:number = 0x1;\n\n        /**\n         * Used to indicate that the scrolling drawing cache should be kept in memory.\n         */\n        static PERSISTENT_SCROLLING_CACHE:number = 0x2;\n\n        /**\n         * Used to indicate that all drawing caches should be kept in memory.\n         */\n        static PERSISTENT_ALL_CACHES:number = 0x3;\n\n        static LAYOUT_MODE_UNDEFINED = -1;\n        static LAYOUT_MODE_CLIP_BOUNDS = 0;\n        //static LAYOUT_MODE_OPTICAL_BOUNDS = 1;\n        static LAYOUT_MODE_DEFAULT = ViewGroup.LAYOUT_MODE_CLIP_BOUNDS;\n        static CLIP_TO_PADDING_MASK = ViewGroup.FLAG_CLIP_TO_PADDING | ViewGroup.FLAG_PADDING_NOT_NULL;\n\n        /**\n         * Views which have been hidden or removed which need to be animated on\n         * their way out.\n         * This field should be made private, so it is hidden from the SDK.\n         * {@hide}\n         */\n        protected mDisappearingChildren:ArrayList<View>;\n        mOnHierarchyChangeListener:ViewGroup.OnHierarchyChangeListener;\n        private mFocused:View;\n        private mFirstTouchTarget:TouchTarget;\n        /**\n         * A Transformation used when drawing children, to\n         * apply on the child being drawn.\n         */\n        private mChildTransformation:Transformation;\n        /**\n         * Used to track the current invalidation region.\n         */\n        protected mInvalidateRegion:RectF;\n\n        // For debugging only.  You can see these in hierarchyviewer.\n        private mLastTouchDownTime = 0;\n        private mLastTouchDownIndex = -1;\n        private mLastTouchDownX = 0;\n        private mLastTouchDownY = 0;\n        mGroupFlags=0;\n        mLayoutMode = ViewGroup.LAYOUT_MODE_UNDEFINED;\n        mChildren:Array<View> = [];\n\n        get mChildrenCount() {\n            return this.mChildren.length;\n        }\n\n        mSuppressLayout = false;\n        private mLayoutCalledWhileSuppressed = false;\n        private mChildCountWithTransientState = 0;\n        private static ViewGroupClassAttrBind:AttrBinder.ClassBinderMap;\n\n        constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>){\n            super(context, bindElement, defStyle);\n            this.initViewGroup();\n            if (bindElement || defStyle) {\n                this.initFromAttributes(context, bindElement, defStyle);\n            }\n        }\n\n        private initViewGroup() {\n            // ViewGroup doesn't draw by default\n            this.setFlags(View.WILL_NOT_DRAW, View.DRAW_MASK);\n            this.mGroupFlags |= ViewGroup.FLAG_CLIP_CHILDREN;\n            this.mGroupFlags |= ViewGroup.FLAG_CLIP_TO_PADDING;\n            this.mGroupFlags |= ViewGroup.FLAG_ANIMATION_DONE;\n            this.mGroupFlags |= ViewGroup.FLAG_ANIMATION_CACHE;\n            this.mGroupFlags |= ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE;\n\n            this.mGroupFlags |= ViewGroup.FLAG_SPLIT_MOTION_EVENTS;\n\n            this.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);\n\n            this.mPersistentDrawingCache = ViewGroup.PERSISTENT_SCROLLING_CACHE;\n        }\n\n        private initFromAttributes(context:Context, attrs:HTMLElement, defStyle?:Map<string, string>) {\n            const a = context.obtainStyledAttributes(attrs, defStyle);\n\n            for (let attr of a.getLowerCaseNoNamespaceAttrNames()) {\n                switch (attr) {\n                    case 'clipchildren':\n                        this.setClipChildren(a.getBoolean(attr, true));\n                        break;\n                    case 'cliptopadding':\n                        this.setClipToPadding(a.getBoolean(attr, true));\n                        break;\n                    case 'animationcache':\n                        this.setAnimationCacheEnabled(a.getBoolean(attr, true));\n                        break;\n                    case 'persistentdrawingcache': {\n                        let value = a.getAttrValue(attr);\n                        if (value === 'none') this.setPersistentDrawingCache(ViewGroup.PERSISTENT_NO_CACHE);\n                        else if (value === 'animation') this.setPersistentDrawingCache(ViewGroup.PERSISTENT_ANIMATION_CACHE);\n                        else if (value === 'scrolling') this.setPersistentDrawingCache(ViewGroup.PERSISTENT_SCROLLING_CACHE);\n                        else if (value === 'all') this.setPersistentDrawingCache(ViewGroup.PERSISTENT_ALL_CACHES);\n                        break;\n                    }\n                    case 'addstatesfromchildren':\n                        this.setAddStatesFromChildren(a.getBoolean(attr, false));\n                        break;\n                    case 'alwaysdrawnwithcache':\n                        this.setAlwaysDrawnWithCacheEnabled(a.getBoolean(attr, true));\n                        break;\n                    case 'layoutanimation': // TODO when layout anim support\n                        // int id = a.getResourceId(attr, -1);\n                        // if (id > 0) {\n                        //     setLayoutAnimation(AnimationUtils.loadLayoutAnimation(mContext, id));\n                        // }\n                        break;\n                    case 'descendantfocusability': {\n                        let value = a.getAttrValue(attr);\n                        if (value == 'beforeDescendants') this.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);\n                        else if (value == 'afterDescendants') this.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);\n                        else if (value == 'blocksDescendants') this.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);\n                        break;\n                    }\n                    case 'splitmotionevents':\n                        this.setMotionEventSplittingEnabled(a.getBoolean(attr, false));\n                        break;\n                    case 'animatelayoutchanges': //TODO when layout transition support\n                        // let animateLayoutChanges = a.getBoolean(attr, false);\n                        // if (animateLayoutChanges) {\n                        //     this.setLayoutTransition(new LayoutTransition());\n                        // }\n                        break;\n                    case 'layoutmode': //TODO when more layout mode support\n                        // this.setLayoutMode(a.getInt(attr, LAYOUT_MODE_UNDEFINED));\n                        break;\n                }\n            }\n\n            a.recycle();\n        }\n\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n            return super.createClassAttrBinder()\n                .set('clipChildren', {\n                    setter(v:ViewGroup, value:any, attrBinder:AttrBinder) {\n                        v.setClipChildren(attrBinder.parseBoolean(value));\n                    },\n                    getter(v:ViewGroup) {\n                        return v.getClipChildren();\n                    }\n                }).set('clipToPadding', {\n                    setter(v:ViewGroup, value:any, attrBinder:AttrBinder) {\n                        v.setClipToPadding(attrBinder.parseBoolean(value));\n                    },\n                    getter(v:ViewGroup) {\n                        return v.isClipToPadding();\n                    }\n                }).set('animationCache', {\n                    setter(v:ViewGroup, value:any, attrBinder:AttrBinder) {\n                        v.setAnimationCacheEnabled(attrBinder.parseBoolean(value, true));\n                    }\n                }).set('persistentDrawingCache', {\n                    setter(v:ViewGroup, value:any, attrBinder:AttrBinder) {\n                        if(value === 'none') v.setPersistentDrawingCache(ViewGroup.PERSISTENT_NO_CACHE);\n                        else if(value === 'animation') v.setPersistentDrawingCache(ViewGroup.PERSISTENT_ANIMATION_CACHE);\n                        else if(value === 'scrolling') v.setPersistentDrawingCache(ViewGroup.PERSISTENT_SCROLLING_CACHE);\n                        else if(value === 'all') v.setPersistentDrawingCache(ViewGroup.PERSISTENT_ALL_CACHES);\n                    }\n                }).set('addStatesFromChildren', {\n                    setter(v:ViewGroup, value:any, attrBinder:AttrBinder) {\n                        v.setAddStatesFromChildren(attrBinder.parseBoolean(value, false));\n                    }\n                }).set('alwaysDrawnWithCache', {\n                    setter(v:ViewGroup, value:any, attrBinder:AttrBinder) {\n                        v.setAlwaysDrawnWithCacheEnabled(attrBinder.parseBoolean(value, true));\n                    }\n                }).set('descendantFocusability', {\n                    setter(v:ViewGroup, value:any, attrBinder:AttrBinder) {\n                        if(value == 'beforeDescendants') this.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);\n                        else if(value == 'afterDescendants') this.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);\n                        else if(value == 'blocksDescendants') this.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);\n                    }\n                }).set('splitMotionEvents', {\n                    setter(v:ViewGroup, value:any, attrBinder:AttrBinder) {\n                        v.setMotionEventSplittingEnabled(attrBinder.parseBoolean(value, false));\n                    }\n                });\n        }\n\n        getDescendantFocusability():number {\n            return this.mGroupFlags & ViewGroup.FLAG_MASK_FOCUSABILITY;\n        }\n        setDescendantFocusability(focusability:number) {\n            switch (focusability) {\n                case ViewGroup.FOCUS_BEFORE_DESCENDANTS:\n                case ViewGroup.FOCUS_AFTER_DESCENDANTS:\n                case ViewGroup.FOCUS_BLOCK_DESCENDANTS:\n                    break;\n                default:\n                    throw new Error(\"must be one of FOCUS_BEFORE_DESCENDANTS, \"\n                        + \"FOCUS_AFTER_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS\");\n            }\n            this.mGroupFlags &= ~ViewGroup.FLAG_MASK_FOCUSABILITY;\n            this.mGroupFlags |= (focusability & ViewGroup.FLAG_MASK_FOCUSABILITY);\n        }\n\n        handleFocusGainInternal(direction:number, previouslyFocusedRect:Rect) {\n            if (this.mFocused != null) {\n                this.mFocused.unFocus();\n                this.mFocused = null;\n            }\n            super.handleFocusGainInternal(direction, previouslyFocusedRect);\n        }\n        requestChildFocus(child:View, focused:View) {\n            if (View.DBG) {\n                System.out.println(this + \" requestChildFocus()\");\n            }\n            if (this.getDescendantFocusability() == ViewGroup.FOCUS_BLOCK_DESCENDANTS) {\n                return;\n            }\n\n            // Unfocus us, if necessary\n            super.unFocus();\n\n            // We had a previous notion of who had focus. Clear it.\n            if (this.mFocused != child) {\n                if (this.mFocused != null) {\n                    this.mFocused.unFocus();\n                }\n\n                this.mFocused = child;\n            }\n            if (this.mParent != null) {\n                this.mParent.requestChildFocus(this, focused);\n            }\n        }\n        focusableViewAvailable(v:View) {\n            if (this.mParent != null\n                    // shortcut: don't report a new focusable view if we block our descendants from\n                    // getting focus\n                && (this.getDescendantFocusability() != ViewGroup.FOCUS_BLOCK_DESCENDANTS)\n                    // shortcut: don't report a new focusable view if we already are focused\n                    // (and we don't prefer our descendants)\n                    //\n                    // note: knowing that mFocused is non-null is not a good enough reason\n                    // to break the traversal since in that case we'd actually have to find\n                    // the focused view and make sure it wasn't FOCUS_AFTER_DESCENDANTS and\n                    // an ancestor of v; this will get checked for at ViewAncestor\n                && !(this.isFocused() && this.getDescendantFocusability() != ViewGroup.FOCUS_AFTER_DESCENDANTS)) {\n                this.mParent.focusableViewAvailable(v);\n            }\n        }\n        focusSearch(direction:number):View;\n        focusSearch(focused:View, direction:number):View;\n        focusSearch(...args):View {\n            if(arguments.length === 1){\n                return super.focusSearch(args[0]);\n            }\n            const focused:View = <View>args[0];\n            const direction:number = args[1];\n            if (this.isRootNamespace()) {\n                // root namespace means we should consider ourselves the top of the\n                // tree for focus searching; otherwise we could be focus searching\n                // into other tabs.  see LocalActivityManager and TabHost for more info\n                return FocusFinder.getInstance().findNextFocus(this, focused, direction);\n            } else if (this.mParent != null) {\n                return this.mParent.focusSearch(focused, direction);\n            }\n            return null;\n        }\n        requestChildRectangleOnScreen(child:View, rectangle:Rect, immediate:boolean) {\n            return false;\n        }\n        childHasTransientStateChanged(child:View, childHasTransientState:boolean) {\n            const oldHasTransientState = this.hasTransientState();\n            if (childHasTransientState) {\n                this.mChildCountWithTransientState++;\n            } else {\n                this.mChildCountWithTransientState--;\n            }\n\n            const newHasTransientState = this.hasTransientState();\n            if (this.mParent != null && oldHasTransientState != newHasTransientState) {\n                this.mParent.childHasTransientStateChanged(this, newHasTransientState);\n            }\n        }\n        hasTransientState():boolean {\n            return this.mChildCountWithTransientState > 0 || super.hasTransientState();\n        }\n\n        dispatchUnhandledMove(focused:android.view.View, direction:number):boolean {\n            return this.mFocused != null && this.mFocused.dispatchUnhandledMove(focused, direction);\n        }\n        clearChildFocus(child:View) {\n            if (View.DBG) {\n                System.out.println(this + \" clearChildFocus()\");\n            }\n\n            this.mFocused = null;\n            if (this.mParent != null) {\n                this.mParent.clearChildFocus(this);\n            }\n        }\n        clearFocus() {\n            if (View.DBG) {\n                System.out.println(this + \" clearFocus()\");\n            }\n            if (this.mFocused == null) {\n                super.clearFocus();\n            } else {\n                let focused = this.mFocused;\n                this.mFocused = null;\n                focused.clearFocus();\n            }\n        }\n        unFocus() {\n            if (View.DBG) {\n                System.out.println(this + \" unFocus()\");\n            }\n            if (this.mFocused == null) {\n                super.unFocus();\n            } else {\n                this.mFocused.unFocus();\n                this.mFocused = null;\n            }\n        }\n        getFocusedChild():View {\n            return this.mFocused;\n        }\n        hasFocus():boolean {\n            return (this.mPrivateFlags & View.PFLAG_FOCUSED) != 0 || this.mFocused != null;\n        }\n        findFocus():View {\n            if (ViewGroup.DBG) {\n                System.out.println(\"Find focus in \" + this + \": flags=\" + this.isFocused() + \", child=\" + this.mFocused);\n            }\n\n            if (this.isFocused()) {\n                return this;\n            }\n\n            if (this.mFocused != null) {\n                return this.mFocused.findFocus();\n            }\n            return null;\n        }\n\n\n        hasFocusable():boolean {\n            if ((this.mViewFlags & View.VISIBILITY_MASK) != View.VISIBLE) {\n                return false;\n            }\n\n            if (this.isFocusable()) {\n                return true;\n            }\n\n            const descendantFocusability = this.getDescendantFocusability();\n            if (descendantFocusability != ViewGroup.FOCUS_BLOCK_DESCENDANTS) {\n                const count = this.mChildrenCount;\n                const children = this.mChildren;\n\n                for (let i = 0; i < count; i++) {\n                    const child = children[i];\n                    if (child.hasFocusable()) {\n                        return true;\n                    }\n                }\n            }\n\n            return false;\n        }\n\n\n        addFocusables(views:ArrayList<View>, direction:number, focusableMode = View.FOCUSABLES_TOUCH_MODE):void {\n            const focusableCount = views.size();\n\n            const descendantFocusability = this.getDescendantFocusability();\n\n            if (descendantFocusability != ViewGroup.FOCUS_BLOCK_DESCENDANTS) {\n                const count = this.mChildrenCount;\n                const children = this.mChildren;\n\n                for (let i = 0; i < count; i++) {\n                    const child = children[i];\n                    if ((child.mViewFlags & View.VISIBILITY_MASK) == View.VISIBLE) {\n                        child.addFocusables(views, direction, focusableMode);\n                    }\n                }\n            }\n\n            // we add ourselves (if focusable) in all cases except for when we are\n            // FOCUS_AFTER_DESCENDANTS and there are some descendants focusable.  this is\n            // to avoid the focus search finding layouts when a more precise search\n            // among the focusable children would be more interesting.\n            if (descendantFocusability != ViewGroup.FOCUS_AFTER_DESCENDANTS\n                    // No focusable descendants\n                || (focusableCount == views.size())) {\n                super.addFocusables(views, direction, focusableMode);\n            }\n        }\n\n        requestFocus(direction=View.FOCUS_DOWN, previouslyFocusedRect=null):boolean {\n            if (View.DBG) {\n                System.out.println(this + \" ViewGroup.requestFocus direction=\"\n                    + direction);\n            }\n            let descendantFocusability = this.getDescendantFocusability();\n\n            switch (descendantFocusability) {\n                case ViewGroup.FOCUS_BLOCK_DESCENDANTS:\n                    return super.requestFocus(direction, previouslyFocusedRect);\n                case ViewGroup.FOCUS_BEFORE_DESCENDANTS: {\n                    const took = super.requestFocus(direction, previouslyFocusedRect);\n                    return took ? took : this.onRequestFocusInDescendants(direction, previouslyFocusedRect);\n                }\n                case ViewGroup.FOCUS_AFTER_DESCENDANTS: {\n                    const took = this.onRequestFocusInDescendants(direction, previouslyFocusedRect);\n                    return took ? took : super.requestFocus(direction, previouslyFocusedRect);\n                }\n                default:\n                    throw new Error(\"descendant focusability must be \"\n                        + \"one of FOCUS_BEFORE_DESCENDANTS, FOCUS_AFTER_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS \"\n                        + \"but is \" + descendantFocusability);\n            }\n        }\n\n        protected onRequestFocusInDescendants(direction:number, previouslyFocusedRect:Rect):boolean {\n            let index;\n            let increment;\n            let end;\n            let count = this.mChildrenCount;\n            if ((direction & View.FOCUS_FORWARD) != 0) {\n                index = 0;\n                increment = 1;\n                end = count;\n            } else {\n                index = count - 1;\n                increment = -1;\n                end = -1;\n            }\n            const children = this.mChildren;\n            for (let i = index; i != end; i += increment) {\n                let child = children[i];\n                if ((child.mViewFlags & View.VISIBILITY_MASK) == View.VISIBLE) {\n                    if (child.requestFocus(direction, previouslyFocusedRect)) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n\n\n        addView(view:View);\n        addView(view:View, index:number);\n        addView(view:View, params:ViewGroup.LayoutParams);\n        addView(view:View, index:number, params:ViewGroup.LayoutParams);\n        addView(view:View, width:number, height:number);\n        addView(...args);\n        addView(...args) {\n            let child:View = args[0];\n            let params = child.getLayoutParams();\n            let index = -1;\n            if (args.length == 2) {\n                if (args[1] instanceof ViewGroup.LayoutParams) params = args[1];\n                else if(typeof args[1] === 'number') index = args[1];\n            } else if (args.length == 3) {\n                if (args[2] instanceof ViewGroup.LayoutParams) {\n                    index = args[1];\n                    params = args[2];\n                } else {\n                    params = this.generateDefaultLayoutParams();\n                    params.width = args[1];\n                    params.height = args[2];\n                }\n            }\n            if (params == null) {\n                params = this.generateDefaultLayoutParams();\n                if (params == null) {\n                    throw new Error(\"generateDefaultLayoutParams() cannot return null\");\n                }\n            }\n\n            // addViewInner() will call child.requestLayout() when setting the new LayoutParams\n            // therefore, we call requestLayout() on ourselves before, so that the child's request\n            // will be blocked at our level\n            this.requestLayout();\n            this.invalidate(true);\n            this.addViewInner(child, index, params, false);\n\n        }\n\n        protected checkLayoutParams(p:ViewGroup.LayoutParams):boolean {\n            return p != null;\n        }\n\n        setOnHierarchyChangeListener(listener:ViewGroup.OnHierarchyChangeListener) {\n            this.mOnHierarchyChangeListener = listener;\n        }\n\n        protected onViewAdded(child:View) {\n            if (this.mOnHierarchyChangeListener != null) {\n                this.mOnHierarchyChangeListener.onChildViewAdded(this, child);\n            }\n        }\n\n        protected onViewRemoved(child:View) {\n            if (this.mOnHierarchyChangeListener != null) {\n                this.mOnHierarchyChangeListener.onChildViewRemoved(this, child);\n            }\n        }\n\n        clearCachedLayoutMode() {\n            if (!this.hasBooleanFlag(ViewGroup.FLAG_LAYOUT_MODE_WAS_EXPLICITLY_SET)) {\n                this.mLayoutMode = ViewGroup.LAYOUT_MODE_UNDEFINED;\n            }\n        }\n\n        addViewInLayout(child:View, index:number, params:ViewGroup.LayoutParams, preventRequestLayout = false):boolean {\n            child.mParent = null;\n            this.addViewInner(child, index, params, preventRequestLayout);\n            child.mPrivateFlags = (child.mPrivateFlags & ~ViewGroup.PFLAG_DIRTY_MASK) | ViewGroup.PFLAG_DRAWN;\n            return true;\n        }\n\n        cleanupLayoutState(child:View) {\n            child.mPrivateFlags &= ~View.PFLAG_FORCE_LAYOUT;\n        }\n\n        addViewInner(child:View, index:number, params:ViewGroup.LayoutParams, preventRequestLayout:boolean) {\n\n            if (child.getParent() != null) {\n                throw new Error(\"The specified child already has a parent. \" +\n                    \"You must call removeView() on the child's parent first.\");\n            }\n\n            if (!this.checkLayoutParams(params)) {\n                params = this.generateLayoutParams(params);\n            }\n\n            if (preventRequestLayout) {\n                child.mLayoutParams = params;\n            } else {\n                child.setLayoutParams(params);\n            }\n\n            if (index < 0) {\n                index = this.mChildrenCount;\n            }\n\n            if(this.mDisappearingChildren) this.mDisappearingChildren.remove(child);//androidui add, remove disappearing child.\n\n            this.addInArray(child, index);\n\n            // tell our children\n            if (preventRequestLayout) {\n                child.assignParent(this);\n            } else {\n                child.mParent = this;\n            }\n\n            if (child.hasFocus()) {\n                this.requestChildFocus(child, child.findFocus());\n            }\n\n            let ai = this.mAttachInfo;\n            if (ai != null && (this.mGroupFlags & ViewGroup.FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW) == 0) {\n                child.dispatchAttachedToWindow(this.mAttachInfo, (this.mViewFlags & ViewGroup.VISIBILITY_MASK));\n            }\n\n            this.onViewAdded(child);\n\n            if ((child.mViewFlags & ViewGroup.DUPLICATE_PARENT_STATE) == ViewGroup.DUPLICATE_PARENT_STATE) {\n                this.mGroupFlags |= ViewGroup.FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE;\n            }\n\n            //if (child.hasTransientState()) {\n            //    childHasTransientStateChanged(child, true);\n            //}\n        }\n\n        private addInArray(child:View, index:number) {\n\n\n            let count = this.mChildrenCount;\n            if (index == count) {\n                this.mChildren.push(child);\n\n                this.addToBindElement(child.bindElement, null);\n\n            } else if (index < count) {\n                let refChild = this.getChildAt(index);\n                this.mChildren.splice(index, 0, child);\n\n                this.addToBindElement(child.bindElement, refChild.bindElement);\n\n            } else {\n                throw new Error(\"index=\" + index + \" count=\" + count);\n            }\n        }\n        private addToBindElement(childElement:HTMLElement, insertBeforeElement:HTMLElement){\n            if(childElement.parentElement){\n                if(childElement.parentElement == this.bindElement) return;\n                childElement.parentElement.removeChild(childElement);\n            }\n            if (insertBeforeElement) {\n                this.bindElement.insertBefore(childElement, insertBeforeElement);//insert to dom\n            }else{\n                this.bindElement.appendChild(childElement);//append to dom\n            }\n        }\n        private removeChildElement(childElement:HTMLElement){\n            try {\n                this.bindElement.removeChild(childElement);//remove from dom\n            } catch (e) {\n            }\n        }\n\n        private removeFromArray(index:number, count = 1) {\n            let start = Math.max(0, index);\n            let end = Math.min(this.mChildrenCount, start + count);\n\n            if (start == end) {\n                return;\n            }\n            for (let i = start; i < end; i++) {\n                this.mChildren[i].mParent = null;\n                this.removeChildElement(this.mChildren[i].bindElement);//remove from dom\n            }\n            this.mChildren.splice(index, end - start);\n        }\n\n        removeView(view:View) {\n            this.removeViewInternal(view);\n            this.requestLayout();\n            this.invalidate(true);\n        }\n\n        removeViewInLayout(view:View) {\n            this.removeViewInternal(view);\n        }\n\n        removeViewsInLayout(start:number, count:number) {\n            this.removeViewsInternal(start, count);\n        }\n\n        removeViewAt(index:number) {\n            this.removeViewsInternal(index, 1);\n            //this.removeViewInternal(index, this.getChildAt(index));\n            this.requestLayout();\n            this.invalidate(true);\n        }\n\n        removeViews(start:number, count:number) {\n            this.removeViewsInternal(start, count);\n            this.requestLayout();\n            this.invalidate(true);\n        }\n\n        private removeViewInternal(view:View) {\n            let index = this.indexOfChild(view);\n            if (index >= 0) {\n                this.removeViewsInternal(index, 1);\n            }\n        }\n\n        private removeViewsInternal(start:number, count:number) {\n            let focused = this.mFocused;\n            let clearChildFocus = false;\n            const detach = this.mAttachInfo != null;\n\n            const children = this.mChildren;\n            const end = start + count;\n\n            for (let i = start; i < end; i++) {\n                const view = children[i];\n\n                if (view == focused) {\n                    view.unFocus();\n                    clearChildFocus = true;\n                }\n\n                this.cancelTouchTarget(view);\n                //this.cancelHoverTarget(view);//TODO when hover ok\n\n                if (view.getAnimation() != null\n                //    ||(mTransitioningViews != null && mTransitioningViews.contains(view)) //TODO when Transition ok\n                ){\n                    this.addDisappearingView(view);\n                } else if (detach) {\n                    view.dispatchDetachedFromWindow();\n                }\n\n                //if (view.hasTransientState()) {\n                //    childHasTransientStateChanged(view, false);\n                //}\n\n                this.onViewRemoved(view);\n            }\n\n            this.removeFromArray(start, count);\n\n            if (clearChildFocus) {\n                this.clearChildFocus(focused);\n                if (!this.rootViewRequestFocus()) {\n                    this.notifyGlobalFocusCleared(focused);\n                }\n            }\n        }\n\n        removeAllViews() {\n            this.removeAllViewsInLayout();\n            this.requestLayout();\n            this.invalidate(true);\n        }\n\n        removeAllViewsInLayout() {\n            const count = this.mChildrenCount;\n            if (count <= 0) {\n                return;\n            }\n            this.removeViewsInternal(0, count);\n        }\n\n\n        detachViewFromParent(child:View|number):void  {\n            if(child instanceof View) child = this.indexOfChild(<View>child);\n            this.removeFromArray(<number>child);\n        }\n\n        /**\n         * Finishes the removal of a detached view. This method will dispatch the detached from\n         * window event and notify the hierarchy change listener.\n         * <p>\n         * This method is intended to be lightweight and makes no assumptions about whether the\n         * parent or child should be redrawn. Proper use of this method will include also making\n         * any appropriate {@link #requestLayout()} or {@link #invalidate()} calls.\n         * For example, callers can {@link #post(Runnable) post} a {@link Runnable}\n         * which performs a {@link #requestLayout()} on the next frame, after all detach/remove\n         * calls are finished, causing layout to be run prior to redrawing the view hierarchy.\n         *\n         * @param child the child to be definitely removed from the view hierarchy\n         * @param animate if true and the view has an animation, the view is placed in the\n         *                disappearing views list, otherwise, it is detached from the window\n         *\n         * @see #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)\n         * @see #detachAllViewsFromParent()\n         * @see #detachViewFromParent(View)\n         * @see #detachViewFromParent(int)\n         */\n        removeDetachedView(child:View, animate:boolean):void  {\n            //if (this.mTransition != null) {\n            //    this.mTransition.removeChild(this, child);\n            //}\n            if (child == this.mFocused) {\n                child.clearFocus();\n            }\n            //child.clearAccessibilityFocus();\n            this.cancelTouchTarget(child);\n            //TODO impl when hover\n            //this.cancelHoverTarget(child);\n            if ((animate && child.getAnimation() != null)\n                //|| (this.mTransitioningViews != null && this.mTransitioningViews.contains(child))\n            ) {\n                this.addDisappearingView(child);\n            } else if (child.mAttachInfo != null) {\n                child.dispatchDetachedFromWindow();\n            }\n            if (child.hasTransientState()) {\n                this.childHasTransientStateChanged(child, false);\n            }\n            this.onViewRemoved(child);\n        }\n        /**\n         * Attaches a view to this view group. Attaching a view assigns this group as the parent,\n         * sets the layout parameters and puts the view in the list of children so that\n         * it can be retrieved by calling {@link #getChildAt(int)}.\n         * <p>\n         * This method is intended to be lightweight and makes no assumptions about whether the\n         * parent or child should be redrawn. Proper use of this method will include also making\n         * any appropriate {@link #requestLayout()} or {@link #invalidate()} calls.\n         * For example, callers can {@link #post(Runnable) post} a {@link Runnable}\n         * which performs a {@link #requestLayout()} on the next frame, after all detach/attach\n         * calls are finished, causing layout to be run prior to redrawing the view hierarchy.\n         * <p>\n         * This method should be called only for views which were detached from their parent.\n         *\n         * @param child the child to attach\n         * @param index the index at which the child should be attached\n         * @param params the layout parameters of the child\n         *\n         * @see #removeDetachedView(View, boolean)\n         * @see #detachAllViewsFromParent()\n         * @see #detachViewFromParent(View)\n         * @see #detachViewFromParent(int)\n         */\n        attachViewToParent(child:View, index:number, params:ViewGroup.LayoutParams):void  {\n            child.mLayoutParams = params;\n            if (index < 0) {\n                index = this.mChildrenCount;\n            }\n            this.addInArray(child, index);\n            child.mParent = this;\n            child.mPrivateFlags = (child.mPrivateFlags & ~ViewGroup.PFLAG_DIRTY_MASK & ~ViewGroup.PFLAG_DRAWING_CACHE_VALID) | ViewGroup.PFLAG_DRAWN | ViewGroup.PFLAG_INVALIDATED;\n            this.mPrivateFlags |= ViewGroup.PFLAG_INVALIDATED;\n            if (child.hasFocus()) {\n                this.requestChildFocus(child, child.findFocus());\n            }\n        }\n\n        /**\n         * Detaches a range of views from their parents. Detaching a view should be followed\n         * either by a call to\n         * {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)}\n         * or a call to {@link #removeDetachedView(View, boolean)}. Detachment should only be\n         * temporary; reattachment or removal should happen within the same drawing cycle as\n         * detachment. When a view is detached, its parent is null and cannot be retrieved by a\n         * call to {@link #getChildAt(int)}.\n         *\n         * @param start the first index of the childrend range to detach\n         * @param count the number of children to detach\n         *\n         * @see #detachViewFromParent(View)\n         * @see #detachViewFromParent(int)\n         * @see #detachAllViewsFromParent()\n         * @see #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)\n         * @see #removeDetachedView(View, boolean)\n         */\n        detachViewsFromParent(start:number, count:number=1):void  {\n            this.removeFromArray(start, count);\n        }\n\n        /**\n         * Detaches all views from the parent. Detaching a view should be followed\n         * either by a call to\n         * {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)}\n         * or a call to {@link #removeDetachedView(View, boolean)}. Detachment should only be\n         * temporary; reattachment or removal should happen within the same drawing cycle as\n         * detachment. When a view is detached, its parent is null and cannot be retrieved by a\n         * call to {@link #getChildAt(int)}.\n         *\n         * @see #detachViewFromParent(View)\n         * @see #detachViewFromParent(int)\n         * @see #detachViewsFromParent(int, int)\n         * @see #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)\n         * @see #removeDetachedView(View, boolean)\n         */\n        detachAllViewsFromParent():void  {\n            const count:number = this.mChildrenCount;\n            if (count <= 0) {\n                return;\n            }\n            const children:View[] = this.mChildren;\n            //this.mChildrenCount = 0;\n            this.mChildren = [];\n            for (let i:number = count - 1; i >= 0; i--) {\n                children[i].mParent = null;\n                //children[i] = null;\n                this.removeChildElement(children[i].bindElement);//remove from dom\n            }\n\n        }\n\n        indexOfChild(child:View):number {\n            return this.mChildren.indexOf(child);\n        }\n\n        getChildCount():number {\n            return this.mChildrenCount;\n        }\n\n        getChildAt(index:number) {\n            if (index < 0 || index >= this.mChildrenCount) {\n                return null;\n            }\n            return this.mChildren[index];\n        }\n\n        bringChildToFront(child:View) {\n            let index = this.indexOfChild(child);\n            if (index >= 0) {\n                this.removeFromArray(index);\n                this.addInArray(child, this.mChildrenCount);\n                child.mParent = this;\n                this.requestLayout();\n                this.invalidate();\n            }\n        }\n\n        hasBooleanFlag(flag:number) {\n            return (this.mGroupFlags & flag) == flag;\n        }\n\n        setBooleanFlag(flag:number, value:boolean) {\n            if (value) {\n                this.mGroupFlags |= flag;\n            } else {\n                this.mGroupFlags &= ~flag;\n            }\n        }\n\n        dispatchGenericPointerEvent(event:MotionEvent):boolean{\n            // Send the event to the child under the pointer.\n            const childrenCount = this.mChildrenCount;\n            if (childrenCount != 0) {\n                const children = this.mChildren;\n                const x = event.getX();\n                const y = event.getY();\n\n                const customOrder = this.isChildrenDrawingOrderEnabled();\n                for (let i = childrenCount - 1; i >= 0; i--) {\n                    const childIndex = customOrder ? this.getChildDrawingOrder(childrenCount, i) : i;\n                    const child = children[childIndex];\n                    if (!ViewGroup.canViewReceivePointerEvents(child)\n                        || !this.isTransformedTouchPointInView(x, y, child, null)) {\n                        continue;\n                    }\n\n                    if (this.dispatchTransformedGenericPointerEvent(event, child)) {\n                        return true;\n                    }\n                }\n            }\n\n            // No child handled the event.  Send it to this view group.\n            return super.dispatchGenericPointerEvent(event);\n        }\n\n        private dispatchTransformedGenericPointerEvent(event:MotionEvent, child:View):boolean {\n            const offsetX = this.mScrollX - child.mLeft;\n            const offsetY = this.mScrollY - child.mTop;\n\n            let handled:boolean;\n            if (!child.hasIdentityMatrix()) {\n                //TODO when Inverse matrix ok\n                //let transformedEvent = MotionEvent.obtain(event);\n                //transformedEvent.offsetLocation(offsetX, offsetY);\n                //transformedEvent.transform(child.getInverseMatrix());\n                //handled = child.dispatchGenericMotionEvent(transformedEvent);\n                //transformedEvent.recycle();\n            } else {\n                event.offsetLocation(offsetX, offsetY);\n                handled = child.dispatchGenericMotionEvent(event);\n                event.offsetLocation(-offsetX, -offsetY);\n            }\n            return handled;\n        }\n\n\n        dispatchKeyEvent(event:android.view.KeyEvent):boolean {\n            if ((this.mPrivateFlags & (View.PFLAG_FOCUSED | View.PFLAG_HAS_BOUNDS))\n                == (View.PFLAG_FOCUSED | View.PFLAG_HAS_BOUNDS)) {\n                if (super.dispatchKeyEvent(event)) {\n                    return true;\n                }\n            } else if (this.mFocused != null && (this.mFocused.mPrivateFlags & View.PFLAG_HAS_BOUNDS)\n                == View.PFLAG_HAS_BOUNDS) {\n                if (this.mFocused.dispatchKeyEvent(event)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n\n        /**\n         * {@inheritDoc}\n         */\n        dispatchWindowFocusChanged(hasFocus:boolean):void  {\n            super.dispatchWindowFocusChanged(hasFocus);\n            const count:number = this.mChildrenCount;\n            const children:View[] = this.mChildren;\n            for (let i:number = 0; i < count; i++) {\n                children[i].dispatchWindowFocusChanged(hasFocus);\n            }\n        }\n\n        addTouchables(views:java.util.ArrayList<android.view.View>):void {\n            super.addTouchables(views);\n\n            const count = this.mChildrenCount;\n            const children = this.mChildren;\n\n            for (let i = 0; i < count; i++) {\n                const child = children[i];\n                if ((child.mViewFlags & View.VISIBILITY_MASK) == View.VISIBLE) {\n                    child.addTouchables(views);\n                }\n            }\n        }\n\n        onInterceptTouchEvent(ev:MotionEvent) {\n            return false;\n        }\n        dispatchTouchEvent(ev:MotionEvent):boolean {\n            let handled = false;\n            if (this.onFilterTouchEventForSecurity(ev)) {\n                let action = ev.getAction();\n                let actionMasked = action & MotionEvent.ACTION_MASK;\n\n                // Handle an initial down.\n                if (actionMasked == MotionEvent.ACTION_DOWN) {\n                    // Throw away all previous state when starting a new touch gesture.\n                    // The framework may have dropped the up or cancel event for the previous gesture\n                    // due to an app switch, ANR, or some other state change.\n                    this.cancelAndClearTouchTargets(ev);\n                    this.resetTouchState();\n                }\n\n                // Check for interception.\n                let intercepted;\n                if (actionMasked == MotionEvent.ACTION_DOWN\n                    || this.mFirstTouchTarget != null) {\n                    let disallowIntercept = (this.mGroupFlags & ViewGroup.FLAG_DISALLOW_INTERCEPT) != 0;\n                    if (!disallowIntercept) {\n                        intercepted = this.onInterceptTouchEvent(ev);\n                        ev.setAction(action); // restore action in case it was changed\n                    } else {\n                        intercepted = false;\n                    }\n                } else {\n                    // There are no touch targets and this action is not an initial down\n                    // so this view group continues to intercept touches.\n                    intercepted = true;\n                }\n\n                // Check for cancelation.\n                let canceled = ViewGroup.resetCancelNextUpFlag(this)\n                    || actionMasked == MotionEvent.ACTION_CANCEL;\n\n                // Update list of touch targets for pointer down, if needed.\n                let split = (this.mGroupFlags & ViewGroup.FLAG_SPLIT_MOTION_EVENTS) != 0;\n                let newTouchTarget:TouchTarget = null;\n                let alreadyDispatchedToNewTouchTarget = false;\n                if (!canceled && !intercepted) {\n                    if (actionMasked == MotionEvent.ACTION_DOWN\n                        || (split && actionMasked == MotionEvent.ACTION_POINTER_DOWN)\n                        || actionMasked == MotionEvent.ACTION_HOVER_MOVE) {\n                        let actionIndex = ev.getActionIndex(); // always 0 for down\n                        let idBitsToAssign = split ? 1 << ev.getPointerId(actionIndex)\n                            : TouchTarget.ALL_POINTER_IDS;\n\n                        // Clean up earlier touch targets for this pointer id in case they\n                        // have become out of sync.\n                        this.removePointersFromTouchTargets(idBitsToAssign);\n\n                        let childrenCount = this.mChildrenCount;\n                        if (newTouchTarget == null && childrenCount != 0) {\n                            let x = ev.getX(actionIndex);\n                            let y = ev.getY(actionIndex);\n                            // Find a child that can receive the event.\n                            // Scan children from front to back.\n                            let children = this.mChildren;\n\n                            let customOrder = this.isChildrenDrawingOrderEnabled();\n                            for (let i = childrenCount - 1; i >= 0; i--) {\n                                let childIndex = customOrder ? this.getChildDrawingOrder(childrenCount, i) : i;\n                                let child = children[childIndex];\n                                if (!ViewGroup.canViewReceivePointerEvents(child)\n                                    || !this.isTransformedTouchPointInView(x, y, child, null)) {\n                                    continue;\n                                }\n\n                                newTouchTarget = this.getTouchTarget(child);\n                                if (newTouchTarget != null) {\n                                    // Child is already receiving touch within its bounds.\n                                    // Give it the new pointer in addition to the ones it is handling.\n                                    newTouchTarget.pointerIdBits |= idBitsToAssign;\n                                    break;\n                                }\n\n                                ViewGroup.resetCancelNextUpFlag(child);\n                                if (this.dispatchTransformedTouchEvent(ev, false, child, idBitsToAssign)) {\n                                    // Child wants to receive touch within its bounds.\n                                    this.mLastTouchDownTime = ev.getDownTime();\n                                    this.mLastTouchDownIndex = childIndex;\n                                    this.mLastTouchDownX = ev.getX();\n                                    this.mLastTouchDownY = ev.getY();\n                                    newTouchTarget = this.addTouchTarget(child, idBitsToAssign);\n                                    alreadyDispatchedToNewTouchTarget = true;\n                                    break;\n                                }\n                            }\n                        }\n\n                        if (newTouchTarget == null && this.mFirstTouchTarget != null) {\n                            // Did not find a child to receive the event.\n                            // Assign the pointer to the least recently added target.\n                            newTouchTarget = this.mFirstTouchTarget;\n                            while (newTouchTarget.next != null) {\n                                newTouchTarget = newTouchTarget.next;\n                            }\n                            newTouchTarget.pointerIdBits |= idBitsToAssign;\n                        }\n                    }\n                }\n\n                // Dispatch to touch targets.\n                if (this.mFirstTouchTarget == null) {\n                    // No touch targets so treat this as an ordinary view.\n                    handled = this.dispatchTransformedTouchEvent(ev, canceled, null,\n                        TouchTarget.ALL_POINTER_IDS);\n                } else {\n                    // Dispatch to touch targets, excluding the new touch target if we already\n                    // dispatched to it.  Cancel touch targets if necessary.\n                    let predecessor:TouchTarget = null;\n                    let target:TouchTarget = this.mFirstTouchTarget;\n                    while (target != null) {\n                        const next:TouchTarget = target.next;\n                        if (alreadyDispatchedToNewTouchTarget && target == newTouchTarget) {\n                            handled = true;\n                        } else {\n                            let cancelChild = ViewGroup.resetCancelNextUpFlag(target.child)\n                                || intercepted;\n                            if (this.dispatchTransformedTouchEvent(ev, cancelChild,\n                                    target.child, target.pointerIdBits)) {\n                                handled = true;\n                            }\n                            if (cancelChild) {\n                                if (predecessor == null) {\n                                    this.mFirstTouchTarget = next;\n                                } else {\n                                    predecessor.next = next;\n                                }\n                                target.recycle();\n                                target = next;\n                                continue;\n                            }\n                        }\n                        predecessor = target;\n                        target = next;\n                    }\n                }\n\n                // Update list of touch targets for pointer up or cancel, if needed.\n                if (canceled\n                    || actionMasked == MotionEvent.ACTION_UP\n                    || actionMasked == MotionEvent.ACTION_HOVER_MOVE) {\n                    this.resetTouchState();\n                } else if (split && actionMasked == MotionEvent.ACTION_POINTER_UP) {\n                    let actionIndex = ev.getActionIndex();\n                    let idBitsToRemove = 1 << ev.getPointerId(actionIndex);\n                    this.removePointersFromTouchTargets(idBitsToRemove);\n                }\n            }\n            return handled;\n        }\n        private resetTouchState() {\n            this.clearTouchTargets();\n            ViewGroup.resetCancelNextUpFlag(this);\n            this.mGroupFlags &= ~ViewGroup.FLAG_DISALLOW_INTERCEPT;\n        }\n        private static resetCancelNextUpFlag(view:View):boolean {\n            if ((view.mPrivateFlags & View.PFLAG_CANCEL_NEXT_UP_EVENT) != 0) {\n                view.mPrivateFlags &= ~View.PFLAG_CANCEL_NEXT_UP_EVENT;\n                return true;\n            }\n            return false;\n        }\n        private clearTouchTargets() {\n            let target = this.mFirstTouchTarget;\n            if (target != null) {\n                do {\n                    let next = target.next;\n                    target.recycle();\n                    target = next;\n                } while (target != null);\n                this.mFirstTouchTarget = null;\n            }\n        }\n\n        private cancelAndClearTouchTargets(event:MotionEvent) {\n            if (this.mFirstTouchTarget != null) {\n                let syntheticEvent = false;\n                if (event == null) {\n                    let now = SystemClock.uptimeMillis();\n                    event = MotionEvent.obtainWithAction(now, now, MotionEvent.ACTION_CANCEL, 0, 0);\n                    //event.setSource(InputDevice.SOURCE_TOUCHSCREEN);\n                    syntheticEvent = true;\n                }\n\n                for (let target = this.mFirstTouchTarget; target != null; target = target.next) {\n                    ViewGroup.resetCancelNextUpFlag(target.child);\n                    this.dispatchTransformedTouchEvent(event, true, target.child, target.pointerIdBits);\n                }\n                this.clearTouchTargets();\n\n                if (syntheticEvent) {\n                    event.recycle();\n                }\n            }\n        }\n\n        private getTouchTarget(child:View):TouchTarget {\n            for (let target = this.mFirstTouchTarget; target != null; target = target.next) {\n                if (target.child == child) {\n                    return target;\n                }\n            }\n            return null;\n        }\n\n        private addTouchTarget(child:View, pointerIdBits:number):TouchTarget {\n            let target = TouchTarget.obtain(child, pointerIdBits);\n            target.next = this.mFirstTouchTarget;\n            this.mFirstTouchTarget = target;\n            return target;\n        }\n\n        private removePointersFromTouchTargets(pointerIdBits:number) {\n            let predecessor:TouchTarget = null;\n            let target = this.mFirstTouchTarget;\n            while (target != null) {\n                let next = target.next;\n                if ((target.pointerIdBits & pointerIdBits) != 0) {\n                    target.pointerIdBits &= ~pointerIdBits;\n                    if (target.pointerIdBits == 0) {\n                        if (predecessor == null) {\n                            this.mFirstTouchTarget = next;\n                        } else {\n                            predecessor.next = next;\n                        }\n                        target.recycle();\n                        target = next;\n                        continue;\n                    }\n                }\n                predecessor = target;\n                target = next;\n            }\n        }\n\n        private cancelTouchTarget(view:View) {\n            let predecessor:TouchTarget = null;\n            let target = this.mFirstTouchTarget;\n            while (target != null) {\n                let next = target.next;\n                if (target.child == view) {\n                    if (predecessor == null) {\n                        this.mFirstTouchTarget = next;\n                    } else {\n                        predecessor.next = next;\n                    }\n                    target.recycle();\n\n                    let now = SystemClock.uptimeMillis();\n                    let event = MotionEvent.obtainWithAction(now, now, MotionEvent.ACTION_CANCEL, 0, 0);\n                    //event.setSource(InputDevice.SOURCE_TOUCHSCREEN);\n                    view.dispatchTouchEvent(event);\n                    event.recycle();\n                    return;\n                }\n                predecessor = target;\n                target = next;\n            }\n        }\n\n        private static canViewReceivePointerEvents(child:View):boolean {\n            return (child.mViewFlags & View.VISIBILITY_MASK) == View.VISIBLE\n                    || child.getAnimation() != null\n                ;\n        }\n\n        protected isTransformedTouchPointInView(x:number, y:number, child:View, outLocalPoint:Point):boolean {\n            let localX = x + this.mScrollX - child.mLeft;\n            let localY = y + this.mScrollY - child.mTop;\n\n            //if (! child.hasIdentityMatrix() && mAttachInfo != null) { //TODO when invers matrix ok\n            //    final float[] localXY = mAttachInfo.mTmpTransformLocation;\n            //    localXY[0] = localX;\n            //    localXY[1] = localY;\n            //    child.getInverseMatrix().mapPoints(localXY);\n            //    localX = localXY[0];\n            //    localY = localXY[1];\n            //}\n\n            let isInView = child.pointInView(localX, localY);\n            if (isInView && outLocalPoint != null) {\n                outLocalPoint.set(localX, localY);\n            }\n            return isInView;\n        }\n\n        private dispatchTransformedTouchEvent(event:MotionEvent, cancel:boolean,\n                                              child:View, desiredPointerIdBits:number):boolean {\n            let handled:boolean;\n\n            // Canceling motions is a special case.  We don't need to perform any transformations\n            // or filtering.  The important part is the action, not the contents.\n            const oldAction = event.getAction();\n            if (cancel || oldAction == MotionEvent.ACTION_CANCEL) {\n                event.setAction(MotionEvent.ACTION_CANCEL);\n                if (child == null) {\n                    handled = super.dispatchTouchEvent(event);\n                } else {\n                    handled = child.dispatchTouchEvent(event);\n                }\n                event.setAction(oldAction);\n                return handled;\n            }\n\n\n            // Calculate the number of pointers to deliver.\n            const oldPointerIdBits = event.getPointerIdBits();\n            const newPointerIdBits = oldPointerIdBits & desiredPointerIdBits;\n\n            // If for some reason we ended up in an inconsistent state where it looks like we\n            // might produce a motion event with no pointers in it, then drop the event.\n            if (newPointerIdBits == 0) {\n                return false;\n            }\n\n            // If the number of pointers is the same and we don't need to perform any fancy\n            // irreversible transformations, then we can reuse the motion event for this\n            // dispatch as long as we are careful to revert any changes we make.\n            // Otherwise we need to make a copy.\n            let transformedEvent:MotionEvent;\n            if (newPointerIdBits == oldPointerIdBits) {\n                if (child == null || child.hasIdentityMatrix()) {\n                    if (child == null) {\n                        handled = super.dispatchTouchEvent(event);\n                    } else {\n                        let offsetX = this.mScrollX - child.mLeft;\n                        let offsetY = this.mScrollY - child.mTop;\n                        event.offsetLocation(offsetX, offsetY);\n\n                        handled = child.dispatchTouchEvent(event);\n\n                        event.offsetLocation(-offsetX, -offsetY);\n                    }\n                    return handled;\n                }\n                transformedEvent = MotionEvent.obtain(event);\n            } else {\n                transformedEvent = event.split(newPointerIdBits);\n            }\n\n            // Perform any necessary transformations and dispatch.\n            if (child == null) {\n                handled = super.dispatchTouchEvent(transformedEvent);\n            } else {\n                let offsetX = this.mScrollX - child.mLeft;\n                let offsetY = this.mScrollY - child.mTop;\n                transformedEvent.offsetLocation(offsetX, offsetY);\n                //if (! child.hasIdentityMatrix()) {//TODO when view InverseMatrix ok\n                //    transformedEvent.transform(child.getInverseMatrix());\n                //}\n\n                handled = child.dispatchTouchEvent(transformedEvent);\n            }\n\n            // Done.\n            transformedEvent.recycle();\n            return handled;\n        }\n\n        /**\n         * Enable or disable the splitting of MotionEvents to multiple children during touch event\n         * dispatch. This behavior is enabled by default for applications that target an\n         * SDK version of {@link Build.VERSION_CODES#HONEYCOMB} or newer.\n         *\n         * <p>When this option is enabled MotionEvents may be split and dispatched to different child\n         * views depending on where each pointer initially went down. This allows for user interactions\n         * such as scrolling two panes of content independently, chording of buttons, and performing\n         * independent gestures on different pieces of content.\n         *\n         * @param split <code>true</code> to allow MotionEvents to be split and dispatched to multiple\n         *              child views. <code>false</code> to only allow one child view to be the target of\n         *              any MotionEvent received by this ViewGroup.\n         * @attr ref android.R.styleable#ViewGroup_splitMotionEvents\n         */\n        setMotionEventSplittingEnabled(split:boolean):void  {\n            // with gestures in progress when this is changed.\n            if (split) {\n                this.mGroupFlags |= ViewGroup.FLAG_SPLIT_MOTION_EVENTS;\n            } else {\n                this.mGroupFlags &= ~ViewGroup.FLAG_SPLIT_MOTION_EVENTS;\n            }\n        }\n\n        /**\n         * Returns true if MotionEvents dispatched to this ViewGroup can be split to multiple children.\n         * @return true if MotionEvents dispatched to this ViewGroup can be split to multiple children.\n         */\n        isMotionEventSplittingEnabled():boolean  {\n            return (this.mGroupFlags & ViewGroup.FLAG_SPLIT_MOTION_EVENTS) == ViewGroup.FLAG_SPLIT_MOTION_EVENTS;\n        }\n\n        /**\n         * Indicates whether the children's drawing cache is used during a layout\n         * animation. By default, the drawing cache is enabled but this will prevent\n         * nested layout animations from working. To nest animations, you must disable\n         * the cache.\n         *\n         * @return true if the animation cache is enabled, false otherwise\n         *\n         * @see #setAnimationCacheEnabled(boolean)\n         * @see View#setDrawingCacheEnabled(boolean)\n         */\n        isAnimationCacheEnabled():boolean  {\n            return (this.mGroupFlags & ViewGroup.FLAG_ANIMATION_CACHE) == ViewGroup.FLAG_ANIMATION_CACHE;\n        }\n\n        /**\n         * Enables or disables the children's drawing cache during a layout animation.\n         * By default, the drawing cache is enabled but this will prevent nested\n         * layout animations from working. To nest animations, you must disable the\n         * cache.\n         *\n         * @param enabled true to enable the animation cache, false otherwise\n         *\n         * @see #isAnimationCacheEnabled()\n         * @see View#setDrawingCacheEnabled(boolean)\n         */\n        setAnimationCacheEnabled(enabled:boolean):void  {\n            this.setBooleanFlag(ViewGroup.FLAG_ANIMATION_CACHE, enabled);\n        }\n\n        /**\n         * Indicates whether this ViewGroup will always try to draw its children using their\n         * drawing cache. By default this property is enabled.\n         *\n         * @return true if the animation cache is enabled, false otherwise\n         *\n         * @see #setAlwaysDrawnWithCacheEnabled(boolean)\n         * @see #setChildrenDrawnWithCacheEnabled(boolean)\n         * @see View#setDrawingCacheEnabled(boolean)\n         */\n        isAlwaysDrawnWithCacheEnabled():boolean  {\n            return (this.mGroupFlags & ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE) == ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE;\n        }\n\n        /**\n         * Indicates whether this ViewGroup will always try to draw its children using their\n         * drawing cache. This property can be set to true when the cache rendering is\n         * slightly different from the children's normal rendering. Renderings can be different,\n         * for instance, when the cache's quality is set to low.\n         *\n         * When this property is disabled, the ViewGroup will use the drawing cache of its\n         * children only when asked to. It's usually the task of subclasses to tell ViewGroup\n         * when to start using the drawing cache and when to stop using it.\n         *\n         * @param always true to always draw with the drawing cache, false otherwise\n         *\n         * @see #isAlwaysDrawnWithCacheEnabled()\n         * @see #setChildrenDrawnWithCacheEnabled(boolean)\n         * @see View#setDrawingCacheEnabled(boolean)\n         * @see View#setDrawingCacheQuality(int)\n         */\n        setAlwaysDrawnWithCacheEnabled(always:boolean):void  {\n            this.setBooleanFlag(ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE, always);\n        }\n\n        /**\n         * Indicates whether the ViewGroup is currently drawing its children using\n         * their drawing cache.\n         *\n         * @return true if children should be drawn with their cache, false otherwise\n         *\n         * @see #setAlwaysDrawnWithCacheEnabled(boolean)\n         * @see #setChildrenDrawnWithCacheEnabled(boolean)\n         */\n        isChildrenDrawnWithCacheEnabled():boolean  {\n            return (this.mGroupFlags & ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE) == ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE;\n        }\n\n        /**\n         * Tells the ViewGroup to draw its children using their drawing cache. This property\n         * is ignored when {@link #isAlwaysDrawnWithCacheEnabled()} is true. A child's drawing cache\n         * will be used only if it has been enabled.\n         *\n         * Subclasses should call this method to start and stop using the drawing cache when\n         * they perform performance sensitive operations, like scrolling or animating.\n         *\n         * @param enabled true if children should be drawn with their cache, false otherwise\n         *\n         * @see #setAlwaysDrawnWithCacheEnabled(boolean)\n         * @see #isChildrenDrawnWithCacheEnabled()\n         */\n        setChildrenDrawnWithCacheEnabled(enabled:boolean):void  {\n            this.setBooleanFlag(ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE, enabled);\n        }\n\n        /**\n         * Enables or disables the drawing cache for each child of this view group.\n         *\n         * @param enabled true to enable the cache, false to dispose of it\n         */\n        setChildrenDrawingCacheEnabled(enabled:boolean):void  {\n            if (enabled || (this.mPersistentDrawingCache & ViewGroup.PERSISTENT_ALL_CACHES) != ViewGroup.PERSISTENT_ALL_CACHES) {\n                const children:View[] = this.mChildren;\n                const count:number = this.mChildrenCount;\n                for (let i:number = 0; i < count; i++) {\n                    children[i].setDrawingCacheEnabled(enabled);\n                }\n            }\n        }\n\n        protected onAnimationStart():void  {\n            super.onAnimationStart();\n            // When this ViewGroup's animation starts, build the cache for the children\n            if ((this.mGroupFlags & ViewGroup.FLAG_ANIMATION_CACHE) == ViewGroup.FLAG_ANIMATION_CACHE) {\n                const count:number = this.mChildrenCount;\n                const children:View[] = this.mChildren;\n                const buildCache:boolean = !this.isHardwareAccelerated();\n                for (let i:number = 0; i < count; i++) {\n                    const child:View = children[i];\n                    if ((child.mViewFlags & ViewGroup.VISIBILITY_MASK) == ViewGroup.VISIBLE) {\n                        child.setDrawingCacheEnabled(true);\n                        if (buildCache) {\n                            child.buildDrawingCache(true);\n                        }\n                    }\n                }\n                this.mGroupFlags |= ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE;\n            }\n        }\n\n        protected onAnimationEnd():void  {\n            super.onAnimationEnd();\n            // When this ViewGroup's animation ends, destroy the cache of the children\n            if ((this.mGroupFlags & ViewGroup.FLAG_ANIMATION_CACHE) == ViewGroup.FLAG_ANIMATION_CACHE) {\n                this.mGroupFlags &= ~ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE;\n                if ((this.mPersistentDrawingCache & ViewGroup.PERSISTENT_ANIMATION_CACHE) == 0) {\n                    this.setChildrenDrawingCacheEnabled(false);\n                }\n            }\n        }\n\n        /**\n         * Returns an integer indicating what types of drawing caches are kept in memory.\n         *\n         * @see #setPersistentDrawingCache(int)\n         * @see #setAnimationCacheEnabled(boolean)\n         *\n         * @return one or a combination of {@link #PERSISTENT_NO_CACHE},\n         *         {@link #PERSISTENT_ANIMATION_CACHE}, {@link #PERSISTENT_SCROLLING_CACHE}\n         *         and {@link #PERSISTENT_ALL_CACHES}\n         */\n        getPersistentDrawingCache():number  {\n            return this.mPersistentDrawingCache;\n        }\n\n        /**\n         * Indicates what types of drawing caches should be kept in memory after\n         * they have been created.\n         *\n         * @see #getPersistentDrawingCache()\n         * @see #setAnimationCacheEnabled(boolean)\n         *\n         * @param drawingCacheToKeep one or a combination of {@link #PERSISTENT_NO_CACHE},\n         *        {@link #PERSISTENT_ANIMATION_CACHE}, {@link #PERSISTENT_SCROLLING_CACHE}\n         *        and {@link #PERSISTENT_ALL_CACHES}\n         */\n        setPersistentDrawingCache(drawingCacheToKeep:number):void  {\n            this.mPersistentDrawingCache = drawingCacheToKeep & ViewGroup.PERSISTENT_ALL_CACHES;\n        }\n\n        isChildrenDrawingOrderEnabled():boolean {\n            return (this.mGroupFlags & ViewGroup.FLAG_USE_CHILD_DRAWING_ORDER) == ViewGroup.FLAG_USE_CHILD_DRAWING_ORDER;\n        }\n        setChildrenDrawingOrderEnabled(enabled:boolean) {\n            this.setBooleanFlag(ViewGroup.FLAG_USE_CHILD_DRAWING_ORDER, enabled);\n        }\n        getChildDrawingOrder(childCount:number , i:number):number {\n            return i;\n        }\n\n        public generateLayoutParamsFromAttr(attrs:HTMLElement):ViewGroup.LayoutParams {\n            return new ViewGroup.LayoutParams(this.getContext(), attrs);\n        }\n\n        protected generateLayoutParams(p:ViewGroup.LayoutParams):ViewGroup.LayoutParams {\n            return p;\n        }\n\n        protected generateDefaultLayoutParams():ViewGroup.LayoutParams {\n            return new ViewGroup.LayoutParams(\n                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);\n        }\n\n        measureChildren(widthMeasureSpec:number, heightMeasureSpec:number) {\n            const size = this.mChildren.length;\n            for (let i = 0; i < size; ++i) {\n                const child = this.mChildren[i];\n                if ((child.mViewFlags & View.VISIBILITY_MASK) != View.GONE) {\n                    this.measureChild(child, widthMeasureSpec, heightMeasureSpec);\n                }\n            }\n        }\n\n        protected measureChild(child:View, parentWidthMeasureSpec:number, parentHeightMeasureSpec:number) {\n            let lp = child.getLayoutParams();\n            const childWidthMeasureSpec = ViewGroup.getChildMeasureSpec(parentWidthMeasureSpec,\n                this.mPaddingLeft + this.mPaddingRight, lp.width);\n            const childHeightMeasureSpec = ViewGroup.getChildMeasureSpec(parentHeightMeasureSpec,\n                this.mPaddingTop + this.mPaddingBottom, lp.height);\n\n            child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n        }\n\n        protected measureChildWithMargins(child:View, parentWidthMeasureSpec:number, widthUsed:number,\n                                parentHeightMeasureSpec:number, heightUsed:number) {\n            let lp = child.getLayoutParams();\n            if (lp instanceof ViewGroup.MarginLayoutParams) {\n\n                const childWidthMeasureSpec = ViewGroup.getChildMeasureSpec(parentWidthMeasureSpec,\n                    this.mPaddingLeft + this.mPaddingRight + lp.leftMargin + lp.rightMargin\n                    + widthUsed, lp.width);\n                const childHeightMeasureSpec = ViewGroup.getChildMeasureSpec(parentHeightMeasureSpec,\n                    this.mPaddingTop + this.mPaddingBottom + lp.topMargin + lp.bottomMargin\n                    + heightUsed, lp.height);\n\n                child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n            }\n        }\n\n        static getChildMeasureSpec(spec:number, padding:number, childDimension:number):number {\n            let MeasureSpec = View.MeasureSpec;\n\n            let specMode = MeasureSpec.getMode(spec);\n            let specSize = MeasureSpec.getSize(spec);\n\n            let size = Math.max(0, specSize - padding);\n\n            let resultSize = 0;\n            let resultMode = 0;\n\n            switch (specMode) {\n                // Parent has imposed an exact size on us\n                case MeasureSpec.EXACTLY:\n                    if (childDimension >= 0) {\n                        resultSize = childDimension;\n                        resultMode = MeasureSpec.EXACTLY;\n                    } else if (childDimension == ViewGroup.LayoutParams.MATCH_PARENT) {\n                        // Child wants to be our size. So be it.\n                        resultSize = size;\n                        resultMode = MeasureSpec.EXACTLY;\n                    } else if (childDimension == ViewGroup.LayoutParams.WRAP_CONTENT) {\n                        // Child wants to determine its own size. It can't be\n                        // bigger than us.\n                        resultSize = size;\n                        resultMode = MeasureSpec.AT_MOST;\n                    }\n                    break;\n\n                // Parent has imposed a maximum size on us\n                case MeasureSpec.AT_MOST:\n                    if (childDimension >= 0) {\n                        // Child wants a specific size... so be it\n                        resultSize = childDimension;\n                        resultMode = MeasureSpec.EXACTLY;\n                    } else if (childDimension == ViewGroup.LayoutParams.MATCH_PARENT) {\n                        // Child wants to be our size, but our size is not fixed.\n                        // Constrain child to not be bigger than us.\n                        resultSize = size;\n                        resultMode = MeasureSpec.AT_MOST;\n                    } else if (childDimension == ViewGroup.LayoutParams.WRAP_CONTENT) {\n                        // Child wants to determine its own size. It can't be\n                        // bigger than us.\n                        resultSize = size;\n                        resultMode = MeasureSpec.AT_MOST;\n                    }\n                    break;\n\n                // Parent asked to see how big we want to be\n                case MeasureSpec.UNSPECIFIED:\n                    if (childDimension >= 0) {\n                        // Child wants a specific size... let him have it\n                        resultSize = childDimension;\n                        resultMode = MeasureSpec.EXACTLY;\n                    } else if (childDimension == ViewGroup.LayoutParams.MATCH_PARENT) {\n                        // Child wants to be our size... find out how big it should\n                        // be\n                        resultSize = 0;\n                        resultMode = MeasureSpec.UNSPECIFIED;\n                    } else if (childDimension == ViewGroup.LayoutParams.WRAP_CONTENT) {\n                        // Child wants to determine its own size.... find out how\n                        // big it should be\n                        resultSize = 0;\n                        resultMode = MeasureSpec.UNSPECIFIED;\n                    }\n                    break;\n            }\n            return MeasureSpec.makeMeasureSpec(resultSize, resultMode);\n        }\n\n\n        /**\n         * Removes any pending animations for views that have been removed. Call\n         * this if you don't want animations for exiting views to stack up.\n         */\n        clearDisappearingChildren():void  {\n            if (this.mDisappearingChildren != null) {\n                this.mDisappearingChildren.clear();\n                this.invalidate();\n            }\n        }\n\n        /**\n         * Add a view which is removed from mChildren but still needs animation\n         *\n         * @param v View to add\n         */\n        private addDisappearingView(v:View):void  {\n            let disappearingChildren:ArrayList<View> = this.mDisappearingChildren;\n            if (disappearingChildren == null) {\n                disappearingChildren = this.mDisappearingChildren = new ArrayList<View>();\n            }\n            disappearingChildren.add(v);\n        }\n\n        /**\n         * Cleanup a view when its animation is done. This may mean removing it from\n         * the list of disappearing views.\n         *\n         * @param view The view whose animation has finished\n         * @param animation The animation, cannot be null\n         */\n        finishAnimatingView(view:View, animation:Animation):void  {\n            const disappearingChildren:ArrayList<View> = this.mDisappearingChildren;\n            if (disappearingChildren != null) {\n                if (disappearingChildren.contains(view)) {\n                    disappearingChildren.remove(view);\n                    if (view.mAttachInfo != null) {\n                        view.dispatchDetachedFromWindow();\n                    }\n                    view.clearAnimation();\n                    this.mGroupFlags |= ViewGroup.FLAG_INVALIDATE_REQUIRED;\n                }\n            }\n            if (animation != null && !animation.getFillAfter()) {\n                view.clearAnimation();\n            }\n            if ((view.mPrivateFlags & ViewGroup.PFLAG_ANIMATION_STARTED) == ViewGroup.PFLAG_ANIMATION_STARTED) {\n                view.onAnimationEnd();\n                // Should be performed by onAnimationEnd() but this avoid an infinite loop,\n                // so we'd rather be safe than sorry\n                view.mPrivateFlags &= ~ViewGroup.PFLAG_ANIMATION_STARTED;\n                // Draw one more frame after the animation is done\n                this.mGroupFlags |= ViewGroup.FLAG_INVALIDATE_REQUIRED;\n            }\n        }\n\n        dispatchAttachedToWindow(info:View.AttachInfo, visibility:number) {\n            this.mGroupFlags |= ViewGroup.FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW;\n            super.dispatchAttachedToWindow(info, visibility);\n            this.mGroupFlags &= ~ViewGroup.FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW;\n\n            const count = this.mChildrenCount;\n            const children = this.mChildren;\n            for (let i = 0; i < count; i++) {\n                const child = children[i];\n                child.dispatchAttachedToWindow(info,\n                    visibility | (child.mViewFlags & View.VISIBILITY_MASK));\n            }\n        }\n\n        protected onAttachedToWindow() {\n            super.onAttachedToWindow();\n            this.clearCachedLayoutMode();\n        }\n\n        protected onDetachedFromWindow() {\n            super.onDetachedFromWindow();\n            this.clearCachedLayoutMode();\n        }\n\n        dispatchDetachedFromWindow() {\n            // If we still have a touch target, we are still in the process of\n            // dispatching motion events to a child; we need to get rid of that\n            // child to avoid dispatching events to it after the window is torn\n            // down. To make sure we keep the child in a consistent state, we\n            // first send it an ACTION_CANCEL motion event.\n            this.cancelAndClearTouchTargets(null);\n\n            // Similarly, set ACTION_EXIT to all hover targets and clear them.\n            //this.exitHoverTargets();\n\n            // In case view is detached while transition is running\n            this.mLayoutCalledWhileSuppressed = false;\n\n            this.mChildren.forEach((child)=>child.dispatchDetachedFromWindow());\n            super.dispatchDetachedFromWindow();\n        }\n\n        /**\n         * {@inheritDoc}\n         */\n        dispatchDisplayHint(hint:number):void  {\n            super.dispatchDisplayHint(hint);\n            const count:number = this.mChildrenCount;\n            const children:View[] = this.mChildren;\n            for (let i:number = 0; i < count; i++) {\n                children[i].dispatchDisplayHint(hint);\n            }\n        }\n\n        /**\n         * Called when a view's visibility has changed. Notify the parent to take any appropriate\n         * action.\n         *\n         * @param child The view whose visibility has changed\n         * @param oldVisibility The previous visibility value (GONE, INVISIBLE, or VISIBLE).\n         * @param newVisibility The new visibility value (GONE, INVISIBLE, or VISIBLE).\n         * @hide\n         */\n        onChildVisibilityChanged(child:View, oldVisibility:number, newVisibility:number):void  {\n            //if (this.mTransition != null) {\n            //    if (newVisibility == ViewGroup.VISIBLE) {\n            //        this.mTransition.showChild(this, child, oldVisibility);\n            //    } else {\n            //        this.mTransition.hideChild(this, child, newVisibility);\n            //        if (this.mTransitioningViews != null && this.mTransitioningViews.contains(child)) {\n            //            // and don't need special handling during drawChild()\n            //            if (this.mVisibilityChangingChildren == null) {\n            //                this.mVisibilityChangingChildren = new ArrayList<View>();\n            //            }\n            //            this.mVisibilityChangingChildren.add(child);\n            //            this.addDisappearingView(child);\n            //        }\n            //    }\n            //}\n            //// in all cases, for drags\n            //if (this.mCurrentDrag != null) {\n            //    if (newVisibility == ViewGroup.VISIBLE) {\n            //        this.notifyChildOfDrag(child);\n            //    }\n            //}\n        }\n        dispatchVisibilityChanged(changedView:View, visibility:number) {\n            super.dispatchVisibilityChanged(changedView, visibility);\n            const count = this.mChildrenCount;\n            let children = this.mChildren;\n            for (let i = 0; i < count; i++) {\n                children[i].dispatchVisibilityChanged(changedView, visibility);\n            }\n        }\n        dispatchSetSelected(selected:boolean) {\n            const children = this.mChildren;\n            const count = this.mChildrenCount;\n            for (let i = 0; i < count; i++) {\n                children[i].setSelected(selected);\n            }\n        }\n        dispatchSetActivated(activated:boolean) {\n            const children = this.mChildren;\n            const count = this.mChildrenCount;\n            for (let i = 0; i < count; i++) {\n                children[i].setActivated(activated);\n            }\n        }\n        dispatchSetPressed(pressed:boolean):void {\n            const children = this.mChildren;\n            const count = this.mChildrenCount;\n            for (let i = 0; i < count; i++) {\n                const child = children[i];\n                // Children that are clickable on their own should not\n                // show a pressed state when their parent view does.\n                // Clearing a pressed state always propagates.\n                if (!pressed || (!child.isClickable() && !child.isLongClickable())) {\n                    child.setPressed(pressed);\n                }\n            }\n        }\n\n        dispatchCancelPendingInputEvents():void  {\n            super.dispatchCancelPendingInputEvents();\n            const children:View[] = this.mChildren;\n            const count:number = this.mChildrenCount;\n            for (let i:number = 0; i < count; i++) {\n                children[i].dispatchCancelPendingInputEvents();\n            }\n        }\n\n        offsetDescendantRectToMyCoords(descendant:View, rect:Rect){\n            this.offsetRectBetweenParentAndChild(descendant, rect, true, false);\n        }\n        offsetRectIntoDescendantCoords(descendant:View, rect:Rect) {\n            this.offsetRectBetweenParentAndChild(descendant, rect, false, false);\n        }\n        offsetRectBetweenParentAndChild(descendant:View, rect:Rect, offsetFromChildToParent:boolean, clipToBounds:boolean){\n            // already in the same coord system :)\n            if (descendant == this) {\n                return;\n            }\n\n            let theParent = descendant.mParent;\n\n            // search and offset up to the parent\n            while ((theParent != null)\n            && (theParent instanceof View)\n            && (theParent != this)) {\n\n                if (offsetFromChildToParent) {\n                    rect.offset(descendant.mLeft - descendant.mScrollX,\n                        descendant.mTop - descendant.mScrollY);\n                    if (clipToBounds) {\n                        let p = <View><any>theParent;\n                        rect.intersect(0, 0, p.mRight - p.mLeft, p.mBottom - p.mTop);\n                    }\n                } else {\n                    if (clipToBounds) {\n                        let p = <View><any>theParent;\n                        rect.intersect(0, 0, p.mRight - p.mLeft, p.mBottom - p.mTop);\n                    }\n                    rect.offset(descendant.mScrollX - descendant.mLeft,\n                        descendant.mScrollY - descendant.mTop);\n                }\n\n                descendant = <View><any>theParent;\n                theParent = descendant.mParent;\n            }\n\n            // now that we are up to this view, need to offset one more time\n            // to get into our coordinate space\n            if (theParent == this) {\n                if (offsetFromChildToParent) {\n                    rect.offset(descendant.mLeft - descendant.mScrollX,\n                        descendant.mTop - descendant.mScrollY);\n                } else {\n                    rect.offset(descendant.mScrollX - descendant.mLeft,\n                        descendant.mScrollY - descendant.mTop);\n                }\n            } else {\n                throw new Error(\"parameter must be a descendant of this view\");\n            }\n        }\n        offsetChildrenTopAndBottom(offset:number) {\n            const count = this.mChildrenCount;\n            const children = this.mChildren;\n\n            for (let i = 0; i < count; i++) {\n                const v = children[i];\n                v.mTop += offset;\n                v.mBottom += offset;\n            }\n\n            this.invalidateViewProperty(false, false);\n        }\n\n        suppressLayout(suppress:boolean) {\n            this.mSuppressLayout = suppress;\n            if (!suppress) {\n                if (this.mLayoutCalledWhileSuppressed) {\n                    this.requestLayout();\n                    this.mLayoutCalledWhileSuppressed = false;\n                }\n            }\n        }\n        isLayoutSuppressed() {\n            return this.mSuppressLayout;\n        }\n\n\n        layout(l:number, t:number, r:number, b:number):void {\n            if (!this.mSuppressLayout) {\n                super.layout(l, t, r, b);\n            } else {\n                // record the fact that we noop'd it; request layout when transition finishes\n                this.mLayoutCalledWhileSuppressed = true;\n            }\n        }\n\n        canAnimate():boolean {\n            //layout animation no impl\n            return false;\n        }\n        protected abstract onLayout(changed:boolean, l:number, t:number, r:number, b:number):void;\n\n        getChildVisibleRect(child:View, r:Rect, offset:Point):boolean{\n            // It doesn't make a whole lot of sense to call this on a view that isn't attached,\n            // but for some simple tests it can be useful. If we don't have attach info this\n            // will allocate memory.\n            const rect = this.mAttachInfo != null ? this.mAttachInfo.mTmpTransformRect : new Rect();\n            rect.set(r);\n\n            if (!child.hasIdentityMatrix()) {\n                child.getMatrix().mapRect(rect);\n            }\n\n            let dx = child.mLeft - this.mScrollX;\n            let dy = child.mTop - this.mScrollY;\n\n            rect.offset(dx, dy);\n\n            if (offset != null) {\n                if (!child.hasIdentityMatrix()) {\n                    let position = this.mAttachInfo != null ? this.mAttachInfo.mTmpTransformLocation : androidui.util.ArrayCreator.newNumberArray(2);\n                    position[0] = offset.x;\n                    position[1] = offset.y;\n                    child.getMatrix().mapPoints(position);\n                    offset.x = Math.floor(position[0] + 0.5);\n                    offset.y = Math.floor(position[1] + 0.5);\n                }\n                offset.x += dx;\n                offset.y += dy;\n            }\n\n            if (rect.intersect(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop)) {\n                if (this.mParent == null) return true;\n                r.set(rect);\n                return this.mParent.getChildVisibleRect(this, r, offset);\n            }\n\n            return false;\n        }\n\n\n\n        protected dispatchDraw(canvas:Canvas) {\n            let count = this.mChildrenCount;\n            let children = this.mChildren;\n            let flags = this.mGroupFlags;\n\n            //TODO when layout animation impl\n            //if ((flags & ViewGroup.FLAG_RUN_ANIMATION) != 0 && this.canAnimate()) {\n            //    const cache:boolean = (this.mGroupFlags & ViewGroup.FLAG_ANIMATION_CACHE) == ViewGroup.FLAG_ANIMATION_CACHE;\n            //    const buildCache:boolean = !this.isHardwareAccelerated();\n            //    for (let i:number = 0; i < count; i++) {\n            //        const child:View = children[i];\n            //        if ((child.mViewFlags & ViewGroup.VISIBILITY_MASK) == ViewGroup.VISIBLE) {\n            //            const params:ViewGroup.LayoutParams = child.getLayoutParams();\n            //            this.attachLayoutAnimationParameters(child, params, i, count);\n            //            this.bindLayoutAnimation(child);\n            //            if (cache) {\n            //                child.setDrawingCacheEnabled(true);\n            //                if (buildCache) {\n            //                    child.buildDrawingCache(true);\n            //                }\n            //            }\n            //        }\n            //    }\n            //    const controller:LayoutAnimationController = this.mLayoutAnimationController;\n            //    if (controller.willOverlap()) {\n            //        this.mGroupFlags |= ViewGroup.FLAG_OPTIMIZE_INVALIDATE;\n            //    }\n            //    controller.start();\n            //    this.mGroupFlags &= ~ViewGroup.FLAG_RUN_ANIMATION;\n            //    this.mGroupFlags &= ~ViewGroup.FLAG_ANIMATION_DONE;\n            //    if (cache) {\n            //        this.mGroupFlags |= ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE;\n            //    }\n            //    if (this.mAnimationListener != null) {\n            //        this.mAnimationListener.onAnimationStart(controller.getAnimation());\n            //    }\n            //}\n\n            let saveCount = 0;\n            let clipToPadding = (flags & ViewGroup.CLIP_TO_PADDING_MASK) == ViewGroup.CLIP_TO_PADDING_MASK;\n            if (clipToPadding) {\n                saveCount = canvas.save();\n                canvas.clipRect(this.mScrollX + this.mPaddingLeft, this.mScrollY + this.mPaddingTop,\n                    this.mScrollX + this.mRight - this.mLeft - this.mPaddingRight,\n                    this.mScrollY + this.mBottom - this.mTop - this.mPaddingBottom);\n\n            }\n\n            // We will draw our child's animation, let's reset the flag\n            this.mPrivateFlags &= ~ViewGroup.PFLAG_DRAW_ANIMATION;\n            this.mGroupFlags &= ~ViewGroup.FLAG_INVALIDATE_REQUIRED;\n            let more:boolean = false;\n            const drawingTime:number = this.getDrawingTime();\n            if ((flags & ViewGroup.FLAG_USE_CHILD_DRAWING_ORDER) == 0) {\n                for (let i:number = 0; i < count; i++) {\n                    const child:View = children[i];\n                    if ((child.mViewFlags & ViewGroup.VISIBILITY_MASK) == ViewGroup.VISIBLE || child.getAnimation() != null) {\n                        more = this.drawChild(canvas, child, drawingTime) || more;\n                    }\n                }\n            } else {\n                for (let i:number = 0; i < count; i++) {\n                    const child:View = children[this.getChildDrawingOrder(count, i)];\n                    if ((child.mViewFlags & ViewGroup.VISIBILITY_MASK) == ViewGroup.VISIBLE || child.getAnimation() != null) {\n                        more = this.drawChild(canvas, child, drawingTime) || more;\n                    }\n                }\n            }\n            // Draw any disappearing views that have animations\n            if (this.mDisappearingChildren != null) {\n                const disappearingChildren:ArrayList<View> = this.mDisappearingChildren;\n                const disappearingCount:number = disappearingChildren.size() - 1;\n                // Go backwards -- we may delete as animations finish\n                for (let i:number = disappearingCount; i >= 0; i--) {\n                    const child:View = disappearingChildren.get(i);\n                    more = this.drawChild(canvas, child, drawingTime) || more;\n                }\n            }\n\n            if (clipToPadding) {\n                canvas.restoreToCount(saveCount);\n            }\n\n            // mGroupFlags might have been updated by drawChild()\n            flags = this.mGroupFlags;\n\n            if ((flags & ViewGroup.FLAG_INVALIDATE_REQUIRED) == ViewGroup.FLAG_INVALIDATE_REQUIRED) {\n                this.invalidate(true);\n            }\n        }\n\n        protected drawChild(canvas:Canvas, child:View , drawingTime:number):boolean {\n            return child.drawFromParent(canvas, this, drawingTime);\n        }\n        protected drawableStateChanged() {\n            super.drawableStateChanged();\n\n            if ((this.mGroupFlags & ViewGroup.FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE) != 0) {\n                if ((this.mGroupFlags & ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN) != 0) {\n                    throw new Error(\"addStateFromChildren cannot be enabled if a\"\n                        + \" child has duplicateParentState set to true\");\n                }\n\n                const children = this.mChildren;\n                const count = this.mChildrenCount;\n\n                for (let i = 0; i < count; i++) {\n                    const child = children[i];\n                    if ((child.mViewFlags & View.DUPLICATE_PARENT_STATE) != 0) {\n                        child.refreshDrawableState();\n                    }\n                }\n            }\n        }\n        jumpDrawablesToCurrentState() {\n            super.jumpDrawablesToCurrentState();\n            const children = this.mChildren;\n            const count = this.mChildrenCount;\n            for (let i = 0; i < count; i++) {\n                children[i].jumpDrawablesToCurrentState();\n            }\n        }\n        protected onCreateDrawableState(extraSpace:number):Array<number> {\n            if ((this.mGroupFlags & ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN) == 0) {\n                return super.onCreateDrawableState(extraSpace);\n            }\n\n            let need = 0;\n            let n = this.getChildCount();\n            for (let i = 0; i < n; i++) {\n                let childState = this.getChildAt(i).getDrawableState();\n\n                if (childState != null) {\n                    need += childState.length;\n                }\n            }\n\n            let state = super.onCreateDrawableState(extraSpace + need);\n\n            for (let i = 0; i < n; i++) {\n                let childState = this.getChildAt(i).getDrawableState();\n\n                if (childState != null) {\n                    state = View.mergeDrawableStates(state, childState);\n                }\n            }\n\n            return state;\n        }\n        setAddStatesFromChildren(addsStates:boolean) {\n            if (addsStates) {\n                this.mGroupFlags |= ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN;\n            } else {\n                this.mGroupFlags &= ~ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN;\n            }\n            this.refreshDrawableState();\n        }\n        addStatesFromChildren():boolean {\n            return (this.mGroupFlags & ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN) != 0;\n        }\n        childDrawableStateChanged(child:android.view.View) {\n            if ((this.mGroupFlags & ViewGroup.FLAG_ADD_STATES_FROM_CHILDREN) != 0) {\n                this.refreshDrawableState();\n            }\n        }\n\n        getClipChildren():boolean {\n            return ((this.mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) != 0);\n        }\n        setClipChildren(clipChildren:boolean) {\n            let previousValue = (this.mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) == ViewGroup.FLAG_CLIP_CHILDREN;\n            if (clipChildren != previousValue) {\n                this.setBooleanFlag(ViewGroup.FLAG_CLIP_CHILDREN, clipChildren);\n            }\n        }\n        setClipToPadding(clipToPadding:boolean) {\n            this.setBooleanFlag(ViewGroup.FLAG_CLIP_TO_PADDING, clipToPadding);\n        }\n        isClipToPadding():boolean{\n            return (this.mGroupFlags & ViewGroup.FLAG_CLIP_TO_PADDING) == ViewGroup.FLAG_CLIP_TO_PADDING;\n        }\n\n\n\n        invalidateChild(child:View, dirty:Rect):void {\n            let parent = this;\n\n            const attachInfo = this.mAttachInfo;\n            if (attachInfo != null) {\n                // If the child is drawing an animation, we want to copy this flag onto\n                // ourselves and the parent to make sure the invalidate request goes\n                // through\n                const drawAnimation = (child.mPrivateFlags & View.PFLAG_DRAW_ANIMATION)\n                    == View.PFLAG_DRAW_ANIMATION;\n\n                // Check whether the child that requests the invalidate is fully opaque\n                // Views being animated or transformed are not considered opaque because we may\n                // be invalidating their old position and need the parent to paint behind them.\n                let childMatrix = child.getMatrix();\n                const isOpaque = child.isOpaque() && !drawAnimation && child.getAnimation() == null && childMatrix.isIdentity();\n\n                // Mark the child as dirty, using the appropriate flag\n                // Make sure we do not set both flags at the same time\n                let opaqueFlag = isOpaque ? View.PFLAG_DIRTY_OPAQUE : View.PFLAG_DIRTY;\n\n                if (child.mLayerType != View.LAYER_TYPE_NONE) {\n                    this.mPrivateFlags |= View.PFLAG_INVALIDATED;\n                    this.mPrivateFlags &= ~View.PFLAG_DRAWING_CACHE_VALID;\n                    child.mLocalDirtyRect.union(dirty);\n                }\n\n                const location = attachInfo.mInvalidateChildLocation;\n                location[0] = child.mLeft;\n                location[1] = child.mTop;\n                if (!childMatrix.isIdentity() ||\n                    (this.mGroupFlags & ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) {\n                    let boundingRect = attachInfo.mTmpTransformRect;\n                    boundingRect.set(dirty);\n                    let transformMatrix:Matrix;\n                    if ((this.mGroupFlags & ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) {\n                        let t = attachInfo.mTmpTransformation;\n                        let transformed = this.getChildStaticTransformation(child, t);\n                        if (transformed) {\n                            transformMatrix = attachInfo.mTmpMatrix;\n                            transformMatrix.set(t.getMatrix());\n                            if (!childMatrix.isIdentity()) {\n                                transformMatrix.preConcat(childMatrix);\n                            }\n                        } else {\n                            transformMatrix = childMatrix;\n                        }\n                    } else {\n                        transformMatrix = childMatrix;\n                    }\n                    transformMatrix.mapRect(boundingRect);\n                    dirty.set(boundingRect);\n                }\n\n                do {\n                    let view:View = null;\n                    if (parent instanceof View) {\n                        view = <View> parent;\n                    }\n\n                    if (drawAnimation) {\n                        if (view != null) {\n                            view.mPrivateFlags |= ViewGroup.PFLAG_DRAW_ANIMATION;\n                        } else if (parent instanceof ViewRootImpl) {\n                            (<ViewRootImpl><any>parent).mIsAnimating = true;\n                        }\n                    }\n\n                    // If the parent is dirty opaque or not dirty, mark it dirty with the opaque\n                    // flag coming from the child that initiated the invalidate\n                    if (view != null) {\n                        //if ((view.mViewFlags & ViewGroup.FADING_EDGE_MASK) != 0 &&//TODO when fade edge effect ok\n                        //    view.getSolidColor() == 0) {\n                            opaqueFlag = View.PFLAG_DIRTY;\n                        //}\n                        if ((view.mPrivateFlags & View.PFLAG_DIRTY_MASK) != View.PFLAG_DIRTY) {\n                            view.mPrivateFlags = (view.mPrivateFlags & ~View.PFLAG_DIRTY_MASK) | opaqueFlag;\n                        }\n                    }\n\n                    parent = <any>parent.invalidateChildInParent(location, dirty);\n                    if (view != null) {\n                        // Account for transform on current parent\n                        let m = view.getMatrix();\n                        if (!m.isIdentity()) {\n                            let boundingRect = attachInfo.mTmpTransformRect;\n                            boundingRect.set(dirty);\n                            m.mapRect(boundingRect);\n                            dirty.set(boundingRect);\n                        }\n                    }\n                } while (parent != null);\n            }\n        }\n\n        invalidateChildInParent(location:Array<number>, dirty:Rect):ViewParent {\n            if ((this.mPrivateFlags & View.PFLAG_DRAWN) == View.PFLAG_DRAWN ||\n                (this.mPrivateFlags & View.PFLAG_DRAWING_CACHE_VALID) == View.PFLAG_DRAWING_CACHE_VALID) {\n                if ((this.mGroupFlags & (ViewGroup.FLAG_OPTIMIZE_INVALIDATE | ViewGroup.FLAG_ANIMATION_DONE)) !=\n                    ViewGroup.FLAG_OPTIMIZE_INVALIDATE) {\n                    dirty.offset(location[0] - this.mScrollX, location[1] - this.mScrollY);\n                    if ((this.mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) == 0) {\n                        dirty.union(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop);\n                    }\n\n                    const left = this.mLeft;\n                    const top = this.mTop;\n\n                    if ((this.mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) == ViewGroup.FLAG_CLIP_CHILDREN) {\n                        if (!dirty.intersect(0, 0, this.mRight - left, this.mBottom - top)) {\n                            dirty.setEmpty();\n                        }\n                    }\n                    this.mPrivateFlags &= ~View.PFLAG_DRAWING_CACHE_VALID;\n\n                    location[0] = left;\n                    location[1] = top;\n\n                    if (this.mLayerType != View.LAYER_TYPE_NONE) {\n                        this.mPrivateFlags |= View.PFLAG_INVALIDATED;\n                       this.mLocalDirtyRect.union(dirty);\n                    }\n\n                    return this.mParent;\n\n                } else {\n                    this.mPrivateFlags &= ~View.PFLAG_DRAWN & ~View.PFLAG_DRAWING_CACHE_VALID;\n\n                    location[0] = this.mLeft;\n                    location[1] = this.mTop;\n                    if ((this.mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) == ViewGroup.FLAG_CLIP_CHILDREN) {\n                        dirty.set(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop);\n                    } else {\n                        // in case the dirty rect extends outside the bounds of this container\n                        dirty.union(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop);\n                    }\n\n                    if (this.mLayerType != View.LAYER_TYPE_NONE) {\n                        this.mPrivateFlags |= View.PFLAG_INVALIDATED;\n                        this.mLocalDirtyRect.union(dirty);\n                    }\n\n                    return this.mParent;\n                }\n            }\n\n            return null;\n        }\n        invalidateChildFast(child:View, dirty:Rect):void{\n            let parent:ViewParent = this;\n\n            const attachInfo = this.mAttachInfo;\n            if (attachInfo != null) {\n                if (child.mLayerType != View.LAYER_TYPE_NONE) {\n                   child.mLocalDirtyRect.union(dirty);\n                }\n\n                let left = child.mLeft;\n                let top = child.mTop;\n                if (!child.getMatrix().isIdentity()) {\n                    child.transformRect(dirty);\n                }\n\n                do {\n                    if (parent instanceof ViewGroup) {\n                        let parentVG = <ViewGroup> parent;\n                        if (parentVG.mLayerType != View.LAYER_TYPE_NONE) {\n                            // Layered parents should be recreated, not just re-issued\n                            parentVG.invalidate();\n                            parent = null;\n                        } else {\n                            parent = parentVG.invalidateChildInParentFast(left, top, dirty);\n                            left = parentVG.mLeft;\n                            top = parentVG.mTop;\n                        }\n                    } else {\n                        // Reached the top; this calls into the usual invalidate method in\n                        // ViewRootImpl, which schedules a traversal\n                        const location = attachInfo.mInvalidateChildLocation;\n                        location[0] = left;\n                        location[1] = top;\n                        parent = parent.invalidateChildInParent(location, dirty);\n                    }\n                } while (parent != null);\n            }\n        }\n        invalidateChildInParentFast(left:number, top:number, dirty:Rect):ViewParent{\n            if ((this.mPrivateFlags & View.PFLAG_DRAWN) == View.PFLAG_DRAWN ||\n                (this.mPrivateFlags & View.PFLAG_DRAWING_CACHE_VALID) == View.PFLAG_DRAWING_CACHE_VALID) {\n                dirty.offset(left - this.mScrollX, top - this.mScrollY);\n                if ((this.mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) == 0) {\n                    dirty.union(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop);\n                }\n\n                if ((this.mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) == 0 ||\n                    dirty.intersect(0, 0, this.mRight - this.mLeft, this.mBottom - this.mTop)) {\n\n                    if (this.mLayerType != View.LAYER_TYPE_NONE) {\n                        this.mLocalDirtyRect.union(dirty);\n                    }\n                    if (!this.getMatrix().isIdentity()) {\n                        this.transformRect(dirty);\n                    }\n\n                    return this.mParent;\n                }\n            }\n\n            return null;\n        }\n\n        /**\n         * Sets  <code>t</code> to be the static transformation of the child, if set, returning a\n         * boolean to indicate whether a static transform was set. The default implementation\n         * simply returns <code>false</code>; subclasses may override this method for different\n         * behavior. {@link #setStaticTransformationsEnabled(boolean)} must be set to true\n         * for this method to be called.\n         *\n         * @param child The child view whose static transform is being requested\n         * @param t The Transformation which will hold the result\n         * @return true if the transformation was set, false otherwise\n         * @see #setStaticTransformationsEnabled(boolean)\n         */\n        protected getChildStaticTransformation(child:View, t:Transformation):boolean  {\n            return false;\n        }\n\n        getChildTransformation():Transformation  {\n            if (this.mChildTransformation == null) {\n                this.mChildTransformation = new Transformation();\n            }\n            return this.mChildTransformation;\n        }\n\n        protected findViewTraversal(id:string):View {\n            if (id == this.mID) {\n                return this;\n            }\n\n            let where:View[] = this.mChildren;\n            const len = this.mChildrenCount;\n\n            for (let i = 0; i < len; i++) {\n                let v = where[i];\n\n                if ((v.mPrivateFlags & View.PFLAG_IS_ROOT_NAMESPACE) == 0) {\n                    v = v.findViewById(id);\n\n                    if (v != null) {\n                        return v;\n                    }\n                }\n            }\n\n            return null;\n        }\n\n        protected findViewWithTagTraversal(tag:any):View {\n            if (tag != null && tag === this.mTag) {\n                return this;\n            }\n\n            let where:View[] = this.mChildren;\n            const len = this.mChildrenCount;\n\n            for (let i = 0; i < len; i++) {\n                let v = where[i];\n\n                if ((v.mPrivateFlags & View.PFLAG_IS_ROOT_NAMESPACE) == 0) {\n                    v = v.findViewWithTag(tag);\n\n                    if (v != null) {\n                        return v;\n                    }\n                }\n            }\n\n            return null;\n        }\n\n        protected findViewByPredicateTraversal(predicate:View.Predicate<View>, childToSkip:View):View {\n            if (predicate.apply(this)) {\n                return this;\n            }\n\n            const where = this.mChildren;\n            const len = this.mChildrenCount;\n\n            for (let i = 0; i < len; i++) {\n                let v = where[i];\n\n                if (v != childToSkip && (v.mPrivateFlags & View.PFLAG_IS_ROOT_NAMESPACE) == 0) {\n                    v = v.findViewByPredicate(predicate);\n\n                    if (v != null) {\n                        return v;\n                    }\n                }\n            }\n\n            return null;\n        }\n\n        requestDisallowInterceptTouchEvent(disallowIntercept:boolean) {\n            if (disallowIntercept == ((this.mGroupFlags & ViewGroup.FLAG_DISALLOW_INTERCEPT) != 0)) {\n                // We're already in this state, assume our ancestors are too\n                return;\n            }\n\n            if (disallowIntercept) {\n                this.mGroupFlags |= ViewGroup.FLAG_DISALLOW_INTERCEPT;\n            } else {\n                this.mGroupFlags &= ~ViewGroup.FLAG_DISALLOW_INTERCEPT;\n            }\n\n            // Pass it up to our parent\n            if (this.mParent != null) {\n                this.mParent.requestDisallowInterceptTouchEvent(disallowIntercept);\n            }\n        }\n        shouldDelayChildPressedState():boolean {\n            return true;\n        }\n\n        onSetLayoutParams(child:View, layoutParams:ViewGroup.LayoutParams) {\n        }\n    }\n\n    export module ViewGroup {\n        export class LayoutParams extends java.lang.JavaObject {\n            private static ClassAttrBinderClazzMap = new Map<java.lang.Class, AttrBinder.ClassBinderMap>();\n            static FILL_PARENT = -1;\n            static MATCH_PARENT = -1;\n            static WRAP_CONTENT = -2;\n\n            public width = 0;\n            public height = 0;\n            private _attrBinder:AttrBinder;\n\n            constructor(context:Context, attrs:HTMLElement);\n            constructor(width:number, height:number);\n            constructor(src:LayoutParams);\n            constructor(...args);\n            constructor(...args) {\n                super();\n                if (args[0] instanceof Context && args[1] instanceof HTMLElement) {\n                    const a = (<Context>args[0]).obtainStyledAttributes(args[1]);\n                    this.setBaseAttributes(a, 'layout_width', 'layout_height');\n                    a.recycle();\n                } else if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n                    this.width = args[0];\n                    this.height = args[1];\n                } else if (args[0] instanceof LayoutParams) {\n                    this.width = args[0].width;\n                    this.height = args[0].height;\n                } else if (args.length === 0) {\n                    // do nothing\n                }\n            }\n\n            /**\n             * Extracts the layout parameters from the supplied attributes.\n             *\n             * @param a the style attributes to extract the parameters from\n             * @param widthAttr the identifier of the width attribute\n             * @param heightAttr the identifier of the height attribute\n             */\n            protected setBaseAttributes(a:android.content.res.TypedArray, widthAttr:string, heightAttr:string):void {\n                this.width = a.getLayoutDimension(widthAttr, LayoutParams.WRAP_CONTENT);\n                this.height = a.getLayoutDimension(heightAttr, LayoutParams.WRAP_CONTENT);\n            }\n\n            getAttrBinder():AttrBinder {\n                if (!this._attrBinder) {\n                    this._attrBinder = this.initBindAttr();\n                }\n                return this._attrBinder;\n            }\n\n            private initBindAttr():AttrBinder {\n                let classAttrBinder = LayoutParams.ClassAttrBinderClazzMap.get(this.getClass());\n                if (!classAttrBinder) {\n                    classAttrBinder = this.createClassAttrBinder();\n                    LayoutParams.ClassAttrBinderClazzMap.set(this.getClass(), classAttrBinder);\n                }\n                const attrBinder = new AttrBinder(this);\n                attrBinder.setClassAttrBind(classAttrBinder);\n                return attrBinder;\n            }\n            protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n                return new androidui.attr.AttrBinder.ClassBinderMap()\n                    .set('layout_width', {\n                        setter(host:LayoutParams, value:any, attrBinder:AttrBinder) {\n                            host.width = attrBinder.parseDimension(value, host.width);\n                        }, getter(host:LayoutParams) {\n                            return host.width;\n                        }\n                    }).set('layout_height', {\n                        setter(host:LayoutParams, value:any, attrBinder:AttrBinder) {\n                            host.height = attrBinder.parseDimension(value, host.height);\n                        }, getter(host:LayoutParams) {\n                            return host.height;\n                        }\n                    })\n            }\n        }\n        export class MarginLayoutParams extends LayoutParams {\n            static DEFAULT_MARGIN_RELATIVE:number = Integer.MIN_VALUE;\n            static DEFAULT_MARGIN_RESOLVED:number = 0;\n            static UNDEFINED_MARGIN = MarginLayoutParams.DEFAULT_MARGIN_RELATIVE;\n\n            public leftMargin = 0;\n            public topMargin = 0;\n            public rightMargin = 0;\n            public bottomMargin = 0;\n\n            constructor(context:Context, attrs:HTMLElement);\n            constructor(src:MarginLayoutParams);\n            constructor(src:LayoutParams);\n            constructor(width:number, height:number);\n            constructor(...args);\n            constructor(...args) {\n                super(...(() => {\n                    if (args[0] instanceof Context && args[1] instanceof HTMLElement) return [0, 0];\n                    else if (typeof args[0] === 'number' && typeof args[1] === 'number') return [args[0], args[1]];\n                    else if (args[0] instanceof MarginLayoutParams) return [args[0]];\n                    else if (args[0] instanceof ViewGroup.LayoutParams) return [args[0]];\n                })());\n\n                if (args[0] instanceof Context && args[1] instanceof HTMLElement) {\n                    const a = (<Context>args[0]).obtainStyledAttributes(args[1]);\n                    this.setBaseAttributes(a, 'layout_width', 'layout_height');\n                    let margin = a.getDimensionPixelSize('layout_margin', -1);\n                    if (margin >= 0) {\n                        this.leftMargin = margin;\n                        this.topMargin = margin;\n                        this.rightMargin= margin;\n                        this.bottomMargin = margin;\n                    } else {\n                        this.leftMargin = a.getDimensionPixelSize('layout_marginLeft', 0);\n                        this.rightMargin = a.getDimensionPixelSize('layout_marginRight', 0);\n                        this.topMargin = a.getDimensionPixelSize('layout_marginTop', 0);\n                        this.bottomMargin = a.getDimensionPixelSize('layout_marginBottom', 0);\n\n                        this.leftMargin = a.getDimensionPixelSize('layout_marginStart', this.leftMargin);\n                        this.rightMargin = a.getDimensionPixelSize('layout_marginEnd', this.rightMargin);\n                    }\n                    a.recycle();\n                } else if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n                } else if (args[0] instanceof MarginLayoutParams) {\n                    const source = args[0];\n                    this.width = source.width;\n                    this.height = source.height;\n\n                    this.leftMargin = source.leftMargin;\n                    this.topMargin = source.topMargin;\n                    this.rightMargin = source.rightMargin;\n                    this.bottomMargin = source.bottomMargin;\n                } else if (args[0] instanceof ViewGroup.LayoutParams) {\n                }\n            }\n\n            protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n                return super.createClassAttrBinder().set('layout_marginLeft', {\n                    setter(host:MarginLayoutParams, value:any) {\n                        if(value==null) value = 0;\n                        host.leftMargin = value;\n                    }, getter(host:MarginLayoutParams) {\n                        return host.leftMargin;\n                    }\n                }).set('layout_marginStart', {\n                    setter(host:MarginLayoutParams, value:any) {\n                        if(value==null) value = 0;\n                        host.leftMargin = value;\n                    }, getter(host:MarginLayoutParams) {\n                        return host.leftMargin;\n                    }\n                }).set('layout_marginTop', {\n                    setter(host:MarginLayoutParams, value:any) {\n                        if(value==null) value = 0;\n                        host.topMargin = value;\n                    }, getter(host:MarginLayoutParams) {\n                        return host.topMargin;\n                    }\n                }).set('layout_marginRight', {\n                    setter(host:MarginLayoutParams, value:any) {\n                        if(value==null) value = 0;\n                        host.rightMargin = value;\n                    }, getter(host:MarginLayoutParams) {\n                        return host.rightMargin;\n                    }\n                }).set('layout_marginEnd', {\n                    setter(host:MarginLayoutParams, value:any) {\n                        if(value==null) value = 0;\n                        host.rightMargin = value;\n                    }, getter(host:MarginLayoutParams) {\n                        return host.rightMargin;\n                    }\n                }).set('layout_marginBottom', {\n                    setter(host:MarginLayoutParams, value:any) {\n                        if(value==null) value = 0;\n                        host.bottomMargin = value;\n                    }, getter(host:MarginLayoutParams) {\n                        return host.bottomMargin;\n                    }\n                }).set('layout_margin', {\n                    setter(host:MarginLayoutParams, value:any, attrBinder:AttrBinder) {\n                        if(value==null) value = 0;\n                        let [top, right, bottom, left] = attrBinder.parsePaddingMarginTRBL(value);\n                        host.topMargin = top;\n                        host.rightMargin = right;\n                        host.bottomMargin = bottom;\n                        host.leftMargin = left;\n                    }, getter(host:MarginLayoutParams) {\n                        return host.topMargin + ' ' + host.rightMargin + ' ' + host.bottomMargin + ' ' + host.leftMargin;\n                    }\n                });\n            }\n\n            setMargins(left:number, top:number, right:number, bottom:number) {\n                this.leftMargin = left;\n                this.topMargin = top;\n                this.rightMargin = right;\n                this.bottomMargin = bottom;\n            }\n\n            setLayoutDirection(layoutDirection:number):void  {\n            }\n\n            getLayoutDirection():number  {\n                return View.LAYOUT_DIRECTION_LTR;\n            }\n\n            isLayoutRtl():boolean  {\n                return this.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;\n            }\n\n            resolveLayoutDirection(layoutDirection:number):void  {\n                //do nothing\n            }\n        }\n        export interface OnHierarchyChangeListener {\n            onChildViewAdded(parent:View, child:View);\n            onChildViewRemoved(parent:View, child:View);\n        }\n    }\n\n    class TouchTarget {\n        private static MAX_RECYCLED = 32;\n        private static sRecycleBin:TouchTarget;\n        private static sRecycledCount=0;\n        static ALL_POINTER_IDS = -1; // all ones\n\n        child:View;\n        pointerIdBits:number;\n        next:TouchTarget;\n\n        static obtain(child:View , pointerIdBits:number ) {\n            let target:TouchTarget;\n            if (TouchTarget.sRecycleBin == null) {\n                target = new TouchTarget();\n            } else {\n                target = TouchTarget.sRecycleBin;\n                TouchTarget.sRecycleBin = target.next;\n                TouchTarget.sRecycledCount--;\n                target.next = null;\n            }\n            target.child = child;\n            target.pointerIdBits = pointerIdBits;\n            return target;\n        }\n\n        public recycle() {\n            if (TouchTarget.sRecycledCount < TouchTarget.MAX_RECYCLED) {\n                this.next = TouchTarget.sRecycleBin;\n                TouchTarget.sRecycleBin = this;\n                TouchTarget.sRecycledCount += 1;\n            } else {\n                this.next = null;\n            }\n            this.child = null;\n        }\n    }\n\n}"
  },
  {
    "path": "src/android/view/ViewOverlay.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"ViewGroup.ts\"/>\n///<reference path=\"ViewRootImpl.ts\"/>\n///<reference path=\"View.ts\"/>\n///<reference path=\"../graphics/drawable/Drawable.ts\"/>\n\nmodule android.view{\n    import Drawable = android.graphics.drawable.Drawable;\n\n    export class ViewOverlay{\n        mOverlayViewGroup: ViewOverlay.OverlayViewGroup;\n        constructor(hostView:View) {\n            this.mOverlayViewGroup = new ViewOverlay.OverlayViewGroup(hostView);\n        }\n        getOverlayView():ViewGroup {\n            return this.mOverlayViewGroup;\n        }\n        add(drawable:Drawable) {\n            this.mOverlayViewGroup.add(drawable);\n        }\n        remove(drawable:Drawable) {\n            //this.mOverlayViewGroup.remove(drawable);\n        }\n        clear() {\n            this.mOverlayViewGroup.clear();\n        }\n        isEmpty() {\n            return this.mOverlayViewGroup.isEmpty();\n        }\n    }\n    export module ViewOverlay{\n        export class OverlayViewGroup extends ViewGroup{\n            mHostView:View;\n            mDrawables:Set<Drawable>;\n\n            constructor(hostView:View) {\n                super(hostView.getContext());\n                this.mHostView = hostView;\n                this.mAttachInfo = hostView.mAttachInfo;\n                this.mRight = hostView.getWidth();\n                this.mBottom = hostView.getHeight();\n            }\n\n            private addDrawable(drawable:Drawable) {\n                //if(!this.mDrawables) this.mDrawables = new Set<Drawable>();\n                //\n                //if (!this.mDrawables.has(drawable)) {\n                //    // Make each drawable unique in the overlay; can't add it more than once\n                //    this.mDrawables.add(drawable);\n                //    this.invalidate(drawable.getBounds());\n                //    drawable.setCallback(this);\n                //}\n            }\n            addView(child:View) {\n                //if (child.getParent() instanceof ViewGroup) {\n                //    let parent = <ViewGroup>child.getParent();\n                //    if (parent != mHostView && parent.getParent() != null &&\n                //        parent.mAttachInfo != null) {\n                //        // Moving to different container; figure out how to position child such that\n                //        // it is in the same location on the screen\n                //        let parentLocation = new int[2];\n                //        let hostViewLocation = new int[2];\n                //        parent.getLocationOnScreen(parentLocation);\n                //        mHostView.getLocationOnScreen(hostViewLocation);\n                //        child.offsetLeftAndRight(parentLocation[0] - hostViewLocation[0]);\n                //        child.offsetTopAndBottom(parentLocation[1] - hostViewLocation[1]);\n                //    }\n                //    parent.removeView(child);\n                //    // fail-safe if view is still attached for any reason\n                //    if (child.getParent() != null) {\n                //        child.mParent = null;\n                //    }\n                //}\n                //super.addView(child);\n            }\n            add(drawable:Drawable);\n            add(child:View);\n            add(arg){\n                if(arg instanceof Drawable) this.addDrawable(arg);\n                else if(arg instanceof View) this.addView(arg);\n            }\n\n\n            //remove(drawable:Drawable);\n            //remove(view:View);\n            //remove(arg) {\n            //    if(arg instanceof View){\n            //        super.removeView(arg);\n            //    }else if(arg instanceof Drawable){\n            //        let drawable = arg;\n            //        if (this.mDrawables != null) {\n            //            this.mDrawables.remove(drawable);\n            //            invalidate(drawable.getBounds());\n            //            drawable.setCallback(null);\n            //        }\n            //    }\n            //}\n            clear() {\n                //this.removeAllViews();\n                //if (this.mDrawables != null) {\n                //    this.mDrawables.clear();\n                //}\n            }\n            isEmpty():boolean {\n                return true;\n                //if (this.getChildCount() == 0 &&\n                //    (this.mDrawables == null || this.mDrawables.size() == 0)) {\n                //    return true;\n                //}\n                //return false;\n            }\n\n            protected onLayout(changed:boolean, l:number, t:number, r:number, b:number) {\n\n            }\n\n            //TODO impl\n\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/ViewParent.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"View.ts\"/>\n///<reference path=\"../graphics/Point.ts\"/>\n///<reference path=\"../graphics/Rect.ts\"/>\n\nmodule android.view{\n    import View = android.view.View;\n    import Rect = android.graphics.Rect;\n    import Point = android.graphics.Point;\n    /**\n     * Defines the responsibilities for a class that will be a parent of a View.\n     * This is the API that a view sees when it wants to interact with its parent.\n     *\n     */\n    export interface ViewParent {\n        /**\n         * Called when something has changed which has invalidated the layout of a\n         * child of this view parent. This will schedule a layout pass of the view\n         * tree.\n         */\n        requestLayout()\n        /**\n         * Indicates whether layout was requested on this view parent.\n         *\n         * @return true if layout was requested, false otherwise\n         */\n        isLayoutRequested():boolean\n        /**\n         * Called when a child wants the view hierarchy to gather and report\n         * transparent regions to the window compositor. Views that \"punch\" holes in\n         * the view hierarchy, such as SurfaceView can use this API to improve\n         * performance of the system. When no such a view is present in the\n         * hierarchy, this optimization in unnecessary and might slightly reduce the\n         * view hierarchy performance.\n         *\n         * @param child the view requesting the transparent region computation\n         *\n         */\n        //requestTransparentRegion(child:View)\n        /**\n         * All or part of a child is dirty and needs to be redrawn.\n         *\n         * @param child The child which is dirty\n         * @param r The area within the child that is invalid\n         */\n        invalidateChild(child:View, r:Rect)\n        /**\n         * All or part of a child is dirty and needs to be redrawn.\n         *\n         * <p>The location array is an array of two int values which respectively\n         * define the left and the top position of the dirty child.</p>\n         *\n         * <p>This method must return the parent of this ViewParent if the specified\n         * rectangle must be invalidated in the parent. If the specified rectangle\n         * does not require invalidation in the parent or if the parent does not\n         * exist, this method must return null.</p>\n         *\n         * <p>When this method returns a non-null value, the location array must\n         * have been updated with the left and top coordinates of this ViewParent.</p>\n         *\n         * @param location An array of 2 ints containing the left and top\n         * coordinates of the child to invalidate\n         * @param r The area within the child that is invalid\n         *\n         * @return the parent of this ViewParent or null\n         */\n        invalidateChildInParent(location:Array<number>, r:Rect):ViewParent\n        /**\n         * Returns the parent if it exists, or null.\n         *\n         * @return a ViewParent or null if this ViewParent does not have a parent\n         */\n        getParent():ViewParent\n        /**\n         * Called when a child of this parent wants focus\n         *\n         * @param child The child of this ViewParent that wants focus. This view\n         * will contain the focused view. It is not necessarily the view that\n         * actually has focus.\n         * @param focused The view that is a descendant of child that actually has\n         * focus\n         */\n        requestChildFocus(child:View, focused:View)\n        /**\n         * Tell view hierarchy that the global view attributes need to be\n         * re-evaluated.\n         *\n         * @param child View whose attributes have changed.\n         */\n        //recomputeViewAttributes(child:View)\n        /**\n         * Called when a child of this parent is giving up focus\n         *\n         * @param child The view that is giving up focus\n         */\n        clearChildFocus(child:View)\n        /**\n         * Compute the visible part of a rectangular region defined in terms of a child view's\n         * coordinates.\n         *\n         * <p>Returns the clipped visible part of the rectangle <code>r</code>, defined in the\n         * <code>child</code>'s local coordinate system. <code>r</code> is modified by this method to\n         * contain the result, expressed in the global (root) coordinate system.</p>\n         *\n         * <p>The resulting rectangle is always axis aligned. If a rotation is applied to a node in the\n         * View hierarchy, the result is the axis-aligned bounding box of the visible rectangle.</p>\n         *\n         * @param child A child View, whose rectangular visible region we want to compute\n         * @param r The input rectangle, defined in the child coordinate system. Will be overwritten to\n         * contain the resulting visible rectangle, expressed in global (root) coordinates\n         * @param offset The input coordinates of a point, defined in the child coordinate system.\n         * As with the <code>r</code> parameter, this will be overwritten to contain the global (root)\n         * coordinates of that point.\n         * A <code>null</code> value is valid (in case you are not interested in this result)\n         * @return true if the resulting rectangle is not empty, false otherwise\n         */\n        getChildVisibleRect(child:View, r:Rect, offset:Point):boolean\n        /**\n         * Find the nearest view in the specified direction that wants to take focus\n         *\n         * @param v The view that currently has focus\n         * @param direction One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT\n         */\n        focusSearch(v:View, direction:number):View\n        /**\n         * Change the z order of the child so it's on top of all other children.\n         * This ordering change may affect layout, if this container\n         * uses an order-dependent layout scheme (e.g., LinearLayout). Prior\n         * to { android.os.Build.VERSION_CODES#KITKAT} this\n         * method should be followed by calls to {@link #requestLayout()} and\n         * {@link View#invalidate()} on this parent to force the parent to redraw\n         * with the new child ordering.\n         *\n         * @param child The child to bring to the top of the z order\n         */\n        bringChildToFront(child:View)\n        /**\n         * Tells the parent that a new focusable view has become available. This is\n         * to handle transitions from the case where there are no focusable views to\n         * the case where the first focusable view appears.\n         *\n         * @param v The view that has become newly focusable\n         */\n        focusableViewAvailable(v:View)\n        /**\n         * This method is called on the parent when a child's drawable state\n         * has changed.\n         *\n         * @param child The child whose drawable state has changed.\n         */\n        childDrawableStateChanged(child:View)\n        /**\n         * Called when a child does not want this parent and its ancestors to\n         * intercept touch events with\n         * {@link ViewGroup#onInterceptTouchEvent(MotionEvent)}.\n         *\n         * <p>This parent should pass this call onto its parents. This parent must obey\n         * this request for the duration of the touch (that is, only clear the flag\n         * after this parent has received an up or a cancel.</p>\n         *\n         * @param disallowIntercept True if the child does not want the parent to\n         * intercept touch events.\n         */\n        requestDisallowInterceptTouchEvent(disallowIntercept:boolean)\n        /**\n         * Called when a child of this group wants a particular rectangle to be\n         * positioned onto the screen. {@link ViewGroup}s overriding this can trust\n         * that:\n         * <ul>\n         * <li>child will be a direct child of this group</li>\n         * <li>rectangle will be in the child's coordinates</li>\n         * </ul>\n         *\n         * <p>{@link ViewGroup}s overriding this should uphold the contract:</p>\n         * <ul>\n         * <li>nothing will change if the rectangle is already visible</li>\n         * <li>the view port will be scrolled only just enough to make the\n         * rectangle visible</li>\n         * <ul>\n         *\n         * @param child The direct child making the request.\n         * @param rectangle The rectangle in the child's coordinates the child\n         * wishes to be on the screen.\n         * @param immediate True to forbid animated or delayed scrolling,\n         * false otherwise\n         * @return Whether the group scrolled to handle the operation\n         */\n        requestChildRectangleOnScreen(child:View, rectangle:Rect, immediate:boolean):boolean\n        /**\n         * Called when a child view now has or no longer is tracking transient state.\n         *\n         * <p>\"Transient state\" is any state that a View might hold that is not expected to\n         * be reflected in the data model that the View currently presents. This state only\n         * affects the presentation to the user within the View itself, such as the current\n         * state of animations in progress or the state of a text selection operation.</p>\n         *\n         * <p>Transient state is useful for hinting to other components of the View system\n         * that a particular view is tracking something complex but encapsulated.\n         * A <code>ListView</code> for example may acknowledge that list item Views\n         * with transient state should be preserved within their position or stable item ID\n         * instead of treating that view as trivially replaceable by the backing adapter.\n         * This allows adapter implementations to be simpler instead of needing to track\n         * the state of item view animations in progress such that they could be restored\n         * in the event of an unexpected recycling and rebinding of attached item views.</p>\n         *\n         * <p>This method is called on a parent view when a child view or a view within\n         * its subtree begins or ends tracking of internal transient state.</p>\n         *\n         * @param child Child view whose state has changed\n         * @param hasTransientState true if this child has transient state\n         */\n        childHasTransientStateChanged(child:View, hasTransientState:boolean)\n        /**\n         * Ask that a new dispatch of {@link View#fitSystemWindows(Rect)\n* View.fitSystemWindows(Rect)} be performed.\n         */\n        //requestFitSystemWindows()\n        /**\n         * Tells if this view parent can resolve the layout direction.\n         * See {@link View#setLayoutDirection(int)}\n         *\n         * @return True if this view parent can resolve the layout direction.\n         */\n        //canResolveLayoutDirection():boolean\n        /**\n         * Tells if this view parent layout direction is resolved.\n         * See {@link View#setLayoutDirection(int)}\n         *\n         * @return True if this view parent layout direction is resolved.\n         */\n        //isLayoutDirectionResolved:boolean\n        /**\n         * Return this view parent layout direction. See {@link View#getLayoutDirection()}\n         *\n         * @return {@link View#LAYOUT_DIRECTION_RTL} if the layout direction is RTL or returns\n         * {@link View#LAYOUT_DIRECTION_LTR} if the layout direction is not RTL.\n         */\n        //layoutDirection:number\n        /**\n         * Tells if this view parent can resolve the text direction.\n         * See {@link View#setTextDirection(int)}\n         *\n         * @return True if this view parent can resolve the text direction.\n         */\n        //canResolveTextDirection():boolean\n        /**\n         * Tells if this view parent text direction is resolved.\n         * See {@link View#setTextDirection(int)}\n         *\n         * @return True if this view parent text direction is resolved.\n         */\n        //isTextDirectionResolved:boolean\n        /**\n         * Return this view parent text direction. See {@link View#getTextDirection()}\n         *\n         * @return the resolved text direction. Returns one of:\n         *\n         * {@link View#TEXT_DIRECTION_FIRST_STRONG}\n         * {@link View#TEXT_DIRECTION_ANY_RTL},\n         * {@link View#TEXT_DIRECTION_LTR},\n         * {@link View#TEXT_DIRECTION_RTL},\n         * {@link View#TEXT_DIRECTION_LOCALE}\n         */\n        //textDirection:number\n        /**\n         * Tells if this view parent can resolve the text alignment.\n         * See {@link View#setTextAlignment(int)}\n         *\n         * @return True if this view parent can resolve the text alignment.\n         */\n        //canResolveTextAlignment():boolean\n        /**\n         * Tells if this view parent text alignment is resolved.\n         * See {@link View#setTextAlignment(int)}\n         *\n         * @return True if this view parent text alignment is resolved.\n         */\n        //isTextAlignmentResolved:boolean\n        /**\n         * Return this view parent text alignment. See {@link View#getTextAlignment()}\n         *\n         * @return the resolved text alignment. Returns one of:\n         *\n         * {@link View#TEXT_ALIGNMENT_GRAVITY},\n         * {@link View#TEXT_ALIGNMENT_CENTER},\n         * {@link View#TEXT_ALIGNMENT_TEXT_START},\n         * {@link View#TEXT_ALIGNMENT_TEXT_END},\n         * {@link View#TEXT_ALIGNMENT_VIEW_START},\n         * {@link View#TEXT_ALIGNMENT_VIEW_END}\n         */\n        //textAlignment:number\n    }\n}"
  },
  {
    "path": "src/android/view/ViewRootImpl.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"ViewParent.ts\"/>\n///<reference path=\"View.ts\"/>\n///<reference path=\"Surface.ts\"/>\n///<reference path=\"../util/Log.ts\"/>\n///<reference path=\"../util/Log.ts\"/>\n///<reference path=\"../os/Handler.ts\"/>\n///<reference path=\"../os/Message.ts\"/>\n///<reference path=\"../os/SystemClock.ts\"/>\n///<reference path=\"../content/res/Resources.ts\"/>\n///<reference path=\"../graphics/Point.ts\"/>\n///<reference path=\"../graphics/Rect.ts\"/>\n///<reference path=\"../graphics/Canvas.ts\"/>\n///<reference path=\"../../java/lang/Runnable.ts\"/>\n///<reference path=\"../../java/lang/System.ts\"/>\n\nmodule android.view {\n    import ViewParent = android.view.ViewParent;\n    import View = android.view.View;\n    import Resources = android.content.res.Resources;\n    import Rect = android.graphics.Rect;\n    import Point = android.graphics.Point;\n    import Canvas = android.graphics.Canvas;\n    import Handler = android.os.Handler;\n    import Message = android.os.Message;\n    import SystemClock = android.os.SystemClock;\n    import Runnable = java.lang.Runnable;\n    import System = java.lang.System;\n    import Log = android.util.Log;\n    import Surface = android.view.Surface;\n    import AndroidUI = androidui.AndroidUI;\n\n    export class ViewRootImpl implements ViewParent {\n        static TAG = \"ViewRootImpl\";\n        private static DBG = Log.View_DBG;\n        static LOCAL_LOGV = ViewRootImpl.DBG;\n        static DEBUG_DRAW = false || ViewRootImpl.LOCAL_LOGV;\n        static DEBUG_LAYOUT = false || ViewRootImpl.LOCAL_LOGV;\n        static DEBUG_INPUT_RESIZE = false || ViewRootImpl.LOCAL_LOGV;\n        static DEBUG_ORIENTATION = false || ViewRootImpl.LOCAL_LOGV;\n        static DEBUG_CONFIGURATION = false || ViewRootImpl.LOCAL_LOGV;\n        static DEBUG_FPS = false || ViewRootImpl.LOCAL_LOGV;\n\n        static ContinueEventToDom = Symbol();\n\n        private mView:View;\n        private mViewVisibility = View.GONE;\n        private mStopped = false;\n        private mWidth:number = -1;\n        private mHeight:number = -1;\n        private mDirty = new Rect();\n        private mIsAnimating = false;\n        private mTempRect:Rect = new Rect();\n        private mVisRect:Rect = new Rect();\n        private mTraversalScheduled:boolean = false;\n        private mWillDrawSoon:boolean = false;\n        private mIsInTraversal:boolean = false;\n        private mLayoutRequested:boolean = false;\n        private mFirst:boolean = true;\n        private mFullRedrawNeeded:boolean = false;\n        private mIsDrawing:boolean = false;\n        private mAdded:boolean = false;\n        private mAddedTouchMode:boolean = false;\n        private mInTouchMode:boolean = false;\n        private mWinFrame = new Rect();//Root Element Bound\n        private mInLayout:boolean;\n        private mLayoutRequesters : Array<View> = [];\n        private mHandlingLayoutInLayoutRequest:boolean;\n        private mRemoved:boolean;\n        private mHandler = new ViewRootHandler();\n        private mViewScrollChanged = false;\n        private mTreeObserver = new ViewTreeObserver();\n        private mIgnoreDirtyState = false;\n        private mSetIgnoreDirtyState = false;\n        private mDrawingTime = 0;\n\n        private mFirstInputStage:InputStage;\n        //private mFirstPostImeInputStage:InputStage;\n\n\n        // Variables to track frames per second, enabled via DEBUG_FPS flag\n        private mFpsStartTime = -1;\n        private mFpsPrevTime = -1;\n        private mFpsNumFrames = 0;\n\n        private mSurface : Surface;\n\n        constructor() {\n        }\n\n        initSurface(canvasElement:HTMLCanvasElement){\n            this.mSurface = new Surface(canvasElement, this);\n        }\n\n        notifyResized(frame:Rect){\n            this.mWinFrame.set(frame.left, frame.top, frame.right, frame.bottom);\n            this.requestLayout();\n            if(this.mSurface) this.mSurface.notifyBoundChange();\n        }\n\n        setView(view:View) {\n            if (this.mView == null) {\n                this.mView = view;\n\n                //this.mAttachInfo.mRootView = view;\n                this.mAdded = true;\n\n                // Schedule the first layout -before- adding to the window\n                // manager, to make sure we do the relayout before receiving\n                // any other events from the system.\n                this.requestLayout();\n                //this.mAttachInfo.mRecomputeGlobalAttributes = true;\n                //collectViewAttributes();\n\n                //mPendingOverscanInsets.set(0, 0, 0, 0);\n                //mPendingContentInsets.set(mAttachInfo.mContentInsets);\n                //mPendingVisibleInsets.set(0, 0, 0, 0);\n\n\n                view.assignParent(this);\n                this.mAddedTouchMode = true;\n\n                let syntheticInputStage = new SyntheticInputStage(this);\n                let viewPostImeStage = new ViewPostImeInputStage(this, syntheticInputStage);\n                let earlyPostImeStage = new EarlyPostImeInputStage(this, viewPostImeStage);\n                this.mFirstInputStage = earlyPostImeStage;\n            }\n        }\n\n        getView():View {\n            return this.mView;\n        }\n\n        getHostVisibility():number {\n            return this.mView.getVisibility();\n        }\n\n        private mTraversalRunnable:TraversalRunnable = new TraversalRunnable(this);\n\n        private scheduleTraversals() {\n            if (!this.mTraversalScheduled) {\n                this.mTraversalScheduled = true;\n                this.mHandler.postAsTraversal(this.mTraversalRunnable);\n\n            }\n        }\n\n        private unscheduleTraversals() {\n            if (this.mTraversalScheduled) {\n                this.mTraversalScheduled = false;\n                this.mHandler.removeCallbacks(this.mTraversalRunnable);\n            }\n        }\n\n        doTraversal() {\n            if (this.mTraversalScheduled) {\n                this.mTraversalScheduled = false;\n\n                this.performTraversals();\n            }\n        }\n\n        private measureHierarchy(host:View, lp:ViewGroup.LayoutParams, desiredWindowWidth:number, desiredWindowHeight:number) {\n            let windowSizeMayChange = false;\n            if (ViewRootImpl.DEBUG_ORIENTATION || ViewRootImpl.DEBUG_LAYOUT) Log.v(ViewRootImpl.TAG,\n                \"Measuring \" + host + \" in display \" + desiredWindowWidth\n                + \"x\" + desiredWindowHeight + \"...\");\n\n            let childWidthMeasureSpec = ViewRootImpl.getRootMeasureSpec(desiredWindowWidth, lp.width);\n            let childHeightMeasureSpec = ViewRootImpl.getRootMeasureSpec(desiredWindowHeight, lp.height);\n            this.performMeasure(childWidthMeasureSpec, childHeightMeasureSpec);\n            if (this.mWidth != host.getMeasuredWidth() || this.mHeight != host.getMeasuredHeight()) {\n                windowSizeMayChange = true;\n            }\n\n            if (ViewRootImpl.DBG) {\n                System.out.println(\"======================================\");\n                System.out.println(\"performTraversals -- after measure\");\n                host.debug();\n            }\n\n            return windowSizeMayChange;\n        }\n\n        private static getRootMeasureSpec(windowSize:number, rootDimension:number):number {\n            let MeasureSpec = View.MeasureSpec;\n            let measureSpec;\n            switch (rootDimension) {\n\n                case ViewGroup.LayoutParams.MATCH_PARENT:\n                    // Window can't resize. Force root view to be windowSize.\n                    measureSpec = MeasureSpec.makeMeasureSpec(windowSize, MeasureSpec.EXACTLY);\n                    break;\n                case ViewGroup.LayoutParams.WRAP_CONTENT:\n                    // Window can resize. Set max size for root view.\n                    measureSpec = MeasureSpec.makeMeasureSpec(windowSize, MeasureSpec.AT_MOST);\n                    break;\n                default:\n                    // Window wants to be an exact size. Force root view to be that size.\n                    measureSpec = MeasureSpec.makeMeasureSpec(rootDimension, MeasureSpec.EXACTLY);\n                    break;\n            }\n            return measureSpec;\n        }\n\n        private performTraversals() {\n            let host = this.mView;\n\n            if (ViewRootImpl.DBG) {\n                System.out.println(\"======================================\");\n                System.out.println(\"performTraversals\");\n                host.debug();\n            }\n\n            if (host == null || !this.mAdded) return;\n\n            this.mIsInTraversal = true;\n            this.mWillDrawSoon = true;\n            let windowSizeMayChange = false;\n            let newSurface = false;\n            let surfaceChanged = false;\n            let lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);\n\n            let desiredWindowWidth;\n            let desiredWindowHeight;\n\n            //let attachInfo = this.mAttachInfo;\n\n            let viewVisibility = this.getHostVisibility();\n            let viewVisibilityChanged = this.mViewVisibility != viewVisibility;// || mNewSurfaceNeeded;\n\n            let params:ViewGroup.LayoutParams = null;\n\n            let frame = this.mWinFrame;\n            desiredWindowWidth = frame.width();\n            desiredWindowHeight = frame.height();\n            if (this.mFirst) {\n                this.mFullRedrawNeeded = true;\n                this.mLayoutRequested = true;\n\n                //let packageMetrics = Resources.getDisplayMetrics();\n                //desiredWindowWidth = packageMetrics.widthPixels;\n                //desiredWindowHeight = packageMetrics.heightPixels;\n\n                //attachInfo.mHasWindowFocus = true;\n                //attachInfo.mWindowVisibility = viewVisibility;\n                viewVisibilityChanged = false;\n                //mLastConfiguration.setTo(host.getResources().getConfiguration());\n                // Set the layout direction if it has not been set before (inherit is the default)\n                //if (mViewLayoutDirectionInitial == View.LAYOUT_DIRECTION_INHERIT) {\n                //    host.setLayoutDirection(mLastConfiguration.getLayoutDirection());\n                //}\n                //host.dispatchAttachedToWindow(attachInfo, 0);\n                //attachInfo.mTreeObserver.dispatchOnWindowAttachedChange(true);\n                //mFitSystemWindowsInsets.set(mAttachInfo.mContentInsets);\n                //host.fitSystemWindows(mFitSystemWindowsInsets);\n                //Log.i(TAG, \"Screen on initialized: \" + attachInfo.mKeepScreenOn);\n\n            } else {\n                if (desiredWindowWidth != this.mWidth || desiredWindowHeight != this.mHeight) {\n                    if (ViewRootImpl.DEBUG_ORIENTATION) {\n                        Log.v(ViewRootImpl.TAG, \"View \" + host + \" resized to: \" + frame);\n                    }\n                    this.mFullRedrawNeeded = true;\n                    this.mLayoutRequested = true;\n                    windowSizeMayChange = true;\n                }\n            }\n\n            if (viewVisibilityChanged) {\n                //attachInfo.mWindowVisibility = viewVisibility;\n                //host.dispatchWindowVisibilityChanged(viewVisibility);\n\n                //if (viewVisibility == View.GONE) {\n                    // After making a window gone, we will count it as being\n                    // shown for the first time the next time it gets focus.\n                    //mHasHadWindowFocus = false;\n                //}\n            }\n\n            // Execute enqueued actions on every traversal in case a detached view enqueued an action\n            ViewRootImpl.getRunQueue(this).executeActions(this.mHandler);\n\n            let layoutRequested = this.mLayoutRequested;\n            if (layoutRequested) {\n\n                if (this.mFirst) {\n                    // make sure touch mode code executes by setting cached value\n                    // to opposite of the added touch mode.\n                    this.mInTouchMode = !this.mAddedTouchMode;\n                    this.ensureTouchModeLocally(this.mAddedTouchMode);\n\n                } else {\n                    //if (!mPendingOverscanInsets.equals(mAttachInfo.mOverscanInsets)) {\n                    //    insetsChanged = true;\n                    //}\n                    //if (!mPendingContentInsets.equals(mAttachInfo.mContentInsets)) {\n                    //    insetsChanged = true;\n                    //}\n                    //if (!mPendingVisibleInsets.equals(mAttachInfo.mVisibleInsets)) {\n                    //    mAttachInfo.mVisibleInsets.set(mPendingVisibleInsets);\n                    //    if (DEBUG_LAYOUT) Log.v(TAG, \"Visible insets changing to: \"\n                    //        + mAttachInfo.mVisibleInsets);\n                    //}\n                    if (lp.width < 0 || lp.height < 0) {\n                        windowSizeMayChange = true;\n\n                        //let packageMetrics = Resources.getDisplayMetrics();\n                        //desiredWindowWidth = packageMetrics.widthPixels;\n                        //desiredWindowHeight = packageMetrics.heightPixels;\n                    }\n                }\n\n                // Ask host how big it wants to be\n                windowSizeMayChange = this.measureHierarchy(host, lp,\n                    desiredWindowWidth, desiredWindowHeight) || windowSizeMayChange;\n            }\n\n            //if (this.mFirst || attachInfo.mViewVisibilityChanged) {\n            //    attachInfo.mViewVisibilityChanged = false;\n            //}\n\n            if (layoutRequested) {\n                // Clear this now, so that if anything requests a layout in the\n                // rest of this function we will catch it and re-run a full\n                // layout pass.\n                this.mLayoutRequested = false;\n            }\n\n            let windowShouldResize = layoutRequested && windowSizeMayChange\n                && ((this.mWidth != host.getMeasuredWidth() || this.mHeight != host.getMeasuredHeight())\n                || (lp.width < 0 && frame.width() !== desiredWindowWidth && frame.width() !== this.mWidth)\n                || (lp.height < 0 && frame.height() !== desiredWindowHeight && frame.height() !== this.mHeight));\n\n            if (this.mFirst || windowShouldResize || viewVisibilityChanged) {\n\n                if (ViewRootImpl.DEBUG_LAYOUT) {\n                    Log.i(ViewRootImpl.TAG, \"host=w:\" + host.getMeasuredWidth() + \", h:\" +\n                        host.getMeasuredHeight() + \", params=\" + params);\n                }\n\n                //if (ViewRootImpl.DEBUG_LAYOUT) Log.v(ViewRootImpl.TAG, \"relayout: frame=\" + frame.toShortString());\n\n                if (ViewRootImpl.DEBUG_ORIENTATION) Log.v(ViewRootImpl.TAG, \"Relayout returned: frame=\" + frame);\n\n                //attachInfo.mWindowLeft = frame.left;\n                //attachInfo.mWindowTop = frame.top;\n\n                // !!FIXME!! This next section handles the case where we did not get the\n                // window size we asked for. We should avoid this by getting a maximum size from\n                // the window session beforehand.\n                if (this.mWidth != frame.width() || this.mHeight != frame.height()) {\n                    this.mWidth = frame.width();\n                    this.mHeight = frame.height();\n                }\n\n                if (this.mWidth != host.getMeasuredWidth()\n                    || this.mHeight != host.getMeasuredHeight()) {\n                    let childWidthMeasureSpec = ViewRootImpl.getRootMeasureSpec(this.mWidth, lp.width);\n                    let childHeightMeasureSpec = ViewRootImpl.getRootMeasureSpec(this.mHeight, lp.height);\n\n                    if (ViewRootImpl.DEBUG_LAYOUT) Log.v(ViewRootImpl.TAG, \"Ooops, something changed!  mWidth=\"\n                        + this.mWidth + \" measuredWidth=\" + host.getMeasuredWidth()\n                        + \" mHeight=\" + this.mHeight\n                        + \" measuredHeight=\" + host.getMeasuredHeight());\n\n                    // Ask host how big it wants to be\n                    this.performMeasure(childWidthMeasureSpec, childHeightMeasureSpec);\n\n                    layoutRequested = true;\n                }\n            }else{\n                //const windowMoved = (attachInfo.mWindowLeft != frame.left\n                //|| attachInfo.mWindowTop != frame.top);\n                //if (windowMoved) {\n                //    attachInfo.mWindowLeft = frame.left;\n                //    attachInfo.mWindowTop = frame.top;\n                //}\n            }\n\n            const didLayout = layoutRequested;\n            let triggerGlobalLayoutListener = didLayout;\n            if (didLayout) {\n                this.performLayout(lp, desiredWindowWidth, desiredWindowHeight);\n\n                // By this point all views have been sized and positioned\n                // We can compute the transparent area(no need)\n\n                if (ViewRootImpl.DBG) {\n                    System.out.println(\"======================================\");\n                    System.out.println(\"performTraversals -- after setFrame\");\n                    host.debug();\n                }\n            }\n\n            if (triggerGlobalLayoutListener) {\n                //attachInfo.mRecomputeGlobalAttributes = false;\n                this.mTreeObserver.dispatchOnGlobalLayout();\n            }\n\n            let skipDraw = false;\n\n            if (this.mFirst) {\n                // handle first focus request\n                if (ViewRootImpl.DEBUG_INPUT_RESIZE) Log.v(ViewRootImpl.TAG, \"First: mView.hasFocus()=\"\n                    + this.mView.hasFocus());\n                if (this.mView != null) {\n                    if (!this.mView.hasFocus()) {\n                        this.mView.requestFocus(View.FOCUS_FORWARD);\n                        if (ViewRootImpl.DEBUG_INPUT_RESIZE) Log.v(ViewRootImpl.TAG, \"First: requested focused view=\"\n                            + this.mView.findFocus());\n                    } else {\n                        if (ViewRootImpl.DEBUG_INPUT_RESIZE) Log.v(ViewRootImpl.TAG, \"First: existing focused view=\"\n                            + this.mView.findFocus());\n                    }\n                }\n//            if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_ANIMATING) != 0) {\n//                // The first time we relayout the window, if the system is\n//                // doing window animations, we want to hold of on any future\n//                // draws until the animation is done.\n//                mWindowsAnimating = true;\n//            }\n            }\n            //else if (mWindowsAnimating) {\n            //    skipDraw = true;\n            //}\n\n            this.mFirst = false;\n            this.mWillDrawSoon = false;\n            this.mViewVisibility = viewVisibility;\n\n            let cancelDraw = this.mTreeObserver.dispatchOnPreDraw() ||\n                viewVisibility != View.VISIBLE;\n\n            if (!cancelDraw) {\n                if (!skipDraw) {\n                    this.performDraw();\n                }\n            } else {\n                if (viewVisibility == View.VISIBLE) {\n                    // Try again\n                    this.scheduleTraversals();\n                }\n            }\n\n            this.mIsInTraversal = false;\n\n            this.checkContinueTraversalsNextFrame();\n        }\n\n        private performLayout(lp:ViewGroup.LayoutParams, desiredWindowWidth:number, desiredWindowHeight:number) {\n            this.mLayoutRequested = false;\n            this.mInLayout = true;\n\n            let host = this.mView;\n            if (ViewRootImpl.DEBUG_ORIENTATION || ViewRootImpl.DEBUG_LAYOUT) {\n                Log.v(ViewRootImpl.TAG, \"Laying out \" + host + \" to (\" +\n                    host.getMeasuredWidth() + \", \" + host.getMeasuredHeight() + \")\");\n            }\n\n            host.layout(0, 0, host.getMeasuredWidth(), host.getMeasuredHeight());\n\n            this.mInLayout = false;\n            let numViewsRequestingLayout = this.mLayoutRequesters.length;\n            if (numViewsRequestingLayout > 0) {\n                // requestLayout() was called during layout.\n                // If no layout-request flags are set on the requesting views, there is no problem.\n                // If some requests are still pending, then we need to clear those flags and do\n                // a full request/measure/layout pass to handle this situation.\n                let validLayoutRequesters = this.getValidLayoutRequesters(this.mLayoutRequesters, false);\n                if (validLayoutRequesters != null) {\n                    // Set this flag to indicate that any further requests are happening during\n                    // the second pass, which may result in posting those requests to the next\n                    // frame instead\n                    this.mHandlingLayoutInLayoutRequest = true;\n\n                    // Process fresh layout requests, then measure and layout\n                    let numValidRequests = validLayoutRequesters.length;\n                    for (let i = 0; i < numValidRequests; ++i) {\n                        let view = validLayoutRequesters[i];\n                        Log.w(\"View\", \"requestLayout() improperly called by \" + view +\n                            \" during layout: running second layout pass\");\n                        view.requestLayout();\n                    }\n                    this.measureHierarchy(host, lp, desiredWindowWidth, desiredWindowHeight);\n                    this.mInLayout = true;\n                    host.layout(0, 0, host.getMeasuredWidth(), host.getMeasuredHeight());\n\n                    this.mHandlingLayoutInLayoutRequest = false;\n\n                    // Check the valid requests again, this time without checking/clearing the\n                    // layout flags, since requests happening during the second pass get noop'd\n                    validLayoutRequesters = this.getValidLayoutRequesters(this.mLayoutRequesters, true);\n                    if (validLayoutRequesters != null) {\n                        let finalRequesters = validLayoutRequesters;\n                        // Post second-pass requests to the next frame\n                        ViewRootImpl.getRunQueue(this).post({\n                            run() {\n                                let numValidRequests = finalRequesters.length;\n                                for (let i = 0; i < numValidRequests; ++i) {\n                                    const view = finalRequesters[i];\n                                    Log.w(\"View\", \"requestLayout() improperly called by \" + view +\n                                        \" during second layout pass: posting in next frame\");\n                                    view.requestLayout();\n                                }\n                            }\n                        });\n                    }\n                }\n\n            }\n            this.mInLayout = false;\n        }\n\n        private getValidLayoutRequesters(layoutRequesters:Array<View>, secondLayoutRequests:boolean) {\n            let numViewsRequestingLayout = layoutRequesters.length;\n            let validLayoutRequesters:Array<View> = null;\n            for (let i = 0; i < numViewsRequestingLayout; ++i) {\n                let view = layoutRequesters[i];\n                if (view != null && view.mAttachInfo != null && view.mParent != null &&\n                    (secondLayoutRequests || (view.mPrivateFlags & View.PFLAG_FORCE_LAYOUT) ==\n                    View.PFLAG_FORCE_LAYOUT)) {\n                    let gone = false;\n                    let parent:View = view;\n                    // Only trigger new requests for views in a non-GONE hierarchy\n                    while (parent != null) {\n                        if ((parent.mViewFlags & View.VISIBILITY_MASK) == View.GONE) {\n                            gone = true;\n                            break;\n                        }\n                        if (parent.mParent instanceof View) {\n                            parent = <View><any>parent.mParent;\n                        } else {\n                            parent = null;\n                        }\n                    }\n                    if (!gone) {\n                        if (validLayoutRequesters == null) {\n                            validLayoutRequesters = [];\n                        }\n                        validLayoutRequesters.push(view);\n                    }\n                }\n            }\n            if (!secondLayoutRequests) {\n                // If we're checking the layout flags, then we need to clean them up also\n                for (let i = 0; i < numViewsRequestingLayout; ++i) {\n                    let view = layoutRequesters[i];\n                    while (view != null &&\n                    (view.mPrivateFlags & View.PFLAG_FORCE_LAYOUT) != 0) {\n                        view.mPrivateFlags &= ~View.PFLAG_FORCE_LAYOUT;\n                        if (view.mParent instanceof View) {\n                            view = <View><any>view.mParent;\n                        } else {\n                            view = null;\n                        }\n                    }\n                }\n            }\n            layoutRequesters.splice(0, layoutRequesters.length);\n            return validLayoutRequesters;\n        }\n\n        private performMeasure(childWidthMeasureSpec:number, childHeightMeasureSpec:number) {\n            this.mView.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n        }\n\n        isInLayout() {\n            return this.mInLayout;\n        }\n\n        requestLayoutDuringLayout(view:View) {\n            if (view.mParent == null || view.mAttachInfo == null) {\n                // Would not normally trigger another layout, so just let it pass through as usual\n                return true;\n            }\n            if (this.mLayoutRequesters.indexOf(view) === -1) {\n                this.mLayoutRequesters.push(view);\n            }\n            if (!this.mHandlingLayoutInLayoutRequest) {\n                // Let the request proceed normally; it will be processed in a second layout pass\n                // if necessary\n                return true;\n            } else {\n                // Don't let the request proceed during the second layout pass.\n                // It will post to the next frame instead.\n                return false;\n            }\n        }\n\n        trackFPS() {\n            // Tracks frames per second drawn. First value in a series of draws may be bogus\n            // because it down not account for the intervening idle time\n            let nowTime = System.currentTimeMillis();\n            if (this.mFpsStartTime < 0) {\n                this.mFpsStartTime = this.mFpsPrevTime = nowTime;\n                this.mFpsNumFrames = 0;\n            } else {\n                this.mFpsNumFrames++;\n                //let thisHash = Integer.toHexString(System.identityHashCode(this));\n                let frameTime = nowTime - this.mFpsPrevTime;\n                let totalTime = nowTime - this.mFpsStartTime;\n                //Log.v(ViewRootImpl.TAG, \"Frame time:\\t\" + frameTime);\n                this.mFpsPrevTime = nowTime;\n                if (totalTime > 1000) {\n                    let fps = this.mFpsNumFrames * 1000 / totalTime;\n                    Log.v(ViewRootImpl.TAG, \"FPS:\\t\" + fps);\n                    this.mSurface.showFps(fps);\n\n                    this.mFpsStartTime = nowTime;\n                    this.mFpsNumFrames = 0;\n                }\n            }\n        }\n\n        private performDraw() {\n            let fullRedrawNeeded = this.mFullRedrawNeeded;\n            this.mFullRedrawNeeded = false;\n            this.mIsDrawing = true;\n            try {\n                this.draw(fullRedrawNeeded);\n            } finally {\n                this.mIsDrawing = false;\n            }\n        }\n\n        private draw(fullRedrawNeeded:boolean) {\n            let surface = this.mSurface;\n            if (!surface.isValid()) {\n                return;\n            }\n\n            if (ViewRootImpl.DEBUG_FPS) {\n                this.trackFPS();\n            }\n\n\n            if (this.mViewScrollChanged) {\n                this.mViewScrollChanged = false;\n                this.mTreeObserver.dispatchOnScrollChanged();\n            }\n\n            if (fullRedrawNeeded) {\n                this.mIgnoreDirtyState = true;\n                this.mDirty.set(0, 0, this.mWidth, this.mHeight);\n            }\n\n            if (ViewRootImpl.DEBUG_ORIENTATION || ViewRootImpl.DEBUG_DRAW) {\n                Log.v(ViewRootImpl.TAG, \"Draw \" + this.mView + \", width=\" + this.mWidth + \", height=\" + this.mHeight + \", dirty=\"+this.mDirty);\n            }\n\n            this.mTreeObserver.dispatchOnDraw();\n\n            this.drawSoftware();\n\n        }\n\n        private drawSoftware(){\n            let canvas;\n            try {\n                canvas = this.mSurface.lockCanvas(this.mDirty);\n                if(!canvas) return;//not ready\n            } catch (e) {\n                //native surface not ready. wait ready callback\n                return;\n            }\n            this.mDirty.setEmpty();\n            this.mIsAnimating = false;\n            //let attachInfo = this.mAttachInfo;\n\n            this.mDrawingTime = SystemClock.uptimeMillis();\n            this.mView.mPrivateFlags |= View.PFLAG_DRAWN;\n\n            this.mSetIgnoreDirtyState = false;\n\n            if(!this.mSurface['lastRenderCanvas']) this.mView.draw(canvas);\n\n\n            if (!this.mSetIgnoreDirtyState) {\n                // Only clear the flag if it was not set during the mView.draw() call\n                this.mIgnoreDirtyState = false;\n            }\n\n            this.mSurface.unlockCanvasAndPost(this.mSurface['lastRenderCanvas'] || canvas);\n\n            if (ViewRootImpl.LOCAL_LOGV) {\n                Log.v(ViewRootImpl.TAG, \"Surface unlockCanvasAndPost\");\n            }\n        }\n\n        private _continueTraversalesCount = 0;\n        private checkContinueTraversalsNextFrame(){\n            //AndroidUI add:\n            //Because of some reason, sometime will skip a frame to traversals when scroll.\n            //Let's continuing traversales next frame.\n\n            const continueFrame = ViewRootImpl.DEBUG_FPS ? 60 : 5;\n            if (!this.mTraversalScheduled && this._continueTraversalesCount < continueFrame) {\n                this._continueTraversalesCount++;\n                this.scheduleTraversals();\n            }else{\n                this._continueTraversalesCount = 0;\n            }\n        }\n\n        isLayoutRequested():boolean {\n            return this.mLayoutRequested;\n        }\n\n\n        private mInvalidateOnAnimationRunnable = new InvalidateOnAnimationRunnable(this.mHandler);\n\n        dispatchInvalidateDelayed(view:View, delayMilliseconds:number):void {\n            let msg = this.mHandler.obtainMessage(ViewRootHandler.MSG_INVALIDATE, view);\n            this.mHandler.sendMessageDelayed(msg, delayMilliseconds);\n        }\n\n        dispatchInvalidateRectDelayed(info:View.AttachInfo.InvalidateInfo, delayMilliseconds:number):void {\n            let msg = this.mHandler.obtainMessage(ViewRootHandler.MSG_INVALIDATE_RECT, info);\n            this.mHandler.sendMessageDelayed(msg, delayMilliseconds);\n        }\n\n        dispatchInvalidateOnAnimation(view:View):void {\n            this.mInvalidateOnAnimationRunnable.addView(view);\n        }\n        dispatchInvalidateRectOnAnimation(info:View.AttachInfo.InvalidateInfo):void{\n            this.mInvalidateOnAnimationRunnable.addViewRect(info);\n        }\n        cancelInvalidate(view:View){\n            this.mHandler.removeMessages(ViewRootHandler.MSG_INVALIDATE, view);\n            // fixme: might leak the AttachInfo.InvalidateInfo objects instead of returning\n            // them to the pool\n            this.mHandler.removeMessages(ViewRootHandler.MSG_INVALIDATE_RECT, view);\n            this.mInvalidateOnAnimationRunnable.removeView(view);\n        }\n\n        getParent():ViewParent {\n            return null;\n        }\n\n        requestLayout() {\n            if (!this.mHandlingLayoutInLayoutRequest) {\n                this.mLayoutRequested = true;\n                this.scheduleTraversals();\n            }\n        }\n\n        invalidate() {\n            this.mDirty.set(0, 0, this.mWidth, this.mHeight);\n            this.scheduleTraversals();\n        }\n        invalidateWorld(view:View) {\n            view.invalidate();\n            if (view instanceof ViewGroup) {\n                let parent = <ViewGroup>view;\n                for (let i = 0; i < parent.getChildCount(); i++) {\n                    this.invalidateWorld(parent.getChildAt(i));\n                }\n            }\n        }\n\n        invalidateChild(child:View, dirty:Rect) {\n            this.invalidateChildInParent(null, dirty);\n        }\n\n        invalidateChildInParent(location:Array<number>, dirty:Rect):ViewParent {\n            if (ViewRootImpl.DEBUG_DRAW) Log.v(ViewRootImpl.TAG, \"Invalidate child: \" + dirty);\n\n            if (dirty == null) {\n                this.invalidate();\n                return null;\n            } else if (dirty.isEmpty() && !this.mIsAnimating) {\n                return null;\n            }\n\n            //if (mCurScrollY != 0) {//no need\n            //    mTempRect.set(dirty);\n            //    dirty = mTempRect;\n            //    if (mCurScrollY != 0) {\n            //        dirty.offset(0, -mCurScrollY);\n            //    }\n            //}\n\n            const localDirty = this.mDirty;\n            if (!localDirty.isEmpty() && !localDirty.contains(dirty)) {\n                this.mSetIgnoreDirtyState = true;\n                this.mIgnoreDirtyState = true;\n            }\n\n            // Add the new dirty rect to the current one\n            localDirty.union(dirty.left, dirty.top, dirty.right, dirty.bottom);\n            // Intersect with the bounds of the window to skip\n            // updates that lie outside of the visible region\n            const intersected = localDirty.intersect(0, 0, this.mWidth, this.mHeight);\n            if (!intersected) {\n                localDirty.setEmpty();\n            }\n            if (!this.mWillDrawSoon && (intersected || this.mIsAnimating)) {\n                this.scheduleTraversals();\n            }\n\n            return null;\n        }\n\n        requestChildFocus(child:View, focused:View) {\n            if (ViewRootImpl.DEBUG_INPUT_RESIZE) {\n                Log.v(ViewRootImpl.TAG, \"Request child focus: focus now \" + focused);\n            }\n            //checkThread();\n            this.scheduleTraversals();\n        }\n\n        clearChildFocus(focused:View) {\n            if (ViewRootImpl.DEBUG_INPUT_RESIZE) {\n                Log.v(ViewRootImpl.TAG, \"Request child focus: focus now \" + focused);\n            }\n            //checkThread();\n            this.scheduleTraversals();\n        }\n\n        getChildVisibleRect(child:View, r:Rect, offset:Point):boolean {\n            if (child != this.mView) {\n                throw new Error(\"child is not mine, honest!\");\n            }\n            // Note: don't apply scroll offset, because we want to know its\n            // visibility in the virtual canvas being given to the view hierarchy.\n            return r.intersect(0, 0, this.mWidth, this.mHeight);\n        }\n\n        focusSearch(focused:View, direction:number):View {\n            if (!(this.mView instanceof ViewGroup)) {\n                return null;\n            }\n            if(this.mView instanceof WindowManager.Layout){\n                let topWindow = (<WindowManager.Layout>this.mView).getTopFocusableWindowView();\n                if(topWindow) return FocusFinder.getInstance().findNextFocus(topWindow, focused, direction);\n            }\n            return FocusFinder.getInstance().findNextFocus(<ViewGroup>this.mView, focused, direction);\n        }\n\n        bringChildToFront(child:View) {\n            //nothing\n        }\n\n        focusableViewAvailable(v:View) {\n            if (this.mView != null) {\n                if (!this.mView.hasFocus()) {\n                    v.requestFocus();\n                } else {\n                    // the one case where will transfer focus away from the current one\n                    // is if the current view is a view group that prefers to give focus\n                    // to its children first AND the view is a descendant of it.\n                    let focused = this.mView.findFocus();\n                    if (focused instanceof ViewGroup) {\n                        let group = <ViewGroup>focused;\n                        if (group.getDescendantFocusability() == ViewGroup.FOCUS_AFTER_DESCENDANTS\n                            && ViewRootImpl.isViewDescendantOf(v, focused)) {\n                            v.requestFocus();\n                        }\n                    }\n                }\n            }\n        }\n        static isViewDescendantOf(child:View, parent:View) {\n            if (child == parent) {\n                return true;\n            }\n\n            const theParent = child.getParent();\n            return (theParent instanceof ViewGroup) && ViewRootImpl.isViewDescendantOf(<View>theParent, parent);\n        }\n\n        childDrawableStateChanged(child:View) {\n            //nothing\n        }\n\n        requestDisallowInterceptTouchEvent(disallowIntercept:boolean) {\n            // ViewAncestor never intercepts touch event, so this can be a no-op\n        }\n\n        requestChildRectangleOnScreen(child:View, rectangle:Rect, immediate:boolean):boolean{\n            //TODO should scroll window\n            //final boolean scrolled = scrollToRectOrFocus(rectangle, immediate);\n            //if (rectangle != null) {\n            //    mTempRect.set(rectangle);\n            //    mTempRect.offset(0, -mCurScrollY);\n            //    mTempRect.offset(mAttachInfo.mWindowLeft, mAttachInfo.mWindowTop);\n            //}\n            //return scrolled;\n            return false;\n        }\n\n        childHasTransientStateChanged(child:View, hasTransientState:boolean) {\n            // Do nothing.\n        }\n\n        dispatchInputEvent(event:MotionEvent|KeyEvent|Event):boolean {\n            this.deliverInputEvent(event);\n            let result = event[InputStage.FLAG_FINISHED_HANDLED];\n            event[InputStage.FLAG_FINISHED] = false;\n            event[InputStage.FLAG_FINISHED_HANDLED] = false;\n\n            let continueToDom = event[ViewRootImpl.ContinueEventToDom];\n            event[ViewRootImpl.ContinueEventToDom] = null;\n            return result && !continueToDom;\n            //let view = this.mView;\n            //let isTouchEvent = event instanceof MotionEvent && event.isTouchEvent();\n            //let disallowIntercept = view instanceof ViewGroup ? (view.mGroupFlags & ViewGroup.FLAG_DISALLOW_INTERCEPT) != 0 : false;\n            //return result && (!isTouchEvent || disallowIntercept);\n        }\n        private deliverInputEvent(event) {\n            this.mFirstInputStage.deliver(event);\n        }\n        private finishInputEvent(event){\n            //event[InputStage.FLAG_FINISHED] = false;\n            //event[InputStage.FLAG_FINISHED_HANDLED] = false;\n        }\n\n        private checkForLeavingTouchModeAndConsume(event:KeyEvent) {\n            // Only relevant in touch mode.\n            if (!this.mInTouchMode) {\n                return false;\n            }\n\n            // Only consider leaving touch mode on DOWN or MULTIPLE actions, never on UP.\n            const action = event.getAction();\n            if (action != KeyEvent.ACTION_DOWN\n                //&& action != KeyEvent.ACTION_MULTIPLE\n            ) {\n                return false;\n            }\n\n            // Don't leave touch mode if the IME told us not to.\n            //if ((event.getFlags() & KeyEvent.FLAG_KEEP_TOUCH_MODE) != 0) {\n            //    return false;\n            //}\n\n            // If the key can be used for keyboard navigation then leave touch mode\n            // and select a focused view if needed (in ensureTouchMode).\n            // When a new focused view is selected, we consume the navigation key because\n            // navigation doesn't make much sense unless a view already has focus so\n            // the key's purpose is to set focus.\n            if (ViewRootImpl.isNavigationKey(event)) {\n                return this.ensureTouchMode(false);\n            }\n\n            // If the key can be used for typing then leave touch mode\n            // and select a focused view if needed (in ensureTouchMode).\n            // Always allow the view to process the typing key.\n            if (ViewRootImpl.isTypingKey(event)) {\n                this.ensureTouchMode(false);\n                return false;\n            }\n\n            return false;\n        }\n        private static isNavigationKey(keyEvent:KeyEvent):boolean {\n            switch (keyEvent.getKeyCode()) {\n                case KeyEvent.KEYCODE_DPAD_LEFT:\n                case KeyEvent.KEYCODE_DPAD_RIGHT:\n                case KeyEvent.KEYCODE_DPAD_UP:\n                case KeyEvent.KEYCODE_DPAD_DOWN:\n                case KeyEvent.KEYCODE_DPAD_CENTER:\n                case KeyEvent.KEYCODE_PAGE_UP:\n                case KeyEvent.KEYCODE_PAGE_DOWN:\n                case KeyEvent.KEYCODE_MOVE_HOME:\n                case KeyEvent.KEYCODE_MOVE_END:\n                case KeyEvent.KEYCODE_TAB:\n                case KeyEvent.KEYCODE_SPACE:\n                case KeyEvent.KEYCODE_ENTER:\n                    return true;\n            }\n            return false;\n        }\n        private static isTypingKey(keyEvent:KeyEvent):boolean {\n            try {\n                return keyEvent.mIsTypingKey;\n            } catch (e) {\n                console.warn(e);\n            }\n            return true;\n        }\n        ensureTouchMode(inTouchMode:boolean):boolean {\n            if (ViewRootImpl.DBG) Log.d(\"touchmode\", \"ensureTouchMode(\" + inTouchMode + \"), current \"\n                + \"touch mode is \" + this.mInTouchMode);\n            if (this.mInTouchMode == inTouchMode) return false;\n\n            // tell the window manager\n            //try {\n            //    if (!this.isInLocalFocusMode()) {\n            //        mWindowSession.setInTouchMode(inTouchMode);\n            //    }\n            //} catch (RemoteException e) {\n            //    throw new RuntimeException(e);\n            //}\n\n            // handle the change\n            return this.ensureTouchModeLocally(inTouchMode);\n        }\n\n        ensureTouchModeLocally(inTouchMode:boolean):boolean {\n            if (ViewRootImpl.DBG) Log.d(\"touchmode\", \"ensureTouchModeLocally(\" + inTouchMode + \"), current \"\n                + \"touch mode is \" + this.mInTouchMode);\n\n            if (this.mInTouchMode == inTouchMode) return false;\n\n            this.mInTouchMode = inTouchMode;\n            this.mTreeObserver.dispatchOnTouchModeChanged(inTouchMode);\n\n            return (inTouchMode) ? this.enterTouchMode() : this.leaveTouchMode();\n        }\n        private enterTouchMode():boolean {\n            if (this.mView != null && this.mView.hasFocus()) {\n                // note: not relying on mFocusedView here because this could\n                // be when the window is first being added, and mFocused isn't\n                // set yet.\n                const focused = this.mView.findFocus();\n                if (focused != null && !focused.isFocusableInTouchMode()) {\n                    const ancestorToTakeFocus = ViewRootImpl.findAncestorToTakeFocusInTouchMode(focused);\n                    if (ancestorToTakeFocus != null) {\n                        // there is an ancestor that wants focus after its\n                        // descendants that is focusable in touch mode.. give it\n                        // focus\n                        return ancestorToTakeFocus.requestFocus();\n                    } else {\n                        // There's nothing to focus. Clear and propagate through the\n                        // hierarchy, but don't attempt to place new focus.\n                        focused.clearFocusInternal(true, false);\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        private static findAncestorToTakeFocusInTouchMode(focused:View):ViewGroup {\n            let parent = focused.getParent();\n            while (parent instanceof ViewGroup) {\n                const vgParent = <ViewGroup>parent;\n                if (vgParent.getDescendantFocusability() == ViewGroup.FOCUS_AFTER_DESCENDANTS\n                    && vgParent.isFocusableInTouchMode()) {\n                    return vgParent;\n                }\n                if (vgParent.isRootNamespace()) {\n                    return null;\n                } else {\n                    parent = vgParent.getParent();\n                }\n            }\n            return null;\n        }\n        private leaveTouchMode():boolean {\n            if (this.mView != null) {\n                if (this.mView.hasFocus()) {\n                    let focusedView = this.mView.findFocus();\n                    if (!(focusedView instanceof ViewGroup)) {\n                        // some view has focus, let it keep it\n                        return false;\n                    } else if ((<ViewGroup>focusedView).getDescendantFocusability() !=\n                    ViewGroup.FOCUS_AFTER_DESCENDANTS) {\n                        // some view group has focus, and doesn't prefer its children\n                        // over itself for focus, so let them keep it.\n                        return false;\n                    }\n                }\n\n                // find the best view to give focus to in this brave new non-touch-mode\n                // world\n                const focused = this.focusSearch(null, View.FOCUS_DOWN);\n                if (focused != null) {\n                    return focused.requestFocus(View.FOCUS_DOWN);\n                }\n            }\n            return false;\n        }\n\n\n        private static RunQueueInstance:ViewRootImpl.RunQueue;\n        private mRunQueue:ViewRootImpl.RunQueue;\n\n        static getRunQueue(viewRoot?:ViewRootImpl):ViewRootImpl.RunQueue {\n            if (viewRoot) {\n                if (!viewRoot.mRunQueue) viewRoot.mRunQueue = new ViewRootImpl.RunQueue();\n                return viewRoot.mRunQueue;\n\n            } else {\n                if (!this.RunQueueInstance) {\n                    this.RunQueueInstance = new RunQueueForNoViewRoot();\n                }\n                return this.RunQueueInstance;\n            }\n        }\n\n    }\n\n    export module ViewRootImpl {\n        interface HandlerAction {\n            action:Runnable;\n            delay:number;\n        }\n        export class RunQueue {\n            private mActions:Array<HandlerAction> = [];\n\n            post(action:Runnable) {\n                this.postDelayed(action, 0);\n            }\n\n            postDelayed(action:Runnable, delayMillis:number) {\n                let handlerAction:HandlerAction = {\n                    action: action,\n                    delay: delayMillis\n                };\n                this.mActions.push(handlerAction);\n\n            }\n\n            removeCallbacks(action:Runnable) {\n                this.mActions = this.mActions.filter((item)=> {\n                    return item.action == action;\n                });\n            }\n\n            executeActions(handler:Handler) {\n                for (let handlerAction of this.mActions) {\n                    handler.postDelayed(handlerAction.action, handlerAction.delay);\n                }\n                this.mActions = [];\n            }\n\n        }\n    }\n\n    class RunQueueForNoViewRoot extends ViewRootImpl.RunQueue {\n        private static Handler = new Handler();\n\n        postDelayed(action:Runnable, delayMillis:number) {\n            RunQueueForNoViewRoot.Handler.postDelayed(action, delayMillis);\n        }\n\n        removeCallbacks(action:Runnable) {\n            RunQueueForNoViewRoot.Handler.removeCallbacks(action);\n        }\n    }\n\n    class TraversalRunnable implements Runnable {\n        ViewRootImpl_this:ViewRootImpl;\n\n        constructor(impl:ViewRootImpl) {\n            this.ViewRootImpl_this = impl;\n        }\n\n        run() {\n            this.ViewRootImpl_this.doTraversal();\n        }\n    }\n\n    class InvalidateOnAnimationRunnable implements Runnable {\n        mHandler:Handler;\n        mPosted = false;\n        mViews = new Set<View>();\n        mViewRects = new Map<View, View.AttachInfo.InvalidateInfo>();\n\n        constructor(handler:Handler) {\n            this.mHandler = handler;\n        }\n\n        addView(view:View){\n            this.mViews.add(view);\n            this.postIfNeededLocked();\n        }\n        addViewRect(info:View.AttachInfo.InvalidateInfo){\n            this.mViewRects.set(info.target, info);\n            this.postIfNeededLocked();\n        }\n        removeView(view:View){\n            this.mViews.delete(view);\n            this.mViewRects.delete(view);\n\n            if (this.mPosted && this.mViews.size===0 && this.mViewRects.size===0) {\n                this.mHandler.removeCallbacks(this);\n                this.mPosted = false;\n            }\n        }\n        run() {\n            this.mPosted = false;\n\n            for(let view of this.mViews){\n                view.invalidate();\n            }\n            this.mViews.clear();\n\n            for(let info of this.mViewRects.values()){\n                info.target.invalidate(info.left, info.top, info.right, info.bottom);\n                info.recycle();\n            }\n            this.mViewRects.clear();\n        }\n\n        postIfNeededLocked() {\n            if (!this.mPosted) {\n                this.mHandler.post(this);\n                this.mPosted = true;\n            }\n        }\n    }\n\n    class ViewRootHandler extends Handler{\n        static MSG_INVALIDATE = 1;\n        static MSG_INVALIDATE_RECT = 2;\n\n\n        handleMessage(msg:Message):void {\n            switch (msg.what) {\n                case ViewRootHandler.MSG_INVALIDATE:\n                    (<View>msg.obj).invalidate();\n                    break;\n                case ViewRootHandler.MSG_INVALIDATE_RECT:\n                    const info = <View.AttachInfo.InvalidateInfo> msg.obj;\n                    info.target.invalidate(info.left, info.top, info.right, info.bottom);\n                    info.recycle();\n                    break;\n            }\n        }\n    }\n\n\n    class InputStage {\n        static FLAG_FINISHED = Symbol();\n        static FLAG_FINISHED_HANDLED = Symbol();\n        static FORWARD = 0;\n        static FINISH_HANDLED = 1;\n        static FINISH_NOT_HANDLED = 2;\n\n        mNext:InputStage;\n\n        ViewRootImpl_this:ViewRootImpl;\n        constructor(impl:ViewRootImpl, next?:InputStage){\n            this.ViewRootImpl_this = impl;\n            this.mNext = next;\n        }\n        deliver(event) {\n            if (event[InputStage.FLAG_FINISHED]) {\n                this.forward(event);\n            } else if (this.shouldDropInputEvent(event)) {\n                this.finish(event, false);\n            } else {\n                this.apply(event, this.onProcess(event));\n            }\n        }\n        finish(event, handled:boolean) {\n            event[InputStage.FLAG_FINISHED] = true;\n            if(handled){\n                event[InputStage.FLAG_FINISHED_HANDLED] = true;\n            }\n            this.forward(event);\n        }\n        forward(event) {\n            this.onDeliverToNext(event);\n        }\n        apply(event, result:number) {\n            if (result == InputStage.FORWARD) {\n                this.forward(event);\n            } else if (result == InputStage.FINISH_HANDLED) {\n                this.finish(event, true);\n            } else if (result == InputStage.FINISH_NOT_HANDLED) {\n                this.finish(event, false);\n            } else {\n                throw new Error(\"Invalid result: \" + result);\n            }\n        }\n        onDeliverToNext(event) {\n            if (this.mNext != null) {\n                this.mNext.deliver(event);\n            } else {\n                (<any>this.ViewRootImpl_this).finishInputEvent(event);\n            }\n        }\n\n        onProcess(event):number{\n            return InputStage.FORWARD;\n        }\n\n        shouldDropInputEvent(event){\n            if ((<any>this.ViewRootImpl_this).mView == null || !(<any>this.ViewRootImpl_this).mAdded) {\n                Log.w(ViewRootImpl.TAG, \"Dropping event due to root view being removed: \" + event);\n                return true;\n            }\n            //else if ((!this.ViewRootImpl_this.mAttachInfo.mHasWindowFocus ||\n            //    (<any>this.ViewRootImpl_this).mStopped)) {\n            //\n            //    // Drop non-terminal input events.\n            //    Log.w(ViewRootImpl.TAG, \"Dropping event due to no window focus: \" + event);\n            //    return true;\n            //}\n            return false;\n        }\n    }\n\n    /**\n     * handle touch event\n     */\n    class EarlyPostImeInputStage extends InputStage{\n        onProcess(event):number {\n            if (event instanceof MotionEvent) {\n                return this.processMotionEvent(event);\n            } else if (event instanceof KeyEvent) {\n                return this.processKeyEvent(event);\n            }\n            return InputStage.FORWARD;\n        }\n\n        private processKeyEvent(event:KeyEvent):number {\n            // If the key's purpose is to exit touch mode then we consume it\n            // and consider it handled.\n            if ((<any>this.ViewRootImpl_this).checkForLeavingTouchModeAndConsume(event)) {\n                return InputStage.FINISH_HANDLED;\n            }\n\n            // Make sure the fallback event policy sees all keys that will be\n            // delivered to the view hierarchy.\n            //mFallbackEventHandler.preDispatchKeyEvent(event);\n            return InputStage.FORWARD;\n        }\n\n        private processMotionEvent(event:MotionEvent):number {\n            // Enter touch mode on down or scroll.\n            const action = event.getAction();\n            if (action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_SCROLL) {\n                this.ViewRootImpl_this.ensureTouchMode(true);\n            }\n\n            // Offset the window bound\n            event.offsetLocation(-this.ViewRootImpl_this.mWinFrame.left, -this.ViewRootImpl_this.mWinFrame.top);\n\n\n            // Offset the scroll position.\n            //if (mCurScrollY != 0) {\n            //    event.offsetLocation(0, mCurScrollY);\n            //}\n\n            // Remember the touch position for possible drag-initiation.\n            //if (event.isTouchEvent()) {\n            //    mLastTouchPoint.x = event.getRawX();\n            //    mLastTouchPoint.y = event.getRawY();\n            //}\n            return InputStage.FORWARD;\n        }\n    }\n    /**\n     * handle key event\n     */\n    class ViewPostImeInputStage extends InputStage{\n        onProcess(event):number {\n            if (event instanceof KeyEvent) {\n                return this.processKeyEvent(event);\n\n            }else if (event instanceof MotionEvent){\n                if(event.isTouchEvent()){\n                    return this.processTouchEvent(event);\n                }else{\n                    return this.processGenericMotionEvent(event);\n                }\n            }\n            return InputStage.FORWARD;\n        }\n\n        private processKeyEvent(event:KeyEvent):number {\n            let mView:View = this.ViewRootImpl_this.mView;\n            //if (event.getAction() != KeyEvent.ACTION_UP) {\n            //    // If delivering a new key event, make sure the window is\n            //    // now allowed to start updating.\n            //    this.handleDispatchDoneAnimating();\n            //}\n\n            // Deliver the key to the view hierarchy.\n            if ((<any>this.ViewRootImpl_this).mView.dispatchKeyEvent(event)) {\n                return InputStage.FINISH_HANDLED;\n            }\n\n            if (this.shouldDropInputEvent(event)) {\n                return InputStage.FINISH_NOT_HANDLED;\n            }\n\n            // If the Control modifier is held, try to interpret the key as a shortcut.\n            if (event.getAction() == KeyEvent.ACTION_DOWN\n                && event.isCtrlPressed()\n                && event.getRepeatCount() == 0\n                //&& !KeyEvent.isModifierKey(event.getKeyCode())\n            ) {\n                //if (mView.dispatchKeyShortcutEvent(event)) {\n                //    return InputStage.FINISH_HANDLED;\n                //}\n                if (this.shouldDropInputEvent(event)) {\n                    return InputStage.FINISH_NOT_HANDLED;\n                }\n            }\n\n            // Apply the fallback event policy.\n            //if (mFallbackEventHandler.dispatchKeyEvent(event)) {\n            //    return FINISH_HANDLED;\n            //}\n            if (this.shouldDropInputEvent(event)) {\n                return InputStage.FINISH_NOT_HANDLED;\n            }\n\n            // Handle automatic focus changes.\n            if (event.getAction() == KeyEvent.ACTION_DOWN) {\n                let direction = 0;\n                switch (event.getKeyCode()) {\n                    case KeyEvent.KEYCODE_DPAD_LEFT:\n                        direction = View.FOCUS_LEFT;\n                        break;\n                    case KeyEvent.KEYCODE_DPAD_RIGHT:\n                        direction = View.FOCUS_RIGHT;\n                        break;\n                    case KeyEvent.KEYCODE_DPAD_UP:\n                        direction = View.FOCUS_UP;\n                        break;\n                    case KeyEvent.KEYCODE_DPAD_DOWN:\n                        direction = View.FOCUS_DOWN;\n                        break;\n                    case KeyEvent.KEYCODE_TAB:\n                        if (event.isShiftPressed()) {\n                            direction = View.FOCUS_BACKWARD;\n                        } else {\n                            direction = View.FOCUS_FORWARD;\n                        }\n                        break;\n                }\n                if (direction != 0) {\n                    let focused = mView.findFocus();\n                    if (focused != null) {\n                        let v = focused.focusSearch(direction);\n                        if (v != null && v != focused) {\n                            // do the math the get the interesting rect\n                            // of previous focused into the coord system of\n                            // newly focused view\n                            focused.getFocusedRect((<any>this.ViewRootImpl_this).mTempRect);\n                            if (mView instanceof ViewGroup) {\n                                (<ViewGroup>mView).offsetDescendantRectToMyCoords(focused,\n                                    (<any>this.ViewRootImpl_this).mTempRect);\n                                (<ViewGroup>mView).offsetRectIntoDescendantCoords(v,\n                                    (<any>this.ViewRootImpl_this).mTempRect);\n                            }\n                            if (v.requestFocus(direction, (<any>this.ViewRootImpl_this).mTempRect)) {\n                                //playSoundEffect(SoundEffectConstants\n                                //    .getContantForFocusDirection(direction));\n                                return InputStage.FINISH_HANDLED;\n                            }\n                        }\n\n                        // Give the focused view a last chance to handle the dpad key.\n                        if (mView.dispatchUnhandledMove(focused, direction)) {\n                            return InputStage.FINISH_HANDLED;\n                        }\n                    } else {\n                        // find the best view to give focus to in this non-touch-mode with no-focus\n                        let v = this.ViewRootImpl_this.focusSearch(null, direction);\n                        if (v != null && v.requestFocus(direction)) {\n                            return InputStage.FINISH_HANDLED;\n                        }\n                    }\n                }\n            }\n            return InputStage.FORWARD;\n        }\n\n        private processGenericMotionEvent(event:MotionEvent){\n            // Deliver the event to the view.\n            if ((<any>this.ViewRootImpl_this).mView.dispatchGenericMotionEvent(event)) {\n                return InputStage.FINISH_HANDLED;\n            }\n            return InputStage.FORWARD;\n        }\n\n        private processTouchEvent(event:MotionEvent){\n            let handled = (<any>this.ViewRootImpl_this).mView.dispatchTouchEvent(event);\n            return handled ? InputStage.FINISH_HANDLED : InputStage.FORWARD;\n        }\n\n    }\n\n    /**\n     * Performs synthesis of new input events from unhandled input events.\n     */\n    class SyntheticInputStage extends InputStage{\n        onProcess(event):number {\n            return super.onProcess(event);\n        }\n    }\n\n\n}"
  },
  {
    "path": "src/android/view/ViewTreeObserver.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../java/lang/util/concurrent/CopyOnWriteArrayList.ts\"/>\n///<reference path=\"../util/CopyOnWriteArray.ts\"/>\n///<reference path=\"../view/View.ts\"/>\n\nmodule android.view {\n    import CopyOnWriteArrayList = java.lang.util.concurrent.CopyOnWriteArrayList;\n    import CopyOnWriteArray = android.util.CopyOnWriteArray;\n\n    /**\n     * A view tree observer is used to register listeners that can be notified of global\n     * changes in the view tree. Such global events include, but are not limited to,\n     * layout of the whole tree, beginning of the drawing pass, touch mode change....\n     *\n     * A ViewTreeObserver should never be instantiated by applications as it is provided\n     * by the views hierarchy. Refer to {@link android.view.View#getViewTreeObserver()}\n     * for more information.\n     */\n    export class ViewTreeObserver {\n\n        //private mOnWindowAttachListeners:CopyOnWriteArrayList<ViewTreeObserver.OnWindowAttachListener>;\n        //private mOnGlobalFocusListeners:CopyOnWriteArrayList<ViewTreeObserver.OnGlobalFocusChangeListener>;\n        private mOnTouchModeChangeListeners:CopyOnWriteArrayList<ViewTreeObserver.OnTouchModeChangeListener>;\n\n        private mOnGlobalLayoutListeners:CopyOnWriteArray<ViewTreeObserver.OnGlobalLayoutListener>;\n        private mOnScrollChangedListeners:CopyOnWriteArray<ViewTreeObserver.OnScrollChangedListener>;\n        private mOnPreDrawListeners:CopyOnWriteArray<ViewTreeObserver.OnPreDrawListener>;\n\n        private mOnDrawListeners:CopyOnWriteArrayList<ViewTreeObserver.OnDrawListener>;\n\n        private mAlive = true;\n\n        //addOnWindowAttachListener(listener:ViewTreeObserver.OnWindowAttachListener) {\n        //    this.checkIsAlive();\n        //\n        //    if (this.mOnWindowAttachListeners == null) {\n        //        this.mOnWindowAttachListeners = new CopyOnWriteArrayList<ViewTreeObserver.OnWindowAttachListener>();\n        //    }\n        //\n        //    this.mOnWindowAttachListeners.add(listener);\n        //}\n        //removeOnWindowAttachListener(victim:ViewTreeObserver.OnWindowAttachListener) {\n        //    this.checkIsAlive();\n        //    if (this.mOnWindowAttachListeners == null) {\n        //        return;\n        //    }\n        //    this.mOnWindowAttachListeners.remove(victim);\n        //}\n        //dispatchOnWindowAttachedChange(attached:boolean) {\n        //    // NOTE: because of the use of CopyOnWriteArrayList, we *must* use an iterator to\n        //    // perform the dispatching. The iterator is a safe guard against listeners that\n        //    // could mutate the list by calling the various add/remove methods. This prevents\n        //    // the array from being modified while we iterate it.\n        //    let listeners = this.mOnWindowAttachListeners;\n        //    if (listeners != null && listeners.size() > 0) {\n        //        for (let listener of listeners) {\n        //            if (attached) listener.onWindowAttached();\n        //            else listener.onWindowDetached();\n        //        }\n        //    }\n        //}\n\n        /**\n         * Register a callback to be invoked when the global layout state or the visibility of views\n         * within the view tree changes\n         *\n         * @param listener The callback to add\n         *\n         * @throws IllegalStateException If {@link #isAlive()} returns false\n         */\n        addOnGlobalLayoutListener(listener:ViewTreeObserver.OnGlobalLayoutListener) {\n            this.checkIsAlive();\n\n            if (this.mOnGlobalLayoutListeners == null) {\n                this.mOnGlobalLayoutListeners = new CopyOnWriteArray<ViewTreeObserver.OnGlobalLayoutListener>();\n            }\n\n            this.mOnGlobalLayoutListeners.add(listener);\n        }\n        /**\n         * Remove a previously installed global layout callback\n         *\n         * @param victim The callback to remove\n         *\n         * @throws IllegalStateException If {@link #isAlive()} returns false\n         *\n         * @deprecated Use #removeOnGlobalLayoutListener instead\n         *\n         * @see #addOnGlobalLayoutListener(OnGlobalLayoutListener)\n         */\n        removeGlobalOnLayoutListener(victim:ViewTreeObserver.OnGlobalLayoutListener) {\n            this.removeOnGlobalLayoutListener(victim);\n        }\n        /**\n         * Remove a previously installed global layout callback\n         *\n         * @param victim The callback to remove\n         *\n         * @throws IllegalStateException If {@link #isAlive()} returns false\n         *\n         * @see #addOnGlobalLayoutListener(OnGlobalLayoutListener)\n         */\n        removeOnGlobalLayoutListener(victim:ViewTreeObserver.OnGlobalLayoutListener) {\n            this.checkIsAlive();\n            if (this.mOnGlobalLayoutListeners == null) {\n                return;\n            }\n            this.mOnGlobalLayoutListeners.remove(victim);\n        }\n        /**\n         * Notifies registered listeners that a global layout happened. This can be called\n         * manually if you are forcing a layout on a View or a hierarchy of Views that are\n         * not attached to a Window or in the GONE state.\n         */\n        dispatchOnGlobalLayout() {\n            // NOTE: because of the use of CopyOnWriteArrayList, we *must* use an iterator to\n            // perform the dispatching. The iterator is a safe guard against listeners that\n            // could mutate the list by calling the various add/remove methods. This prevents\n            // the array from being modified while we iterate it.\n            let listeners = this.mOnGlobalLayoutListeners;\n            if (listeners != null && listeners.size() > 0) {\n                let access = listeners.start();\n                try {\n                    let count = access.length;\n                    for (let i = 0; i < count; i++) {\n                        access[i].onGlobalLayout();\n                    }\n                } finally {\n                    listeners.end();\n                }\n            }\n        }\n        //addOnGlobalFocusChangeListener(listener:ViewTreeObserver.OnGlobalFocusChangeListener) {\n        //    this.checkIsAlive();\n        //\n        //    if (this.mOnGlobalFocusListeners == null) {\n        //        this.mOnGlobalFocusListeners = new CopyOnWriteArrayList<ViewTreeObserver.OnGlobalFocusChangeListener>();\n        //    }\n        //\n        //    this.mOnGlobalFocusListeners.add(listener);\n        //}\n        //removeOnGlobalFocusChangeListener(victim:ViewTreeObserver.OnGlobalFocusChangeListener) {\n        //    this.checkIsAlive();\n        //    if (this.mOnGlobalFocusListeners == null) {\n        //        return;\n        //    }\n        //    this.mOnGlobalFocusListeners.remove(victim);\n        //}\n        //\n        //dispatchOnGlobalFocusChange(oldFocus:android.view.View, newFocus:android.view.View) {\n        //    // NOTE: because of the use of CopyOnWriteArrayList, we *must* use an iterator to\n        //    // perform the dispatching. The iterator is a safe guard against listeners that\n        //    // could mutate the list by calling the various add/remove methods. This prevents\n        //    // the array from being modified while we iterate it.\n        //    const listeners = this.mOnGlobalFocusListeners;\n        //    if (listeners != null && listeners.size() > 0) {\n        //        for (let listener of listeners) {\n        //            listener.onGlobalFocusChanged(oldFocus, newFocus);\n        //        }\n        //    }\n        //}\n\n        /**\n         * Register a callback to be invoked when the view tree is about to be drawn\n         *\n         * @param listener The callback to add\n         *\n         * @throws IllegalStateException If {@link #isAlive()} returns false\n         */\n        addOnPreDrawListener(listener:ViewTreeObserver.OnPreDrawListener) {\n            this.checkIsAlive();\n\n            if (this.mOnPreDrawListeners == null) {\n                this.mOnPreDrawListeners = new CopyOnWriteArray<ViewTreeObserver.OnPreDrawListener>();\n            }\n\n            this.mOnPreDrawListeners.add(listener);\n        }\n        /**\n         * Remove a previously installed pre-draw callback\n         *\n         * @param victim The callback to remove\n         *\n         * @throws IllegalStateException If {@link #isAlive()} returns false\n         *\n         * @see #addOnPreDrawListener(OnPreDrawListener)\n         */\n        removeOnPreDrawListener(victim:ViewTreeObserver.OnPreDrawListener) {\n            this.checkIsAlive();\n            if (this.mOnPreDrawListeners == null) {\n                return;\n            }\n            this.mOnPreDrawListeners.remove(victim);\n        }\n        /**\n         * Notifies registered listeners that the drawing pass is about to start. If a\n         * listener returns true, then the drawing pass is canceled and rescheduled. This can\n         * be called manually if you are forcing the drawing on a View or a hierarchy of Views\n         * that are not attached to a Window or in the GONE state.\n         *\n         * @return True if the current draw should be canceled and resceduled, false otherwise.\n         */\n        dispatchOnPreDraw():boolean {\n            let cancelDraw = false;\n            const listeners = this.mOnPreDrawListeners;\n            if (listeners != null && listeners.size() > 0) {\n                let access = listeners.start();\n                try {\n                    let count = access.length;\n                    for (let i = 0; i < count; i++) {\n                        cancelDraw = cancelDraw || !(access[i].onPreDraw());\n                    }\n                } finally {\n                    listeners.end();\n                }\n            }\n            return cancelDraw;\n        }\n        /**\n         * Register a callback to be invoked when the invoked when the touch mode changes.\n         *\n         * @param listener The callback to add\n         *\n         * @throws IllegalStateException If {@link #isAlive()} returns false\n         */\n        addOnTouchModeChangeListener(listener:ViewTreeObserver.OnTouchModeChangeListener) {\n            this.checkIsAlive();\n\n            if (this.mOnTouchModeChangeListeners == null) {\n                this.mOnTouchModeChangeListeners = new CopyOnWriteArrayList<ViewTreeObserver.OnTouchModeChangeListener>();\n            }\n\n            this.mOnTouchModeChangeListeners.add(listener);\n        }\n        /**\n         * Remove a previously installed touch mode change callback\n         *\n         * @param victim The callback to remove\n         *\n         * @throws IllegalStateException If {@link #isAlive()} returns false\n         *\n         * @see #addOnTouchModeChangeListener(OnTouchModeChangeListener)\n         */\n        removeOnTouchModeChangeListener(victim:ViewTreeObserver.OnTouchModeChangeListener) {\n            this.checkIsAlive();\n            if (this.mOnTouchModeChangeListeners == null) {\n                return;\n            }\n            this.mOnTouchModeChangeListeners.remove(victim);\n        }\n\n        /**\n         * Notifies registered listeners that the touch mode has changed.\n         *\n         * @param inTouchMode True if the touch mode is now enabled, false otherwise.\n         */\n        dispatchOnTouchModeChanged(inTouchMode:boolean) {\n            const listeners = this.mOnTouchModeChangeListeners;\n            if (listeners != null && listeners.size() > 0) {\n                for (let listener of listeners) {\n                    listener.onTouchModeChanged(inTouchMode);\n                }\n            }\n        }\n\n        /**\n         * Register a callback to be invoked when a view has been scrolled.\n         *\n         * @param listener The callback to add\n         *\n         * @throws IllegalStateException If {@link #isAlive()} returns false\n         */\n        addOnScrollChangedListener(listener:ViewTreeObserver.OnScrollChangedListener) {\n            this.checkIsAlive();\n\n            if (this.mOnScrollChangedListeners == null) {\n                this.mOnScrollChangedListeners = new CopyOnWriteArray<ViewTreeObserver.OnScrollChangedListener>();\n            }\n\n            this.mOnScrollChangedListeners.add(listener);\n        }\n        /**\n         * Remove a previously installed scroll-changed callback\n         *\n         * @param victim The callback to remove\n         *\n         * @throws IllegalStateException If {@link #isAlive()} returns false\n         *\n         * @see #addOnScrollChangedListener(OnScrollChangedListener)\n         */\n        removeOnScrollChangedListener(victim:ViewTreeObserver.OnScrollChangedListener) {\n            this.checkIsAlive();\n            if (this.mOnScrollChangedListeners == null) {\n                return;\n            }\n            this.mOnScrollChangedListeners.remove(victim);\n        }\n        /**\n         * Notifies registered listeners that something has scrolled.\n         */\n        dispatchOnScrollChanged():void {\n            let listeners = this.mOnScrollChangedListeners;\n            if (listeners != null && listeners.size() > 0) {\n                let access = listeners.start();\n                try {\n                    let count = access.length;\n                    for (let i = 0; i < count; i++) {\n                        access[i].onScrollChanged();\n                    }\n                } finally {\n                    listeners.end();\n                }\n            }\n        }\n        /**\n         * <p>Register a callback to be invoked when the view tree is about to be drawn.</p>\n         * <p><strong>Note:</strong> this method <strong>cannot</strong> be invoked from\n         * {@link android.view.ViewTreeObserver.OnDrawListener#onDraw()}.</p>\n         *\n         * @param listener The callback to add\n         *\n         * @throws IllegalStateException If {@link #isAlive()} returns false\n         */\n        addOnDrawListener(listener:ViewTreeObserver.OnDrawListener) {\n            this.checkIsAlive();\n\n            if (this.mOnDrawListeners == null) {\n                this.mOnDrawListeners = new CopyOnWriteArrayList<ViewTreeObserver.OnDrawListener>();\n            }\n\n            this.mOnDrawListeners.add(listener);\n        }\n        /**\n         * <p>Remove a previously installed pre-draw callback.</p>\n         * <p><strong>Note:</strong> this method <strong>cannot</strong> be invoked from\n         * {@link android.view.ViewTreeObserver.OnDrawListener#onDraw()}.</p>\n         *\n         * @param victim The callback to remove\n         *\n         * @throws IllegalStateException If {@link #isAlive()} returns false\n         *\n         * @see #addOnDrawListener(OnDrawListener)\n         */\n        removeOnDrawListener(victim:ViewTreeObserver.OnDrawListener) {\n            this.checkIsAlive();\n            if (this.mOnDrawListeners == null) {\n                return;\n            }\n            this.mOnDrawListeners.remove(victim);\n        }\n        /**\n         * Notifies registered listeners that the drawing pass is about to start.\n         */\n        dispatchOnDraw():void {\n            if (this.mOnDrawListeners != null) {\n                for (let listener of this.mOnDrawListeners) {\n                    listener.onDraw();\n                }\n            }\n        }\n\n        /**\n         * Merges all the listeners registered on the specified observer with the listeners\n         * registered on this object. After this method is invoked, the specified observer\n         * will return false in {@link #isAlive()} and should not be used anymore.\n         *\n         * @param observer The ViewTreeObserver whose listeners must be added to this observer\n         */\n        merge(observer:ViewTreeObserver){\n            //if (observer.mOnWindowAttachListeners != null) {\n            //    if (this.mOnWindowAttachListeners != null) {\n            //        this.mOnWindowAttachListeners.addAll(observer.mOnWindowAttachListeners);\n            //    } else {\n            //        this.mOnWindowAttachListeners = observer.mOnWindowAttachListeners;\n            //    }\n            //}\n\n            //if (observer.mOnWindowFocusListeners != null) {\n            //    if (this.mOnWindowFocusListeners != null) {\n            //        this.mOnWindowFocusListeners.addAll(observer.mOnWindowFocusListeners);\n            //    } else {\n            //        this.mOnWindowFocusListeners = observer.mOnWindowFocusListeners;\n            //    }\n            //}\n            //\n            //if (observer.mOnGlobalFocusListeners != null) {\n            //    if (this.mOnGlobalFocusListeners != null) {\n            //        this.mOnGlobalFocusListeners.addAll(observer.mOnGlobalFocusListeners);\n            //    } else {\n            //        this.mOnGlobalFocusListeners = observer.mOnGlobalFocusListeners;\n            //    }\n            //}\n\n            if (observer.mOnGlobalLayoutListeners != null) {\n                if (this.mOnGlobalLayoutListeners != null) {\n                    this.mOnGlobalLayoutListeners.addAll(observer.mOnGlobalLayoutListeners);\n                } else {\n                    this.mOnGlobalLayoutListeners = observer.mOnGlobalLayoutListeners;\n                }\n            }\n\n            if (observer.mOnPreDrawListeners != null) {\n                if (this.mOnPreDrawListeners != null) {\n                    this.mOnPreDrawListeners.addAll(observer.mOnPreDrawListeners);\n                } else {\n                    this.mOnPreDrawListeners = observer.mOnPreDrawListeners;\n                }\n            }\n\n            //if (observer.mOnTouchModeChangeListeners != null) {\n            //    if (this.mOnTouchModeChangeListeners != null) {\n            //        this.mOnTouchModeChangeListeners.addAll(observer.mOnTouchModeChangeListeners);\n            //    } else {\n            //        this.mOnTouchModeChangeListeners = observer.mOnTouchModeChangeListeners;\n            //    }\n            //}\n            //\n            //if (observer.mOnComputeInternalInsetsListeners != null) {\n            //    if (this.mOnComputeInternalInsetsListeners != null) {\n            //        this.mOnComputeInternalInsetsListeners.addAll(observer.mOnComputeInternalInsetsListeners);\n            //    } else {\n            //        this.mOnComputeInternalInsetsListeners = observer.mOnComputeInternalInsetsListeners;\n            //    }\n            //}\n\n            if (observer.mOnScrollChangedListeners != null) {\n                if (this.mOnScrollChangedListeners != null) {\n                    this.mOnScrollChangedListeners.addAll(observer.mOnScrollChangedListeners);\n                } else {\n                    this.mOnScrollChangedListeners = observer.mOnScrollChangedListeners;\n                }\n            }\n\n            observer.kill();\n        }\n\n        private checkIsAlive() {\n            if (!this.mAlive) {\n                throw new Error(\"This ViewTreeObserver is not alive, call \"\n                    + \"getViewTreeObserver() again\");\n            }\n        }\n        /**\n         * Indicates whether this ViewTreeObserver is alive. When an observer is not alive,\n         * any call to a method (except this one) will throw an exception.\n         *\n         * If an application keeps a long-lived reference to this ViewTreeObserver, it should\n         * always check for the result of this method before calling any other method.\n         *\n         * @return True if this object is alive and be used, false otherwise.\n         */\n        isAlive():boolean {\n            return this.mAlive;\n        }\n        private kill() {\n            this.mAlive = false;\n        }\n    }\n\n    export module ViewTreeObserver {\n        //export interface OnWindowAttachListener {\n        //    onWindowAttached();\n        //    onWindowDetached();\n        //}\n\n        /**\n         * Interface definition for a callback to be invoked when the focus state within\n         * the view tree changes.\n         */\n        export interface OnGlobalFocusChangeListener {\n\n            /**\n             * Callback method to be invoked when the focus changes in the view tree. When\n             * the view tree transitions from touch mode to non-touch mode, oldFocus is null.\n             * When the view tree transitions from non-touch mode to touch mode, newFocus is\n             * null. When focus changes in non-touch mode (without transition from or to\n             * touch mode) either oldFocus or newFocus can be null.\n             *\n             * @param oldFocus The previously focused view, if any.\n             * @param newFocus The newly focused View, if any.\n             */\n            onGlobalFocusChanged(oldFocus:android.view.View, newFocus:android.view.View);\n        }\n\n        /**\n         * Interface definition for a callback to be invoked when the global layout state\n         * or the visibility of views within the view tree changes.\n         */\n        export interface OnGlobalLayoutListener {\n\n            /**\n             * Callback method to be invoked when the global layout state or the visibility of views\n             * within the view tree changes\n             */\n            onGlobalLayout();\n        }\n        /**\n         * Interface definition for a callback to be invoked when the view tree is about to be drawn.\n         */\n        export interface OnPreDrawListener {\n            /**\n             * Callback method to be invoked when the view tree is about to be drawn. At this point, all\n             * views in the tree have been measured and given a frame. Clients can use this to adjust\n             * their scroll bounds or even to request a new layout before drawing occurs.\n             *\n             * @return Return true to proceed with the current drawing pass, or false to cancel.\n             *\n             * @see android.view.View#onMeasure\n             * @see android.view.View#onLayout\n             * @see android.view.View#onDraw\n             */\n            onPreDraw():boolean;\n        }\n        /**\n         * Interface definition for a callback to be invoked when the view tree is about to be drawn.\n         */\n        export interface OnDrawListener {\n            /**\n             * <p>Callback method to be invoked when the view tree is about to be drawn. At this point,\n             * views cannot be modified in any way.</p>\n             *\n             * <p>Unlike with {@link OnPreDrawListener}, this method cannot be used to cancel the\n             * current drawing pass.</p>\n             *\n             * <p>An {@link OnDrawListener} listener <strong>cannot be added or removed</strong>\n             * from this method.</p>\n             *\n             * @see android.view.View#onMeasure\n             * @see android.view.View#onLayout\n             * @see android.view.View#onDraw\n             */\n            onDraw();\n        }\n        /**\n         * Interface definition for a callback to be invoked when\n         * something in the view tree has been scrolled.\n         */\n        export interface OnScrollChangedListener {\n            /**\n             * Callback method to be invoked when something in the view tree\n             * has been scrolled.\n             */\n            onScrollChanged();\n        }\n        /**\n         * Interface definition for a callback to be invoked when the touch mode changes.\n         */\n        export interface OnTouchModeChangeListener {\n            /**\n             * Callback method to be invoked when the touch mode changes.\n             *\n             * @param isInTouchMode True if the view hierarchy is now in touch mode, false  otherwise.\n             */\n            onTouchModeChanged(isInTouchMode:boolean);\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/Window.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/view/WindowManager.ts\"/>\n///<reference path=\"../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../android/widget/FrameLayout.ts\"/>\n///<reference path=\"../../android/graphics/PixelFormat.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../android/view/LayoutInflater.ts\"/>\n///<reference path=\"../../android/view/Surface.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewConfiguration.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/view/animation/Animation.ts\"/>\n///<reference path=\"../../android/view/animation/TranslateAnimation.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n///<reference path=\"../../android/os/SystemClock.ts\"/>\n///<reference path=\"../../android/R/anim.ts\"/>\n\nmodule android.view {\nimport PixelFormat = android.graphics.PixelFormat;\nimport Drawable = android.graphics.drawable.Drawable;\nimport Integer = java.lang.Integer;\nimport Gravity = android.view.Gravity;\nimport KeyEvent = android.view.KeyEvent;\nimport LayoutInflater = android.view.LayoutInflater;\nimport MotionEvent = android.view.MotionEvent;\nimport Surface = android.view.Surface;\nimport View = android.view.View;\nimport ViewConfiguration = android.view.ViewConfiguration;\nimport ViewGroup = android.view.ViewGroup;\nimport WindowManager = android.view.WindowManager;\nimport Animation = android.view.animation.Animation;\nimport TranslateAnimation = android.view.animation.TranslateAnimation;\nimport FrameLayout = android.widget.FrameLayout;\nimport Context = android.content.Context;\nimport SystemClock = android.os.SystemClock;\n/**\n * Abstract base class for a top-level window look and behavior policy.  An\n * instance of this class should be used as the top-level view added to the\n * window manager. It provides standard UI policies such as a background, title\n * area, default key processing, etc.\n *\n * <p>The only existing implementation of this abstract class is\n * android.policy.PhoneWindow, which you should instantiate when needing a\n * Window.  Eventually that class will be refactored and a factory method\n * added for creating Window instances without knowing about a particular\n * implementation.\n */\nexport class Window {\n\n    ///** Flag for the \"options panel\" feature.  This is enabled by default. */\n    //static FEATURE_OPTIONS_PANEL:number = 0;\n    //\n    ///** Flag for the \"no title\" feature, turning off the title at the top\n    // *  of the screen. */\n    //static FEATURE_NO_TITLE:number = 1;\n    //\n    ///** Flag for the progress indicator feature */\n    //static FEATURE_PROGRESS:number = 2;\n    //\n    ///** Flag for having an icon on the left side of the title bar */\n    //static FEATURE_LEFT_ICON:number = 3;\n    //\n    ///** Flag for having an icon on the right side of the title bar */\n    //static FEATURE_RIGHT_ICON:number = 4;\n    //\n    ///** Flag for indeterminate progress */\n    //static FEATURE_INDETERMINATE_PROGRESS:number = 5;\n    //\n    ///** Flag for the context menu.  This is enabled by default. */\n    //static FEATURE_CONTEXT_MENU:number = 6;\n    //\n    ///** Flag for custom title. You cannot combine this feature with other title features. */\n    //static FEATURE_CUSTOM_TITLE:number = 7;\n    //\n    ///**\n    // * Flag for enabling the Action Bar.\n    // * This is enabled by default for some devices. The Action Bar\n    // * replaces the title bar and provides an alternate location\n    // * for an on-screen menu button on some devices.\n    // */\n    //static FEATURE_ACTION_BAR:number = 8;\n    //\n    ///**\n    // * Flag for requesting an Action Bar that overlays window content.\n    // * Normally an Action Bar will sit in the space above window content, but if this\n    // * feature is requested along with {@link #FEATURE_ACTION_BAR} it will be layered over\n    // * the window content itself. This is useful if you would like your app to have more control\n    // * over how the Action Bar is displayed, such as letting application content scroll beneath\n    // * an Action Bar with a transparent background or otherwise displaying a transparent/translucent\n    // * Action Bar over application content.\n    // *\n    // * <p>This mode is especially useful with {@link View#SYSTEM_UI_FLAG_FULLSCREEN\n    // * View.SYSTEM_UI_FLAG_FULLSCREEN}, which allows you to seamlessly hide the\n    // * action bar in conjunction with other screen decorations.\n    // *\n    // * <p>As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN}, when an\n    // * ActionBar is in this mode it will adjust the insets provided to\n    // * {@link View#fitSystemWindows(android.graphics.Rect) View.fitSystemWindows(Rect)}\n    // * to include the content covered by the action bar, so you can do layout within\n    // * that space.\n    // */\n    //static FEATURE_ACTION_BAR_OVERLAY:number = 9;\n    //\n    ///**\n    // * Flag for specifying the behavior of action modes when an Action Bar is not present.\n    // * If overlay is enabled, the action mode UI will be allowed to cover existing window content.\n    // */\n    //static FEATURE_ACTION_MODE_OVERLAY:number = 10;\n    //\n    ///**\n    // * Max value used as a feature ID\n    // * @hide\n    // */\n    //static FEATURE_MAX:number = Window.FEATURE_ACTION_MODE_OVERLAY;\n    //\n    ///** Flag for setting the progress bar's visibility to VISIBLE */\n    //static PROGRESS_VISIBILITY_ON:number = -1;\n    //\n    ///** Flag for setting the progress bar's visibility to GONE */\n    //static PROGRESS_VISIBILITY_OFF:number = -2;\n    //\n    ///** Flag for setting the progress bar's indeterminate mode on */\n    //static PROGRESS_INDETERMINATE_ON:number = -3;\n    //\n    ///** Flag for setting the progress bar's indeterminate mode off */\n    //static PROGRESS_INDETERMINATE_OFF:number = -4;\n    //\n    ///** Starting value for the (primary) progress */\n    //static PROGRESS_START:number = 0;\n    //\n    ///** Ending value for the (primary) progress */\n    //static PROGRESS_END:number = 10000;\n    //\n    ///** Lowest possible value for the secondary progress */\n    //static PROGRESS_SECONDARY_START:number = 20000;\n    //\n    ///** Highest possible value for the secondary progress */\n    //static PROGRESS_SECONDARY_END:number = 30000;\n    //\n    ///** The default features enabled */\n    //protected static DEFAULT_FEATURES:number = (1 << Window.FEATURE_OPTIONS_PANEL) | (1 << Window.FEATURE_CONTEXT_MENU);\n    //\n    ///**\n    // * The ID that the main layout in the XML layout file should have.\n    // */\n    //static ID_ANDROID_CONTENT:string = android.R.id.content;\n    //\n    //private static PROPERTY_HARDWARE_UI:string = \"persist.sys.ui.hw\";\n\n    private mContext:Context;\n\n    //private mWindowStyle:TypedArray;\n\n    private mCallback:Window.Callback;\n\n    private mChildWindowManager:WindowManager;\n\n    //private mAppToken:IBinder;\n\n    //private mAppName:string;\n\n    //private mHardwareAccelerated:boolean;\n\n    private mContainer:WindowManager;\n\n\n    private mIsActive:boolean = false;\n    //\n    //private mHasChildren:boolean = false;\n\n    private mCloseOnTouchOutside:boolean = false;\n\n    private mSetCloseOnTouchOutside:boolean = false;\n\n    //private mForcedWindowFlags:number = 0;\n    //\n    //private mFeatures:number = Window.DEFAULT_FEATURES;\n    //\n    //private mLocalFeatures:number = Window.DEFAULT_FEATURES;\n\n    //private mHaveWindowFormat:boolean = false;\n\n    //private mHaveDimAmount:boolean = false;\n\n    //private mDefaultWindowFormat:number = PixelFormat.OPAQUE;\n\n    //private mHasSoftInputMode:boolean = false;\n\n    private mDestroyed:boolean;\n\n    // The current window attributes.\n    private mWindowAttributes:WindowManager.LayoutParams = new WindowManager.LayoutParams();\n\n    private mAttachInfo:View.AttachInfo;\n\n    // This is the top-level view of the window, containing the window decor.\n    private mDecor:DecorView;\n\n    // This is the view in which the window contents are placed. It is either\n    // mDecor itself, or a child of mDecor where the contents go.\n    private mContentParent:ViewGroup;\n\n    //private mTitle:string;\n\n    constructor(context:Context) {\n        this.mContext = context;\n\n        this.initDecorView();\n        this.initAttachInfo();\n        this.getAttributes().setTitle(context.androidUI.appName);//default title\n    }\n\n    private initDecorView(){\n        this.mDecor = new DecorView(this);\n        this.mContentParent = new FrameLayout(this.mContext);\n        this.mContentParent.setId(android.R.id.content);\n        this.mDecor.addView(this.mContentParent, -1, -1);\n    }\n\n    private initAttachInfo(){\n        let viewRootImpl = this.mContext.androidUI._viewRootImpl;\n        this.mAttachInfo = new View.AttachInfo(viewRootImpl, viewRootImpl.mHandler);\n        this.mAttachInfo.mRootView = this.mDecor;\n        this.mAttachInfo.mHasWindowFocus = true;\n    }\n\n    /**\n     * Return the Context this window policy is running in, for retrieving\n     * resources and other information.\n     *\n     * @return Context The Context that was supplied to the constructor.\n     */\n    getContext():Context  {\n        return this.mContext;\n    }\n\n    ///**\n    // * Return the {@link android.R.styleable#Window} attributes from this\n    // * window's theme.\n    // */\n    //getWindowStyle():TypedArray  {\n    //    {\n    //        if (this.mWindowStyle == null) {\n    //            this.mWindowStyle = this.mContext.obtainStyledAttributes(com.android.internal.R.styleable.Window);\n    //        }\n    //        return this.mWindowStyle;\n    //    }\n    //}\n\n    /**\n     * Set the container for this window.  If not set, the DecorWindow\n     * operates as a top-level window; otherwise, it negotiates with the\n     * container to display itself appropriately.\n     *\n     * @param container The desired containing Window.\n     */\n    setContainer(container:WindowManager):void  {\n        this.mContainer = container;\n        //if (container != null) {\n        //    // Embedded screens never have a title.\n        //    //this.mFeatures |= 1 << Window.FEATURE_NO_TITLE;\n        //    //this.mLocalFeatures |= 1 << Window.FEATURE_NO_TITLE;\n        //    container.mHasChildren = true;\n        //}\n    }\n\n    /**\n     * Return the container for this Window.\n     *\n     * @return Window The containing window, or null if this is a\n     *         top-level window.\n     */\n    getContainer():WindowManager  {\n        return this.mContainer;\n    }\n\n    //hasChildren():boolean  {\n    //    return this.mHasChildren;\n    //}\n\n    /** @hide */\n    destroy():void  {\n        this.mDestroyed = true;\n    }\n\n    /** @hide */\n    isDestroyed():boolean  {\n        return this.mDestroyed;\n    }\n    setChildWindowManager(wm:WindowManager):void  {\n        //this.mAppToken = appToken;\n        //this.mAppName = appName;\n        //this.mHardwareAccelerated = hardwareAccelerated;// || SystemProperties.getBoolean(Window.PROPERTY_HARDWARE_UI, false);\n        //if (wm == null) {\n        //    wm = <WindowManager> this.mContext.getSystemService(Context.WINDOW_SERVICE);\n        //}\n        //this.mWindowManager = (<WindowManagerImpl> wm).createLocalWindowManager(this);\n\n        if(this.mChildWindowManager){\n            this.mDecor.removeView(this.mChildWindowManager.getWindowsLayout());\n        }\n        this.mChildWindowManager = wm;\n    }\n\n    //adjustLayoutParamsForSubWindow(wp:WindowManager.LayoutParams):void  {\n    //    let curTitle:string = wp.getTitle();\n    //    if (wp.type >= WindowManager.LayoutParams.FIRST_SUB_WINDOW && wp.type <= WindowManager.LayoutParams.LAST_SUB_WINDOW) {\n    //        if (wp.token == null) {\n    //            let decor:View = this.peekDecorView();\n    //            if (decor != null) {\n    //                wp.token = decor.getWindowToken();\n    //            }\n    //        }\n    //        if (curTitle == null || curTitle.length() == 0) {\n    //            let title:string;\n    //            if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA) {\n    //                title = \"Media\";\n    //            } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY) {\n    //                title = \"MediaOvr\";\n    //            } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_PANEL) {\n    //                title = \"Panel\";\n    //            } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL) {\n    //                title = \"SubPanel\";\n    //            } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG) {\n    //                title = \"AtchDlg\";\n    //            } else {\n    //                title = Integer.toString(wp.type);\n    //            }\n    //            if (this.mAppName != null) {\n    //                title += \":\" + this.mAppName;\n    //            }\n    //            wp.setTitle(title);\n    //        }\n    //    } else {\n    //        if (wp.token == null) {\n    //            wp.token = this.mContainer == null ? this.mAppToken : this.mContainer.mAppToken;\n    //        }\n    //        if ((curTitle == null || curTitle.length() == 0) && this.mAppName != null) {\n    //            wp.setTitle(this.mAppName);\n    //        }\n    //    }\n    //    if (wp.packageName == null) {\n    //        wp.packageName = this.mContext.getPackageName();\n    //    }\n    //    if (this.mHardwareAccelerated) {\n    //        wp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;\n    //    }\n    //}\n\n    /**\n     * Return the window manager allowing this Window to display its own\n     * windows.\n     *\n     * @return WindowManager The ViewManager.\n     */\n    getChildWindowManager():WindowManager  {\n        if(!this.mChildWindowManager){\n            this.mChildWindowManager = new WindowManager(this.mContext);\n            this.mDecor.addView(this.mChildWindowManager.getWindowsLayout(), -1, -1);\n        }\n        return this.mChildWindowManager;\n    }\n\n    /**\n     * Set the Callback interface for this window, used to intercept key\n     * events and other dynamic operations in the window.\n     *\n     * @param callback The desired Callback interface.\n     */\n    setCallback(callback:Window.Callback):void  {\n        this.mCallback = callback;\n    }\n\n    /**\n     * Return the current Callback interface for this window.\n     */\n    getCallback():Window.Callback  {\n        return this.mCallback;\n    }\n\n//    /**\n//     * Take ownership of this window's surface.  The window's view hierarchy\n//     * will no longer draw into the surface, though it will otherwise continue\n//     * to operate (such as for receiving input events).  The given SurfaceHolder\n//     * callback will be used to tell you about state changes to the surface.\n//     */\n//    abstract\n//takeSurface(callback:SurfaceHolder.Callback2):void ;\n\n//    /**\n//     * Take ownership of this window's InputQueue.  The window will no\n//     * longer read and dispatch input events from the queue; it is your\n//     * responsibility to do so.\n//     */\n//    abstract\n//takeInputQueue(callback:InputQueue.Callback):void ;\n\n    setFloating(isFloating:boolean):void {\n        const attrs:WindowManager.LayoutParams = this.getAttributes();\n        if(isFloating === attrs.isFloating()) return;\n        if(isFloating) attrs.flags |= WindowManager.LayoutParams.FLAG_FLOATING;\n        else attrs.flags &= ~WindowManager.LayoutParams.FLAG_FLOATING;\n        if (this.mCallback != null) {\n            this.mCallback.onWindowAttributesChanged(attrs);\n        }\n    }\n\n    /**\n     * Return whether this window is being displayed with a floating style\n     * (based on the {@link android.R.attr#windowIsFloating} attribute in\n     * the style/theme).\n     *\n     * @return Returns true if the window is configured to be displayed floating\n     * on top of whatever is behind it.\n     */\n    isFloating():boolean{\n        return this.mWindowAttributes.isFloating();\n    }\n\n    /**\n     * Set the width and height layout parameters of the window.  The default\n     * for both of these is MATCH_PARENT; you can change them to WRAP_CONTENT\n     * or an absolute value to make a window that is not full-screen.\n     *\n     * @param width The desired layout width of the window.\n     * @param height The desired layout height of the window.\n     *\n     * @see ViewGroup.LayoutParams#height\n     * @see ViewGroup.LayoutParams#width\n     */\n    setLayout(width:number, height:number):void  {\n        const attrs:WindowManager.LayoutParams = this.getAttributes();\n        attrs.width = width;\n        attrs.height = height;\n        if (this.mCallback != null) {\n            this.mCallback.onWindowAttributesChanged(attrs);\n        }\n    }\n\n    /**\n     * Set the gravity of the window, as per the Gravity constants.  This\n     * controls how the window manager is positioned in the overall window; it\n     * is only useful when using WRAP_CONTENT for the layout width or height.\n     *\n     * @param gravity The desired gravity constant.\n     *\n     * @see Gravity\n     * @see #setLayout\n     */\n    setGravity(gravity:number):void  {\n        const attrs:WindowManager.LayoutParams = this.getAttributes();\n        attrs.gravity = gravity;\n        if (this.mCallback != null) {\n            this.mCallback.onWindowAttributesChanged(attrs);\n        }\n    }\n\n    /**\n     * Set the type of the window, as per the WindowManager.LayoutParams\n     * types.\n     *\n     * @param type The new window type (see WindowManager.LayoutParams).\n     */\n    setType(type:number):void  {\n        const attrs:WindowManager.LayoutParams = this.getAttributes();\n        attrs.type = type;\n        if (this.mCallback != null) {\n            this.mCallback.onWindowAttributesChanged(attrs);\n        }\n    }\n\n    ///**\n    // * Set the format of window, as per the PixelFormat types.  This overrides\n    // * the default format that is selected by the Window based on its\n    // * window decorations.\n    // *\n    // * @param format The new window format (see PixelFormat).  Use\n    // *               PixelFormat.UNKNOWN to allow the Window to select\n    // *               the format.\n    // *\n    // * @see PixelFormat\n    // */\n    //setFormat(format:number):void  {\n    //    const attrs:WindowManager.LayoutParams = this.getAttributes();\n    //    if (format != PixelFormat.UNKNOWN) {\n    //        attrs.format = format;\n    //        this.mHaveWindowFormat = true;\n    //    } else {\n    //        attrs.format = this.mDefaultWindowFormat;\n    //        this.mHaveWindowFormat = false;\n    //    }\n    //    if (this.mCallback != null) {\n    //        this.mCallback.onWindowAttributesChanged(attrs);\n    //    }\n    //}\n\n\n    /**\n     * Specify custom animations to use for the window\n     */\n    setWindowAnimations(enterAnimation:Animation, exitAnimation:Animation,\n                        resumeAnimation=this.mWindowAttributes.resumeAnimation, hideAnimation=this.mWindowAttributes.hideAnimation):void  {\n        const attrs:WindowManager.LayoutParams = this.getAttributes();\n        attrs.enterAnimation = enterAnimation;\n        attrs.exitAnimation = exitAnimation;\n        attrs.resumeAnimation = resumeAnimation;\n        attrs.hideAnimation = hideAnimation;\n        //const attrs:WindowManager.LayoutParams = this.getAttributes();\n        //attrs.windowAnimations = resId;\n        if (this.mCallback != null) {\n            this.mCallback.onWindowAttributesChanged(attrs);\n        }\n    }\n\n\n    ///**\n    // * Specify an explicit soft input mode to use for the window, as per\n    // * {@link WindowManager.LayoutParams#softInputMode\n    // * WindowManager.LayoutParams.softInputMode}.  Providing anything besides\n    // * \"unspecified\" here will override the input mode the window would\n    // * normally retrieve from its theme.\n    // */\n    //setSoftInputMode(mode:number):void  {\n    //    const attrs:WindowManager.LayoutParams = this.getAttributes();\n    //    if (mode != WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED) {\n    //        attrs.softInputMode = mode;\n    //        this.mHasSoftInputMode = true;\n    //    } else {\n    //        this.mHasSoftInputMode = false;\n    //    }\n    //    if (this.mCallback != null) {\n    //        this.mCallback.onWindowAttributesChanged(attrs);\n    //    }\n    //}\n\n    /**\n     * Convenience function to set the flag bits as specified in flags, as\n     * per {@link #setFlags}.\n     * @param flags The flag bits to be set.\n     * @see #setFlags\n     * @see #clearFlags\n     */\n    addFlags(flags:number):void  {\n        this.setFlags(flags, flags);\n    }\n\n    ///** @hide */\n    //addPrivateFlags(flags:number):void  {\n    //    this.setPrivateFlags(flags, flags);\n    //}\n\n    /**\n     * Convenience function to clear the flag bits as specified in flags, as\n     * per {@link #setFlags}.\n     * @param flags The flag bits to be cleared.\n     * @see #setFlags\n     * @see #addFlags\n     */\n    clearFlags(flags:number):void  {\n        this.setFlags(0, flags);\n    }\n\n    /**\n     * Set the flags of the window, as per the\n     * {@link WindowManager.LayoutParams WindowManager.LayoutParams}\n     * flags.\n     * \n     * <p>Note that some flags must be set before the window decoration is\n     * created (by the first call to\n     * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)} or\n     * {@link #getDecorView()}:\n     * {@link WindowManager.LayoutParams#FLAG_LAYOUT_IN_SCREEN} and\n     * {@link WindowManager.LayoutParams#FLAG_LAYOUT_INSET_DECOR}.  These\n     * will be set for you based on the {@link android.R.attr#windowIsFloating}\n     * attribute.\n     *\n     * @param flags The new window flags (see WindowManager.LayoutParams).\n     * @param mask Which of the window flag bits to modify.\n     * @see #addFlags\n     * @see #clearFlags\n     */\n    setFlags(flags:number, mask:number):void  {\n        const attrs:WindowManager.LayoutParams = this.getAttributes();\n        attrs.flags = (attrs.flags & ~mask) | (flags & mask);\n        //if ((mask & WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY) != 0) {\n        //    attrs.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SET_NEEDS_MENU_KEY;\n        //}\n        //this.mForcedWindowFlags |= mask;\n        if (this.mCallback != null) {\n            this.mCallback.onWindowAttributesChanged(attrs);\n        }\n    }\n\n    //private setPrivateFlags(flags:number, mask:number):void  {\n    //    const attrs:WindowManager.LayoutParams = this.getAttributes();\n    //    attrs.privateFlags = (attrs.privateFlags & ~mask) | (flags & mask);\n    //    if (this.mCallback != null) {\n    //        this.mCallback.onWindowAttributesChanged(attrs);\n    //    }\n    //}\n\n    /**\n     * Set the amount of dim behind the window when using\n     * {@link WindowManager.LayoutParams#FLAG_DIM_BEHIND}.  This overrides\n     * the default dim amount of that is selected by the Window based on\n     * its theme.\n     *\n     * @param amount The new dim amount, from 0 for no dim to 1 for full dim.\n     */\n    setDimAmount(amount:number):void  {\n        const attrs:WindowManager.LayoutParams = this.getAttributes();\n        attrs.dimAmount = amount;\n        //this.mHaveDimAmount = true;\n        if (this.mCallback != null) {\n            this.mCallback.onWindowAttributesChanged(attrs);\n        }\n    }\n\n    /**\n     * Specify custom window attributes.  <strong>PLEASE NOTE:</strong> the\n     * layout params you give here should generally be from values previously\n     * retrieved with {@link #getAttributes()}; you probably do not want to\n     * blindly create and apply your own, since this will blow away any values\n     * set by the framework that you are not interested in.\n     *\n     * @param a The new window attributes, which will completely override any\n     *          current values.\n     */\n    setAttributes(a:WindowManager.LayoutParams):void  {\n        this.mWindowAttributes.copyFrom(a);\n        if (this.mCallback != null) {\n            this.mCallback.onWindowAttributesChanged(this.mWindowAttributes);\n        }\n    }\n\n    /**\n     * Retrieve the current window attributes associated with this panel.\n     *\n     * @return WindowManager.LayoutParams Either the existing window\n     *         attributes object, or a freshly created one if there is none.\n     */\n    getAttributes():WindowManager.LayoutParams  {\n        return this.mWindowAttributes;\n    }\n\n    ///**\n    // * Return the window flags that have been explicitly set by the client,\n    // * so will not be modified by {@link #getDecorView}.\n    // */\n    //protected getForcedWindowFlags():number  {\n    //    return this.mForcedWindowFlags;\n    //}\n    //\n    ///**\n    // * Has the app specified their own soft input mode?\n    // */\n    //protected hasSoftInputMode():boolean  {\n    //    return this.mHasSoftInputMode;\n    //}\n\n    /** @hide */\n    setCloseOnTouchOutside(close:boolean):void  {\n        this.mCloseOnTouchOutside = close;\n        this.mSetCloseOnTouchOutside = true;\n    }\n\n    /** @hide */\n    setCloseOnTouchOutsideIfNotSet(close:boolean):void  {\n        if (!this.mSetCloseOnTouchOutside) {\n            this.mCloseOnTouchOutside = close;\n            this.mSetCloseOnTouchOutside = true;\n        }\n    }\n\n//    /** @hide */\n//    abstract\n//alwaysReadCloseOnTouchAttr():void ;\n\n    /** @hide */\n    shouldCloseOnTouch(context:Context, event:MotionEvent):boolean  {\n        if (this.mCloseOnTouchOutside && event.getAction() == MotionEvent.ACTION_DOWN && this.isOutOfBounds(context, event) && this.peekDecorView() != null) {\n            return true;\n        }\n        return false;\n    }\n\n    private isOutOfBounds(context:Context, event:MotionEvent):boolean  {\n        const x:number = Math.floor(event.getX());\n        const y:number = Math.floor(event.getY());\n        const slop:number = ViewConfiguration.get(context).getScaledWindowTouchSlop();\n        const decorView:View = this.getDecorView();\n        return (x < -slop) || (y < -slop) || (x > (decorView.getWidth() + slop)) || (y > (decorView.getHeight() + slop));\n    }\n\n    ///**\n    // * Enable extended screen features.  This must be called before\n    // * setContentView().  May be called as many times as desired as long as it\n    // * is before setContentView().  If not called, no extended features\n    // * will be available.  You can not turn off a feature once it is requested.\n    // * You canot use other title features with {@link #FEATURE_CUSTOM_TITLE}.\n    // *\n    // * @param featureId The desired features, defined as constants by Window.\n    // * @return The features that are now set.\n    // */\n    //requestFeature(featureId:number):boolean  {\n    //    const flag:number = 1 << featureId;\n    //    this.mFeatures |= flag;\n    //    this.mLocalFeatures |= this.mContainer != null ? (flag & ~this.mContainer.mFeatures) : flag;\n    //    return (this.mFeatures & flag) != 0;\n    //}\n    //\n    ///**\n    // * @hide Used internally to help resolve conflicting features.\n    // */\n    //protected removeFeature(featureId:number):void  {\n    //    const flag:number = 1 << featureId;\n    //    this.mFeatures &= ~flag;\n    //    this.mLocalFeatures &= ~(this.mContainer != null ? (flag & ~this.mContainer.mFeatures) : flag);\n    //}\n\n        makeActive():void  {\n            if (this.mContainer != null) {\n                if (this.mContainer.mActiveWindow != null) {\n                    this.mContainer.mActiveWindow.mIsActive = false;\n                }\n                this.mContainer.mActiveWindow = this;\n            }\n            this.mIsActive = true;\n            this.onActive();\n        }\n\n        isActive():boolean  {\n            return this.mIsActive;\n        }\n\n    /**\n     * Finds a view that was identified by the id attribute from the XML that\n     * was processed in {@link android.app.Activity#onCreate}.  This will\n     * implicitly call {@link #getDecorView} for you, with all of the\n     * associated side-effects.\n     *\n     * @return The view if found or null otherwise.\n     */\n    findViewById(id:string):View  {\n        return this.getDecorView().findViewById(id);\n    }\n\n    ///**\n    // * Convenience for\n    // * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)}\n    // * to set the screen content from a layout resource.  The resource will be\n    // * inflated, adding all top-level views to the screen.\n    // *\n    // * @param layoutResID Resource ID to be inflated.\n    // * @see #setContentView(View, android.view.ViewGroup.LayoutParams)\n    // */\n    // setContentView(layoutResID:number):void{\n    //\n    //}\n    //\n    ///**\n    // * Convenience for\n    // * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)}\n    // * set the screen content to an explicit view.  This view is placed\n    // * directly into the screen's view hierarchy.  It can itself be a complex\n    // * view hierarhcy.\n    // *\n    // * @param view The desired content to display.\n    // * @see #setContentView(View, android.view.ViewGroup.LayoutParams)\n    // */\n    //setContentView(view:View):void{\n    //\n    //}\n\n    /**\n     * Set the screen content to an explicit view.  This view is placed\n     * directly into the screen's view hierarchy.  It can itself be a complex\n     * view hierarchy.\n     *\n     * <p>Note that calling this function \"locks in\" various characteristics\n     * of the window that can not, from this point forward, be changed: the\n     * features that have been requested with {@link #requestFeature(int)},\n     * and certain window flags as described in {@link #setFlags(int, int)}.\n     * \n     * @param view The desired content to display.\n     * @param params Layout parameters for the view.\n     */\n    setContentView(view:View, params?:ViewGroup.LayoutParams):void{\n        this.mContentParent.removeAllViews();\n        this.addContentView(view, params);\n    }\n\n    /**\n     * Variation on\n     * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)}\n     * to add an additional content view to the screen.  Added after any existing\n     * ones in the screen -- existing views are NOT removed.\n     *\n     * @param view The desired content to display.\n     * @param params Layout parameters for the view.\n     */\n     addContentView(view:View, params:ViewGroup.LayoutParams):void{\n        if(params){\n            this.mContentParent.addView(view, params);\n        }else{\n            this.mContentParent.addView(view);\n        }\n        let cb = this.getCallback();\n        if (cb != null && !this.isDestroyed()) {\n            cb.onContentChanged();\n        }\n    }\n\n    getContentParent():ViewGroup{\n        return this.mContentParent;\n    }\n\n    /**\n     * Return the view in this Window that currently has focus, or null if\n     * there are none.  Note that this does not look in any containing\n     * Window.\n     *\n     * @return View The current View with focus or null.\n     */\n    getCurrentFocus():View{\n        return this.mDecor != null ? this.mDecor.findFocus() : null;\n    }\n\n    /**\n     * Quick access to the {@link LayoutInflater} instance that this Window\n     * retrieved from its Context.\n     *\n     * @return LayoutInflater The shared LayoutInflater.\n     */\n    getLayoutInflater():LayoutInflater{\n        return this.mContext.getLayoutInflater();\n    }\n\n    setTitle(title:string):void{\n        //TODO set title to view\n        this.mDecor.bindElement.setAttribute('title', title);\n        this.getAttributes().setTitle(title);\n    }\n\n//    abstract\n//setTitleColor(textColor:number):void ;\n//\n//    abstract\n//openPanel(featureId:number, event:KeyEvent):void ;\n//\n//    abstract\n//closePanel(featureId:number):void ;\n//\n//    abstract\n//togglePanel(featureId:number, event:KeyEvent):void ;\n//\n//    abstract\n//invalidatePanelMenu(featureId:number):void ;\n//\n//    abstract\n//performPanelShortcut(featureId:number, keyCode:number, event:KeyEvent, flags:number):boolean ;\n//\n//    abstract\n//performPanelIdentifierAction(featureId:number, id:number, flags:number):boolean ;\n//\n//    abstract\n//closeAllPanels():void ;\n//\n//    abstract\n//performContextMenuIdentifierAction(id:number, flags:number):boolean ;\n\n//    /**\n//     * Should be called when the configuration is changed.\n//     *\n//     * @param newConfig The new configuration.\n//     */\n//    abstract\n//onConfigurationChanged(newConfig:Configuration):void ;\n\n    ///**\n    // * Change the background of this window to a Drawable resource. Setting the\n    // * background to null will make the window be opaque. To make the window\n    // * transparent, you can use an empty drawable (for instance a ColorDrawable\n    // * with the color 0 or the system drawable android:drawable/empty.)\n    // *\n    // * @param resid The resource identifier of a drawable resource which will be\n    // *              installed as the new background.\n    // */\n    //setBackgroundDrawableResource(resid:number):void  {\n    //    this.setBackgroundDrawable(this.mContext.getResources().getDrawable(resid));\n    //}\n\n    /**\n     * Change the background of this window to a custom Drawable. Setting the\n     * background to null will make the window be opaque. To make the window\n     * transparent, you can use an empty drawable (for instance a ColorDrawable\n     * with the color 0 or the system drawable android:drawable/empty.)\n     *\n     * @param drawable The new Drawable to use for this window's background.\n     */\n    setBackgroundDrawable(drawable:Drawable):void{\n        if (this.mDecor != null) {\n            this.mDecor.setBackground(drawable);\n            //this.setDefaultWindowFormat(drawable.getOpacity());\n        }\n    }\n\n    setBackgroundColor(color:number):void{\n        if (this.mDecor != null) {\n            this.mDecor.setBackgroundColor(color);\n            //this.setDefaultWindowFormat(drawable.getOpacity());\n        }\n    }\n\n//    /**\n//     * Set the value for a drawable feature of this window, from a resource\n//     * identifier.  You must have called requestFeauture(featureId) before\n//     * calling this function.\n//     *\n//     * @see android.content.res.Resources#getDrawable(int)\n//     *\n//     * @param featureId The desired drawable feature to change, defined as a\n//     * constant by Window.\n//     * @param resId Resource identifier of the desired image.\n//     */\n//    abstract\n//setFeatureDrawableResource(featureId:number, resId:number):void ;\n//\n//    /**\n//     * Set the value for a drawable feature of this window, from a URI. You\n//     * must have called requestFeature(featureId) before calling this\n//     * function.\n//     *\n//     * <p>The only URI currently supported is \"content:\", specifying an image\n//     * in a content provider.\n//     *\n//     * @see android.widget.ImageView#setImageURI\n//     *\n//     * @param featureId The desired drawable feature to change. Features are\n//     * constants defined by Window.\n//     * @param uri The desired URI.\n//     */\n//    abstract\n//setFeatureDrawableUri(featureId:number, uri:Uri):void ;\n//\n//    /**\n//     * Set an explicit Drawable value for feature of this window. You must\n//     * have called requestFeature(featureId) before calling this function.\n//     *\n//     * @param featureId The desired drawable feature to change.\n//     * Features are constants defined by Window.\n//     * @param drawable A Drawable object to display.\n//     */\n//    abstract\n//setFeatureDrawable(featureId:number, drawable:Drawable):void ;\n//\n//    /**\n//     * Set a custom alpha value for the given drawale feature, controlling how\n//     * much the background is visible through it.\n//     *\n//     * @param featureId The desired drawable feature to change.\n//     * Features are constants defined by Window.\n//     * @param alpha The alpha amount, 0 is completely transparent and 255 is\n//     *              completely opaque.\n//     */\n//    abstract\n//setFeatureDrawableAlpha(featureId:number, alpha:number):void ;\n//\n//    /**\n//     * Set the integer value for a feature.  The range of the value depends on\n//     * the feature being set.  For FEATURE_PROGRESSS, it should go from 0 to\n//     * 10000. At 10000 the progress is complete and the indicator hidden.\n//     *\n//     * @param featureId The desired feature to change.\n//     * Features are constants defined by Window.\n//     * @param value The value for the feature.  The interpretation of this\n//     *              value is feature-specific.\n//     */\n//    abstract\n//setFeatureInt(featureId:number, value:number):void ;\n\n    /**\n     * Request that key events come to this activity. Use this if your\n     * activity has no views with focus, but the activity still wants\n     * a chance to process key events.\n     */\n    takeKeyEvents(_get:boolean):void{\n        this.mDecor.setFocusable(_get);\n    }\n\n    /**\n     * Used by custom windows, such as Dialog, to pass the key press event\n     * further down the view hierarchy. Application developers should\n     * not need to implement or call this.\n     *\n     */\n    superDispatchKeyEvent(event:KeyEvent):boolean{\n        return this.mDecor.superDispatchKeyEvent(event);\n    }\n\n//    /**\n//     * Used by custom windows, such as Dialog, to pass the key shortcut press event\n//     * further down the view hierarchy. Application developers should\n//     * not need to implement or call this.\n//     *\n//     */\n//    abstract\n//superDispatchKeyShortcutEvent(event:KeyEvent):boolean ;\n\n    /**\n     * Used by custom windows, such as Dialog, to pass the touch screen event\n     * further down the view hierarchy. Application developers should\n     * not need to implement or call this.\n     *\n     */\n    superDispatchTouchEvent(event:MotionEvent):boolean{\n        return this.mDecor.superDispatchTouchEvent(event);\n    }\n\n//    /**\n//     * Used by custom windows, such as Dialog, to pass the trackball event\n//     * further down the view hierarchy. Application developers should\n//     * not need to implement or call this.\n//     *\n//     */\n//    abstract\n//superDispatchTrackballEvent(event:MotionEvent):boolean ;\n\n    /**\n     * Used by custom windows, such as Dialog, to pass the generic motion event\n     * further down the view hierarchy. Application developers should\n     * not need to implement or call this.\n     *\n     */\n    superDispatchGenericMotionEvent(event:MotionEvent):boolean{\n        return this.mDecor.superDispatchGenericMotionEvent(event);\n    }\n\n    /**\n     * Retrieve the top-level window decor view (containing the standard\n     * window frame/decorations and the client's content inside of that), which\n     * can be added as a window to the window manager.\n     * \n     * <p><em>Note that calling this function for the first time \"locks in\"\n     * various window characteristics as described in\n     * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)}.</em></p>\n     * \n     * @return Returns the top-level window decor view.\n     */\n    getDecorView():View{\n        return this.mDecor;\n    }\n\n    /**\n     * Retrieve the current decor view, but only if it has already been created;\n     * otherwise returns null.\n     * \n     * @return Returns the top-level window decor or null.\n     * @see #getDecorView\n     */\n    peekDecorView():View{\n        return this.mDecor;\n    }\n\n        //TODO androidui: save state\n//    abstract\n//saveHierarchyState():Bundle ;\n//\n//    abstract\n//restoreHierarchyState(savedInstanceState:Bundle):void//\n\n    protected onActive():void {\n    }\n\n    ///**\n    // * Return the feature bits that are enabled.  This is the set of features\n    // * that were given to requestFeature(), and are being handled by this\n    // * Window itself or its container.  That is, it is the set of\n    // * requested features that you can actually use.\n    // *\n    // * <p>To do: add a public version of this API that allows you to check for\n    // * features by their feature ID.\n    // *\n    // * @return int The feature bits.\n    // */\n    //protected getFeatures():number  {\n    //    return this.mFeatures;\n    //}\n    //\n    ///**\n    // * Query for the availability of a certain feature.\n    // *\n    // * @param feature The feature ID to check\n    // * @return true if the feature is enabled, false otherwise.\n    // */\n    //hasFeature(feature:number):boolean  {\n    //    return (this.getFeatures() & (1 << feature)) != 0;\n    //}\n    //\n    ///**\n    // * Return the feature bits that are being implemented by this Window.\n    // * This is the set of features that were given to requestFeature(), and are\n    // * being handled by only this Window itself, not by its containers.\n    // *\n    // * @return int The feature bits.\n    // */\n    //protected getLocalFeatures():number  {\n    //    return this.mLocalFeatures;\n    //}\n    //\n    ///**\n    // * Set the default format of window, as per the PixelFormat types.  This\n    // * is the format that will be used unless the client specifies in explicit\n    // * format with setFormat();\n    // *\n    // * @param format The new window format (see PixelFormat).\n    // *\n    // * @see #setFormat\n    // * @see PixelFormat\n    // */\n    //protected setDefaultWindowFormat(format:number):void  {\n    //    this.mDefaultWindowFormat = format;\n    //    if (!this.mHaveWindowFormat) {\n    //        const attrs:WindowManager.LayoutParams = this.getAttributes();\n    //        attrs.format = format;\n    //        if (this.mCallback != null) {\n    //            this.mCallback.onWindowAttributesChanged(attrs);\n    //        }\n    //    }\n    //}\n    //\n    ///** @hide */\n    //protected haveDimAmount():boolean  {\n    //    return this.mHaveDimAmount;\n    //}\n\n//    abstract\n//setChildDrawable(featureId:number, drawable:Drawable):void ;\n//\n//    abstract\n//setChildInt(featureId:number, value:number):void ;\n//\n//    /**\n//     * Is a keypress one of the defined shortcut keys for this window.\n//     * @param keyCode the key code from {@link android.view.KeyEvent} to check.\n//     * @param event the {@link android.view.KeyEvent} to use to help check.\n//     */\n//    abstract\n//isShortcutKey(keyCode:number, event:KeyEvent):boolean ;\n//\n//    /**\n//     * @see android.app.Activity#setVolumeControlStream(int)\n//     */\n//    abstract\n//setVolumeControlStream(streamType:number):void ;\n//\n//    /**\n//     * @see android.app.Activity#getVolumeControlStream()\n//     */\n//    abstract\n//getVolumeControlStream():number ;\n//\n//    /**\n//     * Set extra options that will influence the UI for this window.\n//     * @param uiOptions Flags specifying extra options for this window.\n//     */\n//    setUiOptions(uiOptions:number):void  {\n//    }\n//\n//    /**\n//     * Set extra options that will influence the UI for this window.\n//     * Only the bits filtered by mask will be modified.\n//     * @param uiOptions Flags specifying extra options for this window.\n//     * @param mask Flags specifying which options should be modified. Others will remain unchanged.\n//     */\n//    setUiOptions(uiOptions:number, mask:number):void  {\n//    }\n//\n//    /**\n//     * Set the primary icon for this window.\n//     *\n//     * @param resId resource ID of a drawable to set\n//     */\n//    setIcon(resId:number):void  {\n//    }\n//\n//    /**\n//     * Set the default icon for this window.\n//     * This will be overridden by any other icon set operation which could come from the\n//     * theme or another explicit set.\n//     *\n//     * @hide\n//     */\n//    setDefaultIcon(resId:number):void  {\n//    }\n//\n//    /**\n//     * Set the logo for this window. A logo is often shown in place of an\n//     * {@link #setIcon(int) icon} but is generally wider and communicates window title information\n//     * as well.\n//     *\n//     * @param resId resource ID of a drawable to set\n//     */\n//    setLogo(resId:number):void  {\n//    }\n//\n//    /**\n//     * Set the default logo for this window.\n//     * This will be overridden by any other logo set operation which could come from the\n//     * theme or another explicit set.\n//     *\n//     * @hide\n//     */\n//    setDefaultLogo(resId:number):void  {\n//    }\n//\n    ///**\n    // * Set focus locally. The window should have the\n    // * {@link WindowManager.LayoutParams#FLAG_LOCAL_FOCUS_MODE} flag set already.\n    // * @param hasFocus Whether this window has focus or not.\n    // * @param inTouchMode Whether this window is in touch mode or not.\n    // */\n    //setLocalFocus(hasFocus:boolean, inTouchMode:boolean):void {\n    //}\n    //\n    ///**\n    // * Inject an event to window locally.\n    // * @param event A key or touch event to inject to this window.\n    // */\n    //injectInputEvent(event:MotionEvent|KeyEvent):void {\n    //}\n}\n\nexport module Window{\n/**\n     * API from a Window back to its caller.  This allows the client to\n     * intercept key dispatching, panels and menus, etc.\n     */\nexport interface Callback {\n\n    /**\n         * Called to process key events.  At the very least your\n         * implementation must call\n         * {@link android.view.Window#superDispatchKeyEvent} to do the\n         * standard key processing.\n         *\n         * @param event The key event.\n         *\n         * @return boolean Return true if this event was consumed.\n         */\n    dispatchKeyEvent(event:KeyEvent):boolean ;\n\n    ///**\n    //     * Called to process a key shortcut event.\n    //     * At the very least your implementation must call\n    //     * {@link android.view.Window#superDispatchKeyShortcutEvent} to do the\n    //     * standard key shortcut processing.\n    //     *\n    //     * @param event The key shortcut event.\n    //     * @return True if this event was consumed.\n    //     */\n    //dispatchKeyShortcutEvent(event:KeyEvent):boolean ;\n\n    /**\n         * Called to process touch screen events.  At the very least your\n         * implementation must call\n         * {@link android.view.Window#superDispatchTouchEvent} to do the\n         * standard touch screen processing.\n         *\n         * @param event The touch screen event.\n         *\n         * @return boolean Return true if this event was consumed.\n         */\n    dispatchTouchEvent(event:MotionEvent):boolean ;\n\n    ///**\n    //     * Called to process trackball events.  At the very least your\n    //     * implementation must call\n    //     * {@link android.view.Window#superDispatchTrackballEvent} to do the\n    //     * standard trackball processing.\n    //     *\n    //     * @param event The trackball event.\n    //     *\n    //     * @return boolean Return true if this event was consumed.\n    //     */\n    //dispatchTrackballEvent(event:MotionEvent):boolean ;\n\n    /**\n         * Called to process generic motion events.  At the very least your\n         * implementation must call\n         * {@link android.view.Window#superDispatchGenericMotionEvent} to do the\n         * standard processing.\n         *\n         * @param event The generic motion event.\n         *\n         * @return boolean Return true if this event was consumed.\n         */\n    dispatchGenericMotionEvent(event:MotionEvent):boolean ;\n\n    ///**\n    //     * Called to process population of {@link AccessibilityEvent}s.\n    //     *\n    //     * @param event The event.\n    //     *\n    //     * @return boolean Return true if event population was completed.\n    //     */\n    //dispatchPopulateAccessibilityEvent(event:AccessibilityEvent):boolean ;\n    //\n    ///**\n    //     * Instantiate the view to display in the panel for 'featureId'.\n    //     * You can return null, in which case the default content (typically\n    //     * a menu) will be created for you.\n    //     *\n    //     * @param featureId Which panel is being created.\n    //     *\n    //     * @return view The top-level view to place in the panel.\n    //     *\n    //     * @see #onPreparePanel\n    //     */\n    //onCreatePanelView(featureId:number):View ;\n    //\n    ///**\n    //     * Initialize the contents of the menu for panel 'featureId'.  This is\n    //     * called if onCreatePanelView() returns null, giving you a standard\n    //     * menu in which you can place your items.  It is only called once for\n    //     * the panel, the first time it is shown.\n    //     *\n    //     * <p>You can safely hold on to <var>menu</var> (and any items created\n    //     * from it), making modifications to it as desired, until the next\n    //     * time onCreatePanelMenu() is called for this feature.\n    //     *\n    //     * @param featureId The panel being created.\n    //     * @param menu The menu inside the panel.\n    //     *\n    //     * @return boolean You must return true for the panel to be displayed;\n    //     *         if you return false it will not be shown.\n    //     */\n    //onCreatePanelMenu(featureId:number, menu:Menu):boolean ;\n    //\n    ///**\n    //     * Prepare a panel to be displayed.  This is called right before the\n    //     * panel window is shown, every time it is shown.\n    //     *\n    //     * @param featureId The panel that is being displayed.\n    //     * @param view The View that was returned by onCreatePanelView().\n    //     * @param menu If onCreatePanelView() returned null, this is the Menu\n    //     *             being displayed in the panel.\n    //     *\n    //     * @return boolean You must return true for the panel to be displayed;\n    //     *         if you return false it will not be shown.\n    //     *\n    //     * @see #onCreatePanelView\n    //     */\n    //onPreparePanel(featureId:number, view:View, menu:Menu):boolean ;\n    //\n    ///**\n    //     * Called when a panel's menu is opened by the user. This may also be\n    //     * called when the menu is changing from one type to another (for\n    //     * example, from the icon menu to the expanded menu).\n    //     *\n    //     * @param featureId The panel that the menu is in.\n    //     * @param menu The menu that is opened.\n    //     * @return Return true to allow the menu to open, or false to prevent\n    //     *         the menu from opening.\n    //     */\n    //onMenuOpened(featureId:number, menu:Menu):boolean ;\n    //\n    ///**\n    //     * Called when a panel's menu item has been selected by the user.\n    //     *\n    //     * @param featureId The panel that the menu is in.\n    //     * @param item The menu item that was selected.\n    //     *\n    //     * @return boolean Return true to finish processing of selection, or\n    //     *         false to perform the normal menu handling (calling its\n    //     *         Runnable or sending a Message to its target Handler).\n    //     */\n    //onMenuItemSelected(featureId:number, item:MenuItem):boolean ;\n\n    /**\n         * This is called whenever the current window attributes change.\n         *\n         */\n    onWindowAttributesChanged(attrs:WindowManager.LayoutParams):void ;\n\n    /**\n         * This hook is called whenever the content view of the screen changes\n         * (due to a call to\n         * {@link Window#setContentView(View, android.view.ViewGroup.LayoutParams)\n         * Window.setContentView} or\n         * {@link Window#addContentView(View, android.view.ViewGroup.LayoutParams)\n         * Window.addContentView}).\n         */\n    onContentChanged():void ;\n\n    /**\n         * This hook is called whenever the window focus changes.  See\n         * {@link View#onWindowFocusChanged(boolean)\n         * View.onWindowFocusChanged(boolean)} for more information.\n         *\n         * @param hasFocus Whether the window now has focus.\n         */\n    onWindowFocusChanged(hasFocus:boolean):void ;\n\n    /**\n         * Called when the window has been attached to the window manager.\n         * See {@link View#onAttachedToWindow() View.onAttachedToWindow()}\n         * for more information.\n         */\n    onAttachedToWindow():void ;\n\n    /**\n         * Called when the window has been attached to the window manager.\n         * See {@link View#onDetachedFromWindow() View.onDetachedFromWindow()}\n         * for more information.\n         */\n    onDetachedFromWindow():void ;\n\n    ///**\n    //     * Called when a panel is being closed.  If another logical subsequent\n    //     * panel is being opened (and this panel is being closed to make room for the subsequent\n    //     * panel), this method will NOT be called.\n    //     *\n    //     * @param featureId The panel that is being displayed.\n    //     * @param menu If onCreatePanelView() returned null, this is the Menu\n    //     *            being displayed in the panel.\n    //     */\n    //onPanelClosed(featureId:number, menu:Menu):void ;\n    //\n    ///**\n    //     * Called when the user signals the desire to start a search.\n    //     *\n    //     * @return true if search launched, false if activity refuses (blocks)\n    //     *\n    //     * @see android.app.Activity#onSearchRequested()\n    //     */\n    //onSearchRequested():boolean ;\n\n    ///**\n    //     * Called when an action mode is being started for this window. Gives the\n    //     * callback an opportunity to handle the action mode in its own unique and\n    //     * beautiful way. If this method returns null the system can choose a way\n    //     * to present the mode or choose not to start the mode at all.\n    //     *\n    //     * @param callback Callback to control the lifecycle of this action mode\n    //     * @return The ActionMode that was started, or null if the system should present it\n    //     */\n    //onWindowStartingActionMode(callback:ActionMode.Callback):ActionMode;\n    //\n    ///**\n    //     * Called when an action mode has been started. The appropriate mode callback\n    //     * method will have already been invoked.\n    //     *\n    //     * @param mode The new mode that has just been started.\n    //     */\n    //onActionModeStarted(mode:ActionMode):void;\n    //\n    ///**\n    //     * Called when an action mode has been finished. The appropriate mode callback\n    //     * method will have already been invoked.\n    //     *\n    //     * @param mode The mode that was just finished.\n    //     */\n    //onActionModeFinished(mode:ActionMode):void;\n}\n}\n\n    class DecorView extends FrameLayout {\n        Window_this : Window;\n        private _ignoreRequestLayoutInAnimation = true;\n        private _pendingRequestLayoutOnAnimationEnd = false;\n        private _ignoreInvalidateInAnimation = true;\n        private _pendingInvalidateOnAnimationEnd = false;\n\n        constructor(window:android.view.Window) {\n            super(window.mContext);\n            this.Window_this = window;\n            this.bindElement.classList.add(window.mContext.constructor.name);\n            this.setBackgroundColor(android.graphics.Color.WHITE);//default window bg\n            this.setIsRootNamespace(true);//window's decor view is root.\n        }\n\n        invalidate();\n        invalidate(invalidateCache:boolean);\n        invalidate(dirty:android.graphics.Rect);\n        invalidate(l:number, t:number, r:number, b:number);\n        invalidate(...args){\n            if (this._ignoreInvalidateInAnimation && this.getAnimation()) {\n                this._pendingInvalidateOnAnimationEnd = true;\n                return null;\n            }\n            super.invalidate.call(this, ...args);\n        }\n\n        invalidateChild(child:android.view.View, dirty:android.graphics.Rect):void {\n            if (this._ignoreInvalidateInAnimation && this.getAnimation()) {\n                this._pendingInvalidateOnAnimationEnd = true;\n                return null;\n            }\n            super.invalidateChild(child, dirty);\n        }\n\n        invalidateChildFast(child:android.view.View, dirty:android.graphics.Rect):void {\n            if (this._ignoreInvalidateInAnimation && this.getAnimation()) {\n                this._pendingInvalidateOnAnimationEnd = true;\n                return null;\n            }\n            super.invalidateChildFast(child, dirty);\n        }\n\n        requestLayout():void {\n            if (this._ignoreRequestLayoutInAnimation && this.getAnimation()) {\n                this._pendingRequestLayoutOnAnimationEnd = true;\n                return null;\n            }\n            super.requestLayout();\n        }\n\n        protected onAnimationStart():void {\n            super.onAnimationStart();\n            this.setDrawingCacheEnabled(true);\n            this.buildDrawingCache(true);\n        }\n\n        protected onAnimationEnd():void {\n            super.onAnimationEnd();\n            this.setDrawingCacheEnabled(false);\n            if (this._pendingInvalidateOnAnimationEnd) {\n                this._pendingInvalidateOnAnimationEnd = false;\n                this.invalidate();\n            }\n            if (this._pendingRequestLayoutOnAnimationEnd) {\n                this._pendingRequestLayoutOnAnimationEnd = false;\n                this.requestLayout();\n            }\n        }\n\n        buildDrawingCache(autoScale:boolean = false):void {\n            if (this.getAnimation() && this.mUnscaledDrawingCache) return; // force keep cache when animation\n            super.buildDrawingCache(autoScale);\n        }\n\n        protected drawFromParent(canvas:android.graphics.Canvas, parent:ViewGroup, drawingTime:number):boolean {\n            //draw shadow when window enter/exit\n            let windowAnimation = this.getAnimation();\n\n            let wparams = <WindowManager.LayoutParams>this.getLayoutParams();\n            let shadowAlpha:number = wparams.dimAmount * 255;//default full shadow\n            if(windowAnimation!=null && shadowAlpha){\n\n                const duration:number = windowAnimation.getDuration();\n                let startTime:number = windowAnimation.getStartTime();\n                if(startTime<0) startTime = drawingTime;\n                let startOffset:number = windowAnimation.getStartOffset();\n\n                let normalizedTime:number;\n                if (duration != 0) {\n                    normalizedTime = (<number> (drawingTime - (startTime + startOffset))) / <number> duration;\n                    normalizedTime = Math.max(Math.min(normalizedTime, 1.0), 0.0);\n                } else {\n                    // time is a step-change with a zero duration\n                    normalizedTime = drawingTime < startTime ? 0.0 : 1.0;\n                }\n                const interpolatedTime:number = windowAnimation.getInterpolator().getInterpolation(normalizedTime);\n\n                if(windowAnimation === wparams.exitAnimation){\n                    shadowAlpha = shadowAlpha * (1-interpolatedTime);\n                    if(!windowAnimation.hasEnded()) parent.invalidate();//shadow on parent (should ignore dirty draw child)\n\n                }else if(windowAnimation === wparams.enterAnimation){\n                    shadowAlpha = shadowAlpha * interpolatedTime;\n                    if(!windowAnimation.hasEnded()) parent.invalidate();//shadow on parent (should ignore dirty draw child)\n                }\n            }\n            if( (windowAnimation!=null || wparams.isFloating()) && shadowAlpha){\n                canvas.drawColor(android.graphics.Color.argb(shadowAlpha, 0, 0, 0));\n            }\n\n            return super.drawFromParent(canvas, parent, drawingTime);\n        }\n\n        tagName():string {\n            return 'Window';\n        }\n\n        dispatchKeyEvent(event:android.view.KeyEvent):boolean {\n\n            //dialog hold on this window's windowManager, dispatch to it first\n            const count:number = this.getChildCount();\n            for (let i:number = count-1; i >=0; i--) {\n                let child = this.getChildAt(i);\n                if(child instanceof WindowManager.Layout && child.dispatchKeyEvent(event)){\n                    return true;\n                }\n            }\n\n            //const keyCode = event.getKeyCode();\n            const action = event.getAction();\n            //const isDown = action == KeyEvent.ACTION_DOWN;\n            if (!this.Window_this.isDestroyed()) {\n                const cb = this.Window_this.getCallback();\n                const handled = cb != null /*&& mFeatureId < 0*/ ? cb.dispatchKeyEvent(event) : super.dispatchKeyEvent(event);\n                if (handled) {\n                    return true;\n                }\n            }\n            return super.dispatchKeyEvent(event);\n        }\n\n        dispatchTouchEvent(ev:android.view.MotionEvent):boolean {\n            let wparams = <WindowManager.LayoutParams>this.getLayoutParams();\n\n            const cb = this.Window_this.getCallback();\n            let outside = this.Window_this.isOutOfBounds(this.getContext(), ev);\n\n            if(outside && !wparams.isTouchModal()){\n                if(wparams.isWatchTouchOutside() && ev.getAction() == android.view.MotionEvent.ACTION_DOWN){\n                    //send a outside event\n                    let action = ev.getAction();\n                    ev.setAction(android.view.MotionEvent.ACTION_OUTSIDE);\n                    if(cb != null && !this.Window_this.isDestroyed() /*&& mFeatureId < 0*/){\n                        cb.dispatchTouchEvent(ev)\n                    }else{\n                        super.dispatchTouchEvent(ev)\n                    }\n                    ev.setAction(action);\n                }\n                return false;\n            }\n\n            cb != null && !this.Window_this.isDestroyed() /*&& mFeatureId < 0*/ ? cb.dispatchTouchEvent(ev) : super.dispatchTouchEvent(ev);\n            return true;\n        }\n\n        dispatchGenericMotionEvent(ev:android.view.MotionEvent):boolean {\n            const cb = this.Window_this.getCallback();\n            return cb != null && !this.Window_this.isDestroyed() /*&& mFeatureId < 0*/ ? cb.dispatchGenericMotionEvent(ev) : super.dispatchGenericMotionEvent(ev);\n        }\n\n        superDispatchKeyEvent(event:KeyEvent):boolean {\n            return super.dispatchKeyEvent(event);\n        }\n\n        superDispatchTouchEvent(event:MotionEvent):boolean {\n            return super.dispatchTouchEvent(event);\n        }\n\n        superDispatchGenericMotionEvent(event:MotionEvent):boolean {\n            return super.dispatchGenericMotionEvent(event);\n        }\n\n        onTouchEvent(event:MotionEvent):boolean {//TODO remove?\n            return this.onInterceptTouchEvent(event);\n        }\n\n        protected onVisibilityChanged(changedView:android.view.View, visibility:number) {\n            this.Window_this.mAttachInfo.mWindowVisibility = visibility;\n            this.dispatchWindowVisibilityChanged(visibility);\n\n            super.onVisibilityChanged(changedView, visibility);\n        }\n\n        onWindowFocusChanged(hasWindowFocus:boolean):void {\n            this.Window_this.mAttachInfo.mHasWindowFocus = hasWindowFocus;\n\n            super.onWindowFocusChanged(hasWindowFocus);\n            const cb = this.Window_this.getCallback();\n            if (cb != null && !this.Window_this.isDestroyed()){// && mFeatureId < 0) {\n                cb.onWindowFocusChanged(hasWindowFocus);\n            }\n\n        }\n\n        protected onAttachedToWindow():void {\n            this.Window_this.mAttachInfo.mWindowVisibility = this.getVisibility();\n\n            super.onAttachedToWindow();\n\n            const cb = this.Window_this.getCallback();\n            if (cb != null && !this.Window_this.isDestroyed()){// && mFeatureId < 0) {\n                cb.onAttachedToWindow();\n            }\n        }\n\n        protected onDetachedFromWindow():void {\n            super.onDetachedFromWindow();\n\n            const cb = this.Window_this.getCallback();\n            if (cb != null && !this.Window_this.isDestroyed()){// && mFeatureId < 0) {\n                cb.onDetachedFromWindow();\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "src/android/view/WindowManager.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/view/Window.ts\"/>\n///<reference path=\"../../android/widget/FrameLayout.ts\"/>\n///<reference path=\"../../android/graphics/PixelFormat.ts\"/>\n///<reference path=\"../../android/text/TextUtils.ts\"/>\n///<reference path=\"../../android/util/Log.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../java/lang/StringBuilder.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n///<reference path=\"../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../android/view/animation/Animation.ts\"/>\n\nmodule android.view {\nimport PixelFormat = android.graphics.PixelFormat;\nimport TextUtils = android.text.TextUtils;\nimport Log = android.util.Log;\nimport Integer = java.lang.Integer;\nimport StringBuilder = java.lang.StringBuilder;\nimport Gravity = android.view.Gravity;\nimport KeyEvent = android.view.KeyEvent;\nimport MotionEvent = android.view.MotionEvent;\nimport View = android.view.View;\nimport ViewGroup = android.view.ViewGroup;\nimport Window = android.view.Window;\nimport Context = android.content.Context;\nimport Animation = android.view.animation.Animation;\n\n/**\n * The interface that apps use to talk to the window manager.\n * <p>\n * Use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code> to get one of these.\n * </p><p>\n * Each window manager instance is bound to a particular {@link Display}.\n * To obtain a {@link WindowManager} for a different display, use\n * {@link Context#createDisplayContext} to obtain a {@link Context} for that\n * display, then use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code>\n * to get the WindowManager.\n * </p><p>\n * The simplest way to show a window on another display is to create a\n * {@link Presentation}.  The presentation will automatically obtain a\n * {@link WindowManager} and {@link Context} for that display.\n * </p>\n *\n * @see android.content.Context#getSystemService\n * @see android.content.Context#WINDOW_SERVICE\n */\nexport class WindowManager {\n    private mWindowsLayout:WindowManager.Layout;\n    protected mActiveWindow:Window;\n\n    private static FocusViewRemember = Symbol();\n\n    constructor(context:Context) {\n        this.mWindowsLayout = new WindowManager.Layout(context, this);\n        let viewRootImpl = context.androidUI._viewRootImpl;\n        let fakeAttachInfo = new View.AttachInfo(viewRootImpl, viewRootImpl.mHandler);\n        fakeAttachInfo.mRootView = this.mWindowsLayout;\n        this.mWindowsLayout.dispatchAttachedToWindow(fakeAttachInfo, 0);\n        this.mWindowsLayout.mGroupFlags |= ViewGroup.FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW; // make attachInfo not handle when addWindow\n        this.mWindowsLayout.mGroupFlags |= ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE; // activity animation should use cache\n    }\n\n    getWindowsLayout():ViewGroup {\n        return this.mWindowsLayout;\n    }\n\n    addWindow(window:Window):void{\n        let wparams = window.getAttributes();\n        if(!wparams){\n            wparams = new WindowManager.LayoutParams();\n        }\n        if(!(wparams instanceof WindowManager.LayoutParams)){\n            throw Error('can\\'t addWindow, params must be WindowManager.LayoutParams : '+wparams);\n        }\n\n        window.setContainer(this);\n        let decorView = window.getDecorView();\n\n\n        //TODO use type as z-index\n        let type = wparams.type;\n        let lastFocusWindowView = this.mWindowsLayout.getTopFocusableWindowView();\n        this.mWindowsLayout.addView(decorView, wparams);\n\n        decorView.dispatchAttachedToWindow(window.mAttachInfo, 0);\n        //window.mAttachInfo.mTreeObserver.dispatchOnWindowAttachedChange(true);\n\n        if(wparams.isFocusable()){\n            decorView.dispatchWindowFocusChanged(true);\n\n            //clearLastWindowFocus\n            if(lastFocusWindowView && lastFocusWindowView.hasFocus()){\n                const focused = lastFocusWindowView.findFocus();\n                lastFocusWindowView[WindowManager.FocusViewRemember] = focused;\n                if (focused != null) {\n                    focused.clearFocusInternal(true, false);\n                }\n                lastFocusWindowView.dispatchWindowFocusChanged(false);\n\n                //new window should be focused\n                decorView.addOnLayoutChangeListener({\n                    onLayoutChange(v:View, left:number , top:number , right:number , bottom:number,\n                                   oldLeft:number , oldTop:number , oldRight:number , oldBottom:number){\n                        decorView.removeOnLayoutChangeListener(this);\n\n                        const newWindowFocused = FocusFinder.getInstance().findNextFocus(<ViewGroup>decorView, null, View.FOCUS_DOWN);\n                        if (newWindowFocused != null) {\n                            newWindowFocused.requestFocus(View.FOCUS_DOWN);\n                        }\n                    }\n                });\n            }\n        }\n        if(decorView instanceof ViewGroup){\n            decorView.setMotionEventSplittingEnabled(wparams.isSplitTouch());\n        }\n\n        let enterAnimation = window.getContext().androidUI.mActivityThread.getOverrideEnterAnimation();\n        if(enterAnimation === undefined) enterAnimation = wparams.enterAnimation;\n        if(enterAnimation) {\n            decorView.bindElement.style.visibility = 'hidden';\n            enterAnimation.setAnimationListener({\n                onAnimationStart(animation: Animation): void {\n                },\n                onAnimationEnd(animation: Animation): void {\n                    decorView.bindElement.style.visibility = '';\n                },\n                onAnimationRepeat(animation: Animation): void {\n                }\n            });\n            decorView.startAnimation(enterAnimation);\n        }\n    }\n\n    updateWindowLayout(window:Window, params:ViewGroup.LayoutParams):void{\n        if(!(params instanceof WindowManager.LayoutParams)){\n            throw Error('can\\'t updateWindowLayout, params must be WindowManager.LayoutParams');\n        }\n        window.getDecorView().setLayoutParams(params);\n    }\n\n    removeWindow(window:Window):void{\n        let decor = window.getDecorView();\n        if(decor.getParent()==null) return;//not add\n        if(decor.getParent() !== this.mWindowsLayout){\n            console.error('removeWindow fail, don\\'t has the window, decor belong to ', decor.getParent());\n            return;\n        }\n        let wparams = <WindowManager.LayoutParams>decor.getLayoutParams();\n        let exitAnimation = window.getContext().androidUI.mActivityThread.getOverrideExitAnimation();\n        if(exitAnimation === undefined) exitAnimation = wparams.exitAnimation;\n        if(exitAnimation){\n            let t = this;\n            decor.startAnimation(exitAnimation);\n            decor.drawAnimation(this.mWindowsLayout, android.os.SystemClock.uptimeMillis(), exitAnimation);//init animation\n            this.mWindowsLayout.removeView(decor);\n        }else{\n            this.mWindowsLayout.removeView(decor);\n        }\n        \n        if(wparams.isFocusable()) {\n            let resumeWindowView = this.mWindowsLayout.getTopFocusableWindowView();\n            if (resumeWindowView) {\n                resumeWindowView.dispatchWindowFocusChanged(true);\n                let resumeFocus = resumeWindowView[WindowManager.FocusViewRemember];\n                if(resumeFocus){\n                    resumeFocus.requestFocus(View.FOCUS_DOWN);\n                }\n            }\n        }\n    }\n}\n\nexport module WindowManager{\n\n    /**\n     * children ara windows decor view\n     */\n    export class Layout extends android.widget.FrameLayout {\n        private mWindowManager:WindowManager;\n\n        constructor(context:android.content.Context, windowManager:WindowManager) {\n            super(context);\n            this.mWindowManager = windowManager;\n        }\n        \n\n        getTopFocusableWindowView(findParent=true):ViewGroup {\n            const count:number = this.getChildCount();\n            for (let i:number = count-1; i >=0; i--) {\n                let child = this.getChildAt(i);\n                let wparams = <WindowManager.LayoutParams>child.getLayoutParams();\n                if(wparams.isFocusable()){\n                    return <ViewGroup>child;\n                }\n            }\n\n            if(findParent){\n                let decor = this.getParent();\n                if(decor!=null){\n                    let windowLayout = decor.getParent();\n                    if(windowLayout instanceof Layout){\n                        return windowLayout.getTopFocusableWindowView();\n                    }\n                }\n            }\n        }\n\n        dispatchKeyEvent(event:android.view.KeyEvent):boolean {\n            let topFocusView = this.getTopFocusableWindowView(false);\n            if(topFocusView && topFocusView.dispatchKeyEvent(event)){\n                return true;\n            }\n            return super.dispatchKeyEvent(event);\n        }\n\n        protected isTransformedTouchPointInView(x:number, y:number, child:android.view.View, outLocalPoint:android.graphics.Point):boolean {\n            let wparams = <WindowManager.LayoutParams>child.getLayoutParams();\n            if(wparams.isFocusable() && wparams.isTouchable()){\n                //handle touch to window\n                return true;\n            }\n            return false;//super.isTransformedTouchPointInView(x, y, child, outLocalPoint);\n        }\n\n        onChildVisibilityChanged(child:android.view.View, oldVisibility:number, newVisibility:number):void {\n            super.onChildVisibilityChanged(child, oldVisibility, newVisibility);\n\n            let wparams = <WindowManager.LayoutParams>child.getLayoutParams();\n            if(newVisibility === View.VISIBLE){\n                let resumeAnimation = child.getContext().androidUI.mActivityThread.getOverrideResumeAnimation();\n                if(resumeAnimation === undefined) resumeAnimation = wparams.resumeAnimation;\n                if(resumeAnimation){\n                    child.startAnimation(resumeAnimation);\n                }\n            }else{\n                let hideAnimation = child.getContext().androidUI.mActivityThread.getOverrideHideAnimation();\n                if(hideAnimation === undefined) hideAnimation = wparams.hideAnimation;\n                if(hideAnimation){\n                    child.startAnimation(hideAnimation);\n                    child.drawAnimation(this, android.os.SystemClock.uptimeMillis(), hideAnimation);//init animation\n                }\n            }\n        }\n\n        protected onLayout(changed: boolean, left: number, top: number, right: number, bottom: number): void {\n            this.layoutChildren(left, top, right, bottom, false /* no force left gravity */);\n        }\n\n        layoutChildren(left: number, top: number, right: number, bottom: number, forceLeftGravity: boolean): void {\n            const count = this.getChildCount();\n\n            const parentLeft = this.getPaddingLeftWithForeground();\n            const parentRight = right - left - this.getPaddingRightWithForeground();\n\n            const parentTop = this.getPaddingTopWithForeground();\n            const parentBottom = bottom - top - this.getPaddingBottomWithForeground();\n\n            this.mForegroundBoundsChanged = true;\n\n            for (let i = 0; i < count; i++) {\n                let child = this.getChildAt(i);\n                if (child.getVisibility() != View.GONE) {\n                    const lp = <WindowManager.LayoutParams> child.getLayoutParams();\n\n                    const width = child.getMeasuredWidth();\n                    const height = child.getMeasuredHeight();\n\n                    let childLeft;\n                    let childTop;\n\n                    let gravity = lp.gravity;\n                    if (gravity == -1) {\n                        gravity = Layout.DEFAULT_CHILD_GRAVITY;\n                    }\n\n                    //const layoutDirection = getLayoutDirection();\n                    const absoluteGravity = gravity;//Gravity.getAbsoluteGravity(gravity, layoutDirection);\n                    const verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK;\n\n                    switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n                        case Gravity.CENTER_HORIZONTAL:\n                            childLeft = parentLeft + (parentRight - parentLeft - width) / 2 + lp.leftMargin - lp.rightMargin;\n                            break;\n                        case Gravity.RIGHT:\n                            if (!forceLeftGravity) {\n                                childLeft = parentRight - width - lp.rightMargin - lp.x;\n                                break;\n                            }\n                        case Gravity.LEFT:\n                        default:\n                            childLeft = parentLeft + lp.leftMargin + lp.x;\n                    }\n\n                    switch (verticalGravity) {\n                        case Gravity.TOP:\n                            childTop = parentTop + lp.topMargin + lp.y;\n                            break;\n                        case Gravity.CENTER_VERTICAL:\n                            childTop = parentTop + (parentBottom - parentTop - height) / 2 + lp.topMargin - lp.bottomMargin;\n                            break;\n                        case Gravity.BOTTOM:\n                            childTop = parentBottom - height - lp.bottomMargin - lp.y;\n                            break;\n                        default:\n                            childTop = parentTop + lp.topMargin;\n                    }\n\n                    child.layout(childLeft, childTop, childLeft + width, childTop + height);\n                }\n            }\n        }\n\n        tagName():string {\n            return 'windowsGroup';\n        }\n    }\n\n\nexport class LayoutParams extends android.widget.FrameLayout.LayoutParams {\n\n    /**\n         * X position for this window.  With the default gravity it is ignored.\n         * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or\n         * {@link Gravity#END} it provides an offset from the given edge.\n         */\n    x:number = 0;\n\n    /**\n         * Y position for this window.  With the default gravity it is ignored.\n         * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides\n         * an offset from the given edge.\n         */\n    y:number = 0;\n\n    ///**\n    //     * Indicates how much of the extra space will be allocated horizontally\n    //     * to the view associated with these LayoutParams. Specify 0 if the view\n    //     * should not be stretched. Otherwise the extra pixels will be pro-rated\n    //     * among all views whose weight is greater than 0.\n    //     */\n    //horizontalWeight:number = 0;\n    //\n    ///**\n    //     * Indicates how much of the extra space will be allocated vertically\n    //     * to the view associated with these LayoutParams. Specify 0 if the view\n    //     * should not be stretched. Otherwise the extra pixels will be pro-rated\n    //     * among all views whose weight is greater than 0.\n    //     */\n    //verticalWeight:number = 0;\n\n    /**\n         * The general type of window.  There are three main classes of\n         * window types:\n         * <ul>\n         * <li> <strong>Application windows</strong> (ranging from\n         * {@link #FIRST_APPLICATION_WINDOW} to\n         * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application\n         * windows.  For these types of windows, the {@link #token} must be\n         * set to the token of the activity they are a part of (this will\n         * normally be done for you if {@link #token} is null).\n         * <li> <strong>Sub-windows</strong> (ranging from\n         * {@link #FIRST_SUB_WINDOW} to\n         * {@link #LAST_SUB_WINDOW}) are associated with another top-level\n         * window.  For these types of windows, the {@link #token} must be\n         * the token of the window it is attached to.\n         * <li> <strong>System windows</strong> (ranging from\n         * {@link #FIRST_SYSTEM_WINDOW} to\n         * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for\n         * use by the system for specific purposes.  They should not normally\n         * be used by applications, and a special permission is required\n         * to use them.\n         * </ul>\n         * \n         * @see #TYPE_BASE_APPLICATION\n         * @see #TYPE_APPLICATION\n         * @see #TYPE_APPLICATION_STARTING\n         * @see #TYPE_APPLICATION_PANEL\n         * @see #TYPE_APPLICATION_MEDIA\n         * @see #TYPE_APPLICATION_SUB_PANEL\n         * @see #TYPE_APPLICATION_ATTACHED_DIALOG\n         * @see #TYPE_STATUS_BAR\n         * @see #TYPE_SEARCH_BAR\n         * @see #TYPE_PHONE\n         * @see #TYPE_SYSTEM_ALERT\n         * @see #TYPE_KEYGUARD\n         * @see #TYPE_TOAST\n         * @see #TYPE_SYSTEM_OVERLAY\n         * @see #TYPE_PRIORITY_PHONE\n         * @see #TYPE_STATUS_BAR_PANEL\n         * @see #TYPE_SYSTEM_DIALOG\n         * @see #TYPE_KEYGUARD_DIALOG\n         * @see #TYPE_SYSTEM_ERROR\n         * @see #TYPE_INPUT_METHOD\n         * @see #TYPE_INPUT_METHOD_DIALOG\n         */\n    type:number = 0;\n\n    /**\n         * Start of window types that represent normal application windows.\n         */\n    static FIRST_APPLICATION_WINDOW:number = 1;\n\n    /**\n         * Window type: an application window that serves as the \"base\" window\n         * of the overall application; all other application windows will\n         * appear on top of it.\n         * In multiuser systems shows only on the owning user's window.\n         */\n    static TYPE_BASE_APPLICATION:number = 1;\n\n    /**\n         * Window type: a normal application window.  The {@link #token} must be\n         * an Activity token identifying who the window belongs to.\n         * In multiuser systems shows only on the owning user's window.\n         */\n    static TYPE_APPLICATION:number = 2;\n\n    /**\n         * Window type: special application window that is displayed while the\n         * application is starting.  Not for use by applications themselves;\n         * this is used by the system to display something until the\n         * application can show its own windows.\n         * In multiuser systems shows on all users' windows.\n         */\n    static TYPE_APPLICATION_STARTING:number = 3;\n\n    /**\n         * End of types of application windows.\n         */\n    static LAST_APPLICATION_WINDOW:number = 99;\n\n    /**\n         * Start of types of sub-windows.  The {@link #token} of these windows\n         * must be set to the window they are attached to.  These types of\n         * windows are kept next to their attached window in Z-order, and their\n         * coordinate space is relative to their attached window.\n         */\n    static FIRST_SUB_WINDOW:number = 1000;\n\n    /**\n         * Window type: a panel on top of an application window.  These windows\n         * appear on top of their attached window.\n         */\n    static TYPE_APPLICATION_PANEL:number = LayoutParams.FIRST_SUB_WINDOW;\n\n    /**\n         * Window type: window for showing media (such as video).  These windows\n         * are displayed behind their attached window.\n         */\n    static TYPE_APPLICATION_MEDIA:number = LayoutParams.FIRST_SUB_WINDOW + 1;\n\n    /**\n         * Window type: a sub-panel on top of an application window.  These\n         * windows are displayed on top their attached window and any\n         * {@link #TYPE_APPLICATION_PANEL} panels.\n         */\n    static TYPE_APPLICATION_SUB_PANEL:number = LayoutParams.FIRST_SUB_WINDOW + 2;\n\n    /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout\n         * of the window happens as that of a top-level window, <em>not</em>\n         * as a child of its container.\n         */\n    static TYPE_APPLICATION_ATTACHED_DIALOG:number = LayoutParams.FIRST_SUB_WINDOW + 3;\n\n    /**\n         * Window type: window for showing overlays on top of media windows.\n         * These windows are displayed between TYPE_APPLICATION_MEDIA and the\n         * application window.  They should be translucent to be useful.  This\n         * is a big ugly hack so:\n         * @hide\n         */\n    static TYPE_APPLICATION_MEDIA_OVERLAY:number = LayoutParams.FIRST_SUB_WINDOW + 4;\n\n    /**\n         * End of types of sub-windows.\n         */\n    static LAST_SUB_WINDOW:number = 1999;\n\n    /**\n         * Start of system-specific window types.  These are not normally\n         * created by applications.\n         */\n    static FIRST_SYSTEM_WINDOW:number = 2000;\n\n    /**\n         * Window type: the status bar.  There can be only one status bar\n         * window; it is placed at the top of the screen, and all other\n         * windows are shifted down so they are below it.\n         * In multiuser systems shows on all users' windows.\n         */\n    static TYPE_STATUS_BAR:number = LayoutParams.FIRST_SYSTEM_WINDOW;\n\n    /**\n         * Window type: the search bar.  There can be only one search bar\n         * window; it is placed at the top of the screen.\n         * In multiuser systems shows on all users' windows.\n         */\n    static TYPE_SEARCH_BAR:number = LayoutParams.FIRST_SYSTEM_WINDOW + 1;\n\n    /**\n         * Window type: phone.  These are non-application windows providing\n         * user interaction with the phone (in particular incoming calls).\n         * These windows are normally placed above all applications, but behind\n         * the status bar.\n         * In multiuser systems shows on all users' windows.\n         */\n    static TYPE_PHONE:number = LayoutParams.FIRST_SYSTEM_WINDOW + 2;\n\n    /**\n         * Window type: system window, such as low power alert. These windows\n         * are always on top of application windows.\n         * In multiuser systems shows only on the owning user's window.\n         */\n    static TYPE_SYSTEM_ALERT:number = LayoutParams.FIRST_SYSTEM_WINDOW + 3;\n\n    /**\n         * Window type: keyguard window.\n         * In multiuser systems shows on all users' windows.\n         */\n    static TYPE_KEYGUARD:number = LayoutParams.FIRST_SYSTEM_WINDOW + 4;\n\n    /**\n         * Window type: transient notifications.\n         * In multiuser systems shows only on the owning user's window.\n         */\n    static TYPE_TOAST:number = LayoutParams.FIRST_SYSTEM_WINDOW + 5;\n\n    /**\n         * Window type: system overlay windows, which need to be displayed\n         * on top of everything else.  These windows must not take input\n         * focus, or they will interfere with the keyguard.\n         * In multiuser systems shows only on the owning user's window.\n         */\n    static TYPE_SYSTEM_OVERLAY:number = LayoutParams.FIRST_SYSTEM_WINDOW + 6;\n\n    /**\n         * Window type: priority phone UI, which needs to be displayed even if\n         * the keyguard is active.  These windows must not take input\n         * focus, or they will interfere with the keyguard.\n         * In multiuser systems shows on all users' windows.\n         */\n    static TYPE_PRIORITY_PHONE:number = LayoutParams.FIRST_SYSTEM_WINDOW + 7;\n\n    /**\n         * Window type: panel that slides out from the status bar\n         * In multiuser systems shows on all users' windows.\n         */\n    static TYPE_SYSTEM_DIALOG:number = LayoutParams.FIRST_SYSTEM_WINDOW + 8;\n\n    ///**\n    //     * Window type: dialogs that the keyguard shows\n    //     * In multiuser systems shows on all users' windows.\n    //     */\n    //static TYPE_KEYGUARD_DIALOG:number = LayoutParams.FIRST_SYSTEM_WINDOW + 9;\n    //\n    ///**\n    //     * Window type: internal system error windows, appear on top of\n    //     * everything they can.\n    //     * In multiuser systems shows only on the owning user's window.\n    //     */\n    //static TYPE_SYSTEM_ERROR:number = LayoutParams.FIRST_SYSTEM_WINDOW + 10;\n    //\n    ///**\n    //     * Window type: internal input methods windows, which appear above\n    //     * the normal UI.  Application windows may be resized or panned to keep\n    //     * the input focus visible while this window is displayed.\n    //     * In multiuser systems shows only on the owning user's window.\n    //     */\n    //static TYPE_INPUT_METHOD:number = LayoutParams.FIRST_SYSTEM_WINDOW + 11;\n    //\n    ///**\n    //     * Window type: internal input methods dialog windows, which appear above\n    //     * the current input method window.\n    //     * In multiuser systems shows only on the owning user's window.\n    //     */\n    //static TYPE_INPUT_METHOD_DIALOG:number = LayoutParams.FIRST_SYSTEM_WINDOW + 12;\n    //\n    ///**\n    //     * Window type: wallpaper window, placed behind any window that wants\n    //     * to sit on top of the wallpaper.\n    //     * In multiuser systems shows only on the owning user's window.\n    //     */\n    //static TYPE_WALLPAPER:number = LayoutParams.FIRST_SYSTEM_WINDOW + 13;\n    //\n    ///**\n    //     * Window type: panel that slides out from over the status bar\n    //     * In multiuser systems shows on all users' windows.\n    //     */\n    //static TYPE_STATUS_BAR_PANEL:number = LayoutParams.FIRST_SYSTEM_WINDOW + 14;\n    //\n    ///**\n    //     * Window type: secure system overlay windows, which need to be displayed\n    //     * on top of everything else.  These windows must not take input\n    //     * focus, or they will interfere with the keyguard.\n    //     *\n    //     * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the\n    //     * system itself is allowed to create these overlays.  Applications cannot\n    //     * obtain permission to create secure system overlays.\n    //     *\n    //     * In multiuser systems shows only on the owning user's window.\n    //     * @hide\n    //     */\n    //static TYPE_SECURE_SYSTEM_OVERLAY:number = LayoutParams.FIRST_SYSTEM_WINDOW + 15;\n    //\n    ///**\n    //     * Window type: the drag-and-drop pseudowindow.  There is only one\n    //     * drag layer (at most), and it is placed on top of all other windows.\n    //     * In multiuser systems shows only on the owning user's window.\n    //     * @hide\n    //     */\n    //static TYPE_DRAG:number = LayoutParams.FIRST_SYSTEM_WINDOW + 16;\n    //\n    ///**\n    //     * Window type: panel that slides out from under the status bar\n    //     * In multiuser systems shows on all users' windows.\n    //     * @hide\n    //     */\n    //static TYPE_STATUS_BAR_SUB_PANEL:number = LayoutParams.FIRST_SYSTEM_WINDOW + 17;\n    //\n    ///**\n    //     * Window type: (mouse) pointer\n    //     * In multiuser systems shows on all users' windows.\n    //     * @hide\n    //     */\n    //static TYPE_POINTER:number = LayoutParams.FIRST_SYSTEM_WINDOW + 18;\n    //\n    ///**\n    //     * Window type: Navigation bar (when distinct from status bar)\n    //     * In multiuser systems shows on all users' windows.\n    //     * @hide\n    //     */\n    //static TYPE_NAVIGATION_BAR:number = LayoutParams.FIRST_SYSTEM_WINDOW + 19;\n    //\n    ///**\n    //     * Window type: The volume level overlay/dialog shown when the user\n    //     * changes the system volume.\n    //     * In multiuser systems shows on all users' windows.\n    //     * @hide\n    //     */\n    //static TYPE_VOLUME_OVERLAY:number = LayoutParams.FIRST_SYSTEM_WINDOW + 20;\n    //\n    ///**\n    //     * Window type: The boot progress dialog, goes on top of everything\n    //     * in the world.\n    //     * In multiuser systems shows on all users' windows.\n    //     * @hide\n    //     */\n    //static TYPE_BOOT_PROGRESS:number = LayoutParams.FIRST_SYSTEM_WINDOW + 21;\n    //\n    ///**\n    //     * Window type: Fake window to consume touch events when the navigation\n    //     * bar is hidden.\n    //     * In multiuser systems shows on all users' windows.\n    //     * @hide\n    //     */\n    //static TYPE_HIDDEN_NAV_CONSUMER:number = LayoutParams.FIRST_SYSTEM_WINDOW + 22;\n    //\n    ///**\n    //     * Window type: Dreams (screen saver) window, just above keyguard.\n    //     * In multiuser systems shows only on the owning user's window.\n    //     * @hide\n    //     */\n    //static TYPE_DREAM:number = LayoutParams.FIRST_SYSTEM_WINDOW + 23;\n    //\n    ///**\n    //     * Window type: Navigation bar panel (when navigation bar is distinct from status bar)\n    //     * In multiuser systems shows on all users' windows.\n    //     * @hide\n    //     */\n    //static TYPE_NAVIGATION_BAR_PANEL:number = LayoutParams.FIRST_SYSTEM_WINDOW + 24;\n    //\n    ///**\n    //     * Window type: Behind the universe of the real windows.\n    //     * In multiuser systems shows on all users' windows.\n    //     * @hide\n    //     */\n    //static TYPE_UNIVERSE_BACKGROUND:number = LayoutParams.FIRST_SYSTEM_WINDOW + 25;\n    //\n    ///**\n    //     * Window type: Display overlay window.  Used to simulate secondary display devices.\n    //     * In multiuser systems shows on all users' windows.\n    //     * @hide\n    //     */\n    //static TYPE_DISPLAY_OVERLAY:number = LayoutParams.FIRST_SYSTEM_WINDOW + 26;\n    //\n    ///**\n    //     * Window type: Magnification overlay window. Used to highlight the magnified\n    //     * portion of a display when accessibility magnification is enabled.\n    //     * In multiuser systems shows on all users' windows.\n    //     * @hide\n    //     */\n    //static TYPE_MAGNIFICATION_OVERLAY:number = LayoutParams.FIRST_SYSTEM_WINDOW + 27;\n    //\n    ///**\n    //     * Window type: Recents. Same layer as {@link #TYPE_SYSTEM_DIALOG} but only appears on\n    //     * one user's screen.\n    //     * In multiuser systems shows on all users' windows.\n    //     * @hide\n    //     */\n    //static TYPE_RECENTS_OVERLAY:number = LayoutParams.FIRST_SYSTEM_WINDOW + 28;\n    //\n    ///**\n    //     * Window type: keyguard scrim window. Shows if keyguard needs to be restarted.\n    //     * In multiuser systems shows on all users' windows.\n    //     * @hide\n    //     */\n    //static TYPE_KEYGUARD_SCRIM:number = LayoutParams.FIRST_SYSTEM_WINDOW + 29;\n    //\n    ///**\n    //     * Window type: Window for Presentation on top of private\n    //     * virtual display.\n    //     */\n    //static TYPE_PRIVATE_PRESENTATION:number = LayoutParams.FIRST_SYSTEM_WINDOW + 30;\n\n    /**\n         * End of types of system windows.\n         */\n    static LAST_SYSTEM_WINDOW:number = 2999;\n\n    ///** @deprecated this is ignored, this value is set automatically when needed. */\n    //static MEMORY_TYPE_NORMAL:number = 0;\n    //\n    ///** @deprecated this is ignored, this value is set automatically when needed. */\n    //static MEMORY_TYPE_HARDWARE:number = 1;\n    //\n    ///** @deprecated this is ignored, this value is set automatically when needed. */\n    //static MEMORY_TYPE_GPU:number = 2;\n    //\n    ///** @deprecated this is ignored, this value is set automatically when needed. */\n    //static MEMORY_TYPE_PUSH_BUFFERS:number = 3;\n    //\n    ///**\n    //     * @deprecated this is ignored\n    //     */\n    //memoryType:number = 0;\n\n    ///** Window flag: as long as this window is visible to the user, allow\n    //     *  the lock screen to activate while the screen is on.\n    //     *  This can be used independently, or in combination with\n    //     *  {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */\n    //static FLAG_ALLOW_LOCK_WHILE_SCREEN_ON:number = 0x00000001;\n\n    ///** Window flag: everything behind this window will be dimmed.\n    //     *  Use {@link #dimAmount} to control the amount of dim. */\n    //static FLAG_DIM_BEHIND:number = 0x00000002;\n\n    ///** Window flag: blur everything behind this window.\n    //     * @deprecated Blurring is no longer supported. */\n    //static FLAG_BLUR_BEHIND:number = 0x00000004;\n\n    /** Window flag: this window won't ever get key input focus, so the\n         * user can not send key or other button events to it.  Those will\n         * instead go to whatever focusable window is behind it.  This flag\n         * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that\n         * is explicitly set.\n         * \n         * <p>Setting this flag also implies that the window will not need to\n         * interact with\n         * a soft input method, so it will be Z-ordered and positioned \n         * independently of any active input method (typically this means it\n         * gets Z-ordered on top of the input method, so it can use the full\n         * screen for its content and cover the input method if needed.  You\n         * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */\n    static FLAG_NOT_FOCUSABLE:number = 0x00000008;\n\n    /** Window flag: this window can never receive touch events. */\n    static FLAG_NOT_TOUCHABLE:number = 0x00000010;\n\n    /** Window flag: even when this window is focusable (its\n         * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events\n         * outside of the window to be sent to the windows behind it.  Otherwise\n         * it will consume all pointer events itself, regardless of whether they\n         * are inside of the window. */\n    static FLAG_NOT_TOUCH_MODAL:number = 0x00000020;\n\n    ///** Window flag: when set, if the device is asleep when the touch\n    //     * screen is pressed, you will receive this first touch event.  Usually\n    //     * the first touch event is consumed by the system since the user can\n    //     * not see what they are pressing on.\n    //     */\n    //static FLAG_TOUCHABLE_WHEN_WAKING:number = 0x00000040;\n    //\n    ///** Window flag: as long as this window is visible to the user, keep\n    //     *  the device's screen turned on and bright. */\n    //static FLAG_KEEP_SCREEN_ON:number = 0x00000080;\n    //\n    ///** Window flag: place the window within the entire screen, ignoring\n    //     *  decorations around the border (such as the status bar).  The\n    //     *  window must correctly position its contents to take the screen\n    //     *  decoration into account.  This flag is normally set for you\n    //     *  by Window as described in {@link Window#setFlags}. */\n    //static FLAG_LAYOUT_IN_SCREEN:number = 0x00000100;\n    //\n    ///** Window flag: allow window to extend outside of the screen. */\n    //static FLAG_LAYOUT_NO_LIMITS:number = 0x00000200;\n\n    ///**\n    //     * Window flag: hide all screen decorations (such as the status bar) while\n    //     * this window is displayed.  This allows the window to use the entire\n    //     * display space for itself -- the status bar will be hidden when\n    //     * an app window with this flag set is on the top layer. A fullscreen window\n    //     * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's\n    //     * {@link #softInputMode} field; the window will stay fullscreen\n    //     * and will not resize.\n    //     *\n    //     * <p>This flag can be controlled in your theme through the\n    //     * {@link android.R.attr#windowFullscreen} attribute; this attribute\n    //     * is automatically set for you in the standard fullscreen themes\n    //     * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},\n    //     * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},\n    //     * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},\n    //     * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},\n    //     * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},\n    //     * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and\n    //     * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>\n    //     */\n    //static FLAG_FULLSCREEN:number = 0x00000400;\n    //\n    ///** Window flag: override {@link #FLAG_FULLSCREEN} and force the\n    //     *  screen decorations (such as the status bar) to be shown. */\n    //static FLAG_FORCE_NOT_FULLSCREEN:number = 0x00000800;\n    //\n    ///** Window flag: turn on dithering when compositing this window to\n    //     *  the screen.\n    //     * @deprecated This flag is no longer used. */\n    //static FLAG_DITHER:number = 0x00001000;\n    //\n    ///** Window flag: treat the content of the window as secure, preventing\n    //     * it from appearing in screenshots or from being viewed on non-secure\n    //     * displays.\n    //     *\n    //     * <p>See {@link android.view.Display#FLAG_SECURE} for more details about\n    //     * secure surfaces and secure displays.\n    //     */\n    //static FLAG_SECURE:number = 0x00002000;\n    //\n    ///** Window flag: a special mode where the layout parameters are used\n    //     * to perform scaling of the surface when it is composited to the\n    //     * screen. */\n    //static FLAG_SCALED:number = 0x00004000;\n    //\n    ///** Window flag: intended for windows that will often be used when the user is\n    //     * holding the screen against their face, it will aggressively filter the event\n    //     * stream to prevent unintended presses in this situation that may not be\n    //     * desired for a particular window, when such an event stream is detected, the\n    //     * application will receive a CANCEL motion event to indicate this so applications\n    //     * can handle this accordingly by taking no action on the event\n    //     * until the finger is released. */\n    //static FLAG_IGNORE_CHEEK_PRESSES:number = 0x00008000;\n    //\n    ///** Window flag: a special option only for use in combination with\n    //     * {@link #FLAG_LAYOUT_IN_SCREEN}.  When requesting layout in the\n    //     * screen your window may appear on top of or behind screen decorations\n    //     * such as the status bar.  By also including this flag, the window\n    //     * manager will report the inset rectangle needed to ensure your\n    //     * content is not covered by screen decorations.  This flag is normally\n    //     * set for you by Window as described in {@link Window#setFlags}.*/\n    //static FLAG_LAYOUT_INSET_DECOR:number = 0x00010000;\n    //\n    ///** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with\n    //     * respect to how this window interacts with the current method.  That\n    //     * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the\n    //     * window will behave as if it needs to interact with the input method\n    //     * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is\n    //     * not set and this flag is set, then the window will behave as if it\n    //     * doesn't need to interact with the input method and can be placed\n    //     * to use more space and cover the input method.\n    //     */\n    //static FLAG_ALT_FOCUSABLE_IM:number = 0x00020000;\n    //\n    /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you\n         * can set this flag to receive a single special MotionEvent with\n         * the action\n         * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for\n         * touches that occur outside of your window.  Note that you will not\n         * receive the full down/move/up gesture, only the location of the\n         * first down as an ACTION_OUTSIDE.\n         */\n    static FLAG_WATCH_OUTSIDE_TOUCH:number = 0x00040000;\n    //\n    ///** Window flag: special flag to let windows be shown when the screen\n    //     * is locked. This will let application windows take precedence over\n    //     * key guard or any other lock screens. Can be used with\n    //     * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows\n    //     * directly before showing the key guard window.  Can be used with\n    //     * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss\n    //     * non-secure keyguards.  This flag only applies to the top-most\n    //     * full-screen window.\n    //     */\n    //static FLAG_SHOW_WHEN_LOCKED:number = 0x00080000;\n    //\n    ///** Window flag: ask that the system wallpaper be shown behind\n    //     * your window.  The window surface must be translucent to be able\n    //     * to actually see the wallpaper behind it; this flag just ensures\n    //     * that the wallpaper surface will be there if this window actually\n    //     * has translucent regions.\n    //     *\n    //     * <p>This flag can be controlled in your theme through the\n    //     * {@link android.R.attr#windowShowWallpaper} attribute; this attribute\n    //     * is automatically set for you in the standard wallpaper themes\n    //     * such as {@link android.R.style#Theme_Wallpaper},\n    //     * {@link android.R.style#Theme_Wallpaper_NoTitleBar},\n    //     * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},\n    //     * {@link android.R.style#Theme_Holo_Wallpaper},\n    //     * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},\n    //     * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and\n    //     * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>\n    //     */\n    //static FLAG_SHOW_WALLPAPER:number = 0x00100000;\n    //\n    ///** Window flag: when set as a window is being added or made\n    //     * visible, once the window has been shown then the system will\n    //     * poke the power manager's user activity (as if the user had woken\n    //     * up the device) to turn the screen on. */\n    //static FLAG_TURN_SCREEN_ON:number = 0x00200000;\n    //\n    ///** Window flag: when set the window will cause the keyguard to\n    //     * be dismissed, only if it is not a secure lock keyguard.  Because such\n    //     * a keyguard is not needed for security, it will never re-appear if\n    //     * the user navigates to another window (in contrast to\n    //     * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily\n    //     * hide both secure and non-secure keyguards but ensure they reappear\n    //     * when the user moves to another UI that doesn't hide them).\n    //     * If the keyguard is currently active and is secure (requires an\n    //     * unlock pattern) than the user will still need to confirm it before\n    //     * seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has\n    //     * also been set.\n    //     */\n    //static FLAG_DISMISS_KEYGUARD:number = 0x00400000;\n\n    /** Window flag: when set the window will accept for touch events\n         * outside of its bounds to be sent to other windows that also\n         * support split touch.  When this flag is not set, the first pointer\n         * that goes down determines the window to which all subsequent touches\n         * go until all pointers go up.  When this flag is set, each pointer\n         * (not necessarily the first) that goes down determines the window\n         * to which all subsequent touches of that pointer will go until that\n         * pointer goes up thereby enabling touches with multiple pointers\n         * to be split across multiple windows.\n         */\n    static FLAG_SPLIT_TOUCH:number = 0x00800000;\n\n    ///**\n    //     * <p>Indicates whether this window should be hardware accelerated.\n    //     * Requesting hardware acceleration does not guarantee it will happen.</p>\n    //     *\n    //     * <p>This flag can be controlled programmatically <em>only</em> to enable\n    //     * hardware acceleration. To enable hardware acceleration for a given\n    //     * window programmatically, do the following:</p>\n    //     *\n    //     * <pre>\n    //     * Window w = activity.getWindow(); // in Activity's onCreate() for instance\n    //     * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,\n    //     *         WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);\n    //     * </pre>\n    //     *\n    //     * <p>It is important to remember that this flag <strong>must</strong>\n    //     * be set before setting the content view of your activity or dialog.</p>\n    //     *\n    //     * <p>This flag cannot be used to disable hardware acceleration after it\n    //     * was enabled in your manifest using\n    //     * {@link android.R.attr#hardwareAccelerated}. If you need to selectively\n    //     * and programmatically disable hardware acceleration (for automated testing\n    //     * for instance), make sure it is turned off in your manifest and enable it\n    //     * on your activity or dialog when you need it instead, using the method\n    //     * described above.</p>\n    //     *\n    //     * <p>This flag is automatically set by the system if the\n    //     * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}\n    //     * XML attribute is set to true on an activity or on the application.</p>\n    //     */\n    //static FLAG_HARDWARE_ACCELERATED:number = 0x01000000;\n    //\n    ///**\n    //     * Window flag: allow window contents to extend in to the screen's\n    //     * overscan area, if there is one.  The window should still correctly\n    //     * position its contents to take the overscan area into account.\n    //     *\n    //     * <p>This flag can be controlled in your theme through the\n    //     * {@link android.R.attr#windowOverscan} attribute; this attribute\n    //     * is automatically set for you in the standard overscan themes\n    //     * such as\n    //     * {@link android.R.style#Theme_Holo_NoActionBar_Overscan},\n    //     * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},\n    //     * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and\n    //     * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>\n    //     *\n    //     * <p>When this flag is enabled for a window, its normal content may be obscured\n    //     * to some degree by the overscan region of the display.  To ensure key parts of\n    //     * that content are visible to the user, you can use\n    //     * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}\n    //     * to set the point in the view hierarchy where the appropriate offsets should\n    //     * be applied.  (This can be done either by directly calling this function, using\n    //     * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,\n    //     * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)\n    //     * View.fitSystemWindows(Rect)} method).</p>\n    //     *\n    //     * <p>This mechanism for positioning content elements is identical to its equivalent\n    //     * use with layout and {@link View#setSystemUiVisibility(int)\n    //     * View.setSystemUiVisibility(int)}; here is an example layout that will correctly\n    //     * position its UI elements with this overscan flag is set:</p>\n    //     *\n    //     * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}\n    //     */\n    //static FLAG_LAYOUT_IN_OVERSCAN:number = 0x02000000;\n    //\n    ///**\n    //     * Window flag: request a translucent status bar with minimal system-provided\n    //     * background protection.\n    //     *\n    //     * <p>This flag can be controlled in your theme through the\n    //     * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute\n    //     * is automatically set for you in the standard translucent decor themes\n    //     * such as\n    //     * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},\n    //     * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},\n    //     * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and\n    //     * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>\n    //     *\n    //     * <p>When this flag is enabled for a window, it automatically sets\n    //     * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and\n    //     * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p>\n    //     */\n    //static FLAG_TRANSLUCENT_STATUS:number = 0x04000000;\n    //\n    ///**\n    //     * Window flag: request a translucent navigation bar with minimal system-provided\n    //     * background protection.\n    //     *\n    //     * <p>This flag can be controlled in your theme through the\n    //     * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute\n    //     * is automatically set for you in the standard translucent decor themes\n    //     * such as\n    //     * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},\n    //     * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},\n    //     * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and\n    //     * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>\n    //     *\n    //     * <p>When this flag is enabled for a window, it automatically sets\n    //     * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and\n    //     * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p>\n    //     */\n    //static FLAG_TRANSLUCENT_NAVIGATION:number = 0x08000000;\n\n    // ----- HIDDEN FLAGS.\n    // These start at the high bit and go down.\n    ///**\n    //     * Flag for a window in local focus mode.\n    //     * Window in local focus mode can control focus independent of window manager using\n    //     * {@link Window#setLocalFocus(boolean, boolean)}.\n    //     * Usually window in this mode will not get touch/key events from window manager, but will\n    //     * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.\n    //     */\n    //static FLAG_LOCAL_FOCUS_MODE:number = 0x10000000;\n    //\n    ///** Window flag: Enable touches to slide out of a window into neighboring\n    //     * windows in mid-gesture instead of being captured for the duration of\n    //     * the gesture.\n    //     *\n    //     * This flag changes the behavior of touch focus for this window only.\n    //     * Touches can slide out of the window but they cannot necessarily slide\n    //     * back in (unless the other window with touch focus permits it).\n    //     *\n    //     * {@hide}\n    //     */\n    //static FLAG_SLIPPERY:number = 0x20000000;\n    //\n    ///**\n    //     * Flag for a window belonging to an activity that responds to {@link KeyEvent#KEYCODE_MENU}\n    //     * and therefore needs a Menu key. For devices where Menu is a physical button this flag is\n    //     * ignored, but on devices where the Menu key is drawn in software it may be hidden unless\n    //     * this flag is set.\n    //     *\n    //     * (Note that Action Bars, when available, are the preferred way to offer additional\n    //     * functions otherwise accessed via an options menu.)\n    //     *\n    //     * {@hide}\n    //     */\n    //static FLAG_NEEDS_MENU_KEY:number = 0x40000000;\n\n    /**\n     * is window floating\n     * @type {number}\n     */\n    static FLAG_FLOATING:number = 0x40000000;\n\n    /**\n         * Various behavioral options/flags.  Default is none.\n         * \n         * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON\n         * @see #FLAG_DIM_BEHIND\n         * @see #FLAG_NOT_FOCUSABLE\n         * @see #FLAG_NOT_TOUCHABLE\n         * @see #FLAG_NOT_TOUCH_MODAL\n         * @see #FLAG_TOUCHABLE_WHEN_WAKING\n         * @see #FLAG_KEEP_SCREEN_ON\n         * @see #FLAG_LAYOUT_IN_SCREEN\n         * @see #FLAG_LAYOUT_NO_LIMITS\n         * @see #FLAG_FULLSCREEN\n         * @see #FLAG_FORCE_NOT_FULLSCREEN\n         * @see #FLAG_SECURE\n         * @see #FLAG_SCALED\n         * @see #FLAG_IGNORE_CHEEK_PRESSES\n         * @see #FLAG_LAYOUT_INSET_DECOR\n         * @see #FLAG_ALT_FOCUSABLE_IM\n         * @see #FLAG_WATCH_OUTSIDE_TOUCH\n         * @see #FLAG_SHOW_WHEN_LOCKED\n         * @see #FLAG_SHOW_WALLPAPER\n         * @see #FLAG_TURN_SCREEN_ON\n         * @see #FLAG_DISMISS_KEYGUARD\n         * @see #FLAG_SPLIT_TOUCH\n         * @see #FLAG_HARDWARE_ACCELERATED\n         * @see #FLAG_LOCAL_FOCUS_MODE\n         * @see #FLAG_FLOATING\n         */\n    flags:number = 0;\n\n    ///**\n    //     * If the window has requested hardware acceleration, but this is not\n    //     * allowed in the process it is in, then still render it as if it is\n    //     * hardware accelerated.  This is used for the starting preview windows\n    //     * in the system process, which don't need to have the overhead of\n    //     * hardware acceleration (they are just a static rendering), but should\n    //     * be rendered as such to match the actual window of the app even if it\n    //     * is hardware accelerated.\n    //     * Even if the window isn't hardware accelerated, still do its rendering\n    //     * as if it was.\n    //     * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows\n    //     * that need hardware acceleration (e.g. LockScreen), where hardware acceleration\n    //     * is generally disabled. This flag must be specified in addition to\n    //     * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system\n    //     * windows.\n    //     *\n    //     * @hide\n    //     */\n    //static PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED:number = 0x00000001;\n    //\n    ///**\n    //     * In the system process, we globally do not use hardware acceleration\n    //     * because there are many threads doing UI there and they conflict.\n    //     * If certain parts of the UI that really do want to use hardware\n    //     * acceleration, this flag can be set to force it.  This is basically\n    //     * for the lock screen.  Anyone else using it, you are probably wrong.\n    //     *\n    //     * @hide\n    //     */\n    //static PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED:number = 0x00000002;\n    //\n    ///**\n    //     * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers\n    //     * may elect to skip these notifications if they are not doing anything productive with\n    //     * them (they do not affect the wallpaper scrolling operation) by calling\n    //     * {@link\n    //     * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.\n    //     *\n    //     * @hide\n    //     */\n    //static PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS:number = 0x00000004;\n    //\n    ///**\n    //     * This is set for a window that has explicitly specified its\n    //     * FLAG_NEEDS_MENU_KEY, so we know the value on this window is the\n    //     * appropriate one to use.  If this is not set, we should look at\n    //     * windows behind it to determine the appropriate value.\n    //     *\n    //     * @hide\n    //     */\n    //static PRIVATE_FLAG_SET_NEEDS_MENU_KEY:number = 0x00000008;\n    //\n    ///** In a multiuser system if this flag is set and the owner is a system process then this\n    //     * window will appear on all user screens. This overrides the default behavior of window\n    //     * types that normally only appear on the owning user's screen. Refer to each window type\n    //     * to determine its default behavior.\n    //     *\n    //     * {@hide} */\n    //static PRIVATE_FLAG_SHOW_FOR_ALL_USERS:number = 0x00000010;\n    //\n    ///**\n    //     * Special flag for the volume overlay: force the window manager out of \"hide nav bar\"\n    //     * mode while the window is on screen.\n    //     *\n    //     * {@hide} */\n    //static PRIVATE_FLAG_FORCE_SHOW_NAV_BAR:number = 0x00000020;\n    //\n    ///**\n    //     * Never animate position changes of the window.\n    //     *\n    //     * {@hide} */\n    //static PRIVATE_FLAG_NO_MOVE_ANIMATION:number = 0x00000040;\n    //\n    ///** Window flag: special flag to limit the size of the window to be\n    //     * original size ([320x480] x density). Used to create window for applications\n    //     * running under compatibility mode.\n    //     *\n    //     * {@hide} */\n    //static PRIVATE_FLAG_COMPATIBLE_WINDOW:number = 0x00000080;\n    //\n    ///** Window flag: a special option intended for system dialogs.  When\n    //     * this flag is set, the window will demand focus unconditionally when\n    //     * it is created.\n    //     * {@hide} */\n    //static PRIVATE_FLAG_SYSTEM_ERROR:number = 0x00000100;\n    //\n    ///** Window flag: maintain the previous translucent decor state when this window\n    //     * becomes top-most.\n    //     * {@hide} */\n    //static PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR:number = 0x00000200;\n    //\n    ///**\n    //     * Control flags that are private to the platform.\n    //     * @hide\n    //     */\n    //privateFlags:number = 0;\n    //\n    ///**\n    //     * Given a particular set of window manager flags, determine whether\n    //     * such a window may be a target for an input method when it has\n    //     * focus.  In particular, this checks the\n    //     * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}\n    //     * flags and returns true if the combination of the two corresponds\n    //     * to a window that needs to be behind the input method so that the\n    //     * user can type into it.\n    //     *\n    //     * @param flags The current window manager flags.\n    //     *\n    //     * @return Returns true if such a window should be behind/interact\n    //     * with an input method, false if not.\n    //     */\n    //static mayUseInputMethod(flags:number):boolean  {\n    //    switch(flags & (LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_ALT_FOCUSABLE_IM)) {\n    //        case 0:\n    //        case LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_ALT_FOCUSABLE_IM:\n    //            return true;\n    //    }\n    //    return false;\n    //}\n    //\n    ///**\n    //     * Mask for {@link #softInputMode} of the bits that determine the\n    //     * desired visibility state of the soft input area for this window.\n    //     */\n    //static SOFT_INPUT_MASK_STATE:number = 0x0f;\n    //\n    ///**\n    //     * Visibility state for {@link #softInputMode}: no state has been specified.\n    //     */\n    //static SOFT_INPUT_STATE_UNSPECIFIED:number = 0;\n    //\n    ///**\n    //     * Visibility state for {@link #softInputMode}: please don't change the state of\n    //     * the soft input area.\n    //     */\n    //static SOFT_INPUT_STATE_UNCHANGED:number = 1;\n    //\n    ///**\n    //     * Visibility state for {@link #softInputMode}: please hide any soft input\n    //     * area when normally appropriate (when the user is navigating\n    //     * forward to your window).\n    //     */\n    //static SOFT_INPUT_STATE_HIDDEN:number = 2;\n    //\n    ///**\n    //     * Visibility state for {@link #softInputMode}: please always hide any\n    //     * soft input area when this window receives focus.\n    //     */\n    //static SOFT_INPUT_STATE_ALWAYS_HIDDEN:number = 3;\n    //\n    ///**\n    //     * Visibility state for {@link #softInputMode}: please show the soft\n    //     * input area when normally appropriate (when the user is navigating\n    //     * forward to your window).\n    //     */\n    //static SOFT_INPUT_STATE_VISIBLE:number = 4;\n    //\n    ///**\n    //     * Visibility state for {@link #softInputMode}: please always make the\n    //     * soft input area visible when this window receives input focus.\n    //     */\n    //static SOFT_INPUT_STATE_ALWAYS_VISIBLE:number = 5;\n    //\n    ///**\n    //     * Mask for {@link #softInputMode} of the bits that determine the\n    //     * way that the window should be adjusted to accommodate the soft\n    //     * input window.\n    //     */\n    //static SOFT_INPUT_MASK_ADJUST:number = 0xf0;\n    //\n    ///** Adjustment option for {@link #softInputMode}: nothing specified.\n    //     * The system will try to pick one or\n    //     * the other depending on the contents of the window.\n    //     */\n    //static SOFT_INPUT_ADJUST_UNSPECIFIED:number = 0x00;\n    //\n    ///** Adjustment option for {@link #softInputMode}: set to allow the\n    //     * window to be resized when an input\n    //     * method is shown, so that its contents are not covered by the input\n    //     * method.  This can <em>not</em> be combined with\n    //     * {@link #SOFT_INPUT_ADJUST_PAN}; if\n    //     * neither of these are set, then the system will try to pick one or\n    //     * the other depending on the contents of the window. If the window's\n    //     * layout parameter flags include {@link #FLAG_FULLSCREEN}, this\n    //     * value for {@link #softInputMode} will be ignored; the window will\n    //     * not resize, but will stay fullscreen.\n    //     */\n    //static SOFT_INPUT_ADJUST_RESIZE:number = 0x10;\n    //\n    ///** Adjustment option for {@link #softInputMode}: set to have a window\n    //     * pan when an input method is\n    //     * shown, so it doesn't need to deal with resizing but just panned\n    //     * by the framework to ensure the current input focus is visible.  This\n    //     * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if\n    //     * neither of these are set, then the system will try to pick one or\n    //     * the other depending on the contents of the window.\n    //     */\n    //static SOFT_INPUT_ADJUST_PAN:number = 0x20;\n    //\n    ///** Adjustment option for {@link #softInputMode}: set to have a window\n    //     * not adjust for a shown input method.  The window will not be resized,\n    //     * and it will not be panned to make its focus visible.\n    //     */\n    //static SOFT_INPUT_ADJUST_NOTHING:number = 0x30;\n    //\n    ///**\n    //     * Bit for {@link #softInputMode}: set when the user has navigated\n    //     * forward to the window.  This is normally set automatically for\n    //     * you by the system, though you may want to set it in certain cases\n    //     * when you are displaying a window yourself.  This flag will always\n    //     * be cleared automatically after the window is displayed.\n    //     */\n    //static SOFT_INPUT_IS_FORWARD_NAVIGATION:number = 0x100;\n    //\n    ///**\n    //     * Desired operating mode for any soft input area.  May be any combination\n    //     * of:\n    //     *\n    //     * <ul>\n    //     * <li> One of the visibility states\n    //     * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},\n    //     * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}, or\n    //     * {@link #SOFT_INPUT_STATE_VISIBLE}.\n    //     * <li> One of the adjustment options\n    //     * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED},\n    //     * {@link #SOFT_INPUT_ADJUST_RESIZE}, or\n    //     * {@link #SOFT_INPUT_ADJUST_PAN}.\n    //     * </ul>\n    //     *\n    //     *\n    //     * <p>This flag can be controlled in your theme through the\n    //     * {@link android.R.attr#windowSoftInputMode} attribute.</p>\n    //     */\n    //softInputMode:number = 0;\n    //\n    ///**\n    //     * Placement of window within the screen as per {@link Gravity}.  Both\n    //     * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,\n    //     * android.graphics.Rect) Gravity.apply} and\n    //     * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)\n    //     * Gravity.applyDisplay} are used during window layout, with this value\n    //     * given as the desired gravity.  For example you can specify\n    //     * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and\n    //     * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here\n    //     * to control the behavior of\n    //     * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)\n    //     * Gravity.applyDisplay}.\n    //     *\n    //     * @see Gravity\n    //     */\n    //gravity:number = 0;\n    //\n    ///**\n    //     * The horizontal margin, as a percentage of the container's width,\n    //     * between the container and the widget.  See\n    //     * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,\n    //     * android.graphics.Rect) Gravity.apply} for how this is used.  This\n    //     * field is added with {@link #x} to supply the <var>xAdj</var> parameter.\n    //     */\n    //horizontalMargin:number = 0;\n    //\n    ///**\n    //     * The vertical margin, as a percentage of the container's height,\n    //     * between the container and the widget.  See\n    //     * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,\n    //     * android.graphics.Rect) Gravity.apply} for how this is used.  This\n    //     * field is added with {@link #y} to supply the <var>yAdj</var> parameter.\n    //     */\n    //verticalMargin:number = 0;\n    //\n    ///**\n    //     * The desired bitmap format.  May be one of the constants in\n    //     * {@link android.graphics.PixelFormat}.  Default is OPAQUE.\n    //     */\n    //format:number = 0;\n    //\n    ///**\n    //     * A style resource defining the animations to use for this window.\n    //     * This must be a system resource; it can not be an application resource\n    //     * because the window manager does not have access to applications.\n    //     */\n    //windowAnimations:number = 0;\n    exitAnimation:Animation = android.R.anim.activity_close_exit;\n    enterAnimation:Animation = android.R.anim.activity_open_enter;\n    resumeAnimation:Animation = android.R.anim.activity_close_enter;\n    hideAnimation:Animation = android.R.anim.activity_open_exit;\n\n    //\n    ///**\n    //     * An alpha value to apply to this entire window.\n    //     * An alpha of 1.0 means fully opaque and 0.0 means fully transparent\n    //     */\n    //alpha:number = 1.0;\n\n    /**\n         * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming\n         * to apply.  Range is from 1.0 for completely opaque to 0.0 for no\n         * dim.\n         */\n    dimAmount:number = 0;\n\n    ///**\n    //     * Default value for {@link #screenBrightness} and {@link #buttonBrightness}\n    //     * indicating that the brightness value is not overridden for this window\n    //     * and normal brightness policy should be used.\n    //     */\n    //static BRIGHTNESS_OVERRIDE_NONE:number = -1.0;\n    //\n    ///**\n    //     * Value for {@link #screenBrightness} and {@link #buttonBrightness}\n    //     * indicating that the screen or button backlight brightness should be set\n    //     * to the lowest value when this window is in front.\n    //     */\n    //static BRIGHTNESS_OVERRIDE_OFF:number = 0.0;\n    //\n    ///**\n    //     * Value for {@link #screenBrightness} and {@link #buttonBrightness}\n    //     * indicating that the screen or button backlight brightness should be set\n    //     * to the hightest value when this window is in front.\n    //     */\n    //static BRIGHTNESS_OVERRIDE_FULL:number = 1.0;\n\n    ///**\n    //     * This can be used to override the user's preferred brightness of\n    //     * the screen.  A value of less than 0, the default, means to use the\n    //     * preferred screen brightness.  0 to 1 adjusts the brightness from\n    //     * dark to full bright.\n    //     */\n    //screenBrightness:number = LayoutParams.BRIGHTNESS_OVERRIDE_NONE;\n    //\n    ///**\n    //     * This can be used to override the standard behavior of the button and\n    //     * keyboard backlights.  A value of less than 0, the default, means to\n    //     * use the standard backlight behavior.  0 to 1 adjusts the brightness\n    //     * from dark to full bright.\n    //     */\n    //buttonBrightness:number = LayoutParams.BRIGHTNESS_OVERRIDE_NONE;\n\n    ///**\n    //     * Value for {@link #rotationAnimation} to define the animation used to\n    //     * specify that this window will rotate in or out following a rotation.\n    //     */\n    //static ROTATION_ANIMATION_ROTATE:number = 0;\n    //\n    ///**\n    //     * Value for {@link #rotationAnimation} to define the animation used to\n    //     * specify that this window will fade in or out following a rotation.\n    //     */\n    //static ROTATION_ANIMATION_CROSSFADE:number = 1;\n    //\n    ///**\n    //     * Value for {@link #rotationAnimation} to define the animation used to\n    //     * specify that this window will immediately disappear or appear following\n    //     * a rotation.\n    //     */\n    //static ROTATION_ANIMATION_JUMPCUT:number = 2;\n    //\n    ///**\n    //     * Define the exit and entry animations used on this window when the device is rotated.\n    //     * This only has an affect if the incoming and outgoing topmost\n    //     * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered\n    //     * by other windows. All other situations default to the\n    //     * {@link #ROTATION_ANIMATION_ROTATE} behavior.\n    //     *\n    //     * @see #ROTATION_ANIMATION_ROTATE\n    //     * @see #ROTATION_ANIMATION_CROSSFADE\n    //     * @see #ROTATION_ANIMATION_JUMPCUT\n    //     */\n    //rotationAnimation:number = LayoutParams.ROTATION_ANIMATION_ROTATE;\n\n    ///**\n    //     * Identifier for this window.  This will usually be filled in for\n    //     * you.\n    //     */\n    //token:IBinder = null;\n\n    ///**\n    //     * Name of the package owning this window.\n    //     */\n    //packageName:string = null;\n    //\n    ///**\n    //     * Specific orientation value for a window.\n    //     * May be any of the same values allowed\n    //     * for {@link android.content.pm.ActivityInfo#screenOrientation}.\n    //     * If not set, a default value of\n    //     * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}\n    //     * will be used.\n    //     */\n    //screenOrientation:number = -1;//ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;\n    //\n    ///**\n    //     * Control the visibility of the status bar.\n    //     *\n    //     * @see View#STATUS_BAR_VISIBLE\n    //     * @see View#STATUS_BAR_HIDDEN\n    //     */\n    //systemUiVisibility:number = 0;\n    //\n    ///**\n    //     * @hide\n    //     * The ui visibility as requested by the views in this hierarchy.\n    //     * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.\n    //     */\n    //subtreeSystemUiVisibility:number = 0;\n    //\n    ///**\n    //     * Get callbacks about the system ui visibility changing.\n    //     *\n    //     * TODO: Maybe there should be a bitfield of optional callbacks that we need.\n    //     *\n    //     * @hide\n    //     */\n    //hasSystemUiListeners:boolean;\n\n    ///**\n    //     * When this window has focus, disable touch pad pointer gesture processing.\n    //     * The window will receive raw position updates from the touch pad instead\n    //     * of pointer movements and synthetic touch events.\n    //     *\n    //     * @hide\n    //     */\n    //static INPUT_FEATURE_DISABLE_POINTER_GESTURES:number = 0x00000001;\n    //\n    ///**\n    //     * Does not construct an input channel for this window.  The channel will therefore\n    //     * be incapable of receiving input.\n    //     *\n    //     * @hide\n    //     */\n    //static INPUT_FEATURE_NO_INPUT_CHANNEL:number = 0x00000002;\n    //\n    ///**\n    //     * When this window has focus, does not call user activity for all input events so\n    //     * the application will have to do it itself.  Should only be used by\n    //     * the keyguard and phone app.\n    //     * <p>\n    //     * Should only be used by the keyguard and phone app.\n    //     * </p>\n    //     *\n    //     * @hide\n    //     */\n    //static INPUT_FEATURE_DISABLE_USER_ACTIVITY:number = 0x00000004;\n    //\n    ///**\n    //     * Control special features of the input subsystem.\n    //     *\n    //     * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES\n    //     * @see #INPUT_FEATURE_NO_INPUT_CHANNEL\n    //     * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY\n    //     * @hide\n    //     */\n    //inputFeatures:number = 0;\n\n    ///**\n    //     * Sets the number of milliseconds before the user activity timeout occurs\n    //     * when this window has focus.  A value of -1 uses the standard timeout.\n    //     * A value of 0 uses the minimum support display timeout.\n    //     * <p>\n    //     * This property can only be used to reduce the user specified display timeout;\n    //     * it can never make the timeout longer than it normally would be.\n    //     * </p><p>\n    //     * Should only be used by the keyguard and phone app.\n    //     * </p>\n    //     *\n    //     * @hide\n    //     */\n    //userActivityTimeout:number = -1;\n\n    //constructor( ) {\n    //    super(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);\n    //    this.type = LayoutParams.TYPE_APPLICATION;\n    //    this.format = PixelFormat.OPAQUE;\n    //}\n\n    constructor(_type=LayoutParams.TYPE_APPLICATION) {\n        super(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);\n        this.type = _type;\n        //this.format = PixelFormat.OPAQUE;\n    }\n\n    //constructor( _type:number, _flags:number) {\n    //    super(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);\n    //    this.type = _type;\n    //    flags = _flags;\n    //    this.format = PixelFormat.OPAQUE;\n    //}\n    //\n    //constructor( _type:number, _flags:number, _format:number) {\n    //    super(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);\n    //    this.type = _type;\n    //    flags = _flags;\n    //    this.format = _format;\n    //}\n    //\n    //constructor( w:number, h:number, _type:number, _flags:number, _format:number) {\n    //    super(w, h);\n    //    this.type = _type;\n    //    flags = _flags;\n    //    this.format = _format;\n    //}\n\n    //constructor( w:number, h:number, xpos:number, ypos:number, _type:number, _flags:number, _format:number) {\n    //    super(w, h);\n    //    this.x = xpos;\n    //    this.y = ypos;\n    //    this.type = _type;\n    //    flags = _flags;\n    //    this.format = _format;\n    //}\n\n    setTitle(title:string):void  {\n        if (null == title) title = \"\";\n        this.mTitle = title;//TextUtils.stringOrSpannedString(title);\n    }\n\n    getTitle():string  {\n        return this.mTitle;\n    }\n\n    static LAYOUT_CHANGED:number = 1 << 0;\n\n    static TYPE_CHANGED:number = 1 << 1;\n\n    static FLAGS_CHANGED:number = 1 << 2;\n\n    static FORMAT_CHANGED:number = 1 << 3;\n\n    static ANIMATION_CHANGED:number = 1 << 4;\n\n    static DIM_AMOUNT_CHANGED:number = 1 << 5;\n\n    static TITLE_CHANGED:number = 1 << 6;\n\n    static ALPHA_CHANGED:number = 1 << 7;\n    //\n    //static MEMORY_TYPE_CHANGED:number = 1 << 8;\n    //\n    //static SOFT_INPUT_MODE_CHANGED:number = 1 << 9;\n    //\n    //static SCREEN_ORIENTATION_CHANGED:number = 1 << 10;\n    //\n    //static SCREEN_BRIGHTNESS_CHANGED:number = 1 << 11;\n    //\n    //static ROTATION_ANIMATION_CHANGED:number = 1 << 12;\n    //\n    ///** {@hide} */\n    //static BUTTON_BRIGHTNESS_CHANGED:number = 1 << 13;\n    //\n    ///** {@hide} */\n    //static SYSTEM_UI_VISIBILITY_CHANGED:number = 1 << 14;\n    //\n    ///** {@hide} */\n    //static SYSTEM_UI_LISTENER_CHANGED:number = 1 << 15;\n    //\n    ///** {@hide} */\n    //static INPUT_FEATURES_CHANGED:number = 1 << 16;\n    //\n    ///** {@hide} */\n    //static PRIVATE_FLAGS_CHANGED:number = 1 << 17;\n    //\n    ///** {@hide} */\n    //static USER_ACTIVITY_TIMEOUT_CHANGED:number = 1 << 18;\n    //\n    ///** {@hide} */\n    //static TRANSLUCENT_FLAGS_CHANGED:number = 1 << 19;\n    //\n    ///** {@hide} */\n    //static EVERYTHING_CHANGED:number = 0xffffffff;\n    //\n    //// internal buffer to backup/restore parameters under compatibility mode.\n    //private mCompatibilityParamsBackup:number[] = null;\n\n    copyFrom(o:LayoutParams):number  {\n        let changes:number = 0;\n        if (this.width != o.width) {\n            this.width = o.width;\n            changes |= LayoutParams.LAYOUT_CHANGED;\n        }\n        if (this.height != o.height) {\n            this.height = o.height;\n            changes |= LayoutParams.LAYOUT_CHANGED;\n        }\n        if (this.x != o.x) {\n            this.x = o.x;\n            changes |= LayoutParams.LAYOUT_CHANGED;\n        }\n        if (this.y != o.y) {\n            this.y = o.y;\n            changes |= LayoutParams.LAYOUT_CHANGED;\n        }\n        //if (this.horizontalWeight != o.horizontalWeight) {\n        //    this.horizontalWeight = o.horizontalWeight;\n        //    changes |= LayoutParams.LAYOUT_CHANGED;\n        //}\n        //if (this.verticalWeight != o.verticalWeight) {\n        //    this.verticalWeight = o.verticalWeight;\n        //    changes |= LayoutParams.LAYOUT_CHANGED;\n        //}\n        //if (this.horizontalMargin != o.horizontalMargin) {\n        //    this.horizontalMargin = o.horizontalMargin;\n        //    changes |= LayoutParams.LAYOUT_CHANGED;\n        //}\n        //if (this.verticalMargin != o.verticalMargin) {\n        //    this.verticalMargin = o.verticalMargin;\n        //    changes |= LayoutParams.LAYOUT_CHANGED;\n        //}\n        if (this.type != o.type) {\n            this.type = o.type;\n            changes |= LayoutParams.TYPE_CHANGED;\n        }\n        if (this.flags != o.flags) {\n            const diff:number = this.flags ^ o.flags;\n            //if ((diff & (LayoutParams.FLAG_TRANSLUCENT_STATUS | LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)) != 0) {\n            //    changes |= LayoutParams.TRANSLUCENT_FLAGS_CHANGED;\n            //}\n            this.flags = o.flags;\n            changes |= LayoutParams.FLAGS_CHANGED;\n        }\n        //if (this.privateFlags != o.privateFlags) {\n        //    this.privateFlags = o.privateFlags;\n        //    changes |= LayoutParams.PRIVATE_FLAGS_CHANGED;\n        //}\n        //if (this.softInputMode != o.softInputMode) {\n        //    this.softInputMode = o.softInputMode;\n        //    changes |= LayoutParams.SOFT_INPUT_MODE_CHANGED;\n        //}\n        if (this.gravity != o.gravity) {\n            this.gravity = o.gravity;\n            changes |= LayoutParams.LAYOUT_CHANGED;\n        }\n        //if (this.format != o.format) {\n        //    this.format = o.format;\n        //    changes |= LayoutParams.FORMAT_CHANGED;\n        //}\n        //if (this.windowAnimations != o.windowAnimations) {\n        //    this.windowAnimations = o.windowAnimations;\n        //    changes |= LayoutParams.ANIMATION_CHANGED;\n        //}\n        //if (this.token == null) {\n        //    // NOTE: token only copied if the recipient doesn't\n        //    // already have one.\n        //    this.token = o.token;\n        //}\n        //if (this.packageName == null) {\n        //    // NOTE: packageName only copied if the recipient doesn't\n        //    // already have one.\n        //    this.packageName = o.packageName;\n        //}\n        if (this.mTitle != (o.mTitle)) {\n            this.mTitle = o.mTitle;\n            changes |= LayoutParams.TITLE_CHANGED;\n        }\n        //if (this.alpha != o.alpha) {\n        //    this.alpha = o.alpha;\n        //    changes |= LayoutParams.ALPHA_CHANGED;\n        //}\n        if (this.dimAmount != o.dimAmount) {\n            this.dimAmount = o.dimAmount;\n            changes |= LayoutParams.DIM_AMOUNT_CHANGED;\n        }\n        //if (this.screenBrightness != o.screenBrightness) {\n        //    this.screenBrightness = o.screenBrightness;\n        //    changes |= LayoutParams.SCREEN_BRIGHTNESS_CHANGED;\n        //}\n        //if (this.buttonBrightness != o.buttonBrightness) {\n        //    this.buttonBrightness = o.buttonBrightness;\n        //    changes |= LayoutParams.BUTTON_BRIGHTNESS_CHANGED;\n        //}\n        //if (this.rotationAnimation != o.rotationAnimation) {\n        //    this.rotationAnimation = o.rotationAnimation;\n        //    changes |= LayoutParams.ROTATION_ANIMATION_CHANGED;\n        //}\n        //if (this.screenOrientation != o.screenOrientation) {\n        //    this.screenOrientation = o.screenOrientation;\n        //    changes |= LayoutParams.SCREEN_ORIENTATION_CHANGED;\n        //}\n        //if (this.systemUiVisibility != o.systemUiVisibility || this.subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {\n        //    this.systemUiVisibility = o.systemUiVisibility;\n        //    this.subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;\n        //    changes |= LayoutParams.SYSTEM_UI_VISIBILITY_CHANGED;\n        //}\n        //if (this.hasSystemUiListeners != o.hasSystemUiListeners) {\n        //    this.hasSystemUiListeners = o.hasSystemUiListeners;\n        //    changes |= LayoutParams.SYSTEM_UI_LISTENER_CHANGED;\n        //}\n        //if (this.inputFeatures != o.inputFeatures) {\n        //    this.inputFeatures = o.inputFeatures;\n        //    changes |= LayoutParams.INPUT_FEATURES_CHANGED;\n        //}\n        //if (this.userActivityTimeout != o.userActivityTimeout) {\n        //    this.userActivityTimeout = o.userActivityTimeout;\n        //    changes |= LayoutParams.USER_ACTIVITY_TIMEOUT_CHANGED;\n        //}\n        return changes;\n    }\n\n    //debug(output:string):string  {\n    //    output += \"Contents of \" + this + \":\";\n    //    Log.d(\"Debug\", output);\n    //    output = super.debug(\"\");\n    //    Log.d(\"Debug\", output);\n    //    Log.d(\"Debug\", \"\");\n    //    Log.d(\"Debug\", \"WindowManager.LayoutParams={title=\" + this.mTitle + \"}\");\n    //    return \"\";\n    //}\n    //\n    //toString():string  {\n    //    let sb:StringBuilder = new StringBuilder(256);\n    //    sb.append(\"WM.LayoutParams{\");\n    //    sb.append(\"(\");\n    //    sb.append(this.x);\n    //    sb.append(',');\n    //    sb.append(this.y);\n    //    sb.append(\")(\");\n    //    sb.append((this.width == LayoutParams.MATCH_PARENT ? \"fill\" : (this.width == LayoutParams.WRAP_CONTENT ? \"wrap\" : this.width)));\n    //    sb.append('x');\n    //    sb.append((this.height == LayoutParams.MATCH_PARENT ? \"fill\" : (this.height == LayoutParams.WRAP_CONTENT ? \"wrap\" : this.height)));\n    //    sb.append(\")\");\n    //    if (this.horizontalMargin != 0) {\n    //        sb.append(\" hm=\");\n    //        sb.append(this.horizontalMargin);\n    //    }\n    //    if (this.verticalMargin != 0) {\n    //        sb.append(\" vm=\");\n    //        sb.append(this.verticalMargin);\n    //    }\n    //    if (this.gravity != 0) {\n    //        sb.append(\" gr=#\");\n    //        sb.append(Integer.toHexString(this.gravity));\n    //    }\n    //    if (this.softInputMode != 0) {\n    //        sb.append(\" sim=#\");\n    //        sb.append(Integer.toHexString(this.softInputMode));\n    //    }\n    //    sb.append(\" ty=\");\n    //    sb.append(this.type);\n    //    sb.append(\" fl=#\");\n    //    sb.append(Integer.toHexString(this.flags));\n    //    if (this.privateFlags != 0) {\n    //        if ((this.privateFlags & LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) {\n    //            sb.append(\" compatible=true\");\n    //        }\n    //        sb.append(\" pfl=0x\").append(Integer.toHexString(this.privateFlags));\n    //    }\n    //    if (this.format != PixelFormat.OPAQUE) {\n    //        sb.append(\" fmt=\");\n    //        sb.append(this.format);\n    //    }\n    //    if (this.windowAnimations != 0) {\n    //        sb.append(\" wanim=0x\");\n    //        sb.append(Integer.toHexString(this.windowAnimations));\n    //    }\n    //    if (this.screenOrientation != -1){//ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {\n    //        sb.append(\" or=\");\n    //        sb.append(this.screenOrientation);\n    //    }\n    //    if (this.alpha != 1.0) {\n    //        sb.append(\" alpha=\");\n    //        sb.append(this.alpha);\n    //    }\n    //    if (this.screenBrightness != LayoutParams.BRIGHTNESS_OVERRIDE_NONE) {\n    //        sb.append(\" sbrt=\");\n    //        sb.append(this.screenBrightness);\n    //    }\n    //    if (this.buttonBrightness != LayoutParams.BRIGHTNESS_OVERRIDE_NONE) {\n    //        sb.append(\" bbrt=\");\n    //        sb.append(this.buttonBrightness);\n    //    }\n    //    if (this.rotationAnimation != LayoutParams.ROTATION_ANIMATION_ROTATE) {\n    //        sb.append(\" rotAnim=\");\n    //        sb.append(this.rotationAnimation);\n    //    }\n    //    if (this.systemUiVisibility != 0) {\n    //        sb.append(\" sysui=0x\");\n    //        sb.append(Integer.toHexString(this.systemUiVisibility));\n    //    }\n    //    if (this.subtreeSystemUiVisibility != 0) {\n    //        sb.append(\" vsysui=0x\");\n    //        sb.append(Integer.toHexString(this.subtreeSystemUiVisibility));\n    //    }\n    //    if (this.hasSystemUiListeners) {\n    //        sb.append(\" sysuil=\");\n    //        sb.append(this.hasSystemUiListeners);\n    //    }\n    //    if (this.inputFeatures != 0) {\n    //        sb.append(\" if=0x\").append(Integer.toHexString(this.inputFeatures));\n    //    }\n    //    if (this.userActivityTimeout >= 0) {\n    //        sb.append(\" userActivityTimeout=\").append(this.userActivityTimeout);\n    //    }\n    //    sb.append('}');\n    //    return sb.toString();\n    //}\n    //\n    ///**\n    //     * Scale the layout params' coordinates and size.\n    //     * @hide\n    //     */\n    //scale(scale:number):void  {\n    //    this.x = Math.floor((this.x * scale + 0.5));\n    //    this.y = Math.floor((this.y * scale + 0.5));\n    //    if (this.width > 0) {\n    //        this.width = Math.floor((this.width * scale + 0.5));\n    //    }\n    //    if (this.height > 0) {\n    //        this.height = Math.floor((this.height * scale + 0.5));\n    //    }\n    //}\n\n    ///**\n    //     * Backup the layout parameters used in compatibility mode.\n    //     * @see LayoutParams#restore()\n    //     */\n    //backup():void  {\n    //    let backup:number[] = this.mCompatibilityParamsBackup;\n    //    if (backup == null) {\n    //        // we backup 4 elements, x, y, width, height\n    //        backup = this.mCompatibilityParamsBackup = androidui.util.ArrayCreator.newNumberArray(4);\n    //    }\n    //    backup[0] = this.x;\n    //    backup[1] = this.y;\n    //    backup[2] = this.width;\n    //    backup[3] = this.height;\n    //}\n    //\n    ///**\n    //     * Restore the layout params' coordinates, size and gravity\n    //     * @see LayoutParams#backup()\n    //     */\n    //restore():void  {\n    //    let backup:number[] = this.mCompatibilityParamsBackup;\n    //    if (backup != null) {\n    //        this.x = backup[0];\n    //        this.y = backup[1];\n    //        this.width = backup[2];\n    //        this.height = backup[3];\n    //    }\n    //}\n\n    private mTitle:string = \"\";\n\n    private isFocusable():boolean {\n        return (this.flags & LayoutParams.FLAG_NOT_FOCUSABLE) == 0;\n    }\n    private isTouchable():boolean {\n        return (this.flags & LayoutParams.FLAG_NOT_TOUCHABLE) == 0;\n    }\n    private isTouchModal():boolean {\n        return (this.flags & LayoutParams.FLAG_NOT_TOUCH_MODAL) == 0;\n    }\n    private isFloating():boolean {\n        return (this.flags & LayoutParams.FLAG_FLOATING) != 0;\n    }\n    private isSplitTouch():boolean {\n        return (this.flags & LayoutParams.FLAG_SPLIT_TOUCH) != 0;\n    }\n    private isWatchTouchOutside():boolean {\n        return (this.flags & LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH) != 0;\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/view/animation/AccelerateDecelerateInterpolator.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"Interpolator.ts\"/>\n\nmodule android.view.animation{\n    /**\n     * An interpolator where the rate of change starts and ends slowly but\n     * accelerates through the middle.\n     *\n     */\n    export class AccelerateDecelerateInterpolator implements Interpolator{\n        getInterpolation(input:number):number {\n            return (Math.cos((input + 1) * Math.PI) / 2) + 0.5;\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/animation/AccelerateInterpolator.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"Interpolator.ts\"/>\n\nmodule android.view.animation {\n    /**\n     * An interpolator where the rate of change starts out slowly and\n     * and then accelerates.\n     *\n     */\n    export class AccelerateInterpolator implements Interpolator {\n        private mFactor:number;\n        private mDoubleFactor:number;\n\n        /**\n         * Constructor\n         *\n         * @param factor Degree to which the animation should be eased. Seting\n         *        factor to 1.0f produces a y=x^2 parabola. Increasing factor above\n         *        1.0f  exaggerates the ease-in effect (i.e., it starts even\n         *        slower and ends evens faster)\n         */\n        constructor(factor = 1) {\n            this.mFactor = factor;\n            this.mDoubleFactor = factor * 2;\n        }\n\n        getInterpolation(input:number):number {\n\n            if (this.mFactor == 1.0) {\n                return input * input;\n            } else {\n                return Math.pow(input, this.mDoubleFactor);\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/animation/AlphaAnimation.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/view/animation/Animation.ts\"/>\n///<reference path=\"../../../android/view/animation/Transformation.ts\"/>\n\nmodule android.view.animation {\nimport Animation = android.view.animation.Animation;\nimport Transformation = android.view.animation.Transformation;\n/**\n * An animation that controls the alpha level of an object.\n * Useful for fading things in and out. This animation ends up\n * changing the alpha property of a {@link Transformation}\n *\n */\nexport class AlphaAnimation extends Animation {\n\n    private mFromAlpha:number = 0;\n\n    private mToAlpha:number = 0;\n\n    ///**\n    // * Constructor used when an AlphaAnimation is loaded from a resource.\n    // *\n    // * @param context Application context to use\n    // * @param attrs Attribute set from which to read values\n    // */\n    //constructor( context:Context, attrs:AttributeSet) {\n    //    super(context, attrs);\n    //    let a:TypedArray = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.AlphaAnimation);\n    //    this.mFromAlpha = a.getFloat(com.android.internal.R.styleable.AlphaAnimation_fromAlpha, 1.0);\n    //    this.mToAlpha = a.getFloat(com.android.internal.R.styleable.AlphaAnimation_toAlpha, 1.0);\n    //    a.recycle();\n    //}\n\n    /**\n     * Constructor to use when building an AlphaAnimation from code\n     * \n     * @param fromAlpha Starting alpha value for the animation, where 1.0 means\n     *        fully opaque and 0.0 means fully transparent.\n     * @param toAlpha Ending alpha value for the animation.\n     */\n    constructor(fromAlpha:number, toAlpha:number) {\n        super();\n        this.mFromAlpha = fromAlpha;\n        this.mToAlpha = toAlpha;\n    }\n\n    /**\n     * Changes the alpha property of the supplied {@link Transformation}\n     */\n    protected applyTransformation(interpolatedTime:number, t:Transformation):void  {\n        const alpha:number = this.mFromAlpha;\n        t.setAlpha(alpha + ((this.mToAlpha - alpha) * interpolatedTime));\n    }\n\n    willChangeTransformationMatrix():boolean  {\n        return false;\n    }\n\n    willChangeBounds():boolean  {\n        return false;\n    }\n\n    /**\n     * @hide\n     */\n    hasAlpha():boolean  {\n        return true;\n    }\n}\n}"
  },
  {
    "path": "src/android/view/animation/Animation.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/graphics/RectF.ts\"/>\n///<reference path=\"../../../android/os/Handler.ts\"/>\n///<reference path=\"../../../android/util/TypedValue.ts\"/>\n///<reference path=\"../../../java/lang/Long.ts\"/>\n///<reference path=\"../../../java/lang/Runnable.ts\"/>\n///<reference path=\"../../../android/view/animation/AccelerateDecelerateInterpolator.ts\"/>\n///<reference path=\"../../../android/view/animation/AnimationUtils.ts\"/>\n///<reference path=\"../../../android/view/animation/DecelerateInterpolator.ts\"/>\n///<reference path=\"../../../android/view/animation/Interpolator.ts\"/>\n///<reference path=\"../../../android/view/animation/Transformation.ts\"/>\n\nmodule android.view.animation {\nimport RectF = android.graphics.RectF;\nimport Handler = android.os.Handler;\nimport TypedValue = android.util.TypedValue;\nimport Long = java.lang.Long;\nimport Runnable = java.lang.Runnable;\nimport AccelerateDecelerateInterpolator = android.view.animation.AccelerateDecelerateInterpolator;\nimport AnimationUtils = android.view.animation.AnimationUtils;\nimport DecelerateInterpolator = android.view.animation.DecelerateInterpolator;\nimport Interpolator = android.view.animation.Interpolator;\nimport Transformation = android.view.animation.Transformation;\n/**\n * Abstraction for an Animation that can be applied to Views, Surfaces, or\n * other objects. See the {@link android.view.animation animation package\n * description file}.\n */\nexport abstract class Animation {\n\n    /**\n     * Repeat the animation indefinitely.\n     */\n    static INFINITE:number = -1;\n\n    /**\n     * When the animation reaches the end and the repeat count is INFINTE_REPEAT\n     * or a positive value, the animation restarts from the beginning.\n     */\n    static RESTART:number = 1;\n\n    /**\n     * When the animation reaches the end and the repeat count is INFINTE_REPEAT\n     * or a positive value, the animation plays backward (and then forward again).\n     */\n    static REVERSE:number = 2;\n\n    /**\n     * Can be used as the start time to indicate the start time should be the current\n     * time when {@link #getTransformation(long, Transformation)} is invoked for the\n     * first animation frame. This can is useful for short animations.\n     */\n    static START_ON_FIRST_FRAME:number = -1;\n\n    /**\n     * The specified dimension is an absolute number of pixels.\n     */\n    static ABSOLUTE:number = 0;\n\n    /**\n     * The specified dimension holds a float and should be multiplied by the\n     * height or width of the object being animated.\n     */\n    static RELATIVE_TO_SELF:number = 1;\n\n    /**\n     * The specified dimension holds a float and should be multiplied by the\n     * height or width of the parent of the object being animated.\n     */\n    static RELATIVE_TO_PARENT:number = 2;\n\n    /**\n     * Requests that the content being animated be kept in its current Z\n     * order.\n     */\n    static ZORDER_NORMAL:number = 0;\n\n    /**\n     * Requests that the content being animated be forced on top of all other\n     * content for the duration of the animation.\n     */\n    static ZORDER_TOP:number = 1;\n\n    /**\n     * Requests that the content being animated be forced under all other\n     * content for the duration of the animation.\n     */\n    static ZORDER_BOTTOM:number = -1;\n\n    private static USE_CLOSEGUARD:boolean = false;//SystemProperties.getBoolean(\"log.closeguard.Animation\", false);\n\n    /**\n     * Set by {@link #getTransformation(long, Transformation)} when the animation ends.\n     */\n    mEnded:boolean = false;\n\n    /**\n     * Set by {@link #getTransformation(long, Transformation)} when the animation starts.\n     */\n    mStarted:boolean = false;\n\n    /**\n     * Set by {@link #getTransformation(long, Transformation)} when the animation repeats\n     * in REVERSE mode.\n     */\n    mCycleFlip:boolean = false;\n\n    /**\n     * This value must be set to true by {@link #initialize(int, int, int, int)}. It\n     * indicates the animation was successfully initialized and can be played.\n     */\n    mInitialized:boolean = false;\n\n    /**\n     * Indicates whether the animation transformation should be applied before the\n     * animation starts. The value of this variable is only relevant if mFillEnabled is true;\n     * otherwise it is assumed to be true.\n     */\n    mFillBefore:boolean = true;\n\n    /**\n     * Indicates whether the animation transformation should be applied after the\n     * animation ends.\n     */\n    mFillAfter:boolean = false;\n\n    /**\n     * Indicates whether fillBefore should be taken into account.\n     */\n    mFillEnabled:boolean = false;\n\n    /**\n     * The time in milliseconds at which the animation must start;\n     */\n    mStartTime:number = -1;\n\n    /**\n     * The delay in milliseconds after which the animation must start. When the\n     * start offset is > 0, the start time of the animation is startTime + startOffset.\n     */\n    mStartOffset:number = 0;\n\n    /**\n     * The duration of one animation cycle in milliseconds.\n     */\n    mDuration:number = 0;\n\n    /**\n     * The number of times the animation must repeat. By default, an animation repeats\n     * indefinitely.\n     */\n    mRepeatCount:number = 0;\n\n    /**\n     * Indicates how many times the animation was repeated.\n     */\n    mRepeated:number = 0;\n\n    /**\n     * The behavior of the animation when it repeats. The repeat mode is either\n     * {@link #RESTART} or {@link #REVERSE}.\n     *\n     */\n    mRepeatMode:number = Animation.RESTART;\n\n    /**\n     * The interpolator used by the animation to smooth the movement.\n     */\n    mInterpolator:Interpolator;\n\n    /**\n     * The animation listener to be notified when the animation starts, ends or repeats.\n     */\n    mListener:Animation.AnimationListener;\n\n    /**\n     * Desired Z order mode during animation.\n     */\n    private mZAdjustment:number = 0;\n\n    /**\n     * Desired background color behind animation.\n     */\n    private mBackgroundColor:number = 0;\n\n    /**\n     * scalefactor to apply to pivot points, etc. during animation. Subclasses retrieve the\n     * value via getScaleFactor().\n     */\n    private mScaleFactor:number = 1;\n\n    /**\n     * Don't animate the wallpaper.\n     */\n    private mDetachWallpaper:boolean = false;\n\n    private mMore:boolean = true;\n\n    private mOneMoreTime:boolean = true;\n\n    mPreviousRegion:RectF = new RectF();\n\n    mRegion:RectF = new RectF();\n\n    mTransformation:Transformation = new Transformation();\n\n    mPreviousTransformation:Transformation = new Transformation();\n\n    //private guard:CloseGuard = CloseGuard.get();\n\n    private mListenerHandler:Handler;\n\n    private mOnStart:Runnable;\n\n    private mOnRepeat:Runnable;\n\n    private mOnEnd:Runnable;\n\n    /**\n     * Creates a new animation with a duration of 0ms, the default interpolator, with\n     * fillBefore set to true and fillAfter set to false\n     */\n    constructor() {\n        this.ensureInterpolator();\n    }\n\n    //protected clone():Animation  {\n    //    const animation:Animation = <Animation> super.clone();\n    //    animation.mPreviousRegion = new RectF();\n    //    animation.mRegion = new RectF();\n    //    animation.mTransformation = new Transformation();\n    //    animation.mPreviousTransformation = new Transformation();\n    //    return animation;\n    //}\n\n    /**\n     * Reset the initialization state of this animation.\n     *\n     * @see #initialize(int, int, int, int)\n     */\n    reset():void  {\n        this.mPreviousRegion.setEmpty();\n        this.mPreviousTransformation.clear();\n        this.mInitialized = false;\n        this.mCycleFlip = false;\n        this.mRepeated = 0;\n        this.mMore = true;\n        this.mOneMoreTime = true;\n        this.mListenerHandler = null;\n    }\n\n    /**\n     * Cancel the animation. Cancelling an animation invokes the animation\n     * listener, if set, to notify the end of the animation.\n     * \n     * If you cancel an animation manually, you must call {@link #reset()}\n     * before starting the animation again.\n     * \n     * @see #reset() \n     * @see #start() \n     * @see #startNow() \n     */\n    cancel():void  {\n        if (this.mStarted && !this.mEnded) {\n            this.fireAnimationEnd();\n            this.mEnded = true;\n            //this.guard.close();\n        }\n        // Make sure we move the animation to the end\n        this.mStartTime = Long.MIN_VALUE;\n        this.mMore = this.mOneMoreTime = false;\n    }\n\n    /**\n     * @hide\n     */\n    detach():void  {\n        if (this.mStarted && !this.mEnded) {\n            this.mEnded = true;\n            //this.guard.close();\n            this.fireAnimationEnd();\n        }\n    }\n\n    /**\n     * Whether or not the animation has been initialized.\n     *\n     * @return Has this animation been initialized.\n     * @see #initialize(int, int, int, int)\n     */\n    isInitialized():boolean  {\n        return this.mInitialized;\n    }\n\n    /**\n     * Initialize this animation with the dimensions of the object being\n     * animated as well as the objects parents. (This is to support animation\n     * sizes being specified relative to these dimensions.)\n     *\n     * <p>Objects that interpret Animations should call this method when\n     * the sizes of the object being animated and its parent are known, and\n     * before calling {@link #getTransformation}.\n     *\n     *\n     * @param width Width of the object being animated\n     * @param height Height of the object being animated\n     * @param parentWidth Width of the animated object's parent\n     * @param parentHeight Height of the animated object's parent\n     */\n    initialize(width:number, height:number, parentWidth:number, parentHeight:number):void  {\n        this.reset();\n        this.mInitialized = true;\n    }\n\n    /**\n     * Sets the handler used to invoke listeners.\n     * \n     * @hide\n     */\n    setListenerHandler(handler:Handler):void  {\n        if (this.mListenerHandler == null) {\n            const inner_this=this;\n            this.mOnStart = {\n                run():void  {\n                    if (inner_this.mListener != null) {\n                        inner_this.mListener.onAnimationStart(inner_this);\n                    }\n                }\n            };\n            this.mOnRepeat = {\n                run():void  {\n                    if (inner_this.mListener != null) {\n                        inner_this.mListener.onAnimationRepeat(inner_this);\n                    }\n                }\n            };\n            this.mOnEnd = {\n                run():void  {\n                    if (inner_this.mListener != null) {\n                        inner_this.mListener.onAnimationEnd(inner_this);\n                    }\n                }\n            };\n        }\n        this.mListenerHandler = handler;\n    }\n\n    /**\n     * Sets the acceleration curve for this animation. Defaults to a linear\n     * interpolation.\n     *\n     * @param i The interpolator which defines the acceleration curve\n     * @attr ref android.R.styleable#Animation_interpolator\n     */\n    setInterpolator(i:Interpolator):void  {\n        this.mInterpolator = i;\n    }\n\n    /**\n     * When this animation should start relative to the start time. This is most\n     * useful when composing complex animations using an {@link AnimationSet }\n     * where some of the animations components start at different times.\n     *\n     * @param startOffset When this Animation should start, in milliseconds from\n     *                    the start time of the root AnimationSet.\n     * @attr ref android.R.styleable#Animation_startOffset\n     */\n    setStartOffset(startOffset:number):void  {\n        this.mStartOffset = startOffset;\n    }\n\n    /**\n     * How long this animation should last. The duration cannot be negative.\n     * \n     * @param durationMillis Duration in milliseconds\n     *\n     * @throws java.lang.IllegalArgumentException if the duration is < 0\n     *\n     * @attr ref android.R.styleable#Animation_duration\n     */\n    setDuration(durationMillis:number):void  {\n        if (durationMillis < 0) {\n            throw Error(`new IllegalArgumentException(\"Animation duration cannot be negative\")`);\n        }\n        this.mDuration = durationMillis;\n    }\n\n    /**\n     * Ensure that the duration that this animation will run is not longer\n     * than <var>durationMillis</var>.  In addition to adjusting the duration\n     * itself, this ensures that the repeat count also will not make it run\n     * longer than the given time.\n     * \n     * @param durationMillis The maximum duration the animation is allowed\n     * to run.\n     */\n    restrictDuration(durationMillis:number):void  {\n        // If we start after the duration, then we just won't run.\n        if (this.mStartOffset > durationMillis) {\n            this.mStartOffset = durationMillis;\n            this.mDuration = 0;\n            this.mRepeatCount = 0;\n            return;\n        }\n        let dur:number = this.mDuration + this.mStartOffset;\n        if (dur > durationMillis) {\n            this.mDuration = durationMillis - this.mStartOffset;\n            dur = durationMillis;\n        }\n        // If the duration is 0 or less, then we won't run.\n        if (this.mDuration <= 0) {\n            this.mDuration = 0;\n            this.mRepeatCount = 0;\n            return;\n        }\n        // overflows after multiplying them.\n        if (this.mRepeatCount < 0 || this.mRepeatCount > durationMillis || (dur * this.mRepeatCount) > durationMillis) {\n            // Figure out how many times to do the animation.  Subtract 1 since\n            // repeat count is the number of times to repeat so 0 runs once.\n            this.mRepeatCount = Math.floor((durationMillis / dur)) - 1;\n            if (this.mRepeatCount < 0) {\n                this.mRepeatCount = 0;\n            }\n        }\n    }\n\n    /**\n     * How much to scale the duration by.\n     *\n     * @param scale The amount to scale the duration.\n     */\n    scaleCurrentDuration(scale:number):void  {\n        this.mDuration = Math.floor((this.mDuration * scale));\n        this.mStartOffset = Math.floor((this.mStartOffset * scale));\n    }\n\n    /**\n     * When this animation should start. When the start time is set to\n     * {@link #START_ON_FIRST_FRAME}, the animation will start the first time\n     * {@link #getTransformation(long, Transformation)} is invoked. The time passed\n     * to this method should be obtained by calling\n     * {@link AnimationUtils#currentAnimationTimeMillis()} instead of\n     * {@link System#currentTimeMillis()}.\n     *\n     * @param startTimeMillis the start time in milliseconds\n     */\n    setStartTime(startTimeMillis:number):void  {\n        this.mStartTime = startTimeMillis;\n        this.mStarted = this.mEnded = false;\n        this.mCycleFlip = false;\n        this.mRepeated = 0;\n        this.mMore = true;\n    }\n\n    /**\n     * Convenience method to start the animation the first time\n     * {@link #getTransformation(long, Transformation)} is invoked.\n     */\n    start():void  {\n        this.setStartTime(-1);\n    }\n\n    /**\n     * Convenience method to start the animation at the current time in\n     * milliseconds.\n     */\n    startNow():void  {\n        this.setStartTime(AnimationUtils.currentAnimationTimeMillis());\n    }\n\n    /**\n     * Defines what this animation should do when it reaches the end. This\n     * setting is applied only when the repeat count is either greater than\n     * 0 or {@link #INFINITE}. Defaults to {@link #RESTART}. \n     *\n     * @param repeatMode {@link #RESTART} or {@link #REVERSE}\n     * @attr ref android.R.styleable#Animation_repeatMode\n     */\n    setRepeatMode(repeatMode:number):void  {\n        this.mRepeatMode = repeatMode;\n    }\n\n    /**\n     * Sets how many times the animation should be repeated. If the repeat\n     * count is 0, the animation is never repeated. If the repeat count is\n     * greater than 0 or {@link #INFINITE}, the repeat mode will be taken\n     * into account. The repeat count is 0 by default.\n     *\n     * @param repeatCount the number of times the animation should be repeated\n     * @attr ref android.R.styleable#Animation_repeatCount\n     */\n    setRepeatCount(repeatCount:number):void  {\n        if (repeatCount < 0) {\n            repeatCount = Animation.INFINITE;\n        }\n        this.mRepeatCount = repeatCount;\n    }\n\n    /**\n     * If fillEnabled is true, this animation will apply the value of fillBefore.\n     *\n     * @return true if the animation will take fillBefore into account\n     * @attr ref android.R.styleable#Animation_fillEnabled\n     */\n    isFillEnabled():boolean  {\n        return this.mFillEnabled;\n    }\n\n    /**\n     * If fillEnabled is true, the animation will apply the value of fillBefore.\n     * Otherwise, fillBefore is ignored and the animation\n     * transformation is always applied until the animation ends.\n     *\n     * @param fillEnabled true if the animation should take the value of fillBefore into account\n     * @attr ref android.R.styleable#Animation_fillEnabled\n     *\n     * @see #setFillBefore(boolean)\n     * @see #setFillAfter(boolean)\n     */\n    setFillEnabled(fillEnabled:boolean):void  {\n        this.mFillEnabled = fillEnabled;\n    }\n\n    /**\n     * If fillBefore is true, this animation will apply its transformation\n     * before the start time of the animation. Defaults to true if\n     * {@link #setFillEnabled(boolean)} is not set to true.\n     * Note that this applies when using an {@link\n     * android.view.animation.AnimationSet AnimationSet} to chain\n     * animations. The transformation is not applied before the AnimationSet\n     * itself starts.\n     *\n     * @param fillBefore true if the animation should apply its transformation before it starts\n     * @attr ref android.R.styleable#Animation_fillBefore\n     *\n     * @see #setFillEnabled(boolean)\n     */\n    setFillBefore(fillBefore:boolean):void  {\n        this.mFillBefore = fillBefore;\n    }\n\n    /**\n     * If fillAfter is true, the transformation that this animation performed\n     * will persist when it is finished. Defaults to false if not set.\n     * Note that this applies to individual animations and when using an {@link\n     * android.view.animation.AnimationSet AnimationSet} to chain\n     * animations.\n     *\n     * @param fillAfter true if the animation should apply its transformation after it ends\n     * @attr ref android.R.styleable#Animation_fillAfter\n     *\n     * @see #setFillEnabled(boolean) \n     */\n    setFillAfter(fillAfter:boolean):void  {\n        this.mFillAfter = fillAfter;\n    }\n\n    /**\n     * Set the Z ordering mode to use while running the animation.\n     * \n     * @param zAdjustment The desired mode, one of {@link #ZORDER_NORMAL},\n     * {@link #ZORDER_TOP}, or {@link #ZORDER_BOTTOM}.\n     * @attr ref android.R.styleable#Animation_zAdjustment\n     */\n    setZAdjustment(zAdjustment:number):void  {\n        this.mZAdjustment = zAdjustment;\n    }\n\n    /**\n     * Set background behind animation.\n     *\n     * @param bg The background color.  If 0, no background.  Currently must\n     * be black, with any desired alpha level.\n     */\n    setBackgroundColor(bg:number):void  {\n        this.mBackgroundColor = bg;\n    }\n\n    /**\n     * The scale factor is set by the call to <code>getTransformation</code>. Overrides of \n     * {@link #getTransformation(long, Transformation, float)} will get this value\n     * directly. Overrides of {@link #applyTransformation(float, Transformation)} can\n     * call this method to get the value.\n     * \n     * @return float The scale factor that should be applied to pre-scaled values in\n     * an Animation such as the pivot points in {@link ScaleAnimation} and {@link RotateAnimation}.\n     */\n    protected getScaleFactor():number  {\n        return this.mScaleFactor;\n    }\n\n    /**\n     * If detachWallpaper is true, and this is a window animation of a window\n     * that has a wallpaper background, then the window will be detached from\n     * the wallpaper while it runs.  That is, the animation will only be applied\n     * to the window, and the wallpaper behind it will remain static.\n     *\n     * @param detachWallpaper true if the wallpaper should be detached from the animation\n     * @attr ref android.R.styleable#Animation_detachWallpaper\n     */\n    setDetachWallpaper(detachWallpaper:boolean):void  {\n        this.mDetachWallpaper = detachWallpaper;\n    }\n\n    /**\n     * Gets the acceleration curve type for this animation.\n     *\n     * @return the {@link Interpolator} associated to this animation\n     * @attr ref android.R.styleable#Animation_interpolator\n     */\n    getInterpolator():Interpolator  {\n        return this.mInterpolator;\n    }\n\n    /**\n     * When this animation should start. If the animation has not startet yet,\n     * this method might return {@link #START_ON_FIRST_FRAME}.\n     *\n     * @return the time in milliseconds when the animation should start or\n     *         {@link #START_ON_FIRST_FRAME}\n     */\n    getStartTime():number  {\n        return this.mStartTime;\n    }\n\n    /**\n     * How long this animation should last\n     *\n     * @return the duration in milliseconds of the animation\n     * @attr ref android.R.styleable#Animation_duration\n     */\n    getDuration():number  {\n        return this.mDuration;\n    }\n\n    /**\n     * When this animation should start, relative to StartTime\n     *\n     * @return the start offset in milliseconds\n     * @attr ref android.R.styleable#Animation_startOffset\n     */\n    getStartOffset():number  {\n        return this.mStartOffset;\n    }\n\n    /**\n     * Defines what this animation should do when it reaches the end.\n     *\n     * @return either one of {@link #REVERSE} or {@link #RESTART}\n     * @attr ref android.R.styleable#Animation_repeatMode\n     */\n    getRepeatMode():number  {\n        return this.mRepeatMode;\n    }\n\n    /**\n     * Defines how many times the animation should repeat. The default value\n     * is 0.\n     *\n     * @return the number of times the animation should repeat, or {@link #INFINITE}\n     * @attr ref android.R.styleable#Animation_repeatCount\n     */\n    getRepeatCount():number  {\n        return this.mRepeatCount;\n    }\n\n    /**\n     * If fillBefore is true, this animation will apply its transformation\n     * before the start time of the animation. If fillBefore is false and\n     * {@link #isFillEnabled() fillEnabled} is true, the transformation will not be applied until\n     * the start time of the animation.\n     *\n     * @return true if the animation applies its transformation before it starts\n     * @attr ref android.R.styleable#Animation_fillBefore\n     */\n    getFillBefore():boolean  {\n        return this.mFillBefore;\n    }\n\n    /**\n     * If fillAfter is true, this animation will apply its transformation\n     * after the end time of the animation.\n     *\n     * @return true if the animation applies its transformation after it ends\n     * @attr ref android.R.styleable#Animation_fillAfter\n     */\n    getFillAfter():boolean  {\n        return this.mFillAfter;\n    }\n\n    /**\n     * Returns the Z ordering mode to use while running the animation as\n     * previously set by {@link #setZAdjustment}.\n     * \n     * @return Returns one of {@link #ZORDER_NORMAL},\n     * {@link #ZORDER_TOP}, or {@link #ZORDER_BOTTOM}.\n     * @attr ref android.R.styleable#Animation_zAdjustment\n     */\n    getZAdjustment():number  {\n        return this.mZAdjustment;\n    }\n\n    /**\n     * Returns the background color behind the animation.\n     */\n    getBackgroundColor():number  {\n        return this.mBackgroundColor;\n    }\n\n    /**\n     * Return value of {@link #setDetachWallpaper(boolean)}.\n     * @attr ref android.R.styleable#Animation_detachWallpaper\n     */\n    getDetachWallpaper():boolean  {\n        return this.mDetachWallpaper;\n    }\n\n    /**\n     * <p>Indicates whether or not this animation will affect the transformation\n     * matrix. For instance, a fade animation will not affect the matrix whereas\n     * a scale animation will.</p>\n     *\n     * @return true if this animation will change the transformation matrix\n     */\n    willChangeTransformationMatrix():boolean  {\n        // assume we will change the matrix\n        return true;\n    }\n\n    /**\n     * <p>Indicates whether or not this animation will affect the bounds of the\n     * animated view. For instance, a fade animation will not affect the bounds\n     * whereas a 200% scale animation will.</p>\n     *\n     * @return true if this animation will change the view's bounds\n     */\n    willChangeBounds():boolean  {\n        // assume we will change the bounds\n        return true;\n    }\n\n    /**\n     * <p>Binds an animation listener to this animation. The animation listener\n     * is notified of animation events such as the end of the animation or the\n     * repetition of the animation.</p>\n     *\n     * @param listener the animation listener to be notified\n     */\n    setAnimationListener(listener:Animation.AnimationListener):void  {\n        this.mListener = listener;\n    }\n\n    /**\n     * Gurantees that this animation has an interpolator. Will use\n     * a AccelerateDecelerateInterpolator is nothing else was specified.\n     */\n    protected ensureInterpolator():void  {\n        if (this.mInterpolator == null) {\n            this.mInterpolator = new AccelerateDecelerateInterpolator();\n        }\n    }\n\n    /**\n     * Compute a hint at how long the entire animation may last, in milliseconds.\n     * Animations can be written to cause themselves to run for a different\n     * duration than what is computed here, but generally this should be\n     * accurate.\n     */\n    computeDurationHint():number  {\n        return (this.getStartOffset() + this.getDuration()) * (this.getRepeatCount() + 1);\n    }\n\n    /**\n     * Gets the transformation to apply at a specified point in time. Implementations of this\n     * method should always replace the specified Transformation or document they are doing\n     * otherwise.\n     *\n     * @param currentTime Where we are in the animation. This is wall clock time.\n     * @param outTransformation A transformation object that is provided by the\n     *        caller and will be filled in by the animation.\n     * @param scale Scaling factor to apply to any inputs to the transform operation, such\n     *        pivot points being rotated or scaled around.\n     * @return True if the animation is still running\n     */\n    getTransformation(currentTime:number, outTransformation:Transformation, scale?:number):boolean  {\n        if(scale!=null) this.mScaleFactor = scale;\n\n        if (this.mStartTime == -1) {\n            this.mStartTime = currentTime;\n        }\n        const startOffset:number = this.getStartOffset();\n        const duration:number = this.mDuration;\n        let normalizedTime:number;\n        if (duration != 0) {\n            normalizedTime = (<number> (currentTime - (this.mStartTime + startOffset))) / <number> duration;\n        } else {\n            // time is a step-change with a zero duration\n            normalizedTime = currentTime < this.mStartTime ? 0.0 : 1.0;\n        }\n        const expired:boolean = normalizedTime >= 1.0;\n        this.mMore = !expired;\n        if (!this.mFillEnabled)\n            normalizedTime = Math.max(Math.min(normalizedTime, 1.0), 0.0);\n        if ((normalizedTime >= 0.0 || this.mFillBefore) && (normalizedTime <= 1.0 || this.mFillAfter)) {\n            if (!this.mStarted) {\n                this.fireAnimationStart();\n                this.mStarted = true;\n                //if (Animation.USE_CLOSEGUARD) {\n                //    this.guard.open(\"cancel or detach or getTransformation\");\n                //}\n            }\n            if (this.mFillEnabled)\n                normalizedTime = Math.max(Math.min(normalizedTime, 1.0), 0.0);\n            if (this.mCycleFlip) {\n                normalizedTime = 1.0 - normalizedTime;\n            }\n            const interpolatedTime:number = this.mInterpolator.getInterpolation(normalizedTime);\n            this.applyTransformation(interpolatedTime, outTransformation);\n        }\n        if (expired) {\n            if (this.mRepeatCount == this.mRepeated) {\n                if (!this.mEnded) {\n                    this.mEnded = true;\n                    //this.guard.close();\n                    this.fireAnimationEnd();\n                }\n            } else {\n                if (this.mRepeatCount > 0) {\n                    this.mRepeated++;\n                }\n                if (this.mRepeatMode == Animation.REVERSE) {\n                    this.mCycleFlip = !this.mCycleFlip;\n                }\n                this.mStartTime = -1;\n                this.mMore = true;\n                this.fireAnimationRepeat();\n            }\n        }\n        if (!this.mMore && this.mOneMoreTime) {\n            this.mOneMoreTime = false;\n            return true;\n        }\n        return this.mMore;\n    }\n\n    private fireAnimationStart():void  {\n        if (this.mListener != null) {\n            if (this.mListenerHandler == null)\n                this.mListener.onAnimationStart(this);\n            else\n                this.mListenerHandler.postAtFrontOfQueue(this.mOnStart);\n        }\n    }\n\n    private fireAnimationRepeat():void  {\n        if (this.mListener != null) {\n            if (this.mListenerHandler == null)\n                this.mListener.onAnimationRepeat(this);\n            else\n                this.mListenerHandler.postAtFrontOfQueue(this.mOnRepeat);\n        }\n    }\n\n    private fireAnimationEnd():void  {\n        if (this.mListener != null) {\n            if (this.mListenerHandler == null)\n                this.mListener.onAnimationEnd(this);\n            else\n                this.mListenerHandler.postAtFrontOfQueue(this.mOnEnd);\n        }\n    }\n\n    /**\n     * <p>Indicates whether this animation has started or not.</p>\n     *\n     * @return true if the animation has started, false otherwise\n     */\n    hasStarted():boolean  {\n        return this.mStarted;\n    }\n\n    /**\n     * <p>Indicates whether this animation has ended or not.</p>\n     *\n     * @return true if the animation has ended, false otherwise\n     */\n    hasEnded():boolean  {\n        return this.mEnded;\n    }\n\n    /**\n     * Helper for getTransformation. Subclasses should implement this to apply\n     * their transforms given an interpolation value.  Implementations of this\n     * method should always replace the specified Transformation or document\n     * they are doing otherwise.\n     * \n     * @param interpolatedTime The value of the normalized time (0.0 to 1.0)\n     *        after it has been run through the interpolation function.\n     * @param t The Transformation object to fill in with the current\n     *        transforms.\n     */\n    protected applyTransformation(interpolatedTime:number, t:Transformation):void  {\n    }\n\n    /**\n     * Convert the information in the description of a size to an actual\n     * dimension\n     *\n     * @param type One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or\n     *             Animation.RELATIVE_TO_PARENT.\n     * @param value The dimension associated with the type parameter\n     * @param size The size of the object being animated\n     * @param parentSize The size of the parent of the object being animated\n     * @return The dimension to use for the animation\n     */\n    protected resolveSize(type:number, value:number, size:number, parentSize:number):number  {\n        switch(type) {\n            case Animation.ABSOLUTE:\n                return value;\n            case Animation.RELATIVE_TO_SELF:\n                return size * value;\n            case Animation.RELATIVE_TO_PARENT:\n                return parentSize * value;\n            default:\n                return value;\n        }\n    }\n\n    /**\n     * @param left\n     * @param top\n     * @param right\n     * @param bottom\n     * @param invalidate\n     * @param transformation\n     * \n     * @hide\n     */\n    getInvalidateRegion(left:number, top:number, right:number, bottom:number, invalidate:RectF, transformation:Transformation):void  {\n        const tempRegion:RectF = this.mRegion;\n        const previousRegion:RectF = this.mPreviousRegion;\n        invalidate.set(left, top, right, bottom);\n        transformation.getMatrix().mapRect(invalidate);\n        // Enlarge the invalidate region to account for rounding errors\n        invalidate.inset(-1.0, -1.0);\n        tempRegion.set(invalidate);\n        invalidate.union(previousRegion);\n        previousRegion.set(tempRegion);\n        const tempTransformation:Transformation = this.mTransformation;\n        const previousTransformation:Transformation = this.mPreviousTransformation;\n        tempTransformation.set(transformation);\n        transformation.set(previousTransformation);\n        previousTransformation.set(tempTransformation);\n    }\n\n    /**\n     * @param left\n     * @param top\n     * @param right\n     * @param bottom\n     *\n     * @hide\n     */\n    initializeInvalidateRegion(left:number, top:number, right:number, bottom:number):void  {\n        const region:RectF = this.mPreviousRegion;\n        region.set(left, top, right, bottom);\n        // Enlarge the invalidate region to account for rounding errors\n        region.inset(-1.0, -1.0);\n        if (this.mFillBefore) {\n            const previousTransformation:Transformation = this.mPreviousTransformation;\n            this.applyTransformation(this.mInterpolator.getInterpolation(0.0), previousTransformation);\n        }\n    }\n\n    //protected finalize():void  {\n    //    try {\n    //        if (this.guard != null) {\n    //            this.guard.warnIfOpen();\n    //        }\n    //    } finally {\n    //        super.finalize();\n    //    }\n    //}\n\n    /**\n     * Return true if this animation changes the view's alpha property.\n     * \n     * @hide\n     */\n    hasAlpha():boolean  {\n        return false;\n    }\n\n\n\n\n}\n\nexport module Animation{\n/**\n     * Utility class to parse a string description of a size.\n     */\nexport class Description {\n\n    /**\n         * One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or\n         * Animation.RELATIVE_TO_PARENT.\n         */\n    type:number = 0;\n\n    /**\n         * The absolute or relative dimension for this Description.\n         */\n    value:number = 0;\n\n    /**\n         * Size descriptions can appear inthree forms:\n         * <ol>\n         * <li>An absolute size. This is represented by a number.</li>\n         * <li>A size relative to the size of the object being animated. This\n         * is represented by a number followed by \"%\".</li> *\n         * <li>A size relative to the size of the parent of object being\n         * animated. This is represented by a number followed by \"%p\".</li>\n         * </ol>\n         * @param value The typed value to parse\n         * @return The parsed version of the description\n         */\n    static parseValue(value:string):Description  {\n        let d:Description = new Description();\n        if (value == null) {\n            d.type = Animation.ABSOLUTE;\n            d.value = 0;\n        } else {\n            if(value.endsWith('%p')){\n                d.type = Animation.RELATIVE_TO_PARENT;\n                d.value = Number.parseFloat(value.substring(0, value.length-2));\n            }else if(value.endsWith('%')){\n                d.type = Animation.RELATIVE_TO_SELF;\n                d.value = Number.parseFloat(value.substring(0, value.length-1));\n            }else{\n                d.type = Animation.ABSOLUTE;\n                d.value = TypedValue.complexToDimensionPixelSize(value);\n            }\n        }\n        d.type = Animation.ABSOLUTE;\n        d.value = 0.0;\n        return d;\n    }\n}\n/**\n     * <p>An animation listener receives notifications from an animation.\n     * Notifications indicate animation related events, such as the end or the\n     * repetition of the animation.</p>\n     */\nexport interface AnimationListener {\n\n    /**\n         * <p>Notifies the start of the animation.</p>\n         *\n         * @param animation The started animation.\n         */\n    onAnimationStart(animation:Animation):void ;\n\n    /**\n         * <p>Notifies the end of the animation. This callback is not invoked\n         * for animations with repeat count set to INFINITE.</p>\n         *\n         * @param animation The animation which reached its end.\n         */\n    onAnimationEnd(animation:Animation):void ;\n\n    /**\n         * <p>Notifies the repetition of the animation.</p>\n         *\n         * @param animation The animation which was repeated.\n         */\n    onAnimationRepeat(animation:Animation):void ;\n}\n}\n\n}"
  },
  {
    "path": "src/android/view/animation/AnimationSet.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/graphics/RectF.ts\"/>\n///<reference path=\"../../../java/util/ArrayList.ts\"/>\n///<reference path=\"../../../java/util/List.ts\"/>\n///<reference path=\"../../../java/lang/Long.ts\"/>\n///<reference path=\"../../../android/view/animation/Animation.ts\"/>\n///<reference path=\"../../../android/view/animation/Interpolator.ts\"/>\n///<reference path=\"../../../android/view/animation/Transformation.ts\"/>\n\nmodule android.view.animation {\nimport RectF = android.graphics.RectF;\nimport ArrayList = java.util.ArrayList;\nimport List = java.util.List;\nimport Long = java.lang.Long;\nimport Animation = android.view.animation.Animation;\nimport Interpolator = android.view.animation.Interpolator;\nimport Transformation = android.view.animation.Transformation;\n/**\n * Represents a group of Animations that should be played together.\n * The transformation of each individual animation are composed \n * together into a single transform. \n * If AnimationSet sets any properties that its children also set\n * (for example, duration or fillBefore), the values of AnimationSet\n * override the child values.\n *\n * <p>The way that AnimationSet inherits behavior from Animation is important to\n * understand. Some of the Animation attributes applied to AnimationSet affect the\n * AnimationSet itself, some are pushed down to the children, and some are ignored,\n * as follows:\n * <ul>\n *     <li>duration, repeatMode, fillBefore, fillAfter: These properties, when set\n *     on an AnimationSet object, will be pushed down to all child animations.</li>\n *     <li>repeatCount, fillEnabled: These properties are ignored for AnimationSet.</li>\n *     <li>startOffset, shareInterpolator: These properties apply to the AnimationSet itself.</li>\n * </ul>\n * Starting with {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH},\n * the behavior of these properties is the same in XML resources and at runtime (prior to that\n * release, the values set in XML were ignored for AnimationSet). That is, calling\n * <code>setDuration(500)</code> on an AnimationSet has the same effect as declaring\n * <code>android:duration=\"500\"</code> in an XML resource for an AnimationSet object.</p>\n */\nexport class AnimationSet extends Animation {\n\n    private static PROPERTY_FILL_AFTER_MASK:number = 0x1;\n\n    private static PROPERTY_FILL_BEFORE_MASK:number = 0x2;\n\n    private static PROPERTY_REPEAT_MODE_MASK:number = 0x4;\n\n    private static PROPERTY_START_OFFSET_MASK:number = 0x8;\n\n    private static PROPERTY_SHARE_INTERPOLATOR_MASK:number = 0x10;\n\n    private static PROPERTY_DURATION_MASK:number = 0x20;\n\n    private static PROPERTY_MORPH_MATRIX_MASK:number = 0x40;\n\n    private static PROPERTY_CHANGE_BOUNDS_MASK:number = 0x80;\n\n    private mFlags:number = 0;\n\n    private mDirty:boolean;\n\n    private mHasAlpha:boolean;\n\n    private mAnimations:ArrayList<Animation> = new ArrayList<Animation>();\n\n    private mTempTransformation:Transformation = new Transformation();\n\n    private mLastEnd:number = 0;\n\n    private mStoredOffsets:number[];\n\n    ///**\n    // * Constructor used when an AnimationSet is loaded from a resource.\n    // *\n    // * @param context Application context to use\n    // * @param attrs Attribute set from which to read values\n    // */\n    //constructor( context:Context, attrs:AttributeSet) {\n    //    super(context, attrs);\n    //    let a:TypedArray = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.AnimationSet);\n    //    this.setFlag(AnimationSet.PROPERTY_SHARE_INTERPOLATOR_MASK, a.getBoolean(com.android.internal.R.styleable.AnimationSet_shareInterpolator, true));\n    //    this.init();\n    //    if (context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {\n    //        if (a.hasValue(com.android.internal.R.styleable.AnimationSet_duration)) {\n    //            this.mFlags |= AnimationSet.PROPERTY_DURATION_MASK;\n    //        }\n    //        if (a.hasValue(com.android.internal.R.styleable.AnimationSet_fillBefore)) {\n    //            this.mFlags |= AnimationSet.PROPERTY_FILL_BEFORE_MASK;\n    //        }\n    //        if (a.hasValue(com.android.internal.R.styleable.AnimationSet_fillAfter)) {\n    //            this.mFlags |= AnimationSet.PROPERTY_FILL_AFTER_MASK;\n    //        }\n    //        if (a.hasValue(com.android.internal.R.styleable.AnimationSet_repeatMode)) {\n    //            this.mFlags |= AnimationSet.PROPERTY_REPEAT_MODE_MASK;\n    //        }\n    //        if (a.hasValue(com.android.internal.R.styleable.AnimationSet_startOffset)) {\n    //            this.mFlags |= AnimationSet.PROPERTY_START_OFFSET_MASK;\n    //        }\n    //    }\n    //    a.recycle();\n    //}\n\n    /**\n     * Constructor to use when building an AnimationSet from code\n     * \n     * @param shareInterpolator Pass true if all of the animations in this set\n     *        should use the interpolator associated with this AnimationSet.\n     *        Pass false if each animation should use its own interpolator.\n     */\n    constructor(shareInterpolator=false) {\n        super();\n        this.setFlag(AnimationSet.PROPERTY_SHARE_INTERPOLATOR_MASK, shareInterpolator);\n        this.init();\n    }\n\n    //protected clone():AnimationSet  {\n    //    const animation:AnimationSet = <AnimationSet> super.clone();\n    //    animation.mTempTransformation = new Transformation();\n    //    animation.mAnimations = new ArrayList<Animation>();\n    //    const count:number = this.mAnimations.size();\n    //    const animations:ArrayList<Animation> = this.mAnimations;\n    //    for (let i:number = 0; i < count; i++) {\n    //        animation.mAnimations.add(animations.get(i).clone());\n    //    }\n    //    return animation;\n    //}\n\n    private setFlag(mask:number, value:boolean):void  {\n        if (value) {\n            this.mFlags |= mask;\n        } else {\n            this.mFlags &= ~mask;\n        }\n    }\n\n    private init():void  {\n        this.mStartTime = 0;\n    }\n\n    setFillAfter(fillAfter:boolean):void  {\n        this.mFlags |= AnimationSet.PROPERTY_FILL_AFTER_MASK;\n        super.setFillAfter(fillAfter);\n    }\n\n    setFillBefore(fillBefore:boolean):void  {\n        this.mFlags |= AnimationSet.PROPERTY_FILL_BEFORE_MASK;\n        super.setFillBefore(fillBefore);\n    }\n\n    setRepeatMode(repeatMode:number):void  {\n        this.mFlags |= AnimationSet.PROPERTY_REPEAT_MODE_MASK;\n        super.setRepeatMode(repeatMode);\n    }\n\n    setStartOffset(startOffset:number):void  {\n        this.mFlags |= AnimationSet.PROPERTY_START_OFFSET_MASK;\n        super.setStartOffset(startOffset);\n    }\n\n    /**\n     * @hide\n     */\n    hasAlpha():boolean  {\n        if (this.mDirty) {\n            this.mDirty = this.mHasAlpha = false;\n            const count:number = this.mAnimations.size();\n            const animations:ArrayList<Animation> = this.mAnimations;\n            for (let i:number = 0; i < count; i++) {\n                if (animations.get(i).hasAlpha()) {\n                    this.mHasAlpha = true;\n                    break;\n                }\n            }\n        }\n        return this.mHasAlpha;\n    }\n\n    /**\n     * <p>Sets the duration of every child animation.</p>\n     *\n     * @param durationMillis the duration of the animation, in milliseconds, for\n     *        every child in this set\n     */\n    setDuration(durationMillis:number):void  {\n        this.mFlags |= AnimationSet.PROPERTY_DURATION_MASK;\n        super.setDuration(durationMillis);\n        this.mLastEnd = this.mStartOffset + this.mDuration;\n    }\n\n    /**\n     * Add a child animation to this animation set.\n     * The transforms of the child animations are applied in the order\n     * that they were added\n     * @param a Animation to add.\n     */\n    addAnimation(a:Animation):void  {\n        this.mAnimations.add(a);\n        let noMatrix:boolean = (this.mFlags & AnimationSet.PROPERTY_MORPH_MATRIX_MASK) == 0;\n        if (noMatrix && a.willChangeTransformationMatrix()) {\n            this.mFlags |= AnimationSet.PROPERTY_MORPH_MATRIX_MASK;\n        }\n        let changeBounds:boolean = (this.mFlags & AnimationSet.PROPERTY_CHANGE_BOUNDS_MASK) == 0;\n        if (changeBounds && a.willChangeBounds()) {\n            this.mFlags |= AnimationSet.PROPERTY_CHANGE_BOUNDS_MASK;\n        }\n        if ((this.mFlags & AnimationSet.PROPERTY_DURATION_MASK) == AnimationSet.PROPERTY_DURATION_MASK) {\n            this.mLastEnd = this.mStartOffset + this.mDuration;\n        } else {\n            if (this.mAnimations.size() == 1) {\n                this.mDuration = a.getStartOffset() + a.getDuration();\n                this.mLastEnd = this.mStartOffset + this.mDuration;\n            } else {\n                this.mLastEnd = Math.max(this.mLastEnd, a.getStartOffset() + a.getDuration());\n                this.mDuration = this.mLastEnd - this.mStartOffset;\n            }\n        }\n        this.mDirty = true;\n    }\n\n    /**\n     * Sets the start time of this animation and all child animations\n     * \n     * @see android.view.animation.Animation#setStartTime(long)\n     */\n    setStartTime(startTimeMillis:number):void  {\n        super.setStartTime(startTimeMillis);\n        const count:number = this.mAnimations.size();\n        const animations:ArrayList<Animation> = this.mAnimations;\n        for (let i:number = 0; i < count; i++) {\n            let a:Animation = animations.get(i);\n            a.setStartTime(startTimeMillis);\n        }\n    }\n\n    getStartTime():number  {\n        let startTime:number = Long.MAX_VALUE;\n        const count:number = this.mAnimations.size();\n        const animations:ArrayList<Animation> = this.mAnimations;\n        for (let i:number = 0; i < count; i++) {\n            let a:Animation = animations.get(i);\n            startTime = Math.min(startTime, a.getStartTime());\n        }\n        return startTime;\n    }\n\n    restrictDuration(durationMillis:number):void  {\n        super.restrictDuration(durationMillis);\n        const animations:ArrayList<Animation> = this.mAnimations;\n        let count:number = animations.size();\n        for (let i:number = 0; i < count; i++) {\n            animations.get(i).restrictDuration(durationMillis);\n        }\n    }\n\n    /**\n     * The duration of an AnimationSet is defined to be the \n     * duration of the longest child animation.\n     * \n     * @see android.view.animation.Animation#getDuration()\n     */\n    getDuration():number  {\n        const animations:ArrayList<Animation> = this.mAnimations;\n        const count:number = animations.size();\n        let duration:number = 0;\n        let durationSet:boolean = (this.mFlags & AnimationSet.PROPERTY_DURATION_MASK) == AnimationSet.PROPERTY_DURATION_MASK;\n        if (durationSet) {\n            duration = this.mDuration;\n        } else {\n            for (let i:number = 0; i < count; i++) {\n                duration = Math.max(duration, animations.get(i).getDuration());\n            }\n        }\n        return duration;\n    }\n\n    /**\n     * The duration hint of an animation set is the maximum of the duration\n     * hints of all of its component animations.\n     * \n     * @see android.view.animation.Animation#computeDurationHint\n     */\n    computeDurationHint():number  {\n        let duration:number = 0;\n        const count:number = this.mAnimations.size();\n        const animations:ArrayList<Animation> = this.mAnimations;\n        for (let i:number = count - 1; i >= 0; --i) {\n            const d:number = animations.get(i).computeDurationHint();\n            if (d > duration)\n                duration = d;\n        }\n        return duration;\n    }\n\n    /**\n     * @hide\n     */\n    initializeInvalidateRegion(left:number, top:number, right:number, bottom:number):void  {\n        const region:RectF = this.mPreviousRegion;\n        region.set(left, top, right, bottom);\n        region.inset(-1.0, -1.0);\n        if (this.mFillBefore) {\n            const count:number = this.mAnimations.size();\n            const animations:ArrayList<Animation> = this.mAnimations;\n            const temp:Transformation = this.mTempTransformation;\n            const previousTransformation:Transformation = this.mPreviousTransformation;\n            for (let i:number = count - 1; i >= 0; --i) {\n                const a:Animation = animations.get(i);\n                if (!a.isFillEnabled() || a.getFillBefore() || a.getStartOffset() == 0) {\n                    temp.clear();\n                    const interpolator:Interpolator = a.mInterpolator;\n                    a.applyTransformation(interpolator != null ? interpolator.getInterpolation(0.0) : 0.0, temp);\n                    previousTransformation.compose(temp);\n                }\n            }\n        }\n    }\n\n    /**\n     * The transformation of an animation set is the concatenation of all of its\n     * component animations.\n     * \n     * @see android.view.animation.Animation#getTransformation\n     */\n    getTransformation(currentTime:number, t:Transformation):boolean  {\n        const count:number = this.mAnimations.size();\n        const animations:ArrayList<Animation> = this.mAnimations;\n        const temp:Transformation = this.mTempTransformation;\n        let more:boolean = false;\n        let started:boolean = false;\n        let ended:boolean = true;\n        t.clear();\n        for (let i:number = count - 1; i >= 0; --i) {\n            const a:Animation = animations.get(i);\n            temp.clear();\n            more = a.getTransformation(currentTime, temp, this.getScaleFactor()) || more;\n            t.compose(temp);\n            started = started || a.hasStarted();\n            ended = a.hasEnded() && ended;\n        }\n        if (started && !this.mStarted) {\n            if (this.mListener != null) {\n                this.mListener.onAnimationStart(this);\n            }\n            this.mStarted = true;\n        }\n        if (ended != this.mEnded) {\n            if (this.mListener != null) {\n                this.mListener.onAnimationEnd(this);\n            }\n            this.mEnded = ended;\n        }\n        return more;\n    }\n\n    /**\n     * @see android.view.animation.Animation#scaleCurrentDuration(float)\n     */\n    scaleCurrentDuration(scale:number):void  {\n        const animations:ArrayList<Animation> = this.mAnimations;\n        let count:number = animations.size();\n        for (let i:number = 0; i < count; i++) {\n            animations.get(i).scaleCurrentDuration(scale);\n        }\n    }\n\n    /**\n     * @see android.view.animation.Animation#initialize(int, int, int, int)\n     */\n    initialize(width:number, height:number, parentWidth:number, parentHeight:number):void  {\n        super.initialize(width, height, parentWidth, parentHeight);\n        let durationSet:boolean = (this.mFlags & AnimationSet.PROPERTY_DURATION_MASK) == AnimationSet.PROPERTY_DURATION_MASK;\n        let fillAfterSet:boolean = (this.mFlags & AnimationSet.PROPERTY_FILL_AFTER_MASK) == AnimationSet.PROPERTY_FILL_AFTER_MASK;\n        let fillBeforeSet:boolean = (this.mFlags & AnimationSet.PROPERTY_FILL_BEFORE_MASK) == AnimationSet.PROPERTY_FILL_BEFORE_MASK;\n        let repeatModeSet:boolean = (this.mFlags & AnimationSet.PROPERTY_REPEAT_MODE_MASK) == AnimationSet.PROPERTY_REPEAT_MODE_MASK;\n        let shareInterpolator:boolean = (this.mFlags & AnimationSet.PROPERTY_SHARE_INTERPOLATOR_MASK) == AnimationSet.PROPERTY_SHARE_INTERPOLATOR_MASK;\n        let startOffsetSet:boolean = (this.mFlags & AnimationSet.PROPERTY_START_OFFSET_MASK) == AnimationSet.PROPERTY_START_OFFSET_MASK;\n        if (shareInterpolator) {\n            this.ensureInterpolator();\n        }\n        const children:ArrayList<Animation> = this.mAnimations;\n        const count:number = children.size();\n        const duration:number = this.mDuration;\n        const fillAfter:boolean = this.mFillAfter;\n        const fillBefore:boolean = this.mFillBefore;\n        const repeatMode:number = this.mRepeatMode;\n        const interpolator:Interpolator = this.mInterpolator;\n        const startOffset:number = this.mStartOffset;\n        let storedOffsets:number[] = this.mStoredOffsets;\n        if (startOffsetSet) {\n            if (storedOffsets == null || storedOffsets.length != count) {\n                storedOffsets = this.mStoredOffsets = androidui.util.ArrayCreator.newNumberArray(count);\n            }\n        } else if (storedOffsets != null) {\n            storedOffsets = this.mStoredOffsets = null;\n        }\n        for (let i:number = 0; i < count; i++) {\n            let a:Animation = children.get(i);\n            if (durationSet) {\n                a.setDuration(duration);\n            }\n            if (fillAfterSet) {\n                a.setFillAfter(fillAfter);\n            }\n            if (fillBeforeSet) {\n                a.setFillBefore(fillBefore);\n            }\n            if (repeatModeSet) {\n                a.setRepeatMode(repeatMode);\n            }\n            if (shareInterpolator) {\n                a.setInterpolator(interpolator);\n            }\n            if (startOffsetSet) {\n                let offset:number = a.getStartOffset();\n                a.setStartOffset(offset + startOffset);\n                storedOffsets[i] = offset;\n            }\n            a.initialize(width, height, parentWidth, parentHeight);\n        }\n    }\n\n    reset():void  {\n        super.reset();\n        this.restoreChildrenStartOffset();\n    }\n\n    /**\n     * @hide\n     */\n    restoreChildrenStartOffset():void  {\n        const offsets:number[] = this.mStoredOffsets;\n        if (offsets == null)\n            return;\n        const children:ArrayList<Animation> = this.mAnimations;\n        const count:number = children.size();\n        for (let i:number = 0; i < count; i++) {\n            children.get(i).setStartOffset(offsets[i]);\n        }\n    }\n\n    /**\n     * @return All the child animations in this AnimationSet. Note that\n     * this may include other AnimationSets, which are not expanded.\n     */\n    getAnimations():List<Animation>  {\n        return this.mAnimations;\n    }\n\n    willChangeTransformationMatrix():boolean  {\n        return (this.mFlags & AnimationSet.PROPERTY_MORPH_MATRIX_MASK) == AnimationSet.PROPERTY_MORPH_MATRIX_MASK;\n    }\n\n    willChangeBounds():boolean  {\n        return (this.mFlags & AnimationSet.PROPERTY_CHANGE_BOUNDS_MASK) == AnimationSet.PROPERTY_CHANGE_BOUNDS_MASK;\n    }\n}\n}"
  },
  {
    "path": "src/android/view/animation/AnimationUtils.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../os/SystemClock.ts\"/>\n\nmodule android.view.animation {\n    import SystemClock = android.os.SystemClock;\n    /**\n     * Defines common utilities for working with animations.\n     *\n     */\n    export class AnimationUtils {\n        /**\n         * Returns the current animation time in milliseconds. This time should be used when invoking\n         * {@link Animation#setStartTime(long)}. Refer to {@link android.os.SystemClock} for more\n         * information about the different available clocks. The clock used by this method is\n         * <em>not</em> the \"wall\" clock (it is not {@link System#currentTimeMillis}).\n         *\n         * @return the current animation time in milliseconds\n         *\n         * @see android.os.SystemClock\n         */\n        static currentAnimationTimeMillis():number {\n            return SystemClock.uptimeMillis();\n        }\n\n        /**\n         * Loads an {@link Animation} object from a resource\n         *\n         * @param context Application context used to access resources\n         * @param id The resource id of the animation to load\n         * @return The animation object reference by the specified id\n         * @throws NotFoundException when the animation cannot be loaded\n         */\n        public static loadAnimation(context:android.content.Context, id:string):Animation {\n            return context.getResources().getAnimation(id);\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/animation/AnticipateInterpolator.ts",
    "content": "/*\n * Copyright (C) 2009 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"Interpolator.ts\"/>\n\nmodule android.view.animation{\n    /**\n     * An interpolator where the change starts backward then flings forward.\n     */\n    export class AnticipateInterpolator implements Interpolator{\n        private mTension:number;\n        /**\n         * @param tension Amount of anticipation. When tension equals 0.0f, there is\n         *                no anticipation and the interpolator becomes a simple\n         *                acceleration interpolator.\n         */\n        constructor(tension=2) {\n            this.mTension = tension;\n        }\n\n        getInterpolation(t:number):number {\n            // a(t) = t * t * ((tension + 1) * t - tension)\n            return t * t * ((this.mTension + 1) * t - this.mTension);\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/animation/AnticipateOvershootInterpolator.ts",
    "content": "/*\n * Copyright (C) 2009 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"Interpolator.ts\"/>\n\nmodule android.view.animation{\n    /**\n     * An interpolator where the change starts backward then flings forward and overshoots\n     * the target value and finally goes back to the final value.\n     */\n    export class AnticipateOvershootInterpolator implements Interpolator{\n        private mTension:number;\n        /**\n         * @param tension Amount of anticipation/overshoot. When tension equals 0.0f,\n         *                there is no anticipation/overshoot and the interpolator becomes\n         *                a simple acceleration/deceleration interpolator.\n         * @param extraTension Amount by which to multiply the tension. For instance,\n         *                     to get the same overshoot as an OvershootInterpolator with\n         *                     a tension of 2.0f, you would use an extraTension of 1.5f.\n         */\n        constructor(tension=2, extraTension=1.5) {\n            this.mTension = tension * extraTension;\n        }\n\n        private static a(t:number, s:number):number{\n            return t * t * ((s + 1) * t - s);\n        }\n        private static o(t:number, s:number):number{\n            return t * t * ((s + 1) * t + s);\n        }\n\n\n        getInterpolation(t:number):number {\n            // a(t, s) = t * t * ((s + 1) * t - s)\n            // o(t, s) = t * t * ((s + 1) * t + s)\n            // f(t) = 0.5 * a(t * 2, tension * extraTension), when t < 0.5\n            // f(t) = 0.5 * (o(t * 2 - 2, tension * extraTension) + 2), when t <= 1.0\n            if (t < 0.5) return 0.5 * AnticipateOvershootInterpolator.a(t * 2.0, this.mTension);\n            else return 0.5 * (AnticipateOvershootInterpolator.o(t * 2.0 - 2.0, this.mTension) + 2.0);\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/animation/BounceInterpolator.ts",
    "content": "/*\n * Copyright (C) 2009 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n///<reference path=\"Interpolator.ts\"/>\n\nmodule android.view.animation {\n    /**\n     * An interpolator where the change bounces at the end.\n     */\n    export class BounceInterpolator implements Interpolator {\n        private static bounce(t:number):number {\n            return t * t * 8.0;\n        }\n\n        getInterpolation(t:number):number {\n            // _b(t) = t * t * 8\n            // bs(t) = _b(t) for t < 0.3535\n            // bs(t) = _b(t - 0.54719) + 0.7 for t < 0.7408\n            // bs(t) = _b(t - 0.8526) + 0.9 for t < 0.9644\n            // bs(t) = _b(t - 1.0435) + 0.95 for t <= 1.0\n            // b(t) = bs(t * 1.1226)\n            t *= 1.1226;\n            if (t < 0.3535) return BounceInterpolator.bounce(t);\n            else if (t < 0.7408) return BounceInterpolator.bounce(t - 0.54719) + 0.7;\n            else if (t < 0.9644) return BounceInterpolator.bounce(t - 0.8526) + 0.9;\n            else return BounceInterpolator.bounce(t - 1.0435) + 0.95;\n        }\n\n    }\n}"
  },
  {
    "path": "src/android/view/animation/CycleInterpolator.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n///<reference path=\"Interpolator.ts\"/>\n\nmodule android.view.animation{\n    /**\n     * Repeats the animation for a specified number of cycles. The\n     * rate of change follows a sinusoidal pattern.\n     *\n     */\n    export class CycleInterpolator implements Interpolator{\n        private mCycles:number;\n        constructor(mCycles:number) {\n            this.mCycles = mCycles;\n        }\n\n        getInterpolation(input:number):number {\n            return (Math.sin(2 * this.mCycles * Math.PI * input));\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/animation/DecelerateInterpolator.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"Interpolator.ts\"/>\n\nmodule android.view.animation {\n    /**\n     * An interpolator where the rate of change starts out quickly and\n     * and then decelerates.\n     *\n     */\n    export class DecelerateInterpolator implements Interpolator {\n        private mFactor:number;\n\n        /**\n         * Constructor\n         *\n         * @param factor Degree to which the animation should be eased. Setting factor to 1.0f produces\n         *        an upside-down y=x^2 parabola. Increasing factor above 1.0f makes exaggerates the\n         *        ease-out effect (i.e., it starts even faster and ends evens slower)\n         */\n        constructor(factor = 1) {\n            this.mFactor = factor;\n        }\n\n        getInterpolation(input:number):number {\n            let result;\n            if (this.mFactor == 1.0) {\n                result = (1.0 - (1.0 - input) * (1.0 - input));\n            } else {\n                result = (1.0 - Math.pow((1.0 - input), 2 * this.mFactor));\n            }\n            return result;\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/animation/Interpolator.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule android.view.animation{\n    /**\n     * An interpolator defines the rate of change of an animation. This allows\n     * the basic animation effects (alpha, scale, translate, rotate) to be\n     * accelerated, decelerated, repeated, etc.\n     */\n    export interface Interpolator{\n        /**\n         * Maps a value representing the elapsed fraction of an animation to a value that represents\n         * the interpolated fraction. This interpolated value is then multiplied by the change in\n         * value of an animation to derive the animated value at the current elapsed animation time.\n         *\n         * @param input A value between 0 and 1.0 indicating our current point\n         *        in the animation where 0 represents the start and 1.0 represents\n         *        the end\n         * @return The interpolation value. This value can be more than 1.0 for\n         *         interpolators which overshoot their targets, or less than 0 for\n         *         interpolators that undershoot their targets.\n         */\n        getInterpolation(input:number):number;\n    }\n}"
  },
  {
    "path": "src/android/view/animation/LinearInterpolator.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"Interpolator.ts\"/>\n\nmodule android.view.animation{\n    /**\n     * An interpolator where the rate of change is constant\n     *\n     */\n    export class LinearInterpolator implements Interpolator{\n        getInterpolation(input:number):number {\n            return input;\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/animation/OvershootInterpolator.ts",
    "content": "/*\n * Copyright (C) 2009 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"Interpolator.ts\"/>\n\nmodule android.view.animation {\n    /**\n     * An interpolator where the change flings forward and overshoots the last value\n     * then comes back.\n     */\n    export class OvershootInterpolator implements Interpolator {\n        private mTension:number;\n\n        /**\n         * @param tension Amount of overshoot. When tension equals 0.0f, there is\n         *                no overshoot and the interpolator becomes a simple\n         *                deceleration interpolator.\n         */\n        constructor(tension = 2) {\n            this.mTension = tension;\n        }\n\n        getInterpolation(t:number):number {\n            // _o(t) = t * t * ((tension + 1) * t + tension)\n            // o(t) = _o(t - 1) + 1\n            t -= 1.0;\n            return t * t * ((this.mTension + 1) * t + this.mTension) + 1.0;\n        }\n    }\n}"
  },
  {
    "path": "src/android/view/animation/RotateAnimation.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/view/animation/Animation.ts\"/>\n///<reference path=\"../../../android/view/animation/Transformation.ts\"/>\n\nmodule android.view.animation {\nimport Animation = android.view.animation.Animation;\nimport Transformation = android.view.animation.Transformation;\n/**\n * An animation that controls the rotation of an object. This rotation takes\n * place in the X-Y plane. You can specify the point to use for the center of\n * the rotation, where (0,0) is the top left point. If not specified, (0,0) is\n * the default rotation point.\n * \n */\nexport class RotateAnimation extends Animation {\n\n    private mFromDegrees:number = 0;\n\n    private mToDegrees:number = 0;\n\n    private mPivotXType:number = RotateAnimation.ABSOLUTE;\n\n    private mPivotYType:number = RotateAnimation.ABSOLUTE;\n\n    private mPivotXValue:number = 0.0;\n\n    private mPivotYValue:number = 0.0;\n\n    private mPivotX:number = 0;\n\n    private mPivotY:number = 0;\n\n    ///**\n    // * Constructor used when a RotateAnimation is loaded from a resource.\n    // *\n    // * @param context Application context to use\n    // * @param attrs Attribute set from which to read values\n    // */\n    //constructor( context:Context, attrs:AttributeSet) {\n    //    super(context, attrs);\n    //    let a:TypedArray = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.RotateAnimation);\n    //    this.mFromDegrees = a.getFloat(com.android.internal.R.styleable.RotateAnimation_fromDegrees, 0.0);\n    //    this.mToDegrees = a.getFloat(com.android.internal.R.styleable.RotateAnimation_toDegrees, 0.0);\n    //    let d:Animation.Description = RotateAnimation.Description.parseValue(a.peekValue(com.android.internal.R.styleable.RotateAnimation_pivotX));\n    //    this.mPivotXType = d.type;\n    //    this.mPivotXValue = d.value;\n    //    d = RotateAnimation.Description.parseValue(a.peekValue(com.android.internal.R.styleable.RotateAnimation_pivotY));\n    //    this.mPivotYType = d.type;\n    //    this.mPivotYValue = d.value;\n    //    a.recycle();\n    //    this.initializePivotPoint();\n    //}\n\n    /**\n     * Constructor to use when building a RotateAnimation from code\n     * \n     * @param fromDegrees Rotation offset to apply at the start of the\n     *        animation.\n     * \n     * @param toDegrees Rotation offset to apply at the end of the animation.\n     * \n     * @param pivotXType Specifies how pivotXValue should be interpreted. One of\n     *        Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or\n     *        Animation.RELATIVE_TO_PARENT.\n     * @param pivotXValue The X coordinate of the point about which the object\n     *        is being rotated, specified as an absolute number where 0 is the\n     *        left edge. This value can either be an absolute number if\n     *        pivotXType is ABSOLUTE, or a percentage (where 1.0 is 100%)\n     *        otherwise.\n     * @param pivotYType Specifies how pivotYValue should be interpreted. One of\n     *        Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or\n     *        Animation.RELATIVE_TO_PARENT.\n     * @param pivotYValue The Y coordinate of the point about which the object\n     *        is being rotated, specified as an absolute number where 0 is the\n     *        top edge. This value can either be an absolute number if\n     *        pivotYType is ABSOLUTE, or a percentage (where 1.0 is 100%)\n     *        otherwise.\n     */\n    constructor(fromDegrees:number, toDegrees:number, pivotXType=RotateAnimation.ABSOLUTE, pivotXValue=0,\n                 pivotYType=RotateAnimation.ABSOLUTE, pivotYValue=0) {\n        super();\n        this.mFromDegrees = fromDegrees;\n        this.mToDegrees = toDegrees;\n        this.mPivotXValue = pivotXValue;\n        this.mPivotXType = pivotXType;\n        this.mPivotYValue = pivotYValue;\n        this.mPivotYType = pivotYType;\n        this.initializePivotPoint();\n    }\n\n    /**\n     * Called at the end of constructor methods to initialize, if possible, values for\n     * the pivot point. This is only possible for ABSOLUTE pivot values.\n     */\n    private initializePivotPoint():void  {\n        if (this.mPivotXType == RotateAnimation.ABSOLUTE) {\n            this.mPivotX = this.mPivotXValue;\n        }\n        if (this.mPivotYType == RotateAnimation.ABSOLUTE) {\n            this.mPivotY = this.mPivotYValue;\n        }\n    }\n\n    protected applyTransformation(interpolatedTime:number, t:Transformation):void  {\n        let degrees:number = this.mFromDegrees + ((this.mToDegrees - this.mFromDegrees) * interpolatedTime);\n        let scale:number = this.getScaleFactor();\n        if (this.mPivotX == 0.0 && this.mPivotY == 0.0) {\n            t.getMatrix().setRotate(degrees);\n        } else {\n            t.getMatrix().setRotate(degrees, this.mPivotX * scale, this.mPivotY * scale);\n        }\n    }\n\n    initialize(width:number, height:number, parentWidth:number, parentHeight:number):void  {\n        super.initialize(width, height, parentWidth, parentHeight);\n        this.mPivotX = this.resolveSize(this.mPivotXType, this.mPivotXValue, width, parentWidth);\n        this.mPivotY = this.resolveSize(this.mPivotYType, this.mPivotYValue, height, parentHeight);\n    }\n}\n}"
  },
  {
    "path": "src/android/view/animation/ScaleAnimation.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/content/res/Resources.ts\"/>\n///<reference path=\"../../../android/util/TypedValue.ts\"/>\n///<reference path=\"../../../android/view/animation/Animation.ts\"/>\n///<reference path=\"../../../android/view/animation/Transformation.ts\"/>\n\nmodule android.view.animation {\nimport Resources = android.content.res.Resources;\nimport TypedValue = android.util.TypedValue;\nimport Animation = android.view.animation.Animation;\nimport Transformation = android.view.animation.Transformation;\n/**\n * An animation that controls the scale of an object. You can specify the point\n * to use for the center of scaling.\n * \n */\nexport class ScaleAnimation extends Animation {\n\n    private mResources:Resources;\n\n    private mFromX:number = 0;\n\n    private mToX:number = 0;\n\n    private mFromY:number = 0;\n\n    private mToY:number = 0;\n\n    //private mFromXType:number = TypedValue.TYPE_NULL;\n    //\n    //private mToXType:number = TypedValue.TYPE_NULL;\n    //\n    //private mFromYType:number = TypedValue.TYPE_NULL;\n    //\n    //private mToYType:number = TypedValue.TYPE_NULL;\n\n    private mFromXData:number = 0;\n\n    private mToXData:number = 0;\n\n    private mFromYData:number = 0;\n\n    private mToYData:number = 0;\n\n    private mPivotXType:number = ScaleAnimation.ABSOLUTE;\n\n    private mPivotYType:number = ScaleAnimation.ABSOLUTE;\n\n    private mPivotXValue:number = 0.0;\n\n    private mPivotYValue:number = 0.0;\n\n    private mPivotX:number = 0;\n\n    private mPivotY:number = 0;\n\n    /**\n     * Constructor to use when building a ScaleAnimation from code\n     * \n     * @param fromX Horizontal scaling factor to apply at the start of the\n     *        animation\n     * @param toX Horizontal scaling factor to apply at the end of the animation\n     * @param fromY Vertical scaling factor to apply at the start of the\n     *        animation\n     * @param toY Vertical scaling factor to apply at the end of the animation\n     * @param pivotXType Specifies how pivotXValue should be interpreted. One of\n     *        Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or\n     *        Animation.RELATIVE_TO_PARENT.\n     * @param pivotXValue The X coordinate of the point about which the object\n     *        is being scaled, specified as an absolute number where 0 is the\n     *        left edge. (This point remains fixed while the object changes\n     *        size.) This value can either be an absolute number if pivotXType\n     *        is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.\n     * @param pivotYType Specifies how pivotYValue should be interpreted. One of\n     *        Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or\n     *        Animation.RELATIVE_TO_PARENT.\n     * @param pivotYValue The Y coordinate of the point about which the object\n     *        is being scaled, specified as an absolute number where 0 is the\n     *        top edge. (This point remains fixed while the object changes\n     *        size.) This value can either be an absolute number if pivotYType\n     *        is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.\n     */\n    constructor(fromX:number, toX:number, fromY:number, toY:number,\n                pivotXType=ScaleAnimation.ABSOLUTE, pivotXValue=0, pivotYType=ScaleAnimation.ABSOLUTE, pivotYValue=0) {\n        super();\n        this.mResources = null;\n        this.mFromX = fromX;\n        this.mToX = toX;\n        this.mFromY = fromY;\n        this.mToY = toY;\n        this.mPivotXValue = pivotXValue;\n        this.mPivotXType = pivotXType;\n        this.mPivotYValue = pivotYValue;\n        this.mPivotYType = pivotYType;\n        this.initializePivotPoint();\n    }\n\n    /**\n     * Called at the end of constructor methods to initialize, if possible, values for\n     * the pivot point. This is only possible for ABSOLUTE pivot values.\n     */\n    private initializePivotPoint():void  {\n        if (this.mPivotXType == ScaleAnimation.ABSOLUTE) {\n            this.mPivotX = this.mPivotXValue;\n        }\n        if (this.mPivotYType == ScaleAnimation.ABSOLUTE) {\n            this.mPivotY = this.mPivotYValue;\n        }\n    }\n\n    protected applyTransformation(interpolatedTime:number, t:Transformation):void  {\n        let sx:number = 1.0;\n        let sy:number = 1.0;\n        let scale:number = this.getScaleFactor();\n        if (this.mFromX != 1.0 || this.mToX != 1.0) {\n            sx = this.mFromX + ((this.mToX - this.mFromX) * interpolatedTime);\n        }\n        if (this.mFromY != 1.0 || this.mToY != 1.0) {\n            sy = this.mFromY + ((this.mToY - this.mFromY) * interpolatedTime);\n        }\n        if (this.mPivotX == 0 && this.mPivotY == 0) {\n            t.getMatrix().setScale(sx, sy);\n        } else {\n            t.getMatrix().setScale(sx, sy, scale * this.mPivotX, scale * this.mPivotY);\n        }\n    }\n\n    //resolveScale(scale:number, type:number, data:number, size:number, psize:number):number  {\n    //    let targetSize:number;\n    //    if (type == TypedValue.TYPE_FRACTION) {\n    //        targetSize = TypedValue.complexToFraction(data, size, psize);\n    //    } else if (type == TypedValue.TYPE_DIMENSION) {\n    //        targetSize = TypedValue.complexToDimension(data, this.mResources.getDisplayMetrics());\n    //    } else {\n    //        return scale;\n    //    }\n    //    if (size == 0) {\n    //        return 1;\n    //    }\n    //    return targetSize / <number> size;\n    //}\n\n    initialize(width:number, height:number, parentWidth:number, parentHeight:number):void  {\n        super.initialize(width, height, parentWidth, parentHeight);\n        //this.mFromX = this.resolveScale(this.mFromX, this.mFromXType, this.mFromXData, width, parentWidth);\n        //this.mToX = this.resolveScale(this.mToX, this.mToXType, this.mToXData, width, parentWidth);\n        //this.mFromY = this.resolveScale(this.mFromY, this.mFromYType, this.mFromYData, height, parentHeight);\n        //this.mToY = this.resolveScale(this.mToY, this.mToYType, this.mToYData, height, parentHeight);\n        this.mPivotX = this.resolveSize(this.mPivotXType, this.mPivotXValue, width, parentWidth);\n        this.mPivotY = this.resolveSize(this.mPivotYType, this.mPivotYValue, height, parentHeight);\n    }\n}\n}"
  },
  {
    "path": "src/android/view/animation/Transformation.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/graphics/Matrix.ts\"/>\n///<reference path=\"../../../java/lang/StringBuilder.ts\"/>\n///<reference path=\"../../../android/view/animation/Animation.ts\"/>\n\nmodule android.view.animation {\nimport Matrix = android.graphics.Matrix;\nimport StringBuilder = java.lang.StringBuilder;\nimport Animation = android.view.animation.Animation;\n/**\n * Defines the transformation to be applied at\n * one point in time of an Animation.\n *\n */\nexport class Transformation {\n\n    /**\n     * Indicates a transformation that has no effect (alpha = 1 and identity matrix.)\n     */\n    static TYPE_IDENTITY:number = 0x0;\n\n    /**\n     * Indicates a transformation that applies an alpha only (uses an identity matrix.)\n     */\n    static TYPE_ALPHA:number = 0x1;\n\n    /**\n     * Indicates a transformation that applies a matrix only (alpha = 1.)\n     */\n    static TYPE_MATRIX:number = 0x2;\n\n    /**\n     * Indicates a transformation that applies an alpha and a matrix.\n     */\n    static TYPE_BOTH:number = Transformation.TYPE_ALPHA | Transformation.TYPE_MATRIX;\n\n    protected mMatrix:Matrix;\n\n    protected mAlpha:number = 0;\n\n    protected mTransformationType:number = 0;\n\n    /**\n     * Creates a new transformation with alpha = 1 and the identity matrix.\n     */\n    constructor() {\n        this.clear();\n    }\n\n    /**\n     * Reset the transformation to a state that leaves the object\n     * being animated in an unmodified state. The transformation type is\n     * {@link #TYPE_BOTH} by default.\n     */\n    clear():void  {\n        if (this.mMatrix == null) {\n            this.mMatrix = new Matrix();\n        } else {\n            this.mMatrix.reset();\n        }\n        this.mAlpha = 1.0;\n        this.mTransformationType = Transformation.TYPE_BOTH;\n    }\n\n    /**\n     * Indicates the nature of this transformation.\n     *\n     * @return {@link #TYPE_ALPHA}, {@link #TYPE_MATRIX},\n     *         {@link #TYPE_BOTH} or {@link #TYPE_IDENTITY}.\n     */\n    getTransformationType():number  {\n        return this.mTransformationType;\n    }\n\n    /**\n     * Sets the transformation type.\n     *\n     * @param transformationType One of {@link #TYPE_ALPHA},\n     *        {@link #TYPE_MATRIX}, {@link #TYPE_BOTH} or\n     *        {@link #TYPE_IDENTITY}.\n     */\n    setTransformationType(transformationType:number):void  {\n        this.mTransformationType = transformationType;\n    }\n\n    /**\n     * Clones the specified transformation.\n     *\n     * @param t The transformation to clone.\n     */\n    set(t:Transformation):void  {\n        this.mAlpha = t.getAlpha();\n        this.mMatrix.set(t.getMatrix());\n        this.mTransformationType = t.getTransformationType();\n    }\n\n    /**\n     * Apply this Transformation to an existing Transformation, e.g. apply\n     * a scale effect to something that has already been rotated.\n     * @param t\n     */\n    compose(t:Transformation):void  {\n        this.mAlpha *= t.getAlpha();\n        this.mMatrix.preConcat(t.getMatrix());\n    }\n\n    /**\n     * Like {@link #compose(Transformation)} but does this.postConcat(t) of\n     * the transformation matrix.\n     * @hide\n     */\n    postCompose(t:Transformation):void  {\n        this.mAlpha *= t.getAlpha();\n        this.mMatrix.postConcat(t.getMatrix());\n    }\n\n    /**\n     * @return The 3x3 Matrix representing the trnasformation to apply to the\n     * coordinates of the object being animated\n     */\n    getMatrix():Matrix  {\n        return this.mMatrix;\n    }\n\n    /**\n     * Sets the degree of transparency\n     * @param alpha 1.0 means fully opaqe and 0.0 means fully transparent\n     */\n    setAlpha(alpha:number):void  {\n        this.mAlpha = alpha;\n    }\n\n    /**\n     * @return The degree of transparency\n     */\n    getAlpha():number  {\n        return this.mAlpha;\n    }\n\n    toString():string  {\n        let sb:StringBuilder = new StringBuilder(64);\n        sb.append(\"Transformation\");\n        this.toShortString(sb);\n        return sb.toString();\n    }\n\n    /**\n     * Return a string representation of the transformation in a compact form.\n     */\n    toShortString(sb?:StringBuilder):void  {\n        sb = sb || new StringBuilder(64);\n        sb.append(\"{alpha=\");\n        sb.append(this.mAlpha);\n        sb.append(\" matrix=\");\n        this.mMatrix.toShortString(sb);\n        sb.append('}');\n    }\n}\n}"
  },
  {
    "path": "src/android/view/animation/TranslateAnimation.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/view/animation/Animation.ts\"/>\n///<reference path=\"../../../android/view/animation/Transformation.ts\"/>\n\nmodule android.view.animation {\nimport Animation = android.view.animation.Animation;\nimport Transformation = android.view.animation.Transformation;\n/**\n * An animation that controls the position of an object. See the\n * {@link android.view.animation full package} description for details and\n * sample code.\n * \n */\nexport class TranslateAnimation extends Animation {\n\n    private mFromXType:number = TranslateAnimation.ABSOLUTE;\n\n    private mToXType:number = TranslateAnimation.ABSOLUTE;\n\n    private mFromYType:number = TranslateAnimation.ABSOLUTE;\n\n    private mToYType:number = TranslateAnimation.ABSOLUTE;\n\n    private mFromXValue:number = 0.0;\n\n    private mToXValue:number = 0.0;\n\n    private mFromYValue:number = 0.0;\n\n    private mToYValue:number = 0.0;\n\n    private mFromXDelta:number = 0;\n\n    private mToXDelta:number = 0;\n\n    private mFromYDelta:number = 0;\n\n    private mToYDelta:number = 0;\n\n    /**\n     * Constructor to use when building a TranslateAnimation from code\n     *\n     * @param fromXDelta Change in X coordinate to apply at the start of the\n     *        animation\n     * @param toXDelta Change in X coordinate to apply at the end of the\n     *        animation\n     * @param fromYDelta Change in Y coordinate to apply at the start of the\n     *        animation\n     * @param toYDelta Change in Y coordinate to apply at the end of the\n     *        animation\n     */\n    constructor( fromXDelta:number, toXDelta:number, fromYDelta:number, toYDelta:number);\n    /**\n     * Constructor to use when building a TranslateAnimation from code\n     * \n     * @param fromXType Specifies how fromXValue should be interpreted. One of\n     *        Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or\n     *        Animation.RELATIVE_TO_PARENT.\n     * @param fromXValue Change in X coordinate to apply at the start of the\n     *        animation. This value can either be an absolute number if fromXType\n     *        is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.\n     * @param toXType Specifies how toXValue should be interpreted. One of\n     *        Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or\n     *        Animation.RELATIVE_TO_PARENT.\n     * @param toXValue Change in X coordinate to apply at the end of the\n     *        animation. This value can either be an absolute number if toXType\n     *        is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.\n     * @param fromYType Specifies how fromYValue should be interpreted. One of\n     *        Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or\n     *        Animation.RELATIVE_TO_PARENT.\n     * @param fromYValue Change in Y coordinate to apply at the start of the\n     *        animation. This value can either be an absolute number if fromYType\n     *        is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.\n     * @param toYType Specifies how toYValue should be interpreted. One of\n     *        Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or\n     *        Animation.RELATIVE_TO_PARENT.\n     * @param toYValue Change in Y coordinate to apply at the end of the\n     *        animation. This value can either be an absolute number if toYType\n     *        is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.\n     */\n    constructor(fromXType:number, fromXValue:number, toXType:number, toXValue:number, fromYType:number, fromYValue:number, toYType:number, toYValue:number);\n    constructor(...args){\n        super();\n        if(args.length===4){\n            this.mFromXValue = args[0];\n            this.mToXValue = args[1];\n            this.mFromYValue = args[2];\n            this.mToYValue = args[3];\n            this.mFromXType = TranslateAnimation.ABSOLUTE;\n            this.mToXType = TranslateAnimation.ABSOLUTE;\n            this.mFromYType = TranslateAnimation.ABSOLUTE;\n            this.mToYType = TranslateAnimation.ABSOLUTE;\n        }else{\n            this.mFromXType = args[0];\n            this.mFromXValue = args[1];\n            this.mToXType = args[2];\n            this.mToXValue = args[3];\n            this.mFromYType = args[4];\n            this.mFromYValue = args[5];\n            this.mToYType = args[6];\n            this.mToYValue = args[7];\n        }\n    }\n\n    protected applyTransformation(interpolatedTime:number, t:Transformation):void  {\n        let dx:number = this.mFromXDelta;\n        let dy:number = this.mFromYDelta;\n        if (this.mFromXDelta != this.mToXDelta) {\n            dx = this.mFromXDelta + ((this.mToXDelta - this.mFromXDelta) * interpolatedTime);\n        }\n        if (this.mFromYDelta != this.mToYDelta) {\n            dy = this.mFromYDelta + ((this.mToYDelta - this.mFromYDelta) * interpolatedTime);\n        }\n        t.getMatrix().setTranslate(dx, dy);\n    }\n\n    initialize(width:number, height:number, parentWidth:number, parentHeight:number):void  {\n        super.initialize(width, height, parentWidth, parentHeight);\n        this.mFromXDelta = this.resolveSize(this.mFromXType, this.mFromXValue, width, parentWidth);\n        this.mToXDelta = this.resolveSize(this.mToXType, this.mToXValue, width, parentWidth);\n        this.mFromYDelta = this.resolveSize(this.mFromYType, this.mFromYValue, height, parentHeight);\n        this.mToYDelta = this.resolveSize(this.mToYType, this.mToYValue, height, parentHeight);\n    }\n}\n}"
  },
  {
    "path": "src/android/view/menu/MenuPopupHelper.ts",
    "content": "/*\n * Copyright (C) 2010 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../../android/content/res/Resources.ts\"/>\n///<reference path=\"../../../android/R/layout.ts\"/>\n///<reference path=\"../../../android/R/attr.ts\"/>\n///<reference path=\"../../../android/widget/ListPopupWindow.ts\"/>\n///<reference path=\"../../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../../android/view/LayoutInflater.ts\"/>\n///<reference path=\"../../../android/view/Menu.ts\"/>\n///<reference path=\"../../../android/view/MenuItem.ts\"/>\n///<reference path=\"../../../android/view/View.ts\"/>\n///<reference path=\"../../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../../android/view/ViewTreeObserver.ts\"/>\n///<reference path=\"../../../android/widget/AdapterView.ts\"/>\n///<reference path=\"../../../android/widget/TextView.ts\"/>\n///<reference path=\"../../../android/widget/ImageView.ts\"/>\n///<reference path=\"../../../android/widget/BaseAdapter.ts\"/>\n///<reference path=\"../../../android/widget/FrameLayout.ts\"/>\n///<reference path=\"../../../android/widget/ListAdapter.ts\"/>\n///<reference path=\"../../../android/widget/PopupWindow.ts\"/>\n///<reference path=\"../../../java/util/ArrayList.ts\"/>\n\nmodule android.view.menu {\nimport Resources = android.content.res.Resources;\nimport R = android.R;\nimport ListPopupWindow = android.widget.ListPopupWindow;\nimport KeyEvent = android.view.KeyEvent;\nimport LayoutInflater = android.view.LayoutInflater;\nimport MenuItem = android.view.MenuItem;\nimport Menu = android.view.Menu;\nimport View = android.view.View;\nimport MeasureSpec = android.view.View.MeasureSpec;\nimport ViewGroup = android.view.ViewGroup;\nimport Context = android.content.Context;\nimport ViewTreeObserver = android.view.ViewTreeObserver;\nimport AdapterView = android.widget.AdapterView;\nimport TextView = android.widget.TextView;\nimport ImageView = android.widget.ImageView;\nimport BaseAdapter = android.widget.BaseAdapter;\nimport FrameLayout = android.widget.FrameLayout;\nimport ListAdapter = android.widget.ListAdapter;\nimport PopupWindow = android.widget.PopupWindow;\nimport ArrayList = java.util.ArrayList;\n/**\n * Presents a menu as a small, simple popup anchored to another view.\n *\n * @hide\n */\nexport class MenuPopupHelper implements AdapterView.OnItemClickListener, View.OnKeyListener,\n    ViewTreeObserver.OnGlobalLayoutListener, PopupWindow.OnDismissListener\n        //, MenuPresenter\n    {\n\n    private static TAG:string = \"MenuPopupHelper\";\n\n    static ITEM_LAYOUT:string = R.layout.popup_menu_item_layout;\n\n    private mContext:Context;\n\n    private mInflater:LayoutInflater;\n\n    private mPopup:ListPopupWindow;\n\n    private mMenu:Menu;\n\n    private mPopupMaxWidth:number = 0;\n\n    private mAnchorView:View;\n\n    //private mOverflowOnly:boolean;\n\n    private mTreeObserver:ViewTreeObserver;\n\n    private mAdapter:MenuPopupHelper.MenuAdapter;\n\n    //private mPresenterCallback:Callback;\n\n    //mForceShowIcon:boolean;\n\n    private mMeasureParent:ViewGroup;\n\n    constructor(context:Context, menu:Menu, anchorView:View=null) {\n        this.mContext = context;\n        this.mInflater = LayoutInflater.from(context);\n        this.mMenu = menu;\n        //this.mOverflowOnly = overflowOnly;\n        const res:Resources = context.getResources();\n        this.mPopupMaxWidth = Math.max(res.getDisplayMetrics().widthPixels / 2, res.getDisplayMetrics().density * 320);\n        this.mAnchorView = anchorView;\n        //menu.addMenuPresenter(this);\n    }\n\n    setAnchorView(anchor:View):void  {\n        this.mAnchorView = anchor;\n    }\n\n    //setForceShowIcon(forceShow:boolean):void  {\n    //    this.mForceShowIcon = forceShow;\n    //}\n\n    show():void  {\n        if (!this.tryShow()) {\n            throw Error(`new IllegalStateException(\"MenuPopupHelper cannot be used without an anchor\")`);\n        }\n    }\n\n    tryShow():boolean  {\n        this.mPopup = new ListPopupWindow(this.mContext, R.attr.popupMenuStyle);\n        this.mPopup.setOnDismissListener(this);\n        this.mPopup.setOnItemClickListener(this);\n        this.mAdapter = new MenuPopupHelper.MenuAdapter(this.mMenu, this);\n        this.mPopup.setAdapter(this.mAdapter);\n        this.mPopup.setModal(true);\n        let anchor:View = this.mAnchorView;\n        if (anchor != null) {\n            const addGlobalListener:boolean = this.mTreeObserver == null;\n            // Refresh to latest\n            this.mTreeObserver = anchor.getViewTreeObserver();\n            if (addGlobalListener) {\n                this.mTreeObserver.addOnGlobalLayoutListener(this);\n            }\n            this.mPopup.setAnchorView(anchor);\n        } else {\n            return false;\n        }\n        this.mPopup.setContentWidth(Math.min(this.measureContentWidth(this.mAdapter), this.mPopupMaxWidth));\n        this.mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);\n        this.mPopup.show();\n        this.mPopup.getListView().setOnKeyListener(this);\n        return true;\n    }\n\n    dismiss():void  {\n        if (this.isShowing()) {\n            this.mPopup.dismiss();\n        }\n    }\n\n    onDismiss():void  {\n        this.mPopup = null;\n        //this.mMenu.close();\n        if (this.mTreeObserver != null) {\n            if (!this.mTreeObserver.isAlive()) {\n                this.mTreeObserver = this.mAnchorView.getViewTreeObserver();\n            }\n            this.mTreeObserver.removeGlobalOnLayoutListener(this);\n            this.mTreeObserver = null;\n        }\n    }\n\n    isShowing():boolean  {\n        return this.mPopup != null && this.mPopup.isShowing();\n    }\n\n    onItemClick(parent:AdapterView<any>, view:View, position:number, id:number):void  {\n        let adapter:MenuPopupHelper.MenuAdapter = this.mAdapter;\n        let invoked:boolean = adapter.getItem(position).invoke();\n        if(invoked) this.mPopup.dismiss();\n        //adapter.mAdapterMenu.performItemAction(adapter.getItem(position), 0);\n    }\n\n    onKey(v:View, keyCode:number, event:KeyEvent):boolean  {\n        if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_MENU) {\n            this.dismiss();\n            return true;\n        }\n        return false;\n    }\n\n    private measureContentWidth(adapter:ListAdapter):number  {\n        // Menus don't tend to be long, so this is more sane than it looks.\n        let width:number = 0;\n        let itemView:View = null;\n        let itemType:number = 0;\n        const widthMeasureSpec:number = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);\n        const heightMeasureSpec:number = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);\n        const count:number = adapter.getCount();\n        for (let i:number = 0; i < count; i++) {\n            const positionType:number = adapter.getItemViewType(i);\n            if (positionType != itemType) {\n                itemType = positionType;\n                itemView = null;\n            }\n            if (this.mMeasureParent == null) {\n                this.mMeasureParent = new FrameLayout(this.mContext);\n            }\n            itemView = adapter.getView(i, itemView, this.mMeasureParent);\n            itemView.measure(widthMeasureSpec, heightMeasureSpec);\n            width = Math.max(width, itemView.getMeasuredWidth());\n        }\n        return width;\n    }\n\n    onGlobalLayout():void  {\n        if (this.isShowing()) {\n            const anchor:View = this.mAnchorView;\n            if (anchor == null || !anchor.isShown()) {\n                this.dismiss();\n            } else if (this.isShowing()) {\n                // Recompute window size and position\n                try {\n                    this.mPopup.setContentWidth(Math.min(this.measureContentWidth(this.mAdapter), this.mPopupMaxWidth));\n                } catch (e) {\n                }\n                this.mPopup.show();\n            }\n        }\n    }\n\n    //initForMenu(context:Context, menu:Menu):void  {\n    //// Don't need to do anything; we added as a presenter in the constructor.\n    //}\n    //\n    //getMenuView(root:ViewGroup):MenuView  {\n    //    throw Error(`new UnsupportedOperationException(\"MenuPopupHelpers manage their own views\")`);\n    //}\n    //\n    //updateMenuView(cleared:boolean):void  {\n    //    if (this.mAdapter != null) {\n    //        this.mAdapter.notifyDataSetChanged();\n    //    }\n    //}\n    //\n    //setCallback(cb:Callback):void  {\n    //    this.mPresenterCallback = cb;\n    //}\n    //\n    //androidui: sub menu not support yet\n    //onSubMenuSelected(subMenu:SubMenuBuilder):boolean  {\n    //    if (subMenu.hasVisibleItems()) {\n    //        let subPopup:MenuPopupHelper = new MenuPopupHelper(this.mContext, subMenu, this.mAnchorView, false);\n    //        subPopup.setCallback(this.mPresenterCallback);\n    //        let preserveIconSpacing:boolean = false;\n    //        const count:number = subMenu.size();\n    //        for (let i:number = 0; i < count; i++) {\n    //            let childItem:MenuItem = subMenu.getItem(i);\n    //            if (childItem.isVisible() && childItem.getIcon() != null) {\n    //                preserveIconSpacing = true;\n    //                break;\n    //            }\n    //        }\n    //        subPopup.setForceShowIcon(preserveIconSpacing);\n    //        if (subPopup.tryShow()) {\n    //            if (this.mPresenterCallback != null) {\n    //                this.mPresenterCallback.onOpenSubMenu(subMenu);\n    //            }\n    //            return true;\n    //        }\n    //    }\n    //    return false;\n    //}\n    //\n    //onCloseMenu(menu:Menu, allMenusAreClosing:boolean):void  {\n    //    // Only care about the (sub)menu we're presenting.\n    //    if (menu != this.mMenu) {\n    //        return;\n    //    }\n    //    this.dismiss();\n    //    if (this.mPresenterCallback != null) {\n    //        this.mPresenterCallback.onCloseMenu(menu, allMenusAreClosing);\n    //    }\n    //}\n    //\n    //flagActionItems():boolean  {\n    //    return false;\n    //}\n    //\n    //expandItemActionView(menu:Menu, item:MenuItem):boolean  {\n    //    return false;\n    //}\n    //\n    //collapseItemActionView(menu:Menu, item:MenuItem):boolean  {\n    //    return false;\n    //}\n    //\n    //getId():number  {\n    //    return 0;\n    //}\n    //\n    //onSaveInstanceState():Parcelable  {\n    //    return null;\n    //}\n    //\n    //onRestoreInstanceState(state:Parcelable):void  {\n    //}\n\n\n}\n\nexport module MenuPopupHelper{\nexport class MenuAdapter extends BaseAdapter {\n    _MenuPopupHelper_this:MenuPopupHelper;\n\n    private mAdapterMenu:Menu;\n\n    //private mExpandedIndex:number = -1;\n\n    constructor(menu:Menu, arg:MenuPopupHelper){\n        super();\n        this._MenuPopupHelper_this = arg;\n        this.mAdapterMenu = menu;\n        //this.findExpandedIndex();\n    }\n\n    getCount():number  {\n        let items:ArrayList<MenuItem> =\n            //this._MenuPopupHelper_this.mOverflowOnly ? this.mAdapterMenu.getNonActionItems() :\n                this.mAdapterMenu.getVisibleItems();\n        //if (this.mExpandedIndex < 0) {\n            return items.size();\n        //}\n        //return items.size() - 1;\n    }\n\n    getItem(position:number):MenuItem  {\n        let items:ArrayList<MenuItem> =\n            //this._MenuPopupHelper_this.mOverflowOnly ? this.mAdapterMenu.getNonActionItems() :\n                this.mAdapterMenu.getVisibleItems();\n        //if (this.mExpandedIndex >= 0 && position >= this.mExpandedIndex) {\n        //    position++;\n        //}\n        return items.get(position);\n    }\n\n    getItemId(position:number):number  {\n        // ID for the item in the AdapterView\n        return position;\n    }\n\n    getView(position:number, convertView:View, parent:ViewGroup):View  {\n        if (convertView == null) {\n            convertView = this._MenuPopupHelper_this.mInflater.inflate(MenuPopupHelper.ITEM_LAYOUT, parent, false);\n        }\n        let itemData = this.getItem(position);\n        convertView.setVisibility(itemData.isVisible() ? View.VISIBLE : View.GONE);\n\n        //setTitle\n        let titleView = <TextView>convertView.findViewById('title');\n        titleView.setText(itemData.getTitle());\n\n        //set short cut (summary)\n        //no short cut api yet\n\n        //set icon\n        let iconView = <ImageView>convertView.findViewById('icon');\n        let icon = itemData.getIcon();\n        iconView.setImageDrawable(icon);\n        if (icon != null) {\n            iconView.setImageDrawable(icon);\n            iconView.setVisibility(View.VISIBLE);\n        } else {\n            iconView.setVisibility(View.GONE);\n        }\n\n        //set enable\n        convertView.setEnabled(itemData.isEnabled());\n\n        //let itemView:MenuView.ItemView = <MenuView.ItemView> convertView;\n        //if (this._MenuPopupHelper_this.mForceShowIcon) {\n        //    (<ListMenuItemView> convertView).setForceShowIcon(true);\n        //}\n        //itemView.initialize(this.getItem(position), 0);\n        return convertView;\n    }\n\n    //findExpandedIndex():void  {\n    //    const expandedItem:MenuItem = this._MenuPopupHelper_this.mMenu.getExpandedItem();\n    //    if (expandedItem != null) {\n    //        const items:ArrayList<MenuItem> = this._MenuPopupHelper_this.mMenu.getNonActionItems();\n    //        const count:number = items.size();\n    //        for (let i:number = 0; i < count; i++) {\n    //            const item:MenuItem = items.get(i);\n    //            if (item == expandedItem) {\n    //                this.mExpandedIndex = i;\n    //                return;\n    //            }\n    //        }\n    //    }\n    //    this.mExpandedIndex = -1;\n    //}\n\n    notifyDataSetChanged():void  {\n        //this.findExpandedIndex();\n        super.notifyDataSetChanged();\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/webkit/WebView.ts",
    "content": "///<reference path=\"../../androidui/widget/HtmlBaseView.ts\"/>\n///<reference path=\"WebViewClient.ts\"/>\n\n\n\nmodule android.webkit {\n    import HtmlBaseView = androidui.widget.HtmlBaseView;\n    import Activity = android.app.Activity;\n\n    /**\n     * AndroidUI NOTE: (in browser)\n     * can't call any webView's methods when host activity was pause\n     * some method can't work fine when load other host's page (Cross domain)\n     * WARN: webView may make history stack weirdly when webView load to other url after first url loaded.\n     * (in native mode webView no these limits)\n     */\n    export class WebView extends HtmlBaseView {\n        private iFrameElement:HTMLIFrameElement;\n        protected mClient:WebViewClient;\n        private initIFrameHistoryLength = -1;\n\n        constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n            super(context, bindElement, defStyle);\n\n            //default size\n            let density = this.getResources().getDisplayMetrics().density;\n            this.setMinimumWidth(300 * density);\n            this.setMinimumHeight(150 * density);\n            // this.initIFrameElement(); //init when call loadUrl()\n        }\n\n        private initIFrameElement(url:string){\n            this.iFrameElement = document.createElement('iframe');\n            this.iFrameElement.style.border = 'none';\n            this.iFrameElement.style.height = '100%';\n            this.iFrameElement.style.width = '100%';\n            this.iFrameElement.onload = ()=>{\n                this.checkActivityResume();\n                if(this.initIFrameHistoryLength<0) this.initIFrameHistoryLength = history.length;\n                if(this.mClient){\n                    this.mClient.onReceivedTitle(this, this.getTitle());\n                    this.mClient.onPageFinished(this, this.getUrl());\n                }\n            };\n            this.bindElement.style['webkitOverflowScrolling'] = this.bindElement.style['overflowScrolling'] = 'touch';\n            this.bindElement.style.overflowY = 'auto';\n\n            if(url) this.iFrameElement.src = url;\n            this.bindElement.appendChild(this.iFrameElement);\n\n\n            //override activity's onDestroy\n            let activity = <Activity>this.getContext();\n            let onDestroy = activity.onDestroy;\n            activity.onDestroy = ()=>{\n                onDestroy.call(activity);\n                PageStack.preClosePageHasIFrame(this.initIFrameHistoryLength);\n            };\n        }\n\n        private checkActivityResume(){\n            if(!(<Activity>this.getContext()).mResumed){\n                console.error('can\\'t call any webview\\'s methods when host activity was pause');\n            }\n        }\n\n        goBack():void {\n            this.checkActivityResume();\n            if(this.canGoBack()){\n                history.back();\n            }\n        }\n\n        canGoBack():boolean {\n            this.checkActivityResume();\n            if(this.initIFrameHistoryLength<0) return false;\n            return history.length > this.initIFrameHistoryLength;\n        }\n\n        /**\n         * Loads the given URL.\n         *\n         * @param url the URL of the resource to load\n         */\n        loadUrl(url:string):void {\n            if(this.initIFrameHistoryLength>0){//iframe already loaded, should check.\n                this.checkActivityResume();\n            }\n            if(!this.iFrameElement){\n                this.initIFrameElement(url);\n            }\n\n            this.iFrameElement.src = url;\n        }\n\n        /**\n         * Reloads the current URL.\n         */\n        reload():void {\n            if(!this.iFrameElement) return;\n            try {\n                this.iFrameElement.contentWindow.location.reload();\n            } catch (e) {\n                this.iFrameElement.src = this.iFrameElement.src;\n            }\n        }\n\n        /**\n         * Gets the URL for the current page. This is not always the same as the URL\n         * passed to WebViewClient.onPageStarted because although the load for\n         * that URL has begun, the current page may not have changed.\n         *\n         * @return the URL for the current page\n         */\n        getUrl():string  {\n            if(!this.iFrameElement) return '';\n            try {\n                return this.iFrameElement.contentWindow.document.URL;\n            } catch (e) {\n                return this.iFrameElement.src;\n            }\n        }\n\n        /**\n         * Gets the title for the current page. This is the title of the current page\n         * until WebViewClient.onReceivedTitle is called.\n         *\n         * @return the title for the current page\n         */\n        getTitle():string  {\n            try {\n                return this.iFrameElement.contentWindow.document.title;\n            } catch (e) {\n                console.warn(e);\n                return '';\n            }\n        }\n\n        /**\n         * Sets the WebViewClient that will receive various notifications and\n         * requests. This will replace the current handler.\n         *\n         * @param client an implementation of WebViewClient\n         */\n        setWebViewClient(client:WebViewClient):void  {\n            this.mClient = client;\n        }\n    }\n}"
  },
  {
    "path": "src/android/webkit/WebViewClient.ts",
    "content": "///<reference path=\"WebView.ts\"/>\n\nmodule android.webkit {\n    export class WebViewClient {\n        onPageFinished(view:WebView, url:string):void  {\n\n        }\n\n        /**\n         * Notify the host application of a change in the document title.\n         * @param view The WebView that initiated the callback.\n         * @param title A String containing the new title of the document.\n         */\n        onReceivedTitle(view:WebView, title:string):void  {\n        }\n    }\n}"
  },
  {
    "path": "src/android/widget/AbsListView.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/text/InputType.ts\"/>\n///<reference path=\"../../android/text/TextUtils.ts\"/>\n///<reference path=\"../../android/util/Log.ts\"/>\n///<reference path=\"../../android/util/LongSparseArray.ts\"/>\n///<reference path=\"../../android/util/SparseArray.ts\"/>\n///<reference path=\"../../android/util/SparseBooleanArray.ts\"/>\n///<reference path=\"../../android/util/StateSet.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/view/HapticFeedbackConstants.ts\"/>\n///<reference path=\"../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../android/view/VelocityTracker.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewConfiguration.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/view/ViewParent.ts\"/>\n///<reference path=\"../../android/view/ViewTreeObserver.ts\"/>\n///<reference path=\"../../android/view/animation/Interpolator.ts\"/>\n///<reference path=\"../../android/view/animation/LinearInterpolator.ts\"/>\n///<reference path=\"../../java/util/ArrayList.ts\"/>\n///<reference path=\"../../java/util/List.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../java/lang/Runnable.ts\"/>\n///<reference path=\"../../java/lang/System.ts\"/>\n///<reference path=\"../../android/widget/Adapter.ts\"/>\n///<reference path=\"../../android/widget/AdapterView.ts\"/>\n///<reference path=\"../../android/widget/Button.ts\"/>\n///<reference path=\"../../android/widget/Checkable.ts\"/>\n///<reference path=\"../../android/widget/ListAdapter.ts\"/>\n///<reference path=\"../../android/widget/OverScroller.ts\"/>\n///<reference path=\"../../android/R/drawable.ts\"/>\n\nmodule android.widget {\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n    import Drawable = android.graphics.drawable.Drawable;\n    import InputType = android.text.InputType;\n    import TextUtils = android.text.TextUtils;\n    import Log = android.util.Log;\n    import LongSparseArray = android.util.LongSparseArray;\n    import SparseArray = android.util.SparseArray;\n    import SparseBooleanArray = android.util.SparseBooleanArray;\n    import StateSet = android.util.StateSet;\n    import Gravity = android.view.Gravity;\n    import HapticFeedbackConstants = android.view.HapticFeedbackConstants;\n    import KeyEvent = android.view.KeyEvent;\n    import MotionEvent = android.view.MotionEvent;\n    import VelocityTracker = android.view.VelocityTracker;\n    import View = android.view.View;\n    import ViewConfiguration = android.view.ViewConfiguration;\n    import ViewGroup = android.view.ViewGroup;\n    import ViewParent = android.view.ViewParent;\n    import ViewTreeObserver = android.view.ViewTreeObserver;\n    import Interpolator = android.view.animation.Interpolator;\n    import LinearInterpolator = android.view.animation.LinearInterpolator;\n    import ArrayList = java.util.ArrayList;\n    import List = java.util.List;\n    import Integer = java.lang.Integer;\n    import Runnable = java.lang.Runnable;\n    import System = java.lang.System;\n    import Adapter = android.widget.Adapter;\n    import AdapterView = android.widget.AdapterView;\n    import Button = android.widget.Button;\n    import Checkable = android.widget.Checkable;\n    import ListAdapter = android.widget.ListAdapter;\n    import OverScroller = android.widget.OverScroller;\n    import AttrBinder = androidui.attr.AttrBinder;\n    /**\n     * Base class that can be used to implement virtualized lists of items. A list does\n     * not have a spatial definition here. For instance, subclases of this class can\n     * display the content of the list in a grid, in a carousel, as stack, etc.\n     *\n     * @attr ref android.R.styleable#AbsListView_listSelector\n     * @attr ref android.R.styleable#AbsListView_drawSelectorOnTop\n     * @attr ref android.R.styleable#AbsListView_stackFromBottom\n     * @attr ref android.R.styleable#AbsListView_scrollingCache\n     * @attr ref android.R.styleable#AbsListView_textFilterEnabled\n     * @attr ref android.R.styleable#AbsListView_transcriptMode\n     * @attr ref android.R.styleable#AbsListView_cacheColorHint\n     * @attr ref android.R.styleable#AbsListView_fastScrollEnabled\n     * @attr ref android.R.styleable#AbsListView_smoothScrollbar\n     * @attr ref android.R.styleable#AbsListView_choiceMode\n     */\n\n    export abstract class AbsListView extends AdapterView<ListAdapter> implements ViewTreeObserver.OnGlobalLayoutListener,\n        ViewTreeObserver.OnTouchModeChangeListener {\n\n        static TAG_AbsListView:string = \"AbsListView\";\n\n        /**\n         * Disables the transcript mode.\n         *\n         * @see #setTranscriptMode(int)\n         */\n        static TRANSCRIPT_MODE_DISABLED:number = 0;\n\n        /**\n         * The list will automatically scroll to the bottom when a data set change\n         * notification is received and only if the last item is already visible\n         * on screen.\n         *\n         * @see #setTranscriptMode(int)\n         */\n        static TRANSCRIPT_MODE_NORMAL:number = 1;\n\n        /**\n         * The list will automatically scroll to the bottom, no matter what items\n         * are currently visible.\n         *\n         * @see #setTranscriptMode(int)\n         */\n        static TRANSCRIPT_MODE_ALWAYS_SCROLL:number = 2;\n\n        /**\n         * Indicates that we are not in the middle of a touch gesture\n         */\n        static TOUCH_MODE_REST:number = -1;\n\n        /**\n         * Indicates we just received the touch event and we are waiting to see if the it is a tap or a\n         * scroll gesture.\n         */\n        static TOUCH_MODE_DOWN:number = 0;\n\n        /**\n         * Indicates the touch has been recognized as a tap and we are now waiting to see if the touch\n         * is a longpress\n         */\n        static TOUCH_MODE_TAP:number = 1;\n\n        /**\n         * Indicates we have waited for everything we can wait for, but the user's finger is still down\n         */\n        static TOUCH_MODE_DONE_WAITING:number = 2;\n\n        /**\n         * Indicates the touch gesture is a scroll\n         */\n        static TOUCH_MODE_SCROLL:number = 3;\n\n        /**\n         * Indicates the view is in the process of being flung\n         */\n        static TOUCH_MODE_FLING:number = 4;\n\n        /**\n         * Indicates the touch gesture is an overscroll - a scroll beyond the beginning or end.\n         */\n        private static TOUCH_MODE_OVERSCROLL:number = 5;\n\n        /**\n         * Indicates the view is being flung outside of normal content bounds\n         * and will spring back.\n         */\n        static TOUCH_MODE_OVERFLING:number = 6;\n\n        /**\n         * Regular layout - usually an unsolicited layout from the view system\n         */\n        static LAYOUT_NORMAL:number = 0;\n\n        /**\n         * Show the first item\n         */\n        static LAYOUT_FORCE_TOP:number = 1;\n\n        /**\n         * Force the selected item to be on somewhere on the screen\n         */\n        static LAYOUT_SET_SELECTION:number = 2;\n\n        /**\n         * Show the last item\n         */\n        static LAYOUT_FORCE_BOTTOM:number = 3;\n\n        /**\n         * Make a mSelectedItem appear in a specific location and build the rest of\n         * the views from there. The top is specified by mSpecificTop.\n         */\n        static LAYOUT_SPECIFIC:number = 4;\n\n        /**\n         * Layout to sync as a result of a data change. Restore mSyncPosition to have its top\n         * at mSpecificTop\n         */\n        static LAYOUT_SYNC:number = 5;\n\n        /**\n         * Layout as a result of using the navigation keys\n         */\n        static LAYOUT_MOVE_SELECTION:number = 6;\n\n        /**\n         * Normal list that does not indicate choices\n         */\n        static CHOICE_MODE_NONE:number = 0;\n\n        /**\n         * The list allows up to one choice\n         */\n        static CHOICE_MODE_SINGLE:number = 1;\n\n        /**\n         * The list allows multiple choices\n         */\n        static CHOICE_MODE_MULTIPLE:number = 2;\n\n        /**\n         * The list allows multiple choices in a modal selection mode\n         * !!not impl this mode\n         */\n        static CHOICE_MODE_MULTIPLE_MODAL:number = 3;\n\n        /**\n         * Controls if/how the user may choose/check items in the list\n         */\n        mChoiceMode:number = AbsListView.CHOICE_MODE_NONE;\n\n        /**\n         * Controls CHOICE_MODE_MULTIPLE_MODAL. null when inactive.\n         * !!not impl current\n         */\n        private mChoiceActionMode;\n\n        /**\n         * Wrapper for the multiple choice mode callback; AbsListView needs to perform\n         * a few extra actions around what application code does.\n         */\n        //private mMultiChoiceModeCallback:AbsListView.MultiChoiceModeWrapper;\n\n        /**\n         * Running count of how many items are currently checked\n         */\n        private mCheckedItemCount:number = 0;\n\n        /**\n         * Running state of which positions are currently checked\n         */\n        mCheckStates:SparseBooleanArray;\n\n        /**\n         * Running state of which IDs are currently checked.\n         * If there is a value for a given key, the checked state for that ID is true\n         * and the value holds the last known position in the adapter for that id.\n         */\n        private mCheckedIdStates:LongSparseArray<number>;\n\n        /**\n         * Controls how the next layout will happen\n         */\n        //mLayoutMode:number = AbsListView.LAYOUT_NORMAL;\n\n        /**\n         * Should be used by subclasses to listen to changes in the dataset\n         */\n        mDataSetObserver:AbsListView.AdapterDataSetObserver;\n\n        /**\n         * The adapter containing the data to be displayed by this view\n         */\n        mAdapter:ListAdapter;\n\n        /**\n         * If mAdapter != null, whenever this is true the adapter has stable IDs.\n         */\n        private mAdapterHasStableIds:boolean;\n\n        /**\n         * This flag indicates the a full notify is required when the RemoteViewsAdapter connects\n         */\n        private mDeferNotifyDataSetChanged:boolean = false;\n\n        /**\n         * Indicates whether the list selector should be drawn on top of the children or behind\n         */\n        private mDrawSelectorOnTop:boolean = false;\n\n        /**\n         * The drawable used to draw the selector\n         */\n        private mSelector:Drawable;\n\n        /**\n         * The current position of the selector in the list.\n         */\n        private mSelectorPosition:number = AbsListView.INVALID_POSITION;\n\n        /**\n         * Defines the selector's location and dimension at drawing time\n         */\n        mSelectorRect:Rect = new Rect();\n\n        /**\n         * The data set used to store unused views that should be reused during the next layout\n         * to avoid creating new ones\n         */\n        mRecycler:AbsListView.RecycleBin = new AbsListView.RecycleBin(this);\n\n        /**\n         * The selection's left padding\n         */\n        private mSelectionLeftPadding:number = 0;\n\n        /**\n         * The selection's top padding\n         */\n        private mSelectionTopPadding:number = 0;\n\n        /**\n         * The selection's right padding\n         */\n        private mSelectionRightPadding:number = 0;\n\n        /**\n         * The selection's bottom padding\n         */\n        private mSelectionBottomPadding:number = 0;\n\n        /**\n         * This view's padding\n         */\n        mListPadding:Rect = new Rect();\n\n        /**\n         * Subclasses must retain their measure spec from onMeasure() into this member\n         */\n        mWidthMeasureSpec:number = 0;\n\n        /**\n         * The top scroll indicator\n         */\n        private mScrollUp:View;\n\n        /**\n         * The down scroll indicator\n         */\n        private mScrollDown:View;\n\n        /**\n         * When the view is scrolling, this flag is set to true to indicate subclasses that\n         * the drawing cache was enabled on the children\n         */\n        mCachingStarted:boolean;\n\n        mCachingActive:boolean;\n\n        /**\n         * The position of the view that received the down motion event\n         */\n        mMotionPosition:number = 0;\n\n        /**\n         * The offset to the top of the mMotionPosition view when the down motion event was received\n         */\n        private mMotionViewOriginalTop:number = 0;\n\n        /**\n         * The desired offset to the top of the mMotionPosition view after a scroll\n         */\n        private mMotionViewNewTop:number = 0;\n\n        /**\n         * The X value associated with the the down motion event\n         */\n        private mMotionX:number = 0;\n\n        /**\n         * The Y value associated with the the down motion event\n         */\n        private mMotionY:number = 0;\n\n        /**\n         * One of TOUCH_MODE_REST, TOUCH_MODE_DOWN, TOUCH_MODE_TAP, TOUCH_MODE_SCROLL, or\n         * TOUCH_MODE_DONE_WAITING\n         */\n        mTouchMode:number = AbsListView.TOUCH_MODE_REST;\n\n        /**\n         * Y value from on the previous motion event (if any)\n         */\n        private mLastY:number = 0;\n\n        /**\n         * How far the finger moved before we started scrolling\n         */\n        private mMotionCorrection:number = 0;\n\n        /**\n         * Determines speed during touch scrolling\n         */\n        private mVelocityTracker:VelocityTracker;\n\n        /**\n         * Handles one frame of a fling\n         */\n        mFlingRunnable:AbsListView.FlingRunnable;\n\n        /**\n         * Handles scrolling between positions within the list.\n         */\n        mPositionScroller:AbsListView.PositionScroller;\n\n        /**\n         * The offset in pixels form the top of the AdapterView to the top\n         * of the currently selected view. Used to save and restore state.\n         */\n        mSelectedTop:number = 0;\n\n        /**\n         * Indicates whether the list is stacked from the bottom edge or\n         * the top edge.\n         */\n        mStackFromBottom:boolean;\n\n        /**\n         * When set to true, the list automatically discards the children's\n         * bitmap cache after scrolling.\n         */\n        private mScrollingCacheEnabled:boolean;\n\n        /**\n         * Whether or not to enable the fast scroll feature on this list\n         */\n        private mFastScrollEnabled:boolean;\n\n        /**\n         * Whether or not to always show the fast scroll feature on this list\n         */\n        private mFastScrollAlwaysVisible:boolean;\n\n        /**\n         * Optional callback to notify client when scroll position has changed\n         */\n        private mOnScrollListener:AbsListView.OnScrollListener;\n\n        /**\n         * Indicates whether to use pixels-based or position-based scrollbar\n         * properties.\n         */\n        private mSmoothScrollbarEnabled:boolean = true;\n\n        /**\n         * Indicates that this view supports filtering\n         */\n        private mTextFilterEnabled:boolean;\n\n        /**\n         * Indicates that this view is currently displaying a filtered view of the data\n         */\n        private mFiltered:boolean;\n\n        /**\n         * Rectangle used for hit testing children\n         */\n        private mTouchFrame:Rect;\n\n        /**\n         * The position to resurrect the selected position to.\n         */\n        mResurrectToPosition:number = AbsListView.INVALID_POSITION;\n\n        /**\n         * Maximum distance to record overscroll\n         */\n        private mOverscrollMax:number = 0;\n\n        /**\n         * Content height divided by this is the overscroll limit.\n         */\n        private static OVERSCROLL_LIMIT_DIVISOR:number = 3;\n\n        /**\n         * How many positions in either direction we will search to try to\n         * find a checked item with a stable ID that moved position across\n         * a data set change. If the item isn't found it will be unselected.\n         */\n        private static CHECK_POSITION_SEARCH_DISTANCE:number = 20;\n\n        /**\n         * Used to request a layout when we changed touch mode\n         */\n        private static TOUCH_MODE_UNKNOWN:number = -1;\n\n        private static TOUCH_MODE_ON:number = 0;\n\n        private static TOUCH_MODE_OFF:number = 1;\n\n        private mLastTouchMode:number = AbsListView.TOUCH_MODE_UNKNOWN;\n\n        private static PROFILE_SCROLLING:boolean = false;\n\n        private mScrollProfilingStarted:boolean = false;\n\n        static PROFILE_FLINGING:boolean = false;\n\n        private mFlingProfilingStarted:boolean = false;\n\n        /**\n         * The last CheckForLongPress runnable we posted, if any\n         */\n        private mPendingCheckForLongPress_List:AbsListView.CheckForLongPress;\n\n        /**\n         * The last CheckForTap runnable we posted, if any\n         */\n        private mPendingCheckForTap_:Runnable;\n\n        /**\n         * The last CheckForKeyLongPress runnable we posted, if any\n         */\n        private mPendingCheckForKeyLongPress:AbsListView.CheckForKeyLongPress;\n\n        /**\n         * Acts upon click\n         */\n        private mPerformClick_:AbsListView.PerformClick;\n\n        /**\n         * Delayed action for touch mode.\n         */\n        mTouchModeReset:Runnable;\n\n        /**\n         * This view is in transcript mode -- it shows the bottom of the list when the data\n         * changes\n         */\n        private mTranscriptMode:number = 0;\n\n        /**\n         * Indicates that this list is always drawn on top of a solid, single-color, opaque\n         * background\n         */\n        private mCacheColorHint:number = 0;\n\n        /**\n         * The select child's view (from the adapter's getView) is enabled.\n         */\n        private mIsChildViewEnabled:boolean;\n\n        /**\n         * The last scroll state reported to clients through {@link OnScrollListener}.\n         */\n        private mLastScrollState:number = AbsListView.OnScrollListener.SCROLL_STATE_IDLE;\n\n        /**\n         * Helper object that renders and controls the fast scroll thumb.\n         */\n        //private mFastScroller:FastScroller;//TODO when fast scroll impl\n\n        private mGlobalLayoutListenerAddedFilter:boolean;\n\n        //private mTouchSlop:number = 0;\n\n        private mDensityScale:number = 0;\n\n        private mClearScrollingCache:Runnable;\n\n        mPositionScrollAfterLayout:Runnable;\n\n        private mMinimumVelocity:number = 0;\n\n        private mMaximumVelocity:number = 0;\n\n        private mVelocityScale:number = 1.0;\n\n        mIsScrap:boolean[] = new Array<boolean>(1);\n\n        // True when the popup should be hidden because of a call to\n        // dispatchDisplayHint()\n        private mPopupHidden:boolean;\n\n        /**\n         * ID of the active pointer. This is used to retain consistency during\n         * drags/flings if multiple pointers are used.\n         */\n        private mActivePointerId:number = AbsListView.INVALID_POINTER;\n\n        /**\n         * Sentinel value for no current active pointer.\n         * Used by {@link #mActivePointerId}.\n         */\n        static INVALID_POINTER:number = -1;\n\n        /**\n         * Maximum distance to overscroll by during edge effects\n         */\n        private mOverscrollDistance:number = 0;\n\n        /**\n         * Maximum distance to overfling during edge effects\n         */\n        private _mOverflingDistance:number = 0;\n        private get mOverflingDistance():number {\n            if(this.mScrollY <= 0){\n                if (this.mScrollY < -this._mOverflingDistance) return -this.mScrollY;\n                return this._mOverflingDistance;\n            }\n            let overDistance = this.mScrollY;\n            if (overDistance > this._mOverflingDistance) return overDistance;\n            return this._mOverflingDistance;\n        }\n        private set mOverflingDistance(value:number) {\n            this._mOverflingDistance = value;\n        }\n\n        // These two EdgeGlows are always set and used together.\n        // Checking one for null is as good as checking both.\n        /**\n         * Tracks the state of the top edge glow.\n         */\n        //private mEdgeGlowTop:EdgeEffect;\n\n        /**\n         * Tracks the state of the bottom edge glow.\n         */\n        //private mEdgeGlowBottom:EdgeEffect;\n\n        /**\n         * An estimate of how many pixels are between the top of the list and\n         * the top of the first position in the adapter, based on the last time\n         * we saw it. Used to hint where to draw edge glows.\n         */\n        private mFirstPositionDistanceGuess:number = 0;\n\n        /**\n         * An estimate of how many pixels are between the bottom of the list and\n         * the bottom of the last position in the adapter, based on the last time\n         * we saw it. Used to hint where to draw edge glows.\n         */\n        private mLastPositionDistanceGuess:number = 0;\n\n        /**\n         * Used for determining when to cancel out of overscroll.\n         */\n        private mDirection:number = 0;\n\n        /**\n         * Tracked on measurement in transcript mode. Makes sure that we can still pin to\n         * the bottom correctly on resizes.\n         */\n        private mForceTranscriptScroll:boolean;\n\n        private mGlowPaddingLeft:number = 0;\n\n        private mGlowPaddingRight:number = 0;\n\n        /**\n         * Used for interacting with list items from an accessibility service.\n         */\n        //private mAccessibilityDelegate:AbsListView.ListItemAccessibilityDelegate;\n        //\n        //private mLastAccessibilityScrollEventFromIndex:number;\n        //\n        //private mLastAccessibilityScrollEventToIndex:number;\n\n        /**\n         * Track the item count from the last time we handled a data change.\n         */\n        private mLastHandledItemCount:number = 0;\n\n        /**\n         * Used for smooth scrolling at a consistent rate\n         */\n        static sLinearInterpolator:Interpolator = new LinearInterpolator();\n\n        /**\n         * The saved state that we will be restoring from when we next sync.\n         * Kept here so that if we happen to be asked to save our state before\n         * the sync happens, we can return this existing data rather than losing\n         * it.\n         */\n        private mPendingSync;//:AbsListView.SavedState;\n\n\n        constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n           super(context, bindElement, defStyle);\n           this.initAbsListView();\n\n           // this.mOwnerThread = Thread.currentThread();\n\n           let a = context.obtainStyledAttributes(bindElement, defStyle);\n\n           let d:Drawable = a.getDrawable('listSelector');\n           if (d != null) {\n               this.setSelector(d);\n           }\n\n           this.mDrawSelectorOnTop = a.getBoolean('drawSelectorOnTop', false);\n\n           let stackFromBottom:boolean = a.getBoolean('stackFromBottom', false);\n           this.setStackFromBottom(stackFromBottom);\n\n           let scrollingCacheEnabled:boolean = a.getBoolean('scrollingCache', true);\n           this.setScrollingCacheEnabled(scrollingCacheEnabled);\n\n           let useTextFilter:boolean = a.getBoolean('textFilterEnabled', false);\n           this.setTextFilterEnabled(useTextFilter);\n\n           let transcriptModeValue = a.getAttrValue('transcriptMode');\n           let transcriptMode:number = AbsListView.TRANSCRIPT_MODE_DISABLED;\n           if (transcriptModeValue === \"disabled\") transcriptMode = AbsListView.TRANSCRIPT_MODE_DISABLED;\n           else if (transcriptModeValue === \"normal\") transcriptMode = AbsListView.TRANSCRIPT_MODE_NORMAL;\n           else if (transcriptModeValue === \"alwaysScroll\") transcriptMode = AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL;\n           this.setTranscriptMode(transcriptMode);\n\n           let color:number = a.getColor('cacheColorHint', 0);\n           this.setCacheColorHint(color);\n\n           let enableFastScroll:boolean = a.getBoolean('fastScrollEnabled', false);\n           this.setFastScrollEnabled(enableFastScroll);\n\n           let smoothScrollbar:boolean = a.getBoolean('smoothScrollbar', true);\n           this.setSmoothScrollbarEnabled(smoothScrollbar);\n\n           let choiceModeValue = a.getAttrValue('choiceMode');\n           let choiceMode = AbsListView.CHOICE_MODE_NONE;\n           if (choiceModeValue === \"none\") choiceMode = AbsListView.CHOICE_MODE_NONE;\n           else if (choiceModeValue === \"singleChoice\") choiceMode = AbsListView.CHOICE_MODE_SINGLE;\n           else if (choiceModeValue === \"multipleChoice\") choiceMode = AbsListView.CHOICE_MODE_MULTIPLE;\n           this.setChoiceMode(choiceMode);\n           this.setFastScrollAlwaysVisible(a.getBoolean('fastScrollAlwaysVisible', false));\n\n           a.recycle();\n        }\n\n        private initAbsListView():void {\n            // Setting focusable in touch mode will set the focusable property to true\n            this.setClickable(true);\n            this.setFocusableInTouchMode(true);\n            this.setWillNotDraw(false);\n            this.setAlwaysDrawnWithCacheEnabled(false);\n            this.setScrollingCacheEnabled(true);\n            const configuration:ViewConfiguration = ViewConfiguration.get();\n            this.mTouchSlop = configuration.getScaledTouchSlop();\n            this.mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();\n            this.mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();\n            this.mOverscrollDistance = configuration.getScaledOverscrollDistance();\n            this.mOverflingDistance = configuration.getScaledOverflingDistance();\n            this.mDensityScale = android.content.res.Resources.getDisplayMetrics().density;\n            this.mLayoutMode = AbsListView.LAYOUT_NORMAL;\n        }\n\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n            return super.createClassAttrBinder()\n                .set('listSelector', {\n                    setter(v: AbsListView, value: any, attrBinder: AttrBinder) {\n                        let d = attrBinder.parseDrawable(value);\n                        if (d) v.setSelector(d);\n                    }, getter(v: AbsListView) {\n                        return v.getSelector();\n                    }\n                })\n                .set('drawSelectorOnTop', {\n                    setter(v: AbsListView, value: any, attrBinder: AttrBinder) {\n                        v.setDrawSelectorOnTop(attrBinder.parseBoolean(value, false));\n                    }, getter(v: AbsListView) {\n                        return v.mDrawSelectorOnTop;\n                    }\n                })\n                .set('stackFromBottom', {\n                    setter(v: AbsListView, value: any, attrBinder: AttrBinder) {\n                        v.setStackFromBottom(attrBinder.parseBoolean(value, false));\n                    }, getter(v: AbsListView) {\n                        return v.isStackFromBottom();\n                    }\n                })\n                .set('scrollingCache', {\n                    setter(v: AbsListView, value: any, attrBinder: AttrBinder) {\n                        v.setScrollingCacheEnabled(attrBinder.parseBoolean(value, true));\n                    }, getter(v: AbsListView) {\n                        return v.isScrollingCacheEnabled();\n                    }\n                })\n                .set('transcriptMode', {\n                    setter(v: AbsListView, value: any, attrBinder: AttrBinder) {\n                        v.setTranscriptMode(attrBinder.parseEnum(value, new Map<string, number>()\n                                .set(\"disabled\", AbsListView.TRANSCRIPT_MODE_DISABLED)\n                                .set(\"normal\", AbsListView.TRANSCRIPT_MODE_NORMAL)\n                                .set(\"alwaysScroll\", AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL),\n                            AbsListView.TRANSCRIPT_MODE_DISABLED));\n                    }, getter(v: AbsListView) {\n                        return v.getTranscriptMode();\n                    }\n                })\n                .set('cacheColorHint', {\n                    setter(v: AbsListView, value: any, attrBinder: AttrBinder) {\n                        let color: number = attrBinder.parseColor(value, 0);\n                        v.setCacheColorHint(color);\n                    }, getter(v: AbsListView) {\n                        return v.getCacheColorHint();\n                    }\n                })\n                .set('fastScrollEnabled', {\n                    setter(v: AbsListView, value: any, attrBinder: AttrBinder) {\n                        let enableFastScroll: boolean = attrBinder.parseBoolean(value, false);\n                        v.setFastScrollEnabled(enableFastScroll);\n                    }, getter(v: AbsListView) {\n                        return v.isFastScrollEnabled();\n                    }\n                })\n                .set('fastScrollAlwaysVisible', {\n                    setter(v: AbsListView, value: any, attrBinder: AttrBinder) {\n                        let fastScrollAlwaysVisible: boolean = attrBinder.parseBoolean(value, false);\n                        v.setFastScrollAlwaysVisible(fastScrollAlwaysVisible);\n                    }, getter(v: AbsListView) {\n                        return v.isFastScrollAlwaysVisible();\n                    }\n                })\n                .set('smoothScrollbar', {\n                    setter(v: AbsListView, value: any, attrBinder: AttrBinder) {\n                        let smoothScrollbar: boolean = attrBinder.parseBoolean(value, true);\n                        v.setSmoothScrollbarEnabled(smoothScrollbar);\n                    }, getter(v: AbsListView) {\n                        return v.isSmoothScrollbarEnabled();\n                    }\n                })\n                .set('choiceMode', {\n                    setter(v: AbsListView, value: any, attrBinder: AttrBinder) {\n                        v.setChoiceMode(attrBinder.parseEnum(value, new Map<string, number>()\n                                .set(\"none\", AbsListView.CHOICE_MODE_NONE)\n                                .set(\"singleChoice\", AbsListView.CHOICE_MODE_SINGLE)\n                                .set(\"multipleChoice\", AbsListView.CHOICE_MODE_MULTIPLE),\n                            AbsListView.CHOICE_MODE_NONE));\n                    }, getter(v: AbsListView) {\n                        return v.getChoiceMode();\n                    }\n                });\n        }\n\n        setOverScrollMode(mode:number):void {\n            if (mode != AbsListView.OVER_SCROLL_NEVER) {\n                //if (this.mEdgeGlowTop == null) {\n                //    let context:Context = this.getContext();\n                //    this.mEdgeGlowTop = new EdgeEffect(context);\n                //    this.mEdgeGlowBottom = new EdgeEffect(context);\n                //}\n            } else {\n                //this.mEdgeGlowTop = null;\n                //this.mEdgeGlowBottom = null;\n            }\n            super.setOverScrollMode(mode);\n        }\n\n\n        /**\n         * {@inheritDoc}\n         */\n        setAdapter(adapter:ListAdapter):void {\n            if (adapter != null) {\n                this.mAdapterHasStableIds = this.mAdapter.hasStableIds();\n                if (this.mChoiceMode != AbsListView.CHOICE_MODE_NONE && this.mAdapterHasStableIds && this.mCheckedIdStates == null) {\n                    this.mCheckedIdStates = new LongSparseArray<number>();\n                }\n            }\n            if (this.mCheckStates != null) {\n                this.mCheckStates.clear();\n            }\n            if (this.mCheckedIdStates != null) {\n                this.mCheckedIdStates.clear();\n            }\n        }\n\n        /**\n         * Returns the number of items currently selected. This will only be valid\n         * if the choice mode is not {@link #CHOICE_MODE_NONE} (default).\n         *\n         * <p>To determine the specific items that are currently selected, use one of\n         * the <code>getChecked*</code> methods.\n         *\n         * @return The number of items currently selected\n         *\n         * @see #getCheckedItemPosition()\n         * @see #getCheckedItemPositions()\n         * @see #getCheckedItemIds()\n         */\n        getCheckedItemCount():number {\n            return this.mCheckedItemCount;\n        }\n\n        /**\n         * Returns the checked state of the specified position. The result is only\n         * valid if the choice mode has been set to {@link #CHOICE_MODE_SINGLE}\n         * or {@link #CHOICE_MODE_MULTIPLE}.\n         *\n         * @param position The item whose checked state to return\n         * @return The item's checked state or <code>false</code> if choice mode\n         *         is invalid\n         *\n         * @see #setChoiceMode(int)\n         */\n        isItemChecked(position:number):boolean {\n            if (this.mChoiceMode != AbsListView.CHOICE_MODE_NONE && this.mCheckStates != null) {\n                return this.mCheckStates.get(position);\n            }\n            return false;\n        }\n\n        /**\n         * Returns the currently checked item. The result is only valid if the choice\n         * mode has been set to {@link #CHOICE_MODE_SINGLE}.\n         *\n         * @return The position of the currently checked item or\n         *         {@link #INVALID_POSITION} if nothing is selected\n         *\n         * @see #setChoiceMode(int)\n         */\n        getCheckedItemPosition():number {\n            if (this.mChoiceMode == AbsListView.CHOICE_MODE_SINGLE && this.mCheckStates != null && this.mCheckStates.size() == 1) {\n                return this.mCheckStates.keyAt(0);\n            }\n            return AbsListView.INVALID_POSITION;\n        }\n\n        /**\n         * Returns the set of checked items in the list. The result is only valid if\n         * the choice mode has not been set to {@link #CHOICE_MODE_NONE}.\n         *\n         * @return  A SparseBooleanArray which will return true for each call to\n         *          get(int position) where position is a checked position in the\n         *          list and false otherwise, or <code>null</code> if the choice\n         *          mode is set to {@link #CHOICE_MODE_NONE}.\n         */\n        getCheckedItemPositions():SparseBooleanArray {\n            if (this.mChoiceMode != AbsListView.CHOICE_MODE_NONE) {\n                return this.mCheckStates;\n            }\n            return null;\n        }\n\n        /**\n         * Returns the set of checked items ids. The result is only valid if the\n         * choice mode has not been set to {@link #CHOICE_MODE_NONE} and the adapter\n         * has stable IDs. ({@link ListAdapter#hasStableIds()} == {@code true})\n         *\n         * @return A new array which contains the id of each checked item in the\n         *         list.\n         */\n        getCheckedItemIds():number[] {\n            if (this.mChoiceMode == AbsListView.CHOICE_MODE_NONE || this.mCheckedIdStates == null || this.mAdapter == null) {\n                return [0];\n            }\n            const idStates:LongSparseArray<Integer> = this.mCheckedIdStates;\n            const count:number = idStates.size();\n            const ids:number[] = [count];\n            for (let i:number = 0; i < count; i++) {\n                ids[i] = idStates.keyAt(i);\n            }\n            return ids;\n        }\n\n        /**\n         * Clear any choices previously set\n         */\n        clearChoices():void {\n            if (this.mCheckStates != null) {\n                this.mCheckStates.clear();\n            }\n            if (this.mCheckedIdStates != null) {\n                this.mCheckedIdStates.clear();\n            }\n            this.mCheckedItemCount = 0;\n        }\n\n        /**\n         * Sets the checked state of the specified position. The is only valid if\n         * the choice mode has been set to {@link #CHOICE_MODE_SINGLE} or\n         * {@link #CHOICE_MODE_MULTIPLE}.\n         *\n         * @param position The item whose checked state is to be checked\n         * @param value The new checked state for the item\n         */\n        setItemChecked(position:number, value:boolean):void {\n            if (this.mChoiceMode == AbsListView.CHOICE_MODE_NONE) {\n                return;\n            }\n            // Start selection mode if needed. We don't need to if we're unchecking something.\n            //if (value && this.mChoiceMode == AbsListView.CHOICE_MODE_MULTIPLE_MODAL && this.mChoiceActionMode == null) {\n            //    if (this.mMultiChoiceModeCallback == null || !this.mMultiChoiceModeCallback.hasWrappedCallback()) {\n            //        throw Error(`new IllegalStateException(\"AbsListView: attempted to start selection mode \" + \"for CHOICE_MODE_MULTIPLE_MODAL but no choice mode callback was \" + \"supplied. Call setMultiChoiceModeListener to set a callback.\")`);\n            //    }\n            //    this.mChoiceActionMode = this.startActionMode(this.mMultiChoiceModeCallback);\n            //}\n            if (this.mChoiceMode == AbsListView.CHOICE_MODE_MULTIPLE || this.mChoiceMode == AbsListView.CHOICE_MODE_MULTIPLE_MODAL) {\n                let oldValue:boolean = this.mCheckStates.get(position);\n                this.mCheckStates.put(position, value);\n                if (this.mCheckedIdStates != null && this.mAdapter.hasStableIds()) {\n                    if (value) {\n                        this.mCheckedIdStates.put(this.mAdapter.getItemId(position), position);\n                    } else {\n                        this.mCheckedIdStates.delete(this.mAdapter.getItemId(position));\n                    }\n                }\n                if (oldValue != value) {\n                    if (value) {\n                        this.mCheckedItemCount++;\n                    } else {\n                        this.mCheckedItemCount--;\n                    }\n                }\n                //if (this.mChoiceActionMode != null) {\n                //    const id:number = this.mAdapter.getItemId(position);\n                //    this.mMultiChoiceModeCallback.onItemCheckedStateChanged(this.mChoiceActionMode, position, id, value);\n                //}\n            } else {\n                let updateIds:boolean = this.mCheckedIdStates != null && this.mAdapter.hasStableIds();\n                // selected item\n                if (value || this.isItemChecked(position)) {\n                    this.mCheckStates.clear();\n                    if (updateIds) {\n                        this.mCheckedIdStates.clear();\n                    }\n                }\n                // we ensure length of mCheckStates is 1, a fact getCheckedItemPosition relies on\n                if (value) {\n                    this.mCheckStates.put(position, true);\n                    if (updateIds) {\n                        this.mCheckedIdStates.put(this.mAdapter.getItemId(position), position);\n                    }\n                    this.mCheckedItemCount = 1;\n                } else if (this.mCheckStates.size() == 0 || !this.mCheckStates.valueAt(0)) {\n                    this.mCheckedItemCount = 0;\n                }\n            }\n            // Do not generate a data change while we are in the layout phase\n            if (!this.mInLayout && !this.mBlockLayoutRequests) {\n                this.mDataChanged = true;\n                this.rememberSyncState();\n                this.requestLayout();\n            }\n        }\n\n        performItemClick(view:View, position:number, id:number):boolean {\n            let handled:boolean = false;\n            let dispatchItemClick:boolean = true;\n            if (this.mChoiceMode != AbsListView.CHOICE_MODE_NONE) {\n                handled = true;\n                let checkedStateChanged:boolean = false;\n                if (this.mChoiceMode == AbsListView.CHOICE_MODE_MULTIPLE || (this.mChoiceMode == AbsListView.CHOICE_MODE_MULTIPLE_MODAL && this.mChoiceActionMode != null)) {\n                    let checked:boolean = !this.mCheckStates.get(position, false);\n                    this.mCheckStates.put(position, checked);\n                    if (this.mCheckedIdStates != null && this.mAdapter.hasStableIds()) {\n                        if (checked) {\n                            this.mCheckedIdStates.put(this.mAdapter.getItemId(position), position);\n                        } else {\n                            this.mCheckedIdStates.delete(this.mAdapter.getItemId(position));\n                        }\n                    }\n                    if (checked) {\n                        this.mCheckedItemCount++;\n                    } else {\n                        this.mCheckedItemCount--;\n                    }\n                    //if (this.mChoiceActionMode != null) {\n                    //    this.mMultiChoiceModeCallback.onItemCheckedStateChanged(this.mChoiceActionMode, position, id, checked);\n                    //    dispatchItemClick = false;\n                    //}\n                    checkedStateChanged = true;\n                } else if (this.mChoiceMode == AbsListView.CHOICE_MODE_SINGLE) {\n                    let checked:boolean = !this.mCheckStates.get(position, false);\n                    if (checked) {\n                        this.mCheckStates.clear();\n                        this.mCheckStates.put(position, true);\n                        if (this.mCheckedIdStates != null && this.mAdapter.hasStableIds()) {\n                            this.mCheckedIdStates.clear();\n                            this.mCheckedIdStates.put(this.mAdapter.getItemId(position), position);\n                        }\n                        this.mCheckedItemCount = 1;\n                    } else if (this.mCheckStates.size() == 0 || !this.mCheckStates.valueAt(0)) {\n                        this.mCheckedItemCount = 0;\n                    }\n                    checkedStateChanged = true;\n                }\n                if (checkedStateChanged) {\n                    this.updateOnScreenCheckedViews();\n                }\n            }\n            if (dispatchItemClick) {\n                handled = super.performItemClick(view, position, id) || handled;\n            }\n            return handled;\n        }\n\n        /**\n         * Perform a quick, in-place update of the checked or activated state\n         * on all visible item views. This should only be called when a valid\n         * choice mode is active.\n         */\n        private updateOnScreenCheckedViews():void {\n            const firstPos:number = this.mFirstPosition;\n            const count:number = this.getChildCount();\n            const useActivated:boolean = true;\n            for (let i:number = 0; i < count; i++) {\n                const child:View = this.getChildAt(i);\n                const position:number = firstPos + i;\n                if (child['setChecked']) {//child instanceof Checkable\n                    (<Checkable><any>child).setChecked(this.mCheckStates.get(position));\n                } else if (useActivated) {\n                    child.setActivated(this.mCheckStates.get(position));\n                }\n            }\n        }\n\n        /**\n         * @see #setChoiceMode(int)\n         *\n         * @return The current choice mode\n         */\n        getChoiceMode():number {\n            return this.mChoiceMode;\n        }\n\n        /**\n         * Defines the choice behavior for the List. By default, Lists do not have any choice behavior\n         * ({@link #CHOICE_MODE_NONE}). By setting the choiceMode to {@link #CHOICE_MODE_SINGLE}, the\n         * List allows up to one item to  be in a chosen state. By setting the choiceMode to\n         * {@link #CHOICE_MODE_MULTIPLE}, the list allows any number of items to be chosen.\n         *\n         * @param choiceMode One of {@link #CHOICE_MODE_NONE}, {@link #CHOICE_MODE_SINGLE}, or\n         * {@link #CHOICE_MODE_MULTIPLE}\n         */\n        setChoiceMode(choiceMode:number):void {\n            this.mChoiceMode = choiceMode;\n            if (this.mChoiceActionMode != null) {\n                this.mChoiceActionMode.finish();\n                this.mChoiceActionMode = null;\n            }\n            if (this.mChoiceMode != AbsListView.CHOICE_MODE_NONE) {\n                if (this.mCheckStates == null) {\n                    this.mCheckStates = new SparseBooleanArray(0);\n                }\n                if (this.mCheckedIdStates == null && this.mAdapter != null && this.mAdapter.hasStableIds()) {\n                    this.mCheckedIdStates = new LongSparseArray<number>(0);\n                }\n                // Modal multi-choice mode only has choices when the mode is active. Clear them.\n                if (this.mChoiceMode == AbsListView.CHOICE_MODE_MULTIPLE_MODAL) {\n                    this.clearChoices();\n                    this.setLongClickable(true);\n                }\n            }\n        }\n\n        /**\n         * Set a {@link MultiChoiceModeListener} that will manage the lifecycle of the\n         * selection {@link ActionMode}. Only used when the choice mode is set to\n         * {@link #CHOICE_MODE_MULTIPLE_MODAL}.\n         *\n         * @param listener Listener that will manage the selection mode\n         *\n         * @see #setChoiceMode(int)\n         */\n        //setMultiChoiceModeListener(listener:AbsListView.MultiChoiceModeListener):void {\n        //    if (this.mMultiChoiceModeCallback == null) {\n        //        this.mMultiChoiceModeCallback = new AbsListView.MultiChoiceModeWrapper(this);\n        //    }\n        //    this.mMultiChoiceModeCallback.setWrapped(listener);\n        //}\n\n        /**\n         * @return true if all list content currently fits within the view boundaries\n         */\n        private contentFits():boolean {\n            const childCount:number = this.getChildCount();\n            if (childCount == 0)\n                return true;\n            if (childCount != this.mItemCount)\n                return false;\n            return this.getChildAt(0).getTop() >= this.mListPadding.top && this.getChildAt(childCount - 1).getBottom() <= this.getHeight() - this.mListPadding.bottom;\n        }\n\n        /**\n         * Specifies whether fast scrolling is enabled or disabled.\n         * <p>\n         * When fast scrolling is enabled, the user can quickly scroll through lists\n         * by dragging the fast scroll thumb.\n         * <p>\n         * If the adapter backing this list implements {@link SectionIndexer}, the\n         * fast scroller will display section header previews as the user scrolls.\n         * Additionally, the user will be able to quickly jump between sections by\n         * tapping along the length of the scroll bar.\n         *\n         * @see SectionIndexer\n         * @see #isFastScrollEnabled()\n         * @param enabled true to enable fast scrolling, false otherwise\n         */\n        setFastScrollEnabled(enabled:boolean):void {\n            if (this.mFastScrollEnabled != enabled) {\n                this.mFastScrollEnabled = enabled;\n                this.setFastScrollerEnabledUiThread(enabled);\n            }\n        }\n\n        private setFastScrollerEnabledUiThread(enabled:boolean):void {\n            //TODO when fastScroller impl\n            //if (this.mFastScroller != null) {\n            //    this.mFastScroller.setEnabled(enabled);\n            //} else if (enabled) {\n            //    this.mFastScroller = new FastScroller(this);\n            //    this.mFastScroller.setEnabled(true);\n            //}\n            //this.resolvePadding();\n            //if (this.mFastScroller != null) {\n            //    this.mFastScroller.updateLayout();\n            //}\n        }\n\n        /**\n         * Set whether or not the fast scroller should always be shown in place of\n         * the standard scroll bars. This will enable fast scrolling if it is not\n         * already enabled.\n         * <p>\n         * Fast scrollers shown in this way will not fade out and will be a\n         * permanent fixture within the list. This is best combined with an inset\n         * scroll bar style to ensure the scroll bar does not overlap content.\n         *\n         * @param alwaysShow true if the fast scroller should always be displayed,\n         *            false otherwise\n         * @see #setScrollBarStyle(int)\n         * @see #setFastScrollEnabled(boolean)\n         */\n        setFastScrollAlwaysVisible(alwaysShow:boolean):void {\n            if (this.mFastScrollAlwaysVisible != alwaysShow) {\n                if (alwaysShow && !this.mFastScrollEnabled) {\n                    this.setFastScrollEnabled(true);\n                }\n                this.mFastScrollAlwaysVisible = alwaysShow;\n                this.setFastScrollerAlwaysVisibleUiThread(alwaysShow);\n            }\n        }\n\n        private setFastScrollerAlwaysVisibleUiThread(alwaysShow:boolean):void {\n            //TODO when fastScroller impl\n            //if (this.mFastScroller != null) {\n            //    this.mFastScroller.setAlwaysShow(alwaysShow);\n            //}\n        }\n\n        /**\n         * @return whether the current thread is the one that created the view\n         */\n        private isOwnerThread():boolean {\n            return true;//one thread is js\n        }\n\n        /**\n         * Returns true if the fast scroller is set to always show on this view.\n         *\n         * @return true if the fast scroller will always show\n         * @see #setFastScrollAlwaysVisible(boolean)\n         */\n        isFastScrollAlwaysVisible():boolean {\n            //TODO when fastScroller impl\n            return false;\n            //if (this.mFastScroller == null) {\n            //    return this.mFastScrollEnabled && this.mFastScrollAlwaysVisible;\n            //} else {\n            //    return this.mFastScroller.isEnabled() && this.mFastScroller.isAlwaysShowEnabled();\n            //}\n        }\n\n        getVerticalScrollbarWidth():number {\n            //TODO when fastScroller impl\n            //if (this.mFastScroller != null && this.mFastScroller.isEnabled()) {\n            //    return Math.max(super.getVerticalScrollbarWidth(), this.mFastScroller.getWidth());\n            //}\n            return super.getVerticalScrollbarWidth();\n        }\n\n        /**\n         * Returns true if the fast scroller is enabled.\n         *\n         * @see #setFastScrollEnabled(boolean)\n         * @return true if fast scroll is enabled, false otherwise\n         */\n        isFastScrollEnabled():boolean {\n            //TODO when fastScroller impl\n            return false;\n            //if (this.mFastScroller == null) {\n            //    return this.mFastScrollEnabled;\n            //} else {\n            //    return this.mFastScroller.isEnabled();\n            //}\n        }\n\n        setVerticalScrollbarPosition(position:number):void {\n            super.setVerticalScrollbarPosition(position);\n            //TODO when fastScroller impl\n            //if (this.mFastScroller != null) {\n            //    this.mFastScroller.setScrollbarPosition(position);\n            //}\n        }\n\n        setScrollBarStyle(style:number):void {\n            super.setScrollBarStyle(style);\n            //TODO when fastScroller impl\n            //if (this.mFastScroller != null) {\n            //    this.mFastScroller.setScrollBarStyle(style);\n            //}\n        }\n\n        /**\n         * If fast scroll is enabled, then don't draw the vertical scrollbar.\n         * @hide\n         */\n        isVerticalScrollBarHidden():boolean {\n            return this.isFastScrollEnabled();\n        }\n\n        /**\n         * When smooth scrollbar is enabled, the position and size of the scrollbar thumb\n         * is computed based on the number of visible pixels in the visible items. This\n         * however assumes that all list items have the same height. If you use a list in\n         * which items have different heights, the scrollbar will change appearance as the\n         * user scrolls through the list. To avoid this issue, you need to disable this\n         * property.\n         *\n         * When smooth scrollbar is disabled, the position and size of the scrollbar thumb\n         * is based solely on the number of items in the adapter and the position of the\n         * visible items inside the adapter. This provides a stable scrollbar as the user\n         * navigates through a list of items with varying heights.\n         *\n         * @param enabled Whether or not to enable smooth scrollbar.\n         *\n         * @see #setSmoothScrollbarEnabled(boolean)\n         * @attr ref android.R.styleable#AbsListView_smoothScrollbar\n         */\n        setSmoothScrollbarEnabled(enabled:boolean):void {\n            this.mSmoothScrollbarEnabled = enabled;\n        }\n\n        /**\n         * Returns the current state of the fast scroll feature.\n         *\n         * @return True if smooth scrollbar is enabled is enabled, false otherwise.\n         *\n         * @see #setSmoothScrollbarEnabled(boolean)\n         */\n        isSmoothScrollbarEnabled():boolean {\n            return this.mSmoothScrollbarEnabled;\n        }\n\n        /**\n         * Set the listener that will receive notifications every time the list scrolls.\n         *\n         * @param l the scroll listener\n         */\n        setOnScrollListener(l:AbsListView.OnScrollListener):void {\n            this.mOnScrollListener = l;\n            this.invokeOnItemScrollListener();\n        }\n\n        /**\n         * Notify our scroll listener (if there is one) of a change in scroll state\n         */\n        invokeOnItemScrollListener():void {\n            //TODO when fastScroller impl\n            //if (this.mFastScroller != null) {\n            //    this.mFastScroller.onScroll(this.mFirstPosition, this.getChildCount(), this.mItemCount);\n            //}\n            if (this.mOnScrollListener != null) {\n                this.mOnScrollListener.onScroll(this, this.mFirstPosition, this.getChildCount(), this.mItemCount);\n            }\n            // dummy values, View's implementation does not use these.\n            this.onScrollChanged(0, 0, 0, 0);\n        }\n\n        //sendAccessibilityEvent(eventType:number):void {\n        //    // events.\n        //    if (eventType == AccessibilityEvent.TYPE_VIEW_SCROLLED) {\n        //        const firstVisiblePosition:number = this.getFirstVisiblePosition();\n        //        const lastVisiblePosition:number = this.getLastVisiblePosition();\n        //        if (this.mLastAccessibilityScrollEventFromIndex == firstVisiblePosition && this.mLastAccessibilityScrollEventToIndex == lastVisiblePosition) {\n        //            return;\n        //        } else {\n        //            this.mLastAccessibilityScrollEventFromIndex = firstVisiblePosition;\n        //            this.mLastAccessibilityScrollEventToIndex = lastVisiblePosition;\n        //        }\n        //    }\n        //    super.sendAccessibilityEvent(eventType);\n        //}\n        //\n        //onInitializeAccessibilityEvent(event:AccessibilityEvent):void {\n        //    super.onInitializeAccessibilityEvent(event);\n        //    event.setClassName(AbsListView.class.getName());\n        //}\n        //\n        //onInitializeAccessibilityNodeInfo(info:AccessibilityNodeInfo):void {\n        //    super.onInitializeAccessibilityNodeInfo(info);\n        //    info.setClassName(AbsListView.class.getName());\n        //    if (this.isEnabled()) {\n        //        if (this.getFirstVisiblePosition() > 0) {\n        //            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);\n        //            info.setScrollable(true);\n        //        }\n        //        if (this.getLastVisiblePosition() < this.getCount() - 1) {\n        //            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);\n        //            info.setScrollable(true);\n        //        }\n        //    }\n        //}\n        //\n        //performAccessibilityAction(action:number, arguments:Bundle):boolean {\n        //    if (super.performAccessibilityAction(action, arguments)) {\n        //        return true;\n        //    }\n        //    switch (action) {\n        //        case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD:\n        //        {\n        //            if (this.isEnabled() && this.getLastVisiblePosition() < this.getCount() - 1) {\n        //                const viewportHeight:number = this.getHeight() - this.mListPadding.top - this.mListPadding.bottom;\n        //                this.smoothScrollBy(viewportHeight, PositionScroller.SCROLL_DURATION);\n        //                return true;\n        //            }\n        //        }\n        //            return false;\n        //        case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD:\n        //        {\n        //            if (this.isEnabled() && mFirstPosition > 0) {\n        //                const viewportHeight:number = this.getHeight() - this.mListPadding.top - this.mListPadding.bottom;\n        //                this.smoothScrollBy(-viewportHeight, PositionScroller.SCROLL_DURATION);\n        //                return true;\n        //            }\n        //        }\n        //            return false;\n        //    }\n        //    return false;\n        //}\n        //\n        ///** @hide */\n        //findViewByAccessibilityIdTraversal(accessibilityId:number):View {\n        //    if (accessibilityId == this.getAccessibilityViewId()) {\n        //        return this;\n        //    }\n        //    // so a service will be able to re-fetch the views.\n        //    if (mDataChanged) {\n        //        return null;\n        //    }\n        //    return super.findViewByAccessibilityIdTraversal(accessibilityId);\n        //}\n\n        /**\n         * Indicates whether the children's drawing cache is used during a scroll.\n         * By default, the drawing cache is enabled but this will consume more memory.\n         *\n         * @return true if the scrolling cache is enabled, false otherwise\n         *\n         * @see #setScrollingCacheEnabled(boolean)\n         * @see View#setDrawingCacheEnabled(boolean)\n         */\n        isScrollingCacheEnabled():boolean {\n            return this.mScrollingCacheEnabled;\n        }\n\n        /**\n         * Enables or disables the children's drawing cache during a scroll.\n         * By default, the drawing cache is enabled but this will use more memory.\n         *\n         * When the scrolling cache is enabled, the caches are kept after the\n         * first scrolling. You can manually clear the cache by calling\n         * {@link android.view.ViewGroup#setChildrenDrawingCacheEnabled(boolean)}.\n         *\n         * @param enabled true to enable the scroll cache, false otherwise\n         *\n         * @see #isScrollingCacheEnabled()\n         * @see View#setDrawingCacheEnabled(boolean)\n         */\n        setScrollingCacheEnabled(enabled:boolean):void {\n            if (this.mScrollingCacheEnabled && !enabled) {\n                this.clearScrollingCache();\n            }\n            this.mScrollingCacheEnabled = enabled;\n        }\n\n        /**\n         * Enables or disables the type filter window. If enabled, typing when\n         * this view has focus will filter the children to match the users input.\n         * Note that the {@link Adapter} used by this view must implement the\n         * {@link Filterable} interface.\n         *\n         * @param textFilterEnabled true to enable type filtering, false otherwise\n         *\n         * @see Filterable\n         */\n        setTextFilterEnabled(textFilterEnabled:boolean):void {\n            this.mTextFilterEnabled = textFilterEnabled;\n        }\n\n        /**\n         * Indicates whether type filtering is enabled for this view\n         *\n         * @return true if type filtering is enabled, false otherwise\n         *\n         * @see #setTextFilterEnabled(boolean)\n         * @see Filterable\n         */\n        isTextFilterEnabled():boolean {\n            return this.mTextFilterEnabled;\n        }\n\n        getFocusedRect(r:Rect):void {\n            let view:View = this.getSelectedView();\n            if (view != null && view.getParent() == this) {\n                // the focused rectangle of the selected view offset into the\n                // coordinate space of this view.\n                view.getFocusedRect(r);\n                this.offsetDescendantRectToMyCoords(view, r);\n            } else {\n                // otherwise, just the norm\n                super.getFocusedRect(r);\n            }\n        }\n\n        private useDefaultSelector():void {\n            this.setSelector(R.drawable.list_selector_background);\n        }\n\n        /**\n         * Indicates whether the content of this view is pinned to, or stacked from,\n         * the bottom edge.\n         *\n         * @return true if the content is stacked from the bottom edge, false otherwise\n         */\n        isStackFromBottom():boolean {\n            return this.mStackFromBottom;\n        }\n\n        /**\n         * When stack from bottom is set to true, the list fills its content starting from\n         * the bottom of the view.\n         *\n         * @param stackFromBottom true to pin the view's content to the bottom edge,\n         *        false to pin the view's content to the top edge\n         */\n        setStackFromBottom(stackFromBottom:boolean):void {\n            if (this.mStackFromBottom != stackFromBottom) {\n                this.mStackFromBottom = stackFromBottom;\n                this.requestLayoutIfNecessary();\n            }\n        }\n\n        private requestLayoutIfNecessary():void {\n            if (this.getChildCount() > 0) {\n                this.resetList();\n                this.requestLayout();\n                this.invalidate();\n            }\n        }\n\n\n\n        //private acceptFilter():boolean {\n        //    return this.mTextFilterEnabled && this.getAdapter() instanceof Filterable && (<Filterable> this.getAdapter()).getFilter() != null;\n        //}\n        //\n        ///**\n        // * Sets the initial value for the text filter.\n        // * @param filterText The text to use for the filter.\n        // *\n        // * @see #setTextFilterEnabled\n        // */\n        //setFilterText(filterText:string):void {\n        //    // Should we check for acceptFilter()?\n        //    if (this.mTextFilterEnabled && !TextUtils.isEmpty(filterText)) {\n        //        this.createTextFilter(false);\n        //        // This is going to call our listener onTextChanged, but we might not\n        //        // be ready to bring up a window yet\n        //        this.mTextFilter.setText(filterText);\n        //        this.mTextFilter.setSelection(filterText.length());\n        //        if (this.mAdapter instanceof Filterable) {\n        //            // if mPopup is non-null, then onTextChanged will do the filtering\n        //            if (this.mPopup == null) {\n        //                let f:Filter = (<Filterable> this.mAdapter).getFilter();\n        //                f.filter(filterText);\n        //            }\n        //            // Set filtered to true so we will display the filter window when our main\n        //            // window is ready\n        //            this.mFiltered = true;\n        //            this.mDataSetObserver.clearSavedState();\n        //        }\n        //    }\n        //}\n        //\n        ///**\n        // * Returns the list's text filter, if available.\n        // * @return the list's text filter or null if filtering isn't enabled\n        // */\n        //getTextFilter():CharSequence {\n        //    if (this.mTextFilterEnabled && this.mTextFilter != null) {\n        //        return this.mTextFilter.getText();\n        //    }\n        //    return null;\n        //}\n\n        protected onFocusChanged(gainFocus:boolean, direction:number, previouslyFocusedRect:Rect):void {\n            super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);\n            if (gainFocus && this.mSelectedPosition < 0 && !this.isInTouchMode()) {\n                if (!this.isAttachedToWindow() && this.mAdapter != null) {\n                    // Data may have changed while we were detached and it's valid\n                    // to change focus while detached. Refresh so we don't die.\n                    this.mDataChanged = true;\n                    this.mOldItemCount = this.mItemCount;\n                    this.mItemCount = this.mAdapter.getCount();\n                }\n                this.resurrectSelection();\n            }\n        }\n\n        requestLayout():void {\n            if (!this.mBlockLayoutRequests && !this.mInLayout) {\n                super.requestLayout();\n            }\n        }\n\n        /**\n         * The list is empty. Clear everything out.\n         */\n        resetList():void {\n            this.removeAllViewsInLayout();\n            this.mFirstPosition = 0;\n            this.mDataChanged = false;\n            this.mPositionScrollAfterLayout = null;\n            this.mNeedSync = false;\n            this.mPendingSync = null;\n            this.mOldSelectedPosition = AbsListView.INVALID_POSITION;\n            this.mOldSelectedRowId = AbsListView.INVALID_ROW_ID;\n            this.setSelectedPositionInt(AbsListView.INVALID_POSITION);\n            this.setNextSelectedPositionInt(AbsListView.INVALID_POSITION);\n            this.mSelectedTop = 0;\n            this.mSelectorPosition = AbsListView.INVALID_POSITION;\n            this.mSelectorRect.setEmpty();\n            this.invalidate();\n        }\n\n        protected computeVerticalScrollExtent():number {\n            const count:number = this.getChildCount();\n            if (count > 0) {\n                if (this.mSmoothScrollbarEnabled) {\n                    let extent:number = count * 100;\n                    let view:View = this.getChildAt(0);\n                    const top:number = view.getTop();\n                    let height:number = view.getHeight();\n                    if (height > 0) {\n                        extent += (top * 100) / height;\n                    }\n                    view = this.getChildAt(count - 1);\n                    const bottom:number = view.getBottom();\n                    height = view.getHeight();\n                    if (height > 0) {\n                        extent -= ((bottom - this.getHeight()) * 100) / height;\n                    }\n                    return extent;\n                } else {\n                    return 1;\n                }\n            }\n            return 0;\n        }\n\n        protected computeVerticalScrollOffset():number {\n            const firstPosition:number = this.mFirstPosition;\n            const childCount:number = this.getChildCount();\n            if (firstPosition >= 0 && childCount > 0) {\n                if (this.mSmoothScrollbarEnabled) {\n                    const view:View = this.getChildAt(0);\n                    const top:number = view.getTop();\n                    let height:number = view.getHeight();\n                    if (height > 0) {\n                        return Math.max(firstPosition * 100 - (top * 100) / height + Math.floor((<number> this.mScrollY / this.getHeight() * this.mItemCount * 100)), 0);\n                    }\n                } else {\n                    let index:number;\n                    const count:number = this.mItemCount;\n                    if (firstPosition == 0) {\n                        index = 0;\n                    } else if (firstPosition + childCount == count) {\n                        index = count;\n                    } else {\n                        index = firstPosition + childCount / 2;\n                    }\n                    return Math.floor((firstPosition + childCount * (index / <number> count)));\n                }\n            }\n            return 0;\n        }\n\n        protected computeVerticalScrollRange():number {\n            let result:number;\n            if (this.mSmoothScrollbarEnabled) {\n                result = Math.max(this.mItemCount * 100, 0);\n                if (this.mScrollY != 0) {\n                    // Compensate for overscroll\n                    result += Math.abs(Math.floor((<number> this.mScrollY / this.getHeight() * this.mItemCount * 100)));\n                }\n            } else {\n                result = this.mItemCount;\n            }\n            return result;\n        }\n\n        protected getTopFadingEdgeStrength():number {\n            const count:number = this.getChildCount();\n            const fadeEdge:number = super.getTopFadingEdgeStrength();\n            if (count == 0) {\n                return fadeEdge;\n            } else {\n                if (this.mFirstPosition > 0) {\n                    return 1.0;\n                }\n                const top:number = this.getChildAt(0).getTop();\n                const fadeLength:number = this.getVerticalFadingEdgeLength();\n                return top < this.mPaddingTop ? -(top - this.mPaddingTop) / fadeLength : fadeEdge;\n            }\n        }\n\n        protected getBottomFadingEdgeStrength():number {\n            const count:number = this.getChildCount();\n            const fadeEdge:number = super.getBottomFadingEdgeStrength();\n            if (count == 0) {\n                return fadeEdge;\n            } else {\n                if (this.mFirstPosition + count - 1 < this.mItemCount - 1) {\n                    return 1.0;\n                }\n                const bottom:number = this.getChildAt(count - 1).getBottom();\n                const height:number = this.getHeight();\n                const fadeLength:number = this.getVerticalFadingEdgeLength();\n                return bottom > height - this.mPaddingBottom ? (bottom - height + this.mPaddingBottom) / fadeLength : fadeEdge;\n            }\n        }\n\n        protected onMeasure(widthMeasureSpec:number, heightMeasureSpec:number):void {\n            if (this.mSelector == null) {\n                this.useDefaultSelector();\n            }\n            const listPadding:Rect = this.mListPadding;\n            listPadding.left = this.mSelectionLeftPadding + this.mPaddingLeft;\n            listPadding.top = this.mSelectionTopPadding + this.mPaddingTop;\n            listPadding.right = this.mSelectionRightPadding + this.mPaddingRight;\n            listPadding.bottom = this.mSelectionBottomPadding + this.mPaddingBottom;\n            // Check if our previous measured size was at a point where we should scroll later.\n            if (this.mTranscriptMode == AbsListView.TRANSCRIPT_MODE_NORMAL) {\n                const childCount:number = this.getChildCount();\n                const listBottom:number = this.getHeight() - this.getPaddingBottom();\n                const lastChild:View = this.getChildAt(childCount - 1);\n                const lastBottom:number = lastChild != null ? lastChild.getBottom() : listBottom;\n                this.mForceTranscriptScroll = this.mFirstPosition + childCount >= this.mLastHandledItemCount && lastBottom <= listBottom;\n            }\n        }\n\n        /**\n         * Subclasses should NOT override this method but\n         *  {@link #layoutChildren()} instead.\n         */\n        protected onLayout(changed:boolean, l:number, t:number, r:number, b:number):void {\n            super.onLayout(changed, l, t, r, b);\n            this.mInLayout = true;\n            if (changed) {\n                let childCount:number = this.getChildCount();\n                for (let i:number = 0; i < childCount; i++) {\n                    this.getChildAt(i).forceLayout();\n                }\n                this.mRecycler.markChildrenDirty();\n            }\n            //TODO when fastScroller impl\n            //if (this.mFastScroller != null && (mItemCount != mOldItemCount || mDataChanged)) {\n            //    this.mFastScroller.onItemCountChanged(mItemCount);\n            //}\n            this.layoutChildren();\n            this.mInLayout = false;\n            this.mOverscrollMax = (b - t) / AbsListView.OVERSCROLL_LIMIT_DIVISOR;\n        }\n\n        /**\n         * @hide\n         */\n        protected setFrame(left:number, top:number, right:number, bottom:number):boolean {\n            const changed:boolean = super.setFrame(left, top, right, bottom);\n            if (changed) {\n                // Reposition the popup when the frame has changed. This includes\n                // translating the widget, not just changing its dimension. The\n                // filter popup needs to follow the widget.\n                const visible:boolean = this.getWindowVisibility() == View.VISIBLE;\n                //if (this.mFiltered && visible && this.mPopup != null && this.mPopup.isShowing()) {\n                //    this.positionPopup();\n                //}\n            }\n            return changed;\n        }\n\n        /**\n         * Subclasses must override this method to layout their children.\n         */\n        protected layoutChildren():void {\n        }\n\n        updateScrollIndicators():void {\n            if (this.mScrollUp != null) {\n                let canScrollUp:boolean;\n                // 0th element is not visible\n                canScrollUp = this.mFirstPosition > 0;\n                // ... Or top of 0th element is not visible\n                if (!canScrollUp) {\n                    if (this.getChildCount() > 0) {\n                        let child:View = this.getChildAt(0);\n                        canScrollUp = child.getTop() < this.mListPadding.top;\n                    }\n                }\n                this.mScrollUp.setVisibility(canScrollUp ? View.VISIBLE : View.INVISIBLE);\n            }\n            if (this.mScrollDown != null) {\n                let canScrollDown:boolean;\n                let count:number = this.getChildCount();\n                // Last item is not visible\n                canScrollDown = (this.mFirstPosition + count) < this.mItemCount;\n                // ... Or bottom of the last element is not visible\n                if (!canScrollDown && count > 0) {\n                    let child:View = this.getChildAt(count - 1);\n                    canScrollDown = child.getBottom() > this.mBottom - this.mListPadding.bottom;\n                }\n                this.mScrollDown.setVisibility(canScrollDown ? View.VISIBLE : View.INVISIBLE);\n            }\n        }\n\n        getSelectedView():View {\n            if (this.mItemCount > 0 && this.mSelectedPosition >= 0) {\n                return this.getChildAt(this.mSelectedPosition - this.mFirstPosition);\n            } else {\n                return null;\n            }\n        }\n\n        /**\n         * List padding is the maximum of the normal view's padding and the padding of the selector.\n         *\n         * @see android.view.View#getPaddingTop()\n         * @see #getSelector()\n         *\n         * @return The top list padding.\n         */\n        getListPaddingTop():number {\n            return this.mListPadding.top;\n        }\n\n        /**\n         * List padding is the maximum of the normal view's padding and the padding of the selector.\n         *\n         * @see android.view.View#getPaddingBottom()\n         * @see #getSelector()\n         *\n         * @return The bottom list padding.\n         */\n        getListPaddingBottom():number {\n            return this.mListPadding.bottom;\n        }\n\n        /**\n         * List padding is the maximum of the normal view's padding and the padding of the selector.\n         *\n         * @see android.view.View#getPaddingLeft()\n         * @see #getSelector()\n         *\n         * @return The left list padding.\n         */\n        getListPaddingLeft():number {\n            return this.mListPadding.left;\n        }\n\n        /**\n         * List padding is the maximum of the normal view's padding and the padding of the selector.\n         *\n         * @see android.view.View#getPaddingRight()\n         * @see #getSelector()\n         *\n         * @return The right list padding.\n         */\n        getListPaddingRight():number {\n            return this.mListPadding.right;\n        }\n\n        /**\n         * Get a view and have it show the data associated with the specified\n         * position. This is called when we have already discovered that the view is\n         * not available for reuse in the recycle bin. The only choices left are\n         * converting an old view or making a new one.\n         *\n         * @param position The position to display\n         * @param isScrap Array of at least 1 boolean, the first entry will become true if\n         *                the returned view was taken from the scrap heap, false if otherwise.\n         *\n         * @return A view displaying the data associated with the specified position\n         */\n        obtainView(position:number, isScrap:boolean[]):View {\n            //Trace.traceBegin(Trace.TRACE_TAG_VIEW, \"obtainView\");\n            isScrap[0] = false;\n            let scrapView:View;\n            scrapView = this.mRecycler.getTransientStateView(position);\n            if (scrapView == null) {\n                scrapView = this.mRecycler.getScrapView(position);\n            }\n            let child:View;\n            if (scrapView != null) {\n                child = this.mAdapter.getView(position, scrapView, this);\n                //if (child.getImportantForAccessibility() == AbsListView.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {\n                //    child.setImportantForAccessibility(AbsListView.IMPORTANT_FOR_ACCESSIBILITY_YES);\n                //}\n                if (child != scrapView) {\n                    this.mRecycler.addScrapView(scrapView, position);\n                    if (this.mCacheColorHint != 0) {\n                        child.setDrawingCacheBackgroundColor(this.mCacheColorHint);\n                    }\n                } else {\n                    isScrap[0] = true;\n                    // recycle this view and bind it to different data.\n                    //if (child.isAccessibilityFocused()) {\n                    //    child.clearAccessibilityFocus();\n                    //}\n                    child.dispatchFinishTemporaryDetach();\n                }\n            } else {\n                child = this.mAdapter.getView(position, null, this);\n                //if (child.getImportantForAccessibility() == AbsListView.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {\n                //    child.setImportantForAccessibility(AbsListView.IMPORTANT_FOR_ACCESSIBILITY_YES);\n                //}\n                if (this.mCacheColorHint != 0) {\n                    child.setDrawingCacheBackgroundColor(this.mCacheColorHint);\n                }\n            }\n            if (this.mAdapterHasStableIds) {\n                const vlp:ViewGroup.LayoutParams = child.getLayoutParams();\n                let lp:AbsListView.LayoutParams;\n                if (vlp == null) {\n                    lp = <AbsListView.LayoutParams> this.generateDefaultLayoutParams();\n                } else if (!this.checkLayoutParams(vlp)) {\n                    lp = <AbsListView.LayoutParams> this.generateLayoutParams(vlp);\n                } else {\n                    lp = <AbsListView.LayoutParams> vlp;\n                }\n                lp.itemId = this.mAdapter.getItemId(position);\n                child.setLayoutParams(lp);\n            }\n            //if (AccessibilityManager.getInstance(this.mContext).isEnabled()) {\n            //    if (this.mAccessibilityDelegate == null) {\n            //        this.mAccessibilityDelegate = new AbsListView.ListItemAccessibilityDelegate(this);\n            //    }\n            //    if (child.getAccessibilityDelegate() == null) {\n            //        child.setAccessibilityDelegate(this.mAccessibilityDelegate);\n            //    }\n            //}\n            //Trace.traceEnd(Trace.TRACE_TAG_VIEW);\n            return child;\n        }\n\n\n        /**\n         * Initializes an {@link AccessibilityNodeInfo} with information about a\n         * particular item in the list.\n         *\n         * @param view View representing the list item.\n         * @param position Position of the list item within the adapter.\n         * @param info Node info to populate.\n         */\n        //onInitializeAccessibilityNodeInfoForItem(view:View, position:number, info:AccessibilityNodeInfo):void {\n        //    const adapter:ListAdapter = this.getAdapter();\n        //    if (position == AbsListView.INVALID_POSITION || adapter == null) {\n        //        // The item doesn't exist, so there's not much we can do here.\n        //        return;\n        //    }\n        //    if (!this.isEnabled() || !adapter.isEnabled(position)) {\n        //        info.setEnabled(false);\n        //        return;\n        //    }\n        //    if (position == this.getSelectedItemPosition()) {\n        //        info.setSelected(true);\n        //        info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_SELECTION);\n        //    } else {\n        //        info.addAction(AccessibilityNodeInfo.ACTION_SELECT);\n        //    }\n        //    if (this.isClickable()) {\n        //        info.addAction(AccessibilityNodeInfo.ACTION_CLICK);\n        //        info.setClickable(true);\n        //    }\n        //    if (this.isLongClickable()) {\n        //        info.addAction(AccessibilityNodeInfo.ACTION_LONG_CLICK);\n        //        info.setLongClickable(true);\n        //    }\n        //}\n\n        positionSelector(l:number, t:number, r:number, b:number):void;\n        positionSelector(position:number, sel:View):void;\n        positionSelector(...args):void {\n            if(args.length===4){\n                let [l, t, r, b] = args;\n                this.mSelectorRect.set(l - this.mSelectionLeftPadding, t - this.mSelectionTopPadding,\n                    r + this.mSelectionRightPadding, b + this.mSelectionBottomPadding);\n\n            }else {\n                let position:number = args[0];\n                let sel:View = args[1];\n                if (position != AbsListView.INVALID_POSITION) {\n                    this.mSelectorPosition = position;\n                }\n                const selectorRect:Rect = this.mSelectorRect;\n                selectorRect.set(sel.getLeft(), sel.getTop(), sel.getRight(), sel.getBottom());\n                if (sel['adjustListItemSelectionBounds']) {\n                    (<AbsListView.SelectionBoundsAdjuster><any>sel).adjustListItemSelectionBounds(selectorRect);\n                }\n                this.positionSelector(selectorRect.left, selectorRect.top, selectorRect.right, selectorRect.bottom);\n                const isChildViewEnabled:boolean = this.mIsChildViewEnabled;\n                if (sel.isEnabled() != isChildViewEnabled) {\n                    this.mIsChildViewEnabled = !isChildViewEnabled;\n                    if (this.getSelectedItemPosition() != AbsListView.INVALID_POSITION) {\n                        this.refreshDrawableState();\n                    }\n                }\n            }\n        }\n\n        protected dispatchDraw(canvas:Canvas):void {\n            let saveCount:number = 0;\n            const clipToPadding:boolean = (this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) == AbsListView.CLIP_TO_PADDING_MASK;\n            if (clipToPadding) {\n                saveCount = canvas.save();\n                const scrollX:number = this.mScrollX;\n                const scrollY:number = this.mScrollY;\n                canvas.clipRect(scrollX + this.mPaddingLeft, scrollY + this.mPaddingTop, scrollX + this.mRight - this.mLeft - this.mPaddingRight, scrollY + this.mBottom - this.mTop - this.mPaddingBottom);\n                this.mGroupFlags &= ~AbsListView.CLIP_TO_PADDING_MASK;\n            }\n            const drawSelectorOnTop:boolean = this.mDrawSelectorOnTop;\n            if (!drawSelectorOnTop) {\n                this.drawSelector(canvas);\n            }\n            super.dispatchDraw(canvas);\n            if (drawSelectorOnTop) {\n                this.drawSelector(canvas);\n            }\n            if (clipToPadding) {\n                canvas.restoreToCount(saveCount);\n                this.mGroupFlags |= AbsListView.CLIP_TO_PADDING_MASK;\n            }\n        }\n\n        isPaddingOffsetRequired():boolean {\n            return (this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) != AbsListView.CLIP_TO_PADDING_MASK;\n        }\n\n        getLeftPaddingOffset():number {\n            return (this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) == AbsListView.CLIP_TO_PADDING_MASK ? 0 : -this.mPaddingLeft;\n        }\n\n        getTopPaddingOffset():number {\n            return (this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) == AbsListView.CLIP_TO_PADDING_MASK ? 0 : -this.mPaddingTop;\n        }\n\n        getRightPaddingOffset():number {\n            return (this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) == AbsListView.CLIP_TO_PADDING_MASK ? 0 : this.mPaddingRight;\n        }\n\n        getBottomPaddingOffset():number {\n            return (this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) == AbsListView.CLIP_TO_PADDING_MASK ? 0 : this.mPaddingBottom;\n        }\n\n        protected onSizeChanged(w:number, h:number, oldw:number, oldh:number):void {\n            if (this.getChildCount() > 0) {\n                this.mDataChanged = true;\n                this.rememberSyncState();\n            }\n            //TODO when fast scroller impl\n            //if (this.mFastScroller != null) {\n            //    this.mFastScroller.onSizeChanged(w, h, oldw, oldh);\n            //}\n        }\n\n        /**\n         * @return True if the current touch mode requires that we draw the selector in the pressed\n         *         state.\n         */\n        touchModeDrawsInPressedState():boolean {\n            // FIXME use isPressed for this\n            switch (this.mTouchMode) {\n                case AbsListView.TOUCH_MODE_TAP:\n                case AbsListView.TOUCH_MODE_DONE_WAITING:\n                    return true;\n                default:\n                    return false;\n            }\n        }\n\n        /**\n         * Indicates whether this view is in a state where the selector should be drawn. This will\n         * happen if we have focus but are not in touch mode, or we are in the middle of displaying\n         * the pressed state for an item.\n         *\n         * @return True if the selector should be shown\n         */\n        shouldShowSelector():boolean {\n            return (!this.isInTouchMode()) || (this.touchModeDrawsInPressedState() && this.isPressed());\n        }\n\n        private drawSelector(canvas:Canvas):void {\n            if (!this.mSelectorRect.isEmpty()) {\n                const selector:Drawable = this.mSelector;\n                selector.setBounds(this.mSelectorRect);\n                selector.draw(canvas);\n            }\n        }\n\n        /**\n         * Controls whether the selection highlight drawable should be drawn on top of the item or\n         * behind it.\n         *\n         * @param onTop If true, the selector will be drawn on the item it is highlighting. The default\n         *        is false.\n         *\n         * @attr ref android.R.styleable#AbsListView_drawSelectorOnTop\n         */\n        setDrawSelectorOnTop(onTop:boolean):void {\n            this.mDrawSelectorOnTop = onTop;\n        }\n\n        /**\n         * Set a Drawable that should be used to highlight the currently selected item.\n         *\n         * @param resID A Drawable resource to use as the selection highlight.\n         *\n         * @attr ref android.R.styleable#AbsListView_listSelector\n         */\n        //setSelector(resID:number):void {\n        //    this.setSelector(this.getResources().getDrawable(resID));\n        //}\n\n        setSelector(sel:Drawable):void {\n            if (this.mSelector != null) {\n                this.mSelector.setCallback(null);\n                this.unscheduleDrawable(this.mSelector);\n            }\n            this.mSelector = sel;\n            let padding:Rect = new Rect();\n            sel.getPadding(padding);\n            this.mSelectionLeftPadding = padding.left;\n            this.mSelectionTopPadding = padding.top;\n            this.mSelectionRightPadding = padding.right;\n            this.mSelectionBottomPadding = padding.bottom;\n            sel.setCallback(this);\n            this.updateSelectorState();\n        }\n\n        /**\n         * Returns the selector {@link android.graphics.drawable.Drawable} that is used to draw the\n         * selection in the list.\n         *\n         * @return the drawable used to display the selector\n         */\n        getSelector():Drawable {\n            return this.mSelector;\n        }\n\n        /**\n         * Sets the selector state to \"pressed\" and posts a CheckForKeyLongPress to see if\n         * this is a long press.\n         */\n        keyPressed():void {\n            if (!this.isEnabled() || !this.isClickable()) {\n                return;\n            }\n            let selector:Drawable = this.mSelector;\n            let selectorRect:Rect = this.mSelectorRect;\n            if (selector != null && (this.isFocused() || this.touchModeDrawsInPressedState()) && !selectorRect.isEmpty()) {\n                const v:View = this.getChildAt(this.mSelectedPosition - this.mFirstPosition);\n                if (v != null) {\n                    if (v.hasFocusable())\n                        return;\n                    v.setPressed(true);\n                }\n                this.setPressed(true);\n                const longClickable:boolean = this.isLongClickable();\n                let d:Drawable = selector.getCurrent();\n                //TODO when transition ok\n                //if (d != null && d instanceof TransitionDrawable) {\n                //    if (longClickable) {\n                //        (<TransitionDrawable> d).startTransition(ViewConfiguration.getLongPressTimeout());\n                //    } else {\n                //        (<TransitionDrawable> d).resetTransition();\n                //    }\n                //}\n                if (longClickable && !this.mDataChanged) {\n                    if (this.mPendingCheckForKeyLongPress == null) {\n                        this.mPendingCheckForKeyLongPress = new AbsListView.CheckForKeyLongPress(this);\n                    }\n                    this.mPendingCheckForKeyLongPress.rememberWindowAttachCount();\n                    this.postDelayed(this.mPendingCheckForKeyLongPress, ViewConfiguration.getLongPressTimeout());\n                }\n            }\n        }\n\n        setScrollIndicators(up:View, down:View):void {\n            this.mScrollUp = up;\n            this.mScrollDown = down;\n        }\n\n        private updateSelectorState():void {\n            if (this.mSelector != null) {\n                if (this.shouldShowSelector()) {\n                    this.mSelector.setState(this.getDrawableState());\n                } else {\n                    this.mSelector.setState(StateSet.NOTHING);\n                }\n            }\n        }\n\n        protected drawableStateChanged():void {\n            super.drawableStateChanged();\n            this.updateSelectorState();\n        }\n\n        protected onCreateDrawableState(extraSpace:number):number[] {\n            // If the child view is enabled then do the default behavior.\n            if (this.mIsChildViewEnabled) {\n                // Common case\n                return super.onCreateDrawableState(extraSpace);\n            }\n            // The selector uses this View's drawable state. The selected child view\n            // is disabled, so we need to remove the enabled state from the drawable\n            // states.\n            const enabledState:number = AbsListView.ENABLED_STATE_SET[0];\n            // If we don't have any extra space, it will return one of the static state arrays,\n            // and clearing the enabled state on those arrays is a bad thing!  If we specify\n            // we need extra space, it will create+copy into a new array that safely mutable.\n            let state:number[] = super.onCreateDrawableState(extraSpace + 1);\n            let enabledPos:number = -1;\n            for (let i:number = state.length - 1; i >= 0; i--) {\n                if (state[i] == enabledState) {\n                    enabledPos = i;\n                    break;\n                }\n            }\n            // Remove the enabled state\n            if (enabledPos >= 0) {\n                System.arraycopy(state, enabledPos + 1, state, enabledPos, state.length - enabledPos - 1);\n            }\n            return state;\n        }\n\n        protected verifyDrawable(dr:Drawable):boolean {\n            return this.mSelector == dr || super.verifyDrawable(dr);\n        }\n\n        jumpDrawablesToCurrentState():void {\n            super.jumpDrawablesToCurrentState();\n            if (this.mSelector != null)\n                this.mSelector.jumpToCurrentState();\n        }\n\n        protected onAttachedToWindow():void {\n            super.onAttachedToWindow();\n            const treeObserver:ViewTreeObserver = this.getViewTreeObserver();\n            treeObserver.addOnTouchModeChangeListener(this);\n            //if (this.mTextFilterEnabled && this.mPopup != null && !this.mGlobalLayoutListenerAddedFilter) {\n            //    treeObserver.addOnGlobalLayoutListener(this);\n            //}\n            if (this.mAdapter != null && this.mDataSetObserver == null) {\n                this.mDataSetObserver = new AbsListView.AdapterDataSetObserver(this);\n                this.mAdapter.registerDataSetObserver(this.mDataSetObserver);\n                // Data may have changed while we were detached. Refresh.\n                this.mDataChanged = true;\n                this.mOldItemCount = this.mItemCount;\n                this.mItemCount = this.mAdapter.getCount();\n            }\n        }\n\n        protected onDetachedFromWindow():void {\n            super.onDetachedFromWindow();\n            // Dismiss the popup in case onSaveInstanceState() was not invoked\n            this.dismissPopup();\n            // Detach any view left in the scrap heap\n            this.mRecycler.clear();\n            const treeObserver:ViewTreeObserver = this.getViewTreeObserver();\n            treeObserver.removeOnTouchModeChangeListener(this);\n            //if (this.mTextFilterEnabled && this.mPopup != null) {\n            //    treeObserver.removeOnGlobalLayoutListener(this);\n            //    this.mGlobalLayoutListenerAddedFilter = false;\n            //}\n            if (this.mAdapter != null && this.mDataSetObserver != null) {\n                this.mAdapter.unregisterDataSetObserver(this.mDataSetObserver);\n                this.mDataSetObserver = null;\n            }\n            //if (this.mScrollStrictSpan != null) {\n            //    this.mScrollStrictSpan.finish();\n            //    this.mScrollStrictSpan = null;\n            //}\n            //if (this.mFlingStrictSpan != null) {\n            //    this.mFlingStrictSpan.finish();\n            //    this.mFlingStrictSpan = null;\n            //}\n            if (this.mFlingRunnable != null) {\n                this.removeCallbacks(this.mFlingRunnable);\n            }\n            if (this.mPositionScroller != null) {\n                this.mPositionScroller.stop();\n            }\n            if (this.mClearScrollingCache != null) {\n                this.removeCallbacks(this.mClearScrollingCache);\n            }\n            if (this.mPerformClick_ != null) {\n                this.removeCallbacks(this.mPerformClick_);\n            }\n            if (this.mTouchModeReset != null) {\n                this.removeCallbacks(this.mTouchModeReset);\n                this.mTouchModeReset.run();\n            }\n        }\n\n        onWindowFocusChanged(hasWindowFocus:boolean):void {\n            super.onWindowFocusChanged(hasWindowFocus);\n            const touchMode:number = this.isInTouchMode() ? AbsListView.TOUCH_MODE_ON : AbsListView.TOUCH_MODE_OFF;\n            if (!hasWindowFocus) {\n                this.setChildrenDrawingCacheEnabled(false);\n                if (this.mFlingRunnable != null) {\n                    this.removeCallbacks(this.mFlingRunnable);\n                    // let the fling runnable report it's new state which\n                    // should be idle\n                    this.mFlingRunnable.endFling();\n                    if (this.mPositionScroller != null) {\n                        this.mPositionScroller.stop();\n                    }\n                    if (this.mScrollY != 0) {\n                        this.mScrollY = 0;\n                        this.invalidateParentCaches();\n                        this.finishGlows();\n                        this.invalidate();\n                    }\n                }\n                // Always hide the type filter\n                this.dismissPopup();\n                if (touchMode == AbsListView.TOUCH_MODE_OFF) {\n                    // Remember the last selected element\n                    this.mResurrectToPosition = this.mSelectedPosition;\n                }\n            } else {\n                if (this.mFiltered && !this.mPopupHidden) {\n                    // Show the type filter only if a filter is in effect\n                    this.showPopup();\n                }\n                // If we changed touch mode since the last time we had focus\n                if (touchMode != this.mLastTouchMode && this.mLastTouchMode != AbsListView.TOUCH_MODE_UNKNOWN) {\n                    // If we come back in trackball mode, we bring the selection back\n                    if (touchMode == AbsListView.TOUCH_MODE_OFF) {\n                        // This will trigger a layout\n                        this.resurrectSelection();\n                        // If we come back in touch mode, then we want to hide the selector\n                    } else {\n                        this.hideSelector();\n                        this.mLayoutMode = AbsListView.LAYOUT_NORMAL;\n                        this.layoutChildren();\n                    }\n                }\n            }\n            this.mLastTouchMode = touchMode;\n        }\n\n        //onRtlPropertiesChanged(layoutDirection:number):void {\n        //    super.onRtlPropertiesChanged(layoutDirection);\n        //    if (this.mFastScroller != null) {\n        //        this.mFastScroller.setScrollbarPosition(this.getVerticalScrollbarPosition());\n        //    }\n        //}\n\n        /**\n         * Creates the ContextMenuInfo returned from {@link #getContextMenuInfo()}. This\n         * methods knows the view, position and ID of the item that received the\n         * long press.\n         *\n         * @param view The view that received the long press.\n         * @param position The position of the item that received the long press.\n         * @param id The ID of the item that received the long press.\n         * @return The extra information that should be returned by\n         *         {@link #getContextMenuInfo()}.\n         */\n        //private createContextMenuInfo(view:View, position:number, id:number):ContextMenuInfo {\n        //    return new AdapterContextMenuInfo(view, position, id);\n        //}\n\n        onCancelPendingInputEvents():void {\n            super.onCancelPendingInputEvents();\n            if (this.mPerformClick_ != null) {\n                this.removeCallbacks(this.mPerformClick_);\n            }\n            if (this.mPendingCheckForTap_ != null) {\n                this.removeCallbacks(this.mPendingCheckForTap_);\n            }\n            if (this.mPendingCheckForLongPress_List != null) {\n                this.removeCallbacks(this.mPendingCheckForLongPress_List);\n            }\n            if (this.mPendingCheckForKeyLongPress != null) {\n                this.removeCallbacks(this.mPendingCheckForKeyLongPress);\n            }\n        }\n\n\n        private performLongPress(child:View, longPressPosition:number, longPressId:number):boolean {\n            // CHOICE_MODE_MULTIPLE_MODAL takes over long press.\n            //if (this.mChoiceMode == AbsListView.CHOICE_MODE_MULTIPLE_MODAL) {\n            //    if (this.mChoiceActionMode == null && (this.mChoiceActionMode = this.startActionMode(this.mMultiChoiceModeCallback)) != null) {\n            //        this.setItemChecked(longPressPosition, true);\n            //        this.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);\n            //    }\n            //    return true;\n            //}\n            let handled:boolean = false;\n            if (this.mOnItemLongClickListener != null) {\n                handled = this.mOnItemLongClickListener.onItemLongClick(<any>this, child, longPressPosition, longPressId);\n            }\n            //if (!handled) {\n            //    this.mContextMenuInfo = this.createContextMenuInfo(child, longPressPosition, longPressId);\n            //    handled = super.showContextMenuForChild(AbsListView.this);\n            //}\n            if (handled) {\n                this.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);\n            }\n            return handled;\n        }\n\n        //getContextMenuInfo():ContextMenuInfo {\n        //    return this.mContextMenuInfo;\n        //}\n        //\n        ///** @hide */\n        //showContextMenu(x:number, y:number, metaState:number):boolean {\n        //    const position:number = this.pointToPosition(Math.floor(x), Math.floor(y));\n        //    if (position != AbsListView.INVALID_POSITION) {\n        //        const id:number = this.mAdapter.getItemId(position);\n        //        let child:View = this.getChildAt(position - mFirstPosition);\n        //        if (child != null) {\n        //            this.mContextMenuInfo = this.createContextMenuInfo(child, position, id);\n        //            return super.showContextMenuForChild(AbsListView.this);\n        //        }\n        //    }\n        //    return super.showContextMenu(x, y, metaState);\n        //}\n        //\n        //showContextMenuForChild(originalView:View):boolean {\n        //    const longPressPosition:number = this.getPositionForView(originalView);\n        //    if (longPressPosition >= 0) {\n        //        const longPressId:number = this.mAdapter.getItemId(longPressPosition);\n        //        let handled:boolean = false;\n        //        if (mOnItemLongClickListener != null) {\n        //            handled = mOnItemLongClickListener.onItemLongClick(AbsListView.this, originalView, longPressPosition, longPressId);\n        //        }\n        //        if (!handled) {\n        //            this.mContextMenuInfo = this.createContextMenuInfo(this.getChildAt(longPressPosition - mFirstPosition), longPressPosition, longPressId);\n        //            handled = super.showContextMenuForChild(originalView);\n        //        }\n        //        return handled;\n        //    }\n        //    return false;\n        //}\n\n        onKeyDown(keyCode:number, event:KeyEvent):boolean {\n            return false;\n        }\n\n        onKeyUp(keyCode:number, event:KeyEvent):boolean {\n            if (KeyEvent.isConfirmKey(keyCode)) {\n                if (!this.isEnabled()) {\n                    return true;\n                }\n                if (this.isClickable() && this.isPressed() && this.mSelectedPosition >= 0\n                    && this.mAdapter != null && this.mSelectedPosition < this.mAdapter.getCount()) {\n                    const view:View = this.getChildAt(this.mSelectedPosition - this.mFirstPosition);\n                    if (view != null) {\n                        this.performItemClick(view, this.mSelectedPosition, this.mSelectedRowId);\n                        view.setPressed(false);\n                    }\n                    this.setPressed(false);\n                    return true;\n                }\n            }\n            return super.onKeyUp(keyCode, event);\n        }\n\n        dispatchSetPressed(pressed:boolean):void {\n            // Don't dispatch setPressed to our children. We call setPressed on ourselves to\n            // get the selector in the right state, but we don't want to press each child.\n        }\n\n        /**\n         * Maps a point to a position in the list.\n         *\n         * @param x X in local coordinate\n         * @param y Y in local coordinate\n         * @return The position of the item which contains the specified point, or\n         *         {@link #INVALID_POSITION} if the point does not intersect an item.\n         */\n        pointToPosition(x:number, y:number):number {\n            let frame:Rect = this.mTouchFrame;\n            if (frame == null) {\n                this.mTouchFrame = new Rect();\n                frame = this.mTouchFrame;\n            }\n            const count:number = this.getChildCount();\n            for (let i:number = count - 1; i >= 0; i--) {\n                const child:View = this.getChildAt(i);\n                if (child.getVisibility() == View.VISIBLE) {\n                    child.getHitRect(frame);\n                    if (frame.contains(x, y)) {\n                        return this.mFirstPosition + i;\n                    }\n                }\n            }\n            return AbsListView.INVALID_POSITION;\n        }\n\n        /**\n         * Maps a point to a the rowId of the item which intersects that point.\n         *\n         * @param x X in local coordinate\n         * @param y Y in local coordinate\n         * @return The rowId of the item which contains the specified point, or {@link #INVALID_ROW_ID}\n         *         if the point does not intersect an item.\n         */\n        pointToRowId(x:number, y:number):number {\n            let position:number = this.pointToPosition(x, y);\n            if (position >= 0) {\n                return this.mAdapter.getItemId(position);\n            }\n            return AbsListView.INVALID_ROW_ID;\n        }\n\n        protected checkOverScrollStartScrollIfNeeded():boolean {\n            return this.mScrollY != 0;\n        }\n\n        private startScrollIfNeeded(y:number):boolean {\n            // Check if we have moved far enough that it looks more like a\n            // scroll than a tap\n            const deltaY:number = y - this.mMotionY;\n            const distance:number = Math.abs(deltaY);\n            const overscroll:boolean = this.checkOverScrollStartScrollIfNeeded();\n            if (overscroll || distance > this.mTouchSlop) {\n                this.createScrollingCache();\n                if (this.mScrollY != 0) {\n                    this.mTouchMode = AbsListView.TOUCH_MODE_OVERSCROLL;\n                    this.mMotionCorrection = 0;\n                } else {\n                    this.mTouchMode = AbsListView.TOUCH_MODE_SCROLL;\n                    this.mMotionCorrection = deltaY > 0 ? this.mTouchSlop : -this.mTouchSlop;\n                }\n                this.removeCallbacks(this.mPendingCheckForLongPress_List);\n                this.setPressed(false);\n                const motionView:View = this.getChildAt(this.mMotionPosition - this.mFirstPosition);\n                if (motionView != null) {\n                    motionView.setPressed(false);\n                }\n                this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);\n                // Time to start stealing events! Once we've stolen them, don't let anyone\n                // steal from us\n                const parent:ViewParent = this.getParent();\n                if (parent != null) {\n                    parent.requestDisallowInterceptTouchEvent(true);\n                }\n                this.scrollIfNeeded(y);\n                return true;\n            }\n            return false;\n        }\n\n        private scrollIfNeeded(y:number):void {\n            const rawDeltaY:number = y - this.mMotionY;\n            const deltaY:number = rawDeltaY - this.mMotionCorrection;\n            let incrementalDeltaY:number = this.mLastY != Integer.MIN_VALUE ? y - this.mLastY : deltaY;\n            if (this.mTouchMode == AbsListView.TOUCH_MODE_SCROLL) {\n                if (AbsListView.PROFILE_SCROLLING) {\n                    if (!this.mScrollProfilingStarted) {\n                        //Debug.startMethodTracing(\"AbsListViewScroll\");\n                        this.mScrollProfilingStarted = true;\n                    }\n                }\n                //if (this.mScrollStrictSpan == null) {\n                //    // If it's non-null, we're already in a scroll.\n                //    this.mScrollStrictSpan = StrictMode.enterCriticalSpan(\"AbsListView-scroll\");\n                //}\n                if (y != this.mLastY) {\n                    // Make sure that we do so in case we're in a parent that can intercept.\n                    if ((this.mGroupFlags & AbsListView.FLAG_DISALLOW_INTERCEPT) == 0 && Math.abs(rawDeltaY) > this.mTouchSlop) {\n                        const parent:ViewParent = this.getParent();\n                        if (parent != null) {\n                            parent.requestDisallowInterceptTouchEvent(true);\n                        }\n                    }\n                    let motionIndex:number;\n                    if (this.mMotionPosition >= 0) {\n                        motionIndex = this.mMotionPosition - this.mFirstPosition;\n                    } else {\n                        // If we don't have a motion position that we can reliably track,\n                        // pick something in the middle to make a best guess at things below.\n                        motionIndex = this.getChildCount() / 2;\n                    }\n                    let motionViewPrevTop:number = 0;\n                    let motionView:View = this.getChildAt(motionIndex);\n                    if (motionView != null) {\n                        motionViewPrevTop = motionView.getTop();\n                    }\n                    // No need to do all this work if we're not going to move anyway\n                    let atEdge:boolean = false;\n                    if (incrementalDeltaY != 0) {\n                        atEdge = this.trackMotionScroll(deltaY, incrementalDeltaY);\n                    }\n                    // Check to see if we have bumped into the scroll limit\n                    motionView = this.getChildAt(motionIndex);\n                    if (motionView != null) {\n                        // Check if the top of the motion view is where it is\n                        // supposed to be\n                        const motionViewRealTop:number = motionView.getTop();\n                        if (atEdge) {\n                            // Apply overscroll\n                            let overscroll:number = -incrementalDeltaY - (motionViewRealTop - motionViewPrevTop);\n                            this.overScrollBy(0, overscroll, 0, this.mScrollY, 0, 0, 0, this.mOverscrollDistance, true);\n                            if (Math.abs(this.mOverscrollDistance) == Math.abs(this.mScrollY)) {\n                                // Don't allow overfling if we're at the edge.\n                                if (this.mVelocityTracker != null) {\n                                    this.mVelocityTracker.clear();\n                                }\n                            }\n                            const overscrollMode:number = this.getOverScrollMode();\n                            if (overscrollMode == AbsListView.OVER_SCROLL_ALWAYS || (overscrollMode == AbsListView.OVER_SCROLL_IF_CONTENT_SCROLLS && !this.contentFits())) {\n                                // Reset when entering overscroll.\n                                this.mDirection = 0;\n                                this.mTouchMode = AbsListView.TOUCH_MODE_OVERSCROLL;\n                                if (rawDeltaY > 0) {\n                                    //this.mEdgeGlowTop.onPull(<number> overscroll / this.getHeight());\n                                    //if (!this.mEdgeGlowBottom.isFinished()) {\n                                    //    this.mEdgeGlowBottom.onRelease();\n                                    //}\n                                    //this.invalidate(this.mEdgeGlowTop.getBounds(false));\n                                } else if (rawDeltaY < 0) {\n                                    //this.mEdgeGlowBottom.onPull(<number> overscroll / this.getHeight());\n                                    //if (!this.mEdgeGlowTop.isFinished()) {\n                                    //    this.mEdgeGlowTop.onRelease();\n                                    //}\n                                    //this.invalidate(this.mEdgeGlowBottom.getBounds(true));\n                                }\n                            }\n                        }\n                        this.mMotionY = y;\n                    }\n                    this.mLastY = y;\n                }\n            } else if (this.mTouchMode == AbsListView.TOUCH_MODE_OVERSCROLL) {\n                if (y != this.mLastY) {\n                    const oldScroll:number = this.mScrollY;\n                    const newScroll:number = oldScroll - incrementalDeltaY;\n                    let newDirection:number = y > this.mLastY ? 1 : -1;\n                    if (this.mDirection == 0) {\n                        this.mDirection = newDirection;\n                    }\n                    let overScrollDistance:number = -incrementalDeltaY;\n                    if ((newScroll < 0 && oldScroll >= 0) || (newScroll > 0 && oldScroll <= 0)) {\n                        overScrollDistance = -oldScroll;\n                        incrementalDeltaY += overScrollDistance;\n                    } else {\n                        incrementalDeltaY = 0;\n                    }\n                    if (overScrollDistance != 0) {\n                        this.overScrollBy(0, overScrollDistance, 0, this.mScrollY, 0, 0, 0, this.mOverscrollDistance, true);\n                        //const overscrollMode:number = this.getOverScrollMode();\n                        //if (overscrollMode == AbsListView.OVER_SCROLL_ALWAYS || (overscrollMode == AbsListView.OVER_SCROLL_IF_CONTENT_SCROLLS && !this.contentFits())) {\n                        //    if (rawDeltaY > 0) {\n                                //this.mEdgeGlowTop.onPull(<number> overScrollDistance / this.getHeight());\n                                //if (!this.mEdgeGlowBottom.isFinished()) {\n                                //    this.mEdgeGlowBottom.onRelease();\n                                //}\n                                //this.invalidate(this.mEdgeGlowTop.getBounds(false));\n                            //} else if (rawDeltaY < 0) {\n                                //this.mEdgeGlowBottom.onPull(<number> overScrollDistance / this.getHeight());\n                                //if (!this.mEdgeGlowTop.isFinished()) {\n                                //    this.mEdgeGlowTop.onRelease();\n                                //}\n                                //this.invalidate(this.mEdgeGlowBottom.getBounds(true));\n                            //}\n                        //}\n                    }\n                    if (incrementalDeltaY != 0) {\n                        // Coming back to 'real' list scrolling\n                        if (this.mScrollY != 0) {\n                            this.mScrollY = 0;\n                            this.invalidateParentIfNeeded();\n                        }\n                        this.trackMotionScroll(incrementalDeltaY, incrementalDeltaY);\n                        this.mTouchMode = AbsListView.TOUCH_MODE_SCROLL;\n                        // We did not scroll the full amount. Treat this essentially like the\n                        // start of a new touch scroll\n                        const motionPosition:number = this.findClosestMotionRow(y);\n                        this.mMotionCorrection = 0;\n                        let motionView:View = this.getChildAt(motionPosition - this.mFirstPosition);\n                        this.mMotionViewOriginalTop = motionView != null ? motionView.getTop() : 0;\n                        this.mMotionY = y;\n                        this.mMotionPosition = motionPosition;\n                    }\n                    this.mLastY = y;\n                    this.mDirection = newDirection;\n                }\n            }\n        }\n\n        onTouchModeChanged(isInTouchMode:boolean):void {\n            if (isInTouchMode) {\n                // Get rid of the selection when we enter touch mode\n                this.hideSelector();\n                // state.)\n                if (this.getHeight() > 0 && this.getChildCount() > 0) {\n                    // We do not lose focus initiating a touch (since AbsListView is focusable in\n                    // touch mode). Force an initial layout to get rid of the selection.\n                    this.layoutChildren();\n                }\n                this.updateSelectorState();\n            } else {\n                let touchMode:number = this.mTouchMode;\n                if (touchMode == AbsListView.TOUCH_MODE_OVERSCROLL || touchMode == AbsListView.TOUCH_MODE_OVERFLING) {\n                    if (this.mFlingRunnable != null) {\n                        this.mFlingRunnable.endFling();\n                    }\n                    if (this.mPositionScroller != null) {\n                        this.mPositionScroller.stop();\n                    }\n                    if (this.mScrollY != 0) {\n                        this.mScrollY = 0;\n                        this.invalidateParentCaches();\n                        this.finishGlows();\n                        this.invalidate();\n                    }\n                }\n            }\n        }\n\n        onTouchEvent(ev:MotionEvent):boolean {\n            if (!this.isEnabled()) {\n                // events, it just doesn't respond to them.\n                return this.isClickable() || this.isLongClickable();\n            }\n            if (this.mPositionScroller != null) {\n                this.mPositionScroller.stop();\n            }\n            if (!this.isAttachedToWindow()) {\n                // in a bogus state.\n                return false;\n            }\n            //TODO when fast scroller impl\n            //if (this.mFastScroller != null) {\n            //    let intercepted:boolean = this.mFastScroller.onTouchEvent(ev);\n            //    if (intercepted) {\n            //        return true;\n            //    }\n            //}\n            this.initVelocityTrackerIfNotExists();\n            this.mVelocityTracker.addMovement(ev);\n            const actionMasked:number = ev.getActionMasked();\n            switch (actionMasked) {\n                case MotionEvent.ACTION_DOWN:\n                {\n                    this.onTouchDown(ev);\n                    break;\n                }\n                case MotionEvent.ACTION_MOVE:\n                {\n                    this.onTouchMove(ev);\n                    break;\n                }\n                case MotionEvent.ACTION_UP:\n                {\n                    this.onTouchUp(ev);\n                    break;\n                }\n                case MotionEvent.ACTION_CANCEL:\n                {\n                    this.onTouchCancel();\n                    break;\n                }\n                case MotionEvent.ACTION_POINTER_UP:\n                {\n                    this.onSecondaryPointerUp(ev);\n                    const x:number = this.mMotionX;\n                    const y:number = this.mMotionY;\n                    const motionPosition:number = this.pointToPosition(x, y);\n                    if (motionPosition >= 0) {\n                        // Remember where the motion event started\n                        const child:View = this.getChildAt(motionPosition - this.mFirstPosition);\n                        this.mMotionViewOriginalTop = child.getTop();\n                        this.mMotionPosition = motionPosition;\n                    }\n                    this.mLastY = y;\n                    break;\n                }\n                case MotionEvent.ACTION_POINTER_DOWN:\n                {\n                    // New pointers take over dragging duties\n                    const index:number = ev.getActionIndex();\n                    const id:number = ev.getPointerId(index);\n                    const x:number = Math.floor(ev.getX(index));\n                    const y:number = Math.floor(ev.getY(index));\n                    this.mMotionCorrection = 0;\n                    this.mActivePointerId = id;\n                    this.mMotionX = x;\n                    this.mMotionY = y;\n                    const motionPosition:number = this.pointToPosition(x, y);\n                    if (motionPosition >= 0) {\n                        // Remember where the motion event started\n                        const child:View = this.getChildAt(motionPosition - this.mFirstPosition);\n                        this.mMotionViewOriginalTop = child.getTop();\n                        this.mMotionPosition = motionPosition;\n                    }\n                    this.mLastY = y;\n                    break;\n                }\n            }\n            return true;\n        }\n\n        private onTouchDown(ev:MotionEvent):void {\n            this.mActivePointerId = ev.getPointerId(0);\n            if (this.mTouchMode == AbsListView.TOUCH_MODE_OVERFLING) {\n                // Stopped the fling. It is a scroll.\n                this.mFlingRunnable.endFling();\n                if (this.mPositionScroller != null) {\n                    this.mPositionScroller.stop();\n                }\n                this.mTouchMode = AbsListView.TOUCH_MODE_OVERSCROLL;\n                this.mMotionX = Math.floor(ev.getX());\n                this.mMotionY = Math.floor(ev.getY());\n                this.mLastY = this.mMotionY;\n                this.mMotionCorrection = 0;\n                this.mDirection = 0;\n            } else {\n                const x:number = Math.floor(ev.getX());\n                const y:number = Math.floor(ev.getY());\n                let motionPosition:number = this.pointToPosition(x, y);\n                if (!this.mDataChanged) {\n                    if (this.mTouchMode == AbsListView.TOUCH_MODE_FLING) {\n                        // Stopped a fling. It is a scroll.\n                        this.createScrollingCache();\n                        this.mTouchMode = AbsListView.TOUCH_MODE_SCROLL;\n                        this.mMotionCorrection = 0;\n                        motionPosition = this.findMotionRow(y);\n                        this.mFlingRunnable.flywheelTouch();\n                    } else if ((motionPosition >= 0) && this.getAdapter().isEnabled(motionPosition)) {\n                        // User clicked on an actual view (and was not stopping a\n                        // fling). It might be a click or a scroll. Assume it is a\n                        // click until proven otherwise.\n                        this.mTouchMode = AbsListView.TOUCH_MODE_DOWN;\n                        // FIXME Debounce\n                        if (this.mPendingCheckForTap_ == null) {\n                            this.mPendingCheckForTap_ = new AbsListView.CheckForTap(this);\n                        }\n                        this.postDelayed(this.mPendingCheckForTap_, ViewConfiguration.getTapTimeout());\n                    }\n                    //AndroidUI added. so listView can drag even not touch on item (item count is less)\n                    else if(motionPosition < 0){\n                        this.mTouchMode = AbsListView.TOUCH_MODE_DOWN;\n                    }\n                }\n                if (motionPosition >= 0) {\n                    // Remember where the motion event started\n                    const v:View = this.getChildAt(motionPosition - this.mFirstPosition);\n                    this.mMotionViewOriginalTop = v.getTop();\n                }\n                this.mMotionX = x;\n                this.mMotionY = y;\n                this.mMotionPosition = motionPosition;\n                this.mLastY = Integer.MIN_VALUE;\n            }\n            if (this.mTouchMode == AbsListView.TOUCH_MODE_DOWN && this.mMotionPosition != AbsListView.INVALID_POSITION\n                && this.performButtonActionOnTouchDown(ev)) {\n                this.removeCallbacks(this.mPendingCheckForTap_);\n            }\n        }\n\n        private onTouchMove(ev:MotionEvent):void {\n            let pointerIndex:number = ev.findPointerIndex(this.mActivePointerId);\n            if (pointerIndex == -1) {\n                pointerIndex = 0;\n                this.mActivePointerId = ev.getPointerId(pointerIndex);\n            }\n            if (this.mDataChanged) {\n                // Re-sync everything if data has been changed\n                // since the scroll operation can query the adapter.\n                this.layoutChildren();\n            }\n            const y:number = Math.floor(ev.getY(pointerIndex));\n            switch (this.mTouchMode) {\n                case AbsListView.TOUCH_MODE_DOWN:\n                case AbsListView.TOUCH_MODE_TAP:\n                case AbsListView.TOUCH_MODE_DONE_WAITING:\n                    // scroll than a tap. If so, we'll enter scrolling mode.\n                    if (this.startScrollIfNeeded(y)) {\n                        break;\n                    }\n                    // Otherwise, check containment within list bounds. If we're\n                    // outside bounds, cancel any active presses.\n                    const x:number = ev.getX(pointerIndex);\n                    if (!this.pointInView(x, y, this.mTouchSlop)) {\n                        this.setPressed(false);\n                        const motionView:View = this.getChildAt(this.mMotionPosition - this.mFirstPosition);\n                        if (motionView != null) {\n                            motionView.setPressed(false);\n                        }\n                        this.removeCallbacks(this.mTouchMode == AbsListView.TOUCH_MODE_DOWN ? this.mPendingCheckForTap_ : this.mPendingCheckForLongPress_List);\n                        this.mTouchMode = AbsListView.TOUCH_MODE_DONE_WAITING;\n                        this.updateSelectorState();\n                    }\n                    break;\n                case AbsListView.TOUCH_MODE_SCROLL:\n                case AbsListView.TOUCH_MODE_OVERSCROLL:\n                    this.scrollIfNeeded(y);\n                    break;\n            }\n        }\n\n        private onTouchUp(ev:MotionEvent):void {\n            switch (this.mTouchMode) {\n                case AbsListView.TOUCH_MODE_DOWN:\n                case AbsListView.TOUCH_MODE_TAP:\n                case AbsListView.TOUCH_MODE_DONE_WAITING:\n                    const motionPosition:number = this.mMotionPosition;\n                    const child:View = this.getChildAt(motionPosition - this.mFirstPosition);\n                    if (child != null) {\n                        if (this.mTouchMode != AbsListView.TOUCH_MODE_DOWN) {\n                            child.setPressed(false);\n                        }\n                        const x:number = ev.getX();\n                        const inList:boolean = x > this.mListPadding.left && x < this.getWidth() - this.mListPadding.right;\n                        if (inList && !child.hasFocusable()) {\n                            if (this.mPerformClick_ == null) {\n                                this.mPerformClick_ = new AbsListView.PerformClick(this);\n                            }\n                            const performClick:AbsListView.PerformClick = this.mPerformClick_;\n                            performClick.mClickMotionPosition = motionPosition;\n                            performClick.rememberWindowAttachCount();\n                            this.mResurrectToPosition = motionPosition;\n                            if (this.mTouchMode == AbsListView.TOUCH_MODE_DOWN || this.mTouchMode == AbsListView.TOUCH_MODE_TAP) {\n                                this.removeCallbacks(this.mTouchMode == AbsListView.TOUCH_MODE_DOWN ? this.mPendingCheckForTap_ : this.mPendingCheckForLongPress_List);\n                                this.mLayoutMode = AbsListView.LAYOUT_NORMAL;\n                                if (!this.mDataChanged && this.mAdapter.isEnabled(motionPosition)) {\n                                    this.mTouchMode = AbsListView.TOUCH_MODE_TAP;\n                                    this.setSelectedPositionInt(this.mMotionPosition);\n                                    this.layoutChildren();\n                                    child.setPressed(true);\n                                    this.positionSelector(this.mMotionPosition, child);\n                                    this.setPressed(true);\n                                    if (this.mSelector != null) {\n                                        let d:Drawable = this.mSelector.getCurrent();\n                                        //TODO when transition drawable impl\n                                        //if (d != null && d instanceof TransitionDrawable) {\n                                        //    (<TransitionDrawable> d).resetTransition();\n                                        //}\n                                    }\n                                    if (this.mTouchModeReset != null) {\n                                        this.removeCallbacks(this.mTouchModeReset);\n                                    }\n                                    this.mTouchModeReset = (()=> {\n                                        const inner_this = this;\n                                        class _Inner implements Runnable {\n\n                                            run():void {\n                                                inner_this.mTouchModeReset = null;\n                                                inner_this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                                                child.setPressed(false);\n                                                inner_this.setPressed(false);\n                                                if (!inner_this.mDataChanged && inner_this.isAttachedToWindow()) {\n                                                    performClick.run();\n                                                }\n                                            }\n                                        }\n                                        return new _Inner();\n                                    })();\n                                    this.postDelayed(this.mTouchModeReset, ViewConfiguration.getPressedStateDuration());\n                                } else {\n                                    this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                                    this.updateSelectorState();\n                                }\n                                return;\n                            } else if (!this.mDataChanged && this.mAdapter.isEnabled(motionPosition)) {\n                                performClick.run();\n                            }\n                        }\n                    }\n                    this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                    this.updateSelectorState();\n                    break;\n                case AbsListView.TOUCH_MODE_SCROLL:\n                    const childCount:number = this.getChildCount();\n                    if (childCount > 0) {\n                        const firstChildTop:number = this.getChildAt(0).getTop();\n                        const lastChildBottom:number = this.getChildAt(childCount - 1).getBottom();\n                        const contentTop:number = this.mListPadding.top;\n                        const contentBottom:number = this.getHeight() - this.mListPadding.bottom;\n                        if (this.mFirstPosition == 0 && firstChildTop >= contentTop && this.mFirstPosition + childCount < this.mItemCount\n                            && lastChildBottom <= this.getHeight() - contentBottom) {\n                            this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                            this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_IDLE);\n                        } else {\n                            const velocityTracker:VelocityTracker = this.mVelocityTracker;\n                            velocityTracker.computeCurrentVelocity(1000, this.mMaximumVelocity);\n                            const initialVelocity:number = Math.floor((velocityTracker.getYVelocity(this.mActivePointerId) * this.mVelocityScale));\n                            // fling further.\n                            if (Math.abs(initialVelocity) > this.mMinimumVelocity\n                                && !( (this.mFirstPosition == 0 && firstChildTop == contentTop - this.mOverscrollDistance)\n                                    || (this.mFirstPosition + childCount == this.mItemCount\n                                        && lastChildBottom == contentBottom + this.mOverscrollDistance))) {\n                                if (this.mFlingRunnable == null) {\n                                    this.mFlingRunnable = new AbsListView.FlingRunnable(this);\n                                }\n                                this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_FLING);\n                                this.mFlingRunnable.start(-initialVelocity);\n                            } else {\n                                this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                                this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_IDLE);\n                                if (this.mFlingRunnable != null) {\n                                    this.mFlingRunnable.endFling();\n                                }\n                                if (this.mPositionScroller != null) {\n                                    this.mPositionScroller.stop();\n                                }\n                            }\n                        }\n                    } else {\n                        this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                        this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_IDLE);\n                    }\n                    break;\n                case AbsListView.TOUCH_MODE_OVERSCROLL:\n                    if (this.mFlingRunnable == null) {\n                        this.mFlingRunnable = new AbsListView.FlingRunnable(this);\n                    }\n                    const velocityTracker:VelocityTracker = this.mVelocityTracker;\n                    velocityTracker.computeCurrentVelocity(1000, this.mMaximumVelocity);\n                    const initialVelocity:number = Math.floor(velocityTracker.getYVelocity(this.mActivePointerId));\n                    this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_FLING);\n                    if (Math.abs(initialVelocity) > this.mMinimumVelocity) {\n                        this.mFlingRunnable.startOverfling(-initialVelocity);\n                    } else {\n                        this.mFlingRunnable.startSpringback();\n                    }\n                    break;\n            }\n            this.setPressed(false);\n            //if (this.mEdgeGlowTop != null) {\n            //    this.mEdgeGlowTop.onRelease();\n            //    this.mEdgeGlowBottom.onRelease();\n            //}\n            // Need to redraw since we probably aren't drawing the selector anymore\n            this.invalidate();\n            this.removeCallbacks(this.mPendingCheckForLongPress_List);\n            this.recycleVelocityTracker();\n            this.mActivePointerId = AbsListView.INVALID_POINTER;\n            if (AbsListView.PROFILE_SCROLLING) {\n                if (this.mScrollProfilingStarted) {\n                    //Debug.stopMethodTracing();\n                    this.mScrollProfilingStarted = false;\n                }\n            }\n            //if (this.mScrollStrictSpan != null) {\n            //    this.mScrollStrictSpan.finish();\n            //    this.mScrollStrictSpan = null;\n            //}\n        }\n\n        private onTouchCancel():void {\n            switch (this.mTouchMode) {\n                case AbsListView.TOUCH_MODE_OVERSCROLL:\n                    if (this.mFlingRunnable == null) {\n                        this.mFlingRunnable = new AbsListView.FlingRunnable(this);\n                    }\n                    this.mFlingRunnable.startSpringback();\n                    break;\n                case AbsListView.TOUCH_MODE_OVERFLING:\n                    // Do nothing - let it play out.\n                    break;\n                default:\n                    this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                    this.setPressed(false);\n                    const motionView:View = this.getChildAt(this.mMotionPosition - this.mFirstPosition);\n                    if (motionView != null) {\n                        motionView.setPressed(false);\n                    }\n                    this.clearScrollingCache();\n                    this.removeCallbacks(this.mPendingCheckForLongPress_List);\n                    this.recycleVelocityTracker();\n            }\n            //if (this.mEdgeGlowTop != null) {\n            //    this.mEdgeGlowTop.onRelease();\n            //    this.mEdgeGlowBottom.onRelease();\n            //}\n            this.mActivePointerId = AbsListView.INVALID_POINTER;\n        }\n\n        protected onOverScrolled(scrollX:number, scrollY:number, clampedX:boolean, clampedY:boolean):void {\n            if (this.mScrollY != scrollY) {\n                this.onScrollChanged(this.mScrollX, scrollY, this.mScrollX, this.mScrollY);\n                this.mScrollY = scrollY;\n                this.invalidateParentIfNeeded();\n                this.awakenScrollBars();\n            }\n        }\n\n        onGenericMotionEvent(event:MotionEvent):boolean {\n            if (event.isPointerEvent()) {\n                switch (event.getAction()) {\n                    case MotionEvent.ACTION_SCROLL:\n                    {\n                        if (this.mTouchMode == AbsListView.TOUCH_MODE_REST) {\n                            const vscroll:number = event.getAxisValue(MotionEvent.AXIS_VSCROLL);\n                            if (vscroll != 0) {\n                                const delta:number = Math.floor((vscroll * this.getVerticalScrollFactor()));\n                                if (!this.trackMotionScroll(delta, delta)) {\n                                    return true;\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n            return super.onGenericMotionEvent(event);\n        }\n\n        draw(canvas:Canvas):void {\n            super.draw(canvas);\n            //if (this.mEdgeGlowTop != null) {\n            //    const scrollY:number = this.mScrollY;\n            //    if (!this.mEdgeGlowTop.isFinished()) {\n            //        const restoreCount:number = canvas.save();\n            //        const leftPadding:number = this.mListPadding.left + this.mGlowPaddingLeft;\n            //        const rightPadding:number = this.mListPadding.right + this.mGlowPaddingRight;\n            //        const width:number = this.getWidth() - leftPadding - rightPadding;\n            //        let edgeY:number = Math.min(0, scrollY + this.mFirstPositionDistanceGuess);\n            //        canvas.translate(leftPadding, edgeY);\n            //        this.mEdgeGlowTop.setSize(width, this.getHeight());\n            //        if (this.mEdgeGlowTop.draw(canvas)) {\n            //            this.mEdgeGlowTop.setPosition(leftPadding, edgeY);\n            //            this.invalidate(this.mEdgeGlowTop.getBounds(false));\n            //        }\n            //        canvas.restoreToCount(restoreCount);\n            //    }\n            //    if (!this.mEdgeGlowBottom.isFinished()) {\n            //        const restoreCount:number = canvas.save();\n            //        const leftPadding:number = this.mListPadding.left + this.mGlowPaddingLeft;\n            //        const rightPadding:number = this.mListPadding.right + this.mGlowPaddingRight;\n            //        const width:number = this.getWidth() - leftPadding - rightPadding;\n            //        const height:number = this.getHeight();\n            //        let edgeX:number = -width + leftPadding;\n            //        let edgeY:number = Math.max(height, scrollY + this.mLastPositionDistanceGuess);\n            //        canvas.translate(edgeX, edgeY);\n            //        canvas.rotate(180, width, 0);\n            //        this.mEdgeGlowBottom.setSize(width, height);\n            //        if (this.mEdgeGlowBottom.draw(canvas)) {\n            //            // Account for the rotation\n            //            this.mEdgeGlowBottom.setPosition(edgeX + width, edgeY);\n            //            this.invalidate(this.mEdgeGlowBottom.getBounds(true));\n            //        }\n            //        canvas.restoreToCount(restoreCount);\n            //    }\n            //}\n        }\n\n        /**\n         * @hide\n         */\n        setOverScrollEffectPadding(leftPadding:number, rightPadding:number):void {\n            this.mGlowPaddingLeft = leftPadding;\n            this.mGlowPaddingRight = rightPadding;\n        }\n\n        private initOrResetVelocityTracker():void {\n            if (this.mVelocityTracker == null) {\n                this.mVelocityTracker = VelocityTracker.obtain();\n            } else {\n                this.mVelocityTracker.clear();\n            }\n        }\n\n        private initVelocityTrackerIfNotExists():void {\n            if (this.mVelocityTracker == null) {\n                this.mVelocityTracker = VelocityTracker.obtain();\n            }\n        }\n\n        private recycleVelocityTracker():void {\n            if (this.mVelocityTracker != null) {\n                this.mVelocityTracker.recycle();\n                this.mVelocityTracker = null;\n            }\n        }\n\n        requestDisallowInterceptTouchEvent(disallowIntercept:boolean):void {\n            if (disallowIntercept) {\n                this.recycleVelocityTracker();\n            }\n            super.requestDisallowInterceptTouchEvent(disallowIntercept);\n        }\n\n        //TODO when hover impl\n        //onInterceptHoverEvent(event:MotionEvent):boolean {\n        //    //TODO when fast scroller impl\n        //    //if (this.mFastScroller != null && this.mFastScroller.onInterceptHoverEvent(event)) {\n        //    //    return true;\n        //    //}\n        //    return super.onInterceptHoverEvent(event);\n        //}\n\n        onInterceptTouchEvent(ev:MotionEvent):boolean {\n            let action:number = ev.getAction();\n            let v:View;\n            if (this.mPositionScroller != null) {\n                this.mPositionScroller.stop();\n            }\n            if (!this.isAttachedToWindow()) {\n                // in a bogus state.\n                return false;\n            }\n            //TODO when fast scroller impl\n            //if (this.mFastScroller != null && this.mFastScroller.onInterceptTouchEvent(ev)) {\n            //    return true;\n            //}\n            switch (action & MotionEvent.ACTION_MASK) {\n                case MotionEvent.ACTION_DOWN:\n                {\n                    let touchMode:number = this.mTouchMode;\n                    if (touchMode == AbsListView.TOUCH_MODE_OVERFLING || touchMode == AbsListView.TOUCH_MODE_OVERSCROLL) {\n                        this.mMotionCorrection = 0;\n                        return true;\n                    }\n                    const x:number = Math.floor(ev.getX());\n                    const y:number = Math.floor(ev.getY());\n                    this.mActivePointerId = ev.getPointerId(0);\n                    let motionPosition:number = this.findMotionRow(y);\n                    if (touchMode != AbsListView.TOUCH_MODE_FLING && motionPosition >= 0) {\n                        // User clicked on an actual view (and was not stopping a fling).\n                        // Remember where the motion event started\n                        v = this.getChildAt(motionPosition - this.mFirstPosition);\n                        this.mMotionViewOriginalTop = v.getTop();\n                        this.mMotionX = x;\n                        this.mMotionY = y;\n                        this.mMotionPosition = motionPosition;\n                        this.mTouchMode = AbsListView.TOUCH_MODE_DOWN;\n                        this.clearScrollingCache();\n                    }\n                    this.mLastY = Integer.MIN_VALUE;\n                    this.initOrResetVelocityTracker();\n                    this.mVelocityTracker.addMovement(ev);\n                    if (touchMode == AbsListView.TOUCH_MODE_FLING) {\n                        return true;\n                    }\n                    break;\n                }\n                case MotionEvent.ACTION_MOVE:\n                {\n                    switch (this.mTouchMode) {\n                        case AbsListView.TOUCH_MODE_DOWN:\n                            let pointerIndex:number = ev.findPointerIndex(this.mActivePointerId);\n                            if (pointerIndex == -1) {\n                                pointerIndex = 0;\n                                this.mActivePointerId = ev.getPointerId(pointerIndex);\n                            }\n                            const y:number = Math.floor(ev.getY(pointerIndex));\n                            this.initVelocityTrackerIfNotExists();\n                            this.mVelocityTracker.addMovement(ev);\n                            if (this.startScrollIfNeeded(y)) {\n                                return true;\n                            }\n                            break;\n                    }\n                    break;\n                }\n                case MotionEvent.ACTION_CANCEL:\n                case MotionEvent.ACTION_UP:\n                {\n                    this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                    this.mActivePointerId = AbsListView.INVALID_POINTER;\n                    this.recycleVelocityTracker();\n                    this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_IDLE);\n                    break;\n                }\n                case MotionEvent.ACTION_POINTER_UP:\n                {\n                    this.onSecondaryPointerUp(ev);\n                    break;\n                }\n            }\n            return false;\n        }\n\n        private onSecondaryPointerUp(ev:MotionEvent):void {\n            const pointerIndex:number = (ev.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;\n            const pointerId:number = ev.getPointerId(pointerIndex);\n            if (pointerId == this.mActivePointerId) {\n                // This was our active pointer going up. Choose a new\n                // active pointer and adjust accordingly.\n                // TODO: Make this decision more intelligent.\n                const newPointerIndex:number = pointerIndex == 0 ? 1 : 0;\n                this.mMotionX = Math.floor(ev.getX(newPointerIndex));\n                this.mMotionY = Math.floor(ev.getY(newPointerIndex));\n                this.mMotionCorrection = 0;\n                this.mActivePointerId = ev.getPointerId(newPointerIndex);\n            }\n        }\n\n        /**\n         * {@inheritDoc}\n         */\n        addTouchables(views:ArrayList<View>):void {\n            const count:number = this.getChildCount();\n            const firstPosition:number = this.mFirstPosition;\n            const adapter:ListAdapter = this.mAdapter;\n            if (adapter == null) {\n                return;\n            }\n            for (let i:number = 0; i < count; i++) {\n                const child:View = this.getChildAt(i);\n                if (adapter.isEnabled(firstPosition + i)) {\n                    views.add(child);\n                }\n                child.addTouchables(views);\n            }\n        }\n\n        /**\n         * Fires an \"on scroll state changed\" event to the registered\n         * {@link android.widget.AbsListView.OnScrollListener}, if any. The state change\n         * is fired only if the specified state is different from the previously known state.\n         *\n         * @param newState The new scroll state.\n         */\n        private reportScrollStateChange(newState:number):void {\n            if (newState != this.mLastScrollState) {\n                if (this.mOnScrollListener != null) {\n                    this.mLastScrollState = newState;\n                    this.mOnScrollListener.onScrollStateChanged(this, newState);\n                }\n            }\n        }\n\n\n        /**\n         * The amount of friction applied to flings. The default value\n         * is {@link ViewConfiguration#getScrollFriction}.\n         */\n        setFriction(friction:number):void {\n            if (this.mFlingRunnable == null) {\n                this.mFlingRunnable = new AbsListView.FlingRunnable(this);\n            }\n            this.mFlingRunnable.mScroller.setFriction(friction);\n        }\n\n        /**\n         * Sets a scale factor for the fling velocity. The initial scale\n         * factor is 1.0.\n         *\n         * @param scale The scale factor to multiply the velocity by.\n         */\n        setVelocityScale(scale:number):void {\n            this.mVelocityScale = scale;\n        }\n\n        /**\n         * Smoothly scroll to the specified adapter position. The view will scroll\n         * such that the indicated position is displayed <code>offset</code> pixels from\n         * the top edge of the view. If this is impossible, (e.g. the offset would scroll\n         * the first or last item beyond the boundaries of the list) it will get as close\n         * as possible. The scroll will take <code>duration</code> milliseconds to complete.\n         *\n         * @param position Position to scroll to\n         * @param offset Desired distance in pixels of <code>position</code> from the top\n         *               of the view when scrolling is finished\n         * @param duration Number of milliseconds to use for the scroll\n         */\n        smoothScrollToPositionFromTop(position:number, offset:number, duration?:number):void {\n            if (this.mPositionScroller == null) {\n                this.mPositionScroller = new AbsListView.PositionScroller(this);\n            }\n            this.mPositionScroller.startWithOffset(position, offset, duration);\n        }\n\n        /**\n         * Smoothly scroll to the specified adapter position. The view will\n         * scroll such that the indicated position is displayed, but it will\n         * stop early if scrolling further would scroll boundPosition out of\n         * view.\n         * @param position Scroll to this adapter position.\n         * @param boundPosition Do not scroll if it would move this adapter\n         *          position out of view.\n         */\n        smoothScrollToPosition(position:number, boundPosition?:number):void {\n            if (this.mPositionScroller == null) {\n                this.mPositionScroller = new AbsListView.PositionScroller(this);\n            }\n            this.mPositionScroller.start(position, boundPosition);\n        }\n\n        /**\n         * Smoothly scroll by distance pixels over duration milliseconds.\n         * @param distance Distance to scroll in pixels.\n         * @param duration Duration of the scroll animation in milliseconds.\n         */\n        smoothScrollBy(distance:number, duration:number, linear:boolean=false):void {\n            if (this.mFlingRunnable == null) {\n                this.mFlingRunnable = new AbsListView.FlingRunnable(this);\n            }\n            // No sense starting to scroll if we're not going anywhere\n            const firstPos:number = this.mFirstPosition;\n            const childCount:number = this.getChildCount();\n            const lastPos:number = firstPos + childCount;\n            const topLimit:number = this.getPaddingTop();\n            const bottomLimit:number = this.getHeight() - this.getPaddingBottom();\n            if (distance == 0 || this.mItemCount == 0 || childCount == 0\n                || (firstPos == 0 && this.getChildAt(0).getTop() == topLimit && distance < 0)\n                || (lastPos == this.mItemCount && this.getChildAt(childCount - 1).getBottom() == bottomLimit && distance > 0)) {\n                this.mFlingRunnable.endFling();\n                if (this.mPositionScroller != null) {\n                    this.mPositionScroller.stop();\n                }\n            } else {\n                this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_FLING);\n                this.mFlingRunnable.startScroll(distance, duration, linear);\n            }\n        }\n\n        /**\n         * Allows RemoteViews to scroll relatively to a position.\n         */\n        smoothScrollByOffset(position:number):void {\n            let index:number = -1;\n            if (position < 0) {\n                index = this.getFirstVisiblePosition();\n            } else if (position > 0) {\n                index = this.getLastVisiblePosition();\n            }\n            if (index > -1) {\n                let child:View = this.getChildAt(index - this.getFirstVisiblePosition());\n                if (child != null) {\n                    let visibleRect:Rect = new Rect();\n                    if (child.getGlobalVisibleRect(visibleRect)) {\n                        // the child is partially visible\n                        let childRectArea:number = child.getWidth() * child.getHeight();\n                        let visibleRectArea:number = visibleRect.width() * visibleRect.height();\n                        let visibleArea:number = (visibleRectArea / <number> childRectArea);\n                        const visibleThreshold:number = 0.75;\n                        if ((position < 0) && (visibleArea < visibleThreshold)) {\n                            // the top index is not perceivably visible so offset\n                            // to account for showing that top index as well\n                            ++index;\n                        } else if ((position > 0) && (visibleArea < visibleThreshold)) {\n                            // the bottom index is not perceivably visible so offset\n                            // to account for showing that bottom index as well\n                            --index;\n                        }\n                    }\n                    this.smoothScrollToPosition(Math.max(0, Math.min(this.getCount(), index + position)));\n                }\n            }\n        }\n\n        private createScrollingCache():void {\n            if (this.mScrollingCacheEnabled && !this.mCachingStarted && !this.isHardwareAccelerated()) {\n                this.setChildrenDrawnWithCacheEnabled(true);\n                this.setChildrenDrawingCacheEnabled(true);\n                this.mCachingStarted = this.mCachingActive = true;\n            }\n        }\n\n        private clearScrollingCache():void {\n            if (!this.isHardwareAccelerated()) {\n                if (this.mClearScrollingCache == null) {\n                    this.mClearScrollingCache = (()=> {\n                        const inner_this = this;\n                        class _Inner implements Runnable {\n\n                            run():void {\n                                if (inner_this.mCachingStarted) {\n                                    inner_this.mCachingStarted = inner_this.mCachingActive = false;\n                                    inner_this.setChildrenDrawnWithCacheEnabled(false);\n                                    if ((inner_this.mPersistentDrawingCache & AbsListView.PERSISTENT_SCROLLING_CACHE) == 0) {\n                                        inner_this.setChildrenDrawingCacheEnabled(false);\n                                    }\n                                    if (!inner_this.isAlwaysDrawnWithCacheEnabled()) {\n                                        inner_this.invalidate();\n                                    }\n                                }\n                            }\n                        }\n                        return new _Inner();\n                    })();\n                }\n                this.post(this.mClearScrollingCache);\n            }\n        }\n\n        /**\n         * Scrolls the list items within the view by a specified number of pixels.\n         *\n         * @param y the amount of pixels to scroll by vertically\n         * @see #canScrollList(int)\n         */\n        scrollListBy(y:number):void {\n            this.trackMotionScroll(-y, -y);\n        }\n\n        /**\n         * Check if the items in the list can be scrolled in a certain direction.\n         *\n         * @param direction Negative to check scrolling up, positive to check\n         *            scrolling down.\n         * @return true if the list can be scrolled in the specified direction,\n         *         false otherwise.\n         * @see #scrollListBy(int)\n         */\n        canScrollList(direction:number):boolean {\n            const childCount:number = this.getChildCount();\n            if (childCount == 0) {\n                return false;\n            }\n            const firstPosition:number = this.mFirstPosition;\n            const listPadding:Rect = this.mListPadding;\n            if (direction > 0) {\n                const lastBottom:number = this.getChildAt(childCount - 1).getBottom();\n                const lastPosition:number = firstPosition + childCount;\n                return lastPosition < this.mItemCount || lastBottom > this.getHeight() - listPadding.bottom;\n            } else {\n                const firstTop:number = this.getChildAt(0).getTop();\n                return firstPosition > 0 || firstTop < listPadding.top;\n            }\n        }\n\n        /**\n         * Track a motion scroll\n         *\n         * @param deltaY Amount to offset mMotionView. This is the accumulated delta since the motion\n         *        began. Positive numbers mean the user's finger is moving down the screen.\n         * @param incrementalDeltaY Change in deltaY from the previous event.\n         * @return true if we're already at the beginning/end of the list and have nothing to do.\n         */\n        private trackMotionScroll(deltaY:number, incrementalDeltaY:number):boolean {\n            const childCount:number = this.getChildCount();\n            if (childCount == 0) {\n                return true;\n            }\n            const firstTop:number = this.getChildAt(0).getTop();\n            const lastBottom:number = this.getChildAt(childCount - 1).getBottom();\n            const listPadding:Rect = this.mListPadding;\n            // \"effective padding\" In this case is the amount of padding that affects\n            // how much space should not be filled by items. If we don't clip to padding\n            // there is no effective padding.\n            let effectivePaddingTop:number = 0;\n            let effectivePaddingBottom:number = 0;\n            if ((this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) == AbsListView.CLIP_TO_PADDING_MASK) {\n                effectivePaddingTop = listPadding.top;\n                effectivePaddingBottom = listPadding.bottom;\n            }\n            // FIXME account for grid vertical spacing too?\n            const spaceAbove:number = effectivePaddingTop - firstTop;\n            const end:number = this.getHeight() - effectivePaddingBottom;\n            const spaceBelow:number = lastBottom - end;\n            const height:number = this.getHeight() - this.mPaddingBottom - this.mPaddingTop;\n            if (deltaY < 0) {\n                deltaY = Math.max(-(height - 1), deltaY);\n            } else {\n                deltaY = Math.min(height - 1, deltaY);\n            }\n            if (incrementalDeltaY < 0) {\n                incrementalDeltaY = Math.max(-(height - 1), incrementalDeltaY);\n            } else {\n                incrementalDeltaY = Math.min(height - 1, incrementalDeltaY);\n            }\n            const firstPosition:number = this.mFirstPosition;\n            // Update our guesses for where the first and last views are\n            if (firstPosition == 0) {\n                this.mFirstPositionDistanceGuess = firstTop - listPadding.top;\n            } else {\n                this.mFirstPositionDistanceGuess += incrementalDeltaY;\n            }\n            if (firstPosition + childCount == this.mItemCount) {\n                this.mLastPositionDistanceGuess = lastBottom + listPadding.bottom;\n            } else {\n                this.mLastPositionDistanceGuess += incrementalDeltaY;\n            }\n            const cannotScrollDown:boolean = (firstPosition == 0 && firstTop >= listPadding.top && incrementalDeltaY >= 0);\n            const cannotScrollUp:boolean = (firstPosition + childCount == this.mItemCount && lastBottom <= this.getHeight() - listPadding.bottom && incrementalDeltaY <= 0);\n            if (cannotScrollDown || cannotScrollUp) {\n                return incrementalDeltaY != 0;\n            }\n            const down:boolean = incrementalDeltaY < 0;\n            const inTouchMode:boolean = this.isInTouchMode();\n            if (inTouchMode) {\n                this.hideSelector();\n            }\n            const headerViewsCount:number = this.getHeaderViewsCount();\n            const footerViewsStart:number = this.mItemCount - this.getFooterViewsCount();\n            let start:number = 0;\n            let count:number = 0;\n            if (down) {\n                let top:number = -incrementalDeltaY;\n                if ((this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) == AbsListView.CLIP_TO_PADDING_MASK) {\n                    top += listPadding.top;\n                }\n                for (let i:number = 0; i < childCount; i++) {\n                    const child:View = this.getChildAt(i);\n                    if (child.getBottom() >= top) {\n                        break;\n                    } else {\n                        count++;\n                        let position:number = firstPosition + i;\n                        if (position >= headerViewsCount && position < footerViewsStart) {\n                            // system-managed transient state.\n                            //if (child.isAccessibilityFocused()) {\n                            //    child.clearAccessibilityFocus();\n                            //}\n                            this.mRecycler.addScrapView(child, position);\n                        }\n                    }\n                }\n            } else {\n                let bottom:number = this.getHeight() - incrementalDeltaY;\n                if ((this.mGroupFlags & AbsListView.CLIP_TO_PADDING_MASK) == AbsListView.CLIP_TO_PADDING_MASK) {\n                    bottom -= listPadding.bottom;\n                }\n                for (let i:number = childCount - 1; i >= 0; i--) {\n                    const child:View = this.getChildAt(i);\n                    if (child.getTop() <= bottom) {\n                        break;\n                    } else {\n                        start = i;\n                        count++;\n                        let position:number = firstPosition + i;\n                        if (position >= headerViewsCount && position < footerViewsStart) {\n                            // system-managed transient state.\n                            //if (child.isAccessibilityFocused()) {\n                            //    child.clearAccessibilityFocus();\n                            //}\n                            this.mRecycler.addScrapView(child, position);\n                        }\n                    }\n                }\n            }\n            this.mMotionViewNewTop = this.mMotionViewOriginalTop + deltaY;\n            this.mBlockLayoutRequests = true;\n            if (count > 0) {\n                this.detachViewsFromParent(start, count);\n                this.mRecycler.removeSkippedScrap();\n            }\n            // calls to bubble up from the children all the way to the top\n            if (!this.awakenScrollBars()) {\n                this.invalidate();\n            }\n            this.offsetChildrenTopAndBottom(incrementalDeltaY);\n            if (down) {\n                this.mFirstPosition += count;\n            }\n            const absIncrementalDeltaY:number = Math.abs(incrementalDeltaY);\n            if (spaceAbove < absIncrementalDeltaY || spaceBelow < absIncrementalDeltaY) {\n                this.fillGap(down);\n            }\n            if (!inTouchMode && this.mSelectedPosition != AbsListView.INVALID_POSITION) {\n                const childIndex:number = this.mSelectedPosition - this.mFirstPosition;\n                if (childIndex >= 0 && childIndex < this.getChildCount()) {\n                    this.positionSelector(this.mSelectedPosition, this.getChildAt(childIndex));\n                }\n            } else if (this.mSelectorPosition != AbsListView.INVALID_POSITION) {\n                const childIndex:number = this.mSelectorPosition - this.mFirstPosition;\n                if (childIndex >= 0 && childIndex < this.getChildCount()) {\n                    this.positionSelector(AbsListView.INVALID_POSITION, this.getChildAt(childIndex));\n                }\n            } else {\n                this.mSelectorRect.setEmpty();\n            }\n            this.mBlockLayoutRequests = false;\n            this.invokeOnItemScrollListener();\n            return false;\n        }\n\n        /**\n         * Returns the number of header views in the list. Header views are special views\n         * at the top of the list that should not be recycled during a layout.\n         *\n         * @return The number of header views, 0 in the default implementation.\n         */\n        getHeaderViewsCount():number {\n            return 0;\n        }\n\n        /**\n         * Returns the number of footer views in the list. Footer views are special views\n         * at the bottom of the list that should not be recycled during a layout.\n         *\n         * @return The number of footer views, 0 in the default implementation.\n         */\n        getFooterViewsCount():number {\n            return 0;\n        }\n\n        /**\n         * Fills the gap left open by a touch-scroll. During a touch scroll, children that\n         * remain on screen are shifted and the other ones are discarded. The role of this\n         * method is to fill the gap thus created by performing a partial layout in the\n         * empty space.\n         *\n         * @param down true if the scroll is going down, false if it is going up\n         */\n        abstract fillGap(down:boolean):void ;\n\n        hideSelector():void {\n            if (this.mSelectedPosition != AbsListView.INVALID_POSITION) {\n                if (this.mLayoutMode != AbsListView.LAYOUT_SPECIFIC) {\n                    this.mResurrectToPosition = this.mSelectedPosition;\n                }\n                if (this.mNextSelectedPosition >= 0 && this.mNextSelectedPosition != this.mSelectedPosition) {\n                    this.mResurrectToPosition = this.mNextSelectedPosition;\n                }\n                this.setSelectedPositionInt(AbsListView.INVALID_POSITION);\n                this.setNextSelectedPositionInt(AbsListView.INVALID_POSITION);\n                this.mSelectedTop = 0;\n            }\n        }\n\n        /**\n         * @return A position to select. First we try mSelectedPosition. If that has been clobbered by\n         * entering touch mode, we then try mResurrectToPosition. Values are pinned to the range\n         * of items available in the adapter\n         */\n        reconcileSelectedPosition():number {\n            let position:number = this.mSelectedPosition;\n            if (position < 0) {\n                position = this.mResurrectToPosition;\n            }\n            position = Math.max(0, position);\n            position = Math.min(position, this.mItemCount - 1);\n            return position;\n        }\n\n        /**\n         * Find the row closest to y. This row will be used as the motion row when scrolling\n         *\n         * @param y Where the user touched\n         * @return The position of the first (or only) item in the row containing y\n         */\n        abstract findMotionRow(y:number):number ;\n\n        /**\n         * Find the row closest to y. This row will be used as the motion row when scrolling.\n         *\n         * @param y Where the user touched\n         * @return The position of the first (or only) item in the row closest to y\n         */\n        private findClosestMotionRow(y:number):number {\n            const childCount:number = this.getChildCount();\n            if (childCount == 0) {\n                return AbsListView.INVALID_POSITION;\n            }\n            const motionRow:number = this.findMotionRow(y);\n            return motionRow != AbsListView.INVALID_POSITION ? motionRow : this.mFirstPosition + childCount - 1;\n        }\n\n        /**\n         * Causes all the views to be rebuilt and redrawn.\n         */\n        invalidateViews():void {\n            this.mDataChanged = true;\n            this.rememberSyncState();\n            this.requestLayout();\n            this.invalidate();\n        }\n\n        /**\n         * If there is a selection returns false.\n         * Otherwise resurrects the selection and returns true if resurrected.\n         */\n        resurrectSelectionIfNeeded():boolean {\n            if (this.mSelectedPosition < 0 && this.resurrectSelection()) {\n                this.updateSelectorState();\n                return true;\n            }\n            return false;\n        }\n\n        /**\n         * Makes the item at the supplied position selected.\n         *\n         * @param position the position of the new selection\n         */\n        abstract setSelectionInt(position:number):void ;\n\n        /**\n         * Attempt to bring the selection back if the user is switching from touch\n         * to trackball mode\n         * @return Whether selection was set to something.\n         */\n        private resurrectSelection():boolean {\n            const childCount:number = this.getChildCount();\n            if (childCount <= 0) {\n                return false;\n            }\n            let selectedTop:number = 0;\n            let selectedPos:number;\n            let childrenTop:number = this.mListPadding.top;\n            let childrenBottom:number = this.mBottom - this.mTop - this.mListPadding.bottom;\n            const firstPosition:number = this.mFirstPosition;\n            const toPosition:number = this.mResurrectToPosition;\n            let down:boolean = true;\n            if (toPosition >= firstPosition && toPosition < firstPosition + childCount) {\n                selectedPos = toPosition;\n                const selected:View = this.getChildAt(selectedPos - this.mFirstPosition);\n                selectedTop = selected.getTop();\n                let selectedBottom:number = selected.getBottom();\n                // We are scrolled, don't get in the fade\n                if (selectedTop < childrenTop) {\n                    selectedTop = childrenTop + this.getVerticalFadingEdgeLength();\n                } else if (selectedBottom > childrenBottom) {\n                    selectedTop = childrenBottom - selected.getMeasuredHeight() - this.getVerticalFadingEdgeLength();\n                }\n            } else {\n                if (toPosition < firstPosition) {\n                    // Default to selecting whatever is first\n                    selectedPos = firstPosition;\n                    for (let i:number = 0; i < childCount; i++) {\n                        const v:View = this.getChildAt(i);\n                        const top:number = v.getTop();\n                        if (i == 0) {\n                            // Remember the position of the first item\n                            selectedTop = top;\n                            // See if we are scrolled at all\n                            if (firstPosition > 0 || top < childrenTop) {\n                                // If we are scrolled, don't select anything that is\n                                // in the fade region\n                                childrenTop += this.getVerticalFadingEdgeLength();\n                            }\n                        }\n                        if (top >= childrenTop) {\n                            // Found a view whose top is fully visisble\n                            selectedPos = firstPosition + i;\n                            selectedTop = top;\n                            break;\n                        }\n                    }\n                } else {\n                    const itemCount:number = this.mItemCount;\n                    down = false;\n                    selectedPos = firstPosition + childCount - 1;\n                    for (let i:number = childCount - 1; i >= 0; i--) {\n                        const v:View = this.getChildAt(i);\n                        const top:number = v.getTop();\n                        const bottom:number = v.getBottom();\n                        if (i == childCount - 1) {\n                            selectedTop = top;\n                            if (firstPosition + childCount < itemCount || bottom > childrenBottom) {\n                                childrenBottom -= this.getVerticalFadingEdgeLength();\n                            }\n                        }\n                        if (bottom <= childrenBottom) {\n                            selectedPos = firstPosition + i;\n                            selectedTop = top;\n                            break;\n                        }\n                    }\n                }\n            }\n            this.mResurrectToPosition = AbsListView.INVALID_POSITION;\n            this.removeCallbacks(this.mFlingRunnable);\n            if (this.mPositionScroller != null) {\n                this.mPositionScroller.stop();\n            }\n            this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n            this.clearScrollingCache();\n            this.mSpecificTop = selectedTop;\n            selectedPos = this.lookForSelectablePosition(selectedPos, down);\n            if (selectedPos >= firstPosition && selectedPos <= this.getLastVisiblePosition()) {\n                this.mLayoutMode = AbsListView.LAYOUT_SPECIFIC;\n                this.updateSelectorState();\n                this.setSelectionInt(selectedPos);\n                this.invokeOnItemScrollListener();\n            } else {\n                selectedPos = AbsListView.INVALID_POSITION;\n            }\n            this.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_IDLE);\n            return selectedPos >= 0;\n        }\n\n        private confirmCheckedPositionsById():void {\n            // Clear out the positional check states, we'll rebuild it below from IDs.\n            this.mCheckStates.clear();\n            let checkedCountChanged:boolean = false;\n            for (let checkedIndex:number = 0; checkedIndex < this.mCheckedIdStates.size(); checkedIndex++) {\n                const id:number = this.mCheckedIdStates.keyAt(checkedIndex);\n                const lastPos:number = this.mCheckedIdStates.valueAt(checkedIndex);\n                const lastPosId:number = this.mAdapter.getItemId(lastPos);\n                if (id != lastPosId) {\n                    // Look around to see if the ID is nearby. If not, uncheck it.\n                    const start:number = Math.max(0, lastPos - AbsListView.CHECK_POSITION_SEARCH_DISTANCE);\n                    const end:number = Math.min(lastPos + AbsListView.CHECK_POSITION_SEARCH_DISTANCE, this.mItemCount);\n                    let found:boolean = false;\n                    for (let searchPos:number = start; searchPos < end; searchPos++) {\n                        const searchId:number = this.mAdapter.getItemId(searchPos);\n                        if (id == searchId) {\n                            found = true;\n                            this.mCheckStates.put(searchPos, true);\n                            this.mCheckedIdStates.setValueAt(checkedIndex, searchPos);\n                            break;\n                        }\n                    }\n                    if (!found) {\n                        this.mCheckedIdStates.delete(id);\n                        checkedIndex--;\n                        this.mCheckedItemCount--;\n                        checkedCountChanged = true;\n                        //if (this.mChoiceActionMode != null && this.mMultiChoiceModeCallback != null) {\n                        //    this.mMultiChoiceModeCallback.onItemCheckedStateChanged(this.mChoiceActionMode, lastPos, id, false);\n                        //}\n                    }\n                } else {\n                    this.mCheckStates.put(lastPos, true);\n                }\n            }\n            if (checkedCountChanged && this.mChoiceActionMode != null) {\n                this.mChoiceActionMode.invalidate();\n            }\n        }\n\n        handleDataChanged():void {\n            let count:number = this.mItemCount;\n            let lastHandledItemCount:number = this.mLastHandledItemCount;\n            this.mLastHandledItemCount = this.mItemCount;\n            if (this.mChoiceMode != AbsListView.CHOICE_MODE_NONE && this.mAdapter != null && this.mAdapter.hasStableIds()) {\n                this.confirmCheckedPositionsById();\n            }\n            // TODO: In the future we can recycle these views based on stable ID instead.\n            this.mRecycler.clearTransientStateViews();\n            if (count > 0) {\n                let newPos:number;\n                let selectablePos:number;\n                // Find the row we are supposed to sync to\n                if (this.mNeedSync) {\n                    // Update this first, since setNextSelectedPositionInt inspects it\n                    this.mNeedSync = false;\n                    this.mPendingSync = null;\n                    if (this.mTranscriptMode == AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL) {\n                        this.mLayoutMode = AbsListView.LAYOUT_FORCE_BOTTOM;\n                        return;\n                    } else if (this.mTranscriptMode == AbsListView.TRANSCRIPT_MODE_NORMAL) {\n                        if (this.mForceTranscriptScroll) {\n                            this.mForceTranscriptScroll = false;\n                            this.mLayoutMode = AbsListView.LAYOUT_FORCE_BOTTOM;\n                            return;\n                        }\n                        const childCount:number = this.getChildCount();\n                        const listBottom:number = this.getHeight() - this.getPaddingBottom();\n                        const lastChild:View = this.getChildAt(childCount - 1);\n                        const lastBottom:number = lastChild != null ? lastChild.getBottom() : listBottom;\n                        if (this.mFirstPosition + childCount >= lastHandledItemCount && lastBottom <= listBottom) {\n                            this.mLayoutMode = AbsListView.LAYOUT_FORCE_BOTTOM;\n                            return;\n                        }\n                        // Something new came in and we didn't scroll; give the user a clue that\n                        // there's something new.\n                        this.awakenScrollBars();\n                    }\n                    switch (this.mSyncMode) {\n                        case AbsListView.SYNC_SELECTED_POSITION:\n                            if (this.isInTouchMode()) {\n                                // We saved our state when not in touch mode. (We know this because\n                                // mSyncMode is SYNC_SELECTED_POSITION.) Now we are trying to\n                                // restore in touch mode. Just leave mSyncPosition as it is (possibly\n                                // adjusting if the available range changed) and return.\n                                this.mLayoutMode = AbsListView.LAYOUT_SYNC;\n                                this.mSyncPosition = Math.min(Math.max(0, this.mSyncPosition), count - 1);\n                                return;\n                            } else {\n                                // See if we can find a position in the new data with the same\n                                // id as the old selection. This will change mSyncPosition.\n                                newPos = this.findSyncPosition();\n                                if (newPos >= 0) {\n                                    // Found it. Now verify that new selection is still selectable\n                                    selectablePos = this.lookForSelectablePosition(newPos, true);\n                                    if (selectablePos == newPos) {\n                                        // Same row id is selected\n                                        this.mSyncPosition = newPos;\n                                        if (this.mSyncHeight == this.getHeight()) {\n                                            // If we are at the same height as when we saved state, try\n                                            // to restore the scroll position too.\n                                            this.mLayoutMode = AbsListView.LAYOUT_SYNC;\n                                        } else {\n                                            // We are not the same height as when the selection was saved, so\n                                            // don't try to restore the exact position\n                                            this.mLayoutMode = AbsListView.LAYOUT_SET_SELECTION;\n                                        }\n                                        // Restore selection\n                                        this.setNextSelectedPositionInt(newPos);\n                                        return;\n                                    }\n                                }\n                            }\n                            break;\n                        case AbsListView.SYNC_FIRST_POSITION:\n                            // Leave mSyncPosition as it is -- just pin to available range\n                            this.mLayoutMode = AbsListView.LAYOUT_SYNC;\n                            this.mSyncPosition = Math.min(Math.max(0, this.mSyncPosition), count - 1);\n                            return;\n                    }\n                }\n                if (!this.isInTouchMode()) {\n                    // We couldn't find matching data -- try to use the same position\n                    newPos = this.getSelectedItemPosition();\n                    // Pin position to the available range\n                    if (newPos >= count) {\n                        newPos = count - 1;\n                    }\n                    if (newPos < 0) {\n                        newPos = 0;\n                    }\n                    // Make sure we select something selectable -- first look down\n                    selectablePos = this.lookForSelectablePosition(newPos, true);\n                    if (selectablePos >= 0) {\n                        this.setNextSelectedPositionInt(selectablePos);\n                        return;\n                    } else {\n                        // Looking down didn't work -- try looking up\n                        selectablePos = this.lookForSelectablePosition(newPos, false);\n                        if (selectablePos >= 0) {\n                            this.setNextSelectedPositionInt(selectablePos);\n                            return;\n                        }\n                    }\n                } else {\n                    // We already know where we want to resurrect the selection\n                    if (this.mResurrectToPosition >= 0) {\n                        return;\n                    }\n                }\n            }\n            // Nothing is selected. Give up and reset everything.\n            this.mLayoutMode = this.mStackFromBottom ? AbsListView.LAYOUT_FORCE_BOTTOM : AbsListView.LAYOUT_FORCE_TOP;\n            this.mSelectedPosition = AbsListView.INVALID_POSITION;\n            this.mSelectedRowId = AbsListView.INVALID_ROW_ID;\n            this.mNextSelectedPosition = AbsListView.INVALID_POSITION;\n            this.mNextSelectedRowId = AbsListView.INVALID_ROW_ID;\n            this.mNeedSync = false;\n            this.mPendingSync = null;\n            this.mSelectorPosition = AbsListView.INVALID_POSITION;\n            this.checkSelectionChanged();\n        }\n\n        onDisplayHint(hint:number):void {\n            super.onDisplayHint(hint);\n            //switch (hint) {\n            //    case AbsListView.INVISIBLE:\n            //        if (this.mPopup != null && this.mPopup.isShowing()) {\n            //            this.dismissPopup();\n            //        }\n            //        break;\n            //    case AbsListView.VISIBLE:\n            //        if (this.mFiltered && this.mPopup != null && !this.mPopup.isShowing()) {\n            //            this.showPopup();\n            //        }\n            //        break;\n            //}\n            this.mPopupHidden = hint == AbsListView.INVISIBLE;\n        }\n\n        /**\n         * Removes the filter window\n         */\n        private dismissPopup():void {\n            //if (this.mPopup != null) {\n            //    this.mPopup.dismiss();\n            //}\n        }\n\n        /**\n         * Shows the filter window\n         */\n        private showPopup():void {\n            // Make sure we have a window before showing the popup\n            //if (this.getWindowVisibility() == View.VISIBLE) {\n            //    this.createTextFilter(true);\n            //    this.positionPopup();\n            //    // Make sure we get focus if we are showing the popup\n            //    this.checkFocus();\n            //}\n        }\n\n        private positionPopup():void {\n            //let screenHeight:number = Resources.getDisplayMetrics().heightPixels;\n            //const xy:number[] = [2];\n            //this.getLocationOnScreen(xy);\n            //// TODO: The 20 below should come from the theme\n            //// TODO: And the gravity should be defined in the theme as well\n            //const bottomGap:number = screenHeight - xy[1] - this.getHeight() + Math.floor((this.mDensityScale * 20));\n            //if (!this.mPopup.isShowing()) {\n            //    this.mPopup.showAtLocation(this, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, xy[0], bottomGap);\n            //} else {\n            //    this.mPopup.update(xy[0], bottomGap, -1, -1);\n            //}\n        }\n\n        /**\n         * What is the distance between the source and destination rectangles given the direction of\n         * focus navigation between them? The direction basically helps figure out more quickly what is\n         * self evident by the relationship between the rects...\n         *\n         * @param source the source rectangle\n         * @param dest the destination rectangle\n         * @param direction the direction\n         * @return the distance between the rectangles\n         */\n        static getDistance(source:Rect, dest:Rect, direction:number):number {\n            // source x, y\n            let sX:number, sY:number;\n            // dest x, y\n            let dX:number, dY:number;\n            switch (direction) {\n                case View.FOCUS_RIGHT:\n                    sX = source.right;\n                    sY = source.top + source.height() / 2;\n                    dX = dest.left;\n                    dY = dest.top + dest.height() / 2;\n                    break;\n                case View.FOCUS_DOWN:\n                    sX = source.left + source.width() / 2;\n                    sY = source.bottom;\n                    dX = dest.left + dest.width() / 2;\n                    dY = dest.top;\n                    break;\n                case View.FOCUS_LEFT:\n                    sX = source.left;\n                    sY = source.top + source.height() / 2;\n                    dX = dest.right;\n                    dY = dest.top + dest.height() / 2;\n                    break;\n                case View.FOCUS_UP:\n                    sX = source.left + source.width() / 2;\n                    sY = source.top;\n                    dX = dest.left + dest.width() / 2;\n                    dY = dest.bottom;\n                    break;\n                case View.FOCUS_FORWARD:\n                case View.FOCUS_BACKWARD:\n                    sX = source.right + source.width() / 2;\n                    sY = source.top + source.height() / 2;\n                    dX = dest.left + dest.width() / 2;\n                    dY = dest.top + dest.height() / 2;\n                    break;\n                default:\n                    throw Error(`new IllegalArgumentException(\"direction must be one of \" + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, \" + \"FOCUS_FORWARD, FOCUS_BACKWARD}.\")`);\n            }\n            let deltaX:number = dX - sX;\n            let deltaY:number = dY - sY;\n            return deltaY * deltaY + deltaX * deltaX;\n        }\n\n        isInFilterMode():boolean {\n            return this.mFiltered;\n        }\n\n        /**\n         * Sends a key to the text filter window\n         *\n         * @param keyCode The keycode for the event\n         * @param event The actual key event\n         *\n         * @return True if the text filter handled the event, false otherwise.\n         */\n        //private sendToTextFilter(keyCode:number, count:number, event:KeyEvent):boolean {\n        //    if (!this.acceptFilter()) {\n        //        return false;\n        //    }\n        //    let handled:boolean = false;\n        //    let okToSend:boolean = true;\n        //    switch (keyCode) {\n        //        case KeyEvent.KEYCODE_DPAD_UP:\n        //        case KeyEvent.KEYCODE_DPAD_DOWN:\n        //        case KeyEvent.KEYCODE_DPAD_LEFT:\n        //        case KeyEvent.KEYCODE_DPAD_RIGHT:\n        //        case KeyEvent.KEYCODE_DPAD_CENTER:\n        //        case KeyEvent.KEYCODE_ENTER:\n        //            okToSend = false;\n        //            break;\n        //        case KeyEvent.KEYCODE_BACK:\n        //            if (this.mFiltered && this.mPopup != null && this.mPopup.isShowing()) {\n        //                if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {\n        //                    let state:KeyEvent.DispatcherState = this.getKeyDispatcherState();\n        //                    if (state != null) {\n        //                        state.startTracking(event, this);\n        //                    }\n        //                    handled = true;\n        //                } else if (event.getAction() == KeyEvent.ACTION_UP && event.isTracking() && !event.isCanceled()) {\n        //                    handled = true;\n        //                    this.mTextFilter.setText(\"\");\n        //                }\n        //            }\n        //            okToSend = false;\n        //            break;\n        //        case KeyEvent.KEYCODE_SPACE:\n        //            // Only send spaces once we are filtered\n        //            okToSend = this.mFiltered;\n        //            break;\n        //    }\n        //    if (okToSend) {\n        //        this.createTextFilter(true);\n        //        let forwardEvent:KeyEvent = event;\n        //        if (forwardEvent.getRepeatCount() > 0) {\n        //            forwardEvent = KeyEvent.changeTimeRepeat(event, event.getEventTime(), 0);\n        //        }\n        //        let action:number = event.getAction();\n        //        switch (action) {\n        //            case KeyEvent.ACTION_DOWN:\n        //                handled = this.mTextFilter.onKeyDown(keyCode, forwardEvent);\n        //                break;\n        //            case KeyEvent.ACTION_UP:\n        //                handled = this.mTextFilter.onKeyUp(keyCode, forwardEvent);\n        //                break;\n        //            case KeyEvent.ACTION_MULTIPLE:\n        //                handled = this.mTextFilter.onKeyMultiple(keyCode, count, event);\n        //                break;\n        //        }\n        //    }\n        //    return handled;\n        //}\n        //\n        ///**\n        // * Return an InputConnection for editing of the filter text.\n        // */\n        //onCreateInputConnection(outAttrs:EditorInfo):InputConnection {\n        //    if (this.isTextFilterEnabled()) {\n        //        if (this.mPublicInputConnection == null) {\n        //            this.mDefInputConnection = new BaseInputConnection(this, false);\n        //            this.mPublicInputConnection = new AbsListView.InputConnectionWrapper(outAttrs);\n        //        }\n        //        outAttrs.inputType = EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_FILTER;\n        //        outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE;\n        //        return this.mPublicInputConnection;\n        //    }\n        //    return null;\n        //}\n        //\n        //\n        ///**\n        // * For filtering we proxy an input connection to an internal text editor,\n        // * and this allows the proxying to happen.\n        // */\n        //checkInputConnectionProxy(view:View):boolean {\n        //    return view == this.mTextFilter;\n        //}\n        //\n        ///**\n        // * Creates the window for the text filter and populates it with an EditText field;\n        // *\n        // * @param animateEntrance true if the window should appear with an animation\n        // */\n        //private createTextFilter(animateEntrance:boolean):void {\n        //    if (this.mPopup == null) {\n        //        let p:PopupWindow = new PopupWindow(this.getContext());\n        //        p.setFocusable(false);\n        //        p.setTouchable(false);\n        //        p.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);\n        //        p.setContentView(this.getTextFilterInput());\n        //        p.setWidth(LayoutParams.WRAP_CONTENT);\n        //        p.setHeight(LayoutParams.WRAP_CONTENT);\n        //        p.setBackgroundDrawable(null);\n        //        this.mPopup = p;\n        //        this.getViewTreeObserver().addOnGlobalLayoutListener(this);\n        //        this.mGlobalLayoutListenerAddedFilter = true;\n        //    }\n        //    if (animateEntrance) {\n        //        this.mPopup.setAnimationStyle(com.android.internal.R.style.Animation_TypingFilter);\n        //    } else {\n        //        this.mPopup.setAnimationStyle(com.android.internal.R.style.Animation_TypingFilterRestore);\n        //    }\n        //}\n        //\n        //private getTextFilterInput():EditText {\n        //    if (this.mTextFilter == null) {\n        //        const layoutInflater:LayoutInflater = LayoutInflater.from(this.getContext());\n        //        this.mTextFilter = <EditText> layoutInflater.inflate(com.android.internal.R.layout.typing_filter, null);\n        //        // For some reason setting this as the \"real\" input type changes\n        //        // the text view in some way that it doesn't work, and I don't\n        //        // want to figure out why this is.\n        //        this.mTextFilter.setRawInputType(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_FILTER);\n        //        this.mTextFilter.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);\n        //        this.mTextFilter.addTextChangedListener(this);\n        //    }\n        //    return this.mTextFilter;\n        //}\n        //\n        ///**\n        // * Clear the text filter.\n        // */\n        //clearTextFilter():void {\n        //    if (this.mFiltered) {\n        //        this.getTextFilterInput().setText(\"\");\n        //        this.mFiltered = false;\n        //        if (this.mPopup != null && this.mPopup.isShowing()) {\n        //            this.dismissPopup();\n        //        }\n        //    }\n        //}\n        //\n        /**\n         * Returns if the ListView currently has a text filter.\n         */\n        hasTextFilter():boolean {\n            return this.mFiltered;\n        }\n\n        onGlobalLayout():void {\n            if (this.isShown()) {\n                // Show the popup if we are filtered\n                //if (this.mFiltered && this.mPopup != null && !this.mPopup.isShowing() && !this.mPopupHidden) {\n                //    this.showPopup();\n                //}\n            } else {\n                // Hide the popup when we are no longer visible\n                //if (this.mPopup != null && this.mPopup.isShowing()) {\n                //    this.dismissPopup();\n                //}\n            }\n        }\n        //\n        ///**\n        // * For our text watcher that is associated with the text filter.  Does\n        // * nothing.\n        // */\n        //beforeTextChanged(s:string, start:number, count:number, after:number):void {\n        //}\n        //\n        ///**\n        // * For our text watcher that is associated with the text filter. Performs\n        // * the actual filtering as the text changes, and takes care of hiding and\n        // * showing the popup displaying the currently entered filter text.\n        // */\n        //onTextChanged(s:string, start:number, before:number, count:number):void {\n        //    if (this.isTextFilterEnabled()) {\n        //        this.createTextFilter(true);\n        //        let length:number = s.length();\n        //        let showing:boolean = this.mPopup.isShowing();\n        //        if (!showing && length > 0) {\n        //            // Show the filter popup if necessary\n        //            this.showPopup();\n        //            this.mFiltered = true;\n        //        } else if (showing && length == 0) {\n        //            // Remove the filter popup if the user has cleared all text\n        //            this.dismissPopup();\n        //            this.mFiltered = false;\n        //        }\n        //        if (this.mAdapter instanceof Filterable) {\n        //            let f:Filter = (<Filterable> this.mAdapter).getFilter();\n        //            // Filter should not be null when we reach this part\n        //            if (f != null) {\n        //                f.filter(s, this);\n        //            } else {\n        //                throw Error(`new IllegalStateException(\"You cannot call onTextChanged with a non \" + \"filterable adapter\")`);\n        //            }\n        //        }\n        //    }\n        //}\n        //\n        ///**\n        // * For our text watcher that is associated with the text filter.  Does\n        // * nothing.\n        // */\n        //afterTextChanged(s):void {\n        //}\n        //\n        //onFilterComplete(count:number):void {\n        //    if (mSelectedPosition < 0 && count > 0) {\n        //        this.mResurrectToPosition = AbsListView.INVALID_POSITION;\n        //        this.resurrectSelection();\n        //    }\n        //}\n\n        protected generateDefaultLayoutParams():ViewGroup.LayoutParams {\n            return new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0);\n        }\n\n        protected generateLayoutParams(p:ViewGroup.LayoutParams):ViewGroup.LayoutParams {\n            return new AbsListView.LayoutParams(p);\n        }\n\n        generateLayoutParamsFromAttr(attrs:HTMLElement):ViewGroup.LayoutParams {\n           return new AbsListView.LayoutParams(this.getContext(), attrs);\n        }\n\n        protected checkLayoutParams(p:ViewGroup.LayoutParams):boolean {\n            return p instanceof AbsListView.LayoutParams;\n        }\n\n        /**\n         * Puts the list or grid into transcript mode. In this mode the list or grid will always scroll\n         * to the bottom to show new items.\n         *\n         * @param mode the transcript mode to set\n         *\n         * @see #TRANSCRIPT_MODE_DISABLED\n         * @see #TRANSCRIPT_MODE_NORMAL\n         * @see #TRANSCRIPT_MODE_ALWAYS_SCROLL\n         */\n        setTranscriptMode(mode:number):void {\n            this.mTranscriptMode = mode;\n        }\n\n        /**\n         * Returns the current transcript mode.\n         *\n         * @return {@link #TRANSCRIPT_MODE_DISABLED}, {@link #TRANSCRIPT_MODE_NORMAL} or\n         *         {@link #TRANSCRIPT_MODE_ALWAYS_SCROLL}\n         */\n        getTranscriptMode():number {\n            return this.mTranscriptMode;\n        }\n\n        getSolidColor():number {\n            return this.mCacheColorHint;\n        }\n\n        /**\n         * When set to a non-zero value, the cache color hint indicates that this list is always drawn\n         * on top of a solid, single-color, opaque background.\n         *\n         * Zero means that what's behind this object is translucent (non solid) or is not made of a\n         * single color. This hint will not affect any existing background drawable set on this view (\n         * typically set via {@link #setBackgroundDrawable(Drawable)}).\n         *\n         * @param color The background color\n         */\n        setCacheColorHint(color:number):void {\n            if (color != this.mCacheColorHint) {\n                this.mCacheColorHint = color;\n                let count:number = this.getChildCount();\n                for (let i:number = 0; i < count; i++) {\n                    this.getChildAt(i).setDrawingCacheBackgroundColor(color);\n                }\n                this.mRecycler.setCacheColorHint(color);\n            }\n        }\n\n        /**\n         * When set to a non-zero value, the cache color hint indicates that this list is always drawn\n         * on top of a solid, single-color, opaque background\n         *\n         * @return The cache color hint\n         */\n        getCacheColorHint():number {\n            return this.mCacheColorHint;\n        }\n\n        /**\n         * Move all views (excluding headers and footers) held by this AbsListView into the supplied\n         * List. This includes views displayed on the screen as well as views stored in AbsListView's\n         * internal view recycler.\n         *\n         * @param views A list into which to put the reclaimed views\n         */\n        reclaimViews(views:List<View>):void {\n            let childCount:number = this.getChildCount();\n            let listener:AbsListView.RecyclerListener = this.mRecycler.mRecyclerListener;\n            // Reclaim views on screen\n            for (let i:number = 0; i < childCount; i++) {\n                let child:View = this.getChildAt(i);\n                let lp:AbsListView.LayoutParams = <AbsListView.LayoutParams> child.getLayoutParams();\n                // Don't reclaim header or footer views, or views that should be ignored\n                if (lp != null && this.mRecycler.shouldRecycleViewType(lp.viewType)) {\n                    views.add(child);\n                    //child.setAccessibilityDelegate(null);\n                    if (listener != null) {\n                        // Pretend they went through the scrap heap\n                        listener.onMovedToScrapHeap(child);\n                    }\n                }\n            }\n            this.mRecycler.reclaimScrapViews(views);\n            this.removeAllViewsInLayout();\n        }\n\n        private finishGlows():void {\n            //if (this.mEdgeGlowTop != null) {\n            //    this.mEdgeGlowTop.finish();\n            //    this.mEdgeGlowBottom.finish();\n            //}\n        }\n\n        ///**\n        // * Sets up this AbsListView to use a remote views adapter which connects to a RemoteViewsService\n        // * through the specified intent.\n        // * @param intent the intent used to identify the RemoteViewsService for the adapter to connect to.\n        // */\n        //setRemoteViewsAdapter(intent:Intent):void {\n        //    // service handling the specified intent.\n        //    if (this.mRemoteAdapter != null) {\n        //        let fcNew:Intent.FilterComparison = new Intent.FilterComparison(intent);\n        //        let fcOld:Intent.FilterComparison = new Intent.FilterComparison(this.mRemoteAdapter.getRemoteViewsServiceIntent());\n        //        if (fcNew.equals(fcOld)) {\n        //            return;\n        //        }\n        //    }\n        //    this.mDeferNotifyDataSetChanged = false;\n        //    // Otherwise, create a new RemoteViewsAdapter for binding\n        //    this.mRemoteAdapter = new RemoteViewsAdapter(this.getContext(), intent, this);\n        //    if (this.mRemoteAdapter.isDataReady()) {\n        //        this.setAdapter(this.mRemoteAdapter);\n        //    }\n        //}\n        //\n        ///**\n        // * Sets up the onClickHandler to be used by the RemoteViewsAdapter when inflating RemoteViews\n        // *\n        // * @param handler The OnClickHandler to use when inflating RemoteViews.\n        // *\n        // * @hide\n        // */\n        //setRemoteViewsOnClickHandler(handler:OnClickHandler):void {\n        //    // service handling the specified intent.\n        //    if (this.mRemoteAdapter != null) {\n        //        this.mRemoteAdapter.setRemoteViewsOnClickHandler(handler);\n        //    }\n        //}\n        //\n        ///**\n        // * This defers a notifyDataSetChanged on the pending RemoteViewsAdapter if it has not\n        // * connected yet.\n        // */\n        //deferNotifyDataSetChanged():void {\n        //    this.mDeferNotifyDataSetChanged = true;\n        //}\n        //\n        ///**\n        // * Called back when the adapter connects to the RemoteViewsService.\n        // */\n        //onRemoteAdapterConnected():boolean {\n        //    if (this.mRemoteAdapter != this.mAdapter) {\n        //        this.setAdapter(this.mRemoteAdapter);\n        //        if (this.mDeferNotifyDataSetChanged) {\n        //            this.mRemoteAdapter.notifyDataSetChanged();\n        //            this.mDeferNotifyDataSetChanged = false;\n        //        }\n        //        return false;\n        //    } else if (this.mRemoteAdapter != null) {\n        //        this.mRemoteAdapter.superNotifyDataSetChanged();\n        //        return true;\n        //    }\n        //    return false;\n        //}\n        //\n        ///**\n        // * Called back when the adapter disconnects from the RemoteViewsService.\n        // */\n        //onRemoteAdapterDisconnected():void {\n        //    // If the remote adapter disconnects, we keep it around\n        //    // since the currently displayed items are still cached.\n        //    // Further, we want the service to eventually reconnect\n        //    // when necessary, as triggered by this view requesting\n        //    // items from the Adapter.\n        //}\n        //\n        ///**\n        // * Hints the RemoteViewsAdapter, if it exists, about which views are currently\n        // * being displayed by the AbsListView.\n        // */\n        setVisibleRangeHint(start:number, end:number):void {\n            //if (this.mRemoteAdapter != null) {\n            //    this.mRemoteAdapter.setVisibleRangeHint(start, end);\n            //}\n        }\n\n        /**\n         * Sets the recycler listener to be notified whenever a View is set aside in\n         * the recycler for later reuse. This listener can be used to free resources\n         * associated to the View.\n         *\n         * @param listener The recycler listener to be notified of views set aside\n         *        in the recycler.\n         *\n         * @see android.widget.AbsListView.RecycleBin\n         * @see android.widget.AbsListView.RecyclerListener\n         */\n        setRecyclerListener(listener:AbsListView.RecyclerListener):void {\n            this.mRecycler.mRecyclerListener = listener;\n        }\n\n\n        static retrieveFromScrap(scrapViews:ArrayList<View>, position:number):View {\n            let size:number = scrapViews.size();\n            if (size > 0) {\n                // See if we still have a view for this position.\n                for (let i:number = 0; i < size; i++) {\n                    let view:View = scrapViews.get(i);\n                    if ((<AbsListView.LayoutParams> view.getLayoutParams()).scrappedFromPosition == position) {\n                        scrapViews.remove(i);\n                        return view;\n                    }\n                }\n                return scrapViews.remove(size - 1);\n            } else {\n                return null;\n            }\n        }\n    }\n\n    export module AbsListView {\n        /**\n         * Interface definition for a callback to be invoked when the list or grid\n         * has been scrolled.\n         */\n        export interface OnScrollListener {\n\n            /**\n             * Callback method to be invoked while the list view or grid view is being scrolled. If the\n             * view is being scrolled, this method will be called before the next frame of the scroll is\n             * rendered. In particular, it will be called before any calls to\n             * {@link Adapter#getView(int, View, ViewGroup)}.\n             *\n             * @param view The view whose scroll state is being reported\n             *\n             * @param scrollState The current scroll state. One of {@link #SCROLL_STATE_IDLE},\n             * {@link #SCROLL_STATE_TOUCH_SCROLL} or {@link #SCROLL_STATE_IDLE}.\n             */\n            onScrollStateChanged(view:AbsListView, scrollState:number):void ;\n\n            /**\n             * Callback method to be invoked when the list or grid has been scrolled. This will be\n             * called after the scroll has completed\n             * @param view The view whose scroll state is being reported\n             * @param firstVisibleItem the index of the first visible cell (ignore if\n             *        visibleItemCount == 0)\n             * @param visibleItemCount the number of visible cells\n             * @param totalItemCount the number of items in the list adaptor\n             */\n            onScroll(view:AbsListView, firstVisibleItem:number, visibleItemCount:number, totalItemCount:number):void ;\n        }\n        export module OnScrollListener {\n            /**\n             * The view is not scrolling. Note navigating the list using the trackball counts as\n             * being in the idle state since these transitions are not animated.\n             */\n            export var SCROLL_STATE_IDLE:number = 0;\n\n            /**\n             * The user is scrolling using touch, and their finger is still on the screen\n             */\n            export var SCROLL_STATE_TOUCH_SCROLL:number = 1;\n\n            /**\n             * The user had previously been scrolling using touch and had performed a fling. The\n             * animation is now coasting to a stop\n             */\n            export var SCROLL_STATE_FLING:number = 2;\n        }\n        /**\n         * The top-level view of a list item can implement this interface to allow\n         * itself to modify the bounds of the selection shown for that item.\n         */\n        export interface SelectionBoundsAdjuster {\n\n            /**\n             * Called to allow the list item to adjust the bounds shown for\n             * its selection.\n             *\n             * @param bounds On call, this contains the bounds the list has\n             * selected for the item (that is the bounds of the entire view).  The\n             * values can be modified as desired.\n             */\n            adjustListItemSelectionBounds(bounds:Rect):void ;\n        }\n        /**\n         * A base class for Runnables that will check that their view is still attached to\n         * the original window as when the Runnable was created.\n         *\n         */\n        export class WindowRunnnable {\n            _AbsListView_this:AbsListView;\n\n            constructor(arg:AbsListView) {\n                this._AbsListView_this = arg;\n            }\n\n            private mOriginalAttachCount:number;\n\n            rememberWindowAttachCount():void {\n                this.mOriginalAttachCount = this._AbsListView_this.getWindowAttachCount();\n            }\n\n            sameWindow():boolean {\n                return this._AbsListView_this.getWindowAttachCount() == this.mOriginalAttachCount;\n            }\n        }\n        export class PerformClick extends AbsListView.WindowRunnnable implements Runnable {\n            _AbsListView_this:AbsListView;\n\n            constructor(arg:AbsListView) {\n                super(arg);\n                this._AbsListView_this = arg;\n            }\n\n            mClickMotionPosition:number = 0;\n\n            run():void {\n                // bail out before bad things happen\n                if (this._AbsListView_this.mDataChanged)\n                    return;\n                const adapter:ListAdapter = this._AbsListView_this.mAdapter;\n                const motionPosition:number = this.mClickMotionPosition;\n                if (adapter != null && this._AbsListView_this.mItemCount > 0 && motionPosition != AbsListView.INVALID_POSITION\n                    && motionPosition < adapter.getCount() && this.sameWindow()) {\n                    const view:View = this._AbsListView_this.getChildAt(motionPosition - this._AbsListView_this.mFirstPosition);\n                    // screen, etc.) and we should cancel the click\n                    if (view != null) {\n                        this._AbsListView_this.performItemClick(view, motionPosition, adapter.getItemId(motionPosition));\n                    }\n                }\n            }\n        }\n        export class CheckForLongPress extends AbsListView.WindowRunnnable implements Runnable {\n            _AbsListView_this:AbsListView;\n\n            constructor(arg:AbsListView) {\n                super(arg);\n                this._AbsListView_this = arg;\n            }\n\n            run():void {\n                const motionPosition:number = this._AbsListView_this.mMotionPosition;\n                const child:View = this._AbsListView_this.getChildAt(motionPosition - this._AbsListView_this.mFirstPosition);\n                if (child != null) {\n                    const longPressPosition:number = this._AbsListView_this.mMotionPosition;\n                    const longPressId:number = this._AbsListView_this.mAdapter.getItemId(this._AbsListView_this.mMotionPosition);\n                    let handled:boolean = false;\n                    if (this.sameWindow() && !this._AbsListView_this.mDataChanged) {\n                        handled = this._AbsListView_this.performLongPress(child, longPressPosition, longPressId);\n                    }\n                    if (handled) {\n                        this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                        this._AbsListView_this.setPressed(false);\n                        child.setPressed(false);\n                    } else {\n                        this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_DONE_WAITING;\n                    }\n                }\n            }\n        }\n        export class CheckForKeyLongPress extends AbsListView.WindowRunnnable implements Runnable {\n            _AbsListView_this:AbsListView;\n\n            constructor(arg:AbsListView) {\n                super(arg);\n                this._AbsListView_this = arg;\n            }\n\n            run():void {\n                if (this._AbsListView_this.isPressed() && this._AbsListView_this.mSelectedPosition >= 0) {\n                    let index:number = this._AbsListView_this.mSelectedPosition - this._AbsListView_this.mFirstPosition;\n                    let v:View = this._AbsListView_this.getChildAt(index);\n                    if (!this._AbsListView_this.mDataChanged) {\n                        let handled:boolean = false;\n                        if (this.sameWindow()) {\n                            handled = this._AbsListView_this.performLongPress(v,\n                                this._AbsListView_this.mSelectedPosition, this._AbsListView_this.mSelectedRowId);\n                        }\n                        if (handled) {\n                            this._AbsListView_this.setPressed(false);\n                            v.setPressed(false);\n                        }\n                    } else {\n                        this._AbsListView_this.setPressed(false);\n                        if (v != null)\n                            v.setPressed(false);\n                    }\n                }\n            }\n        }\n        export class CheckForTap implements Runnable {\n            _AbsListView_this:AbsListView;\n\n            constructor(arg:AbsListView) {\n                this._AbsListView_this = arg;\n            }\n\n            run():void {\n                if (this._AbsListView_this.mTouchMode == AbsListView.TOUCH_MODE_DOWN) {\n                    this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_TAP;\n                    const child:View = this._AbsListView_this.getChildAt(\n                        this._AbsListView_this.mMotionPosition - this._AbsListView_this.mFirstPosition);\n                    if (child != null && !child.hasFocusable()) {\n                        this._AbsListView_this.mLayoutMode = AbsListView.LAYOUT_NORMAL;\n                        if (!this._AbsListView_this.mDataChanged) {\n                            child.setPressed(true);\n                            this._AbsListView_this.setPressed(true);\n                            this._AbsListView_this.layoutChildren();\n                            this._AbsListView_this.positionSelector(this._AbsListView_this.mMotionPosition, child);\n                            this._AbsListView_this.refreshDrawableState();\n                            const longPressTimeout:number = ViewConfiguration.getLongPressTimeout();\n                            const longClickable:boolean = this._AbsListView_this.isLongClickable();\n                            if (this._AbsListView_this.mSelector != null) {\n                                let d:Drawable = this._AbsListView_this.mSelector.getCurrent();\n                                //TODO when transition drawable impl\n                                //if (d != null && d instanceof TransitionDrawable) {\n                                //    if (longClickable) {\n                                //        (<TransitionDrawable> d).startTransition(longPressTimeout);\n                                //    } else {\n                                //        (<TransitionDrawable> d).resetTransition();\n                                //    }\n                                //}\n                            }\n                            if (longClickable) {\n                                if (this._AbsListView_this.mPendingCheckForLongPress_List == null) {\n                                    this._AbsListView_this.mPendingCheckForLongPress_List = new AbsListView.CheckForLongPress(this._AbsListView_this);\n                                }\n                                this._AbsListView_this.mPendingCheckForLongPress_List.rememberWindowAttachCount();\n                                this._AbsListView_this.postDelayed(this._AbsListView_this.mPendingCheckForLongPress_List, longPressTimeout);\n                            } else {\n                                this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_DONE_WAITING;\n                            }\n                        } else {\n                            this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_DONE_WAITING;\n                        }\n                    }\n                }\n            }\n        }\n        /**\n         * Responsible for fling behavior. Use {@link #start(int)} to\n         * initiate a fling. Each frame of the fling is handled in {@link #run()}.\n         * A FlingRunnable will keep re-posting itself until the fling is done.\n         *\n         */\n        export class FlingRunnable implements Runnable {\n            _AbsListView_this:AbsListView;\n\n            constructor(arg:AbsListView) {\n                this._AbsListView_this = arg;\n                this.mScroller = new OverScroller();\n            }\n\n            /**\n             * Tracks the decay of a fling scroll\n             */\n            mScroller:OverScroller;\n\n            /**\n             * Y value reported by mScroller on the previous fling\n             */\n            private mLastFlingY:number = 0;\n\n            private mCheckFlywheel:Runnable = (()=> {\n                const inner_this = this;\n                class _Inner implements Runnable {\n\n                    run():void {\n                        const activeId:number = inner_this._AbsListView_this.mActivePointerId;\n                        const vt:VelocityTracker = inner_this._AbsListView_this.mVelocityTracker;\n                        const scroller:OverScroller = inner_this.mScroller;\n                        if (vt == null || activeId == AbsListView.INVALID_POINTER) {\n                            return;\n                        }\n                        vt.computeCurrentVelocity(1000, inner_this._AbsListView_this.mMaximumVelocity);\n                        const yvel:number = -vt.getYVelocity(activeId);\n                        if (Math.abs(yvel) >= inner_this._AbsListView_this.mMinimumVelocity && scroller.isScrollingInDirection(0, yvel)) {\n                            // Keep the fling alive a little longer\n                            inner_this._AbsListView_this.postDelayed(inner_this, FlingRunnable.FLYWHEEL_TIMEOUT);\n                        } else {\n                            inner_this.endFling();\n                            inner_this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_SCROLL;\n                            inner_this._AbsListView_this.reportScrollStateChange(OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);\n                        }\n                    }\n                }\n                return new _Inner();\n            })();\n\n            // milliseconds\n            static FLYWHEEL_TIMEOUT:number = 40;\n\n            start(initialVelocity:number):void {\n                let initialY:number = initialVelocity < 0 ? Integer.MAX_VALUE : 0;\n                this.mLastFlingY = initialY;\n                this.mScroller.setInterpolator(null);\n                this.mScroller.fling(0, initialY, 0, initialVelocity, 0, Integer.MAX_VALUE, 0, Integer.MAX_VALUE);\n                this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_FLING;\n                this._AbsListView_this.postOnAnimation(this);\n                if (AbsListView.PROFILE_FLINGING) {\n                    if (!this._AbsListView_this.mFlingProfilingStarted) {\n                        //Debug.startMethodTracing(\"AbsListViewFling\");\n                        this._AbsListView_this.mFlingProfilingStarted = true;\n                    }\n                }\n                //if (this._AbsListView_this.mFlingStrictSpan == null) {\n                //    this._AbsListView_this.mFlingStrictSpan = StrictMode.enterCriticalSpan(\"AbsListView-fling\");\n                //}\n            }\n\n            startSpringback():void {\n                if (this.mScroller.springBack(0, this._AbsListView_this.mScrollY, 0, 0, 0, 0)) {\n                    this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_OVERFLING;\n                    this._AbsListView_this.invalidate();\n                    this._AbsListView_this.postOnAnimation(this);\n                } else {\n                    this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                    this._AbsListView_this.reportScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);\n                }\n            }\n\n            startOverfling(initialVelocity:number):void {\n                this.mScroller.setInterpolator(null);\n\n                let minY = Integer.MIN_VALUE, maxY = Integer.MAX_VALUE;\n                if(this._AbsListView_this.mScrollY < 0) minY = 0;\n                else if(this._AbsListView_this.mScrollY > 0) maxY = 0;\n\n                this.mScroller.fling(0, this._AbsListView_this.mScrollY, 0, initialVelocity, 0, 0, minY, maxY, 0, this._AbsListView_this.getHeight());\n                this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_OVERFLING;\n                this._AbsListView_this.invalidate();\n                this._AbsListView_this.postOnAnimation(this);\n            }\n\n            private edgeReached(delta:number):void {\n                this.mScroller.notifyVerticalEdgeReached(this._AbsListView_this.mScrollY, 0, this._AbsListView_this.mOverflingDistance);\n                const overscrollMode:number = this._AbsListView_this.getOverScrollMode();\n                if (overscrollMode == AbsListView.OVER_SCROLL_ALWAYS || (overscrollMode == AbsListView.OVER_SCROLL_IF_CONTENT_SCROLLS && !this._AbsListView_this.contentFits())) {\n                    this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_OVERFLING;\n                    //const vel:number = Math.floor(this.mScroller.getCurrVelocity());\n                    //if (delta > 0) {\n                    //    this._AbsListView_this.mEdgeGlowTop.onAbsorb(vel);\n                    //} else {\n                    //    this._AbsListView_this.mEdgeGlowBottom.onAbsorb(vel);\n                    //}\n                } else {\n                    this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                    if (this._AbsListView_this.mPositionScroller != null) {\n                        this._AbsListView_this.mPositionScroller.stop();\n                    }\n                }\n                this._AbsListView_this.invalidate();\n                this._AbsListView_this.postOnAnimation(this);\n            }\n\n            startScroll(distance:number, duration:number, linear:boolean):void {\n                let initialY:number = distance < 0 ? Integer.MAX_VALUE : 0;\n                this.mLastFlingY = initialY;\n                this.mScroller.setInterpolator(linear ? AbsListView.sLinearInterpolator : null);\n                this.mScroller.startScroll(0, initialY, 0, distance, duration);\n                this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_FLING;\n                this._AbsListView_this.postOnAnimation(this);\n            }\n\n            endFling():void {\n                this._AbsListView_this.mTouchMode = AbsListView.TOUCH_MODE_REST;\n                this._AbsListView_this.removeCallbacks(this);\n                this._AbsListView_this.removeCallbacks(this.mCheckFlywheel);\n                this._AbsListView_this.reportScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);\n                this._AbsListView_this.clearScrollingCache();\n                this.mScroller.abortAnimation();\n                //if (this._AbsListView_this.mFlingStrictSpan != null) {\n                //    this._AbsListView_this.mFlingStrictSpan.finish();\n                //    this._AbsListView_this.mFlingStrictSpan = null;\n                //}\n            }\n\n            flywheelTouch():void {\n                this._AbsListView_this.postDelayed(this.mCheckFlywheel, FlingRunnable.FLYWHEEL_TIMEOUT);\n            }\n\n            run():void {\n                switch (this._AbsListView_this.mTouchMode) {\n                    default:\n                        this.endFling();\n                        return;\n                    case AbsListView.TOUCH_MODE_SCROLL:\n                        if (this.mScroller.isFinished()) {\n                            return;\n                        }\n                    // Fall through\n                    case AbsListView.TOUCH_MODE_FLING:\n                    {\n                        if (this._AbsListView_this.mDataChanged) {\n                            this._AbsListView_this.layoutChildren();\n                        }\n                        if (this._AbsListView_this.mItemCount == 0 || this._AbsListView_this.getChildCount() == 0) {\n                            this.endFling();\n                            return;\n                        }\n                        const scroller:OverScroller = this.mScroller;\n                        let more:boolean = scroller.computeScrollOffset();\n                        const y:number = scroller.getCurrY();\n                        // Flip sign to convert finger direction to list items direction\n                        // (e.g. finger moving down means list is moving towards the top)\n                        let delta:number = this.mLastFlingY - y;\n                        // Pretend that each frame of a fling scroll is a touch scroll\n                        if (delta > 0) {\n                            // List is moving towards the top. Use first view as mMotionPosition\n                            this._AbsListView_this.mMotionPosition = this._AbsListView_this.mFirstPosition;\n                            const firstView:View = this._AbsListView_this.getChildAt(0);\n                            this._AbsListView_this.mMotionViewOriginalTop = firstView.getTop();\n                            // Don't fling more than 1 screen\n                            delta = Math.min(this._AbsListView_this.getHeight() - this._AbsListView_this.mPaddingBottom - this._AbsListView_this.mPaddingTop - 1, delta);\n                        } else {\n                            // List is moving towards the bottom. Use last view as mMotionPosition\n                            let offsetToLast:number = this._AbsListView_this.getChildCount() - 1;\n                            this._AbsListView_this.mMotionPosition = this._AbsListView_this.mFirstPosition + offsetToLast;\n                            const lastView:View = this._AbsListView_this.getChildAt(offsetToLast);\n                            this._AbsListView_this.mMotionViewOriginalTop = lastView.getTop();\n                            // Don't fling more than 1 screen\n                            delta = Math.max(-(this._AbsListView_this.getHeight() - this._AbsListView_this.mPaddingBottom - this._AbsListView_this.mPaddingTop - 1), delta);\n                        }\n                        // Check to see if we have bumped into the scroll limit\n                        let motionView:View = this._AbsListView_this.getChildAt(this._AbsListView_this.mMotionPosition - this._AbsListView_this.mFirstPosition);\n                        let oldTop:number = 0;\n                        if (motionView != null) {\n                            oldTop = motionView.getTop();\n                        }\n                        // Don't stop just because delta is zero (it could have been rounded)\n                        const atEdge:boolean = this._AbsListView_this.trackMotionScroll(delta, delta);\n                        const atEnd:boolean = atEdge && (delta != 0);\n                        if (atEnd) {\n                            if (motionView != null) {\n                                // Tweak the scroll for how far we overshot\n                                let overshoot:number = -(delta - (motionView.getTop() - oldTop));\n                                this._AbsListView_this.overScrollBy(0, overshoot, 0, this._AbsListView_this.mScrollY, 0, 0, 0, this._AbsListView_this.mOverflingDistance, false);\n                            }\n                            if (more) {\n                                this.edgeReached(delta);\n                            }\n                            break;\n                        }\n                        if (more && !atEnd) {\n                            if (atEdge)\n                                this._AbsListView_this.invalidate();\n                            this.mLastFlingY = y;\n                            this._AbsListView_this.postOnAnimation(this);\n                        } else {\n                            this.endFling();\n                            if (AbsListView.PROFILE_FLINGING) {\n                                if (this._AbsListView_this.mFlingProfilingStarted) {\n                                    //Debug.stopMethodTracing();\n                                    this._AbsListView_this.mFlingProfilingStarted = false;\n                                }\n                                //if (this._AbsListView_this.mFlingStrictSpan != null) {\n                                //    this._AbsListView_this.mFlingStrictSpan.finish();\n                                //    this._AbsListView_this.mFlingStrictSpan = null;\n                                //}\n                            }\n                        }\n                        break;\n                    }\n                    case AbsListView.TOUCH_MODE_OVERFLING:\n                    {\n                        const scroller:OverScroller = this.mScroller;\n                        if (scroller.computeScrollOffset()) {\n                            const scrollY:number = this._AbsListView_this.mScrollY;\n                            const currY:number = scroller.getCurrY();\n                            let deltaY:number = currY - scrollY;\n\n                            //fix android bug: check cross scroll here, not in overScrollBy, it always false.\n                            const crossDown:boolean = scrollY <= 0 && currY > 0;\n                            const crossUp:boolean = scrollY >= 0 && currY < 0;\n                            if (crossDown || crossUp) {\n                                let velocity:number = Math.floor(scroller.getCurrVelocity());\n                                if (crossUp) velocity = -velocity;\n                                // Don't flywheel from this; we're just continuing things.\n                                scroller.abortAnimation();\n                                this.start(velocity);\n                                deltaY = -scrollY;\n                            }\n\n\n                            if (this._AbsListView_this.overScrollBy(0, deltaY, 0, scrollY, 0, 0, 0, this._AbsListView_this.mOverflingDistance, false)) {\n                                //const crossDown:boolean = scrollY <= 0 && currY > 0;\n                                //const crossUp:boolean = scrollY >= 0 && currY < 0;\n                                //if (crossDown || crossUp) {\n                                //    let velocity:number = Math.floor(scroller.getCurrVelocity());\n                                //    if (crossUp)\n                                //        velocity = -velocity;\n                                //    // Don't flywheel from this; we're just continuing things.\n                                //    scroller.abortAnimation();\n                                //    this.start(velocity);\n                                //} else {\n                                    this.startSpringback();\n                                //}\n                            } else {\n                                this._AbsListView_this.invalidate();\n                                this._AbsListView_this.postOnAnimation(this);\n                            }\n                        } else {\n                            this.endFling();\n                        }\n                        break;\n                    }\n                }\n            }\n        }\n        export class PositionScroller implements Runnable {\n            _AbsListView_this:AbsListView;\n\n            constructor(arg:AbsListView) {\n                this._AbsListView_this = arg;\n                this.mExtraScroll = ViewConfiguration.get().getScaledFadingEdgeLength();\n            }\n\n            private static SCROLL_DURATION:number = 200;\n\n            private static MOVE_DOWN_POS:number = 1;\n\n            private static MOVE_UP_POS:number = 2;\n\n            private static MOVE_DOWN_BOUND:number = 3;\n\n            private static MOVE_UP_BOUND:number = 4;\n\n            private static MOVE_OFFSET:number = 5;\n\n            private mMode:number = 0;\n\n            private mTargetPos:number = 0;\n\n            private mBoundPos:number = 0;\n\n            private mLastSeenPos:number = 0;\n\n            private mScrollDuration:number = 0;\n\n            private mExtraScroll:number = 0;\n\n            private mOffsetFromTop:number = 0;\n\n            start(position:number, boundPosition?:number):void{\n                if(boundPosition==null) this._start_1(position);\n                else this._start_2(position, boundPosition);\n            }\n            private _start_1(position:number):void {\n                this.stop();\n                if (this._AbsListView_this.mDataChanged) {\n                    // Wait until we're back in a stable state to try this.\n                    this._AbsListView_this.mPositionScrollAfterLayout = (()=> {\n                        const inner_this = this;\n                        class _Inner implements Runnable {\n\n                            run():void {\n                                inner_this.start(position);\n                            }\n                        }\n                        return new _Inner();\n                    })();\n                    return;\n                }\n                const childCount:number = this._AbsListView_this.getChildCount();\n                if (childCount == 0) {\n                    // Can't scroll without children.\n                    return;\n                }\n                const firstPos:number = this._AbsListView_this.mFirstPosition;\n                const lastPos:number = firstPos + childCount - 1;\n                let viewTravelCount:number;\n                let clampedPosition:number = Math.max(0, Math.min(this._AbsListView_this.getCount() - 1, position));\n                if (clampedPosition < firstPos) {\n                    viewTravelCount = firstPos - clampedPosition + 1;\n                    this.mMode = PositionScroller.MOVE_UP_POS;\n                } else if (clampedPosition > lastPos) {\n                    viewTravelCount = clampedPosition - lastPos + 1;\n                    this.mMode = PositionScroller.MOVE_DOWN_POS;\n                } else {\n                    this.scrollToVisible(clampedPosition, AbsListView.INVALID_POSITION, PositionScroller.SCROLL_DURATION);\n                    return;\n                }\n                if (viewTravelCount > 0) {\n                    this.mScrollDuration = PositionScroller.SCROLL_DURATION / viewTravelCount;\n                } else {\n                    this.mScrollDuration = PositionScroller.SCROLL_DURATION;\n                }\n                this.mTargetPos = clampedPosition;\n                this.mBoundPos = AbsListView.INVALID_POSITION;\n                this.mLastSeenPos = AbsListView.INVALID_POSITION;\n                this._AbsListView_this.postOnAnimation(this);\n            }\n\n            private _start_2(position:number, boundPosition:number):void {\n                this.stop();\n                if (boundPosition == AbsListView.INVALID_POSITION) {\n                    this.start(position);\n                    return;\n                }\n                if (this._AbsListView_this.mDataChanged) {\n                    // Wait until we're back in a stable state to try this.\n                    this._AbsListView_this.mPositionScrollAfterLayout = (()=> {\n                        const inner_this = this;\n                        class _Inner implements Runnable {\n\n                            run():void {\n                                inner_this.start(position, boundPosition);\n                            }\n                        }\n                        return new _Inner();\n                    })();\n                    return;\n                }\n                const childCount:number = this._AbsListView_this.getChildCount();\n                if (childCount == 0) {\n                    // Can't scroll without children.\n                    return;\n                }\n                const firstPos:number = this._AbsListView_this.mFirstPosition;\n                const lastPos:number = firstPos + childCount - 1;\n                let viewTravelCount:number;\n                let clampedPosition:number = Math.max(0, Math.min(this._AbsListView_this.getCount() - 1, position));\n                if (clampedPosition < firstPos) {\n                    const boundPosFromLast:number = lastPos - boundPosition;\n                    if (boundPosFromLast < 1) {\n                        // Moving would shift our bound position off the screen. Abort.\n                        return;\n                    }\n                    const posTravel:number = firstPos - clampedPosition + 1;\n                    const boundTravel:number = boundPosFromLast - 1;\n                    if (boundTravel < posTravel) {\n                        viewTravelCount = boundTravel;\n                        this.mMode = PositionScroller.MOVE_UP_BOUND;\n                    } else {\n                        viewTravelCount = posTravel;\n                        this.mMode = PositionScroller.MOVE_UP_POS;\n                    }\n                } else if (clampedPosition > lastPos) {\n                    const boundPosFromFirst:number = boundPosition - firstPos;\n                    if (boundPosFromFirst < 1) {\n                        // Moving would shift our bound position off the screen. Abort.\n                        return;\n                    }\n                    const posTravel:number = clampedPosition - lastPos + 1;\n                    const boundTravel:number = boundPosFromFirst - 1;\n                    if (boundTravel < posTravel) {\n                        viewTravelCount = boundTravel;\n                        this.mMode = PositionScroller.MOVE_DOWN_BOUND;\n                    } else {\n                        viewTravelCount = posTravel;\n                        this.mMode = PositionScroller.MOVE_DOWN_POS;\n                    }\n                } else {\n                    this.scrollToVisible(clampedPosition, boundPosition, PositionScroller.SCROLL_DURATION);\n                    return;\n                }\n                if (viewTravelCount > 0) {\n                    this.mScrollDuration = PositionScroller.SCROLL_DURATION / viewTravelCount;\n                } else {\n                    this.mScrollDuration = PositionScroller.SCROLL_DURATION;\n                }\n                this.mTargetPos = clampedPosition;\n                this.mBoundPos = boundPosition;\n                this.mLastSeenPos = AbsListView.INVALID_POSITION;\n                this._AbsListView_this.postOnAnimation(this);\n            }\n\n            startWithOffset(position:number, offset:number, duration:number = PositionScroller.SCROLL_DURATION):void {\n                this.stop();\n                if (this._AbsListView_this.mDataChanged) {\n                    // Wait until we're back in a stable state to try this.\n                    const postOffset:number = offset;\n                    this._AbsListView_this.mPositionScrollAfterLayout = (()=> {\n                        const inner_this = this;\n                        class _Inner implements Runnable {\n\n                            run():void {\n                                inner_this.startWithOffset(position, postOffset, duration);\n                            }\n                        }\n                        return new _Inner();\n                    })();\n                    return;\n                }\n                const childCount:number = this._AbsListView_this.getChildCount();\n                if (childCount == 0) {\n                    // Can't scroll without children.\n                    return;\n                }\n                offset += this._AbsListView_this.getPaddingTop();\n                this.mTargetPos = Math.max(0, Math.min(this._AbsListView_this.getCount() - 1, position));\n                this.mOffsetFromTop = offset;\n                this.mBoundPos = AbsListView.INVALID_POSITION;\n                this.mLastSeenPos = AbsListView.INVALID_POSITION;\n                this.mMode = PositionScroller.MOVE_OFFSET;\n                const firstPos:number = this._AbsListView_this.mFirstPosition;\n                const lastPos:number = firstPos + childCount - 1;\n                let viewTravelCount:number;\n                if (this.mTargetPos < firstPos) {\n                    viewTravelCount = firstPos - this.mTargetPos;\n                } else if (this.mTargetPos > lastPos) {\n                    viewTravelCount = this.mTargetPos - lastPos;\n                } else {\n                    // On-screen, just scroll.\n                    const targetTop:number = this._AbsListView_this.getChildAt(this.mTargetPos - firstPos).getTop();\n                    this._AbsListView_this.smoothScrollBy(targetTop - offset, duration, true);\n                    return;\n                }\n                // Estimate how many screens we should travel\n                const screenTravelCount:number = <number> viewTravelCount / childCount;\n                this.mScrollDuration = screenTravelCount < 1 ? duration : Math.floor((duration / screenTravelCount));\n                this.mLastSeenPos = AbsListView.INVALID_POSITION;\n                this._AbsListView_this.postOnAnimation(this);\n            }\n\n            /**\n             * Scroll such that targetPos is in the visible padded region without scrolling\n             * boundPos out of view. Assumes targetPos is onscreen.\n             */\n            private scrollToVisible(targetPos:number, boundPos:number, duration:number):void {\n                const firstPos:number = this._AbsListView_this.mFirstPosition;\n                const childCount:number = this._AbsListView_this.getChildCount();\n                const lastPos:number = firstPos + childCount - 1;\n                const paddedTop:number = this._AbsListView_this.mListPadding.top;\n                const paddedBottom:number = this._AbsListView_this.getHeight() - this._AbsListView_this.mListPadding.bottom;\n                if (targetPos < firstPos || targetPos > lastPos) {\n                    Log.w(AbsListView.TAG_AbsListView, \"scrollToVisible called with targetPos \" + targetPos + \" not visible [\" + firstPos + \", \" + lastPos + \"]\");\n                }\n                if (boundPos < firstPos || boundPos > lastPos) {\n                    // boundPos doesn't matter, it's already offscreen.\n                    boundPos = AbsListView.INVALID_POSITION;\n                }\n                const targetChild:View = this._AbsListView_this.getChildAt(targetPos - firstPos);\n                const targetTop:number = targetChild.getTop();\n                const targetBottom:number = targetChild.getBottom();\n                let scrollBy:number = 0;\n                if (targetBottom > paddedBottom) {\n                    scrollBy = targetBottom - paddedBottom;\n                }\n                if (targetTop < paddedTop) {\n                    scrollBy = targetTop - paddedTop;\n                }\n                if (scrollBy == 0) {\n                    return;\n                }\n                if (boundPos >= 0) {\n                    const boundChild:View = this._AbsListView_this.getChildAt(boundPos - firstPos);\n                    const boundTop:number = boundChild.getTop();\n                    const boundBottom:number = boundChild.getBottom();\n                    const absScroll:number = Math.abs(scrollBy);\n                    if (scrollBy < 0 && boundBottom + absScroll > paddedBottom) {\n                        // Don't scroll the bound view off the bottom of the screen.\n                        scrollBy = Math.max(0, boundBottom - paddedBottom);\n                    } else if (scrollBy > 0 && boundTop - absScroll < paddedTop) {\n                        // Don't scroll the bound view off the top of the screen.\n                        scrollBy = Math.min(0, boundTop - paddedTop);\n                    }\n                }\n                this._AbsListView_this.smoothScrollBy(scrollBy, duration);\n            }\n\n            stop():void {\n                this._AbsListView_this.removeCallbacks(this);\n            }\n\n            run():void {\n                const listHeight:number = this._AbsListView_this.getHeight();\n                const firstPos:number = this._AbsListView_this.mFirstPosition;\n                switch (this.mMode) {\n                    case PositionScroller.MOVE_DOWN_POS:\n                    {\n                        const lastViewIndex:number = this._AbsListView_this.getChildCount() - 1;\n                        const lastPos:number = firstPos + lastViewIndex;\n                        if (lastViewIndex < 0) {\n                            return;\n                        }\n                        if (lastPos == this.mLastSeenPos) {\n                            // No new views, let things keep going.\n                            this._AbsListView_this.postOnAnimation(this);\n                            return;\n                        }\n                        const lastView:View = this._AbsListView_this.getChildAt(lastViewIndex);\n                        const lastViewHeight:number = lastView.getHeight();\n                        const lastViewTop:number = lastView.getTop();\n                        const lastViewPixelsShowing:number = listHeight - lastViewTop;\n                        const extraScroll:number = lastPos < this._AbsListView_this.mItemCount - 1 ? Math.max(this._AbsListView_this.mListPadding.bottom, this.mExtraScroll) : this._AbsListView_this.mListPadding.bottom;\n                        const scrollBy:number = lastViewHeight - lastViewPixelsShowing + extraScroll;\n                        this._AbsListView_this.smoothScrollBy(scrollBy, this.mScrollDuration, true);\n                        this.mLastSeenPos = lastPos;\n                        if (lastPos < this.mTargetPos) {\n                            this._AbsListView_this.postOnAnimation(this);\n                        }\n                        break;\n                    }\n                    case PositionScroller.MOVE_DOWN_BOUND:\n                    {\n                        const nextViewIndex:number = 1;\n                        const childCount:number = this._AbsListView_this.getChildCount();\n                        if (firstPos == this.mBoundPos || childCount <= nextViewIndex || firstPos + childCount >= this._AbsListView_this.mItemCount) {\n                            return;\n                        }\n                        const nextPos:number = firstPos + nextViewIndex;\n                        if (nextPos == this.mLastSeenPos) {\n                            // No new views, let things keep going.\n                            this._AbsListView_this.postOnAnimation(this);\n                            return;\n                        }\n                        const nextView:View = this._AbsListView_this.getChildAt(nextViewIndex);\n                        const nextViewHeight:number = nextView.getHeight();\n                        const nextViewTop:number = nextView.getTop();\n                        const extraScroll:number = Math.max(this._AbsListView_this.mListPadding.bottom, this.mExtraScroll);\n                        if (nextPos < this.mBoundPos) {\n                            this._AbsListView_this.smoothScrollBy(Math.max(0, nextViewHeight + nextViewTop - extraScroll), this.mScrollDuration, true);\n                            this.mLastSeenPos = nextPos;\n                            this._AbsListView_this.postOnAnimation(this);\n                        } else {\n                            if (nextViewTop > extraScroll) {\n                                this._AbsListView_this.smoothScrollBy(nextViewTop - extraScroll, this.mScrollDuration, true);\n                            }\n                        }\n                        break;\n                    }\n                    case PositionScroller.MOVE_UP_POS:\n                    {\n                        if (firstPos == this.mLastSeenPos) {\n                            // No new views, let things keep going.\n                            this._AbsListView_this.postOnAnimation(this);\n                            return;\n                        }\n                        const firstView:View = this._AbsListView_this.getChildAt(0);\n                        if (firstView == null) {\n                            return;\n                        }\n                        const firstViewTop:number = firstView.getTop();\n                        const extraScroll:number = firstPos > 0 ? Math.max(this.mExtraScroll, this._AbsListView_this.mListPadding.top) : this._AbsListView_this.mListPadding.top;\n                        this._AbsListView_this.smoothScrollBy(firstViewTop - extraScroll, this.mScrollDuration, true);\n                        this.mLastSeenPos = firstPos;\n                        if (firstPos > this.mTargetPos) {\n                            this._AbsListView_this.postOnAnimation(this);\n                        }\n                        break;\n                    }\n                    case PositionScroller.MOVE_UP_BOUND:\n                    {\n                        const lastViewIndex:number = this._AbsListView_this.getChildCount() - 2;\n                        if (lastViewIndex < 0) {\n                            return;\n                        }\n                        const lastPos:number = firstPos + lastViewIndex;\n                        if (lastPos == this.mLastSeenPos) {\n                            // No new views, let things keep going.\n                            this._AbsListView_this.postOnAnimation(this);\n                            return;\n                        }\n                        const lastView:View = this._AbsListView_this.getChildAt(lastViewIndex);\n                        const lastViewHeight:number = lastView.getHeight();\n                        const lastViewTop:number = lastView.getTop();\n                        const lastViewPixelsShowing:number = listHeight - lastViewTop;\n                        const extraScroll:number = Math.max(this._AbsListView_this.mListPadding.top, this.mExtraScroll);\n                        this.mLastSeenPos = lastPos;\n                        if (lastPos > this.mBoundPos) {\n                            this._AbsListView_this.smoothScrollBy(-(lastViewPixelsShowing - extraScroll), this.mScrollDuration, true);\n                            this._AbsListView_this.postOnAnimation(this);\n                        } else {\n                            const bottom:number = listHeight - extraScroll;\n                            const lastViewBottom:number = lastViewTop + lastViewHeight;\n                            if (bottom > lastViewBottom) {\n                                this._AbsListView_this.smoothScrollBy(-(bottom - lastViewBottom), this.mScrollDuration, true);\n                            }\n                        }\n                        break;\n                    }\n                    case PositionScroller.MOVE_OFFSET:\n                    {\n                        if (this.mLastSeenPos == firstPos) {\n                            // No new views, let things keep going.\n                            this._AbsListView_this.postOnAnimation(this);\n                            return;\n                        }\n                        this.mLastSeenPos = firstPos;\n                        const childCount:number = this._AbsListView_this.getChildCount();\n                        const position:number = this.mTargetPos;\n                        const lastPos:number = firstPos + childCount - 1;\n                        let viewTravelCount:number = 0;\n                        if (position < firstPos) {\n                            viewTravelCount = firstPos - position + 1;\n                        } else if (position > lastPos) {\n                            viewTravelCount = position - lastPos;\n                        }\n                        // Estimate how many screens we should travel\n                        const screenTravelCount:number = <number> viewTravelCount / childCount;\n                        const modifier:number = Math.min(Math.abs(screenTravelCount), 1.);\n                        if (position < firstPos) {\n                            const distance:number = Math.floor((-this._AbsListView_this.getHeight() * modifier));\n                            const duration:number = Math.floor((this.mScrollDuration * modifier));\n                            this._AbsListView_this.smoothScrollBy(distance, duration, true);\n                            this._AbsListView_this.postOnAnimation(this);\n                        } else if (position > lastPos) {\n                            const distance:number = Math.floor((this._AbsListView_this.getHeight() * modifier));\n                            const duration:number = Math.floor((this.mScrollDuration * modifier));\n                            this._AbsListView_this.smoothScrollBy(distance, duration, true);\n                            this._AbsListView_this.postOnAnimation(this);\n                        } else {\n                            // On-screen, just scroll.\n                            const targetTop:number = this._AbsListView_this.getChildAt(position - firstPos).getTop();\n                            const distance:number = targetTop - this.mOffsetFromTop;\n                            const duration:number = Math.floor((this.mScrollDuration * (<number> Math.abs(distance) / this._AbsListView_this.getHeight())));\n                            this._AbsListView_this.smoothScrollBy(distance, duration, true);\n                        }\n                        break;\n                    }\n                    default:\n                        break;\n                }\n            }\n        }\n        export class AdapterDataSetObserver extends AdapterView.AdapterDataSetObserver {\n            _AbsListView_this:AbsListView;\n\n            constructor(arg:any) {\n                super(arg);\n                this._AbsListView_this = arg;\n            }\n\n            onChanged():void {\n                super.onChanged();\n                //TODO when fast scroller impl\n                //if (this._AbsListView_this.mFastScroller != null) {\n                //    this._AbsListView_this.mFastScroller.onSectionsChanged();\n                //}\n            }\n\n            onInvalidated():void {\n                super.onInvalidated();\n                //TODO when fast scroller impl\n                //if (this._AbsListView_this.mFastScroller != null) {\n                //    this._AbsListView_this.mFastScroller.onSectionsChanged();\n                //}\n            }\n        }\n\n        /**\n         * AbsListView extends LayoutParams to provide a place to hold the view type.\n         */\n        export class LayoutParams extends ViewGroup.LayoutParams {\n\n            /**\n             * View type for this view, as returned by\n             * {@link android.widget.Adapter#getItemViewType(int) }\n             */\n            viewType:number = 0;\n\n            /**\n             * When this boolean is set, the view has been added to the AbsListView\n             * at least once. It is used to know whether headers/footers have already\n             * been added to the list view and whether they should be treated as\n             * recycled views or not.\n             */\n            recycledHeaderFooter:boolean;\n\n            /**\n             * When an AbsListView is measured with an AT_MOST measure spec, it needs\n             * to obtain children views to measure itself. When doing so, the children\n             * are not attached to the window, but put in the recycler which assumes\n             * they've been attached before. Setting this flag will force the reused\n             * view to be attached to the window rather than just attached to the\n             * parent.\n             */\n            forceAdd:boolean;\n\n            /**\n             * The position the view was removed from when pulled out of the\n             * scrap heap.\n             * @hide\n             */\n            scrappedFromPosition:number = 0;\n\n            /**\n             * The ID the view represents\n             */\n            itemId:number = -1;\n\n            constructor(context:android.content.Context, attrs:HTMLElement);\n            constructor(w:number, h:number);\n            constructor(w:number, h:number, viewType:number);\n            constructor(source:ViewGroup.LayoutParams);\n            constructor(...args){\n                super(...(() => {\n                    if (args[0] instanceof android.content.Context && args[1] instanceof HTMLElement) return [args[0], args[1]];\n                    else if (typeof args[0] === 'number' && typeof args[1] === 'number' && typeof args[2] === 'number') return [args[0], args[1]];\n                    else if (typeof args[0] === 'number' && typeof args[1] === 'number') return [args[0], args[1]];\n                    else if (args[0] instanceof ViewGroup.LayoutParams) return [args[0]];\n                })());\n                if (args[0] instanceof android.content.Context && args[1] instanceof HTMLElement) {\n                } else if (typeof args[0] === 'number' && typeof args[1] === 'number' && typeof args[2] == 'number') {\n                    this.viewType = args[2];\n                } else if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n                } else if (args[0] instanceof ViewGroup.LayoutParams) {\n                }\n            }\n        }\n        /**\n         * A RecyclerListener is used to receive a notification whenever a View is placed\n         * inside the RecycleBin's scrap heap. This listener is used to free resources\n         * associated to Views placed in the RecycleBin.\n         *\n         * @see android.widget.AbsListView.RecycleBin\n         * @see android.widget.AbsListView#setRecyclerListener(android.widget.AbsListView.RecyclerListener)\n         */\n        export interface RecyclerListener {\n\n            /**\n             * Indicates that the specified View was moved into the recycler's scrap heap.\n             * The view is not displayed on screen any more and any expensive resource\n             * associated with the view should be discarded.\n             *\n             * @param view\n             */\n            onMovedToScrapHeap(view:View):void ;\n        }\n        /**\n         * The RecycleBin facilitates reuse of views across layouts. The RecycleBin has two levels of\n         * storage: ActiveViews and ScrapViews. ActiveViews are those views which were onscreen at the\n         * start of a layout. By construction, they are displaying current information. At the end of\n         * layout, all views in ActiveViews are demoted to ScrapViews. ScrapViews are old views that\n         * could potentially be used by the adapter to avoid allocating views unnecessarily.\n         *\n         * @see android.widget.AbsListView#setRecyclerListener(android.widget.AbsListView.RecyclerListener)\n         * @see android.widget.AbsListView.RecyclerListener\n         */\n        export class RecycleBin {\n            _AbsListView_this:AbsListView;\n\n            constructor(arg:AbsListView) {\n                this._AbsListView_this = arg;\n            }\n\n            mRecyclerListener:AbsListView.RecyclerListener;\n\n            /**\n             * The position of the first view stored in mActiveViews.\n             */\n            private mFirstActivePosition:number = 0;\n\n            /**\n             * Views that were on screen at the start of layout. This array is populated at the start of\n             * layout, and at the end of layout all view in mActiveViews are moved to mScrapViews.\n             * Views in mActiveViews represent a contiguous range of Views, with position of the first\n             * view store in mFirstActivePosition.\n             */\n            mActiveViews:View[] = [];\n\n            /**\n             * Unsorted views that can be used by the adapter as a convert view.\n             */\n            private mScrapViews:ArrayList<View>[];\n\n            private mViewTypeCount:number = 0;\n\n            private mCurrentScrap:ArrayList<View>;\n\n            private mSkippedScrap:ArrayList<View>;\n\n            private mTransientStateViews:SparseArray<View>;\n\n            private mTransientStateViewsById:LongSparseArray<View>;\n\n            setViewTypeCount(viewTypeCount:number):void {\n                if (viewTypeCount < 1) {\n                    throw Error(`new IllegalArgumentException(\"Can't have a viewTypeCount < 1\")`);\n                }\n                //noinspection unchecked\n                let scrapViews:ArrayList<View>[] = new Array<ArrayList<View>>(viewTypeCount);\n                for (let i:number = 0; i < viewTypeCount; i++) {\n                    scrapViews[i] = new ArrayList<View>();\n                }\n                this.mViewTypeCount = viewTypeCount;\n                this.mCurrentScrap = scrapViews[0];\n                this.mScrapViews = scrapViews;\n            }\n\n            markChildrenDirty():void {\n                if (this.mViewTypeCount == 1) {\n                    const scrap:ArrayList<View> = this.mCurrentScrap;\n                    const scrapCount:number = scrap.size();\n                    for (let i:number = 0; i < scrapCount; i++) {\n                        scrap.get(i).forceLayout();\n                    }\n                } else {\n                    const typeCount:number = this.mViewTypeCount;\n                    for (let i:number = 0; i < typeCount; i++) {\n                        const scrap:ArrayList<View> = this.mScrapViews[i];\n                        const scrapCount:number = scrap.size();\n                        for (let j:number = 0; j < scrapCount; j++) {\n                            scrap.get(j).forceLayout();\n                        }\n                    }\n                }\n                if (this.mTransientStateViews != null) {\n                    const count:number = this.mTransientStateViews.size();\n                    for (let i:number = 0; i < count; i++) {\n                        this.mTransientStateViews.valueAt(i).forceLayout();\n                    }\n                }\n                if (this.mTransientStateViewsById != null) {\n                    const count:number = this.mTransientStateViewsById.size();\n                    for (let i:number = 0; i < count; i++) {\n                        this.mTransientStateViewsById.valueAt(i).forceLayout();\n                    }\n                }\n            }\n\n            shouldRecycleViewType(viewType:number):boolean {\n                return viewType >= 0;\n            }\n\n            /**\n             * Clears the scrap heap.\n             */\n            clear():void {\n                if (this.mViewTypeCount == 1) {\n                    const scrap:ArrayList<View> = this.mCurrentScrap;\n                    const scrapCount:number = scrap.size();\n                    for (let i:number = 0; i < scrapCount; i++) {\n                        this._AbsListView_this.removeDetachedView(scrap.remove(scrapCount - 1 - i), false);\n                    }\n                } else {\n                    const typeCount:number = this.mViewTypeCount;\n                    for (let i:number = 0; i < typeCount; i++) {\n                        const scrap:ArrayList<View> = this.mScrapViews[i];\n                        const scrapCount:number = scrap.size();\n                        for (let j:number = 0; j < scrapCount; j++) {\n                            this._AbsListView_this.removeDetachedView(scrap.remove(scrapCount - 1 - j), false);\n                        }\n                    }\n                }\n                if (this.mTransientStateViews != null) {\n                    this.mTransientStateViews.clear();\n                }\n                if (this.mTransientStateViewsById != null) {\n                    this.mTransientStateViewsById.clear();\n                }\n            }\n\n            /**\n             * Fill ActiveViews with all of the children of the AbsListView.\n             *\n             * @param childCount The minimum number of views mActiveViews should hold\n             * @param firstActivePosition The position of the first view that will be stored in\n             *        mActiveViews\n             */\n            fillActiveViews(childCount:number, firstActivePosition:number):void {\n                if (this.mActiveViews.length < childCount) {\n                    this.mActiveViews = new Array<View>(childCount);\n                }\n                this.mFirstActivePosition = firstActivePosition;\n                //noinspection MismatchedReadAndWriteOfArray\n                const activeViews:View[] = this.mActiveViews;\n                for (let i:number = 0; i < childCount; i++) {\n                    let child:View = this._AbsListView_this.getChildAt(i);\n                    let lp:AbsListView.LayoutParams = <AbsListView.LayoutParams> child.getLayoutParams();\n                    // Don't put header or footer views into the scrap heap\n                    if (lp != null && lp.viewType != AbsListView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER) {\n                        // Note:  We do place AdapterView.ITEM_VIEW_TYPE_IGNORE in active views.\n                        //        However, we will NOT place them into scrap views.\n                        activeViews[i] = child;\n                    }\n                }\n            }\n\n            /**\n             * Get the view corresponding to the specified position. The view will be removed from\n             * mActiveViews if it is found.\n             *\n             * @param position The position to look up in mActiveViews\n             * @return The view if it is found, null otherwise\n             */\n            getActiveView(position:number):View {\n                let index:number = position - this.mFirstActivePosition;\n                const activeViews:View[] = this.mActiveViews;\n                if (index >= 0 && index < activeViews.length) {\n                    const match:View = activeViews[index];\n                    activeViews[index] = null;\n                    return match;\n                }\n                return null;\n            }\n\n            getTransientStateView(position:number):View {\n                if (this._AbsListView_this.mAdapter != null && this._AbsListView_this.mAdapterHasStableIds && this.mTransientStateViewsById != null) {\n                    let id:number = this._AbsListView_this.mAdapter.getItemId(position);\n                    let result:View = this.mTransientStateViewsById.get(id);\n                    this.mTransientStateViewsById.remove(id);\n                    return result;\n                }\n                if (this.mTransientStateViews != null) {\n                    const index:number = this.mTransientStateViews.indexOfKey(position);\n                    if (index >= 0) {\n                        let result:View = this.mTransientStateViews.valueAt(index);\n                        this.mTransientStateViews.removeAt(index);\n                        return result;\n                    }\n                }\n                return null;\n            }\n\n            /**\n             * Dump any currently saved views with transient state.\n             */\n            clearTransientStateViews():void {\n                if (this.mTransientStateViews != null) {\n                    this.mTransientStateViews.clear();\n                }\n                if (this.mTransientStateViewsById != null) {\n                    this.mTransientStateViewsById.clear();\n                }\n            }\n\n            /**\n             * @return A view from the ScrapViews collection. These are unordered.\n             */\n            getScrapView(position:number):View {\n                if (this.mViewTypeCount == 1) {\n                    return AbsListView.retrieveFromScrap(this.mCurrentScrap, position);\n                } else {\n                    let whichScrap:number = this._AbsListView_this.mAdapter.getItemViewType(position);\n                    if (whichScrap >= 0 && whichScrap < this.mScrapViews.length) {\n                        return AbsListView.retrieveFromScrap(this.mScrapViews[whichScrap], position);\n                    }\n                }\n                return null;\n            }\n\n            /**\n             * Puts a view into the list of scrap views.\n             * <p>\n             * If the list data hasn't changed or the adapter has stable IDs, views\n             * with transient state will be preserved for later retrieval.\n             *\n             * @param scrap The view to add\n             * @param position The view's position within its parent\n             */\n            addScrapView(scrap:View, position:number):void {\n                const lp:AbsListView.LayoutParams = <AbsListView.LayoutParams> scrap.getLayoutParams();\n                if (lp == null) {\n                    return;\n                }\n                lp.scrappedFromPosition = position;\n                // Remove but don't scrap header or footer views, or views that\n                // should otherwise not be recycled.\n                const viewType:number = lp.viewType;\n                if (!this.shouldRecycleViewType(viewType)) {\n                    return;\n                }\n                scrap.dispatchStartTemporaryDetach();\n\n                // The the accessibility state of the view may change while temporary\n                // detached and we do not allow detached views to fire accessibility\n                // events. So we are announcing that the subtree changed giving a chance\n                // to clients holding on to a view in this subtree to refresh it.\n                //this._AbsListView_this.notifyViewAccessibilityStateChangedIfNeeded(AccessibilityEvent.CONTENT_CHANGE_TYPE_SUBTREE);\n\n                // Don't scrap views that have transient state.\n                const scrapHasTransientState:boolean = scrap.hasTransientState();\n                if (scrapHasTransientState) {\n                    if (this._AbsListView_this.mAdapter != null && this._AbsListView_this.mAdapterHasStableIds) {\n                        // the same data.\n                        if (this.mTransientStateViewsById == null) {\n                            this.mTransientStateViewsById = new LongSparseArray<View>();\n                        }\n                        this.mTransientStateViewsById.put(lp.itemId, scrap);\n                    } else if (!this._AbsListView_this.mDataChanged) {\n                        // their old positions.\n                        if (this.mTransientStateViews == null) {\n                            this.mTransientStateViews = new SparseArray<View>();\n                        }\n                        this.mTransientStateViews.put(position, scrap);\n                    } else {\n                        // Otherwise, we'll have to remove the view and start over.\n                        if (this.mSkippedScrap == null) {\n                            this.mSkippedScrap = new ArrayList<View>();\n                        }\n                        this.mSkippedScrap.add(scrap);\n                    }\n                } else {\n                    if (this.mViewTypeCount == 1) {\n                        this.mCurrentScrap.add(scrap);\n                    } else {\n                        this.mScrapViews[viewType].add(scrap);\n                    }\n                    // Clear any system-managed transient state.\n                    //if (scrap.isAccessibilityFocused()) {\n                    //    scrap.clearAccessibilityFocus();\n                    //}\n                    //scrap.setAccessibilityDelegate(null);\n                    if (this.mRecyclerListener != null) {\n                        this.mRecyclerListener.onMovedToScrapHeap(scrap);\n                    }\n                }\n            }\n\n            /**\n             * Finish the removal of any views that skipped the scrap heap.\n             */\n            removeSkippedScrap():void {\n                if (this.mSkippedScrap == null) {\n                    return;\n                }\n                const count:number = this.mSkippedScrap.size();\n                for (let i:number = 0; i < count; i++) {\n                    this._AbsListView_this.removeDetachedView(this.mSkippedScrap.get(i), false);\n                }\n                this.mSkippedScrap.clear();\n            }\n\n            /**\n             * Move all views remaining in mActiveViews to mScrapViews.\n             */\n            scrapActiveViews():void {\n                const activeViews:View[] = this.mActiveViews;\n                const hasListener:boolean = this.mRecyclerListener != null;\n                const multipleScraps:boolean = this.mViewTypeCount > 1;\n                let scrapViews:ArrayList<View> = this.mCurrentScrap;\n                const count:number = activeViews.length;\n                for (let i:number = count - 1; i >= 0; i--) {\n                    const victim:View = activeViews[i];\n                    if (victim != null) {\n                        const lp:AbsListView.LayoutParams = <AbsListView.LayoutParams> victim.getLayoutParams();\n                        let whichScrap:number = lp.viewType;\n                        activeViews[i] = null;\n                        const scrapHasTransientState:boolean = victim.hasTransientState();\n                        if (!this.shouldRecycleViewType(whichScrap) || scrapHasTransientState) {\n                            // Do not move views that should be ignored\n                            if (whichScrap != AbsListView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER && scrapHasTransientState) {\n                                this._AbsListView_this.removeDetachedView(victim, false);\n                            }\n                            if (scrapHasTransientState) {\n                                if (this._AbsListView_this.mAdapter != null && this._AbsListView_this.mAdapterHasStableIds) {\n                                    if (this.mTransientStateViewsById == null) {\n                                        this.mTransientStateViewsById = new LongSparseArray<View>();\n                                    }\n                                    let id:number = this._AbsListView_this.mAdapter.getItemId(this.mFirstActivePosition + i);\n                                    this.mTransientStateViewsById.put(id, victim);\n                                } else {\n                                    if (this.mTransientStateViews == null) {\n                                        this.mTransientStateViews = new SparseArray<View>();\n                                    }\n                                    this.mTransientStateViews.put(this.mFirstActivePosition + i, victim);\n                                }\n                            }\n                            continue;\n                        }\n                        if (multipleScraps) {\n                            scrapViews = this.mScrapViews[whichScrap];\n                        }\n                        victim.dispatchStartTemporaryDetach();\n                        lp.scrappedFromPosition = this.mFirstActivePosition + i;\n                        scrapViews.add(victim);\n                        //victim.setAccessibilityDelegate(null);\n                        if (hasListener) {\n                            this.mRecyclerListener.onMovedToScrapHeap(victim);\n                        }\n                    }\n                }\n                this.pruneScrapViews();\n            }\n\n            /**\n             * Makes sure that the size of mScrapViews does not exceed the size of mActiveViews.\n             * (This can happen if an adapter does not recycle its views).\n             */\n            private pruneScrapViews():void {\n                const maxViews:number = this.mActiveViews.length;\n                const viewTypeCount:number = this.mViewTypeCount;\n                const scrapViews:ArrayList<View>[] = this.mScrapViews;\n                for (let i:number = 0; i < viewTypeCount; ++i) {\n                    const scrapPile:ArrayList<View> = scrapViews[i];\n                    let size:number = scrapPile.size();\n                    const extras:number = size - maxViews;\n                    size--;\n                    for (let j:number = 0; j < extras; j++) {\n                        this._AbsListView_this.removeDetachedView(scrapPile.remove(size--), false);\n                    }\n                }\n                if (this.mTransientStateViews != null) {\n                    for (let i:number = 0; i < this.mTransientStateViews.size(); i++) {\n                        const v:View = this.mTransientStateViews.valueAt(i);\n                        if (!v.hasTransientState()) {\n                            this.mTransientStateViews.removeAt(i);\n                            i--;\n                        }\n                    }\n                }\n                if (this.mTransientStateViewsById != null) {\n                    for (let i:number = 0; i < this.mTransientStateViewsById.size(); i++) {\n                        const v:View = this.mTransientStateViewsById.valueAt(i);\n                        if (!v.hasTransientState()) {\n                            this.mTransientStateViewsById.removeAt(i);\n                            i--;\n                        }\n                    }\n                }\n            }\n\n            /**\n             * Puts all views in the scrap heap into the supplied list.\n             */\n            reclaimScrapViews(views:List<View>):void {\n                if (this.mViewTypeCount == 1) {\n                    views.addAll(this.mCurrentScrap);\n                } else {\n                    const viewTypeCount:number = this.mViewTypeCount;\n                    const scrapViews:ArrayList<View>[] = this.mScrapViews;\n                    for (let i:number = 0; i < viewTypeCount; ++i) {\n                        const scrapPile:ArrayList<View> = scrapViews[i];\n                        views.addAll(scrapPile);\n                    }\n                }\n            }\n\n            /**\n             * Updates the cache color hint of all known views.\n             *\n             * @param color The new cache color hint.\n             */\n            setCacheColorHint(color:number):void {\n                if (this.mViewTypeCount == 1) {\n                    const scrap:ArrayList<View> = this.mCurrentScrap;\n                    const scrapCount:number = scrap.size();\n                    for (let i:number = 0; i < scrapCount; i++) {\n                        scrap.get(i).setDrawingCacheBackgroundColor(color);\n                    }\n                } else {\n                    const typeCount:number = this.mViewTypeCount;\n                    for (let i:number = 0; i < typeCount; i++) {\n                        const scrap:ArrayList<View> = this.mScrapViews[i];\n                        const scrapCount:number = scrap.size();\n                        for (let j:number = 0; j < scrapCount; j++) {\n                            scrap.get(j).setDrawingCacheBackgroundColor(color);\n                        }\n                    }\n                }\n                // Just in case this is called during a layout pass\n                const activeViews:View[] = this.mActiveViews;\n                const count:number = activeViews.length;\n                for (let i:number = 0; i < count; ++i) {\n                    const victim:View = activeViews[i];\n                    if (victim != null) {\n                        victim.setDrawingCacheBackgroundColor(color);\n                    }\n                }\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "src/android/widget/AbsSeekBar.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../android/view/ViewConfiguration.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../android/widget/ProgressBar.ts\"/>\n\nmodule android.widget {\nimport Canvas = android.graphics.Canvas;\nimport Rect = android.graphics.Rect;\nimport Drawable = android.graphics.drawable.Drawable;\nimport KeyEvent = android.view.KeyEvent;\nimport MotionEvent = android.view.MotionEvent;\nimport ViewConfiguration = android.view.ViewConfiguration;\nimport Integer = java.lang.Integer;\nimport ProgressBar = android.widget.ProgressBar;\n    import AttrBinder = androidui.attr.AttrBinder;\n\nexport abstract class AbsSeekBar extends ProgressBar {\n\n    private mThumb:Drawable;\n\n    private mThumbOffset:number = 0;\n\n    /**\n     * On touch, this offset plus the scaled value from the position of the\n     * touch will form the progress value. Usually 0.\n     */\n    mTouchProgressOffset:number = 0;\n\n    /**\n     * Whether this is user seekable.\n     */\n    mIsUserSeekable:boolean = true;\n\n    /**\n     * On key presses (right or left), the amount to increment/decrement the\n     * progress.\n     */\n    private mKeyProgressIncrement:number = 1;\n\n    private static NO_ALPHA:number = 0xFF;\n\n    private mDisabledAlpha:number = 0;\n\n    private mTouchDownX:number = 0;\n\n    private mIsDragging:boolean;\n\n\n    constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n        super(context, bindElement, defStyle);\n\n        let a = context.obtainStyledAttributes(bindElement, defStyle);\n        const thumb = a.getDrawable('thumb');\n        this.setThumb(thumb); // will guess mThumbOffset if thumb != null...\n        // ...but allow layout to override this\n        const thumbOffset = a.getDimensionPixelOffset('thumbOffset', this.getThumbOffset());\n        this.setThumbOffset(thumbOffset);\n        a.recycle();\n\n        a = context.obtainStyledAttributes(bindElement, defStyle);\n        this.mDisabledAlpha = a.getFloat('disabledAlpha', 0.5);\n        a.recycle();\n    }\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder().set('thumb', {\n            setter(v:AbsSeekBar, value:any, attrBinder:AttrBinder) {\n                v.setThumb(attrBinder.parseDrawable(value));\n            }, getter(v:AbsSeekBar) {\n                return v.mThumb;\n            }\n        }).set('thumbOffset', {\n            setter(v:AbsSeekBar, value:any, attrBinder:AttrBinder) {\n                v.setThumbOffset(attrBinder.parseNumberPixelOffset(value));\n            }, getter(v:AbsSeekBar) {\n                return v.mThumbOffset;\n            }\n        }).set('disabledAlpha', {\n            setter(v:AbsSeekBar, value:any, attrBinder:AttrBinder) {\n                v.mDisabledAlpha = attrBinder.parseFloat(value, 0.5);\n            }, getter(v:AbsSeekBar) {\n                return v.mDisabledAlpha;\n            }\n        });\n    }\n\n    /**\n     * Sets the thumb that will be drawn at the end of the progress meter within the SeekBar.\n     * <p>\n     * If the thumb is a valid drawable (i.e. not null), half its width will be\n     * used as the new thumb offset (@see #setThumbOffset(int)).\n     * \n     * @param thumb Drawable representing the thumb\n     */\n    setThumb(thumb:Drawable):void  {\n        let needUpdate:boolean;\n        // drawable changed)\n        if (this.mThumb != null && thumb != this.mThumb) {\n            this.mThumb.setCallback(null);\n            needUpdate = true;\n        } else {\n            needUpdate = false;\n        }\n        if (thumb != null) {\n            thumb.setCallback(this);\n            //if (this.canResolveLayoutDirection()) {\n            //    thumb.setLayoutDirection(this.getLayoutDirection());\n            //}\n            // Assuming the thumb drawable is symmetric, set the thumb offset\n            // such that the thumb will hang halfway off either edge of the\n            // progress bar.\n            this.mThumbOffset = thumb.getIntrinsicWidth() / 2;\n            // If we're updating get the new states\n            if (needUpdate && (thumb.getIntrinsicWidth() != this.mThumb.getIntrinsicWidth() || thumb.getIntrinsicHeight() != this.mThumb.getIntrinsicHeight())) {\n                this.requestLayout();\n            }\n        }\n        this.mThumb = thumb;\n        this.invalidate();\n        if (needUpdate) {\n            this.updateThumbPos(this.getWidth(), this.getHeight());\n            if (thumb != null && thumb.isStateful()) {\n                // Note that if the states are different this won't work.\n                // For now, let's consider that an app bug.\n                let state:number[] = this.getDrawableState();\n                thumb.setState(state);\n            }\n        }\n    }\n\n    /**\n     * Return the drawable used to represent the scroll thumb - the component that\n     * the user can drag back and forth indicating the current value by its position.\n     *\n     * @return The current thumb drawable\n     */\n    getThumb():Drawable  {\n        return this.mThumb;\n    }\n\n    /**\n     * @see #setThumbOffset(int)\n     */\n    getThumbOffset():number  {\n        return this.mThumbOffset;\n    }\n\n    /**\n     * Sets the thumb offset that allows the thumb to extend out of the range of\n     * the track.\n     * \n     * @param thumbOffset The offset amount in pixels.\n     */\n    setThumbOffset(thumbOffset:number):void  {\n        this.mThumbOffset = thumbOffset;\n        this.invalidate();\n    }\n\n    /**\n     * Sets the amount of progress changed via the arrow keys.\n     * \n     * @param increment The amount to increment or decrement when the user\n     *            presses the arrow keys.\n     */\n    setKeyProgressIncrement(increment:number):void  {\n        this.mKeyProgressIncrement = increment < 0 ? -increment : increment;\n    }\n\n    /**\n     * Returns the amount of progress changed via the arrow keys.\n     * <p>\n     * By default, this will be a value that is derived from the max progress.\n     * \n     * @return The amount to increment or decrement when the user presses the\n     *         arrow keys. This will be positive.\n     */\n    getKeyProgressIncrement():number  {\n        return this.mKeyProgressIncrement;\n    }\n\n    setMax(max:number):void  {\n        super.setMax(max);\n        if ((this.mKeyProgressIncrement == 0) || (this.getMax() / this.mKeyProgressIncrement > 20)) {\n            // It will take the user too long to change this via keys, change it\n            // to something more reasonable\n            this.setKeyProgressIncrement(Math.max(1, Math.round(<number> this.getMax() / 20)));\n        }\n    }\n\n    protected verifyDrawable(who:Drawable):boolean  {\n        return who == this.mThumb || super.verifyDrawable(who);\n    }\n\n    jumpDrawablesToCurrentState():void  {\n        super.jumpDrawablesToCurrentState();\n        if (this.mThumb != null)\n            this.mThumb.jumpToCurrentState();\n    }\n\n    protected drawableStateChanged():void  {\n        super.drawableStateChanged();\n        let progressDrawable:Drawable = this.getProgressDrawable();\n        if (progressDrawable != null) {\n            progressDrawable.setAlpha(this.isEnabled() ? AbsSeekBar.NO_ALPHA : Math.floor((AbsSeekBar.NO_ALPHA * this.mDisabledAlpha)));\n        }\n        if (this.mThumb != null && this.mThumb.isStateful()) {\n            let state:number[] = this.getDrawableState();\n            this.mThumb.setState(state);\n        }\n    }\n\n    onProgressRefresh(scale:number, fromUser:boolean):void  {\n        super.onProgressRefresh(scale, fromUser);\n        let thumb:Drawable = this.mThumb;\n        if (thumb != null) {\n            this.setThumbPos(this.getWidth(), thumb, scale, Integer.MIN_VALUE);\n            /*\n             * Since we draw translated, the drawable's bounds that it signals\n             * for invalidation won't be the actual bounds we want invalidated,\n             * so just invalidate this whole view.\n             */\n            this.invalidate();\n        }\n    }\n\n    protected onSizeChanged(w:number, h:number, oldw:number, oldh:number):void  {\n        super.onSizeChanged(w, h, oldw, oldh);\n        this.updateThumbPos(w, h);\n    }\n\n    private updateThumbPos(w:number, h:number):void  {\n        let d:Drawable = this.getCurrentDrawable();\n        let thumb:Drawable = this.mThumb;\n        let thumbHeight:number = thumb == null ? 0 : thumb.getIntrinsicHeight();\n        // The max height does not incorporate padding, whereas the height\n        // parameter does\n        let trackHeight:number = Math.min(this.mMaxHeight, h - this.mPaddingTop - this.mPaddingBottom);\n        let max:number = this.getMax();\n        let scale:number = max > 0 ? <number> this.getProgress() / <number> max : 0;\n        if (thumbHeight > trackHeight) {\n            if (thumb != null) {\n                this.setThumbPos(w, thumb, scale, 0);\n            }\n            let gapForCenteringTrack:number = (thumbHeight - trackHeight) / 2;\n            if (d != null) {\n                // Canvas will be translated by the padding, so 0,0 is where we start drawing\n                d.setBounds(0, gapForCenteringTrack, w - this.mPaddingRight - this.mPaddingLeft, h - this.mPaddingBottom - gapForCenteringTrack - this.mPaddingTop);\n            }\n        } else {\n            if (d != null) {\n                // Canvas will be translated by the padding, so 0,0 is where we start drawing\n                d.setBounds(0, 0, w - this.mPaddingRight - this.mPaddingLeft, h - this.mPaddingBottom - this.mPaddingTop);\n            }\n            let gap:number = (trackHeight - thumbHeight) / 2;\n            if (thumb != null) {\n                this.setThumbPos(w, thumb, scale, gap);\n            }\n        }\n    }\n\n    /**\n     * @param gap If set to {@link Integer#MIN_VALUE}, this will be ignored and\n     */\n    private setThumbPos(w:number, thumb:Drawable, scale:number, gap:number):void  {\n        let available:number = w - this.mPaddingLeft - this.mPaddingRight;\n        let thumbWidth:number = thumb.getIntrinsicWidth();\n        let thumbHeight:number = thumb.getIntrinsicHeight();\n        available -= thumbWidth;\n        // The extra space for the thumb to move on the track\n        available += this.mThumbOffset * 2;\n        let thumbPos:number = Math.floor((scale * available));\n        let topBound:number, bottomBound:number;\n        if (gap == Integer.MIN_VALUE) {\n            let oldBounds:Rect = thumb.getBounds();\n            topBound = oldBounds.top;\n            bottomBound = oldBounds.bottom;\n        } else {\n            topBound = gap;\n            bottomBound = gap + thumbHeight;\n        }\n        // Canvas will be translated, so 0,0 is where we start drawing\n        const left:number = (this.isLayoutRtl() && this.mMirrorForRtl) ? available - thumbPos : thumbPos;\n        thumb.setBounds(left, topBound, left + thumbWidth, bottomBound);\n    }\n\n    ///**\n    // * @hide\n    // */\n    //onResolveDrawables(layoutDirection:number):void  {\n    //    super.onResolveDrawables(layoutDirection);\n    //    if (this.mThumb != null) {\n    //        this.mThumb.setLayoutDirection(layoutDirection);\n    //    }\n    //}\n\n    protected onDraw(canvas:Canvas):void  {\n        super.onDraw(canvas);\n        if (this.mThumb != null) {\n            canvas.save();\n            // Translate the padding. For the x, we need to allow the thumb to\n            // draw in its extra space\n            canvas.translate(this.mPaddingLeft - this.mThumbOffset, this.mPaddingTop);\n            this.mThumb.draw(canvas);\n            canvas.restore();\n        }\n    }\n\n    protected onMeasure(widthMeasureSpec:number, heightMeasureSpec:number):void  {\n        let d:Drawable = this.getCurrentDrawable();\n        let thumbHeight:number = this.mThumb == null ? 0 : this.mThumb.getIntrinsicHeight();\n        let dw:number = 0;\n        let dh:number = 0;\n        if (d != null) {\n            dw = Math.max(this.mMinWidth, Math.min(this.mMaxWidth, d.getIntrinsicWidth()));\n            dh = Math.max(this.mMinHeight, Math.min(this.mMaxHeight, d.getIntrinsicHeight()));\n            dh = Math.max(thumbHeight, dh);\n        }\n        dw += this.mPaddingLeft + this.mPaddingRight;\n        dh += this.mPaddingTop + this.mPaddingBottom;\n        this.setMeasuredDimension(AbsSeekBar.resolveSizeAndState(dw, widthMeasureSpec, 0), AbsSeekBar.resolveSizeAndState(dh, heightMeasureSpec, 0));\n    }\n\n    onTouchEvent(event:MotionEvent):boolean  {\n        if (!this.mIsUserSeekable || !this.isEnabled()) {\n            return false;\n        }\n        switch(event.getAction()) {\n            case MotionEvent.ACTION_DOWN:\n                if (this.isInScrollingContainer()) {\n                    this.mTouchDownX = event.getX();\n                } else {\n                    this.setPressed(true);\n                    if (this.mThumb != null) {\n                        // This may be within the padding region\n                        this.invalidate(this.mThumb.getBounds());\n                    }\n                    this.onStartTrackingTouch();\n                    this.trackTouchEvent(event);\n                    this.attemptClaimDrag();\n                }\n                break;\n            case MotionEvent.ACTION_MOVE:\n                if (this.mIsDragging) {\n                    this.trackTouchEvent(event);\n                } else {\n                    const x:number = event.getX();\n                    if (Math.abs(x - this.mTouchDownX) > this.mTouchSlop) {\n                        this.setPressed(true);\n                        if (this.mThumb != null) {\n                            // This may be within the padding region\n                            this.invalidate(this.mThumb.getBounds());\n                        }\n                        this.onStartTrackingTouch();\n                        this.trackTouchEvent(event);\n                        this.attemptClaimDrag();\n                    }\n                }\n                break;\n            case MotionEvent.ACTION_UP:\n                if (this.mIsDragging) {\n                    this.trackTouchEvent(event);\n                    this.onStopTrackingTouch();\n                    this.setPressed(false);\n                } else {\n                    // Touch up when we never crossed the touch slop threshold should\n                    // be interpreted as a tap-seek to that location.\n                    this.onStartTrackingTouch();\n                    this.trackTouchEvent(event);\n                    this.onStopTrackingTouch();\n                }\n                // ProgressBar doesn't know to repaint the thumb drawable\n                // in its inactive state when the touch stops (because the\n                // value has not apparently changed)\n                this.invalidate();\n                break;\n            case MotionEvent.ACTION_CANCEL:\n                if (this.mIsDragging) {\n                    this.onStopTrackingTouch();\n                    this.setPressed(false);\n                }\n                // see above explanation\n                this.invalidate();\n                break;\n        }\n        return true;\n    }\n\n    private trackTouchEvent(event:MotionEvent):void  {\n        const width:number = this.getWidth();\n        const available:number = width - this.mPaddingLeft - this.mPaddingRight;\n        let x:number = Math.floor(event.getX());\n        let scale:number;\n        let progress:number = 0;\n        if (this.isLayoutRtl() && this.mMirrorForRtl) {\n            if (x > width - this.mPaddingRight) {\n                scale = 0.0;\n            } else if (x < this.mPaddingLeft) {\n                scale = 1.0;\n            } else {\n                scale = <number> (available - x + this.mPaddingLeft) / <number> available;\n                progress = this.mTouchProgressOffset;\n            }\n        } else {\n            if (x < this.mPaddingLeft) {\n                scale = 0.0;\n            } else if (x > width - this.mPaddingRight) {\n                scale = 1.0;\n            } else {\n                scale = <number> (x - this.mPaddingLeft) / <number> available;\n                progress = this.mTouchProgressOffset;\n            }\n        }\n        const max:number = this.getMax();\n        progress += scale * max;\n        this.setProgress(Math.floor(progress), true);\n    }\n\n    /**\n     * Tries to claim the user's drag motion, and requests disallowing any\n     * ancestors from stealing events in the drag.\n     */\n    private attemptClaimDrag():void  {\n        if (this.mParent != null) {\n            this.mParent.requestDisallowInterceptTouchEvent(true);\n        }\n    }\n\n    /**\n     * This is called when the user has started touching this widget.\n     */\n    onStartTrackingTouch():void  {\n        this.mIsDragging = true;\n    }\n\n    /**\n     * This is called when the user either releases his touch or the touch is\n     * canceled.\n     */\n    onStopTrackingTouch():void  {\n        this.mIsDragging = false;\n    }\n\n    /**\n     * Called when the user changes the seekbar's progress by using a key event.\n     */\n    onKeyChange():void  {\n    }\n\n    onKeyDown(keyCode:number, event:KeyEvent):boolean  {\n        if (this.isEnabled()) {\n            let progress:number = this.getProgress();\n            switch(keyCode) {\n                case KeyEvent.KEYCODE_DPAD_LEFT:\n                    if (progress <= 0)\n                        break;\n                    this.setProgress(progress - this.mKeyProgressIncrement, true);\n                    this.onKeyChange();\n                    return true;\n                case KeyEvent.KEYCODE_DPAD_RIGHT:\n                    if (progress >= this.getMax())\n                        break;\n                    this.setProgress(progress + this.mKeyProgressIncrement, true);\n                    this.onKeyChange();\n                    return true;\n            }\n        }\n        return super.onKeyDown(keyCode, event);\n    }\n\n    //onRtlPropertiesChanged(layoutDirection:number):void  {\n    //    super.onRtlPropertiesChanged(layoutDirection);\n    //    let max:number = this.getMax();\n    //    let scale:number = max > 0 ? <number> this.getProgress() / <number> max : 0;\n    //    let thumb:Drawable = this.mThumb;\n    //    if (thumb != null) {\n    //        this.setThumbPos(this.getWidth(), thumb, scale, Integer.MIN_VALUE);\n    //        /*\n    //         * Since we draw translated, the drawable's bounds that it signals\n    //         * for invalidation won't be the actual bounds we want invalidated,\n    //         * so just invalidate this whole view.\n    //         */\n    //        this.invalidate();\n    //    }\n    //}\n}\n}"
  },
  {
    "path": "src/android/widget/AbsSpinner.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/database/DataSetObserver.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/util/SparseArray.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../java/lang/System.ts\"/>\n///<reference path=\"../../android/widget/Adapter.ts\"/>\n///<reference path=\"../../android/widget/AdapterView.ts\"/>\n///<reference path=\"../../android/widget/ArrayAdapter.ts\"/>\n///<reference path=\"../../android/widget/Spinner.ts\"/>\n///<reference path=\"../../android/widget/SpinnerAdapter.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n\nmodule android.widget {\nimport DataSetObserver = android.database.DataSetObserver;\nimport Rect = android.graphics.Rect;\nimport SparseArray = android.util.SparseArray;\nimport View = android.view.View;\nimport ViewGroup = android.view.ViewGroup;\nimport Integer = java.lang.Integer;\nimport System = java.lang.System;\nimport Adapter = android.widget.Adapter;\nimport AdapterView = android.widget.AdapterView;\nimport ArrayAdapter = android.widget.ArrayAdapter;\nimport Spinner = android.widget.Spinner;\nimport SpinnerAdapter = android.widget.SpinnerAdapter;\nimport Context = android.content.Context;\n    import AttrBinder = androidui.attr.AttrBinder;\n/**\n * An abstract base class for spinner widgets. SDK users will probably not\n * need to use this class.\n * \n * @attr ref android.R.styleable#AbsSpinner_entries\n */\nexport abstract class AbsSpinner extends AdapterView<SpinnerAdapter> {\n\n    mAdapter:SpinnerAdapter;\n\n    mHeightMeasureSpec:number = 0;\n\n    mWidthMeasureSpec:number = 0;\n\n    mSelectionLeftPadding:number = 0;\n\n    mSelectionTopPadding:number = 0;\n\n    mSelectionRightPadding:number = 0;\n\n    mSelectionBottomPadding:number = 0;\n\n    mSpinnerPadding:Rect = new Rect();\n\n    mRecycler:AbsSpinner.RecycleBin = new AbsSpinner.RecycleBin(this);\n\n    private mDataSetObserver:DataSetObserver;\n\n    /** Temporary frame to hold a child View's frame rectangle */\n    private mTouchFrame:Rect;\n\n\n    constructor(context:Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n        super(context, bindElement, defStyle);\n        this.initAbsSpinner();\n\n        const a = context.obtainStyledAttributes(bindElement, defStyle);\n        const entries = a.getTextArray('entries');\n        if (entries != null) {\n            const adapter = new ArrayAdapter<string>(context, R.layout.simple_spinner_item, entries);\n            adapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item);\n            this.setAdapter(adapter);\n        }\n        a.recycle();\n    }\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder().set('entries', {\n            setter(v:AbsSpinner, value:any, attrBinder:AttrBinder) {\n                let entries:string[] = attrBinder.parseStringArray(value);\n                if (entries != null) {\n                    let adapter: ArrayAdapter<string> = new ArrayAdapter<string>(v.getContext(), R.layout.simple_spinner_item, entries);\n                    adapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item);\n                    v.setAdapter(adapter);\n                }\n            }\n        });\n    }\n\n    /**\n     * Common code for different constructor flavors\n     */\n    private initAbsSpinner():void  {\n        this.setFocusable(true);\n        this.setWillNotDraw(false);\n    }\n\n    /**\n     * The Adapter is used to provide the data which backs this Spinner.\n     * It also provides methods to transform spinner items based on their position\n     * relative to the selected item.\n     * @param adapter The SpinnerAdapter to use for this Spinner\n     */\n    setAdapter(adapter:SpinnerAdapter):void  {\n        if (null != this.mAdapter) {\n            this.mAdapter.unregisterDataSetObserver(this.mDataSetObserver);\n            this.resetList();\n        }\n        this.mAdapter = adapter;\n        this.mOldSelectedPosition = AbsSpinner.INVALID_POSITION;\n        this.mOldSelectedRowId = AbsSpinner.INVALID_ROW_ID;\n        if (this.mAdapter != null) {\n            this.mOldItemCount = this.mItemCount;\n            this.mItemCount = this.mAdapter.getCount();\n            this.checkFocus();\n            this.mDataSetObserver = new AdapterView.AdapterDataSetObserver(this);\n            this.mAdapter.registerDataSetObserver(this.mDataSetObserver);\n            let position:number = this.mItemCount > 0 ? 0 : AbsSpinner.INVALID_POSITION;\n            this.setSelectedPositionInt(position);\n            this.setNextSelectedPositionInt(position);\n            if (this.mItemCount == 0) {\n                // Nothing selected\n                this.checkSelectionChanged();\n            }\n        } else {\n            this.checkFocus();\n            this.resetList();\n            // Nothing selected\n            this.checkSelectionChanged();\n        }\n        this.requestLayout();\n    }\n\n    /**\n     * Clear out all children from the list\n     */\n    resetList():void  {\n        this.mDataChanged = false;\n        this.mNeedSync = false;\n        this.removeAllViewsInLayout();\n        this.mOldSelectedPosition = AbsSpinner.INVALID_POSITION;\n        this.mOldSelectedRowId = AbsSpinner.INVALID_ROW_ID;\n        this.setSelectedPositionInt(AbsSpinner.INVALID_POSITION);\n        this.setNextSelectedPositionInt(AbsSpinner.INVALID_POSITION);\n        this.invalidate();\n    }\n\n    /** \n     * @see android.view.View#measure(int, int)\n     * \n     * Figure out the dimensions of this Spinner. The width comes from\n     * the widthMeasureSpec as Spinnners can't have their width set to\n     * UNSPECIFIED. The height is based on the height of the selected item\n     * plus padding. \n     */\n    protected onMeasure(widthMeasureSpec:number, heightMeasureSpec:number):void  {\n        let widthMode:number = View.MeasureSpec.getMode(widthMeasureSpec);\n        let widthSize:number;\n        let heightSize:number;\n        this.mSpinnerPadding.left = this.mPaddingLeft > this.mSelectionLeftPadding ? this.mPaddingLeft : this.mSelectionLeftPadding;\n        this.mSpinnerPadding.top = this.mPaddingTop > this.mSelectionTopPadding ? this.mPaddingTop : this.mSelectionTopPadding;\n        this.mSpinnerPadding.right = this.mPaddingRight > this.mSelectionRightPadding ? this.mPaddingRight : this.mSelectionRightPadding;\n        this.mSpinnerPadding.bottom = this.mPaddingBottom > this.mSelectionBottomPadding ? this.mPaddingBottom : this.mSelectionBottomPadding;\n        if (this.mDataChanged) {\n            this.handleDataChanged();\n        }\n        let preferredHeight:number = 0;\n        let preferredWidth:number = 0;\n        let needsMeasuring:boolean = true;\n        let selectedPosition:number = this.getSelectedItemPosition();\n        if (selectedPosition >= 0 && this.mAdapter != null && selectedPosition < this.mAdapter.getCount()) {\n            // Try looking in the recycler. (Maybe we were measured once already)\n            let view:View = this.mRecycler.get(selectedPosition);\n            if (view == null) {\n                // Make a new one\n                view = this.mAdapter.getView(selectedPosition, null, this);\n                //if (view.getImportantForAccessibility() == AbsSpinner.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {\n                //    view.setImportantForAccessibility(AbsSpinner.IMPORTANT_FOR_ACCESSIBILITY_YES);\n                //}\n            }\n            if (view != null) {\n                // Put in recycler for re-measuring and/or layout\n                this.mRecycler.put(selectedPosition, view);\n                if (view.getLayoutParams() == null) {\n                    this.mBlockLayoutRequests = true;\n                    view.setLayoutParams(this.generateDefaultLayoutParams());\n                    this.mBlockLayoutRequests = false;\n                }\n                this.measureChild(view, widthMeasureSpec, heightMeasureSpec);\n                preferredHeight = this.getChildHeight(view) + this.mSpinnerPadding.top + this.mSpinnerPadding.bottom;\n                preferredWidth = this.getChildWidth(view) + this.mSpinnerPadding.left + this.mSpinnerPadding.right;\n                needsMeasuring = false;\n            }\n        }\n        if (needsMeasuring) {\n            // No views -- just use padding\n            preferredHeight = this.mSpinnerPadding.top + this.mSpinnerPadding.bottom;\n            if (widthMode == View.MeasureSpec.UNSPECIFIED) {\n                preferredWidth = this.mSpinnerPadding.left + this.mSpinnerPadding.right;\n            }\n        }\n        preferredHeight = Math.max(preferredHeight, this.getSuggestedMinimumHeight());\n        preferredWidth = Math.max(preferredWidth, this.getSuggestedMinimumWidth());\n        heightSize = AbsSpinner.resolveSizeAndState(preferredHeight, heightMeasureSpec, 0);\n        widthSize = AbsSpinner.resolveSizeAndState(preferredWidth, widthMeasureSpec, 0);\n        this.setMeasuredDimension(widthSize, heightSize);\n        this.mHeightMeasureSpec = heightMeasureSpec;\n        this.mWidthMeasureSpec = widthMeasureSpec;\n    }\n\n    getChildHeight(child:View):number  {\n        return child.getMeasuredHeight();\n    }\n\n    getChildWidth(child:View):number  {\n        return child.getMeasuredWidth();\n    }\n\n    protected generateDefaultLayoutParams():ViewGroup.LayoutParams  {\n        return new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);\n    }\n\n    recycleAllViews():void  {\n        const childCount:number = this.getChildCount();\n        const recycleBin:AbsSpinner.RecycleBin = this.mRecycler;\n        const position:number = this.mFirstPosition;\n        // All views go in recycler\n        for (let i:number = 0; i < childCount; i++) {\n            let v:View = this.getChildAt(i);\n            let index:number = position + i;\n            recycleBin.put(index, v);\n        }\n    }\n\n    /**\n     * Jump directly to a specific item in the adapter data.\n     */\n    setSelection(position:number, animate?:boolean):void  {\n        if(arguments.length === 1){\n            this.setNextSelectedPositionInt(position);\n            this.requestLayout();\n            this.invalidate();\n        }else {\n            // Animate only if requested position is already on screen somewhere\n            let shouldAnimate:boolean = animate && this.mFirstPosition <= position && position <= this.mFirstPosition + this.getChildCount() - 1;\n            this.setSelectionInt(position, shouldAnimate);\n        }\n    }\n\n    /**\n     * Makes the item at the supplied position selected.\n     * \n     * @param position Position to select\n     * @param animate Should the transition be animated\n     * \n     */\n    setSelectionInt(position:number, animate:boolean):void  {\n        if (position != this.mOldSelectedPosition) {\n            this.mBlockLayoutRequests = true;\n            let delta:number = position - this.mSelectedPosition;\n            this.setNextSelectedPositionInt(position);\n            this.layoutSpinner(delta, animate);\n            this.mBlockLayoutRequests = false;\n        }\n    }\n\n    abstract layoutSpinner(delta:number, animate:boolean):void;\n\n    getSelectedView():View  {\n        if (this.mItemCount > 0 && this.mSelectedPosition >= 0) {\n            return this.getChildAt(this.mSelectedPosition - this.mFirstPosition);\n        } else {\n            return null;\n        }\n    }\n\n    /**\n     * Override to prevent spamming ourselves with layout requests\n     * as we place views\n     * \n     * @see android.view.View#requestLayout()\n     */\n    requestLayout():void  {\n        if (!this.mBlockLayoutRequests) {\n            super.requestLayout();\n        }\n    }\n\n    getAdapter():SpinnerAdapter  {\n        return this.mAdapter;\n    }\n\n    getCount():number  {\n        return this.mItemCount;\n    }\n\n    /**\n     * Maps a point to a position in the list.\n     * \n     * @param x X in local coordinate\n     * @param y Y in local coordinate\n     * @return The position of the item which contains the specified point, or\n     *         {@link #INVALID_POSITION} if the point does not intersect an item.\n     */\n    pointToPosition(x:number, y:number):number  {\n        let frame:Rect = this.mTouchFrame;\n        if (frame == null) {\n            this.mTouchFrame = new Rect();\n            frame = this.mTouchFrame;\n        }\n        const count:number = this.getChildCount();\n        for (let i:number = count - 1; i >= 0; i--) {\n            let child:View = this.getChildAt(i);\n            if (child.getVisibility() == View.VISIBLE) {\n                child.getHitRect(frame);\n                if (frame.contains(x, y)) {\n                    return this.mFirstPosition + i;\n                }\n            }\n        }\n        return AbsSpinner.INVALID_POSITION;\n    }\n\n\n\n    //onSaveInstanceState():Parcelable  {\n    //    let superState:Parcelable = super.onSaveInstanceState();\n    //    let ss:AbsSpinner.SavedState = new AbsSpinner.SavedState(superState);\n    //    ss.selectedId = this.getSelectedItemId();\n    //    if (ss.selectedId >= 0) {\n    //        ss.position = this.getSelectedItemPosition();\n    //    } else {\n    //        ss.position = AbsSpinner.INVALID_POSITION;\n    //    }\n    //    return ss;\n    //}\n    //\n    //onRestoreInstanceState(state:Parcelable):void  {\n    //    let ss:AbsSpinner.SavedState = <AbsSpinner.SavedState> state;\n    //    super.onRestoreInstanceState(ss.getSuperState());\n    //    if (ss.selectedId >= 0) {\n    //        this.mDataChanged = true;\n    //        this.mNeedSync = true;\n    //        this.mSyncRowId = ss.selectedId;\n    //        this.mSyncPosition = ss.position;\n    //        this.mSyncMode = AbsSpinner.SYNC_SELECTED_POSITION;\n    //        this.requestLayout();\n    //    }\n    //}\n    //\n    //\n    //\n    //onInitializeAccessibilityEvent(event:AccessibilityEvent):void  {\n    //    super.onInitializeAccessibilityEvent(event);\n    //    event.setClassName(AbsSpinner.class.getName());\n    //}\n    //\n    //onInitializeAccessibilityNodeInfo(info:AccessibilityNodeInfo):void  {\n    //    super.onInitializeAccessibilityNodeInfo(info);\n    //    info.setClassName(AbsSpinner.class.getName());\n    //}\n}\n\nexport module AbsSpinner{\n//export class SavedState extends View.BaseSavedState {\n//\n//    selectedId:number = 0;\n//\n//    position:number = 0;\n//\n//    /**\n//         * Constructor called from {@link AbsSpinner#onSaveInstanceState()}\n//         */\n//    constructor( superState:Parcelable) {\n//        super(superState);\n//    }\n//\n//    /**\n//         * Constructor called from {@link #CREATOR}\n//         */\n//    constructor( _in:Parcel) {\n//        super(_in);\n//        this.selectedId = _in.readLong();\n//        this.position = _in.readInt();\n//    }\n//\n//    writeToParcel(out:Parcel, flags:number):void  {\n//        super.writeToParcel(out, flags);\n//        out.writeLong(this.selectedId);\n//        out.writeInt(this.position);\n//    }\n//\n//    toString():string  {\n//        return \"AbsSpinner.SavedState{\" + Integer.toHexString(System.identityHashCode(this)) + \" selectedId=\" + this.selectedId + \" position=\" + this.position + \"}\";\n//    }\n//\n//    static CREATOR:Parcelable.Creator<SavedState> = (()=>{\n//        const inner_this=this;\n//        class _Inner extends Parcelable.Creator<SavedState> {\n//\n//            createFromParcel(_in:Parcel):SavedState  {\n//                return new SavedState(_in);\n//            }\n//\n//            newArray(size:number):SavedState[]  {\n//                return new Array<SavedState>(size);\n//            }\n//        }\n//        return new _Inner();\n//    })();\n//}\nexport class RecycleBin {\n    _AbsSpinner_this:AbsSpinner;\n    constructor(arg:AbsSpinner){\n        this._AbsSpinner_this = arg;\n    }\n\n    private mScrapHeap:SparseArray<View> = new SparseArray<View>();\n\n    put(position:number, v:View):void  {\n        this.mScrapHeap.put(position, v);\n    }\n\n    get(position:number):View  {\n        // System.out.print(\"Looking for \" + position);\n        let result:View = this.mScrapHeap.get(position);\n        if (result != null) {\n            // System.out.println(\" HIT\");\n            this.mScrapHeap.delete(position);\n        } else {\n        // System.out.println(\" MISS\");\n        }\n        return result;\n    }\n\n    clear():void  {\n        const scrapHeap:SparseArray<View> = this.mScrapHeap;\n        const count:number = scrapHeap.size();\n        for (let i:number = 0; i < count; i++) {\n            const view:View = scrapHeap.valueAt(i);\n            if (view != null) {\n                this._AbsSpinner_this.removeDetachedView(view, true);\n            }\n        }\n        scrapHeap.clear();\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/widget/Adapter.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/database/DataSetObserver.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"AdapterView.ts\"/>\n\n\nmodule android.widget {\n    import DataSetObserver = android.database.DataSetObserver;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import Integer = java.lang.Integer;\n\n    /**\n     * An Adapter object acts as a bridge between an {@link AdapterView} and the\n     * underlying data for that view. The Adapter provides access to the data items.\n     * The Adapter is also responsible for making a {@link android.view.View} for\n     * each item in the data set.\n     *\n     * @see android.widget.ArrayAdapter\n     * @see android.widget.CursorAdapter\n     * @see android.widget.SimpleCursorAdapter\n     */\n    export interface Adapter {\n\n        /**\n         * Register an observer that is called when changes happen to the data used by this adapter.\n         *\n         * @param observer the object that gets notified when the data set changes.\n         */\n        registerDataSetObserver(observer:DataSetObserver):void ;\n\n        /**\n         * Unregister an observer that has previously been registered with this\n         * adapter via {@link #registerDataSetObserver}.\n         *\n         * @param observer the object to unregister.\n         */\n        unregisterDataSetObserver(observer:DataSetObserver):void ;\n\n        /**\n         * How many items are in the data set represented by this Adapter.\n         *\n         * @return Count of items.\n         */\n        getCount():number ;\n\n        /**\n         * Get the data item associated with the specified position in the data set.\n         *\n         * @param position Position of the item whose data we want within the adapter's\n         * data set.\n         * @return The data at the specified position.\n         */\n        getItem(position:number):any ;\n\n        /**\n         * Get the row id associated with the specified position in the list.\n         *\n         * @param position The position of the item within the adapter's data set whose row id we want.\n         * @return The id of the item at the specified position.\n         */\n        getItemId(position:number):number ;\n\n        /**\n         * Indicates whether the item ids are stable across changes to the\n         * underlying data.\n         *\n         * @return True if the same id always refers to the same object.\n         */\n        hasStableIds():boolean ;\n\n        /**\n         * Get a View that displays the data at the specified position in the data set. You can either\n         * create a View manually or inflate it from an XML layout file. When the View is inflated, the\n         * parent View (GridView, ListView...) will apply default layout parameters unless you use\n         * {@link android.view.LayoutInflater#inflate(int, android.view.ViewGroup, boolean)}\n         * to specify a root view and to prevent attachment to the root.\n         *\n         * @param position The position of the item within the adapter's data set of the item whose view\n         *        we want.\n         * @param convertView The old view to reuse, if possible. Note: You should check that this view\n         *        is non-null and of an appropriate type before using. If it is not possible to convert\n         *        this view to display the correct data, this method can create a new view.\n         *        Heterogeneous lists can specify their number of view types, so that this View is\n         *        always of the right type (see {@link #getViewTypeCount()} and\n         *        {@link #getItemViewType(int)}).\n         * @param parent The parent that this view will eventually be attached to\n         * @return A View corresponding to the data at the specified position.\n         */\n        getView(position:number, convertView:View, parent:ViewGroup):View ;\n\n\n        /**\n         * Get the type of View that will be created by {@link #getView} for the specified item.\n         *\n         * @param position The position of the item within the adapter's data set whose view type we\n         *        want.\n         * @return An integer representing the type of View. Two views should share the same type if one\n         *         can be converted to the other in {@link #getView}. Note: Integers must be in the\n         *         range 0 to {@link #getViewTypeCount} - 1. {@link #IGNORE_ITEM_VIEW_TYPE} can\n         *         also be returned.\n         * @see #IGNORE_ITEM_VIEW_TYPE\n         */\n        getItemViewType(position:number):number ;\n\n        /**\n         * <p>\n         * Returns the number of types of Views that will be created by\n         * {@link #getView}. Each type represents a set of views that can be\n         * converted in {@link #getView}. If the adapter always returns the same\n         * type of View for all items, this method should return 1.\n         * </p>\n         * <p>\n         * This method will only be called when when the adapter is set on the\n         * the {@link AdapterView}.\n         * </p>\n         *\n         * @return The number of types of Views that will be created by this adapter\n         */\n        getViewTypeCount():number ;\n\n        /**\n         * @return true if this adapter doesn't contain any data.  This is used to determine\n         * whether the empty view should be displayed.  A typical implementation will return\n         * getCount() == 0 but since getCount() includes the headers and footers, specialized\n         * adapters might want a different behavior.\n         */\n        isEmpty():boolean ;\n    }\n\n    export module Adapter{\n\n        /**\n         * An item view type that causes the {@link AdapterView} to ignore the item\n         * view. For example, this can be used if the client does not want a\n         * particular view to be given for conversion in\n         * {@link #getView(int, View, ViewGroup)}.\n         *\n         * @see #getItemViewType(int)\n         * @see #getViewTypeCount()\n         */\n        export var IGNORE_ITEM_VIEW_TYPE = AdapterView.ITEM_VIEW_TYPE_IGNORE;\n        export var NO_SELECTION:number = Integer.MIN_VALUE;\n    }\n}"
  },
  {
    "path": "src/android/widget/AdapterView.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/database/DataSetObserver.ts\"/>\n///<reference path=\"../../android/os/SystemClock.ts\"/>\n///<reference path=\"../../android/util/SparseArray.ts\"/>\n///<reference path=\"../../android/view/SoundEffectConstants.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../java/lang/Long.ts\"/>\n///<reference path=\"Adapter.ts\"/>\n\n\nmodule android.widget {\n    import DataSetObserver = android.database.DataSetObserver;\n    import SystemClock = android.os.SystemClock;\n    import SparseArray = android.util.SparseArray;\n    import SoundEffectConstants = android.view.SoundEffectConstants;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import Long = java.lang.Long;\n    import Runnable = java.lang.Runnable;\n    /**\n     * An AdapterView is a view whose children are determined by an {@link Adapter}.\n     *\n     * <p>\n     * See {@link ListView}, {@link GridView}, {@link Spinner} and\n     *      {@link Gallery} for commonly used subclasses of AdapterView.\n     *\n     * <div class=\"special reference\">\n     * <h3>Developer Guides</h3>\n     * <p>For more information about using AdapterView, read the\n     * <a href=\"{@docRoot}guide/topics/ui/binding.html\">Binding to Data with AdapterView</a>\n     * developer guide.</p></div>\n     */\n    export abstract class AdapterView<T extends Adapter> extends ViewGroup {\n\n        /**\n         * The item view type returned by {@link Adapter#getItemViewType(int)} when\n         * the adapter does not want the item's view recycled.\n         */\n        static ITEM_VIEW_TYPE_IGNORE:number = -1;\n\n        /**\n         * The item view type returned by {@link Adapter#getItemViewType(int)} when\n         * the item is a header or footer.\n         */\n        static ITEM_VIEW_TYPE_HEADER_OR_FOOTER:number = -2;\n\n        /**\n         * The position of the first child displayed\n         */\n        mFirstPosition:number = 0;\n\n        /**\n         * The offset in pixels from the top of the AdapterView to the top\n         * of the view to select during the next layout.\n         */\n        mSpecificTop:number = 0\n\n        /**\n         * Position from which to start looking for mSyncRowId\n         */\n        mSyncPosition:number = 0;\n\n        /**\n         * Row id to look for when data has changed\n         */\n        mSyncRowId:number = AdapterView.INVALID_ROW_ID;\n\n        /**\n         * Height of the view when mSyncPosition and mSyncRowId where set\n         */\n        mSyncHeight:number = 0;\n\n        /**\n         * True if we need to sync to mSyncRowId\n         */\n        mNeedSync:boolean = false;\n\n        /**\n         * Indicates whether to sync based on the selection or position. Possible\n         * values are {@link #SYNC_SELECTED_POSITION} or\n         * {@link #SYNC_FIRST_POSITION}.\n         */\n        mSyncMode:number = 0;\n\n        /**\n         * Our height after the last layout\n         */\n        private mLayoutHeight:number = 0;\n\n        /**\n         * Sync based on the selected child\n         */\n        static SYNC_SELECTED_POSITION:number = 0;\n\n        /**\n         * Sync based on the first child displayed\n         */\n        static SYNC_FIRST_POSITION:number = 1;\n\n        /**\n         * Maximum amount of time to spend in {@link #findSyncPosition()}\n         */\n        static SYNC_MAX_DURATION_MILLIS:number = 100;\n\n        /**\n         * Indicates that this view is currently being laid out.\n         */\n        mInLayout:boolean = false;\n\n        /**\n         * The listener that receives notifications when an item is selected.\n         */\n        private mOnItemSelectedListener:AdapterView.OnItemSelectedListener;\n\n        /**\n         * The listener that receives notifications when an item is clicked.\n         */\n        private mOnItemClickListener:AdapterView.OnItemClickListener;\n\n        /**\n         * The listener that receives notifications when an item is long clicked.\n         */\n        mOnItemLongClickListener:AdapterView.OnItemLongClickListener;\n\n        /**\n         * True if the data has changed since the last layout\n         */\n        mDataChanged:boolean;\n\n        /**\n         * The position within the adapter's data set of the item to select\n         * during the next layout.\n         */\n        mNextSelectedPosition:number = AdapterView.INVALID_POSITION;\n\n        /**\n         * The item id of the item to select during the next layout.\n         */\n        mNextSelectedRowId:number = AdapterView.INVALID_ROW_ID;\n\n        /**\n         * The position within the adapter's data set of the currently selected item.\n         */\n        mSelectedPosition:number = AdapterView.INVALID_POSITION;\n\n        /**\n         * The item id of the currently selected item.\n         */\n        mSelectedRowId:number = AdapterView.INVALID_ROW_ID;\n\n        /**\n         * View to show if there are no items to show.\n         */\n        private mEmptyView:View;\n\n        /**\n         * The number of items in the current adapter.\n         */\n        mItemCount:number = 0;\n\n        /**\n         * The number of items in the adapter before a data changed event occurred.\n         */\n        mOldItemCount:number = 0;\n\n        /**\n         * Represents an invalid position. All valid positions are in the range 0 to 1 less than the\n         * number of items in the current adapter.\n         */\n        static INVALID_POSITION:number = -1;\n\n        /**\n         * Represents an empty or invalid row id\n         */\n        static INVALID_ROW_ID:number = Long.MIN_VALUE;\n\n        /**\n         * The last selected position we used when notifying\n         */\n        mOldSelectedPosition:number = AdapterView.INVALID_POSITION;\n\n        /**\n         * The id of the last selected position we used when notifying\n         */\n        mOldSelectedRowId:number = AdapterView.INVALID_ROW_ID;\n\n        /**\n         * Indicates what focusable state is requested when calling setFocusable().\n         * In addition to this, this view has other criteria for actually\n         * determining the focusable state (such as whether its empty or the text\n         * filter is shown).\n         *\n         * @see #setFocusable(boolean)\n         * @see #checkFocus()\n         */\n        private mDesiredFocusableState:boolean;\n\n        private mDesiredFocusableInTouchModeState:boolean;\n\n        private mSelectionNotifier:SelectionNotifier;\n\n        /**\n         * When set to true, calls to requestLayout() will not propagate up the parent hierarchy.\n         * This is used to layout the children during a layout pass.\n         */\n        mBlockLayoutRequests:boolean = false;\n\n        /**\n         * Register a callback to be invoked when an item in this AdapterView has\n         * been clicked.\n         *\n         * @param listener The callback that will be invoked.\n         */\n        setOnItemClickListener(listener:AdapterView.OnItemClickListener):void  {\n            this.mOnItemClickListener = listener;\n        }\n\n        /**\n         * @return The callback to be invoked with an item in this AdapterView has\n         *         been clicked, or null id no callback has been set.\n         */\n        getOnItemClickListener():AdapterView.OnItemClickListener  {\n            return this.mOnItemClickListener;\n        }\n\n        /**\n         * Call the OnItemClickListener, if it is defined. Performs all normal\n         * actions associated with clicking: reporting accessibility event, playing\n         * a sound, etc.\n         *\n         * @param view The view within the AdapterView that was clicked.\n         * @param position The position of the view in the adapter.\n         * @param id The row id of the item that was clicked.\n         * @return True if there was an assigned OnItemClickListener that was\n         *         called, false otherwise is returned.\n         */\n        performItemClick(view:View, position:number, id:number):boolean  {\n            if (this.mOnItemClickListener != null) {\n                this.playSoundEffect(SoundEffectConstants.CLICK);\n                //if (view != null) {\n                //    view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);\n                //}\n                this.mOnItemClickListener.onItemClick(this, view, position, id);\n                return true;\n            }\n            return false;\n        }\n\n\n\n        /**\n         * Register a callback to be invoked when an item in this AdapterView has\n         * been clicked and held\n         *\n         * @param listener The callback that will run\n         */\n        setOnItemLongClickListener(listener:AdapterView.OnItemLongClickListener):void  {\n            if (!this.isLongClickable()) {\n                this.setLongClickable(true);\n            }\n            this.mOnItemLongClickListener = listener;\n        }\n\n        /**\n         * @return The callback to be invoked with an item in this AdapterView has\n         *         been clicked and held, or null id no callback as been set.\n         */\n        getOnItemLongClickListener():AdapterView.OnItemLongClickListener  {\n            return this.mOnItemLongClickListener;\n        }\n\n\n\n        /**\n         * Register a callback to be invoked when an item in this AdapterView has\n         * been selected.\n         *\n         * @param listener The callback that will run\n         */\n        setOnItemSelectedListener(listener:AdapterView.OnItemSelectedListener):void  {\n            this.mOnItemSelectedListener = listener;\n        }\n\n        getOnItemSelectedListener():AdapterView.OnItemSelectedListener  {\n            return this.mOnItemSelectedListener;\n        }\n\n\n\n        /**\n         * Returns the adapter currently associated with this widget.\n         *\n         * @return The adapter used to provide this view's content.\n         */\n        abstract getAdapter():T ;\n\n        /**\n         * Sets the adapter that provides the data and the views to represent the data\n         * in this widget.\n         *\n         * @param adapter The adapter to use to create this view's content.\n         */\n        abstract setAdapter(adapter:T):void ;\n\n        /**\n         * This method is not supported and throws an UnsupportedOperationException when called.\n         *\n         * @throws UnsupportedOperationException Every time this method is invoked.\n         */\n        addView(...args):void  {\n            throw Error(`new UnsupportedOperationException(\"addView() is not supported in AdapterView\")`);\n        }\n\n        /**\n         * This method is not supported and throws an UnsupportedOperationException when called.\n         *\n         * @param child Ignored.\n         *\n         * @throws UnsupportedOperationException Every time this method is invoked.\n         */\n        removeView(child:View):void  {\n            throw Error(`new UnsupportedOperationException(\"removeView(View) is not supported in AdapterView\")`);\n        }\n\n        /**\n         * This method is not supported and throws an UnsupportedOperationException when called.\n         *\n         * @param index Ignored.\n         *\n         * @throws UnsupportedOperationException Every time this method is invoked.\n         */\n        removeViewAt(index:number):void  {\n            throw Error(`new UnsupportedOperationException(\"removeViewAt(int) is not supported in AdapterView\")`);\n        }\n\n        /**\n         * This method is not supported and throws an UnsupportedOperationException when called.\n         *\n         * @throws UnsupportedOperationException Every time this method is invoked.\n         */\n        removeAllViews():void  {\n            throw Error(`new UnsupportedOperationException(\"removeAllViews() is not supported in AdapterView\")`);\n        }\n\n        protected onLayout(changed:boolean, left:number, top:number, right:number, bottom:number):void  {\n            this.mLayoutHeight = this.getHeight();\n        }\n\n        /**\n         * Return the position of the currently selected item within the adapter's data set\n         *\n         * @return int Position (starting at 0), or {@link #INVALID_POSITION} if there is nothing selected.\n         */\n        getSelectedItemPosition():number  {\n            return this.mNextSelectedPosition;\n        }\n\n        /**\n         * @return The id corresponding to the currently selected item, or {@link #INVALID_ROW_ID}\n         * if nothing is selected.\n         */\n        getSelectedItemId():number  {\n            return this.mNextSelectedRowId;\n        }\n\n        /**\n         * @return The view corresponding to the currently selected item, or null\n         * if nothing is selected\n         */\n        abstract getSelectedView():View ;\n\n        /**\n         * @return The data corresponding to the currently selected item, or\n         * null if there is nothing selected.\n         */\n        getSelectedItem():any  {\n            let adapter:T = this.getAdapter();\n            let selection:number = this.getSelectedItemPosition();\n            if (adapter != null && adapter.getCount() > 0 && selection >= 0) {\n                return adapter.getItem(selection);\n            } else {\n                return null;\n            }\n        }\n\n        /**\n         * @return The number of items owned by the Adapter associated with this\n         *         AdapterView. (This is the number of data items, which may be\n         *         larger than the number of visible views.)\n         */\n        getCount():number  {\n            return this.mItemCount;\n        }\n\n        /**\n         * Get the position within the adapter's data set for the view, where view is a an adapter item\n         * or a descendant of an adapter item.\n         *\n         * @param view an adapter item, or a descendant of an adapter item. This must be visible in this\n         *        AdapterView at the time of the call.\n         * @return the position within the adapter's data set of the view, or {@link #INVALID_POSITION}\n         *         if the view does not correspond to a list item (or it is not currently visible).\n         */\n        getPositionForView(view:View):number  {\n            let listItem:View = view;\n            try {\n                let v:View;\n                while (!((v = <View><any> listItem.getParent()) == (this))) {\n                    listItem = v;\n                }\n            } catch (e){\n                return AdapterView.INVALID_POSITION;\n            }\n            // Search the children for the list item\n            const childCount:number = this.getChildCount();\n            for (let i:number = 0; i < childCount; i++) {\n                if (this.getChildAt(i) == (listItem)) {\n                    return this.mFirstPosition + i;\n                }\n            }\n            // Child not found!\n            return AdapterView.INVALID_POSITION;\n        }\n\n        /**\n         * Returns the position within the adapter's data set for the first item\n         * displayed on screen.\n         *\n         * @return The position within the adapter's data set\n         */\n        getFirstVisiblePosition():number  {\n            return this.mFirstPosition;\n        }\n\n        /**\n         * Returns the position within the adapter's data set for the last item\n         * displayed on screen.\n         *\n         * @return The position within the adapter's data set\n         */\n        getLastVisiblePosition():number  {\n            return this.mFirstPosition + this.getChildCount() - 1;\n        }\n\n        /**\n         * Sets the currently selected item. To support accessibility subclasses that\n         * override this method must invoke the overriden super method first.\n         *\n         * @param position Index (starting at 0) of the data item to be selected.\n         */\n        abstract setSelection(position:number):void ;\n\n        /**\n         * Sets the view to show if the adapter is empty\n         */\n        setEmptyView(emptyView:View):void  {\n            this.mEmptyView = emptyView;\n            // If not explicitly specified this view is important for accessibility.\n            //if (emptyView != null && emptyView.getImportantForAccessibility() == AdapterView.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {\n            //    emptyView.setImportantForAccessibility(AdapterView.IMPORTANT_FOR_ACCESSIBILITY_YES);\n            //}\n            const adapter:T = this.getAdapter();\n            const empty:boolean = ((adapter == null) || adapter.isEmpty());\n            this.updateEmptyStatus(empty);\n        }\n\n        /**\n         * When the current adapter is empty, the AdapterView can display a special view\n         * call the empty view. The empty view is used to provide feedback to the user\n         * that no data is available in this AdapterView.\n         *\n         * @return The view to show if the adapter is empty.\n         */\n        getEmptyView():View  {\n            return this.mEmptyView;\n        }\n\n        /**\n         * Indicates whether this view is in filter mode. Filter mode can for instance\n         * be enabled by a user when typing on the keyboard.\n         *\n         * @return True if the view is in filter mode, false otherwise.\n         */\n        isInFilterMode():boolean  {\n            return false;\n        }\n\n        setFocusable(focusable:boolean):void  {\n            const adapter:T = this.getAdapter();\n            const empty:boolean = adapter == null || adapter.getCount() == 0;\n            this.mDesiredFocusableState = focusable;\n            if (!focusable) {\n                this.mDesiredFocusableInTouchModeState = false;\n            }\n            super.setFocusable(focusable && (!empty || this.isInFilterMode()));\n        }\n\n        setFocusableInTouchMode(focusable:boolean):void  {\n            const adapter:T = this.getAdapter();\n            const empty:boolean = adapter == null || adapter.getCount() == 0;\n            this.mDesiredFocusableInTouchModeState = focusable;\n            if (focusable) {\n                this.mDesiredFocusableState = true;\n            }\n            super.setFocusableInTouchMode(focusable && (!empty || this.isInFilterMode()));\n        }\n\n        checkFocus():void  {\n            const adapter:T = this.getAdapter();\n            const empty:boolean = adapter == null || adapter.getCount() == 0;\n            const focusable:boolean = !empty || this.isInFilterMode();\n            // The order in which we set focusable in touch mode/focusable may matter\n            // for the client, see View.setFocusableInTouchMode() comments for more\n            // details\n            super.setFocusableInTouchMode(focusable && this.mDesiredFocusableInTouchModeState);\n            super.setFocusable(focusable && this.mDesiredFocusableState);\n            if (this.mEmptyView != null) {\n                this.updateEmptyStatus((adapter == null) || adapter.isEmpty());\n            }\n        }\n\n        /**\n         * Update the status of the list based on the empty parameter.  If empty is true and\n         * we have an empty view, display it.  In all the other cases, make sure that the listview\n         * is VISIBLE and that the empty view is GONE (if it's not null).\n         */\n        private updateEmptyStatus(empty:boolean):void  {\n            if (this.isInFilterMode()) {\n                empty = false;\n            }\n            if (empty) {\n                if (this.mEmptyView != null) {\n                    this.mEmptyView.setVisibility(View.VISIBLE);\n                    this.setVisibility(View.GONE);\n                } else {\n                    // If the caller just removed our empty view, make sure the list view is visible\n                    this.setVisibility(View.VISIBLE);\n                }\n                // the state of the adapter.\n                if (this.mDataChanged) {\n                    this.onLayout(false, this.mLeft, this.mTop, this.mRight, this.mBottom);\n                }\n            } else {\n                if (this.mEmptyView != null)\n                    this.mEmptyView.setVisibility(View.GONE);\n                this.setVisibility(View.VISIBLE);\n            }\n        }\n\n        /**\n         * Gets the data associated with the specified position in the list.\n         *\n         * @param position Which data to get\n         * @return The data associated with the specified position in the list\n         */\n        getItemAtPosition(position:number):any  {\n            let adapter:T = this.getAdapter();\n            return (adapter == null || position < 0) ? null : adapter.getItem(position);\n        }\n\n        getItemIdAtPosition(position:number):number  {\n            let adapter:T = this.getAdapter();\n            return (adapter == null || position < 0) ? AdapterView.INVALID_ROW_ID : adapter.getItemId(position);\n        }\n\n        setOnClickListener(l:View.OnClickListener):void  {\n            throw Error(`new RuntimeException(\"Don't call setOnClickListener for an AdapterView. \" + \"You probably want setOnItemClickListener instead\")`);\n        }\n\n        /**\n         * Override to prevent freezing of any views created by the adapter.\n         */\n        //dispatchSaveInstanceState(container:SparseArray<Parcelable>):void  {\n        //    this.dispatchFreezeSelfOnly(container);\n        //}\n\n        /**\n         * Override to prevent thawing of any views created by the adapter.\n         */\n        //dispatchRestoreInstanceState(container:SparseArray<Parcelable>):void  {\n        //    this.dispatchThawSelfOnly(container);\n        //}\n\n\n\n        protected onDetachedFromWindow():void  {\n            super.onDetachedFromWindow();\n            this.removeCallbacks(this.mSelectionNotifier);\n        }\n\n\n\n        private selectionChanged():void  {\n            if (this.mOnItemSelectedListener != null\n                //|| AccessibilityManager.getInstance(this.mContext).isEnabled()\n            ) {\n                if (this.mInLayout || this.mBlockLayoutRequests) {\n                    // new layout or invalidate requests.\n                    if (this.mSelectionNotifier == null) {\n                        this.mSelectionNotifier = new SelectionNotifier(this);\n                    }\n                    this.post(this.mSelectionNotifier);\n                } else {\n                    this.fireOnSelected();\n                    this.performAccessibilityActionsOnSelected();\n                }\n            }\n        }\n\n        private fireOnSelected():void  {\n            if (this.mOnItemSelectedListener == null) {\n                return;\n            }\n            const selection:number = this.getSelectedItemPosition();\n            if (selection >= 0) {\n                let v:View = this.getSelectedView();\n                this.mOnItemSelectedListener.onItemSelected(this, v, selection, this.getAdapter().getItemId(selection));\n            } else {\n                this.mOnItemSelectedListener.onNothingSelected(this);\n            }\n        }\n\n        private performAccessibilityActionsOnSelected():void  {\n            //if (!AccessibilityManager.getInstance(this.mContext).isEnabled()) {\n            //    return;\n            //}\n            //const position:number = this.getSelectedItemPosition();\n            //if (position >= 0) {\n            //    // we fire selection events here not in View\n            //    this.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);\n            //}\n        }\n\n        //dispatchPopulateAccessibilityEvent(event:AccessibilityEvent):boolean  {\n        //    let selectedView:View = this.getSelectedView();\n        //    if (selectedView != null && selectedView.getVisibility() == AdapterView.VISIBLE && selectedView.dispatchPopulateAccessibilityEvent(event)) {\n        //        return true;\n        //    }\n        //    return false;\n        //}\n\n        //onRequestSendAccessibilityEvent(child:View, event:AccessibilityEvent):boolean  {\n        //    if (super.onRequestSendAccessibilityEvent(child, event)) {\n        //        // Add a record for ourselves as well.\n        //        let record:AccessibilityEvent = AccessibilityEvent.obtain();\n        //        this.onInitializeAccessibilityEvent(record);\n        //        // Populate with the text of the requesting child.\n        //        child.dispatchPopulateAccessibilityEvent(record);\n        //        event.appendRecord(record);\n        //        return true;\n        //    }\n        //    return false;\n        //}\n\n        //onInitializeAccessibilityNodeInfo(info:AccessibilityNodeInfo):void  {\n        //    super.onInitializeAccessibilityNodeInfo(info);\n        //    info.setClassName(AdapterView.class.getName());\n        //    info.setScrollable(this.isScrollableForAccessibility());\n        //    let selectedView:View = this.getSelectedView();\n        //    if (selectedView != null) {\n        //        info.setEnabled(selectedView.isEnabled());\n        //    }\n        //}\n\n        //onInitializeAccessibilityEvent(event:AccessibilityEvent):void  {\n        //    super.onInitializeAccessibilityEvent(event);\n        //    event.setClassName(AdapterView.class.getName());\n        //    event.setScrollable(this.isScrollableForAccessibility());\n        //    let selectedView:View = this.getSelectedView();\n        //    if (selectedView != null) {\n        //        event.setEnabled(selectedView.isEnabled());\n        //    }\n        //    event.setCurrentItemIndex(this.getSelectedItemPosition());\n        //    event.setFromIndex(this.getFirstVisiblePosition());\n        //    event.setToIndex(this.getLastVisiblePosition());\n        //    event.setItemCount(this.getCount());\n        //}\n\n        private isScrollableForAccessibility():boolean  {\n            let adapter:T = this.getAdapter();\n            if (adapter != null) {\n                const itemCount:number = adapter.getCount();\n                return itemCount > 0 && (this.getFirstVisiblePosition() > 0 || this.getLastVisiblePosition() < itemCount - 1);\n            }\n            return false;\n        }\n\n        canAnimate():boolean  {\n            return super.canAnimate() && this.mItemCount > 0;\n        }\n\n        handleDataChanged():void  {\n            const count:number = this.mItemCount;\n            let found:boolean = false;\n            if (count > 0) {\n                let newPos:number;\n                // Find the row we are supposed to sync to\n                if (this.mNeedSync) {\n                    // Update this first, since setNextSelectedPositionInt inspects\n                    // it\n                    this.mNeedSync = false;\n                    // See if we can find a position in the new data with the same\n                    // id as the old selection\n                    newPos = this.findSyncPosition();\n                    if (newPos >= 0) {\n                        // Verify that new selection is selectable\n                        let selectablePos:number = this.lookForSelectablePosition(newPos, true);\n                        if (selectablePos == newPos) {\n                            // Same row id is selected\n                            this.setNextSelectedPositionInt(newPos);\n                            found = true;\n                        }\n                    }\n                }\n                if (!found) {\n                    // Try to use the same position if we can't find matching data\n                    newPos = this.getSelectedItemPosition();\n                    // Pin position to the available range\n                    if (newPos >= count) {\n                        newPos = count - 1;\n                    }\n                    if (newPos < 0) {\n                        newPos = 0;\n                    }\n                    // Make sure we select something selectable -- first look down\n                    let selectablePos:number = this.lookForSelectablePosition(newPos, true);\n                    if (selectablePos < 0) {\n                        // Looking down didn't work -- try looking up\n                        selectablePos = this.lookForSelectablePosition(newPos, false);\n                    }\n                    if (selectablePos >= 0) {\n                        this.setNextSelectedPositionInt(selectablePos);\n                        this.checkSelectionChanged();\n                        found = true;\n                    }\n                }\n            }\n            if (!found) {\n                // Nothing is selected\n                this.mSelectedPosition = AdapterView.INVALID_POSITION;\n                this.mSelectedRowId = AdapterView.INVALID_ROW_ID;\n                this.mNextSelectedPosition = AdapterView.INVALID_POSITION;\n                this.mNextSelectedRowId = AdapterView.INVALID_ROW_ID;\n                this.mNeedSync = false;\n                this.checkSelectionChanged();\n            }\n            //this.notifySubtreeAccessibilityStateChangedIfNeeded();\n        }\n\n        checkSelectionChanged():void  {\n            if ((this.mSelectedPosition != this.mOldSelectedPosition) || (this.mSelectedRowId != this.mOldSelectedRowId)) {\n                this.selectionChanged();\n                this.mOldSelectedPosition = this.mSelectedPosition;\n                this.mOldSelectedRowId = this.mSelectedRowId;\n            }\n        }\n\n        /**\n         * Searches the adapter for a position matching mSyncRowId. The search starts at mSyncPosition\n         * and then alternates between moving up and moving down until 1) we find the right position, or\n         * 2) we run out of time, or 3) we have looked at every position\n         *\n         * @return Position of the row that matches mSyncRowId, or {@link #INVALID_POSITION} if it can't\n         *         be found\n         */\n        findSyncPosition():number  {\n            let count:number = this.mItemCount;\n            if (count == 0) {\n                return AdapterView.INVALID_POSITION;\n            }\n            let idToMatch:number = this.mSyncRowId;\n            let seed:number = this.mSyncPosition;\n            // If there isn't a selection don't hunt for it\n            if (idToMatch == AdapterView.INVALID_ROW_ID) {\n                return AdapterView.INVALID_POSITION;\n            }\n            // Pin seed to reasonable values\n            seed = Math.max(0, seed);\n            seed = Math.min(count - 1, seed);\n            let endTime:number = SystemClock.uptimeMillis() + AdapterView.SYNC_MAX_DURATION_MILLIS;\n            let rowId:number;\n            // first position scanned so far\n            let first:number = seed;\n            // last position scanned so far\n            let last:number = seed;\n            // True if we should move down on the next iteration\n            let next:boolean = false;\n            // True when we have looked at the first item in the data\n            let hitFirst:boolean;\n            // True when we have looked at the last item in the data\n            let hitLast:boolean;\n            // Get the item ID locally (instead of getItemIdAtPosition), so\n            // we need the adapter\n            let adapter:T = this.getAdapter();\n            if (adapter == null) {\n                return AdapterView.INVALID_POSITION;\n            }\n            while (SystemClock.uptimeMillis() <= endTime) {\n                rowId = adapter.getItemId(seed);\n                if (rowId == idToMatch) {\n                    // Found it!\n                    return seed;\n                }\n                hitLast = last == count - 1;\n                hitFirst = first == 0;\n                if (hitLast && hitFirst) {\n                    // Looked at everything\n                    break;\n                }\n                if (hitFirst || (next && !hitLast)) {\n                    // Either we hit the top, or we are trying to move down\n                    last++;\n                    seed = last;\n                    // Try going up next time\n                    next = false;\n                } else if (hitLast || (!next && !hitFirst)) {\n                    // Either we hit the bottom, or we are trying to move up\n                    first--;\n                    seed = first;\n                    // Try going down next time\n                    next = true;\n                }\n            }\n            return AdapterView.INVALID_POSITION;\n        }\n\n        /**\n         * Find a position that can be selected (i.e., is not a separator).\n         *\n         * @param position The starting position to look at.\n         * @param lookDown Whether to look down for other positions.\n         * @return The next selectable position starting at position and then searching either up or\n         *         down. Returns {@link #INVALID_POSITION} if nothing can be found.\n         */\n        lookForSelectablePosition(position:number, lookDown:boolean):number  {\n            return position;\n        }\n\n        /**\n         * Utility to keep mSelectedPosition and mSelectedRowId in sync\n         * @param position Our current position\n         */\n        setSelectedPositionInt(position:number):void  {\n            this.mSelectedPosition = position;\n            this.mSelectedRowId = this.getItemIdAtPosition(position);\n        }\n\n        /**\n         * Utility to keep mNextSelectedPosition and mNextSelectedRowId in sync\n         * @param position Intended value for mSelectedPosition the next time we go\n         * through layout\n         */\n        setNextSelectedPositionInt(position:number):void  {\n            this.mNextSelectedPosition = position;\n            this.mNextSelectedRowId = this.getItemIdAtPosition(position);\n            // If we are trying to sync to the selection, update that too\n            if (this.mNeedSync && this.mSyncMode == AdapterView.SYNC_SELECTED_POSITION && position >= 0) {\n                this.mSyncPosition = position;\n                this.mSyncRowId = this.mNextSelectedRowId;\n            }\n        }\n\n        /**\n         * Remember enough information to restore the screen state when the data has\n         * changed.\n         *\n         */\n        rememberSyncState():void  {\n            if (this.getChildCount() > 0) {\n                this.mNeedSync = true;\n                this.mSyncHeight = this.mLayoutHeight;\n                if (this.mSelectedPosition >= 0) {\n                    // Sync the selection state\n                    let v:View = this.getChildAt(this.mSelectedPosition - this.mFirstPosition);\n                    this.mSyncRowId = this.mNextSelectedRowId;\n                    this.mSyncPosition = this.mNextSelectedPosition;\n                    if (v != null) {\n                        this.mSpecificTop = v.getTop();\n                    }\n                    this.mSyncMode = AdapterView.SYNC_SELECTED_POSITION;\n                } else {\n                    // Sync the based on the offset of the first view\n                    let v:View = this.getChildAt(0);\n                    let adapter:T = this.getAdapter();\n                    if (this.mFirstPosition >= 0 && this.mFirstPosition < adapter.getCount()) {\n                        this.mSyncRowId = adapter.getItemId(this.mFirstPosition);\n                    } else {\n                        this.mSyncRowId = AdapterView.NO_ID;\n                    }\n                    this.mSyncPosition = this.mFirstPosition;\n                    if (v != null) {\n                        this.mSpecificTop = v.getTop();\n                    }\n                    this.mSyncMode = AdapterView.SYNC_FIRST_POSITION;\n                }\n            }\n        }\n    }\n\n    export module AdapterView{\n        /**\n         * Interface definition for a callback to be invoked when an item in this\n         * AdapterView has been clicked.\n         */\n        export interface OnItemClickListener {\n\n            /**\n             * Callback method to be invoked when an item in this AdapterView has\n             * been clicked.\n             * <p>\n             * Implementers can call getItemAtPosition(position) if they need\n             * to access the data associated with the selected item.\n             *\n             * @param parent The AdapterView where the click happened.\n             * @param view The view within the AdapterView that was clicked (this\n             *            will be a view provided by the adapter)\n             * @param position The position of the view in the adapter.\n             * @param id The row id of the item that was clicked.\n             */\n            onItemClick(parent:AdapterView<any>, view:View, position:number, id:number):void ;\n        }\n        /**\n         * Interface definition for a callback to be invoked when an item in this\n         * view has been clicked and held.\n         */\n        export interface OnItemLongClickListener {\n\n            /**\n             * Callback method to be invoked when an item in this view has been\n             * clicked and held.\n             *\n             * Implementers can call getItemAtPosition(position) if they need to access\n             * the data associated with the selected item.\n             *\n             * @param parent The AbsListView where the click happened\n             * @param view The view within the AbsListView that was clicked\n             * @param position The position of the view in the list\n             * @param id The row id of the item that was clicked\n             *\n             * @return true if the callback consumed the long click, false otherwise\n             */\n            onItemLongClick(parent:AdapterView<any>, view:View, position:number, id:number):boolean ;\n        }\n        /**\n         * Interface definition for a callback to be invoked when\n         * an item in this view has been selected.\n         */\n        export interface OnItemSelectedListener {\n\n            /**\n             * <p>Callback method to be invoked when an item in this view has been\n             * selected. This callback is invoked only when the newly selected\n             * position is different from the previously selected position or if\n             * there was no selected item.</p>\n             *\n             * Impelmenters can call getItemAtPosition(position) if they need to access the\n             * data associated with the selected item.\n             *\n             * @param parent The AdapterView where the selection happened\n             * @param view The view within the AdapterView that was clicked\n             * @param position The position of the view in the adapter\n             * @param id The row id of the item that is selected\n             */\n            onItemSelected(parent:AdapterView<any>, view:View, position:number, id:number):void ;\n\n            /**\n             * Callback method to be invoked when the selection disappears from this\n             * view. The selection can disappear for instance when touch is activated\n             * or when the adapter becomes empty.\n             *\n             * @param parent The AdapterView that now contains no selected item.\n             */\n            onNothingSelected(parent:AdapterView<any>):void ;\n        }\n        /**\n         * Extra menu information provided to the\n         * {@link android.view.View.OnCreateContextMenuListener#onCreateContextMenu(ContextMenu, View, ContextMenuInfo) }\n         * callback when a context menu is brought up for this AdapterView.\n         *\n         */\n        //export class AdapterContextMenuInfo implements ContextMenu.ContextMenuInfo {\n        //\n        //    constructor(targetView:View, position:number, id:number) {\n        //        this.targetView = targetView;\n        //        this.position = position;\n        //        this.id = id;\n        //    }\n        //\n        //    /**\n        //     * The child view for which the context menu is being displayed. This\n        //     * will be one of the children of this AdapterView.\n        //     */\n        //    targetView:View;\n        //\n        //    /**\n        //     * The position in the adapter for which the context menu is being\n        //     * displayed.\n        //     */\n        //    position:number;\n        //\n        //    /**\n        //     * The row id of the item for which the context menu is being displayed.\n        //     */\n        //    id:number;\n        //}\n\n        export class AdapterDataSetObserver extends DataSetObserver {\n            AdapterView_this:AdapterView<any>;\n            //private mInstanceState:Parcelable = null;\n            constructor(AdapterView_this:AdapterView<any>){\n                super();\n                this.AdapterView_this = AdapterView_this;\n            }\n            onChanged():void  {\n                this.AdapterView_this.mDataChanged = true;\n                this.AdapterView_this.mOldItemCount = this.AdapterView_this.mItemCount;\n                this.AdapterView_this.mItemCount = this.AdapterView_this.getAdapter().getCount();\n                // been repopulated with new data.\n                //if (this.AdapterView_this.getAdapter().hasStableIds() && this.AdapterView_this.mInstanceState != null\n                //    && this.AdapterView_this.mOldItemCount == 0 && this.AdapterView_this.mItemCount > 0) {\n                //    this.AdapterView_this.onRestoreInstanceState(this.AdapterView_this.mInstanceState);\n                //    this.AdapterView_this.mInstanceState = null;\n                //} else {\n                this.AdapterView_this.rememberSyncState();\n                //}\n                this.AdapterView_this.checkFocus();\n                this.AdapterView_this.requestLayout();\n            }\n\n            onInvalidated():void  {\n                this.AdapterView_this.mDataChanged = true;\n                //if (AdapterView.this.AdapterView_this.getAdapter().hasStableIds()) {\n                //    // Remember the current state for the case where our hosting activity is being\n                //    // stopped and later restarted\n                //    this.AdapterView_this.mInstanceState = AdapterView.this.AdapterView_this.onSaveInstanceState();\n                //}\n                // Data is invalid so we should reset our state\n                this.AdapterView_this.mOldItemCount = this.AdapterView_this.mItemCount;\n                this.AdapterView_this.mItemCount = 0;\n                this.AdapterView_this.mSelectedPosition = AdapterView.INVALID_POSITION;\n                this.AdapterView_this.mSelectedRowId = AdapterView.INVALID_ROW_ID;\n                this.AdapterView_this.mNextSelectedPosition = AdapterView.INVALID_POSITION;\n                this.AdapterView_this.mNextSelectedRowId = AdapterView.INVALID_ROW_ID;\n                this.AdapterView_this.mNeedSync = false;\n                this.AdapterView_this.checkFocus();\n                this.AdapterView_this.requestLayout();\n            }\n\n            clearSavedState():void  {\n                //this.AdapterView_this.mInstanceState = null;\n            }\n        }\n    }\n    class SelectionNotifier implements Runnable {\n        AdapterView_this:AdapterView<any>;\n        constructor(AdapterView_this:AdapterView<any>){\n            this.AdapterView_this = AdapterView_this;\n        }\n\n        run():void  {\n            if (this.AdapterView_this.mDataChanged) {\n                // has been synched to the new data.\n                if (this.AdapterView_this.getAdapter() != null) {\n                    this.AdapterView_this.post(this);\n                }\n            } else {\n                this.AdapterView_this.fireOnSelected();\n                this.AdapterView_this.performAccessibilityActionsOnSelected();\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "src/android/widget/ArrayAdapter.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/util/Log.ts\"/>\n///<reference path=\"../../android/view/LayoutInflater.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../java/util/ArrayList.ts\"/>\n///<reference path=\"../../java/util/Arrays.ts\"/>\n///<reference path=\"../../java/util/Collections.ts\"/>\n///<reference path=\"../../java/util/Comparator.ts\"/>\n///<reference path=\"../../java/util/List.ts\"/>\n///<reference path=\"../../android/widget/Adapter.ts\"/>\n///<reference path=\"../../android/widget/BaseAdapter.ts\"/>\n///<reference path=\"../../android/widget/ImageView.ts\"/>\n///<reference path=\"../../android/widget/ListView.ts\"/>\n///<reference path=\"../../android/widget/TextView.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n\nmodule android.widget {\nimport Log = android.util.Log;\nimport LayoutInflater = android.view.LayoutInflater;\nimport View = android.view.View;\nimport ViewGroup = android.view.ViewGroup;\nimport ArrayList = java.util.ArrayList;\nimport Arrays = java.util.Arrays;\nimport Collections = java.util.Collections;\nimport Comparator = java.util.Comparator;\nimport List = java.util.List;\nimport Adapter = android.widget.Adapter;\nimport BaseAdapter = android.widget.BaseAdapter;\nimport ImageView = android.widget.ImageView;\nimport ListView = android.widget.ListView;\nimport TextView = android.widget.TextView;\nimport Context = android.content.Context;\n/**\n * A concrete BaseAdapter that is backed by an array of arbitrary\n * objects.  By default this class expects that the provided resource id references\n * a single TextView.  If you want to use a more complex layout, use the constructors that\n * also takes a field id.  That field id should reference a TextView in the larger layout\n * resource.\n *\n * <p>However the TextView is referenced, it will be filled with the toString() of each object in\n * the array. You can add lists or arrays of custom objects. Override the toString() method\n * of your objects to determine what text will be displayed for the item in the list.\n *\n * <p>To use something other than TextViews for the array display, for instance, ImageViews,\n * or to have some of data besides toString() results fill the views,\n * override {@link #getView(int, View, ViewGroup)} to return the type of view you want.\n */\nexport class ArrayAdapter<T> extends BaseAdapter {\n\n    /**\n     * Contains the list of objects that represent the data of this ArrayAdapter.\n     * The content of this list is referred to as \"the array\" in the documentation.\n     */\n    private mObjects:List<T>;\n\n    ///**\n    // * Lock used to modify the content of {@link #mObjects}. Any write operation\n    // * performed on the array should be synchronized on this lock. This lock is also\n    // * used by the filter (see {@link #getFilter()} to make a synchronized copy of\n    // * the original array of data.\n    // */\n    //private mLock:any = new any();\n\n    /**\n     * The resource indicating what views to inflate to display the content of this\n     * array adapter.\n     */\n    private mResource:string;\n\n    /**\n     * The resource indicating what views to inflate to display the content of this\n     * array adapter in a drop down widget.\n     */\n    private mDropDownResource:string;\n\n    /**\n     * If the inflated resource is not a TextView, {@link #mFieldId} is used to find\n     * a TextView inside the inflated views hierarchy. This field must contain the\n     * identifier that matches the one defined in the resource file.\n     */\n    private mFieldId:string;\n\n    /**\n     * Indicates whether or not {@link #notifyDataSetChanged()} must be called whenever\n     * {@link #mObjects} is modified.\n     */\n    private mNotifyOnChange:boolean = true;\n\n    private mContext:Context;\n\n    //// A copy of the original mObjects array, initialized from and then used instead as soon as\n    //// the mFilter ArrayFilter is used. mObjects will then only contain the filtered values.\n    //private mOriginalValues:ArrayList<T>;\n    //\n    //private mFilter:ArrayAdapter.ArrayFilter;\n\n    private mInflater:LayoutInflater;\n\n    /**\n     * Constructor\n     *\n     * @param context The current context.\n     * @param resource The resource ID for a layout file containing a TextView to use when\n     *                 instantiating views.\n     */\n    constructor(context: Context, resource: string);\n    /**\n     * Constructor\n     *\n     * @param context The current context.\n     * @param resource The resource ID for a layout file containing a layout to use when\n     *                 instantiating views.\n     * @param textViewResourceId The id of the TextView within the layout resource to be populated\n     */\n    constructor(context: Context, resource: string, textViewResourceId: string);\n    /**\n     * Constructor\n     *\n     * @param context The current context.\n     * @param resource The resource ID for a layout file containing a TextView to use when\n     *                 instantiating views.\n     * @param objects The objects to represent in the ListView.\n     */\n    constructor(context: Context, resource: string, objects: T[]);\n    /**\n     * Constructor\n     *\n     * @param context The current context.\n     * @param resource The resource ID for a layout file containing a layout to use when\n     *                 instantiating views.\n     * @param textViewResourceId The id of the TextView within the layout resource to be populated\n     * @param objects The objects to represent in the ListView.\n     */\n    constructor(context: Context, resource: string, textViewResourceId: string, objects: T[]|List<T>);\n    constructor(...args) {\n        super();\n        if (args.length === 2) {\n            this.init(args[0], args[1], null, new ArrayList<T>());\n        } else if (args.length === 3) {\n            if (args[2] instanceof Array) {\n                this.init(args[0], args[1], null, <List<T>>Arrays.asList(args[2]));\n            } else {\n                this.init(args[0], args[1], args[2], new ArrayList<T>());\n            }\n        } else if (args.length === 4) {\n            this.init(args[0], args[1], args[2], args[3]);\n        }\n    }\n\n    /**\n     * Adds the specified object at the end of the array.\n     *\n     * @param object The object to add at the end of the array.\n     */\n    add(object:T):void  {\n        {\n            //if (this.mOriginalValues != null) {\n            //    this.mOriginalValues.add(object);\n            //} else {\n                this.mObjects.add(object);\n            //}\n        }\n        if (this.mNotifyOnChange)\n            this.notifyDataSetChanged();\n    }\n\n    /**\n     * Adds the specified Collection at the end of the array.\n     *\n     * @param collection The Collection to add at the end of the array.\n     */\n    addAll(collection:List<T>):void  {\n        {\n            //if (this.mOriginalValues != null) {\n            //    this.mOriginalValues.addAll(collection);\n            //} else {\n                this.mObjects.addAll(collection);\n            //}\n        }\n        if (this.mNotifyOnChange)\n            this.notifyDataSetChanged();\n    }\n\n    ///**\n    // * Adds the specified items at the end of the array.\n    // *\n    // * @param items The items to add at the end of the array.\n    // */\n    //addAll(...items:T):void  {\n    //    {\n    //        if (this.mOriginalValues != null) {\n    //            Collections.addAll(this.mOriginalValues, items);\n    //        } else {\n    //            Collections.addAll(this.mObjects, items);\n    //        }\n    //    }\n    //    if (this.mNotifyOnChange)\n    //        this.notifyDataSetChanged();\n    //}\n\n    /**\n     * Inserts the specified object at the specified index in the array.\n     *\n     * @param object The object to insert into the array.\n     * @param index The index at which the object must be inserted.\n     */\n    insert(object:T, index:number):void  {\n        {\n            //if (this.mOriginalValues != null) {\n            //    this.mOriginalValues.add(index, object);\n            //} else {\n                this.mObjects.add(index, object);\n            //}\n        }\n        if (this.mNotifyOnChange)\n            this.notifyDataSetChanged();\n    }\n\n    /**\n     * Removes the specified object from the array.\n     *\n     * @param object The object to remove.\n     */\n    remove(object:T):void  {\n        {\n            //if (this.mOriginalValues != null) {\n            //    this.mOriginalValues.remove(object);\n            //} else {\n                this.mObjects.remove(object);\n            //}\n        }\n        if (this.mNotifyOnChange)\n            this.notifyDataSetChanged();\n    }\n\n    /**\n     * Remove all elements from the list.\n     */\n    clear():void  {\n        {\n            //if (this.mOriginalValues != null) {\n            //    this.mOriginalValues.clear();\n            //} else {\n                this.mObjects.clear();\n            //}\n        }\n        if (this.mNotifyOnChange)\n            this.notifyDataSetChanged();\n    }\n\n    /**\n     * Sorts the content of this adapter using the specified comparator.\n     *\n     * @param comparator The comparator used to sort the objects contained\n     *        in this adapter.\n     */\n    sort(comparator:Comparator<T>):void  {\n        {\n            //if (this.mOriginalValues != null) {\n            //    Collections.sort(this.mOriginalValues, comparator);\n            //} else {\n                Collections.sort(this.mObjects, comparator);\n            //}\n        }\n        if (this.mNotifyOnChange)\n            this.notifyDataSetChanged();\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    notifyDataSetChanged():void  {\n        super.notifyDataSetChanged();\n        this.mNotifyOnChange = true;\n    }\n\n    /**\n     * Control whether methods that change the list ({@link #add},\n     * {@link #insert}, {@link #remove}, {@link #clear}) automatically call\n     * {@link #notifyDataSetChanged}.  If set to false, caller must\n     * manually call notifyDataSetChanged() to have the changes\n     * reflected in the attached view.\n     *\n     * The default is true, and calling notifyDataSetChanged()\n     * resets the flag to true.\n     *\n     * @param notifyOnChange if true, modifications to the list will\n     *                       automatically call {@link\n     *                       #notifyDataSetChanged}\n     */\n    setNotifyOnChange(notifyOnChange:boolean):void  {\n        this.mNotifyOnChange = notifyOnChange;\n    }\n\n    private init(context:Context, resource:string, textViewResourceId:string, objects:T[]|List<T>):void  {\n        this.mContext = context;\n        this.mInflater = context.getLayoutInflater();\n        this.mResource = this.mDropDownResource = resource;\n        if(objects instanceof Array) objects = Arrays.asList(<T[]>objects);\n        this.mObjects = <List<T>>objects;\n        this.mFieldId = textViewResourceId;\n    }\n\n    /**\n     * Returns the context associated with this array adapter. The context is used\n     * to create views from the resource passed to the constructor.\n     *\n     * @return The Context associated with this adapter.\n     */\n    getContext():Context  {\n        return this.mContext;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    getCount():number  {\n        return this.mObjects.size();\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    getItem(position:number):T  {\n        return this.mObjects.get(position);\n    }\n\n    /**\n     * Returns the position of the specified item in the array.\n     *\n     * @param item The item to retrieve the position of.\n     *\n     * @return The position of the specified item.\n     */\n    getPosition(item:T):number  {\n        return this.mObjects.indexOf(item);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    getItemId(position:number):number  {\n        return position;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    getView(position:number, convertView:View, parent:ViewGroup):View  {\n        return this.createViewFromResource(position, convertView, parent, this.mResource);\n    }\n\n    private createViewFromResource(position:number, convertView:View, parent:ViewGroup, resource:string):View  {\n        let view:View;\n        let text:TextView;\n        if (convertView == null) {\n            view = this.mInflater.inflate(this.mContext.getResources().getLayout(resource), parent, false);\n        } else {\n            view = convertView;\n        }\n        try {\n            if (this.mFieldId == null) {\n                //  If no custom field is assigned, assume the whole resource is a TextView\n                text = <TextView> view;\n            } else {\n                //  Otherwise, find the TextView field within the layout\n                text = <TextView> view.findViewById(this.mFieldId);\n            }\n        } catch (e){\n            Log.e(\"ArrayAdapter\", \"You must supply a resource ID for a TextView\");\n            throw Error(`new IllegalStateException(\"ArrayAdapter requires the resource ID to be a TextView\", e)`);\n        }\n        let item:T = this.getItem(position);\n        if (typeof item === 'string') {\n            text.setText(<string><any>item);\n        } else {\n            text.setText(item.toString());\n        }\n        return view;\n    }\n\n    /**\n     * <p>Sets the layout resource to create the drop down views.</p>\n     *\n     * @param resource the layout resource defining the drop down views\n     * @see #getDropDownView(int, android.view.View, android.view.ViewGroup)\n     */\n    setDropDownViewResource(resource:string):void  {\n        this.mDropDownResource = resource;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    getDropDownView(position:number, convertView:View, parent:ViewGroup):View  {\n        return this.createViewFromResource(position, convertView, parent, this.mDropDownResource);\n    }\n\n    ///**\n    // * Creates a new ArrayAdapter from external resources. The content of the array is\n    // * obtained through {@link android.content.res.Resources#getTextArray(int)}.\n    // *\n    // * @param context The application's environment.\n    // * @param textArrayResId The identifier of the array to use as the data source.\n    // * @param textViewResId The identifier of the layout used to create views.\n    // *\n    // * @return An ArrayAdapter<CharSequence>.\n    // */\n    //static createFromResource(context:Context, textArrayResId:number, textViewResId:number):ArrayAdapter<string>  {\n    //    let strings:string[] = context.getResources().getTextArray(textArrayResId);\n    //    return new ArrayAdapter<string>(context, textViewResId, strings);\n    //}\n\n    ///**\n    // * {@inheritDoc}\n    // */\n    //getFilter():Filter  {\n    //    if (this.mFilter == null) {\n    //        this.mFilter = new ArrayAdapter.ArrayFilter(this);\n    //    }\n    //    return this.mFilter;\n    //}\n\n\n}\n\nexport module ArrayAdapter{\n///**\n//     * <p>An array filter constrains the content of the array adapter with\n//     * a prefix. Each item that does not start with the supplied prefix\n//     * is removed from the list.</p>\n//     */\n//export class ArrayFilter extends Filter {\n//    _ArrayAdapter_this:ArrayAdapter;\n//    constructor(arg:ArrayAdapter){\n//        super();\n//        this._ArrayAdapter_this = arg;\n//    }\n//\n//    protected performFiltering(prefix:string):Filter.FilterResults  {\n//        let results:Filter.FilterResults = new Filter.FilterResults();\n//        if (this._ArrayAdapter_this.mOriginalValues == null) {\n//            {\n//                this._ArrayAdapter_this.mOriginalValues = new ArrayList<T>(this._ArrayAdapter_this.mObjects);\n//            }\n//        }\n//        if (prefix == null || prefix.length() == 0) {\n//            let list:ArrayList<T>;\n//            {\n//                list = new ArrayList<T>(this._ArrayAdapter_this.mOriginalValues);\n//            }\n//            results.values = list;\n//            results.count = list.size();\n//        } else {\n//            let prefixString:string = prefix.toString().toLowerCase();\n//            let values:ArrayList<T>;\n//            {\n//                values = new ArrayList<T>(this._ArrayAdapter_this.mOriginalValues);\n//            }\n//            const count:number = values.size();\n//            const newValues:ArrayList<T> = new ArrayList<T>();\n//            for (let i:number = 0; i < count; i++) {\n//                const value:T = values.get(i);\n//                const valueText:string = value.toString().toLowerCase();\n//                // First match against the whole, non-splitted value\n//                if (valueText.startsWith(prefixString)) {\n//                    newValues.add(value);\n//                } else {\n//                    const words:string[] = valueText.split(\" \");\n//                    const wordCount:number = words.length;\n//                    // Start at index 0, in case valueText starts with space(s)\n//                    for (let k:number = 0; k < wordCount; k++) {\n//                        if (words[k].startsWith(prefixString)) {\n//                            newValues.add(value);\n//                            break;\n//                        }\n//                    }\n//                }\n//            }\n//            results.values = newValues;\n//            results.count = newValues.size();\n//        }\n//        return results;\n//    }\n//\n//    protected publishResults(constraint:string, results:Filter.FilterResults):void  {\n//        //noinspection unchecked\n//        this._ArrayAdapter_this.mObjects = <List<T>> results.values;\n//        if (results.count > 0) {\n//            this._ArrayAdapter_this.notifyDataSetChanged();\n//        } else {\n//            this._ArrayAdapter_this.notifyDataSetInvalidated();\n//        }\n//    }\n//}\n}\n\n}"
  },
  {
    "path": "src/android/widget/BaseAdapter.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/database/DataSetObservable.ts\"/>\n///<reference path=\"../../android/database/DataSetObserver.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/widget/Adapter.ts\"/>\n///<reference path=\"../../android/widget/ListAdapter.ts\"/>\n///<reference path=\"../../android/widget/ListView.ts\"/>\n///<reference path=\"../../android/widget/SpinnerAdapter.ts\"/>\n\nmodule android.widget {\nimport DataSetObservable = android.database.DataSetObservable;\nimport DataSetObserver = android.database.DataSetObserver;\nimport View = android.view.View;\nimport ViewGroup = android.view.ViewGroup;\nimport Adapter = android.widget.Adapter;\nimport ListAdapter = android.widget.ListAdapter;\nimport ListView = android.widget.ListView;\nimport SpinnerAdapter = android.widget.SpinnerAdapter;\n/**\n * Common base class of common implementation for an {@link Adapter} that can be\n * used in both {@link ListView} (by implementing the specialized\n * {@link ListAdapter} interface} and {@link Spinner} (by implementing the\n * specialized {@link SpinnerAdapter} interface.\n */\nexport abstract class BaseAdapter implements ListAdapter, SpinnerAdapter {\n\n    private mDataSetObservable:DataSetObservable = new DataSetObservable();\n\n    hasStableIds():boolean  {\n        return false;\n    }\n\n    registerDataSetObserver(observer:DataSetObserver):void  {\n        this.mDataSetObservable.registerObserver(observer);\n    }\n\n    unregisterDataSetObserver(observer:DataSetObserver):void  {\n        this.mDataSetObservable.unregisterObserver(observer);\n    }\n\n    /**\n     * Notifies the attached observers that the underlying data has been changed\n     * and any View reflecting the data set should refresh itself.\n     */\n    notifyDataSetChanged():void  {\n        this.mDataSetObservable.notifyChanged();\n    }\n\n    /**\n     * Notifies the attached observers that the underlying data is no longer valid\n     * or available. Once invoked this adapter is no longer valid and should\n     * not report further data set changes.\n     */\n    notifyDataSetInvalidated():void  {\n        this.mDataSetObservable.notifyInvalidated();\n    }\n\n    areAllItemsEnabled():boolean  {\n        return true;\n    }\n\n    isEnabled(position:number):boolean  {\n        return true;\n    }\n\n    getDropDownView(position:number, convertView:View, parent:ViewGroup):View  {\n        return this.getView(position, convertView, parent);\n    }\n\n    getItemViewType(position:number):number  {\n        return 0;\n    }\n\n    getViewTypeCount():number  {\n        return 1;\n    }\n\n    isEmpty():boolean  {\n        return this.getCount() == 0;\n    }\n\n    //abstract method impl from interface\n\n    abstract getView(position:number, convertView:View, parent:ViewGroup):View ;\n\n\n    abstract getCount():number ;\n\n    abstract getItem(position:number):any;\n\n    abstract getItemId(position:number):number;\n}\n}"
  },
  {
    "path": "src/android/widget/BaseExpandableListAdapter.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/database/DataSetObservable.ts\"/>\n///<reference path=\"../../android/database/DataSetObserver.ts\"/>\n///<reference path=\"../../android/widget/Adapter.ts\"/>\n///<reference path=\"../../android/widget/ExpandableListAdapter.ts\"/>\n///<reference path=\"../../android/widget/HeterogeneousExpandableList.ts\"/>\n///<reference path=\"../../android/widget/ListAdapter.ts\"/>\n///<reference path=\"../../androidui/util/Long.ts\"/>\n\nmodule android.widget {\nimport DataSetObservable = android.database.DataSetObservable;\nimport DataSetObserver = android.database.DataSetObserver;\nimport Adapter = android.widget.Adapter;\nimport ExpandableListAdapter = android.widget.ExpandableListAdapter;\nimport HeterogeneousExpandableList = android.widget.HeterogeneousExpandableList;\nimport ListAdapter = android.widget.ListAdapter;\nimport Long = goog.math.Long;\n\n\n    const _0x8000000000000000 = Long.fromNumber(0x8000000000000000);\n    const _0x7FFFFFFF = Long.fromNumber(0x7FFFFFFF);\n    const _0xFFFFFFFF = Long.fromNumber(0xFFFFFFFF);\n\n/**\n * Base class for a {@link ExpandableListAdapter} used to provide data and Views\n * from some data to an expandable list view.\n * <p>\n * Adapters inheriting this class should verify that the base implementations of\n * {@link #getCombinedChildId(long, long)} and {@link #getCombinedGroupId(long)}\n * are correct in generating unique IDs from the group/children IDs.\n * <p>\n * @see SimpleExpandableListAdapter\n * @see SimpleCursorTreeAdapter\n */\nexport abstract class BaseExpandableListAdapter implements ExpandableListAdapter, HeterogeneousExpandableList {\n\n    private mDataSetObservable:DataSetObservable = new DataSetObservable();\n\n    registerDataSetObserver(observer:DataSetObserver):void  {\n        this.mDataSetObservable.registerObserver(observer);\n    }\n\n    unregisterDataSetObserver(observer:DataSetObserver):void  {\n        this.mDataSetObservable.unregisterObserver(observer);\n    }\n\n    /**\n     * @see DataSetObservable#notifyInvalidated()\n     */\n    notifyDataSetInvalidated():void  {\n        this.mDataSetObservable.notifyInvalidated();\n    }\n\n    /**\n     * @see DataSetObservable#notifyChanged()\n     */\n    notifyDataSetChanged():void  {\n        this.mDataSetObservable.notifyChanged();\n    }\n\n    areAllItemsEnabled():boolean  {\n        return true;\n    }\n\n    onGroupCollapsed(groupPosition:number):void  {\n    }\n\n    onGroupExpanded(groupPosition:number):void  {\n    }\n\n    /**\n     * Override this method if you foresee a clash in IDs based on this scheme:\n     * <p>\n     * Base implementation returns a long:\n     * <li> bit 0: Whether this ID points to a child (unset) or group (set), so for this method\n     *             this bit will be 1.\n     * <li> bit 1-31: Lower 31 bits of the groupId\n     * <li> bit 32-63: Lower 32 bits of the childId.\n     * <p> \n     * {@inheritDoc}\n     */\n    getCombinedChildId(groupId:number, childId:number):number  {\n        //return 0x8000000000000000 | ((groupId & 0x7FFFFFFF) << 32) | (childId & 0xFFFFFFFF);\n        const _groupId = Long.fromNumber(groupId);\n        const _childId = Long.fromNumber(childId);\n        return _0x8000000000000000.or(_groupId.and(_0x7FFFFFFF).shiftLeft(32)).or(_childId.and(_0xFFFFFFFF)).toNumber();\n    }\n\n    /**\n     * Override this method if you foresee a clash in IDs based on this scheme:\n     * <p>\n     * Base implementation returns a long:\n     * <li> bit 0: Whether this ID points to a child (unset) or group (set), so for this method\n     *             this bit will be 0.\n     * <li> bit 1-31: Lower 31 bits of the groupId\n     * <li> bit 32-63: Lower 32 bits of the childId.\n     * <p> \n     * {@inheritDoc}\n     */\n    getCombinedGroupId(groupId:number):number  {\n        //return (groupId & 0x7FFFFFFF) << 32;\n        const _groupId = Long.fromNumber(groupId);\n        return _groupId.add(_0x7FFFFFFF).shiftLeft(32).toNumber();\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    isEmpty():boolean  {\n        return this.getGroupCount() == 0;\n    }\n\n    /**\n     * {@inheritDoc}\n     * @return 0 for any group or child position, since only one child type count is declared.\n     */\n    getChildType(groupPosition:number, childPosition:number):number  {\n        return 0;\n    }\n\n    /**\n     * {@inheritDoc}\n     * @return 1 as a default value in BaseExpandableListAdapter.\n     */\n    getChildTypeCount():number  {\n        return 1;\n    }\n\n    /**\n     * {@inheritDoc}\n     * @return 0 for any groupPosition, since only one group type count is declared.\n     */\n    getGroupType(groupPosition:number):number  {\n        return 0;\n    }\n\n    /**\n     * {@inheritDoc}\n     * @return 1 as a default value in BaseExpandableListAdapter.\n     */\n    getGroupTypeCount():number  {\n        return 1;\n    }\n\n\n    abstract getGroupCount():number;\n\n    abstract getChildrenCount(groupPosition:number):number;\n\n    abstract getGroup(groupPosition:number):any;\n\n    abstract getChild(groupPosition:number, childPosition:number):any;\n\n    abstract getGroupId(groupPosition:number):number;\n\n    abstract getChildId(groupPosition:number, childPosition:number):number;\n\n    abstract hasStableIds():boolean;\n\n    abstract getGroupView(groupPosition:number, isExpanded:boolean, convertView:android.view.View, parent:android.view.ViewGroup):android.view.View;\n\n    abstract getChildView(groupPosition:number, childPosition:number, isLastChild:boolean,\n                 convertView:android.view.View, parent:android.view.ViewGroup):android.view.View;\n\n    abstract isChildSelectable(groupPosition:number, childPosition:number):boolean;\n}\n}"
  },
  {
    "path": "src/android/widget/Button.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"TextView.ts\"/>\n///<reference path=\"../view/View.ts\"/>\n///<reference path=\"../R/attr.ts\"/>\n\nmodule android.widget{\n    import View = android.view.View;\n    import Gravity = android.view.Gravity;\n\n    /**\n     * Represents a push-button widget. Push-buttons can be\n     * pressed, or clicked, by the user to perform an action.\n\n     * <p>A typical use of a push-button in an activity would be the following:\n     * </p>\n     *\n     * <pre>\n     * public class MyActivity extends Activity {\n     *     protected void onCreate(Bundle icicle) {\n     *         super.onCreate(icicle);\n     *\n     *         setContentView(R.layout.content_layout_id);\n     *\n     *         final Button button = (Button) findViewById(R.id.button_id);\n     *         button.setOnClickListener(new View.OnClickListener() {\n     *             public void onClick(View v) {\n     *                 // Perform action on click\n     *             }\n     *         });\n     *     }\n     * }</pre>\n     *\n     * <p>However, instead of applying an {@link android.view.View.OnClickListener OnClickListener} to\n     * the button in your activity, you can assign a method to your button in the XML layout,\n     * using the {@link android.R.attr#onClick android:onClick} attribute. For example:</p>\n     *\n     * <pre>\n     * &lt;Button\n     *     android:layout_height=\"wrap_content\"\n     *     android:layout_width=\"wrap_content\"\n     *     android:text=\"@string/self_destruct\"\n     *     android:onClick=\"selfDestruct\" /&gt;</pre>\n     *\n     * <p>Now, when a user clicks the button, the Android system calls the activity's {@code\n     * selfDestruct(View)} method. In order for this to work, the method must be public and accept\n     * a {@link android.view.View} as its only parameter. For example:</p>\n     *\n     * <pre>\n     * public void selfDestruct(View view) {\n     *     // Kabloey\n     * }</pre>\n     *\n     * <p>The {@link android.view.View} passed into the method is a reference to the widget\n     * that was clicked.</p>\n     *\n     * <h3>Button style</h3>\n     *\n     * <p>Every Button is styled using the system's default button background, which is often different\n     * from one device to another and from one version of the platform to another. If you're not\n     * satisfied with the default button style and want to customize it to match the design of your\n     * application, then you can replace the button's background image with a <a\n     * href=\"{@docRoot}guide/topics/resources/drawable-resource.html#StateList\">state list drawable</a>.\n     * A state list drawable is a drawable resource defined in XML that changes its image based on\n     * the current state of the button. Once you've defined a state list drawable in XML, you can apply\n     * it to your Button with the {@link android.R.attr#background android:background}\n     * attribute. For more information and an example, see <a\n     * href=\"{@docRoot}guide/topics/resources/drawable-resource.html#StateList\">State List\n     * Drawable</a>.</p>\n     *\n     * <p>See the <a href=\"{@docRoot}guide/topics/ui/controls/button.html\">Buttons</a>\n     * guide.</p>\n     *\n     * <p><strong>XML attributes</strong></p>\n     * <p>\n     * See {@link android.R.styleable#Button Button Attributes},\n     * {@link android.R.styleable#TextView TextView Attributes},\n     * {@link android.R.styleable#View View Attributes}\n     * </p>\n     */\n    export class Button extends TextView{\n        constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle = android.R.attr.buttonStyle) {\n            super(context, bindElement, defStyle);\n        }\n    }\n}"
  },
  {
    "path": "src/android/widget/CheckBox.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/widget/Button.ts\"/>\n///<reference path=\"../../android/widget/CompoundButton.ts\"/>\n///<reference path=\"../../android/widget/TextView.ts\"/>\n///<reference path=\"../../android/R/attr.ts\"/>\n\nmodule android.widget {\n    import Button = android.widget.Button;\n    import CompoundButton = android.widget.CompoundButton;\n    import TextView = android.widget.TextView;\n    /**\n     * <p>\n     * A checkbox is a specific type of two-states button that can be either\n     * checked or unchecked. A example usage of a checkbox inside your activity\n     * would be the following:\n     * </p>\n     *\n     * <pre class=\"prettyprint\">\n     * public class MyActivity extends Activity {\n *     protected void onCreate(Bundle icicle) {\n *         super.onCreate(icicle);\n *\n *         setContentView(R.layout.content_layout_id);\n *\n *         final CheckBox checkBox = (CheckBox) findViewById(R.id.checkbox_id);\n *         if (checkBox.isChecked()) {\n *             checkBox.setChecked(false);\n *         }\n *     }\n * }\n     * </pre>\n     *\n     * <p>See the <a href=\"{@docRoot}guide/topics/ui/controls/checkbox.html\">Checkboxes</a>\n     * guide.</p>\n     *\n     * <p><strong>XML attributes</strong></p>\n     * <p>\n     * See {@link android.R.styleable#CompoundButton CompoundButton Attributes},\n     * {@link android.R.styleable#Button Button Attributes},\n     * {@link android.R.styleable#TextView TextView Attributes},\n     * {@link android.R.styleable#View View Attributes}\n     * </p>\n     */\n    export class CheckBox extends CompoundButton {\n\n        constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle = android.R.attr.checkboxStyle) {\n            super(context, bindElement, defStyle);\n        }\n    }\n}"
  },
  {
    "path": "src/android/widget/Checkable.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\nmodule android.widget {\n/**\n * Defines an extension for views that make them checkable.\n *\n */\nexport interface Checkable {\n\n    /**\n     * Change the checked state of the view\n     * \n     * @param checked The new checked state\n     */\n    setChecked(checked:boolean):void ;\n\n    /**\n     * @return The current checked state of the view\n     */\n    isChecked():boolean ;\n\n    /**\n     * Change the checked state of the view to the inverse of its current state\n     *\n     */\n    toggle():void ;\n}\n}"
  },
  {
    "path": "src/android/widget/CheckedTextView.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/widget/Checkable.ts\"/>\n///<reference path=\"../../android/widget/ListView.ts\"/>\n///<reference path=\"../../android/widget/TextView.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n\nmodule android.widget {\nimport Canvas = android.graphics.Canvas;\nimport Drawable = android.graphics.drawable.Drawable;\nimport Gravity = android.view.Gravity;\nimport Checkable = android.widget.Checkable;\nimport ListView = android.widget.ListView;\nimport TextView = android.widget.TextView;\nimport View = android.view.View;\nimport Context = android.content.Context;\n    import AttrBinder = androidui.attr.AttrBinder;\n/**\n * An extension to TextView that supports the {@link android.widget.Checkable} interface.\n * This is useful when used in a {@link android.widget.ListView ListView} where the it's \n * {@link android.widget.ListView#setChoiceMode(int) setChoiceMode} has been set to\n * something other than {@link android.widget.ListView#CHOICE_MODE_NONE CHOICE_MODE_NONE}.\n *\n * @attr ref android.R.styleable#CheckedTextView_checked\n * @attr ref android.R.styleable#CheckedTextView_checkMark\n */\nexport class CheckedTextView extends TextView implements Checkable {\n\n    private mChecked:boolean;\n\n    private mCheckMarkResource:number = 0;\n\n    private mCheckMarkDrawable:Drawable;\n\n    private mBasePadding:number = 0;\n\n    private mCheckMarkWidth:number = 0;\n\n    private mNeedRequestlayout:boolean;\n\n    private static CHECKED_STATE_SET:number[] = [ View.VIEW_STATE_CHECKED ];\n\n    constructor(context:Context, bindElement?:HTMLElement, defStyle=R.attr.checkedTextViewStyle) {\n        super(context, bindElement, defStyle);\n\n        const a = context.obtainStyledAttributes(bindElement, defStyle);\n\n        const d = a.getDrawable('checkMark');\n        if (d != null) {\n            this.setCheckMarkDrawable(d);\n        }\n\n        const checked = a.getBoolean('checked', false);\n        this.setChecked(checked);\n\n        a.recycle();\n    }\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder().set('checkMark', {\n            setter(v:CheckedTextView, value:any, attrBinder:AttrBinder) {\n                v.setCheckMarkDrawable(attrBinder.parseDrawable(value));\n            }, getter(v:CheckedTextView) {\n                return v.getCheckMarkDrawable();\n            }\n        }).set('checked', {\n            setter(v:CheckedTextView, value:any, attrBinder:AttrBinder) {\n                v.setChecked(attrBinder.parseBoolean(value, false));\n            }, getter(v:CheckedTextView) {\n                return v.isChecked();\n            }\n        });\n    }\n\n    toggle():void  {\n        this.setChecked(!this.mChecked);\n    }\n\n    isChecked():boolean  {\n        return this.mChecked;\n    }\n\n    /**\n     * <p>Changes the checked state of this text view.</p>\n     *\n     * @param checked true to check the text, false to uncheck it\n     */\n    setChecked(checked:boolean):void  {\n        if (this.mChecked != checked) {\n            this.mChecked = checked;\n            this.refreshDrawableState();\n            //this.notifyViewAccessibilityStateChangedIfNeeded(AccessibilityEvent.CONTENT_CHANGE_TYPE_UNDEFINED);\n        }\n    }\n\n    ///**\n    // * Set the checkmark to a given Drawable, identified by its resourece id. This will be drawn\n    // * when {@link #isChecked()} is true.\n    // *\n    // * @param resid The Drawable to use for the checkmark.\n    // *\n    // * @see #setCheckMarkDrawable(Drawable)\n    // * @see #getCheckMarkDrawable()\n    // *\n    // * @attr ref android.R.styleable#CheckedTextView_checkMark\n    // */\n    //setCheckMarkDrawable(resid:number):void  {\n    //    if (resid != 0 && resid == this.mCheckMarkResource) {\n    //        return;\n    //    }\n    //    this.mCheckMarkResource = resid;\n    //    let d:Drawable = null;\n    //    if (this.mCheckMarkResource != 0) {\n    //        d = this.getResources().getDrawable(this.mCheckMarkResource);\n    //    }\n    //    this.setCheckMarkDrawable(d);\n    //}\n\n    /**\n     * Set the checkmark to a given Drawable. This will be drawn when {@link #isChecked()} is true.\n     *\n     * @param d The Drawable to use for the checkmark.\n     *\n     * @see #setCheckMarkDrawable(int)\n     * @see #getCheckMarkDrawable()\n     *\n     * @attr ref android.R.styleable#CheckedTextView_checkMark\n     */\n    setCheckMarkDrawable(d:Drawable):void  {\n        if (this.mCheckMarkDrawable != null) {\n            this.mCheckMarkDrawable.setCallback(null);\n            this.unscheduleDrawable(this.mCheckMarkDrawable);\n        }\n        this.mNeedRequestlayout = (d != this.mCheckMarkDrawable);\n        if (d != null) {\n            d.setCallback(this);\n            d.setVisible(this.getVisibility() == CheckedTextView.VISIBLE, false);\n            d.setState(CheckedTextView.CHECKED_STATE_SET);\n            this.setMinHeight(d.getIntrinsicHeight());\n            this.mCheckMarkWidth = d.getIntrinsicWidth();\n            d.setState(this.getDrawableState());\n        } else {\n            this.mCheckMarkWidth = 0;\n        }\n        this.mCheckMarkDrawable = d;\n        // Do padding resolution. This will call internalSetPadding() and do a requestLayout() if needed.\n        this.resolvePadding();\n    }\n\n    /**\n     * Gets the checkmark drawable\n     *\n     * @return The drawable use to represent the checkmark, if any.\n     *\n     * @see #setCheckMarkDrawable(Drawable)\n     * @see #setCheckMarkDrawable(int)\n     *\n     * @attr ref android.R.styleable#CheckedTextView_checkMark\n     */\n    getCheckMarkDrawable():Drawable  {\n        return this.mCheckMarkDrawable;\n    }\n\n    ///**\n    // * @hide\n    // */\n    //protected internalSetPadding(left:number, top:number, right:number, bottom:number):void  {\n    //    super.internalSetPadding(left, top, right, bottom);\n    //    this.setBasePadding(this.isLayoutRtl());\n    //}\n\n    setPadding(left:number, top:number, right:number, bottom:number):void {\n        super.setPadding(left, top, right, bottom);\n        this.setBasePadding(this.isLayoutRtl());\n    }\n\n    //onRtlPropertiesChanged(layoutDirection:number):void  {\n    //    super.onRtlPropertiesChanged(layoutDirection);\n    //    this.updatePadding();\n    //}\n\n    private updatePadding():void  {\n        //this.resetPaddingToInitialValues();\n        let newPadding:number = (this.mCheckMarkDrawable != null) ? this.mCheckMarkWidth + this.mBasePadding : this.mBasePadding;\n        if (this.isLayoutRtl()) {\n            this.mNeedRequestlayout = (this.mPaddingLeft != newPadding) || this.mNeedRequestlayout;\n            this.mPaddingLeft = newPadding;\n        } else {\n            this.mNeedRequestlayout = (this.mPaddingRight != newPadding) || this.mNeedRequestlayout;\n            this.mPaddingRight = newPadding;\n        }\n        if (this.mNeedRequestlayout) {\n            this.requestLayout();\n            this.mNeedRequestlayout = false;\n        }\n    }\n\n    private setBasePadding(isLayoutRtl:boolean):void  {\n        if (isLayoutRtl) {\n            this.mBasePadding = this.mPaddingLeft;\n        } else {\n            this.mBasePadding = this.mPaddingRight;\n        }\n    }\n\n    protected onDraw(canvas:Canvas):void  {\n        super.onDraw(canvas);\n        const checkMarkDrawable:Drawable = this.mCheckMarkDrawable;\n        if (checkMarkDrawable != null) {\n            const verticalGravity:number = this.getGravity() & Gravity.VERTICAL_GRAVITY_MASK;\n            const height:number = checkMarkDrawable.getIntrinsicHeight();\n            let y:number = 0;\n            switch(verticalGravity) {\n                case Gravity.BOTTOM:\n                    y = this.getHeight() - height;\n                    break;\n                case Gravity.CENTER_VERTICAL:\n                    y = (this.getHeight() - height) / 2;\n                    break;\n            }\n            const isLayoutRtl:boolean = this.isLayoutRtl();\n            const width:number = this.getWidth();\n            const top:number = y;\n            const bottom:number = top + height;\n            let left:number;\n            let right:number;\n            if (isLayoutRtl) {\n                left = this.mBasePadding;\n                right = left + this.mCheckMarkWidth;\n            } else {\n                right = width - this.mBasePadding;\n                left = right - this.mCheckMarkWidth;\n            }\n            checkMarkDrawable.setBounds(this.mScrollX + left, top, this.mScrollX + right, bottom);\n            checkMarkDrawable.draw(canvas);\n        }\n    }\n\n    protected onCreateDrawableState(extraSpace:number):number[]  {\n        const drawableState:number[] = super.onCreateDrawableState(extraSpace + 1);\n        if (this.isChecked()) {\n            CheckedTextView.mergeDrawableStates(drawableState, CheckedTextView.CHECKED_STATE_SET);\n        }\n        return drawableState;\n    }\n\n    protected drawableStateChanged():void  {\n        super.drawableStateChanged();\n        if (this.mCheckMarkDrawable != null) {\n            let myDrawableState:number[] = this.getDrawableState();\n            // Set the state of the Drawable\n            this.mCheckMarkDrawable.setState(myDrawableState);\n            this.invalidate();\n        }\n    }\n\n    //onInitializeAccessibilityEvent(event:AccessibilityEvent):void  {\n    //    super.onInitializeAccessibilityEvent(event);\n    //    event.setClassName(CheckedTextView.class.getName());\n    //    event.setChecked(this.mChecked);\n    //}\n    //\n    //onInitializeAccessibilityNodeInfo(info:AccessibilityNodeInfo):void  {\n    //    super.onInitializeAccessibilityNodeInfo(info);\n    //    info.setClassName(CheckedTextView.class.getName());\n    //    info.setCheckable(true);\n    //    info.setChecked(this.mChecked);\n    //}\n}\n}"
  },
  {
    "path": "src/android/widget/CompoundButton.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../java/lang/System.ts\"/>\n///<reference path=\"../../android/widget/Button.ts\"/>\n///<reference path=\"../../android/widget/Checkable.ts\"/>\n///<reference path=\"../../android/widget/TextView.ts\"/>\n\nmodule android.widget {\nimport Canvas = android.graphics.Canvas;\nimport Drawable = android.graphics.drawable.Drawable;\nimport Gravity = android.view.Gravity;\nimport View = android.view.View;\nimport Integer = java.lang.Integer;\nimport System = java.lang.System;\nimport Button = android.widget.Button;\nimport Checkable = android.widget.Checkable;\nimport TextView = android.widget.TextView;\n    import AttrBinder = androidui.attr.AttrBinder;\n/**\n * <p>\n * A button with two states, checked and unchecked. When the button is pressed\n * or clicked, the state changes automatically.\n * </p>\n *\n * <p><strong>XML attributes</strong></p>\n * <p>\n * See {@link android.R.styleable#CompoundButton\n * CompoundButton Attributes}, {@link android.R.styleable#Button Button\n * Attributes}, {@link android.R.styleable#TextView TextView Attributes}, {@link\n * android.R.styleable#View View Attributes}\n * </p>\n */\nexport abstract class CompoundButton extends Button implements Checkable {\n\n    private mChecked:boolean;\n\n    private mButtonResource:number = 0;\n\n    private mBroadcasting:boolean;\n\n    private mButtonDrawable:Drawable;\n\n    private mOnCheckedChangeListener:CompoundButton.OnCheckedChangeListener;\n\n    private mOnCheckedChangeWidgetListener:CompoundButton.OnCheckedChangeListener;\n\n    private static CHECKED_STATE_SET:number[] = [ View.VIEW_STATE_CHECKED ];\n\n    constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n        super(context, bindElement, defStyle);\n        const a = context.obtainStyledAttributes(bindElement, defStyle);\n\n        const d = a.getDrawable('button');\n        if (d != null) {\n            this.setButtonDrawable(d);\n        }\n\n        const checked = a.getBoolean('checked', false);\n        this.setChecked(checked);\n\n        a.recycle();\n    }\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder().set('button', {\n            setter(v:CompoundButton, value:any, attrBinder:AttrBinder) {\n                v.setButtonDrawable(attrBinder.parseDrawable(value));\n            }, getter(v:CompoundButton) {\n                return v.mButtonDrawable;\n            }\n        }).set('checked', {\n            setter(v:CompoundButton, value:any, attrBinder:AttrBinder) {\n                v.setChecked(attrBinder.parseBoolean(value, v.isChecked()));\n            }, getter(v:CompoundButton) {\n                return v.isChecked();\n            }\n        });\n    }\n\n    toggle():void  {\n        this.setChecked(!this.mChecked);\n    }\n\n    performClick():boolean  {\n        /*\n         * XXX: These are tiny, need some surrounding 'expanded touch area',\n         * which will need to be implemented in Button if we only override\n         * performClick()\n         */\n        /* When clicked, toggle the state */\n        this.toggle();\n        return super.performClick();\n    }\n\n    isChecked():boolean  {\n        return this.mChecked;\n    }\n\n    /**\n     * <p>Changes the checked state of this button.</p>\n     *\n     * @param checked true to check the button, false to uncheck it\n     */\n    setChecked(checked:boolean):void  {\n        if (this.mChecked != checked) {\n            this.mChecked = checked;\n            this.refreshDrawableState();\n            //this.notifyViewAccessibilityStateChangedIfNeeded(AccessibilityEvent.CONTENT_CHANGE_TYPE_UNDEFINED);\n            // Avoid infinite recursions if setChecked() is called from a listener\n            if (this.mBroadcasting) {\n                return;\n            }\n            this.mBroadcasting = true;\n            if (this.mOnCheckedChangeListener != null) {\n                this.mOnCheckedChangeListener.onCheckedChanged(this, this.mChecked);\n            }\n            if (this.mOnCheckedChangeWidgetListener != null) {\n                this.mOnCheckedChangeWidgetListener.onCheckedChanged(this, this.mChecked);\n            }\n            this.mBroadcasting = false;\n        }\n    }\n\n    /**\n     * Register a callback to be invoked when the checked state of this button\n     * changes.\n     *\n     * @param listener the callback to call on checked state change\n     */\n    setOnCheckedChangeListener(listener:CompoundButton.OnCheckedChangeListener):void  {\n        this.mOnCheckedChangeListener = listener;\n    }\n\n    /**\n     * Register a callback to be invoked when the checked state of this button\n     * changes. This callback is used for internal purpose only.\n     *\n     * @param listener the callback to call on checked state change\n     * @hide\n     */\n    setOnCheckedChangeWidgetListener(listener:CompoundButton.OnCheckedChangeListener):void  {\n        this.mOnCheckedChangeWidgetListener = listener;\n    }\n\n\n\n    ///**\n    // * Set the background to a given Drawable, identified by its resource id.\n    // *\n    // * @param resid the resource id of the drawable to use as the background\n    // */\n    //setButtonDrawable(resid:number):void  {\n    //    if (resid != 0 && resid == this.mButtonResource) {\n    //        return;\n    //    }\n    //    this.mButtonResource = resid;\n    //    let d:Drawable = null;\n    //    if (this.mButtonResource != 0) {\n    //        d = this.getResources().getDrawable(this.mButtonResource);\n    //    }\n    //    this.setButtonDrawable(d);\n    //}\n\n    /**\n     * Set the background to a given Drawable\n     *\n     * @param d The Drawable to use as the background\n     */\n    setButtonDrawable(d:Drawable):void  {\n        if (d != null) {\n            if (this.mButtonDrawable != null) {\n                this.mButtonDrawable.setCallback(null);\n                this.unscheduleDrawable(this.mButtonDrawable);\n            }\n            d.setCallback(this);\n            d.setVisible(this.getVisibility() == CompoundButton.VISIBLE, false);\n            this.mButtonDrawable = d;\n            this.setMinHeight(this.mButtonDrawable.getIntrinsicHeight());\n        }\n        this.refreshDrawableState();\n    }\n\n    //onInitializeAccessibilityEvent(event:AccessibilityEvent):void  {\n    //    super.onInitializeAccessibilityEvent(event);\n    //    event.setClassName(CompoundButton.class.getName());\n    //    event.setChecked(this.mChecked);\n    //}\n    //\n    //onInitializeAccessibilityNodeInfo(info:AccessibilityNodeInfo):void  {\n    //    super.onInitializeAccessibilityNodeInfo(info);\n    //    info.setClassName(CompoundButton.class.getName());\n    //    info.setCheckable(true);\n    //    info.setChecked(this.mChecked);\n    //}\n\n    getCompoundPaddingLeft():number  {\n        let padding:number = super.getCompoundPaddingLeft();\n        if (!this.isLayoutRtl()) {\n            const buttonDrawable:Drawable = this.mButtonDrawable;\n            if (buttonDrawable != null) {\n                padding += buttonDrawable.getIntrinsicWidth();\n            }\n        }\n        return padding;\n    }\n\n    getCompoundPaddingRight():number  {\n        let padding:number = super.getCompoundPaddingRight();\n        if (this.isLayoutRtl()) {\n            const buttonDrawable:Drawable = this.mButtonDrawable;\n            if (buttonDrawable != null) {\n                padding += buttonDrawable.getIntrinsicWidth();\n            }\n        }\n        return padding;\n    }\n\n    /**\n     * @hide\n     */\n    getHorizontalOffsetForDrawables():number  {\n        const buttonDrawable:Drawable = this.mButtonDrawable;\n        return (buttonDrawable != null) ? buttonDrawable.getIntrinsicWidth() : 0;\n    }\n\n    protected onDraw(canvas:Canvas):void  {\n        super.onDraw(canvas);\n        const buttonDrawable:Drawable = this.mButtonDrawable;\n        if (buttonDrawable != null) {\n            const verticalGravity:number = this.getGravity() & Gravity.VERTICAL_GRAVITY_MASK;\n            const drawableHeight:number = buttonDrawable.getIntrinsicHeight();\n            const drawableWidth:number = buttonDrawable.getIntrinsicWidth();\n            let top:number = 0;\n            switch(verticalGravity) {\n                case Gravity.BOTTOM:\n                    top = this.getHeight() - drawableHeight;\n                    break;\n                case Gravity.CENTER_VERTICAL:\n                    top = (this.getHeight() - drawableHeight) / 2;\n                    break;\n            }\n            let bottom:number = top + drawableHeight;\n            let left:number = this.isLayoutRtl() ? this.getWidth() - drawableWidth : 0;\n            let right:number = this.isLayoutRtl() ? this.getWidth() : drawableWidth;\n            buttonDrawable.setBounds(left, top, right, bottom);\n            buttonDrawable.draw(canvas);\n        }\n    }\n\n    protected onCreateDrawableState(extraSpace:number):number[]  {\n        const drawableState:number[] = super.onCreateDrawableState(extraSpace + 1);\n        if (this.isChecked()) {\n            CompoundButton.mergeDrawableStates(drawableState, CompoundButton.CHECKED_STATE_SET);\n        }\n        return drawableState;\n    }\n\n    protected drawableStateChanged():void  {\n        super.drawableStateChanged();\n        if (this.mButtonDrawable != null) {\n            let myDrawableState:number[] = this.getDrawableState();\n            // Set the state of the Drawable\n            this.mButtonDrawable.setState(myDrawableState);\n            this.invalidate();\n        }\n    }\n\n    drawableSizeChange(d:android.graphics.drawable.Drawable):void {\n        if(d == this.mButtonDrawable){\n            this.setButtonDrawable(d);\n            this.requestLayout();\n        }else{\n            super.drawableSizeChange(d);\n        }\n    }\n\n    protected verifyDrawable(who:Drawable):boolean  {\n        return super.verifyDrawable(who) || who == this.mButtonDrawable;\n    }\n\n    jumpDrawablesToCurrentState():void  {\n        super.jumpDrawablesToCurrentState();\n        if (this.mButtonDrawable != null)\n            this.mButtonDrawable.jumpToCurrentState();\n    }\n\n}\n\nexport module CompoundButton{\n/**\n     * Interface definition for a callback to be invoked when the checked state\n     * of a compound button changed.\n     */\nexport interface OnCheckedChangeListener {\n\n    /**\n         * Called when the checked state of a compound button has changed.\n         *\n         * @param buttonView The compound button view whose state has changed.\n         * @param isChecked  The new checked state of buttonView.\n         */\n    onCheckedChanged(buttonView:CompoundButton, isChecked:boolean):void ;\n}\n}\n\n}"
  },
  {
    "path": "src/android/widget/EditText.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/text/Spannable.ts\"/>\n///<reference path=\"../../android/text/TextUtils.ts\"/>\n///<reference path=\"../../android/widget/TextView.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n///<reference path=\"../../android/graphics/Color.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/text/InputType.ts\"/>\n///<reference path=\"../../android/text/method/PasswordTransformationMethod.ts\"/>\n///<reference path=\"../../androidui/util/Platform.ts\"/>\n\nmodule android.widget {\nimport Spannable = android.text.Spannable;\nimport TextUtils = android.text.TextUtils;\nimport TextView = android.widget.TextView;\nimport View = android.view.View;\nimport Gravity = android.view.Gravity;\nimport Context = android.content.Context;\nimport Color = android.graphics.Color;\nimport Canvas = android.graphics.Canvas;\nimport Integer = java.lang.Integer;\nimport InputType = android.text.InputType;\nimport PasswordTransformationMethod = android.text.method.PasswordTransformationMethod;\nimport Platform = androidui.util.Platform;\n    import AttrBinder = androidui.attr.AttrBinder;\n\n\n/**\n * EditText is a thin veneer over TextView that configures itself\n * to be editable.\n *\n * <p>See the <a href=\"{@docRoot}guide/topics/ui/controls/text.html\">Text Fields</a>\n * guide.</p>\n * <p>\n * <b>XML attributes</b>\n * <p>\n * See {@link android.R.styleable#EditText EditText Attributes},\n * {@link android.R.styleable#TextView TextView Attributes},\n * {@link android.R.styleable#View View Attributes}\n */\nexport class EditText extends TextView {\n    private inputElement:HTMLTextAreaElement|HTMLInputElement;\n    private mSingleLineInputElement:HTMLInputElement;\n    private mMultiLineInputElement:HTMLTextAreaElement;\n\n    private mInputType = InputType.TYPE_NULL;\n    private mForceDisableDraw = false;\n    private mMaxLength = Integer.MAX_VALUE;\n\n    constructor(context:Context, bindElement?:HTMLElement, defStyle:any=android.R.attr.editTextStyle) {\n        super(context, bindElement, defStyle);\n\n        const a = context.obtainStyledAttributes(bindElement, defStyle);\n        const inputTypeS = a.getAttrValue(\"inputType\");\n        if (inputTypeS) {\n            this._setInputType(inputTypeS);\n        }\n        this.mMaxLength = a.getInteger('maxLength', this.mMaxLength);\n    }\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder().set('inputType', {\n            setter(v:EditText, value:any, attrBinder:AttrBinder) {\n                if (Number.isInteger(Number.parseInt(value))) {\n                    v.setInputType(Number.parseInt(value));\n                } else {\n                    v._setInputType(value + '');\n                }\n            }, getter(v:EditText) {\n                return v.getInputType();\n            }\n        }).set('maxLength', {\n            setter(v:EditText, value:any, attrBinder:AttrBinder) {\n                v.mMaxLength = attrBinder.parseInt(value, v.mMaxLength);\n            }, getter(v:EditText) {\n                return v.mMaxLength;\n            }\n        });\n    }\n\n    protected initBindElement(bindElement:HTMLElement):void {\n        super.initBindElement(bindElement);\n        this.switchToMultiLineInputElement();//default\n    }\n\n    protected onInputValueChange(e){\n        let text = this.inputElement.value;//innerText;\n        let filterText = '';\n        for(let i = 0, length = text.length; i<length; i++){\n            let c = text.codePointAt(i);\n            if(!this.filterKeyCodeByInputType(c) && filterText.length < this.mMaxLength){\n                filterText += text[i];\n            }\n        }\n        if(text != filterText){\n            text = filterText;\n            this.inputElement.value = text;\n        }\n\n        if (!text || text.length === 0) {\n            this.setForceDisableDrawText(false);\n        } else {\n            this.setForceDisableDrawText(true);\n        }\n        this.setText(text);\n    }\n\n    private onDomTextInput(e) {\n        let text = e['data'];\n        for(let i = 0, length = text.length; i<length; i++){\n            let c = text.codePointAt(i);\n            if(!this.filterKeyCodeOnInput(c)){\n                return;\n            }\n        }\n        // prevent\n        e.preventDefault();\n        e.stopPropagation();\n    }\n\n    private switchToInputElement(inputElement: HTMLInputElement|HTMLTextAreaElement) {\n        if(this.inputElement === inputElement) return;\n        inputElement.onblur = ()=>{\n            inputElement.style.opacity = '0';\n            this.setForceDisableDrawText(false);\n            this.onInputElementFocusChanged(false);\n        };\n        inputElement.onfocus = ()=>{\n            inputElement.style.opacity = '1';\n            if(this.getText().length>0){\n                this.setForceDisableDrawText(true);\n            }\n            this.onInputElementFocusChanged(true);\n        };\n        inputElement.oninput = (e) => this.onInputValueChange(e);\n        inputElement.removeEventListener('textInput', (e) => this.onDomTextInput(e));\n        inputElement.addEventListener('textInput', (e) => this.onDomTextInput(e));\n\n        if(this.inputElement && this.inputElement.parentElement){\n            this.bindElement.removeChild(this.inputElement);\n            this.bindElement.appendChild(inputElement);\n        }\n        this.inputElement = inputElement;\n    }\n    private switchToSingleLineInputElement(){\n        if(!this.mSingleLineInputElement){\n            this.mSingleLineInputElement = document.createElement('input');\n            this.mSingleLineInputElement.style.position = 'absolute';\n            this.mSingleLineInputElement.style['webkitAppearance'] = 'none';\n            this.mSingleLineInputElement.style.borderRadius = '0';\n            this.mSingleLineInputElement.style.overflow = 'auto';\n            this.mSingleLineInputElement.style.background = 'transparent';\n            this.mSingleLineInputElement.style.fontFamily = Canvas.getMeasureTextFontFamily();\n        }\n        this.switchToInputElement(this.mSingleLineInputElement);\n    }\n    protected switchToMultiLineInputElement(){\n        if(!this.mMultiLineInputElement) {\n            this.mMultiLineInputElement = document.createElement('textarea');\n            this.mMultiLineInputElement.style.position = 'absolute';\n            this.mMultiLineInputElement.style['webkitAppearance'] = 'none';\n            this.mMultiLineInputElement.style['resize'] = 'none';\n            this.mMultiLineInputElement.style.borderRadius = '0';\n            this.mMultiLineInputElement.style.overflow = 'auto';\n            this.mMultiLineInputElement.style.background = 'transparent';\n            this.mMultiLineInputElement.style.boxSizing = 'border-box';\n            this.mMultiLineInputElement.style.fontFamily = Canvas.getMeasureTextFontFamily();\n        }\n        this.switchToInputElement(this.mMultiLineInputElement);\n    }\n    protected tryShowInputElement(){\n        if(!this.isInputElementShowed()){\n            this.inputElement.value = this.getText().toString();\n            this.bindElement.appendChild(this.inputElement);\n            this.inputElement.focus();\n            if(this.getText().length>0){\n                this.setForceDisableDrawText(true);\n            }\n            this.syncTextBoundInfoToInputElement();\n            //TODO make cursor position friendly : move to first / move to touch position\n        }\n    }\n\n    protected tryDismissInputElement(){\n        try {\n            if (this.inputElement.parentNode) this.bindElement.removeChild(this.inputElement);\n        } catch (e) {\n        }\n        this.setForceDisableDrawText(false);\n    }\n    \n    protected onInputElementFocusChanged(focused:boolean) {\n    }\n\n    isInputElementShowed():boolean {\n        return this.inputElement.parentElement != null && this.inputElement.style.opacity != '0';\n    }\n\n    performClick(event:android.view.MotionEvent):boolean {\n        this.tryShowInputElement();\n        return super.performClick(event);\n    }\n\n    protected onFocusChanged(focused:boolean, direction:number, previouslyFocusedRect:android.graphics.Rect):void {\n        super.onFocusChanged(focused, direction, previouslyFocusedRect);\n        if(focused){\n            this.tryShowInputElement();\n        }else{\n            this.tryDismissInputElement();\n        }\n    }\n\n    protected setForceDisableDrawText(disable:boolean){\n        if(this.mForceDisableDraw == disable) return;\n        this.mForceDisableDraw = disable;\n        if(disable){\n            this.mSkipDrawText = true;\n        }else{\n            this.mSkipDrawText = false;\n        }\n        this.invalidate();\n    }\n\n    protected updateTextColors():void  {\n        super.updateTextColors();\n        if(this.isInputElementShowed()){\n            this.syncTextBoundInfoToInputElement();\n        }\n    }\n\n    onTouchEvent(event:android.view.MotionEvent):boolean {\n        const superResult:boolean = super.onTouchEvent(event);\n        if(this.isInputElementShowed()){\n            event[android.view.ViewRootImpl.ContinueEventToDom] = true;\n\n            // touch scroll in dom\n            //TODO check touch direction\n            if(this.inputElement.scrollHeight>this.inputElement.offsetHeight || this.inputElement.scrollWidth>this.inputElement.offsetWidth){\n                this.getParent().requestDisallowInterceptTouchEvent(true);\n            }\n\n            return true;\n        }\n        return superResult;\n    }\n\n    private filterKeyEvent(event:android.view.KeyEvent):boolean {\n        let keyCode = event.getKeyCode();\n        if(keyCode == android.view.KeyEvent.KEYCODE_Backspace || keyCode == android.view.KeyEvent.KEYCODE_Del\n            || event.isCtrlPressed() || event.isAltPressed() || event.isMetaPressed()){\n            return false;\n        }\n        if(keyCode == android.view.KeyEvent.KEYCODE_ENTER && this.isSingleLine()){\n            return true;\n        }\n        if(event.mIsTypingKey) {\n            if(this.getText().length >= this.mMaxLength) {\n                return true;\n            }\n            return this.filterKeyCodeOnInput(keyCode);\n        }\n        return false;\n    }\n\n    protected filterKeyCodeByInputType(keyCode:number):boolean {\n        let filter = false;\n        const inputType = this.mInputType;\n        const typeClass = inputType & InputType.TYPE_MASK_CLASS;\n        if (typeClass === InputType.TYPE_CLASS_NUMBER) {\n            filter = InputType.LimitCode.TYPE_CLASS_NUMBER.indexOf(keyCode) === -1;\n            if ((inputType & InputType.TYPE_NUMBER_FLAG_SIGNED) === InputType.TYPE_NUMBER_FLAG_SIGNED) {\n                filter = filter && keyCode !== android.view.KeyEvent.KEYCODE_Minus;\n            }\n            if ((inputType & InputType.TYPE_NUMBER_FLAG_DECIMAL) === InputType.TYPE_NUMBER_FLAG_DECIMAL) {\n                filter = filter && keyCode !== android.view.KeyEvent.KEYCODE_Period;\n            }\n        } else if (typeClass === InputType.TYPE_CLASS_PHONE) {\n            filter = InputType.LimitCode.TYPE_CLASS_PHONE.indexOf(keyCode) === -1;\n        }\n        return filter;\n    }\n\n    protected filterKeyCodeOnInput(keyCode:number):boolean {\n        let filter = false;\n        const inputType = this.mInputType;\n        const typeClass = inputType & InputType.TYPE_MASK_CLASS;\n        if (typeClass === InputType.TYPE_CLASS_NUMBER) {\n            if ((inputType & InputType.TYPE_NUMBER_FLAG_SIGNED) === InputType.TYPE_NUMBER_FLAG_SIGNED) {\n                if(keyCode === android.view.KeyEvent.KEYCODE_Minus && this.getText().length > 0) {\n                    filter = true;\n                }\n            }\n            if ((inputType & InputType.TYPE_NUMBER_FLAG_DECIMAL) === InputType.TYPE_NUMBER_FLAG_DECIMAL) {\n                if (keyCode === android.view.KeyEvent.KEYCODE_Period && (this.getText().includes('.') || this.getText().length === 0)) {\n                    filter = true;\n                }\n            }\n        }\n        return filter || this.filterKeyCodeByInputType(keyCode);\n    }\n\n    private checkFilterKeyEventToDom(event:android.view.KeyEvent):boolean {\n        if(this.isInputElementShowed()){\n            if(this.filterKeyEvent(event)){\n                event[android.view.ViewRootImpl.ContinueEventToDom] = false;\n            }else{\n                event[android.view.ViewRootImpl.ContinueEventToDom] = true;\n            }\n            return true;\n        }\n        return false;\n    }\n\n    onKeyDown(keyCode:number, event:android.view.KeyEvent):boolean {\n        const filter = this.checkFilterKeyEventToDom(event);\n        return super.onKeyDown(keyCode, event) || filter;\n    }\n\n    onKeyUp(keyCode:number, event:android.view.KeyEvent):boolean {\n        const filter = this.checkFilterKeyEventToDom(event);\n        return super.onKeyUp(keyCode, event) || filter;\n    }\n\n    requestSyncBoundToElement(immediately = false):void {\n        if(this.isInputElementShowed()){\n            immediately = true;\n        }\n        super.requestSyncBoundToElement(immediately);\n    }\n\n\n    protected setRawTextSize(size:number):void  {\n        super.setRawTextSize(size);\n        if(this.isInputElementShowed()){\n            this.syncTextBoundInfoToInputElement();\n        }\n    }\n\n    protected onTextChanged(text:String, start:number, lengthBefore:number, lengthAfter:number):void {\n        if(this.isInputElementShowed()){\n            this.syncTextBoundInfoToInputElement();\n        }\n    }\n\n    protected onLayout(changed:boolean, left:number, top:number, right:number, bottom:number):void {\n        super.onLayout(changed, left, top, right, bottom);\n\n        if(this.isInputElementShowed()){\n            this.syncTextBoundInfoToInputElement();\n        }\n    }\n\n    setGravity(gravity:number):void {\n        super.setGravity(gravity);\n        if(this.isInputElementShowed()){\n            this.syncTextBoundInfoToInputElement();\n        }\n    }\n\n    setSingleLine(singleLine = true):void {\n        if (singleLine) {\n            this.switchToSingleLineInputElement();\n        } else {\n            this.switchToMultiLineInputElement();\n        }\n        super.setSingleLine(singleLine);\n    }\n\n    _setInputType(value:string):void {\n        switch (value + ''){\n            case 'none':\n                this.setInputType(InputType.TYPE_NULL);\n                break;\n            case 'text':\n                this.setInputType(InputType.TYPE_CLASS_TEXT);\n                break;\n            case 'textUri':\n                this.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);\n                break;\n            case 'textEmailAddress':\n                this.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);\n                break;\n            case 'textPassword':\n                this.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);\n                break;\n            case 'textVisiblePassword':\n                this.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);\n                break;\n            case 'number':\n                this.setInputType(InputType.TYPE_CLASS_NUMBER);\n                break;\n            case 'numberSigned':\n                this.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED);\n                break;\n            case 'numberDecimal':\n                this.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);\n                break;\n            case 'numberPassword':\n                this.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD);\n                break;\n            case 'phone':\n                this.setInputType(InputType.TYPE_CLASS_PHONE);\n                break;\n            case 'datetime':\n                this.setInputType(InputType.TYPE_CLASS_DATETIME);\n                break;\n            case 'date':\n                this.setInputType(InputType.TYPE_CLASS_DATETIME | InputType.TYPE_DATETIME_VARIATION_DATE);\n                break;\n            case 'time':\n                this.setInputType(InputType.TYPE_CLASS_DATETIME | InputType.TYPE_DATETIME_VARIATION_TIME);\n                break;\n        }\n    }\n    /**\n     * Set the type of the content with a constant as defined for {@link EditorInfo#inputType}. This\n     * will take care of changing the key listener, by calling {@link #setKeyListener(KeyListener)},\n     * to match the given content type.  If the given content type is {@link EditorInfo#TYPE_NULL}\n     * then a soft keyboard will not be displayed for this text view.\n     *\n     * Note that the maximum number of displayed lines (see {@link #setMaxLines(int)}) will be\n     * modified if you change the {@link EditorInfo#TYPE_TEXT_FLAG_MULTI_LINE} flag of the input\n     * type.\n     *\n     * @see #getInputType()\n     * @see #setRawInputType(int)\n     * @see android.text.InputType\n     * @attr ref android.R.styleable#TextView_inputType\n     */\n    setInputType(type:number):void  {\n        this.mInputType = type;\n        const typeClass = type & InputType.TYPE_MASK_CLASS;\n        this.inputElement.style['webkitTextSecurity'] = '';\n        this.setTransformationMethod(null);\n\n        switch (typeClass){\n            case InputType.TYPE_NULL:\n                this.setSingleLine(false);\n                this.inputElement.removeAttribute('type');\n                break;\n            case InputType.TYPE_CLASS_TEXT:\n                if ((type & InputType.TYPE_TEXT_VARIATION_URI) === InputType.TYPE_TEXT_VARIATION_URI) {\n                    this.setSingleLine(true);\n                    this.inputElement.setAttribute('type', 'url');\n                } else if ((type & InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS) === InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS) {\n                    this.setSingleLine(true);\n                    this.inputElement.setAttribute('type', 'email');\n                } else if ((type & InputType.TYPE_TEXT_VARIATION_PASSWORD) === InputType.TYPE_TEXT_VARIATION_PASSWORD) {\n                    this.setSingleLine(true);\n                    this.inputElement.setAttribute('type', 'password');\n                    this.setTransformationMethod(PasswordTransformationMethod.getInstance());\n                } else if ((type & InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) === InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {\n                    this.setSingleLine(true);\n                    this.inputElement.setAttribute('type', 'email');//use email type as visible password\n                } else {\n                    this.setSingleLine(false);\n                    this.inputElement.removeAttribute('type');\n                }\n                break;\n            case InputType.TYPE_CLASS_NUMBER:\n                this.setSingleLine(true);\n                this.inputElement.setAttribute('type', 'number');\n                if ((type & InputType.TYPE_NUMBER_VARIATION_PASSWORD) === InputType.TYPE_NUMBER_VARIATION_PASSWORD) {\n                    this.inputElement.style['webkitTextSecurity'] = 'disc';\n                    this.setTransformationMethod(PasswordTransformationMethod.getInstance());\n                }\n                break;\n            case InputType.TYPE_CLASS_PHONE:\n                this.setSingleLine(true);\n                this.inputElement.setAttribute('type', 'tel');\n                break;\n            case InputType.TYPE_CLASS_DATETIME:\n                this.setSingleLine(true);\n                if ((type & InputType.TYPE_DATETIME_VARIATION_DATE) === InputType.TYPE_DATETIME_VARIATION_DATE) {\n                    this.inputElement.setAttribute('type', 'date');\n                } else if ((type & InputType.TYPE_DATETIME_VARIATION_TIME) === InputType.TYPE_DATETIME_VARIATION_TIME) {\n                    this.inputElement.setAttribute('type', 'time');\n                } else {\n                    this.inputElement.setAttribute('type', 'datetime');\n                }\n                break;\n        }\n    }\n\n    /**\n     * Get the type of the editable content.\n     *\n     * @see #setInputType(int)\n     * @see android.text.InputType\n     */\n    getInputType():number  {\n        return this.mInputType;\n    }\n\n\n    private syncTextBoundInfoToInputElement(){\n        let left = this.getLeft();\n        let top = this.getTop();\n        let right = this.getRight();\n        let bottom = this.getBottom();\n\n        const density = this.getResources().getDisplayMetrics().density;\n        let maxHeight = this.getMaxHeight();\n        if(maxHeight<=0 || maxHeight>=Integer.MAX_VALUE){\n            let maxLine = this.getMaxLines();\n            if(maxLine>0 && maxLine<Integer.MAX_VALUE){\n                maxHeight =  maxLine * this.getLineHeight();\n            }\n        }\n        let textHeight = bottom - top - this.getCompoundPaddingTop() - this.getCompoundPaddingBottom();\n        if(maxHeight<=0 || maxHeight>textHeight){\n            maxHeight = textHeight;\n        }\n        let layout:android.text.Layout = this.mLayout;\n        if (this.mHint != null && this.mText.length == 0) {\n            layout = this.mHintLayout;\n        }\n        let height = layout ? Math.min(layout.getLineTop(layout.getLineCount()), maxHeight) : maxHeight;\n        this.inputElement.style.height = height / density + 1 + 'px';\n\n        this.inputElement.style.top = '';\n        this.inputElement.style.bottom = '';\n        this.inputElement.style.transform = this.inputElement.style.webkitTransform = '';\n        let gravity = this.getGravity();\n        switch (gravity & Gravity.VERTICAL_GRAVITY_MASK) {\n            case Gravity.TOP:\n                this.inputElement.style.top = this.getCompoundPaddingTop() / density + 'px';\n                break;\n            case Gravity.BOTTOM:\n                this.inputElement.style.bottom = this.getCompoundPaddingBottom() / density + 'px';\n                break;\n            default:\n                this.inputElement.style.top = '50%';\n                this.inputElement.style.transform = this.inputElement.style.webkitTransform = 'translate(0, -50%)';\n                break;\n        }\n\n        switch (gravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n            case Gravity.LEFT:\n                this.inputElement.style.textAlign = 'left';\n                break;\n            case Gravity.RIGHT:\n                this.inputElement.style.textAlign = 'right';\n                break;\n            default:\n                this.inputElement.style.textAlign = 'center';\n                break;\n        }\n\n        const isIOS = Platform.isIOS;\n        this.inputElement.style.left = this.getCompoundPaddingLeft() / density - (isIOS?3:0) + 'px';\n        //this.inputElement.style.right = this.getCompoundPaddingRight() / density + 'px';\n        this.inputElement.style.width = (right - left - this.getCompoundPaddingRight() - this.getCompoundPaddingLeft()) / density + (isIOS?6:1) + 'px';\n        this.inputElement.style.lineHeight = this.getLineHeight()/density + 'px';\n\n        if(this.getLineCount() == 1){\n            this.inputElement.style.whiteSpace = 'nowrap';\n        }else{\n            this.inputElement.style.whiteSpace = '';\n        }\n\n        let text = this.getText().toString();\n        if(text!=this.inputElement.value) this.inputElement.value = text;\n        this.inputElement.style.fontSize = this.getTextSize() / density + 'px';\n        this.inputElement.style.color = Color.toRGBAFunc(this.getCurrentTextColor());\n\n        if(this.inputElement == this.mMultiLineInputElement){\n            this.inputElement.style.padding = (this.getTextSize()/density/5).toFixed(1) + 'px 0px 0px 0px';//textarea baseline adjust\n        }else{\n            this.inputElement.style.padding = '0px';\n        }\n    }\n    \n    protected dependOnDebugLayout():boolean {\n        return true;\n    }\n\n//protected getDefaultEditable():boolean  {\n    //    return true;\n    //}\n    //\n    //protected getDefaultMovementMethod():MovementMethod  {\n    //    return ArrowKeyMovementMethod.getInstance();\n    //}\n    //\n    //getText():Editable  {\n    //    return <Editable> super.getText();\n    //}\n    //\n    //setText(text:CharSequence, type:BufferType):void  {\n    //    super.setText(text, BufferType.EDITABLE);\n    //}\n    //\n    ///**\n    // * Convenience for {@link Selection#setSelection(Spannable, int, int)}.\n    // */\n    //setSelection(start:number, stop:number):void  {\n    //    Selection.setSelection(this.getText(), start, stop);\n    //}\n    //\n    ///**\n    // * Convenience for {@link Selection#setSelection(Spannable, int)}.\n    // */\n    //setSelection(index:number):void  {\n    //    Selection.setSelection(this.getText(), index);\n    //}\n    //\n    ///**\n    // * Convenience for {@link Selection#selectAll}.\n    // */\n    //selectAll():void  {\n    //    Selection.selectAll(this.getText());\n    //}\n    //\n    ///**\n    // * Convenience for {@link Selection#extendSelection}.\n    // */\n    //extendSelection(index:number):void  {\n    //    Selection.extendSelection(this.getText(), index);\n    //}\n\n    setEllipsize(ellipsis:TextUtils.TruncateAt):void  {\n        if (ellipsis == TextUtils.TruncateAt.MARQUEE) {\n            throw Error(`new IllegalArgumentException(\"EditText cannot use the ellipsize mode \" + \"TextUtils.TruncateAt.MARQUEE\")`);\n        }\n        super.setEllipsize(ellipsis);\n    }\n}\n}"
  },
  {
    "path": "src/android/widget/ExpandableListAdapter.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/database/DataSetObserver.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/widget/Adapter.ts\"/>\n///<reference path=\"../../android/widget/ExpandableListView.ts\"/>\n///<reference path=\"../../android/widget/ListAdapter.ts\"/>\n///<reference path=\"../../android/widget/ListView.ts\"/>\n\nmodule android.widget {\nimport DataSetObserver = android.database.DataSetObserver;\nimport View = android.view.View;\nimport ViewGroup = android.view.ViewGroup;\nimport Adapter = android.widget.Adapter;\nimport ExpandableListView = android.widget.ExpandableListView;\nimport ListAdapter = android.widget.ListAdapter;\nimport ListView = android.widget.ListView;\n/**\n * An adapter that links a {@link ExpandableListView} with the underlying\n * data. The implementation of this interface will provide access\n * to the data of the children (categorized by groups), and also instantiate\n * {@link View}s for children and groups.\n */\nexport interface ExpandableListAdapter {\n\n    /**\n     * @see Adapter#registerDataSetObserver(DataSetObserver)\n     */\n    registerDataSetObserver(observer:DataSetObserver):void ;\n\n    /**\n     * @see Adapter#unregisterDataSetObserver(DataSetObserver)\n     */\n    unregisterDataSetObserver(observer:DataSetObserver):void ;\n\n    /**\n     * Gets the number of groups.\n     * \n     * @return the number of groups\n     */\n    getGroupCount():number ;\n\n    /**\n     * Gets the number of children in a specified group.\n     * \n     * @param groupPosition the position of the group for which the children\n     *            count should be returned\n     * @return the children count in the specified group\n     */\n    getChildrenCount(groupPosition:number):number ;\n\n    /**\n     * Gets the data associated with the given group.\n     * \n     * @param groupPosition the position of the group\n     * @return the data child for the specified group\n     */\n    getGroup(groupPosition:number):any ;\n\n    /**\n     * Gets the data associated with the given child within the given group.\n     * \n     * @param groupPosition the position of the group that the child resides in\n     * @param childPosition the position of the child with respect to other\n     *            children in the group\n     * @return the data of the child\n     */\n    getChild(groupPosition:number, childPosition:number):any ;\n\n    /**\n     * Gets the ID for the group at the given position. This group ID must be\n     * unique across groups. The combined ID (see\n     * {@link #getCombinedGroupId(long)}) must be unique across ALL items\n     * (groups and all children).\n     * \n     * @param groupPosition the position of the group for which the ID is wanted\n     * @return the ID associated with the group\n     */\n    getGroupId(groupPosition:number):number ;\n\n    /**\n     * Gets the ID for the given child within the given group. This ID must be\n     * unique across all children within the group. The combined ID (see\n     * {@link #getCombinedChildId(long, long)}) must be unique across ALL items\n     * (groups and all children).\n     * \n     * @param groupPosition the position of the group that contains the child\n     * @param childPosition the position of the child within the group for which\n     *            the ID is wanted\n     * @return the ID associated with the child\n     */\n    getChildId(groupPosition:number, childPosition:number):number ;\n\n    /**\n     * Indicates whether the child and group IDs are stable across changes to the\n     * underlying data.\n     * \n     * @return whether or not the same ID always refers to the same object\n     * @see Adapter#hasStableIds()\n     */\n    hasStableIds():boolean ;\n\n    /**\n     * Gets a View that displays the given group. This View is only for the\n     * group--the Views for the group's children will be fetched using\n     * {@link #getChildView(int, int, boolean, View, ViewGroup)}.\n     * \n     * @param groupPosition the position of the group for which the View is\n     *            returned\n     * @param isExpanded whether the group is expanded or collapsed\n     * @param convertView the old view to reuse, if possible. You should check\n     *            that this view is non-null and of an appropriate type before\n     *            using. If it is not possible to convert this view to display\n     *            the correct data, this method can create a new view. It is not\n     *            guaranteed that the convertView will have been previously\n     *            created by\n     *            {@link #getGroupView(int, boolean, View, ViewGroup)}.\n     * @param parent the parent that this view will eventually be attached to\n     * @return the View corresponding to the group at the specified position\n     */\n    getGroupView(groupPosition:number, isExpanded:boolean, convertView:View, parent:ViewGroup):View ;\n\n    /**\n     * Gets a View that displays the data for the given child within the given\n     * group.\n     * \n     * @param groupPosition the position of the group that contains the child\n     * @param childPosition the position of the child (for which the View is\n     *            returned) within the group\n     * @param isLastChild Whether the child is the last child within the group\n     * @param convertView the old view to reuse, if possible. You should check\n     *            that this view is non-null and of an appropriate type before\n     *            using. If it is not possible to convert this view to display\n     *            the correct data, this method can create a new view. It is not\n     *            guaranteed that the convertView will have been previously\n     *            created by\n     *            {@link #getChildView(int, int, boolean, View, ViewGroup)}.\n     * @param parent the parent that this view will eventually be attached to\n     * @return the View corresponding to the child at the specified position\n     */\n    getChildView(groupPosition:number, childPosition:number, isLastChild:boolean, convertView:View, parent:ViewGroup):View ;\n\n    /**\n     * Whether the child at the specified position is selectable.\n     * \n     * @param groupPosition the position of the group that contains the child\n     * @param childPosition the position of the child within the group\n     * @return whether the child is selectable.\n     */\n    isChildSelectable(groupPosition:number, childPosition:number):boolean ;\n\n    /**\n     * @see ListAdapter#areAllItemsEnabled()\n     */\n    areAllItemsEnabled():boolean ;\n\n    /**\n     * @see ListAdapter#isEmpty()\n     */\n    isEmpty():boolean ;\n\n    /**\n     * Called when a group is expanded.\n     * \n     * @param groupPosition The group being expanded.\n     */\n    onGroupExpanded(groupPosition:number):void ;\n\n    /**\n     * Called when a group is collapsed.\n     * \n     * @param groupPosition The group being collapsed.\n     */\n    onGroupCollapsed(groupPosition:number):void ;\n\n    /**\n     * Gets an ID for a child that is unique across any item (either group or\n     * child) that is in this list. Expandable lists require each item (group or\n     * child) to have a unique ID among all children and groups in the list.\n     * This method is responsible for returning that unique ID given a child's\n     * ID and its group's ID. Furthermore, if {@link #hasStableIds()} is true, the\n     * returned ID must be stable as well.\n     * \n     * @param groupId The ID of the group that contains this child.\n     * @param childId The ID of the child.\n     * @return The unique (and possibly stable) ID of the child across all\n     *         groups and children in this list.\n     */\n    getCombinedChildId(groupId:number, childId:number):number ;\n\n    /**\n     * Gets an ID for a group that is unique across any item (either group or\n     * child) that is in this list. Expandable lists require each item (group or\n     * child) to have a unique ID among all children and groups in the list.\n     * This method is responsible for returning that unique ID given a group's\n     * ID. Furthermore, if {@link #hasStableIds()} is true, the returned ID must be\n     * stable as well.\n     * \n     * @param groupId The ID of the group\n     * @return The unique (and possibly stable) ID of the group across all\n     *         groups and children in this list.\n     */\n    getCombinedGroupId(groupId:number):number ;\n}\n}"
  },
  {
    "path": "src/android/widget/ExpandableListConnector.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/database/DataSetObserver.ts\"/>\n///<reference path=\"../../android/os/SystemClock.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../java/util/ArrayList.ts\"/>\n///<reference path=\"../../java/util/Collections.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../java/lang/Comparable.ts\"/>\n///<reference path=\"../../android/widget/Adapter.ts\"/>\n///<reference path=\"../../android/widget/AdapterView.ts\"/>\n///<reference path=\"../../android/widget/BaseAdapter.ts\"/>\n///<reference path=\"../../android/widget/ExpandableListAdapter.ts\"/>\n///<reference path=\"../../android/widget/ExpandableListPosition.ts\"/>\n///<reference path=\"../../android/widget/HeterogeneousExpandableList.ts\"/>\n///<reference path=\"../../android/widget/ListAdapter.ts\"/>\n///<reference path=\"../../android/widget/ListView.ts\"/>\n\nmodule android.widget {\nimport DataSetObserver = android.database.DataSetObserver;\nimport SystemClock = android.os.SystemClock;\nimport View = android.view.View;\nimport ViewGroup = android.view.ViewGroup;\nimport ArrayList = java.util.ArrayList;\nimport Collections = java.util.Collections;\nimport Integer = java.lang.Integer;\nimport Comparable = java.lang.Comparable;\nimport Adapter = android.widget.Adapter;\nimport AdapterView = android.widget.AdapterView;\nimport BaseAdapter = android.widget.BaseAdapter;\nimport ExpandableListAdapter = android.widget.ExpandableListAdapter;\nimport ExpandableListPosition = android.widget.ExpandableListPosition;\nimport HeterogeneousExpandableList = android.widget.HeterogeneousExpandableList;\nimport ListAdapter = android.widget.ListAdapter;\nimport ListView = android.widget.ListView;\n/**\n * A {@link BaseAdapter} that provides data/Views in an expandable list (offers\n * features such as collapsing/expanding groups containing children). By\n * itself, this adapter has no data and is a connector to a\n * {@link ExpandableListAdapter} which provides the data.\n * <p>\n * Internally, this connector translates the flat list position that the\n * ListAdapter expects to/from group and child positions that the ExpandableListAdapter\n * expects.\n */\nexport class ExpandableListConnector extends BaseAdapter /*implements Filterable*/ {\n\n    /**\n     * The ExpandableListAdapter to fetch the data/Views for this expandable list\n     */\n    private mExpandableListAdapter:ExpandableListAdapter;\n\n    /**\n     * List of metadata for the currently expanded groups. The metadata consists\n     * of data essential for efficiently translating between flat list positions\n     * and group/child positions. See {@link GroupMetadata}.\n     */\n    private mExpGroupMetadataList:ArrayList<ExpandableListConnector.GroupMetadata>;\n\n    /** The number of children from all currently expanded groups */\n    private mTotalExpChildrenCount:number = 0;\n\n    /** The maximum number of allowable expanded groups. Defaults to 'no limit' */\n    private mMaxExpGroupCount:number = Integer.MAX_VALUE;\n\n    /** Change observer used to have ExpandableListAdapter changes pushed to us */\n    private mDataSetObserver:DataSetObserver = new ExpandableListConnector.MyDataSetObserver(this);\n\n    /**\n     * Constructs the connector\n     */\n    constructor(expandableListAdapter:ExpandableListAdapter) {\n        super();\n        this.mExpGroupMetadataList = new ArrayList<ExpandableListConnector.GroupMetadata>();\n        this.setExpandableListAdapter(expandableListAdapter);\n    }\n\n    /**\n     * Point to the {@link ExpandableListAdapter} that will give us data/Views\n     * \n     * @param expandableListAdapter the adapter that supplies us with data/Views\n     */\n    setExpandableListAdapter(expandableListAdapter:ExpandableListAdapter):void  {\n        if (this.mExpandableListAdapter != null) {\n            this.mExpandableListAdapter.unregisterDataSetObserver(this.mDataSetObserver);\n        }\n        this.mExpandableListAdapter = expandableListAdapter;\n        expandableListAdapter.registerDataSetObserver(this.mDataSetObserver);\n    }\n\n    /**\n     * Translates a flat list position to either a) group pos if the specified\n     * flat list position corresponds to a group, or b) child pos if it\n     * corresponds to a child.  Performs a binary search on the expanded\n     * groups list to find the flat list pos if it is an exp group, otherwise\n     * finds where the flat list pos fits in between the exp groups.\n     * \n     * @param flPos the flat list position to be translated\n     * @return the group position or child position of the specified flat list\n     *         position encompassed in a {@link PositionMetadata} object\n     *         that contains additional useful info for insertion, etc.\n     */\n    getUnflattenedPos(flPos:number):ExpandableListConnector.PositionMetadata  {\n        /* Keep locally since frequent use */\n        const egml:ArrayList<ExpandableListConnector.GroupMetadata> = this.mExpGroupMetadataList;\n        const numExpGroups:number = egml.size();\n        /* Binary search variables */\n        let leftExpGroupIndex:number = 0;\n        let rightExpGroupIndex:number = numExpGroups - 1;\n        let midExpGroupIndex:number = 0;\n        let midExpGm:ExpandableListConnector.GroupMetadata;\n        if (numExpGroups == 0) {\n            /*\n             * There aren't any expanded groups (hence no visible children\n             * either), so flPos must be a group and its group pos will be the\n             * same as its flPos\n             */\n            return ExpandableListConnector.PositionMetadata.obtain(flPos, ExpandableListPosition.GROUP, flPos, -1, null, 0);\n        }\n        /*\n         * Binary search over the expanded groups to find either the exact\n         * expanded group (if we're looking for a group) or the group that\n         * contains the child we're looking for. If we are looking for a\n         * collapsed group, we will not have a direct match here, but we will\n         * find the expanded group just before the group we're searching for (so\n         * then we can calculate the group position of the group we're searching\n         * for). If there isn't an expanded group prior to the group being\n         * searched for, then the group being searched for's group position is\n         * the same as the flat list position (since there are no children before\n         * it, and all groups before it are collapsed).\n         */\n        while (leftExpGroupIndex <= rightExpGroupIndex) {\n            midExpGroupIndex = Math.floor((rightExpGroupIndex - leftExpGroupIndex) / 2 + leftExpGroupIndex);\n            midExpGm = egml.get(midExpGroupIndex);\n            if (flPos > midExpGm.lastChildFlPos) {\n                /*\n                 * The flat list position is after the current middle group's\n                 * last child's flat list position, so search right\n                 */\n                leftExpGroupIndex = midExpGroupIndex + 1;\n            } else if (flPos < midExpGm.flPos) {\n                /*\n                 * The flat list position is before the current middle group's\n                 * flat list position, so search left\n                 */\n                rightExpGroupIndex = midExpGroupIndex - 1;\n            } else if (flPos == midExpGm.flPos) {\n                /*\n                 * The flat list position is this middle group's flat list\n                 * position, so we've found an exact hit\n                 */\n                return ExpandableListConnector.PositionMetadata.obtain(flPos, ExpandableListPosition.GROUP, midExpGm.gPos, -1, midExpGm, midExpGroupIndex);\n            } else if (flPos <= midExpGm.lastChildFlPos) /* && flPos > midGm.flPos as deduced from previous\n                     * conditions */\n            {\n                /* The flat list position is a child of the middle group */\n                /* \n                 * Subtract the first child's flat list position from the\n                 * specified flat list pos to get the child's position within\n                 * the group\n                 */\n                const childPos:number = flPos - (midExpGm.flPos + 1);\n                return ExpandableListConnector.PositionMetadata.obtain(flPos, ExpandableListPosition.CHILD, midExpGm.gPos, childPos, midExpGm, midExpGroupIndex);\n            }\n        }\n        /* \n         * If we've reached here, it means the flat list position must be a\n         * group that is not expanded, since otherwise we would have hit it\n         * in the above search.\n         */\n        /**\n         * If we are to expand this group later, where would it go in the\n         * mExpGroupMetadataList ?\n         */\n        let insertPosition:number = 0;\n        /** What is its group position in the list of all groups? */\n        let groupPos:number = 0;\n        /*\n         * To figure out exact insertion and prior group positions, we need to\n         * determine how we broke out of the binary search.  We backtrack\n         * to see this.\n         */\n        if (leftExpGroupIndex > midExpGroupIndex) {\n            /*\n             * This would occur in the first conditional, so the flat list\n             * insertion position is after the left group. Also, the\n             * leftGroupPos is one more than it should be (since that broke out\n             * of our binary search), so we decrement it.\n             */\n            const leftExpGm:ExpandableListConnector.GroupMetadata = egml.get(leftExpGroupIndex - 1);\n            insertPosition = leftExpGroupIndex;\n            /*\n             * Sums the number of groups between the prior exp group and this\n             * one, and then adds it to the prior group's group pos\n             */\n            groupPos = (flPos - leftExpGm.lastChildFlPos) + leftExpGm.gPos;\n        } else if (rightExpGroupIndex < midExpGroupIndex) {\n            /*\n             * This would occur in the second conditional, so the flat list\n             * insertion position is before the right group. Also, the\n             * rightGroupPos is one less than it should be, so increment it.\n             */\n            const rightExpGm:ExpandableListConnector.GroupMetadata = egml.get(++rightExpGroupIndex);\n            insertPosition = rightExpGroupIndex;\n            /*\n             * Subtracts this group's flat list pos from the group after's flat\n             * list position to find out how many groups are in between the two\n             * groups. Then, subtracts that number from the group after's group\n             * pos to get this group's pos.\n             */\n            groupPos = rightExpGm.gPos - (rightExpGm.flPos - flPos);\n        } else {\n            // TODO: clean exit\n            throw Error(`new RuntimeException(\"Unknown state\")`);\n        }\n        return ExpandableListConnector.PositionMetadata.obtain(flPos, ExpandableListPosition.GROUP, groupPos, -1, null, insertPosition);\n    }\n\n    /**\n     * Translates either a group pos or a child pos (+ group it belongs to) to a\n     * flat list position.  If searching for a child and its group is not expanded, this will\n     * return null since the child isn't being shown in the ListView, and hence it has no\n     * position.\n     * \n     * @param pos a {@link ExpandableListPosition} representing either a group position\n     *        or child position\n     * @return the flat list position encompassed in a {@link PositionMetadata}\n     *         object that contains additional useful info for insertion, etc., or null.\n     */\n    getFlattenedPos(pos:ExpandableListPosition):ExpandableListConnector.PositionMetadata  {\n        const egml:ArrayList<ExpandableListConnector.GroupMetadata> = this.mExpGroupMetadataList;\n        const numExpGroups:number = egml.size();\n        /* Binary search variables */\n        let leftExpGroupIndex:number = 0;\n        let rightExpGroupIndex:number = numExpGroups - 1;\n        let midExpGroupIndex:number = 0;\n        let midExpGm:ExpandableListConnector.GroupMetadata;\n        if (numExpGroups == 0) {\n            /*\n             * There aren't any expanded groups, so flPos must be a group and\n             * its flPos will be the same as its group pos.  The\n             * insert position is 0 (since the list is empty).\n             */\n            return ExpandableListConnector.PositionMetadata.obtain(pos.groupPos, pos.type, pos.groupPos, pos.childPos, null, 0);\n        }\n        /*\n         * Binary search over the expanded groups to find either the exact\n         * expanded group (if we're looking for a group) or the group that\n         * contains the child we're looking for.\n         */\n        while (leftExpGroupIndex <= rightExpGroupIndex) {\n            midExpGroupIndex = Math.floor((rightExpGroupIndex - leftExpGroupIndex) / 2 + leftExpGroupIndex);\n            midExpGm = egml.get(midExpGroupIndex);\n            if (pos.groupPos > midExpGm.gPos) {\n                /*\n                 * It's after the current middle group, so search right\n                 */\n                leftExpGroupIndex = midExpGroupIndex + 1;\n            } else if (pos.groupPos < midExpGm.gPos) {\n                /*\n                 * It's before the current middle group, so search left\n                 */\n                rightExpGroupIndex = midExpGroupIndex - 1;\n            } else if (pos.groupPos == midExpGm.gPos) {\n                if (pos.type == ExpandableListPosition.GROUP) {\n                    /* If it's a group, give them this matched group's flPos */\n                    return ExpandableListConnector.PositionMetadata.obtain(midExpGm.flPos, pos.type, pos.groupPos, pos.childPos, midExpGm, midExpGroupIndex);\n                } else if (pos.type == ExpandableListPosition.CHILD) {\n                    /* If it's a child, calculate the flat list pos */\n                    return ExpandableListConnector.PositionMetadata.obtain(midExpGm.flPos + pos.childPos + 1, pos.type, pos.groupPos, pos.childPos, midExpGm, midExpGroupIndex);\n                } else {\n                    return null;\n                }\n            }\n        }\n        /* \n         * If we've reached here, it means there was no match in the expanded\n         * groups, so it must be a collapsed group that they're search for\n         */\n        if (pos.type != ExpandableListPosition.GROUP) {\n            /* If it isn't a group, return null */\n            return null;\n        }\n        /*\n         * To figure out exact insertion and prior group positions, we need to\n         * determine how we broke out of the binary search. We backtrack to see\n         * this.\n         */\n        if (leftExpGroupIndex > midExpGroupIndex) {\n            /*\n             * This would occur in the first conditional, so the flat list\n             * insertion position is after the left group.\n             * \n             * The leftGroupPos is one more than it should be (from the binary\n             * search loop) so we subtract 1 to get the actual left group.  Since\n             * the insertion point is AFTER the left group, we keep this +1\n             * value as the insertion point\n             */\n            const leftExpGm:ExpandableListConnector.GroupMetadata = egml.get(leftExpGroupIndex - 1);\n            const flPos:number = leftExpGm.lastChildFlPos + (pos.groupPos - leftExpGm.gPos);\n            return ExpandableListConnector.PositionMetadata.obtain(flPos, pos.type, pos.groupPos, pos.childPos, null, leftExpGroupIndex);\n        } else if (rightExpGroupIndex < midExpGroupIndex) {\n            /*\n             * This would occur in the second conditional, so the flat list\n             * insertion position is before the right group. Also, the\n             * rightGroupPos is one less than it should be (from binary search\n             * loop), so we increment to it.\n             */\n            const rightExpGm:ExpandableListConnector.GroupMetadata = egml.get(++rightExpGroupIndex);\n            const flPos:number = rightExpGm.flPos - (rightExpGm.gPos - pos.groupPos);\n            return ExpandableListConnector.PositionMetadata.obtain(flPos, pos.type, pos.groupPos, pos.childPos, null, rightExpGroupIndex);\n        } else {\n            return null;\n        }\n    }\n\n    areAllItemsEnabled():boolean  {\n        return this.mExpandableListAdapter.areAllItemsEnabled();\n    }\n\n    isEnabled(flatListPos:number):boolean  {\n        const metadata:ExpandableListConnector.PositionMetadata = this.getUnflattenedPos(flatListPos);\n        const pos:ExpandableListPosition = metadata.position;\n        let retValue:boolean;\n        if (pos.type == ExpandableListPosition.CHILD) {\n            retValue = this.mExpandableListAdapter.isChildSelectable(pos.groupPos, pos.childPos);\n        } else {\n            // Groups are always selectable\n            retValue = true;\n        }\n        metadata.recycle();\n        return retValue;\n    }\n\n    getCount():number  {\n        /*\n         * Total count for the list view is the number groups plus the \n         * number of children from currently expanded groups (a value we keep\n         * cached in this class)\n         */\n        return this.mExpandableListAdapter.getGroupCount() + this.mTotalExpChildrenCount;\n    }\n\n    getItem(flatListPos:number):any  {\n        const posMetadata:ExpandableListConnector.PositionMetadata = this.getUnflattenedPos(flatListPos);\n        let retValue:any;\n        if (posMetadata.position.type == ExpandableListPosition.GROUP) {\n            retValue = this.mExpandableListAdapter.getGroup(posMetadata.position.groupPos);\n        } else if (posMetadata.position.type == ExpandableListPosition.CHILD) {\n            retValue = this.mExpandableListAdapter.getChild(posMetadata.position.groupPos, posMetadata.position.childPos);\n        } else {\n            // TODO: clean exit\n            throw Error(`new RuntimeException(\"Flat list position is of unknown type\")`);\n        }\n        posMetadata.recycle();\n        return retValue;\n    }\n\n    getItemId(flatListPos:number):number  {\n        const posMetadata:ExpandableListConnector.PositionMetadata = this.getUnflattenedPos(flatListPos);\n        const groupId:number = this.mExpandableListAdapter.getGroupId(posMetadata.position.groupPos);\n        let retValue:number;\n        if (posMetadata.position.type == ExpandableListPosition.GROUP) {\n            retValue = this.mExpandableListAdapter.getCombinedGroupId(groupId);\n        } else if (posMetadata.position.type == ExpandableListPosition.CHILD) {\n            const childId:number = this.mExpandableListAdapter.getChildId(posMetadata.position.groupPos, posMetadata.position.childPos);\n            retValue = this.mExpandableListAdapter.getCombinedChildId(groupId, childId);\n        } else {\n            // TODO: clean exit\n            throw Error(`new RuntimeException(\"Flat list position is of unknown type\")`);\n        }\n        posMetadata.recycle();\n        return retValue;\n    }\n\n    getView(flatListPos:number, convertView:View, parent:ViewGroup):View  {\n        const posMetadata:ExpandableListConnector.PositionMetadata = this.getUnflattenedPos(flatListPos);\n        let retValue:View;\n        if (posMetadata.position.type == ExpandableListPosition.GROUP) {\n            retValue = this.mExpandableListAdapter.getGroupView(posMetadata.position.groupPos, posMetadata.isExpanded(), convertView, parent);\n        } else if (posMetadata.position.type == ExpandableListPosition.CHILD) {\n            const isLastChild:boolean = posMetadata.groupMetadata.lastChildFlPos == flatListPos;\n            retValue = this.mExpandableListAdapter.getChildView(posMetadata.position.groupPos, posMetadata.position.childPos, isLastChild, convertView, parent);\n        } else {\n            // TODO: clean exit\n            throw Error(`new RuntimeException(\"Flat list position is of unknown type\")`);\n        }\n        posMetadata.recycle();\n        return retValue;\n    }\n\n    getItemViewType(flatListPos:number):number  {\n        const metadata:ExpandableListConnector.PositionMetadata = this.getUnflattenedPos(flatListPos);\n        const pos:ExpandableListPosition = metadata.position;\n        let retValue:number;\n        if (HeterogeneousExpandableList.isImpl(this.mExpandableListAdapter)) {\n            let adapter:HeterogeneousExpandableList = <HeterogeneousExpandableList><any>this.mExpandableListAdapter;\n            if (pos.type == ExpandableListPosition.GROUP) {\n                retValue = adapter.getGroupType(pos.groupPos);\n            } else {\n                const childType:number = adapter.getChildType(pos.groupPos, pos.childPos);\n                retValue = adapter.getGroupTypeCount() + childType;\n            }\n        } else {\n            if (pos.type == ExpandableListPosition.GROUP) {\n                retValue = 0;\n            } else {\n                retValue = 1;\n            }\n        }\n        metadata.recycle();\n        return retValue;\n    }\n\n    getViewTypeCount():number  {\n        if (HeterogeneousExpandableList.isImpl(this.mExpandableListAdapter)) {\n            let adapter:HeterogeneousExpandableList = <HeterogeneousExpandableList><any>this.mExpandableListAdapter;\n            return adapter.getGroupTypeCount() + adapter.getChildTypeCount();\n        } else {\n            return 2;\n        }\n    }\n\n    hasStableIds():boolean  {\n        return this.mExpandableListAdapter.hasStableIds();\n    }\n\n    /**\n     * Traverses the expanded group metadata list and fills in the flat list\n     * positions.\n     * \n     * @param forceChildrenCountRefresh Forces refreshing of the children count\n     *        for all expanded groups.\n     * @param syncGroupPositions Whether to search for the group positions\n     *         based on the group IDs. This should only be needed when calling\n     *         this from an onChanged callback.\n     */\n    private refreshExpGroupMetadataList(forceChildrenCountRefresh:boolean, syncGroupPositions:boolean):void  {\n        const egml:ArrayList<ExpandableListConnector.GroupMetadata> = this.mExpGroupMetadataList;\n        let egmlSize:number = egml.size();\n        let curFlPos:number = 0;\n        /* Update child count as we go through */\n        this.mTotalExpChildrenCount = 0;\n        if (syncGroupPositions) {\n            // We need to check whether any groups have moved positions\n            let positionsChanged:boolean = false;\n            for (let i:number = egmlSize - 1; i >= 0; i--) {\n                let curGm:ExpandableListConnector.GroupMetadata = egml.get(i);\n                let newGPos:number = this.findGroupPosition(curGm.gId, curGm.gPos);\n                if (newGPos != curGm.gPos) {\n                    if (newGPos == AdapterView.INVALID_POSITION) {\n                        // Doh, just remove it from the list of expanded groups\n                        egml.remove(i);\n                        egmlSize--;\n                    }\n                    curGm.gPos = newGPos;\n                    if (!positionsChanged)\n                        positionsChanged = true;\n                }\n            }\n            if (positionsChanged) {\n                // At least one group changed positions, so re-sort\n                Collections.sort(egml);\n            }\n        }\n        let gChildrenCount:number;\n        let lastGPos:number = 0;\n        for (let i:number = 0; i < egmlSize; i++) {\n            /* Store in local variable since we'll access freq */\n            let curGm:ExpandableListConnector.GroupMetadata = egml.get(i);\n            /*\n             * Get the number of children, try to refrain from calling\n             * another class's method unless we have to (so do a subtraction)\n             */\n            if ((curGm.lastChildFlPos == ExpandableListConnector.GroupMetadata.REFRESH) || forceChildrenCountRefresh) {\n                gChildrenCount = this.mExpandableListAdapter.getChildrenCount(curGm.gPos);\n            } else {\n                /* Num children for this group is its last child's fl pos minus\n                 * the group's fl pos\n                 */\n                gChildrenCount = curGm.lastChildFlPos - curGm.flPos;\n            }\n            /* Update */\n            this.mTotalExpChildrenCount += gChildrenCount;\n            /*\n             * This skips the collapsed groups and increments the flat list\n             * position (for subsequent exp groups) by accounting for the collapsed\n             * groups\n             */\n            curFlPos += (curGm.gPos - lastGPos);\n            lastGPos = curGm.gPos;\n            /* Update the flat list positions, and the current flat list pos */\n            curGm.flPos = curFlPos;\n            curFlPos += gChildrenCount;\n            curGm.lastChildFlPos = curFlPos;\n        }\n    }\n\n    /**\n     * Collapse a group in the grouped list view\n     * \n     * @param groupPos position of the group to collapse\n     */\n    collapseGroup(groupPos:number):boolean  {\n        let elGroupPos:ExpandableListPosition = ExpandableListPosition.obtain(ExpandableListPosition.GROUP, groupPos, -1, -1);\n        let pm:ExpandableListConnector.PositionMetadata = this.getFlattenedPos(elGroupPos);\n        elGroupPos.recycle();\n        if (pm == null)\n            return false;\n        let retValue:boolean = this.collapseGroupWithMeta(pm);\n        pm.recycle();\n        return retValue;\n    }\n\n    collapseGroupWithMeta(posMetadata:ExpandableListConnector.PositionMetadata):boolean  {\n        /*\n         * If it is null, it must be already collapsed. This group metadata\n         * object should have been set from the search that returned the\n         * position metadata object.\n         */\n        if (posMetadata.groupMetadata == null)\n            return false;\n        // Remove the group from the list of expanded groups \n        this.mExpGroupMetadataList.remove(posMetadata.groupMetadata);\n        // Refresh the metadata\n        this.refreshExpGroupMetadataList(false, false);\n        // Notify of change\n        this.notifyDataSetChanged();\n        // Give the callback\n        this.mExpandableListAdapter.onGroupCollapsed(posMetadata.groupMetadata.gPos);\n        return true;\n    }\n\n    /**\n     * Expand a group in the grouped list view\n     * @param groupPos the group to be expanded\n     */\n    expandGroup(groupPos:number):boolean  {\n        let elGroupPos:ExpandableListPosition = ExpandableListPosition.obtain(ExpandableListPosition.GROUP, groupPos, -1, -1);\n        let pm:ExpandableListConnector.PositionMetadata = this.getFlattenedPos(elGroupPos);\n        elGroupPos.recycle();\n        let retValue:boolean = this.expandGroupWithMeta(pm);\n        pm.recycle();\n        return retValue;\n    }\n\n    expandGroupWithMeta(posMetadata:ExpandableListConnector.PositionMetadata):boolean  {\n        if (posMetadata.position.groupPos < 0) {\n            // TODO clean exit\n            throw Error(`new RuntimeException(\"Need group\")`);\n        }\n        if (this.mMaxExpGroupCount == 0)\n            return false;\n        // Check to see if it's already expanded\n        if (posMetadata.groupMetadata != null)\n            return false;\n        /* Restrict number of expanded groups to mMaxExpGroupCount */\n        if (this.mExpGroupMetadataList.size() >= this.mMaxExpGroupCount) {\n            /* Collapse a group */\n            // TODO: Collapse something not on the screen instead of the first one?\n            // TODO: Could write overloaded function to take GroupMetadata to collapse\n            let collapsedGm:ExpandableListConnector.GroupMetadata = this.mExpGroupMetadataList.get(0);\n            let collapsedIndex:number = this.mExpGroupMetadataList.indexOf(collapsedGm);\n            this.collapseGroup(collapsedGm.gPos);\n            /* Decrement index if it is after the group we removed */\n            if (posMetadata.groupInsertIndex > collapsedIndex) {\n                posMetadata.groupInsertIndex--;\n            }\n        }\n        let expandedGm:ExpandableListConnector.GroupMetadata = ExpandableListConnector.GroupMetadata.obtain(ExpandableListConnector.GroupMetadata.REFRESH, ExpandableListConnector.GroupMetadata.REFRESH, posMetadata.position.groupPos, this.mExpandableListAdapter.getGroupId(posMetadata.position.groupPos));\n        this.mExpGroupMetadataList.add(posMetadata.groupInsertIndex, expandedGm);\n        // Refresh the metadata\n        this.refreshExpGroupMetadataList(false, false);\n        // Notify of change\n        this.notifyDataSetChanged();\n        // Give the callback\n        this.mExpandableListAdapter.onGroupExpanded(expandedGm.gPos);\n        return true;\n    }\n\n    /**\n     * Whether the given group is currently expanded.\n     * @param groupPosition The group to check.\n     * @return Whether the group is currently expanded.\n     */\n    isGroupExpanded(groupPosition:number):boolean  {\n        let groupMetadata:ExpandableListConnector.GroupMetadata;\n        for (let i:number = this.mExpGroupMetadataList.size() - 1; i >= 0; i--) {\n            groupMetadata = this.mExpGroupMetadataList.get(i);\n            if (groupMetadata.gPos == groupPosition) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    /**\n     * Set the maximum number of groups that can be expanded at any given time\n     */\n    setMaxExpGroupCount(maxExpGroupCount:number):void  {\n        this.mMaxExpGroupCount = maxExpGroupCount;\n    }\n\n    getAdapter():ExpandableListAdapter  {\n        return this.mExpandableListAdapter;\n    }\n\n    //getFilter():Filter  {\n    //    let adapter:ExpandableListAdapter = this.getAdapter();\n    //    if (adapter instanceof Filterable) {\n    //        return (<Filterable> adapter).getFilter();\n    //    } else {\n    //        return null;\n    //    }\n    //}\n\n    getExpandedGroupMetadataList():ArrayList<ExpandableListConnector.GroupMetadata>  {\n        return this.mExpGroupMetadataList;\n    }\n\n    setExpandedGroupMetadataList(expandedGroupMetadataList:ArrayList<ExpandableListConnector.GroupMetadata>):void  {\n        if ((expandedGroupMetadataList == null) || (this.mExpandableListAdapter == null)) {\n            return;\n        }\n        // Make sure our current data set is big enough for the previously\n        // expanded groups, if not, ignore this request\n        let numGroups:number = this.mExpandableListAdapter.getGroupCount();\n        for (let i:number = expandedGroupMetadataList.size() - 1; i >= 0; i--) {\n            if (expandedGroupMetadataList.get(i).gPos >= numGroups) {\n                // Doh, for some reason the client doesn't have some of the groups\n                return;\n            }\n        }\n        this.mExpGroupMetadataList = expandedGroupMetadataList;\n        this.refreshExpGroupMetadataList(true, false);\n    }\n\n    isEmpty():boolean  {\n        let adapter:ExpandableListAdapter = this.getAdapter();\n        return adapter != null ? adapter.isEmpty() : true;\n    }\n\n    /**\n     * Searches the expandable list adapter for a group position matching the\n     * given group ID. The search starts at the given seed position and then\n     * alternates between moving up and moving down until 1) we find the right\n     * position, or 2) we run out of time, or 3) we have looked at every\n     * position\n     * \n     * @return Position of the row that matches the given row ID, or\n     *         {@link AdapterView#INVALID_POSITION} if it can't be found\n     * @see AdapterView#findSyncPosition()\n     */\n    findGroupPosition(groupIdToMatch:number, seedGroupPosition:number):number  {\n        let count:number = this.mExpandableListAdapter.getGroupCount();\n        if (count == 0) {\n            return AdapterView.INVALID_POSITION;\n        }\n        // If there isn't a selection don't hunt for it\n        if (groupIdToMatch == AdapterView.INVALID_ROW_ID) {\n            return AdapterView.INVALID_POSITION;\n        }\n        // Pin seed to reasonable values\n        seedGroupPosition = Math.max(0, seedGroupPosition);\n        seedGroupPosition = Math.min(count - 1, seedGroupPosition);\n        let endTime:number = SystemClock.uptimeMillis() + AdapterView.SYNC_MAX_DURATION_MILLIS;\n        let rowId:number;\n        // first position scanned so far\n        let first:number = seedGroupPosition;\n        // last position scanned so far\n        let last:number = seedGroupPosition;\n        // True if we should move down on the next iteration\n        let next:boolean = false;\n        // True when we have looked at the first item in the data\n        let hitFirst:boolean;\n        // True when we have looked at the last item in the data\n        let hitLast:boolean;\n        // Get the item ID locally (instead of getItemIdAtPosition), so\n        // we need the adapter\n        let adapter:ExpandableListAdapter = this.getAdapter();\n        if (adapter == null) {\n            return AdapterView.INVALID_POSITION;\n        }\n        while (SystemClock.uptimeMillis() <= endTime) {\n            rowId = adapter.getGroupId(seedGroupPosition);\n            if (rowId == groupIdToMatch) {\n                // Found it!\n                return seedGroupPosition;\n            }\n            hitLast = last == count - 1;\n            hitFirst = first == 0;\n            if (hitLast && hitFirst) {\n                // Looked at everything\n                break;\n            }\n            if (hitFirst || (next && !hitLast)) {\n                // Either we hit the top, or we are trying to move down\n                last++;\n                seedGroupPosition = last;\n                // Try going up next time\n                next = false;\n            } else if (hitLast || (!next && !hitFirst)) {\n                // Either we hit the bottom, or we are trying to move up\n                first--;\n                seedGroupPosition = first;\n                // Try going down next time\n                next = true;\n            }\n        }\n        return AdapterView.INVALID_POSITION;\n    }\n\n\n\n\n\n\n}\n\nexport module ExpandableListConnector{\nexport class MyDataSetObserver extends DataSetObserver {\n    _ExpandableListConnector_this:ExpandableListConnector;\n    constructor(arg:ExpandableListConnector){\n        super();\n        this._ExpandableListConnector_this = arg;\n    }\n\n    onChanged():void  {\n        this._ExpandableListConnector_this.refreshExpGroupMetadataList(true, true);\n        this._ExpandableListConnector_this.notifyDataSetChanged();\n    }\n\n    onInvalidated():void  {\n        this._ExpandableListConnector_this.refreshExpGroupMetadataList(true, true);\n        this._ExpandableListConnector_this.notifyDataSetInvalidated();\n    }\n}\n/**\n     * Metadata about an expanded group to help convert from a flat list\n     * position to either a) group position for groups, or b) child position for\n     * children\n     */\nexport class GroupMetadata implements Comparable<GroupMetadata> {\n\n    static REFRESH:number = -1;\n\n    /** This group's flat list position */\n    flPos:number = 0;\n\n    /* firstChildFlPos isn't needed since it's (flPos + 1) */\n    /**\n         * This group's last child's flat list position, so basically\n         * the range of this group in the flat list\n         */\n    lastChildFlPos:number = 0;\n\n    /**\n         * This group's group position\n         */\n    gPos:number = 0;\n\n    /**\n         * This group's id\n         */\n    gId:number = 0;\n\n    constructor( ) {\n    }\n\n    static obtain(flPos:number, lastChildFlPos:number, gPos:number, gId:number):GroupMetadata  {\n        let gm:GroupMetadata = new GroupMetadata();\n        gm.flPos = flPos;\n        gm.lastChildFlPos = lastChildFlPos;\n        gm.gPos = gPos;\n        gm.gId = gId;\n        return gm;\n    }\n\n    compareTo(another:GroupMetadata):number  {\n        if (another == null) {\n            throw Error(`new IllegalArgumentException()`);\n        }\n        return this.gPos - another.gPos;\n    }\n\n}\n/**\n     * Data type that contains an expandable list position (can refer to either a group\n     * or child) and some extra information regarding referred item (such as\n     * where to insert into the flat list, etc.)\n     */\nexport class PositionMetadata {\n\n    private static MAX_POOL_SIZE:number = 5;\n\n    private static sPool:ArrayList<PositionMetadata> = new ArrayList<PositionMetadata>(PositionMetadata.MAX_POOL_SIZE);\n\n    /** Data type to hold the position and its type (child/group) */\n    position:ExpandableListPosition;\n\n    /**\n         * Link back to the expanded GroupMetadata for this group. Useful for\n         * removing the group from the list of expanded groups inside the\n         * connector when we collapse the group, and also as a check to see if\n         * the group was expanded or collapsed (this will be null if the group\n         * is collapsed since we don't keep that group's metadata)\n         */\n    groupMetadata:ExpandableListConnector.GroupMetadata;\n\n    /**\n         * For groups that are collapsed, we use this as the index (in\n         * mExpGroupMetadataList) to insert this group when we are expanding\n         * this group.\n         */\n    groupInsertIndex:number = 0;\n\n    private resetState():void  {\n        if (this.position != null) {\n            this.position.recycle();\n            this.position = null;\n        }\n        this.groupMetadata = null;\n        this.groupInsertIndex = 0;\n    }\n\n    /**\n         * Use {@link #obtain(int, int, int, int, GroupMetadata, int)}\n         */\n    constructor() {\n    }\n\n    static obtain(flatListPos:number, type:number, groupPos:number, childPos:number, groupMetadata:ExpandableListConnector.GroupMetadata, groupInsertIndex:number):PositionMetadata  {\n        let pm:PositionMetadata = PositionMetadata.getRecycledOrCreate();\n        pm.position = ExpandableListPosition.obtain(type, groupPos, childPos, flatListPos);\n        pm.groupMetadata = groupMetadata;\n        pm.groupInsertIndex = groupInsertIndex;\n        return pm;\n    }\n\n    private static getRecycledOrCreate():PositionMetadata  {\n        let pm:PositionMetadata;\n        {\n            if (PositionMetadata.sPool.size() > 0) {\n                pm = PositionMetadata.sPool.remove(0);\n            } else {\n                return new PositionMetadata();\n            }\n        }\n        pm.resetState();\n        return pm;\n    }\n\n    recycle():void  {\n        this.resetState();\n        {\n            if (PositionMetadata.sPool.size() < PositionMetadata.MAX_POOL_SIZE) {\n                PositionMetadata.sPool.add(this);\n            }\n        }\n    }\n\n    /**\n         * Checks whether the group referred to in this object is expanded,\n         * or not (at the time this object was created)\n         * \n         * @return whether the group at groupPos is expanded or not\n         */\n    isExpanded():boolean  {\n        return this.groupMetadata != null;\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/widget/ExpandableListPosition.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../java/util/ArrayList.ts\"/>\n///<reference path=\"../../android/widget/ExpandableListView.ts\"/>\n///<reference path=\"../../android/widget/ListView.ts\"/>\n\nmodule android.widget {\nimport ArrayList = java.util.ArrayList;\nimport ExpandableListView = android.widget.ExpandableListView;\nimport ListView = android.widget.ListView;\n/**\n * ExpandableListPosition can refer to either a group's position or a child's\n * position. Referring to a child's position requires both a group position (the\n * group containing the child) and a child position (the child's position within\n * that group). To create objects, use {@link #obtainChildPosition(int, int)} or\n * {@link #obtainGroupPosition(int)}.\n */\nexport class ExpandableListPosition {\n\n    private static MAX_POOL_SIZE:number = 5;\n\n    private static sPool:ArrayList<ExpandableListPosition> = new ArrayList<ExpandableListPosition>(ExpandableListPosition.MAX_POOL_SIZE);\n\n    /**\n     * This data type represents a child position\n     */\n    static CHILD:number = 1;\n\n    /**\n     * This data type represents a group position\n     */\n    static GROUP:number = 2;\n\n    /**\n     * The position of either the group being referred to, or the parent\n     * group of the child being referred to\n     */\n    groupPos:number = 0;\n\n    /**\n     * The position of the child within its parent group \n     */\n    childPos:number = 0;\n\n    /**\n     * The position of the item in the flat list (optional, used internally when\n     * the corresponding flat list position for the group or child is known)\n     */\n    flatListPos:number = 0;\n\n    /**\n     * What type of position this ExpandableListPosition represents\n     */\n    type:number = 0;\n\n    private resetState():void  {\n        this.groupPos = 0;\n        this.childPos = 0;\n        this.flatListPos = 0;\n        this.type = 0;\n    }\n\n    constructor( ) {\n    }\n\n    getPackedPosition():number  {\n        if (this.type == ExpandableListPosition.CHILD)\n            return ExpandableListView.getPackedPositionForChild(this.groupPos, this.childPos);\n        else\n            return ExpandableListView.getPackedPositionForGroup(this.groupPos);\n    }\n\n    static obtainGroupPosition(groupPosition:number):ExpandableListPosition  {\n        return ExpandableListPosition.obtain(ExpandableListPosition.GROUP, groupPosition, 0, 0);\n    }\n\n    static obtainChildPosition(groupPosition:number, childPosition:number):ExpandableListPosition  {\n        return ExpandableListPosition.obtain(ExpandableListPosition.CHILD, groupPosition, childPosition, 0);\n    }\n\n    static obtainPosition(packedPosition:number):ExpandableListPosition  {\n        if (packedPosition == ExpandableListView.PACKED_POSITION_VALUE_NULL) {\n            return null;\n        }\n        let elp:ExpandableListPosition = ExpandableListPosition.getRecycledOrCreate();\n        elp.groupPos = ExpandableListView.getPackedPositionGroup(packedPosition);\n        if (ExpandableListView.getPackedPositionType(packedPosition) == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {\n            elp.type = ExpandableListPosition.CHILD;\n            elp.childPos = ExpandableListView.getPackedPositionChild(packedPosition);\n        } else {\n            elp.type = ExpandableListPosition.GROUP;\n        }\n        return elp;\n    }\n\n    static obtain(type:number, groupPos:number, childPos:number, flatListPos:number):ExpandableListPosition  {\n        let elp:ExpandableListPosition = ExpandableListPosition.getRecycledOrCreate();\n        elp.type = type;\n        elp.groupPos = groupPos;\n        elp.childPos = childPos;\n        elp.flatListPos = flatListPos;\n        return elp;\n    }\n\n    private static getRecycledOrCreate():ExpandableListPosition  {\n        let elp:ExpandableListPosition;\n        {\n            if (ExpandableListPosition.sPool.size() > 0) {\n                elp = ExpandableListPosition.sPool.remove(0);\n            } else {\n                return new ExpandableListPosition();\n            }\n        }\n        elp.resetState();\n        return elp;\n    }\n\n    /**\n     * Do not call this unless you obtained this via ExpandableListPosition.obtain().\n     * PositionMetadata will handle recycling its own children.\n     */\n    recycle():void  {\n        {\n            if (ExpandableListPosition.sPool.size() < ExpandableListPosition.MAX_POOL_SIZE) {\n                ExpandableListPosition.sPool.add(this);\n            }\n        }\n    }\n}\n}"
  },
  {
    "path": "src/android/widget/ExpandableListView.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/view/SoundEffectConstants.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../java/util/ArrayList.ts\"/>\n///<reference path=\"../../android/widget/Adapter.ts\"/>\n///<reference path=\"../../android/widget/AdapterView.ts\"/>\n///<reference path=\"../../android/widget/ExpandableListAdapter.ts\"/>\n///<reference path=\"../../android/widget/ExpandableListConnector.ts\"/>\n///<reference path=\"../../android/widget/ExpandableListPosition.ts\"/>\n///<reference path=\"../../android/widget/ListAdapter.ts\"/>\n///<reference path=\"../../android/widget/ListView.ts\"/>\n///<reference path=\"../../android/widget/ScrollView.ts\"/>\n///<reference path=\"../../android/R/attr.ts\"/>\n///<reference path=\"../../androidui/util/Long.ts\"/>\n\nmodule android.widget {\nimport Canvas = android.graphics.Canvas;\nimport Rect = android.graphics.Rect;\nimport Drawable = android.graphics.drawable.Drawable;\nimport SoundEffectConstants = android.view.SoundEffectConstants;\nimport View = android.view.View;\nimport PositionMetadata = android.widget.ExpandableListConnector.PositionMetadata;\nimport ArrayList = java.util.ArrayList;\nimport Adapter = android.widget.Adapter;\nimport AdapterView = android.widget.AdapterView;\nimport ExpandableListAdapter = android.widget.ExpandableListAdapter;\nimport ExpandableListConnector = android.widget.ExpandableListConnector;\nimport ExpandableListPosition = android.widget.ExpandableListPosition;\nimport ListAdapter = android.widget.ListAdapter;\nimport ListView = android.widget.ListView;\nimport ScrollView = android.widget.ScrollView;\nimport Long = goog.math.Long;\n    import AttrBinder = androidui.attr.AttrBinder;\n\n/**\n * A view that shows items in a vertically scrolling two-level list. This\n * differs from the {@link ListView} by allowing two levels: groups which can\n * individually be expanded to show its children. The items come from the\n * {@link ExpandableListAdapter} associated with this view.\n * <p>\n * Expandable lists are able to show an indicator beside each item to display\n * the item's current state (the states are usually one of expanded group,\n * collapsed group, child, or last child). Use\n * {@link #setChildIndicator(Drawable)} or {@link #setGroupIndicator(Drawable)}\n * (or the corresponding XML attributes) to set these indicators (see the docs\n * for each method to see additional state that each Drawable can have). The\n * default style for an {@link ExpandableListView} provides indicators which\n * will be shown next to Views given to the {@link ExpandableListView}. The\n * layouts android.R.layout.simple_expandable_list_item_1 and\n * android.R.layout.simple_expandable_list_item_2 (which should be used with\n * {@link SimpleCursorTreeAdapter}) contain the preferred position information\n * for indicators.\n * <p>\n * The context menu information set by an {@link ExpandableListView} will be a\n * {@link ExpandableListContextMenuInfo} object with\n * {@link ExpandableListContextMenuInfo#packedPosition} being a packed position\n * that can be used with {@link #getPackedPositionType(long)} and the other\n * similar methods.\n * <p>\n * <em><b>Note:</b></em> You cannot use the value <code>wrap_content</code>\n * for the <code>android:layout_height</code> attribute of a\n * ExpandableListView in XML if the parent's size is also not strictly specified\n * (for example, if the parent were ScrollView you could not specify\n * wrap_content since it also can be any length. However, you can use\n * wrap_content if the ExpandableListView parent has a specific size, such as\n * 100 pixels.\n * \n * @attr ref android.R.styleable#ExpandableListView_groupIndicator\n * @attr ref android.R.styleable#ExpandableListView_indicatorLeft\n * @attr ref android.R.styleable#ExpandableListView_indicatorRight\n * @attr ref android.R.styleable#ExpandableListView_childIndicator\n * @attr ref android.R.styleable#ExpandableListView_childIndicatorLeft\n * @attr ref android.R.styleable#ExpandableListView_childIndicatorRight\n * @attr ref android.R.styleable#ExpandableListView_childDivider\n * @attr ref android.R.styleable#ExpandableListView_indicatorStart\n * @attr ref android.R.styleable#ExpandableListView_indicatorEnd\n * @attr ref android.R.styleable#ExpandableListView_childIndicatorStart\n * @attr ref android.R.styleable#ExpandableListView_childIndicatorEnd\n */\nexport class ExpandableListView extends ListView {\n\n    /**\n     * The packed position represents a group.\n     */\n    static PACKED_POSITION_TYPE_GROUP:number = 0;\n\n    /**\n     * The packed position represents a child.\n     */\n    static PACKED_POSITION_TYPE_CHILD:number = 1;\n\n    /**\n     * The packed position represents a neither/null/no preference.\n     */\n    static PACKED_POSITION_TYPE_NULL:number = 2;\n\n    /**\n     * The value for a packed position that represents neither/null/no\n     * preference. This value is not otherwise possible since a group type\n     * (first bit 0) should not have a child position filled.\n     */\n    static PACKED_POSITION_VALUE_NULL:number = 0x00000000FFFFFFFF;\n\n    /** The mask (in packed position representation) for the child */\n    private static PACKED_POSITION_MASK_CHILD = Long.fromNumber(0x00000000FFFFFFFF);\n\n    /** The mask (in packed position representation) for the group */\n    private static PACKED_POSITION_MASK_GROUP = Long.fromNumber(0x7FFFFFFF00000000);\n\n    /** The mask (in packed position representation) for the type */\n    private static PACKED_POSITION_MASK_TYPE = Long.fromNumber(0x8000000000000000);\n\n    /** The shift amount (in packed position representation) for the group */\n    private static PACKED_POSITION_SHIFT_GROUP:number = 32;\n\n    /** The shift amount (in packed position representation) for the type */\n    private static PACKED_POSITION_SHIFT_TYPE:number = 63;\n\n    /** The mask (in integer child position representation) for the child */\n    private static PACKED_POSITION_INT_MASK_CHILD = Long.fromNumber(0xFFFFFFFF);\n\n    /** The mask (in integer group position representation) for the group */\n    private static PACKED_POSITION_INT_MASK_GROUP = Long.fromNumber(0x7FFFFFFF);\n\n    /** Serves as the glue/translator between a ListView and an ExpandableListView */\n    private mConnector:ExpandableListConnector;\n\n    /** Gives us Views through group+child positions */\n    private mExpandAdapter:ExpandableListAdapter;\n\n    /** Left bound for drawing the indicator. */\n    private mIndicatorLeft:number = 0;\n\n    /** Right bound for drawing the indicator. */\n    private mIndicatorRight:number = 0;\n\n    /** Start bound for drawing the indicator. */\n    private mIndicatorStart:number = 0;\n\n    /** End bound for drawing the indicator. */\n    private mIndicatorEnd:number = 0;\n\n    /**\n     * Left bound for drawing the indicator of a child. Value of\n     * {@link #CHILD_INDICATOR_INHERIT} means use mIndicatorLeft.\n     */\n    private mChildIndicatorLeft:number = 0;\n\n    /**\n     * Right bound for drawing the indicator of a child. Value of\n     * {@link #CHILD_INDICATOR_INHERIT} means use mIndicatorRight.\n     */\n    private mChildIndicatorRight:number = 0;\n\n    /**\n     * Start bound for drawing the indicator of a child. Value of\n     * {@link #CHILD_INDICATOR_INHERIT} means use mIndicatorStart.\n     */\n    private mChildIndicatorStart:number = 0;\n\n    /**\n     * End bound for drawing the indicator of a child. Value of\n     * {@link #CHILD_INDICATOR_INHERIT} means use mIndicatorEnd.\n     */\n    private mChildIndicatorEnd:number = 0;\n\n    /**\n     * Denotes when a child indicator should inherit this bound from the generic\n     * indicator bounds\n     */\n    static CHILD_INDICATOR_INHERIT:number = -1;\n\n    /**\n     * Denotes an undefined value for an indicator\n     */\n    private static INDICATOR_UNDEFINED:number = -2;\n\n    /** The indicator drawn next to a group. */\n    private mGroupIndicator:Drawable;\n\n    /** The indicator drawn next to a child. */\n    private mChildIndicator:Drawable;\n\n    /** State indicating the group is expanded. */\n    private static GROUP_EXPANDED_STATE_SET:number[] = [ View.VIEW_STATE_EXPANDED ];\n\n    /** State indicating the group is empty (has no children). */\n    private static GROUP_EMPTY_STATE_SET:number[] = [ View.VIEW_STATE_EMPTY ];\n\n    /** State indicating the group is expanded and empty (has no children). */\n    private static GROUP_EXPANDED_EMPTY_STATE_SET:number[] = [ View.VIEW_STATE_EXPANDED, View.VIEW_STATE_EMPTY ];\n\n    /** States for the group where the 0th bit is expanded and 1st bit is empty. */\n    private static GROUP_STATE_SETS:number[][] = [\n    // 00\n    ExpandableListView.EMPTY_STATE_SET,\n    // 01\n    ExpandableListView.GROUP_EXPANDED_STATE_SET,\n    // 10\n    ExpandableListView.GROUP_EMPTY_STATE_SET,\n    // 11\n    ExpandableListView.GROUP_EXPANDED_EMPTY_STATE_SET ];\n\n    /** State indicating the child is the last within its group. */\n    private static CHILD_LAST_STATE_SET:number[] = [ View.VIEW_STATE_LAST ];\n\n    /** Drawable to be used as a divider when it is adjacent to any children */\n    private mChildDivider:Drawable;\n\n    // Bounds of the indicator to be drawn\n    private mIndicatorRect:Rect = new Rect();\n\n    constructor(context:android.content.Context, attrs?:HTMLElement, defStyle=android.R.attr.expandableListViewStyle) {\n       super(context, attrs, defStyle);\n       let a = context.obtainStyledAttributes(attrs, defStyle);\n       this.mGroupIndicator = a.getDrawable('groupIndicator');\n       this.mChildIndicator = a.getDrawable('childIndicator');\n       this.mIndicatorLeft = a.getDimensionPixelSize('indicatorLeft', 0);\n       this.mIndicatorRight = a.getDimensionPixelSize('indicatorRight', 0);\n       if (this.mIndicatorRight == 0 && this.mGroupIndicator != null) {\n           this.mIndicatorRight = this.mIndicatorLeft + this.mGroupIndicator.getIntrinsicWidth();\n       }\n       this.mChildIndicatorLeft = a.getDimensionPixelSize('childIndicatorLeft', ExpandableListView.CHILD_INDICATOR_INHERIT);\n       this.mChildIndicatorRight = a.getDimensionPixelSize('childIndicatorRight', ExpandableListView.CHILD_INDICATOR_INHERIT);\n       this.mChildDivider = a.getDrawable('childDivider');\n       if (!this.isRtlCompatibilityMode()) {\n           this.mIndicatorStart = a.getDimensionPixelSize('indicatorStart', ExpandableListView.INDICATOR_UNDEFINED);\n           this.mIndicatorEnd = a.getDimensionPixelSize('indicatorEnd', ExpandableListView.INDICATOR_UNDEFINED);\n           this.mChildIndicatorStart = a.getDimensionPixelSize('childIndicatorStart', ExpandableListView.CHILD_INDICATOR_INHERIT);\n           this.mChildIndicatorEnd = a.getDimensionPixelSize('childIndicatorEnd', ExpandableListView.CHILD_INDICATOR_INHERIT);\n       }\n       a.recycle();\n    }\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder().set('groupIndicator', {\n            setter(v:ExpandableListView, value:any, attrBinder:AttrBinder) {\n                v.setGroupIndicator(attrBinder.parseDrawable(value));\n            }, getter(v:ExpandableListView) {\n                return v.mGroupIndicator;\n            }\n        }).set('childIndicator', {\n            setter(v:ExpandableListView, value:any, attrBinder:AttrBinder) {\n                v.setChildIndicator(attrBinder.parseDrawable(value));\n            }, getter(v:ExpandableListView) {\n                return v.mChildIndicator;\n            }\n        }).set('indicatorLeft', {\n            setter(v:ExpandableListView, value:any, attrBinder:AttrBinder) {\n                v.setIndicatorBounds(attrBinder.parseNumberPixelOffset(value, 0), v.mIndicatorRight);\n            }, getter(v:ExpandableListView) {\n                return v.mIndicatorLeft;\n            }\n        }).set('indicatorRight', {\n            setter(v:ExpandableListView, value:any, attrBinder:AttrBinder) {\n                let num = attrBinder.parseNumberPixelOffset(value, 0);\n                if (num == 0 && v.mGroupIndicator != null) {\n                    num = v.mIndicatorLeft + v.mGroupIndicator.getIntrinsicWidth();\n                }\n                this.setIndicatorBounds(v.mIndicatorLeft, num);\n            }, getter(v:ExpandableListView) {\n                return v.mIndicatorRight;\n            }\n        }).set('childIndicatorLeft', {\n            setter(v:ExpandableListView, value:any, attrBinder:AttrBinder) {\n                v.setChildIndicatorBounds(attrBinder.parseNumberPixelOffset(value, ExpandableListView.CHILD_INDICATOR_INHERIT), v.mChildIndicatorRight);\n            }, getter(v:ExpandableListView) {\n                return v.mChildIndicatorLeft;\n            }\n        }).set('childIndicatorRight', {\n            setter(v:ExpandableListView, value:any, attrBinder:AttrBinder) {\n                let num = attrBinder.parseNumberPixelOffset(value, ExpandableListView.CHILD_INDICATOR_INHERIT);\n                if (num == 0 && v.mChildIndicator != null) {\n                    num = v.mChildIndicatorLeft + v.mChildIndicator.getIntrinsicWidth();\n                }\n                v.setIndicatorBounds(v.mChildIndicatorLeft, num);\n            }, getter(v:ExpandableListView) {\n                return v.mChildIndicatorRight;\n            }\n        }).set('childDivider', {\n            setter(v:ExpandableListView, value:any, attrBinder:AttrBinder) {\n                v.setChildDivider(attrBinder.parseDrawable(value));\n            }, getter(v:ExpandableListView) {\n                return v.mChildDivider;\n            }\n        });\n    }\n\n    /**\n     * Return true if we are in RTL compatibility mode (either before Jelly Bean MR1 or\n     * RTL not supported)\n     */\n    private isRtlCompatibilityMode():boolean  {\n        return !this.hasRtlSupport();\n    }\n\n    /**\n     * Return true if the application tag in the AndroidManifest has set \"supportRtl\" to true\n     */\n    private hasRtlSupport():boolean  {\n        return false;\n    }\n\n    onRtlPropertiesChanged(layoutDirection:number):void  {\n        this.resolveIndicator();\n        this.resolveChildIndicator();\n    }\n\n    /**\n     * Resolve start/end indicator. start/end indicator always takes precedence over left/right\n     * indicator when defined.\n     */\n    private resolveIndicator():void  {\n        const isLayoutRtl:boolean = this.isLayoutRtl();\n        if (isLayoutRtl) {\n            if (this.mIndicatorStart >= 0) {\n                this.mIndicatorRight = this.mIndicatorStart;\n            }\n            if (this.mIndicatorEnd >= 0) {\n                this.mIndicatorLeft = this.mIndicatorEnd;\n            }\n        } else {\n            if (this.mIndicatorStart >= 0) {\n                this.mIndicatorLeft = this.mIndicatorStart;\n            }\n            if (this.mIndicatorEnd >= 0) {\n                this.mIndicatorRight = this.mIndicatorEnd;\n            }\n        }\n        if (this.mIndicatorRight == 0 && this.mGroupIndicator != null) {\n            this.mIndicatorRight = this.mIndicatorLeft + this.mGroupIndicator.getIntrinsicWidth();\n        }\n    }\n\n    /**\n     * Resolve start/end child indicator. start/end child indicator always takes precedence over\n     * left/right child indicator when defined.\n     */\n    private resolveChildIndicator():void  {\n        const isLayoutRtl:boolean = this.isLayoutRtl();\n        if (isLayoutRtl) {\n            if (this.mChildIndicatorStart >= ExpandableListView.CHILD_INDICATOR_INHERIT) {\n                this.mChildIndicatorRight = this.mChildIndicatorStart;\n            }\n            if (this.mChildIndicatorEnd >= ExpandableListView.CHILD_INDICATOR_INHERIT) {\n                this.mChildIndicatorLeft = this.mChildIndicatorEnd;\n            }\n        } else {\n            if (this.mChildIndicatorStart >= ExpandableListView.CHILD_INDICATOR_INHERIT) {\n                this.mChildIndicatorLeft = this.mChildIndicatorStart;\n            }\n            if (this.mChildIndicatorEnd >= ExpandableListView.CHILD_INDICATOR_INHERIT) {\n                this.mChildIndicatorRight = this.mChildIndicatorEnd;\n            }\n        }\n    }\n\n    protected dispatchDraw(canvas:Canvas):void  {\n        // Draw children, etc.\n        super.dispatchDraw(canvas);\n        // If we have any indicators to draw, we do it here\n        if ((this.mChildIndicator == null) && (this.mGroupIndicator == null)) {\n            return;\n        }\n        let saveCount:number = 0;\n        const clipToPadding:boolean = (this.mGroupFlags & ExpandableListView.CLIP_TO_PADDING_MASK) == ExpandableListView.CLIP_TO_PADDING_MASK;\n        if (clipToPadding) {\n            saveCount = canvas.save();\n            const scrollX:number = this.mScrollX;\n            const scrollY:number = this.mScrollY;\n            canvas.clipRect(scrollX + this.mPaddingLeft, scrollY + this.mPaddingTop, scrollX + this.mRight - this.mLeft - this.mPaddingRight, scrollY + this.mBottom - this.mTop - this.mPaddingBottom);\n        }\n        const headerViewsCount:number = this.getHeaderViewsCount();\n        const lastChildFlPos:number = this.mItemCount - this.getFooterViewsCount() - headerViewsCount - 1;\n        const myB:number = this.mBottom;\n        let pos:PositionMetadata;\n        let item:View;\n        let indicator:Drawable;\n        let t:number, b:number;\n        // Start at a value that is neither child nor group\n        let lastItemType:number = ~(ExpandableListPosition.CHILD | ExpandableListPosition.GROUP);\n        const indicatorRect:Rect = this.mIndicatorRect;\n        // The \"child\" mentioned in the following two lines is this\n        // View's child, not referring to an expandable list's\n        // notion of a child (as opposed to a group)\n        const childCount:number = this.getChildCount();\n        for (let i:number = 0, childFlPos:number = this.mFirstPosition - headerViewsCount; i < childCount; i++, childFlPos++) {\n            if (childFlPos < 0) {\n                // This child is header\n                continue;\n            } else if (childFlPos > lastChildFlPos) {\n                // This child is footer, so are all subsequent children\n                break;\n            }\n            item = this.getChildAt(i);\n            t = item.getTop();\n            b = item.getBottom();\n            // This item isn't on the screen\n            if ((b < 0) || (t > myB))\n                continue;\n            // Get more expandable list-related info for this item\n            pos = this.mConnector.getUnflattenedPos(childFlPos);\n            const isLayoutRtl:boolean = this.isLayoutRtl();\n            const width:number = this.getWidth();\n            // the left & right bounds\n            if (pos.position.type != lastItemType) {\n                if (pos.position.type == ExpandableListPosition.CHILD) {\n                    indicatorRect.left = (this.mChildIndicatorLeft == ExpandableListView.CHILD_INDICATOR_INHERIT) ? this.mIndicatorLeft : this.mChildIndicatorLeft;\n                    indicatorRect.right = (this.mChildIndicatorRight == ExpandableListView.CHILD_INDICATOR_INHERIT) ? this.mIndicatorRight : this.mChildIndicatorRight;\n                } else {\n                    indicatorRect.left = this.mIndicatorLeft;\n                    indicatorRect.right = this.mIndicatorRight;\n                }\n                if (isLayoutRtl) {\n                    const temp:number = indicatorRect.left;\n                    indicatorRect.left = width - indicatorRect.right;\n                    indicatorRect.right = width - temp;\n                    indicatorRect.left -= this.mPaddingRight;\n                    indicatorRect.right -= this.mPaddingRight;\n                } else {\n                    indicatorRect.left += this.mPaddingLeft;\n                    indicatorRect.right += this.mPaddingLeft;\n                }\n                lastItemType = pos.position.type;\n            }\n            if (indicatorRect.left != indicatorRect.right) {\n                // Use item's full height + the divider height\n                if (this.mStackFromBottom) {\n                    // See ListView#dispatchDraw\n                    // - mDividerHeight;\n                    indicatorRect.top = t;\n                    indicatorRect.bottom = b;\n                } else {\n                    indicatorRect.top = t;\n                    // + mDividerHeight;\n                    indicatorRect.bottom = b;\n                }\n                // Get the indicator (with its state set to the item's state)\n                indicator = this.getIndicator(pos);\n                if (indicator != null) {\n                    // Draw the indicator\n                    indicator.setBounds(indicatorRect);\n                    indicator.draw(canvas);\n                }\n            }\n            pos.recycle();\n        }\n        if (clipToPadding) {\n            canvas.restoreToCount(saveCount);\n        }\n    }\n\n    /**\n     * Gets the indicator for the item at the given position. If the indicator\n     * is stateful, the state will be given to the indicator.\n     * \n     * @param pos The flat list position of the item whose indicator\n     *            should be returned.\n     * @return The indicator in the proper state.\n     */\n    private getIndicator(pos:PositionMetadata):Drawable  {\n        let indicator:Drawable;\n        if (pos.position.type == ExpandableListPosition.GROUP) {\n            indicator = this.mGroupIndicator;\n            if (indicator != null && indicator.isStateful()) {\n                // Empty check based on availability of data.  If the groupMetadata isn't null,\n                // we do a check on it. Otherwise, the group is collapsed so we consider it\n                // empty for performance reasons.\n                let isEmpty:boolean = (pos.groupMetadata == null) || (pos.groupMetadata.lastChildFlPos == pos.groupMetadata.flPos);\n                const stateSetIndex:number = // Expanded?\n                (pos.isExpanded() ? 1 : 0) | // Empty?\n                (isEmpty ? 2 : 0);\n                indicator.setState(ExpandableListView.GROUP_STATE_SETS[stateSetIndex]);\n            }\n        } else {\n            indicator = this.mChildIndicator;\n            if (indicator != null && indicator.isStateful()) {\n                // No need for a state sets array for the child since it only has two states\n                const stateSet = pos.position.flatListPos == pos.groupMetadata.lastChildFlPos ? ExpandableListView.CHILD_LAST_STATE_SET : ExpandableListView.EMPTY_STATE_SET;\n                indicator.setState(stateSet);\n            }\n        }\n        return indicator;\n    }\n\n    /**\n     * Sets the drawable that will be drawn adjacent to every child in the list. This will\n     * be drawn using the same height as the normal divider ({@link #setDivider(Drawable)}) or\n     * if it does not have an intrinsic height, the height set by {@link #setDividerHeight(int)}.\n     * \n     * @param childDivider The drawable to use.\n     */\n    setChildDivider(childDivider:Drawable):void  {\n        this.mChildDivider = childDivider;\n    }\n\n    drawDivider(canvas:Canvas, bounds:Rect, childIndex:number):void  {\n        let flatListPosition:number = childIndex + this.mFirstPosition;\n        // all items, then the item below it has to be a group)\n        if (flatListPosition >= 0) {\n            const adjustedPosition:number = this.getFlatPositionForConnector(flatListPosition);\n            let pos:PositionMetadata = this.mConnector.getUnflattenedPos(adjustedPosition);\n            // If this item is a child, or it is a non-empty group that is expanded\n            if ((pos.position.type == ExpandableListPosition.CHILD) || (pos.isExpanded() && pos.groupMetadata.lastChildFlPos != pos.groupMetadata.flPos)) {\n                // These are the cases where we draw the child divider\n                const divider:Drawable = this.mChildDivider;\n                divider.setBounds(bounds);\n                divider.draw(canvas);\n                pos.recycle();\n                return;\n            }\n            pos.recycle();\n        }\n        // Otherwise draw the default divider\n        super.drawDivider(canvas, bounds, flatListPosition);\n    }\n\n    /**\n     * This overloaded method should not be used, instead use\n     * {@link #setAdapter(ExpandableListAdapter)}.\n     * <p>\n     * {@inheritDoc}\n     */\n    setAdapter(adapter:ListAdapter):void  {\n        throw Error(`new RuntimeException(\"For ExpandableListView, use setAdapter(ExpandableListAdapter) instead of \" + \"setAdapter(ListAdapter)\")`);\n    }\n\n    /**\n     * This method should not be used, use {@link #getExpandableListAdapter()}.\n     */\n    getAdapter():ListAdapter  {\n        /*\n         * The developer should never really call this method on an\n         * ExpandableListView, so it would be nice to throw a RuntimeException,\n         * but AdapterView calls this\n         */\n        return super.getAdapter();\n    }\n\n    /**\n     * Register a callback to be invoked when an item has been clicked and the\n     * caller prefers to receive a ListView-style position instead of a group\n     * and/or child position. In most cases, the caller should use\n     * {@link #setOnGroupClickListener} and/or {@link #setOnChildClickListener}.\n     * <p />\n     * {@inheritDoc}\n     */\n    setOnItemClickListener(l:AdapterView.OnItemClickListener):void  {\n        super.setOnItemClickListener(l);\n    }\n\n    /**\n     * Sets the adapter that provides data to this view.\n     * @param adapter The adapter that provides data to this view.\n     */\n    setExpandableAdapter(adapter:ExpandableListAdapter):void  {\n        // Set member variable\n        this.mExpandAdapter = adapter;\n        if (adapter != null) {\n            // Create the connector\n            this.mConnector = new ExpandableListConnector(adapter);\n        } else {\n            this.mConnector = null;\n        }\n        // Link the ListView (superclass) to the expandable list data through the connector\n        super.setAdapter(this.mConnector);\n    }\n\n    /**\n     * Gets the adapter that provides data to this view.\n     * @return The adapter that provides data to this view.\n     */\n    getExpandableListAdapter():ExpandableListAdapter  {\n        return this.mExpandAdapter;\n    }\n\n    /**\n     * @param position An absolute (including header and footer) flat list position.\n     * @return true if the position corresponds to a header or a footer item.\n     */\n    private isHeaderOrFooterPosition(position:number):boolean  {\n        const footerViewsStart:number = this.mItemCount - this.getFooterViewsCount();\n        return (position < this.getHeaderViewsCount() || position >= footerViewsStart);\n    }\n\n    /**\n     * Converts an absolute item flat position into a group/child flat position, shifting according\n     * to the number of header items.\n     * \n     * @param flatListPosition The absolute flat position\n     * @return A group/child flat position as expected by the connector.\n     */\n    private getFlatPositionForConnector(flatListPosition:number):number  {\n        return flatListPosition - this.getHeaderViewsCount();\n    }\n\n    /**\n     * Converts a group/child flat position into an absolute flat position, that takes into account\n     * the possible headers.\n     * \n     * @param flatListPosition The child/group flat position\n     * @return An absolute flat position.\n     */\n    private getAbsoluteFlatPosition(flatListPosition:number):number  {\n        return flatListPosition + this.getHeaderViewsCount();\n    }\n\n    performItemClick(v:View, position:number, id:number):boolean  {\n        // Ignore clicks in header/footers\n        if (this.isHeaderOrFooterPosition(position)) {\n            // Clicked on a header/footer, so ignore pass it on to super\n            return super.performItemClick(v, position, id);\n        }\n        // Internally handle the item click\n        const adjustedPosition:number = this.getFlatPositionForConnector(position);\n        return this.handleItemClick(v, adjustedPosition, id);\n    }\n\n    /**\n     * This will either expand/collapse groups (if a group was clicked) or pass\n     * on the click to the proper child (if a child was clicked)\n     * \n     * @param position The flat list position. This has already been factored to\n     *            remove the header/footer.\n     * @param id The ListAdapter ID, not the group or child ID.\n     */\n    handleItemClick(v:View, position:number, id:number):boolean  {\n        const posMetadata:PositionMetadata = this.mConnector.getUnflattenedPos(position);\n        id = this.getChildOrGroupId(posMetadata.position);\n        let returnValue:boolean;\n        if (posMetadata.position.type == ExpandableListPosition.GROUP) {\n            /* It's a group click, so pass on event */\n            if (this.mOnGroupClickListener != null) {\n                if (this.mOnGroupClickListener.onGroupClick(this, v, posMetadata.position.groupPos, id)) {\n                    posMetadata.recycle();\n                    return true;\n                }\n            }\n            if (posMetadata.isExpanded()) {\n                /* Collapse it */\n                this.mConnector.collapseGroupWithMeta(posMetadata);\n                this.playSoundEffect(SoundEffectConstants.CLICK);\n                if (this.mOnGroupCollapseListener != null) {\n                    this.mOnGroupCollapseListener.onGroupCollapse(posMetadata.position.groupPos);\n                }\n            } else {\n                /* Expand it */\n                this.mConnector.expandGroupWithMeta(posMetadata);\n                this.playSoundEffect(SoundEffectConstants.CLICK);\n                if (this.mOnGroupExpandListener != null) {\n                    this.mOnGroupExpandListener.onGroupExpand(posMetadata.position.groupPos);\n                }\n                const groupPos:number = posMetadata.position.groupPos;\n                const groupFlatPos:number = posMetadata.position.flatListPos;\n                const shiftedGroupPosition:number = groupFlatPos + this.getHeaderViewsCount();\n                this.smoothScrollToPosition(shiftedGroupPosition + this.mExpandAdapter.getChildrenCount(groupPos), shiftedGroupPosition);\n            }\n            returnValue = true;\n        } else {\n            /* It's a child, so pass on event */\n            if (this.mOnChildClickListener != null) {\n                this.playSoundEffect(SoundEffectConstants.CLICK);\n                return this.mOnChildClickListener.onChildClick(this, v, posMetadata.position.groupPos, posMetadata.position.childPos, id);\n            }\n            returnValue = false;\n        }\n        posMetadata.recycle();\n        return returnValue;\n    }\n\n    /**\n     * Expand a group in the grouped list view\n     *\n     * @param groupPos the group to be expanded\n     * @param animate true if the expanding group should be animated in\n     * @return True if the group was expanded, false otherwise (if the group\n     *         was already expanded, this will return false)\n     */\n    expandGroup(groupPos:number, animate=false):boolean  {\n        let elGroupPos:ExpandableListPosition = ExpandableListPosition.obtain(ExpandableListPosition.GROUP, groupPos, -1, -1);\n        let pm:PositionMetadata = this.mConnector.getFlattenedPos(elGroupPos);\n        elGroupPos.recycle();\n        let retValue:boolean = this.mConnector.expandGroupWithMeta(pm);\n        if (this.mOnGroupExpandListener != null) {\n            this.mOnGroupExpandListener.onGroupExpand(groupPos);\n        }\n        if (animate) {\n            const groupFlatPos:number = pm.position.flatListPos;\n            const shiftedGroupPosition:number = groupFlatPos + this.getHeaderViewsCount();\n            this.smoothScrollToPosition(shiftedGroupPosition + this.mExpandAdapter.getChildrenCount(groupPos), shiftedGroupPosition);\n        }\n        pm.recycle();\n        return retValue;\n    }\n\n    /**\n     * Collapse a group in the grouped list view\n     * \n     * @param groupPos position of the group to collapse\n     * @return True if the group was collapsed, false otherwise (if the group\n     *         was already collapsed, this will return false)\n     */\n    collapseGroup(groupPos:number):boolean  {\n        let retValue:boolean = this.mConnector.collapseGroup(groupPos);\n        if (this.mOnGroupCollapseListener != null) {\n            this.mOnGroupCollapseListener.onGroupCollapse(groupPos);\n        }\n        return retValue;\n    }\n\n\n\n    private mOnGroupCollapseListener:ExpandableListView.OnGroupCollapseListener;\n\n    setOnGroupCollapseListener(onGroupCollapseListener:ExpandableListView.OnGroupCollapseListener):void  {\n        this.mOnGroupCollapseListener = onGroupCollapseListener;\n    }\n\n\n\n    private mOnGroupExpandListener:ExpandableListView.OnGroupExpandListener;\n\n    setOnGroupExpandListener(onGroupExpandListener:ExpandableListView.OnGroupExpandListener):void  {\n        this.mOnGroupExpandListener = onGroupExpandListener;\n    }\n\n\n\n    private mOnGroupClickListener:ExpandableListView.OnGroupClickListener;\n\n    setOnGroupClickListener(onGroupClickListener:ExpandableListView.OnGroupClickListener):void  {\n        this.mOnGroupClickListener = onGroupClickListener;\n    }\n\n\n\n    private mOnChildClickListener:ExpandableListView.OnChildClickListener;\n\n    setOnChildClickListener(onChildClickListener:ExpandableListView.OnChildClickListener):void  {\n        this.mOnChildClickListener = onChildClickListener;\n    }\n\n    /**\n     * Converts a flat list position (the raw position of an item (child or group)\n     * in the list) to a group and/or child position (represented in a\n     * packed position). This is useful in situations where the caller needs to\n     * use the underlying {@link ListView}'s methods. Use\n     * {@link ExpandableListView#getPackedPositionType} ,\n     * {@link ExpandableListView#getPackedPositionChild},\n     * {@link ExpandableListView#getPackedPositionGroup} to unpack.\n     * \n     * @param flatListPosition The flat list position to be converted.\n     * @return The group and/or child position for the given flat list position\n     *         in packed position representation. #PACKED_POSITION_VALUE_NULL if\n     *         the position corresponds to a header or a footer item.\n     */\n    getExpandableListPosition(flatListPosition:number):number  {\n        if (this.isHeaderOrFooterPosition(flatListPosition)) {\n            return ExpandableListView.PACKED_POSITION_VALUE_NULL;\n        }\n        const adjustedPosition:number = this.getFlatPositionForConnector(flatListPosition);\n        let pm:PositionMetadata = this.mConnector.getUnflattenedPos(adjustedPosition);\n        let packedPos:number = pm.position.getPackedPosition();\n        pm.recycle();\n        return packedPos;\n    }\n\n    /**\n     * Converts a group and/or child position to a flat list position. This is\n     * useful in situations where the caller needs to use the underlying\n     * {@link ListView}'s methods.\n     * \n     * @param packedPosition The group and/or child positions to be converted in\n     *            packed position representation. Use\n     *            {@link #getPackedPositionForChild(int, int)} or\n     *            {@link #getPackedPositionForGroup(int)}.\n     * @return The flat list position for the given child or group.\n     */\n    getFlatListPosition(packedPosition:number):number  {\n        let elPackedPos:ExpandableListPosition = ExpandableListPosition.obtainPosition(packedPosition);\n        let pm:PositionMetadata = this.mConnector.getFlattenedPos(elPackedPos);\n        elPackedPos.recycle();\n        const flatListPosition:number = pm.position.flatListPos;\n        pm.recycle();\n        return this.getAbsoluteFlatPosition(flatListPosition);\n    }\n\n    /**\n     * Gets the position of the currently selected group or child (along with\n     * its type). Can return {@link #PACKED_POSITION_VALUE_NULL} if no selection.\n     * \n     * @return A packed position containing the currently selected group or\n     *         child's position and type. #PACKED_POSITION_VALUE_NULL if no selection\n     *         or if selection is on a header or a footer item.\n     */\n    getSelectedPosition():number  {\n        const selectedPos:number = this.getSelectedItemPosition();\n        // The case where there is no selection (selectedPos == -1) is also handled here.\n        return this.getExpandableListPosition(selectedPos);\n    }\n\n    /**\n     * Gets the ID of the currently selected group or child. Can return -1 if no\n     * selection.\n     * \n     * @return The ID of the currently selected group or child. -1 if no\n     *         selection.\n     */\n    getSelectedId():number  {\n        let packedPos:number = this.getSelectedPosition();\n        if (packedPos == ExpandableListView.PACKED_POSITION_VALUE_NULL)\n            return -1;\n        let groupPos:number = ExpandableListView.getPackedPositionGroup(packedPos);\n        if (ExpandableListView.getPackedPositionType(packedPos) == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {\n            // It's a group\n            return this.mExpandAdapter.getGroupId(groupPos);\n        } else {\n            // It's a child\n            return this.mExpandAdapter.getChildId(groupPos, ExpandableListView.getPackedPositionChild(packedPos));\n        }\n    }\n\n    /**\n     * Sets the selection to the specified group.\n     * @param groupPosition The position of the group that should be selected.\n     */\n    setSelectedGroup(groupPosition:number):void  {\n        let elGroupPos:ExpandableListPosition = ExpandableListPosition.obtainGroupPosition(groupPosition);\n        let pm:PositionMetadata = this.mConnector.getFlattenedPos(elGroupPos);\n        elGroupPos.recycle();\n        const absoluteFlatPosition:number = this.getAbsoluteFlatPosition(pm.position.flatListPos);\n        super.setSelection(absoluteFlatPosition);\n        pm.recycle();\n    }\n\n    /**\n     * Sets the selection to the specified child. If the child is in a collapsed\n     * group, the group will only be expanded and child subsequently selected if\n     * shouldExpandGroup is set to true, otherwise the method will return false.\n     * \n     * @param groupPosition The position of the group that contains the child.\n     * @param childPosition The position of the child within the group.\n     * @param shouldExpandGroup Whether the child's group should be expanded if\n     *            it is collapsed.\n     * @return Whether the selection was successfully set on the child.\n     */\n    setSelectedChild(groupPosition:number, childPosition:number, shouldExpandGroup:boolean):boolean  {\n        let elChildPos:ExpandableListPosition = ExpandableListPosition.obtainChildPosition(groupPosition, childPosition);\n        let flatChildPos:PositionMetadata = this.mConnector.getFlattenedPos(elChildPos);\n        if (flatChildPos == null) {\n            // Shouldn't expand the group, so return false for we didn't set the selection\n            if (!shouldExpandGroup)\n                return false;\n            this.expandGroup(groupPosition);\n            flatChildPos = this.mConnector.getFlattenedPos(elChildPos);\n            // Sanity check\n            if (flatChildPos == null) {\n                throw Error(`new IllegalStateException(\"Could not find child\")`);\n            }\n        }\n        let absoluteFlatPosition:number = this.getAbsoluteFlatPosition(flatChildPos.position.flatListPos);\n        super.setSelection(absoluteFlatPosition);\n        elChildPos.recycle();\n        flatChildPos.recycle();\n        return true;\n    }\n\n    /**\n     * Whether the given group is currently expanded.\n     * \n     * @param groupPosition The group to check.\n     * @return Whether the group is currently expanded.\n     */\n    isGroupExpanded(groupPosition:number):boolean  {\n        return this.mConnector.isGroupExpanded(groupPosition);\n    }\n\n    /**\n     * Gets the type of a packed position. See\n     * {@link #getPackedPositionForChild(int, int)}.\n     * \n     * @param packedPosition The packed position for which to return the type.\n     * @return The type of the position contained within the packed position,\n     *         either {@link #PACKED_POSITION_TYPE_CHILD}, {@link #PACKED_POSITION_TYPE_GROUP}, or\n     *         {@link #PACKED_POSITION_TYPE_NULL}.\n     */\n    static getPackedPositionType(packedPosition:number):number  {\n        if (packedPosition == ExpandableListView.PACKED_POSITION_VALUE_NULL) {\n            return ExpandableListView.PACKED_POSITION_TYPE_NULL;\n        }\n        //return (packedPosition & ExpandableListView.PACKED_POSITION_MASK_TYPE) == ExpandableListView.PACKED_POSITION_MASK_TYPE\n        //    ? ExpandableListView.PACKED_POSITION_TYPE_CHILD : ExpandableListView.PACKED_POSITION_TYPE_GROUP;\n        return (Long.fromNumber(packedPosition).and(ExpandableListView.PACKED_POSITION_MASK_TYPE)).equals(ExpandableListView.PACKED_POSITION_MASK_TYPE)\n            ? ExpandableListView.PACKED_POSITION_TYPE_CHILD : ExpandableListView.PACKED_POSITION_TYPE_GROUP;\n    }\n\n    /**\n     * Gets the group position from a packed position. See\n     * {@link #getPackedPositionForChild(int, int)}.\n     * \n     * @param packedPosition The packed position from which the group position\n     *            will be returned.\n     * @return The group position portion of the packed position. If this does\n     *         not contain a group, returns -1.\n     */\n    static getPackedPositionGroup(packedPosition:number):number  {\n        // Null\n        if (packedPosition == ExpandableListView.PACKED_POSITION_VALUE_NULL)\n            return -1;\n        //return (packedPosition & ExpandableListView.PACKED_POSITION_MASK_GROUP) >> ExpandableListView.PACKED_POSITION_SHIFT_GROUP;\n        return (Long.fromNumber(packedPosition).and(ExpandableListView.PACKED_POSITION_MASK_GROUP))\n            .shiftRight(ExpandableListView.PACKED_POSITION_SHIFT_GROUP).toNumber();\n    }\n\n    /**\n     * Gets the child position from a packed position that is of\n     * {@link #PACKED_POSITION_TYPE_CHILD} type (use {@link #getPackedPositionType(long)}).\n     * To get the group that this child belongs to, use\n     * {@link #getPackedPositionGroup(long)}. See\n     * {@link #getPackedPositionForChild(int, int)}.\n     * \n     * @param packedPosition The packed position from which the child position\n     *            will be returned.\n     * @return The child position portion of the packed position. If this does\n     *         not contain a child, returns -1.\n     */\n    static getPackedPositionChild(packedPosition:number):number  {\n        // Null\n        if (packedPosition == ExpandableListView.PACKED_POSITION_VALUE_NULL)\n            return -1;\n        // Group since a group type clears this bit\n        //if ((packedPosition & ExpandableListView.PACKED_POSITION_MASK_TYPE) != ExpandableListView.PACKED_POSITION_MASK_TYPE)\n        if ((Long.fromNumber(packedPosition).and(ExpandableListView.PACKED_POSITION_MASK_TYPE)).notEquals(ExpandableListView.PACKED_POSITION_MASK_TYPE))\n            return -1;\n        return Long.fromNumber(packedPosition).and(ExpandableListView.PACKED_POSITION_MASK_CHILD).toNumber();\n    }\n\n    /**\n     * Returns the packed position representation of a child's position.\n     * <p>\n     * In general, a packed position should be used in\n     * situations where the position given to/returned from an\n     * {@link ExpandableListAdapter} or {@link ExpandableListView} method can\n     * either be a child or group. The two positions are packed into a single\n     * long which can be unpacked using\n     * {@link #getPackedPositionChild(long)},\n     * {@link #getPackedPositionGroup(long)}, and\n     * {@link #getPackedPositionType(long)}.\n     * \n     * @param groupPosition The child's parent group's position.\n     * @param childPosition The child position within the group.\n     * @return The packed position representation of the child (and parent group).\n     */\n    static getPackedPositionForChild(groupPosition:number, childPosition:number):number  {\n        //return (ExpandableListView.PACKED_POSITION_TYPE_CHILD << ExpandableListView.PACKED_POSITION_SHIFT_TYPE)\n        //    | ((groupPosition & ExpandableListView.PACKED_POSITION_INT_MASK_GROUP) << ExpandableListView.PACKED_POSITION_SHIFT_GROUP)\n        //    | (childPosition & ExpandableListView.PACKED_POSITION_INT_MASK_CHILD);\n        return Long.fromInt(ExpandableListView.PACKED_POSITION_TYPE_CHILD).shiftLeft(ExpandableListView.PACKED_POSITION_SHIFT_TYPE)\n        .or(Long.fromNumber(groupPosition).and(ExpandableListView.PACKED_POSITION_INT_MASK_GROUP).shiftLeft(ExpandableListView.PACKED_POSITION_SHIFT_GROUP))\n        .or(Long.fromNumber(childPosition).and(ExpandableListView.PACKED_POSITION_INT_MASK_CHILD)).toNumber();\n    }\n\n    /**\n     * Returns the packed position representation of a group's position. See\n     * {@link #getPackedPositionForChild(int, int)}.\n     * \n     * @param groupPosition The child's parent group's position.\n     * @return The packed position representation of the group.\n     */\n    static getPackedPositionForGroup(groupPosition:number):number  {\n        // No need to OR a type in because PACKED_POSITION_GROUP == 0\n        //return ((groupPosition & ExpandableListView.PACKED_POSITION_INT_MASK_GROUP) << ExpandableListView.PACKED_POSITION_SHIFT_GROUP);\n        return Long.fromInt(groupPosition).and(ExpandableListView.PACKED_POSITION_INT_MASK_GROUP)\n            .shiftLeft(ExpandableListView.PACKED_POSITION_SHIFT_GROUP).toNumber();\n    }\n\n    //createContextMenuInfo(view:View, flatListPosition:number, id:number):ContextMenuInfo  {\n    //    if (this.isHeaderOrFooterPosition(flatListPosition)) {\n    //        // Return normal info for header/footer view context menus\n    //        return new AdapterView.AdapterContextMenuInfo(view, flatListPosition, id);\n    //    }\n    //    const adjustedPosition:number = this.getFlatPositionForConnector(flatListPosition);\n    //    let pm:PositionMetadata = this.mConnector.getUnflattenedPos(adjustedPosition);\n    //    let pos:ExpandableListPosition = pm.position;\n    //    id = this.getChildOrGroupId(pos);\n    //    let packedPosition:number = pos.getPackedPosition();\n    //    pm.recycle();\n    //    return new ExpandableListView.ExpandableListContextMenuInfo(view, packedPosition, id);\n    //}\n\n    /**\n     * Gets the ID of the group or child at the given <code>position</code>.\n     * This is useful since there is no ListAdapter ID -> ExpandableListAdapter\n     * ID conversion mechanism (in some cases, it isn't possible).\n     * \n     * @param position The position of the child or group whose ID should be\n     *            returned.\n     */\n    private getChildOrGroupId(position:ExpandableListPosition):number  {\n        if (position.type == ExpandableListPosition.CHILD) {\n            return this.mExpandAdapter.getChildId(position.groupPos, position.childPos);\n        } else {\n            return this.mExpandAdapter.getGroupId(position.groupPos);\n        }\n    }\n\n    /**\n     * Sets the indicator to be drawn next to a child.\n     * \n     * @param childIndicator The drawable to be used as an indicator. If the\n     *            child is the last child for a group, the state\n     *            {@link android.R.attr#state_last} will be set.\n     */\n    setChildIndicator(childIndicator:Drawable):void  {\n        this.mChildIndicator = childIndicator;\n    }\n\n    /**\n     * Sets the drawing bounds for the child indicator. For either, you can\n     * specify {@link #CHILD_INDICATOR_INHERIT} to use inherit from the general\n     * indicator's bounds.\n     *\n     * @see #setIndicatorBounds(int, int)\n     * @param left The left position (relative to the left bounds of this View)\n     *            to start drawing the indicator.\n     * @param right The right position (relative to the left bounds of this\n     *            View) to end the drawing of the indicator.\n     */\n    setChildIndicatorBounds(left:number, right:number):void  {\n        this.mChildIndicatorLeft = left;\n        this.mChildIndicatorRight = right;\n        this.resolveChildIndicator();\n    }\n\n    /**\n     * Sets the relative drawing bounds for the child indicator. For either, you can\n     * specify {@link #CHILD_INDICATOR_INHERIT} to use inherit from the general\n     * indicator's bounds.\n     *\n     * @see #setIndicatorBounds(int, int)\n     * @param start The start position (relative to the start bounds of this View)\n     *            to start drawing the indicator.\n     * @param end The end position (relative to the end bounds of this\n     *            View) to end the drawing of the indicator.\n     */\n    setChildIndicatorBoundsRelative(start:number, end:number):void  {\n        this.mChildIndicatorStart = start;\n        this.mChildIndicatorEnd = end;\n        this.resolveChildIndicator();\n    }\n\n    /**\n     * Sets the indicator to be drawn next to a group.\n     * \n     * @param groupIndicator The drawable to be used as an indicator. If the\n     *            group is empty, the state {@link android.R.attr#state_empty} will be\n     *            set. If the group is expanded, the state\n     *            {@link android.R.attr#state_expanded} will be set.\n     */\n    setGroupIndicator(groupIndicator:Drawable):void  {\n        this.mGroupIndicator = groupIndicator;\n        if (this.mIndicatorRight == 0 && this.mGroupIndicator != null) {\n            this.mIndicatorRight = this.mIndicatorLeft + this.mGroupIndicator.getIntrinsicWidth();\n        }\n    }\n\n    /**\n     * Sets the drawing bounds for the indicators (at minimum, the group indicator\n     * is affected by this; the child indicator is affected by this if the\n     * child indicator bounds are set to inherit).\n     * \n     * @see #setChildIndicatorBounds(int, int) \n     * @param left The left position (relative to the left bounds of this View)\n     *            to start drawing the indicator.\n     * @param right The right position (relative to the left bounds of this\n     *            View) to end the drawing of the indicator.\n     */\n    setIndicatorBounds(left:number, right:number):void  {\n        this.mIndicatorLeft = left;\n        this.mIndicatorRight = right;\n        this.resolveIndicator();\n    }\n\n    /**\n     * Sets the relative drawing bounds for the indicators (at minimum, the group indicator\n     * is affected by this; the child indicator is affected by this if the\n     * child indicator bounds are set to inherit).\n     *\n     * @see #setChildIndicatorBounds(int, int)\n     * @param start The start position (relative to the start bounds of this View)\n     *            to start drawing the indicator.\n     * @param end The end position (relative to the end bounds of this\n     *            View) to end the drawing of the indicator.\n     */\n    setIndicatorBoundsRelative(start:number, end:number):void  {\n        this.mIndicatorStart = start;\n        this.mIndicatorEnd = end;\n        this.resolveIndicator();\n    }\n}\n\nexport module ExpandableListView{\n/** Used for being notified when a group is collapsed */\nexport interface OnGroupCollapseListener {\n\n    /**\n         * Callback method to be invoked when a group in this expandable list has\n         * been collapsed.\n         * \n         * @param groupPosition The group position that was collapsed\n         */\n    onGroupCollapse(groupPosition:number):void ;\n}\n/** Used for being notified when a group is expanded */\nexport interface OnGroupExpandListener {\n\n    /**\n         * Callback method to be invoked when a group in this expandable list has\n         * been expanded.\n         * \n         * @param groupPosition The group position that was expanded\n         */\n    onGroupExpand(groupPosition:number):void ;\n}\n/**\n     * Interface definition for a callback to be invoked when a group in this\n     * expandable list has been clicked.\n     */\nexport interface OnGroupClickListener {\n\n    /**\n         * Callback method to be invoked when a group in this expandable list has\n         * been clicked.\n         * \n         * @param parent The ExpandableListConnector where the click happened\n         * @param v The view within the expandable list/ListView that was clicked\n         * @param groupPosition The group position that was clicked\n         * @param id The row id of the group that was clicked\n         * @return True if the click was handled\n         */\n    onGroupClick(parent:ExpandableListView, v:View, groupPosition:number, id:number):boolean ;\n}\n/**\n     * Interface definition for a callback to be invoked when a child in this\n     * expandable list has been clicked.\n     */\nexport interface OnChildClickListener {\n\n    /**\n         * Callback method to be invoked when a child in this expandable list has\n         * been clicked.\n         * \n         * @param parent The ExpandableListView where the click happened\n         * @param v The view within the expandable list/ListView that was clicked\n         * @param groupPosition The group position that contains the child that\n         *        was clicked\n         * @param childPosition The child position within the group\n         * @param id The row id of the child that was clicked\n         * @return True if the click was handled\n         */\n    onChildClick(parent:ExpandableListView, v:View, groupPosition:number, childPosition:number, id:number):boolean ;\n}\n}\n\n}"
  },
  {
    "path": "src/android/widget/FrameLayout.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../view/Gravity.ts\"/>\n///<reference path=\"../view/ViewOverlay.ts\"/>\n///<reference path=\"../view/ViewGroup.ts\"/>\n///<reference path=\"../view/View.ts\"/>\n///<reference path=\"../graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../graphics/Rect.ts\"/>\n///<reference path=\"../graphics/Canvas.ts\"/>\n\nmodule android.widget {\n    import Gravity = android.view.Gravity;\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Rect = android.graphics.Rect;\n    import Canvas = android.graphics.Canvas;\n    import AttrBinder = androidui.attr.AttrBinder;\n    import Context = android.content.Context;\n\n    /**\n     * FrameLayout is designed to block out an area on the screen to display\n     * a single item. Generally, FrameLayout should be used to hold a single child view, because it can\n     * be difficult to organize child views in a way that's scalable to different screen sizes without\n     * the children overlapping each other. You can, however, add multiple children to a FrameLayout\n     * and control their position within the FrameLayout by assigning gravity to each child, using the\n     * <a href=\"FrameLayout.LayoutParams.html#attr_android:layout_gravity\">{@code\n     * android:layout_gravity}</a> attribute.\n     * <p>Child views are drawn in a stack, with the most recently added child on top.\n     * The size of the FrameLayout is the size of its largest child (plus padding), visible\n     * or not (if the FrameLayout's parent permits). Views that are {@link android.view.View#GONE} are\n     * used for sizing\n     * only if {@link #setMeasureAllChildren(boolean) setConsiderGoneChildrenWhenMeasuring()}\n     * is set to true.\n     *\n     * @attr ref android.R.styleable#FrameLayout_foreground\n     * @attr ref android.R.styleable#FrameLayout_foregroundGravity\n     * @attr ref android.R.styleable#FrameLayout_measureAllChildren\n     */\n    export class FrameLayout extends ViewGroup {\n        static DEFAULT_CHILD_GRAVITY = Gravity.TOP | Gravity.LEFT;\n\n        mMeasureAllChildren = false;\n        mForeground:Drawable;\n        private mForegroundPaddingLeft = 0;\n        private mForegroundPaddingTop = 0;\n        private mForegroundPaddingRight = 0;\n        private mForegroundPaddingBottom = 0;\n        private mSelfBounds = new Rect();\n        private mOverlayBounds = new Rect();\n        private mForegroundGravity = Gravity.FILL;\n        mForegroundInPadding = true;\n        mForegroundBoundsChanged = false;\n        private mMatchParentChildren = new Array<View>(1);\n\n        constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n            super(context, bindElement, defStyle);\n\n            const a = context.obtainStyledAttributes(bindElement, defStyle);\n            this.mForegroundGravity = Gravity.parseGravity(a.getAttrValue('foregroundGravity'), this.mForegroundGravity);\n\n            const d = a.getDrawable('foreground');\n            if (d != null) {\n                this.setForeground(d);\n            }\n\n            if (a.getBoolean('measureAllChildren', false)) {\n                this.setMeasureAllChildren(true);\n            }\n\n            this.mForegroundInPadding = a.getBoolean('foregroundInsidePadding', true);\n            a.recycle();\n        }\n\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n            return super.createClassAttrBinder().set('foregroundGravity', {\n                setter(v:FrameLayout, value:any, attrBinder:AttrBinder) {\n                    v.mForegroundGravity = attrBinder.parseGravity(value, v.mForegroundGravity);\n                }, getter(v:FrameLayout) {\n                    return v.mForegroundGravity;\n                }\n            }).set('foreground', {\n                setter(v:FrameLayout, value:any, attrBinder:AttrBinder) {\n                    v.setForeground(attrBinder.parseDrawable(value));\n                }, getter(v:FrameLayout) {\n                    return v.getForeground();\n                }\n            }).set('measureAllChildren', {\n                setter(v:FrameLayout, value:any, attrBinder:AttrBinder) {\n                    if (attrBinder.parseBoolean(value)) {\n                        v.setMeasureAllChildren(true);\n                    }\n                }, getter(v:FrameLayout) {\n                    return v.mMeasureAllChildren;\n                }\n            });\n        }\n\n        /**\n         * Describes how the foreground is positioned.\n         *\n         * @return foreground gravity.\n         *\n         * @see #setForegroundGravity(int)\n         *\n         * @attr ref android.R.styleable#FrameLayout_foregroundGravity\n         */\n        getForegroundGravity():number {\n            return this.mForegroundGravity;\n        }\n\n        /**\n         * Describes how the foreground is positioned. Defaults to START and TOP.\n         *\n         * @param foregroundGravity See {@link android.view.Gravity}\n         *\n         * @see #getForegroundGravity()\n         *\n         * @attr ref android.R.styleable#FrameLayout_foregroundGravity\n         */\n        setForegroundGravity(foregroundGravity:number) {\n            if (this.mForegroundGravity != foregroundGravity) {\n                if ((foregroundGravity & Gravity.HORIZONTAL_GRAVITY_MASK) == 0) {\n                    foregroundGravity |= Gravity.LEFT;\n                }\n\n                if ((foregroundGravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) {\n                    foregroundGravity |= Gravity.TOP;\n                }\n\n                this.mForegroundGravity = foregroundGravity;\n\n\n                if (this.mForegroundGravity == Gravity.FILL && this.mForeground != null) {\n                    let padding = new Rect();\n                    if (this.mForeground.getPadding(padding)) {\n                        this.mForegroundPaddingLeft = padding.left;\n                        this.mForegroundPaddingTop = padding.top;\n                        this.mForegroundPaddingRight = padding.right;\n                        this.mForegroundPaddingBottom = padding.bottom;\n                    }\n                } else {\n                    this.mForegroundPaddingLeft = 0;\n                    this.mForegroundPaddingTop = 0;\n                    this.mForegroundPaddingRight = 0;\n                    this.mForegroundPaddingBottom = 0;\n                }\n\n                this.requestLayout();\n            }\n        }\n\n        protected verifyDrawable(who:Drawable):boolean {\n            return super.verifyDrawable(who) || (who == this.mForeground);\n        }\n\n        jumpDrawablesToCurrentState() {\n            super.jumpDrawablesToCurrentState();\n            if (this.mForeground != null) this.mForeground.jumpToCurrentState();\n        }\n\n        protected drawableStateChanged() {\n            super.drawableStateChanged();\n            if (this.mForeground != null && this.mForeground.isStateful()) {\n                this.mForeground.setState(this.getDrawableState());\n            }\n        }\n\n        /**\n         * Returns a set of layout parameters with a width of\n         * {@link android.view.ViewGroup.LayoutParams#MATCH_PARENT},\n         * and a height of {@link android.view.ViewGroup.LayoutParams#MATCH_PARENT}.\n         */\n        protected generateDefaultLayoutParams():FrameLayout.LayoutParams {\n            return new FrameLayout.LayoutParams(\n                FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);\n        }\n\n        /**\n         * Supply a Drawable that is to be rendered on top of all of the child\n         * views in the frame layout.  Any padding in the Drawable will be taken\n         * into account by ensuring that the children are inset to be placed\n         * inside of the padding area.\n         *\n         * @param drawable The Drawable to be drawn on top of the children.\n         *\n         * @attr ref android.R.styleable#FrameLayout_foreground\n         */\n        setForeground(drawable:Drawable) {\n            if (this.mForeground != drawable) {\n                if (this.mForeground != null) {\n                    this.mForeground.setCallback(null);\n                    this.unscheduleDrawable(this.mForeground);\n                }\n\n                this.mForeground = drawable;\n                this.mForegroundPaddingLeft = 0;\n                this.mForegroundPaddingTop = 0;\n                this.mForegroundPaddingRight = 0;\n                this.mForegroundPaddingBottom = 0;\n\n                if (drawable != null) {\n                    this.setWillNotDraw(false);\n                    drawable.setCallback(this);\n                    if (drawable.isStateful()) {\n                        drawable.setState(this.getDrawableState());\n                    }\n                    if (this.mForegroundGravity == Gravity.FILL) {\n                        let padding = new Rect();\n                        if (drawable.getPadding(padding)) {\n                            this.mForegroundPaddingLeft = padding.left;\n                            this.mForegroundPaddingTop = padding.top;\n                            this.mForegroundPaddingRight = padding.right;\n                            this.mForegroundPaddingBottom = padding.bottom;\n                        }\n                    }\n                } else {\n                    this.setWillNotDraw(true);\n                }\n                this.requestLayout();\n                this.invalidate();\n            }\n        }\n\n        /**\n         * Returns the drawable used as the foreground of this FrameLayout. The\n         * foreground drawable, if non-null, is always drawn on top of the children.\n         *\n         * @return A Drawable or null if no foreground was set.\n         */\n        getForeground():Drawable {\n            return this.mForeground;\n        }\n\n        getPaddingLeftWithForeground():number {\n            return this.mForegroundInPadding ? Math.max(this.mPaddingLeft, this.mForegroundPaddingLeft) :\n            this.mPaddingLeft + this.mForegroundPaddingLeft;\n        }\n\n        getPaddingRightWithForeground():number {\n            return this.mForegroundInPadding ? Math.max(this.mPaddingRight, this.mForegroundPaddingRight) :\n            this.mPaddingRight + this.mForegroundPaddingRight;\n        }\n\n        getPaddingTopWithForeground():number {\n            return this.mForegroundInPadding ? Math.max(this.mPaddingTop, this.mForegroundPaddingTop) :\n            this.mPaddingTop + this.mForegroundPaddingTop;\n        }\n\n        getPaddingBottomWithForeground() {\n            return this.mForegroundInPadding ? Math.max(this.mPaddingBottom, this.mForegroundPaddingBottom) :\n            this.mPaddingBottom + this.mForegroundPaddingBottom;\n        }\n\n        protected onMeasure(widthMeasureSpec:number, heightMeasureSpec:number) {\n            let count = this.getChildCount();\n\n            let measureMatchParentChildren =\n                View.MeasureSpec.getMode(widthMeasureSpec) != View.MeasureSpec.EXACTLY ||\n                View.MeasureSpec.getMode(heightMeasureSpec) != View.MeasureSpec.EXACTLY;\n            this.mMatchParentChildren = [];\n\n            let maxHeight = 0;\n            let maxWidth = 0;\n            let childState = 0;\n\n            for (let i = 0; i < count; i++) {\n                let child = this.getChildAt(i);\n                if (this.mMeasureAllChildren || child.getVisibility() != View.GONE) {\n                    this.measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);\n                    let lp = <FrameLayout.LayoutParams> child.getLayoutParams();\n                    maxWidth = Math.max(maxWidth,\n                        child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin);\n                    maxHeight = Math.max(maxHeight,\n                        child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin);\n                    childState = View.combineMeasuredStates(childState, child.getMeasuredState());\n                    if (measureMatchParentChildren) {\n                        if (lp.width == FrameLayout.LayoutParams.MATCH_PARENT ||\n                            lp.height == FrameLayout.LayoutParams.MATCH_PARENT) {\n                            this.mMatchParentChildren.push(child);\n                        }\n                    }\n                }\n            }\n\n            // Account for padding too\n            maxWidth += this.getPaddingLeftWithForeground() + this.getPaddingRightWithForeground();\n            maxHeight += this.getPaddingTopWithForeground() + this.getPaddingBottomWithForeground();\n\n            // Check against our minimum height and width\n            maxHeight = Math.max(maxHeight, this.getSuggestedMinimumHeight());\n            maxWidth = Math.max(maxWidth, this.getSuggestedMinimumWidth());\n\n            // Check against our foreground's minimum height and width\n            let drawable = this.getForeground();\n            if (drawable != null) {\n                maxHeight = Math.max(maxHeight, drawable.getMinimumHeight());\n                maxWidth = Math.max(maxWidth, drawable.getMinimumWidth());\n            }\n\n            this.setMeasuredDimension(View.resolveSizeAndState(maxWidth, widthMeasureSpec, childState),\n                View.resolveSizeAndState(maxHeight, heightMeasureSpec,\n                    childState << View.MEASURED_HEIGHT_STATE_SHIFT));\n\n            count = this.mMatchParentChildren.length;\n            if (count > 1) {\n                for (let i = 0; i < count; i++) {\n                    let child = this.mMatchParentChildren[i];\n\n                    let lp = <ViewGroup.MarginLayoutParams> child.getLayoutParams();\n                    let childWidthMeasureSpec;\n                    let childHeightMeasureSpec;\n\n                    if (lp.width == FrameLayout.LayoutParams.MATCH_PARENT) {\n                        childWidthMeasureSpec = View.MeasureSpec.makeMeasureSpec(this.getMeasuredWidth() -\n                            this.getPaddingLeftWithForeground() - this.getPaddingRightWithForeground() -\n                            lp.leftMargin - lp.rightMargin,\n                            View.MeasureSpec.EXACTLY);\n                    } else {\n                        childWidthMeasureSpec = ViewGroup.getChildMeasureSpec(widthMeasureSpec,\n                            this.getPaddingLeftWithForeground() + this.getPaddingRightWithForeground() +\n                            lp.leftMargin + lp.rightMargin,\n                            lp.width);\n                    }\n\n                    if (lp.height == FrameLayout.LayoutParams.MATCH_PARENT) {\n                        childHeightMeasureSpec = View.MeasureSpec.makeMeasureSpec(this.getMeasuredHeight() -\n                            this.getPaddingTopWithForeground() - this.getPaddingBottomWithForeground() -\n                            lp.topMargin - lp.bottomMargin,\n                            View.MeasureSpec.EXACTLY);\n                    } else {\n                        childHeightMeasureSpec = ViewGroup.getChildMeasureSpec(heightMeasureSpec,\n                            this.getPaddingTopWithForeground() + this.getPaddingBottomWithForeground() +\n                            lp.topMargin + lp.bottomMargin,\n                            lp.height);\n                    }\n\n                    child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n                }\n            }\n        }\n\n\n        protected onLayout(changed:boolean, left:number, top:number, right:number, bottom:number):void {\n            this.layoutChildren(left, top, right, bottom, false /* no force left gravity */);\n        }\n\n        layoutChildren(left:number, top:number, right:number, bottom:number, forceLeftGravity:boolean):void {\n            const count = this.getChildCount();\n\n            const parentLeft = this.getPaddingLeftWithForeground();\n            const parentRight = right - left - this.getPaddingRightWithForeground();\n\n            const parentTop = this.getPaddingTopWithForeground();\n            const parentBottom = bottom - top - this.getPaddingBottomWithForeground();\n\n            this.mForegroundBoundsChanged = true;\n\n            for (let i = 0; i < count; i++) {\n                let child = this.getChildAt(i);\n                if (child.getVisibility() != View.GONE) {\n                    const lp = <FrameLayout.LayoutParams> child.getLayoutParams();\n\n                    const width = child.getMeasuredWidth();\n                    const height = child.getMeasuredHeight();\n\n                    let childLeft;\n                    let childTop;\n\n                    let gravity = lp.gravity;\n                    if (gravity == -1) {\n                        gravity = FrameLayout.DEFAULT_CHILD_GRAVITY;\n                    }\n\n                    //const layoutDirection = getLayoutDirection();\n                    const absoluteGravity = gravity;//Gravity.getAbsoluteGravity(gravity, layoutDirection);\n                    const verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK;\n\n                    switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n                        case Gravity.CENTER_HORIZONTAL:\n                            childLeft = parentLeft + (parentRight - parentLeft - width) / 2 +\n                                lp.leftMargin - lp.rightMargin;\n                            break;\n                        case Gravity.RIGHT:\n                            if (!forceLeftGravity) {\n                                childLeft = parentRight - width - lp.rightMargin;\n                                break;\n                            }\n                        case Gravity.LEFT:\n                        default:\n                            childLeft = parentLeft + lp.leftMargin;\n                    }\n\n                    switch (verticalGravity) {\n                        case Gravity.TOP:\n                            childTop = parentTop + lp.topMargin;\n                            break;\n                        case Gravity.CENTER_VERTICAL:\n                            childTop = parentTop + (parentBottom - parentTop - height) / 2 +\n                                lp.topMargin - lp.bottomMargin;\n                            break;\n                        case Gravity.BOTTOM:\n                            childTop = parentBottom - height - lp.bottomMargin;\n                            break;\n                        default:\n                            childTop = parentTop + lp.topMargin;\n                    }\n\n                    child.layout(childLeft, childTop, childLeft + width, childTop + height);\n                }\n            }\n        }\n\n        protected onSizeChanged(w:number, h:number, oldw:number, oldh:number):void {\n            super.onSizeChanged(w, h, oldw, oldh);\n            this.mForegroundBoundsChanged = true;\n        }\n\n        draw(canvas:Canvas){\n            super.draw(canvas);\n\n            if (this.mForeground != null) {\n                const foreground = this.mForeground;\n\n                if (this.mForegroundBoundsChanged) {\n                    this.mForegroundBoundsChanged = false;\n                    const selfBounds = this.mSelfBounds;\n                    const overlayBounds = this.mOverlayBounds;\n\n                    const w = this.mRight - this.mLeft;\n                    const h = this.mBottom - this.mTop;\n\n                    if (this.mForegroundInPadding) {\n                        selfBounds.set(0, 0, w, h);\n                    } else {\n                        selfBounds.set(this.mPaddingLeft, this.mPaddingTop, w - this.mPaddingRight, h - this.mPaddingBottom);\n                    }\n\n                    //const layoutDirection = this.getLayoutDirection();\n                    Gravity.apply(this.mForegroundGravity, foreground.getIntrinsicWidth(),\n                        foreground.getIntrinsicHeight(), selfBounds, overlayBounds);\n                    foreground.setBounds(overlayBounds);\n                }\n\n                foreground.draw(canvas);\n            }\n        }\n\n        /**\n         * Sets whether to consider all children, or just those in\n         * the VISIBLE or INVISIBLE state, when measuring. Defaults to false.\n         *\n         * @param measureAll true to consider children marked GONE, false otherwise.\n         * Default value is false.\n         *\n         * @attr ref android.R.styleable#FrameLayout_measureAllChildren\n         */\n        setMeasureAllChildren( measureAll:boolean) {\n            this.mMeasureAllChildren = measureAll;\n        }\n        /**\n         * Determines whether all children, or just those in the VISIBLE or\n         * INVISIBLE state, are considered when measuring.\n         *\n         * @return Whether all children are considered when measuring.\n         */\n        getMeasureAllChildren() {\n            return this.mMeasureAllChildren;\n        }\n\n        public generateLayoutParamsFromAttr(attrs: HTMLElement): android.view.ViewGroup.LayoutParams {\n            return new FrameLayout.LayoutParams(this.getContext(), attrs);\n        }\n\n        shouldDelayChildPressedState():boolean {\n            return false;\n        }\n        protected checkLayoutParams(p:ViewGroup.LayoutParams){\n            return p instanceof FrameLayout.LayoutParams;\n        }\n        protected generateLayoutParams(p:ViewGroup.LayoutParams){\n            return new FrameLayout.LayoutParams(p);\n        }\n    }\n\n    export module FrameLayout {\n        /**\n         * Per-child layout information for layouts that support margins.\n         * See {@link android.R.styleable#FrameLayout_Layout FrameLayout Layout Attributes}\n         * for a list of all child view attributes that this class supports.\n         *\n         * @attr ref android.R.styleable#FrameLayout_Layout_layout_gravity\n         */\n        export class LayoutParams extends ViewGroup.MarginLayoutParams {\n            /**\n             * The gravity to apply with the View to which these layout parameters\n             * are associated.\n             *\n             * @see android.view.Gravity\n             *\n             * @attr ref android.R.styleable#FrameLayout_Layout_layout_gravity\n             */\n            gravity = -1;\n\n            constructor(context:Context, attrs:HTMLElement);\n            constructor();\n            /**\n             * Copy constructor. Clones the width, height, margin values, and\n             * gravity of the source.\n             *\n             * @param source The layout params to copy from.\n             */\n            constructor(source:ViewGroup.LayoutParams);\n            /**\n             * Creates a new set of layout parameters with the specified width, height\n             * and weight.\n             *\n             * @param width the width, either {@link #MATCH_PARENT},\n             *        {@link #WRAP_CONTENT} or a fixed size in pixels\n             * @param height the height, either {@link #MATCH_PARENT},\n             *        {@link #WRAP_CONTENT} or a fixed size in pixels\n             * @param gravity the gravity\n             *\n             * @see android.view.Gravity\n             */\n            constructor(width:number, height:number, gravity?:number);\n            constructor(...args) {\n                super(...(() => {\n                    if (args[0] instanceof android.content.Context && args[1] instanceof HTMLElement) return [args[0], args[1]];\n                    else if (typeof args[0] === 'number' && typeof args[1] === 'number' && typeof args[2] === 'number') return [args[0], args[1]];\n                    else if (typeof args[0] === 'number' && typeof args[1] === 'number') return [args[0], args[1]];\n                    else if (args[0] instanceof ViewGroup.LayoutParams) return [args[0]];\n                })());\n                if (args[0] instanceof Context && args[1] instanceof HTMLElement) {\n                    const c = <Context>args[0];\n                    const attrs = <HTMLElement>args[1];\n                    const a = c.obtainStyledAttributes(attrs);\n                    this.gravity = Gravity.parseGravity(a.getAttrValue('layout_gravity'), -1);\n                    a.recycle();\n                } else if (typeof args[0] === 'number' && typeof args[1] === 'number' && typeof args[2] === 'number') {\n                    this.gravity = args[2];\n                } else if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n                } else if (args[0] instanceof FrameLayout.LayoutParams) {\n                    const source = <FrameLayout.LayoutParams>args[0];\n                    this.gravity = source.gravity;\n                } else if (args[0] instanceof ViewGroup.MarginLayoutParams) {\n                } else if (args[0] instanceof ViewGroup.LayoutParams) {\n                }\n            }\n\n            protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n                return super.createClassAttrBinder().set('layout_gravity', {\n                    setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                        param.gravity = attrBinder.parseGravity(value, param.gravity);\n                    }, getter(param:LayoutParams) {\n                        return param.gravity;\n                    }\n                });\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/android/widget/GridView.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/os/Trace.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../android/view/SoundEffectConstants.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../android/widget/AbsListView.ts\"/>\n///<reference path=\"../../android/widget/Adapter.ts\"/>\n///<reference path=\"../../android/widget/Checkable.ts\"/>\n///<reference path=\"../../android/widget/ListAdapter.ts\"/>\n///<reference path=\"../../android/widget/ListView.ts\"/>\n///<reference path=\"../../android/R/attr.ts\"/>\n\nmodule android.widget {\nimport Rect = android.graphics.Rect;\nimport Trace = android.os.Trace;\nimport Gravity = android.view.Gravity;\nimport KeyEvent = android.view.KeyEvent;\nimport SoundEffectConstants = android.view.SoundEffectConstants;\nimport View = android.view.View;\nimport ViewGroup = android.view.ViewGroup;\nimport Integer = java.lang.Integer;\nimport AbsListView = android.widget.AbsListView;\nimport LayoutParams = android.widget.AbsListView.LayoutParams;\nimport Adapter = android.widget.Adapter;\nimport Checkable = android.widget.Checkable;\nimport ListAdapter = android.widget.ListAdapter;\nimport ListView = android.widget.ListView;\n    import AttrBinder = androidui.attr.AttrBinder;\n/**\n * A view that shows items in two-dimensional scrolling grid. The items in the\n * grid come from the {@link ListAdapter} associated with this view.\n *\n * <p>See the <a href=\"{@docRoot}guide/topics/ui/layout/gridview.html\">Grid\n * View</a> guide.</p>\n * \n * @attr ref android.R.styleable#GridView_horizontalSpacing\n * @attr ref android.R.styleable#GridView_verticalSpacing\n * @attr ref android.R.styleable#GridView_stretchMode\n * @attr ref android.R.styleable#GridView_columnWidth\n * @attr ref android.R.styleable#GridView_numColumns\n * @attr ref android.R.styleable#GridView_gravity\n */\nexport class GridView extends AbsListView {\n\n    /**\n     * Disables stretching.\n     * \n     * @see #setStretchMode(int) \n     */\n    static NO_STRETCH:number = 0;\n\n    /**\n     * Stretches the spacing between columns.\n     * \n     * @see #setStretchMode(int) \n     */\n    static STRETCH_SPACING:number = 1;\n\n    /**\n     * Stretches columns.\n     * \n     * @see #setStretchMode(int) \n     */\n    static STRETCH_COLUMN_WIDTH:number = 2;\n\n    /**\n     * Stretches the spacing between columns. The spacing is uniform.\n     * \n     * @see #setStretchMode(int) \n     */\n    static STRETCH_SPACING_UNIFORM:number = 3;\n\n    /**\n     * Creates as many columns as can fit on screen.\n     * \n     * @see #setNumColumns(int) \n     */\n    static AUTO_FIT:number = -1;\n\n    private mNumColumns:number = GridView.AUTO_FIT;\n\n    private mHorizontalSpacing:number = 0;\n\n    private mRequestedHorizontalSpacing:number = 0;\n\n    private mVerticalSpacing:number = 0;\n\n    private mStretchMode:number = GridView.STRETCH_COLUMN_WIDTH;\n\n    private mColumnWidth:number = 0;\n\n    private mRequestedColumnWidth:number = 0;\n\n    private mRequestedNumColumns:number = 0;\n\n    private mReferenceView:View = null;\n\n    private mReferenceViewInSelectedRow:View = null;\n\n    private mGravity:number = Gravity.LEFT;\n\n    private mTempRect:Rect = new Rect();\n\n    constructor(context:android.content.Context, attrs:HTMLElement, defStyle=android.R.attr.gridViewStyle) {\n       super(context, attrs, defStyle);\n       let a = context.obtainStyledAttributes(attrs, defStyle);\n       let hSpacing:number = a.getDimensionPixelOffset('horizontalSpacing', 0);\n       this.setHorizontalSpacing(hSpacing);\n       let vSpacing:number = a.getDimensionPixelOffset('verticalSpacing', 0);\n       this.setVerticalSpacing(vSpacing);\n       let stretchModeS = a.getAttrValue('stretchMode');\n       if (stretchModeS) {\n           switch (stretchModeS) {\n               case \"none\":\n                   this.setStretchMode(GridView.NO_STRETCH);\n                   break;\n               case \"spacingWidth\":\n                   this.setStretchMode(GridView.STRETCH_SPACING);\n                   break;\n               case \"columnWidth\":\n                   this.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);\n                   break;\n               case \"spacingWidthUniform\":\n                   this.setStretchMode(GridView.STRETCH_SPACING_UNIFORM);\n                   break;\n           }\n       }\n       let columnWidth:number = a.getDimensionPixelOffset('columnWidth', -1);\n       if (columnWidth > 0) {\n           this.setColumnWidth(columnWidth);\n       }\n       let numColumns:number = a.getInt('numColumns', 1);\n       this.setNumColumns(numColumns);\n       let gravityS = a.getAttrValue('gravity');\n       if (gravityS) {\n           this.setGravity(Gravity.parseGravity(gravityS, this.mGravity));\n       }\n       a.recycle();\n    }\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder().set('horizontalSpacing', {\n            setter(v:GridView, value:any, attrBinder:AttrBinder) {\n                v.setHorizontalSpacing(attrBinder.parseNumberPixelOffset(value, 0));\n            }, getter(v:GridView) {\n                return v.getHorizontalSpacing();\n            }\n        }).set('verticalSpacing', {\n            setter(v:GridView, value:any, attrBinder:AttrBinder) {\n                v.setVerticalSpacing(attrBinder.parseNumberPixelOffset(value, 0));\n            }, getter(v:GridView) {\n                return v.getVerticalSpacing();\n            }\n        }).set('stretchMode', {\n            setter(v:GridView, value:any, attrBinder:AttrBinder) {\n                v.setStretchMode(attrBinder.parseEnum(value,\n                    new Map<string, number>()\n                        .set(\"none\", GridView.NO_STRETCH)\n                        .set(\"spacingWidth\", GridView.STRETCH_SPACING)\n                        .set(\"columnWidth\", GridView.STRETCH_COLUMN_WIDTH)\n                        .set(\"spacingWidthUniform\", GridView.STRETCH_SPACING_UNIFORM),\n                    GridView.STRETCH_COLUMN_WIDTH));\n            }, getter(v:GridView) {\n                return v.getStretchMode();\n            }\n        }).set('columnWidth', {\n            setter(v:GridView, value:any, attrBinder:AttrBinder) {\n                let columnWidth = attrBinder.parseNumberPixelOffset(value, -1);\n                if(columnWidth > 0 ){\n                    this.setColumnWidth(columnWidth);\n                }\n            }, getter(v:GridView) {\n                return v.getColumnWidth();\n            }\n        }).set('numColumns', {\n            setter(v:GridView, value:any, attrBinder:AttrBinder) {\n                v.setNumColumns(attrBinder.parseInt(value, 1));\n            }, getter(v:GridView) {\n                return v.getNumColumns();\n            }\n        }).set('gravity', {\n            setter(v:GridView, value:any, attrBinder:AttrBinder) {\n                v.setGravity(attrBinder.parseGravity(value, v.getGravity()));\n            }, getter(v:GridView) {\n                return v.getGravity();\n            }\n        });\n    }\n\n    getAdapter():ListAdapter  {\n        return this.mAdapter;\n    }\n\n    /**\n     * Sets the data behind this GridView.\n     *\n     * @param adapter the adapter providing the grid's data\n     */\n    setAdapter(adapter:ListAdapter):void  {\n        if (this.mAdapter != null && this.mDataSetObserver != null) {\n            this.mAdapter.unregisterDataSetObserver(this.mDataSetObserver);\n        }\n        this.resetList();\n        this.mRecycler.clear();\n        this.mAdapter = adapter;\n        this.mOldSelectedPosition = GridView.INVALID_POSITION;\n        this.mOldSelectedRowId = GridView.INVALID_ROW_ID;\n        // AbsListView#setAdapter will update choice mode states.\n        super.setAdapter(adapter);\n        if (this.mAdapter != null) {\n            this.mOldItemCount = this.mItemCount;\n            this.mItemCount = this.mAdapter.getCount();\n            this.mDataChanged = true;\n            this.checkFocus();\n            this.mDataSetObserver = new AbsListView.AdapterDataSetObserver(this);\n            this.mAdapter.registerDataSetObserver(this.mDataSetObserver);\n            this.mRecycler.setViewTypeCount(this.mAdapter.getViewTypeCount());\n            let position:number;\n            if (this.mStackFromBottom) {\n                position = this.lookForSelectablePosition(this.mItemCount - 1, false);\n            } else {\n                position = this.lookForSelectablePosition(0, true);\n            }\n            this.setSelectedPositionInt(position);\n            this.setNextSelectedPositionInt(position);\n            this.checkSelectionChanged();\n        } else {\n            this.checkFocus();\n            // Nothing selected\n            this.checkSelectionChanged();\n        }\n        this.requestLayout();\n    }\n\n    lookForSelectablePosition(position:number, lookDown:boolean):number  {\n        const adapter:ListAdapter = this.mAdapter;\n        if (adapter == null || this.isInTouchMode()) {\n            return GridView.INVALID_POSITION;\n        }\n        if (position < 0 || position >= this.mItemCount) {\n            return GridView.INVALID_POSITION;\n        }\n        return position;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    fillGap(down:boolean):void  {\n        const numColumns:number = this.mNumColumns;\n        const verticalSpacing:number = this.mVerticalSpacing;\n        const count:number = this.getChildCount();\n        if (down) {\n            let paddingTop:number = 0;\n            if ((this.mGroupFlags & GridView.CLIP_TO_PADDING_MASK) == GridView.CLIP_TO_PADDING_MASK) {\n                paddingTop = this.getListPaddingTop();\n            }\n            const startOffset:number = count > 0 ? this.getChildAt(count - 1).getBottom() + verticalSpacing : paddingTop;\n            let position:number = this.mFirstPosition + count;\n            if (this.mStackFromBottom) {\n                position += numColumns - 1;\n            }\n            this.fillDown(position, startOffset);\n            this.correctTooHigh(numColumns, verticalSpacing, this.getChildCount());\n        } else {\n            let paddingBottom:number = 0;\n            if ((this.mGroupFlags & GridView.CLIP_TO_PADDING_MASK) == GridView.CLIP_TO_PADDING_MASK) {\n                paddingBottom = this.getListPaddingBottom();\n            }\n            const startOffset:number = count > 0 ? this.getChildAt(0).getTop() - verticalSpacing : this.getHeight() - paddingBottom;\n            let position:number = this.mFirstPosition;\n            if (!this.mStackFromBottom) {\n                position -= numColumns;\n            } else {\n                position--;\n            }\n            this.fillUp(position, startOffset);\n            this.correctTooLow(numColumns, verticalSpacing, this.getChildCount());\n        }\n    }\n\n    /**\n     * Fills the list from pos down to the end of the list view.\n     *\n     * @param pos The first position to put in the list\n     *\n     * @param nextTop The location where the top of the item associated with pos\n     *        should be drawn\n     *\n     * @return The view that is currently selected, if it happens to be in the\n     *         range that we draw.\n     */\n    private fillDown(pos:number, nextTop:number):View  {\n        let selectedView:View = null;\n        let end:number = (this.mBottom - this.mTop);\n        if ((this.mGroupFlags & GridView.CLIP_TO_PADDING_MASK) == GridView.CLIP_TO_PADDING_MASK) {\n            end -= this.mListPadding.bottom;\n        }\n        while (nextTop < end && pos < this.mItemCount) {\n            let temp:View = this.makeRow(pos, nextTop, true);\n            if (temp != null) {\n                selectedView = temp;\n            }\n            // mReferenceView will change with each call to makeRow()\n            // do not cache in a local variable outside of this loop\n            nextTop = this.mReferenceView.getBottom() + this.mVerticalSpacing;\n            pos += this.mNumColumns;\n        }\n        this.setVisibleRangeHint(this.mFirstPosition, this.mFirstPosition + this.getChildCount() - 1);\n        return selectedView;\n    }\n\n    private makeRow(startPos:number, y:number, flow:boolean):View  {\n        const columnWidth:number = this.mColumnWidth;\n        const horizontalSpacing:number = this.mHorizontalSpacing;\n        const isLayoutRtl:boolean = this.isLayoutRtl();\n        let last:number;\n        let nextLeft:number;\n        if (isLayoutRtl) {\n            nextLeft = this.getWidth() - this.mListPadding.right - columnWidth - ((this.mStretchMode == GridView.STRETCH_SPACING_UNIFORM) ? horizontalSpacing : 0);\n        } else {\n            nextLeft = this.mListPadding.left + ((this.mStretchMode == GridView.STRETCH_SPACING_UNIFORM) ? horizontalSpacing : 0);\n        }\n        if (!this.mStackFromBottom) {\n            last = Math.min(startPos + this.mNumColumns, this.mItemCount);\n        } else {\n            last = startPos + 1;\n            startPos = Math.max(0, startPos - this.mNumColumns + 1);\n            if (last - startPos < this.mNumColumns) {\n                const deltaLeft:number = (this.mNumColumns - (last - startPos)) * (columnWidth + horizontalSpacing);\n                nextLeft += (isLayoutRtl ? -1 : +1) * deltaLeft;\n            }\n        }\n        let selectedView:View = null;\n        const hasFocus:boolean = this.shouldShowSelector();\n        const inClick:boolean = this.touchModeDrawsInPressedState();\n        const selectedPosition:number = this.mSelectedPosition;\n        let child:View = null;\n        for (let pos:number = startPos; pos < last; pos++) {\n            // is this the selected item?\n            let selected:boolean = pos == selectedPosition;\n            // does the list view have focus or contain focus\n            const where:number = flow ? -1 : pos - startPos;\n            child = this.makeAndAddView(pos, y, flow, nextLeft, selected, where);\n            nextLeft += (isLayoutRtl ? -1 : +1) * columnWidth;\n            if (pos < last - 1) {\n                nextLeft += horizontalSpacing;\n            }\n            if (selected && (hasFocus || inClick)) {\n                selectedView = child;\n            }\n        }\n        this.mReferenceView = child;\n        if (selectedView != null) {\n            this.mReferenceViewInSelectedRow = this.mReferenceView;\n        }\n        return selectedView;\n    }\n\n    /**\n     * Fills the list from pos up to the top of the list view.\n     *\n     * @param pos The first position to put in the list\n     *\n     * @param nextBottom The location where the bottom of the item associated\n     *        with pos should be drawn\n     *\n     * @return The view that is currently selected\n     */\n    private fillUp(pos:number, nextBottom:number):View  {\n        let selectedView:View = null;\n        let end:number = 0;\n        if ((this.mGroupFlags & GridView.CLIP_TO_PADDING_MASK) == GridView.CLIP_TO_PADDING_MASK) {\n            end = this.mListPadding.top;\n        }\n        while (nextBottom > end && pos >= 0) {\n            let temp:View = this.makeRow(pos, nextBottom, false);\n            if (temp != null) {\n                selectedView = temp;\n            }\n            nextBottom = this.mReferenceView.getTop() - this.mVerticalSpacing;\n            this.mFirstPosition = pos;\n            pos -= this.mNumColumns;\n        }\n        if (this.mStackFromBottom) {\n            this.mFirstPosition = Math.max(0, pos + 1);\n        }\n        this.setVisibleRangeHint(this.mFirstPosition, this.mFirstPosition + this.getChildCount() - 1);\n        return selectedView;\n    }\n\n    /**\n     * Fills the list from top to bottom, starting with mFirstPosition\n     *\n     * @param nextTop The location where the top of the first item should be\n     *        drawn\n     *\n     * @return The view that is currently selected\n     */\n    private fillFromTop(nextTop:number):View  {\n        this.mFirstPosition = Math.min(this.mFirstPosition, this.mSelectedPosition);\n        this.mFirstPosition = Math.min(this.mFirstPosition, this.mItemCount - 1);\n        if (this.mFirstPosition < 0) {\n            this.mFirstPosition = 0;\n        }\n        this.mFirstPosition -= this.mFirstPosition % this.mNumColumns;\n        return this.fillDown(this.mFirstPosition, nextTop);\n    }\n\n    private fillFromBottom(lastPosition:number, nextBottom:number):View  {\n        lastPosition = Math.max(lastPosition, this.mSelectedPosition);\n        lastPosition = Math.min(lastPosition, this.mItemCount - 1);\n        const invertedPosition:number = this.mItemCount - 1 - lastPosition;\n        lastPosition = this.mItemCount - 1 - (invertedPosition - (invertedPosition % this.mNumColumns));\n        return this.fillUp(lastPosition, nextBottom);\n    }\n\n    private fillSelection(childrenTop:number, childrenBottom:number):View  {\n        const selectedPosition:number = this.reconcileSelectedPosition();\n        const numColumns:number = this.mNumColumns;\n        const verticalSpacing:number = this.mVerticalSpacing;\n        let rowStart:number;\n        let rowEnd:number = -1;\n        if (!this.mStackFromBottom) {\n            rowStart = selectedPosition - (selectedPosition % numColumns);\n        } else {\n            const invertedSelection:number = this.mItemCount - 1 - selectedPosition;\n            rowEnd = this.mItemCount - 1 - (invertedSelection - (invertedSelection % numColumns));\n            rowStart = Math.max(0, rowEnd - numColumns + 1);\n        }\n        const fadingEdgeLength:number = this.getVerticalFadingEdgeLength();\n        const topSelectionPixel:number = this.getTopSelectionPixel(childrenTop, fadingEdgeLength, rowStart);\n        const sel:View = this.makeRow(this.mStackFromBottom ? rowEnd : rowStart, topSelectionPixel, true);\n        this.mFirstPosition = rowStart;\n        const referenceView:View = this.mReferenceView;\n        if (!this.mStackFromBottom) {\n            this.fillDown(rowStart + numColumns, referenceView.getBottom() + verticalSpacing);\n            this.pinToBottom(childrenBottom);\n            this.fillUp(rowStart - numColumns, referenceView.getTop() - verticalSpacing);\n            this.adjustViewsUpOrDown();\n        } else {\n            const bottomSelectionPixel:number = this.getBottomSelectionPixel(childrenBottom, fadingEdgeLength, numColumns, rowStart);\n            const offset:number = bottomSelectionPixel - referenceView.getBottom();\n            this.offsetChildrenTopAndBottom(offset);\n            this.fillUp(rowStart - 1, referenceView.getTop() - verticalSpacing);\n            this.pinToTop(childrenTop);\n            this.fillDown(rowEnd + numColumns, referenceView.getBottom() + verticalSpacing);\n            this.adjustViewsUpOrDown();\n        }\n        return sel;\n    }\n\n    private pinToTop(childrenTop:number):void  {\n        if (this.mFirstPosition == 0) {\n            const top:number = this.getChildAt(0).getTop();\n            const offset:number = childrenTop - top;\n            if (offset < 0) {\n                this.offsetChildrenTopAndBottom(offset);\n            }\n        }\n    }\n\n    private pinToBottom(childrenBottom:number):void  {\n        const count:number = this.getChildCount();\n        if (this.mFirstPosition + count == this.mItemCount) {\n            const bottom:number = this.getChildAt(count - 1).getBottom();\n            const offset:number = childrenBottom - bottom;\n            if (offset > 0) {\n                this.offsetChildrenTopAndBottom(offset);\n            }\n        }\n    }\n\n    findMotionRow(y:number):number  {\n        const childCount:number = this.getChildCount();\n        if (childCount > 0) {\n            const numColumns:number = this.mNumColumns;\n            if (!this.mStackFromBottom) {\n                for (let i:number = 0; i < childCount; i += numColumns) {\n                    if (y <= this.getChildAt(i).getBottom()) {\n                        return this.mFirstPosition + i;\n                    }\n                }\n            } else {\n                for (let i:number = childCount - 1; i >= 0; i -= numColumns) {\n                    if (y >= this.getChildAt(i).getTop()) {\n                        return this.mFirstPosition + i;\n                    }\n                }\n            }\n        }\n        return GridView.INVALID_POSITION;\n    }\n\n    /**\n     * Layout during a scroll that results from tracking motion events. Places\n     * the mMotionPosition view at the offset specified by mMotionViewTop, and\n     * then build surrounding views from there.\n     *\n     * @param position the position at which to start filling\n     * @param top the top of the view at that position\n     * @return The selected view, or null if the selected view is outside the\n     *         visible area.\n     */\n    private fillSpecific(position:number, top:number):View  {\n        const numColumns:number = this.mNumColumns;\n        let motionRowStart:number;\n        let motionRowEnd:number = -1;\n        if (!this.mStackFromBottom) {\n            motionRowStart = position - (position % numColumns);\n        } else {\n            const invertedSelection:number = this.mItemCount - 1 - position;\n            motionRowEnd = this.mItemCount - 1 - (invertedSelection - (invertedSelection % numColumns));\n            motionRowStart = Math.max(0, motionRowEnd - numColumns + 1);\n        }\n        const temp:View = this.makeRow(this.mStackFromBottom ? motionRowEnd : motionRowStart, top, true);\n        // Possibly changed again in fillUp if we add rows above this one.\n        this.mFirstPosition = motionRowStart;\n        const referenceView:View = this.mReferenceView;\n        // We didn't have anything to layout, bail out\n        if (referenceView == null) {\n            return null;\n        }\n        const verticalSpacing:number = this.mVerticalSpacing;\n        let above:View;\n        let below:View;\n        if (!this.mStackFromBottom) {\n            above = this.fillUp(motionRowStart - numColumns, referenceView.getTop() - verticalSpacing);\n            this.adjustViewsUpOrDown();\n            below = this.fillDown(motionRowStart + numColumns, referenceView.getBottom() + verticalSpacing);\n            // Check if we have dragged the bottom of the grid too high\n            const childCount:number = this.getChildCount();\n            if (childCount > 0) {\n                this.correctTooHigh(numColumns, verticalSpacing, childCount);\n            }\n        } else {\n            below = this.fillDown(motionRowEnd + numColumns, referenceView.getBottom() + verticalSpacing);\n            this.adjustViewsUpOrDown();\n            above = this.fillUp(motionRowStart - 1, referenceView.getTop() - verticalSpacing);\n            // Check if we have dragged the bottom of the grid too high\n            const childCount:number = this.getChildCount();\n            if (childCount > 0) {\n                this.correctTooLow(numColumns, verticalSpacing, childCount);\n            }\n        }\n        if (temp != null) {\n            return temp;\n        } else if (above != null) {\n            return above;\n        } else {\n            return below;\n        }\n    }\n\n    private correctTooHigh(numColumns:number, verticalSpacing:number, childCount:number):void  {\n        // First see if the last item is visible\n        const lastPosition:number = this.mFirstPosition + childCount - 1;\n        if (lastPosition == this.mItemCount - 1 && childCount > 0) {\n            // Get the last child ...\n            const lastChild:View = this.getChildAt(childCount - 1);\n            // ... and its bottom edge\n            const lastBottom:number = lastChild.getBottom();\n            // This is bottom of our drawable area\n            const end:number = (this.mBottom - this.mTop) - this.mListPadding.bottom;\n            // This is how far the bottom edge of the last view is from the bottom of the\n            // drawable area\n            let bottomOffset:number = end - lastBottom;\n            const firstChild:View = this.getChildAt(0);\n            const firstTop:number = firstChild.getTop();\n            // first row or the first row is scrolled off the top of the drawable area\n            if (bottomOffset > 0 && (this.mFirstPosition > 0 || firstTop < this.mListPadding.top)) {\n                if (this.mFirstPosition == 0) {\n                    // Don't pull the top too far down\n                    bottomOffset = Math.min(bottomOffset, this.mListPadding.top - firstTop);\n                }\n                // Move everything down\n                this.offsetChildrenTopAndBottom(bottomOffset);\n                if (this.mFirstPosition > 0) {\n                    // Fill the gap that was opened above mFirstPosition with more rows, if\n                    // possible\n                    this.fillUp(this.mFirstPosition - (this.mStackFromBottom ? 1 : numColumns), firstChild.getTop() - verticalSpacing);\n                    // Close up the remaining gap\n                    this.adjustViewsUpOrDown();\n                }\n            }\n        }\n    }\n\n    private correctTooLow(numColumns:number, verticalSpacing:number, childCount:number):void  {\n        if (this.mFirstPosition == 0 && childCount > 0) {\n            // Get the first child ...\n            const firstChild:View = this.getChildAt(0);\n            // ... and its top edge\n            const firstTop:number = firstChild.getTop();\n            // This is top of our drawable area\n            const start:number = this.mListPadding.top;\n            // This is bottom of our drawable area\n            const end:number = (this.mBottom - this.mTop) - this.mListPadding.bottom;\n            // This is how far the top edge of the first view is from the top of the\n            // drawable area\n            let topOffset:number = firstTop - start;\n            const lastChild:View = this.getChildAt(childCount - 1);\n            const lastBottom:number = lastChild.getBottom();\n            const lastPosition:number = this.mFirstPosition + childCount - 1;\n            // last row or the last row is scrolled off the bottom of the drawable area\n            if (topOffset > 0 && (lastPosition < this.mItemCount - 1 || lastBottom > end)) {\n                if (lastPosition == this.mItemCount - 1) {\n                    // Don't pull the bottom too far up\n                    topOffset = Math.min(topOffset, lastBottom - end);\n                }\n                // Move everything up\n                this.offsetChildrenTopAndBottom(-topOffset);\n                if (lastPosition < this.mItemCount - 1) {\n                    // Fill the gap that was opened below the last position with more rows, if\n                    // possible\n                    this.fillDown(lastPosition + (!this.mStackFromBottom ? 1 : numColumns), lastChild.getBottom() + verticalSpacing);\n                    // Close up the remaining gap\n                    this.adjustViewsUpOrDown();\n                }\n            }\n        }\n    }\n\n    /**\n     * Fills the grid based on positioning the new selection at a specific\n     * location. The selection may be moved so that it does not intersect the\n     * faded edges. The grid is then filled upwards and downwards from there.\n     *\n     * @param selectedTop Where the selected item should be\n     * @param childrenTop Where to start drawing children\n     * @param childrenBottom Last pixel where children can be drawn\n     * @return The view that currently has selection\n     */\n    private fillFromSelection(selectedTop:number, childrenTop:number, childrenBottom:number):View  {\n        const fadingEdgeLength:number = this.getVerticalFadingEdgeLength();\n        const selectedPosition:number = this.mSelectedPosition;\n        const numColumns:number = this.mNumColumns;\n        const verticalSpacing:number = this.mVerticalSpacing;\n        let rowStart:number;\n        let rowEnd:number = -1;\n        if (!this.mStackFromBottom) {\n            rowStart = selectedPosition - (selectedPosition % numColumns);\n        } else {\n            let invertedSelection:number = this.mItemCount - 1 - selectedPosition;\n            rowEnd = this.mItemCount - 1 - (invertedSelection - (invertedSelection % numColumns));\n            rowStart = Math.max(0, rowEnd - numColumns + 1);\n        }\n        let sel:View;\n        let referenceView:View;\n        let topSelectionPixel:number = this.getTopSelectionPixel(childrenTop, fadingEdgeLength, rowStart);\n        let bottomSelectionPixel:number = this.getBottomSelectionPixel(childrenBottom, fadingEdgeLength, numColumns, rowStart);\n        sel = this.makeRow(this.mStackFromBottom ? rowEnd : rowStart, selectedTop, true);\n        // Possibly changed again in fillUp if we add rows above this one.\n        this.mFirstPosition = rowStart;\n        referenceView = this.mReferenceView;\n        this.adjustForTopFadingEdge(referenceView, topSelectionPixel, bottomSelectionPixel);\n        this.adjustForBottomFadingEdge(referenceView, topSelectionPixel, bottomSelectionPixel);\n        if (!this.mStackFromBottom) {\n            this.fillUp(rowStart - numColumns, referenceView.getTop() - verticalSpacing);\n            this.adjustViewsUpOrDown();\n            this.fillDown(rowStart + numColumns, referenceView.getBottom() + verticalSpacing);\n        } else {\n            this.fillDown(rowEnd + numColumns, referenceView.getBottom() + verticalSpacing);\n            this.adjustViewsUpOrDown();\n            this.fillUp(rowStart - 1, referenceView.getTop() - verticalSpacing);\n        }\n        return sel;\n    }\n\n    /**\n     * Calculate the bottom-most pixel we can draw the selection into\n     *\n     * @param childrenBottom Bottom pixel were children can be drawn\n     * @param fadingEdgeLength Length of the fading edge in pixels, if present\n     * @param numColumns Number of columns in the grid\n     * @param rowStart The start of the row that will contain the selection\n     * @return The bottom-most pixel we can draw the selection into\n     */\n    private getBottomSelectionPixel(childrenBottom:number, fadingEdgeLength:number, numColumns:number, rowStart:number):number  {\n        // Last pixel we can draw the selection into\n        let bottomSelectionPixel:number = childrenBottom;\n        if (rowStart + numColumns - 1 < this.mItemCount - 1) {\n            bottomSelectionPixel -= fadingEdgeLength;\n        }\n        return bottomSelectionPixel;\n    }\n\n    /**\n     * Calculate the top-most pixel we can draw the selection into\n     *\n     * @param childrenTop Top pixel were children can be drawn\n     * @param fadingEdgeLength Length of the fading edge in pixels, if present\n     * @param rowStart The start of the row that will contain the selection\n     * @return The top-most pixel we can draw the selection into\n     */\n    private getTopSelectionPixel(childrenTop:number, fadingEdgeLength:number, rowStart:number):number  {\n        // first pixel we can draw the selection into\n        let topSelectionPixel:number = childrenTop;\n        if (rowStart > 0) {\n            topSelectionPixel += fadingEdgeLength;\n        }\n        return topSelectionPixel;\n    }\n\n    /**\n     * Move all views upwards so the selected row does not interesect the bottom\n     * fading edge (if necessary).\n     *\n     * @param childInSelectedRow A child in the row that contains the selection\n     * @param topSelectionPixel The topmost pixel we can draw the selection into\n     * @param bottomSelectionPixel The bottommost pixel we can draw the\n     *        selection into\n     */\n    private adjustForBottomFadingEdge(childInSelectedRow:View, topSelectionPixel:number, bottomSelectionPixel:number):void  {\n        // list\n        if (childInSelectedRow.getBottom() > bottomSelectionPixel) {\n            // Find space available above the selection into which we can\n            // scroll upwards\n            let spaceAbove:number = childInSelectedRow.getTop() - topSelectionPixel;\n            // Find space required to bring the bottom of the selected item\n            // fully into view\n            let spaceBelow:number = childInSelectedRow.getBottom() - bottomSelectionPixel;\n            let offset:number = Math.min(spaceAbove, spaceBelow);\n            // Now offset the selected item to get it into view\n            this.offsetChildrenTopAndBottom(-offset);\n        }\n    }\n\n    /**\n     * Move all views upwards so the selected row does not interesect the top\n     * fading edge (if necessary).\n     *\n     * @param childInSelectedRow A child in the row that contains the selection\n     * @param topSelectionPixel The topmost pixel we can draw the selection into\n     * @param bottomSelectionPixel The bottommost pixel we can draw the\n     *        selection into\n     */\n    private adjustForTopFadingEdge(childInSelectedRow:View, topSelectionPixel:number, bottomSelectionPixel:number):void  {\n        // Some of the newly selected item extends above the top of the list\n        if (childInSelectedRow.getTop() < topSelectionPixel) {\n            // Find space required to bring the top of the selected item\n            // fully into view\n            let spaceAbove:number = topSelectionPixel - childInSelectedRow.getTop();\n            // Find space available below the selection into which we can\n            // scroll downwards\n            let spaceBelow:number = bottomSelectionPixel - childInSelectedRow.getBottom();\n            let offset:number = Math.min(spaceAbove, spaceBelow);\n            // Now offset the selected item to get it into view\n            this.offsetChildrenTopAndBottom(offset);\n        }\n    }\n\n    /**\n     * Smoothly scroll to the specified adapter position. The view will\n     * scroll such that the indicated position is displayed.\n     * @param position Scroll to this adapter position.\n     */\n    smoothScrollToPosition(position:number):void  {\n        super.smoothScrollToPosition(position);\n    }\n\n    /**\n     * Smoothly scroll to the specified adapter position offset. The view will\n     * scroll such that the indicated position is displayed.\n     * @param offset The amount to offset from the adapter position to scroll to.\n     */\n    smoothScrollByOffset(offset:number):void  {\n        super.smoothScrollByOffset(offset);\n    }\n\n    /**\n     * Fills the grid based on positioning the new selection relative to the old\n     * selection. The new selection will be placed at, above, or below the\n     * location of the new selection depending on how the selection is moving.\n     * The selection will then be pinned to the visible part of the screen,\n     * excluding the edges that are faded. The grid is then filled upwards and\n     * downwards from there.\n     *\n     * @param delta Which way we are moving\n     * @param childrenTop Where to start drawing children\n     * @param childrenBottom Last pixel where children can be drawn\n     * @return The view that currently has selection\n     */\n    private moveSelection(delta:number, childrenTop:number, childrenBottom:number):View  {\n        const fadingEdgeLength:number = this.getVerticalFadingEdgeLength();\n        const selectedPosition:number = this.mSelectedPosition;\n        const numColumns:number = this.mNumColumns;\n        const verticalSpacing:number = this.mVerticalSpacing;\n        let oldRowStart:number;\n        let rowStart:number;\n        let rowEnd:number = -1;\n        if (!this.mStackFromBottom) {\n            oldRowStart = (selectedPosition - delta) - ((selectedPosition - delta) % numColumns);\n            rowStart = selectedPosition - (selectedPosition % numColumns);\n        } else {\n            let invertedSelection:number = this.mItemCount - 1 - selectedPosition;\n            rowEnd = this.mItemCount - 1 - (invertedSelection - (invertedSelection % numColumns));\n            rowStart = Math.max(0, rowEnd - numColumns + 1);\n            invertedSelection = this.mItemCount - 1 - (selectedPosition - delta);\n            oldRowStart = this.mItemCount - 1 - (invertedSelection - (invertedSelection % numColumns));\n            oldRowStart = Math.max(0, oldRowStart - numColumns + 1);\n        }\n        const rowDelta:number = rowStart - oldRowStart;\n        const topSelectionPixel:number = this.getTopSelectionPixel(childrenTop, fadingEdgeLength, rowStart);\n        const bottomSelectionPixel:number = this.getBottomSelectionPixel(childrenBottom, fadingEdgeLength, numColumns, rowStart);\n        // Possibly changed again in fillUp if we add rows above this one.\n        this.mFirstPosition = rowStart;\n        let sel:View;\n        let referenceView:View;\n        if (rowDelta > 0) {\n            /*\n             * Case 1: Scrolling down.\n             */\n            const oldBottom:number = this.mReferenceViewInSelectedRow == null ? 0 : this.mReferenceViewInSelectedRow.getBottom();\n            sel = this.makeRow(this.mStackFromBottom ? rowEnd : rowStart, oldBottom + verticalSpacing, true);\n            referenceView = this.mReferenceView;\n            this.adjustForBottomFadingEdge(referenceView, topSelectionPixel, bottomSelectionPixel);\n        } else if (rowDelta < 0) {\n            /*\n             * Case 2: Scrolling up.\n             */\n            const oldTop:number = this.mReferenceViewInSelectedRow == null ? 0 : this.mReferenceViewInSelectedRow.getTop();\n            sel = this.makeRow(this.mStackFromBottom ? rowEnd : rowStart, oldTop - verticalSpacing, false);\n            referenceView = this.mReferenceView;\n            this.adjustForTopFadingEdge(referenceView, topSelectionPixel, bottomSelectionPixel);\n        } else {\n            /*\n             * Keep selection where it was\n             */\n            const oldTop:number = this.mReferenceViewInSelectedRow == null ? 0 : this.mReferenceViewInSelectedRow.getTop();\n            sel = this.makeRow(this.mStackFromBottom ? rowEnd : rowStart, oldTop, true);\n            referenceView = this.mReferenceView;\n        }\n        if (!this.mStackFromBottom) {\n            this.fillUp(rowStart - numColumns, referenceView.getTop() - verticalSpacing);\n            this.adjustViewsUpOrDown();\n            this.fillDown(rowStart + numColumns, referenceView.getBottom() + verticalSpacing);\n        } else {\n            this.fillDown(rowEnd + numColumns, referenceView.getBottom() + verticalSpacing);\n            this.adjustViewsUpOrDown();\n            this.fillUp(rowStart - 1, referenceView.getTop() - verticalSpacing);\n        }\n        return sel;\n    }\n\n    private determineColumns(availableSpace:number):boolean  {\n        const requestedHorizontalSpacing:number = this.mRequestedHorizontalSpacing;\n        const stretchMode:number = this.mStretchMode;\n        const requestedColumnWidth:number = this.mRequestedColumnWidth;\n        let didNotInitiallyFit:boolean = false;\n        if (this.mRequestedNumColumns == GridView.AUTO_FIT) {\n            if (requestedColumnWidth > 0) {\n                // Client told us to pick the number of columns\n                this.mNumColumns = (availableSpace + requestedHorizontalSpacing) / (requestedColumnWidth + requestedHorizontalSpacing);\n            } else {\n                // Just make up a number if we don't have enough info\n                this.mNumColumns = 2;\n            }\n        } else {\n            // We picked the columns\n            this.mNumColumns = this.mRequestedNumColumns;\n        }\n        if (this.mNumColumns <= 0) {\n            this.mNumColumns = 1;\n        }\n        switch(stretchMode) {\n            case GridView.NO_STRETCH:\n                // Nobody stretches\n                this.mColumnWidth = requestedColumnWidth;\n                this.mHorizontalSpacing = requestedHorizontalSpacing;\n                break;\n            default:\n                let spaceLeftOver:number = availableSpace - (this.mNumColumns * requestedColumnWidth) - ((this.mNumColumns - 1) * requestedHorizontalSpacing);\n                if (spaceLeftOver < 0) {\n                    didNotInitiallyFit = true;\n                }\n                switch(stretchMode) {\n                    case GridView.STRETCH_COLUMN_WIDTH:\n                        // Stretch the columns\n                        this.mColumnWidth = requestedColumnWidth + spaceLeftOver / this.mNumColumns;\n                        this.mHorizontalSpacing = requestedHorizontalSpacing;\n                        break;\n                    case GridView.STRETCH_SPACING:\n                        // Stretch the spacing between columns\n                        this.mColumnWidth = requestedColumnWidth;\n                        if (this.mNumColumns > 1) {\n                            this.mHorizontalSpacing = requestedHorizontalSpacing + spaceLeftOver / (this.mNumColumns - 1);\n                        } else {\n                            this.mHorizontalSpacing = requestedHorizontalSpacing + spaceLeftOver;\n                        }\n                        break;\n                    case GridView.STRETCH_SPACING_UNIFORM:\n                        // Stretch the spacing between columns\n                        this.mColumnWidth = requestedColumnWidth;\n                        if (this.mNumColumns > 1) {\n                            this.mHorizontalSpacing = requestedHorizontalSpacing + spaceLeftOver / (this.mNumColumns + 1);\n                        } else {\n                            this.mHorizontalSpacing = requestedHorizontalSpacing + spaceLeftOver;\n                        }\n                        break;\n                }\n                break;\n        }\n        return didNotInitiallyFit;\n    }\n\n    protected onMeasure(widthMeasureSpec:number, heightMeasureSpec:number):void  {\n        // Sets up mListPadding\n        super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n        let widthMode:number = View.MeasureSpec.getMode(widthMeasureSpec);\n        let heightMode:number = View.MeasureSpec.getMode(heightMeasureSpec);\n        let widthSize:number = View.MeasureSpec.getSize(widthMeasureSpec);\n        let heightSize:number = View.MeasureSpec.getSize(heightMeasureSpec);\n        if (widthMode == View.MeasureSpec.UNSPECIFIED) {\n            if (this.mColumnWidth > 0) {\n                widthSize = this.mColumnWidth + this.mListPadding.left + this.mListPadding.right;\n            } else {\n                widthSize = this.mListPadding.left + this.mListPadding.right;\n            }\n            widthSize += this.getVerticalScrollbarWidth();\n        }\n        let childWidth:number = widthSize - this.mListPadding.left - this.mListPadding.right;\n        let didNotInitiallyFit:boolean = this.determineColumns(childWidth);\n        let childHeight:number = 0;\n        let childState:number = 0;\n        this.mItemCount = this.mAdapter == null ? 0 : this.mAdapter.getCount();\n        const count:number = this.mItemCount;\n        if (count > 0) {\n            const child:View = this.obtainView(0, this.mIsScrap);\n            let p:AbsListView.LayoutParams = <AbsListView.LayoutParams> child.getLayoutParams();\n            if (p == null) {\n                p = <AbsListView.LayoutParams> this.generateDefaultLayoutParams();\n                child.setLayoutParams(p);\n            }\n            p.viewType = this.mAdapter.getItemViewType(0);\n            p.forceAdd = true;\n            let childHeightSpec:number = GridView.getChildMeasureSpec(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), 0, p.height);\n            let childWidthSpec:number = GridView.getChildMeasureSpec(View.MeasureSpec.makeMeasureSpec(this.mColumnWidth, View.MeasureSpec.EXACTLY), 0, p.width);\n            child.measure(childWidthSpec, childHeightSpec);\n            childHeight = child.getMeasuredHeight();\n            childState = GridView.combineMeasuredStates(childState, child.getMeasuredState());\n            if (this.mRecycler.shouldRecycleViewType(p.viewType)) {\n                this.mRecycler.addScrapView(child, -1);\n            }\n        }\n        if (heightMode == View.MeasureSpec.UNSPECIFIED) {\n            heightSize = this.mListPadding.top + this.mListPadding.bottom + childHeight + this.getVerticalFadingEdgeLength() * 2;\n        }\n        if (heightMode == View.MeasureSpec.AT_MOST) {\n            let ourSize:number = this.mListPadding.top + this.mListPadding.bottom;\n            const numColumns:number = this.mNumColumns;\n            for (let i:number = 0; i < count; i += numColumns) {\n                ourSize += childHeight;\n                if (i + numColumns < count) {\n                    ourSize += this.mVerticalSpacing;\n                }\n                if (ourSize >= heightSize) {\n                    ourSize = heightSize;\n                    break;\n                }\n            }\n            heightSize = ourSize;\n        }\n        if (widthMode == View.MeasureSpec.AT_MOST && this.mRequestedNumColumns != GridView.AUTO_FIT) {\n            let ourSize:number = (this.mRequestedNumColumns * this.mColumnWidth) + ((this.mRequestedNumColumns - 1) * this.mHorizontalSpacing) + this.mListPadding.left + this.mListPadding.right;\n            if (ourSize > widthSize || didNotInitiallyFit) {\n                widthSize |= GridView.MEASURED_STATE_TOO_SMALL;\n            }\n        }\n        this.setMeasuredDimension(widthSize, heightSize);\n        this.mWidthMeasureSpec = widthMeasureSpec;\n    }\n\n    protected layoutChildren():void  {\n        const blockLayoutRequests:boolean = this.mBlockLayoutRequests;\n        if (!blockLayoutRequests) {\n            this.mBlockLayoutRequests = true;\n        }\n        try {\n            super.layoutChildren();\n            this.invalidate();\n            if (this.mAdapter == null) {\n                this.resetList();\n                this.invokeOnItemScrollListener();\n                return;\n            }\n            const childrenTop:number = this.mListPadding.top;\n            const childrenBottom:number = this.mBottom - this.mTop - this.mListPadding.bottom;\n            let childCount:number = this.getChildCount();\n            let index:number;\n            let delta:number = 0;\n            let sel:View;\n            let oldSel:View = null;\n            let oldFirst:View = null;\n            let newSel:View = null;\n            // Remember stuff we will need down below\n            switch(this.mLayoutMode) {\n                case GridView.LAYOUT_SET_SELECTION:\n                    index = this.mNextSelectedPosition - this.mFirstPosition;\n                    if (index >= 0 && index < childCount) {\n                        newSel = this.getChildAt(index);\n                    }\n                    break;\n                case GridView.LAYOUT_FORCE_TOP:\n                case GridView.LAYOUT_FORCE_BOTTOM:\n                case GridView.LAYOUT_SPECIFIC:\n                case GridView.LAYOUT_SYNC:\n                    break;\n                case GridView.LAYOUT_MOVE_SELECTION:\n                    if (this.mNextSelectedPosition >= 0) {\n                        delta = this.mNextSelectedPosition - this.mSelectedPosition;\n                    }\n                    break;\n                default:\n                    // Remember the previously selected view\n                    index = this.mSelectedPosition - this.mFirstPosition;\n                    if (index >= 0 && index < childCount) {\n                        oldSel = this.getChildAt(index);\n                    }\n                    // Remember the previous first child\n                    oldFirst = this.getChildAt(0);\n            }\n            let dataChanged:boolean = this.mDataChanged;\n            if (dataChanged) {\n                this.handleDataChanged();\n            }\n            // and calling it a day\n            if (this.mItemCount == 0) {\n                this.resetList();\n                this.invokeOnItemScrollListener();\n                return;\n            }\n            this.setSelectedPositionInt(this.mNextSelectedPosition);\n            // Pull all children into the RecycleBin.\n            // These views will be reused if possible\n            const firstPosition:number = this.mFirstPosition;\n            const recycleBin:AbsListView.RecycleBin = this.mRecycler;\n            if (dataChanged) {\n                for (let i:number = 0; i < childCount; i++) {\n                    recycleBin.addScrapView(this.getChildAt(i), firstPosition + i);\n                }\n            } else {\n                recycleBin.fillActiveViews(childCount, firstPosition);\n            }\n            // Clear out old views\n            //removeAllViewsInLayout();\n            this.detachAllViewsFromParent();\n            recycleBin.removeSkippedScrap();\n            switch(this.mLayoutMode) {\n                case GridView.LAYOUT_SET_SELECTION:\n                    if (newSel != null) {\n                        sel = this.fillFromSelection(newSel.getTop(), childrenTop, childrenBottom);\n                    } else {\n                        sel = this.fillSelection(childrenTop, childrenBottom);\n                    }\n                    break;\n                case GridView.LAYOUT_FORCE_TOP:\n                    this.mFirstPosition = 0;\n                    sel = this.fillFromTop(childrenTop);\n                    this.adjustViewsUpOrDown();\n                    break;\n                case GridView.LAYOUT_FORCE_BOTTOM:\n                    sel = this.fillUp(this.mItemCount - 1, childrenBottom);\n                    this.adjustViewsUpOrDown();\n                    break;\n                case GridView.LAYOUT_SPECIFIC:\n                    sel = this.fillSpecific(this.mSelectedPosition, this.mSpecificTop);\n                    break;\n                case GridView.LAYOUT_SYNC:\n                    sel = this.fillSpecific(this.mSyncPosition, this.mSpecificTop);\n                    break;\n                case GridView.LAYOUT_MOVE_SELECTION:\n                    // Move the selection relative to its old position\n                    sel = this.moveSelection(delta, childrenTop, childrenBottom);\n                    break;\n                default:\n                    if (childCount == 0) {\n                        if (!this.mStackFromBottom) {\n                            this.setSelectedPositionInt(this.mAdapter == null || this.isInTouchMode() ? GridView.INVALID_POSITION : 0);\n                            sel = this.fillFromTop(childrenTop);\n                        } else {\n                            const last:number = this.mItemCount - 1;\n                            this.setSelectedPositionInt(this.mAdapter == null || this.isInTouchMode() ? GridView.INVALID_POSITION : last);\n                            sel = this.fillFromBottom(last, childrenBottom);\n                        }\n                    } else {\n                        if (this.mSelectedPosition >= 0 && this.mSelectedPosition < this.mItemCount) {\n                            sel = this.fillSpecific(this.mSelectedPosition, oldSel == null ? childrenTop : oldSel.getTop());\n                        } else if (this.mFirstPosition < this.mItemCount) {\n                            sel = this.fillSpecific(this.mFirstPosition, oldFirst == null ? childrenTop : oldFirst.getTop());\n                        } else {\n                            sel = this.fillSpecific(0, childrenTop);\n                        }\n                    }\n                    break;\n            }\n            // Flush any cached views that did not get reused above\n            recycleBin.scrapActiveViews();\n            if (sel != null) {\n                this.positionSelector(GridView.INVALID_POSITION, sel);\n                this.mSelectedTop = sel.getTop();\n            } else if (this.mTouchMode > GridView.TOUCH_MODE_DOWN && this.mTouchMode < GridView.TOUCH_MODE_SCROLL) {\n                let child:View = this.getChildAt(this.mMotionPosition - this.mFirstPosition);\n                if (child != null)\n                    this.positionSelector(this.mMotionPosition, child);\n            } else {\n                this.mSelectedTop = 0;\n                this.mSelectorRect.setEmpty();\n            }\n            this.mLayoutMode = GridView.LAYOUT_NORMAL;\n            this.mDataChanged = false;\n            if (this.mPositionScrollAfterLayout != null) {\n                this.post(this.mPositionScrollAfterLayout);\n                this.mPositionScrollAfterLayout = null;\n            }\n            this.mNeedSync = false;\n            this.setNextSelectedPositionInt(this.mSelectedPosition);\n            this.updateScrollIndicators();\n            if (this.mItemCount > 0) {\n                this.checkSelectionChanged();\n            }\n            this.invokeOnItemScrollListener();\n        } finally {\n            if (!blockLayoutRequests) {\n                this.mBlockLayoutRequests = false;\n            }\n        }\n    }\n\n    /**\n     * Obtain the view and add it to our list of children. The view can be made\n     * fresh, converted from an unused view, or used as is if it was in the\n     * recycle bin.\n     *\n     * @param position Logical position in the list\n     * @param y Top or bottom edge of the view to add\n     * @param flow if true, align top edge to y. If false, align bottom edge to\n     *        y.\n     * @param childrenLeft Left edge where children should be positioned\n     * @param selected Is this position selected?\n     * @param where to add new item in the list\n     * @return View that was added\n     */\n    private makeAndAddView(position:number, y:number, flow:boolean, childrenLeft:number, selected:boolean, where:number):View  {\n        let child:View;\n        if (!this.mDataChanged) {\n            // Try to use an existing view for this position\n            child = this.mRecycler.getActiveView(position);\n            if (child != null) {\n                // Found it -- we're using an existing child\n                // This just needs to be positioned\n                this.setupChild(child, position, y, flow, childrenLeft, selected, true, where);\n                return child;\n            }\n        }\n        // Make a new view for this position, or convert an unused view if\n        // possible\n        child = this.obtainView(position, this.mIsScrap);\n        // This needs to be positioned and measured\n        this.setupChild(child, position, y, flow, childrenLeft, selected, this.mIsScrap[0], where);\n        return child;\n    }\n\n    /**\n     * Add a view as a child and make sure it is measured (if necessary) and\n     * positioned properly.\n     *\n     * @param child The view to add\n     * @param position The position of the view\n     * @param y The y position relative to which this view will be positioned\n     * @param flow if true, align top edge to y. If false, align bottom edge\n     *        to y.\n     * @param childrenLeft Left edge where children should be positioned\n     * @param selected Is this position selected?\n     * @param recycled Has this view been pulled from the recycle bin? If so it\n     *        does not need to be remeasured.\n     * @param where Where to add the item in the list\n     *\n     */\n    private setupChild(child:View, position:number, y:number, flow:boolean, childrenLeft:number, selected:boolean, recycled:boolean, where:number):void  {\n        Trace.traceBegin(Trace.TRACE_TAG_VIEW, \"setupGridItem\");\n        let isSelected:boolean = selected && this.shouldShowSelector();\n        const updateChildSelected:boolean = isSelected != child.isSelected();\n        const mode:number = this.mTouchMode;\n        const isPressed:boolean = mode > GridView.TOUCH_MODE_DOWN && mode < GridView.TOUCH_MODE_SCROLL && this.mMotionPosition == position;\n        const updateChildPressed:boolean = isPressed != child.isPressed();\n        let needToMeasure:boolean = !recycled || updateChildSelected || child.isLayoutRequested();\n        // Respect layout params that are already in the view. Otherwise make\n        // some up...\n        let p:AbsListView.LayoutParams = <AbsListView.LayoutParams> child.getLayoutParams();\n        if (p == null) {\n            p = <AbsListView.LayoutParams> this.generateDefaultLayoutParams();\n        }\n        p.viewType = this.mAdapter.getItemViewType(position);\n        if (recycled && !p.forceAdd) {\n            this.attachViewToParent(child, where, p);\n        } else {\n            p.forceAdd = false;\n            this.addViewInLayout(child, where, p, true);\n        }\n        if (updateChildSelected) {\n            child.setSelected(isSelected);\n            if (isSelected) {\n                this.requestFocus();\n            }\n        }\n        if (updateChildPressed) {\n            child.setPressed(isPressed);\n        }\n        if (this.mChoiceMode != GridView.CHOICE_MODE_NONE && this.mCheckStates != null) {\n            if (child['setChecked']) {\n                (<Checkable><any>child).setChecked(this.mCheckStates.get(position));\n            } else {\n                child.setActivated(this.mCheckStates.get(position));\n            }\n        }\n        if (needToMeasure) {\n            let childHeightSpec:number = ViewGroup.getChildMeasureSpec(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), 0, p.height);\n            let childWidthSpec:number = ViewGroup.getChildMeasureSpec(View.MeasureSpec.makeMeasureSpec(this.mColumnWidth, View.MeasureSpec.EXACTLY), 0, p.width);\n            child.measure(childWidthSpec, childHeightSpec);\n        } else {\n            this.cleanupLayoutState(child);\n        }\n        const w:number = child.getMeasuredWidth();\n        const h:number = child.getMeasuredHeight();\n        let childLeft:number;\n        const childTop:number = flow ? y : y - h;\n        //const layoutDirection:number = this.getLayoutDirection();\n        const absoluteGravity:number = this.mGravity;//Gravity.getAbsoluteGravity(this.mGravity, layoutDirection);\n        switch(absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n            case Gravity.LEFT:\n                childLeft = childrenLeft;\n                break;\n            case Gravity.CENTER_HORIZONTAL:\n                childLeft = childrenLeft + ((this.mColumnWidth - w) / 2);\n                break;\n            case Gravity.RIGHT:\n                childLeft = childrenLeft + this.mColumnWidth - w;\n                break;\n            default:\n                childLeft = childrenLeft;\n                break;\n        }\n        if (needToMeasure) {\n            const childRight:number = childLeft + w;\n            const childBottom:number = childTop + h;\n            child.layout(childLeft, childTop, childRight, childBottom);\n        } else {\n            child.offsetLeftAndRight(childLeft - child.getLeft());\n            child.offsetTopAndBottom(childTop - child.getTop());\n        }\n        if (this.mCachingStarted) {\n            child.setDrawingCacheEnabled(true);\n        }\n        if (recycled && ((<AbsListView.LayoutParams> child.getLayoutParams()).scrappedFromPosition) != position) {\n            child.jumpDrawablesToCurrentState();\n        }\n        Trace.traceEnd(Trace.TRACE_TAG_VIEW);\n    }\n\n    /**\n     * Sets the currently selected item\n     * \n     * @param position Index (starting at 0) of the data item to be selected.\n     * \n     * If in touch mode, the item will not be selected but it will still be positioned\n     * appropriately.\n     */\n    setSelection(position:number):void  {\n        if (!this.isInTouchMode()) {\n            this.setNextSelectedPositionInt(position);\n        } else {\n            this.mResurrectToPosition = position;\n        }\n        this.mLayoutMode = GridView.LAYOUT_SET_SELECTION;\n        if (this.mPositionScroller != null) {\n            this.mPositionScroller.stop();\n        }\n        this.requestLayout();\n    }\n\n    /**\n     * Makes the item at the supplied position selected.\n     *\n     * @param position the position of the new selection\n     */\n    setSelectionInt(position:number):void  {\n        let previousSelectedPosition:number = this.mNextSelectedPosition;\n        if (this.mPositionScroller != null) {\n            this.mPositionScroller.stop();\n        }\n        this.setNextSelectedPositionInt(position);\n        this.layoutChildren();\n        const next:number = this.mStackFromBottom ? this.mItemCount - 1 - this.mNextSelectedPosition : this.mNextSelectedPosition;\n        const previous:number = this.mStackFromBottom ? this.mItemCount - 1 - previousSelectedPosition : previousSelectedPosition;\n        const nextRow:number = next / this.mNumColumns;\n        const previousRow:number = previous / this.mNumColumns;\n        if (nextRow != previousRow) {\n            this.awakenScrollBars();\n        }\n    }\n\n    onKeyDown(keyCode:number, event:KeyEvent):boolean  {\n        return this.commonKey(keyCode, 1, event);\n    }\n\n    onKeyMultiple(keyCode:number, repeatCount:number, event:KeyEvent):boolean  {\n        return this.commonKey(keyCode, repeatCount, event);\n    }\n\n    onKeyUp(keyCode:number, event:KeyEvent):boolean  {\n        return this.commonKey(keyCode, 1, event);\n    }\n\n    private commonKey(keyCode:number, count:number, event:KeyEvent):boolean  {\n        if (this.mAdapter == null) {\n            return false;\n        }\n        if (this.mDataChanged) {\n            this.layoutChildren();\n        }\n        let handled:boolean = false;\n        let action:number = event.getAction();\n        if (action != KeyEvent.ACTION_UP) {\n            switch(keyCode) {\n                case KeyEvent.KEYCODE_DPAD_LEFT:\n                    if (event.hasNoModifiers()) {\n                        handled = this.resurrectSelectionIfNeeded() || this.arrowScroll(GridView.FOCUS_LEFT);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_DPAD_RIGHT:\n                    if (event.hasNoModifiers()) {\n                        handled = this.resurrectSelectionIfNeeded() || this.arrowScroll(GridView.FOCUS_RIGHT);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_DPAD_UP:\n                    if (event.hasNoModifiers()) {\n                        handled = this.resurrectSelectionIfNeeded() || this.arrowScroll(GridView.FOCUS_UP);\n                    } else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {\n                        handled = this.resurrectSelectionIfNeeded() || this.fullScroll(GridView.FOCUS_UP);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_DPAD_DOWN:\n                    if (event.hasNoModifiers()) {\n                        handled = this.resurrectSelectionIfNeeded() || this.arrowScroll(GridView.FOCUS_DOWN);\n                    } else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {\n                        handled = this.resurrectSelectionIfNeeded() || this.fullScroll(GridView.FOCUS_DOWN);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_DPAD_CENTER:\n                case KeyEvent.KEYCODE_ENTER:\n                    if (event.hasNoModifiers()) {\n                        handled = this.resurrectSelectionIfNeeded();\n                        if (!handled && event.getRepeatCount() == 0 && this.getChildCount() > 0) {\n                            this.keyPressed();\n                            handled = true;\n                        }\n                    }\n                    break;\n                case KeyEvent.KEYCODE_SPACE:\n                    //if (this.mPopup == null || !this.mPopup.isShowing()) {\n                        if (event.hasNoModifiers()) {\n                            handled = this.resurrectSelectionIfNeeded() || this.pageScroll(GridView.FOCUS_DOWN);\n                        } else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) {\n                            handled = this.resurrectSelectionIfNeeded() || this.pageScroll(GridView.FOCUS_UP);\n                        }\n                    //}\n                    break;\n                case KeyEvent.KEYCODE_PAGE_UP:\n                    if (event.hasNoModifiers()) {\n                        handled = this.resurrectSelectionIfNeeded() || this.pageScroll(GridView.FOCUS_UP);\n                    } else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {\n                        handled = this.resurrectSelectionIfNeeded() || this.fullScroll(GridView.FOCUS_UP);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_PAGE_DOWN:\n                    if (event.hasNoModifiers()) {\n                        handled = this.resurrectSelectionIfNeeded() || this.pageScroll(GridView.FOCUS_DOWN);\n                    } else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {\n                        handled = this.resurrectSelectionIfNeeded() || this.fullScroll(GridView.FOCUS_DOWN);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_MOVE_HOME:\n                    if (event.hasNoModifiers()) {\n                        handled = this.resurrectSelectionIfNeeded() || this.fullScroll(GridView.FOCUS_UP);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_MOVE_END:\n                    if (event.hasNoModifiers()) {\n                        handled = this.resurrectSelectionIfNeeded() || this.fullScroll(GridView.FOCUS_DOWN);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_TAB:\n                    // XXX Sometimes it is useful to be able to TAB through the items in\n                    //     a GridView sequentially.  Unfortunately this can create an\n                    //     asymmetry in TAB navigation order unless the list selection\n                    //     always reverts to the top or bottom when receiving TAB focus from\n                    //     another widget.  Leaving this behavior disabled for now but\n                    //     perhaps it should be configurable (and more comprehensive).\n                    // if (false) {\n                    //     if (event.hasNoModifiers()) {\n                    //         handled = this.resurrectSelectionIfNeeded() || this.sequenceScroll(GridView.FOCUS_FORWARD);\n                    //     } else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) {\n                    //         handled = this.resurrectSelectionIfNeeded() || this.sequenceScroll(GridView.FOCUS_BACKWARD);\n                    //     }\n                    // }\n                    break;\n            }\n        }\n        if (handled) {\n            return true;\n        }\n        //if (this.sendToTextFilter(keyCode, count, event)) {\n        //    return true;\n        //}\n        switch(action) {\n            case KeyEvent.ACTION_DOWN:\n                return super.onKeyDown(keyCode, event);\n            case KeyEvent.ACTION_UP:\n                return super.onKeyUp(keyCode, event);\n            //case KeyEvent.ACTION_MULTIPLE:\n            //    return super.onKeyMultiple(keyCode, count, event);\n            default:\n                return false;\n        }\n    }\n\n    /**\n     * Scrolls up or down by the number of items currently present on screen.\n     *\n     * @param direction either {@link View#FOCUS_UP} or {@link View#FOCUS_DOWN}\n     * @return whether selection was moved\n     */\n    pageScroll(direction:number):boolean  {\n        let nextPage:number = -1;\n        if (direction == GridView.FOCUS_UP) {\n            nextPage = Math.max(0, this.mSelectedPosition - this.getChildCount());\n        } else if (direction == GridView.FOCUS_DOWN) {\n            nextPage = Math.min(this.mItemCount - 1, this.mSelectedPosition + this.getChildCount());\n        }\n        if (nextPage >= 0) {\n            this.setSelectionInt(nextPage);\n            this.invokeOnItemScrollListener();\n            this.awakenScrollBars();\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * Go to the last or first item if possible.\n     *\n     * @param direction either {@link View#FOCUS_UP} or {@link View#FOCUS_DOWN}.\n     *\n     * @return Whether selection was moved.\n     */\n    fullScroll(direction:number):boolean  {\n        let moved:boolean = false;\n        if (direction == GridView.FOCUS_UP) {\n            this.mLayoutMode = GridView.LAYOUT_SET_SELECTION;\n            this.setSelectionInt(0);\n            this.invokeOnItemScrollListener();\n            moved = true;\n        } else if (direction == GridView.FOCUS_DOWN) {\n            this.mLayoutMode = GridView.LAYOUT_SET_SELECTION;\n            this.setSelectionInt(this.mItemCount - 1);\n            this.invokeOnItemScrollListener();\n            moved = true;\n        }\n        if (moved) {\n            this.awakenScrollBars();\n        }\n        return moved;\n    }\n\n    /**\n     * Scrolls to the next or previous item, horizontally or vertically.\n     *\n     * @param direction either {@link View#FOCUS_LEFT}, {@link View#FOCUS_RIGHT},\n     *        {@link View#FOCUS_UP} or {@link View#FOCUS_DOWN}\n     *\n     * @return whether selection was moved\n     */\n    arrowScroll(direction:number):boolean  {\n        const selectedPosition:number = this.mSelectedPosition;\n        const numColumns:number = this.mNumColumns;\n        let startOfRowPos:number;\n        let endOfRowPos:number;\n        let moved:boolean = false;\n        if (!this.mStackFromBottom) {\n            startOfRowPos = Math.floor(selectedPosition / numColumns) * numColumns;\n            endOfRowPos = Math.min(startOfRowPos + numColumns - 1, this.mItemCount - 1);\n        } else {\n            const invertedSelection:number = this.mItemCount - 1 - selectedPosition;\n            endOfRowPos = this.mItemCount - 1 - (invertedSelection / numColumns) * numColumns;\n            startOfRowPos = Math.max(0, endOfRowPos - numColumns + 1);\n        }\n        switch(direction) {\n            case GridView.FOCUS_UP:\n                if (startOfRowPos > 0) {\n                    this.mLayoutMode = GridView.LAYOUT_MOVE_SELECTION;\n                    this.setSelectionInt(Math.max(0, selectedPosition - numColumns));\n                    moved = true;\n                }\n                break;\n            case GridView.FOCUS_DOWN:\n                if (endOfRowPos < this.mItemCount - 1) {\n                    this.mLayoutMode = GridView.LAYOUT_MOVE_SELECTION;\n                    this.setSelectionInt(Math.min(selectedPosition + numColumns, this.mItemCount - 1));\n                    moved = true;\n                }\n                break;\n            case GridView.FOCUS_LEFT:\n                if (selectedPosition > startOfRowPos) {\n                    this.mLayoutMode = GridView.LAYOUT_MOVE_SELECTION;\n                    this.setSelectionInt(Math.max(0, selectedPosition - 1));\n                    moved = true;\n                }\n                break;\n            case GridView.FOCUS_RIGHT:\n                if (selectedPosition < endOfRowPos) {\n                    this.mLayoutMode = GridView.LAYOUT_MOVE_SELECTION;\n                    this.setSelectionInt(Math.min(selectedPosition + 1, this.mItemCount - 1));\n                    moved = true;\n                }\n                break;\n        }\n        if (moved) {\n            this.playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));\n            this.invokeOnItemScrollListener();\n        }\n        if (moved) {\n            this.awakenScrollBars();\n        }\n        return moved;\n    }\n\n    /**\n     * Goes to the next or previous item according to the order set by the\n     * adapter.\n     */\n    sequenceScroll(direction:number):boolean  {\n        let selectedPosition:number = this.mSelectedPosition;\n        let numColumns:number = this.mNumColumns;\n        let count:number = this.mItemCount;\n        let startOfRow:number;\n        let endOfRow:number;\n        if (!this.mStackFromBottom) {\n            startOfRow = (selectedPosition / numColumns) * numColumns;\n            endOfRow = Math.min(startOfRow + numColumns - 1, count - 1);\n        } else {\n            let invertedSelection:number = count - 1 - selectedPosition;\n            endOfRow = count - 1 - (invertedSelection / numColumns) * numColumns;\n            startOfRow = Math.max(0, endOfRow - numColumns + 1);\n        }\n        let moved:boolean = false;\n        let showScroll:boolean = false;\n        switch(direction) {\n            case GridView.FOCUS_FORWARD:\n                if (selectedPosition < count - 1) {\n                    // Move to the next item.\n                    this.mLayoutMode = GridView.LAYOUT_MOVE_SELECTION;\n                    this.setSelectionInt(selectedPosition + 1);\n                    moved = true;\n                    // Show the scrollbar only if changing rows.\n                    showScroll = selectedPosition == endOfRow;\n                }\n                break;\n            case GridView.FOCUS_BACKWARD:\n                if (selectedPosition > 0) {\n                    // Move to the previous item.\n                    this.mLayoutMode = GridView.LAYOUT_MOVE_SELECTION;\n                    this.setSelectionInt(selectedPosition - 1);\n                    moved = true;\n                    // Show the scrollbar only if changing rows.\n                    showScroll = selectedPosition == startOfRow;\n                }\n                break;\n        }\n        if (moved) {\n            this.playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));\n            this.invokeOnItemScrollListener();\n        }\n        if (showScroll) {\n            this.awakenScrollBars();\n        }\n        return moved;\n    }\n\n    protected onFocusChanged(gainFocus:boolean, direction:number, previouslyFocusedRect:Rect):void  {\n        super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);\n        let closestChildIndex:number = -1;\n        if (gainFocus && previouslyFocusedRect != null) {\n            previouslyFocusedRect.offset(this.mScrollX, this.mScrollY);\n            // figure out which item should be selected based on previously\n            // focused rect\n            let otherRect:Rect = this.mTempRect;\n            let minDistance:number = Integer.MAX_VALUE;\n            const childCount:number = this.getChildCount();\n            for (let i:number = 0; i < childCount; i++) {\n                // only consider view's on appropriate edge of grid\n                if (!this.isCandidateSelection(i, direction)) {\n                    continue;\n                }\n                const other:View = this.getChildAt(i);\n                other.getDrawingRect(otherRect);\n                this.offsetDescendantRectToMyCoords(other, otherRect);\n                let distance:number = GridView.getDistance(previouslyFocusedRect, otherRect, direction);\n                if (distance < minDistance) {\n                    minDistance = distance;\n                    closestChildIndex = i;\n                }\n            }\n        }\n        if (closestChildIndex >= 0) {\n            this.setSelection(closestChildIndex + this.mFirstPosition);\n        } else {\n            this.requestLayout();\n        }\n    }\n\n    /**\n     * Is childIndex a candidate for next focus given the direction the focus\n     * change is coming from?\n     * @param childIndex The index to check.\n     * @param direction The direction, one of\n     *        {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_FORWARD, FOCUS_BACKWARD}\n     * @return Whether childIndex is a candidate.\n     */\n    private isCandidateSelection(childIndex:number, direction:number):boolean  {\n        const count:number = this.getChildCount();\n        const invertedIndex:number = count - 1 - childIndex;\n        let rowStart:number;\n        let rowEnd:number;\n        if (!this.mStackFromBottom) {\n            rowStart = childIndex - (childIndex % this.mNumColumns);\n            rowEnd = Math.max(rowStart + this.mNumColumns - 1, count);\n        } else {\n            rowEnd = count - 1 - (invertedIndex - (invertedIndex % this.mNumColumns));\n            rowStart = Math.max(0, rowEnd - this.mNumColumns + 1);\n        }\n        switch(direction) {\n            case View.FOCUS_RIGHT:\n                // edge\n                return childIndex == rowStart;\n            case View.FOCUS_DOWN:\n                // coming from top; only valid if in top row\n                return rowStart == 0;\n            case View.FOCUS_LEFT:\n                // coming from right, must be on right edge\n                return childIndex == rowEnd;\n            case View.FOCUS_UP:\n                // coming from bottom, need to be in last row\n                return rowEnd == count - 1;\n            case View.FOCUS_FORWARD:\n                // coming from top-left, need to be first in top row\n                return childIndex == rowStart && rowStart == 0;\n            case View.FOCUS_BACKWARD:\n                // coming from bottom-right, need to be last in bottom row\n                return childIndex == rowEnd && rowEnd == count - 1;\n            default:\n                throw Error(`new IllegalArgumentException(\"direction must be one of \" + \"{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, \" + \"FOCUS_FORWARD, FOCUS_BACKWARD}.\")`);\n        }\n    }\n\n    /**\n     * Set the gravity for this grid. Gravity describes how the child views\n     * are horizontally aligned. Defaults to Gravity.LEFT\n     *\n     * @param gravity the gravity to apply to this grid's children\n     *\n     * @attr ref android.R.styleable#GridView_gravity\n     */\n    setGravity(gravity:number):void  {\n        if (this.mGravity != gravity) {\n            this.mGravity = gravity;\n            this.requestLayoutIfNecessary();\n        }\n    }\n\n    /**\n     * Describes how the child views are horizontally aligned. Defaults to Gravity.LEFT\n     *\n     * @return the gravity that will be applied to this grid's children\n     *\n     * @attr ref android.R.styleable#GridView_gravity\n     */\n    getGravity():number  {\n        return this.mGravity;\n    }\n\n    /**\n     * Set the amount of horizontal (x) spacing to place between each item\n     * in the grid.\n     *\n     * @param horizontalSpacing The amount of horizontal space between items,\n     * in pixels.\n     *\n     * @attr ref android.R.styleable#GridView_horizontalSpacing\n     */\n    setHorizontalSpacing(horizontalSpacing:number):void  {\n        if (horizontalSpacing != this.mRequestedHorizontalSpacing) {\n            this.mRequestedHorizontalSpacing = horizontalSpacing;\n            this.requestLayoutIfNecessary();\n        }\n    }\n\n    /**\n     * Returns the amount of horizontal spacing currently used between each item in the grid.\n     *\n     * <p>This is only accurate for the current layout. If {@link #setHorizontalSpacing(int)}\n     * has been called but layout is not yet complete, this method may return a stale value.\n     * To get the horizontal spacing that was explicitly requested use\n     * {@link #getRequestedHorizontalSpacing()}.</p>\n     *\n     * @return Current horizontal spacing between each item in pixels\n     *\n     * @see #setHorizontalSpacing(int)\n     * @see #getRequestedHorizontalSpacing()\n     *\n     * @attr ref android.R.styleable#GridView_horizontalSpacing\n     */\n    getHorizontalSpacing():number  {\n        return this.mHorizontalSpacing;\n    }\n\n    /**\n     * Returns the requested amount of horizontal spacing between each item in the grid.\n     *\n     * <p>The value returned may have been supplied during inflation as part of a style,\n     * the default GridView style, or by a call to {@link #setHorizontalSpacing(int)}.\n     * If layout is not yet complete or if GridView calculated a different horizontal spacing\n     * from what was requested, this may return a different value from\n     * {@link #getHorizontalSpacing()}.</p>\n     *\n     * @return The currently requested horizontal spacing between items, in pixels\n     *\n     * @see #setHorizontalSpacing(int)\n     * @see #getHorizontalSpacing()\n     *\n     * @attr ref android.R.styleable#GridView_horizontalSpacing\n     */\n    getRequestedHorizontalSpacing():number  {\n        return this.mRequestedHorizontalSpacing;\n    }\n\n    /**\n     * Set the amount of vertical (y) spacing to place between each item\n     * in the grid.\n     *\n     * @param verticalSpacing The amount of vertical space between items,\n     * in pixels.\n     *\n     * @see #getVerticalSpacing()\n     *\n     * @attr ref android.R.styleable#GridView_verticalSpacing\n     */\n    setVerticalSpacing(verticalSpacing:number):void  {\n        if (verticalSpacing != this.mVerticalSpacing) {\n            this.mVerticalSpacing = verticalSpacing;\n            this.requestLayoutIfNecessary();\n        }\n    }\n\n    /**\n     * Returns the amount of vertical spacing between each item in the grid.\n     *\n     * @return The vertical spacing between items in pixels\n     *\n     * @see #setVerticalSpacing(int)\n     *\n     * @attr ref android.R.styleable#GridView_verticalSpacing\n     */\n    getVerticalSpacing():number  {\n        return this.mVerticalSpacing;\n    }\n\n    /**\n     * Control how items are stretched to fill their space.\n     *\n     * @param stretchMode Either {@link #NO_STRETCH},\n     * {@link #STRETCH_SPACING}, {@link #STRETCH_SPACING_UNIFORM}, or {@link #STRETCH_COLUMN_WIDTH}.\n     *\n     * @attr ref android.R.styleable#GridView_stretchMode\n     */\n    setStretchMode(stretchMode:number):void  {\n        if (stretchMode != this.mStretchMode) {\n            this.mStretchMode = stretchMode;\n            this.requestLayoutIfNecessary();\n        }\n    }\n\n    getStretchMode():number  {\n        return this.mStretchMode;\n    }\n\n    /**\n     * Set the width of columns in the grid.\n     *\n     * @param columnWidth The column width, in pixels.\n     *\n     * @attr ref android.R.styleable#GridView_columnWidth\n     */\n    setColumnWidth(columnWidth:number):void  {\n        if (columnWidth != this.mRequestedColumnWidth) {\n            this.mRequestedColumnWidth = columnWidth;\n            this.requestLayoutIfNecessary();\n        }\n    }\n\n    /**\n     * Return the width of a column in the grid.\n     *\n     * <p>This may not be valid yet if a layout is pending.</p>\n     *\n     * @return The column width in pixels\n     *\n     * @see #setColumnWidth(int)\n     * @see #getRequestedColumnWidth()\n     *\n     * @attr ref android.R.styleable#GridView_columnWidth\n     */\n    getColumnWidth():number  {\n        return this.mColumnWidth;\n    }\n\n    /**\n     * Return the requested width of a column in the grid.\n     *\n     * <p>This may not be the actual column width used. Use {@link #getColumnWidth()}\n     * to retrieve the current real width of a column.</p>\n     *\n     * @return The requested column width in pixels\n     *\n     * @see #setColumnWidth(int)\n     * @see #getColumnWidth()\n     *\n     * @attr ref android.R.styleable#GridView_columnWidth\n     */\n    getRequestedColumnWidth():number  {\n        return this.mRequestedColumnWidth;\n    }\n\n    /**\n     * Set the number of columns in the grid\n     *\n     * @param numColumns The desired number of columns.\n     *\n     * @attr ref android.R.styleable#GridView_numColumns\n     */\n    setNumColumns(numColumns:number):void  {\n        if (numColumns != this.mRequestedNumColumns) {\n            this.mRequestedNumColumns = numColumns;\n            this.requestLayoutIfNecessary();\n        }\n    }\n\n    /**\n     * Get the number of columns in the grid. \n     * Returns {@link #AUTO_FIT} if the Grid has never been laid out.\n     *\n     * @attr ref android.R.styleable#GridView_numColumns\n     * \n     * @see #setNumColumns(int)\n     */\n    getNumColumns():number  {\n        return this.mNumColumns;\n    }\n\n    /**\n     * Make sure views are touching the top or bottom edge, as appropriate for\n     * our gravity\n     */\n    private adjustViewsUpOrDown():void  {\n        const childCount:number = this.getChildCount();\n        if (childCount > 0) {\n            let delta:number;\n            let child:View;\n            if (!this.mStackFromBottom) {\n                // Uh-oh -- we came up short. Slide all views up to make them\n                // align with the top\n                child = this.getChildAt(0);\n                delta = child.getTop() - this.mListPadding.top;\n                if (this.mFirstPosition != 0) {\n                    // It's OK to have some space above the first item if it is\n                    // part of the vertical spacing\n                    delta -= this.mVerticalSpacing;\n                }\n                if (delta < 0) {\n                    // We only are looking to see if we are too low, not too high\n                    delta = 0;\n                }\n            } else {\n                // we are too high, slide all views down to align with bottom\n                child = this.getChildAt(childCount - 1);\n                delta = child.getBottom() - (this.getHeight() - this.mListPadding.bottom);\n                if (this.mFirstPosition + childCount < this.mItemCount) {\n                    // It's OK to have some space below the last item if it is\n                    // part of the vertical spacing\n                    delta += this.mVerticalSpacing;\n                }\n                if (delta > 0) {\n                    // We only are looking to see if we are too high, not too low\n                    delta = 0;\n                }\n            }\n            if (delta != 0) {\n                this.offsetChildrenTopAndBottom(-delta);\n            }\n        }\n    }\n\n    protected computeVerticalScrollExtent():number  {\n        const count:number = this.getChildCount();\n        if (count > 0) {\n            const numColumns:number = this.mNumColumns;\n            const rowCount:number = (count + numColumns - 1) / numColumns;\n            let extent:number = rowCount * 100;\n            let view:View = this.getChildAt(0);\n            const top:number = view.getTop();\n            let height:number = view.getHeight();\n            if (height > 0) {\n                extent += (top * 100) / height;\n            }\n            view = this.getChildAt(count - 1);\n            const bottom:number = view.getBottom();\n            height = view.getHeight();\n            if (height > 0) {\n                extent -= ((bottom - this.getHeight()) * 100) / height;\n            }\n            return extent;\n        }\n        return 0;\n    }\n\n    protected computeVerticalScrollOffset():number  {\n        if (this.mFirstPosition >= 0 && this.getChildCount() > 0) {\n            const view:View = this.getChildAt(0);\n            const top:number = view.getTop();\n            let height:number = view.getHeight();\n            if (height > 0) {\n                const numColumns:number = this.mNumColumns;\n                const rowCount:number = (this.mItemCount + numColumns - 1) / numColumns;\n                // In case of stackFromBottom the calculation of whichRow needs\n                // to take into account that counting from the top the first row\n                // might not be entirely filled.\n                const oddItemsOnFirstRow:number = this.isStackFromBottom() ? ((rowCount * numColumns) - this.mItemCount) : 0;\n                const whichRow:number = (this.mFirstPosition + oddItemsOnFirstRow) / numColumns;\n                return Math.max(whichRow * 100 - (top * 100) / height + Math.floor((<number> this.mScrollY / this.getHeight() * rowCount * 100)), 0);\n            }\n        }\n        return 0;\n    }\n\n    protected computeVerticalScrollRange():number  {\n        // TODO: Account for vertical spacing too\n        const numColumns:number = this.mNumColumns;\n        const rowCount:number = (this.mItemCount + numColumns - 1) / numColumns;\n        let result:number = Math.max(rowCount * 100, 0);\n        if (this.mScrollY != 0) {\n            // Compensate for overscroll\n            result += Math.abs(Math.floor((<number> this.mScrollY / this.getHeight() * rowCount * 100)));\n        }\n        return result;\n    }\n}\n}"
  },
  {
    "path": "src/android/widget/HeaderViewListAdapter.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/database/DataSetObserver.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../java/util/ArrayList.ts\"/>\n///<reference path=\"../../android/widget/Adapter.ts\"/>\n///<reference path=\"../../android/widget/AdapterView.ts\"/>\n///<reference path=\"../../android/widget/ListAdapter.ts\"/>\n///<reference path=\"../../android/widget/ListView.ts\"/>\n///<reference path=\"../../android/widget/WrapperListAdapter.ts\"/>\n\nmodule android.widget {\nimport DataSetObserver = android.database.DataSetObserver;\nimport View = android.view.View;\nimport ViewGroup = android.view.ViewGroup;\nimport ArrayList = java.util.ArrayList;\nimport Adapter = android.widget.Adapter;\nimport AdapterView = android.widget.AdapterView;\nimport ListAdapter = android.widget.ListAdapter;\nimport ListView = android.widget.ListView;\nimport WrapperListAdapter = android.widget.WrapperListAdapter;\n/**\n * ListAdapter used when a ListView has header views. This ListAdapter\n * wraps another one and also keeps track of the header views and their\n * associated data objects.\n *<p>This is intended as a base class; you will probably not need to\n * use this class directly in your own code.\n */\nexport class HeaderViewListAdapter implements WrapperListAdapter {\n\n    private mAdapter:ListAdapter;\n\n    // These two ArrayList are assumed to NOT be null.\n    // They are indeed created when declared in ListView and then shared.\n    mHeaderViewInfos:ArrayList<ListView.FixedViewInfo>;\n\n    mFooterViewInfos:ArrayList<ListView.FixedViewInfo>;\n\n    // Used as a placeholder in case the provided info views are indeed null.\n    // Currently only used by some CTS tests, which may be removed.\n    static EMPTY_INFO_LIST:ArrayList<ListView.FixedViewInfo> = new ArrayList<ListView.FixedViewInfo>();\n\n    mAreAllFixedViewsSelectable:boolean;\n\n    private mIsFilterable:boolean;\n\n     constructor(headerViewInfos:ArrayList<ListView.FixedViewInfo>, footerViewInfos:ArrayList<ListView.FixedViewInfo>, adapter:ListAdapter) {\n        this.mAdapter = adapter;\n        this.mIsFilterable = false;//adapter instanceof Filterable;\n        if (headerViewInfos == null) {\n            this.mHeaderViewInfos = HeaderViewListAdapter.EMPTY_INFO_LIST;\n        } else {\n            this.mHeaderViewInfos = headerViewInfos;\n        }\n        if (footerViewInfos == null) {\n            this.mFooterViewInfos = HeaderViewListAdapter.EMPTY_INFO_LIST;\n        } else {\n            this.mFooterViewInfos = footerViewInfos;\n        }\n        this.mAreAllFixedViewsSelectable = this.areAllListInfosSelectable(this.mHeaderViewInfos) && this.areAllListInfosSelectable(this.mFooterViewInfos);\n    }\n\n    getHeadersCount():number  {\n        return this.mHeaderViewInfos.size();\n    }\n\n    getFootersCount():number  {\n        return this.mFooterViewInfos.size();\n    }\n\n    isEmpty():boolean  {\n        return this.mAdapter == null || this.mAdapter.isEmpty();\n    }\n\n    private areAllListInfosSelectable(infos:ArrayList<ListView.FixedViewInfo>):boolean  {\n        if (infos != null) {\n            for (let info of infos.array) {\n                if (!info.isSelectable) {\n                    return false;\n                }\n            }\n        }\n        return true;\n    }\n\n    removeHeader(v:View):boolean  {\n        for (let i:number = 0; i < this.mHeaderViewInfos.size(); i++) {\n            let info:ListView.FixedViewInfo = this.mHeaderViewInfos.get(i);\n            if (info.view == v) {\n                this.mHeaderViewInfos.remove(i);\n                this.mAreAllFixedViewsSelectable = this.areAllListInfosSelectable(this.mHeaderViewInfos) && this.areAllListInfosSelectable(this.mFooterViewInfos);\n                return true;\n            }\n        }\n        return false;\n    }\n\n    removeFooter(v:View):boolean  {\n        for (let i:number = 0; i < this.mFooterViewInfos.size(); i++) {\n            let info:ListView.FixedViewInfo = this.mFooterViewInfos.get(i);\n            if (info.view == v) {\n                this.mFooterViewInfos.remove(i);\n                this.mAreAllFixedViewsSelectable = this.areAllListInfosSelectable(this.mHeaderViewInfos) && this.areAllListInfosSelectable(this.mFooterViewInfos);\n                return true;\n            }\n        }\n        return false;\n    }\n\n    getCount():number  {\n        if (this.mAdapter != null) {\n            return this.getFootersCount() + this.getHeadersCount() + this.mAdapter.getCount();\n        } else {\n            return this.getFootersCount() + this.getHeadersCount();\n        }\n    }\n\n    areAllItemsEnabled():boolean  {\n        if (this.mAdapter != null) {\n            return this.mAreAllFixedViewsSelectable && this.mAdapter.areAllItemsEnabled();\n        } else {\n            return true;\n        }\n    }\n\n    isEnabled(position:number):boolean  {\n        // Header (negative positions will throw an IndexOutOfBoundsException)\n        let numHeaders:number = this.getHeadersCount();\n        if (position < numHeaders) {\n            return this.mHeaderViewInfos.get(position).isSelectable;\n        }\n        // Adapter\n        const adjPosition:number = position - numHeaders;\n        let adapterCount:number = 0;\n        if (this.mAdapter != null) {\n            adapterCount = this.mAdapter.getCount();\n            if (adjPosition < adapterCount) {\n                return this.mAdapter.isEnabled(adjPosition);\n            }\n        }\n        // Footer (off-limits positions will throw an IndexOutOfBoundsException)\n        return this.mFooterViewInfos.get(adjPosition - adapterCount).isSelectable;\n    }\n\n    getItem(position:number):any  {\n        // Header (negative positions will throw an IndexOutOfBoundsException)\n        let numHeaders:number = this.getHeadersCount();\n        if (position < numHeaders) {\n            return this.mHeaderViewInfos.get(position).data;\n        }\n        // Adapter\n        const adjPosition:number = position - numHeaders;\n        let adapterCount:number = 0;\n        if (this.mAdapter != null) {\n            adapterCount = this.mAdapter.getCount();\n            if (adjPosition < adapterCount) {\n                return this.mAdapter.getItem(adjPosition);\n            }\n        }\n        // Footer (off-limits positions will throw an IndexOutOfBoundsException)\n        return this.mFooterViewInfos.get(adjPosition - adapterCount).data;\n    }\n\n    getItemId(position:number):number  {\n        let numHeaders:number = this.getHeadersCount();\n        if (this.mAdapter != null && position >= numHeaders) {\n            let adjPosition:number = position - numHeaders;\n            let adapterCount:number = this.mAdapter.getCount();\n            if (adjPosition < adapterCount) {\n                return this.mAdapter.getItemId(adjPosition);\n            }\n        }\n        return -1;\n    }\n\n    hasStableIds():boolean  {\n        if (this.mAdapter != null) {\n            return this.mAdapter.hasStableIds();\n        }\n        return false;\n    }\n\n    getView(position:number, convertView:View, parent:ViewGroup):View  {\n        // Header (negative positions will throw an IndexOutOfBoundsException)\n        let numHeaders:number = this.getHeadersCount();\n        if (position < numHeaders) {\n            return this.mHeaderViewInfos.get(position).view;\n        }\n        // Adapter\n        const adjPosition:number = position - numHeaders;\n        let adapterCount:number = 0;\n        if (this.mAdapter != null) {\n            adapterCount = this.mAdapter.getCount();\n            if (adjPosition < adapterCount) {\n                return this.mAdapter.getView(adjPosition, convertView, parent);\n            }\n        }\n        // Footer (off-limits positions will throw an IndexOutOfBoundsException)\n        return this.mFooterViewInfos.get(adjPosition - adapterCount).view;\n    }\n\n    getItemViewType(position:number):number  {\n        let numHeaders:number = this.getHeadersCount();\n        if (this.mAdapter != null && position >= numHeaders) {\n            let adjPosition:number = position - numHeaders;\n            let adapterCount:number = this.mAdapter.getCount();\n            if (adjPosition < adapterCount) {\n                return this.mAdapter.getItemViewType(adjPosition);\n            }\n        }\n        return AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER;\n    }\n\n    getViewTypeCount():number  {\n        if (this.mAdapter != null) {\n            return this.mAdapter.getViewTypeCount();\n        }\n        return 1;\n    }\n\n    registerDataSetObserver(observer:DataSetObserver):void  {\n        if (this.mAdapter != null) {\n            this.mAdapter.registerDataSetObserver(observer);\n        }\n    }\n\n    unregisterDataSetObserver(observer:DataSetObserver):void  {\n        if (this.mAdapter != null) {\n            this.mAdapter.unregisterDataSetObserver(observer);\n        }\n    }\n\n    getFilter()  {\n        //if (this.mIsFilterable) {\n        //    return (<Filterable> this.mAdapter).getFilter();\n        //}\n        return null;\n    }\n\n    getWrappedAdapter():ListAdapter  {\n        return this.mAdapter;\n    }\n}\n}"
  },
  {
    "path": "src/android/widget/HeterogeneousExpandableList.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/widget/Adapter.ts\"/>\n///<reference path=\"../../android/widget/AdapterView.ts\"/>\n///<reference path=\"../../android/widget/ExpandableListAdapter.ts\"/>\n///<reference path=\"../../android/widget/ExpandableListView.ts\"/>\n///<reference path=\"../../android/widget/ListAdapter.ts\"/>\n///<reference path=\"../../android/widget/ListView.ts\"/>\n\nmodule android.widget {\nimport View = android.view.View;\nimport ViewGroup = android.view.ViewGroup;\nimport Adapter = android.widget.Adapter;\nimport AdapterView = android.widget.AdapterView;\nimport ExpandableListAdapter = android.widget.ExpandableListAdapter;\nimport ExpandableListView = android.widget.ExpandableListView;\nimport ListAdapter = android.widget.ListAdapter;\nimport ListView = android.widget.ListView;\n/**\n * Additional methods that when implemented make an\n * {@link ExpandableListAdapter} take advantage of the {@link Adapter} view type\n * mechanism.\n * <p>\n * An {@link ExpandableListAdapter} declares it has one view type for its group items\n * and one view type for its child items. Although adapted for most {@link ExpandableListView}s,\n * these values should be tuned for heterogeneous {@link ExpandableListView}s.\n * </p>\n * Lists that contain different types of group and/or child item views, should use an adapter that\n * implements this interface. This way, the recycled views that will be provided to\n * {@link android.widget.ExpandableListAdapter#getGroupView(int, boolean, View, ViewGroup)}\n * and\n * {@link android.widget.ExpandableListAdapter#getChildView(int, int, boolean, View, ViewGroup)}\n * will be of the appropriate group or child type, resulting in a more efficient reuse of the\n * previously created views.\n */\nexport interface HeterogeneousExpandableList {\n\n    /**\n     * Get the type of group View that will be created by\n     * {@link android.widget.ExpandableListAdapter#getGroupView(int, boolean, View, ViewGroup)}\n     * . for the specified group item.\n     * \n     * @param groupPosition the position of the group for which the type should be returned.\n     * @return An integer representing the type of group View. Two group views should share the same\n     *         type if one can be converted to the other in\n     *         {@link android.widget.ExpandableListAdapter#getGroupView(int, boolean, View, ViewGroup)}\n     *         . Note: Integers must be in the range 0 to {@link #getGroupTypeCount} - 1.\n     *         {@link android.widget.Adapter#IGNORE_ITEM_VIEW_TYPE} can also be returned.\n     * @see android.widget.Adapter#IGNORE_ITEM_VIEW_TYPE\n     * @see #getGroupTypeCount()\n     */\n    getGroupType(groupPosition:number):number ;\n\n    /**\n     * Get the type of child View that will be created by\n     * {@link android.widget.ExpandableListAdapter#getChildView(int, int, boolean, View, ViewGroup)}\n     * for the specified child item.\n     * \n     * @param groupPosition the position of the group that the child resides in\n     * @param childPosition the position of the child with respect to other children in the group\n     * @return An integer representing the type of child View. Two child views should share the same\n     *         type if one can be converted to the other in\n     *         {@link android.widget.ExpandableListAdapter#getChildView(int, int, boolean, View, ViewGroup)}\n     *         Note: Integers must be in the range 0 to {@link #getChildTypeCount} - 1.\n     *         {@link android.widget.Adapter#IGNORE_ITEM_VIEW_TYPE} can also be returned.\n     * @see android.widget.Adapter#IGNORE_ITEM_VIEW_TYPE\n     * @see #getChildTypeCount()\n     */\n    getChildType(groupPosition:number, childPosition:number):number ;\n\n    /**\n     * <p>\n     * Returns the number of types of group Views that will be created by\n     * {@link android.widget.ExpandableListAdapter#getGroupView(int, boolean, View, ViewGroup)}\n     * . Each type represents a set of views that can be converted in\n     * {@link android.widget.ExpandableListAdapter#getGroupView(int, boolean, View, ViewGroup)}\n     * . If the adapter always returns the same type of View for all group items, this method should\n     * return 1.\n     * </p>\n     * This method will only be called when the adapter is set on the {@link AdapterView}.\n     * \n     * @return The number of types of group Views that will be created by this adapter.\n     * @see #getChildTypeCount()\n     * @see #getGroupType(int)\n     */\n    getGroupTypeCount():number ;\n\n    /**\n     * <p>\n     * Returns the number of types of child Views that will be created by\n     * {@link android.widget.ExpandableListAdapter#getChildView(int, int, boolean, View, ViewGroup)}\n     * . Each type represents a set of views that can be converted in\n     * {@link android.widget.ExpandableListAdapter#getChildView(int, int, boolean, View, ViewGroup)}\n     * , for any group. If the adapter always returns the same type of View for\n     * all child items, this method should return 1.\n     * </p>\n     * This method will only be called when the adapter is set on the {@link AdapterView}.\n     * \n     * @return The total number of types of child Views that will be created by this adapter.\n     * @see #getGroupTypeCount()\n     * @see #getChildType(int, int)\n     */\n    getChildTypeCount():number ;\n}\n\n    export module HeterogeneousExpandableList{\n        export function isImpl(obj):boolean {\n            return obj && obj['getGroupType'] && obj['getChildType'] && obj['getGroupTypeCount']&& obj['getChildTypeCount'];\n        }\n    }\n}"
  },
  {
    "path": "src/android/widget/HorizontalScrollView.ts",
    "content": "/*\n * Copyright (C) 2009 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/util/Log.ts\"/>\n///<reference path=\"../../android/view/FocusFinder.ts\"/>\n///<reference path=\"../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../android/view/VelocityTracker.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewConfiguration.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/view/ViewParent.ts\"/>\n///<reference path=\"../../android/view/animation/AnimationUtils.ts\"/>\n///<reference path=\"../../java/util/List.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../java/lang/System.ts\"/>\n///<reference path=\"../../android/widget/FrameLayout.ts\"/>\n///<reference path=\"../../android/widget/LinearLayout.ts\"/>\n///<reference path=\"../../android/widget/ListView.ts\"/>\n///<reference path=\"../../android/widget/OverScroller.ts\"/>\n///<reference path=\"../../android/widget/ScrollView.ts\"/>\n///<reference path=\"../../android/widget/TextView.ts\"/>\n\nmodule android.widget {\nimport Canvas = android.graphics.Canvas;\nimport Rect = android.graphics.Rect;\nimport Log = android.util.Log;\nimport FocusFinder = android.view.FocusFinder;\nimport KeyEvent = android.view.KeyEvent;\nimport MotionEvent = android.view.MotionEvent;\nimport VelocityTracker = android.view.VelocityTracker;\nimport View = android.view.View;\nimport ViewConfiguration = android.view.ViewConfiguration;\nimport ViewGroup = android.view.ViewGroup;\nimport ViewParent = android.view.ViewParent;\nimport AnimationUtils = android.view.animation.AnimationUtils;\nimport List = java.util.List;\nimport Integer = java.lang.Integer;\nimport System = java.lang.System;\nimport FrameLayout = android.widget.FrameLayout;\nimport LinearLayout = android.widget.LinearLayout;\nimport ListView = android.widget.ListView;\nimport OverScroller = android.widget.OverScroller;\nimport ScrollView = android.widget.ScrollView;\nimport TextView = android.widget.TextView;\n/**\n * Layout container for a view hierarchy that can be scrolled by the user,\n * allowing it to be larger than the physical display.  A HorizontalScrollView\n * is a {@link FrameLayout}, meaning you should place one child in it\n * containing the entire contents to scroll; this child may itself be a layout\n * manager with a complex hierarchy of objects.  A child that is often used\n * is a {@link LinearLayout} in a horizontal orientation, presenting a horizontal\n * array of top-level items that the user can scroll through.\n *\n * <p>The {@link TextView} class also\n * takes care of its own scrolling, so does not require a HorizontalScrollView, but\n * using the two together is possible to achieve the effect of a text view\n * within a larger container.\n *\n * <p>HorizontalScrollView only supports horizontal scrolling. For vertical scrolling,\n * use either {@link ScrollView} or {@link ListView}.\n *\n * @attr ref android.R.styleable#HorizontalScrollView_fillViewport\n */\nexport class HorizontalScrollView extends FrameLayout {\n\n    private static ANIMATED_SCROLL_GAP:number = ScrollView.ANIMATED_SCROLL_GAP;\n\n    private static MAX_SCROLL_FACTOR:number = ScrollView.MAX_SCROLL_FACTOR;\n\n    private static TAG:string = \"HorizontalScrollView\";\n\n    private mLastScroll:number = 0;\n\n    private mTempRect:Rect = new Rect();\n\n    private mScroller:OverScroller;\n\n    //private mEdgeGlowLeft:EdgeEffect;\n    //\n    //private mEdgeGlowRight:EdgeEffect;\n\n    /**\n     * Position of the last motion event.\n     */\n    private mLastMotionX:number = 0;\n\n    /**\n     * True when the layout has changed but the traversal has not come through yet.\n     * Ideally the view hierarchy would keep track of this for us.\n     */\n    private mIsLayoutDirty:boolean = true;\n\n    /**\n     * The child to give focus to in the event that a child has requested focus while the\n     * layout is dirty. This prevents the scroll from being wrong if the child has not been\n     * laid out before requesting focus.\n     */\n    private mChildToScrollTo:View = null;\n\n    /**\n     * True if the user is currently dragging this ScrollView around. This is\n     * not the same as 'is being flinged', which can be checked by\n     * mScroller.isFinished() (flinging begins when the user lifts his finger).\n     */\n    private mIsBeingDragged:boolean = false;\n\n    /**\n     * Determines speed during touch scrolling\n     */\n    private mVelocityTracker:VelocityTracker;\n\n    /**\n     * When set to true, the scroll view measure its child to make it fill the currently\n     * visible area.\n     */\n    private mFillViewport:boolean;\n\n    /**\n     * Whether arrow scrolling is animated.\n     */\n    private mSmoothScrollingEnabled:boolean = true;\n\n    //private mTouchSlop:number = 0;\n\n    private mMinimumVelocity:number = 0;\n\n    private mMaximumVelocity:number = 0;\n\n    private mOverscrollDistance:number = 0;\n\n    private _mOverflingDistance:number = 0;\n    private get mOverflingDistance():number {\n        if (this.mScrollX < -this._mOverflingDistance) return -this.mScrollX;\n        let overDistance = this.mScrollX - this.getScrollRange();\n        if (overDistance > this._mOverflingDistance) return overDistance;\n        return this._mOverflingDistance;\n    }\n    private set mOverflingDistance(value:number) {\n        this._mOverflingDistance = value;\n    }\n\n    /**\n     * ID of the active pointer. This is used to retain consistency during\n     * drags/flings if multiple pointers are used.\n     */\n    private mActivePointerId:number = HorizontalScrollView.INVALID_POINTER;\n\n    /**\n     * Sentinel value for no current active pointer.\n     * Used by {@link #mActivePointerId}.\n     */\n    private static INVALID_POINTER:number = -1;\n\n    //private mSavedState:HorizontalScrollView.SavedState;\n\n    constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n        super(context, bindElement, defStyle);\n        this.initScrollView();\n        let a = context.obtainStyledAttributes(bindElement, defStyle);\n        this.setFillViewport(a.getBoolean('fillViewport', false));\n        a.recycle();\n    }\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder().set('', {\n            setter(v:HorizontalScrollView, value:any, attrBinder:androidui.attr.AttrBinder) {\n                v.setFillViewport(attrBinder.parseBoolean(value));\n            }, getter(v:HorizontalScrollView) {\n                return v.isFillViewport();\n            }\n        });\n    }\n\n    protected getLeftFadingEdgeStrength():number  {\n        if (this.getChildCount() == 0) {\n            return 0.0;\n        }\n        const length:number = this.getHorizontalFadingEdgeLength();\n        if (this.mScrollX < length) {\n            return this.mScrollX / <number> length;\n        }\n        return 1.0;\n    }\n\n    protected getRightFadingEdgeStrength():number  {\n        if (this.getChildCount() == 0) {\n            return 0.0;\n        }\n        const length:number = this.getHorizontalFadingEdgeLength();\n        const rightEdge:number = this.getWidth() - this.mPaddingRight;\n        const span:number = this.getChildAt(0).getRight() - this.mScrollX - rightEdge;\n        if (span < length) {\n            return span / <number> length;\n        }\n        return 1.0;\n    }\n\n    /**\n     * @return The maximum amount this scroll view will scroll in response to\n     *   an arrow event.\n     */\n    getMaxScrollAmount():number  {\n        return Math.floor((HorizontalScrollView.MAX_SCROLL_FACTOR * (this.mRight - this.mLeft)));\n    }\n\n    private initScrollView():void  {\n        this.mScroller = new OverScroller();\n        this.setFocusable(true);\n        this.setDescendantFocusability(HorizontalScrollView.FOCUS_AFTER_DESCENDANTS);\n        this.setWillNotDraw(false);\n        const configuration:ViewConfiguration = ViewConfiguration.get();\n        this.mTouchSlop = configuration.getScaledTouchSlop();\n        this.mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();\n        this.mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();\n        this.mOverscrollDistance = configuration.getScaledOverscrollDistance();\n        this._mOverflingDistance = configuration.getScaledOverflingDistance();\n\n        this.initScrollCache();\n        this.setHorizontalScrollBarEnabled(true);\n    }\n\n    addView(...args) {\n        if (this.getChildCount() > 0) {\n            throw new Error(\"ScrollView can host only one direct child\");\n        }\n        return super.addView(...args);\n    }\n\n    /**\n     * @return Returns true this HorizontalScrollView can be scrolled\n     */\n    private canScroll():boolean  {\n        let child:View = this.getChildAt(0);\n        if (child != null) {\n            let childWidth:number = child.getWidth();\n            return this.getWidth() < childWidth + this.mPaddingLeft + this.mPaddingRight;\n        }\n        return false;\n    }\n\n    /**\n     * Indicates whether this HorizontalScrollView's content is stretched to\n     * fill the viewport.\n     *\n     * @return True if the content fills the viewport, false otherwise.\n     *\n     * @attr ref android.R.styleable#HorizontalScrollView_fillViewport\n     */\n    isFillViewport():boolean  {\n        return this.mFillViewport;\n    }\n\n    /**\n     * Indicates this HorizontalScrollView whether it should stretch its content width\n     * to fill the viewport or not.\n     *\n     * @param fillViewport True to stretch the content's width to the viewport's\n     *        boundaries, false otherwise.\n     *\n     * @attr ref android.R.styleable#HorizontalScrollView_fillViewport\n     */\n    setFillViewport(fillViewport:boolean):void  {\n        if (fillViewport != this.mFillViewport) {\n            this.mFillViewport = fillViewport;\n            this.requestLayout();\n        }\n    }\n\n    /**\n     * @return Whether arrow scrolling will animate its transition.\n     */\n    isSmoothScrollingEnabled():boolean  {\n        return this.mSmoothScrollingEnabled;\n    }\n\n    /**\n     * Set whether arrow scrolling will animate its transition.\n     * @param smoothScrollingEnabled whether arrow scrolling will animate its transition\n     */\n    setSmoothScrollingEnabled(smoothScrollingEnabled:boolean):void  {\n        this.mSmoothScrollingEnabled = smoothScrollingEnabled;\n    }\n\n    protected onMeasure(widthMeasureSpec:number, heightMeasureSpec:number):void  {\n        super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n        if (!this.mFillViewport) {\n            return;\n        }\n        const widthMode:number = View.MeasureSpec.getMode(widthMeasureSpec);\n        if (widthMode == View.MeasureSpec.UNSPECIFIED) {\n            return;\n        }\n        if (this.getChildCount() > 0) {\n            const child:View = this.getChildAt(0);\n            let width:number = this.getMeasuredWidth();\n            if (child.getMeasuredWidth() < width) {\n                const lp:FrameLayout.LayoutParams = <FrameLayout.LayoutParams> child.getLayoutParams();\n                let childHeightMeasureSpec:number = HorizontalScrollView.getChildMeasureSpec(heightMeasureSpec, this.mPaddingTop + this.mPaddingBottom, lp.height);\n                width -= this.mPaddingLeft;\n                width -= this.mPaddingRight;\n                let childWidthMeasureSpec:number = View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY);\n                child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n            }\n        }\n    }\n\n    dispatchKeyEvent(event:KeyEvent):boolean  {\n        // Let the focused view and/or our descendants get the key first\n        return super.dispatchKeyEvent(event) || this.executeKeyEvent(event);\n    }\n\n    /**\n     * You can call this function yourself to have the scroll view perform\n     * scrolling from a key event, just as if the event had been dispatched to\n     * it by the view hierarchy.\n     *\n     * @param event The key event to execute.\n     * @return Return true if the event was handled, else false.\n     */\n    executeKeyEvent(event:KeyEvent):boolean  {\n        this.mTempRect.setEmpty();\n        if (!this.canScroll()) {\n            if (this.isFocused()) {\n                let currentFocused:View = this.findFocus();\n                if (currentFocused == this)\n                    currentFocused = null;\n                let nextFocused:View = FocusFinder.getInstance().findNextFocus(this, currentFocused, View.FOCUS_RIGHT);\n                return nextFocused != null && nextFocused != this && nextFocused.requestFocus(View.FOCUS_RIGHT);\n            }\n            return false;\n        }\n        let handled:boolean = false;\n        if (event.getAction() == KeyEvent.ACTION_DOWN) {\n            switch(event.getKeyCode()) {\n                case KeyEvent.KEYCODE_DPAD_LEFT:\n                    if (!event.isAltPressed()) {\n                        handled = this.arrowScroll(View.FOCUS_LEFT);\n                    } else {\n                        handled = this.fullScroll(View.FOCUS_LEFT);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_DPAD_RIGHT:\n                    if (!event.isAltPressed()) {\n                        handled = this.arrowScroll(View.FOCUS_RIGHT);\n                    } else {\n                        handled = this.fullScroll(View.FOCUS_RIGHT);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_SPACE:\n                    this.pageScroll(event.isShiftPressed() ? View.FOCUS_LEFT : View.FOCUS_RIGHT);\n                    break;\n            }\n        }\n        return handled;\n    }\n\n    private inChild(x:number, y:number):boolean  {\n        if (this.getChildCount() > 0) {\n            const scrollX:number = this.mScrollX;\n            const child:View = this.getChildAt(0);\n            return !(y < child.getTop() || y >= child.getBottom() || x < child.getLeft() - scrollX || x >= child.getRight() - scrollX);\n        }\n        return false;\n    }\n\n    private initOrResetVelocityTracker():void  {\n        if (this.mVelocityTracker == null) {\n            this.mVelocityTracker = VelocityTracker.obtain();\n        } else {\n            this.mVelocityTracker.clear();\n        }\n    }\n\n    private initVelocityTrackerIfNotExists():void  {\n        if (this.mVelocityTracker == null) {\n            this.mVelocityTracker = VelocityTracker.obtain();\n        }\n    }\n\n    private recycleVelocityTracker():void  {\n        if (this.mVelocityTracker != null) {\n            this.mVelocityTracker.recycle();\n            this.mVelocityTracker = null;\n        }\n    }\n\n    requestDisallowInterceptTouchEvent(disallowIntercept:boolean):void  {\n        if (disallowIntercept) {\n            this.recycleVelocityTracker();\n        }\n        super.requestDisallowInterceptTouchEvent(disallowIntercept);\n    }\n\n    onInterceptTouchEvent(ev:MotionEvent):boolean  {\n        /*\n         * This method JUST determines whether we want to intercept the motion.\n         * If we return true, onMotionEvent will be called and we do the actual\n         * scrolling there.\n         */\n        /*\n        * Shortcut the most recurring case: the user is in the dragging\n        * state and he is moving his finger.  We want to intercept this\n        * motion.\n        */\n        const action:number = ev.getAction();\n        if ((action == MotionEvent.ACTION_MOVE) && (this.mIsBeingDragged)) {\n            return true;\n        }\n        switch(action & MotionEvent.ACTION_MASK) {\n            case MotionEvent.ACTION_MOVE:\n                {\n                    /*\n                 * mIsBeingDragged == false, otherwise the shortcut would have caught it. Check\n                 * whether the user has moved far enough from his original down touch.\n                 */\n                    /*\n                * Locally do absolute value. mLastMotionX is set to the x value\n                * of the down event.\n                */\n                    const activePointerId:number = this.mActivePointerId;\n                    if (activePointerId == HorizontalScrollView.INVALID_POINTER) {\n                        // If we don't have a valid id, the touch down wasn't on content.\n                        break;\n                    }\n                    const pointerIndex:number = ev.findPointerIndex(activePointerId);\n                    if (pointerIndex == -1) {\n                        Log.e(HorizontalScrollView.TAG, \"Invalid pointerId=\" + activePointerId + \" in onInterceptTouchEvent\");\n                        break;\n                    }\n                    const x:number = Math.floor(ev.getX(pointerIndex));\n                    const xDiff:number = Math.floor(Math.abs(x - this.mLastMotionX));\n                    if (xDiff > this.mTouchSlop) {\n                        this.mIsBeingDragged = true;\n                        this.mLastMotionX = x;\n                        this.initVelocityTrackerIfNotExists();\n                        this.mVelocityTracker.addMovement(ev);\n                        if (this.mParent != null)\n                            this.mParent.requestDisallowInterceptTouchEvent(true);\n                    }\n                    break;\n                }\n            case MotionEvent.ACTION_DOWN:\n                {\n                    const x:number = Math.floor(ev.getX());\n                    if (!this.inChild(Math.floor(x), Math.floor(ev.getY()))) {\n                        this.mIsBeingDragged = false;\n                        this.recycleVelocityTracker();\n                        break;\n                    }\n                    /*\n                 * Remember location of down touch.\n                 * ACTION_DOWN always refers to pointer index 0.\n                 */\n                    this.mLastMotionX = x;\n                    this.mActivePointerId = ev.getPointerId(0);\n                    this.initOrResetVelocityTracker();\n                    this.mVelocityTracker.addMovement(ev);\n                    /*\n                * If being flinged and user touches the screen, initiate drag;\n                * otherwise don't.  mScroller.isFinished should be false when\n                * being flinged.\n                */\n                    this.mIsBeingDragged = !this.mScroller.isFinished();\n                    break;\n                }\n            case MotionEvent.ACTION_CANCEL:\n            case MotionEvent.ACTION_UP:\n                /* Release the drag */\n                this.mIsBeingDragged = false;\n                this.mActivePointerId = HorizontalScrollView.INVALID_POINTER;\n                if (this.mScroller.springBack(this.mScrollX, this.mScrollY, 0, this.getScrollRange(), 0, 0)) {\n                    this.postInvalidateOnAnimation();\n                }\n                break;\n            case MotionEvent.ACTION_POINTER_DOWN:\n                {\n                    const index:number = ev.getActionIndex();\n                    this.mLastMotionX = Math.floor(ev.getX(index));\n                    this.mActivePointerId = ev.getPointerId(index);\n                    break;\n                }\n            case MotionEvent.ACTION_POINTER_UP:\n                this.onSecondaryPointerUp(ev);\n                this.mLastMotionX = Math.floor(ev.getX(ev.findPointerIndex(this.mActivePointerId)));\n                break;\n        }\n        /*\n        * The only time we want to intercept motion events is if we are in the\n        * drag mode.\n        */\n        return this.mIsBeingDragged;\n    }\n\n    onTouchEvent(ev:MotionEvent):boolean  {\n        this.initVelocityTrackerIfNotExists();\n        this.mVelocityTracker.addMovement(ev);\n        const action:number = ev.getAction();\n        switch(action & MotionEvent.ACTION_MASK) {\n            case MotionEvent.ACTION_DOWN:\n                {\n                    if (this.getChildCount() == 0) {\n                        return false;\n                    }\n                    if ((this.mIsBeingDragged = !this.mScroller.isFinished())) {\n                        const parent:ViewParent = this.getParent();\n                        if (parent != null) {\n                            parent.requestDisallowInterceptTouchEvent(true);\n                        }\n                    }\n                    /*\n                 * If being flinged and user touches, stop the fling. isFinished\n                 * will be false if being flinged.\n                 */\n                    if (!this.mScroller.isFinished()) {\n                        this.mScroller.abortAnimation();\n                    }\n                    // Remember where the motion event started\n                    this.mLastMotionX = Math.floor(ev.getX());\n                    this.mActivePointerId = ev.getPointerId(0);\n                    break;\n                }\n            case MotionEvent.ACTION_MOVE:\n                const activePointerIndex:number = ev.findPointerIndex(this.mActivePointerId);\n                if (activePointerIndex == -1) {\n                    Log.e(HorizontalScrollView.TAG, \"Invalid pointerId=\" + this.mActivePointerId + \" in onTouchEvent\");\n                    break;\n                }\n                const x:number = Math.floor(ev.getX(activePointerIndex));\n                let deltaX:number = this.mLastMotionX - x;\n                if (!this.mIsBeingDragged && Math.abs(deltaX) > this.mTouchSlop) {\n                    const parent:ViewParent = this.getParent();\n                    if (parent != null) {\n                        parent.requestDisallowInterceptTouchEvent(true);\n                    }\n                    this.mIsBeingDragged = true;\n                    if (deltaX > 0) {\n                        deltaX -= this.mTouchSlop;\n                    } else {\n                        deltaX += this.mTouchSlop;\n                    }\n                }\n                if (this.mIsBeingDragged) {\n                    // Scroll to follow the motion event\n                    this.mLastMotionX = x;\n                    const oldX:number = this.mScrollX;\n                    const oldY:number = this.mScrollY;\n                    const range:number = this.getScrollRange();\n                    const overscrollMode:number = this.getOverScrollMode();\n                    const canOverscroll:boolean = overscrollMode == HorizontalScrollView.OVER_SCROLL_ALWAYS || (overscrollMode == HorizontalScrollView.OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0);\n                    // calls onScrollChanged if applicable.\n                    if (this.overScrollBy(deltaX, 0, this.mScrollX, 0, range, 0, this.mOverscrollDistance, 0, true)) {\n                        // Break our velocity if we hit a scroll barrier.\n                        this.mVelocityTracker.clear();\n                    }\n                    if (canOverscroll) {\n                        //const pulledToX:number = oldX + deltaX;\n                        //if (pulledToX < 0) {\n                        //    this.mEdgeGlowLeft.onPull(<number> deltaX / this.getWidth());\n                        //    if (!this.mEdgeGlowRight.isFinished()) {\n                        //        this.mEdgeGlowRight.onRelease();\n                        //    }\n                        //} else if (pulledToX > range) {\n                        //    this.mEdgeGlowRight.onPull(<number> deltaX / this.getWidth());\n                        //    if (!this.mEdgeGlowLeft.isFinished()) {\n                        //        this.mEdgeGlowLeft.onRelease();\n                        //    }\n                        //}\n                        //if (this.mEdgeGlowLeft != null && (!this.mEdgeGlowLeft.isFinished() || !this.mEdgeGlowRight.isFinished())) {\n                        //    this.postInvalidateOnAnimation();\n                        //}\n                    }\n                }\n                break;\n            case MotionEvent.ACTION_UP:\n                if (this.mIsBeingDragged) {\n                    const velocityTracker:VelocityTracker = this.mVelocityTracker;\n                    velocityTracker.computeCurrentVelocity(1000, this.mMaximumVelocity);\n                    let initialVelocity:number = Math.floor(velocityTracker.getXVelocity(this.mActivePointerId));\n                    if (this.getChildCount() > 0) {\n                        let isOverDrag = this.mScrollX < 0 || this.mScrollX > this.getScrollRange();\n                        if (!isOverDrag && (Math.abs(initialVelocity) > this.mMinimumVelocity)) {\n                            this.fling(-initialVelocity);\n                        } else {\n                            if (this.mScroller.springBack(this.mScrollX, this.mScrollY, 0, this.getScrollRange(), 0, 0)) {\n                                this.postInvalidateOnAnimation();\n                            }\n                        }\n                    }\n                    this.mActivePointerId = HorizontalScrollView.INVALID_POINTER;\n                    this.mIsBeingDragged = false;\n                    this.recycleVelocityTracker();\n                    //if (this.mEdgeGlowLeft != null) {\n                    //    this.mEdgeGlowLeft.onRelease();\n                    //    this.mEdgeGlowRight.onRelease();\n                    //}\n                }\n                break;\n            case MotionEvent.ACTION_CANCEL:\n                if (this.mIsBeingDragged && this.getChildCount() > 0) {\n                    if (this.mScroller.springBack(this.mScrollX, this.mScrollY, 0, this.getScrollRange(), 0, 0)) {\n                        this.postInvalidateOnAnimation();\n                    }\n                    this.mActivePointerId = HorizontalScrollView.INVALID_POINTER;\n                    this.mIsBeingDragged = false;\n                    this.recycleVelocityTracker();\n                    //if (this.mEdgeGlowLeft != null) {\n                    //    this.mEdgeGlowLeft.onRelease();\n                    //    this.mEdgeGlowRight.onRelease();\n                    //}\n                }\n                break;\n            case MotionEvent.ACTION_POINTER_UP:\n                this.onSecondaryPointerUp(ev);\n                break;\n        }\n        return true;\n    }\n\n    private onSecondaryPointerUp(ev:MotionEvent):void  {\n        const pointerIndex:number = (ev.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;\n        const pointerId:number = ev.getPointerId(pointerIndex);\n        if (pointerId == this.mActivePointerId) {\n            // This was our active pointer going up. Choose a new\n            // active pointer and adjust accordingly.\n            // TODO: Make this decision more intelligent.\n            const newPointerIndex:number = pointerIndex == 0 ? 1 : 0;\n            this.mLastMotionX = Math.floor(ev.getX(newPointerIndex));\n            this.mActivePointerId = ev.getPointerId(newPointerIndex);\n            if (this.mVelocityTracker != null) {\n                this.mVelocityTracker.clear();\n            }\n        }\n    }\n\n    onGenericMotionEvent(event:MotionEvent):boolean  {\n        if (event.isPointerEvent()) {\n            switch(event.getAction()) {\n                case MotionEvent.ACTION_SCROLL:\n                    {\n                        if (!this.mIsBeingDragged) {\n                            let hscroll:number;\n                            //if ((event.getMetaState() & KeyEvent.META_SHIFT_ON) != 0) {\n                               hscroll = -event.getAxisValue(MotionEvent.AXIS_VSCROLL);\n                            //} else {\n                            //     hscroll = event.getAxisValue(MotionEvent.AXIS_HSCROLL);\n                            //}\n                            if (hscroll != 0) {\n                                const delta:number = Math.floor((hscroll * this.getHorizontalScrollFactor()));\n                                const range:number = this.getScrollRange();\n                                let oldScrollX:number = this.mScrollX;\n                                let newScrollX:number = oldScrollX + delta;\n                                if (newScrollX < 0) {\n                                    newScrollX = 0;\n                                } else if (newScrollX > range) {\n                                    newScrollX = range;\n                                }\n                                if (newScrollX != oldScrollX) {\n                                    super.scrollTo(newScrollX, this.mScrollY);\n                                    return true;\n                                }\n                            }\n                        }\n                    }\n            }\n        }\n        return super.onGenericMotionEvent(event);\n    }\n\n    shouldDelayChildPressedState():boolean  {\n        return true;\n    }\n\n    protected onOverScrolled(scrollX:number, scrollY:number, clampedX:boolean, clampedY:boolean):void  {\n        // Treat animating scrolls differently; see #computeScroll() for why.\n        if (!this.mScroller.isFinished()) {\n            const oldX:number = this.mScrollX;\n            const oldY:number = this.mScrollY;\n            this.mScrollX = scrollX;\n            this.mScrollY = scrollY;\n            this.invalidateParentIfNeeded();\n            this.onScrollChanged(this.mScrollX, this.mScrollY, oldX, oldY);\n            if (clampedX) {\n                this.mScroller.springBack(this.mScrollX, this.mScrollY, 0, this.getScrollRange(), 0, 0);\n            }\n        } else {\n            super.scrollTo(scrollX, scrollY);\n        }\n        this.awakenScrollBars();\n    }\n\n    //performAccessibilityAction(action:number, arguments:Bundle):boolean  {\n    //    if (super.performAccessibilityAction(action, arguments)) {\n    //        return true;\n    //    }\n    //    switch(action) {\n    //        case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD:\n    //            {\n    //                if (!this.isEnabled()) {\n    //                    return false;\n    //                }\n    //                const viewportWidth:number = this.getWidth() - this.mPaddingLeft - this.mPaddingRight;\n    //                const targetScrollX:number = Math.min(this.mScrollX + viewportWidth, this.getScrollRange());\n    //                if (targetScrollX != this.mScrollX) {\n    //                    this.smoothScrollTo(targetScrollX, 0);\n    //                    return true;\n    //                }\n    //            }\n    //            return false;\n    //        case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD:\n    //            {\n    //                if (!this.isEnabled()) {\n    //                    return false;\n    //                }\n    //                const viewportWidth:number = this.getWidth() - this.mPaddingLeft - this.mPaddingRight;\n    //                const targetScrollX:number = Math.max(0, this.mScrollX - viewportWidth);\n    //                if (targetScrollX != this.mScrollX) {\n    //                    this.smoothScrollTo(targetScrollX, 0);\n    //                    return true;\n    //                }\n    //            }\n    //            return false;\n    //    }\n    //    return false;\n    //}\n    //\n    //onInitializeAccessibilityNodeInfo(info:AccessibilityNodeInfo):void  {\n    //    super.onInitializeAccessibilityNodeInfo(info);\n    //    info.setClassName(HorizontalScrollView.class.getName());\n    //    const scrollRange:number = this.getScrollRange();\n    //    if (scrollRange > 0) {\n    //        info.setScrollable(true);\n    //        if (this.isEnabled() && this.mScrollX > 0) {\n    //            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);\n    //        }\n    //        if (this.isEnabled() && this.mScrollX < scrollRange) {\n    //            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);\n    //        }\n    //    }\n    //}\n    //\n    //onInitializeAccessibilityEvent(event:AccessibilityEvent):void  {\n    //    super.onInitializeAccessibilityEvent(event);\n    //    event.setClassName(HorizontalScrollView.class.getName());\n    //    event.setScrollable(this.getScrollRange() > 0);\n    //    event.setScrollX(this.mScrollX);\n    //    event.setScrollY(this.mScrollY);\n    //    event.setMaxScrollX(this.getScrollRange());\n    //    event.setMaxScrollY(this.mScrollY);\n    //}\n\n    private getScrollRange():number  {\n        let scrollRange:number = 0;\n        if (this.getChildCount() > 0) {\n            let child:View = this.getChildAt(0);\n            scrollRange = Math.max(0, child.getWidth() - (this.getWidth() - this.mPaddingLeft - this.mPaddingRight));\n        }\n        return scrollRange;\n    }\n\n    /**\n     * <p>\n     * Finds the next focusable component that fits in this View's bounds\n     * (excluding fading edges) pretending that this View's left is located at\n     * the parameter left.\n     * </p>\n     *\n     * @param leftFocus          look for a candidate is the one at the left of the bounds\n     *                           if leftFocus is true, or at the right of the bounds if leftFocus\n     *                           is false\n     * @param left               the left offset of the bounds in which a focusable must be\n     *                           found (the fading edge is assumed to start at this position)\n     * @param preferredFocusable the View that has highest priority and will be\n     *                           returned if it is within my bounds (null is valid)\n     * @return the next focusable component in the bounds or null if none can be found\n     */\n    private findFocusableViewInMyBounds(leftFocus:boolean, left:number, preferredFocusable:View):View  {\n        /*\n         * The fading edge's transparent side should be considered for focus\n         * since it's mostly visible, so we divide the actual fading edge length\n         * by 2.\n         */\n        const fadingEdgeLength:number = this.getHorizontalFadingEdgeLength() / 2;\n        const leftWithoutFadingEdge:number = left + fadingEdgeLength;\n        const rightWithoutFadingEdge:number = left + this.getWidth() - fadingEdgeLength;\n        if ((preferredFocusable != null) && (preferredFocusable.getLeft() < rightWithoutFadingEdge) && (preferredFocusable.getRight() > leftWithoutFadingEdge)) {\n            return preferredFocusable;\n        }\n        return this.findFocusableViewInBounds(leftFocus, leftWithoutFadingEdge, rightWithoutFadingEdge);\n    }\n\n    /**\n     * <p>\n     * Finds the next focusable component that fits in the specified bounds.\n     * </p>\n     *\n     * @param leftFocus look for a candidate is the one at the left of the bounds\n     *                  if leftFocus is true, or at the right of the bounds if\n     *                  leftFocus is false\n     * @param left      the left offset of the bounds in which a focusable must be\n     *                  found\n     * @param right     the right offset of the bounds in which a focusable must\n     *                  be found\n     * @return the next focusable component in the bounds or null if none can\n     *         be found\n     */\n    private findFocusableViewInBounds(leftFocus:boolean, left:number, right:number):View  {\n        let focusables:List<View> = this.getFocusables(View.FOCUS_FORWARD);\n        let focusCandidate:View = null;\n        /*\n         * A fully contained focusable is one where its left is below the bound's\n         * left, and its right is above the bound's right. A partially\n         * contained focusable is one where some part of it is within the\n         * bounds, but it also has some part that is not within bounds.  A fully contained\n         * focusable is preferred to a partially contained focusable.\n         */\n        let foundFullyContainedFocusable:boolean = false;\n        let count:number = focusables.size();\n        for (let i:number = 0; i < count; i++) {\n            let view:View = focusables.get(i);\n            let viewLeft:number = view.getLeft();\n            let viewRight:number = view.getRight();\n            if (left < viewRight && viewLeft < right) {\n                /*\n                 * the focusable is in the target area, it is a candidate for\n                 * focusing\n                 */\n                const viewIsFullyContained:boolean = (left < viewLeft) && (viewRight < right);\n                if (focusCandidate == null) {\n                    /* No candidate, take this one */\n                    focusCandidate = view;\n                    foundFullyContainedFocusable = viewIsFullyContained;\n                } else {\n                    const viewIsCloserToBoundary:boolean = (leftFocus && viewLeft < focusCandidate.getLeft()) || (!leftFocus && viewRight > focusCandidate.getRight());\n                    if (foundFullyContainedFocusable) {\n                        if (viewIsFullyContained && viewIsCloserToBoundary) {\n                            /*\n                             * We're dealing with only fully contained views, so\n                             * it has to be closer to the boundary to beat our\n                             * candidate\n                             */\n                            focusCandidate = view;\n                        }\n                    } else {\n                        if (viewIsFullyContained) {\n                            /* Any fully contained view beats a partially contained view */\n                            focusCandidate = view;\n                            foundFullyContainedFocusable = true;\n                        } else if (viewIsCloserToBoundary) {\n                            /*\n                             * Partially contained view beats another partially\n                             * contained view if it's closer\n                             */\n                            focusCandidate = view;\n                        }\n                    }\n                }\n            }\n        }\n        return focusCandidate;\n    }\n\n    /**\n     * <p>Handles scrolling in response to a \"page up/down\" shortcut press. This\n     * method will scroll the view by one page left or right and give the focus\n     * to the leftmost/rightmost component in the new visible area. If no\n     * component is a good candidate for focus, this scrollview reclaims the\n     * focus.</p>\n     *\n     * @param direction the scroll direction: {@link android.view.View#FOCUS_LEFT}\n     *                  to go one page left or {@link android.view.View#FOCUS_RIGHT}\n     *                  to go one page right\n     * @return true if the key event is consumed by this method, false otherwise\n     */\n    pageScroll(direction:number):boolean  {\n        let right:boolean = direction == View.FOCUS_RIGHT;\n        let width:number = this.getWidth();\n        if (right) {\n            this.mTempRect.left = this.getScrollX() + width;\n            let count:number = this.getChildCount();\n            if (count > 0) {\n                let view:View = this.getChildAt(0);\n                if (this.mTempRect.left + width > view.getRight()) {\n                    this.mTempRect.left = view.getRight() - width;\n                }\n            }\n        } else {\n            this.mTempRect.left = this.getScrollX() - width;\n            if (this.mTempRect.left < 0) {\n                this.mTempRect.left = 0;\n            }\n        }\n        this.mTempRect.right = this.mTempRect.left + width;\n        return this.scrollAndFocus(direction, this.mTempRect.left, this.mTempRect.right);\n    }\n\n    /**\n     * <p>Handles scrolling in response to a \"home/end\" shortcut press. This\n     * method will scroll the view to the left or right and give the focus\n     * to the leftmost/rightmost component in the new visible area. If no\n     * component is a good candidate for focus, this scrollview reclaims the\n     * focus.</p>\n     *\n     * @param direction the scroll direction: {@link android.view.View#FOCUS_LEFT}\n     *                  to go the left of the view or {@link android.view.View#FOCUS_RIGHT}\n     *                  to go the right\n     * @return true if the key event is consumed by this method, false otherwise\n     */\n    fullScroll(direction:number):boolean  {\n        let right:boolean = direction == View.FOCUS_RIGHT;\n        let width:number = this.getWidth();\n        this.mTempRect.left = 0;\n        this.mTempRect.right = width;\n        if (right) {\n            let count:number = this.getChildCount();\n            if (count > 0) {\n                let view:View = this.getChildAt(0);\n                this.mTempRect.right = view.getRight();\n                this.mTempRect.left = this.mTempRect.right - width;\n            }\n        }\n        return this.scrollAndFocus(direction, this.mTempRect.left, this.mTempRect.right);\n    }\n\n    /**\n     * <p>Scrolls the view to make the area defined by <code>left</code> and\n     * <code>right</code> visible. This method attempts to give the focus\n     * to a component visible in this area. If no component can be focused in\n     * the new visible area, the focus is reclaimed by this scrollview.</p>\n     *\n     * @param direction the scroll direction: {@link android.view.View#FOCUS_LEFT}\n     *                  to go left {@link android.view.View#FOCUS_RIGHT} to right\n     * @param left     the left offset of the new area to be made visible\n     * @param right    the right offset of the new area to be made visible\n     * @return true if the key event is consumed by this method, false otherwise\n     */\n    private scrollAndFocus(direction:number, left:number, right:number):boolean  {\n        let handled:boolean = true;\n        let width:number = this.getWidth();\n        let containerLeft:number = this.getScrollX();\n        let containerRight:number = containerLeft + width;\n        let goLeft:boolean = direction == View.FOCUS_LEFT;\n        let newFocused:View = this.findFocusableViewInBounds(goLeft, left, right);\n        if (newFocused == null) {\n            newFocused = this;\n        }\n        if (left >= containerLeft && right <= containerRight) {\n            handled = false;\n        } else {\n            let delta:number = goLeft ? (left - containerLeft) : (right - containerRight);\n            this.doScrollX(delta);\n        }\n        if (newFocused != this.findFocus())\n            newFocused.requestFocus(direction);\n        return handled;\n    }\n\n    /**\n     * Handle scrolling in response to a left or right arrow click.\n     *\n     * @param direction The direction corresponding to the arrow key that was\n     *                  pressed\n     * @return True if we consumed the event, false otherwise\n     */\n    arrowScroll(direction:number):boolean  {\n        let currentFocused:View = this.findFocus();\n        if (currentFocused == this)\n            currentFocused = null;\n        let nextFocused:View = FocusFinder.getInstance().findNextFocus(this, currentFocused, direction);\n        const maxJump:number = this.getMaxScrollAmount();\n        if (nextFocused != null && this.isWithinDeltaOfScreen(nextFocused, maxJump)) {\n            nextFocused.getDrawingRect(this.mTempRect);\n            this.offsetDescendantRectToMyCoords(nextFocused, this.mTempRect);\n            let scrollDelta:number = this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);\n            this.doScrollX(scrollDelta);\n            nextFocused.requestFocus(direction);\n        } else {\n            // no new focus\n            let scrollDelta:number = maxJump;\n            if (direction == View.FOCUS_LEFT && this.getScrollX() < scrollDelta) {\n                scrollDelta = this.getScrollX();\n            } else if (direction == View.FOCUS_RIGHT && this.getChildCount() > 0) {\n                let daRight:number = this.getChildAt(0).getRight();\n                let screenRight:number = this.getScrollX() + this.getWidth();\n                if (daRight - screenRight < maxJump) {\n                    scrollDelta = daRight - screenRight;\n                }\n            }\n            if (scrollDelta == 0) {\n                return false;\n            }\n            this.doScrollX(direction == View.FOCUS_RIGHT ? scrollDelta : -scrollDelta);\n        }\n        if (currentFocused != null && currentFocused.isFocused() && this.isOffScreen(currentFocused)) {\n            // previously focused item still has focus and is off screen, give\n            // it up (take it back to ourselves)\n            // (also, need to temporarily force FOCUS_BEFORE_DESCENDANTS so we are\n            // sure to\n            // get it)\n            // save\n            const descendantFocusability:number = this.getDescendantFocusability();\n            this.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);\n            this.requestFocus();\n            // restore\n            this.setDescendantFocusability(descendantFocusability);\n        }\n        return true;\n    }\n\n    /**\n     * @return whether the descendant of this scroll view is scrolled off\n     *  screen.\n     */\n    private isOffScreen(descendant:View):boolean  {\n        return !this.isWithinDeltaOfScreen(descendant, 0);\n    }\n\n    /**\n     * @return whether the descendant of this scroll view is within delta\n     *  pixels of being on the screen.\n     */\n    private isWithinDeltaOfScreen(descendant:View, delta:number):boolean  {\n        descendant.getDrawingRect(this.mTempRect);\n        this.offsetDescendantRectToMyCoords(descendant, this.mTempRect);\n        return (this.mTempRect.right + delta) >= this.getScrollX() && (this.mTempRect.left - delta) <= (this.getScrollX() + this.getWidth());\n    }\n\n    /**\n     * Smooth scroll by a X delta\n     *\n     * @param delta the number of pixels to scroll by on the X axis\n     */\n    private doScrollX(delta:number):void  {\n        if (delta != 0) {\n            if (this.mSmoothScrollingEnabled) {\n                this.smoothScrollBy(delta, 0);\n            } else {\n                this.scrollBy(delta, 0);\n            }\n        }\n    }\n\n    /**\n     * Like {@link View#scrollBy}, but scroll smoothly instead of immediately.\n     *\n     * @param dx the number of pixels to scroll by on the X axis\n     * @param dy the number of pixels to scroll by on the Y axis\n     */\n    smoothScrollBy(dx:number, dy:number):void  {\n        if (this.getChildCount() == 0) {\n            // Nothing to do.\n            return;\n        }\n        let duration:number = AnimationUtils.currentAnimationTimeMillis() - this.mLastScroll;\n        if (duration > HorizontalScrollView.ANIMATED_SCROLL_GAP) {\n            const width:number = this.getWidth() - this.mPaddingRight - this.mPaddingLeft;\n            const right:number = this.getChildAt(0).getWidth();\n            const maxX:number = Math.max(0, right - width);\n            const scrollX:number = this.mScrollX;\n            dx = Math.max(0, Math.min(scrollX + dx, maxX)) - scrollX;\n            this.mScroller.startScroll(scrollX, this.mScrollY, dx, 0);\n            this.postInvalidateOnAnimation();\n        } else {\n            if (!this.mScroller.isFinished()) {\n                this.mScroller.abortAnimation();\n            }\n            this.scrollBy(dx, dy);\n        }\n        this.mLastScroll = AnimationUtils.currentAnimationTimeMillis();\n    }\n\n    /**\n     * Like {@link #scrollTo}, but scroll smoothly instead of immediately.\n     *\n     * @param x the position where to scroll on the X axis\n     * @param y the position where to scroll on the Y axis\n     */\n    smoothScrollTo(x:number, y:number):void  {\n        this.smoothScrollBy(x - this.mScrollX, y - this.mScrollY);\n    }\n\n    /**\n     * <p>The scroll range of a scroll view is the overall width of all of its\n     * children.</p>\n     */\n    protected computeHorizontalScrollRange():number  {\n        const count:number = this.getChildCount();\n        const contentWidth:number = this.getWidth() - this.mPaddingLeft - this.mPaddingRight;\n        if (count == 0) {\n            return contentWidth;\n        }\n        let scrollRange:number = this.getChildAt(0).getRight();\n        const scrollX:number = this.mScrollX;\n        const overscrollRight:number = Math.max(0, scrollRange - contentWidth);\n        if (scrollX < 0) {\n            scrollRange -= scrollX;\n        } else if (scrollX > overscrollRight) {\n            scrollRange += scrollX - overscrollRight;\n        }\n        return scrollRange;\n    }\n\n    protected computeHorizontalScrollOffset():number  {\n        return Math.max(0, super.computeHorizontalScrollOffset());\n    }\n\n    protected measureChild(child:View, parentWidthMeasureSpec:number, parentHeightMeasureSpec:number):void  {\n        let lp:ViewGroup.LayoutParams = child.getLayoutParams();\n        let childWidthMeasureSpec:number;\n        let childHeightMeasureSpec:number;\n        childHeightMeasureSpec = HorizontalScrollView.getChildMeasureSpec(parentHeightMeasureSpec, this.mPaddingTop + this.mPaddingBottom, lp.height);\n        childWidthMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n        child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n    }\n\n    protected measureChildWithMargins(child:View, parentWidthMeasureSpec:number, widthUsed:number, parentHeightMeasureSpec:number, heightUsed:number):void  {\n        const lp:ViewGroup.MarginLayoutParams = <ViewGroup.MarginLayoutParams> child.getLayoutParams();\n        const childHeightMeasureSpec:number = HorizontalScrollView.getChildMeasureSpec(parentHeightMeasureSpec, this.mPaddingTop + this.mPaddingBottom + lp.topMargin + lp.bottomMargin + heightUsed, lp.height);\n        const childWidthMeasureSpec:number = View.MeasureSpec.makeMeasureSpec(lp.leftMargin + lp.rightMargin, View.MeasureSpec.UNSPECIFIED);\n        child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n    }\n\n    computeScroll():void  {\n        if (this.mScroller.computeScrollOffset()) {\n            // This is called at drawing time by ViewGroup.  We don't want to\n            // re-show the scrollbars at this point, which scrollTo will do,\n            // so we replicate most of scrollTo here.\n            //\n            //         It's a little odd to call onScrollChanged from inside the drawing.\n            //\n            //         It is, except when you remember that computeScroll() is used to\n            //         animate scrolling. So unless we want to defer the onScrollChanged()\n            //         until the end of the animated scrolling, we don't really have a\n            //         choice here.\n            //\n            //         I agree.  The alternative, which I think would be worse, is to post\n            //         something and tell the subclasses later.  This is bad because there\n            //         will be a window where mScrollX/Y is different from what the app\n            //         thinks it is.\n            //\n            let oldX:number = this.mScrollX;\n            let oldY:number = this.mScrollY;\n            let x:number = this.mScroller.getCurrX();\n            let y:number = this.mScroller.getCurrY();\n            if (oldX != x || oldY != y) {\n                const range:number = this.getScrollRange();\n                const overscrollMode:number = this.getOverScrollMode();\n                const canOverscroll:boolean = overscrollMode == HorizontalScrollView.OVER_SCROLL_ALWAYS || (overscrollMode == HorizontalScrollView.OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0);\n                this.overScrollBy(x - oldX, y - oldY, oldX, oldY, range, 0, this.mOverflingDistance, 0, false);\n                this.onScrollChanged(this.mScrollX, this.mScrollY, oldX, oldY);\n                if (canOverscroll) {\n                    //if (x < 0 && oldX >= 0) {\n                    //    this.mEdgeGlowLeft.onAbsorb(Math.floor(this.mScroller.getCurrVelocity()));\n                    //} else if (x > range && oldX <= range) {\n                    //    this.mEdgeGlowRight.onAbsorb(Math.floor(this.mScroller.getCurrVelocity()));\n                    //}\n                }\n            }\n            if (!this.awakenScrollBars()) {\n                this.postInvalidateOnAnimation();\n            }\n        }\n    }\n\n    /**\n     * Scrolls the view to the given child.\n     *\n     * @param child the View to scroll to\n     */\n    private scrollToChild(child:View):void  {\n        child.getDrawingRect(this.mTempRect);\n        /* Offset from child's local coordinates to ScrollView coordinates */\n        this.offsetDescendantRectToMyCoords(child, this.mTempRect);\n        let scrollDelta:number = this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);\n        if (scrollDelta != 0) {\n            this.scrollBy(scrollDelta, 0);\n        }\n    }\n\n    /**\n     * If rect is off screen, scroll just enough to get it (or at least the\n     * first screen size chunk of it) on screen.\n     *\n     * @param rect      The rectangle.\n     * @param immediate True to scroll immediately without animation\n     * @return true if scrolling was performed\n     */\n    private scrollToChildRect(rect:Rect, immediate:boolean):boolean  {\n        const delta:number = this.computeScrollDeltaToGetChildRectOnScreen(rect);\n        const scroll:boolean = delta != 0;\n        if (scroll) {\n            if (immediate) {\n                this.scrollBy(delta, 0);\n            } else {\n                this.smoothScrollBy(delta, 0);\n            }\n        }\n        return scroll;\n    }\n\n    /**\n     * Compute the amount to scroll in the X direction in order to get\n     * a rectangle completely on the screen (or, if taller than the screen,\n     * at least the first screen size chunk of it).\n     *\n     * @param rect The rect.\n     * @return The scroll delta.\n     */\n    protected computeScrollDeltaToGetChildRectOnScreen(rect:Rect):number  {\n        if (this.getChildCount() == 0)\n            return 0;\n        let width:number = this.getWidth();\n        let screenLeft:number = this.getScrollX();\n        let screenRight:number = screenLeft + width;\n        let fadingEdge:number = this.getHorizontalFadingEdgeLength();\n        // leave room for left fading edge as long as rect isn't at very left\n        if (rect.left > 0) {\n            screenLeft += fadingEdge;\n        }\n        // leave room for right fading edge as long as rect isn't at very right\n        if (rect.right < this.getChildAt(0).getWidth()) {\n            screenRight -= fadingEdge;\n        }\n        let scrollXDelta:number = 0;\n        if (rect.right > screenRight && rect.left > screenLeft) {\n            if (rect.width() > width) {\n                // just enough to get screen size chunk on\n                scrollXDelta += (rect.left - screenLeft);\n            } else {\n                // get entire rect at right of screen\n                scrollXDelta += (rect.right - screenRight);\n            }\n            // make sure we aren't scrolling beyond the end of our content\n            let right:number = this.getChildAt(0).getRight();\n            let distanceToRight:number = right - screenRight;\n            scrollXDelta = Math.min(scrollXDelta, distanceToRight);\n        } else if (rect.left < screenLeft && rect.right < screenRight) {\n            if (rect.width() > width) {\n                // screen size chunk\n                scrollXDelta -= (screenRight - rect.right);\n            } else {\n                // entire rect at left\n                scrollXDelta -= (screenLeft - rect.left);\n            }\n            // make sure we aren't scrolling any further than the left our content\n            scrollXDelta = Math.max(scrollXDelta, -this.getScrollX());\n        }\n        return scrollXDelta;\n    }\n\n    requestChildFocus(child:View, focused:View):void  {\n        if (!this.mIsLayoutDirty) {\n            this.scrollToChild(focused);\n        } else {\n            // The child may not be laid out yet, we can't compute the scroll yet\n            this.mChildToScrollTo = focused;\n        }\n        super.requestChildFocus(child, focused);\n    }\n\n    /**\n     * When looking for focus in children of a scroll view, need to be a little\n     * more careful not to give focus to something that is scrolled off screen.\n     *\n     * This is more expensive than the default {@link android.view.ViewGroup}\n     * implementation, otherwise this behavior might have been made the default.\n     */\n    protected onRequestFocusInDescendants(direction:number, previouslyFocusedRect:Rect):boolean  {\n        // (ugh).\n        if (direction == View.FOCUS_FORWARD) {\n            direction = View.FOCUS_RIGHT;\n        } else if (direction == View.FOCUS_BACKWARD) {\n            direction = View.FOCUS_LEFT;\n        }\n        const nextFocus:View = previouslyFocusedRect == null ? FocusFinder.getInstance().findNextFocus(this, null, direction) : FocusFinder.getInstance().findNextFocusFromRect(this, previouslyFocusedRect, direction);\n        if (nextFocus == null) {\n            return false;\n        }\n        if (this.isOffScreen(nextFocus)) {\n            return false;\n        }\n        return nextFocus.requestFocus(direction, previouslyFocusedRect);\n    }\n\n    requestChildRectangleOnScreen(child:View, rectangle:Rect, immediate:boolean):boolean  {\n        // offset into coordinate space of this scroll view\n        rectangle.offset(child.getLeft() - child.getScrollX(), child.getTop() - child.getScrollY());\n        return this.scrollToChildRect(rectangle, immediate);\n    }\n\n    requestLayout():void  {\n        this.mIsLayoutDirty = true;\n        super.requestLayout();\n    }\n\n    protected onLayout(changed:boolean, l:number, t:number, r:number, b:number):void  {\n        let childWidth:number = 0;\n        let childMargins:number = 0;\n        if (this.getChildCount() > 0) {\n            childWidth = this.getChildAt(0).getMeasuredWidth();\n            let childParams:FrameLayout.LayoutParams = <FrameLayout.LayoutParams> this.getChildAt(0).getLayoutParams();\n            childMargins = childParams.leftMargin + childParams.rightMargin;\n        }\n        const available:number = r - l - this.getPaddingLeftWithForeground() - this.getPaddingRightWithForeground() - childMargins;\n        const forceLeftGravity:boolean = (childWidth > available);\n        this.layoutChildren(l, t, r, b, forceLeftGravity);\n        this.mIsLayoutDirty = false;\n        // Give a child focus if it needs it\n        if (this.mChildToScrollTo != null && HorizontalScrollView.isViewDescendantOf(this.mChildToScrollTo, this)) {\n            this.scrollToChild(this.mChildToScrollTo);\n        }\n        this.mChildToScrollTo = null;\n        if (!this.isLaidOut()) {\n            const scrollRange:number = Math.max(0, childWidth - (r - l - this.mPaddingLeft - this.mPaddingRight));\n            //if (this.mSavedState != null) {\n            //    if (this.isLayoutRtl() == this.mSavedState.isLayoutRtl) {\n            //        this.mScrollX = this.mSavedState.scrollPosition;\n            //    } else {\n            //        this.mScrollX = scrollRange - this.mSavedState.scrollPosition;\n            //    }\n            //    this.mSavedState = null;\n            //} else\n            {\n                if (this.isLayoutRtl()) {\n                    this.mScrollX = scrollRange - this.mScrollX;\n                }\n            // mScrollX default value is \"0\" for LTR\n            }\n            // Don't forget to clamp\n            if (this.mScrollX > scrollRange) {\n                this.mScrollX = scrollRange;\n            } else if (this.mScrollX < 0) {\n                this.mScrollX = 0;\n            }\n        }\n        // Calling this with the present values causes it to re-claim them\n        this.scrollTo(this.mScrollX, this.mScrollY);\n    }\n\n    protected onSizeChanged(w:number, h:number, oldw:number, oldh:number):void  {\n        super.onSizeChanged(w, h, oldw, oldh);\n        let currentFocused:View = this.findFocus();\n        if (null == currentFocused || this == currentFocused)\n            return;\n        const maxJump:number = this.mRight - this.mLeft;\n        if (this.isWithinDeltaOfScreen(currentFocused, maxJump)) {\n            currentFocused.getDrawingRect(this.mTempRect);\n            this.offsetDescendantRectToMyCoords(currentFocused, this.mTempRect);\n            let scrollDelta:number = this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);\n            this.doScrollX(scrollDelta);\n        }\n    }\n\n    /**\n     * Return true if child is a descendant of parent, (or equal to the parent).\n     */\n    private static isViewDescendantOf(child:View, parent:View):boolean  {\n        if (child == parent) {\n            return true;\n        }\n        const theParent:ViewParent = child.getParent();\n        return (theParent instanceof ViewGroup) && HorizontalScrollView.isViewDescendantOf(<View> theParent, parent);\n    }\n\n    /**\n     * Fling the scroll view\n     *\n     * @param velocityX The initial velocity in the X direction. Positive\n     *                  numbers mean that the finger/cursor is moving down the screen,\n     *                  which means we want to scroll towards the left.\n     */\n    fling(velocityX:number):void  {\n        if (this.getChildCount() > 0) {\n            let width:number = this.getWidth() - this.mPaddingRight - this.mPaddingLeft;\n            let right:number = this.getChildAt(0).getWidth();\n            this.mScroller.fling(this.mScrollX, this.mScrollY, velocityX, 0, 0, Math.max(0, right - width), 0, 0, width / 2, 0);\n            const movingRight:boolean = velocityX > 0;\n            let currentFocused:View = this.findFocus();\n            let newFocused:View = this.findFocusableViewInMyBounds(movingRight, this.mScroller.getFinalX(), currentFocused);\n            if (newFocused == null) {\n                newFocused = this;\n            }\n            if (newFocused != currentFocused) {\n                newFocused.requestFocus(movingRight ? View.FOCUS_RIGHT : View.FOCUS_LEFT);\n            }\n            this.postInvalidateOnAnimation();\n        }\n    }\n\n    /**\n     * {@inheritDoc}\n     *\n     * <p>This version also clamps the scrolling to the bounds of our child.\n     */\n    scrollTo(x:number, y:number):void  {\n        // we rely on the fact the View.scrollBy calls scrollTo.\n        if (this.getChildCount() > 0) {\n            let child:View = this.getChildAt(0);\n            x = HorizontalScrollView.clamp(x, this.getWidth() - this.mPaddingRight - this.mPaddingLeft, child.getWidth());\n            y = HorizontalScrollView.clamp(y, this.getHeight() - this.mPaddingBottom - this.mPaddingTop, child.getHeight());\n            if (x != this.mScrollX || y != this.mScrollY) {\n                super.scrollTo(x, y);\n            }\n        }\n    }\n\n    setOverScrollMode(mode:number):void  {\n        //if (mode != HorizontalScrollView.OVER_SCROLL_NEVER) {\n        //    if (this.mEdgeGlowLeft == null) {\n        //        let context:Context = this.getContext();\n        //        this.mEdgeGlowLeft = new EdgeEffect(context);\n        //        this.mEdgeGlowRight = new EdgeEffect(context);\n        //    }\n        //} else {\n        //    this.mEdgeGlowLeft = null;\n        //    this.mEdgeGlowRight = null;\n        //}\n        super.setOverScrollMode(mode);\n    }\n\n    draw(canvas:Canvas):void  {\n        super.draw(canvas);\n        //if (this.mEdgeGlowLeft != null) {\n        //    const scrollX:number = this.mScrollX;\n        //    if (!this.mEdgeGlowLeft.isFinished()) {\n        //        const restoreCount:number = canvas.save();\n        //        const height:number = this.getHeight() - this.mPaddingTop - this.mPaddingBottom;\n        //        canvas.rotate(270);\n        //        canvas.translate(-height + this.mPaddingTop, Math.min(0, scrollX));\n        //        this.mEdgeGlowLeft.setSize(height, this.getWidth());\n        //        if (this.mEdgeGlowLeft.draw(canvas)) {\n        //            this.postInvalidateOnAnimation();\n        //        }\n        //        canvas.restoreToCount(restoreCount);\n        //    }\n        //    if (!this.mEdgeGlowRight.isFinished()) {\n        //        const restoreCount:number = canvas.save();\n        //        const width:number = this.getWidth();\n        //        const height:number = this.getHeight() - this.mPaddingTop - this.mPaddingBottom;\n        //        canvas.rotate(90);\n        //        canvas.translate(-this.mPaddingTop, -(Math.max(this.getScrollRange(), scrollX) + width));\n        //        this.mEdgeGlowRight.setSize(height, width);\n        //        if (this.mEdgeGlowRight.draw(canvas)) {\n        //            this.postInvalidateOnAnimation();\n        //        }\n        //        canvas.restoreToCount(restoreCount);\n        //    }\n        //}\n    }\n\n    private static clamp(n:number, my:number, child:number):number  {\n        if (my >= child || n < 0) {\n            return 0;\n        }\n        if ((my + n) > child) {\n            return child - my;\n        }\n        return n;\n    }\n\n    //protected onRestoreInstanceState(state:Parcelable):void  {\n    //    if (this.mContext.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR2) {\n    //        // Some old apps reused IDs in ways they shouldn't have.\n    //        // Don't break them, but they don't get scroll state restoration.\n    //        super.onRestoreInstanceState(state);\n    //        return;\n    //    }\n    //    let ss:HorizontalScrollView.SavedState = <HorizontalScrollView.SavedState> state;\n    //    super.onRestoreInstanceState(ss.getSuperState());\n    //    this.mSavedState = ss;\n    //    this.requestLayout();\n    //}\n    //\n    //protected onSaveInstanceState():Parcelable  {\n    //    if (this.mContext.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR2) {\n    //        // Don't break them, but they don't get scroll state restoration.\n    //        return super.onSaveInstanceState();\n    //    }\n    //    let superState:Parcelable = super.onSaveInstanceState();\n    //    let ss:HorizontalScrollView.SavedState = new HorizontalScrollView.SavedState(superState);\n    //    ss.scrollPosition = this.mScrollX;\n    //    ss.isLayoutRtl = this.isLayoutRtl();\n    //    return ss;\n    //}\n\n\n}\n\n//export module HorizontalScrollView{\n//export class SavedState extends View.BaseSavedState {\n//\n//    scrollPosition:number = 0;\n//\n//    isLayoutRtl:boolean;\n//\n//    constructor( superState:Parcelable) {\n//        super(superState);\n//    }\n//\n//    constructor( source:Parcel) {\n//        super(source);\n//        this.scrollPosition = source.readInt();\n//        this.isLayoutRtl = (source.readInt() == 0) ? true : false;\n//    }\n//\n//    writeToParcel(dest:Parcel, flags:number):void  {\n//        super.writeToParcel(dest, flags);\n//        dest.writeInt(this.scrollPosition);\n//        dest.writeInt(this.isLayoutRtl ? 1 : 0);\n//    }\n//\n//    toString():string  {\n//        return \"HorizontalScrollView.SavedState{\" + Integer.toHexString(System.identityHashCode(this)) + \" scrollPosition=\" + this.scrollPosition + \" isLayoutRtl=\" + this.isLayoutRtl + \"}\";\n//    }\n//\n//    static CREATOR:Parcelable.Creator<SavedState> = (()=>{\n//        const inner_this=this;\n//        class _Inner extends Parcelable.Creator<SavedState> {\n//\n//            createFromParcel(_in:Parcel):SavedState  {\n//                return new SavedState(_in);\n//            }\n//\n//            newArray(size:number):SavedState[]  {\n//                return new Array<SavedState>(size);\n//            }\n//        }\n//        return new _Inner();\n//    })();\n//}\n//}\n\n}"
  },
  {
    "path": "src/android/widget/ImageButton.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"ImageView.ts\"/>\n///<reference path=\"../view/View.ts\"/>\n///<reference path=\"../R/attr.ts\"/>\n\nmodule android.widget{\n\n    /**\n     * <p>\n     * Displays a button with an image (instead of text) that can be pressed\n     * or clicked by the user. By default, an ImageButton looks like a regular\n     * {@link android.widget.Button}, with the standard button background\n     * that changes color during different button states. The image on the surface\n     * of the button is defined either by the {@code android:src} attribute in the\n     * {@code <ImageButton>} XML element or by the\n     * {@link #setImageResource(int)} method.</p>\n     *\n     * <p>To remove the standard button background image, define your own\n     * background image or set the background color to be transparent.</p>\n     * <p>To indicate the different button states (focused, selected, etc.), you can\n     * define a different image for each state. E.g., a blue image by default, an\n     * orange one for when focused, and a yellow one for when pressed. An easy way to\n     * do this is with an XML drawable \"selector.\" For example:</p>\n     * <pre>\n     * &lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n     * &lt;selector xmlns:android=\"http://schemas.android.com/apk/res/android\"&gt;\n     *     &lt;item android:state_pressed=\"true\"\n     *           android:drawable=\"@drawable/button_pressed\" /&gt; &lt;!-- pressed --&gt;\n     *     &lt;item android:state_focused=\"true\"\n     *           android:drawable=\"@drawable/button_focused\" /&gt; &lt;!-- focused --&gt;\n     *     &lt;item android:drawable=\"@drawable/button_normal\" /&gt; &lt;!-- default --&gt;\n     * &lt;/selector&gt;</pre>\n     *\n     * <p>Save the XML file in your project {@code res/drawable/} folder and then\n     * reference it as a drawable for the source of your ImageButton (in the\n     * {@code android:src} attribute). Android will automatically change the image\n     * based on the state of the button and the corresponding images\n     * defined in the XML.</p>\n     *\n     * <p>The order of the {@code <item>} elements is important because they are\n     * evaluated in order. This is why the \"normal\" button image comes last, because\n     * it will only be applied after {@code android:state_pressed} and {@code\n     * android:state_focused} have both evaluated false.</p>\n     *\n     * <p>See the <a href=\"{@docRoot}guide/topics/ui/controls/button.html\">Buttons</a>\n     * guide.</p>\n     *\n     * <p><strong>XML attributes</strong></p>\n     * <p>\n     * See {@link android.R.styleable#ImageView Button Attributes},\n     * {@link android.R.styleable#View View Attributes}\n     * </p>\n     */\n    export class ImageButton extends ImageView {\n        constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle = android.R.attr.imageButtonStyle){\n            super(context, bindElement, defStyle);\n        }\n    }\n}"
  },
  {
    "path": "src/android/widget/ImageView.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/content/res/Resources.ts\"/>\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../android/graphics/Matrix.ts\"/>\n///<reference path=\"../../android/graphics/RectF.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/text/TextUtils.ts\"/>\n///<reference path=\"../../android/util/Log.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../java/lang/System.ts\"/>\n///<reference path=\"../../androidui/image/NetDrawable.ts\"/>\n\nmodule android.widget {\nimport Resources = android.content.res.Resources;\nimport Canvas = android.graphics.Canvas;\nimport Matrix = android.graphics.Matrix;\nimport RectF = android.graphics.RectF;\nimport Drawable = android.graphics.drawable.Drawable;\nimport TextUtils = android.text.TextUtils;\nimport Log = android.util.Log;\nimport View = android.view.View;\nimport Integer = java.lang.Integer;\nimport System = java.lang.System;\nimport NetDrawable = androidui.image.NetDrawable;\nimport LayoutParams = android.view.ViewGroup.LayoutParams;\n    import AttrBinder = androidui.attr.AttrBinder;\n    \n/**\n * Displays an arbitrary image, such as an icon.  The ImageView class\n * can load images from various sources (such as resources or content\n * providers), takes care of computing its measurement from the image so that\n * it can be used in any layout manager, and provides various display options\n * such as scaling and tinting.\n *\n * @attr ref android.R.styleable#ImageView_adjustViewBounds\n * @attr ref android.R.styleable#ImageView_src\n * @attr ref android.R.styleable#ImageView_maxWidth\n * @attr ref android.R.styleable#ImageView_maxHeight\n * @attr ref android.R.styleable#ImageView_tint\n * @attr ref android.R.styleable#ImageView_scaleType\n * @attr ref android.R.styleable#ImageView_cropToPadding\n */\nexport class ImageView extends View {\n\n    // settable by the client\n    private mUri:string;\n\n    //private mResource:number = 0;\n\n    private mMatrix:Matrix;\n\n    private mScaleType:ImageView.ScaleType;\n\n    private mHaveFrame:boolean = false;\n\n    private mAdjustViewBounds:boolean = false;\n\n    private mMaxWidth:number = Integer.MAX_VALUE;\n\n    private mMaxHeight:number = Integer.MAX_VALUE;\n\n    //// these are applied to the drawable\n    //private mColorFilter:ColorFilter;\n    //\n    //private mXfermode:Xfermode;\n\n    private mAlpha:number = 255;\n\n    private mViewAlphaScale:number = 256;\n\n    private mColorMod:boolean = false;\n\n    private mDrawable:Drawable = null;\n\n    private mState:number[] = null;\n\n    private mMergeState:boolean = false;\n\n    private mLevel:number = 0;\n\n    private mDrawableWidth:number = 0;\n\n    private mDrawableHeight:number = 0;\n\n    private mDrawMatrix:Matrix = null;\n\n    // Avoid allocations...\n    private mTempSrc:RectF = new RectF();\n\n    private mTempDst:RectF = new RectF();\n\n    private mCropToPadding:boolean;\n\n    private mBaseline:number = -1;\n\n    private mBaselineAlignBottom:boolean = false;\n\n    // AdjustViewBounds behavior will be in compatibility mode for older apps.\n    private mAdjustViewBoundsCompat:boolean = false;\n\n    //private static sScaleTypeArray:ImageView.ScaleType[] = [ ImageView.ScaleType.MATRIX, ImageView.ScaleType.FIT_XY,\n    //    ImageView.ScaleType.FIT_START, ImageView.ScaleType.FIT_CENTER, ImageView.ScaleType.FIT_END, ImageView.ScaleType.CENTER,\n    //    ImageView.ScaleType.CENTER_CROP, ImageView.ScaleType.CENTER_INSIDE ];\n\n    constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>){\n        super(context, bindElement, defStyle);\n        this.initImageView();\n\n        let a = context.obtainStyledAttributes(bindElement, defStyle);\n        let d = a.getDrawable('src');\n        if (d != null) {\n            this.setImageDrawable(d);\n        }\n\n        this.mBaselineAlignBottom = a.getBoolean('baselineAlignBottom', false);\n\n        this.mBaseline = a.getDimensionPixelSize('baseline', -1);\n\n        this.setAdjustViewBounds(a.getBoolean('adjustViewBounds', false));\n\n        this.setMaxWidth(a.getDimensionPixelSize('maxWidth', Integer.MAX_VALUE));\n\n        this.setMaxHeight(a.getDimensionPixelSize('maxHeight', Integer.MAX_VALUE));\n\n        let scaleType = ImageView.parseScaleType(a.getString('scaleType'), null);\n        if (scaleType != null) {\n            this.setScaleType(scaleType);\n        }\n\n        // AndroidUI ignore: not support now.\n        // let tint = a.getInt('tint', 0);\n        // if (tint != 0) {\n        //     this.setColorFilter(tint);\n        // }\n\n        let alpha = a.getInt('drawableAlpha', 255);\n        if (alpha != 255) {\n            this.setAlpha(alpha);\n        }\n\n        this.mCropToPadding = a.getBoolean('cropToPadding', false);\n\n        a.recycle();\n\n        //need inflate syntax/reader for matrix\n    }\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder()\n            .set('src', {\n                setter(v: ImageView, value: any, attrBinder:AttrBinder) {\n                    let d = attrBinder.parseDrawable(value);\n                    if (d) v.setImageDrawable(d);\n                    else v.setImageURI(value);\n                }, getter(v: ImageView) {\n                    return v.mDrawable;\n                }\n            }).set('baselineAlignBottom', {\n                setter(v: ImageView, value: any, attrBinder:AttrBinder) {\n                    v.setBaselineAlignBottom(attrBinder.parseBoolean(value, v.mBaselineAlignBottom));\n                }, getter(v: ImageView) {\n                    return v.getBaselineAlignBottom();\n                }\n            }).set('baseline', {\n                setter(v: ImageView, value: any, attrBinder:AttrBinder) {\n                    v.setBaseline(attrBinder.parseNumberPixelSize(value, v.mBaseline));\n                }, getter(v: ImageView) {\n                    return v.mBaseline;\n                }\n            }).set('adjustViewBounds', {\n                setter(v: ImageView, value: any, attrBinder:AttrBinder) {\n                    v.setAdjustViewBounds(attrBinder.parseBoolean(value, false));\n                }, getter(v: ImageView) {\n                    return v.getAdjustViewBounds();\n                }\n            }).set('maxWidth', {\n                setter(v: ImageView, value: any, attrBinder:AttrBinder) {\n                    let baseValue = v.getParent() instanceof View ? (<View><any>v.getParent()).getWidth() : 0;\n                    v.setMaxWidth(attrBinder.parseNumberPixelSize(value, v.mMaxWidth, baseValue));\n                }, getter(v: ImageView) {\n                    return v.mMaxWidth;\n                }\n            }).set('maxHeight', {\n                setter(v: ImageView, value: any, attrBinder:AttrBinder) {\n                    let baseValue = v.getParent() instanceof View ? (<View><any>v.getParent()).getHeight() : 0;\n                    v.setMaxHeight(attrBinder.parseNumberPixelSize(value, v.mMaxHeight, baseValue));\n                }, getter(v: ImageView) {\n                    return v.mMaxHeight;\n                }\n            }).set('scaleType', {\n                setter(v: ImageView, value: any, attrBinder:AttrBinder) {\n                    if (typeof value === 'number') {\n                        v.setScaleType(value);\n                    } else {\n                        v.setScaleType(ImageView.parseScaleType(value, v.mScaleType));\n                    }\n                }, getter(v: ImageView) {\n                    return v.mScaleType;\n                }\n            }).set('drawableAlpha', {\n                setter(v: ImageView, value: any, attrBinder:AttrBinder) {\n                    v.setImageAlpha(attrBinder.parseInt(value, v.mAlpha));\n                }, getter(v: ImageView) {\n                    return v.mAlpha;\n                }\n            }).set('cropToPadding', {\n                setter(v: ImageView, value: any, attrBinder:AttrBinder) {\n                    v.setCropToPadding(attrBinder.parseBoolean(value, false));\n                }, getter(v: ImageView) {\n                    return v.getCropToPadding();\n                }\n            });\n    }\n\n    private initImageView():void  {\n        this.mMatrix = new Matrix();\n        this.mScaleType = ImageView.ScaleType.FIT_CENTER;\n        //this.mAdjustViewBoundsCompat = this.mContext.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1;\n    }\n\n    protected verifyDrawable(dr:Drawable):boolean  {\n        return this.mDrawable == dr || super.verifyDrawable(dr);\n    }\n\n    jumpDrawablesToCurrentState():void  {\n        super.jumpDrawablesToCurrentState();\n        if (this.mDrawable != null)\n            this.mDrawable.jumpToCurrentState();\n    }\n\n    invalidateDrawable(dr:Drawable):void  {\n        if (dr == this.mDrawable) {\n            /* we invalidate the whole view in this case because it's very\n             * hard to know where the drawable actually is. This is made\n             * complicated because of the offsets and transformations that\n             * can be applied. In theory we could get the drawable's bounds\n             * and run them through the transformation and offsets, but this\n             * is probably not worth the effort.\n             */\n            this.invalidate();\n        } else {\n            super.invalidateDrawable(dr);\n        }\n    }\n\n    drawableSizeChange(who : Drawable):void{\n        if (who == this.mDrawable) {\n            this.resizeFromDrawable();\n        }else {\n            super.drawableSizeChange(who);\n        }\n    }\n\n    hasOverlappingRendering():boolean  {\n        return (this.getBackground() != null && this.getBackground().getCurrent() != null);\n    }\n\n    //onPopulateAccessibilityEvent(event:AccessibilityEvent):void  {\n    //    super.onPopulateAccessibilityEvent(event);\n    //    let contentDescription:CharSequence = this.getContentDescription();\n    //    if (!TextUtils.isEmpty(contentDescription)) {\n    //        event.getText().add(contentDescription);\n    //    }\n    //}\n\n    /**\n     * True when ImageView is adjusting its bounds\n     * to preserve the aspect ratio of its drawable\n     *\n     * @return whether to adjust the bounds of this view\n     * to presrve the original aspect ratio of the drawable\n     *\n     * @see #setAdjustViewBounds(boolean)\n     *\n     * @attr ref android.R.styleable#ImageView_adjustViewBounds\n     */\n    getAdjustViewBounds():boolean  {\n        return this.mAdjustViewBounds;\n    }\n\n    /**\n     * Set this to true if you want the ImageView to adjust its bounds\n     * to preserve the aspect ratio of its drawable.\n     *\n     * <p><strong>Note:</strong> If the application targets API level 17 or lower,\n     * adjustViewBounds will allow the drawable to shrink the view bounds, but not grow\n     * to fill available measured space in all cases. This is for compatibility with\n     * legacy {@link android.view.View.MeasureSpec MeasureSpec} and\n     * {@link android.widget.RelativeLayout RelativeLayout} behavior.</p>\n     *\n     * @param adjustViewBounds Whether to adjust the bounds of this view\n     * to preserve the original aspect ratio of the drawable.\n     * \n     * @see #getAdjustViewBounds()\n     *\n     * @attr ref android.R.styleable#ImageView_adjustViewBounds\n     */\n    setAdjustViewBounds(adjustViewBounds:boolean):void  {\n        this.mAdjustViewBounds = adjustViewBounds;\n        if (adjustViewBounds) {\n            this.setScaleType(ImageView.ScaleType.FIT_CENTER);\n        }\n    }\n\n    /**\n     * The maximum width of this view.\n     *\n     * @return The maximum width of this view\n     *\n     * @see #setMaxWidth(int)\n     *\n     * @attr ref android.R.styleable#ImageView_maxWidth\n     */\n    getMaxWidth():number  {\n        return this.mMaxWidth;\n    }\n\n    /**\n     * An optional argument to supply a maximum width for this view. Only valid if\n     * {@link #setAdjustViewBounds(boolean)} has been set to true. To set an image to be a maximum\n     * of 100 x 100 while preserving the original aspect ratio, do the following: 1) set\n     * adjustViewBounds to true 2) set maxWidth and maxHeight to 100 3) set the height and width\n     * layout params to WRAP_CONTENT.\n     * \n     * <p>\n     * Note that this view could be still smaller than 100 x 100 using this approach if the original\n     * image is small. To set an image to a fixed size, specify that size in the layout params and\n     * then use {@link #setScaleType(android.widget.ImageView.ScaleType)} to determine how to fit\n     * the image within the bounds.\n     * </p>\n     * \n     * @param maxWidth maximum width for this view\n     *\n     * @see #getMaxWidth()\n     *\n     * @attr ref android.R.styleable#ImageView_maxWidth\n     */\n    setMaxWidth(maxWidth:number):void  {\n        this.mMaxWidth = maxWidth;\n    }\n\n    /**\n     * The maximum height of this view.\n     *\n     * @return The maximum height of this view\n     *\n     * @see #setMaxHeight(int)\n     *\n     * @attr ref android.R.styleable#ImageView_maxHeight\n     */\n    getMaxHeight():number  {\n        return this.mMaxHeight;\n    }\n\n    /**\n     * An optional argument to supply a maximum height for this view. Only valid if\n     * {@link #setAdjustViewBounds(boolean)} has been set to true. To set an image to be a\n     * maximum of 100 x 100 while preserving the original aspect ratio, do the following: 1) set\n     * adjustViewBounds to true 2) set maxWidth and maxHeight to 100 3) set the height and width\n     * layout params to WRAP_CONTENT.\n     * \n     * <p>\n     * Note that this view could be still smaller than 100 x 100 using this approach if the original\n     * image is small. To set an image to a fixed size, specify that size in the layout params and\n     * then use {@link #setScaleType(android.widget.ImageView.ScaleType)} to determine how to fit\n     * the image within the bounds.\n     * </p>\n     * \n     * @param maxHeight maximum height for this view\n     *\n     * @see #getMaxHeight()\n     *\n     * @attr ref android.R.styleable#ImageView_maxHeight\n     */\n    setMaxHeight(maxHeight:number):void  {\n        this.mMaxHeight = maxHeight;\n    }\n\n    /** Return the view's drawable, or null if no drawable has been\n        assigned.\n    */\n    getDrawable():Drawable  {\n        return this.mDrawable;\n    }\n\n    ///**\n    // * Sets a drawable as the content of this ImageView.\n    // *\n    // * <p class=\"note\">This does Bitmap reading and decoding on the UI\n    // * thread, which can cause a latency hiccup.  If that's a concern,\n    // * consider using {@link #setImageDrawable(android.graphics.drawable.Drawable)} or\n    // * {@link #setImageBitmap(android.graphics.Bitmap)} and\n    // * {@link android.graphics.BitmapFactory} instead.</p>\n    // *\n    // * @param resId the resource identifier of the drawable\n    // *\n    // * @attr ref android.R.styleable#ImageView_src\n    // */\n    //setImageResource(resId:number):void  {\n    //    if (this.mUri != null || this.mResource != resId) {\n    //        this.updateDrawable(null);\n    //        this.mResource = resId;\n    //        this.mUri = null;\n    //        const oldWidth:number = this.mDrawableWidth;\n    //        const oldHeight:number = this.mDrawableHeight;\n    //        this.resolveUri();\n    //        if (oldWidth != this.mDrawableWidth || oldHeight != this.mDrawableHeight) {\n    //            this.requestLayout();\n    //        }\n    //        this.invalidate();\n    //    }\n    //}\n\n    /**\n     * Sets the content of this ImageView to the specified Uri.\n     *\n     // * <p class=\"note\">This does Bitmap reading and decoding on the UI\n     // * thread, which can cause a latency hiccup.  If that's a concern,\n     // * consider using {@link #setImageDrawable(android.graphics.drawable.Drawable)} or\n     // * {@link #setImageBitmap(android.graphics.Bitmap)} and\n     // * {@link android.graphics.BitmapFactory} instead.</p>\n     //\n     * AndroidUI note: suggest to load net image use this method\n     *\n     * @param uri The Uri of an image\n     */\n    setImageURI(uri:string):void  {\n        //if (this.mResource != 0 || (this.mUri != uri && (uri == null || this.mUri == null || !uri.equals(this.mUri)))) {\n        if (this.mUri != uri) {\n            if(this.mDrawable instanceof NetDrawable){//use same obj to load image\n                this.mUri = uri;\n                (<NetDrawable>this.mDrawable).setURL(uri);\n                this.invalidate();\n\n            }else {\n                this.updateDrawable(null);\n                //this.mResource = 0;\n                this.mUri = uri;\n                const oldWidth:number = this.mDrawableWidth;\n                const oldHeight:number = this.mDrawableHeight;\n                this.resolveUri();\n                if (oldWidth != this.mDrawableWidth || oldHeight != this.mDrawableHeight) {\n                    this.requestLayout();\n                }\n                this.invalidate();\n            }\n        }\n    }\n\n    /**\n     * Sets a drawable as the content of this ImageView.\n     * \n     * @param drawable The drawable to set\n     */\n    setImageDrawable(drawable:Drawable):void  {\n        if (this.mDrawable != drawable) {\n            //this.mResource = 0;\n            this.mUri = null;\n            const oldWidth:number = this.mDrawableWidth;\n            const oldHeight:number = this.mDrawableHeight;\n            this.updateDrawable(drawable);\n            if (oldWidth != this.mDrawableWidth || oldHeight != this.mDrawableHeight) {\n                this.requestLayout();\n            }\n            this.invalidate();\n        }\n    }\n\n    ///**\n    // * Sets a Bitmap as the content of this ImageView.\n    // *\n    // * @param bm The bitmap to set\n    // */\n    //setImageBitmap(bm:Bitmap):void  {\n    //    // if this is used frequently, may handle bitmaps explicitly\n    //    // to reduce the intermediate drawable object\n    //    this.setImageDrawable(new BitmapDrawable(this.mContext.getResources(), bm));\n    //}\n\n    setImageState(state:number[], merge:boolean):void  {\n        this.mState = state;\n        this.mMergeState = merge;\n        if (this.mDrawable != null) {\n            this.refreshDrawableState();\n            this.resizeFromDrawable();\n        }\n    }\n\n    setSelected(selected:boolean):void  {\n        super.setSelected(selected);\n        this.resizeFromDrawable();\n    }\n\n    /**\n     * Sets the image level, when it is constructed from a \n     * {@link android.graphics.drawable.LevelListDrawable}.\n     *\n     * @param level The new level for the image.\n     */\n    setImageLevel(level:number):void  {\n        this.mLevel = level;\n        if (this.mDrawable != null) {\n            this.mDrawable.setLevel(level);\n            this.resizeFromDrawable();\n        }\n    }\n\n\n\n    /**\n     * Controls how the image should be resized or moved to match the size\n     * of this ImageView.\n     * \n     * @param scaleType The desired scaling mode.\n     * \n     * @attr ref android.R.styleable#ImageView_scaleType\n     */\n    setScaleType(scaleType:ImageView.ScaleType):void  {\n        if (scaleType == null) {\n            throw Error(`new NullPointerException()`);\n        }\n        if (this.mScaleType != scaleType) {\n            this.mScaleType = scaleType;\n            this.setWillNotCacheDrawing(this.mScaleType == ImageView.ScaleType.CENTER);\n            this.requestLayout();\n            this.invalidate();\n        }\n    }\n\n    /**\n     * Return the current scale type in use by this ImageView.\n     *\n     * @see ImageView.ScaleType\n     *\n     * @attr ref android.R.styleable#ImageView_scaleType\n     */\n    getScaleType():ImageView.ScaleType  {\n        return this.mScaleType;\n    }\n\n    /** Return the view's optional matrix. This is applied to the\n        view's drawable when it is drawn. If there is not matrix,\n        this method will return an identity matrix.\n        Do not change this matrix in place but make a copy.\n        If you want a different matrix applied to the drawable,\n        be sure to call setImageMatrix().\n    */\n    getImageMatrix():Matrix  {\n        if (this.mDrawMatrix == null) {\n            return new Matrix(Matrix.IDENTITY_MATRIX);\n        }\n        return this.mDrawMatrix;\n    }\n\n    setImageMatrix(matrix:Matrix):void  {\n        // collaps null and identity to just null\n        if (matrix != null && matrix.isIdentity()) {\n            matrix = null;\n        }\n        // don't invalidate unless we're actually changing our matrix\n        if (matrix == null && !this.mMatrix.isIdentity() || matrix != null && !this.mMatrix.equals(matrix)) {\n            this.mMatrix.set(matrix);\n            this.configureBounds();\n            this.invalidate();\n        }\n    }\n\n    /**\n     * Return whether this ImageView crops to padding.\n     *\n     * @return whether this ImageView crops to padding\n     *\n     * @see #setCropToPadding(boolean)\n     *\n     * @attr ref android.R.styleable#ImageView_cropToPadding\n     */\n    getCropToPadding():boolean  {\n        return this.mCropToPadding;\n    }\n\n    /**\n     * Sets whether this ImageView will crop to padding.\n     *\n     * @param cropToPadding whether this ImageView will crop to padding\n     *\n     * @see #getCropToPadding()\n     *\n     * @attr ref android.R.styleable#ImageView_cropToPadding\n     */\n    setCropToPadding(cropToPadding:boolean):void  {\n        if (this.mCropToPadding != cropToPadding) {\n            this.mCropToPadding = cropToPadding;\n            this.requestLayout();\n            this.invalidate();\n        }\n    }\n\n    private resolveUri():void  {\n        if (this.mDrawable != null) {\n            return;\n        }\n        let d:Drawable = null;\n        if (this.mUri != null) {\n            d = new androidui.image.NetDrawable(this.mUri);\n        } else {\n            return;\n        }\n        this.updateDrawable(d);\n    }\n\n    onCreateDrawableState(extraSpace:number):number[]  {\n        if (this.mState == null) {\n            return super.onCreateDrawableState(extraSpace);\n        } else if (!this.mMergeState) {\n            return this.mState;\n        } else {\n            return ImageView.mergeDrawableStates(super.onCreateDrawableState(extraSpace + this.mState.length), this.mState);\n        }\n    }\n\n    private updateDrawable(d:Drawable):void  {\n        if (this.mDrawable != null) {\n            this.mDrawable.setCallback(null);\n            this.unscheduleDrawable(this.mDrawable);\n        }\n        this.mDrawable = d;\n        if (d != null) {\n            d.setCallback(this);\n            if (d.isStateful()) {\n                d.setState(this.getDrawableState());\n            }\n            d.setLevel(this.mLevel);\n            //d.setLayoutDirection(this.getLayoutDirection());\n            d.setVisible(this.getVisibility() == ImageView.VISIBLE, true);\n            this.mDrawableWidth = d.getIntrinsicWidth();\n            this.mDrawableHeight = d.getIntrinsicHeight();\n            this.applyColorMod();\n            this.configureBounds();\n        } else {\n            this.mDrawableWidth = this.mDrawableHeight = -1;\n        }\n    }\n\n    protected resizeFromDrawable():boolean  {\n        let d:Drawable = this.mDrawable;\n        if (d != null) {\n            let w:number = d.getIntrinsicWidth();\n            if (w < 0) w = this.mDrawableWidth;\n            let h:number = d.getIntrinsicHeight();\n            if (h < 0) h = this.mDrawableHeight;\n            if (w != this.mDrawableWidth || h != this.mDrawableHeight) {\n                this.mDrawableWidth = w;\n                this.mDrawableHeight = h;\n\n                if (this.mLayoutParams!=null\n                    && this.mLayoutParams.width != LayoutParams.WRAP_CONTENT && this.mLayoutParams.width != LayoutParams.MATCH_PARENT\n                    && this.mLayoutParams.height != LayoutParams.WRAP_CONTENT && this.mLayoutParams.height != LayoutParams.MATCH_PARENT) {\n                    // In a fixed-size view, no need requestLayout.\n                    this.configureBounds();\n\n                } else {\n                    this.requestLayout();\n                }\n                this.invalidate();\n                return true;\n            }\n        }\n        return false;\n    }\n\n    //onRtlPropertiesChanged(layoutDirection:number):void  {\n    //    super.onRtlPropertiesChanged(layoutDirection);\n    //    if (this.mDrawable != null) {\n    //        this.mDrawable.setLayoutDirection(layoutDirection);\n    //    }\n    //}\n\n    private static sS2FArray:Matrix.ScaleToFit[] = [ Matrix.ScaleToFit.FILL, Matrix.ScaleToFit.START, Matrix.ScaleToFit.CENTER, Matrix.ScaleToFit.END ];\n\n    private static scaleTypeToScaleToFit(st:ImageView.ScaleType):Matrix.ScaleToFit  {\n        // ScaleToFit enum to their corresponding Matrix.ScaleToFit values\n        return ImageView.sS2FArray[st - 1];\n    }\n\n    protected onMeasure(widthMeasureSpec:number, heightMeasureSpec:number):void  {\n        this.resolveUri();\n        let w:number;\n        let h:number;\n        // Desired aspect ratio of the view's contents (not including padding)\n        let desiredAspect:number = 0.0;\n        // We are allowed to change the view's width\n        let resizeWidth:boolean = false;\n        // We are allowed to change the view's height\n        let resizeHeight:boolean = false;\n        const widthSpecMode:number = View.MeasureSpec.getMode(widthMeasureSpec);\n        const heightSpecMode:number = View.MeasureSpec.getMode(heightMeasureSpec);\n        if (this.mDrawable == null) {\n            // If no drawable, its intrinsic size is 0.\n            this.mDrawableWidth = -1;\n            this.mDrawableHeight = -1;\n            w = h = 0;\n        } else {\n            w = this.mDrawableWidth;\n            h = this.mDrawableHeight;\n            if (w <= 0)\n                w = 1;\n            if (h <= 0)\n                h = 1;\n            // ratio of our drawable. See if that is possible.\n            if (this.mAdjustViewBounds) {\n                resizeWidth = widthSpecMode != View.MeasureSpec.EXACTLY;\n                resizeHeight = heightSpecMode != View.MeasureSpec.EXACTLY;\n                desiredAspect = <number> w / <number> h;\n            }\n        }\n        let pleft:number = this.mPaddingLeft;\n        let pright:number = this.mPaddingRight;\n        let ptop:number = this.mPaddingTop;\n        let pbottom:number = this.mPaddingBottom;\n        let widthSize:number;\n        let heightSize:number;\n        if (resizeWidth || resizeHeight) {\n            /* If we get here, it means we want to resize to match the\n                drawables aspect ratio, and we have the freedom to change at\n                least one dimension. \n            */\n            // Get the max possible width given our constraints\n            widthSize = this.resolveAdjustedSize(w + pleft + pright, this.mMaxWidth, widthMeasureSpec);\n            // Get the max possible height given our constraints\n            heightSize = this.resolveAdjustedSize(h + ptop + pbottom, this.mMaxHeight, heightMeasureSpec);\n            if (desiredAspect != 0.0) {\n                // See what our actual aspect ratio is\n                let actualAspect:number = <number> (widthSize - pleft - pright) / (heightSize - ptop - pbottom);\n                if (Math.abs(actualAspect - desiredAspect) > 0.0000001) {\n                    let done:boolean = false;\n                    // Try adjusting width to be proportional to height\n                    if (resizeWidth) {\n                        let newWidth:number = Math.floor((desiredAspect * (heightSize - ptop - pbottom))) + pleft + pright;\n                        // Allow the width to outgrow its original estimate if height is fixed.\n                        if (!resizeHeight && !this.mAdjustViewBoundsCompat) {\n                            widthSize = this.resolveAdjustedSize(newWidth, this.mMaxWidth, widthMeasureSpec);\n                        }\n                        if (newWidth <= widthSize) {\n                            widthSize = newWidth;\n                            done = true;\n                        }\n                    }\n                    // Try adjusting height to be proportional to width\n                    if (!done && resizeHeight) {\n                        let newHeight:number = Math.floor(((widthSize - pleft - pright) / desiredAspect)) + ptop + pbottom;\n                        // Allow the height to outgrow its original estimate if width is fixed.\n                        if (!resizeWidth && !this.mAdjustViewBoundsCompat) {\n                            heightSize = this.resolveAdjustedSize(newHeight, this.mMaxHeight, heightMeasureSpec);\n                        }\n                        if (newHeight <= heightSize) {\n                            heightSize = newHeight;\n                        }\n                    }\n                }\n            }\n        } else {\n            /* We are either don't want to preserve the drawables aspect ratio,\n               or we are not allowed to change view dimensions. Just measure in\n               the normal way.\n            */\n            w += pleft + pright;\n            h += ptop + pbottom;\n            w = Math.max(w, this.getSuggestedMinimumWidth());\n            h = Math.max(h, this.getSuggestedMinimumHeight());\n            widthSize = ImageView.resolveSizeAndState(w, widthMeasureSpec, 0);\n            heightSize = ImageView.resolveSizeAndState(h, heightMeasureSpec, 0);\n        }\n        this.setMeasuredDimension(widthSize, heightSize);\n    }\n\n    private resolveAdjustedSize(desiredSize:number, maxSize:number, measureSpec:number):number  {\n        let result:number = desiredSize;\n        let specMode:number = View.MeasureSpec.getMode(measureSpec);\n        let specSize:number = View.MeasureSpec.getSize(measureSpec);\n        switch(specMode) {\n            case View.MeasureSpec.UNSPECIFIED:\n                /* Parent says we can be as big as we want. Just don't be larger\n                   than max size imposed on ourselves.\n                */\n                result = Math.min(desiredSize, maxSize);\n                break;\n            case View.MeasureSpec.AT_MOST:\n                // Parent says we can be as big as we want, up to specSize. \n                // Don't be larger than specSize, and don't be larger than \n                // the max size imposed on ourselves.\n                result = Math.min(Math.min(desiredSize, specSize), maxSize);\n                break;\n            case View.MeasureSpec.EXACTLY:\n                // No choice. Do what we are told.\n                result = specSize;\n                break;\n        }\n        return result;\n    }\n\n    protected setFrame(l:number, t:number, r:number, b:number):boolean  {\n        let changed:boolean = super.setFrame(l, t, r, b);\n        this.mHaveFrame = true;\n        this.configureBounds();\n        return changed;\n    }\n\n    private configureBounds():void  {\n        if (this.mDrawable == null || !this.mHaveFrame) {\n            return;\n        }\n        let dwidth:number = this.mDrawableWidth;\n        let dheight:number = this.mDrawableHeight;\n        let vwidth:number = this.getWidth() - this.mPaddingLeft - this.mPaddingRight;\n        let vheight:number = this.getHeight() - this.mPaddingTop - this.mPaddingBottom;\n        let fits:boolean = (dwidth < 0 || vwidth == dwidth) && (dheight < 0 || vheight == dheight);\n        if (dwidth <= 0 || dheight <= 0 || ImageView.ScaleType.FIT_XY == this.mScaleType) {\n            /* If the drawable has no intrinsic size, or we're told to\n                scaletofit, then we just fill our entire view.\n            */\n            this.mDrawable.setBounds(0, 0, vwidth, vheight);\n            this.mDrawMatrix = null;\n        } else {\n            // We need to do the scaling ourself, so have the drawable\n            // use its native size.\n            this.mDrawable.setBounds(0, 0, dwidth, dheight);\n            if (ImageView.ScaleType.MATRIX == this.mScaleType) {\n                // Use the specified matrix as-is.\n                if (this.mMatrix.isIdentity()) {\n                    this.mDrawMatrix = null;\n                } else {\n                    this.mDrawMatrix = this.mMatrix;\n                }\n            } else if (fits) {\n                // The bitmap fits exactly, no transform needed.\n                this.mDrawMatrix = null;\n            } else if (ImageView.ScaleType.CENTER == this.mScaleType) {\n                // Center bitmap in view, no scaling.\n                this.mDrawMatrix = this.mMatrix;\n                this.mDrawMatrix.setTranslate(Math.floor(((vwidth - dwidth) * 0.5 + 0.5)), Math.floor(((vheight - dheight) * 0.5 + 0.5)));\n            } else if (ImageView.ScaleType.CENTER_CROP == this.mScaleType) {\n                this.mDrawMatrix = this.mMatrix;\n                let scale:number;\n                let dx:number = 0, dy:number = 0;\n                if (dwidth * vheight > vwidth * dheight) {\n                    scale = <number> vheight / <number> dheight;\n                    dx = (vwidth - dwidth * scale) * 0.5;\n                } else {\n                    scale = <number> vwidth / <number> dwidth;\n                    dy = (vheight - dheight * scale) * 0.5;\n                }\n                this.mDrawMatrix.setScale(scale, scale);\n                this.mDrawMatrix.postTranslate(Math.floor((dx + 0.5)), Math.floor((dy + 0.5)));\n            } else if (ImageView.ScaleType.CENTER_INSIDE == this.mScaleType) {\n                this.mDrawMatrix = this.mMatrix;\n                let scale:number;\n                let dx:number;\n                let dy:number;\n                if (dwidth <= vwidth && dheight <= vheight) {\n                    scale = 1.0;\n                } else {\n                    scale = Math.min(<number> vwidth / <number> dwidth, <number> vheight / <number> dheight);\n                }\n                dx = Math.floor(((vwidth - dwidth * scale) * 0.5 + 0.5));\n                dy = Math.floor(((vheight - dheight * scale) * 0.5 + 0.5));\n                this.mDrawMatrix.setScale(scale, scale);\n                this.mDrawMatrix.postTranslate(dx, dy);\n            } else {\n                // Generate the required transform.\n                this.mTempSrc.set(0, 0, dwidth, dheight);\n                this.mTempDst.set(0, 0, vwidth, vheight);\n                this.mDrawMatrix = this.mMatrix;\n                this.mDrawMatrix.setRectToRect(this.mTempSrc, this.mTempDst, ImageView.scaleTypeToScaleToFit(this.mScaleType));\n            }\n        }\n    }\n\n    protected drawableStateChanged():void  {\n        super.drawableStateChanged();\n        let d:Drawable = this.mDrawable;\n        if (d != null && d.isStateful()) {\n            d.setState(this.getDrawableState());\n        }\n    }\n\n    protected onDraw(canvas:Canvas):void  {\n        super.onDraw(canvas);\n        if (this.mDrawable == null) {\n            // couldn't resolve the URI\n            return;\n        }\n        if (this.mDrawableWidth == 0 || this.mDrawableHeight == 0) {\n            // nothing to draw (empty bounds)\n            return;\n        }\n        if (this.mDrawMatrix == null && this.mPaddingTop == 0 && this.mPaddingLeft == 0) {\n            this.mDrawable.draw(canvas);\n        } else {\n            let saveCount:number = canvas.getSaveCount();\n            canvas.save();\n            if (this.mCropToPadding) {\n                const scrollX:number = this.mScrollX;\n                const scrollY:number = this.mScrollY;\n                canvas.clipRect(scrollX + this.mPaddingLeft, scrollY + this.mPaddingTop, scrollX + this.mRight - this.mLeft - this.mPaddingRight, scrollY + this.mBottom - this.mTop - this.mPaddingBottom);\n            }\n            canvas.translate(this.mPaddingLeft, this.mPaddingTop);\n            if (this.mDrawMatrix != null) {\n                canvas.concat(this.mDrawMatrix);\n            }\n            this.mDrawable.draw(canvas);\n            canvas.restoreToCount(saveCount);\n        }\n    }\n\n    /**\n     * <p>Return the offset of the widget's text baseline from the widget's top\n     * boundary. </p>\n     *\n     * @return the offset of the baseline within the widget's bounds or -1\n     *         if baseline alignment is not supported.\n     */\n    getBaseline():number  {\n        if (this.mBaselineAlignBottom) {\n            return this.getMeasuredHeight();\n        } else {\n            return this.mBaseline;\n        }\n    }\n\n    /**\n     * <p>Set the offset of the widget's text baseline from the widget's top\n     * boundary.  This value is overridden by the {@link #setBaselineAlignBottom(boolean)}\n     * property.</p>\n     *\n     * @param baseline The baseline to use, or -1 if none is to be provided.\n     *\n     * @see #setBaseline(int) \n     * @attr ref android.R.styleable#ImageView_baseline\n     */\n    setBaseline(baseline:number):void  {\n        if (this.mBaseline != baseline) {\n            this.mBaseline = baseline;\n            this.requestLayout();\n        }\n    }\n\n    /**\n     * Set whether to set the baseline of this view to the bottom of the view.\n     * Setting this value overrides any calls to setBaseline.\n     *\n     * @param aligned If true, the image view will be baseline aligned with\n     *      based on its bottom edge.\n     *\n     * @attr ref android.R.styleable#ImageView_baselineAlignBottom\n     */\n    setBaselineAlignBottom(aligned:boolean):void  {\n        if (this.mBaselineAlignBottom != aligned) {\n            this.mBaselineAlignBottom = aligned;\n            this.requestLayout();\n        }\n    }\n\n    /**\n     * Return whether this view's baseline will be considered the bottom of the view.\n     *\n     * @see #setBaselineAlignBottom(boolean)\n     */\n    getBaselineAlignBottom():boolean  {\n        return this.mBaselineAlignBottom;\n    }\n\n    ///**\n    // * Set a tinting option for the image.\n    // *\n    // * @param color Color tint to apply.\n    // * @param mode How to apply the color.  The standard mode is\n    // * {@link PorterDuff.Mode#SRC_ATOP}\n    // *\n    // * @attr ref android.R.styleable#ImageView_tint\n    // */\n    //setColorFilter(color:number, mode:PorterDuff.Mode):void  {\n    //    this.setColorFilter(new PorterDuffColorFilter(color, mode));\n    //}\n    //\n    ///**\n    // * Set a tinting option for the image. Assumes\n    // * {@link PorterDuff.Mode#SRC_ATOP} blending mode.\n    // *\n    // * @param color Color tint to apply.\n    // * @attr ref android.R.styleable#ImageView_tint\n    // */\n    //setColorFilter(color:number):void  {\n    //    this.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);\n    //}\n    //\n    //clearColorFilter():void  {\n    //    this.setColorFilter(null);\n    //}\n    //\n    ///**\n    // * @hide Candidate for future API inclusion\n    // */\n    //setXfermode(mode:Xfermode):void  {\n    //    if (this.mXfermode != mode) {\n    //        this.mXfermode = mode;\n    //        this.mColorMod = true;\n    //        this.applyColorMod();\n    //        this.invalidate();\n    //    }\n    //}\n    //\n    ///**\n    // * Returns the active color filter for this ImageView.\n    // *\n    // * @return the active color filter for this ImageView\n    // *\n    // * @see #setColorFilter(android.graphics.ColorFilter)\n    // */\n    //getColorFilter():ColorFilter  {\n    //    return this.mColorFilter;\n    //}\n    //\n    ///**\n    // * Apply an arbitrary colorfilter to the image.\n    // *\n    // * @param cf the colorfilter to apply (may be null)\n    // *\n    // * @see #getColorFilter()\n    // */\n    //setColorFilter(cf:ColorFilter):void  {\n    //    if (this.mColorFilter != cf) {\n    //        this.mColorFilter = cf;\n    //        this.mColorMod = true;\n    //        this.applyColorMod();\n    //        this.invalidate();\n    //    }\n    //}\n\n    /**\n     * Returns the alpha that will be applied to the drawable of this ImageView.\n     *\n     * @return the alpha that will be applied to the drawable of this ImageView\n     *\n     * @see #setImageAlpha(int)\n     */\n    getImageAlpha():number  {\n        return this.mAlpha;\n    }\n\n    /**\n     * Sets the alpha value that should be applied to the image.\n     *\n     * @param alpha the alpha value that should be applied to the image\n     *\n     * @see #getImageAlpha()\n     */\n    setImageAlpha(alpha:number):void  {\n        // keep it legal\n        alpha &= 0xFF;\n        if (this.mAlpha != alpha) {\n            this.mAlpha = alpha;\n            this.mColorMod = true;\n            this.applyColorMod();\n            this.invalidate();\n        }\n    }\n\n    ///**\n    // * Sets the alpha value that should be applied to the image.\n    // *\n    // * @param alpha the alpha value that should be applied to the image\n    // *\n    // * @deprecated use #setImageAlpha(int) instead\n    // */\n    //setAlpha(alpha:number):void  {\n    //    // keep it legal\n    //    alpha &= 0xFF;\n    //    if (this.mAlpha != alpha) {\n    //        this.mAlpha = alpha;\n    //        this.mColorMod = true;\n    //        this.applyColorMod();\n    //        this.invalidate();\n    //    }\n    //}\n\n    private applyColorMod():void  {\n        // re-applied if the Drawable is changed.\n        if (this.mDrawable != null && this.mColorMod) {\n            this.mDrawable = this.mDrawable.mutate();\n            //this.mDrawable.setColorFilter(this.mColorFilter);\n            //this.mDrawable.setXfermode(this.mXfermode);\n            this.mDrawable.setAlpha(this.mAlpha * this.mViewAlphaScale >> 8);\n        }\n    }\n\n    setVisibility(visibility:number):void  {\n        super.setVisibility(visibility);\n        if (this.mDrawable != null) {\n            this.mDrawable.setVisible(visibility == ImageView.VISIBLE, false);\n        }\n    }\n\n    protected onAttachedToWindow():void  {\n        super.onAttachedToWindow();\n        if (this.mDrawable != null) {\n            this.mDrawable.setVisible(this.getVisibility() == ImageView.VISIBLE, false);\n        }\n    }\n\n    protected onDetachedFromWindow():void  {\n        super.onDetachedFromWindow();\n        if (this.mDrawable != null) {\n            this.mDrawable.setVisible(false, false);\n        }\n    }\n\n    //onInitializeAccessibilityEvent(event:AccessibilityEvent):void  {\n    //    super.onInitializeAccessibilityEvent(event);\n    //    event.setClassName(ImageView.class.getName());\n    //}\n    //\n    //onInitializeAccessibilityNodeInfo(info:AccessibilityNodeInfo):void  {\n    //    super.onInitializeAccessibilityNodeInfo(info);\n    //    info.setClassName(ImageView.class.getName());\n    //}\n\n    static parseScaleType(s:string, defaultType:ImageView.ScaleType):ImageView.ScaleType{\n        if(s==null) return defaultType;\n        s = s.toLowerCase();\n        if(s === 'matrix'.toLowerCase()) return ImageView.ScaleType.MATRIX;\n        if(s === 'fitXY'.toLowerCase()) return ImageView.ScaleType.FIT_XY;\n        if(s === 'fitStart'.toLowerCase()) return ImageView.ScaleType.FIT_START;\n        if(s === 'fitCenter'.toLowerCase()) return ImageView.ScaleType.FIT_CENTER;\n        if(s === 'fitEnd'.toLowerCase()) return ImageView.ScaleType.FIT_END;\n        if(s === 'center'.toLowerCase()) return ImageView.ScaleType.CENTER;\n        if(s === 'centerCrop'.toLowerCase()) return ImageView.ScaleType.CENTER_CROP;\n        if(s === 'centerInside'.toLowerCase()) return ImageView.ScaleType.CENTER_INSIDE;\n        return defaultType;\n    }\n}\n\nexport module ImageView{\n/**\n     * Options for scaling the bounds of an image to the bounds of this view.\n     */\nexport enum ScaleType {\n\n    /**\n         * Scale using the image matrix when drawing. The image matrix can be set using\n         * {@link ImageView#setImageMatrix(Matrix)}. From XML, use this syntax:\n         * <code>android:scaleType=\"matrix\"</code>.\n         */\n    MATRIX /*(0) {\n    }\n     */, /**\n         * Scale the image using {@link Matrix.ScaleToFit#FILL}.\n         * From XML, use this syntax: <code>android:scaleType=\"fitXY\"</code>.\n         */\n    FIT_XY /*(1) {\n    }\n     */, /**\n         * Scale the image using {@link Matrix.ScaleToFit#START}.\n         * From XML, use this syntax: <code>android:scaleType=\"fitStart\"</code>.\n         */\n    FIT_START /*(2) {\n    }\n     */, /**\n         * Scale the image using {@link Matrix.ScaleToFit#CENTER}.\n         * From XML, use this syntax:\n         * <code>android:scaleType=\"fitCenter\"</code>.\n         */\n    FIT_CENTER /*(3) {\n    }\n     */, /**\n         * Scale the image using {@link Matrix.ScaleToFit#END}.\n         * From XML, use this syntax: <code>android:scaleType=\"fitEnd\"</code>.\n         */\n    FIT_END /*(4) {\n    }\n     */, /**\n         * Center the image in the view, but perform no scaling.\n         * From XML, use this syntax: <code>android:scaleType=\"center\"</code>.\n         */\n    CENTER /*(5) {\n    }\n     */, /**\n         * Scale the image uniformly (maintain the image's aspect ratio) so\n         * that both dimensions (width and height) of the image will be equal\n         * to or larger than the corresponding dimension of the view\n         * (minus padding). The image is then centered in the view.\n         * From XML, use this syntax: <code>android:scaleType=\"centerCrop\"</code>.\n         */\n    CENTER_CROP /*(6) {\n    }\n     */, /**\n         * Scale the image uniformly (maintain the image's aspect ratio) so\n         * that both dimensions (width and height) of the image will be equal\n         * to or less than the corresponding dimension of the view\n         * (minus padding). The image is then centered in the view.\n         * From XML, use this syntax: <code>android:scaleType=\"centerInside\"</code>.\n         */\n    CENTER_INSIDE /*(7) {\n    }\n     */ /*;\n\n    constructor( ni:number) {\n        nativeInt = ni;\n    }\n\n    nativeInt:number = 0;\n     */}}\n\n}"
  },
  {
    "path": "src/android/widget/LinearLayout.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../view/Gravity.ts\"/>\n///<reference path=\"../view/View.ts\"/>\n///<reference path=\"../view/ViewGroup.ts\"/>\n///<reference path=\"../graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../graphics/Rect.ts\"/>\nmodule android.widget{\n    import Gravity = android.view.Gravity;\n    import View = android.view.View;\n    import MeasureSpec = View.MeasureSpec;\n    import ViewGroup = android.view.ViewGroup;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n    import Context = android.content.Context;\n\n    export class LinearLayout extends ViewGroup{\n        static HORIZONTAL = 0;\n        static VERTICAL = 1;\n\n        /**\n         * Don't show any dividers.\n         */\n        static SHOW_DIVIDER_NONE = 0;\n        /**\n         * Show a divider at the beginning of the group.\n         */\n        static SHOW_DIVIDER_BEGINNING = 1;\n        /**\n         * Show dividers between each item in the group.\n         */\n        static SHOW_DIVIDER_MIDDLE = 2;\n        /**\n         * Show a divider at the end of the group.\n         */\n        static SHOW_DIVIDER_END = 4;\n\n\n        /**\n         * Whether the children of this layout are baseline aligned.  Only applicable\n         * if {@link #mOrientation} is horizontal.\n         */\n        private mBaselineAligned = true;\n\n\n        /**\n         * If this layout is part of another layout that is baseline aligned,\n         * use the child at this index as the baseline.\n         *\n         * Note: this is orthogonal to {@link #mBaselineAligned}, which is concerned\n         * with whether the children of this layout are baseline aligned.\n         */\n        private mBaselineAlignedChildIndex = -1;\n\n\n        /**\n         * The additional offset to the child's baseline.\n         * We'll calculate the baseline of this layout as we measure vertically; for\n         * horizontal linear layouts, the offset of 0 is appropriate.\n         */\n        private mBaselineChildTop = 0;\n\n        private mOrientation = 0;\n\n        private mGravity = Gravity.LEFT | Gravity.TOP;\n\n        private mTotalLength = 0;\n\n        private mWeightSum = -1;\n\n        private mUseLargestChild = false;\n\n        private mMaxAscent : Array<number>;\n        private mMaxDescent : Array<number>;\n\n        private static VERTICAL_GRAVITY_COUNT = 4;\n\n        private static INDEX_CENTER_VERTICAL = 0;\n        private static INDEX_TOP = 1;\n        private static INDEX_BOTTOM = 2;\n        private static INDEX_FILL = 3;\n\n\n        private mDivider:Drawable;\n        private mDividerWidth:number = 0;\n        private mDividerHeight:number = 0;\n        private mShowDividers:number = LinearLayout.SHOW_DIVIDER_NONE;\n        private mDividerPadding:number = 0;\n\n\n        constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n            super(context, bindElement, defStyle);\n            const a = context.obtainStyledAttributes(bindElement, defStyle);\n\n            const orientationS = a.getAttrValue('orientation');\n            if (orientationS) {\n                const orientation = LinearLayout[orientationS.toUpperCase()];\n                if (Number.isInteger(orientation)) {\n                    this.setOrientation(orientation);\n                }\n            }\n\n            const gravityS = a.getAttrValue('gravity');\n            if (gravityS) {\n                this.setGravity(Gravity.parseGravity(gravityS));\n            }\n\n            let baselineAligned = a.getBoolean('baselineAligned', true);\n            if (!baselineAligned) {\n                this.setBaselineAligned(baselineAligned);\n            }\n\n            this.mWeightSum = a.getFloat('weightSum', -1.0);\n\n            this.mBaselineAlignedChildIndex = a.getInt('baselineAlignedChildIndex', -1);\n\n            this.mUseLargestChild = a.getBoolean('measureWithLargestChild', false);\n\n            this.setDividerDrawable(a.getDrawable('divider'));\n            let fieldName = ('SHOW_DIVIDER_' + a.getAttrValue('showDividers')).toUpperCase();\n            if(Number.isInteger(LinearLayout[fieldName])){\n                this.mShowDividers = LinearLayout[fieldName];\n            }\n\n            this.mDividerPadding = a.getDimensionPixelSize('dividerPadding', 0);\n\n            a.recycle();\n        }\n\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n            return super.createClassAttrBinder().set('orientation', {\n                setter(v:LinearLayout, value:any, attrBinder:androidui.attr.AttrBinder) {\n                    if((value+\"\").toUpperCase() === 'VERTICAL' || LinearLayout.VERTICAL == value){\n                        v.setOrientation(LinearLayout.VERTICAL);\n                    }else if((value+\"\").toUpperCase() === 'HORIZONTAL' || LinearLayout.HORIZONTAL == value) {\n                        v.setOrientation(LinearLayout.HORIZONTAL);\n                    }\n                }, getter(v:LinearLayout) {\n                    return v.mOrientation;\n                }\n            }).set('gravity', {\n                setter(v:LinearLayout, value:any, attrBinder:androidui.attr.AttrBinder) {\n                    v.setGravity(attrBinder.parseGravity(value, v.mGravity));\n                }, getter(v:LinearLayout) {\n                    return v.mGravity;\n                }\n            }).set('baselineAligned', {\n                setter(v:LinearLayout, value:any, attrBinder:androidui.attr.AttrBinder) {\n                    if(!attrBinder.parseBoolean(value)) v.setBaselineAligned(false);\n                }, getter(v:LinearLayout) {\n                    return v.mBaselineAligned;\n                }\n            }).set('weightSum', {\n                setter(v:LinearLayout, value:any, attrBinder:androidui.attr.AttrBinder) {\n                    v.setWeightSum(attrBinder.parseFloat(value, v.mWeightSum));\n                }, getter(v:LinearLayout) {\n                    return v.mWeightSum;\n                }\n            }).set('baselineAlignedChildIndex', {\n                setter(v:LinearLayout, value:any, attrBinder:androidui.attr.AttrBinder) {\n                    v.setBaselineAlignedChildIndex(attrBinder.parseInt(value, v.mBaselineAlignedChildIndex));\n                }, getter(v:LinearLayout) {\n                    return v.mBaselineAlignedChildIndex;\n                }\n            }).set('measureWithLargestChild', {\n                setter(v:LinearLayout, value:any, attrBinder:androidui.attr.AttrBinder) {\n                    v.setMeasureWithLargestChildEnabled(attrBinder.parseBoolean(value, v.mUseLargestChild));\n                }, getter(v:LinearLayout) {\n                    return v.mUseLargestChild;\n                }\n            }).set('divider', {\n                setter(v:LinearLayout, value:any, attrBinder:androidui.attr.AttrBinder) {\n                    v.setDividerDrawable(attrBinder.parseDrawable(value));\n                }, getter(v:LinearLayout) {\n                    return v.mDivider;\n                }\n            }).set('showDividers', {\n                setter(v:LinearLayout, value:any, attrBinder:androidui.attr.AttrBinder) {\n                    if (Number.isInteger(parseInt(value))) {\n                        this.setShowDividers(parseInt(value))\n                    } else {\n                        let fieldName = ('SHOW_DIVIDER_' + value).toUpperCase();\n                        if(Number.isInteger(LinearLayout[fieldName])){\n                            this.setShowDividers(LinearLayout[fieldName])\n                        }\n                    }\n                }, getter(v:LinearLayout) {\n                    return v.getShowDividers();\n                }\n            }).set('dividerPadding', {\n                setter(v:LinearLayout, value:any, attrBinder:androidui.attr.AttrBinder) {\n                    v.setDividerPadding(attrBinder.parseInt(value, v.mDividerPadding));\n                }, getter(v:LinearLayout) {\n                    return v.getDividerPadding();\n                }\n            });\n        }\n\n        setShowDividers(showDividers:number) {\n            if (showDividers != this.mShowDividers) {\n                this.requestLayout();\n            }\n            this.mShowDividers = showDividers;\n        }\n\n        shouldDelayChildPressedState():boolean {\n            return false;\n        }\n\n        getShowDividers():number {\n            return this.mShowDividers;\n        }\n\n        getDividerDrawable():Drawable {\n            return this.mDivider;\n        }\n\n        setDividerDrawable(divider:Drawable) {\n            if (divider == this.mDivider) {\n                return;\n            }\n            this.mDivider = divider;\n            if (divider != null) {\n                this.mDividerWidth = divider.getIntrinsicWidth();\n                this.mDividerHeight = divider.getIntrinsicHeight();\n            } else {\n                this.mDividerWidth = 0;\n                this.mDividerHeight = 0;\n            }\n            this.setWillNotDraw(divider == null);\n            this.requestLayout();\n        }\n\n        setDividerPadding(padding:number) {\n            this.mDividerPadding = padding;\n        }\n\n        getDividerPadding() {\n            return this.mDividerPadding;\n        }\n\n        getDividerWidth() {\n            return this.mDividerWidth;\n        }\n\n        protected onDraw(canvas:Canvas) {\n            if (this.mDivider == null) {\n                return;\n            }\n\n            if (this.mOrientation == LinearLayout.VERTICAL) {\n                this.drawDividersVertical(canvas);\n            } else {\n                this.drawDividersHorizontal(canvas);\n            }\n        }\n\n        drawDividersVertical(canvas:Canvas) {\n            const count = this.getVirtualChildCount();\n            for (let i = 0; i < count; i++) {\n                const child = this.getVirtualChildAt(i);\n\n                if (child != null && child.getVisibility() != View.GONE) {\n                    if (this.hasDividerBeforeChildAt(i)) {\n                        const lp = <LinearLayout.LayoutParams>child.getLayoutParams();\n                        const top = child.getTop() - lp.topMargin - this.mDividerHeight;\n                        this.drawHorizontalDivider(canvas, top);\n                    }\n                }\n            }\n\n            if (this.hasDividerBeforeChildAt(count)) {\n                const child = this.getVirtualChildAt(count - 1);\n                let bottom = 0;\n                if (child == null) {\n                    bottom = this.getHeight() - this.getPaddingBottom() - this.mDividerHeight;\n                } else {\n                    const lp = <LinearLayout.LayoutParams>child.getLayoutParams();\n                    bottom = child.getBottom() + lp.bottomMargin;\n                }\n                this.drawHorizontalDivider(canvas, bottom);\n            }\n        }\n\n        drawDividersHorizontal(canvas:Canvas) {\n            const count = this.getVirtualChildCount();\n            const isLayoutRtl = this.isLayoutRtl();\n            for (let i = 0; i < count; i++) {\n                const child = this.getVirtualChildAt(i);\n\n                if (child != null && child.getVisibility() != View.GONE) {\n                    if (this.hasDividerBeforeChildAt(i)) {\n                        const lp = <LinearLayout.LayoutParams>child.getLayoutParams();\n                        let position;\n                        if (isLayoutRtl) {\n                            position = child.getRight() + lp.rightMargin;\n                        } else {\n                            position = child.getLeft() - lp.leftMargin - this.mDividerWidth;\n                        }\n                        this.drawVerticalDivider(canvas, position);\n                    }\n                }\n            }\n\n            if (this.hasDividerBeforeChildAt(count)) {\n                const child = this.getVirtualChildAt(count - 1);\n                let position;\n                if (child == null) {\n                    if (isLayoutRtl) {\n                        position = this.getPaddingLeft();\n                    } else {\n                        position = this.getWidth() - this.getPaddingRight() - this.mDividerWidth;\n                    }\n                } else {\n                    const lp = <LinearLayout.LayoutParams>child.getLayoutParams();\n                    if (isLayoutRtl) {\n                        position = child.getLeft() - lp.leftMargin - this.mDividerWidth;\n                    } else {\n                        position = child.getRight() + lp.rightMargin;\n                    }\n                }\n                this.drawVerticalDivider(canvas, position);\n            }\n        }\n\n        drawHorizontalDivider(canvas:Canvas, top:number) {\n            this.mDivider.setBounds(this.getPaddingLeft() + this.mDividerPadding, top,\n                this.getWidth() - this.getPaddingRight() - this.mDividerPadding, top + this.mDividerHeight);\n            this.mDivider.draw(canvas);\n        }\n        drawVerticalDivider(canvas:Canvas, left:number) {\n            this.mDivider.setBounds(left, this.getPaddingTop() + this.mDividerPadding,\n                left + this.mDividerWidth, this.getHeight() - this.getPaddingBottom() - this.mDividerPadding);\n            this.mDivider.draw(canvas);\n        }\n\n        isBaselineAligned():boolean {\n            return this.mBaselineAligned;\n        }\n\n        setBaselineAligned(baselineAligned:boolean) {\n            this.mBaselineAligned = baselineAligned;\n        }\n\n        isMeasureWithLargestChildEnabled():boolean {\n            return this.mUseLargestChild;\n        }\n\n        setMeasureWithLargestChildEnabled(enabled:boolean) {\n            this.mUseLargestChild = enabled;\n        }\n\n        getBaseline():number {\n            if (this.mBaselineAlignedChildIndex < 0) {\n                return super.getBaseline();\n            }\n\n            if (this.getChildCount() <= this.mBaselineAlignedChildIndex) {\n                throw new Error(\"mBaselineAlignedChildIndex of LinearLayout \"\n                    + \"set to an index that is out of bounds.\");\n            }\n\n            const child = this.getChildAt(this.mBaselineAlignedChildIndex);\n            const childBaseline = child.getBaseline();\n\n            if (childBaseline == -1) {\n                if (this.mBaselineAlignedChildIndex == 0) {\n                    // this is just the default case, safe to return -1\n                    return -1;\n                }\n                // the user picked an index that points to something that doesn't\n                // know how to calculate its baseline.\n                throw new Error(\"mBaselineAlignedChildIndex of LinearLayout \"\n                    + \"points to a View that doesn't know how to get its baseline.\");\n            }\n\n            // TODO: This should try to take into account the virtual offsets\n            // (See getNextLocationOffset and getLocationOffset)\n            // We should add to childTop:\n            // sum([getNextLocationOffset(getChildAt(i)) / i < mBaselineAlignedChildIndex])\n            // and also add:\n            // getLocationOffset(child)\n            let childTop = this.mBaselineChildTop;\n\n            if (this.mOrientation == LinearLayout.VERTICAL) {\n                const majorGravity = this.mGravity & Gravity.VERTICAL_GRAVITY_MASK;\n                if (majorGravity != Gravity.TOP) {\n                    switch (majorGravity) {\n                        case Gravity.BOTTOM:\n                            childTop = this.mBottom - this.mTop - this.mPaddingBottom - this.mTotalLength;\n                            break;\n\n                        case Gravity.CENTER_VERTICAL:\n                            childTop += ((this.mBottom - this.mTop - this.mPaddingTop - this.mPaddingBottom) -\n                                this.mTotalLength) / 2;\n                            break;\n                    }\n                }\n            }\n\n            let lp = <LinearLayout.LayoutParams>child.getLayoutParams();\n            return childTop + lp.topMargin + childBaseline;\n        }\n\n        getBaselineAlignedChildIndex():number {\n            return this.mBaselineAlignedChildIndex;\n        }\n\n        setBaselineAlignedChildIndex(i:number) {\n            if ((i < 0) || (i >= this.getChildCount())) {\n                throw new Error(\"base aligned child index out \"\n                    + \"of range (0, \" + this.getChildCount() + \")\");\n            }\n            this.mBaselineAlignedChildIndex = i;\n        }\n\n        getVirtualChildAt(index:number) {\n            return this.getChildAt(index);\n        }\n\n        getVirtualChildCount():number {\n            return this.getChildCount();\n        }\n\n        getWeightSum():number {\n            return this.mWeightSum;\n        }\n\n        setWeightSum(weightSum:number){\n            this.mWeightSum = Math.max(0, weightSum);\n        }\n\n\n        protected onMeasure(widthMeasureSpec, heightMeasureSpec) {\n            if (this.mOrientation == LinearLayout.VERTICAL) {\n                this.measureVertical(widthMeasureSpec, heightMeasureSpec);\n            } else {\n                this.measureHorizontal(widthMeasureSpec, heightMeasureSpec);\n            }\n        }\n\n        hasDividerBeforeChildAt(childIndex:number) {\n            if (childIndex == 0) {\n                return (this.mShowDividers & LinearLayout.SHOW_DIVIDER_BEGINNING) != 0;\n            } else if (childIndex == this.getChildCount()) {\n                return (this.mShowDividers & LinearLayout.SHOW_DIVIDER_END) != 0;\n            } else if ((this.mShowDividers & LinearLayout.SHOW_DIVIDER_MIDDLE) != 0) {\n                let hasVisibleViewBefore = false;\n                for (let i = childIndex - 1; i >= 0; i--) {\n                    if (this.getChildAt(i).getVisibility() != LinearLayout.GONE) {\n                        hasVisibleViewBefore = true;\n                        break;\n                    }\n                }\n                return hasVisibleViewBefore;\n            }\n            return false;\n        }\n\n        measureVertical(widthMeasureSpec:number, heightMeasureSpec:number) {\n            this.mTotalLength = 0;\n            let maxWidth = 0;\n            let childState = 0;\n            let alternativeMaxWidth = 0;\n            let weightedMaxWidth = 0;\n            let allFillParent = true;\n            let totalWeight = 0;\n\n            const count = this.getVirtualChildCount();\n\n            const widthMode = MeasureSpec.getMode(widthMeasureSpec);\n            const heightMode = MeasureSpec.getMode(heightMeasureSpec);\n\n            let matchWidth = false;\n\n            const baselineChildIndex = this.mBaselineAlignedChildIndex;\n            const useLargestChild = this.mUseLargestChild;\n\n            let largestChildHeight = Number.MIN_SAFE_INTEGER;\n\n            // See how tall everyone is. Also remember max width.\n            for (let i = 0; i < count; ++i) {\n                const child = this.getVirtualChildAt(i);\n\n                if (child == null) {\n                    this.mTotalLength += this.measureNullChild(i);\n                    continue;\n                }\n\n                if (child.getVisibility() == View.GONE) {\n                    i += this.getChildrenSkipCount(child, i);\n                    continue;\n                }\n\n                if (this.hasDividerBeforeChildAt(i)) {\n                    this.mTotalLength += this.mDividerHeight;\n                }\n\n                let lp = <LinearLayout.LayoutParams>child.getLayoutParams();\n\n                totalWeight += lp.weight;\n\n                if (heightMode == MeasureSpec.EXACTLY && lp.height == 0 && lp.weight > 0) {\n                    // Optimization: don't bother measuring children who are going to use\n                    // leftover space. These views will get measured again down below if\n                    // there is any leftover space.\n                    const totalLength = this.mTotalLength;\n                    this.mTotalLength = Math.max(totalLength, totalLength + lp.topMargin + lp.bottomMargin);\n                } else {\n                    let oldHeight = Number.MIN_SAFE_INTEGER;\n\n                    if (lp.height == 0 && lp.weight > 0) {\n                        // heightMode is either UNSPECIFIED or AT_MOST, and this\n                        // child wanted to stretch to fill available space.\n                        // Translate that to WRAP_CONTENT so that it does not end up\n                        // with a height of 0\n                        oldHeight = 0;\n                        lp.height = LinearLayout.LayoutParams.WRAP_CONTENT;\n                    }\n\n                    // Determine how big this child would like to be. If this or\n                    // previous children have given a weight, then we allow it to\n                    // use all available space (and we will shrink things later\n                    // if needed).\n                    this.measureChildBeforeLayout(\n                        child, i, widthMeasureSpec, 0, heightMeasureSpec,\n                        totalWeight == 0 ? this.mTotalLength : 0);\n\n                    if (oldHeight != Number.MIN_SAFE_INTEGER) {\n                        lp.height = oldHeight;\n                    }\n\n                    const childHeight = child.getMeasuredHeight();\n                    const totalLength = this.mTotalLength;\n                    this.mTotalLength = Math.max(totalLength, totalLength + childHeight + lp.topMargin +\n                        lp.bottomMargin + this.getNextLocationOffset(child));\n\n                    if (useLargestChild) {\n                        largestChildHeight = Math.max(childHeight, largestChildHeight);\n                    }\n                }\n\n                /**\n                 * If applicable, compute the additional offset to the child's baseline\n                 * we'll need later when asked {@link #getBaseline}.\n                 */\n                if ((baselineChildIndex >= 0) && (baselineChildIndex == i + 1)) {\n                    this.mBaselineChildTop = this.mTotalLength;\n                }\n\n                // if we are trying to use a child index for our baseline, the above\n                // book keeping only works if there are no children above it with\n                // weight.  fail fast to aid the developer.\n                if (i < baselineChildIndex && lp.weight > 0) {\n                    throw new Error(\"A child of LinearLayout with index \"\n                        + \"less than mBaselineAlignedChildIndex has weight > 0, which \"\n                        + \"won't work.  Either remove the weight, or don't set \"\n                        + \"mBaselineAlignedChildIndex.\");\n                }\n\n                let matchWidthLocally = false;\n                if (widthMode != MeasureSpec.EXACTLY && lp.width == LinearLayout.LayoutParams.MATCH_PARENT) {\n                    // The width of the linear layout will scale, and at least one\n                    // child said it wanted to match our width. Set a flag\n                    // indicating that we need to remeasure at least that view when\n                    // we know our width.\n                    matchWidth = true;\n                    matchWidthLocally = true;\n                }\n\n                const margin = lp.leftMargin + lp.rightMargin;\n                const measuredWidth = child.getMeasuredWidth() + margin;\n                maxWidth = Math.max(maxWidth, measuredWidth);\n                childState = LinearLayout.combineMeasuredStates(childState, child.getMeasuredState());\n\n                allFillParent = allFillParent && lp.width == LinearLayout.LayoutParams.MATCH_PARENT;\n                if (lp.weight > 0) {\n                    /*\n                     * Widths of weighted Views are bogus if we end up\n                     * remeasuring, so keep them separate.\n                     */\n                    weightedMaxWidth = Math.max(weightedMaxWidth,\n                        matchWidthLocally ? margin : measuredWidth);\n                } else {\n                    alternativeMaxWidth = Math.max(alternativeMaxWidth,\n                        matchWidthLocally ? margin : measuredWidth);\n                }\n\n                i += this.getChildrenSkipCount(child, i);\n            }\n\n            if (this.mTotalLength > 0 && this.hasDividerBeforeChildAt(count)) {\n                this.mTotalLength += this.mDividerHeight;\n            }\n\n            if (useLargestChild &&\n                (heightMode == MeasureSpec.AT_MOST || heightMode == MeasureSpec.UNSPECIFIED)) {\n                this.mTotalLength = 0;\n\n                for (let i = 0; i < count; ++i) {\n                    const child = this.getVirtualChildAt(i);\n\n                    if (child == null) {\n                        this.mTotalLength += this.measureNullChild(i);\n                        continue;\n                    }\n\n                    if (child.getVisibility() == View.GONE) {\n                        i += this.getChildrenSkipCount(child, i);\n                        continue;\n                    }\n\n                    const lp = <LinearLayout.LayoutParams>child.getLayoutParams();\n                    // Account for negative margins\n                    const totalLength = this.mTotalLength;\n                    this.mTotalLength = Math.max(totalLength, totalLength + largestChildHeight +\n                        lp.topMargin + lp.bottomMargin + this.getNextLocationOffset(child));\n                }\n            }\n\n\n            // Add in our padding\n            this.mTotalLength += this.mPaddingTop + this.mPaddingBottom;\n\n            let heightSize = this.mTotalLength;\n\n            // Check against our minimum height\n            heightSize = Math.max(heightSize, this.getSuggestedMinimumHeight());\n\n            // Reconcile our calculated size with the heightMeasureSpec\n            let heightSizeAndState = LinearLayout.resolveSizeAndState(heightSize, heightMeasureSpec, 0);\n            heightSize = heightSizeAndState & View.MEASURED_SIZE_MASK;\n\n            // Either expand children with weight to take up available space or\n            // shrink them if they extend beyond our current bounds\n            let delta = heightSize - this.mTotalLength;\n            if (delta != 0 && totalWeight > 0) {\n                let weightSum = this.mWeightSum > 0 ? this.mWeightSum : totalWeight;\n\n                this.mTotalLength = 0;\n\n                for (let i = 0; i < count; ++i) {\n                    const child = this.getVirtualChildAt(i);\n\n                    if (child.getVisibility() == View.GONE) {\n                        continue;\n                    }\n\n                    let lp = <LinearLayout.LayoutParams>child.getLayoutParams();\n\n                    let childExtra = lp.weight;\n                    if (childExtra > 0) {\n                        // Child said it could absorb extra space -- give him his share\n                        let share = (childExtra * delta / weightSum);\n                        weightSum -= childExtra;\n                        delta -= share;\n\n                        const childWidthMeasureSpec = LinearLayout.getChildMeasureSpec(widthMeasureSpec,\n                            this.mPaddingLeft + this.mPaddingRight +\n                            lp.leftMargin + lp.rightMargin, lp.width);\n\n                        // TODO: Use a field like lp.isMeasured to figure out if this\n                        // child has been previously measured\n                        if ((lp.height != 0) || (heightMode != MeasureSpec.EXACTLY)) {\n                            // child was measured once already above...\n                            // base new measurement on stored values\n                            let childHeight = child.getMeasuredHeight() + share;\n                            if (childHeight < 0) {\n                                childHeight = 0;\n                            }\n\n                            child.measure(childWidthMeasureSpec,\n                                MeasureSpec.makeMeasureSpec(childHeight, MeasureSpec.EXACTLY));\n                        } else {\n                            // child was skipped in the loop above.\n                            // Measure for this first time here\n                            child.measure(childWidthMeasureSpec,\n                                MeasureSpec.makeMeasureSpec(share > 0 ? share : 0,\n                                    MeasureSpec.EXACTLY));\n                        }\n\n                        // Child may now not fit in vertical dimension.\n                        childState = LinearLayout.combineMeasuredStates(childState, child.getMeasuredState()\n                            & (View.MEASURED_STATE_MASK>>View.MEASURED_HEIGHT_STATE_SHIFT));\n                    }\n\n                    const margin =  lp.leftMargin + lp.rightMargin;\n                    const measuredWidth = child.getMeasuredWidth() + margin;\n                    maxWidth = Math.max(maxWidth, measuredWidth);\n\n                    let matchWidthLocally = widthMode != MeasureSpec.EXACTLY &&\n                        lp.width == LinearLayout.LayoutParams.MATCH_PARENT;\n\n                    alternativeMaxWidth = Math.max(alternativeMaxWidth,\n                        matchWidthLocally ? margin : measuredWidth);\n\n                    allFillParent = allFillParent && lp.width == LinearLayout.LayoutParams.MATCH_PARENT;\n\n                    const totalLength = this.mTotalLength;\n                    this.mTotalLength = Math.max(totalLength, totalLength + child.getMeasuredHeight() +\n                        lp.topMargin + lp.bottomMargin + this.getNextLocationOffset(child));\n                }\n\n                // Add in our padding\n                this.mTotalLength += this.mPaddingTop + this.mPaddingBottom;\n                // TODO: Should we recompute the heightSpec based on the new total length?\n            } else {\n                alternativeMaxWidth = Math.max(alternativeMaxWidth, weightedMaxWidth);\n\n\n                // We have no limit, so make all weighted views as tall as the largest child.\n                // Children will have already been measured once.\n                if (useLargestChild && heightMode != MeasureSpec.EXACTLY) {\n                    for (let i = 0; i < count; i++) {\n                        const child = this.getVirtualChildAt(i);\n\n                        if (child == null || child.getVisibility() == View.GONE) {\n                            continue;\n                        }\n\n                        const lp = <LinearLayout.LayoutParams>child.getLayoutParams();\n\n                        let childExtra = lp.weight;\n                        if (childExtra > 0) {\n                            child.measure(\n                                MeasureSpec.makeMeasureSpec(child.getMeasuredWidth(),\n                                    MeasureSpec.EXACTLY),\n                                MeasureSpec.makeMeasureSpec(largestChildHeight,\n                                    MeasureSpec.EXACTLY));\n                        }\n                    }\n                }\n            }\n\n            if (!allFillParent && widthMode != MeasureSpec.EXACTLY) {\n                maxWidth = alternativeMaxWidth;\n            }\n\n            maxWidth += this.mPaddingLeft + this.mPaddingRight;\n\n            // Check against our minimum width\n            maxWidth = Math.max(maxWidth, this.getSuggestedMinimumWidth());\n\n            this.setMeasuredDimension(LinearLayout.resolveSizeAndState(maxWidth, widthMeasureSpec, childState),\n                heightSizeAndState);\n\n            if (matchWidth) {\n                this.forceUniformWidth(count, heightMeasureSpec);\n            }\n        }\n\n        forceUniformWidth(count:number, heightMeasureSpec:number) {\n            // Pretend that the linear layout has an exact size.\n            let uniformMeasureSpec = MeasureSpec.makeMeasureSpec(this.getMeasuredWidth(), MeasureSpec.EXACTLY);\n            for (let i = 0; i< count; ++i) {\n                const child = this.getVirtualChildAt(i);\n                if (child.getVisibility() != View.GONE) {\n                    let lp = <LinearLayout.LayoutParams>child.getLayoutParams();\n\n                    if (lp.width == LinearLayout.LayoutParams.MATCH_PARENT) {\n                        // Temporarily force children to reuse their old measured height\n                        // FIXME: this may not be right for something like wrapping text?\n                        let oldHeight = lp.height;\n                        lp.height = child.getMeasuredHeight();\n\n                        // Remeasue with new dimensions\n                        this.measureChildWithMargins(child, uniformMeasureSpec, 0, heightMeasureSpec, 0);\n                        lp.height = oldHeight;\n                    }\n                }\n            }\n        }\n\n        measureHorizontal(widthMeasureSpec:number, heightMeasureSpec:number) {\n            this.mTotalLength = 0;\n            let maxHeight = 0;\n            let childState = 0;\n            let alternativeMaxHeight = 0;\n            let weightedMaxHeight = 0;\n            let allFillParent = true;\n            let totalWeight = 0;\n\n            const count = this.getVirtualChildCount();\n\n            const widthMode = MeasureSpec.getMode(widthMeasureSpec);\n            const heightMode = MeasureSpec.getMode(heightMeasureSpec);\n\n            let matchHeight = false;\n\n            if (this.mMaxAscent == null || this.mMaxDescent == null) {\n                this.mMaxAscent = androidui.util.ArrayCreator.newNumberArray(LinearLayout.VERTICAL_GRAVITY_COUNT);\n                this.mMaxDescent = androidui.util.ArrayCreator.newNumberArray(LinearLayout.VERTICAL_GRAVITY_COUNT);\n            }\n\n            let maxAscent = this.mMaxAscent;\n            let maxDescent = this.mMaxDescent;\n\n            maxAscent[0] = maxAscent[1] = maxAscent[2] = maxAscent[3] = -1;\n            maxDescent[0] = maxDescent[1] = maxDescent[2] = maxDescent[3] = -1;\n\n            const baselineAligned = this.mBaselineAligned;\n            const useLargestChild = this.mUseLargestChild;\n\n            const isExactly = widthMode == MeasureSpec.EXACTLY;\n\n            let largestChildWidth = Number.MAX_SAFE_INTEGER;\n\n            // See how wide everyone is. Also remember max height.\n            for (let i = 0; i < count; ++i) {\n                const child = this.getVirtualChildAt(i);\n\n                if (child == null) {\n                    this.mTotalLength += this.measureNullChild(i);\n                    continue;\n                }\n\n                if (child.getVisibility() == View.GONE) {\n                    i += this.getChildrenSkipCount(child, i);\n                    continue;\n                }\n\n                if (this.hasDividerBeforeChildAt(i)) {\n                    this.mTotalLength += this.mDividerWidth;\n                }\n\n                const lp = <LinearLayout.LayoutParams>child.getLayoutParams();\n\n                totalWeight += lp.weight;\n\n                if (widthMode == MeasureSpec.EXACTLY && lp.width == 0 && lp.weight > 0) {\n                    // Optimization: don't bother measuring children who are going to use\n                    // leftover space. These views will get measured again down below if\n                    // there is any leftover space.\n                    if (isExactly) {\n                        this.mTotalLength += lp.leftMargin + lp.rightMargin;\n                    } else {\n                        const totalLength = this.mTotalLength;\n                        this.mTotalLength = Math.max(totalLength, totalLength +\n                            lp.leftMargin + lp.rightMargin);\n                    }\n\n                    // Baseline alignment requires to measure widgets to obtain the\n                    // baseline offset (in particular for TextViews). The following\n                    // defeats the optimization mentioned above. Allow the child to\n                    // use as much space as it wants because we can shrink things\n                    // later (and re-measure).\n                    if (baselineAligned) {\n                        const freeSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);\n                        child.measure(freeSpec, freeSpec);\n                    }\n                } else {\n                    let oldWidth = Number.MIN_SAFE_INTEGER;\n\n                    if (lp.width == 0 && lp.weight > 0) {\n                        // widthMode is either UNSPECIFIED or AT_MOST, and this\n                        // child\n                        // wanted to stretch to fill available space. Translate that to\n                        // WRAP_CONTENT so that it does not end up with a width of 0\n                        oldWidth = 0;\n                        lp.width = LinearLayout.LayoutParams.WRAP_CONTENT;\n                    }\n\n                    // Determine how big this child would like to be. If this or\n                    // previous children have given a weight, then we allow it to\n                    // use all available space (and we will shrink things later\n                    // if needed).\n                    this.measureChildBeforeLayout(child, i, widthMeasureSpec,\n                        totalWeight == 0 ? this.mTotalLength : 0,\n                        heightMeasureSpec, 0);\n\n                    if (oldWidth != Number.MIN_SAFE_INTEGER) {\n                        lp.width = oldWidth;\n                    }\n\n                    const childWidth = child.getMeasuredWidth();\n                    if (isExactly) {\n                        this.mTotalLength += childWidth + lp.leftMargin + lp.rightMargin +\n                            this.getNextLocationOffset(child);\n                    } else {\n                        const totalLength = this.mTotalLength;\n                        this.mTotalLength = Math.max(totalLength, totalLength + childWidth + lp.leftMargin +\n                            lp.rightMargin + this.getNextLocationOffset(child));\n                    }\n\n                    if (useLargestChild) {\n                        largestChildWidth = Math.max(childWidth, largestChildWidth);\n                    }\n                }\n\n                let matchHeightLocally = false;\n                if (heightMode != MeasureSpec.EXACTLY && lp.height == LinearLayout.LayoutParams.MATCH_PARENT) {\n                    // The height of the linear layout will scale, and at least one\n                    // child said it wanted to match our height. Set a flag indicating that\n                    // we need to remeasure at least that view when we know our height.\n                    matchHeight = true;\n                    matchHeightLocally = true;\n                }\n\n                const margin = lp.topMargin + lp.bottomMargin;\n                const childHeight = child.getMeasuredHeight() + margin;\n                childState = LinearLayout.combineMeasuredStates(childState, child.getMeasuredState());\n\n                if (baselineAligned) {\n                    const childBaseline = child.getBaseline();\n                    if (childBaseline != -1) {\n                        // Translates the child's vertical gravity into an index\n                        // in the range 0..VERTICAL_GRAVITY_COUNT\n                        const gravity = (lp.gravity < 0 ? this.mGravity : lp.gravity)\n                            & Gravity.VERTICAL_GRAVITY_MASK;\n                        const index = ((gravity >> Gravity.AXIS_Y_SHIFT)\n                            & ~Gravity.AXIS_SPECIFIED) >> 1;\n\n                        maxAscent[index] = Math.max(maxAscent[index], childBaseline);\n                        maxDescent[index] = Math.max(maxDescent[index], childHeight - childBaseline);\n                    }\n                }\n\n                maxHeight = Math.max(maxHeight, childHeight);\n\n                allFillParent = allFillParent && lp.height == LinearLayout.LayoutParams.MATCH_PARENT;\n                if (lp.weight > 0) {\n                    /*\n                     * Heights of weighted Views are bogus if we end up\n                     * remeasuring, so keep them separate.\n                     */\n                    weightedMaxHeight = Math.max(weightedMaxHeight,\n                        matchHeightLocally ? margin : childHeight);\n                } else {\n                    alternativeMaxHeight = Math.max(alternativeMaxHeight,\n                        matchHeightLocally ? margin : childHeight);\n                }\n\n                i += this.getChildrenSkipCount(child, i);\n            }\n\n            if (this.mTotalLength > 0 && this.hasDividerBeforeChildAt(count)) {\n                this.mTotalLength += this.mDividerWidth;\n            }\n\n            // Check mMaxAscent[INDEX_TOP] first because it maps to Gravity.TOP,\n            // the most common case\n            if (maxAscent[LinearLayout.INDEX_TOP] != -1 ||\n                maxAscent[LinearLayout.INDEX_CENTER_VERTICAL] != -1 ||\n                maxAscent[LinearLayout.INDEX_BOTTOM] != -1 ||\n                maxAscent[LinearLayout.INDEX_FILL] != -1) {\n                const ascent = Math.max(maxAscent[LinearLayout.INDEX_FILL],\n                    Math.max(maxAscent[LinearLayout.INDEX_CENTER_VERTICAL],\n                        Math.max(maxAscent[LinearLayout.INDEX_TOP], maxAscent[LinearLayout.INDEX_BOTTOM])));\n                const descent = Math.max(maxDescent[LinearLayout.INDEX_FILL],\n                    Math.max(maxDescent[LinearLayout.INDEX_CENTER_VERTICAL],\n                        Math.max(maxDescent[LinearLayout.INDEX_TOP], maxDescent[LinearLayout.INDEX_BOTTOM])));\n                maxHeight = Math.max(maxHeight, ascent + descent);\n            }\n\n            if (useLargestChild &&\n                (widthMode == MeasureSpec.AT_MOST || widthMode == MeasureSpec.UNSPECIFIED)) {\n                this.mTotalLength = 0;\n\n                for (let i = 0; i < count; ++i) {\n                    const child = this.getVirtualChildAt(i);\n\n                    if (child == null) {\n                        this.mTotalLength += this.measureNullChild(i);\n                        continue;\n                    }\n\n                    if (child.getVisibility() == View.GONE) {\n                        i += this.getChildrenSkipCount(child, i);\n                        continue;\n                    }\n\n                    const lp = <LinearLayout.LayoutParams>child.getLayoutParams();\n                    if (isExactly) {\n                        this.mTotalLength += largestChildWidth + lp.leftMargin + lp.rightMargin +\n                            this.getNextLocationOffset(child);\n                    } else {\n                        const totalLength = this.mTotalLength;\n                        this.mTotalLength = Math.max(totalLength, totalLength + largestChildWidth +\n                            lp.leftMargin + lp.rightMargin + this.getNextLocationOffset(child));\n                    }\n                }\n            }\n\n\n            // Add in our padding\n            this.mTotalLength += this.mPaddingLeft + this.mPaddingRight;\n\n            let widthSize = this.mTotalLength;\n\n            // Check against our minimum width\n            widthSize = Math.max(widthSize, this.getSuggestedMinimumWidth());\n\n            // Reconcile our calculated size with the widthMeasureSpec\n            let widthSizeAndState = LinearLayout.resolveSizeAndState(widthSize, widthMeasureSpec, 0);\n            widthSize = widthSizeAndState & View.MEASURED_SIZE_MASK;\n\n            // Either expand children with weight to take up available space or\n            // shrink them if they extend beyond our current bounds\n            let delta = widthSize - this.mTotalLength;\n            if (delta != 0 && totalWeight > 0) {\n                let weightSum = this.mWeightSum > 0 ? this.mWeightSum : totalWeight;\n\n                maxAscent[0] = maxAscent[1] = maxAscent[2] = maxAscent[3] = -1;\n                maxDescent[0] = maxDescent[1] = maxDescent[2] = maxDescent[3] = -1;\n                maxHeight = -1;\n\n                this.mTotalLength = 0;\n\n                for (let i = 0; i < count; ++i) {\n                    const child = this.getVirtualChildAt(i);\n\n                    if (child == null || child.getVisibility() == View.GONE) {\n                        continue;\n                    }\n\n                    const lp = <LinearLayout.LayoutParams>child.getLayoutParams();\n\n                    let childExtra = lp.weight;\n                    if (childExtra > 0) {\n                        // Child said it could absorb extra space -- give him his share\n                        let share = (childExtra * delta / weightSum);\n                        weightSum -= childExtra;\n                        delta -= share;\n\n                        const childHeightMeasureSpec = LinearLayout.getChildMeasureSpec(\n                            heightMeasureSpec,\n                            this.mPaddingTop + this.mPaddingBottom + lp.topMargin + lp.bottomMargin,\n                            lp.height);\n\n                        // TODO: Use a field like lp.isMeasured to figure out if this\n                        // child has been previously measured\n                        if ((lp.width != 0) || (widthMode != MeasureSpec.EXACTLY)) {\n                            // child was measured once already above ... base new measurement\n                            // on stored values\n                            let childWidth = child.getMeasuredWidth() + share;\n                            if (childWidth < 0) {\n                                childWidth = 0;\n                            }\n\n                            child.measure(\n                                MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY),\n                                childHeightMeasureSpec);\n                        } else {\n                            // child was skipped in the loop above. Measure for this first time here\n                            child.measure(MeasureSpec.makeMeasureSpec(\n                                    share > 0 ? share : 0, MeasureSpec.EXACTLY),\n                                childHeightMeasureSpec);\n                        }\n\n                        // Child may now not fit in horizontal dimension.\n                        childState = LinearLayout.combineMeasuredStates(childState,\n                            child.getMeasuredState() & View.MEASURED_STATE_MASK);\n                    }\n\n                    if (isExactly) {\n                        this.mTotalLength += child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin +\n                            this.getNextLocationOffset(child);\n                    } else {\n                        const totalLength = this.mTotalLength;\n                        this.mTotalLength = Math.max(totalLength, totalLength + child.getMeasuredWidth() +\n                            lp.leftMargin + lp.rightMargin + this.getNextLocationOffset(child));\n                    }\n\n                    let matchHeightLocally = heightMode != MeasureSpec.EXACTLY &&\n                        lp.height == LinearLayout.LayoutParams.MATCH_PARENT;\n\n                    const margin = lp.topMargin + lp .bottomMargin;\n                    let childHeight = child.getMeasuredHeight() + margin;\n                    maxHeight = Math.max(maxHeight, childHeight);\n                    alternativeMaxHeight = Math.max(alternativeMaxHeight,\n                        matchHeightLocally ? margin : childHeight);\n\n                    allFillParent = allFillParent && lp.height == LinearLayout.LayoutParams.MATCH_PARENT;\n\n                    if (baselineAligned) {\n                        const childBaseline = child.getBaseline();\n                        if (childBaseline != -1) {\n                            // Translates the child's vertical gravity into an index in the range 0..2\n                            const gravity = (lp.gravity < 0 ? this.mGravity : lp.gravity)\n                                & Gravity.VERTICAL_GRAVITY_MASK;\n                            const index = ((gravity >> Gravity.AXIS_Y_SHIFT)\n                                & ~Gravity.AXIS_SPECIFIED) >> 1;\n\n                            maxAscent[index] = Math.max(maxAscent[index], childBaseline);\n                            maxDescent[index] = Math.max(maxDescent[index],\n                                childHeight - childBaseline);\n                        }\n                    }\n                }\n\n                // Add in our padding\n                this.mTotalLength += this.mPaddingLeft + this.mPaddingRight;\n                // TODO: Should we update widthSize with the new total length?\n\n                // Check mMaxAscent[INDEX_TOP] first because it maps to Gravity.TOP,\n                // the most common case\n                if (maxAscent[LinearLayout.INDEX_TOP] != -1 ||\n                    maxAscent[LinearLayout.INDEX_CENTER_VERTICAL] != -1 ||\n                    maxAscent[LinearLayout.INDEX_BOTTOM] != -1 ||\n                    maxAscent[LinearLayout.INDEX_FILL] != -1) {\n                    const ascent = Math.max(maxAscent[LinearLayout.INDEX_FILL],\n                        Math.max(maxAscent[LinearLayout.INDEX_CENTER_VERTICAL],\n                            Math.max(maxAscent[LinearLayout.INDEX_TOP], maxAscent[LinearLayout.INDEX_BOTTOM])));\n                    const descent = Math.max(maxDescent[LinearLayout.INDEX_FILL],\n                        Math.max(maxDescent[LinearLayout.INDEX_CENTER_VERTICAL],\n                            Math.max(maxDescent[LinearLayout.INDEX_TOP], maxDescent[LinearLayout.INDEX_BOTTOM])));\n                    maxHeight = Math.max(maxHeight, ascent + descent);\n                }\n            } else {\n                alternativeMaxHeight = Math.max(alternativeMaxHeight, weightedMaxHeight);\n\n                // We have no limit, so make all weighted views as wide as the largest child.\n                // Children will have already been measured once.\n                if (useLargestChild && widthMode != MeasureSpec.EXACTLY) {\n                    for (let i = 0; i < count; i++) {\n                        const child = this.getVirtualChildAt(i);\n\n                        if (child == null || child.getVisibility() == View.GONE) {\n                            continue;\n                        }\n\n                        const lp = <LinearLayout.LayoutParams>child.getLayoutParams();\n\n                        let childExtra = lp.weight;\n                        if (childExtra > 0) {\n                            child.measure(\n                                MeasureSpec.makeMeasureSpec(largestChildWidth, MeasureSpec.EXACTLY),\n                                MeasureSpec.makeMeasureSpec(child.getMeasuredHeight(),\n                                    MeasureSpec.EXACTLY));\n                        }\n                    }\n                }\n            }\n\n            if (!allFillParent && heightMode != MeasureSpec.EXACTLY) {\n                maxHeight = alternativeMaxHeight;\n            }\n\n            maxHeight += this.mPaddingTop + this.mPaddingBottom;\n\n            // Check against our minimum height\n            maxHeight = Math.max(maxHeight, this.getSuggestedMinimumHeight());\n\n            this.setMeasuredDimension(widthSizeAndState | (childState&View.MEASURED_STATE_MASK),\n                LinearLayout.resolveSizeAndState(maxHeight, heightMeasureSpec,\n                    (childState<<View.MEASURED_HEIGHT_STATE_SHIFT)));\n\n            if (matchHeight) {\n                this.forceUniformHeight(count, widthMeasureSpec);\n            }\n        }\n\n        private forceUniformHeight(count:number, widthMeasureSpec:number) {\n            // Pretend that the linear layout has an exact size. This is the measured height of\n            // ourselves. The measured height should be the max height of the children, changed\n            // to accommodate the heightMeasureSpec from the parent\n            let uniformMeasureSpec = MeasureSpec.makeMeasureSpec(this.getMeasuredHeight(),\n                MeasureSpec.EXACTLY);\n            for (let i = 0; i < count; ++i) {\n                const child = this.getVirtualChildAt(i);\n                if (child.getVisibility() != View.GONE) {\n                    let lp = <LinearLayout.LayoutParams>child.getLayoutParams();\n\n                    if (lp.height == LinearLayout.LayoutParams.MATCH_PARENT) {\n                        // Temporarily force children to reuse their old measured width\n                        // FIXME: this may not be right for something like wrapping text?\n                        let oldWidth = lp.width;\n                        lp.width = child.getMeasuredWidth();\n\n                        // Remeasure with new dimensions\n                        this.measureChildWithMargins(child, widthMeasureSpec, 0, uniformMeasureSpec, 0);\n                        lp.width = oldWidth;\n                    }\n                }\n            }\n        }\n\n        getChildrenSkipCount(child:View, index:number):number {\n            return 0;\n        }\n        measureNullChild(childIndex:number):number {\n            return 0;\n        }\n        measureChildBeforeLayout(child:View, childIndex:number, widthMeasureSpec:number,\n                                 totalWidth:number, heightMeasureSpec:number, totalHeight:number) {\n            this.measureChildWithMargins(child, widthMeasureSpec, totalWidth,\n                heightMeasureSpec, totalHeight);\n        }\n        getLocationOffset(child:View):number {\n            return 0;\n        }\n        getNextLocationOffset(child:View) {\n            return 0;\n        }\n\n        protected onLayout(changed:boolean, l:number, t:number, r:number, b:number):void {\n            if (this.mOrientation == LinearLayout.VERTICAL) {\n                this.layoutVertical(l, t, r, b);\n            } else {\n                this.layoutHorizontal(l, t, r, b);\n            }\n        }\n\n        layoutVertical(left:number, top:number, right:number, bottom:number) {\n            const paddingLeft = this.mPaddingLeft;\n\n            let childTop;\n            let childLeft;\n\n            // Where right end of child should go\n            const width = right - left;\n            let childRight = width - this.mPaddingRight;\n\n            // Space available for child\n            let childSpace = width - paddingLeft - this.mPaddingRight;\n\n            const count = this.getVirtualChildCount();\n\n            const majorGravity = this.mGravity & Gravity.VERTICAL_GRAVITY_MASK;\n            const minorGravity = this.mGravity & Gravity.HORIZONTAL_GRAVITY_MASK;\n\n            switch (majorGravity) {\n                case Gravity.BOTTOM:\n                    // mTotalLength contains the padding already\n                    childTop = this.mPaddingTop + bottom - top - this.mTotalLength;\n                    break;\n\n                // mTotalLength contains the padding already\n                case Gravity.CENTER_VERTICAL:\n                    childTop = this.mPaddingTop + (bottom - top - this.mTotalLength) / 2;\n                    break;\n\n                case Gravity.TOP:\n                default:\n                    childTop = this.mPaddingTop;\n                    break;\n            }\n\n            for (let i = 0; i < count; i++) {\n                const child = this.getVirtualChildAt(i);\n                if (child == null) {\n                    childTop += this.measureNullChild(i);\n                } else if (child.getVisibility() != View.GONE) {\n                    const childWidth = child.getMeasuredWidth();\n                    const childHeight = child.getMeasuredHeight();\n\n                    const lp = <LinearLayout.LayoutParams>child.getLayoutParams();\n\n                    let gravity = lp.gravity;\n                    if (gravity < 0) {\n                        gravity = minorGravity;\n                    }\n                    //const layoutDirection = this.getLayoutDirection();\n                    const absoluteGravity = gravity;//Gravity.getAbsoluteGravity(gravity, layoutDirection);\n                    switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n                        case Gravity.CENTER_HORIZONTAL:\n                            childLeft = paddingLeft + ((childSpace - childWidth) / 2)\n                                + lp.leftMargin - lp.rightMargin;\n                            break;\n\n                        case Gravity.RIGHT:\n                            childLeft = childRight - childWidth - lp.rightMargin;\n                            break;\n\n                        case Gravity.LEFT:\n                        default:\n                            childLeft = paddingLeft + lp.leftMargin;\n                            break;\n                    }\n\n                    if (this.hasDividerBeforeChildAt(i)) {\n                        childTop += this.mDividerHeight;\n                    }\n\n                    childTop += lp.topMargin;\n                    this.setChildFrame(child, childLeft, childTop + this.getLocationOffset(child),\n                        childWidth, childHeight);\n                    childTop += childHeight + lp.bottomMargin + this.getNextLocationOffset(child);\n\n                    i += this.getChildrenSkipCount(child, i);\n                }\n            }\n        }\n\n        layoutHorizontal(left:number, top:number, right:number, bottom:number) {\n            const isLayoutRtl = this.isLayoutRtl();\n            const paddingTop = this.mPaddingTop;\n\n            let childTop;\n            let childLeft;\n\n            // Where bottom of child should go\n            const height = bottom - top;\n            let childBottom = height - this.mPaddingBottom;\n\n            // Space available for child\n            let childSpace = height - paddingTop - this.mPaddingBottom;\n\n            const count = this.getVirtualChildCount();\n\n            const majorGravity = this.mGravity & Gravity.HORIZONTAL_GRAVITY_MASK;\n            const minorGravity = this.mGravity & Gravity.VERTICAL_GRAVITY_MASK;\n\n            const baselineAligned = this.mBaselineAligned;\n\n            const maxAscent = this.mMaxAscent;\n            const maxDescent = this.mMaxDescent;\n\n            //const layoutDirection = this.getLayoutDirection();\n            let absoluteGravity = majorGravity;//Gravity.getAbsoluteGravity(majorGravity, layoutDirection);\n            switch (absoluteGravity) {\n                case Gravity.RIGHT:\n                    // mTotalLength contains the padding already\n                    childLeft = this.mPaddingLeft + right - left - this.mTotalLength;\n                    break;\n\n                case Gravity.CENTER_HORIZONTAL:\n                    // mTotalLength contains the padding already\n                    childLeft = this.mPaddingLeft + (right - left - this.mTotalLength) / 2;\n                    break;\n\n                case Gravity.LEFT:\n                default:\n                    childLeft = this.mPaddingLeft;\n                    break;\n            }\n\n            let start = 0;\n            let dir = 1;\n            //In case of RTL, start drawing from the last child.\n            if (isLayoutRtl) {\n                start = count - 1;\n                dir = -1;\n            }\n\n            for (let i = 0; i < count; i++) {\n                let childIndex = start + dir * i;\n                const child = this.getVirtualChildAt(childIndex);\n\n                if (child == null) {\n                    childLeft += this.measureNullChild(childIndex);\n                } else if (child.getVisibility() != View.GONE) {\n                    const childWidth = child.getMeasuredWidth();\n                    const childHeight = child.getMeasuredHeight();\n                    let childBaseline = -1;\n\n                    const lp = <LinearLayout.LayoutParams>child.getLayoutParams();\n\n                    if (baselineAligned && lp.height != LinearLayout.LayoutParams.MATCH_PARENT) {\n                        childBaseline = child.getBaseline();\n                    }\n\n                    let gravity = lp.gravity;\n                    if (gravity < 0) {\n                        gravity = minorGravity;\n                    }\n\n                    switch (gravity & Gravity.VERTICAL_GRAVITY_MASK) {\n                        case Gravity.TOP:\n                            childTop = paddingTop + lp.topMargin;\n                            if (childBaseline != -1) {\n                                childTop += maxAscent[LinearLayout.INDEX_TOP] - childBaseline;\n                            }\n                            break;\n\n                        case Gravity.CENTER_VERTICAL:\n                            // Removed support for baseline alignment when layout_gravity or\n                            // gravity == center_vertical. See bug #1038483.\n                            // Keep the code around if we need to re-enable this feature\n                            // if (childBaseline != -1) {\n                            //     // Align baselines vertically only if the child is smaller than us\n                            //     if (childSpace - childHeight > 0) {\n                            //         childTop = paddingTop + (childSpace / 2) - childBaseline;\n                            //     } else {\n                            //         childTop = paddingTop + (childSpace - childHeight) / 2;\n                            //     }\n                            // } else {\n                            childTop = paddingTop + ((childSpace - childHeight) / 2)\n                                + lp.topMargin - lp.bottomMargin;\n                            break;\n\n                        case Gravity.BOTTOM:\n                            childTop = childBottom - childHeight - lp.bottomMargin;\n                            if (childBaseline != -1) {\n                                let descent = child.getMeasuredHeight() - childBaseline;\n                                childTop -= (maxDescent[LinearLayout.INDEX_BOTTOM] - descent);\n                            }\n                            break;\n                        default:\n                            childTop = paddingTop;\n                            break;\n                    }\n\n                    if (this.hasDividerBeforeChildAt(childIndex)) {\n                        childLeft += this.mDividerWidth;\n                    }\n\n                    childLeft += lp.leftMargin;\n                    this.setChildFrame(child, childLeft + this.getLocationOffset(child), childTop,\n                        childWidth, childHeight);\n                    childLeft += childWidth + lp.rightMargin +\n                        this.getNextLocationOffset(child);\n\n                    i += this.getChildrenSkipCount(child, childIndex);\n                }\n            }\n        }\n\n        private setChildFrame(child:View, left:number, top:number, width:number, height:number){\n            child.layout(left, top, left + width, top + height);\n        }\n\n        setOrientation(orientation:number) {\n            if(typeof orientation === 'string'){\n                if('VERTICAL' === (orientation+'').toUpperCase()) orientation = LinearLayout.VERTICAL;\n                else if('HORIZONTAL' === (orientation+'').toUpperCase()) orientation = LinearLayout.HORIZONTAL;\n            }\n            if (this.mOrientation != orientation) {\n                this.mOrientation = orientation;\n                this.requestLayout();\n            }\n        }\n\n        getOrientation() {\n            return this.mOrientation;\n        }\n\n        setGravity(gravity:number) {\n            if (this.mGravity != gravity) {\n                if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == 0) {\n                    gravity |= Gravity.LEFT;\n                }\n\n                if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) {\n                    gravity |= Gravity.TOP;\n                }\n\n                this.mGravity = gravity;\n                this.requestLayout();\n            }\n        }\n\n        setHorizontalGravity(horizontalGravity:number) {\n            const gravity = horizontalGravity & Gravity.HORIZONTAL_GRAVITY_MASK;\n            if ((this.mGravity & Gravity.HORIZONTAL_GRAVITY_MASK) != gravity) {\n                this.mGravity = (this.mGravity & ~Gravity.HORIZONTAL_GRAVITY_MASK) | gravity;\n                this.requestLayout();\n            }\n        }\n\n        setVerticalGravity(verticalGravity:number) {\n            const gravity = verticalGravity & Gravity.VERTICAL_GRAVITY_MASK;\n            if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) != gravity) {\n                this.mGravity = (this.mGravity & ~Gravity.VERTICAL_GRAVITY_MASK) | gravity;\n                this.requestLayout();\n            }\n        }\n\n        public generateLayoutParamsFromAttr(attrs: HTMLElement): android.view.ViewGroup.LayoutParams {\n            return new LinearLayout.LayoutParams(this.getContext(), attrs);\n        }\n\n        protected generateDefaultLayoutParams():android.view.ViewGroup.LayoutParams {\n            let LayoutParams = LinearLayout.LayoutParams;\n            if (this.mOrientation == LinearLayout.HORIZONTAL) {\n                return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);\n            } else if (this.mOrientation == LinearLayout.VERTICAL) {\n                return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);\n            }\n            return super.generateDefaultLayoutParams();\n        }\n\n        protected generateLayoutParams(p:android.view.ViewGroup.LayoutParams):android.view.ViewGroup.LayoutParams {\n            return new LinearLayout.LayoutParams(p);\n        }\n\n        protected checkLayoutParams(p:android.view.ViewGroup.LayoutParams):boolean {\n            return p instanceof LinearLayout.LayoutParams;\n        }\n    }\n\n    export module LinearLayout{\n        export class LayoutParams extends android.view.ViewGroup.MarginLayoutParams{\n            weight = 0;\n            gravity = -1;\n\n            constructor(context:Context, attrs:HTMLElement);\n            constructor(width:number, height:number);\n            constructor(source:ViewGroup.LayoutParams);\n            constructor(width:number, height:number, weight?:number);\n            constructor(...args) {\n                super(...(() => {\n                    if (args[0] instanceof Context && args[1] instanceof HTMLElement) return [args[0], args[1]];\n                    else if (typeof args[0] === 'number' && typeof args[1] === 'number' && typeof args[2] === 'number') return [args[0], args[1]];\n                    else if (typeof args[0] === 'number' && typeof args[1] === 'number') return [args[0], args[1]];\n                    else if (args[0] instanceof LinearLayout.LayoutParams) return [args[0]];\n                    else if (args[0] instanceof ViewGroup.MarginLayoutParams) return [args[0]];\n                    else if (args[0] instanceof ViewGroup.LayoutParams) return [args[0]];\n                })());\n                if (args[0] instanceof Context && args[1] instanceof HTMLElement) {\n                    const c = <Context>args[0];\n                    const attrs = <HTMLElement>args[1];\n                    const a = c.obtainStyledAttributes(attrs);\n                    this.weight = a.getFloat('layout_weight', 0);\n                    this.gravity = Gravity.parseGravity(a.getAttrValue('layout_gravity'), -1);\n                    a.recycle();\n                } else if (typeof args[0] === 'number' && typeof args[1] === 'number' && typeof args[2] == 'number') {\n                    this.weight = args[2];\n                } else if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n                    this.weight = 0;\n                } else if (args[0] instanceof LinearLayout.LayoutParams) {\n                    const source = <LinearLayout.LayoutParams>args[0];\n                    this.weight = source.weight;\n                    this.gravity = source.gravity;\n                } else if (args[0] instanceof ViewGroup.MarginLayoutParams) {\n                } else if (args[0] instanceof ViewGroup.LayoutParams) {\n                }\n            }\n\n            protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n                return super.createClassAttrBinder().set('layout_gravity', {\n                    setter(param:LayoutParams, value:any, attrBinder:androidui.attr.AttrBinder) {\n                        param.gravity = attrBinder.parseGravity(value, param.gravity);\n                    }, getter(param:LayoutParams) {\n                        return param.gravity;\n                    }\n                }).set('layout_weight', {\n                    setter(param:LayoutParams, value:any, attrBinder:androidui.attr.AttrBinder) {\n                        param.weight = attrBinder.parseFloat(value, param.weight);\n                    }, getter(param:LayoutParams) {\n                        return param.weight;\n                    }\n                });\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "src/android/widget/ListAdapter.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/widget/Adapter.ts\"/>\n\nmodule android.widget {\nimport Adapter = android.widget.Adapter;\n/**\n * Extended {@link Adapter} that is the bridge between a {@link ListView}\n * and the data that backs the list. Frequently that data comes from a Cursor,\n * but that is not\n * required. The ListView can display any data provided that it is wrapped in a\n * ListAdapter.\n */\nexport interface ListAdapter extends Adapter {\n\n    /**\n     * Indicates whether all the items in this adapter are enabled. If the\n     * value returned by this method changes over time, there is no guarantee\n     * it will take effect.  If true, it means all items are selectable and\n     * clickable (there is no separator.)\n     * \n     * @return True if all items are enabled, false otherwise.\n     * \n     * @see #isEnabled(int) \n     */\n    areAllItemsEnabled():boolean ;\n\n    /**\n     * Returns true if the item at the specified position is not a separator.\n     * (A separator is a non-selectable, non-clickable item).\n     * \n     * The result is unspecified if position is invalid. An {@link ArrayIndexOutOfBoundsException}\n     * should be thrown in that case for fast failure.\n     *\n     * @param position Index of the item\n     * \n     * @return True if the item is not a separator\n     * \n     * @see #areAllItemsEnabled() \n     */\n    isEnabled(position:number):boolean ;\n}\n    export module ListAdapter{\n        export function isImpl(obj){\n            return obj && obj['areAllItemsEnabled'] && obj['isEnabled'];\n        }\n    }\n}"
  },
  {
    "path": "src/android/widget/ListPopupWindow.ts",
    "content": "/*\n * Copyright (C) 2010 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/database/DataSetObserver.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/os/Handler.ts\"/>\n///<reference path=\"../../android/text/TextUtils.ts\"/>\n///<reference path=\"../../android/util/Log.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewConfiguration.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/view/ViewParent.ts\"/>\n///<reference path=\"../../android/view/animation/AccelerateDecelerateInterpolator.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../java/lang/Runnable.ts\"/>\n///<reference path=\"../../android/widget/AbsListView.ts\"/>\n///<reference path=\"../../android/widget/Adapter.ts\"/>\n///<reference path=\"../../android/widget/AdapterView.ts\"/>\n///<reference path=\"../../android/widget/LinearLayout.ts\"/>\n///<reference path=\"../../android/widget/ListAdapter.ts\"/>\n///<reference path=\"../../android/widget/ListView.ts\"/>\n///<reference path=\"../../android/widget/PopupWindow.ts\"/>\n///<reference path=\"../../android/widget/Scroller.ts\"/>\n///<reference path=\"../../android/widget/Spinner.ts\"/>\n///<reference path=\"../../android/widget/TextView.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n///<reference path=\"../../android/view/animation/Animation.ts\"/>\n///<reference path=\"../../java/lang/Runnable.ts\"/>\n///<reference path=\"../../android/R/attr.ts\"/>\n\nmodule android.widget {\n//import Animator = android.animation.Animator;\n//import AnimatorListenerAdapter = android.animation.AnimatorListenerAdapter;\n//import ObjectAnimator = android.animation.ObjectAnimator;\nimport DataSetObserver = android.database.DataSetObserver;\nimport Rect = android.graphics.Rect;\nimport Drawable = android.graphics.drawable.Drawable;\nimport Handler = android.os.Handler;\nimport TextUtils = android.text.TextUtils;\n//import IntProperty = android.util.IntProperty;\nimport Log = android.util.Log;\nimport Gravity = android.view.Gravity;\nimport KeyEvent = android.view.KeyEvent;\nimport MotionEvent = android.view.MotionEvent;\nimport View = android.view.View;\nimport MeasureSpec = android.view.View.MeasureSpec;\nimport OnAttachStateChangeListener = android.view.View.OnAttachStateChangeListener;\nimport OnTouchListener = android.view.View.OnTouchListener;\nimport ViewConfiguration = android.view.ViewConfiguration;\nimport ViewGroup = android.view.ViewGroup;\nimport ViewParent = android.view.ViewParent;\nimport AccelerateDecelerateInterpolator = android.view.animation.AccelerateDecelerateInterpolator;\nimport Integer = java.lang.Integer;\nimport Runnable = java.lang.Runnable;\nimport AbsListView = android.widget.AbsListView;\nimport Adapter = android.widget.Adapter;\nimport AdapterView = android.widget.AdapterView;\nimport LinearLayout = android.widget.LinearLayout;\nimport ListAdapter = android.widget.ListAdapter;\nimport ListView = android.widget.ListView;\nimport PopupWindow = android.widget.PopupWindow;\nimport Scroller = android.widget.Scroller;\nimport Spinner = android.widget.Spinner;\nimport TextView = android.widget.TextView;\nimport Context = android.content.Context;\nimport Animation = android.view.animation.Animation;\n/**\n * A ListPopupWindow anchors itself to a host view and displays a\n * list of choices.\n * \n * <p>ListPopupWindow contains a number of tricky behaviors surrounding\n * positioning, scrolling parents to fit the dropdown, interacting\n * sanely with the IME if present, and others.\n * \n * @see android.widget.AutoCompleteTextView\n * @see android.widget.Spinner\n */\nexport class ListPopupWindow {\n\n    private static TAG:string = \"ListPopupWindow\";\n\n    private static DEBUG:boolean = false;\n\n    /**\n     * This value controls the length of time that the user\n     * must leave a pointer down without scrolling to expand\n     * the autocomplete dropdown list to cover the IME.\n     */\n    private static EXPAND_LIST_TIMEOUT:number = 250;\n\n    private mContext:Context;\n\n    private mPopup:PopupWindow;\n\n    private mAdapter:ListAdapter;\n\n    private mDropDownList:ListPopupWindow.DropDownListView;\n\n    private mDropDownHeight:number = ViewGroup.LayoutParams.WRAP_CONTENT;\n\n    private mDropDownWidth:number = ViewGroup.LayoutParams.WRAP_CONTENT;\n\n    private mDropDownHorizontalOffset:number = 0;\n\n    private mDropDownVerticalOffset:number = 0;\n\n    private mDropDownVerticalOffsetSet:boolean;\n\n    private mDropDownGravity:number = Gravity.NO_GRAVITY;\n\n    private mDropDownAlwaysVisible:boolean = false;\n\n    private mForceIgnoreOutsideTouch:boolean = false;\n\n    mListItemExpandMaximum:number = Integer.MAX_VALUE;\n\n    private mPromptView:View;\n\n    private mPromptPosition:number = ListPopupWindow.POSITION_PROMPT_ABOVE;\n\n    private mObserver:DataSetObserver;\n\n    private mDropDownAnchorView:View;\n\n    private mDropDownListHighlight:Drawable;\n\n    private mItemClickListener:AdapterView.OnItemClickListener;\n\n    private mItemSelectedListener:AdapterView.OnItemSelectedListener;\n\n    private mResizePopupRunnable:ListPopupWindow.ResizePopupRunnable = new ListPopupWindow.ResizePopupRunnable(this);\n\n    private mTouchInterceptor:ListPopupWindow.PopupTouchInterceptor = new ListPopupWindow.PopupTouchInterceptor(this);\n\n    private mScrollListener:ListPopupWindow.PopupScrollListener = new ListPopupWindow.PopupScrollListener(this);\n\n    private mHideSelector:ListPopupWindow.ListSelectorHider = new ListPopupWindow.ListSelectorHider(this);\n\n    private mShowDropDownRunnable:Runnable;\n\n    private mHandler:Handler = new Handler();\n\n    private mTempRect:Rect = new Rect();\n\n    private mModal:boolean;\n\n    private mLayoutDirection:number = 0;\n\n    /**\n     * The provided prompt view should appear above list content.\n     * \n     * @see #setPromptPosition(int)\n     * @see #getPromptPosition()\n     * @see #setPromptView(View)\n     */\n    static POSITION_PROMPT_ABOVE:number = 0;\n\n    /**\n     * The provided prompt view should appear below list content.\n     * \n     * @see #setPromptPosition(int)\n     * @see #getPromptPosition()\n     * @see #setPromptView(View)\n     */\n    static POSITION_PROMPT_BELOW:number = 1;\n\n    /**\n     * Alias for {@link ViewGroup.LayoutParams#MATCH_PARENT}.\n     * If used to specify a popup width, the popup will match the width of the anchor view.\n     * If used to specify a popup height, the popup will fill available space.\n     */\n    static MATCH_PARENT:number = ViewGroup.LayoutParams.MATCH_PARENT;\n\n    /**\n     * Alias for {@link ViewGroup.LayoutParams#WRAP_CONTENT}.\n     * If used to specify a popup width, the popup will use the width of its content.\n     */\n    static WRAP_CONTENT:number = ViewGroup.LayoutParams.WRAP_CONTENT;\n\n    /**\n     * Mode for {@link #setInputMethodMode(int)}: the requirements for the\n     * input method should be based on the focusability of the popup.  That is\n     * if it is focusable than it needs to work with the input method, else\n     * it doesn't.\n     */\n    static INPUT_METHOD_FROM_FOCUSABLE:number = PopupWindow.INPUT_METHOD_FROM_FOCUSABLE;\n\n    /**\n     * Mode for {@link #setInputMethodMode(int)}: this popup always needs to\n     * work with an input method, regardless of whether it is focusable.  This\n     * means that it will always be displayed so that the user can also operate\n     * the input method while it is shown.\n     */\n    static INPUT_METHOD_NEEDED:number = PopupWindow.INPUT_METHOD_NEEDED;\n\n    /**\n     * Mode for {@link #setInputMethodMode(int)}: this popup never needs to\n     * work with an input method, regardless of whether it is focusable.  This\n     * means that it will always be displayed to use as much space on the\n     * screen as needed, regardless of whether this covers the input method.\n     */\n    static INPUT_METHOD_NOT_NEEDED:number = PopupWindow.INPUT_METHOD_NOT_NEEDED;\n\n    /**\n     * Create a new, empty popup window capable of displaying items from a ListAdapter.\n     * Backgrounds should be set using {@link #setBackgroundDrawable(Drawable)}.\n     * \n     * @param context Context used for contained views.\n     * @param attrs Attributes from inflating parent views used to style the popup.\n     * @param defStyleAttr Style attribute to read for default styling of popup content.\n     * @param defStyleRes Style resource ID to use for default styling of popup content.\n     */\n    constructor(context:Context, styleAttr=android.R.attr.listPopupWindowStyle) {\n        this.mContext = context;\n        this.mPopup = new PopupWindow(context, styleAttr);\n        this.mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);\n        // Set the default layout direction to match the default locale one\n        //const locale:Locale = this.mContext.getResources().getConfiguration().locale;\n        this.mLayoutDirection = View.LAYOUT_DIRECTION_LTR;//TextUtils.getLayoutDirectionFromLocale(locale);\n    }\n\n    /**\n     * Sets the adapter that provides the data and the views to represent the data\n     * in this popup window.\n     *\n     * @param adapter The adapter to use to create this window's content.\n     */\n    setAdapter(adapter:ListAdapter):void  {\n        if (this.mObserver == null) {\n            this.mObserver = new ListPopupWindow.PopupDataSetObserver(this);\n        } else if (this.mAdapter != null) {\n            this.mAdapter.unregisterDataSetObserver(this.mObserver);\n        }\n        this.mAdapter = adapter;\n        if (this.mAdapter != null) {\n            adapter.registerDataSetObserver(this.mObserver);\n        }\n        if (this.mDropDownList != null) {\n            this.mDropDownList.setAdapter(this.mAdapter);\n        }\n    }\n\n    /**\n     * Set where the optional prompt view should appear. The default is\n     * {@link #POSITION_PROMPT_ABOVE}.\n     * \n     * @param position A position constant declaring where the prompt should be displayed.\n     * \n     * @see #POSITION_PROMPT_ABOVE\n     * @see #POSITION_PROMPT_BELOW\n     */\n    setPromptPosition(position:number):void  {\n        this.mPromptPosition = position;\n    }\n\n    /**\n     * @return Where the optional prompt view should appear.\n     * \n     * @see #POSITION_PROMPT_ABOVE\n     * @see #POSITION_PROMPT_BELOW\n     */\n    getPromptPosition():number  {\n        return this.mPromptPosition;\n    }\n\n    /**\n     * Set whether this window should be modal when shown.\n     * \n     * <p>If a popup window is modal, it will receive all touch and key input.\n     * If the user touches outside the popup window's content area the popup window\n     * will be dismissed.\n     * \n     * @param modal {@code true} if the popup window should be modal, {@code false} otherwise.\n     */\n    setModal(modal:boolean):void  {\n        this.mModal = true;\n        this.mPopup.setFocusable(modal);\n    }\n\n    /**\n     * Returns whether the popup window will be modal when shown.\n     * \n     * @return {@code true} if the popup window will be modal, {@code false} otherwise.\n     */\n    isModal():boolean  {\n        return this.mModal;\n    }\n\n    /**\n     * Forces outside touches to be ignored. Normally if {@link #isDropDownAlwaysVisible()} is\n     * false, we allow outside touch to dismiss the dropdown. If this is set to true, then we\n     * ignore outside touch even when the drop down is not set to always visible.\n     * \n     * @hide Used only by AutoCompleteTextView to handle some internal special cases.\n     */\n    setForceIgnoreOutsideTouch(forceIgnoreOutsideTouch:boolean):void  {\n        this.mForceIgnoreOutsideTouch = forceIgnoreOutsideTouch;\n    }\n\n    /**\n     * Sets whether the drop-down should remain visible under certain conditions.\n     *\n     * The drop-down will occupy the entire screen below {@link #getAnchorView} regardless\n     * of the size or content of the list.  {@link #getBackground()} will fill any space\n     * that is not used by the list.\n     *\n     * @param dropDownAlwaysVisible Whether to keep the drop-down visible.\n     *\n     * @hide Only used by AutoCompleteTextView under special conditions.\n     */\n    setDropDownAlwaysVisible(dropDownAlwaysVisible:boolean):void  {\n        this.mDropDownAlwaysVisible = dropDownAlwaysVisible;\n    }\n\n    /**\n     * @return Whether the drop-down is visible under special conditions.\n     *\n     * @hide Only used by AutoCompleteTextView under special conditions.\n     */\n    isDropDownAlwaysVisible():boolean  {\n        return this.mDropDownAlwaysVisible;\n    }\n\n    ///**\n    // * Sets the operating mode for the soft input area.\n    // *\n    // * @param mode The desired mode, see\n    // *        {@link android.view.WindowManager.LayoutParams#softInputMode}\n    // *        for the full list\n    // *\n    // * @see android.view.WindowManager.LayoutParams#softInputMode\n    // * @see #getSoftInputMode()\n    // */\n    //setSoftInputMode(mode:number):void  {\n    //    this.mPopup.setSoftInputMode(mode);\n    //}\n    //\n    ///**\n    // * Returns the current value in {@link #setSoftInputMode(int)}.\n    // *\n    // * @see #setSoftInputMode(int)\n    // * @see android.view.WindowManager.LayoutParams#softInputMode\n    // */\n    //getSoftInputMode():number  {\n    //    return this.mPopup.getSoftInputMode();\n    //}\n    //\n    ///**\n    // * Sets a drawable to use as the list item selector.\n    // *\n    // * @param selector List selector drawable to use in the popup.\n    // */\n    //setListSelector(selector:Drawable):void  {\n    //    this.mDropDownListHighlight = selector;\n    //}\n\n    /**\n     * @return The background drawable for the popup window.\n     */\n    getBackground():Drawable  {\n        return this.mPopup.getBackground();\n    }\n\n    /**\n     * Sets a drawable to be the background for the popup window.\n     * \n     * @param d A drawable to set as the background.\n     */\n    setBackgroundDrawable(d:Drawable):void  {\n        this.mPopup.setBackgroundDrawable(d);\n    }\n\n    /**\n     * Set an animation to use when the popup window is shown or dismissed.\n     */\n    setWindowAnimation(enterAnimation:Animation, exitAnimation:Animation):void  {\n        this.mPopup.setWindowAnimation(enterAnimation, exitAnimation);\n    }\n\n    /**\n     * <p>Return the animation style to use the popup appears</p>\n     */\n    getEnterAnimation():Animation  {\n        return this.mPopup.mEnterAnimation;\n    }\n    /**\n     * <p>Return the animation style to use the popup appears</p>\n     */\n    getExitAnimation():Animation  {\n        return this.mPopup.mExitAnimation;\n    }\n\n    /**\n     * Returns the view that will be used to anchor this popup.\n     * \n     * @return The popup's anchor view\n     */\n    getAnchorView():View  {\n        return this.mDropDownAnchorView;\n    }\n\n    /**\n     * Sets the popup's anchor view. This popup will always be positioned relative to\n     * the anchor view when shown.\n     * \n     * @param anchor The view to use as an anchor.\n     */\n    setAnchorView(anchor:View):void  {\n        this.mDropDownAnchorView = anchor;\n    }\n\n    /**\n     * @return The horizontal offset of the popup from its anchor in pixels.\n     */\n    getHorizontalOffset():number  {\n        return this.mDropDownHorizontalOffset;\n    }\n\n    /**\n     * Set the horizontal offset of this popup from its anchor view in pixels.\n     * \n     * @param offset The horizontal offset of the popup from its anchor.\n     */\n    setHorizontalOffset(offset:number):void  {\n        this.mDropDownHorizontalOffset = offset;\n    }\n\n    /**\n     * @return The vertical offset of the popup from its anchor in pixels.\n     */\n    getVerticalOffset():number  {\n        if (!this.mDropDownVerticalOffsetSet) {\n            return 0;\n        }\n        return this.mDropDownVerticalOffset;\n    }\n\n    /**\n     * Set the vertical offset of this popup from its anchor view in pixels.\n     * \n     * @param offset The vertical offset of the popup from its anchor.\n     */\n    setVerticalOffset(offset:number):void  {\n        this.mDropDownVerticalOffset = offset;\n        this.mDropDownVerticalOffsetSet = true;\n    }\n\n    /**\n     * Set the gravity of the dropdown list. This is commonly used to\n     * set gravity to START or END for alignment with the anchor.\n     *\n     * @param gravity Gravity value to use\n     */\n    setDropDownGravity(gravity:number):void  {\n        this.mDropDownGravity = gravity;\n    }\n\n    /**\n     * @return The width of the popup window in pixels.\n     */\n    getWidth():number  {\n        return this.mDropDownWidth;\n    }\n\n    /**\n     * Sets the width of the popup window in pixels. Can also be {@link #MATCH_PARENT}\n     * or {@link #WRAP_CONTENT}.\n     * \n     * @param width Width of the popup window.\n     */\n    setWidth(width:number):void  {\n        this.mDropDownWidth = width;\n    }\n\n    /**\n     * Sets the width of the popup window by the size of its content. The final width may be\n     * larger to accommodate styled window dressing.\n     *\n     * @param width Desired width of content in pixels.\n     */\n    setContentWidth(width:number):void  {\n        let popupBackground:Drawable = this.mPopup.getBackground();\n        if (popupBackground != null) {\n            popupBackground.getPadding(this.mTempRect);\n            this.mDropDownWidth = this.mTempRect.left + this.mTempRect.right + width;\n        } else {\n            this.setWidth(width);\n        }\n    }\n\n    /**\n     * @return The height of the popup window in pixels.\n     */\n    getHeight():number  {\n        return this.mDropDownHeight;\n    }\n\n    /**\n     * Sets the height of the popup window in pixels. Can also be {@link #MATCH_PARENT}.\n     * \n     * @param height Height of the popup window.\n     */\n    setHeight(height:number):void  {\n        this.mDropDownHeight = height;\n    }\n\n    /**\n     * Sets a listener to receive events when a list item is clicked.\n     * \n     * @param clickListener Listener to register\n     * \n     * @see ListView#setOnItemClickListener(android.widget.AdapterView.OnItemClickListener)\n     */\n    setOnItemClickListener(clickListener:AdapterView.OnItemClickListener):void  {\n        this.mItemClickListener = clickListener;\n    }\n\n    /**\n     * Sets a listener to receive events when a list item is selected.\n     * \n     * @param selectedListener Listener to register.\n     * \n     * @see ListView#setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener)\n     */\n    setOnItemSelectedListener(selectedListener:AdapterView.OnItemSelectedListener):void  {\n        this.mItemSelectedListener = selectedListener;\n    }\n\n    /**\n     * Set a view to act as a user prompt for this popup window. Where the prompt view will appear\n     * is controlled by {@link #setPromptPosition(int)}.\n     * \n     * @param prompt View to use as an informational prompt.\n     */\n    setPromptView(prompt:View):void  {\n        let showing:boolean = this.isShowing();\n        if (showing) {\n            this.removePromptView();\n        }\n        this.mPromptView = prompt;\n        if (showing) {\n            this.show();\n        }\n    }\n\n    /**\n     * Post a {@link #show()} call to the UI thread.\n     */\n    postShow():void  {\n        this.mHandler.post(this.mShowDropDownRunnable);\n    }\n\n    /**\n     * Show the popup list. If the list is already showing, this method\n     * will recalculate the popup's size and position.\n     */\n    show():void  {\n        let height:number = this.buildDropDown();\n        let widthSpec:number = 0;\n        let heightSpec:number = 0;\n        let noInputMethod:boolean = this.isInputMethodNotNeeded();\n        this.mPopup.setAllowScrollingAnchorParent(!noInputMethod);\n        if (this.mPopup.isShowing()) {\n            if (this.mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) {\n                // The call to PopupWindow's update method below can accept -1 for any\n                // value you do not want to update.\n                widthSpec = -1;\n            } else if (this.mDropDownWidth == ViewGroup.LayoutParams.WRAP_CONTENT) {\n                widthSpec = this.getAnchorView().getWidth();\n            } else {\n                widthSpec = this.mDropDownWidth;\n            }\n            if (this.mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {\n                // The call to PopupWindow's update method below can accept -1 for any\n                // value you do not want to update.\n                heightSpec = noInputMethod ? height : ViewGroup.LayoutParams.MATCH_PARENT;\n                if (noInputMethod) {\n                    this.mPopup.setWindowLayoutMode(this.mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT ? ViewGroup.LayoutParams.MATCH_PARENT : 0, 0);\n                } else {\n                    this.mPopup.setWindowLayoutMode(this.mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT ? ViewGroup.LayoutParams.MATCH_PARENT : 0, ViewGroup.LayoutParams.MATCH_PARENT);\n                }\n            } else if (this.mDropDownHeight == ViewGroup.LayoutParams.WRAP_CONTENT) {\n                heightSpec = height;\n            } else {\n                heightSpec = this.mDropDownHeight;\n            }\n            this.mPopup.setOutsideTouchable(!this.mForceIgnoreOutsideTouch && !this.mDropDownAlwaysVisible);\n            this.mPopup.update(this.getAnchorView(), this.mDropDownHorizontalOffset, this.mDropDownVerticalOffset, widthSpec, heightSpec);\n        } else {\n            if (this.mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) {\n                widthSpec = ViewGroup.LayoutParams.MATCH_PARENT;\n            } else {\n                if (this.mDropDownWidth == ViewGroup.LayoutParams.WRAP_CONTENT) {\n                    this.mPopup.setWidth(this.getAnchorView().getWidth());\n                } else {\n                    this.mPopup.setWidth(this.mDropDownWidth);\n                }\n            }\n            if (this.mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {\n                heightSpec = ViewGroup.LayoutParams.MATCH_PARENT;\n            } else {\n                if (this.mDropDownHeight == ViewGroup.LayoutParams.WRAP_CONTENT) {\n                    this.mPopup.setHeight(height);\n                } else {\n                    this.mPopup.setHeight(this.mDropDownHeight);\n                }\n            }\n            this.mPopup.setWindowLayoutMode(widthSpec, heightSpec);\n            this.mPopup.setClipToScreenEnabled(true);\n            // use outside touchable to dismiss drop down when touching outside of it, so\n            // only set this if the dropdown is not always visible\n            this.mPopup.setOutsideTouchable(!this.mForceIgnoreOutsideTouch && !this.mDropDownAlwaysVisible);\n            this.mPopup.setTouchInterceptor(this.mTouchInterceptor);\n            this.mPopup.showAsDropDown(this.getAnchorView(), this.mDropDownHorizontalOffset, this.mDropDownVerticalOffset, this.mDropDownGravity);\n            this.mDropDownList.setSelection(ListView.INVALID_POSITION);\n            if (!this.mModal || this.mDropDownList.isInTouchMode()) {\n                this.clearListSelection();\n            }\n            if (!this.mModal) {\n                this.mHandler.post(this.mHideSelector);\n            }\n        }\n    }\n\n    /**\n     * Dismiss the popup window.\n     */\n    dismiss():void  {\n        this.mPopup.dismiss();\n        this.removePromptView();\n        this.mPopup.setContentView(null);\n        this.mDropDownList = null;\n        this.mHandler.removeCallbacks(this.mResizePopupRunnable);\n    }\n\n    /**\n     * Set a listener to receive a callback when the popup is dismissed.\n     *\n     * @param listener Listener that will be notified when the popup is dismissed.\n     */\n    setOnDismissListener(listener:PopupWindow.OnDismissListener):void  {\n        this.mPopup.setOnDismissListener(listener);\n    }\n\n    private removePromptView():void  {\n        if (this.mPromptView != null) {\n            const parent:ViewParent = this.mPromptView.getParent();\n            if (parent instanceof ViewGroup) {\n                const group:ViewGroup = <ViewGroup> parent;\n                group.removeView(this.mPromptView);\n            }\n        }\n    }\n\n    /**\n     * Control how the popup operates with an input method: one of\n     * {@link #INPUT_METHOD_FROM_FOCUSABLE}, {@link #INPUT_METHOD_NEEDED},\n     * or {@link #INPUT_METHOD_NOT_NEEDED}.\n     * \n     * <p>If the popup is showing, calling this method will take effect only\n     * the next time the popup is shown or through a manual call to the {@link #show()}\n     * method.</p>\n     * \n     * @see #getInputMethodMode()\n     * @see #show()\n     */\n    setInputMethodMode(mode:number):void  {\n        this.mPopup.setInputMethodMode(mode);\n    }\n\n    /**\n     * Return the current value in {@link #setInputMethodMode(int)}.\n     * \n     * @see #setInputMethodMode(int)\n     */\n    getInputMethodMode():number  {\n        return this.mPopup.getInputMethodMode();\n    }\n\n    /**\n     * Set the selected position of the list.\n     * Only valid when {@link #isShowing()} == {@code true}.\n     * \n     * @param position List position to set as selected.\n     */\n    setSelection(position:number):void  {\n        let list:ListPopupWindow.DropDownListView = this.mDropDownList;\n        if (this.isShowing() && list != null) {\n            list.mListSelectionHidden = false;\n            list.setSelection(position);\n            if (list.getChoiceMode() != ListView.CHOICE_MODE_NONE) {\n                list.setItemChecked(position, true);\n            }\n        }\n    }\n\n    /**\n     * Clear any current list selection.\n     * Only valid when {@link #isShowing()} == {@code true}.\n     */\n    clearListSelection():void  {\n        const list:ListPopupWindow.DropDownListView = this.mDropDownList;\n        if (list != null) {\n            // WARNING: Please read the comment where mListSelectionHidden is declared\n            list.mListSelectionHidden = true;\n            list.hideSelector();\n            list.requestLayout();\n        }\n    }\n\n    /**\n     * @return {@code true} if the popup is currently showing, {@code false} otherwise.\n     */\n    isShowing():boolean  {\n        return this.mPopup.isShowing();\n    }\n\n    /**\n     * @return {@code true} if this popup is configured to assume the user does not need\n     * to interact with the IME while it is showing, {@code false} otherwise.\n     */\n    isInputMethodNotNeeded():boolean  {\n        return this.mPopup.getInputMethodMode() == ListPopupWindow.INPUT_METHOD_NOT_NEEDED;\n    }\n\n    /**\n     * Perform an item click operation on the specified list adapter position.\n     * \n     * @param position Adapter position for performing the click\n     * @return true if the click action could be performed, false if not.\n     *         (e.g. if the popup was not showing, this method would return false.)\n     */\n    performItemClick(position:number):boolean  {\n        if (this.isShowing()) {\n            if (this.mItemClickListener != null) {\n                const list:ListPopupWindow.DropDownListView = this.mDropDownList;\n                const child:View = list.getChildAt(position - list.getFirstVisiblePosition());\n                const adapter:ListAdapter = list.getAdapter();\n                this.mItemClickListener.onItemClick(list, child, position, adapter.getItemId(position));\n            }\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * @return The currently selected item or null if the popup is not showing.\n     */\n    getSelectedItem():any  {\n        if (!this.isShowing()) {\n            return null;\n        }\n        return this.mDropDownList.getSelectedItem();\n    }\n\n    /**\n     * @return The position of the currently selected item or {@link ListView#INVALID_POSITION}\n     * if {@link #isShowing()} == {@code false}.\n     * \n     * @see ListView#getSelectedItemPosition()\n     */\n    getSelectedItemPosition():number  {\n        if (!this.isShowing()) {\n            return ListView.INVALID_POSITION;\n        }\n        return this.mDropDownList.getSelectedItemPosition();\n    }\n\n    /**\n     * @return The ID of the currently selected item or {@link ListView#INVALID_ROW_ID}\n     * if {@link #isShowing()} == {@code false}.\n     * \n     * @see ListView#getSelectedItemId()\n     */\n    getSelectedItemId():number  {\n        if (!this.isShowing()) {\n            return ListView.INVALID_ROW_ID;\n        }\n        return this.mDropDownList.getSelectedItemId();\n    }\n\n    /**\n     * @return The View for the currently selected item or null if\n     * {@link #isShowing()} == {@code false}.\n     * \n     * @see ListView#getSelectedView()\n     */\n    getSelectedView():View  {\n        if (!this.isShowing()) {\n            return null;\n        }\n        return this.mDropDownList.getSelectedView();\n    }\n\n    /**\n     * @return The {@link ListView} displayed within the popup window.\n     * Only valid when {@link #isShowing()} == {@code true}.\n     */\n    getListView():ListView  {\n        return this.mDropDownList;\n    }\n\n    /**\n     * The maximum number of list items that can be visible and still have\n     * the list expand when touched.\n     *\n     * @param max Max number of items that can be visible and still allow the list to expand.\n     */\n    setListItemExpandMax(max:number):void  {\n        this.mListItemExpandMaximum = max;\n    }\n\n    /**\n     * Filter key down events. By forwarding key down events to this function,\n     * views using non-modal ListPopupWindow can have it handle key selection of items.\n     *  \n     * @param keyCode keyCode param passed to the host view's onKeyDown\n     * @param event event param passed to the host view's onKeyDown\n     * @return true if the event was handled, false if it was ignored.\n     * \n     * @see #setModal(boolean)\n     */\n    onKeyDown(keyCode:number, event:KeyEvent):boolean  {\n        // when the drop down is shown, we drive it directly\n        if (this.isShowing()) {\n            // to select one of its items\n            if (keyCode != KeyEvent.KEYCODE_SPACE && (this.mDropDownList.getSelectedItemPosition() >= 0 || !KeyEvent.isConfirmKey(keyCode))) {\n                let curIndex:number = this.mDropDownList.getSelectedItemPosition();\n                let consumed:boolean;\n                const below:boolean = !this.mPopup.isAboveAnchor();\n                const adapter:ListAdapter = this.mAdapter;\n                let allEnabled:boolean;\n                let firstItem:number = Integer.MAX_VALUE;\n                let lastItem:number = Integer.MIN_VALUE;\n                if (adapter != null) {\n                    allEnabled = adapter.areAllItemsEnabled();\n                    firstItem = allEnabled ? 0 : this.mDropDownList.lookForSelectablePosition(0, true);\n                    lastItem = allEnabled ? adapter.getCount() - 1 : this.mDropDownList.lookForSelectablePosition(adapter.getCount() - 1, false);\n                }\n                if ((below && keyCode == KeyEvent.KEYCODE_DPAD_UP && curIndex <= firstItem) || (!below && keyCode == KeyEvent.KEYCODE_DPAD_DOWN && curIndex >= lastItem)) {\n                    // When the selection is at the top, we block the key\n                    // event to prevent focus from moving.\n                    this.clearListSelection();\n                    this.mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);\n                    this.show();\n                    return true;\n                } else {\n                    // WARNING: Please read the comment where mListSelectionHidden\n                    //          is declared\n                    this.mDropDownList.mListSelectionHidden = false;\n                }\n                consumed = this.mDropDownList.onKeyDown(keyCode, event);\n                if (ListPopupWindow.DEBUG)\n                    Log.v(ListPopupWindow.TAG, \"Key down: code=\" + keyCode + \" list consumed=\" + consumed);\n                if (consumed) {\n                    // If it handled the key event, then the user is\n                    // navigating in the list, so we should put it in front.\n                    this.mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);\n                    // Here's a little trick we need to do to make sure that\n                    // the list view is actually showing its focus indicator,\n                    // by ensuring it has focus and getting its window out\n                    // of touch mode.\n                    this.mDropDownList.requestFocusFromTouch();\n                    this.show();\n                    switch(keyCode) {\n                        // next component\n                        case KeyEvent.KEYCODE_ENTER:\n                        case KeyEvent.KEYCODE_DPAD_CENTER:\n                        case KeyEvent.KEYCODE_DPAD_DOWN:\n                        case KeyEvent.KEYCODE_DPAD_UP:\n                            return true;\n                    }\n                } else {\n                    if (below && keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {\n                        // event to avoid going to the next focusable widget\n                        if (curIndex == lastItem) {\n                            return true;\n                        }\n                    } else if (!below && keyCode == KeyEvent.KEYCODE_DPAD_UP && curIndex == firstItem) {\n                        return true;\n                    }\n                }\n            }\n        }\n        return false;\n    }\n\n    /**\n     * Filter key down events. By forwarding key up events to this function,\n     * views using non-modal ListPopupWindow can have it handle key selection of items.\n     *  \n     * @param keyCode keyCode param passed to the host view's onKeyUp\n     * @param event event param passed to the host view's onKeyUp\n     * @return true if the event was handled, false if it was ignored.\n     * \n     * @see #setModal(boolean)\n     */\n    onKeyUp(keyCode:number, event:KeyEvent):boolean  {\n        if (this.isShowing() && this.mDropDownList.getSelectedItemPosition() >= 0) {\n            let consumed:boolean = this.mDropDownList.onKeyUp(keyCode, event);\n            if (consumed && KeyEvent.isConfirmKey(keyCode)) {\n                // if the list accepts the key events and the key event was a click, the text view\n                // gets the selected item from the drop down as its content\n                this.dismiss();\n            }\n            return consumed;\n        }\n        return false;\n    }\n\n    /**\n     * Filter pre-IME key events. By forwarding {@link View#onKeyPreIme(int, KeyEvent)}\n     * events to this function, views using ListPopupWindow can have it dismiss the popup\n     * when the back key is pressed.\n     *  \n     * @param keyCode keyCode param passed to the host view's onKeyPreIme\n     * @param event event param passed to the host view's onKeyPreIme\n     * @return true if the event was handled, false if it was ignored.\n     * \n     * @see #setModal(boolean)\n     */\n    onKeyPreIme(keyCode:number, event:KeyEvent):boolean  {\n        if (keyCode == KeyEvent.KEYCODE_BACK && this.isShowing()) {\n            // special case for the back key, we do not even try to send it\n            // to the drop down list but instead, consume it immediately\n            const anchorView:View = this.mDropDownAnchorView;\n            if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {\n                let state:KeyEvent.DispatcherState = anchorView.getKeyDispatcherState();\n                if (state != null) {\n                    state.startTracking(event, this);\n                }\n                return true;\n            } else if (event.getAction() == KeyEvent.ACTION_UP) {\n                let state:KeyEvent.DispatcherState = anchorView.getKeyDispatcherState();\n                if (state != null) {\n                    state.handleUpEvent(event);\n                }\n                if (event.isTracking() && !event.isCanceled()) {\n                    this.dismiss();\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n\n    /**\n     * Returns an {@link OnTouchListener} that can be added to the source view\n     * to implement drag-to-open behavior. Generally, the source view should be\n     * the same view that was passed to {@link #setAnchorView}.\n     * <p>\n     * When the listener is set on a view, touching that view and dragging\n     * outside of its bounds will open the popup window. Lifting will select the\n     * currently touched list item.\n     * <p>\n     * Example usage:\n     * <pre>\n     * ListPopupWindow myPopup = new ListPopupWindow(context);\n     * myPopup.setAnchor(myAnchor);\n     * OnTouchListener dragListener = myPopup.createDragToOpenListener(myAnchor);\n     * myAnchor.setOnTouchListener(dragListener);\n     * </pre>\n     *\n     * @param src the view on which the resulting listener will be set\n     * @return a touch listener that controls drag-to-open behavior\n     */\n    createDragToOpenListener(src:View):OnTouchListener  {\n        return (()=>{\n            const inner_this=this;\n            class _Inner extends ListPopupWindow.ForwardingListener {\n                getPopup():ListPopupWindow  {\n                    return inner_this;\n                }\n            }\n            return new _Inner(src);\n        })();\n    }\n\n    /**\n     * <p>Builds the popup window's content and returns the height the popup\n     * should have. Returns -1 when the content already exists.</p>\n     *\n     * @return the content's height or -1 if content already exists\n     */\n    private buildDropDown():number  {\n        let dropDownView:ViewGroup;\n        let otherHeights:number = 0;\n        if (this.mDropDownList == null) {\n            let context:Context = this.mContext;\n            /**\n             * This Runnable exists for the sole purpose of checking if the view layout has got\n             * completed and if so call showDropDown to display the drop down. This is used to show\n             * the drop down as soon as possible after user opens up the search dialog, without\n             * waiting for the normal UI pipeline to do it's job which is slower than this method.\n             */\n            this.mShowDropDownRunnable = (()=>{\n                const inner_this=this;\n                class _Inner implements Runnable {\n                    run():void  {\n                        // View layout should be all done before displaying the drop down.\n                        let view:View = inner_this.getAnchorView();\n                        if (view != null && view.isAttachedToWindow()) {\n                            inner_this.show();\n                        }\n                    }\n                }\n                return new _Inner();\n            })();\n            this.mDropDownList = new ListPopupWindow.DropDownListView(context, !this.mModal);\n            if (this.mDropDownListHighlight != null) {\n                this.mDropDownList.setSelector(this.mDropDownListHighlight);\n            }\n            this.mDropDownList.setAdapter(this.mAdapter);\n            this.mDropDownList.setOnItemClickListener(this.mItemClickListener);\n            this.mDropDownList.setFocusable(true);\n            this.mDropDownList.setFocusableInTouchMode(true);\n            this.mDropDownList.setOnItemSelectedListener((()=>{\n                const inner_this=this;\n                class _Inner implements AdapterView.OnItemSelectedListener {\n\n                    onItemSelected(parent:AdapterView<any>, view:View, position:number, id:number):void  {\n                        if (position != -1) {\n                            let dropDownList:ListPopupWindow.DropDownListView = inner_this.mDropDownList;\n                            if (dropDownList != null) {\n                                dropDownList.mListSelectionHidden = false;\n                            }\n                        }\n                    }\n\n                    onNothingSelected(parent:AdapterView<any>):void  {\n                    }\n                }\n                return new _Inner();\n            })());\n            this.mDropDownList.setOnScrollListener(this.mScrollListener);\n            if (this.mItemSelectedListener != null) {\n                this.mDropDownList.setOnItemSelectedListener(this.mItemSelectedListener);\n            }\n            dropDownView = this.mDropDownList;\n            let hintView:View = this.mPromptView;\n            if (hintView != null) {\n                // if a hint has been specified, we accomodate more space for it and\n                // add a text view in the drop down menu, at the bottom of the list\n                let hintContainer:LinearLayout = new LinearLayout(context);\n                hintContainer.setOrientation(LinearLayout.VERTICAL);\n                let hintParams:LinearLayout.LayoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1.0);\n                switch(this.mPromptPosition) {\n                    case ListPopupWindow.POSITION_PROMPT_BELOW:\n                        hintContainer.addView(dropDownView, hintParams);\n                        hintContainer.addView(hintView);\n                        break;\n                    case ListPopupWindow.POSITION_PROMPT_ABOVE:\n                        hintContainer.addView(hintView);\n                        hintContainer.addView(dropDownView, hintParams);\n                        break;\n                    default:\n                        Log.e(ListPopupWindow.TAG, \"Invalid hint position \" + this.mPromptPosition);\n                        break;\n                }\n                // measure the hint's height to find how much more vertical space\n                // we need to add to the drop down's height\n                let widthSpec:number = MeasureSpec.makeMeasureSpec(this.mDropDownWidth, MeasureSpec.AT_MOST);\n                let heightSpec:number = MeasureSpec.UNSPECIFIED;\n                hintView.measure(widthSpec, heightSpec);\n                hintParams = <LinearLayout.LayoutParams> hintView.getLayoutParams();\n                otherHeights = hintView.getMeasuredHeight() + hintParams.topMargin + hintParams.bottomMargin;\n                dropDownView = hintContainer;\n            }\n            this.mPopup.setContentView(dropDownView);\n        } else {\n            dropDownView = <ViewGroup> this.mPopup.getContentView();\n            const view:View = this.mPromptView;\n            if (view != null) {\n                let hintParams:LinearLayout.LayoutParams = <LinearLayout.LayoutParams> view.getLayoutParams();\n                otherHeights = view.getMeasuredHeight() + hintParams.topMargin + hintParams.bottomMargin;\n            }\n        }\n        // getMaxAvailableHeight() subtracts the padding, so we put it back\n        // to get the available height for the whole window\n        let padding:number = 0;\n        let background:Drawable = this.mPopup.getBackground();\n        if (background != null) {\n            background.getPadding(this.mTempRect);\n            padding = this.mTempRect.top + this.mTempRect.bottom;\n            // background so that content will line up.\n            if (!this.mDropDownVerticalOffsetSet) {\n                this.mDropDownVerticalOffset = -this.mTempRect.top;\n            }\n        } else {\n            this.mTempRect.setEmpty();\n        }\n        // Max height available on the screen for a popup.\n        let ignoreBottomDecorations:boolean = this.mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;\n        const maxHeight:number = this.mPopup.getMaxAvailableHeight(this.getAnchorView(), this.mDropDownVerticalOffset, ignoreBottomDecorations);\n        if (this.mDropDownAlwaysVisible || this.mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {\n            return maxHeight + padding;\n        }\n        let childWidthSpec:number;\n        switch(this.mDropDownWidth) {\n            case ViewGroup.LayoutParams.WRAP_CONTENT:\n                childWidthSpec = MeasureSpec.makeMeasureSpec(this.mContext.getResources().getDisplayMetrics().widthPixels - (this.mTempRect.left + this.mTempRect.right), MeasureSpec.AT_MOST);\n                break;\n            case ViewGroup.LayoutParams.MATCH_PARENT:\n                childWidthSpec = MeasureSpec.makeMeasureSpec(this.mContext.getResources().getDisplayMetrics().widthPixels - (this.mTempRect.left + this.mTempRect.right), MeasureSpec.EXACTLY);\n                break;\n            default:\n                childWidthSpec = MeasureSpec.makeMeasureSpec(this.mDropDownWidth, MeasureSpec.EXACTLY);\n                break;\n        }\n        const listContent:number = this.mDropDownList.measureHeightOfChildren(childWidthSpec, 0, ListView.NO_POSITION, maxHeight - otherHeights, -1);\n        // the popup if it is not needed\n        if (listContent > 0)\n            otherHeights += padding;\n        return listContent + otherHeights;\n    }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}\n\nexport module ListPopupWindow{\n/**\n     * Abstract class that forwards touch events to a {@link ListPopupWindow}.\n     *\n     * @hide\n     */\nexport abstract class ForwardingListener implements View.OnTouchListener, View.OnAttachStateChangeListener {\n\n    /** Scaled touch slop, used for detecting movement outside bounds. */\n    private mScaledTouchSlop:number = 0;\n\n    /** Timeout before disallowing intercept on the source's parent. */\n    private mTapTimeout:number = 0;\n\n    /** Source view from which events are forwarded. */\n    private mSrc:View;\n\n    /** Runnable used to prevent conflicts with scrolling parents. */\n    private mDisallowIntercept:Runnable;\n\n    /** Whether this listener is currently forwarding touch events. */\n    private mForwarding:boolean;\n\n    /** The id of the first pointer down in the current event stream. */\n    private mActivePointerId:number = 0;\n\n    constructor( src:View) {\n        this.mSrc = src;\n        this.mScaledTouchSlop = ViewConfiguration.get(src.getContext()).getScaledTouchSlop();\n        this.mTapTimeout = ViewConfiguration.getTapTimeout();\n        src.addOnAttachStateChangeListener(this);\n    }\n\n    /**\n         * Returns the popup to which this listener is forwarding events.\n         * <p>\n         * Override this to return the correct popup. If the popup is displayed\n         * asynchronously, you may also need to override\n         * {@link #onForwardingStopped} to prevent premature cancelation of\n         * forwarding.\n         *\n         * @return the popup to which this listener is forwarding events\n         */\n    abstract getPopup():ListPopupWindow ;\n\n    onTouch(v:View, event:MotionEvent):boolean  {\n        const wasForwarding:boolean = this.mForwarding;\n        let forwarding:boolean;\n        if (wasForwarding) {\n            forwarding = this.onTouchForwarded(event) || !this.onForwardingStopped();\n        } else {\n            forwarding = this.onTouchObserved(event) && this.onForwardingStarted();\n        }\n        this.mForwarding = forwarding;\n        return forwarding || wasForwarding;\n    }\n\n    onViewAttachedToWindow(v:View):void  {\n    }\n\n    onViewDetachedFromWindow(v:View):void  {\n        this.mForwarding = false;\n        this.mActivePointerId = MotionEvent.INVALID_POINTER_ID;\n        if (this.mDisallowIntercept != null) {\n            this.mSrc.removeCallbacks(this.mDisallowIntercept);\n        }\n    }\n\n    /**\n         * Called when forwarding would like to start.\n         * <p>\n         * By default, this will show the popup returned by {@link #getPopup()}.\n         * It may be overridden to perform another action, like clicking the\n         * source view or preparing the popup before showing it.\n         *\n         * @return true to start forwarding, false otherwise\n         */\n    protected onForwardingStarted():boolean  {\n        const popup:ListPopupWindow = this.getPopup();\n        if (popup != null && !popup.isShowing()) {\n            popup.show();\n        }\n        return true;\n    }\n\n    /**\n         * Called when forwarding would like to stop.\n         * <p>\n         * By default, this will dismiss the popup returned by\n         * {@link #getPopup()}. It may be overridden to perform some other\n         * action.\n         *\n         * @return true to stop forwarding, false otherwise\n         */\n    protected onForwardingStopped():boolean  {\n        const popup:ListPopupWindow = this.getPopup();\n        if (popup != null && popup.isShowing()) {\n            popup.dismiss();\n        }\n        return true;\n    }\n\n    /**\n         * Observes motion events and determines when to start forwarding.\n         *\n         * @param srcEvent motion event in source view coordinates\n         * @return true to start forwarding motion events, false otherwise\n         */\n    private onTouchObserved(srcEvent:MotionEvent):boolean  {\n        const src:View = this.mSrc;\n        if (!src.isEnabled()) {\n            return false;\n        }\n        const actionMasked:number = srcEvent.getActionMasked();\n        switch(actionMasked) {\n            case MotionEvent.ACTION_DOWN:\n                this.mActivePointerId = srcEvent.getPointerId(0);\n                if (this.mDisallowIntercept == null) {\n                    this.mDisallowIntercept = new ForwardingListener.DisallowIntercept(this);\n                }\n                src.postDelayed(this.mDisallowIntercept, this.mTapTimeout);\n                break;\n            case MotionEvent.ACTION_MOVE:\n                const activePointerIndex:number = srcEvent.findPointerIndex(this.mActivePointerId);\n                if (activePointerIndex >= 0) {\n                    const x:number = srcEvent.getX(activePointerIndex);\n                    const y:number = srcEvent.getY(activePointerIndex);\n                    if (!src.pointInView(x, y, this.mScaledTouchSlop)) {\n                        // The pointer has moved outside of the view.\n                        if (this.mDisallowIntercept != null) {\n                            src.removeCallbacks(this.mDisallowIntercept);\n                        }\n                        src.getParent().requestDisallowInterceptTouchEvent(true);\n                        return true;\n                    }\n                }\n                break;\n            case MotionEvent.ACTION_CANCEL:\n            case MotionEvent.ACTION_UP:\n                if (this.mDisallowIntercept != null) {\n                    src.removeCallbacks(this.mDisallowIntercept);\n                }\n                break;\n        }\n        return false;\n    }\n\n    /**\n         * Handled forwarded motion events and determines when to stop\n         * forwarding.\n         *\n         * @param srcEvent motion event in source view coordinates\n         * @return true to continue forwarding motion events, false to cancel\n         */\n    private onTouchForwarded(srcEvent:MotionEvent):boolean  {\n        return false;//TODO when event.transform(matrix) & invers Matrix support\n        //const src:View = this.mSrc;\n        //const popup:ListPopupWindow = this.getPopup();\n        //if (popup == null || !popup.isShowing()) {\n        //    return false;\n        //}\n        //const dst:ListPopupWindow.DropDownListView = popup.mDropDownList;\n        //if (dst == null || !dst.isShown()) {\n        //    return false;\n        //}\n        //// Convert event to destination-local coordinates.\n        //const dstEvent:MotionEvent = MotionEvent.obtainNoHistory(srcEvent);\n        //src.toGlobalMotionEvent(dstEvent);\n        //dst.toLocalMotionEvent(dstEvent);\n        //// Forward converted event to destination view, then recycle it.\n        //const handled:boolean = dst.onForwardedEvent(dstEvent, this.mActivePointerId);\n        //dstEvent.recycle();\n        //return handled;\n    }\n\n\n}\n\nexport module ForwardingListener{\nexport class DisallowIntercept implements Runnable {\n    _ForwardingListener_this:ForwardingListener;\n    constructor(arg:ForwardingListener){\n        this._ForwardingListener_this = arg;\n    }\n\n    run():void  {\n        const parent:ViewParent = this._ForwardingListener_this.mSrc.getParent();\n        parent.requestDisallowInterceptTouchEvent(true);\n    }\n}\n}\n\n/**\n     * <p>Wrapper class for a ListView. This wrapper can hijack the focus to\n     * make sure the list uses the appropriate drawables and states when\n     * displayed on screen within a drop down. The focus is never actually\n     * passed to the drop down in this mode; the list only looks focused.</p>\n     */\nexport class DropDownListView extends ListView {\n\n    /** Duration in milliseconds of the drag-to-open click animation. */\n    private static CLICK_ANIM_DURATION:number = 150;\n\n    /** Target alpha value for drag-to-open click animation. */\n    private static CLICK_ANIM_ALPHA:number = 0x80;\n\n    ///** Wrapper around Drawable's <code>alpha</code> property. */\n    //private static DRAWABLE_ALPHA:IntProperty<Drawable> = (()=>{\n    //    const inner_this=this;\n    //    class _Inner extends IntProperty<Drawable> {\n    //\n    //        setValue(object:Drawable, value:number):void  {\n    //            object.setAlpha(value);\n    //        }\n    //\n    //        get(object:Drawable):number  {\n    //            return object.getAlpha();\n    //        }\n    //    }\n    //    return new _Inner(\"alpha\");\n    //})();\n\n    /*\n         * WARNING: This is a workaround for a touch mode issue.\n         *\n         * Touch mode is propagated lazily to windows. This causes problems in\n         * the following scenario:\n         * - Type something in the AutoCompleteTextView and get some results\n         * - Move down with the d-pad to select an item in the list\n         * - Move up with the d-pad until the selection disappears\n         * - Type more text in the AutoCompleteTextView *using the soft keyboard*\n         *   and get new results; you are now in touch mode\n         * - The selection comes back on the first item in the list, even though\n         *   the list is supposed to be in touch mode\n         *\n         * Using the soft keyboard triggers the touch mode change but that change\n         * is propagated to our window only after the first list layout, therefore\n         * after the list attempts to resurrect the selection.\n         *\n         * The trick to work around this issue is to pretend the list is in touch\n         * mode when we know that the selection should not appear, that is when\n         * we know the user moved the selection away from the list.\n         *\n         * This boolean is set to true whenever we explicitly hide the list's\n         * selection and reset to false whenever we know the user moved the\n         * selection back to the list.\n         *\n         * When this boolean is true, isInTouchMode() returns true, otherwise it\n         * returns super.isInTouchMode().\n         */\n    private mListSelectionHidden:boolean;\n\n    /**\n         * True if this wrapper should fake focus.\n         */\n    private mHijackFocus:boolean;\n\n    /** Whether to force drawing of the pressed state selector. */\n    private mDrawsInPressedState:boolean;\n\n    /** Current drag-to-open click animation, if any. */\n    //private mClickAnimation:Animator;\n\n    /** Helper for drag-to-open auto scrolling. */\n    //private mScrollHelper:AbsListViewAutoScroller;\n\n    /**\n         * <p>Creates a new list view wrapper.</p>\n         *\n         * @param context this view's context\n         */\n    constructor(context:Context, hijackFocus:boolean) {\n        super(context, null, R.attr.dropDownListViewStyle);\n        this.mHijackFocus = hijackFocus;\n        // TODO: Add an API to control this\n        // Transparent, since the background drawable could be anything.\n        this.setCacheColorHint(0);\n    }\n\n    /**\n         * Handles forwarded events.\n         *\n         * @param activePointerId id of the pointer that activated forwarding\n         * @return whether the event was handled\n         */\n    onForwardedEvent(event:MotionEvent, activePointerId:number):boolean  {\n        let handledEvent:boolean = true;\n        let clearPressedItem:boolean = false;\n        const actionMasked:number = event.getActionMasked();\n        switch(actionMasked) {\n            case MotionEvent.ACTION_CANCEL:\n                handledEvent = false;\n                break;\n            case MotionEvent.ACTION_UP:\n                handledEvent = false;\n            // $FALL-THROUGH$\n            case MotionEvent.ACTION_MOVE:\n                const activeIndex:number = event.findPointerIndex(activePointerId);\n                if (activeIndex < 0) {\n                    handledEvent = false;\n                    break;\n                }\n                const x:number = Math.floor(event.getX(activeIndex));\n                const y:number = Math.floor(event.getY(activeIndex));\n                const position:number = this.pointToPosition(x, y);\n                if (position == DropDownListView.INVALID_POSITION) {\n                    clearPressedItem = true;\n                    break;\n                }\n                const child:View = this.getChildAt(position - this.getFirstVisiblePosition());\n                this.setPressedItem(child, position);\n                handledEvent = true;\n                if (actionMasked == MotionEvent.ACTION_UP) {\n                    this.clickPressedItem(child, position);\n                }\n                break;\n        }\n        // Failure to handle the event cancels forwarding.\n        if (!handledEvent || clearPressedItem) {\n            this.clearPressedItem();\n        }\n        //TODO when ForwardedEvent support\n        // Manage automatic scrolling.\n        //if (handledEvent) {\n        //    if (this.mScrollHelper == null) {\n        //        this.mScrollHelper = new AbsListViewAutoScroller(this);\n        //    }\n        //    this.mScrollHelper.setEnabled(true);\n        //    this.mScrollHelper.onTouch(this, event);\n        //} else if (this.mScrollHelper != null) {\n        //    this.mScrollHelper.setEnabled(false);\n        //}\n        return handledEvent;\n    }\n\n    /**\n         * Starts an alpha animation on the selector. When the animation ends,\n         * the list performs a click on the item.\n         */\n    private clickPressedItem(child:View, position:number):void  {\n        const id:number = this.getItemIdAtPosition(position);\n        this.performItemClick(child, position, id);\n\n        //TODO when animator ok\n        //const anim:Animator = ObjectAnimator.ofInt(this.mSelector, DropDownListView.DRAWABLE_ALPHA, 0xFF, DropDownListView.CLICK_ANIM_ALPHA, 0xFF);\n        //anim.setDuration(DropDownListView.CLICK_ANIM_DURATION);\n        //anim.setInterpolator(new AccelerateDecelerateInterpolator());\n        //anim.addListener((()=>{\n        //    const inner_this=this;\n        //    class _Inner extends AnimatorListenerAdapter {\n        //\n        //        onAnimationEnd(animation:Animator):void  {\n        //            inner_this.performItemClick(child, position, id);\n        //        }\n        //    }\n        //    return new _Inner();\n        //})());\n        //anim.start();\n        //if (this.mClickAnimation != null) {\n        //    this.mClickAnimation.cancel();\n        //}\n        //this.mClickAnimation = anim;\n    }\n\n    private clearPressedItem():void  {\n        this.mDrawsInPressedState = false;\n        this.setPressed(false);\n        this.updateSelectorState();\n        //if (this.mClickAnimation != null) {\n        //    this.mClickAnimation.cancel();\n        //    this.mClickAnimation = null;\n        //}\n    }\n\n    private setPressedItem(child:View, position:number):void  {\n        this.mDrawsInPressedState = true;\n        // Ordering is essential. First update the pressed state and layout\n        // the children. This will ensure the selector actually gets drawn.\n        this.setPressed(true);\n        this.layoutChildren();\n        // Ensure that keyboard focus starts from the last touched position.\n        this.setSelectedPositionInt(position);\n        this.positionSelector(position, child);\n        // Refresh the drawable state to reflect the new pressed state,\n        // which will also update the selector state.\n        this.refreshDrawableState();\n        //if (this.mClickAnimation != null) {\n        //    this.mClickAnimation.cancel();\n        //    this.mClickAnimation = null;\n        //}\n    }\n\n    touchModeDrawsInPressedState():boolean  {\n        return this.mDrawsInPressedState || super.touchModeDrawsInPressedState();\n    }\n\n    /**\n         * <p>Avoids jarring scrolling effect by ensuring that list elements\n         * made of a text view fit on a single line.</p>\n         *\n         * @param position the item index in the list to get a view for\n         * @return the view for the specified item\n         */\n    obtainView(position:number, isScrap:boolean[]):View  {\n        let view:View = super.obtainView(position, isScrap);\n        if (view instanceof TextView) {\n            (<TextView> view).setHorizontallyScrolling(true);\n        }\n        return view;\n    }\n\n    isInTouchMode():boolean  {\n        // WARNING: Please read the comment where mListSelectionHidden is declared\n        return (this.mHijackFocus && this.mListSelectionHidden) || super.isInTouchMode();\n    }\n\n    /**\n         * <p>Returns the focus state in the drop down.</p>\n         *\n         * @return true always if hijacking focus\n         */\n    hasWindowFocus():boolean  {\n        return this.mHijackFocus || super.hasWindowFocus();\n    }\n\n    /**\n         * <p>Returns the focus state in the drop down.</p>\n         *\n         * @return true always if hijacking focus\n         */\n    isFocused():boolean  {\n        return this.mHijackFocus || super.isFocused();\n    }\n\n    /**\n         * <p>Returns the focus state in the drop down.</p>\n         *\n         * @return true always if hijacking focus\n         */\n    hasFocus():boolean  {\n        return this.mHijackFocus || super.hasFocus();\n    }\n}\nexport class PopupDataSetObserver extends DataSetObserver {\n    _ListPopupWindow_this:ListPopupWindow;\n    constructor(arg:ListPopupWindow){\n        super();\n        this._ListPopupWindow_this = arg;\n    }\n\n    onChanged():void  {\n        if (this._ListPopupWindow_this.isShowing()) {\n            // Resize the popup to fit new content\n            this._ListPopupWindow_this.show();\n        }\n    }\n\n    onInvalidated():void  {\n        this._ListPopupWindow_this.dismiss();\n    }\n}\nexport class ListSelectorHider implements Runnable {\n    _ListPopupWindow_this:ListPopupWindow;\n    constructor(arg:ListPopupWindow){\n        this._ListPopupWindow_this = arg;\n    }\n\n    run():void  {\n        this._ListPopupWindow_this.clearListSelection();\n    }\n}\nexport class ResizePopupRunnable implements Runnable {\n    _ListPopupWindow_this:ListPopupWindow;\n    constructor(arg:ListPopupWindow){\n        this._ListPopupWindow_this = arg;\n    }\n\n    run():void  {\n        if (this._ListPopupWindow_this.mDropDownList != null && this._ListPopupWindow_this.mDropDownList.getCount() > this._ListPopupWindow_this.mDropDownList.getChildCount() && this._ListPopupWindow_this.mDropDownList.getChildCount() <= this._ListPopupWindow_this.mListItemExpandMaximum) {\n            this._ListPopupWindow_this.mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);\n            this._ListPopupWindow_this.show();\n        }\n    }\n}\nexport class PopupTouchInterceptor implements OnTouchListener {\n    _ListPopupWindow_this:ListPopupWindow;\n    constructor(arg:ListPopupWindow){\n        this._ListPopupWindow_this = arg;\n    }\n\n    onTouch(v:View, event:MotionEvent):boolean  {\n        const action:number = event.getAction();\n        const x:number = Math.floor(event.getX());\n        const y:number = Math.floor(event.getY());\n        if (action == MotionEvent.ACTION_DOWN && this._ListPopupWindow_this.mPopup != null && this._ListPopupWindow_this.mPopup.isShowing() && (x >= 0 && x < this._ListPopupWindow_this.mPopup.getWidth() && y >= 0 && y < this._ListPopupWindow_this.mPopup.getHeight())) {\n            this._ListPopupWindow_this.mHandler.postDelayed(this._ListPopupWindow_this.mResizePopupRunnable, ListPopupWindow.EXPAND_LIST_TIMEOUT);\n        } else if (action == MotionEvent.ACTION_UP) {\n            this._ListPopupWindow_this.mHandler.removeCallbacks(this._ListPopupWindow_this.mResizePopupRunnable);\n        }\n        return false;\n    }\n}\nexport class PopupScrollListener implements AbsListView.OnScrollListener {\n    _ListPopupWindow_this:ListPopupWindow;\n    constructor(arg:ListPopupWindow){\n        this._ListPopupWindow_this = arg;\n    }\n\n    onScroll(view:AbsListView, firstVisibleItem:number, visibleItemCount:number, totalItemCount:number):void  {\n    }\n\n    onScrollStateChanged(view:AbsListView, scrollState:number):void  {\n        if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL\n            && !this._ListPopupWindow_this.isInputMethodNotNeeded() && this._ListPopupWindow_this.mPopup.getContentView() != null) {\n            this._ListPopupWindow_this.mHandler.removeCallbacks(this._ListPopupWindow_this.mResizePopupRunnable);\n            this._ListPopupWindow_this.mResizePopupRunnable.run();\n        }\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/widget/ListView.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../android/graphics/PixelFormat.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/util/MathUtils.ts\"/>\n///<reference path=\"../../android/util/SparseBooleanArray.ts\"/>\n///<reference path=\"../../android/view/FocusFinder.ts\"/>\n///<reference path=\"../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../android/view/SoundEffectConstants.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/view/ViewParent.ts\"/>\n///<reference path=\"../../android/view/ViewRootImpl.ts\"/>\n///<reference path=\"../../android/os/Trace.ts\"/>\n///<reference path=\"../../java/util/ArrayList.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../java/lang/System.ts\"/>\n///<reference path=\"../../java/lang/Runnable.ts\"/>\n///<reference path=\"../../android/widget/AbsListView.ts\"/>\n///<reference path=\"../../android/widget/Adapter.ts\"/>\n///<reference path=\"../../android/widget/AdapterView.ts\"/>\n///<reference path=\"../../android/widget/Checkable.ts\"/>\n///<reference path=\"../../android/widget/HeaderViewListAdapter.ts\"/>\n///<reference path=\"../../android/widget/ListAdapter.ts\"/>\n///<reference path=\"../../android/widget/WrapperListAdapter.ts\"/>\n///<reference path=\"../../android/widget/BaseAdapter.ts\"/>\n///<reference path=\"../../android/R/attr.ts\"/>\n\nmodule android.widget {\nimport Canvas = android.graphics.Canvas;\nimport Paint = android.graphics.Paint;\nimport PixelFormat = android.graphics.PixelFormat;\nimport Rect = android.graphics.Rect;\nimport Drawable = android.graphics.drawable.Drawable;\nimport MathUtils = android.util.MathUtils;\nimport SparseBooleanArray = android.util.SparseBooleanArray;\nimport FocusFinder = android.view.FocusFinder;\nimport KeyEvent = android.view.KeyEvent;\nimport SoundEffectConstants = android.view.SoundEffectConstants;\nimport View = android.view.View;\nimport ViewGroup = android.view.ViewGroup;\nimport ViewParent = android.view.ViewParent;\nimport ViewRootImpl = android.view.ViewRootImpl;\nimport Trace = android.os.Trace;\nimport ArrayList = java.util.ArrayList;\nimport Integer = java.lang.Integer;\nimport System = java.lang.System;\nimport Runnable = java.lang.Runnable;\nimport AbsListView = android.widget.AbsListView;\nimport Adapter = android.widget.Adapter;\nimport AdapterView = android.widget.AdapterView;\nimport Checkable = android.widget.Checkable;\nimport HeaderViewListAdapter = android.widget.HeaderViewListAdapter;\nimport ListAdapter = android.widget.ListAdapter;\nimport WrapperListAdapter = android.widget.WrapperListAdapter;\n    import AttrBinder = androidui.attr.AttrBinder;\n/**\n * A view that shows items in a vertically scrolling list. The items\n * come from the {@link ListAdapter} associated with this view.\n *\n * <p>See the <a href=\"{@docRoot}guide/topics/ui/layout/listview.html\">List View</a>\n * guide.</p>\n *\n * @attr ref android.R.styleable#ListView_entries\n * @attr ref android.R.styleable#ListView_divider\n * @attr ref android.R.styleable#ListView_dividerHeight\n * @attr ref android.R.styleable#ListView_headerDividersEnabled\n * @attr ref android.R.styleable#ListView_footerDividersEnabled\n */\nexport class ListView extends AbsListView {\n\n    /**\n     * Used to indicate a no preference for a position type.\n     */\n    static NO_POSITION:number = -1;\n\n    /**\n     * When arrow scrolling, ListView will never scroll more than this factor\n     * times the height of the list.\n     */\n    private static MAX_SCROLL_FACTOR:number = 0.33;\n\n    /**\n     * When arrow scrolling, need a certain amount of pixels to preview next\n     * items.  This is usually the fading edge, but if that is small enough,\n     * we want to make sure we preview at least this many pixels.\n     */\n    private static MIN_SCROLL_PREVIEW_PIXELS:number = 2;\n\n\n\n    private mHeaderViewInfos:ArrayList<ListView.FixedViewInfo> = new ArrayList<ListView.FixedViewInfo>();\n\n    private mFooterViewInfos:ArrayList<ListView.FixedViewInfo> = new ArrayList<ListView.FixedViewInfo>();\n\n    mDivider:Drawable;\n\n    mDividerHeight:number = 0;\n\n    mOverScrollHeader:Drawable;\n\n    mOverScrollFooter:Drawable;\n\n    private mIsCacheColorOpaque:boolean = false;\n\n    private mDividerIsOpaque:boolean = false;\n\n    private mHeaderDividersEnabled:boolean = true;\n\n    private mFooterDividersEnabled:boolean = true;\n\n    private mAreAllItemsSelectable:boolean = true;\n\n    private mItemsCanFocus:boolean = false;\n\n    // used for temporary calculations.\n    private mTempRect:Rect = new Rect();\n\n    private mDividerPaint:Paint;\n\n    // the single allocated result per list view; kinda cheesey but avoids\n    // allocating these thingies too often.\n    private mArrowScrollFocusResult:ListView.ArrowScrollFocusResult = new ListView.ArrowScrollFocusResult();\n\n    // Keeps focused children visible through resizes\n    private mFocusSelector:ListView.FocusSelector;\n\n    constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle=android.R.attr.listViewStyle) {\n        super(context, bindElement, defStyle);\n        let a = context.obtainStyledAttributes(bindElement, defStyle);\n        // let entries = a.getTextArray('entries');\n        // if (entries != null) {\n        //     this.setAdapter(new ArrayAdapter<string>(context, R.layout.simple_list_item_1, entries));\n        // }\n        const d: Drawable = a.getDrawable('divider');\n        if (d != null) {\n            // If a divider is specified use its intrinsic height for divider height\n            this.setDivider(d);\n        }\n        const osHeader: Drawable = a.getDrawable('overScrollHeader');\n        if (osHeader != null) {\n            this.setOverscrollHeader(osHeader);\n        }\n        const osFooter: Drawable = a.getDrawable('overScrollFooter');\n        if (osFooter != null) {\n            this.setOverscrollFooter(osFooter);\n        }\n        // Use the height specified, zero being the default\n        const dividerHeight: number = a.getDimensionPixelSize('dividerHeight', 0);\n        if (dividerHeight != 0) {\n            this.setDividerHeight(dividerHeight);\n        }\n        this.mHeaderDividersEnabled = a.getBoolean('headerDividersEnabled', true);\n        this.mFooterDividersEnabled = a.getBoolean('footerDividersEnabled', true);\n        a.recycle();\n    }\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder().set('divider', {\n            setter(v:ListView, value:any, attrBinder:AttrBinder) {\n                let divider = attrBinder.parseDrawable(value);\n                if(divider) v.setDivider(divider);\n            }, getter(v:ListView) {\n                return v.mDivider;\n            }\n        }).set('overScrollHeader', {\n            setter(v:ListView, value:any, attrBinder:AttrBinder) {\n                let header = attrBinder.parseDrawable(value);\n                if(header) v.setOverscrollHeader(header);\n            }, getter(v:ListView) {\n                return v.getOverscrollHeader();\n            }\n        }).set('overScrollFooter', {\n            setter(v:ListView, value:any, attrBinder:AttrBinder) {\n                let footer = attrBinder.parseDrawable(value);\n                if(footer) v.setOverscrollFooter(footer);\n            }, getter(v:ListView) {\n                return v.getOverscrollFooter();\n            }\n        }).set('dividerHeight', {\n            setter(v:ListView, value:any, attrBinder:AttrBinder) {\n                v.setDividerHeight(attrBinder.parseNumberPixelSize(value, v.getDividerHeight()));\n            }, getter(v:ListView) {\n                return v.getDividerHeight();\n            }\n        }).set('headerDividersEnabled', {\n            setter(v:ListView, value:any, attrBinder:AttrBinder) {\n                v.setHeaderDividersEnabled(attrBinder.parseBoolean(value, v.mHeaderDividersEnabled));\n            }, getter(v:ListView) {\n                return v.mHeaderDividersEnabled;\n            }\n        }).set('dividerHeight', {\n            setter(v:ListView, value:any, attrBinder:AttrBinder) {\n                v.setFooterDividersEnabled(attrBinder.parseBoolean(value, v.mFooterDividersEnabled));\n            }, getter(v:ListView) {\n                return v.mFooterDividersEnabled;\n            }\n        });\n    }\n\n    /**\n     * @return The maximum amount a list view will scroll in response to\n     *   an arrow event.\n     */\n    getMaxScrollAmount():number  {\n        return Math.floor((ListView.MAX_SCROLL_FACTOR * (this.mBottom - this.mTop)));\n    }\n\n    /**\n     * Make sure views are touching the top or bottom edge, as appropriate for\n     * our gravity\n     */\n    private adjustViewsUpOrDown():void  {\n        const childCount:number = this.getChildCount();\n        let delta:number;\n        if (childCount > 0) {\n            let child:View;\n            if (!this.mStackFromBottom) {\n                // Uh-oh -- we came up short. Slide all views up to make them\n                // align with the top\n                child = this.getChildAt(0);\n                delta = child.getTop() - this.mListPadding.top;\n                if (this.mFirstPosition != 0) {\n                    // It's OK to have some space above the first item if it is\n                    // part of the vertical spacing\n                    delta -= this.mDividerHeight;\n                }\n                if (delta < 0) {\n                    // We only are looking to see if we are too low, not too high\n                    delta = 0;\n                }\n            } else {\n                // we are too high, slide all views down to align with bottom\n                child = this.getChildAt(childCount - 1);\n                delta = child.getBottom() - (this.getHeight() - this.mListPadding.bottom);\n                if (this.mFirstPosition + childCount < this.mItemCount) {\n                    // It's OK to have some space below the last item if it is\n                    // part of the vertical spacing\n                    delta += this.mDividerHeight;\n                }\n                if (delta > 0) {\n                    delta = 0;\n                }\n            }\n            if (delta != 0) {\n                this.offsetChildrenTopAndBottom(-delta);\n            }\n        }\n    }\n\n    /**\n     * Add a fixed view to appear at the top of the list. If this method is\n     * called more than once, the views will appear in the order they were\n     * added. Views added using this call can take focus if they want.\n     * <p>\n     * Note: When first introduced, this method could only be called before\n     * setting the adapter with {@link #setAdapter(ListAdapter)}. Starting with\n     * {@link android.os.Build.VERSION_CODES#KITKAT}, this method may be\n     * called at any time. If the ListView's adapter does not extend\n     * {@link HeaderViewListAdapter}, it will be wrapped with a supporting\n     * instance of {@link WrapperListAdapter}.\n     *\n     * @param v The view to add.\n     * @param data Data to associate with this view\n     * @param isSelectable whether the item is selectable\n     */\n    addHeaderView(v:View, data:any=null, isSelectable:boolean=true):void  {\n        const info:ListView.FixedViewInfo = new ListView.FixedViewInfo(this);\n        info.view = v;\n        info.data = data;\n        info.isSelectable = isSelectable;\n        this.mHeaderViewInfos.add(info);\n        // Wrap the adapter if it wasn't already wrapped.\n        if (this.mAdapter != null) {\n            if (!(this.mAdapter instanceof HeaderViewListAdapter)) {\n                this.mAdapter = new HeaderViewListAdapter(this.mHeaderViewInfos, this.mFooterViewInfos, this.mAdapter);\n            }\n            // we need to notify the observer.\n            if (this.mDataSetObserver != null) {\n                this.mDataSetObserver.onChanged();\n            }\n        }\n    }\n\n    getHeaderViewsCount():number  {\n        return this.mHeaderViewInfos.size();\n    }\n\n    /**\n     * Removes a previously-added header view.\n     *\n     * @param v The view to remove\n     * @return true if the view was removed, false if the view was not a header\n     *         view\n     */\n    removeHeaderView(v:View):boolean  {\n        if (this.mHeaderViewInfos.size() > 0) {\n            let result:boolean = false;\n            if (this.mAdapter != null && (<HeaderViewListAdapter> this.mAdapter).removeHeader(v)) {\n                if (this.mDataSetObserver != null) {\n                    this.mDataSetObserver.onChanged();\n                }\n                result = true;\n            }\n            this.removeFixedViewInfo(v, this.mHeaderViewInfos);\n            return result;\n        }\n        return false;\n    }\n\n    private removeFixedViewInfo(v:View, where:ArrayList<ListView.FixedViewInfo>):void  {\n        let len:number = where.size();\n        for (let i:number = 0; i < len; ++i) {\n            let info:ListView.FixedViewInfo = where.get(i);\n            if (info.view == v) {\n                where.remove(i);\n                break;\n            }\n        }\n    }\n\n    /**\n     * Add a fixed view to appear at the bottom of the list. If addFooterView is\n     * called more than once, the views will appear in the order they were\n     * added. Views added using this call can take focus if they want.\n     * <p>\n     * Note: When first introduced, this method could only be called before\n     * setting the adapter with {@link #setAdapter(ListAdapter)}. Starting with\n     * {@link android.os.Build.VERSION_CODES#KITKAT}, this method may be\n     * called at any time. If the ListView's adapter does not extend\n     * {@link HeaderViewListAdapter}, it will be wrapped with a supporting\n     * instance of {@link WrapperListAdapter}.\n     *\n     * @param v The view to add.\n     * @param data Data to associate with this view\n     * @param isSelectable true if the footer view can be selected\n     */\n    addFooterView(v:View, data:any=null, isSelectable:boolean=true):void  {\n        const info:ListView.FixedViewInfo = new ListView.FixedViewInfo(this);\n        info.view = v;\n        info.data = data;\n        info.isSelectable = isSelectable;\n        this.mFooterViewInfos.add(info);\n        // Wrap the adapter if it wasn't already wrapped.\n        if (this.mAdapter != null) {\n            if (!(this.mAdapter instanceof HeaderViewListAdapter)) {\n                this.mAdapter = new HeaderViewListAdapter(this.mHeaderViewInfos, this.mFooterViewInfos, this.mAdapter);\n            }\n            // we need to notify the observer.\n            if (this.mDataSetObserver != null) {\n                this.mDataSetObserver.onChanged();\n            }\n        }\n    }\n\n    getFooterViewsCount():number  {\n        return this.mFooterViewInfos.size();\n    }\n\n    /**\n     * Removes a previously-added footer view.\n     *\n     * @param v The view to remove\n     * @return\n     * true if the view was removed, false if the view was not a footer view\n     */\n    removeFooterView(v:View):boolean  {\n        if (this.mFooterViewInfos.size() > 0) {\n            let result:boolean = false;\n            if (this.mAdapter != null && (<HeaderViewListAdapter> this.mAdapter).removeFooter(v)) {\n                if (this.mDataSetObserver != null) {\n                    this.mDataSetObserver.onChanged();\n                }\n                result = true;\n            }\n            this.removeFixedViewInfo(v, this.mFooterViewInfos);\n            return result;\n        }\n        return false;\n    }\n\n    /**\n     * Returns the adapter currently in use in this ListView. The returned adapter\n     * might not be the same adapter passed to {@link #setAdapter(ListAdapter)} but\n     * might be a {@link WrapperListAdapter}.\n     *\n     * @return The adapter currently used to display data in this ListView.\n     *\n     * @see #setAdapter(ListAdapter)\n     */\n    getAdapter():ListAdapter  {\n        return this.mAdapter;\n    }\n\n    /**\n     * Sets the data behind this ListView.\n     *\n     * The adapter passed to this method may be wrapped by a {@link WrapperListAdapter},\n     * depending on the ListView features currently in use. For instance, adding\n     * headers and/or footers will cause the adapter to be wrapped.\n     *\n     * @param adapter The ListAdapter which is responsible for maintaining the\n     *        data backing this list and for producing a view to represent an\n     *        item in that data set.\n     *\n     * @see #getAdapter() \n     */\n    setAdapter(adapter:ListAdapter):void  {\n        if (this.mAdapter != null && this.mDataSetObserver != null) {\n            this.mAdapter.unregisterDataSetObserver(this.mDataSetObserver);\n        }\n        this.resetList();\n        this.mRecycler.clear();\n        if (this.mHeaderViewInfos.size() > 0 || this.mFooterViewInfos.size() > 0) {\n            this.mAdapter = new HeaderViewListAdapter(this.mHeaderViewInfos, this.mFooterViewInfos, adapter);\n        } else {\n            this.mAdapter = adapter;\n        }\n        this.mOldSelectedPosition = ListView.INVALID_POSITION;\n        this.mOldSelectedRowId = ListView.INVALID_ROW_ID;\n        // AbsListView#setAdapter will update choice mode states.\n        super.setAdapter(adapter);\n        if (this.mAdapter != null) {\n            this.mAreAllItemsSelectable = this.mAdapter.areAllItemsEnabled();\n            this.mOldItemCount = this.mItemCount;\n            this.mItemCount = this.mAdapter.getCount();\n            this.checkFocus();\n            this.mDataSetObserver = new AbsListView.AdapterDataSetObserver(this);\n            this.mAdapter.registerDataSetObserver(this.mDataSetObserver);\n            this.mRecycler.setViewTypeCount(this.mAdapter.getViewTypeCount());\n            let position:number;\n            if (this.mStackFromBottom) {\n                position = this.lookForSelectablePosition(this.mItemCount - 1, false);\n            } else {\n                position = this.lookForSelectablePosition(0, true);\n            }\n            this.setSelectedPositionInt(position);\n            this.setNextSelectedPositionInt(position);\n            if (this.mItemCount == 0) {\n                // Nothing selected\n                this.checkSelectionChanged();\n            }\n        } else {\n            this.mAreAllItemsSelectable = true;\n            this.checkFocus();\n            // Nothing selected\n            this.checkSelectionChanged();\n        }\n        this.requestLayout();\n    }\n\n    /**\n     * The list is empty. Clear everything out.\n     */\n    resetList():void  {\n        // The parent's resetList() will remove all views from the layout so we need to\n        // cleanup the state of our footers and headers\n        this.clearRecycledState(this.mHeaderViewInfos);\n        this.clearRecycledState(this.mFooterViewInfos);\n        super.resetList();\n        this.mLayoutMode = ListView.LAYOUT_NORMAL;\n    }\n\n    private clearRecycledState(infos:ArrayList<ListView.FixedViewInfo>):void  {\n        if (infos != null) {\n            const count:number = infos.size();\n            for (let i:number = 0; i < count; i++) {\n                const child:View = infos.get(i).view;\n                const p:AbsListView.LayoutParams = <AbsListView.LayoutParams> child.getLayoutParams();\n                if (p != null) {\n                    p.recycledHeaderFooter = false;\n                }\n            }\n        }\n    }\n\n    /**\n     * @return Whether the list needs to show the top fading edge\n     */\n    private showingTopFadingEdge():boolean  {\n        const listTop:number = this.mScrollY + this.mListPadding.top;\n        return (this.mFirstPosition > 0) || (this.getChildAt(0).getTop() > listTop);\n    }\n\n    /**\n     * @return Whether the list needs to show the bottom fading edge\n     */\n    private showingBottomFadingEdge():boolean  {\n        const childCount:number = this.getChildCount();\n        const bottomOfBottomChild:number = this.getChildAt(childCount - 1).getBottom();\n        const lastVisiblePosition:number = this.mFirstPosition + childCount - 1;\n        const listBottom:number = this.mScrollY + this.getHeight() - this.mListPadding.bottom;\n        return (lastVisiblePosition < this.mItemCount - 1) || (bottomOfBottomChild < listBottom);\n    }\n\n    requestChildRectangleOnScreen(child:View, rect:Rect, immediate:boolean):boolean  {\n        let rectTopWithinChild:number = rect.top;\n        // offset so rect is in coordinates of the this view\n        rect.offset(child.getLeft(), child.getTop());\n        rect.offset(-child.getScrollX(), -child.getScrollY());\n        const height:number = this.getHeight();\n        let listUnfadedTop:number = this.getScrollY();\n        let listUnfadedBottom:number = listUnfadedTop + height;\n        const fadingEdge:number = this.getVerticalFadingEdgeLength();\n        if (this.showingTopFadingEdge()) {\n            // leave room for top fading edge as long as rect isn't at very top\n            if ((this.mSelectedPosition > 0) || (rectTopWithinChild > fadingEdge)) {\n                listUnfadedTop += fadingEdge;\n            }\n        }\n        let childCount:number = this.getChildCount();\n        let bottomOfBottomChild:number = this.getChildAt(childCount - 1).getBottom();\n        if (this.showingBottomFadingEdge()) {\n            // leave room for bottom fading edge as long as rect isn't at very bottom\n            if ((this.mSelectedPosition < this.mItemCount - 1) || (rect.bottom < (bottomOfBottomChild - fadingEdge))) {\n                listUnfadedBottom -= fadingEdge;\n            }\n        }\n        let scrollYDelta:number = 0;\n        if (rect.bottom > listUnfadedBottom && rect.top > listUnfadedTop) {\n            if (rect.height() > height) {\n                // just enough to get screen size chunk on\n                scrollYDelta += (rect.top - listUnfadedTop);\n            } else {\n                // get entire rect at bottom of screen\n                scrollYDelta += (rect.bottom - listUnfadedBottom);\n            }\n            // make sure we aren't scrolling beyond the end of our children\n            let distanceToBottom:number = bottomOfBottomChild - listUnfadedBottom;\n            scrollYDelta = Math.min(scrollYDelta, distanceToBottom);\n        } else if (rect.top < listUnfadedTop && rect.bottom < listUnfadedBottom) {\n            if (rect.height() > height) {\n                // screen size chunk\n                scrollYDelta -= (listUnfadedBottom - rect.bottom);\n            } else {\n                // entire rect at top\n                scrollYDelta -= (listUnfadedTop - rect.top);\n            }\n            // make sure we aren't scrolling any further than the top our children\n            let top:number = this.getChildAt(0).getTop();\n            let deltaToTop:number = top - listUnfadedTop;\n            scrollYDelta = Math.max(scrollYDelta, deltaToTop);\n        }\n        const scroll:boolean = scrollYDelta != 0;\n        if (scroll) {\n            this.scrollListItemsBy(-scrollYDelta);\n            this.positionSelector(ListView.INVALID_POSITION, child);\n            this.mSelectedTop = child.getTop();\n            this.invalidate();\n        }\n        return scroll;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    fillGap(down:boolean):void  {\n        const count:number = this.getChildCount();\n        if (down) {\n            let paddingTop:number = 0;\n            if ((this.mGroupFlags & ListView.CLIP_TO_PADDING_MASK) == ListView.CLIP_TO_PADDING_MASK) {\n                paddingTop = this.getListPaddingTop();\n            }\n            const startOffset:number = count > 0 ? this.getChildAt(count - 1).getBottom() + this.mDividerHeight : paddingTop;\n            this.fillDown(this.mFirstPosition + count, startOffset);\n            this.correctTooHigh(this.getChildCount());\n        } else {\n            let paddingBottom:number = 0;\n            if ((this.mGroupFlags & ListView.CLIP_TO_PADDING_MASK) == ListView.CLIP_TO_PADDING_MASK) {\n                paddingBottom = this.getListPaddingBottom();\n            }\n            const startOffset:number = count > 0 ? this.getChildAt(0).getTop() - this.mDividerHeight : this.getHeight() - paddingBottom;\n            this.fillUp(this.mFirstPosition - 1, startOffset);\n            this.correctTooLow(this.getChildCount());\n        }\n    }\n\n    /**\n     * Fills the list from pos down to the end of the list view.\n     *\n     * @param pos The first position to put in the list\n     *\n     * @param nextTop The location where the top of the item associated with pos\n     *        should be drawn\n     *\n     * @return The view that is currently selected, if it happens to be in the\n     *         range that we draw.\n     */\n    private fillDown(pos:number, nextTop:number):View  {\n        let selectedView:View = null;\n        let end:number = (this.mBottom - this.mTop);\n        if ((this.mGroupFlags & ListView.CLIP_TO_PADDING_MASK) == ListView.CLIP_TO_PADDING_MASK) {\n            end -= this.mListPadding.bottom;\n        }\n        while (nextTop < end && pos < this.mItemCount) {\n            // is this the selected item?\n            let selected:boolean = pos == this.mSelectedPosition;\n            let child:View = this.makeAndAddView(pos, nextTop, true, this.mListPadding.left, selected);\n            nextTop = child.getBottom() + this.mDividerHeight;\n            if (selected) {\n                selectedView = child;\n            }\n            pos++;\n        }\n        this.setVisibleRangeHint(this.mFirstPosition, this.mFirstPosition + this.getChildCount() - 1);\n        return selectedView;\n    }\n\n    /**\n     * Fills the list from pos up to the top of the list view.\n     *\n     * @param pos The first position to put in the list\n     *\n     * @param nextBottom The location where the bottom of the item associated\n     *        with pos should be drawn\n     *\n     * @return The view that is currently selected\n     */\n    private fillUp(pos:number, nextBottom:number):View  {\n        let selectedView:View = null;\n        let end:number = 0;\n        if ((this.mGroupFlags & ListView.CLIP_TO_PADDING_MASK) == ListView.CLIP_TO_PADDING_MASK) {\n            end = this.mListPadding.top;\n        }\n        while (nextBottom > end && pos >= 0) {\n            // is this the selected item?\n            let selected:boolean = pos == this.mSelectedPosition;\n            let child:View = this.makeAndAddView(pos, nextBottom, false, this.mListPadding.left, selected);\n            nextBottom = child.getTop() - this.mDividerHeight;\n            if (selected) {\n                selectedView = child;\n            }\n            pos--;\n        }\n        this.mFirstPosition = pos + 1;\n        this.setVisibleRangeHint(this.mFirstPosition, this.mFirstPosition + this.getChildCount() - 1);\n        return selectedView;\n    }\n\n    /**\n     * Fills the list from top to bottom, starting with mFirstPosition\n     *\n     * @param nextTop The location where the top of the first item should be\n     *        drawn\n     *\n     * @return The view that is currently selected\n     */\n    private fillFromTop(nextTop:number):View  {\n        this.mFirstPosition = Math.min(this.mFirstPosition, this.mSelectedPosition);\n        this.mFirstPosition = Math.min(this.mFirstPosition, this.mItemCount - 1);\n        if (this.mFirstPosition < 0) {\n            this.mFirstPosition = 0;\n        }\n        return this.fillDown(this.mFirstPosition, nextTop);\n    }\n\n    /**\n     * Put mSelectedPosition in the middle of the screen and then build up and\n     * down from there. This method forces mSelectedPosition to the center.\n     *\n     * @param childrenTop Top of the area in which children can be drawn, as\n     *        measured in pixels\n     * @param childrenBottom Bottom of the area in which children can be drawn,\n     *        as measured in pixels\n     * @return Currently selected view\n     */\n    private fillFromMiddle(childrenTop:number, childrenBottom:number):View  {\n        let height:number = childrenBottom - childrenTop;\n        let position:number = this.reconcileSelectedPosition();\n        let sel:View = this.makeAndAddView(position, childrenTop, true, this.mListPadding.left, true);\n        this.mFirstPosition = position;\n        let selHeight:number = sel.getMeasuredHeight();\n        if (selHeight <= height) {\n            sel.offsetTopAndBottom((height - selHeight) / 2);\n        }\n        this.fillAboveAndBelow(sel, position);\n        if (!this.mStackFromBottom) {\n            this.correctTooHigh(this.getChildCount());\n        } else {\n            this.correctTooLow(this.getChildCount());\n        }\n        return sel;\n    }\n\n    /**\n     * Once the selected view as been placed, fill up the visible area above and\n     * below it.\n     *\n     * @param sel The selected view\n     * @param position The position corresponding to sel\n     */\n    private fillAboveAndBelow(sel:View, position:number):void  {\n        const dividerHeight:number = this.mDividerHeight;\n        if (!this.mStackFromBottom) {\n            this.fillUp(position - 1, sel.getTop() - dividerHeight);\n            this.adjustViewsUpOrDown();\n            this.fillDown(position + 1, sel.getBottom() + dividerHeight);\n        } else {\n            this.fillDown(position + 1, sel.getBottom() + dividerHeight);\n            this.adjustViewsUpOrDown();\n            this.fillUp(position - 1, sel.getTop() - dividerHeight);\n        }\n    }\n\n    /**\n     * Fills the grid based on positioning the new selection at a specific\n     * location. The selection may be moved so that it does not intersect the\n     * faded edges. The grid is then filled upwards and downwards from there.\n     *\n     * @param selectedTop Where the selected item should be\n     * @param childrenTop Where to start drawing children\n     * @param childrenBottom Last pixel where children can be drawn\n     * @return The view that currently has selection\n     */\n    private fillFromSelection(selectedTop:number, childrenTop:number, childrenBottom:number):View  {\n        let fadingEdgeLength:number = this.getVerticalFadingEdgeLength();\n        const selectedPosition:number = this.mSelectedPosition;\n        let sel:View;\n        const topSelectionPixel:number = this.getTopSelectionPixel(childrenTop, fadingEdgeLength, selectedPosition);\n        const bottomSelectionPixel:number = this.getBottomSelectionPixel(childrenBottom, fadingEdgeLength, selectedPosition);\n        sel = this.makeAndAddView(selectedPosition, selectedTop, true, this.mListPadding.left, true);\n        // Some of the newly selected item extends below the bottom of the list\n        if (sel.getBottom() > bottomSelectionPixel) {\n            // Find space available above the selection into which we can scroll\n            // upwards\n            const spaceAbove:number = sel.getTop() - topSelectionPixel;\n            // Find space required to bring the bottom of the selected item\n            // fully into view\n            const spaceBelow:number = sel.getBottom() - bottomSelectionPixel;\n            const offset:number = Math.min(spaceAbove, spaceBelow);\n            // Now offset the selected item to get it into view\n            sel.offsetTopAndBottom(-offset);\n        } else if (sel.getTop() < topSelectionPixel) {\n            // Find space required to bring the top of the selected item fully\n            // into view\n            const spaceAbove:number = topSelectionPixel - sel.getTop();\n            // Find space available below the selection into which we can scroll\n            // downwards\n            const spaceBelow:number = bottomSelectionPixel - sel.getBottom();\n            const offset:number = Math.min(spaceAbove, spaceBelow);\n            // Offset the selected item to get it into view\n            sel.offsetTopAndBottom(offset);\n        }\n        // Fill in views above and below\n        this.fillAboveAndBelow(sel, selectedPosition);\n        if (!this.mStackFromBottom) {\n            this.correctTooHigh(this.getChildCount());\n        } else {\n            this.correctTooLow(this.getChildCount());\n        }\n        return sel;\n    }\n\n    /**\n     * Calculate the bottom-most pixel we can draw the selection into\n     *\n     * @param childrenBottom Bottom pixel were children can be drawn\n     * @param fadingEdgeLength Length of the fading edge in pixels, if present\n     * @param selectedPosition The position that will be selected\n     * @return The bottom-most pixel we can draw the selection into\n     */\n    private getBottomSelectionPixel(childrenBottom:number, fadingEdgeLength:number, selectedPosition:number):number  {\n        let bottomSelectionPixel:number = childrenBottom;\n        if (selectedPosition != this.mItemCount - 1) {\n            bottomSelectionPixel -= fadingEdgeLength;\n        }\n        return bottomSelectionPixel;\n    }\n\n    /**\n     * Calculate the top-most pixel we can draw the selection into\n     *\n     * @param childrenTop Top pixel were children can be drawn\n     * @param fadingEdgeLength Length of the fading edge in pixels, if present\n     * @param selectedPosition The position that will be selected\n     * @return The top-most pixel we can draw the selection into\n     */\n    private getTopSelectionPixel(childrenTop:number, fadingEdgeLength:number, selectedPosition:number):number  {\n        // first pixel we can draw the selection into\n        let topSelectionPixel:number = childrenTop;\n        if (selectedPosition > 0) {\n            topSelectionPixel += fadingEdgeLength;\n        }\n        return topSelectionPixel;\n    }\n\n    /**\n     * Smoothly scroll to the specified adapter position. The view will\n     * scroll such that the indicated position is displayed.\n     * @param position Scroll to this adapter position.\n     */\n    smoothScrollToPosition(position:number, boundPosition?:number):void  {\n        super.smoothScrollToPosition(position, boundPosition);\n    }\n\n    /**\n     * Smoothly scroll to the specified adapter position offset. The view will\n     * scroll such that the indicated position is displayed.\n     * @param offset The amount to offset from the adapter position to scroll to.\n     */\n    smoothScrollByOffset(offset:number):void  {\n        super.smoothScrollByOffset(offset);\n    }\n\n    /**\n     * Fills the list based on positioning the new selection relative to the old\n     * selection. The new selection will be placed at, above, or below the\n     * location of the new selection depending on how the selection is moving.\n     * The selection will then be pinned to the visible part of the screen,\n     * excluding the edges that are faded. The list is then filled upwards and\n     * downwards from there.\n     *\n     * @param oldSel The old selected view. Useful for trying to put the new\n     *        selection in the same place\n     * @param newSel The view that is to become selected. Useful for trying to\n     *        put the new selection in the same place\n     * @param delta Which way we are moving\n     * @param childrenTop Where to start drawing children\n     * @param childrenBottom Last pixel where children can be drawn\n     * @return The view that currently has selection\n     */\n    private moveSelection(oldSel:View, newSel:View, delta:number, childrenTop:number, childrenBottom:number):View  {\n        let fadingEdgeLength:number = this.getVerticalFadingEdgeLength();\n        const selectedPosition:number = this.mSelectedPosition;\n        let sel:View;\n        const topSelectionPixel:number = this.getTopSelectionPixel(childrenTop, fadingEdgeLength, selectedPosition);\n        const bottomSelectionPixel:number = this.getBottomSelectionPixel(childrenTop, fadingEdgeLength, selectedPosition);\n        if (delta > 0) {\n            /*\n             * Case 1: Scrolling down.\n             */\n            /*\n             *     Before           After\n             *    |       |        |       |\n             *    +-------+        +-------+\n             *    |   A   |        |   A   |\n             *    |   1   |   =>   +-------+\n             *    +-------+        |   B   |\n             *    |   B   |        |   2   |\n             *    +-------+        +-------+\n             *    |       |        |       |\n             *\n             *    Try to keep the top of the previously selected item where it was.\n             *    oldSel = A\n             *    sel = B\n             */\n            // Put oldSel (A) where it belongs\n            oldSel = this.makeAndAddView(selectedPosition - 1, oldSel.getTop(), true, this.mListPadding.left, false);\n            const dividerHeight:number = this.mDividerHeight;\n            // Now put the new selection (B) below that\n            sel = this.makeAndAddView(selectedPosition, oldSel.getBottom() + dividerHeight, true, this.mListPadding.left, true);\n            // Some of the newly selected item extends below the bottom of the list\n            if (sel.getBottom() > bottomSelectionPixel) {\n                // Find space available above the selection into which we can scroll upwards\n                let spaceAbove:number = sel.getTop() - topSelectionPixel;\n                // Find space required to bring the bottom of the selected item fully into view\n                let spaceBelow:number = sel.getBottom() - bottomSelectionPixel;\n                // Don't scroll more than half the height of the list\n                let halfVerticalSpace:number = (childrenBottom - childrenTop) / 2;\n                let offset:number = Math.min(spaceAbove, spaceBelow);\n                offset = Math.min(offset, halfVerticalSpace);\n                // We placed oldSel, so offset that item\n                oldSel.offsetTopAndBottom(-offset);\n                // Now offset the selected item to get it into view\n                sel.offsetTopAndBottom(-offset);\n            }\n            // Fill in views above and below\n            if (!this.mStackFromBottom) {\n                this.fillUp(this.mSelectedPosition - 2, sel.getTop() - dividerHeight);\n                this.adjustViewsUpOrDown();\n                this.fillDown(this.mSelectedPosition + 1, sel.getBottom() + dividerHeight);\n            } else {\n                this.fillDown(this.mSelectedPosition + 1, sel.getBottom() + dividerHeight);\n                this.adjustViewsUpOrDown();\n                this.fillUp(this.mSelectedPosition - 2, sel.getTop() - dividerHeight);\n            }\n        } else if (delta < 0) {\n            if (newSel != null) {\n                // Try to position the top of newSel (A) where it was before it was selected\n                sel = this.makeAndAddView(selectedPosition, newSel.getTop(), true, this.mListPadding.left, true);\n            } else {\n                // If (A) was not on screen and so did not have a view, position\n                // it above the oldSel (B)\n                sel = this.makeAndAddView(selectedPosition, oldSel.getTop(), false, this.mListPadding.left, true);\n            }\n            // Some of the newly selected item extends above the top of the list\n            if (sel.getTop() < topSelectionPixel) {\n                // Find space required to bring the top of the selected item fully into view\n                let spaceAbove:number = topSelectionPixel - sel.getTop();\n                // Find space available below the selection into which we can scroll downwards\n                let spaceBelow:number = bottomSelectionPixel - sel.getBottom();\n                // Don't scroll more than half the height of the list\n                let halfVerticalSpace:number = (childrenBottom - childrenTop) / 2;\n                let offset:number = Math.min(spaceAbove, spaceBelow);\n                offset = Math.min(offset, halfVerticalSpace);\n                // Offset the selected item to get it into view\n                sel.offsetTopAndBottom(offset);\n            }\n            // Fill in views above and below\n            this.fillAboveAndBelow(sel, selectedPosition);\n        } else {\n            let oldTop:number = oldSel.getTop();\n            /*\n             * Case 3: Staying still\n             */\n            sel = this.makeAndAddView(selectedPosition, oldTop, true, this.mListPadding.left, true);\n            // We're staying still...\n            if (oldTop < childrenTop) {\n                // ... but the top of the old selection was off screen.\n                // (This can happen if the data changes size out from under us)\n                let newBottom:number = sel.getBottom();\n                if (newBottom < childrenTop + 20) {\n                    // Not enough visible -- bring it onscreen\n                    sel.offsetTopAndBottom(childrenTop - sel.getTop());\n                }\n            }\n            // Fill in views above and below\n            this.fillAboveAndBelow(sel, selectedPosition);\n        }\n        return sel;\n    }\n\n\n\n    protected onSizeChanged(w:number, h:number, oldw:number, oldh:number):void  {\n        if (this.getChildCount() > 0) {\n            let focusedChild:View = this.getFocusedChild();\n            if (focusedChild != null) {\n                const childPosition:number = this.mFirstPosition + this.indexOfChild(focusedChild);\n                const childBottom:number = focusedChild.getBottom();\n                const offset:number = Math.max(0, childBottom - (h - this.mPaddingTop));\n                const top:number = focusedChild.getTop() - offset;\n                if (this.mFocusSelector == null) {\n                    this.mFocusSelector = new ListView.FocusSelector(this);\n                }\n                this.post(this.mFocusSelector.setup(childPosition, top));\n            }\n        }\n        super.onSizeChanged(w, h, oldw, oldh);\n    }\n\n    protected onMeasure(widthMeasureSpec:number, heightMeasureSpec:number):void  {\n        // Sets up mListPadding\n        super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n        let widthMode:number = View.MeasureSpec.getMode(widthMeasureSpec);\n        let heightMode:number = View.MeasureSpec.getMode(heightMeasureSpec);\n        let widthSize:number = View.MeasureSpec.getSize(widthMeasureSpec);\n        let heightSize:number = View.MeasureSpec.getSize(heightMeasureSpec);\n        let childWidth:number = 0;\n        let childHeight:number = 0;\n        let childState:number = 0;\n        this.mItemCount = this.mAdapter == null ? 0 : this.mAdapter.getCount();\n        if (this.mItemCount > 0 && (widthMode == View.MeasureSpec.UNSPECIFIED || heightMode == View.MeasureSpec.UNSPECIFIED)) {\n            const child:View = this.obtainView(0, this.mIsScrap);\n            this.measureScrapChild(child, 0, widthMeasureSpec);\n            childWidth = child.getMeasuredWidth();\n            childHeight = child.getMeasuredHeight();\n            childState = ListView.combineMeasuredStates(childState, child.getMeasuredState());\n            if (this.recycleOnMeasure() && this.mRecycler.shouldRecycleViewType((<AbsListView.LayoutParams> child.getLayoutParams()).viewType)) {\n                this.mRecycler.addScrapView(child, -1);\n            }\n        }\n        if (widthMode == View.MeasureSpec.UNSPECIFIED) {\n            widthSize = this.mListPadding.left + this.mListPadding.right + childWidth + this.getVerticalScrollbarWidth();\n        } else {\n            widthSize |= (childState & ListView.MEASURED_STATE_MASK);\n        }\n        if (heightMode == View.MeasureSpec.UNSPECIFIED) {\n            heightSize = this.mListPadding.top + this.mListPadding.bottom + childHeight + this.getVerticalFadingEdgeLength() * 2;\n        }\n        if (heightMode == View.MeasureSpec.AT_MOST) {\n            // TODO: after first layout we should maybe start at the first visible position, not 0\n            heightSize = this.measureHeightOfChildren(widthMeasureSpec, 0, ListView.NO_POSITION, heightSize, -1);\n        }\n        this.setMeasuredDimension(widthSize, heightSize);\n        this.mWidthMeasureSpec = widthMeasureSpec;\n    }\n\n    private measureScrapChild(child:View, position:number, widthMeasureSpec:number):void  {\n        let p:AbsListView.LayoutParams = <AbsListView.LayoutParams> child.getLayoutParams();\n        if (p == null) {\n            p = <AbsListView.LayoutParams> this.generateDefaultLayoutParams();\n            child.setLayoutParams(p);\n        }\n        p.viewType = this.mAdapter.getItemViewType(position);\n        p.forceAdd = true;\n        let childWidthSpec:number = ViewGroup.getChildMeasureSpec(widthMeasureSpec, this.mListPadding.left + this.mListPadding.right, p.width);\n        let lpHeight:number = p.height;\n        let childHeightSpec:number;\n        if (lpHeight > 0) {\n            childHeightSpec = View.MeasureSpec.makeMeasureSpec(lpHeight, View.MeasureSpec.EXACTLY);\n        } else {\n            childHeightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n        }\n        child.measure(childWidthSpec, childHeightSpec);\n    }\n\n    /**\n     * @return True to recycle the views used to measure this ListView in\n     *         UNSPECIFIED/AT_MOST modes, false otherwise.\n     * @hide\n     */\n    protected recycleOnMeasure():boolean  {\n        return true;\n    }\n\n    /**\n     * Measures the height of the given range of children (inclusive) and\n     * returns the height with this ListView's padding and divider heights\n     * included. If maxHeight is provided, the measuring will stop when the\n     * current height reaches maxHeight.\n     *\n     * @param widthMeasureSpec The width measure spec to be given to a child's\n     *            {@link View#measure(int, int)}.\n     * @param startPosition The position of the first child to be shown.\n     * @param endPosition The (inclusive) position of the last child to be\n     *            shown. Specify {@link #NO_POSITION} if the last child should be\n     *            the last available child from the adapter.\n     * @param maxHeight The maximum height that will be returned (if all the\n     *            children don't fit in this value, this value will be\n     *            returned).\n     * @param disallowPartialChildPosition In general, whether the returned\n     *            height should only contain entire children. This is more\n     *            powerful--it is the first inclusive position at which partial\n     *            children will not be allowed. Example: it looks nice to have\n     *            at least 3 completely visible children, and in portrait this\n     *            will most likely fit; but in landscape there could be times\n     *            when even 2 children can not be completely shown, so a value\n     *            of 2 (remember, inclusive) would be good (assuming\n     *            startPosition is 0).\n     * @return The height of this ListView with the given children.\n     */\n    measureHeightOfChildren(widthMeasureSpec:number, startPosition:number, endPosition:number, maxHeight:number, disallowPartialChildPosition:number):number  {\n        const adapter:ListAdapter = this.mAdapter;\n        if (adapter == null) {\n            return this.mListPadding.top + this.mListPadding.bottom;\n        }\n        // Include the padding of the list\n        let returnedHeight:number = this.mListPadding.top + this.mListPadding.bottom;\n        const dividerHeight:number = ((this.mDividerHeight > 0) && this.mDivider != null) ? this.mDividerHeight : 0;\n        // The previous height value that was less than maxHeight and contained\n        // no partial children\n        let prevHeightWithoutPartialChild:number = 0;\n        let i:number;\n        let child:View;\n        // mItemCount - 1 since endPosition parameter is inclusive\n        endPosition = (endPosition == ListView.NO_POSITION) ? adapter.getCount() - 1 : endPosition;\n        const recycleBin:AbsListView.RecycleBin = this.mRecycler;\n        const recyle:boolean = this.recycleOnMeasure();\n        const isScrap:boolean[] = this.mIsScrap;\n        for (i = startPosition; i <= endPosition; ++i) {\n            child = this.obtainView(i, isScrap);\n            this.measureScrapChild(child, i, widthMeasureSpec);\n            if (i > 0) {\n                // Count the divider for all but one child\n                returnedHeight += dividerHeight;\n            }\n            // Recycle the view before we possibly return from the method\n            if (recyle && recycleBin.shouldRecycleViewType((<AbsListView.LayoutParams> child.getLayoutParams()).viewType)) {\n                recycleBin.addScrapView(child, -1);\n            }\n            returnedHeight += child.getMeasuredHeight();\n            if (returnedHeight >= maxHeight) {\n                // then the i'th position did not fit completely.\n                // Disallowing is enabled (> -1)\n                return (disallowPartialChildPosition >= 0) && // We've past the min pos\n                (i > disallowPartialChildPosition) && // We have a prev height\n                (prevHeightWithoutPartialChild > 0) && // i'th child did not fit completely\n                (returnedHeight != maxHeight) ? prevHeightWithoutPartialChild : maxHeight;\n            }\n            if ((disallowPartialChildPosition >= 0) && (i >= disallowPartialChildPosition)) {\n                prevHeightWithoutPartialChild = returnedHeight;\n            }\n        }\n        // completely fit, so return the returnedHeight\n        return returnedHeight;\n    }\n\n    findMotionRow(y:number):number  {\n        let childCount:number = this.getChildCount();\n        if (childCount > 0) {\n            if (!this.mStackFromBottom) {\n                for (let i:number = 0; i < childCount; i++) {\n                    let v:View = this.getChildAt(i);\n                    if (y <= v.getBottom()) {\n                        return this.mFirstPosition + i;\n                    }\n                }\n            } else {\n                for (let i:number = childCount - 1; i >= 0; i--) {\n                    let v:View = this.getChildAt(i);\n                    if (y >= v.getTop()) {\n                        return this.mFirstPosition + i;\n                    }\n                }\n            }\n        }\n        return ListView.INVALID_POSITION;\n    }\n\n    /**\n     * Put a specific item at a specific location on the screen and then build\n     * up and down from there.\n     *\n     * @param position The reference view to use as the starting point\n     * @param top Pixel offset from the top of this view to the top of the\n     *        reference view.\n     *\n     * @return The selected view, or null if the selected view is outside the\n     *         visible area.\n     */\n    private fillSpecific(position:number, top:number):View  {\n        let tempIsSelected:boolean = position == this.mSelectedPosition;\n        let temp:View = this.makeAndAddView(position, top, true, this.mListPadding.left, tempIsSelected);\n        // Possibly changed again in fillUp if we add rows above this one.\n        this.mFirstPosition = position;\n        let above:View;\n        let below:View;\n        const dividerHeight:number = this.mDividerHeight;\n        if (!this.mStackFromBottom) {\n            above = this.fillUp(position - 1, temp.getTop() - dividerHeight);\n            // This will correct for the top of the first view not touching the top of the list\n            this.adjustViewsUpOrDown();\n            below = this.fillDown(position + 1, temp.getBottom() + dividerHeight);\n            let childCount:number = this.getChildCount();\n            if (childCount > 0) {\n                this.correctTooHigh(childCount);\n            }\n        } else {\n            below = this.fillDown(position + 1, temp.getBottom() + dividerHeight);\n            // This will correct for the bottom of the last view not touching the bottom of the list\n            this.adjustViewsUpOrDown();\n            above = this.fillUp(position - 1, temp.getTop() - dividerHeight);\n            let childCount:number = this.getChildCount();\n            if (childCount > 0) {\n                this.correctTooLow(childCount);\n            }\n        }\n        if (tempIsSelected) {\n            return temp;\n        } else if (above != null) {\n            return above;\n        } else {\n            return below;\n        }\n    }\n\n    /**\n     * Check if we have dragged the bottom of the list too high (we have pushed the\n     * top element off the top of the screen when we did not need to). Correct by sliding\n     * everything back down.\n     *\n     * @param childCount Number of children\n     */\n    private correctTooHigh(childCount:number):void  {\n        // First see if the last item is visible. If it is not, it is OK for the\n        // top of the list to be pushed up.\n        let lastPosition:number = this.mFirstPosition + childCount - 1;\n        if (lastPosition == this.mItemCount - 1 && childCount > 0) {\n            // Get the last child ...\n            const lastChild:View = this.getChildAt(childCount - 1);\n            // ... and its bottom edge\n            const lastBottom:number = lastChild.getBottom();\n            // This is bottom of our drawable area\n            const end:number = (this.mBottom - this.mTop) - this.mListPadding.bottom;\n            // This is how far the bottom edge of the last view is from the bottom of the\n            // drawable area\n            let bottomOffset:number = end - lastBottom;\n            let firstChild:View = this.getChildAt(0);\n            const firstTop:number = firstChild.getTop();\n            // first row or the first row is scrolled off the top of the drawable area\n            if (bottomOffset > 0 && (this.mFirstPosition > 0 || firstTop < this.mListPadding.top)) {\n                if (this.mFirstPosition == 0) {\n                    // Don't pull the top too far down\n                    bottomOffset = Math.min(bottomOffset, this.mListPadding.top - firstTop);\n                }\n                // Move everything down\n                this.offsetChildrenTopAndBottom(bottomOffset);\n                if (this.mFirstPosition > 0) {\n                    // Fill the gap that was opened above mFirstPosition with more rows, if\n                    // possible\n                    this.fillUp(this.mFirstPosition - 1, firstChild.getTop() - this.mDividerHeight);\n                    // Close up the remaining gap\n                    this.adjustViewsUpOrDown();\n                }\n            }\n        }\n    }\n\n    /**\n     * Check if we have dragged the bottom of the list too low (we have pushed the\n     * bottom element off the bottom of the screen when we did not need to). Correct by sliding\n     * everything back up.\n     *\n     * @param childCount Number of children\n     */\n    private correctTooLow(childCount:number):void  {\n        // bottom of the list to be pushed down.\n        if (this.mFirstPosition == 0 && childCount > 0) {\n            // Get the first child ...\n            const firstChild:View = this.getChildAt(0);\n            // ... and its top edge\n            const firstTop:number = firstChild.getTop();\n            // This is top of our drawable area\n            const start:number = this.mListPadding.top;\n            // This is bottom of our drawable area\n            const end:number = (this.mBottom - this.mTop) - this.mListPadding.bottom;\n            // This is how far the top edge of the first view is from the top of the\n            // drawable area\n            let topOffset:number = firstTop - start;\n            let lastChild:View = this.getChildAt(childCount - 1);\n            const lastBottom:number = lastChild.getBottom();\n            let lastPosition:number = this.mFirstPosition + childCount - 1;\n            // last row or the last row is scrolled off the bottom of the drawable area\n            if (topOffset > 0) {\n                if (lastPosition < this.mItemCount - 1 || lastBottom > end) {\n                    if (lastPosition == this.mItemCount - 1) {\n                        // Don't pull the bottom too far up\n                        topOffset = Math.min(topOffset, lastBottom - end);\n                    }\n                    // Move everything up\n                    this.offsetChildrenTopAndBottom(-topOffset);\n                    if (lastPosition < this.mItemCount - 1) {\n                        // Fill the gap that was opened below the last position with more rows, if\n                        // possible\n                        this.fillDown(lastPosition + 1, lastChild.getBottom() + this.mDividerHeight);\n                        // Close up the remaining gap\n                        this.adjustViewsUpOrDown();\n                    }\n                } else if (lastPosition == this.mItemCount - 1) {\n                    this.adjustViewsUpOrDown();\n                }\n            }\n        }\n    }\n\n    layoutChildren():void  {\n        const blockLayoutRequests:boolean = this.mBlockLayoutRequests;\n        if (blockLayoutRequests) {\n            return;\n        }\n        this.mBlockLayoutRequests = true;\n        try {\n            super.layoutChildren();\n            this.invalidate();\n            if (this.mAdapter == null) {\n                this.resetList();\n                this.invokeOnItemScrollListener();\n                return;\n            }\n            const childrenTop:number = this.mListPadding.top;\n            const childrenBottom:number = this.mBottom - this.mTop - this.mListPadding.bottom;\n            const childCount:number = this.getChildCount();\n            let index:number = 0;\n            let delta:number = 0;\n            let sel:View;\n            let oldSel:View = null;\n            let oldFirst:View = null;\n            let newSel:View = null;\n            // Remember stuff we will need down below\n            switch(this.mLayoutMode) {\n                case ListView.LAYOUT_SET_SELECTION:\n                    index = this.mNextSelectedPosition - this.mFirstPosition;\n                    if (index >= 0 && index < childCount) {\n                        newSel = this.getChildAt(index);\n                    }\n                    break;\n                case ListView.LAYOUT_FORCE_TOP:\n                case ListView.LAYOUT_FORCE_BOTTOM:\n                case ListView.LAYOUT_SPECIFIC:\n                case ListView.LAYOUT_SYNC:\n                    break;\n                case ListView.LAYOUT_MOVE_SELECTION:\n                default:\n                    // Remember the previously selected view\n                    index = this.mSelectedPosition - this.mFirstPosition;\n                    if (index >= 0 && index < childCount) {\n                        oldSel = this.getChildAt(index);\n                    }\n                    // Remember the previous first child\n                    oldFirst = this.getChildAt(0);\n                    if (this.mNextSelectedPosition >= 0) {\n                        delta = this.mNextSelectedPosition - this.mSelectedPosition;\n                    }\n                    // Caution: newSel might be null\n                    newSel = this.getChildAt(index + delta);\n            }\n            let dataChanged:boolean = this.mDataChanged;\n            if (dataChanged) {\n                this.handleDataChanged();\n            }\n            // and calling it a day\n            if (this.mItemCount == 0) {\n                this.resetList();\n                this.invokeOnItemScrollListener();\n                return;\n            } else if (this.mItemCount != this.mAdapter.getCount()) {\n                throw Error(`IllegalStateException(\"The content of the adapter has changed but\n                ListView did not receive a notification. Make sure the content of\n                your adapter is not modified from a background thread, but only from\n                the UI thread. Make sure your adapter calls notifyDataSetChanged()\n                when its content changes. [in ListView(${this.getId()},${this.constructor.name})\n                with Adapter(${this.mAdapter.constructor.name})]\")`);\n            }\n            this.setSelectedPositionInt(this.mNextSelectedPosition);\n            // Remember which child, if any, had accessibility focus.\n            //let accessibilityFocusPosition:number;\n            const accessFocusedChild:View = null;//this.getAccessibilityFocusedChild();\n            //if (accessFocusedChild != null) {\n            //    accessibilityFocusPosition = this.getPositionForView(accessFocusedChild);\n            //    accessFocusedChild.setHasTransientState(true);\n            //} else {\n            //    accessibilityFocusPosition = ListView.INVALID_POSITION;\n            //}\n            // Ensure the child containing focus, if any, has transient state.\n            // If the list data hasn't changed, or if the adapter has stable\n            // IDs, this will maintain focus.\n            const focusedChild:View = this.getFocusedChild();\n            if (focusedChild != null) {\n                focusedChild.setHasTransientState(true);\n            }\n            // Pull all children into the RecycleBin.\n            // These views will be reused if possible\n            const firstPosition:number = this.mFirstPosition;\n            const recycleBin:AbsListView.RecycleBin = this.mRecycler;\n            if (dataChanged) {\n                for (let i:number = 0; i < childCount; i++) {\n                    recycleBin.addScrapView(this.getChildAt(i), firstPosition + i);\n                }\n            } else {\n                recycleBin.fillActiveViews(childCount, firstPosition);\n            }\n            // Clear out old views\n            this.detachAllViewsFromParent();\n            recycleBin.removeSkippedScrap();\n            switch(this.mLayoutMode) {\n                case ListView.LAYOUT_SET_SELECTION:\n                    if (newSel != null) {\n                        sel = this.fillFromSelection(newSel.getTop(), childrenTop, childrenBottom);\n                    } else {\n                        sel = this.fillFromMiddle(childrenTop, childrenBottom);\n                    }\n                    break;\n                case ListView.LAYOUT_SYNC:\n                    sel = this.fillSpecific(this.mSyncPosition, this.mSpecificTop);\n                    break;\n                case ListView.LAYOUT_FORCE_BOTTOM:\n                    sel = this.fillUp(this.mItemCount - 1, childrenBottom);\n                    this.adjustViewsUpOrDown();\n                    break;\n                case ListView.LAYOUT_FORCE_TOP:\n                    this.mFirstPosition = 0;\n                    sel = this.fillFromTop(childrenTop);\n                    this.adjustViewsUpOrDown();\n                    break;\n                case ListView.LAYOUT_SPECIFIC:\n                    sel = this.fillSpecific(this.reconcileSelectedPosition(), this.mSpecificTop);\n                    break;\n                case ListView.LAYOUT_MOVE_SELECTION:\n                    sel = this.moveSelection(oldSel, newSel, delta, childrenTop, childrenBottom);\n                    break;\n                default:\n                    if (childCount == 0) {\n                        if (!this.mStackFromBottom) {\n                            const position:number = this.lookForSelectablePosition(0, true);\n                            this.setSelectedPositionInt(position);\n                            sel = this.fillFromTop(childrenTop);\n                        } else {\n                            const position:number = this.lookForSelectablePosition(this.mItemCount - 1, false);\n                            this.setSelectedPositionInt(position);\n                            sel = this.fillUp(this.mItemCount - 1, childrenBottom);\n                        }\n                    } else {\n                        if (this.mSelectedPosition >= 0 && this.mSelectedPosition < this.mItemCount) {\n                            sel = this.fillSpecific(this.mSelectedPosition, oldSel == null ? childrenTop : oldSel.getTop());\n                        } else if (this.mFirstPosition < this.mItemCount) {\n                            sel = this.fillSpecific(this.mFirstPosition, oldFirst == null ? childrenTop : oldFirst.getTop());\n                        } else {\n                            sel = this.fillSpecific(0, childrenTop);\n                        }\n                    }\n                    break;\n            }\n            // Flush any cached views that did not get reused above\n            recycleBin.scrapActiveViews();\n            if (sel != null) {\n                const shouldPlaceFocus:boolean = this.mItemsCanFocus && this.hasFocus();\n                const maintainedFocus:boolean = focusedChild != null && focusedChild.hasFocus();\n                if (shouldPlaceFocus && !maintainedFocus && !sel.hasFocus()) {\n                    if (sel.requestFocus()) {\n                        // Successfully placed focus, clear selection.\n                        sel.setSelected(false);\n                        this.mSelectorRect.setEmpty();\n                    } else {\n                        // Failed to place focus, clear current (invalid) focus.\n                        const focused:View = this.getFocusedChild();\n                        if (focused != null) {\n                            focused.clearFocus();\n                        }\n                        this.positionSelector(ListView.INVALID_POSITION, sel);\n                    }\n                } else {\n                    this.positionSelector(ListView.INVALID_POSITION, sel);\n                }\n                this.mSelectedTop = sel.getTop();\n            } else {\n                // Otherwise, clear selection.\n                if (this.mTouchMode == ListView.TOUCH_MODE_TAP || this.mTouchMode == ListView.TOUCH_MODE_DONE_WAITING) {\n                    const child:View = this.getChildAt(this.mMotionPosition - this.mFirstPosition);\n                    if (child != null) {\n                        this.positionSelector(this.mMotionPosition, child);\n                    }\n                } else {\n                    this.mSelectedTop = 0;\n                    this.mSelectorRect.setEmpty();\n                }\n            }\n            if (accessFocusedChild != null) {\n                accessFocusedChild.setHasTransientState(false);\n                // view, attempt to restore it to the previous position.\n                //if (!accessFocusedChild.isAccessibilityFocused() && accessibilityFocusPosition != ListView.INVALID_POSITION) {\n                //    // Bound the position within the visible children.\n                //    const position:number = MathUtils.constrain(accessibilityFocusPosition - this.mFirstPosition, 0, this.getChildCount() - 1);\n                //    const restoreView:View = this.getChildAt(position);\n                //    if (restoreView != null) {\n                //        restoreView.requestAccessibilityFocus();\n                //    }\n                //}\n            }\n            if (focusedChild != null) {\n                focusedChild.setHasTransientState(false);\n            }\n            this.mLayoutMode = ListView.LAYOUT_NORMAL;\n            this.mDataChanged = false;\n            if (this.mPositionScrollAfterLayout != null) {\n                this.post(this.mPositionScrollAfterLayout);\n                this.mPositionScrollAfterLayout = null;\n            }\n            this.mNeedSync = false;\n            this.setNextSelectedPositionInt(this.mSelectedPosition);\n            this.updateScrollIndicators();\n            if (this.mItemCount > 0) {\n                this.checkSelectionChanged();\n            }\n            this.invokeOnItemScrollListener();\n        } finally {\n            if (!blockLayoutRequests) {\n                this.mBlockLayoutRequests = false;\n            }\n        }\n    }\n\n    /**\n     * @return the direct child that contains accessibility focus, or null if no\n     *         child contains accessibility focus\n     */\n    //private getAccessibilityFocusedChild():View  {\n    //    const viewRootImpl:ViewRootImpl = this.getViewRootImpl();\n    //    if (viewRootImpl == null) {\n    //        return null;\n    //    }\n    //    let focusedView:View = viewRootImpl.getAccessibilityFocusedHost();\n    //    if (focusedView == null) {\n    //        return null;\n    //    }\n    //    let viewParent:ViewParent = focusedView.getParent();\n    //    while ((viewParent instanceof View) && (viewParent != this)) {\n    //        focusedView = <View> viewParent;\n    //        viewParent = viewParent.getParent();\n    //    }\n    //    if (!(viewParent instanceof View)) {\n    //        return null;\n    //    }\n    //    return focusedView;\n    //}\n\n    /**\n     * Obtain the view and add it to our list of children. The view can be made\n     * fresh, converted from an unused view, or used as is if it was in the\n     * recycle bin.\n     *\n     * @param position Logical position in the list\n     * @param y Top or bottom edge of the view to add\n     * @param flow If flow is true, align top edge to y. If false, align bottom\n     *        edge to y.\n     * @param childrenLeft Left edge where children should be positioned\n     * @param selected Is this position selected?\n     * @return View that was added\n     */\n    private makeAndAddView(position:number, y:number, flow:boolean, childrenLeft:number, selected:boolean):View  {\n        let child:View;\n        if (!this.mDataChanged) {\n            // Try to use an existing view for this position\n            child = this.mRecycler.getActiveView(position);\n            if (child != null) {\n                // Found it -- we're using an existing child\n                // This just needs to be positioned\n                this.setupChild(child, position, y, flow, childrenLeft, selected, true);\n                return child;\n            }\n        }\n        // Make a new view for this position, or convert an unused view if possible\n        child = this.obtainView(position, this.mIsScrap);\n        // This needs to be positioned and measured\n        this.setupChild(child, position, y, flow, childrenLeft, selected, this.mIsScrap[0]);\n        return child;\n    }\n\n    /**\n     * Add a view as a child and make sure it is measured (if necessary) and\n     * positioned properly.\n     *\n     * @param child The view to add\n     * @param position The position of this child\n     * @param y The y position relative to which this view will be positioned\n     * @param flowDown If true, align top edge to y. If false, align bottom\n     *        edge to y.\n     * @param childrenLeft Left edge where children should be positioned\n     * @param selected Is this position selected?\n     * @param recycled Has this view been pulled from the recycle bin? If so it\n     *        does not need to be remeasured.\n     */\n    private setupChild(child:View, position:number, y:number, flowDown:boolean, childrenLeft:number, selected:boolean, recycled:boolean):void  {\n        Trace.traceBegin(Trace.TRACE_TAG_VIEW, \"setupListItem\");\n        const isSelected:boolean = selected && this.shouldShowSelector();\n        const updateChildSelected:boolean = isSelected != child.isSelected();\n        const mode:number = this.mTouchMode;\n        const isPressed:boolean = mode > ListView.TOUCH_MODE_DOWN && mode < ListView.TOUCH_MODE_SCROLL && this.mMotionPosition == position;\n        const updateChildPressed:boolean = isPressed != child.isPressed();\n        const needToMeasure:boolean = !recycled || updateChildSelected || child.isLayoutRequested();\n        // Respect layout params that are already in the view. Otherwise make some up...\n        // noinspection unchecked\n        let p:AbsListView.LayoutParams = <AbsListView.LayoutParams> child.getLayoutParams();\n        if (p == null) {\n            p = <AbsListView.LayoutParams> this.generateDefaultLayoutParams();\n        }\n        if(!(p instanceof AbsListView.LayoutParams)){\n            const name = p instanceof Function ? (<Function>p).constructor.name : p + '';\n            throw Error('ClassCaseException(' + name + ' can\\'t case to AbsListView.LayoutParams)');\n        }\n        p.viewType = this.mAdapter.getItemViewType(position);\n        if ((recycled && !p.forceAdd) || (p.recycledHeaderFooter && p.viewType == AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER)) {\n            this.attachViewToParent(child, flowDown ? -1 : 0, p);\n        } else {\n            p.forceAdd = false;\n            if (p.viewType == AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER) {\n                p.recycledHeaderFooter = true;\n            }\n            this.addViewInLayout(child, flowDown ? -1 : 0, p, true);\n        }\n        if (updateChildSelected) {\n            child.setSelected(isSelected);\n        }\n        if (updateChildPressed) {\n            child.setPressed(isPressed);\n        }\n        if (this.mChoiceMode != ListView.CHOICE_MODE_NONE && this.mCheckStates != null) {\n            if (child['setChecked']) {\n                (<Checkable><any>child).setChecked(this.mCheckStates.get(position));\n            } else {\n                child.setActivated(this.mCheckStates.get(position));\n            }\n        }\n        if (needToMeasure) {\n            let childWidthSpec:number = ViewGroup.getChildMeasureSpec(this.mWidthMeasureSpec, this.mListPadding.left + this.mListPadding.right, p.width);\n            let lpHeight:number = p.height;\n            let childHeightSpec:number;\n            if (lpHeight > 0) {\n                childHeightSpec = View.MeasureSpec.makeMeasureSpec(lpHeight, View.MeasureSpec.EXACTLY);\n            } else {\n                childHeightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n            }\n            child.measure(childWidthSpec, childHeightSpec);\n        } else {\n            this.cleanupLayoutState(child);\n        }\n        const w:number = child.getMeasuredWidth();\n        const h:number = child.getMeasuredHeight();\n        const childTop:number = flowDown ? y : y - h;\n        if (needToMeasure) {\n            const childRight:number = childrenLeft + w;\n            const childBottom:number = childTop + h;\n            child.layout(childrenLeft, childTop, childRight, childBottom);\n        } else {\n            child.offsetLeftAndRight(childrenLeft - child.getLeft());\n            child.offsetTopAndBottom(childTop - child.getTop());\n        }\n        if (this.mCachingStarted && !child.isDrawingCacheEnabled()) {\n            child.setDrawingCacheEnabled(true);\n        }\n        if (recycled && ((<AbsListView.LayoutParams> child.getLayoutParams()).scrappedFromPosition) != position) {\n            child.jumpDrawablesToCurrentState();\n        }\n        Trace.traceEnd(Trace.TRACE_TAG_VIEW);\n    }\n\n    canAnimate():boolean  {\n        return super.canAnimate() && this.mItemCount > 0;\n    }\n\n    /**\n     * Sets the currently selected item. If in touch mode, the item will not be selected\n     * but it will still be positioned appropriately. If the specified selection position\n     * is less than 0, then the item at position 0 will be selected.\n     *\n     * @param position Index (starting at 0) of the data item to be selected.\n     */\n    setSelection(position:number):void  {\n        this.setSelectionFromTop(position, 0);\n    }\n\n    /**\n     * Sets the selected item and positions the selection y pixels from the top edge\n     * of the ListView. (If in touch mode, the item will not be selected but it will\n     * still be positioned appropriately.)\n     *\n     * @param position Index (starting at 0) of the data item to be selected.\n     * @param y The distance from the top edge of the ListView (plus padding) that the\n     *        item will be positioned.\n     */\n    setSelectionFromTop(position:number, y:number):void  {\n        if (this.mAdapter == null) {\n            return;\n        }\n        if (!this.isInTouchMode()) {\n            position = this.lookForSelectablePosition(position, true);\n            if (position >= 0) {\n                this.setNextSelectedPositionInt(position);\n            }\n        } else {\n            this.mResurrectToPosition = position;\n        }\n        if (position >= 0) {\n            this.mLayoutMode = ListView.LAYOUT_SPECIFIC;\n            this.mSpecificTop = this.mListPadding.top + y;\n            if (this.mNeedSync) {\n                this.mSyncPosition = position;\n                this.mSyncRowId = this.mAdapter.getItemId(position);\n            }\n            if (this.mPositionScroller != null) {\n                this.mPositionScroller.stop();\n            }\n            this.requestLayout();\n        }\n    }\n\n    /**\n     * Makes the item at the supplied position selected.\n     * \n     * @param position the position of the item to select\n     */\n    setSelectionInt(position:number):void  {\n        this.setNextSelectedPositionInt(position);\n        let awakeScrollbars:boolean = false;\n        const selectedPosition:number = this.mSelectedPosition;\n        if (selectedPosition >= 0) {\n            if (position == selectedPosition - 1) {\n                awakeScrollbars = true;\n            } else if (position == selectedPosition + 1) {\n                awakeScrollbars = true;\n            }\n        }\n        if (this.mPositionScroller != null) {\n            this.mPositionScroller.stop();\n        }\n        this.layoutChildren();\n        if (awakeScrollbars) {\n            this.awakenScrollBars();\n        }\n    }\n\n    /**\n     * Find a position that can be selected (i.e., is not a separator).\n     *\n     * @param position The starting position to look at.\n     * @param lookDown Whether to look down for other positions.\n     * @return The next selectable position starting at position and then searching either up or\n     *         down. Returns {@link #INVALID_POSITION} if nothing can be found.\n     */\n    lookForSelectablePosition(position:number, lookDown:boolean):number  {\n        const adapter:ListAdapter = this.mAdapter;\n        if (adapter == null || this.isInTouchMode()) {\n            return ListView.INVALID_POSITION;\n        }\n        const count:number = adapter.getCount();\n        if (!this.mAreAllItemsSelectable) {\n            if (lookDown) {\n                position = Math.max(0, position);\n                while (position < count && !adapter.isEnabled(position)) {\n                    position++;\n                }\n            } else {\n                position = Math.min(position, count - 1);\n                while (position >= 0 && !adapter.isEnabled(position)) {\n                    position--;\n                }\n            }\n        }\n        if (position < 0 || position >= count) {\n            return ListView.INVALID_POSITION;\n        }\n        return position;\n    }\n\n    /**\n     * Find a position that can be selected (i.e., is not a separator). If there\n     * are no selectable positions in the specified direction from the starting\n     * position, searches in the opposite direction from the starting position\n     * to the current position.\n     *\n     * @param current the current position\n     * @param position the starting position\n     * @param lookDown whether to look down for other positions\n     * @return the next selectable position, or {@link #INVALID_POSITION} if\n     *         nothing can be found\n     */\n    lookForSelectablePositionAfter(current:number, position:number, lookDown:boolean):number  {\n        const adapter:ListAdapter = this.mAdapter;\n        if (adapter == null || this.isInTouchMode()) {\n            return ListView.INVALID_POSITION;\n        }\n        // First check after the starting position in the specified direction.\n        const after:number = this.lookForSelectablePosition(position, lookDown);\n        if (after != ListView.INVALID_POSITION) {\n            return after;\n        }\n        // Then check between the starting position and the current position.\n        const count:number = adapter.getCount();\n        current = MathUtils.constrain(current, -1, count - 1);\n        if (lookDown) {\n            position = Math.min(position - 1, count - 1);\n            while ((position > current) && !adapter.isEnabled(position)) {\n                position--;\n            }\n            if (position <= current) {\n                return ListView.INVALID_POSITION;\n            }\n        } else {\n            position = Math.max(0, position + 1);\n            while ((position < current) && !adapter.isEnabled(position)) {\n                position++;\n            }\n            if (position >= current) {\n                return ListView.INVALID_POSITION;\n            }\n        }\n        return position;\n    }\n\n    /**\n     * setSelectionAfterHeaderView set the selection to be the first list item\n     * after the header views.\n     */\n    setSelectionAfterHeaderView():void  {\n        const count:number = this.mHeaderViewInfos.size();\n        if (count > 0) {\n            this.mNextSelectedPosition = 0;\n            return;\n        }\n        if (this.mAdapter != null) {\n            this.setSelection(count);\n        } else {\n            this.mNextSelectedPosition = count;\n            this.mLayoutMode = ListView.LAYOUT_SET_SELECTION;\n        }\n    }\n\n    dispatchKeyEvent(event:KeyEvent):boolean  {\n        // Dispatch in the normal way\n        let handled:boolean = super.dispatchKeyEvent(event);\n        if (!handled) {\n            // If we didn't handle it...\n            let focused:View = this.getFocusedChild();\n            if (focused != null && event.getAction() == KeyEvent.ACTION_DOWN) {\n                // ... and our focused child didn't handle it\n                // ... give it to ourselves so we can scroll if necessary\n                handled = this.onKeyDown(event.getKeyCode(), event);\n            }\n        }\n        return handled;\n    }\n\n    onKeyDown(keyCode:number, event:KeyEvent):boolean  {\n        return this.commonKey(keyCode, 1, event);\n    }\n\n    onKeyMultiple(keyCode:number, repeatCount:number, event:KeyEvent):boolean  {\n        return this.commonKey(keyCode, repeatCount, event);\n    }\n\n    onKeyUp(keyCode:number, event:KeyEvent):boolean  {\n        return this.commonKey(keyCode, 1, event);\n    }\n\n    private commonKey(keyCode:number, count:number, event:KeyEvent):boolean  {\n        if (this.mAdapter == null || !this.isAttachedToWindow()) {\n            return false;\n        }\n        if (this.mDataChanged) {\n            this.layoutChildren();\n        }\n        let handled:boolean = false;\n        let action:number = event.getAction();\n        if (action != KeyEvent.ACTION_UP) {\n            switch(keyCode) {\n                case KeyEvent.KEYCODE_DPAD_UP:\n                    if (event.hasNoModifiers()) {\n                        handled = this.resurrectSelectionIfNeeded();\n                        if (!handled) {\n                            while (count-- > 0) {\n                                if (this.arrowScroll(ListView.FOCUS_UP)) {\n                                    handled = true;\n                                } else {\n                                    break;\n                                }\n                            }\n                        }\n                    } else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {\n                        handled = this.resurrectSelectionIfNeeded() || this.fullScroll(ListView.FOCUS_UP);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_DPAD_DOWN:\n                    if (event.hasNoModifiers()) {\n                        handled = this.resurrectSelectionIfNeeded();\n                        if (!handled) {\n                            while (count-- > 0) {\n                                if (this.arrowScroll(ListView.FOCUS_DOWN)) {\n                                    handled = true;\n                                } else {\n                                    break;\n                                }\n                            }\n                        }\n                    } else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {\n                        handled = this.resurrectSelectionIfNeeded() || this.fullScroll(ListView.FOCUS_DOWN);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_DPAD_LEFT:\n                    if (event.hasNoModifiers()) {\n                        handled = this.handleHorizontalFocusWithinListItem(View.FOCUS_LEFT);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_DPAD_RIGHT:\n                    if (event.hasNoModifiers()) {\n                        handled = this.handleHorizontalFocusWithinListItem(View.FOCUS_RIGHT);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_DPAD_CENTER:\n                case KeyEvent.KEYCODE_ENTER:\n                    if (event.hasNoModifiers()) {\n                        handled = this.resurrectSelectionIfNeeded();\n                        if (!handled && event.getRepeatCount() == 0 && this.getChildCount() > 0) {\n                            this.keyPressed();\n                            handled = true;\n                        }\n                    }\n                    break;\n                case KeyEvent.KEYCODE_SPACE:\n                    //if (this.mPopup == null || !this.mPopup.isShowing()) {\n                        if (event.hasNoModifiers()) {\n                            handled = this.resurrectSelectionIfNeeded() || this.pageScroll(ListView.FOCUS_DOWN);\n                        } else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) {\n                            handled = this.resurrectSelectionIfNeeded() || this.pageScroll(ListView.FOCUS_UP);\n                        }\n                        handled = true;\n                    //}\n                    break;\n                case KeyEvent.KEYCODE_PAGE_UP:\n                    if (event.hasNoModifiers()) {\n                        handled = this.resurrectSelectionIfNeeded() || this.pageScroll(ListView.FOCUS_UP);\n                    } else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {\n                        handled = this.resurrectSelectionIfNeeded() || this.fullScroll(ListView.FOCUS_UP);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_PAGE_DOWN:\n                    if (event.hasNoModifiers()) {\n                        handled = this.resurrectSelectionIfNeeded() || this.pageScroll(ListView.FOCUS_DOWN);\n                    } else if (event.hasModifiers(KeyEvent.META_ALT_ON)) {\n                        handled = this.resurrectSelectionIfNeeded() || this.fullScroll(ListView.FOCUS_DOWN);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_MOVE_HOME:\n                    if (event.hasNoModifiers()) {\n                        handled = this.resurrectSelectionIfNeeded() || this.fullScroll(ListView.FOCUS_UP);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_MOVE_END:\n                    if (event.hasNoModifiers()) {\n                        handled = this.resurrectSelectionIfNeeded() || this.fullScroll(ListView.FOCUS_DOWN);\n                    }\n                    break;\n                case KeyEvent.KEYCODE_TAB:\n                    // XXX Sometimes it is useful to be able to TAB through the items in\n                    //     a ListView sequentially.  Unfortunately this can create an\n                    //     asymmetry in TAB navigation order unless the list selection\n                    //     always reverts to the top or bottom when receiving TAB focus from\n                    //     another widget.  Leaving this behavior disabled for now but\n                    //     perhaps it should be configurable (and more comprehensive).\n                    // if (false) {\n                    //     if (event.hasNoModifiers()) {\n                    //         handled = this.resurrectSelectionIfNeeded() || this.arrowScroll(ListView.FOCUS_DOWN);\n                    //     } else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) {\n                    //         handled = this.resurrectSelectionIfNeeded() || this.arrowScroll(ListView.FOCUS_UP);\n                    //     }\n                    // }\n                    break;\n            }\n        }\n        if (handled) {\n            return true;\n        }\n        //if (this.sendToTextFilter(keyCode, count, event)) {\n        //    return true;\n        //}\n        switch(action) {\n            case KeyEvent.ACTION_DOWN:\n                return super.onKeyDown(keyCode, event);\n            case KeyEvent.ACTION_UP:\n                return super.onKeyUp(keyCode, event);\n            //case KeyEvent.ACTION_MULTIPLE:\n            //    return super.onKeyMultiple(keyCode, count, event);\n            default:\n                // shouldn't happen\n                return false;\n        }\n    }\n\n    /**\n     * Scrolls up or down by the number of items currently present on screen.\n     *\n     * @param direction either {@link View#FOCUS_UP} or {@link View#FOCUS_DOWN}\n     * @return whether selection was moved\n     */\n    pageScroll(direction:number):boolean  {\n        let nextPage:number;\n        let down:boolean;\n        if (direction == ListView.FOCUS_UP) {\n            nextPage = Math.max(0, this.mSelectedPosition - this.getChildCount() - 1);\n            down = false;\n        } else if (direction == ListView.FOCUS_DOWN) {\n            nextPage = Math.min(this.mItemCount - 1, this.mSelectedPosition + this.getChildCount() - 1);\n            down = true;\n        } else {\n            return false;\n        }\n        if (nextPage >= 0) {\n            const position:number = this.lookForSelectablePositionAfter(this.mSelectedPosition, nextPage, down);\n            if (position >= 0) {\n                this.mLayoutMode = ListView.LAYOUT_SPECIFIC;\n                this.mSpecificTop = this.mPaddingTop + this.getVerticalFadingEdgeLength();\n                if (down && (position > (this.mItemCount - this.getChildCount()))) {\n                    this.mLayoutMode = ListView.LAYOUT_FORCE_BOTTOM;\n                }\n                if (!down && (position < this.getChildCount())) {\n                    this.mLayoutMode = ListView.LAYOUT_FORCE_TOP;\n                }\n                this.setSelectionInt(position);\n                this.invokeOnItemScrollListener();\n                if (!this.awakenScrollBars()) {\n                    this.invalidate();\n                }\n                return true;\n            }\n        }\n        return false;\n    }\n\n    /**\n     * Go to the last or first item if possible (not worrying about panning\n     * across or navigating within the internal focus of the currently selected\n     * item.)\n     *\n     * @param direction either {@link View#FOCUS_UP} or {@link View#FOCUS_DOWN}\n     * @return whether selection was moved\n     */\n    fullScroll(direction:number):boolean  {\n        let moved:boolean = false;\n        if (direction == ListView.FOCUS_UP) {\n            if (this.mSelectedPosition != 0) {\n                const position:number = this.lookForSelectablePositionAfter(this.mSelectedPosition, 0, true);\n                if (position >= 0) {\n                    this.mLayoutMode = ListView.LAYOUT_FORCE_TOP;\n                    this.setSelectionInt(position);\n                    this.invokeOnItemScrollListener();\n                }\n                moved = true;\n            }\n        } else if (direction == ListView.FOCUS_DOWN) {\n            const lastItem:number = (this.mItemCount - 1);\n            if (this.mSelectedPosition < lastItem) {\n                const position:number = this.lookForSelectablePositionAfter(this.mSelectedPosition, lastItem, false);\n                if (position >= 0) {\n                    this.mLayoutMode = ListView.LAYOUT_FORCE_BOTTOM;\n                    this.setSelectionInt(position);\n                    this.invokeOnItemScrollListener();\n                }\n                moved = true;\n            }\n        }\n        if (moved && !this.awakenScrollBars()) {\n            this.awakenScrollBars();\n            this.invalidate();\n        }\n        return moved;\n    }\n\n    /**\n     * To avoid horizontal focus searches changing the selected item, we\n     * manually focus search within the selected item (as applicable), and\n     * prevent focus from jumping to something within another item.\n     * @param direction one of {View.FOCUS_LEFT, View.FOCUS_RIGHT}\n     * @return Whether this consumes the key event.\n     */\n    private handleHorizontalFocusWithinListItem(direction:number):boolean  {\n        if (direction != View.FOCUS_LEFT && direction != View.FOCUS_RIGHT) {\n            throw Error(`new IllegalArgumentException(\"direction must be one of\" + \" {View.FOCUS_LEFT, View.FOCUS_RIGHT}\")`);\n        }\n        const numChildren:number = this.getChildCount();\n        if (this.mItemsCanFocus && numChildren > 0 && this.mSelectedPosition != ListView.INVALID_POSITION) {\n            const selectedView:View = this.getSelectedView();\n            if (selectedView != null && selectedView.hasFocus() && selectedView instanceof ViewGroup) {\n                const currentFocus:View = selectedView.findFocus();\n                const nextFocus:View = FocusFinder.getInstance().findNextFocus(<ViewGroup> selectedView, currentFocus, direction);\n                if (nextFocus != null) {\n                    // do the math to get interesting rect in next focus' coordinates\n                    currentFocus.getFocusedRect(this.mTempRect);\n                    this.offsetDescendantRectToMyCoords(currentFocus, this.mTempRect);\n                    this.offsetRectIntoDescendantCoords(nextFocus, this.mTempRect);\n                    if (nextFocus.requestFocus(direction, this.mTempRect)) {\n                        return true;\n                    }\n                }\n                // we are blocking the key from being handled (by returning true)\n                // if the global result is going to be some other view within this\n                // list.  this is to acheive the overall goal of having\n                // horizontal d-pad navigation remain in the current item.\n                const globalNextFocus:View = FocusFinder.getInstance().findNextFocus(<ViewGroup> this.getRootView(), currentFocus, direction);\n                if (globalNextFocus != null) {\n                    return this.isViewAncestorOf(globalNextFocus, this);\n                }\n            }\n        }\n        return false;\n    }\n\n    /**\n     * Scrolls to the next or previous item if possible.\n     *\n     * @param direction either {@link View#FOCUS_UP} or {@link View#FOCUS_DOWN}\n     *\n     * @return whether selection was moved\n     */\n    arrowScroll(direction:number):boolean  {\n        try {\n            this.mInLayout = true;\n            const handled:boolean = this.arrowScrollImpl(direction);\n            if (handled) {\n                this.playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));\n            }\n            return handled;\n        } finally {\n            this.mInLayout = false;\n        }\n    }\n\n    /**\n     * Used by {@link #arrowScrollImpl(int)} to help determine the next selected position\n     * to move to. This return a position in the direction given if the selected item\n     * is fully visible.\n     *\n     * @param selectedView Current selected view to move from\n     * @param selectedPos Current selected position to move from\n     * @param direction Direction to move in\n     * @return Desired selected position after moving in the given direction\n     */\n    private nextSelectedPositionForDirection(selectedView:View, selectedPos:number, direction:number):number  {\n        let nextSelected:number;\n        if (direction == View.FOCUS_DOWN) {\n            const listBottom:number = this.getHeight() - this.mListPadding.bottom;\n            if (selectedView != null && selectedView.getBottom() <= listBottom) {\n                nextSelected = selectedPos != ListView.INVALID_POSITION && selectedPos >= this.mFirstPosition ? selectedPos + 1 : this.mFirstPosition;\n            } else {\n                return ListView.INVALID_POSITION;\n            }\n        } else {\n            const listTop:number = this.mListPadding.top;\n            if (selectedView != null && selectedView.getTop() >= listTop) {\n                const lastPos:number = this.mFirstPosition + this.getChildCount() - 1;\n                nextSelected = selectedPos != ListView.INVALID_POSITION && selectedPos <= lastPos ? selectedPos - 1 : lastPos;\n            } else {\n                return ListView.INVALID_POSITION;\n            }\n        }\n        if (nextSelected < 0 || nextSelected >= this.mAdapter.getCount()) {\n            return ListView.INVALID_POSITION;\n        }\n        return this.lookForSelectablePosition(nextSelected, direction == View.FOCUS_DOWN);\n    }\n\n    /**\n     * Handle an arrow scroll going up or down.  Take into account whether items are selectable,\n     * whether there are focusable items etc.\n     *\n     * @param direction Either {@link android.view.View#FOCUS_UP} or {@link android.view.View#FOCUS_DOWN}.\n     * @return Whether any scrolling, selection or focus change occured.\n     */\n    private arrowScrollImpl(direction:number):boolean  {\n        if (this.getChildCount() <= 0) {\n            return false;\n        }\n        let selectedView:View = this.getSelectedView();\n        let selectedPos:number = this.mSelectedPosition;\n        let nextSelectedPosition:number = this.nextSelectedPositionForDirection(selectedView, selectedPos, direction);\n        let amountToScroll:number = this.amountToScroll(direction, nextSelectedPosition);\n        // if we are moving focus, we may OVERRIDE the default behavior\n        const focusResult:ListView.ArrowScrollFocusResult = this.mItemsCanFocus ? this.arrowScrollFocused(direction) : null;\n        if (focusResult != null) {\n            nextSelectedPosition = focusResult.getSelectedPosition();\n            amountToScroll = focusResult.getAmountToScroll();\n        }\n        let needToRedraw:boolean = focusResult != null;\n        if (nextSelectedPosition != ListView.INVALID_POSITION) {\n            this.handleNewSelectionChange(selectedView, direction, nextSelectedPosition, focusResult != null);\n            this.setSelectedPositionInt(nextSelectedPosition);\n            this.setNextSelectedPositionInt(nextSelectedPosition);\n            selectedView = this.getSelectedView();\n            selectedPos = nextSelectedPosition;\n            if (this.mItemsCanFocus && focusResult == null) {\n                // there was no new view found to take focus, make sure we\n                // don't leave focus with the old selection\n                const focused:View = this.getFocusedChild();\n                if (focused != null) {\n                    focused.clearFocus();\n                }\n            }\n            needToRedraw = true;\n            this.checkSelectionChanged();\n        }\n        if (amountToScroll > 0) {\n            this.scrollListItemsBy((direction == View.FOCUS_UP) ? amountToScroll : -amountToScroll);\n            needToRedraw = true;\n        }\n        // item that was panned off screen gives up focus.\n        if (this.mItemsCanFocus && (focusResult == null) && selectedView != null && selectedView.hasFocus()) {\n            const focused:View = selectedView.findFocus();\n            if (!this.isViewAncestorOf(focused, this) || this.distanceToView(focused) > 0) {\n                focused.clearFocus();\n            }\n        }\n        // if  the current selection is panned off, we need to remove the selection\n        if (nextSelectedPosition == ListView.INVALID_POSITION && selectedView != null && !this.isViewAncestorOf(selectedView, this)) {\n            selectedView = null;\n            this.hideSelector();\n            // but we don't want to set the ressurect position (that would make subsequent\n            // unhandled key events bring back the item we just scrolled off!)\n            this.mResurrectToPosition = ListView.INVALID_POSITION;\n        }\n        if (needToRedraw) {\n            if (selectedView != null) {\n                this.positionSelector(selectedPos, selectedView);\n                this.mSelectedTop = selectedView.getTop();\n            }\n            if (!this.awakenScrollBars()) {\n                this.invalidate();\n            }\n            this.invokeOnItemScrollListener();\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * When selection changes, it is possible that the previously selected or the\n     * next selected item will change its size.  If so, we need to offset some folks,\n     * and re-layout the items as appropriate.\n     *\n     * @param selectedView The currently selected view (before changing selection).\n     *   should be <code>null</code> if there was no previous selection.\n     * @param direction Either {@link android.view.View#FOCUS_UP} or\n     *        {@link android.view.View#FOCUS_DOWN}.\n     * @param newSelectedPosition The position of the next selection.\n     * @param newFocusAssigned whether new focus was assigned.  This matters because\n     *        when something has focus, we don't want to show selection (ugh).\n     */\n    private handleNewSelectionChange(selectedView:View, direction:number, newSelectedPosition:number, newFocusAssigned:boolean):void  {\n        if (newSelectedPosition == ListView.INVALID_POSITION) {\n            throw Error(`new IllegalArgumentException(\"newSelectedPosition needs to be valid\")`);\n        }\n        // whether or not we are moving down or up, we want to preserve the\n        // top of whatever view is on top:\n        // - moving down: the view that had selection\n        // - moving up: the view that is getting selection\n        let topView:View;\n        let bottomView:View;\n        let topViewIndex:number, bottomViewIndex:number;\n        let topSelected:boolean = false;\n        const selectedIndex:number = this.mSelectedPosition - this.mFirstPosition;\n        const nextSelectedIndex:number = newSelectedPosition - this.mFirstPosition;\n        if (direction == View.FOCUS_UP) {\n            topViewIndex = nextSelectedIndex;\n            bottomViewIndex = selectedIndex;\n            topView = this.getChildAt(topViewIndex);\n            bottomView = selectedView;\n            topSelected = true;\n        } else {\n            topViewIndex = selectedIndex;\n            bottomViewIndex = nextSelectedIndex;\n            topView = selectedView;\n            bottomView = this.getChildAt(bottomViewIndex);\n        }\n        const numChildren:number = this.getChildCount();\n        // start with top view: is it changing size?\n        if (topView != null) {\n            topView.setSelected(!newFocusAssigned && topSelected);\n            this.measureAndAdjustDown(topView, topViewIndex, numChildren);\n        }\n        // is the bottom view changing size?\n        if (bottomView != null) {\n            bottomView.setSelected(!newFocusAssigned && !topSelected);\n            this.measureAndAdjustDown(bottomView, bottomViewIndex, numChildren);\n        }\n    }\n\n    /**\n     * Re-measure a child, and if its height changes, lay it out preserving its\n     * top, and adjust the children below it appropriately.\n     * @param child The child\n     * @param childIndex The view group index of the child.\n     * @param numChildren The number of children in the view group.\n     */\n    private measureAndAdjustDown(child:View, childIndex:number, numChildren:number):void  {\n        let oldHeight:number = child.getHeight();\n        this.measureItem(child);\n        if (child.getMeasuredHeight() != oldHeight) {\n            // lay out the view, preserving its top\n            this.relayoutMeasuredItem(child);\n            // adjust views below appropriately\n            const heightDelta:number = child.getMeasuredHeight() - oldHeight;\n            for (let i:number = childIndex + 1; i < numChildren; i++) {\n                this.getChildAt(i).offsetTopAndBottom(heightDelta);\n            }\n        }\n    }\n\n    /**\n     * Measure a particular list child.\n     * TODO: unify with setUpChild.\n     * @param child The child.\n     */\n    private measureItem(child:View):void  {\n        let p:ViewGroup.LayoutParams = child.getLayoutParams();\n        if (p == null) {\n            p = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);\n        }\n        let childWidthSpec:number = ViewGroup.getChildMeasureSpec(this.mWidthMeasureSpec, this.mListPadding.left + this.mListPadding.right, p.width);\n        let lpHeight:number = p.height;\n        let childHeightSpec:number;\n        if (lpHeight > 0) {\n            childHeightSpec = View.MeasureSpec.makeMeasureSpec(lpHeight, View.MeasureSpec.EXACTLY);\n        } else {\n            childHeightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n        }\n        child.measure(childWidthSpec, childHeightSpec);\n    }\n\n    /**\n     * Layout a child that has been measured, preserving its top position.\n     * TODO: unify with setUpChild.\n     * @param child The child.\n     */\n    private relayoutMeasuredItem(child:View):void  {\n        const w:number = child.getMeasuredWidth();\n        const h:number = child.getMeasuredHeight();\n        const childLeft:number = this.mListPadding.left;\n        const childRight:number = childLeft + w;\n        const childTop:number = child.getTop();\n        const childBottom:number = childTop + h;\n        child.layout(childLeft, childTop, childRight, childBottom);\n    }\n\n    /**\n     * @return The amount to preview next items when arrow srolling.\n     */\n    private getArrowScrollPreviewLength():number  {\n        return Math.max(ListView.MIN_SCROLL_PREVIEW_PIXELS, this.getVerticalFadingEdgeLength());\n    }\n\n    /**\n     * Determine how much we need to scroll in order to get the next selected view\n     * visible, with a fading edge showing below as applicable.  The amount is\n     * capped at {@link #getMaxScrollAmount()} .\n     *\n     * @param direction either {@link android.view.View#FOCUS_UP} or\n     *        {@link android.view.View#FOCUS_DOWN}.\n     * @param nextSelectedPosition The position of the next selection, or\n     *        {@link #INVALID_POSITION} if there is no next selectable position\n     * @return The amount to scroll. Note: this is always positive!  Direction\n     *         needs to be taken into account when actually scrolling.\n     */\n    private amountToScroll(direction:number, nextSelectedPosition:number):number  {\n        const listBottom:number = this.getHeight() - this.mListPadding.bottom;\n        const listTop:number = this.mListPadding.top;\n        let numChildren:number = this.getChildCount();\n        if (direction == View.FOCUS_DOWN) {\n            let indexToMakeVisible:number = numChildren - 1;\n            if (nextSelectedPosition != ListView.INVALID_POSITION) {\n                indexToMakeVisible = nextSelectedPosition - this.mFirstPosition;\n            }\n            while (numChildren <= indexToMakeVisible) {\n                // Child to view is not attached yet.\n                this.addViewBelow(this.getChildAt(numChildren - 1), this.mFirstPosition + numChildren - 1);\n                numChildren++;\n            }\n            const positionToMakeVisible:number = this.mFirstPosition + indexToMakeVisible;\n            const viewToMakeVisible:View = this.getChildAt(indexToMakeVisible);\n            let goalBottom:number = listBottom;\n            if (positionToMakeVisible < this.mItemCount - 1) {\n                goalBottom -= this.getArrowScrollPreviewLength();\n            }\n            if (viewToMakeVisible.getBottom() <= goalBottom) {\n                // item is fully visible.\n                return 0;\n            }\n            if (nextSelectedPosition != ListView.INVALID_POSITION && (goalBottom - viewToMakeVisible.getTop()) >= this.getMaxScrollAmount()) {\n                // item already has enough of it visible, changing selection is good enough\n                return 0;\n            }\n            let amountToScroll:number = (viewToMakeVisible.getBottom() - goalBottom);\n            if ((this.mFirstPosition + numChildren) == this.mItemCount) {\n                // last is last in list -> make sure we don't scroll past it\n                const max:number = this.getChildAt(numChildren - 1).getBottom() - listBottom;\n                amountToScroll = Math.min(amountToScroll, max);\n            }\n            return Math.min(amountToScroll, this.getMaxScrollAmount());\n        } else {\n            let indexToMakeVisible:number = 0;\n            if (nextSelectedPosition != ListView.INVALID_POSITION) {\n                indexToMakeVisible = nextSelectedPosition - this.mFirstPosition;\n            }\n            while (indexToMakeVisible < 0) {\n                // Child to view is not attached yet.\n                this.addViewAbove(this.getChildAt(0), this.mFirstPosition);\n                this.mFirstPosition--;\n                indexToMakeVisible = nextSelectedPosition - this.mFirstPosition;\n            }\n            const positionToMakeVisible:number = this.mFirstPosition + indexToMakeVisible;\n            const viewToMakeVisible:View = this.getChildAt(indexToMakeVisible);\n            let goalTop:number = listTop;\n            if (positionToMakeVisible > 0) {\n                goalTop += this.getArrowScrollPreviewLength();\n            }\n            if (viewToMakeVisible.getTop() >= goalTop) {\n                // item is fully visible.\n                return 0;\n            }\n            if (nextSelectedPosition != ListView.INVALID_POSITION && (viewToMakeVisible.getBottom() - goalTop) >= this.getMaxScrollAmount()) {\n                // item already has enough of it visible, changing selection is good enough\n                return 0;\n            }\n            let amountToScroll:number = (goalTop - viewToMakeVisible.getTop());\n            if (this.mFirstPosition == 0) {\n                // first is first in list -> make sure we don't scroll past it\n                const max:number = listTop - this.getChildAt(0).getTop();\n                amountToScroll = Math.min(amountToScroll, max);\n            }\n            return Math.min(amountToScroll, this.getMaxScrollAmount());\n        }\n    }\n\n\n\n    /**\n     * @param direction either {@link android.view.View#FOCUS_UP} or\n     *        {@link android.view.View#FOCUS_DOWN}.\n     * @return The position of the next selectable position of the views that\n     *         are currently visible, taking into account the fact that there might\n     *         be no selection.  Returns {@link #INVALID_POSITION} if there is no\n     *         selectable view on screen in the given direction.\n     */\n    private lookForSelectablePositionOnScreen(direction:number):number  {\n        const firstPosition:number = this.mFirstPosition;\n        if (direction == View.FOCUS_DOWN) {\n            let startPos:number = (this.mSelectedPosition != ListView.INVALID_POSITION) ? this.mSelectedPosition + 1 : firstPosition;\n            if (startPos >= this.mAdapter.getCount()) {\n                return ListView.INVALID_POSITION;\n            }\n            if (startPos < firstPosition) {\n                startPos = firstPosition;\n            }\n            const lastVisiblePos:number = this.getLastVisiblePosition();\n            const adapter:ListAdapter = this.getAdapter();\n            for (let pos:number = startPos; pos <= lastVisiblePos; pos++) {\n                if (adapter.isEnabled(pos) && this.getChildAt(pos - firstPosition).getVisibility() == View.VISIBLE) {\n                    return pos;\n                }\n            }\n        } else {\n            let last:number = firstPosition + this.getChildCount() - 1;\n            let startPos:number = (this.mSelectedPosition != ListView.INVALID_POSITION) ? this.mSelectedPosition - 1 : firstPosition + this.getChildCount() - 1;\n            if (startPos < 0 || startPos >= this.mAdapter.getCount()) {\n                return ListView.INVALID_POSITION;\n            }\n            if (startPos > last) {\n                startPos = last;\n            }\n            const adapter:ListAdapter = this.getAdapter();\n            for (let pos:number = startPos; pos >= firstPosition; pos--) {\n                if (adapter.isEnabled(pos) && this.getChildAt(pos - firstPosition).getVisibility() == View.VISIBLE) {\n                    return pos;\n                }\n            }\n        }\n        return ListView.INVALID_POSITION;\n    }\n\n    /**\n     * Do an arrow scroll based on focus searching.  If a new view is\n     * given focus, return the selection delta and amount to scroll via\n     * an {@link ArrowScrollFocusResult}, otherwise, return null.\n     *\n     * @param direction either {@link android.view.View#FOCUS_UP} or\n     *        {@link android.view.View#FOCUS_DOWN}.\n     * @return The result if focus has changed, or <code>null</code>.\n     */\n    private arrowScrollFocused(direction:number):ListView.ArrowScrollFocusResult  {\n        const selectedView:View = this.getSelectedView();\n        let newFocus:View;\n        if (selectedView != null && selectedView.hasFocus()) {\n            let oldFocus:View = selectedView.findFocus();\n            newFocus = FocusFinder.getInstance().findNextFocus(this, oldFocus, direction);\n        } else {\n            if (direction == View.FOCUS_DOWN) {\n                const topFadingEdgeShowing:boolean = (this.mFirstPosition > 0);\n                const listTop:number = this.mListPadding.top + (topFadingEdgeShowing ? this.getArrowScrollPreviewLength() : 0);\n                const ySearchPoint:number = (selectedView != null && selectedView.getTop() > listTop) ? selectedView.getTop() : listTop;\n                this.mTempRect.set(0, ySearchPoint, 0, ySearchPoint);\n            } else {\n                const bottomFadingEdgeShowing:boolean = (this.mFirstPosition + this.getChildCount() - 1) < this.mItemCount;\n                const listBottom:number = this.getHeight() - this.mListPadding.bottom - (bottomFadingEdgeShowing ? this.getArrowScrollPreviewLength() : 0);\n                const ySearchPoint:number = (selectedView != null && selectedView.getBottom() < listBottom) ? selectedView.getBottom() : listBottom;\n                this.mTempRect.set(0, ySearchPoint, 0, ySearchPoint);\n            }\n            newFocus = FocusFinder.getInstance().findNextFocusFromRect(this, this.mTempRect, direction);\n        }\n        if (newFocus != null) {\n            const positionOfNewFocus:number = this.positionOfNewFocus(newFocus);\n            // we aren't jumping over another selectable position\n            if (this.mSelectedPosition != ListView.INVALID_POSITION && positionOfNewFocus != this.mSelectedPosition) {\n                const selectablePosition:number = this.lookForSelectablePositionOnScreen(direction);\n                if (selectablePosition != ListView.INVALID_POSITION && ((direction == View.FOCUS_DOWN && selectablePosition < positionOfNewFocus) || (direction == View.FOCUS_UP && selectablePosition > positionOfNewFocus))) {\n                    return null;\n                }\n            }\n            let focusScroll:number = this.amountToScrollToNewFocus(direction, newFocus, positionOfNewFocus);\n            const maxScrollAmount:number = this.getMaxScrollAmount();\n            if (focusScroll < maxScrollAmount) {\n                // not moving too far, safe to give next view focus\n                newFocus.requestFocus(direction);\n                this.mArrowScrollFocusResult.populate(positionOfNewFocus, focusScroll);\n                return this.mArrowScrollFocusResult;\n            } else if (this.distanceToView(newFocus) < maxScrollAmount) {\n                // Case to consider:\n                // too far to get entire next focusable on screen, but by going\n                // max scroll amount, we are getting it at least partially in view,\n                // so give it focus and scroll the max ammount.\n                newFocus.requestFocus(direction);\n                this.mArrowScrollFocusResult.populate(positionOfNewFocus, maxScrollAmount);\n                return this.mArrowScrollFocusResult;\n            }\n        }\n        return null;\n    }\n\n    /**\n     * @param newFocus The view that would have focus.\n     * @return the position that contains newFocus\n     */\n    private positionOfNewFocus(newFocus:View):number  {\n        const numChildren:number = this.getChildCount();\n        for (let i:number = 0; i < numChildren; i++) {\n            const child:View = this.getChildAt(i);\n            if (this.isViewAncestorOf(newFocus, child)) {\n                return this.mFirstPosition + i;\n            }\n        }\n        throw Error(`new IllegalArgumentException(\"newFocus is not a child of any of the\" + \" children of the list!\")`);\n    }\n\n    /**\n     * Return true if child is an ancestor of parent, (or equal to the parent).\n     */\n    private isViewAncestorOf(child:View, parent:View):boolean  {\n        if (child == parent) {\n            return true;\n        }\n        const theParent:ViewParent = child.getParent();\n        return (theParent instanceof ViewGroup) && this.isViewAncestorOf(<View> theParent, parent);\n    }\n\n    /**\n     * Determine how much we need to scroll in order to get newFocus in view.\n     * @param direction either {@link android.view.View#FOCUS_UP} or\n     *        {@link android.view.View#FOCUS_DOWN}.\n     * @param newFocus The view that would take focus.\n     * @param positionOfNewFocus The position of the list item containing newFocus\n     * @return The amount to scroll.  Note: this is always positive!  Direction\n     *   needs to be taken into account when actually scrolling.\n     */\n    private amountToScrollToNewFocus(direction:number, newFocus:View, positionOfNewFocus:number):number  {\n        let amountToScroll:number = 0;\n        newFocus.getDrawingRect(this.mTempRect);\n        this.offsetDescendantRectToMyCoords(newFocus, this.mTempRect);\n        if (direction == View.FOCUS_UP) {\n            if (this.mTempRect.top < this.mListPadding.top) {\n                amountToScroll = this.mListPadding.top - this.mTempRect.top;\n                if (positionOfNewFocus > 0) {\n                    amountToScroll += this.getArrowScrollPreviewLength();\n                }\n            }\n        } else {\n            const listBottom:number = this.getHeight() - this.mListPadding.bottom;\n            if (this.mTempRect.bottom > listBottom) {\n                amountToScroll = this.mTempRect.bottom - listBottom;\n                if (positionOfNewFocus < this.mItemCount - 1) {\n                    amountToScroll += this.getArrowScrollPreviewLength();\n                }\n            }\n        }\n        return amountToScroll;\n    }\n\n    /**\n     * Determine the distance to the nearest edge of a view in a particular\n     * direction.\n     * \n     * @param descendant A descendant of this list.\n     * @return The distance, or 0 if the nearest edge is already on screen.\n     */\n    private distanceToView(descendant:View):number  {\n        let distance:number = 0;\n        descendant.getDrawingRect(this.mTempRect);\n        this.offsetDescendantRectToMyCoords(descendant, this.mTempRect);\n        const listBottom:number = this.mBottom - this.mTop - this.mListPadding.bottom;\n        if (this.mTempRect.bottom < this.mListPadding.top) {\n            distance = this.mListPadding.top - this.mTempRect.bottom;\n        } else if (this.mTempRect.top > listBottom) {\n            distance = this.mTempRect.top - listBottom;\n        }\n        return distance;\n    }\n\n    /**\n     * Scroll the children by amount, adding a view at the end and removing\n     * views that fall off as necessary.\n     *\n     * @param amount The amount (positive or negative) to scroll.\n     */\n    private scrollListItemsBy(amount:number):void  {\n        this.offsetChildrenTopAndBottom(amount);\n        const listBottom:number = this.getHeight() - this.mListPadding.bottom;\n        const listTop:number = this.mListPadding.top;\n        const recycleBin:AbsListView.RecycleBin = this.mRecycler;\n        if (amount < 0) {\n            // shifted items up\n            // may need to pan views into the bottom space\n            let numChildren:number = this.getChildCount();\n            let last:View = this.getChildAt(numChildren - 1);\n            while (last.getBottom() < listBottom) {\n                const lastVisiblePosition:number = this.mFirstPosition + numChildren - 1;\n                if (lastVisiblePosition < this.mItemCount - 1) {\n                    last = this.addViewBelow(last, lastVisiblePosition);\n                    numChildren++;\n                } else {\n                    break;\n                }\n            }\n            // to shift back\n            if (last.getBottom() < listBottom) {\n                this.offsetChildrenTopAndBottom(listBottom - last.getBottom());\n            }\n            // top views may be panned off screen\n            let first:View = this.getChildAt(0);\n            while (first.getBottom() < listTop) {\n                let layoutParams:AbsListView.LayoutParams = <AbsListView.LayoutParams> first.getLayoutParams();\n                if (recycleBin.shouldRecycleViewType(layoutParams.viewType)) {\n                    recycleBin.addScrapView(first, this.mFirstPosition);\n                }\n                this.detachViewFromParent(first);\n                first = this.getChildAt(0);\n                this.mFirstPosition++;\n            }\n        } else {\n            // shifted items down\n            let first:View = this.getChildAt(0);\n            // may need to pan views into top\n            while ((first.getTop() > listTop) && (this.mFirstPosition > 0)) {\n                first = this.addViewAbove(first, this.mFirstPosition);\n                this.mFirstPosition--;\n            }\n            // need to shift it back\n            if (first.getTop() > listTop) {\n                this.offsetChildrenTopAndBottom(listTop - first.getTop());\n            }\n            let lastIndex:number = this.getChildCount() - 1;\n            let last:View = this.getChildAt(lastIndex);\n            // bottom view may be panned off screen\n            while (last.getTop() > listBottom) {\n                let layoutParams:AbsListView.LayoutParams = <AbsListView.LayoutParams> last.getLayoutParams();\n                if (recycleBin.shouldRecycleViewType(layoutParams.viewType)) {\n                    recycleBin.addScrapView(last, this.mFirstPosition + lastIndex);\n                }\n                this.detachViewFromParent(last);\n                last = this.getChildAt(--lastIndex);\n            }\n        }\n    }\n\n    private addViewAbove(theView:View, position:number):View  {\n        let abovePosition:number = position - 1;\n        let view:View = this.obtainView(abovePosition, this.mIsScrap);\n        let edgeOfNewChild:number = theView.getTop() - this.mDividerHeight;\n        this.setupChild(view, abovePosition, edgeOfNewChild, false, this.mListPadding.left, false, this.mIsScrap[0]);\n        return view;\n    }\n\n    private addViewBelow(theView:View, position:number):View  {\n        let belowPosition:number = position + 1;\n        let view:View = this.obtainView(belowPosition, this.mIsScrap);\n        let edgeOfNewChild:number = theView.getBottom() + this.mDividerHeight;\n        this.setupChild(view, belowPosition, edgeOfNewChild, true, this.mListPadding.left, false, this.mIsScrap[0]);\n        return view;\n    }\n\n    /**\n     * Indicates that the views created by the ListAdapter can contain focusable\n     * items.\n     *\n     * @param itemsCanFocus true if items can get focus, false otherwise\n     */\n    setItemsCanFocus(itemsCanFocus:boolean):void  {\n        this.mItemsCanFocus = itemsCanFocus;\n        if (!itemsCanFocus) {\n            this.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);\n        }\n    }\n\n    /**\n     * @return Whether the views created by the ListAdapter can contain focusable\n     * items.\n     */\n    getItemsCanFocus():boolean  {\n        return this.mItemsCanFocus;\n    }\n\n    isOpaque():boolean  {\n        let retValue:boolean = (this.mCachingActive && this.mIsCacheColorOpaque && this.mDividerIsOpaque && this.hasOpaqueScrollbars()) || super.isOpaque();\n        if (retValue) {\n            // only return true if the list items cover the entire area of the view\n            const listTop:number = this.mListPadding != null ? this.mListPadding.top : this.mPaddingTop;\n            let first:View = this.getChildAt(0);\n            if (first == null || first.getTop() > listTop) {\n                return false;\n            }\n            const listBottom:number = this.getHeight() - (this.mListPadding != null ? this.mListPadding.bottom : this.mPaddingBottom);\n            let last:View = this.getChildAt(this.getChildCount() - 1);\n            if (last == null || last.getBottom() < listBottom) {\n                return false;\n            }\n        }\n        return retValue;\n    }\n\n    setCacheColorHint(color:number):void  {\n        const opaque:boolean = (color >>> 24) == 0xFF;\n        this.mIsCacheColorOpaque = opaque;\n        if (opaque) {\n            if (this.mDividerPaint == null) {\n                this.mDividerPaint = new Paint();\n            }\n            this.mDividerPaint.setColor(color);\n        }\n        super.setCacheColorHint(color);\n    }\n\n    drawOverscrollHeader(canvas:Canvas, drawable:Drawable, bounds:Rect):void  {\n        const height:number = drawable.getMinimumHeight();\n        canvas.save();\n        canvas.clipRect(bounds);\n        const span:number = bounds.bottom - bounds.top;\n        if (span < height) {\n            bounds.top = bounds.bottom - height;\n        }\n        drawable.setBounds(bounds);\n        drawable.draw(canvas);\n        canvas.restore();\n    }\n\n    drawOverscrollFooter(canvas:Canvas, drawable:Drawable, bounds:Rect):void  {\n        const height:number = drawable.getMinimumHeight();\n        canvas.save();\n        canvas.clipRect(bounds);\n        const span:number = bounds.bottom - bounds.top;\n        if (span < height) {\n            bounds.bottom = bounds.top + height;\n        }\n        drawable.setBounds(bounds);\n        drawable.draw(canvas);\n        canvas.restore();\n    }\n\n    protected dispatchDraw(canvas:Canvas):void  {\n        if (this.mCachingStarted) {\n            this.mCachingActive = true;\n        }\n        // Draw the dividers\n        const dividerHeight:number = this.mDividerHeight;\n        const overscrollHeader:Drawable = this.mOverScrollHeader;\n        const overscrollFooter:Drawable = this.mOverScrollFooter;\n        const drawOverscrollHeader:boolean = overscrollHeader != null;\n        const drawOverscrollFooter:boolean = overscrollFooter != null;\n        const drawDividers:boolean = dividerHeight > 0 && this.mDivider != null;\n        if (drawDividers || drawOverscrollHeader || drawOverscrollFooter) {\n            // Only modify the top and bottom in the loop, we set the left and right here\n            const bounds:Rect = this.mTempRect;\n            bounds.left = this.mPaddingLeft;\n            bounds.right = this.mRight - this.mLeft - this.mPaddingRight;\n            const count:number = this.getChildCount();\n            const headerCount:number = this.mHeaderViewInfos.size();\n            const itemCount:number = this.mItemCount;\n            const footerLimit:number = (itemCount - this.mFooterViewInfos.size());\n            const headerDividers:boolean = this.mHeaderDividersEnabled;\n            const footerDividers:boolean = this.mFooterDividersEnabled;\n            const first:number = this.mFirstPosition;\n            const areAllItemsSelectable:boolean = this.mAreAllItemsSelectable;\n            const adapter:ListAdapter = this.mAdapter;\n            // If the list is opaque *and* the background is not, we want to\n            // fill a rect where the dividers would be for non-selectable items\n            // If the list is opaque and the background is also opaque, we don't\n            // need to draw anything since the background will do it for us\n            const fillForMissingDividers:boolean = this.isOpaque() && !super.isOpaque();\n            if (fillForMissingDividers && this.mDividerPaint == null && this.mIsCacheColorOpaque) {\n                this.mDividerPaint = new Paint();\n                this.mDividerPaint.setColor(this.getCacheColorHint());\n            }\n            const paint:Paint = this.mDividerPaint;\n            let effectivePaddingTop:number = 0;\n            let effectivePaddingBottom:number = 0;\n            if ((this.mGroupFlags & ListView.CLIP_TO_PADDING_MASK) == ListView.CLIP_TO_PADDING_MASK) {\n                effectivePaddingTop = this.mListPadding.top;\n                effectivePaddingBottom = this.mListPadding.bottom;\n            }\n            const listBottom:number = this.mBottom - this.mTop - effectivePaddingBottom + this.mScrollY;\n            if (!this.mStackFromBottom) {\n                let bottom:number = 0;\n                // Draw top divider or header for overscroll\n                const scrollY:number = this.mScrollY;\n                if (count > 0 && scrollY < 0) {\n                    if (drawOverscrollHeader) {\n                        bounds.bottom = 0;\n                        bounds.top = scrollY;\n                        this.drawOverscrollHeader(canvas, overscrollHeader, bounds);\n                    } else if (drawDividers) {\n                        bounds.bottom = 0;\n                        bounds.top = -dividerHeight;\n                        this.drawDivider(canvas, bounds, -1);\n                    }\n                }\n                for (let i:number = 0; i < count; i++) {\n                    const itemIndex:number = (first + i);\n                    const isHeader:boolean = (itemIndex < headerCount);\n                    const isFooter:boolean = (itemIndex >= footerLimit);\n                    if ((headerDividers || !isHeader) && (footerDividers || !isFooter)) {\n                        const child:View = this.getChildAt(i);\n                        bottom = child.getBottom();\n                        const isLastItem:boolean = (i == (count - 1));\n                        if (drawDividers && (bottom < listBottom) && !(drawOverscrollFooter && isLastItem)) {\n                            const nextIndex:number = (itemIndex + 1);\n                            // footers when enabled, and the end of the list.\n                            if (areAllItemsSelectable || ((adapter.isEnabled(itemIndex) || (headerDividers && isHeader) || (footerDividers && isFooter)) && (isLastItem || adapter.isEnabled(nextIndex) || (headerDividers && (nextIndex < headerCount)) || (footerDividers && (nextIndex >= footerLimit))))) {\n                                bounds.top = bottom;\n                                bounds.bottom = bottom + dividerHeight;\n                                this.drawDivider(canvas, bounds, i);\n                            } else if (fillForMissingDividers) {\n                                bounds.top = bottom;\n                                bounds.bottom = bottom + dividerHeight;\n                                canvas.drawRect(bounds, paint);\n                            }\n                        }\n                    }\n                }\n                const overFooterBottom:number = this.mBottom + this.mScrollY;\n                if (drawOverscrollFooter && first + count == itemCount && overFooterBottom > bottom) {\n                    bounds.top = bottom;\n                    bounds.bottom = overFooterBottom;\n                    this.drawOverscrollFooter(canvas, overscrollFooter, bounds);\n                }\n            } else {\n                let top:number;\n                const scrollY:number = this.mScrollY;\n                if (count > 0 && drawOverscrollHeader) {\n                    bounds.top = scrollY;\n                    bounds.bottom = this.getChildAt(0).getTop();\n                    this.drawOverscrollHeader(canvas, overscrollHeader, bounds);\n                }\n                const start:number = drawOverscrollHeader ? 1 : 0;\n                for (let i:number = start; i < count; i++) {\n                    const itemIndex:number = (first + i);\n                    const isHeader:boolean = (itemIndex < headerCount);\n                    const isFooter:boolean = (itemIndex >= footerLimit);\n                    if ((headerDividers || !isHeader) && (footerDividers || !isFooter)) {\n                        const child:View = this.getChildAt(i);\n                        top = child.getTop();\n                        if (drawDividers && (top > effectivePaddingTop)) {\n                            const isFirstItem:boolean = (i == start);\n                            const previousIndex:number = (itemIndex - 1);\n                            // footers when enabled, and the end of the list.\n                            if (areAllItemsSelectable || ((adapter.isEnabled(itemIndex) || (headerDividers && isHeader) || (footerDividers && isFooter)) && (isFirstItem || adapter.isEnabled(previousIndex) || (headerDividers && (previousIndex < headerCount)) || (footerDividers && (previousIndex >= footerLimit))))) {\n                                bounds.top = top - dividerHeight;\n                                bounds.bottom = top;\n                                // Give the method the child ABOVE the divider,\n                                // so we subtract one from our child position.\n                                // Give -1 when there is no child above the\n                                // divider.\n                                this.drawDivider(canvas, bounds, i - 1);\n                            } else if (fillForMissingDividers) {\n                                bounds.top = top - dividerHeight;\n                                bounds.bottom = top;\n                                canvas.drawRect(bounds, paint);\n                            }\n                        }\n                    }\n                }\n                if (count > 0 && scrollY > 0) {\n                    if (drawOverscrollFooter) {\n                        const absListBottom:number = this.mBottom;\n                        bounds.top = absListBottom;\n                        bounds.bottom = absListBottom + scrollY;\n                        this.drawOverscrollFooter(canvas, overscrollFooter, bounds);\n                    } else if (drawDividers) {\n                        bounds.top = listBottom;\n                        bounds.bottom = listBottom + dividerHeight;\n                        this.drawDivider(canvas, bounds, -1);\n                    }\n                }\n            }\n        }\n        // Draw the indicators (these should be drawn above the dividers) and children\n        super.dispatchDraw(canvas);\n    }\n\n    protected drawChild(canvas:Canvas, child:View, drawingTime:number):boolean  {\n        let more:boolean = super.drawChild(canvas, child, drawingTime);\n        if (this.mCachingActive && child.mCachingFailed) {\n            this.mCachingActive = false;\n        }\n        return more;\n    }\n\n    /**\n     * Draws a divider for the given child in the given bounds.\n     *\n     * @param canvas The canvas to draw to.\n     * @param bounds The bounds of the divider.\n     * @param childIndex The index of child (of the View) above the divider.\n     *            This will be -1 if there is no child above the divider to be\n     *            drawn.\n     */\n    drawDivider(canvas:Canvas, bounds:Rect, childIndex:number):void  {\n        // This widget draws the same divider for all children\n        const divider:Drawable = this.mDivider;\n        divider.setBounds(bounds);\n        divider.draw(canvas);\n    }\n\n    /**\n     * Returns the drawable that will be drawn between each item in the list.\n     *\n     * @return the current drawable drawn between list elements\n     */\n    getDivider():Drawable  {\n        return this.mDivider;\n    }\n\n    /**\n     * Sets the drawable that will be drawn between each item in the list. If the drawable does\n     * not have an intrinsic height, you should also call {@link #setDividerHeight(int)}\n     *\n     * @param divider The drawable to use.\n     */\n    setDivider(divider:Drawable):void  {\n        if (divider != null) {\n            this.mDividerHeight = divider.getIntrinsicHeight();\n        } else {\n            this.mDividerHeight = 0;\n        }\n        this.mDivider = divider;\n        this.mDividerIsOpaque = divider == null || divider.getOpacity() == PixelFormat.OPAQUE;\n        this.requestLayout();\n        this.invalidate();\n    }\n\n    /**\n     * @return Returns the height of the divider that will be drawn between each item in the list.\n     */\n    getDividerHeight():number  {\n        return this.mDividerHeight;\n    }\n\n    /**\n     * Sets the height of the divider that will be drawn between each item in the list. Calling\n     * this will override the intrinsic height as set by {@link #setDivider(Drawable)}\n     *\n     * @param height The new height of the divider in pixels.\n     */\n    setDividerHeight(height:number):void  {\n        this.mDividerHeight = height;\n        this.requestLayout();\n        this.invalidate();\n    }\n\n    /**\n     * Enables or disables the drawing of the divider for header views.\n     *\n     * @param headerDividersEnabled True to draw the headers, false otherwise.\n     *\n     * @see #setFooterDividersEnabled(boolean)\n     * @see #areHeaderDividersEnabled()\n     * @see #addHeaderView(android.view.View)\n     */\n    setHeaderDividersEnabled(headerDividersEnabled:boolean):void  {\n        this.mHeaderDividersEnabled = headerDividersEnabled;\n        this.invalidate();\n    }\n\n    /**\n     * @return Whether the drawing of the divider for header views is enabled\n     *\n     * @see #setHeaderDividersEnabled(boolean)\n     */\n    areHeaderDividersEnabled():boolean  {\n        return this.mHeaderDividersEnabled;\n    }\n\n    /**\n     * Enables or disables the drawing of the divider for footer views.\n     *\n     * @param footerDividersEnabled True to draw the footers, false otherwise.\n     *\n     * @see #setHeaderDividersEnabled(boolean)\n     * @see #areFooterDividersEnabled()\n     * @see #addFooterView(android.view.View)\n     */\n    setFooterDividersEnabled(footerDividersEnabled:boolean):void  {\n        this.mFooterDividersEnabled = footerDividersEnabled;\n        this.invalidate();\n    }\n\n    /**\n     * @return Whether the drawing of the divider for footer views is enabled\n     *\n     * @see #setFooterDividersEnabled(boolean)\n     */\n    areFooterDividersEnabled():boolean  {\n        return this.mFooterDividersEnabled;\n    }\n\n    /**\n     * Sets the drawable that will be drawn above all other list content.\n     * This area can become visible when the user overscrolls the list.\n     *\n     * @param header The drawable to use\n     */\n    setOverscrollHeader(header:Drawable):void  {\n        this.mOverScrollHeader = header;\n        if (this.mScrollY < 0) {\n            this.invalidate();\n        }\n    }\n\n    /**\n     * @return The drawable that will be drawn above all other list content\n     */\n    getOverscrollHeader():Drawable  {\n        return this.mOverScrollHeader;\n    }\n\n    /**\n     * Sets the drawable that will be drawn below all other list content.\n     * This area can become visible when the user overscrolls the list,\n     * or when the list's content does not fully fill the container area.\n     *\n     * @param footer The drawable to use\n     */\n    setOverscrollFooter(footer:Drawable):void  {\n        this.mOverScrollFooter = footer;\n        this.invalidate();\n    }\n\n    /**\n     * @return The drawable that will be drawn below all other list content\n     */\n    getOverscrollFooter():Drawable  {\n        return this.mOverScrollFooter;\n    }\n\n    onFocusChanged(gainFocus:boolean, direction:number, previouslyFocusedRect:Rect):void  {\n        super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);\n        const adapter:ListAdapter = this.mAdapter;\n        let closetChildIndex:number = -1;\n        let closestChildTop:number = 0;\n        if (adapter != null && gainFocus && previouslyFocusedRect != null) {\n            previouslyFocusedRect.offset(this.mScrollX, this.mScrollY);\n            // it could change in layoutChildren.\n            if (adapter.getCount() < this.getChildCount() + this.mFirstPosition) {\n                this.mLayoutMode = ListView.LAYOUT_NORMAL;\n                this.layoutChildren();\n            }\n            // figure out which item should be selected based on previously\n            // focused rect\n            let otherRect:Rect = this.mTempRect;\n            let minDistance:number = Integer.MAX_VALUE;\n            const childCount:number = this.getChildCount();\n            const firstPosition:number = this.mFirstPosition;\n            for (let i:number = 0; i < childCount; i++) {\n                // only consider selectable views\n                if (!adapter.isEnabled(firstPosition + i)) {\n                    continue;\n                }\n                let other:View = this.getChildAt(i);\n                other.getDrawingRect(otherRect);\n                this.offsetDescendantRectToMyCoords(other, otherRect);\n                let distance:number = ListView.getDistance(previouslyFocusedRect, otherRect, direction);\n                if (distance < minDistance) {\n                    minDistance = distance;\n                    closetChildIndex = i;\n                    closestChildTop = other.getTop();\n                }\n            }\n        }\n        if (closetChildIndex >= 0) {\n            this.setSelectionFromTop(closetChildIndex + this.mFirstPosition, closestChildTop);\n        } else {\n            this.requestLayout();\n        }\n    }\n\n    /*\n     * (non-Javadoc)\n     *\n     * Children specified in XML are assumed to be header views. After we have\n     * parsed them move them out of the children list and into mHeaderViews.\n     */\n    protected onFinishInflate():void  {\n        super.onFinishInflate();\n        let count:number = this.getChildCount();\n        if (count > 0) {\n            for (let i:number = 0; i < count; ++i) {\n                this.addHeaderView(this.getChildAt(i));\n            }\n            this.removeAllViews();\n        }\n    }\n\n    /* (non-Javadoc)\n     * @see android.view.View#findViewById(int)\n     * First look in our children, then in any header and footer views that may be scrolled off.\n     */\n    protected findViewTraversal(id:string):View  {\n        let v:View;\n        v = super.findViewTraversal(id);\n        if (v == null) {\n            v = this.findViewInHeadersOrFooters(this.mHeaderViewInfos, id);\n            if (v != null) {\n                return v;\n            }\n            v = this.findViewInHeadersOrFooters(this.mFooterViewInfos, id);\n            if (v != null) {\n                return v;\n            }\n        }\n        return v;\n    }\n\n    /* (non-Javadoc)\n     *\n     * Look in the passed in list of headers or footers for the view.\n     */\n    findViewInHeadersOrFooters(where:ArrayList<ListView.FixedViewInfo>, id:string):View  {\n        if (where != null) {\n            let len:number = where.size();\n            let v:View;\n            for (let i:number = 0; i < len; i++) {\n                v = where.get(i).view;\n                if (!v.isRootNamespace()) {\n                    v = v.findViewById(id);\n                    if (v != null) {\n                        return v;\n                    }\n                }\n            }\n        }\n        return null;\n    }\n\n    /* (non-Javadoc)\n     * @see android.view.View#findViewWithTag(Object)\n     * First look in our children, then in any header and footer views that may be scrolled off.\n     */\n    //findViewWithTagTraversal(tag:any):View  {\n    //    let v:View;\n    //    v = super.findViewWithTagTraversal(tag);\n    //    if (v == null) {\n    //        v = this.findViewWithTagInHeadersOrFooters(this.mHeaderViewInfos, tag);\n    //        if (v != null) {\n    //            return v;\n    //        }\n    //        v = this.findViewWithTagInHeadersOrFooters(this.mFooterViewInfos, tag);\n    //        if (v != null) {\n    //            return v;\n    //        }\n    //    }\n    //    return v;\n    //}\n\n    /* (non-Javadoc)\n     *\n     * Look in the passed in list of headers or footers for the view with the tag.\n     */\n    //findViewWithTagInHeadersOrFooters(where:ArrayList<ListView.FixedViewInfo>, tag:any):View  {\n    //    if (where != null) {\n    //        let len:number = where.size();\n    //        let v:View;\n    //        for (let i:number = 0; i < len; i++) {\n    //            v = where.get(i).view;\n    //            if (!v.isRootNamespace()) {\n    //                v = v.findViewWithTag(tag);\n    //                if (v != null) {\n    //                    return v;\n    //                }\n    //            }\n    //        }\n    //    }\n    //    return null;\n    //}\n\n    /**\n     * @hide\n     * @see android.view.View#findViewByPredicate(Predicate)\n     * First look in our children, then in any header and footer views that may be scrolled off.\n     */\n    protected findViewByPredicateTraversal(predicate:View.Predicate<View>, childToSkip:View):View  {\n        let v:View;\n        v = super.findViewByPredicateTraversal(predicate, childToSkip);\n        if (v == null) {\n            v = this.findViewByPredicateInHeadersOrFooters(this.mHeaderViewInfos, predicate, childToSkip);\n            if (v != null) {\n                return v;\n            }\n            v = this.findViewByPredicateInHeadersOrFooters(this.mFooterViewInfos, predicate, childToSkip);\n            if (v != null) {\n                return v;\n            }\n        }\n        return v;\n    }\n\n    /* (non-Javadoc)\n     *\n     * Look in the passed in list of headers or footers for the first view that matches\n     * the predicate.\n     */\n    findViewByPredicateInHeadersOrFooters(where:ArrayList<ListView.FixedViewInfo>, predicate:View.Predicate<View>, childToSkip:View):View  {\n        if (where != null) {\n            let len:number = where.size();\n            let v:View;\n            for (let i:number = 0; i < len; i++) {\n                v = where.get(i).view;\n                if (v != childToSkip && !v.isRootNamespace()) {\n                    v = v.findViewByPredicate(predicate);\n                    if (v != null) {\n                        return v;\n                    }\n                }\n            }\n        }\n        return null;\n    }\n\n    /**\n     * Returns the set of checked items ids. The result is only valid if the\n     * choice mode has not been set to {@link #CHOICE_MODE_NONE}.\n     * \n     * @return A new array which contains the id of each checked item in the\n     *         list.\n     *         \n     * @deprecated Use {@link #getCheckedItemIds()} instead.\n     */\n    getCheckItemIds():number[]  {\n        // Use new behavior that correctly handles stable ID mapping.\n        if (this.mAdapter != null && this.mAdapter.hasStableIds()) {\n            return this.getCheckedItemIds();\n        }\n        // Fall back to it to support legacy apps.\n        if (this.mChoiceMode != ListView.CHOICE_MODE_NONE && this.mCheckStates != null && this.mAdapter != null) {\n            const states:SparseBooleanArray = this.mCheckStates;\n            const count:number = states.size();\n            const ids:number[] = androidui.util.ArrayCreator.newNumberArray(count);\n            const adapter:ListAdapter = this.mAdapter;\n            let checkedCount:number = 0;\n            for (let i:number = 0; i < count; i++) {\n                if (states.valueAt(i)) {\n                    ids[checkedCount++] = adapter.getItemId(states.keyAt(i));\n                }\n            }\n            // resulting in checkedCount being smaller than count.\n            if (checkedCount == count) {\n                return ids;\n            } else {\n                const result:number[] = androidui.util.ArrayCreator.newNumberArray(checkedCount);\n                System.arraycopy(ids, 0, result, 0, checkedCount);\n                return result;\n            }\n        }\n        return androidui.util.ArrayCreator.newNumberArray(0);\n    }\n\n    //onInitializeAccessibilityEvent(event:AccessibilityEvent):void  {\n    //    super.onInitializeAccessibilityEvent(event);\n    //    event.setClassName(ListView.class.getName());\n    //}\n    //\n    //onInitializeAccessibilityNodeInfo(info:AccessibilityNodeInfo):void  {\n    //    super.onInitializeAccessibilityNodeInfo(info);\n    //    info.setClassName(ListView.class.getName());\n    //    const count:number = this.getCount();\n    //    const collectionInfo:CollectionInfo = CollectionInfo.obtain(1, count, false);\n    //    info.setCollectionInfo(collectionInfo);\n    //}\n    //\n    //onInitializeAccessibilityNodeInfoForItem(view:View, position:number, info:AccessibilityNodeInfo):void  {\n    //    super.onInitializeAccessibilityNodeInfoForItem(view, position, info);\n    //    const lp:LayoutParams = <LayoutParams> view.getLayoutParams();\n    //    const isHeading:boolean = lp != null && lp.viewType != ListView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER;\n    //    const itemInfo:CollectionItemInfo = CollectionItemInfo.obtain(0, 1, position, 1, isHeading);\n    //    info.setCollectionItemInfo(itemInfo);\n    //}\n}\n\nexport module ListView{\n/**\n     * A class that represents a fixed view in a list, for example a header at the top\n     * or a footer at the bottom.\n     */\nexport class FixedViewInfo {\n    _ListView_this:ListView;\n    constructor(arg:ListView){\n        this._ListView_this = arg;\n    }\n\n    /** The view to add to the list */\n    view:View;\n\n    /** The data backing the view. This is returned from {@link ListAdapter#getItem(int)}. */\n    data:any;\n\n    /** <code>true</code> if the fixed view should be selectable in the list */\n    isSelectable:boolean;\n}\nexport class FocusSelector implements Runnable {\n    _ListView_this:ListView;\n    constructor(arg:ListView){\n        this._ListView_this = arg;\n    }\n\n    private mPosition:number = 0;\n\n    private mPositionTop:number = 0;\n\n    setup(position:number, top:number):ListView.FocusSelector  {\n        this.mPosition = position;\n        this.mPositionTop = top;\n        return this;\n    }\n\n    run():void  {\n        this._ListView_this.setSelectionFromTop(this.mPosition, this.mPositionTop);\n    }\n}\n/**\n     * Holds results of focus aware arrow scrolling.\n     */\nexport class ArrowScrollFocusResult {\n\n    private mSelectedPosition:number = 0;\n\n    private mAmountToScroll:number = 0;\n\n    /**\n         * How {@link android.widget.ListView#arrowScrollFocused} returns its values.\n         */\n    populate(selectedPosition:number, amountToScroll:number):void  {\n        this.mSelectedPosition = selectedPosition;\n        this.mAmountToScroll = amountToScroll;\n    }\n\n    getSelectedPosition():number  {\n        return this.mSelectedPosition;\n    }\n\n    getAmountToScroll():number  {\n        return this.mAmountToScroll;\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/widget/NumberPicker.ts",
    "content": "/*\n * Copyright (C) 2008 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/content/res/ColorStateList.ts\"/>\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../android/graphics/Color.ts\"/>\n///<reference path=\"../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/text/TextUtils.ts\"/>\n///<reference path=\"../../android/util/SparseArray.ts\"/>\n///<reference path=\"../../android/util/TypedValue.ts\"/>\n///<reference path=\"../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../android/view/VelocityTracker.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewConfiguration.ts\"/>\n///<reference path=\"../../android/view/animation/DecelerateInterpolator.ts\"/>\n///<reference path=\"../../java/util/ArrayList.ts\"/>\n///<reference path=\"../../java/util/Collections.ts\"/>\n///<reference path=\"../../java/util/List.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../java/lang/StringBuilder.ts\"/>\n///<reference path=\"../../java/lang/Runnable.ts\"/>\n///<reference path=\"../../android/widget/Button.ts\"/>\n///<reference path=\"../../android/widget/ImageButton.ts\"/>\n///<reference path=\"../../android/widget/LinearLayout.ts\"/>\n///<reference path=\"../../android/widget/OverScroller.ts\"/>\n///<reference path=\"../../android/widget/TextView.ts\"/>\n///<reference path=\"../../android/R/layout.ts\"/>\n\nmodule android.widget {\n    import ColorStateList = android.content.res.ColorStateList;\n    import Canvas = android.graphics.Canvas;\n    import Color = android.graphics.Color;\n    import Paint = android.graphics.Paint;\n    import Align = android.graphics.Paint.Align;\n    import Rect = android.graphics.Rect;\n    import Drawable = android.graphics.drawable.Drawable;\n    import TextUtils = android.text.TextUtils;\n    import SparseArray = android.util.SparseArray;\n    import TypedValue = android.util.TypedValue;\n    import KeyEvent = android.view.KeyEvent;\n    import MotionEvent = android.view.MotionEvent;\n    import VelocityTracker = android.view.VelocityTracker;\n    import View = android.view.View;\n    import ViewConfiguration = android.view.ViewConfiguration;\n    import DecelerateInterpolator = android.view.animation.DecelerateInterpolator;\n    import ArrayList = java.util.ArrayList;\n    import Collections = java.util.Collections;\n    import List = java.util.List;\n    import Integer = java.lang.Integer;\n    import StringBuilder = java.lang.StringBuilder;\n    import Runnable = java.lang.Runnable;\n    import Button = android.widget.Button;\n    import ImageButton = android.widget.ImageButton;\n    import LinearLayout = android.widget.LinearLayout;\n    import OverScroller = android.widget.OverScroller;\n    import Scroller = android.widget.OverScroller;\n    import TextView = android.widget.TextView;\n    import R = android.R;\n    import AttrBinder = androidui.attr.AttrBinder;\n    /**\n     * A widget that enables the user to select a number form a predefined range.\n     * There are two flavors of this widget and which one is presented to the user\n     * depends on the current theme.\n     * <ul>\n     * <li>\n     * If the current theme is derived from {@link android.R.style#Theme} the widget\n     * presents the current value as an editable input field with an increment button\n     * above and a decrement button below. Long pressing the buttons allows for a quick\n     * change of the current value. Tapping on the input field allows to type in\n     * a desired value.\n     * </li>\n     * <li>\n     * If the current theme is derived from {@link android.R.style#Theme_Holo} or\n     * {@link android.R.style#Theme_Holo_Light} the widget presents the current\n     * value as an editable input field with a lesser value above and a greater\n     * value below. Tapping on the lesser or greater value selects it by animating\n     * the number axis up or down to make the chosen value current. Flinging up\n     * or down allows for multiple increments or decrements of the current value.\n     * Long pressing on the lesser and greater values also allows for a quick change\n     * of the current value. Tapping on the current value allows to type in a\n     * desired value.\n     * </li>\n     * </ul>\n     * <p>\n     * For an example of using this widget, see {@link android.widget.TimePicker}.\n     * </p>\n     */\n    export class NumberPicker extends LinearLayout {\n\n        /**\n         * The number of items show in the selector wheel.\n         */\n        private SELECTOR_WHEEL_ITEM_COUNT:number = 3;\n\n        /**\n         * The default update interval during long press.\n         */\n        private static DEFAULT_LONG_PRESS_UPDATE_INTERVAL:number = 300;\n\n        /**\n         * The index of the middle selector item.\n         */\n        private SELECTOR_MIDDLE_ITEM_INDEX:number = Math.floor(this.SELECTOR_WHEEL_ITEM_COUNT / 2);\n\n        /**\n         * The coefficient by which to adjust (divide) the max fling velocity.\n         */\n        private static SELECTOR_MAX_FLING_VELOCITY_ADJUSTMENT:number = 8;\n\n        /**\n         * The the duration for adjusting the selector wheel.\n         */\n        private static SELECTOR_ADJUSTMENT_DURATION_MILLIS:number = 800;\n\n        /**\n         * The duration of scrolling while snapping to a given position.\n         */\n        private static SNAP_SCROLL_DURATION:number = 300;\n\n        /**\n         * The strength of fading in the top and bottom while drawing the selector.\n         */\n        private static TOP_AND_BOTTOM_FADING_EDGE_STRENGTH:number = 0.9;\n\n        /**\n         * The default unscaled height of the selection divider.\n         */\n        private static UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT:number = 2;\n\n        /**\n         * The default unscaled distance between the selection dividers.\n         */\n        private static UNSCALED_DEFAULT_SELECTION_DIVIDERS_DISTANCE:number = 48;\n\n        ///**\n        // * The resource id for the default layout.\n        // */\n        //private static DEFAULT_LAYOUT_RESOURCE_ID:number = R.layout.number_picker;\n\n        /**\n         * Constant for unspecified size.\n         */\n        private static SIZE_UNSPECIFIED:number = -1;\n\n\n\n        private static sTwoDigitFormatter:NumberPicker.TwoDigitFormatter;\n\n        /**\n         * @hide\n         */\n        static getTwoDigitFormatter():NumberPicker.Formatter  {\n            if(!NumberPicker.sTwoDigitFormatter){\n                NumberPicker.sTwoDigitFormatter = new NumberPicker.TwoDigitFormatter();\n            }\n            return NumberPicker.sTwoDigitFormatter;\n        }\n\n        ///**\n        // * The increment button.\n        // */\n        //private mIncrementButton:ImageButton;\n\n        ///**\n        // * The decrement button.\n        // */\n        //private mDecrementButton:ImageButton;\n\n        ///**\n        // * The text for showing the current value.\n        // */\n        //private mInputText:EditText;\n\n        /**\n         * The distance between the two selection dividers.\n         */\n        private mSelectionDividersDistance:number = 0;\n\n        /**\n         * The min height of this widget.\n         */\n        private mMinHeight_:number = NumberPicker.SIZE_UNSPECIFIED;\n\n        /**\n         * The max height of this widget.\n         */\n        private mMaxHeight:number = NumberPicker.SIZE_UNSPECIFIED;\n\n        /**\n         * The max width of this widget.\n         */\n        private mMinWidth_:number = NumberPicker.SIZE_UNSPECIFIED;\n\n        /**\n         * The max width of this widget.\n         */\n        private mMaxWidth:number = NumberPicker.SIZE_UNSPECIFIED;\n\n        /**\n         * Flag whether to compute the max width.\n         */\n        private mComputeMaxWidth:boolean;\n\n        /**\n         * The height of the text.\n         */\n        private mTextSize:number = 0;\n\n        /**\n         * The height of the gap between text elements if the selector wheel.\n         */\n        private mSelectorTextGapHeight:number = 0;\n\n        /**\n         * The values to be displayed instead the indices.\n         */\n        private mDisplayedValues:string[];\n\n        /**\n         * Lower value of the range of numbers allowed for the NumberPicker\n         */\n        private mMinValue:number = 0;\n\n        /**\n         * Upper value of the range of numbers allowed for the NumberPicker\n         */\n        private mMaxValue:number = 0;\n\n        /**\n         * Current value of this NumberPicker\n         */\n        private mValue:number = 0;\n\n        /**\n         * Listener to be notified upon current value change.\n         */\n        private mOnValueChangeListener:NumberPicker.OnValueChangeListener;\n\n        /**\n         * Listener to be notified upon scroll state change.\n         */\n        private mOnScrollListener:NumberPicker.OnScrollListener;\n\n        /**\n         * Formatter for for displaying the current value.\n         */\n        private mFormatter:NumberPicker.Formatter;\n\n        /**\n         * The speed for updating the value form long press.\n         */\n        private mLongPressUpdateInterval:number = NumberPicker.DEFAULT_LONG_PRESS_UPDATE_INTERVAL;\n\n        /**\n         * Cache for the string representation of selector indices.\n         */\n        private mSelectorIndexToStringCache:SparseArray<string> = new SparseArray<string>();\n\n        /**\n         * The selector indices whose value are show by the selector.\n         */\n        private mSelectorIndices:number[];\n\n        /**\n         * The {@link Paint} for drawing the selector.\n         */\n        private mSelectorWheelPaint:Paint;\n\n        /**\n         * The {@link Drawable} for pressed virtual (increment/decrement) buttons.\n         */\n        private mVirtualButtonPressedDrawable:Drawable;\n\n        /**\n         * The height of a selector element (text + gap).\n         */\n        private mSelectorElementHeight:number = 0;\n\n        /**\n         * The initial offset of the scroll selector.\n         */\n        private mInitialScrollOffset:number = Integer.MIN_VALUE;\n\n        /**\n         * The current offset of the scroll selector.\n         */\n        private mCurrentScrollOffset:number = 0;\n\n        /**\n         * The {@link Scroller} responsible for flinging the selector.\n         */\n        private mFlingScroller:Scroller;\n\n        /**\n         * The {@link Scroller} responsible for adjusting the selector.\n         */\n        private mAdjustScroller:Scroller;\n\n        /**\n         * The previous Y coordinate while scrolling the selector.\n         */\n        private mPreviousScrollerY:number = 0;\n\n        /**\n         * Handle to the reusable command for setting the input text selection.\n         */\n        private mSetSelectionCommand:NumberPicker.SetSelectionCommand;\n\n        /**\n         * Handle to the reusable command for changing the current value from long\n         * press by one.\n         */\n        private mChangeCurrentByOneFromLongPressCommand:NumberPicker.ChangeCurrentByOneFromLongPressCommand;\n\n        /**\n         * Command for beginning an edit of the current value via IME on long press.\n         */\n        private mBeginSoftInputOnLongPressCommand:NumberPicker.BeginSoftInputOnLongPressCommand;\n\n        /**\n         * The Y position of the last down event.\n         */\n        private mLastDownEventY:number = 0;\n\n        /**\n         * The time of the last down event.\n         */\n        private mLastDownEventTime:number = 0;\n\n        /**\n         * The Y position of the last down or move event.\n         */\n        private mLastDownOrMoveEventY:number = 0;\n\n        /**\n         * Determines speed during touch scrolling.\n         */\n        private mVelocityTracker:VelocityTracker;\n\n        /**\n         * @see ViewConfiguration#getScaledTouchSlop()\n         */\n        //private mTouchSlop:number = 0;\n\n        /**\n         * @see ViewConfiguration#getScaledMinimumFlingVelocity()\n         */\n        private mMinimumFlingVelocity:number = 0;\n\n        /**\n         * @see ViewConfiguration#getScaledMaximumFlingVelocity()\n         */\n        private mMaximumFlingVelocity:number = 0;\n\n        /**\n         * Flag whether the selector should wrap around.\n         */\n        private mWrapSelectorWheel:boolean;\n\n        /**\n         * The back ground color used to optimize scroller fading.\n         */\n        private mSolidColor:number = 0;\n\n        /**\n         * Flag whether this widget has a selector wheel.\n         */\n        private mHasSelectorWheel:boolean;\n\n        /**\n         * Divider for showing item to be selected while scrolling\n         */\n        private mSelectionDivider:Drawable;\n\n        /**\n         * The height of the selection divider.\n         */\n        private mSelectionDividerHeight:number = 0;\n\n        /**\n         * The current scroll state of the number picker.\n         */\n        private mScrollState:number = NumberPicker.OnScrollListener.SCROLL_STATE_IDLE;\n\n        /**\n         * Flag whether to ignore move events - we ignore such when we show in IME\n         * to prevent the content from scrolling.\n         */\n        private mIngonreMoveEvents:boolean;\n\n        /**\n         * Flag whether to show soft input on tap.\n         */\n        private mShowSoftInputOnTap:boolean;\n\n        /**\n         * The top of the top selection divider.\n         */\n        private mTopSelectionDividerTop:number = 0;\n\n        /**\n         * The bottom of the bottom selection divider.\n         */\n        private mBottomSelectionDividerBottom:number = 0;\n\n        /**\n         * The virtual id of the last hovered child.\n         */\n        private mLastHoveredChildVirtualViewId:number = 0;\n\n        /**\n         * Whether the increment virtual button is pressed.\n         */\n        private mIncrementVirtualButtonPressed:boolean;\n\n        /**\n         * Whether the decrement virtual button is pressed.\n         */\n        private mDecrementVirtualButtonPressed:boolean;\n\n        /**\n         * Provider to report to clients the semantic structure of this widget.\n         */\n        //private mAccessibilityNodeProvider:NumberPicker.AccessibilityNodeProviderImpl;\n\n        /**\n         * Helper class for managing pressed state of the virtual buttons.\n         */\n        private mPressedStateHelper:NumberPicker.PressedStateHelper;\n\n        /**\n         * The keycode of the last handled DPAD down event.\n         */\n        private mLastHandledDownDpadKeyCode:number = -1;\n\n\n\n        /**\n         * Create a new number picker\n         *\n         * @param context the application environment.\n         * @param bindElement a collection of attributes.\n         * @param defStyle The default style to apply to this view.\n         */\n        constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle=android.R.attr.numberPickerStyle) {\n            super(context, bindElement, defStyle);\n\n            // process style attributes\n            let attributesArray = context.obtainStyledAttributes(bindElement, defStyle);\n            // const layoutResId:number = attributesArray.getResourceId('internalLayout', NumberPicker.DEFAULT_LAYOUT_RESOURCE_ID);\n            this.mHasSelectorWheel = true; // (layoutResId != NumberPicker.DEFAULT_LAYOUT_RESOURCE_ID);\n            this.mSolidColor = attributesArray.getColor('solidColor', 0);\n            this.mSelectionDivider = attributesArray.getDrawable('selectionDivider');\n            const defSelectionDividerHeight:number = Math.floor(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, NumberPicker.UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT, this.getResources().getDisplayMetrics()));\n            this.mSelectionDividerHeight = attributesArray.getDimensionPixelSize('selectionDividerHeight', defSelectionDividerHeight);\n            const defSelectionDividerDistance:number = Math.floor(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, NumberPicker.UNSCALED_DEFAULT_SELECTION_DIVIDERS_DISTANCE, this.getResources().getDisplayMetrics()));\n            this.mSelectionDividersDistance = attributesArray.getDimensionPixelSize('selectionDividersDistance', defSelectionDividerDistance);\n            this.mMinHeight = attributesArray.getDimensionPixelSize('internalMinHeight', NumberPicker.SIZE_UNSPECIFIED);\n            this.mMaxHeight = attributesArray.getDimensionPixelSize('internalMaxHeight', NumberPicker.SIZE_UNSPECIFIED);\n            if (this.mMinHeight != NumberPicker.SIZE_UNSPECIFIED && this.mMaxHeight != NumberPicker.SIZE_UNSPECIFIED && this.mMinHeight > this.mMaxHeight) {\n               throw Error(`new IllegalArgumentException(\"minHeight > maxHeight\")`);\n            }\n            this.mMinWidth = attributesArray.getDimensionPixelSize('internalMinWidth', NumberPicker.SIZE_UNSPECIFIED);\n            this.mMaxWidth = attributesArray.getDimensionPixelSize('internalMaxWidth', NumberPicker.SIZE_UNSPECIFIED);\n            if (this.mMinWidth != NumberPicker.SIZE_UNSPECIFIED && this.mMaxWidth != NumberPicker.SIZE_UNSPECIFIED && this.mMinWidth > this.mMaxWidth) {\n               throw Error(`new IllegalArgumentException(\"minWidth > maxWidth\")`);\n            }\n            this.mComputeMaxWidth = (this.mMaxWidth == NumberPicker.SIZE_UNSPECIFIED);\n            this.mVirtualButtonPressedDrawable = attributesArray.getDrawable('virtualButtonPressedDrawable');\n\n            this.mTextSize = attributesArray.getDimensionPixelSize('textSize', Math.floor(16 * this.getResources().getDisplayMetrics().density)); // AndroidUIX modify\n            // create the selector wheel paint\n            let paint:Paint = new Paint();\n            paint.setAntiAlias(true);\n            paint.setTextAlign(Align.CENTER);\n            paint.setTextSize(this.mTextSize);\n            //paint.setTypeface(this.mInputText.getTypeface());\n            //let colors:ColorStateList = this.mInputText.getTextColors();\n            paint.setColor(attributesArray.getColor('textColor', Color.DKGRAY)); // AndroidUIX modify\n            this.mSelectorWheelPaint = paint;\n\n            this.SELECTOR_WHEEL_ITEM_COUNT = attributesArray.getInt('itemCount', this.SELECTOR_WHEEL_ITEM_COUNT); // AndroidUIX modify\n            this.SELECTOR_MIDDLE_ITEM_INDEX = Math.floor(this.SELECTOR_WHEEL_ITEM_COUNT / 2); // AndroidUIX modify\n            this.mSelectorIndices = androidui.util.ArrayCreator.newNumberArray(this.SELECTOR_WHEEL_ITEM_COUNT);\n\n            if (this.mMinHeight_ != NumberPicker.SIZE_UNSPECIFIED && this.mMaxHeight != NumberPicker.SIZE_UNSPECIFIED && this.mMinHeight_ > this.mMaxHeight) {\n                throw Error(`new IllegalArgumentException(\"minHeight > maxHeight\")`);\n            }\n            if (this.mMinWidth_ != NumberPicker.SIZE_UNSPECIFIED && this.mMaxWidth != NumberPicker.SIZE_UNSPECIFIED && this.mMinWidth_ > this.mMaxWidth) {\n                throw Error(`new IllegalArgumentException(\"minWidth > maxWidth\")`);\n            }\n            this.mComputeMaxWidth = (this.mMaxWidth == NumberPicker.SIZE_UNSPECIFIED);\n\n            this.setMinValue(attributesArray.getInt('minValue', this.mMinValue)); // AndroidUIX modify\n            this.setMaxValue(attributesArray.getInt('maxValue', this.mMaxValue)); // AndroidUIX modify\n            attributesArray.recycle();\n\n            this.mPressedStateHelper = new NumberPicker.PressedStateHelper(this);\n            // By default Linearlayout that we extend is not drawn. This is\n            // its draw() method is not called but dispatchDraw() is called\n            // directly (see ViewGroup.drawChild()). However, this class uses\n            // the fading edge effect implemented by View and we need our\n            // draw() method to be called. Therefore, we declare we will draw.\n            this.setWillNotDraw(!this.mHasSelectorWheel);\n            //let inflater:LayoutInflater = <LayoutInflater> this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n            //inflater.inflate(layoutResId, this, true);\n            //let onClickListener:View.OnClickListener = (()=>{\n            //    const inner_this=this;\n            //    class _Inner implements View.OnClickListener {\n            //        onClick(v:View):void  {\n            //            inner_this.hideSoftInput();\n            //            inner_this.mInputText.clearFocus();\n            //            if (v.getId() == R.id.increment) {\n            //                inner_this.changeValueByOne(true);\n            //            } else {\n            //                inner_this.changeValueByOne(false);\n            //            }\n            //        }\n            //    }\n            //    return new _Inner();\n            //})();\n            //let onLongClickListener:View.OnLongClickListener = (()=>{\n            //    const inner_this=this;\n            //    class _Inner implements View.OnLongClickListener {\n            //\n            //        onLongClick(v:View):boolean  {\n            //            this.hideSoftInput();\n            //            this.mInputText.clearFocus();\n            //            if (v.getId() == R.id.increment) {\n            //                this.postChangeCurrentByOneFromLongPress(true, 0);\n            //            } else {\n            //                this.postChangeCurrentByOneFromLongPress(false, 0);\n            //            }\n            //            return true;\n            //        }\n            //    }\n            //    return new _Inner(this);\n            //})();\n            //// increment button\n            //if (!this.mHasSelectorWheel) {\n            //    this.mIncrementButton = <ImageButton> this.findViewById(R.id.increment);\n            //    this.mIncrementButton.setOnClickListener(onClickListener);\n            //    this.mIncrementButton.setOnLongClickListener(onLongClickListener);\n            //} else {\n            //    this.mIncrementButton = null;\n            //}\n            //// decrement button\n            //if (!this.mHasSelectorWheel) {\n            //    this.mDecrementButton = <ImageButton> this.findViewById(R.id.decrement);\n            //    this.mDecrementButton.setOnClickListener(onClickListener);\n            //    this.mDecrementButton.setOnLongClickListener(onLongClickListener);\n            //} else {\n            //    this.mDecrementButton = null;\n            //}\n            // input text\n            //this.mInputText = <EditText> this.findViewById(R.id.numberpicker_input);\n            //this.mInputText.setOnFocusChangeListener((()=>{\n            //    const inner_this=this;\n            //    class _Inner extends View.OnFocusChangeListener {\n            //\n            //        onFocusChange(v:View, hasFocus:boolean):void  {\n            //            if (hasFocus) {\n            //                this.mInputText.selectAll();\n            //            } else {\n            //                this.mInputText.setSelection(0, 0);\n            //                this.validateInputTextView(v);\n            //            }\n            //        }\n            //    }\n            //    return new _Inner(this);\n            //})());\n            //this.mInputText.setFilters( [ new NumberPicker.InputTextFilter(this) ]);\n            //this.mInputText.setRawInputType(InputType.TYPE_CLASS_NUMBER);\n            //this.mInputText.setImeOptions(EditorInfo.IME_ACTION_DONE);\n            // initialize constants\n            let configuration:ViewConfiguration = ViewConfiguration.get();\n            //this.mTouchSlop = configuration.getScaledTouchSlop();\n            this.mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();\n            this.mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity() / NumberPicker.SELECTOR_MAX_FLING_VELOCITY_ADJUSTMENT;\n            // create the fling and adjust scrollers\n            this.mFlingScroller = new OverScroller(null, true);\n            this.mAdjustScroller = new OverScroller(new DecelerateInterpolator(2.5));\n            this.updateInputTextView();\n            // If not explicitly specified this view is important for accessibility.\n            //if (this.getImportantForAccessibility() == NumberPicker.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {\n            //    this.setImportantForAccessibility(NumberPicker.IMPORTANT_FOR_ACCESSIBILITY_YES);\n            //}\n        }\n\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n            return super.createClassAttrBinder().set('solidColor', {\n                setter(v:NumberPicker, value:any, attrBinder:AttrBinder) {\n                    v.mSolidColor = attrBinder.parseColor(value, v.mSolidColor);\n                    v.invalidate();\n                }, getter(v:NumberPicker) {\n                    return v.mSolidColor;\n                }\n            }).set('selectionDivider', {\n                setter(v:NumberPicker, value:any, attrBinder:AttrBinder) {\n                    v.mSelectionDivider = attrBinder.parseDrawable(value);\n                    v.invalidate();\n                }, getter(v:NumberPicker) {\n                    return v.mSelectionDivider;\n                }\n            }).set('selectionDividerHeight', {\n                setter(v:NumberPicker, value:any, attrBinder:AttrBinder) {\n                    v.mSelectionDividerHeight = attrBinder.parseNumberPixelSize(value, v.mSelectionDividerHeight);\n                    v.invalidate();\n                }, getter(v:NumberPicker) {\n                    return v.mSelectionDividerHeight;\n                }\n            }).set('selectionDividersDistance', {\n                setter(v:NumberPicker, value:any, attrBinder:AttrBinder) {\n                    v.mSelectionDividersDistance = attrBinder.parseNumberPixelSize(value, v.mSelectionDividersDistance);\n                    v.invalidate();\n                }, getter(v:NumberPicker) {\n                    return v.mSelectionDividersDistance;\n                }\n            }).set('internalMinHeight', {\n                setter(v:NumberPicker, value:any, attrBinder:AttrBinder) {\n                    v.mMinHeight_ = attrBinder.parseNumberPixelSize(value, v.mMinHeight_);\n                    v.invalidate();\n                }, getter(v:NumberPicker) {\n                    return v.mMinHeight_;\n                }\n            }).set('internalMaxHeight', {\n                setter(v:NumberPicker, value:any, attrBinder:AttrBinder) {\n                    v.mMaxHeight = attrBinder.parseNumberPixelSize(value, v.mMaxHeight);\n                    v.invalidate();\n                }, getter(v:NumberPicker) {\n                    return v.mMaxHeight;\n                }\n            }).set('internalMinWidth', {\n                setter(v:NumberPicker, value:any, attrBinder:AttrBinder) {\n                    v.mMinWidth_ = attrBinder.parseNumberPixelSize(value, v.mMinWidth_);\n                    v.invalidate();\n                }, getter(v:NumberPicker) {\n                    return v.mMinWidth_;\n                }\n            }).set('internalMaxWidth', {\n                setter(v:NumberPicker, value:any, attrBinder:AttrBinder) {\n                    v.mMaxWidth = attrBinder.parseNumberPixelSize(value, v.mMaxWidth);\n                    v.invalidate();\n                }, getter(v:NumberPicker) {\n                    return v.mMaxWidth;\n                }\n            }).set('virtualButtonPressedDrawable', {\n                setter(v:NumberPicker, value:any, attrBinder:AttrBinder) {\n                    v.mVirtualButtonPressedDrawable = attrBinder.parseDrawable(value);\n                    v.invalidate();\n                }, getter(v:NumberPicker) {\n                    return v.mVirtualButtonPressedDrawable;\n                }\n            });\n        }\n\n        protected onLayout(changed:boolean, left:number, top:number, right:number, bottom:number):void  {\n            if (!this.mHasSelectorWheel) {\n                super.onLayout(changed, left, top, right, bottom);\n                return;\n            }\n            const msrdWdth:number = this.getMeasuredWidth();\n            const msrdHght:number = this.getMeasuredHeight();\n            // Input text centered horizontally.\n            //const inptTxtMsrdWdth:number = this.mInputText.getMeasuredWidth();\n            //const inptTxtMsrdHght:number = this.mInputText.getMeasuredHeight();\n            //const inptTxtLeft:number = (msrdWdth - inptTxtMsrdWdth) / 2;\n            //const inptTxtTop:number = (msrdHght - inptTxtMsrdHght) / 2;\n            //const inptTxtRight:number = inptTxtLeft + inptTxtMsrdWdth;\n            //const inptTxtBottom:number = inptTxtTop + inptTxtMsrdHght;\n            //this.mInputText.layout(inptTxtLeft, inptTxtTop, inptTxtRight, inptTxtBottom);\n            if (changed) {\n                // need to do all this when we know our size\n                this.initializeSelectorWheel();\n                this.initializeFadingEdges();\n                this.mTopSelectionDividerTop = (this.getHeight() - this.mSelectionDividersDistance) / 2 - this.mSelectionDividerHeight;\n                this.mBottomSelectionDividerBottom = this.mTopSelectionDividerTop + 2 * this.mSelectionDividerHeight + this.mSelectionDividersDistance;\n            }\n        }\n\n        protected onMeasure(widthMeasureSpec:number, heightMeasureSpec:number):void  {\n            if (!this.mHasSelectorWheel) {\n                super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n                return;\n            }\n            // Try greedily to fit the max width and height.\n            const newWidthMeasureSpec:number = this.makeMeasureSpec(widthMeasureSpec, this.mMaxWidth);\n            const newHeightMeasureSpec:number = this.makeMeasureSpec(heightMeasureSpec, this.mMaxHeight);\n            super.onMeasure(newWidthMeasureSpec, newHeightMeasureSpec);\n            // Flag if we are measured with width or height less than the respective min.\n            const widthSize:number = this.resolveSizeAndStateRespectingMinSize(this.mMinWidth_, this.getMeasuredWidth(), widthMeasureSpec);\n            const heightSize:number = this.resolveSizeAndStateRespectingMinSize(this.mMinHeight_, this.getMeasuredHeight(), heightMeasureSpec);\n            this.setMeasuredDimension(widthSize, heightSize);\n        }\n\n        /**\n         * Move to the final position of a scroller. Ensures to force finish the scroller\n         * and if it is not at its final position a scroll of the selector wheel is\n         * performed to fast forward to the final position.\n         *\n         * @param scroller The scroller to whose final position to get.\n         * @return True of the a move was performed, i.e. the scroller was not in final position.\n         */\n        private moveToFinalScrollerPosition(scroller:Scroller):boolean  {\n            scroller.forceFinished(true);\n            let amountToScroll:number = scroller.getFinalY() - scroller.getCurrY();\n            let futureScrollOffset:number = (this.mCurrentScrollOffset + amountToScroll) % this.mSelectorElementHeight;\n            let overshootAdjustment:number = this.mInitialScrollOffset - futureScrollOffset;\n            if (overshootAdjustment != 0) {\n                if (Math.abs(overshootAdjustment) > this.mSelectorElementHeight / 2) {\n                    if (overshootAdjustment > 0) {\n                        overshootAdjustment -= this.mSelectorElementHeight;\n                    } else {\n                        overshootAdjustment += this.mSelectorElementHeight;\n                    }\n                }\n                amountToScroll += overshootAdjustment;\n                this.scrollBy(0, amountToScroll);\n                return true;\n            }\n            return false;\n        }\n\n        onInterceptTouchEvent(event:MotionEvent):boolean  {\n            if (!this.mHasSelectorWheel || !this.isEnabled()) {\n                return false;\n            }\n            const action:number = event.getActionMasked();\n            switch(action) {\n                case MotionEvent.ACTION_DOWN:\n                {\n                    this.removeAllCallbacks();\n                    //this.mInputText.setVisibility(View.INVISIBLE);\n                    this.mLastDownOrMoveEventY = this.mLastDownEventY = event.getY();\n                    this.mLastDownEventTime = event.getEventTime();\n                    this.mIngonreMoveEvents = false;\n                    this.mShowSoftInputOnTap = false;\n                    // Handle pressed state before any state change.\n                    if (this.mLastDownEventY < this.mTopSelectionDividerTop) {\n                        if (this.mScrollState == NumberPicker.OnScrollListener.SCROLL_STATE_IDLE) {\n                            this.mPressedStateHelper.buttonPressDelayed(NumberPicker.PressedStateHelper.BUTTON_DECREMENT);\n                        }\n                    } else if (this.mLastDownEventY > this.mBottomSelectionDividerBottom) {\n                        if (this.mScrollState == NumberPicker.OnScrollListener.SCROLL_STATE_IDLE) {\n                            this.mPressedStateHelper.buttonPressDelayed(NumberPicker.PressedStateHelper.BUTTON_INCREMENT);\n                        }\n                    }\n                    // Make sure we support flinging inside scrollables.\n                    this.getParent().requestDisallowInterceptTouchEvent(true);\n                    if (!this.mFlingScroller.isFinished()) {\n                        this.mFlingScroller.forceFinished(true);\n                        this.mAdjustScroller.forceFinished(true);\n                        this.onScrollStateChange(NumberPicker.OnScrollListener.SCROLL_STATE_IDLE);\n                    } else if (!this.mAdjustScroller.isFinished()) {\n                        this.mFlingScroller.forceFinished(true);\n                        this.mAdjustScroller.forceFinished(true);\n                    } else if (this.mLastDownEventY < this.mTopSelectionDividerTop) {\n                        this.hideSoftInput();\n                        this.postChangeCurrentByOneFromLongPress(false, ViewConfiguration.getLongPressTimeout());\n                    } else if (this.mLastDownEventY > this.mBottomSelectionDividerBottom) {\n                        this.hideSoftInput();\n                        this.postChangeCurrentByOneFromLongPress(true, ViewConfiguration.getLongPressTimeout());\n                    } else {\n                        this.mShowSoftInputOnTap = true;\n                        this.postBeginSoftInputOnLongPressCommand();\n                    }\n                    return true;\n                }\n            }\n            return false;\n        }\n\n        onTouchEvent(event:MotionEvent):boolean  {\n            if (!this.isEnabled() || !this.mHasSelectorWheel) {\n                return false;\n            }\n            if (this.mVelocityTracker == null) {\n                this.mVelocityTracker = VelocityTracker.obtain();\n            }\n            this.mVelocityTracker.addMovement(event);\n            let action:number = event.getActionMasked();\n            switch(action) {\n                case MotionEvent.ACTION_MOVE:\n                {\n                    if (this.mIngonreMoveEvents) {\n                        break;\n                    }\n                    let currentMoveY:number = event.getY();\n                    if (this.mScrollState != NumberPicker.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {\n                        let deltaDownY:number = Math.floor(Math.abs(currentMoveY - this.mLastDownEventY));\n                        if (deltaDownY > this.mTouchSlop) {\n                            this.removeAllCallbacks();\n                            this.onScrollStateChange(NumberPicker.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);\n                        }\n                    } else {\n                        let deltaMoveY:number = Math.floor(((currentMoveY - this.mLastDownOrMoveEventY)));\n                        this.scrollBy(0, deltaMoveY);\n                        this.invalidate();\n                    }\n                    this.mLastDownOrMoveEventY = currentMoveY;\n                }\n                    break;\n                case MotionEvent.ACTION_UP:\n                {\n                    this.removeBeginSoftInputCommand();\n                    this.removeChangeCurrentByOneFromLongPress();\n                    this.mPressedStateHelper.cancel();\n                    let velocityTracker:VelocityTracker = this.mVelocityTracker;\n                    velocityTracker.computeCurrentVelocity(1000, this.mMaximumFlingVelocity);\n                    let initialVelocity:number = Math.floor(velocityTracker.getYVelocity());\n                    if (Math.abs(initialVelocity) > this.mMinimumFlingVelocity) {\n                        this.fling(initialVelocity);\n                        this.onScrollStateChange(NumberPicker.OnScrollListener.SCROLL_STATE_FLING);\n                    } else {\n                        let eventY:number = Math.floor(event.getY());\n                        let deltaMoveY:number = Math.floor(Math.abs(eventY - this.mLastDownEventY));\n                        let deltaTime:number = event.getEventTime() - this.mLastDownEventTime;\n                        if (deltaMoveY <= this.mTouchSlop && deltaTime < ViewConfiguration.getTapTimeout()) {\n                            if (this.mShowSoftInputOnTap) {\n                                this.mShowSoftInputOnTap = false;\n                                this.showSoftInput();\n                            } else {\n                                let selectorIndexOffset:number = (eventY / this.mSelectorElementHeight) - this.SELECTOR_MIDDLE_ITEM_INDEX;\n                                if (selectorIndexOffset > 0) {\n                                    this.changeValueByOne(true);\n                                    this.mPressedStateHelper.buttonTapped(NumberPicker.PressedStateHelper.BUTTON_INCREMENT);\n                                } else if (selectorIndexOffset < 0) {\n                                    this.changeValueByOne(false);\n                                    this.mPressedStateHelper.buttonTapped(NumberPicker.PressedStateHelper.BUTTON_DECREMENT);\n                                }\n                            }\n                        } else {\n                            this.ensureScrollWheelAdjusted();\n                        }\n                        this.onScrollStateChange(NumberPicker.OnScrollListener.SCROLL_STATE_IDLE);\n                    }\n                    this.mVelocityTracker.recycle();\n                    this.mVelocityTracker = null;\n                }\n                    break;\n            }\n            return true;\n        }\n\n        dispatchTouchEvent(event:MotionEvent):boolean  {\n            const action:number = event.getActionMasked();\n            switch(action) {\n                case MotionEvent.ACTION_CANCEL:\n                case MotionEvent.ACTION_UP:\n                    this.removeAllCallbacks();\n                    break;\n            }\n            return super.dispatchTouchEvent(event);\n        }\n\n        dispatchKeyEvent(event:KeyEvent):boolean  {\n            const keyCode:number = event.getKeyCode();\n            switch(keyCode) {\n                case KeyEvent.KEYCODE_DPAD_CENTER:\n                case KeyEvent.KEYCODE_ENTER:\n                    this.removeAllCallbacks();\n                    break;\n                case KeyEvent.KEYCODE_DPAD_DOWN:\n                case KeyEvent.KEYCODE_DPAD_UP:\n                    if (!this.mHasSelectorWheel) {\n                        break;\n                    }\n                    switch(event.getAction()) {\n                        case KeyEvent.ACTION_DOWN:\n                            if (this.mWrapSelectorWheel || (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) ? this.getValue() < this.getMaxValue() : this.getValue() > this.getMinValue()) {\n                                this.requestFocus();\n                                this.mLastHandledDownDpadKeyCode = keyCode;\n                                this.removeAllCallbacks();\n                                if (this.mFlingScroller.isFinished()) {\n                                    this.changeValueByOne(keyCode == KeyEvent.KEYCODE_DPAD_DOWN);\n                                }\n                                return true;\n                            }\n                            break;\n                        case KeyEvent.ACTION_UP:\n                            if (this.mLastHandledDownDpadKeyCode == keyCode) {\n                                this.mLastHandledDownDpadKeyCode = -1;\n                                return true;\n                            }\n                            break;\n                    }\n            }\n            return super.dispatchKeyEvent(event);\n        }\n\n        //dispatchTrackballEvent(event:MotionEvent):boolean  {\n        //    const action:number = event.getActionMasked();\n        //    switch(action) {\n        //        case MotionEvent.ACTION_CANCEL:\n        //        case MotionEvent.ACTION_UP:\n        //            this.removeAllCallbacks();\n        //            break;\n        //    }\n        //    return super.dispatchTrackballEvent(event);\n        //}\n\n        //protected dispatchHoverEvent(event:MotionEvent):boolean  {\n        //    if (!this.mHasSelectorWheel) {\n        //        return super.dispatchHoverEvent(event);\n        //    }\n        //    if (AccessibilityManager.getInstance(this.mContext).isEnabled()) {\n        //        const eventY:number = Math.floor(event.getY());\n        //        let hoveredVirtualViewId:number;\n        //        if (eventY < this.mTopSelectionDividerTop) {\n        //            hoveredVirtualViewId = NumberPicker.AccessibilityNodeProviderImpl.VIRTUAL_VIEW_ID_DECREMENT;\n        //        } else if (eventY > this.mBottomSelectionDividerBottom) {\n        //            hoveredVirtualViewId = NumberPicker.AccessibilityNodeProviderImpl.VIRTUAL_VIEW_ID_INCREMENT;\n        //        } else {\n        //            hoveredVirtualViewId = NumberPicker.AccessibilityNodeProviderImpl.VIRTUAL_VIEW_ID_INPUT;\n        //        }\n        //        const action:number = event.getActionMasked();\n        //        let provider:NumberPicker.AccessibilityNodeProviderImpl = <NumberPicker.AccessibilityNodeProviderImpl> this.getAccessibilityNodeProvider();\n        //        switch(action) {\n        //            case MotionEvent.ACTION_HOVER_ENTER:\n        //            {\n        //                provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId, AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);\n        //                this.mLastHoveredChildVirtualViewId = hoveredVirtualViewId;\n        //                provider.performAction(hoveredVirtualViewId, AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null);\n        //            }\n        //                break;\n        //            case MotionEvent.ACTION_HOVER_MOVE:\n        //            {\n        //                if (this.mLastHoveredChildVirtualViewId != hoveredVirtualViewId && this.mLastHoveredChildVirtualViewId != View.NO_ID) {\n        //                    provider.sendAccessibilityEventForVirtualView(this.mLastHoveredChildVirtualViewId, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);\n        //                    provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId, AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);\n        //                    this.mLastHoveredChildVirtualViewId = hoveredVirtualViewId;\n        //                    provider.performAction(hoveredVirtualViewId, AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null);\n        //                }\n        //            }\n        //                break;\n        //            case MotionEvent.ACTION_HOVER_EXIT:\n        //            {\n        //                provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);\n        //                this.mLastHoveredChildVirtualViewId = View.NO_ID;\n        //            }\n        //                break;\n        //        }\n        //    }\n        //    return false;\n        //}\n\n        computeScroll():void  {\n            let scroller:Scroller = this.mFlingScroller;\n            if (scroller.isFinished()) {\n                scroller = this.mAdjustScroller;\n                if (scroller.isFinished()) {\n                    return;\n                }\n            }\n            scroller.computeScrollOffset();\n            let currentScrollerY:number = scroller.getCurrY();\n            if (this.mPreviousScrollerY == 0) {\n                this.mPreviousScrollerY = scroller.getStartY();\n            }\n            this.scrollBy(0, currentScrollerY - this.mPreviousScrollerY);\n            this.mPreviousScrollerY = currentScrollerY;\n            if (scroller.isFinished()) {\n                this.onScrollerFinished(scroller);\n            } else {\n                this.invalidate();\n            }\n        }\n\n        setEnabled(enabled:boolean):void  {\n            super.setEnabled(enabled);\n            if (!this.mHasSelectorWheel) {\n                //this.mIncrementButton.setEnabled(enabled);\n            }\n            if (!this.mHasSelectorWheel) {\n                //this.mDecrementButton.setEnabled(enabled);\n            }\n            //this.mInputText.setEnabled(enabled);\n        }\n\n        scrollBy(x:number, y:number):void  {\n            let selectorIndices:number[] = this.mSelectorIndices;\n            if (!this.mWrapSelectorWheel && y > 0 && selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX] <= this.mMinValue) {\n                this.mCurrentScrollOffset = this.mInitialScrollOffset;\n                return;\n            }\n            if (!this.mWrapSelectorWheel && y < 0 && selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX] >= this.mMaxValue) {\n                this.mCurrentScrollOffset = this.mInitialScrollOffset;\n                return;\n            }\n            this.mCurrentScrollOffset += y;\n            while (this.mCurrentScrollOffset - this.mInitialScrollOffset > this.mSelectorTextGapHeight) {\n                this.mCurrentScrollOffset -= this.mSelectorElementHeight;\n                this.decrementSelectorIndices(selectorIndices);\n                this.setValueInternal(selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX], true);\n                if (!this.mWrapSelectorWheel && selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX] <= this.mMinValue) {\n                    this.mCurrentScrollOffset = this.mInitialScrollOffset;\n                }\n            }\n            while (this.mCurrentScrollOffset - this.mInitialScrollOffset < -this.mSelectorTextGapHeight) {\n                this.mCurrentScrollOffset += this.mSelectorElementHeight;\n                this.incrementSelectorIndices(selectorIndices);\n                this.setValueInternal(selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX], true);\n                if (!this.mWrapSelectorWheel && selectorIndices[this.SELECTOR_MIDDLE_ITEM_INDEX] >= this.mMaxValue) {\n                    this.mCurrentScrollOffset = this.mInitialScrollOffset;\n                }\n            }\n        }\n\n        protected computeVerticalScrollOffset():number  {\n            return this.mCurrentScrollOffset;\n        }\n\n        protected computeVerticalScrollRange():number  {\n            return (this.mMaxValue - this.mMinValue + 1) * this.mSelectorElementHeight;\n        }\n\n        protected computeVerticalScrollExtent():number  {\n            return this.getHeight();\n        }\n\n        getSolidColor():number  {\n            return this.mSolidColor;\n        }\n\n        /**\n         * Sets the listener to be notified on change of the current value.\n         *\n         * @param onValueChangedListener The listener.\n         */\n        setOnValueChangedListener(onValueChangedListener:NumberPicker.OnValueChangeListener):void  {\n            this.mOnValueChangeListener = onValueChangedListener;\n        }\n\n        /**\n         * Set listener to be notified for scroll state changes.\n         *\n         * @param onScrollListener The listener.\n         */\n        setOnScrollListener(onScrollListener:NumberPicker.OnScrollListener):void  {\n            this.mOnScrollListener = onScrollListener;\n        }\n\n        /**\n         * Set the formatter to be used for formatting the current value.\n         * <p>\n         * Note: If you have provided alternative values for the values this\n         * formatter is never invoked.\n         * </p>\n         *\n         * @param formatter The formatter object. If formatter is <code>null</code>,\n         *            {@link String#valueOf(int)} will be used.\n         *@see #setDisplayedValues(String[])\n         */\n        setFormatter(formatter:NumberPicker.Formatter):void  {\n            if (formatter == this.mFormatter) {\n                return;\n            }\n            this.mFormatter = formatter;\n            this.initializeSelectorWheelIndices();\n            this.updateInputTextView();\n        }\n\n        /**\n         * Set the current value for the number picker.\n         * <p>\n         * If the argument is less than the {@link NumberPicker#getMinValue()} and\n         * {@link NumberPicker#getWrapSelectorWheel()} is <code>false</code> the\n         * current value is set to the {@link NumberPicker#getMinValue()} value.\n         * </p>\n         * <p>\n         * If the argument is less than the {@link NumberPicker#getMinValue()} and\n         * {@link NumberPicker#getWrapSelectorWheel()} is <code>true</code> the\n         * current value is set to the {@link NumberPicker#getMaxValue()} value.\n         * </p>\n         * <p>\n         * If the argument is less than the {@link NumberPicker#getMaxValue()} and\n         * {@link NumberPicker#getWrapSelectorWheel()} is <code>false</code> the\n         * current value is set to the {@link NumberPicker#getMaxValue()} value.\n         * </p>\n         * <p>\n         * If the argument is less than the {@link NumberPicker#getMaxValue()} and\n         * {@link NumberPicker#getWrapSelectorWheel()} is <code>true</code> the\n         * current value is set to the {@link NumberPicker#getMinValue()} value.\n         * </p>\n         *\n         * @param value The current value.\n         * @see #setWrapSelectorWheel(boolean)\n         * @see #setMinValue(int)\n         * @see #setMaxValue(int)\n         */\n        setValue(value:number):void  {\n            this.setValueInternal(value, false);\n        }\n\n        /**\n         * Shows the soft input for its input text.\n         */\n        private showSoftInput():void  {\n            //let inputMethodManager:InputMethodManager = InputMethodManager.peekInstance();\n            //if (inputMethodManager != null) {\n            //    if (this.mHasSelectorWheel) {\n            //        this.mInputText.setVisibility(View.VISIBLE);\n            //    }\n            //    this.mInputText.requestFocus();\n            //    inputMethodManager.showSoftInput(this.mInputText, 0);\n            //}\n        }\n\n        /**\n         * Hides the soft input if it is active for the input text.\n         */\n        private hideSoftInput():void  {\n            //let inputMethodManager:InputMethodManager = InputMethodManager.peekInstance();\n            //if (inputMethodManager != null && inputMethodManager.isActive(this.mInputText)) {\n            //    inputMethodManager.hideSoftInputFromWindow(this.getWindowToken(), 0);\n            //    if (this.mHasSelectorWheel) {\n            //        this.mInputText.setVisibility(View.INVISIBLE);\n            //    }\n            //}\n        }\n\n        /**\n         * Computes the max width if no such specified as an attribute.\n         */\n        private tryComputeMaxWidth():void  {\n            if (!this.mComputeMaxWidth) {\n                return;\n            }\n            let maxTextWidth:number = 0;\n            if (this.mDisplayedValues == null) {\n                let maxDigitWidth:number = 0;\n                for (let i:number = 0; i <= 9; i++) {\n                    const digitWidth:number = this.mSelectorWheelPaint.measureText(NumberPicker.formatNumberWithLocale(i));\n                    if (digitWidth > maxDigitWidth) {\n                        maxDigitWidth = digitWidth;\n                    }\n                }\n                let numberOfDigits:number = 0;\n                let current:number = this.mMaxValue;\n                while (current > 0) {\n                    numberOfDigits++;\n                    current = current / 10;\n                }\n                maxTextWidth = Math.floor((numberOfDigits * maxDigitWidth));\n            } else {\n                const valueCount:number = this.mDisplayedValues.length;\n                for (let i:number = 0; i < valueCount; i++) {\n                    const textWidth:number = this.mSelectorWheelPaint.measureText(this.mDisplayedValues[i]);\n                    if (textWidth > maxTextWidth) {\n                        maxTextWidth = Math.floor(textWidth);\n                    }\n                }\n            }\n            //maxTextWidth += this.mInputText.getPaddingLeft() + this.mInputText.getPaddingRight();\n            if (this.mMaxWidth != maxTextWidth) {\n                if (maxTextWidth > this.mMinWidth_) {\n                    this.mMaxWidth = maxTextWidth;\n                } else {\n                    this.mMaxWidth = this.mMinWidth_;\n                }\n                this.invalidate();\n            }\n        }\n\n        /**\n         * Gets whether the selector wheel wraps when reaching the min/max value.\n         *\n         * @return True if the selector wheel wraps.\n         *\n         * @see #getMinValue()\n         * @see #getMaxValue()\n         */\n        getWrapSelectorWheel():boolean  {\n            return this.mWrapSelectorWheel;\n        }\n\n        /**\n         * Sets whether the selector wheel shown during flinging/scrolling should\n         * wrap around the {@link NumberPicker#getMinValue()} and\n         * {@link NumberPicker#getMaxValue()} values.\n         * <p>\n         * By default if the range (max - min) is more than the number of items shown\n         * on the selector wheel the selector wheel wrapping is enabled.\n         * </p>\n         * <p>\n         * <strong>Note:</strong> If the number of items, i.e. the range (\n         * {@link #getMaxValue()} - {@link #getMinValue()}) is less than\n         * the number of items shown on the selector wheel, the selector wheel will\n         * not wrap. Hence, in such a case calling this method is a NOP.\n         * </p>\n         *\n         * @param wrapSelectorWheel Whether to wrap.\n         */\n        setWrapSelectorWheel(wrapSelectorWheel:boolean):void  {\n            const wrappingAllowed:boolean = (this.mMaxValue - this.mMinValue) >= this.mSelectorIndices.length;\n            if ((!wrapSelectorWheel || wrappingAllowed) && wrapSelectorWheel != this.mWrapSelectorWheel) {\n                this.mWrapSelectorWheel = wrapSelectorWheel;\n            }\n        }\n\n        /**\n         * Sets the speed at which the numbers be incremented and decremented when\n         * the up and down buttons are long pressed respectively.\n         * <p>\n         * The default value is 300 ms.\n         * </p>\n         *\n         * @param intervalMillis The speed (in milliseconds) at which the numbers\n         *            will be incremented and decremented.\n         */\n        setOnLongPressUpdateInterval(intervalMillis:number):void  {\n            this.mLongPressUpdateInterval = intervalMillis;\n        }\n\n        /**\n         * Returns the value of the picker.\n         *\n         * @return The value.\n         */\n        getValue():number  {\n            return this.mValue;\n        }\n\n        /**\n         * Returns the min value of the picker.\n         *\n         * @return The min value\n         */\n        getMinValue():number  {\n            return this.mMinValue;\n        }\n\n        /**\n         * Sets the min value of the picker.\n         *\n         * @param minValue The min value inclusive.\n         *\n         * <strong>Note:</strong> The length of the displayed values array\n         * set via {@link #setDisplayedValues(String[])} must be equal to the\n         * range of selectable numbers which is equal to\n         * {@link #getMaxValue()} - {@link #getMinValue()} + 1.\n         */\n        setMinValue(minValue:number):void  {\n            if (this.mMinValue == minValue) {\n                return;\n            }\n            if (minValue < 0) {\n                throw Error(`new IllegalArgumentException(\"minValue must be >= 0\")`);\n            }\n            this.mMinValue = minValue;\n            if (this.mMinValue > this.mValue) {\n                this.mValue = this.mMinValue;\n            }\n            let wrapSelectorWheel:boolean = this.mMaxValue - this.mMinValue > this.mSelectorIndices.length;\n            this.setWrapSelectorWheel(wrapSelectorWheel);\n            this.initializeSelectorWheelIndices();\n            this.updateInputTextView();\n            this.tryComputeMaxWidth();\n            this.invalidate();\n        }\n\n        /**\n         * Returns the max value of the picker.\n         *\n         * @return The max value.\n         */\n        getMaxValue():number  {\n            return this.mMaxValue;\n        }\n\n        /**\n         * Sets the max value of the picker.\n         *\n         * @param maxValue The max value inclusive.\n         *\n         * <strong>Note:</strong> The length of the displayed values array\n         * set via {@link #setDisplayedValues(String[])} must be equal to the\n         * range of selectable numbers which is equal to\n         * {@link #getMaxValue()} - {@link #getMinValue()} + 1.\n         */\n        setMaxValue(maxValue:number):void  {\n            if (this.mMaxValue == maxValue) {\n                return;\n            }\n            if (maxValue < 0) {\n                throw Error(`new IllegalArgumentException(\"maxValue must be >= 0\")`);\n            }\n            this.mMaxValue = maxValue;\n            if (this.mMaxValue < this.mValue) {\n                this.mValue = this.mMaxValue;\n            }\n            let wrapSelectorWheel:boolean = this.mMaxValue - this.mMinValue > this.mSelectorIndices.length;\n            this.setWrapSelectorWheel(wrapSelectorWheel);\n            this.initializeSelectorWheelIndices();\n            this.updateInputTextView();\n            this.tryComputeMaxWidth();\n            this.invalidate();\n        }\n\n        /**\n         * Gets the values to be displayed instead of string values.\n         *\n         * @return The displayed values.\n         */\n        getDisplayedValues():string[]  {\n            return this.mDisplayedValues;\n        }\n\n        /**\n         * Sets the values to be displayed.\n         *\n         * @param displayedValues The displayed values.\n         *\n         * <strong>Note:</strong> The length of the displayed values array\n         * must be equal to the range of selectable numbers which is equal to\n         * {@link #getMaxValue()} - {@link #getMinValue()} + 1.\n         */\n        setDisplayedValues(displayedValues:string[]):void  {\n            if (this.mDisplayedValues == displayedValues) {\n                return;\n            }\n            this.mDisplayedValues = displayedValues;\n            if (this.mDisplayedValues != null) {\n                // Allow text entry rather than strictly numeric entry.\n                //this.mInputText.setRawInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);\n            } else {\n                //this.mInputText.setRawInputType(InputType.TYPE_CLASS_NUMBER);\n            }\n            this.updateInputTextView();\n            this.initializeSelectorWheelIndices();\n            this.tryComputeMaxWidth();\n        }\n\n        protected getTopFadingEdgeStrength():number  {\n            return NumberPicker.TOP_AND_BOTTOM_FADING_EDGE_STRENGTH;\n        }\n\n        protected getBottomFadingEdgeStrength():number  {\n            return NumberPicker.TOP_AND_BOTTOM_FADING_EDGE_STRENGTH;\n        }\n\n        protected onDetachedFromWindow():void  {\n            super.onDetachedFromWindow();\n            this.removeAllCallbacks();\n        }\n\n        protected onDraw(canvas:Canvas):void  {\n            if (!this.mHasSelectorWheel) {\n                super.onDraw(canvas);\n                return;\n            }\n            let x:number = (this.mRight - this.mLeft) / 2;\n            let y:number = this.mCurrentScrollOffset;\n            // draw the virtual buttons pressed state if needed\n            if (this.mVirtualButtonPressedDrawable != null && this.mScrollState == NumberPicker.OnScrollListener.SCROLL_STATE_IDLE) {\n                if (this.mDecrementVirtualButtonPressed) {\n                    this.mVirtualButtonPressedDrawable.setState(NumberPicker.PRESSED_STATE_SET);\n                    this.mVirtualButtonPressedDrawable.setBounds(0, 0, this.mRight, this.mTopSelectionDividerTop);\n                    this.mVirtualButtonPressedDrawable.draw(canvas);\n                }\n                if (this.mIncrementVirtualButtonPressed) {\n                    this.mVirtualButtonPressedDrawable.setState(NumberPicker.PRESSED_STATE_SET);\n                    this.mVirtualButtonPressedDrawable.setBounds(0, this.mBottomSelectionDividerBottom, this.mRight, this.mBottom);\n                    this.mVirtualButtonPressedDrawable.draw(canvas);\n                }\n            }\n            // draw the selector wheel\n            let selectorIndices:number[] = this.mSelectorIndices;\n            for (let i:number = 0; i < selectorIndices.length; i++) {\n                let selectorIndex:number = selectorIndices[i];\n                let scrollSelectorValue:string = this.mSelectorIndexToStringCache.get(selectorIndex);\n                // with the new one.\n                //if (i != this.SELECTOR_MIDDLE_ITEM_INDEX || this.mInputText.getVisibility() != NumberPicker.VISIBLE) {\n                    canvas.drawText(scrollSelectorValue, x, y, this.mSelectorWheelPaint);\n                //}\n                y += this.mSelectorElementHeight;\n            }\n            // draw the selection dividers\n            if (this.mSelectionDivider != null) {\n                // draw the top divider\n                let topOfTopDivider:number = this.mTopSelectionDividerTop;\n                let bottomOfTopDivider:number = topOfTopDivider + this.mSelectionDividerHeight;\n                this.mSelectionDivider.setBounds(0, topOfTopDivider, this.mRight, bottomOfTopDivider);\n                this.mSelectionDivider.draw(canvas);\n                // draw the bottom divider\n                let bottomOfBottomDivider:number = this.mBottomSelectionDividerBottom;\n                let topOfBottomDivider:number = bottomOfBottomDivider - this.mSelectionDividerHeight;\n                this.mSelectionDivider.setBounds(0, topOfBottomDivider, this.mRight, bottomOfBottomDivider);\n                this.mSelectionDivider.draw(canvas);\n            }\n        }\n\n        //onInitializeAccessibilityEvent(event:AccessibilityEvent):void  {\n        //    super.onInitializeAccessibilityEvent(event);\n        //    event.setClassName(NumberPicker.class.getName());\n        //    event.setScrollable(true);\n        //    event.setScrollY((this.mMinValue + this.mValue) * this.mSelectorElementHeight);\n        //    event.setMaxScrollY((this.mMaxValue - this.mMinValue) * this.mSelectorElementHeight);\n        //}\n        //\n        //getAccessibilityNodeProvider():AccessibilityNodeProvider  {\n        //    if (!this.mHasSelectorWheel) {\n        //        return super.getAccessibilityNodeProvider();\n        //    }\n        //    if (this.mAccessibilityNodeProvider == null) {\n        //        this.mAccessibilityNodeProvider = new NumberPicker.AccessibilityNodeProviderImpl(this);\n        //    }\n        //    return this.mAccessibilityNodeProvider;\n        //}\n\n        /**\n         * Makes a measure spec that tries greedily to use the max value.\n         *\n         * @param measureSpec The measure spec.\n         * @param maxSize The max value for the size.\n         * @return A measure spec greedily imposing the max size.\n         */\n        private makeMeasureSpec(measureSpec:number, maxSize:number):number  {\n            if (maxSize == NumberPicker.SIZE_UNSPECIFIED) {\n                return measureSpec;\n            }\n            const size:number = View.MeasureSpec.getSize(measureSpec);\n            const mode:number = View.MeasureSpec.getMode(measureSpec);\n            switch(mode) {\n                case View.MeasureSpec.EXACTLY:\n                    return measureSpec;\n                case View.MeasureSpec.AT_MOST:\n                    return View.MeasureSpec.makeMeasureSpec(Math.min(size, maxSize), View.MeasureSpec.EXACTLY);\n                case View.MeasureSpec.UNSPECIFIED:\n                    return View.MeasureSpec.makeMeasureSpec(maxSize, View.MeasureSpec.EXACTLY);\n                default:\n                    throw Error(`new IllegalArgumentException(\"Unknown measure mode: \" + mode)`);\n            }\n        }\n\n        /**\n         * Utility to reconcile a desired size and state, with constraints imposed\n         * by a MeasureSpec. Tries to respect the min size, unless a different size\n         * is imposed by the constraints.\n         *\n         * @param minSize The minimal desired size.\n         * @param measuredSize The currently measured size.\n         * @param measureSpec The current measure spec.\n         * @return The resolved size and state.\n         */\n        private resolveSizeAndStateRespectingMinSize(minSize:number, measuredSize:number, measureSpec:number):number  {\n            if (minSize != NumberPicker.SIZE_UNSPECIFIED) {\n                const desiredWidth:number = Math.max(minSize, measuredSize);\n                return NumberPicker.resolveSizeAndState(desiredWidth, measureSpec, 0);\n            } else {\n                return measuredSize;\n            }\n        }\n\n        /**\n         * Resets the selector indices and clear the cached string representation of\n         * these indices.\n         */\n        private initializeSelectorWheelIndices():void  {\n            this.mSelectorIndexToStringCache.clear();\n            let selectorIndices:number[] = this.mSelectorIndices;\n            let current:number = this.getValue();\n            for (let i:number = 0; i < this.mSelectorIndices.length; i++) {\n                let selectorIndex:number = Math.floor(current + (i - this.SELECTOR_MIDDLE_ITEM_INDEX));\n                if (this.mWrapSelectorWheel) {\n                    selectorIndex = this.getWrappedSelectorIndex(selectorIndex);\n                }\n                selectorIndices[i] = selectorIndex;\n                this.ensureCachedScrollSelectorValue(selectorIndices[i]);\n            }\n        }\n\n        /**\n         * Sets the current value of this NumberPicker.\n         *\n         * @param current The new value of the NumberPicker.\n         * @param notifyChange Whether to notify if the current value changed.\n         */\n        private setValueInternal(current:number, notifyChange:boolean):void  {\n            if (this.mValue == current) {\n                return;\n            }\n            // Wrap around the values if we go past the start or end\n            if (this.mWrapSelectorWheel) {\n                current = this.getWrappedSelectorIndex(current);\n            } else {\n                current = Math.max(current, this.mMinValue);\n                current = Math.min(current, this.mMaxValue);\n            }\n            let previous:number = this.mValue;\n            this.mValue = current;\n            this.updateInputTextView();\n            if (notifyChange) {\n                this.notifyChange(previous, current);\n            }\n            this.initializeSelectorWheelIndices();\n            this.invalidate();\n        }\n\n        /**\n         * Changes the current value by one which is increment or\n         * decrement based on the passes argument.\n         * decrement the current value.\n         *\n         * @param increment True to increment, false to decrement.\n         */\n        private changeValueByOne(increment:boolean):void  {\n            if (this.mHasSelectorWheel) {\n                //this.mInputText.setVisibility(View.INVISIBLE);\n                if (!this.moveToFinalScrollerPosition(this.mFlingScroller)) {\n                    this.moveToFinalScrollerPosition(this.mAdjustScroller);\n                }\n                this.mPreviousScrollerY = 0;\n                if (increment) {\n                    this.mFlingScroller.startScroll(0, 0, 0, -this.mSelectorElementHeight, NumberPicker.SNAP_SCROLL_DURATION);\n                } else {\n                    this.mFlingScroller.startScroll(0, 0, 0, this.mSelectorElementHeight, NumberPicker.SNAP_SCROLL_DURATION);\n                }\n                this.invalidate();\n            } else {\n                if (increment) {\n                    this.setValueInternal(this.mValue + 1, true);\n                } else {\n                    this.setValueInternal(this.mValue - 1, true);\n                }\n            }\n        }\n\n        private initializeSelectorWheel():void  {\n            this.initializeSelectorWheelIndices();\n            let selectorIndices:number[] = this.mSelectorIndices;\n            let totalTextHeight:number = selectorIndices.length * this.mTextSize;\n            let totalTextGapHeight:number = (this.mBottom - this.mTop) - totalTextHeight;\n            let textGapCount:number = selectorIndices.length;\n            this.mSelectorTextGapHeight = Math.floor((totalTextGapHeight / textGapCount + 0.5));\n            this.mSelectorElementHeight = this.mTextSize + this.mSelectorTextGapHeight;\n            // Ensure that the middle item is positioned the same as the text in\n            // mInputText\n            let editTextTextPosition:number = this.getHeight()/2 + this.mTextSize/2;\n            this.mInitialScrollOffset = editTextTextPosition - (this.mSelectorElementHeight * this.SELECTOR_MIDDLE_ITEM_INDEX);\n            this.mCurrentScrollOffset = this.mInitialScrollOffset;\n            this.updateInputTextView();\n        }\n\n        private initializeFadingEdges():void  {\n            this.setVerticalFadingEdgeEnabled(true);\n            this.setFadingEdgeLength((this.mBottom - this.mTop - this.mTextSize) / 2);\n        }\n\n        /**\n         * Callback invoked upon completion of a given <code>scroller</code>.\n         */\n        private onScrollerFinished(scroller:Scroller):void  {\n            if (scroller == this.mFlingScroller) {\n                if (!this.ensureScrollWheelAdjusted()) {\n                    this.updateInputTextView();\n                }\n                this.onScrollStateChange(NumberPicker.OnScrollListener.SCROLL_STATE_IDLE);\n            } else {\n                if (this.mScrollState != NumberPicker.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {\n                    this.updateInputTextView();\n                }\n            }\n        }\n\n        /**\n         * Handles transition to a given <code>scrollState</code>\n         */\n        private onScrollStateChange(scrollState:number):void  {\n            if (this.mScrollState == scrollState) {\n                return;\n            }\n            this.mScrollState = scrollState;\n            if (this.mOnScrollListener != null) {\n                this.mOnScrollListener.onScrollStateChange(this, scrollState);\n            }\n        }\n\n        /**\n         * Flings the selector with the given <code>velocityY</code>.\n         */\n        private fling(velocityY:number):void  {\n            this.mPreviousScrollerY = 0;\n            if (velocityY > 0) {\n                this.mFlingScroller.fling(0, 0, 0, velocityY, 0, 0, 0, Integer.MAX_VALUE);\n            } else {\n                this.mFlingScroller.fling(0, Integer.MAX_VALUE, 0, velocityY, 0, 0, 0, Integer.MAX_VALUE);\n            }\n            this.invalidate();\n        }\n\n        /**\n         * @return The wrapped index <code>selectorIndex</code> value.\n         */\n        private getWrappedSelectorIndex(selectorIndex:number):number  {\n            if (selectorIndex > this.mMaxValue) {\n                return this.mMinValue + (selectorIndex - this.mMaxValue) % (this.mMaxValue - this.mMinValue) - 1;\n            } else if (selectorIndex < this.mMinValue) {\n                return this.mMaxValue - (this.mMinValue - selectorIndex) % (this.mMaxValue - this.mMinValue) + 1;\n            }\n            return selectorIndex;\n        }\n\n        /**\n         * Increments the <code>selectorIndices</code> whose string representations\n         * will be displayed in the selector.\n         */\n        private incrementSelectorIndices(selectorIndices:number[]):void  {\n            for (let i:number = 0; i < selectorIndices.length - 1; i++) {\n                selectorIndices[i] = selectorIndices[i + 1];\n            }\n            let nextScrollSelectorIndex:number = selectorIndices[selectorIndices.length - 2] + 1;\n            if (this.mWrapSelectorWheel && nextScrollSelectorIndex > this.mMaxValue) {\n                nextScrollSelectorIndex = this.mMinValue;\n            }\n            selectorIndices[selectorIndices.length - 1] = nextScrollSelectorIndex;\n            this.ensureCachedScrollSelectorValue(nextScrollSelectorIndex);\n        }\n\n        /**\n         * Decrements the <code>selectorIndices</code> whose string representations\n         * will be displayed in the selector.\n         */\n        private decrementSelectorIndices(selectorIndices:number[]):void  {\n            for (let i:number = selectorIndices.length - 1; i > 0; i--) {\n                selectorIndices[i] = selectorIndices[i - 1];\n            }\n            let nextScrollSelectorIndex:number = selectorIndices[1] - 1;\n            if (this.mWrapSelectorWheel && nextScrollSelectorIndex < this.mMinValue) {\n                nextScrollSelectorIndex = this.mMaxValue;\n            }\n            selectorIndices[0] = nextScrollSelectorIndex;\n            this.ensureCachedScrollSelectorValue(nextScrollSelectorIndex);\n        }\n\n        /**\n         * Ensures we have a cached string representation of the given <code>\n         * selectorIndex</code> to avoid multiple instantiations of the same string.\n         */\n        private ensureCachedScrollSelectorValue(selectorIndex:number):void  {\n            let cache:SparseArray<string> = this.mSelectorIndexToStringCache;\n            let scrollSelectorValue:string = cache.get(selectorIndex);\n            if (scrollSelectorValue != null) {\n                return;\n            }\n            if (selectorIndex < this.mMinValue || selectorIndex > this.mMaxValue) {\n                scrollSelectorValue = \"\";\n            } else {\n                if (this.mDisplayedValues != null) {\n                    let displayedValueIndex:number = selectorIndex - this.mMinValue;\n                    scrollSelectorValue = this.mDisplayedValues[displayedValueIndex];\n                } else {\n                    scrollSelectorValue = this.formatNumber(selectorIndex);\n                }\n            }\n            cache.put(selectorIndex, scrollSelectorValue);\n        }\n\n        private formatNumber(value:number):string  {\n            return (this.mFormatter != null) ? this.mFormatter.format(value) : NumberPicker.formatNumberWithLocale(value);\n        }\n\n        private validateInputTextView(v:View):void  {\n            //let str:string = String.valueOf((<TextView> v).getText());\n            //if (TextUtils.isEmpty(str)) {\n            //    // Restore to the old value as we don't allow empty values\n            //    this.updateInputTextView();\n            //} else {\n            //    // Check the new value and ensure it's in range\n            //    let current:number = this.getSelectedPos(str.toString());\n            //    this.setValueInternal(current, true);\n            //}\n        }\n\n        /**\n         * Updates the view of this NumberPicker. If displayValues were specified in\n         * the string corresponding to the index specified by the current value will\n         * be returned. Otherwise, the formatter specified in {@link #setFormatter}\n         * will be used to format the number.\n         *\n         * @return Whether the text was updated.\n         */\n        private updateInputTextView():boolean  {\n            /*\n             * If we don't have displayed values then use the current number else\n             * find the correct value in the displayed values for the current\n             * number.\n             */\n            //let text:string = (this.mDisplayedValues == null) ? this.formatNumber(this.mValue) : this.mDisplayedValues[this.mValue - this.mMinValue];\n            //if (!TextUtils.isEmpty(text) && !text.equals(this.mInputText.getText().toString())) {\n            //    this.mInputText.setText(text);\n            //    return true;\n            //}\n            return false;\n        }\n\n        /**\n         * Notifies the listener, if registered, of a change of the value of this\n         * NumberPicker.\n         */\n        private notifyChange(previous:number, current:number):void  {\n            if (this.mOnValueChangeListener != null) {\n                this.mOnValueChangeListener.onValueChange(this, previous, this.mValue);\n            }\n        }\n\n        /**\n         * Posts a command for changing the current value by one.\n         *\n         * @param increment Whether to increment or decrement the value.\n         */\n        private postChangeCurrentByOneFromLongPress(increment:boolean, delayMillis:number):void  {\n            if (this.mChangeCurrentByOneFromLongPressCommand == null) {\n                this.mChangeCurrentByOneFromLongPressCommand = new NumberPicker.ChangeCurrentByOneFromLongPressCommand(this);\n            } else {\n                this.removeCallbacks(this.mChangeCurrentByOneFromLongPressCommand);\n            }\n            this.mChangeCurrentByOneFromLongPressCommand.setStep(increment);\n            this.postDelayed(this.mChangeCurrentByOneFromLongPressCommand, delayMillis);\n        }\n\n        /**\n         * Removes the command for changing the current value by one.\n         */\n        private removeChangeCurrentByOneFromLongPress():void  {\n            if (this.mChangeCurrentByOneFromLongPressCommand != null) {\n                this.removeCallbacks(this.mChangeCurrentByOneFromLongPressCommand);\n            }\n        }\n\n        /**\n         * Posts a command for beginning an edit of the current value via IME on\n         * long press.\n         */\n        private postBeginSoftInputOnLongPressCommand():void  {\n            if (this.mBeginSoftInputOnLongPressCommand == null) {\n                this.mBeginSoftInputOnLongPressCommand = new NumberPicker.BeginSoftInputOnLongPressCommand(this);\n            } else {\n                this.removeCallbacks(this.mBeginSoftInputOnLongPressCommand);\n            }\n            this.postDelayed(this.mBeginSoftInputOnLongPressCommand, ViewConfiguration.getLongPressTimeout());\n        }\n\n        /**\n         * Removes the command for beginning an edit of the current value via IME.\n         */\n        private removeBeginSoftInputCommand():void  {\n            if (this.mBeginSoftInputOnLongPressCommand != null) {\n                this.removeCallbacks(this.mBeginSoftInputOnLongPressCommand);\n            }\n        }\n\n        /**\n         * Removes all pending callback from the message queue.\n         */\n        private removeAllCallbacks():void  {\n            if (this.mChangeCurrentByOneFromLongPressCommand != null) {\n                this.removeCallbacks(this.mChangeCurrentByOneFromLongPressCommand);\n            }\n            if (this.mSetSelectionCommand != null) {\n                this.removeCallbacks(this.mSetSelectionCommand);\n            }\n            if (this.mBeginSoftInputOnLongPressCommand != null) {\n                this.removeCallbacks(this.mBeginSoftInputOnLongPressCommand);\n            }\n            this.mPressedStateHelper.cancel();\n        }\n\n        /**\n         * @return The selected index given its displayed <code>value</code>.\n         */\n        private getSelectedPos(value:string):number  {\n            if (this.mDisplayedValues == null) {\n                try {\n                    return Integer.parseInt(value);\n                } catch (e){\n                }\n            } else {\n                for (let i:number = 0; i < this.mDisplayedValues.length; i++) {\n                    // Don't force the user to type in jan when ja will do\n                    value = value.toLowerCase();\n                    if (this.mDisplayedValues[i].toLowerCase().startsWith(value)) {\n                        return this.mMinValue + i;\n                    }\n                }\n                /*\n                 * The user might have typed in a number into the month field i.e.\n                 * 10 instead of OCT so support that too.\n                 */\n                try {\n                    return Integer.parseInt(value);\n                } catch (e){\n                }\n            }\n            return this.mMinValue;\n        }\n\n        /**\n         * Posts an {@link SetSelectionCommand} from the given <code>selectionStart\n         * </code> to <code>selectionEnd</code>.\n         */\n        private postSetSelectionCommand(selectionStart:number, selectionEnd:number):void  {\n            if (this.mSetSelectionCommand == null) {\n                this.mSetSelectionCommand = new NumberPicker.SetSelectionCommand(this);\n            } else {\n                this.removeCallbacks(this.mSetSelectionCommand);\n            }\n            this.mSetSelectionCommand.mSelectionStart = selectionStart;\n            this.mSetSelectionCommand.mSelectionEnd = selectionEnd;\n            this.post(this.mSetSelectionCommand);\n        }\n\n        /**\n         * The numbers accepted by the input text's {@link Filter}\n         */\n        //private static DIGIT_CHARACTERS:char[] =  [ // Latin digits are the common case\n        //    '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', // Arabic-Indic\n        //    '٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩', // Extended Arabic-Indic\n        //    '۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹' ];\n\n\n\n        /**\n         * Ensures that the scroll wheel is adjusted i.e. there is no offset and the\n         * middle element is in the middle of the widget.\n         *\n         * @return Whether an adjustment has been made.\n         */\n        private ensureScrollWheelAdjusted():boolean  {\n            // adjust to the closest value\n            let deltaY:number = this.mInitialScrollOffset - this.mCurrentScrollOffset;\n            if (deltaY != 0) {\n                this.mPreviousScrollerY = 0;\n                if (Math.abs(deltaY) > this.mSelectorElementHeight / 2) {\n                    deltaY += (deltaY > 0) ? -this.mSelectorElementHeight : this.mSelectorElementHeight;\n                }\n                this.mAdjustScroller.startScroll(0, 0, 0, deltaY, NumberPicker.SELECTOR_ADJUSTMENT_DURATION_MILLIS);\n                this.invalidate();\n                return true;\n            }\n            return false;\n        }\n\n\n\n\n\n\n\n\n\n\n\n\n\n        private static formatNumberWithLocale(value:number):string  {\n            return value + '';\n        }\n    }\n\n    export module NumberPicker{\n        /**\n         * Use a custom NumberPicker formatting callback to use two-digit minutes\n         * strings like \"01\". Keeping a static formatter etc. is the most efficient\n         * way to do this; it avoids creating temporary objects on every call to\n         * format().\n         */\n        export class TwoDigitFormatter implements NumberPicker.Formatter {\n            format(value:number):string  {\n                let s = value+'';\n                if(s.length===1) s = '0' + s;\n                return s;\n            }\n        }\n        /**\n         * Interface to listen for changes of the current value.\n         */\n        export interface OnValueChangeListener {\n\n            /**\n             * Called upon a change of the current value.\n             *\n             * @param picker The NumberPicker associated with this listener.\n             * @param oldVal The previous value.\n             * @param newVal The new value.\n             */\n            onValueChange(picker:NumberPicker, oldVal:number, newVal:number):void ;\n        }\n        /**\n         * Interface to listen for the picker scroll state.\n         */\n        export interface OnScrollListener {\n\n            /**\n             * Callback invoked while the number picker scroll state has changed.\n             *\n             * @param view The view whose scroll state is being reported.\n             * @param scrollState The current scroll state. One of\n             *            {@link #SCROLL_STATE_IDLE},\n             *            {@link #SCROLL_STATE_TOUCH_SCROLL} or\n             *            {@link #SCROLL_STATE_IDLE}.\n             */\n            onScrollStateChange(view:NumberPicker, scrollState:number):void ;\n        }\n\n        export module OnScrollListener{\n            /**\n             * The view is not scrolling.\n             */\n            export var SCROLL_STATE_IDLE:number = 0;/**\n         * The user is scrolling using touch, and his finger is still on the screen.\n         */\n        export var SCROLL_STATE_TOUCH_SCROLL:number = 1;/**\n         * The user had previously been scrolling using touch and performed a fling.\n         */\n        export var SCROLL_STATE_FLING:number = 2;}\n\n        /**\n         * Interface used to format current value into a string for presentation.\n         */\n        export interface Formatter {\n\n            /**\n             * Formats a string representation of the current value.\n             *\n             * @param value The currently selected value.\n             * @return A formatted string representation.\n             */\n            format(value:number):string ;\n        }\n        ///**\n        // * Filter for accepting only valid indices or prefixes of the string\n        // * representation of valid indices.\n        // */\n        //export class InputTextFilter extends NumberKeyListener {\n        //    _NumberPicker_this:NumberPicker;\n        //    constructor(arg:NumberPicker){\n        //        super();\n        //        this._NumberPicker_this = arg;\n        //    }\n        //\n        //    // XXX This doesn't allow for range limits when controlled by a\n        //    // soft input method!\n        //    getInputType():number  {\n        //        return InputType.TYPE_CLASS_TEXT;\n        //    }\n        //\n        //    protected getAcceptedChars():char[]  {\n        //        return NumberPicker.DIGIT_CHARACTERS;\n        //    }\n        //\n        //    filter(source:CharSequence, start:number, end:number, dest:Spanned, dstart:number, dend:number):CharSequence  {\n        //        if (this._NumberPicker_this.mDisplayedValues == null) {\n        //            let filtered:CharSequence = super.filter(source, start, end, dest, dstart, dend);\n        //            if (filtered == null) {\n        //                filtered = source.subSequence(start, end);\n        //            }\n        //            let result:string = String.valueOf(dest.subSequence(0, dstart)) + filtered + dest.subSequence(dend, dest.length());\n        //            if (\"\".equals(result)) {\n        //                return result;\n        //            }\n        //            let val:number = this._NumberPicker_this.getSelectedPos(result);\n        //            /*\n        //             * Ensure the user can't type in a value greater than the max\n        //             * allowed. We have to allow less than min as the user might\n        //             * want to delete some numbers and then type a new number.\n        //             * And prevent multiple-\"0\" that exceeds the length of upper\n        //             * bound number.\n        //             */\n        //            if (val > this._NumberPicker_this.mMaxValue || result.length() > String.valueOf(this._NumberPicker_this.mMaxValue).length()) {\n        //                return \"\";\n        //            } else {\n        //                return filtered;\n        //            }\n        //        } else {\n        //            let filtered:CharSequence = String.valueOf(source.subSequence(start, end));\n        //            if (TextUtils.isEmpty(filtered)) {\n        //                return \"\";\n        //            }\n        //            let result:string = String.valueOf(dest.subSequence(0, dstart)) + filtered + dest.subSequence(dend, dest.length());\n        //            let str:string = String.valueOf(result).toLowerCase();\n        //            for (let val:string of this._NumberPicker_this.mDisplayedValues) {\n        //                let valLowerCase:string = val.toLowerCase();\n        //                if (valLowerCase.startsWith(str)) {\n        //                    this._NumberPicker_this.postSetSelectionCommand(result.length(), val.length());\n        //                    return val.subSequence(dstart, val.length());\n        //                }\n        //            }\n        //            return \"\";\n        //        }\n        //    }\n        //}\n        export class PressedStateHelper implements Runnable {\n            _NumberPicker_this:NumberPicker;\n            constructor(arg:NumberPicker){\n                this._NumberPicker_this = arg;\n            }\n\n            static BUTTON_INCREMENT:number = 1;\n\n            static BUTTON_DECREMENT:number = 2;\n\n            private MODE_PRESS:number = 1;\n\n            private MODE_TAPPED:number = 2;\n\n            private mManagedButton:number = 0;\n\n            private mMode:number = 0;\n\n            cancel():void  {\n                this.mMode = 0;\n                this.mManagedButton = 0;\n                this._NumberPicker_this.removeCallbacks(this);\n                if (this._NumberPicker_this.mIncrementVirtualButtonPressed) {\n                    this._NumberPicker_this.mIncrementVirtualButtonPressed = false;\n                    this._NumberPicker_this.invalidate(0, this._NumberPicker_this.mBottomSelectionDividerBottom, this._NumberPicker_this.mRight, this._NumberPicker_this.mBottom);\n                }\n                if (this._NumberPicker_this.mDecrementVirtualButtonPressed) {\n                    this._NumberPicker_this.mDecrementVirtualButtonPressed = false;\n                    this._NumberPicker_this.invalidate(0, 0, this._NumberPicker_this.mRight, this._NumberPicker_this.mTopSelectionDividerTop);\n                }\n            }\n\n            buttonPressDelayed(button:number):void  {\n                this.cancel();\n                this.mMode = this.MODE_PRESS;\n                this.mManagedButton = button;\n                this._NumberPicker_this.postDelayed(this, ViewConfiguration.getTapTimeout());\n            }\n\n            buttonTapped(button:number):void  {\n                this.cancel();\n                this.mMode = this.MODE_TAPPED;\n                this.mManagedButton = button;\n                this._NumberPicker_this.post(this);\n            }\n\n            run():void  {\n                switch(this.mMode) {\n                    case this.MODE_PRESS:\n                    {\n                        switch(this.mManagedButton) {\n                            case PressedStateHelper.BUTTON_INCREMENT:\n                            {\n                                this._NumberPicker_this.mIncrementVirtualButtonPressed = true;\n                                this._NumberPicker_this.invalidate(0, this._NumberPicker_this.mBottomSelectionDividerBottom, this._NumberPicker_this.mRight, this._NumberPicker_this.mBottom);\n                            }\n                                break;\n                            case PressedStateHelper.BUTTON_DECREMENT:\n                            {\n                                this._NumberPicker_this.mDecrementVirtualButtonPressed = true;\n                                this._NumberPicker_this.invalidate(0, 0, this._NumberPicker_this.mRight, this._NumberPicker_this.mTopSelectionDividerTop);\n                            }\n                        }\n                    }\n                        break;\n                    case this.MODE_TAPPED:\n                    {\n                        switch(this.mManagedButton) {\n                            case PressedStateHelper.BUTTON_INCREMENT:\n                            {\n                                if (!this._NumberPicker_this.mIncrementVirtualButtonPressed) {\n                                    this._NumberPicker_this.postDelayed(this, ViewConfiguration.getPressedStateDuration());\n                                }\n                                this._NumberPicker_this.mIncrementVirtualButtonPressed = !this._NumberPicker_this.mIncrementVirtualButtonPressed;\n                                this._NumberPicker_this.invalidate(0, this._NumberPicker_this.mBottomSelectionDividerBottom, this._NumberPicker_this.mRight, this._NumberPicker_this.mBottom);\n                            }\n                                break;\n                            case PressedStateHelper.BUTTON_DECREMENT:\n                            {\n                                if (!this._NumberPicker_this.mDecrementVirtualButtonPressed) {\n                                    this._NumberPicker_this.postDelayed(this, ViewConfiguration.getPressedStateDuration());\n                                }\n                                this._NumberPicker_this.mDecrementVirtualButtonPressed = !this._NumberPicker_this.mDecrementVirtualButtonPressed;\n                                this._NumberPicker_this.invalidate(0, 0, this._NumberPicker_this.mRight, this._NumberPicker_this.mTopSelectionDividerTop);\n                            }\n                        }\n                    }\n                        break;\n                }\n            }\n        }\n        /**\n         * Command for setting the input text selection.\n         */\n        export class SetSelectionCommand implements Runnable {\n            _NumberPicker_this:NumberPicker;\n            constructor(arg:NumberPicker){\n                this._NumberPicker_this = arg;\n            }\n\n            private mSelectionStart:number = 0;\n\n            private mSelectionEnd:number = 0;\n\n            run():void  {\n                //this._NumberPicker_this.mInputText.setSelection(this.mSelectionStart, this.mSelectionEnd);\n            }\n        }\n        /**\n         * Command for changing the current value from a long press by one.\n         */\n        export class ChangeCurrentByOneFromLongPressCommand implements Runnable {\n            _NumberPicker_this:NumberPicker;\n            constructor(arg:NumberPicker){\n                this._NumberPicker_this = arg;\n            }\n\n            private mIncrement:boolean;\n\n            setStep(increment:boolean):void  {\n                this.mIncrement = increment;\n            }\n\n            run():void  {\n                this._NumberPicker_this.changeValueByOne(this.mIncrement);\n                this._NumberPicker_this.postDelayed(this, this._NumberPicker_this.mLongPressUpdateInterval);\n            }\n        }\n        /**\n         * @hide\n         */\n        //export class CustomEditText extends EditText {\n        //\n        //    constructor( context:Context, attrs:AttributeSet) {\n        //        super(context, attrs);\n        //    }\n        //\n        //    onEditorAction(actionCode:number):void  {\n        //        super.onEditorAction(actionCode);\n        //        if (actionCode == EditorInfo.IME_ACTION_DONE) {\n        //            this.clearFocus();\n        //        }\n        //    }\n        //}\n        /**\n         * Command for beginning soft input on long press.\n         */\n        export class BeginSoftInputOnLongPressCommand implements Runnable {\n            _NumberPicker_this:NumberPicker;\n            constructor(arg:NumberPicker){\n                this._NumberPicker_this = arg;\n            }\n\n            run():void  {\n                this._NumberPicker_this.showSoftInput();\n                this._NumberPicker_this.mIngonreMoveEvents = true;\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "src/android/widget/OverScroller.ts",
    "content": "/*\n * Copyright (C) 2010 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../view/ViewConfiguration.ts\"/>\n///<reference path=\"../view/animation/Interpolator.ts\"/>\n///<reference path=\"../content/res/Resources.ts\"/>\n///<reference path=\"../os/SystemClock.ts\"/>\n///<reference path=\"../util/Log.ts\"/>\n///<reference path=\"../../androidui/util/NumberChecker.ts\"/>\n\nmodule android.widget{\n    import ViewConfiguration = android.view.ViewConfiguration;\n    import Interpolator = android.view.animation.Interpolator;\n    import Resources = android.content.res.Resources;\n    import SystemClock = android.os.SystemClock;\n    import Log = android.util.Log;\n    import NumberChecker = androidui.util.NumberChecker;\n\n    /**\n     * This class encapsulates scrolling with the ability to overshoot the bounds\n     * of a scrolling operation. This class is a drop-in replacement for\n     * {@link android.widget.Scroller} in most cases.\n     */\n    export class OverScroller{\n        private mMode = 0;\n        private mScrollerX:SplineOverScroller;\n        private mScrollerY:SplineOverScroller;\n        private mInterpolator:Interpolator;\n        private mFlywheel = true;\n\n        static DEFAULT_DURATION = 250;\n        static SCROLL_MODE = 0;\n        static FLING_MODE = 1;\n\n\n        /**\n         * Creates an OverScroller.\n         * @param interpolator The scroll interpolator. If null, a default (viscous) interpolator will\n         * be used.\n         * @param flywheel If true, successive fling motions will keep on increasing scroll speed.\n         * @hide\n         */\n        constructor(interpolator?:Interpolator, flywheel=true) {\n            this.mInterpolator = interpolator;\n            this.mFlywheel = flywheel;\n            this.mScrollerX = new SplineOverScroller();\n            this.mScrollerY = new SplineOverScroller();\n        }\n\n        setInterpolator(interpolator:Interpolator):void  {\n            this.mInterpolator = interpolator;\n        }\n\n        /**\n         * The amount of friction applied to flings. The default value\n         * is {@link ViewConfiguration#getScrollFriction}.\n         *\n         * @param friction A scalar dimension-less value representing the coefficient of\n         *         friction.\n         */\n        setFriction(friction:number) {\n            NumberChecker.warnNotNumber(friction);\n            this.mScrollerX.setFriction(friction);\n            this.mScrollerY.setFriction(friction);\n        }\n        /**\n         *\n         * Returns whether the scroller has finished scrolling.\n         *\n         * @return True if the scroller has finished scrolling, false otherwise.\n         */\n        isFinished():boolean {\n            return this.mScrollerX.mFinished && this.mScrollerY.mFinished;\n        }\n        /**\n         * Force the finished field to a particular value. Contrary to\n         * {@link #abortAnimation()}, forcing the animation to finished\n         * does NOT cause the scroller to move to the final x and y\n         * position.\n         *\n         * @param finished The new finished value.\n         */\n        forceFinished(finished:boolean) {\n            this.mScrollerX.mFinished = this.mScrollerY.mFinished = finished;\n        }\n        /**\n         * Returns the current X offset in the scroll.\n         *\n         * @return The new X offset as an absolute distance from the origin.\n         */\n        getCurrX():number {\n            return this.mScrollerX.mCurrentPosition;\n        }\n        /**\n         * Returns the current Y offset in the scroll.\n         *\n         * @return The new Y offset as an absolute distance from the origin.\n         */\n        getCurrY():number {\n            return this.mScrollerY.mCurrentPosition;\n        }\n        /**\n         * Returns the absolute value of the current velocity.\n         *\n         * @return The original velocity less the deceleration, norm of the X and Y velocity vector.\n         */\n        getCurrVelocity():number {\n            let squaredNorm = this.mScrollerX.mCurrVelocity * this.mScrollerX.mCurrVelocity;\n            squaredNorm += this.mScrollerY.mCurrVelocity * this.mScrollerY.mCurrVelocity;\n            return Math.sqrt(squaredNorm);\n        }\n        /**\n         * Returns the start X offset in the scroll.\n         *\n         * @return The start X offset as an absolute distance from the origin.\n         */\n        getStartX():number {\n            return this.mScrollerX.mStart;\n        }\n        /**\n         * Returns the start Y offset in the scroll.\n         *\n         * @return The start Y offset as an absolute distance from the origin.\n         */\n        getStartY():number {\n            return this.mScrollerY.mStart;\n        }\n        /**\n         * Returns where the scroll will end. Valid only for \"fling\" scrolls.\n         *\n         * @return The final X offset as an absolute distance from the origin.\n         */\n        getFinalX():number {\n            return this.mScrollerX.mFinal;\n        }\n        /**\n         * Returns where the scroll will end. Valid only for \"fling\" scrolls.\n         *\n         * @return The final Y offset as an absolute distance from the origin.\n         */\n        getFinalY():number {\n            return this.mScrollerY.mFinal;\n        }\n\n        /**\n         * Returns how long the scroll event will take, in milliseconds.\n         *\n         * @return The duration of the scroll in milliseconds.\n         *\n         * @hide Pending removal once nothing depends on it\n         * @deprecated OverScrollers don't necessarily have a fixed duration.\n         *             This function will lie to the best of its ability.\n         */\n        getDuration():number {\n            return Math.max(this.mScrollerX.mDuration, this.mScrollerY.mDuration);\n        }\n        //extendDuration(extend:number) {\n        //    this.mScrollerX.extendDuration(extend);\n        //    this.mScrollerY.extendDuration(extend);\n        //}\n        //setFinalX(newX:number) {\n        //    this.mScrollerX.setFinalPosition(newX);\n        //}\n        //setFinalY(newY:number) {\n        //    this.mScrollerY.setFinalPosition(newY);\n        //}\n        /**\n         * Call this when you want to know the new location. If it returns true, the\n         * animation is not yet finished.\n         */\n        computeScrollOffset():boolean {\n            if (this.isFinished()) {\n                return false;\n            }\n\n            switch (this.mMode) {\n                case OverScroller.SCROLL_MODE:\n                    let time = SystemClock.uptimeMillis();\n                    // Any scroller can be used for time, since they were started\n                    // together in scroll mode. We use X here.\n                    const elapsedTime = time - this.mScrollerX.mStartTime;\n\n                    const duration = this.mScrollerX.mDuration;\n                    if (elapsedTime < duration) {\n                        let q = (elapsedTime) / duration;\n\n                        if (this.mInterpolator == null) {\n                            q = Scroller_viscousFluid(q);\n                        } else {\n                            q = this.mInterpolator.getInterpolation(q);\n                        }\n\n                        this.mScrollerX.updateScroll(q);\n                        this.mScrollerY.updateScroll(q);\n                    } else {\n                        this.abortAnimation();\n                    }\n                    break;\n\n                case OverScroller.FLING_MODE:\n                    if (!this.mScrollerX.mFinished) {\n                        if (!this.mScrollerX.update()) {\n                            if (!this.mScrollerX.continueWhenFinished()) {\n                                this.mScrollerX.finish();\n                            }\n                        }\n                    }\n\n                    if (!this.mScrollerY.mFinished) {\n                        if (!this.mScrollerY.update()) {\n                            if (!this.mScrollerY.continueWhenFinished()) {\n                                this.mScrollerY.finish();\n                            }\n                        }\n                    }\n\n                    break;\n            }\n\n            return true;\n        }\n        /**\n         * Start scrolling by providing a starting point and the distance to travel.\n         *\n         * @param startX Starting horizontal scroll offset in pixels. Positive\n         *        numbers will scroll the content to the left.\n         * @param startY Starting vertical scroll offset in pixels. Positive numbers\n         *        will scroll the content up.\n         * @param dx Horizontal distance to travel. Positive numbers will scroll the\n         *        content to the left.\n         * @param dy Vertical distance to travel. Positive numbers will scroll the\n         *        content up.\n         * @param duration Duration of the scroll in milliseconds.\n         */\n        startScroll(startX:number, startY:number, dx:number, dy:number, duration=OverScroller.DEFAULT_DURATION) {\n            NumberChecker.warnNotNumber(startX, startY, dx, dy, duration);\n            this.mMode = OverScroller.SCROLL_MODE;\n            this.mScrollerX.startScroll(startX, dx, duration);\n            this.mScrollerY.startScroll(startY, dy, duration);\n        }\n        /**\n         * Call this when you want to 'spring back' into a valid coordinate range.\n         *\n         * @param startX Starting X coordinate\n         * @param startY Starting Y coordinate\n         * @param minX Minimum valid X value\n         * @param maxX Maximum valid X value\n         * @param minY Minimum valid Y value\n         * @param maxY Minimum valid Y value\n         * @return true if a springback was initiated, false if startX and startY were\n         *          already within the valid range.\n         */\n        springBack(startX:number, startY:number, minX:number, maxX:number, minY:number, maxY:number):boolean {\n            NumberChecker.warnNotNumber(startX, startY, minX, maxX, minY, maxY);\n            this.mMode = OverScroller.FLING_MODE;\n\n            // Make sure both methods are called.\n            const spingbackX = this.mScrollerX.springback(startX, minX, maxX);\n            const spingbackY = this.mScrollerY.springback(startY, minY, maxY);\n            return spingbackX || spingbackY;\n        }\n        /**\n         * Start scrolling based on a fling gesture. The distance traveled will\n         * depend on the initial velocity of the fling.\n         *\n         * @param startX Starting point of the scroll (X)\n         * @param startY Starting point of the scroll (Y)\n         * @param velocityX Initial velocity of the fling (X) measured in pixels per\n         *            second.\n         * @param velocityY Initial velocity of the fling (Y) measured in pixels per\n         *            second\n         * @param minX Minimum X value. The scroller will not scroll past this point\n         *            unless overX > 0. If overfling is allowed, it will use minX as\n         *            a springback boundary.\n         * @param maxX Maximum X value. The scroller will not scroll past this point\n         *            unless overX > 0. If overfling is allowed, it will use maxX as\n         *            a springback boundary.\n         * @param minY Minimum Y value. The scroller will not scroll past this point\n         *            unless overY > 0. If overfling is allowed, it will use minY as\n         *            a springback boundary.\n         * @param maxY Maximum Y value. The scroller will not scroll past this point\n         *            unless overY > 0. If overfling is allowed, it will use maxY as\n         *            a springback boundary.\n         * @param overX Overfling range. If > 0, horizontal overfling in either\n         *            direction will be possible.\n         * @param overY Overfling range. If > 0, vertical overfling in either\n         *            direction will be possible.\n         */\n        fling(startX:number, startY:number, velocityX:number, velocityY:number,\n              minX:number, maxX:number, minY:number, maxY:number, overX=0, overY=0) {\n            NumberChecker.warnNotNumber(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, overX, overY);\n            // Continue a scroll or fling in progress\n            if (this.mFlywheel && !this.isFinished()) {\n                let oldVelocityX = this.mScrollerX.mCurrVelocity;\n                let oldVelocityY = this.mScrollerY.mCurrVelocity;\n                if (Math_signum(velocityX) == Math_signum(oldVelocityX) &&\n                    Math_signum(velocityY) == Math_signum(oldVelocityY)) {\n                    velocityX += oldVelocityX;\n                    velocityY += oldVelocityY;\n                }\n            }\n\n            this.mMode = OverScroller.FLING_MODE;\n            this.mScrollerX.fling(startX, velocityX, minX, maxX, overX);\n            this.mScrollerY.fling(startY, velocityY, minY, maxY, overY);\n        }\n        /**\n         * Notify the scroller that we've reached a horizontal boundary.\n         * Normally the information to handle this will already be known\n         * when the animation is started, such as in a call to one of the\n         * fling functions. However there are cases where this cannot be known\n         * in advance. This function will transition the current motion and\n         * animate from startX to finalX as appropriate.\n         *\n         * @param startX Starting/current X position\n         * @param finalX Desired final X position\n         * @param overX Magnitude of overscroll allowed. This should be the maximum\n         *              desired distance from finalX. Absolute value - must be positive.\n         */\n        notifyHorizontalEdgeReached(startX:number, finalX:number, overX:number) {\n            NumberChecker.warnNotNumber(startX, finalX, overX);\n            this.mScrollerX.notifyEdgeReached(startX, finalX, overX);\n        }\n        /**\n         * Notify the scroller that we've reached a vertical boundary.\n         * Normally the information to handle this will already be known\n         * when the animation is started, such as in a call to one of the\n         * fling functions. However there are cases where this cannot be known\n         * in advance. This function will animate a parabolic motion from\n         * startY to finalY.\n         *\n         * @param startY Starting/current Y position\n         * @param finalY Desired final Y position\n         * @param overY Magnitude of overscroll allowed. This should be the maximum\n         *              desired distance from finalY. Absolute value - must be positive.\n         */\n        notifyVerticalEdgeReached(startY:number, finalY:number, overY:number) {\n            NumberChecker.warnNotNumber(startY, finalY, overY);\n            this.mScrollerY.notifyEdgeReached(startY, finalY, overY);\n        }\n        /**\n         * Returns whether the current Scroller is currently returning to a valid position.\n         * Valid bounds were provided by the\n         * {@link #fling(int, int, int, int, int, int, int, int, int, int)} method.\n         *\n         * One should check this value before calling\n         * {@link #startScroll(int, int, int, int)} as the interpolation currently in progress\n         * to restore a valid position will then be stopped. The caller has to take into account\n         * the fact that the started scroll will start from an overscrolled position.\n         *\n         * @return true when the current position is overscrolled and in the process of\n         *         interpolating back to a valid value.\n         */\n        isOverScrolled():boolean {\n            return ((!this.mScrollerX.mFinished &&\n            this.mScrollerX.mState != SplineOverScroller.SPLINE) ||\n            (!this.mScrollerY.mFinished &&\n            this.mScrollerY.mState != SplineOverScroller.SPLINE));\n        }\n        /**\n         * Stops the animation. Contrary to {@link #forceFinished(boolean)},\n         * aborting the animating causes the scroller to move to the final x and y\n         * positions.\n         *\n         * @see #forceFinished(boolean)\n         */\n        abortAnimation() {\n            this.mScrollerX.finish();\n            this.mScrollerY.finish();\n        }\n        /**\n         * Returns the time elapsed since the beginning of the scrolling.\n         *\n         * @return The elapsed time in milliseconds.\n         *\n         * @hide\n         */\n        timePassed():number {\n            const time = SystemClock.uptimeMillis();\n            const startTime = Math.min(this.mScrollerX.mStartTime, this.mScrollerY.mStartTime);\n            return (time - startTime);\n        }\n        isScrollingInDirection(xvel:number, yvel:number):boolean {\n            const dx = this.mScrollerX.mFinal - this.mScrollerX.mStart;\n            const dy = this.mScrollerY.mFinal - this.mScrollerY.mStart;\n            return !this.isFinished() && Math_signum(xvel) == Math_signum(dx) &&\n            Math_signum(yvel) == Math_signum(dy);\n        }\n\n    }\n\n    class SplineOverScroller{\n        static DECELERATION_RATE = (Math.log(0.78) / Math.log(0.9));\n        static INFLEXION = 0.35; // Tension lines cross at (INFLEXION, 1)\n        static START_TENSION = 0.5;\n        static END_TENSION = 1.0;\n        static P1 = SplineOverScroller.START_TENSION * SplineOverScroller.INFLEXION;\n        static P2 = 1.0 - SplineOverScroller.END_TENSION * (1 - SplineOverScroller.INFLEXION);\n\n        static NB_SAMPLES = 100;\n        static SPLINE_POSITION = androidui.util.ArrayCreator.newNumberArray(SplineOverScroller.NB_SAMPLES + 1);\n        static SPLINE_TIME = androidui.util.ArrayCreator.newNumberArray(SplineOverScroller.NB_SAMPLES + 1);\n\n        static SPLINE = 0;\n        static CUBIC = 1;\n        static BALLISTIC = 2;\n\n        // Initial position\n        mStart = 0;\n\n        // Current position\n        mCurrentPosition = 0;\n\n        // Final position\n        mFinal = 0;\n\n        // Initial velocity\n        mVelocity = 0;\n\n        // Current velocity\n        private _mCurrVelocity = 0;\n        get mCurrVelocity():number{\n            return this._mCurrVelocity;\n        }\n        set mCurrVelocity(value:number){\n            if(!NumberChecker.checkIsNumber(value)){\n                value = 0;\n            }\n            this._mCurrVelocity = value;\n        }\n\n        // Constant current deceleration\n        mDeceleration = 0;\n\n        // Animation starting time, in system milliseconds\n        mStartTime = 0;\n\n        // Animation duration, in milliseconds\n        mDuration = 0;\n\n        // Duration to complete spline component of animation\n        mSplineDuration = 0;\n\n        // Distance to travel along spline animation\n        mSplineDistance = 0;\n\n        // Whether the animation is currently in progress\n        mFinished = false;\n\n        // The allowed overshot distance before boundary is reached.\n        mOver = 0;\n\n        // Fling friction\n        mFlingFriction = ViewConfiguration.getScrollFriction();\n\n        // Current state of the animation.\n        mState = SplineOverScroller.SPLINE;\n\n        // Constant gravity value, used in the deceleration phase.\n        static GRAVITY = 2000;\n\n        // A context-specific coefficient adjusted to physical values.\n        mPhysicalCoeff = 0;\n\n        static _staticFunc = function(){\n            let x_min = 0.0;\n            let y_min = 0.0;\n            for (let i = 0; i < SplineOverScroller.NB_SAMPLES; i++) {\n                const alpha = i / SplineOverScroller.NB_SAMPLES;\n\n                let x_max = 1.0;\n                let x, tx, coef;\n                while (true) {\n                    x = x_min + (x_max - x_min) / 2.0;\n                    coef = 3.0 * x * (1.0 - x);\n                    tx = coef * ((1.0 - x) * SplineOverScroller.P1 + x * SplineOverScroller.P2) + x * x * x;\n                    if (Math.abs(tx - alpha) < 1E-5) break;\n                    if (tx > alpha) x_max = x;\n                    else x_min = x;\n                }\n                SplineOverScroller.SPLINE_POSITION[i] = coef * ((1.0 - x) * SplineOverScroller.START_TENSION + x) + x * x * x;\n\n                let y_max = 1.0;\n                let y, dy;\n                while (true) {\n                    y = y_min + (y_max - y_min) / 2.0;\n                    coef = 3.0 * y * (1.0 - y);\n                    dy = coef * ((1.0 - y) * SplineOverScroller.START_TENSION + y) + y * y * y;\n                    if (Math.abs(dy - alpha) < 1E-5) break;\n                    if (dy > alpha) y_max = y;\n                    else y_min = y;\n                }\n                SplineOverScroller.SPLINE_TIME[i] = coef * ((1.0 - y) * SplineOverScroller.P1 + y * SplineOverScroller.P2) + y * y * y;\n            }\n            SplineOverScroller.SPLINE_POSITION[SplineOverScroller.NB_SAMPLES] = SplineOverScroller.SPLINE_TIME[SplineOverScroller.NB_SAMPLES] = 1.0;\n        }();\n\n        setFriction(friction:number) {\n            this.mFlingFriction = friction;\n        }\n\n        constructor(){\n            this.mFinished = true;\n            let ppi = Resources.getDisplayMetrics().density * 160;\n            this.mPhysicalCoeff = 9.80665 // g (m/s^2)\n                * 39.37 // inch/meter\n                * ppi\n                * 0.84; // look and feel tuning\n        }\n\n        updateScroll(q:number) {\n            this.mCurrentPosition = this.mStart + Math.round(q * (this.mFinal - this.mStart));\n        }\n\n        static getDeceleration(velocity:number) {\n            return velocity > 0 ? -SplineOverScroller.GRAVITY : SplineOverScroller.GRAVITY;\n        }\n\n\n        private adjustDuration(start:number, oldFinal:number, newFinal:number):void {\n            let oldDistance = oldFinal - start;\n            let newDistance = newFinal - start;\n            let x = Math.abs(newDistance / oldDistance);\n            let index = Math.floor(SplineOverScroller.NB_SAMPLES * x);\n            if (index < SplineOverScroller.NB_SAMPLES) {\n                let x_inf = index / SplineOverScroller.NB_SAMPLES;\n                let x_sup = (index + 1) / SplineOverScroller.NB_SAMPLES;\n                let t_inf = SplineOverScroller.SPLINE_TIME[index];\n                let t_sup = SplineOverScroller.SPLINE_TIME[index + 1];\n                let timeCoef = t_inf + (x - x_inf) / (x_sup - x_inf) * (t_sup - t_inf);\n                this.mDuration *= timeCoef;\n            }\n        }\n\n        startScroll(start:number, distance:number, duration:number) {\n            this.mFinished = false;\n\n            this.mStart = start;\n            this.mFinal = start + distance;\n\n            this.mStartTime = SystemClock.uptimeMillis();\n            this.mDuration = duration;\n\n            // Unused\n            this.mDeceleration = 0;\n            this.mVelocity = 0;\n        }\n\n        finish() {\n            this.mCurrentPosition = this.mFinal;\n            this.mFinished = true;\n        }\n\n        setFinalPosition(position:number) {\n            this.mFinal = position;\n            this.mFinished = false;\n        }\n\n        extendDuration(extend:number) {\n            let time = SystemClock.uptimeMillis();\n            let elapsedTime = (time - this.mStartTime);\n            this.mDuration = elapsedTime + extend;\n            this.mFinished = false;\n        }\n\n        springback(start:number, min:number, max:number):boolean {\n            this.mFinished = true;\n\n            this.mStart = this.mFinal = start;\n            this.mVelocity = 0;\n\n            this.mStartTime = SystemClock.uptimeMillis();\n            this.mDuration = 0;\n\n            if (start < min) {\n                this.startSpringback(start, min, 0);\n            } else if (start > max) {\n                this.startSpringback(start, max, 0);\n            }\n\n            return !this.mFinished;\n        }\n        startSpringback(start:number, end:number, velocity:number) {\n            // mStartTime has been set\n            this.mFinished = false;\n            this.mState = SplineOverScroller.CUBIC;\n            this.mStart = start;\n            this.mFinal = end;\n            const delta = start - end;\n            this.mDeceleration = SplineOverScroller.getDeceleration(delta);\n            // TODO take velocity into account\n            this.mVelocity = -delta; // only sign is used\n            this.mOver = Math.abs(delta);\n            const density = android.content.res.Resources.getDisplayMetrics().density;\n            this.mDuration = Math.floor(1000.0 * Math.sqrt(-2.0 * (delta / density) / this.mDeceleration));\n        }\n\n        fling(start:number, velocity:number, min:number, max:number, over:number) {\n            this.mOver = over;\n            this.mFinished = false;\n            this.mCurrVelocity = this.mVelocity = velocity;\n            this.mDuration = this.mSplineDuration = 0;\n            this.mStartTime = SystemClock.uptimeMillis();\n            this.mCurrentPosition = this.mStart = start;\n\n            if (start > max || start < min) {\n                this.startAfterEdge(start, min, max, velocity);\n                return;\n            }\n\n            this.mState = SplineOverScroller.SPLINE;\n            let totalDistance = 0.0;\n\n            if (velocity != 0) {\n                this.mDuration = this.mSplineDuration = this.getSplineFlingDuration(velocity);\n                totalDistance = this.getSplineFlingDistance(velocity);\n            }\n\n            this.mSplineDistance = (totalDistance * Math_signum(velocity));\n            this.mFinal = start + this.mSplineDistance;\n\n            // Clamp to a valid final position\n            if (this.mFinal < min) {\n                this.adjustDuration(this.mStart, this.mFinal, min);\n                this.mFinal = min;\n            }\n\n            if (this.mFinal > max) {\n                this.adjustDuration(this.mStart, this.mFinal, max);\n                this.mFinal = max;\n            }\n        }\n\n        getSplineDeceleration(velocity:number):number {\n            return Math.log(SplineOverScroller.INFLEXION * Math.abs(velocity) / (this.mFlingFriction * this.mPhysicalCoeff));\n        }\n\n        getSplineFlingDistance(velocity:number):number {\n            let l = this.getSplineDeceleration(velocity);\n            let decelMinusOne = SplineOverScroller.DECELERATION_RATE - 1.0;\n            return this.mFlingFriction * this.mPhysicalCoeff * Math.exp(SplineOverScroller.DECELERATION_RATE / decelMinusOne * l);\n        }\n        getSplineFlingDuration(velocity:number):number {\n            let l = this.getSplineDeceleration(velocity);\n            let decelMinusOne = SplineOverScroller.DECELERATION_RATE - 1.0;\n            return (1000.0 * Math.exp(l / decelMinusOne));\n        }\n\n        fitOnBounceCurve(start:number, end:number, velocity:number) {\n            // Simulate a bounce that started from edge\n            let durationToApex = - velocity / this.mDeceleration;\n            let distanceToApex = velocity * velocity / 2.0 / Math.abs(this.mDeceleration);\n            let distanceToEdge = Math.abs(end - start);\n            let totalDuration = Math.sqrt(\n            2.0 * (distanceToApex + distanceToEdge) / Math.abs(this.mDeceleration));\n            this.mStartTime -= (1000 * (totalDuration - durationToApex));\n            this.mStart = end;\n            this.mVelocity = (- this.mDeceleration * totalDuration);\n        }\n        startBounceAfterEdge(start:number, end:number, velocity:number) {\n            this.mDeceleration = SplineOverScroller.getDeceleration(velocity == 0 ? start - end : velocity);\n            this.fitOnBounceCurve(start, end, velocity);\n            this.onEdgeReached();\n        }\n        startAfterEdge(start:number, min:number, max:number, velocity:number) {\n            if (start > min && start < max) {\n                Log.e(\"OverScroller\", \"startAfterEdge called from a valid position\");\n                this.mFinished = true;\n                return;\n            }\n            const positive = start > max;\n            const edge = positive ? max : min;\n            const overDistance = start - edge;\n            let keepIncreasing = overDistance * velocity >= 0;\n            if (keepIncreasing) {\n                // Will result in a bounce or a to_boundary depending on velocity.\n                this.startBounceAfterEdge(start, edge, velocity);\n            } else {\n                const totalDistance = this.getSplineFlingDistance(velocity);\n                if (totalDistance > Math.abs(overDistance)) {\n                    this.fling(start, velocity, positive ? min : start, positive ? start : max, this.mOver);\n                } else {\n                    this.startSpringback(start, edge, velocity);\n                }\n            }\n        }\n\n        notifyEdgeReached(start:number, end:number, over:number) {\n            // mState is used to detect successive notifications\n            if (this.mState == SplineOverScroller.SPLINE) {\n                this.mOver = over;\n                this.mStartTime = SystemClock.uptimeMillis();\n                // We were in fling/scroll mode before: current velocity is such that distance to\n                // edge is increasing. This ensures that startAfterEdge will not start a new fling.\n                this.startAfterEdge(start, end, end, this.mCurrVelocity);\n            }\n        }\n\n        onEdgeReached() {\n            // mStart, mVelocity and mStartTime were adjusted to their values when edge was reached.\n            let distance = this.mVelocity * this.mVelocity / (2 * Math.abs(this.mDeceleration));\n            const sign = Math_signum(this.mVelocity);\n\n            if (distance > this.mOver) {\n                // Default deceleration is not sufficient to slow us down before boundary\n                this.mDeceleration = - sign * this.mVelocity * this.mVelocity / (2.0 * this.mOver);\n                distance = this.mOver;\n            }\n\n            this.mOver = distance;\n            this.mState = SplineOverScroller.BALLISTIC;\n            this.mFinal = this.mStart + (this.mVelocity > 0 ? distance : -distance);\n            this.mDuration = - (1000 * this.mVelocity / this.mDeceleration);\n        }\n\n        continueWhenFinished():boolean {\n            switch (this.mState) {\n                case SplineOverScroller.SPLINE:\n                    // Duration from start to null velocity\n                    if (this.mDuration < this.mSplineDuration) {\n                        // If the animation was clamped, we reached the edge\n                        this.mStart = this.mFinal;\n                        // TODO Better compute speed when edge was reached\n                        this.mVelocity = this.mCurrVelocity;\n                        this.mDeceleration = SplineOverScroller.getDeceleration(this.mVelocity);\n                        this.mStartTime += this.mDuration;\n                        this.onEdgeReached();\n                    } else {\n                        // Normal stop, no need to continue\n                        return false;\n                    }\n                    break;\n                case SplineOverScroller.BALLISTIC:\n                    this.mStartTime += this.mDuration;\n                    this.startSpringback(this.mFinal, this.mStart, 0);\n                    break;\n                case SplineOverScroller.CUBIC:\n                    return false;\n            }\n\n            this.update();\n            return true;\n        }\n\n        update():boolean {\n            const time = SystemClock.uptimeMillis();\n            const currentTime = time - this.mStartTime;\n\n            if (currentTime > this.mDuration) {\n                return false;\n            }\n\n            let distance = 0;\n            switch (this.mState) {\n                case SplineOverScroller.SPLINE: {\n                    const t = currentTime / this.mSplineDuration;\n                    const index = Math.floor(SplineOverScroller.NB_SAMPLES * t);\n                    let distanceCoef = 1;\n                    let velocityCoef = 0;\n                    if (index < SplineOverScroller.NB_SAMPLES) {\n                        const t_inf = index / SplineOverScroller.NB_SAMPLES;\n                        const t_sup = (index + 1) / SplineOverScroller.NB_SAMPLES;\n                        const d_inf = SplineOverScroller.SPLINE_POSITION[index];\n                        const d_sup = SplineOverScroller.SPLINE_POSITION[index + 1];\n                        velocityCoef = (d_sup - d_inf) / (t_sup - t_inf);\n                        distanceCoef = d_inf + (t - t_inf) * velocityCoef;\n                    }\n\n                    distance = distanceCoef * this.mSplineDistance;\n                    this.mCurrVelocity = velocityCoef * this.mSplineDistance / this.mSplineDuration * 1000;\n                    break;\n                }\n\n                case SplineOverScroller.BALLISTIC: {\n                    const t = currentTime / 1000;\n                    this.mCurrVelocity = this.mVelocity + this.mDeceleration * t;\n                    distance = this.mVelocity * t + this.mDeceleration * t * t / 2;\n                    break;\n                }\n\n                case SplineOverScroller.CUBIC: {\n                    const t = (currentTime) / this.mDuration;\n                    const t2 = t * t;\n                    const sign = Math_signum(this.mVelocity);\n                    distance = sign * this.mOver * (3 * t2 - 2 * t * t2);\n                    this.mCurrVelocity = sign * this.mOver * 6 * (- t + t2);\n                    break;\n                }\n            }\n\n            this.mCurrentPosition = this.mStart + Math.round(distance);\n\n            return true;\n        }\n\n    }\n\n\n    function Math_signum(value:number):number{\n        if(value === 0 || Number.isNaN(value)) return value;\n        return Math.abs(value)===value ? 1 : -1;\n    }\n\n    let sViscousFluidScale = 8;\n    // must be set to 1.0 (used in viscousFluid())\n    let sViscousFluidNormalize = 1;\n    function Scroller_viscousFluid(x:number):number{\n        x *= sViscousFluidScale;\n        if (x < 1) {\n            x -= (1 - Math.exp(-x));\n        } else {\n            let start = 0.36787944117;   // 1/e == exp(-1)\n            x = 1 - Math.exp(1 - x);\n            x = start + x * (1 - start);\n        }\n        x *= sViscousFluidNormalize;\n        return x;\n    }\n    sViscousFluidNormalize = 1 / Scroller_viscousFluid(1);\n}"
  },
  {
    "path": "src/android/widget/PopupWindow.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/content/res/Resources.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n///<reference path=\"../../android/graphics/PixelFormat.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/graphics/drawable/StateListDrawable.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/view/ViewTreeObserver.ts\"/>\n///<reference path=\"../../android/view/Window.ts\"/>\n///<reference path=\"../../android/view/WindowManager.ts\"/>\n///<reference path=\"../../android/view/animation/Animation.ts\"/>\n///<reference path=\"../../java/lang/ref/WeakReference.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../android/widget/FrameLayout.ts\"/>\n///<reference path=\"../../android/widget/Spinner.ts\"/>\n///<reference path=\"../../android/widget/TextView.ts\"/>\n///<reference path=\"../../android/R/attr.ts\"/>\n///<reference path=\"../../android/R/anim.ts\"/>\n\nmodule android.widget {\nimport R = android.R;\nimport Resources = android.content.res.Resources;\nimport Context = android.content.Context;\nimport PixelFormat = android.graphics.PixelFormat;\nimport Rect = android.graphics.Rect;\nimport Drawable = android.graphics.drawable.Drawable;\nimport StateListDrawable = android.graphics.drawable.StateListDrawable;\nimport Gravity = android.view.Gravity;\nimport KeyEvent = android.view.KeyEvent;\nimport MotionEvent = android.view.MotionEvent;\nimport View = android.view.View;\nimport OnTouchListener = android.view.View.OnTouchListener;\nimport ViewGroup = android.view.ViewGroup;\nimport ViewTreeObserver = android.view.ViewTreeObserver;\nimport OnScrollChangedListener = android.view.ViewTreeObserver.OnScrollChangedListener;\nimport WindowManager = android.view.WindowManager;\nimport Window = android.view.Window;\nimport Animation = android.view.animation.Animation;\nimport WeakReference = java.lang.ref.WeakReference;\nimport Integer = java.lang.Integer;\nimport FrameLayout = android.widget.FrameLayout;\nimport Spinner = android.widget.Spinner;\nimport TextView = android.widget.TextView;\n    import AnimationUtils = android.view.animation.AnimationUtils;\n/**\n * <p>A popup window that can be used to display an arbitrary view. The popup\n * window is a floating container that appears on top of the current\n * activity.</p>\n * \n * @see android.widget.AutoCompleteTextView\n * @see android.widget.Spinner\n */\nexport class PopupWindow implements Window.Callback{\n\n    /**\n     * Mode for {@link #setInputMethodMode(int)}: the requirements for the\n     * input method should be based on the focusability of the popup.  That is\n     * if it is focusable than it needs to work with the input method, else\n     * it doesn't.\n     */\n    static INPUT_METHOD_FROM_FOCUSABLE:number = 0;\n\n    /**\n     * Mode for {@link #setInputMethodMode(int)}: this popup always needs to\n     * work with an input method, regardless of whether it is focusable.  This\n     * means that it will always be displayed so that the user can also operate\n     * the input method while it is shown.\n     */\n    static INPUT_METHOD_NEEDED:number = 1;\n\n    /**\n     * Mode for {@link #setInputMethodMode(int)}: this popup never needs to\n     * work with an input method, regardless of whether it is focusable.  This\n     * means that it will always be displayed to use as much space on the\n     * screen as needed, regardless of whether this covers the input method.\n     */\n    static INPUT_METHOD_NOT_NEEDED:number = 2;\n\n    private static DEFAULT_ANCHORED_GRAVITY:number = Gravity.TOP | Gravity.START;\n\n    private mContext:Context;\n\n    private mWindowManager:WindowManager;\n\n    private mIsShowing:boolean;\n\n    private mIsDropdown:boolean;\n\n    private mContentView:View;\n\n    private mPopupView:View;\n    private mPopupWindow:Window;\n\n    private mFocusable:boolean;\n\n    private mInputMethodMode:number = PopupWindow.INPUT_METHOD_FROM_FOCUSABLE;\n\n    //private mSoftInputMode:number = WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED;\n\n    private mTouchable:boolean = true;\n\n    private mOutsideTouchable:boolean = false;\n\n    //private mClippingEnabled:boolean = true;\n\n    private mSplitTouchEnabled:number = -1;\n\n    //private mLayoutInScreen:boolean;\n\n    private mClipToScreen:boolean;\n\n    private mAllowScrollingAnchorParent:boolean = true;\n\n    //private mLayoutInsetDecor:boolean = false;\n\n    private mNotTouchModal:boolean;\n\n    private mTouchInterceptor:OnTouchListener;\n\n    private mWidthMode:number;\n\n    private mWidth:number;\n\n    private mLastWidth:number;\n\n    private mHeightMode:number;\n\n    private mHeight:number;\n\n    private mLastHeight:number;\n\n    private mPopupWidth:number;\n\n    private mPopupHeight:number;\n\n    private mDrawingLocation:number[] = [0, 0];\n\n    private mScreenLocation:number[] = [0, 0];\n\n    private mTempRect:Rect = new Rect();\n\n    private mBackground:Drawable;\n\n    private mAboveAnchorBackgroundDrawable:Drawable;\n\n    private mBelowAnchorBackgroundDrawable:Drawable;\n\n    private mAboveAnchor:boolean;\n\n    private mWindowLayoutType:number = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;\n\n    private mOnDismissListener:PopupWindow.OnDismissListener;\n\n    //private mIgnoreCheekPress:boolean = false;\n\n    private mDefaultDropdownAboveEnterAnimation = R.anim.grow_fade_in_from_bottom;\n    private mDefaultDropdownBelowEnterAnimation = R.anim.grow_fade_in;\n    private mDefaultDropdownAboveExitAnimation = R.anim.shrink_fade_out_from_bottom;\n    private mDefaultDropdownBelowExitAnimation = R.anim.shrink_fade_out;\n    private mEnterAnimation:Animation;\n    private mExitAnimation:Animation;\n\n    //private static ABOVE_ANCHOR_STATE_SET:number[] =  [ com.android.internal.R.attr.state_above_anchor ];\n\n    private mAnchor:WeakReference<View>;\n\n    private mOnScrollChangedListener:ViewTreeObserver.OnScrollChangedListener = (()=>{\n        const inner_this=this;\n        class _Inner implements ViewTreeObserver.OnScrollChangedListener {\n            onScrollChanged():void  {\n                let anchor:View = inner_this.mAnchor != null ? inner_this.mAnchor.get() : null;\n                if (anchor != null && inner_this.mPopupView != null) {\n                    let p:WindowManager.LayoutParams = <WindowManager.LayoutParams> inner_this.mPopupView.getLayoutParams();\n                    inner_this.updateAboveAnchor(inner_this.findDropDownPosition(anchor, p, inner_this.mAnchorXoff, inner_this.mAnchorYoff, inner_this.mAnchoredGravity));\n                    inner_this.update(p.x, p.y, -1, -1, true);\n                }\n            }\n        }\n        return new _Inner();\n    })();\n\n    private mAnchorXoff:number;\n    private mAnchorYoff:number;\n    private mAnchoredGravity:number;\n\n    private mPopupViewInitialLayoutDirectionInherited:boolean;\n\n\n    /**\n     * <p>Create a new popup window which can display the <tt>contentView</tt>.\n     * The dimension of the window must be passed to this constructor.</p>\n     *\n     * <p>The popup does not provide any background. This should be handled\n     * by the content view.</p>\n     *\n     * @param contentView the popup's content\n     * @param width the popup's width\n     * @param height the popup's height\n     * @param focusable true if the popup can be focused, false otherwise\n     */\n    constructor(contentView:View, width?:number, height?:number, focusable?:boolean);\n    /**\n     * <p>Create a new, empty, non focusable popup window of dimension (0,0).</p>\n     * \n     * <p>The popup does not provide a background.</p>\n     */\n     constructor(context:Context, styleAttr?:Map<string, string>);\n     constructor(...args) {\n         if(args[0] instanceof Context) {\n             let context = <Context>args[0];\n             let styleAttr = args.length==1 ? R.attr.popupWindowStyle : args[1];\n\n             this.mContext = context;\n             this.mWindowManager = context.getWindowManager();//<WindowManager> context.getSystemService(Context.WINDOW_SERVICE);\n             this.mPopupWindow = new Window(context);\n             this.mPopupWindow.setCallback(this);\n             let a = context.obtainStyledAttributes(null, styleAttr);\n             this.mBackground = a.getDrawable('popupBackground');\n             this.mEnterAnimation = AnimationUtils.loadAnimation(context, a.getAttrValue('popupEnterAnimation'));\n             this.mExitAnimation = AnimationUtils.loadAnimation(context, a.getAttrValue('popupExitAnimation'));\n\n             // at least one other drawable, intended for the 'below-anchor state'.\n             //if (this.mBackground instanceof StateListDrawable) {\n             //    let background:StateListDrawable = <StateListDrawable> this.mBackground;\n             //    // Find the above-anchor view - this one's easy, it should be labeled as such.\n             //    let aboveAnchorStateIndex:number = background.getStateDrawableIndex(PopupWindow.ABOVE_ANCHOR_STATE_SET);\n             //    // Now, for the below-anchor view, look for any other drawable specified in the\n             //    // StateListDrawable which is not for the above-anchor state and use that.\n             //    let count:number = background.getStateCount();\n             //    let belowAnchorStateIndex:number = -1;\n             //    for (let i:number = 0; i < count; i++) {\n             //        if (i != aboveAnchorStateIndex) {\n             //            belowAnchorStateIndex = i;\n             //            break;\n             //        }\n             //    }\n             //    // to null so that we'll just use refreshDrawableState.\n             //    if (aboveAnchorStateIndex != -1 && belowAnchorStateIndex != -1) {\n             //        this.mAboveAnchorBackgroundDrawable = background.getStateDrawable(aboveAnchorStateIndex);\n             //        this.mBelowAnchorBackgroundDrawable = background.getStateDrawable(belowAnchorStateIndex);\n             //    } else {\n             //        this.mBelowAnchorBackgroundDrawable = null;\n             //        this.mAboveAnchorBackgroundDrawable = null;\n             //    }\n             //}\n             //a.recycle();\n         }else{\n             let [contentView=null, width=0, height=0, focusable=false] = args;\n\n             if (contentView != null) {\n                 this.mContext = contentView.getContext();\n                 this.mWindowManager = this.mContext.getWindowManager();//<WindowManager> this.mContext.getSystemService(Context.WINDOW_SERVICE);\n                 this.mPopupWindow = new Window(this.mContext);\n                 this.mPopupWindow.setCallback(this);\n             }\n             this.setContentView(contentView);\n             this.setWidth(width);\n             this.setHeight(height);\n             this.setFocusable(focusable);\n         }\n    }\n\n\n\n    /**\n     * <p>Return the drawable used as the popup window's background.</p>\n     *\n     * @return the background drawable or null\n     */\n    getBackground():Drawable  {\n        return this.mBackground;\n    }\n\n    /**\n     * <p>Change the background drawable for this popup window. The background\n     * can be set to null.</p>\n     *\n     * @param background the popup's background\n     */\n    setBackgroundDrawable(background:Drawable):void  {\n        this.mBackground = background;\n    }\n\n    /**\n     * <p>Return the animation style to use the popup appears</p>\n     */\n    getEnterAnimation():Animation  {\n        return this.mEnterAnimation;\n    }\n    /**\n     * <p>Return the animation style to use the popup appears</p>\n     */\n    getExitAnimation():Animation  {\n        return this.mExitAnimation;\n    }\n\n    ///**\n    // * Set the flag on popup to ignore cheek press eventt; by default this flag\n    // * is set to false\n    // * which means the pop wont ignore cheek press dispatch events.\n    // *\n    // * <p>If the popup is showing, calling this method will take effect only\n    // * the next time the popup is shown or through a manual call to one of\n    // * the {@link #update()} methods.</p>\n    // *\n    // * @see #update()\n    // */\n    //setIgnoreCheekPress():void  {\n    //    this.mIgnoreCheekPress = true;\n    //}\n\n    /**\n     * <p>Change the animation style resource for this popup.</p>\n     *\n     * <p>If the popup is showing, calling this method will take effect only\n     * the next time the popup is shown or through a manual call to one of\n     * the {@link #update()} methods.</p>\n     *\n     * @param animationStyle animation style to use when the popup appears\n     *      and disappears.  Set to -1 for the default animation, 0 for no\n     *      animation, or a resource identifier for an explicit animation.\n     *      \n     * @see #update()\n     */\n    setWindowAnimation(enterAnimation:Animation, exitAnimation:Animation):void  {\n        this.mEnterAnimation = enterAnimation;\n        this.mExitAnimation = exitAnimation;\n    }\n\n    /**\n     * <p>Return the view used as the content of the popup window.</p>\n     *\n     * @return a {@link android.view.View} representing the popup's content\n     *\n     * @see #setContentView(android.view.View)\n     */\n    getContentView():View  {\n        return this.mContentView;\n    }\n\n    /**\n     * <p>Change the popup's content. The content is represented by an instance\n     * of {@link android.view.View}.</p>\n     *\n     * <p>This method has no effect if called when the popup is showing.</p>\n     *\n     * @param contentView the new content for the popup\n     *\n     * @see #getContentView()\n     * @see #isShowing()\n     */\n    setContentView(contentView:View):void  {\n        if (this.isShowing()) {\n            return;\n        }\n        this.mContentView = contentView;\n        if (this.mContext == null && this.mContentView != null) {\n            this.mContext = this.mContentView.getContext();\n        }\n        if (this.mWindowManager == null && this.mContentView != null) {\n            this.mWindowManager = this.mContext.getWindowManager();//<WindowManager> this.mContext.getSystemService(Context.WINDOW_SERVICE);\n        }\n        if(this.mPopupWindow==null && this.mContext!=null){\n            this.mPopupWindow = new Window(this.mContext);\n            this.mPopupWindow.setCallback(this);\n        }\n    }\n\n    /**\n     * Set a callback for all touch events being dispatched to the popup\n     * window.\n     */\n    setTouchInterceptor(l:OnTouchListener):void  {\n        this.mTouchInterceptor = l;\n    }\n\n    /**\n     * <p>Indicate whether the popup window can grab the focus.</p>\n     *\n     * @return true if the popup is focusable, false otherwise\n     *\n     * @see #setFocusable(boolean)\n     */\n    isFocusable():boolean  {\n        return this.mFocusable;\n    }\n\n    /**\n     * <p>Changes the focusability of the popup window. When focusable, the\n     * window will grab the focus from the current focused widget if the popup\n     * contains a focusable {@link android.view.View}.  By default a popup\n     * window is not focusable.</p>\n     *\n     * <p>If the popup is showing, calling this method will take effect only\n     * the next time the popup is shown or through a manual call to one of\n     * the {@link #update()} methods.</p>\n     *\n     * @param focusable true if the popup should grab focus, false otherwise.\n     *\n     * @see #isFocusable()\n     * @see #isShowing() \n     * @see #update()\n     */\n    setFocusable(focusable:boolean):void  {\n        this.mFocusable = focusable;\n    }\n\n    /**\n     * Return the current value in {@link #setInputMethodMode(int)}.\n     * \n     * @see #setInputMethodMode(int)\n     */\n    getInputMethodMode():number  {\n        return this.mInputMethodMode;\n    }\n\n    /**\n     * Control how the popup operates with an input method: one of\n     * {@link #INPUT_METHOD_FROM_FOCUSABLE}, {@link #INPUT_METHOD_NEEDED},\n     * or {@link #INPUT_METHOD_NOT_NEEDED}.\n     * \n     * <p>If the popup is showing, calling this method will take effect only\n     * the next time the popup is shown or through a manual call to one of\n     * the {@link #update()} methods.</p>\n     * \n     * @see #getInputMethodMode()\n     * @see #update()\n     */\n    setInputMethodMode(mode:number):void  {\n        this.mInputMethodMode = mode;\n    }\n\n    ///**\n    // * Sets the operating mode for the soft input area.\n    // *\n    // * @param mode The desired mode, see\n    // *        {@link android.view.WindowManager.LayoutParams#softInputMode}\n    // *        for the full list\n    // *\n    // * @see android.view.WindowManager.LayoutParams#softInputMode\n    // * @see #getSoftInputMode()\n    // */\n    //setSoftInputMode(mode:number):void  {\n    //    this.mSoftInputMode = mode;\n    //}\n    //\n    ///**\n    // * Returns the current value in {@link #setSoftInputMode(int)}.\n    // *\n    // * @see #setSoftInputMode(int)\n    // * @see android.view.WindowManager.LayoutParams#softInputMode\n    // */\n    //getSoftInputMode():number  {\n    //    return this.mSoftInputMode;\n    //}\n\n    /**\n     * <p>Indicates whether the popup window receives touch events.</p>\n     * \n     * @return true if the popup is touchable, false otherwise\n     * \n     * @see #setTouchable(boolean)\n     */\n    isTouchable():boolean  {\n        return this.mTouchable;\n    }\n\n    /**\n     * <p>Changes the touchability of the popup window. When touchable, the\n     * window will receive touch events, otherwise touch events will go to the\n     * window below it. By default the window is touchable.</p>\n     *\n     * <p>If the popup is showing, calling this method will take effect only\n     * the next time the popup is shown or through a manual call to one of\n     * the {@link #update()} methods.</p>\n     *\n     * @param touchable true if the popup should receive touch events, false otherwise\n     *\n     * @see #isTouchable()\n     * @see #isShowing() \n     * @see #update()\n     */\n    setTouchable(touchable:boolean):void  {\n        this.mTouchable = touchable;\n    }\n\n    /**\n     * <p>Indicates whether the popup window will be informed of touch events\n     * outside of its window.</p>\n     *\n     * @return true if the popup is outside touchable, false otherwise\n     *\n     * @see #setOutsideTouchable(boolean)\n     */\n    isOutsideTouchable():boolean  {\n        return this.mOutsideTouchable;\n    }\n\n    /**\n     * <p>Controls whether the pop-up will be informed of touch events outside\n     * of its window.  This only makes sense for pop-ups that are touchable\n     * but not focusable, which means touches outside of the window will\n     * be delivered to the window behind.  The default is false.</p>\n     *\n     * <p>If the popup is showing, calling this method will take effect only\n     * the next time the popup is shown or through a manual call to one of\n     * the {@link #update()} methods.</p>\n     *\n     * @param touchable true if the popup should receive outside\n     * touch events, false otherwise\n     *\n     * @see #isOutsideTouchable()\n     * @see #isShowing()\n     * @see #update()\n     */\n    setOutsideTouchable(touchable:boolean):void  {\n        this.mOutsideTouchable = touchable;\n    }\n\n    ///**\n    // * <p>Indicates whether clipping of the popup window is enabled.</p>\n    // *\n    // * @return true if the clipping is enabled, false otherwise\n    // *\n    // * @see #setClippingEnabled(boolean)\n    // */\n    //isClippingEnabled():boolean  {\n    //    return this.mClippingEnabled;\n    //}\n    //\n    ///**\n    // * <p>Allows the popup window to extend beyond the bounds of the screen. By default the\n    // * window is clipped to the screen boundaries. Setting this to false will allow windows to be\n    // * accurately positioned.</p>\n    // *\n    // * <p>If the popup is showing, calling this method will take effect only\n    // * the next time the popup is shown or through a manual call to one of\n    // * the {@link #update()} methods.</p>\n    // *\n    // * @param enabled false if the window should be allowed to extend outside of the screen\n    // * @see #isShowing()\n    // * @see #isClippingEnabled()\n    // * @see #update()\n    // */\n    //setClippingEnabled(enabled:boolean):void  {\n    //    this.mClippingEnabled = enabled;\n    //}\n\n    /**\n     * Clip this popup window to the screen, but not to the containing window.\n     *\n     * @param enabled True to clip to the screen.\n     * @hide\n     */\n    setClipToScreenEnabled(enabled:boolean):void  {\n        this.mClipToScreen = enabled;\n        //this.setClippingEnabled(!enabled);\n    }\n\n    /**\n     * Allow PopupWindow to scroll the anchor's parent to provide more room\n     * for the popup. Enabled by default.\n     *\n     * @param enabled True to scroll the anchor's parent when more room is desired by the popup.\n     */\n    private setAllowScrollingAnchorParent(enabled:boolean):void  {\n        this.mAllowScrollingAnchorParent = enabled;\n    }\n\n    /**\n     * <p>Indicates whether the popup window supports splitting touches.</p>\n     * \n     * @return true if the touch splitting is enabled, false otherwise\n     * \n     * @see #setSplitTouchEnabled(boolean)\n     */\n    isSplitTouchEnabled():boolean  {\n        if (this.mSplitTouchEnabled < 0 && this.mContext != null) {\n            return true;//this.mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.HONEYCOMB;\n        }\n        return this.mSplitTouchEnabled == 1;\n    }\n\n    /**\n     * <p>Allows the popup window to split touches across other windows that also\n     * support split touch.  When this flag is false, the first pointer\n     * that goes down determines the window to which all subsequent touches\n     * go until all pointers go up.  When this flag is true, each pointer\n     * (not necessarily the first) that goes down determines the window\n     * to which all subsequent touches of that pointer will go until that\n     * pointer goes up thereby enabling touches with multiple pointers\n     * to be split across multiple windows.</p>\n     *\n     * @param enabled true if the split touches should be enabled, false otherwise\n     * @see #isSplitTouchEnabled()\n     */\n    setSplitTouchEnabled(enabled:boolean):void  {\n        this.mSplitTouchEnabled = enabled ? 1 : 0;\n    }\n\n    ///**\n    // * <p>Indicates whether the popup window will be forced into using absolute screen coordinates\n    // * for positioning.</p>\n    // *\n    // * @return true if the window will always be positioned in screen coordinates.\n    // * @hide\n    // */\n    //isLayoutInScreenEnabled():boolean  {\n    //    return this.mLayoutInScreen;\n    //}\n    //\n    ///**\n    // * <p>Allows the popup window to force the flag\n    // * {@link WindowManager.LayoutParams#FLAG_LAYOUT_IN_SCREEN}, overriding default behavior.\n    // * This will cause the popup to be positioned in absolute screen coordinates.</p>\n    // *\n    // * @param enabled true if the popup should always be positioned in screen coordinates\n    // * @hide\n    // */\n    //setLayoutInScreenEnabled(enabled:boolean):void  {\n    //    this.mLayoutInScreen = enabled;\n    //}\n\n    ///**\n    // * Allows the popup window to force the flag\n    // * {@link WindowManager.LayoutParams#FLAG_LAYOUT_INSET_DECOR}, overriding default behavior.\n    // * This will cause the popup to inset its content to account for system windows overlaying\n    // * the screen, such as the status bar.\n    // *\n    // * <p>This will often be combined with {@link #setLayoutInScreenEnabled(boolean)}.\n    // *\n    // * @param enabled true if the popup's views should inset content to account for system windows,\n    // *                the way that decor views behave for full-screen windows.\n    // * @hide\n    // */\n    //setLayoutInsetDecor(enabled:boolean):void  {\n    //    this.mLayoutInsetDecor = enabled;\n    //}\n\n    /**\n     * Set the layout type for this window. Should be one of the TYPE constants defined in\n     * {@link WindowManager.LayoutParams}.\n     *\n     * @param layoutType Layout type for this window.\n     * @hide\n     */\n    setWindowLayoutType(layoutType:number):void  {\n        this.mWindowLayoutType = layoutType;\n    }\n\n    /**\n     * @return The layout type for this window.\n     * @hide\n     */\n    getWindowLayoutType():number  {\n        return this.mWindowLayoutType;\n    }\n\n    /**\n     * Set whether this window is touch modal or if outside touches will be sent to\n     * other windows behind it.\n     * @hide\n     */\n    setTouchModal(touchModal:boolean):void  {\n        this.mNotTouchModal = !touchModal;\n    }\n\n    /**\n     * <p>Change the width and height measure specs that are given to the\n     * window manager by the popup.  By default these are 0, meaning that\n     * the current width or height is requested as an explicit size from\n     * the window manager.  You can supply\n     * {@link ViewGroup.LayoutParams#WRAP_CONTENT} or \n     * {@link ViewGroup.LayoutParams#MATCH_PARENT} to have that measure\n     * spec supplied instead, replacing the absolute width and height that\n     * has been set in the popup.</p>\n     *\n     * <p>If the popup is showing, calling this method will take effect only\n     * the next time the popup is shown.</p>\n     *\n     * @param widthSpec an explicit width measure spec mode, either\n     * {@link ViewGroup.LayoutParams#WRAP_CONTENT},\n     * {@link ViewGroup.LayoutParams#MATCH_PARENT}, or 0 to use the absolute\n     * width.\n     * @param heightSpec an explicit height measure spec mode, either\n     * {@link ViewGroup.LayoutParams#WRAP_CONTENT},\n     * {@link ViewGroup.LayoutParams#MATCH_PARENT}, or 0 to use the absolute\n     * height.\n     */\n    setWindowLayoutMode(widthSpec:number, heightSpec:number):void  {\n        this.mWidthMode = widthSpec;\n        this.mHeightMode = heightSpec;\n    }\n\n    /**\n     * <p>Return this popup's height MeasureSpec</p>\n     *\n     * @return the height MeasureSpec of the popup\n     *\n     * @see #setHeight(int)\n     */\n    getHeight():number  {\n        return this.mHeight;\n    }\n\n    /**\n     * <p>Change the popup's height MeasureSpec</p>\n     *\n     * <p>If the popup is showing, calling this method will take effect only\n     * the next time the popup is shown.</p>\n     *\n     * @param height the height MeasureSpec of the popup\n     *\n     * @see #getHeight()\n     * @see #isShowing() \n     */\n    setHeight(height:number):void  {\n        this.mHeight = height;\n    }\n\n    /**\n     * <p>Return this popup's width MeasureSpec</p>\n     *\n     * @return the width MeasureSpec of the popup\n     *\n     * @see #setWidth(int) \n     */\n    getWidth():number  {\n        return this.mWidth;\n    }\n\n    /**\n     * <p>Change the popup's width MeasureSpec</p>\n     *\n     * <p>If the popup is showing, calling this method will take effect only\n     * the next time the popup is shown.</p>\n     *\n     * @param width the width MeasureSpec of the popup\n     *\n     * @see #getWidth()\n     * @see #isShowing()\n     */\n    setWidth(width:number):void  {\n        this.mWidth = width;\n    }\n\n    /**\n     * <p>Indicate whether this popup window is showing on screen.</p>\n     *\n     * @return true if the popup is showing, false otherwise\n     */\n    isShowing():boolean  {\n        return this.mIsShowing;\n    }\n\n    /**\n     * <p>\n     * Display the content view in a popup window at the specified location. If the popup window\n     * cannot fit on screen, it will be clipped. See {@link android.view.WindowManager.LayoutParams}\n     * for more information on how gravity and the x and y parameters are related. Specifying\n     * a gravity of {@link android.view.Gravity#NO_GRAVITY} is similar to specifying\n     * <code>Gravity.LEFT | Gravity.TOP</code>.\n     * </p>\n     * \n     * @param parent a parent view to get the {@link android.view.View#getWindowToken()} token from\n     * @param gravity the gravity which controls the placement of the popup window\n     * @param x the popup's x location offset\n     * @param y the popup's y location offset\n     */\n    showAtLocation(parent:View, gravity:number, x:number, y:number):void  {\n        if (this.isShowing() || this.mContentView == null) {\n            return;\n        }\n        this.unregisterForScrollChanged();\n        this.mIsShowing = true;\n        this.mIsDropdown = false;\n        let p:WindowManager.LayoutParams = this.createPopupLayout();\n        p.enterAnimation = this.computeWindowEnterAnimation();\n        p.exitAnimation = this.computeWindowExitAnimation();\n        this.preparePopup(p);\n        if (gravity == Gravity.NO_GRAVITY) {\n            gravity = Gravity.TOP | Gravity.START;\n        }\n        p.gravity = gravity;\n        p.x = x;\n        p.y = y;\n        if (this.mHeightMode < 0)\n            p.height = this.mLastHeight = this.mHeightMode;\n        if (this.mWidthMode < 0)\n            p.width = this.mLastWidth = this.mWidthMode;\n        this.invokePopup(p);\n    }\n\n    /**\n     * <p>Display the content view in a popup window anchored to the bottom-left\n     * corner of the anchor view offset by the specified x and y coordinates.\n     * If there is not enough room on screen to show\n     * the popup in its entirety, this method tries to find a parent scroll\n     * view to scroll. If no parent scroll view can be scrolled, the bottom-left\n     * corner of the popup is pinned at the top left corner of the anchor view.</p>\n     * <p>If the view later scrolls to move <code>anchor</code> to a different\n     * location, the popup will be moved correspondingly.</p>\n     *\n     * @param anchor the view on which to pin the popup window\n     * @param xoff A horizontal offset from the anchor in pixels\n     * @param yoff A vertical offset from the anchor in pixels\n     * @param gravity Alignment of the popup relative to the anchor\n     *\n     * @see #dismiss()\n     */\n    showAsDropDown(anchor:View, xoff=0, yoff=0, gravity=PopupWindow.DEFAULT_ANCHORED_GRAVITY):void  {\n        if (this.isShowing() || this.mContentView == null) {\n            return;\n        }\n        this.registerForScrollChanged(anchor, xoff, yoff, gravity);\n        this.mIsShowing = true;\n        this.mIsDropdown = true;\n        let p:WindowManager.LayoutParams = this.createPopupLayout();\n        this.preparePopup(p);\n        this.updateAboveAnchor(this.findDropDownPosition(anchor, p, xoff, yoff, gravity));\n        if (this.mHeightMode < 0)\n            p.height = this.mLastHeight = this.mHeightMode;\n        if (this.mWidthMode < 0)\n            p.width = this.mLastWidth = this.mWidthMode;\n        p.enterAnimation = this.computeWindowEnterAnimation();\n        p.exitAnimation = this.computeWindowExitAnimation();\n        this.invokePopup(p);\n    }\n\n    private updateAboveAnchor(aboveAnchor:boolean):void  {\n        if (aboveAnchor != this.mAboveAnchor) {\n            this.mAboveAnchor = aboveAnchor;\n            if (this.mBackground != null) {\n                // do the job.\n                if (this.mAboveAnchorBackgroundDrawable != null) {\n                    if (this.mAboveAnchor) {\n                        this.mPopupView.setBackgroundDrawable(this.mAboveAnchorBackgroundDrawable);\n                    } else {\n                        this.mPopupView.setBackgroundDrawable(this.mBelowAnchorBackgroundDrawable);\n                    }\n                } else {\n                    this.mPopupView.refreshDrawableState();\n                }\n            }\n        }\n    }\n\n    /**\n     * Indicates whether the popup is showing above (the y coordinate of the popup's bottom\n     * is less than the y coordinate of the anchor) or below the anchor view (the y coordinate\n     * of the popup is greater than y coordinate of the anchor's bottom).\n     *\n     * The value returned\n     * by this method is meaningful only after {@link #showAsDropDown(android.view.View)}\n     * or {@link #showAsDropDown(android.view.View, int, int)} was invoked.\n     *\n     * @return True if this popup is showing above the anchor view, false otherwise.\n     */\n    isAboveAnchor():boolean  {\n        return this.mAboveAnchor;\n    }\n\n    /**\n     * <p>Prepare the popup by embedding in into a new ViewGroup if the\n     * background drawable is not null. If embedding is required, the layout\n     * parameters' height is mnodified to take into account the background's\n     * padding.</p>\n     *\n     * @param p the layout parameters of the popup's content view\n     */\n    private preparePopup(p:WindowManager.LayoutParams):void  {\n        if (this.mContentView == null || this.mContext == null || this.mWindowManager == null) {\n            throw Error(`new IllegalStateException(\"You must specify a valid content view by \" + \"calling setContentView() before attempting to show the popup.\")`);\n        }\n        //if (this.mBackground != null) {\n        //    const layoutParams:ViewGroup.LayoutParams = this.mContentView.getLayoutParams();\n        //    let height:number = ViewGroup.LayoutParams.MATCH_PARENT;\n        //    if (layoutParams != null && layoutParams.height == ViewGroup.LayoutParams.WRAP_CONTENT) {\n        //        height = ViewGroup.LayoutParams.WRAP_CONTENT;\n        //    }\n        //    // when a background is available, we embed the content view\n        //    // within another view that owns the background drawable\n        //    let popupViewContainer:PopupWindow.PopupViewContainer = new PopupWindow.PopupViewContainer(this.mContext, this);\n        //    let listParams = new PopupWindow.PopupViewContainer.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, height);\n        //    popupViewContainer.setBackgroundDrawable(this.mBackground);\n        //    popupViewContainer.addView(this.mContentView, listParams);\n        //    this.mPopupView = popupViewContainer;\n        //} else {\n        //    this.mPopupView = this.mContentView;\n        //}\n        this.mPopupWindow.setContentView(this.mContentView);\n        this.mPopupWindow.setFloating(true);\n        this.mPopupWindow.setBackgroundColor(android.graphics.Color.TRANSPARENT);\n        this.mPopupWindow.setDimAmount(0);\n        this.mPopupView = this.mPopupWindow.getDecorView();\n        if (this.mBackground != null) {\n            this.mPopupView.setBackground(this.mBackground)\n        }\n\n        this.mPopupViewInitialLayoutDirectionInherited = false;//(this.mPopupView.getRawLayoutDirection() == View.LAYOUT_DIRECTION_INHERIT);\n        this.mPopupWidth = p.width;\n        this.mPopupHeight = p.height;\n    }\n\n    /**\n     * <p>Invoke the popup window by adding the content view to the window\n     * manager.</p>\n     *\n     * <p>The content view must be non-null when this method is invoked.</p>\n     *\n     * @param p the layout parameters of the popup's content view\n     */\n    private invokePopup(p:WindowManager.LayoutParams):void  {\n        //if (this.mContext != null) {\n        //    p.packageName = this.mContext.getPackageName();\n        //}\n        //this.mPopupView.setFitsSystemWindows(this.mLayoutInsetDecor);\n        this.setLayoutDirectionFromAnchor();\n        this.mWindowManager.addWindow(this.mPopupWindow);\n    }\n\n    private setLayoutDirectionFromAnchor():void  {\n        if (this.mAnchor != null) {\n            let anchor:View = this.mAnchor.get();\n            if (anchor != null && this.mPopupViewInitialLayoutDirectionInherited) {\n                this.mPopupView.setLayoutDirection(anchor.getLayoutDirection());\n            }\n        }\n    }\n\n    /**\n     * <p>Generate the layout parameters for the popup window.</p>\n     *\n     * @param token the window token used to bind the popup's window\n     *\n     * @return the layout parameters to pass to the window manager\n     */\n    private createPopupLayout():WindowManager.LayoutParams  {\n        // generates the layout parameters for the drop down\n        // we want a fixed size view located at the bottom left of the anchor\n        let p:WindowManager.LayoutParams = this.mPopupWindow.getAttributes();\n        // these gravity settings put the view at the top left corner of the\n        // screen. The view is then positioned to the appropriate location\n        // by setting the x and y offsets to match the anchor's bottom\n        // left corner\n        p.gravity = Gravity.START | Gravity.TOP;\n        p.width = this.mLastWidth = this.mWidth;\n        p.height = this.mLastHeight = this.mHeight;\n        //if (this.mBackground != null) {\n        //    p.format = this.mBackground.getOpacity();\n        //} else {\n        //    p.format = PixelFormat.TRANSLUCENT;\n        //}\n        p.flags = this.computeFlags(p.flags);\n        p.type = this.mWindowLayoutType;\n        //p.token = token;\n        //p.softInputMode = this.mSoftInputMode;\n        p.setTitle(\"PopupWindow\");\n        return p;\n    }\n\n    private computeFlags(curFlags:number):number  {\n        curFlags &= ~(\n            //WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES |\n            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |\n            WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE |\n            //WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH |\n            //WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS |\n            //WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM |\n            WindowManager.LayoutParams.FLAG_SPLIT_TOUCH);\n        //if (this.mIgnoreCheekPress) {\n        //    curFlags |= WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES;\n        //}\n        if (!this.mFocusable) {\n            curFlags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;\n            //if (this.mInputMethodMode == PopupWindow.INPUT_METHOD_NEEDED) {\n            //    curFlags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;\n            //}\n        }\n        //else if (this.mInputMethodMode == PopupWindow.INPUT_METHOD_NOT_NEEDED) {\n        //    curFlags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;\n        //}\n        if (!this.mTouchable) {\n            curFlags |= WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;\n        }\n        if (this.mOutsideTouchable) {\n            curFlags |= WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;\n        }\n        //if (!this.mClippingEnabled) {\n        //    curFlags |= WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;\n        //}\n        if (this.isSplitTouchEnabled()) {\n            curFlags |= WindowManager.LayoutParams.FLAG_SPLIT_TOUCH;\n        }\n        //if (this.mLayoutInScreen) {\n        //    curFlags |= WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;\n        //}\n        //if (this.mLayoutInsetDecor) {\n        //    curFlags |= WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR;\n        //}\n        if (this.mNotTouchModal) {\n            curFlags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;\n        }\n        return curFlags;\n    }\n\n    private computeWindowEnterAnimation():Animation  {\n        if (this.mEnterAnimation == null) {\n            if (this.mIsDropdown) {\n                return this.mAboveAnchor ? this.mDefaultDropdownAboveEnterAnimation : this.mDefaultDropdownBelowEnterAnimation;\n            }\n            return null;\n        }\n        return this.mEnterAnimation;\n    }\n\n    private computeWindowExitAnimation():Animation  {\n        if (this.mExitAnimation == null) {\n            if (this.mIsDropdown) {\n                return this.mAboveAnchor ? this.mDefaultDropdownAboveExitAnimation : this.mDefaultDropdownBelowExitAnimation;\n            }\n            return null;\n        }\n        return this.mExitAnimation;\n    }\n\n    /**\n     * <p>Positions the popup window on screen. When the popup window is too\n     * tall to fit under the anchor, a parent scroll view is seeked and scrolled\n     * up to reclaim space. If scrolling is not possible or not enough, the\n     * popup window gets moved on top of the anchor.</p>\n     *\n     * <p>The height must have been set on the layout parameters prior to\n     * calling this method.</p>\n     *\n     * @param anchor the view on which the popup window must be anchored\n     * @param p the layout parameters used to display the drop down\n     *\n     * @return true if the popup is translated upwards to fit on screen\n     */\n    private findDropDownPosition(anchor:View, p:WindowManager.LayoutParams, xoff:number, yoff:number, gravity:number):boolean  {\n        const anchorHeight:number = anchor.getHeight();\n        anchor.getLocationInWindow(this.mDrawingLocation);\n        p.x = this.mDrawingLocation[0] + xoff;\n        p.y = this.mDrawingLocation[1] + anchorHeight + yoff;\n        const hgrav:number = Gravity.getAbsoluteGravity(gravity, anchor.getLayoutDirection()) & Gravity.HORIZONTAL_GRAVITY_MASK;\n        if (hgrav == Gravity.RIGHT) {\n            // Flip the location to align the right sides of the popup and anchor instead of left\n            p.x -= this.mPopupWidth - anchor.getWidth();\n        }\n        let onTop:boolean = false;\n        p.gravity = Gravity.LEFT | Gravity.TOP;\n        anchor.getLocationOnScreen(this.mScreenLocation);\n        const displayFrame:Rect = new Rect();\n        anchor.getWindowVisibleDisplayFrame(displayFrame);\n        let screenY:number = this.mScreenLocation[1] + anchorHeight + yoff;\n        const root:View = anchor.getRootView();\n        if (screenY + this.mPopupHeight > displayFrame.bottom || p.x + this.mPopupWidth - root.getWidth() > 0) {\n            // the edit box\n            if (this.mAllowScrollingAnchorParent) {\n                let scrollX:number = anchor.getScrollX();\n                let scrollY:number = anchor.getScrollY();\n                let r:Rect = new Rect(scrollX, scrollY, scrollX + this.mPopupWidth + xoff, scrollY + this.mPopupHeight + anchor.getHeight() + yoff);\n                anchor.requestRectangleOnScreen(r, true);\n            }\n            // now we re-evaluate the space available, and decide from that\n            // whether the pop-up will go above or below the anchor.\n            anchor.getLocationInWindow(this.mDrawingLocation);\n            p.x = this.mDrawingLocation[0] + xoff;\n            p.y = this.mDrawingLocation[1] + anchor.getHeight() + yoff;\n            // Preserve the gravity adjustment\n            if (hgrav == Gravity.RIGHT) {\n                p.x -= this.mPopupWidth - anchor.getWidth();\n            }\n            // determine whether there is more space above or below the anchor\n            anchor.getLocationOnScreen(this.mScreenLocation);\n            onTop = (displayFrame.bottom - this.mScreenLocation[1] - anchor.getHeight() - yoff) < (this.mScreenLocation[1] - yoff - displayFrame.top);\n            if (onTop) {\n                p.gravity = Gravity.LEFT | Gravity.BOTTOM;\n                p.y = root.getHeight() - this.mDrawingLocation[1] + yoff;\n            } else {\n                p.y = this.mDrawingLocation[1] + anchor.getHeight() + yoff;\n            }\n        }\n        if (this.mClipToScreen) {\n            const displayFrameWidth:number = displayFrame.right - displayFrame.left;\n            let right:number = p.x + p.width;\n            if (right > displayFrameWidth) {\n                p.x -= right - displayFrameWidth;\n            }\n            if (p.x < displayFrame.left) {\n                p.x = displayFrame.left;\n                p.width = Math.min(p.width, displayFrameWidth);\n            }\n            if (onTop) {\n                let popupTop:number = this.mScreenLocation[1] + yoff - this.mPopupHeight;\n                if (popupTop < 0) {\n                    p.y += popupTop;\n                }\n            } else {\n                p.y = Math.max(p.y, displayFrame.top);\n            }\n        }\n        p.gravity |= Gravity.DISPLAY_CLIP_VERTICAL;\n        return onTop;\n    }\n\n    /**\n     * Returns the maximum height that is available for the popup to be\n     * completely shown, optionally ignoring any bottom decorations such as\n     * the input method. It is recommended that this height be the maximum for\n     * the popup's height, otherwise it is possible that the popup will be\n     * clipped.\n     * \n     * @param anchor The view on which the popup window must be anchored.\n     * @param yOffset y offset from the view's bottom edge\n     * @param ignoreBottomDecorations if true, the height returned will be\n     *        all the way to the bottom of the display, ignoring any\n     *        bottom decorations\n     * @return The maximum available height for the popup to be completely\n     *         shown.\n     *         \n     * @hide Pending API council approval.\n     */\n    getMaxAvailableHeight(anchor:View, yOffset=0, ignoreBottomDecorations=false):number {\n        const displayFrame:Rect = new Rect();\n        anchor.getWindowVisibleDisplayFrame(displayFrame);\n        const anchorPos:number[] = this.mDrawingLocation;\n        anchor.getLocationOnScreen(anchorPos);\n        let bottomEdge:number = displayFrame.bottom;\n        if (ignoreBottomDecorations) {\n            let res:Resources = anchor.getContext().getResources();\n            bottomEdge = res.getDisplayMetrics().heightPixels;\n        }\n        const distanceToBottom:number = bottomEdge - (anchorPos[1] + anchor.getHeight()) - yOffset;\n        const distanceToTop:number = anchorPos[1] - displayFrame.top + yOffset;\n        // anchorPos[1] is distance from anchor to top of screen\n        let returnedHeight:number = Math.max(distanceToBottom, distanceToTop);\n        if (this.mBackground != null) {\n            this.mBackground.getPadding(this.mTempRect);\n            returnedHeight -= this.mTempRect.top + this.mTempRect.bottom;\n        }\n        return returnedHeight;\n    }\n\n    /**\n     * <p>Dispose of the popup window. This method can be invoked only after\n     * {@link #showAsDropDown(android.view.View)} has been executed. Failing that, calling\n     * this method will have no effect.</p>\n     *\n     * @see #showAsDropDown(android.view.View) \n     */\n    dismiss():void  {\n        if (this.isShowing() && this.mPopupView != null) {\n            this.mIsShowing = false;\n            this.unregisterForScrollChanged();\n            try {\n                this.mWindowManager.removeWindow(this.mPopupWindow);\n            } finally {\n                if (this.mPopupView != this.mContentView && this.mPopupView instanceof ViewGroup) {\n                    (<ViewGroup> this.mPopupView).removeView(this.mContentView);\n                }\n                this.mPopupView = null;\n                if (this.mOnDismissListener != null) {\n                    this.mOnDismissListener.onDismiss();\n                }\n            }\n        }\n    }\n\n    /**\n     * Sets the listener to be called when the window is dismissed.\n     * \n     * @param onDismissListener The listener.\n     */\n    setOnDismissListener(onDismissListener:PopupWindow.OnDismissListener):void  {\n        this.mOnDismissListener = onDismissListener;\n    }\n\n    /**\n     * Updates the state of the popup window, if it is currently being displayed,\n     * from the currently set state.  This include:\n     * {@link #setClippingEnabled(boolean)}, {@link #setFocusable(boolean)},\n     * {@link #setIgnoreCheekPress()}, {@link #setInputMethodMode(int)},\n     * {@link #setTouchable(boolean)}, and {@link #setAnimationStyle(int)}.\n     */\n    update():void;\n    /**\n     * <p>Updates the dimension of the popup window. Calling this function\n     * also updates the window with the current popup state as described\n     * for {@link #update()}.</p>\n     *\n     * @param width the new width\n     * @param height the new height\n     */\n    update(width:number, height:number):void;\n    /**\n     * <p>Updates the position and the dimension of the popup window. Calling this\n     * function also updates the window with the current popup state as described\n     * for {@link #update()}.</p>\n     *\n     * @param anchor the popup's anchor view\n     * @param width the new width, can be -1 to ignore\n     * @param height the new height, can be -1 to ignore\n     */\n    update(anchor:View, width:number, height:number):void;\n    /**\n     * <p>Updates the position and the dimension of the popup window. Width and\n     * height can be set to -1 to update location only.  Calling this function\n     * also updates the window with the current popup state as\n     * described for {@link #update()}.</p>\n     *\n     * @param x the new x location\n     * @param y the new y location\n     * @param width the new width, can be -1 to ignore\n     * @param height the new height, can be -1 to ignore\n     * @param force reposition the window even if the specified position\n     *              already seems to correspond to the LayoutParams\n     */\n    update(x:number, y:number, width:number, height:number, force?:boolean):void;\n\n    /**\n     * <p>Updates the position and the dimension of the popup window. Width and\n     * height can be set to -1 to update location only.  Calling this function\n     * also updates the window with the current popup state as\n     * described for {@link #update()}.</p>\n     *\n     * <p>If the view later scrolls to move <code>anchor</code> to a different\n     * location, the popup will be moved correspondingly.</p>\n     *\n     * @param anchor the popup's anchor view\n     * @param xoff x offset from the view's left edge\n     * @param yoff y offset from the view's bottom edge\n     * @param width the new width, can be -1 to ignore\n     * @param height the new height, can be -1 to ignore\n     */\n    update(anchor:View, xoff:number, yoff:number, width:number, height:number):void;\n    update(...args):void{\n        if(args.length==0){\n            this._update();\n\n        }else if(args.length==2){\n            this._update_w_h(args[0], args[1]);\n\n        }else if(args.length==3){\n            this._update_a_w_h(args[0], args[1], args[2]);\n\n        }else if(args.length == 4){\n            this._update_x_y_w_h_f(args[0], args[1], args[2], args[3]);\n\n        }else if(args.length == 5){\n            if(args[0] instanceof View) this._update_a_x_y_w_h(args[0], args[1], args[2], args[3], args[4]);\n            else this._update_x_y_w_h_f(args[0], args[1], args[2], args[3], args[4]);\n        }\n    }\n\n    private _update():void  {\n        if (!this.isShowing() || this.mContentView == null) {\n            return;\n        }\n        let p:WindowManager.LayoutParams = <WindowManager.LayoutParams> this.mPopupView.getLayoutParams();\n        let update:boolean = false;\n        const enterAnim = this.computeWindowEnterAnimation();\n        const exitAnim = this.computeWindowExitAnimation();\n        if (enterAnim != p.enterAnimation) {\n            p.enterAnimation = enterAnim;\n            update = true;\n        }\n        if (exitAnim != p.exitAnimation) {\n            p.exitAnimation = exitAnim;\n            update = true;\n        }\n        const newFlags:number = this.computeFlags(p.flags);\n        if (newFlags != p.flags) {\n            p.flags = newFlags;\n            update = true;\n        }\n        if (update) {\n            this.setLayoutDirectionFromAnchor();\n            this.mWindowManager.updateWindowLayout(this.mPopupWindow, p);\n        }\n    }\n\n    private _update_w_h(width:number, height:number):void  {\n        let p:WindowManager.LayoutParams = <WindowManager.LayoutParams> this.mPopupView.getLayoutParams();\n        this.update(p.x, p.y, width, height, false);\n    }\n\n    private _update_x_y_w_h_f(x:number, y:number, width:number, height:number, force=false):void {\n        if (width != -1) {\n            this.mLastWidth = width;\n            this.setWidth(width);\n        }\n        if (height != -1) {\n            this.mLastHeight = height;\n            this.setHeight(height);\n        }\n        if (!this.isShowing() || this.mContentView == null) {\n            return;\n        }\n        let p:WindowManager.LayoutParams = <WindowManager.LayoutParams> this.mPopupView.getLayoutParams();\n        let update:boolean = force;\n        const finalWidth:number = this.mWidthMode < 0 ? this.mWidthMode : this.mLastWidth;\n        if (width != -1 && p.width != finalWidth) {\n            p.width = this.mLastWidth = finalWidth;\n            update = true;\n        }\n        const finalHeight:number = this.mHeightMode < 0 ? this.mHeightMode : this.mLastHeight;\n        if (height != -1 && p.height != finalHeight) {\n            p.height = this.mLastHeight = finalHeight;\n            update = true;\n        }\n        if (p.x != x) {\n            p.x = x;\n            update = true;\n        }\n        if (p.y != y) {\n            p.y = y;\n            update = true;\n        }\n        const enterAnim = this.computeWindowEnterAnimation();\n        const exitAnim = this.computeWindowExitAnimation();\n        if (enterAnim != p.enterAnimation) {\n            p.enterAnimation = enterAnim;\n            update = true;\n        }\n        if (exitAnim != p.exitAnimation) {\n            p.exitAnimation = exitAnim;\n            update = true;\n        }\n        const newFlags:number = this.computeFlags(p.flags);\n        if (newFlags != p.flags) {\n            p.flags = newFlags;\n            update = true;\n        }\n        if (update) {\n            this.setLayoutDirectionFromAnchor();\n            this.mWindowManager.updateWindowLayout(this.mPopupWindow, p);\n        }\n    }\n\n    private _update_a_w_h(anchor:View, width:number, height:number):void  {\n        this._update_all_args(anchor, false, 0, 0, true, width, height, this.mAnchoredGravity);\n    }\n\n    private _update_a_x_y_w_h(anchor:View, xoff:number, yoff:number, width:number, height:number):void  {\n        this._update_all_args(anchor, true, xoff, yoff, true, width, height, this.mAnchoredGravity);\n    }\n\n    private _update_all_args(anchor:View, updateLocation:boolean, xoff:number, yoff:number, updateDimension:boolean, width:number, height:number, gravity:number):void  {\n        if (!this.isShowing() || this.mContentView == null) {\n            return;\n        }\n        let oldAnchor:WeakReference<View> = this.mAnchor;\n        const needsUpdate:boolean = updateLocation && (this.mAnchorXoff != xoff || this.mAnchorYoff != yoff);\n        if (oldAnchor == null || oldAnchor.get() != anchor || (needsUpdate && !this.mIsDropdown)) {\n            this.registerForScrollChanged(anchor, xoff, yoff, gravity);\n        } else if (needsUpdate) {\n            // No need to register again if this is a DropDown, showAsDropDown already did.\n            this.mAnchorXoff = xoff;\n            this.mAnchorYoff = yoff;\n            this.mAnchoredGravity = gravity;\n        }\n        let p:WindowManager.LayoutParams = <WindowManager.LayoutParams> this.mPopupView.getLayoutParams();\n        if (updateDimension) {\n            if (width == -1) {\n                width = this.mPopupWidth;\n            } else {\n                this.mPopupWidth = width;\n            }\n            if (height == -1) {\n                height = this.mPopupHeight;\n            } else {\n                this.mPopupHeight = height;\n            }\n        }\n        let x:number = p.x;\n        let y:number = p.y;\n        if (updateLocation) {\n            this.updateAboveAnchor(this.findDropDownPosition(anchor, p, xoff, yoff, gravity));\n        } else {\n            this.updateAboveAnchor(this.findDropDownPosition(anchor, p, this.mAnchorXoff, this.mAnchorYoff, this.mAnchoredGravity));\n        }\n        this.update(p.x, p.y, width, height, x != p.x || y != p.y);\n    }\n\n\n\n    private unregisterForScrollChanged():void  {\n        let anchorRef:WeakReference<View> = this.mAnchor;\n        let anchor:View = null;\n        if (anchorRef != null) {\n            anchor = anchorRef.get();\n        }\n        if (anchor != null) {\n            let vto:ViewTreeObserver = anchor.getViewTreeObserver();\n            vto.removeOnScrollChangedListener(this.mOnScrollChangedListener);\n        }\n        this.mAnchor = null;\n    }\n\n    private registerForScrollChanged(anchor:View, xoff:number, yoff:number, gravity:number):void  {\n        this.unregisterForScrollChanged();\n        this.mAnchor = new WeakReference<View>(anchor);\n        let vto:ViewTreeObserver = anchor.getViewTreeObserver();\n        if (vto != null) {\n            vto.addOnScrollChangedListener(this.mOnScrollChangedListener);\n        }\n        this.mAnchorXoff = xoff;\n        this.mAnchorYoff = yoff;\n        this.mAnchoredGravity = gravity;\n    }\n\n    //androidui add:\n    onTouchEvent(event:MotionEvent):boolean {\n        //if (this.mPopupWindow.shouldCloseOnTouch(this.mContext, event)) {\n        //    this.dismiss();\n        //    return true;\n        //}\n        const x:number = Math.floor(event.getX());\n        const y:number = Math.floor(event.getY());\n        if ((event.getAction() == MotionEvent.ACTION_DOWN) && ((x < 0) || (x >= this.mPopupView.getWidth()) || (y < 0) || (y >= this.mPopupView.getHeight()))) {\n            this.dismiss();\n            return true;\n        } else if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {\n            this.dismiss();\n            return true;\n\n        } else if(this.mPopupView){\n            return this.mPopupView.onTouchEvent(event);\n        }\n        return false;\n    }\n    onGenericMotionEvent(event:MotionEvent):boolean {\n        return false;\n    }\n    onWindowAttributesChanged(params:WindowManager.LayoutParams):void {\n        if (this.mPopupWindow != null) {\n            this.mWindowManager.updateWindowLayout(this.mPopupWindow, params);\n        }\n    }\n    onContentChanged():void {\n    }\n    onWindowFocusChanged(hasFocus:boolean):void {\n    }\n    onAttachedToWindow():void {\n    }\n    onDetachedFromWindow():void {\n    }\n    dispatchKeyEvent(event:KeyEvent):boolean {\n        if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {\n            if (this.mPopupView.getKeyDispatcherState() == null) {\n                return this.mPopupWindow.superDispatchKeyEvent(event);\n            }\n            if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {\n                let state:KeyEvent.DispatcherState = this.mPopupView.getKeyDispatcherState();\n                if (state != null) {\n                    state.startTracking(event, this);\n                }\n                return true;\n            } else if (event.getAction() == KeyEvent.ACTION_UP) {\n                let state:KeyEvent.DispatcherState = this.mPopupView.getKeyDispatcherState();\n                if (state != null && state.isTracking(event) && !event.isCanceled()) {\n                    this.dismiss();\n                    return true;\n                }\n            }\n            return this.mPopupWindow.superDispatchKeyEvent(event);\n        } else {\n            return this.mPopupWindow.superDispatchKeyEvent(event);\n        }\n    }\n    dispatchTouchEvent(ev:MotionEvent):boolean {\n        if (this.mTouchInterceptor != null && this.mTouchInterceptor.onTouch(this.mPopupView, ev)) {\n            return true;\n        }\n        if(this.mPopupWindow.superDispatchTouchEvent(ev)){\n            return true;\n        }\n        return this.onTouchEvent(ev);\n    }\n    dispatchGenericMotionEvent(ev:MotionEvent):boolean {\n        if (this.mPopupWindow.superDispatchGenericMotionEvent(ev)) {\n            return true;\n        }\n        return this.onGenericMotionEvent(ev);\n    }\n\n}\n\nexport module PopupWindow{\n/**\n     * Listener that is called when this popup window is dismissed.\n     */\nexport interface OnDismissListener {\n    /**\n         * Called when this popup window is dismissed.\n         */\n    onDismiss():void;\n}\n//export class PopupViewContainer extends FrameLayout {\n//    private static TAG:string = \"PopupWindow.PopupViewContainer\";\n//\n//    _PopupWindow_this:any;\n//    constructor(context:Context, arg:PopupWindow){\n//        super(context);\n//        this._PopupWindow_this = arg;\n//    }\n//\n//\n//    //onCreateDrawableState(extraSpace:number):number[]  {\n//    //    if (this._PopupWindow_this.mAboveAnchor) {\n//    //        // 1 more needed for the above anchor state\n//    //        const drawableState:number[] = super.onCreateDrawableState(extraSpace + 1);\n//    //        View.mergeDrawableStates(drawableState, PopupWindow.ABOVE_ANCHOR_STATE_SET);\n//    //        return drawableState;\n//    //    } else {\n//    //        return super.onCreateDrawableState(extraSpace);\n//    //    }\n//    //}\n//\n//    dispatchKeyEvent(event:KeyEvent):boolean  {\n//        if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {\n//            if (this.getKeyDispatcherState() == null) {\n//                return super.dispatchKeyEvent(event);\n//            }\n//            if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {\n//                let state:KeyEvent.DispatcherState = this.getKeyDispatcherState();\n//                if (state != null) {\n//                    state.startTracking(event, this);\n//                }\n//                return true;\n//            } else if (event.getAction() == KeyEvent.ACTION_UP) {\n//                let state:KeyEvent.DispatcherState = this.getKeyDispatcherState();\n//                if (state != null && state.isTracking(event) && !event.isCanceled()) {\n//                    this._PopupWindow_this.dismiss();\n//                    return true;\n//                }\n//            }\n//            return super.dispatchKeyEvent(event);\n//        } else {\n//            return super.dispatchKeyEvent(event);\n//        }\n//    }\n//\n//    dispatchTouchEvent(ev:MotionEvent):boolean  {\n//        if (this._PopupWindow_this.mTouchInterceptor != null && this._PopupWindow_this.mTouchInterceptor.onTouch(this, ev)) {\n//            return true;\n//        }\n//        return super.dispatchTouchEvent(ev);\n//    }\n//\n//    onTouchEvent(event:MotionEvent):boolean  {\n//        const x:number = Math.floor(event.getX());\n//        const y:number = Math.floor(event.getY());\n//        if ((event.getAction() == MotionEvent.ACTION_DOWN) && ((x < 0) || (x >= this.getWidth()) || (y < 0) || (y >= this.getHeight()))) {\n//            this._PopupWindow_this.dismiss();\n//            return true;\n//        } else if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {\n//            this._PopupWindow_this.dismiss();\n//            return true;\n//        } else {\n//            return super.onTouchEvent(event);\n//        }\n//    }\n//\n//    sendAccessibilityEvent(eventType:number):void  {\n//        // clinets are interested in the content not the container, make it event source\n//        if (this._PopupWindow_this.mContentView != null) {\n//            this._PopupWindow_this.mContentView.sendAccessibilityEvent(eventType);\n//        } else {\n//            super.sendAccessibilityEvent(eventType);\n//        }\n//    }\n//}\n}\n\n}"
  },
  {
    "path": "src/android/widget/ProgressBar.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Animatable.ts\"/>\n///<reference path=\"../../android/graphics/drawable/AnimationDrawable.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/graphics/drawable/LayerDrawable.ts\"/>\n///<reference path=\"../../android/graphics/drawable/StateListDrawable.ts\"/>\n///<reference path=\"../../android/graphics/drawable/ClipDrawable.ts\"/>\n///<reference path=\"../../android/util/Pools.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/animation/AlphaAnimation.ts\"/>\n///<reference path=\"../../android/view/animation/Animation.ts\"/>\n///<reference path=\"../../android/view/animation/AnimationUtils.ts\"/>\n///<reference path=\"../../android/view/animation/Interpolator.ts\"/>\n///<reference path=\"../../android/view/animation/LinearInterpolator.ts\"/>\n///<reference path=\"../../android/view/animation/Transformation.ts\"/>\n///<reference path=\"../../java/util/ArrayList.ts\"/>\n///<reference path=\"../../android/widget/LinearLayout.ts\"/>\n///<reference path=\"../../android/widget/TextView.ts\"/>\n///<reference path=\"../../android/R/id.ts\"/>\n///<reference path=\"../../androidui/image/NetDrawable.ts\"/>\n\nmodule android.widget {\nimport Canvas = android.graphics.Canvas;\nimport Rect = android.graphics.Rect;\nimport Animatable = android.graphics.drawable.Animatable;\nimport AnimationDrawable = android.graphics.drawable.AnimationDrawable;\nimport Drawable = android.graphics.drawable.Drawable;\nimport LayerDrawable = android.graphics.drawable.LayerDrawable;\nimport StateListDrawable = android.graphics.drawable.StateListDrawable;\nimport ClipDrawable = android.graphics.drawable.ClipDrawable;\nimport SynchronizedPool = android.util.Pools.SynchronizedPool;\nimport Gravity = android.view.Gravity;\nimport View = android.view.View;\nimport AlphaAnimation = android.view.animation.AlphaAnimation;\nimport Animation = android.view.animation.Animation;\nimport AnimationUtils = android.view.animation.AnimationUtils;\nimport Interpolator = android.view.animation.Interpolator;\nimport LinearInterpolator = android.view.animation.LinearInterpolator;\nimport Transformation = android.view.animation.Transformation;\nimport ArrayList = java.util.ArrayList;\nimport LinearLayout = android.widget.LinearLayout;\nimport TextView = android.widget.TextView;\nimport R = android.R;\nimport NetDrawable = androidui.image.NetDrawable;\n    import AttrBinder = androidui.attr.AttrBinder;\n\n/**\n * <p>\n * Visual indicator of progress in some operation.  Displays a bar to the user\n * representing how far the operation has progressed; the application can \n * change the amount of progress (modifying the length of the bar) as it moves \n * forward.  There is also a secondary progress displayable on a progress bar\n * which is useful for displaying intermediate progress, such as the buffer\n * level during a streaming playback progress bar.\n * </p>\n *\n * <p>\n * A progress bar can also be made indeterminate. In indeterminate mode, the\n * progress bar shows a cyclic animation without an indication of progress. This mode is used by\n * applications when the length of the task is unknown. The indeterminate progress bar can be either\n * a spinning wheel or a horizontal bar.\n * </p>\n *\n * <p>The following code example shows how a progress bar can be used from\n * a worker thread to update the user interface to notify the user of progress:\n * </p>\n * \n * <pre>\n * public class MyActivity extends Activity {\n *     private static final int PROGRESS = 0x1;\n *\n *     private ProgressBar mProgress;\n *     private int mProgressStatus = 0;\n *\n *     private Handler mHandler = new Handler();\n *\n *     protected void onCreate(Bundle icicle) {\n *         super.onCreate(icicle);\n *\n *         setContentView(R.layout.progressbar_activity);\n *\n *         mProgress = (ProgressBar) findViewById('progress'_bar);\n *\n *         // Start lengthy operation in a background thread\n *         new Thread(new Runnable() {\n *             public void run() {\n *                 while (mProgressStatus &lt; 100) {\n *                     mProgressStatus = doWork();\n *\n *                     // Update the progress bar\n *                     mHandler.post(new Runnable() {\n *                         public void run() {\n *                             mProgress.setProgress(mProgressStatus);\n *                         }\n *                     });\n *                 }\n *             }\n *         }).start();\n *     }\n * }</pre>\n *\n * <p>To add a progress bar to a layout file, you can use the {@code &lt;ProgressBar&gt;} element.\n * By default, the progress bar is a spinning wheel (an indeterminate indicator). To change to a\n * horizontal progress bar, apply the {@link android.R.style#Widget_ProgressBar_Horizontal\n * Widget.ProgressBar.Horizontal} style, like so:</p>\n *\n * <pre>\n * &lt;ProgressBar\n *     style=\"@android:style/Widget.ProgressBar.Horizontal\"\n *     ... /&gt;</pre>\n *\n * <p>If you will use the progress bar to show real progress, you must use the horizontal bar. You\n * can then increment the  progress with {@link #incrementProgressBy incrementProgressBy()} or\n * {@link #setProgress setProgress()}. By default, the progress bar is full when it reaches 100. If\n * necessary, you can adjust the maximum value (the value for a full bar) using the {@link\n * android.R.styleable#ProgressBar_max android:max} attribute. Other attributes available are listed\n * below.</p>\n *\n * <p>Another common style to apply to the progress bar is {@link\n * android.R.style#Widget_ProgressBar_Small Widget.ProgressBar.Small}, which shows a smaller\n * version of the spinning wheel&mdash;useful when waiting for content to load.\n * For example, you can insert this kind of progress bar into your default layout for\n * a view that will be populated by some content fetched from the Internet&mdash;the spinning wheel\n * appears immediately and when your application receives the content, it replaces the progress bar\n * with the loaded content. For example:</p>\n *\n * <pre>\n * &lt;LinearLayout\n *     android:orientation=\"horizontal\"\n *     ... &gt;\n *     &lt;ProgressBar\n *         android:layout_width=\"wrap_content\"\n *         android:layout_height=\"wrap_content\"\n *         style=\"@android:style/Widget.ProgressBar.Small\"\n *         android:layout_marginRight=\"5dp\" /&gt;\n *     &lt;TextView\n *         android:layout_width=\"wrap_content\"\n *         android:layout_height=\"wrap_content\"\n *         android:text=\"@string/loading\" /&gt;\n * &lt;/LinearLayout&gt;</pre>\n *\n * <p>Other progress bar styles provided by the system include:</p>\n * <ul>\n * <li>{@link android.R.style#Widget_ProgressBar_Horizontal Widget.ProgressBar.Horizontal}</li>\n * <li>{@link android.R.style#Widget_ProgressBar_Small Widget.ProgressBar.Small}</li>\n * <li>{@link android.R.style#Widget_ProgressBar_Large Widget.ProgressBar.Large}</li>\n * <li>{@link android.R.style#Widget_ProgressBar_Inverse Widget.ProgressBar.Inverse}</li>\n * <li>{@link android.R.style#Widget_ProgressBar_Small_Inverse\n * Widget.ProgressBar.Small.Inverse}</li>\n * <li>{@link android.R.style#Widget_ProgressBar_Large_Inverse\n * Widget.ProgressBar.Large.Inverse}</li>\n * </ul>\n * <p>The \"inverse\" styles provide an inverse color scheme for the spinner, which may be necessary\n * if your application uses a light colored theme (a white background).</p>\n *  \n * <p><strong>XML attributes</b></strong> \n * <p> \n * See {@link android.R.styleable#ProgressBar ProgressBar Attributes}, \n * {@link android.R.styleable#View View Attributes}\n * </p>\n * \n * @attr ref android.R.styleable#ProgressBar_animationResolution\n * @attr ref android.R.styleable#ProgressBar_indeterminate\n * @attr ref android.R.styleable#ProgressBar_indeterminateBehavior\n * @attr ref android.R.styleable#ProgressBar_indeterminateDrawable\n * @attr ref android.R.styleable#ProgressBar_indeterminateDuration\n * @attr ref android.R.styleable#ProgressBar_indeterminateOnly\n * @attr ref android.R.styleable#ProgressBar_interpolator\n * @attr ref android.R.styleable#ProgressBar_max\n * @attr ref android.R.styleable#ProgressBar_maxHeight\n * @attr ref android.R.styleable#ProgressBar_maxWidth\n * @attr ref android.R.styleable#ProgressBar_minHeight\n * @attr ref android.R.styleable#ProgressBar_minWidth\n * @attr ref android.R.styleable#ProgressBar_mirrorForRtl\n * @attr ref android.R.styleable#ProgressBar_progress\n * @attr ref android.R.styleable#ProgressBar_progressDrawable\n * @attr ref android.R.styleable#ProgressBar_secondaryProgress\n */\nexport class ProgressBar extends View {\n\n    private static MAX_LEVEL:number = 10000;\n\n    private static TIMEOUT_SEND_ACCESSIBILITY_EVENT:number = 200;\n\n    mMinWidth:number = 0;\n\n    mMaxWidth:number = 0;\n\n    mMinHeight:number = 0;\n\n    mMaxHeight:number = 0;\n\n    private mProgress:number = 0;\n\n    private mSecondaryProgress:number = 0;\n\n    private mMax:number = 0;\n\n    private mBehavior:number = 0;\n\n    private mDuration:number = 0;\n\n    private mIndeterminate:boolean;\n\n    private mOnlyIndeterminate:boolean;\n\n    private mTransformation:Transformation;\n\n    private mAnimation:AlphaAnimation;\n\n    private mHasAnimation:boolean;\n\n    private mIndeterminateDrawable:Drawable;\n\n    private mProgressDrawable:Drawable;\n\n    private mCurrentDrawable:Drawable;\n\n    protected mSampleTile:NetDrawable;\n\n    private mNoInvalidate:boolean;\n\n    private mInterpolator:Interpolator;\n\n    //private mRefreshProgressRunnable:ProgressBar.RefreshProgressRunnable;\n\n    //private mUiThreadId:number = 0;\n\n    private mShouldStartAnimationDrawable:boolean;\n\n    private mInDrawing:boolean;\n\n    private mAttached:boolean;\n\n    private mRefreshIsPosted:boolean;\n\n    mMirrorForRtl:boolean = false;\n\n    private mRefreshData:ArrayList<ProgressBar.RefreshData> = new ArrayList<ProgressBar.RefreshData>();\n\n    //private mAccessibilityEventSender:ProgressBar.AccessibilityEventSender;\n\n    constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle=android.R.attr.progressBarStyle) {\n        super(context, bindElement, defStyle);\n        //this.mUiThreadId = Thread.currentThread().getId();\n\n        this.initProgressBar();\n        let a = context.obtainStyledAttributes(bindElement, defStyle);\n        this.mNoInvalidate = true;\n        let drawable: Drawable = a.getDrawable('progressDrawable');\n        if (drawable != null) {\n            drawable = this.tileify(drawable, false);\n            // Calling this method can set mMaxHeight, make sure the corresponding\n            // XML attribute for mMaxHeight is read after calling this method\n            this.setProgressDrawable(drawable);\n        }\n        this.mDuration = a.getInt('indeterminateDuration', this.mDuration);\n        this.mMinWidth = a.getDimensionPixelSize('minWidth', this.mMinWidth);\n        this.mMaxWidth = a.getDimensionPixelSize('maxWidth', this.mMaxWidth);\n        this.mMinHeight = a.getDimensionPixelSize('minHeight', this.mMinHeight);\n        this.mMaxHeight = a.getDimensionPixelSize('maxHeight', this.mMaxHeight);\n        if(a.getAttrValue('indeterminateBehavior') == 'cycle') {\n            this.mBehavior = Animation.REVERSE;\n        } else {\n            this.mBehavior = Animation.RESTART;\n        }\n        // const resID: number = a.getResourceId(com.android.internal.R.styleable.ProgressBar_interpolator, // default to linear interpolator\n        //     android.R.anim.linear_interpolator);\n        // if (resID > 0) {\n        //     this.setInterpolator(context, resID);\n        // }\n        this.setMax(a.getInt('max', this.mMax));\n        this.setProgress(a.getInt('progress', this.mProgress));\n        this.setSecondaryProgress(a.getInt('secondaryProgress', this.mSecondaryProgress));\n        drawable = a.getDrawable('indeterminateDrawable');\n        if (drawable != null) {\n            drawable = this.tileifyIndeterminate(drawable);\n            this.setIndeterminateDrawable(drawable);\n        }\n        this.mOnlyIndeterminate = a.getBoolean('indeterminateOnly', this.mOnlyIndeterminate);\n        this.mNoInvalidate = false;\n        this.setIndeterminate(this.mOnlyIndeterminate || a.getBoolean('indeterminate', this.mIndeterminate));\n        this.mMirrorForRtl = a.getBoolean('mirrorForRtl', this.mMirrorForRtl);\n        a.recycle();\n    }\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder().set('progressDrawable', {\n            setter(v:ProgressBar, value:any, a:AttrBinder) {\n                let drawable = a.parseDrawable(value);\n                if(drawable!=null){\n                    drawable = v.tileify(drawable, false);\n                    v.setProgressDrawable(drawable);\n                }\n            }, getter(v:ProgressBar) {\n                return v.getProgressDrawable();\n            }\n        }).set('indeterminateDuration', {\n            setter(v:ProgressBar, value:any, a:AttrBinder) {\n                v.mDuration = Math.floor(a.parseInt(value, v.mDuration));\n            }, getter(v:ProgressBar) {\n                return v.mDuration;\n            }\n        }).set('minWidth', {\n            setter(v:ProgressBar, value:any, a:AttrBinder) {\n                v.mMinWidth = Math.floor(a.parseNumberPixelSize(value, v.mMinWidth));\n            }, getter(v:ProgressBar) {\n                return v.mMinWidth;\n            }\n        }).set('maxWidth', {\n            setter(v:ProgressBar, value:any, a:AttrBinder) {\n                v.mMaxWidth = Math.floor(a.parseNumberPixelSize(value, v.mMaxWidth));\n            }, getter(v:ProgressBar) {\n                return v.mMaxWidth;\n            }\n        }).set('minHeight', {\n            setter(v:ProgressBar, value:any, a:AttrBinder) {\n                v.mMinHeight = Math.floor(a.parseNumberPixelSize(value, v.mMinHeight));\n            }, getter(v:ProgressBar) {\n                return v.mMinHeight;\n            }\n        }).set('maxHeight', {\n            setter(v:ProgressBar, value:any, a:AttrBinder) {\n                v.mMaxHeight = Math.floor(a.parseNumberPixelSize(value, v.mMaxHeight));\n            }, getter(v:ProgressBar) {\n                return v.mMaxHeight;\n            }\n        }).set('indeterminateBehavior', {\n            setter(v:ProgressBar, value:any, a:AttrBinder) {\n                if (Number.isInteger(Number.parseInt(value))) {\n                    v.mBehavior = Number.parseInt(value);\n                } else {\n                    if (value + ''.toLowerCase() == 'cycle') {\n                        v.mBehavior = Animation.REVERSE;\n                    } else {\n                        v.mBehavior = Animation.RESTART;\n                    }\n                }\n            }, getter(v:ProgressBar) {\n                return v.mBehavior;\n            }\n        }).set('interpolator', {\n            setter(v:ProgressBar, value:any, a:AttrBinder) {\n            }, getter(v:ProgressBar) {\n            }\n        }).set('max', {\n            setter(v:ProgressBar, value:any, a:AttrBinder) {\n                v.setMax(a.parseInt(value, v.mMax));\n            }, getter(v:ProgressBar) {\n                return v.mMax;\n            }\n        }).set('progress', {\n            setter(v:ProgressBar, value:any, a:AttrBinder) {\n                v.setProgress(a.parseInt(value, v.mProgress));\n            }, getter(v:ProgressBar) {\n                return v.mProgress;\n            }\n        }).set('secondaryProgress', {\n            setter(v:ProgressBar, value:any, a:AttrBinder) {\n                v.setSecondaryProgress(a.parseInt(value, v.mSecondaryProgress));\n            }, getter(v:ProgressBar) {\n                return v.mSecondaryProgress;\n            }\n        }).set('indeterminateDrawable', {\n            setter(v:ProgressBar, value:any, a:AttrBinder) {\n                let drawable = a.parseDrawable(value);\n                if(drawable!=null){\n                    drawable = v.tileifyIndeterminate(drawable);\n                    v.setIndeterminateDrawable(drawable);\n                }\n            }, getter(v:ProgressBar) {\n                return v.mIndeterminateDrawable;\n            }\n        }).set('indeterminateOnly', {\n            setter(v:ProgressBar, value:any, a:AttrBinder) {\n                v.mOnlyIndeterminate = a.parseBoolean(value, v.mOnlyIndeterminate);\n                v.setIndeterminate(v.mOnlyIndeterminate || v.mIndeterminate);\n            }, getter(v:ProgressBar) {\n                return v.mOnlyIndeterminate;\n            }\n        }).set('indeterminate', {\n            setter(v:ProgressBar, value:any, a:AttrBinder) {\n                v.setIndeterminate(v.mOnlyIndeterminate || a.parseBoolean(value, v.mIndeterminate));\n            }, getter(v:ProgressBar) {\n                return v.mIndeterminate;\n            }\n        });\n    }\n\n    /**\n     * Converts a drawable to a tiled version of itself. It will recursively\n     * traverse layer and state list drawables.\n     */\n    private tileify(drawable:Drawable, clip:boolean):Drawable  {\n        if (drawable instanceof LayerDrawable) {\n            let background:LayerDrawable = <LayerDrawable> drawable;\n            const N:number = background.getNumberOfLayers();\n            let outDrawables:Drawable[] = new Array<Drawable>(N);\n            let drawableChange = false;\n            for (let i:number = 0; i < N; i++) {\n                let id:string = background.getId(i);\n                let orig = background.getDrawable(i);\n                outDrawables[i] = this.tileify(orig, (id == R.id.progress || id == R.id.secondaryProgress));\n                drawableChange = drawableChange || outDrawables[i] !== orig;\n            }\n            if(!drawableChange) return background;\n\n            let newBg:LayerDrawable = new LayerDrawable(outDrawables);\n            for (let i:number = 0; i < N; i++) {\n                newBg.setId(i, background.getId(i));\n            }\n            return newBg;\n        } else if (drawable instanceof StateListDrawable) {\n            let _in:StateListDrawable = <StateListDrawable> drawable;\n            let out:StateListDrawable = new StateListDrawable();\n            let numStates:number = _in.getStateCount();\n            for (let i:number = 0; i < numStates; i++) {\n                out.addState(_in.getStateSet(i), this.tileify(_in.getStateDrawable(i), clip));\n            }\n            return out;\n        //} else if (drawable instanceof BitmapDrawable) {\n        //    const tileBitmap:Bitmap = (<BitmapDrawable> drawable).getBitmap();\n        //    if (this.mSampleTile == null) {\n        //        this.mSampleTile = tileBitmap;\n        //    }\n        //    const shapeDrawable:ShapeDrawable = new ShapeDrawable(this.getDrawableShape());\n        //    const bitmapShader:BitmapShader = new BitmapShader(tileBitmap, Shader.TileMode.REPEAT, Shader.TileMode.CLAMP);\n        //    shapeDrawable.getPaint().setShader(bitmapShader);\n        //    return (clip) ? new ClipDrawable(shapeDrawable, Gravity.LEFT, ClipDrawable.HORIZONTAL) : shapeDrawable;\n        } else if (drawable instanceof NetDrawable) {\n            const netDrawable = (<NetDrawable> drawable);\n            if (this.mSampleTile == null) {\n                this.mSampleTile = netDrawable;\n            }\n            netDrawable.setTileMode(NetDrawable.TileMode.REPEAT, null);\n            return (clip) ? new ClipDrawable(netDrawable, Gravity.LEFT, ClipDrawable.HORIZONTAL) : netDrawable;\n        }\n        return drawable;\n    }\n\n    //getDrawableShape():Shape  {\n    //    const roundedCorners:number[] =  [ 5, 5, 5, 5, 5, 5, 5, 5 ];\n    //    return new RoundRectShape(roundedCorners, null, null);\n    //}\n\n    /**\n     * Convert a AnimationDrawable for use as a barberpole animation.\n     * Each frame of the animation is wrapped in a ClipDrawable and\n     * given a tiling BitmapShader.\n     */\n    private tileifyIndeterminate(drawable:Drawable):Drawable  {\n        if (drawable instanceof AnimationDrawable) {\n            let background:AnimationDrawable = <AnimationDrawable> drawable;\n            const N:number = background.getNumberOfFrames();\n            let newBg:AnimationDrawable = new AnimationDrawable();\n            newBg.setOneShot(background.isOneShot());\n            for (let i:number = 0; i < N; i++) {\n                let frame:Drawable = this.tileify(background.getFrame(i), true);\n                frame.setLevel(10000);\n                newBg.addFrame(frame, background.getDuration(i));\n            }\n            newBg.setLevel(10000);\n            drawable = newBg;\n        }\n        return drawable;\n    }\n\n    /**\n     * <p>\n     * Initialize the progress bar's default values:\n     * </p>\n     * <ul>\n     * <li>progress = 0</li>\n     * <li>max = 100</li>\n     * <li>animation duration = 4000 ms</li>\n     * <li>indeterminate = false</li>\n     * <li>behavior = repeat</li>\n     * </ul>\n     */\n    private initProgressBar():void  {\n        this.mMax = 100;\n        this.mProgress = 0;\n        this.mSecondaryProgress = 0;\n        this.mIndeterminate = false;\n        this.mOnlyIndeterminate = false;\n        this.mDuration = 4000;\n        this.mBehavior = AlphaAnimation.RESTART;\n        this.mMinWidth = 24;\n        this.mMaxWidth = 48;\n        this.mMinHeight = 24;\n        this.mMaxHeight = 48;\n    }\n\n    /**\n     * <p>Indicate whether this progress bar is in indeterminate mode.</p>\n     *\n     * @return true if the progress bar is in indeterminate mode\n     */\n    isIndeterminate():boolean  {\n        return this.mIndeterminate;\n    }\n\n    /**\n     * <p>Change the indeterminate mode for this progress bar. In indeterminate\n     * mode, the progress is ignored and the progress bar shows an infinite\n     * animation instead.</p>\n     * \n     * If this progress bar's style only supports indeterminate mode (such as the circular\n     * progress bars), then this will be ignored.\n     *\n     * @param indeterminate true to enable the indeterminate mode\n     */\n    setIndeterminate(indeterminate:boolean):void  {\n        if ((!this.mOnlyIndeterminate || !this.mIndeterminate) && indeterminate != this.mIndeterminate) {\n            this.mIndeterminate = indeterminate;\n            if (indeterminate) {\n                // swap between indeterminate and regular backgrounds\n                this.mCurrentDrawable = this.mIndeterminateDrawable;\n                this.startAnimation();\n            } else {\n                this.mCurrentDrawable = this.mProgressDrawable;\n                this.stopAnimation();\n            }\n        }\n    }\n\n    /**\n     * <p>Get the drawable used to draw the progress bar in\n     * indeterminate mode.</p>\n     *\n     * @return a {@link android.graphics.drawable.Drawable} instance\n     *\n     * @see #setIndeterminateDrawable(android.graphics.drawable.Drawable)\n     * @see #setIndeterminate(boolean)\n     */\n    getIndeterminateDrawable():Drawable  {\n        return this.mIndeterminateDrawable;\n    }\n\n    /**\n     * <p>Define the drawable used to draw the progress bar in\n     * indeterminate mode.</p>\n     *\n     * @param d the new drawable\n     *\n     * @see #getIndeterminateDrawable()\n     * @see #setIndeterminate(boolean)\n     */\n    setIndeterminateDrawable(d:Drawable):void  {\n        if (d != null) {\n            d.setCallback(this);\n        }\n        this.mIndeterminateDrawable = d;\n        //if (this.mIndeterminateDrawable != null && this.canResolveLayoutDirection()) {\n        //    this.mIndeterminateDrawable.setLayoutDirection(this.getLayoutDirection());\n        //}\n        if (this.mIndeterminate) {\n            this.mCurrentDrawable = d;\n            this.postInvalidate();\n        }\n    }\n\n    /**\n     * <p>Get the drawable used to draw the progress bar in\n     * progress mode.</p>\n     *\n     * @return a {@link android.graphics.drawable.Drawable} instance\n     *\n     * @see #setProgressDrawable(android.graphics.drawable.Drawable)\n     * @see #setIndeterminate(boolean)\n     */\n    getProgressDrawable():Drawable  {\n        return this.mProgressDrawable;\n    }\n\n    /**\n     * <p>Define the drawable used to draw the progress bar in\n     * progress mode.</p>\n     *\n     * @param d the new drawable\n     *\n     * @see #getProgressDrawable()\n     * @see #setIndeterminate(boolean)\n     */\n    setProgressDrawable(d:Drawable):void  {\n        let needUpdate:boolean;\n        if (this.mProgressDrawable != null && d != this.mProgressDrawable) {\n            this.mProgressDrawable.setCallback(null);\n            needUpdate = true;\n        } else {\n            needUpdate = false;\n        }\n        if (d != null) {\n            d.setCallback(this);\n            //if (this.canResolveLayoutDirection()) {\n            //    d.setLayoutDirection(this.getLayoutDirection());\n            //}\n            // Make sure the ProgressBar is always tall enough\n            let drawableHeight:number = d.getMinimumHeight();\n            if (this.mMaxHeight < drawableHeight) {\n                this.mMaxHeight = drawableHeight;\n                this.requestLayout();\n            }\n        }\n        this.mProgressDrawable = d;\n        if (!this.mIndeterminate) {\n            this.mCurrentDrawable = d;\n            this.postInvalidate();\n        }\n        if (needUpdate) {\n            this.updateDrawableBounds(this.getWidth(), this.getHeight());\n            this.updateDrawableState();\n            this.doRefreshProgress(R.id.progress, this.mProgress, false, false);\n            this.doRefreshProgress(R.id.secondaryProgress, this.mSecondaryProgress, false, false);\n        }\n    }\n\n    /**\n     * @return The drawable currently used to draw the progress bar\n     */\n    getCurrentDrawable():Drawable  {\n        return this.mCurrentDrawable;\n    }\n\n    protected verifyDrawable(who:Drawable):boolean  {\n        return who == this.mProgressDrawable || who == this.mIndeterminateDrawable || super.verifyDrawable(who);\n    }\n\n    jumpDrawablesToCurrentState():void  {\n        super.jumpDrawablesToCurrentState();\n        if (this.mProgressDrawable != null)\n            this.mProgressDrawable.jumpToCurrentState();\n        if (this.mIndeterminateDrawable != null)\n            this.mIndeterminateDrawable.jumpToCurrentState();\n    }\n\n    ///**\n    // * @hide\n    // */\n    //onResolveDrawables(layoutDirection:number):void  {\n    //    const d:Drawable = this.mCurrentDrawable;\n    //    if (d != null) {\n    //        d.setLayoutDirection(layoutDirection);\n    //    }\n    //    if (this.mIndeterminateDrawable != null) {\n    //        this.mIndeterminateDrawable.setLayoutDirection(layoutDirection);\n    //    }\n    //    if (this.mProgressDrawable != null) {\n    //        this.mProgressDrawable.setLayoutDirection(layoutDirection);\n    //    }\n    //}\n\n    postInvalidate():void  {\n        if (!this.mNoInvalidate) {\n            super.postInvalidate();\n        }\n    }\n\n\n    private doRefreshProgress(id:string, progress:number, fromUser:boolean, callBackToApp:boolean):void  {\n        let scale:number = this.mMax > 0 ? <number> progress / <number> this.mMax : 0;\n        const d:Drawable = this.mCurrentDrawable;\n        if (d != null) {\n            let progressDrawable:Drawable = null;\n            if (d instanceof LayerDrawable) {\n                progressDrawable = (<LayerDrawable> d).findDrawableByLayerId(id);\n                //if (progressDrawable != null && this.canResolveLayoutDirection()) {\n                //    progressDrawable.setLayoutDirection(this.getLayoutDirection());\n                //}\n            }\n            const level:number = Math.floor((scale * ProgressBar.MAX_LEVEL));\n            (progressDrawable != null ? progressDrawable : d).setLevel(level);\n        } else {\n            this.invalidate();\n        }\n        if (callBackToApp && id == R.id.progress) {\n            this.onProgressRefresh(scale, fromUser);\n        }\n    }\n\n    onProgressRefresh(scale:number, fromUser:boolean):void  {\n        //if (AccessibilityManager.getInstance(this.mContext).isEnabled()) {\n        //    this.scheduleAccessibilityEventSender();\n        //}\n    }\n\n    private refreshProgress(id:string, progress:number, fromUser:boolean):void  {\n        //if (this.mUiThreadId == Thread.currentThread().getId()) {\n            this.doRefreshProgress(id, progress, fromUser, true);\n        //} else {\n        //    if (this.mRefreshProgressRunnable == null) {\n        //        this.mRefreshProgressRunnable = new ProgressBar.RefreshProgressRunnable(this);\n        //    }\n        //    const rd:ProgressBar.RefreshData = ProgressBar.RefreshData.obtain(id, progress, fromUser);\n        //    this.mRefreshData.add(rd);\n        //    if (this.mAttached && !this.mRefreshIsPosted) {\n        //        this.post(this.mRefreshProgressRunnable);\n        //        this.mRefreshIsPosted = true;\n        //    }\n        //}\n    }\n\n    /**\n     * <p>Set the current progress to the specified value. Does not do anything\n     * if the progress bar is in indeterminate mode.</p>\n     *\n     * @param progress the new progress, between 0 and {@link #getMax()}\n     *\n     * @see #setIndeterminate(boolean)\n     * @see #isIndeterminate()\n     * @see #getProgress()\n     * @see #incrementProgressBy(int) \n     */\n    setProgress(progress:number, fromUser = false):void  {\n        if (this.mIndeterminate) {\n            return;\n        }\n        if (progress < 0) {\n            progress = 0;\n        }\n        if (progress > this.mMax) {\n            progress = this.mMax;\n        }\n        if (progress != this.mProgress) {\n            this.mProgress = progress;\n            this.refreshProgress(R.id.progress, this.mProgress, fromUser);\n        }\n    }\n\n    /**\n     * <p>\n     * Set the current secondary progress to the specified value. Does not do\n     * anything if the progress bar is in indeterminate mode.\n     * </p>\n     * \n     * @param secondaryProgress the new secondary progress, between 0 and {@link #getMax()}\n     * @see #setIndeterminate(boolean)\n     * @see #isIndeterminate()\n     * @see #getSecondaryProgress()\n     * @see #incrementSecondaryProgressBy(int)\n     */\n    setSecondaryProgress(secondaryProgress:number):void  {\n        if (this.mIndeterminate) {\n            return;\n        }\n        if (secondaryProgress < 0) {\n            secondaryProgress = 0;\n        }\n        if (secondaryProgress > this.mMax) {\n            secondaryProgress = this.mMax;\n        }\n        if (secondaryProgress != this.mSecondaryProgress) {\n            this.mSecondaryProgress = secondaryProgress;\n            this.refreshProgress(R.id.secondaryProgress, this.mSecondaryProgress, false);\n        }\n    }\n\n    /**\n     * <p>Get the progress bar's current level of progress. Return 0 when the\n     * progress bar is in indeterminate mode.</p>\n     *\n     * @return the current progress, between 0 and {@link #getMax()}\n     *\n     * @see #setIndeterminate(boolean)\n     * @see #isIndeterminate()\n     * @see #setProgress(int)\n     * @see #setMax(int)\n     * @see #getMax()\n     */\n    getProgress():number  {\n        return this.mIndeterminate ? 0 : this.mProgress;\n    }\n\n    /**\n     * <p>Get the progress bar's current level of secondary progress. Return 0 when the\n     * progress bar is in indeterminate mode.</p>\n     *\n     * @return the current secondary progress, between 0 and {@link #getMax()}\n     *\n     * @see #setIndeterminate(boolean)\n     * @see #isIndeterminate()\n     * @see #setSecondaryProgress(int)\n     * @see #setMax(int)\n     * @see #getMax()\n     */\n    getSecondaryProgress():number  {\n        return this.mIndeterminate ? 0 : this.mSecondaryProgress;\n    }\n\n    /**\n     * <p>Return the upper limit of this progress bar's range.</p>\n     *\n     * @return a positive integer\n     *\n     * @see #setMax(int)\n     * @see #getProgress()\n     * @see #getSecondaryProgress()\n     */\n    getMax():number  {\n        return this.mMax;\n    }\n\n    /**\n     * <p>Set the range of the progress bar to 0...<tt>max</tt>.</p>\n     *\n     * @param max the upper range of this progress bar\n     *\n     * @see #getMax()\n     * @see #setProgress(int) \n     * @see #setSecondaryProgress(int) \n     */\n    setMax(max:number):void  {\n        if (max < 0) {\n            max = 0;\n        }\n        if (max != this.mMax) {\n            this.mMax = max;\n            this.postInvalidate();\n            if (this.mProgress > max) {\n                this.mProgress = max;\n            }\n            this.refreshProgress(R.id.progress, this.mProgress, false);\n        }\n    }\n\n    /**\n     * <p>Increase the progress bar's progress by the specified amount.</p>\n     *\n     * @param diff the amount by which the progress must be increased\n     *\n     * @see #setProgress(int) \n     */\n    incrementProgressBy(diff:number):void  {\n        this.setProgress(this.mProgress + diff);\n    }\n\n    /**\n     * <p>Increase the progress bar's secondary progress by the specified amount.</p>\n     *\n     * @param diff the amount by which the secondary progress must be increased\n     *\n     * @see #setSecondaryProgress(int) \n     */\n    incrementSecondaryProgressBy(diff:number):void  {\n        this.setSecondaryProgress(this.mSecondaryProgress + diff);\n    }\n\n    /**\n     * <p>Start the indeterminate progress animation.</p>\n     */\n    startAnimation():void  {\n        if (this.getVisibility() != ProgressBar.VISIBLE) {\n            return;\n        }\n        if (Animatable.isImpl(this.mIndeterminateDrawable)) {\n            this.mShouldStartAnimationDrawable = true;\n            this.mHasAnimation = false;\n        } else {\n            this.mHasAnimation = true;\n            if (this.mInterpolator == null) {\n                this.mInterpolator = new LinearInterpolator();\n            }\n            if (this.mTransformation == null) {\n                this.mTransformation = new Transformation();\n            } else {\n                this.mTransformation.clear();\n            }\n            if (this.mAnimation == null) {\n                this.mAnimation = new AlphaAnimation(0.0, 1.0);\n            } else {\n                this.mAnimation.reset();\n            }\n            this.mAnimation.setRepeatMode(this.mBehavior);\n            this.mAnimation.setRepeatCount(Animation.INFINITE);\n            this.mAnimation.setDuration(this.mDuration);\n            this.mAnimation.setInterpolator(this.mInterpolator);\n            this.mAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);\n        }\n        this.postInvalidate();\n    }\n\n    /**\n     * <p>Stop the indeterminate progress animation.</p>\n     */\n    stopAnimation():void  {\n        this.mHasAnimation = false;\n        if (Animatable.isImpl(this.mIndeterminateDrawable)) {\n            (<Animatable><any>this.mIndeterminateDrawable).stop();\n            this.mShouldStartAnimationDrawable = false;\n        }\n        this.postInvalidate();\n    }\n\n    ///**\n    // * Sets the acceleration curve for the indeterminate animation.\n    // * The interpolator is loaded as a resource from the specified context.\n    // *\n    // * @param context The application environment\n    // * @param resID The resource identifier of the interpolator to load\n    // */\n    //setInterpolator(context:Context, resID:number):void  {\n    //    this.setInterpolator(AnimationUtils.loadInterpolator(context, resID));\n    //}\n\n    /**\n     * Sets the acceleration curve for the indeterminate animation.\n     * Defaults to a linear interpolation.\n     *\n     * @param interpolator The interpolator which defines the acceleration curve\n     */\n    setInterpolator(interpolator:Interpolator):void  {\n        this.mInterpolator = interpolator;\n    }\n\n    /**\n     * Gets the acceleration curve type for the indeterminate animation.\n     *\n     * @return the {@link Interpolator} associated to this animation\n     */\n    getInterpolator():Interpolator  {\n        return this.mInterpolator;\n    }\n\n    setVisibility(v:number):void  {\n        if (this.getVisibility() != v) {\n            super.setVisibility(v);\n            if (this.mIndeterminate) {\n                // let's be nice with the UI thread\n                if (v == ProgressBar.GONE || v == ProgressBar.INVISIBLE) {\n                    this.stopAnimation();\n                } else {\n                    this.startAnimation();\n                }\n            }\n        }\n    }\n\n    protected onVisibilityChanged(changedView:View, visibility:number):void  {\n        super.onVisibilityChanged(changedView, visibility);\n        if (this.mIndeterminate) {\n            // let's be nice with the UI thread\n            if (visibility == ProgressBar.GONE || visibility == ProgressBar.INVISIBLE) {\n                this.stopAnimation();\n            } else {\n                this.startAnimation();\n            }\n        }\n    }\n\n    invalidateDrawable(dr:Drawable):void  {\n        if (!this.mInDrawing) {\n            if (this.verifyDrawable(dr)) {\n                const dirty:Rect = dr.getBounds();\n                const scrollX:number = this.mScrollX + this.mPaddingLeft;\n                const scrollY:number = this.mScrollY + this.mPaddingTop;\n                this.invalidate(dirty.left + scrollX, dirty.top + scrollY, dirty.right + scrollX, dirty.bottom + scrollY);\n            } else {\n                super.invalidateDrawable(dr);\n            }\n        }\n    }\n\n    protected onSizeChanged(w:number, h:number, oldw:number, oldh:number):void  {\n        this.updateDrawableBounds(w, h);\n    }\n\n    private updateDrawableBounds(w:number, h:number):void  {\n        // onDraw will translate the canvas so we draw starting at 0,0.\n        // Subtract out padding for the purposes of the calculations below.\n        w -= this.mPaddingRight + this.mPaddingLeft;\n        h -= this.mPaddingTop + this.mPaddingBottom;\n        let right:number = w;\n        let bottom:number = h;\n        let top:number = 0;\n        let left:number = 0;\n        if (this.mIndeterminateDrawable != null) {\n            // Aspect ratio logic does not apply to AnimationDrawables\n            if (this.mOnlyIndeterminate && !(this.mIndeterminateDrawable instanceof AnimationDrawable)) {\n                // Maintain aspect ratio. Certain kinds of animated drawables\n                // get very confused otherwise.\n                const intrinsicWidth:number = this.mIndeterminateDrawable.getIntrinsicWidth();\n                const intrinsicHeight:number = this.mIndeterminateDrawable.getIntrinsicHeight();\n                const intrinsicAspect:number = <number> intrinsicWidth / intrinsicHeight;\n                const boundAspect:number = <number> w / h;\n                if (intrinsicAspect != boundAspect) {\n                    if (boundAspect > intrinsicAspect) {\n                        // New width is larger. Make it smaller to match height.\n                        const width:number = Math.floor((h * intrinsicAspect));\n                        left = (w - width) / 2;\n                        right = left + width;\n                    } else {\n                        // New height is larger. Make it smaller to match width.\n                        const height:number = Math.floor((w * (1 / intrinsicAspect)));\n                        top = (h - height) / 2;\n                        bottom = top + height;\n                    }\n                }\n            }\n            if (this.isLayoutRtl() && this.mMirrorForRtl) {\n                let tempLeft:number = left;\n                left = w - right;\n                right = w - tempLeft;\n            }\n            this.mIndeterminateDrawable.setBounds(left, top, right, bottom);\n        }\n        if (this.mProgressDrawable != null) {\n            this.mProgressDrawable.setBounds(0, 0, right, bottom);\n        }\n    }\n\n    protected onDraw(canvas:Canvas):void  {\n        super.onDraw(canvas);\n        let d:Drawable = this.mCurrentDrawable;\n        if (d != null) {\n            // Translate canvas so a indeterminate circular progress bar with padding\n            // rotates properly in its animation\n            canvas.save();\n            if (this.isLayoutRtl() && this.mMirrorForRtl) {\n                canvas.translate(this.getWidth() - this.mPaddingRight, this.mPaddingTop);\n                canvas.scale(-1.0, 1.0);\n            } else {\n                canvas.translate(this.mPaddingLeft, this.mPaddingTop);\n            }\n            let time:number = this.getDrawingTime();\n            if (this.mHasAnimation) {\n                this.mAnimation.getTransformation(time, this.mTransformation);\n                let scale:number = this.mTransformation.getAlpha();\n                try {\n                    this.mInDrawing = true;\n                    d.setLevel(Math.floor((scale * ProgressBar.MAX_LEVEL)));\n                } finally {\n                    this.mInDrawing = false;\n                }\n                this.postInvalidateOnAnimation();\n            }\n            d.draw(canvas);\n            canvas.restore();\n            if (this.mShouldStartAnimationDrawable && Animatable.isImpl(d) ) {\n                (<Animatable><any>d).start();\n                this.mShouldStartAnimationDrawable = false;\n            }\n        }\n    }\n\n    protected onMeasure(widthMeasureSpec:number, heightMeasureSpec:number):void  {\n        let d:Drawable = this.mCurrentDrawable;\n        let dw:number = 0;\n        let dh:number = 0;\n        if (d != null) {\n            dw = Math.max(this.mMinWidth, Math.min(this.mMaxWidth, d.getIntrinsicWidth()));\n            dh = Math.max(this.mMinHeight, Math.min(this.mMaxHeight, d.getIntrinsicHeight()));\n        }\n        this.updateDrawableState();\n        dw += this.mPaddingLeft + this.mPaddingRight;\n        dh += this.mPaddingTop + this.mPaddingBottom;\n        this.setMeasuredDimension(ProgressBar.resolveSizeAndState(dw, widthMeasureSpec, 0), ProgressBar.resolveSizeAndState(dh, heightMeasureSpec, 0));\n    }\n\n    protected drawableStateChanged():void  {\n        super.drawableStateChanged();\n        this.updateDrawableState();\n    }\n\n    private updateDrawableState():void  {\n        let state:number[] = this.getDrawableState();\n        if (this.mProgressDrawable != null && this.mProgressDrawable.isStateful()) {\n            this.mProgressDrawable.setState(state);\n        }\n        if (this.mIndeterminateDrawable != null && this.mIndeterminateDrawable.isStateful()) {\n            this.mIndeterminateDrawable.setState(state);\n        }\n    }\n\n\n\n    protected onAttachedToWindow():void  {\n        super.onAttachedToWindow();\n        if (this.mIndeterminate) {\n            this.startAnimation();\n        }\n        if (this.mRefreshData != null) {\n            {\n                const count:number = this.mRefreshData.size();\n                for (let i:number = 0; i < count; i++) {\n                    const rd:ProgressBar.RefreshData = this.mRefreshData.get(i);\n                    this.doRefreshProgress(rd.id, rd.progress, rd.fromUser, true);\n                    rd.recycle();\n                }\n                this.mRefreshData.clear();\n            }\n        }\n        this.mAttached = true;\n    }\n\n    protected onDetachedFromWindow():void  {\n        if (this.mIndeterminate) {\n            this.stopAnimation();\n        }\n        //if (this.mRefreshProgressRunnable != null) {\n        //    this.removeCallbacks(this.mRefreshProgressRunnable);\n        //}\n        //if (this.mRefreshProgressRunnable != null && this.mRefreshIsPosted) {\n        //    this.removeCallbacks(this.mRefreshProgressRunnable);\n        //}\n        //if (this.mAccessibilityEventSender != null) {\n        //    this.removeCallbacks(this.mAccessibilityEventSender);\n        //}\n        // This should come after stopAnimation(), otherwise an invalidate message remains in the\n        // queue, which can prevent the entire view hierarchy from being GC'ed during a rotation\n        super.onDetachedFromWindow();\n        this.mAttached = false;\n    }\n\n\n}\n\nexport module ProgressBar{\n//export class RefreshProgressRunnable implements Runnable {\n//    _ProgressBar_this:ProgressBar;\n//    constructor(arg:ProgressBar){\n//        this._ProgressBar_this = arg;\n//    }\n//\n//    run():void  {\n//        {\n//            const count:number = this._ProgressBar_this.mRefreshData.size();\n//            for (let i:number = 0; i < count; i++) {\n//                const rd:ProgressBar.RefreshData = this._ProgressBar_this.mRefreshData.get(i);\n//                this._ProgressBar_this.doRefreshProgress(rd.id, rd.progress, rd.fromUser, true);\n//                rd.recycle();\n//            }\n//            this._ProgressBar_this.mRefreshData.clear();\n//            this._ProgressBar_this.mRefreshIsPosted = false;\n//        }\n//    }\n//}\nexport class RefreshData {\n\n    private static POOL_MAX:number = 24;\n\n    private static sPool:SynchronizedPool<RefreshData> = new SynchronizedPool<RefreshData>(RefreshData.POOL_MAX);\n\n    id:string;\n\n    progress:number = 0;\n\n    fromUser:boolean;\n\n    static obtain(id:string, progress:number, fromUser:boolean):RefreshData  {\n        let rd:RefreshData = RefreshData.sPool.acquire();\n        if (rd == null) {\n            rd = new RefreshData();\n        }\n        rd.id = id;\n        rd.progress = progress;\n        rd.fromUser = fromUser;\n        return rd;\n    }\n\n    recycle():void  {\n        RefreshData.sPool.release(this);\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/widget/RadioButton.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/widget/Button.ts\"/>\n///<reference path=\"../../android/widget/CheckBox.ts\"/>\n///<reference path=\"../../android/widget/CompoundButton.ts\"/>\n///<reference path=\"../../android/widget/TextView.ts\"/>\n\nmodule android.widget {\nimport Button = android.widget.Button;\nimport CheckBox = android.widget.CheckBox;\nimport CompoundButton = android.widget.CompoundButton;\nimport TextView = android.widget.TextView;\n/**\n * <p>\n * A radio button is a two-states button that can be either checked or\n * unchecked. When the radio button is unchecked, the user can press or click it\n * to check it. However, contrary to a {@link android.widget.CheckBox}, a radio\n * button cannot be unchecked by the user once checked.\n * </p>\n *\n * <p>\n * Radio buttons are normally used together in a\n * {@link android.widget.RadioGroup}. When several radio buttons live inside\n * a radio group, checking one radio button unchecks all the others.</p>\n * </p>\n *\n * <p>See the <a href=\"{@docRoot}guide/topics/ui/controls/radiobutton.html\">Radio Buttons</a>\n * guide.</p>\n *\n * <p><strong>XML attributes</strong></p>\n * <p> \n * See {@link android.R.styleable#CompoundButton CompoundButton Attributes}, \n * {@link android.R.styleable#Button Button Attributes}, \n * {@link android.R.styleable#TextView TextView Attributes}, \n * {@link android.R.styleable#View View Attributes}\n * </p>\n */\nexport class RadioButton extends CompoundButton {\n\n    constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle = android.R.attr.radiobuttonStyle) {\n        super(context, bindElement, defStyle);\n    }\n\n    /**\n     * {@inheritDoc}\n     * <p>\n     * If the radio button is already checked, this method will not toggle the radio button.\n     */\n    toggle():void  {\n        // checked (as opposed to check boxes widgets)\n        if (!this.isChecked()) {\n            super.toggle();\n        }\n    }\n}\n}"
  },
  {
    "path": "src/android/widget/RadioGroup.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/widget/Button.ts\"/>\n///<reference path=\"../../android/widget/CompoundButton.ts\"/>\n///<reference path=\"../../android/widget/LinearLayout.ts\"/>\n///<reference path=\"../../android/widget/RadioButton.ts\"/>\n\nmodule android.widget {\nimport View = android.view.View;\nimport ViewGroup = android.view.ViewGroup;\nimport Button = android.widget.Button;\nimport CompoundButton = android.widget.CompoundButton;\nimport LinearLayout = android.widget.LinearLayout;\nimport RadioButton = android.widget.RadioButton;\n    import AttrBinder = androidui.attr.AttrBinder;\n/**\n * <p>This class is used to create a multiple-exclusion scope for a set of radio\n * buttons. Checking one radio button that belongs to a radio group unchecks\n * any previously checked radio button within the same group.</p>\n *\n * <p>Intially, all of the radio buttons are unchecked. While it is not possible\n * to uncheck a particular radio button, the radio group can be cleared to\n * remove the checked state.</p>\n *\n * <p>The selection is identified by the unique id of the radio button as defined\n * in the XML layout file.</p>\n *\n * <p><strong>XML Attributes</strong></p>\n * <p>See {@link android.R.styleable#RadioGroup RadioGroup Attributes}, \n * {@link android.R.styleable#LinearLayout LinearLayout Attributes},\n * {@link android.R.styleable#ViewGroup ViewGroup Attributes},\n * {@link android.R.styleable#View View Attributes}</p>\n * <p>Also see\n * {@link android.widget.LinearLayout.LayoutParams LinearLayout.LayoutParams}\n * for layout attributes.</p>\n * \n * @see RadioButton\n *\n */\nexport class RadioGroup extends LinearLayout {\n\n    // holds the checked id; the selection is empty by default\n    private mCheckedId:string = View.NO_ID;\n\n    // tracks children radio buttons checked state\n    private mChildOnCheckedChangeListener:CompoundButton.OnCheckedChangeListener;\n\n    // when true, mOnCheckedChangeListener discards events\n    private mProtectFromCheckedChange:boolean = false;\n\n    private mOnCheckedChangeListener:RadioGroup.OnCheckedChangeListener;\n\n    private mPassThroughListener:RadioGroup.PassThroughHierarchyChangeListener;\n\n    constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n        super(context, bindElement, defStyle);\n\n        // retrieve selected radio button as requested by the user in the\n        // XML layout file\n        let attributes = context.obtainStyledAttributes(\n            bindElement, defStyle);\n\n        let value = attributes.getString('checkedButton');\n        if (value) {\n            this.mCheckedId = value;\n        }\n\n        const orientation = attributes.getString('orientation');\n        if (orientation === 'horizontal') {\n            this.setOrientation(RadioGroup.HORIZONTAL);\n        } else {\n            this.setOrientation(RadioGroup.VERTICAL);\n        }\n\n        attributes.recycle();\n\n        this.init();\n    }\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder().set('checkedButton', {\n            setter(v:RadioGroup, value:any) {\n                if (typeof value === 'string' || value == null) {\n                    v.setCheckedId(value);\n                }\n            }\n        });\n    }\n\n    private init():void  {\n        this.mChildOnCheckedChangeListener = new RadioGroup.CheckedStateTracker(this);\n        this.mPassThroughListener = new RadioGroup.PassThroughHierarchyChangeListener(this);\n        super.setOnHierarchyChangeListener(this.mPassThroughListener);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    setOnHierarchyChangeListener(listener:ViewGroup.OnHierarchyChangeListener):void  {\n        // the user listener is delegated to our pass-through listener\n        this.mPassThroughListener.mOnHierarchyChangeListener = listener;\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    protected onFinishInflate():void  {\n        super.onFinishInflate();\n        // checks the appropriate radio button as requested in the XML file\n        if (this.mCheckedId != null) {\n            this.mProtectFromCheckedChange = true;\n            this.setCheckedStateForView(this.mCheckedId, true);\n            this.mProtectFromCheckedChange = false;\n            this.setCheckedId(this.mCheckedId);\n        }\n    }\n\n    addView(...args) {\n        let child = <View>args[0];\n        if (child instanceof RadioButton) {\n            const button:RadioButton = <RadioButton> child;\n            if (button.isChecked()) {\n                this.mProtectFromCheckedChange = true;\n                if (this.mCheckedId != null) {\n                    this.setCheckedStateForView(this.mCheckedId, false);\n                }\n                this.mProtectFromCheckedChange = false;\n                this.setCheckedId(button.getId());\n            }\n        }\n        super.addView(...args);\n    }\n\n    /**\n     * <p>Sets the selection to the radio button whose identifier is passed in\n     * parameter. Using -1 as the selection identifier clears the selection;\n     * such an operation is equivalent to invoking {@link #clearCheck()}.</p>\n     *\n     * @param id the unique id of the radio button to select in this group\n     *\n     * @see #getCheckedRadioButtonId()\n     * @see #clearCheck()\n     */\n    check(id:string):void  {\n        // don't even bother\n        if (id != null && (id == this.mCheckedId)) {\n            return;\n        }\n        if (this.mCheckedId != null) {\n            this.setCheckedStateForView(this.mCheckedId, false);\n        }\n        if (id != null) {\n            this.setCheckedStateForView(id, true);\n        }\n        this.setCheckedId(id);\n    }\n\n    private setCheckedId(id:string):void  {\n        this.mCheckedId = id;\n        if (this.mOnCheckedChangeListener != null) {\n            this.mOnCheckedChangeListener.onCheckedChanged(this, this.mCheckedId);\n        }\n    }\n\n    private setCheckedStateForView(viewId:string, checked:boolean):void  {\n        let checkedView:View = this.findViewById(viewId);\n        if (checkedView != null && checkedView instanceof RadioButton) {\n            (<RadioButton> checkedView).setChecked(checked);\n        }\n    }\n\n    /**\n     * <p>Returns the identifier of the selected radio button in this group.\n     * Upon empty selection, the returned value is -1.</p>\n     *\n     * @return the unique id of the selected radio button in this group\n     *\n     * @see #check(int)\n     * @see #clearCheck()\n     *\n     * @attr ref android.R.styleable#RadioGroup_checkedButton\n     */\n    getCheckedRadioButtonId():string  {\n        return this.mCheckedId;\n    }\n\n    /**\n     * <p>Clears the selection. When the selection is cleared, no radio button\n     * in this group is selected and {@link #getCheckedRadioButtonId()} returns\n     * null.</p>\n     *\n     * @see #check(int)\n     * @see #getCheckedRadioButtonId()\n     */\n    clearCheck():void  {\n        this.check(null);\n    }\n\n    /**\n     * <p>Register a callback to be invoked when the checked radio button\n     * changes in this group.</p>\n     *\n     * @param listener the callback to call on checked state change\n     */\n    setOnCheckedChangeListener(listener:RadioGroup.OnCheckedChangeListener):void  {\n        this.mOnCheckedChangeListener = listener;\n    }\n\n    public generateLayoutParamsFromAttr(attrs: HTMLElement): android.view.ViewGroup.LayoutParams {\n        return new RadioGroup.LayoutParams(this.getContext(), attrs);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    protected checkLayoutParams(p:ViewGroup.LayoutParams):boolean  {\n        return p instanceof RadioGroup.LayoutParams;\n    }\n\n    protected generateDefaultLayoutParams():LinearLayout.LayoutParams  {\n        return new RadioGroup.LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT);\n    }\n\n}\n\nexport module RadioGroup{\nexport class LayoutParams extends LinearLayout.LayoutParams {\n\n    protected setBaseAttributes(a: android.content.res.TypedArray, widthAttr: string, heightAttr: string): void {\n        if (a.hasValue(widthAttr)) {\n            this.width = a.getLayoutDimension(widthAttr, LayoutParams.WRAP_CONTENT);\n        } else {\n            this.width = LayoutParams.WRAP_CONTENT;\n        }\n\n        if (a.hasValue(heightAttr)) {\n            this.height = a.getLayoutDimension(heightAttr, LayoutParams.WRAP_CONTENT);\n        } else {\n            this.height = LayoutParams.WRAP_CONTENT;\n        }\n    }\n}\n/**\n     * <p>Interface definition for a callback to be invoked when the checked\n     * radio button changed in this group.</p>\n     */\nexport interface OnCheckedChangeListener {\n\n    /**\n         * <p>Called when the checked radio button has changed. When the\n         * selection is cleared, checkedId is -1.</p>\n         *\n         * @param group the group in which the checked radio button has changed\n         * @param checkedId the unique identifier of the newly checked radio button\n         */\n    onCheckedChanged(group:RadioGroup, checkedId:string):void ;\n}\nexport class CheckedStateTracker implements CompoundButton.OnCheckedChangeListener {\n    _RadioGroup_this:RadioGroup;\n    constructor(arg:RadioGroup){\n        this._RadioGroup_this = arg;\n    }\n\n    onCheckedChanged(buttonView:CompoundButton, isChecked:boolean):void  {\n        // prevents from infinite recursion\n        if (this._RadioGroup_this.mProtectFromCheckedChange) {\n            return;\n        }\n        this._RadioGroup_this.mProtectFromCheckedChange = true;\n        if (this._RadioGroup_this.mCheckedId != null) {\n            this._RadioGroup_this.setCheckedStateForView(this._RadioGroup_this.mCheckedId, false);\n        }\n        this._RadioGroup_this.mProtectFromCheckedChange = false;\n        let id:string = buttonView.getId();\n        this._RadioGroup_this.setCheckedId(id);\n    }\n}\n/**\n     * <p>A pass-through listener acts upon the events and dispatches them\n     * to another listener. This allows the table layout to set its own internal\n     * hierarchy change listener without preventing the user to setup his.</p>\n     */\nexport class PassThroughHierarchyChangeListener implements ViewGroup.OnHierarchyChangeListener {\n    _RadioGroup_this:RadioGroup;\n    constructor(arg:RadioGroup){\n        this._RadioGroup_this = arg;\n    }\n\n    private mOnHierarchyChangeListener:ViewGroup.OnHierarchyChangeListener;\n\n    onChildViewAdded(parent:View, child:View):void  {\n        if (parent == this._RadioGroup_this && child instanceof RadioButton) {\n            let id:string = child.getId();\n            // generates an id if it's missing\n            if (id == View.NO_ID) {\n                id = 'hash' + child.hashCode();//View.generateViewId();\n                child.setId(id);\n            }\n            (<RadioButton> child).setOnCheckedChangeWidgetListener(this._RadioGroup_this.mChildOnCheckedChangeListener);\n        }\n        if (this.mOnHierarchyChangeListener != null) {\n            this.mOnHierarchyChangeListener.onChildViewAdded(parent, child);\n        }\n    }\n\n    onChildViewRemoved(parent:View, child:View):void  {\n        if (parent == this._RadioGroup_this && child instanceof RadioButton) {\n            (<RadioButton> child).setOnCheckedChangeWidgetListener(null);\n        }\n        if (this.mOnHierarchyChangeListener != null) {\n            this.mOnHierarchyChangeListener.onChildViewRemoved(parent, child);\n        }\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/widget/RatingBar.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/widget/AbsSeekBar.ts\"/>\n///<reference path=\"../../android/widget/ProgressBar.ts\"/>\n///<reference path=\"../../android/widget/SeekBar.ts\"/>\n\nmodule android.widget {\nimport AbsSeekBar = android.widget.AbsSeekBar;\nimport ProgressBar = android.widget.ProgressBar;\nimport SeekBar = android.widget.SeekBar;\n    import AttrBinder = androidui.attr.AttrBinder;\n/**\n * A RatingBar is an extension of SeekBar and ProgressBar that shows a rating in\n * stars. The user can touch/drag or use arrow keys to set the rating when using\n * the default size RatingBar. The smaller RatingBar style (\n * {@link android.R.attr#ratingBarStyleSmall}) and the larger indicator-only\n * style ({@link android.R.attr#ratingBarStyleIndicator}) do not support user\n * interaction and should only be used as indicators.\n * <p>\n * When using a RatingBar that supports user interaction, placing widgets to the\n * left or right of the RatingBar is discouraged.\n * <p>\n * The number of stars set (via {@link #setNumStars(int)} or in an XML layout)\n * will be shown when the layout width is set to wrap content (if another layout\n * width is set, the results may be unpredictable).\n * <p>\n * The secondary progress should not be modified by the client as it is used\n * internally as the background for a fractionally filled star.\n * \n * @attr ref android.R.styleable#RatingBar_numStars\n * @attr ref android.R.styleable#RatingBar_rating\n * @attr ref android.R.styleable#RatingBar_stepSize\n * @attr ref android.R.styleable#RatingBar_isIndicator\n */\nexport class RatingBar extends AbsSeekBar {\n\n\n\n    private mNumStars:number = 5;\n\n    private mProgressOnStartTracking:number = 0;\n\n    private mOnRatingBarChangeListener:RatingBar.OnRatingBarChangeListener;\n\n\n    constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle=android.R.attr.ratingBarStyle) {\n        super(context, bindElement, defStyle);\n\n        const a = context.obtainStyledAttributes(bindElement, defStyle);\n        const numStars = a.getInt('numStars', this.mNumStars);\n        this.setIsIndicator(a.getBoolean('isIndicator', !this.mIsUserSeekable));\n        const rating = a.getFloat('rating', -1);\n        const stepSize = a.getFloat('stepSize', -1);\n        a.recycle();\n\n        if (numStars > 0 && numStars != this.mNumStars) {\n            this.setNumStars(numStars);\n        }\n\n        if (stepSize >= 0) {\n            this.setStepSize(stepSize);\n        } else {\n            this.setStepSize(0.5);\n        }\n\n        if (rating >= 0) {\n            this.setRating(rating);\n        }\n\n        // A touch inside a star fill up to that fractional area (slightly more\n        // than 1 so boundaries round up).\n        this.mTouchProgressOffset = 1.1;\n\n    }\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder().set('numStars', {\n            setter(v:RatingBar, value:any, a:AttrBinder) {\n                v.setNumStars(a.parseInt(value, v.mNumStars));\n            }, getter(v:RatingBar) {\n                return v.mNumStars;\n            }\n        }).set('isIndicator', {\n            setter(v:RatingBar, value:any, a:AttrBinder) {\n                v.setIsIndicator(a.parseBoolean(value, !v.mIsUserSeekable));\n            }, getter(v:RatingBar) {\n                return v.isIndicator();\n            }\n        }).set('stepSize', {\n            setter(v:RatingBar, value:any, a:AttrBinder) {\n                v.setStepSize(a.parseFloat(value, 0.5));\n            }, getter(v:RatingBar) {\n                return v.getStepSize();\n            }\n        }).set('rating', {\n            setter(v:RatingBar, value:any, a:AttrBinder) {\n                v.setRating(a.parseFloat(value, v.getRating()));\n            }, getter(v:RatingBar) {\n                return v.getRating();\n            }\n        });\n    }\n\n//constructor( context:Context, attrs:AttributeSet, defStyle:number) {\n    //    super(context, attrs, defStyle);\n    //    let a:TypedArray = context.obtainStyledAttributes(attrs, R.styleable.RatingBar, defStyle, 0);\n    //    const numStars:number = a.getInt(R.styleable.RatingBar_numStars, this.mNumStars);\n    //    this.setIsIndicator(a.getBoolean(R.styleable.RatingBar_isIndicator, !this.mIsUserSeekable));\n    //    const rating:number = a.getFloat(R.styleable.RatingBar_rating, -1);\n    //    const stepSize:number = a.getFloat(R.styleable.RatingBar_stepSize, -1);\n    //    a.recycle();\n    //    if (numStars > 0 && numStars != this.mNumStars) {\n    //        this.setNumStars(numStars);\n    //    }\n    //    if (stepSize >= 0) {\n    //        this.setStepSize(stepSize);\n    //    } else {\n    //        this.setStepSize(0.5);\n    //    }\n    //    if (rating >= 0) {\n    //        this.setRating(rating);\n    //    }\n    //    // A touch inside a star fill up to that fractional area (slightly more\n    //    // than 1 so boundaries round up).\n    //    this.mTouchProgressOffset = 1.1;\n    //}\n\n    /**\n     * Sets the listener to be called when the rating changes.\n     * \n     * @param listener The listener.\n     */\n    setOnRatingBarChangeListener(listener:RatingBar.OnRatingBarChangeListener):void  {\n        this.mOnRatingBarChangeListener = listener;\n    }\n\n    /**\n     * @return The listener (may be null) that is listening for rating change\n     *         events.\n     */\n    getOnRatingBarChangeListener():RatingBar.OnRatingBarChangeListener  {\n        return this.mOnRatingBarChangeListener;\n    }\n\n    /**\n     * Whether this rating bar should only be an indicator (thus non-changeable\n     * by the user).\n     * \n     * @param isIndicator Whether it should be an indicator.\n     *\n     * @attr ref android.R.styleable#RatingBar_isIndicator\n     */\n    setIsIndicator(isIndicator:boolean):void  {\n        this.mIsUserSeekable = !isIndicator;\n        this.setFocusable(!isIndicator);\n    }\n\n    /**\n     * @return Whether this rating bar is only an indicator.\n     *\n     * @attr ref android.R.styleable#RatingBar_isIndicator\n     */\n    isIndicator():boolean  {\n        return !this.mIsUserSeekable;\n    }\n\n    /**\n     * Sets the number of stars to show. In order for these to be shown\n     * properly, it is recommended the layout width of this widget be wrap\n     * content.\n     * \n     * @param numStars The number of stars.\n     */\n    setNumStars(numStars:number):void  {\n        if (numStars <= 0) {\n            return;\n        }\n        let step = this.getStepSize();\n        this.mNumStars = numStars;\n        this.setStepSize(step);\n\n        // This causes the width to change, so re-layout\n        this.requestLayout();\n\n    }\n\n    /**\n     * Returns the number of stars shown.\n     * @return The number of stars shown.\n     */\n    getNumStars():number  {\n        return this.mNumStars;\n    }\n\n    /**\n     * Sets the rating (the number of stars filled).\n     * \n     * @param rating The rating to set.\n     */\n    setRating(rating:number):void  {\n        this.setProgress(Math.round(rating * this.getProgressPerStar()));\n    }\n\n    /**\n     * Gets the current rating (number of stars filled).\n     * \n     * @return The current rating.\n     */\n    getRating():number  {\n        return this.getProgress() / this.getProgressPerStar();\n    }\n\n    /**\n     * Sets the step size (granularity) of this rating bar.\n     * \n     * @param stepSize The step size of this rating bar. For example, if\n     *            half-star granularity is wanted, this would be 0.5.\n     */\n    setStepSize(stepSize:number):void  {\n        if (Number.isNaN(stepSize) || !Number.isFinite(stepSize) || stepSize <= 0) {\n            return;\n        }\n        const newMax:number = this.mNumStars / stepSize;\n        let newProgress:number = Math.floor((newMax / this.getMax() * this.getProgress()));\n        if(Number.isNaN(newProgress)) newProgress = 0;\n        this.setMax(Math.floor(newMax));\n        this.setProgress(newProgress);\n    }\n\n    /**\n     * Gets the step size of this rating bar.\n     * \n     * @return The step size.\n     */\n    getStepSize():number  {\n        return <number> this.getNumStars() / this.getMax();\n    }\n\n    /**\n     * @return The amount of progress that fits into a star\n     */\n    private getProgressPerStar():number  {\n        if (this.mNumStars > 0) {\n            return 1 * this.getMax() / this.mNumStars;\n        } else {\n            return 1;\n        }\n    }\n\n    //getDrawableShape():Shape  {\n    //    // TODO: Once ProgressBar's TODOs are fixed, this won't be needed\n    //    return new RectShape();\n    //}\n\n    onProgressRefresh(scale:number, fromUser:boolean):void  {\n        super.onProgressRefresh(scale, fromUser);\n        // Keep secondary progress in sync with primary\n        this.updateSecondaryProgress(this.getProgress());\n        if (!fromUser) {\n            // Callback for non-user rating changes\n            this.dispatchRatingChange(false);\n        }\n    }\n\n    /**\n     * The secondary progress is used to differentiate the background of a\n     * partially filled star. This method keeps the secondary progress in sync\n     * with the progress.\n     * \n     * @param progress The primary progress level.\n     */\n    private updateSecondaryProgress(progress:number):void  {\n        const ratio:number = this.getProgressPerStar();\n        if (ratio > 0) {\n            const progressInStars:number = progress / ratio;\n            const secondaryProgress:number = Math.floor((Math.ceil(progressInStars) * ratio));\n            this.setSecondaryProgress(secondaryProgress);\n        }\n    }\n\n    protected onMeasure(widthMeasureSpec:number, heightMeasureSpec:number):void  {\n        super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n        if (this.mSampleTile != null) {\n            // TODO: Once ProgressBar's TODOs are gone, this can be done more\n            // cleanly than mSampleTile\n            const width:number = this.mSampleTile.getIntrinsicWidth() * this.mNumStars;\n            this.setMeasuredDimension(RatingBar.resolveSizeAndState(width, widthMeasureSpec, 0), this.getMeasuredHeight());\n        }\n    }\n\n    onStartTrackingTouch():void  {\n        this.mProgressOnStartTracking = this.getProgress();\n        super.onStartTrackingTouch();\n    }\n\n    onStopTrackingTouch():void  {\n        super.onStopTrackingTouch();\n        if (this.getProgress() != this.mProgressOnStartTracking) {\n            this.dispatchRatingChange(true);\n        }\n    }\n\n    onKeyChange():void  {\n        super.onKeyChange();\n        this.dispatchRatingChange(true);\n    }\n\n    dispatchRatingChange(fromUser:boolean):void  {\n        if (this.mOnRatingBarChangeListener != null) {\n            this.mOnRatingBarChangeListener.onRatingChanged(this, this.getRating(), fromUser);\n        }\n    }\n\n    setMax(max:number):void  {\n        // Disallow max progress = 0\n        if (max <= 0) {\n            return;\n        }\n        super.setMax(max);\n    }\n}\n\nexport module RatingBar{\n/**\n     * A callback that notifies clients when the rating has been changed. This\n     * includes changes that were initiated by the user through a touch gesture\n     * or arrow key/trackball as well as changes that were initiated\n     * programmatically.\n     */\nexport interface OnRatingBarChangeListener {\n\n    /**\n         * Notification that the rating has changed. Clients can use the\n         * fromUser parameter to distinguish user-initiated changes from those\n         * that occurred programmatically. This will not be called continuously\n         * while the user is dragging, only when the user finalizes a rating by\n         * lifting the touch.\n         * \n         * @param ratingBar The RatingBar whose rating has changed.\n         * @param rating The current rating. This will be in the range\n         *            0..numStars.\n         * @param fromUser True if the rating change was initiated by a user's\n         *            touch gesture or arrow key/horizontal trackbell movement.\n         */\n    onRatingChanged(ratingBar:RatingBar, rating:number, fromUser:boolean):void ;\n}\n}\n\n}"
  },
  {
    "path": "src/android/widget/RelativeLayout.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/util/ArrayMap.ts\"/>\n///<reference path=\"../../java/util/ArrayDeque.ts\"/>\n///<reference path=\"../../java/util/ArrayList.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/util/Pools.ts\"/>\n///<reference path=\"../../android/util/SparseArray.ts\"/>\n///<reference path=\"../../android/util/SparseMap.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../java/lang/System.ts\"/>\n///<reference path=\"../../android/widget/HorizontalScrollView.ts\"/>\n///<reference path=\"../../android/widget/ScrollView.ts\"/>\n\nmodule android.widget {\nimport ArrayMap = android.util.ArrayMap;\nimport ArrayDeque = java.util.ArrayDeque;\nimport ArrayList = java.util.ArrayList;\nimport Rect = android.graphics.Rect;\nimport SynchronizedPool = android.util.Pools.SynchronizedPool;\nimport SparseArray = android.util.SparseArray;\nimport SparseMap = android.util.SparseMap;\nimport Gravity = android.view.Gravity;\nimport View = android.view.View;\nimport ViewGroup = android.view.ViewGroup;\nimport Integer = java.lang.Integer;\nimport System = java.lang.System;\nimport HorizontalScrollView = android.widget.HorizontalScrollView;\nimport ScrollView = android.widget.ScrollView;\nimport AttrBinder = androidui.attr.AttrBinder;\nimport Context = android.content.Context;\n\n/**\n * A Layout where the positions of the children can be described in relation to each other or to the\n * parent.\n *\n * <p>\n * Note that you cannot have a circular dependency between the size of the RelativeLayout and the\n * position of its children. For example, you cannot have a RelativeLayout whose height is set to\n * {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT WRAP_CONTENT} and a child set to\n * {@link #ALIGN_PARENT_BOTTOM}.\n * </p>\n *\n * <p><strong>Note:</strong> In platform version 17 and lower, RelativeLayout was affected by\n * a measurement bug that could cause child views to be measured with incorrect\n * {@link android.view.View.MeasureSpec MeasureSpec} values. (See\n * {@link android.view.View.MeasureSpec#makeMeasureSpec(int, int) MeasureSpec.makeMeasureSpec}\n * for more details.) This was triggered when a RelativeLayout container was placed in\n * a scrolling container, such as a ScrollView or HorizontalScrollView. If a custom view\n * not equipped to properly measure with the MeasureSpec mode\n * {@link android.view.View.MeasureSpec#UNSPECIFIED UNSPECIFIED} was placed in a RelativeLayout,\n * this would silently work anyway as RelativeLayout would pass a very large\n * {@link android.view.View.MeasureSpec#AT_MOST AT_MOST} MeasureSpec instead.</p>\n *\n * <p>This behavior has been preserved for apps that set <code>android:targetSdkVersion=\"17\"</code>\n * or older in their manifest's <code>uses-sdk</code> tag for compatibility. Apps targeting SDK\n * version 18 or newer will receive the correct behavior</p>\n *\n * <p>See the <a href=\"{@docRoot}guide/topics/ui/layout/relative.html\">Relative\n * Layout</a> guide.</p>\n *\n * <p>\n * Also see {@link android.widget.RelativeLayout.LayoutParams RelativeLayout.LayoutParams} for\n * layout attributes\n * </p>\n *\n * @attr ref android.R.styleable#RelativeLayout_gravity\n * @attr ref android.R.styleable#RelativeLayout_ignoreGravity\n */\nexport class RelativeLayout extends ViewGroup {\n\n    static TRUE:string = \"\";\n\n    /**\n     * Rule that aligns a child's right edge with another child's left edge.\n     */\n    static LEFT_OF:number = 0;\n\n    /**\n     * Rule that aligns a child's left edge with another child's right edge.\n     */\n    static RIGHT_OF:number = 1;\n\n    /**\n     * Rule that aligns a child's bottom edge with another child's top edge.\n     */\n    static ABOVE:number = 2;\n\n    /**\n     * Rule that aligns a child's top edge with another child's bottom edge.\n     */\n    static BELOW:number = 3;\n\n    /**\n     * Rule that aligns a child's baseline with another child's baseline.\n     */\n    static ALIGN_BASELINE:number = 4;\n\n    /**\n     * Rule that aligns a child's left edge with another child's left edge.\n     */\n    static ALIGN_LEFT:number = 5;\n\n    /**\n     * Rule that aligns a child's top edge with another child's top edge.\n     */\n    static ALIGN_TOP:number = 6;\n\n    /**\n     * Rule that aligns a child's right edge with another child's right edge.\n     */\n    static ALIGN_RIGHT:number = 7;\n\n    /**\n     * Rule that aligns a child's bottom edge with another child's bottom edge.\n     */\n    static ALIGN_BOTTOM:number = 8;\n\n    /**\n     * Rule that aligns the child's left edge with its RelativeLayout\n     * parent's left edge.\n     */\n    static ALIGN_PARENT_LEFT:number = 9;\n\n    /**\n     * Rule that aligns the child's top edge with its RelativeLayout\n     * parent's top edge.\n     */\n    static ALIGN_PARENT_TOP:number = 10;\n\n    /**\n     * Rule that aligns the child's right edge with its RelativeLayout\n     * parent's right edge.\n     */\n    static ALIGN_PARENT_RIGHT:number = 11;\n\n    /**\n     * Rule that aligns the child's bottom edge with its RelativeLayout\n     * parent's bottom edge.\n     */\n    static ALIGN_PARENT_BOTTOM:number = 12;\n\n    /**\n     * Rule that centers the child with respect to the bounds of its\n     * RelativeLayout parent.\n     */\n    static CENTER_IN_PARENT:number = 13;\n\n    /**\n     * Rule that centers the child horizontally with respect to the\n     * bounds of its RelativeLayout parent.\n     */\n    static CENTER_HORIZONTAL:number = 14;\n\n    /**\n     * Rule that centers the child vertically with respect to the\n     * bounds of its RelativeLayout parent.\n     */\n    static CENTER_VERTICAL:number = 15;\n\n    /**\n     * Rule that aligns a child's end edge with another child's start edge.\n     */\n    static START_OF:number = 16;\n\n    /**\n     * Rule that aligns a child's start edge with another child's end edge.\n     */\n    static END_OF:number = 17;\n\n    /**\n     * Rule that aligns a child's start edge with another child's start edge.\n     */\n    static ALIGN_START:number = 18;\n\n    /**\n     * Rule that aligns a child's end edge with another child's end edge.\n     */\n    static ALIGN_END:number = 19;\n\n    /**\n     * Rule that aligns the child's start edge with its RelativeLayout\n     * parent's start edge.\n     */\n    static ALIGN_PARENT_START:number = 20;\n\n    /**\n     * Rule that aligns the child's end edge with its RelativeLayout\n     * parent's end edge.\n     */\n    static ALIGN_PARENT_END:number = 21;\n\n    static VERB_COUNT:number = 22;\n\n    private static RULES_VERTICAL:number[] = [ RelativeLayout.ABOVE, RelativeLayout.BELOW, RelativeLayout.ALIGN_BASELINE, RelativeLayout.ALIGN_TOP, RelativeLayout.ALIGN_BOTTOM ];\n\n    private static RULES_HORIZONTAL:number[] = [ RelativeLayout.LEFT_OF, RelativeLayout.RIGHT_OF, RelativeLayout.ALIGN_LEFT, RelativeLayout.ALIGN_RIGHT, RelativeLayout.START_OF, RelativeLayout.END_OF, RelativeLayout.ALIGN_START, RelativeLayout.ALIGN_END ];\n\n    private mBaselineView:View = null;\n\n    private mHasBaselineAlignedChild:boolean;\n\n    private mGravity:number = Gravity.START | Gravity.TOP;\n\n    private mContentBounds:Rect = new Rect();\n\n    private mSelfBounds:Rect = new Rect();\n\n    private mIgnoreGravity:string = View.NO_ID;\n\n    //private mTopToBottomLeftToRightSet:SortedSet<View> = null;\n\n    private mDirtyHierarchy:boolean;\n\n    private mSortedHorizontalChildren:View[];\n\n    private mSortedVerticalChildren:View[];\n\n    private mGraph:RelativeLayout.DependencyGraph = new RelativeLayout.DependencyGraph();\n\n    // Compatibility hack. Old versions of the platform had problems\n    // with MeasureSpec value overflow and RelativeLayout was one source of them.\n    // Some apps came to rely on them. :(\n    private mAllowBrokenMeasureSpecs:boolean = false;\n\n    // Compatibility hack. Old versions of the platform would not take\n    // margins and padding into account when generating the height measure spec\n    // for children during the horizontal measure pass.\n    private mMeasureVerticalWithPaddingMargin:boolean = false;\n\n    // A default width used for RTL measure pass\n    /**\n     * Value reduced so as not to interfere with View's measurement spec. flags. See:\n     * {@link View#MEASURED_SIZE_MASK}.\n     * {@link View#MEASURED_STATE_TOO_SMALL}.\n     **/\n    private static DEFAULT_WIDTH:number = 0x00010000;\n\n\n    constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n        super(context, bindElement, defStyle);\n        if (bindElement || defStyle) {\n            const a = context.obtainStyledAttributes(bindElement, defStyle);\n            this.mIgnoreGravity = a.getResourceId('ignoreGravity', View.NO_ID);\n            this.mGravity = Gravity.parseGravity(a.getAttrValue('gravity'), this.mGravity);\n            a.recycle();\n        }\n        this.queryCompatibilityModes();\n    }\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder().set('ignoreGravity', {\n            setter(v:RelativeLayout, value:any, a:AttrBinder) {\n                v.setIgnoreGravity(value+'');\n            }, getter(v:RelativeLayout) {\n                return v.mIgnoreGravity;\n            }\n        }).set('gravity', {\n            setter(v:RelativeLayout, value:any, a:AttrBinder) {\n                v.setGravity(a.parseGravity(value, v.mGravity));\n            }, getter(v:RelativeLayout) {\n                return v.mGravity;\n            }\n        });\n    }\n\n    private queryCompatibilityModes():void  {\n        this.mAllowBrokenMeasureSpecs = false; //version <= Build.VERSION_CODES.JELLY_BEAN_MR1;\n        this.mMeasureVerticalWithPaddingMargin = true; //version >= Build.VERSION_CODES.JELLY_BEAN_MR2;\n    }\n\n    shouldDelayChildPressedState():boolean  {\n        return false;\n    }\n\n    /**\n     * Defines which View is ignored when the gravity is applied. This setting has no\n     * effect if the gravity is <code>Gravity.START | Gravity.TOP</code>.\n     *\n     * @param viewId The id of the View to be ignored by gravity, or 0 if no View\n     *        should be ignored.\n     *\n     * @see #setGravity(int)\n     *\n     * @attr ref android.R.styleable#RelativeLayout_ignoreGravity\n     */\n    setIgnoreGravity(viewId:string):void  {\n        this.mIgnoreGravity = viewId;\n    }\n\n    /**\n     * Describes how the child views are positioned.\n     *\n     * @return the gravity.\n     *\n     * @see #setGravity(int)\n     * @see android.view.Gravity\n     *\n     * @attr ref android.R.styleable#RelativeLayout_gravity\n     */\n    getGravity():number  {\n        return this.mGravity;\n    }\n\n    /**\n     * Describes how the child views are positioned. Defaults to\n     * <code>Gravity.START | Gravity.TOP</code>.\n     *\n     * <p>Note that since RelativeLayout considers the positioning of each child\n     * relative to one another to be significant, setting gravity will affect\n     * the positioning of all children as a single unit within the parent.\n     * This happens after children have been relatively positioned.</p>\n     *\n     * @param gravity See {@link android.view.Gravity}\n     *\n     * @see #setHorizontalGravity(int)\n     * @see #setVerticalGravity(int)\n     *\n     * @attr ref android.R.styleable#RelativeLayout_gravity\n     */\n    setGravity(gravity:number):void  {\n        if (this.mGravity != gravity) {\n            if ((gravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) {\n                gravity |= Gravity.START;\n            }\n            if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) {\n                gravity |= Gravity.TOP;\n            }\n            this.mGravity = gravity;\n            this.requestLayout();\n        }\n    }\n\n    setHorizontalGravity(horizontalGravity:number):void  {\n        const gravity:number = horizontalGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK;\n        if ((this.mGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) != gravity) {\n            this.mGravity = (this.mGravity & ~Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) | gravity;\n            this.requestLayout();\n        }\n    }\n\n    setVerticalGravity(verticalGravity:number):void  {\n        const gravity:number = verticalGravity & Gravity.VERTICAL_GRAVITY_MASK;\n        if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) != gravity) {\n            this.mGravity = (this.mGravity & ~Gravity.VERTICAL_GRAVITY_MASK) | gravity;\n            this.requestLayout();\n        }\n    }\n\n    getBaseline():number  {\n        return this.mBaselineView != null ? this.mBaselineView.getBaseline() : super.getBaseline();\n    }\n\n    requestLayout():void  {\n        super.requestLayout();\n        this.mDirtyHierarchy = true;\n    }\n\n    private sortChildren():void  {\n        const count:number = this.getChildCount();\n        if (this.mSortedVerticalChildren == null || this.mSortedVerticalChildren.length != count) {\n            this.mSortedVerticalChildren = new Array<View>(count);\n        }\n        if (this.mSortedHorizontalChildren == null || this.mSortedHorizontalChildren.length != count) {\n            this.mSortedHorizontalChildren = new Array<View>(count);\n        }\n        const graph:RelativeLayout.DependencyGraph = this.mGraph;\n        graph.clear();\n        for (let i:number = 0; i < count; i++) {\n            graph.add(this.getChildAt(i));\n        }\n        graph.getSortedViews(this.mSortedVerticalChildren, RelativeLayout.RULES_VERTICAL);\n        graph.getSortedViews(this.mSortedHorizontalChildren, RelativeLayout.RULES_HORIZONTAL);\n    }\n\n    protected onMeasure(widthMeasureSpec:number, heightMeasureSpec:number):void  {\n        if (this.mDirtyHierarchy) {\n            this.mDirtyHierarchy = false;\n            this.sortChildren();\n        }\n        let myWidth:number = -1;\n        let myHeight:number = -1;\n        let width:number = 0;\n        let height:number = 0;\n        const widthMode:number = View.MeasureSpec.getMode(widthMeasureSpec);\n        const heightMode:number = View.MeasureSpec.getMode(heightMeasureSpec);\n        const widthSize:number = View.MeasureSpec.getSize(widthMeasureSpec);\n        const heightSize:number = View.MeasureSpec.getSize(heightMeasureSpec);\n        // Record our dimensions if they are known;\n        if (widthMode != View.MeasureSpec.UNSPECIFIED) {\n            myWidth = widthSize;\n        }\n        if (heightMode != View.MeasureSpec.UNSPECIFIED) {\n            myHeight = heightSize;\n        }\n        if (widthMode == View.MeasureSpec.EXACTLY) {\n            width = myWidth;\n        }\n        if (heightMode == View.MeasureSpec.EXACTLY) {\n            height = myHeight;\n        }\n        this.mHasBaselineAlignedChild = false;\n        let ignore:View = null;\n        let gravity:number = this.mGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK;\n        const horizontalGravity:boolean = gravity != Gravity.START && gravity != 0;\n        gravity = this.mGravity & Gravity.VERTICAL_GRAVITY_MASK;\n        const verticalGravity:boolean = gravity != Gravity.TOP && gravity != 0;\n        let left:number = Integer.MAX_VALUE;\n        let top:number = Integer.MAX_VALUE;\n        let right:number = Integer.MIN_VALUE;\n        let bottom:number = Integer.MIN_VALUE;\n        let offsetHorizontalAxis:boolean = false;\n        let offsetVerticalAxis:boolean = false;\n        if ((horizontalGravity || verticalGravity) && this.mIgnoreGravity != View.NO_ID) {\n            ignore = this.findViewById(this.mIgnoreGravity);\n        }\n        const isWrapContentWidth:boolean = widthMode != View.MeasureSpec.EXACTLY;\n        const isWrapContentHeight:boolean = heightMode != View.MeasureSpec.EXACTLY;\n        // We need to know our size for doing the correct computation of children positioning in RTL\n        // mode but there is no practical way to get it instead of running the code below.\n        // So, instead of running the code twice, we just set the width to a \"default display width\"\n        // before the computation and then, as a last pass, we will update their real position with\n        // an offset equals to \"DEFAULT_WIDTH - width\".\n        const layoutDirection:number = this.getLayoutDirection();\n        if (this.isLayoutRtl() && myWidth == -1) {\n            myWidth = RelativeLayout.DEFAULT_WIDTH;\n        }\n        let views:View[] = this.mSortedHorizontalChildren;\n        let count:number = views.length;\n        for (let i:number = 0; i < count; i++) {\n            let child:View = views[i];\n            if (child.getVisibility() != RelativeLayout.GONE) {\n                let params:RelativeLayout.LayoutParams = <RelativeLayout.LayoutParams> child.getLayoutParams();\n                let rules:string[] = params.getRules(layoutDirection);\n                this.applyHorizontalSizeRules(params, myWidth, rules);\n                this.measureChildHorizontal(child, params, myWidth, myHeight);\n                if (this.positionChildHorizontal(child, params, myWidth, isWrapContentWidth)) {\n                    offsetHorizontalAxis = true;\n                }\n            }\n        }\n        views = this.mSortedVerticalChildren;\n        count = views.length;\n        //const targetSdkVersion:number = this.getContext().getApplicationInfo().targetSdkVersion;\n        for (let i:number = 0; i < count; i++) {\n            let child:View = views[i];\n            if (child.getVisibility() != RelativeLayout.GONE) {\n                let params:RelativeLayout.LayoutParams = <RelativeLayout.LayoutParams> child.getLayoutParams();\n                this.applyVerticalSizeRules(params, myHeight);\n                this._measureChild(child, params, myWidth, myHeight);\n                if (this.positionChildVertical(child, params, myHeight, isWrapContentHeight)) {\n                    offsetVerticalAxis = true;\n                }\n                if (isWrapContentWidth) {\n                    if (this.isLayoutRtl()) {\n                        //if (targetSdkVersion < Build.VERSION_CODES.KITKAT) {\n                        //    width = Math.max(width, myWidth - params.mLeft);\n                        //} else {\n                            width = Math.max(width, myWidth - params.mLeft - params.leftMargin);\n                        //}\n                    } else {\n                        //if (targetSdkVersion < Build.VERSION_CODES.KITKAT) {\n                        //    width = Math.max(width, params.mRight);\n                        //} else {\n                            width = Math.max(width, params.mRight + params.rightMargin);\n                        //}\n                    }\n                }\n                if (isWrapContentHeight) {\n                    //if (targetSdkVersion < Build.VERSION_CODES.KITKAT) {\n                    //    height = Math.max(height, params.mBottom);\n                    //} else {\n                        height = Math.max(height, params.mBottom + params.bottomMargin);\n                    //}\n                }\n                if (child != ignore || verticalGravity) {\n                    left = Math.min(left, params.mLeft - params.leftMargin);\n                    top = Math.min(top, params.mTop - params.topMargin);\n                }\n                if (child != ignore || horizontalGravity) {\n                    right = Math.max(right, params.mRight + params.rightMargin);\n                    bottom = Math.max(bottom, params.mBottom + params.bottomMargin);\n                }\n            }\n        }\n        if (this.mHasBaselineAlignedChild) {\n            for (let i:number = 0; i < count; i++) {\n                let child:View = this.getChildAt(i);\n                if (child.getVisibility() != RelativeLayout.GONE) {\n                    let params:RelativeLayout.LayoutParams = <RelativeLayout.LayoutParams> child.getLayoutParams();\n                    this.alignBaseline(child, params);\n                    if (child != ignore || verticalGravity) {\n                        left = Math.min(left, params.mLeft - params.leftMargin);\n                        top = Math.min(top, params.mTop - params.topMargin);\n                    }\n                    if (child != ignore || horizontalGravity) {\n                        right = Math.max(right, params.mRight + params.rightMargin);\n                        bottom = Math.max(bottom, params.mBottom + params.bottomMargin);\n                    }\n                }\n            }\n        }\n        if (isWrapContentWidth) {\n            // Width already has left padding in it since it was calculated by looking at\n            // the right of each child view\n            width += this.mPaddingRight;\n            if (this.mLayoutParams != null && this.mLayoutParams.width >= 0) {\n                width = Math.max(width, this.mLayoutParams.width);\n            }\n            width = Math.max(width, this.getSuggestedMinimumWidth());\n            width = RelativeLayout.resolveSize(width, widthMeasureSpec);\n            if (offsetHorizontalAxis) {\n                for (let i:number = 0; i < count; i++) {\n                    let child:View = this.getChildAt(i);\n                    if (child.getVisibility() != RelativeLayout.GONE) {\n                        let params:RelativeLayout.LayoutParams = <RelativeLayout.LayoutParams> child.getLayoutParams();\n                        const rules:string[] = params.getRules(layoutDirection);\n                        if (rules[RelativeLayout.CENTER_IN_PARENT] != null || rules[RelativeLayout.CENTER_HORIZONTAL] != null) {\n                            RelativeLayout.centerHorizontal(child, params, width);\n                        } else if (rules[RelativeLayout.ALIGN_PARENT_RIGHT] != null) {\n                            const childWidth:number = child.getMeasuredWidth();\n                            params.mLeft = width - this.mPaddingRight - childWidth;\n                            params.mRight = params.mLeft + childWidth;\n                        }\n                    }\n                }\n            }\n        }\n        if (isWrapContentHeight) {\n            // Height already has top padding in it since it was calculated by looking at\n            // the bottom of each child view\n            height += this.mPaddingBottom;\n            if (this.mLayoutParams != null && this.mLayoutParams.height >= 0) {\n                height = Math.max(height, this.mLayoutParams.height);\n            }\n            height = Math.max(height, this.getSuggestedMinimumHeight());\n            height = RelativeLayout.resolveSize(height, heightMeasureSpec);\n            if (offsetVerticalAxis) {\n                for (let i:number = 0; i < count; i++) {\n                    let child:View = this.getChildAt(i);\n                    if (child.getVisibility() != RelativeLayout.GONE) {\n                        let params:RelativeLayout.LayoutParams = <RelativeLayout.LayoutParams> child.getLayoutParams();\n                        const rules:string[] = params.getRules(layoutDirection);\n                        if (rules[RelativeLayout.CENTER_IN_PARENT] != null || rules[RelativeLayout.CENTER_VERTICAL] != null) {\n                            RelativeLayout.centerVertical(child, params, height);\n                        } else if (rules[RelativeLayout.ALIGN_PARENT_BOTTOM] != null) {\n                            const childHeight:number = child.getMeasuredHeight();\n                            params.mTop = height - this.mPaddingBottom - childHeight;\n                            params.mBottom = params.mTop + childHeight;\n                        }\n                    }\n                }\n            }\n        }\n        if (horizontalGravity || verticalGravity) {\n            const selfBounds:Rect = this.mSelfBounds;\n            selfBounds.set(this.mPaddingLeft, this.mPaddingTop, width - this.mPaddingRight, height - this.mPaddingBottom);\n            const contentBounds:Rect = this.mContentBounds;\n            Gravity.apply(this.mGravity, right - left, bottom - top, selfBounds, contentBounds, layoutDirection);\n            const horizontalOffset:number = contentBounds.left - left;\n            const verticalOffset:number = contentBounds.top - top;\n            if (horizontalOffset != 0 || verticalOffset != 0) {\n                for (let i:number = 0; i < count; i++) {\n                    let child:View = this.getChildAt(i);\n                    if (child.getVisibility() != RelativeLayout.GONE && child != ignore) {\n                        let params:RelativeLayout.LayoutParams = <RelativeLayout.LayoutParams> child.getLayoutParams();\n                        if (horizontalGravity) {\n                            params.mLeft += horizontalOffset;\n                            params.mRight += horizontalOffset;\n                        }\n                        if (verticalGravity) {\n                            params.mTop += verticalOffset;\n                            params.mBottom += verticalOffset;\n                        }\n                    }\n                }\n            }\n        }\n        if (this.isLayoutRtl()) {\n            const offsetWidth:number = myWidth - width;\n            for (let i:number = 0; i < count; i++) {\n                let child:View = this.getChildAt(i);\n                if (child.getVisibility() != RelativeLayout.GONE) {\n                    let params:RelativeLayout.LayoutParams = <RelativeLayout.LayoutParams> child.getLayoutParams();\n                    params.mLeft -= offsetWidth;\n                    params.mRight -= offsetWidth;\n                }\n            }\n        }\n        this.setMeasuredDimension(width, height);\n    }\n\n    private alignBaseline(child:View, params:RelativeLayout.LayoutParams):void  {\n        const layoutDirection:number = this.getLayoutDirection();\n        let rules:string[] = params.getRules(layoutDirection);\n        let anchorBaseline:number = this.getRelatedViewBaseline(rules, RelativeLayout.ALIGN_BASELINE);\n        if (anchorBaseline != -1) {\n            let anchorParams:RelativeLayout.LayoutParams = this.getRelatedViewParams(rules, RelativeLayout.ALIGN_BASELINE);\n            if (anchorParams != null) {\n                let offset:number = anchorParams.mTop + anchorBaseline;\n                let baseline:number = child.getBaseline();\n                if (baseline != -1) {\n                    offset -= baseline;\n                }\n                let height:number = params.mBottom - params.mTop;\n                params.mTop = offset;\n                params.mBottom = params.mTop + height;\n            }\n        }\n        if (this.mBaselineView == null) {\n            this.mBaselineView = child;\n        } else {\n            let lp:RelativeLayout.LayoutParams = <RelativeLayout.LayoutParams> this.mBaselineView.getLayoutParams();\n            if (params.mTop < lp.mTop || (params.mTop == lp.mTop && params.mLeft < lp.mLeft)) {\n                this.mBaselineView = child;\n            }\n        }\n    }\n\n    /**\n     * Measure a child. The child should have left, top, right and bottom information\n     * stored in its LayoutParams. If any of these values is -1 it means that the view\n     * can extend up to the corresponding edge.\n     *\n     * @param child Child to measure\n     * @param params LayoutParams associated with child\n     * @param myWidth Width of the the RelativeLayout\n     * @param myHeight Height of the RelativeLayout\n     */\n    private _measureChild(child:View, params:RelativeLayout.LayoutParams, myWidth:number, myHeight:number):void  {\n        let childWidthMeasureSpec:number = this.getChildMeasureSpec(params.mLeft, params.mRight, params.width, params.leftMargin, params.rightMargin, this.mPaddingLeft, this.mPaddingRight, myWidth);\n        let childHeightMeasureSpec:number = this.getChildMeasureSpec(params.mTop, params.mBottom, params.height, params.topMargin, params.bottomMargin, this.mPaddingTop, this.mPaddingBottom, myHeight);\n        child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n    }\n\n    private measureChildHorizontal(child:View, params:RelativeLayout.LayoutParams, myWidth:number, myHeight:number):void  {\n        let childWidthMeasureSpec:number = this.getChildMeasureSpec(params.mLeft, params.mRight, params.width, params.leftMargin, params.rightMargin, this.mPaddingLeft, this.mPaddingRight, myWidth);\n        let maxHeight:number = myHeight;\n        if (this.mMeasureVerticalWithPaddingMargin) {\n            maxHeight = Math.max(0, myHeight - this.mPaddingTop - this.mPaddingBottom - params.topMargin - params.bottomMargin);\n        }\n        let childHeightMeasureSpec:number;\n        if (myHeight < 0 && !this.mAllowBrokenMeasureSpecs) {\n            if (params.height >= 0) {\n                childHeightMeasureSpec = View.MeasureSpec.makeMeasureSpec(params.height, View.MeasureSpec.EXACTLY);\n            } else {\n                // Negative values in a mySize/myWidth/myWidth value in RelativeLayout measurement\n                // is code for, \"we got an unspecified mode in the RelativeLayout's measurespec.\"\n                // Carry it forward.\n                childHeightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n            }\n        } else if (params.width == RelativeLayout.LayoutParams.MATCH_PARENT) {\n            childHeightMeasureSpec = View.MeasureSpec.makeMeasureSpec(maxHeight, View.MeasureSpec.EXACTLY);\n        } else {\n            childHeightMeasureSpec = View.MeasureSpec.makeMeasureSpec(maxHeight, View.MeasureSpec.AT_MOST);\n        }\n        child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n    }\n\n    /**\n     * Get a measure spec that accounts for all of the constraints on this view.\n     * This includes size constraints imposed by the RelativeLayout as well as\n     * the View's desired dimension.\n     *\n     * @param childStart The left or top field of the child's layout params\n     * @param childEnd The right or bottom field of the child's layout params\n     * @param childSize The child's desired size (the width or height field of\n     *        the child's layout params)\n     * @param startMargin The left or top margin\n     * @param endMargin The right or bottom margin\n     * @param startPadding mPaddingLeft or mPaddingTop\n     * @param endPadding mPaddingRight or mPaddingBottom\n     * @param mySize The width or height of this view (the RelativeLayout)\n     * @return MeasureSpec for the child\n     */\n    private getChildMeasureSpec(childStart:number, childEnd:number, childSize:number, startMargin:number, endMargin:number, startPadding:number, endPadding:number, mySize:number):number  {\n        if (mySize < 0 && !this.mAllowBrokenMeasureSpecs) {\n            if (childSize >= 0) {\n                return View.MeasureSpec.makeMeasureSpec(childSize, View.MeasureSpec.EXACTLY);\n            }\n            // Carry it forward.\n            return View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n        }\n        let childSpecMode:number = 0;\n        let childSpecSize:number = 0;\n        // Figure out start and end bounds.\n        let tempStart:number = childStart;\n        let tempEnd:number = childEnd;\n        // view's margins and our padding\n        if (tempStart < 0) {\n            tempStart = startPadding + startMargin;\n        }\n        if (tempEnd < 0) {\n            tempEnd = mySize - endPadding - endMargin;\n        }\n        // Figure out maximum size available to this view\n        let maxAvailable:number = tempEnd - tempStart;\n        if (childStart >= 0 && childEnd >= 0) {\n            // Constraints fixed both edges, so child must be an exact size\n            childSpecMode = View.MeasureSpec.EXACTLY;\n            childSpecSize = maxAvailable;\n        } else {\n            if (childSize >= 0) {\n                // Child wanted an exact size. Give as much as possible\n                childSpecMode = View.MeasureSpec.EXACTLY;\n                if (maxAvailable >= 0) {\n                    // We have a maxmum size in this dimension.\n                    childSpecSize = Math.min(maxAvailable, childSize);\n                } else {\n                    // We can grow in this dimension.\n                    childSpecSize = childSize;\n                }\n            } else if (childSize == RelativeLayout.LayoutParams.MATCH_PARENT) {\n                // Child wanted to be as big as possible. Give all available\n                // space\n                childSpecMode = View.MeasureSpec.EXACTLY;\n                childSpecSize = maxAvailable;\n            } else if (childSize == RelativeLayout.LayoutParams.WRAP_CONTENT) {\n                // our max size\n                if (maxAvailable >= 0) {\n                    // We have a maximum size in this dimension.\n                    childSpecMode = View.MeasureSpec.AT_MOST;\n                    childSpecSize = maxAvailable;\n                } else {\n                    // We can grow in this dimension. Child can be as big as it\n                    // wants\n                    childSpecMode = View.MeasureSpec.UNSPECIFIED;\n                    childSpecSize = 0;\n                }\n            }\n        }\n        return View.MeasureSpec.makeMeasureSpec(childSpecSize, childSpecMode);\n    }\n\n    private positionChildHorizontal(child:View, params:RelativeLayout.LayoutParams, myWidth:number, wrapContent:boolean):boolean  {\n        const layoutDirection:number = this.getLayoutDirection();\n        let rules:string[] = params.getRules(layoutDirection);\n        if (params.mLeft < 0 && params.mRight >= 0) {\n            // Right is fixed, but left varies\n            params.mLeft = params.mRight - child.getMeasuredWidth();\n        } else if (params.mLeft >= 0 && params.mRight < 0) {\n            // Left is fixed, but right varies\n            params.mRight = params.mLeft + child.getMeasuredWidth();\n        } else if (params.mLeft < 0 && params.mRight < 0) {\n            // Both left and right vary\n            if (rules[RelativeLayout.CENTER_IN_PARENT] != null || rules[RelativeLayout.CENTER_HORIZONTAL] != null) {\n                if (!wrapContent) {\n                    RelativeLayout.centerHorizontal(child, params, myWidth);\n                } else {\n                    params.mLeft = this.mPaddingLeft + params.leftMargin;\n                    params.mRight = params.mLeft + child.getMeasuredWidth();\n                }\n                return true;\n            } else {\n                // from the left. This will give LEFT/TOP for LTR and RIGHT/TOP for RTL.\n                if (this.isLayoutRtl()) {\n                    params.mRight = myWidth - this.mPaddingRight - params.rightMargin;\n                    params.mLeft = params.mRight - child.getMeasuredWidth();\n                } else {\n                    params.mLeft = this.mPaddingLeft + params.leftMargin;\n                    params.mRight = params.mLeft + child.getMeasuredWidth();\n                }\n            }\n        }\n        return rules[RelativeLayout.ALIGN_PARENT_END] != null;\n    }\n\n    private positionChildVertical(child:View, params:RelativeLayout.LayoutParams, myHeight:number, wrapContent:boolean):boolean  {\n        let rules:string[] = params.getRules();\n        if (params.mTop < 0 && params.mBottom >= 0) {\n            // Bottom is fixed, but top varies\n            params.mTop = params.mBottom - child.getMeasuredHeight();\n        } else if (params.mTop >= 0 && params.mBottom < 0) {\n            // Top is fixed, but bottom varies\n            params.mBottom = params.mTop + child.getMeasuredHeight();\n        } else if (params.mTop < 0 && params.mBottom < 0) {\n            // Both top and bottom vary\n            if (rules[RelativeLayout.CENTER_IN_PARENT] != null || rules[RelativeLayout.CENTER_VERTICAL] != null) {\n                if (!wrapContent) {\n                    RelativeLayout.centerVertical(child, params, myHeight);\n                } else {\n                    params.mTop = this.mPaddingTop + params.topMargin;\n                    params.mBottom = params.mTop + child.getMeasuredHeight();\n                }\n                return true;\n            } else {\n                params.mTop = this.mPaddingTop + params.topMargin;\n                params.mBottom = params.mTop + child.getMeasuredHeight();\n            }\n        }\n        return rules[RelativeLayout.ALIGN_PARENT_BOTTOM] != null;\n    }\n\n    private applyHorizontalSizeRules(childParams:RelativeLayout.LayoutParams, myWidth:number, rules:string[]):void  {\n        let anchorParams:RelativeLayout.LayoutParams;\n        // -1 indicated a \"soft requirement\" in that direction. For example:\n        // left=10, right=-1 means the view must start at 10, but can go as far as it wants to the right\n        // left =-1, right=10 means the view must end at 10, but can go as far as it wants to the left\n        // left=10, right=20 means the left and right ends are both fixed\n        childParams.mLeft = -1;\n        childParams.mRight = -1;\n        anchorParams = this.getRelatedViewParams(rules, RelativeLayout.LEFT_OF);\n        if (anchorParams != null) {\n            childParams.mRight = anchorParams.mLeft - (anchorParams.leftMargin + childParams.rightMargin);\n        } else if (childParams.alignWithParent && rules[RelativeLayout.LEFT_OF] != null) {\n            if (myWidth >= 0) {\n                childParams.mRight = myWidth - this.mPaddingRight - childParams.rightMargin;\n            }\n        }\n        anchorParams = this.getRelatedViewParams(rules, RelativeLayout.RIGHT_OF);\n        if (anchorParams != null) {\n            childParams.mLeft = anchorParams.mRight + (anchorParams.rightMargin + childParams.leftMargin);\n        } else if (childParams.alignWithParent && rules[RelativeLayout.RIGHT_OF] != null) {\n            childParams.mLeft = this.mPaddingLeft + childParams.leftMargin;\n        }\n        anchorParams = this.getRelatedViewParams(rules, RelativeLayout.ALIGN_LEFT);\n        if (anchorParams != null) {\n            childParams.mLeft = anchorParams.mLeft + childParams.leftMargin;\n        } else if (childParams.alignWithParent && rules[RelativeLayout.ALIGN_LEFT] != null) {\n            childParams.mLeft = this.mPaddingLeft + childParams.leftMargin;\n        }\n        anchorParams = this.getRelatedViewParams(rules, RelativeLayout.ALIGN_RIGHT);\n        if (anchorParams != null) {\n            childParams.mRight = anchorParams.mRight - childParams.rightMargin;\n        } else if (childParams.alignWithParent && rules[RelativeLayout.ALIGN_RIGHT] != null) {\n            if (myWidth >= 0) {\n                childParams.mRight = myWidth - this.mPaddingRight - childParams.rightMargin;\n            }\n        }\n        if (null != rules[RelativeLayout.ALIGN_PARENT_LEFT]) {\n            childParams.mLeft = this.mPaddingLeft + childParams.leftMargin;\n        }\n        if (null != rules[RelativeLayout.ALIGN_PARENT_RIGHT]) {\n            if (myWidth >= 0) {\n                childParams.mRight = myWidth - this.mPaddingRight - childParams.rightMargin;\n            }\n        }\n    }\n\n    private applyVerticalSizeRules(childParams:RelativeLayout.LayoutParams, myHeight:number):void  {\n        let rules:string[] = childParams.getRules();\n        let anchorParams:RelativeLayout.LayoutParams;\n        childParams.mTop = -1;\n        childParams.mBottom = -1;\n        anchorParams = this.getRelatedViewParams(rules, RelativeLayout.ABOVE);\n        if (anchorParams != null) {\n            childParams.mBottom = anchorParams.mTop - (anchorParams.topMargin + childParams.bottomMargin);\n        } else if (childParams.alignWithParent && rules[RelativeLayout.ABOVE] != null) {\n            if (myHeight >= 0) {\n                childParams.mBottom = myHeight - this.mPaddingBottom - childParams.bottomMargin;\n            }\n        }\n        anchorParams = this.getRelatedViewParams(rules, RelativeLayout.BELOW);\n        if (anchorParams != null) {\n            childParams.mTop = anchorParams.mBottom + (anchorParams.bottomMargin + childParams.topMargin);\n        } else if (childParams.alignWithParent && rules[RelativeLayout.BELOW] != null) {\n            childParams.mTop = this.mPaddingTop + childParams.topMargin;\n        }\n        anchorParams = this.getRelatedViewParams(rules, RelativeLayout.ALIGN_TOP);\n        if (anchorParams != null) {\n            childParams.mTop = anchorParams.mTop + childParams.topMargin;\n        } else if (childParams.alignWithParent && rules[RelativeLayout.ALIGN_TOP] != null) {\n            childParams.mTop = this.mPaddingTop + childParams.topMargin;\n        }\n        anchorParams = this.getRelatedViewParams(rules, RelativeLayout.ALIGN_BOTTOM);\n        if (anchorParams != null) {\n            childParams.mBottom = anchorParams.mBottom - childParams.bottomMargin;\n        } else if (childParams.alignWithParent && rules[RelativeLayout.ALIGN_BOTTOM] != null) {\n            if (myHeight >= 0) {\n                childParams.mBottom = myHeight - this.mPaddingBottom - childParams.bottomMargin;\n            }\n        }\n        if (null != rules[RelativeLayout.ALIGN_PARENT_TOP]) {\n            childParams.mTop = this.mPaddingTop + childParams.topMargin;\n        }\n        if (null != rules[RelativeLayout.ALIGN_PARENT_BOTTOM]) {\n            if (myHeight >= 0) {\n                childParams.mBottom = myHeight - this.mPaddingBottom - childParams.bottomMargin;\n            }\n        }\n        if (rules[RelativeLayout.ALIGN_BASELINE] != null) {\n            this.mHasBaselineAlignedChild = true;\n        }\n    }\n\n    private getRelatedView(rules:string[], relation:number):View  {\n        let id:string = rules[relation];\n        if (id != null) {\n            let node:RelativeLayout.DependencyGraph.Node = this.mGraph.mKeyNodes.get(id);\n            if (node == null)\n                return null;\n            let v:View = node.view;\n            // Find the first non-GONE view up the chain\n            while (v.getVisibility() == View.GONE) {\n                rules = (<RelativeLayout.LayoutParams> v.getLayoutParams()).getRules(v.getLayoutDirection());\n                node = this.mGraph.mKeyNodes.get((rules[relation]));\n                if (node == null)\n                    return null;\n                v = node.view;\n            }\n            return v;\n        }\n        return null;\n    }\n\n    private getRelatedViewParams(rules:string[], relation:number):RelativeLayout.LayoutParams  {\n        let v:View = this.getRelatedView(rules, relation);\n        if (v != null) {\n            let params:ViewGroup.LayoutParams = v.getLayoutParams();\n            if (params instanceof RelativeLayout.LayoutParams) {\n                return <RelativeLayout.LayoutParams> v.getLayoutParams();\n            }\n        }\n        return null;\n    }\n\n    private getRelatedViewBaseline(rules:string[], relation:number):number  {\n        let v:View = this.getRelatedView(rules, relation);\n        if (v != null) {\n            return v.getBaseline();\n        }\n        return -1;\n    }\n\n    private static centerHorizontal(child:View, params:RelativeLayout.LayoutParams, myWidth:number):void  {\n        let childWidth:number = child.getMeasuredWidth();\n        let left:number = (myWidth - childWidth) / 2;\n        params.mLeft = left;\n        params.mRight = left + childWidth;\n    }\n\n    private static centerVertical(child:View, params:RelativeLayout.LayoutParams, myHeight:number):void  {\n        let childHeight:number = child.getMeasuredHeight();\n        let top:number = (myHeight - childHeight) / 2;\n        params.mTop = top;\n        params.mBottom = top + childHeight;\n    }\n\n    protected onLayout(changed:boolean, l:number, t:number, r:number, b:number):void  {\n        //  The layout has actually already been performed and the positions\n        //  cached.  Apply the cached values to the children.\n        const count:number = this.getChildCount();\n        for (let i:number = 0; i < count; i++) {\n            let child:View = this.getChildAt(i);\n            if (child.getVisibility() != RelativeLayout.GONE) {\n                let st:RelativeLayout.LayoutParams = <RelativeLayout.LayoutParams> child.getLayoutParams();\n                child.layout(st.mLeft, st.mTop, st.mRight, st.mBottom);\n            }\n        }\n    }\n\n    public generateLayoutParamsFromAttr(attrs: HTMLElement): android.view.ViewGroup.LayoutParams {\n        return new RelativeLayout.LayoutParams(this.getContext(), attrs);\n    }\n\n    /**\n     * Returns a set of layout parameters with a width of\n     * {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT},\n     * a height of {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT} and no spanning.\n     */\n    protected generateDefaultLayoutParams():ViewGroup.LayoutParams  {\n        return new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);\n    }\n\n    // Override to allow type-checking of LayoutParams.\n    protected checkLayoutParams(p:ViewGroup.LayoutParams):boolean  {\n        return p instanceof RelativeLayout.LayoutParams;\n    }\n\n    protected generateLayoutParams(p:ViewGroup.LayoutParams):ViewGroup.LayoutParams  {\n        return new RelativeLayout.LayoutParams(p);\n    }\n    //\n    //dispatchPopulateAccessibilityEvent(event:AccessibilityEvent):boolean  {\n    //    if (this.mTopToBottomLeftToRightSet == null) {\n    //        this.mTopToBottomLeftToRightSet = new TreeSet<View>(new RelativeLayout.TopToBottomLeftToRightComparator(this));\n    //    }\n    //    // sort children top-to-bottom and left-to-right\n    //    for (let i:number = 0, count:number = this.getChildCount(); i < count; i++) {\n    //        this.mTopToBottomLeftToRightSet.add(this.getChildAt(i));\n    //    }\n    //    for (let view:View of this.mTopToBottomLeftToRightSet) {\n    //        if (view.getVisibility() == View.VISIBLE && view.dispatchPopulateAccessibilityEvent(event)) {\n    //            this.mTopToBottomLeftToRightSet.clear();\n    //            return true;\n    //        }\n    //    }\n    //    this.mTopToBottomLeftToRightSet.clear();\n    //    return false;\n    //}\n    //\n    //onInitializeAccessibilityEvent(event:AccessibilityEvent):void  {\n    //    super.onInitializeAccessibilityEvent(event);\n    //    event.setClassName(RelativeLayout.class.getName());\n    //}\n    //\n    //onInitializeAccessibilityNodeInfo(info:AccessibilityNodeInfo):void  {\n    //    super.onInitializeAccessibilityNodeInfo(info);\n    //    info.setClassName(RelativeLayout.class.getName());\n    //}\n\n\n\n\n\n\n}\n\nexport module RelativeLayout{\n///**\n//     * Compares two views in left-to-right and top-to-bottom fashion.\n//     */\n//export class TopToBottomLeftToRightComparator implements Comparator<View> {\n//    _RelativeLayout_this:RelativeLayout;\n//    constructor(arg:RelativeLayout){\n//        this._RelativeLayout_this = arg;\n//    }\n//\n//    compare(first:View, second:View):number  {\n//        // top - bottom\n//        let topDifference:number = first.getTop() - second.getTop();\n//        if (topDifference != 0) {\n//            return topDifference;\n//        }\n//        // left - right\n//        let leftDifference:number = first.getLeft() - second.getLeft();\n//        if (leftDifference != 0) {\n//            return leftDifference;\n//        }\n//        // break tie by height\n//        let heightDiference:number = first.getHeight() - second.getHeight();\n//        if (heightDiference != 0) {\n//            return heightDiference;\n//        }\n//        // break tie by width\n//        let widthDiference:number = first.getWidth() - second.getWidth();\n//        if (widthDiference != 0) {\n//            return widthDiference;\n//        }\n//        return 0;\n//    }\n//}\n        /**\n     * Per-child layout information associated with RelativeLayout.\n     *\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignWithParentIfMissing\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_toLeftOf\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_toRightOf\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_above\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_below\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignBaseline\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignLeft\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignTop\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignRight\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignBottom\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignParentLeft\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignParentTop\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignParentRight\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignParentBottom\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_centerInParent\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_centerHorizontal\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_centerVertical\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_toStartOf\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_toEndOf\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignStart\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignEnd\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignParentStart\n     * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignParentEnd\n     */\nexport class LayoutParams extends ViewGroup.MarginLayoutParams {\n\n    private mRules:string[] = new Array<string>(RelativeLayout.VERB_COUNT);\n\n    private mInitialRules:string[] = new Array<string>(RelativeLayout.VERB_COUNT);\n\n    mLeft:number = 0;\n    mTop:number = 0;\n    mRight:number = 0;\n    mBottom:number = 0;\n\n    private mStart:number = LayoutParams.DEFAULT_MARGIN_RELATIVE;\n\n    private mEnd:number = LayoutParams.DEFAULT_MARGIN_RELATIVE;\n\n    private mRulesChanged:boolean = false;\n\n    private mIsRtlCompatibilityMode:boolean = false;\n\n    /**\n         * When true, uses the parent as the anchor if the anchor doesn't exist or if\n         * the anchor's visibility is GONE.\n         */\n    alignWithParent:boolean;\n\n    //constructor( c:Context, attrs:AttributeSet) {\n    //    super(c, attrs);\n    //    let a:TypedArray = c.obtainStyledAttributes(attrs, com.android.internal.R.styleable.RelativeLayout_Layout);\n    //    const targetSdkVersion:number = c.getApplicationInfo().targetSdkVersion;\n    //    this.mIsRtlCompatibilityMode = (targetSdkVersion < JELLY_BEAN_MR1 || !c.getApplicationInfo().hasRtlSupport());\n    //    const rules:number[] = this.mRules;\n    //    //noinspection MismatchedReadAndWriteOfArray\n    //    const initialRules:number[] = this.mInitialRules;\n    //    const N:number = a.getIndexCount();\n    //    for (let i:number = 0; i < N; i++) {\n    //        let attr:number = a.getIndex(i);\n    //        switch(attr) {\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignWithParentIfMissing:\n    //                this.alignWithParent = a.getBoolean(attr, false);\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_toLeftOf:\n    //                rules[RelativeLayout.LEFT_OF] = a.getResourceId(attr, 0);\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_toRightOf:\n    //                rules[RelativeLayout.RIGHT_OF] = a.getResourceId(attr, 0);\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_above:\n    //                rules[RelativeLayout.ABOVE] = a.getResourceId(attr, 0);\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_below:\n    //                rules[RelativeLayout.BELOW] = a.getResourceId(attr, 0);\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignBaseline:\n    //                rules[RelativeLayout.ALIGN_BASELINE] = a.getResourceId(attr, 0);\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignLeft:\n    //                rules[RelativeLayout.ALIGN_LEFT] = a.getResourceId(attr, 0);\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignTop:\n    //                rules[RelativeLayout.ALIGN_TOP] = a.getResourceId(attr, 0);\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignRight:\n    //                rules[RelativeLayout.ALIGN_RIGHT] = a.getResourceId(attr, 0);\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignBottom:\n    //                rules[RelativeLayout.ALIGN_BOTTOM] = a.getResourceId(attr, 0);\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignParentLeft:\n    //                rules[RelativeLayout.ALIGN_PARENT_LEFT] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : 0;\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignParentTop:\n    //                rules[RelativeLayout.ALIGN_PARENT_TOP] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : 0;\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignParentRight:\n    //                rules[RelativeLayout.ALIGN_PARENT_RIGHT] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : 0;\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignParentBottom:\n    //                rules[RelativeLayout.ALIGN_PARENT_BOTTOM] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : 0;\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_centerInParent:\n    //                rules[RelativeLayout.CENTER_IN_PARENT] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : 0;\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_centerHorizontal:\n    //                rules[RelativeLayout.CENTER_HORIZONTAL] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : 0;\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_centerVertical:\n    //                rules[RelativeLayout.CENTER_VERTICAL] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : 0;\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_toStartOf:\n    //                rules[RelativeLayout.START_OF] = a.getResourceId(attr, 0);\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_toEndOf:\n    //                rules[RelativeLayout.END_OF] = a.getResourceId(attr, 0);\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignStart:\n    //                rules[RelativeLayout.ALIGN_START] = a.getResourceId(attr, 0);\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignEnd:\n    //                rules[RelativeLayout.ALIGN_END] = a.getResourceId(attr, 0);\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignParentStart:\n    //                rules[RelativeLayout.ALIGN_PARENT_START] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : 0;\n    //                break;\n    //            case com.android.internal.R.styleable.RelativeLayout_Layout_layout_alignParentEnd:\n    //                rules[RelativeLayout.ALIGN_PARENT_END] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : 0;\n    //                break;\n    //        }\n    //    }\n    //    this.mRulesChanged = true;\n    //    System.arraycopy(rules, RelativeLayout.LEFT_OF, initialRules, RelativeLayout.LEFT_OF, RelativeLayout.VERB_COUNT);\n    //    a.recycle();\n    //}\n\n    constructor(context:Context, attrs:HTMLElement);\n    constructor(w:number, h:number);\n    constructor(source:RelativeLayout.LayoutParams);\n    constructor(source:ViewGroup.LayoutParams);\n    constructor(source:ViewGroup.MarginLayoutParams);\n    constructor(...args){\n        super(...(() => {\n            if (args[0] instanceof android.content.Context && args[1] instanceof HTMLElement) return [args[0], args[1]];\n            else if (typeof args[0] === 'number' && typeof args[1] === 'number') return [args[0], args[1]];\n            else if (args[0] instanceof RelativeLayout.LayoutParams) return [args[0]];\n            else if (args[0] instanceof ViewGroup.MarginLayoutParams) return [args[0]];\n            else if (args[0] instanceof ViewGroup.LayoutParams) return [args[0]];\n        })());\n        if (args[0] instanceof Context && args[1] instanceof HTMLElement) {\n            const c = <Context>args[0];\n            const attrs = <HTMLElement>args[1];\n            let a = c.obtainStyledAttributes(attrs);\n            // const targetSdkVersion:number = c.getApplicationInfo().targetSdkVersion;\n            this.mIsRtlCompatibilityMode = false;//(targetSdkVersion < JELLY_BEAN_MR1 || !c.getApplicationInfo().hasRtlSupport());\n            const rules:string[] = this.mRules;\n            //noinspection MismatchedReadAndWriteOfArray\n            const initialRules:string[] = this.mInitialRules;\n            for (let attr of a.getLowerCaseNoNamespaceAttrNames()) {\n                switch(attr) {\n                    case 'layout_alignwithparentifmissing':\n                        this.alignWithParent = a.getBoolean(attr, false);\n                        break;\n                    case 'layout_toleftof':\n                        rules[RelativeLayout.LEFT_OF] = a.getResourceId(attr, null);\n                        break;\n                    case 'layout_torightof':\n                        rules[RelativeLayout.RIGHT_OF] = a.getResourceId(attr, null);\n                        break;\n                    case 'layout_above':\n                        rules[RelativeLayout.ABOVE] = a.getResourceId(attr, null);\n                        break;\n                    case 'layout_below':\n                        rules[RelativeLayout.BELOW] = a.getResourceId(attr, null);\n                        break;\n                    case 'layout_alignbaseline':\n                        rules[RelativeLayout.ALIGN_BASELINE] = a.getResourceId(attr, null);\n                        break;\n                    case 'layout_alignleft':\n                        rules[RelativeLayout.ALIGN_LEFT] = a.getResourceId(attr, null);\n                        break;\n                    case 'layout_aligntop':\n                        rules[RelativeLayout.ALIGN_TOP] = a.getResourceId(attr, null);\n                        break;\n                    case 'layout_alignright':\n                        rules[RelativeLayout.ALIGN_RIGHT] = a.getResourceId(attr, null);\n                        break;\n                    case 'layout_alignbottom':\n                        rules[RelativeLayout.ALIGN_BOTTOM] = a.getResourceId(attr, null);\n                        break;\n                    case 'layout_alignparentleft':\n                        rules[RelativeLayout.ALIGN_PARENT_LEFT] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                        break;\n                    case 'layout_alignparenttop':\n                        rules[RelativeLayout.ALIGN_PARENT_TOP] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                        break;\n                    case 'layout_alignparentright':\n                        rules[RelativeLayout.ALIGN_PARENT_RIGHT] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                        break;\n                    case 'layout_alignparentbottom':\n                        rules[RelativeLayout.ALIGN_PARENT_BOTTOM] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                        break;\n                    case 'layout_centerinparent':\n                        rules[RelativeLayout.CENTER_IN_PARENT] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                        break;\n                    case 'layout_centerhorizontal':\n                        rules[RelativeLayout.CENTER_HORIZONTAL] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                        break;\n                    case 'layout_centervertical':\n                        rules[RelativeLayout.CENTER_VERTICAL] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                        break;\n                    case 'layout_tostartof':\n                        rules[RelativeLayout.START_OF] = a.getResourceId(attr, null);\n                        break;\n                    case 'layout_toendof':\n                        rules[RelativeLayout.END_OF] = a.getResourceId(attr, null);\n                        break;\n                    case 'layout_alignstart':\n                        rules[RelativeLayout.ALIGN_START] = a.getResourceId(attr, null);\n                        break;\n                    case 'layout_alignend':\n                        rules[RelativeLayout.ALIGN_END] = a.getResourceId(attr, null);\n                        break;\n                    case 'layout_alignparentstart':\n                        rules[RelativeLayout.ALIGN_PARENT_START] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                        break;\n                    case 'layout_alignparentend':\n                        rules[RelativeLayout.ALIGN_PARENT_END] = a.getBoolean(attr, false) ? RelativeLayout.TRUE : null;\n                        break;\n                }\n            }\n            this.mRulesChanged = true;\n            System.arraycopy(rules, RelativeLayout.LEFT_OF, initialRules, RelativeLayout.LEFT_OF, RelativeLayout.VERB_COUNT);\n            a.recycle();\n        } else if (typeof args[0] === 'number' && typeof args[1] === 'number') {\n            super(args[0], args[1]);\n        } else if (args[0] instanceof RelativeLayout.LayoutParams) {\n            const source = <RelativeLayout.LayoutParams>args[0];\n            this.mIsRtlCompatibilityMode = source.mIsRtlCompatibilityMode;\n            this.mRulesChanged = source.mRulesChanged;\n            this.alignWithParent = source.alignWithParent;\n            System.arraycopy(source.mRules, RelativeLayout.LEFT_OF, this.mRules, RelativeLayout.LEFT_OF, RelativeLayout.VERB_COUNT);\n            System.arraycopy(source.mInitialRules, RelativeLayout.LEFT_OF, this.mInitialRules, RelativeLayout.LEFT_OF, RelativeLayout.VERB_COUNT);\n        } else if (args[0] instanceof ViewGroup.MarginLayoutParams) {\n        } else if (args[0] instanceof ViewGroup.LayoutParams) {\n        }\n    }\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder().set('layout_alignWithParentIfMissing', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                param.alignWithParent = attrBinder.parseBoolean(value, false);\n            }, getter(param:LayoutParams) {\n                return param.alignWithParent;\n            }\n        }).set('layout_toLeftOf', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                this.addRule(RelativeLayout.LEFT_OF, value+'');\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.LEFT_OF];\n            }\n        }).set('layout_toRightOf', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                this.addRule(RelativeLayout.RIGHT_OF, value+'');\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.RIGHT_OF];\n            }\n        }).set('layout_above', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                this.addRule(RelativeLayout.ABOVE, value+'');\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.ABOVE];\n            }\n        }).set('layout_below', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                this.addRule(RelativeLayout.BELOW, value+'');\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.BELOW];\n            }\n        }).set('layout_alignBaseline', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                this.addRule(RelativeLayout.ALIGN_BASELINE, value+'');\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.ALIGN_BASELINE];\n            }\n        }).set('layout_alignLeft', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                this.addRule(RelativeLayout.ALIGN_LEFT, value+'');\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.ALIGN_LEFT];\n            }\n        }).set('layout_alignTop', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                this.addRule(RelativeLayout.ALIGN_TOP, value+'');\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.ALIGN_TOP];\n            }\n        }).set('layout_alignRight', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                this.addRule(RelativeLayout.ALIGN_RIGHT, value+'');\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.ALIGN_RIGHT];\n            }\n        }).set('layout_alignBottom', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                this.addRule(RelativeLayout.ALIGN_BOTTOM, value+'');\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.ALIGN_BOTTOM];\n            }\n        }).set('layout_alignParentLeft', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                this.addRule(RelativeLayout.ALIGN_PARENT_LEFT, anchor);\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.ALIGN_PARENT_LEFT];\n            }\n        }).set('layout_alignParentTop', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                this.addRule(RelativeLayout.ALIGN_PARENT_TOP, anchor);\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.ALIGN_PARENT_TOP];\n            }\n        }).set('layout_alignParentRight', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                this.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, anchor);\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.ALIGN_PARENT_RIGHT];\n            }\n        }).set('layout_alignParentBottom', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                this.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, anchor);\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.ALIGN_PARENT_BOTTOM];\n            }\n        }).set('layout_centerInParent', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                this.addRule(RelativeLayout.CENTER_IN_PARENT, anchor);\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.CENTER_IN_PARENT];\n            }\n        }).set('layout_centerHorizontal', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                this.addRule(RelativeLayout.CENTER_HORIZONTAL, anchor);\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.CENTER_HORIZONTAL];\n            }\n        }).set('layout_centerVertical', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                this.addRule(RelativeLayout.CENTER_VERTICAL, anchor);\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.CENTER_VERTICAL];\n            }\n        }).set('layout_toStartOf', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                this.addRule(RelativeLayout.LEFT_OF, value+'');\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.LEFT_OF];\n            }\n        }).set('layout_toEndOf', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                this.addRule(RelativeLayout.RIGHT_OF, value+'');\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.RIGHT_OF];\n            }\n        }).set('layout_alignStart', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                this.addRule(RelativeLayout.ALIGN_LEFT, value+'');\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.ALIGN_LEFT];\n            }\n        }).set('layout_alignEnd', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                this.addRule(RelativeLayout.ALIGN_RIGHT, value+'');\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.ALIGN_RIGHT];\n            }\n        }).set('layout_alignParentStart', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                this.addRule(RelativeLayout.ALIGN_PARENT_LEFT, anchor);\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.ALIGN_PARENT_LEFT];\n            }\n        }).set('layout_alignParentEnd', {\n            setter(param:LayoutParams, value:any, attrBinder:AttrBinder) {\n                const anchor = attrBinder.parseBoolean(value, false) ? RelativeLayout.TRUE : null;\n                this.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, anchor);\n            }, getter(param:LayoutParams) {\n                return param.mRules[RelativeLayout.ALIGN_PARENT_RIGHT];\n            }\n        });\n    }\n\n    /**\n         * Adds a layout rule to be interpreted by the RelativeLayout. Use this for\n         * verbs that take a target, such as a sibling (ALIGN_RIGHT) or a boolean\n         * value (VISIBLE).\n         *\n         * @param verb One of the verbs defined by\n         *        {@link android.widget.RelativeLayout RelativeLayout}, such as\n         *         ALIGN_WITH_PARENT_LEFT.\n         * @param anchor The id of another view to use as an anchor,\n         *        or a boolean value(represented as {@link RelativeLayout#TRUE})\n         *        for true or 0 for false).  For verbs that don't refer to another sibling\n         *        (for example, ALIGN_WITH_PARENT_BOTTOM) just use -1.\n         * @see #addRule(int)\n         */\n    addRule(verb:number, anchor:string=RelativeLayout.TRUE):void  {\n        this.mRules[verb] = anchor;\n        this.mInitialRules[verb] = anchor;\n        this.mRulesChanged = true;\n    }\n\n    /**\n         * Removes a layout rule to be interpreted by the RelativeLayout.\n         *\n         * @param verb One of the verbs defined by\n         *        {@link android.widget.RelativeLayout RelativeLayout}, such as\n         *         ALIGN_WITH_PARENT_LEFT.\n         * @see #addRule(int)\n         * @see #addRule(int, int)\n         */\n    removeRule(verb:number):void  {\n        this.mRules[verb] = null;\n        this.mInitialRules[verb] = null;\n        this.mRulesChanged = true;\n    }\n\n    private hasRelativeRules():boolean  {\n        return (this.mInitialRules[RelativeLayout.START_OF] != null || this.mInitialRules[RelativeLayout.END_OF] != null\n        || this.mInitialRules[RelativeLayout.ALIGN_START] != null || this.mInitialRules[RelativeLayout.ALIGN_END] != null\n        || this.mInitialRules[RelativeLayout.ALIGN_PARENT_START] != null || this.mInitialRules[RelativeLayout.ALIGN_PARENT_END] != null);\n    }\n\n    // The way we are resolving rules depends on the layout direction and if we are pre JB MR1\n    // or not.\n    //\n    // If we are pre JB MR1 (said as \"RTL compatibility mode\"), \"left\"/\"right\" rules are having\n    // predominance over any \"start/end\" rules that could have been defined. A special case:\n    // if no \"left\"/\"right\" rule has been defined and \"start\"/\"end\" rules are defined then we\n    // resolve those \"start\"/\"end\" rules to \"left\"/\"right\" respectively.\n    //\n    // If we are JB MR1+, then \"start\"/\"end\" rules are having predominance over \"left\"/\"right\"\n    // rules. If no \"start\"/\"end\" rule is defined then we use \"left\"/\"right\" rules.\n    //\n    // In all cases, the result of the resolution should clear the \"start\"/\"end\" rules to leave\n    // only the \"left\"/\"right\" rules at the end.\n    private resolveRules(layoutDirection:number):void  {\n        const isLayoutRtl:boolean = (layoutDirection == View.LAYOUT_DIRECTION_RTL);\n        // Reset to initial state\n        System.arraycopy(this.mInitialRules, RelativeLayout.LEFT_OF, this.mRules, RelativeLayout.LEFT_OF, RelativeLayout.VERB_COUNT);\n        // Apply rules depending on direction and if we are in RTL compatibility mode\n        if (this.mIsRtlCompatibilityMode) {\n            if (this.mRules[RelativeLayout.ALIGN_START] != null) {\n                if (this.mRules[RelativeLayout.ALIGN_LEFT] == null) {\n                    // \"left\" rule is not defined but \"start\" rule is: use the \"start\" rule as\n                    // the \"left\" rule\n                    this.mRules[RelativeLayout.ALIGN_LEFT] = this.mRules[RelativeLayout.ALIGN_START];\n                }\n                this.mRules[RelativeLayout.ALIGN_START] = null;\n            }\n            if (this.mRules[RelativeLayout.ALIGN_END] != null) {\n                if (this.mRules[RelativeLayout.ALIGN_RIGHT] == null) {\n                    // \"right\" rule is not defined but \"end\" rule is: use the \"end\" rule as the\n                    // \"right\" rule\n                    this.mRules[RelativeLayout.ALIGN_RIGHT] = this.mRules[RelativeLayout.ALIGN_END];\n                }\n                this.mRules[RelativeLayout.ALIGN_END] = null;\n            }\n            if (this.mRules[RelativeLayout.START_OF] != null) {\n                if (this.mRules[RelativeLayout.LEFT_OF] == null) {\n                    // \"left\" rule is not defined but \"start\" rule is: use the \"start\" rule as\n                    // the \"left\" rule\n                    this.mRules[RelativeLayout.LEFT_OF] = this.mRules[RelativeLayout.START_OF];\n                }\n                this.mRules[RelativeLayout.START_OF] = null;\n            }\n            if (this.mRules[RelativeLayout.END_OF] != null) {\n                if (this.mRules[RelativeLayout.RIGHT_OF] == null) {\n                    // \"right\" rule is not defined but \"end\" rule is: use the \"end\" rule as the\n                    // \"right\" rule\n                    this.mRules[RelativeLayout.RIGHT_OF] = this.mRules[RelativeLayout.END_OF];\n                }\n                this.mRules[RelativeLayout.END_OF] = null;\n            }\n            if (this.mRules[RelativeLayout.ALIGN_PARENT_START] != null) {\n                if (this.mRules[RelativeLayout.ALIGN_PARENT_LEFT] == null) {\n                    // \"left\" rule is not defined but \"start\" rule is: use the \"start\" rule as\n                    // the \"left\" rule\n                    this.mRules[RelativeLayout.ALIGN_PARENT_LEFT] = this.mRules[RelativeLayout.ALIGN_PARENT_START];\n                }\n                this.mRules[RelativeLayout.ALIGN_PARENT_START] = null;\n            }\n            if (this.mRules[RelativeLayout.ALIGN_PARENT_RIGHT] == null) {\n                if (this.mRules[RelativeLayout.ALIGN_PARENT_RIGHT] == null) {\n                    // \"right\" rule is not defined but \"end\" rule is: use the \"end\" rule as the\n                    // \"right\" rule\n                    this.mRules[RelativeLayout.ALIGN_PARENT_RIGHT] = this.mRules[RelativeLayout.ALIGN_PARENT_END];\n                }\n                this.mRules[RelativeLayout.ALIGN_PARENT_END] = null;\n            }\n        } else {\n            // JB MR1+ case\n            if ((this.mRules[RelativeLayout.ALIGN_START] != null || this.mRules[RelativeLayout.ALIGN_END] != null)\n                && (this.mRules[RelativeLayout.ALIGN_LEFT] != null || this.mRules[RelativeLayout.ALIGN_RIGHT] != null)) {\n                // \"start\"/\"end\" rules take precedence over \"left\"/\"right\" rules\n                this.mRules[RelativeLayout.ALIGN_LEFT] = null;\n                this.mRules[RelativeLayout.ALIGN_RIGHT] = null;\n            }\n            if (this.mRules[RelativeLayout.ALIGN_START] != null) {\n                // \"start\" rule resolved to \"left\" or \"right\" depending on the direction\n                this.mRules[isLayoutRtl ? RelativeLayout.ALIGN_RIGHT : RelativeLayout.ALIGN_LEFT] = this.mRules[RelativeLayout.ALIGN_START];\n                this.mRules[RelativeLayout.ALIGN_START] = null;\n            }\n            if (this.mRules[RelativeLayout.ALIGN_END] != null) {\n                // \"end\" rule resolved to \"left\" or \"right\" depending on the direction\n                this.mRules[isLayoutRtl ? RelativeLayout.ALIGN_LEFT : RelativeLayout.ALIGN_RIGHT] = this.mRules[RelativeLayout.ALIGN_END];\n                this.mRules[RelativeLayout.ALIGN_END] = null;\n            }\n            if ((this.mRules[RelativeLayout.START_OF] != null || this.mRules[RelativeLayout.END_OF] != null)\n                && (this.mRules[RelativeLayout.LEFT_OF] != null || this.mRules[RelativeLayout.RIGHT_OF] != null)) {\n                // \"start\"/\"end\" rules take precedence over \"left\"/\"right\" rules\n                this.mRules[RelativeLayout.LEFT_OF] = null;\n                this.mRules[RelativeLayout.RIGHT_OF] = null;\n            }\n            if (this.mRules[RelativeLayout.START_OF] != null) {\n                // \"start\" rule resolved to \"left\" or \"right\" depending on the direction\n                this.mRules[isLayoutRtl ? RelativeLayout.RIGHT_OF : RelativeLayout.LEFT_OF] = this.mRules[RelativeLayout.START_OF];\n                this.mRules[RelativeLayout.START_OF] = null;\n            }\n            if (this.mRules[RelativeLayout.END_OF] != null) {\n                // \"end\" rule resolved to \"left\" or \"right\" depending on the direction\n                this.mRules[isLayoutRtl ? RelativeLayout.LEFT_OF : RelativeLayout.RIGHT_OF] = this.mRules[RelativeLayout.END_OF];\n                this.mRules[RelativeLayout.END_OF] = null;\n            }\n            if ((this.mRules[RelativeLayout.ALIGN_PARENT_START] != null || this.mRules[RelativeLayout.ALIGN_PARENT_END] != null)\n                && (this.mRules[RelativeLayout.ALIGN_PARENT_LEFT] != null || this.mRules[RelativeLayout.ALIGN_PARENT_RIGHT] != null)) {\n                // \"start\"/\"end\" rules take precedence over \"left\"/\"right\" rules\n                this.mRules[RelativeLayout.ALIGN_PARENT_LEFT] = null;\n                this.mRules[RelativeLayout.ALIGN_PARENT_RIGHT] = null;\n            }\n            if (this.mRules[RelativeLayout.ALIGN_PARENT_START] != null) {\n                // \"start\" rule resolved to \"left\" or \"right\" depending on the direction\n                this.mRules[isLayoutRtl ? RelativeLayout.ALIGN_PARENT_RIGHT : RelativeLayout.ALIGN_PARENT_LEFT] = this.mRules[RelativeLayout.ALIGN_PARENT_START];\n                this.mRules[RelativeLayout.ALIGN_PARENT_START] = null;\n            }\n            if (this.mRules[RelativeLayout.ALIGN_PARENT_END] != null) {\n                // \"end\" rule resolved to \"left\" or \"right\" depending on the direction\n                this.mRules[isLayoutRtl ? RelativeLayout.ALIGN_PARENT_LEFT : RelativeLayout.ALIGN_PARENT_RIGHT] = this.mRules[RelativeLayout.ALIGN_PARENT_END];\n                this.mRules[RelativeLayout.ALIGN_PARENT_END] = null;\n            }\n\n        }\n        this.mRulesChanged = false;\n    }\n\n    /**\n         * Retrieves a complete list of all supported rules, where the index is the rule\n         * verb, and the element value is the value specified, or \"false\" if it was never\n         * set. If there are relative rules defined (*_START / *_END), they will be resolved\n         * depending on the layout direction.\n         *\n         * @param layoutDirection the direction of the layout.\n         *                        Should be either {@link View#LAYOUT_DIRECTION_LTR}\n         *                        or {@link View#LAYOUT_DIRECTION_RTL}\n         * @return the supported rules\n         * @see #addRule(int, int)\n         *\n         * @hide\n         */\n    getRules(layoutDirection?:number):string[]  {\n        if(layoutDirection!=null) {\n            if (this.hasRelativeRules() && (this.mRulesChanged || layoutDirection != this.getLayoutDirection())) {\n                this.resolveRules(layoutDirection);\n                if (layoutDirection != this.getLayoutDirection()) {\n                    this.setLayoutDirection(layoutDirection);\n                }\n            }\n        }\n        return this.mRules;\n    }\n\n    resolveLayoutDirection(layoutDirection:number):void  {\n        const isLayoutRtl:boolean = this.isLayoutRtl();\n        if (isLayoutRtl) {\n            if (this.mStart != LayoutParams.DEFAULT_MARGIN_RELATIVE)\n                this.mRight = this.mStart;\n            if (this.mEnd != LayoutParams.DEFAULT_MARGIN_RELATIVE)\n                this.mLeft = this.mEnd;\n        } else {\n            if (this.mStart != LayoutParams.DEFAULT_MARGIN_RELATIVE)\n                this.mLeft = this.mStart;\n            if (this.mEnd != LayoutParams.DEFAULT_MARGIN_RELATIVE)\n                this.mRight = this.mEnd;\n        }\n        if (this.hasRelativeRules() && layoutDirection != this.getLayoutDirection()) {\n            this.resolveRules(layoutDirection);\n        }\n        // This will set the layout direction\n        super.resolveLayoutDirection(layoutDirection);\n    }\n}\nexport class DependencyGraph {\n\n    /**\n         * List of all views in the graph.\n         */\n    private mNodes:ArrayList<DependencyGraph.Node> = new ArrayList<DependencyGraph.Node>();\n\n    /**\n         * List of nodes in the graph. Each node is identified by its\n         * view id (see View#getId()).\n         */\n    mKeyNodes:SparseMap<string, DependencyGraph.Node> = new SparseMap<string, DependencyGraph.Node>();\n\n    /**\n         * Temporary data structure used to build the list of roots\n         * for this graph.\n         */\n    private mRoots:ArrayDeque<DependencyGraph.Node> = new ArrayDeque<DependencyGraph.Node>();\n\n    /**\n         * Clears the graph.\n         */\n    clear():void  {\n        const nodes:ArrayList<DependencyGraph.Node> = this.mNodes;\n        const count:number = nodes.size();\n        for (let i:number = 0; i < count; i++) {\n            nodes.get(i).release();\n        }\n        nodes.clear();\n        this.mKeyNodes.clear();\n        this.mRoots.clear();\n    }\n\n    /**\n         * Adds a view to the graph.\n         *\n         * @param view The view to be added as a node to the graph.\n         */\n    add(view:View):void  {\n        const id:string = view.getId();\n        const node:DependencyGraph.Node = DependencyGraph.Node.acquire(view);\n        if (id != View.NO_ID) {\n            this.mKeyNodes.put(id, node);\n        }\n        this.mNodes.add(node);\n    }\n\n    /**\n         * Builds a sorted list of views. The sorting order depends on the dependencies\n         * between the view. For instance, if view C needs view A to be processed first\n         * and view A needs view B to be processed first, the dependency graph\n         * is: B -> A -> C. The sorted array will contain views B, A and C in this order.\n         *\n         * @param sorted The sorted list of views. The length of this array must\n         *        be equal to getChildCount().\n         * @param rules The list of rules to take into account.\n         */\n    getSortedViews(sorted:View[], rules:number[]):void  {\n        const roots:ArrayDeque<DependencyGraph.Node> = this.findRoots(rules);\n        let index:number = 0;\n        let node:DependencyGraph.Node;\n        while ((node = roots.pollLast()) != null) {\n            const view:View = node.view;\n            const key:string = view.getId();\n            sorted[index++] = view;\n            const dependents:ArrayMap<DependencyGraph.Node, DependencyGraph> = node.dependents;\n            const count:number = dependents.size();\n            for (let i:number = 0; i < count; i++) {\n                const dependent:DependencyGraph.Node = dependents.keyAt(i);\n                const dependencies = dependent.dependencies;\n                dependencies.remove(key);\n                if (dependencies.size() == 0) {\n                    roots.add(dependent);\n                }\n            }\n        }\n        if (index < sorted.length) {\n            throw Error(`new IllegalStateException(\"Circular dependencies cannot exist\" + \" in RelativeLayout\")`);\n        }\n    }\n\n    /**\n         * Finds the roots of the graph. A root is a node with no dependency and\n         * with [0..n] dependents.\n         *\n         * @param rulesFilter The list of rules to consider when building the\n         *        dependencies\n         *\n         * @return A list of node, each being a root of the graph\n         */\n    private findRoots(rulesFilter:number[]):ArrayDeque<DependencyGraph.Node>  {\n        const keyNodes:SparseMap<string, DependencyGraph.Node> = this.mKeyNodes;\n        const nodes:ArrayList<DependencyGraph.Node> = this.mNodes;\n        const count:number = nodes.size();\n        // all dependents and dependencies before running the algorithm\n        for (let i:number = 0; i < count; i++) {\n            const node:DependencyGraph.Node = nodes.get(i);\n            node.dependents.clear();\n            node.dependencies.clear();\n        }\n        // Builds up the dependents and dependencies for each node of the graph\n        for (let i:number = 0; i < count; i++) {\n            const node:DependencyGraph.Node = nodes.get(i);\n            const layoutParams:RelativeLayout.LayoutParams = <RelativeLayout.LayoutParams> node.view.getLayoutParams();\n            const rules:string[] = layoutParams.mRules;\n            const rulesCount:number = rulesFilter.length;\n            // dependencies for a specific set of rules\n            for (let j:number = 0; j < rulesCount; j++) {\n                const rule:string = rules[rulesFilter[j]];\n                if (rule != null) {\n                    // The node this node depends on\n                    const dependency:DependencyGraph.Node = keyNodes.get(rule);\n                    // Skip unknowns and self dependencies\n                    if (dependency == null || dependency == node) {\n                        continue;\n                    }\n                    // Add the current node as a dependent\n                    dependency.dependents.put(node, this);\n                    // Add a dependency to the current node\n                    node.dependencies.put(rule, dependency);\n                }\n            }\n        }\n        const roots:ArrayDeque<DependencyGraph.Node> = this.mRoots;\n        roots.clear();\n        // Finds all the roots in the graph: all nodes with no dependencies\n        for (let i:number = 0; i < count; i++) {\n            const node:DependencyGraph.Node = nodes.get(i);\n            if (node.dependencies.size() == 0)\n                roots.addLast(node);\n        }\n        return roots;\n    }\n\n\n}\n\nexport module DependencyGraph{\n/**\n         * A node in the dependency graph. A node is a view, its list of dependencies\n         * and its list of dependents.\n         *\n         * A node with no dependent is considered a root of the graph.\n         */\nexport class Node {\n\n    /**\n             * The view representing this node in the layout.\n             */\n    view:View;\n\n    /**\n             * The list of dependents for this node; a dependent is a node\n             * that needs this node to be processed first.\n             */\n    dependents:ArrayMap<Node, RelativeLayout.DependencyGraph> = new ArrayMap<Node, RelativeLayout.DependencyGraph>();\n\n    /**\n             * The list of dependencies for this node.\n             */\n    dependencies:SparseMap<string, Node> = new SparseMap<string, Node>();\n\n    /*\n             * START POOL IMPLEMENTATION\n             */\n    // The pool is static, so all nodes instances are shared across\n    // activities, that's why we give it a rather high limit\n    private static POOL_LIMIT:number = 100;\n\n    private static sPool:SynchronizedPool<Node> = new SynchronizedPool<Node>(Node.POOL_LIMIT);\n\n    static acquire(view:View):Node  {\n        let node:Node = Node.sPool.acquire();\n        if (node == null) {\n            node = new Node();\n        }\n        node.view = view;\n        return node;\n    }\n\n    release():void  {\n        this.view = null;\n        this.dependents.clear();\n        this.dependencies.clear();\n        Node.sPool.release(this);\n    }\n    /*\n             * END POOL IMPLEMENTATION\n             */\n}\n}\n\n}\n\n}"
  },
  {
    "path": "src/android/widget/ScrollView.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/os/Bundle.ts\"/>\n///<reference path=\"../../android/util/Log.ts\"/>\n///<reference path=\"../../android/view/FocusFinder.ts\"/>\n///<reference path=\"../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../android/view/VelocityTracker.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewConfiguration.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/view/ViewParent.ts\"/>\n///<reference path=\"../../android/view/animation/AnimationUtils.ts\"/>\n///<reference path=\"../../java/util/List.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../java/lang/System.ts\"/>\n///<reference path=\"../../android/widget/FrameLayout.ts\"/>\n///<reference path=\"../../android/widget/LinearLayout.ts\"/>\n///<reference path=\"../../android/widget/ListView.ts\"/>\n///<reference path=\"../../android/widget/OverScroller.ts\"/>\n///<reference path=\"../../android/widget/Scroller.ts\"/>\n///<reference path=\"../../android/widget/TextView.ts\"/>\n\nmodule android.widget {\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n    import Bundle = android.os.Bundle;\n    import Log = android.util.Log;\n    import FocusFinder = android.view.FocusFinder;\n    import KeyEvent = android.view.KeyEvent;\n    import MotionEvent = android.view.MotionEvent;\n    import VelocityTracker = android.view.VelocityTracker;\n    import View = android.view.View;\n    import ViewConfiguration = android.view.ViewConfiguration;\n    import ViewGroup = android.view.ViewGroup;\n    import ViewParent = android.view.ViewParent;\n    import AnimationUtils = android.view.animation.AnimationUtils;\n    import List = java.util.List;\n    import Integer = java.lang.Integer;\n    import System = java.lang.System;\n    import FrameLayout = android.widget.FrameLayout;\n    import LinearLayout = android.widget.LinearLayout;\n    import ListView = android.widget.ListView;\n    import OverScroller = android.widget.OverScroller;\n    import Scroller = android.widget.Scroller;\n    import TextView = android.widget.TextView;\n    import AttrBinder = androidui.attr.AttrBinder;\n    /**\n     * Layout container for a view hierarchy that can be scrolled by the user,\n     * allowing it to be larger than the physical display.  A ScrollView\n     * is a {@link FrameLayout}, meaning you should place one child in it\n     * containing the entire contents to scroll; this child may itself be a layout\n     * manager with a complex hierarchy of objects.  A child that is often used\n     * is a {@link LinearLayout} in a vertical orientation, presenting a vertical\n     * array of top-level items that the user can scroll through.\n     * <p>You should never use a ScrollView with a {@link ListView}, because\n     * ListView takes care of its own vertical scrolling.  Most importantly, doing this\n     * defeats all of the important optimizations in ListView for dealing with\n     * large lists, since it effectively forces the ListView to display its entire\n     * list of items to fill up the infinite container supplied by ScrollView.\n     * <p>The {@link TextView} class also\n     * takes care of its own scrolling, so does not require a ScrollView, but\n     * using the two together is possible to achieve the effect of a text view\n     * within a larger container.\n     *\n     * <p>ScrollView only supports vertical scrolling. For horizontal scrolling,\n     * use {@link HorizontalScrollView}.\n     *\n     * @attr ref android.R.styleable#ScrollView_fillViewport\n     */\n    export class ScrollView extends FrameLayout {\n\n        static ANIMATED_SCROLL_GAP: number = 250;\n\n        static MAX_SCROLL_FACTOR: number = 0.5;\n\n        private static TAG: string = \"ScrollView\";\n\n        private mLastScroll: number = 0;\n\n        private mTempRect: Rect = new Rect();\n\n        private mScroller: OverScroller;\n\n        // private mEdgeGlowTop:EdgeEffect;\n        //\n        // private mEdgeGlowBottom:EdgeEffect;\n\n        /**\n         * Position of the last motion event.\n         */\n        private mLastMotionY: number = 0;\n\n        /**\n         * True when the layout has changed but the traversal has not come through yet.\n         * Ideally the view hierarchy would keep track of this for us.\n         */\n        private mIsLayoutDirty: boolean = true;\n\n        /**\n         * The child to give focus to in the event that a child has requested focus while the\n         * layout is dirty. This prevents the scroll from being wrong if the child has not been\n         * laid out before requesting focus.\n         */\n        private mChildToScrollTo: View = null;\n\n        /**\n         * True if the user is currently dragging this ScrollView around. This is\n         * not the same as 'is being flinged', which can be checked by\n         * mScroller.isFinished() (flinging begins when the user lifts his finger).\n         */\n        private mIsBeingDragged: boolean = false;\n\n        /**\n         * Determines speed during touch scrolling\n         */\n        private mVelocityTracker: VelocityTracker;\n\n        /**\n         * When set to true, the scroll view measure its child to make it fill the currently\n         * visible area.\n         */\n        private mFillViewport: boolean;\n\n        /**\n         * Whether arrow scrolling is animated.\n         */\n        private mSmoothScrollingEnabled: boolean = true;\n\n        // private mTouchSlop:number = 0;\n\n        private mMinimumVelocity: number = 0;\n\n        private mMaximumVelocity: number = 0;\n\n        private mOverscrollDistance: number = 0;\n\n        private mOverflingDistance: number = 0;\n\n        /**\n         * ID of the active pointer. This is used to retain consistency during\n         * drags/flings if multiple pointers are used.\n         */\n        private mActivePointerId: number = ScrollView.INVALID_POINTER;\n\n        // /**\n        //  * The StrictMode \"critical time span\" objects to catch animation\n        //  * stutters.  Non-null when a time-sensitive animation is\n        //  * in-flight.  Must call finish() on them when done animating.\n        //  * These are no-ops on user builds.\n        //  */\n        //     // aka \"drag\"\n        // private mScrollStrictSpan:StrictMode.Span = null;\n        //\n        // private mFlingStrictSpan:StrictMode.Span = null;\n\n        /**\n         * Sentinel value for no current active pointer.\n         * Used by {@link #mActivePointerId}.\n         */\n        private static INVALID_POINTER: number = -1;\n\n        // private mSavedState:ScrollView.SavedState;\n\n        constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle=R.attr.scrollViewStyle) {\n            super(context, bindElement, defStyle);\n            this.initScrollView();\n\n            const a = context.obtainStyledAttributes(bindElement, defStyle);\n\n            this.setFillViewport(a.getBoolean('fillViewport', false));\n\n            a.recycle();\n        }\n\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n            return super.createClassAttrBinder().set('fillViewport', {\n                setter(v:ScrollView, value:any, attrBinder:AttrBinder) {\n                    v.setFillViewport(attrBinder.parseBoolean(value));\n                }, getter(v:ScrollView) {\n                    return v.isFillViewport();\n                }\n            });\n        }\n\n        shouldDelayChildPressedState(): boolean {\n            return true;\n        }\n\n        protected getTopFadingEdgeStrength(): number {\n            if (this.getChildCount() == 0) {\n                return 0.0;\n            }\n            const length: number = this.getVerticalFadingEdgeLength();\n            if (this.mScrollY < length) {\n                return this.mScrollY / <number> length;\n            }\n            return 1.0;\n        }\n\n        protected getBottomFadingEdgeStrength(): number {\n            if (this.getChildCount() == 0) {\n                return 0.0;\n            }\n            const length: number = this.getVerticalFadingEdgeLength();\n            const bottomEdge: number = this.getHeight() - this.mPaddingBottom;\n            const span: number = this.getChildAt(0).getBottom() - this.mScrollY - bottomEdge;\n            if (span < length) {\n                return span / <number> length;\n            }\n            return 1.0;\n        }\n\n        /**\n         * @return The maximum amount this scroll view will scroll in response to\n         *   an arrow event.\n         */\n        getMaxScrollAmount(): number {\n            return Math.floor((ScrollView.MAX_SCROLL_FACTOR * (this.mBottom - this.mTop)));\n        }\n\n        private initScrollView(): void {\n            this.mScroller = new OverScroller();\n            this.setFocusable(true);\n            this.setDescendantFocusability(ScrollView.FOCUS_AFTER_DESCENDANTS);\n            this.setWillNotDraw(false);\n            const configuration: ViewConfiguration = ViewConfiguration.get(this.mContext);\n            this.mTouchSlop = configuration.getScaledTouchSlop();\n            this.mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();\n            this.mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();\n            this.mOverscrollDistance = configuration.getScaledOverscrollDistance();\n            this.mOverflingDistance = configuration.getScaledOverflingDistance();\n        }\n\n        addView(...args): void {\n            if (this.getChildCount() > 0) {\n                throw new Error(\"ScrollView can host only one direct child\");\n            }\n            return super.addView(...args);\n        }\n\n        /**\n         * @return Returns true this ScrollView can be scrolled\n         */\n        private canScroll(): boolean {\n            let child: View = this.getChildAt(0);\n            if (child != null) {\n                let childHeight: number = child.getHeight();\n                return this.getHeight() < childHeight + this.mPaddingTop + this.mPaddingBottom;\n            }\n            return false;\n        }\n\n        /**\n         * Indicates whether this ScrollView's content is stretched to fill the viewport.\n         *\n         * @return True if the content fills the viewport, false otherwise.\n         *\n         * @attr ref android.R.styleable#ScrollView_fillViewport\n         */\n        isFillViewport(): boolean {\n            return this.mFillViewport;\n        }\n\n        /**\n         * Indicates this ScrollView whether it should stretch its content height to fill\n         * the viewport or not.\n         *\n         * @param fillViewport True to stretch the content's height to the viewport's\n         *        boundaries, false otherwise.\n         *\n         * @attr ref android.R.styleable#ScrollView_fillViewport\n         */\n        setFillViewport(fillViewport: boolean): void {\n            if (fillViewport != this.mFillViewport) {\n                this.mFillViewport = fillViewport;\n                this.requestLayout();\n            }\n        }\n\n        /**\n         * @return Whether arrow scrolling will animate its transition.\n         */\n        isSmoothScrollingEnabled(): boolean {\n            return this.mSmoothScrollingEnabled;\n        }\n\n        /**\n         * Set whether arrow scrolling will animate its transition.\n         * @param smoothScrollingEnabled whether arrow scrolling will animate its transition\n         */\n        setSmoothScrollingEnabled(smoothScrollingEnabled: boolean): void {\n            this.mSmoothScrollingEnabled = smoothScrollingEnabled;\n        }\n\n        protected onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void {\n            super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n            if (!this.mFillViewport) {\n                return;\n            }\n            const heightMode: number = View.MeasureSpec.getMode(heightMeasureSpec);\n            if (heightMode == View.MeasureSpec.UNSPECIFIED) {\n                return;\n            }\n            if (this.getChildCount() > 0) {\n                const child: View = this.getChildAt(0);\n                let height: number = this.getMeasuredHeight();\n                if (child.getMeasuredHeight() < height) {\n                    const lp: FrameLayout.LayoutParams = <FrameLayout.LayoutParams> child.getLayoutParams();\n                    let childWidthMeasureSpec: number = ScrollView.getChildMeasureSpec(widthMeasureSpec, this.mPaddingLeft + this.mPaddingRight, lp.width);\n                    height -= this.mPaddingTop;\n                    height -= this.mPaddingBottom;\n                    let childHeightMeasureSpec: number = View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.EXACTLY);\n                    child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n                }\n            }\n        }\n\n        dispatchKeyEvent(event: KeyEvent): boolean {\n            // Let the focused view and/or our descendants get the key first\n            return super.dispatchKeyEvent(event) || this.executeKeyEvent(event);\n        }\n\n        /**\n         * You can call this function yourself to have the scroll view perform\n         * scrolling from a key event, just as if the event had been dispatched to\n         * it by the view hierarchy.\n         *\n         * @param event The key event to execute.\n         * @return Return true if the event was handled, else false.\n         */\n        executeKeyEvent(event: KeyEvent): boolean {\n            this.mTempRect.setEmpty();\n            if (!this.canScroll()) {\n                if (this.isFocused() && event.getKeyCode() != KeyEvent.KEYCODE_BACK) {\n                    let currentFocused: View = this.findFocus();\n                    if (currentFocused == this)\n                        currentFocused = null;\n                    let nextFocused: View = FocusFinder.getInstance().findNextFocus(this, currentFocused, View.FOCUS_DOWN);\n                    return nextFocused != null && nextFocused != this && nextFocused.requestFocus(View.FOCUS_DOWN);\n                }\n                return false;\n            }\n            let handled: boolean = false;\n            if (event.getAction() == KeyEvent.ACTION_DOWN) {\n                switch (event.getKeyCode()) {\n                    case KeyEvent.KEYCODE_DPAD_UP:\n                        if (!event.isAltPressed()) {\n                            handled = this.arrowScroll(View.FOCUS_UP);\n                        } else {\n                            handled = this.fullScroll(View.FOCUS_UP);\n                        }\n                        break;\n                    case KeyEvent.KEYCODE_DPAD_DOWN:\n                        if (!event.isAltPressed()) {\n                            handled = this.arrowScroll(View.FOCUS_DOWN);\n                        } else {\n                            handled = this.fullScroll(View.FOCUS_DOWN);\n                        }\n                        break;\n                    case KeyEvent.KEYCODE_SPACE:\n                        this.pageScroll(event.isShiftPressed() ? View.FOCUS_UP : View.FOCUS_DOWN);\n                        break;\n                }\n            }\n            return handled;\n        }\n\n        private inChild(x: number, y: number): boolean {\n            if (this.getChildCount() > 0) {\n                const scrollY: number = this.mScrollY;\n                const child: View = this.getChildAt(0);\n                return !(y < child.getTop() - scrollY || y >= child.getBottom() - scrollY || x < child.getLeft() || x >= child.getRight());\n            }\n            return false;\n        }\n\n        private initOrResetVelocityTracker(): void {\n            if (this.mVelocityTracker == null) {\n                this.mVelocityTracker = VelocityTracker.obtain();\n            } else {\n                this.mVelocityTracker.clear();\n            }\n        }\n\n        private initVelocityTrackerIfNotExists(): void {\n            if (this.mVelocityTracker == null) {\n                this.mVelocityTracker = VelocityTracker.obtain();\n            }\n        }\n\n        private recycleVelocityTracker(): void {\n            if (this.mVelocityTracker != null) {\n                this.mVelocityTracker.recycle();\n                this.mVelocityTracker = null;\n            }\n        }\n\n        requestDisallowInterceptTouchEvent(disallowIntercept: boolean): void {\n            if (disallowIntercept) {\n                this.recycleVelocityTracker();\n            }\n            super.requestDisallowInterceptTouchEvent(disallowIntercept);\n        }\n\n        onInterceptTouchEvent(ev: MotionEvent): boolean {\n            /*\n             * This method JUST determines whether we want to intercept the motion.\n             * If we return true, onMotionEvent will be called and we do the actual\n             * scrolling there.\n             */\n            /*\n             * Shortcut the most recurring case: the user is in the dragging\n             * state and he is moving his finger.  We want to intercept this\n             * motion.\n             */\n            const action: number = ev.getAction();\n            if ((action == MotionEvent.ACTION_MOVE) && (this.mIsBeingDragged)) {\n                return true;\n            }\n            /*\n             * Don't try to intercept touch if we can't scroll anyway.\n             */\n            if (this.getScrollY() == 0 && !this.canScrollVertically(1)) {\n                return false;\n            }\n            switch (action & MotionEvent.ACTION_MASK) {\n                case MotionEvent.ACTION_MOVE: {\n                    /*\n                     * mIsBeingDragged == false, otherwise the shortcut would have caught it. Check\n                     * whether the user has moved far enough from his original down touch.\n                     */\n                    /*\n                     * Locally do absolute value. mLastMotionY is set to the y value\n                     * of the down event.\n                     */\n                    const activePointerId: number = this.mActivePointerId;\n                    if (activePointerId == ScrollView.INVALID_POINTER) {\n                        // If we don't have a valid id, the touch down wasn't on content.\n                        break;\n                    }\n                    const pointerIndex: number = ev.findPointerIndex(activePointerId);\n                    if (pointerIndex == -1) {\n                        Log.e(ScrollView.TAG, \"Invalid pointerId=\" + activePointerId + \" in onInterceptTouchEvent\");\n                        break;\n                    }\n                    const y: number = Math.floor(ev.getY(pointerIndex));\n                    const yDiff: number = Math.abs(y - this.mLastMotionY);\n                    if (yDiff > this.mTouchSlop) {\n                        this.mIsBeingDragged = true;\n                        this.mLastMotionY = y;\n                        this.initVelocityTrackerIfNotExists();\n                        this.mVelocityTracker.addMovement(ev);\n                        // if (this.mScrollStrictSpan == null) {\n                        //     this.mScrollStrictSpan = StrictMode.enterCriticalSpan(\"ScrollView-scroll\");\n                        // }\n                        const parent: ViewParent = this.getParent();\n                        if (parent != null) {\n                            parent.requestDisallowInterceptTouchEvent(true);\n                        }\n                    }\n                    break;\n                }\n                case MotionEvent.ACTION_DOWN: {\n                    const y: number = Math.floor(ev.getY());\n                    if (!this.inChild(Math.floor(ev.getX()), Math.floor(y))) {\n                        this.mIsBeingDragged = false;\n                        this.recycleVelocityTracker();\n                        break;\n                    }\n                    /*\n                     * Remember location of down touch.\n                     * ACTION_DOWN always refers to pointer index 0.\n                     */\n                    this.mLastMotionY = y;\n                    this.mActivePointerId = ev.getPointerId(0);\n                    this.initOrResetVelocityTracker();\n                    this.mVelocityTracker.addMovement(ev);\n                    /*\n                     * If being flinged and user touches the screen, initiate drag;\n                     * otherwise don't.  mScroller.isFinished should be false when\n                     * being flinged.\n                     */\n                    this.mIsBeingDragged = !this.mScroller.isFinished();\n                    // if (this.mIsBeingDragged && this.mScrollStrictSpan == null) {\n                    //     this.mScrollStrictSpan = StrictMode.enterCriticalSpan(\"ScrollView-scroll\");\n                    // }\n                    break;\n                }\n                case MotionEvent.ACTION_CANCEL:\n                case MotionEvent.ACTION_UP:\n                    /* Release the drag */\n                    this.mIsBeingDragged = false;\n                    this.mActivePointerId = ScrollView.INVALID_POINTER;\n                    this.recycleVelocityTracker();\n                    if (this.mScroller.springBack(this.mScrollX, this.mScrollY, 0, 0, 0, this.getScrollRange())) {\n                        this.postInvalidateOnAnimation();\n                    }\n                    break;\n                case MotionEvent.ACTION_POINTER_UP:\n                    this.onSecondaryPointerUp(ev);\n                    break;\n            }\n            /*\n             * The only time we want to intercept motion events is if we are in the\n             * drag mode.\n             */\n            return this.mIsBeingDragged;\n        }\n\n        onTouchEvent(ev: MotionEvent): boolean {\n            this.initVelocityTrackerIfNotExists();\n            this.mVelocityTracker.addMovement(ev);\n            const action: number = ev.getAction();\n            switch (action & MotionEvent.ACTION_MASK) {\n                case MotionEvent.ACTION_DOWN: {\n                    if (this.getChildCount() == 0) {\n                        return false;\n                    }\n                    if ((this.mIsBeingDragged = !this.mScroller.isFinished())) {\n                        const parent: ViewParent = this.getParent();\n                        if (parent != null) {\n                            parent.requestDisallowInterceptTouchEvent(true);\n                        }\n                    }\n                    /*\n                     * If being flinged and user touches, stop the fling. isFinished\n                     * will be false if being flinged.\n                     */\n                    if (!this.mScroller.isFinished()) {\n                        this.mScroller.abortAnimation();\n                        // if (this.mFlingStrictSpan != null) {\n                        //     this.mFlingStrictSpan.finish();\n                        //     this.mFlingStrictSpan = null;\n                        // }\n                    }\n                    // Remember where the motion event started\n                    this.mLastMotionY = Math.floor(ev.getY());\n                    this.mActivePointerId = ev.getPointerId(0);\n                    break;\n                }\n                case MotionEvent.ACTION_MOVE:\n                    const activePointerIndex: number = ev.findPointerIndex(this.mActivePointerId);\n                    if (activePointerIndex == -1) {\n                        Log.e(ScrollView.TAG, \"Invalid pointerId=\" + this.mActivePointerId + \" in onTouchEvent\");\n                        break;\n                    }\n                    const y: number = Math.floor(ev.getY(activePointerIndex));\n                    let deltaY: number = this.mLastMotionY - y;\n                    if (!this.mIsBeingDragged && Math.abs(deltaY) > this.mTouchSlop) {\n                        const parent: ViewParent = this.getParent();\n                        if (parent != null) {\n                            parent.requestDisallowInterceptTouchEvent(true);\n                        }\n                        this.mIsBeingDragged = true;\n                        if (deltaY > 0) {\n                            deltaY -= this.mTouchSlop;\n                        } else {\n                            deltaY += this.mTouchSlop;\n                        }\n                    }\n                    if (this.mIsBeingDragged) {\n                        // Scroll to follow the motion event\n                        this.mLastMotionY = y;\n                        const oldX: number = this.mScrollX;\n                        const oldY: number = this.mScrollY;\n                        const range: number = this.getScrollRange();\n                        const overscrollMode: number = this.getOverScrollMode();\n                        const canOverscroll: boolean = overscrollMode == ScrollView.OVER_SCROLL_ALWAYS || (overscrollMode == ScrollView.OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0);\n                        // calls onScrollChanged if applicable.\n                        if (this.overScrollBy(0, deltaY, 0, this.mScrollY, 0, range, 0, this.mOverscrollDistance, true)) {\n                            // Break our velocity if we hit a scroll barrier.\n                            this.mVelocityTracker.clear();\n                        }\n                        // if (canOverscroll) {\n                        //     const pulledToY:number = oldY + deltaY;\n                        //     if (pulledToY < 0) {\n                        //         this.mEdgeGlowTop.onPull(<number> deltaY / this.getHeight());\n                        //         if (!this.mEdgeGlowBottom.isFinished()) {\n                        //             this.mEdgeGlowBottom.onRelease();\n                        //         }\n                        //     } else if (pulledToY > range) {\n                        //         this.mEdgeGlowBottom.onPull(<number> deltaY / this.getHeight());\n                        //         if (!this.mEdgeGlowTop.isFinished()) {\n                        //             this.mEdgeGlowTop.onRelease();\n                        //         }\n                        //     }\n                        //     if (this.mEdgeGlowTop != null && (!this.mEdgeGlowTop.isFinished() || !this.mEdgeGlowBottom.isFinished())) {\n                        //         this.postInvalidateOnAnimation();\n                        //     }\n                        // }\n                    }\n                    break;\n                case MotionEvent.ACTION_UP:\n                    if (this.mIsBeingDragged) {\n                        const velocityTracker: VelocityTracker = this.mVelocityTracker;\n                        velocityTracker.computeCurrentVelocity(1000, this.mMaximumVelocity);\n                        let initialVelocity: number = Math.floor(velocityTracker.getYVelocity(this.mActivePointerId));\n                        if (this.getChildCount() > 0) {\n                            const springBack = this.mScrollY < -this.mOverflingDistance || this.mScrollY - this.getScrollRange() > this.mOverflingDistance;\n                            if (!springBack && (Math.abs(initialVelocity) > this.mMinimumVelocity)) {\n                                this.fling(-initialVelocity);\n                            } else {\n                                if (this.mScroller.springBack(this.mScrollX, this.mScrollY, 0, 0, 0, this.getScrollRange())) {\n                                    this.postInvalidateOnAnimation();\n                                }\n                            }\n                        }\n                        this.mActivePointerId = ScrollView.INVALID_POINTER;\n                        this.endDrag();\n                    }\n                    break;\n                case MotionEvent.ACTION_CANCEL:\n                    if (this.mIsBeingDragged && this.getChildCount() > 0) {\n                        if (this.mScroller.springBack(this.mScrollX, this.mScrollY, 0, 0, 0, this.getScrollRange())) {\n                            this.postInvalidateOnAnimation();\n                        }\n                        this.mActivePointerId = ScrollView.INVALID_POINTER;\n                        this.endDrag();\n                    }\n                    break;\n                case MotionEvent.ACTION_POINTER_DOWN: {\n                    const index: number = ev.getActionIndex();\n                    this.mLastMotionY = Math.floor(ev.getY(index));\n                    this.mActivePointerId = ev.getPointerId(index);\n                    break;\n                }\n                case MotionEvent.ACTION_POINTER_UP:\n                    this.onSecondaryPointerUp(ev);\n                    this.mLastMotionY = Math.floor(ev.getY(ev.findPointerIndex(this.mActivePointerId)));\n                    break;\n            }\n            return true;\n        }\n\n        private onSecondaryPointerUp(ev: MotionEvent): void {\n            const pointerIndex: number = (ev.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;\n            const pointerId: number = ev.getPointerId(pointerIndex);\n            if (pointerId == this.mActivePointerId) {\n                // This was our active pointer going up. Choose a new\n                // active pointer and adjust accordingly.\n                // TODO: Make this decision more intelligent.\n                const newPointerIndex: number = pointerIndex == 0 ? 1 : 0;\n                this.mLastMotionY = Math.floor(ev.getY(newPointerIndex));\n                this.mActivePointerId = ev.getPointerId(newPointerIndex);\n                if (this.mVelocityTracker != null) {\n                    this.mVelocityTracker.clear();\n                }\n            }\n        }\n\n        onGenericMotionEvent(event: MotionEvent): boolean {\n            if (event.isPointerEvent()) {\n                switch (event.getAction()) {\n                    case MotionEvent.ACTION_SCROLL: {\n                        if (!this.mIsBeingDragged) {\n                            const vscroll: number = event.getAxisValue(MotionEvent.AXIS_VSCROLL);\n                            if (vscroll != 0) {\n                                const delta: number = Math.floor((vscroll * this.getVerticalScrollFactor()));\n                                const range: number = this.getScrollRange();\n                                let oldScrollY: number = this.mScrollY;\n                                let newScrollY: number = oldScrollY - delta;\n                                if (newScrollY < 0) {\n                                    newScrollY = 0;\n                                } else if (newScrollY > range) {\n                                    newScrollY = range;\n                                }\n                                if (newScrollY != oldScrollY) {\n                                    super.scrollTo(this.mScrollX, newScrollY);\n                                    return true;\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n            return super.onGenericMotionEvent(event);\n        }\n\n        protected onOverScrolled(scrollX: number, scrollY: number, clampedX: boolean, clampedY: boolean): void {\n            // Treat animating scrolls differently; see #computeScroll() for why.\n            if (!this.mScroller.isFinished()) {\n                const oldX: number = this.mScrollX;\n                const oldY: number = this.mScrollY;\n                this.mScrollX = scrollX;\n                this.mScrollY = scrollY;\n                this.invalidateParentIfNeeded();\n                this.onScrollChanged(this.mScrollX, this.mScrollY, oldX, oldY);\n                if (clampedY) {\n                    this.mScroller.springBack(this.mScrollX, this.mScrollY, 0, 0, 0, this.getScrollRange());\n                }\n            } else {\n                super.scrollTo(scrollX, scrollY);\n            }\n            this.awakenScrollBars();\n        }\n\n        // performAccessibilityAction(action:number, arguments:Bundle):boolean  {\n        //     if (super.performAccessibilityAction(action, arguments)) {\n        //         return true;\n        //     }\n        //     if (!this.isEnabled()) {\n        //         return false;\n        //     }\n        //     switch(action) {\n        //         case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD:\n        //         {\n        //             const viewportHeight:number = this.getHeight() - this.mPaddingBottom - this.mPaddingTop;\n        //             const targetScrollY:number = Math.min(this.mScrollY + viewportHeight, this.getScrollRange());\n        //             if (targetScrollY != this.mScrollY) {\n        //                 this.smoothScrollTo(0, targetScrollY);\n        //                 return true;\n        //             }\n        //         }\n        //             return false;\n        //         case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD:\n        //         {\n        //             const viewportHeight:number = this.getHeight() - this.mPaddingBottom - this.mPaddingTop;\n        //             const targetScrollY:number = Math.max(this.mScrollY - viewportHeight, 0);\n        //             if (targetScrollY != this.mScrollY) {\n        //                 this.smoothScrollTo(0, targetScrollY);\n        //                 return true;\n        //             }\n        //         }\n        //             return false;\n        //     }\n        //     return false;\n        // }\n        //\n        // onInitializeAccessibilityNodeInfo(info:AccessibilityNodeInfo):void  {\n        //     super.onInitializeAccessibilityNodeInfo(info);\n        //     info.setClassName(ScrollView.class.getName());\n        //     if (this.isEnabled()) {\n        //         const scrollRange:number = this.getScrollRange();\n        //         if (scrollRange > 0) {\n        //             info.setScrollable(true);\n        //             if (this.mScrollY > 0) {\n        //                 info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);\n        //             }\n        //             if (this.mScrollY < scrollRange) {\n        //                 info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);\n        //             }\n        //         }\n        //     }\n        // }\n        //\n        // onInitializeAccessibilityEvent(event:AccessibilityEvent):void  {\n        //     super.onInitializeAccessibilityEvent(event);\n        //     event.setClassName(ScrollView.class.getName());\n        //     const scrollable:boolean = this.getScrollRange() > 0;\n        //     event.setScrollable(scrollable);\n        //     event.setScrollX(this.mScrollX);\n        //     event.setScrollY(this.mScrollY);\n        //     event.setMaxScrollX(this.mScrollX);\n        //     event.setMaxScrollY(this.getScrollRange());\n        // }\n\n        private getScrollRange(): number {\n            let scrollRange: number = 0;\n            if (this.getChildCount() > 0) {\n                let child: View = this.getChildAt(0);\n                scrollRange = Math.max(0, child.getHeight() - (this.getHeight() - this.mPaddingBottom - this.mPaddingTop));\n            }\n            return scrollRange;\n        }\n\n        /**\n         * <p>\n         * Finds the next focusable component that fits in the specified bounds.\n         * </p>\n         *\n         * @param topFocus look for a candidate is the one at the top of the bounds\n         *                 if topFocus is true, or at the bottom of the bounds if topFocus is\n         *                 false\n         * @param top      the top offset of the bounds in which a focusable must be\n         *                 found\n         * @param bottom   the bottom offset of the bounds in which a focusable must\n         *                 be found\n         * @return the next focusable component in the bounds or null if none can\n         *         be found\n         */\n        private findFocusableViewInBounds(topFocus: boolean, top: number, bottom: number): View {\n            let focusables: List<View> = this.getFocusables(View.FOCUS_FORWARD);\n            let focusCandidate: View = null;\n            /*\n             * A fully contained focusable is one where its top is below the bound's\n             * top, and its bottom is above the bound's bottom. A partially\n             * contained focusable is one where some part of it is within the\n             * bounds, but it also has some part that is not within bounds.  A fully contained\n             * focusable is preferred to a partially contained focusable.\n             */\n            let foundFullyContainedFocusable: boolean = false;\n            let count: number = focusables.size();\n            for (let i: number = 0; i < count; i++) {\n                let view: View = focusables.get(i);\n                let viewTop: number = view.getTop();\n                let viewBottom: number = view.getBottom();\n                if (top < viewBottom && viewTop < bottom) {\n                    /*\n                     * the focusable is in the target area, it is a candidate for\n                     * focusing\n                     */\n                    const viewIsFullyContained: boolean = (top < viewTop) && (viewBottom < bottom);\n                    if (focusCandidate == null) {\n                        /* No candidate, take this one */\n                        focusCandidate = view;\n                        foundFullyContainedFocusable = viewIsFullyContained;\n                    } else {\n                        const viewIsCloserToBoundary: boolean = (topFocus && viewTop < focusCandidate.getTop()) || (!topFocus && viewBottom > focusCandidate.getBottom());\n                        if (foundFullyContainedFocusable) {\n                            if (viewIsFullyContained && viewIsCloserToBoundary) {\n                                /*\n                                 * We're dealing with only fully contained views, so\n                                 * it has to be closer to the boundary to beat our\n                                 * candidate\n                                 */\n                                focusCandidate = view;\n                            }\n                        } else {\n                            if (viewIsFullyContained) {\n                                /* Any fully contained view beats a partially contained view */\n                                focusCandidate = view;\n                                foundFullyContainedFocusable = true;\n                            } else if (viewIsCloserToBoundary) {\n                                /*\n                                 * Partially contained view beats another partially\n                                 * contained view if it's closer\n                                 */\n                                focusCandidate = view;\n                            }\n                        }\n                    }\n                }\n            }\n            return focusCandidate;\n        }\n\n        /**\n         * <p>Handles scrolling in response to a \"page up/down\" shortcut press. This\n         * method will scroll the view by one page up or down and give the focus\n         * to the topmost/bottommost component in the new visible area. If no\n         * component is a good candidate for focus, this scrollview reclaims the\n         * focus.</p>\n         *\n         * @param direction the scroll direction: {@link android.view.View#FOCUS_UP}\n         *                  to go one page up or\n         *                  {@link android.view.View#FOCUS_DOWN} to go one page down\n         * @return true if the key event is consumed by this method, false otherwise\n         */\n        pageScroll(direction: number): boolean {\n            let down: boolean = direction == View.FOCUS_DOWN;\n            let height: number = this.getHeight();\n            if (down) {\n                this.mTempRect.top = this.getScrollY() + height;\n                let count: number = this.getChildCount();\n                if (count > 0) {\n                    let view: View = this.getChildAt(count - 1);\n                    if (this.mTempRect.top + height > view.getBottom()) {\n                        this.mTempRect.top = view.getBottom() - height;\n                    }\n                }\n            } else {\n                this.mTempRect.top = this.getScrollY() - height;\n                if (this.mTempRect.top < 0) {\n                    this.mTempRect.top = 0;\n                }\n            }\n            this.mTempRect.bottom = this.mTempRect.top + height;\n            return this.scrollAndFocus(direction, this.mTempRect.top, this.mTempRect.bottom);\n        }\n\n        /**\n         * <p>Handles scrolling in response to a \"home/end\" shortcut press. This\n         * method will scroll the view to the top or bottom and give the focus\n         * to the topmost/bottommost component in the new visible area. If no\n         * component is a good candidate for focus, this scrollview reclaims the\n         * focus.</p>\n         *\n         * @param direction the scroll direction: {@link android.view.View#FOCUS_UP}\n         *                  to go the top of the view or\n         *                  {@link android.view.View#FOCUS_DOWN} to go the bottom\n         * @return true if the key event is consumed by this method, false otherwise\n         */\n        fullScroll(direction: number): boolean {\n            let down: boolean = direction == View.FOCUS_DOWN;\n            let height: number = this.getHeight();\n            this.mTempRect.top = 0;\n            this.mTempRect.bottom = height;\n            if (down) {\n                let count: number = this.getChildCount();\n                if (count > 0) {\n                    let view: View = this.getChildAt(count - 1);\n                    this.mTempRect.bottom = view.getBottom() + this.mPaddingBottom;\n                    this.mTempRect.top = this.mTempRect.bottom - height;\n                }\n            }\n            return this.scrollAndFocus(direction, this.mTempRect.top, this.mTempRect.bottom);\n        }\n\n        /**\n         * <p>Scrolls the view to make the area defined by <code>top</code> and\n         * <code>bottom</code> visible. This method attempts to give the focus\n         * to a component visible in this area. If no component can be focused in\n         * the new visible area, the focus is reclaimed by this ScrollView.</p>\n         *\n         * @param direction the scroll direction: {@link android.view.View#FOCUS_UP}\n         *                  to go upward, {@link android.view.View#FOCUS_DOWN} to downward\n         * @param top       the top offset of the new area to be made visible\n         * @param bottom    the bottom offset of the new area to be made visible\n         * @return true if the key event is consumed by this method, false otherwise\n         */\n        private scrollAndFocus(direction: number, top: number, bottom: number): boolean {\n            let handled: boolean = true;\n            let height: number = this.getHeight();\n            let containerTop: number = this.getScrollY();\n            let containerBottom: number = containerTop + height;\n            let up: boolean = direction == View.FOCUS_UP;\n            let newFocused: View = this.findFocusableViewInBounds(up, top, bottom);\n            if (newFocused == null) {\n                newFocused = this;\n            }\n            if (top >= containerTop && bottom <= containerBottom) {\n                handled = false;\n            } else {\n                let delta: number = up ? (top - containerTop) : (bottom - containerBottom);\n                this.doScrollY(delta);\n            }\n            if (newFocused != this.findFocus())\n                newFocused.requestFocus(direction);\n            return handled;\n        }\n\n        /**\n         * Handle scrolling in response to an up or down arrow click.\n         *\n         * @param direction The direction corresponding to the arrow key that was\n         *                  pressed\n         * @return True if we consumed the event, false otherwise\n         */\n        arrowScroll(direction: number): boolean {\n            let currentFocused: View = this.findFocus();\n            if (currentFocused == this)\n                currentFocused = null;\n            let nextFocused: View = FocusFinder.getInstance().findNextFocus(this, currentFocused, direction);\n            const maxJump: number = this.getMaxScrollAmount();\n            if (nextFocused != null && this.isWithinDeltaOfScreen(nextFocused, maxJump, this.getHeight())) {\n                nextFocused.getDrawingRect(this.mTempRect);\n                this.offsetDescendantRectToMyCoords(nextFocused, this.mTempRect);\n                let scrollDelta: number = this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);\n                this.doScrollY(scrollDelta);\n                nextFocused.requestFocus(direction);\n            } else {\n                // no new focus\n                let scrollDelta: number = maxJump;\n                if (direction == View.FOCUS_UP && this.getScrollY() < scrollDelta) {\n                    scrollDelta = this.getScrollY();\n                } else if (direction == View.FOCUS_DOWN) {\n                    if (this.getChildCount() > 0) {\n                        let daBottom: number = this.getChildAt(0).getBottom();\n                        let screenBottom: number = this.getScrollY() + this.getHeight() - this.mPaddingBottom;\n                        if (daBottom - screenBottom < maxJump) {\n                            scrollDelta = daBottom - screenBottom;\n                        }\n                    }\n                }\n                if (scrollDelta == 0) {\n                    return false;\n                }\n                this.doScrollY(direction == View.FOCUS_DOWN ? scrollDelta : -scrollDelta);\n            }\n            if (currentFocused != null && currentFocused.isFocused() && this.isOffScreen(currentFocused)) {\n                // previously focused item still has focus and is off screen, give\n                // it up (take it back to ourselves)\n                // (also, need to temporarily force FOCUS_BEFORE_DESCENDANTS so we are\n                // sure to\n                // get it)\n                // save\n                const descendantFocusability: number = this.getDescendantFocusability();\n                this.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);\n                this.requestFocus();\n                // restore\n                this.setDescendantFocusability(descendantFocusability);\n            }\n            return true;\n        }\n\n        /**\n         * @return whether the descendant of this scroll view is scrolled off\n         *  screen.\n         */\n        private isOffScreen(descendant: View): boolean {\n            return !this.isWithinDeltaOfScreen(descendant, 0, this.getHeight());\n        }\n\n        /**\n         * @return whether the descendant of this scroll view is within delta\n         *  pixels of being on the screen.\n         */\n        private isWithinDeltaOfScreen(descendant: View, delta: number, height: number): boolean {\n            descendant.getDrawingRect(this.mTempRect);\n            this.offsetDescendantRectToMyCoords(descendant, this.mTempRect);\n            return (this.mTempRect.bottom + delta) >= this.getScrollY() && (this.mTempRect.top - delta) <= (this.getScrollY() + height);\n        }\n\n        /**\n         * Smooth scroll by a Y delta\n         *\n         * @param delta the number of pixels to scroll by on the Y axis\n         */\n        private doScrollY(delta: number): void {\n            if (delta != 0) {\n                if (this.mSmoothScrollingEnabled) {\n                    this.smoothScrollBy(0, delta);\n                } else {\n                    this.scrollBy(0, delta);\n                }\n            }\n        }\n\n        /**\n         * Like {@link View#scrollBy}, but scroll smoothly instead of immediately.\n         *\n         * @param dx the number of pixels to scroll by on the X axis\n         * @param dy the number of pixels to scroll by on the Y axis\n         */\n        smoothScrollBy(dx: number, dy: number): void {\n            if (this.getChildCount() == 0) {\n                // Nothing to do.\n                return;\n            }\n            let duration: number = AnimationUtils.currentAnimationTimeMillis() - this.mLastScroll;\n            if (duration > ScrollView.ANIMATED_SCROLL_GAP) {\n                const height: number = this.getHeight() - this.mPaddingBottom - this.mPaddingTop;\n                const bottom: number = this.getChildAt(0).getHeight();\n                const maxY: number = Math.max(0, bottom - height);\n                const scrollY: number = this.mScrollY;\n                dy = Math.max(0, Math.min(scrollY + dy, maxY)) - scrollY;\n                this.mScroller.startScroll(this.mScrollX, scrollY, 0, dy);\n                this.postInvalidateOnAnimation();\n            } else {\n                if (!this.mScroller.isFinished()) {\n                    this.mScroller.abortAnimation();\n                    // if (this.mFlingStrictSpan != null) {\n                    //     this.mFlingStrictSpan.finish();\n                    //     this.mFlingStrictSpan = null;\n                    // }\n                }\n                this.scrollBy(dx, dy);\n            }\n            this.mLastScroll = AnimationUtils.currentAnimationTimeMillis();\n        }\n\n        /**\n         * Like {@link #scrollTo}, but scroll smoothly instead of immediately.\n         *\n         * @param x the position where to scroll on the X axis\n         * @param y the position where to scroll on the Y axis\n         */\n        smoothScrollTo(x: number, y: number): void {\n            this.smoothScrollBy(x - this.mScrollX, y - this.mScrollY);\n        }\n\n        /**\n         * <p>The scroll range of a scroll view is the overall height of all of its\n         * children.</p>\n         */\n        protected computeVerticalScrollRange(): number {\n            const count: number = this.getChildCount();\n            const contentHeight: number = this.getHeight() - this.mPaddingBottom - this.mPaddingTop;\n            if (count == 0) {\n                return contentHeight;\n            }\n            let scrollRange: number = this.getChildAt(0).getBottom();\n            const scrollY: number = this.mScrollY;\n            const overscrollBottom: number = Math.max(0, scrollRange - contentHeight);\n            if (scrollY < 0) {\n                scrollRange -= scrollY;\n            } else if (scrollY > overscrollBottom) {\n                scrollRange += scrollY - overscrollBottom;\n            }\n            return scrollRange;\n        }\n\n        protected computeVerticalScrollOffset(): number {\n            return Math.max(0, super.computeVerticalScrollOffset());\n        }\n\n        protected measureChild(child: View, parentWidthMeasureSpec: number, parentHeightMeasureSpec: number): void {\n            let lp: ViewGroup.LayoutParams = child.getLayoutParams();\n            let childWidthMeasureSpec: number;\n            let childHeightMeasureSpec: number;\n            childWidthMeasureSpec = ScrollView.getChildMeasureSpec(parentWidthMeasureSpec, this.mPaddingLeft + this.mPaddingRight, lp.width);\n            childHeightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n            child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n        }\n\n        protected measureChildWithMargins(child: View, parentWidthMeasureSpec: number, widthUsed: number, parentHeightMeasureSpec: number, heightUsed: number): void {\n            const lp: ViewGroup.MarginLayoutParams = <ViewGroup.MarginLayoutParams> child.getLayoutParams();\n            const childWidthMeasureSpec: number = ScrollView.getChildMeasureSpec(parentWidthMeasureSpec, this.mPaddingLeft + this.mPaddingRight + lp.leftMargin + lp.rightMargin + widthUsed, lp.width);\n            const childHeightMeasureSpec: number = View.MeasureSpec.makeMeasureSpec(lp.topMargin + lp.bottomMargin, View.MeasureSpec.UNSPECIFIED);\n            child.measure(childWidthMeasureSpec, childHeightMeasureSpec);\n        }\n\n        computeScroll(): void {\n            if (this.mScroller.computeScrollOffset()) {\n                // This is called at drawing time by ViewGroup.  We don't want to\n                // re-show the scrollbars at this point, which scrollTo will do,\n                // so we replicate most of scrollTo here.\n                //\n                //         It's a little odd to call onScrollChanged from inside the drawing.\n                //\n                //         It is, except when you remember that computeScroll() is used to\n                //         animate scrolling. So unless we want to defer the onScrollChanged()\n                //         until the end of the animated scrolling, we don't really have a\n                //         choice here.\n                //\n                //         I agree.  The alternative, which I think would be worse, is to post\n                //         something and tell the subclasses later.  This is bad because there\n                //         will be a window where mScrollX/Y is different from what the app\n                //         thinks it is.\n                //\n                let oldX: number = this.mScrollX;\n                let oldY: number = this.mScrollY;\n                let x: number = this.mScroller.getCurrX();\n                let y: number = this.mScroller.getCurrY();\n                if (oldX != x || oldY != y) {\n                    const range: number = this.getScrollRange();\n                    const overscrollMode: number = this.getOverScrollMode();\n                    const canOverscroll: boolean = overscrollMode == ScrollView.OVER_SCROLL_ALWAYS || (overscrollMode == ScrollView.OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0);\n                    this.overScrollBy(x - oldX, y - oldY, oldX, oldY, 0, range, 0, this.getHeight() / 2, false);\n                    this.onScrollChanged(this.mScrollX, this.mScrollY, oldX, oldY);\n                    // if (canOverscroll) {\n                    //     if (y < 0 && oldY >= 0) {\n                    //         this.mEdgeGlowTop.onAbsorb(Math.floor(this.mScroller.getCurrVelocity()));\n                    //     } else if (y > range && oldY <= range) {\n                    //         this.mEdgeGlowBottom.onAbsorb(Math.floor(this.mScroller.getCurrVelocity()));\n                    //     }\n                    // }\n                }\n                if (!this.awakenScrollBars()) {\n                    // Keep on drawing until the animation has finished.\n                    this.postInvalidateOnAnimation();\n                }\n            } else {\n                // if (this.mFlingStrictSpan != null) {\n                //     this.mFlingStrictSpan.finish();\n                //     this.mFlingStrictSpan = null;\n                // }\n            }\n        }\n\n        /**\n         * Scrolls the view to the given child.\n         *\n         * @param child the View to scroll to\n         */\n        private scrollToChild(child: View): void {\n            child.getDrawingRect(this.mTempRect);\n            /* Offset from child's local coordinates to ScrollView coordinates */\n            this.offsetDescendantRectToMyCoords(child, this.mTempRect);\n            let scrollDelta: number = this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);\n            if (scrollDelta != 0) {\n                this.scrollBy(0, scrollDelta);\n            }\n        }\n\n        /**\n         * If rect is off screen, scroll just enough to get it (or at least the\n         * first screen size chunk of it) on screen.\n         *\n         * @param rect      The rectangle.\n         * @param immediate True to scroll immediately without animation\n         * @return true if scrolling was performed\n         */\n        private scrollToChildRect(rect: Rect, immediate: boolean): boolean {\n            const delta: number = this.computeScrollDeltaToGetChildRectOnScreen(rect);\n            const scroll: boolean = delta != 0;\n            if (scroll) {\n                if (immediate) {\n                    this.scrollBy(0, delta);\n                } else {\n                    this.smoothScrollBy(0, delta);\n                }\n            }\n            return scroll;\n        }\n\n        /**\n         * Compute the amount to scroll in the Y direction in order to get\n         * a rectangle completely on the screen (or, if taller than the screen,\n         * at least the first screen size chunk of it).\n         *\n         * @param rect The rect.\n         * @return The scroll delta.\n         */\n        protected computeScrollDeltaToGetChildRectOnScreen(rect: Rect): number {\n            if (this.getChildCount() == 0)\n                return 0;\n            let height: number = this.getHeight();\n            let screenTop: number = this.getScrollY();\n            let screenBottom: number = screenTop + height;\n            let fadingEdge: number = this.getVerticalFadingEdgeLength();\n            // leave room for top fading edge as long as rect isn't at very top\n            if (rect.top > 0) {\n                screenTop += fadingEdge;\n            }\n            // leave room for bottom fading edge as long as rect isn't at very bottom\n            if (rect.bottom < this.getChildAt(0).getHeight()) {\n                screenBottom -= fadingEdge;\n            }\n            let scrollYDelta: number = 0;\n            if (rect.bottom > screenBottom && rect.top > screenTop) {\n                if (rect.height() > height) {\n                    // just enough to get screen size chunk on\n                    scrollYDelta += (rect.top - screenTop);\n                } else {\n                    // get entire rect at bottom of screen\n                    scrollYDelta += (rect.bottom - screenBottom);\n                }\n                // make sure we aren't scrolling beyond the end of our content\n                let bottom: number = this.getChildAt(0).getBottom();\n                let distanceToBottom: number = bottom - screenBottom;\n                scrollYDelta = Math.min(scrollYDelta, distanceToBottom);\n            } else if (rect.top < screenTop && rect.bottom < screenBottom) {\n                if (rect.height() > height) {\n                    // screen size chunk\n                    scrollYDelta -= (screenBottom - rect.bottom);\n                } else {\n                    // entire rect at top\n                    scrollYDelta -= (screenTop - rect.top);\n                }\n                // make sure we aren't scrolling any further than the top our content\n                scrollYDelta = Math.max(scrollYDelta, -this.getScrollY());\n            }\n            return scrollYDelta;\n        }\n\n        requestChildFocus(child: View, focused: View): void {\n            if (!this.mIsLayoutDirty) {\n                this.scrollToChild(focused);\n            } else {\n                // The child may not be laid out yet, we can't compute the scroll yet\n                this.mChildToScrollTo = focused;\n            }\n            super.requestChildFocus(child, focused);\n        }\n\n        /**\n         * When looking for focus in children of a scroll view, need to be a little\n         * more careful not to give focus to something that is scrolled off screen.\n         *\n         * This is more expensive than the default {@link android.view.ViewGroup}\n         * implementation, otherwise this behavior might have been made the default.\n         */\n        protected onRequestFocusInDescendants(direction: number, previouslyFocusedRect: Rect): boolean {\n            // (ugh).\n            if (direction == View.FOCUS_FORWARD) {\n                direction = View.FOCUS_DOWN;\n            } else if (direction == View.FOCUS_BACKWARD) {\n                direction = View.FOCUS_UP;\n            }\n            const nextFocus: View = previouslyFocusedRect == null ? FocusFinder.getInstance().findNextFocus(this, null, direction) : FocusFinder.getInstance().findNextFocusFromRect(this, previouslyFocusedRect, direction);\n            if (nextFocus == null) {\n                return false;\n            }\n            if (this.isOffScreen(nextFocus)) {\n                return false;\n            }\n            return nextFocus.requestFocus(direction, previouslyFocusedRect);\n        }\n\n        requestChildRectangleOnScreen(child: View, rectangle: Rect, immediate: boolean): boolean {\n            // offset into coordinate space of this scroll view\n            rectangle.offset(child.getLeft() - child.getScrollX(), child.getTop() - child.getScrollY());\n            return this.scrollToChildRect(rectangle, immediate);\n        }\n\n        requestLayout(): void {\n            this.mIsLayoutDirty = true;\n            super.requestLayout();\n        }\n\n        // protected onDetachedFromWindow():void  {\n        //     super.onDetachedFromWindow();\n        //     if (this.mScrollStrictSpan != null) {\n        //         this.mScrollStrictSpan.finish();\n        //         this.mScrollStrictSpan = null;\n        //     }\n        //     if (this.mFlingStrictSpan != null) {\n        //         this.mFlingStrictSpan.finish();\n        //         this.mFlingStrictSpan = null;\n        //     }\n        // }\n\n        protected onLayout(changed: boolean, l: number, t: number, r: number, b: number): void {\n            super.onLayout(changed, l, t, r, b);\n            this.mIsLayoutDirty = false;\n            // Give a child focus if it needs it\n            if (this.mChildToScrollTo != null && ScrollView.isViewDescendantOf(this.mChildToScrollTo, this)) {\n                this.scrollToChild(this.mChildToScrollTo);\n            }\n            this.mChildToScrollTo = null;\n            if (!this.isLaidOut()) {\n                // if (this.mSavedState != null) {\n                //     this.mScrollY = this.mSavedState.scrollPosition;\n                //     this.mSavedState = null;\n                // }\n                // mScrollY default value is \"0\"\n                const childHeight: number = (this.getChildCount() > 0) ? this.getChildAt(0).getMeasuredHeight() : 0;\n                const scrollRange: number = Math.max(0, childHeight - (b - t - this.mPaddingBottom - this.mPaddingTop));\n                // Don't forget to clamp\n                if (this.mScrollY > scrollRange) {\n                    this.mScrollY = scrollRange;\n                } else if (this.mScrollY < 0) {\n                    this.mScrollY = 0;\n                }\n            }\n            // Calling this with the present values causes it to re-claim them\n            this.scrollTo(this.mScrollX, this.mScrollY);\n        }\n\n        protected onSizeChanged(w: number, h: number, oldw: number, oldh: number): void {\n            super.onSizeChanged(w, h, oldw, oldh);\n            let currentFocused: View = this.findFocus();\n            if (null == currentFocused || this == currentFocused)\n                return;\n            // view visible with the new screen height.\n            if (this.isWithinDeltaOfScreen(currentFocused, 0, oldh)) {\n                currentFocused.getDrawingRect(this.mTempRect);\n                this.offsetDescendantRectToMyCoords(currentFocused, this.mTempRect);\n                let scrollDelta: number = this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);\n                this.doScrollY(scrollDelta);\n            }\n        }\n\n        /**\n         * Return true if child is a descendant of parent, (or equal to the parent).\n         */\n        private static isViewDescendantOf(child: View, parent: View): boolean {\n            if (child == parent) {\n                return true;\n            }\n            const theParent: ViewParent = child.getParent();\n            return (theParent instanceof ViewGroup) && ScrollView.isViewDescendantOf(<View> theParent, parent);\n        }\n\n        /**\n         * Fling the scroll view\n         *\n         * @param velocityY The initial velocity in the Y direction. Positive\n         *                  numbers mean that the finger/cursor is moving down the screen,\n         *                  which means we want to scroll towards the top.\n         */\n        fling(velocityY: number): void {\n            if (this.getChildCount() > 0) {\n                let height: number = this.getHeight() - this.mPaddingBottom - this.mPaddingTop;\n                let bottom: number = this.getChildAt(0).getHeight();\n                this.mScroller.fling(this.mScrollX, this.mScrollY, 0, velocityY, 0, 0, 0, Math.max(0, bottom - height), 0, this.mOverflingDistance);\n                // if (this.mFlingStrictSpan == null) {\n                //     this.mFlingStrictSpan = StrictMode.enterCriticalSpan(\"ScrollView-fling\");\n                // }\n                this.postInvalidateOnAnimation();\n            }\n        }\n\n        private endDrag(): void {\n            this.mIsBeingDragged = false;\n            this.recycleVelocityTracker();\n            // if (this.mEdgeGlowTop != null) {\n            //     this.mEdgeGlowTop.onRelease();\n            //     this.mEdgeGlowBottom.onRelease();\n            // }\n            // if (this.mScrollStrictSpan != null) {\n            //     this.mScrollStrictSpan.finish();\n            //     this.mScrollStrictSpan = null;\n            // }\n        }\n\n        /**\n         * {@inheritDoc}\n         *\n         * <p>This version also clamps the scrolling to the bounds of our child.\n         */\n        scrollTo(x: number, y: number): void {\n            // we rely on the fact the View.scrollBy calls scrollTo.\n            if (this.getChildCount() > 0) {\n                let child: View = this.getChildAt(0);\n                x = ScrollView.clamp(x, this.getWidth() - this.mPaddingRight - this.mPaddingLeft, child.getWidth());\n                y = ScrollView.clamp(y, this.getHeight() - this.mPaddingBottom - this.mPaddingTop, child.getHeight());\n                if (x != this.mScrollX || y != this.mScrollY) {\n                    super.scrollTo(x, y);\n                }\n            }\n        }\n\n        // setOverScrollMode(mode:number):void  {\n        //     if (mode != ScrollView.OVER_SCROLL_NEVER) {\n        //         if (this.mEdgeGlowTop == null) {\n        //             let context = this.getContext();\n        //             this.mEdgeGlowTop = new EdgeEffect(context);\n        //             this.mEdgeGlowBottom = new EdgeEffect(context);\n        //         }\n        //     } else {\n        //         this.mEdgeGlowTop = null;\n        //         this.mEdgeGlowBottom = null;\n        //     }\n        //     super.setOverScrollMode(mode);\n        // }\n\n        draw(canvas: Canvas): void {\n            super.draw(canvas);\n            // if (this.mEdgeGlowTop != null) {\n            //     const scrollY:number = this.mScrollY;\n            //     if (!this.mEdgeGlowTop.isFinished()) {\n            //         const restoreCount:number = canvas.save();\n            //         const width:number = this.getWidth() - this.mPaddingLeft - this.mPaddingRight;\n            //         canvas.translate(this.mPaddingLeft, Math.min(0, scrollY));\n            //         this.mEdgeGlowTop.setSize(width, this.getHeight());\n            //         if (this.mEdgeGlowTop.draw(canvas)) {\n            //             this.postInvalidateOnAnimation();\n            //         }\n            //         canvas.restoreToCount(restoreCount);\n            //     }\n            //     if (!this.mEdgeGlowBottom.isFinished()) {\n            //         const restoreCount:number = canvas.save();\n            //         const width:number = this.getWidth() - this.mPaddingLeft - this.mPaddingRight;\n            //         const height:number = this.getHeight();\n            //         canvas.translate(-width + this.mPaddingLeft, Math.max(this.getScrollRange(), scrollY) + height);\n            //         canvas.rotate(180, width, 0);\n            //         this.mEdgeGlowBottom.setSize(width, height);\n            //         if (this.mEdgeGlowBottom.draw(canvas)) {\n            //             this.postInvalidateOnAnimation();\n            //         }\n            //         canvas.restoreToCount(restoreCount);\n            //     }\n            // }\n        }\n\n        private static clamp(n: number, my: number, child: number): number {\n            if (my >= child || n < 0) {\n                /* my >= child is this case:\n                 *                    |--------------- me ---------------|\n                 *     |------ child ------|\n                 * or\n                 *     |--------------- me ---------------|\n                 *            |------ child ------|\n                 * or\n                 *     |--------------- me ---------------|\n                 *                                  |------ child ------|\n                 *\n                 * n < 0 is this case:\n                 *     |------ me ------|\n                 *                    |-------- child --------|\n                 *     |-- mScrollX --|\n                 */\n                return 0;\n            }\n            if ((my + n) > child) {\n                /* this case:\n                 *                    |------ me ------|\n                 *     |------ child ------|\n                 *     |-- mScrollX --|\n                 */\n                return child - my;\n            }\n            return n;\n        }\n\n        // protected onRestoreInstanceState(state:Parcelable):void  {\n        //     if (this.mContext.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR2) {\n        //         // Some old apps reused IDs in ways they shouldn't have.\n        //         // Don't break them, but they don't get scroll state restoration.\n        //         super.onRestoreInstanceState(state);\n        //         return;\n        //     }\n        //     let ss:ScrollView.SavedState = <ScrollView.SavedState> state;\n        //     super.onRestoreInstanceState(ss.getSuperState());\n        //     this.mSavedState = ss;\n        //     this.requestLayout();\n        // }\n        //\n        // protected onSaveInstanceState():Parcelable  {\n        //     if (this.mContext.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR2) {\n        //         // Don't break them, but they don't get scroll state restoration.\n        //         return super.onSaveInstanceState();\n        //     }\n        //     let superState:Parcelable = super.onSaveInstanceState();\n        //     let ss:ScrollView.SavedState = new ScrollView.SavedState(superState);\n        //     ss.scrollPosition = this.mScrollY;\n        //     return ss;\n        // }\n\n\n    }\n\n    // export module ScrollView{\n    //     export class SavedState extends View.BaseSavedState {\n    //\n    //         scrollPosition:number = 0;\n    //\n    //         constructor( superState:Parcelable) {\n    //             super(superState);\n    //         }\n    //\n    //         constructor( source:Parcel) {\n    //             super(source);\n    //             this.scrollPosition = source.readInt();\n    //         }\n    //\n    //         writeToParcel(dest:Parcel, flags:number):void  {\n    //             super.writeToParcel(dest, flags);\n    //             dest.writeInt(this.scrollPosition);\n    //         }\n    //\n    //         toString():string  {\n    //             return \"HorizontalScrollView.SavedState{\" + Integer.toHexString(System.identityHashCode(this)) + \" scrollPosition=\" + this.scrollPosition + \"}\";\n    //         }\n    //\n    //         static CREATOR:Parcelable.Creator<SavedState> = (()=>{\n    //             const inner_this=this;\n    //             class _Inner extends Parcelable.Creator<SavedState> {\n    //\n    //                 createFromParcel(_in:Parcel):SavedState  {\n    //                     return new SavedState(_in);\n    //                 }\n    //\n    //                 newArray(size:number):SavedState[]  {\n    //                     return new Array<SavedState>(size);\n    //                 }\n    //             }\n    //             return new _Inner();\n    //         })();\n    //     }\n    // }\n\n}"
  },
  {
    "path": "src/android/widget/Scroller.ts",
    "content": "/**\n * Created by linfaxin on 16/1/15.\n * AndroidUI's impl \n */\n///<reference path=\"OverScroller.ts\"/>\n\nmodule android.widget {\n    export class Scroller extends OverScroller{\n    }\n}"
  },
  {
    "path": "src/android/widget/SeekBar.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/widget/AbsSeekBar.ts\"/>\n///<reference path=\"../../android/widget/ProgressBar.ts\"/>\n\nmodule android.widget {\nimport AbsSeekBar = android.widget.AbsSeekBar;\nimport ProgressBar = android.widget.ProgressBar;\n/**\n * A SeekBar is an extension of ProgressBar that adds a draggable thumb. The user can touch\n * the thumb and drag left or right to set the current progress level or use the arrow keys.\n * Placing focusable widgets to the left or right of a SeekBar is discouraged. \n * <p>\n * Clients of the SeekBar can attach a {@link SeekBar.OnSeekBarChangeListener} to\n * be notified of the user's actions.\n *\n * @attr ref android.R.styleable#SeekBar_thumb\n */\nexport class SeekBar extends AbsSeekBar {\n\n    private mOnSeekBarChangeListener:SeekBar.OnSeekBarChangeListener;\n\n\n    constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle=android.R.attr.seekBarStyle){\n        super(context, bindElement, defStyle);\n    }\n\n    onProgressRefresh(scale:number, fromUser:boolean):void  {\n        super.onProgressRefresh(scale, fromUser);\n        if (this.mOnSeekBarChangeListener != null) {\n            this.mOnSeekBarChangeListener.onProgressChanged(this, this.getProgress(), fromUser);\n        }\n    }\n\n    /**\n     * Sets a listener to receive notifications of changes to the SeekBar's progress level. Also\n     * provides notifications of when the user starts and stops a touch gesture within the SeekBar.\n     * \n     * @param l The seek bar notification listener\n     * \n     * @see SeekBar.OnSeekBarChangeListener\n     */\n    setOnSeekBarChangeListener(l:SeekBar.OnSeekBarChangeListener):void  {\n        this.mOnSeekBarChangeListener = l;\n    }\n\n    onStartTrackingTouch():void  {\n        super.onStartTrackingTouch();\n        if (this.mOnSeekBarChangeListener != null) {\n            this.mOnSeekBarChangeListener.onStartTrackingTouch(this);\n        }\n    }\n\n    onStopTrackingTouch():void  {\n        super.onStopTrackingTouch();\n        if (this.mOnSeekBarChangeListener != null) {\n            this.mOnSeekBarChangeListener.onStopTrackingTouch(this);\n        }\n    }\n}\n\nexport module SeekBar{\n/**\n     * A callback that notifies clients when the progress level has been\n     * changed. This includes changes that were initiated by the user through a\n     * touch gesture or arrow key/trackball as well as changes that were initiated\n     * programmatically.\n     */\nexport interface OnSeekBarChangeListener {\n\n    /**\n         * Notification that the progress level has changed. Clients can use the fromUser parameter\n         * to distinguish user-initiated changes from those that occurred programmatically.\n         * \n         * @param seekBar The SeekBar whose progress has changed\n         * @param progress The current progress level. This will be in the range 0..max where max\n         *        was set by {@link ProgressBar#setMax(int)}. (The default value for max is 100.)\n         * @param fromUser True if the progress change was initiated by the user.\n         */\n    onProgressChanged(seekBar:SeekBar, progress:number, fromUser:boolean):void ;\n\n    /**\n         * Notification that the user has started a touch gesture. Clients may want to use this\n         * to disable advancing the seekbar. \n         * @param seekBar The SeekBar in which the touch gesture began\n         */\n    onStartTrackingTouch(seekBar:SeekBar):void ;\n\n    /**\n         * Notification that the user has finished a touch gesture. Clients may want to use this\n         * to re-enable advancing the seekbar. \n         * @param seekBar The SeekBar in which the touch gesture began\n         */\n    onStopTrackingTouch(seekBar:SeekBar):void ;\n}\n}\n\n}"
  },
  {
    "path": "src/android/widget/Spinner.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/app/AlertDialog.ts\"/>\n///<reference path=\"../../android/content/DialogInterface.ts\"/>\n///<reference path=\"../../android/database/DataSetObserver.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/util/Log.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/view/ViewTreeObserver.ts\"/>\n///<reference path=\"../../android/widget/AbsSpinner.ts\"/>\n///<reference path=\"../../android/widget/Adapter.ts\"/>\n///<reference path=\"../../android/widget/AdapterView.ts\"/>\n///<reference path=\"../../android/widget/ListAdapter.ts\"/>\n///<reference path=\"../../android/widget/ListPopupWindow.ts\"/>\n///<reference path=\"../../android/widget/ListView.ts\"/>\n///<reference path=\"../../android/widget/PopupWindow.ts\"/>\n///<reference path=\"../../android/widget/SpinnerAdapter.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n///<reference path=\"../../android/R/attr.ts\"/>\n\nmodule android.widget {\nimport AlertDialog = android.app.AlertDialog;\nimport DialogInterface = android.content.DialogInterface;\nimport OnClickListener = android.content.DialogInterface.OnClickListener;\nimport DataSetObserver = android.database.DataSetObserver;\nimport Rect = android.graphics.Rect;\nimport Drawable = android.graphics.drawable.Drawable;\nimport Log = android.util.Log;\nimport Gravity = android.view.Gravity;\nimport MotionEvent = android.view.MotionEvent;\nimport View = android.view.View;\nimport ViewGroup = android.view.ViewGroup;\nimport ViewTreeObserver = android.view.ViewTreeObserver;\nimport OnGlobalLayoutListener = android.view.ViewTreeObserver.OnGlobalLayoutListener;\nimport ForwardingListener = android.widget.ListPopupWindow.ForwardingListener;\nimport OnDismissListener = android.widget.PopupWindow.OnDismissListener;\nimport AbsSpinner = android.widget.AbsSpinner;\nimport Adapter = android.widget.Adapter;\nimport AdapterView = android.widget.AdapterView;\nimport ListAdapter = android.widget.ListAdapter;\nimport ListPopupWindow = android.widget.ListPopupWindow;\nimport ListView = android.widget.ListView;\nimport PopupWindow = android.widget.PopupWindow;\nimport SpinnerAdapter = android.widget.SpinnerAdapter;\nimport Context = android.content.Context;\nimport R = android.R;\n    import AttrBinder = androidui.attr.AttrBinder;\n/**\n * A view that displays one child at a time and lets the user pick among them.\n * The items in the Spinner come from the {@link Adapter} associated with\n * this view.\n *\n * <p>See the <a href=\"{@docRoot}guide/topics/ui/controls/spinner.html\">Spinners</a> guide.</p>\n *\n * @attr ref android.R.styleable#Spinner_dropDownHorizontalOffset\n * @attr ref android.R.styleable#Spinner_dropDownSelector\n * @attr ref android.R.styleable#Spinner_dropDownVerticalOffset\n * @attr ref android.R.styleable#Spinner_dropDownWidth\n * @attr ref android.R.styleable#Spinner_gravity\n * @attr ref android.R.styleable#Spinner_popupBackground\n * @attr ref android.R.styleable#Spinner_prompt\n * @attr ref android.R.styleable#Spinner_spinnerMode\n */\nexport class Spinner extends AbsSpinner implements OnClickListener {\n\n    static TAG:string = \"Spinner\";\n\n    // Only measure this many items to get a decent max width.\n    private static MAX_ITEMS_MEASURED:number = 15;\n\n    /**\n     * Use a dialog window for selecting spinner options.\n     */\n    static MODE_DIALOG:number = 0;\n\n    /**\n     * Use a dropdown anchored to the Spinner for selecting spinner options.\n     */\n    static MODE_DROPDOWN:number = 1;\n\n    /**\n     * Use the theme-supplied value to select the dropdown mode.\n     */\n    private static MODE_THEME:number = -1;\n\n    ///** Forwarding listener used to implement drag-to-open. */\n    //private mForwardingListener:ForwardingListener;\n\n    private mPopup:Spinner.SpinnerPopup;\n\n    private mTempAdapter:Spinner.DropDownAdapter;\n\n    mDropDownWidth:number = 0;\n\n    private mGravity:number = 0;\n\n    private mDisableChildrenWhenDisabled:boolean;\n\n    private mTempRect:Rect = new Rect();\n\n    /**\n     * Construct a new spinner with the given context's theme, the supplied attribute set,\n     * and default style. <code>mode</code> may be one of {@link #MODE_DIALOG} or\n     * {@link #MODE_DROPDOWN} and determines how the user will select choices from the spinner.\n     *\n     * @param context The Context the view is running in, through which it can\n     *        access the current theme, resources, etc.\n     * @param attrs The attributes of the XML tag that is inflating the view.\n     * @param defStyle The default style to apply to this view. If 0, no style\n     *        will be applied (beyond what is included in the theme). This may\n     *        either be an attribute resource, whose value will be retrieved\n     *        from the current theme, or an explicit style resource.\n     * @param mode Constant describing how the user will select choices from the spinner.\n     * \n     * @see #MODE_DIALOG\n     * @see #MODE_DROPDOWN\n     */\n    constructor(context:Context, bindElement?:HTMLElement, defStyle=R.attr.spinnerStyle, mode=Spinner.MODE_THEME) {\n        super(context, bindElement, defStyle);\n\n        const a = context.obtainStyledAttributes(bindElement, defStyle);\n\n        if (mode == Spinner.MODE_THEME) {\n            if ('dialog' === a.getAttrValue('spinnerMode')) {\n                mode = Spinner.MODE_DIALOG;\n            } else {\n                mode = Spinner.MODE_DROPDOWN;\n            }\n        }\n\n        switch (mode) {\n            case Spinner.MODE_DIALOG: {\n                this.mPopup = new Spinner.DialogPopup(this);\n                break;\n            }\n\n            case Spinner.MODE_DROPDOWN: {\n                const popup = new Spinner.DropdownPopup(context, defStyle, this);\n\n                this.mDropDownWidth = a.getLayoutDimension('dropDownWidth', ViewGroup.LayoutParams.WRAP_CONTENT);\n                popup.setBackgroundDrawable(a.getDrawable('popupBackground'));\n                const verticalOffset = a.getDimensionPixelOffset('dropDownVerticalOffset', 0);\n                if (verticalOffset != 0) {\n                    popup.setVerticalOffset(verticalOffset);\n                }\n\n                const horizontalOffset = a.getDimensionPixelOffset('dropDownHorizontalOffset', 0);\n                if (horizontalOffset != 0) {\n                    popup.setHorizontalOffset(horizontalOffset);\n                }\n\n                this.mPopup = popup;\n                // mForwardingListener = new ForwardingListener(this) {\n                // @Override\n                // public ListPopupWindow getPopup() {\n                //         return popup;\n                //     }\n                //\n                // @Override\n                // public boolean onForwardingStarted() {\n                //         if (!mPopup.isShowing()) {\n                //             mPopup.show(getTextDirection(), getTextAlignment());\n                //         }\n                //         return true;\n                //     }\n                // };\n                break;\n            }\n        }\n\n        this.mGravity = Gravity.parseGravity(a.getAttrValue('gravity'), Gravity.CENTER);\n\n        this.mPopup.setPromptText(a.getString('prompt'));\n\n        this.mDisableChildrenWhenDisabled = a.getBoolean('disableChildrenWhenDisabled', false);\n\n        a.recycle();\n\n        // Finish setting things up if this happened.\n        if (this.mTempAdapter != null) {\n            this.mPopup.setAdapter(this.mTempAdapter);\n            this.mTempAdapter = null;\n        }\n    }\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder().set('dropDownWidth', {\n            setter(v:Spinner, value:any, a:AttrBinder) {\n                v.mDropDownWidth = a.parseNumberPixelSize(value, v.mDropDownWidth);\n            }, getter(v:Spinner) {\n                return v.mDropDownWidth;\n            }\n        }).set('popupBackground', {\n            setter(v:Spinner, value:any, a:AttrBinder) {\n                v.mPopup.setBackgroundDrawable(a.parseDrawable(value));\n            }, getter(v:Spinner) {\n                return v.mPopup.getBackground();\n            }\n        }).set('dropDownVerticalOffset', {\n            setter(v:Spinner, value:any, a:AttrBinder) {\n                const verticalOffset:number = a.parseNumberPixelSize(value, 0);\n                if (verticalOffset != 0) {\n                    v.mPopup.setVerticalOffset(verticalOffset);\n                }\n            }, getter(v:Spinner) {\n                return v.mPopup.getVerticalOffset();\n            }\n        }).set('dropDownHorizontalOffset', {\n            setter(v:Spinner, value:any, a:AttrBinder) {\n                const horizontalOffset:number = a.parseNumberPixelSize(value, 0);\n                if (horizontalOffset != 0) {\n                    v.mPopup.setHorizontalOffset(horizontalOffset);\n                }\n            }, getter(v:Spinner) {\n                return v.mPopup.getHorizontalOffset();\n            }\n        }).set('gravity', {\n            setter(v:Spinner, value:any, a:AttrBinder) {\n                v.mGravity = a.parseGravity(value, Gravity.CENTER);\n            }, getter(v:Spinner) {\n                return v.mGravity;\n            }\n        }).set('prompt', {\n            setter(v:Spinner, value:any, a:AttrBinder) {\n                v.mPopup.setPromptText(a.parseString(value));\n            }, getter(v:Spinner) {\n                return v.mPopup.getHintText();\n            }\n        }).set('disableChildrenWhenDisabled', {\n            setter(v:Spinner, value:any, a:AttrBinder) {\n                v.mDisableChildrenWhenDisabled = a.parseBoolean(value, false);\n            }, getter(v:Spinner) {\n                return v.mDisableChildrenWhenDisabled;\n            }\n        });\n    }\n\n    /**\n     * Set the background drawable for the spinner's popup window of choices.\n     * Only valid in {@link #MODE_DROPDOWN}; this method is a no-op in other modes.\n     *\n     * @param background Background drawable\n     *\n     * @attr ref android.R.styleable#Spinner_popupBackground\n     */\n    setPopupBackgroundDrawable(background:Drawable):void  {\n        if (!(this.mPopup instanceof Spinner.DropdownPopup)) {\n            Log.e(Spinner.TAG, \"setPopupBackgroundDrawable: incompatible spinner mode; ignoring...\");\n            return;\n        }\n        (<Spinner.DropdownPopup> this.mPopup).setBackgroundDrawable(background);\n    }\n\n    ///**\n    // * Set the background drawable for the spinner's popup window of choices.\n    // * Only valid in {@link #MODE_DROPDOWN}; this method is a no-op in other modes.\n    // *\n    // * @param resId Resource ID of a background drawable\n    // *\n    // * @attr ref android.R.styleable#Spinner_popupBackground\n    // */\n    //setPopupBackgroundResource(resId:number):void  {\n    //    this.setPopupBackgroundDrawable(this.getContext().getResources().getDrawable(resId));\n    //}\n\n    /**\n     * Get the background drawable for the spinner's popup window of choices.\n     * Only valid in {@link #MODE_DROPDOWN}; other modes will return null.\n     *\n     * @return background Background drawable\n     *\n     * @attr ref android.R.styleable#Spinner_popupBackground\n     */\n    getPopupBackground():Drawable  {\n        return this.mPopup.getBackground();\n    }\n\n    /**\n     * Set a vertical offset in pixels for the spinner's popup window of choices.\n     * Only valid in {@link #MODE_DROPDOWN}; this method is a no-op in other modes.\n     *\n     * @param pixels Vertical offset in pixels\n     *\n     * @attr ref android.R.styleable#Spinner_dropDownVerticalOffset\n     */\n    setDropDownVerticalOffset(pixels:number):void  {\n        this.mPopup.setVerticalOffset(pixels);\n    }\n\n    /**\n     * Get the configured vertical offset in pixels for the spinner's popup window of choices.\n     * Only valid in {@link #MODE_DROPDOWN}; other modes will return 0.\n     *\n     * @return Vertical offset in pixels\n     *\n     * @attr ref android.R.styleable#Spinner_dropDownVerticalOffset\n     */\n    getDropDownVerticalOffset():number  {\n        return this.mPopup.getVerticalOffset();\n    }\n\n    /**\n     * Set a horizontal offset in pixels for the spinner's popup window of choices.\n     * Only valid in {@link #MODE_DROPDOWN}; this method is a no-op in other modes.\n     *\n     * @param pixels Horizontal offset in pixels\n     *\n     * @attr ref android.R.styleable#Spinner_dropDownHorizontalOffset\n     */\n    setDropDownHorizontalOffset(pixels:number):void  {\n        this.mPopup.setHorizontalOffset(pixels);\n    }\n\n    /**\n     * Get the configured horizontal offset in pixels for the spinner's popup window of choices.\n     * Only valid in {@link #MODE_DROPDOWN}; other modes will return 0.\n     *\n     * @return Horizontal offset in pixels\n     *\n     * @attr ref android.R.styleable#Spinner_dropDownHorizontalOffset\n     */\n    getDropDownHorizontalOffset():number  {\n        return this.mPopup.getHorizontalOffset();\n    }\n\n    /**\n     * Set the width of the spinner's popup window of choices in pixels. This value\n     * may also be set to {@link android.view.ViewGroup.LayoutParams#MATCH_PARENT}\n     * to match the width of the Spinner itself, or\n     * {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT} to wrap to the measured size\n     * of contained dropdown list items.\n     *\n     * <p>Only valid in {@link #MODE_DROPDOWN}; this method is a no-op in other modes.</p>\n     *\n     * @param pixels Width in pixels, WRAP_CONTENT, or MATCH_PARENT\n     *\n     * @attr ref android.R.styleable#Spinner_dropDownWidth\n     */\n    setDropDownWidth(pixels:number):void  {\n        if (!(this.mPopup instanceof Spinner.DropdownPopup)) {\n            Log.e(Spinner.TAG, \"Cannot set dropdown width for MODE_DIALOG, ignoring\");\n            return;\n        }\n        this.mDropDownWidth = pixels;\n    }\n\n    /**\n     * Get the configured width of the spinner's popup window of choices in pixels.\n     * The returned value may also be {@link android.view.ViewGroup.LayoutParams#MATCH_PARENT}\n     * meaning the popup window will match the width of the Spinner itself, or\n     * {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT} to wrap to the measured size\n     * of contained dropdown list items.\n     *\n     * @return Width in pixels, WRAP_CONTENT, or MATCH_PARENT\n     *\n     * @attr ref android.R.styleable#Spinner_dropDownWidth\n     */\n    getDropDownWidth():number  {\n        return this.mDropDownWidth;\n    }\n\n    setEnabled(enabled:boolean):void  {\n        super.setEnabled(enabled);\n        if (this.mDisableChildrenWhenDisabled) {\n            const count:number = this.getChildCount();\n            for (let i:number = 0; i < count; i++) {\n                this.getChildAt(i).setEnabled(enabled);\n            }\n        }\n    }\n\n    /**\n     * Describes how the selected item view is positioned. Currently only the horizontal component\n     * is used. The default is determined by the current theme.\n     *\n     * @param gravity See {@link android.view.Gravity}\n     *\n     * @attr ref android.R.styleable#Spinner_gravity\n     */\n    setGravity(gravity:number):void  {\n        if (this.mGravity != gravity) {\n            if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == 0) {\n                gravity |= Gravity.START;\n            }\n            this.mGravity = gravity;\n            this.requestLayout();\n        }\n    }\n\n    /**\n     * Describes how the selected item view is positioned. The default is determined by the\n     * current theme.\n     *\n     * @return A {@link android.view.Gravity Gravity} value\n     */\n    getGravity():number  {\n        return this.mGravity;\n    }\n\n    /**\n     * Sets the Adapter used to provide the data which backs this Spinner.\n     * <p>\n     * Note that Spinner overrides {@link Adapter#getViewTypeCount()} on the\n     * Adapter associated with this view. Calling\n     * {@link Adapter#getItemViewType(int) getItemViewType(int)} on the object\n     * returned from {@link #getAdapter()} will always return 0. Calling\n     * {@link Adapter#getViewTypeCount() getViewTypeCount()} will always return\n     * 1.\n     *\n     * @see AbsSpinner#setAdapter(SpinnerAdapter)\n     */\n    setAdapter(adapter:SpinnerAdapter):void  {\n        super.setAdapter(adapter);\n        this.mRecycler.clear();\n        if (this.mPopup != null) {\n            this.mPopup.setAdapter(new Spinner.DropDownAdapter(adapter));\n        } else {\n            this.mTempAdapter = new Spinner.DropDownAdapter(adapter);\n        }\n    }\n\n    getBaseline():number  {\n        let child:View = null;\n        if (this.getChildCount() > 0) {\n            child = this.getChildAt(0);\n        } else if (this.mAdapter != null && this.mAdapter.getCount() > 0) {\n            child = this.makeView(0, false);\n            this.mRecycler.put(0, child);\n        }\n        if (child != null) {\n            const childBaseline:number = child.getBaseline();\n            return childBaseline >= 0 ? child.getTop() + childBaseline : -1;\n        } else {\n            return -1;\n        }\n    }\n\n    protected onDetachedFromWindow():void  {\n        super.onDetachedFromWindow();\n        if (this.mPopup != null && this.mPopup.isShowing()) {\n            this.mPopup.dismiss();\n        }\n    }\n\n    /**\n     * <p>A spinner does not support item click events. Calling this method\n     * will raise an exception.</p>\n     * <p>Instead use {@link AdapterView#setOnItemSelectedListener}.\n     *\n     * @param l this listener will be ignored\n     */\n    setOnItemClickListener(l:AdapterView.OnItemClickListener):void  {\n        throw Error(`new RuntimeException(\"setOnItemClickListener cannot be used with a spinner.\")`);\n    }\n\n    /**\n     * @hide internal use only\n     */\n    setOnItemClickListenerInt(l:AdapterView.OnItemClickListener):void  {\n        super.setOnItemClickListener(l);\n    }\n\n    //onTouchEvent(event:MotionEvent):boolean  {\n    //    if (this.mForwardingListener != null && this.mForwardingListener.onTouch(this, event)) {\n    //        return true;\n    //    }\n    //    return super.onTouchEvent(event);\n    //}\n\n    protected onMeasure(widthMeasureSpec:number, heightMeasureSpec:number):void  {\n        super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n        if (this.mPopup != null && View.MeasureSpec.getMode(widthMeasureSpec) == View.MeasureSpec.AT_MOST) {\n            const measuredWidth:number = this.getMeasuredWidth();\n            this.setMeasuredDimension(Math.min(Math.max(measuredWidth, this.measureContentWidth(this.getAdapter(), this.getBackground())), View.MeasureSpec.getSize(widthMeasureSpec)), this.getMeasuredHeight());\n        }\n    }\n\n    /**\n     * @see android.view.View#onLayout(boolean,int,int,int,int)\n     *\n     * Creates and positions all views\n     *\n     */\n    protected onLayout(changed:boolean, l:number, t:number, r:number, b:number):void  {\n        super.onLayout(changed, l, t, r, b);\n        this.mInLayout = true;\n        this.layoutSpinner(0, false);\n        this.mInLayout = false;\n    }\n\n    /**\n     * Creates and positions all views for this Spinner.\n     *\n     * @param delta Change in the selected position. +1 means selection is moving to the right,\n     * so views are scrolling to the left. -1 means selection is moving to the left.\n     */\n    layoutSpinner(delta:number, animate:boolean):void  {\n        let childrenLeft:number = this.mSpinnerPadding.left;\n        let childrenWidth:number = this.mRight - this.mLeft - this.mSpinnerPadding.left - this.mSpinnerPadding.right;\n        if (this.mDataChanged) {\n            this.handleDataChanged();\n        }\n        // Handle the empty set by removing all views\n        if (this.mItemCount == 0) {\n            this.resetList();\n            return;\n        }\n        if (this.mNextSelectedPosition >= 0) {\n            this.setSelectedPositionInt(this.mNextSelectedPosition);\n        }\n        this.recycleAllViews();\n        // Clear out old views\n        this.removeAllViewsInLayout();\n        // Make selected view and position it\n        this.mFirstPosition = this.mSelectedPosition;\n        if (this.mAdapter != null) {\n            let sel:View = this.makeView(this.mSelectedPosition, true);\n            let width:number = sel.getMeasuredWidth();\n            let selectedOffset:number = childrenLeft;\n            const layoutDirection:number = this.getLayoutDirection();\n            const absoluteGravity:number = Gravity.getAbsoluteGravity(this.mGravity, layoutDirection);\n            switch(absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n                case Gravity.CENTER_HORIZONTAL:\n                    selectedOffset = childrenLeft + (childrenWidth / 2) - (width / 2);\n                    break;\n                case Gravity.RIGHT:\n                    selectedOffset = childrenLeft + childrenWidth - width;\n                    break;\n            }\n            sel.offsetLeftAndRight(selectedOffset);\n        }\n        // Flush any cached views that did not get reused above\n        this.mRecycler.clear();\n        this.invalidate();\n        this.checkSelectionChanged();\n        this.mDataChanged = false;\n        this.mNeedSync = false;\n        this.setNextSelectedPositionInt(this.mSelectedPosition);\n    }\n\n    /**\n     * Obtain a view, either by pulling an existing view from the recycler or\n     * by getting a new one from the adapter. If we are animating, make sure\n     * there is enough information in the view's layout parameters to animate\n     * from the old to new positions.\n     *\n     * @param position Position in the spinner for the view to obtain\n     * @param addChild true to add the child to the spinner, false to obtain and configure only.\n     * @return A view for the given position\n     */\n    private makeView(position:number, addChild:boolean):View  {\n        let child:View;\n        if (!this.mDataChanged) {\n            child = this.mRecycler.get(position);\n            if (child != null) {\n                // Position the view\n                this.setUpChild(child, addChild);\n                return child;\n            }\n        }\n        // Nothing found in the recycler -- ask the adapter for a view\n        child = this.mAdapter.getView(position, null, this);\n        // Position the view\n        this.setUpChild(child, addChild);\n        return child;\n    }\n\n    /**\n     * Helper for makeAndAddView to set the position of a view\n     * and fill out its layout paramters.\n     *\n     * @param child The view to position\n     * @param addChild true if the child should be added to the Spinner during setup\n     */\n    private setUpChild(child:View, addChild:boolean):void  {\n        // Respect layout params that are already in the view. Otherwise\n        // make some up...\n        let lp:ViewGroup.LayoutParams = child.getLayoutParams();\n        if (lp == null) {\n            lp = this.generateDefaultLayoutParams();\n        }\n        if (addChild) {\n            this.addViewInLayout(child, 0, lp);\n        }\n        child.setSelected(this.hasFocus());\n        if (this.mDisableChildrenWhenDisabled) {\n            child.setEnabled(this.isEnabled());\n        }\n        // Get measure specs\n        let childHeightSpec:number = ViewGroup.getChildMeasureSpec(this.mHeightMeasureSpec, this.mSpinnerPadding.top + this.mSpinnerPadding.bottom, lp.height);\n        let childWidthSpec:number = ViewGroup.getChildMeasureSpec(this.mWidthMeasureSpec, this.mSpinnerPadding.left + this.mSpinnerPadding.right, lp.width);\n        // Measure child\n        child.measure(childWidthSpec, childHeightSpec);\n        let childLeft:number;\n        let childRight:number;\n        // Position vertically based on gravity setting\n        let childTop:number = this.mSpinnerPadding.top + ((this.getMeasuredHeight() - this.mSpinnerPadding.bottom - this.mSpinnerPadding.top - child.getMeasuredHeight()) / 2);\n        let childBottom:number = childTop + child.getMeasuredHeight();\n        let width:number = child.getMeasuredWidth();\n        childLeft = 0;\n        childRight = childLeft + width;\n        child.layout(childLeft, childTop, childRight, childBottom);\n    }\n\n    performClick():boolean  {\n        let handled:boolean = super.performClick();\n        if (!handled) {\n            handled = true;\n            if (!this.mPopup.isShowing()) {\n                this.mPopup.showPopup(this.getTextDirection(), this.getTextAlignment());\n            }\n        }\n        return handled;\n    }\n\n    onClick(dialog:DialogInterface, which:number):void  {\n        this.setSelection(which);\n        dialog.dismiss();\n    }\n\n    //onInitializeAccessibilityEvent(event:AccessibilityEvent):void  {\n    //    super.onInitializeAccessibilityEvent(event);\n    //    event.setClassName(Spinner.class.getName());\n    //}\n    //\n    //onInitializeAccessibilityNodeInfo(info:AccessibilityNodeInfo):void  {\n    //    super.onInitializeAccessibilityNodeInfo(info);\n    //    info.setClassName(Spinner.class.getName());\n    //    if (this.mAdapter != null) {\n    //        info.setCanOpenPopup(true);\n    //    }\n    //}\n\n    /**\n     * Sets the prompt to display when the dialog is shown.\n     * @param prompt the prompt to set\n     */\n    setPrompt(prompt:string):void  {\n        this.mPopup.setPromptText(prompt);\n    }\n\n    ///**\n    // * Sets the prompt to display when the dialog is shown.\n    // * @param promptId the resource ID of the prompt to display when the dialog is shown\n    // */\n    //setPromptId(promptId:number):void  {\n    //    this.setPrompt(this.getContext().getText(promptId));\n    //}\n\n    /**\n     * @return The prompt to display when the dialog is shown\n     */\n    getPrompt():string  {\n        return this.mPopup.getHintText();\n    }\n\n    measureContentWidth(adapter:SpinnerAdapter, background:Drawable):number  {\n        if (adapter == null) {\n            return 0;\n        }\n        let width:number = 0;\n        let itemView:View = null;\n        let itemType:number = 0;\n        const widthMeasureSpec:number = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n        const heightMeasureSpec:number = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);\n        // Make sure the number of items we'll measure is capped. If it's a huge data set\n        // with wildly varying sizes, oh well.\n        let start:number = Math.max(0, this.getSelectedItemPosition());\n        const end:number = Math.min(adapter.getCount(), start + Spinner.MAX_ITEMS_MEASURED);\n        const count:number = end - start;\n        start = Math.max(0, start - (Spinner.MAX_ITEMS_MEASURED - count));\n        for (let i:number = start; i < end; i++) {\n            const positionType:number = adapter.getItemViewType(i);\n            if (positionType != itemType) {\n                itemType = positionType;\n                itemView = null;\n            }\n            itemView = adapter.getView(i, itemView, this);\n            if (itemView.getLayoutParams() == null) {\n                itemView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));\n            }\n            itemView.measure(widthMeasureSpec, heightMeasureSpec);\n            width = Math.max(width, itemView.getMeasuredWidth());\n        }\n        // Add background padding to measured width\n        if (background != null) {\n            background.getPadding(this.mTempRect);\n            width += this.mTempRect.left + this.mTempRect.right;\n        }\n        return width;\n    }\n\n    //onSaveInstanceState():Parcelable  {\n    //    const ss:Spinner.SavedState = new Spinner.SavedState(super.onSaveInstanceState());\n    //    ss.showDropdown = this.mPopup != null && this.mPopup.isShowing();\n    //    return ss;\n    //}\n    //\n    //onRestoreInstanceState(state:Parcelable):void  {\n    //    let ss:Spinner.SavedState = <Spinner.SavedState> state;\n    //    super.onRestoreInstanceState(ss.getSuperState());\n    //    if (ss.showDropdown) {\n    //        let vto:ViewTreeObserver = this.getViewTreeObserver();\n    //        if (vto != null) {\n    //            const listener:OnGlobalLayoutListener = (()=>{\n    //                const inner_this=this;\n    //                class _Inner extends OnGlobalLayoutListener {\n    //\n    //                    onGlobalLayout():void  {\n    //                        if (!inner_this.mPopup.isShowing()) {\n    //                            inner_this.mPopup.showPopup(inner_this.getTextDirection(), inner_this.getTextAlignment());\n    //                        }\n    //                        const vto:ViewTreeObserver = inner_this.getViewTreeObserver();\n    //                        if (vto != null) {\n    //                            vto.removeOnGlobalLayoutListener(this);\n    //                        }\n    //                    }\n    //                }\n    //                return new _Inner();\n    //            })();\n    //            vto.addOnGlobalLayoutListener(listener);\n    //        }\n    //    }\n    //}\n\n}\n\nexport module Spinner{\n//export class SavedState extends AbsSpinner.SavedState {\n//\n//    showDropdown:boolean;\n//\n//    constructor( superState:Parcelable) {\n//        super(superState);\n//    }\n//\n//    constructor( _in:Parcel) {\n//        super(_in);\n//        this.showDropdown = _in.readByte() != 0;\n//    }\n//\n//    writeToParcel(out:Parcel, flags:number):void  {\n//        super.writeToParcel(out, flags);\n//        out.writeByte(<byte> (this.showDropdown ? 1 : 0));\n//    }\n//\n//    static CREATOR:Parcelable.Creator<AbsSpinner.SavedState> = (()=>{\n//        const inner_this=this;\n//        class _Inner extends Parcelable.Creator<AbsSpinner.SavedState> {\n//\n//            createFromParcel(_in:Parcel):AbsSpinner.SavedState  {\n//                return new AbsSpinner.SavedState(_in);\n//            }\n//\n//            newArray(size:number):AbsSpinner.SavedState[]  {\n//                return new Array<AbsSpinner.SavedState>(size);\n//            }\n//        }\n//        return new _Inner();\n//    })();\n//}\n/**\n     * <p>Wrapper class for an Adapter. Transforms the embedded Adapter instance\n     * into a ListAdapter.</p>\n     */\nexport class DropDownAdapter implements ListAdapter, SpinnerAdapter {\n\n    private mAdapter:SpinnerAdapter;\n\n    private mListAdapter:ListAdapter;\n\n    /**\n         * <p>Creates a new ListAdapter wrapper for the specified adapter.</p>\n         *\n         * @param adapter the Adapter to transform into a ListAdapter\n         */\n    constructor(adapter:SpinnerAdapter) {\n        this.mAdapter = adapter;\n        if (ListAdapter.isImpl(adapter)) {\n            this.mListAdapter = <ListAdapter><any>adapter;\n        }\n    }\n\n    getCount():number  {\n        return this.mAdapter == null ? 0 : this.mAdapter.getCount();\n    }\n\n    getItem(position:number):any  {\n        return this.mAdapter == null ? null : this.mAdapter.getItem(position);\n    }\n\n    getItemId(position:number):number  {\n        return this.mAdapter == null ? -1 : this.mAdapter.getItemId(position);\n    }\n\n    getView(position:number, convertView:View, parent:ViewGroup):View  {\n        return this.getDropDownView(position, convertView, parent);\n    }\n\n    getDropDownView(position:number, convertView:View, parent:ViewGroup):View  {\n        return (this.mAdapter == null) ? null : this.mAdapter.getDropDownView(position, convertView, parent);\n    }\n\n    hasStableIds():boolean  {\n        return this.mAdapter != null && this.mAdapter.hasStableIds();\n    }\n\n    registerDataSetObserver(observer:DataSetObserver):void  {\n        if (this.mAdapter != null) {\n            this.mAdapter.registerDataSetObserver(observer);\n        }\n    }\n\n    unregisterDataSetObserver(observer:DataSetObserver):void  {\n        if (this.mAdapter != null) {\n            this.mAdapter.unregisterDataSetObserver(observer);\n        }\n    }\n\n    /**\n         * If the wrapped SpinnerAdapter is also a ListAdapter, delegate this call.\n         * Otherwise, return true. \n         */\n    areAllItemsEnabled():boolean  {\n        const adapter:ListAdapter = this.mListAdapter;\n        if (adapter != null) {\n            return adapter.areAllItemsEnabled();\n        } else {\n            return true;\n        }\n    }\n\n    /**\n         * If the wrapped SpinnerAdapter is also a ListAdapter, delegate this call.\n         * Otherwise, return true.\n         */\n    isEnabled(position:number):boolean  {\n        const adapter:ListAdapter = this.mListAdapter;\n        if (adapter != null) {\n            return adapter.isEnabled(position);\n        } else {\n            return true;\n        }\n    }\n\n    getItemViewType(position:number):number  {\n        return 0;\n    }\n\n    getViewTypeCount():number  {\n        return 1;\n    }\n\n    isEmpty():boolean  {\n        return this.getCount() == 0;\n    }\n}\n/**\n     * Implements some sort of popup selection interface for selecting a spinner option.\n     * Allows for different spinner modes.\n     */\nexport interface SpinnerPopup {\n\n    setAdapter(adapter:ListAdapter):void ;\n\n    /**\n         * Show the popup\n         */\n    showPopup(textDirection:number, textAlignment:number):void ;\n\n    /**\n         * Dismiss the popup\n         */\n    dismiss():void ;\n\n    /**\n         * @return true if the popup is showing, false otherwise.\n         */\n    isShowing():boolean ;\n\n    /**\n         * Set hint text to be displayed to the user. This should provide\n         * a description of the choice being made.\n         * @param hintText Hint text to set.\n         */\n    setPromptText(hintText:string):void ;\n\n    getHintText():string ;\n\n    setBackgroundDrawable(bg:Drawable):void ;\n\n    setVerticalOffset(px:number):void ;\n\n    setHorizontalOffset(px:number):void ;\n\n    getBackground():Drawable ;\n\n    getVerticalOffset():number ;\n\n    getHorizontalOffset():number ;\n}\nexport class DialogPopup implements Spinner.SpinnerPopup, DialogInterface.OnClickListener {\n    _Spinner_this:Spinner;\n    constructor(arg:Spinner){\n        this._Spinner_this = arg;\n    }\n\n    private mPopup:AlertDialog;\n\n    private mListAdapter:ListAdapter;\n\n    private mPrompt:string;\n\n    dismiss():void  {\n        this.mPopup.dismiss();\n        this.mPopup = null;\n    }\n\n    isShowing():boolean  {\n        return this.mPopup != null ? this.mPopup.isShowing() : false;\n    }\n\n    setAdapter(adapter:ListAdapter):void  {\n        this.mListAdapter = adapter;\n    }\n\n    setPromptText(hintText:string):void  {\n        this.mPrompt = hintText;\n    }\n\n    getHintText():string  {\n        return this.mPrompt;\n    }\n\n    showPopup(textDirection:number, textAlignment:number):void  {\n        if (this.mListAdapter == null) {\n            return;\n        }\n        let builder:AlertDialog.Builder = new AlertDialog.Builder(this._Spinner_this.getContext());\n        if (this.mPrompt != null) {\n            builder.setTitle(this.mPrompt);\n        }\n        this.mPopup = builder.setSingleChoiceItemsWithAdapter(this.mListAdapter, this._Spinner_this.getSelectedItemPosition(), this).create();\n        const listView:ListView = this.mPopup.getListView();\n        listView.setTextDirection(textDirection);\n        listView.setTextAlignment(textAlignment);\n        this.mPopup.show();\n    }\n\n    onClick(dialog:DialogInterface, which:number):void  {\n        this._Spinner_this.setSelection(which);\n        if (this._Spinner_this.mOnItemClickListener != null) {\n            this._Spinner_this.performItemClick(null, which, this.mListAdapter.getItemId(which));\n        }\n        this.dismiss();\n    }\n\n    setBackgroundDrawable(bg:Drawable):void  {\n        Log.e(Spinner.TAG, \"Cannot set popup background for MODE_DIALOG, ignoring\");\n    }\n\n    setVerticalOffset(px:number):void  {\n        Log.e(Spinner.TAG, \"Cannot set vertical offset for MODE_DIALOG, ignoring\");\n    }\n\n    setHorizontalOffset(px:number):void  {\n        Log.e(Spinner.TAG, \"Cannot set horizontal offset for MODE_DIALOG, ignoring\");\n    }\n\n    getBackground():Drawable  {\n        return null;\n    }\n\n    getVerticalOffset():number  {\n        return 0;\n    }\n\n    getHorizontalOffset():number  {\n        return 0;\n    }\n}\nexport class DropdownPopup extends ListPopupWindow implements Spinner.SpinnerPopup {\n    _Spinner_this:Spinner;\n\n    private mHintText:string;\n\n    //private mAdapter:ListAdapter;\n\n    constructor(context:Context, defStyleRes:Map<string, string>, arg:Spinner) {\n        super(context, defStyleRes);\n        this._Spinner_this = arg;\n\n        this.setAnchorView(this._Spinner_this);\n        this.setModal(true);\n        this.setPromptPosition(DropdownPopup.POSITION_PROMPT_ABOVE);\n        this.setOnItemClickListener((()=>{\n            const inner_this=this;\n            class _Inner implements AdapterView.OnItemClickListener {\n\n                onItemClick(parent:AdapterView<any>, v:View, position:number, id:number):void  {\n                    inner_this._Spinner_this.setSelection(position);\n                    if (inner_this._Spinner_this.mOnItemClickListener != null) {\n                        inner_this._Spinner_this.performItemClick(v, position, inner_this.mAdapter.getItemId(position));\n                    }\n                    inner_this.dismiss();\n                }\n            }\n            return new _Inner();\n        })());\n    }\n\n    setAdapter(adapter:ListAdapter):void  {\n        super.setAdapter(adapter);\n        //this.mAdapter = adapter;\n    }\n\n    getHintText():string  {\n        return this.mHintText;\n    }\n\n    setPromptText(hintText:string):void  {\n        // Hint text is ignored for dropdowns, but maintain it here.\n        this.mHintText = hintText;\n    }\n\n    computeContentWidth():void  {\n        const background:Drawable = this.getBackground();\n        let hOffset:number = 0;\n        if (background != null) {\n            background.getPadding(this._Spinner_this.mTempRect);\n            hOffset = this._Spinner_this.isLayoutRtl() ? this._Spinner_this.mTempRect.right : -this._Spinner_this.mTempRect.left;\n        } else {\n            this._Spinner_this.mTempRect.left = this._Spinner_this.mTempRect.right = 0;\n        }\n        const spinnerPaddingLeft:number = this._Spinner_this.getPaddingLeft();\n        const spinnerPaddingRight:number = this._Spinner_this.getPaddingRight();\n        const spinnerWidth:number = this._Spinner_this.getWidth();\n        if (this._Spinner_this.mDropDownWidth == DropdownPopup.WRAP_CONTENT) {\n            let contentWidth:number = this._Spinner_this.measureContentWidth(<SpinnerAdapter><any>this.mAdapter, this.getBackground());\n            const contentWidthLimit:number = this._Spinner_this.mContext.getResources().getDisplayMetrics().widthPixels - this._Spinner_this.mTempRect.left - this._Spinner_this.mTempRect.right;\n            if (contentWidth > contentWidthLimit) {\n                contentWidth = contentWidthLimit;\n            }\n            this.setContentWidth(Math.max(contentWidth, spinnerWidth - spinnerPaddingLeft - spinnerPaddingRight));\n        } else if (this._Spinner_this.mDropDownWidth == DropdownPopup.MATCH_PARENT) {\n            this.setContentWidth(spinnerWidth - spinnerPaddingLeft - spinnerPaddingRight);\n        } else {\n            this.setContentWidth(this._Spinner_this.mDropDownWidth);\n        }\n        if (this._Spinner_this.isLayoutRtl()) {\n            hOffset += spinnerWidth - spinnerPaddingRight - this.getWidth();\n        } else {\n            hOffset += spinnerPaddingLeft;\n        }\n        this.setHorizontalOffset(hOffset);\n    }\n\n    showPopup(textDirection:number, textAlignment:number):void  {\n        const wasShowing:boolean = this.isShowing();\n        this.computeContentWidth();\n        this.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NOT_NEEDED);\n        super.show();\n        const listView:ListView = this.getListView();\n        listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);\n        listView.setTextDirection(textDirection);\n        listView.setTextAlignment(textAlignment);\n        this.setSelection(this._Spinner_this.getSelectedItemPosition());\n        if (wasShowing) {\n            // showing it will still stick around.\n            return;\n        }\n        // Make sure we hide if our anchor goes away.\n        // TODO: This might be appropriate to push all the way down to PopupWindow,\n        // but it may have other side effects to investigate first. (Text editing handles, etc.)\n        const vto:ViewTreeObserver = this._Spinner_this.getViewTreeObserver();\n        if (vto != null) {\n            const layoutListener:android.view.ViewTreeObserver.OnGlobalLayoutListener = (()=>{\n                const inner_this=this;\n                class _Inner implements android.view.ViewTreeObserver.OnGlobalLayoutListener {\n\n                    onGlobalLayout():void  {\n                        if (!inner_this._Spinner_this.isVisibleToUser()) {\n                            inner_this.dismiss();\n                        } else {\n                            inner_this.computeContentWidth();\n                            // Use super.show here to update; we don't want to move the selected\n                            // position or adjust other things that would be reset otherwise.\n                            inner_this.show();\n                        }\n                    }\n                }\n                return new _Inner();\n            })();\n            vto.addOnGlobalLayoutListener(layoutListener);\n            this.setOnDismissListener((()=>{\n                const inner_this=this;\n                class _Inner implements PopupWindow.OnDismissListener {\n                    onDismiss():void  {\n                        const vto:ViewTreeObserver = inner_this._Spinner_this.getViewTreeObserver();\n                        if (vto != null) {\n                            vto.removeOnGlobalLayoutListener(layoutListener);\n                        }\n                    }\n                }\n                return new _Inner();\n            })());\n        }\n    }\n}\n}\n\n}"
  },
  {
    "path": "src/android/widget/SpinnerAdapter.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/widget/Adapter.ts\"/>\n\nmodule android.widget {\nimport View = android.view.View;\nimport ViewGroup = android.view.ViewGroup;\nimport Adapter = android.widget.Adapter;\n/**\n * Extended {@link Adapter} that is the bridge between a\n * {@link android.widget.Spinner} and its data. A spinner adapter allows to\n * define two different views: one that shows the data in the spinner itself and\n * one that shows the data in the drop down list when the spinner is pressed.</p>\n */\nexport interface SpinnerAdapter extends Adapter {\n\n    /**\n     * <p>Get a {@link android.view.View} that displays in the drop down popup\n     * the data at the specified position in the data set.</p>\n     *\n     * @param position      index of the item whose view we want.\n     * @param convertView   the old view to reuse, if possible. Note: You should\n     *        check that this view is non-null and of an appropriate type before\n     *        using. If it is not possible to convert this view to display the\n     *        correct data, this method can create a new view.\n     * @param parent the parent that this view will eventually be attached to\n     * @return a {@link android.view.View} corresponding to the data at the\n     *         specified position.\n     */\n    getDropDownView(position:number, convertView:View, parent:ViewGroup):View ;\n}\n}"
  },
  {
    "path": "src/android/widget/TextView.ts",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/R/attr.ts\"/>\n///<reference path=\"../../android/R/color.ts\"/>\n///<reference path=\"../../android/R/drawable.ts\"/>\n///<reference path=\"../../android/R/string.ts\"/>\n///<reference path=\"../../android/content/res/ColorStateList.ts\"/>\n///<reference path=\"../../android/content/res/Resources.ts\"/>\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../android/graphics/Path.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/graphics/RectF.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/os/Handler.ts\"/>\n///<reference path=\"../../android/os/Message.ts\"/>\n///<reference path=\"../../android/os/SystemClock.ts\"/>\n///<reference path=\"../../android/text/BoringLayout.ts\"/>\n///<reference path=\"../../android/text/DynamicLayout.ts\"/>\n///<reference path=\"../../android/text/InputType.ts\"/>\n///<reference path=\"../../android/text/Layout.ts\"/>\n///<reference path=\"../../android/text/SpanWatcher.ts\"/>\n///<reference path=\"../../android/text/Spannable.ts\"/>\n///<reference path=\"../../android/text/Spanned.ts\"/>\n///<reference path=\"../../android/text/StaticLayout.ts\"/>\n///<reference path=\"../../android/text/TextDirectionHeuristic.ts\"/>\n///<reference path=\"../../android/text/TextDirectionHeuristics.ts\"/>\n///<reference path=\"../../android/text/TextPaint.ts\"/>\n///<reference path=\"../../android/text/TextUtils.ts\"/>\n///<reference path=\"../../android/text/TextWatcher.ts\"/>\n///<reference path=\"../../android/text/method/AllCapsTransformationMethod.ts\"/>\n///<reference path=\"../../android/text/method/MovementMethod.ts\"/>\n///<reference path=\"../../android/text/method/SingleLineTransformationMethod.ts\"/>\n///<reference path=\"../../android/text/method/TransformationMethod.ts\"/>\n///<reference path=\"../../android/text/method/TransformationMethod2.ts\"/>\n///<reference path=\"../../android/text/style/CharacterStyle.ts\"/>\n///<reference path=\"../../android/text/style/ParagraphStyle.ts\"/>\n///<reference path=\"../../android/text/style/UpdateAppearance.ts\"/>\n///<reference path=\"../../android/util/Log.ts\"/>\n///<reference path=\"../../android/util/TypedValue.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/view/HapticFeedbackConstants.ts\"/>\n///<reference path=\"../../android/view/KeyEvent.ts\"/>\n///<reference path=\"../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewConfiguration.ts\"/>\n///<reference path=\"../../android/view/ViewRootImpl.ts\"/>\n///<reference path=\"../../android/view/ViewTreeObserver.ts\"/>\n///<reference path=\"../../android/view/animation/AnimationUtils.ts\"/>\n///<reference path=\"../../java/lang/ref/WeakReference.ts\"/>\n///<reference path=\"../../java/util/ArrayList.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"../../java/lang/System.ts\"/>\n///<reference path=\"../../java/lang/Runnable.ts\"/>\n///<reference path=\"../../android/widget/OverScroller.ts\"/>\n///<reference path=\"../../androidui/image/NetDrawable.ts\"/>\n\nmodule android.widget {\nimport R = android.R;\nimport ColorStateList = android.content.res.ColorStateList;\nimport Resources = android.content.res.Resources;\nimport Canvas = android.graphics.Canvas;\nimport Paint = android.graphics.Paint;\nimport Path = android.graphics.Path;\nimport Rect = android.graphics.Rect;\nimport Color = android.graphics.Color;\nimport RectF = android.graphics.RectF;\nimport Drawable = android.graphics.drawable.Drawable;\nimport Handler = android.os.Handler;\nimport Message = android.os.Message;\nimport SystemClock = android.os.SystemClock;\nimport BoringLayout = android.text.BoringLayout;\nimport DynamicLayout = android.text.DynamicLayout;\nimport InputType = android.text.InputType;\nimport Layout = android.text.Layout;\nimport SpanWatcher = android.text.SpanWatcher;\nimport Spannable = android.text.Spannable;\nimport Spanned = android.text.Spanned;\nimport StaticLayout = android.text.StaticLayout;\nimport TextDirectionHeuristic = android.text.TextDirectionHeuristic;\nimport TextDirectionHeuristics = android.text.TextDirectionHeuristics;\nimport TextPaint = android.text.TextPaint;\nimport TextUtils = android.text.TextUtils;\nimport TruncateAt = android.text.TextUtils.TruncateAt;\nimport TextWatcher = android.text.TextWatcher;\nimport AllCapsTransformationMethod = android.text.method.AllCapsTransformationMethod;\nimport MovementMethod = android.text.method.MovementMethod;\nimport SingleLineTransformationMethod = android.text.method.SingleLineTransformationMethod;\nimport TransformationMethod = android.text.method.TransformationMethod;\nimport TransformationMethod2 = android.text.method.TransformationMethod2;\nimport CharacterStyle = android.text.style.CharacterStyle;\nimport ParagraphStyle = android.text.style.ParagraphStyle;\nimport UpdateAppearance = android.text.style.UpdateAppearance;\nimport Log = android.util.Log;\nimport TypedValue = android.util.TypedValue;\nimport Gravity = android.view.Gravity;\nimport HapticFeedbackConstants = android.view.HapticFeedbackConstants;\nimport KeyEvent = android.view.KeyEvent;\nimport MotionEvent = android.view.MotionEvent;\nimport View = android.view.View;\nimport ViewConfiguration = android.view.ViewConfiguration;\nimport LayoutParams = android.view.ViewGroup.LayoutParams;\nimport ViewRootImpl = android.view.ViewRootImpl;\nimport ViewTreeObserver = android.view.ViewTreeObserver;\nimport AnimationUtils = android.view.animation.AnimationUtils;\nimport WeakReference = java.lang.ref.WeakReference;\nimport ArrayList = java.util.ArrayList;\nimport Integer = java.lang.Integer;\nimport System = java.lang.System;\nimport Runnable = java.lang.Runnable;\nimport OverScroller = android.widget.OverScroller;\nimport NetDrawable = androidui.image.NetDrawable;\nimport AttrBinder = androidui.attr.AttrBinder;\n\n/**\n * Displays text to the user and optionally allows them to edit it.  A TextView\n * is a complete text editor, however the basic class is configured to not\n * allow editing; see {@link EditText} for a subclass that configures the text\n * view for editing.\n *\n * <p>\n * To allow users to copy some or all of the TextView's value and paste it somewhere else, set the\n * XML attribute {@link android.R.styleable#TextView_textIsSelectable\n * android:textIsSelectable} to \"true\" or call\n * {@link #setTextIsSelectable setTextIsSelectable(true)}. The {@code textIsSelectable} flag\n * allows users to make selection gestures in the TextView, which in turn triggers the system's\n * built-in copy/paste controls.\n * <p>\n * <b>XML attributes</b>\n * <p>\n * See {@link android.R.styleable#TextView TextView Attributes},\n * {@link android.R.styleable#View View Attributes}\n *\n * @attr ref android.R.styleable#TextView_text\n * @attr ref android.R.styleable#TextView_bufferType\n * @attr ref android.R.styleable#TextView_hint\n * @attr ref android.R.styleable#TextView_textColor\n * @attr ref android.R.styleable#TextView_textColorHighlight\n * @attr ref android.R.styleable#TextView_textColorHint\n * @attr ref android.R.styleable#TextView_textAppearance\n * @attr ref android.R.styleable#TextView_textColorLink\n * @attr ref android.R.styleable#TextView_textSize\n * @attr ref android.R.styleable#TextView_textScaleX\n * @attr ref android.R.styleable#TextView_fontFamily\n * @attr ref android.R.styleable#TextView_typeface\n * @attr ref android.R.styleable#TextView_textStyle\n * @attr ref android.R.styleable#TextView_cursorVisible\n * @attr ref android.R.styleable#TextView_maxLines\n * @attr ref android.R.styleable#TextView_maxHeight\n * @attr ref android.R.styleable#TextView_lines\n * @attr ref android.R.styleable#TextView_height\n * @attr ref android.R.styleable#TextView_minLines\n * @attr ref android.R.styleable#TextView_minHeight\n * @attr ref android.R.styleable#TextView_maxEms\n * @attr ref android.R.styleable#TextView_maxWidth\n * @attr ref android.R.styleable#TextView_ems\n * @attr ref android.R.styleable#TextView_width\n * @attr ref android.R.styleable#TextView_minEms\n * @attr ref android.R.styleable#TextView_minWidth\n * @attr ref android.R.styleable#TextView_gravity\n * @attr ref android.R.styleable#TextView_scrollHorizontally\n * @attr ref android.R.styleable#TextView_password\n * @attr ref android.R.styleable#TextView_singleLine\n * @attr ref android.R.styleable#TextView_selectAllOnFocus\n * @attr ref android.R.styleable#TextView_includeFontPadding\n * @attr ref android.R.styleable#TextView_maxLength\n * @attr ref android.R.styleable#TextView_shadowColor\n * @attr ref android.R.styleable#TextView_shadowDx\n * @attr ref android.R.styleable#TextView_shadowDy\n * @attr ref android.R.styleable#TextView_shadowRadius\n * @attr ref android.R.styleable#TextView_autoLink\n * @attr ref android.R.styleable#TextView_linksClickable\n * @attr ref android.R.styleable#TextView_numeric\n * @attr ref android.R.styleable#TextView_digits\n * @attr ref android.R.styleable#TextView_phoneNumber\n * @attr ref android.R.styleable#TextView_inputMethod\n * @attr ref android.R.styleable#TextView_capitalize\n * @attr ref android.R.styleable#TextView_autoText\n * @attr ref android.R.styleable#TextView_editable\n * @attr ref android.R.styleable#TextView_freezesText\n * @attr ref android.R.styleable#TextView_ellipsize\n * @attr ref android.R.styleable#TextView_drawableTop\n * @attr ref android.R.styleable#TextView_drawableBottom\n * @attr ref android.R.styleable#TextView_drawableRight\n * @attr ref android.R.styleable#TextView_drawableLeft\n * @attr ref android.R.styleable#TextView_drawableStart\n * @attr ref android.R.styleable#TextView_drawableEnd\n * @attr ref android.R.styleable#TextView_drawablePadding\n * @attr ref android.R.styleable#TextView_lineSpacingExtra\n * @attr ref android.R.styleable#TextView_lineSpacingMultiplier\n * @attr ref android.R.styleable#TextView_marqueeRepeatLimit\n * @attr ref android.R.styleable#TextView_inputType\n * @attr ref android.R.styleable#TextView_imeOptions\n * @attr ref android.R.styleable#TextView_privateImeOptions\n * @attr ref android.R.styleable#TextView_imeActionLabel\n * @attr ref android.R.styleable#TextView_imeActionId\n * @attr ref android.R.styleable#TextView_editorExtras\n */\nexport class TextView extends View implements ViewTreeObserver.OnPreDrawListener {\n\n    static LOG_TAG:string = \"TextView\";\n\n    static DEBUG_EXTRACT:boolean = false;\n\n    // Enum for the \"typeface\" XML parameter.\n    // TODO: How can we get this from the XML instead of hardcoding it here?\n    private static SANS:number = 1;\n\n    private static SERIF:number = 2;\n\n    private static MONOSPACE:number = 3;\n\n    // Bitfield for the \"numeric\" XML parameter.\n    // TODO: How can we get this from the XML instead of hardcoding it here?\n    private static SIGNED:number = 2;\n\n    private static DECIMAL:number = 4;\n\n    /**\n     * Draw marquee text with fading edges as usual\n     */\n    private static MARQUEE_FADE_NORMAL:number = 0;\n\n    /**\n     * Draw marquee text as ellipsize end while inactive instead of with the fade.\n     * (Useful for devices where the fade can be expensive if overdone)\n     */\n    private static MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS:number = 1;\n\n    /**\n     * Draw marquee text with fading edges because it is currently active/animating.\n     */\n    private static MARQUEE_FADE_SWITCH_SHOW_FADE:number = 2;\n\n    private static LINES:number = 1;\n\n    private static EMS:number = TextView.LINES;\n\n    private static PIXELS:number = 2;\n\n    private static TEMP_RECTF:RectF = new RectF();\n\n    // XXX should be much larger\n    private static VERY_WIDE:number = 1024 * 1024;\n\n    private static ANIMATED_SCROLL_GAP:number = 250;\n\n    private static NO_FILTERS = new Array<any>(0);\n\n    //private static EMPTY_SPANNED:Spanned = new SpannedString(\"\");\n\n    private static CHANGE_WATCHER_PRIORITY:number = 100;\n\n    // New state used to change background based on whether this TextView is multiline.\n    private static MULTILINE_STATE_SET:number[] = [ View.VIEW_STATE_MULTILINE ];\n\n    // System wide time for last cut or copy action.\n    static LAST_CUT_OR_COPY_TIME:number = 0;\n\n    private mTextColor:ColorStateList = ColorStateList.valueOf(Color.BLACK);\n\n    private mHintTextColor:ColorStateList;\n\n    private mLinkTextColor:ColorStateList;\n\n    private mCurTextColor:number = 0;\n\n    private mCurHintTextColor:number = 0;\n\n    private mFreezesText:boolean;\n\n    private mTemporaryDetach:boolean;\n\n    private mDispatchTemporaryDetach:boolean;\n\n    //private mEditableFactory:Editable.Factory = Editable.Factory.getInstance();\n\n    private mSpannableFactory:Spannable.Factory = Spannable.Factory.getInstance();\n\n    private mShadowRadius:number = 0;\n    private mShadowDx:number = 0;\n    private mShadowDy:number = 0;\n\n    private mPreDrawRegistered:boolean;\n\n    // A flag to prevent repeated movements from escaping the enclosing text view. The idea here is\n    // that if a user is holding down a movement key to traverse text, we shouldn't also traverse\n    // the view hierarchy. On the other hand, if the user is using the movement key to traverse views\n    // (i.e. the first movement was to traverse out of this view, or this view was traversed into by\n    // the user holding the movement key down) then we shouldn't prevent the focus from changing.\n    private mPreventDefaultMovement:boolean;\n\n    private mEllipsize:TextUtils.TruncateAt;\n\n\n\n    mDrawables:TextView.Drawables;\n\n    //private mCharWrapper:TextView.CharWrapper;\n\n    private mMarquee:TextView.Marquee;\n\n    private mRestartMarquee:boolean;\n\n    private mMarqueeRepeatLimit:number = 3;\n\n    private mLastLayoutDirection:number = -1;\n\n    /**\n     * On some devices the fading edges add a performance penalty if used\n     * extensively in the same layout. This mode indicates how the marquee\n     * is currently being shown, if applicable. (mEllipsize will == MARQUEE)\n     */\n    private mMarqueeFadeMode:number = TextView.MARQUEE_FADE_NORMAL;\n\n    /**\n     * When mMarqueeFadeMode is not MARQUEE_FADE_NORMAL, this stores\n     * the layout that should be used when the mode switches.\n     */\n    private mSavedMarqueeModeLayout:Layout;\n\n    private mText:String;\n\n    private mTransformed:String;\n\n    private mBufferType:TextView.BufferType = TextView.BufferType.NORMAL;\n\n    private mHint:String;\n\n    private mHintLayout:Layout;\n\n    private mMovement:MovementMethod;\n\n    private mTransformation:TransformationMethod;\n\n    private mAllowTransformationLengthChange:boolean;\n\n    private mChangeWatcher:TextView.ChangeWatcher;\n\n    private mListeners:ArrayList<TextWatcher>;\n\n    // display attributes\n    private mTextPaint:TextPaint;\n\n    private mUserSetTextScaleX:boolean;\n\n    private mLayout:Layout;\n\n    private mGravity:number = Gravity.TOP | Gravity.LEFT;\n\n    private mHorizontallyScrolling:boolean;\n\n    private mAutoLinkMask:number = 0;\n\n    private mLinksClickable:boolean = true;\n\n    private mSpacingMult:number = 1.0;\n\n    private mSpacingAdd:number = 0.0;\n\n    private mMaximum:number = Integer.MAX_VALUE;\n\n    private mMaxMode:number = TextView.LINES;\n\n    private mMinimum:number = 0;\n\n    private mMinMode:number = TextView.LINES;\n\n    private mOldMaximum:number = this.mMaximum;\n\n    private mOldMaxMode:number = this.mMaxMode;\n\n    private mMaxWidthValue:number = Integer.MAX_VALUE;\n\n    private mMaxWidthMode:number = TextView.PIXELS;\n\n    private mMinWidthValue:number = 0;\n\n    private mMinWidthMode:number = TextView.PIXELS;\n\n    private mSingleLine:boolean;\n\n    private mDesiredHeightAtMeasure:number = -1;\n\n    private mIncludePad:boolean = true;\n\n    private mDeferScroll:number = -1;\n\n    // tmp primitives, so we don't alloc them on each draw\n    private mTempRect:Rect;\n\n    private mLastScroll:number = 0;\n\n    private mScroller:OverScroller;\n\n    private mBoring:BoringLayout.Metrics;\n    private mHintBoring:BoringLayout.Metrics;\n\n    private mSavedLayout:BoringLayout;\n    private mSavedHintLayout:BoringLayout;\n\n    private mTextDir:TextDirectionHeuristic;\n\n    private mFilters = TextView.NO_FILTERS;\n\n    //private mCurrentSpellCheckerLocaleCache:Locale;\n\n    // It is possible to have a selection even when mEditor is null (programmatically set, like when\n    // a link is pressed). These highlight-related fields do not go in mEditor.\n    mHighlightColor:number = 0x6633B5E5;\n\n    private mHighlightPath:Path;\n\n    private mHighlightPaint:Paint;\n\n    private mHighlightPathBogus:boolean = true;\n\n    // Although these fields are specific to editable text, they are not added to Editor because\n    // they are defined by the TextView's style and are theme-dependent.\n    mCursorDrawableRes:number = 0;\n\n    // These four fields, could be moved to Editor, since we know their default values and we\n    // could condition the creation of the Editor to a non standard value. This is however\n    // brittle since the hardcoded values here (such as\n    // com.android.internal.R.drawable.text_select_handle_left) would have to be updated if the\n    // default style is modified.\n    mTextSelectHandleLeftRes:number = 0;\n\n    mTextSelectHandleRightRes:number = 0;\n\n    mTextSelectHandleRes:number = 0;\n\n    mTextEditSuggestionItemLayout:number = 0;\n\n    /**\n     * EditText specific data, created on demand when one of the Editor fields is used.\n     * See {@link #createEditorIfNeeded()}.\n     */\n    private mEditor:any;\n\n    //androidui: flag will set to true when editing.\n    protected mSkipDrawText = false;\n\n    /*\n     * Kick-start the font cache for the zygote process (to pay the cost of\n     * initializing freetype for our default font only once).\n     */\n    //static {\n    //    let p:Paint = new Paint();\n    //    p.setAntiAlias(true);\n    //    // We don't care about the result, just the side-effect of measuring.\n    //    p.measureText(\"H\");\n    //}\n\n    constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle=android.R.attr.textViewStyle){\n        super(context, bindElement, defStyle);\n\n        this.mText = \"\";\n\n        // const res = this.getResources();\n        // const compat = res.getCompatibilityInfo();\n\n        this.mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);\n        // this.mTextPaint.density = res.getDisplayMetrics().density;\n        // mTextPaint.setCompatibilityScaling(compat.applicationScale);\n\n        this.mHighlightPaint = new Paint(Paint.ANTI_ALIAS_FLAG);\n        // mHighlightPaint.setCompatibilityScaling(compat.applicationScale);\n\n        this.mMovement = this.getDefaultMovementMethod();\n\n        this.mTransformation = null;\n\n        let textColorHighlight = 0;\n        let textColor:ColorStateList = null;\n        let textColorHint:ColorStateList = null;\n        let textColorLink:ColorStateList = null;\n        let textSize = 14 * this.getResources().getDisplayMetrics().density;\n        // let fontFamily:string = null;\n        // let typefaceIndex = -1;\n        // let styleIndex = -1;\n        let allCaps = false;\n        let shadowcolor = 0;\n        let dx = 0, dy = 0, r = 0;\n\n        /*\n         * Look the appearance up without checking first if it exists because\n         * almost every TextView has one and it greatly simplifies the logic\n         * to be able to parse the appearance first and then let specific tags\n         * for this View override it.\n         * AndroidUIX note : not support text appearance now.\n         */\n        // let a = context.obtainStyledAttributes(bindElement, defStyle);\n        // let appearance = context.obtainStyledAttributes(bindElement, defStyle);\n        // let appearance:android.content.res.TypedArray = null;\n        // let ap = a.getString('textAppearance');\n        // a.recycle();\n        // if (ap) {\n        //     appearance = theme.obtainStyledAttributes(\n        //         ap, com.android.internal.R.styleable.TextAppearance);\n        // }\n        // if (appearance != null) {\n        //     for (let attr of appearance.getLowerCaseNoNamespaceAttrNames()) {\n        //         switch (attr) {\n        //             case 'textcolorhighlight':\n        //                 textColorHighlight = appearance.getColor(attr, textColorHighlight);\n        //                 break;\n        //\n        //             case 'textcolor':\n        //                 textColor = appearance.getColorStateList(attr);\n        //                 break;\n        //\n        //             case 'textcolorhint':\n        //                 textColorHint = appearance.getColorStateList(attr);\n        //                 break;\n        //\n        //             case 'textcolorlink':\n        //                 textColorLink = appearance.getColorStateList(attr);\n        //                 break;\n        //\n        //             case 'textsize':\n        //                 textSize = appearance.getDimensionPixelSize(attr, textSize);\n        //                 break;\n        //\n        //             case 'typeface':\n        //                 typefaceIndex = appearance.getInt(attr, -1);\n        //                 break;\n        //\n        //             case 'fontfamily':\n        //                 fontFamily = appearance.getString(attr);\n        //                 break;\n        //\n        //             case 'textstyle':\n        //                 styleIndex = appearance.getInt(attr, -1);\n        //                 break;\n        //\n        //             case 'textallcaps':\n        //                 allCaps = appearance.getBoolean(attr, false);\n        //                 break;\n        //\n        //             case 'shadowcolor':\n        //                 shadowcolor = appearance.getInt(attr, 0);\n        //                 break;\n        //\n        //             case 'shadowdx':\n        //                 dx = appearance.getFloat(attr, 0);\n        //                 break;\n        //\n        //             case 'shadowdy':\n        //                 dy = appearance.getFloat(attr, 0);\n        //                 break;\n        //\n        //             case 'shadowradius':\n        //                 r = appearance.getFloat(attr, 0);\n        //                 break;\n        //         }\n        //\n        //         appearance.recycle();\n        //     }\n        // }\n\n        let editable = this.getDefaultEditable();\n        // let inputMethod:String = null;\n        let numeric = 0;\n        let digits:String = null;\n        // let phone = false;\n        // let autotext = false;\n        // let autocap = -1;\n        // let buffertype = 0;\n        // let selectallonfocus = false;\n        let drawableLeft:Drawable = null, drawableTop:Drawable = null, drawableRight:Drawable = null,\n            drawableBottom:Drawable = null, drawableStart:Drawable = null, drawableEnd:Drawable = null;\n        let drawablePadding = 0;\n        let ellipsize:TextUtils.TruncateAt;\n        let singleLine = false;\n        let maxlength = -1;\n        let text = \"\";\n        let hint = null;\n        // let password = false;\n        // let inputType = 0; // EditorInfo.TYPE_NULL;\n\n        let a = context.obtainStyledAttributes(bindElement, defStyle);\n\n        for (let attr of a.getLowerCaseNoNamespaceAttrNames()) {\n            switch (attr) {\n                case 'editable':\n                    editable = a.getBoolean(attr, editable);\n                    break;\n\n                case 'inputmethod':\n                    // inputMethod = a.getText(attr);\n                    break;\n\n                case 'numeric':\n                    numeric = a.getInt(attr, numeric);\n                    break;\n\n                case 'digits':\n                    digits = a.getText(attr);\n                    break;\n\n                case 'phonenumber':\n                    // phone = a.getBoolean(attr, phone);\n                    break;\n\n                case 'autotext':\n                    // autotext = a.getBoolean(attr, autotext);\n                    break;\n\n                case 'capitalize':\n                    // autocap = a.getInt(attr, autocap);\n                    break;\n\n                case 'buffertype':\n                    // buffertype = a.getInt(attr, buffertype);\n                    break;\n\n                case 'selectallonfocus':\n                    // selectallonfocus = a.getBoolean(attr, selectallonfocus);\n                    break;\n\n                case 'autolink':\n                    this.mAutoLinkMask = a.getInt(attr, 0);\n                    break;\n\n                case 'linksclickable':\n                    this.mLinksClickable = a.getBoolean(attr, true);\n                    break;\n\n                case 'drawableleft':\n                    drawableLeft = a.getDrawable(attr);\n                    break;\n\n                case 'drawabletop':\n                    drawableTop = a.getDrawable(attr);\n                    break;\n\n                case 'drawableright':\n                    drawableRight = a.getDrawable(attr);\n                    break;\n\n                case 'drawablebottom':\n                    drawableBottom = a.getDrawable(attr);\n                    break;\n\n                case 'drawablestart':\n                    drawableStart = a.getDrawable(attr);\n                    break;\n\n                case 'drawableend':\n                    drawableEnd = a.getDrawable(attr);\n                    break;\n\n                case 'drawablepadding':\n                    drawablePadding = a.getDimensionPixelSize(attr, drawablePadding);\n                    break;\n\n                case 'maxlines':\n                    this.setMaxLines(a.getInt(attr, -1));\n                    break;\n\n                case 'maxheight':\n                    this.setMaxHeight(a.getDimensionPixelSize(attr, -1));\n                    break;\n\n                case 'lines':\n                    this.setLines(a.getInt(attr, -1));\n                    break;\n\n                case 'height':\n                    this.setHeight(a.getDimensionPixelSize(attr, -1));\n                    break;\n\n                case 'minlines':\n                    this.setMinLines(a.getInt(attr, -1));\n                    break;\n\n                case 'minheight':\n                    this.setMinHeight(a.getDimensionPixelSize(attr, -1));\n                    break;\n\n                case 'maxems':\n                    this.setMaxEms(a.getInt(attr, -1));\n                    break;\n\n                case 'maxwidth':\n                    this.setMaxWidth(a.getDimensionPixelSize(attr, -1));\n                    break;\n\n                case 'ems':\n                    this.setEms(a.getInt(attr, -1));\n                    break;\n\n                case 'width':\n                    this.setWidth(a.getDimensionPixelSize(attr, -1));\n                    break;\n\n                case 'minems':\n                    this.setMinEms(a.getInt(attr, -1));\n                    break;\n\n                case 'minwidth':\n                    this.setMinWidth(a.getDimensionPixelSize(attr, -1));\n                    break;\n\n                case 'gravity':\n                    this.setGravity(Gravity.parseGravity(a.getAttrValue(attr), -1));\n                    break;\n\n                case 'hint':\n                    hint = a.getText(attr);\n                    break;\n\n                case 'text':\n                    text = a.getText(attr);\n                    break;\n\n                case 'scrollhorizontally':\n                    if (a.getBoolean(attr, false)) {\n                        this.setHorizontallyScrolling(true);\n                    }\n                    break;\n\n                case 'singleline':\n                    singleLine = a.getBoolean(attr, singleLine);\n                    break;\n\n                case 'ellipsize':\n                    ellipsize = TextUtils.TruncateAt[(a.getAttrValue(attr) + '').toUpperCase()];\n                    break;\n\n                case 'marqueerepeatlimit':\n                    this.setMarqueeRepeatLimit(a.getInt(attr, this.mMarqueeRepeatLimit));\n                    break;\n\n                case 'includefontpadding':\n                    if (!a.getBoolean(attr, true)) {\n                        this.setIncludeFontPadding(false);\n                    }\n                    break;\n\n                case 'cursorvisible':\n                    if (!a.getBoolean(attr, true)) {\n                        this.setCursorVisible(false);\n                    }\n                    break;\n\n                case 'maxlength':\n                    maxlength = a.getInt(attr, -1);\n                    break;\n\n                case 'textscalex':\n                    this.setTextScaleX(a.getFloat(attr, 1.0));\n                    break;\n\n                case 'freezestext':\n                    this.mFreezesText = a.getBoolean(attr, false);\n                    break;\n\n                case 'shadowcolor':\n                    shadowcolor = a.getInt(attr, 0);\n                    break;\n\n                case 'shadowdx':\n                    dx = a.getFloat(attr, 0);\n                    break;\n\n                case 'shadowdy':\n                    dy = a.getFloat(attr, 0);\n                    break;\n\n                case 'shadowradius':\n                    r = a.getFloat(attr, 0);\n                    break;\n\n                case 'enabled':\n                    this.setEnabled(a.getBoolean(attr, this.isEnabled()));\n                    break;\n\n                case 'textcolorhighlight':\n                    textColorHighlight = a.getColor(attr, textColorHighlight);\n                    break;\n\n                case 'textcolor':\n                    textColor = a.getColorStateList(attr);\n                    break;\n\n                case 'textcolorhint':\n                    textColorHint = a.getColorStateList(attr);\n                    break;\n\n                case 'textcolorlink':\n                    textColorLink = a.getColorStateList(attr);\n                    break;\n\n                case 'textsize':\n                    textSize = a.getDimensionPixelSize(attr, textSize);\n                    break;\n\n                case 'typeface':\n                    // typefaceIndex = a.getInt(attr, typefaceIndex);\n                    break;\n\n                case 'textstyle':\n                    // styleIndex = a.getInt(attr, styleIndex);\n                    break;\n\n                case 'fontfamily':\n                    // fontFamily = a.getString(attr);\n                    break;\n\n                case 'password':\n                    // password = a.getBoolean(attr, password);\n                    break;\n\n                case 'linespacingextra':\n                    this.mSpacingAdd = a.getDimensionPixelSize(attr, Math.floor(this.mSpacingAdd));\n                    break;\n\n                case 'linespacingmultiplier':\n                    this.mSpacingMult = a.getFloat(attr, this.mSpacingMult);\n                    break;\n\n                case 'inputtype':\n                    // inputType = a.getInt(attr, EditorInfo.TYPE_NULL);\n                    break;\n\n                case 'imeoptions':\n                    // createEditorIfNeeded();\n                    // mEditor.createInputContentTypeIfNeeded();\n                    // mEditor.mInputContentType.imeOptions = a.getInt(attr,\n                    //     mEditor.mInputContentType.imeOptions);\n                    break;\n\n                case 'imeactionlabel':\n                    // createEditorIfNeeded();\n                    // mEditor.createInputContentTypeIfNeeded();\n                    // mEditor.mInputContentType.imeActionLabel = a.getText(attr);\n                    break;\n\n                case 'imeactionid':\n                    // createEditorIfNeeded();\n                    // mEditor.createInputContentTypeIfNeeded();\n                    // mEditor.mInputContentType.imeActionId = a.getInt(attr,\n                    //     mEditor.mInputContentType.imeActionId);\n                    break;\n\n                case 'privateimeoptions':\n                    // this.setPrivateImeOptions(a.getString(attr));\n                    break;\n\n                case 'editorextras':\n                    // try {\n                    //     this.setInputExtras(a.getResourceId(attr, 0));\n                    // } catch (e) {\n                    //     Log.w(LOG_TAG, \"Failure reading input extras\", e);\n                    // } catch (IOException e) {\n                    //     Log.w(LOG_TAG, \"Failure reading input extras\", e);\n                    // }\n                    break;\n\n                case 'textcursordrawable':\n                    // this.mCursorDrawableRes = a.getResourceId(attr, 0);\n                    break;\n\n                case 'textselecthandleleft':\n                    // this.mTextSelectHandleLeftRes = a.getResourceId(attr, 0);\n                    break;\n\n                case 'textselecthandleright':\n                    // this.mTextSelectHandleRightRes = a.getResourceId(attr, 0);\n                    break;\n\n                case 'textselecthandle':\n                    // this.mTextSelectHandleRes = a.getResourceId(attr, 0);\n                    break;\n\n                case 'texteditsuggestionitemlayout':\n                    // this.mTextEditSuggestionItemLayout = a.getResourceId(attr, 0);\n                    break;\n\n                case 'textisselectable':\n                    this.setTextIsSelectable(a.getBoolean(attr, false));\n                    break;\n\n                case 'textallcaps':\n                    allCaps = a.getBoolean(attr, false);\n                    break;\n            }\n        }\n        a.recycle();\n\n        let bufferType = this.mBufferType;// TextView.BufferType.EDITABLE;\n\n        // const variation =\n        //     inputType & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_MASK_VARIATION);\n        // final boolean passwordInputType = variation\n        //     == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD);\n        // final boolean webPasswordInputType = variation\n        //     == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_WEB_PASSWORD);\n        // final boolean numberPasswordInputType = variation\n        //     == (EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_VARIATION_PASSWORD);\n\n        // if (inputMethod != null) {\n        //     Class<?> c;\n        //\n        //     try {\n        //         c = Class.forName(inputMethod.toString());\n        //     } catch (ClassNotFoundException ex) {\n        //         throw new RuntimeException(ex);\n        //     }\n        //\n        //     try {\n        //         createEditorIfNeeded();\n        //         mEditor.mKeyListener = (KeyListener) c.newInstance();\n        //     } catch (InstantiationException ex) {\n        //         throw new RuntimeException(ex);\n        //     } catch (IllegalAccessException ex) {\n        //         throw new RuntimeException(ex);\n        //     }\n        //     try {\n        //         mEditor.mInputType = inputType != EditorInfo.TYPE_NULL\n        //             ? inputType\n        //             : mEditor.mKeyListener.getInputType();\n        //     } catch (IncompatibleClassChangeError e) {\n        //         mEditor.mInputType = EditorInfo.TYPE_CLASS_TEXT;\n        //     }\n        // } else if (digits != null) {\n        //     createEditorIfNeeded();\n        //     mEditor.mKeyListener = DigitsKeyListener.getInstance(digits.toString());\n        //     // If no input type was specified, we will default to generic\n        //     // text, since we can't tell the IME about the set of digits\n        //     // that was selected.\n        //     mEditor.mInputType = inputType != EditorInfo.TYPE_NULL\n        //         ? inputType : EditorInfo.TYPE_CLASS_TEXT;\n        // } else if (inputType != EditorInfo.TYPE_NULL) {\n        //     setInputType(inputType, true);\n        //     // If set, the input type overrides what was set using the deprecated singleLine flag.\n        //     singleLine = !isMultilineInputType(inputType);\n        // } else if (phone) {\n        //     createEditorIfNeeded();\n        //     mEditor.mKeyListener = DialerKeyListener.getInstance();\n        //     mEditor.mInputType = inputType = EditorInfo.TYPE_CLASS_PHONE;\n        // } else if (numeric != 0) {\n        //     createEditorIfNeeded();\n        //     mEditor.mKeyListener = DigitsKeyListener.getInstance((numeric & SIGNED) != 0,\n        //         (numeric & DECIMAL) != 0);\n        //     inputType = EditorInfo.TYPE_CLASS_NUMBER;\n        //     if ((numeric & SIGNED) != 0) {\n        //         inputType |= EditorInfo.TYPE_NUMBER_FLAG_SIGNED;\n        //     }\n        //     if ((numeric & DECIMAL) != 0) {\n        //         inputType |= EditorInfo.TYPE_NUMBER_FLAG_DECIMAL;\n        //     }\n        //     mEditor.mInputType = inputType;\n        // } else if (autotext || autocap != -1) {\n        //     TextKeyListener.Capitalize cap;\n        //\n        //     inputType = EditorInfo.TYPE_CLASS_TEXT;\n        //\n        //     switch (autocap) {\n        //         case 1:\n        //             cap = TextKeyListener.Capitalize.SENTENCES;\n        //             inputType |= EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES;\n        //             break;\n        //\n        //         case 2:\n        //             cap = TextKeyListener.Capitalize.WORDS;\n        //             inputType |= EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS;\n        //             break;\n        //\n        //         case 3:\n        //             cap = TextKeyListener.Capitalize.CHARACTERS;\n        //             inputType |= EditorInfo.TYPE_TEXT_FLAG_CAP_CHARACTERS;\n        //             break;\n        //\n        //         default:\n        //             cap = TextKeyListener.Capitalize.NONE;\n        //             break;\n        //     }\n        //\n        //     createEditorIfNeeded();\n        //     mEditor.mKeyListener = TextKeyListener.getInstance(autotext, cap);\n        //     mEditor.mInputType = inputType;\n        // } else if (isTextSelectable()) {\n        //     // Prevent text changes from keyboard.\n        //     if (mEditor != null) {\n        //         mEditor.mKeyListener = null;\n        //         mEditor.mInputType = EditorInfo.TYPE_NULL;\n        //     }\n        //     bufferType = BufferType.SPANNABLE;\n        //     // So that selection can be changed using arrow keys and touch is handled.\n        //     setMovementMethod(ArrowKeyMovementMethod.getInstance());\n        // } else if (editable) {\n        //     createEditorIfNeeded();\n        //     mEditor.mKeyListener = TextKeyListener.getInstance();\n        //     mEditor.mInputType = EditorInfo.TYPE_CLASS_TEXT;\n        // } else {\n        //     if (mEditor != null) mEditor.mKeyListener = null;\n        //\n        //     switch (buffertype) {\n        //         case 0:\n        //             bufferType = BufferType.NORMAL;\n        //             break;\n        //         case 1:\n        //             bufferType = BufferType.SPANNABLE;\n        //             break;\n        //         case 2:\n        //             bufferType = BufferType.EDITABLE;\n        //             break;\n        //     }\n        // }\n        //\n        // if (mEditor != null) mEditor.adjustInputType(password, passwordInputType,\n        //     webPasswordInputType, numberPasswordInputType);\n        //\n        // if (selectallonfocus) {\n        //     createEditorIfNeeded();\n        //     mEditor.mSelectAllOnFocus = true;\n        //\n        //     if (bufferType == BufferType.NORMAL)\n        //         bufferType = BufferType.SPANNABLE;\n        // }\n\n        // This call will save the initial left/right drawables\n        this.setCompoundDrawablesWithIntrinsicBounds(\n            drawableLeft, drawableTop, drawableRight, drawableBottom);\n        this.setRelativeDrawablesIfNeeded(drawableStart, drawableEnd);\n        this.setCompoundDrawablePadding(drawablePadding);\n\n        // Same as setSingleLine(), but make sure the transformation method and the maximum number\n        // of lines of height are unchanged for multi-line TextViews.\n        this.setInputTypeSingleLine(singleLine);\n        this.applySingleLine(singleLine, singleLine, singleLine);\n\n        if (singleLine && this.getKeyListener() == null && ellipsize == null) {\n            ellipsize = TextUtils.TruncateAt.END; // END\n        }\n\n        switch (ellipsize) {\n            case TextUtils.TruncateAt.START:\n                this.setEllipsize(TextUtils.TruncateAt.START);\n                break;\n            case TextUtils.TruncateAt.MIDDLE:\n                this.setEllipsize(TextUtils.TruncateAt.MIDDLE);\n                break;\n            case TextUtils.TruncateAt.END:\n                this.setEllipsize(TextUtils.TruncateAt.END);\n                break;\n            case TextUtils.TruncateAt.MARQUEE:\n                // if (ViewConfiguration.get(context).isFadingMarqueeEnabled()) {\n                //     this.setHorizontalFadingEdgeEnabled(true);\n                //     this.mMarqueeFadeMode = MARQUEE_FADE_NORMAL;\n                // } else {\n                    this.setHorizontalFadingEdgeEnabled(false);\n                    this.mMarqueeFadeMode = TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS;\n                // }\n                this.setEllipsize(TextUtils.TruncateAt.MARQUEE);\n                break;\n        }\n\n        this.setTextColor(textColor != null ? textColor : ColorStateList.valueOf(0xFF000000));\n        this.setHintTextColor(textColorHint);\n        this.setLinkTextColor(textColorLink);\n        if (textColorHighlight != 0) {\n            this.setHighlightColor(textColorHighlight);\n        }\n        this.setRawTextSize(textSize);\n\n        if (allCaps) {\n            this.setTransformationMethod(new AllCapsTransformationMethod(this.getContext()));\n        }\n\n        // if (password || passwordInputType || webPasswordInputType || numberPasswordInputType) {\n        //     this.setTransformationMethod(android.text.method.PasswordTransformationMethod.PasswordTransformationMethod.getInstance());\n        //     typefaceIndex = MONOSPACE;\n        // } else if (mEditor != null &&\n        //     (mEditor.mInputType & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_MASK_VARIATION))\n        //     == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD)) {\n        //     typefaceIndex = MONOSPACE;\n        // }\n        //\n        // setTypefaceFromAttrs(fontFamily, typefaceIndex, styleIndex);\n\n        if (shadowcolor != 0) {\n            this.setShadowLayer(r, dx, dy, shadowcolor);\n        }\n\n        // if (maxlength >= 0) {\n        //     this.setFilters(new InputFilter[] { new InputFilter.LengthFilter(maxlength) });\n        // } else {\n        //     this.setFilters(TextView.NO_FILTERS);\n        // }\n\n        this.setText(text, bufferType);\n        if (hint != null) this.setHint(hint);\n\n        // /*\n        //  * Views are not normally focusable unless specified to be.\n        //  * However, TextViews that have input or movement methods *are*\n        //  * focusable by default.\n        //  */\n        // a = context.obtainStyledAttributes(attrs,\n        //     com.android.internal.R.styleable.View,\n        //     defStyle, 0);\n        //\n        // boolean focusable = mMovement != null || getKeyListener() != null;\n        // boolean clickable = focusable;\n        // boolean longClickable = focusable;\n        //\n        // n = a.getIndexCount();\n        // for (int i = 0; i < n; i++) {\n        //     int attr = a.getIndex(i);\n        //\n        //     switch (attr) {\n        //         case com.android.internal.R.styleable.View_focusable:\n        //             focusable = a.getBoolean(attr, focusable);\n        //             break;\n        //\n        //         case com.android.internal.R.styleable.View_clickable:\n        //             clickable = a.getBoolean(attr, clickable);\n        //             break;\n        //\n        //         case com.android.internal.R.styleable.View_longClickable:\n        //             longClickable = a.getBoolean(attr, longClickable);\n        //             break;\n        //     }\n        // }\n        // a.recycle();\n        //\n        // setFocusable(focusable);\n        // setClickable(clickable);\n        // setLongClickable(longClickable);\n        //\n        // if (mEditor != null) mEditor.prepareCursorControllers();\n        //\n        // // If not explicitly specified this view is important for accessibility.\n        // if (getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) {\n        //     setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);\n        // }\n    }\n\n\n    protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n        return super.createClassAttrBinder()\n            .set('textColorHighlight', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setHighlightColor(attrBinder.parseColor(value, v.mHighlightColor));\n                },\n                getter(v: TextView){\n                    return v.getHighlightColor();\n                }\n            }).set('textColor', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    let color = attrBinder.parseColorList(value);\n                    if (color) v.setTextColor(color);\n                },\n                getter(v: TextView){\n                    return v.mTextColor;\n                }\n            }).set('textColorHint', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    let color = attrBinder.parseColorList(value);\n                    if (color) v.setHintTextColor(color);\n                },\n                getter(v: TextView){\n                    return v.mHintTextColor;\n                }\n            }).set('textSize', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    let size = attrBinder.parseNumberPixelSize(value, v.mTextPaint.getTextSize());\n                    v.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);\n                },\n                getter(v: TextView){\n                    return v.mTextPaint.getTextSize();\n                }\n            }).set('textAllCaps', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setAllCaps(attrBinder.parseBoolean(value, true));\n                }\n            }).set('shadowColor', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setShadowLayer(v.mShadowRadius, v.mShadowDx, v.mShadowDy,\n                        attrBinder.parseColor(value, v.mTextPaint.shadowColor));\n                },\n                getter(v: TextView){\n                    return v.getShadowColor();\n                }\n            }).set('shadowDx', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    let dx = attrBinder.parseNumberPixelSize(value, v.mShadowDx);\n                    v.setShadowLayer(v.mShadowRadius, dx, v.mShadowDy, v.mTextPaint.shadowColor);\n                },\n                getter(v: TextView){\n                    return v.getShadowDx();\n                }\n            }).set('shadowDy', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    let dy = attrBinder.parseNumberPixelSize(value, v.mShadowDy);\n                    v.setShadowLayer(v.mShadowRadius, v.mShadowDx, dy, v.mTextPaint.shadowColor);\n                },\n                getter(v: TextView){\n                    return v.getShadowDy();\n                }\n            }).set('shadowRadius', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    let radius = attrBinder.parseNumberPixelSize(value, v.mShadowRadius);\n                    v.setShadowLayer(radius, v.mShadowDx, v.mShadowDy, v.mTextPaint.shadowColor);\n                },\n                getter(v: TextView){\n                    return v.getShadowRadius();\n                }\n            }).set('drawableLeft', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    let dr = v.mDrawables || <TextView.Drawables>{};\n                    let drawable = attrBinder.parseDrawable(value);\n                    v.setCompoundDrawablesWithIntrinsicBounds(drawable, dr.mDrawableTop, dr.mDrawableRight, dr.mDrawableBottom);\n                },\n                getter(v: TextView){\n                    return v.getCompoundDrawables()[0];\n                }\n            }).set('drawableStart', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    let dr = v.mDrawables || <TextView.Drawables>{};\n                    let drawable = attrBinder.parseDrawable(value);\n                    v.setCompoundDrawablesWithIntrinsicBounds(drawable, dr.mDrawableTop, dr.mDrawableRight, dr.mDrawableBottom);\n                },\n                getter(v: TextView){\n                    return v.getCompoundDrawables()[0];\n                }\n            }).set('drawableTop', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    let dr = v.mDrawables || <TextView.Drawables>{};\n                    let drawable = attrBinder.parseDrawable(value);\n                    v.setCompoundDrawablesWithIntrinsicBounds(dr.mDrawableLeft, drawable, dr.mDrawableRight, dr.mDrawableBottom);\n                },\n                getter(v: TextView){\n                    return v.getCompoundDrawables()[1];\n                }\n            }).set('drawableRight', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    let dr = v.mDrawables || <TextView.Drawables>{};\n                    let drawable = attrBinder.parseDrawable(value);\n                    v.setCompoundDrawablesWithIntrinsicBounds(dr.mDrawableLeft, dr.mDrawableTop, drawable, dr.mDrawableBottom);\n                },\n                getter(v: TextView){\n                    return v.getCompoundDrawables()[2];\n                }\n            }).set('drawableEnd', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    let dr = v.mDrawables || <TextView.Drawables>{};\n                    let drawable = attrBinder.parseDrawable(value);\n                    v.setCompoundDrawablesWithIntrinsicBounds(dr.mDrawableLeft, dr.mDrawableTop, drawable, dr.mDrawableBottom);\n                },\n                getter(v: TextView){\n                    return v.getCompoundDrawables()[2];\n                }\n            }).set('drawableBottom', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    let dr = v.mDrawables || <TextView.Drawables>{};\n                    let drawable = attrBinder.parseDrawable(value);\n                    v.setCompoundDrawablesWithIntrinsicBounds(dr.mDrawableLeft, dr.mDrawableTop, dr.mDrawableRight, drawable);\n                },\n                getter(v: TextView){\n                    return v.getCompoundDrawables()[3];\n                }\n            }).set('drawablePadding', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setCompoundDrawablePadding(attrBinder.parseNumberPixelSize(value));\n                },\n                getter(v: TextView){\n                    return v.getCompoundDrawablePadding();\n                }\n            }).set('maxLines', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    value = Number.parseInt(value);\n                    if (Number.isInteger(value)) v.setMaxLines(value);\n                },\n                getter(v: TextView){\n                    return v.getMaxLines();\n                }\n            }).set('maxHeight', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setMaxHeight(attrBinder.parseNumberPixelSize(value, v.getMaxHeight()));\n                },\n                getter(v: TextView){\n                    return v.getMaxHeight();\n                }\n            }).set('lines', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    value = Number.parseInt(value);\n                    if (Number.isInteger(value)) v.setLines(value);\n                },\n                getter(v: TextView){\n                    if (v.getMaxLines() === v.getMinLines()) return v.getMaxLines();\n                    return null;\n                }\n            }).set('height', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    value = attrBinder.parseNumberPixelSize(value, -1);\n                    if (value >= 0) v.setHeight(value);\n                },\n                getter(v: TextView){\n                    if (v.getMaxHeight() === v.getMinimumHeight()) return v.getMaxHeight();\n                    return null;\n                }\n            }).set('minLines', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setMinLines(attrBinder.parseInt(value, v.getMinLines()));\n                },\n                getter(v: TextView){\n                    return v.getMinLines();\n                }\n            }).set('minHeight', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setMinHeight(attrBinder.parseNumberPixelSize(value, v.getMinHeight()));\n                },\n                getter(v: TextView){\n                    return v.getMinHeight();\n                }\n            }).set('maxEms', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setMaxEms(attrBinder.parseInt(value, v.getMaxEms()));\n                },\n                getter(v: TextView){\n                    return v.getMaxEms();\n                }\n            }).set('maxWidth', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setMaxWidth(attrBinder.parseNumberPixelSize(value, v.getMaxWidth()));\n                },\n                getter(v: TextView){\n                    return v.getMaxWidth();\n                }\n            }).set('ems', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    let ems = attrBinder.parseInt(value, null);\n                    if (ems != null) v.setEms(ems);\n                },\n                getter(v: TextView){\n                    if (v.getMinEms() === v.getMaxEms()) return v.getMaxEms();\n                    return null;\n                }\n            }).set('width', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    value = attrBinder.parseNumberPixelSize(value, -1);\n                    if (value >= 0) v.setWidth(value);\n                },\n                getter(v: TextView){\n                    if (v.getMinWidth() === v.getMaxWidth()) return v.getMinWidth();\n                    return null;\n                }\n            }).set('minEms', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setMinEms(attrBinder.parseInt(value, v.getMinEms()));\n                },\n                getter(v: TextView){\n                    return v.getMinEms();\n                }\n            }).set('minWidth', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setMinWidth(attrBinder.parseNumberPixelSize(value, v.getMinWidth()));\n                },\n                getter(v: TextView){\n                    return v.getMinWidth();\n                }\n            }).set('gravity', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setGravity(attrBinder.parseGravity(value, v.mGravity));\n                },\n                getter(v: TextView){\n                    return v.mGravity;\n                }\n            }).set('hint', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setHint(attrBinder.parseString(value));\n                },\n                getter(v: TextView){\n                    return v.getHint();\n                }\n            }).set('text', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setText(attrBinder.parseString(value));\n                },\n                getter(v: TextView){\n                    return v.getText();\n                }\n            }).set('scrollHorizontally', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setHorizontallyScrolling(attrBinder.parseBoolean(value, false));\n                }\n            }).set('singleLine', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setSingleLine(attrBinder.parseBoolean(value, false));\n                }\n            }).set('ellipsize', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    let ellipsize = TextUtils.TruncateAt[(value + '').toUpperCase()];\n                    if (ellipsize) v.setEllipsize(ellipsize);\n                }\n            }).set('marqueeRepeatLimit', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    let marqueeRepeatLimit = attrBinder.parseInt(value, -1);\n                    if (marqueeRepeatLimit >= 0) v.setMarqueeRepeatLimit(marqueeRepeatLimit);\n                }\n            }).set('includeFontPadding', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setIncludeFontPadding(attrBinder.parseBoolean(value, false));\n                }\n            }).set('enabled', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setEnabled(attrBinder.parseBoolean(value, v.isEnabled()));\n                },\n                getter(v: TextView){\n                    return v.isEnabled();\n                }\n            }).set('lineSpacingExtra', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setLineSpacing(attrBinder.parseNumberPixelSize(value, v.mSpacingAdd), v.mSpacingMult);\n                },\n                getter(v: TextView){\n                    return v.mSpacingAdd;\n                }\n            }).set('lineSpacingMultiplier', {\n                setter(v: TextView, value: any, attrBinder: AttrBinder) {\n                    v.setLineSpacing(v.mSpacingAdd, attrBinder.parseFloat(value, v.mSpacingMult));\n                },\n                getter(v: TextView){\n                    return v.mSpacingMult;\n                }\n            });\n    }\n\n    private setTypefaceFromAttrs(familyName:string, typefaceIndex:number, styleIndex:number):void  {\n        //let tf:Typeface = null;\n        //if (familyName != null) {\n        //    tf = Typeface.create(familyName, styleIndex);\n        //    if (tf != null) {\n        //        this.setTypeface(tf);\n        //        return;\n        //    }\n        //}\n        //switch(typefaceIndex) {\n        //    case TextView.SANS:\n        //        tf = Typeface.SANS_SERIF;\n        //        break;\n        //    case TextView.SERIF:\n        //        tf = Typeface.SERIF;\n        //        break;\n        //    case TextView.MONOSPACE:\n        //        tf = Typeface.MONOSPACE;\n        //        break;\n        //}\n        //this.setTypeface(tf, styleIndex);\n    }\n\n    private setRelativeDrawablesIfNeeded(start:Drawable, end:Drawable):void  {\n        let hasRelativeDrawables:boolean = (start != null) || (end != null);\n        if (hasRelativeDrawables) {\n            let dr:TextView.Drawables = this.mDrawables;\n            if (dr == null) {\n                this.mDrawables = dr = new TextView.Drawables();\n            }\n            this.mDrawables.mOverride = true;\n            const compoundRect:Rect = dr.mCompoundRect;\n            let state:number[] = this.getDrawableState();\n            if (start != null) {\n                start.setBounds(0, 0, start.getIntrinsicWidth(), start.getIntrinsicHeight());\n                start.setState(state);\n                start.copyBounds(compoundRect);\n                start.setCallback(this);\n                dr.mDrawableStart = start;\n                dr.mDrawableSizeStart = compoundRect.width();\n                dr.mDrawableHeightStart = compoundRect.height();\n            } else {\n                dr.mDrawableSizeStart = dr.mDrawableHeightStart = 0;\n            }\n            if (end != null) {\n                end.setBounds(0, 0, end.getIntrinsicWidth(), end.getIntrinsicHeight());\n                end.setState(state);\n                end.copyBounds(compoundRect);\n                end.setCallback(this);\n                dr.mDrawableEnd = end;\n                dr.mDrawableSizeEnd = compoundRect.width();\n                dr.mDrawableHeightEnd = compoundRect.height();\n            } else {\n                dr.mDrawableSizeEnd = dr.mDrawableHeightEnd = 0;\n            }\n            this.resetResolvedDrawables();\n            this.resolveDrawables();\n        }\n    }\n\n    setEnabled(enabled:boolean):void  {\n        if (enabled == this.isEnabled()) {\n            return;\n        }\n        //if (!enabled) {\n        //    // Hide the soft input if the currently active TextView is disabled\n        //    let imm:InputMethodManager = InputMethodManager.peekInstance();\n        //    if (imm != null && imm.isActive(this)) {\n        //        imm.hideSoftInputFromWindow(this.getWindowToken(), 0);\n        //    }\n        //}\n        super.setEnabled(enabled);\n        //if (enabled) {\n        //    // Make sure IME is updated with current editor info.\n        //    let imm:InputMethodManager = InputMethodManager.peekInstance();\n        //    if (imm != null)\n        //        imm.restartInput(this);\n        //}\n        //// Will change text color\n        //if (this.mEditor != null) {\n        //    this.mEditor.invalidateTextDisplayList();\n        //    this.mEditor.prepareCursorControllers();\n        //    // start or stop the cursor blinking as appropriate\n        //    this.mEditor.makeBlink();\n        //}\n    }\n\n    /**\n     * Sets the typeface and style in which the text should be displayed,\n     * and turns on the fake bold and italic bits in the Paint if the\n     * Typeface that you provided does not have all the bits in the\n     * style that you specified.\n     *\n     * @attr ref android.R.styleable#TextView_typeface\n     * @attr ref android.R.styleable#TextView_textStyle\n     */\n    setTypeface(tf:any, style:number):void  {\n        //if (style > 0) {\n        //    if (tf == null) {\n        //        tf = Typeface.defaultFromStyle(style);\n        //    } else {\n        //        tf = Typeface.create(tf, style);\n        //    }\n        //    this.setTypeface(tf);\n        //    // now compute what (if any) algorithmic styling is needed\n        //    let typefaceStyle:number = tf != null ? tf.getStyle() : 0;\n        //    let need:number = style & ~typefaceStyle;\n        //    this.mTextPaint.setFakeBoldText((need & Typeface.BOLD) != 0);\n        //    this.mTextPaint.setTextSkewX((need & Typeface.ITALIC) != 0 ? -0.25 : 0);\n        //} else {\n        //    this.mTextPaint.setFakeBoldText(false);\n        //    this.mTextPaint.setTextSkewX(0);\n        //    this.setTypeface(tf);\n        //}\n    }\n\n    /**\n     * Subclasses override this to specify that they have a KeyListener\n     * by default even if not specifically called for in the XML options.\n     */\n    protected getDefaultEditable():boolean  {\n        return false;\n    }\n\n    /**\n     * Subclasses override this to specify a default movement method.\n     */\n    protected getDefaultMovementMethod():MovementMethod  {\n        return null;\n    }\n\n    /**\n     * Return the text the TextView is displaying. If setText() was called with\n     * an argument of TextView.BufferType.SPANNABLE or TextView.BufferType.EDITABLE, you can cast\n     * the return value from this method to Spannable or Editable, respectively.\n     *\n     * Note: The content of the return value should not be modified. If you want\n     * a modifiable one, you should make your own copy first.\n     *\n     * @attr ref android.R.styleable#TextView_text\n     */\n    getText():String  {\n        return this.mText;\n    }\n\n    /**\n     * Returns the length, in characters, of the text managed by this TextView\n     */\n    length():number  {\n        return this.mText.length;\n    }\n\n    /**\n     * Return the text the TextView is displaying as an Editable object.  If\n     * the text is not editable, null is returned.\n     *\n     * @see #getText\n     */\n    getEditableText():any  {\n        return null;\n        //return (this.mText instanceof Editable) ? <Editable> this.mText : null;\n    }\n\n    /**\n     * @return the height of one standard line in pixels.  Note that markup\n     * within the text can cause individual lines to be taller or shorter\n     * than this height, and the layout may contain additional first-\n     * or last-line padding.\n     */\n    getLineHeight():number  {\n        return Math.round(this.mTextPaint.getFontMetricsInt(null) * this.mSpacingMult + this.mSpacingAdd);\n    }\n\n    /**\n     * @return the Layout that is currently being used to display the text.\n     * This can be null if the text or width has recently changes.\n     */\n    getLayout():Layout  {\n        return this.mLayout;\n    }\n\n    /**\n     * @return the Layout that is currently being used to display the hint text.\n     * This can be null.\n     */\n    getHintLayout():Layout  {\n        return this.mHintLayout;\n    }\n\n    /**\n     * Retrieve the {@link android.content.UndoManager} that is currently associated\n     * with this TextView.  By default there is no associated UndoManager, so null\n     * is returned.  One can be associated with the TextView through\n     * {@link #setUndoManager(android.content.UndoManager, String)}\n     *\n     * @hide\n     */\n    getUndoManager():any  {\n        return null;\n        //return this.mEditor == null ? null : this.mEditor.mUndoManager;\n    }\n\n    /**\n     * Associate an {@link android.content.UndoManager} with this TextView.  Once\n     * done, all edit operations on the TextView will result in appropriate\n     * {@link android.content.UndoOperation} objects pushed on the given UndoManager's\n     * stack.\n     *\n     * @param undoManager The {@link android.content.UndoManager} to associate with\n     * this TextView, or null to clear any existing association.\n     * @param tag String tag identifying this particular TextView owner in the\n     * UndoManager.  This is used to keep the correct association with the\n     * {@link android.content.UndoOwner} of any operations inside of the UndoManager.\n     *\n     * @hide\n     */\n    setUndoManager(undoManager:any, tag:string):void  {\n        //not support now\n        //if (undoManager != null) {\n        //    this.createEditorIfNeeded();\n        //    this.mEditor.mUndoManager = undoManager;\n        //    this.mEditor.mUndoOwner = undoManager.getOwner(tag, this);\n        //    this.mEditor.mUndoInputFilter = new Editor.UndoInputFilter(this.mEditor);\n        //    if (!(this.mText instanceof Editable)) {\n        //        this.setText(this.mText, TextView.BufferType.EDITABLE);\n        //    }\n        //    this.setFilters(<Editable> this.mText, this.mFilters);\n        //} else if (this.mEditor != null) {\n        //    // XXX need to destroy all associated state.\n        //    this.mEditor.mUndoManager = null;\n        //    this.mEditor.mUndoOwner = null;\n        //    this.mEditor.mUndoInputFilter = null;\n        //}\n    }\n\n    /**\n     * @return the current key listener for this TextView.\n     * This will frequently be null for non-EditText TextViews.\n     *\n     * @attr ref android.R.styleable#TextView_numeric\n     * @attr ref android.R.styleable#TextView_digits\n     * @attr ref android.R.styleable#TextView_phoneNumber\n     * @attr ref android.R.styleable#TextView_inputMethod\n     * @attr ref android.R.styleable#TextView_capitalize\n     * @attr ref android.R.styleable#TextView_autoText\n     */\n    getKeyListener():any  {\n        return null;\n        //return this.mEditor == null ? null : this.mEditor.mKeyListener;\n    }\n\n    /**\n     * Sets the key listener to be used with this TextView.  This can be null\n     * to disallow user input.  Note that this method has significant and\n     * subtle interactions with soft keyboards and other input method:\n     * see {@link KeyListener#getInputType() KeyListener.getContentType()}\n     * for important details.  Calling this method will replace the current\n     * content type of the text view with the content type returned by the\n     * key listener.\n     * <p>\n     * Be warned that if you want a TextView with a key listener or movement\n     * method not to be focusable, or if you want a TextView without a\n     * key listener or movement method to be focusable, you must call\n     * {@link #setFocusable} again after calling this to get the focusability\n     * back the way you want it.\n     *\n     * @attr ref android.R.styleable#TextView_numeric\n     * @attr ref android.R.styleable#TextView_digits\n     * @attr ref android.R.styleable#TextView_phoneNumber\n     * @attr ref android.R.styleable#TextView_inputMethod\n     * @attr ref android.R.styleable#TextView_capitalize\n     * @attr ref android.R.styleable#TextView_autoText\n     */\n    setKeyListener(input:any):void  {\n        //not support\n        //this.setKeyListenerOnly(input);\n        //this.fixFocusableAndClickableSettings();\n        //if (input != null) {\n        //    this.createEditorIfNeeded();\n        //    try {\n        //        this.mEditor.mInputType = this.mEditor.mKeyListener.getInputType();\n        //    } catch (e){\n        //        this.mEditor.mInputType = EditorInfo.TYPE_CLASS_TEXT;\n        //    }\n        //    // Change inputType, without affecting transformation.\n        //    // No need to applySingleLine since mSingleLine is unchanged.\n        //    this.setInputTypeSingleLine(this.mSingleLine);\n        //} else {\n        //    if (this.mEditor != null)\n        //        this.mEditor.mInputType = EditorInfo.TYPE_NULL;\n        //}\n        //let imm:InputMethodManager = InputMethodManager.peekInstance();\n        //if (imm != null)\n        //    imm.restartInput(this);\n    }\n\n    private setKeyListenerOnly(input:any):void  {\n        //not support\n        // null is the default value\n        //if (this.mEditor == null && input == null)\n        //    return;\n        //this.createEditorIfNeeded();\n        //if (this.mEditor.mKeyListener != input) {\n        //    this.mEditor.mKeyListener = input;\n        //    if (input != null && !(this.mText instanceof Editable)) {\n        //        this.setText(this.mText);\n        //    }\n        //    this.setFilters(<Editable> this.mText, this.mFilters);\n        //}\n    }\n\n    /**\n     * @return the movement method being used for this TextView.\n     * This will frequently be null for non-EditText TextViews.\n     */\n    getMovementMethod():MovementMethod  {\n        return this.mMovement;\n    }\n\n    /**\n     * Sets the movement method (arrow key handler) to be used for\n     * this TextView.  This can be null to disallow using the arrow keys\n     * to move the cursor or scroll the view.\n     * <p>\n     * Be warned that if you want a TextView with a key listener or movement\n     * method not to be focusable, or if you want a TextView without a\n     * key listener or movement method to be focusable, you must call\n     * {@link #setFocusable} again after calling this to get the focusability\n     * back the way you want it.\n     */\n    setMovementMethod(movement:MovementMethod):void  {\n        if (this.mMovement != movement) {\n            this.mMovement = movement;\n            if (movement != null && !Spannable.isImpl(this.mText)) {\n                this.setText(this.mText);\n            }\n            this.fixFocusableAndClickableSettings();\n            // mMovement\n            //if (this.mEditor != null)\n            //    this.mEditor.prepareCursorControllers();\n        }\n    }\n\n    private fixFocusableAndClickableSettings():void  {\n        if (this.mMovement != null\n            //|| (this.mEditor != null && this.mEditor.mKeyListener != null)\n        ) {\n            this.setFocusable(true);\n            this.setClickable(true);\n            this.setLongClickable(true);\n        } else {\n            this.setFocusable(false);\n            this.setClickable(false);\n            this.setLongClickable(false);\n        }\n    }\n\n    /**\n     * @return the current transformation method for this TextView.\n     * This will frequently be null except for single-line and password\n     * fields.\n     *\n     * @attr ref android.R.styleable#TextView_password\n     * @attr ref android.R.styleable#TextView_singleLine\n     */\n    getTransformationMethod():TransformationMethod  {\n        return this.mTransformation;\n    }\n\n    /**\n     * Sets the transformation that is applied to the text that this\n     * TextView is displaying.\n     *\n     * @attr ref android.R.styleable#TextView_password\n     * @attr ref android.R.styleable#TextView_singleLine\n     */\n    setTransformationMethod(method:TransformationMethod):void  {\n        if (method == this.mTransformation) {\n            // the same.\n            return;\n        }\n        if (this.mTransformation != null) {\n            if (Spannable.isImpl(this.mText)) {\n                (<Spannable> this.mText).removeSpan(this.mTransformation);\n            }\n        }\n        this.mTransformation = method;\n        if (TransformationMethod2.isImpl(method)) {\n            let method2:TransformationMethod2 = <TransformationMethod2> method;\n            this.mAllowTransformationLengthChange = !this.isTextSelectable();// && !(this.mText instanceof Editable);\n            method2.setLengthChangesAllowed(this.mAllowTransformationLengthChange);\n        } else {\n            this.mAllowTransformationLengthChange = false;\n        }\n        this.setText(this.mText);\n        //if (this.hasPasswordTransformationMethod()) {\n        //    this.notifyViewAccessibilityStateChangedIfNeeded(AccessibilityEvent.CONTENT_CHANGE_TYPE_UNDEFINED);\n        //}\n    }\n\n    /**\n     * Returns the top padding of the view, plus space for the top\n     * Drawable if any.\n     */\n    getCompoundPaddingTop():number  {\n        const dr:TextView.Drawables = this.mDrawables;\n        if (dr == null || dr.mDrawableTop == null) {\n            return this.mPaddingTop;\n        } else {\n            return this.mPaddingTop + dr.mDrawablePadding + dr.mDrawableSizeTop;\n        }\n    }\n\n    /**\n     * Returns the bottom padding of the view, plus space for the bottom\n     * Drawable if any.\n     */\n    getCompoundPaddingBottom():number  {\n        const dr:TextView.Drawables = this.mDrawables;\n        if (dr == null || dr.mDrawableBottom == null) {\n            return this.mPaddingBottom;\n        } else {\n            return this.mPaddingBottom + dr.mDrawablePadding + dr.mDrawableSizeBottom;\n        }\n    }\n\n    /**\n     * Returns the left padding of the view, plus space for the left\n     * Drawable if any.\n     */\n    getCompoundPaddingLeft():number  {\n        const dr:TextView.Drawables = this.mDrawables;\n        if (dr == null || dr.mDrawableLeft == null) {\n            return this.mPaddingLeft;\n        } else {\n            return this.mPaddingLeft + dr.mDrawablePadding + dr.mDrawableSizeLeft;\n        }\n    }\n\n    /**\n     * Returns the right padding of the view, plus space for the right\n     * Drawable if any.\n     */\n    getCompoundPaddingRight():number  {\n        const dr:TextView.Drawables = this.mDrawables;\n        if (dr == null || dr.mDrawableRight == null) {\n            return this.mPaddingRight;\n        } else {\n            return this.mPaddingRight + dr.mDrawablePadding + dr.mDrawableSizeRight;\n        }\n    }\n\n    /**\n     * Returns the start padding of the view, plus space for the start\n     * Drawable if any.\n     */\n    getCompoundPaddingStart():number  {\n        this.resolveDrawables();\n        //switch(this.getLayoutDirection()) {\n        //    default:\n        //    case TextView.LAYOUT_DIRECTION_LTR:\n                return this.getCompoundPaddingLeft();\n        //    case TextView.LAYOUT_DIRECTION_RTL:\n        //        return this.getCompoundPaddingRight();\n        //}\n    }\n\n    /**\n     * Returns the end padding of the view, plus space for the end\n     * Drawable if any.\n     */\n    getCompoundPaddingEnd():number  {\n        this.resolveDrawables();\n        //switch(this.getLayoutDirection()) {\n        //    default:\n        //    case TextView.LAYOUT_DIRECTION_LTR:\n                return this.getCompoundPaddingRight();\n        //    case TextView.LAYOUT_DIRECTION_RTL:\n        //        return this.getCompoundPaddingLeft();\n        //}\n    }\n\n    /**\n     * Returns the extended top padding of the view, including both the\n     * top Drawable if any and any extra space to keep more than maxLines\n     * of text from showing.  It is only valid to call this after measuring.\n     */\n    getExtendedPaddingTop():number  {\n        if (this.mMaxMode != TextView.LINES) {\n            return this.getCompoundPaddingTop();\n        }\n        if (this.mLayout.getLineCount() <= this.mMaximum) {\n            return this.getCompoundPaddingTop();\n        }\n        let top:number = this.getCompoundPaddingTop();\n        let bottom:number = this.getCompoundPaddingBottom();\n        let viewht:number = this.getHeight() - top - bottom;\n        let layoutht:number = this.mLayout.getLineTop(this.mMaximum);\n        if (layoutht >= viewht) {\n            return top;\n        }\n        const gravity:number = this.mGravity & Gravity.VERTICAL_GRAVITY_MASK;\n        if (gravity == Gravity.TOP) {\n            return top;\n        } else if (gravity == Gravity.BOTTOM) {\n            return top + viewht - layoutht;\n        } else {\n            // (gravity == Gravity.CENTER_VERTICAL)\n            return top + (viewht - layoutht) / 2;\n        }\n    }\n\n    /**\n     * Returns the extended bottom padding of the view, including both the\n     * bottom Drawable if any and any extra space to keep more than maxLines\n     * of text from showing.  It is only valid to call this after measuring.\n     */\n    getExtendedPaddingBottom():number  {\n        if (this.mMaxMode != TextView.LINES) {\n            return this.getCompoundPaddingBottom();\n        }\n        if (this.mLayout.getLineCount() <= this.mMaximum) {\n            return this.getCompoundPaddingBottom();\n        }\n        let top:number = this.getCompoundPaddingTop();\n        let bottom:number = this.getCompoundPaddingBottom();\n        let viewht:number = this.getHeight() - top - bottom;\n        let layoutht:number = this.mLayout.getLineTop(this.mMaximum);\n        if (layoutht >= viewht) {\n            return bottom;\n        }\n        const gravity:number = this.mGravity & Gravity.VERTICAL_GRAVITY_MASK;\n        if (gravity == Gravity.TOP) {\n            return bottom + viewht - layoutht;\n        } else if (gravity == Gravity.BOTTOM) {\n            return bottom;\n        } else {\n            // (gravity == Gravity.CENTER_VERTICAL)\n            return bottom + (viewht - layoutht) / 2;\n        }\n    }\n\n    /**\n     * Returns the total left padding of the view, including the left\n     * Drawable if any.\n     */\n    getTotalPaddingLeft():number  {\n        return this.getCompoundPaddingLeft();\n    }\n\n    /**\n     * Returns the total right padding of the view, including the right\n     * Drawable if any.\n     */\n    getTotalPaddingRight():number  {\n        return this.getCompoundPaddingRight();\n    }\n\n    /**\n     * Returns the total start padding of the view, including the start\n     * Drawable if any.\n     */\n    getTotalPaddingStart():number  {\n        return this.getCompoundPaddingStart();\n    }\n\n    /**\n     * Returns the total end padding of the view, including the end\n     * Drawable if any.\n     */\n    getTotalPaddingEnd():number  {\n        return this.getCompoundPaddingEnd();\n    }\n\n    /**\n     * Returns the total top padding of the view, including the top\n     * Drawable if any, the extra space to keep more than maxLines\n     * from showing, and the vertical offset for gravity, if any.\n     */\n    getTotalPaddingTop():number  {\n        return this.getExtendedPaddingTop() + this.getVerticalOffset(true);\n    }\n\n    /**\n     * Returns the total bottom padding of the view, including the bottom\n     * Drawable if any, the extra space to keep more than maxLines\n     * from showing, and the vertical offset for gravity, if any.\n     */\n    getTotalPaddingBottom():number  {\n        return this.getExtendedPaddingBottom() + this.getBottomVerticalOffset(true);\n    }\n\n    /**\n     * Sets the Drawables (if any) to appear to the left of, above,\n     * to the right of, and below the text.  Use null if you do not\n     * want a Drawable there.  The Drawables must already have had\n     * {@link Drawable#setBounds} called.\n     *\n     * @attr ref android.R.styleable#TextView_drawableLeft\n     * @attr ref android.R.styleable#TextView_drawableTop\n     * @attr ref android.R.styleable#TextView_drawableRight\n     * @attr ref android.R.styleable#TextView_drawableBottom\n     */\n    setCompoundDrawables(left:Drawable, top:Drawable, right:Drawable, bottom:Drawable):void  {\n        let dr:TextView.Drawables = this.mDrawables;\n        const drawables:boolean = left != null || top != null || right != null || bottom != null;\n        if (!drawables) {\n            // Clearing drawables...  can we free the data structure?\n            if (dr != null) {\n                if (dr.mDrawablePadding == 0) {\n                    this.mDrawables = null;\n                } else {\n                    // out all of the fields in the existing structure.\n                    if (dr.mDrawableLeft != null){\n                        dr.mDrawableLeft.setCallback(null);\n                    }\n                    dr.mDrawableLeft = null;\n                    if (dr.mDrawableTop != null){\n                        dr.mDrawableTop.setCallback(null);\n                    }\n                    dr.mDrawableTop = null;\n                    if (dr.mDrawableRight != null){\n                        dr.mDrawableRight.setCallback(null);\n                    }\n                    dr.mDrawableRight = null;\n                    if (dr.mDrawableBottom != null){\n                        dr.mDrawableBottom.setCallback(null);\n                    }\n                    dr.mDrawableBottom = null;\n                    dr.mDrawableSizeLeft = dr.mDrawableHeightLeft = 0;\n                    dr.mDrawableSizeRight = dr.mDrawableHeightRight = 0;\n                    dr.mDrawableSizeTop = dr.mDrawableWidthTop = 0;\n                    dr.mDrawableSizeBottom = dr.mDrawableWidthBottom = 0;\n                }\n            }\n        } else {\n            if (dr == null) {\n                this.mDrawables = dr = new TextView.Drawables();\n            }\n            this.mDrawables.mOverride = false;\n            if (dr.mDrawableLeft != left && dr.mDrawableLeft != null) {\n                dr.mDrawableLeft.setCallback(null);\n            }\n            dr.mDrawableLeft = left;\n            if (dr.mDrawableTop != top && dr.mDrawableTop != null) {\n                dr.mDrawableTop.setCallback(null);\n            }\n            dr.mDrawableTop = top;\n            if (dr.mDrawableRight != right && dr.mDrawableRight != null) {\n                dr.mDrawableRight.setCallback(null);\n            }\n            dr.mDrawableRight = right;\n            if (dr.mDrawableBottom != bottom && dr.mDrawableBottom != null) {\n                dr.mDrawableBottom.setCallback(null);\n            }\n            dr.mDrawableBottom = bottom;\n            const compoundRect:Rect = dr.mCompoundRect;\n            let state:number[];\n            state = this.getDrawableState();\n            if (left != null) {\n                left.setState(state);\n                left.copyBounds(compoundRect);\n                left.setCallback(this);\n                dr.mDrawableSizeLeft = compoundRect.width();\n                dr.mDrawableHeightLeft = compoundRect.height();\n            } else {\n                dr.mDrawableSizeLeft = dr.mDrawableHeightLeft = 0;\n            }\n            if (right != null) {\n                right.setState(state);\n                right.copyBounds(compoundRect);\n                right.setCallback(this);\n                dr.mDrawableSizeRight = compoundRect.width();\n                dr.mDrawableHeightRight = compoundRect.height();\n            } else {\n                dr.mDrawableSizeRight = dr.mDrawableHeightRight = 0;\n            }\n            if (top != null) {\n                top.setState(state);\n                top.copyBounds(compoundRect);\n                top.setCallback(this);\n                dr.mDrawableSizeTop = compoundRect.height();\n                dr.mDrawableWidthTop = compoundRect.width();\n            } else {\n                dr.mDrawableSizeTop = dr.mDrawableWidthTop = 0;\n            }\n            if (bottom != null) {\n                bottom.setState(state);\n                bottom.copyBounds(compoundRect);\n                bottom.setCallback(this);\n                dr.mDrawableSizeBottom = compoundRect.height();\n                dr.mDrawableWidthBottom = compoundRect.width();\n            } else {\n                dr.mDrawableSizeBottom = dr.mDrawableWidthBottom = 0;\n            }\n        }\n        // Save initial left/right drawables\n        if (dr != null) {\n            dr.mDrawableLeftInitial = left;\n            dr.mDrawableRightInitial = right;\n        }\n        this.resetResolvedDrawables();\n        this.resolveDrawables();\n        this.invalidate();\n        this.requestLayout();\n    }\n\n    /**\n     * Sets the Drawables (if any) to appear to the left of, above,\n     * to the right of, and below the text.  Use null if you do not\n     * want a Drawable there. The Drawables' bounds will be set to\n     * their intrinsic bounds.\n     *\n     * @attr ref android.R.styleable#TextView_drawableLeft\n     * @attr ref android.R.styleable#TextView_drawableTop\n     * @attr ref android.R.styleable#TextView_drawableRight\n     * @attr ref android.R.styleable#TextView_drawableBottom\n     */\n    setCompoundDrawablesWithIntrinsicBounds(left:Drawable, top:Drawable, right:Drawable, bottom:Drawable):void  {\n        if (left != null) {\n            left.setBounds(0, 0, left.getIntrinsicWidth(), left.getIntrinsicHeight());\n        }\n        if (right != null) {\n            right.setBounds(0, 0, right.getIntrinsicWidth(), right.getIntrinsicHeight());\n        }\n        if (top != null) {\n            top.setBounds(0, 0, top.getIntrinsicWidth(), top.getIntrinsicHeight());\n        }\n        if (bottom != null) {\n            bottom.setBounds(0, 0, bottom.getIntrinsicWidth(), bottom.getIntrinsicHeight());\n        }\n        this.setCompoundDrawables(left, top, right, bottom);\n    }\n\n    /**\n     * Sets the Drawables (if any) to appear to the start of, above,\n     * to the end of, and below the text.  Use null if you do not\n     * want a Drawable there.  The Drawables must already have had\n     * {@link Drawable#setBounds} called.\n     *\n     * @attr ref android.R.styleable#TextView_drawableStart\n     * @attr ref android.R.styleable#TextView_drawableTop\n     * @attr ref android.R.styleable#TextView_drawableEnd\n     * @attr ref android.R.styleable#TextView_drawableBottom\n     */\n    setCompoundDrawablesRelative(start:Drawable, top:Drawable, end:Drawable, bottom:Drawable):void  {\n        let dr:TextView.Drawables = this.mDrawables;\n        const drawables:boolean = start != null || top != null || end != null || bottom != null;\n        if (!drawables) {\n            // Clearing drawables...  can we free the data structure?\n            if (dr != null) {\n                if (dr.mDrawablePadding == 0) {\n                    this.mDrawables = null;\n                } else {\n                    // out all of the fields in the existing structure.\n                    if (dr.mDrawableStart != null){\n                        dr.mDrawableStart.setCallback(null);\n                    }\n                    dr.mDrawableStart = null;\n                    if (dr.mDrawableTop != null){\n                        dr.mDrawableTop.setCallback(null);\n                    }\n                    dr.mDrawableTop = null;\n                    if (dr.mDrawableEnd != null){\n                        dr.mDrawableEnd.setCallback(null);\n                    }\n                    dr.mDrawableEnd = null;\n                    if (dr.mDrawableBottom != null){\n                        dr.mDrawableBottom.setCallback(null);\n                    }\n                    dr.mDrawableBottom = null;\n                    dr.mDrawableSizeStart = dr.mDrawableHeightStart = 0;\n                    dr.mDrawableSizeEnd = dr.mDrawableHeightEnd = 0;\n                    dr.mDrawableSizeTop = dr.mDrawableWidthTop = 0;\n                    dr.mDrawableSizeBottom = dr.mDrawableWidthBottom = 0;\n                }\n            }\n        } else {\n            if (dr == null) {\n                this.mDrawables = dr = new TextView.Drawables();\n            }\n            this.mDrawables.mOverride = true;\n            if (dr.mDrawableStart != start && dr.mDrawableStart != null) {\n                dr.mDrawableStart.setCallback(null);\n            }\n            dr.mDrawableStart = start;\n            if (dr.mDrawableTop != top && dr.mDrawableTop != null) {\n                dr.mDrawableTop.setCallback(null);\n            }\n            dr.mDrawableTop = top;\n            if (dr.mDrawableEnd != end && dr.mDrawableEnd != null) {\n                dr.mDrawableEnd.setCallback(null);\n            }\n            dr.mDrawableEnd = end;\n            if (dr.mDrawableBottom != bottom && dr.mDrawableBottom != null) {\n                dr.mDrawableBottom.setCallback(null);\n            }\n            dr.mDrawableBottom = bottom;\n            const compoundRect:Rect = dr.mCompoundRect;\n            let state:number[];\n            state = this.getDrawableState();\n            if (start != null) {\n                start.setState(state);\n                start.copyBounds(compoundRect);\n                start.setCallback(this);\n                dr.mDrawableSizeStart = compoundRect.width();\n                dr.mDrawableHeightStart = compoundRect.height();\n            } else {\n                dr.mDrawableSizeStart = dr.mDrawableHeightStart = 0;\n            }\n            if (end != null) {\n                end.setState(state);\n                end.copyBounds(compoundRect);\n                end.setCallback(this);\n                dr.mDrawableSizeEnd = compoundRect.width();\n                dr.mDrawableHeightEnd = compoundRect.height();\n            } else {\n                dr.mDrawableSizeEnd = dr.mDrawableHeightEnd = 0;\n            }\n            if (top != null) {\n                top.setState(state);\n                top.copyBounds(compoundRect);\n                top.setCallback(this);\n                dr.mDrawableSizeTop = compoundRect.height();\n                dr.mDrawableWidthTop = compoundRect.width();\n            } else {\n                dr.mDrawableSizeTop = dr.mDrawableWidthTop = 0;\n            }\n            if (bottom != null) {\n                bottom.setState(state);\n                bottom.copyBounds(compoundRect);\n                bottom.setCallback(this);\n                dr.mDrawableSizeBottom = compoundRect.height();\n                dr.mDrawableWidthBottom = compoundRect.width();\n            } else {\n                dr.mDrawableSizeBottom = dr.mDrawableWidthBottom = 0;\n            }\n        }\n        this.resetResolvedDrawables();\n        this.resolveDrawables();\n        this.invalidate();\n        this.requestLayout();\n    }\n\n    ///**\n    // * Sets the Drawables (if any) to appear to the start of, above,\n    // * to the end of, and below the text.  Use 0 if you do not\n    // * want a Drawable there. The Drawables' bounds will be set to\n    // * their intrinsic bounds.\n    // *\n    // * @param start Resource identifier of the start Drawable.\n    // * @param top Resource identifier of the top Drawable.\n    // * @param end Resource identifier of the end Drawable.\n    // * @param bottom Resource identifier of the bottom Drawable.\n    // *\n    // * @attr ref android.R.styleable#TextView_drawableStart\n    // * @attr ref android.R.styleable#TextView_drawableTop\n    // * @attr ref android.R.styleable#TextView_drawableEnd\n    // * @attr ref android.R.styleable#TextView_drawableBottom\n    // */\n    //setCompoundDrawablesRelativeWithIntrinsicBounds(start:number, top:number, end:number, bottom:number):void  {\n    //    const resources:Resources = this.getResources();\n    //    this.setCompoundDrawablesRelativeWithIntrinsicBounds(start != 0 ? resources.getDrawable(start) : null, top != 0 ? resources.getDrawable(top) : null, end != 0 ? resources.getDrawable(end) : null, bottom != 0 ? resources.getDrawable(bottom) : null);\n    //}\n\n    /**\n     * Sets the Drawables (if any) to appear to the start of, above,\n     * to the end of, and below the text.  Use null if you do not\n     * want a Drawable there. The Drawables' bounds will be set to\n     * their intrinsic bounds.\n     *\n     * @attr ref android.R.styleable#TextView_drawableStart\n     * @attr ref android.R.styleable#TextView_drawableTop\n     * @attr ref android.R.styleable#TextView_drawableEnd\n     * @attr ref android.R.styleable#TextView_drawableBottom\n     */\n    setCompoundDrawablesRelativeWithIntrinsicBounds(start:Drawable, top:Drawable, end:Drawable, bottom:Drawable):void  {\n        if (start != null) {\n            start.setBounds(0, 0, start.getIntrinsicWidth(), start.getIntrinsicHeight());\n        }\n        if (end != null) {\n            end.setBounds(0, 0, end.getIntrinsicWidth(), end.getIntrinsicHeight());\n        }\n        if (top != null) {\n            top.setBounds(0, 0, top.getIntrinsicWidth(), top.getIntrinsicHeight());\n        }\n        if (bottom != null) {\n            bottom.setBounds(0, 0, bottom.getIntrinsicWidth(), bottom.getIntrinsicHeight());\n        }\n        this.setCompoundDrawablesRelative(start, top, end, bottom);\n    }\n\n    /**\n     * Returns drawables for the left, top, right, and bottom borders.\n     *\n     * @attr ref android.R.styleable#TextView_drawableLeft\n     * @attr ref android.R.styleable#TextView_drawableTop\n     * @attr ref android.R.styleable#TextView_drawableRight\n     * @attr ref android.R.styleable#TextView_drawableBottom\n     */\n    getCompoundDrawables():Drawable[]  {\n        const dr:TextView.Drawables = this.mDrawables;\n        if (dr != null) {\n            return  [ dr.mDrawableLeft, dr.mDrawableTop, dr.mDrawableRight, dr.mDrawableBottom ];\n        } else {\n            return  [ null, null, null, null ];\n        }\n    }\n\n    /**\n     * Returns drawables for the start, top, end, and bottom borders.\n     *\n     * @attr ref android.R.styleable#TextView_drawableStart\n     * @attr ref android.R.styleable#TextView_drawableTop\n     * @attr ref android.R.styleable#TextView_drawableEnd\n     * @attr ref android.R.styleable#TextView_drawableBottom\n     */\n    getCompoundDrawablesRelative():Drawable[]  {\n        const dr:TextView.Drawables = this.mDrawables;\n        if (dr != null) {\n            return  [ dr.mDrawableStart, dr.mDrawableTop, dr.mDrawableEnd, dr.mDrawableBottom ];\n        } else {\n            return  [ null, null, null, null ];\n        }\n    }\n\n    /**\n     * Sets the size of the padding between the compound drawables and\n     * the text.\n     *\n     * @attr ref android.R.styleable#TextView_drawablePadding\n     */\n    setCompoundDrawablePadding(pad:number):void  {\n        let dr:TextView.Drawables = this.mDrawables;\n        if (pad == 0) {\n            if (dr != null) {\n                dr.mDrawablePadding = pad;\n            }\n        } else {\n            if (dr == null) {\n                this.mDrawables = dr = new TextView.Drawables();\n            }\n            dr.mDrawablePadding = pad;\n        }\n        this.invalidate();\n        this.requestLayout();\n    }\n\n    /**\n     * Returns the padding between the compound drawables and the text.\n     *\n     * @attr ref android.R.styleable#TextView_drawablePadding\n     */\n    getCompoundDrawablePadding():number  {\n        const dr:TextView.Drawables = this.mDrawables;\n        return dr != null ? dr.mDrawablePadding : 0;\n    }\n\n    setPadding(left:number, top:number, right:number, bottom:number):void  {\n        if (left != this.mPaddingLeft || right != this.mPaddingRight || top != this.mPaddingTop || bottom != this.mPaddingBottom) {\n            this.nullLayouts();\n        }\n        // the super call will requestLayout()\n        super.setPadding(left, top, right, bottom);\n        this.invalidate();\n    }\n\n    //setPaddingRelative(start:number, top:number, end:number, bottom:number):void  {\n    //    if (start != this.getPaddingStart() || end != this.getPaddingEnd() || top != this.mPaddingTop || bottom != this.mPaddingBottom) {\n    //        this.nullLayouts();\n    //    }\n    //    // the super call will requestLayout()\n    //    super.setPaddingRelative(start, top, end, bottom);\n    //    this.invalidate();\n    //}\n\n    /**\n     * Gets the autolink mask of the text.  See {@link\n     * android.text.util.Linkify#ALL Linkify.ALL} and peers for\n     * possible values.\n     *\n     * @attr ref android.R.styleable#TextView_autoLink\n     */\n    getAutoLinkMask():number  {\n        return this.mAutoLinkMask;\n    }\n\n    ///**\n    // * Sets the text color, size, style, hint color, and highlight color\n    // * from the specified TextAppearance resource.\n    // */\n    //setTextAppearance(context:Context, resid:number):void  {\n    //    let appearance:TypedArray = context.obtainStyledAttributes(resid, com.android.internal.R.styleable.TextAppearance);\n    //    let color:number;\n    //    let colors:ColorStateList;\n    //    let ts:number;\n    //    color = appearance.getColor(com.android.internal.R.styleable.TextAppearance_textColorHighlight, 0);\n    //    if (color != 0) {\n    //        this.setHighlightColor(color);\n    //    }\n    //    colors = appearance.getColorStateList(com.android.internal.R.styleable.TextAppearance_textColor);\n    //    if (colors != null) {\n    //        this.setTextColor(colors);\n    //    }\n    //    ts = appearance.getDimensionPixelSize(com.android.internal.R.styleable.TextAppearance_textSize, 0);\n    //    if (ts != 0) {\n    //        this.setRawTextSize(ts);\n    //    }\n    //    colors = appearance.getColorStateList(com.android.internal.R.styleable.TextAppearance_textColorHint);\n    //    if (colors != null) {\n    //        this.setHintTextColor(colors);\n    //    }\n    //    colors = appearance.getColorStateList(com.android.internal.R.styleable.TextAppearance_textColorLink);\n    //    if (colors != null) {\n    //        this.setLinkTextColor(colors);\n    //    }\n    //    let familyName:string;\n    //    let typefaceIndex:number, styleIndex:number;\n    //    familyName = appearance.getString(com.android.internal.R.styleable.TextAppearance_fontFamily);\n    //    typefaceIndex = appearance.getInt(com.android.internal.R.styleable.TextAppearance_typeface, -1);\n    //    styleIndex = appearance.getInt(com.android.internal.R.styleable.TextAppearance_textStyle, -1);\n    //    this.setTypefaceFromAttrs(familyName, typefaceIndex, styleIndex);\n    //    const shadowcolor:number = appearance.getInt(com.android.internal.R.styleable.TextAppearance_shadowColor, 0);\n    //    if (shadowcolor != 0) {\n    //        const dx:number = appearance.getFloat(com.android.internal.R.styleable.TextAppearance_shadowDx, 0);\n    //        const dy:number = appearance.getFloat(com.android.internal.R.styleable.TextAppearance_shadowDy, 0);\n    //        const r:number = appearance.getFloat(com.android.internal.R.styleable.TextAppearance_shadowRadius, 0);\n    //        this.setShadowLayer(r, dx, dy, shadowcolor);\n    //    }\n    //    if (appearance.getBoolean(com.android.internal.R.styleable.TextAppearance_textAllCaps, false)) {\n    //        this.setTransformationMethod(new AllCapsTransformationMethod());\n    //    }\n    //    appearance.recycle();\n    //}\n\n    /**\n     * Get the default {@link Locale} of the text in this TextView.\n     * @return the default {@link Locale} of the text in this TextView.\n     */\n    getTextLocale():any  {\n        return null;\n        //return this.mTextPaint.getTextLocale();\n    }\n\n    /**\n     * Set the default {@link Locale} of the text in this TextView to the given value. This value\n     * is used to choose appropriate typefaces for ambiguous characters. Typically used for CJK\n     * locales to disambiguate Hanzi/Kanji/Hanja characters.\n     *\n     * @param locale the {@link Locale} for drawing text, must not be null.\n     *\n     * @see Paint#setTextLocale\n     */\n    setTextLocale(locale:any):void  {\n        //this.mTextPaint.setTextLocale(locale);\n    }\n\n    /**\n     * @return the size (in pixels) of the default text size in this TextView.\n     */\n    getTextSize():number  {\n        return this.mTextPaint.getTextSize();\n    }\n\n    /**\n     * Set the default text size to the given value, interpreted as \"scaled\n     * pixel\" units.  This size is adjusted based on the current density and\n     * user font size preference.\n     *\n     * @param size The scaled pixel size.\n     *\n     * @attr ref android.R.styleable#TextView_textSize\n     */\n    setTextSize(size:number):void;\n\n    /**\n     * Set the default text size to a given unit and value.  See {@link\n     * TypedValue} for the possible dimension units.\n     *\n     * @param unit The desired dimension unit.\n     * @param size The desired size in the given units.\n     *\n     * @attr ref android.R.styleable#TextView_textSize\n     */\n    setTextSize(unit:string, size:number):void;\n    setTextSize(...args):void  {\n        if(args.length==1){\n            this.setTextSize(TypedValue.COMPLEX_UNIT_SP, <number>args[0]);\n            return;\n        }\n        let [unit, size] = args;\n        this.setRawTextSize(TypedValue.applyDimension(unit, size, this.getResources().getDisplayMetrics()));\n    }\n\n    protected setRawTextSize(size:number):void  {\n        if (size != this.mTextPaint.getTextSize()) {\n            this.mTextPaint.setTextSize(size);\n            if (this.mLayout != null) {\n                this.nullLayouts();\n                this.requestLayout();\n                this.invalidate();\n            }\n        }\n    }\n\n    /**\n     * @return the extent by which text is currently being stretched\n     * horizontally.  This will usually be 1.\n     */\n    getTextScaleX():number  {\n        return 1;\n        //return this.mTextPaint.getTextScaleX();\n    }\n\n    /**\n     * Sets the extent by which text should be stretched horizontally.\n     *\n     * @attr ref android.R.styleable#TextView_textScaleX\n     */\n    setTextScaleX(size:number):void  {\n        //if (size != this.mTextPaint.getTextScaleX()) {\n        //    this.mUserSetTextScaleX = true;\n        //    this.mTextPaint.setTextScaleX(size);\n        //    if (this.mLayout != null) {\n        //        this.nullLayouts();\n        //        this.requestLayout();\n        //        this.invalidate();\n        //    }\n        //}\n    }\n\n    ///**\n    // * Sets the typeface and style in which the text should be displayed.\n    // * Note that not all Typeface families actually have bold and italic\n    // * variants, so you may need to use\n    // * {@link #setTypeface(Typeface, int)} to get the appearance\n    // * that you actually want.\n    // *\n    // * @see #getTypeface()\n    // *\n    // * @attr ref android.R.styleable#TextView_fontFamily\n    // * @attr ref android.R.styleable#TextView_typeface\n    // * @attr ref android.R.styleable#TextView_textStyle\n    // */\n    //setTypeface(tf:any):void  {\n    //    if (this.mTextPaint.getTypeface() != tf) {\n    //        this.mTextPaint.setTypeface(tf);\n    //        if (this.mLayout != null) {\n    //            this.nullLayouts();\n    //            this.requestLayout();\n    //            this.invalidate();\n    //        }\n    //    }\n    //}\n\n    /**\n     * @return the current typeface and style in which the text is being\n     * displayed.\n     *\n     * @see #setTypeface(Typeface)\n     *\n     * @attr ref android.R.styleable#TextView_fontFamily\n     * @attr ref android.R.styleable#TextView_typeface\n     * @attr ref android.R.styleable#TextView_textStyle\n     */\n    getTypeface():any  {\n        return null;//TODO when Typeface impl\n        //return this.mTextPaint.getTypeface();\n    }\n\n    /**\n     * Sets the text color.\n     *\n     * @see #setTextColor(int)\n     * @see #getTextColors()\n     * @see #setHintTextColor(ColorStateList)\n     * @see #setLinkTextColor(ColorStateList)\n     *\n     * @attr ref android.R.styleable#TextView_textColor\n     */\n    setTextColor(colors:ColorStateList|number):void  {\n        if(typeof colors === 'number'){\n            colors = ColorStateList.valueOf(<number>colors);\n        }\n        if (colors == null) {\n            throw Error(`new NullPointerException()`);\n        }\n        this.mTextColor = <ColorStateList>colors;\n        this.updateTextColors();\n    }\n\n    /**\n     * Gets the text colors for the different states (normal, selected, focused) of the TextView.\n     *\n     * @see #setTextColor(ColorStateList)\n     * @see #setTextColor(int)\n     *\n     * @attr ref android.R.styleable#TextView_textColor\n     */\n    getTextColors():ColorStateList  {\n        return this.mTextColor;\n    }\n\n    /**\n     * <p>Return the current color selected for normal text.</p>\n     *\n     * @return Returns the current text color.\n     */\n    getCurrentTextColor():number  {\n        return this.mCurTextColor;\n    }\n\n    /**\n     * Sets the color used to display the selection highlight.\n     *\n     * @attr ref android.R.styleable#TextView_textColorHighlight\n     */\n    setHighlightColor(color:number):void  {\n        if (this.mHighlightColor != color) {\n            this.mHighlightColor = color;\n            this.invalidate();\n        }\n    }\n\n    /**\n     * @return the color used to display the selection highlight\n     *\n     * @see #setHighlightColor(int)\n     *\n     * @attr ref android.R.styleable#TextView_textColorHighlight\n     */\n    getHighlightColor():number  {\n        return this.mHighlightColor;\n    }\n\n    /**\n     * Sets whether the soft input method will be made visible when this\n     * TextView gets focused. The default is true.\n     * @hide\n     */\n    setShowSoftInputOnFocus(show:boolean):void  {\n        this.createEditorIfNeeded();\n        //this.mEditor.mShowSoftInputOnFocus = show;\n    }\n\n    /**\n     * Returns whether the soft input method will be made visible when this\n     * TextView gets focused. The default is true.\n     * @hide\n     */\n    getShowSoftInputOnFocus():boolean  {\n        return false;\n        // When there is no Editor, return default true value\n        //return this.mEditor == null || this.mEditor.mShowSoftInputOnFocus;\n    }\n\n    /**\n     * Gives the text a shadow of the specified radius and color, the specified\n     * distance from its normal position.\n     *\n     * @attr ref android.R.styleable#TextView_shadowColor\n     * @attr ref android.R.styleable#TextView_shadowDx\n     * @attr ref android.R.styleable#TextView_shadowDy\n     * @attr ref android.R.styleable#TextView_shadowRadius\n     */\n    setShadowLayer(radius:number, dx:number, dy:number, color:number):void  {\n        this.mTextPaint.setShadowLayer(radius, dx, dy, color);\n        this.mShadowRadius = radius;\n        this.mShadowDx = dx;\n        this.mShadowDy = dy;\n        // Will change text clip region\n        //if (this.mEditor != null)\n        //    this.mEditor.invalidateTextDisplayList();\n        this.invalidate();\n    }\n\n    /**\n     * Gets the radius of the shadow layer.\n     *\n     * @return the radius of the shadow layer. If 0, the shadow layer is not visible\n     *\n     * @see #setShadowLayer(float, float, float, int)\n     *\n     * @attr ref android.R.styleable#TextView_shadowRadius\n     */\n    getShadowRadius():number  {\n        return this.mShadowRadius;\n    }\n\n    /**\n     * @return the horizontal offset of the shadow layer\n     *\n     * @see #setShadowLayer(float, float, float, int)\n     *\n     * @attr ref android.R.styleable#TextView_shadowDx\n     */\n    getShadowDx():number  {\n        return this.mShadowDx;\n    }\n\n    /**\n     * @return the vertical offset of the shadow layer\n     *\n     * @see #setShadowLayer(float, float, float, int)\n     *\n     * @attr ref android.R.styleable#TextView_shadowDy\n     */\n    getShadowDy():number  {\n        return this.mShadowDy;\n    }\n\n    /**\n     * @return the color of the shadow layer\n     *\n     * @see #setShadowLayer(float, float, float, int)\n     *\n     * @attr ref android.R.styleable#TextView_shadowColor\n     */\n    getShadowColor():number  {\n        return this.mTextPaint.shadowColor;\n    }\n\n    /**\n     * @return the base paint used for the text.  Please use this only to\n     * consult the Paint's properties and not to change them.\n     */\n    getPaint():TextPaint  {\n        return this.mTextPaint;\n    }\n\n    /**\n     * Sets the autolink mask of the text.  See {@link\n     * android.text.util.Linkify#ALL Linkify.ALL} and peers for\n     * possible values.\n     *\n     * @attr ref android.R.styleable#TextView_autoLink\n     */\n    setAutoLinkMask(mask:number):void  {\n        this.mAutoLinkMask = mask;\n    }\n\n    /**\n     * Sets whether the movement method will automatically be set to\n     * {@link LinkMovementMethod} if {@link #setAutoLinkMask} has been\n     * set to nonzero and links are detected in {@link #setText}.\n     * The default is true.\n     *\n     * @attr ref android.R.styleable#TextView_linksClickable\n     */\n    setLinksClickable(whether:boolean):void  {\n        this.mLinksClickable = whether;\n    }\n\n    /**\n     * Returns whether the movement method will automatically be set to\n     * {@link LinkMovementMethod} if {@link #setAutoLinkMask} has been\n     * set to nonzero and links are detected in {@link #setText}.\n     * The default is true.\n     *\n     * @attr ref android.R.styleable#TextView_linksClickable\n     */\n    getLinksClickable():boolean  {\n        return this.mLinksClickable;\n    }\n\n    /**\n     * Returns the list of URLSpans attached to the text\n     * (by {@link Linkify} or otherwise) if any.  You can call\n     * {@link URLSpan#getURL} on them to find where they link to\n     * or use {@link Spanned#getSpanStart} and {@link Spanned#getSpanEnd}\n     * to find the region of the text they are attached to.\n     */\n    getUrls():any[]  {\n        //if (this.mText instanceof Spanned) {\n        //    return (<Spanned> this.mText).getSpans(0, this.mText.length(), URLSpan.class);\n        //} else {\n            return new Array<any>(0);\n        //}\n    }\n\n    /**\n     * Sets the color of the hint text.\n     *\n     * @see #getHintTextColors()\n     * @see #setHintTextColor(int)\n     * @see #setTextColor(ColorStateList)\n     * @see #setLinkTextColor(ColorStateList)\n     *\n     * @attr ref android.R.styleable#TextView_textColorHint\n     */\n    setHintTextColor(colors:ColorStateList|number):void  {\n        if(typeof colors === 'number'){\n            colors = ColorStateList.valueOf(<number>colors);\n        }\n        this.mHintTextColor = <ColorStateList>colors;\n        this.updateTextColors();\n    }\n\n    /**\n     * @return the color of the hint text, for the different states of this TextView.\n     *\n     * @see #setHintTextColor(ColorStateList)\n     * @see #setHintTextColor(int)\n     * @see #setTextColor(ColorStateList)\n     * @see #setLinkTextColor(ColorStateList)\n     *\n     * @attr ref android.R.styleable#TextView_textColorHint\n     */\n    getHintTextColors():ColorStateList  {\n        return this.mHintTextColor;\n    }\n\n    /**\n     * <p>Return the current color selected to paint the hint text.</p>\n     *\n     * @return Returns the current hint text color.\n     */\n    getCurrentHintTextColor():number  {\n        return this.mHintTextColor != null ? this.mCurHintTextColor : this.mCurTextColor;\n    }\n\n    /**\n    * Sets the color of links in the text.\n    *\n    * @see #setLinkTextColor(int)\n    * @see #getLinkTextColors()\n    * @see #setTextColor(ColorStateList)\n    * @see #setHintTextColor(ColorStateList)\n    *\n    * @attr ref android.R.styleable#TextView_textColorLink\n    */\n    setLinkTextColor(colors: number|ColorStateList): void {\n        if (typeof colors === 'number') {\n            colors = ColorStateList.valueOf(<number>colors);\n        }\n        this.mLinkTextColor = <ColorStateList>colors;\n        this.updateTextColors();\n    }\n\n    /**\n    * @return the list of colors used to paint the links in the text, for the different states of\n    * this TextView\n    *\n    * @see #setLinkTextColor(ColorStateList)\n    * @see #setLinkTextColor(int)\n    *\n    * @attr ref android.R.styleable#TextView_textColorLink\n    */\n    getLinkTextColors():ColorStateList  {\n        return this.mLinkTextColor;\n    }\n\n    /**\n     * Sets the horizontal alignment of the text and the\n     * vertical gravity that will be used when there is extra space\n     * in the TextView beyond what is required for the text itself.\n     *\n     * @see android.view.Gravity\n     * @attr ref android.R.styleable#TextView_gravity\n     */\n    setGravity(gravity:number):void  {\n        if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == 0) {\n            gravity |= Gravity.LEFT;\n        }\n        if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) {\n            gravity |= Gravity.TOP;\n        }\n        let newLayout:boolean = false;\n        if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) != (this.mGravity & Gravity.HORIZONTAL_GRAVITY_MASK)) {\n            newLayout = true;\n        }\n        if (gravity != this.mGravity) {\n            this.invalidate();\n        }\n        this.mGravity = gravity;\n        if (this.mLayout != null && newLayout) {\n            // XXX this is heavy-handed because no actual content changes.\n            let want:number = this.mLayout.getWidth();\n            let hintWant:number = this.mHintLayout == null ? 0 : this.mHintLayout.getWidth();\n            this.makeNewLayout(want, hintWant, TextView.UNKNOWN_BORING, TextView.UNKNOWN_BORING, this.mRight - this.mLeft - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight(), true);\n        }\n    }\n\n    /**\n     * Returns the horizontal and vertical alignment of this TextView.\n     *\n     * @see android.view.Gravity\n     * @attr ref android.R.styleable#TextView_gravity\n     */\n    getGravity():number  {\n        return this.mGravity;\n    }\n\n    /**\n     * @return the flags on the Paint being used to display the text.\n     * @see Paint#getFlags\n     */\n    getPaintFlags():number  {\n        return this.mTextPaint.getFlags();\n    }\n\n    /**\n     * Sets flags on the Paint being used to display the text and\n     * reflows the text if they are different from the old flags.\n     * @see Paint#setFlags\n     */\n    setPaintFlags(flags:number):void  {\n        if (this.mTextPaint.getFlags() != flags) {\n            this.mTextPaint.setFlags(flags);\n            if (this.mLayout != null) {\n                this.nullLayouts();\n                this.requestLayout();\n                this.invalidate();\n            }\n        }\n    }\n\n    /**\n     * Sets whether the text should be allowed to be wider than the\n     * View is.  If false, it will be wrapped to the width of the View.\n     *\n     * @attr ref android.R.styleable#TextView_scrollHorizontally\n     */\n    setHorizontallyScrolling(whether:boolean):void  {\n        if (this.mHorizontallyScrolling != whether) {\n            this.mHorizontallyScrolling = whether;\n            if (this.mLayout != null) {\n                this.nullLayouts();\n                this.requestLayout();\n                this.invalidate();\n            }\n        }\n    }\n\n    /**\n     * Returns whether the text is allowed to be wider than the View is.\n     * If false, the text will be wrapped to the width of the View.\n     *\n     * @attr ref android.R.styleable#TextView_scrollHorizontally\n     * @hide\n     */\n    getHorizontallyScrolling():boolean  {\n        return this.mHorizontallyScrolling;\n    }\n\n    /**\n     * Makes the TextView at least this many lines tall.\n     *\n     * Setting this value overrides any other (minimum) height setting. A single line TextView will\n     * set this value to 1.\n     *\n     * @see #getMinLines()\n     *\n     * @attr ref android.R.styleable#TextView_minLines\n     */\n    setMinLines(minlines:number):void  {\n        this.mMinimum = minlines;\n        this.mMinMode = TextView.LINES;\n        this.requestLayout();\n        this.invalidate();\n    }\n\n    /**\n     * @return the minimum number of lines displayed in this TextView, or -1 if the minimum\n     * height was set in pixels instead using {@link #setMinHeight(int) or #setHeight(int)}.\n     *\n     * @see #setMinLines(int)\n     *\n     * @attr ref android.R.styleable#TextView_minLines\n     */\n    getMinLines():number  {\n        return this.mMinMode == TextView.LINES ? this.mMinimum : -1;\n    }\n\n    /**\n     * Makes the TextView at least this many pixels tall.\n     *\n     * Setting this value overrides any other (minimum) number of lines setting.\n     *\n     * @attr ref android.R.styleable#TextView_minHeight\n     */\n    setMinHeight(minHeight:number):void  {\n        this.mMinimum = minHeight;\n        this.mMinMode = TextView.PIXELS;\n        this.requestLayout();\n        this.invalidate();\n    }\n\n    /**\n     * @return the minimum height of this TextView expressed in pixels, or -1 if the minimum\n     * height was set in number of lines instead using {@link #setMinLines(int) or #setLines(int)}.\n     *\n     * @see #setMinHeight(int)\n     *\n     * @attr ref android.R.styleable#TextView_minHeight\n     */\n    getMinHeight():number  {\n        return this.mMinMode == TextView.PIXELS ? this.mMinimum : -1;\n    }\n\n    /**\n     * Makes the TextView at most this many lines tall.\n     *\n     * Setting this value overrides any other (maximum) height setting.\n     *\n     * @attr ref android.R.styleable#TextView_maxLines\n     */\n    setMaxLines(maxlines:number):void  {\n        this.mMaximum = maxlines;\n        this.mMaxMode = TextView.LINES;\n        this.requestLayout();\n        this.invalidate();\n    }\n\n    /**\n     * @return the maximum number of lines displayed in this TextView, or -1 if the maximum\n     * height was set in pixels instead using {@link #setMaxHeight(int) or #setHeight(int)}.\n     *\n     * @see #setMaxLines(int)\n     *\n     * @attr ref android.R.styleable#TextView_maxLines\n     */\n    getMaxLines():number  {\n        return this.mMaxMode == TextView.LINES ? this.mMaximum : -1;\n    }\n\n    /**\n     * Makes the TextView at most this many pixels tall.  This option is mutually exclusive with the\n     * {@link #setMaxLines(int)} method.\n     *\n     * Setting this value overrides any other (maximum) number of lines setting.\n     *\n     * @attr ref android.R.styleable#TextView_maxHeight\n     */\n    setMaxHeight(maxHeight:number):void  {\n        this.mMaximum = maxHeight;\n        this.mMaxMode = TextView.PIXELS;\n        this.requestLayout();\n        this.invalidate();\n    }\n\n    /**\n     * @return the maximum height of this TextView expressed in pixels, or -1 if the maximum\n     * height was set in number of lines instead using {@link #setMaxLines(int) or #setLines(int)}.\n     *\n     * @see #setMaxHeight(int)\n     *\n     * @attr ref android.R.styleable#TextView_maxHeight\n     */\n    getMaxHeight():number  {\n        return this.mMaxMode == TextView.PIXELS ? this.mMaximum : -1;\n    }\n\n    /**\n     * Makes the TextView exactly this many lines tall.\n     *\n     * Note that setting this value overrides any other (minimum / maximum) number of lines or\n     * height setting. A single line TextView will set this value to 1.\n     *\n     * @attr ref android.R.styleable#TextView_lines\n     */\n    setLines(lines:number):void  {\n        this.mMaximum = this.mMinimum = lines;\n        this.mMaxMode = this.mMinMode = TextView.LINES;\n        this.requestLayout();\n        this.invalidate();\n    }\n\n    /**\n     * Makes the TextView exactly this many pixels tall.\n     * You could do the same thing by specifying this number in the\n     * LayoutParams.\n     *\n     * Note that setting this value overrides any other (minimum / maximum) number of lines or\n     * height setting.\n     *\n     * @attr ref android.R.styleable#TextView_height\n     */\n    setHeight(pixels:number):void  {\n        this.mMaximum = this.mMinimum = pixels;\n        this.mMaxMode = this.mMinMode = TextView.PIXELS;\n        this.requestLayout();\n        this.invalidate();\n    }\n\n    /**\n     * Makes the TextView at least this many ems wide\n     *\n     * @attr ref android.R.styleable#TextView_minEms\n     */\n    setMinEms(minems:number):void  {\n        this.mMinWidthValue = minems;\n        this.mMinWidthMode = TextView.EMS;\n        this.requestLayout();\n        this.invalidate();\n    }\n\n    /**\n     * @return the minimum width of the TextView, expressed in ems or -1 if the minimum width\n     * was set in pixels instead (using {@link #setMinWidth(int)} or {@link #setWidth(int)}).\n     *\n     * @see #setMinEms(int)\n     * @see #setEms(int)\n     *\n     * @attr ref android.R.styleable#TextView_minEms\n     */\n    getMinEms():number  {\n        return this.mMinWidthMode == TextView.EMS ? this.mMinWidthValue : -1;\n    }\n\n    /**\n     * Makes the TextView at least this many pixels wide\n     *\n     * @attr ref android.R.styleable#TextView_minWidth\n     */\n    setMinWidth(minpixels:number):void  {\n        this.mMinWidthValue = minpixels;\n        this.mMinWidthMode = TextView.PIXELS;\n        this.requestLayout();\n        this.invalidate();\n    }\n\n    /**\n     * @return the minimum width of the TextView, in pixels or -1 if the minimum width\n     * was set in ems instead (using {@link #setMinEms(int)} or {@link #setEms(int)}).\n     *\n     * @see #setMinWidth(int)\n     * @see #setWidth(int)\n     *\n     * @attr ref android.R.styleable#TextView_minWidth\n     */\n    getMinWidth():number  {\n        return this.mMinWidthMode == TextView.PIXELS ? this.mMinWidthValue : -1;\n    }\n\n    /**\n     * Makes the TextView at most this many ems wide\n     *\n     * @attr ref android.R.styleable#TextView_maxEms\n     */\n    setMaxEms(maxems:number):void  {\n        this.mMaxWidthValue = maxems;\n        this.mMaxWidthMode = TextView.EMS;\n        this.requestLayout();\n        this.invalidate();\n    }\n\n    /**\n     * @return the maximum width of the TextView, expressed in ems or -1 if the maximum width\n     * was set in pixels instead (using {@link #setMaxWidth(int)} or {@link #setWidth(int)}).\n     *\n     * @see #setMaxEms(int)\n     * @see #setEms(int)\n     *\n     * @attr ref android.R.styleable#TextView_maxEms\n     */\n    getMaxEms():number  {\n        return this.mMaxWidthMode == TextView.EMS ? this.mMaxWidthValue : -1;\n    }\n\n    /**\n     * Makes the TextView at most this many pixels wide\n     *\n     * @attr ref android.R.styleable#TextView_maxWidth\n     */\n    setMaxWidth(maxpixels:number):void  {\n        this.mMaxWidthValue = maxpixels;\n        this.mMaxWidthMode = TextView.PIXELS;\n        this.requestLayout();\n        this.invalidate();\n    }\n\n    /**\n     * @return the maximum width of the TextView, in pixels or -1 if the maximum width\n     * was set in ems instead (using {@link #setMaxEms(int)} or {@link #setEms(int)}).\n     *\n     * @see #setMaxWidth(int)\n     * @see #setWidth(int)\n     *\n     * @attr ref android.R.styleable#TextView_maxWidth\n     */\n    getMaxWidth():number  {\n        return this.mMaxWidthMode == TextView.PIXELS ? this.mMaxWidthValue : -1;\n    }\n\n    /**\n     * Makes the TextView exactly this many ems wide\n     *\n     * @see #setMaxEms(int)\n     * @see #setMinEms(int)\n     * @see #getMinEms()\n     * @see #getMaxEms()\n     *\n     * @attr ref android.R.styleable#TextView_ems\n     */\n    setEms(ems:number):void  {\n        this.mMaxWidthValue = this.mMinWidthValue = ems;\n        this.mMaxWidthMode = this.mMinWidthMode = TextView.EMS;\n        this.requestLayout();\n        this.invalidate();\n    }\n\n    /**\n     * Makes the TextView exactly this many pixels wide.\n     * You could do the same thing by specifying this number in the\n     * LayoutParams.\n     *\n     * @see #setMaxWidth(int)\n     * @see #setMinWidth(int)\n     * @see #getMinWidth()\n     * @see #getMaxWidth()\n     *\n     * @attr ref android.R.styleable#TextView_width\n     */\n    setWidth(pixels:number):void  {\n        this.mMaxWidthValue = this.mMinWidthValue = pixels;\n        this.mMaxWidthMode = this.mMinWidthMode = TextView.PIXELS;\n        this.requestLayout();\n        this.invalidate();\n    }\n\n    /**\n     * Sets line spacing for this TextView.  Each line will have its height\n     * multiplied by <code>mult</code> and have <code>add</code> added to it.\n     *\n     * @attr ref android.R.styleable#TextView_lineSpacingExtra\n     * @attr ref android.R.styleable#TextView_lineSpacingMultiplier\n     */\n    setLineSpacing(add:number, mult:number):void  {\n        if (this.mSpacingAdd != add || this.mSpacingMult != mult) {\n            this.mSpacingAdd = add;\n            this.mSpacingMult = mult;\n            if (this.mLayout != null) {\n                this.nullLayouts();\n                this.requestLayout();\n                this.invalidate();\n            }\n        }\n    }\n\n    /**\n     * Gets the line spacing multiplier\n     *\n     * @return the value by which each line's height is multiplied to get its actual height.\n     *\n     * @see #setLineSpacing(float, float)\n     * @see #getLineSpacingExtra()\n     *\n     * @attr ref android.R.styleable#TextView_lineSpacingMultiplier\n     */\n    getLineSpacingMultiplier():number  {\n        return this.mSpacingMult;\n    }\n\n    /**\n     * Gets the line spacing extra space\n     *\n     * @return the extra space that is added to the height of each lines of this TextView.\n     *\n     * @see #setLineSpacing(float, float)\n     * @see #getLineSpacingMultiplier()\n     *\n     * @attr ref android.R.styleable#TextView_lineSpacingExtra\n     */\n    getLineSpacingExtra():number  {\n        return this.mSpacingAdd;\n    }\n\n    ///**\n    // * Convenience method: Append the specified text slice to the TextView's\n    // * display buffer, upgrading it to TextView.BufferType.EDITABLE if it was\n    // * not already editable.\n    // */\n    //append(text:String, start=0, end=text.length):void  {\n    //    if (!(this.mText instanceof Editable)) {\n    //        this.setText(this.mText, TextView.BufferType.EDITABLE);\n    //    }\n    //    (<Editable> this.mText).append(text, start, end);\n    //}\n\n    protected updateTextColors():void  {\n        let inval:boolean = false;\n        let color:number = this.mTextColor.getColorForState(this.getDrawableState(), 0);\n        if (color != this.mCurTextColor) {\n            this.mCurTextColor = color;\n            inval = true;\n        }\n        if (this.mLinkTextColor != null) {\n            color = this.mLinkTextColor.getColorForState(this.getDrawableState(), 0);\n            if (color != this.mTextPaint.linkColor) {\n                this.mTextPaint.linkColor = color;\n                inval = true;\n            }\n        }\n        if (this.mHintTextColor != null) {\n            color = this.mHintTextColor.getColorForState(this.getDrawableState(), 0);\n            if (color != this.mCurHintTextColor && this.mText.length == 0) {\n                this.mCurHintTextColor = color;\n                inval = true;\n            }\n        }\n        if (inval) {\n            // Text needs to be redrawn with the new color\n            //if (this.mEditor != null)\n            //    this.mEditor.invalidateTextDisplayList();\n            this.invalidate();\n        }\n    }\n\n    protected drawableStateChanged():void  {\n        super.drawableStateChanged();\n        if (this.mTextColor != null && this.mTextColor.isStateful() || (this.mHintTextColor != null && this.mHintTextColor.isStateful()) || (this.mLinkTextColor != null && this.mLinkTextColor.isStateful())) {\n            this.updateTextColors();\n        }\n        const dr:TextView.Drawables = this.mDrawables;\n        if (dr != null) {\n            let state:number[] = this.getDrawableState();\n            if (dr.mDrawableTop != null && dr.mDrawableTop.isStateful()) {\n                dr.mDrawableTop.setState(state);\n            }\n            if (dr.mDrawableBottom != null && dr.mDrawableBottom.isStateful()) {\n                dr.mDrawableBottom.setState(state);\n            }\n            if (dr.mDrawableLeft != null && dr.mDrawableLeft.isStateful()) {\n                dr.mDrawableLeft.setState(state);\n            }\n            if (dr.mDrawableRight != null && dr.mDrawableRight.isStateful()) {\n                dr.mDrawableRight.setState(state);\n            }\n            if (dr.mDrawableStart != null && dr.mDrawableStart.isStateful()) {\n                dr.mDrawableStart.setState(state);\n            }\n            if (dr.mDrawableEnd != null && dr.mDrawableEnd.isStateful()) {\n                dr.mDrawableEnd.setState(state);\n            }\n        }\n    }\n\n    //onSaveInstanceState():Parcelable  {\n    //    let superState:Parcelable = super.onSaveInstanceState();\n    //    // Save state if we are forced to\n    //    let save:boolean = this.mFreezesText;\n    //    let start:number = 0;\n    //    let end:number = 0;\n    //    if (this.mText != null) {\n    //        start = this.getSelectionStart();\n    //        end = this.getSelectionEnd();\n    //        if (start >= 0 || end >= 0) {\n    //            // Or save state if there is a selection\n    //            save = true;\n    //        }\n    //    }\n    //    if (save) {\n    //        let ss:TextView.SavedState = new TextView.SavedState(superState);\n    //        // XXX Should also save the current scroll position!\n    //        ss.selStart = start;\n    //        ss.selEnd = end;\n    //        if (this.mText instanceof Spanned) {\n    //            let sp:Spannable = new SpannableStringBuilder(this.mText);\n    //            if (this.mEditor != null) {\n    //                this.removeMisspelledSpans(sp);\n    //                sp.removeSpan(this.mEditor.mSuggestionRangeSpan);\n    //            }\n    //            ss.text = sp;\n    //        } else {\n    //            ss.text = this.mText.toString();\n    //        }\n    //        if (this.isFocused() && start >= 0 && end >= 0) {\n    //            ss.frozenWithFocus = true;\n    //        }\n    //        ss.error = this.getError();\n    //        return ss;\n    //    }\n    //    return superState;\n    //}\n\n    removeMisspelledSpans(spannable:Spannable):void  {\n        //let suggestionSpans:SuggestionSpan[] = spannable.getSpans(0, spannable.length(), SuggestionSpan.class);\n        //for (let i:number = 0; i < suggestionSpans.length; i++) {\n        //    let flags:number = suggestionSpans[i].getFlags();\n        //    if ((flags & SuggestionSpan.FLAG_EASY_CORRECT) != 0 && (flags & SuggestionSpan.FLAG_MISSPELLED) != 0) {\n        //        spannable.removeSpan(suggestionSpans[i]);\n        //    }\n        //}\n    }\n\n    //onRestoreInstanceState(state:Parcelable):void  {\n    //    if (!(state instanceof TextView.SavedState)) {\n    //        super.onRestoreInstanceState(state);\n    //        return;\n    //    }\n    //    let ss:TextView.SavedState = <TextView.SavedState> state;\n    //    super.onRestoreInstanceState(ss.getSuperState());\n    //    // XXX restore buffer type too, as well as lots of other stuff\n    //    if (ss.text != null) {\n    //        this.setText(ss.text);\n    //    }\n    //    if (ss.selStart >= 0 && ss.selEnd >= 0) {\n    //        if (this.mText instanceof Spannable) {\n    //            let len:number = this.mText.length();\n    //            if (ss.selStart > len || ss.selEnd > len) {\n    //                let restored:string = \"\";\n    //                if (ss.text != null) {\n    //                    restored = \"(restored) \";\n    //                }\n    //                Log.e(TextView.LOG_TAG, \"Saved cursor position \" + ss.selStart + \"/\" + ss.selEnd + \" out of range for \" + restored + \"text \" + this.mText);\n    //            } else {\n    //                Selection.setSelection(<Spannable> this.mText, ss.selStart, ss.selEnd);\n    //                if (ss.frozenWithFocus) {\n    //                    this.createEditorIfNeeded();\n    //                    this.mEditor.mFrozenWithFocus = true;\n    //                }\n    //            }\n    //        }\n    //    }\n    //    if (ss.error != null) {\n    //        const error:CharSequence = ss.error;\n    //        // Display the error later, after the first layout pass\n    //        this.post((()=>{\n    //            const inner_this=this;\n    //            class _Inner extends Runnable {\n    //\n    //                run():void  {\n    //                    inner_this.setError(error);\n    //                }\n    //            }\n    //            return new _Inner();\n    //        })());\n    //    }\n    //}\n\n    /**\n     * Control whether this text view saves its entire text contents when\n     * freezing to an icicle, in addition to dynamic state such as cursor\n     * position.  By default this is false, not saving the text.  Set to true\n     * if the text in the text view is not being saved somewhere else in\n     * persistent storage (such as in a content provider) so that if the\n     * view is later thawed the user will not lose their data.\n     *\n     * @param freezesText Controls whether a frozen icicle should include the\n     * entire text data: true to include it, false to not.\n     *\n     * @attr ref android.R.styleable#TextView_freezesText\n     */\n    setFreezesText(freezesText:boolean):void  {\n        this.mFreezesText = freezesText;\n    }\n\n    /**\n     * Return whether this text view is including its entire text contents\n     * in frozen icicles.\n     *\n     * @return Returns true if text is included, false if it isn't.\n     *\n     * @see #setFreezesText\n     */\n    getFreezesText():boolean  {\n        return this.mFreezesText;\n    }\n\n    ///////////////////////////////////////////////////////////////////////////\n    ///**\n    // * Sets the Factory used to create new Editables.\n    // */\n    //setEditableFactory(factory:Editable.Factory):void  {\n    //    this.mEditableFactory = factory;\n    //    this.setText(this.mText);\n    //}\n\n    /**\n     * Sets the Factory used to create new Spannables.\n     */\n    setSpannableFactory(factory:Spannable.Factory):void  {\n        this.mSpannableFactory = factory;\n        this.setText(this.mText);\n    }\n\n    /**\n     * Like {@link #setText(CharSequence)},\n     * except that the cursor position (if any) is retained in the new text.\n     *\n     * @param text The new text to place in the text view.\n     *\n     * @see #setText(CharSequence)\n     */\n    //setTextKeepState(text:CharSequence):void  {\n    //    this.setTextKeepState(text, this.mBufferType);\n    //}\n\n    setText(text:String, type=this.mBufferType, notifyBefore=true, oldlen=0):void  {\n        if (text == null) {\n            text = \"\";\n        }\n        // If suggestions are not enabled, remove the suggestion spans from the text\n        if (!this.isSuggestionsEnabled()) {\n            text = this.removeSuggestionSpans(text);\n        }\n        //if (!this.mUserSetTextScaleX) this.mTextPaint.setTextScaleX(1.0);\n        if (Spanned.isImplements(text) && (<Spanned> text).getSpanStart(TextUtils.TruncateAt.MARQUEE) >= 0) {\n            //if (ViewConfiguration.get().isFadingMarqueeEnabled()) {\n                this.setHorizontalFadingEdgeEnabled(true);\n                this.mMarqueeFadeMode = TextView.MARQUEE_FADE_NORMAL;\n            //} else {\n            //    this.setHorizontalFadingEdgeEnabled(false);\n            //    this.mMarqueeFadeMode = TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS;\n            //}\n            this.setEllipsize(TextUtils.TruncateAt.MARQUEE);\n        }\n        //let n:number = this.mFilters.length;//TODO when filter impl\n        //for (let i:number = 0; i < n; i++) {\n        //    let out:CharSequence = this.mFilters[i].filter(text, 0, text.length(), TextView.EMPTY_SPANNED, 0, 0);\n        //    if (out != null) {\n        //        text = out;\n        //    }\n        //}\n        if (notifyBefore) {\n            if (this.mText != null) {\n                oldlen = this.mText.length;\n                this.sendBeforeTextChanged(this.mText, 0, oldlen, text.length);\n            } else {\n                this.sendBeforeTextChanged(\"\", 0, 0, text.length);\n            }\n        }\n        let needEditableForNotification:boolean = false;\n        if (this.mListeners != null && this.mListeners.size() != 0) {\n            needEditableForNotification = true;\n        }\n        //if (type == TextView.BufferType.EDITABLE || this.getKeyListener() != null || needEditableForNotification) {\n        //    this.createEditorIfNeeded();\n        //    let t:Editable = this.mEditableFactory.newEditable(text);\n        //    text = t;\n        //    this.setFilters(t, this.mFilters);\n        //    let imm:InputMethodManager = InputMethodManager.peekInstance();\n        //    if (imm != null)\n        //        imm.restartInput(this);\n        //\n        // } else\n        if (type == TextView.BufferType.SPANNABLE || this.mMovement != null) {\n            text = this.mSpannableFactory.newSpannable(text);\n        }\n        //else if (!(text instanceof TextView.CharWrapper)) {\n        //    text = TextUtils.stringOrSpannedString(text);\n        //}\n        //if (this.mAutoLinkMask != 0) {\n        //    let s2:Spannable;\n        //    if (type == TextView.BufferType.EDITABLE || text instanceof Spannable) {\n        //        s2 = <Spannable> text;\n        //    } else {\n        //        s2 = this.mSpannableFactory.newSpannable(text);\n        //    }\n        //    if (Linkify.addLinks(s2, this.mAutoLinkMask)) {\n        //        text = s2;\n        //        type = (type == TextView.BufferType.EDITABLE) ? TextView.BufferType.EDITABLE : TextView.BufferType.SPANNABLE;\n        //        /*\n        //         * We must go ahead and set the text before changing the\n        //         * movement method, because setMovementMethod() may call\n        //         * setText() again to try to upgrade the buffer type.\n        //         */\n        //        this.mText = text;\n        //        // would prevent an arbitrary cursor displacement.\n        //        if (this.mLinksClickable && !this.textCanBeSelected()) {\n        //            this.setMovementMethod(LinkMovementMethod.getInstance());\n        //        }\n        //    }\n        //}\n        this.mBufferType = type;\n        this.mText = text;\n        if (this.mTransformation == null) {\n            this.mTransformed = text;\n        } else {\n            this.mTransformed = this.mTransformation.getTransformation(text, this);\n        }\n        const textLength:number = text.length;\n        //if (Spannable.isImpl(text) && !this.mAllowTransformationLengthChange) {\n        //    let sp:Spannable = <Spannable> text;\n        //    // Remove any ChangeWatchers that might have come from other TextViews.\n        //    const watchers:TextView.ChangeWatcher[] = sp.getSpans(0, sp.length, TextView.ChangeWatcher.type);\n        //    const count:number = watchers.length;\n        //    for (let i:number = 0; i < count; i++) {\n        //        sp.removeSpan(watchers[i]);\n        //    }\n        //    if (this.mChangeWatcher == null)\n        //        this.mChangeWatcher = new TextView.ChangeWatcher(this);\n        //    sp.setSpan(this.mChangeWatcher, 0, textLength, Spanned.SPAN_INCLUSIVE_INCLUSIVE | (TextView.CHANGE_WATCHER_PRIORITY << Spanned.SPAN_PRIORITY_SHIFT));\n        //    //if (this.mEditor != null) this.mEditor.addSpanWatchers(sp);\n        //    if (this.mTransformation != null) {\n        //        sp.setSpan(this.mTransformation, 0, textLength, Spanned.SPAN_INCLUSIVE_INCLUSIVE);\n        //    }\n        //    if (this.mMovement != null) {\n        //        this.mMovement.initialize(this, <Spannable> text);\n        //        /*\n        //         * Initializing the movement method will have set the\n        //         * selection, so reset mSelectionMoved to keep that from\n        //         * interfering with the normal on-focus selection-setting.\n        //         */\n        //        //if (this.mEditor != null)\n        //        //    this.mEditor.mSelectionMoved = false;\n        //    }\n        //}\n        if (this.mLayout != null) {\n            this.checkForRelayout();\n        }\n        this.sendOnTextChanged(text, 0, oldlen, textLength);\n        this.onTextChanged(text, 0, oldlen, textLength);\n        //this.notifyViewAccessibilityStateChangedIfNeeded(AccessibilityEvent.CONTENT_CHANGE_TYPE_TEXT);\n        //if (needEditableForNotification) {\n        //    this.sendAfterTextChanged(<Editable> text);\n        //}\n        // SelectionModifierCursorController depends on textCanBeSelected, which depends on text\n        //if (this.mEditor != null)\n        //    this.mEditor.prepareCursorControllers();\n    }\n\n    /**\n     * Sets the TextView to display the specified slice of the specified\n     * char array.  You must promise that you will not change the contents\n     * of the array except for right before another call to setText(),\n     * since the TextView has no way to know that the text\n     * has changed and that it needs to invalidate and re-layout.\n     */\n    //setText(text:string[], start:number, len:number):void  {\n    //    let oldlen:number = 0;\n    //    if (start < 0 || len < 0 || start + len > text.length) {\n    //        throw Error(`new IndexOutOfBoundsException(start + \", \" + len)`);\n    //    }\n    //    /*\n    //     * We must do the before-notification here ourselves because if\n    //     * the old text is a CharWrapper we destroy it before calling\n    //     * into the normal path.\n    //     */\n    //    if (this.mText != null) {\n    //        oldlen = this.mText.length();\n    //        this.sendBeforeTextChanged(this.mText, 0, oldlen, len);\n    //    } else {\n    //        this.sendBeforeTextChanged(\"\", 0, 0, len);\n    //    }\n    //    if (this.mCharWrapper == null) {\n    //        this.mCharWrapper = new TextView.CharWrapper(text, start, len);\n    //    } else {\n    //        this.mCharWrapper.set(text, start, len);\n    //    }\n    //    this.setText(this.mCharWrapper, this.mBufferType, false, oldlen);\n    //}\n\n    ///**\n    // * Like {@link #setText(CharSequence, android.widget.TextView.BufferType)},\n    // * except that the cursor position (if any) is retained in the new text.\n    // *\n    // * @see #setText(CharSequence, android.widget.TextView.BufferType)\n    // */\n    //setTextKeepState(text:CharSequence, type:TextView.BufferType):void  {\n    //    let start:number = this.getSelectionStart();\n    //    let end:number = this.getSelectionEnd();\n    //    let len:number = text.length();\n    //    this.setText(text, type);\n    //    if (start >= 0 || end >= 0) {\n    //        if (this.mText instanceof Spannable) {\n    //            Selection.setSelection(<Spannable> this.mText, Math.max(0, Math.min(start, len)), Math.max(0, Math.min(end, len)));\n    //        }\n    //    }\n    //}\n\n    /**\n     * Sets the text to be displayed when the text of the TextView is empty.\n     * Null means to use the normal empty text. The hint does not currently\n     * participate in determining the size of the view.\n     *\n     * @attr ref android.R.styleable#TextView_hint\n     */\n    setHint(hint:String):void  {\n        this.mHint = hint;//TextUtils.stringOrSpannedString(hint);\n        if (this.mLayout != null) {\n            this.checkForRelayout();\n        }\n        if (this.mText.length == 0) {\n            this.invalidate();\n        }\n        // Invalidate display list if hint is currently used\n        //if (this.mEditor != null && this.mText.length() == 0 && this.mHint != null) {\n        //    this.mEditor.invalidateTextDisplayList();\n        //}\n    }\n\n    /**\n     * Returns the hint that is displayed when the text of the TextView\n     * is empty.\n     *\n     * @attr ref android.R.styleable#TextView_hint\n     */\n    getHint():String  {\n        return this.mHint;\n    }\n\n    isSingleLine():boolean  {\n        return this.mSingleLine;\n    }\n\n    private static isMultilineInputType(type:number):boolean  {\n        return true;\n        //return (type & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE)) == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE);\n    }\n\n    /**\n     * Removes the suggestion spans.\n     */\n    removeSuggestionSpans(text:String):String  {\n        //if (text instanceof Spanned) {\n        //    let spannable:Spannable;\n        //    if (text instanceof Spannable) {\n        //        spannable = <Spannable> text;\n        //    } else {\n        //        spannable = new SpannableString(text);\n        //        text = spannable;\n        //    }\n        //    let spans:SuggestionSpan[] = spannable.getSpans(0, text.length(), SuggestionSpan.class);\n        //    for (let i:number = 0; i < spans.length; i++) {\n        //        spannable.removeSpan(spans[i]);\n        //    }\n        //}\n        return text;\n    }\n\n    ///**\n    // * Set the type of the content with a constant as defined for {@link EditorInfo#inputType}. This\n    // * will take care of changing the key listener, by calling {@link #setKeyListener(KeyListener)},\n    // * to match the given content type.  If the given content type is {@link EditorInfo#TYPE_NULL}\n    // * then a soft keyboard will not be displayed for this text view.\n    // *\n    // * Note that the maximum number of displayed lines (see {@link #setMaxLines(int)}) will be\n    // * modified if you change the {@link EditorInfo#TYPE_TEXT_FLAG_MULTI_LINE} flag of the input\n    // * type.\n    // *\n    // * @see #getInputType()\n    // * @see #setRawInputType(int)\n    // * @see android.text.InputType\n    // * @attr ref android.R.styleable#TextView_inputType\n    // */\n    //setInputType(type:number):void  {\n    //    const wasPassword:boolean = TextView.isPasswordInputType(this.getInputType());\n    //    const wasVisiblePassword:boolean = TextView.isVisiblePasswordInputType(this.getInputType());\n    //    this.setInputType(type, false);\n    //    const isPassword:boolean = TextView.isPasswordInputType(type);\n    //    const isVisiblePassword:boolean = TextView.isVisiblePasswordInputType(type);\n    //    let forceUpdate:boolean = false;\n    //    if (isPassword) {\n    //        this.setTransformationMethod(PasswordTransformationMethod.getInstance());\n    //        this.setTypefaceFromAttrs(null, /* fontFamily */\n    //        TextView.MONOSPACE, 0);\n    //    } else if (isVisiblePassword) {\n    //        if (this.mTransformation == PasswordTransformationMethod.getInstance()) {\n    //            forceUpdate = true;\n    //        }\n    //        this.setTypefaceFromAttrs(null, /* fontFamily */\n    //        TextView.MONOSPACE, 0);\n    //    } else if (wasPassword || wasVisiblePassword) {\n    //        // not in password mode, clean up typeface and transformation\n    //        this.setTypefaceFromAttrs(null, /* fontFamily */\n    //        -1, -1);\n    //        if (this.mTransformation == PasswordTransformationMethod.getInstance()) {\n    //            forceUpdate = true;\n    //        }\n    //    }\n    //    let singleLine:boolean = !TextView.isMultilineInputType(type);\n    //    // were previously in password mode.\n    //    if (this.mSingleLine != singleLine || forceUpdate) {\n    //        // Change single line mode, but only change the transformation if\n    //        // we are not in password mode.\n    //        this.applySingleLine(singleLine, !isPassword, true);\n    //    }\n    //    if (!this.isSuggestionsEnabled()) {\n    //        this.mText = this.removeSuggestionSpans(this.mText);\n    //    }\n    //    let imm:InputMethodManager = InputMethodManager.peekInstance();\n    //    if (imm != null)\n    //        imm.restartInput(this);\n    //}\n\n    /**\n     * It would be better to rely on the input type for everything. A password inputType should have\n     * a password transformation. We should hence use isPasswordInputType instead of this method.\n     *\n     * We should:\n     * - Call setInputType in setKeyListener instead of changing the input type directly (which\n     * would install the correct transformation).\n     * - Refuse the installation of a non-password transformation in setTransformation if the input\n     * type is password.\n     *\n     * However, this is like this for legacy reasons and we cannot break existing apps. This method\n     * is useful since it matches what the user can see (obfuscated text or not).\n     *\n     * @return true if the current transformation method is of the password type.\n     */\n    private hasPasswordTransformationMethod():boolean  {\n        return false;\n        //return this.mTransformation instanceof PasswordTransformationMethod;\n    }\n\n    private static isPasswordInputType(inputType:number):boolean  {\n        return false;\n        //const variation:number = inputType & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_MASK_VARIATION);\n        //return variation == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD) || variation == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_WEB_PASSWORD) || variation == (EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_VARIATION_PASSWORD);\n    }\n\n    private static isVisiblePasswordInputType(inputType:number):boolean  {\n        return true;\n        //const variation:number = inputType & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_MASK_VARIATION);\n        //return variation == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);\n    }\n\n    /**\n     * Directly change the content type integer of the text view, without\n     * modifying any other state.\n     * @see #setInputType(int)\n     * @see android.text.InputType\n     * @attr ref android.R.styleable#TextView_inputType\n     */\n    setRawInputType(type:number):void  {\n        //TYPE_NULL is the default value\n        //if (type == InputType.TYPE_NULL && this.mEditor == null)\n        //    return;\n        //this.createEditorIfNeeded();\n        //this.mEditor.mInputType = type;\n    }\n\n    setInputType(type:number, direct:boolean=false):void  {\n        //const cls:number = type & EditorInfo.TYPE_MASK_CLASS;\n        //let input:KeyListener;\n        //if (cls == EditorInfo.TYPE_CLASS_TEXT) {\n        //    let autotext:boolean = (type & EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT) != 0;\n        //    let cap:TextKeyListener.Capitalize;\n        //    if ((type & EditorInfo.TYPE_TEXT_FLAG_CAP_CHARACTERS) != 0) {\n        //        cap = TextKeyListener.Capitalize.CHARACTERS;\n        //    } else if ((type & EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS) != 0) {\n        //        cap = TextKeyListener.Capitalize.WORDS;\n        //    } else if ((type & EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES) != 0) {\n        //        cap = TextKeyListener.Capitalize.SENTENCES;\n        //    } else {\n        //        cap = TextKeyListener.Capitalize.NONE;\n        //    }\n        //    input = TextKeyListener.getInstance(autotext, cap);\n        //} else if (cls == EditorInfo.TYPE_CLASS_NUMBER) {\n        //    input = DigitsKeyListener.getInstance((type & EditorInfo.TYPE_NUMBER_FLAG_SIGNED) != 0, (type & EditorInfo.TYPE_NUMBER_FLAG_DECIMAL) != 0);\n        //} else if (cls == EditorInfo.TYPE_CLASS_DATETIME) {\n        //    switch(type & EditorInfo.TYPE_MASK_VARIATION) {\n        //        case EditorInfo.TYPE_DATETIME_VARIATION_DATE:\n        //            input = DateKeyListener.getInstance();\n        //            break;\n        //        case EditorInfo.TYPE_DATETIME_VARIATION_TIME:\n        //            input = TimeKeyListener.getInstance();\n        //            break;\n        //        default:\n        //            input = DateTimeKeyListener.getInstance();\n        //            break;\n        //    }\n        //} else if (cls == EditorInfo.TYPE_CLASS_PHONE) {\n        //    input = DialerKeyListener.getInstance();\n        //} else {\n        //    input = TextKeyListener.getInstance();\n        //}\n        //this.setRawInputType(type);\n        //if (direct) {\n        //    this.createEditorIfNeeded();\n        //    this.mEditor.mKeyListener = input;\n        //} else {\n        //    this.setKeyListenerOnly(input);\n        //}\n    }\n\n    /**\n     * Get the type of the editable content.\n     *\n     * @see #setInputType(int)\n     * @see android.text.InputType\n     */\n    getInputType():number  {\n        return 0;\n        //return this.mEditor == null ? EditorInfo.TYPE_NULL : this.mEditor.mInputType;\n    }\n\n    /**\n     * Change the editor type integer associated with the text view, which\n     * will be reported to an IME with {@link EditorInfo#imeOptions} when it\n     * has focus.\n     * @see #getImeOptions\n     * @see android.view.inputmethod.EditorInfo\n     * @attr ref android.R.styleable#TextView_imeOptions\n     */\n    setImeOptions(imeOptions:number):void  {\n        //this.createEditorIfNeeded();\n        //this.mEditor.createInputContentTypeIfNeeded();\n        //this.mEditor.mInputContentType.imeOptions = imeOptions;\n    }\n\n    /**\n     * Get the type of the IME editor.\n     *\n     * @see #setImeOptions(int)\n     * @see android.view.inputmethod.EditorInfo\n     */\n    getImeOptions():number  {\n        return -1;\n        //return this.mEditor != null && this.mEditor.mInputContentType != null ? this.mEditor.mInputContentType.imeOptions : EditorInfo.IME_NULL;\n    }\n\n    /**\n     * Change the custom IME action associated with the text view, which\n     * will be reported to an IME with {@link EditorInfo#actionLabel}\n     * and {@link EditorInfo#actionId} when it has focus.\n     * @see #getImeActionLabel\n     * @see #getImeActionId\n     * @see android.view.inputmethod.EditorInfo\n     * @attr ref android.R.styleable#TextView_imeActionLabel\n     * @attr ref android.R.styleable#TextView_imeActionId\n     */\n    setImeActionLabel(label:String, actionId:number):void  {\n        this.createEditorIfNeeded();\n        //this.mEditor.createInputContentTypeIfNeeded();\n        //this.mEditor.mInputContentType.imeActionLabel = label;\n        //this.mEditor.mInputContentType.imeActionId = actionId;\n    }\n\n    /**\n     * Get the IME action label previous set with {@link #setImeActionLabel}.\n     *\n     * @see #setImeActionLabel\n     * @see android.view.inputmethod.EditorInfo\n     */\n    getImeActionLabel():String  {\n        return '';\n        //return this.mEditor != null && this.mEditor.mInputContentType != null ? this.mEditor.mInputContentType.imeActionLabel : null;\n    }\n\n    /**\n     * Get the IME action ID previous set with {@link #setImeActionLabel}.\n     *\n     * @see #setImeActionLabel\n     * @see android.view.inputmethod.EditorInfo\n     */\n    getImeActionId():number  {\n        return 0;\n        //return this.mEditor != null && this.mEditor.mInputContentType != null ? this.mEditor.mInputContentType.imeActionId : 0;\n    }\n\n    /**\n     * Set a special listener to be called when an action is performed\n     * on the text view.  This will be called when the enter key is pressed,\n     * or when an action supplied to the IME is selected by the user.  Setting\n     * this means that the normal hard key event will not insert a newline\n     * into the text view, even if it is multi-line; holding down the ALT\n     * modifier will, however, allow the user to insert a newline character.\n     */\n    setOnEditorActionListener(l:TextView.OnEditorActionListener):void  {\n        this.createEditorIfNeeded();\n        //this.mEditor.createInputContentTypeIfNeeded();\n        //this.mEditor.mInputContentType.onEditorActionListener = l;\n    }\n\n    /**\n     * Called when an attached input method calls\n     * {@link InputConnection#performEditorAction(int)\n     * InputConnection.performEditorAction()}\n     * for this text view.  The default implementation will call your action\n     * listener supplied to {@link #setOnEditorActionListener}, or perform\n     * a standard operation for {@link EditorInfo#IME_ACTION_NEXT\n     * EditorInfo.IME_ACTION_NEXT}, {@link EditorInfo#IME_ACTION_PREVIOUS\n     * EditorInfo.IME_ACTION_PREVIOUS}, or {@link EditorInfo#IME_ACTION_DONE\n     * EditorInfo.IME_ACTION_DONE}.\n     *\n     * <p>For backwards compatibility, if no IME options have been set and the\n     * text view would not normally advance focus on enter, then\n     * the NEXT and DONE actions received here will be turned into an enter\n     * key down/up pair to go through the normal key handling.\n     *\n     * @param actionCode The code of the action being performed.\n     *\n     * @see #setOnEditorActionListener\n     */\n    //onEditorAction(actionCode:number):void  {\n    //    const ict:Editor.InputContentType = this.mEditor == null ? null : this.mEditor.mInputContentType;\n    //    if (ict != null) {\n    //        if (ict.onEditorActionListener != null) {\n    //            if (ict.onEditorActionListener.onEditorAction(this, actionCode, null)) {\n    //                return;\n    //            }\n    //        }\n    //        // app may be expecting.\n    //        if (actionCode == EditorInfo.IME_ACTION_NEXT) {\n    //            let v:View = this.focusSearch(TextView.FOCUS_FORWARD);\n    //            if (v != null) {\n    //                if (!v.requestFocus(TextView.FOCUS_FORWARD)) {\n    //                    throw Error(`new IllegalStateException(\"focus search returned a view \" + \"that wasn't able to take focus!\")`);\n    //                }\n    //            }\n    //            return;\n    //        } else if (actionCode == EditorInfo.IME_ACTION_PREVIOUS) {\n    //            let v:View = this.focusSearch(TextView.FOCUS_BACKWARD);\n    //            if (v != null) {\n    //                if (!v.requestFocus(TextView.FOCUS_BACKWARD)) {\n    //                    throw Error(`new IllegalStateException(\"focus search returned a view \" + \"that wasn't able to take focus!\")`);\n    //                }\n    //            }\n    //            return;\n    //        } else if (actionCode == EditorInfo.IME_ACTION_DONE) {\n    //            let imm:InputMethodManager = InputMethodManager.peekInstance();\n    //            if (imm != null && imm.isActive(this)) {\n    //                imm.hideSoftInputFromWindow(this.getWindowToken(), 0);\n    //            }\n    //            return;\n    //        }\n    //    }\n    //    let viewRootImpl:ViewRootImpl = this.getViewRootImpl();\n    //    if (viewRootImpl != null) {\n    //        let eventTime:number = SystemClock.uptimeMillis();\n    //        viewRootImpl.dispatchKeyFromIme(new KeyEvent(eventTime, eventTime, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER, 0, 0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE | KeyEvent.FLAG_EDITOR_ACTION));\n    //        viewRootImpl.dispatchKeyFromIme(new KeyEvent(SystemClock.uptimeMillis(), eventTime, KeyEvent.ACTION_UP, KeyEvent.KEYCODE_ENTER, 0, 0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE | KeyEvent.FLAG_EDITOR_ACTION));\n    //    }\n    //}\n\n    ///**\n    // * Set the private content type of the text, which is the\n    // * {@link EditorInfo#privateImeOptions EditorInfo.privateImeOptions}\n    // * field that will be filled in when creating an input connection.\n    // *\n    // * @see #getPrivateImeOptions()\n    // * @see EditorInfo#privateImeOptions\n    // * @attr ref android.R.styleable#TextView_privateImeOptions\n    // */\n    //setPrivateImeOptions(type:string):void  {\n    //    this.createEditorIfNeeded();\n    //    this.mEditor.createInputContentTypeIfNeeded();\n    //    this.mEditor.mInputContentType.privateImeOptions = type;\n    //}\n    //\n    ///**\n    // * Get the private type of the content.\n    // *\n    // * @see #setPrivateImeOptions(String)\n    // * @see EditorInfo#privateImeOptions\n    // */\n    //getPrivateImeOptions():string  {\n    //    return this.mEditor != null && this.mEditor.mInputContentType != null ? this.mEditor.mInputContentType.privateImeOptions : null;\n    //}\n    //\n    ///**\n    // * Set the extra input data of the text, which is the\n    // * {@link EditorInfo#extras TextBoxAttribute.extras}\n    // * Bundle that will be filled in when creating an input connection.  The\n    // * given integer is the resource ID of an XML resource holding an\n    // * {@link android.R.styleable#InputExtras &lt;input-extras&gt;} XML tree.\n    // *\n    // * @see #getInputExtras(boolean)\n    // * @see EditorInfo#extras\n    // * @attr ref android.R.styleable#TextView_editorExtras\n    // */\n    //setInputExtras(xmlResId:number):void  {\n    //    this.createEditorIfNeeded();\n    //    let parser:XmlResourceParser = this.getResources().getXml(xmlResId);\n    //    this.mEditor.createInputContentTypeIfNeeded();\n    //    this.mEditor.mInputContentType.extras = new Bundle();\n    //    this.getResources().parseBundleExtras(parser, this.mEditor.mInputContentType.extras);\n    //}\n    //\n    ///**\n    // * Retrieve the input extras currently associated with the text view, which\n    // * can be viewed as well as modified.\n    // *\n    // * @param create If true, the extras will be created if they don't already\n    // * exist.  Otherwise, null will be returned if none have been created.\n    // * @see #setInputExtras(int)\n    // * @see EditorInfo#extras\n    // * @attr ref android.R.styleable#TextView_editorExtras\n    // */\n    //getInputExtras(create:boolean):any  {\n    //    if (this.mEditor == null && !create)\n    //        return null;\n    //    this.createEditorIfNeeded();\n    //    if (this.mEditor.mInputContentType == null) {\n    //        if (!create)\n    //            return null;\n    //        this.mEditor.createInputContentTypeIfNeeded();\n    //    }\n    //    if (this.mEditor.mInputContentType.extras == null) {\n    //        if (!create)\n    //            return null;\n    //        this.mEditor.mInputContentType.extras = new Bundle();\n    //    }\n    //    return this.mEditor.mInputContentType.extras;\n    //}\n    //\n    ///**\n    // * Returns the error message that was set to be displayed with\n    // * {@link #setError}, or <code>null</code> if no error was set\n    // * or if it the error was cleared by the widget after user input.\n    // */\n    //getError():String  {\n    //    return this.mEditor == null ? null : this.mEditor.mError;\n    //}\n    //\n    ///**\n    // * Sets the right-hand compound drawable of the TextView to the specified\n    // * icon and sets an error message that will be displayed in a popup when\n    // * the TextView has focus.  The icon and error message will be reset to\n    // * null when any key events cause changes to the TextView's text.  The\n    // * drawable must already have had {@link Drawable#setBounds} set on it.\n    // * If the <code>error</code> is <code>null</code>, the error message will\n    // * be cleared (and you should provide a <code>null</code> icon as well).\n    // */\n    //setError(error:String, icon:Drawable=null):void  {\n    //    this.createEditorIfNeeded();\n    //    this.mEditor.setError(error, icon);\n    //    this.notifyViewAccessibilityStateChangedIfNeeded(AccessibilityEvent.CONTENT_CHANGE_TYPE_UNDEFINED);\n    //}\n\n    protected setFrame(l:number, t:number, r:number, b:number):boolean  {\n        let result:boolean = super.setFrame(l, t, r, b);\n        //if (this.mEditor != null)\n        //    this.mEditor.setFrame();\n        this.restartMarqueeIfNeeded();\n        return result;\n    }\n\n    private restartMarqueeIfNeeded():void  {\n        if (this.mRestartMarquee && this.mEllipsize == TextUtils.TruncateAt.MARQUEE) {\n            this.mRestartMarquee = false;\n            this.startMarquee();\n        }\n    }\n\n    /**\n     * Sets the list of input filters that will be used if the buffer is\n     * Editable. Has no effect otherwise.\n     *\n     * @attr ref android.R.styleable#TextView_maxLength\n     */\n    setFilters(filters:any[]):void;\n    setFilters(e:any, filters:any[]):void;\n    setFilters(...args):void  {\n        //if (this.mEditor != null) {\n        //    const undoFilter:boolean = this.mEditor.mUndoInputFilter != null;\n        //    const keyFilter:boolean = this.mEditor.mKeyListener instanceof InputFilter;\n        //    let num:number = 0;\n        //    if (undoFilter)\n        //        num++;\n        //    if (keyFilter)\n        //        num++;\n        //    if (num > 0) {\n        //        let nf:InputFilter[] = new Array<InputFilter>(filters.length + num);\n        //        System.arraycopy(filters, 0, nf, 0, filters.length);\n        //        num = 0;\n        //        if (undoFilter) {\n        //            nf[filters.length] = this.mEditor.mUndoInputFilter;\n        //            num++;\n        //        }\n        //        if (keyFilter) {\n        //            nf[filters.length + num] = <InputFilter> this.mEditor.mKeyListener;\n        //        }\n        //        e.setFilters(nf);\n        //        return;\n        //    }\n        //}\n        //e.setFilters(filters);\n    }\n\n    /**\n     * Returns the current list of input filters.\n     *\n     * @attr ref android.R.styleable#TextView_maxLength\n     */\n    getFilters():any[]  {\n        return this.mFilters;\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    private getBoxHeight(l:Layout):number  {\n        //let opticalInsets:Insets = TextView.isLayoutModeOptical(this.mParent) ? this.getOpticalInsets() : Insets.NONE;\n        let padding:number = (l == this.mHintLayout) ? this.getCompoundPaddingTop() + this.getCompoundPaddingBottom() : this.getExtendedPaddingTop() + this.getExtendedPaddingBottom();\n        return this.getMeasuredHeight() - padding;// + opticalInsets.top + opticalInsets.bottom;\n    }\n\n    getVerticalOffset(forceNormal:boolean):number  {\n        let voffset:number = 0;\n        const gravity:number = this.mGravity & Gravity.VERTICAL_GRAVITY_MASK;\n        let l:Layout = this.mLayout;\n        if (!forceNormal && this.mText.length == 0 && this.mHintLayout != null) {\n            l = this.mHintLayout;\n        }\n        if (gravity != Gravity.TOP) {\n            let boxht:number = this.getBoxHeight(l);\n            let textht:number = l.getHeight();\n            if (textht < boxht) {\n                if (gravity == Gravity.BOTTOM)\n                    voffset = boxht - textht;\n                else\n                    // (gravity == Gravity.CENTER_VERTICAL)\n                    voffset = (boxht - textht) >> 1;\n            }\n        }\n        return voffset;\n    }\n\n    private getBottomVerticalOffset(forceNormal:boolean):number  {\n        let voffset:number = 0;\n        const gravity:number = this.mGravity & Gravity.VERTICAL_GRAVITY_MASK;\n        let l:Layout = this.mLayout;\n        if (!forceNormal && this.mText.length == 0 && this.mHintLayout != null) {\n            l = this.mHintLayout;\n        }\n        if (gravity != Gravity.BOTTOM) {\n            let boxht:number = this.getBoxHeight(l);\n            let textht:number = l.getHeight();\n            if (textht < boxht) {\n                if (gravity == Gravity.TOP)\n                    voffset = boxht - textht;\n                else\n                    // (gravity == Gravity.CENTER_VERTICAL)\n                    voffset = (boxht - textht) >> 1;\n            }\n        }\n        return voffset;\n    }\n\n    //invalidateCursorPath():void  {\n    //    if (this.mHighlightPathBogus) {\n    //        this.invalidateCursor();\n    //    } else {\n    //        const horizontalPadding:number = this.getCompoundPaddingLeft();\n    //        const verticalPadding:number = this.getExtendedPaddingTop() + this.getVerticalOffset(true);\n    //        if (this.mEditor.mCursorCount == 0) {\n    //            {\n    //                /*\n    //                 * The reason for this concern about the thickness of the\n    //                 * cursor and doing the floor/ceil on the coordinates is that\n    //                 * some EditTexts (notably textfields in the Browser) have\n    //                 * anti-aliased text where not all the characters are\n    //                 * necessarily at integer-multiple locations.  This should\n    //                 * make sure the entire cursor gets invalidated instead of\n    //                 * sometimes missing half a pixel.\n    //                 */\n    //                let thick:number = Math.ceil(this.mTextPaint.getStrokeWidth());\n    //                if (thick < 1.0) {\n    //                    thick = 1.0;\n    //                }\n    //                thick /= 2.0;\n    //                // mHighlightPath is guaranteed to be non null at that point.\n    //                this.mHighlightPath.computeBounds(TextView.TEMP_RECTF, false);\n    //                this.invalidate(Math.floor(Math.floor(horizontalPadding + TextView.TEMP_RECTF.left - thick)), Math.floor(Math.floor(verticalPadding + TextView.TEMP_RECTF.top - thick)), Math.floor(Math.ceil(horizontalPadding + TextView.TEMP_RECTF.right + thick)), Math.floor(Math.ceil(verticalPadding + TextView.TEMP_RECTF.bottom + thick)));\n    //            }\n    //        } else {\n    //            for (let i:number = 0; i < this.mEditor.mCursorCount; i++) {\n    //                let bounds:Rect = this.mEditor.mCursorDrawable[i].getBounds();\n    //                this.invalidate(bounds.left + horizontalPadding, bounds.top + verticalPadding, bounds.right + horizontalPadding, bounds.bottom + verticalPadding);\n    //            }\n    //        }\n    //    }\n    //}\n    //\n    //invalidateCursor():void  {\n    //    let where:number = this.getSelectionEnd();\n    //    this.invalidateCursor(where, where, where);\n    //}\n    //\n    //private invalidateCursor(a:number, b:number, c:number):void  {\n    //    if (a >= 0 || b >= 0 || c >= 0) {\n    //        let start:number = Math.min(Math.min(a, b), c);\n    //        let end:number = Math.max(Math.max(a, b), c);\n    //        this.invalidateRegion(start, end, true);\n    //    }\n    //}\n\n    /**\n     * Invalidates the region of text enclosed between the start and end text offsets.\n     */\n    invalidateRegion(start:number, end:number, invalidateCursor:boolean):void  {\n        if (this.mLayout == null) {\n            this.invalidate();\n        } else {\n            let lineStart:number = this.mLayout.getLineForOffset(start);\n            let top:number = this.mLayout.getLineTop(lineStart);\n            // the same problem with the descenders on the line above it!)\n            if (lineStart > 0) {\n                top -= this.mLayout.getLineDescent(lineStart - 1);\n            }\n            let lineEnd:number;\n            if (start == end)\n                lineEnd = lineStart;\n            else\n                lineEnd = this.mLayout.getLineForOffset(end);\n            let bottom:number = this.mLayout.getLineBottom(lineEnd);\n            // mEditor can be null in case selection is set programmatically.\n            //if (invalidateCursor && this.mEditor != null) {\n            //    for (let i:number = 0; i < this.mEditor.mCursorCount; i++) {\n            //        let bounds:Rect = this.mEditor.mCursorDrawable[i].getBounds();\n            //        top = Math.min(top, bounds.top);\n            //        bottom = Math.max(bottom, bounds.bottom);\n            //    }\n            //}\n            const compoundPaddingLeft:number = this.getCompoundPaddingLeft();\n            const verticalPadding:number = this.getExtendedPaddingTop() + this.getVerticalOffset(true);\n            let left:number, right:number;\n            if (lineStart == lineEnd && !invalidateCursor) {\n                left = Math.floor(this.mLayout.getPrimaryHorizontal(start));\n                right = Math.floor((this.mLayout.getPrimaryHorizontal(end) + 1.0));\n                left += compoundPaddingLeft;\n                right += compoundPaddingLeft;\n            } else {\n                // Rectangle bounding box when the region spans several lines\n                left = compoundPaddingLeft;\n                right = this.getWidth() - this.getCompoundPaddingRight();\n            }\n            this.invalidate(this.mScrollX + left, verticalPadding + top, this.mScrollX + right, verticalPadding + bottom);\n        }\n    }\n\n    private registerForPreDraw():void  {\n        if (!this.mPreDrawRegistered) {\n            this.getViewTreeObserver().addOnPreDrawListener(this);\n            this.mPreDrawRegistered = true;\n        }\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    onPreDraw():boolean  {\n        if (this.mLayout == null) {\n            this.assumeLayout();\n        }\n        if (this.mMovement != null) {\n            /* This code also provides auto-scrolling when a cursor is moved using a\n             * CursorController (insertion point or selection limits).\n             * For selection, ensure start or end is visible depending on controller's state.\n             */\n            let curs:number = this.getSelectionEnd();\n            // Do not create the controller if it is not already created.\n            //if (this.mEditor != null && this.mEditor.mSelectionModifierCursorController != null && this.mEditor.mSelectionModifierCursorController.isSelectionStartDragged()) {\n            //    curs = this.getSelectionStart();\n            //}\n            /*\n             * TODO: This should really only keep the end in view if\n             * it already was before the text changed.  I'm not sure\n             * of a good way to tell from here if it was.\n             */\n            if (curs < 0 && (this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {\n                curs = this.mText.length;\n            }\n            if (curs >= 0) {\n                this.bringPointIntoView(curs);\n            }\n        } else {\n            this.bringTextIntoView();\n        }\n        //   a screen rotation) since layout is not yet initialized at that point.\n        //if (this.mEditor != null && this.mEditor.mCreatedWithASelection) {\n        //    this.mEditor.startSelectionActionMode();\n        //    this.mEditor.mCreatedWithASelection = false;\n        //}\n        // not be set. Do the test here instead.\n        //if (this instanceof ExtractEditText && this.hasSelection() && this.mEditor != null) {\n        //    this.mEditor.startSelectionActionMode();\n        //}\n        this.getViewTreeObserver().removeOnPreDrawListener(this);\n        this.mPreDrawRegistered = false;\n        return true;\n    }\n\n    protected onAttachedToWindow():void  {\n        super.onAttachedToWindow();\n        this.mTemporaryDetach = false;\n        //if (this.mEditor != null)\n        //    this.mEditor.onAttachedToWindow();\n    }\n\n    protected onDetachedFromWindow():void  {\n        super.onDetachedFromWindow();\n        if (this.mPreDrawRegistered) {\n            this.getViewTreeObserver().removeOnPreDrawListener(this);\n            this.mPreDrawRegistered = false;\n        }\n        this.resetResolvedDrawables();\n        //if (this.mEditor != null)\n        //    this.mEditor.onDetachedFromWindow();\n    }\n\n    //onScreenStateChanged(screenState:number):void  {\n    //    super.onScreenStateChanged(screenState);\n    //    if (this.mEditor != null)\n    //        this.mEditor.onScreenStateChanged(screenState);\n    //}\n\n    protected isPaddingOffsetRequired():boolean  {\n        return this.mShadowRadius != 0 || this.mDrawables != null;\n    }\n\n    protected getLeftPaddingOffset():number  {\n        return this.getCompoundPaddingLeft() - this.mPaddingLeft + Math.floor(Math.min(0, this.mShadowDx - this.mShadowRadius));\n    }\n\n    protected getTopPaddingOffset():number  {\n        return Math.floor(Math.min(0, this.mShadowDy - this.mShadowRadius));\n    }\n\n    protected getBottomPaddingOffset():number  {\n        return Math.floor(Math.max(0, this.mShadowDy + this.mShadowRadius));\n    }\n\n    protected getRightPaddingOffset():number  {\n        return -(this.getCompoundPaddingRight() - this.mPaddingRight) + Math.floor(Math.max(0, this.mShadowDx + this.mShadowRadius));\n    }\n\n    protected verifyDrawable(who:Drawable):boolean  {\n        const verified:boolean = super.verifyDrawable(who);\n        if (!verified && this.mDrawables != null) {\n            return who == this.mDrawables.mDrawableLeft || who == this.mDrawables.mDrawableTop || who == this.mDrawables.mDrawableRight || who == this.mDrawables.mDrawableBottom || who == this.mDrawables.mDrawableStart || who == this.mDrawables.mDrawableEnd;\n        }\n        return verified;\n    }\n\n    jumpDrawablesToCurrentState():void  {\n        super.jumpDrawablesToCurrentState();\n        if (this.mDrawables != null) {\n            if (this.mDrawables.mDrawableLeft != null) {\n                this.mDrawables.mDrawableLeft.jumpToCurrentState();\n            }\n            if (this.mDrawables.mDrawableTop != null) {\n                this.mDrawables.mDrawableTop.jumpToCurrentState();\n            }\n            if (this.mDrawables.mDrawableRight != null) {\n                this.mDrawables.mDrawableRight.jumpToCurrentState();\n            }\n            if (this.mDrawables.mDrawableBottom != null) {\n                this.mDrawables.mDrawableBottom.jumpToCurrentState();\n            }\n            if (this.mDrawables.mDrawableStart != null) {\n                this.mDrawables.mDrawableStart.jumpToCurrentState();\n            }\n            if (this.mDrawables.mDrawableEnd != null) {\n                this.mDrawables.mDrawableEnd.jumpToCurrentState();\n            }\n        }\n    }\n\n\n    drawableSizeChange(d:android.graphics.drawable.Drawable):void {\n        const drawables:TextView.Drawables = this.mDrawables;\n        const isCompoundDrawable = drawables!=null && (d == drawables.mDrawableLeft || d == drawables.mDrawableTop\n            || d == drawables.mDrawableRight || d == drawables.mDrawableBottom || d == drawables.mDrawableStart || d == drawables.mDrawableEnd);\n\n        if(isCompoundDrawable){\n            d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());\n            this.setCompoundDrawables(drawables.mDrawableLeft, drawables.mDrawableTop, drawables.mDrawableRight, drawables.mDrawableBottom);\n        }else{\n            super.drawableSizeChange(d);\n        }\n    }\n\n    invalidateDrawable(drawable:Drawable):void  {\n        if (this.verifyDrawable(drawable)) {\n            const dirty:Rect = drawable.getBounds();\n            let scrollX:number = this.mScrollX;\n            let scrollY:number = this.mScrollY;\n            // IMPORTANT: The coordinates below are based on the coordinates computed\n            // for each compound drawable in onDraw(). Make sure to update each section\n            // accordingly.\n            const drawables:TextView.Drawables = this.mDrawables;\n\n            if (drawables != null) {\n                if (drawable == drawables.mDrawableLeft) {\n                    const compoundPaddingTop:number = this.getCompoundPaddingTop();\n                    const compoundPaddingBottom:number = this.getCompoundPaddingBottom();\n                    const vspace:number = this.mBottom - this.mTop - compoundPaddingBottom - compoundPaddingTop;\n                    scrollX += this.mPaddingLeft;\n                    scrollY += compoundPaddingTop + (vspace - drawables.mDrawableHeightLeft) / 2;\n                } else if (drawable == drawables.mDrawableRight) {\n                    const compoundPaddingTop:number = this.getCompoundPaddingTop();\n                    const compoundPaddingBottom:number = this.getCompoundPaddingBottom();\n                    const vspace:number = this.mBottom - this.mTop - compoundPaddingBottom - compoundPaddingTop;\n                    scrollX += (this.mRight - this.mLeft - this.mPaddingRight - drawables.mDrawableSizeRight);\n                    scrollY += compoundPaddingTop + (vspace - drawables.mDrawableHeightRight) / 2;\n                } else if (drawable == drawables.mDrawableTop) {\n                    const compoundPaddingLeft:number = this.getCompoundPaddingLeft();\n                    const compoundPaddingRight:number = this.getCompoundPaddingRight();\n                    const hspace:number = this.mRight - this.mLeft - compoundPaddingRight - compoundPaddingLeft;\n                    scrollX += compoundPaddingLeft + (hspace - drawables.mDrawableWidthTop) / 2;\n                    scrollY += this.mPaddingTop;\n                } else if (drawable == drawables.mDrawableBottom) {\n                    const compoundPaddingLeft:number = this.getCompoundPaddingLeft();\n                    const compoundPaddingRight:number = this.getCompoundPaddingRight();\n                    const hspace:number = this.mRight - this.mLeft - compoundPaddingRight - compoundPaddingLeft;\n                    scrollX += compoundPaddingLeft + (hspace - drawables.mDrawableWidthBottom) / 2;\n                    scrollY += (this.mBottom - this.mTop - this.mPaddingBottom - drawables.mDrawableSizeBottom);\n                }\n            }\n\n            this.invalidate(dirty.left + scrollX, dirty.top + scrollY, dirty.right + scrollX, dirty.bottom + scrollY);\n        }\n    }\n\n    //hasOverlappingRendering():boolean  {\n    //    // horizontal fading edge causes SaveLayerAlpha, which doesn't support alpha modulation\n    //    return ((this.getBackground() != null && this.getBackground().getCurrent() != null) || this.mText instanceof Spannable || this.hasSelection() || this.isHorizontalFadingEdgeEnabled());\n    //}\n\n    /**\n     *\n     * Returns the state of the {@code textIsSelectable} flag (See\n     * {@link #setTextIsSelectable setTextIsSelectable()}). Although you have to set this flag\n     * to allow users to select and copy text in a non-editable TextView, the content of an\n     * {@link EditText} can always be selected, independently of the value of this flag.\n     * <p>\n     *\n     * @return True if the text displayed in this TextView can be selected by the user.\n     *\n     * @attr ref android.R.styleable#TextView_textIsSelectable\n     */\n    isTextSelectable():boolean  {\n        return false;\n        //return this.mEditor == null ? false : this.mEditor.mTextIsSelectable;\n    }\n\n    /**\n     * Sets whether the content of this view is selectable by the user. The default is\n     * {@code false}, meaning that the content is not selectable.\n     * <p>\n     * When you use a TextView to display a useful piece of information to the user (such as a\n     * contact's address), make it selectable, so that the user can select and copy its\n     * content. You can also use set the XML attribute\n     * {@link android.R.styleable#TextView_textIsSelectable} to \"true\".\n     * <p>\n     * When you call this method to set the value of {@code textIsSelectable}, it sets\n     * the flags {@code focusable}, {@code focusableInTouchMode}, {@code clickable},\n     * and {@code longClickable} to the same value. These flags correspond to the attributes\n     * {@link android.R.styleable#View_focusable android:focusable},\n     * {@link android.R.styleable#View_focusableInTouchMode android:focusableInTouchMode},\n     * {@link android.R.styleable#View_clickable android:clickable}, and\n     * {@link android.R.styleable#View_longClickable android:longClickable}. To restore any of these\n     * flags to a state you had set previously, call one or more of the following methods:\n     * {@link #setFocusable(boolean) setFocusable()},\n     * {@link #setFocusableInTouchMode(boolean) setFocusableInTouchMode()},\n     * {@link #setClickable(boolean) setClickable()} or\n     * {@link #setLongClickable(boolean) setLongClickable()}.\n     *\n     * @param selectable Whether the content of this TextView should be selectable.\n     */\n    setTextIsSelectable(selectable:boolean):void  {\n        //// false is default value with no edit data\n        //if (!selectable && this.mEditor == null)\n        //    return;\n        //this.createEditorIfNeeded();\n        //if (this.mEditor.mTextIsSelectable == selectable)\n        //    return;\n        //this.mEditor.mTextIsSelectable = selectable;\n        //this.setFocusableInTouchMode(selectable);\n        //this.setFocusable(selectable);\n        //this.setClickable(selectable);\n        //this.setLongClickable(selectable);\n        //// mInputType should already be EditorInfo.TYPE_NULL and mInput should be null\n        //this.setMovementMethod(selectable ? ArrowKeyMovementMethod.getInstance() : null);\n        //this.setText(this.mText, selectable ? TextView.BufferType.SPANNABLE : TextView.BufferType.NORMAL);\n        //// Called by setText above, but safer in case of future code changes\n        //this.mEditor.prepareCursorControllers();\n    }\n\n    protected onCreateDrawableState(extraSpace:number):number[]  {\n        let drawableState:number[];\n        if (this.mSingleLine) {\n            drawableState = super.onCreateDrawableState(extraSpace);\n        } else {\n            drawableState = super.onCreateDrawableState(extraSpace + 1);\n            TextView.mergeDrawableStates(drawableState, TextView.MULTILINE_STATE_SET);\n        }\n        if (this.isTextSelectable()) {\n            // Disable pressed state, which was introduced when TextView was made clickable.\n            // Prevents text color change.\n            // setClickable(false) would have a similar effect, but it also disables focus changes\n            // and long press actions, which are both needed by text selection.\n            const length:number = drawableState.length;\n            for (let i:number = 0; i < length; i++) {\n                if (drawableState[i] == View.VIEW_STATE_PRESSED) {\n                    const nonPressedState:number[] = androidui.util.ArrayCreator.newNumberArray(length - 1);\n                    System.arraycopy(drawableState, 0, nonPressedState, 0, i);\n                    System.arraycopy(drawableState, i + 1, nonPressedState, i, length - i - 1);\n                    return nonPressedState;\n                }\n            }\n        }\n        return drawableState;\n    }\n\n    private getUpdatedHighlightPath():Path  {\n        let highlight:Path = null;\n        let highlightPaint:Paint = this.mHighlightPaint;\n        const selStart:number = this.getSelectionStart();\n        const selEnd:number = this.getSelectionEnd();\n        if (this.mMovement != null && (this.isFocused() || this.isPressed()) && selStart >= 0) {\n            if (selStart == selEnd) {\n                //if (this.mEditor != null && this.mEditor.isCursorVisible() && (SystemClock.uptimeMillis() - this.mEditor.mShowCursor) % (2 * Editor.BLINK) < Editor.BLINK) {\n                //    if (this.mHighlightPathBogus) {\n                //        if (this.mHighlightPath == null)\n                //            this.mHighlightPath = new Path();\n                //        this.mHighlightPath.reset();\n                //        this.mLayout.getCursorPath(selStart, this.mHighlightPath, this.mText);\n                //        this.mEditor.updateCursorsPositions();\n                //        this.mHighlightPathBogus = false;\n                //    }\n                //    // XXX should pass to skin instead of drawing directly\n                //    highlightPaint.setColor(this.mCurTextColor);\n                //    highlightPaint.setStyle(Paint.Style.STROKE);\n                //    highlight = this.mHighlightPath;\n                //}\n            } else {\n                if (this.mHighlightPathBogus) {\n                    if (this.mHighlightPath == null)\n                        this.mHighlightPath = new Path();\n                    this.mHighlightPath.reset();\n                    this.mLayout.getSelectionPath(selStart, selEnd, this.mHighlightPath);\n                    this.mHighlightPathBogus = false;\n                }\n                // XXX should pass to skin instead of drawing directly\n                highlightPaint.setColor(this.mHighlightColor);\n                highlightPaint.setStyle(Paint.Style.FILL);\n                highlight = this.mHighlightPath;\n            }\n        }\n        return highlight;\n    }\n\n    /**\n     * @hide\n     */\n    getHorizontalOffsetForDrawables():number  {\n        return 0;\n    }\n\n    protected onDraw(canvas:Canvas):void  {\n        this.restartMarqueeIfNeeded();\n        // Draw the background for this view\n        super.onDraw(canvas);\n        const compoundPaddingLeft:number = this.getCompoundPaddingLeft();\n        const compoundPaddingTop:number = this.getCompoundPaddingTop();\n        const compoundPaddingRight:number = this.getCompoundPaddingRight();\n        const compoundPaddingBottom:number = this.getCompoundPaddingBottom();\n        const scrollX:number = this.mScrollX;\n        const scrollY:number = this.mScrollY;\n        const right:number = this.mRight;\n        const left:number = this.mLeft;\n        const bottom:number = this.mBottom;\n        const top:number = this.mTop;\n        const isLayoutRtl:boolean = this.isLayoutRtl();\n        const offset:number = this.getHorizontalOffsetForDrawables();\n        const leftOffset:number = isLayoutRtl ? 0 : offset;\n        const rightOffset:number = isLayoutRtl ? offset : 0;\n        const dr:TextView.Drawables = this.mDrawables;\n        if (dr != null) {\n            /*\n             * Compound, not extended, because the icon is not clipped\n             * if the text height is smaller.\n             */\n            let vspace:number = bottom - top - compoundPaddingBottom - compoundPaddingTop;\n            let hspace:number = right - left - compoundPaddingRight - compoundPaddingLeft;\n            // Make sure to update invalidateDrawable() when changing this code.\n            if (dr.mDrawableLeft != null) {\n                canvas.save();\n                canvas.translate(scrollX + this.mPaddingLeft + leftOffset, scrollY + compoundPaddingTop + (vspace - dr.mDrawableHeightLeft) / 2);\n                dr.mDrawableLeft.draw(canvas);\n                canvas.restore();\n            }\n            // Make sure to update invalidateDrawable() when changing this code.\n            if (dr.mDrawableRight != null) {\n                canvas.save();\n                canvas.translate(scrollX + right - left - this.mPaddingRight - dr.mDrawableSizeRight - rightOffset, scrollY + compoundPaddingTop + (vspace - dr.mDrawableHeightRight) / 2);\n                dr.mDrawableRight.draw(canvas);\n                canvas.restore();\n            }\n            // Make sure to update invalidateDrawable() when changing this code.\n            if (dr.mDrawableTop != null) {\n                canvas.save();\n                canvas.translate(scrollX + compoundPaddingLeft + (hspace - dr.mDrawableWidthTop) / 2, scrollY + this.mPaddingTop);\n                dr.mDrawableTop.draw(canvas);\n                canvas.restore();\n            }\n            // Make sure to update invalidateDrawable() when changing this code.\n            if (dr.mDrawableBottom != null) {\n                canvas.save();\n                canvas.translate(scrollX + compoundPaddingLeft + (hspace - dr.mDrawableWidthBottom) / 2, scrollY + bottom - top - this.mPaddingBottom - dr.mDrawableSizeBottom);\n                dr.mDrawableBottom.draw(canvas);\n                canvas.restore();\n            }\n        }\n        let color:number = this.mCurTextColor;\n        if (this.mLayout == null) {\n            this.assumeLayout();\n        }\n        let layout:Layout = this.mLayout;\n        if (this.mHint != null && this.mText.length == 0) {\n            if (this.mHintTextColor != null) {\n                color = this.mCurHintTextColor;\n            }\n            layout = this.mHintLayout;\n        }\n        this.mTextPaint.setColor(color);\n        this.mTextPaint.drawableState = this.getDrawableState();\n\n        //androidui: will set to true by EditText (when editing)\n        if(this.mSkipDrawText) return;\n\n        canvas.save();\n\n        /*  Would be faster if we didn't have to do this. Can we chop the\n            (displayable) text so that we don't need to do this ever?\n        */\n        let extendedPaddingTop:number = this.getExtendedPaddingTop();\n        let extendedPaddingBottom:number = this.getExtendedPaddingBottom();\n        const vspace:number = this.mBottom - this.mTop - compoundPaddingBottom - compoundPaddingTop;\n        const maxScrollY:number = this.mLayout.getHeight() - vspace;\n        let clipLeft:number = compoundPaddingLeft + scrollX;\n        let clipTop:number = (scrollY == 0) ? 0 : extendedPaddingTop + scrollY;\n        let clipRight:number = right - left - compoundPaddingRight + scrollX;\n        let clipBottom:number = bottom - top + scrollY - ((scrollY == maxScrollY) ? 0 : extendedPaddingBottom);\n        if (this.mShadowRadius != 0) {\n            clipLeft += Math.min(0, this.mShadowDx - this.mShadowRadius);\n            clipRight += Math.max(0, this.mShadowDx + this.mShadowRadius);\n            clipTop += Math.min(0, this.mShadowDy - this.mShadowRadius);\n            clipBottom += Math.max(0, this.mShadowDy + this.mShadowRadius);\n        }\n        canvas.clipRect(clipLeft, clipTop, clipRight, clipBottom);\n        let voffsetText:number = 0;\n        let voffsetCursor:number = 0;\n        /* shortcircuit calling getVerticaOffset() */\n        if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) != Gravity.TOP) {\n            voffsetText = this.getVerticalOffset(false);\n            voffsetCursor = this.getVerticalOffset(true);\n        }\n        canvas.translate(compoundPaddingLeft, extendedPaddingTop + voffsetText);\n        //const layoutDirection:number = this.getLayoutDirection();\n        const absoluteGravity:number = this.mGravity;//Gravity.getAbsoluteGravity(this.mGravity, layoutDirection);\n        if (this.mEllipsize == TextUtils.TruncateAt.MARQUEE && this.mMarqueeFadeMode != TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS) {\n            if (!this.mSingleLine && this.getLineCount() == 1 && this.canMarquee() && (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) != Gravity.LEFT) {\n                const width:number = this.mRight - this.mLeft;\n                const padding:number = this.getCompoundPaddingLeft() + this.getCompoundPaddingRight();\n                const dx:number = this.mLayout.getLineRight(0) - (width - padding);\n                canvas.translate(isLayoutRtl ? -dx : +dx, 0.0);\n            }\n            if (this.mMarquee != null && this.mMarquee.isRunning()) {\n                const dx:number = -this.mMarquee.getScroll();\n                canvas.translate(isLayoutRtl ? -dx : +dx, 0.0);\n            }\n        }\n        const cursorOffsetVertical:number = voffsetCursor - voffsetText;\n        let highlight:Path = this.getUpdatedHighlightPath();\n        //if (this.mEditor != null) {\n        //    this.mEditor.onDraw(canvas, layout, highlight, this.mHighlightPaint, cursorOffsetVertical);\n        //} else {\n            layout.draw(canvas, highlight, this.mHighlightPaint, cursorOffsetVertical);\n        //}\n        if (this.mMarquee != null && this.mMarquee.shouldDrawGhost()) {\n            const dx:number = Math.floor(this.mMarquee.getGhostOffset());\n            canvas.translate(isLayoutRtl ? -dx : dx, 0.0);\n            layout.draw(canvas, highlight, this.mHighlightPaint, cursorOffsetVertical);\n        }\n        canvas.restore();\n    }\n\n    getFocusedRect(r:Rect):void  {\n        if (this.mLayout == null) {\n            super.getFocusedRect(r);\n            return;\n        }\n        let selEnd:number = this.getSelectionEnd();\n        if (selEnd < 0) {\n            super.getFocusedRect(r);\n            return;\n        }\n        //let selStart:number = this.getSelectionStart();\n        //if (selStart < 0 || selStart >= selEnd) {\n        //    let line:number = this.mLayout.getLineForOffset(selEnd);\n        //    r.top = this.mLayout.getLineTop(line);\n        //    r.bottom = this.mLayout.getLineBottom(line);\n        //    r.left = Math.floor(this.mLayout.getPrimaryHorizontal(selEnd)) - 2;\n        //    r.right = r.left + 4;\n        //} else {\n        //    let lineStart:number = this.mLayout.getLineForOffset(selStart);\n        //    let lineEnd:number = this.mLayout.getLineForOffset(selEnd);\n        //    r.top = this.mLayout.getLineTop(lineStart);\n        //    r.bottom = this.mLayout.getLineBottom(lineEnd);\n        //    if (lineStart == lineEnd) {\n        //        r.left = Math.floor(this.mLayout.getPrimaryHorizontal(selStart));\n        //        r.right = Math.floor(this.mLayout.getPrimaryHorizontal(selEnd));\n        //    } else {\n        //        // rect cover the entire width.\n        //        if (this.mHighlightPathBogus) {\n        //            if (this.mHighlightPath == null)\n        //                this.mHighlightPath = new Path();\n        //            this.mHighlightPath.reset();\n        //            this.mLayout.getSelectionPath(selStart, selEnd, this.mHighlightPath);\n        //            this.mHighlightPathBogus = false;\n        //        }\n        //        {\n        //            this.mHighlightPath.computeBounds(TextView.TEMP_RECTF, true);\n        //            r.left = Math.floor(TextView.TEMP_RECTF.left) - 1;\n        //            r.right = Math.floor(TextView.TEMP_RECTF.right) + 1;\n        //        }\n        //    }\n        //}\n        //// Adjust for padding and gravity.\n        //let paddingLeft:number = this.getCompoundPaddingLeft();\n        //let paddingTop:number = this.getExtendedPaddingTop();\n        //if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) != Gravity.TOP) {\n        //    paddingTop += this.getVerticalOffset(false);\n        //}\n        //r.offset(paddingLeft, paddingTop);\n        //let paddingBottom:number = this.getExtendedPaddingBottom();\n        //r.bottom += paddingBottom;\n    }\n\n    /**\n     * Return the number of lines of text, or 0 if the internal Layout has not\n     * been built.\n     */\n    getLineCount():number  {\n        return this.mLayout != null ? this.mLayout.getLineCount() : 0;\n    }\n\n    /**\n     * Return the baseline for the specified line (0...getLineCount() - 1)\n     * If bounds is not null, return the top, left, right, bottom extents\n     * of the specified line in it. If the internal Layout has not been built,\n     * return 0 and set bounds to (0, 0, 0, 0)\n     * @param line which line to examine (0..getLineCount() - 1)\n     * @param bounds Optional. If not null, it returns the extent of the line\n     * @return the Y-coordinate of the baseline\n     */\n    getLineBounds(line:number, bounds:Rect):number  {\n        if (this.mLayout == null) {\n            if (bounds != null) {\n                bounds.set(0, 0, 0, 0);\n            }\n            return 0;\n        } else {\n            let baseline:number = this.mLayout.getLineBounds(line, bounds);\n            let voffset:number = this.getExtendedPaddingTop();\n            if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) != Gravity.TOP) {\n                voffset += this.getVerticalOffset(true);\n            }\n            if (bounds != null) {\n                bounds.offset(this.getCompoundPaddingLeft(), voffset);\n            }\n            return baseline + voffset;\n        }\n    }\n\n    getBaseline():number  {\n        if (this.mLayout == null) {\n            return super.getBaseline();\n        }\n        let voffset:number = 0;\n        if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) != Gravity.TOP) {\n            voffset = this.getVerticalOffset(true);\n        }\n        //if (TextView.isLayoutModeOptical(this.mParent)) {\n        //    voffset -= this.getOpticalInsets().top;\n        //}\n        return this.getExtendedPaddingTop() + voffset + this.mLayout.getLineBaseline(0);\n    }\n\n    /**\n     * @hide\n     */\n    protected getFadeTop(offsetRequired:boolean):number  {\n        if (this.mLayout == null)\n            return 0;\n        let voffset:number = 0;\n        if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) != Gravity.TOP) {\n            voffset = this.getVerticalOffset(true);\n        }\n        if (offsetRequired)\n            voffset += this.getTopPaddingOffset();\n        return this.getExtendedPaddingTop() + voffset;\n    }\n\n    /**\n     * @hide\n     */\n    protected getFadeHeight(offsetRequired:boolean):number  {\n        return this.mLayout != null ? this.mLayout.getHeight() : 0;\n    }\n\n    //onKeyPreIme(keyCode:number, event:KeyEvent):boolean  {\n    //    if (keyCode == KeyEvent.KEYCODE_BACK) {\n    //        let isInSelectionMode:boolean = this.mEditor != null && this.mEditor.mSelectionActionMode != null;\n    //        if (isInSelectionMode) {\n    //            if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {\n    //                let state:KeyEvent.DispatcherState = this.getKeyDispatcherState();\n    //                if (state != null) {\n    //                    state.startTracking(event, this);\n    //                }\n    //                return true;\n    //            } else if (event.getAction() == KeyEvent.ACTION_UP) {\n    //                let state:KeyEvent.DispatcherState = this.getKeyDispatcherState();\n    //                if (state != null) {\n    //                    state.handleUpEvent(event);\n    //                }\n    //                if (event.isTracking() && !event.isCanceled()) {\n    //                    this.stopSelectionActionMode();\n    //                    return true;\n    //                }\n    //            }\n    //        }\n    //    }\n    //    return super.onKeyPreIme(keyCode, event);\n    //}\n\n    onKeyDown(keyCode:number, event:KeyEvent):boolean  {\n        let which:number = this.doKeyDown(keyCode, event, null);\n        if (which == 0) {\n            return super.onKeyDown(keyCode, event);\n        }\n        return true;\n    }\n\n    //onKeyMultiple(keyCode:number, repeatCount:number, event:KeyEvent):boolean  {\n    //    let down:KeyEvent = KeyEvent.changeAction(event, KeyEvent.ACTION_DOWN);\n    //    let which:number = this.doKeyDown(keyCode, down, event);\n    //    if (which == 0) {\n    //        // Go through default dispatching.\n    //        return super.onKeyMultiple(keyCode, repeatCount, event);\n    //    }\n    //    if (which == -1) {\n    //        // Consumed the whole thing.\n    //        return true;\n    //    }\n    //    repeatCount--;\n    //    // We are going to dispatch the remaining events to either the input\n    //    // or movement method.  To do this, we will just send a repeated stream\n    //    // of down and up events until we have done the complete repeatCount.\n    //    // It would be nice if those interfaces had an onKeyMultiple() method,\n    //    // but adding that is a more complicated change.\n    //    let up:KeyEvent = KeyEvent.changeAction(event, KeyEvent.ACTION_UP);\n    //    if (which == 1) {\n    //        // mEditor and mEditor.mInput are not null from doKeyDown\n    //        this.mEditor.mKeyListener.onKeyUp(this, <Editable> this.mText, keyCode, up);\n    //        while (--repeatCount > 0) {\n    //            this.mEditor.mKeyListener.onKeyDown(this, <Editable> this.mText, keyCode, down);\n    //            this.mEditor.mKeyListener.onKeyUp(this, <Editable> this.mText, keyCode, up);\n    //        }\n    //        this.hideErrorIfUnchanged();\n    //    } else if (which == 2) {\n    //        // mMovement is not null from doKeyDown\n    //        this.mMovement.onKeyUp(this, <Spannable> this.mText, keyCode, up);\n    //        while (--repeatCount > 0) {\n    //            this.mMovement.onKeyDown(this, <Spannable> this.mText, keyCode, down);\n    //            this.mMovement.onKeyUp(this, <Spannable> this.mText, keyCode, up);\n    //        }\n    //    }\n    //    return true;\n    //}\n\n    /**\n     * Returns true if pressing ENTER in this field advances focus instead\n     * of inserting the character.  This is true mostly in single-line fields,\n     * but also in mail addresses and subjects which will display on multiple\n     * lines but where it doesn't make sense to insert newlines.\n     */\n    private shouldAdvanceFocusOnEnter():boolean  {\n        if (this.getKeyListener() == null) {\n            return false;\n        }\n        if (this.mSingleLine) {\n            return true;\n        }\n        //if (this.mEditor != null && (this.mEditor.mInputType & EditorInfo.TYPE_MASK_CLASS) == EditorInfo.TYPE_CLASS_TEXT) {\n        //    let variation:number = this.mEditor.mInputType & EditorInfo.TYPE_MASK_VARIATION;\n        //    if (variation == EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS || variation == EditorInfo.TYPE_TEXT_VARIATION_EMAIL_SUBJECT) {\n        //        return true;\n        //    }\n        //}\n        return false;\n    }\n\n    /**\n     * Returns true if pressing TAB in this field advances focus instead\n     * of inserting the character.  Insert tabs only in multi-line editors.\n     */\n    private shouldAdvanceFocusOnTab():boolean  {\n        //if (this.getKeyListener() != null && !this.mSingleLine && this.mEditor != null && (this.mEditor.mInputType & EditorInfo.TYPE_MASK_CLASS) == EditorInfo.TYPE_CLASS_TEXT) {\n        //    let variation:number = this.mEditor.mInputType & EditorInfo.TYPE_MASK_VARIATION;\n        //    if (variation == EditorInfo.TYPE_TEXT_FLAG_IME_MULTI_LINE || variation == EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE) {\n        //        return false;\n        //    }\n        //}\n        return true;\n    }\n\n    private doKeyDown(keyCode:number, event:KeyEvent, otherEvent:KeyEvent):number  {\n        //if (!this.isEnabled()) {\n            return 0;\n        //}\n        //// prevent the user from traversing out of this on the next key down.\n        //if (event.getRepeatCount() == 0 && !KeyEvent.isModifierKey(keyCode)) {\n        //    this.mPreventDefaultMovement = false;\n        //}\n        //switch(keyCode) {\n        //    case KeyEvent.KEYCODE_ENTER:\n        //        if (event.hasNoModifiers()) {\n        //            // enter key events.\n        //            if (this.mEditor != null && this.mEditor.mInputContentType != null) {\n        //                // chance to consume the event.\n        //                if (this.mEditor.mInputContentType.onEditorActionListener != null && this.mEditor.mInputContentType.onEditorActionListener.onEditorAction(this, EditorInfo.IME_NULL, event)) {\n        //                    this.mEditor.mInputContentType.enterDown = true;\n        //                    // We are consuming the enter key for them.\n        //                    return -1;\n        //                }\n        //            }\n        //            // don't let it be inserted into the text.\n        //            if ((event.getFlags() & KeyEvent.FLAG_EDITOR_ACTION) != 0 || this.shouldAdvanceFocusOnEnter()) {\n        //                if (this.hasOnClickListeners()) {\n        //                    return 0;\n        //                }\n        //                return -1;\n        //            }\n        //        }\n        //        break;\n        //    case KeyEvent.KEYCODE_DPAD_CENTER:\n        //        if (event.hasNoModifiers()) {\n        //            if (this.shouldAdvanceFocusOnEnter()) {\n        //                return 0;\n        //            }\n        //        }\n        //        break;\n        //    case KeyEvent.KEYCODE_TAB:\n        //        if (event.hasNoModifiers() || event.hasModifiers(KeyEvent.META_SHIFT_ON)) {\n        //            if (this.shouldAdvanceFocusOnTab()) {\n        //                return 0;\n        //            }\n        //        }\n        //        break;\n        //    // Has to be done on key down (and not on key up) to correctly be intercepted.\n        //    case KeyEvent.KEYCODE_BACK:\n        //        if (this.mEditor != null && this.mEditor.mSelectionActionMode != null) {\n        //            this.stopSelectionActionMode();\n        //            return -1;\n        //        }\n        //        break;\n        //}\n        //if (this.mEditor != null && this.mEditor.mKeyListener != null) {\n        //    this.resetErrorChangedFlag();\n        //    let doDown:boolean = true;\n        //    if (otherEvent != null) {\n        //        try {\n        //            this.beginBatchEdit();\n        //            const handled:boolean = this.mEditor.mKeyListener.onKeyOther(this, <Editable> this.mText, otherEvent);\n        //            this.hideErrorIfUnchanged();\n        //            doDown = false;\n        //            if (handled) {\n        //                return -1;\n        //            }\n        //        } catch (e){\n        //        } finally {\n        //            this.endBatchEdit();\n        //        }\n        //    }\n        //    if (doDown) {\n        //        this.beginBatchEdit();\n        //        const handled:boolean = this.mEditor.mKeyListener.onKeyDown(this, <Editable> this.mText, keyCode, event);\n        //        this.endBatchEdit();\n        //        this.hideErrorIfUnchanged();\n        //        if (handled)\n        //            return 1;\n        //    }\n        //}\n        //if (this.mMovement != null && this.mLayout != null) {\n        //    let doDown:boolean = true;\n        //    if (otherEvent != null) {\n        //        try {\n        //            let handled:boolean = this.mMovement.onKeyOther(this, <Spannable> this.mText, otherEvent);\n        //            doDown = false;\n        //            if (handled) {\n        //                return -1;\n        //            }\n        //        } catch (e){\n        //        }\n        //    }\n        //    if (doDown) {\n        //        if (this.mMovement.onKeyDown(this, <Spannable> this.mText, keyCode, event)) {\n        //            if (event.getRepeatCount() == 0 && !KeyEvent.isModifierKey(keyCode)) {\n        //                this.mPreventDefaultMovement = true;\n        //            }\n        //            return 2;\n        //        }\n        //    }\n        //}\n        //return this.mPreventDefaultMovement && !KeyEvent.isModifierKey(keyCode) ? -1 : 0;\n    }\n\n    /**\n     * Resets the mErrorWasChanged flag, so that future calls to {@link #setError(CharSequence)}\n     * can be recorded.\n     * @hide\n     */\n    resetErrorChangedFlag():void  {\n        /*\n         * Keep track of what the error was before doing the input\n         * so that if an input filter changed the error, we leave\n         * that error showing.  Otherwise, we take down whatever\n         * error was showing when the user types something.\n         */\n        //if (this.mEditor != null)\n        //    this.mEditor.mErrorWasChanged = false;\n    }\n\n    /**\n     * @hide\n     */\n    hideErrorIfUnchanged():void  {\n        //if (this.mEditor != null && this.mEditor.mError != null && !this.mEditor.mErrorWasChanged) {\n        //    this.setError(null, null);\n        //}\n    }\n\n    onKeyUp(keyCode:number, event:KeyEvent):boolean  {\n        //if (!this.isEnabled()) {\n            return super.onKeyUp(keyCode, event);\n        //}\n        //if (!KeyEvent.isModifierKey(keyCode)) {\n        //    this.mPreventDefaultMovement = false;\n        //}\n        //switch(keyCode) {\n        //    case KeyEvent.KEYCODE_DPAD_CENTER:\n        //        if (event.hasNoModifiers()) {\n        //            /*\n        //             * If there is a click listener, just call through to\n        //             * super, which will invoke it.\n        //             *\n        //             * If there isn't a click listener, try to show the soft\n        //             * input method.  (It will also\n        //             * call performClick(), but that won't do anything in\n        //             * this case.)\n        //             */\n        //            if (!this.hasOnClickListeners()) {\n        //                if (this.mMovement != null && this.mText instanceof Editable && this.mLayout != null && this.onCheckIsTextEditor()) {\n        //                    let imm:InputMethodManager = InputMethodManager.peekInstance();\n        //                    this.viewClicked(imm);\n        //                    if (imm != null && this.getShowSoftInputOnFocus()) {\n        //                        imm.showSoftInput(this, 0);\n        //                    }\n        //                }\n        //            }\n        //        }\n        //        return super.onKeyUp(keyCode, event);\n        //    case KeyEvent.KEYCODE_ENTER:\n        //        if (event.hasNoModifiers()) {\n        //            if (this.mEditor != null && this.mEditor.mInputContentType != null && this.mEditor.mInputContentType.onEditorActionListener != null && this.mEditor.mInputContentType.enterDown) {\n        //                this.mEditor.mInputContentType.enterDown = false;\n        //                if (this.mEditor.mInputContentType.onEditorActionListener.onEditorAction(this, EditorInfo.IME_NULL, event)) {\n        //                    return true;\n        //                }\n        //            }\n        //            if ((event.getFlags() & KeyEvent.FLAG_EDITOR_ACTION) != 0 || this.shouldAdvanceFocusOnEnter()) {\n        //                /*\n        //                 * If there is a click listener, just call through to\n        //                 * super, which will invoke it.\n        //                 *\n        //                 * If there isn't a click listener, try to advance focus,\n        //                 * but still call through to super, which will reset the\n        //                 * pressed state and longpress state.  (It will also\n        //                 * call performClick(), but that won't do anything in\n        //                 * this case.)\n        //                 */\n        //                if (!this.hasOnClickListeners()) {\n        //                    let v:View = this.focusSearch(TextView.FOCUS_DOWN);\n        //                    if (v != null) {\n        //                        if (!v.requestFocus(TextView.FOCUS_DOWN)) {\n        //                            throw Error(`new IllegalStateException(\"focus search returned a view \" + \"that wasn't able to take focus!\")`);\n        //                        }\n        //                        /*\n        //                         * Return true because we handled the key; super\n        //                         * will return false because there was no click\n        //                         * listener.\n        //                         */\n        //                        super.onKeyUp(keyCode, event);\n        //                        return true;\n        //                    } else if ((event.getFlags() & KeyEvent.FLAG_EDITOR_ACTION) != 0) {\n        //                        // No target for next focus, but make sure the IME\n        //                        // if this came from it.\n        //                        let imm:InputMethodManager = InputMethodManager.peekInstance();\n        //                        if (imm != null && imm.isActive(this)) {\n        //                            imm.hideSoftInputFromWindow(this.getWindowToken(), 0);\n        //                        }\n        //                    }\n        //                }\n        //            }\n        //            return super.onKeyUp(keyCode, event);\n        //        }\n        //        break;\n        //}\n        //if (this.mEditor != null && this.mEditor.mKeyListener != null)\n        //    if (this.mEditor.mKeyListener.onKeyUp(this, <Editable> this.mText, keyCode, event))\n        //        return true;\n        //if (this.mMovement != null && this.mLayout != null)\n        //    if (this.mMovement.onKeyUp(this, <Spannable> this.mText, keyCode, event))\n        //        return true;\n        //return super.onKeyUp(keyCode, event);\n    }\n\n    onCheckIsTextEditor():boolean  {\n        return false;\n        //return this.mEditor != null && this.mEditor.mInputType != EditorInfo.TYPE_NULL;\n    }\n\n    //onCreateInputConnection(outAttrs:EditorInfo):InputConnection  {\n    //    if (this.onCheckIsTextEditor() && this.isEnabled()) {\n    //        this.mEditor.createInputMethodStateIfNeeded();\n    //        outAttrs.inputType = this.getInputType();\n    //        if (this.mEditor.mInputContentType != null) {\n    //            outAttrs.imeOptions = this.mEditor.mInputContentType.imeOptions;\n    //            outAttrs.privateImeOptions = this.mEditor.mInputContentType.privateImeOptions;\n    //            outAttrs.actionLabel = this.mEditor.mInputContentType.imeActionLabel;\n    //            outAttrs.actionId = this.mEditor.mInputContentType.imeActionId;\n    //            outAttrs.extras = this.mEditor.mInputContentType.extras;\n    //        } else {\n    //            outAttrs.imeOptions = EditorInfo.IME_NULL;\n    //        }\n    //        if (this.focusSearch(TextView.FOCUS_DOWN) != null) {\n    //            outAttrs.imeOptions |= EditorInfo.IME_FLAG_NAVIGATE_NEXT;\n    //        }\n    //        if (this.focusSearch(TextView.FOCUS_UP) != null) {\n    //            outAttrs.imeOptions |= EditorInfo.IME_FLAG_NAVIGATE_PREVIOUS;\n    //        }\n    //        if ((outAttrs.imeOptions & EditorInfo.IME_MASK_ACTION) == EditorInfo.IME_ACTION_UNSPECIFIED) {\n    //            if ((outAttrs.imeOptions & EditorInfo.IME_FLAG_NAVIGATE_NEXT) != 0) {\n    //                // An action has not been set, but the enter key will move to\n    //                // the next focus, so set the action to that.\n    //                outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT;\n    //            } else {\n    //                // An action has not been set, and there is no focus to move\n    //                // to, so let's just supply a \"done\" action.\n    //                outAttrs.imeOptions |= EditorInfo.IME_ACTION_DONE;\n    //            }\n    //            if (!this.shouldAdvanceFocusOnEnter()) {\n    //                outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_ENTER_ACTION;\n    //            }\n    //        }\n    //        if (TextView.isMultilineInputType(outAttrs.inputType)) {\n    //            // Multi-line text editors should always show an enter key.\n    //            outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_ENTER_ACTION;\n    //        }\n    //        outAttrs.hintText = this.mHint;\n    //        if (this.mText instanceof Editable) {\n    //            let ic:InputConnection = new EditableInputConnection(this);\n    //            outAttrs.initialSelStart = this.getSelectionStart();\n    //            outAttrs.initialSelEnd = this.getSelectionEnd();\n    //            outAttrs.initialCapsMode = ic.getCursorCapsMode(this.getInputType());\n    //            return ic;\n    //        }\n    //    }\n    //    return null;\n    //}\n    //\n    ///**\n    // * If this TextView contains editable content, extract a portion of it\n    // * based on the information in <var>request</var> in to <var>outText</var>.\n    // * @return Returns true if the text was successfully extracted, else false.\n    // */\n    //extractText(request:ExtractedTextRequest, outText:ExtractedText):boolean  {\n    //    this.createEditorIfNeeded();\n    //    return this.mEditor.extractText(request, outText);\n    //}\n    //\n    ///**\n    // * This is used to remove all style-impacting spans from text before new\n    // * extracted text is being replaced into it, so that we don't have any\n    // * lingering spans applied during the replace.\n    // */\n    //static removeParcelableSpans(spannable:Spannable, start:number, end:number):void  {\n    //    let spans:any[] = spannable.getSpans(start, end, ParcelableSpan.class);\n    //    let i:number = spans.length;\n    //    while (i > 0) {\n    //        i--;\n    //        spannable.removeSpan(spans[i]);\n    //    }\n    //}\n    //\n    ///**\n    // * Apply to this text view the given extracted text, as previously\n    // * returned by {@link #extractText(ExtractedTextRequest, ExtractedText)}.\n    // */\n    //setExtractedText(text:ExtractedText):void  {\n    //    let content:Editable = this.getEditableText();\n    //    if (text.text != null) {\n    //        if (content == null) {\n    //            this.setText(text.text, TextView.BufferType.EDITABLE);\n    //        } else if (text.partialStartOffset < 0) {\n    //            TextView.removeParcelableSpans(content, 0, content.length());\n    //            content.replace(0, content.length(), text.text);\n    //        } else {\n    //            const N:number = content.length();\n    //            let start:number = text.partialStartOffset;\n    //            if (start > N)\n    //                start = N;\n    //            let end:number = text.partialEndOffset;\n    //            if (end > N)\n    //                end = N;\n    //            TextView.removeParcelableSpans(content, start, end);\n    //            content.replace(start, end, text.text);\n    //        }\n    //    }\n    //    // Now set the selection position...  make sure it is in range, to\n    //    // avoid crashes.  If this is a partial update, it is possible that\n    //    // the underlying text may have changed, causing us problems here.\n    //    // Also we just don't want to trust clients to do the right thing.\n    //    let sp:Spannable = <Spannable> this.getText();\n    //    const N:number = sp.length();\n    //    let start:number = text.selectionStart;\n    //    if (start < 0)\n    //        start = 0;\n    //    else if (start > N)\n    //        start = N;\n    //    let end:number = text.selectionEnd;\n    //    if (end < 0)\n    //        end = 0;\n    //    else if (end > N)\n    //        end = N;\n    //    Selection.setSelection(sp, start, end);\n    //    // Finally, update the selection mode.\n    //    if ((text.flags & ExtractedText.FLAG_SELECTING) != 0) {\n    //        MetaKeyKeyListener.startSelecting(this, sp);\n    //    } else {\n    //        MetaKeyKeyListener.stopSelecting(this, sp);\n    //    }\n    //}\n    //\n    ///**\n    // * @hide\n    // */\n    //setExtracting(req:ExtractedTextRequest):void  {\n    //    if (this.mEditor.mInputMethodState != null) {\n    //        this.mEditor.mInputMethodState.mExtractedTextRequest = req;\n    //    }\n    //    // This would stop a possible selection mode, but no such mode is started in case\n    //    // extracted mode will start. Some text is selected though, and will trigger an action mode\n    //    // in the extracted view.\n    //    this.mEditor.hideControllers();\n    //}\n    //\n    ///**\n    // * Called by the framework in response to a text completion from\n    // * the current input method, provided by it calling\n    // * {@link InputConnection#commitCompletion\n    // * InputConnection.commitCompletion()}.  The default implementation does\n    // * nothing; text views that are supporting auto-completion should override\n    // * this to do their desired behavior.\n    // *\n    // * @param text The auto complete text the user has selected.\n    // */\n    //onCommitCompletion(text:CompletionInfo):void  {\n    //// intentionally empty\n    //}\n    //\n    ///**\n    // * Called by the framework in response to a text auto-correction (such as fixing a typo using a\n    // * a dictionnary) from the current input method, provided by it calling\n    // * {@link InputConnection#commitCorrection} InputConnection.commitCorrection()}. The default\n    // * implementation flashes the background of the corrected word to provide feedback to the user.\n    // *\n    // * @param info The auto correct info about the text that was corrected.\n    // */\n    //onCommitCorrection(info:CorrectionInfo):void  {\n    //    if (this.mEditor != null)\n    //        this.mEditor.onCommitCorrection(info);\n    //}\n    //\n    //beginBatchEdit():void  {\n    //    if (this.mEditor != null)\n    //        this.mEditor.beginBatchEdit();\n    //}\n    //\n    //endBatchEdit():void  {\n    //    if (this.mEditor != null)\n    //        this.mEditor.endBatchEdit();\n    //}\n    //\n    ///**\n    // * Called by the framework in response to a request to begin a batch\n    // * of edit operations through a call to link {@link #beginBatchEdit()}.\n    // */\n    //onBeginBatchEdit():void  {\n    //// intentionally empty\n    //}\n    //\n    ///**\n    // * Called by the framework in response to a request to end a batch\n    // * of edit operations through a call to link {@link #endBatchEdit}.\n    // */\n    //onEndBatchEdit():void  {\n    //// intentionally empty\n    //}\n\n    /**\n     * Called by the framework in response to a private command from the\n     * current method, provided by it calling\n     * {@link InputConnection#performPrivateCommand\n     * InputConnection.performPrivateCommand()}.\n     *\n     * @param action The action name of the command.\n     * @param data Any additional data for the command.  This may be null.\n     * @return Return true if you handled the command, else false.\n     */\n    //onPrivateIMECommand(action:string, data:Bundle):boolean  {\n    //    return false;\n    //}\n\n    private nullLayouts():void  {\n        if (this.mLayout instanceof BoringLayout && this.mSavedLayout == null) {\n            this.mSavedLayout = <BoringLayout> this.mLayout;\n        }\n        if (this.mHintLayout instanceof BoringLayout && this.mSavedHintLayout == null) {\n            this.mSavedHintLayout = <BoringLayout> this.mHintLayout;\n        }\n        this.mSavedMarqueeModeLayout = this.mLayout = this.mHintLayout = null;\n        this.mBoring = this.mHintBoring = null;\n        // Since it depends on the value of mLayout\n        //if (this.mEditor != null)\n        //    this.mEditor.prepareCursorControllers();\n    }\n\n    /**\n     * Make a new Layout based on the already-measured size of the view,\n     * on the assumption that it was measured correctly at some point.\n     */\n    private assumeLayout():void  {\n        let width:number = this.mRight - this.mLeft - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight();\n        if (width < 1) {\n            width = 0;\n        }\n        let physicalWidth:number = width;\n        if (this.mHorizontallyScrolling) {\n            width = TextView.VERY_WIDE;\n        }\n        this.makeNewLayout(width, physicalWidth, TextView.UNKNOWN_BORING, TextView.UNKNOWN_BORING, physicalWidth, false);\n    }\n\n    private getLayoutAlignment():Layout.Alignment  {\n        let alignment:Layout.Alignment;\n        //switch(this.getTextAlignment()) {\n        //    case TextView.TEXT_ALIGNMENT_GRAVITY:\n                switch(this.mGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n                    //case Gravity.START:\n                    //    alignment = Layout.Alignment.ALIGN_NORMAL;\n                    //    break;\n                    //case Gravity.END:\n                    //    alignment = Layout.Alignment.ALIGN_OPPOSITE;\n                    //    break;\n                    case Gravity.LEFT:\n                        alignment = Layout.Alignment.ALIGN_LEFT;\n                        break;\n                    case Gravity.RIGHT:\n                        alignment = Layout.Alignment.ALIGN_RIGHT;\n                        break;\n                    case Gravity.CENTER_HORIZONTAL:\n                        alignment = Layout.Alignment.ALIGN_CENTER;\n                        break;\n                    default:\n                        alignment = Layout.Alignment.ALIGN_NORMAL;\n                        break;\n                }\n        //        break;\n        //    case TextView.TEXT_ALIGNMENT_TEXT_START:\n        //        alignment = Layout.Alignment.ALIGN_NORMAL;\n        //        break;\n        //    case TextView.TEXT_ALIGNMENT_TEXT_END:\n        //        alignment = Layout.Alignment.ALIGN_OPPOSITE;\n        //        break;\n        //    case TextView.TEXT_ALIGNMENT_CENTER:\n        //        alignment = Layout.Alignment.ALIGN_CENTER;\n        //        break;\n        //    case TextView.TEXT_ALIGNMENT_VIEW_START:\n        //        alignment = (this.getLayoutDirection() == TextView.LAYOUT_DIRECTION_RTL) ? Layout.Alignment.ALIGN_RIGHT : Layout.Alignment.ALIGN_LEFT;\n        //        break;\n        //    case TextView.TEXT_ALIGNMENT_VIEW_END:\n        //        alignment = (this.getLayoutDirection() == TextView.LAYOUT_DIRECTION_RTL) ? Layout.Alignment.ALIGN_LEFT : Layout.Alignment.ALIGN_RIGHT;\n        //        break;\n        //    case TextView.TEXT_ALIGNMENT_INHERIT:\n        //    // but better safe than sorry so we just fall through\n        //    default:\n        //        alignment = Layout.Alignment.ALIGN_NORMAL;\n        //        break;\n        //}\n        return alignment;\n    }\n\n    /**\n     * The width passed in is now the desired layout width,\n     * not the full view width with padding.\n     * {@hide}\n     */\n    protected makeNewLayout(wantWidth:number, hintWidth:number, boring:BoringLayout.Metrics, hintBoring:BoringLayout.Metrics, ellipsisWidth:number, bringIntoView:boolean):void  {\n        this.stopMarquee();\n        // Update \"old\" cached values\n        this.mOldMaximum = this.mMaximum;\n        this.mOldMaxMode = this.mMaxMode;\n        this.mHighlightPathBogus = true;\n        if (wantWidth < 0) {\n            wantWidth = 0;\n        }\n        if (hintWidth < 0) {\n            hintWidth = 0;\n        }\n        let alignment:Layout.Alignment = this.getLayoutAlignment();\n        const testDirChange:boolean = this.mSingleLine && this.mLayout != null && (alignment == Layout.Alignment.ALIGN_NORMAL || alignment == Layout.Alignment.ALIGN_OPPOSITE);\n        let oldDir:number = 0;\n        if (testDirChange)\n            oldDir = this.mLayout.getParagraphDirection(0);\n        let shouldEllipsize:boolean = this.mEllipsize != null && this.getKeyListener() == null;\n        const switchEllipsize:boolean = this.mEllipsize == TruncateAt.MARQUEE && this.mMarqueeFadeMode != TextView.MARQUEE_FADE_NORMAL;\n        let effectiveEllipsize:TruncateAt = this.mEllipsize;\n        if (this.mEllipsize == TruncateAt.MARQUEE && this.mMarqueeFadeMode == TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS) {\n            effectiveEllipsize = TruncateAt.END_SMALL;\n        }\n        if (this.mTextDir == null) {\n            this.mTextDir = this.getTextDirectionHeuristic();\n        }\n        this.mLayout = this.makeSingleLayout(wantWidth, boring, ellipsisWidth, alignment, shouldEllipsize, effectiveEllipsize, effectiveEllipsize == this.mEllipsize);\n        if (switchEllipsize) {\n            let oppositeEllipsize:TruncateAt = effectiveEllipsize == TruncateAt.MARQUEE ? TruncateAt.END : TruncateAt.MARQUEE;\n            this.mSavedMarqueeModeLayout = this.makeSingleLayout(wantWidth, boring, ellipsisWidth, alignment, shouldEllipsize, oppositeEllipsize, effectiveEllipsize != this.mEllipsize);\n        }\n        shouldEllipsize = this.mEllipsize != null;\n        this.mHintLayout = null;\n        if (this.mHint != null) {\n            if (shouldEllipsize)\n                hintWidth = wantWidth;\n            if (hintBoring == TextView.UNKNOWN_BORING) {\n                hintBoring = BoringLayout.isBoring(this.mHint, this.mTextPaint, this.mTextDir, this.mHintBoring);\n                if (hintBoring != null) {\n                    this.mHintBoring = hintBoring;\n                }\n            }\n            if (hintBoring != null) {\n                if (hintBoring.width <= hintWidth && (!shouldEllipsize || hintBoring.width <= ellipsisWidth)) {\n                    if (this.mSavedHintLayout != null) {\n                        this.mHintLayout = this.mSavedHintLayout.replaceOrMake(this.mHint, this.mTextPaint, hintWidth, alignment, this.mSpacingMult, this.mSpacingAdd, hintBoring, this.mIncludePad);\n                    } else {\n                        this.mHintLayout = BoringLayout.make(this.mHint, this.mTextPaint, hintWidth, alignment, this.mSpacingMult, this.mSpacingAdd, hintBoring, this.mIncludePad);\n                    }\n                    this.mSavedHintLayout = <BoringLayout> this.mHintLayout;\n                } else if (shouldEllipsize && hintBoring.width <= hintWidth) {\n                    if (this.mSavedHintLayout != null) {\n                        this.mHintLayout = this.mSavedHintLayout.replaceOrMake(this.mHint, this.mTextPaint, hintWidth, alignment, this.mSpacingMult, this.mSpacingAdd, hintBoring, this.mIncludePad, this.mEllipsize, ellipsisWidth);\n                    } else {\n                        this.mHintLayout = BoringLayout.make(this.mHint, this.mTextPaint, hintWidth, alignment, this.mSpacingMult, this.mSpacingAdd, hintBoring, this.mIncludePad, this.mEllipsize, ellipsisWidth);\n                    }\n                } else if (shouldEllipsize) {\n                    this.mHintLayout = new StaticLayout(this.mHint, 0, this.mHint.length, this.mTextPaint, hintWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad, this.mEllipsize, ellipsisWidth, this.mMaxMode == TextView.LINES ? this.mMaximum : Integer.MAX_VALUE);\n                } else {\n                    this.mHintLayout = new StaticLayout(this.mHint, 0, this.mHint.length, this.mTextPaint, hintWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad);\n                }\n            } else if (shouldEllipsize) {\n                this.mHintLayout = new StaticLayout(this.mHint, 0, this.mHint.length, this.mTextPaint, hintWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad, this.mEllipsize, ellipsisWidth, this.mMaxMode == TextView.LINES ? this.mMaximum : Integer.MAX_VALUE);\n            } else {\n                this.mHintLayout = new StaticLayout(this.mHint, 0, this.mHint.length, this.mTextPaint, hintWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad);\n            }\n        }\n        if (bringIntoView || (testDirChange && oldDir != this.mLayout.getParagraphDirection(0))) {\n            this.registerForPreDraw();\n        }\n        if (this.mEllipsize == TextUtils.TruncateAt.MARQUEE) {\n            if (!this.compressText(ellipsisWidth)) {\n                const height:number = this.mLayoutParams.height;\n                // start the marquee immediately\n                if (height != LayoutParams.WRAP_CONTENT && height != LayoutParams.MATCH_PARENT) {\n                    this.startMarquee();\n                } else {\n                    // Defer the start of the marquee until we know our width (see setFrame())\n                    this.mRestartMarquee = true;\n                }\n            }\n        }\n        // CursorControllers need a non-null mLayout\n        //if (this.mEditor != null)\n        //    this.mEditor.prepareCursorControllers();\n    }\n\n    private makeSingleLayout(wantWidth:number, boring:BoringLayout.Metrics, ellipsisWidth:number, alignment:Layout.Alignment, shouldEllipsize:boolean, effectiveEllipsize:TruncateAt, useSaved:boolean):Layout  {\n        let result:Layout = null;\n        if (Spannable.isImpl(this.mText)) {\n            result = new DynamicLayout(this.mText, this.mTransformed, this.mTextPaint, wantWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad, this.getKeyListener() == null ? effectiveEllipsize : null, ellipsisWidth);\n        } else {\n            if (boring == TextView.UNKNOWN_BORING) {\n                boring = BoringLayout.isBoring(this.mTransformed, this.mTextPaint, this.mTextDir, this.mBoring);\n                if (boring != null) {\n                    this.mBoring = boring;\n                }\n            }\n            if (boring != null) {\n                if (boring.width <= wantWidth && (effectiveEllipsize == null || boring.width <= ellipsisWidth)) {\n                    if (useSaved && this.mSavedLayout != null) {\n                        result = this.mSavedLayout.replaceOrMake(this.mTransformed, this.mTextPaint, wantWidth, alignment, this.mSpacingMult, this.mSpacingAdd, boring, this.mIncludePad);\n                    } else {\n                        result = BoringLayout.make(this.mTransformed, this.mTextPaint, wantWidth, alignment, this.mSpacingMult, this.mSpacingAdd, boring, this.mIncludePad);\n                    }\n                    if (useSaved) {\n                        this.mSavedLayout = <BoringLayout> result;\n                    }\n                } else if (shouldEllipsize && boring.width <= wantWidth) {\n                    if (useSaved && this.mSavedLayout != null) {\n                        result = this.mSavedLayout.replaceOrMake(this.mTransformed, this.mTextPaint, wantWidth, alignment, this.mSpacingMult, this.mSpacingAdd, boring, this.mIncludePad, effectiveEllipsize, ellipsisWidth);\n                    } else {\n                        result = BoringLayout.make(this.mTransformed, this.mTextPaint, wantWidth, alignment, this.mSpacingMult, this.mSpacingAdd, boring, this.mIncludePad, effectiveEllipsize, ellipsisWidth);\n                    }\n                } else if (shouldEllipsize) {\n                    result = new StaticLayout(this.mTransformed, 0, this.mTransformed.length, this.mTextPaint, wantWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad, effectiveEllipsize, ellipsisWidth, this.mMaxMode == TextView.LINES ? this.mMaximum : Integer.MAX_VALUE);\n                } else {\n                    result = new StaticLayout(this.mTransformed, 0, this.mTransformed.length, this.mTextPaint, wantWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad);\n                }\n            } else if (shouldEllipsize) {\n                result = new StaticLayout(this.mTransformed, 0, this.mTransformed.length, this.mTextPaint, wantWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad, effectiveEllipsize, ellipsisWidth, this.mMaxMode == TextView.LINES ? this.mMaximum : Integer.MAX_VALUE);\n            } else {\n                result = new StaticLayout(this.mTransformed, 0, this.mTransformed.length, this.mTextPaint, wantWidth, alignment, this.mTextDir, this.mSpacingMult, this.mSpacingAdd, this.mIncludePad);\n            }\n        }\n        return result;\n    }\n\n    private compressText(width:number):boolean  {\n        if (this.isHardwareAccelerated())\n            return false;\n        // Only compress the text if it hasn't been compressed by the previous pass\n        if (width > 0.0 && this.mLayout != null && this.getLineCount() == 1 && !this.mUserSetTextScaleX && this.mTextPaint.getTextScaleX() == 1.0) {\n            const textWidth:number = this.mLayout.getLineWidth(0);\n            const overflow:number = (textWidth + 1.0 - width) / width;\n            if (overflow > 0.0 && overflow <= TextView.Marquee.MARQUEE_DELTA_MAX) {\n                this.mTextPaint.setTextScaleX(1.0 - overflow - 0.005);\n                this.post((()=>{\n                    const inner_this=this;\n                    class _Inner implements Runnable {\n\n                        run():void  {\n                            inner_this.requestLayout();\n                        }\n                    }\n                    return new _Inner();\n                })());\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private static desired(layout:Layout):number  {\n        let n:number = layout.getLineCount();\n        let text:String = layout.getText();\n        let max:number = 0;\n        for (let i:number = 0; i < n - 1; i++) {\n            if (text.charAt(layout.getLineEnd(i) - 1) != '\\n')\n                return -1;\n        }\n        for (let i:number = 0; i < n; i++) {\n            max = Math.max(max, layout.getLineWidth(i));\n        }\n        return Math.floor(Math.ceil(max));\n    }\n\n    /**\n     * Set whether the TextView includes extra top and bottom padding to make\n     * room for accents that go above the normal ascent and descent.\n     * The default is true.\n     *\n     * @see #getIncludeFontPadding()\n     *\n     * @attr ref android.R.styleable#TextView_includeFontPadding\n     */\n    setIncludeFontPadding(includepad:boolean):void  {\n        if (this.mIncludePad != includepad) {\n            this.mIncludePad = includepad;\n            if (this.mLayout != null) {\n                this.nullLayouts();\n                this.requestLayout();\n                this.invalidate();\n            }\n        }\n    }\n\n    /**\n     * Gets whether the TextView includes extra top and bottom padding to make\n     * room for accents that go above the normal ascent and descent.\n     *\n     * @see #setIncludeFontPadding(boolean)\n     *\n     * @attr ref android.R.styleable#TextView_includeFontPadding\n     */\n    getIncludeFontPadding():boolean  {\n        return this.mIncludePad;\n    }\n\n    private static UNKNOWN_BORING:BoringLayout.Metrics = new BoringLayout.Metrics();\n\n    protected onMeasure(widthMeasureSpec:number, heightMeasureSpec:number):void  {\n        let widthMode:number = View.MeasureSpec.getMode(widthMeasureSpec);\n        let heightMode:number = View.MeasureSpec.getMode(heightMeasureSpec);\n        let widthSize:number = View.MeasureSpec.getSize(widthMeasureSpec);\n        let heightSize:number = View.MeasureSpec.getSize(heightMeasureSpec);\n        let width:number;\n        let height:number;\n        let boring:BoringLayout.Metrics = TextView.UNKNOWN_BORING;\n        let hintBoring:BoringLayout.Metrics = TextView.UNKNOWN_BORING;\n        if (this.mTextDir == null) {\n            this.mTextDir = this.getTextDirectionHeuristic();\n        }\n        let des:number = -1;\n        let fromexisting:boolean = false;\n        if (widthMode == View.MeasureSpec.EXACTLY) {\n            // Parent has told us how big to be. So be it.\n            width = widthSize;\n        } else {\n            if (this.mLayout != null && this.mEllipsize == null) {\n                des = TextView.desired(this.mLayout);\n            }\n            if (des < 0) {\n                boring = BoringLayout.isBoring(this.mTransformed, this.mTextPaint, this.mTextDir, this.mBoring);\n                if (boring != null) {\n                    this.mBoring = boring;\n                }\n            } else {\n                fromexisting = true;\n            }\n            if (boring == null || boring == TextView.UNKNOWN_BORING) {\n                if (des < 0) {\n                    des = Math.floor(Math.ceil(Layout.getDesiredWidth(this.mTransformed, this.mTextPaint)));\n                }\n                width = des;\n            } else {\n                width = boring.width;\n            }\n            const dr:TextView.Drawables = this.mDrawables;\n            if (dr != null) {\n                width = Math.max(width, dr.mDrawableWidthTop);\n                width = Math.max(width, dr.mDrawableWidthBottom);\n            }\n            if (this.mHint != null) {\n                let hintDes:number = -1;\n                let hintWidth:number;\n                if (this.mHintLayout != null && this.mEllipsize == null) {\n                    hintDes = TextView.desired(this.mHintLayout);\n                }\n                if (hintDes < 0) {\n                    hintBoring = BoringLayout.isBoring(this.mHint, this.mTextPaint, this.mTextDir, this.mHintBoring);\n                    if (hintBoring != null) {\n                        this.mHintBoring = hintBoring;\n                    }\n                }\n                if (hintBoring == null || hintBoring == TextView.UNKNOWN_BORING) {\n                    if (hintDes < 0) {\n                        hintDes = Math.floor(Math.ceil(Layout.getDesiredWidth(this.mHint, this.mTextPaint)));\n                    }\n                    hintWidth = hintDes;\n                } else {\n                    hintWidth = hintBoring.width;\n                }\n                if (hintWidth > width) {\n                    width = hintWidth;\n                }\n            }\n            width += this.getCompoundPaddingLeft() + this.getCompoundPaddingRight();\n            if (this.mMaxWidthMode == TextView.EMS) {\n                width = Math.min(width, this.mMaxWidthValue * this.getLineHeight());\n            } else {\n                width = Math.min(width, this.mMaxWidthValue);\n            }\n            if (this.mMinWidthMode == TextView.EMS) {\n                width = Math.max(width, this.mMinWidthValue * this.getLineHeight());\n            } else {\n                width = Math.max(width, this.mMinWidthValue);\n            }\n            // Check against our minimum width\n            width = Math.max(width, this.getSuggestedMinimumWidth());\n            if (widthMode == View.MeasureSpec.AT_MOST) {\n                width = Math.min(widthSize, width);\n            }\n        }\n        let want:number = width - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight();\n        let unpaddedWidth:number = want;\n        if (this.mHorizontallyScrolling)\n            want = TextView.VERY_WIDE;\n        let hintWant:number = want;\n        let hintWidth:number = (this.mHintLayout == null) ? hintWant : this.mHintLayout.getWidth();\n        if (this.mLayout == null) {\n            this.makeNewLayout(want, hintWant, boring, hintBoring, width - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight(), false);\n        } else {\n            const layoutChanged:boolean = (this.mLayout.getWidth() != want) || (hintWidth != hintWant) || (this.mLayout.getEllipsizedWidth() != width - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight());\n            const widthChanged:boolean = (this.mHint == null) && (this.mEllipsize == null) && (want > this.mLayout.getWidth()) && (this.mLayout instanceof BoringLayout || (fromexisting && des >= 0 && des <= want));\n            const maximumChanged:boolean = (this.mMaxMode != this.mOldMaxMode) || (this.mMaximum != this.mOldMaximum);\n            if (layoutChanged || maximumChanged) {\n                if (!maximumChanged && widthChanged) {\n                    this.mLayout.increaseWidthTo(want);\n                } else {\n                    this.makeNewLayout(want, hintWant, boring, hintBoring, width - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight(), false);\n                }\n            } else {\n            // Nothing has changed\n            }\n        }\n        if (heightMode == View.MeasureSpec.EXACTLY) {\n            // Parent has told us how big to be. So be it.\n            height = heightSize;\n            this.mDesiredHeightAtMeasure = -1;\n        } else {\n            let desired:number = this.getDesiredHeight();\n            height = desired;\n            this.mDesiredHeightAtMeasure = desired;\n            if (heightMode == View.MeasureSpec.AT_MOST) {\n                height = Math.min(desired, heightSize);\n            }\n        }\n        let unpaddedHeight:number = height - this.getCompoundPaddingTop() - this.getCompoundPaddingBottom();\n        if (this.mMaxMode == TextView.LINES && this.mLayout.getLineCount() > this.mMaximum) {\n            unpaddedHeight = Math.min(unpaddedHeight, this.mLayout.getLineTop(this.mMaximum));\n        }\n        /*\n         * We didn't let makeNewLayout() register to bring the cursor into view,\n         * so do it here if there is any possibility that it is needed.\n         */\n        if (this.mMovement != null || this.mLayout.getWidth() > unpaddedWidth || this.mLayout.getHeight() > unpaddedHeight) {\n            this.registerForPreDraw();\n        } else {\n            this.scrollTo(0, 0);\n        }\n        this.setMeasuredDimension(width, height);\n    }\n\n    private getDesiredHeight(layout?:Layout, cap=true):number  {\n        if(arguments.length===0){\n            return Math.max(this.getDesiredHeight(this.mLayout, true), this.getDesiredHeight(this.mHintLayout, this.mEllipsize != null));\n        }\n        \n        if (layout == null) {\n            return 0;\n        }\n        let linecount:number = layout.getLineCount();\n        let pad:number = this.getCompoundPaddingTop() + this.getCompoundPaddingBottom();\n        let desired:number = layout.getLineTop(linecount);\n        const dr:TextView.Drawables = this.mDrawables;\n        if (dr != null) {\n            desired = Math.max(desired, dr.mDrawableHeightLeft);\n            desired = Math.max(desired, dr.mDrawableHeightRight);\n        }\n        desired += pad;\n        if (this.mMaxMode == TextView.LINES) {\n            /*\n             * Don't cap the hint to a certain number of lines.\n             * (Do cap it, though, if we have a maximum pixel height.)\n             */\n            if (cap) {\n                if (linecount > this.mMaximum) {\n                    desired = layout.getLineTop(this.mMaximum);\n                    if (dr != null) {\n                        desired = Math.max(desired, dr.mDrawableHeightLeft);\n                        desired = Math.max(desired, dr.mDrawableHeightRight);\n                    }\n                    desired += pad;\n                    linecount = this.mMaximum;\n                }\n            }\n        } else {\n            desired = Math.min(desired, this.mMaximum);\n        }\n        if (this.mMinMode == TextView.LINES) {\n            if (linecount < this.mMinimum) {\n                desired += this.getLineHeight() * (this.mMinimum - linecount);\n            }\n        } else {\n            desired = Math.max(desired, this.mMinimum);\n        }\n        // Check against our minimum height\n        desired = Math.max(desired, this.getSuggestedMinimumHeight());\n        return desired;\n    }\n\n    /**\n     * Check whether a change to the existing text layout requires a\n     * new view layout.\n     */\n    private checkForResize():void  {\n        let sizeChanged:boolean = false;\n        if (this.mLayout != null) {\n            // Check if our width changed\n            if (this.mLayoutParams.width == LayoutParams.WRAP_CONTENT) {\n                sizeChanged = true;\n                this.invalidate();\n            }\n            // Check if our height changed\n            if (this.mLayoutParams.height == LayoutParams.WRAP_CONTENT) {\n                let desiredHeight:number = this.getDesiredHeight();\n                if (desiredHeight != this.getHeight()) {\n                    sizeChanged = true;\n                }\n            } else if (this.mLayoutParams.height == LayoutParams.MATCH_PARENT) {\n                if (this.mDesiredHeightAtMeasure >= 0) {\n                    let desiredHeight:number = this.getDesiredHeight();\n                    if (desiredHeight != this.mDesiredHeightAtMeasure) {\n                        sizeChanged = true;\n                    }\n                }\n            }\n        }\n        if (sizeChanged) {\n            this.requestLayout();\n            // caller will have already invalidated\n        }\n    }\n\n    /**\n     * Check whether entirely new text requires a new view layout\n     * or merely a new text layout.\n     */\n    private checkForRelayout():void  {\n        if ((this.mLayoutParams.width != LayoutParams.WRAP_CONTENT || (this.mMaxWidthMode == this.mMinWidthMode && this.mMaxWidthValue == this.mMinWidthValue)) && (this.mHint == null || this.mHintLayout != null) && (this.mRight - this.mLeft - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight() > 0)) {\n            // Static width, so try making a new text layout.\n            let oldht:number = this.mLayout.getHeight();\n            let want:number = this.mLayout.getWidth();\n            let hintWant:number = this.mHintLayout == null ? 0 : this.mHintLayout.getWidth();\n            /*\n             * No need to bring the text into view, since the size is not\n             * changing (unless we do the requestLayout(), in which case it\n             * will happen at measure).\n             */\n            this.makeNewLayout(want, hintWant, TextView.UNKNOWN_BORING, TextView.UNKNOWN_BORING, this.mRight - this.mLeft - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight(), false);\n            if (this.mEllipsize != TextUtils.TruncateAt.MARQUEE) {\n                // In a fixed-height view, so use our new text layout.\n                if (this.mLayoutParams.height != LayoutParams.WRAP_CONTENT && this.mLayoutParams.height != LayoutParams.MATCH_PARENT) {\n                    this.invalidate();\n                    return;\n                }\n                // so use our new text layout.\n                if (this.mLayout.getHeight() == oldht && (this.mHintLayout == null || this.mHintLayout.getHeight() == oldht)) {\n                    this.invalidate();\n                    return;\n                }\n            }\n            // We lose: the height has changed and we have a dynamic height.\n            // Request a new view layout using our new text layout.\n            this.requestLayout();\n            this.invalidate();\n        } else {\n            // Dynamic width, so we have no choice but to request a new\n            // view layout with a new text layout.\n            this.nullLayouts();\n            this.requestLayout();\n            this.invalidate();\n        }\n    }\n\n    protected onLayout(changed:boolean, left:number, top:number, right:number, bottom:number):void  {\n        super.onLayout(changed, left, top, right, bottom);\n        if (this.mDeferScroll >= 0) {\n            let curs:number = this.mDeferScroll;\n            this.mDeferScroll = -1;\n            this.bringPointIntoView(Math.min(curs, this.mText.length));\n        }\n    }\n\n    private isShowingHint():boolean  {\n        return TextUtils.isEmpty(this.mText) && !TextUtils.isEmpty(this.mHint);\n    }\n\n    /**\n     * Returns true if anything changed.\n     */\n    private bringTextIntoView():boolean  {\n        let layout:Layout = this.isShowingHint() ? this.mHintLayout : this.mLayout;\n        let line:number = 0;\n        if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {\n            line = layout.getLineCount() - 1;\n        }\n        let a:Layout.Alignment = layout.getParagraphAlignment(line);\n        let dir:number = layout.getParagraphDirection(line);\n        let hspace:number = this.mRight - this.mLeft - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight();\n        let vspace:number = this.mBottom - this.mTop - this.getExtendedPaddingTop() - this.getExtendedPaddingBottom();\n        let ht:number = layout.getHeight();\n        let scrollx:number, scrolly:number;\n        // Convert to left, center, or right alignment.\n        if (a == Layout.Alignment.ALIGN_NORMAL) {\n            a = dir == Layout.DIR_LEFT_TO_RIGHT ? Layout.Alignment.ALIGN_LEFT : Layout.Alignment.ALIGN_RIGHT;\n        } else if (a == Layout.Alignment.ALIGN_OPPOSITE) {\n            a = dir == Layout.DIR_LEFT_TO_RIGHT ? Layout.Alignment.ALIGN_RIGHT : Layout.Alignment.ALIGN_LEFT;\n        }\n        if (a == Layout.Alignment.ALIGN_CENTER) {\n            /*\n             * Keep centered if possible, or, if it is too wide to fit,\n             * keep leading edge in view.\n             */\n            let left:number = Math.floor(Math.floor(layout.getLineLeft(line)));\n            let right:number = Math.floor(Math.ceil(layout.getLineRight(line)));\n            if (right - left < hspace) {\n                scrollx = (right + left) / 2 - hspace / 2;\n            } else {\n                if (dir < 0) {\n                    scrollx = right - hspace;\n                } else {\n                    scrollx = left;\n                }\n            }\n        } else if (a == Layout.Alignment.ALIGN_RIGHT) {\n            let right:number = Math.floor(Math.ceil(layout.getLineRight(line)));\n            scrollx = right - hspace;\n        } else {\n            // a == Layout.Alignment.ALIGN_LEFT (will also be the default)\n            scrollx = Math.floor(Math.floor(layout.getLineLeft(line)));\n        }\n        if (ht < vspace) {\n            scrolly = 0;\n        } else {\n            if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {\n                scrolly = ht - vspace;\n            } else {\n                scrolly = 0;\n            }\n        }\n        if (scrollx != this.mScrollX || scrolly != this.mScrollY) {\n            this.scrollTo(scrollx, scrolly);\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * Move the point, specified by the offset, into the view if it is needed.\n     * This has to be called after layout. Returns true if anything changed.\n     */\n    bringPointIntoView(offset:number):boolean  {\n        if (this.isLayoutRequested()) {\n            this.mDeferScroll = offset;\n            return false;\n        }\n        let changed:boolean = false;\n        let layout:Layout = this.isShowingHint() ? this.mHintLayout : this.mLayout;\n        if (layout == null)\n            return changed;\n        let line:number = layout.getLineForOffset(offset);\n        let grav:number;\n        switch(layout.getParagraphAlignment(line)) {\n            case Layout.Alignment.ALIGN_LEFT:\n                grav = 1;\n                break;\n            case Layout.Alignment.ALIGN_RIGHT:\n                grav = -1;\n                break;\n            case Layout.Alignment.ALIGN_NORMAL:\n                grav = layout.getParagraphDirection(line);\n                break;\n            case Layout.Alignment.ALIGN_OPPOSITE:\n                grav = -layout.getParagraphDirection(line);\n                break;\n            case Layout.Alignment.ALIGN_CENTER:\n            default:\n                grav = 0;\n                break;\n        }\n        // We only want to clamp the cursor to fit within the layout width\n        // in left-to-right modes, because in a right to left alignment,\n        // we want to scroll to keep the line-right on the screen, as other\n        // lines are likely to have text flush with the right margin, which\n        // we want to keep visible.\n        // A better long-term solution would probably be to measure both\n        // the full line and a blank-trimmed version, and, for example, use\n        // the latter measurement for centering and right alignment, but for\n        // the time being we only implement the cursor clamping in left to\n        // right where it is most likely to be annoying.\n        const clamped:boolean = grav > 0;\n        // FIXME: Is it okay to truncate this, or should we round?\n        const x:number = Math.floor(layout.getPrimaryHorizontal(offset, clamped));\n        const top:number = layout.getLineTop(line);\n        const bottom:number = layout.getLineTop(line + 1);\n        let left:number = Math.floor(Math.floor(layout.getLineLeft(line)));\n        let right:number = Math.floor(Math.ceil(layout.getLineRight(line)));\n        let ht:number = layout.getHeight();\n        let hspace:number = this.mRight - this.mLeft - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight();\n        let vspace:number = this.mBottom - this.mTop - this.getExtendedPaddingTop() - this.getExtendedPaddingBottom();\n        if (!this.mHorizontallyScrolling && right - left > hspace && right > x) {\n            // If cursor has been clamped, make sure we don't scroll.\n            right = Math.max(x, left + hspace);\n        }\n        let hslack:number = (bottom - top) / 2;\n        let vslack:number = hslack;\n        if (vslack > vspace / 4)\n            vslack = vspace / 4;\n        if (hslack > hspace / 4)\n            hslack = hspace / 4;\n        let hs:number = this.mScrollX;\n        let vs:number = this.mScrollY;\n        if (top - vs < vslack)\n            vs = top - vslack;\n        if (bottom - vs > vspace - vslack)\n            vs = bottom - (vspace - vslack);\n        if (ht - vs < vspace)\n            vs = ht - vspace;\n        if (0 - vs > 0)\n            vs = 0;\n        if (grav != 0) {\n            if (x - hs < hslack) {\n                hs = x - hslack;\n            }\n            if (x - hs > hspace - hslack) {\n                hs = x - (hspace - hslack);\n            }\n        }\n        if (grav < 0) {\n            if (left - hs > 0)\n                hs = left;\n            if (right - hs < hspace)\n                hs = right - hspace;\n        } else if (grav > 0) {\n            if (right - hs < hspace)\n                hs = right - hspace;\n            if (left - hs > 0)\n                hs = left;\n        } else /* grav == 0 */\n        {\n            if (right - left <= hspace) {\n                /*\n                 * If the entire text fits, center it exactly.\n                 */\n                hs = left - (hspace - (right - left)) / 2;\n            } else if (x > right - hslack) {\n                /*\n                 * If we are near the right edge, keep the right edge\n                 * at the edge of the view.\n                 */\n                hs = right - hspace;\n            } else if (x < left + hslack) {\n                /*\n                 * If we are near the left edge, keep the left edge\n                 * at the edge of the view.\n                 */\n                hs = left;\n            } else if (left > hs) {\n                /*\n                 * Is there whitespace visible at the left?  Fix it if so.\n                 */\n                hs = left;\n            } else if (right < hs + hspace) {\n                /*\n                 * Is there whitespace visible at the right?  Fix it if so.\n                 */\n                hs = right - hspace;\n            } else {\n                /*\n                 * Otherwise, float as needed.\n                 */\n                if (x - hs < hslack) {\n                    hs = x - hslack;\n                }\n                if (x - hs > hspace - hslack) {\n                    hs = x - (hspace - hslack);\n                }\n            }\n        }\n        if (hs != this.mScrollX || vs != this.mScrollY) {\n            if (this.mScroller == null) {\n                this.scrollTo(hs, vs);\n            } else {\n                let duration:number = AnimationUtils.currentAnimationTimeMillis() - this.mLastScroll;\n                let dx:number = hs - this.mScrollX;\n                let dy:number = vs - this.mScrollY;\n                if (duration > TextView.ANIMATED_SCROLL_GAP) {\n                    this.mScroller.startScroll(this.mScrollX, this.mScrollY, dx, dy);\n                    this.awakenScrollBars(this.mScroller.getDuration());\n                    this.invalidate();\n                } else {\n                    if (!this.mScroller.isFinished()) {\n                        this.mScroller.abortAnimation();\n                    }\n                    this.scrollBy(dx, dy);\n                }\n                this.mLastScroll = AnimationUtils.currentAnimationTimeMillis();\n            }\n            changed = true;\n        }\n        if (this.isFocused()) {\n            // will be ignored.\n            if (this.mTempRect == null)\n                this.mTempRect = new Rect();\n            this.mTempRect.set(x - 2, top, x + 2, bottom);\n            this.getInterestingRect(this.mTempRect, line);\n            this.mTempRect.offset(this.mScrollX, this.mScrollY);\n            //if (this.requestRectangleOnScreen(this.mTempRect)) {\n            //    changed = true;\n            //}\n        }\n        return changed;\n    }\n\n    /**\n     * Move the cursor, if needed, so that it is at an offset that is visible\n     * to the user.  This will not move the cursor if it represents more than\n     * one character (a selection range).  This will only work if the\n     * TextView contains spannable text; otherwise it will do nothing.\n     *\n     * @return True if the cursor was actually moved, false otherwise.\n     */\n    moveCursorToVisibleOffset():boolean  {\n        //if (!(this.mText instanceof Spannable)) {\n        //    return false;\n        //}\n        //let start:number = this.getSelectionStart();\n        //let end:number = this.getSelectionEnd();\n        //if (start != end) {\n        //    return false;\n        //}\n        //// First: make sure the line is visible on screen:\n        //let line:number = this.mLayout.getLineForOffset(start);\n        //const top:number = this.mLayout.getLineTop(line);\n        //const bottom:number = this.mLayout.getLineTop(line + 1);\n        //const vspace:number = this.mBottom - this.mTop - this.getExtendedPaddingTop() - this.getExtendedPaddingBottom();\n        //let vslack:number = (bottom - top) / 2;\n        //if (vslack > vspace / 4)\n        //    vslack = vspace / 4;\n        //const vs:number = this.mScrollY;\n        //if (top < (vs + vslack)) {\n        //    line = this.mLayout.getLineForVertical(vs + vslack + (bottom - top));\n        //} else if (bottom > (vspace + vs - vslack)) {\n        //    line = this.mLayout.getLineForVertical(vspace + vs - vslack - (bottom - top));\n        //}\n        //// Next: make sure the character is visible on screen:\n        //const hspace:number = this.mRight - this.mLeft - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight();\n        //const hs:number = this.mScrollX;\n        //const leftChar:number = this.mLayout.getOffsetForHorizontal(line, hs);\n        //const rightChar:number = this.mLayout.getOffsetForHorizontal(line, hspace + hs);\n        //// line might contain bidirectional text\n        //const lowChar:number = leftChar < rightChar ? leftChar : rightChar;\n        //const highChar:number = leftChar > rightChar ? leftChar : rightChar;\n        //let newStart:number = start;\n        //if (newStart < lowChar) {\n        //    newStart = lowChar;\n        //} else if (newStart > highChar) {\n        //    newStart = highChar;\n        //}\n        //if (newStart != start) {\n        //    Selection.setSelection(<Spannable> this.mText, newStart);\n        //    return true;\n        //}\n        return false;\n    }\n\n    computeScroll():void  {\n        if (this.mScroller != null) {\n            if (this.mScroller.computeScrollOffset()) {\n                this.mScrollX = this.mScroller.getCurrX();\n                this.mScrollY = this.mScroller.getCurrY();\n                this.invalidateParentCaches();\n                // So we draw again\n                this.postInvalidate();\n            }\n        }\n    }\n\n    private getInterestingRect(r:Rect, line:number):void  {\n        this.convertFromViewportToContentCoordinates(r);\n        // TODO Take left/right padding into account too?\n        if (line == 0)\n            r.top -= this.getExtendedPaddingTop();\n        if (line == this.mLayout.getLineCount() - 1)\n            r.bottom += this.getExtendedPaddingBottom();\n    }\n\n    private convertFromViewportToContentCoordinates(r:Rect):void  {\n        const horizontalOffset:number = this.viewportToContentHorizontalOffset();\n        r.left += horizontalOffset;\n        r.right += horizontalOffset;\n        const verticalOffset:number = this.viewportToContentVerticalOffset();\n        r.top += verticalOffset;\n        r.bottom += verticalOffset;\n    }\n\n    viewportToContentHorizontalOffset():number  {\n        return this.getCompoundPaddingLeft() - this.mScrollX;\n    }\n\n    viewportToContentVerticalOffset():number  {\n        let offset:number = this.getExtendedPaddingTop() - this.mScrollY;\n        if ((this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) != Gravity.TOP) {\n            offset += this.getVerticalOffset(false);\n        }\n        return offset;\n    }\n\n    //debug(depth:number):void  {\n    //    super.debug(depth);\n    //    let output:string = TextView.debugIndent(depth);\n    //    output += \"frame={\" + this.mLeft + \", \" + this.mTop + \", \" + this.mRight + \", \" + this.mBottom + \"} scroll={\" + this.mScrollX + \", \" + this.mScrollY + \"} \";\n    //    if (this.mText != null) {\n    //        output += \"mText=\\\"\" + this.mText + \"\\\" \";\n    //        if (this.mLayout != null) {\n    //            output += \"mLayout width=\" + this.mLayout.getWidth() + \" height=\" + this.mLayout.getHeight();\n    //        }\n    //    } else {\n    //        output += \"mText=NULL\";\n    //    }\n    //    Log.d(TextView.VIEW_LOG_TAG, output);\n    //}\n\n    /**\n     * Convenience for {@link Selection#getSelectionStart}.\n     */\n    getSelectionStart():number  {\n        return -1;\n        //return Selection.getSelectionStart(this.getText());\n    }\n\n    /**\n     * Convenience for {@link Selection#getSelectionEnd}.\n     */\n    getSelectionEnd():number  {\n        return -1;\n        //return Selection.getSelectionEnd(this.getText());\n    }\n\n    /**\n     * Return true iff there is a selection inside this text view.\n     */\n    hasSelection():boolean  {\n        const selectionStart:number = this.getSelectionStart();\n        const selectionEnd:number = this.getSelectionEnd();\n        return selectionStart >= 0 && selectionStart != selectionEnd;\n    }\n\n    ///**\n    // * Sets the properties of this field (lines, horizontally scrolling,\n    // * transformation method) to be for a single-line input.\n    // *\n    // * @attr ref android.R.styleable#TextView_singleLine\n    // */\n    //setSingleLine():void  {\n    //    this.setSingleLine(true);\n    //}\n\n    /**\n     * Sets the properties of this field to transform input to ALL CAPS\n     * display. This may use a \"small caps\" formatting if available.\n     * This setting will be ignored if this field is editable or selectable.\n     *\n     * This call replaces the current transformation method. Disabling this\n     * will not necessarily restore the previous behavior from before this\n     * was enabled.\n     *\n     * @see #setTransformationMethod(TransformationMethod)\n     * @attr ref android.R.styleable#TextView_textAllCaps\n     */\n    setAllCaps(allCaps:boolean):void  {\n        if (allCaps) {\n            this.setTransformationMethod(new AllCapsTransformationMethod());\n        } else {\n            this.setTransformationMethod(null);\n        }\n    }\n\n    /**\n     * If true, sets the properties of this field (number of lines, horizontally scrolling,\n     * transformation method) to be for a single-line input; if false, restores these to the default\n     * conditions.\n     *\n     * Note that the default conditions are not necessarily those that were in effect prior this\n     * method, and you may want to reset these properties to your custom values.\n     *\n     * @attr ref android.R.styleable#TextView_singleLine\n     */\n    setSingleLine(singleLine = true):void  {\n        // Could be used, but may break backward compatibility.\n        if (this.mSingleLine == singleLine) return;\n        this.setInputTypeSingleLine(singleLine);\n        this.applySingleLine(singleLine, true, true);\n    }\n\n    /**\n     * Adds or remove the EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE on the mInputType.\n     * @param singleLine\n     */\n    private setInputTypeSingleLine(singleLine:boolean):void  {\n        //if (this.mEditor != null && (this.mEditor.mInputType & EditorInfo.TYPE_MASK_CLASS) == EditorInfo.TYPE_CLASS_TEXT) {\n        //    if (singleLine) {\n        //        this.mEditor.mInputType &= ~EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;\n        //    } else {\n        //        this.mEditor.mInputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;\n        //    }\n        //}\n    }\n\n    private applySingleLine(singleLine:boolean, applyTransformation:boolean, changeMaxLines:boolean):void  {\n        this.mSingleLine = singleLine;\n        if (singleLine) {\n            this.setLines(1);\n            this.setHorizontallyScrolling(true);\n            if (applyTransformation) {\n                this.setTransformationMethod(SingleLineTransformationMethod.getInstance());\n            }\n        } else {\n            if (changeMaxLines) {\n                this.setMaxLines(Integer.MAX_VALUE);\n            }\n            this.setHorizontallyScrolling(false);\n            if (applyTransformation) {\n                this.setTransformationMethod(null);\n            }\n        }\n    }\n\n    /**\n     * Causes words in the text that are longer than the view is wide\n     * to be ellipsized instead of broken in the middle.  You may also\n     * want to {@link #setSingleLine} or {@link #setHorizontallyScrolling}\n     * to constrain the text to a single line.  Use <code>null</code>\n     * to turn off ellipsizing.\n     *\n     * If {@link #setMaxLines} has been used to set two or more lines,\n     * {@link android.text.TextUtils.TruncateAt#END} and\n     * {@link android.text.TextUtils.TruncateAt#MARQUEE}* are only supported\n     * (other ellipsizing types will not do anything).\n     *\n     * @attr ref android.R.styleable#TextView_ellipsize\n     */\n    setEllipsize(where:TextUtils.TruncateAt):void  {\n        // TruncateAt is an enum. != comparison is ok between these singleton objects.\n        if (this.mEllipsize != where) {\n            this.mEllipsize = where;\n            if (this.mLayout != null) {\n                this.nullLayouts();\n                this.requestLayout();\n                this.invalidate();\n            }\n        }\n    }\n\n    /**\n     * Sets how many times to repeat the marquee animation. Only applied if the\n     * TextView has marquee enabled. Set to -1 to repeat indefinitely.\n     *\n     * @see #getMarqueeRepeatLimit()\n     *\n     * @attr ref android.R.styleable#TextView_marqueeRepeatLimit\n     */\n    setMarqueeRepeatLimit(marqueeLimit:number):void  {\n        this.mMarqueeRepeatLimit = marqueeLimit;\n    }\n\n    /**\n     * Gets the number of times the marquee animation is repeated. Only meaningful if the\n     * TextView has marquee enabled.\n     *\n     * @return the number of times the marquee animation is repeated. -1 if the animation\n     * repeats indefinitely\n     *\n     * @see #setMarqueeRepeatLimit(int)\n     *\n     * @attr ref android.R.styleable#TextView_marqueeRepeatLimit\n     */\n    getMarqueeRepeatLimit():number  {\n        return this.mMarqueeRepeatLimit;\n    }\n\n    /**\n     * Returns where, if anywhere, words that are longer than the view\n     * is wide should be ellipsized.\n     */\n    getEllipsize():TextUtils.TruncateAt  {\n        return this.mEllipsize;\n    }\n\n    /**\n     * Set the TextView so that when it takes focus, all the text is\n     * selected.\n     *\n     * @attr ref android.R.styleable#TextView_selectAllOnFocus\n     */\n    setSelectAllOnFocus(selectAllOnFocus:boolean):void  {\n        this.createEditorIfNeeded();\n        this.mEditor.mSelectAllOnFocus = selectAllOnFocus;\n        if (selectAllOnFocus && !Spannable.isImpl(this.mText)) {\n            this.setText(this.mText, TextView.BufferType.SPANNABLE);\n        }\n    }\n\n    /**\n     * Set whether the cursor is visible. The default is true. Note that this property only\n     * makes sense for editable TextView.\n     *\n     * @see #isCursorVisible()\n     *\n     * @attr ref android.R.styleable#TextView_cursorVisible\n     */\n    setCursorVisible(visible:boolean):void  {\n        // visible is the default value with no edit data\n        //if (visible && this.mEditor == null)\n        //    return;\n        //this.createEditorIfNeeded();\n        //if (this.mEditor.mCursorVisible != visible) {\n        //    this.mEditor.mCursorVisible = visible;\n        //    this.invalidate();\n        //    this.mEditor.makeBlink();\n        //    // InsertionPointCursorController depends on mCursorVisible\n        //    this.mEditor.prepareCursorControllers();\n        //}\n    }\n\n    /**\n     * @return whether or not the cursor is visible (assuming this TextView is editable)\n     *\n     * @see #setCursorVisible(boolean)\n     *\n     * @attr ref android.R.styleable#TextView_cursorVisible\n     */\n    isCursorVisible():boolean  {\n        // true is the default value\n        return null;\n        //return this.mEditor == null ? true : this.mEditor.mCursorVisible;\n    }\n\n    private canMarquee():boolean  {\n        let width:number = (this.mRight - this.mLeft - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight());\n        return width > 0 && (this.mLayout.getLineWidth(0) > width || (this.mMarqueeFadeMode != TextView.MARQUEE_FADE_NORMAL && this.mSavedMarqueeModeLayout != null && this.mSavedMarqueeModeLayout.getLineWidth(0) > width));\n    }\n\n    private startMarquee():void  {\n        // Do not ellipsize EditText\n        if (this.getKeyListener() != null)\n            return;\n        if (this.compressText(this.getWidth() - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight())) {\n            return;\n        }\n        if ((this.mMarquee == null || this.mMarquee.isStopped()) && (this.isFocused() || this.isSelected()) && this.getLineCount() == 1 && this.canMarquee()) {\n            if (this.mMarqueeFadeMode == TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS) {\n                this.mMarqueeFadeMode = TextView.MARQUEE_FADE_SWITCH_SHOW_FADE;\n                const tmp:Layout = this.mLayout;\n                this.mLayout = this.mSavedMarqueeModeLayout;\n                this.mSavedMarqueeModeLayout = tmp;\n                this.setHorizontalFadingEdgeEnabled(true);\n                this.requestLayout();\n                this.invalidate();\n            }\n            if (this.mMarquee == null)\n                this.mMarquee = new TextView.Marquee(this);\n            this.mMarquee.start(this.mMarqueeRepeatLimit);\n        }\n    }\n\n    private stopMarquee():void  {\n        if (this.mMarquee != null && !this.mMarquee.isStopped()) {\n            this.mMarquee.stop();\n        }\n        if (this.mMarqueeFadeMode == TextView.MARQUEE_FADE_SWITCH_SHOW_FADE) {\n            this.mMarqueeFadeMode = TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS;\n            const tmp:Layout = this.mSavedMarqueeModeLayout;\n            this.mSavedMarqueeModeLayout = this.mLayout;\n            this.mLayout = tmp;\n            this.setHorizontalFadingEdgeEnabled(false);\n            this.requestLayout();\n            this.invalidate();\n        }\n    }\n\n    private startStopMarquee(start:boolean):void  {\n        if (this.mEllipsize == TextUtils.TruncateAt.MARQUEE) {\n            if (start) {\n                this.startMarquee();\n            } else {\n                this.stopMarquee();\n            }\n        }\n    }\n\n    /**\n     * This method is called when the text is changed, in case any subclasses\n     * would like to know.\n     *\n     * Within <code>text</code>, the <code>lengthAfter</code> characters\n     * beginning at <code>start</code> have just replaced old text that had\n     * length <code>lengthBefore</code>. It is an error to attempt to make\n     * changes to <code>text</code> from this callback.\n     *\n     * @param text The text the TextView is displaying\n     * @param start The offset of the start of the range of the text that was\n     * modified\n     * @param lengthBefore The length of the former text that has been replaced\n     * @param lengthAfter The length of the replacement modified text\n     */\n    protected onTextChanged(text:String, start:number, lengthBefore:number, lengthAfter:number):void  {\n    // intentionally empty, template pattern method can be overridden by subclasses\n    }\n\n    /**\n     * This method is called when the selection has changed, in case any\n     * subclasses would like to know.\n     *\n     * @param selStart The new selection start location.\n     * @param selEnd The new selection end location.\n     */\n    protected onSelectionChanged(selStart:number, selEnd:number):void  {\n        //this.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED);\n    }\n\n    /**\n     * Adds a TextWatcher to the list of those whose methods are called\n     * whenever this TextView's text changes.\n     * <p>\n     * In 1.0, the {@link TextWatcher#afterTextChanged} method was erroneously\n     * not called after {@link #setText} calls.  Now, doing {@link #setText}\n     * if there are any text changed listeners forces the buffer type to\n     * Editable if it would not otherwise be and does call this method.\n     */\n    addTextChangedListener(watcher:TextWatcher):void  {\n        if (this.mListeners == null) {\n            this.mListeners = new ArrayList<TextWatcher>();\n        }\n        this.mListeners.add(watcher);\n    }\n\n    /**\n     * Removes the specified TextWatcher from the list of those whose\n     * methods are called\n     * whenever this TextView's text changes.\n     */\n    removeTextChangedListener(watcher:TextWatcher):void  {\n        if (this.mListeners != null) {\n            let i:number = this.mListeners.indexOf(watcher);\n            if (i >= 0) {\n                this.mListeners.remove(i);\n            }\n        }\n    }\n\n    private sendBeforeTextChanged(text:String, start:number, before:number, after:number):void  {\n        if (this.mListeners != null) {\n            const list:ArrayList<TextWatcher> = this.mListeners;\n            const count:number = list.size();\n            for (let i:number = 0; i < count; i++) {\n                list.get(i).beforeTextChanged(text, start, before, after);\n            }\n        }\n        // The spans that are inside or intersect the modified region no longer make sense\n        //this.removeIntersectingNonAdjacentSpans(start, start + before, SpellCheckSpan.class);\n        //this.removeIntersectingNonAdjacentSpans(start, start + before, SuggestionSpan.class);\n    }\n\n    // Removes all spans that are inside or actually overlap the start..end range\n    //private removeIntersectingNonAdjacentSpans<T> (start:number, end:number, type:Class<T>):void  {\n    //    if (!(this.mText instanceof Editable))\n    //        return;\n    //    let text:Editable = <Editable> this.mText;\n    //    let spans:T[] = text.getSpans(start, end, type);\n    //    const length:number = spans.length;\n    //    for (let i:number = 0; i < length; i++) {\n    //        const spanStart:number = text.getSpanStart(spans[i]);\n    //        const spanEnd:number = text.getSpanEnd(spans[i]);\n    //        if (spanEnd == start || spanStart == end)\n    //            break;\n    //        text.removeSpan(spans[i]);\n    //    }\n    //}\n\n    removeAdjacentSuggestionSpans(pos:number):void  {\n        //if (!(this.mText instanceof Editable))\n        //    return;\n        //const text:Editable = <Editable> this.mText;\n        //const spans:SuggestionSpan[] = text.getSpans(pos, pos, SuggestionSpan.class);\n        //const length:number = spans.length;\n        //for (let i:number = 0; i < length; i++) {\n        //    const spanStart:number = text.getSpanStart(spans[i]);\n        //    const spanEnd:number = text.getSpanEnd(spans[i]);\n        //    if (spanEnd == pos || spanStart == pos) {\n        //        if (SpellChecker.haveWordBoundariesChanged(text, pos, pos, spanStart, spanEnd)) {\n        //            text.removeSpan(spans[i]);\n        //        }\n        //    }\n        //}\n    }\n\n    /**\n     * Not private so it can be called from an inner class without going\n     * through a thunk.\n     */\n    sendOnTextChanged(text:String, start:number, before:number, after:number):void  {\n        if (this.mListeners != null) {\n            const list:ArrayList<TextWatcher> = this.mListeners;\n            const count:number = list.size();\n            for (let i:number = 0; i < count; i++) {\n                list.get(i).onTextChanged(text, start, before, after);\n            }\n        }\n        //if (this.mEditor != null)\n        //    this.mEditor.sendOnTextChanged(start, after);\n    }\n\n    /**\n     * Not private so it can be called from an inner class without going\n     * through a thunk.\n     */\n    sendAfterTextChanged(text:any):void  {\n        if (this.mListeners != null) {\n            const list:ArrayList<TextWatcher> = this.mListeners;\n            const count:number = list.size();\n            for (let i:number = 0; i < count; i++) {\n                list.get(i).afterTextChanged(text+'');\n            }\n        }\n    }\n\n    updateAfterEdit():void  {\n        this.invalidate();\n        let curs:number = this.getSelectionStart();\n        if (curs >= 0 || (this.mGravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {\n            this.registerForPreDraw();\n        }\n        this.checkForResize();\n        if (curs >= 0) {\n            this.mHighlightPathBogus = true;\n            //if (this.mEditor != null)\n            //    this.mEditor.makeBlink();\n            this.bringPointIntoView(curs);\n        }\n    }\n\n    /**\n     * Not private so it can be called from an inner class without going\n     * through a thunk.\n     */\n    handleTextChanged(buffer:String, start:number, before:number, after:number):void  {\n        //const ims:Editor.InputMethodState = this.mEditor == null ? null : this.mEditor.mInputMethodState;\n        //if (ims == null || ims.mBatchEditNesting == 0) {\n            this.updateAfterEdit();\n        //}\n        //if (ims != null) {\n        //    ims.mContentChanged = true;\n        //    if (ims.mChangedStart < 0) {\n        //        ims.mChangedStart = start;\n        //        ims.mChangedEnd = start + before;\n        //    } else {\n        //        ims.mChangedStart = Math.min(ims.mChangedStart, start);\n        //        ims.mChangedEnd = Math.max(ims.mChangedEnd, start + before - ims.mChangedDelta);\n        //    }\n        //    ims.mChangedDelta += after - before;\n        //}\n        this.sendOnTextChanged(buffer, start, before, after);\n        this.onTextChanged(buffer, start, before, after);\n    }\n\n    /**\n     * Not private so it can be called from an inner class without going\n     * through a thunk.\n     */\n    spanChange(buf:Spanned, what:any, oldStart:number, newStart:number, oldEnd:number, newEnd:number):void  {\n        // XXX Make the start and end move together if this ends up\n        // spending too much time invalidating.\n        let selChanged:boolean = false;\n        let newSelStart:number = -1, newSelEnd:number = -1;\n        //const ims:Editor.InputMethodState = this.mEditor == null ? null : this.mEditor.mInputMethodState;\n        //if (what == Selection.SELECTION_END) {\n        //    selChanged = true;\n        //    newSelEnd = newStart;\n        //    if (oldStart >= 0 || newStart >= 0) {\n        //        this.invalidateCursor(Selection.getSelectionStart(buf), oldStart, newStart);\n        //        this.checkForResize();\n        //        this.registerForPreDraw();\n        //        if (this.mEditor != null)\n        //            this.mEditor.makeBlink();\n        //    }\n        //}\n        //if (what == Selection.SELECTION_START) {\n        //    selChanged = true;\n        //    newSelStart = newStart;\n        //    if (oldStart >= 0 || newStart >= 0) {\n        //        let end:number = Selection.getSelectionEnd(buf);\n        //        this.invalidateCursor(end, oldStart, newStart);\n        //    }\n        //}\n        //if (selChanged) {\n        //    this.mHighlightPathBogus = true;\n        //    if (this.mEditor != null && !this.isFocused())\n        //        this.mEditor.mSelectionMoved = true;\n        //    if ((buf.getSpanFlags(what) & Spanned.SPAN_INTERMEDIATE) == 0) {\n        //        if (newSelStart < 0) {\n        //            newSelStart = Selection.getSelectionStart(buf);\n        //        }\n        //        if (newSelEnd < 0) {\n        //            newSelEnd = Selection.getSelectionEnd(buf);\n        //        }\n        //        this.onSelectionChanged(newSelStart, newSelEnd);\n        //    }\n        //}\n        //if (what instanceof UpdateAppearance || what instanceof ParagraphStyle || what instanceof CharacterStyle) {\n            //if (ims == null || ims.mBatchEditNesting == 0) {\n                this.invalidate();\n                this.mHighlightPathBogus = true;\n                this.checkForResize();\n            //} else {\n            //    ims.mContentChanged = true;\n            //}\n            //if (this.mEditor != null) {\n            //    if (oldStart >= 0)\n            //        this.mEditor.invalidateTextDisplayList(this.mLayout, oldStart, oldEnd);\n            //    if (newStart >= 0)\n            //        this.mEditor.invalidateTextDisplayList(this.mLayout, newStart, newEnd);\n            //}\n        //}\n        //if (MetaKeyKeyListener.isMetaTracker(buf, what)) {\n        //    this.mHighlightPathBogus = true;\n        //    if (ims != null && MetaKeyKeyListener.isSelectingMetaTracker(buf, what)) {\n        //        ims.mSelectionModeChanged = true;\n        //    }\n        //    if (Selection.getSelectionStart(buf) >= 0) {\n        //        if (ims == null || ims.mBatchEditNesting == 0) {\n        //            this.invalidateCursor();\n        //        } else {\n        //            ims.mCursorChanged = true;\n        //        }\n        //    }\n        //}\n        //if (what instanceof ParcelableSpan) {\n        //    // the current extract editor would be interested in it.\n        //    if (ims != null && ims.mExtractedTextRequest != null) {\n        //        if (ims.mBatchEditNesting != 0) {\n        //            if (oldStart >= 0) {\n        //                if (ims.mChangedStart > oldStart) {\n        //                    ims.mChangedStart = oldStart;\n        //                }\n        //                if (ims.mChangedStart > oldEnd) {\n        //                    ims.mChangedStart = oldEnd;\n        //                }\n        //            }\n        //            if (newStart >= 0) {\n        //                if (ims.mChangedStart > newStart) {\n        //                    ims.mChangedStart = newStart;\n        //                }\n        //                if (ims.mChangedStart > newEnd) {\n        //                    ims.mChangedStart = newEnd;\n        //                }\n        //            }\n        //        } else {\n        //            if (TextView.DEBUG_EXTRACT)\n        //                Log.v(TextView.LOG_TAG, \"Span change outside of batch: \" + oldStart + \"-\" + oldEnd + \",\" + newStart + \"-\" + newEnd + \" \" + what);\n        //            ims.mContentChanged = true;\n        //        }\n        //    }\n        //}\n        //if (this.mEditor != null && this.mEditor.mSpellChecker != null && newStart < 0 && what instanceof SpellCheckSpan) {\n        //    this.mEditor.mSpellChecker.onSpellCheckSpanRemoved(<SpellCheckSpan> what);\n        //}\n    }\n\n    /**\n     * @hide\n     */\n    dispatchFinishTemporaryDetach():void  {\n        this.mDispatchTemporaryDetach = true;\n        super.dispatchFinishTemporaryDetach();\n        this.mDispatchTemporaryDetach = false;\n    }\n\n    onStartTemporaryDetach():void  {\n        super.onStartTemporaryDetach();\n        // usually because this instance is an editable field in a list\n        if (!this.mDispatchTemporaryDetach)\n            this.mTemporaryDetach = true;\n        // selection state as needed.\n        //if (this.mEditor != null)\n        //    this.mEditor.mTemporaryDetach = true;\n    }\n\n    onFinishTemporaryDetach():void  {\n        super.onFinishTemporaryDetach();\n        // usually because this instance is an editable field in a list\n        if (!this.mDispatchTemporaryDetach)\n            this.mTemporaryDetach = false;\n        //if (this.mEditor != null)\n        //    this.mEditor.mTemporaryDetach = false;\n    }\n\n    protected onFocusChanged(focused:boolean, direction:number, previouslyFocusedRect:Rect):void  {\n        if (this.mTemporaryDetach) {\n            // If we are temporarily in the detach state, then do nothing.\n            super.onFocusChanged(focused, direction, previouslyFocusedRect);\n            return;\n        }\n        //if (this.mEditor != null)\n        //    this.mEditor.onFocusChanged(focused, direction);\n        //if (focused) {\n        //    if (this.mText instanceof Spannable) {\n        //        let sp:Spannable = <Spannable> this.mText;\n        //        MetaKeyKeyListener.resetMetaState(sp);\n        //    }\n        //}\n        this.startStopMarquee(focused);\n        if (this.mTransformation != null) {\n            this.mTransformation.onFocusChanged(this, this.mText, focused, direction, previouslyFocusedRect);\n        }\n        super.onFocusChanged(focused, direction, previouslyFocusedRect);\n    }\n\n    onWindowFocusChanged(hasWindowFocus:boolean):void  {\n        super.onWindowFocusChanged(hasWindowFocus);\n        //if (this.mEditor != null)\n        //    this.mEditor.onWindowFocusChanged(hasWindowFocus);\n        this.startStopMarquee(hasWindowFocus);\n    }\n\n    protected onVisibilityChanged(changedView:View, visibility:number):void  {\n        super.onVisibilityChanged(changedView, visibility);\n        //if (this.mEditor != null && visibility != TextView.VISIBLE) {\n        //    this.mEditor.hideControllers();\n        //}\n    }\n\n    /**\n     * Use {@link BaseInputConnection#removeComposingSpans\n     * BaseInputConnection.removeComposingSpans()} to remove any IME composing\n     * state from this text view.\n     */\n    clearComposingText():void  {\n        //if (this.mText instanceof Spannable) {\n        //    BaseInputConnection.removeComposingSpans(<Spannable> this.mText);\n        //}\n    }\n\n    setSelected(selected:boolean):void  {\n        let wasSelected:boolean = this.isSelected();\n        super.setSelected(selected);\n        if (selected != wasSelected && this.mEllipsize == TextUtils.TruncateAt.MARQUEE) {\n            if (selected) {\n                this.startMarquee();\n            } else {\n                this.stopMarquee();\n            }\n        }\n    }\n\n    onTouchEvent(event:MotionEvent):boolean  {\n        const action:number = event.getActionMasked();\n        //if (this.mEditor != null)\n        //    this.mEditor.onTouchEvent(event);\n        const superResult:boolean = super.onTouchEvent(event);\n        /*\n         * Don't handle the release after a long press, because it will\n         * move the selection away from whatever the menu action was\n         * trying to affect.\n         */\n        //if (this.mEditor != null && this.mEditor.mDiscardNextActionUp && action == MotionEvent.ACTION_UP) {\n        //    this.mEditor.mDiscardNextActionUp = false;\n        //    return superResult;\n        //}\n        const touchIsFinished:boolean = (action == MotionEvent.ACTION_UP)\n            //&& (this.mEditor == null || !this.mEditor.mIgnoreActionUpEvent)\n            && this.isFocused();\n        if ((this.mMovement != null || this.onCheckIsTextEditor()) && this.isEnabled() && Spannable.isImpl(this.mText) && this.mLayout != null) {\n            let handled:boolean = false;\n            if (this.mMovement != null) {\n                handled = this.mMovement.onTouchEvent(this, <Spannable> this.mText, event) || handled;\n            }\n            //const textIsSelectable:boolean = this.isTextSelectable();\n            //if (touchIsFinished && this.mLinksClickable && this.mAutoLinkMask != 0 && textIsSelectable) {\n            //    // The LinkMovementMethod which should handle taps on links has not been installed\n            //    // on non editable text that support text selection.\n            //    // We reproduce its behavior here to open links for these.\n            //    let links:ClickableSpan[] = (<Spannable> this.mText).getSpans(this.getSelectionStart(), this.getSelectionEnd(), ClickableSpan.class);\n            //    if (links.length > 0) {\n            //        links[0].onClick(this);\n            //        handled = true;\n            //    }\n            //}\n            //if (touchIsFinished && (this.isTextEditable() || textIsSelectable)) {\n            //    // Show the IME, except when selecting in read-only text.\n            //    const imm:InputMethodManager = InputMethodManager.peekInstance();\n            //    this.viewClicked(imm);\n            //    if (!textIsSelectable && this.mEditor.mShowSoftInputOnFocus) {\n            //        handled |= imm != null && imm.showSoftInput(this, 0);\n            //    }\n            //    // The above condition ensures that the mEditor is not null\n            //    this.mEditor.onTouchUpEvent(event);\n            //    handled = true;\n            //}\n            if (handled) {\n                return true;\n            }\n        }\n        return superResult;\n    }\n\n    onGenericMotionEvent(event:MotionEvent):boolean  {\n        if (this.mMovement != null && Spannable.isImpl(this.mText) && this.mLayout != null) {\n            try {\n                if (this.mMovement.onGenericMotionEvent(this, <Spannable> this.mText, event)) {\n                    return true;\n                }\n            } catch (e){\n            }\n        }\n        return super.onGenericMotionEvent(event);\n    }\n\n    /**\n     * @return True iff this TextView contains a text that can be edited, or if this is\n     * a selectable TextView.\n     */\n    isTextEditable():boolean  {\n        return false;\n        //return this.mText instanceof Editable && this.onCheckIsTextEditor() && this.isEnabled();\n    }\n\n    /**\n     * Returns true, only while processing a touch gesture, if the initial\n     * touch down event caused focus to move to the text view and as a result\n     * its selection changed.  Only valid while processing the touch gesture\n     * of interest, in an editable text view.\n     */\n    didTouchFocusSelect():boolean  {\n        return false;\n        //return this.mEditor != null && this.mEditor.mTouchFocusSelected;\n    }\n\n    cancelLongPress():void  {\n        super.cancelLongPress();\n        //if (this.mEditor != null)\n        //    this.mEditor.mIgnoreActionUpEvent = true;\n    }\n\n    //onTrackballEvent(event:MotionEvent):boolean  {\n    //    if (this.mMovement != null && Spannable.isImpl(this.mText) && this.mLayout != null) {\n    //        if (this.mMovement.onTrackballEvent(this, <Spannable> this.mText, event)) {\n    //            return true;\n    //        }\n    //    }\n    //    return super.onTrackballEvent(event);\n    //}\n\n    setScroller(s:OverScroller):void  {\n        this.mScroller = s;\n    }\n\n    protected getLeftFadingEdgeStrength():number  {\n        if (this.mEllipsize == TextUtils.TruncateAt.MARQUEE && this.mMarqueeFadeMode != TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS) {\n            if (this.mMarquee != null && !this.mMarquee.isStopped()) {\n                const marquee:TextView.Marquee = this.mMarquee;\n                if (marquee.shouldDrawLeftFade()) {\n                    const scroll:number = marquee.getScroll();\n                    return scroll / this.getHorizontalFadingEdgeLength();\n                } else {\n                    return 0.0;\n                }\n            } else if (this.getLineCount() == 1) {\n                //const layoutDirection:number = this.getLayoutDirection();\n                const absoluteGravity:number = this.mGravity;//Gravity.getAbsoluteGravity(this.mGravity, layoutDirection);\n                switch(absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n                    case Gravity.LEFT:\n                        return 0.0;\n                    case Gravity.RIGHT:\n                        return (this.mLayout.getLineRight(0) - (this.mRight - this.mLeft) - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight() - this.mLayout.getLineLeft(0)) / this.getHorizontalFadingEdgeLength();\n                    case Gravity.CENTER_HORIZONTAL:\n                    case Gravity.FILL_HORIZONTAL:\n                        const textDirection:number = this.mLayout.getParagraphDirection(0);\n                        if (textDirection == Layout.DIR_LEFT_TO_RIGHT) {\n                            return 0.0;\n                        } else {\n                            return (this.mLayout.getLineRight(0) - (this.mRight - this.mLeft) - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight() - this.mLayout.getLineLeft(0)) / this.getHorizontalFadingEdgeLength();\n                        }\n                }\n            }\n        }\n        return super.getLeftFadingEdgeStrength();\n    }\n\n    protected getRightFadingEdgeStrength():number  {\n        if (this.mEllipsize == TextUtils.TruncateAt.MARQUEE && this.mMarqueeFadeMode != TextView.MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS) {\n            if (this.mMarquee != null && !this.mMarquee.isStopped()) {\n                const marquee:TextView.Marquee = this.mMarquee;\n                const maxFadeScroll:number = marquee.getMaxFadeScroll();\n                const scroll:number = marquee.getScroll();\n                return (maxFadeScroll - scroll) / this.getHorizontalFadingEdgeLength();\n            } else if (this.getLineCount() == 1) {\n                //const layoutDirection:number = this.getLayoutDirection();\n                const absoluteGravity:number = this.mGravity;//Gravity.getAbsoluteGravity(this.mGravity, layoutDirection);\n                switch(absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {\n                    case Gravity.LEFT:\n                        const textWidth:number = (this.mRight - this.mLeft) - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight();\n                        const lineWidth:number = this.mLayout.getLineWidth(0);\n                        return (lineWidth - textWidth) / this.getHorizontalFadingEdgeLength();\n                    case Gravity.RIGHT:\n                        return 0.0;\n                    case Gravity.CENTER_HORIZONTAL:\n                    case Gravity.FILL_HORIZONTAL:\n                        const textDirection:number = this.mLayout.getParagraphDirection(0);\n                        if (textDirection == Layout.DIR_RIGHT_TO_LEFT) {\n                            return 0.0;\n                        } else {\n                            return (this.mLayout.getLineWidth(0) - ((this.mRight - this.mLeft) - this.getCompoundPaddingLeft() - this.getCompoundPaddingRight())) / this.getHorizontalFadingEdgeLength();\n                        }\n                }\n            }\n        }\n        return super.getRightFadingEdgeStrength();\n    }\n\n    protected computeHorizontalScrollRange():number  {\n        if (this.mLayout != null) {\n            return this.mSingleLine && (this.mGravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.LEFT ? Math.floor(this.mLayout.getLineWidth(0)) : this.mLayout.getWidth();\n        }\n        return super.computeHorizontalScrollRange();\n    }\n\n    protected computeVerticalScrollRange():number  {\n        if (this.mLayout != null)\n            return this.mLayout.getHeight();\n        return super.computeVerticalScrollRange();\n    }\n\n    protected computeVerticalScrollExtent():number  {\n        return this.getHeight() - this.getCompoundPaddingTop() - this.getCompoundPaddingBottom();\n    }\n\n    //findViewsWithText(outViews:ArrayList<View>, searched:String, flags:number):void  {\n    //    super.findViewsWithText(outViews, searched, flags);\n    //    if (!outViews.contains(this) && (flags & TextView.FIND_VIEWS_WITH_TEXT) != 0 && !TextUtils.isEmpty(searched) && !TextUtils.isEmpty(this.mText)) {\n    //        let searchedLowerCase:string = searched.toString().toLowerCase();\n    //        let textLowerCase:string = this.mText.toString().toLowerCase();\n    //        if (textLowerCase.contains(searchedLowerCase)) {\n    //            outViews.add(this);\n    //        }\n    //    }\n    //}\n\n\n\n    /**\n     * Returns the TextView_textColor attribute from the\n     * TypedArray, if set, or the TextAppearance_textColor\n     * from the TextView_textAppearance attribute, if TextView_textColor\n     * was not set directly.\n     */\n    static getTextColors():ColorStateList  {\n        return android.R.color.textView_textColor;\n    }\n\n    /**\n     * Returns the default color from the TextView_textColor attribute\n     * from the AttributeSet, if set, or the default color from the\n     * TextAppearance_textColor from the TextView_textAppearance attribute,\n     * if TextView_textColor was not set directly.\n     */\n    static getTextColor(def:number):number  {\n        let colors:ColorStateList = this.getTextColors();\n        if (colors == null) {\n            return def;\n        } else {\n            return colors.getDefaultColor();\n        }\n    }\n\n    //onKeyShortcut(keyCode:number, event:KeyEvent):boolean  {\n    //    const filteredMetaState:number = event.getMetaState() & ~KeyEvent.META_CTRL_MASK;\n    //    if (KeyEvent.metaStateHasNoModifiers(filteredMetaState)) {\n    //        switch(keyCode) {\n    //            case KeyEvent.KEYCODE_A:\n    //                if (this.canSelectText()) {\n    //                    return this.onTextContextMenuItem(TextView.ID_SELECT_ALL);\n    //                }\n    //                break;\n    //            case KeyEvent.KEYCODE_X:\n    //                if (this.canCut()) {\n    //                    return this.onTextContextMenuItem(TextView.ID_CUT);\n    //                }\n    //                break;\n    //            case KeyEvent.KEYCODE_C:\n    //                if (this.canCopy()) {\n    //                    return this.onTextContextMenuItem(TextView.ID_COPY);\n    //                }\n    //                break;\n    //            case KeyEvent.KEYCODE_V:\n    //                if (this.canPaste()) {\n    //                    return this.onTextContextMenuItem(TextView.ID_PASTE);\n    //                }\n    //                break;\n    //        }\n    //    }\n    //    return super.onKeyShortcut(keyCode, event);\n    //}\n\n    /**\n     * Unlike {@link #textCanBeSelected()}, this method is based on the <i>current</i> state of the\n     * TextView. {@link #textCanBeSelected()} has to be true (this is one of the conditions to have\n     * a selection controller (see {@link Editor#prepareCursorControllers()}), but this is not\n     * sufficient.\n     */\n    private canSelectText():boolean  {\n        return false;\n        //return this.mText.length() != 0 && this.mEditor != null && this.mEditor.hasSelectionController();\n    }\n\n    /**\n     * Test based on the <i>intrinsic</i> charateristics of the TextView.\n     * The text must be spannable and the movement method must allow for arbitary selection.\n     *\n     * See also {@link #canSelectText()}.\n     */\n    textCanBeSelected():boolean  {\n        return false;\n        //// the value of this condition might be changed.\n        //if (this.mMovement == null || !this.mMovement.canSelectArbitrarily())\n        //    return false;\n        //return this.isTextEditable() || (this.isTextSelectable() && this.mText instanceof Spannable && this.isEnabled());\n    }\n\n    //private getTextServicesLocale(allowNullLocale:boolean):Locale  {\n    //    // Start fetching the text services locale asynchronously.\n    //    this.updateTextServicesLocaleAsync();\n    //    // locale.\n    //    return (this.mCurrentSpellCheckerLocaleCache == null && !allowNullLocale) ? Locale.getDefault() : this.mCurrentSpellCheckerLocaleCache;\n    //}\n    //\n    ///**\n    // * This is a temporary method. Future versions may support multi-locale text.\n    // * Caveat: This method may not return the latest text services locale, but this should be\n    // * acceptable and it's more important to make this method asynchronous.\n    // *\n    // * @return The locale that should be used for a word iterator\n    // * in this TextView, based on the current spell checker settings,\n    // * the current IME's locale, or the system default locale.\n    // * Please note that a word iterator in this TextView is different from another word iterator\n    // * used by SpellChecker.java of TextView. This method should be used for the former.\n    // * @hide\n    // */\n    //// TODO: Support multi-locale\n    //// TODO: Update the text services locale immediately after the keyboard locale is switched\n    //// by catching intent of keyboard switch event\n    //getTextServicesLocale():Locale  {\n    //    return this.getTextServicesLocale(false);\n    //}\n    //\n    ///**\n    // * This is a temporary method. Future versions may support multi-locale text.\n    // * Caveat: This method may not return the latest spell checker locale, but this should be\n    // * acceptable and it's more important to make this method asynchronous.\n    // *\n    // * @return The locale that should be used for a spell checker in this TextView,\n    // * based on the current spell checker settings, the current IME's locale, or the system default\n    // * locale.\n    // * @hide\n    // */\n    //getSpellCheckerLocale():Locale  {\n    //    return this.getTextServicesLocale(true);\n    //}\n    //\n    //private updateTextServicesLocaleAsync():void  {\n    //    // AsyncTask.execute() uses a serial executor which means we don't have\n    //    // to lock around updateTextServicesLocaleLocked() to prevent it from\n    //    // being executed n times in parallel.\n    //    AsyncTask.execute((()=>{\n    //        const inner_this=this;\n    //        class _Inner extends Runnable {\n    //\n    //            run():void  {\n    //                inner_this.updateTextServicesLocaleLocked();\n    //            }\n    //        }\n    //        return new _Inner();\n    //    })());\n    //}\n    //\n    //private updateTextServicesLocaleLocked():void  {\n    //    const textServicesManager:TextServicesManager = <TextServicesManager> this.mContext.getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE);\n    //    const subtype:SpellCheckerSubtype = textServicesManager.getCurrentSpellCheckerSubtype(true);\n    //    let locale:Locale;\n    //    if (subtype != null) {\n    //        locale = SpellCheckerSubtype.constructLocaleFromString(subtype.getLocale());\n    //    } else {\n    //        locale = null;\n    //    }\n    //    this.mCurrentSpellCheckerLocaleCache = locale;\n    //}\n\n    //onLocaleChanged():void  {\n    //    // Will be re-created on demand in getWordIterator with the proper new locale\n    //    this.mEditor.mWordIterator = null;\n    //}\n    //\n    ///**\n    // * This method is used by the ArrowKeyMovementMethod to jump from one word to the other.\n    // * Made available to achieve a consistent behavior.\n    // * @hide\n    // */\n    //getWordIterator():WordIterator  {\n    //    if (this.mEditor != null) {\n    //        return this.mEditor.getWordIterator();\n    //    } else {\n    //        return null;\n    //    }\n    //}\n    //\n    //onPopulateAccessibilityEvent(event:AccessibilityEvent):void  {\n    //    super.onPopulateAccessibilityEvent(event);\n    //    const isPassword:boolean = this.hasPasswordTransformationMethod();\n    //    if (!isPassword || this.shouldSpeakPasswordsForAccessibility()) {\n    //        const text:CharSequence = this.getTextForAccessibility();\n    //        if (!TextUtils.isEmpty(text)) {\n    //            event.getText().add(text);\n    //        }\n    //    }\n    //}\n    //\n    ///**\n    // * @return true if the user has explicitly allowed accessibility services\n    // * to speak passwords.\n    // */\n    //private shouldSpeakPasswordsForAccessibility():boolean  {\n    //    return (Settings.Secure.getInt(this.mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, 0) == 1);\n    //}\n    //\n    //onInitializeAccessibilityEvent(event:AccessibilityEvent):void  {\n    //    super.onInitializeAccessibilityEvent(event);\n    //    event.setClassName(TextView.class.getName());\n    //    const isPassword:boolean = this.hasPasswordTransformationMethod();\n    //    event.setPassword(isPassword);\n    //    if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED) {\n    //        event.setFromIndex(Selection.getSelectionStart(this.mText));\n    //        event.setToIndex(Selection.getSelectionEnd(this.mText));\n    //        event.setItemCount(this.mText.length());\n    //    }\n    //}\n    //\n    //onInitializeAccessibilityNodeInfo(info:AccessibilityNodeInfo):void  {\n    //    super.onInitializeAccessibilityNodeInfo(info);\n    //    info.setClassName(TextView.class.getName());\n    //    const isPassword:boolean = this.hasPasswordTransformationMethod();\n    //    info.setPassword(isPassword);\n    //    if (!isPassword) {\n    //        info.setText(this.getTextForAccessibility());\n    //    }\n    //    if (this.mBufferType == TextView.BufferType.EDITABLE) {\n    //        info.setEditable(true);\n    //    }\n    //    if (this.mEditor != null) {\n    //        info.setInputType(this.mEditor.mInputType);\n    //        if (this.mEditor.mError != null) {\n    //            info.setContentInvalid(true);\n    //        }\n    //    }\n    //    if (!TextUtils.isEmpty(this.mText)) {\n    //        info.addAction(AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY);\n    //        info.addAction(AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY);\n    //        info.setMovementGranularities(AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_LINE | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PARAGRAPH | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PAGE);\n    //    }\n    //    if (this.isFocused()) {\n    //        if (this.canSelectText()) {\n    //            info.addAction(AccessibilityNodeInfo.ACTION_SET_SELECTION);\n    //        }\n    //        if (this.canCopy()) {\n    //            info.addAction(AccessibilityNodeInfo.ACTION_COPY);\n    //        }\n    //        if (this.canPaste()) {\n    //            info.addAction(AccessibilityNodeInfo.ACTION_PASTE);\n    //        }\n    //        if (this.canCut()) {\n    //            info.addAction(AccessibilityNodeInfo.ACTION_CUT);\n    //        }\n    //    }\n    //    if (!this.isSingleLine()) {\n    //        info.setMultiLine(true);\n    //    }\n    //}\n\n    //performAccessibilityAction(action:number, arguments:Bundle):boolean  {\n    //    switch(action) {\n    //        case AccessibilityNodeInfo.ACTION_COPY:\n    //            {\n    //                if (this.isFocused() && this.canCopy()) {\n    //                    if (this.onTextContextMenuItem(TextView.ID_COPY)) {\n    //                        return true;\n    //                    }\n    //                }\n    //            }\n    //            return false;\n    //        case AccessibilityNodeInfo.ACTION_PASTE:\n    //            {\n    //                if (this.isFocused() && this.canPaste()) {\n    //                    if (this.onTextContextMenuItem(TextView.ID_PASTE)) {\n    //                        return true;\n    //                    }\n    //                }\n    //            }\n    //            return false;\n    //        case AccessibilityNodeInfo.ACTION_CUT:\n    //            {\n    //                if (this.isFocused() && this.canCut()) {\n    //                    if (this.onTextContextMenuItem(TextView.ID_CUT)) {\n    //                        return true;\n    //                    }\n    //                }\n    //            }\n    //            return false;\n    //        case AccessibilityNodeInfo.ACTION_SET_SELECTION:\n    //            {\n    //                if (this.isFocused() && this.canSelectText()) {\n    //                    let text:CharSequence = this.getIterableTextForAccessibility();\n    //                    if (text == null) {\n    //                        return false;\n    //                    }\n    //                    const start:number = (arguments != null) ? arguments.getInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, -1) : -1;\n    //                    const end:number = (arguments != null) ? arguments.getInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, -1) : -1;\n    //                    if ((this.getSelectionStart() != start || this.getSelectionEnd() != end)) {\n    //                        // No arguments clears the selection.\n    //                        if (start == end && end == -1) {\n    //                            Selection.removeSelection(<Spannable> text);\n    //                            return true;\n    //                        }\n    //                        if (start >= 0 && start <= end && end <= text.length()) {\n    //                            Selection.setSelection(<Spannable> text, start, end);\n    //                            // Make sure selection mode is engaged.\n    //                            if (this.mEditor != null) {\n    //                                this.mEditor.startSelectionActionMode();\n    //                            }\n    //                            return true;\n    //                        }\n    //                    }\n    //                }\n    //            }\n    //            return false;\n    //        default:\n    //            {\n    //                return super.performAccessibilityAction(action, arguments);\n    //            }\n    //    }\n    //}\n    //\n    //sendAccessibilityEvent(eventType:number):void  {\n    //    // For details see the implementation of bringTextIntoView().\n    //    if (eventType == AccessibilityEvent.TYPE_VIEW_SCROLLED) {\n    //        return;\n    //    }\n    //    super.sendAccessibilityEvent(eventType);\n    //}\n    //\n    ///**\n    // * Gets the text reported for accessibility purposes.\n    // *\n    // * @return The accessibility text.\n    // *\n    // * @hide\n    // */\n    //getTextForAccessibility():CharSequence  {\n    //    let text:CharSequence = this.getText();\n    //    if (TextUtils.isEmpty(text)) {\n    //        text = this.getHint();\n    //    }\n    //    return text;\n    //}\n    //\n    //sendAccessibilityEventTypeViewTextChanged(beforeText:CharSequence, fromIndex:number, removedCount:number, addedCount:number):void  {\n    //    let event:AccessibilityEvent = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED);\n    //    event.setFromIndex(fromIndex);\n    //    event.setRemovedCount(removedCount);\n    //    event.setAddedCount(addedCount);\n    //    event.setBeforeText(beforeText);\n    //    this.sendAccessibilityEventUnchecked(event);\n    //}\n    //\n    ///**\n    // * Returns whether this text view is a current input method target.  The\n    // * default implementation just checks with {@link InputMethodManager}.\n    // */\n    //isInputMethodTarget():boolean  {\n    //    let imm:InputMethodManager = InputMethodManager.peekInstance();\n    //    return imm != null && imm.isActive(this);\n    //}\n    //\n    //static ID_SELECT_ALL:number = android.R.id.selectAll;\n    //\n    //static ID_CUT:number = android.R.id.cut;\n    //\n    //static ID_COPY:number = android.R.id.copy;\n    //\n    //static ID_PASTE:number = android.R.id.paste;\n    //\n    ///**\n    // * Called when a context menu option for the text view is selected.  Currently\n    // * this will be one of {@link android.R.id#selectAll}, {@link android.R.id#cut},\n    // * {@link android.R.id#copy} or {@link android.R.id#paste}.\n    // *\n    // * @return true if the context menu item action was performed.\n    // */\n    //onTextContextMenuItem(id:number):boolean  {\n    //    let min:number = 0;\n    //    let max:number = this.mText.length();\n    //    if (this.isFocused()) {\n    //        const selStart:number = this.getSelectionStart();\n    //        const selEnd:number = this.getSelectionEnd();\n    //        min = Math.max(0, Math.min(selStart, selEnd));\n    //        max = Math.max(0, Math.max(selStart, selEnd));\n    //    }\n    //    switch(id) {\n    //        case TextView.ID_SELECT_ALL:\n    //            // This does not enter text selection mode. Text is highlighted, so that it can be\n    //            // bulk edited, like selectAllOnFocus does. Returns true even if text is empty.\n    //            this.selectAllText();\n    //            return true;\n    //        case TextView.ID_PASTE:\n    //            this.paste(min, max);\n    //            return true;\n    //        case TextView.ID_CUT:\n    //            this.setPrimaryClip(ClipData.newPlainText(null, this.getTransformedText(min, max)));\n    //            this.deleteText_internal(min, max);\n    //            this.stopSelectionActionMode();\n    //            return true;\n    //        case TextView.ID_COPY:\n    //            this.setPrimaryClip(ClipData.newPlainText(null, this.getTransformedText(min, max)));\n    //            this.stopSelectionActionMode();\n    //            return true;\n    //    }\n    //    return false;\n    //}\n\n    getTransformedText(start:number, end:number):String  {\n        return this.removeSuggestionSpans(this.mTransformed.substring(start, end));\n    }\n\n    performLongClick():boolean  {\n        let handled:boolean = false;\n        if (super.performLongClick()) {\n            handled = true;\n        }\n        //if (this.mEditor != null) {\n        //    handled |= this.mEditor.performLongClick(handled);\n        //}\n        if (handled) {\n            this.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);\n            //if (this.mEditor != null)\n            //    this.mEditor.mDiscardNextActionUp = true;\n        }\n        return handled;\n    }\n\n    //protected onScrollChanged(horiz:number, vert:number, oldHoriz:number, oldVert:number):void  {\n    //    super.onScrollChanged(horiz, vert, oldHoriz, oldVert);\n    //    if (this.mEditor != null) {\n    //        this.mEditor.onScrollChanged();\n    //    }\n    //}\n\n    /**\n     * Return whether or not suggestions are enabled on this TextView. The suggestions are generated\n     * by the IME or by the spell checker as the user types. This is done by adding\n     * {@link SuggestionSpan}s to the text.\n     *\n     * When suggestions are enabled (default), this list of suggestions will be displayed when the\n     * user asks for them on these parts of the text. This value depends on the inputType of this\n     * TextView.\n     *\n     * The class of the input type must be {@link InputType#TYPE_CLASS_TEXT}.\n     *\n     * In addition, the type variation must be one of\n     * {@link InputType#TYPE_TEXT_VARIATION_NORMAL},\n     * {@link InputType#TYPE_TEXT_VARIATION_EMAIL_SUBJECT},\n     * {@link InputType#TYPE_TEXT_VARIATION_LONG_MESSAGE},\n     * {@link InputType#TYPE_TEXT_VARIATION_SHORT_MESSAGE} or\n     * {@link InputType#TYPE_TEXT_VARIATION_WEB_EDIT_TEXT}.\n     *\n     * And finally, the {@link InputType#TYPE_TEXT_FLAG_NO_SUGGESTIONS} flag must <i>not</i> be set.\n     *\n     * @return true if the suggestions popup window is enabled, based on the inputType.\n     */\n    isSuggestionsEnabled():boolean  {\n        return false;\n        //if (this.mEditor == null)\n        //    return false;\n        //if ((this.mEditor.mInputType & InputType.TYPE_MASK_CLASS) != InputType.TYPE_CLASS_TEXT) {\n        //    return false;\n        //}\n        //if ((this.mEditor.mInputType & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS) > 0)\n        //    return false;\n        //const variation:number = this.mEditor.mInputType & EditorInfo.TYPE_MASK_VARIATION;\n        //return (variation == EditorInfo.TYPE_TEXT_VARIATION_NORMAL || variation == EditorInfo.TYPE_TEXT_VARIATION_EMAIL_SUBJECT || variation == EditorInfo.TYPE_TEXT_VARIATION_LONG_MESSAGE || variation == EditorInfo.TYPE_TEXT_VARIATION_SHORT_MESSAGE || variation == EditorInfo.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT);\n    }\n\n    /**\n     * If provided, this ActionMode.Callback will be used to create the ActionMode when text\n     * selection is initiated in this View.\n     *\n     * The standard implementation populates the menu with a subset of Select All, Cut, Copy and\n     * Paste actions, depending on what this View supports.\n     *\n     * A custom implementation can add new entries in the default menu in its\n     * {@link android.view.ActionMode.Callback#onPrepareActionMode(ActionMode, Menu)} method. The\n     * default actions can also be removed from the menu using {@link Menu#removeItem(int)} and\n     * passing {@link android.R.id#selectAll}, {@link android.R.id#cut}, {@link android.R.id#copy}\n     * or {@link android.R.id#paste} ids as parameters.\n     *\n     * Returning false from\n     * {@link android.view.ActionMode.Callback#onCreateActionMode(ActionMode, Menu)} will prevent\n     * the action mode from being started.\n     *\n     * Action click events should be handled by the custom implementation of\n     * {@link android.view.ActionMode.Callback#onActionItemClicked(ActionMode, MenuItem)}.\n     *\n     * Note that text selection mode is not started when a TextView receives focus and the\n     * {@link android.R.attr#selectAllOnFocus} flag has been set. The content is highlighted in\n     * that case, to allow for quick replacement.\n     */\n    setCustomSelectionActionModeCallback(actionModeCallback:any):void  {\n        this.createEditorIfNeeded();\n        //this.mEditor.mCustomSelectionActionModeCallback = actionModeCallback;\n    }\n\n    /**\n     * Retrieves the value set in {@link #setCustomSelectionActionModeCallback}. Default is null.\n     *\n     * @return The current custom selection callback.\n     */\n    getCustomSelectionActionModeCallback():any  {\n        return null;\n        //return this.mEditor == null ? null : this.mEditor.mCustomSelectionActionModeCallback;\n    }\n\n    /**\n     * @hide\n     */\n    protected stopSelectionActionMode():void  {\n        //this.mEditor.stopSelectionActionMode();\n    }\n\n    canCut():boolean  {\n        //if (this.hasPasswordTransformationMethod()) {\n        //    return false;\n        //}\n        //if (this.mText.length() > 0 && this.hasSelection() && this.mText instanceof Editable && this.mEditor != null && this.mEditor.mKeyListener != null) {\n        //    return true;\n        //}\n        return false;\n    }\n\n    canCopy():boolean  {\n        return true;\n        //if (this.hasPasswordTransformationMethod()) {\n        //    return false;\n        //}\n        //if (this.mText.length() > 0 && this.hasSelection()) {\n        //    return true;\n        //}\n        //return false;\n    }\n\n    canPaste():boolean  {\n        return false;\n        //return (this.mText instanceof Editable && this.mEditor != null && this.mEditor.mKeyListener != null\n        //&& this.getSelectionStart() >= 0 && this.getSelectionEnd() >= 0\n        //&& (<ClipboardManager> this.getContext().getSystemService(Context.CLIPBOARD_SERVICE)).hasPrimaryClip());\n    }\n\n    selectAllText():boolean  {\n        return false;\n        //const length:number = this.mText.length();\n        //Selection.setSelection(<Spannable> this.mText, 0, length);\n        //return length > 0;\n    }\n\n    ///**\n    // * Prepare text so that there are not zero or two spaces at beginning and end of region defined\n    // * by [min, max] when replacing this region by paste.\n    // * Note that if there were two spaces (or more) at that position before, they are kept. We just\n    // * make sure we do not add an extra one from the paste content.\n    // */\n    //prepareSpacesAroundPaste(min:number, max:number, paste:String):number  {\n    //    if (paste.length() > 0) {\n    //        if (min > 0) {\n    //            const charBefore:string = this.mTransformed.charAt(min - 1);\n    //            const charAfter:string = paste.charAt(0);\n    //            if (Character.isSpaceChar(charBefore) && Character.isSpaceChar(charAfter)) {\n    //                // Two spaces at beginning of paste: remove one\n    //                const originalLength:number = this.mText.length();\n    //                this.deleteText_internal(min - 1, min);\n    //                // Due to filters, there is no guarantee that exactly one character was\n    //                // removed: count instead.\n    //                const delta:number = this.mText.length() - originalLength;\n    //                min += delta;\n    //                max += delta;\n    //            } else if (!Character.isSpaceChar(charBefore) && charBefore != '\\n' && !Character.isSpaceChar(charAfter) && charAfter != '\\n') {\n    //                // No space at beginning of paste: add one\n    //                const originalLength:number = this.mText.length();\n    //                this.replaceText_internal(min, min, \" \");\n    //                // Taking possible filters into account as above.\n    //                const delta:number = this.mText.length() - originalLength;\n    //                min += delta;\n    //                max += delta;\n    //            }\n    //        }\n    //        if (max < this.mText.length()) {\n    //            const charBefore:string = paste.charAt(paste.length() - 1);\n    //            const charAfter:string = this.mTransformed.charAt(max);\n    //            if (Character.isSpaceChar(charBefore) && Character.isSpaceChar(charAfter)) {\n    //                // Two spaces at end of paste: remove one\n    //                this.deleteText_internal(max, max + 1);\n    //            } else if (!Character.isSpaceChar(charBefore) && charBefore != '\\n' && !Character.isSpaceChar(charAfter) && charAfter != '\\n') {\n    //                // No space at end of paste: add one\n    //                this.replaceText_internal(max, max, \" \");\n    //            }\n    //        }\n    //    }\n    //    return TextUtils.packRangeInLong(min, max);\n    //}\n    //\n    ///**\n    // * Paste clipboard content between min and max positions.\n    // */\n    //private paste(min:number, max:number):void  {\n    //    let clipboard:ClipboardManager = <ClipboardManager> this.getContext().getSystemService(Context.CLIPBOARD_SERVICE);\n    //    let clip:ClipData = clipboard.getPrimaryClip();\n    //    if (clip != null) {\n    //        let didFirst:boolean = false;\n    //        for (let i:number = 0; i < clip.getItemCount(); i++) {\n    //            let paste:CharSequence = clip.getItemAt(i).coerceToStyledText(this.getContext());\n    //            if (paste != null) {\n    //                if (!didFirst) {\n    //                    let minMax:number = this.prepareSpacesAroundPaste(min, max, paste);\n    //                    min = TextUtils.unpackRangeStartFromLong(minMax);\n    //                    max = TextUtils.unpackRangeEndFromLong(minMax);\n    //                    Selection.setSelection(<Spannable> this.mText, max);\n    //                    (<Editable> this.mText).replace(min, max, paste);\n    //                    didFirst = true;\n    //                } else {\n    //                    (<Editable> this.mText).insert(this.getSelectionEnd(), \"\\n\");\n    //                    (<Editable> this.mText).insert(this.getSelectionEnd(), paste);\n    //                }\n    //            }\n    //        }\n    //        this.stopSelectionActionMode();\n    //        TextView.LAST_CUT_OR_COPY_TIME = 0;\n    //    }\n    //}\n\n    //private setPrimaryClip(clip:ClipData):void  {\n    //    let clipboard:ClipboardManager = <ClipboardManager> this.getContext().getSystemService(Context.CLIPBOARD_SERVICE);\n    //    clipboard.setPrimaryClip(clip);\n    //    TextView.LAST_CUT_OR_COPY_TIME = SystemClock.uptimeMillis();\n    //}\n\n    /**\n     * Get the character offset closest to the specified absolute position. A typical use case is to\n     * pass the result of {@link MotionEvent#getX()} and {@link MotionEvent#getY()} to this method.\n     *\n     * @param x The horizontal absolute position of a point on screen\n     * @param y The vertical absolute position of a point on screen\n     * @return the character offset for the character whose position is closest to the specified\n     *  position. Returns -1 if there is no layout.\n     */\n    getOffsetForPosition(x:number, y:number):number  {\n        if (this.getLayout() == null)\n            return -1;\n        const line:number = this.getLineAtCoordinate(y);\n        const offset:number = this.getOffsetAtCoordinate(line, x);\n        return offset;\n    }\n\n    convertToLocalHorizontalCoordinate(x:number):number  {\n        x -= this.getTotalPaddingLeft();\n        // Clamp the position to inside of the view.\n        x = Math.max(0.0, x);\n        x = Math.min(this.getWidth() - this.getTotalPaddingRight() - 1, x);\n        x += this.getScrollX();\n        return x;\n    }\n\n    getLineAtCoordinate(y:number):number  {\n        y -= this.getTotalPaddingTop();\n        // Clamp the position to inside of the view.\n        y = Math.max(0.0, y);\n        y = Math.min(this.getHeight() - this.getTotalPaddingBottom() - 1, y);\n        y += this.getScrollY();\n        return this.getLayout().getLineForVertical(Math.floor(y));\n    }\n\n    private getOffsetAtCoordinate(line:number, x:number):number  {\n        x = this.convertToLocalHorizontalCoordinate(x);\n        return this.getLayout().getOffsetForHorizontal(line, x);\n    }\n\n    //onDragEvent(event:DragEvent):boolean  {\n    //    switch(event.getAction()) {\n    //        case DragEvent.ACTION_DRAG_STARTED:\n    //            return this.mEditor != null && this.mEditor.hasInsertionController();\n    //        case DragEvent.ACTION_DRAG_ENTERED:\n    //            TextView.this.requestFocus();\n    //            return true;\n    //        case DragEvent.ACTION_DRAG_LOCATION:\n    //            const offset:number = this.getOffsetForPosition(event.getX(), event.getY());\n    //            Selection.setSelection(<Spannable> this.mText, offset);\n    //            return true;\n    //        case DragEvent.ACTION_DROP:\n    //            if (this.mEditor != null)\n    //                this.mEditor.onDrop(event);\n    //            return true;\n    //        case DragEvent.ACTION_DRAG_ENDED:\n    //        case DragEvent.ACTION_DRAG_EXITED:\n    //        default:\n    //            return true;\n    //    }\n    //}\n\n    isInBatchEditMode():boolean  {\n        //if (this.mEditor == null)\n            return false;\n        //const ims:Editor.InputMethodState = this.mEditor.mInputMethodState;\n        //if (ims != null) {\n        //    return ims.mBatchEditNesting > 0;\n        //}\n        //return this.mEditor.mInBatchEditControllers;\n    }\n\n    //onRtlPropertiesChanged(layoutDirection:number):void  {\n    //    super.onRtlPropertiesChanged(layoutDirection);\n    //    this.mTextDir = this.getTextDirectionHeuristic();\n    //}\n\n    getTextDirectionHeuristic():TextDirectionHeuristic  {\n        return TextDirectionHeuristics.LTR;\n        //if (this.hasPasswordTransformationMethod()) {\n        //    // passwords fields should be LTR\n        //    return TextDirectionHeuristics.LTR;\n        //}\n        //// Always need to resolve layout direction first\n        //const defaultIsRtl:boolean = (this.getLayoutDirection() == TextView.LAYOUT_DIRECTION_RTL);\n        //// Now, we can select the heuristic\n        //switch(this.getTextDirection()) {\n        //    default:\n        //    case TextView.TEXT_DIRECTION_FIRST_STRONG:\n        //        return (defaultIsRtl ? TextDirectionHeuristics.FIRSTSTRONG_RTL : TextDirectionHeuristics.FIRSTSTRONG_LTR);\n        //    case TextView.TEXT_DIRECTION_ANY_RTL:\n        //        return TextDirectionHeuristics.ANYRTL_LTR;\n        //    case TextView.TEXT_DIRECTION_LTR:\n        //        return TextDirectionHeuristics.LTR;\n        //    case TextView.TEXT_DIRECTION_RTL:\n        //        return TextDirectionHeuristics.RTL;\n        //    case TextView.TEXT_DIRECTION_LOCALE:\n        //        return TextDirectionHeuristics.LOCALE;\n        //}\n    }\n\n    /**\n     * @hide\n     */\n    onResolveDrawables(layoutDirection:number):void  {\n        // No need to resolve twice\n        if (this.mLastLayoutDirection == layoutDirection) {\n            return;\n        }\n        this.mLastLayoutDirection = layoutDirection;\n        // Resolve drawables\n        if (this.mDrawables != null) {\n            this.mDrawables.resolveWithLayoutDirection(layoutDirection);\n        }\n    }\n\n    /**\n     * @hide\n     */\n    protected resetResolvedDrawables():void  {\n        //super.resetResolvedDrawables();\n        this.mLastLayoutDirection = -1;\n    }\n\n    ///**\n    // * @hide\n    // */\n    //protected viewClicked(imm:InputMethodManager):void  {\n    //    if (imm != null) {\n    //        imm.viewClicked(this);\n    //    }\n    //}\n\n    /**\n     * Deletes the range of text [start, end[.\n     * @hide\n     */\n    protected deleteText_internal(start:number, end:number):void  {\n        //(<Editable> this.mText).delete(start, end);\n    }\n\n    /**\n     * Replaces the range of text [start, end[ by replacement text\n     * @hide\n     */\n    protected replaceText_internal(start:number, end:number, text:String):void  {\n        //(<Editable> this.mText).replace(start, end, text);\n    }\n\n    /**\n     * Sets a span on the specified range of text\n     * @hide\n     */\n    protected setSpan_internal(span:any, start:number, end:number, flags:number):void  {\n        //(<Editable> this.mText).setSpan(span, start, end, flags);\n    }\n\n    /**\n     * Moves the cursor to the specified offset position in text\n     * @hide\n     */\n    protected setCursorPosition_internal(start:number, end:number):void  {\n        //Selection.setSelection((<Editable> this.mText), start, end);\n    }\n\n    /**\n     * An Editor should be created as soon as any of the editable-specific fields (grouped\n     * inside the Editor object) is assigned to a non-default value.\n     * This method will create the Editor if needed.\n     *\n     * A standard TextView (as well as buttons, checkboxes...) should not qualify and hence will\n     * have a null Editor, unlike an EditText. Inconsistent in-between states will have an\n     * Editor for backward compatibility, as soon as one of these fields is assigned.\n     *\n     * Also note that for performance reasons, the mEditor is created when needed, but not\n     * reset when no more edit-specific fields are needed.\n     */\n    private createEditorIfNeeded():void  {\n        //if (this.mEditor == null) {\n        //    this.mEditor = new Editor(this);\n        //}\n    }\n\n    ///**\n    // * @hide\n    // */\n    //getIterableTextForAccessibility():CharSequence  {\n    //    if (!(this.mText instanceof Spannable)) {\n    //        this.setText(this.mText, TextView.BufferType.SPANNABLE);\n    //    }\n    //    return this.mText;\n    //}\n    //\n    ///**\n    // * @hide\n    // */\n    //getIteratorForGranularity(granularity:number):TextSegmentIterator  {\n    //    switch(granularity) {\n    //        case AccessibilityNodeInfo.MOVEMENT_GRANULARITY_LINE:\n    //            {\n    //                let text:Spannable = <Spannable> this.getIterableTextForAccessibility();\n    //                if (!TextUtils.isEmpty(text) && this.getLayout() != null) {\n    //                    let iterator:AccessibilityIterators.LineTextSegmentIterator = AccessibilityIterators.LineTextSegmentIterator.getInstance();\n    //                    iterator.initialize(text, this.getLayout());\n    //                    return iterator;\n    //                }\n    //            }\n    //            break;\n    //        case AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PAGE:\n    //            {\n    //                let text:Spannable = <Spannable> this.getIterableTextForAccessibility();\n    //                if (!TextUtils.isEmpty(text) && this.getLayout() != null) {\n    //                    let iterator:AccessibilityIterators.PageTextSegmentIterator = AccessibilityIterators.PageTextSegmentIterator.getInstance();\n    //                    iterator.initialize(this);\n    //                    return iterator;\n    //                }\n    //            }\n    //            break;\n    //    }\n    //    return super.getIteratorForGranularity(granularity);\n    //}\n    //\n    ///**\n    // * @hide\n    // */\n    //getAccessibilitySelectionStart():number  {\n    //    return this.getSelectionStart();\n    //}\n    //\n    ///**\n    // * @hide\n    // */\n    //isAccessibilitySelectionExtendable():boolean  {\n    //    return true;\n    //}\n    //\n    ///**\n    // * @hide\n    // */\n    //getAccessibilitySelectionEnd():number  {\n    //    return this.getSelectionEnd();\n    //}\n    //\n    ///**\n    // * @hide\n    // */\n    //setAccessibilitySelection(start:number, end:number):void  {\n    //    if (this.getAccessibilitySelectionStart() == start && this.getAccessibilitySelectionEnd() == end) {\n    //        return;\n    //    }\n    //    // controllers interact with how selection behaves.\n    //    if (this.mEditor != null) {\n    //        this.mEditor.hideControllers();\n    //    }\n    //    let text:CharSequence = this.getIterableTextForAccessibility();\n    //    if (Math.min(start, end) >= 0 && Math.max(start, end) <= text.length()) {\n    //        Selection.setSelection(<Spannable> text, start, end);\n    //    } else {\n    //        Selection.removeSelection(<Spannable> text);\n    //    }\n    //}\n\n\n\n\n\n\n\n\n}\n\nexport module TextView{\nexport class Drawables {\n\n    static DRAWABLE_NONE:number = -1;\n\n    static DRAWABLE_RIGHT:number = 0;\n\n    static DRAWABLE_LEFT:number = 1;\n\n    mCompoundRect:Rect = new Rect();\n\n    mDrawableTop:Drawable;\n    mDrawableBottom:Drawable;\n    mDrawableLeft:Drawable;\n    mDrawableRight:Drawable;\n    mDrawableStart:Drawable;\n    mDrawableEnd:Drawable;\n    mDrawableError:Drawable;\n    mDrawableTemp:Drawable;\n\n    mDrawableLeftInitial:Drawable;\n    mDrawableRightInitial:Drawable;\n\n    mIsRtlCompatibilityMode:boolean;\n\n    mOverride:boolean;\n\n    mDrawableSizeTop:number = 0;\n    mDrawableSizeBottom:number = 0;\n    mDrawableSizeLeft:number = 0;\n    mDrawableSizeRight:number = 0;\n    mDrawableSizeStart:number = 0;\n    mDrawableSizeEnd:number = 0;\n    mDrawableSizeError:number = 0;\n    mDrawableSizeTemp:number = 0;\n\n    mDrawableWidthTop:number = 0;\n    mDrawableWidthBottom:number = 0;\n    mDrawableHeightLeft:number = 0;\n    mDrawableHeightRight:number = 0;\n    mDrawableHeightStart:number = 0;\n    mDrawableHeightEnd:number = 0;\n    mDrawableHeightError:number = 0;\n    mDrawableHeightTemp:number = 0;\n\n    mDrawablePadding:number = 0;\n\n    mDrawableSaved:number = Drawables.DRAWABLE_NONE;\n\n    constructor( context?:any) {\n        //const targetSdkVersion:number = context.getApplicationInfo().targetSdkVersion;\n        this.mIsRtlCompatibilityMode = false;//(targetSdkVersion < JELLY_BEAN_MR1 || !context.getApplicationInfo().hasRtlSupport());\n        this.mOverride = false;\n    }\n\n    resolveWithLayoutDirection(layoutDirection:number):void  {\n        // First reset \"left\" and \"right\" drawables to their initial values\n        this.mDrawableLeft = this.mDrawableLeftInitial;\n        this.mDrawableRight = this.mDrawableRightInitial;\n        //if (this.mIsRtlCompatibilityMode) {\n        //    // Use \"start\" drawable as \"left\" drawable if the \"left\" drawable was not defined\n        //    if (this.mDrawableStart != null && this.mDrawableLeft == null) {\n        //        this.mDrawableLeft = this.mDrawableStart;\n        //        this.mDrawableSizeLeft = this.mDrawableSizeStart;\n        //        this.mDrawableHeightLeft = this.mDrawableHeightStart;\n        //    }\n        //    // Use \"end\" drawable as \"right\" drawable if the \"right\" drawable was not defined\n        //    if (this.mDrawableEnd != null && this.mDrawableRight == null) {\n        //        this.mDrawableRight = this.mDrawableEnd;\n        //        this.mDrawableSizeRight = this.mDrawableSizeEnd;\n        //        this.mDrawableHeightRight = this.mDrawableHeightEnd;\n        //    }\n        //} else {\n        //    // drawable if and only if they have been defined\n        //    switch(layoutDirection) {\n        //        case TextView.LAYOUT_DIRECTION_RTL:\n        //            if (this.mOverride) {\n        //                this.mDrawableRight = this.mDrawableStart;\n        //                this.mDrawableSizeRight = this.mDrawableSizeStart;\n        //                this.mDrawableHeightRight = this.mDrawableHeightStart;\n        //                this.mDrawableLeft = this.mDrawableEnd;\n        //                this.mDrawableSizeLeft = this.mDrawableSizeEnd;\n        //                this.mDrawableHeightLeft = this.mDrawableHeightEnd;\n        //            }\n        //            break;\n        //        case TextView.LAYOUT_DIRECTION_LTR:\n        //        default:\n                    if (this.mOverride) {\n                        this.mDrawableLeft = this.mDrawableStart;\n                        this.mDrawableSizeLeft = this.mDrawableSizeStart;\n                        this.mDrawableHeightLeft = this.mDrawableHeightStart;\n                        this.mDrawableRight = this.mDrawableEnd;\n                        this.mDrawableSizeRight = this.mDrawableSizeEnd;\n                        this.mDrawableHeightRight = this.mDrawableHeightEnd;\n                    }\n        //            break;\n        //    }\n        //}\n        this.applyErrorDrawableIfNeeded(layoutDirection);\n        this.updateDrawablesLayoutDirection(layoutDirection);\n    }\n\n    private updateDrawablesLayoutDirection(layoutDirection:number):void  {\n        //if (this.mDrawableLeft != null) {\n        //    this.mDrawableLeft.setLayoutDirection(layoutDirection);\n        //}\n        //if (this.mDrawableRight != null) {\n        //    this.mDrawableRight.setLayoutDirection(layoutDirection);\n        //}\n        //if (this.mDrawableTop != null) {\n        //    this.mDrawableTop.setLayoutDirection(layoutDirection);\n        //}\n        //if (this.mDrawableBottom != null) {\n        //    this.mDrawableBottom.setLayoutDirection(layoutDirection);\n        //}\n    }\n\n    setErrorDrawable(dr:Drawable, tv:TextView):void  {\n        if (this.mDrawableError != dr && this.mDrawableError != null) {\n            this.mDrawableError.setCallback(null);\n        }\n        this.mDrawableError = dr;\n        const compoundRect:Rect = this.mCompoundRect;\n        let state:number[] = tv.getDrawableState();\n        if (this.mDrawableError != null) {\n            this.mDrawableError.setState(state);\n            this.mDrawableError.copyBounds(compoundRect);\n            this.mDrawableError.setCallback(tv);\n            this.mDrawableSizeError = compoundRect.width();\n            this.mDrawableHeightError = compoundRect.height();\n        } else {\n            this.mDrawableSizeError = this.mDrawableHeightError = 0;\n        }\n    }\n\n    private applyErrorDrawableIfNeeded(layoutDirection:number):void  {\n        // first restore the initial state if needed\n        switch(this.mDrawableSaved) {\n            case Drawables.DRAWABLE_LEFT:\n                this.mDrawableLeft = this.mDrawableTemp;\n                this.mDrawableSizeLeft = this.mDrawableSizeTemp;\n                this.mDrawableHeightLeft = this.mDrawableHeightTemp;\n                break;\n            case Drawables.DRAWABLE_RIGHT:\n                this.mDrawableRight = this.mDrawableTemp;\n                this.mDrawableSizeRight = this.mDrawableSizeTemp;\n                this.mDrawableHeightRight = this.mDrawableHeightTemp;\n                break;\n            case Drawables.DRAWABLE_NONE:\n            default:\n        }\n        // then, if needed, assign the Error drawable to the correct location\n        //if (this.mDrawableError != null) {\n        //    switch(layoutDirection) {\n        //        case TextView.LAYOUT_DIRECTION_RTL:\n        //            this.mDrawableSaved = Drawables.DRAWABLE_LEFT;\n        //            this.mDrawableTemp = this.mDrawableLeft;\n        //            this.mDrawableSizeTemp = this.mDrawableSizeLeft;\n        //            this.mDrawableHeightTemp = this.mDrawableHeightLeft;\n        //            this.mDrawableLeft = this.mDrawableError;\n        //            this.mDrawableSizeLeft = this.mDrawableSizeError;\n        //            this.mDrawableHeightLeft = this.mDrawableHeightError;\n        //            break;\n        //        case TextView.LAYOUT_DIRECTION_LTR:\n        //        default:\n                    this.mDrawableSaved = Drawables.DRAWABLE_RIGHT;\n                    this.mDrawableTemp = this.mDrawableRight;\n                    this.mDrawableSizeTemp = this.mDrawableSizeRight;\n                    this.mDrawableHeightTemp = this.mDrawableHeightRight;\n                    this.mDrawableRight = this.mDrawableError;\n                    this.mDrawableSizeRight = this.mDrawableSizeError;\n                    this.mDrawableHeightRight = this.mDrawableHeightError;\n        //            break;\n        //    }\n        //}\n    }\n}\n/**\n     * Interface definition for a callback to be invoked when an action is\n     * performed on the editor.\n     */\nexport interface OnEditorActionListener {\n\n    /**\n         * Called when an action is being performed.\n         *\n         * @param v The view that was clicked.\n         * @param actionId Identifier of the action.  This will be either the\n         * identifier you supplied, or {@link EditorInfo#IME_NULL\n         * EditorInfo.IME_NULL} if being called due to the enter key\n         * being pressed.\n         * @param event If triggered by an enter key, this is the event;\n         * otherwise, this is null.\n         * @return Return true if you have consumed the action, else false.\n         */\n    onEditorAction(v:TextView, actionId:number, event:KeyEvent):boolean ;\n}\n///**\n//     * User interface state that is stored by TextView for implementing\n//     * {@link View#onSaveInstanceState}.\n//     */\n//export class SavedState extends View.BaseSavedState {\n//\n//    selStart:number = 0;\n//\n//    selEnd:number = 0;\n//\n//    text:CharSequence;\n//\n//    frozenWithFocus:boolean;\n//\n//    error:CharSequence;\n//\n//    constructor( superState:Parcelable) {\n//        super(superState);\n//    }\n//\n//    writeToParcel(out:Parcel, flags:number):void  {\n//        super.writeToParcel(out, flags);\n//        out.writeInt(this.selStart);\n//        out.writeInt(this.selEnd);\n//        out.writeInt(this.frozenWithFocus ? 1 : 0);\n//        TextUtils.writeToParcel(this.text, out, flags);\n//        if (this.error == null) {\n//            out.writeInt(0);\n//        } else {\n//            out.writeInt(1);\n//            TextUtils.writeToParcel(this.error, out, flags);\n//        }\n//    }\n//\n//    toString():string  {\n//        let str:string = \"TextView.SavedState{\" + Integer.toHexString(System.identityHashCode(this)) + \" start=\" + this.selStart + \" end=\" + this.selEnd;\n//        if (this.text != null) {\n//            str += \" text=\" + this.text;\n//        }\n//        return str + \"}\";\n//    }\n//\n//    static CREATOR:Parcelable.Creator<SavedState> = (()=>{\n//        const inner_this=this;\n//        class _Inner extends Parcelable.Creator<SavedState> {\n//\n//            createFromParcel(_in:Parcel):SavedState  {\n//                return new SavedState(_in);\n//            }\n//\n//            newArray(size:number):SavedState[]  {\n//                return new Array<SavedState>(size);\n//            }\n//        }\n//        return new _Inner();\n//    })();\n//\n//    constructor( _in:Parcel) {\n//        super(_in);\n//        this.selStart = _in.readInt();\n//        this.selEnd = _in.readInt();\n//        this.frozenWithFocus = (_in.readInt() != 0);\n//        this.text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(_in);\n//        if (_in.readInt() != 0) {\n//            this.error = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(_in);\n//        }\n//    }\n//}\n//export class CharWrapper implements CharSequence, GetChars, GraphicsOperations {\n//\n//    private mChars:string[];\n//\n//    private mStart:number = 0;\n//    private mLength:number = 0;\n//\n//    constructor( chars:string[], start:number, len:number) {\n//        this.mChars = chars;\n//        this.mStart = start;\n//        this.mLength = len;\n//    }\n//\n//    /* package */\n//    set(chars:string[], start:number, len:number):void  {\n//        this.mChars = chars;\n//        this.mStart = start;\n//        this.mLength = len;\n//    }\n//\n//    length():number  {\n//        return this.mLength;\n//    }\n//\n//    charAt(off:number):string  {\n//        return this.mChars[off + this.mStart];\n//    }\n//\n//    toString():string  {\n//        return new string(this.mChars, this.mStart, this.mLength);\n//    }\n//\n//    subSequence(start:number, end:number):CharSequence  {\n//        if (start < 0 || end < 0 || start > this.mLength || end > this.mLength) {\n//            throw Error(`new IndexOutOfBoundsException(start + \", \" + end)`);\n//        }\n//        return new string(this.mChars, start + this.mStart, end - start);\n//    }\n//\n//    getChars(start:number, end:number, buf:string[], off:number):void  {\n//        if (start < 0 || end < 0 || start > this.mLength || end > this.mLength) {\n//            throw Error(`new IndexOutOfBoundsException(start + \", \" + end)`);\n//        }\n//        System.arraycopy(this.mChars, start + this.mStart, buf, off, end - start);\n//    }\n//\n//    drawText(c:Canvas, start:number, end:number, x:number, y:number, p:Paint):void  {\n//        c.drawText(this.mChars, start + this.mStart, end - start, x, y, p);\n//    }\n//\n//    drawTextRun(c:Canvas, start:number, end:number, contextStart:number, contextEnd:number, x:number, y:number, flags:number, p:Paint):void  {\n//        let count:number = end - start;\n//        let contextCount:number = contextEnd - contextStart;\n//        c.drawTextRun(this.mChars, start + this.mStart, count, contextStart + this.mStart, contextCount, x, y, flags, p);\n//    }\n//\n//    measureText(start:number, end:number, p:Paint):number  {\n//        return p.measureText(this.mChars, start + this.mStart, end - start);\n//    }\n//\n//    getTextWidths(start:number, end:number, widths:number[], p:Paint):number  {\n//        return p.getTextWidths(this.mChars, start + this.mStart, end - start, widths);\n//    }\n//\n//    getTextRunAdvances(start:number, end:number, contextStart:number, contextEnd:number, flags:number, advances:number[], advancesIndex:number, p:Paint):number  {\n//        let count:number = end - start;\n//        let contextCount:number = contextEnd - contextStart;\n//        return p.getTextRunAdvances(this.mChars, start + this.mStart, count, contextStart + this.mStart, contextCount, flags, advances, advancesIndex);\n//    }\n//\n//    getTextRunCursor(contextStart:number, contextEnd:number, flags:number, offset:number, cursorOpt:number, p:Paint):number  {\n//        let contextCount:number = contextEnd - contextStart;\n//        return p.getTextRunCursor(this.mChars, contextStart + this.mStart, contextCount, flags, offset + this.mStart, cursorOpt);\n//    }\n//}\nexport class Marquee extends Handler {\n\n    // TODO: Add an option to configure this\n    private static MARQUEE_DELTA_MAX:number = 0.07;\n\n    private static MARQUEE_DELAY:number = 1200;\n\n    private static MARQUEE_RESTART_DELAY:number = 1200;\n\n    private static MARQUEE_RESOLUTION:number = 1000 / 30;\n\n    private static MARQUEE_PIXELS_PER_SECOND:number = 30;\n\n    private static MARQUEE_STOPPED:number = 0x0;\n\n    private static MARQUEE_STARTING:number = 0x1;\n\n    private static MARQUEE_RUNNING:number = 0x2;\n\n    private static MESSAGE_START:number = 0x1;\n\n    private static MESSAGE_TICK:number = 0x2;\n\n    private static MESSAGE_RESTART:number = 0x3;\n\n    private mView:WeakReference<TextView>;\n\n    private mStatus:number = Marquee.MARQUEE_STOPPED;\n\n    private mScrollUnit:number = 0;\n\n    private mMaxScroll:number = 0;\n\n    private mMaxFadeScroll:number = 0;\n\n    private mGhostStart:number = 0;\n\n    private mGhostOffset:number = 0;\n\n    private mFadeStop:number = 0;\n\n    private mRepeatLimit:number = 0;\n\n    private mScroll:number = 0;\n\n    constructor(v:TextView) {\n        super();\n        const density:number = v.getResources().getDisplayMetrics().density;\n        this.mScrollUnit = (Marquee.MARQUEE_PIXELS_PER_SECOND * density) / Marquee.MARQUEE_RESOLUTION;\n        this.mView = new WeakReference<TextView>(v);\n    }\n\n    handleMessage(msg:Message):void  {\n        switch(msg.what) {\n            case Marquee.MESSAGE_START:\n                this.mStatus = Marquee.MARQUEE_RUNNING;\n                this.tick();\n                break;\n            case Marquee.MESSAGE_TICK:\n                this.tick();\n                break;\n            case Marquee.MESSAGE_RESTART:\n                if (this.mStatus == Marquee.MARQUEE_RUNNING) {\n                    if (this.mRepeatLimit >= 0) {\n                        this.mRepeatLimit--;\n                    }\n                    this.start(this.mRepeatLimit);\n                }\n                break;\n        }\n    }\n\n    tick():void  {\n        if (this.mStatus != Marquee.MARQUEE_RUNNING) {\n            return;\n        }\n        this.removeMessages(Marquee.MESSAGE_TICK);\n        const textView:TextView = this.mView.get();\n        if (textView != null && (textView.isFocused() || textView.isSelected())) {\n            this.mScroll += this.mScrollUnit;\n            if (this.mScroll > this.mMaxScroll) {\n                this.mScroll = this.mMaxScroll;\n                this.sendEmptyMessageDelayed(Marquee.MESSAGE_RESTART, Marquee.MARQUEE_RESTART_DELAY);\n            } else {\n                this.sendEmptyMessageDelayed(Marquee.MESSAGE_TICK, Marquee.MARQUEE_RESOLUTION);\n            }\n            textView.invalidate();\n        }\n    }\n\n    stop():void  {\n        this.mStatus = Marquee.MARQUEE_STOPPED;\n        this.removeMessages(Marquee.MESSAGE_START);\n        this.removeMessages(Marquee.MESSAGE_RESTART);\n        this.removeMessages(Marquee.MESSAGE_TICK);\n        this.resetScroll();\n    }\n\n    private resetScroll():void  {\n        this.mScroll = 0.0;\n        const textView:TextView = this.mView.get();\n        if (textView != null)\n            textView.invalidate();\n    }\n\n    start(repeatLimit:number):void  {\n        if (repeatLimit == 0) {\n            this.stop();\n            return;\n        }\n        this.mRepeatLimit = repeatLimit;\n        const textView:TextView = this.mView.get();\n        if (textView != null && textView.mLayout != null) {\n            this.mStatus = Marquee.MARQUEE_STARTING;\n            this.mScroll = 0.0;\n            const textWidth:number = textView.getWidth() - textView.getCompoundPaddingLeft() - textView.getCompoundPaddingRight();\n            const lineWidth:number = textView.mLayout.getLineWidth(0);\n            const gap:number = textWidth / 3.0;\n            this.mGhostStart = lineWidth - textWidth + gap;\n            this.mMaxScroll = this.mGhostStart + textWidth;\n            this.mGhostOffset = lineWidth + gap;\n            this.mFadeStop = lineWidth + textWidth / 6.0;\n            this.mMaxFadeScroll = this.mGhostStart + lineWidth + lineWidth;\n            textView.invalidate();\n            this.sendEmptyMessageDelayed(Marquee.MESSAGE_START, Marquee.MARQUEE_DELAY);\n        }\n    }\n\n    getGhostOffset():number  {\n        return this.mGhostOffset;\n    }\n\n    getScroll():number  {\n        return this.mScroll;\n    }\n\n    getMaxFadeScroll():number  {\n        return this.mMaxFadeScroll;\n    }\n\n    shouldDrawLeftFade():boolean  {\n        return this.mScroll <= this.mFadeStop;\n    }\n\n    shouldDrawGhost():boolean  {\n        return this.mStatus == Marquee.MARQUEE_RUNNING && this.mScroll > this.mGhostStart;\n    }\n\n    isRunning():boolean  {\n        return this.mStatus == Marquee.MARQUEE_RUNNING;\n    }\n\n    isStopped():boolean  {\n        return this.mStatus == Marquee.MARQUEE_STOPPED;\n    }\n}\nexport class ChangeWatcher implements TextWatcher, SpanWatcher {\n    _TextView_this:TextView;\n    constructor(arg:TextView){\n        this._TextView_this = arg;\n    }\n\n    private mBeforeText:String;\n\n    beforeTextChanged(buffer:String, start:number, before:number, after:number):void  {\n        if (TextView.DEBUG_EXTRACT)\n            Log.v(TextView.LOG_TAG, \"beforeTextChanged start=\" + start + \" before=\" + before + \" after=\" + after + \": \" + buffer);\n        //if (AccessibilityManager.getInstance(this._TextView_this.mContext).isEnabled() && ((!TextView.isPasswordInputType(this._TextView_this.getInputType()) && !this._TextView_this.hasPasswordTransformationMethod()) || this._TextView_this.shouldSpeakPasswordsForAccessibility())) {\n        //    this.mBeforeText = buffer.toString();\n        //}\n        this._TextView_this.sendBeforeTextChanged(buffer, start, before, after);\n    }\n\n    onTextChanged(buffer:String, start:number, before:number, after:number):void  {\n        if (TextView.DEBUG_EXTRACT)\n            Log.v(TextView.LOG_TAG, \"onTextChanged start=\" + start + \" before=\" + before + \" after=\" + after + \": \" + buffer);\n        this._TextView_this.handleTextChanged(buffer, start, before, after);\n        //if (AccessibilityManager.getInstance(this._TextView_this.mContext).isEnabled() && (this._TextView_this.isFocused() || this._TextView_this.isSelected() && this._TextView_this.isShown())) {\n        //    this._TextView_this.sendAccessibilityEventTypeViewTextChanged(this.mBeforeText, start, before, after);\n        //    this.mBeforeText = null;\n        //}\n    }\n\n    afterTextChanged(buffer:String):void  {\n        if (TextView.DEBUG_EXTRACT)\n            Log.v(TextView.LOG_TAG, \"afterTextChanged: \" + buffer);\n        this._TextView_this.sendAfterTextChanged(buffer);\n        //if (MetaKeyKeyListener.getMetaState(buffer, MetaKeyKeyListener.META_SELECTING) != 0) {\n        //    MetaKeyKeyListener.stopSelecting(this._TextView_this, buffer);\n        //}\n    }\n\n    onSpanChanged(buf:Spannable, what:any, s:number, e:number, st:number, en:number):void  {\n        if (TextView.DEBUG_EXTRACT)\n            Log.v(TextView.LOG_TAG, \"onSpanChanged s=\" + s + \" e=\" + e + \" st=\" + st + \" en=\" + en + \" what=\" + what + \": \" + buf);\n        this._TextView_this.spanChange(buf, what, s, st, e, en);\n    }\n\n    onSpanAdded(buf:Spannable, what:any, s:number, e:number):void  {\n        if (TextView.DEBUG_EXTRACT)\n            Log.v(TextView.LOG_TAG, \"onSpanAdded s=\" + s + \" e=\" + e + \" what=\" + what + \": \" + buf);\n        this._TextView_this.spanChange(buf, what, -1, s, -1, e);\n    }\n\n    onSpanRemoved(buf:Spannable, what:any, s:number, e:number):void  {\n        if (TextView.DEBUG_EXTRACT)\n            Log.v(TextView.LOG_TAG, \"onSpanRemoved s=\" + s + \" e=\" + e + \" what=\" + what + \": \" + buf);\n        this._TextView_this.spanChange(buf, what, s, -1, e, -1);\n    }\n}\nexport enum BufferType {\n\n    NORMAL /*() {\n    }\n     */, SPANNABLE /*() {\n    }\n     */, EDITABLE /*() {\n    }\n     */ /*;\n     */}}\n\n}"
  },
  {
    "path": "src/android/widget/Toast.ts",
    "content": "/*\n * Copyright (C) 2007 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/content/res/Resources.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n///<reference path=\"../../android/graphics/PixelFormat.ts\"/>\n///<reference path=\"../../android/os/Handler.ts\"/>\n///<reference path=\"../../android/util/Log.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/view/LayoutInflater.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/WindowManager.ts\"/>\n///<reference path=\"../../android/view/Window.ts\"/>\n///<reference path=\"../../android/widget/TextView.ts\"/>\n///<reference path=\"../../java/lang/Runnable.ts\"/>\n\nmodule android.widget {\n    import Context = android.content.Context;\n    import Resources = android.content.res.Resources;\n    import PixelFormat = android.graphics.PixelFormat;\n    import Handler = android.os.Handler;\n    import Log = android.util.Log;\n    import Gravity = android.view.Gravity;\n    import LayoutInflater = android.view.LayoutInflater;\n    import View = android.view.View;\n    import OnClickListener = android.view.View.OnClickListener;\n    import WindowManager = android.view.WindowManager;\n    import Window = android.view.Window;\n    import TextView = android.widget.TextView;\n    import Runnable = java.lang.Runnable;\n    /**\n     * A toast is a view containing a quick little message for the user.  The toast class\n     * helps you create and show those.\n     * {@more}\n     *\n     * <p>\n     * When the view is shown to the user, appears as a floating view over the\n     * application.  It will never receive focus.  The user will probably be in the\n     * middle of typing something else.  The idea is to be as unobtrusive as\n     * possible, while still showing the user the information you want them to see.\n     * Two examples are the volume control, and the brief message saying that your\n     * settings have been saved.\n     * <p>\n     * The easiest way to use this class is to call one of the static methods that constructs\n     * everything you need and returns a new Toast object.\n     *\n     * <div class=\"special reference\">\n     * <h3>Developer Guides</h3>\n     * <p>For information about creating Toast notifications, read the\n     * <a href=\"{@docRoot}guide/topics/ui/notifiers/toasts.html\">Toast Notifications</a> developer\n     * guide.</p>\n     * </div>\n     */\n    export class Toast {\n\n        static TAG:string = \"Toast\";\n\n        static localLOGV:boolean = false;\n\n        /**\n         * Show the view or text notification for a short period of time.  This time\n         * could be user-definable.  This is the default.\n         * @see #setDuration\n         */\n        static LENGTH_SHORT:number = 0;\n\n        /**\n         * Show the view or text notification for a long period of time.  This time\n         * could be user-definable.\n         * @see #setDuration\n         */\n        static LENGTH_LONG:number = 1;\n\n        mContext:Context;\n\n        mTN:Toast.TN;\n\n        mDuration:number = 0;\n\n        mNextView:View;\n\n        private mHandler = new Handler();\n        private mDelayHide:Runnable = (()=> {\n            const inner_this = this;\n            return {\n                run() {\n                    inner_this.mTN.hide();\n                }\n            }\n        })();\n\n        /**\n         * Construct an empty Toast object.  You must call {@link #setView} before you\n         * can call {@link #show}.\n         *\n         * @param context  The context to use.  Usually your {@link android.app.Application}\n         *                 or {@link android.app.Activity} object.\n         */\n        constructor(context:Context) {\n            this.mContext = context;\n            this.mTN = new Toast.TN();\n            this.mTN.mY = context.getResources().getDisplayMetrics().density * 64;\n            this.mTN.mGravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;\n        }\n\n        /**\n         * Show the view for the specified duration.\n         */\n        show():void {\n            if (this.mNextView == null) {\n                throw Error(`new RuntimeException(\"setView must have been called\")`);\n            }\n            let tn:Toast.TN = this.mTN;\n            tn.mNextView = this.mNextView;\n            tn.show();\n\n            this.mHandler.removeCallbacks(this.mDelayHide);\n            let showDuration = this.mDuration === Toast.LENGTH_LONG ? 3500 : (this.mDuration === Toast.LENGTH_SHORT ? 2000 : this.mDuration);\n            this.mHandler.postDelayed(this.mDelayHide, showDuration);\n        }\n\n        /**\n         * Close the view if it's showing, or don't show it if it isn't showing yet.\n         * You do not normally have to call this.  Normally view will disappear on its own\n         * after the appropriate duration.\n         */\n        cancel():void {\n            this.mTN.hide();\n        }\n\n        /**\n         * Set the view to show.\n         * @see #getView\n         */\n        setView(view:View):void {\n            this.mNextView = view;\n        }\n\n        /**\n         * Return the view.\n         * @see #setView\n         */\n        getView():View {\n            return this.mNextView;\n        }\n\n        /**\n         * Set how long to show the view for.\n         * @see #LENGTH_SHORT\n         * @see #LENGTH_LONG\n         */\n        setDuration(duration:number):void {\n            this.mDuration = duration;\n        }\n\n        /**\n         * Return the duration.\n         * @see #setDuration\n         */\n        getDuration():number {\n            return this.mDuration;\n        }\n\n        ///**\n        // * Set the margins of the view.\n        // *\n        // * @param horizontalMargin The horizontal margin, in percentage of the\n        // *        container width, between the container's edges and the\n        // *        notification\n        // * @param verticalMargin The vertical margin, in percentage of the\n        // *        container height, between the container's edges and the\n        // *        notification\n        // */\n        //setMargin(horizontalMargin:number, verticalMargin:number):void  {\n        //    this.mTN.mHorizontalMargin = horizontalMargin;\n        //    this.mTN.mVerticalMargin = verticalMargin;\n        //}\n        //\n        ///**\n        // * Return the horizontal margin.\n        // */\n        //getHorizontalMargin():number  {\n        //    return this.mTN.mHorizontalMargin;\n        //}\n        //\n        ///**\n        // * Return the vertical margin.\n        // */\n        //getVerticalMargin():number  {\n        //    return this.mTN.mVerticalMargin;\n        //}\n\n        /**\n         * Set the location at which the notification should appear on the screen.\n         * @see android.view.Gravity\n         * @see #getGravity\n         */\n        setGravity(gravity:number, xOffset:number, yOffset:number):void {\n            this.mTN.mGravity = gravity;\n            this.mTN.mX = xOffset;\n            this.mTN.mY = yOffset;\n        }\n\n        /**\n         * Get the location at which the notification should appear on the screen.\n         * @see android.view.Gravity\n         * @see #getGravity\n         */\n        getGravity():number {\n            return this.mTN.mGravity;\n        }\n\n        /**\n         * Return the X offset in pixels to apply to the gravity's location.\n         */\n        getXOffset():number {\n            return this.mTN.mX;\n        }\n\n        /**\n         * Return the Y offset in pixels to apply to the gravity's location.\n         */\n        getYOffset():number {\n            return this.mTN.mY;\n        }\n\n        /**\n         * Make a standard toast that just contains a text view.\n         *\n         * @param context  The context to use.  Usually your {@link android.app.Application}\n         *                 or {@link android.app.Activity} object.\n         * @param text     The text to show.  Can be formatted text.\n         * @param duration How long to display the message.  Either {@link #LENGTH_SHORT} or\n         *                 {@link #LENGTH_LONG}\n         *\n         */\n        static makeText(context:Context, text:string, duration:number):Toast {\n            let result:Toast = new Toast(context);\n            let inflate:LayoutInflater = context.getLayoutInflater();//<LayoutInflater> context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n            let v:View = inflate.inflate(android.R.layout.transient_notification, null);\n            let tv:TextView = <TextView> v.findViewById(android.R.id.message);\n            tv.setMaxWidth(260 * context.getResources().getDisplayMetrics().density);\n            tv.setText(text);\n            result.mNextView = v;\n            result.mDuration = duration;\n            return result;\n        }\n\n        ///**\n        // * Make a standard toast that just contains a text view with the text from a resource.\n        // *\n        // * @param context  The context to use.  Usually your {@link android.app.Application}\n        // *                 or {@link android.app.Activity} object.\n        // * @param resId    The resource id of the string resource to use.  Can be formatted text.\n        // * @param duration How long to display the message.  Either {@link #LENGTH_SHORT} or\n        // *                 {@link #LENGTH_LONG}\n        // *\n        // * @throws Resources.NotFoundException if the resource can't be found.\n        // */\n        //static makeText(context:Context, resId:number, duration:number):Toast  {\n        //    return Toast.makeText(context, context.getResources().getText(resId), duration);\n        //}\n\n        ///**\n        // * Update the text in a Toast that was previously created using one of the makeText() methods.\n        // * @param resId The new text for the Toast.\n        // */\n        //setText(resId:number):void  {\n        //    this.setText(this.mContext.getText(resId));\n        //}\n\n        /**\n         * Update the text in a Toast that was previously created using one of the makeText() methods.\n         * @param s The new text for the Toast.\n         */\n        setText(s:string):void {\n            if (this.mNextView == null) {\n                throw Error(`new RuntimeException(\"This Toast was not created with Toast.makeText()\")`);\n            }\n            let tv:TextView = <TextView> this.mNextView.findViewById(android.R.id.message);\n            if (tv == null) {\n                throw Error(`new RuntimeException(\"This Toast was not created with Toast.makeText()\")`);\n            }\n            tv.setText(s);\n        }\n    }\n\n    export module Toast {\n        export class TN {\n\n            mShow:Runnable = (()=> {\n                const inner_this = this;\n                class _Inner implements Runnable {\n\n                    run():void {\n                        inner_this.handleShow();\n                    }\n                }\n                return new _Inner();\n            })();\n\n            mHide:Runnable = (()=> {\n                const inner_this = this;\n                class _Inner implements Runnable {\n\n                    run():void {\n                        inner_this.handleHide();\n                        // Don't do this in handleHide() because it is also invoked by handleShow()\n                        inner_this.mNextView = null;\n                    }\n                }\n                return new _Inner();\n            })();\n\n            //private mParams:WindowManager.LayoutParams = new WindowManager.LayoutParams();\n\n            mHandler:Handler = new Handler();\n\n            mGravity:number = 0;\n\n            mX:number = 0;\n            mY:number = 0;\n\n            //mHorizontalMargin:number = 0;\n            //\n            //mVerticalMargin:number = 0;\n\n            mView:View;\n            mWindow:Window;\n\n            mNextView:View;\n\n            mWM:WindowManager;\n\n            /**\n             * schedule handleShow into the right thread\n             */\n            show():void {\n                if (Toast.localLOGV) Log.v(Toast.TAG, \"SHOW: \" + this);\n                this.mHandler.post(this.mShow);\n            }\n\n            /**\n             * schedule handleHide into the right thread\n             */\n            hide():void {\n                if (Toast.localLOGV) Log.v(Toast.TAG, \"HIDE: \" + this);\n                this.mHandler.post(this.mHide);\n            }\n\n            handleShow():void {\n                if (Toast.localLOGV) Log.v(Toast.TAG, \"HANDLE SHOW: \" + this + \" mView=\" + this.mView + \" mNextView=\" + this.mNextView);\n                if (this.mView != this.mNextView) {\n                    // remove the old view if necessary\n                    this.handleHide();\n                    this.mView = this.mNextView;\n                    if (!this.mWindow) {\n                        this.mWindow = new Window(this.mView.getContext().getApplicationContext());\n\n                        const params:WindowManager.LayoutParams = this.mWindow.getAttributes();\n                        params.height = WindowManager.LayoutParams.WRAP_CONTENT;\n                        params.width = WindowManager.LayoutParams.WRAP_CONTENT;\n                        //params.format = PixelFormat.TRANSLUCENT;\n                        //params.windowAnimations = com.android.internal.R.style.Animation_Toast;\n                        params.dimAmount = 0;\n                        params.type = WindowManager.LayoutParams.TYPE_TOAST;\n                        params.setTitle(\"Toast\");\n                        params.leftMargin = params.rightMargin = 36 * this.mView.getContext().getResources().getDisplayMetrics().density;\n                        params.flags =\n                            //WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON |\n                            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;\n\n                        this.mWindow.setFloating(true);\n                        this.mWindow.setBackgroundColor(android.graphics.Color.TRANSPARENT);\n                        this.mWindow.setWindowAnimations(android.R.anim.toast_enter, android.R.anim.toast_exit, null, null);\n                    }\n                    const params:WindowManager.LayoutParams = this.mWindow.getAttributes();\n                    this.mWindow.setContentView(this.mView);\n\n                    let context:Context = this.mView.getContext().getApplicationContext();\n                    //if (context == null) {\n                    //    context = this.mView.getContext();\n                    //}\n                    this.mWM = context.getWindowManager();//<WindowManager> context.getSystemService(Context.WINDOW_SERVICE);\n                    // We can resolve the Gravity here by using the Locale for getting\n                    // the layout direction\n                    //const config:Configuration = this.mView.getContext().getResources().getConfiguration();\n                    const gravity:number = Gravity.getAbsoluteGravity(this.mGravity/*, config.getLayoutDirection()*/);\n                    params.gravity = gravity;\n                    //if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.FILL_HORIZONTAL) {\n                    //    this.mParams.horizontalWeight = 1.0;\n                    //}\n                    //if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.FILL_VERTICAL) {\n                    //    this.mParams.verticalWeight = 1.0;\n                    //}\n                    params.x = this.mX;\n                    params.y = this.mY;\n                    //this.mParams.verticalMargin = this.mVerticalMargin;\n                    //this.mParams.horizontalMargin = this.mHorizontalMargin;\n\n                    if (this.mWindow.getDecorView().getParent() != null) {\n                        if (Toast.localLOGV) Log.v(Toast.TAG, \"REMOVE! \" + this.mView + \" in \" + this);\n                        this.mWM.removeWindow(this.mWindow);\n                    }\n                    if (Toast.localLOGV) Log.v(Toast.TAG, \"ADD! \" + this.mView + \" in \" + this);\n                    this.mWM.addWindow(this.mWindow);\n                    //this.trySendAccessibilityEvent();\n                }\n            }\n\n            //private trySendAccessibilityEvent():void  {\n            //    let accessibilityManager:AccessibilityManager = AccessibilityManager.getInstance(this.mView.getContext());\n            //    if (!accessibilityManager.isEnabled()) {\n            //        return;\n            //    }\n            //    // treat toasts as notifications since they are used to\n            //    // announce a transient piece of information to the user\n            //    let event:AccessibilityEvent = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED);\n            //    event.setClassName(this.getClass().getName());\n            //    event.setPackageName(this.mView.getContext().getPackageName());\n            //    this.mView.dispatchPopulateAccessibilityEvent(event);\n            //    accessibilityManager.sendAccessibilityEvent(event);\n            //}\n\n            handleHide():void {\n                if (Toast.localLOGV)\n                    Log.v(Toast.TAG, \"HANDLE HIDE: \" + this + \" mView=\" + this.mView);\n                if (this.mView != null) {\n                    // the view isn't yet added, so let's try not to crash.\n                    if (this.mView.getParent() != null) {\n                        if (Toast.localLOGV) Log.v(Toast.TAG, \"REMOVE! \" + this.mView + \" in \" + this);\n                        this.mWM.removeWindow(this.mWindow);\n                    }\n                    this.mView = null;\n                }\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "src/android/widget/WrapperListAdapter.ts",
    "content": "/*\n * Copyright (C) 2008 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n///<reference path=\"../../android/widget/Adapter.ts\"/>\n///<reference path=\"../../android/widget/ListAdapter.ts\"/>\n///<reference path=\"../../android/widget/ListView.ts\"/>\n\nmodule android.widget {\nimport Adapter = android.widget.Adapter;\nimport ListAdapter = android.widget.ListAdapter;\nimport ListView = android.widget.ListView;\n/**\n * List adapter that wraps another list adapter. The wrapped adapter can be retrieved\n * by calling {@link #getWrappedAdapter()}.\n *\n * @see ListView\n */\nexport interface WrapperListAdapter extends ListAdapter {\n\n    /**\n     * Returns the adapter wrapped by this list adapter.\n     *\n     * @return The {@link android.widget.ListAdapter} wrapped by this adapter.\n     */\n    getWrappedAdapter():ListAdapter ;\n}\n}"
  },
  {
    "path": "src/androidui/AndroidUI.ts",
    "content": "/**\n * Created by linfaxin on 15/10/23.\n */\n///<reference path=\"../android/app/Application.ts\"/>\n///<reference path=\"../android/view/View.ts\"/>\n///<reference path=\"../android/view/ViewGroup.ts\"/>\n///<reference path=\"../android/view/ViewRootImpl.ts\"/>\n///<reference path=\"../android/widget/FrameLayout.ts\"/>\n///<reference path=\"../android/view/MotionEvent.ts\"/>\n///<reference path=\"../android/view/KeyEvent.ts\"/>\n///<reference path=\"../android/view/WindowManager.ts\"/>\n///<reference path=\"../android/app/ActivityThread.ts\"/>\n///<reference path=\"../android/R/string.ts\"/>\n///<reference path=\"AndroidUIElement.ts\"/>\n\n/**\n * Bridge between Html Element and Android View\n */\nmodule androidui {\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import FrameLayout = android.widget.FrameLayout;\n    import MotionEvent = android.view.MotionEvent;\n    import KeyEvent = android.view.KeyEvent;\n    import Intent = android.content.Intent;\n    import ActivityThread = android.app.ActivityThread;\n    import UIClient = androidui.AndroidUI.UIClient;\n    import ViewRootImpl = android.view.ViewRootImpl;\n\n    export class AndroidUI {\n        static BindToElementName = 'AndroidUI';\n\n        androidUIElement:AndroidUIElement;\n\n        private _canvas:HTMLCanvasElement = document.createElement(\"canvas\");\n        get windowManager(){\n            return this.mApplication.getWindowManager();\n        }\n        private mActivityThread:ActivityThread;\n        private _viewRootImpl:android.view.ViewRootImpl;\n        private mApplication:android.app.Application;\n        appName:string;\n        private uiClient:AndroidUI.UIClient;\n        private viewsDependOnDebugLayout = new Set<View>();\n        private showDebugLayoutDefault = false;\n\n        private _windowBound = new android.graphics.Rect();\n        private tempRect = new android.graphics.Rect();\n        get windowBound():android.graphics.Rect{\n            return this._windowBound;\n        }\n        private touchEvent = new MotionEvent();\n        private ketEvent = new KeyEvent();\n\n        constructor(androidUIElement:AndroidUIElement) {\n            this.androidUIElement = androidUIElement;\n            if(androidUIElement[AndroidUI.BindToElementName]){\n                throw Error('already init a AndroidUI with this element');\n            }\n            androidUIElement[AndroidUI.BindToElementName] = this;\n            this.init();\n        }\n\n\n        private init() {\n            this.appName = document.title;\n            this._viewRootImpl = new android.view.ViewRootImpl();\n\n            this.initAndroidUIElement();\n\n            this.initApplication();\n\n            this.androidUIElement.appendChild(this._canvas);\n\n            this.initEvent();\n\n            this.initRootSizeChange();\n\n            this._viewRootImpl.setView(this.windowManager.getWindowsLayout());\n            this._viewRootImpl.initSurface(this._canvas);\n\n            this.initBrowserVisibleChange();\n\n            this.initLaunchActivity();\n\n            this.initGlobalCrashHandle();\n        }\n\n        private initApplication() {\n            const appName = this.androidUIElement.getAttribute('appName');\n            let appClazz;\n            if (appName) {\n                try {\n                    appClazz = eval(appName);\n                } catch (e) {\n                }\n            }\n            appClazz = appClazz || android.app.Application;\n            this.mApplication = new appClazz(this);\n            this.mApplication.onCreate();\n        }\n\n        private initLaunchActivity(){\n            this.mActivityThread = new ActivityThread(this);\n\n            //launch activity defined in 'android-ui' element\n            for(let ele of Array.from(this.androidUIElement.children)){\n                let tagName = ele.tagName;\n                if(tagName != 'ACTIVITY') continue;\n                let activityName = ele.getAttribute('name') || ele.getAttribute('android:name') || 'android.app.Activity';\n\n                let intent = new Intent(activityName);\n                this.mActivityThread.overrideNextWindowAnimation(null, null, null, null);\n                let activity = this.mActivityThread.handleLaunchActivity(intent);\n                if (activity) {\n                    this.androidUIElement.removeChild(ele);\n\n                    // show layout defined in activity tag\n                    for(let element of Array.from((<HTMLElement>ele).children)){\n                        android.view.LayoutInflater.from(activity).inflate(<HTMLElement>element, activity.getWindow().mContentParent, true);\n                    }\n\n                    //activity could have a attribute defined callback when created\n                    let onCreateFunc = ele.getAttribute('oncreate');\n                    if(onCreateFunc && typeof window[onCreateFunc] === \"function\"){\n                        window[onCreateFunc].call(this, activity);\n                    }\n\n                }\n            }\n\n            this.mActivityThread.initWithPageStack();//restore activity here.\n        }\n\n        private initGlobalCrashHandle(){\n            window.onerror = (sMsg,sUrl,sLine)=>{\n                if(window.confirm(android.R.string_.crash_catch_alert+'\\n'+sMsg)){\n                    //reload will clear console's log.\n                    window.location.reload();\n                }\n            }\n        }\n\n\n        /**\n         * @returns {boolean} is bound change\n         */\n        private refreshWindowBound():boolean {\n\n            let boundLeft = this.androidUIElement.offsetLeft;\n            let boundTop = this.androidUIElement.offsetTop;\n\n            let parent = this.androidUIElement.parentElement;\n            if(parent){\n                boundLeft += parent.offsetLeft;\n                boundTop += parent.offsetTop;\n                parent = parent.parentElement;\n            }\n            let boundRight = boundLeft + this.androidUIElement.offsetWidth;\n            let boundBottom = boundTop + this.androidUIElement.offsetHeight;\n\n            if(this._windowBound && this._windowBound.left == boundLeft && this._windowBound.top == boundTop\n                && this._windowBound.right == boundRight && this._windowBound.bottom == boundBottom){\n                return false;\n            }\n            this._windowBound.set(boundLeft, boundTop, boundRight, boundBottom);\n            return true;\n        }\n\n        private initAndroidUIElement(){\n            if (this.androidUIElement.style.display==='none') {\n                this.androidUIElement.style.display = '';\n            }\n\n            this.androidUIElement.setAttribute('tabindex', '0');//let element could get focus. so the key event can handle.\n            this.androidUIElement.focus();\n            this.androidUIElement.onblur = (e) => {\n                this._viewRootImpl.ensureTouchMode(true);\n            };\n        }\n\n        private initEvent(){\n            this.initTouchEvent();\n            this.initMouseEvent();\n            this.initKeyEvent();\n            this.initGenericEvent();\n        }\n\n        private initTouchEvent() {\n            this.androidUIElement.addEventListener('touchstart', (e)=> {\n                this.refreshWindowBound();\n\n                if(e.target!=document.activeElement || !this.androidUIElement.contains(<HTMLElement>document.activeElement)){\n                    this.androidUIElement.focus();\n                }\n\n                this.touchEvent.initWithTouch(<any>e, MotionEvent.ACTION_DOWN, this._windowBound);\n                if(this._viewRootImpl.dispatchInputEvent(this.touchEvent)){\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n\n            }, true);\n\n            this.androidUIElement.addEventListener('touchmove', (e)=> {\n                this.touchEvent.initWithTouch(<any>e, MotionEvent.ACTION_MOVE, this._windowBound);\n                if(this._viewRootImpl.dispatchInputEvent(this.touchEvent)){\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n            this.androidUIElement.addEventListener('touchend', (e)=> {\n                this.touchEvent.initWithTouch(<any>e, MotionEvent.ACTION_UP, this._windowBound);\n                if(this._viewRootImpl.dispatchInputEvent(this.touchEvent)){\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n            this.androidUIElement.addEventListener('touchcancel', (e)=> {\n                this.touchEvent.initWithTouch(<any>e, MotionEvent.ACTION_CANCEL, this._windowBound);\n                if(this._viewRootImpl.dispatchInputEvent(this.touchEvent)){\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n        }\n\n        private initMouseEvent(){\n            function mouseToTouchEvent(e:MouseEvent){\n                let touch:Touch = {\n                    identifier: 0,\n                    target: null,\n                    screenX: e.screenX,\n                    screenY: e.screenY,\n                    clientX: e.clientX,\n                    clientY: e.clientY,\n                    pageX: e.pageX,\n                    pageY: e.pageY\n                };\n                return {\n                    changedTouches : [touch],\n                    targetTouches : [touch],\n                    touches : e.type === 'mouseup' ? [] : [touch],\n                    timeStamp : e.timeStamp\n                };\n            }\n            let isMouseDown = false;\n\n            this.androidUIElement.addEventListener('mousedown', (e:MouseEvent)=> {\n                isMouseDown = true;\n                this.refreshWindowBound();\n\n                if(e.target!=document.activeElement || !this.androidUIElement.contains(<HTMLElement>document.activeElement)){\n                    this.androidUIElement.focus();\n                }\n\n                this.touchEvent.initWithTouch(<any>mouseToTouchEvent(e), MotionEvent.ACTION_DOWN, this._windowBound);\n                if(this._viewRootImpl.dispatchInputEvent(this.touchEvent)){\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n\n            this.androidUIElement.addEventListener('mousemove', (e)=> {\n                if(!isMouseDown) return;\n                this.touchEvent.initWithTouch(<any>mouseToTouchEvent(e), MotionEvent.ACTION_MOVE, this._windowBound);\n                if(this._viewRootImpl.dispatchInputEvent(this.touchEvent)){\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n\n            this.androidUIElement.addEventListener('mouseup', (e)=> {\n                isMouseDown = false;\n                this.touchEvent.initWithTouch(<any>mouseToTouchEvent(e), MotionEvent.ACTION_UP, this._windowBound);\n                if(this._viewRootImpl.dispatchInputEvent(this.touchEvent)){\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n\n            this.androidUIElement.addEventListener('mouseleave', (e)=> {\n                if(e.fromElement === this.androidUIElement){\n                    isMouseDown = false;\n                    this.touchEvent.initWithTouch(<any>mouseToTouchEvent(e), MotionEvent.ACTION_CANCEL, this._windowBound);\n                    if(this._viewRootImpl.dispatchInputEvent(this.touchEvent)){\n                        e.stopPropagation();\n                        e.preventDefault();\n                        return true;\n                    }\n                }\n            }, true);\n\n\n            let scrollEvent = new MotionEvent();\n            //Action_Scroll\n            this.androidUIElement.addEventListener('mousewheel', (e:MouseWheelEvent)=> {\n                scrollEvent.initWithMouseWheel(<WheelEvent><any>e);\n                if(this._viewRootImpl.dispatchInputEvent(scrollEvent)){\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n        }\n\n        private initKeyEvent(){\n            this.androidUIElement.addEventListener('keydown', (e:KeyboardEvent)=> {\n                this.ketEvent.initKeyEvent(e, KeyEvent.ACTION_DOWN);\n                if(this._viewRootImpl.dispatchInputEvent(this.ketEvent)){\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n            this.androidUIElement.addEventListener('keyup', (e:KeyboardEvent)=> {\n                this.ketEvent.initKeyEvent(e, KeyEvent.ACTION_UP);\n                if(this._viewRootImpl.dispatchInputEvent(this.ketEvent)){\n                    e.stopPropagation();\n                    e.preventDefault();\n                    return true;\n                }\n            }, true);\n\n        }\n        private initGenericEvent(){\n            // No generic Event current. Hover event should listen & dispatch here\n        }\n\n        private initRootSizeChange(){\n            const inner_this = this;\n            window.addEventListener('resize', ()=>{\n                inner_this.notifyRootSizeChange();\n            });\n\n            let lastWidth = this.androidUIElement.offsetWidth;\n            let lastHeight = this.androidUIElement.offsetHeight;\n            if(lastWidth>0 && lastHeight>0) this.notifyRootSizeChange();\n\n            setInterval(()=>{\n                let width = inner_this.androidUIElement.offsetWidth;\n                let height = inner_this.androidUIElement.offsetHeight;\n                if(lastHeight !== height || lastWidth !== width){\n                    lastWidth = width;\n                    lastHeight = height;\n                    inner_this.notifyRootSizeChange();\n                }\n\n            }, 500);\n        }\n\n        private initBrowserVisibleChange(){\n            var eventName = 'visibilitychange';\n            if (document['webkitHidden'] != undefined) {\n                eventName = 'webkitvisibilitychange';\n            }\n            document.addEventListener(eventName, ()=>{\n                if(document['hidden'] || document['webkitHidden']){\n                    //hidden\n                    this.mActivityThread.scheduleApplicationHide();\n                }else{\n                    //show\n                    this.mActivityThread.scheduleApplicationShow();\n                    this._viewRootImpl.invalidate();\n                }\n            }, false);\n        }\n\n        private notifyRootSizeChange(){\n            if(this.refreshWindowBound()) {\n                let density = android.content.res.Resources.getDisplayMetrics().density;\n                this.tempRect.set(this._windowBound.left * density, this._windowBound.top * density,\n                    this._windowBound.right * density, this._windowBound.bottom * density);\n                let width = this._windowBound.width();\n                let height = this._windowBound.height();\n                this._canvas.width = width * density;\n                this._canvas.height = height * density;\n                this._canvas.style.width = width + \"px\";\n                this._canvas.style.height = height + \"px\";\n                this._viewRootImpl.notifyResized(this.tempRect);\n            }\n        }\n\n        viewAttachedDependOnDebugLayout(view:View):void{\n            this.viewsDependOnDebugLayout.add(view);\n            this.showDebugLayout();\n        }\n        viewDetachedDependOnDebugLayout(view:View):void{\n            this.viewsDependOnDebugLayout.delete(view);\n            if(this.viewsDependOnDebugLayout.size==0 && !this.showDebugLayoutDefault){\n                this.hideDebugLayout();\n            }\n        }\n\n        setDebugEnable(enable = true){\n            ViewRootImpl.DEBUG_FPS = enable;\n            this.setShowDebugLayout(enable);\n        }\n\n        setShowDebugLayout(showDebugLayoutDefault = true){\n            this.showDebugLayoutDefault = showDebugLayoutDefault;\n            if(showDebugLayoutDefault){\n                this.showDebugLayout();\n            }else{\n                this.hideDebugLayout();\n            }\n        }\n        private showDebugLayout(){\n            if(this.windowManager.getWindowsLayout().bindElement.parentNode === null){\n                this.androidUIElement.appendChild(this.windowManager.getWindowsLayout().bindElement);\n            }\n        }\n        private hideDebugLayout(){\n            if(this.windowManager.getWindowsLayout().bindElement.parentNode === this.androidUIElement){\n                this.androidUIElement.removeChild(this.windowManager.getWindowsLayout().bindElement);\n            }\n        }\n\n        setUIClient(uiClient:UIClient){\n            this.uiClient = uiClient;\n        }\n\n        showAppClosed():void {\n            AndroidUI.showAppClosed(this);\n        }\n        \n        private static showAppClosed(androidUI:AndroidUI) {\n            //NOTE: will override by NativeApi\n            androidUI.androidUIElement.parentNode.removeChild(androidUI.androidUIElement);\n            if(androidUI.uiClient && androidUI.uiClient.shouldShowAppClosed){\n                androidUI.uiClient.shouldShowAppClosed(androidUI);\n            }\n        }\n    }\n\n    export module AndroidUI{\n        export interface UIClient{\n            shouldShowAppClosed?(androidUI:AndroidUI);\n        }\n    }\n}"
  },
  {
    "path": "src/androidui/AndroidUIElement.ts",
    "content": "/**\n * Created by linfaxin on 16/1/4.\n */\n\n///<reference path=\"AndroidUI.ts\"/>\n\nmodule androidui{\n\n    if (typeof HTMLDivElement !== 'function'){\n        const _HTMLDivElement = function(){};\n        _HTMLDivElement.prototype = (<any>HTMLDivElement).prototype;\n        HTMLDivElement = <any>_HTMLDivElement;\n    }\n\n    /**\n     * Root Element of a android ui.\n     */\n    export class AndroidUIElement extends HTMLDivElement {\n        AndroidUI:AndroidUI;\n\n        createdCallback():void{\n            $domReady(()=>initElement(this));\n        }\n\n        attachedCallback():void {\n        }\n\n        detachedCallback():void {\n        }\n\n        attributeChangedCallback(attributeName:string, oldVal:string, newVal:string):void {\n            if(attributeName==='debug' && newVal!=null && newVal!='false' && newVal!='0'){\n                this.AndroidUI.setDebugEnable();\n            }\n        }\n    }\n\n    function runFunction(func:string){\n        if(typeof window[func] === \"function\"){\n            window[func]();\n        }else{\n            try {\n                eval(func);\n            } catch (e) {\n                console.warn(e);\n            }\n        }\n    }\n\n    function $domReady(func:()=>void){\n        if(/^loaded|^complete|^interactive/.test(document.readyState)){//already loaded\n            //delay call onCreate, insure browser load lib complete\n            setTimeout(func, 0);\n        }else{\n            document.addEventListener('DOMContentLoaded', func);\n        }\n    }\n\n    function initElement(ele:AndroidUIElement){\n        ele.AndroidUI = new AndroidUI(ele);\n        let debugAttr = ele.getAttribute('debug');\n        if(debugAttr!=null && debugAttr!='0' && debugAttr!='false') ele.AndroidUI.setDebugEnable();\n\n        //life callback\n        let onClose = ele.getAttribute('onclose');\n        if(onClose){\n            ele.AndroidUI.setUIClient({\n                shouldShowAppClosed(androidUI:AndroidUI):void {\n                    if(!onClose) return;\n                    runFunction(onClose);\n                }\n            });\n        }\n        let onLoad = ele.getAttribute('onload');\n        if(onLoad){\n            runFunction(onLoad);\n        }\n    }\n\n    if(typeof document['registerElement'] === \"function\"){\n        (<any>document).registerElement(\"android-ui\", AndroidUIElement);\n    }else{\n        $domReady(()=>{\n            let eles = document.getElementsByTagName('android-ui');\n            for(let ele of Array.from(eles)){\n                initElement(<AndroidUIElement>ele);\n            }\n        });\n    }\n\n\n\n    //init common style\n    let styleElement = document.createElement('style');\n    styleElement.innerHTML += `\n        android-ui {\n            position : relative;\n            overflow : hidden;\n            display : block;\n            outline: none;\n        }\n        android-ui * {\n            overflow : hidden;\n            border : none;\n            outline: none;\n            pointer-events: auto;\n        }\n        android-ui resources {\n            display: none;\n        }\n        android-ui Button {\n            border: none;\n            background: none;\n        }\n        android-ui windowsgroup {\n            pointer-events: none;\n        }\n        android-ui > canvas {\n            position: absolute;\n            left: 0;\n            top: 0;\n        }\n        `;\n    document.head.appendChild(styleElement);\n}"
  },
  {
    "path": "src/androidui/attr/AttrBinder.ts",
    "content": "/**\n * Created by linfaxin on 15/11/26.\n */\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/graphics/drawable/ColorDrawable.ts\"/>\n///<reference path=\"../../android/content/res/ColorStateList.ts\"/>\n///<reference path=\"../../android/content/res/Resources.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n///<reference path=\"AttrValueParser.ts\"/>\n\nfunction fixDefaultNamespaceAndLowerCase(key) {\n    key = key.toLowerCase();\n    if (!key.includes(':')) key = 'android:' + key;\n    return key;\n}\n\nmodule androidui.attr {\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import Gravity = android.view.Gravity;\n    import Drawable = android.graphics.drawable.Drawable;\n    import ColorDrawable = android.graphics.drawable.ColorDrawable;\n    import Color = android.graphics.Color;\n    import ColorStateList = android.content.res.ColorStateList;\n    import Resources = android.content.res.Resources;\n    import Context = android.content.Context;\n    import TypedValue = android.util.TypedValue;\n\n    export class AttrBinder {\n        private host:View|ViewGroup.LayoutParams;\n        private attrChangeMap:Map<string, (newValue:any)=>void>;\n        private attrStashMap:Map<string, ()=>any>;\n        private classAttrBindMap:AttrBinder.ClassBinderMap;\n        private objectRefs = [];\n        private mContext:Context;\n\n        constructor(host:View|ViewGroup.LayoutParams){\n            this.host = host;\n        }\n\n        setClassAttrBind(classAttrBind:AttrBinder.ClassBinderMap):void {\n            if (classAttrBind) {\n                this.classAttrBindMap = classAttrBind;\n            }\n        }\n\n        addAttr(attrName:string, onAttrChange:(newValue:any)=>void, stashAttrValueWhenStateChange?:()=>any):void {\n            if(!attrName) return;\n            attrName = fixDefaultNamespaceAndLowerCase(attrName);\n\n            if(onAttrChange){\n                if (!this.attrChangeMap) {\n                    this.attrChangeMap = new Map<string, (newValue:any)=>void>();\n                }\n                this.attrChangeMap.set(attrName, onAttrChange);\n            }\n            if(stashAttrValueWhenStateChange) {\n                this.attrStashMap = new Map<string, ()=>any>();\n                this.attrStashMap.set(attrName, stashAttrValueWhenStateChange);\n            }\n        }\n\n        onAttrChange(attrName:string, attrValue:any, context:Context):void {\n            this.mContext = context;\n            if(!attrName) return;\n            attrName = fixDefaultNamespaceAndLowerCase(attrName);\n\n            let onAttrChangeCall = this.attrChangeMap && this.attrChangeMap.get(attrName);\n            if(onAttrChangeCall) {\n                onAttrChangeCall.call(this.host, attrValue, this.host);\n            }\n            if(this.classAttrBindMap) {\n                this.classAttrBindMap.callSetter(attrName, this.host, attrValue, this);\n            }\n        }\n\n        /**\n         * @returns {string} undefined if not set get callback on addAttr\n         */\n        getAttrValue(attrName:string):string {\n            if(!attrName) return undefined;\n            attrName = fixDefaultNamespaceAndLowerCase(attrName);\n            let getAttrCall = this.attrStashMap && this.attrStashMap.get(attrName);\n            let value;\n            if(getAttrCall){\n                value = getAttrCall.call(this.host);\n            } else if (this.classAttrBindMap) {\n                value = this.classAttrBindMap.callGetter(attrName, this.host);\n            }\n            if(value == null) return null;\n            if(typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"string\") return value+'';\n            return this.setRefObject(value);\n        }\n\n\n        private getRefObject(ref:string):any{\n            if(ref && ref.startsWith('@ref/')){\n                ref = ref.substring('@ref/'.length);\n                let index = Number.parseInt(ref);\n                if(Number.isInteger(index)){\n                    return this.objectRefs[index];\n                }\n            }\n        }\n\n        private setRefObject(obj:any):string{\n            let index = this.objectRefs.indexOf(obj);\n            if(index>=0) return '@ref/'+index;\n            this.objectRefs.push(obj);\n            return '@ref/'+(this.objectRefs.length-1);\n        }\n\n\n        /**\n         * @param value\n         * @returns {[top, right, bottom, left]}\n         */\n        parsePaddingMarginTRBL(value):number[]{\n            value = (value + '');\n            let parts = [];\n            for(let part of value.split(' ')){\n                if(part) parts.push(part);\n            }\n            let trbl: Array<string>;\n            switch (parts.length){\n                case 1 : trbl = [parts[0], parts[0], parts[0], parts[0]]; break;\n                case 2 : trbl = [parts[0], parts[1], parts[0], parts[1]]; break;\n                case 3 : trbl = [parts[0], parts[1], parts[2], parts[1]]; break;\n                case 4 : trbl = [parts[0], parts[1], parts[2], parts[3]]; break;\n            }\n            if (trbl) {\n                return trbl.map((v) => this.parseDimension(v));\n            }\n            throw Error('not a padding or margin value : '+value);\n\n        }\n\n        parseEnum(value, enumMap:Map<string,number>, defaultValue:number):number {\n            if(Number.isInteger(value)){\n                return value;\n            }\n            if(enumMap.has(value)){\n                return enumMap.get(value);\n            }\n            return defaultValue;\n        }\n\n        parseBoolean(value, defaultValue = true):boolean{\n            if(value===false) return false;\n            else if(value===true) return true;\n            let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n            if (typeof value === \"string\") {\n                return AttrValueParser.parseBoolean(res, value, defaultValue);\n            }\n            return defaultValue;\n        }\n\n        parseGravity(s:string, defaultValue=Gravity.NO_GRAVITY):number {\n            let gravity = Number.parseInt(s);\n            if(Number.isInteger(gravity)) return gravity;\n\n            return Gravity.parseGravity(s, defaultValue);\n        }\n\n        parseDrawable(s:string):Drawable{\n            if(!s) return null;\n            if((<any>s) instanceof Drawable) return <Drawable><any>s;\n            if(s.startsWith('@ref/')){\n                let refObj = this.getRefObject(s);\n                if(refObj) return refObj;\n            }\n            let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n            s = (s + '').trim();\n            return AttrValueParser.parseDrawable(res, s);\n        }\n\n        parseColor(value:string, defaultValue?:number):number{\n            let color = Number.parseInt(value);\n            if(Number.isInteger(color)) return color;\n            let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n            color = AttrValueParser.parseColor(res, value, defaultValue);\n            if(isNaN(color)){\n                return Color.BLACK;\n            }\n            return color;\n        }\n\n        parseColorList(value:string):ColorStateList{\n            if(!value) return null;\n            if((<any>value) instanceof ColorStateList) return <ColorStateList><any>value;\n            if(typeof value == 'number') return ColorStateList.valueOf(<number><any>value);\n            if(value.startsWith('@ref/')){\n                let refObj = this.getRefObject(value);\n                if(refObj) return refObj;\n            }\n            let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n            return AttrValueParser.parseColorStateList(res, value);\n        }\n\n        parseInt(value, defaultValue = 0):number{\n            if(typeof value == 'number') return <number><any>value;\n            let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n            return AttrValueParser.parseInt(res, value, defaultValue);\n        }\n\n        parseFloat(value, defaultValue = 0):number{\n            if(typeof value == 'number') return <number><any>value;\n            let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n            return AttrValueParser.parseFloat(res, value, defaultValue);\n        }\n\n        parseDimension(value, defaultValue = 0, baseValue = 0):number{\n            if(typeof value == 'number') return <number><any>value;\n            let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n            return AttrValueParser.parseDimension(res, value, defaultValue, baseValue);\n        }\n\n        parseNumberPixelOffset(value, defaultValue = 0, baseValue = 0):number{\n            if(typeof value == 'number') return <number><any>value;\n            let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n            return AttrValueParser.parseDimensionPixelOffset(res, value, defaultValue, baseValue);\n        }\n\n        parseNumberPixelSize(value, defaultValue = 0, baseValue = 0):number{\n            if(typeof value == 'number') return <number><any>value;\n            let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n            return AttrValueParser.parseDimensionPixelSize(res, value, defaultValue, baseValue);\n        }\n\n        parseString(value, defaultValue?:string):string{\n            let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n            if(typeof value === 'string') {\n                return AttrValueParser.parseString(res, value, defaultValue);\n            }\n            return defaultValue;\n        }\n\n        parseStringArray(value):string[] {\n            if(typeof value === 'string') {\n                if(value.startsWith('@ref/')){\n                    let refObj = this.getRefObject(value);\n                    if(refObj) return refObj;\n                }\n                let res = this.mContext ? this.mContext.getResources() : Resources.getSystem();\n                return AttrValueParser.parseTextArray(res, value);\n            }\n            return null;\n        }\n\n    }\n\n    export module AttrBinder {\n        export class ClassBinderMap {\n            binderMap:Map<string, ClassBinderValue>;\n            constructor(copyBinderMap?: Map<string, androidui.attr.AttrBinder.ClassBinderValue>) {\n                this.binderMap = new Map<string, ClassBinderValue>(copyBinderMap);\n            }\n\n            set(key:string, value?:androidui.attr.AttrBinder.ClassBinderValue):ClassBinderMap {\n                key = fixDefaultNamespaceAndLowerCase(key);\n                this.binderMap.set(key, value);\n                return this;\n            }\n\n            get(key:string):androidui.attr.AttrBinder.ClassBinderValue {\n                key = fixDefaultNamespaceAndLowerCase(key);\n                return this.binderMap.get(key);\n            }\n\n            private callSetter(attrName:string, host:android.view.View|android.view.ViewGroup.LayoutParams, attrValue:any, attrBinder:AttrBinder):void {\n                if (!attrName) return;\n                let value = this.get(attrName);\n                if (value) {\n                    value.setter.call(host, host, attrValue, attrBinder);\n                }\n            }\n            private callGetter(attrName:string, host:android.view.View|android.view.ViewGroup.LayoutParams): any {\n                if (!attrName) return;\n                let value = this.get(attrName);\n                if (value) {\n                    return value.getter.call(host, host);\n                }\n            }\n        }\n\n        export interface ClassBinderValue {\n            setter:(host:android.view.View|android.view.ViewGroup.LayoutParams, attrValue:any, attrBinder:AttrBinder) => void;\n            getter?:(host:android.view.View|android.view.ViewGroup.LayoutParams) => any;\n        }\n    }\n}"
  },
  {
    "path": "src/androidui/attr/AttrValueParser.ts",
    "content": "/**\n * Created by linfaxin on 16/7/12.\n */\n\nmodule androidui.attr {\n    /**\n     * helper for parse attribute's value\n     */\n    export class AttrValueParser {\n\n        static parseString(r:android.content.res.Resources, value:string, defValue=value):string {\n            if(value==null) return defValue;\n            if(value.startsWith('@')){\n                try {\n                    return r.getString(value);\n                } catch (e) {\n                    console.warn(e);\n                }\n            }\n            return defValue;\n        }\n\n\n        static parseBoolean(r:android.content.res.Resources, value:string, defValue:boolean):boolean {\n            if(value==null) return defValue;\n            if(value.startsWith('@')){\n                try {\n                    return r.getBoolean(value);\n                } catch (e) {\n                    console.warn(e);\n                }\n            }\n            if(value ==='false' || value === '0') return false;\n            else if(value ==='true' || value === '1' || value === '') return true;\n            return defValue;\n        }\n\n        static parseInt(r:android.content.res.Resources, value:string, defValue:number):number {\n            if(value==null) return defValue;\n            if(value.startsWith('@')){\n                try {\n                    return r.getInteger(value);\n                } catch (e) {\n                    console.warn(e);\n                }\n            }\n            let v = parseInt(value);\n            if(isNaN(v)) return defValue;\n            return v;\n        }\n\n\n        static parseFloat(r:android.content.res.Resources, value:string, defValue:number):number {\n            if(value==null) return defValue;\n            if(value.startsWith('@')){\n                try {\n                    return r.getFloat(value);\n                } catch (e) {\n                    console.warn(e);\n                }\n            }\n            let v = parseFloat(value);\n            if(isNaN(v)) return defValue;\n            if(value.endsWith('%')) v/=100;\n            return v;\n        }\n\n        static parseColor(r:android.content.res.Resources, value:string, defValue:number):number {\n            if(value==null) return defValue;\n            try {\n                if(value.startsWith('@')) {\n                    return r.getColor(value);\n                } else {\n                    return android.graphics.Color.parseColor(value);\n                }\n            } catch (e) {\n                console.warn(e);\n            }\n            return defValue;\n        }\n\n        static parseColorStateList(r:android.content.res.Resources, value:string):android.content.res.ColorStateList {\n            if(value==null) return null;\n            if(value.startsWith('@')){\n                return r.getColorStateList(value);\n\n            }else {\n                try {\n                    let color = android.graphics.Color.parseColor(value);\n                    return android.content.res.ColorStateList.valueOf(color);\n                } catch (e) {\n                    console.warn(e);\n                }\n            }\n            return null;\n        }\n\n        static parseDimension(r:android.content.res.Resources, value:string, defValue:number, baseValue=0):number {\n            if(value==null) return defValue;\n            if(value.startsWith('@')){\n                try {\n                    return r.getDimension(value, baseValue);\n                } catch (e) {\n                    console.warn(e);\n                    return defValue;\n                }\n            }\n            try {\n                return android.util.TypedValue.complexToDimension(value, baseValue);\n            } catch (e) {\n                console.warn(e);\n            }\n            return defValue;\n        }\n\n        static parseDimensionPixelOffset(r:android.content.res.Resources, value:string, defValue:number, baseValue=0):number {\n            if(value==null) return defValue;\n            if(value.startsWith('@')){\n                try {\n                    return r.getDimensionPixelOffset(value, baseValue);\n                } catch (e) {\n                    console.warn(e);\n                    return defValue;\n                }\n            }\n            try {\n                return android.util.TypedValue.complexToDimensionPixelOffset(value, baseValue);\n            } catch (e) {\n                console.warn(e);\n            }\n            return defValue;\n        }\n\n        static parseDimensionPixelSize(r:android.content.res.Resources, value:string, defValue:number, baseValue=0):number {\n            if(value==null) return defValue;\n            if(value.startsWith('@')){\n                try {\n                    return r.getDimensionPixelSize(value);\n                } catch (e) {\n                    console.warn(e);\n                    return defValue;\n                }\n            }\n            try {\n                return android.util.TypedValue.complexToDimensionPixelSize(value, baseValue);\n            } catch (e) {\n                console.warn(e);\n            }\n            return defValue;\n        }\n\n        static parseDrawable(r:android.content.res.Resources, value:string):android.graphics.drawable.Drawable {\n            if(value==null) return null;\n            if(value.startsWith('@')){\n                try {\n                    return r.getDrawable(value);\n                } catch (e) {\n                    console.warn(e);\n                }\n\n            }else if(value.startsWith('url(')){\n                value = value.substring('url('.length);\n                if(value.endsWith(')')) value = value.substring(0, value.length-1);\n                return new androidui.image.NetDrawable(value);\n\n            }else{\n                try {\n                    let color = android.graphics.Color.parseColor(value);\n                    return new android.graphics.drawable.ColorDrawable(color);\n                } catch (e) {\n                }\n            }\n            return null;\n        }\n\n        static parseTextArray(r:android.content.res.Resources, value:string):string[] {\n            if(value==null) return null;\n            if(value.startsWith('@')){\n                return r.getStringArray(value);\n\n            }else{\n                //support for json array\n                try {\n                    let json = JSON.parse(value);\n                    if(json instanceof Array) return json;\n                } catch (e) {\n                }\n            }\n            return null;\n        }\n\n    }\n}"
  },
  {
    "path": "src/androidui/attr/StateAttr.ts",
    "content": "/**\n * Created by linfaxin on 15/11/3.\n */\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/util/StateSet.ts\"/>\n///<reference path=\"../../java/util/Arrays.ts\"/>\n\nmodule androidui.attr{\n\n    export class StateAttr {\n        private stateSpec:number[];\n        private attributes = new Map<string,string>();\n\n        constructor(state:number[]) {\n            this.stateSpec = state.concat().sort();\n        }\n\n        clone():StateAttr {\n            let stateAttr = new StateAttr(this.stateSpec);\n            stateAttr.attributes = new Map<string, string>(this.attributes);\n            return stateAttr;\n        }\n\n        setAttr(name:string, value:string){\n            this.attributes.set(name, value);\n        }\n\n        hasAttr(name:string){\n            return this.attributes.has(name);\n        }\n\n        getAttrMap():Map<string, string>{\n            return this.attributes;\n        }\n\n        putAll(stateAttr:StateAttr){\n            for(let [key, value] of stateAttr.attributes.entries()){\n                this.attributes.set(key, value);\n            }\n        }\n\n        isDefaultState():boolean {\n            return this.stateSpec.length === 0;\n        }\n\n        isStateEquals(state:number[]):boolean{\n            if(!state) return false;\n            return java.util.Arrays.equals(this.stateSpec, state.concat().sort());\n        }\n\n        isStateMatch(state:number[]):boolean{\n            return android.util.StateSet.stateSetMatches(this.stateSpec, state);\n        }\n\n\n        /**\n         * this:{'k1':'v1', 'k3':'v3-1'}\n         * another:{'k2':'v2', 'k3':'v3-2'}\n         * @returns {Map<K, V>} new map: {'k1':'v1', 'k2':null, 'k3':'v3-1'}\n         */\n        createDiffKeyAsNullValueAttrMap(another:StateAttr):Map<string,string>{\n            if(!another) return this.attributes;\n            let removed = new Map<string, string>(another.attributes);\n            for(let key of this.attributes.keys()) removed.delete(key);\n\n            let merge = new Map<string, string>(this.attributes);\n            for(let key of removed.keys()) merge.set(key, <string>null);\n\n            return merge;\n        }\n    }\n}"
  },
  {
    "path": "src/androidui/attr/StateAttrList.ts",
    "content": "/**\n * Created by linfaxin on 15/11/3.\n */\n///<reference path=\"StateAttr.ts\"/>\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/util/StateSet.ts\"/>\n\nlet STATE_MAP:Map<string, number>; // delay init, because android.view.View was undefined now.\n\nmodule androidui.attr {\n    import View = android.view.View;\n\n    export class StateAttrList {\n        private originStateAttrList:Array<StateAttr> = [];\n        private matchedStateAttrList:Array<StateAttr> = [];\n        private mView:View;\n\n        constructor(view:View){\n            this.mView = view;\n            this.getOrCreateStateAttr([]); // create default stateAttr\n        }\n\n        static getViewStateValue(attrName:string):number {\n            if (!STATE_MAP) { // delay init\n                STATE_MAP = new Map<string, number>()\n                    .set('state_window_focused', android.view.View.VIEW_STATE_WINDOW_FOCUSED)\n                    .set('state_selected', android.view.View.VIEW_STATE_SELECTED)\n                    .set('state_focused', android.view.View.VIEW_STATE_FOCUSED)\n                    .set('state_enabled', android.view.View.VIEW_STATE_ENABLED)\n                    .set('state_disabled', -android.view.View.VIEW_STATE_ENABLED)\n                    .set('state_pressed', android.view.View.VIEW_STATE_PRESSED)\n                    .set('state_activated', android.view.View.VIEW_STATE_ACTIVATED)\n                    .set('state_hovered', android.view.View.VIEW_STATE_HOVERED)\n                    .set('state_checked', android.view.View.VIEW_STATE_CHECKED);\n            }\n            return STATE_MAP.get(attrName.split(':').pop());\n        }\n\n        public addStatedAttr(attrName:string, attrValue:string):void {\n            this.addStatedAttrImpl(attrName, attrValue, []);\n        }\n\n        private addStatedAttrImpl(attrName:string, attrValue:string, inParseState:number[]){\n            const stateValue = StateAttrList.getViewStateValue(attrName);\n            if(stateValue != null) {\n                const newInParseState = inParseState.concat(stateValue).sort();\n                let _stateAttr = this.getOrCreateStateAttr(newInParseState);\n\n                //attr with state\n                if(attrValue.startsWith('@')){\n                    //support: android:state_pressed=\"@style/myStyle\"\n                    let styleMap = this.mView.getResources().getStyleAsMap(attrValue);\n                    if(styleMap && styleMap.size > 0) {\n                        const statedEntries:Array<Array<any>> = [];\n                        for(let entry of styleMap.entries()) {\n                            const [key, value] = entry;\n                            if (key.startsWith('android:state_')) {\n                                statedEntries.push(entry);\n                            } else {\n                                _stateAttr.setAttr(key.toLowerCase(), value);\n                            }\n                        }\n                        for(let entry of statedEntries) {\n                            const [key, value] = entry;\n                            this.addStatedAttrImpl(key, value, newInParseState);\n                        }\n                    }\n\n                }else{\n                    // support like: android:state_pressed=\"padding:10dp; background:#333;\"\n                    for(let part of attrValue.split(';')){\n                        let [name, value] = part.split(':');\n                        name = name.trim();\n                        if(name) {\n                            _stateAttr.setAttr('android:' + name.toLowerCase(), value.trim());\n                        }\n                    }\n                }\n            }\n        }\n\n        private getStateAttr(state:number[]):StateAttr{\n            for(let stateAttr of this.originStateAttrList){\n                if(stateAttr.isStateEquals(state)) return stateAttr;\n            }\n        }\n\n        private getOrCreateStateAttr(state:number[]):StateAttr{\n            let stateAttr = this.getStateAttr(state);\n            if(!stateAttr) {\n                stateAttr = new StateAttr(state);\n                this.originStateAttrList.push(stateAttr);\n            }\n            return stateAttr;\n        }\n\n        getMatchedStateAttr(state:number[]):StateAttr {\n            if(state == null) return null;\n            for(let stateAttr of this.matchedStateAttrList){\n                if(stateAttr.isStateEquals(state)) return stateAttr;\n            }\n            let matchedAttr:StateAttr = new StateAttr(state);\n            for(let stateAttr of this.originStateAttrList){\n                if(stateAttr.isDefaultState()) continue; // ignore default state\n                if(stateAttr.isStateMatch(state)){\n                    matchedAttr.putAll(stateAttr);\n                }\n            }\n            this.matchedStateAttrList.push(matchedAttr);\n            return matchedAttr;\n        }\n\n        /**\n         * call when the attr is not stateable (when user set a new value to the attr by code)\n         * @param attrName this attr's name\n         */\n        removeAttrAllState(attrName:string){\n            for(let stateAttr of this.originStateAttrList){\n                stateAttr.getAttrMap().delete(attrName);\n            }\n            for(let stateAttr of this.matchedStateAttrList){\n                stateAttr.getAttrMap().delete(attrName);\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/androidui/image/ChangeImageSizeDrawable.ts",
    "content": "/**\n * Created by linfaxin on 15/11/2.\n */\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/content/res/Resources.ts\"/>\n///<reference path=\"NetImage.ts\"/>\n\n\n\nmodule androidui.image{\n    import Drawable = android.graphics.drawable.Drawable;\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n\n    export class ChangeImageSizeDrawable extends Drawable implements Drawable.Callback{\n        private mState:State;\n        private mTmpRect = new Rect();\n        private mMutated = false;\n\n        constructor(drawable:Drawable, overrideWidth:number, overrideHeight=overrideWidth) {\n            super();\n            this.mState = new State(null, this);\n            this.mState.mDrawable = drawable;\n            this.mState.mOverrideWidth = overrideWidth;\n            this.mState.mOverrideHeight = overrideHeight;\n\n            if (drawable != null) {\n                drawable.setCallback(this);\n            }\n        }\n\n        drawableSizeChange(who:android.graphics.drawable.Drawable):any {\n            const callback = this.getCallback();\n            if (callback != null && callback.drawableSizeChange) {\n                callback.drawableSizeChange(this);\n            }\n        }\n\n        invalidateDrawable(who:android.graphics.drawable.Drawable):void {\n            const callback = this.getCallback();\n            if (callback != null) {\n                callback.invalidateDrawable(this);\n            }\n        }\n\n        scheduleDrawable(who:android.graphics.drawable.Drawable, what:java.lang.Runnable, when:number):void {\n            const callback = this.getCallback();\n            if (callback != null) {\n                callback.scheduleDrawable(this, what, when);\n            }\n        }\n\n        unscheduleDrawable(who:android.graphics.drawable.Drawable, what:java.lang.Runnable):void {\n            const callback = this.getCallback();\n            if (callback != null) {\n                callback.unscheduleDrawable(this, what);\n            }\n        }\n\n        draw(canvas:Canvas) {\n            this.mState.mDrawable.draw(canvas);\n        }\n\n\n        getPadding(padding:android.graphics.Rect):boolean {\n            return this.mState.mDrawable.getPadding(padding);\n        }\n\n        setVisible(visible:boolean, restart:boolean):boolean {\n            this.mState.mDrawable.setVisible(visible, restart);\n            return super.setVisible(visible, restart);\n        }\n\n\n        setAlpha(alpha:number) {\n            this.mState.mDrawable.setAlpha(alpha);\n        }\n\n        getAlpha():number {\n            return this.mState.mDrawable.getAlpha();\n        }\n\n        getOpacity():number {\n            return this.mState.mDrawable.getOpacity();\n        }\n\n        isStateful():boolean {\n            return this.mState.mDrawable.isStateful();\n        }\n\n        protected onStateChange(state:Array<number>):boolean {\n            let changed = this.mState.mDrawable.setState(state);\n            this.onBoundsChange(this.getBounds());\n            return changed;\n        }\n\n        protected onBoundsChange(r:android.graphics.Rect):void {\n            this.mState.mDrawable.setBounds(r.left, r.top, r.right, r.bottom);\n        }\n\n        getIntrinsicWidth():number {\n            return this.mState.mOverrideWidth;\n        }\n\n        getIntrinsicHeight():number {\n            return this.mState.mOverrideHeight;\n        }\n\n        getConstantState():Drawable.ConstantState {\n            if (this.mState.canConstantState()) {\n                //this.mState.mChangingConfigurations = getChangingConfigurations();\n                return this.mState;\n            }\n            return null;\n        }\n        mutate():Drawable {\n            if (!this.mMutated && super.mutate() == this) {\n                this.mState.mDrawable.mutate();\n                this.mMutated = true;\n            }\n            return this;\n        }\n        getDrawable():Drawable {\n            return this.mState.mDrawable;\n        }\n    }\n\n    class State implements Drawable.ConstantState{\n        mDrawable:Drawable;\n        mOverrideWidth = 0;\n        mOverrideHeight = 0;\n        mCheckedConstantState:boolean;\n        mCanConstantState:boolean;\n\n        constructor(orig:State, owner:ChangeImageSizeDrawable) {\n            if (orig != null) {\n                this.mDrawable = orig.mDrawable.getConstantState().newDrawable();\n                this.mDrawable.setCallback(owner);\n                //this.mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection());\n                this.mOverrideWidth = orig.mOverrideWidth;\n                this.mOverrideHeight = orig.mOverrideHeight;\n                this.mCheckedConstantState = this.mCanConstantState = true;\n            }\n        }\n\n        newDrawable():Drawable {\n            let drawable = new ChangeImageSizeDrawable(null, 0);\n            (<any>drawable).mState = new State(this, drawable);\n            return drawable;\n        }\n\n        canConstantState():boolean {\n            if (!this.mCheckedConstantState) {\n                this.mCanConstantState = this.mDrawable.getConstantState() != null;\n                this.mCheckedConstantState = true;\n            }\n\n            return this.mCanConstantState;\n        }\n\n    }\n}"
  },
  {
    "path": "src/androidui/image/NetDrawable.ts",
    "content": "/**\n * Created by linfaxin on 15/12/11.\n */\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/content/res/Resources.ts\"/>\n///<reference path=\"NetImage.ts\"/>\n\n\nmodule androidui.image{\n    import Paint = android.graphics.Paint;\n    import Rect = android.graphics.Rect;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Canvas = android.graphics.Canvas;\n\n    export class NetDrawable extends Drawable {\n        private mState:State;\n        private mLoadListener:NetDrawable.LoadListener;\n        protected mImageWidth = 0;\n        protected mImageHeight = 0;\n        private mTileModeX:NetDrawable.TileMode;\n        private mTileModeY:NetDrawable.TileMode;\n        private mTmpTileBound:Rect;\n        \n\n        constructor(src:string|NetImage, paint?:Paint, overrideImageRatio?:number){\n            super();\n            let image:NetImage;\n            if(src instanceof NetImage){\n                image = src;\n                if(overrideImageRatio) image.mOverrideImageRatio = overrideImageRatio;\n            }else{\n                image = new NetImage(<string>src, overrideImageRatio);\n            }\n            image.addLoadListener(()=>this.onLoad(), ()=>this.onError());\n\n            this.mState = new State(image, paint);\n\n            if(image.isImageLoaded()) this.initBoundWithLoadedImage(image);\n        }\n\n        protected initBoundWithLoadedImage(image:NetImage){\n            let imageRatio = image.getImageRatio();\n            this.mImageWidth = Math.floor(image.width / imageRatio * android.content.res.Resources.getDisplayMetrics().density);\n            this.mImageHeight = Math.floor(image.height / imageRatio * android.content.res.Resources.getDisplayMetrics().density);\n        }\n\n        setURL(url:string, hiddenWhenLoading=true):void {\n            if(hiddenWhenLoading){\n                this.mImageWidth = this.mImageHeight = 0;\n            }\n            this.mState.mImage.src = url;\n        }\n\n        draw(canvas:Canvas):void {\n            if(!this.isImageSizeEmpty()){\n                let emptyTileX = this.mTileModeX == null || this.mTileModeX == NetDrawable.TileMode.DEFAULT;\n                let emptyTileY = this.mTileModeY == null || this.mTileModeY == NetDrawable.TileMode.DEFAULT;\n\n                if(emptyTileX && emptyTileY){\n                    canvas.drawImage(this.mState.mImage, null, this.getBounds(), this.mState.paint);\n                } else{\n                    this.drawTile(canvas);\n                }\n            }\n        }\n\n        private drawTile(canvas:Canvas):void {\n            let imageWidth = this.mImageWidth;\n            let imageHeight = this.mImageHeight;\n            if(imageHeight<=0 || imageWidth<=0) return;\n            let tileX = this.mTileModeX;\n            let tileY = this.mTileModeY;\n            let bound = this.getBounds();\n\n            if(this.mTmpTileBound==null) this.mTmpTileBound = new Rect();\n            let tmpBound = this.mTmpTileBound;\n            tmpBound.setEmpty();\n\n            function drawColumn(){\n                if(tileY === NetDrawable.TileMode.REPEAT){\n                    tmpBound.bottom = imageHeight;\n                    while(tmpBound.isEmpty() || tmpBound.intersects(bound)){\n                        canvas.drawImage(this.mState.mImage, null, tmpBound, this.mState.paint);\n                        tmpBound.offset(0, imageHeight);\n                    }\n                }else{\n                    tmpBound.bottom = bound.height();\n                    canvas.drawImage(this.mState.mImage, null, tmpBound, this.mState.paint);\n                }\n            }\n\n            if(tileX === NetDrawable.TileMode.REPEAT){\n                tmpBound.right = imageWidth;\n                while(tmpBound.isEmpty() || tmpBound.intersects(bound)){\n                    drawColumn.call(this);\n                    tmpBound.offset(imageWidth, -tmpBound.top);\n                }\n\n            }else{\n                tmpBound.right = bound.width();\n                drawColumn.call(this);\n            }\n        }\n\n        setAlpha(alpha:number):void {\n            this.mState.paint.setAlpha(alpha);\n        }\n\n        getAlpha():number {\n            return this.mState.paint.getAlpha();\n        }\n\n        getIntrinsicWidth():number {\n            return this.mImageWidth;\n        }\n\n        getIntrinsicHeight():number {\n            return this.mImageHeight;\n        }\n\n        protected onLoad(){\n            this.initBoundWithLoadedImage(this.mState.mImage);\n            if(this.mLoadListener) this.mLoadListener.onLoad(this);\n            this.invalidateSelf();\n            this.notifySizeChangeSelf();\n        }\n\n        protected onError(){\n            this.mImageWidth = this.mImageHeight = 0;\n            if(this.mLoadListener) this.mLoadListener.onError(this);\n            this.invalidateSelf();\n            this.notifySizeChangeSelf();\n        }\n\n        isImageSizeEmpty():boolean {\n            return this.mImageWidth <=0 || this.mImageHeight <= 0;\n        }\n\n        getImage():NetImage {\n            return this.mState.mImage;\n        }\n\n        setLoadListener(loadListener:NetDrawable.LoadListener):void {\n            this.mLoadListener = loadListener;\n        }\n\n        setTileMode(tileX:NetDrawable.TileMode, tileY:NetDrawable.TileMode){\n            this.mTileModeX = tileX;\n            this.mTileModeY = tileY;\n            this.invalidateSelf();\n        }\n\n        getConstantState():Drawable.ConstantState {\n            return this.mState;\n        }\n\n    }\n\n    export module NetDrawable{\n        export interface LoadListener {\n            onLoad(drawable:NetDrawable);\n            onError(drawable:NetDrawable);\n        }\n\n        export enum TileMode{\n            DEFAULT,\n            REPEAT,\n            //MIRROR  //TODO not support now\n        }\n    }\n\n    class State implements Drawable.ConstantState{\n        mImage:NetImage;\n        paint:Paint;\n        constructor(image:NetImage, paint=new Paint()) {\n            this.mImage = image;\n            this.paint = new Paint();\n            if(paint!=null) this.paint.set(paint);\n        }\n        newDrawable():Drawable {\n            return new NetDrawable(this.mImage.src, this.paint);\n        }\n    }\n}"
  },
  {
    "path": "src/androidui/image/NetImage.ts",
    "content": "/**\n * Created by linfaxin on 15/12/11.\n */\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/graphics/Color.ts\"/>\n\nmodule androidui.image{\n    import Rect = android.graphics.Rect;\n    import Color = android.graphics.Color;\n\n    export class NetImage {\n        private browserImage;\n        private mSrc:string;\n        private mImageWidth=0;\n        private mImageHeight=0;\n        private mOnLoads = new Set<()=>void>();\n        private mOnErrors = new Set<()=>void>();\n        private mImageLoaded = false;\n        private mOverrideImageRatio:number;\n\n        constructor(src:string, overrideImageRatio?:number) {\n            this.init(src);\n            this.mOverrideImageRatio = overrideImageRatio;\n        }\n\n        protected init(src:string){\n            this.createImage();\n            this.src = src;\n        }\n\n        protected createImage(){\n            this.browserImage = new Image();\n        }\n\n        protected loadImage(){\n            this.browserImage.src = this.mSrc;\n            this.browserImage.onload = ()=>{\n                this.mImageWidth = this.browserImage.width;\n                this.mImageHeight = this.browserImage.height;\n                this.fireOnLoad();\n            };\n            this.browserImage.onerror = ()=>{\n                this.mImageWidth = this.mImageHeight = 0;\n                this.fireOnError();\n            };\n        }\n\n        public get src():string {\n            return this.mSrc;\n        }\n\n        public set src(value:string) {\n            value = convertToAbsUrl(value);\n            if(value!==this.mSrc){\n                this.mSrc = value;\n                this.loadImage();\n            }\n        }\n\n        public get width():number {\n            return this.mImageWidth;\n        }\n\n        public get height():number {\n            return this.mImageHeight;\n        }\n\n        getImageRatio():number {\n            if(this.mOverrideImageRatio) return this.mOverrideImageRatio;\n            let url = this.src;\n            if(!url) return 1;\n            if(url.startsWith('data:')) return 1;//may base64 encode\n            const match = url.match(/@(\\d)x(\\.9)?\\.\\w*$/); // xxx@3x.xxx & // xxx@3x.9.xxx\n            if (match) {\n                return parseInt(match[1]);\n            }\n            return 1;\n        }\n\n        isImageLoaded():boolean {\n            return this.mImageLoaded;\n        }\n\n        private fireOnLoad(){\n            this.mImageLoaded = true;\n            for(let load of [...this.mOnLoads]){\n                load();\n            }\n        }\n        private fireOnError(){\n            this.mImageLoaded = false;\n            for(let error of [...this.mOnErrors]){\n                error();\n            }\n        }\n\n        addLoadListener(onload:()=>void, onerror?:()=>void){\n            if(onload){\n                this.mOnLoads.add(onload);\n            }\n            if(onerror){\n                this.mOnErrors.add(onerror);\n            }\n        }\n\n        removeLoadListener(onload?:()=>void, onerror?:()=>void){\n            if(onload){\n                this.mOnLoads.delete(onload);\n            }\n            if(onerror){\n                this.mOnErrors.delete(onerror);\n            }\n        }\n\n        recycle():void {\n            //no impl for web\n        }\n\n        getBorderPixels(callBack:(leftBorder:number[], topBorder:number[], rightBorder:number[], bottomBorder:number[])=>void):void {\n            if(!callBack) return;\n            let mTmpRect = new Rect();\n\n            //left border\n            mTmpRect.set(0, 1, 1, this.height-1);\n            this.getPixels(mTmpRect, (leftBorder:number[])=>{\n\n                //top border\n                mTmpRect.set(1, 0, this.width-1, 1);\n                this.getPixels(mTmpRect, (topBorder:number[])=>{\n\n                    //right border\n                    mTmpRect.set(this.width-1, 1, this.width, this.height-1);\n                    this.getPixels(mTmpRect, (rightBorder:number[])=>{\n\n                        //bottom border\n                        mTmpRect.set(1, this.height-1, this.width-1, this.height);\n                        this.getPixels(mTmpRect, (bottomBorder:number[])=>{\n\n                            callBack(leftBorder, topBorder, rightBorder, bottomBorder);\n                        });\n                    });\n                });\n            });\n        }\n\n        getPixels(bound:Rect, callBack:(data:number[])=>void):void {\n            if(!callBack) return;\n            let canvasEle = document.createElement('canvas');\n            if(!bound) bound = new Rect(0, 0, this.width, this.height);\n            if(bound.isEmpty()) {\n                callBack([]);\n                return;\n            }\n            let w = bound.width();\n            let h = bound.height();\n            canvasEle.width = w;\n            canvasEle.height = h;\n            let canvas = canvasEle.getContext('2d');\n            canvas.drawImage(this.browserImage, bound.left, bound.top, w, h, 0, 0, w, h);\n            let data = canvas.getImageData(0, 0, w, h).data;\n            let colorData = [];\n            for(let i = 0; i<data.length; i+=4){\n                colorData.push(Color.rgba(data[i], data[i+1], data[i+2], data[i+3]));\n            }\n            callBack(colorData);\n\n            canvasEle.width = 0;\n            canvasEle.height = 0;\n        }\n\n    }\n\n    let convertA = document.createElement('a');\n    function convertToAbsUrl(url:string){\n        convertA.href = url;\n        return convertA.href;\n    }\n}"
  },
  {
    "path": "src/androidui/image/NinePatchDrawable.ts",
    "content": "/**\n * Created by linfaxin on 16/1/23.\n */\n///<reference path=\"NetDrawable.ts\"/>\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/graphics/Color.ts\"/>\n///<reference path=\"../../android/view/ViewConfiguration.ts\"/>\n///<reference path=\"../../android/content/res/Resources.ts\"/>\n///<reference path=\"NetImage.ts\"/>\n\nmodule androidui.image {\n    import Paint = android.graphics.Paint;\n    import Rect = android.graphics.Rect;\n    import Color = android.graphics.Color;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Canvas = android.graphics.Canvas;\n\n\n    export class NinePatchDrawable extends NetDrawable {\n        private static GlobalBorderInfoCache = new Map<string, NinePatchBorderInfo>();\n\n        private mTmpRect = new Rect();\n        private mTmpRect2 = new Rect();\n        private mNinePatchBorderInfo:NinePatchBorderInfo;\n        private mNinePatchDrawCache:Canvas;\n\n        //constructor(src:string|NetImage, paint?:Paint, overrideImageRatio?:number) {\n        //    super(src, paint, overrideImageRatio);\n        //}\n\n        protected initBoundWithLoadedImage(image:NetImage){\n            let imageRatio = image.getImageRatio();\n            this.mImageWidth = Math.floor( (image.width-2) / imageRatio * android.content.res.Resources.getDisplayMetrics().density);\n            this.mImageHeight = Math.floor( (image.height-2) / imageRatio * android.content.res.Resources.getDisplayMetrics().density);\n            this.initNinePatchBorderInfo(image);\n        }\n\n        private initNinePatchBorderInfo(image:NetImage){\n            this.mNinePatchBorderInfo = NinePatchDrawable.GlobalBorderInfoCache.get(image.src);\n            if(!this.mNinePatchBorderInfo){\n                image.getBorderPixels((leftBorder:number[], topBorder:number[], rightBorder:number[], bottomBorder:number[])=>{\n                    this.mNinePatchBorderInfo = new NinePatchBorderInfo(leftBorder, topBorder, rightBorder, bottomBorder);\n                    NinePatchDrawable.GlobalBorderInfoCache.set(image.src, this.mNinePatchBorderInfo);\n                });\n            }\n        }\n\n        protected onLoad():void {\n            //parse nine patch border now.\n            let image:NetImage = this.getImage();\n\n            let ninePatchBorderInfo = NinePatchDrawable.GlobalBorderInfoCache.get(image.src);\n            if(ninePatchBorderInfo){\n                this.mNinePatchBorderInfo = ninePatchBorderInfo;\n                super.onLoad();\n                return;\n            }\n\n            image.getBorderPixels((leftBorder:number[], topBorder:number[], rightBorder:number[], bottomBorder:number[])=>{\n                ninePatchBorderInfo = new NinePatchBorderInfo(leftBorder, topBorder, rightBorder, bottomBorder);\n                NinePatchDrawable.GlobalBorderInfoCache.set(image.src, ninePatchBorderInfo);\n                //parse border finish, notify load finish.\n                super.onLoad();\n            });\n        }\n\n\n        draw(canvas:Canvas):void {\n            if(!this.mNinePatchBorderInfo) return;\n            if(!this.isImageSizeEmpty()){\n                let cache = this.getNinePatchCache();\n                if(cache){\n                    canvas.drawCanvas(cache);\n                }else{\n                    this.drawNinePatch(canvas);\n                }\n            }\n        }\n\n        private getNinePatchCache():Canvas {\n            let bound = this.getBounds();\n            let width = bound.width();\n            let height = bound.height();\n            let cache = this.mNinePatchDrawCache;\n            if(cache){\n                if(cache.getWidth() === width && cache.getHeight() === height){\n                    return cache;\n                }\n                cache.recycle();\n            }\n            const cachePixelSize:number = width * height * 4;\n            const drawingCacheSize:number = android.view.ViewConfiguration.get().getScaledMaximumDrawingCacheSize();\n            if(cachePixelSize > drawingCacheSize) return null;\n            cache = this.mNinePatchDrawCache = new Canvas(bound.width(), bound.height());\n            this.drawNinePatch(cache);\n            return cache;\n        }\n\n        private drawNinePatch(canvas:Canvas):void {\n            let smoothEnableBak = canvas.isImageSmoothingEnabled();\n            canvas.setImageSmoothingEnabled(false);\n\n            let imageWidth = this.mImageWidth;\n            let imageHeight = this.mImageHeight;\n            if(imageHeight<=0 || imageWidth<=0) return;\n            let image = this.getImage();\n            let bound = this.getBounds();\n            const staticRatioScale = android.content.res.Resources.getDisplayMetrics().density / image.getImageRatio();\n\n            const staticWidthSum = this.mNinePatchBorderInfo.getHorizontalStaticLengthSum();\n            const staticHeightSum = this.mNinePatchBorderInfo.getVerticalStaticLengthSum();\n            let extraWidth = bound.width() - Math.floor(staticWidthSum * staticRatioScale);\n            let extraHeight = bound.height() - Math.floor(staticHeightSum * staticRatioScale);\n            let staticWidthPartScale = (extraWidth>=0 || staticWidthSum==0) ? 1 : bound.width() / staticWidthSum;\n            let staticHeightPartScale = (extraHeight>=0 || staticHeightSum==0) ? 1 : bound.height() / staticHeightSum;\n            staticWidthPartScale *= staticRatioScale;\n            staticHeightPartScale *= staticRatioScale;\n            const scaleHorizontalWeightSum = this.mNinePatchBorderInfo.getHorizontalScaleLengthSum();\n            const scaleVerticalWeightSum = this.mNinePatchBorderInfo.getVerticalScaleLengthSum();\n\n            const drawColumn = (srcFromX:number, srcToX:number, dstFromX:number, dstToX:number)=>{\n                const heightParts = this.mNinePatchBorderInfo.getVerticalTypedValues();\n                let srcFromY = 1;\n                let dstFromY = 0;\n                for(let i = 0, size=heightParts.length; i<size; i++){\n                    let typedValue = heightParts[i];\n                    let isScalePart = NinePatchBorderInfo.isScaleType(typedValue);\n                    let srcHeight = NinePatchBorderInfo.getValueUnpack(typedValue);\n                    if(srcHeight <= 0) continue;\n                    let dstHeight;\n                    if(isScalePart){\n                        if(scaleVerticalWeightSum == 0) continue;\n                        dstHeight = extraHeight * srcHeight / scaleVerticalWeightSum;\n                        if(dstHeight <= 0) continue;\n\n                    }else{\n                        //static part\n                        dstHeight = srcHeight * staticHeightPartScale;\n                    }\n\n                    let srcRect = this.mTmpRect;\n                    let dstRect = this.mTmpRect2;\n                    srcRect.set(srcFromX, srcFromY, srcToX, srcFromY+srcHeight);\n                    dstRect.set(dstFromX, dstFromY, dstToX, dstFromY+dstHeight);\n\n                    // eat half pix for iOS to prevent draw the nine-patch border\n                    if (srcRect.bottom === image.height - 1) srcRect.bottom -= 0.5;\n                    if (srcRect.right === image.width - 1) srcRect.right -= 0.5;\n\n                    canvas.drawImage(image, srcRect, dstRect);\n\n                    srcFromY+=srcHeight;\n                    dstFromY+=dstHeight;\n                }\n            };\n\n            const widthParts = this.mNinePatchBorderInfo.getHorizontalTypedValues();\n            let srcFromX = 1;\n            let dstFromX = 0;\n            for(let i = 0, size=widthParts.length; i<size; i++){\n                let typedValue = widthParts[i];\n                let isScalePart = NinePatchBorderInfo.isScaleType(typedValue);\n                let srcWidth = NinePatchBorderInfo.getValueUnpack(typedValue);\n                let dstWidth;\n                if(isScalePart) {\n                    dstWidth = extraWidth * srcWidth / scaleHorizontalWeightSum;\n\n                } else {//static part\n                    dstWidth = srcWidth * staticWidthPartScale;\n                }\n                if(dstWidth <= 0) continue;\n\n                drawColumn(srcFromX, srcFromX+srcWidth, dstFromX, dstFromX+dstWidth);\n                srcFromX+=srcWidth;\n                dstFromX+=dstWidth;\n            }\n\n            canvas.setImageSmoothingEnabled(smoothEnableBak);\n        }\n\n\n        getPadding(padding:android.graphics.Rect):boolean {\n            let info = this.mNinePatchBorderInfo;\n            if(!info) return false;\n            let imageRatio = this.getImage() && this.getImage().getImageRatio() || 1;\n            const staticRatioScale = android.content.res.Resources.getDisplayMetrics().density / imageRatio;\n            padding.set(Math.floor(info.getPaddingLeft() * staticRatioScale), Math.floor(info.getPaddingTop() * staticRatioScale),\n                Math.floor(info.getPaddingRight() * staticRatioScale), Math.floor(info.getPaddingBottom() * staticRatioScale));\n            return true;\n        }\n    }\n\n    class NinePatchBorderInfo {\n        //src data (start & end pixel excluded)\n        //private leftBorder:number[];\n        //private topBorder:number[];\n        //private rightBorder:number[];\n        //private bottomBorder:number[];\n\n        //parsed data\n        private horizontalTypedValues:number[];\n        private horizontalStaticLengthSum = 0;\n        private horizontalScaleLengthSum = 0;\n        private verticalTypedValues:number[];\n        private verticalStaticLengthSum = 0;\n        private verticalScaleLengthSum = 0;\n\n        private paddingLeft = 0;\n        private paddingTop = 0;\n        private paddingRight = 0;\n        private paddingBottom = 0;\n\n        constructor(leftBorder:number[], topBorder:number[], rightBorder:number[], bottomBorder:number[]){\n            //this.leftBorder = leftBorder;\n            //this.topBorder = topBorder;\n            //this.rightBorder = rightBorder;\n            //this.bottomBorder = bottomBorder;\n\n            this.horizontalTypedValues = [];\n            this.verticalTypedValues = [];\n            let tmpLength = 0;\n            let currentStatic = true;\n\n            for(let color of leftBorder){\n                let isScaleColor = NinePatchBorderInfo.isScaleColor(color);\n                let typeChange = (isScaleColor && currentStatic) || (!isScaleColor && !currentStatic);\n                if(typeChange) {\n                    let lengthValue = currentStatic ? tmpLength : -tmpLength; //negative value mean scale part\n                    if(currentStatic) this.verticalStaticLengthSum += tmpLength;\n                    this.verticalTypedValues.push(lengthValue);\n                    tmpLength = 1;\n                }else{\n                    tmpLength++;\n                }\n                currentStatic = !isScaleColor;\n            }\n            if(currentStatic) this.verticalStaticLengthSum += tmpLength;\n            this.verticalScaleLengthSum = leftBorder.length - this.verticalStaticLengthSum;\n            this.verticalTypedValues.push(currentStatic ? tmpLength : -tmpLength);//negative value mean scale pixel\n\n            tmpLength = 0;\n            currentStatic = true;\n            for(let color of topBorder){\n                let isScaleColor = NinePatchBorderInfo.isScaleColor(color);\n                let typeChange = (isScaleColor && currentStatic) || (!isScaleColor && !currentStatic);\n                if(typeChange) {\n                    let lengthValue = currentStatic ? tmpLength : -tmpLength; //negative value mean scale part\n                    if(currentStatic) this.horizontalStaticLengthSum += tmpLength;\n                    this.horizontalTypedValues.push(lengthValue);\n                    tmpLength = 1;\n                }else{\n                    tmpLength++;\n                }\n                currentStatic = !isScaleColor;\n            }\n            if(currentStatic) this.horizontalStaticLengthSum += tmpLength;\n            this.horizontalScaleLengthSum = topBorder.length - this.horizontalStaticLengthSum;\n            this.horizontalTypedValues.push(currentStatic ? tmpLength : -tmpLength);//negative value mean scale pixel\n\n\n            //padding from left & top\n            if(this.horizontalTypedValues.length>=3){\n                this.paddingLeft = Math.max(0, this.horizontalTypedValues[0]);\n                this.paddingRight = Math.max(0, this.horizontalTypedValues[this.horizontalTypedValues.length-1]);\n            }\n            if(this.verticalTypedValues.length>=3){\n                this.paddingTop = Math.max(0, this.verticalTypedValues[0]);\n                this.paddingBottom = Math.max(0, this.verticalTypedValues[this.verticalTypedValues.length-1]);\n            }\n            //override if rightBorder / bottomBorder defined\n            for(let i = 0, length = rightBorder.length; i<length; i++){\n                if(NinePatchBorderInfo.isScaleColor(rightBorder[i])){\n                    this.paddingTop = i;\n                    break;\n                }\n            }\n            for(let i = 0, length = rightBorder.length; i<length; i++){\n                if(NinePatchBorderInfo.isScaleColor(rightBorder[length-1-i])){\n                    this.paddingBottom = i;\n                    break;\n                }\n            }\n            for(let i = 0, length = bottomBorder.length; i<length; i++){\n                if(NinePatchBorderInfo.isScaleColor(bottomBorder[i])){\n                    this.paddingLeft = i;\n                    break;\n                }\n            }\n            for(let i = 0, length = bottomBorder.length; i<length; i++){\n                if(NinePatchBorderInfo.isScaleColor(bottomBorder[length-1-i])){\n                    this.paddingRight = i;\n                    break;\n                }\n            }\n        }\n        static isScaleColor(color:number):boolean {\n            //return color === 0xff000000;\n            return Color.alpha(color) > 200 && Color.red(color) < 50 && Color.green(color) < 50 && Color.blue(color) < 50;\n        }\n        static isScaleType(typedValue:number):boolean {\n            return typedValue < 0;\n        }\n        static getValueUnpack(typedValue:number):number {\n            return Math.abs(typedValue);\n        }\n\n        getHorizontalTypedValues():number[] {\n            return this.horizontalTypedValues;\n        }\n        getHorizontalStaticLengthSum():number {\n            return this.horizontalStaticLengthSum;\n        }\n        getHorizontalScaleLengthSum():number {\n            return this.horizontalScaleLengthSum;\n        }\n\n        getVerticalTypedValues():number[] {\n            return this.verticalTypedValues;\n        }\n        getVerticalStaticLengthSum():number {\n            return this.verticalStaticLengthSum;\n        }\n        getVerticalScaleLengthSum():number {\n            return this.verticalScaleLengthSum;\n        }\n\n        getPaddingLeft():number {\n            return this.paddingLeft;\n        }\n        getPaddingTop():number {\n            return this.paddingTop;\n        }\n        getPaddingRight():number {\n            return this.paddingRight;\n        }\n        getPaddingBottom():number {\n            return this.paddingBottom;\n        }\n    }\n\n}"
  },
  {
    "path": "src/androidui/image/RegionImageDrawable.ts",
    "content": "/**\n * Created by linfaxin on 15/12/24.\n */\n///<reference path=\"../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../android/graphics/Paint.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/content/res/Resources.ts\"/>\n///<reference path=\"NetImage.ts\"/>\n\n\nmodule androidui.image{\n    import Paint = android.graphics.Paint;\n    import Rect = android.graphics.Rect;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Canvas = android.graphics.Canvas;\n    import Resources = android.content.res.Resources;\n\n    export class RegionImageDrawable extends Drawable {\n        private mState:State;\n\n        constructor(image:NetImage, bound, paint = new Paint()){\n            super();\n            this.mState = new State(image, bound, paint);\n            image.addLoadListener(()=>{\n                this.invalidateSelf();\n            });\n        }\n\n        draw(canvas:Canvas):void {\n            canvas.drawImage(this.mState.mImage, this.mState.mBound, this.getBounds(), this.mState.mPaint);\n        }\n\n        setAlpha(alpha:number):void {\n            this.mState.mPaint.setAlpha(alpha);\n        }\n\n        getAlpha():number {\n            return this.mState.mPaint.getAlpha();\n        }\n\n        getIntrinsicWidth():number {\n            return Math.floor(this.mState.mBound.width() * Resources.getDisplayMetrics().density / this.mState.mImage.getImageRatio());\n        }\n\n        getIntrinsicHeight():number {\n            return Math.floor(this.mState.mBound.height() * Resources.getDisplayMetrics().density / this.mState.mImage.getImageRatio());\n        }\n\n        getImage():NetImage {\n            return this.mState.mImage;\n        }\n\n        getConstantState():Drawable.ConstantState {\n            return this.mState;\n        }\n\n    }\n\n    class State implements Drawable.ConstantState{\n        mImage:NetImage;\n        mBound:Rect;\n        mPaint:Paint;\n        constructor(image:NetImage, bound:Rect, paint:Paint) {\n            this.mImage = image;\n            this.mBound = bound;\n            this.mPaint = paint;\n        }\n        newDrawable():Drawable {\n            return new RegionImageDrawable(this.mImage, this.mBound, this.mPaint);\n        }\n    }\n}"
  },
  {
    "path": "src/androidui/native/NativeApi.ts",
    "content": "///<reference path=\"../../android/widget/EditText.ts\"/>\n///<reference path=\"../../android/view/Surface.ts\"/>\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"NativeSurface.ts\"/>\n///<reference path=\"NativeCanvas.ts\"/>\n///<reference path=\"NativeImage.ts\"/>\n///<reference path=\"NativeEditText.ts\"/>\n///<reference path=\"NativeWebView.ts\"/>\n///<reference path=\"NativeHtmlView.ts\"/>\n///<reference path=\"../../android/webkit/WebView.ts\"/>\n\n\nmodule androidui.native {\n\n    import EditTextApi = androidui.native.NativeApi.DrawHTMLBoundApi;\n    import WebViewApi = androidui.native.NativeApi.WebViewApi;\n    const AndroidJsBridgeProperty = 'AndroidUIRuntime';//android js bridge name\n    const JSBridge:BridgeImpl = window[AndroidJsBridgeProperty];\n\n    export class NativeApi {\n        static surface:NativeApi.SurfaceApi;\n        static canvas:NativeApi.CanvasApi;\n        static image:NativeApi.ImageApi;\n        static drawHTML:NativeApi.DrawHTMLBoundApi;\n        static webView:NativeApi.WebViewApi;\n    }\n\n    export module NativeApi {\n        class BatchCall {\n            //private calls:NativeCall[] = [];\n            private calls:String[] = [];\n            pushCall(method:string, methodArgs:any[]){\n                //this.calls.push(new NativeCall(method, methodArgs));\n                //this.calls.push(method + JSON.stringify(methodArgs));\n                this.calls.push(method);\n                this.calls.push(...methodArgs);\n                this.calls.push(null);\n            }\n            clear(){\n                this.calls = [];\n            }\n            toString(){\n                return this.calls.join('\\n');\n            }\n        }\n        //class NativeCall {\n        //    method:string;\n        //    args:any[];\n        //\n        //    constructor(methodName:string, methodArgs:any[]) {\n        //        this.method = methodName;\n        //        this.args = methodArgs;\n        //    }\n        //    toString(){\n        //        return this.method + JSON.stringify(this.args);\n        //    }\n        //}\n\n        let batchCall = new BatchCall();\n\n        export class SurfaceApi {\n            createSurface(surfaceId:number, left:number, top:number, right:number, bottom:number):void{\n                JSBridge.createSurface(surfaceId, left, top, right, bottom);\n            }\n            onSurfaceBoundChange(surfaceId:number, left:number, top:number, right:number, bottom:number):void{\n                JSBridge.onSurfaceBoundChange(surfaceId, left, top, right, bottom);\n            }\n            /** lock area to be draw on. The lock area can be modified.*/\n            lockCanvas(surfaceId:number, canvasId:number, left:number, top:number, right:number, bottom:number):void{\n                batchCall.pushCall('31', [surfaceId, canvasId, left, top, right, bottom]);\n            }\n            unlockCanvasAndPost(surfaceId:number, canvasId:number):void{\n                batchCall.pushCall('32', [surfaceId, canvasId]);\n                JSBridge.batchCall(batchCall.toString());\n                batchCall.clear();\n            }\n            showFps(fps:number):void {\n                JSBridge.showJSFps(fps);\n            }\n        }\n\n        export class CanvasApi {\n            createCanvas(canvasId:number, width:number, height:number):void{\n                batchCall.pushCall('33', [canvasId, width, height]);\n            }\n            recycleCanvas(canvasId:number):void{\n                batchCall.pushCall('34', [canvasId]);\n            }\n            translate(canvasId:number, dx:number, dy:number):void{\n                batchCall.pushCall('35', [canvasId, dx, dy]);\n            }\n            scale(canvasId:number, sx:number, sy:number):void{\n                batchCall.pushCall('36', [canvasId, sx, sy]);\n            }\n            rotate(canvasId:number, degrees:number):void{\n                batchCall.pushCall('37', [canvasId, degrees]);\n            }\n            concat(canvasId:number, MSCALE_X:number, MSKEW_X:number, MTRANS_X:number, MSKEW_Y:number, MSCALE_Y:number, MTRANS_Y:number):void{\n                batchCall.pushCall('38', [canvasId, MSCALE_X, MSKEW_X, MTRANS_X, MSKEW_Y, MSCALE_Y, MTRANS_Y]);\n            }\n            drawColor(canvasId:number, color:number):void{\n                batchCall.pushCall('39', [canvasId, color]);\n            }\n            clearColor(canvasId:number):void{\n                batchCall.pushCall('40', [canvasId]);\n            }\n            drawRect(canvasId:number, left:number, top:number, width:number, height:number, style:android.graphics.Paint.Style):void{\n                batchCall.pushCall('41', [canvasId, left, top, width, height, style||android.graphics.Paint.Style.FILL]);\n            }\n            clipRect(canvasId:number, left:number, top:number, width:number, height:number):void{\n                batchCall.pushCall('42', [canvasId, left, top, width, height]);\n            }\n            save(canvasId:number):void{\n                batchCall.pushCall('43', [canvasId]);\n            }\n            restore(canvasId:number):void{\n                batchCall.pushCall('44', [canvasId]);\n            }\n            drawCanvas(canvasId:number, drawCanvasId:number, offsetX:number, offsetY:number){\n                batchCall.pushCall('45', [canvasId, drawCanvasId, offsetX, offsetY]);\n            }\n            /**\n             * @param canvasId\n             * @param text text to be draw\n             * @param x left position to start draw text\n             * @param y right position to start draw text\n             * @param fillStyle 0:fill / 1:stroke / 2:fill&stroke\n             */\n            drawText(canvasId:number, text:string, x:number, y:number, fillStyle:android.graphics.Paint.Style):void{\n                text = '\"'+text.replace(/(\\n)+|(\\r\\n)+/g, \"\\\\n\") + '\"';\n                batchCall.pushCall('47', [canvasId, text, x, y, fillStyle||android.graphics.Paint.Style.FILL]);\n            }\n\n            setFillColor(canvasId:number, color:number, style:android.graphics.Paint.Style):void{\n                batchCall.pushCall('49', [canvasId, color, style||android.graphics.Paint.Style.FILL]);\n            }\n            /**\n             * @param canvasId\n             * @param alpha [0, 1]\n             */\n            multiplyGlobalAlpha(canvasId:number, alpha:number):void{\n                batchCall.pushCall('50', [canvasId, alpha]);\n            }\n            /**\n             * @param canvasId\n             * @param alpha [0, 1]\n             */\n            setGlobalAlpha(canvasId:number, alpha:number):void{\n                batchCall.pushCall('51', [canvasId, alpha]);\n            }\n            /**\n             * @param canvasId\n             * @param align left/center/right\n             */\n            setTextAlign(canvasId:number, align:string):void{\n                batchCall.pushCall('52', [canvasId, align]);\n            }\n            setLineWidth(canvasId:number, width:number):void{\n                batchCall.pushCall('53', [canvasId, width]);\n            }\n            /**\n             * @param canvasId\n             * @param lineCap butt/round/square\n             */\n            setLineCap(canvasId:number, lineCap:string):void{\n                batchCall.pushCall('54', [canvasId, lineCap]);\n            }\n            /**\n             * @param canvasId\n             * @param lineJoin miter/round/bevel\n             */\n            setLineJoin(canvasId:number, lineJoin:string):void{\n                batchCall.pushCall('55', [canvasId, lineJoin]);\n            }\n            setShadow(canvasId:number, radius:number, dx:number, dy:number, color:number):void{\n                batchCall.pushCall('56', [canvasId, radius, dx, dy, color]);\n            }\n            setFontSize(canvasId:number, size:number):void{\n                batchCall.pushCall('57', [canvasId, size]);\n            }\n            setFont(canvasId:number, fontName:string):void {\n                batchCall.pushCall('58', [canvasId, fontName]);\n            }\n            drawOval(canvasId:number, left:number, top:number, right:number, bottom:number, style:android.graphics.Paint.Style):void{\n                batchCall.pushCall('59', [canvasId, left, top, right, bottom, style||android.graphics.Paint.Style.FILL]);\n            }\n            drawCircle(canvasId:number, cx:number, cy:number, radius:number, style:android.graphics.Paint.Style):void{\n                batchCall.pushCall('60', [canvasId, cx, cy, radius, style||android.graphics.Paint.Style.FILL]);\n            }\n            drawArc(canvasId:number, left:number, top:number, right:number, bottom:number, startAngle:number, sweepAngle:number, useCenter:boolean, style:android.graphics.Paint.Style):void{\n                batchCall.pushCall('61', [canvasId, left, top, right, bottom, startAngle, sweepAngle, useCenter, style||android.graphics.Paint.Style.FILL]);\n            }\n            drawRoundRectImpl(canvasId:number, left:number, top:number, width:number, height:number, radiusTopLeft:number, radiusTopRight:number,\n                              radiusBottomRight:number, radiusBottomLeft:number, style:android.graphics.Paint.Style):void {\n                batchCall.pushCall('62', [canvasId, left, top, width, height, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft, style||android.graphics.Paint.Style.FILL]);\n            }\n            clipRoundRectImpl(canvasId:number, left:number, top:number, width:number, height:number,\n                              radiusTopLeft:number, radiusTopRight:number, radiusBottomRight:number, radiusBottomLeft:number):void {\n                batchCall.pushCall('63', [canvasId, left, top, width, height, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft]);\n            }\n\n            drawImage2args(canvasId:number, drawImageId:number, left:number, top:number):void {\n                batchCall.pushCall('70', [canvasId, drawImageId, left, top]);\n            }\n            drawImage4args(canvasId:number, drawImageId:number, dstLeft:number, dstTop:number, dstRight:number, dstBottom:number):void {\n                batchCall.pushCall('71', [canvasId, drawImageId, dstLeft, dstTop, dstRight, dstBottom]);\n            }\n            drawImage8args(canvasId:number, drawImageId:number, srcLeft:number, srcTop:number, srcRight:number, srcBottom:number,\n                           dstLeft:number, dstTop:number, dstRight:number, dstBottom:number):void {\n                batchCall.pushCall('72', [canvasId, drawImageId, srcLeft, srcTop, srcRight, srcBottom, dstLeft, dstTop, dstRight, dstBottom]);\n            }\n        }\n\n        export interface ImageApi {\n            createImage(imageId:number):void;\n            loadImage(imageId:number, src:string):void;\n            recycleImage(imageId:number):void;\n            getPixels(imageId:number, callbackIndex:number, left:number, top:number, right:number, bottom:number):void;\n        }\n\n        export interface DrawHTMLBoundApi {\n            showDrawHTMLBound(viewHash:number, left:number, top:number, right:number, bottom:number):void;\n            hideDrawHTMLBound(viewHash:number):void;\n        }\n\n        export interface WebViewApi {\n            createWebView(viewHash:number):void;\n            destroyWebView(viewHash:number):void;\n            webViewBoundChange(viewHash:number, left:number, top:number, right:number, bottom:number):void;\n            webViewLoadUrl(viewHash:number, url:string):void;\n            webViewGoBack(viewHash:number):void;\n            webViewReload(viewHash:number):void;\n        }\n    }\n\n\n    interface BridgeImpl extends NativeApi.ImageApi, EditTextApi, WebViewApi {\n        initRuntime():void;\n        closeApp():void;\n        pageAlive(deadDelay:number):void;\n        createSurface(surfaceId:number, left:number, top:number, right:number, bottom:number):void;\n        onSurfaceBoundChange(surfaceId:number, left:number, top:number, right:number, bottom:number):void;\n        batchCall(jsonString:string):void;\n        measureText(text:string, textSize:number):number;\n        showJSFps(fps:number):void;\n    }\n\n    if(JSBridge){\n        android.view.Surface.prototype = NativeSurface.prototype;\n        android.graphics.Canvas.prototype = NativeCanvas.prototype;\n        androidui.image.NetImage.prototype = NativeImage.prototype;\n        android.widget.EditText = NativeEditText;//ensure no place import.\n        android.webkit.WebView = NativeWebView;//ensure no place import.\n        androidui.widget.HtmlView = NativeHtmlView;//ensure no place import.\n\n        //android.graphics.Canvas.measureTextImpl = function(text:string, textSize:number):number {\n        //    return JSBridge.measureText(text, textSize);\n        //};\n\n        NativeApi.surface = new NativeApi.SurfaceApi();\n        NativeApi.canvas = new NativeApi.CanvasApi();\n        NativeApi.image = JSBridge;\n        NativeApi.drawHTML = JSBridge;\n        NativeApi.webView = JSBridge;\n\n        //override some methods\n        android.os.MessageQueue.requestNextLoop = ()=>{//loop fast\n            setTimeout(android.os.MessageQueue.loop, 0);\n        };\n        androidui.AndroidUI.showAppClosed = ()=>{\n            JSBridge.closeApp();\n        };\n\n\n        JSBridge.initRuntime();\n        window.addEventListener('load', ()=>{\n            setInterval(()=>{\n                JSBridge.pageAlive(1500);\n            }, 800);\n        });\n    }\n\n}"
  },
  {
    "path": "src/androidui/native/NativeCanvas.ts",
    "content": "/**\n * Created by linfaxin on 15/12/14.\n */\n///<reference path=\"../../android/view/Surface.ts\"/>\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"../../android/graphics/Paint.ts\"/>\n///<reference path=\"NativeApi.ts\"/>\n\nmodule androidui.native {\n    import Canvas = android.graphics.Canvas;\n    import Rect = android.graphics.Rect;\n\n    let sNextID = 0;\n\n    export class NativeCanvas extends Canvas {\n        private canvasId:number;\n\n        protected initCanvasImpl():void {\n            this.canvasId = ++sNextID;\n            this.createCanvasImpl();\n        }\n        protected createCanvasImpl():void {\n            NativeApi.canvas.createCanvas(this.canvasId, this.mWidth, this.mHeight);\n            this.save();//is need?\n        }\n\n        protected recycleImpl():void {\n            NativeApi.canvas.recycleCanvas(this.canvasId);\n        }\n\n        public isNativeAccelerated():boolean{\n            return true;\n        }\n\n        protected translateImpl(dx:number, dy:number):void {\n            NativeApi.canvas.translate(this.canvasId, dx, dy);\n        }\n\n        protected scaleImpl(sx:number, sy:number):void {\n            NativeApi.canvas.scale(this.canvasId, sx, sy);\n        }\n\n        protected rotateImpl(degrees:number):void {\n            NativeApi.canvas.rotate(this.canvasId, degrees);\n        }\n\n        protected concatImpl(MSCALE_X:number, MSKEW_X:number, MTRANS_X:number, MSKEW_Y:number, MSCALE_Y:number,\n                             MTRANS_Y:number, MPERSP_0:number, MPERSP_1:number, MPERSP_2:number){\n            NativeApi.canvas.concat(this.canvasId, MSCALE_X, MSKEW_X, MTRANS_X, MSKEW_Y, MSCALE_Y, MTRANS_Y);\n        }\n\n        protected drawARGBImpl(a:number, r:number, g:number, b:number):void {\n            NativeApi.canvas.drawColor(this.canvasId, android.graphics.Color.argb(a, r, g, b));\n        }\n\n        protected clearColorImpl():void {\n            NativeApi.canvas.clearColor(this.canvasId);\n        }\n\n        protected saveImpl():void {\n            NativeApi.canvas.save(this.canvasId);\n        }\n\n        protected restoreImpl():void {\n            NativeApi.canvas.restore(this.canvasId);\n        }\n\n        protected clipRectImpl(left:number, top:number, width:number, height:number):void {\n            NativeApi.canvas.clipRect(this.canvasId, left, top, width, height);\n        }\n        protected clipRoundRectImpl(left:number, top:number, width:number, height:number, radiusTopLeft:number,\n                                    radiusTopRight:number, radiusBottomRight:number, radiusBottomLeft:number):void {\n            NativeApi.canvas.clipRoundRectImpl(this.canvasId, left, top, width, height, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft);\n        }\n\n        protected drawCanvasImpl(canvas:android.graphics.Canvas, offsetX:number, offsetY:number):void {\n            if(canvas instanceof NativeCanvas){\n                NativeApi.canvas.drawCanvas(this.canvasId, canvas.canvasId, offsetX, offsetY);\n            }else{\n                throw Error('canvas should be NativeCanvas');\n            }\n        }\n\n        protected drawImageImpl(image:androidui.image.NetImage, srcRect?:Rect, dstRect?:Rect):void {\n            if(image instanceof NativeImage){\n                if(srcRect && dstRect) {\n                    NativeApi.canvas.drawImage8args(this.canvasId, image.imageId, srcRect.left, srcRect.top, srcRect.right, srcRect.bottom,\n                        dstRect.left, dstRect.top, dstRect.right, dstRect.bottom);\n                } else if (dstRect) {\n                    NativeApi.canvas.drawImage4args(this.canvasId, image.imageId, dstRect.left, dstRect.top, dstRect.right, dstRect.bottom);\n                } else {\n                    NativeApi.canvas.drawImage2args(this.canvasId, image.imageId, 0, 0);\n                }\n            }else{\n                throw Error('image should be NativeImage');\n            }\n        }\n\n        protected drawRectImpl(left:number, top:number, width:number, height:number, style:android.graphics.Paint.Style){\n            NativeApi.canvas.drawRect(this.canvasId, left, top, width, height, style);\n        }\n\n        protected drawOvalImpl(oval:android.graphics.RectF, style:android.graphics.Paint.Style):void {\n            NativeApi.canvas.drawOval(this.canvasId, oval.left, oval.top, oval.right, oval.bottom, style);\n        }\n\n        protected drawCircleImpl(cx:number, cy:number, radius:number, style:android.graphics.Paint.Style):void {\n            NativeApi.canvas.drawCircle(this.canvasId, cx, cy, radius, style);\n        }\n\n        protected drawArcImpl(oval:android.graphics.RectF, startAngle:number, sweepAngle:number, useCenter:boolean, style:android.graphics.Paint.Style):void {\n            NativeApi.canvas.drawArc(this.canvasId, oval.left, oval.top, oval.right, oval.bottom, startAngle, sweepAngle, useCenter, style);\n        }\n\n        protected drawRoundRectImpl(rect:android.graphics.RectF, radiusTopLeft:number, radiusTopRight:number,\n                                    radiusBottomRight:number, radiusBottomLeft:number, style:android.graphics.Paint.Style):void {\n            NativeApi.canvas.drawRoundRectImpl(this.canvasId, rect.left, rect.top, rect.width(), rect.height(),\n                radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft, style);\n        }\n\n        protected drawTextImpl(text:string, x:number, y:number, style:android.graphics.Paint.Style):void {\n            NativeApi.canvas.drawText(this.canvasId, text, x, y, style);\n        }\n\n        protected setColorImpl(color:number, style?:android.graphics.Paint.Style):void {\n            NativeApi.canvas.setFillColor(this.canvasId, color, style);\n        }\n\n        protected multiplyGlobalAlphaImpl(alpha:number):void {\n            NativeApi.canvas.multiplyGlobalAlpha(this.canvasId, alpha);\n        }\n\n        protected setGlobalAlphaImpl(alpha:number):void {\n            NativeApi.canvas.setGlobalAlpha(this.canvasId, alpha);\n        }\n\n        protected setTextAlignImpl(align:string):void {\n            NativeApi.canvas.setTextAlign(this.canvasId, align);\n        }\n\n        protected setLineWidthImpl(width:number):void {\n            NativeApi.canvas.setLineWidth(this.canvasId, width);\n        }\n\n        protected setLineCapImpl(lineCap:string):void {\n            NativeApi.canvas.setLineCap(this.canvasId, lineCap);\n        }\n\n        protected setLineJoinImpl(lineJoin:string):void {\n            NativeApi.canvas.setLineJoin(this.canvasId, lineJoin);\n        }\n\n        protected setShadowImpl(radius:number, dx:number, dy:number, color:number):void {\n            NativeApi.canvas.setShadow(this.canvasId, radius, dx, dy, color);\n        }\n\n        protected setFontSizeImpl(size:number):void {\n            NativeApi.canvas.setFontSize(this.canvasId, size);\n        }\n\n        protected setFontImpl(fontName:string):void {\n            NativeApi.canvas.setFont(this.canvasId, fontName);\n        }\n\n\n        protected isImageSmoothingEnabledImpl():boolean {\n            return false;\n        }\n        protected setImageSmoothingEnabledImpl(enable:boolean):void {\n            //native no need\n        }\n\n        private static applyTextMeasure(cacheMeasureTextSize:number, defaultWidth:number, widths:number[]){\n            android.graphics.Canvas.measureTextImpl = function(text:string, textSize:number):number {\n                let width = 0;\n                for(let i=0,length=text.length; i<length; i++){\n                    let c = text.charCodeAt(i);\n                    let cWidth = widths[c] || defaultWidth;\n                    width += cWidth * textSize / cacheMeasureTextSize;\n                }\n                return width;\n            };\n        }\n    }\n\n}"
  },
  {
    "path": "src/androidui/native/NativeEditText.ts",
    "content": "///<reference path=\"../../android/widget/EditText.ts\"/>\n///<reference path=\"NativeApi.ts\"/>\n\nmodule androidui.native {\n    \n    import Rect = android.graphics.Rect;\n    export class NativeEditText extends android.widget.EditText {\n        private mRectTmp = new Rect();\n        // protected setForceDisableDrawText(disable:boolean){\n        //     //always show text on canvas.\n        // }\n        private computeTextArea():void {\n            this.getGlobalVisibleRect(this.mRectTmp);\n\n            if (this.mLayout == null) {\n                this.assumeLayout();\n            }\n            this.mRectTmp.left += this.getTotalPaddingLeft();\n            this.mRectTmp.top += this.getTotalPaddingTop();\n            this.mRectTmp.right -= (this.getTotalPaddingRight());\n            this.mRectTmp.bottom -= (this.getTotalPaddingBottom());\n        }\n\n        protected onInputElementFocusChanged(focused:boolean):any {\n            if(focused){\n                this.computeTextArea();\n                NativeApi.drawHTML.showDrawHTMLBound(this.hashCode(), this.mRectTmp.left, this.mRectTmp.top, this.mRectTmp.right, this.mRectTmp.bottom);\n            }else{\n                NativeApi.drawHTML.hideDrawHTMLBound(this.hashCode());\n            }\n            return super.onInputElementFocusChanged(focused);\n        }\n\n        protected tryShowInputElement():any {\n            this.computeTextArea();\n            NativeApi.drawHTML.showDrawHTMLBound(this.hashCode(), this.mRectTmp.left, this.mRectTmp.top, this.mRectTmp.right, this.mRectTmp.bottom);\n            return super.tryShowInputElement();\n        }\n\n        protected tryDismissInputElement():any {\n            NativeApi.drawHTML.hideDrawHTMLBound(this.hashCode());\n            return super.tryDismissInputElement();\n        }\n\n        protected _syncBoundAndScrollToElement():void {\n            super._syncBoundAndScrollToElement();\n            if(this.isInputElementShowed() && this.isFocused() && this.getText().length>0) {\n                this.computeTextArea();\n                NativeApi.drawHTML.showDrawHTMLBound(this.hashCode(), this.mRectTmp.left, this.mRectTmp.top, this.mRectTmp.right, this.mRectTmp.bottom);\n            }\n        }\n        \n        protected onDetachedFromWindow():void {\n            super.onDetachedFromWindow();\n            NativeApi.drawHTML.hideDrawHTMLBound(this.hashCode());\n        }\n    }\n}"
  },
  {
    "path": "src/androidui/native/NativeHtmlView.ts",
    "content": "///<reference path=\"../widget/HtmlView.ts\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n\nmodule androidui.native{\n    import HtmlView = androidui.widget.HtmlView;\n    import Rect = android.graphics.Rect;\n\n    export class NativeHtmlView extends HtmlView {\n        private mRectDrawHTMLBoundTmp = new Rect();\n\n        protected _syncBoundAndScrollToElement():void {\n            super._syncBoundAndScrollToElement();\n            this.getGlobalVisibleRect(this.mRectDrawHTMLBoundTmp);\n            NativeApi.drawHTML.showDrawHTMLBound(this.hashCode(), this.mRectDrawHTMLBoundTmp.left, this.mRectDrawHTMLBoundTmp.top, this.mRectDrawHTMLBoundTmp.right, this.mRectDrawHTMLBoundTmp.bottom);\n        }\n\n        protected onDetachedFromWindow():void {\n            super.onDetachedFromWindow();\n            NativeApi.drawHTML.hideDrawHTMLBound(this.hashCode());\n        }\n    }\n}"
  },
  {
    "path": "src/androidui/native/NativeImage.ts",
    "content": "/**\n * Created by linfaxin on 15/12/14.\n */\n///<reference path=\"../image/NetImage\"/>\n///<reference path=\"../../android/graphics/Rect.ts\"/>\n///<reference path=\"NativeApi.ts\"/>\n\nmodule androidui.native {\n    import NetImage = androidui.image.NetImage;\n    import Rect = android.graphics.Rect;\n\n    let sNextId = 0;\n    const NativeImageInstances = new Map<number, NativeImage>();\n\n    export class NativeImage extends NetImage{\n        imageId:number;\n        leftBorder:number[];\n        topBorder:number[];\n        rightBorder:number[];\n        bottomBorder:number[];\n        private getPixelsCallbacks:Array<(data:number[])=>void>;\n\n        protected createImage(){\n            this.imageId = sNextId++;\n            NativeImageInstances.set(this.imageId, this);\n            NativeApi.image.createImage(this.imageId);\n        }\n\n        protected loadImage(){\n            NativeApi.image.loadImage(this.imageId, this.src);\n        }\n\n        recycle(){\n            NativeApi.image.recycleImage(this.imageId);\n            NativeImageInstances.delete(this.imageId);\n        }\n\n        getPixels(bound:Rect, callBack:(data:number[])=>void):void {\n            if(!callBack) return;\n            if(!bound) bound = new Rect(0, 0, this.width, this.height);\n            if(bound.isEmpty()) {\n                callBack([]);\n                return;\n            }\n            if(!this.getPixelsCallbacks) this.getPixelsCallbacks = [];\n            this.getPixelsCallbacks.push(callBack);\n            let callBackIndex = this.getPixelsCallbacks.length-1;\n            NativeApi.image.getPixels(this.imageId, callBackIndex, bound.left, bound.top, bound.right, bound.bottom);\n        }\n\n\n        getBorderPixels(callBack:(leftBorder:number[], topBorder:number[], rightBorder:number[], bottomBorder:number[])=>void):void {\n            if(!callBack) return;\n            if(this.leftBorder && this.topBorder && this.rightBorder && this.bottomBorder){\n                callBack(this.leftBorder, this.topBorder, this.rightBorder, this.bottomBorder);\n            }else{\n                super.getBorderPixels(callBack);\n            }\n        }\n\n        //call from native\n        private static notifyLoadFinish(imageId:number, width:number, height:number,\n                                        leftBorder:number[], topBorder:number[], rightBorder:number[], bottomBorder:number[]){\n            let image:NativeImage = NativeImageInstances.get(imageId);\n            image.mImageWidth = width;\n            image.mImageHeight = height;\n            image.leftBorder = leftBorder;\n            image.topBorder = topBorder;\n            image.rightBorder = rightBorder;\n            image.bottomBorder = bottomBorder;\n            image.fireOnLoad();\n        }\n        //call from native\n        private static notifyLoadError(imageId:number){\n            let image:NativeImage = NativeImageInstances.get(imageId);\n            image.mImageWidth = image.mImageHeight = 0;\n            image.fireOnError();\n        }\n\n        //call from native\n        private static notifyGetPixels(imageId:number, callBackIndex:number, data:number[]){\n            let image:NativeImage = NativeImageInstances.get(imageId);\n            let callBack = image.getPixelsCallbacks[callBackIndex];\n            image.getPixelsCallbacks[callBackIndex] = null;\n            callBack(data);\n        }\n    }\n}"
  },
  {
    "path": "src/androidui/native/NativeSurface.ts",
    "content": "/**\n * Created by linfaxin on 15/12/14.\n */\n///<reference path=\"../../android/view/Surface.ts\"/>\n///<reference path=\"../../android/content/res/Resources.ts\"/>\n///<reference path=\"NativeCanvas.ts\"/>\n///<reference path=\"NativeApi.ts\"/>\n\n\nmodule androidui.native {\n    import Surface = android.view.Surface;\n\n\n    let sNextSurfaceID = 0;\n    const SurfaceInstances = new Map<number, NativeSurface>();\n\n    export class NativeSurface extends Surface{\n        private surfaceId;\n        private lockedCanvas:NativeSurfaceLockCanvas;\n\n        protected initImpl() {\n            this.initCanvasBound();\n            this.surfaceId = ++sNextSurfaceID;\n            SurfaceInstances.set(this.surfaceId, this);\n            let bound = this.mCanvasBound;\n            NativeApi.surface.createSurface(this.surfaceId, bound.left, bound.top, bound.right, bound.bottom);\n        }\n\n        notifyBoundChange() {\n            this.initCanvasBound();\n            let bound = this.mCanvasBound;\n            NativeApi.surface.onSurfaceBoundChange(this.surfaceId, bound.left, bound.top, bound.right, bound.bottom);\n        }\n\n        protected lockCanvasImpl(left:number, top:number, width:number, height:number):android.graphics.Canvas {\n            if(!this.lockedCanvas){\n                this.lockedCanvas = new NativeSurfaceLockCanvas(width, height);\n            }\n            NativeApi.surface.lockCanvas(this.surfaceId, this.lockedCanvas.canvasId, left, top, left+width, top+height);\n            return this.lockedCanvas;\n        }\n\n        unlockCanvasAndPost(canvas:android.graphics.Canvas):void {\n            if(canvas instanceof NativeCanvas){\n                NativeApi.surface.unlockCanvasAndPost(this.surfaceId, canvas.canvasId);\n            }else{\n                throw Error('canvas is not NativeCanvas');\n            }\n        }\n\n        showFps(fps:number):void {\n            NativeApi.surface.showFps(fps);\n        }\n\n        //call from native\n        private static notifySurfaceReady(surfaceId:number){\n            let surface:NativeSurface = SurfaceInstances.get(surfaceId);\n            surface.viewRoot.scheduleTraversals();\n        }\n\n        private static notifySurfaceSupportDirtyDraw(surfaceId:number, dirtyDrawSupport:boolean){\n            let surface:NativeSurface = SurfaceInstances.get(surfaceId);\n            surface.mSupportDirtyDraw = dirtyDrawSupport;\n            surface.viewRoot.scheduleTraversals();\n        }\n    }\n\n    class NativeSurfaceLockCanvas extends NativeCanvas{\n\n        protected createCanvasImpl():void {\n            //no need create canvas, will create when lock canvas\n        }\n    }\n\n}"
  },
  {
    "path": "src/androidui/native/NativeWebView.ts",
    "content": "///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/webkit/WebView.ts\"/>\n///<reference path=\"../../android/app/Activity.ts\"/>\n///<reference path=\"NativeApi.ts\"/>\n\nmodule androidui.native{\n    import View = android.view.View;\n    import WebView = android.webkit.WebView;\n    import WebViewClient = android.webkit.WebViewClient;\n    import Rect = android.graphics.Rect;\n    import Activity = android.app.Activity;\n\n    const anchor = document.createElement('a');\n    const webViewMap = new Map<number, NativeWebView>();\n\n    export class NativeWebView extends WebView{\n        private mBoundRect = new Rect();\n        private mRectTmp = new Rect();\n        private mLocationTmp = androidui.util.ArrayCreator.newNumberArray(2);\n        \n        private mUrl:string;\n        private mTitle:string;\n        private mCanGoBack:boolean;\n\n        constructor(context:android.content.Context, bindElement:HTMLElement, defStyle:any) {\n            super(context, bindElement, defStyle);\n\n            NativeApi.webView.createWebView(this.hashCode());\n            webViewMap.set(this.hashCode(), this);\n\n            //override activity's onDestroy\n            let activity = <Activity>this.getContext();\n            let onDestroy = activity.onDestroy;\n            activity.onDestroy = ()=>{\n                onDestroy.call(activity);\n                webViewMap.delete(this.hashCode());\n                NativeApi.webView.destroyWebView(this.hashCode());\n            };\n        }\n        \n        goBack():void {\n            NativeApi.webView.webViewGoBack(this.hashCode());\n        }\n\n        canGoBack():boolean {\n            return this.mCanGoBack;\n        }\n\n        loadUrl(url:string):void {\n            anchor.href = url;\n            url = anchor.href;\n            \n            this.mUrl = url;\n            NativeApi.webView.webViewLoadUrl(this.hashCode(), url);\n        }\n\n        reload():void {\n            NativeApi.webView.webViewReload(this.hashCode());\n        }\n\n        getUrl():string {\n            return this.mUrl;\n        }\n\n        getTitle():string {\n            return this.mTitle || this.getUrl();\n        }\n\n        setWebViewClient(client:android.webkit.WebViewClient):void {\n            super.setWebViewClient(client);\n        }\n\n        protected dependOnDebugLayout():boolean {\n            return false;\n        }\n        \n        protected _syncBoundAndScrollToElement():void {\n            super._syncBoundAndScrollToElement();\n\n            this.getLocationOnScreen(this.mLocationTmp);\n            this.mRectTmp.set(this.mLocationTmp[0], this.mLocationTmp[1], this.mLocationTmp[0] + this.getWidth(), this.mLocationTmp[1] + this.getHeight());\n            if(!this.mRectTmp.equals(this.mBoundRect)){\n                this.mBoundRect.set(this.mRectTmp);\n                NativeApi.webView.webViewBoundChange(this.hashCode(), this.mBoundRect.left, this.mBoundRect.top, this.mBoundRect.right, this.mBoundRect.bottom);\n            }\n        }\n\n        private static notifyLoadFinish(viewHash:number, url:string, title:string):void {\n            let nativeWebView = webViewMap.get(viewHash);\n            if(nativeWebView==null) return;\n            nativeWebView.mUrl = url;\n            nativeWebView.mTitle = title;\n            if(nativeWebView.mClient!=null){\n                nativeWebView.mClient.onReceivedTitle(nativeWebView, title);\n                nativeWebView.mClient.onPageFinished(nativeWebView, url);\n            }\n        }\n\n        private static notifyWebViewHistoryChange(viewHash:number, currentHistoryIndex:number, historySize:number):void {\n            let nativeWebView = webViewMap.get(viewHash);\n            if(nativeWebView==null) return;\n            nativeWebView.mCanGoBack = currentHistoryIndex > 0;\n        }\n    }\n}"
  },
  {
    "path": "src/androidui/util/ArrayCreator.ts",
    "content": "module androidui.util{\n    export class ArrayCreator {\n\n        /**\n         * In Java, number array will default fill 0.\n         * @param size\n         * @returns {number[]}\n         */\n        static newNumberArray(size:number):Array<number> {\n            let array = new Array<number>(size);\n            if(size>0) ArrayCreator.fillArray(array, 0);\n            return array;\n        }\n\n        /**\n         * In Java, boolean array will default fill false.\n         * @param size\n         * @returns {boolean[]}\n         */\n        static newBooleanArray(size:number):Array<boolean> {\n            let array = new Array<boolean>(size);\n            ArrayCreator.fillArray(array, false);\n            return array;\n        }\n\n        /**\n         * fill value to array\n         * @param array\n         * @param value\n         */\n        static fillArray(array:Array<any>, value:any){\n            for (var i = 0, length = array.length; i < length; i++) {\n                array[i] = value;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/androidui/util/ClassFinder.ts",
    "content": "/**\n * Created by linfaxin on 15/11/6.\n */\nmodule androidui.util{\n    export class ClassFinder {\n        /**\n         * @param classFullName com.xxx.xxx.MyView\n         * @param findInRoot root obj to find\n         */\n        static findClass(classFullName:string, findInRoot:any=window) {\n            let nameParts = classFullName.split('.');\n\n            let finding:any = findInRoot;\n            for(let part of nameParts){\n                //try ignore case first\n                let quickFind = finding[part.toLowerCase()];\n                if(quickFind){\n                    finding = quickFind;\n                    continue;\n                }\n\n                //search\n                let found = false;\n                for(let key in finding){\n                    if(key.toUpperCase()===part.toUpperCase()){\n                        finding = finding[key];\n                        found = true;\n                        break;\n                    }\n                }\n                if(!found) return null;\n            }\n\n            if(finding === findInRoot){\n                return null;\n            }\n            return finding;\n        }\n\n        static _findViewClassCache = {};\n        static findViewClass(className:string) {\n            let rootViewClass = ClassFinder._findViewClassCache[className];\n            if(!rootViewClass) rootViewClass = ClassFinder.findClass(className, android.view);\n            if(!rootViewClass) rootViewClass = ClassFinder.findClass(className, android['widget']);\n            if(!rootViewClass) rootViewClass = ClassFinder.findClass(className, androidui['widget']);\n            if(!rootViewClass) rootViewClass = ClassFinder.findClass(className);\n            if(!rootViewClass){\n                if(document.createElement(className) instanceof HTMLUnknownElement){\n                    console.warn('inflate: not find class ' + className);\n                }\n                return null;\n            }\n            ClassFinder._findViewClassCache[className] = rootViewClass;\n            return rootViewClass;\n        }\n    }\n}"
  },
  {
    "path": "src/androidui/util/Long.ts",
    "content": "// Copyright 2009 The Closure Library Authors. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS-IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * goog.math.Long Typescript port\n */\n\nmodule goog.math{\n    /**\n     * Constructs a 64-bit two's-complement integer, given its low and high 32-bit\n     * values as *signed* integers.  See the from* functions below for more\n     * convenient ways of constructing Longs.\n     *\n     * The internal representation of a long is the two given signed, 32-bit values.\n     * We use 32-bit pieces because these are the size of integers on which\n     * Javascript performs bit-operations.  For operations like addition and\n     * multiplication, we split each number into 16-bit pieces, which can easily be\n     * multiplied within Javascript's floating-point representation without overflow\n     * or change in sign.\n     *\n     * In the algorithms below, we frequently reduce the negative case to the\n     * positive case by negating the input(s) and then post-processing the result.\n     * Note that we must ALWAYS check specially whether those values are MIN_VALUE\n     * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n     * a positive number, it overflows back into a negative).  Not handling this\n     * case would often result in infinite recursion.\n     *\n     * @param {number} low  The low (signed) 32 bits of the long.\n     * @param {number} high  The high (signed) 32 bits of the long.\n     * @constructor\n     */\n    export class Long{\n\n        /**\n         * A cache of the Long representations of small integer values.\n         * @type {!Object}\n         * @private\n         */\n        private static IntCache_ = {};\n\n        /**\n         * Number used repeated below in calculations.  This must appear before the\n         * first call to any from* function below.\n         * @type {number}\n         * @private\n         */\n        private static TWO_PWR_16_DBL_ = 1 << 16;\n        private static TWO_PWR_24_DBL_ = 1 << 24;\n        private static TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_;\n        private static TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2;\n        private static TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_;\n        private static TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_;\n        private static TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2;\n\n        private static TWO_PWR_24_ = Long.fromInt(1 << 24);\n\n        static ZERO = Long.fromInt(0);\n        static ONE = Long.fromInt(1);\n        static NEG_ONE = Long.fromInt(-1);\n        static MAX_VALUE = Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);\n        static MIN_VALUE = Long.fromBits(0, 0x80000000 | 0);\n\n\n\n\n        private low_:number;\n        private high_:number;\n\n        /**\n         * Constructs a 64-bit two's-complement integer, given its low and high 32-bit\n         * values as *signed* integers.  See the from* functions below for more\n         * convenient ways of constructing Longs.\n         *\n         * @param {number} low  The low (signed) 32 bits of the long.\n         * @param {number} high  The high (signed) 32 bits of the long.\n         * @constructor\n         */\n        constructor(low:number, high:number) {\n            this.low_ = low | 0;  // force into 32 signed bits.\n            this.high_ = high | 0;  // force into 32 signed bits.\n        }\n\n        /** @return {number} The value, assuming it is a 32-bit integer. */\n        toInt():number {\n            return this.low_;\n        }\n\n\n        /** @return {number} The closest floating-point representation to this value. */\n        toNumber():number {\n            return this.high_ * Long.TWO_PWR_32_DBL_ + this.getLowBitsUnsigned();\n        }\n\n        /**\n         * @param {number=} opt_radix The radix in which the text should be written.\n         * @return {string} The textual representation of this value.\n         * @override\n         */\n        toString(opt_radix:number):string {\n            var radix = opt_radix || 10;\n            if (radix < 2 || 36 < radix) {\n                throw Error('radix out of range: ' + radix);\n            }\n\n            if (this.isZero()) {\n                return '0';\n            }\n\n            if (this.isNegative()) {\n                if (this.equals(Long.MIN_VALUE)) {\n                    // We need to change the Long value before it can be negated, so we remove\n                    // the bottom-most digit in this base and then recurse to do the rest.\n                    var radixLong = Long.fromNumber(radix);\n                    var div = this.div(radixLong);\n                    let rem = div.multiply(radixLong).subtract(this);\n                    return div.toString(radix) + rem.toInt().toString(radix);\n                } else {\n                    return '-' + this.negate().toString(radix);\n                }\n            }\n\n            // Do several (6) digits each time through the loop, so as to\n            // minimize the calls to the very expensive emulated div.\n            var radixToPower = Long.fromNumber(Math.pow(radix, 6));\n\n            let rem:Long = this;\n            var result = '';\n            while (true) {\n                var remDiv = rem.div(radixToPower);\n                var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();\n                var digits = intval.toString(radix);\n\n                rem = remDiv;\n                if (rem.isZero()) {\n                    return digits + result;\n                } else {\n                    while (digits.length < 6) {\n                        digits = '0' + digits;\n                    }\n                    result = '' + digits + result;\n                }\n            }\n        }\n\n        /** @return {number} The high 32-bits as a signed value. */\n        getHighBits():number {\n            return this.high_;\n        }\n\n        /** @return {number} The low 32-bits as a signed value. */\n        getLowBits():number {\n            return this.low_;\n        }\n\n        /** @return {number} The low 32-bits as an unsigned value. */\n        getLowBitsUnsigned():number {\n            return (this.low_ >= 0) ? this.low_ : Long.TWO_PWR_32_DBL_ + this.low_;\n        }\n\n        /**\n         * @return {number} Returns the number of bits needed to represent the absolute\n         *     value of this Long.\n         */\n        getNumBitsAbs():number {\n            if (this.isNegative()) {\n                if (this.equals(Long.MIN_VALUE)) {\n                    return 64;\n                } else {\n                    return this.negate().getNumBitsAbs();\n                }\n            } else {\n                var val = this.high_ != 0 ? this.high_ : this.low_;\n                for (var bit = 31; bit > 0; bit--) {\n                    if ((val & (1 << bit)) != 0) {\n                        break;\n                    }\n                }\n                return this.high_ != 0 ? bit + 33 : bit + 1;\n            }\n        }\n\n        /** @return {boolean} Whether this value is zero. */\n        isZero():boolean {\n            return this.high_ == 0 && this.low_ == 0;\n        }\n\n        /** @return {boolean} Whether this value is negative. */\n        isNegative():boolean {\n            return this.high_ < 0;\n        }\n\n        /** @return {boolean} Whether this value is odd. */\n        isOdd():boolean {\n            return (this.low_ & 1) == 1;\n        }\n\n        /**\n         * @param {goog.math.Long} other Long to compare against.\n         * @return {boolean} Whether this Long equals the other.\n         */\n        equals(other:Long):boolean {\n            return (this.high_ == other.high_) && (this.low_ == other.low_);\n        }\n\n\n        /**\n         * @param {goog.math.Long} other Long to compare against.\n         * @return {boolean} Whether this Long does not equal the other.\n         */\n        notEquals(other:Long):boolean {\n            return (this.high_ != other.high_) || (this.low_ != other.low_);\n        }\n\n\n        /**\n         * @param {goog.math.Long} other Long to compare against.\n         * @return {boolean} Whether this Long is less than the other.\n         */\n        lessThan(other:Long):boolean {\n            return this.compare(other) < 0;\n        }\n\n\n        /**\n         * @param {goog.math.Long} other Long to compare against.\n         * @return {boolean} Whether this Long is less than or equal to the other.\n         */\n        lessThanOrEqual(other:Long):boolean {\n            return this.compare(other) <= 0;\n        }\n\n\n        /**\n         * @param {goog.math.Long} other Long to compare against.\n         * @return {boolean} Whether this Long is greater than the other.\n         */\n        greaterThan(other:Long):boolean {\n            return this.compare(other) > 0;\n        }\n\n\n        /**\n         * @param {goog.math.Long} other Long to compare against.\n         * @return {boolean} Whether this Long is greater than or equal to the other.\n         */\n        greaterThanOrEqual(other:Long):boolean {\n            return this.compare(other) >= 0;\n        }\n\n\n        /**\n         * Compares this Long with the given one.\n         * @param {goog.math.Long} other Long to compare against.\n         * @return {number} 0 if they are the same, 1 if the this is greater, and -1\n         *     if the given one is greater.\n         */\n        compare(other:Long):number {\n            if (this.equals(other)) {\n                return 0;\n            }\n\n            var thisNeg = this.isNegative();\n            var otherNeg = other.isNegative();\n            if (thisNeg && !otherNeg) {\n                return -1;\n            }\n            if (!thisNeg && otherNeg) {\n                return 1;\n            }\n\n            // at this point, the signs are the same, so subtraction will not overflow\n            if (this.subtract(other).isNegative()) {\n                return -1;\n            } else {\n                return 1;\n            }\n        }\n\n\n        /** @return {!goog.math.Long} The negation of this value. */\n        negate():Long {\n            if (this.equals(Long.MIN_VALUE)) {\n                return Long.MIN_VALUE;\n            } else {\n                return this.not().add(Long.ONE);\n            }\n        }\n\n\n        /**\n         * Returns the sum of this and the given Long.\n         * @param {goog.math.Long} other Long to add to this one.\n         * @return {!goog.math.Long} The sum of this and the given Long.\n         */\n        add(other:Long):Long {\n            // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\n\n            var a48 = this.high_ >>> 16;\n            var a32 = this.high_ & 0xFFFF;\n            var a16 = this.low_ >>> 16;\n            var a00 = this.low_ & 0xFFFF;\n\n            var b48 = other.high_ >>> 16;\n            var b32 = other.high_ & 0xFFFF;\n            var b16 = other.low_ >>> 16;\n            var b00 = other.low_ & 0xFFFF;\n\n            var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n            c00 += a00 + b00;\n            c16 += c00 >>> 16;\n            c00 &= 0xFFFF;\n            c16 += a16 + b16;\n            c32 += c16 >>> 16;\n            c16 &= 0xFFFF;\n            c32 += a32 + b32;\n            c48 += c32 >>> 16;\n            c32 &= 0xFFFF;\n            c48 += a48 + b48;\n            c48 &= 0xFFFF;\n            return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n        }\n\n\n        /**\n         * Returns the difference of this and the given Long.\n         * @param {goog.math.Long} other Long to subtract from this.\n         * @return {!goog.math.Long} The difference of this and the given Long.\n         */\n        subtract(other:Long):Long {\n            return this.add(other.negate());\n        }\n\n\n        /**\n         * Returns the product of this and the given long.\n         * @param {goog.math.Long} other Long to multiply with this.\n         * @return {!goog.math.Long} The product of this and the other.\n         */\n        multiply(other:Long):Long {\n            if (this.isZero()) {\n                return Long.ZERO;\n            } else if (other.isZero()) {\n                return Long.ZERO;\n            }\n\n            if (this.equals(Long.MIN_VALUE)) {\n                return other.isOdd() ? Long.MIN_VALUE : Long.ZERO;\n            } else if (other.equals(Long.MIN_VALUE)) {\n                return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;\n            }\n\n            if (this.isNegative()) {\n                if (other.isNegative()) {\n                    return this.negate().multiply(other.negate());\n                } else {\n                    return this.negate().multiply(other).negate();\n                }\n            } else if (other.isNegative()) {\n                return this.multiply(other.negate()).negate();\n            }\n\n            // If both longs are small, use float multiplication\n            if (this.lessThan(Long.TWO_PWR_24_) &&\n                other.lessThan(Long.TWO_PWR_24_)) {\n                return Long.fromNumber(this.toNumber() * other.toNumber());\n            }\n\n            // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\n            // We can skip products that would overflow.\n\n            var a48 = this.high_ >>> 16;\n            var a32 = this.high_ & 0xFFFF;\n            var a16 = this.low_ >>> 16;\n            var a00 = this.low_ & 0xFFFF;\n\n            var b48 = other.high_ >>> 16;\n            var b32 = other.high_ & 0xFFFF;\n            var b16 = other.low_ >>> 16;\n            var b00 = other.low_ & 0xFFFF;\n\n            var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n            c00 += a00 * b00;\n            c16 += c00 >>> 16;\n            c00 &= 0xFFFF;\n            c16 += a16 * b00;\n            c32 += c16 >>> 16;\n            c16 &= 0xFFFF;\n            c16 += a00 * b16;\n            c32 += c16 >>> 16;\n            c16 &= 0xFFFF;\n            c32 += a32 * b00;\n            c48 += c32 >>> 16;\n            c32 &= 0xFFFF;\n            c32 += a16 * b16;\n            c48 += c32 >>> 16;\n            c32 &= 0xFFFF;\n            c32 += a00 * b32;\n            c48 += c32 >>> 16;\n            c32 &= 0xFFFF;\n            c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n            c48 &= 0xFFFF;\n            return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n        }\n\n\n        /**\n         * Returns this Long divided by the given one.\n         * @param {goog.math.Long} other Long by which to divide.\n         * @return {!goog.math.Long} This Long divided by the given one.\n         */\n        div(other:Long):Long {\n            if (other.isZero()) {\n                throw Error('division by zero');\n            } else if (this.isZero()) {\n                return Long.ZERO;\n            }\n\n            if (this.equals(Long.MIN_VALUE)) {\n                if (other.equals(Long.ONE) ||\n                    other.equals(Long.NEG_ONE)) {\n                    return Long.MIN_VALUE;  // recall that -MIN_VALUE == MIN_VALUE\n                } else if (other.equals(Long.MIN_VALUE)) {\n                    return Long.ONE;\n                } else {\n                    // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\n                    var halfThis = this.shiftRight(1);\n                    let approx = halfThis.div(other).shiftLeft(1);\n                    if (approx.equals(Long.ZERO)) {\n                        return other.isNegative() ? Long.ONE : Long.NEG_ONE;\n                    } else {\n                        let rem = this.subtract(other.multiply(approx));\n                        var result = approx.add(rem.div(other));\n                        return result;\n                    }\n                }\n            } else if (other.equals(Long.MIN_VALUE)) {\n                return Long.ZERO;\n            }\n\n            if (this.isNegative()) {\n                if (other.isNegative()) {\n                    return this.negate().div(other.negate());\n                } else {\n                    return this.negate().div(other).negate();\n                }\n            } else if (other.isNegative()) {\n                return this.div(other.negate()).negate();\n            }\n\n            // Repeat the following until the remainder is less than other:  find a\n            // floating-point that approximates remainder / other *from below*, add this\n            // into the result, and subtract it from the remainder.  It is critical that\n            // the approximate value is less than or equal to the real value so that the\n            // remainder never becomes negative.\n            var res = Long.ZERO;\n            let rem:Long = this;\n            while (rem.greaterThanOrEqual(other)) {\n                // Approximate the result of division. This may be a little greater or\n                // smaller than the actual value.\n                let approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));\n\n                // We will tweak the approximate result by changing it in the 48-th digit or\n                // the smallest non-fractional digit, whichever is larger.\n                var log2 = Math.ceil(Math.log(approx) / Math.LN2);\n                var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48);\n\n                // Decrease the approximation until it is smaller than the remainder.  Note\n                // that if it is too large, the product overflows and is negative.\n                var approxRes = Long.fromNumber(approx);\n                var approxRem = approxRes.multiply(other);\n                while (approxRem.isNegative() || approxRem.greaterThan(rem)) {\n                    approx -= delta;\n                    approxRes = Long.fromNumber(approx);\n                    approxRem = approxRes.multiply(other);\n                }\n\n                // We know the answer can't be zero... and actually, zero would cause\n                // infinite recursion since we would make no progress.\n                if (approxRes.isZero()) {\n                    approxRes = Long.ONE;\n                }\n\n                res = res.add(approxRes);\n                rem = rem.subtract(approxRem);\n            }\n            return res;\n        }\n\n\n        /**\n         * Returns this Long modulo the given one.\n         * @param {goog.math.Long} other Long by which to mod.\n         * @return {!goog.math.Long} This Long modulo the given one.\n         */\n        modulo(other:Long):Long {\n            return this.subtract(this.div(other).multiply(other));\n        }\n\n\n        /** @return {!goog.math.Long} The bitwise-NOT of this value. */\n        not():Long {\n            return Long.fromBits(~this.low_, ~this.high_);\n        }\n\n\n        /**\n         * Returns the bitwise-AND of this Long and the given one.\n         * @param {goog.math.Long} other The Long with which to AND.\n         * @return {!goog.math.Long} The bitwise-AND of this and the other.\n         */\n        and(other:Long):Long {\n            return Long.fromBits(this.low_ & other.low_,\n                this.high_ & other.high_);\n        }\n\n\n        /**\n         * Returns the bitwise-OR of this Long and the given one.\n         * @param {goog.math.Long} other The Long with which to OR.\n         * @return {!goog.math.Long} The bitwise-OR of this and the other.\n         */\n        or(other:Long):Long {\n            return Long.fromBits(this.low_ | other.low_,\n                this.high_ | other.high_);\n        }\n\n\n        /**\n         * Returns the bitwise-XOR of this Long and the given one.\n         * @param {goog.math.Long} other The Long with which to XOR.\n         * @return {!goog.math.Long} The bitwise-XOR of this and the other.\n         */\n        xor(other:Long):Long {\n            return Long.fromBits(this.low_ ^ other.low_,\n                this.high_ ^ other.high_);\n        }\n\n\n        /**\n         * Returns this Long with bits shifted to the left by the given amount.\n         * @param {number} numBits The number of bits by which to shift.\n         * @return {!goog.math.Long} This shifted to the left by the given amount.\n         */\n        shiftLeft(numBits:number):Long {\n            numBits &= 63;\n            if (numBits == 0) {\n                return this;\n            } else {\n                var low = this.low_;\n                if (numBits < 32) {\n                    var high = this.high_;\n                    return Long.fromBits(\n                        low << numBits,\n                        (high << numBits) | (low >>> (32 - numBits)));\n                } else {\n                    return Long.fromBits(0, low << (numBits - 32));\n                }\n            }\n        }\n\n\n        /**\n         * Returns this Long with bits shifted to the right by the given amount.\n         * @param {number} numBits The number of bits by which to shift.\n         * @return {!goog.math.Long} This shifted to the right by the given amount.\n         */\n        shiftRight(numBits:number):Long {\n            numBits &= 63;\n            if (numBits == 0) {\n                return this;\n            } else {\n                var high = this.high_;\n                if (numBits < 32) {\n                    var low = this.low_;\n                    return Long.fromBits(\n                        (low >>> numBits) | (high << (32 - numBits)),\n                        high >> numBits);\n                } else {\n                    return Long.fromBits(\n                        high >> (numBits - 32),\n                        high >= 0 ? 0 : -1);\n                }\n            }\n        }\n\n\n        /**\n         * Returns this Long with bits shifted to the right by the given amount, with\n         * zeros placed into the new leading bits.\n         * @param {number} numBits The number of bits by which to shift.\n         * @return {!goog.math.Long} This shifted to the right by the given amount, with\n         *     zeros placed into the new leading bits.\n         */\n        shiftRightUnsigned(numBits:number):Long {\n            numBits &= 63;\n            if (numBits == 0) {\n                return this;\n            } else {\n                var high = this.high_;\n                if (numBits < 32) {\n                    var low = this.low_;\n                    return Long.fromBits(\n                        (low >>> numBits) | (high << (32 - numBits)),\n                        high >>> numBits);\n                } else if (numBits == 32) {\n                    return Long.fromBits(high, 0);\n                } else {\n                    return Long.fromBits(high >>> (numBits - 32), 0);\n                }\n            }\n        }\n\n\n        /**\n         * Returns a Long representing the given (32-bit) integer value.\n         * @param {number} value The 32-bit integer in question.\n         * @return {!goog.math.Long} The corresponding Long value.\n         */\n        static fromInt(value:number):Long {\n            if (-128 <= value && value < 128) {\n                var cachedObj = Long.IntCache_[value];\n                if (cachedObj) {\n                    return cachedObj;\n                }\n            }\n\n            var obj = new Long(value | 0, value < 0 ? -1 : 0);\n            if (-128 <= value && value < 128) {\n                Long.IntCache_[value] = obj;\n            }\n            return obj;\n        }\n\n\n        /**\n         * Returns a Long representing the given value, provided that it is a finite\n         * number.  Otherwise, zero is returned.\n         * @param {number} value The number in question.\n         * @return {!goog.math.Long} The corresponding Long value.\n         */\n        static fromNumber(value:number):Long {\n            if (isNaN(value) || !isFinite(value)) {\n                return Long.ZERO;\n            } else if (value <= -Long.TWO_PWR_63_DBL_) {\n                return Long.MIN_VALUE;\n            } else if (value + 1 >= Long.TWO_PWR_63_DBL_) {\n                return Long.MAX_VALUE;\n            } else if (value < 0) {\n                return Long.fromNumber(-value).negate();\n            } else {\n                return new Long(\n                    (value % Long.TWO_PWR_32_DBL_) | 0,\n                    (value / Long.TWO_PWR_32_DBL_) | 0);\n            }\n        }\n\n        /**\n         * Returns a Long representing the 64-bit integer that comes by concatenating\n         * the given high and low bits.  Each is assumed to use 32 bits.\n         * @param {number} lowBits The low 32-bits.\n         * @param {number} highBits The high 32-bits.\n         * @return {!goog.math.Long} The corresponding Long value.\n         */\n        static fromBits(lowBits:number, highBits:number):Long {\n            return new Long(lowBits, highBits);\n        }\n\n        /**\n         * Returns a Long representation of the given string, written using the given\n         * radix.\n         * @param {string} str The textual representation of the Long.\n         * @param {number=} opt_radix The radix in which the text is written.\n         * @return {!goog.math.Long} The corresponding Long value.\n         */\n        static fromString(str:string, opt_radix:number):Long {\n            if (str.length == 0) {\n                throw Error('number format error: empty string');\n            }\n\n            var radix = opt_radix || 10;\n            if (radix < 2 || 36 < radix) {\n                throw Error('radix out of range: ' + radix);\n            }\n\n            if (str.charAt(0) == '-') {\n                return Long.fromString(str.substring(1), radix).negate();\n            } else if (str.indexOf('-') >= 0) {\n                throw Error('number format error: interior \"-\" character: ' + str);\n            }\n\n            // Do several (8) digits each time through the loop, so as to\n            // minimize the calls to the very expensive emulated div.\n            var radixToPower = Long.fromNumber(Math.pow(radix, 8));\n\n            var result = Long.ZERO;\n            for (var i = 0; i < str.length; i += 8) {\n                var size = Math.min(8, str.length - i);\n                var value = parseInt(str.substring(i, i + size), radix);\n                if (size < 8) {\n                    var power = Long.fromNumber(Math.pow(radix, size));\n                    result = result.multiply(power).add(Long.fromNumber(value));\n                } else {\n                    result = result.multiply(radixToPower);\n                    result = result.add(Long.fromNumber(value));\n                }\n            }\n            return result;\n        }\n\n    }\n}"
  },
  {
    "path": "src/androidui/util/NumberChecker.ts",
    "content": "/**\n * Created by linfaxin on 15/11/24.\n */\nmodule androidui.util{\n    export class NumberChecker{\n        static warnNotNumber(...n:number[]):boolean {\n            try {\n                this.assetNotNumber(...n);\n            } catch (e) {\n                console.error(e);\n                return true;\n            }\n            return false;\n        }\n        static assetNotNumber(...ns:number[]) {\n            if(!this.checkIsNumber()){\n                throw Error('assetNotNumber : ' + ns);\n            }\n        }\n        static checkIsNumber(...ns:number[]):boolean {\n            if(ns==null) return false;\n            for(let n of ns){\n                if(n==null || Number.isNaN(n)) return false;\n            }\n            return true;\n        }\n    }\n}"
  },
  {
    "path": "src/androidui/util/PageStack.ts",
    "content": "/**\n * Created by linfaxin on 15/12/30.\n */\n\nmodule PageStack{\n    export var DEBUG = false;\n    const history_go = history.go;\n    export var currentStack:StateStack;\n    var iFrameHistoryLengthAsFake = 0;\n\n    /**\n     * callback when user press back history button\n     * @return is back press consumed\n     */\n    export var backListener:()=>boolean;\n    /**\n     * callback when call PageStack.openPage()\n     * @return opened page or true means open success\n     */\n    export var pageOpenHandler:(pageId:string, pageExtra?:any, isRestore?:boolean)=>any;\n    /**\n     * callback when user modify location.hash\n     * @return opened page or true means open success\n     */\n    export var pagePushHandler:(pageId:string, pageExtra?:any)=>any;\n    /**\n     * callback when page will close\n     * @return closed page or true means close success. The history will back after close success\n     */\n    export var pageCloseHandler:(pageId:string, pageExtra?:any)=>any;\n\n    let historyLocking = false;//wait history go complete\n    let windowLoadLocking = true;//wait window load finish\n    let pendingFuncLock = [];\n\n    let initCalled = false;\n\n    export function init(){\n        initCalled = true;\n        _init();\n\n        //override history go/back/forward\n        history.go = function(delta:number){\n            PageStack.go(delta);\n        };\n        history.back = function(delta=-1){\n            PageStack.go(delta);\n        };\n        history.forward = function(delta=1){\n            PageStack.go(delta);\n        };\n    }\n    function checkInitCalled(){\n        if(!initCalled) throw Error(\"PageStack.init() must be call first\");\n    }\n\n    function _init(){\n        currentStack = history.state;\n        if(currentStack && !currentStack.isRoot){\n            console.log('already has history.state when _init PageState, restore page');\n            restorePageFromStackIfNeed();\n\n        }else{\n            currentStack = currentStack || {\n                    pageId: '',\n                    isRoot: true,\n                    stack: [{pageId: null}]\n                };\n\n            let initOpenUrl = location.hash;\n            if(initOpenUrl && initOpenUrl.indexOf('#')===0) initOpenUrl = initOpenUrl.substring(1);\n\n            removeLastHistoryIfFaked();\n            ensureLockDo(()=>{\n                //set root hash '#' when _init PageStack\n                history.replaceState(currentStack, null, '#');\n            });\n\n            if(initOpenUrl && initOpenUrl.length>0){\n                if(firePagePush(initOpenUrl, null)){\n                    notifyNewPageOpened(initOpenUrl);\n                }\n            }\n        }\n        ensureLastHistoryFaked();\n\n\n        if (document.readyState === 'complete') {\n            windowLoadLocking = false;\n            setTimeout(initOnpopstate, 0);\n\n        }else{\n            window.addEventListener('load', ()=>{\n                windowLoadLocking = false;\n\n                //init listener popstate delay, because safari will trigger a 'onpopstate' when page load finish, should ignore this.\n                window.removeEventListener('popstate', onpopstateListener);\n                //a 'popstate' event will trigger before next frame in safari\n                setTimeout(initOnpopstate, 0);\n            });\n        }\n    }\n\n    //_init onpopstate, deal when user press back / modify location hash\n    let onpopstateListener = function(ev:PopStateEvent){\n        let stack = <StateStack>ev.state;\n\n        if(historyLocking){\n            //historyGo method will callback to here, do nothing only remember stack\n            currentStack = stack;\n            return;\n        }\n\n        if(DEBUG) console.log('onpopstate', stack);\n\n        if(!stack){\n            //no state, user modified the hash.\n\n            let pageId = location.hash;\n            if(pageId[0]==='#') pageId = pageId.substring(1);\n\n            //back the changed hash page & fake page\n            historyGo(-2, false);\n            if(firePagePush(pageId, null)){\n                notifyNewPageOpened(pageId);\n\n            }else{\n                ensureLastHistoryFaked();\n            }\n\n        }else if(currentStack.stack.length!=stack.stack.length){\n            //will happen when back multi page (long click back button on pc chrome)\n            let delta = stack.stack.length - currentStack.stack.length;\n            if(delta>=0){\n                console.warn('something error! stack: ', stack, 'last stack: ', currentStack);\n                return;\n            }\n\n            var stackList = currentStack.stack;\n            currentStack = stack;\n            //history already change, try close the pages\n            tryClosePageAfterHistoryChanged(stackList, delta);\n\n        }else{\n            currentStack = stack;\n\n            //user press back button.\n            if(fireBackPressed()){\n                //user handle the back press.\n                ensureLastHistoryFaked();\n\n            }else{\n                var stackList = currentStack.stack;\n                var pageId = stackList[stackList.length-1].pageId;\n                if(firePageClose(pageId, stackList[stackList.length-1].extra)){\n                    //should go back real.\n                    historyGo(-1);\n\n                }else{\n                    ensureLastHistoryFaked();\n                }\n            }\n        }\n    };\n    function initOnpopstate(){\n        window.removeEventListener('popstate', onpopstateListener);\n        window.addEventListener('popstate', onpopstateListener);\n    }\n\n\n    export function go(delta:number, pageAlreadyClose=false){\n        checkInitCalled();\n        if(historyLocking){\n            //do delay\n            ensureLockDo(()=>{\n                go(delta);\n            });\n            return;\n        }\n        var stackList = currentStack.stack;\n        if(delta===-1 && !pageAlreadyClose){\n            if(!firePageClose(stackList[stackList.length-1].pageId, stackList[stackList.length-1].extra)){\n                //page not close, can't go back\n                return;\n            }\n        }\n\n        removeLastHistoryIfFaked();\n\n        historyGo(delta);\n\n        if(delta<-1 && !pageAlreadyClose) {\n            ensureLockDo(()=> {\n                //after history already change, fire close page\n                tryClosePageAfterHistoryChanged(stackList, delta);\n            });\n        }\n    }\n\n    function tryClosePageAfterHistoryChanged(stateListBeforeHistoryChange:StateSaved[], delta:number){\n        let historyLength = stateListBeforeHistoryChange.length;\n        for(let i=historyLength+delta; i<historyLength; i++){\n            let state = stateListBeforeHistoryChange[i];\n            if(!firePageClose(state.pageId, state.extra)){\n                //restore the page history if not close\n                notifyNewPageOpened(state.pageId, state.extra);\n            }\n        }\n    }\n\n    export function back(pageAlreadyClose=false){\n        checkInitCalled();\n        go(-1, pageAlreadyClose);\n    }\n\n    export function openPage(pageId:string, extra?:any):any {\n        checkInitCalled();\n        pageId+='';\n        var openResult = firePageOpen(pageId, extra);\n        if(openResult){\n            notifyNewPageOpened(pageId, extra);\n        }\n        return openResult;\n    }\n\n    export function backToPage(pageId:string){\n        checkInitCalled();\n        if(DEBUG) console.log('backToPage', pageId);\n        if(historyLocking){\n            //do delay\n            ensureLockDo(()=>{\n                backToPage(pageId);\n            });\n        }\n        let stackList = currentStack.stack;\n        let historyLength = stackList.length;\n        for(let i=historyLength-1; i>=0; i--){//reverse\n            let state = stackList[i];\n            if(state.pageId == pageId){\n                let delta = i - historyLength;\n                removeLastHistoryIfFaked();\n                historyGo(delta);\n                return;\n            }\n        }\n    }\n\n\n    let releaseLockingTimeout;\n    let requestHistoryGoWhenLocking = 0;\n    let ensureFakeAfterHistoryChange = false;\n    export function historyGo(delta:number, ensureFaked=true){\n        if(delta>=0) return;//not support forward\n        if(history.length === 1) return;//no history\n\n        ensureFakeAfterHistoryChange = ensureFakeAfterHistoryChange || ensureFaked;\n        if(historyLocking){\n            requestHistoryGoWhenLocking += delta;\n            return;\n        }\n\n        if(DEBUG) console.log('historyGo', delta);\n\n        historyLocking = true;\n        const state = history.state;\n        if(releaseLockingTimeout) clearTimeout(releaseLockingTimeout);\n        function checkRelease(){\n            clearTimeout(releaseLockingTimeout);\n            if(history.state === state){\n                releaseLockingTimeout = setTimeout(checkRelease, 0);\n            }else{\n                let continueGo = requestHistoryGoWhenLocking;\n                if(continueGo!=0){\n                    requestHistoryGoWhenLocking = 0;\n                    historyLocking = false;\n                    historyGo(continueGo, false);\n\n                }else {\n                    //history change complete\n                    if(ensureFakeAfterHistoryChange) ensureLastHistoryFakedImpl();\n                    ensureFakeAfterHistoryChange = false;\n                    releaseLockingTimeout = setTimeout(()=> {\n                        historyLocking = false;\n                    }, 10);\n                }\n            }\n        }\n        releaseLockingTimeout = setTimeout(checkRelease, 0);\n\n        history_go.call(history, delta);\n    }\n\n    //if page reload, but the page content will clear, should re-open pages\n    function restorePageFromStackIfNeed(){\n        if(currentStack){\n            let copy = currentStack.stack.concat();\n            copy.shift();//ignore root stack\n            for(let saveState of copy){\n                firePageOpen(saveState.pageId, saveState.extra, true);\n            }\n        }\n    }\n\n    function fireBackPressed():boolean {\n        if(backListener){\n            try {\n                return backListener();\n            } catch (e) {\n                console.error(e);\n            }\n        }\n    }\n    function firePageOpen(pageId:string, pageExtra?:any, isRestore=false):any {\n        if(pageOpenHandler){\n            try {\n                return pageOpenHandler(pageId, pageExtra, isRestore);\n            } catch (e) {\n                console.error(e);\n            }\n        }\n    }\n    function firePagePush(pageId:string, pageExtra?:any):any {\n        if(pagePushHandler){\n            try {\n                return pagePushHandler(pageId, pageExtra);\n            } catch (e) {\n                console.error(e);\n            }\n        }\n    }\n    function firePageClose(pageId:string, pageExtra?:any):boolean {\n        if(pageCloseHandler){\n            try {\n                return pageCloseHandler(pageId, pageExtra);\n            } catch (e) {\n                console.error(e);\n            }\n        }\n    }\n\n    /**\n     * call when app logic already close page. sync browser history here.\n     */\n    export function notifyPageClosed(pageId:string):void {\n        checkInitCalled();\n        if(DEBUG) console.log('notifyPageClosed', pageId);\n        if(historyLocking){\n            //do delay\n            ensureLockDo(()=>{\n                notifyPageClosed(pageId);\n            });\n            return;\n        }\n        let stackList = currentStack.stack;\n        let historyLength = stackList.length;\n        for(let i=historyLength-1; i>=0; i--){//reverse\n            let state = stackList[i];\n            if(state.pageId == pageId){\n                if(i === historyLength-1){//last page closed, back the history now\n                    removeLastHistoryIfFaked();\n                    historyGo(-1);\n                }else{\n                    let delta = i - historyLength;\n                    (function (delta) {\n                        removeLastHistoryIfFaked();\n                        //back history to the aim page first\n                        historyGo(delta);\n                        //then re-add other pages to history\n                        ensureLockDoAtFront(()=> {\n                            let historyLength = stackList.length;\n                            let pageStartAddIndex = historyLength + delta + 1;\n                            for (let j = pageStartAddIndex; j < historyLength; j++) {\n                                notifyNewPageOpened(stackList[j].pageId, stackList[j].extra);\n                            }\n                        });\n                    })(delta);\n                }\n                return;\n            }\n        }\n    }\n\n    /**\n     * call when app logic already open page. sync browser history here.\n     */\n    export function notifyNewPageOpened(pageId:string, extra?:any){\n        checkInitCalled();\n        if(DEBUG) console.log('notifyNewPageOpened', pageId);\n        let state:StateSaved = {\n            pageId : pageId,\n            extra : extra\n        };\n\n        ensureLockDo(function(){\n            currentStack.stack.push(state);\n            currentStack.pageId = pageId;\n            currentStack.isRoot = false;\n\n            if(history.state.isFake){\n                //replace the fake page\n                history.replaceState(currentStack, null, '#'+pageId);\n            }else{\n                history.pushState(currentStack, null, '#'+pageId);\n            }\n            ensureLastHistoryFakedImpl();\n        });\n    }\n\n    export function getPageExtra(pageId?:string):any {\n        checkInitCalled();\n        let stackList = currentStack.stack;\n        let historyLength = stackList.length;\n\n        if(!pageId){\n            return stackList[historyLength - 1].extra;\n\n        }else{\n            for(let i=historyLength-1; i>=0; i--) {//reverse\n                let state = stackList[i];\n                if(state.pageId == pageId){\n                    return state.extra;\n                }\n            }\n        }\n    }\n\n    export function setPageExtra(extra:any, pageId?:string):void {\n        checkInitCalled();\n        removeLastHistoryIfFaked();\n        ensureLockDo(function() {\n            let stackList = currentStack.stack;\n            let historyLength = stackList.length;\n\n            if(!pageId){\n                stackList[historyLength - 1].extra = extra;\n                history.replaceState(currentStack, null, '');\n\n            }else{\n                for(let i=historyLength-1; i>=0; i--) {//reverse\n                    let state = stackList[i];\n                    if(state.pageId == pageId){\n                        state.extra = extra;\n                        history.replaceState(currentStack, null, '');\n                        break;\n                    }\n                }\n            }\n\n            ensureLastHistoryFakedImpl();\n        });\n    }\n\n\n    function ensureLockDo(func:()=>any){\n        checkInitCalled();\n        if(!historyLocking && !windowLoadLocking){\n            func();\n            return;\n        }\n        pendingFuncLock.push(func);\n        _queryLockDo();\n    }\n\n    function ensureLockDoAtFront(func:()=>any, runNowIfNotLock=false){\n        checkInitCalled();\n        if(!historyLocking && !windowLoadLocking && runNowIfNotLock){\n            func();\n            return;\n        }\n        pendingFuncLock.splice(0, 0, func);\n        _queryLockDo();\n    }\n\n    let execLockedTimeoutId:number;\n    function _queryLockDo(){\n        if(execLockedTimeoutId) clearTimeout(execLockedTimeoutId);\n\n        function execLockedFunctions(){\n            if(historyLocking || windowLoadLocking){\n                clearTimeout(execLockedTimeoutId);\n                execLockedTimeoutId = setTimeout(execLockedFunctions, 0);\n\n            }else{\n                let f;\n                while(f = pendingFuncLock.shift()){\n                    f();\n                    if(historyLocking || windowLoadLocking){\n                        //case history change when call the function, all other functions will call next frame.\n                        clearTimeout(execLockedTimeoutId);\n                        execLockedTimeoutId = setTimeout(execLockedFunctions, 0);\n                        break;\n                    }\n                }\n            }\n        }\n        execLockedTimeoutId = setTimeout(execLockedFunctions, 0);\n    }\n\n    /**\n     * If current page has iFrame, you should call this method to fix history before close the page.\n     * (no need if iFrame has no history)\n     * @param historyLengthWhenInitIFrame\n     */\n    export function preClosePageHasIFrame(historyLengthWhenInitIFrame:number){\n        history.pushState({isFake:true}, null, null);\n        iFrameHistoryLengthAsFake = history.length - historyLengthWhenInitIFrame;\n    }\n\n    function removeLastHistoryIfFaked(){\n        ensureLockDo(removeLastHistoryIfFakedImpl);\n    }\n    function removeLastHistoryIfFakedImpl(){\n        if(history.state && history.state.isFake){\n            if(DEBUG) console.log('remove Fake History');\n            history.replaceState(null, null, '');//make history.state.isFake = false\n            historyGo(-1 - iFrameHistoryLengthAsFake, false);\n            iFrameHistoryLengthAsFake = 0;\n        }\n    }\n\n    function ensureLastHistoryFaked(){\n        ensureLockDo(ensureLastHistoryFakedImpl);\n    }\n    function ensureLastHistoryFakedImpl(){\n        if(!history.state.isFake){\n            if(DEBUG) console.log('append Fake History');\n            history.pushState({\n                isFake: true,\n                isRoot: currentStack.isRoot,\n                stack: currentStack.stack,\n            }, null, '');\n        }\n    }\n\n    export interface StateStack {\n        pageId:string;\n        isRoot?:boolean;\n        stack:StateSaved[];\n    }\n\n    export interface StateSaved {\n        pageId:string;\n        extra?:any;\n    }\n\n}"
  },
  {
    "path": "src/androidui/util/PerformanceAdjuster.ts",
    "content": "/**\n * Created by linfaxin on 15/12/1.\n */\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/graphics/Canvas.ts\"/>\n\nmodule androidui.util{\n    import Canvas = android.graphics.Canvas;\n    import Drawable = android.graphics.drawable.Drawable;\n    import ColorDrawable = android.graphics.drawable.ColorDrawable;\n    import Color = android.graphics.Color;\n    export class PerformanceAdjuster {\n\n        static noCanvasMode(){\n            android.graphics.Canvas.prototype = HackCanvas.prototype;\n\n            android.view.View.prototype.onDrawVerticalScrollBar =\n                function(canvas:Canvas, scrollBar:Drawable, l:number, t:number, r:number, b:number):void {\n                    let scrollBarEl = this.bindElement['VerticalScrollBar'];\n                    if(!scrollBarEl){\n                        scrollBarEl = document.createElement('div');\n                        this.bindElement['VerticalScrollBar'] = scrollBarEl;\n                        scrollBarEl.style.zIndex = '9';\n                        scrollBarEl.style.position = 'absolute';\n                        scrollBarEl.style.background = 'black';\n                        scrollBarEl.style.left = '0px';\n                        scrollBarEl.style.top = '0px';\n                        this.bindElement.appendChild(scrollBarEl);\n                    }\n\n                    let height = b - t;\n                    let width = r - l;\n                    let size = height;\n                    let thickness = width;\n                    let extent = this.mScrollCache.scrollBar.mExtent;\n                    let range = this.mScrollCache.scrollBar.mRange;\n\n                    let length = Math.round( size * extent / range);\n                    let offset = Math.round( (size - length) * this.mScrollCache.scrollBar.mOffset / (range - extent));\n                    if(t<0) t = 0;\n                    if(offset<0) offset = 0;\n\n                    scrollBarEl.style.transform = scrollBarEl.style.webkitTransform = `translate(${l}px, ${t + offset}px)`;\n                    scrollBarEl.style.width = (r-l)/2 + 'px';//half style\n                    scrollBarEl.style.height = length + 'px';\n                    scrollBarEl.style.opacity = this.mScrollCache.scrollBar.mVerticalThumb.getAlpha() / 255 + '';\n            };\n\n            const oldSetBackground = android.view.View.prototype.setBackground;\n            android.view.View.prototype.setBackground = function(drawable:Drawable){\n                oldSetBackground.call(this, drawable);\n                if(drawable instanceof ColorDrawable){\n                    this.bindElement.style.background = Color.toRGBAFunc((<ColorDrawable>this.mBackground).getColor());\n                }\n            };\n        }\n\n    }\n\n    class HackCanvas extends android.graphics.Canvas{\n\n        protected init():void {\n        }\n\n        recycle():void {\n        }\n\n        translate(dx:number, dy:number):void {\n        }\n\n        scale(sx:number, sy:number, px:number, py:number):void {\n        }\n\n        rotate(degrees:number, px:number, py:number):void {\n        }\n\n        drawRGB(r:number, g:number, b:number):void {\n        }\n\n        drawARGB(a:number, r:number, g:number, b:number):void {\n        }\n\n        drawColor(color:number):void {\n        }\n\n        clearColor():void {\n        }\n\n        save():number {\n            return 1;\n        }\n\n        restore():void {\n        }\n\n        restoreToCount(saveCount:number):void {\n        }\n\n        getSaveCount():number {\n            return 1;\n        }\n\n\n        clipRect(rect: android.graphics.Rect): boolean;\n        clipRect(left: number, top: number, right: number, bottom: number): boolean;\n        clipRect(...args):boolean {\n            return false;\n        }\n\n        getClipBounds(bounds:android.graphics.Rect):android.graphics.Rect {\n            return null;\n        }\n\n        quickReject(rect:android.graphics.Rect): boolean;\n        quickReject(left: number, top: number, right: number, bottom: number): boolean;\n        quickReject(...args):boolean {\n            return false;\n        }\n\n        drawCanvas(canvas:android.graphics.Canvas, offsetX:number, offsetY:number):void {\n        }\n\n        drawRect(rect:android.graphics.Rect, paint:android.graphics.Paint): any;\n        drawRect(left: number, top: number, right: number, bottom: number, paint: android.graphics.Paint): any;\n        drawRect(...args):any {\n        }\n\n        drawText(text:string, x:number, y:number, paint:android.graphics.Paint):void {\n        }\n    }\n}"
  },
  {
    "path": "src/androidui/util/Platform.ts",
    "content": "/**\n * Created by linfaxin on 16/2/4.\n */\nmodule androidui.util {\n    export class Platform {\n        static isIOS = navigator.userAgent.match(/(iPhone|iPad|iPod|ios)/i) ? true : false;\n        static isAndroid = navigator.userAgent.match('Android') ? true : false;\n        static isWeChat = navigator.userAgent.match(/MicroMessenger/i) ? true : false;\n    }\n}"
  },
  {
    "path": "src/androidui/widget/HtmlBaseView.ts",
    "content": "/**\n * Created by linfaxin on 15/10/26.\n */\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/content/res/Resources.ts\"/>\n///<reference path=\"../../android/R/attr.ts\"/>\n///<reference path=\"../../androidui/AndroidUI.ts\"/>\n\nmodule androidui.widget {\n    import View = android.view.View;\n    import Gravity = android.view.Gravity;\n    import Resources = android.content.res.Resources;\n    import Color = android.graphics.Color;\n    import ColorStateList = android.content.res.ColorStateList;\n    import MeasureSpec = View.MeasureSpec;\n    import TypedValue = android.util.TypedValue;\n\n    export class HtmlBaseView extends View {\n        private mHtmlTouchAble = false;\n\n        constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n            super(context, bindElement, defStyle);\n        }\n\n        onTouchEvent(event:android.view.MotionEvent):boolean {\n            if(this.mHtmlTouchAble){\n                event[android.view.ViewRootImpl.ContinueEventToDom] = true;\n            }\n            return super.onTouchEvent(event) || this.mHtmlTouchAble;\n        }\n\n        setHtmlTouchAble(enable:boolean):void {\n            this.mHtmlTouchAble = enable;\n        }\n\n        isHtmlTouchAble():boolean {\n            return this.mHtmlTouchAble;\n        }\n\n        protected dependOnDebugLayout():boolean {\n            return true;\n        }\n    }\n\n}"
  },
  {
    "path": "src/androidui/widget/HtmlDataAdapter.ts",
    "content": "/**\n * Created by linfaxin on 15/11/16.\n */\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n\nmodule androidui.widget{\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import Context = android.content.Context;\n\n    /**\n     * adapter can defined in html\n     */\n    export interface HtmlDataAdapter {\n        onInflateAdapter(bindElement:HTMLElement, context?:Context, parent?:ViewGroup):void;\n    }\n}"
  },
  {
    "path": "src/androidui/widget/HtmlDataListAdapter.ts",
    "content": "/**\n * Created by linfaxin on 15/11/16.\n */\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/widget/AbsListView.ts\"/>\n///<reference path=\"../../android/widget/ListAdapter.ts\"/>\n///<reference path=\"../../android/widget/BaseAdapter.ts\"/>\n///<reference path=\"../../android/widget/AdapterView.ts\"/>\n///<reference path=\"../../android/widget/SpinnerAdapter.ts\"/>\n///<reference path=\"../../android/database/DataSetObservable.ts\"/>\n///<reference path=\"../../android/database/DataSetObserver.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n\nmodule androidui.widget{\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import AbsListView = android.widget.AbsListView;\n    import ListAdapter = android.widget.ListAdapter;\n    import BaseAdapter = android.widget.BaseAdapter;\n    import AdapterView = android.widget.AdapterView;\n    import SpinnerAdapter = android.widget.SpinnerAdapter;\n    import DataSetObservable = android.database.DataSetObservable;\n    import DataSetObserver = android.database.DataSetObserver;\n    import Context = android.content.Context;\n\n    export class HtmlDataListAdapter extends BaseAdapter implements HtmlDataAdapter{\n        static RefElementTag = \"ref-element\".toUpperCase();\n        static RefElementProperty = \"RefElement\";\n        static BindAdapterProperty = \"BindAdapter\";\n\n        bindElementData:HTMLElement;\n        mContext:Context;\n\n        onInflateAdapter(bindElement:HTMLElement, context?:Context, parent?:android.view.ViewGroup):void {\n            this.bindElementData = bindElement;\n            this.mContext = context;\n            if(parent instanceof AbsListView){\n                parent.setAdapter(this);\n            }\n            bindElement[HtmlDataListAdapter.BindAdapterProperty] = this;\n            this.registerHtmlDataObserver();\n        }\n\n        private registerHtmlDataObserver(){\n            if(!window['MutationObserver']) return;\n            const adapter = this;\n            function callBack(arr: MutationRecord[], observer: MutationObserver){\n                adapter.notifyDataSetChanged();\n            }\n            let observer:MutationObserver = new MutationObserver(callBack);\n            observer.observe(this.bindElementData, {childList:true});\n        }\n\n\n        getItemViewType(position:number):number {\n            return AdapterView.ITEM_VIEW_TYPE_IGNORE;\n        }\n\n        getView(position:number, convertView:View, parent:ViewGroup):View{\n            let element = this.getItem(position);\n            let view:View = element[View.AndroidViewProperty];\n            this.checkReplaceWithRef(element);\n            if(!view){\n                view = View.inflate(this.mContext, <HTMLElement>element);\n                element[View.AndroidViewProperty] = view;\n            }\n            return view;\n        }\n\n        getCount():number{\n            return this.bindElementData.children.length;\n        }\n\n        getItem(position:number):Element{\n            let element = this.bindElementData.children[position];\n            if(element.tagName === HtmlDataListAdapter.RefElementTag){\n                element = element[HtmlDataListAdapter.RefElementProperty];\n                if(!element) throw Error('Reference element is '+element);\n            }\n            return element;\n        }\n\n        /**\n         * create a ref element replace the element\n         * @param element\n         * @return ref element\n         */\n        private checkReplaceWithRef(element):HTMLElement {\n            let refElement = element[HtmlDataListAdapter.RefElementProperty] || document.createElement(HtmlDataListAdapter.RefElementTag);\n            refElement[HtmlDataListAdapter.RefElementProperty] = element;\n            element[HtmlDataListAdapter.RefElementProperty] = refElement;\n            if(element.parentNode === this.bindElementData) {\n                this.bindElementData.insertBefore(refElement, element);\n                this.bindElementData.removeChild(element);\n            }\n            return refElement;\n        }\n\n        private removeElementRefAndRestoreToAdapter(childElement:Element){\n            if(childElement.tagName === HtmlDataListAdapter.RefElementTag){\n                let element = childElement[HtmlDataListAdapter.RefElementProperty];\n                this.bindElementData.insertBefore(element, childElement);\n                this.bindElementData.removeChild(childElement);\n            }\n        }\n\n        /**\n         * restore real element to ref element, so the bindElement's children was origin children\n         */\n        notifyDataSizeWillChange(){\n            for(let i = 0, count=this.bindElementData.children.length; i<count; i++){\n                this.removeElementRefAndRestoreToAdapter(this.bindElementData.children[i]);\n            }\n            this.notifyDataSetChanged();\n        }\n\n\n        getItemId(position:number):number {\n            let id:string = this.getItem(position).id;\n            let idNumber = Number.parseInt(id);\n            if(Number.isInteger(idNumber)) return idNumber;\n            return -1;\n        }\n\n    }\n}"
  },
  {
    "path": "src/androidui/widget/HtmlDataPagerAdapter.ts",
    "content": "/**\n * Created by linfaxin on 15/11/16.\n */\n\n///<reference path=\"../../android/database/DataSetObservable.ts\"/>\n///<reference path=\"../../android/database/Observable.ts\"/>\n///<reference path=\"../../android/database/DataSetObserver.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/support/v4/view/ViewPager.ts\"/>\n///<reference path=\"../../android/support/v4/view/PagerAdapter.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n\nmodule androidui.widget{\n\n    import Observable = android.database.Observable;\n    import DataSetObservable = android.database.DataSetObservable;\n    import DataSetObserver = android.database.DataSetObserver;\n    import ViewGroup = android.view.ViewGroup;\n    import View = android.view.View;\n    import ViewPager = android.support.v4.view.ViewPager;\n    import PagerAdapter = android.support.v4.view.PagerAdapter;\n    import Context = android.content.Context;\n\n    export class HtmlDataPagerAdapter extends PagerAdapter implements HtmlDataAdapter{\n        static RefElementTag = \"ref-element\".toUpperCase();\n        static RefElementProperty = \"RefElement\";\n        static BindAdapterProperty = \"BindAdapter\";\n        bindElementData:HTMLElement;\n        mContext:Context;\n\n        onInflateAdapter(bindElement:HTMLElement, context?:Context, parent?:android.view.ViewGroup):void {\n            this.bindElementData = bindElement;\n            this.mContext = context;\n            if(parent instanceof ViewPager){\n                parent.setAdapter(this);\n            }\n            bindElement[HtmlDataPagerAdapter.BindAdapterProperty] = this;\n            this.registerHtmlDataObserver();\n        }\n\n        private registerHtmlDataObserver(){\n            if(!window['MutationObserver']) return;\n            const adapter = this;\n            function callBack(arr: MutationRecord[], observer: MutationObserver){\n                adapter.notifyDataSetChanged();\n            }\n            let observer:MutationObserver = new MutationObserver(callBack);\n            observer.observe(this.bindElementData, {childList:true});\n        }\n\n\n        getCount():number {\n            return this.bindElementData.children.length;\n        }\n\n        instantiateItem(container:android.view.ViewGroup, position:number):any {\n            let element = this.getItem(position);\n            let view:View = element[View.AndroidViewProperty];\n            this.checkReplaceWithRef(element);\n            if(!view){\n                view = View.inflate(this.mContext, <HTMLElement>element);\n                element[View.AndroidViewProperty] = view;\n            }\n            container.addView(view);\n            return view;\n        }\n\n        getItem(position:number):Element{\n            let element = this.bindElementData.children[position];\n            if(element.tagName === HtmlDataPagerAdapter.RefElementTag){\n                element = element[HtmlDataPagerAdapter.RefElementProperty];\n                if(!element) throw Error('Reference element is '+element);\n            }\n            return element;\n        }\n\n        /**\n         * create a ref element replace the element\n         * @param element\n         * @return ref element\n         */\n        private checkReplaceWithRef(element):HTMLElement {\n            let refElement = element[HtmlDataPagerAdapter.RefElementProperty] || document.createElement(HtmlDataPagerAdapter.RefElementTag);\n            refElement[HtmlDataPagerAdapter.RefElementProperty] = element;\n            element[HtmlDataPagerAdapter.RefElementProperty] = refElement;\n            if(element.parentNode === this.bindElementData) {\n                this.bindElementData.insertBefore(refElement, element);\n                this.bindElementData.removeChild(element);\n            }\n            return refElement;\n        }\n\n        private removeElementRefAndRestoreToAdapter(childElement:Element){\n            if(childElement.tagName === HtmlDataPagerAdapter.RefElementTag){\n                let element = childElement[HtmlDataPagerAdapter.RefElementProperty];\n                this.bindElementData.insertBefore(element, childElement);\n                this.bindElementData.removeChild(childElement);\n            }\n        }\n\n        /**\n         * restore real element to ref element, so the bindElement's children was origin children\n         */\n        notifyDataSizeWillChange(){\n            for(let i = 0, count=this.bindElementData.children.length; i<count; i++){\n                this.removeElementRefAndRestoreToAdapter(this.bindElementData.children[i]);\n            }\n            this.notifyDataSetChanged();\n        }\n\n        destroyItem(container:android.view.ViewGroup, position:number, object:any):void {\n            let view = <View>object;\n            container.removeView(view);\n        }\n\n        isViewFromObject(view:android.view.View, object:any):boolean {\n            return view === object;\n        }\n\n        getItemPosition(object:any):number {\n            let position = PagerAdapter.POSITION_NONE;\n            if(object==null) return position;\n            for(let i=0, count = this.getCount(); i<count; i++){\n                if(object === this.getItem(i)[View.AndroidViewProperty]){\n                    position = i;\n                    break;\n                }\n            }\n            return position;\n        }\n    }\n}"
  },
  {
    "path": "src/androidui/widget/HtmlDataPickerAdapter.ts",
    "content": "/**\n * Created by linfaxin on 15/11/16.\n */\n\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/widget/NumberPicker.ts\"/>\n///<reference path=\"../../android/content/Context.ts\"/>\n\nmodule androidui.widget{\n\n    import ViewGroup = android.view.ViewGroup;\n    import View = android.view.View;\n    import NumberPicker = android.widget.NumberPicker;\n    import Context = android.content.Context;\n\n\n    export class HtmlDataPickerAdapter implements HtmlDataAdapter{\n        bindElementData:HTMLElement;\n\n        onInflateAdapter(bindElement:HTMLElement, context?:Context, parent?:android.view.ViewGroup):void {\n            this.bindElementData = bindElement;\n            if(parent instanceof NumberPicker){\n                if(!window['MutationObserver']) return;\n                const callBack = (arr: MutationRecord[], observer: MutationObserver)=>{\n                    const values = [];\n                    for(let child of Array.from(this.bindElementData.children)){\n                         values.push((<HTMLElement>child).innerText);\n                    }\n                    parent.setDisplayedValues(values);\n                };\n                callBack.call(this);\n\n                let observer:MutationObserver = new MutationObserver(callBack);\n                observer.observe(this.bindElementData, {childList:true});\n            }\n        }\n\n\n    }\n}"
  },
  {
    "path": "src/androidui/widget/HtmlImageView.ts",
    "content": "/**\n * Created by linfaxin on 15/11/7.\n */\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/widget/ImageView.ts\"/>\n///<reference path=\"HtmlBaseView.ts\"/>\n\nmodule androidui.widget{\n    import View = android.view.View;\n    import MeasureSpec = View.MeasureSpec;\n    import AttrBinder = androidui.attr.AttrBinder;\n\n    /**\n     * use a img element draw Image. It's better to use {@see ImageView} draw image on Canvas.\n     */\n    export class HtmlImageView extends HtmlBaseView {\n        private mScaleType:android.widget.ImageView.ScaleType;\n        private mHaveFrame = false;\n        private mAdjustViewBounds = false;\n        private mMaxWidth = Number.MAX_SAFE_INTEGER;\n        private mMaxHeight = Number.MAX_SAFE_INTEGER;\n\n        private mAlpha = 255;\n\n        private mDrawableWidth:number = 0;\n        private mDrawableHeight:number = 0;\n        private mAdjustViewBoundsCompat = false;\n\n        private mImgElement:HTMLImageElement;\n\n        constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n            super(context, bindElement, defStyle);\n            this.initImageView();\n\n            const a = context.obtainStyledAttributes(bindElement, defStyle);\n            const src = a.getString('src');\n            if (src) {\n                this.setImageURI(src);\n            }\n            this.setAdjustViewBounds(a.getBoolean('adjustViewBounds', false));\n            this.setMaxWidth(a.getDimensionPixelSize('maxWidth', this.mMaxWidth));\n            this.setMaxHeight(a.getDimensionPixelSize('maxHeight', this.mMaxHeight));\n            this.setScaleType(android.widget.ImageView.parseScaleType(a.getAttrValue('scaleType'), this.mScaleType));\n            this.setImageAlpha(a.getInt('drawableAlpha', this.mAlpha));\n        }\n\n        protected createClassAttrBinder(): androidui.attr.AttrBinder.ClassBinderMap {\n            return super.createClassAttrBinder().set('src', {\n                setter(v:HtmlImageView, value:any, attrBinder:AttrBinder) {\n                    v.setImageURI(value);\n                }, getter(v:HtmlImageView) {\n                    return v.mImgElement.src;\n                }\n            }).set('adjustViewBounds', {\n                setter(v:HtmlImageView, value:any, attrBinder:AttrBinder) {\n                    v.setAdjustViewBounds(attrBinder.parseBoolean(value, false));\n                }, getter(v:HtmlImageView) {\n                    return v.getAdjustViewBounds();\n                }\n            }).set('maxWidth', {\n                setter(v:HtmlImageView, value:any, attrBinder:AttrBinder) {\n                    v.setMaxWidth(attrBinder.parseNumberPixelSize(value, v.mMaxWidth));\n                }, getter(v:HtmlImageView) {\n                    return v.mMaxWidth;\n                }\n            }).set('maxHeight', {\n                setter(v:HtmlImageView, value:any, attrBinder:AttrBinder) {\n                    v.setMaxHeight(attrBinder.parseNumberPixelSize(value, v.mMaxHeight));\n                }, getter(v:HtmlImageView) {\n                    return v.mMaxHeight;\n                }\n            }).set('scaleType', {\n                setter(v:HtmlImageView, value:any, attrBinder:AttrBinder) {\n                    if (typeof value === 'number') {\n                        v.setScaleType(value);\n                    } else {\n                        v.setScaleType(android.widget.ImageView.parseScaleType(value, v.mScaleType));\n                    }\n                }, getter(v:HtmlImageView) {\n                    return v.mScaleType;\n                }\n            }).set('drawableAlpha', {\n                setter(v: HtmlImageView, value: any, attrBinder:AttrBinder) {\n                    v.setImageAlpha(attrBinder.parseInt(value, v.mAlpha));\n                }, getter(v: HtmlImageView) {\n                    return v.mAlpha;\n                }\n            });\n        }\n\n        private initImageView(){\n            this.mScaleType  = android.widget.ImageView.ScaleType.FIT_CENTER;\n\n            this.mImgElement = document.createElement('img');\n            this.mImgElement.style.position = \"absolute\";\n\n            this.mImgElement.onload = (()=>{\n                this.mImgElement.style.left = 0+'px';\n                this.mImgElement.style.top = 0+'px';\n                this.mImgElement.style.width = '';\n                this.mImgElement.style.height = '';\n                this.mDrawableWidth = this.mImgElement.width;\n                this.mDrawableHeight = this.mImgElement.height;\n                this.mImgElement.style.display = 'none';\n                this.mImgElement.style.opacity = '';\n                this.requestLayout();\n            });\n\n            this.bindElement.appendChild(this.mImgElement);\n        }\n\n        getAdjustViewBounds():boolean {\n            return this.mAdjustViewBounds;\n        }\n\n        setAdjustViewBounds(adjustViewBounds:boolean) {\n            this.mAdjustViewBounds = adjustViewBounds;\n            if (adjustViewBounds) {\n                this.setScaleType(android.widget.ImageView.ScaleType.FIT_CENTER);\n            }\n        }\n\n        getMaxWidth():number {\n            return this.mMaxWidth;\n        }\n        setMaxWidth(maxWidth:number) {\n            this.mMaxWidth = maxWidth;\n        }\n        getMaxHeight():number {\n            return this.mMaxHeight;\n        }\n        setMaxHeight(maxHeight:number) {\n            this.mMaxHeight = maxHeight;\n        }\n        setImageURI(uri:string){\n            this.mDrawableWidth = -1;\n            this.mDrawableHeight = -1;\n            this.mImgElement.style.opacity = '0';\n            this.mImgElement.src = uri;\n        }\n        setScaleType(scaleType:android.widget.ImageView.ScaleType) {\n            if (scaleType == null) {\n                throw new Error('NullPointerException');\n            }\n\n            if (this.mScaleType != scaleType) {\n                this.mScaleType = scaleType;\n\n                this.setWillNotCacheDrawing(scaleType == android.widget.ImageView.ScaleType.CENTER);\n\n                this.requestLayout();\n                this.invalidate();\n            }\n        }\n\n        getScaleType():android.widget.ImageView.ScaleType {\n            return this.mScaleType;\n        }\n\n\n        protected onMeasure(widthMeasureSpec, heightMeasureSpec):void {\n            let w:number;\n            let h:number;\n\n            // Desired aspect ratio of the view's contents (not including padding)\n            let desiredAspect = 0.0;\n\n            // We are allowed to change the view's width\n            let resizeWidth = false;\n\n            // We are allowed to change the view's height\n            let resizeHeight = false;\n\n            const widthSpecMode = MeasureSpec.getMode(widthMeasureSpec);\n            const heightSpecMode = MeasureSpec.getMode(heightMeasureSpec);\n\n            if(!this.mImgElement.src || !this.mImgElement.complete){\n                // If no drawable, its intrinsic size is 0.\n                this.mDrawableWidth = -1;\n                this.mDrawableHeight = -1;\n                w = h = 0;\n            }else{\n                w = this.mDrawableWidth;\n                h = this.mDrawableHeight;\n                if (w <= 0) w = 1;\n                if (h <= 0) h = 1;\n\n                // We are supposed to adjust view bounds to match the aspect\n                // ratio of our drawable. See if that is possible.\n                if (this.mAdjustViewBounds) {\n                    resizeWidth = widthSpecMode != MeasureSpec.EXACTLY;\n                    resizeHeight = heightSpecMode != MeasureSpec.EXACTLY;\n\n                    desiredAspect = w / h;\n                }\n            }\n\n            let pleft = this.mPaddingLeft;\n            let pright = this.mPaddingRight;\n            let ptop = this.mPaddingTop;\n            let pbottom = this.mPaddingBottom;\n\n            let widthSize:number;\n            let heightSize:number;\n\n            if (resizeWidth || resizeHeight) {\n                /* If we get here, it means we want to resize to match the\n                 drawables aspect ratio, and we have the freedom to change at\n                 least one dimension.\n                 */\n\n                // Get the max possible width given our constraints\n                widthSize = this.resolveAdjustedSize(w + pleft + pright, this.mMaxWidth, widthMeasureSpec);\n\n                // Get the max possible height given our constraints\n                heightSize = this.resolveAdjustedSize(h + ptop + pbottom, this.mMaxHeight, heightMeasureSpec);\n\n                if (desiredAspect != 0) {\n                    // See what our actual aspect ratio is\n                    let actualAspect = (widthSize - pleft - pright) / (heightSize - ptop - pbottom);\n\n                    if (Math.abs(actualAspect - desiredAspect) > 0.0000001) {\n\n                        let done = false;\n\n                        // Try adjusting width to be proportional to height\n                        if (resizeWidth) {\n                            let newWidth = Math.floor(desiredAspect * (heightSize - ptop - pbottom)) +\n                                pleft + pright;\n\n                            // Allow the width to outgrow its original estimate if height is fixed.\n                            if (!resizeHeight && !this.mAdjustViewBoundsCompat) {\n                                widthSize = this.resolveAdjustedSize(newWidth, this.mMaxWidth, widthMeasureSpec);\n                            }\n\n                            if (newWidth <= widthSize) {\n                                widthSize = newWidth;\n                                done = true;\n                            }\n                        }\n\n                        // Try adjusting height to be proportional to width\n                        if (!done && resizeHeight) {\n                            let newHeight = Math.floor((widthSize - pleft - pright) / desiredAspect) +\n                                ptop + pbottom;\n\n                            // Allow the height to outgrow its original estimate if width is fixed.\n                            if (!resizeWidth && !this.mAdjustViewBoundsCompat) {\n                                heightSize = this.resolveAdjustedSize(newHeight, this.mMaxHeight,\n                                    heightMeasureSpec);\n                            }\n\n                            if (newHeight <= heightSize) {\n                                heightSize = newHeight;\n                            }\n                        }\n                    }\n                }\n            } else {\n                /* We are either don't want to preserve the drawables aspect ratio,\n                 or we are not allowed to change view dimensions. Just measure in\n                 the normal way.\n                 */\n                w += pleft + pright;\n                h += ptop + pbottom;\n\n                w = Math.max(w, this.getSuggestedMinimumWidth());\n                h = Math.max(h, this.getSuggestedMinimumHeight());\n\n                widthSize = HtmlImageView.resolveSizeAndState(w, widthMeasureSpec, 0);\n                heightSize = HtmlImageView.resolveSizeAndState(h, heightMeasureSpec, 0);\n            }\n\n            this.setMeasuredDimension(widthSize, heightSize);\n        }\n\n        private resolveAdjustedSize(desiredSize:number, maxSize:number, measureSpec:number):number {\n            let result = desiredSize;\n            let specMode = MeasureSpec.getMode(measureSpec);\n            let specSize =  MeasureSpec.getSize(measureSpec);\n            switch (specMode) {\n                case MeasureSpec.UNSPECIFIED:\n                    /* Parent says we can be as big as we want. Just don't be larger\n                     than max size imposed on ourselves.\n                     */\n                    result = Math.min(desiredSize, maxSize);\n                    break;\n                case MeasureSpec.AT_MOST:\n                    // Parent says we can be as big as we want, up to specSize.\n                    // Don't be larger than specSize, and don't be larger than\n                    // the max size imposed on ourselves.\n                    result = Math.min(Math.min(desiredSize, specSize), maxSize);\n                    break;\n                case MeasureSpec.EXACTLY:\n                    // No choice. Do what we are told.\n                    result = specSize;\n                    break;\n            }\n            return result;\n        }\n\n        protected setFrame(left:number, top:number, right:number, bottom:number):boolean {\n            let changed = super.setFrame(left, top, right, bottom);\n            this.mHaveFrame = true;\n            this.configureBounds();\n            this.mImgElement.style.display = '';\n            return changed;\n        }\n\n        private configureBounds() {\n\n            let dwidth = this.mDrawableWidth;\n            let dheight = this.mDrawableHeight;\n\n            let vwidth = this.getWidth() - this.mPaddingLeft - this.mPaddingRight;\n            let vheight = this.getHeight() - this.mPaddingTop - this.mPaddingBottom;\n\n            let fits = (dwidth < 0 || vwidth == dwidth) && (dheight < 0 || vheight == dheight);\n\n            this.mImgElement.style.left = 0+'px';\n            this.mImgElement.style.top = 0+'px';\n            this.mImgElement.style.width = '';\n            this.mImgElement.style.height = '';\n            if (dwidth <= 0 || dheight <= 0) {\n                /* If the drawable has no intrinsic size, or we're told to\n                 scaletofit, then we just fill our entire view.\n                 */\n                return;\n            }\n            if(this.mScaleType === android.widget.ImageView.ScaleType.FIT_XY){\n                this.mImgElement.style.width = vwidth+'px';\n                this.mImgElement.style.height = vheight+'px';\n                return;\n            }\n            // We need to do the scaling ourself, so have the drawable\n            // use its native size.\n            this.mImgElement.style.width = dwidth+'px';\n            this.mImgElement.style.height = dheight+'px';\n\n            if (android.widget.ImageView.ScaleType.MATRIX === this.mScaleType) {\n                //nothing : MATRIX is not support\n\n            }else if (fits) {\n                // The bitmap fits exactly, no transform needed.\n\n            } else if (android.widget.ImageView.ScaleType.CENTER === this.mScaleType) {\n                // Center bitmap in view, no scaling.\n                let left = Math.round((vwidth - dwidth) * 0.5);\n                let top = Math.round((vheight - dheight) * 0.5);\n                this.mImgElement.style.left = left+'px';\n                this.mImgElement.style.top = top+'px';\n\n            } else if (android.widget.ImageView.ScaleType.CENTER_CROP === this.mScaleType) {\n\n                let scale;\n                let dx = 0, dy = 0;\n\n                if (dwidth * vheight > vwidth * dheight) {\n                    scale = vheight / dheight;\n                    dx = (vwidth - dwidth * scale) * 0.5;\n                    this.mImgElement.style.width = 'auto';\n                    this.mImgElement.style.height = vheight+'px';\n                    this.mImgElement.style.left = Math.round(dx)+'px';\n                    this.mImgElement.style.top = '0px';\n                } else {\n                    scale = vwidth / dwidth;\n                    dy = (vheight - dheight * scale) * 0.5;\n                    this.mImgElement.style.width = vwidth+'px';\n                    this.mImgElement.style.height = 'auto';\n                    this.mImgElement.style.left = '0px';\n                    this.mImgElement.style.top = Math.round(dy)+'px';\n                }\n\n            } else if (android.widget.ImageView.ScaleType.CENTER_INSIDE === this.mScaleType) {\n                let scale = 1;\n                if (dwidth <= vwidth && dheight <= vheight) {\n                    //small nothing\n                } else {\n                    let wScale = vwidth / dwidth;\n                    let hScale = vheight / dheight;\n                    if(wScale < hScale){\n                        this.mImgElement.style.width = vwidth+'px';\n                        this.mImgElement.style.height = 'auto';\n                    }else{\n                        this.mImgElement.style.width = 'auto';\n                        this.mImgElement.style.height = vheight+'px';\n                    }\n                    scale = Math.min(wScale, hScale);\n                }\n                let dx = Math.round((vwidth - dwidth * scale) * 0.5);\n                let dy = Math.round((vheight - dheight * scale) * 0.5);\n                this.mImgElement.style.left = dx + 'px';\n                this.mImgElement.style.top = dy+'px';\n\n\n            } else {\n\n                let wScale = vwidth / dwidth;\n                let hScale = vheight / dheight;\n                if(wScale < hScale){\n                    this.mImgElement.style.width = vwidth+'px';\n                    this.mImgElement.style.height = 'auto';\n                }else{\n                    this.mImgElement.style.width = 'auto';\n                    this.mImgElement.style.height = vheight+'px';\n                }\n                let scale = Math.min(wScale, hScale);\n                if (android.widget.ImageView.ScaleType.FIT_CENTER === this.mScaleType) {\n                    let dx = Math.round((vwidth - dwidth * scale) * 0.5);\n                    let dy = Math.round((vheight - dheight * scale) * 0.5);\n                    this.mImgElement.style.left = dx + 'px';\n                    this.mImgElement.style.top = dy+'px';\n\n                }else if (android.widget.ImageView.ScaleType.FIT_END === this.mScaleType) {\n                    let dx = Math.round((vwidth - dwidth * scale));\n                    let dy = Math.round((vheight - dheight * scale));\n                    this.mImgElement.style.left = dx + 'px';\n                    this.mImgElement.style.top = dy+'px';\n\n                }else if (android.widget.ImageView.ScaleType.FIT_START === this.mScaleType) {\n                    //default is fit start\n                }\n\n            }\n        }\n\n        getImageAlpha():number {\n            return this.mAlpha;\n        }\n        setImageAlpha(alpha:number) {\n            this.setAlpha(alpha);\n        }\n\n    }\n\n}"
  },
  {
    "path": "src/androidui/widget/HtmlView.ts",
    "content": "/**\n * Created by linfaxin on 15/10/26.\n */\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/content/res/Resources.ts\"/>\n///<reference path=\"../../android/graphics/Color.ts\"/>\n///<reference path=\"../../android/content/res/ColorStateList.ts\"/>\n///<reference path=\"../../android/util/TypedValue.ts\"/>\n///<reference path=\"../../android/R/attr.ts\"/>\n///<reference path=\"../../androidui/AndroidUI.ts\"/>\n///<reference path=\"HtmlBaseView.ts\"/>\n\nmodule androidui.widget {\n    import View = android.view.View;\n    import Gravity = android.view.Gravity;\n    import Resources = android.content.res.Resources;\n    import Color = android.graphics.Color;\n    import ColorStateList = android.content.res.ColorStateList;\n    import MeasureSpec = View.MeasureSpec;\n    import TypedValue = android.util.TypedValue;\n\n    export class HtmlView extends HtmlBaseView {\n\n        constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n            super(context, bindElement, defStyle);\n        }\n\n        protected onMeasure(widthMeasureSpec:any, heightMeasureSpec:any):void {\n            let widthMode = MeasureSpec.getMode(widthMeasureSpec);\n            let heightMode = MeasureSpec.getMode(heightMeasureSpec);\n            let widthSize = MeasureSpec.getSize(widthMeasureSpec);\n            let heightSize = MeasureSpec.getSize(heightMeasureSpec);\n\n            let width:number, height:number;\n            const density = this.getResources().getDisplayMetrics().density;\n\n            if (widthMode == MeasureSpec.EXACTLY) {\n                // Parent has told us how big to be. So be it.\n                width = widthSize;\n\n            } else {\n                let sWidth = this.bindElement.style.width, sLeft = this.bindElement.style.left;\n                this.bindElement.style.width = '';\n                this.bindElement.style.left = '';\n                width = this.bindElement.offsetWidth * density + 2;//more space (some case may wrap word)\n\n                this.bindElement.style.width = sWidth;\n                this.bindElement.style.left = sLeft;\n\n                // Check against our minimum width\n                width = Math.max(width, this.getSuggestedMinimumWidth());\n\n                if (widthMode == MeasureSpec.AT_MOST) {\n                    width = Math.min(widthSize, width);\n                }\n            }\n\n\n            if (heightMode == MeasureSpec.EXACTLY) {\n                // Parent has told us how big to be. So be it.\n                height = heightSize;\n\n            } else {\n                let sWidth = this.bindElement.style.width;\n                this.bindElement.style.width = width / density + \"px\";\n                this.bindElement.style.height = '';\n                height = this.bindElement.offsetHeight * density;\n\n                this.bindElement.style.width = sWidth;\n\n                // Check against our minimum height\n                height = Math.max(height, this.getSuggestedMinimumHeight());\n\n                if (heightMode == MeasureSpec.AT_MOST) {\n                    height = Math.min(height, heightSize);\n                }\n            }\n\n            this.setMeasuredDimension(width, height);\n        }\n\n        setHtml(html:string) {\n            this.bindElement.innerHTML = html;\n            this.requestLayout();\n        }\n\n        getHtml():string {\n            return this.bindElement.innerHTML;\n        }\n\n    }\n\n}"
  },
  {
    "path": "src/androidui/widget/OverScrollLocker.ts",
    "content": "/**\n * Created by linfaxin on 15/11/21.\n */\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../android/widget/FrameLayout.ts\"/>\n///<reference path=\"../../android/widget/AbsListView.ts\"/>\n///<reference path=\"../../android/widget/ScrollView.ts\"/>\n///<reference path=\"../../android/widget/OverScroller.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\nmodule androidui.widget {\n    import View = android.view.View;\n    import Gravity = android.view.Gravity;\n    import ViewGroup = android.view.ViewGroup;\n    import MotionEvent = android.view.MotionEvent;\n    import FrameLayout = android.widget.FrameLayout;\n    import AbsListView = android.widget.AbsListView;\n    import ScrollView = android.widget.ScrollView;\n    import OverScroller = android.widget.OverScroller;\n    import Integer = java.lang.Integer;\n    export interface OverScrollLocker {\n        lockOverScrollTop(lockTop:number):void;\n        lockOverScrollBottom(lockBottom:number):void;\n        getScrollContentBottom():number;\n    }\n\n    export module OverScrollLocker{\n        const InstanceMap = new WeakMap<View, OverScrollLocker>();\n        export function getFrom(view:View):OverScrollLocker {\n            let scrollLocker = InstanceMap.get(view);\n            if(!scrollLocker){\n                if(view instanceof AbsListView){\n                    scrollLocker = new ListViewOverScrollLocker(view);\n                }else if(view instanceof ScrollView){\n                    scrollLocker = new ScrollViewScrollLocker(view);\n                }\n                if(scrollLocker) InstanceMap.set(view, scrollLocker);\n            }\n            return scrollLocker;\n        }\n\n        abstract class BaseOverScrollLocker implements OverScrollLocker{\n            lockTop:number;\n            lockBottom:number;\n            isInTouch:boolean;\n            view:View;\n            constructor(view:View){\n                this.view = view;\n\n                const onTouchEventFunc = view.onTouchEvent;\n                view.onTouchEvent = (event:MotionEvent):boolean =>{\n                    let result = onTouchEventFunc.call(view, event);\n                    switch (event.getAction()){\n                        case MotionEvent.ACTION_DOWN:\n                        case MotionEvent.ACTION_MOVE:\n                            this.isInTouch = true;\n                            break;\n                        case MotionEvent.ACTION_UP:\n                        case MotionEvent.ACTION_CANCEL:\n                            this.isInTouch = false;\n                            break;\n                    }\n                    return result;\n                }\n            }\n\n            lockOverScrollTop(lockTop:number):void {\n                this.lockTop = lockTop;\n                if(!this.isInTouch && this.getOverScrollY() < -lockTop){\n                    this.springBackToLockTop();\n                }\n            }\n\n            lockOverScrollBottom(lockBottom:number):void {\n                this.lockBottom = lockBottom;\n                if(!this.isInTouch && this.getOverScrollY() > lockBottom){\n                    this.springBackToLockBottom();\n                }\n            }\n            abstract getOverScrollY():number;\n\n            abstract getScrollContentBottom():number;\n\n            abstract springBackToLockTop():void;\n\n            abstract springBackToLockBottom():void;\n\n        }\n\n\n        class ListViewOverScrollLocker extends BaseOverScrollLocker{\n            listView:AbsListView;\n            constructor(listView:AbsListView){\n                super(listView);\n                this.listView = listView;\n                this.configListView();\n            }\n\n            private configListView(){\n                let listView = this.listView;\n                if(!listView.mFlingRunnable) listView.mFlingRunnable = new AbsListView.FlingRunnable(listView);\n                const scroller:OverScroller = listView.mFlingRunnable.mScroller;\n\n                listView.mFlingRunnable.startOverfling = (initialVelocity:number)=>{\n                    scroller.setInterpolator(null);\n                    let minY = Integer.MIN_VALUE, maxY = Integer.MAX_VALUE;\n                    if(listView.mScrollY < 0) minY = -this.lockTop;\n                    else if(listView.mScrollY > 0) maxY = this.lockBottom;\n\n                    scroller.fling(0, listView.mScrollY, 0, initialVelocity, 0, 0, minY, maxY, 0, listView._mOverflingDistance);//listView.getHeight()\n                    listView.mTouchMode = AbsListView.TOUCH_MODE_OVERFLING;\n                    listView.invalidate();\n                    listView.postOnAnimation(listView.mFlingRunnable);\n                };\n\n                const layoutChildrenFunc = listView.layoutChildren;\n                listView.layoutChildren = () => {\n                    const overScrollY = this.getOverScrollY();\n                    layoutChildrenFunc.call(listView);\n                    if(overScrollY!==0){\n                        listView.overScrollBy(0, -overScrollY, 0, listView.mScrollY, 0, 0, 0, listView.mOverscrollDistance, false);\n\n                        const atEdge:boolean = listView.trackMotionScroll(-overScrollY, -overScrollY);\n                        if(atEdge){\n                            listView.overScrollBy(0, overScrollY, 0, listView.mScrollY, 0, 0, 0, listView.mOverscrollDistance, false);\n                        }else{\n                            //listView.mTouchMode = AbsListView.TOUCH_MODE_SCROLL;\n                            listView.mFlingRunnable.mScroller.abortAnimation();\n                        }\n                    }\n                };\n\n                listView.checkOverScrollStartScrollIfNeeded = ():boolean =>{\n                    return listView.mScrollY > this.lockBottom || listView.mScrollY < this.lockTop;\n                };\n\n\n                listView.mFlingRunnable.edgeReached = (delta:number)=>{\n                    let initialVelocity = listView.mFlingRunnable.mScroller.getCurrVelocity();\n                    if(delta>0) initialVelocity = -initialVelocity;\n                    listView.mFlingRunnable.startOverfling(initialVelocity);\n                };\n\n                const oldSpringBack = scroller.springBack;\n                scroller.springBack = (startX:number, startY:number, minX:number, maxX:number, minY:number, maxY:number):boolean=> {\n                    minY = -this.lockTop;\n                    maxY = this.lockBottom;\n                    return oldSpringBack.call(scroller, startX, startY, minX, maxX, minY, maxY);\n                };\n\n                const oldFling = scroller.fling;\n                scroller.fling = (startX:number, startY:number, velocityX:number, velocityY:number,\n                    minX:number, maxX:number, minY:number, maxY:number, overX=0, overY=0):void =>{\n                    if(velocityY>0) overY += this.lockBottom;\n                    else overY += this.lockTop;\n                    oldFling.call(scroller, startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, overX, overY);\n                };\n            }\n\n            getScrollContentBottom():number {\n                let childCount = this.listView.getChildCount();\n                let maxBottom = 0;\n                let minTop = 0;\n                for(let i=0; i<childCount; i++){\n                    let child = this.listView.getChildAt(i);\n                    let childBottom = child.getBottom();\n                    let childTop = child.getTop();\n                    if(childBottom > maxBottom){\n                        maxBottom = childBottom;\n                    }\n                    if(childTop < minTop){\n                        minTop = childTop;\n                    }\n                }\n                if(minTop>0) minTop = 0;\n                if(this.listView.getAdapter() && childCount>0){\n                    return (maxBottom - minTop) * this.listView.getAdapter().getCount() / childCount;\n                }\n                return 0;\n            }\n\n            getOverScrollY():number {\n                return this.listView.mScrollY;\n            }\n\n            private startSpringBack(){\n                this.listView.reportScrollStateChange(AbsListView.OnScrollListener.SCROLL_STATE_FLING);\n                //springBack func has been override, the args will change later\n                this.listView.mFlingRunnable.mScroller.springBack(0, this.listView.mScrollY, 0, 0, 0, 0);\n                this.listView.mTouchMode = AbsListView.TOUCH_MODE_OVERFLING;\n                this.listView.postOnAnimation(this.listView.mFlingRunnable);\n            }\n            springBackToLockTop():void {\n                this.startSpringBack();\n            }\n\n            springBackToLockBottom():void {\n                this.startSpringBack();\n            }\n        }\n\n        class ScrollViewScrollLocker extends BaseOverScrollLocker{\n            scrollView:ScrollView;\n            constructor(scrollView:ScrollView){\n                super(scrollView);\n                this.scrollView = scrollView;\n\n                const scroller = scrollView.mScroller;\n\n\n                const oldSpringBack = scroller.springBack;\n                scroller.springBack = (startX:number, startY:number, minX:number, maxX:number, minY:number, maxY:number):boolean=> {\n                    minY = -this.lockTop;\n                    maxY = this.scrollView.getScrollRange() + this.lockBottom;\n                    return oldSpringBack.call(scroller, startX, startY, minX, maxX, minY, maxY);\n                };\n\n                const oldFling = scroller.fling;\n                scroller.fling = (startX:number, startY:number, velocityX:number, velocityY:number,\n                                  minX:number, maxX:number, minY:number, maxY:number, overX=0, overY=0):void =>{\n                    if(velocityY>0) overY += this.lockBottom;\n                    else overY += this.lockTop;\n                    minY -= this.lockTop;\n                    maxY += this.lockBottom;\n                    oldFling.call(scroller, startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, overX, overY);\n                };\n                this.listenScrollContentHeightChange();\n            }\n\n            private listenScrollContentHeightChange(){\n                const listenHeightChange = (v:View)=>{\n                    const onSizeChangedFunc = v.onSizeChanged;\n                    v.onSizeChanged = (w: number, h: number, oldw: number, oldh: number): void =>{\n                        onSizeChangedFunc.call(v, w, h, oldw, oldh);\n                        //awake the scroll bar & check the footer header position\n                        this.scrollView.overScrollBy(0, 0, 0, this.scrollView.mScrollY, 0,\n                            this.scrollView.getScrollRange(), 0, this.scrollView.mOverscrollDistance, false);\n                    }\n\n                };\n                if(this.scrollView.getChildCount()>0){\n                    listenHeightChange(this.scrollView.getChildAt(0));\n                }else{\n                    const onViewAddedFunc = this.scrollView.onViewAdded;\n                    this.scrollView.onViewAdded = (v:View):void =>{\n                        onViewAddedFunc.call(this.scrollView, v);\n                        listenHeightChange(v);\n                    }\n                }\n            }\n\n            getScrollContentBottom():number {\n                if (this.scrollView.getChildCount() > 0) {\n                    return this.scrollView.getChildAt(0).getBottom();\n                }\n                return this.scrollView.getPaddingTop();\n            }\n\n            getOverScrollY():number {\n                let scrollY = this.scrollView.getScrollY();\n                if(scrollY < 0) return scrollY;\n                let scrollRange = this.scrollView.getScrollRange();\n                if(scrollY > scrollRange){\n                    return scrollY - scrollRange;\n                }\n                return 0;\n            }\n\n            private startSpringBack(){\n                if (this.scrollView.mScroller.springBack(this.scrollView.mScrollX, this.scrollView.mScrollY,\n                        0, 0, 0, this.scrollView.getScrollRange())) {\n                    this.scrollView.postInvalidateOnAnimation();\n                }\n            }\n            springBackToLockTop():void {\n                this.startSpringBack();\n            }\n\n            springBackToLockBottom():void {\n                this.startSpringBack();\n            }\n        }\n    }\n\n\n}"
  },
  {
    "path": "src/androidui/widget/PullRefreshLoadLayout.ts",
    "content": "/**\n * Created by linfaxin on 15/11/19.\n */\n///<reference path=\"../../android/view/View.ts\"/>\n///<reference path=\"../../android/view/Gravity.ts\"/>\n///<reference path=\"../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../android/widget/FrameLayout.ts\"/>\n///<reference path=\"../../android/widget/AbsListView.ts\"/>\n///<reference path=\"../../android/widget/ScrollView.ts\"/>\n///<reference path=\"../../android/widget/OverScroller.ts\"/>\n///<reference path=\"../../android/widget/TextView.ts\"/>\n///<reference path=\"../../android/widget/LinearLayout.ts\"/>\n///<reference path=\"../../android/widget/ProgressBar.ts\"/>\n///<reference path=\"../../android/R/string.ts\"/>\n///<reference path=\"../../java/lang/Integer.ts\"/>\n///<reference path=\"OverScrollLocker.ts\"/>\n\nmodule androidui.widget{\n    import View = android.view.View;\n    import Gravity = android.view.Gravity;\n    import ViewGroup = android.view.ViewGroup;\n    import FrameLayout = android.widget.FrameLayout;\n    import AbsListView = android.widget.AbsListView;\n    import ScrollView = android.widget.ScrollView;\n    import OverScroller = android.widget.OverScroller;\n    import TextView = android.widget.TextView;\n    import LinearLayout = android.widget.LinearLayout;\n    import ProgressBar = android.widget.ProgressBar;\n    import Integer = java.lang.Integer;\n    import R = android.R;\n\n    export class PullRefreshLoadLayout extends FrameLayout{\n        static State_Disable = -1;\n        static State_Header_Normal = 0;\n        static State_Header_Refreshing = 1;\n        static State_Header_ReadyToRefresh = 2;\n        static State_Header_RefreshFail = 3;\n        static State_Footer_Normal = 4;\n        static State_Footer_Loading = 5;\n        static State_Footer_ReadyToLoad = 6;\n        static State_Footer_LoadFail = 7;\n        static State_Footer_NoMoreToLoad = 8;\n        static StateChangeLimit = {\n            [PullRefreshLoadLayout.State_Header_Refreshing] :\n                [PullRefreshLoadLayout.State_Header_ReadyToRefresh, PullRefreshLoadLayout.State_Footer_Loading\n                    , PullRefreshLoadLayout.State_Footer_ReadyToLoad, PullRefreshLoadLayout.State_Footer_LoadFail\n                    , PullRefreshLoadLayout.State_Footer_NoMoreToLoad, ],\n\n            [PullRefreshLoadLayout.State_Header_RefreshFail] :\n                [PullRefreshLoadLayout.State_Header_ReadyToRefresh, PullRefreshLoadLayout.State_Footer_Loading\n                    , PullRefreshLoadLayout.State_Footer_ReadyToLoad, PullRefreshLoadLayout.State_Footer_LoadFail\n                    , PullRefreshLoadLayout.State_Footer_NoMoreToLoad, ],\n            [PullRefreshLoadLayout.State_Footer_Loading] :\n                [PullRefreshLoadLayout.State_Header_ReadyToRefresh, PullRefreshLoadLayout.State_Header_Refreshing\n                    , PullRefreshLoadLayout.State_Footer_ReadyToLoad, PullRefreshLoadLayout.State_Header_RefreshFail],\n            [PullRefreshLoadLayout.State_Footer_NoMoreToLoad] : [PullRefreshLoadLayout.State_Footer_ReadyToLoad]\n        };\n\n\n        private autoLoadScrollAtBottom = true;\n        private headerView:PullRefreshLoadLayout.HeaderView;\n        private footerView:PullRefreshLoadLayout.FooterView;\n        private footerViewReadyDistance = 36 * android.content.res.Resources.getDisplayMetrics().density;\n        private contentView:View;\n        private contentOverY = 0;\n        private overScrollLocker:OverScrollLocker;\n        private refreshLoadListener:PullRefreshLoadLayout.RefreshLoadListener;\n\n        constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n            super(context, bindElement, defStyle);\n\n            const a = context.obtainStyledAttributes(bindElement, defStyle);\n            if (a.getBoolean('refreshEnable', true)) {\n                this.setRefreshEnable(true);\n            }\n            if (a.getBoolean('loadEnable', true)) {\n                this.setLoadEnable(true);\n            }\n            a.recycle();\n        }\n\n        protected onViewAdded(child:View):void {\n            super.onViewAdded(child);\n            if(child instanceof PullRefreshLoadLayout.HeaderView){\n                if(child!=this.headerView) this.setHeaderView(child);\n            } else if (child instanceof PullRefreshLoadLayout.FooterView){\n                if(child!=this.footerView) this.setFooterView(child);\n            } else {\n                if(child!=this.contentView) this.setContentView(child);\n            }\n            if(this.footerView!=null){//foot should be click\n                this.bringChildToFront(this.footerView);\n            }\n        }\n\n        private configHeaderView(){\n            let headerView = this.headerView;\n            let params = <FrameLayout.LayoutParams>headerView.getLayoutParams();\n            params.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;\n            params.height = ViewGroup.LayoutParams.WRAP_CONTENT;\n            params.width = ViewGroup.LayoutParams.MATCH_PARENT;\n            headerView.setLayoutParams(params);\n        }\n        private configFooterView(){\n            let footerView = this.footerView;\n            let params = <FrameLayout.LayoutParams>footerView.getLayoutParams();\n            params.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;\n            params.height = ViewGroup.LayoutParams.WRAP_CONTENT;\n            params.width = ViewGroup.LayoutParams.WRAP_CONTENT;\n            footerView.setLayoutParams(params);\n        }\n        private configContentView(){\n            let contentView = this.contentView;\n            let params = <FrameLayout.LayoutParams>contentView.getLayoutParams();\n            params.height = ViewGroup.LayoutParams.MATCH_PARENT;\n            params.width = ViewGroup.LayoutParams.MATCH_PARENT;\n            contentView.setLayoutParams(params);\n\n            this.overScrollLocker = OverScrollLocker.getFrom(contentView);\n\n            const overScrollByFunc = contentView.overScrollBy;\n            contentView.overScrollBy = (deltaX:number, deltaY:number, scrollX:number, scrollY:number,\n                                        scrollRangeX:number, scrollRangeY:number, maxOverScrollX:number, maxOverScrollY:number,\n                                        isTouchEvent:boolean):boolean =>{\n                let result = overScrollByFunc.call(contentView,\n                    deltaX, deltaY, scrollX, scrollY, scrollRangeX, scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);\n                if(contentView === this.contentView){\n                    this.onContentOverScroll(scrollRangeY, maxOverScrollY, isTouchEvent);\n                }\n                return result;\n            }\n        }\n\n        private onContentOverScroll(scrollRangeY:number, maxOverScrollY:number, isTouchEvent:boolean):void{\n            let newScrollY = this.contentView.mScrollY;\n            const top = 0;\n            const bottom = scrollRangeY;\n\n            if (newScrollY > bottom) {\n                this.contentOverY = newScrollY - bottom;\n            } else if (newScrollY < top) {\n                this.contentOverY = newScrollY - top;\n            }else {\n                this.contentOverY = 0;\n            }\n            this.checkHeaderFooterPosition();\n\n            if(this.headerView){\n                if(this.contentOverY < -this.headerView.getHeight()){\n                    if(isTouchEvent){\n                        this.setHeaderState(PullRefreshLoadLayout.State_Header_ReadyToRefresh);\n                    }else if(this.headerView.state === PullRefreshLoadLayout.State_Header_ReadyToRefresh){\n                        this.setHeaderState(PullRefreshLoadLayout.State_Header_Refreshing);\n                    }\n                }else if(this.headerView.state === PullRefreshLoadLayout.State_Header_ReadyToRefresh){\n                    this.setHeaderState(this.headerView.stateBeforeReady);\n                }\n            }\n            if(this.footerView){\n                const footerState = this.footerView.state;\n                if(this.contentOverY > this.footerView.getHeight() + this.footerViewReadyDistance){\n                    if(isTouchEvent){\n                        this.setFooterState(PullRefreshLoadLayout.State_Footer_ReadyToLoad);\n                    }else if(footerState === PullRefreshLoadLayout.State_Footer_ReadyToLoad){\n                        this.setFooterState(PullRefreshLoadLayout.State_Footer_Loading);\n                    }\n                }else if(footerState === PullRefreshLoadLayout.State_Footer_ReadyToLoad){\n                    this.setFooterState(this.footerView.stateBeforeReady);\n                }\n\n                if(this.contentOverY>0 && this.autoLoadScrollAtBottom\n                    && footerState === PullRefreshLoadLayout.State_Footer_Normal){\n                    this.setFooterState(PullRefreshLoadLayout.State_Footer_Loading);\n                }\n            }\n        }\n\n        setHeaderView(headerView:PullRefreshLoadLayout.HeaderView):void{\n            if(this.headerView){\n                this.removeView(this.headerView);\n            }\n            this.headerView = headerView;\n            if(headerView.getParent()==null) this.addView(headerView);\n            this.configHeaderView();\n        }\n        setFooterView(footerView:PullRefreshLoadLayout.FooterView):void{\n            if(this.footerView){\n                this.removeView(this.footerView);\n            }\n            this.footerView = footerView;\n            if(footerView.getParent()==null) this.addView(footerView);\n            this.configFooterView();\n        }\n        setContentView(contentView:View):void{\n            if(this.contentView){\n                this.removeView(this.contentView);\n            }\n            this.contentView = contentView;\n            if(contentView.getParent()==null) this.addView(contentView);\n            this.configContentView();\n        }\n\n        setHeaderState(newState:number):void {\n            if(!this.headerView) return;\n            if(this.headerView.state === newState) return;\n            const changeLimit:number[] = PullRefreshLoadLayout.StateChangeLimit[this.headerView.state];\n            if (changeLimit && changeLimit.indexOf(newState) !== -1) return;\n            this.headerView.setStateInner(this, newState);\n            this.checkLockOverScroll();\n\n            if(newState === PullRefreshLoadLayout.State_Header_Refreshing && this.refreshLoadListener){\n                this.refreshLoadListener.onRefresh(this);\n            }\n        }\n        getHeaderState():number {\n            if(!this.headerView) return PullRefreshLoadLayout.State_Disable;\n            return this.headerView.state;\n        }\n\n        setFooterState(newState:number):void {\n            if(!this.footerView) return;\n            if(this.footerView.state === newState) return;\n            const changeLimit:number[] = PullRefreshLoadLayout.StateChangeLimit[this.footerView.state];\n            if (changeLimit && changeLimit.indexOf(newState) !== -1) return;\n            this.footerView.setStateInner(this, newState);\n            this.checkLockOverScroll();\n\n            if(newState === PullRefreshLoadLayout.State_Footer_Loading && this.refreshLoadListener){\n                this.refreshLoadListener.onLoadMore(this);\n            }\n        }\n        getFooterState():number {\n            if(!this.footerView) return PullRefreshLoadLayout.State_Disable;\n            return this.footerView.state;\n        }\n\n\n        private checkLockOverScroll(){\n            if(!this.overScrollLocker) return;\n            if(this.headerView) {\n                switch (this.headerView.state) {\n                    case PullRefreshLoadLayout.State_Header_Normal :\n                        this.overScrollLocker.lockOverScrollTop(0);\n                        break;\n                    case PullRefreshLoadLayout.State_Header_Refreshing :\n                        this.overScrollLocker.lockOverScrollTop(this.headerView.getHeight());\n                        break;\n                    case PullRefreshLoadLayout.State_Header_ReadyToRefresh :\n                        this.overScrollLocker.lockOverScrollTop(this.headerView.getHeight());\n                        break;\n                    case PullRefreshLoadLayout.State_Header_RefreshFail :\n                        this.overScrollLocker.lockOverScrollTop(this.headerView.getHeight());\n                        break;\n                }\n            }else{\n                this.overScrollLocker.lockOverScrollTop(0);\n            }\n            this.overScrollLocker.lockOverScrollBottom(this.footerView ? this.footerView.getHeight() : 0);\n        }\n\n        private checkHeaderFooterPosition(){\n            if(this.contentOverY>0){\n                this.setHeaderViewAppearDistance(0);\n                this.setFooterViewAppearDistance(this.contentOverY);\n\n            }else if(this.contentOverY<0){\n                this.setHeaderViewAppearDistance(-this.contentOverY);\n                this.setFooterViewAppearDistance(0);\n\n            }else {\n                this.setHeaderViewAppearDistance(0);\n                this.setFooterViewAppearDistance(0);\n            }\n        }\n\n        private setHeaderViewAppearDistance(distance:number){\n            if(!this.headerView) return;\n            let offset = -this.headerView.getHeight() - this.headerView.getTop() + distance;\n            this.headerView.offsetTopAndBottom(offset);\n        }\n\n        private setFooterViewAppearDistance(distance:number){\n            if(!this.contentView || !this.footerView) return;\n            let bottomToParentBottom = Math.min(this.overScrollLocker.getScrollContentBottom(),this.contentView.getHeight()) - this.footerView.getBottom();\n            if(this.contentOverY<0) bottomToParentBottom -= this.contentOverY;\n            let offset = this.footerView.getHeight() + bottomToParentBottom - distance;\n            this.footerView.offsetTopAndBottom(offset);\n        }\n\n\n        protected onLayout(changed:boolean, left:number, top:number, right:number, bottom:number):void {\n            super.onLayout(changed, left, top, right, bottom);\n            this.checkHeaderFooterPosition();\n            this.checkLockOverScroll();\n\n            if(!this.isLaidOut()){//first layout after attach window\n                //check if start Load when init\n                if(this.autoLoadScrollAtBottom && this.footerView!=null\n                    && this.footerView.getGlobalVisibleRect(new android.graphics.Rect())){\n                    this.setFooterState(PullRefreshLoadLayout.State_Footer_Loading);\n                }\n            }\n        }\n\n        setAutoLoadMoreWhenScrollBottom(autoLoad:boolean):void {\n            this.autoLoadScrollAtBottom = autoLoad;\n        }\n\n        setRefreshEnable(enable:boolean):void {\n            const oldEnable = this.headerView!=null;\n            if(enable === oldEnable) return;\n            if(!enable){\n                this.removeView(this.headerView);\n                this.headerView = null;\n                if(this.overScrollLocker) this.overScrollLocker.lockOverScrollTop(0);\n            }else{\n                this.setHeaderView(new PullRefreshLoadLayout.DefaultHeaderView(this.getContext()));\n            }\n        }\n        setLoadEnable(enable:boolean):void {\n            const oldEnable = this.footerView!=null;\n            if(enable === oldEnable) return;\n            if(!enable){\n                this.removeView(this.footerView);\n                this.footerView = null;\n                if(this.overScrollLocker) this.overScrollLocker.lockOverScrollBottom(0);\n            }else{\n                this.setFooterView(new PullRefreshLoadLayout.DefaultFooterView(this.getContext()));\n            }\n        }\n\n        setRefreshLoadListener(refreshLoadListener:PullRefreshLoadLayout.RefreshLoadListener){\n            this.refreshLoadListener = refreshLoadListener;\n        }\n\n        startRefresh(){\n            this.setHeaderState(PullRefreshLoadLayout.State_Header_Refreshing);\n        }\n\n        startLoadMore(){\n            this.setFooterState(PullRefreshLoadLayout.State_Footer_Loading);\n        }\n    }\n\n\n    export module PullRefreshLoadLayout{\n        export interface RefreshLoadListener{\n            onRefresh(prll:PullRefreshLoadLayout):void;\n            onLoadMore(prll:PullRefreshLoadLayout):void;\n        }\n\n        export abstract class HeaderView extends FrameLayout{\n            private state:number = PullRefreshLoadLayout.State_Header_Normal;\n            private stateBeforeReady = PullRefreshLoadLayout.State_Header_Normal;\n\n            protected setStateInner(prll:PullRefreshLoadLayout, state:number):void {\n                const oldState = this.state;\n                this.state = state;\n                this.onStateChange(state, oldState);\n\n                const inner_this = this;\n                switch (state){\n                    case PullRefreshLoadLayout.State_Header_RefreshFail :\n                        this.postDelayed({\n                            run(){\n                                if(state === inner_this.state){\n                                    prll.setHeaderState(PullRefreshLoadLayout.State_Header_Normal);\n                                }\n                            }\n                        }, 1000);\n                        break;\n                    case PullRefreshLoadLayout.State_Header_ReadyToRefresh:\n                        this.stateBeforeReady = oldState;\n                        break;\n                }\n            }\n            abstract onStateChange(newState:number, oldState:number):void;\n        }\n        export abstract class FooterView extends FrameLayout{\n            private state:number = PullRefreshLoadLayout.State_Footer_Normal;\n            private stateBeforeReady = PullRefreshLoadLayout.State_Footer_Normal;\n\n            protected setStateInner(prll:PullRefreshLoadLayout, state:number):void {\n                const oldState = this.state;\n                this.state = state;\n                this.onStateChange(state, oldState);\n\n                switch (state){\n                    case PullRefreshLoadLayout.State_Footer_ReadyToLoad:\n                        this.stateBeforeReady = oldState;\n                        break;\n                }\n            }\n            abstract onStateChange(newState:number, oldState:number):void;\n        }\n        export class DefaultHeaderView extends HeaderView{\n            textView:TextView;\n            progressBar:ProgressBar;\n            constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n                super(context, bindElement, defStyle);\n                this.progressBar = new ProgressBar(context);\n                this.progressBar.setVisibility(View.GONE);\n                this.textView = new TextView(context);\n                let density = android.content.res.Resources.getDisplayMetrics().density;\n                const pad = 16 * density;\n                this.textView.setPadding(pad/2, pad, pad/2, pad);\n                this.textView.setGravity(Gravity.CENTER);\n\n                let linear = new LinearLayout(context);\n                linear.addView(this.progressBar, 32 * density, 32 * density);\n                linear.addView(this.textView);\n                linear.setGravity(Gravity.CENTER);\n\n                this.addView(linear, -1, -2);\n                this.onStateChange(PullRefreshLoadLayout.State_Header_Normal, PullRefreshLoadLayout.State_Disable);\n            }\n            onStateChange(newState:number, oldState:number):void{\n                switch (newState){\n                    case PullRefreshLoadLayout.State_Header_Refreshing:\n                        this.textView.setText(R.string_.prll_header_state_loading);\n                        this.progressBar.setVisibility(View.VISIBLE);\n                        break;\n                    case PullRefreshLoadLayout.State_Header_ReadyToRefresh:\n                        this.textView.setText(R.string_.prll_header_state_ready);\n                        this.progressBar.setVisibility(View.GONE);\n                        break;\n                    case PullRefreshLoadLayout.State_Header_RefreshFail:\n                        this.textView.setText(R.string_.prll_header_state_fail);\n                        this.progressBar.setVisibility(View.GONE);\n                        break;\n                    default:\n                        this.textView.setText(R.string_.prll_header_state_normal);\n                        this.progressBar.setVisibility(View.GONE);\n                }\n            }\n        }\n        export class DefaultFooterView extends FooterView{\n            textView:TextView;\n            progressBar:ProgressBar;\n            constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n                super(context, bindElement, defStyle);\n                this.progressBar = new ProgressBar(context);\n                this.progressBar.setVisibility(View.GONE);\n                this.textView = new TextView(context);\n                let density = android.content.res.Resources.getDisplayMetrics().density;\n                const pad = 16 * density;\n                this.textView.setPadding(pad/2, pad, pad/2, pad);\n                this.textView.setGravity(Gravity.CENTER);\n\n                let linear = new LinearLayout(context);\n                linear.addView(this.progressBar);\n                linear.addView(this.textView);\n                linear.setGravity(Gravity.CENTER);\n\n                this.addView(linear, -1, -2);\n                this.onStateChange(PullRefreshLoadLayout.State_Footer_Normal, PullRefreshLoadLayout.State_Disable);\n\n                this.setOnClickListener({\n                    onClick(v:View){\n                        let parent = v.getParent();\n                        if(parent instanceof PullRefreshLoadLayout){\n                            parent.setFooterState(PullRefreshLoadLayout.State_Footer_Loading);\n                        }\n                    }\n                });\n            }\n            onStateChange(newState:number, oldState:number):void{\n                switch (newState){\n                    case PullRefreshLoadLayout.State_Footer_Loading:\n                        this.textView.setText(R.string_.prll_footer_state_loading);\n                        this.progressBar.setVisibility(View.VISIBLE);\n                        break;\n                    case PullRefreshLoadLayout.State_Footer_ReadyToLoad:\n                        this.textView.setText(R.string_.prll_footer_state_ready);\n                        this.progressBar.setVisibility(View.GONE);\n                        break;\n                    case PullRefreshLoadLayout.State_Footer_LoadFail:\n                        this.textView.setText(R.string_.prll_footer_state_fail);\n                        this.progressBar.setVisibility(View.GONE);\n                        break;\n                    case PullRefreshLoadLayout.State_Footer_NoMoreToLoad:\n                        this.textView.setText(R.string_.prll_footer_state_no_more);\n                        this.progressBar.setVisibility(View.GONE);\n                        break;\n                    default:\n                        this.textView.setText(R.string_.prll_footer_state_normal);\n                        this.progressBar.setVisibility(View.GONE);\n                }\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "src/build_sdk_res.js",
    "content": "var fs = require('fs');\nvar jsdom = require('jsdom');\n\nbuildLayout();\nbuildImage();\n\nfunction buildImage(){\n    var path = 'res/image';\n    var dirImageData = {};\n    var ninePatchImages = [];\n\n    var files = fs.readdirSync(path);\n    files.forEach(function(fileName){\n        var splits = fileName.split('.');\n        var nameWithRadio = fileName.split('.')[0];\n\n        var fileSuffixes = splits[splits.length-1];\n        if(fileSuffixes !== 'png' && fileSuffixes !== 'jpg' && fileSuffixes !== 'gif' && fileSuffixes !== 'webp'){\n            return;//not support\n        }\n\n        var name = nameWithRadio;\n        var radio = Number.parseInt(name.split('@').pop()[0]);//..@3x\n        if(Number.isInteger(radio)) name = name.substring(0, name.lastIndexOf('@'));\n        else radio = 1;\n\n        if(fileName.substring(nameWithRadio.length).indexOf('.9.')===0) ninePatchImages.push(name);\n\n        var base64Data = fs.readFileSync(path+'/'+fileName, 'base64');\n        var radioArray = dirImageData[name] || (dirImageData[name]=[]);\n        if(radioArray[radio]){\n            throw Error('already defined a same radio image: ' + fileName);\n        }\n        radioArray[radio] = `data:image/${fileSuffixes};base64,${base64Data}`;\n    });\n\n\n    var exportLines = '';\n    for(var k of Object.keys(dirImageData)){\n        //console.log('export:'+k);\n        exportLines +=\n`        static get ${k}(){\n            return imageCache.${k} || (imageCache.${k}=findRatioImage(data.${k}));\n        }\n`;\n    }\n\n\n    var str =\n        `///<reference path=\"../../androidui/image/NetImage.ts\"/>\nmodule android.R {\n    import NetImage = androidui.image.NetImage;\n\n    //index=ratio, index-0 alway null, index-3 = @x3\n    var data = ${JSON.stringify(dirImageData, null, 8)};\n    var imageCache = {\n        ${Object.keys(dirImageData).join(':null,\\n        ')+':null'}\n    };\n\n    function findRatioImage(array:string[]):NetImage {\n        if(array[window.devicePixelRatio]) return new NetImage(array[window.devicePixelRatio], window.devicePixelRatio);\n        for(let i=array.length; i>=0; i--){\n            if(array[i]){\n                return new NetImage(array[i], i);\n            }\n        }\n        throw Error('Not find radio image. May something error in build.')\n    }\n    export class image_base64{\n${exportLines}\n    }\n}`;\n\n    fs.writeFile('android/R/image_base64.ts', str, 'utf-8');\n\n\n    var exportImage_tsLines = '';\n    for(var k of Object.keys(dirImageData)){\n        if(ninePatchImages.indexOf(k)===-1){\n            exportImage_tsLines += `\n        static get ${k}(){return new NetDrawable(image_base64.${k})}`;\n        }else{\n            exportImage_tsLines += `\n        static get ${k}(){return new NinePatchDrawable(image_base64.${k})}`;\n        }\n    }\n    var image_ts =\n        `///<reference path=\"../../androidui/image/NetDrawable.ts\"/>\n///<reference path=\"../../androidui/image/NinePatchDrawable.ts\"/>\n///<reference path=\"../../androidui/image/ChangeImageSizeDrawable.ts\"/>\n///<reference path=\"image_base64.ts\"/>\nmodule android.R {\n    import NetDrawable = androidui.image.NetDrawable;\n    import ChangeImageSizeDrawable = androidui.image.ChangeImageSizeDrawable;\n    import NinePatchDrawable = androidui.image.NinePatchDrawable;\n\n    const density = android.content.res.Resources.getDisplayMetrics().density;\n    export class image{\n${exportImage_tsLines}\n\n        //scale images\n        static get spinner_48_outer_holo(){ return new ChangeImageSizeDrawable(image.spinner_76_outer_holo, 48 * density, 48 * density)}\n        static get spinner_48_inner_holo(){ return new ChangeImageSizeDrawable(image.spinner_76_inner_holo, 48 * density, 48 * density)}\n        static get spinner_16_outer_holo(){ return new ChangeImageSizeDrawable(image.spinner_76_outer_holo, 16 * density, 16 * density)}\n        static get spinner_16_inner_holo(){ return new ChangeImageSizeDrawable(image.spinner_76_inner_holo, 16 * density, 16 * density)}\n\n        static get rate_star_small_off_holo_light(){ return new ChangeImageSizeDrawable(image.rate_star_big_half_holo_light, 16 * density, 16 * density)}\n        static get rate_star_small_half_holo_light(){ return new ChangeImageSizeDrawable(image.rate_star_big_off_holo_light, 16 * density, 16 * density)}\n        static get rate_star_small_on_holo_light(){ return new ChangeImageSizeDrawable(image.rate_star_big_on_holo_light, 16 * density, 16 * density)}\n    }\n    \n    // load these image when init\n    image_base64.actionbar_ic_back_white;\n    image_base64.btn_default_normal_holo_light;\n    image_base64.dropdown_background_dark;\n    image_base64.editbox_background_normal;\n    image_base64.ic_menu_moreoverflow_normal_holo_dark;\n    image_base64.menu_panel_holo_dark;\n    image_base64.menu_panel_holo_light;\n    image_base64.popup_bottom_bright;\n    image_base64.popup_center_bright;\n    image_base64.popup_full_bright;\n    image_base64.popup_top_bright;\n}`;\n    fs.writeFile('android/R/image.ts', image_ts, 'utf-8');\n}\n\nfunction buildLayout(){\n\n    var definedIds = {};\n\n    function xml2html(html){\n        var doc = jsdom.jsdom(html, {\n            parsingMode : 'xml'\n        });\n        var document = doc.defaultView.document;\n        travelElement(document.documentElement);\n        if(document.documentElement.tagName=='resources') return;\n        return document.documentElement.outerHTML;\n    }\n\n    function travelElement(ele){\n        if(ele){\n            //android:id=\"@+id/xx\" ==> id=\"xx\",\n            var id = ele.getAttribute('android:id') || ele.getAttribute('id');\n            ele.removeAttribute('android:id');\n            if(id){\n                if(id.startsWith('@+id/')) id = id.substring('@+id/'.length);\n                if(id.startsWith('@id/')) id = id.substring('@id/'.length);\n                ele.setAttribute('id', id);\n                definedIds[id] = id;\n            }\n\n            //remove xmlns & xmlns:android, no need when run\n            ele.removeAttribute('xmlns');\n            ele.removeAttribute('xmlns:android');\n\n            for(var child of Array.from(ele.children)){\n                travelElement(child);\n            }\n        }\n    }\n\n    function writeToIdFile(){\n        var str =\n            `module android.R {\n    export const id = ${JSON.stringify(definedIds, null, 8)};\n}`;\n        fs.writeFile('android/R/id.ts', str, 'utf-8');\n    }\n\n\n    var path = 'res/layout';\n    var layoutData = {};\n    var files = fs.readdirSync(path);\n    files.forEach(function(fileName){\n        var splits = fileName.split('.');\n        var fileSuffixes = splits[splits.length-1];\n\n        if(fileSuffixes != 'html' && fileSuffixes != 'xml') return;//must end with '.html/.xml'\n        var html = fs.readFileSync(path+'/'+fileName, 'utf-8');\n        html = xml2html(html);\n        if(!html) return;\n        var name = splits[0];\n        layoutData[name] = html;\n    });\n\n\n    var exportLines = '';\n    for(var k of Object.keys(layoutData)){\n        exportLines += `\n        static ${k} = '@android:layout/${k}';`;\n    }\n\n    var str =\n        `module android.R {\n    const _layout_data = ${JSON.stringify(layoutData, null, 8)};\n    const _tempDiv = document.createElement('div');\n\n    export class layout{\n        static getLayoutData(layoutName:string):HTMLElement{\n            if(!layoutName) return null;\n            if(!_layout_data[layoutName]) return null;\n            _tempDiv.innerHTML = _layout_data[layoutName];\n            let data = <HTMLElement>_tempDiv.firstElementChild;\n            _tempDiv.removeChild(data);\n            return data;\n        }\n        ${exportLines}\n    }\n}`;\n\n    fs.writeFile('android/R/layout.ts', str, 'utf-8');\n    writeToIdFile();\n}\n"
  },
  {
    "path": "src/insert_sdk_version_dist.js",
    "content": "var fs = require('fs');\nvar packageJson = require('../package');\n\nvar versionInfo = `/**\n * AndroidUIX v${packageJson.version}\n * ${packageJson.repository.url}\n */`;\n\nvar jsPath = '../dist/android-ui.js';\nfs.writeFileSync(jsPath, versionInfo + '\\n' + fs.readFileSync(jsPath));"
  },
  {
    "path": "src/java/lang/Comparable.ts",
    "content": "\nmodule java.lang {\n\n    export interface Comparable<T> {\n\n        /**\n         * @param   o the object to be compared.\n         * @return  a negative integer, zero, or a positive integer as this object\n         *          is less than, equal to, or greater than the specified object.\n         *\n         * @throws NullPointerException if the specified object is null\n         * @throws ClassCastException if the specified object's type prevents it\n         *         from being compared to this object.\n         */\n        compareTo(o:T):number;\n    }\n\n    export module Comparable{\n        export function isImpl(obj){\n            return obj && obj['compareTo'];\n        }\n    }\n}"
  },
  {
    "path": "src/java/lang/Float.ts",
    "content": "/**\n * Created by linfaxin on 15/11/13.\n */\nmodule java.lang{\n    export class Float{\n        static MIN_VALUE = Number.MIN_VALUE;\n        static MAX_VALUE = Number.MAX_VALUE;\n\n        static parseFloat(value:string):number {\n            return Number.parseFloat(value);\n        }\n    }\n}"
  },
  {
    "path": "src/java/lang/Integer.ts",
    "content": "/**\n * Created by linfaxin on 15/11/13.\n */\nmodule java.lang{\n    export class Integer{\n        static MIN_VALUE = -0x80000000;\n        static MAX_VALUE = 0x7fffffff;\n\n        static parseInt(value:string):number {\n            return Number.parseInt(value);\n        }\n\n        static toHexString(n:number):string {\n            if(!n) return n+'';\n            return n.toString(16);\n        }\n    }\n}"
  },
  {
    "path": "src/java/lang/Long.ts",
    "content": "/**\n * Created by linfaxin on 15/11/13.\n */\n///<reference path=\"../../androidui/util/Long.ts\"/>\n\nmodule java.lang{\n    export class Long{\n        static MIN_VALUE = goog.math.Long.MIN_VALUE.toNumber();\n        static MAX_VALUE = goog.math.Long.MAX_VALUE.toNumber();\n    }\n}"
  },
  {
    "path": "src/java/lang/Object.ts",
    "content": "/**\n * Created by linfaxin on 15/11/26.\n */\nmodule java.lang{\n\n    let hashCodeGenerator = 0;\n    export class JavaObject {\n        static get class():Class {\n            return Class.getClass(this);\n        }\n\n        private hash = hashCodeGenerator++;\n        hashCode():number{\n            return this.hash;\n        }\n\n        getClass():Class {\n            return Class.getClass(this.constructor);\n        }\n\n        equals(o):boolean {\n            return this === o;\n        }\n\n    }\n\n    export class Class{\n        private static classCache = new Map();\n        private static getClass(clazz:Function) {\n            let c = Class.classCache.get(clazz);\n            if (!c) {\n                c = new Class(clazz);\n                Class.classCache.set(clazz, c);\n            }\n            return c;\n        }\n\n        clazz:Function;\n        constructor(clazz:Function) {\n            this.clazz = clazz;\n        }\n\n        getName():string {\n            return this.clazz.name;\n        }\n        getSimpleName():string {\n            return this.clazz.name;\n        }\n    }\n}"
  },
  {
    "path": "src/java/lang/Runnable.ts",
    "content": "/**\n * Created by linfaxin on 15/10/5.\n */\nmodule java.lang{\n    export interface Runnable{\n        run();\n    }\n    export module Runnable {\n        export function of(func:()=>any): Runnable {\n            return {\n                run: func\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/java/lang/StringBuilder.ts",
    "content": "module java.lang{\n    export class StringBuilder{\n        array : Array<string>;\n\n        constructor();\n        constructor(capacity : number);\n        constructor(str : string);\n        constructor(arg?) {\n            this.array = [];\n            if(!Number.isInteger(arg) && arg){//number means capacity, miss\n                this.append(arg);\n            }\n        }\n        length() : number {\n            return this.array.length;\n        }\n        append(a:any) : StringBuilder{\n            let str:string = a + '';\n            this.array.push(...str.split(''));\n            return this;\n        }\n\n        /**\n         * @throws StringIndexOutOfBoundsException {@inheritDoc}\n         */\n        deleteCharAt(index:number):StringBuilder {\n            this.array.splice(index, 1);\n            return this;\n        }\n\n        replace(start:number, end:number, str:string):StringBuilder {\n            this.array.splice(start, end-start, ...str.split(''));\n            return this;\n        }\n\n        setLength(length : number){\n            let arrayLength = this.array.length;\n            if(length===arrayLength) return;\n            if(length<arrayLength){\n                this.array = this.array.splice(length, arrayLength-length);\n            }else{\n                for(let i = 0; i<arrayLength-length; i++){\n                    this.array.push('\\0');\n                }\n            }\n        }\n        toString() : string{\n            return this.array.join('');\n        }\n    }\n}"
  },
  {
    "path": "src/java/lang/System.ts",
    "content": "/**\n * Created by linfaxin on 15/10/8.\n */\nmodule java.lang{\n    export class System{\n        static out = {\n            println(any?){\n                console.log('\\n');\n                console.log(any);\n            },\n            print(any){\n                console.log(any);\n            }\n        };\n\n        static currentTimeMillis():number {\n            return new Date().getTime();\n        }\n\n        static arraycopy(src:any[], srcPos:number, dest:any[], destPos:number, length:number):void {\n            let srcLength = src.length;\n            let destLength = dest.length;\n            for(let i=0; i<length; i++){\n                let srcIndex = i+srcPos;\n                if(srcIndex>=srcLength) return;\n                let destIndex = i+destPos;\n                if(destIndex>=destLength) return;\n                dest[destIndex] = src[srcIndex];\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/java/lang/ref/WeakReference.ts",
    "content": "module java.lang.ref {\n    //TODO may not weak\n    export class WeakReference<T> {\n        weakMap:WeakMap<any, T>;\n\n        constructor(referent:T) {\n            this.weakMap = new WeakMap();\n            this.weakMap.set(this, referent);\n        }\n\n        get():T {\n            return this.weakMap.get(this);\n        }\n\n        set(value:T) {\n            this.weakMap.set(this, value);\n        }\n\n        clear() {\n            this.weakMap.delete(this);\n        }\n    }\n}\n"
  },
  {
    "path": "src/java/lang/util/concurrent/CopyOnWriteArrayList.ts",
    "content": "/**\n * Created by linfaxin on 15/10/6.\n */\nmodule java.lang.util.concurrent {\n\n    export class CopyOnWriteArrayList<T> {\n        private mData:Array<T> = [];\n        private isDataNew = true;\n\n        iterator(){\n            this.isDataNew = false;\n            return this.mData;\n        }\n\n        [Symbol.iterator](){\n            this.isDataNew = false;\n            return this.mData[Symbol.iterator]();\n        }\n\n        private checkNewData(){\n            if(!this.isDataNew){\n                this.isDataNew = true;\n                this.mData = [...this.mData];\n            }\n        }\n\n        size():number {\n            return this.mData.length;\n        }\n        add(...items: T[]) {\n            this.checkNewData();\n            this.mData.push(...items);\n        }\n        addAll(array:CopyOnWriteArrayList<T>) {\n            this.checkNewData();\n            this.mData.push(...array.mData);\n        }\n        remove(item:T ) {\n            this.checkNewData();\n            this.mData.splice(this.mData.indexOf(item), 1);\n        }\n\n    }\n}"
  },
  {
    "path": "src/java/util/ArrayDeque.ts",
    "content": "/**\n * Created by linfaxin on 15/12/12.\n */\n///<reference path=\"ArrayList.ts\"/>\n\nmodule java.util{\n\n    export class ArrayDeque<E> extends ArrayList<E> {\n\n        public addFirst(e:E):void {\n            this.add(0, e);\n        }\n        public addLast(e:E):void {\n            this.add(e);\n        }\n\n        public offerFirst(e:E):boolean {\n            this.addFirst(e);\n            return true;\n        }\n        public offerLast(e:E):boolean {\n            this.addLast(e);\n            return true;\n        }\n        removeFirst():E {\n            let x = this.pollFirst();\n            if(x==null) throw Error('NoSuchElementException');\n            return x;\n        }\n\n        removeLast():E {\n            let x = this.pollLast();\n            if(x==null) throw Error('NoSuchElementException');\n            return x;\n        }\n\n        pollFirst():E {\n            return this.array.shift();\n        }\n        pollLast():E {\n            return this.array.splice(this.array.length-1)[0];\n        }\n        getFirst():E {\n            let x = this.peekFirst();\n            if(x==null) throw Error('NoSuchElementException');\n            return x;\n        }\n        getLast():E {\n            let x = this.peekLast();\n            if(x==null) throw Error('NoSuchElementException');\n            return x;\n        }\n        peekFirst():E {\n            return this.array[0];\n        }\n        peekLast():E {\n            return this.array[this.array.length-1];\n        }\n\n        removeFirstOccurrence(o:any):boolean {\n            if (o == null) return false;\n            for(let i = 0, count=this.size(); i<count; i++){\n                if(this.array[i]==o){\n                    this.delete(i);\n                    return true;\n                }\n            }\n            return false;\n        }\n        removeLastOccurrence(o:any):boolean {\n            if (o == null) return false;\n            for(let i = this.size(); i>=0; i--){\n                if(this.array[i]==o){\n                    this.delete(i);\n                    return true;\n                }\n            }\n            return false;\n        }\n\n        offer(e:E):boolean {\n            return this.offerLast(e);\n        }\n        remove():E {\n            return this.removeFirst();\n        }\n        poll():E {\n            return this.pollFirst();\n        }\n        element():E {\n            return this.getFirst();\n        }\n        peek():E {\n            return this.peekFirst();\n        }\n        push(e:E) {\n            this.addFirst(e);\n        }\n        pop():E {\n            return this.removeFirst();\n        }\n\n        private delete(i:number):boolean {\n            if(i >= this.array.length) return false;\n            this.array.splice(i, 1);\n            return true;\n        }\n\n\n\n\n    }\n}"
  },
  {
    "path": "src/java/util/ArrayList.ts",
    "content": "/**\n * Created by linfaxin on 15/10/28.\n */\n///<reference path=\"List.ts\"/>\n\nmodule java.util{\n    export class ArrayList<T> implements List<T>{\n        array : Array<T> = [];\n\n        constructor(initialCapacity=0) {\n        }\n\n        size():number{\n            return this.array.length;\n        }\n        isEmpty():boolean {\n            return this.size() <= 0;\n        }\n        contains(o:T) {\n            return this.indexOf(o) >= 0;\n        }\n        indexOf(o:T) {\n            return this.array.indexOf(o);\n        }\n        lastIndexOf(o:T) {\n            return this.array.lastIndexOf(o);\n        }\n        clone():ArrayList<T> {\n            let arrayList = new ArrayList<T>();\n            arrayList.array.push(...this.array);\n            return arrayList;\n        }\n        toArray(a=new Array<T>(this.size())):Array<T>{\n            let size = this.size();\n            for (let i = 0; i < size; i++) {\n                a[i] = this.array[i];\n\n            }\n            return a;\n        }\n        getArray():Array<T>{\n            return this.array;\n        }\n        get(index:number):T {\n            index = Math.floor(index);\n            return this.array[index];\n        }\n        set(index:number, element:T):T {\n            index = Math.floor(index);\n            let old = this.array[index];\n            this.array[index] = element;\n            return old;\n        }\n\n        add(t:T);\n        add(index:number, t:T);\n        add(...args){\n            let index:number, t:T;\n            if(args.length===1) t=args[0];\n            else if(args.length===2){\n                index = Math.floor(args[0]);\n                t = args[1];\n            }\n            if(index===undefined) this.array.push(t);\n            else this.array.splice(index, 0, t);\n        }\n\n        remove(o:number|T) {\n            let index : number;\n            if(Number.isInteger(<number>o)){\n                index = <number>o;\n            }else{\n                index = this.array.indexOf(<T>o);\n            }\n            let old = this.array[index];\n            this.array.splice(index, 1);\n            return old;\n        }\n        clear() {\n            this.array = [];\n        }\n        addAll(list:ArrayList<T>);\n        addAll(index:number, list:ArrayList<T>);\n        addAll(...args){\n            let index:number, list:ArrayList<T>;\n            if(args.length===1){\n                list = args[0];\n            }else if(args.length===2){\n                index = Math.floor(args[0]);\n                list = args[1];\n            }\n            if(index===undefined){\n                this.array.push(...list.array);\n            }else{\n                this.array.splice(index, 0, ...list.array);\n            }\n        }\n        removeAll(list:ArrayList<T>):boolean{\n            let oldSize = this.size();\n            list.array.forEach((item)=>{\n                let index = this.array.indexOf(item);\n                this.array.splice(index, 1);\n            });\n            return this.size()===oldSize;\n        }\n\n        [Symbol.iterator](){\n            return this.array[Symbol.iterator];\n        }\n\n        subList(fromIndex:number, toIndex:number):ArrayList<T> {\n            let list = new ArrayList<T>();\n            fromIndex = Math.floor(fromIndex);\n            toIndex = Math.floor(toIndex);\n            for (var i = fromIndex; i < toIndex; i++) {\n                list.array.push(this.array[i]);\n            }\n            return list;\n        }\n\n        toString(){\n            return this.array.toString();\n        }\n\n        sort(compareFn?: (a: T, b: T) => number){\n            this.array.sort(compareFn);\n        }\n    }\n}"
  },
  {
    "path": "src/java/util/Arrays.ts",
    "content": "/**\n * Created by linfaxin on 15/12/6.\n */\n///<reference path=\"List.ts\"/>\n///<reference path=\"ArrayList.ts\"/>\n///<reference path=\"../../androidui/util/ArrayCreator.ts\"/>\n\nmodule java.util {\n    export class Arrays {\n\n        /**\n         * Sorts the specified range of the array into ascending order. The range\n         * to be sorted extends from the index {@code fromIndex}, inclusive, to\n         * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},\n         * the range to be sorted is empty.\n         *\n         * <p>Implementation note: The sorting algorithm is a Dual-Pivot Quicksort\n         * by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm\n         * offers O(n log(n)) performance on many data sets that cause other\n         * quicksorts to degrade to quadratic performance, and is typically\n         * faster than traditional (one-pivot) Quicksort implementations.\n         *\n         * @param a the array to be sorted\n         * @param fromIndex the index of the first element, inclusive, to be sorted\n         * @param toIndex the index of the last element, exclusive, to be sorted\n         *\n         * @throws IllegalArgumentException if {@code fromIndex > toIndex}\n         * @throws ArrayIndexOutOfBoundsException\n         *     if {@code fromIndex < 0} or {@code toIndex > a.length}\n         */\n\n        static sort(a:number[], fromIndex:number, toIndex:number) {\n            Arrays.rangeCheck(a.length, fromIndex, toIndex);\n\n            var sort = androidui.util.ArrayCreator.newNumberArray(toIndex-fromIndex);\n            for(let i = fromIndex; i < toIndex; i++){\n                sort[i-fromIndex] = a[i];\n            }\n            sort.sort((a:number, b:number)=> {\n                return a > b ? 1 : -1\n            });\n            for(let i = fromIndex; i < toIndex; i++){\n                a[i] = sort[i-fromIndex];\n            }\n        }\n\n        /**\n         * Checks that {@code fromIndex} and {@code toIndex} are in\n         * the range and throws an exception if they aren't.\n         */\n        private static rangeCheck(arrayLength:number, fromIndex:number, toIndex:number) {\n            if (fromIndex > toIndex) {\n                throw new Error(\n                    \"ArrayIndexOutOfBoundsException:fromIndex(\" + fromIndex + \") > toIndex(\" + toIndex + \")\");\n            }\n            if (fromIndex < 0) {\n                throw new Error('ArrayIndexOutOfBoundsException:' + fromIndex);\n            }\n            if (toIndex > arrayLength) {\n                throw new Error('ArrayIndexOutOfBoundsException:' + toIndex);\n            }\n        }\n\n        static asList<T>(array:T[]):List<T> {\n            let list = new ArrayList<T>();\n            list.array.push(...array);\n            return list;\n        }\n\n\n        /**\n         * Returns <tt>true</tt> if the two specified arrays of Objects are\n         * <i>equal</i> to one another.  The two arrays are considered equal if\n         * both arrays contain the same number of elements, and all corresponding\n         * pairs of elements in the two arrays are equal.  Two objects <tt>e1</tt>\n         * and <tt>e2</tt> are considered <i>equal</i> if <tt>(e1==null ? e2==null\n         * : e1.equals(e2))</tt>.  In other words, the two arrays are equal if\n         * they contain the same elements in the same order.  Also, two array\n         * references are considered equal if both are <tt>null</tt>.<p>\n         *\n         * @param a one array to be tested for equality\n         * @param a2 the other array to be tested for equality\n         * @return <tt>true</tt> if the two arrays are equal\n         */\n        static equals(a:any[], a2:any[]):boolean {\n            if (a == a2) return true;\n            if (a == null || a2 == null) return false;\n\n            let length = a.length;\n            if (a2.length != length) return false;\n\n            for (let i=0; i<length; i++) {\n                if (a[i]!=a2[i]) return false;\n            }\n            return true;\n        }\n    }\n}"
  },
  {
    "path": "src/java/util/Collections.ts",
    "content": "/**\n * Created by linfaxin on 15/11/28.\n */\n///<reference path=\"List.ts\"/>\n///<reference path=\"ArrayList.ts\"/>\n///<reference path=\"Comparator.ts\"/>\n///<reference path=\"../lang/Comparable.ts\"/>\n\n\n\nmodule java.util{\n    import Comparable = java.lang.Comparable;\n\n    export class Collections{\n\n        private static EMPTY_LIST = new ArrayList();\n        static emptyList():List<any> {\n            return Collections.EMPTY_LIST;\n        }\n\n        static sort<T>(list:List<T>, c?:Comparator<T>){\n            if(c) {\n                list.sort((t1, t2):number=> {\n                    return c.compare(t1, t2);\n                });\n            }else {\n                list.sort((t1, t2):number=> {\n                    if(Comparable.isImpl(t1) && Comparable.isImpl(t2)){\n                        return (<Comparable<any>><any>t1).compareTo(t2);\n                    }\n                    return 0;\n                });\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/java/util/Comparator.ts",
    "content": "module java.util {\n    export interface Comparator<T> {\n\n        /**\n         * Compares its two arguments for order.  Returns a negative integer,\n         * zero, or a positive integer as the first argument is less than, equal\n         * to, or greater than the second.<p>\n         *\n         * @param o1 the first object to be compared.\n         * @param o2 the second object to be compared.\n         * @return a negative integer, zero, or a positive integer as the\n         *         first argument is less than, equal to, or greater than the\n         *         second.\n         * @throws NullPointerException if an argument is null and this\n         *         comparator does not permit null arguments\n         * @throws ClassCastException if the arguments' types prevent them from\n         *         being compared by this comparator.\n         */\n        compare(o1:T, o2:T):number;\n    }\n}"
  },
  {
    "path": "src/java/util/List.ts",
    "content": "/**\n * Created by linfaxin on 15/10/28.\n */\nmodule java.util{\n    export interface List<T>{\n        size():number;\n        isEmpty():boolean;\n        contains(o:T);\n        indexOf(o:T);\n        lastIndexOf(o:T);\n        clone():List<T>;\n        toArray(a:Array<T>):Array<T>;\n        getArray():Array<T>;\n        get(index:number):T;\n        set(index:number, element:T):T;\n\n        add(t:T);\n        add(index:number, t:T);\n\n        remove(o:number|T);\n        clear();\n        addAll(list:List<T>);\n        addAll(index:number, list:List<T>);\n        removeAll(list:List<T>):boolean;\n\n        subList(fromIndex:number, toIndex:number):List<T>;\n\n        sort(compareFn?: (a: T, b: T) => number);\n    }\n}"
  },
  {
    "path": "src/lib/com/jakewharton/salvage/RecyclingPagerAdapter.ts",
    "content": "/**\n * Created by linfaxin on 15/11/6.\n */\n///<reference path=\"../../../../android/view/View.ts\"/>\n///<reference path=\"../../../../android/view/ViewGroup.ts\"/>\n///<reference path=\"../../../../android/support/v4/view/ViewPager.ts\"/>\n///<reference path=\"../../../../android/support/v4/view/PagerAdapter.ts\"/>\n\nmodule com.jakewharton.salvage{\n    import View = android.view.View;\n    import ViewGroup = android.view.ViewGroup;\n    import SparseArray = android.util.SparseArray;\n    import ViewPager = android.support.v4.view.ViewPager;\n    import PagerAdapter = android.support.v4.view.PagerAdapter;\n\n\n    /**\n     * A {@link PagerAdapter} which behaves like an {@link android.widget.Adapter} with view types and\n     * view recycling.\n     */\n    export abstract class RecyclingPagerAdapter extends PagerAdapter{\n        static IGNORE_ITEM_VIEW_TYPE = -1;\n        private recycleBin:RecycleBin;\n        constructor(){\n            super();\n            this.recycleBin = new RecycleBin();\n            this.recycleBin.setViewTypeCount(this.getViewTypeCount());\n        }\n\n        notifyDataSetChanged():void {\n            this.recycleBin.scrapActiveViews();\n            super.notifyDataSetChanged();\n        }\n\n        instantiateItem(container:android.view.ViewGroup, position:number):any {\n            let viewType = this.getItemViewType(position);\n            let view = null;\n            if (viewType != RecyclingPagerAdapter.IGNORE_ITEM_VIEW_TYPE) {\n                view = this.recycleBin.getScrapView(position, viewType);\n            }\n            view = this.getView(position, view, container);\n            container.addView(view);\n            return view;\n        }\n\n        destroyItem(container:android.view.ViewGroup, position:number, object:any):void {\n            let view = <View>object;\n            container.removeView(view);\n            let viewType = this.getItemViewType(position);\n            if (viewType != RecyclingPagerAdapter.IGNORE_ITEM_VIEW_TYPE) {\n                this.recycleBin.addScrapView(view, position, viewType);\n            }\n        }\n\n        isViewFromObject(view:android.view.View, object:any):boolean {\n            return view === object;\n        }\n\n        /**\n         * <p>\n         * Returns the number of types of Views that will be created by\n         * {@link #getView}. Each type represents a set of views that can be\n         * converted in {@link #getView}. If the adapter always returns the same\n         * type of View for all items, this method should return 1.\n         * </p>\n         * <p>\n         * This method will only be called when when the adapter is set on the\n         * the {@link AdapterView}.\n         * </p>\n         *\n         * @return The number of types of Views that will be created by this adapter\n         */\n        getViewTypeCount():number {\n            return 1;\n        }\n\n        /**\n         * Get the type of View that will be created by {@link #getView} for the specified item.\n         *\n         * @param position The position of the item within the adapter's data set whose view type we\n         *        want.\n         * @return An integer representing the type of View. Two views should share the same type if one\n         *         can be converted to the other in {@link #getView}. Note: Integers must be in the\n         *         range 0 to {@link #getViewTypeCount} - 1. {@link #IGNORE_ITEM_VIEW_TYPE} can\n         *         also be returned.\n         * @see #IGNORE_ITEM_VIEW_TYPE\n         */\n        getItemViewType(position:number):number {\n            return 0;\n        }\n\n\n        /**\n         * Get a View that displays the data at the specified position in the data set. You can either\n         * create a View manually or inflate it from an XML layout file. When the View is inflated, the\n         * parent View (GridView, ListView...) will apply default layout parameters unless you use\n         * {@link android.view.LayoutInflater#inflate(int, android.view.ViewGroup, boolean)}\n         * to specify a root view and to prevent attachment to the root.\n         *\n         * @param position The position of the item within the adapter's data set of the item whose view\n         *        we want.\n         * @param convertView The old view to reuse, if possible. Note: You should check that this view\n         *        is non-null and of an appropriate type before using. If it is not possible to convert\n         *        this view to display the correct data, this method can create a new view.\n         *        Heterogeneous lists can specify their number of view types, so that this View is\n         *        always of the right type (see {@link #getViewTypeCount()} and\n         *        {@link #getItemViewType(int)}).\n         * @param parent The parent that this view will eventually be attached to\n         * @return . A View corresponding to the data at the specified position.\n         */\n        abstract getView(position:number, convertView:View, parent:ViewGroup):View;\n\n    }\n\n\n    /**\n     * The RecycleBin facilitates reuse of views across layouts. The RecycleBin has two levels of\n     * storage: ActiveViews and ScrapViews. ActiveViews are those views which were onscreen at the\n     * start of a layout. By construction, they are displaying current information. At the end of\n     * layout, all views in ActiveViews are demoted to ScrapViews. ScrapViews are old views that\n     * could potentially be used by the adapter to avoid allocating views unnecessarily.\n     * <p>\n     * This class was taken from Android's implementation of {@link android.widget.AbsListView} which\n     * is copyrighted 2006 The Android Open Source Project.\n     */\n    class RecycleBin{\n        private activeViews:View[] = [];\n        private activeViewTypes:number[] = [];\n\n        private scrapViews:SparseArray<View>[];\n        private viewTypeCount = 0;\n        private currentScrapViews:SparseArray<View>;\n\n        setViewTypeCount(viewTypeCount:number) {\n            if (viewTypeCount < 1) {\n                throw new Error(\"Can't have a viewTypeCount < 1\");\n            }\n            //noinspection unchecked\n            let scrapViews = new Array<SparseArray<View>>(viewTypeCount);\n            for (let i = 0; i < viewTypeCount; i++) {\n                scrapViews[i] = new SparseArray<View>();\n            }\n            this.viewTypeCount = viewTypeCount;\n            this.currentScrapViews = scrapViews[0];\n            this.scrapViews = scrapViews;\n        }\n        shouldRecycleViewType(viewType:number):boolean {\n            return viewType >= 0;\n        }\n        getScrapView(position:number, viewType:number):View {\n            if (this.viewTypeCount == 1) {\n                return this.retrieveFromScrap(this.currentScrapViews, position);\n            } else if (viewType >= 0 && viewType < this.scrapViews.length) {\n                return this.retrieveFromScrap(this.scrapViews[viewType], position);\n            }\n            return null;\n        }\n        addScrapView(scrap:View, position:number, viewType:number) {\n            if (this.viewTypeCount == 1) {\n                this.currentScrapViews.put(position, scrap);\n            } else {\n                this.scrapViews[viewType].put(position, scrap);\n            }\n        }\n        scrapActiveViews() {\n            const activeViews = this.activeViews;\n            const activeViewTypes = this.activeViewTypes;\n            const multipleScraps = this.viewTypeCount > 1;\n\n            let scrapViews = this.currentScrapViews;\n            const count = activeViews.length;\n            for (let i = count - 1; i >= 0; i--) {\n                const victim = activeViews[i];\n                if (victim != null) {\n                    let whichScrap = activeViewTypes[i];\n\n                    activeViews[i] = null;\n                    activeViewTypes[i] = -1;\n\n                    if (!this.shouldRecycleViewType(whichScrap)) {\n                        continue;\n                    }\n\n                    if (multipleScraps) {\n                        scrapViews = this.scrapViews[whichScrap];\n                    }\n                    scrapViews.put(i, victim);\n                }\n            }\n\n            this.pruneScrapViews();\n        }\n\n        private pruneScrapViews() {\n            const maxViews = this.activeViews.length;\n            const viewTypeCount = this.viewTypeCount;\n            const scrapViews = this.scrapViews;\n            for (let i = 0; i < viewTypeCount; ++i) {\n                const scrapPile = scrapViews[i];\n                let size = scrapPile.size();\n                const extras = size - maxViews;\n                size--;\n                for (let j = 0; j < extras; j++) {\n                    scrapPile.remove(scrapPile.keyAt(size--));\n                }\n            }\n        }\n        retrieveFromScrap(scrapViews:SparseArray<View>, position:number):View {\n            let size = scrapViews.size();\n            if (size > 0) {\n                // See if we still have a view for this position.\n                for (let i = 0; i < size; i++) {\n                    let fromPosition = scrapViews.keyAt(i);\n                    let view = scrapViews.get(fromPosition);\n                    if (fromPosition == position) {\n                        scrapViews.remove(fromPosition);\n                        return view;\n                    }\n                }\n                let index = size - 1;\n                let r = scrapViews.valueAt(index);\n                scrapViews.remove(scrapViews.keyAt(index));\n                return r;\n            } else {\n                return null;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/lib/uk/co/senab/photoview/GestureDetector.ts",
    "content": "/*******************************************************************************\n * Copyright 2011, 2012 Chris Banes.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *******************************************************************************/\n\n///<reference path=\"../../../../../android/util/Log.ts\"/>\n///<reference path=\"../../../../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../../../../android/view/ScaleGestureDetector.ts\"/>\n///<reference path=\"../../../../../android/view/VelocityTracker.ts\"/>\n///<reference path=\"../../../../../android/view/ViewConfiguration.ts\"/>\n///<reference path=\"../../../../../java/lang/Float.ts\"/>\n\nmodule uk.co.senab.photoview {\nimport Log = android.util.Log;\nimport MotionEvent = android.view.MotionEvent;\nimport ScaleGestureDetector = android.view.ScaleGestureDetector;\nimport VelocityTracker = android.view.VelocityTracker;\nimport ViewConfiguration = android.view.ViewConfiguration;\nimport Float = java.lang.Float;\nexport class GestureDetector {\n\n    protected mListener:GestureDetector.OnGestureListener;\n\n    private static LOG_TAG:string = \"CupcakeGestureDetector\";\n\n    private static INVALID_POINTER_ID:number = -1;\n\n    private mActivePointerId:number = GestureDetector.INVALID_POINTER_ID;\n\n    private mActivePointerIndex:number = 0;\n\n    mLastTouchX:number = 0;\n\n    mLastTouchY:number = 0;\n\n    mTouchSlop:number = 0;\n\n    mMinimumVelocity:number = 0;\n\n    protected mScaleDetector:ScaleGestureDetector;\n\n    setOnGestureListener(listener:GestureDetector.OnGestureListener):void  {\n        this.mListener = listener;\n    }\n\n    constructor() {\n        const configuration:ViewConfiguration = ViewConfiguration.get();\n        this.mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();\n        this.mTouchSlop = configuration.getScaledTouchSlop();\n\n        const inner_this=this;\n        let scaleListener:ScaleGestureDetector.OnScaleGestureListener = {\n            onScale(detector:ScaleGestureDetector):boolean  {\n                let scaleFactor:number = detector.getScaleFactor();\n                if (Number.isNaN(scaleFactor) || !Number.isFinite(scaleFactor)) return false;\n                inner_this.mListener.onScale(scaleFactor, detector.getFocusX(), detector.getFocusY());\n                return true;\n            },\n            onScaleBegin(detector:ScaleGestureDetector):boolean  {\n                return true;\n            },\n            onScaleEnd(detector:ScaleGestureDetector):void  {\n                // NO-OP\n            }\n        };\n\n        this.mScaleDetector = new ScaleGestureDetector(scaleListener);\n    }\n\n    private mVelocityTracker:VelocityTracker;\n\n    private mIsDragging:boolean;\n\n    getActiveX(ev:MotionEvent):number  {\n        return ev.getX(this.mActivePointerIndex<0 ? 0 : this.mActivePointerIndex);\n    }\n\n    getActiveY(ev:MotionEvent):number  {\n        return ev.getY(this.mActivePointerIndex<0 ? 0 : this.mActivePointerIndex);\n    }\n\n    isScaling():boolean  {\n        return this.mScaleDetector.isInProgress();\n    }\n\n    isDragging():boolean  {\n        return this.mIsDragging;\n    }\n\n    onTouchEvent(ev:MotionEvent):boolean  {\n        this.mScaleDetector.onTouchEvent(ev);\n\n        //get pointId\n        const action:number = ev.getAction();\n        switch(action & MotionEvent.ACTION_MASK) {\n            case MotionEvent.ACTION_DOWN:\n                this.mActivePointerId = ev.getPointerId(0);\n                break;\n            case MotionEvent.ACTION_CANCEL:\n            case MotionEvent.ACTION_UP:\n                this.mActivePointerId = GestureDetector.INVALID_POINTER_ID;\n                break;\n            case MotionEvent.ACTION_POINTER_UP:\n                // Ignore deprecation, ACTION_POINTER_ID_MASK and\n                // ACTION_POINTER_ID_SHIFT has same value and are deprecated\n                // You can have either deprecation or lint target api warning\n                // Compat.getPointerIndex(ev.getAction());\n                const pointerIndex:number = ev.getActionIndex();\n                const pointerId:number = ev.getPointerId(pointerIndex);\n                if (pointerId == this.mActivePointerId) {\n                    // This was our active pointer going up. Choose a new\n                    // active pointer and adjust accordingly.\n                    const newPointerIndex:number = pointerIndex == 0 ? 1 : 0;\n                    this.mActivePointerId = ev.getPointerId(newPointerIndex);\n                    this.mLastTouchX = ev.getX(newPointerIndex);\n                    this.mLastTouchY = ev.getY(newPointerIndex);\n                }\n                break;\n        }\n        this.mActivePointerIndex = ev.findPointerIndex(this.mActivePointerId != GestureDetector.INVALID_POINTER_ID ? this.mActivePointerId : 0);\n        switch(ev.getAction()) {\n            case MotionEvent.ACTION_DOWN:\n                {\n                    this.mVelocityTracker = VelocityTracker.obtain();\n                    if (null != this.mVelocityTracker) {\n                        this.mVelocityTracker.addMovement(ev);\n                    } else {\n                        Log.i(GestureDetector.LOG_TAG, \"Velocity tracker is null\");\n                    }\n                    this.mLastTouchX = this.getActiveX(ev);\n                    this.mLastTouchY = this.getActiveY(ev);\n                    this.mIsDragging = false;\n                    break;\n                }\n            case MotionEvent.ACTION_MOVE:\n                {\n                    const x:number = this.getActiveX(ev);\n                    const y:number = this.getActiveY(ev);\n                    const dx:number = x - this.mLastTouchX, dy:number = y - this.mLastTouchY;\n                    if (!this.mIsDragging) {\n                        // Use Pythagoras to see if drag length is larger than\n                        // touch slop\n                        this.mIsDragging = Math.sqrt((dx * dx) + (dy * dy)) >= this.mTouchSlop;\n                    }\n                    if (this.mIsDragging) {\n                        this.mListener.onDrag(dx, dy);\n                        this.mLastTouchX = x;\n                        this.mLastTouchY = y;\n                        if (null != this.mVelocityTracker) {\n                            this.mVelocityTracker.addMovement(ev);\n                        }\n                    }\n                    break;\n                }\n            case MotionEvent.ACTION_CANCEL:\n                {\n                    // Recycle Velocity Tracker\n                    if (null != this.mVelocityTracker) {\n                        this.mVelocityTracker.recycle();\n                        this.mVelocityTracker = null;\n                    }\n                    break;\n                }\n            case MotionEvent.ACTION_UP:\n                {\n                    if (this.mIsDragging) {\n                        if (null != this.mVelocityTracker) {\n                            this.mLastTouchX = this.getActiveX(ev);\n                            this.mLastTouchY = this.getActiveY(ev);\n                            // Compute velocity within the last 1000ms\n                            this.mVelocityTracker.addMovement(ev);\n                            this.mVelocityTracker.computeCurrentVelocity(1000);\n                            const vX:number = this.mVelocityTracker.getXVelocity(), vY:number = this.mVelocityTracker.getYVelocity();\n                            // listener\n                            if (Math.max(Math.abs(vX), Math.abs(vY)) >= this.mMinimumVelocity) {\n                                this.mListener.onFling(this.mLastTouchX, this.mLastTouchY, -vX, -vY);\n                            }\n                        }\n                    }\n                    // Recycle Velocity Tracker\n                    if (null != this.mVelocityTracker) {\n                        this.mVelocityTracker.recycle();\n                        this.mVelocityTracker = null;\n                    }\n                    break;\n                }\n        }\n        return true;\n    }\n\n\n}\n\nexport module GestureDetector{\nexport interface OnGestureListener {\n\n    onDrag(dx:number, dy:number):void ;\n\n    onFling(startX:number, startY:number, velocityX:number, velocityY:number):void ;\n\n    onScale(scaleFactor:number, focusX:number, focusY:number):void ;\n}\n}\n\n}"
  },
  {
    "path": "src/lib/uk/co/senab/photoview/IPhotoView.ts",
    "content": "/*******************************************************************************\n * Copyright 2011, 2012 Chris Banes.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *******************************************************************************/\n\n///<reference path=\"../../../../../android/graphics/Matrix.ts\"/>\n///<reference path=\"../../../../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../../../../android/graphics/RectF.ts\"/>\n///<reference path=\"../../../../../android/view/GestureDetector.ts\"/>\n///<reference path=\"../../../../../android/view/View.ts\"/>\n///<reference path=\"../../../../../android/widget/ImageView.ts\"/>\n///<reference path=\"../../../../uk/co/senab/photoview/GestureDetector.ts\"/>\n///<reference path=\"../../../../uk/co/senab/photoview/PhotoView.ts\"/>\n///<reference path=\"../../../../uk/co/senab/photoview/PhotoViewAttacher.ts\"/>\n\nmodule uk.co.senab.photoview {\n    import Matrix = android.graphics.Matrix;\n    import Canvas = android.graphics.Canvas;\n    import RectF = android.graphics.RectF;\n    import GestureDetector = android.view.GestureDetector;\n    import View = android.view.View;\n    import ImageView = android.widget.ImageView;\n    import PhotoView = uk.co.senab.photoview.PhotoView;\n    import PhotoViewAttacher = uk.co.senab.photoview.PhotoViewAttacher;\n    export interface IPhotoView {\n\n        /**\n         * Returns true if the PhotoView is set to allow zooming of Photos.\n         *\n         * @return true if the PhotoView allows zooming.\n         */\n        canZoom():boolean ;\n\n        /**\n         * Gets the Display Rectangle of the currently displayed Drawable. The Rectangle is relative to\n         * this View and includes all scaling and translations.\n         *\n         * @return - RectF of Displayed Drawable\n         */\n        getDisplayRect():RectF ;\n\n        /**\n         * Sets the Display Matrix of the currently displayed Drawable. The Rectangle is considered\n         * relative to this View and includes all scaling and translations.\n         *\n         * @param finalMatrix target matrix to set PhotoView to\n         * @return - true if rectangle was applied successfully\n         */\n        setDisplayMatrix(finalMatrix:Matrix):boolean ;\n\n        /**\n         * Gets the Display Matrix of the currently displayed Drawable. The Rectangle is considered\n         * relative to this View and includes all scaling and translations.\n         *\n         * @return - true if rectangle was applied successfully\n         */\n        getDisplayMatrix():Matrix ;\n\n        /**\n         * Use {@link #getMinimumScale()} instead, this will be removed in future release\n         *\n         * @return The current minimum scale level. What this value represents depends on the current\n         * {@link ImageView.ScaleType}.\n         */\n        getMinScale():number ;\n\n        /**\n         * @return The current minimum scale level. What this value represents depends on the current\n         * {@link ImageView.ScaleType}.\n         */\n        getMinimumScale():number ;\n\n        /**\n         * Use {@link #getMediumScale()} instead, this will be removed in future release\n         *\n         * @return The current middle scale level. What this value represents depends on the current\n         * {@link ImageView.ScaleType}.\n         */\n        getMidScale():number ;\n\n        /**\n         * @return The current medium scale level. What this value represents depends on the current\n         * {@link ImageView.ScaleType}.\n         */\n        getMediumScale():number ;\n\n        /**\n         * Use {@link #getMaximumScale()} instead, this will be removed in future release\n         *\n         * @return The current maximum scale level. What this value represents depends on the current\n         * {@link ImageView.ScaleType}.\n         */\n        getMaxScale():number ;\n\n        /**\n         * @return The current maximum scale level. What this value represents depends on the current\n         * {@link ImageView.ScaleType}.\n         */\n        getMaximumScale():number ;\n\n        /**\n         * Returns the current scale value\n         *\n         * @return float - current scale value\n         */\n        getScale():number ;\n\n        /**\n         * Return the current scale type in use by the ImageView.\n         *\n         * @return current ImageView.ScaleType\n         */\n        getScaleType():ImageView.ScaleType ;\n\n        /**\n         * Whether to allow the ImageView's parent to intercept the touch event when the photo is scroll\n         * to it's horizontal edge.\n         *\n         * @param allow whether to allow intercepting by parent element or not\n         */\n        setAllowParentInterceptOnEdge(allow:boolean):void ;\n\n        /**\n         * Use {@link #setMinimumScale(float minimumScale)} instead, this will be removed in future\n         * release\n         * <p>&nbsp;</p>\n         * Sets the minimum scale level. What this value represents depends on the current {@link\n            * ImageView.ScaleType}.\n         *\n         * @param minScale minimum allowed scale\n         */\n        setMinScale(minScale:number):void ;\n\n        /**\n         * Sets the minimum scale level. What this value represents depends on the current {@link\n            * ImageView.ScaleType}.\n         *\n         * @param minimumScale minimum allowed scale\n         */\n        setMinimumScale(minimumScale:number):void ;\n\n        /**\n         * Use {@link #setMediumScale(float mediumScale)} instead, this will be removed in future\n         * release\n         * <p>&nbsp;</p>\n         * Sets the middle scale level. What this value represents depends on the current {@link\n            * ImageView.ScaleType}.\n         *\n         * @param midScale medium scale preset\n         */\n        setMidScale(midScale:number):void ;\n\n        /*\n         * Sets the medium scale level. What this value represents depends on the current {@link android.widget.ImageView.ScaleType}.\n         *\n         * @param mediumScale medium scale preset\n         */\n        setMediumScale(mediumScale:number):void ;\n\n        /**\n         * Use {@link #setMaximumScale(float maximumScale)} instead, this will be removed in future\n         * release\n         * <p>&nbsp;</p>\n         * Sets the maximum scale level. What this value represents depends on the current {@link\n            * ImageView.ScaleType}.\n         *\n         * @param maxScale maximum allowed scale preset\n         */\n        setMaxScale(maxScale:number):void ;\n\n        /**\n         * Sets the maximum scale level. What this value represents depends on the current {@link\n            * ImageView.ScaleType}.\n         *\n         * @param maximumScale maximum allowed scale preset\n         */\n        setMaximumScale(maximumScale:number):void ;\n\n        /**\n         * Allows to set all three scale levels at once, so you don't run into problem with setting\n         * medium/minimum scale before the maximum one\n         *\n         * @param minimumScale minimum allowed scale\n         * @param mediumScale  medium allowed scale\n         * @param maximumScale maximum allowed scale preset\n         */\n        setScaleLevels(minimumScale:number, mediumScale:number, maximumScale:number):void ;\n\n        /**\n         * Register a callback to be invoked when the Photo displayed by this view is long-pressed.\n         *\n         * @param listener - Listener to be registered.\n         */\n        setOnLongClickListener(listener:View.OnLongClickListener):void ;\n\n        /**\n         * Register a callback to be invoked when the Matrix has changed for this View. An example would\n         * be the user panning or scaling the Photo.\n         *\n         * @param listener - Listener to be registered.\n         */\n        setOnMatrixChangeListener(listener:PhotoViewAttacher.OnMatrixChangedListener):void ;\n\n        /**\n         * Register a callback to be invoked when the Photo displayed by this View is tapped with a\n         * single tap.\n         *\n         * @param listener - Listener to be registered.\n         */\n        setOnPhotoTapListener(listener:PhotoViewAttacher.OnPhotoTapListener):void ;\n\n        /**\n         * Returns a listener to be invoked when the Photo displayed by this View is tapped with a\n         * single tap.\n         *\n         * @return PhotoViewAttacher.OnPhotoTapListener currently set, may be null\n         */\n        getOnPhotoTapListener():PhotoViewAttacher.OnPhotoTapListener ;\n\n        /**\n         * Register a callback to be invoked when the View is tapped with a single tap.\n         *\n         * @param listener - Listener to be registered.\n         */\n        setOnViewTapListener(listener:PhotoViewAttacher.OnViewTapListener):void ;\n\n        /**\n         * Enables rotation via PhotoView internal functions.\n         *\n         * @param rotationDegree - Degree to rotate PhotoView to, should be in range 0 to 360\n         */\n        setRotationTo(rotationDegree:number):void ;\n\n        /**\n         * Enables rotation via PhotoView internal functions.\n         *\n         * @param rotationDegree - Degree to rotate PhotoView by, should be in range 0 to 360\n         */\n        setRotationBy(rotationDegree:number):void ;\n\n        /**\n         * Returns a callback listener to be invoked when the View is tapped with a single tap.\n         *\n         * @return PhotoViewAttacher.OnViewTapListener currently set, may be null\n         */\n        getOnViewTapListener():PhotoViewAttacher.OnViewTapListener ;\n\n        /**\n         * Changes the current scale to the specified value.\n         *\n         * @param scale - Value to scale to\n         */\n        setScale(scale:number):void ;\n\n        /**\n         * Changes the current scale to the specified value.\n         *\n         * @param scale   - Value to scale to\n         * @param animate - Whether to animate the scale\n         */\n        setScale(scale:number, animate:boolean):void ;\n\n        /**\n         * Changes the current scale to the specified value, around the given focal point.\n         *\n         * @param scale   - Value to scale to\n         * @param focalX  - X Focus Point\n         * @param focalY  - Y Focus Point\n         * @param animate - Whether to animate the scale\n         */\n        setScale(scale:number, focalX:number, focalY:number, animate:boolean):void ;\n\n        /**\n         * Controls how the image should be resized or moved to match the size of the ImageView. Any\n         * scaling or panning will happen within the confines of this {@link\n            * ImageView.ScaleType}.\n         *\n         * @param scaleType - The desired scaling mode.\n         */\n        setScaleType(scaleType:ImageView.ScaleType):void ;\n\n        /**\n         * Allows you to enable/disable the zoom functionality on the ImageView. When disable the\n         * ImageView reverts to using the FIT_CENTER matrix.\n         *\n         * @param zoomable - Whether the zoom functionality is enabled.\n         */\n        setZoomable(zoomable:boolean):void ;\n\n        /**\n         * Enables rotation via PhotoView internal functions. Name is chosen so it won't collide with\n         * View.setRotation(float) in API since 11\n         *\n         * @param rotationDegree - Degree to rotate PhotoView to, should be in range 0 to 360\n         * @deprecated use {@link #setRotationTo(float)}\n         */\n        setPhotoViewRotation(rotationDegree:number):void ;\n\n        /**\n         * Extracts currently visible area to Bitmap object, if there is no image loaded yet or the\n         * ImageView is already destroyed, returns {@code null}\n         *\n         * @return currently visible area as bitmap or null\n         */\n        getVisibleRectangleBitmap():Canvas ;\n\n        /**\n         * Allows to change zoom transition speed, default value is 200 (PhotoViewAttacher.DEFAULT_ZOOM_DURATION).\n         * Will default to 200 if provided negative value\n         *\n         * @param milliseconds duration of zoom interpolation\n         */\n        setZoomTransitionDuration(milliseconds:number):void ;\n\n        /**\n         * Will return instance of IPhotoView (eg. PhotoViewAttacher), can be used to provide better\n         * integration\n         *\n         * @return IPhotoView implementation instance if available, null if not\n         */\n        getIPhotoViewImplementation():IPhotoView ;\n\n        /**\n         * Sets custom double tap listener, to intercept default given functions. To reset behavior to\n         * default, you can just pass in \"null\" or public field of PhotoViewAttacher.defaultOnDoubleTapListener\n         *\n         * @param newOnDoubleTapListener custom OnDoubleTapListener to be set on ImageView\n         */\n        setOnDoubleTapListener(newOnDoubleTapListener:GestureDetector.OnDoubleTapListener):void ;\n\n        /**\n         * Will report back about scale changes\n         *\n         * @param onScaleChangeListener OnScaleChangeListener instance\n         */\n        setOnScaleChangeListener(onScaleChangeListener:PhotoViewAttacher.OnScaleChangeListener):void ;\n    }\n\n    export module IPhotoView {\n        export var DEFAULT_MAX_SCALE:number = 3.0;\n        export var DEFAULT_MID_SCALE:number = 1.75;\n        export var DEFAULT_MIN_SCALE:number = 1.0;\n        export var DEFAULT_ZOOM_DURATION:number = 200;\n\n        export function isImpl(obj):boolean {\n            if(!obj) return false;\n            return obj['canZoom'] &&\n                obj['getDisplayRect'] &&\n                obj['setDisplayMatrix'] &&\n                obj['getDisplayMatrix'] &&\n                obj['getMinScale'] &&\n                obj['getMinimumScale'] &&\n                obj['getMidScale'] &&\n                obj['getMediumScale'] &&\n                obj['getMaxScale'] &&\n                obj['getMaximumScale'] &&\n                obj['getScale'] &&\n                obj['getScaleType'] &&\n                obj['setAllowParentInterceptOnEdge'] &&\n                obj['setMinScale'] &&\n                obj['setMinimumScale'] &&\n                obj['setMidScale'] &&\n                obj['setMediumScale'] &&\n                obj['setMaxScale'] &&\n                obj['setMaximumScale'] &&\n                obj['setScaleLevels'] &&\n                obj['setOnLongClickListener'] &&\n                obj['setOnMatrixChangeListener'] &&\n                obj['setOnPhotoTapListener'] &&\n                obj['getOnPhotoTapListener'] &&\n                obj['setOnViewTapListener'] &&\n                obj['setRotationTo'] &&\n                obj['setRotationBy'] &&\n                obj['getOnViewTapListener'] &&\n                obj['setScale'] &&\n                obj['setScale'] &&\n                obj['setScale'] &&\n                obj['setScaleType'] &&\n                obj['setZoomable'] &&\n                obj['setPhotoViewRotation'] &&\n                obj['getVisibleRectangleBitmap'] &&\n                obj['setZoomTransitionDuration'] &&\n                obj['getIPhotoViewImplementation'] &&\n                obj['setOnDoubleTapListener'] &&\n                obj['setOnScaleChangeListener'];\n        }\n    }\n\n}"
  },
  {
    "path": "src/lib/uk/co/senab/photoview/PhotoView.ts",
    "content": "/*******************************************************************************\n * Copyright 2011, 2012 Chris Banes.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *******************************************************************************/\n\n///<reference path=\"../../../../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../../../../android/graphics/Matrix.ts\"/>\n///<reference path=\"../../../../../android/graphics/RectF.ts\"/>\n///<reference path=\"../../../../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../../../../android/view/GestureDetector.ts\"/>\n///<reference path=\"../../../../../android/view/View.ts\"/>\n///<reference path=\"../../../../../android/widget/ImageView.ts\"/>\n///<reference path=\"../../../../uk/co/senab/photoview/PhotoViewAttacher.ts\"/>\n///<reference path=\"../../../../uk/co/senab/photoview/IPhotoView.ts\"/>\n\nmodule uk.co.senab.photoview {\nimport Canvas = android.graphics.Canvas;\nimport Matrix = android.graphics.Matrix;\nimport RectF = android.graphics.RectF;\nimport Drawable = android.graphics.drawable.Drawable;\nimport GestureDetector = android.view.GestureDetector;\nimport View = android.view.View;\nimport ImageView = android.widget.ImageView;\nimport OnMatrixChangedListener = uk.co.senab.photoview.PhotoViewAttacher.OnMatrixChangedListener;\nimport OnPhotoTapListener = uk.co.senab.photoview.PhotoViewAttacher.OnPhotoTapListener;\nimport OnViewTapListener = uk.co.senab.photoview.PhotoViewAttacher.OnViewTapListener;\nimport PhotoViewAttacher = uk.co.senab.photoview.PhotoViewAttacher;\nimport IPhotoView = uk.co.senab.photoview.IPhotoView;\n    import ScaleType = ImageView.ScaleType;\n\nexport class PhotoView extends ImageView implements IPhotoView {\n\n    private mAttacher:PhotoViewAttacher;\n\n    private mPendingScaleType:ScaleType;\n\n    constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle?:Map<string, string>) {\n        super(context, bindElement, defStyle);\n        super.setScaleType(ScaleType.MATRIX);\n        this.init();\n    }\n\n    protected init():void  {\n        if (null == this.mAttacher || null == this.mAttacher.getImageView()) {\n            this.mAttacher = new PhotoViewAttacher(this);\n        }\n        if (null != this.mPendingScaleType) {\n            this.setScaleType(this.mPendingScaleType);\n            this.mPendingScaleType = null;\n        }\n    }\n\n    /**\n     * @deprecated use {@link #setRotationTo(float)}\n     */\n    setPhotoViewRotation(rotationDegree:number):void  {\n        this.mAttacher.setRotationTo(rotationDegree);\n    }\n\n    setRotationTo(rotationDegree:number):void  {\n        this.mAttacher.setRotationTo(rotationDegree);\n    }\n\n    setRotationBy(rotationDegree:number):void  {\n        this.mAttacher.setRotationBy(rotationDegree);\n    }\n\n    canZoom():boolean  {\n        return this.mAttacher.canZoom();\n    }\n\n    getDisplayRect():RectF  {\n        return this.mAttacher.getDisplayRect();\n    }\n\n    getDisplayMatrix():Matrix  {\n        return this.mAttacher.getDisplayMatrix();\n    }\n\n    setDisplayMatrix(finalRectangle:Matrix):boolean  {\n        return this.mAttacher.setDisplayMatrix(finalRectangle);\n    }\n\n    getMinScale():number  {\n        return this.getMinimumScale();\n    }\n\n    getMinimumScale():number  {\n        return this.mAttacher.getMinimumScale();\n    }\n\n    getMidScale():number  {\n        return this.getMediumScale();\n    }\n\n    getMediumScale():number  {\n        return this.mAttacher.getMediumScale();\n    }\n\n    getMaxScale():number  {\n        return this.getMaximumScale();\n    }\n\n    getMaximumScale():number  {\n        return this.mAttacher.getMaximumScale();\n    }\n\n    getScale():number  {\n        return this.mAttacher.getScale();\n    }\n\n    getScaleType():ScaleType  {\n        return this.mAttacher.getScaleType();\n    }\n\n    setAllowParentInterceptOnEdge(allow:boolean):void  {\n        this.mAttacher.setAllowParentInterceptOnEdge(allow);\n    }\n\n    setMinScale(minScale:number):void  {\n        this.setMinimumScale(minScale);\n    }\n\n    setMinimumScale(minimumScale:number):void  {\n        this.mAttacher.setMinimumScale(minimumScale);\n    }\n\n    setMidScale(midScale:number):void  {\n        this.setMediumScale(midScale);\n    }\n\n    setMediumScale(mediumScale:number):void  {\n        this.mAttacher.setMediumScale(mediumScale);\n    }\n\n    setMaxScale(maxScale:number):void  {\n        this.setMaximumScale(maxScale);\n    }\n\n    setMaximumScale(maximumScale:number):void  {\n        this.mAttacher.setMaximumScale(maximumScale);\n    }\n\n    setScaleLevels(minimumScale:number, mediumScale:number, maximumScale:number):void  {\n        this.mAttacher.setScaleLevels(minimumScale, mediumScale, maximumScale);\n    }\n\n    setImageDrawable(drawable:Drawable):// setImageBitmap calls through to this method\n    void  {\n        super.setImageDrawable(drawable);\n        if (null != this.mAttacher) {\n            this.mAttacher.update();\n        }\n    }\n\n    //setImageResource(resId:number):void  {\n    //    super.setImageResource(resId);\n    //    if (null != this.mAttacher) {\n    //        this.mAttacher.update();\n    //    }\n    //}\n\n    setImageURI(uri:string):void  {\n        super.setImageURI(uri);\n        //if (null != this.mAttacher) {\n        //    this.mAttacher.update();\n        //}\n    }\n\n    protected resizeFromDrawable():boolean  {\n        let change = super.resizeFromDrawable();\n        if(change && null != this.mAttacher){\n            this.mAttacher.update();\n        }\n        return change;\n    }\n\n    setOnMatrixChangeListener(listener:OnMatrixChangedListener):void  {\n        this.mAttacher.setOnMatrixChangeListener(listener);\n    }\n\n    setOnLongClickListener(l:View.OnLongClickListener):void  {\n        this.mAttacher.setOnLongClickListener(l);\n    }\n\n    setOnPhotoTapListener(listener:OnPhotoTapListener):void  {\n        this.mAttacher.setOnPhotoTapListener(listener);\n    }\n\n    getOnPhotoTapListener():OnPhotoTapListener  {\n        return this.mAttacher.getOnPhotoTapListener();\n    }\n\n    setOnViewTapListener(listener:OnViewTapListener):void  {\n        this.mAttacher.setOnViewTapListener(listener);\n    }\n\n    getOnViewTapListener():OnViewTapListener  {\n        return this.mAttacher.getOnViewTapListener();\n    }\n\n    setScale(scale:number, animate?:boolean):void;\n    setScale(scale:number, focalX:number, focalY:number, animate?:boolean):void;\n    setScale(...args):void  {\n        (<any>this.mAttacher).setScale(...args);\n    }\n\n    setScaleType(scaleType:ScaleType):void  {\n        if (null != this.mAttacher) {\n            this.mAttacher.setScaleType(scaleType);\n        } else {\n            this.mPendingScaleType = scaleType;\n        }\n    }\n\n    setZoomable(zoomable:boolean):void  {\n        this.mAttacher.setZoomable(zoomable);\n    }\n\n    getVisibleRectangleBitmap():Canvas  {\n        return this.mAttacher.getVisibleRectangleBitmap();\n    }\n\n    setZoomTransitionDuration(milliseconds:number):void  {\n        this.mAttacher.setZoomTransitionDuration(milliseconds);\n    }\n\n    getIPhotoViewImplementation():IPhotoView  {\n        return this.mAttacher;\n    }\n\n    setOnDoubleTapListener(newOnDoubleTapListener:GestureDetector.OnDoubleTapListener):void  {\n        this.mAttacher.setOnDoubleTapListener(newOnDoubleTapListener);\n    }\n\n    setOnScaleChangeListener(onScaleChangeListener:PhotoViewAttacher.OnScaleChangeListener):void  {\n        this.mAttacher.setOnScaleChangeListener(onScaleChangeListener);\n    }\n\n    protected onDetachedFromWindow():void  {\n        this.mAttacher.cleanup();\n        super.onDetachedFromWindow();\n    }\n\n    protected onAttachedToWindow():void  {\n        this.init();\n        super.onAttachedToWindow();\n    }\n}\n}"
  },
  {
    "path": "src/lib/uk/co/senab/photoview/PhotoViewAttacher.ts",
    "content": "/*******************************************************************************\n * Copyright 2011, 2012 Chris Banes.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *******************************************************************************/\n\n///<reference path=\"../../../../../android/graphics/Canvas.ts\"/>\n///<reference path=\"../../../../../android/graphics/Matrix.ts\"/>\n///<reference path=\"../../../../../android/graphics/RectF.ts\"/>\n///<reference path=\"../../../../../android/graphics/drawable/Drawable.ts\"/>\n///<reference path=\"../../../../../android/util/Log.ts\"/>\n///<reference path=\"../../../../../android/view/MotionEvent.ts\"/>\n///<reference path=\"../../../../../android/view/View.ts\"/>\n///<reference path=\"../../../../../android/view/ViewParent.ts\"/>\n///<reference path=\"../../../../../android/view/ViewTreeObserver.ts\"/>\n///<reference path=\"../../../../../android/view/animation/AccelerateDecelerateInterpolator.ts\"/>\n///<reference path=\"../../../../../android/view/animation/Interpolator.ts\"/>\n///<reference path=\"../../../../../android/widget/ImageView.ts\"/>\n///<reference path=\"../../../../../android/widget/OverScroller.ts\"/>\n///<reference path=\"../../../../../java/lang/ref/WeakReference.ts\"/>\n///<reference path=\"../../../../../java/lang/Runnable.ts\"/>\n///<reference path=\"../../../../../java/lang/System.ts\"/>\n///<reference path=\"../../../../uk/co/senab/photoview/GestureDetector.ts\"/>\n///<reference path=\"../../../../uk/co/senab/photoview/IPhotoView.ts\"/>\n///<reference path=\"../../../../uk/co/senab/photoview/PhotoView.ts\"/>\n///<reference path=\"../../../../../androidui/util/ArrayCreator.ts\"/>\n\nmodule uk.co.senab.photoview {\n    import Canvas = android.graphics.Canvas;\n    import Matrix = android.graphics.Matrix;\n    import ScaleToFit = android.graphics.Matrix.ScaleToFit;\n    import RectF = android.graphics.RectF;\n    import Drawable = android.graphics.drawable.Drawable;\n    import Log = android.util.Log;\n    import View = android.view.View;\n    import OnLongClickListener = android.view.View.OnLongClickListener;\n    import ViewParent = android.view.ViewParent;\n    import ViewTreeObserver = android.view.ViewTreeObserver;\n    import AccelerateDecelerateInterpolator = android.view.animation.AccelerateDecelerateInterpolator;\n    import Interpolator = android.view.animation.Interpolator;\n    import ImageView = android.widget.ImageView;\n    import ScaleType = android.widget.ImageView.ScaleType;\n    import OverScroller = android.widget.OverScroller;\n    import WeakReference = java.lang.ref.WeakReference;\n    import MotionEvent = android.view.MotionEvent;\n    const ACTION_CANCEL = MotionEvent.ACTION_CANCEL;\n    const ACTION_DOWN = MotionEvent.ACTION_DOWN;\n    const ACTION_UP = MotionEvent.ACTION_UP;\n    import Runnable = java.lang.Runnable;\n    import System = java.lang.System;\n    import GestureDetector = uk.co.senab.photoview.GestureDetector;\n    import IPhotoView = uk.co.senab.photoview.IPhotoView;\n    import PhotoView = uk.co.senab.photoview.PhotoView;\n    export class PhotoViewAttacher implements IPhotoView, View.OnTouchListener, GestureDetector.OnGestureListener, ViewTreeObserver.OnGlobalLayoutListener {\n\n        private static LOG_TAG:string = \"PhotoViewAttacher\";\n\n        // let debug flag be dynamic, but still Proguard can be used to remove from\n        // release builds\n        private static DEBUG:boolean = Log.View_DBG;\n\n        static sInterpolator:Interpolator = new AccelerateDecelerateInterpolator();\n\n        ZOOM_DURATION:number = IPhotoView.DEFAULT_ZOOM_DURATION;\n\n        static EDGE_NONE:number = -1;\n\n        static EDGE_LEFT:number = 0;\n\n        static EDGE_RIGHT:number = 1;\n\n        static EDGE_BOTH:number = 2;\n\n        private mMinScale:number = IPhotoView.DEFAULT_MIN_SCALE;\n\n        private mMidScale:number = IPhotoView.DEFAULT_MID_SCALE;\n\n        private mMaxScale:number = IPhotoView.DEFAULT_MAX_SCALE;\n\n        private mAllowParentInterceptOnEdge:boolean = true;\n\n        private mBlockParentIntercept:boolean = false;\n\n        private static checkZoomLevels(minZoom:number, midZoom:number, maxZoom:number):void {\n            if (minZoom >= midZoom) {\n                throw Error(`new IllegalArgumentException(\"MinZoom has to be less than MidZoom\")`);\n            } else if (midZoom >= maxZoom) {\n                throw Error(`new IllegalArgumentException(\"MidZoom has to be less than MaxZoom\")`);\n            }\n        }\n\n        /**\n         * @return true if the ImageView exists, and it's Drawable existss\n         */\n        private static hasDrawable(imageView:ImageView):boolean {\n            return null != imageView && null != imageView.getDrawable();\n        }\n\n        /**\n         * @return true if the ScaleType is supported.\n         */\n        private static isSupportedScaleType(scaleType:ScaleType):boolean {\n            if (null == scaleType) {\n                return false;\n            }\n            switch (scaleType) {\n                case ScaleType.MATRIX:\n                    throw Error(`new IllegalArgumentException(ScaleType.MATRIX is not supported in PhotoView)`);\n                default:\n                    return true;\n            }\n        }\n\n        /**\n         * Set's the ImageView's ScaleType to Matrix.\n         */\n        private static setImageViewScaleTypeMatrix(imageView:ImageView):void {\n            /**\n             * PhotoView sets it's own ScaleType to Matrix, then diverts all calls\n             * setScaleType to this.setScaleType automatically.\n             */\n            if (null != imageView && !(IPhotoView.isImpl(imageView))) {\n                if (ScaleType.MATRIX != (imageView.getScaleType())) {\n                    imageView.setScaleType(ScaleType.MATRIX);\n                }\n            }\n        }\n\n        private mImageView:WeakReference<ImageView>;\n\n        // Gesture Detectors\n        private mGestureDetector:android.view.GestureDetector;\n\n        private mScaleDragDetector:GestureDetector;\n\n        // These are set so we don't keep allocating them on the heap\n        private mBaseMatrix:Matrix = new Matrix();\n\n        private mDrawMatrix:Matrix = new Matrix();\n\n        private mSuppMatrix:Matrix = new Matrix();\n\n        private mDisplayRect:RectF = new RectF();\n\n        private mMatrixValues:number[] = androidui.util.ArrayCreator.newNumberArray(9);\n\n        // Listeners\n        private mMatrixChangeListener:PhotoViewAttacher.OnMatrixChangedListener;\n\n        private mPhotoTapListener:PhotoViewAttacher.OnPhotoTapListener;\n\n        private mViewTapListener:PhotoViewAttacher.OnViewTapListener;\n\n        private mLongClickListener:OnLongClickListener;\n\n        private mScaleChangeListener:PhotoViewAttacher.OnScaleChangeListener;\n\n        private mIvTop:number = 0;\n        private mIvRight:number = 0;\n        private mIvBottom:number = 0;\n        private mIvLeft:number = 0;\n\n        private mCurrentFlingRunnable:PhotoViewAttacher.FlingRunnable;\n\n        private mScrollEdge:number = PhotoViewAttacher.EDGE_BOTH;\n\n        private mZoomEnabled:boolean;\n\n        private mScaleType:ScaleType = ScaleType.FIT_CENTER;\n\n        constructor(imageView:ImageView, zoomable = true) {\n            this.mImageView = new WeakReference(imageView);\n            //imageView.setDrawingCacheEnabled(true);\n            imageView.setOnTouchListener(this);\n            let observer:ViewTreeObserver = imageView.getViewTreeObserver();\n            if (null != observer)\n                observer.addOnGlobalLayoutListener(this);\n            // Make sure we using MATRIX Scale Type\n            PhotoViewAttacher.setImageViewScaleTypeMatrix(imageView);\n            //if (imageView.isInEditMode()) {\n            //    return;\n            //}\n            // Create Gesture Detectors...\n            this.mScaleDragDetector = new GestureDetector();\n            this.mScaleDragDetector.setOnGestureListener(this);\n            this.mGestureDetector = new android.view.GestureDetector((()=> {\n                const inner_this = this;\n                class _Inner extends android.view.GestureDetector.SimpleOnGestureListener {\n                    // forward long click listener\n                    onLongPress(e:MotionEvent):void {\n                        if (null != inner_this.mLongClickListener) {\n                            inner_this.mLongClickListener.onLongClick(inner_this.getImageView());\n                        }\n                    }\n                }\n                return new _Inner();\n            })());\n            this.mGestureDetector.setOnDoubleTapListener(new PhotoViewAttacher.DefaultOnDoubleTapListener(this));\n            // Finally, update the UI so that we're zoomable\n            this.setZoomable(zoomable);\n        }\n\n        setOnDoubleTapListener(newOnDoubleTapListener:android.view.GestureDetector.OnDoubleTapListener):void {\n            if (newOnDoubleTapListener != null) {\n                this.mGestureDetector.setOnDoubleTapListener(newOnDoubleTapListener);\n            } else {\n                this.mGestureDetector.setOnDoubleTapListener(new PhotoViewAttacher.DefaultOnDoubleTapListener(this));\n            }\n        }\n\n        setOnScaleChangeListener(onScaleChangeListener:PhotoViewAttacher.OnScaleChangeListener):void {\n            this.mScaleChangeListener = onScaleChangeListener;\n        }\n\n        canZoom():boolean {\n            return this.mZoomEnabled;\n        }\n\n        /**\n         * Clean-up the resources attached to this object. This needs to be called when the ImageView is\n         * no longer used. A good example is from {@link View#onDetachedFromWindow()} or\n         * from {@link android.app.Activity#onDestroy()}. This is automatically called if you are using\n         * {@link uk.co.senab.photoview.PhotoView}.\n         */\n        cleanup():void {\n            if (null == this.mImageView) {\n                // cleanup already done\n                return;\n            }\n            const imageView:ImageView = this.mImageView.get();\n            if (null != imageView) {\n                // Remove this as a global layout listener\n                let observer:ViewTreeObserver = imageView.getViewTreeObserver();\n                if (null != observer && observer.isAlive()) {\n                    observer.removeGlobalOnLayoutListener(this);\n                }\n                // Remove the ImageView's reference to this\n                imageView.setOnTouchListener(null);\n                // make sure a pending fling runnable won't be run\n                this.cancelFling();\n            }\n            if (null != this.mGestureDetector) {\n                this.mGestureDetector.setOnDoubleTapListener(null);\n            }\n            // Clear listeners too\n            this.mMatrixChangeListener = null;\n            this.mPhotoTapListener = null;\n            this.mViewTapListener = null;\n            // Finally, clear ImageView\n            this.mImageView = null;\n        }\n\n        getDisplayRect():RectF {\n            this.checkMatrixBounds();\n            return this._getDisplayRect(this.getDrawMatrix());\n        }\n\n        setDisplayMatrix(finalMatrix:Matrix):boolean {\n            if (finalMatrix == null)\n                throw Error(`new IllegalArgumentException(\"Matrix cannot be null\")`);\n            let imageView:ImageView = this.getImageView();\n            if (null == imageView)\n                return false;\n            if (null == imageView.getDrawable())\n                return false;\n            this.mSuppMatrix.set(finalMatrix);\n            this.setImageViewMatrix(this.getDrawMatrix());\n            this.checkMatrixBounds();\n            return true;\n        }\n\n        /**\n         * @deprecated use {@link #setRotationTo(float)}\n         */\n        setPhotoViewRotation(degrees:number):void {\n            this.mSuppMatrix.setRotate(degrees % 360);\n            this.checkAndDisplayMatrix();\n        }\n\n        setRotationTo(degrees:number):void {\n            this.mSuppMatrix.setRotate(degrees % 360);\n            this.checkAndDisplayMatrix();\n        }\n\n        setRotationBy(degrees:number):void {\n            this.mSuppMatrix.postRotate(degrees % 360);\n            this.checkAndDisplayMatrix();\n        }\n\n        getImageView():ImageView {\n            let imageView:ImageView = null;\n            if (null != this.mImageView) {\n                imageView = this.mImageView.get();\n            }\n            // If we don't have an ImageView, call cleanup()\n            if (null == imageView) {\n                this.cleanup();\n                if (PhotoViewAttacher.DEBUG)\n                    Log.i(PhotoViewAttacher.LOG_TAG, \"ImageView no longer exists. You should not use this PhotoViewAttacher any more.\");\n            }\n            return imageView;\n        }\n\n        getMinScale():number {\n            return this.getMinimumScale();\n        }\n\n        getMinimumScale():number {\n            return this.mMinScale;\n        }\n\n        getMidScale():number {\n            return this.getMediumScale();\n        }\n\n        getMediumScale():number {\n            return this.mMidScale;\n        }\n\n        getMaxScale():number {\n            return this.getMaximumScale();\n        }\n\n        getMaximumScale():number {\n            return this.mMaxScale;\n        }\n\n        getScale():number {\n            return <number> Math.sqrt(<number> Math.pow(this.getValue(this.mSuppMatrix, Matrix.MSCALE_X), 2) + <number> Math.pow(this.getValue(this.mSuppMatrix, Matrix.MSKEW_Y), 2));\n        }\n\n        getScaleType():ScaleType {\n            return this.mScaleType;\n        }\n\n        onDrag(dx:number, dy:number):void {\n            if (this.mScaleDragDetector.isScaling()) {\n                // Do not drag if we are already scaling\n                return;\n            }\n            if (PhotoViewAttacher.DEBUG) {\n                Log.d(PhotoViewAttacher.LOG_TAG, `onDrag: dx: ${dx.toFixed(2)}. dy: ${dy.toFixed(2)}`);\n            }\n            let imageView:ImageView = this.getImageView();\n            this.mSuppMatrix.postTranslate(dx, dy);\n            this.checkAndDisplayMatrix();\n            /**\n             * Here we decide whether to let the ImageView's parent to start taking\n             * over the touch event.\n             *\n             * First we check whether this function is enabled. We never want the\n             * parent to take over if we're scaling. We then check the edge we're\n             * on, and the direction of the scroll (i.e. if we're pulling against\n             * the edge, aka 'overscrolling', let the parent take over).\n             */\n            let parent:ViewParent = imageView.getParent();\n            if (this.mAllowParentInterceptOnEdge && !this.mScaleDragDetector.isScaling() && !this.mBlockParentIntercept) {\n                if (this.mScrollEdge == PhotoViewAttacher.EDGE_BOTH || (this.mScrollEdge == PhotoViewAttacher.EDGE_LEFT && dx >= 1) || (this.mScrollEdge == PhotoViewAttacher.EDGE_RIGHT && dx <= -1)) {\n                    if (null != parent)\n                        parent.requestDisallowInterceptTouchEvent(false);\n                }\n            } else {\n                if (null != parent) {\n                    parent.requestDisallowInterceptTouchEvent(true);\n                }\n            }\n        }\n\n        onFling(startX:number, startY:number, velocityX:number, velocityY:number):void {\n            if (PhotoViewAttacher.DEBUG) {\n                Log.d(PhotoViewAttacher.LOG_TAG, \"onFling. sX: \" + startX + \" sY: \" + startY + \" Vx: \" + velocityX + \" Vy: \" + velocityY);\n            }\n            let imageView:ImageView = this.getImageView();\n            this.mCurrentFlingRunnable = new PhotoViewAttacher.FlingRunnable(this);\n            this.mCurrentFlingRunnable.fling(this.getImageViewWidth(imageView), this.getImageViewHeight(imageView), Math.floor(velocityX), Math.floor(velocityY));\n            imageView.post(this.mCurrentFlingRunnable);\n        }\n\n        onGlobalLayout():void {\n            let imageView:ImageView = this.getImageView();\n            if (null != imageView) {\n                if (this.mZoomEnabled) {\n                    const top:number = imageView.getTop();\n                    const right:number = imageView.getRight();\n                    const bottom:number = imageView.getBottom();\n                    const left:number = imageView.getLeft();\n                    /**\n                     * We need to check whether the ImageView's bounds have changed.\n                     * This would be easier if we targeted API 11+ as we could just use\n                     * View.OnLayoutChangeListener. Instead we have to replicate the\n                     * work, keeping track of the ImageView's bounds and then checking\n                     * if the values change.\n                     */\n                    if (top != this.mIvTop || bottom != this.mIvBottom || left != this.mIvLeft || right != this.mIvRight) {\n                        // Update our base matrix, as the bounds have changed\n                        this.updateBaseMatrix(imageView.getDrawable());\n                        // Update values as something has changed\n                        this.mIvTop = top;\n                        this.mIvRight = right;\n                        this.mIvBottom = bottom;\n                        this.mIvLeft = left;\n                    }\n                } else {\n                    this.updateBaseMatrix(imageView.getDrawable());\n                }\n            }\n        }\n\n        onScale(scaleFactor:number, focusX:number, focusY:number):void {\n            if (PhotoViewAttacher.DEBUG) {\n                Log.d(PhotoViewAttacher.LOG_TAG, `onScale: scale: ${scaleFactor.toFixed(2)}. fX: ${focusX.toFixed(2)}. fY: ${focusY.toFixed(2)}f`);\n            }\n            if (this.getScale() < this.mMaxScale || scaleFactor < 1) {\n                if (null != this.mScaleChangeListener) {\n                    this.mScaleChangeListener.onScaleChange(scaleFactor, focusX, focusY);\n                }\n                this.mSuppMatrix.postScale(scaleFactor, scaleFactor, focusX, focusY);\n                this.checkAndDisplayMatrix();\n            }\n        }\n\n        onTouch(v:View, ev:MotionEvent):boolean {\n            let handled:boolean = false;\n            if (this.mZoomEnabled && PhotoViewAttacher.hasDrawable(<ImageView> v)) {\n                let parent:ViewParent = v.getParent();\n                switch (ev.getAction()) {\n                    case ACTION_DOWN:\n                        // event\n                        if (null != parent) {\n                            parent.requestDisallowInterceptTouchEvent(true);\n                        } else {\n                            Log.i(PhotoViewAttacher.LOG_TAG, \"onTouch getParent() returned null\");\n                        }\n                        // If we're flinging, and the user presses down, cancel\n                        // fling\n                        this.cancelFling();\n                        break;\n                    case ACTION_CANCEL:\n                    case ACTION_UP:\n                        // to min scale\n                        if (this.getScale() < this.mMinScale) {\n                            let rect:RectF = this.getDisplayRect();\n                            if (null != rect) {\n                                v.post(new PhotoViewAttacher.AnimatedZoomRunnable(this, this.getScale(), this.mMinScale, rect.centerX(), rect.centerY()));\n                                handled = true;\n                            }\n                        }\n                        break;\n                }\n                // Try the Scale/Drag detector\n                if (null != this.mScaleDragDetector) {\n                    let wasScaling:boolean = this.mScaleDragDetector.isScaling();\n                    let wasDragging:boolean = this.mScaleDragDetector.isDragging();\n                    handled = this.mScaleDragDetector.onTouchEvent(ev);\n                    let didntScale:boolean = !wasScaling && !this.mScaleDragDetector.isScaling();\n                    let didntDrag:boolean = !wasDragging && !this.mScaleDragDetector.isDragging();\n                    this.mBlockParentIntercept = didntScale && didntDrag;\n                }\n                // Check to see if the user double tapped\n                if (null != this.mGestureDetector && this.mGestureDetector.onTouchEvent(ev)) {\n                    handled = true;\n                }\n            }\n            return handled;\n        }\n\n        setAllowParentInterceptOnEdge(allow:boolean):void {\n            this.mAllowParentInterceptOnEdge = allow;\n        }\n\n        setMinScale(minScale:number):void {\n            this.setMinimumScale(minScale);\n        }\n\n        setMinimumScale(minimumScale:number):void {\n            PhotoViewAttacher.checkZoomLevels(minimumScale, this.mMidScale, this.mMaxScale);\n            this.mMinScale = minimumScale;\n        }\n\n        setMidScale(midScale:number):void {\n            this.setMediumScale(midScale);\n        }\n\n        setMediumScale(mediumScale:number):void {\n            PhotoViewAttacher.checkZoomLevels(this.mMinScale, mediumScale, this.mMaxScale);\n            this.mMidScale = mediumScale;\n        }\n\n        setMaxScale(maxScale:number):void {\n            this.setMaximumScale(maxScale);\n        }\n\n        setMaximumScale(maximumScale:number):void {\n            PhotoViewAttacher.checkZoomLevels(this.mMinScale, this.mMidScale, maximumScale);\n            this.mMaxScale = maximumScale;\n        }\n\n        setScaleLevels(minimumScale:number, mediumScale:number, maximumScale:number):void {\n            PhotoViewAttacher.checkZoomLevels(minimumScale, mediumScale, maximumScale);\n            this.mMinScale = minimumScale;\n            this.mMidScale = mediumScale;\n            this.mMaxScale = maximumScale;\n        }\n\n        setOnLongClickListener(listener:OnLongClickListener):void {\n            this.mLongClickListener = listener;\n        }\n\n        setOnMatrixChangeListener(listener:PhotoViewAttacher.OnMatrixChangedListener):void {\n            this.mMatrixChangeListener = listener;\n        }\n\n        setOnPhotoTapListener(listener:PhotoViewAttacher.OnPhotoTapListener):void {\n            this.mPhotoTapListener = listener;\n        }\n\n        getOnPhotoTapListener():PhotoViewAttacher.OnPhotoTapListener {\n            return this.mPhotoTapListener;\n        }\n\n        setOnViewTapListener(listener:PhotoViewAttacher.OnViewTapListener):void {\n            this.mViewTapListener = listener;\n        }\n\n        getOnViewTapListener():PhotoViewAttacher.OnViewTapListener {\n            return this.mViewTapListener;\n        }\n\n        setScale(scale:number, animate?:boolean):void;\n        setScale(scale:number, focalX:number, focalY:number, animate?:boolean):void;\n        setScale(...args):void {\n            if (args.length >= 3) {\n                (<any>this).setScale_4(...args);\n            } else {\n                (<any>this).setScale_2(...args);\n            }\n        }\n\n        private setScale_2(scale:number, animate = false):void {\n            let imageView:ImageView = this.getImageView();\n            if (null != imageView) {\n                this.setScale(scale, (imageView.getRight()) / 2, (imageView.getBottom()) / 2, animate);\n            }\n        }\n\n        private setScale_4(scale:number, focalX:number, focalY:number, animate = false):void {\n            let imageView:ImageView = this.getImageView();\n            if (null != imageView) {\n                // Check to see if the scale is within bounds\n                if (scale < this.mMinScale || scale > this.mMaxScale) {\n                    Log.i(PhotoViewAttacher.LOG_TAG, \"Scale must be within the range of minScale and maxScale\");\n                    return;\n                }\n                if (animate) {\n                    imageView.post(new PhotoViewAttacher.AnimatedZoomRunnable(this, this.getScale(), scale, focalX, focalY));\n                } else {\n                    this.mSuppMatrix.setScale(scale, scale, focalX, focalY);\n                    this.checkAndDisplayMatrix();\n                }\n            }\n        }\n\n        setScaleType(scaleType:ScaleType):void {\n            if (PhotoViewAttacher.isSupportedScaleType(scaleType) && scaleType != this.mScaleType) {\n                this.mScaleType = scaleType;\n                // Finally update\n                this.update();\n            }\n        }\n\n        setZoomable(zoomable:boolean):void {\n            this.mZoomEnabled = zoomable;\n            this.update();\n        }\n\n        update():void {\n            let imageView:ImageView = this.getImageView();\n            if (null != imageView) {\n                if (this.mZoomEnabled) {\n                    // Make sure we using MATRIX Scale Type\n                    PhotoViewAttacher.setImageViewScaleTypeMatrix(imageView);\n                    // Update the base matrix using the current drawable\n                    this.updateBaseMatrix(imageView.getDrawable());\n                } else {\n                    // Reset the Matrix...\n                    this.resetMatrix();\n                }\n            }\n        }\n\n        getDisplayMatrix():Matrix {\n            return new Matrix(this.getDrawMatrix());\n        }\n\n        getDrawMatrix():Matrix {\n            this.mDrawMatrix.set(this.mBaseMatrix);\n            this.mDrawMatrix.postConcat(this.mSuppMatrix);\n            return this.mDrawMatrix;\n        }\n\n        private cancelFling():void {\n            if (null != this.mCurrentFlingRunnable) {\n                this.mCurrentFlingRunnable.cancelFling();\n                this.mCurrentFlingRunnable = null;\n            }\n        }\n\n        /**\n         * Helper method that simply checks the Matrix, and then displays the result\n         */\n        private checkAndDisplayMatrix():void {\n            if (this.checkMatrixBounds()) {\n                this.setImageViewMatrix(this.getDrawMatrix());\n            }\n        }\n\n        private checkImageViewScaleType():void {\n            let imageView:ImageView = this.getImageView();\n            /**\n             * PhotoView's getScaleType() will just divert to this.getScaleType() so\n             * only call if we're not attached to a PhotoView.\n             */\n            if (null != imageView && !(IPhotoView.isImpl(imageView))) {\n                if (ScaleType.MATRIX != (imageView.getScaleType())) {\n                    throw Error(`new IllegalStateException(\"The ImageView's ScaleType has been changed since attaching a PhotoViewAttacher\")`);\n                }\n            }\n        }\n\n        private checkMatrixBounds():boolean {\n            const imageView:ImageView = this.getImageView();\n            if (null == imageView) {\n                return false;\n            }\n            const rect:RectF = this._getDisplayRect(this.getDrawMatrix());\n            if (null == rect) {\n                return false;\n            }\n            const height:number = rect.height(), width:number = rect.width();\n            let deltaX:number = 0, deltaY:number = 0;\n            const viewHeight:number = this.getImageViewHeight(imageView);\n            if (height <= viewHeight) {\n                switch (this.mScaleType) {\n                    case ScaleType.FIT_START:\n                        deltaY = -rect.top;\n                        break;\n                    case ScaleType.FIT_END:\n                        deltaY = viewHeight - height - rect.top;\n                        break;\n                    default:\n                        deltaY = (viewHeight - height) / 2 - rect.top;\n                        break;\n                }\n            } else if (rect.top > 0) {\n                deltaY = -rect.top;\n            } else if (rect.bottom < viewHeight) {\n                deltaY = viewHeight - rect.bottom;\n            }\n            const viewWidth:number = this.getImageViewWidth(imageView);\n            if (width <= viewWidth) {\n                switch (this.mScaleType) {\n                    case ScaleType.FIT_START:\n                        deltaX = -rect.left;\n                        break;\n                    case ScaleType.FIT_END:\n                        deltaX = viewWidth - width - rect.left;\n                        break;\n                    default:\n                        deltaX = (viewWidth - width) / 2 - rect.left;\n                        break;\n                }\n                this.mScrollEdge = PhotoViewAttacher.EDGE_BOTH;\n            } else if (rect.left > 0) {\n                this.mScrollEdge = PhotoViewAttacher.EDGE_LEFT;\n                deltaX = -rect.left;\n            } else if (rect.right < viewWidth) {\n                deltaX = viewWidth - rect.right;\n                this.mScrollEdge = PhotoViewAttacher.EDGE_RIGHT;\n            } else {\n                this.mScrollEdge = PhotoViewAttacher.EDGE_NONE;\n            }\n            // Finally actually translate the matrix\n            this.mSuppMatrix.postTranslate(deltaX, deltaY);\n            return true;\n        }\n\n        /**\n         * Helper method that maps the supplied Matrix to the current Drawable\n         *\n         * @param matrix - Matrix to map Drawable against\n         * @return RectF - Displayed Rectangle\n         */\n        private _getDisplayRect(matrix:Matrix):RectF {\n            let imageView:ImageView = this.getImageView();\n            if (null != imageView) {\n                let d:Drawable = imageView.getDrawable();\n                if (null != d) {\n                    this.mDisplayRect.set(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());\n                    matrix.mapRect(this.mDisplayRect);\n                    return this.mDisplayRect;\n                }\n            }\n            return null;\n        }\n\n        getVisibleRectangleBitmap():Canvas {\n            let imageView:ImageView = this.getImageView();\n            return imageView == null ? null : imageView.getDrawingCache();\n        }\n\n        setZoomTransitionDuration(milliseconds:number):void {\n            if (milliseconds < 0)\n                milliseconds = IPhotoView.DEFAULT_ZOOM_DURATION;\n            this.ZOOM_DURATION = milliseconds;\n        }\n\n        getIPhotoViewImplementation():IPhotoView {\n            return this;\n        }\n\n        /**\n         * Helper method that 'unpacks' a Matrix and returns the required value\n         *\n         * @param matrix     - Matrix to unpack\n         * @param whichValue - Which value from Matrix.M* to return\n         * @return float - returned value\n         */\n        private getValue(matrix:Matrix, whichValue:number):number {\n            matrix.getValues(this.mMatrixValues);\n            return this.mMatrixValues[whichValue];\n        }\n\n        /**\n         * Resets the Matrix back to FIT_CENTER, and then displays it.s\n         */\n        private resetMatrix():void {\n            this.mSuppMatrix.reset();\n            this.setImageViewMatrix(this.getDrawMatrix());\n            this.checkMatrixBounds();\n        }\n\n        private setImageViewMatrix(matrix:Matrix):void {\n            let imageView:ImageView = this.getImageView();\n            if (null != imageView) {\n                this.checkImageViewScaleType();\n                imageView.setImageMatrix(matrix);\n                // Call MatrixChangedListener if needed\n                if (null != this.mMatrixChangeListener) {\n                    let displayRect:RectF = this._getDisplayRect(matrix);\n                    if (null != displayRect) {\n                        this.mMatrixChangeListener.onMatrixChanged(displayRect);\n                    }\n                }\n            }\n        }\n\n        /**\n         * Calculate Matrix for FIT_CENTER\n         *\n         * @param d - Drawable being displayed\n         */\n        private updateBaseMatrix(d:Drawable):void {\n            let imageView:ImageView = this.getImageView();\n            if (null == imageView || null == d) {\n                return;\n            }\n            const viewWidth:number = this.getImageViewWidth(imageView);\n            const viewHeight:number = this.getImageViewHeight(imageView);\n            const drawableWidth:number = d.getIntrinsicWidth();\n            const drawableHeight:number = d.getIntrinsicHeight();\n            this.mBaseMatrix.reset();\n            const widthScale:number = viewWidth / drawableWidth;\n            const heightScale:number = viewHeight / drawableHeight;\n            if (this.mScaleType == ScaleType.CENTER) {\n                this.mBaseMatrix.postTranslate((viewWidth - drawableWidth) / 2, (viewHeight - drawableHeight) / 2);\n            } else if (this.mScaleType == ScaleType.CENTER_CROP) {\n                let scale:number = Math.max(widthScale, heightScale);\n                this.mBaseMatrix.postScale(scale, scale);\n                this.mBaseMatrix.postTranslate((viewWidth - drawableWidth * scale) / 2, (viewHeight - drawableHeight * scale) / 2);\n            } else if (this.mScaleType == ScaleType.CENTER_INSIDE) {\n                let scale:number = Math.min(1.0, Math.min(widthScale, heightScale));\n                this.mBaseMatrix.postScale(scale, scale);\n                this.mBaseMatrix.postTranslate((viewWidth - drawableWidth * scale) / 2, (viewHeight - drawableHeight * scale) / 2);\n            } else {\n                let mTempSrc:RectF = new RectF(0, 0, drawableWidth, drawableHeight);\n                let mTempDst:RectF = new RectF(0, 0, viewWidth, viewHeight);\n                switch (this.mScaleType) {\n                    case ScaleType.FIT_CENTER:\n                        this.mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.CENTER);\n                        break;\n                    case ScaleType.FIT_START:\n                        this.mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.START);\n                        break;\n                    case ScaleType.FIT_END:\n                        this.mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.END);\n                        break;\n                    case ScaleType.FIT_XY:\n                        this.mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.FILL);\n                        break;\n                    default:\n                        break;\n                }\n            }\n            this.resetMatrix();\n        }\n\n        private getImageViewWidth(imageView:ImageView):number {\n            if (null == imageView)\n                return 0;\n            return imageView.getWidth() - imageView.getPaddingLeft() - imageView.getPaddingRight();\n        }\n\n        private getImageViewHeight(imageView:ImageView):number {\n            if (null == imageView)\n                return 0;\n            return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();\n        }\n\n    }\n\n    export module PhotoViewAttacher {\n        /**\n         * Interface definition for a callback to be invoked when the internal Matrix has changed for\n         * this View.\n         *\n         * @author Chris Banes\n         */\n        export interface OnMatrixChangedListener {\n\n            /**\n             * Callback for when the Matrix displaying the Drawable has changed. This could be because\n             * the View's bounds have changed, or the user has zoomed.\n             *\n             * @param rect - Rectangle displaying the Drawable's new bounds.\n             */\n            onMatrixChanged(rect:RectF):void ;\n        }\n        /**\n         * Interface definition for callback to be invoked when attached ImageView scale changes\n         *\n         * @author Marek Sebera\n         */\n        export interface OnScaleChangeListener {\n\n            /**\n             * Callback for when the scale changes\n             *\n             * @param scaleFactor the scale factor (less than 1 for zoom out, greater than 1 for zoom in)\n             * @param focusX      focal point X position\n             * @param focusY      focal point Y position\n             */\n            onScaleChange(scaleFactor:number, focusX:number, focusY:number):void ;\n        }\n        /**\n         * Interface definition for a callback to be invoked when the Photo is tapped with a single\n         * tap.\n         *\n         * @author Chris Banes\n         */\n        export interface OnPhotoTapListener {\n\n            /**\n             * A callback to receive where the user taps on a photo. You will only receive a callback if\n             * the user taps on the actual photo, tapping on 'whitespace' will be ignored.\n             *\n             * @param view - View the user tapped.\n             * @param x    - where the user tapped from the of the Drawable, as percentage of the\n             *             Drawable width.\n             * @param y    - where the user tapped from the top of the Drawable, as percentage of the\n             *             Drawable height.\n             */\n            onPhotoTap(view:View, x:number, y:number):void ;\n        }\n        /**\n         * Interface definition for a callback to be invoked when the ImageView is tapped with a single\n         * tap.\n         *\n         * @author Chris Banes\n         */\n        export interface OnViewTapListener {\n\n            /**\n             * A callback to receive where the user taps on a ImageView. You will receive a callback if\n             * the user taps anywhere on the view, tapping on 'whitespace' will not be ignored.\n             *\n             * @param view - View the user tapped.\n             * @param x    - where the user tapped from the left of the View.\n             * @param y    - where the user tapped from the top of the View.\n             */\n            onViewTap(view:View, x:number, y:number):void ;\n        }\n        export class AnimatedZoomRunnable implements Runnable {\n            _PhotoViewAttacher_this:PhotoViewAttacher;\n\n            private mFocalX:number = 0;\n            private mFocalY:number = 0;\n\n            private mStartTime:number = 0;\n\n            private mZoomStart:number = 0;\n            private mZoomEnd:number = 0;\n\n            constructor(arg:PhotoViewAttacher, currentZoom:number, targetZoom:number, focalX:number, focalY:number) {\n                this._PhotoViewAttacher_this = arg;\n                this.mFocalX = focalX;\n                this.mFocalY = focalY;\n                this.mStartTime = System.currentTimeMillis();\n                this.mZoomStart = currentZoom;\n                this.mZoomEnd = targetZoom;\n            }\n\n            run():void {\n                let imageView:ImageView = this._PhotoViewAttacher_this.getImageView();\n                if (imageView == null) {\n                    return;\n                }\n                let t:number = this.interpolate();\n                let scale:number = this.mZoomStart + t * (this.mZoomEnd - this.mZoomStart);\n                let deltaScale:number = scale / this._PhotoViewAttacher_this.getScale();\n                this._PhotoViewAttacher_this.onScale(deltaScale, this.mFocalX, this.mFocalY);\n                // We haven't hit our target scale yet, so post ourselves again\n                if (t < 1) {\n                    imageView.postOnAnimation(this);\n                }\n            }\n\n            private interpolate():number {\n                let t:number = 1 * (System.currentTimeMillis() - this.mStartTime) / this._PhotoViewAttacher_this.ZOOM_DURATION;\n                t = Math.min(1, t);\n                t = PhotoViewAttacher.sInterpolator.getInterpolation(t);\n                return t;\n            }\n        }\n        export class FlingRunnable implements Runnable {\n            _PhotoViewAttacher_this:PhotoViewAttacher;\n\n            constructor(arg:PhotoViewAttacher) {\n                this._PhotoViewAttacher_this = arg;\n                this.mScroller = new OverScroller();\n            }\n\n            private mScroller:OverScroller;\n\n            private mCurrentX:number = 0;\n            private mCurrentY:number = 0;\n\n            cancelFling():void {\n                if (PhotoViewAttacher.DEBUG) {\n                    Log.d(PhotoViewAttacher.LOG_TAG, \"Cancel Fling\");\n                }\n                this.mScroller.forceFinished(true);\n            }\n\n            fling(viewWidth:number, viewHeight:number, velocityX:number, velocityY:number):void {\n                const rect:RectF = this._PhotoViewAttacher_this.getDisplayRect();\n                if (null == rect) {\n                    return;\n                }\n                const startX:number = Math.round(-rect.left);\n                let minX:number, maxX:number, minY:number, maxY:number;\n                if (viewWidth < rect.width()) {\n                    minX = 0;\n                    maxX = Math.round(rect.width() - viewWidth);\n                } else {\n                    minX = maxX = startX;\n                }\n                const startY:number = Math.round(-rect.top);\n                if (viewHeight < rect.height()) {\n                    minY = 0;\n                    maxY = Math.round(rect.height() - viewHeight);\n                } else {\n                    minY = maxY = startY;\n                }\n                this.mCurrentX = startX;\n                this.mCurrentY = startY;\n                if (PhotoViewAttacher.DEBUG) {\n                    Log.d(PhotoViewAttacher.LOG_TAG, \"fling. StartX:\" + startX + \" StartY:\" + startY + \" MaxX:\" + maxX + \" MaxY:\" + maxY);\n                }\n                // If we actually can move, fling the scroller\n                if (startX != maxX || startY != maxY) {\n                    this.mScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, 0, 0);\n                }\n            }\n\n            run():void {\n                if (this.mScroller.isFinished()) {\n                    // remaining post that should not be handled\n                    return;\n                }\n                let imageView:ImageView = this._PhotoViewAttacher_this.getImageView();\n                if (null != imageView && this.mScroller.computeScrollOffset()) {\n                    const newX:number = this.mScroller.getCurrX();\n                    const newY:number = this.mScroller.getCurrY();\n                    if (PhotoViewAttacher.DEBUG) {\n                        Log.d(PhotoViewAttacher.LOG_TAG, \"fling run(). CurrentX:\" + this.mCurrentX + \" CurrentY:\" + this.mCurrentY + \" NewX:\" + newX + \" NewY:\" + newY);\n                    }\n                    this._PhotoViewAttacher_this.mSuppMatrix.postTranslate(this.mCurrentX - newX, this.mCurrentY - newY);\n                    this._PhotoViewAttacher_this.setImageViewMatrix(this._PhotoViewAttacher_this.getDrawMatrix());\n                    this.mCurrentX = newX;\n                    this.mCurrentY = newY;\n                    // Post On animation\n                    imageView.postOnAnimation(this);\n                }\n            }\n        }\n        /**\n         * Provided default implementation of GestureDetector.OnDoubleTapListener, to be overriden with custom behavior, if needed\n         * <p>&nbsp;</p>\n         * To be used via {@link PhotoViewAttacher#setOnDoubleTapListener(android.view.GestureDetector.OnDoubleTapListener)}\n         */\n        export class DefaultOnDoubleTapListener implements android.view.GestureDetector.OnDoubleTapListener {\n\n            private photoViewAttacher:PhotoViewAttacher;\n\n            /**\n             * Default constructor\n             *\n             * @param photoViewAttacher PhotoViewAttacher to bind to\n             */\n            constructor(photoViewAttacher:PhotoViewAttacher) {\n                this.setPhotoViewAttacher(photoViewAttacher);\n            }\n\n            /**\n             * Allows to change PhotoViewAttacher within range of single instance\n             *\n             * @param newPhotoViewAttacher PhotoViewAttacher to bind to\n             */\n            setPhotoViewAttacher(newPhotoViewAttacher:PhotoViewAttacher):void {\n                this.photoViewAttacher = newPhotoViewAttacher;\n            }\n\n            onSingleTapConfirmed(e:MotionEvent):boolean {\n                if (this.photoViewAttacher == null)\n                    return false;\n                let imageView:ImageView = this.photoViewAttacher.getImageView();\n                if (null != this.photoViewAttacher.getOnPhotoTapListener()) {\n                    const displayRect:RectF = this.photoViewAttacher.getDisplayRect();\n                    if (null != displayRect) {\n                        const x:number = e.getX(), y:number = e.getY();\n                        // Check to see if the user tapped on the photo\n                        if (displayRect.contains(x, y)) {\n                            let xResult:number = (x - displayRect.left) / displayRect.width();\n                            let yResult:number = (y - displayRect.top) / displayRect.height();\n                            this.photoViewAttacher.getOnPhotoTapListener().onPhotoTap(imageView, xResult, yResult);\n                            return true;\n                        }\n                    }\n                }\n                if (null != this.photoViewAttacher.getOnViewTapListener()) {\n                    this.photoViewAttacher.getOnViewTapListener().onViewTap(imageView, e.getX(), e.getY());\n                }\n                return false;\n            }\n\n            onDoubleTap(ev:MotionEvent):boolean {\n                if (this.photoViewAttacher == null)\n                    return false;\n                try {\n                    let scale:number = this.photoViewAttacher.getScale();\n                    let x:number = ev.getX();\n                    let y:number = ev.getY();\n                    if (scale < this.photoViewAttacher.getMediumScale()) {\n                        this.photoViewAttacher.setScale(this.photoViewAttacher.getMediumScale(), x, y, true);\n                    } else if (scale >= this.photoViewAttacher.getMediumScale() && scale < this.photoViewAttacher.getMaximumScale()) {\n                        this.photoViewAttacher.setScale(this.photoViewAttacher.getMaximumScale(), x, y, true);\n                    } else {\n                        this.photoViewAttacher.setScale(this.photoViewAttacher.getMinimumScale(), x, y, true);\n                    }\n                } catch (e) {\n                }\n                return true;\n            }\n\n            onDoubleTapEvent(e:MotionEvent):boolean {\n                // Wait for the confirmed onDoubleTap() instead\n                return false;\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "src/pack_enter.ts",
    "content": "\n//use the deepest sub class as enter\n///<reference path=\"android/app/Application.ts\"/>\n///<reference path=\"android/view/GestureDetector.ts\"/>\n\n///<reference path=\"android/widget/FrameLayout.ts\"/>\n///<reference path=\"android/widget/ScrollView.ts\"/>\n///<reference path=\"android/widget/LinearLayout.ts\"/>\n///<reference path=\"android/widget/RelativeLayout.ts\"/>\n///<reference path=\"android/widget/TextView.ts\"/>\n///<reference path=\"android/widget/Button.ts\"/>\n///<reference path=\"android/widget/EditText.ts\"/>\n///<reference path=\"android/widget/ImageView.ts\"/>\n///<reference path=\"android/widget/ImageButton.ts\"/>\n///<reference path=\"android/widget/ListView.ts\"/>\n///<reference path=\"android/widget/GridView.ts\"/>\n///<reference path=\"android/widget/HorizontalScrollView.ts\"/>\n///<reference path=\"android/widget/NumberPicker.ts\"/>\n///<reference path=\"android/widget/ProgressBar.ts\"/>\n///<reference path=\"android/widget/CheckBox.ts\"/>\n///<reference path=\"android/widget/RadioButton.ts\"/>\n///<reference path=\"android/widget/RadioGroup.ts\"/>\n///<reference path=\"android/widget/CheckedTextView.ts\"/>\n///<reference path=\"android/widget/SeekBar.ts\"/>\n///<reference path=\"android/widget/RatingBar.ts\"/>\n///<reference path=\"android/widget/ExpandableListView.ts\"/>\n///<reference path=\"android/widget/BaseExpandableListAdapter.ts\"/>\n///<reference path=\"android/widget/Toast.ts\"/>\n///<reference path=\"android/widget/Spinner.ts\"/>\n///<reference path=\"android/widget/ListPopupWindow.ts\"/>\n\n///<reference path=\"android/webkit/WebView.ts\"/>\n\n///<reference path=\"android/app/AlertDialog.ts\"/>\n\n\n///<reference path=\"android/view/animation/AlphaAnimation.ts\"/>\n///<reference path=\"android/view/animation/ScaleAnimation.ts\"/>\n///<reference path=\"android/view/animation/RotateAnimation.ts\"/>\n///<reference path=\"android/view/animation/TranslateAnimation.ts\"/>\n///<reference path=\"android/view/animation/AnimationSet.ts\"/>\n\n///<reference path=\"android/view/Menu.ts\"/>\n///<reference path=\"android/view/menu/MenuPopupHelper.ts\"/>\n\n\n///<reference path=\"android/support/v4/view/ViewPager.ts\"/>\n///<reference path=\"android/support/v4/widget/ViewDragHelper.ts\"/>\n///<reference path=\"android/support/v4/widget/DrawerLayout.ts\"/>\n\n///<reference path=\"lib/com/jakewharton/salvage/RecyclingPagerAdapter.ts\"/>\n///<reference path=\"lib/uk/co/senab/photoview/PhotoView.ts\"/>\n\n\n\n///<reference path=\"android/app/Activity.ts\"/>\n///<reference path=\"android/app/ActionBarActivity.ts\"/>\n///<reference path=\"androidui/AndroidUI.ts\"/>\n///<reference path=\"androidui/image/NetDrawable.ts\"/>\n///<reference path=\"androidui/widget/HtmlView.ts\"/>\n///<reference path=\"androidui/widget/HtmlImageView.ts\"/>\n///<reference path=\"androidui/widget/HtmlDataListAdapter.ts\"/>\n///<reference path=\"androidui/widget/HtmlDataPagerAdapter.ts\"/>\n///<reference path=\"androidui/widget/HtmlDataPickerAdapter.ts\"/>\n///<reference path=\"androidui/widget/PullRefreshLoadLayout.ts\"/>\n\n///<reference path=\"androidui/util/PerformanceAdjuster.ts\"/>\n///<reference path=\"androidui/native/NativeApi.ts\"/>\n\nwindow[`android`] = android;\nwindow[`java`] = java;\nwindow[`AndroidUI`] = androidui.AndroidUI;\n(function() {\n\tvar event = document.createEvent(\"CustomEvent\");\n\tevent.initCustomEvent(\"AndroidUILoadFinish\", true, true, null);\n\tdocument.dispatchEvent(event);\n})();\n"
  },
  {
    "path": "src/res/layout/_id_defined.xml",
    "content": "<resources>\n    <item id=\"content\"/>\n    <item id=\"background\"/>\n    <item id=\"secondaryProgress\"/>\n    <item id=\"progress\"/>\n    <item id=\"contentPanel\"/>\n    <item id=\"topPanel\"/>\n    <item id=\"buttonPanel\"/>\n    <item id=\"customPanel\"/>\n    <item id=\"custom\"/>\n    <item id=\"titleDivider\"/>\n    <item id=\"titleDividerTop\"/>\n    <item id=\"title_template\"/>\n    <item id=\"icon\"/>\n    <item id=\"alertTitle\"/>\n    <item id=\"scrollView\"/>\n    <item id=\"message\"/>\n    <item id=\"button1\"/>\n    <item id=\"button2\"/>\n    <item id=\"button3\"/>\n    <item id=\"leftSpacer\"/>\n    <item id=\"rightSpacer\"/>\n    <item id=\"text1\"/>\n</resources>"
  },
  {
    "path": "src/res/layout/action_bar.xml",
    "content": "<merge xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <LinearLayout\n            android:id=\"action_bar_center_layout\"\n            android:layout_height=\"wrap_content\"\n            android:layout_width=\"match_parent\"\n            android:layout_marginLeft=\"60dp\"\n            android:layout_marginRight=\"60dp\"\n            android:minHeight=\"48dp\"\n            android:gravity=\"center\"\n            android:orientation=\"vertical\">\n        <TextView\n                android:id=\"action_bar_title\"\n                android:gravity=\"center\"\n                android:drawablePadding=\"4dp\"\n                android:singleLine=\"true\"\n                android:ellipsize=\"end\"\n                android:textColor=\"@android:color/white\"\n                android:textSize=\"18sp\"/>\n        <TextView\n                android:id=\"action_bar_sub_title\"\n                android:visibility=\"gone\"\n                android:gravity=\"center\"\n                android:layout_marginTop=\"4dp\"\n                android:drawablePadding=\"4dp\"\n                android:singleLine=\"true\"\n                android:ellipsize=\"end\"\n                android:textColor=\"@android:color/white\"\n                android:textSize=\"12sp\"/>\n    </LinearLayout>\n    <Button\n            android:id=\"action_bar_left\"\n            android:visibility=\"gone\"\n            android:layout_gravity=\"left|center_vertical\"\n            android:layout_width=\"wrap_content\"\n            android:background=\"@android:drawable/item_background\"\n            android:textColor=\"@android:color/white\"\n            android:paddingLeft=\"6dp\"\n            android:paddingRight=\"6dp\"\n            android:drawablePadding=\"4dp\"\n            android:minWidth=\"32dp\"\n            android:textSize=\"17sp\"\n            android:singleLine=\"true\"/>\n    <Button\n            android:id=\"action_bar_right\"\n            android:visibility=\"gone\"\n            android:layout_gravity=\"right|center_vertical\"\n            android:layout_width=\"wrap_content\"\n            android:background=\"@android:drawable/item_background\"\n            android:textColor=\"@android:color/white\"\n            android:paddingRight=\"6dp\"\n            android:paddingLeft=\"6dp\"\n            android:drawablePadding=\"4dp\"\n            android:minWidth=\"32dp\"\n            android:textSize=\"17sp\"\n            android:singleLine=\"true\"/>\n</merge>\n"
  },
  {
    "path": "src/res/layout/alert_dialog.xml",
    "content": "\n<!--\n/*\n** Copyright 2010, The Android Open Source Project\n**\n** Licensed under the Apache License, Version 2.0 (the \"License\");\n** you may not use this file except in compliance with the License.\n** You may obtain a copy of the License at\n**\n**     http://www.apache.org/licenses/LICENSE-2.0\n**\n** Unless required by applicable law or agreed to in writing, software\n** distributed under the License is distributed on an \"AS IS\" BASIS,\n** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n** See the License for the specific language governing permissions and\n** limitations under the License.\n*/\n-->\n\n<!--android:viewShadowColor=\"black\"-->\n<!--android:viewShadowDy=\"3dp\"-->\n<!--android:viewShadowRadius=\"10dp\"-->\n<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:id=\"parentPanel\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:layout_marginStart=\"8dip\"\n    android:layout_marginEnd=\"8dip\"\n    android:orientation=\"vertical\">\n\n    <LinearLayout android:id=\"topPanel\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:orientation=\"vertical\">\n        <View android:id=\"titleDividerTop\"\n              android:layout_width=\"match_parent\"\n              android:layout_height=\"1dip\"\n              android:visibility=\"gone\"\n              android:background=\"#aaa\"/>\n        <LinearLayout android:id=\"title_template\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:orientation=\"horizontal\"\n            android:gravity=\"center_vertical|start\"\n            android:minHeight=\"64dp\"\n            android:layout_marginStart=\"16dip\"\n            android:layout_marginEnd=\"16dip\">\n            <ImageView android:id=\"icon\"\n                       android:layout_width=\"wrap_content\"\n                       android:layout_height=\"wrap_content\"\n                       android:paddingEnd=\"8dip\"/>\n            <TextView android:id=\"alertTitle\"\n                      android:maxLines=\"1\"\n                      android:scrollHorizontally=\"true\"\n                      android:textSize=\"22sp\"\n                      android:textColor=\"#333\"\n                      android:singleLine=\"true\"\n                      android:ellipsize=\"end\"\n                      android:layout_width=\"match_parent\"\n                      android:layout_height=\"wrap_content\"\n                      android:textAlignment=\"viewStart\"/>\n        </LinearLayout>\n        <View android:id=\"titleDivider\"\n              android:layout_width=\"match_parent\"\n              android:layout_height=\"1dip\"\n              android:visibility=\"gone\"\n              android:background=\"#aaa\"/>\n        <!-- If the client uses a customTitle, it will be added here. -->\n    </LinearLayout>\n\n    <LinearLayout android:id=\"contentPanel\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_weight=\"1\"\n        android:orientation=\"vertical\"\n        android:minHeight=\"64dp\">\n        <ScrollView android:id=\"scrollView\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:clipToPadding=\"false\">\n            <TextView android:id=\"message\"\n                      android:textSize=\"18sp\"\n                      android:layout_width=\"match_parent\"\n                      android:layout_height=\"wrap_content\"\n                      android:paddingStart=\"16dip\"\n                      android:paddingEnd=\"16dip\"\n                      android:paddingTop=\"8dip\"\n                      android:paddingBottom=\"8dip\"/>\n        </ScrollView>\n    </LinearLayout>\n\n    <FrameLayout android:id=\"customPanel\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_weight=\"1\"\n        android:minHeight=\"64dp\">\n        <FrameLayout android:id=\"custom\"\n                     android:layout_width=\"match_parent\"\n                     android:layout_height=\"wrap_content\"/>\n    </FrameLayout>\n\n    <LinearLayout android:id=\"buttonPanel\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:minHeight=\"48dip\"\n        android:orientation=\"vertical\"\n        android:divider=\"@android:drawable/divider_horizontal\"\n        android:showDividers=\"beginning\"\n        android:dividerPadding=\"0dip\">\n        <LinearLayout\n            android:divider=\"@android:drawable/divider_vertical\"\n            android:showDividers=\"middle\"\n            android:dividerPadding=\"0dp\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:orientation=\"horizontal\"\n            android:layoutDirection=\"locale\"\n            android:measureWithLargestChild=\"true\">\n            <Button android:id=\"button2\"\n                    android:layout_width=\"wrap_content\"\n                    android:layout_gravity=\"start\"\n                    android:layout_weight=\"1\"\n                    android:maxLines=\"2\"\n                    android:paddingStart=\"4dp\"\n                    android:paddingEnd=\"4dp\"\n                    android:background=\"@android:drawable/item_background\"\n                    android:textSize=\"14sp\"\n                    android:minHeight=\"48dp\"\n                    android:layout_height=\"wrap_content\"/>\n            <Button android:id=\"button3\"\n                    android:layout_width=\"wrap_content\"\n                    android:layout_gravity=\"center_horizontal\"\n                    android:layout_weight=\"1\"\n                    android:maxLines=\"2\"\n                    android:paddingStart=\"4dp\"\n                    android:paddingEnd=\"4dp\"\n                    android:background=\"@android:drawable/item_background\"\n                    android:textSize=\"14sp\"\n                    android:minHeight=\"48dp\"\n                    android:layout_height=\"wrap_content\"/>\n            <Button android:id=\"button1\"\n                    android:layout_width=\"wrap_content\"\n                    android:layout_gravity=\"end\"\n                    android:layout_weight=\"1\"\n                    android:maxLines=\"2\"\n                    android:paddingStart=\"4dp\"\n                    android:paddingEnd=\"4dp\"\n                    android:background=\"@android:drawable/item_background\"\n                    android:textSize=\"14sp\"\n                    android:minHeight=\"48dp\"\n                    android:layout_height=\"wrap_content\"/>\n        </LinearLayout>\n     </LinearLayout>\n</LinearLayout>\n"
  },
  {
    "path": "src/res/layout/alert_dialog_progress.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2011 The Android Open Source Project\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"wrap_content\" android:layout_height=\"match_parent\">\n    <ProgressBar android:id=\"progress\"\n                 style=\"@android:attr/progressBarStyleHorizontal\"\n                 android:layout_width=\"match_parent\"\n                 android:layout_height=\"wrap_content\"\n                 android:layout_marginTop=\"16dip\"\n                 android:layout_marginBottom=\"1dip\"\n                 android:layout_marginStart=\"16dip\"\n                 android:layout_marginEnd=\"16dip\"\n                 android:layout_centerHorizontal=\"true\"/>\n    <TextView\n            android:id=\"progress_percent\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:paddingBottom=\"16dip\"\n            android:layout_marginStart=\"16dip\"\n            android:layout_marginEnd=\"16dip\"\n            android:layout_alignParentStart=\"true\"\n            android:layout_below=\"progress\"\n    />\n    <TextView\n            android:id=\"progress_number\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:paddingBottom=\"16dip\"\n            android:layout_marginStart=\"16dip\"\n            android:layout_marginEnd=\"16dip\"\n            android:layout_alignParentEnd=\"true\"\n            android:layout_below=\"progress\"\n    />\n</RelativeLayout>\n"
  },
  {
    "path": "src/res/layout/popup_menu_item_layout.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2010 The Android Open Source Project\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n  \n          http://www.apache.org/licenses/LICENSE-2.0\n  \n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"48dp\"\n    android:minWidth=\"196dip\"\n    android:paddingEnd=\"16dip\">\n\n    <ImageView\n            android:id=\"icon\"\n            android:visibility=\"gone\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:layout_gravity=\"center_vertical\"\n            android:layout_marginStart=\"8dip\"\n            android:layout_marginEnd=\"-8dip\"\n            android:layout_marginTop=\"8dip\"\n            android:layout_marginBottom=\"8dip\"\n            android:scaleType=\"centerInside\"\n            android:duplicateParentState=\"true\"/>\n    \n    <!-- The title and summary have some gap between them, and this 'group' should be centered vertically. -->\n    <RelativeLayout\n        android:layout_width=\"0dip\"\n        android:layout_weight=\"1\"\n        android:layout_height=\"wrap_content\"\n        android:layout_gravity=\"center_vertical\"\n        android:layout_marginStart=\"16dip\"\n        android:duplicateParentState=\"true\">\n\n        <TextView\n                android:id=\"title\"\n                android:layout_width=\"match_parent\"\n                android:layout_height=\"wrap_content\"\n                android:layout_alignParentTop=\"true\"\n                android:layout_alignParentStart=\"true\"\n\n                android:textColor=\"@android:color/primary_text_dark_disable_only\"\n                android:textSize=\"18sp\"\n\n                android:singleLine=\"true\"\n                android:duplicateParentState=\"true\"\n                android:ellipsize=\"marquee\"\n                android:fadingEdge=\"horizontal\"\n                android:textAlignment=\"viewStart\"/>\n\n        <TextView\n                android:id=\"shortcut\"\n                android:visibility=\"gone\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:layout_below=\"title\"\n                android:layout_alignParentStart=\"true\"\n\n                android:textColor=\"@android:color/primary_text_dark_disable_only\"\n                android:textSize=\"12sp\"\n\n                android:singleLine=\"true\"\n                android:duplicateParentState=\"true\"\n                android:textAlignment=\"viewStart\"/>\n\n    </RelativeLayout>\n\n    <!-- Checkbox, and/or radio button will be inserted here. -->\n    \n</LinearLayout>\n"
  },
  {
    "path": "src/res/layout/select_dialog.xml",
    "content": "<!--\n/*\n** Copyright 2010, The Android Open Source Project\n**\n** Licensed under the Apache License, Version 2.0 (the \"License\");\n** you may not use this file except in compliance with the License.\n** You may obtain a copy of the License at\n**\n**     http://www.apache.org/licenses/LICENSE-2.0\n**\n** Unless required by applicable law or agreed to in writing, software\n** distributed under the License is distributed on an \"AS IS\" BASIS,\n** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n** See the License for the specific language governing permissions and\n** limitations under the License.\n*/\n-->\n\n<!--\n    This layout file is used by the AlertDialog when displaying a list of items.\n    This layout file is inflated and used as the ListView to display the items.\n    Assign an ID so its state will be saved/restored.\n-->\n<view class=\"android.app.AlertController.RecycleListView\"\n      xmlns:android=\"http://schemas.android.com/apk/res/android\"\n      android:id=\"select_dialog_listview\"\n      android:layout_width=\"match_parent\"\n      android:layout_height=\"match_parent\"\n      android:cacheColorHint=\"@null\"\n      android:divider=\"@android:drawable/list_divider\"\n      android:scrollbars=\"vertical\"\n      android:overScrollMode=\"ifContentScrolls\"\n      android:textAlignment=\"viewStart\"/>\n"
  },
  {
    "path": "src/res/layout/select_dialog_item.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n/*\n** Copyright 2010, The Android Open Source Project\n**\n** Licensed under the Apache License, Version 2.0 (the \"License\");\n** you may not use this file except in compliance with the License.\n** You may obtain a copy of the License at\n**\n**     http://www.apache.org/licenses/LICENSE-2.0\n**\n** Unless required by applicable law or agreed to in writing, software\n** distributed under the License is distributed on an \"AS IS\" BASIS,\n** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n** See the License for the specific language governing permissions and\n** limitations under the License.\n*/\n-->\n\n<!--\n    This layout file is used by the AlertDialog when displaying a list of items.\n    This layout file is inflated and used as the TextView to display individual\n    items.\n-->\n<TextView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n          android:id=\"text1\"\n          android:layout_width=\"match_parent\"\n          android:layout_height=\"wrap_content\"\n          android:minHeight=\"48dp\"\n          android:textSize=\"18sp\"\n          android:gravity=\"center_vertical\"\n          android:paddingStart=\"16dip\"\n          android:paddingEnd=\"16dip\"\n          android:ellipsize=\"end\"\n/>\n"
  },
  {
    "path": "src/res/layout/select_dialog_multichoice.xml",
    "content": "\n<!-- Copyright (C) 2010 The Android Open Source Project\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<CheckedTextView\n        xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:id=\"text1\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:minHeight=\"48dp\"\n        android:textSize=\"18sp\"\n        android:gravity=\"center_vertical\"\n        android:paddingStart=\"16dip\"\n        android:paddingEnd=\"16dip\"\n        android:checkMark=\"@android:drawable/btn_check\"\n        android:ellipsize=\"end\"\n/>\n"
  },
  {
    "path": "src/res/layout/select_dialog_singlechoice.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2010 The Android Open Source Project\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<CheckedTextView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n                 android:id=\"text1\"\n                 android:layout_width=\"match_parent\"\n                 android:layout_height=\"wrap_content\"\n                 android:minHeight=\"48dp\"\n                 android:textSize=\"18sp\"\n                 android:gravity=\"center_vertical\"\n                 android:paddingStart=\"16dip\"\n                 android:paddingEnd=\"16dip\"\n                 android:checkMark=\"@android:drawable/btn_radio\"\n                 android:ellipsize=\"end\"\n/>\n"
  },
  {
    "path": "src/res/layout/simple_spinner_dropdown_item.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n/* //device/apps/common/assets/res/any/layout/simple_spinner_item.xml\n**\n** Copyright 2008, The Android Open Source Project\n**\n** Licensed under the Apache License, Version 2.0 (the \"License\"); \n** you may not use this file except in compliance with the License. \n** You may obtain a copy of the License at \n**\n**     http://www.apache.org/licenses/LICENSE-2.0 \n**\n** Unless required by applicable law or agreed to in writing, software \n** distributed under the License is distributed on an \"AS IS\" BASIS, \n** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \n** See the License for the specific language governing permissions and \n** limitations under the License.\n*/\n-->\n<CheckedTextView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n                 android:id=\"text1\"\n\n                 android:paddingStart=\"8dp\"\n                 android:paddingEnd=\"8dp\"\n                 android:textColor=\"@android:color/primary_text_light_disable_only\"\n\n                 android:gravity=\"center_vertical\"\n                 android:singleLine=\"true\"\n                 android:layout_width=\"match_parent\"\n                 android:layout_height=\"48dp\"\n                 android:ellipsize=\"end\"\n                 android:textAlignment=\"inherit\"/>\n"
  },
  {
    "path": "src/res/layout/simple_spinner_item.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n/* //device/apps/common/assets/res/any/layout/simple_spinner_item.xml\n**\n** Copyright 2006, The Android Open Source Project\n**\n** Licensed under the Apache License, Version 2.0 (the \"License\"); \n** you may not use this file except in compliance with the License. \n** You may obtain a copy of the License at \n**\n**     http://www.apache.org/licenses/LICENSE-2.0 \n**\n** Unless required by applicable law or agreed to in writing, software \n** distributed under the License is distributed on an \"AS IS\" BASIS, \n** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \n** See the License for the specific language governing permissions and \n** limitations under the License.\n*/\n-->\n<TextView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n          android:id=\"text1\"\n\n          android:paddingStart=\"8dp\"\n          android:paddingEnd=\"8dp\"\n          android:textColor=\"@android:color/primary_text_light_disable_only\"\n\n          android:gravity=\"center_vertical\"\n          android:singleLine=\"true\"\n          android:layout_width=\"match_parent\"\n          android:layout_height=\"wrap_content\"\n          android:ellipsize=\"end\"\n          android:textAlignment=\"inherit\"/>\n"
  },
  {
    "path": "src/res/layout/transient_notification.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n/* //device/apps/common/res/layout/transient_notification.xml\n**\n** Copyright 2006, The Android Open Source Project\n**\n** Licensed under the Apache License, Version 2.0 (the \"License\");\n** you may not use this file except in compliance with the License.\n** You may obtain a copy of the License at\n**\n**     http://www.apache.org/licenses/LICENSE-2.0\n**\n** Unless required by applicable law or agreed to in writing, software\n** distributed under the License is distributed on an \"AS IS\" BASIS,\n** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n** See the License for the specific language governing permissions and\n** limitations under the License.\n*/\n-->\n\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\"\n    android:background=\"@android:drawable/toast_frame\">\n\n    <TextView\n            android:id=\"message\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:layout_weight=\"1\"\n            android:layout_gravity=\"center_horizontal\"\n            android:textColor=\"white\"\n            android:shadowColor=\"#BB000000\"\n            android:shadowRadius=\"2.75\"\n    />\n\n</LinearLayout>\n\n\n"
  },
  {
    "path": "src/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"removeComments\": true,\n    \"target\":\"ES6\",\n    \"outFile\": \"../dist/android-ui.js\",\n    \"declaration\" : true,\n    \"sourceMap\": false\n  },\n  \"files\": [\n    \"pack_enter\"\n  ],\n  \"exclude\": [\n    \"node_modules\"\n  ]\n}"
  }
]